From b4bc995250521e69ae6a5445f6badcfc49e5376c Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Tue, 9 Feb 2016 11:30:53 -0600 Subject: [PATCH 001/302] TESTING (but seems to be fine): slight cleanup, allow for using "oracle" or "sun" interchangably in config, force use of JNI 1.4 or better since nobody uses java 1.2 or 1.3 for this anyway --- .../serverScript/src/shared/JavaLibrary.cpp | 55 +++++++++++++------ 1 file changed, 39 insertions(+), 16 deletions(-) diff --git a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp index 5802a20d..277f0f67 100755 --- a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp +++ b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp @@ -69,8 +69,8 @@ using namespace JNIWrappersNamespace; #include #endif -#ifndef JNI_VERSION_1_2 -#error JNI version 1.2 or better only! +#ifndef JNI_VERSION_1_4 +#error JNI version 1.4 or better only! #endif //======================================================================== @@ -1026,16 +1026,17 @@ void JavaLibrary::initializeJavaThread() if (javaVMName == NULL || ( strcmp(javaVMName, "none") != 0 && strcmp(javaVMName, "ibm") != 0 && - strcmp(javaVMName, "sun") != 0)) + strcmp(javaVMName, "sun") != 0 && + strcmp(javaVMName, "oracle") != 0)) { FATAL(true, ("[ServerGame] javaVMName not defined. Valid values are: " - "none, ibm, or sun")); + "none, ibm, oracle, or sun")); } else if (strcmp(javaVMName, "ibm") == 0) { ms_javaVmType = JV_ibm; } - else if (strcmp(javaVMName, "sun") == 0) + else if (strcmp(javaVMName, "sun") == 0 || strcmp(javaVMName, "oracle") == 0) { ms_javaVmType = JV_sun; } @@ -1188,10 +1189,6 @@ void JavaLibrary::initializeJavaThread() { tempOption.optionString = "-Xoss768k"; options.push_back(tempOption); - } - - if (ms_javaVmType == JV_ibm) - { tempOption.optionString = "-Xcheck:jni"; options.push_back(tempOption); tempOption.optionString = "-Xcheck:nabounds"; @@ -1224,7 +1221,6 @@ void JavaLibrary::initializeJavaThread() options.push_back(tempOption); } -#ifdef JNI_VERSION_1_4 if ((!ms_javaVmType) == JV_ibm) { tempOption.optionString = "-Xrs"; @@ -1238,8 +1234,6 @@ void JavaLibrary::initializeJavaThread() options.push_back(tempOption); } -#endif - #ifdef REMOTE_DEBUG_ON char *jdwpBuffer = NULL; if (ConfigServerGame::getUseRemoteDebugJava()) @@ -1288,11 +1282,40 @@ void JavaLibrary::initializeJavaThread() tempOption.optionString = const_cast(classPath.c_str()); options.push_back(tempOption); -#ifdef JNI_VERSION_1_4 - vm_args.version = JNI_VERSION_1_4; -#else - vm_args.version = JNI_VERSION_1_2; + +#ifdef JNI_VERSION_1_8 + vm_args.version = JNI_VERSION_1_8; +#define JAVAVERSET = 1 #endif + +#ifndef JAVAVERSET +#ifdef JNI_VERSION_1_7 + vm_args.version = JNI_VERSION_1_7; +#define JAVAVERSET = 1 +#endif +#endif + +#ifndef JAVAVERSET +#ifdef JNI_VERSION_1_6 + vm_args.version = JNI_VERSION_1_6; +#define JAVAVERSET = 1 +#endif +#endif + +#ifndef JAVAVERSET +#ifdef JNI_VERSION_1_5 + vm_args.version = JNI_VERSION_1_5; +#define JAVAVERSET = 1 +#endif +#endif + +#ifndef JAVAVERSET +#ifdef JNI_VERSION_1_4 + vm_args.version = JNI_VERSION_1_4; +#define JAVAVERSET = 1 +#endif +#endif + vm_args.options = &options[0]; vm_args.nOptions = options.size(); vm_args.ignoreUnrecognized = JNI_FALSE; From b123c482e6df6303ddb8a5dafa365606d4e8eca0 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Tue, 9 Feb 2016 11:36:34 -0600 Subject: [PATCH 002/302] remove the def once we're done --- engine/server/library/serverScript/src/shared/JavaLibrary.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp index 277f0f67..18dd6c4e 100755 --- a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp +++ b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp @@ -1314,6 +1314,10 @@ void JavaLibrary::initializeJavaThread() vm_args.version = JNI_VERSION_1_4; #define JAVAVERSET = 1 #endif +#endif + +#ifdef JAVAVERSET +#undef JAVAVERSET #endif vm_args.options = &options[0]; From f1c197e700e726d768006f0e91b4ecceaa5bb7eb Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Tue, 9 Feb 2016 17:32:47 -0600 Subject: [PATCH 003/302] Remove code that seems to be unnecessary now that we no longer use stlport --- external/ours/library/archive/src/shared/AutoDeltaSet.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/external/ours/library/archive/src/shared/AutoDeltaSet.h b/external/ours/library/archive/src/shared/AutoDeltaSet.h index a548dce4..9f64da22 100644 --- a/external/ours/library/archive/src/shared/AutoDeltaSet.h +++ b/external/ours/library/archive/src/shared/AutoDeltaSet.h @@ -184,12 +184,6 @@ inline typename AutoDeltaSet::const_iterator AutoDeltaSet m_commands.push_back(c); ++m_baselineCommandCount; - // @note apathy - hack to convert from const_iterator to iterator as requried by STLPort - typename SetType::iterator tmp(m_set.begin()); - std::advance(tmp, std::distance(tmp, i)); - i++; - m_set.erase(tmp); - touch(); onErase(c.value); onChanged(); From 845cc346808f920166a76a1a39c7cbfb1298350f Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Tue, 9 Feb 2016 17:36:47 -0600 Subject: [PATCH 004/302] some style and logic cleanups that were annoying me --- .../serverScript/src/shared/JavaLibrary.cpp | 35 ++++--------------- 1 file changed, 7 insertions(+), 28 deletions(-) diff --git a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp index 18dd6c4e..2b868749 100755 --- a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp +++ b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp @@ -50,19 +50,6 @@ using namespace JNIWrappersNamespace; #error Unsupported platform #endif -#if !defined(JNI_IBM_JAVA) && defined(WIN32) -//-- Justin Randall [1/21/2003 4:43:15 PM] -- -// The scripting system simply will not work properly with -// our linux servers running the ibm java vm if the win32 -// server is not also using that vm. There are serialization -// issues that render the game useless. Please do not -// change this until the broken interaction between various -// VM's has been rectified! -//#error Unsupported Java VM -#endif//JNI_IBM_JAVA - -//#undef JNI_IBM_JAVA - #ifdef linux // shared library includes #include @@ -771,7 +758,7 @@ void JavaLibrary::throwScriptException(char const * const format, ...) va_list va; va_start(va, format); - throwScriptException(format, va); + throwScriptException(format, va); va_end(va); } @@ -1147,11 +1134,8 @@ void JavaLibrary::initializeJavaThread() // set up the args to initialize the jvm std::string classPath = "-Djava.class.path="; -// classPath += PATH_SEPARATOR; classPath += ConfigServerGame::getScriptPath(); -// DEBUG_REPORT_LOG(true, ("Java class path = %s\n", classPath.c_str())); - JavaVMInitArgs vm_args; JavaVMOption tempOption = {NULL, NULL}; std::vector options; @@ -1159,11 +1143,6 @@ void JavaLibrary::initializeJavaThread() UNREF(jdwpBuffer); -// classPath += PATH_SEPARATOR; -// classPath += "/home/sjakab/temp/OptimizeitSuiteDemo/lib/optit.jar"; -// tempOption.optionString = "-Xnoclassgc"; -// options.push_back(tempOption); - if (ConfigServerScript::hasJavaOptions()) { int const numberOfJavaOptions = ConfigServerScript::getNumberOfJavaOptions(); @@ -1184,7 +1163,8 @@ void JavaLibrary::initializeJavaThread() tempOption.optionString = "-Xmx512m"; options.push_back(tempOption); tempOption.optionString = "-Xss768k"; - options.push_back(tempOption); + options.push_back(tempOption); + if (ms_javaVmType == JV_ibm) { tempOption.optionString = "-Xoss768k"; @@ -1207,7 +1187,6 @@ void JavaLibrary::initializeJavaThread() tempOption.optionString = "-Xint"; options.push_back(tempOption); } - tempOption.optionString = "-Xincgc"; options.push_back(tempOption); } @@ -1220,8 +1199,7 @@ void JavaLibrary::initializeJavaThread() tempOption.optionString = "-verbose:class"; options.push_back(tempOption); } - - if ((!ms_javaVmType) == JV_ibm) + if (ms_javaVmType != JV_ibm) { tempOption.optionString = "-Xrs"; options.push_back(tempOption); @@ -1247,11 +1225,13 @@ void JavaLibrary::initializeJavaThread() } tempOption.optionString = "-Xdebug"; options.push_back(tempOption); + // we need to copy the -Xrunjdwp parameter into a char buffer due to a bug // in the Java VM const char * jdwpString = "-Xrunjdwp:transport=dt_socket,server=y,suspend=n"; jdwpBuffer = new char[strlen(jdwpString) + 32]; strcpy(jdwpBuffer, jdwpString); + if (ConfigServerGame::getJavaDebugPort()[0] == '\0') { strcat(jdwpBuffer, ",address="); @@ -1282,7 +1262,6 @@ void JavaLibrary::initializeJavaThread() tempOption.optionString = const_cast(classPath.c_str()); options.push_back(tempOption); - #ifdef JNI_VERSION_1_8 vm_args.version = JNI_VERSION_1_8; #define JAVAVERSET = 1 @@ -1322,7 +1301,7 @@ void JavaLibrary::initializeJavaThread() vm_args.options = &options[0]; vm_args.nOptions = options.size(); - vm_args.ignoreUnrecognized = JNI_FALSE; + vm_args.ignoreUnrecognized = JNI_TRUE; // create the JVM JNIEnv * env = NULL; From 76493024cf574abbbca6b6ea4534118b5bf77b64 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Tue, 9 Feb 2016 19:04:54 -0600 Subject: [PATCH 005/302] update note, java should in theory just die on it's own because the kernel apparently will kill itw --- engine/server/library/serverScript/src/shared/JavaLibrary.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp index 2b868749..e84c354c 100755 --- a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp +++ b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp @@ -866,7 +866,7 @@ void JavaLibrary::fatalHandler(int signum) else { // destroy Java threads - // @note apathy - this pthread method is not in later versions of glibc + // this pthread method is not in later versions of glibc as the kernel should handle the kill //pthread_kill_other_threads_np(); ms_instance = NULL; ms_env = NULL; From 66904dc582548a4814203c2b5ae12b99ec738dd1 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Tue, 9 Feb 2016 19:57:22 -0600 Subject: [PATCH 006/302] to the shitcan with flags that break things --- .../server/library/serverScript/src/shared/JavaLibrary.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp index e84c354c..69712e48 100755 --- a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp +++ b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp @@ -1199,13 +1199,6 @@ void JavaLibrary::initializeJavaThread() tempOption.optionString = "-verbose:class"; options.push_back(tempOption); } - if (ms_javaVmType != JV_ibm) - { - tempOption.optionString = "-Xrs"; - options.push_back(tempOption); - tempOption.optionString = "-Xcheck:jni"; - options.push_back(tempOption); - } if (ConfigServerGame::getLogJavaGc()) { tempOption.optionString = "-Xloggc:javagc.log"; From 090aaeb2cef77191a3bc486a879441cfd6db47b8 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Wed, 10 Feb 2016 09:35:57 -0600 Subject: [PATCH 007/302] add optional java 9 support --- .../library/serverScript/src/shared/JavaLibrary.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp index 69712e48..0023408c 100755 --- a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp +++ b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp @@ -1255,11 +1255,19 @@ void JavaLibrary::initializeJavaThread() tempOption.optionString = const_cast(classPath.c_str()); options.push_back(tempOption); -#ifdef JNI_VERSION_1_8 - vm_args.version = JNI_VERSION_1_8; +// the below is ok but could use the dynamic function call too if we want someday +#ifdef JNI_VERSION_1_9 + vm_args.version = JNI_VERSION_1_9; #define JAVAVERSET = 1 #endif +#ifndef JAVAVERSET +#ifdef JNI_VERSION_1_8 + vm_args.version = JNI_VERSION_1_8; +#define JAVAVERSET = 1 +#endif +#endif + #ifndef JAVAVERSET #ifdef JNI_VERSION_1_7 vm_args.version = JNI_VERSION_1_7; From 6e893ad8c8a50fde231df18d16354bf380127c21 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Wed, 10 Feb 2016 10:18:42 -0600 Subject: [PATCH 008/302] cmake's still not always respecting JAVA_HOME --- cmake/linux/FindJNI.cmake | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmake/linux/FindJNI.cmake b/cmake/linux/FindJNI.cmake index da46a7d2..fc15c9cc 100644 --- a/cmake/linux/FindJNI.cmake +++ b/cmake/linux/FindJNI.cmake @@ -103,6 +103,10 @@ JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES ${_JAVA_HOME}/jre/bin/classic ${_JAVA_HOME}/lib ${_JAVA_HOME} + /opt/java17/jre/lib/i386 + /opt/java17/jre/lib + /opt/java17/jre + /opt/java17/lib /usr/java/jre/lib/i386 /usr/java/jre/lib /usr/lib @@ -152,6 +156,8 @@ set(JAVA_AWT_INCLUDE_DIRECTORIES "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/include" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\${java_install_version};JavaHome]/include" ${_JAVA_HOME}/include + /opt/java17/include + /opt/java17/jre/include /usr/include /usr/local/include /usr/lib/java/include From a7f2d0ea6a82506794edd8b236d67a48ff3e988f Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Wed, 10 Feb 2016 16:23:27 -0600 Subject: [PATCH 009/302] the code for trapping script crashes breaks things, apparently... TODO: maybe find the new/proper way to do this since it's kinda important, or just fix our scripts and have no need for crashes --- .../serverScript/src/shared/JavaLibrary.cpp | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp index 0023408c..39dfced2 100755 --- a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp +++ b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp @@ -1324,17 +1324,6 @@ void JavaLibrary::initializeJavaThread() } ms_loaded = 1; -#ifdef linux - if (ConfigServerGame::getTrapScriptCrashes()) - { - //set up signal handler for fatals in linux - OurSa.sa_handler = fatalHandler; - sigemptyset(&OurSa.sa_mask); - OurSa.sa_flags = 0; - IGNORE_RETURN(sigaction(SIGSEGV, &OurSa, &JavaSa)); - } -#endif - // wait until the main thread tells us to shutdown ms_shutdownJava->wait(); @@ -1342,13 +1331,6 @@ void JavaLibrary::initializeJavaThread() IGNORE_RETURN(ms_jvm->DestroyJavaVM()); ms_jvm = NULL; -#ifdef linux - if (ConfigServerGame::getTrapScriptCrashes()) - { - // restore the default signal handler - IGNORE_RETURN(sigaction(SIGSEGV, &OrgSa, NULL)); - } -#endif #if defined(_WIN32) IGNORE_RETURN(FreeLibrary(static_cast(libHandle))); From 3e4cc36e7eef674ac9fcb44d7118cdbacf693076 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Thu, 11 Feb 2016 15:16:14 -0600 Subject: [PATCH 010/302] newer standards prefer nullptr over NULL - this is most of them but there are others too --- .../Miff/src/linux/InputFileHandler.cpp | 2 +- .../Miff/src/linux/OutputFileHandler.cpp | 4 +- .../application/Miff/src/linux/miff.cpp | 12 +- .../src/shared/AuctionTransferClient.cpp | 2 +- .../ATGenericAPI/GenericApiCore.cpp | 16 +- .../ATGenericAPI/GenericConnection.cpp | 20 +- .../AuctionTransferAPI.cpp | 10 +- .../AuctionTransferGameAPI/Base/Archive.cpp | 4 +- .../shared/AuctionTransferGameAPI/Request.cpp | 6 +- .../TcpLibrary/IPAddress.h | 2 +- .../TcpLibrary/TcpBlockAllocator.cpp | 6 +- .../TcpLibrary/TcpConnection.cpp | 64 +- .../TcpLibrary/TcpConnection.h | 2 +- .../TcpLibrary/TcpManager.cpp | 106 +- .../TcpLibrary/TcpManager.h | 4 +- .../AuctionTransferGameAPI/zip/GZipHelper.h | 4 +- .../AuctionTransferGameAPI/zip/Zip/zlib.h | 38 +- .../AuctionTransferGameAPI/zip/Zip/zutil.h | 4 +- .../src/shared/CentralCSHandler.h | 2 +- .../src/shared/CentralServer.cpp | 64 +- .../CentralServer/src/shared/CentralServer.h | 2 +- .../src/shared/CentralServerMetricsData.cpp | 10 +- .../src/shared/CharacterCreationTracker.cpp | 8 +- .../src/shared/ConsoleCommandParserGame.cpp | 6 +- .../src/shared/ConsoleManager.cpp | 2 +- .../src/shared/PlanetManager.cpp | 2 +- .../application/ChatServer/src/linux/main.cpp | 2 +- .../src/shared/CentralServerConnection.cpp | 2 +- .../ChatServer/src/shared/ChatInterface.cpp | 144 +-- .../ChatServer/src/shared/ChatServer.cpp | 104 +- .../src/shared/ChatServerRoomOwner.cpp | 2 +- .../ChatServer/src/shared/VChatInterface.cpp | 12 +- .../CommoditiesServer/src/linux/main.cpp | 2 +- .../CommoditiesServer/src/shared/Auction.cpp | 54 +- .../src/shared/AuctionLocation.cpp | 6 +- .../src/shared/AuctionMarket.cpp | 30 +- .../src/shared/CommodityServer.cpp | 10 +- .../src/shared/CommodityServerMetricsData.cpp | 2 +- .../ConnectionServer/src/linux/main.cpp | 2 +- .../src/shared/ClientConnection.cpp | 32 +- .../src/shared/ConnectionServer.cpp | 24 +- .../src/shared/GameConnection.cpp | 4 +- .../src/shared/PseudoClientConnection.cpp | 4 +- .../src/shared/SessionApiClient.cpp | 18 +- .../CustomerServiceServer/src/linux/main.cpp | 2 +- .../src/shared/CentralServerConnection.cpp | 8 +- .../src/shared/ChatServerConnection.cpp | 4 +- .../shared/ConfigCustomerServiceServer.cpp | 12 +- .../src/shared/CustomerServiceInterface.cpp | 104 +- .../src/shared/CustomerServiceServer.cpp | 28 +- .../LogServer/src/shared/LoggingServerApi.cpp | 52 +- .../LoginServer/src/linux/main.cpp | 2 +- .../src/shared/CSToolConnection.cpp | 4 +- .../src/shared/CentralServerConnection.cpp | 4 +- .../src/shared/ClientConnection.cpp | 4 +- .../LoginServer/src/shared/ConsoleManager.cpp | 2 +- .../LoginServer/src/shared/LoginServer.cpp | 30 +- .../LoginServer/src/shared/LoginServer.h | 2 +- .../src/shared/SessionApiClient.cpp | 2 +- .../src/shared/TaskCreateCharacter.cpp | 2 +- .../src/shared/TaskGetCharactersForDelete.cpp | 2 +- .../MetricsServer/src/linux/main.cpp | 2 +- .../src/shared/MetricsGatheringConnection.cpp | 20 +- .../src/shared/MetricsServer.cpp | 4 +- .../PlanetServer/src/linux/main.cpp | 2 +- .../src/shared/ConsoleCommandParser.cpp | 2 +- .../src/shared/ConsoleManager.cpp | 2 +- .../src/shared/GameServerData.cpp | 6 +- .../src/shared/PlanetProxyObject.cpp | 8 +- .../PlanetServer/src/shared/PlanetServer.cpp | 32 +- .../PlanetServer/src/shared/PlanetServer.h | 2 +- .../src/shared/PreloadManager.cpp | 2 +- .../PlanetServer/src/shared/Scene.cpp | 10 +- .../src/linux/main.cpp | 2 +- .../TaskManager/src/linux/ConsoleInput.cpp | 2 +- .../TaskManager/src/linux/ProcessSpawner.cpp | 2 +- .../TaskManager/src/linux/main.cpp | 2 +- .../TaskManager/src/shared/GameConnection.cpp | 2 +- .../TaskManager/src/shared/Locator.cpp | 6 +- .../src/shared/ManagerConnection.cpp | 4 +- .../TaskManager/src/shared/TaskManager.cpp | 10 +- .../src/shared/CTSAPIClient.cpp | 16 +- .../src/shared/ConsoleManager.cpp | 2 +- .../src/shared/TransferServer.cpp | 34 +- .../src/shared/ConsoleManager.cpp | 2 +- .../serverDatabase/src/shared/DataLookup.cpp | 4 +- .../src/shared/DatabaseProcess.cpp | 4 +- .../ImmediateDeleteCustomPersistStep.cpp | 2 +- .../serverDatabase/src/shared/LazyDeleter.cpp | 16 +- .../serverDatabase/src/shared/Loader.cpp | 18 +- .../src/shared/MessageToManager.cpp | 10 +- .../serverDatabase/src/shared/Persister.cpp | 34 +- .../src/shared/TaskGetBiography.cpp | 6 +- .../src/shared/TaskSetBiography.cpp | 2 +- .../src/shared/ai/AggroListProperty.cpp | 16 +- .../src/shared/ai/AiCombatPulseQueue.cpp | 6 +- .../src/shared/ai/AiCreatureCombatProfile.cpp | 10 +- .../src/shared/ai/AiCreatureData.cpp | 12 +- .../src/shared/ai/AiCreatureWeaponActions.cpp | 8 +- .../src/shared/ai/AiMovementArchive.cpp | 6 +- .../src/shared/ai/AiMovementBase.cpp | 26 +- .../src/shared/ai/AiMovementLoiter.cpp | 18 +- .../src/shared/ai/AiMovementMove.cpp | 4 +- .../src/shared/ai/AiMovementPathFollow.cpp | 8 +- .../src/shared/ai/AiMovementPatrol.cpp | 30 +- .../src/shared/ai/AiMovementSwarm.cpp | 28 +- .../src/shared/ai/AiMovementTarget.cpp | 10 +- .../shared/ai/AiMovementWanderInterior.cpp | 16 +- .../src/shared/ai/AiMovementWaypoint.cpp | 4 +- .../src/shared/ai/AiTargetingSystem.cpp | 2 +- .../serverGame/src/shared/ai/Formation.cpp | 4 +- .../serverGame/src/shared/ai/HateList.cpp | 46 +- .../serverGame/src/shared/ai/HateList.h | 2 +- .../serverGame/src/shared/ai/Squad.cpp | 6 +- .../behavior/AiCreatureStateArchive.cpp | 6 +- .../src/shared/behavior/AiLocation.cpp | 44 +- .../behavior/AiShipAttackTargetList.cpp | 22 +- .../behavior/AiShipBehaviorAttackBomber.cpp | 6 +- .../AiShipBehaviorAttackCapitalShip.cpp | 2 +- .../behavior/AiShipBehaviorAttackFighter.cpp | 28 +- .../AiShipBehaviorAttackFighter_Maneuver.cpp | 16 +- .../shared/behavior/AiShipBehaviorDock.cpp | 30 +- .../shared/behavior/AiShipBehaviorFollow.cpp | 18 +- .../shared/behavior/AiShipBehaviorIdle.cpp | 2 +- .../shared/behavior/AiShipBehaviorTrack.cpp | 4 +- .../behavior/AiShipBehaviorWaypoint.cpp | 14 +- .../behavior/ShipTurretTargetingSystem.cpp | 4 +- .../shared/collision/CollisionCallbacks.cpp | 12 +- .../src/shared/command/CommandCppFuncs.cpp | 414 ++++---- .../src/shared/command/CommandQueue.cpp | 38 +- .../src/shared/command/CommandQueue.h | 2 +- .../commoditiesMarket/CommoditiesMarket.cpp | 46 +- .../CommoditiesServerConnection.cpp | 2 +- .../shared/console/ConsoleCommandParserAi.cpp | 78 +- .../console/ConsoleCommandParserCity.cpp | 2 +- .../ConsoleCommandParserCollection.cpp | 56 +- .../console/ConsoleCommandParserCraft.cpp | 4 +- .../ConsoleCommandParserCraftStation.cpp | 30 +- .../console/ConsoleCommandParserGuild.cpp | 10 +- .../ConsoleCommandParserManufacture.cpp | 56 +- .../console/ConsoleCommandParserMoney.cpp | 12 +- .../console/ConsoleCommandParserNpc.cpp | 8 +- .../console/ConsoleCommandParserObject.cpp | 288 ++--- .../console/ConsoleCommandParserObjvar.cpp | 16 +- .../console/ConsoleCommandParserPvp.cpp | 140 +-- .../console/ConsoleCommandParserResource.cpp | 18 +- .../console/ConsoleCommandParserScript.cpp | 12 +- .../console/ConsoleCommandParserServer.cpp | 154 +-- .../console/ConsoleCommandParserShip.cpp | 42 +- .../console/ConsoleCommandParserSkill.cpp | 32 +- .../console/ConsoleCommandParserSpaceAi.cpp | 46 +- .../console/ConsoleCommandParserVeteran.cpp | 6 +- .../src/shared/console/ConsoleManager.cpp | 10 +- .../src/shared/console/ConsoleManager.h | 6 +- .../controller/AiCreatureController.cpp | 204 ++-- .../shared/controller/AiShipController.cpp | 176 ++-- .../controller/AiShipControllerInterface.cpp | 18 +- .../shared/controller/CreatureController.cpp | 48 +- .../shared/controller/PlanetController.cpp | 6 +- .../controller/PlayerCreatureController.cpp | 84 +- .../controller/PlayerShipController.cpp | 18 +- .../shared/controller/ServerController.cpp | 24 +- .../src/shared/controller/ShipController.cpp | 66 +- .../shared/controller/TangibleController.cpp | 22 +- .../src/shared/core/AttribModNameManager.cpp | 20 +- .../src/shared/core/BiographyManager.cpp | 2 +- .../src/shared/core/CharacterMatchManager.cpp | 28 +- .../serverGame/src/shared/core/Client.cpp | 22 +- .../src/shared/core/ClusterWideDataClient.cpp | 2 +- .../src/shared/core/CombatTracker.cpp | 14 +- .../src/shared/core/CommunityManager.cpp | 22 +- .../src/shared/core/ConfigServerGame.cpp | 8 +- .../src/shared/core/ConfigServerGame.h | 2 +- .../src/shared/core/ContainerInterface.cpp | 52 +- .../src/shared/core/FormManagerServer.cpp | 16 +- .../serverGame/src/shared/core/GameServer.cpp | 94 +- .../serverGame/src/shared/core/GameServer.h | 8 +- .../src/shared/core/InstantDeleteList.cpp | 4 +- .../src/shared/core/LogoutTracker.cpp | 4 +- .../src/shared/core/MessageToQueue.cpp | 4 +- .../src/shared/core/NameManager.cpp | 24 +- .../src/shared/core/NewbieTutorial.cpp | 6 +- .../src/shared/core/NpcConversation.cpp | 14 +- .../src/shared/core/ObserveTracker.cpp | 4 +- .../core/PlayerCreationManagerServer.cpp | 4 +- .../src/shared/core/PositionUpdateTracker.cpp | 4 +- .../serverGame/src/shared/core/RegexList.cpp | 6 +- .../src/shared/core/ReportManager.cpp | 6 +- .../src/shared/core/SceneGlobalData.cpp | 2 +- .../shared/core/ServerBuffBuilderManager.cpp | 28 +- .../src/shared/core/ServerBuildoutManager.cpp | 24 +- .../core/ServerImageDesignerManager.cpp | 50 +- .../src/shared/core/ServerUIManager.cpp | 36 +- .../src/shared/core/ServerUIPage.cpp | 12 +- .../src/shared/core/ServerUniverse.cpp | 36 +- .../src/shared/core/ServerWorld.cpp | 84 +- .../src/shared/core/SetupServerGame.cpp | 4 +- .../src/shared/core/StaticLootItemManager.cpp | 8 +- .../src/shared/core/VeteranRewardManager.cpp | 40 +- .../src/shared/guild/GuildInterface.cpp | 20 +- .../shared/metrics/GameServerMetricsData.cpp | 2 +- .../serverGame/src/shared/network/Chat.cpp | 2 +- .../network/ConnectionServerConnection.cpp | 14 +- .../CustomerServiceServerConnection.cpp | 4 +- .../network/GameServerMessageArchive.cpp | 2 +- .../src/shared/object/BuildingObject.cpp | 16 +- .../src/shared/object/CellObject.cpp | 42 +- .../src/shared/object/CityObject.cpp | 20 +- .../src/shared/object/CreatureObject.cpp | 356 +++---- .../src/shared/object/CreatureObject.h | 6 +- .../shared/object/CreatureObject_Mounts.cpp | 42 +- .../shared/object/CreatureObject_Ships.cpp | 8 +- .../shared/object/DraftSchematicObject.cpp | 52 +- .../src/shared/object/FactoryObject.cpp | 146 +-- .../src/shared/object/GroupIdObserver.cpp | 4 +- .../src/shared/object/GroupObject.cpp | 2 +- .../src/shared/object/GuildObject.cpp | 42 +- .../object/HarvesterInstallationObject.cpp | 12 +- .../object/HarvesterInstallationObject.h | 2 +- .../src/shared/object/InstallationObject.cpp | 12 +- .../src/shared/object/IntangibleObject.cpp | 52 +- .../src/shared/object/LineOfSightCache.cpp | 8 +- .../object/ManufactureInstallationObject.cpp | 142 +-- .../object/ManufactureSchematicObject.cpp | 180 ++-- .../src/shared/object/MissionObject.cpp | 22 +- .../src/shared/object/ObjectFactory.cpp | 6 +- .../src/shared/object/ObjectTracker.cpp | 2 +- .../shared/object/PatrolPathNodeProperty.cpp | 2 +- .../src/shared/object/PlanetObject.cpp | 26 +- .../src/shared/object/PlayerObject.cpp | 324 +++--- .../src/shared/object/PlayerObject.h | 18 +- .../src/shared/object/PlayerQuestObject.cpp | 4 +- .../shared/object/ResourceContainerObject.cpp | 22 +- .../src/shared/object/ResourcePoolObject.cpp | 4 +- .../src/shared/object/ResourceTypeObject.cpp | 10 +- .../src/shared/object/ServerObject.cpp | 202 ++-- .../src/shared/object/ServerObject.h | 8 +- .../object/ServerObject_AuthTransfer.cpp | 4 +- .../object/ServerResourceClassObject.cpp | 2 +- .../src/shared/object/ShipObject.cpp | 64 +- .../shared/object/ShipObject_Components.cpp | 50 +- .../src/shared/object/StaticObject.cpp | 14 +- .../object/TangibleConditionObserver.cpp | 8 +- .../src/shared/object/TangibleObject.cpp | 256 ++--- .../src/shared/object/TangibleObject.h | 2 +- .../object/TangibleObject_Conversation.cpp | 34 +- .../src/shared/object/UniverseObject.cpp | 12 +- .../src/shared/object/WeaponObject.cpp | 14 +- .../objectTemplate/ServerArmorTemplate.cpp | 304 +++--- .../ServerBattlefieldMarkerObjectTemplate.cpp | 10 +- .../ServerBuildingObjectTemplate.cpp | 70 +- .../ServerCellObjectTemplate.cpp | 10 +- .../ServerCityObjectTemplate.cpp | 10 +- ...rverConstructionContractObjectTemplate.cpp | 10 +- .../ServerCreatureObjectTemplate.cpp | 558 +++++----- .../ServerDraftSchematicObjectTemplate.cpp | 428 ++++---- .../ServerFactoryObjectTemplate.cpp | 10 +- .../ServerGroupObjectTemplate.cpp | 10 +- .../ServerGuildObjectTemplate.cpp | 10 +- ...verHarvesterInstallationObjectTemplate.cpp | 166 +-- .../ServerInstallationObjectTemplate.cpp | 10 +- .../ServerIntangibleObjectTemplate.cpp | 304 +++--- ...rManufactureInstallationObjectTemplate.cpp | 10 +- ...rverManufactureSchematicObjectTemplate.cpp | 210 ++-- .../ServerMissionObjectTemplate.cpp | 10 +- .../objectTemplate/ServerObjectTemplate.cpp | 992 +++++++++--------- .../ServerPlanetObjectTemplate.cpp | 22 +- .../ServerPlayerObjectTemplate.cpp | 10 +- .../ServerPlayerQuestObjectTemplate.cpp | 10 +- .../ServerResourceContainerObjectTemplate.cpp | 58 +- .../ServerShipObjectTemplate.cpp | 22 +- .../ServerStaticObjectTemplate.cpp | 22 +- .../ServerTangibleObjectTemplate.cpp | 262 ++--- .../ServerUniverseObjectTemplate.cpp | 10 +- .../ServerVehicleObjectTemplate.cpp | 166 +-- .../ServerWeaponObjectTemplate.cpp | 586 +++++------ .../ServerXpManagerObjectTemplate.cpp | 12 +- .../library/serverGame/src/shared/pvp/Pvp.cpp | 6 +- .../src/shared/pvp/PvpRuleSetBase.cpp | 4 +- .../src/shared/pvp/PvpUpdateObserver.cpp | 8 +- .../serverGame/src/shared/region/Region.cpp | 6 +- .../src/shared/region/RegionMaster.cpp | 106 +- .../src/shared/resource/SurveySystem.cpp | 2 +- .../serverGame/src/shared/space/Missile.cpp | 4 +- .../src/shared/space/MissileManager.cpp | 14 +- .../src/shared/space/NebulaManagerServer.cpp | 8 +- .../src/shared/space/ProjectileManager.cpp | 12 +- .../shared/space/ServerAsteroidManager.cpp | 12 +- .../shared/space/ServerShipComponentData.cpp | 10 +- .../shared/space/ShipAiEnemySearchManager.cpp | 6 +- .../space/ShipComponentDataCargoHold.cpp | 2 +- .../shared/space/ShipComponentDataManager.cpp | 10 +- .../space/ShipInternalDamageOverTime.cpp | 10 +- .../ShipInternalDamageOverTimeManager.cpp | 14 +- .../src/shared/space/SpaceAttackSquad.cpp | 28 +- .../src/shared/space/SpaceDockingManager.cpp | 6 +- .../serverGame/src/shared/space/SpacePath.cpp | 8 +- .../src/shared/space/SpacePathManager.cpp | 6 +- .../src/shared/space/SpaceSquad.cpp | 50 +- .../src/shared/space/SpaceSquadManager.cpp | 4 +- .../shared/space/SpaceVisibilityManager.cpp | 12 +- .../InstallationSynchronizedUi.cpp | 4 +- .../src/shared/trading/ServerSecureTrade.cpp | 20 +- .../src/shared/TaskConnectionIdMessage.cpp | 2 +- .../AccountFeatureIdResponse.cpp | 2 +- .../AccountFeatureIdResponse.h | 2 +- .../AdjustAccountFeatureIdResponse.cpp | 2 +- .../AdjustAccountFeatureIdResponse.h | 6 +- .../SceneTransferMessages.cpp | 4 +- .../centralGameServer/SceneTransferMessages.h | 4 +- .../core/SetupServerNetworkMessages.cpp | 2 +- .../gameGameServer/AiCreatureStateMessage.cpp | 6 +- .../gameGameServer/AiMovementMessage.cpp | 4 +- .../GameServerMessageInterface.cpp | 6 +- .../gameGameServer/RenameCharacterMessage.cpp | 4 +- .../src/shared/CityPathGraph.cpp | 74 +- .../src/shared/CityPathGraphManager.cpp | 98 +- .../src/shared/CityPathNode.cpp | 28 +- .../src/shared/PathAutoGenerator.cpp | 14 +- .../src/shared/ServerPathBuilder.cpp | 150 +-- .../src/shared/ServerPathfindingMessaging.cpp | 50 +- .../shared/ServerPathfindingNotification.cpp | 8 +- .../src/shared/GameScriptObject.cpp | 116 +- .../serverScript/src/shared/JNIWrappers.cpp | 28 +- .../serverScript/src/shared/JavaLibrary.cpp | 902 ++++++++-------- .../src/shared/ScriptFunctionTable.cpp | 6 +- .../src/shared/ScriptListEntry.cpp | 8 +- .../serverScript/src/shared/ScriptListEntry.h | 2 +- .../src/shared/ScriptMethodsAi.cpp | 100 +- .../src/shared/ScriptMethodsAnimation.cpp | 14 +- .../src/shared/ScriptMethodsAttributes.cpp | 46 +- .../src/shared/ScriptMethodsAuction.cpp | 22 +- .../src/shared/ScriptMethodsBroadcasting.cpp | 6 +- .../src/shared/ScriptMethodsBuffBuilder.cpp | 6 +- .../src/shared/ScriptMethodsChat.cpp | 12 +- .../src/shared/ScriptMethodsCity.cpp | 2 +- .../src/shared/ScriptMethodsClientEffect.cpp | 90 +- .../shared/ScriptMethodsClusterWideData.cpp | 4 +- .../src/shared/ScriptMethodsCombat.cpp | 158 +-- .../src/shared/ScriptMethodsCommandQueue.cpp | 28 +- .../src/shared/ScriptMethodsConsole.cpp | 4 +- .../src/shared/ScriptMethodsContainers.cpp | 112 +- .../src/shared/ScriptMethodsCrafting.cpp | 230 ++-- .../src/shared/ScriptMethodsDebug.cpp | 12 +- .../shared/ScriptMethodsDynamicVariable.cpp | 110 +- .../src/shared/ScriptMethodsForm.cpp | 4 +- .../src/shared/ScriptMethodsHateList.cpp | 32 +- .../src/shared/ScriptMethodsHolocube.cpp | 4 +- .../src/shared/ScriptMethodsHyperspace.cpp | 36 +- .../src/shared/ScriptMethodsImageDesign.cpp | 10 +- .../src/shared/ScriptMethodsInstallation.cpp | 12 +- .../src/shared/ScriptMethodsInteriors.cpp | 56 +- .../src/shared/ScriptMethodsJedi.cpp | 96 +- .../src/shared/ScriptMethodsMap.cpp | 16 +- .../src/shared/ScriptMethodsMentalStates.cpp | 4 +- .../src/shared/ScriptMethodsMission.cpp | 104 +- .../src/shared/ScriptMethodsMoney.cpp | 18 +- .../src/shared/ScriptMethodsMount.cpp | 6 +- .../shared/ScriptMethodsNewbieTutorial.cpp | 2 +- .../src/shared/ScriptMethodsNotification.cpp | 6 +- .../src/shared/ScriptMethodsNpc.cpp | 30 +- .../src/shared/ScriptMethodsObjectCreate.cpp | 124 +-- .../src/shared/ScriptMethodsObjectInfo.cpp | 434 ++++---- .../src/shared/ScriptMethodsObjectMove.cpp | 64 +- .../src/shared/ScriptMethodsPermissions.cpp | 8 +- .../src/shared/ScriptMethodsPilot.cpp | 74 +- .../src/shared/ScriptMethodsPlayerAccount.cpp | 42 +- .../src/shared/ScriptMethodsPlayerQuest.cpp | 30 +- .../src/shared/ScriptMethodsPvp.cpp | 16 +- .../src/shared/ScriptMethodsQuest.cpp | 28 +- .../src/shared/ScriptMethodsRegion.cpp | 140 +-- .../src/shared/ScriptMethodsRegion3d.cpp | 2 +- .../src/shared/ScriptMethodsResource.cpp | 74 +- .../src/shared/ScriptMethodsScript.cpp | 26 +- .../src/shared/ScriptMethodsServerUI.cpp | 18 +- .../src/shared/ScriptMethodsShip.cpp | 102 +- .../src/shared/ScriptMethodsSkill.cpp | 92 +- .../src/shared/ScriptMethodsString.cpp | 6 +- .../src/shared/ScriptMethodsSystem.cpp | 10 +- .../src/shared/ScriptMethodsTerrain.cpp | 70 +- .../src/shared/ScriptMethodsVeteran.cpp | 38 +- .../src/shared/ScriptMethodsWaypoint.cpp | 2 +- .../src/shared/ScriptMethodsWorldInfo.cpp | 86 +- .../src/shared/ScriptParamArchive.cpp | 2 +- .../src/shared/ScriptParameters.cpp | 4 +- .../src/shared/ScriptParameters.h | 2 +- .../src/shared/AdminAccountManager.cpp | 4 +- .../src/shared/ChatLogManager.cpp | 2 +- .../src/shared/ClusterWideDataManagerList.cpp | 6 +- .../src/shared/FreeCtsDataTable.cpp | 32 +- .../src/shared/DataTableTool.cpp | 2 +- .../src/shared/TemplateCompiler.cpp | 30 +- .../core/TemplateDefinitionCompiler.cpp | 26 +- .../src/shared/core/BarrierObject.cpp | 6 +- .../src/shared/core/BoxTree.cpp | 50 +- .../sharedCollision/src/shared/core/BoxTree.h | 2 +- .../src/shared/core/CollisionBuckets.cpp | 2 +- .../src/shared/core/CollisionMesh.cpp | 12 +- .../src/shared/core/CollisionNotification.cpp | 2 +- .../src/shared/core/CollisionProperty.cpp | 92 +- .../src/shared/core/CollisionResolve.cpp | 24 +- .../src/shared/core/CollisionResolve.h | 10 +- .../src/shared/core/CollisionUtils.cpp | 52 +- .../src/shared/core/CollisionWorld.cpp | 110 +- .../src/shared/core/ConfigSharedCollision.cpp | 4 +- .../src/shared/core/Contact3d.h | 6 +- .../src/shared/core/ContactPoint.cpp | 6 +- .../src/shared/core/DoorObject.cpp | 26 +- .../sharedCollision/src/shared/core/Floor.cpp | 26 +- .../src/shared/core/FloorLocator.cpp | 24 +- .../src/shared/core/FloorManager.cpp | 8 +- .../src/shared/core/FloorMesh.cpp | 78 +- .../src/shared/core/Footprint.cpp | 42 +- .../core/FootprintForceReattachManager.cpp | 2 +- .../src/shared/core/MultiList.cpp | 72 +- .../src/shared/core/MultiList.h | 20 +- .../src/shared/core/NeighborObject.cpp | 2 +- .../src/shared/core/SimpleCollisionMesh.cpp | 4 +- .../src/shared/core/SpatialDatabase.cpp | 68 +- .../src/shared/extent/BoxExtent.cpp | 2 +- .../src/shared/extent/CollisionDetect.cpp | 38 +- .../src/shared/extent/CollisionDetect.h | 8 +- .../src/shared/extent/CompositeExtent.cpp | 6 +- .../src/shared/extent/CylinderExtent.cpp | 2 +- .../src/shared/extent/DetailExtent.cpp | 4 +- .../src/shared/extent/Extent.cpp | 2 +- .../src/shared/extent/ExtentList.cpp | 10 +- .../src/shared/extent/MeshExtent.cpp | 10 +- .../shared/extent/OrientedCylinderExtent.cpp | 2 +- .../src/shared/extent/SimpleExtent.cpp | 2 +- .../src/shared/BitStream.cpp | 44 +- .../sharedCompression/src/shared/Lz77.cpp | 10 +- .../src/shared/ZlibCompressor.cpp | 16 +- .../src/shared/core/Bindable.h | 10 +- .../src/shared/core/DbBindableBase.h | 2 +- .../src/shared/core/DbBindableBool.h | 2 +- .../src/shared/core/DbBindableString.h | 10 +- .../src/shared/core/DbBindableUnicode.h | 2 +- .../src/shared/core/DbBufferRow.h | 4 +- .../src/shared/core/DbServer.cpp | 8 +- .../shared/core/NullEncodedStandardString.h | 2 +- .../shared/core/NullEncodedUnicodeString.h | 2 +- .../src_oci/DbBindableVarray.cpp | 30 +- .../src_oci/OciQueryImplementation.cpp | 18 +- .../src_oci/OciServer.cpp | 2 +- .../src_oci/OciSession.cpp | 20 +- .../sharedDebug/src/linux/DebugMonitor.cpp | 2 +- .../src/linux/PerformanceTimer.cpp | 10 +- .../sharedDebug/src/shared/DataLint.cpp | 64 +- .../sharedDebug/src/shared/DebugFlags.cpp | 18 +- .../sharedDebug/src/shared/DebugKey.cpp | 2 +- .../sharedDebug/src/shared/InstallTimer.cpp | 2 +- .../sharedDebug/src/shared/PixCounter.cpp | 12 +- .../sharedDebug/src/shared/Profiler.cpp | 32 +- .../sharedDebug/src/shared/RemoteDebug.cpp | 16 +- .../sharedDebug/src/shared/RemoteDebug.h | 4 +- .../src/shared/RemoteDebug_inner.cpp | 26 +- .../src/shared/RemoteDebug_inner.h | 4 +- .../library/sharedDebug/src/shared/Report.cpp | 4 +- .../src/shared/AsynchronousLoader.cpp | 38 +- .../sharedFile/src/shared/FileManifest.cpp | 10 +- .../sharedFile/src/shared/FileNameUtils.cpp | 8 +- .../sharedFile/src/shared/FileStreamer.cpp | 10 +- .../src/shared/FileStreamerFile.cpp | 4 +- .../src/shared/FileStreamerThread.cpp | 38 +- .../library/sharedFile/src/shared/Iff.cpp | 34 +- .../library/sharedFile/src/shared/Iff.h | 4 +- .../src/shared/IndentedFileWriter.cpp | 14 +- .../sharedFile/src/shared/MemoryFile.cpp | 8 +- .../sharedFile/src/shared/TreeFile.cpp | 40 +- .../src/shared/TreeFile_SearchNode.cpp | 42 +- .../sharedFile/src/shared/ZlibFile.cpp | 8 +- .../library/sharedFoundation/src/linux/Os.cpp | 12 +- .../src/linux/PerThreadData.cpp | 8 +- .../src/linux/PerThreadData.h | 8 +- .../src/linux/PlatformGlue.cpp | 6 +- .../sharedFoundation/src/linux/PlatformGlue.h | 6 +- .../src/linux/SetupSharedFoundation.cpp | 12 +- .../sharedFoundation/src/linux/vsnprintf.cpp | 2 +- .../sharedFoundation/src/shared/BitArray.cpp | 4 +- .../sharedFoundation/src/shared/BitArray.h | 2 +- .../src/shared/CalendarTime.cpp | 18 +- .../src/shared/CommandLine.cpp | 78 +- .../sharedFoundation/src/shared/CommandLine.h | 2 +- .../src/shared/ConfigFile.cpp | 50 +- .../sharedFoundation/src/shared/ConfigFile.h | 2 +- .../src/shared/CrashReportInformation.cpp | 2 +- .../sharedFoundation/src/shared/Crc.cpp | 2 +- .../src/shared/CrcStringTable.cpp | 14 +- .../src/shared/DataResourceList.h | 30 +- .../sharedFoundation/src/shared/ExitChain.cpp | 12 +- .../sharedFoundation/src/shared/Fatal.cpp | 6 +- .../sharedFoundation/src/shared/Fatal.h | 8 +- .../src/shared/FormattedString.h | 4 +- .../sharedFoundation/src/shared/LabelHash.cpp | 4 +- .../src/shared/MemoryBlockManager.cpp | 16 +- .../src/shared/MessageQueue.cpp | 4 +- .../sharedFoundation/src/shared/Misc.h | 20 +- .../src/shared/PersistentCrcString.cpp | 38 +- .../library/sharedFoundation/src/shared/Tag.h | 4 +- .../sharedFoundation/src/shared/Watcher.cpp | 4 +- .../sharedFoundation/src/shared/Watcher.h | 14 +- .../dynamicVariable/DynamicVariable.cpp | 96 +- .../shared/dynamicVariable/DynamicVariable.h | 4 +- .../appearance/WearableAppearanceMap.cpp | 12 +- .../collision/CollisionCallbackManager.cpp | 10 +- .../src/shared/core/AiDebugString.cpp | 2 +- .../shared/core/AssetCustomizationManager.cpp | 26 +- .../src/shared/core/CitizenRankDataTable.cpp | 6 +- .../src/shared/core/CollectionsDataTable.cpp | 38 +- .../CommoditiesAdvancedSearchAttribute.cpp | 6 +- .../src/shared/core/CustomizationManager.cpp | 6 +- .../src/shared/core/FormManager.cpp | 32 +- .../src/shared/core/GameScheduler.cpp | 2 +- .../src/shared/core/GroundZoneManager.cpp | 6 +- .../src/shared/core/GuildRankDataTable.cpp | 8 +- .../src/shared/core/LfgCharacterData.cpp | 2 +- .../src/shared/core/LfgDataTable.cpp | 24 +- .../sharedGame/src/shared/core/LfgDataTable.h | 2 +- .../src/shared/core/PlayerCreationManager.cpp | 4 +- .../shared/core/SharedBuffBuilderManager.cpp | 2 +- .../shared/core/SharedBuildoutAreaManager.cpp | 16 +- .../core/SharedImageDesignerManager.cpp | 2 +- .../sharedGame/src/shared/core/Universe.cpp | 6 +- .../src/shared/core/WearableEntry.cpp | 2 +- .../mount/MountValidScaleRangeTable.cpp | 4 +- .../src/shared/mount/SharedSaddleManager.cpp | 2 +- .../src/shared/object/ResourceClassObject.cpp | 34 +- .../src/shared/object/ResourceClassObject.h | 2 +- .../sharedGame/src/shared/object/Waypoint.cpp | 2 +- .../SharedBattlefieldMarkerObjectTemplate.cpp | 106 +- .../SharedBuildingObjectTemplate.cpp | 34 +- .../SharedCellObjectTemplate.cpp | 10 +- ...aredConstructionContractObjectTemplate.cpp | 10 +- .../SharedCreatureObjectTemplate.cpp | 774 +++++++------- .../SharedDraftSchematicObjectTemplate.cpp | 202 ++-- .../SharedFactoryObjectTemplate.cpp | 10 +- .../SharedGroupObjectTemplate.cpp | 10 +- .../SharedGuildObjectTemplate.cpp | 10 +- .../SharedInstallationObjectTemplate.cpp | 10 +- .../SharedIntangibleObjectTemplate.cpp | 10 +- .../SharedJediManagerObjectTemplate.cpp | 10 +- ...aredManufactureSchematicObjectTemplate.cpp | 10 +- .../SharedMissionObjectTemplate.cpp | 10 +- .../objectTemplate/SharedObjectTemplate.cpp | 494 ++++----- .../SharedPlayerObjectTemplate.cpp | 10 +- .../SharedPlayerQuestObjectTemplate.cpp | 10 +- .../SharedResourceContainerObjectTemplate.cpp | 10 +- .../SharedShipObjectTemplate.cpp | 58 +- .../SharedStaticObjectTemplate.cpp | 10 +- .../SharedTangibleObjectTemplate.cpp | 546 +++++----- .../SharedTerrainSurfaceObjectTemplate.cpp | 70 +- .../SharedUniverseObjectTemplate.cpp | 10 +- .../SharedVehicleObjectTemplate.cpp | 334 +++--- .../SharedWaypointObjectTemplate.cpp | 10 +- .../SharedWeaponObjectTemplate.cpp | 82 +- .../sharedGame/src/shared/quest/Quest.cpp | 2 +- .../src/shared/quest/QuestManager.cpp | 8 +- .../space/AsteroidGenerationManager.cpp | 12 +- .../src/shared/space/NebulaManager.cpp | 16 +- .../src/shared/space/ShipChassis.cpp | 16 +- .../src/shared/space/ShipChassisSlot.cpp | 4 +- .../src/shared/space/ShipChassisWritable.cpp | 4 +- .../space/ShipComponentAttachmentManager.cpp | 14 +- .../src/shared/space/ShipComponentData.cpp | 2 +- .../shared/space/ShipComponentDescriptor.cpp | 26 +- .../space/ShipComponentDescriptorWritable.cpp | 2 +- .../space/ShipComponentWeaponManager.cpp | 4 +- .../sharedGame/src/shared/sui/SuiPageData.cpp | 10 +- .../sharedImage/src/shared/TargaFormat.cpp | 4 +- .../library/sharedIoWin/src/shared/IoWin.cpp | 6 +- .../sharedIoWin/src/shared/IoWinManager.cpp | 44 +- .../sharedIoWin/src/shared/IoWinManager.h | 2 +- .../sharedMath/src/shared/MxCifQuadTree.cpp | 42 +- .../src/shared/MxCifQuadTreeBounds.h | 4 +- .../library/sharedMath/src/shared/Plane.cpp | 22 +- .../sharedMath/src/shared/Quaternion.cpp | 2 +- .../sharedMath/src/shared/SphereTreeNode.h | 6 +- .../sharedMath/src/shared/Transform.cpp | 18 +- .../library/sharedMath/src/shared/Vector.cpp | 4 +- .../src/shared/debug/DebugShapeRenderer.cpp | 6 +- .../src/shared/MemoryManager.cpp | 42 +- .../src/shared/Emitter.cpp | 2 +- .../src/shared/Receiver.cpp | 2 +- .../sharedNetwork/src/linux/TcpClient.cpp | 4 +- .../sharedNetwork/src/shared/Service.cpp | 4 +- .../core/SetupSharedNetworkMessages.cpp | 2 +- .../src/shared/ObjectWatcherList.cpp | 12 +- .../src/shared/appearance/Appearance.cpp | 38 +- .../src/shared/appearance/Appearance.h | 2 +- .../shared/appearance/AppearanceTemplate.cpp | 16 +- .../appearance/AppearanceTemplateList.cpp | 16 +- .../container/ArrangementDescriptorList.cpp | 2 +- .../shared/container/ContainedByProperty.cpp | 2 +- .../src/shared/container/Container.cpp | 12 +- .../src/shared/container/SlotIdManager.cpp | 6 +- .../src/shared/container/SlottedContainer.cpp | 2 +- .../src/shared/container/VolumeContainer.cpp | 4 +- .../src/shared/container/VolumeContainer.h | 4 +- .../src/shared/controller/Controller.cpp | 14 +- .../src/shared/core/SetupSharedObject.cpp | 2 +- .../src/shared/core/SetupSharedObject.h | 2 +- .../customization/CustomizationData.cpp | 8 +- .../CustomizationData_LocalDirectory.cpp | 26 +- .../customization/CustomizationIdManager.cpp | 2 +- .../ObjectTemplateCustomizationDataWriter.cpp | 2 +- .../src/shared/lot/LotManager.cpp | 8 +- .../src/shared/object/AlterScheduler.cpp | 54 +- .../src/shared/object/CachedNetworkId.cpp | 12 +- .../sharedObject/src/shared/object/Object.cpp | 196 ++-- .../sharedObject/src/shared/object/Object.h | 18 +- .../src/shared/object/ObjectList.cpp | 10 +- .../src/shared/object/ObjectTemplate.cpp | 8 +- .../src/shared/object/ObjectTemplateList.cpp | 4 +- .../src/shared/object/ScheduleData.cpp | 12 +- .../src/shared/portal/CellProperty.cpp | 100 +- .../sharedObject/src/shared/portal/Portal.cpp | 20 +- .../src/shared/portal/PortalProperty.cpp | 14 +- .../shared/portal/PortalPropertyTemplate.cpp | 32 +- .../src/shared/portal/SphereGrid.h | 6 +- .../src/shared/property/LayerProperty.cpp | 6 +- .../sharedObject/src/shared/world/World.cpp | 4 +- .../src/shared/DynamicPathGraph.cpp | 36 +- .../src/shared/DynamicPathGraph.h | 2 +- .../src/shared/DynamicPathNode.cpp | 6 +- .../src/shared/PathGraph.cpp | 10 +- .../src/shared/PathGraphIterator.cpp | 10 +- .../sharedPathfinding/src/shared/PathNode.cpp | 4 +- .../src/shared/PathSearch.cpp | 42 +- .../src/shared/Pathfinding.cpp | 2 +- .../src/shared/SetupSharedPathfinding.cpp | 6 +- .../src/shared/SimplePathGraph.cpp | 26 +- .../src/shared/SharedRemoteDebugServer.cpp | 8 +- .../SharedRemoteDebugServerConnection.cpp | 4 +- .../src/shared/ExpertiseManager.cpp | 2 +- .../src/shared/LevelManager.cpp | 4 +- .../src/shared/SkillManager.cpp | 10 +- .../shared/template/ServerArmorTemplate.cpp | 48 +- .../ServerBattlefieldMarkerObjectTemplate.cpp | 10 +- .../template/ServerBuildingObjectTemplate.cpp | 22 +- .../template/ServerCellObjectTemplate.cpp | 10 +- .../template/ServerCityObjectTemplate.cpp | 10 +- ...rverConstructionContractObjectTemplate.cpp | 10 +- .../template/ServerCreatureObjectTemplate.cpp | 80 +- .../ServerDraftSchematicObjectTemplate.cpp | 94 +- .../template/ServerFactoryObjectTemplate.cpp | 10 +- .../template/ServerGroupObjectTemplate.cpp | 10 +- .../template/ServerGuildObjectTemplate.cpp | 10 +- ...verHarvesterInstallationObjectTemplate.cpp | 30 +- .../ServerInstallationObjectTemplate.cpp | 10 +- .../ServerIntangibleObjectTemplate.cpp | 70 +- .../ServerJediManagerObjectTemplate.cpp | 10 +- ...rManufactureInstallationObjectTemplate.cpp | 10 +- ...rverManufactureSchematicObjectTemplate.cpp | 48 +- .../template/ServerMissionObjectTemplate.cpp | 10 +- .../shared/template/ServerObjectTemplate.cpp | 160 +-- .../template/ServerPlanetObjectTemplate.cpp | 16 +- .../template/ServerPlayerObjectTemplate.cpp | 10 +- .../ServerPlayerQuestObjectTemplate.cpp | 10 +- .../ServerResourceClassObjectTemplate.cpp | 34 +- .../ServerResourceContainerObjectTemplate.cpp | 16 +- .../ServerResourcePoolObjectTemplate.cpp | 20 +- .../ServerResourceTypeObjectTemplate.cpp | 16 +- .../template/ServerShipObjectTemplate.cpp | 16 +- .../template/ServerStaticObjectTemplate.cpp | 16 +- .../template/ServerTangibleObjectTemplate.cpp | 50 +- .../template/ServerTokenObjectTemplate.cpp | 10 +- .../template/ServerUberObjectTemplate.cpp | 390 +++---- .../template/ServerUniverseObjectTemplate.cpp | 10 +- .../template/ServerVehicleObjectTemplate.cpp | 30 +- .../template/ServerWaypointObjectTemplate.cpp | 10 +- .../template/ServerWeaponObjectTemplate.cpp | 74 +- .../ServerXpManagerObjectTemplate.cpp | 10 +- .../SharedBattlefieldMarkerObjectTemplate.cpp | 22 +- .../template/SharedBuildingObjectTemplate.cpp | 20 +- .../template/SharedCellObjectTemplate.cpp | 10 +- ...aredConstructionContractObjectTemplate.cpp | 10 +- .../template/SharedCreatureObjectTemplate.cpp | 106 +- .../SharedDraftSchematicObjectTemplate.cpp | 54 +- .../template/SharedFactoryObjectTemplate.cpp | 10 +- .../template/SharedGroupObjectTemplate.cpp | 10 +- .../template/SharedGuildObjectTemplate.cpp | 10 +- .../SharedInstallationObjectTemplate.cpp | 10 +- .../SharedIntangibleObjectTemplate.cpp | 10 +- .../SharedJediManagerObjectTemplate.cpp | 10 +- ...aredManufactureSchematicObjectTemplate.cpp | 10 +- .../template/SharedMissionObjectTemplate.cpp | 10 +- .../shared/template/SharedObjectTemplate.cpp | 108 +- .../template/SharedPlayerObjectTemplate.cpp | 10 +- .../SharedPlayerQuestObjectTemplate.cpp | 10 +- .../SharedResourceContainerObjectTemplate.cpp | 10 +- .../template/SharedShipObjectTemplate.cpp | 30 +- .../template/SharedStaticObjectTemplate.cpp | 10 +- .../template/SharedTangibleObjectTemplate.cpp | 114 +- .../SharedTerrainSurfaceObjectTemplate.cpp | 22 +- .../template/SharedTokenObjectTemplate.cpp | 10 +- .../template/SharedUniverseObjectTemplate.cpp | 10 +- .../template/SharedVehicleObjectTemplate.cpp | 40 +- .../template/SharedWaypointObjectTemplate.cpp | 10 +- .../template/SharedWeaponObjectTemplate.cpp | 26 +- .../src/shared/core/File.cpp | 12 +- .../src/shared/core/File.h | 14 +- .../src/shared/core/Filename.cpp | 44 +- .../src/shared/core/Filename.h | 10 +- .../src/shared/core/ObjectTemplate.cpp | 12 +- .../src/shared/core/TemplateData.cpp | 356 +++---- .../src/shared/core/TemplateData.h | 6 +- .../src/shared/core/TemplateDataIterator.cpp | 18 +- .../shared/core/TemplateDefinitionFile.cpp | 40 +- .../src/shared/core/TemplateDefinitionFile.h | 2 +- .../src/shared/core/TemplateGlobals.cpp | 32 +- .../src/shared/core/TpfFile.cpp | 164 +-- .../src/shared/core/TpfTemplate.cpp | 64 +- .../ProceduralTerrainAppearance.cpp | 18 +- .../SamplerProceduralTerrainAppearance.cpp | 2 +- .../ServerProceduralTerrainAppearance.cpp | 2 +- .../src/shared/appearance/TerrainQuadTree.cpp | 12 +- .../src/shared/appearance/TerrainQuadTree.h | 2 +- .../src/shared/core/WaterTypeManager.cpp | 8 +- .../src/shared/generator/BitmapGroup.cpp | 2 +- .../src/shared/generator/ShaderGroup.cpp | 2 +- .../src/shared/object/TerrainObject.cpp | 2 +- .../src/shared/CachedFileManager.cpp | 10 +- .../src/shared/CurrentUserOptionManager.cpp | 4 +- .../sharedUtility/src/shared/DataTable.cpp | 14 +- .../src/shared/DataTableColumnType.cpp | 6 +- .../src/shared/DataTableManager.cpp | 8 +- .../src/shared/DataTableWriter.cpp | 4 +- .../sharedUtility/src/shared/FileName.cpp | 4 +- .../sharedUtility/src/shared/RotaryCache.cpp | 10 +- .../src/shared/SetupSharedUtility.cpp | 2 +- .../src/shared/TemplateParameter.cpp | 12 +- .../src/shared/TemplateParameter.h | 28 +- .../src/shared/ValueDictionary.cpp | 2 +- .../src/shared/ValueDictionaryArchive.cpp | 4 +- .../src/shared/tree/XmlTreeDocument.cpp | 10 +- .../src/shared/tree/XmlTreeDocumentList.cpp | 8 +- .../sharedXml/src/shared/tree/XmlTreeNode.cpp | 48 +- .../platform/projects/MonAPI2/MonitorAPI.cpp | 30 +- .../platform/projects/MonAPI2/MonitorAPI.h | 10 +- .../platform/projects/MonAPI2/MonitorData.cpp | 18 +- .../platform/projects/MonAPI2/MonitorData.h | 8 +- .../Session/CommonAPI/CommonClient.cpp | 4 +- .../projects/Session/LoginAPI/ClientCore.cpp | 8 +- .../library/platform/utils/Base/Archive.cpp | 4 +- .../library/platform/utils/Base/AutoLog.cpp | 30 +- .../3rd/library/platform/utils/Base/AutoLog.h | 4 +- .../library/platform/utils/Base/Config.cpp | 26 +- .../3rd/library/platform/utils/Base/Config.h | 24 +- .../library/platform/utils/Base/Statistics.h | 4 +- .../utils/Base/TemplateObjectAllocator.h | 4 +- .../utils/Base/linux/BlockAllocator.cpp | 8 +- .../platform/utils/Base/linux/Event.cpp | 6 +- .../platform/utils/Base/linux/Logger.cpp | 18 +- .../platform/utils/Base/linux/Thread.cpp | 12 +- .../CSAssistStressTest/test.cpp | 54 +- .../CSAssistgameapi/CSAssistgameapicore.cpp | 72 +- .../CSAssistgameapi/CSAssistgameapicore.h | 4 +- .../CSAssistgameapi/CSAssistreceiver.cpp | 6 +- .../CSAssistgameapi/CSAssisttest/test.cpp | 12 +- .../CSAssist/CSAssistgameapi/packdata.cpp | 2 +- .../CSAssist/utils/Base/Archive.cpp | 4 +- .../CSAssist/utils/Base/AutoLog.cpp | 30 +- .../soePlatform/CSAssist/utils/Base/AutoLog.h | 4 +- .../CSAssist/utils/Base/Config.cpp | 26 +- .../soePlatform/CSAssist/utils/Base/Config.h | 24 +- .../CSAssist/utils/Base/Logger.cpp | 24 +- .../CSAssist/utils/Base/Statistics.h | 4 +- .../utils/Base/TemplateObjectAllocator.h | 4 +- .../CSAssist/utils/Base/WideString.h | 60 +- .../utils/Base/linux/BlockAllocator.cpp | 8 +- .../CSAssist/utils/Base/linux/Event.cpp | 6 +- .../CSAssist/utils/Base/linux/Thread.cpp | 12 +- .../CSAssist/utils/Base/serialize.h | 6 +- .../CSAssist/utils/TcpLibrary/IPAddress.h | 2 +- .../utils/TcpLibrary/TcpBlockAllocator.cpp | 6 +- .../utils/TcpLibrary/TcpConnection.cpp | 64 +- .../CSAssist/utils/TcpLibrary/TcpConnection.h | 2 +- .../CSAssist/utils/TcpLibrary/TcpManager.cpp | 106 +- .../CSAssist/utils/TcpLibrary/TcpManager.h | 4 +- .../TcpLibrary/TestClient/TestClient.cpp | 10 +- .../utils/Unicode/UnicodeCharacterDataMap.h | 2 +- .../CSAssist/utils/Unicode/utf8.cpp | 2 +- .../CTServiceGameAPI/Base/Archive.cpp | 4 +- .../CTGenericAPI/GenericApiCore.cpp | 16 +- .../CTGenericAPI/GenericConnection.cpp | 20 +- .../CTServiceGameAPI/CTServiceAPI.cpp | 4 +- .../CTServiceGameAPI/TcpLibrary/IPAddress.h | 2 +- .../TcpLibrary/TcpBlockAllocator.cpp | 6 +- .../TcpLibrary/TcpConnection.cpp | 64 +- .../TcpLibrary/TcpConnection.h | 2 +- .../TcpLibrary/TcpManager.cpp | 106 +- .../CTServiceGameAPI/TcpLibrary/TcpManager.h | 4 +- .../CTServiceGameAPI/TestClient/Main.cpp | 2 +- .../Unicode/UnicodeCharacterDataMap.h | 2 +- .../CTServiceGameAPI/test/main.cpp | 2 +- .../projects/ChatAPI/AvatarIteratorCore.cpp | 24 +- .../projects/ChatAPI/AvatarListItemCore.cpp | 4 +- .../ChatAPI/projects/ChatAPI/ChatAPI.cpp | 12 +- .../ChatAPI/projects/ChatAPI/ChatAPI.h | 12 +- .../ChatAPI/projects/ChatAPI/ChatAPICore.cpp | 172 +-- .../ChatAPI/projects/ChatAPI/ChatEnum.cpp | 2 +- .../projects/ChatAPI/ChatFriendStatusCore.cpp | 4 +- .../projects/ChatAPI/ChatIgnoreStatusCore.cpp | 4 +- .../ChatAPI/projects/ChatAPI/ChatRoom.cpp | 2 +- .../ChatAPI/projects/ChatAPI/ChatRoomCore.cpp | 46 +- .../ChatAPI/projects/ChatAPI/Message.cpp | 8 +- .../projects/ChatAPI/PersistentMessage.cpp | 4 +- .../ChatAPI/projects/ChatAPI/Request.cpp | 4 +- .../ChatAPI/projects/ChatAPI/Response.cpp | 72 +- .../ChatAPI/utils/Base/Archive.cpp | 4 +- .../ChatAPI/utils/Base/AutoLog.cpp | 30 +- .../soePlatform/ChatAPI/utils/Base/AutoLog.h | 4 +- .../ChatAPI/utils/Base/CmdLine.cpp | 4 +- .../soePlatform/ChatAPI/utils/Base/Config.cpp | 26 +- .../soePlatform/ChatAPI/utils/Base/Config.h | 24 +- .../soePlatform/ChatAPI/utils/Base/Logger.cpp | 28 +- .../ChatAPI/utils/Base/Statistics.h | 4 +- .../utils/Base/TemplateObjectAllocator.h | 4 +- .../ChatAPI/utils/Base/WideString.h | 60 +- .../utils/Base/linux/BlockAllocator.cpp | 8 +- .../ChatAPI/utils/Base/linux/Event.cpp | 6 +- .../ChatAPI/utils/Base/linux/Thread.cpp | 12 +- .../ChatAPI/utils/Base/serialize.h | 6 +- .../utils/GenericAPI/GenericApiCore.cpp | 16 +- .../utils/GenericAPI/GenericConnection.cpp | 20 +- .../utils/UdpLibrary/UdpConnection.cpp | 90 +- .../ChatAPI/utils/UdpLibrary/UdpConnection.h | 24 +- .../utils/UdpLibrary/UdpDriverLinux.cpp | 16 +- .../utils/UdpLibrary/UdpDriverWindows.cpp | 16 +- .../ChatAPI/utils/UdpLibrary/UdpHashTable.h | 92 +- .../ChatAPI/utils/UdpLibrary/UdpLinkedList.h | 50 +- .../utils/UdpLibrary/UdpLogicalPacket.cpp | 18 +- .../utils/UdpLibrary/UdpLogicalPacket.h | 10 +- .../ChatAPI/utils/UdpLibrary/UdpManager.cpp | 144 +-- .../ChatAPI/utils/UdpLibrary/UdpManager.h | 26 +- .../ChatAPI/utils/UdpLibrary/UdpMisc.cpp | 28 +- .../ChatAPI/utils/UdpLibrary/UdpMisc.h | 4 +- .../ChatAPI/utils/UdpLibrary/UdpPriority.h | 18 +- .../utils/UdpLibrary/UdpReliableChannel.cpp | 72 +- .../utils/UdpLibrary/UdpReliableChannel.h | 4 +- .../utils/Unicode/UnicodeCharacterDataMap.h | 2 +- .../ChatAPI/utils/Unicode/utf8.cpp | 2 +- .../projects/VChat/VChatAPI/common.cpp | 28 +- .../VChat/VChatUnitTest/VChatClient.cpp | 28 +- .../VChatAPI/utils2.0/utils/Api/api.cpp | 16 +- .../VChatAPI/utils2.0/utils/Api/api.h | 2 +- .../utils2.0/utils/Api/apiMessages.cpp | 22 +- .../VChatAPI/utils2.0/utils/Api/apiMessages.h | 6 +- .../VChatAPI/utils2.0/utils/Api/apiPinned.cpp | 4 +- .../VChatAPI/utils2.0/utils/Base/cmdLine.cpp | 4 +- .../VChatAPI/utils2.0/utils/Base/date.cpp | 2 +- .../VChatAPI/utils2.0/utils/Base/dateUtils.h | 4 +- .../utils/Base/genericRateLimitingMechanism.h | 6 +- .../utils2.0/utils/Base/hashtable.hpp | 100 +- .../VChatAPI/utils2.0/utils/Base/log.cpp | 24 +- .../utils2.0/utils/Base/monitorAPI.cpp | 28 +- .../VChatAPI/utils2.0/utils/Base/monitorAPI.h | 4 +- .../utils2.0/utils/Base/monitorData.cpp | 18 +- .../utils2.0/utils/Base/monitorData.h | 6 +- .../VChatAPI/utils2.0/utils/Base/priority.hpp | 18 +- .../utils2.0/utils/Base/stringutils.cpp | 4 +- .../utils2.0/utils/Base/stringutils.h | 2 +- .../utils2.0/utils/Base/substringSearchTree.h | 54 +- .../VChatAPI/utils2.0/utils/Base/thread.cpp | 16 +- .../VChatAPI/utils2.0/utils/Base/utf8.cpp | 2 +- .../utils2.0/utils/TcpLibrary/IPAddress.h | 2 +- .../utils/TcpLibrary/TcpBlockAllocator.cpp | 6 +- .../utils/TcpLibrary/TcpConnection.cpp | 64 +- .../utils2.0/utils/TcpLibrary/TcpConnection.h | 2 +- .../utils2.0/utils/TcpLibrary/TcpManager.cpp | 110 +- .../utils2.0/utils/TcpLibrary/TcpManager.h | 4 +- .../utils2.0/utils/UdpLibrary/UdpLibrary.cpp | 434 ++++---- .../utils2.0/utils/UdpLibrary/UdpLibrary.hpp | 42 +- .../3rd/library/udplibrary/PointerDeque.hpp | 14 +- .../3rd/library/udplibrary/UdpLibrary.cpp | 428 ++++---- .../3rd/library/udplibrary/UdpLibrary.hpp | 42 +- external/3rd/library/udplibrary/hashtable.hpp | 100 +- external/3rd/library/udplibrary/priority.hpp | 18 +- external/3rd/library/udplibrary/udpclient.cpp | 4 +- external/3rd/library/udplibrary/udpserver.cpp | 2 +- .../src/shared/AutoDeltaVariableCallback.h | 2 +- .../library/archive/src/shared/ByteStream.cpp | 2 +- .../library/archive/src/shared/ByteStream.h | 2 +- .../crypto/src/shared/original/cryptlib.h | 2 +- .../crypto/src/shared/original/filters.cpp | 8 +- .../crypto/src/shared/original/filters.h | 32 +- .../crypto/src/shared/original/queue.cpp | 2 +- .../crypto/src/shared/original/smartptr.h | 18 +- .../src/shared/wrapper/TwofishCrypt.cpp | 2 +- .../fileInterface/src/shared/AbstractFile.cpp | 6 +- .../fileInterface/src/shared/AbstractFile.h | 2 +- .../fileInterface/src/shared/StdioFile.cpp | 16 +- .../src/shared/LocalizationManager.cpp | 18 +- .../src/shared/LocalizedString.cpp | 12 +- .../src/shared/LocalizedStringTable.cpp | 12 +- .../LocalizedStringTableReaderWriter.cpp | 12 +- .../library/singleton/src/shared/Singleton2.h | 4 +- .../src/shared/UnicodeCharacterDataMap.cpp | 6 +- .../src/shared/UnicodeCharacterDataMap.h | 2 +- .../unicode/src/shared/UnicodeUtils.cpp | 2 +- .../library/unicode/src/shared/UnicodeUtils.h | 4 +- .../ours/library/unicode/src/shared/utf8.cpp | 2 +- .../SwgDatabaseServer/src/linux/main.cpp | 2 +- .../shared/buffers/AuctionLocationsBuffer.cpp | 4 +- .../buffers/BattlefieldParticipantBuffer.cpp | 4 +- .../buffers/BountyHunterTargetBuffer.cpp | 2 +- .../shared/buffers/CreatureObjectBuffer.cpp | 2 +- .../src/shared/buffers/ExperienceBuffer.cpp | 4 +- .../buffers/IndexedNetworkTableBuffer.h | 4 +- .../ManufactureSchematicAttributeBuffer.cpp | 4 +- .../buffers/MarketAuctionBidsBuffer.cpp | 4 +- .../shared/buffers/MarketAuctionsBuffer.cpp | 6 +- .../src/shared/buffers/ObjectTableBuffer.cpp | 6 +- .../src/shared/buffers/ResourceTypeBuffer.cpp | 4 +- .../cleanup/TaskObjectTemplateListUpdater.cpp | 2 +- .../src/shared/core/CMLoader.cpp | 4 +- .../src/shared/core/ObjvarNameManager.cpp | 16 +- .../src/shared/core/SwgLoader.cpp | 10 +- .../src/shared/core/SwgPersister.cpp | 2 +- .../src/shared/core/SwgSnapshot.cpp | 8 +- .../src/shared/queries/CommoditiesQuery.cpp | 10 +- .../src/shared/tasks/TaskSaveObjvarNames.cpp | 2 +- .../src/shared/combat/CombatEngine.cpp | 36 +- .../controller/JediManagerController.cpp | 28 +- .../SwgPlayerCreatureController.cpp | 2 +- .../src/shared/core/CSHandler.cpp | 14 +- .../src/shared/core/SwgGameServer.cpp | 6 +- .../src/shared/core/SwgServerUniverse.cpp | 4 +- .../src/shared/object/JediManagerObject.cpp | 8 +- .../src/shared/object/SwgCreatureObject.cpp | 12 +- .../src/shared/object/SwgPlayerObject.cpp | 10 +- .../ServerJediManagerObjectTemplate.cpp | 10 +- .../core/SetupSwgServerNetworkMessages.cpp | 2 +- .../combat/MessageQueueCombatAction.cpp | 8 +- .../core/SetupSwgSharedNetworkMessages.cpp | 2 +- .../src/shared/CombatEngineData.h | 8 +- 937 files changed, 14983 insertions(+), 14983 deletions(-) diff --git a/engine/client/application/Miff/src/linux/InputFileHandler.cpp b/engine/client/application/Miff/src/linux/InputFileHandler.cpp index ead23d7c..0cb2d496 100755 --- a/engine/client/application/Miff/src/linux/InputFileHandler.cpp +++ b/engine/client/application/Miff/src/linux/InputFileHandler.cpp @@ -124,7 +124,7 @@ int InputFileHandler::deleteFile( if (deleteHandleFlag && file) { delete file; - file = NULL; + file = nullptr; } return(unlink(filename)); } diff --git a/engine/client/application/Miff/src/linux/OutputFileHandler.cpp b/engine/client/application/Miff/src/linux/OutputFileHandler.cpp index 1c8ffe96..82fa61a9 100755 --- a/engine/client/application/Miff/src/linux/OutputFileHandler.cpp +++ b/engine/client/application/Miff/src/linux/OutputFileHandler.cpp @@ -20,7 +20,7 @@ OutputFileHandler::OutputFileHandler(const char *filename) { outputIFF = new Iff(MAXIFFDATASIZE); - outFilename = NULL; + outFilename = nullptr; setCurrentFilename(filename); } @@ -45,7 +45,7 @@ OutputFileHandler::~OutputFileHandler(void) delete [] outFilename; } - outputIFF = NULL; + outputIFF = nullptr; } diff --git a/engine/client/application/Miff/src/linux/miff.cpp b/engine/client/application/Miff/src/linux/miff.cpp index cd395ab5..5bf4af1b 100755 --- a/engine/client/application/Miff/src/linux/miff.cpp +++ b/engine/client/application/Miff/src/linux/miff.cpp @@ -55,7 +55,7 @@ //================================================= static vars assignment == const int entryPointVersion = 1; // constantly check DataEntryPoint.h to see if this value has changed -OutputFileHandler *outfileHandler = NULL; +OutputFileHandler *outfileHandler = nullptr; const int bufferSize = 16 * 1024 * 1024; const int maxStringSize = 256; const char version[] = "1.3 September 18, 2000"; @@ -242,7 +242,7 @@ int main( int argc, // number of args in commandline // static void callbackFunction(void) { - outfileHandler = NULL; + outfileHandler = nullptr; #ifdef WIN32 @@ -392,13 +392,13 @@ static errorType evaluateArgs(void) // get default values from DOS char currentDir[maxStringSize]; - if (NULL == getcwd(currentDir, maxStringSize)) // get current working directory + if (nullptr == getcwd(currentDir, maxStringSize)) // get current working directory { retVal = ERR_UNKNOWNDIR; return(retVal); } drive[0] = currentDir[0]; // drive letter - drive[1] = 0; // and null terminate it + drive[1] = 0; // and nullptr terminate it strcpy(extension, "IFF"); // default to uppercase .IFF strcpy(directory, ¤tDir[2]); // get everything after the Drive: including the first backslash filename[0] = 0; @@ -619,7 +619,7 @@ static errorType loadInputToBuffer( // we've successfully read the file, now close it... delete inFileHandler; } - else // inFileName is NULL + else // inFileName is nullptr { retVal = ERR_FILENOTFOUND; } @@ -746,7 +746,7 @@ static void handleError(errorType error) // Revisions and History: // 1/07/99 [] - created // -extern "C" void MIFFMessage(char *message, // null terminated string to be displayed +extern "C" void MIFFMessage(char *message, // nullptr terminated string to be displayed int forceOutput) // if non-zero, it will print out even in quiet mode (for ERRORs) { if (forceOutput) diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferClient.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferClient.cpp index eb67f237..c7ddebeb 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferClient.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferClient.cpp @@ -35,7 +35,7 @@ void AuctionTransferClient::addCoinToAuction( const ExchangeListCreditsMessage& // 2bi. if user connected: send VeAuctionCoinReply (with result code) to user's ES // 2bii. if user not connected: send immediate abort back to auction service - const unsigned uTrack = getNewTransactionID( NULL ); + const unsigned uTrack = getNewTransactionID( nullptr ); AuctionAssetDetails &details = m_mPendingRequestDetails[ uTrack ]; details.u8Type = AuctionAssetDetails::TYPE_COIN; diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericApiCore.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericApiCore.cpp index 6c412225..3735217d 100644 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericApiCore.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericApiCore.cpp @@ -119,7 +119,7 @@ unsigned GenericAPICore::submitRequest(GenericRequest *req, GenericResponse *res } req->setTrack(m_currTrack); res->setTrack(m_currTrack); - time_t timeout = time(NULL) + m_requestTimeout; + time_t timeout = time(nullptr) + m_requestTimeout; req->setTimeout(timeout); res->setTimeout(timeout); @@ -138,7 +138,7 @@ void GenericAPICore::process() if (!m_suspended) { // Process timeout on pending requests - while((m_outCount > 0) && ((req = m_outboundQueue.front().first)->getTimeout() <= time(NULL))) + while((m_outCount > 0) && ((req = m_outboundQueue.front().first)->getTimeout() <= time(nullptr))) { --m_outCount; res = m_outboundQueue.front().second; @@ -150,7 +150,7 @@ void GenericAPICore::process() } // Process timeout on pending responses - while((m_pendingCount > 0) && ((res = (*m_pending.begin()).second)->getTimeout() <= time(NULL))) + while((m_pendingCount > 0) && ((res = (*m_pending.begin()).second)->getTimeout() <= time(nullptr))) { --m_pendingCount; m_pending.erase(m_pending.begin()); @@ -163,7 +163,7 @@ void GenericAPICore::process() pair out_pair = m_outboundQueue.front(); req = out_pair.first; res = out_pair.second; - GenericConnection *con = NULL; + GenericConnection *con = nullptr; if (req->getMappedServerTrack() == 0) // request has no originating "owner" server { con = getNextActiveConnection(); // it does not matter which server we send this to @@ -180,7 +180,7 @@ void GenericAPICore::process() } } - if (con != NULL) + if (con != nullptr) { Base::ByteStream msg; req->pack(msg); @@ -215,7 +215,7 @@ GenericConnection *GenericAPICore::getNextActiveConnection() unsigned startIndex = m_nextConnectionIndex; unsigned maxIndex = m_serverConnections.size() - 1; - GenericConnection *con = NULL; + GenericConnection *con = nullptr; //loop until we find an active connection, or until we get back // to where we started @@ -235,7 +235,7 @@ GenericConnection *GenericAPICore::getNextActiveConnection() //went past end of vector, start back at 0 m_nextConnectionIndex = 0; } - }while (con == NULL && m_nextConnectionIndex != startIndex); + }while (con == nullptr && m_nextConnectionIndex != startIndex); return con; } @@ -261,7 +261,7 @@ ServerTrackObject *GenericAPICore::findServer(unsigned server_track) { std::map::iterator iter = m_serverTracks.find(server_track); if (iter == m_serverTracks.end()) - return NULL; + return nullptr; ServerTrackObject *stobj = (*iter).second; m_serverTracks.erase(server_track); return stobj; diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericConnection.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericConnection.cpp index 318f5c20..8abb0dff 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericConnection.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericConnection.cpp @@ -25,7 +25,7 @@ using namespace Base; GenericConnection::GenericConnection(const char *host, short port, GenericAPICore *apiCore, unsigned reconnectTimeout, unsigned noDataTimeoutSecs, unsigned, unsigned incomingBufSizeInKB, unsigned outgoingBufSizeInKB, unsigned keepAlive, unsigned maxRecvMessageSizeInKB) : m_bConnected(CON_NONE), m_apiCore(apiCore), - m_con(NULL), + m_con(nullptr), m_host(host), m_port(port), m_lastTrack(123455), //random choice != 1 @@ -50,8 +50,8 @@ GenericConnection::~GenericConnection() { if(m_con) { - m_con->SetHandler(NULL); - m_con->Disconnect();//don't worry about onterminated being called, we've set it's handler to null, so it wont + m_con->SetHandler(nullptr); + m_con->Disconnect();//don't worry about onterminated being called, we've set it's handler to nullptr, so it wont m_con->Release(); } @@ -64,7 +64,7 @@ void GenericConnection::disconnect() { m_con->Disconnect(); //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); - m_con = NULL; + m_con = nullptr; } m_conState = CON_DISCONNECT; m_bConnected = CON_NONE; @@ -77,7 +77,7 @@ void GenericConnection::OnTerminated(TcpConnection *) if(m_con) { m_con->Release(); - m_con = NULL; + m_con = nullptr; } m_conState = CON_DISCONNECT; m_bConnected = CON_NONE; @@ -93,7 +93,7 @@ void GenericConnection::OnRoutePacket(TcpConnection *, const unsigned char *data get(iter, type); get(iter, track); - GenericResponse *res = NULL; + GenericResponse *res = nullptr; // the following if block is a temporary fix that prevents // a crash with a game team in which they occasionally find @@ -152,7 +152,7 @@ void GenericConnection::process() { m_con->SetHandler(this); m_conState = CON_NEGOTIATE; - m_conTimeout = time(NULL) + m_reconnectTimeout; + m_conTimeout = time(nullptr) + m_reconnectTimeout; } break; case CON_NEGOTIATE: @@ -178,12 +178,12 @@ void GenericConnection::process() put(msg, std::string(m_apiCore->m_gameIdentifiers[index])); Send(msg); } - else if(time(NULL) > m_conTimeout) + else if(time(nullptr) > m_conTimeout) { // we did not connect m_con->Disconnect(); //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); - m_con = NULL; + m_con = nullptr; m_conState = CON_DISCONNECT; m_bConnected = CON_NONE; } @@ -199,7 +199,7 @@ void GenericConnection::process() { m_con->Disconnect(); //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); - m_con = NULL; + m_con = nullptr; } } m_manager->GiveTime(); diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/AuctionTransferAPI.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/AuctionTransferAPI.cpp index 872eff5e..7e716a00 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/AuctionTransferAPI.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/AuctionTransferAPI.cpp @@ -25,9 +25,9 @@ AuctionTransferAPI::AuctionTransferAPI(const char *hostNames, const char *identi std::vector portArray; char hostConfig[4096]; char identifierConfig[4096]; - if (hostNames == NULL) + if (hostNames == nullptr) hostNames = DEFAULT_HOST; - if(identifiers == NULL) + if(identifiers == nullptr) identifiers = DEFAULT_IDENTIFIER; // parse the hosts and ports out : @@ -52,7 +52,7 @@ AuctionTransferAPI::AuctionTransferAPI(const char *hostNames, const char *identi portArray.push_back(port); } } - while ((ptr = strtok(NULL, " ")) != NULL); + while ((ptr = strtok(nullptr, " ")) != nullptr); } strncpy(identifierConfig, identifiers, 4096); identifierConfig[4095] = 0; @@ -67,7 +67,7 @@ AuctionTransferAPI::AuctionTransferAPI(const char *hostNames, const char *identi identifierArray.push_back(identifier); } } - while ((ptr = strtok(NULL, ";")) != NULL); + while ((ptr = strtok(nullptr, ";")) != nullptr); } if (hostArray.empty()) @@ -134,7 +134,7 @@ unsigned AuctionTransferAPI::sendCommitTransaction(long long transactionID, void unsigned AuctionTransferAPI::sendPrepareTransaction(const char *serverIdentifier, long long transactionID, unsigned stationID, unsigned characterID, long long assetID, const char *xmlAsset, void *user, bool compress) { RequestTypes requestEnum = GAME_REQUEST_SEND_PREPARE_TRANSACTION; - GenericRequest *req = NULL; + GenericRequest *req = nullptr; if( compress ) { requestEnum = GAME_REQUEST_SEND_PREPARE_TRANSACTION_COMPRESSED; diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/Archive.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/Archive.cpp index e3400df0..8ad45428 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/Archive.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/Archive.cpp @@ -91,7 +91,7 @@ namespace Base ByteStream::ByteStream() : allocatedSize(0), beginReadIterator(), - data(NULL), + data(nullptr), size(0), lastPutSize(0) { @@ -208,7 +208,7 @@ namespace Base if(data->size < allocatedSize) { unsigned char * tmp = new unsigned char[newSize]; - if(data->buffer != NULL) + if(data->buffer != nullptr) memcpy(tmp, data->buffer, size); delete[] data->buffer; data->buffer = tmp; diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Request.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Request.cpp index 13291373..ed2e0ad3 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Request.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Request.cpp @@ -7,7 +7,7 @@ void put(Base::ByteStream &msg, const Blob &source); ////////////////////////////////////////////////////////////////////////////////////// Blob::Blob(const unsigned char *data, unsigned len) - : m_data(NULL), + : m_data(nullptr), m_len(len) { if (m_len > 0) @@ -20,7 +20,7 @@ void put(Base::ByteStream &msg, const Blob &source); ////////////////////////////////////////////////////////////////////////////////////// Blob::Blob(const Blob &cpy) - : m_data(NULL), + : m_data(nullptr), m_len(cpy.m_len) { if (m_len > 0) @@ -45,7 +45,7 @@ void put(Base::ByteStream &msg, const Blob &source); if (m_data) { delete [] m_data; - m_data = NULL; + m_data = nullptr; } m_len = cpy.m_len; diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/IPAddress.h b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/IPAddress.h index f6d5f886..03b59e8d 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/IPAddress.h +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/IPAddress.h @@ -32,7 +32,7 @@ public: * @brief Used to retreive the the dot-notation represenatatiion of this address. * * @param buffer A pointer to the buffer to place the ip address into. - * Must be at least 17 characters long, will be null terminated. + * Must be at least 17 characters long, will be nullptr terminated. * * @return A pointer to the buffer the address was placed into. */ diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpBlockAllocator.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpBlockAllocator.cpp index 6d476d78..b7da0f27 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpBlockAllocator.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpBlockAllocator.cpp @@ -6,7 +6,7 @@ namespace NAMESPACE #endif TcpBlockAllocator::TcpBlockAllocator(const unsigned initSize, const unsigned initCount) -: m_freeHead(NULL), m_blockCount(initCount), m_blockSize(initSize), m_numAvailBlocks(0) +: m_freeHead(nullptr), m_blockCount(initCount), m_blockSize(initSize), m_numAvailBlocks(0) { realloc(); } @@ -33,7 +33,7 @@ data_block *TcpBlockAllocator::getBlock() tmp = m_freeHead; m_freeHead = m_freeHead->m_next; - tmp->m_next = NULL; + tmp->m_next = nullptr; m_numAvailBlocks--; return(tmp); } @@ -56,7 +56,7 @@ void TcpBlockAllocator::returnBlock(data_block *b) void TcpBlockAllocator::realloc() { - data_block *tmp = NULL, *cursor = NULL; + data_block *tmp = nullptr, *cursor = nullptr; tmp = new data_block; m_numAvailBlocks++; cursor = tmp; diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpConnection.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpConnection.cpp index 41f75157..20fdad78 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpConnection.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpConnection.cpp @@ -11,28 +11,28 @@ namespace NAMESPACE //used when want to open new connection with this socket TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, const IPAddress &destIP, short destPort, unsigned timeout) -: m_nextConnection(NULL), - m_prevConnection(NULL), +: m_nextConnection(nullptr), + m_prevConnection(nullptr), m_socket(INVALID_SOCKET), - m_nextKeepAliveConnection(NULL), - m_prevKeepAliveConnection(NULL), + m_nextKeepAliveConnection(nullptr), + m_prevKeepAliveConnection(nullptr), m_aliveListId(tcpManager->m_aliveList.m_listID), - m_nextRecvDataConnection(NULL), - m_prevRecvDataConnection(NULL), + m_nextRecvDataConnection(nullptr), + m_prevRecvDataConnection(nullptr), m_recvDataListId(tcpManager->m_dataList.m_listID), m_manager(tcpManager), m_status(StatusNegotiating), - m_handler(NULL), + m_handler(nullptr), m_destIP(destIP), m_destPort(destPort), m_refCount(0), m_sendAllocator(sendAlloc), - m_head(NULL), - m_tail(NULL), + m_head(nullptr), + m_tail(nullptr), m_bytesRead(0), m_bytesNeeded(0), m_params(params), - m_recvBuff(NULL), + m_recvBuff(nullptr), m_connectTimeout(timeout), m_connectTimer(), m_wasConRemovedFromMgr(false) @@ -94,28 +94,28 @@ TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAllo //used when server mode creates new connection object representing a connect request TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, SOCKET socket, const IPAddress &destIP, short destPort) -: m_nextConnection(NULL), - m_prevConnection(NULL), +: m_nextConnection(nullptr), + m_prevConnection(nullptr), m_socket(socket), - m_nextKeepAliveConnection(NULL), - m_prevKeepAliveConnection(NULL), + m_nextKeepAliveConnection(nullptr), + m_prevKeepAliveConnection(nullptr), m_aliveListId(tcpManager->m_aliveList.m_listID), - m_nextRecvDataConnection(NULL), - m_prevRecvDataConnection(NULL), + m_nextRecvDataConnection(nullptr), + m_prevRecvDataConnection(nullptr), m_recvDataListId(tcpManager->m_dataList.m_listID), m_manager(tcpManager), m_status(StatusConnected), - m_handler(NULL), + m_handler(nullptr), m_destIP(destIP), m_destPort(destPort), m_refCount(0), m_sendAllocator(sendAlloc), - m_head(NULL), - m_tail(NULL), + m_head(nullptr), + m_tail(nullptr), m_bytesRead(0), m_bytesNeeded(0), m_params(params), - m_recvBuff(NULL), + m_recvBuff(nullptr), m_connectTimeout(0), m_connectTimer(), m_wasConRemovedFromMgr(false) @@ -208,7 +208,7 @@ int TcpConnection::finishConnect() t.tv_sec = 0; t.tv_usec = 0; - int err = select(m_socket + 1, NULL, &wrSet, NULL, &t); + int err = select(m_socket + 1, nullptr, &wrSet, nullptr, &t); if (err == 0) { @@ -303,7 +303,7 @@ TcpConnection::~TcpConnection() { delete [] m_recvBuff; - while(m_head != NULL) + while(m_head != nullptr) { data_block *tmp = m_head; m_head = m_head->m_next; @@ -327,22 +327,22 @@ void TcpConnection::Send(const char *data, unsigned int dataLen) { m_aliveListId = m_manager->m_keepAliveList.m_listID; - if (m_prevKeepAliveConnection != NULL) + if (m_prevKeepAliveConnection != nullptr) m_prevKeepAliveConnection->m_nextKeepAliveConnection = m_nextKeepAliveConnection; - if (m_nextKeepAliveConnection != NULL) + if (m_nextKeepAliveConnection != nullptr) m_nextKeepAliveConnection->m_prevKeepAliveConnection = m_prevKeepAliveConnection; if (m_manager->m_keepAliveList.m_beginList == this) m_manager->m_keepAliveList.m_beginList = m_nextKeepAliveConnection; m_nextKeepAliveConnection = m_manager->m_aliveList.m_beginList; - m_prevKeepAliveConnection = NULL; - if (m_manager->m_aliveList.m_beginList != NULL) + m_prevKeepAliveConnection = nullptr; + if (m_manager->m_aliveList.m_beginList != nullptr) m_manager->m_aliveList.m_beginList->m_prevKeepAliveConnection = this; m_manager->m_aliveList.m_beginList = this; } - data_block *work = NULL; + data_block *work = nullptr; // this connection has no send buffer. Get a block if(!m_tail) @@ -467,16 +467,16 @@ int TcpConnection::processIncoming() { m_recvDataListId = m_manager->m_noDataList.m_listID; - if (m_prevRecvDataConnection != NULL) + if (m_prevRecvDataConnection != nullptr) m_prevRecvDataConnection->m_nextRecvDataConnection = m_nextRecvDataConnection; - if (m_nextRecvDataConnection != NULL) + if (m_nextRecvDataConnection != nullptr) m_nextRecvDataConnection->m_prevRecvDataConnection = m_prevRecvDataConnection; if (m_manager->m_noDataList.m_beginList == this) m_manager->m_noDataList.m_beginList = m_nextRecvDataConnection; m_nextRecvDataConnection = m_manager->m_dataList.m_beginList; - m_prevRecvDataConnection = NULL; - if (m_manager->m_dataList.m_beginList != NULL) + m_prevRecvDataConnection = nullptr; + if (m_manager->m_dataList.m_beginList != nullptr) m_manager->m_dataList.m_beginList->m_prevRecvDataConnection = this; m_manager->m_dataList.m_beginList = this; } @@ -622,7 +622,7 @@ int TcpConnection::processOutgoing() int sendError = 1; - // If m_head is not null, then this connection has something to send + // If m_head is not nullptr, then this connection has something to send if(m_head) diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpConnection.h b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpConnection.h index 07eb4f42..92d631d1 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpConnection.h +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpConnection.h @@ -50,7 +50,7 @@ public: * connection is disconnected, you simply need to derive your class * (multiply if necessary) from TcpConnectionHandler, then you can use * this method to set the object the TcpConnection will call as appropriate. - * default = NULL (no callbacks made) + * default = nullptr (no callbacks made) * * @param handler The object which will be called for notifications. */ diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpManager.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpManager.cpp index a89065a6..7c00d9f6 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpManager.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpManager.cpp @@ -41,14 +41,14 @@ TcpManager::TcpParams::TcpParams(const TcpParams &cpy) } TcpManager::TcpManager(const TcpParams ¶ms) -: m_handler(NULL), - m_keepAliveList(NULL, 1), - m_aliveList(NULL, 2), - m_noDataList(NULL, 1), - m_dataList(NULL, 2), +: m_handler(nullptr), + m_keepAliveList(nullptr, 1), + m_aliveList(nullptr, 2), + m_noDataList(nullptr, 1), + m_dataList(nullptr, 2), m_params(params), m_refCount(1), - m_connectionList(NULL), + m_connectionList(nullptr), m_connectionListCount(0), m_socket(INVALID_SOCKET), m_boundAsServer(false), @@ -86,7 +86,7 @@ TcpManager::~TcpManager() close(m_socket); #endif } - while (m_connectionList != NULL) + while (m_connectionList != nullptr) { TcpConnection *con = m_connectionList; m_connectionList = m_connectionList->m_nextConnection; @@ -166,7 +166,7 @@ bool TcpManager::BindAsServer() { struct hostent * lphp; lphp = gethostbyname(m_params.bindAddress); - if (lphp != NULL) + if (lphp != nullptr) addr_loc.sin_addr.s_addr = ((struct in_addr *)(lphp->h_addr))->s_addr; } else @@ -191,7 +191,7 @@ bool TcpManager::BindAsServer() TcpConnection *TcpManager::acceptClient() { - TcpConnection *newConn = NULL; + TcpConnection *newConn = nullptr; if (m_boundAsServer && m_connectionListCount < m_params.maxConnections) { @@ -205,7 +205,7 @@ TcpConnection *TcpManager::acceptClient() { newConn = new TcpConnection(this, &m_allocator, m_params, sock, IPAddress(addr.sin_addr.s_addr), ntohs(addr.sin_port)); addNewConnection(newConn); - if (m_handler != NULL) + if (m_handler != nullptr) { m_handler->OnConnectRequest(newConn); } @@ -230,8 +230,8 @@ SOCKET TcpManager::getMaxFD() if (m_boundAsServer) maxfd = m_socket+1; - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) { next = con->m_nextConnection; if (con->GetStatus() != TcpConnection::StatusDisconnected && con->m_socket > maxfd) @@ -245,8 +245,8 @@ SOCKET TcpManager::getMaxFD() TcpConnection *TcpManager::getConnection(SOCKET fd) { - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) { next = con->m_nextConnection; if (con->m_socket == fd) @@ -255,7 +255,7 @@ TcpConnection *TcpManager::getConnection(SOCKET fd) } } //if get here ,couldn't find it - return NULL; + return nullptr; } bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendTimePerConnection, unsigned maxRecvTimePerConnection) @@ -277,8 +277,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT { // Send output from last heartbeat - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) { con->AddRef(); if (next) next->Release(); @@ -345,7 +345,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT tmpfds = m_permfds; timeout.tv_sec = 0; timeout.tv_usec = 0; - int cnt = select(maxfd, &tmpfds, NULL, NULL, &timeout); // blocks for timeout + int cnt = select(maxfd, &tmpfds, nullptr, nullptr, &timeout); // blocks for timeout if (cnt > 0) @@ -371,8 +371,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //process incoming client messages if (maxRecvTimePerConnection != 0) { - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) { con->AddRef(); if (next) next->Release(); @@ -437,8 +437,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT pollfds[0].events |= POLLIN; } - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next, idx++) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next, idx++) { next = con->m_nextConnection; pollfds[idx].fd = con->m_socket; @@ -478,7 +478,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT } //process regular msg(s) - if (con == NULL) + if (con == nullptr) { close(pollfds[idx].fd); continue; @@ -510,7 +510,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT }//if(pollfds[... else if (pollfds[idx].revents & POLLHUP) { - if (con == NULL) + if (con == nullptr) { close(pollfds[idx].fd); continue; @@ -528,21 +528,21 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //now process any keepalives, if time to do that if (m_params.keepAliveDelay > 0 && m_keepAliveTimer.isDone(m_params.keepAliveDelay)) { - TcpConnection *next = NULL; - for (TcpConnection *con = m_keepAliveList.m_beginList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_keepAliveList.m_beginList ; con != nullptr ; con = next) { con->AddRef(); if (next) next->Release(); next = con->m_nextKeepAliveConnection; if (next) next->AddRef(); - con->Send(NULL, 0); //note: this request will move the connection from the keepAliveList to the aliveList + con->Send(nullptr, 0); //note: this request will move the connection from the keepAliveList to the aliveList con->Release(); } //now move the complete alive list over to the keepalive list to reset those timers m_keepAliveList.m_beginList = m_aliveList.m_beginList; - m_aliveList.m_beginList = NULL; + m_aliveList.m_beginList = nullptr; //switch id's for those connections that were in the alive list last go - around int tmpID = m_aliveList.m_listID; @@ -556,8 +556,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //now process any noDataCons, if time to do that if (m_params.noDataTimeout > 0 && m_noDataTimer.isDone(m_params.noDataTimeout)) { - TcpConnection *next = NULL; - for (TcpConnection *con = m_noDataList.m_beginList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_noDataList.m_beginList ; con != nullptr ; con = next) { con->AddRef(); if (next) next->Release(); @@ -571,7 +571,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //now move the complete data list over to the nodata list to reset those timers m_noDataList.m_beginList = m_dataList.m_beginList; - m_dataList.m_beginList = NULL; + m_dataList.m_beginList = nullptr; //switch id's for those connections that were in the data list last go - around int tmpID = m_dataList.m_listID; @@ -593,11 +593,11 @@ TcpConnection *TcpManager::EstablishConnection(const char *serverAddress, unsign { //can't open outgoing connections when in server mode // use a different TcpManager to do that - return NULL; + return nullptr; } if (m_connectionListCount >= m_params.maxConnections) - return(NULL); + return(nullptr); // get server address unsigned long address = inet_addr(serverAddress); @@ -605,8 +605,8 @@ TcpConnection *TcpManager::EstablishConnection(const char *serverAddress, unsign { struct hostent * lphp; lphp = gethostbyname(serverAddress); - if (lphp == NULL) - return(NULL); + if (lphp == nullptr) + return(nullptr); address = ((struct in_addr *)(lphp->h_addr))->s_addr; } IPAddress destIP(address); @@ -631,22 +631,22 @@ void TcpManager::addNewConnection(TcpConnection *con) } #endif con->m_nextConnection = m_connectionList; - con->m_prevConnection = NULL; - if (m_connectionList != NULL) + con->m_prevConnection = nullptr; + if (m_connectionList != nullptr) m_connectionList->m_prevConnection = con; m_connectionList = con; m_connectionListCount++; con->m_nextKeepAliveConnection = m_aliveList.m_beginList; - con->m_prevKeepAliveConnection = NULL; - if (m_aliveList.m_beginList != NULL) + con->m_prevKeepAliveConnection = nullptr; + if (m_aliveList.m_beginList != nullptr) m_aliveList.m_beginList->m_prevKeepAliveConnection = con; m_aliveList.m_beginList = con; con->m_aliveListId = m_keepAliveList.m_listID;//start it out thinking it's already in the alive list, since it is con->m_nextRecvDataConnection = m_dataList.m_beginList; - con->m_prevRecvDataConnection = NULL; - if (m_dataList.m_beginList != NULL) + con->m_prevRecvDataConnection = nullptr; + if (m_dataList.m_beginList != nullptr) m_dataList.m_beginList->m_prevRecvDataConnection = con; m_dataList.m_beginList = con; con->m_recvDataListId = m_noDataList.m_listID;//start it out thinking it's already in the data list, since it is @@ -667,40 +667,40 @@ void TcpManager::removeConnection(TcpConnection *con) #pragma warning(pop) } #endif - if (con->m_prevConnection != NULL) + if (con->m_prevConnection != nullptr) con->m_prevConnection->m_nextConnection = con->m_nextConnection; - if (con->m_nextConnection != NULL) + if (con->m_nextConnection != nullptr) con->m_nextConnection->m_prevConnection = con->m_prevConnection; if (m_connectionList == con) m_connectionList = con->m_nextConnection; - con->m_nextConnection = NULL; - con->m_prevConnection = NULL; + con->m_nextConnection = nullptr; + con->m_prevConnection = nullptr; - if (con->m_prevKeepAliveConnection != NULL) + if (con->m_prevKeepAliveConnection != nullptr) con->m_prevKeepAliveConnection->m_nextKeepAliveConnection = con->m_nextKeepAliveConnection; - if (con->m_nextKeepAliveConnection != NULL) + if (con->m_nextKeepAliveConnection != nullptr) con->m_nextKeepAliveConnection->m_prevKeepAliveConnection = con->m_prevKeepAliveConnection; if (m_aliveList.m_beginList == con) m_aliveList.m_beginList = con->m_nextKeepAliveConnection; else if (m_keepAliveList.m_beginList == con) m_keepAliveList.m_beginList = con->m_nextKeepAliveConnection; - con->m_nextKeepAliveConnection = NULL; - con->m_prevKeepAliveConnection = NULL; + con->m_nextKeepAliveConnection = nullptr; + con->m_prevKeepAliveConnection = nullptr; - if (con->m_prevRecvDataConnection != NULL) + if (con->m_prevRecvDataConnection != nullptr) con->m_prevRecvDataConnection->m_nextRecvDataConnection = con->m_nextRecvDataConnection; - if (con->m_nextRecvDataConnection != NULL) + if (con->m_nextRecvDataConnection != nullptr) con->m_nextRecvDataConnection->m_prevRecvDataConnection = con->m_prevRecvDataConnection; if (m_dataList.m_beginList == con) m_dataList.m_beginList = con->m_nextRecvDataConnection; else if (m_noDataList.m_beginList == con) m_noDataList.m_beginList = con->m_nextRecvDataConnection; - con->m_nextRecvDataConnection = NULL; - con->m_prevRecvDataConnection = NULL; + con->m_nextRecvDataConnection = nullptr; + con->m_prevRecvDataConnection = nullptr; diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpManager.h b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpManager.h index 75eb6df4..c4e8b1cf 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpManager.h +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpManager.h @@ -156,7 +156,7 @@ public: * simply need to derive your class (multiply if necessary) from TcpManagerHandler, then you can use * this method to set the object the TcpManager will call as appropriate. The TcpConnection object * also has a handler mechanism that replaces the other callback functions below, see TcpConnection::SetHandler - * default = NULL (no callbacks made) + * default = nullptr (no callbacks made) * * @param handler The object which will be called for manager related notifications. */ @@ -211,7 +211,7 @@ public: * the connect-complete callback to be called if the connection is succesfull. * * @return A pointer to a TcpConnection object. - * NULL if the manager object has exceeded its maximum number of connections + * nullptr if the manager object has exceeded its maximum number of connections * or if the serverAddress cannot be resolved to an IP address. */ TcpConnection *EstablishConnection(const char *serverAddress, unsigned short serverPort, unsigned timeout = 0); diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/GZipHelper.h b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/GZipHelper.h index a01bf682..dab0f9b3 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/GZipHelper.h +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/GZipHelper.h @@ -187,7 +187,7 @@ class CA2GZIPT int destroy() { int err = Z_OK; - if (m_zstream.state != NULL) { + if (m_zstream.state != nullptr) { err = deflateEnd(&(m_zstream)); } if (m_z_err < 0) err = m_z_err; @@ -459,7 +459,7 @@ class CGZIP2AT int destroy() { int err = Z_OK; - if (m_zstream.state != NULL) { + if (m_zstream.state != nullptr) { err = inflateEnd(&(m_zstream)); } if (m_z_err < 0) err = m_z_err; diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/zlib.h b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/zlib.h index 52cb529f..fb425a3b 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/zlib.h +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/zlib.h @@ -74,7 +74,7 @@ typedef struct z_stream_s { uInt avail_out; /* remaining free space at next_out */ uLong total_out; /* total nb of bytes output so far */ - char *msg; /* last error message, NULL if no error */ + char *msg; /* last error message, nullptr if no error */ struct internal_state FAR *state; /* not visible by applications */ alloc_func zalloc; /* used to allocate the internal state */ @@ -193,7 +193,7 @@ ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); enough memory, Z_STREAM_ERROR if level is not a valid compression level, Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible with the version assumed by the caller (ZLIB_VERSION). - msg is set to null if there is no error message. deflateInit does not + msg is set to nullptr if there is no error message. deflateInit does not perform any compression: this will be done by deflate(). */ @@ -271,7 +271,7 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); processed or more output produced), Z_STREAM_END if all input has been consumed and all output has been produced (only when flush is set to Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example - if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible + if next_in or next_out was nullptr), Z_BUF_ERROR if no progress is possible (for example avail_in or avail_out was zero). */ @@ -304,7 +304,7 @@ ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_VERSION_ERROR if the zlib library version is incompatible with the - version assumed by the caller. msg is set to null if there is no error + version assumed by the caller. msg is set to nullptr if there is no error message. inflateInit does not perform any decompression apart from reading the zlib header if present: this will be done by inflate(). (So next_in and avail_in may be modified, but next_out and avail_out are unchanged.) @@ -372,7 +372,7 @@ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); preset dictionary is needed at this point, Z_DATA_ERROR if the input data was corrupted (input stream not conforming to the zlib format or incorrect adler32 checksum), Z_STREAM_ERROR if the stream structure was inconsistent - (for example if next_in or next_out was NULL), Z_MEM_ERROR if there was not + (for example if next_in or next_out was nullptr), Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if no progress is possible or if there was not enough room in the output buffer when Z_FINISH is used. In the Z_DATA_ERROR case, the application may then call inflateSync to look for a good @@ -437,7 +437,7 @@ ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid - method). msg is set to null if there is no error message. deflateInit2 does + method). msg is set to nullptr if there is no error message. deflateInit2 does not perform any compression: this will be done by deflate(). */ @@ -471,7 +471,7 @@ ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, actually used by the compressor.) deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a - parameter is invalid (such as NULL dictionary) or the stream state is + parameter is invalid (such as nullptr dictionary) or the stream state is inconsistent (for example if deflate has already been called for this stream or if the compression method is bsort). deflateSetDictionary does not perform any compression: this will be done by deflate(). @@ -491,7 +491,7 @@ ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if the source stream state was inconsistent - (such as zalloc being NULL). msg is left unchanged in both source and + (such as zalloc being nullptr). msg is left unchanged in both source and destination. */ @@ -503,7 +503,7 @@ ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); that may have been set by deflateInit2. deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being NULL). + stream state was inconsistent (such as zalloc or state being nullptr). */ ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, @@ -544,7 +544,7 @@ ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if a parameter is invalid (such as a negative - memLevel). msg is set to null if there is no error message. inflateInit2 + memLevel). msg is set to nullptr if there is no error message. inflateInit2 does not perform any decompression apart from reading the zlib header if present: this will be done by inflate(). (So next_in and avail_in may be modified, but next_out and avail_out are unchanged.) @@ -562,7 +562,7 @@ ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, dictionary (see deflateSetDictionary). inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a - parameter is invalid (such as NULL dictionary) or the stream state is + parameter is invalid (such as nullptr dictionary) or the stream state is inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the expected one (incorrect Adler32 value). inflateSetDictionary does not perform any decompression: this will be done by subsequent calls of @@ -591,7 +591,7 @@ ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); The stream will keep attributes that may have been set by inflateInit2. inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being NULL). + stream state was inconsistent (such as zalloc or state being nullptr). */ @@ -667,7 +667,7 @@ ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); gzopen can be used to read a file which is not in gzip format; in this case gzread will directly read from the file without decompression. - gzopen returns NULL if the file could not be opened or if there was + gzopen returns nullptr if the file could not be opened or if there was insufficient memory to allocate the (de)compression state; errno can be checked to distinguish the two cases (if errno is zero, the zlib error is Z_MEM_ERROR). */ @@ -681,7 +681,7 @@ ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); The next call of gzclose on the returned gzFile will also close the file descriptor fd, just like fclose(fdopen(fd), mode) closes the file descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode). - gzdopen returns NULL if there was insufficient memory to allocate + gzdopen returns nullptr if there was insufficient memory to allocate the (de)compression state. */ @@ -718,8 +718,8 @@ ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...)); ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); /* - Writes the given null-terminated string to the compressed file, excluding - the terminating null character. + Writes the given nullptr-terminated string to the compressed file, excluding + the terminating nullptr character. gzputs returns the number of characters written, or -1 in case of error. */ @@ -727,7 +727,7 @@ ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); /* Reads bytes from the compressed file until len-1 characters are read, or a newline character is read and transferred to buf, or an end-of-file - condition is encountered. The string is then terminated with a null + condition is encountered. The string is then terminated with a nullptr character. gzgets returns buf, or Z_NULL in case of error. */ @@ -822,7 +822,7 @@ ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); /* Update a running Adler-32 checksum with the bytes buf[0..len-1] and - return the updated checksum. If buf is NULL, this function returns + return the updated checksum. If buf is nullptr, this function returns the required initial value for the checksum. An Adler-32 checksum is almost as reliable as a CRC32 but can be computed much faster. Usage example: @@ -838,7 +838,7 @@ ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); /* Update a running crc with the bytes buf[0..len-1] and return the updated - crc. If buf is NULL, this function returns the required initial value + crc. If buf is nullptr, this function returns the required initial value for the crc. Pre- and post-conditioning (one's complement) is performed within this function so it shouldn't be done by the application. Usage example: diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/zutil.h b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/zutil.h index 718ebc15..fecd535d 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/zutil.h +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/zutil.h @@ -116,7 +116,7 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ # include /* for fdopen */ # else # ifndef fdopen -# define fdopen(fd,mode) NULL /* No fdopen() */ +# define fdopen(fd,mode) nullptr /* No fdopen() */ # endif # endif #endif @@ -130,7 +130,7 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ #endif #if defined(_BEOS_) || defined(RISCOS) -# define fdopen(fd,mode) NULL /* No fdopen() */ +# define fdopen(fd,mode) nullptr /* No fdopen() */ #endif #if (defined(_MSC_VER) && (_MSC_VER > 600)) diff --git a/engine/server/application/CentralServer/src/shared/CentralCSHandler.h b/engine/server/application/CentralServer/src/shared/CentralCSHandler.h index e2b5fd0b..b07690de 100755 --- a/engine/server/application/CentralServer/src/shared/CentralCSHandler.h +++ b/engine/server/application/CentralServer/src/shared/CentralCSHandler.h @@ -69,7 +69,7 @@ protected: std::string name; EntryType type; - CentralCSHandlerFunc func; // will be null unless it's of TYPE_CENTRAL. + CentralCSHandlerFunc func; // will be nullptr unless it's of TYPE_CENTRAL. }; diff --git a/engine/server/application/CentralServer/src/shared/CentralServer.cpp b/engine/server/application/CentralServer/src/shared/CentralServer.cpp index 35d9e51c..3c1578f9 100755 --- a/engine/server/application/CentralServer/src/shared/CentralServer.cpp +++ b/engine/server/application/CentralServer/src/shared/CentralServer.cpp @@ -587,7 +587,7 @@ void CentralServer::getReadyGameServers(std::vector &theList) GameServerConnection * CentralServer::getRandomGameServer(void) { if (m_gameServerConnectionsList.empty()) - return NULL; + return nullptr; // m_gameServerConnectionsList ***DOES NOT*** contain the DB server so // we don't have to worry about checking for and excluding the DB server @@ -611,7 +611,7 @@ GameServerConnection * CentralServer::getRandomGameServer(void) indexNextGameServer = 0; } - return NULL; + return nullptr; } //----------------------------------------------------------------------- @@ -696,7 +696,7 @@ void CentralServer::launchStartingProcesses() const if (!m_taskManager || !m_taskManager->isConnected() || (m_clusterId == 0)) { if (!m_taskManager) - REPORT_LOG(true, ("CentralServer not launching starting processes because m_taskManager is NULL\n")); + REPORT_LOG(true, ("CentralServer not launching starting processes because m_taskManager is nullptr\n")); else if (!m_taskManager->isConnected()) REPORT_LOG(true, ("CentralServer not launching starting processes because m_taskManager->isConnected() is false\n")); @@ -820,7 +820,7 @@ void CentralServer::launchStartingPlanetServers() char const * const p = ConfigCentralServer::getStartPlanet(i); if (p) { - FATAL(!*p, ("CentralServer::launchStartingPlanetServers: ConfigCentralServer::getStartPlanet(%d) specified a non-null but empty planet name", i)); + FATAL(!*p, ("CentralServer::launchStartingPlanetServers: ConfigCentralServer::getStartPlanet(%d) specified a non-nullptr but empty planet name", i)); std::string planetName; std::string hostName; @@ -1495,7 +1495,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons { ConnectionServerConnection * c = (*ci); - if ( (c != NULL) + if ( (c != nullptr) && !c->getChatServiceAddress().empty() && (c->getChatServicePort() != 0)) { @@ -1537,13 +1537,13 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons { ChatServerConnection *connection = (*iterChatServerConnections); - if (connection != NULL) + if (connection != nullptr) { connection->send(address, true); } else { - REPORT_LOG(true, ("Trying to send the customer service server: chat server service address to a NULL chat server\n")); + REPORT_LOG(true, ("Trying to send the customer service server: chat server service address to a nullptr chat server\n")); } } } @@ -1556,7 +1556,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons { ConnectionServerConnection * c = (*ci); - if ( (c != NULL) + if ( (c != nullptr) && !c->getCustomerServiceAddress().empty() && (c->getCustomerServicePort() != 0)) { @@ -1631,7 +1631,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); const RequestGameServerForLoginMessage msg(ri); - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); PlayerSceneMapType::const_iterator i = m_playerSceneMap.find(msg.getCharacterId()); if ((i != m_playerSceneMap.end()) && (i->second.second > timeNow)) { @@ -1892,14 +1892,14 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons } else { - if(getInstance().m_transferServerConnection != NULL) + if(getInstance().m_transferServerConnection != nullptr) { getInstance().m_transferServerConnection->disconnect(); getInstance().m_transferServerConnection = 0; s_retryTransferServerConnection = false; } - if(getInstance().m_stationPlayersCollectorConnection != NULL) + if(getInstance().m_stationPlayersCollectorConnection != nullptr) { getInstance().m_stationPlayersCollectorConnection->disconnect(); getInstance().m_stationPlayersCollectorConnection = 0; @@ -1947,11 +1947,11 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons if (iterFind != s_pendingRenameCharacter.end()) { ++(iterFind->second.second); - iterFind->second.first = ::time(NULL) + 3600; // 1 hour timeout + iterFind->second.first = ::time(nullptr) + 3600; // 1 hour timeout } else { - s_pendingRenameCharacter.insert(std::make_pair(msg.getValue().second.first, std::make_pair((::time(NULL) + 3600), 1))); // 1 hour timeout + s_pendingRenameCharacter.insert(std::make_pair(msg.getValue().second.first, std::make_pair((::time(nullptr) + 3600), 1))); // 1 hour timeout } // tell the chat server to destroy any avatar with the new name, but only if the first name changed @@ -2099,11 +2099,11 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons { i->second.first = ssfp.getValue().second.first; if (ssfp.getValue().second.second) - i->second.second = ::time(NULL) + static_cast(ConfigCentralServer::getCtsDenyLoginThresholdSeconds()); + i->second.second = ::time(nullptr) + static_cast(ConfigCentralServer::getCtsDenyLoginThresholdSeconds()); } else { - m_playerSceneMap[ssfp.getValue().first]=std::make_pair(ssfp.getValue().second.first, (ssfp.getValue().second.second ? (::time(NULL) + static_cast(ConfigCentralServer::getCtsDenyLoginThresholdSeconds())) : 0)); + m_playerSceneMap[ssfp.getValue().first]=std::make_pair(ssfp.getValue().second.first, (ssfp.getValue().second.second ? (::time(nullptr) + static_cast(ConfigCentralServer::getCtsDenyLoginThresholdSeconds())) : 0)); } } } @@ -2250,7 +2250,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); GenericValueTypeMessage > const msg(ri); - m_timePopulationStatisticsRefresh = ::time(NULL); + m_timePopulationStatisticsRefresh = ::time(nullptr); m_populationStatistics = msg.getValue(); } else if (message.isType("GcwScoreStatRsp")) @@ -2258,7 +2258,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); GenericValueTypeMessage, std::pair >, std::map > > > > const msg(ri); - m_timeGcwScoreStatisticsRefresh = ::time(NULL); + m_timeGcwScoreStatisticsRefresh = ::time(nullptr); std::string const timeGcwScoreStatisticsRefreshStr = CalendarTime::convertEpochToTimeStringLocal(m_timeGcwScoreStatisticsRefresh); std::map const & gcwImperialScorePercentile = msg.getValue().first; @@ -2330,7 +2330,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); GenericValueTypeMessage >, std::map > > > const msg(ri); - m_timeLastLoginTimeStatisticsRefresh = ::time(NULL); + m_timeLastLoginTimeStatisticsRefresh = ::time(nullptr); m_lastLoginTimeStatistics = msg.getValue().first; m_createTimeStatistics = msg.getValue().second; } @@ -2606,7 +2606,7 @@ void CentralServer::removeGameServer(GameServerConnection const *gameServer) } else { - DEBUG_WARNING(true, ("A game server crashed but our process ID ptr is null.")); + DEBUG_WARNING(true, ("A game server crashed but our process ID ptr is nullptr.")); } } @@ -2828,7 +2828,7 @@ void CentralServer::update() if ( ConfigCentralServer::getAuctionEnabled() ) // allow auctions? { - if ( m_pAuctionTransferClient == NULL ) + if ( m_pAuctionTransferClient == nullptr ) { const char* hostName[1] = { ConfigCentralServer::getAuctionServer() }; const short port[1] = { (short)ConfigCentralServer::getAuctionPort() }; @@ -2975,7 +2975,7 @@ void CentralServer::sendToPlanetServer(const std::string &sceneId, const GameNet // ---------------------------------------------------------------------- -void CentralServer::sendToAllConnectionServers(const GameNetworkMessage & message, const bool reliable, Connection const * exclude /*= NULL*/) +void CentralServer::sendToAllConnectionServers(const GameNetworkMessage & message, const bool reliable, Connection const * exclude /*= nullptr*/) { // send to all connection servers for (ConnectionServerConnectionList::const_iterator i = m_connectionServerConnections.begin(); i != m_connectionServerConnections.end(); ++i) @@ -3005,7 +3005,7 @@ void CentralServer::sendToDBProcess(const GameNetworkMessage & message, const bo bool CentralServer::hasDBConnection() const { const GameServerConnection * g = getGameServer(getDbProcessServerProcessId()); - return (g != NULL); + return (g != nullptr); } //----------------------------------------------------------------------- @@ -3110,7 +3110,7 @@ void CentralServer::startPlanetServer(const std::string & host, const std::strin TaskSpawnProcess spawn(host.empty() ? std::string("any") : host, "PlanetServer", options, spawnDelay); CentralServer::getInstance().sendTaskMessage(spawn); - m_pendingPlanetServers[sceneId] = std::make_pair(std::make_pair(host, options), ::time(NULL)); + m_pendingPlanetServers[sceneId] = std::make_pair(std::make_pair(host, options), ::time(nullptr)); IGNORE_RETURN(m_planetsWaitingForPreload.insert(sceneId)); bool const preloadFinished = isPreloadFinished(); @@ -3119,14 +3119,14 @@ void CentralServer::startPlanetServer(const std::string & host, const std::strin else if (m_timeClusterWentIntoLoadingState <= 0) m_timeClusterWentIntoLoadingState = time(0); - if(getInstance().m_transferServerConnection != NULL && !preloadFinished) + if(getInstance().m_transferServerConnection != nullptr && !preloadFinished) { getInstance().m_transferServerConnection->disconnect(); getInstance().m_transferServerConnection = 0; s_retryTransferServerConnection = false; } - if(getInstance().m_stationPlayersCollectorConnection != NULL && ! isPreloadFinished()) + if(getInstance().m_stationPlayersCollectorConnection != nullptr && ! isPreloadFinished()) { getInstance().m_stationPlayersCollectorConnection->disconnect(); getInstance().m_stationPlayersCollectorConnection = 0; @@ -3263,7 +3263,7 @@ void CentralServer::handleGameServerForLoginMessage(const GameServerForLoginMess void CentralServer::handleExchangeListCreditsMessage(const ExchangeListCreditsMessage &msg) { LOG("Exchange", ("Central Server got exchange list credits %d.",msg.getCredits())); - if ( m_pAuctionTransferClient == NULL ) + if ( m_pAuctionTransferClient == nullptr ) { // send failure packet } @@ -3299,7 +3299,7 @@ ConnectionServerConnection * CentralServer::getAnyConnectionServer() ConnectionServerConnection * CentralServer::getConnectionServerForAccount(StationId suid) { - ConnectionServerConnection * result = NULL; + ConnectionServerConnection * result = nullptr; ConnectionServerSUIDMap::iterator i=m_accountConnectionMap.find(suid); if (i!=m_accountConnectionMap.end()) { @@ -3707,7 +3707,7 @@ void CentralServer::checkShutdownProcess() { // if it's been "awhile" since we requested to restart the PlanetServer, // then assume that something has gone wrong, and try the restart again - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); if ((iterPendingPlanetServer->second.second + static_cast(ConfigCentralServer::getMaxTimeToWaitForPlanetServerStartSeconds())) < timeNow) { @@ -3982,7 +3982,7 @@ int CentralServer::getSecondsClusterHasBeenInLoadingState() const const std::map & CentralServer::getPopulationStatistics(time_t & refreshTime) { // periodically request updated statistics from the game server - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); if (m_timePopulationStatisticsNextRefresh <= timeNow) { GameServerConnection * universeGameServerConnection = getGameServer(UniverseManager::getInstance().getUniverseProcess()); @@ -4004,7 +4004,7 @@ const std::map & CentralServer::getPopulationStatistics(time_t const std::map > > & CentralServer::getGcwScoreStatistics(time_t & refreshTime) { // periodically request updated statistics from the game server - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); if (m_timeGcwScoreStatisticsNextRefresh <= timeNow) { GameServerConnection * universeGameServerConnection = getGameServer(UniverseManager::getInstance().getUniverseProcess()); @@ -4026,7 +4026,7 @@ const std::map > std::pair > const *, std::map > const *> CentralServer::getLastLoginTimeStatistics(time_t & refreshTime) { // periodically request updated statistics from the game server - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); if (m_timeLastLoginTimeStatisticsNextRefresh <= timeNow) { GameServerConnection * universeGameServerConnection = getGameServer(UniverseManager::getInstance().getUniverseProcess()); @@ -4049,7 +4049,7 @@ std::pair > const *, std::map characterMatchStatisticsRequest("LfgStatReq", 0); diff --git a/engine/server/application/CentralServer/src/shared/CentralServer.h b/engine/server/application/CentralServer/src/shared/CentralServer.h index d628b2fa..262552b0 100755 --- a/engine/server/application/CentralServer/src/shared/CentralServer.h +++ b/engine/server/application/CentralServer/src/shared/CentralServer.h @@ -121,7 +121,7 @@ public: void sendToAllGameServersExceptDBProcess(const GameNetworkMessage & message, const bool reliable); void sendToAllPlanetServers(const GameNetworkMessage & message, const bool reliable); void sendToPlanetServer(const std::string &sceneId, const GameNetworkMessage & message, const bool reliable); - void sendToAllConnectionServers(const GameNetworkMessage & message, const bool reliable, Connection const * exclude = NULL); + void sendToAllConnectionServers(const GameNetworkMessage & message, const bool reliable, Connection const * exclude = nullptr); void sendToConnectionServerForAccount(StationId account, const GameNetworkMessage & message, const bool reliable); void sendToDBProcess(const GameNetworkMessage & message, const bool reliable) const; void sendToLoginServer(uint32 loginServerId, const GameNetworkMessage &message); diff --git a/engine/server/application/CentralServer/src/shared/CentralServerMetricsData.cpp b/engine/server/application/CentralServer/src/shared/CentralServerMetricsData.cpp index 19307914..b34c0174 100755 --- a/engine/server/application/CentralServer/src/shared/CentralServerMetricsData.cpp +++ b/engine/server/application/CentralServer/src/shared/CentralServerMetricsData.cpp @@ -148,7 +148,7 @@ void CentralServerMetricsData::updateData() // appear yellow to draw attention) for some amount of time // after detecting a system time mismatch issue #ifndef WIN32 - if ((lastTimeSystemTimeMismatchNotification + ConfigCentralServer::getSystemTimeMismatchAlertIntervalSeconds()) > ::time(NULL)) + if ((lastTimeSystemTimeMismatchNotification + ConfigCentralServer::getSystemTimeMismatchAlertIntervalSeconds()) > ::time(nullptr)) m_data[m_systemTimeMismatch].m_value = STATUS_LOADING; else m_data[m_systemTimeMismatch].m_value = 1; @@ -202,7 +202,7 @@ void CentralServerMetricsData::updateData() std::string label("population."); label += iter->first; - m_mapPopulationStatisticsIndex[iter->first] = addMetric(label.c_str(), 0, NULL, false, false); + m_mapPopulationStatisticsIndex[iter->first] = addMetric(label.c_str(), 0, nullptr, false, false); } } } @@ -235,7 +235,7 @@ void CentralServerMetricsData::updateData() } else { - gcwScoreStatisticsIndex = addMetric(iter->first.c_str(), 0, NULL, false, false); + gcwScoreStatisticsIndex = addMetric(iter->first.c_str(), 0, nullptr, false, false); IGNORE_RETURN(m_mapGcwScoreStatisticsIndex.insert(std::make_pair(iter->first, gcwScoreStatisticsIndex))); } @@ -263,7 +263,7 @@ void CentralServerMetricsData::updateData() std::string label("population."); label += secondIter.first; - m_mapLastLoginTimeStatisticsIndex[secondIter.first] = addMetric(label.c_str(), 0, NULL, false, false); + m_mapLastLoginTimeStatisticsIndex[secondIter.first] = addMetric(label.c_str(), 0, nullptr, false, false); } } } @@ -288,7 +288,7 @@ void CentralServerMetricsData::updateData() std::string label("population."); label += iter->second.first; - m_mapCreateTimeStatisticsIndex[iter->second.first] = addMetric(label.c_str(), 0, NULL, false, false); + m_mapCreateTimeStatisticsIndex[iter->second.first] = addMetric(label.c_str(), 0, nullptr, false, false); } } } diff --git a/engine/server/application/CentralServer/src/shared/CharacterCreationTracker.cpp b/engine/server/application/CentralServer/src/shared/CharacterCreationTracker.cpp index 5cbdb5c9..b56ee398 100755 --- a/engine/server/application/CentralServer/src/shared/CharacterCreationTracker.cpp +++ b/engine/server/application/CentralServer/src/shared/CharacterCreationTracker.cpp @@ -26,13 +26,13 @@ // ====================================================================== -CharacterCreationTracker * CharacterCreationTracker::ms_instance = NULL; +CharacterCreationTracker * CharacterCreationTracker::ms_instance = nullptr; // ====================================================================== void CharacterCreationTracker::install() { - DEBUG_FATAL(ms_instance != NULL,("Called install() twice.\n")); + DEBUG_FATAL(ms_instance != nullptr,("Called install() twice.\n")); ms_instance = new CharacterCreationTracker; ExitChain::add(CharacterCreationTracker::remove,"CharacterCreationTracker::remove"); } @@ -354,8 +354,8 @@ void CharacterCreationTracker::setFastCreationLock(StationId account) CharacterCreationTracker::CreationRecord::CreationRecord() : m_stage(S_queuedForGameServer), - m_gameCreationRequest(NULL), - m_loginCreationRequest(NULL), + m_gameCreationRequest(nullptr), + m_loginCreationRequest(nullptr), m_creationTime(ServerClock::getInstance().getGameTimeSeconds()), m_gameServerId(0), m_loginServerId(0), diff --git a/engine/server/application/CentralServer/src/shared/ConsoleCommandParserGame.cpp b/engine/server/application/CentralServer/src/shared/ConsoleCommandParserGame.cpp index 3231ecff..5c5f351d 100755 --- a/engine/server/application/CentralServer/src/shared/ConsoleCommandParserGame.cpp +++ b/engine/server/application/CentralServer/src/shared/ConsoleCommandParserGame.cpp @@ -117,8 +117,8 @@ bool ConsoleCommandParserGame::performParsing(const NetworkId & track, const Str if( argv.size() > 4 ) { LOG("ServerConsole", ("Received command to shutdown the cluster.")); - uint32 timeToShutdown = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), NULL, 10); - uint32 maxTime = strtoul(Unicode::wideToNarrow(argv[3]).c_str(), NULL, 10); + uint32 timeToShutdown = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), nullptr, 10); + uint32 maxTime = strtoul(Unicode::wideToNarrow(argv[3]).c_str(), nullptr, 10); Unicode::String systemMessage = Unicode::narrowToWide(""); for(unsigned int i = 4; i < argv.size(); ++i) { @@ -141,7 +141,7 @@ bool ConsoleCommandParserGame::performParsing(const NetworkId & track, const Str { if(argv.size() > 1) { - unsigned int stationId = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), NULL, 10); + unsigned int stationId = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), nullptr, 10); if(stationId > 0) { GenericValueTypeMessage auth("AuthorizeDownload", stationId); diff --git a/engine/server/application/CentralServer/src/shared/ConsoleManager.cpp b/engine/server/application/CentralServer/src/shared/ConsoleManager.cpp index d162fbb3..6535d3db 100755 --- a/engine/server/application/CentralServer/src/shared/ConsoleManager.cpp +++ b/engine/server/application/CentralServer/src/shared/ConsoleManager.cpp @@ -16,7 +16,7 @@ namespace ConsoleManagerNamespace { - ConsoleCommandParser * s_consoleCommandParserRoot = NULL; + ConsoleCommandParser * s_consoleCommandParserRoot = nullptr; } using namespace ConsoleManagerNamespace; diff --git a/engine/server/application/CentralServer/src/shared/PlanetManager.cpp b/engine/server/application/CentralServer/src/shared/PlanetManager.cpp index f9912dde..33d47cbd 100755 --- a/engine/server/application/CentralServer/src/shared/PlanetManager.cpp +++ b/engine/server/application/CentralServer/src/shared/PlanetManager.cpp @@ -138,7 +138,7 @@ PlanetServerConnection *PlanetManager::getPlanetServerForScene(const std::string if (i!=instance().m_servers.end()) return (*i).second.m_connection; else - return NULL; + return nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/application/ChatServer/src/linux/main.cpp b/engine/server/application/ChatServer/src/linux/main.cpp index eecd0c24..295c53f2 100755 --- a/engine/server/application/ChatServer/src/linux/main.cpp +++ b/engine/server/application/ChatServer/src/linux/main.cpp @@ -29,7 +29,7 @@ int main(int argc, char ** argv) SetupSharedFile::install(false); SetupSharedNetworkMessages::install(); - SetupSharedRandom::install(static_cast(time(NULL))); //lint !e1924 !e64 // NULL is a C-Style cast? + SetupSharedRandom::install(static_cast(time(nullptr))); //lint !e1924 !e64 // nullptr is a C-Style cast? Os::setProgramName("ChatServer"); //setup the server diff --git a/engine/server/application/ChatServer/src/shared/CentralServerConnection.cpp b/engine/server/application/ChatServer/src/shared/CentralServerConnection.cpp index b9fa2835..decda6cf 100755 --- a/engine/server/application/ChatServer/src/shared/CentralServerConnection.cpp +++ b/engine/server/application/ChatServer/src/shared/CentralServerConnection.cpp @@ -98,7 +98,7 @@ void CentralServerConnection::onReceive(const Archive::ByteStream & message) std::string const newNameNormalized(newName, 0, newName.find(' ')); ChatAvatarId const newAvatar("SWG", ConfigChatServer::getClusterName(), newNameNormalized); - IGNORE_RETURN(ChatServer::getChatInterface()->RequestTransferAvatar(msg.getStationId(), oldAvatar.getName(), oldAvatar.getAPIAddress(), msg.getStationId(), newAvatar.getName(), newAvatar.getAPIAddress(), true, NULL)); + IGNORE_RETURN(ChatServer::getChatInterface()->RequestTransferAvatar(msg.getStationId(), oldAvatar.getName(), oldAvatar.getAPIAddress(), msg.getStationId(), newAvatar.getName(), newAvatar.getAPIAddress(), true, nullptr)); } } else if (m.isType("ChatDestroyAvatar")) diff --git a/engine/server/application/ChatServer/src/shared/ChatInterface.cpp b/engine/server/application/ChatServer/src/shared/ChatInterface.cpp index 1ad72571..75aeae1b 100755 --- a/engine/server/application/ChatServer/src/shared/ChatInterface.cpp +++ b/engine/server/application/ChatServer/src/shared/ChatInterface.cpp @@ -350,7 +350,7 @@ void ChatInterface::OnGetRoom(unsigned track, unsigned result, const ChatRoom *r if (room) makeRoomName(room, roomName); //printf("!!!!!!!!!!!!got room %s\n", roomName.c_str()); - if (strstr(roomName.c_str(), "group") == NULL) + if (strstr(roomName.c_str(), "group") == nullptr) { ChatServer::putSystemAvatarInRoom(roomName); } @@ -373,7 +373,7 @@ void ChatInterface::OnGetRoom(unsigned track, unsigned result, const ChatRoom *r } } - ChatServerRoomOwner *owner = NULL; + ChatServerRoomOwner *owner = nullptr; if (room) owner = getRoomOwner(room->getRoomID()); @@ -709,12 +709,12 @@ std::string makeCanonicalName(const std::string &characterName) { retVal = toUpper(tmp); } - tmp = strtok(NULL, "."); + tmp = strtok(nullptr, "."); if (tmp) { retVal += (dot + tmp); } - tmp = strtok(NULL, "."); + tmp = strtok(nullptr, "."); if (tmp) { retVal += (dot + tmp); @@ -796,7 +796,7 @@ void ChatInterface::DestroyAvatar(const std::string & characterName) // track how many times we have called RequestGetAnyAvatar() for this particular DestroyAvatar // operation, so that we can stop if we somehow get stuck in an infinite loop - unsigned const trackID = RequestGetAnyAvatar(ChatUnicodeString(avatar.getName()), ChatUnicodeString(avatar.getAPIAddress()), NULL); + unsigned const trackID = RequestGetAnyAvatar(ChatUnicodeString(avatar.getName()), ChatUnicodeString(avatar.getAPIAddress()), nullptr); trackingRequestGetAnyAvatarForDestroy[trackID] = std::make_pair(std::make_pair(ChatUnicodeString(avatar.getName()), ChatUnicodeString(avatar.getAPIAddress())), 1); } @@ -848,7 +848,7 @@ void ChatInterface::sendQueuedHeadersToClient() const unsigned long queuedHeadersSendTime = currentTime + static_cast(s_intervalToSendHeadersToClientSeconds); int numberHeadersSent = 0; - const ChatPersistentMessageToClient * header = NULL; + const ChatPersistentMessageToClient * header = nullptr; for (std::map > >::iterator iter = queuedHeaders.begin(); iter != queuedHeaders.end();) { @@ -900,7 +900,7 @@ void ChatInterface::clearQueuedHeadersForAvatar(const ChatAvatarId & avatarId) void ChatInterface::addQueuedHeaderForAvatar(const ChatAvatarId & avatarId, const ChatPersistentMessageToClient * header, unsigned long sendTime) { - if (header == NULL) + if (header == nullptr) return; std::pair > & queuedHeader = queuedHeaders[avatarId]; @@ -923,7 +923,7 @@ ChatServerAvatarOwner *ChatInterface::getAvatarOwner(const ChatAvatar *avatar) return (*f).second; } } - return NULL; + return nullptr; } //----------------------------------------------------------------------- @@ -944,7 +944,7 @@ void ChatInterface::OnAddModerator(unsigned track, unsigned result, const ChatAv sequence = pair->sequence; delete pair; - pair = NULL; + pair = nullptr; } ChatAvatarId srcId; @@ -1057,7 +1057,7 @@ void ChatInterface::OnRemoveModerator(unsigned track, unsigned result, const Cha sequence = pair->sequence; delete pair; - pair = NULL; + pair = nullptr; } ChatAvatarId srcId; @@ -1178,7 +1178,7 @@ void ChatInterface::OnAddFriend(unsigned track, unsigned result, const ChatAvata ChatAvatarId d; makeAvatarId(destName, destAddress, d); - ChatServerAvatarOwner * mo = NULL; + ChatServerAvatarOwner * mo = nullptr; if (srcAvatar) mo = getAvatarOwner(srcAvatar); @@ -1206,7 +1206,7 @@ void ChatInterface::OnRemoveFriend(unsigned track, unsigned result, const ChatAv ChatAvatarId d; makeAvatarId(destName, destAddress, d); - ChatServerAvatarOwner * mo = NULL; + ChatServerAvatarOwner * mo = nullptr; if (srcAvatar) mo = getAvatarOwner(srcAvatar); @@ -1245,7 +1245,7 @@ void ChatInterface::OnIgnoreStatus(unsigned track, unsigned result, const ChatAv } } - ChatServerAvatarOwner * mo = NULL; + ChatServerAvatarOwner * mo = nullptr; if (srcAvatar) mo = getAvatarOwner(srcAvatar); if(mo) @@ -1281,7 +1281,7 @@ void ChatInterface::OnFriendStatus(unsigned track, unsigned result, const ChatAv idList.push_back(id); } } - ChatServerAvatarOwner * mo = NULL; + ChatServerAvatarOwner * mo = nullptr; if (srcAvatar) mo = getAvatarOwner(srcAvatar); if(mo) @@ -1304,7 +1304,7 @@ void ChatInterface::OnReceiveFriendLogin(const ChatAvatar *srcAvatar, const Chat PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnReceiveFriendLogin"); UNREF(srcAddress); - ChatServerAvatarOwner * owner = NULL; + ChatServerAvatarOwner * owner = nullptr; if (destAvatar) owner = getAvatarOwner(destAvatar); if(owner) @@ -1332,7 +1332,7 @@ void ChatInterface::OnReceiveFriendLogout(const ChatAvatar *srcAvatar, const Cha PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnReceiveFriendLogout"); UNREF(srcAddress); - ChatServerAvatarOwner * owner = NULL; + ChatServerAvatarOwner * owner = nullptr; if (destAvatar) owner = getAvatarOwner(destAvatar); if(owner) @@ -1395,7 +1395,7 @@ void ChatInterface::OnRemoveIgnore(unsigned track, unsigned result, const ChatAv ChatAvatarId d; makeAvatarId(destName, destAddress, d); - ChatServerAvatarOwner * mo = NULL; + ChatServerAvatarOwner * mo = nullptr; if (srcAvatar) mo = getAvatarOwner(srcAvatar); if(mo) @@ -1435,7 +1435,7 @@ void ChatInterface::OnLoginAvatar(unsigned track, unsigned result, const ChatAva if ((result == CHATRESULT_SUCCESS) && newAvatar) { // destroy chat avatar - unsigned const trackID = RequestDestroyAvatar(newAvatar, NULL); + unsigned const trackID = RequestDestroyAvatar(newAvatar, nullptr); trackingRequestGetAnyAvatarForDestroy[trackID] = iterFind->second; } @@ -1504,7 +1504,7 @@ void ChatInterface::OnLoginAvatar(unsigned track, unsigned result, const ChatAva static Unicode::String wideFilter = Unicode::narrowToWide(""); static ChatUnicodeString swgNode(wideSWG.data(), wideSWG.size()); static ChatUnicodeString filter(wideFilter.data(), wideFilter.size()); - IGNORE_RETURN(RequestGetRoomSummaries(swgNode, filter, NULL)); + IGNORE_RETURN(RequestGetRoomSummaries(swgNode, filter, nullptr)); } } else @@ -1525,11 +1525,11 @@ void ChatInterface::OnLoginAvatar(unsigned track, unsigned result, const ChatAva if(ChatServer::isGod(f->second)) { - RequestSetAvatarAttributes(newAvatar, AVATARATTR_GM, NULL); + RequestSetAvatarAttributes(newAvatar, AVATARATTR_GM, nullptr); } else { - RequestSetAvatarAttributes(newAvatar, 0, NULL); + RequestSetAvatarAttributes(newAvatar, 0, nullptr); } ChatServer::chatConnectedAvatar((*f).second, *newAvatar); @@ -1549,7 +1549,7 @@ void ChatInterface::OnLoginAvatar(unsigned track, unsigned result, const ChatAva //ChatServer::getFriendsList(id); clearQueuedHeadersForAvatar(avId); - IGNORE_RETURN(RequestGetPersistentHeaders(newAvatar, NULL)); + IGNORE_RETURN(RequestGetPersistentHeaders(newAvatar, nullptr)); //REPORT_LOG(true, ("Connection to chat system for %s.%s.%s confirmed\n", avatar.GetGameCode().c_str(), avatar.GetGameServerName().c_str(), avatar.GetCharacterName().c_str())); }//lint !e429 Custodial pointer 'owner' has not been freed or returned // jrandall avatar owns it pendingAvatars.erase(f); @@ -1560,7 +1560,7 @@ void ChatInterface::OnLoginAvatar(unsigned track, unsigned result, const ChatAva // the time they connected to the connection server and the time // this message arrived from the chat backend. if (newAvatar) - IGNORE_RETURN(RequestLogoutAvatar(newAvatar, NULL)); + IGNORE_RETURN(RequestLogoutAvatar(newAvatar, nullptr)); } } ChatOnConnectAvatar const connect; @@ -1585,7 +1585,7 @@ void ChatInterface::OnCreateRoom(unsigned track,unsigned result, const ChatRoom static ChatUnicodeString swgNode(wideSWG.data(), wideSWG.size()); static ChatUnicodeString filter(wideFilter.data(), wideFilter.size()); //printf("!!!!Calling GetRoomSummaries from OnCreateRoom\n"); - //IGNORE_RETURN(RequestGetRoomSummaries(swgNode, filter, NULL)); + //IGNORE_RETURN(RequestGetRoomSummaries(swgNode, filter, nullptr)); ChatRoomData roomData; @@ -1598,7 +1598,7 @@ void ChatInterface::OnCreateRoom(unsigned track,unsigned result, const ChatRoom //Unicode::String wideRoomName(newRoom->getRoomName().string_data, newRoom->getRoomName().string_length); std::string roomName; makeRoomName(newRoom, roomName); - if (strstr(roomName.c_str(), "group") == NULL) + if (strstr(roomName.c_str(), "group") == nullptr) { ChatServer::putSystemAvatarInRoom(roomName); } @@ -1644,7 +1644,7 @@ void ChatInterface::OnGetRoomSummaries(unsigned track, unsigned result, unsigned std::unordered_map::const_iterator f = roomList.find(lowerRoomName); if(f == roomList.end()) { - RequestGetRoom(foundRooms[i].getRoomAddress(), NULL); + RequestGetRoom(foundRooms[i].getRoomAddress(), nullptr); //ChatServerRoomOwner * o = new ChatServerRoomOwner((*i)); //(*i)->SetRoomOwnerPtr(o); //IGNORE_RETURN(roomList.insert(std::make_pair(lowerRoomName, *o))); @@ -1664,7 +1664,7 @@ const ChatServerRoomOwner *ChatInterface::getRoomOwner(const std::string & roomN { return &((*f).second); } - return NULL; + return nullptr; } //----------------------------------------------------------------------- @@ -1680,7 +1680,7 @@ ChatServerRoomOwner *ChatInterface::getRoomOwner(unsigned roomId) } ++f; } - return NULL; + return nullptr; } //----------------------------------------------------------------------- @@ -1727,13 +1727,13 @@ void ChatInterface::OnDestroyRoom(unsigned track, unsigned result, void *user) static Unicode::String wideFilter = Unicode::narrowToWide(""); static ChatUnicodeString swgNode(wideSWG.data(), wideSWG.size()); static ChatUnicodeString filter(wideFilter.data(), wideFilter.size()); - //IGNORE_RETURN(RequestGetRoomSummaries(swgNode, filter, NULL)); + //IGNORE_RETURN(RequestGetRoomSummaries(swgNode, filter, nullptr)); ChatAvatarId destroyer; RoomOwnerSequencePair *pair = (RoomOwnerSequencePair *)user; - const ChatServerRoomOwner * owner = NULL; + const ChatServerRoomOwner * owner = nullptr; unsigned sequence = 0; if (pair) { @@ -1805,7 +1805,7 @@ void ChatInterface::OnDestroyAvatar(unsigned track, unsigned result, const ChatA // stop if it looks like we're in an infinite loop if (iterFind->second.second <= 25) { - unsigned const trackID = RequestGetAnyAvatar(iterFind->second.first.first, iterFind->second.first.second, NULL); + unsigned const trackID = RequestGetAnyAvatar(iterFind->second.first.first, iterFind->second.first.second, nullptr); trackingRequestGetAnyAvatarForDestroy[trackID] = std::make_pair(iterFind->second.first, (iterFind->second.second + 1)); } } @@ -1828,13 +1828,13 @@ void ChatInterface::OnGetAnyAvatar(unsigned track, unsigned result, const ChatAv // can only destroy the avatar if he is logged in if (loggedIn) { - unsigned const trackID = RequestDestroyAvatar(foundAvatar, NULL); + unsigned const trackID = RequestDestroyAvatar(foundAvatar, nullptr); trackingRequestGetAnyAvatarForDestroy[trackID] = iterFind->second; } // log in the chat avatar so we can destroy him else { - unsigned const trackID = RequestLoginAvatar(foundAvatar->getUserID(), foundAvatar->getName(), foundAvatar->getAddress(), NULL); + unsigned const trackID = RequestLoginAvatar(foundAvatar->getUserID(), foundAvatar->getName(), foundAvatar->getAddress(), nullptr); trackingRequestGetAnyAvatarForDestroy[trackID] = iterFind->second; } } @@ -1850,9 +1850,9 @@ void ChatInterface::OnReceiveForcedLogout(const ChatAvatar *oldAvatar) ChatServer::fileLog(false, "ChatInterface", "OnReceiveForcedLogout() oldAvatar(%s)", ChatServer::getFullChatAvatarName(oldAvatar).c_str()); PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnReceiveForcedLogout"); - if (oldAvatar == NULL) + if (oldAvatar == nullptr) { - DEBUG_WARNING(true, ("We received an OnReceiveForcedLogout with a success result code but NULL data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnReceiveForcedLogout with a success result code but nullptr data. This is an error that the API should never give.")); return; } ChatAvatarId id; @@ -1876,9 +1876,9 @@ void ChatInterface::OnEnterRoom(unsigned track, unsigned result, const ChatAvata PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnEnterRoom"); - if (result == CHATRESULT_SUCCESS && (srcAvatar == NULL || destRoom == NULL)) + if (result == CHATRESULT_SUCCESS && (srcAvatar == nullptr || destRoom == nullptr)) { - DEBUG_WARNING(true, ("We received an OnEnterRoom with a success result code but NULL data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnEnterRoom with a success result code but nullptr data. This is an error that the API should never give.")); return; } @@ -2097,9 +2097,9 @@ void ChatInterface::OnAddBan(unsigned track, unsigned result, const ChatAvatar * PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnAddBan"); - if (result == CHATRESULT_SUCCESS && (srcAvatar == NULL || destRoom == NULL)) + if (result == CHATRESULT_SUCCESS && (srcAvatar == nullptr || destRoom == nullptr)) { - DEBUG_WARNING(true, ("We received an OnAddBan with a success result code but NULL data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnAddBan with a success result code but nullptr data. This is an error that the API should never give.")); return; } @@ -2113,7 +2113,7 @@ void ChatInterface::OnAddBan(unsigned track, unsigned result, const ChatAvatar * sequence = pair->sequence; delete pair; - pair = NULL; + pair = nullptr; } ChatAvatarId srcId; @@ -2218,9 +2218,9 @@ void ChatInterface::OnRemoveBan(unsigned track, unsigned result, const ChatAvata PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnRemoveBan"); - if (result == CHATRESULT_SUCCESS && (srcAvatar == NULL || destRoom == NULL)) + if (result == CHATRESULT_SUCCESS && (srcAvatar == nullptr || destRoom == nullptr)) { - DEBUG_WARNING(true, ("We received an OnRemoveBan with a success result code but NULL data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnRemoveBan with a success result code but nullptr data. This is an error that the API should never give.")); return; } @@ -2234,7 +2234,7 @@ void ChatInterface::OnRemoveBan(unsigned track, unsigned result, const ChatAvata sequence = pair->sequence; delete pair; - pair = NULL; + pair = nullptr; } ChatAvatarId srcId; @@ -2337,9 +2337,9 @@ void ChatInterface::OnAddInvite(unsigned track, unsigned result, const ChatAvata PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnAddInvite"); - if (result == CHATRESULT_SUCCESS && (srcAvatar == NULL || destRoom == NULL)) + if (result == CHATRESULT_SUCCESS && (srcAvatar == nullptr || destRoom == nullptr)) { - DEBUG_WARNING(true, ("We received an OnAddInvite with a success result code but NULL data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnAddInvite with a success result code but nullptr data. This is an error that the API should never give.")); return; } @@ -2353,7 +2353,7 @@ void ChatInterface::OnAddInvite(unsigned track, unsigned result, const ChatAvata sequence = pair->sequence; delete pair; - pair = NULL; + pair = nullptr; } ChatAvatarId srcId; @@ -2378,7 +2378,7 @@ void ChatInterface::OnAddInvite(unsigned track, unsigned result, const ChatAvata { // Calling this on a room will cause the API to cache the room // and to receive room updates for the room. - RequestGetRoom(destRoom->getAddress(), NULL); + RequestGetRoom(destRoom->getAddress(), nullptr); // Send the room data for the room the avatar was invited to join // since the room may be private and may be unknown to the player @@ -2455,9 +2455,9 @@ void ChatInterface::OnRemoveInvite(unsigned track, unsigned result, const ChatAv PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnRemoveInvite"); - if (result == CHATRESULT_SUCCESS && (srcAvatar == NULL || destRoom == NULL)) + if (result == CHATRESULT_SUCCESS && (srcAvatar == nullptr || destRoom == nullptr)) { - DEBUG_WARNING(true, ("We received an OnRemoveInvite with a success result code but NULL data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnRemoveInvite with a success result code but nullptr data. This is an error that the API should never give.")); return; } @@ -2471,7 +2471,7 @@ void ChatInterface::OnRemoveInvite(unsigned track, unsigned result, const ChatAv sequence = pair->sequence; delete pair; - pair = NULL; + pair = nullptr; } std::string roomName; @@ -2555,9 +2555,9 @@ void ChatInterface::OnLeaveRoom(unsigned track, unsigned result, const ChatAvata PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnLeaveRoom"); - if (result == CHATRESULT_SUCCESS && (srcAvatar == NULL || destRoom == NULL)) + if (result == CHATRESULT_SUCCESS && (srcAvatar == nullptr || destRoom == nullptr)) { - DEBUG_WARNING(true, ("We received an OnLeaveRoom with a success result code but NULL data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnLeaveRoom with a success result code but nullptr data. This is an error that the API should never give.")); return; } @@ -2653,7 +2653,7 @@ void ChatInterface::OnKickAvatar(unsigned track, unsigned result, const ChatAvat sequence = pair->sequence; delete pair; - pair = NULL; + pair = nullptr; } std::string roomName; @@ -2755,9 +2755,9 @@ void ChatInterface::OnGetPersistentMessage(unsigned track, unsigned result, Chat ChatServer::fileLog(false, "ChatInterface", "OnGetPersistentMessage() track(%u) result(%u) destAvatar(%s)", track, result, ChatServer::getFullChatAvatarName(destAvatar).c_str()); PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnGetPersistentMessage"); - if (result == CHATRESULT_SUCCESS && (destAvatar == NULL)) + if (result == CHATRESULT_SUCCESS && (destAvatar == nullptr)) { - DEBUG_WARNING(true, ("We received an OnGetPersistentMessage with a success result code but NULL data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnGetPersistentMessage with a success result code but nullptr data. This is an error that the API should never give.")); return; } UNREF(user); @@ -2807,9 +2807,9 @@ void ChatInterface::OnGetPersistentHeaders(unsigned track, unsigned result, Chat ChatServer::fileLog(false, "ChatInterface", "OnGetPersistentHeaders() track(%u) result(%u) destAvatar(%s)", track, result, ChatServer::getFullChatAvatarName(destAvatar).c_str(), listLength); PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnGetPersistentHeaders"); - if (result == CHATRESULT_SUCCESS && (destAvatar == NULL)) + if (result == CHATRESULT_SUCCESS && (destAvatar == nullptr)) { - DEBUG_WARNING(true, ("We received an OnGetPersistentHeaders with a success result code but NULL data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnGetPersistentHeaders with a success result code but nullptr data. This is an error that the API should never give.")); return; } UNREF(track); @@ -2876,9 +2876,9 @@ void ChatInterface::OnReceivePersistentMessage(const ChatAvatar *destAvatar, con ChatServer::fileLog(false, "ChatInterface", "OnReceivePersistentMessage() destAvatar(%s)", ChatServer::getFullChatAvatarName(destAvatar).c_str()); PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnReceivePersistentMessage"); - if (destAvatar == NULL) + if (destAvatar == nullptr) { - DEBUG_WARNING(true, ("We received an OnREceivePersistentMessage with a success result code but NULL data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnREceivePersistentMessage with a success result code but nullptr data. This is an error that the API should never give.")); return; } if (!header) @@ -2910,9 +2910,9 @@ void ChatInterface::OnSendRoomMessage(unsigned track, unsigned result, const Cha ChatServer::fileLog(false, "ChatInterface", "OnSendRoomMessage() track(%u) result(%u) srcAvatar(%s) destRoom(%s)", track, result, ChatServer::getFullChatAvatarName(srcAvatar).c_str(), ChatServer::getChatRoomNameNarrow(destRoom).c_str()); PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnSendRoomMessage"); - if (result == CHATRESULT_SUCCESS && (srcAvatar == NULL || destRoom == NULL)) + if (result == CHATRESULT_SUCCESS && (srcAvatar == nullptr || destRoom == nullptr)) { - DEBUG_WARNING(true, ("We received an OnsendRoomMessage with a success result code but NULL data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnsendRoomMessage with a success result code but nullptr data. This is an error that the API should never give.")); return; } UNREF(srcAvatar); @@ -2931,7 +2931,7 @@ void ChatInterface::OnReceiveRoomMessage(const ChatAvatar *srcAvatar, const Chat PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnReceiveRoomMessage"); if(! srcAvatar || ! destAvatar || ! destRoom) { - DEBUG_WARNING(true, ("We received an OnREceiveRoomMessage with a success result code but NULL data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnREceiveRoomMessage with a success result code but nullptr data. This is an error that the API should never give.")); return; } @@ -2995,9 +2995,9 @@ void ChatInterface::OnSendInstantMessage(unsigned track, unsigned result, const PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnSendInstantMessage"); - if (result == CHATRESULT_SUCCESS && (srcAvatar == NULL)) + if (result == CHATRESULT_SUCCESS && (srcAvatar == nullptr)) { - DEBUG_WARNING(true, ("We received an OnSendInstantMessage with a success result code but NULL data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnSendInstantMessage with a success result code but nullptr data. This is an error that the API should never give.")); return; } UNREF(srcAvatar); @@ -3015,9 +3015,9 @@ void ChatInterface::OnReceiveInstantMessage(const ChatAvatar *srcAvatar, const C ChatServer::fileLog(false, "ChatInterface", "OnReceiveInstantMessage() srcAvatar(%s) destAvatar(%s)", ChatServer::getFullChatAvatarName(srcAvatar).c_str(), ChatServer::getFullChatAvatarName(destAvatar).c_str()); PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnReceiveInstantMessage"); - if ((srcAvatar == NULL || destAvatar == NULL)) + if ((srcAvatar == nullptr || destAvatar == nullptr)) { - DEBUG_WARNING(true, ("We received an OnReceiveInstantMessage with a success result code but NULL data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnReceiveInstantMessage with a success result code but nullptr data. This is an error that the API should never give.")); return; } ChatAvatarId fromId; @@ -3052,9 +3052,9 @@ void ChatInterface::OnSendPersistentMessage(unsigned track, unsigned result, con ChatServer::fileLog(false, "ChatInterface", "OnSendPersistentMessage() track(%u) result(%u) srcAvatar(%s)", track, result, ChatServer::getFullChatAvatarName(srcAvatar).c_str()); PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnSendPersistentMessage"); - if (result == CHATRESULT_SUCCESS && (srcAvatar == NULL)) + if (result == CHATRESULT_SUCCESS && (srcAvatar == nullptr)) { - DEBUG_WARNING(true, ("We received an OnSendPersistentMessage with a success result code but NULL data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnSendPersistentMessage with a success result code but nullptr data. This is an error that the API should never give.")); return; } unsigned sequence = (unsigned)user; @@ -3120,7 +3120,7 @@ void ChatInterface::OnUpdatePersistentMessages(unsigned track, unsigned result, ChatAvatarId targetChatAvatarId; - if (targetAvatar != NULL) + if (targetAvatar != nullptr) { makeAvatarId(*targetAvatar, targetChatAvatarId); } @@ -3130,17 +3130,17 @@ void ChatInterface::OnUpdatePersistentMessages(unsigned track, unsigned result, ChatAvatarId sourceChatAvatarId; NetworkId const *tmpNetworkId = reinterpret_cast(user); - if (tmpNetworkId != NULL) + if (tmpNetworkId != nullptr) { ChatAvatar const *sourceAvatar = ChatServer::getAvatarByNetworkId(*tmpNetworkId); - if (sourceAvatar != NULL) + if (sourceAvatar != nullptr) { makeAvatarId(*sourceAvatar, sourceChatAvatarId); } delete tmpNetworkId; - tmpNetworkId = NULL; + tmpNetworkId = nullptr; } ChatServer::fileLog(false, "ChatInterface", "OnUpdatePersistentMessage() track(%u) result(%u) sourceAvatar(%s) targetAvatar(%s)", track, result, sourceChatAvatarId.getFullName().c_str(), targetChatAvatarId.getFullName().c_str()); diff --git a/engine/server/application/ChatServer/src/shared/ChatServer.cpp b/engine/server/application/ChatServer/src/shared/ChatServer.cpp index 76d47a9c..c8e12a6d 100755 --- a/engine/server/application/ChatServer/src/shared/ChatServer.cpp +++ b/engine/server/application/ChatServer/src/shared/ChatServer.cpp @@ -162,7 +162,7 @@ void ChatServerNamespace::cleanChatLog() //----------------------------------------------------------------------- -ChatServer *ChatServer::m_instance = NULL; +ChatServer *ChatServer::m_instance = nullptr; #include @@ -250,7 +250,7 @@ if ((t3 - t2) > (1000 * 5)) static Unicode::String wideFilter = Unicode::narrowToWide(""); static ChatUnicodeString swgNode(wideSWG.data(), wideSWG.size()); static ChatUnicodeString filter(wideFilter.data(), wideFilter.size()); - instance().chatInterface->RequestGetRoomSummaries(swgNode, filter, NULL); + instance().chatInterface->RequestGetRoomSummaries(swgNode, filter, nullptr); } ++i; @@ -286,7 +286,7 @@ gameService(0), planetService(), ownerSystem(0), systemAvatarId("SWG", ConfigChatServer::getClusterName(), "SYSTEM"), -customerServiceServerConnection(NULL), +customerServiceServerConnection(nullptr), m_gameServerConnectionRegistry(), m_voiceChatIdMap() { @@ -452,7 +452,7 @@ void ChatServer::setOwnerSystem(const ChatAvatar * o) Connection *connection = safe_cast(instance().centralServerConnection); - if (connection != NULL) + if (connection != nullptr) { connection->send(bs, true); } @@ -618,7 +618,7 @@ const ChatAvatar * ChatServer::getAvatarByNetworkId(const NetworkId & id) { if (id.getValue() == 0) { - return NULL; + return nullptr; } const ChatAvatar * result = 0; ChatAvatarList::const_iterator f = instance().chatAvatars.find(id); @@ -635,7 +635,7 @@ ChatServer::AvatarExtendedData * ChatServer::getAvatarExtendedDataByNetworkId(co { if (id.getValue() == 0) { - return NULL; + return nullptr; } ChatServer::AvatarExtendedData * result = 0; ChatAvatarList::iterator f = instance().chatAvatars.find(id); @@ -783,7 +783,7 @@ void ChatServer::addFriend(const NetworkId & id, const unsigned int sequence, co unsigned track = instance().chatInterface->RequestAddFriend(from, ChatUnicodeString(friendName.data(), friendName.length()), ChatUnicodeString(friendAddress.data(), friendAddress.length()), - false, NULL); + false, nullptr); instance().pendingRequests[track] = id; } else @@ -810,7 +810,7 @@ void ChatServer::removeFriend(const NetworkId & id, const unsigned int sequence, splitChatAvatarId(friendId, friendName, friendAddress); unsigned track = instance().chatInterface->RequestRemoveFriend(from, ChatUnicodeString(friendName.data(), friendName.length()), - ChatUnicodeString(friendAddress.data(), friendAddress.length()), NULL); + ChatUnicodeString(friendAddress.data(), friendAddress.length()), nullptr); instance().pendingRequests[track] = id; } else @@ -829,7 +829,7 @@ void ChatServer::getFriendsList(const ChatAvatarId &characterName) const ChatAvatar *avatar = getAvatarByNetworkId(id); if (avatar) { - unsigned track = instance().chatInterface->RequestFriendStatus(avatar, NULL); + unsigned track = instance().chatInterface->RequestFriendStatus(avatar, nullptr); instance().pendingRequests[track] = id; } else @@ -857,7 +857,7 @@ void ChatServer::addIgnore(const NetworkId & id, const unsigned int sequence, co unsigned track = instance().chatInterface->RequestAddIgnore(from, ChatUnicodeString(ignoreName.data(), ignoreName.length()), ChatUnicodeString(ignoreAddress.data(), ignoreAddress.length()), - NULL); + nullptr); instance().pendingRequests[track] = id; } else @@ -884,7 +884,7 @@ void ChatServer::removeIgnore(const NetworkId & id, const unsigned int sequence, splitChatAvatarId(ignoreId, ignoreName, ignoreAddress); unsigned track = instance().chatInterface->RequestRemoveIgnore(from, ChatUnicodeString(ignoreName.data(), ignoreName.length()), - ChatUnicodeString(ignoreAddress.data(), ignoreAddress.length()), NULL); + ChatUnicodeString(ignoreAddress.data(), ignoreAddress.length()), nullptr); instance().pendingRequests[track] = id; } else @@ -905,7 +905,7 @@ void ChatServer::getIgnoreList(const ChatAvatarId &characterName) if (avatar) { - unsigned track = instance().chatInterface->RequestIgnoreStatus(avatar, NULL); + unsigned track = instance().chatInterface->RequestIgnoreStatus(avatar, nullptr); instance().pendingRequests[track] = id; } else @@ -1160,7 +1160,7 @@ void ChatServer::createRoom(const NetworkId & id, const unsigned int sequence, c { roomAttr |= ROOMATTR_PRIVATE; } - if (isSystemOwner && (strstr(roomName.c_str(), "system") != NULL)) + if (isSystemOwner && (strstr(roomName.c_str(), "system") != nullptr)) { roomAttr |= ROOMATTR_PERSISTENT; } @@ -1193,7 +1193,7 @@ void ChatServer::deleteAllPersistentMessages(const NetworkId &sourceNetworkId, c ChatAvatar const *avatar = getAvatarByNetworkId(targetNetworkId); - if (avatar != NULL) + if (avatar != nullptr) { { NetworkId *tmpNetworkId = new NetworkId(sourceNetworkId); @@ -1225,7 +1225,7 @@ void ChatServer::deletePersistentMessage(const NetworkId &id, const unsigned int const ChatAvatar *avatar = getAvatarByNetworkId(id); if (avatar) { - instance().chatInterface->RequestUpdatePersistentMessage(avatar, messageId, PERSISTENT_DELETED, NULL); + instance().chatInterface->RequestUpdatePersistentMessage(avatar, messageId, PERSISTENT_DELETED, nullptr); } } @@ -1290,10 +1290,10 @@ void ChatServer::destroyRoom(const std::string & roomName) { ChatServer::fileLog(s_enableChatRoomLogs, "ChatServer", "destroyRoom() roomName(%s)", roomName.c_str()); - if ((strstr(roomName.c_str(), ConfigChatServer::getClusterName()) != NULL) || + if ((strstr(roomName.c_str(), ConfigChatServer::getClusterName()) != nullptr) || (strstr(roomName.c_str(), toLower(std::string(ConfigChatServer::getClusterName() ) ).c_str() ) )) { - if ((strstr(roomName.c_str(), "GroupChat") != NULL) || (strstr(roomName.c_str(), "groupchat") != NULL)) + if ((strstr(roomName.c_str(), "GroupChat") != nullptr) || (strstr(roomName.c_str(), "groupchat") != nullptr)) { size_t pos = roomName.rfind("."); if (pos != roomName.npos) @@ -1311,7 +1311,7 @@ void ChatServer::destroyRoom(const std::string & roomName) const ChatServerRoomOwner *owner = instance().chatInterface->getRoomOwner(roomName); if (!instance().ownerSystem) { - DEBUG_WARNING(true, ("Chat ownerSystem is NULL")); + DEBUG_WARNING(true, ("Chat ownerSystem is nullptr")); return; } if (owner) @@ -1331,7 +1331,7 @@ void ChatServer::disconnectAvatar(const ChatAvatar & avatar) if (&avatar == instance().ownerSystem) { - instance().ownerSystem = NULL; + instance().ownerSystem = nullptr; } ChatAvatarList::iterator i; for(i = instance().chatAvatars.begin(); i != instance().chatAvatars.end(); ++i) @@ -1423,7 +1423,7 @@ void ChatServer::enterRoom(const ChatAvatarId & id, const std::string & roomName const ChatAvatar *avatar = getAvatarByNetworkId(getNetworkIdByAvatarId(id)); if (room && avatar) { - instance().chatInterface->RequestEnterRoom(avatar, room->getAddress(), NULL); + instance().chatInterface->RequestEnterRoom(avatar, room->getAddress(), nullptr); } else { @@ -1450,7 +1450,7 @@ void ChatServer::putSystemAvatarInRoom(const std::string & roomName) const ChatServerRoomOwner *room = instance().chatInterface->getRoomOwner(roomName); if (room && instance().ownerSystem) { - instance().chatInterface->RequestEnterRoom(instance().ownerSystem, room->getAddress(), NULL); + instance().chatInterface->RequestEnterRoom(instance().ownerSystem, room->getAddress(), nullptr); } } @@ -1619,7 +1619,7 @@ void ChatServer::invite(const NetworkId & id, const ChatAvatarId & avatarId, con ChatServer::fileLog(s_enableChatRoomLogs, "ChatServer", "invite() id(%s) avatar(%s) roomName(%s)", id.getValueString().c_str(), avatarId.getFullName().c_str(), roomName.c_str()); // Try to get an invitor - ChatAvatar const * invitor = NULL; + ChatAvatar const * invitor = nullptr; if (id != NetworkId::cms_invalid) { invitor = getAvatarByNetworkId(id); @@ -1738,7 +1738,7 @@ void ChatServer::inviteGroupMembers(const NetworkId & id, const ChatAvatarId & a void ChatServer::removeSystemAvatarFromRoom(const ChatRoom *room) { - ChatServer::fileLog(s_enableChatRoomLogs, "ChatServer", "removeSystemAvatarFromRoom() room(%s)", (room != NULL) ? toNarrowString(room->getRoomName()).c_str() : "NULL"); + ChatServer::fileLog(s_enableChatRoomLogs, "ChatServer", "removeSystemAvatarFromRoom() room(%s)", (room != nullptr) ? toNarrowString(room->getRoomName()).c_str() : "nullptr"); if (!room || !instance().ownerSystem) { @@ -1754,7 +1754,7 @@ void ChatServer::removeSystemAvatarFromRoom(const ChatRoom *room) } } - instance().chatInterface->RequestLeaveRoom(instance().ownerSystem, room->getAddress(), NULL); + instance().chatInterface->RequestLeaveRoom(instance().ownerSystem, room->getAddress(), nullptr); } //----------------------------------------------------------------------- @@ -1991,7 +1991,7 @@ void ChatServer::sendInstantMessage(const ChatAvatarId & from, const ChatAvatarI const NetworkId &toNetworkId = getNetworkIdByAvatarId(to); const ChatAvatar * toAvatar = getAvatarByNetworkId(toNetworkId); - if (toAvatar != NULL) + if (toAvatar != nullptr) { ChatServer::fileLog(false, "ChatServer", "sendInstantMessage() resolved tell locally"); @@ -2022,7 +2022,7 @@ void ChatServer::sendInstantMessage(const ChatAvatarId & from, const ChatAvatarI IGNORE_RETURN(instance().chatInterface->RequestSendInstantMessage(fromAvatar, ChatUnicodeString(friendName.data(), friendName.size()), ChatUnicodeString(friendAddress.data(), friendAddress.size()), - ChatUnicodeString(message.data(), message.size()), ChatUnicodeString(outOfBand.data(), outOfBand.size()), NULL)); + ChatUnicodeString(message.data(), message.size()), ChatUnicodeString(outOfBand.data(), outOfBand.size()), nullptr)); } } } @@ -2054,7 +2054,7 @@ void ChatServer::sendInstantMessage(const NetworkId & fromId, const unsigned int { return; } - else if (::time(NULL) < aed->unsquelchTime) // still in squelch period + else if (::time(nullptr) < aed->unsquelchTime) // still in squelch period { return; } @@ -2076,14 +2076,14 @@ void ChatServer::sendInstantMessage(const NetworkId & fromId, const unsigned int Unicode::String wideFrom; Unicode::String wideTo; - if (from != NULL) + if (from != nullptr) { makeAvatarId(*from, fromAvatarId); wideFrom = (Unicode::narrowToWide(fromAvatarId.getFullName())); } ChatAvatarId toAvatarId; - if (toAvatar != NULL) + if (toAvatar != nullptr) { ChatServer::fileLog(false, "ChatServer", "sendInstantMessage() resolved tell locally"); @@ -2158,7 +2158,7 @@ void ChatServer::sendPersistentMessage(const ChatAvatarId & from, const ChatAvat ChatUnicodeString(subject.data(), subject.size()), ChatUnicodeString(message.data(), message.size()), ChatUnicodeString(oob.data(), oob.size()), - NULL + nullptr ); Unicode::String log; @@ -2187,7 +2187,7 @@ void ChatServer::sendPersistentMessage(const NetworkId & fromId, const unsigned // to.cluster.c_str(), to.name.c_str()); UNREF(sequenceId); ChatServer::AvatarExtendedData * aed = getAvatarExtendedDataByNetworkId(fromId); - const ChatAvatar * from = (aed ? &(aed->chatAvatar) : NULL); + const ChatAvatar * from = (aed ? &(aed->chatAvatar) : nullptr); if(from) { // see if player is squelched @@ -2197,7 +2197,7 @@ void ChatServer::sendPersistentMessage(const NetworkId & fromId, const unsigned { return; } - else if (::time(NULL) < aed->unsquelchTime) // still in squelch period + else if (::time(nullptr) < aed->unsquelchTime) // still in squelch period { return; } @@ -2225,7 +2225,7 @@ void ChatServer::sendPersistentMessage(const NetworkId & fromId, const unsigned ChatAvatarId fromAvatarId; - if (from != NULL) + if (from != nullptr) { makeAvatarId(*from, fromAvatarId); } @@ -2255,7 +2255,7 @@ void ChatServer::sendRoomMessage(const ChatAvatarId &id, const std::string & roo if (!instance().ownerSystem) { - DEBUG_WARNING(true, ("Chat ownerSystem is NULL")); + DEBUG_WARNING(true, ("Chat ownerSystem is nullptr")); return; } // get room id @@ -2265,7 +2265,7 @@ void ChatServer::sendRoomMessage(const ChatAvatarId &id, const std::string & roo { const ChatAvatar *sender = instance().ownerSystem; - IGNORE_RETURN(instance().chatInterface->RequestSendRoomMessage(sender, (*f).second.getAddress(), ChatUnicodeString(msg.data(), msg.size()), ChatUnicodeString(oob.data(), oob.size()), NULL)); + IGNORE_RETURN(instance().chatInterface->RequestSendRoomMessage(sender, (*f).second.getAddress(), ChatUnicodeString(msg.data(), msg.size()), ChatUnicodeString(oob.data(), oob.size()), nullptr)); } } } @@ -2280,7 +2280,7 @@ void ChatServer::sendRoomMessage(const NetworkId & id, const unsigned int sequen UNREF(sequence); ChatServer::AvatarExtendedData * aed = getAvatarExtendedDataByNetworkId(id); - const ChatAvatar * sender = (aed ? &(aed->chatAvatar) : NULL); + const ChatAvatar * sender = (aed ? &(aed->chatAvatar) : nullptr); const ChatServerRoomOwner *room = instance().chatInterface->getRoomOwner(roomId); if(sender && room) { @@ -2296,7 +2296,7 @@ void ChatServer::sendRoomMessage(const NetworkId & id, const unsigned int sequen aed->nonSpatialCharCount += msg.size(); // sync chat character count with game server - timeNow = ::time(NULL); + timeNow = ::time(nullptr); if ((timeNow > aed->chatSpamNextTimeToSyncWithGameServer) || (timeNow > aed->chatSpamTimeEndInterval)) { GenericValueTypeMessage, std::pair > > chatStatistics("ChatStatisticsCS", std::make_pair(std::make_pair(id, static_cast(aed->chatSpamTimeEndInterval)), std::make_pair(aed->spatialCharCount, aed->nonSpatialCharCount))); @@ -2322,7 +2322,7 @@ void ChatServer::sendRoomMessage(const NetworkId & id, const unsigned int sequen allowToSpeak = false; squelched = true; } - else if (::time(NULL) < aed->unsquelchTime) // still in squelch period + else if (::time(nullptr) < aed->unsquelchTime) // still in squelch period { allowToSpeak = false; squelched = true; @@ -2393,7 +2393,7 @@ void ChatServer::sendStandardRoomMessage(const ChatAvatarId &senderId, const std } if (sender) { - IGNORE_RETURN(instance().chatInterface->RequestSendRoomMessage(sender, (*f).second.getAddress(), ChatUnicodeString(msg.data(), msg.size()), ChatUnicodeString(oob.data(), oob.size()), NULL)); + IGNORE_RETURN(instance().chatInterface->RequestSendRoomMessage(sender, (*f).second.getAddress(), ChatUnicodeString(msg.data(), msg.size()), ChatUnicodeString(oob.data(), oob.size()), nullptr)); } } } @@ -2505,7 +2505,7 @@ std::string ChatServer::getFullChatAvatarName(ChatAvatar const *chatAvatar) { std::string result; - if (chatAvatar != NULL) + if (chatAvatar != nullptr) { result += toNarrowString(chatAvatar->getName()); result += '.'; @@ -2513,7 +2513,7 @@ std::string ChatServer::getFullChatAvatarName(ChatAvatar const *chatAvatar) } else { - result = "NULL"; + result = "nullptr"; } return result; @@ -2539,7 +2539,7 @@ std::string ChatServer::getConnectionAddress(Connection const *connection) { std::string result; - if (connection != NULL) + if (connection != nullptr) { char text[256]; snprintf(text, sizeof(text), "%s:%d", connection->getRemoteAddress().c_str(), connection->getRemotePort()); @@ -2547,7 +2547,7 @@ std::string ChatServer::getConnectionAddress(Connection const *connection) } else { - result = "NULL"; + result = "nullptr"; } return result; @@ -2566,13 +2566,13 @@ Unicode::String ChatServer::getChatRoomName(ChatRoom const *chatRoom) { Unicode::String result; - if (chatRoom != NULL) + if (chatRoom != nullptr) { result = toUnicodeString(chatRoom->getRoomName()); } else { - result = Unicode::narrowToWide("NULL"); + result = Unicode::narrowToWide("nullptr"); } return result; @@ -2582,12 +2582,12 @@ Unicode::String ChatServer::getChatRoomName(ChatRoom const *chatRoom) void ChatServer::clearCustomerServiceServerConnection() { - if (instance().customerServiceServerConnection != NULL) + if (instance().customerServiceServerConnection != nullptr) { instance().customerServiceServerConnection->disconnect(); } - instance().customerServiceServerConnection = NULL; + instance().customerServiceServerConnection = nullptr; } // ---------------------------------------------------------------------- @@ -2596,7 +2596,7 @@ void ChatServer::connectToCustomerServiceServer(const std::string &address, cons { //DEBUG_REPORT_LOG(true, ("***ChatServer::connectToCustomerServiceServer() address(%s) port(%d)\n", address.c_str(), port)); - if (instance().customerServiceServerConnection != NULL) + if (instance().customerServiceServerConnection != nullptr) { instance().customerServiceServerConnection->disconnect(); } @@ -2670,7 +2670,7 @@ bool ChatServer::isValidChatAvatarName(Unicode::String const &chatAvatarName) void ChatServer::logChatMessage(Unicode::String const &logPlayer, Unicode::String const &fromPlayer, Unicode::String const &toPlayer, Unicode::String const &text, Unicode::String const &channel) { - DEBUG_WARNING(toPlayer.empty(), ("toPlayer is NULL")); + DEBUG_WARNING(toPlayer.empty(), ("toPlayer is nullptr")); Unicode::String lowerLogPlayer(Unicode::toLower(logPlayer)); Unicode::String lowerFromPlayer(Unicode::toLower(fromPlayer)); @@ -2760,7 +2760,7 @@ void ChatServer::requestTransferAvatar(const TransferCharacterData & request) ChatAvatarId destinationAvatar("SWG", destination, request.getDestinationCharacterName()); - instance().chatInterface->RequestTransferAvatar(request.getSourceStationId(), makeChatUnicodeString(sourceAvatar.getName()), makeChatUnicodeString(sourceAvatar.getAPIAddress()), request.getDestinationStationId(), makeChatUnicodeString(destinationAvatar.getName()), makeChatUnicodeString(destinationAvatar.getAPIAddress()), true, NULL); + instance().chatInterface->RequestTransferAvatar(request.getSourceStationId(), makeChatUnicodeString(sourceAvatar.getName()), makeChatUnicodeString(sourceAvatar.getAPIAddress()), request.getDestinationStationId(), makeChatUnicodeString(destinationAvatar.getName()), makeChatUnicodeString(destinationAvatar.getAPIAddress()), true, nullptr); } } @@ -2845,7 +2845,7 @@ void ChatServer::handleChatStatisticsFromGameServer(NetworkId const & character, // non-spatial chat to report to the game server else if (aed->nonSpatialCharCount != nonSpatialNumCharacters) { - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); if (timeNow > aed->chatSpamNextTimeToSyncWithGameServer) { GenericValueTypeMessage, std::pair > > chatStatistics("ChatStatisticsCS", std::make_pair(std::make_pair(character, static_cast(aed->chatSpamTimeEndInterval)), std::make_pair(aed->spatialCharCount, aed->nonSpatialCharCount))); @@ -2904,7 +2904,7 @@ void ChatServer::sendToGameServerById(unsigned const connectionId, GameNetworkMe GameServerConnection *ChatServer::getGameServerConnectionFromId(unsigned int sequence) { - GameServerConnection * result = NULL; + GameServerConnection * result = nullptr; std::unordered_map::iterator f = m_gameServerConnectionRegistry.find(sequence); if(f != m_gameServerConnectionRegistry.end()) { diff --git a/engine/server/application/ChatServer/src/shared/ChatServerRoomOwner.cpp b/engine/server/application/ChatServer/src/shared/ChatServerRoomOwner.cpp index 091a78ac..dc8cd1a3 100755 --- a/engine/server/application/ChatServer/src/shared/ChatServerRoomOwner.cpp +++ b/engine/server/application/ChatServer/src/shared/ChatServerRoomOwner.cpp @@ -86,7 +86,7 @@ const ChatRoom * ChatServerRoomOwner::getRoom() const if (chatInterface) return chatInterface->getRoom(roomID); - return NULL; + return nullptr; } //----------------------------------------------------------------------- diff --git a/engine/server/application/ChatServer/src/shared/VChatInterface.cpp b/engine/server/application/ChatServer/src/shared/VChatInterface.cpp index 6e7e257c..b98704bc 100755 --- a/engine/server/application/ChatServer/src/shared/VChatInterface.cpp +++ b/engine/server/application/ChatServer/src/shared/VChatInterface.cpp @@ -435,7 +435,7 @@ void VChatInterface::OnConnectionOpened( const char * address ) ChatServer::fileLog(ms_voiceLoggingEnabled, ms_logLable, "OnConnectionOpened: %s", address); - uint32 track = VChatAPI::GetAccount(ms_systemAvatarName, ConfigChatServer::getGameCode(), ConfigChatServer::getClusterName(), 0, 0, NULL); + uint32 track = VChatAPI::GetAccount(ms_systemAvatarName, ConfigChatServer::getGameCode(), ConfigChatServer::getClusterName(), 0, 0, nullptr); ChatServer::fileLog(ms_voiceLoggingEnabled, ms_logLable, "Creating system avatar: %s track(%u)", getSystemLoginName().c_str(), track); } @@ -477,7 +477,7 @@ void VChatInterface::OnGetAccount(unsigned track, unsigned result, unsigned user { requestConnectPlayer(info->suid,info->avatarName,info->id, info->failedAttempts+1); delete info; - info = NULL; + info = nullptr; return; } } @@ -501,7 +501,7 @@ void VChatInterface::OnGetAccount(unsigned track, unsigned result, unsigned user } delete info; - info = NULL; + info = nullptr; } void VChatInterface::OnGetChannelV2(unsigned track, unsigned result, @@ -639,7 +639,7 @@ void VChatInterface::OnGetAllChannels(unsigned track, unsigned result, const VCh if(shouldRetry) { - GetAllChannels(NULL); + GetAllChannels(nullptr); } } @@ -832,7 +832,7 @@ void VChatInterface::checkForCharacterChannelAdd(std::string const & name, std:: data.m_channelPassword, data.m_channelURI, "en_US", - NULL); + nullptr); (*iter).second.push_back(playerOID); @@ -877,7 +877,7 @@ void VChatInterface::checkForCharacterChannelRemove(std::string const & name, st parseWorldName(std::string(avatar->getServer().c_str())), "SWG", "guild", - NULL); + nullptr); } iter = (*chanIter).second.erase(iter); diff --git a/engine/server/application/CommoditiesServer/src/linux/main.cpp b/engine/server/application/CommoditiesServer/src/linux/main.cpp index b93208f5..ce3735d1 100755 --- a/engine/server/application/CommoditiesServer/src/linux/main.cpp +++ b/engine/server/application/CommoditiesServer/src/linux/main.cpp @@ -61,7 +61,7 @@ int main(int argc, char ** argv) Unicode::UnicodeNarrowStringVector localeVector; localeVector.push_back(defaultLocale); - LocalizationManager::install (new TreeFile::TreeFileFactory, localeVector, debugStringIds, NULL, displayBadStringIds); + LocalizationManager::install (new TreeFile::TreeFileFactory, localeVector, debugStringIds, nullptr, displayBadStringIds); ExitChain::add(LocalizationManager::remove, "LocalizationManager::remove"); DataTableManager::install(); diff --git a/engine/server/application/CommoditiesServer/src/shared/Auction.cpp b/engine/server/application/CommoditiesServer/src/shared/Auction.cpp index 0d1edd7f..63f43523 100755 --- a/engine/server/application/CommoditiesServer/src/shared/Auction.cpp +++ b/engine/server/application/CommoditiesServer/src/shared/Auction.cpp @@ -208,7 +208,7 @@ namespace AuctionNamespace if (iterAttr != searchableAttributeString->end()) { applicableSearchCondition = true; - return (NULL != strstr(iterAttr->second.c_str(), searchCondition.stringValue.c_str())); // lowercase is assumed (and required) + return (nullptr != strstr(iterAttr->second.c_str(), searchCondition.stringValue.c_str())); // lowercase is assumed (and required) } } @@ -242,7 +242,7 @@ namespace AuctionNamespace if (iterAttr != searchableAttributeString->end()) { applicableSearchCondition = true; - return (NULL == strstr(iterAttr->second.c_str(), searchCondition.stringValue.c_str())); // lowercase is assumed (and required) + return (nullptr == strstr(iterAttr->second.c_str(), searchCondition.stringValue.c_str())); // lowercase is assumed (and required) } } @@ -293,10 +293,10 @@ m_userDescription(userDescription), m_oobLength(oobLength), m_oobData(oobData), m_attributes(), -m_searchableAttributeInt(NULL), -m_searchableAttributeFloat(NULL), -m_searchableAttributeString(NULL), -m_highBid(NULL), +m_searchableAttributeInt(nullptr), +m_searchableAttributeFloat(nullptr), +m_searchableAttributeString(nullptr), +m_highBid(nullptr), m_item(new AuctionItem(itemId, itemType, itemTemplateId, itemTimer, itemNameLength, itemName, creatorId, itemSize)), m_sold(false), m_active(true), @@ -395,10 +395,10 @@ m_userDescription(userDescription), m_oobLength(oobLength), m_oobData(oobData), m_attributes(), -m_searchableAttributeInt(NULL), -m_searchableAttributeFloat(NULL), -m_searchableAttributeString(NULL), -m_highBid(NULL), +m_searchableAttributeInt(nullptr), +m_searchableAttributeFloat(nullptr), +m_searchableAttributeString(nullptr), +m_highBid(nullptr), m_item(new AuctionItem(itemId, itemType, itemTemplateId, itemTimer, itemNameLength, itemName, creatorId, itemSize)), m_sold(isSold), m_active(isActive), @@ -488,7 +488,7 @@ void Auction::Initialization() #ifdef _DEBUG for (int i = 0; i < static_cast(AuctionQueryHeadersMessage::SCC_LAST); ++i) { - s_searchConditionComparisonFn[i] = NULL; + s_searchConditionComparisonFn[i] = nullptr; } #endif @@ -502,7 +502,7 @@ void Auction::Initialization() #ifdef _DEBUG for (int j = 0; j < static_cast(AuctionQueryHeadersMessage::SCC_LAST); ++j) { - DEBUG_FATAL((s_searchConditionComparisonFn[j] == NULL), ("s_searchConditionComparisonFn array is NULL at index (%d)", j)); + DEBUG_FATAL((s_searchConditionComparisonFn[j] == nullptr), ("s_searchConditionComparisonFn array is nullptr at index (%d)", j)); } #endif @@ -659,7 +659,7 @@ const AuctionBid *Auction::GetPreviousBid() const { if (m_bids.size() <= 1) { - return NULL; + return nullptr; } else { @@ -677,9 +677,9 @@ const AuctionBid *Auction::GetPreviousBid() const */ int Auction::GetActualBid(AuctionBid *bid) { - assert(bid != NULL); + assert(bid != nullptr); int bidNeeded = std::max(m_minBid, bid->GetBid()); - if (m_highBid != NULL) + if (m_highBid != nullptr) { bidNeeded = m_highBid->GetBid(); if (*bid > *m_highBid) @@ -765,7 +765,7 @@ AuctionResultCode Auction::AddBid( AuctionBid *auctionBid = new AuctionBid(bidderId, bid, maxProxyBid); int newBidForHighBidder = GetActualBid(auctionBid); - if (m_highBid != NULL) + if (m_highBid != nullptr) { if (*auctionBid <= *m_highBid) { @@ -810,7 +810,7 @@ const AuctionBid *Auction::GetPlayerBid(const NetworkId & playerId) const } ++iter; } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -826,7 +826,7 @@ bool Auction::Update(int gameTime) //immediate sale DEBUG_REPORT_LOG(true, ("[Commodities Server Auction::Update] : Expiring immediate sale - Auction is active and sold.\n")); - if ((m_trackId != -1) && (CommodityServer::getInstance().getGameServer(m_trackId) != NULL)) + if ((m_trackId != -1) && (CommodityServer::getInstance().getGameServer(m_trackId) != nullptr)) { Expire(true, false, m_trackId); m_trackId = -1; @@ -840,14 +840,14 @@ bool Auction::Update(int gameTime) { DEBUG_REPORT_LOG(true, ("[Commodities Server Auction::Update] : Auction expiring based on timer.\n")); - if ((m_trackId != -1) && (CommodityServer::getInstance().getGameServer(m_trackId) != NULL)) + if ((m_trackId != -1) && (CommodityServer::getInstance().getGameServer(m_trackId) != nullptr)) { - Expire(m_highBid != NULL, true, m_trackId); + Expire(m_highBid != nullptr, true, m_trackId); m_trackId = -1; } else { - Expire(m_highBid != NULL, true); + Expire(m_highBid != nullptr, true); } } @@ -862,7 +862,7 @@ void Auction::Expire(bool sold, bool expiredBasedOnTimer, int track_id) m_auctionTimer = 0; m_active = false; - if (sold && m_highBid != NULL) + if (sold && m_highBid != nullptr) { m_sold = true; } @@ -934,7 +934,7 @@ void Auction::Expire(bool sold, bool expiredBasedOnTimer, int track_id) m_location.SetVendorFirstTimerExpiredAuctionDate(time(0)); } - DEBUG_REPORT_LOG(true, ("[Commodities Server Auction::Expire] : Sending OnAuctionExpired for non-sold auction and null high bid obj .\n")); + DEBUG_REPORT_LOG(true, ("[Commodities Server Auction::Expire] : Sending OnAuctionExpired for non-sold auction and nullptr high bid obj .\n")); AuctionMarket::getInstance().OnAuctionExpired( GetCreatorId(), m_sold, m_flags, NetworkId::cms_invalid, 0, m_item->GetItemId(), 0, @@ -1107,8 +1107,8 @@ void Auction::BuildSearchableAttributeList() std::map const & saAlias = CommoditiesAdvancedSearchAttribute::getSearchAttributeNameAliasesForGameObjectType(m_item->GetCategory()); // for factory crates, also include the attributes of the item inside the crate - std::map const * saItemInsideFactoryCrate = NULL; - std::map const * saAliasItemInsideFactoryCrate = NULL; + std::map const * saItemInsideFactoryCrate = nullptr; + std::map const * saAliasItemInsideFactoryCrate = nullptr; int gotItemInsideFactoryCrate = 0; if (m_item->GetCategory() == SharedObjectTemplate::GOT_misc_factory_crate) @@ -1134,10 +1134,10 @@ void Auction::BuildSearchableAttributeList() saAliasItemInsideFactoryCrate = &(CommoditiesAdvancedSearchAttribute::getSearchAttributeNameAliasesForGameObjectType(gotItemInsideFactoryCrate)); if (saItemInsideFactoryCrate->empty()) - saItemInsideFactoryCrate = NULL; + saItemInsideFactoryCrate = nullptr; if (saAliasItemInsideFactoryCrate->empty()) - saAliasItemInsideFactoryCrate = NULL; + saAliasItemInsideFactoryCrate = nullptr; } } diff --git a/engine/server/application/CommoditiesServer/src/shared/AuctionLocation.cpp b/engine/server/application/CommoditiesServer/src/shared/AuctionLocation.cpp index df458ef0..d692840d 100755 --- a/engine/server/application/CommoditiesServer/src/shared/AuctionLocation.cpp +++ b/engine/server/application/CommoditiesServer/src/shared/AuctionLocation.cpp @@ -137,7 +137,7 @@ AuctionLocation::~AuctionLocation() bool AuctionLocation::AddAuction(Auction *auction) { - assert(auction != NULL); + assert(auction != nullptr); if (IsVendorMarket() && (!auction->IsActive() || !IsOwner(auction->GetCreatorId()))) { @@ -189,7 +189,7 @@ void AuctionLocation::CancelVendorSale(Auction *auction) bool AuctionLocation::RemoveAuction(Auction *auction) { - assert(auction != NULL); + assert(auction != nullptr); return RemoveAuction(auction->GetItem().GetItemId()); } @@ -265,7 +265,7 @@ Auction *AuctionLocation::GetAuction(const NetworkId & itemId) return((*i).second); } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/application/CommoditiesServer/src/shared/AuctionMarket.cpp b/engine/server/application/CommoditiesServer/src/shared/AuctionMarket.cpp index a07b0864..328f189e 100644 --- a/engine/server/application/CommoditiesServer/src/shared/AuctionMarket.cpp +++ b/engine/server/application/CommoditiesServer/src/shared/AuctionMarket.cpp @@ -121,7 +121,7 @@ namespace AuctionMarketNamespace Auction const * const auction, int const type, int const entranceCharge, - AuctionBid const * const playerBid = NULL + AuctionBid const * const playerBid = nullptr ) { AuctionDataHeader *header = new AuctionDataHeader; @@ -301,7 +301,7 @@ namespace AuctionMarketNamespace std::map attributeValue; }; - GetItemAttributeDataRequest * getItemAttributeDataRequest = NULL; + GetItemAttributeDataRequest * getItemAttributeDataRequest = nullptr; void processItemAttributeData(std::map const & auctions); @@ -394,8 +394,8 @@ void AuctionMarketNamespace::processItemAttributeData(std::map const * skipAttribute = NULL; - std::map const * skipAttributeAlias = NULL; + std::map const * skipAttribute = nullptr; + std::map const * skipAttributeAlias = nullptr; if (getItemAttributeDataRequest->ignoreSearchableAttribute) { std::map const & sa = CommoditiesAdvancedSearchAttribute::getSearchAttributeForGameObjectType(iterAuction->second->GetItem().GetCategory()); @@ -590,7 +590,7 @@ void AuctionMarketNamespace::processItemAttributeData(std::mapGetLocation(); if (!location.IsOwner(auction->GetItem().GetOwnerId())) @@ -1979,7 +1979,7 @@ void AuctionMarket::AcceptHighBid(const AcceptHighBidMessage &message) DEBUG_REPORT_LOG(m_showAllDebugInfo, ("[Commodities Server AcceptHighBidMessage] : ResponseId : %d.\n", message.GetResponseId())); DEBUG_REPORT_LOG(m_showAllDebugInfo, ("[Commodities Server AcceptHighBidMessage] : TrackId : %d.\n", message.GetTrackId())); - Auction *auction = NULL; + Auction *auction = nullptr; AuctionResultCode result = ARC_Success; std::map::iterator iter = m_auctions.find( message.GetAuctionId()); @@ -1994,7 +1994,7 @@ void AuctionMarket::AcceptHighBid(const AcceptHighBidMessage &message) { result = ARC_NotItemOwner; } - else if (auction->GetHighBid() == NULL) + else if (auction->GetHighBid() == nullptr) { result = ARC_NoBids; } @@ -2525,19 +2525,19 @@ void AuctionMarket::QueryAuctionHeaders( int debugNumberLocationsMatched = 0; int debugNumberAuctionsTested = 0; - std::map *auctionsPtr = NULL; + std::map *auctionsPtr = nullptr; int entranceCharge = 0; - AuctionLocation *locationPtr = NULL; - Auction *auctionPtr = NULL; + AuctionLocation *locationPtr = nullptr; + Auction *auctionPtr = nullptr; std::map::const_iterator auctionIterator; - AuctionDataHeader *header = NULL; + AuctionDataHeader *header = nullptr; bool checkItemTemplate; while (locationIter != locationIterEnd) { ++debugNumberLocationsTested; checkItemTemplate = false; - auctionsPtr = NULL; + auctionsPtr = nullptr; entranceCharge = 0; locationPtr = (*locationIter).second; @@ -2606,7 +2606,7 @@ void AuctionMarket::QueryAuctionHeaders( auctionPtr = (*auctionIterator).second; const AuctionItem &item = auctionPtr->GetItem(); - header = NULL; + header = nullptr; // Check to see if the item template matches if (searchForResourceContainer && (itemTemplateId != 0)) @@ -4977,7 +4977,7 @@ void AuctionMarket::getAuctionLocationPriorityQueue(int requestingGameServerId, { std::string output; char buffer[2048]; - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); for (std::set >::const_iterator iterPQ = m_priorityQueueAuctionLocation.begin(); iterPQ != m_priorityQueueAuctionLocation.end(); ++iterPQ) { if (count <= 0) diff --git a/engine/server/application/CommoditiesServer/src/shared/CommodityServer.cpp b/engine/server/application/CommoditiesServer/src/shared/CommodityServer.cpp index 1e2671be..3c2019cd 100755 --- a/engine/server/application/CommoditiesServer/src/shared/CommodityServer.cpp +++ b/engine/server/application/CommoditiesServer/src/shared/CommodityServer.cpp @@ -191,7 +191,7 @@ void CommodityServer::run() s_commodityServerMetricsData = new CommodityServerMetricsData; MetricsManager::install(s_commodityServerMetricsData, false, "CommoditiesServer", "", 0); - time_t timePrevious = ::time(NULL); + time_t timePrevious = ::time(nullptr); time_t timeCurrent = timePrevious; while (true) @@ -202,7 +202,7 @@ void CommodityServer::run() break; NetworkHandler::update(); - timeCurrent = ::time(NULL); + timeCurrent = ::time(nullptr); MetricsManager::update(static_cast((timeCurrent - timePrevious) * 1000)); timePrevious = timeCurrent; @@ -229,18 +229,18 @@ void CommodityServer::run() // this is not a high priority thing, so wait until // the cluster has started and "stabilized" before // doing this; 3 hours should be adequate - time_t timeToRequestExcludedType = ::time(NULL) + 10800; + time_t timeToRequestExcludedType = ::time(nullptr) + 10800; // one time request from the game server (any game server) // to receive the resource tree hierarchy to support // searching for resource container - time_t timeToRequestResourceTree = ::time(NULL); + time_t timeToRequestResourceTree = ::time(nullptr); while(true) { NetworkHandler::update(); - timeCurrent = ::time(NULL); + timeCurrent = ::time(nullptr); MetricsManager::update(static_cast((timeCurrent - timePrevious) * 1000)); timePrevious = timeCurrent; diff --git a/engine/server/application/CommoditiesServer/src/shared/CommodityServerMetricsData.cpp b/engine/server/application/CommoditiesServer/src/shared/CommodityServerMetricsData.cpp index 4b1ff37e..90594e07 100755 --- a/engine/server/application/CommoditiesServer/src/shared/CommodityServerMetricsData.cpp +++ b/engine/server/application/CommoditiesServer/src/shared/CommodityServerMetricsData.cpp @@ -74,7 +74,7 @@ void CommodityServerMetricsData::updateData() buffer[sizeof(buffer)-1] = '\0'; } - m_mapAuctionsCountByGameObjectTypeIndex[iterGameObjectType->first] = addMetric(buffer, 0, NULL, false, false); + m_mapAuctionsCountByGameObjectTypeIndex[iterGameObjectType->first] = addMetric(buffer, 0, nullptr, false, false); } } } diff --git a/engine/server/application/ConnectionServer/src/linux/main.cpp b/engine/server/application/ConnectionServer/src/linux/main.cpp index 24c76421..5984dd4c 100755 --- a/engine/server/application/ConnectionServer/src/linux/main.cpp +++ b/engine/server/application/ConnectionServer/src/linux/main.cpp @@ -37,7 +37,7 @@ int main(int argc, char ** argv) SetupSharedFile::install(false); SetupSharedNetworkMessages::install(); - SetupSharedRandom::install(time(NULL)); + SetupSharedRandom::install(time(nullptr)); //setup the server NetworkHandler::install(); diff --git a/engine/server/application/ConnectionServer/src/shared/ClientConnection.cpp b/engine/server/application/ConnectionServer/src/shared/ClientConnection.cpp index f7b3020b..32b3811c 100755 --- a/engine/server/application/ConnectionServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/ConnectionServer/src/shared/ClientConnection.cpp @@ -82,7 +82,7 @@ m_canCreateRegularCharacter(false), m_canCreateJediCharacter(false), m_hasRequestedCharacterCreate(false), m_hasCreatedCharacter(false), -m_pendingCharacterCreate(NULL), +m_pendingCharacterCreate(nullptr), m_canSkipTutorial(false), m_characterId(NetworkId::cms_invalid), m_characterName(), @@ -144,7 +144,7 @@ ClientConnection::~ClientConnection() { hasBeenKicked = m_client->hasBeenKicked(); delete m_client; - m_client = NULL; + m_client = nullptr; } // tell Session to stop recording play time for the character @@ -177,7 +177,7 @@ ClientConnection::~ClientConnection() m_pendingChatQueryRoomRequests.clear(); delete m_pendingCharacterCreate; - m_pendingCharacterCreate = NULL; + m_pendingCharacterCreate = nullptr; } @@ -202,7 +202,7 @@ std::string ClientConnection::getPlayTimeDuration() const int playTimeDuration = 0; if (m_startPlayTime > 0) - playTimeDuration = static_cast(::time(NULL) - m_startPlayTime); + playTimeDuration = static_cast(::time(nullptr) - m_startPlayTime); return CalendarTime::convertSecondsToHMS(static_cast(playTimeDuration)); } @@ -214,7 +214,7 @@ std::string ClientConnection::getActivePlayTimeDuration() const int activePlayTimeDuration = static_cast(m_activePlayTimeDuration); if (m_lastActiveTime > 0) - activePlayTimeDuration += static_cast(::time(NULL) - m_lastActiveTime); + activePlayTimeDuration += static_cast(::time(nullptr) - m_lastActiveTime); return CalendarTime::convertSecondsToHMS(static_cast(activePlayTimeDuration)); } @@ -226,7 +226,7 @@ std::string ClientConnection::getCurrentActivePlayTimeDuration() const int activePlayTimeDuration = 0; if (m_lastActiveTime > 0) - activePlayTimeDuration = static_cast(::time(NULL) - m_lastActiveTime); + activePlayTimeDuration = static_cast(::time(nullptr) - m_lastActiveTime); return CalendarTime::convertSecondsToHMS(static_cast(activePlayTimeDuration)); } @@ -400,7 +400,7 @@ void ClientConnection::handleClientIdMessage(const ClientIdMsg& msg) std::hash h; m_suid = h(m_accountName.c_str()); } - onValidateClient(m_suid, m_accountName, m_isSecure, NULL, ConfigConnectionServer::getDefaultGameFeatures(), ConfigConnectionServer::getDefaultSubscriptionFeatures(), 0, 0, 0, 0, ConfigConnectionServer::getFakeBuddyPoints()); + onValidateClient(m_suid, m_accountName, m_isSecure, nullptr, ConfigConnectionServer::getDefaultGameFeatures(), ConfigConnectionServer::getDefaultSubscriptionFeatures(), 0, 0, 0, 0, ConfigConnectionServer::getFakeBuddyPoints()); } } else @@ -452,7 +452,7 @@ void ClientConnection::onIdValidated(bool canLogin, bool canCreateRegularCharact } delete m_pendingCharacterCreate; - m_pendingCharacterCreate = NULL; + m_pendingCharacterCreate = nullptr; return; } @@ -683,7 +683,7 @@ void ClientConnection::onReceive(const Archive::ByteStream & message) } else { - ConnectionServer::dropClient(this, "m_client is null while receiving a message!"); + ConnectionServer::dropClient(this, "m_client is nullptr while receiving a message!"); disconnect(); } } @@ -796,7 +796,7 @@ void ClientConnection::onReceive(const Archive::ByteStream & message) } else { - ConnectionServer::dropClient(this, "m_client is null while receiving a message!"); + ConnectionServer::dropClient(this, "m_client is nullptr while receiving a message!"); disconnect(); } } @@ -839,7 +839,7 @@ void ClientConnection::onReceive(const Archive::ByteStream & message) } else { - ConnectionServer::dropClient(this, "m_client is null while receiving a message!"); + ConnectionServer::dropClient(this, "m_client is nullptr while receiving a message!"); disconnect(); } } @@ -865,7 +865,7 @@ void ClientConnection::onReceive(const Archive::ByteStream & message) //DEBUG_REPORT_LOG(true, ("CONSRV::CS - suid: %i\n", getSUID())); - if (customerServiceConnection != NULL) + if (customerServiceConnection != nullptr) { static std::vector v; v.clear(); @@ -935,7 +935,7 @@ void ClientConnection::onReceive(const Archive::ByteStream & message) } else { - ConnectionServer::dropClient(this, "m_client is null while receiving a message!"); + ConnectionServer::dropClient(this, "m_client is nullptr while receiving a message!"); disconnect(); } } @@ -951,7 +951,7 @@ void ClientConnection::onReceive(const Archive::ByteStream & message) if (m_lastActiveTime > 0) { // record the amount of active time - m_activePlayTimeDuration += static_cast(::time(NULL) - m_lastActiveTime); + m_activePlayTimeDuration += static_cast(::time(nullptr) - m_lastActiveTime); // tell Session to stop recording play time for the character if (ConnectionServer::getSessionApiClient() && ConfigConnectionServer::getSessionRecordPlayTime()) @@ -988,7 +988,7 @@ void ClientConnection::onReceive(const Archive::ByteStream & message) if (m_lastActiveTime == 0) { // record the time client went active - m_lastActiveTime = ::time(NULL); + m_lastActiveTime = ::time(nullptr); // tell Session to start recording play time for the character if (ConnectionServer::getSessionApiClient() && ConfigConnectionServer::getSessionRecordPlayTime()) @@ -1616,7 +1616,7 @@ void ClientConnection::onValidateClient (uint32 suid, const std::string & userna } // tell client the server-side game and subscription feature bits and which ConnectionServer we are and the current server Epoch time - GenericValueTypeMessage, std::pair > > const msgFeatureBits("AccountFeatureBits", std::make_pair(std::make_pair(gameFeatures, subscriptionFeatures), std::make_pair(ConfigConnectionServer::getConnectionServerNumber(), static_cast(::time(NULL))))); + GenericValueTypeMessage, std::pair > > const msgFeatureBits("AccountFeatureBits", std::make_pair(std::make_pair(gameFeatures, subscriptionFeatures), std::make_pair(ConfigConnectionServer::getConnectionServerNumber(), static_cast(::time(nullptr))))); send(msgFeatureBits, true); std::string const gameFeaturesDescription = ClientGameFeature::getDescription(gameFeatures); diff --git a/engine/server/application/ConnectionServer/src/shared/ConnectionServer.cpp b/engine/server/application/ConnectionServer/src/shared/ConnectionServer.cpp index b698ecb6..10d0c99f 100755 --- a/engine/server/application/ConnectionServer/src/shared/ConnectionServer.cpp +++ b/engine/server/application/ConnectionServer/src/shared/ConnectionServer.cpp @@ -163,7 +163,7 @@ const CustomerServiceConnection * ConnectionServer::getCustomerServiceConnection { return (*(instance().customerServiceServers.begin())); } - return NULL; + return nullptr; } //----------------------------------------------------------------------- @@ -366,7 +366,7 @@ void ConnectionServer::addNewClient(ClientConnection* cconn, const NetworkId &oi //send the game server a message about this client. static const std::string loginTrace("TRACE_LOGIN"); LOG(loginTrace, ("NewClient(%d, %s, %s)", cconn->getSUID(), oid.getValueString().c_str(), cconn->getAccountName().c_str())); - NewClient m(oid, cconn->getAccountName(), cconn->getRemoteAddress(), cconn->getIsSecure(), false, cconn->getSUID(), NULL, cconn->getGameFeatures(), cconn->getSubscriptionFeatures(), cconn->getEntitlementTotalTime(), cconn->getEntitlementEntitledTime(), cconn->getEntitlementTotalTimeSinceLastLogin(), cconn->getEntitlementEntitledTimeSinceLastLogin(), cconn->getBuddyPoints(), cconn->getConsumedRewardEvents(), cconn->getClaimedRewardItems(), cconn->isUsingAdminLogin(), cconn->getCanSkipTutorial(), sendToStarport ); + NewClient m(oid, cconn->getAccountName(), cconn->getRemoteAddress(), cconn->getIsSecure(), false, cconn->getSUID(), nullptr, cconn->getGameFeatures(), cconn->getSubscriptionFeatures(), cconn->getEntitlementTotalTime(), cconn->getEntitlementEntitledTime(), cconn->getEntitlementTotalTimeSinceLastLogin(), cconn->getEntitlementEntitledTimeSinceLastLogin(), cconn->getBuddyPoints(), cconn->getConsumedRewardEvents(), cconn->getClaimedRewardItems(), cconn->isUsingAdminLogin(), cconn->getCanSkipTutorial(), sendToStarport ); gconn->send(m, true); //@todo move this to ClientConnection.cpp } @@ -375,7 +375,7 @@ void ConnectionServer::addNewClient(ClientConnection* cconn, const NetworkId &oi void ConnectionServer::dropClient(ClientConnection * conn, const std::string& description) { - DEBUG_FATAL(!conn, ("Cannot call dropClient with NULL connection")); + DEBUG_FATAL(!conn, ("Cannot call dropClient with nullptr connection")); if (!conn) //lint !e774 // boolean within 'if' always evaluates to False //suppresed because this is only relevant in DEBUG builds return; @@ -466,7 +466,7 @@ GameConnection* ConnectionServer::getGameConnection(const std::string &sceneName return (*i).second; } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -477,15 +477,15 @@ void ConnectionServer::handleConnectionServerIdMessage(const ConnectionServerId const Service * const servicePrivate = getClientServicePrivate(); const Service * const servicePublic = getClientServicePublic(); - FATAL(servicePrivate == NULL && servicePublic == NULL, ("No client service is active!")); + FATAL(servicePrivate == nullptr && servicePublic == nullptr, ("No client service is active!")); const Service * const g = getGameService(); - FATAL(g == NULL, ("No game service is active!")); + FATAL(g == nullptr, ("No game service is active!")); const Service * const c = getChatService(); const Service * const cs = getCustomerService(); const uint16 pingPort = getPingPort (); - if((servicePrivate != NULL || servicePublic != NULL) && g != NULL) //lint !e774 // always evaluates to false // suppresed because the FATAL macro triggers this lint warning + if((servicePrivate != nullptr || servicePublic != nullptr) && g != nullptr) //lint !e774 // always evaluates to false // suppresed because the FATAL macro triggers this lint warning { uint16 chatPort = 0; uint16 csPort = 0; @@ -739,7 +739,7 @@ void ConnectionServer::receiveMessage(const MessageDispatch::Emitter & source, c std::set::const_iterator i; for(i = clients.begin(); i != clients.end(); ++ i) { - (*i)->setChatConnection(NULL); + (*i)->setChatConnection(nullptr); } } } @@ -782,7 +782,7 @@ void ConnectionServer::receiveMessage(const MessageDispatch::Emitter & source, c std::set::const_iterator i; for(i = clients.begin(); i != clients.end(); ++ i) { - (*i)->setCustomerServiceConnection(NULL); + (*i)->setCustomerServiceConnection(nullptr); } } @@ -960,7 +960,7 @@ void ConnectionServer::remove() // explicitly delete all connections that were setup from setupConnections rather than letting // Connection::remove do it. There are connections that require a valid s_connectionServer which is deleted - // and set to NULL. + // and set to nullptr. s_connectionServer->unsetupConnections(); SetupSharedLog::remove(); @@ -1316,7 +1316,7 @@ GameConnection* ConnectionServer::getGameConnection(uint32 gameServerId) if (i != cs.gameServerMap.end()) return (*i).second; - return NULL; + return nullptr; } //----------------------------------------------------------------------- @@ -1327,7 +1327,7 @@ GameConnection* ConnectionServer::getAnyGameConnection() if (!cs.gameServerMap.empty()) return cs.gameServerMap.begin()->second; - return NULL; + return nullptr; } //----------------------------------------------------------------------- diff --git a/engine/server/application/ConnectionServer/src/shared/GameConnection.cpp b/engine/server/application/ConnectionServer/src/shared/GameConnection.cpp index ddf0fe38..ecfede1e 100755 --- a/engine/server/application/ConnectionServer/src/shared/GameConnection.cpp +++ b/engine/server/application/ConnectionServer/src/shared/GameConnection.cpp @@ -157,7 +157,7 @@ void GameConnection::onReceive(const Archive::ByteStream & message) ca.getStartYaw(), ca.getTemplateName(), ca.getTimeSeconds(), - static_cast(::time(NULL)), + static_cast(::time(nullptr)), ConfigConnectionServer::getDisableWorldSnapshot()); client->getClientConnection()->send(startScene, true); } @@ -166,7 +166,7 @@ void GameConnection::onReceive(const Archive::ByteStream & message) // record the time when play started for the character if (client->getClientConnection()->getStartPlayTime() == 0) { - client->getClientConnection()->setStartPlayTime(::time(NULL)); + client->getClientConnection()->setStartPlayTime(::time(nullptr)); } // update the play time info on the game server diff --git a/engine/server/application/ConnectionServer/src/shared/PseudoClientConnection.cpp b/engine/server/application/ConnectionServer/src/shared/PseudoClientConnection.cpp index 49553a04..9caa85e9 100755 --- a/engine/server/application/ConnectionServer/src/shared/PseudoClientConnection.cpp +++ b/engine/server/application/ConnectionServer/src/shared/PseudoClientConnection.cpp @@ -246,9 +246,9 @@ void PseudoClientConnection::receiveMessage(const Archive::ByteStream & message) characterId = m_transferCharacterData.getDestinationCharacterId(); } std::vector > static const emptyStringVector; - NewClient m(characterId, "TransferServer", NetworkHandler::getHostName(), true, false, stationId, NULL, 0, 0, 0, 0, 0, 0, 0, emptyStringVector, emptyStringVector, m_transferCharacterData.getCSToolId() != 0, true); + NewClient m(characterId, "TransferServer", NetworkHandler::getHostName(), true, false, stationId, nullptr, 0, 0, 0, 0, 0, 0, 0, emptyStringVector, emptyStringVector, m_transferCharacterData.getCSToolId() != 0, true); m_gameConnection->send(m, true); - LOG("CustomerService", ("CharacterTransfer: Sent NewClient(%s, \"TransferServer\", \"%s\", true, false, %d, NULL, 0, 0)\n", characterId.getValueString().c_str(), NetworkHandler::getHostName().c_str(), stationId)); + LOG("CustomerService", ("CharacterTransfer: Sent NewClient(%s, \"TransferServer\", \"%s\", true, false, %d, nullptr, 0, 0)\n", characterId.getValueString().c_str(), NetworkHandler::getHostName().c_str(), stationId)); } } else if(msg.isType("TransferLoginCharacterToSourceServer")) diff --git a/engine/server/application/ConnectionServer/src/shared/SessionApiClient.cpp b/engine/server/application/ConnectionServer/src/shared/SessionApiClient.cpp index dba551e9..67598bb4 100755 --- a/engine/server/application/ConnectionServer/src/shared/SessionApiClient.cpp +++ b/engine/server/application/ConnectionServer/src/shared/SessionApiClient.cpp @@ -303,10 +303,10 @@ void SessionApiClient::OnGetFeatures(const apiTrackingNumber trackingNumber, if (i != ms_getFeaturesTrackingNumberMap.end()) { bool reuseMessage = false; - AccountFeatureIdRequest const * accountFeatureIdRequest = NULL; - AdjustAccountFeatureIdRequest const * adjustAccountFeatureIdRequest = NULL; - AdjustAccountFeatureIdResponse * adjustAccountFeatureIdResponse = NULL; - ClaimRewardsMessage * claimRewardsMessage = NULL; + AccountFeatureIdRequest const * accountFeatureIdRequest = nullptr; + AdjustAccountFeatureIdRequest const * adjustAccountFeatureIdRequest = nullptr; + AdjustAccountFeatureIdResponse * adjustAccountFeatureIdResponse = nullptr; + ClaimRewardsMessage * claimRewardsMessage = nullptr; if (i->second->isType("AccountFeatureIdRequest")) accountFeatureIdRequest = dynamic_cast(i->second); @@ -319,7 +319,7 @@ void SessionApiClient::OnGetFeatures(const apiTrackingNumber trackingNumber, if (result == RESULT_SUCCESS) { - ClientConnection * clientConnection = NULL; + ClientConnection * clientConnection = nullptr; if (accountFeatureIdRequest) clientConnection = ConnectionServer::getClientConnection(accountFeatureIdRequest->getTargetStationId()); else if (adjustAccountFeatureIdRequest) @@ -391,7 +391,7 @@ void SessionApiClient::OnGetFeatures(const apiTrackingNumber trackingNumber, else { // if account already has the feature, adjust it, otherwise add the feature - LoginAPI::Feature const * existingFeature = NULL; + LoginAPI::Feature const * existingFeature = nullptr; for (unsigned k = 0; k < featureCount; ++k) { @@ -444,7 +444,7 @@ void SessionApiClient::OnGetFeatures(const apiTrackingNumber trackingNumber, } else { - LoginAPI::Feature const * newlyAddedFeature = NULL; + LoginAPI::Feature const * newlyAddedFeature = nullptr; for (unsigned k = 0; k < featureCount; ++k) { @@ -506,7 +506,7 @@ void SessionApiClient::OnGetFeatures(const apiTrackingNumber trackingNumber, else { // see if account already has the required feature - LoginAPI::Feature const * existingFeature = NULL; + LoginAPI::Feature const * existingFeature = nullptr; for (unsigned k = 0; k < featureCount; ++k) { @@ -904,7 +904,7 @@ void SessionApiClient::validateClient (ClientConnection* client, const std::stri void SessionApiClient::startPlay(const ClientConnection& client) { - IGNORE_RETURN(SessionStartPlay(client.getSessionId().c_str(), ConfigConnectionServer::getClusterName(), client.getCharacterName().c_str(), NULL)); + IGNORE_RETURN(SessionStartPlay(client.getSessionId().c_str(), ConfigConnectionServer::getClusterName(), client.getCharacterName().c_str(), nullptr)); } //------------------------------------------------------------ diff --git a/engine/server/application/CustomerServiceServer/src/linux/main.cpp b/engine/server/application/CustomerServiceServer/src/linux/main.cpp index 7cdc4016..35924a2c 100755 --- a/engine/server/application/CustomerServiceServer/src/linux/main.cpp +++ b/engine/server/application/CustomerServiceServer/src/linux/main.cpp @@ -30,7 +30,7 @@ int main(int argc, char *argv[]) SetupSharedFile::install(false); SetupSharedNetworkMessages::install(); - SetupSharedRandom::install(static_cast(time(NULL))); + SetupSharedRandom::install(static_cast(time(nullptr))); Os::setProgramName("CustomerServiceServer"); ConfigCustomerServiceServer::install(); NetworkHandler::install(); diff --git a/engine/server/application/CustomerServiceServer/src/shared/CentralServerConnection.cpp b/engine/server/application/CustomerServiceServer/src/shared/CentralServerConnection.cpp index 68a2ded3..8e74a876 100755 --- a/engine/server/application/CustomerServiceServer/src/shared/CentralServerConnection.cpp +++ b/engine/server/application/CustomerServiceServer/src/shared/CentralServerConnection.cpp @@ -49,7 +49,7 @@ void CentralServerConnection::onConnectionOpened() Service *chatServerService = CustomerServiceServer::getInstance().getChatServerService(); - if (chatServerService != NULL) + if (chatServerService != nullptr) { const std::string address(chatServerService->getBindAddress()); const int port = chatServerService->getBindPort(); @@ -62,7 +62,7 @@ void CentralServerConnection::onConnectionOpened() } else { - LOG("CentralServerConnection", ("onConnectionOpened() ERROR: ChatServerService is NULL")); + LOG("CentralServerConnection", ("onConnectionOpened() ERROR: ChatServerService is nullptr")); } } @@ -71,7 +71,7 @@ void CentralServerConnection::onConnectionOpened() Service *gameServerService = CustomerServiceServer::getInstance().getGameServerService(); - if (gameServerService != NULL) + if (gameServerService != nullptr) { const std::string address(gameServerService->getBindAddress()); const int port = gameServerService->getBindPort(); @@ -84,7 +84,7 @@ void CentralServerConnection::onConnectionOpened() } else { - LOG("CentralServerConnection", ("onConnectionOpened() ERROR: GameServerService is NULL")); + LOG("CentralServerConnection", ("onConnectionOpened() ERROR: GameServerService is nullptr")); } } } diff --git a/engine/server/application/CustomerServiceServer/src/shared/ChatServerConnection.cpp b/engine/server/application/CustomerServiceServer/src/shared/ChatServerConnection.cpp index 239a4630..30a167b1 100755 --- a/engine/server/application/CustomerServiceServer/src/shared/ChatServerConnection.cpp +++ b/engine/server/application/CustomerServiceServer/src/shared/ChatServerConnection.cpp @@ -64,13 +64,13 @@ void ChatServerConnection::sendTo(GameNetworkMessage const &message) { LOG("ChatServerConnection", ("sendTo() message(%s)", message.getCmdName().c_str())); - if (s_connection != NULL) + if (s_connection != nullptr) { s_connection->send(message, true); } else { - LOG("ChatServerConnection", ("sendTo() Unable to send, NULL ChatServerConnection")); + LOG("ChatServerConnection", ("sendTo() Unable to send, nullptr ChatServerConnection")); } } diff --git a/engine/server/application/CustomerServiceServer/src/shared/ConfigCustomerServiceServer.cpp b/engine/server/application/CustomerServiceServer/src/shared/ConfigCustomerServiceServer.cpp index eff05cf2..d0e93110 100755 --- a/engine/server/application/CustomerServiceServer/src/shared/ConfigCustomerServiceServer.cpp +++ b/engine/server/application/CustomerServiceServer/src/shared/ConfigCustomerServiceServer.cpp @@ -12,19 +12,19 @@ namespace ConfigCustomerServiceServerNamespace { - const char * s_clusterName = NULL; - const char * s_centralServerAddress = NULL; + const char * s_clusterName = nullptr; + const char * s_centralServerAddress = nullptr; int s_centralServerPort = 0; - const char * s_gameCode = NULL; - const char * s_csServerAddress = NULL; + const char * s_gameCode = nullptr; + const char * s_csServerAddress = nullptr; int s_csServerPort = 0; int s_maxPacketsPerSecond = 50; int s_requestTimeoutSeconds = 300; int s_maxAllowedNumberOfTickets = 1; int s_gameServicePort = 0; int s_chatServicePort = 0; - const char* s_chatServiceBindInterface = NULL; - const char* s_gameServiceBindInterface = NULL; + const char* s_chatServiceBindInterface = nullptr; + const char* s_gameServiceBindInterface = nullptr; bool s_writeTicketToBugLog = false; }; diff --git a/engine/server/application/CustomerServiceServer/src/shared/CustomerServiceInterface.cpp b/engine/server/application/CustomerServiceServer/src/shared/CustomerServiceInterface.cpp index e1e93c31..333117be 100755 --- a/engine/server/application/CustomerServiceServer/src/shared/CustomerServiceInterface.cpp +++ b/engine/server/application/CustomerServiceServer/src/shared/CustomerServiceInterface.cpp @@ -38,7 +38,7 @@ using namespace CSAssist; /////////////////////////////////////////////////////////////////////////////// CustomerServiceInterface::ClientInfo::ClientInfo() - : m_connection(NULL) + : m_connection(nullptr) , m_stationUserId(0) , m_ticketCount(-1) , m_pendingTicketCount(0) @@ -71,10 +71,10 @@ CustomerServiceInterface::~CustomerServiceInterface() delete m_japaneseCategoryList; delete m_clientConnectionMap; - m_clientConnectionMap = NULL; + m_clientConnectionMap = nullptr; delete m_suidToNetworkIdMap; - m_suidToNetworkIdMap = NULL; + m_suidToNetworkIdMap = nullptr; } //----------------------------------------------------------------------- @@ -97,8 +97,8 @@ void CustomerServiceInterface::OnConnectCSAssist( } m_connectionToBackEndEstablised = true; - m_englishCategoryTrack = requestGetIssueHierarchy(NULL, Unicode::narrowToWide("Default").data(), Unicode::narrowToWide("en").data());; - m_japaneseCategoryTrack = requestGetIssueHierarchy(NULL, Unicode::narrowToWide("Default").data(), Unicode::narrowToWide("ja").data());; + m_englishCategoryTrack = requestGetIssueHierarchy(nullptr, Unicode::narrowToWide("Default").data(), Unicode::narrowToWide("en").data());; + m_japaneseCategoryTrack = requestGetIssueHierarchy(nullptr, Unicode::narrowToWide("Default").data(), Unicode::narrowToWide("ja").data());; } } @@ -117,7 +117,7 @@ void CustomerServiceInterface::OnConnectRejectedCSAssist(const CSAssistGameAPITr void CustomerServiceInterface::parseIssueChild(CategoryList & categoryList, xmlNodePtr childPtr) { - static CustomerServiceCategory *currentCategory = NULL; + static CustomerServiceCategory *currentCategory = nullptr; xmlNodePtr child = childPtr->children; //start element @@ -142,19 +142,19 @@ void CustomerServiceInterface::parseIssueChild(CategoryList & categoryList, xmlN val = reinterpret_cast(xmlGetProp(childPtr, (const unsigned char *)"isBugType")); - bool const isBugType = (val != NULL) && (strcmp(val, "true") == 0); + bool const isBugType = (val != nullptr) && (strcmp(val, "true") == 0); // Check for service type val = reinterpret_cast(xmlGetProp(childPtr, (const unsigned char *)"isServiceType")); - bool const isServiceType = (val != NULL) && (strcmp(val, "true") == 0); + bool const isServiceType = (val != nullptr) && (strcmp(val, "true") == 0); // Check if valid val = reinterpret_cast(xmlGetProp(childPtr, (const unsigned char *)"invalid")); - bool const invalid = (val != NULL) && (strcmp(val, "true") == 0); + bool const invalid = (val != nullptr) && (strcmp(val, "true") == 0); if (!invalid) { @@ -187,9 +187,9 @@ void CustomerServiceInterface::parseIssueChild(CategoryList & categoryList, xmlN } } - while (child != NULL) + while (child != nullptr) { - if (child->name != NULL) + if (child->name != nullptr) { parseIssueChild(categoryList, child); } @@ -204,7 +204,7 @@ void CustomerServiceInterface::parseIssueChild(CategoryList & categoryList, xmlN if (currentCategory) { delete currentCategory; - currentCategory = NULL; + currentCategory = nullptr; } } @@ -215,13 +215,13 @@ void CustomerServiceInterface::parseIssueChild(CategoryList & categoryList, xmlN void CustomerServiceInterface::parseIssueHierarchy(CategoryList & categoryList, Unicode::String const & xmlData) { - xmlDocPtr xmlInfo = NULL; + xmlDocPtr xmlInfo = nullptr; Unicode::UTF8String xmlDataUtf8(Unicode::wideToUTF8(xmlData)); - if ((xmlInfo = xmlParseMemory(xmlDataUtf8.c_str(), xmlDataUtf8.length())) != NULL) + if ((xmlInfo = xmlParseMemory(xmlDataUtf8.c_str(), xmlDataUtf8.length())) != nullptr) { xmlNodePtr xmlCurrent = xmlDocGetRootElement(xmlInfo); - if (xmlCurrent != NULL) + if (xmlCurrent != nullptr) { parseIssueChild(categoryList, xmlCurrent); } @@ -247,7 +247,7 @@ void CustomerServiceInterface::OnGetIssueHierarchy( return; } - if (hierarchyBody != NULL) + if (hierarchyBody != nullptr) { if (track == m_englishCategoryTrack) { @@ -266,7 +266,7 @@ void CustomerServiceInterface::OnGetIssueHierarchy( } else { - LOG("CSServer", ("ERROR: NULL hierarchy returned from platform...why did this happen?", track, modifyData, result, getErrorString(result))); + LOG("CSServer", ("ERROR: nullptr hierarchy returned from platform...why did this happen?", track, modifyData, result, getErrorString(result))); } } @@ -282,9 +282,9 @@ void CustomerServiceInterface::OnCreateTicket( CreateTicketResponseMessage message(result, ticket); const NetworkId *tmpNetworkId = reinterpret_cast(userData); - LOG("CSServer", ("OnCreateTicket() track(%i) result(%i) (%s) networkId(%s) ticketId(%i)", track, result, getErrorString(result), (tmpNetworkId != NULL) ? tmpNetworkId->getValueString().c_str() : "NA", ticket)); + LOG("CSServer", ("OnCreateTicket() track(%i) result(%i) (%s) networkId(%s) ticketId(%i)", track, result, getErrorString(result), (tmpNetworkId != nullptr) ? tmpNetworkId->getValueString().c_str() : "NA", ticket)); - if (tmpNetworkId != NULL) + if (tmpNetworkId != nullptr) { if (result == CSASSIST_RESULT_SUCCESS) { @@ -296,7 +296,7 @@ void CustomerServiceInterface::OnCreateTicket( sendToClient(*tmpNetworkId, message); delete tmpNetworkId; - tmpNetworkId = NULL; + tmpNetworkId = nullptr; } } @@ -312,14 +312,14 @@ void CustomerServiceInterface::OnAppendTicketComment( AppendCommentResponseMessage message(result, ticket); const NetworkId *tmpNetworkId = reinterpret_cast(userData); - LOG("CSServer", ("OnAppendTicketComment() track(%i) result(%i) (%s) networkId(%s) ticketId(%i)", track, result, getErrorString(result), (tmpNetworkId != NULL) ? tmpNetworkId->getValueString().c_str() : "NA", ticket)); + LOG("CSServer", ("OnAppendTicketComment() track(%i) result(%i) (%s) networkId(%s) ticketId(%i)", track, result, getErrorString(result), (tmpNetworkId != nullptr) ? tmpNetworkId->getValueString().c_str() : "NA", ticket)); - if (tmpNetworkId != NULL) + if (tmpNetworkId != nullptr) { sendToClient(*tmpNetworkId, message); delete tmpNetworkId; - tmpNetworkId = NULL; + tmpNetworkId = nullptr; } } @@ -335,9 +335,9 @@ void CustomerServiceInterface::OnCancelTicket( CancelTicketResponseMessage message(result, ticket); const NetworkId *tmpNetworkId = reinterpret_cast(userData); - LOG("CSServer", ("OnCancelTicket() track(%i) result(%i) (%s) networkId(%s) ticketId(%i)", track, result, getErrorString(result), (tmpNetworkId != NULL) ? tmpNetworkId->getValueString().c_str() : "NA", ticket)); + LOG("CSServer", ("OnCancelTicket() track(%i) result(%i) (%s) networkId(%s) ticketId(%i)", track, result, getErrorString(result), (tmpNetworkId != nullptr) ? tmpNetworkId->getValueString().c_str() : "NA", ticket)); - if (tmpNetworkId != NULL) + if (tmpNetworkId != nullptr) { if (result == CSASSIST_RESULT_SUCCESS) { @@ -347,7 +347,7 @@ void CustomerServiceInterface::OnCancelTicket( sendToClient(*tmpNetworkId, message); delete tmpNetworkId; - tmpNetworkId = NULL; + tmpNetworkId = nullptr; } } @@ -378,9 +378,9 @@ void CustomerServiceInterface::OnGetTicketByCharacter( GetTicketsResponseMessage message(result, totalNumber, tickets); const NetworkId *tmpNetworkId = reinterpret_cast(userData); - LOG("CSServer", ("OnGetTicketByCharacter() track(%i) result(%i) (%s) networkId(%s) totalNumber(%i) numberReturned(%i)", track, result, getErrorString(result), (tmpNetworkId != NULL) ? tmpNetworkId->getValueString().c_str() : "NA", totalNumber, numberReturned)); + LOG("CSServer", ("OnGetTicketByCharacter() track(%i) result(%i) (%s) networkId(%s) totalNumber(%i) numberReturned(%i)", track, result, getErrorString(result), (tmpNetworkId != nullptr) ? tmpNetworkId->getValueString().c_str() : "NA", totalNumber, numberReturned)); - if (tmpNetworkId != NULL) + if (tmpNetworkId != nullptr) { // Save the number of tickets this player has @@ -396,7 +396,7 @@ void CustomerServiceInterface::OnGetTicketByCharacter( sendToClient(*tmpNetworkId, message); delete tmpNetworkId; - tmpNetworkId = NULL; + tmpNetworkId = nullptr; } } @@ -423,14 +423,14 @@ void CustomerServiceInterface::OnGetTicketComments( const NetworkId *tmpNetworkId = reinterpret_cast(userData); - LOG("CSServer", ("OnGetTicketComments() track(%i) result(%i) (%s) networkId(%s) numberRead(%i)", track, result, getErrorString(result), (tmpNetworkId != NULL) ? tmpNetworkId->getValueString().c_str() : "NA", numberRead)); + LOG("CSServer", ("OnGetTicketComments() track(%i) result(%i) (%s) networkId(%s) numberRead(%i)", track, result, getErrorString(result), (tmpNetworkId != nullptr) ? tmpNetworkId->getValueString().c_str() : "NA", numberRead)); - if (tmpNetworkId != NULL) + if (tmpNetworkId != nullptr) { sendToClient(*tmpNetworkId, message); delete tmpNetworkId; - tmpNetworkId = NULL; + tmpNetworkId = nullptr; } } @@ -455,14 +455,14 @@ void CustomerServiceInterface::OnSearchKB( SearchKnowledgeBaseResponseMessage message(result, searchResultsVector); const NetworkId *tmpNetworkId = reinterpret_cast(userData); - LOG("CSServer", ("OnSearchKB() track(%i) result(%i) (%s) networkId(%s) numberRead(%i)", track, result, getErrorString(result), (tmpNetworkId != NULL) ? tmpNetworkId->getValueString().c_str() : "NA", numberRead)); + LOG("CSServer", ("OnSearchKB() track(%i) result(%i) (%s) networkId(%s) numberRead(%i)", track, result, getErrorString(result), (tmpNetworkId != nullptr) ? tmpNetworkId->getValueString().c_str() : "NA", numberRead)); - if (tmpNetworkId != NULL) + if (tmpNetworkId != nullptr) { sendToClient(*tmpNetworkId, message); delete tmpNetworkId; - tmpNetworkId = NULL; + tmpNetworkId = nullptr; } } @@ -482,12 +482,12 @@ void CustomerServiceInterface::OnGetKBArticle( { GetArticleResponseMessage message(result, Unicode::String(articleBody)); const NetworkId *tmpNetworkId = reinterpret_cast(userData); - if (tmpNetworkId != NULL) + if (tmpNetworkId != nullptr) { sendToClient(*tmpNetworkId, message); delete tmpNetworkId; - tmpNetworkId = NULL; + tmpNetworkId = nullptr; } } } @@ -501,7 +501,7 @@ void CustomerServiceInterface::OnIssueHierarchyChanged( { LOG("CSServer", ("OnIssueHierarchyChanged()")); - requestGetIssueHierarchy(NULL, version, language); + requestGetIssueHierarchy(nullptr, version, language); } //----------------------------------------------------------------------- @@ -512,9 +512,9 @@ void CustomerServiceInterface::OnNewTicketActivity(const CSAssistGameAPITrack tr const NetworkId *tmpNetworkId = reinterpret_cast(userData); - LOG("CSServer", ("OnNewTicketActivity() track(%i) result(%i) (%s) networkId(%s) activity(%s) ticket count(%i)", track, result, getErrorString(result), (tmpNetworkId != NULL) ? tmpNetworkId->getValueString().c_str() : "NA", NewActivityFlag ? "yes" : "no", HasTickets)); + LOG("CSServer", ("OnNewTicketActivity() track(%i) result(%i) (%s) networkId(%s) activity(%s) ticket count(%i)", track, result, getErrorString(result), (tmpNetworkId != nullptr) ? tmpNetworkId->getValueString().c_str() : "NA", NewActivityFlag ? "yes" : "no", HasTickets)); - if (tmpNetworkId != NULL) + if (tmpNetworkId != nullptr) { // Save the number of tickets this player has @@ -530,7 +530,7 @@ void CustomerServiceInterface::OnNewTicketActivity(const CSAssistGameAPITrack tr sendToClient(*tmpNetworkId, message); delete tmpNetworkId; - tmpNetworkId = NULL; + tmpNetworkId = nullptr; } } @@ -540,12 +540,12 @@ void CustomerServiceInterface::OnMarkTicketRead(const CSAssistGameAPITrack track { const NetworkId *tmpNetworkId = reinterpret_cast(userData); - LOG("CSServer", ("OnMarkTicketRead() track(%i) result(%i) (%s) networkId(%s)", track, result, getErrorString(result), (tmpNetworkId != NULL) ? tmpNetworkId->getValueString().c_str() : "NA")); + LOG("CSServer", ("OnMarkTicketRead() track(%i) result(%i) (%s) networkId(%s)", track, result, getErrorString(result), (tmpNetworkId != nullptr) ? tmpNetworkId->getValueString().c_str() : "NA")); - if (tmpNetworkId != NULL) + if (tmpNetworkId != nullptr) { delete tmpNetworkId; - tmpNetworkId = NULL; + tmpNetworkId = nullptr; } } @@ -575,16 +575,16 @@ void CustomerServiceInterface::OnRegisterCharacter(const CSAssistGameAPITrack tr { const NetworkId *tmpNetworkId = reinterpret_cast(userData); - LOG("CSServer", ("OnRegisterCharacter() track(%i) result(%i) (%s) networkId(%s)", track, result, getErrorString(result), (tmpNetworkId != NULL) ? tmpNetworkId->getValueString().c_str() : "NA")); + LOG("CSServer", ("OnRegisterCharacter() track(%i) result(%i) (%s) networkId(%s)", track, result, getErrorString(result), (tmpNetworkId != nullptr) ? tmpNetworkId->getValueString().c_str() : "NA")); - if (tmpNetworkId != NULL) + if (tmpNetworkId != nullptr) { ConnectPlayerResponseMessage message(result); sendToClient(*tmpNetworkId, message); delete tmpNetworkId; - tmpNetworkId = NULL; + tmpNetworkId = nullptr; } } @@ -594,9 +594,9 @@ void CustomerServiceInterface::OnUnRegisterCharacter(const CSAssistGameAPITrack { const NetworkId *tmpNetworkId = reinterpret_cast(userData); - LOG("CSServer", ("OnUnRegisterCharacter() track(%i) result(%i) (%s) networkId(%s)", track, result, getErrorString(result), (tmpNetworkId != NULL) ? tmpNetworkId->getValueString().c_str() : "NA")); + LOG("CSServer", ("OnUnRegisterCharacter() track(%i) result(%i) (%s) networkId(%s)", track, result, getErrorString(result), (tmpNetworkId != nullptr) ? tmpNetworkId->getValueString().c_str() : "NA")); - if (tmpNetworkId != NULL) + if (tmpNetworkId != nullptr) { // If the player was successfully unregistered, remove the local cached reference @@ -606,7 +606,7 @@ void CustomerServiceInterface::OnUnRegisterCharacter(const CSAssistGameAPITrack } delete tmpNetworkId; - tmpNetworkId = NULL; + tmpNetworkId = nullptr; } } @@ -708,7 +708,7 @@ void CustomerServiceInterface::sendToClient(const NetworkId &player, const GameN } else { - LOG("CSServer", ("sendToClient() Connection is NULL: networkId(%s) cmdName(%s)", player.getValueString().c_str(), message.getCmdName().c_str())); + LOG("CSServer", ("sendToClient() Connection is nullptr: networkId(%s) cmdName(%s)", player.getValueString().c_str(), message.getCmdName().c_str())); } } else @@ -779,7 +779,7 @@ void CustomerServiceInterface::requestUnRegisterCharacter(const NetworkId &reque LOG("CSServer", ("requestUnRegisterCharacter() networkId(%s) suid(%i)", requester.getValueString().c_str(), suid)); NetworkId *tmpNetworkId = new NetworkId(requester); - CSAssistGameAPI::requestUnRegisterCharacter(reinterpret_cast(tmpNetworkId), suid, NULL); + CSAssistGameAPI::requestUnRegisterCharacter(reinterpret_cast(tmpNetworkId), suid, nullptr); } else { diff --git a/engine/server/application/CustomerServiceServer/src/shared/CustomerServiceServer.cpp b/engine/server/application/CustomerServiceServer/src/shared/CustomerServiceServer.cpp index 7beaacc5..fb4e7abe 100755 --- a/engine/server/application/CustomerServiceServer/src/shared/CustomerServiceServer.cpp +++ b/engine/server/application/CustomerServiceServer/src/shared/CustomerServiceServer.cpp @@ -49,7 +49,7 @@ namespace CustomerServiceServerNamespace using namespace CustomerServiceServerNamespace; -CustomerServiceServer *CustomerServiceServer::m_instance = NULL; +CustomerServiceServer *CustomerServiceServer::m_instance = nullptr; /////////////////////////////////////////////////////////////////////////////// // @@ -83,12 +83,12 @@ CustomerServiceServer::PendingTicket::PendingTicket() CustomerServiceServer::CustomerServiceServer() : m_callback(new MessageDispatch::Callback), -m_centralServerConnection(NULL), +m_centralServerConnection(nullptr), m_connectionServerSet(new ConnectionServerSet), m_done(false), m_csInterface(ConfigCustomerServiceServer::getCustomerServiceServerAddress(), ConfigCustomerServiceServer::getCustomerServiceServerPort(), ConfigCustomerServiceServer::getRequestTimeoutSeconds()), -m_gameServerService(NULL), -m_chatServerService(NULL), +m_gameServerService(nullptr), +m_chatServerService(nullptr), m_nextSequenceId(0), m_pendingTicketList(new PendingTicketList) { @@ -113,7 +113,7 @@ m_pendingTicketList(new PendingTicketList) m_csInterface.setMaxPacketsPerSecond(ConfigCustomerServiceServer::getMaxPacketsPerSecond()); - m_csInterface.connectCSAssist(NULL, + m_csInterface.connectCSAssist(nullptr, Unicode::narrowToWide(ConfigCustomerServiceServer::getGameCode()).data(), Unicode::narrowToWide(ConfigCustomerServiceServer::getClusterName()).data()); @@ -148,19 +148,19 @@ CustomerServiceServer::~CustomerServiceServer() m_centralServerConnection->disconnect(); delete m_callback; - m_callback = NULL; + m_callback = nullptr; delete m_connectionServerSet; - m_connectionServerSet = NULL; + m_connectionServerSet = nullptr; delete m_gameServerService; - m_gameServerService = NULL; + m_gameServerService = nullptr; delete m_chatServerService; - m_chatServerService = NULL; + m_chatServerService = nullptr; delete m_pendingTicketList; - m_pendingTicketList = NULL; + m_pendingTicketList = nullptr; MetricsManager::remove(); delete s_customerServiceServerMetricsData; @@ -233,7 +233,7 @@ void CustomerServiceServer::update() CustomerServiceServer &CustomerServiceServer::getInstance() { - if (m_instance == NULL) + if (m_instance == nullptr) { m_instance = new CustomerServiceServer; } @@ -405,7 +405,7 @@ void CustomerServiceServer::getTickets( NetworkId *tmpNetworkId = new NetworkId(requester); m_csInterface.requestGetTicketByCharacter( - reinterpret_cast(tmpNetworkId), suid, NULL, + reinterpret_cast(tmpNetworkId), suid, nullptr, start, count, markAsRead); } @@ -475,7 +475,7 @@ void CustomerServiceServer::requestNewTicketActivity(const NetworkId &requester, NetworkId *tmpNetworkId = new NetworkId(requester); - m_csInterface.requestNewTicketActivity(reinterpret_cast(tmpNetworkId), suid, NULL); + m_csInterface.requestNewTicketActivity(reinterpret_cast(tmpNetworkId), suid, nullptr); } //----------------------------------------------------------------------- @@ -497,7 +497,7 @@ void CustomerServiceServer::requestRegisterCharacter(const NetworkId &requester, LOG("CSServer", ("CustomerServiceInterface::requestRegisterCharacter() - networkId(%s) suid(%i)", requester.getValueString().c_str(), suid)); NetworkId *tmpNetworkId = new NetworkId(requester); - m_csInterface.requestRegisterCharacter(reinterpret_cast(tmpNetworkId), suid, NULL, 0); + m_csInterface.requestRegisterCharacter(reinterpret_cast(tmpNetworkId), suid, nullptr, 0); } } diff --git a/engine/server/application/LogServer/src/shared/LoggingServerApi.cpp b/engine/server/application/LogServer/src/shared/LoggingServerApi.cpp index 89591848..a6b9920f 100755 --- a/engine/server/application/LogServer/src/shared/LoggingServerApi.cpp +++ b/engine/server/application/LogServer/src/shared/LoggingServerApi.cpp @@ -23,16 +23,16 @@ LoggingServerApi::LoggingServerApi(LoggingServerHandler *handler, int queueSize) mLoginName[0] = 0; mPassword[0] = 0; mDefaultDirectory[0] = 0; - mConnection = NULL; - mUdpManager = NULL; - mTransaction = NULL; - mSessionId = int(time(NULL)); + mConnection = nullptr; + mUdpManager = nullptr; + mTransaction = nullptr; + mSessionId = int(time(nullptr)); mSessionSequence = 1; } LoggingServerApi::~LoggingServerApi() { - if (mTransaction != NULL) + if (mTransaction != nullptr) StopTransaction(); for (int i = 0; i < mQueueCount; i++) @@ -77,7 +77,7 @@ void LoggingServerApi::Connect(const char *address, int port, const char *loginN mUdpManager = new UdpManager(¶ms); mConnection = mUdpManager->EstablishConnection(address, port, 30000); - if (mConnection != NULL) + if (mConnection != nullptr) mConnection->SetHandler(this); mLoginSent = false; } @@ -89,17 +89,17 @@ void LoggingServerApi::Disconnect() mPassword[0] = 0; mDefaultDirectory[0] = 0; - if (mConnection != NULL) + if (mConnection != nullptr) { mConnection->Disconnect(); mConnection->Release(); - mConnection = NULL; + mConnection = nullptr; } - if (mUdpManager != NULL) + if (mUdpManager != nullptr) { mUdpManager->Release(); - mUdpManager = NULL; + mUdpManager = nullptr; } } @@ -119,7 +119,7 @@ void LoggingServerApi::Flush(int timeout) LoggingServerApi::Status LoggingServerApi::GetStatus() const { - if (mConnection != NULL) + if (mConnection != nullptr) { switch (mConnection->GetStatus()) { @@ -153,7 +153,7 @@ void LoggingServerApi::OnRoutePacket(UdpConnection *, const uchar *data, int) FlushQueue(); } - if (mHandler != NULL) + if (mHandler != nullptr) mHandler->LshOnLoginConfirm(mAuthenticated); break; } @@ -171,13 +171,13 @@ void LoggingServerApi::OnRoutePacket(UdpConnection *, const uchar *data, int) char *filename = ptr; ptr += strlen(ptr) + 1; char *message = ptr; - if (mHandler != NULL) + if (mHandler != nullptr) mHandler->LshOnMonitor(sessionId, sequenceNumber, name, filename, typeCode, message); break; } case cS2CPacketFileList: { - if (mHandler != NULL) + if (mHandler != nullptr) mHandler->LshOnFileList((char *)(data + 1)); break; } @@ -188,7 +188,7 @@ void LoggingServerApi::OnRoutePacket(UdpConnection *, const uchar *data, int) void LoggingServerApi::OnTerminated(UdpConnection *con) { - if(mHandler != NULL) + if(mHandler != nullptr) { mHandler->LshOnTerminated( con->GetDisconnectReason() ); } @@ -196,7 +196,7 @@ void LoggingServerApi::OnTerminated(UdpConnection *con) void LoggingServerApi::GiveTime() { - if (mConnection != NULL && mConnection->GetStatus() == UdpConnection::cStatusConnected) + if (mConnection != nullptr && mConnection->GetStatus() == UdpConnection::cStatusConnected) { if (!mLoginSent) { @@ -225,7 +225,7 @@ void LoggingServerApi::GiveTime() if (mQueue[spot].sentTime != 0 && UdpMisc::ClockElapsed(mQueue[spot].sentTime) > cSafetyQueueTime) { mQueue[spot].packet->Release(); - mQueue[spot].packet = NULL; + mQueue[spot].packet = nullptr; mQueuePosition++; mQueueCount--; } @@ -235,7 +235,7 @@ void LoggingServerApi::GiveTime() } } - if (mUdpManager != NULL) + if (mUdpManager != nullptr) { mUdpManager->GiveTime(); } @@ -243,17 +243,17 @@ void LoggingServerApi::GiveTime() void LoggingServerApi::StartTransaction() { - if (mTransaction == NULL) + if (mTransaction == nullptr) mTransaction = new GroupLogicalPacket(); } void LoggingServerApi::StopTransaction() { - if (mTransaction != NULL) + if (mTransaction != nullptr) { PacketSend(mTransaction); mTransaction->Release(); - mTransaction = NULL; + mTransaction = nullptr; } } @@ -264,7 +264,7 @@ void LoggingServerApi::PacketSend(LogicalPacket *lp) { int spot = mQueuePosition % mQueueSize; mQueue[spot].packet->Release(); - mQueue[spot].packet = NULL; + mQueue[spot].packet = nullptr; mQueuePosition++; mQueueCount--; } @@ -374,7 +374,7 @@ void LoggingServerApi::Log(const char *filename, int typeCode, const char *messa void LoggingServerApi::LogPacket(char *data, int len) { - if (mTransaction != NULL) + if (mTransaction != nullptr) { // add it to the transaction mTransaction->AddPacket(data, len); @@ -389,7 +389,7 @@ void LoggingServerApi::LogPacket(char *data, int len) LogicalPacket *LoggingServerApi::CreatePacket(char *data, int dataLen) { - if (mUdpManager != NULL) + if (mUdpManager != nullptr) { return(mUdpManager->CreatePacket(data, dataLen)); } @@ -440,7 +440,7 @@ void LoggingServerApi::GetStatistics(LoggingServerApiStatistics *stats) memset( stats, 0, sizeof( *stats) ); UdpConnectionStatistics udpConnectionStats; memset( &udpConnectionStats, 0, sizeof( udpConnectionStats ) ); - if( mConnection != NULL ) + if( mConnection != nullptr ) { mConnection->GetStats( &udpConnectionStats ); stats->applicationPacketsReceived = udpConnectionStats.applicationPacketsReceived; @@ -454,7 +454,7 @@ void LoggingServerApi::GetStatistics(LoggingServerApiStatistics *stats) } UdpManagerStatistics managerStats; - if( mUdpManager != NULL ) + if( mUdpManager != nullptr ) { mUdpManager->GetStats( &managerStats ); udp_int64 iterations = managerStats.iterations; diff --git a/engine/server/application/LoginServer/src/linux/main.cpp b/engine/server/application/LoginServer/src/linux/main.cpp index 7b4d7c1b..e08cb606 100755 --- a/engine/server/application/LoginServer/src/linux/main.cpp +++ b/engine/server/application/LoginServer/src/linux/main.cpp @@ -35,7 +35,7 @@ int main(int argc, char ** argv) SetupSharedFile::install(false); SetupSharedNetworkMessages::install(); - SetupSharedRandom::install(static_cast(time(NULL))); //lint !e1924 !e64 // NULL is a C-Style cast? + SetupSharedRandom::install(static_cast(time(nullptr))); //lint !e1924 !e64 // nullptr is a C-Style cast? Os::setProgramName("LoginServer"); //setup the server diff --git a/engine/server/application/LoginServer/src/shared/CSToolConnection.cpp b/engine/server/application/LoginServer/src/shared/CSToolConnection.cpp index 3da0b98b..7e10c623 100755 --- a/engine/server/application/LoginServer/src/shared/CSToolConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/CSToolConnection.cpp @@ -51,7 +51,7 @@ void CSToolConnection::validateCSTool(uint32 toolId, apiResult result, const api p_connection->m_bSecure = true; } - // if we have a null session type, then we aren't connected to the + // if we have a nullptr session type, then we aren't connected to the // Session Server and are in debug mode. // // if we *do* have a good session, then check the admin table for access level. @@ -71,7 +71,7 @@ void CSToolConnection::validateCSTool(uint32 toolId, apiResult result, const api bool canLogin = isInternal; // we always have to be internal. if (sessionNull) { - // null session means we can skip everything else. + // nullptr session means we can skip everything else. canLogin = canLogin && true; accessLevel = 100; } diff --git a/engine/server/application/LoginServer/src/shared/CentralServerConnection.cpp b/engine/server/application/LoginServer/src/shared/CentralServerConnection.cpp index 6b803038..2f096fce 100755 --- a/engine/server/application/LoginServer/src/shared/CentralServerConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/CentralServerConnection.cpp @@ -282,13 +282,13 @@ void CentralServerConnection::onReceive(const Archive::ByteStream & message) else if(m.isType("GcwScoreStatRaw")) { GenericValueTypeMessage >, std::map > > > > const msg(ri); - LoginServer::getInstance().sendToAllClusters(msg, NULL, 0, msg.getValue().first.c_str()); + LoginServer::getInstance().sendToAllClusters(msg, nullptr, 0, msg.getValue().first.c_str()); } else if(m.isType("GcwScoreStatPct")) { GenericValueTypeMessage, std::map > > > const msg(ri); - LoginServer::getInstance().sendToAllClusters(msg, NULL, 0, msg.getValue().first.c_str()); + LoginServer::getInstance().sendToAllClusters(msg, nullptr, 0, msg.getValue().first.c_str()); } } diff --git a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp index 087796db..6fe81a51 100755 --- a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp @@ -100,7 +100,7 @@ void ClientConnection::onReceive(const Archive::ByteStream & message) // client has an idea of how much difference there is between // the client's Epoch time and the server Epoch time GenericValueTypeMessage const serverNowEpochTime( - "ServerNowEpochTime", static_cast(::time(NULL))); + "ServerNowEpochTime", static_cast(::time(nullptr))); send(serverNowEpochTime, true); LoginClientId id(ri); @@ -202,7 +202,7 @@ void ClientConnection::validateClient(const std::string & id, const std::string LOG("LoginClientConnection", ("validateClient() for stationId (%lu) at IP (%s), id (%s) key (%s), skipping validating session", m_stationId, getRemoteAddress().c_str(), id.c_str(), key.c_str())); - LoginServer::getInstance().onValidateClient(suid, id, this, true, NULL, 0xFFFFFFFF, 0xFFFFFFFF); + LoginServer::getInstance().onValidateClient(suid, id, this, true, nullptr, 0xFFFFFFFF, 0xFFFFFFFF); } } diff --git a/engine/server/application/LoginServer/src/shared/ConsoleManager.cpp b/engine/server/application/LoginServer/src/shared/ConsoleManager.cpp index ecaaa8fa..8721d5c6 100755 --- a/engine/server/application/LoginServer/src/shared/ConsoleManager.cpp +++ b/engine/server/application/LoginServer/src/shared/ConsoleManager.cpp @@ -14,7 +14,7 @@ namespace ConsoleManagerNamespace { - ConsoleCommandParser * s_consoleCommandParserRoot = NULL; + ConsoleCommandParser * s_consoleCommandParserRoot = nullptr; } using namespace ConsoleManagerNamespace; diff --git a/engine/server/application/LoginServer/src/shared/LoginServer.cpp b/engine/server/application/LoginServer/src/shared/LoginServer.cpp index a38d3725..759331b4 100755 --- a/engine/server/application/LoginServer/src/shared/LoginServer.cpp +++ b/engine/server/application/LoginServer/src/shared/LoginServer.cpp @@ -130,7 +130,7 @@ LoginServer::LoginServer() : Singleton(), MessageDispatch::Receiver(), done(false), -m_centralService(NULL), +m_centralService(nullptr), clientService(0), pingService(0), keyServer(0), @@ -391,7 +391,7 @@ void LoginServer::receiveMessage(const MessageDispatch::Emitter & source, const { CentralServerConnection * connection = const_cast(safe_cast(&source)); DEBUG_REPORT_LOG(true, ("Cluster connection %s opened\n", msg.getClusterName().c_str())); - ClusterListEntry *cle=NULL; + ClusterListEntry *cle=nullptr; if (ConfigLoginServer::getDevelopmentMode()) { // in this mode, we trust the name sent by the cluster and we dynamically add clusters we don't know about @@ -410,7 +410,7 @@ void LoginServer::receiveMessage(const MessageDispatch::Emitter & source, const { WARNING(true,("Server %i is named \"%s\" in the database. The server at the specified address (%s:%hu) reports its name as \"%s\". It will not be allowed in the service. Either the name in the database or the name in Central's config file should be corrected.\n",cle->m_clusterId, cle->m_clusterName.c_str(), connection->getRemoteAddress().c_str(), connection->getRemotePort(), msg.getClusterName().c_str())); disconnectCluster(*cle,true,false); - cle=NULL; + cle=nullptr; } } @@ -589,7 +589,7 @@ void LoginServer::receiveMessage(const MessageDispatch::Emitter & source, const // for testing purpose when not using session authentication, store // the account feature Ids locally in memory, which will get cleared // (obviously) when the LoginServer is restarted - std::map > * nonSessionTestingAccountFeatureIds = NULL; + std::map > * nonSessionTestingAccountFeatureIds = nullptr; if (msg.getGameCode() == PlatformGameCode::SWG) nonSessionTestingAccountFeatureIds = &s_nonSessionTestingAccountSwgFeatureIds; else if (msg.getGameCode() == PlatformGameCode::SWGTCG) @@ -648,7 +648,7 @@ void LoginServer::receiveMessage(const MessageDispatch::Emitter & source, const // for testing purpose when not using session authentication, store // the account feature Ids locally in memory, which will get cleared // (obviously) when the LoginServer is restarted - std::map > * nonSessionTestingAccountFeatureIds = NULL; + std::map > * nonSessionTestingAccountFeatureIds = nullptr; if (msg.getGameCode() == PlatformGameCode::SWG) nonSessionTestingAccountFeatureIds = &s_nonSessionTestingAccountSwgFeatureIds; else if (msg.getGameCode() == PlatformGameCode::SWGTCG) @@ -826,7 +826,7 @@ void LoginServer::receiveMessage(const MessageDispatch::Emitter & source, const const CentralServerConnection *conn = dynamic_cast(&source); if (conn) - DatabaseConnection::getInstance().renameCharacter(conn->getClusterId(), msg.getCharacterId(), msg.getNewName(), NULL); + DatabaseConnection::getInstance().renameCharacter(conn->getClusterId(), msg.getCharacterId(), msg.getNewName(), nullptr); else WARNING_STRICT_FATAL(true,("Got RenameCharacterMessage from something other than CentralServerConnection.\n")); } @@ -1461,11 +1461,11 @@ LoginServer::ClusterListEntry *LoginServer::findClusterByName(const std::string ClusterListType::iterator i; for (i=m_clusterList.begin(); i!=m_clusterList.end(); ++i) { - NOT_NULL(*i); // not legal to push null pointers on the vector + NOT_NULL(*i); // not legal to push nullptr pointers on the vector if ((*i)->m_clusterName == clusterName) return *i; } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -1555,7 +1555,7 @@ void LoginServer::sendClusterStatus(ClientConnection &conn) const // 5) Cluster has told us its ready for players if (cle && cle->m_clusterId!=0 && cle->m_connected && !cle->m_connectionServers.empty() && (clientIsPrivate || !cle->m_secret)) { - DEBUG_FATAL(!cle->m_centralServerConnection,("Programmer bug: m_connected was true but m_centralServerConnection was NULL\n")); + DEBUG_FATAL(!cle->m_centralServerConnection,("Programmer bug: m_connected was true but m_centralServerConnection was nullptr\n")); LoginClusterStatus::ClusterData item; item.m_clusterId = cle->m_clusterId; item.m_timeZone = cle->m_timeZone; @@ -1840,12 +1840,12 @@ LoginServer::ClusterListEntry * LoginServer::findClusterById(uint32 clusterId) ClusterListType::const_iterator i; for (i=m_clusterList.begin(); i!=m_clusterList.end(); ++i) { - NOT_NULL(*i); // not legal to push null pointers on the vector + NOT_NULL(*i); // not legal to push nullptr pointers on the vector if ((*i)->m_clusterId == clusterId) return *i; } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -1859,12 +1859,12 @@ LoginServer::ClusterListEntry * LoginServer::findClusterByConnection(const Centr ClusterListType::const_iterator i; for (i=m_clusterList.begin(); i!=m_clusterList.end(); ++i) { - NOT_NULL(*i); // not legal to push null pointers on the vector + NOT_NULL(*i); // not legal to push nullptr pointers on the vector if ((*i)->m_centralServerConnection == connection) return *i; } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -1908,12 +1908,12 @@ void LoginServer::setDone(const bool isDone) // ---------------------------------------------------------------------- -void LoginServer::sendToAllClusters(GameNetworkMessage const & message, Connection const * excludeCentralConnection /*= NULL*/, uint32 excludeClusterId /*= 0*/, char const * excludeClusterName /*= NULL*/) +void LoginServer::sendToAllClusters(GameNetworkMessage const & message, Connection const * excludeCentralConnection /*= nullptr*/, uint32 excludeClusterId /*= 0*/, char const * excludeClusterName /*= nullptr*/) { ClusterListType::const_iterator i; for (i=m_clusterList.begin(); i!=m_clusterList.end(); ++i) { - if (NON_NULL(*i)->m_connected && (*i)->m_centralServerConnection && ((*i)->m_centralServerConnection != excludeCentralConnection) && ((*i)->m_clusterId != excludeClusterId) && ((excludeClusterName == NULL) || _stricmp(excludeClusterName, (*i)->m_centralServerConnection->getClusterName().c_str()))) + if (NON_NULL(*i)->m_connected && (*i)->m_centralServerConnection && ((*i)->m_centralServerConnection != excludeCentralConnection) && ((*i)->m_clusterId != excludeClusterId) && ((excludeClusterName == nullptr) || _stricmp(excludeClusterName, (*i)->m_centralServerConnection->getClusterName().c_str()))) (*i)->m_centralServerConnection->send(message,true); } } diff --git a/engine/server/application/LoginServer/src/shared/LoginServer.h b/engine/server/application/LoginServer/src/shared/LoginServer.h index a284068e..f1d4de5b 100755 --- a/engine/server/application/LoginServer/src/shared/LoginServer.h +++ b/engine/server/application/LoginServer/src/shared/LoginServer.h @@ -64,7 +64,7 @@ public: void validateAccount (const StationId& stationId, uint32 clusterId, uint32 subscriptionBits, bool canCreateRegular, bool canCreateJedi, bool canSkipTutorial, unsigned int track, std::vector > const & consumedRewardEvents, std::vector > const & claimedRewardItems); void validateAccountForTransfer(const TransferRequestMoveValidation & request, uint32 clusterId, uint32 sourceCharacterTemplateId, bool canCreateRegular, bool canCreateJedi); void sendToCluster (uint32 clusterId, const GameNetworkMessage &message); - void sendToAllClusters (GameNetworkMessage const & message, Connection const * excludeCentralConnection = NULL, uint32 excludeClusterId = 0, char const * excludeClusterName = NULL); + void sendToAllClusters (GameNetworkMessage const & message, Connection const * excludeCentralConnection = nullptr, uint32 excludeClusterId = 0, char const * excludeClusterName = nullptr); bool areAllClustersUp () const; void getClusterIds (stdvector::fwd result); void performAccountTransfer (const AvatarList &avatars, TransferAccountData * transferAccountData); diff --git a/engine/server/application/LoginServer/src/shared/SessionApiClient.cpp b/engine/server/application/LoginServer/src/shared/SessionApiClient.cpp index f130d691..73ff91ae 100755 --- a/engine/server/application/LoginServer/src/shared/SessionApiClient.cpp +++ b/engine/server/application/LoginServer/src/shared/SessionApiClient.cpp @@ -435,7 +435,7 @@ void SessionApiClient::NotifySessionKick(const char ** sessionList, void SessionApiClient::checkStatusForPurge(StationId account) { - GetAccountSubscription(account, PlatformGameCode::SWG, NULL); + GetAccountSubscription(account, PlatformGameCode::SWG, nullptr); } //------------------------------------------------------------------------------------------ diff --git a/engine/server/application/LoginServer/src/shared/TaskCreateCharacter.cpp b/engine/server/application/LoginServer/src/shared/TaskCreateCharacter.cpp index 6e8ed6d4..243f3c71 100755 --- a/engine/server/application/LoginServer/src/shared/TaskCreateCharacter.cpp +++ b/engine/server/application/LoginServer/src/shared/TaskCreateCharacter.cpp @@ -58,7 +58,7 @@ void TaskCreateCharacter::onComplete() // let all other galaxies know that a new character has been created for the station account GenericValueTypeMessage const ncc("NewCharacterCreated", m_stationId); - LoginServer::getInstance().sendToAllClusters(ncc, NULL, m_clusterId); + LoginServer::getInstance().sendToAllClusters(ncc, nullptr, m_clusterId); } // ====================================================================== diff --git a/engine/server/application/LoginServer/src/shared/TaskGetCharactersForDelete.cpp b/engine/server/application/LoginServer/src/shared/TaskGetCharactersForDelete.cpp index 5259daf4..3cc49cef 100755 --- a/engine/server/application/LoginServer/src/shared/TaskGetCharactersForDelete.cpp +++ b/engine/server/application/LoginServer/src/shared/TaskGetCharactersForDelete.cpp @@ -14,7 +14,7 @@ // ====================================================================== TaskGetCharactersForDelete::TaskGetCharactersForDelete (StationId stationId, int clusterGroupId) : - TaskGetAvatarList(stationId, clusterGroupId, NULL) + TaskGetAvatarList(stationId, clusterGroupId, nullptr) { } diff --git a/engine/server/application/MetricsServer/src/linux/main.cpp b/engine/server/application/MetricsServer/src/linux/main.cpp index 2287e9de..d4a429d8 100755 --- a/engine/server/application/MetricsServer/src/linux/main.cpp +++ b/engine/server/application/MetricsServer/src/linux/main.cpp @@ -40,7 +40,7 @@ int main(int argc, char ** argv) SetupSharedNetwork::getDefaultServerSetupData(networkSetupData); SetupSharedNetwork::install(networkSetupData); - SetupSharedRandom::install(static_cast(time(NULL))); //lint !e1924 !e64 // NULL is a C-Style cast? + SetupSharedRandom::install(static_cast(time(nullptr))); //lint !e1924 !e64 // nullptr is a C-Style cast? Os::setProgramName("MetricsServer"); //setup the server diff --git a/engine/server/application/MetricsServer/src/shared/MetricsGatheringConnection.cpp b/engine/server/application/MetricsServer/src/shared/MetricsGatheringConnection.cpp index 4cab5ae6..dd398ff2 100755 --- a/engine/server/application/MetricsServer/src/shared/MetricsGatheringConnection.cpp +++ b/engine/server/application/MetricsServer/src/shared/MetricsGatheringConnection.cpp @@ -169,19 +169,19 @@ void MetricsGatheringConnection::update(const std::vector & data) //note: we know that the "isSecret", and "isLocked" nodes will come after the "population" node in the list // we are iterating over, so they will override the population setting - if (strstr((*dataIter).m_label.c_str(), "population") != NULL) + if (strstr((*dataIter).m_label.c_str(), "population") != nullptr) { // there are nodes under the population node, so don't interpret them as the population - if (strstr((*dataIter).m_label.c_str(), "population.") == NULL) + if (strstr((*dataIter).m_label.c_str(), "population.") == nullptr) mon->set(MetricsServer::getWorldCountChannel(), std::max((*dataIter).m_value, 0)); } - else if (strstr((*dataIter).m_label.c_str(), "isSecret") != NULL - || strstr((*dataIter).m_label.c_str(), "isLocked") != NULL) + else if (strstr((*dataIter).m_label.c_str(), "isSecret") != nullptr + || strstr((*dataIter).m_label.c_str(), "isLocked") != nullptr) { if ((*dataIter).m_value == 1) mon->set(MetricsServer::getWorldCountChannel(), STATUS_LOCKED); } - else if (strstr((*dataIter).m_label.c_str(), "isLoading") != NULL) + else if (strstr((*dataIter).m_label.c_str(), "isLoading") != nullptr) { // include in the root node description how // long the cluster has been loading @@ -226,19 +226,19 @@ void MetricsGatheringConnection::update(const std::vector & data) //note: we know that the "isSecret", and "isLocked" nodes will come after the "population" node in the list // we are iterating over, so they will override the population setting - if (strstr((*dataIter).m_label.c_str(), "population") != NULL) + if (strstr((*dataIter).m_label.c_str(), "population") != nullptr) { // there are nodes under the population node, so don't interpret them as the population - if (strstr((*dataIter).m_label.c_str(), "population.") == NULL) + if (strstr((*dataIter).m_label.c_str(), "population.") == nullptr) mon->set(MetricsServer::getWorldCountChannel(), std::max((*dataIter).m_value, 0)); } - else if (strstr((*dataIter).m_label.c_str(), "isSecret") != NULL - || strstr((*dataIter).m_label.c_str(), "isLocked") != NULL) + else if (strstr((*dataIter).m_label.c_str(), "isSecret") != nullptr + || strstr((*dataIter).m_label.c_str(), "isLocked") != nullptr) { if ((*dataIter).m_value == 1) mon->set(MetricsServer::getWorldCountChannel(), STATUS_LOCKED); } - else if (strstr((*dataIter).m_label.c_str(), "isLoading") != NULL) + else if (strstr((*dataIter).m_label.c_str(), "isLoading") != nullptr) { // include in the root node description how // long the cluster has been loading diff --git a/engine/server/application/MetricsServer/src/shared/MetricsServer.cpp b/engine/server/application/MetricsServer/src/shared/MetricsServer.cpp index 9754caca..aab52220 100755 --- a/engine/server/application/MetricsServer/src/shared/MetricsServer.cpp +++ b/engine/server/application/MetricsServer/src/shared/MetricsServer.cpp @@ -29,8 +29,8 @@ std::string MetricsServer::m_worldCountChannelDescription; bool MetricsServer::m_done = false; Service* MetricsServer::m_metricsService; CMonitorAPI * MetricsServer::m_soeMonitor; -Service * MetricsServer::ms_service = NULL; -TaskConnection * MetricsServer::ms_taskConnection = NULL; +Service * MetricsServer::ms_service = nullptr; +TaskConnection * MetricsServer::ms_taskConnection = nullptr; //---------------------------------------------------------------- diff --git a/engine/server/application/PlanetServer/src/linux/main.cpp b/engine/server/application/PlanetServer/src/linux/main.cpp index d77747cf..7d8b5908 100755 --- a/engine/server/application/PlanetServer/src/linux/main.cpp +++ b/engine/server/application/PlanetServer/src/linux/main.cpp @@ -46,7 +46,7 @@ int main(int argc, char ** argv) SetupSharedNetworkMessages::install(); - SetupSharedRandom::install(time(NULL)); //lint !e732 loss of sign (of 0!) + SetupSharedRandom::install(time(nullptr)); //lint !e732 loss of sign (of 0!) SetupSharedUtility::Data sharedUtilityData; SetupSharedUtility::setupGameData (sharedUtilityData); diff --git a/engine/server/application/PlanetServer/src/shared/ConsoleCommandParser.cpp b/engine/server/application/PlanetServer/src/shared/ConsoleCommandParser.cpp index b5839b87..4a3fec7d 100755 --- a/engine/server/application/PlanetServer/src/shared/ConsoleCommandParser.cpp +++ b/engine/server/application/PlanetServer/src/shared/ConsoleCommandParser.cpp @@ -31,7 +31,7 @@ const CommandParser::CmdInfo cmds[] = //----------------------------------------------------------------------- ConsoleCommandParser::ConsoleCommandParser() : -CommandParser ("", 0, "...", "console commands", NULL) +CommandParser ("", 0, "...", "console commands", nullptr) { createDelegateCommands(cmds); } diff --git a/engine/server/application/PlanetServer/src/shared/ConsoleManager.cpp b/engine/server/application/PlanetServer/src/shared/ConsoleManager.cpp index 2326cbf2..4a94be0c 100755 --- a/engine/server/application/PlanetServer/src/shared/ConsoleManager.cpp +++ b/engine/server/application/PlanetServer/src/shared/ConsoleManager.cpp @@ -14,7 +14,7 @@ namespace ConsoleManagerNamespace { - ConsoleCommandParser * s_consoleCommandParserRoot = NULL; + ConsoleCommandParser * s_consoleCommandParserRoot = nullptr; } using namespace ConsoleManagerNamespace; diff --git a/engine/server/application/PlanetServer/src/shared/GameServerData.cpp b/engine/server/application/PlanetServer/src/shared/GameServerData.cpp index 58a57f31..e7e91d59 100755 --- a/engine/server/application/PlanetServer/src/shared/GameServerData.cpp +++ b/engine/server/application/PlanetServer/src/shared/GameServerData.cpp @@ -27,7 +27,7 @@ GameServerData::GameServerData(GameServerConnection *connection) : // ---------------------------------------------------------------------- GameServerData::GameServerData(const GameServerData &rhs) : - m_connection(NULL), // connection pointer is not copied when we copy GameServerDatas + m_connection(nullptr), // connection pointer is not copied when we copy GameServerDatas m_objectCount(rhs.m_objectCount), m_interestObjectCount(rhs.m_interestObjectCount), m_interestCreatureObjectCount(rhs.m_interestCreatureObjectCount), @@ -38,7 +38,7 @@ GameServerData::GameServerData(const GameServerData &rhs) : // ---------------------------------------------------------------------- GameServerData::GameServerData() : - m_connection(NULL), + m_connection(nullptr), m_objectCount(0), m_interestObjectCount(0), m_interestCreatureObjectCount(0), @@ -53,7 +53,7 @@ GameServerData &GameServerData::operator=(const GameServerData &rhs) if (&rhs == this) return *this; - m_connection=NULL; // connection pointer is not copied when we copy GameServerDatas + m_connection=nullptr; // connection pointer is not copied when we copy GameServerDatas m_objectCount=rhs.m_objectCount; m_interestObjectCount=rhs.m_interestObjectCount; m_interestCreatureObjectCount=rhs.m_interestCreatureObjectCount; diff --git a/engine/server/application/PlanetServer/src/shared/PlanetProxyObject.cpp b/engine/server/application/PlanetServer/src/shared/PlanetProxyObject.cpp index 0fff2eb7..b2d9cf79 100755 --- a/engine/server/application/PlanetServer/src/shared/PlanetProxyObject.cpp +++ b/engine/server/application/PlanetServer/src/shared/PlanetProxyObject.cpp @@ -41,9 +41,9 @@ PlanetProxyObject::PlanetProxyObject (const NetworkId &objectId) : m_authoritativeServer(0), m_lastReportedServer(0), m_interestRadius(0), - m_quadtreeNode(NULL), + m_quadtreeNode(nullptr), m_authTransferTimeMs(Clock::timeMs()), - m_contents(NULL), + m_contents(nullptr), m_level(0), m_hibernating(false), m_templateCrc(0), @@ -137,9 +137,9 @@ void PlanetProxyObject::update(int x, int y, int z, NetworkId containedBy, uint3 if (ConfigPlanetServer::getEnableContentsChecking() && (m_containedBy!=containedBy)) updateContentsTracking(containedBy); - bool const firstUpdate = (m_quadtreeNode == NULL); + bool const firstUpdate = (m_quadtreeNode == nullptr); - if (m_quadtreeNode!=NULL) // if this is the first update for this object, m_quadtreeNode will be NULL because it hasn't been placed anywhere yet + if (m_quadtreeNode!=nullptr) // if this is the first update for this object, m_quadtreeNode will be nullptr because it hasn't been placed anywhere yet { removeServerStatistics(); diff --git a/engine/server/application/PlanetServer/src/shared/PlanetServer.cpp b/engine/server/application/PlanetServer/src/shared/PlanetServer.cpp index d69a029c..a76929ce 100755 --- a/engine/server/application/PlanetServer/src/shared/PlanetServer.cpp +++ b/engine/server/application/PlanetServer/src/shared/PlanetServer.cpp @@ -102,12 +102,12 @@ using namespace PlanetServerNamespace; PlanetServer::PlanetServer() : Singleton(), MessageDispatch::Receiver(), - m_pendingCentralServerConnection(NULL), - m_centralServerConnection(NULL), - m_gameService(NULL), - m_watcherService(NULL), + m_pendingCentralServerConnection(nullptr), + m_centralServerConnection(nullptr), + m_gameService(nullptr), + m_watcherService(nullptr), m_gameServers(), - m_taskConnection(NULL), + m_taskConnection(nullptr), m_done(false), m_roundRobinGameServer(0), m_pendingServerStarts(new std::map()), @@ -117,7 +117,7 @@ PlanetServer::PlanetServer() : m_spaceMode(false), m_messagesWaitingForGameServer(), m_metricsData(0), - m_taskManagerConnection(NULL), + m_taskManagerConnection(nullptr), m_sceneTransferChunkLoads(new std::list), m_pendingCharacterSaves(new std::map), m_watchers(), @@ -433,7 +433,7 @@ void PlanetServer::receiveMessage(const MessageDispatch::Emitter & source, const GameServerConnection *gameServer=const_cast(dynamic_cast(&source)); std::set::iterator f = m_pendingGameServerDisconnects.find(gameServer); - WARNING_DEBUG_FATAL(gameServer==0,("Source was NULL or source was not a GameServerConnection.")); + WARNING_DEBUG_FATAL(gameServer==0,("Source was nullptr or source was not a GameServerConnection.")); DEBUG_REPORT_LOG(true, ("removing crashed gameserver\n")); uint32 id = gameServer->getProcessId(); GameServerMapType::iterator i=m_gameServers.find(id); @@ -688,7 +688,7 @@ void PlanetServer::receiveMessage(const MessageDispatch::Emitter & source, const UnloadedPlayerMessage msg(ri); GameServerConnection *gameServer=const_cast(dynamic_cast(&source)); - WARNING_DEBUG_FATAL(gameServer==0,("Source was NULL or source was not a GameServerConnection.")); + WARNING_DEBUG_FATAL(gameServer==0,("Source was nullptr or source was not a GameServerConnection.")); uint32 gameServerId = gameServer->getProcessId(); (*m_pendingCharacterSaves)[msg.getPlayerId()]=gameServerId; @@ -766,19 +766,19 @@ void PlanetServer::receiveMessage(const MessageDispatch::Emitter & source, const GameServerData * fromServer = PlanetServer::getGameServerData(msg.getFromProcess()); GameServerData * toServer = PlanetServer::getGameServerData(msg.getToProcess()); PlanetProxyObject * object = Scene::getInstance().findObjectByID(msg.getId()); - if (fromServer == NULL || toServer == NULL || object == NULL) + if (fromServer == nullptr || toServer == nullptr || object == nullptr) { - if (fromServer == NULL) + if (fromServer == nullptr) { WARNING(true, ("Message GameServerForceChangeAuthorityMessage: no " "from server %lu", msg.getFromProcess())); } - if (toServer == NULL) + if (toServer == nullptr) { WARNING(true, ("Message GameServerForceChangeAuthorityMessage: no " "to server %lu", msg.getToProcess())); } - if (object == NULL) + if (object == nullptr) { WARNING(true, ("Message GameServerForceChangeAuthorityMessage: no " "object for id %s", msg.getId().getValueString().c_str())); @@ -914,7 +914,7 @@ void PlanetServer::receiveMessage(const MessageDispatch::Emitter & source, const { // if it's been "awhile" since we requested to restart the GameServer, // then assume that something has gone wrong, and try the restart again - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); for (std::map >::iterator iter = m_startingGameServers->begin(); iter != m_startingGameServers->end(); ++iter) { @@ -1005,7 +1005,7 @@ GameServerConnection *PlanetServer::getGameServerConnection(uint32 serverId) if (i!=m_gameServers.end()) return (*i).second->getConnection(); else - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -1290,7 +1290,7 @@ void PlanetServer::startGameServer(const std::set & preloadServ TaskSpawnProcess spawn("any", "SwgGameServer", options, i->second); if (m_centralServerConnection) { - (*m_startingGameServers)[cookie] = std::make_pair(options, ::time(NULL)); + (*m_startingGameServers)[cookie] = std::make_pair(options, ::time(nullptr)); ++cookie; m_centralServerConnection->send(spawn,true); DEBUG_REPORT_LOG(true, ("Sent start gameserver request for scene %s\n", ConfigPlanetServer::getSceneID())); @@ -1321,7 +1321,7 @@ GameServerData *PlanetServer::getGameServerData(uint32 serverId) const if (i!=m_gameServers.end()) return i->second; else - return NULL; + return nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/application/PlanetServer/src/shared/PlanetServer.h b/engine/server/application/PlanetServer/src/shared/PlanetServer.h index cf457544..7a75e4fc 100755 --- a/engine/server/application/PlanetServer/src/shared/PlanetServer.h +++ b/engine/server/application/PlanetServer/src/shared/PlanetServer.h @@ -146,7 +146,7 @@ inline int PlanetServer::getNumberOfGameServers() const inline void PlanetServer::onCentralConnected(CentralServerConnection *connection) { - m_pendingCentralServerConnection=NULL; + m_pendingCentralServerConnection=nullptr; m_centralServerConnection=connection; } diff --git a/engine/server/application/PlanetServer/src/shared/PreloadManager.cpp b/engine/server/application/PlanetServer/src/shared/PreloadManager.cpp index 37371536..15811eeb 100755 --- a/engine/server/application/PlanetServer/src/shared/PreloadManager.cpp +++ b/engine/server/application/PlanetServer/src/shared/PreloadManager.cpp @@ -119,7 +119,7 @@ void PreloadManager::handlePreloadList() if (PlanetServer::getInstance().getEnablePreload()) { DataTable * data = DataTableManager::getTable(ConfigPlanetServer::getPreloadDataTableName(),true); - FATAL(data==NULL,("Could not find data table %s, needed for preload",ConfigPlanetServer::getPreloadDataTableName())); + FATAL(data==nullptr,("Could not find data table %s, needed for preload",ConfigPlanetServer::getPreloadDataTableName())); int numRows = data->getNumRows(); for (int row=0; row(&source); - WARNING_DEBUG_FATAL(gameServer==0,("Source was NULL or source was not a GameServerConnection.")); + WARNING_DEBUG_FATAL(gameServer==0,("Source was nullptr or source was not a GameServerConnection.")); if (message.isType("GameConnectionClosed")) { @@ -216,7 +216,7 @@ Node *Scene::findNodeByPosition(int x, int z) /** * Given coordinates, return a const pointer to the node that encloses - * those coordinates. Will not create new nodes, so it may return NULL. + * those coordinates. Will not create new nodes, so it may return nullptr. */ const Node *Scene::findNodeByPositionConst(int x, int z) const { @@ -245,7 +245,7 @@ Node *Scene::findNodeByRoundedPosition(int x, int z) /** * Given coordinates that are known to be a node boundary, return a const pointer - * to the node. Does not create new nodes, so may return NULL. + * to the node. Does not create new nodes, so may return nullptr. */ const Node *Scene::findNodeByRoundedPositionConst(int x, int z) const { @@ -254,7 +254,7 @@ const Node *Scene::findNodeByRoundedPositionConst(int x, int z) const if (i!=m_nodeMap.end()) return (*i).second; else - return NULL; + return nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/application/StationPlayersCollector/src/linux/main.cpp b/engine/server/application/StationPlayersCollector/src/linux/main.cpp index 7112ccde..d2abdabf 100755 --- a/engine/server/application/StationPlayersCollector/src/linux/main.cpp +++ b/engine/server/application/StationPlayersCollector/src/linux/main.cpp @@ -35,7 +35,7 @@ int main(int argc, char ** argv) SetupSharedFile::install(false); SetupSharedNetworkMessages::install(); - SetupSharedRandom::install(static_cast(time(NULL))); //lint !e1924 !e64 // NULL is a C-Style cast? + SetupSharedRandom::install(static_cast(time(nullptr))); //lint !e1924 !e64 // nullptr is a C-Style cast? Os::setProgramName("StationPlayersCollector"); diff --git a/engine/server/application/TaskManager/src/linux/ConsoleInput.cpp b/engine/server/application/TaskManager/src/linux/ConsoleInput.cpp index a0d4580c..756bd237 100755 --- a/engine/server/application/TaskManager/src/linux/ConsoleInput.cpp +++ b/engine/server/application/TaskManager/src/linux/ConsoleInput.cpp @@ -22,7 +22,7 @@ struct SetBufferMode SetBufferMode::SetBufferMode() { - setvbuf(stdin, NULL, _IONBF, 0); + setvbuf(stdin, nullptr, _IONBF, 0); } //----------------------------------------------------------------------- diff --git a/engine/server/application/TaskManager/src/linux/ProcessSpawner.cpp b/engine/server/application/TaskManager/src/linux/ProcessSpawner.cpp index 3996480b..e63ffd6b 100755 --- a/engine/server/application/TaskManager/src/linux/ProcessSpawner.cpp +++ b/engine/server/application/TaskManager/src/linux/ProcessSpawner.cpp @@ -92,7 +92,7 @@ void makeParameters(const std::vector & parameters, std::vector(time(NULL))); //lint !e1924 !e64 // NULL is a C-Style cast? + SetupSharedRandom::install(static_cast(time(nullptr))); //lint !e1924 !e64 // nullptr is a C-Style cast? Os::setProgramName("TaskManager"); //setup the server diff --git a/engine/server/application/TaskManager/src/shared/GameConnection.cpp b/engine/server/application/TaskManager/src/shared/GameConnection.cpp index d297a6dd..baa6adfb 100755 --- a/engine/server/application/TaskManager/src/shared/GameConnection.cpp +++ b/engine/server/application/TaskManager/src/shared/GameConnection.cpp @@ -89,7 +89,7 @@ void GameConnection::receive(const Archive::ByteStream & message) char filename[30]; snprintf(filename, sizeof(filename)-1, "/proc/%lu/cmdline", m_pid); - // format of the cmdline file is a NULL separates every + // format of the cmdline file is a nullptr separates every // parameter, so we'll have to replace the NULLs with spaces FILE *inFile = fopen(filename,"rb"); if (inFile) diff --git a/engine/server/application/TaskManager/src/shared/Locator.cpp b/engine/server/application/TaskManager/src/shared/Locator.cpp index 994d2184..2dac97f8 100755 --- a/engine/server/application/TaskManager/src/shared/Locator.cpp +++ b/engine/server/application/TaskManager/src/shared/Locator.cpp @@ -25,11 +25,11 @@ namespace LocatorNamespace float getConfigSetting(const char *section, const char *key, const float defaultValue) { const ConfigFile::Section * sec = ConfigFile::getSection(section); - if (sec == NULL) + if (sec == nullptr) return defaultValue; const ConfigFile::Key * ky = sec->findKey(key); - if (ky == NULL) + if (ky == nullptr) return defaultValue; return ky->getAsFloat(ky->getCount()-1, defaultValue); @@ -364,7 +364,7 @@ void Locator::opened(std::string const &label, ManagerConnection *newConnection) TaskManager::runSpawnRequestQueue(); } else - WARNING_STRICT_FATAL(true, ("Passed null connection to Locator::opened")); + WARNING_STRICT_FATAL(true, ("Passed nullptr connection to Locator::opened")); } // ---------------------------------------------------------------------- diff --git a/engine/server/application/TaskManager/src/shared/ManagerConnection.cpp b/engine/server/application/TaskManager/src/shared/ManagerConnection.cpp index 3720de92..08807765 100755 --- a/engine/server/application/TaskManager/src/shared/ManagerConnection.cpp +++ b/engine/server/application/TaskManager/src/shared/ManagerConnection.cpp @@ -98,7 +98,7 @@ void ManagerConnection::onReceive(const Archive::ByteStream & message) r = message.begin(); if (m.isType("SystemTimeCheck")) { - long const currentTime = static_cast(::time(NULL)); + long const currentTime = static_cast(::time(nullptr)); GenericValueTypeMessage > msg(r); if (TaskManager::getNodeLabel() == "node0") @@ -117,7 +117,7 @@ void ManagerConnection::onReceive(const Archive::ByteStream & message) else if (m.isType("TaskConnectionIdMessage")) { static long const clockDriftFatalTimePeriod = static_cast(TaskManager::getStartTime()) + ConfigTaskManager::getClockDriftFatalIntervalSeconds(); - long const currentTime = static_cast(::time(NULL)); + long const currentTime = static_cast(::time(nullptr)); TaskConnectionIdMessage t(r); WARNING_STRICT_FATAL(t.getServerType() != TaskConnectionIdMessage::TaskManager, ("ManagerConnection received wrong type identifier")); diff --git a/engine/server/application/TaskManager/src/shared/TaskManager.cpp b/engine/server/application/TaskManager/src/shared/TaskManager.cpp index 192ab1a3..04550a81 100755 --- a/engine/server/application/TaskManager/src/shared/TaskManager.cpp +++ b/engine/server/application/TaskManager/src/shared/TaskManager.cpp @@ -161,7 +161,7 @@ m_processEntries(), m_localServers(), m_remoteServers(), m_nodeLabel(), -m_startTime(::time(NULL)), +m_startTime(::time(nullptr)), m_nodeList(), m_nodeNumber(-1), m_nodeToConnectToList(), @@ -362,7 +362,7 @@ void TaskManager::processRcFile() void TaskManager::setupNodeList() { char buffer[64]; - const char* result = NULL; + const char* result = nullptr; int nodeIndex = 0; bool found = true; @@ -375,7 +375,7 @@ void TaskManager::setupNodeList() { found = false; sprintf(buffer, "node%d", nodeIndex); - result = ConfigFile::getKeyString("TaskManager", buffer, NULL); + result = ConfigFile::getKeyString("TaskManager", buffer, nullptr); if (result) { NodeEntry n(result, buffer, nodeIndex); @@ -967,8 +967,8 @@ void TaskManager::update() // of slave TaskManager that has disconnected but has not reconnected, // so that an alert can be made in SOEMon so ops can see it and restart // the disconnected TaskManager - static time_t timeSystemTimeCheck = ::time(NULL) + ConfigTaskManager::getSystemTimeCheckIntervalSeconds(); - time_t const timeNow = ::time(NULL); + static time_t timeSystemTimeCheck = ::time(nullptr) + ConfigTaskManager::getSystemTimeCheckIntervalSeconds(); + time_t const timeNow = ::time(nullptr); if (timeSystemTimeCheck <= timeNow) { if (getNodeLabel() != "node0") diff --git a/engine/server/application/TransferServer/src/shared/CTSAPIClient.cpp b/engine/server/application/TransferServer/src/shared/CTSAPIClient.cpp index 6d456516..ca5d0845 100755 --- a/engine/server/application/TransferServer/src/shared/CTSAPIClient.cpp +++ b/engine/server/application/TransferServer/src/shared/CTSAPIClient.cpp @@ -147,7 +147,7 @@ void CTSAPIClient::onRequestMove(const unsigned server_track, const char *langua { LOG("CTSAPI", ("Received a transfer request for station ID %d, but a transfer for that id is already in progress", uid)); const unsigned int result = static_cast(CTService::CT_GAMERESULT_SOFTERROR); - IGNORE_RETURN(replyMove(server_track, result, NULL, NULL)); + IGNORE_RETURN(replyMove(server_track, result, nullptr, nullptr)); } } @@ -165,7 +165,7 @@ void CTSAPIClient::onRequestTransferAccount(const unsigned server_track, const u { LOG("CTSAPI", ("Received a transfer request for station ID %d, but a transfer for that id is already in progress", uid)); const unsigned int result = static_cast(CTService::CT_GAMERESULT_SOFTERROR); - IGNORE_RETURN(replyTransferAccount(server_track, result, NULL, NULL)); + IGNORE_RETURN(replyTransferAccount(server_track, result, nullptr, nullptr)); } } @@ -197,12 +197,12 @@ void CTSAPIClient::onRequestServerList(const unsigned server_track, const char * if(! servers.empty()) { const unsigned int result = static_cast(CTService::CT_RESULT_SUCCESS); - IGNORE_RETURN(replyServerList(server_track, result, servers.size(), &servers[0], NULL)); + IGNORE_RETURN(replyServerList(server_track, result, servers.size(), &servers[0], nullptr)); } else { const unsigned int result = static_cast(CTService::CT_RESULT_FAILURE); - IGNORE_RETURN(replyServerList(server_track, result, servers.size(), NULL, NULL)); + IGNORE_RETURN(replyServerList(server_track, result, servers.size(), nullptr, nullptr)); } } @@ -226,12 +226,12 @@ void CTSAPIClient::onRequestDestinationServerList(const unsigned server_track, c if(! servers.empty()) { const unsigned int result = static_cast(CTService::CT_RESULT_SUCCESS); - IGNORE_RETURN(replyDestinationServerList(server_track, result, servers.size(), &servers[0], NULL)); + IGNORE_RETURN(replyDestinationServerList(server_track, result, servers.size(), &servers[0], nullptr)); } else { const unsigned int result = static_cast(CTService::CT_RESULT_FAILURE); - IGNORE_RETURN(replyDestinationServerList(server_track, result, servers.size(), NULL, NULL)); + IGNORE_RETURN(replyDestinationServerList(server_track, result, servers.size(), nullptr, nullptr)); } } @@ -260,7 +260,7 @@ void CTSAPIClient::moveStart(unsigned int stationId, unsigned int track, const C std::map::iterator f = s_completedTransfers.find(track); if(f != s_completedTransfers.end()) { - IGNORE_RETURN(replyMove(track, f->second, NULL, NULL)); + IGNORE_RETURN(replyMove(track, f->second, nullptr, nullptr)); } else { @@ -284,7 +284,7 @@ void CTSAPIClient::lostCentralServerConnection(const CentralServerConnection * c { if(i->second.m_sourceCentralServerConnection == centralServerConnection || i->second.m_destinationCentralServerConnection == centralServerConnection) { - IGNORE_RETURN(replyMove(i->second.m_track, result, NULL, NULL)); + IGNORE_RETURN(replyMove(i->second.m_track, result, nullptr, nullptr)); s_activeTransfers.erase(i++); } else diff --git a/engine/server/application/TransferServer/src/shared/ConsoleManager.cpp b/engine/server/application/TransferServer/src/shared/ConsoleManager.cpp index c0208e0d..1a04dc38 100755 --- a/engine/server/application/TransferServer/src/shared/ConsoleManager.cpp +++ b/engine/server/application/TransferServer/src/shared/ConsoleManager.cpp @@ -14,7 +14,7 @@ namespace ConsoleManagerNamespace { - ConsoleCommandParser * s_consoleCommandParserRoot = NULL; + ConsoleCommandParser * s_consoleCommandParserRoot = nullptr; } using namespace ConsoleManagerNamespace; diff --git a/engine/server/application/TransferServer/src/shared/TransferServer.cpp b/engine/server/application/TransferServer/src/shared/TransferServer.cpp index 07334ab4..6533fd3e 100755 --- a/engine/server/application/TransferServer/src/shared/TransferServer.cpp +++ b/engine/server/application/TransferServer/src/shared/TransferServer.cpp @@ -150,10 +150,10 @@ namespace TransferServerNamespace if(s_apiClient) { const std::string resultString = resultToString(resultCode); - LOG("CustomerService", ("CharacterTransfer: transactionId=%u replyMove(%u, %s, NULL, NULL)", reply.getTransactionId(), reply.getTrack(), resultString.c_str())); + LOG("CustomerService", ("CharacterTransfer: transactionId=%u replyMove(%u, %s, nullptr, nullptr)", reply.getTransactionId(), reply.getTrack(), resultString.c_str())); const unsigned int result = static_cast(resultCode); s_apiClient->moveComplete(reply.getSourceStationId(), reply.getTrack(), result); - IGNORE_RETURN(s_apiClient->replyMove(reply.getTrack(), result, Unicode::narrowToWide(resultString).c_str(), NULL)); + IGNORE_RETURN(s_apiClient->replyMove(reply.getTrack(), result, Unicode::narrowToWide(resultString).c_str(), nullptr)); } } @@ -282,7 +282,7 @@ void TransferServer::requestCharacterList(unsigned int track, unsigned int stati { const unsigned int result = static_cast(CTService::CT_RESULT_FAILURE); - IGNORE_RETURN(s_apiClient->replyCharacterList(track, result, 0, NULL, NULL)); + IGNORE_RETURN(s_apiClient->replyCharacterList(track, result, 0, nullptr, nullptr)); s_apiClient->moveComplete(stationId, track, result); } } @@ -410,7 +410,7 @@ void TransferServer::requestTransferAccount(unsigned int track, unsigned int sou if(s_apiClient) { const unsigned int result = static_cast(CTService::CT_GAMERESULT_HARDERROR); - IGNORE_RETURN(s_apiClient->replyValidateMove(track, result, NULL, NULL, NULL)); + IGNORE_RETURN(s_apiClient->replyValidateMove(track, result, nullptr, nullptr, nullptr)); s_apiClient->moveComplete(sourceStationId, track, result); } @@ -430,7 +430,7 @@ void TransferServer::requestTransferAccount(unsigned int track, unsigned int sou if(s_apiClient) { const unsigned int result = static_cast(CTService::CT_GAMERESULT_SERVER_IS_DOWN); - IGNORE_RETURN(s_apiClient->replyTransferAccount(track, result, NULL, NULL)); + IGNORE_RETURN(s_apiClient->replyTransferAccount(track, result, nullptr, nullptr)); s_apiClient->moveComplete(sourceStationId, track, result); } @@ -442,12 +442,12 @@ void TransferServer::requestTransferAccount(unsigned int track, unsigned int sou if(destinationStationId == 0 || sourceStationId == 0) { - LOG("CustomerService", ("CharacterTransfer: Account move request made with a null destination station id: or source station id: %lu\n", sourceStationId)); + LOG("CustomerService", ("CharacterTransfer: Account move request made with a nullptr destination station id: or source station id: %lu\n", sourceStationId)); if(s_apiClient) { const unsigned int result = static_cast(CTService::CT_GAMERESULT_HARDERROR); - IGNORE_RETURN(s_apiClient->replyTransferAccount(track, result, NULL, NULL)); + IGNORE_RETURN(s_apiClient->replyTransferAccount(track, result, nullptr, nullptr)); s_apiClient->moveComplete(sourceStationId, track, result); } @@ -488,7 +488,7 @@ void TransferServer::requestMoveValidation(unsigned int track, unsigned int sour if(s_apiClient) { const unsigned int result = static_cast(CTService::CT_GAMERESULT_HARDERROR); - IGNORE_RETURN(s_apiClient->replyValidateMove(track, result, NULL, NULL, NULL)); + IGNORE_RETURN(s_apiClient->replyValidateMove(track, result, nullptr, nullptr, nullptr)); s_apiClient->moveComplete(sourceStationId, track, result); } } @@ -516,7 +516,7 @@ void TransferServer::requestMoveValidation(unsigned int track, unsigned int sour if(s_apiClient) { const unsigned int result = static_cast(CTService::CT_GAMERESULT_SERVER_IS_DOWN); - IGNORE_RETURN(s_apiClient->replyValidateMove(track, result, NULL, NULL, NULL)); + IGNORE_RETURN(s_apiClient->replyValidateMove(track, result, nullptr, nullptr, nullptr)); s_apiClient->moveComplete(sourceStationId, track, result); } } @@ -651,8 +651,8 @@ void TransferServer::replyCharacterList(const TransferReplyCharacterList & reply result = static_cast(CTService::CT_RESULT_FAILURE); s_apiClient->moveComplete(reply.getStationId(), reply.getTrack(), result); } - LOG("CTSAPI", ("invoking CTServiceAPI::replyCharacterList(%d, %d, %d, characters, NULL)", reply.getTrack(), result, chars.size())); - IGNORE_RETURN(s_apiClient->replyCharacterList(reply.getTrack(), result, reply.getAvatarList().size(), characters, NULL)); + LOG("CTSAPI", ("invoking CTServiceAPI::replyCharacterList(%d, %d, %d, characters, nullptr)", reply.getTrack(), result, chars.size())); + IGNORE_RETURN(s_apiClient->replyCharacterList(reply.getTrack(), result, reply.getAvatarList().size(), characters, nullptr)); } // else use another interface if available } @@ -675,7 +675,7 @@ void TransferServer::replyValidateMove(const TransferCharacterData & reply) { LOG("CustomerService", ("CharacterTransfer: replyValidateMove passed name validation for %s", reply.toString().c_str())); } - IGNORE_RETURN(s_apiClient->replyValidateMove(reply.getTrack(), result, NULL, NULL, NULL)); + IGNORE_RETURN(s_apiClient->replyValidateMove(reply.getTrack(), result, nullptr, nullptr, nullptr)); s_apiClient->moveComplete(reply.getSourceStationId(), reply.getTrack(), result); } } @@ -736,7 +736,7 @@ void TransferServer::replyTransferAccountSuccess(const TransferAccountData & rep LOG("CustomerService", ("CharacterTransfer: Could not transfer chat avatars for character %s on cluster %s from %lu to %lu: central connection does not exist in transferserver", i->second.c_str(), i->first.c_str(), reply.getSourceStationId(), reply.getDestinationStationId())); const unsigned int result = static_cast(CTService::CT_GAMERESULT_HARDERROR); s_apiClient->moveComplete(reply.getSourceStationId(), reply.getTrack(), result); - IGNORE_RETURN(s_apiClient->replyTransferAccount(reply.getTrack(), result, NULL, NULL)); + IGNORE_RETURN(s_apiClient->replyTransferAccount(reply.getTrack(), result, nullptr, nullptr)); } } } @@ -748,7 +748,7 @@ void TransferServer::replyTransferAccountSuccess(const TransferAccountData & rep if(s_apiClient) { const unsigned int result = static_cast(CTService::CT_GAMERESULT_SUCCESS); - IGNORE_RETURN(s_apiClient->replyTransferAccount(reply.getTrack(), result, NULL, NULL)); + IGNORE_RETURN(s_apiClient->replyTransferAccount(reply.getTrack(), result, nullptr, nullptr)); s_apiClient->moveComplete(reply.getSourceStationId(), reply.getTrack(), result); } } @@ -808,7 +808,7 @@ void TransferServer::failedToTransferAccountNoCentralConnection(const TransferAc LOG("CustomerService", ("CharacterTransfer: Transfer failed: Could not connect to central server to update game database. Sending HARD ERROR to CTS API. %s", failed.toString().c_str())); const unsigned int result = static_cast(CTService::CT_GAMERESULT_HARDERROR); s_apiClient->moveComplete(failed.getSourceStationId(), failed.getTrack(), result); - IGNORE_RETURN(s_apiClient->replyTransferAccount(failed.getTrack(), result, NULL, NULL)); + IGNORE_RETURN(s_apiClient->replyTransferAccount(failed.getTrack(), result, nullptr, nullptr)); } } @@ -821,7 +821,7 @@ void TransferServer::failedToTransferAccountDestinationNotEmpty (const TransferA LOG("CustomerService", ("CharacterTransfer: Transfer failed: Destination stationId has avatars. Sending HARD ERROR to CTS API. %s", failed.toString().c_str())); const unsigned int result = static_cast(CTService::CT_GAMERESULT_HARDERROR); s_apiClient->moveComplete(failed.getSourceStationId(), failed.getTrack(), result); - IGNORE_RETURN(s_apiClient->replyTransferAccount(failed.getTrack(), result, NULL, NULL)); + IGNORE_RETURN(s_apiClient->replyTransferAccount(failed.getTrack(), result, nullptr, nullptr)); } } @@ -860,7 +860,7 @@ void TransferServer::failedToValidateTransfer(const TransferReplyMoveValidation { const unsigned int result = ((reply.getResult() == TransferReplyMoveValidation::TRMVR_cannot_create_regular_character) ? static_cast(CTService::CT_GAMERESULT_MAX_CHAR_ON_DEST_SERVER) : static_cast(CTService::CT_GAMERESULT_SERVER_IS_DOWN)); - IGNORE_RETURN(s_apiClient->replyValidateMove(reply.getTrack(), result, NULL, NULL, NULL)); + IGNORE_RETURN(s_apiClient->replyValidateMove(reply.getTrack(), result, nullptr, nullptr, nullptr)); s_apiClient->moveComplete(reply.getSourceStationId(), reply.getTrack(), result); // close pseudoclientconnections diff --git a/engine/server/library/serverDatabase/src/shared/ConsoleManager.cpp b/engine/server/library/serverDatabase/src/shared/ConsoleManager.cpp index 4e24a67e..70f8342d 100755 --- a/engine/server/library/serverDatabase/src/shared/ConsoleManager.cpp +++ b/engine/server/library/serverDatabase/src/shared/ConsoleManager.cpp @@ -14,7 +14,7 @@ namespace ConsoleManagerNamespace { - ConsoleCommandParser * s_consoleCommandParserRoot = NULL; + ConsoleCommandParser * s_consoleCommandParserRoot = nullptr; } using namespace ConsoleManagerNamespace; diff --git a/engine/server/library/serverDatabase/src/shared/DataLookup.cpp b/engine/server/library/serverDatabase/src/shared/DataLookup.cpp index dd42952a..33fef53a 100755 --- a/engine/server/library/serverDatabase/src/shared/DataLookup.cpp +++ b/engine/server/library/serverDatabase/src/shared/DataLookup.cpp @@ -30,7 +30,7 @@ //----------------------------------------------------------------------- -DataLookup *DataLookup::ms_theInstance = NULL; +DataLookup *DataLookup::ms_theInstance = nullptr; //----------------------------------------------------------------------- @@ -524,7 +524,7 @@ void DataLookup::deleteReservationList(uint32 stationId) reservationList * rl = rlIter->second; if (!rl) { - WARNING_STRICT_FATAL(true, ("Reservation list for stationID %lu is NULL", stationId)); + WARNING_STRICT_FATAL(true, ("Reservation list for stationID %lu is nullptr", stationId)); return; } reservationList::iterator i; diff --git a/engine/server/library/serverDatabase/src/shared/DatabaseProcess.cpp b/engine/server/library/serverDatabase/src/shared/DatabaseProcess.cpp index 1c0eca40..fb5a56fe 100755 --- a/engine/server/library/serverDatabase/src/shared/DatabaseProcess.cpp +++ b/engine/server/library/serverDatabase/src/shared/DatabaseProcess.cpp @@ -46,7 +46,7 @@ // ---------------------------------------------------------------------- -DatabaseProcess *DatabaseProcess::ms_theInstance = NULL; +DatabaseProcess *DatabaseProcess::ms_theInstance = nullptr; // ---------------------------------------------------------------------- @@ -627,7 +627,7 @@ void DatabaseProcess::sendToCommoditiesServer(GameNetworkMessage const &message, commoditiesConnection->send(message,reliable); } else - DEBUG_REPORT_LOG(true, ("commoditiesConnection is NULL\n")); + DEBUG_REPORT_LOG(true, ("commoditiesConnection is nullptr\n")); } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverDatabase/src/shared/ImmediateDeleteCustomPersistStep.cpp b/engine/server/library/serverDatabase/src/shared/ImmediateDeleteCustomPersistStep.cpp index e1c3d149..c205c79d 100755 --- a/engine/server/library/serverDatabase/src/shared/ImmediateDeleteCustomPersistStep.cpp +++ b/engine/server/library/serverDatabase/src/shared/ImmediateDeleteCustomPersistStep.cpp @@ -23,7 +23,7 @@ ImmediateDeleteCustomPersistStep::ImmediateDeleteCustomPersistStep() : ImmediateDeleteCustomPersistStep::~ImmediateDeleteCustomPersistStep() { delete m_objects; - m_objects = NULL; + m_objects = nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverDatabase/src/shared/LazyDeleter.cpp b/engine/server/library/serverDatabase/src/shared/LazyDeleter.cpp index 16baa713..ecdc4260 100755 --- a/engine/server/library/serverDatabase/src/shared/LazyDeleter.cpp +++ b/engine/server/library/serverDatabase/src/shared/LazyDeleter.cpp @@ -27,7 +27,7 @@ // ====================================================================== -LazyDeleter * LazyDeleter::ms_instance=NULL; +LazyDeleter * LazyDeleter::ms_instance=nullptr; // ====================================================================== @@ -80,13 +80,13 @@ void LazyDeleter::remove() { NOT_NULL(ms_instance); delete ms_instance; - ms_instance = NULL; + ms_instance = nullptr; } // ---------------------------------------------------------------------- LazyDeleter::LazyDeleter() : - m_workerThread(NULL), // Avoid starting the worker thread until the other member variables are initialized + m_workerThread(nullptr), // Avoid starting the worker thread until the other member variables are initialized m_incomingObjects(new std::vector), m_objectsToDelete(new std::deque), m_objectListLock(new Mutex), @@ -113,11 +113,11 @@ LazyDeleter::~LazyDeleter() delete m_objectsToDelete; delete m_objectListLock; - m_workerThread = NULL; - m_incomingObjects = NULL; - m_objectsToDelete = NULL; - m_objectListLock = NULL; - m_session = NULL; + m_workerThread = nullptr; + m_incomingObjects = nullptr; + m_objectsToDelete = nullptr; + m_objectListLock = nullptr; + m_session = nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverDatabase/src/shared/Loader.cpp b/engine/server/library/serverDatabase/src/shared/Loader.cpp index fb4b5a6c..3f863d80 100755 --- a/engine/server/library/serverDatabase/src/shared/Loader.cpp +++ b/engine/server/library/serverDatabase/src/shared/Loader.cpp @@ -55,7 +55,7 @@ // ====================================================================== -Loader *Loader::ms_instance = NULL; +Loader *Loader::ms_instance = nullptr; // ====================================================================== @@ -72,7 +72,7 @@ void Loader::remove() { NOT_NULL(ms_instance); delete ms_instance; - ms_instance = NULL; + ms_instance = nullptr; } // ---------------------------------------------------------------------- @@ -442,7 +442,7 @@ void Loader::receiveMessage(const MessageDispatch::Emitter & source, const Messa { Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); ValidateCharacterForLoginMessage msg(ri); - verifyCharacter(msg.getSuid(), msg.getCharacterId(), NULL); + verifyCharacter(msg.getSuid(), msg.getCharacterId(), nullptr); } else if(message.isType("TransferGetLoginLocationData")) { @@ -647,7 +647,7 @@ void Loader::checkVersionNumber(int expectedVersion, bool fatalOnMismatch) void Loader::requestChunk(uint32 processId,int nodeX, int nodeZ, const std::string &sceneId) { ObjectLocator * const regularLocator=new ChunkLocator(nodeX, nodeZ, sceneId, processId, true); - ObjectLocator * goldLocator=NULL; + ObjectLocator * goldLocator=nullptr; if (ConfigServerDatabase::getEnableGoldDatabase()) goldLocator = new ChunkLocator(nodeX, nodeZ, sceneId, processId, false); addLocatorsForServer(processId, regularLocator, goldLocator); @@ -671,7 +671,7 @@ void Loader::requestCharacter(const NetworkId &characterId, uint32 gameServerId) i=m_multipleLoginLock.find(characterId); if (i==m_multipleLoginLock.end()) { - addLocatorsForServer(gameServerId, new CharacterLocator(characterId), NULL); + addLocatorsForServer(gameServerId, new CharacterLocator(characterId), nullptr); DEBUG_REPORT_LOG(true,("Adding multipleLoginLock for %s\n",characterId.getValueString().c_str())); m_multipleLoginLock[characterId] = gameServerId; @@ -684,7 +684,7 @@ void Loader::requestCharacter(const NetworkId &characterId, uint32 gameServerId) } } else - addLocatorsForServer(gameServerId, new CharacterLocator(characterId), NULL); + addLocatorsForServer(gameServerId, new CharacterLocator(characterId), nullptr); } // ---------------------------------------------------------------------- @@ -692,7 +692,7 @@ void Loader::requestCharacter(const NetworkId &characterId, uint32 gameServerId) void Loader::loadContainedObject(const NetworkId &containerId, const NetworkId &objectId, uint32 gameServerId) { LOG("AuctionRetrieval", ("Loader::received loadContainedObject for loading object %s for retrieval", objectId.getValueString().c_str())); - addLocatorsForServer(gameServerId, new ContainedObjectLocator(containerId,objectId), NULL); + addLocatorsForServer(gameServerId, new ContainedObjectLocator(containerId,objectId), nullptr); } @@ -700,7 +700,7 @@ void Loader::loadContainedObject(const NetworkId &containerId, const NetworkId & void Loader::loadContents(const NetworkId &containerId, uint32 gameServerId) { - addLocatorsForServer(gameServerId, new ContentsLocator(containerId), NULL); + addLocatorsForServer(gameServerId, new ContentsLocator(containerId), nullptr); } // ---------------------------------------------------------------------- @@ -820,7 +820,7 @@ void Loader::removeLoadLock(const NetworkId &characterId) if (i->second!=0) { DEBUG_REPORT_LOG(true,("Now handling delayed login request for character %s\n",characterId.getValueString().c_str())); - addLocatorsForServer(i->second, new CharacterLocator(characterId), NULL); + addLocatorsForServer(i->second, new CharacterLocator(characterId), nullptr); } m_loadLock.erase(i); diff --git a/engine/server/library/serverDatabase/src/shared/MessageToManager.cpp b/engine/server/library/serverDatabase/src/shared/MessageToManager.cpp index 6773ccca..d47dc773 100755 --- a/engine/server/library/serverDatabase/src/shared/MessageToManager.cpp +++ b/engine/server/library/serverDatabase/src/shared/MessageToManager.cpp @@ -16,7 +16,7 @@ // ====================================================================== -MessageToManager *MessageToManager::ms_instance=NULL; +MessageToManager *MessageToManager::ms_instance=nullptr; // ====================================================================== @@ -34,7 +34,7 @@ void MessageToManager::remove() { NOT_NULL(ms_instance); delete ms_instance; - ms_instance = NULL; + ms_instance = nullptr; } // ---------------------------------------------------------------------- @@ -51,7 +51,7 @@ MessageToManager::~MessageToManager() for (MessagesByObjectType::iterator i=m_messagesByObject.begin(); i!=m_messagesByObject.end(); ++i) { delete i->second; - i->second=NULL; + i->second=nullptr; } } @@ -71,7 +71,7 @@ void MessageToManager::handleMessageTo(const MessageToPayload &data) { DEBUG_WARNING(true,("Received message %s twice.",data.getMessageId().getValueString().c_str())); delete i->second; - i->second = NULL; + i->second = nullptr; } m_messagesByObject[theKey]=new MessageToPayload(data); @@ -127,7 +127,7 @@ void MessageToManager::removeMessage(const MessageToId &messageId) if (j!=m_messagesByObject.end()) { delete j->second; - j->second=NULL; + j->second=nullptr; m_messagesByObject.erase(j); } m_messageToObjectMap.erase(i); diff --git a/engine/server/library/serverDatabase/src/shared/Persister.cpp b/engine/server/library/serverDatabase/src/shared/Persister.cpp index 89c299ff..bf178daa 100755 --- a/engine/server/library/serverDatabase/src/shared/Persister.cpp +++ b/engine/server/library/serverDatabase/src/shared/Persister.cpp @@ -70,7 +70,7 @@ // ====================================================================== -Persister *Persister::ms_instance=NULL; +Persister *Persister::ms_instance=nullptr; // ====================================================================== @@ -88,7 +88,7 @@ void Persister::remove() { NOT_NULL(ms_instance); delete ms_instance; - ms_instance = NULL; + ms_instance = nullptr; } //----------------------------------------------------------------------- @@ -108,9 +108,9 @@ Persister::Persister() : m_charactersToDeleteThisSaveCycle(new CharactersToDeleteType), m_charactersToDeleteNextSaveCycle(new CharactersToDeleteType), m_timeSinceLastSave(0), - m_messageSnapshot(NULL), - m_commoditiesSnapshot(NULL), - m_arbitraryGameDataSnapshot(NULL), + m_messageSnapshot(nullptr), + m_commoditiesSnapshot(nullptr), + m_arbitraryGameDataSnapshot(nullptr), m_saveStartTime(0), m_totalSaveTime(0), m_maxSaveTime(0), @@ -181,15 +181,15 @@ Persister::~Persister() m_currentSnapshots.clear(); m_newObjectSnapshots.clear(); m_objectSnapshotMap.clear(); - m_messageSnapshot = NULL; - m_commoditiesSnapshot = NULL; - m_arbitraryGameDataSnapshot = NULL; + m_messageSnapshot = nullptr; + m_commoditiesSnapshot = nullptr; + m_arbitraryGameDataSnapshot = nullptr; delete m_charactersToDeleteThisSaveCycle; - m_charactersToDeleteThisSaveCycle = NULL; + m_charactersToDeleteThisSaveCycle = nullptr; delete m_charactersToDeleteNextSaveCycle; - m_charactersToDeleteNextSaveCycle = NULL; + m_charactersToDeleteNextSaveCycle = nullptr; } // ---------------------------------------------------------------------- @@ -283,7 +283,7 @@ void Persister::onFrameBarrierReached() /** * Moves the current & new object snapshots onto the queue to be saved. * - * Does nothing if these snapshots are null. + * Does nothing if these snapshots are nullptr. */ void Persister::startSave(void) @@ -351,9 +351,9 @@ void Persister::startSave(void) m_currentSnapshots.clear(); m_newObjectSnapshots.clear(); m_objectSnapshotMap.clear(); - m_messageSnapshot = NULL; - m_commoditiesSnapshot = NULL; - m_arbitraryGameDataSnapshot = NULL; + m_messageSnapshot = nullptr; + m_commoditiesSnapshot = nullptr; + m_arbitraryGameDataSnapshot = nullptr; // prepare the list of characters to delete during the next save cycle if (m_charactersToDeleteNextSaveCycle && m_charactersToDeleteThisSaveCycle) @@ -515,7 +515,7 @@ void Persister::newObject(uint32 serverId, const NetworkId &objectId, int templa return; } - Snapshot *snap=NULL; + Snapshot *snap=nullptr; PendingCharactersType::iterator chardata=m_pendingCharacters.find(objectId); if (chardata!=m_pendingCharacters.end()) @@ -543,7 +543,7 @@ void Persister::newObject(uint32 serverId, const NetworkId &objectId, int templa else { // Add the object to the appropriate snapshot - snap=NULL; + snap=nullptr; { ObjectSnapshotMap::const_iterator j=m_objectSnapshotMap.find(container); if (j!=m_objectSnapshotMap.end() && j->second->getMode() == DB::ModeQuery::mode_INSERT) @@ -728,7 +728,7 @@ void Persister::receiveMessage(const MessageDispatch::Emitter & source, const Me Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); RenameCharacterMessageEx msg(ri); - renameCharacter(sourceGameServer, static_cast(msg.getRenameCharacterMessageSource()), msg.getStationId(), msg.getCharacterId(), msg.getNewName(), msg.getOldName(), msg.getLastNameChangeOnly(), msg.getRequestedBy(), NULL); + renameCharacter(sourceGameServer, static_cast(msg.getRenameCharacterMessageSource()), msg.getStationId(), msg.getCharacterId(), msg.getNewName(), msg.getOldName(), msg.getLastNameChangeOnly(), msg.getRequestedBy(), nullptr); } else if (message.isType("UnloadedPlayerMessage")) { diff --git a/engine/server/library/serverDatabase/src/shared/TaskGetBiography.cpp b/engine/server/library/serverDatabase/src/shared/TaskGetBiography.cpp index 9c6cb243..96b976fb 100755 --- a/engine/server/library/serverDatabase/src/shared/TaskGetBiography.cpp +++ b/engine/server/library/serverDatabase/src/shared/TaskGetBiography.cpp @@ -19,7 +19,7 @@ TaskGetBiography::TaskGetBiography(const NetworkId &owner, uint32 requestingProcess) : m_owner(owner), m_requestingProcess(requestingProcess), - m_bio(NULL) + m_bio(nullptr) { } @@ -28,7 +28,7 @@ TaskGetBiography::TaskGetBiography(const NetworkId &owner, uint32 requestingProc TaskGetBiography::~TaskGetBiography() { delete m_bio; - m_bio=NULL; + m_bio=nullptr; } // ---------------------------------------------------------------------- @@ -53,7 +53,7 @@ bool TaskGetBiography::process(DB::Session *session) void TaskGetBiography::onComplete() { - WARNING_STRICT_FATAL(!m_bio,("In TaskGetBiography::onComplete, but m_bio is NULL\n")); + WARNING_STRICT_FATAL(!m_bio,("In TaskGetBiography::onComplete, but m_bio is nullptr\n")); if (m_bio) { BiographyMessage msg(m_owner, *m_bio); diff --git a/engine/server/library/serverDatabase/src/shared/TaskSetBiography.cpp b/engine/server/library/serverDatabase/src/shared/TaskSetBiography.cpp index d8a98958..501cfe48 100755 --- a/engine/server/library/serverDatabase/src/shared/TaskSetBiography.cpp +++ b/engine/server/library/serverDatabase/src/shared/TaskSetBiography.cpp @@ -24,7 +24,7 @@ TaskSetBiography::TaskSetBiography(const NetworkId &owner, const Unicode::String TaskSetBiography::~TaskSetBiography() { delete m_bio; - m_bio=NULL; + m_bio=nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/ai/AggroListProperty.cpp b/engine/server/library/serverGame/src/shared/ai/AggroListProperty.cpp index 0b0a552d..e06b0d40 100755 --- a/engine/server/library/serverGame/src/shared/ai/AggroListProperty.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AggroListProperty.cpp @@ -106,7 +106,7 @@ bool AggroListPropertyNamespace::isIncapacitated(TangibleObject const & target) { CreatureObject const * const targetCreatureObject = target.asCreatureObject(); - return (targetCreatureObject != NULL) ? targetCreatureObject->isIncapacitated() : false; + return (targetCreatureObject != nullptr) ? targetCreatureObject->isIncapacitated() : false; } // ---------------------------------------------------------------------- @@ -114,7 +114,7 @@ bool AggroListPropertyNamespace::isDead(TangibleObject const & target) { CreatureObject const * const targetCreatureObject = target.asCreatureObject(); - return (targetCreatureObject != NULL) ? targetCreatureObject->isDead() : false; + return (targetCreatureObject != nullptr) ? targetCreatureObject->isDead() : false; } // ---------------------------------------------------------------------- @@ -122,7 +122,7 @@ bool AggroListPropertyNamespace::isInvulnerable(TangibleObject const & target) { CreatureObject const * const targetCreatureObject = target.asCreatureObject(); - return (targetCreatureObject != NULL) ? targetCreatureObject->isInvulnerable() : false; + return (targetCreatureObject != nullptr) ? targetCreatureObject->isInvulnerable() : false; } // ---------------------------------------------------------------------- @@ -138,7 +138,7 @@ bool AggroListPropertyNamespace::isFeigningDeath(TangibleObject const & target) { CreatureObject const * const targetCreatureObject = target.asCreatureObject(); - return (targetCreatureObject != NULL) ? targetCreatureObject->getState(States::FeignDeath) : false; + return (targetCreatureObject != nullptr) ? targetCreatureObject->getState(States::FeignDeath) : false; } // ---------------------------------------------------------------------- @@ -146,7 +146,7 @@ bool AggroListPropertyNamespace::isInPlayerBuilding(TangibleObject const & targe { ServerObject const * const topMostServerObject = ServerObject::asServerObject(ContainerInterface::getTopmostContainer(target)); - return (topMostServerObject != NULL) ? (topMostServerObject->getGameObjectType() == SharedObjectTemplate::GOT_building_player) : false; + return (topMostServerObject != nullptr) ? (topMostServerObject->getGameObjectType() == SharedObjectTemplate::GOT_building_player) : false; } // ---------------------------------------------------------------------- @@ -154,7 +154,7 @@ bool AggroListPropertyNamespace::isAggroImmune(TangibleObject const & target) { PlayerObject const * const playerObject = PlayerCreatureController::getPlayerObject(target.asCreatureObject()); - return (playerObject != NULL) ? playerObject->isAggroImmune() : false; + return (playerObject != nullptr) ? playerObject->isAggroImmune() : false; } // ====================================================================== @@ -212,7 +212,7 @@ void AggroListProperty::alter() // First, list things that invalidate this target in the aggro list // Second, list the things that promote the target to the hate list - if (target.getObject() == NULL) + if (target.getObject() == nullptr) { purgeList.push_back(iterTargetList); } @@ -315,7 +315,7 @@ TangibleObject & AggroListProperty::getTangibleOwner() AggroListProperty * AggroListProperty::getAggroListProperty(Object & object) { Property * const property = object.getProperty(getClassPropertyId()); - AggroListProperty * const aggroProperty = (property != NULL) ? static_cast(property) : NULL; + AggroListProperty * const aggroProperty = (property != nullptr) ? static_cast(property) : nullptr; return aggroProperty; } diff --git a/engine/server/library/serverGame/src/shared/ai/AiCombatPulseQueue.cpp b/engine/server/library/serverGame/src/shared/ai/AiCombatPulseQueue.cpp index c3e95004..328d9540 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiCombatPulseQueue.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiCombatPulseQueue.cpp @@ -45,7 +45,7 @@ void AiCombatPulseQueue::remove() void AiCombatPulseQueue::schedule(TangibleObject * const object, int waitTimeMs, unsigned long currentFrameTimeMs) { - if (object == NULL) + if (object == nullptr) return; unsigned long desiredTime = Clock::getFrameStartTimeMs() + currentFrameTimeMs + waitTimeMs; @@ -97,7 +97,7 @@ void AiCombatPulseQueue::alter(real time) TangibleObject * const object = (j->second)->first; - if (object != NULL && object->isInCombat()) + if (object != nullptr && object->isInCombat()) { NetworkId const & id = object->getNetworkId(); @@ -107,7 +107,7 @@ void AiCombatPulseQueue::alter(real time) GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(object); - if (gameScriptObject != NULL) + if (gameScriptObject != nullptr) { ScriptParams scriptParams; IGNORE_RETURN(gameScriptObject->trigAllScripts(Scripting::TRIG_AI_COMBAT_FRAME, scriptParams)); diff --git a/engine/server/library/serverGame/src/shared/ai/AiCreatureCombatProfile.cpp b/engine/server/library/serverGame/src/shared/ai/AiCreatureCombatProfile.cpp index cf2cb505..c27828d6 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiCreatureCombatProfile.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiCreatureCombatProfile.cpp @@ -136,9 +136,9 @@ void AiCreatureCombatProfileNamespace::loadCombatProfileTable(DataTable const & for (int i = 0; i < serverObjectCount; ++i) { ServerObject * const serverObject = ServerWorld::getObject(i); - CreatureObject * const creatureObject = (serverObject != NULL) ? serverObject->asCreatureObject() : NULL; + CreatureObject * const creatureObject = (serverObject != nullptr) ? serverObject->asCreatureObject() : nullptr; - if ( (creatureObject != NULL) + if ( (creatureObject != nullptr) && !creatureObject->isPlayerControlled()) { creatureObject->makeDead(NetworkId::cms_invalid, NetworkId::cms_invalid); @@ -228,7 +228,7 @@ void AiCreatureCombatProfileNamespace::grantActions(CreatureObject & owner, AiCr // ---------------------------------------------------------------------- AiCreatureCombatProfile::AiCreatureCombatProfile() - : m_profileId(NULL) + : m_profileId(nullptr) , m_singleUseActionList() , m_delayRepeatActionList() , m_instantRepeatActionList() @@ -247,7 +247,7 @@ void AiCreatureCombatProfile::install() bool const openIfNotFound = true; DataTable * const dataTable = DataTableManager::getTable(s_combatProfileTable, openIfNotFound); - if (dataTable != NULL) + if (dataTable != nullptr) { #ifdef _DEBUG DataTableManager::addReloadCallback(s_combatProfileTable, &loadCombatProfileTable); @@ -267,7 +267,7 @@ void AiCreatureCombatProfile::install() // ---------------------------------------------------------------------- AiCreatureCombatProfile const * AiCreatureCombatProfile::getCombatProfile(CrcString const & profileName) { - AiCreatureCombatProfile const * result = NULL; + AiCreatureCombatProfile const * result = nullptr; CombatProfileMap::const_iterator iterCombatProfileMap = s_combatProfileMap.find(PersistentCrcString(profileName)); if (iterCombatProfileMap != s_combatProfileMap.end()) diff --git a/engine/server/library/serverGame/src/shared/ai/AiCreatureData.cpp b/engine/server/library/serverGame/src/shared/ai/AiCreatureData.cpp index 034f9980..3d90a5f7 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiCreatureData.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiCreatureData.cpp @@ -46,7 +46,7 @@ namespace AiCreatureDataNamespace CreatureDataMap s_creatureDataMap; WeaponDataMap s_weaponDataMap; - AiCreatureData const * s_defaultCreatureData = NULL; + AiCreatureData const * s_defaultCreatureData = nullptr; int s_creatureErrorCount = 0; int s_weaponErrorCount = 0; @@ -154,7 +154,7 @@ void AiCreatureDataNamespace::verifySecondaryWeapon(CrcString const & creatureNa void AiCreatureDataNamespace::verifyPrimarySpecials(CrcString const & creatureName, CrcString & primarySpecials) { if ( !primarySpecials.isEmpty() - && (AiCreatureCombatProfile::getCombatProfile(primarySpecials) == NULL)) + && (AiCreatureCombatProfile::getCombatProfile(primarySpecials) == nullptr)) { ++s_creatureErrorCount; WARNING(true, ("AiCreatureData::verifyPrimarySpecials() Creature(%s) has invalid primary_weapon_specials(%s)", creatureName.getString(), primarySpecials.getString())); @@ -165,7 +165,7 @@ void AiCreatureDataNamespace::verifyPrimarySpecials(CrcString const & creatureNa void AiCreatureDataNamespace::verifySecondarySpecials(CrcString const & creatureName, CrcString & secondarySpecials) { if ( !secondarySpecials.isEmpty() - && (AiCreatureCombatProfile::getCombatProfile(secondarySpecials) == NULL)) + && (AiCreatureCombatProfile::getCombatProfile(secondarySpecials) == nullptr)) { ++s_creatureErrorCount; WARNING(true, ("AiCreatureData::verifySecondarySpecials() Creature(%s) has invalid secondary_weapon_specials(%s)", creatureName.getString(), secondarySpecials.getString())); @@ -320,7 +320,7 @@ void AiCreatureDataNamespace::loadWeaponColumn(WeaponList & weaponList, std::str // ---------------------------------------------------------------------- AiCreatureData::AiCreatureData() - : m_name(NULL) + : m_name(nullptr) , m_movementSpeedPercent(1.0f) , m_primaryWeapon() , m_secondaryWeapon() @@ -348,7 +348,7 @@ void AiCreatureData::install() bool const openIfNotFound = true; DataTable * const dataTable = DataTableManager::getTable(s_weaponDataTable, openIfNotFound); - if (dataTable != NULL) + if (dataTable != nullptr) { DataTableManager::addReloadCallback(s_weaponDataTable, &loadWeaponData); loadWeaponData(*dataTable); @@ -366,7 +366,7 @@ void AiCreatureData::install() bool const openIfNotFound = true; DataTable * const dataTable = DataTableManager::getTable(s_creaureDataTable, openIfNotFound); - if (dataTable != NULL) + if (dataTable != nullptr) { DataTableManager::addReloadCallback(s_creaureDataTable, &loadCreatureData); loadCreatureData(*dataTable); diff --git a/engine/server/library/serverGame/src/shared/ai/AiCreatureWeaponActions.cpp b/engine/server/library/serverGame/src/shared/ai/AiCreatureWeaponActions.cpp index 781bc2f1..4d5498f8 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiCreatureWeaponActions.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiCreatureWeaponActions.cpp @@ -58,7 +58,7 @@ AiCreatureWeaponActions::AiCreatureWeaponActions() : m_singleUseActionList() , m_delayRepeatActionList() , m_instantRepeatActionList() - , m_combatProfile(NULL) + , m_combatProfile(nullptr) { } @@ -81,7 +81,7 @@ void AiCreatureWeaponActions::setCombatProfile(CreatureObject & owner, AiCreatur // ---------------------------------------------------------------------- void AiCreatureWeaponActions::reset() { - if (m_combatProfile != NULL) + if (m_combatProfile != nullptr) { resetActionTimers(m_singleUseActionList, m_combatProfile->m_singleUseActionList); resetActionTimers(m_delayRepeatActionList, m_combatProfile->m_delayRepeatActionList); @@ -92,9 +92,9 @@ void AiCreatureWeaponActions::reset() // ---------------------------------------------------------------------- PersistentCrcString const & AiCreatureWeaponActions::getCombatAction() { - // If the combat profile is NULL, then the AI has no special actions assigned + // If the combat profile is nullptr, then the AI has no special actions assigned - if (m_combatProfile != NULL) + if (m_combatProfile != nullptr) { time_t const osTime = Os::getRealSystemTime(); diff --git a/engine/server/library/serverGame/src/shared/ai/AiMovementArchive.cpp b/engine/server/library/serverGame/src/shared/ai/AiMovementArchive.cpp index 723b8c7e..e1508bf4 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiMovementArchive.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiMovementArchive.cpp @@ -34,12 +34,12 @@ namespace Archive get(source, target.m_objectId); get(source, movementType); - AICreatureController * controller = NULL; + AICreatureController * controller = nullptr; Object * object = NetworkIdManager::getObjectById(target.getObjectId()); - if (object != NULL) + if (object != nullptr) controller = dynamic_cast(object->getController()); - if (controller == NULL) + if (controller == nullptr) { WARNING(true, ("AiMovementMessage Archive::get, got message to object %s that doesn't have an AICreatureController", target.getObjectId().getValueString().c_str())); target.m_movement = AiMovementBaseNullPtr; diff --git a/engine/server/library/serverGame/src/shared/ai/AiMovementBase.cpp b/engine/server/library/serverGame/src/shared/ai/AiMovementBase.cpp index dde28a05..79f1e119 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiMovementBase.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiMovementBase.cpp @@ -30,9 +30,9 @@ AiMovementBase::AiMovementBase( AICreatureController * controller ) : m_controller( controller ), - m_stateFunction( NULL ), + m_stateFunction( nullptr ), m_stateName(), - m_pendingFunction( NULL ), + m_pendingFunction( nullptr ), m_pendingName() { } @@ -41,9 +41,9 @@ AiMovementBase::AiMovementBase( AICreatureController * controller ) AiMovementBase::AiMovementBase( AICreatureController * controller, Archive::ReadIterator & source ) : m_controller( controller ), - m_stateFunction( NULL ), + m_stateFunction( nullptr ), m_stateName(), - m_pendingFunction( NULL ), + m_pendingFunction( nullptr ), m_pendingName() { // !!! @@ -177,7 +177,7 @@ void AiMovementBase::applyStateChange ( void ) m_stateFunction = m_pendingFunction; m_stateName = m_pendingName; - m_pendingFunction = NULL; + m_pendingFunction = nullptr; m_pendingName.clear(); } } @@ -249,49 +249,49 @@ char const * AiMovementBase::getMovementString(AiMovementType const aiMovementTy // ---------------------------------------------------------------------- AiMovementSwarm * AiMovementBase::asAiMovementSwarm() { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- AiMovementFace * AiMovementBase::asAiMovementFace() { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- AiMovementFlee * AiMovementBase::asAiMovementFlee() { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- AiMovementFollow * AiMovementBase::asAiMovementFollow() { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- AiMovementLoiter * AiMovementBase::asAiMovementLoiter() { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- AiMovementMove * AiMovementBase::asAiMovementMove() { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- AiMovementPatrol * AiMovementBase::asAiMovementPatrol() { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- AiMovementWander * AiMovementBase::asAiMovementWander() { - return NULL; + return nullptr; } // ====================================================================== diff --git a/engine/server/library/serverGame/src/shared/ai/AiMovementLoiter.cpp b/engine/server/library/serverGame/src/shared/ai/AiMovementLoiter.cpp index 8e4e5a2d..e8e0f5c4 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiMovementLoiter.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiMovementLoiter.cpp @@ -67,9 +67,9 @@ Vector AiMovementLoiterNamespace::getRandomLoiterPosition_p(Vector const anchorP bool AiMovementLoiterNamespace::isPositionOnFloor(Floor const * const floor, Vector const & position_p, float const radius, Vector & floorPosition_p) { bool result = false; - FloorMesh const * const floorMesh = (floor != NULL) ? floor->getFloorMesh() : NULL; + FloorMesh const * const floorMesh = (floor != nullptr) ? floor->getFloorMesh() : nullptr; - if (floorMesh != NULL) + if (floorMesh != nullptr) { // See if the circle fits entirely on the floor { @@ -199,7 +199,7 @@ AiMovementLoiter::AiMovementLoiter( AICreatureController * controller, Archive:: AiMovementLoiter::~AiMovementLoiter() { delete m_cachedAiLocations; - m_cachedAiLocations = NULL; + m_cachedAiLocations = nullptr; } // ---------------------------------------------------------------------- @@ -420,7 +420,7 @@ bool AiMovementLoiter::generateWaypoint() Floor const * const ownerFloor = CollisionWorld::getFloorStandingOn(*creatureOwner); - if (ownerFloor != NULL) + if (ownerFloor != nullptr) { // The owner is standing on a floor @@ -476,7 +476,7 @@ bool AiMovementLoiter::generateWaypoint() TerrainObject const * const terrainObject = TerrainObject::getConstInstance(); - if ( (terrainObject != NULL) + if ( (terrainObject != nullptr) && terrainObject->isPassable(randomPosition_p)) { // Snap the random position to the terrain @@ -518,7 +518,7 @@ bool AiMovementLoiter::generateWaypoint() { BaseExtent const * const extent = collisionProperty->getExtent_l(); - if (extent != NULL) + if (extent != nullptr) { Vector const begin_o(object.rotateTranslate_w2o(m_anchor.getPosition_p())); Vector const end_o(object.rotateTranslate_w2o(randomPosition_p)); @@ -580,7 +580,7 @@ void AiMovementLoiter::addDebug(AiDebugString & aiDebugString) AiMovementWaypoint::addDebug(aiDebugString); FormattedString<512> fs; - aiDebugString.addText(fs.sprintf("LOITER %s\n%s\ndist[%.0f...%.0f]\ndelay[%.1f...%.1f]\n", (m_anchor.getObject() != NULL) ? "TARGET" : "POSITION", m_stateName.c_str(), m_minDistance, m_maxDistance, m_minDelay, m_maxDelay), PackedRgb::solidCyan); + aiDebugString.addText(fs.sprintf("LOITER %s\n%s\ndist[%.0f...%.0f]\ndelay[%.1f...%.1f]\n", (m_anchor.getObject() != nullptr) ? "TARGET" : "POSITION", m_stateName.c_str(), m_minDistance, m_maxDistance, m_minDelay, m_maxDelay), PackedRgb::solidCyan); //if (m_bubbleCheckResult == BCR_invalid) //{ @@ -599,7 +599,7 @@ void AiMovementLoiter::addDebug(AiDebugString & aiDebugString) { Object const * const anchorObject = m_anchor.getObject(); - if (anchorObject != NULL) + if (anchorObject != nullptr) { // We are anchored to a moving target @@ -659,7 +659,7 @@ bool AiMovementLoiter::isAnchorValid() const { TangibleObject const * const tangibleObject = TangibleObject::asTangibleObject(m_anchor.getObject()); - if (tangibleObject != NULL) + if (tangibleObject != nullptr) { if (tangibleObject->isInCombat()) { diff --git a/engine/server/library/serverGame/src/shared/ai/AiMovementMove.cpp b/engine/server/library/serverGame/src/shared/ai/AiMovementMove.cpp index 9641e7e3..71b6b193 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiMovementMove.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiMovementMove.cpp @@ -85,7 +85,7 @@ AiMovementMove::AiMovementMove( AICreatureController * controller, Archive::Read AiMovementMove::~AiMovementMove() { delete m_pathBuilder; - m_pathBuilder = NULL; + m_pathBuilder = nullptr; } // ---------------------------------------------------------------------- @@ -151,7 +151,7 @@ void AiMovementMove::refresh( void ) m_target = target; m_targetName = targetName; - if (m_controller != NULL) + if (m_controller != nullptr) m_start = AiLocation(m_controller->getCreatureCell(), m_controller->getCreaturePosition_p()); CHANGE_STATE( AiMovementMove::stateWaiting ); } diff --git a/engine/server/library/serverGame/src/shared/ai/AiMovementPathFollow.cpp b/engine/server/library/serverGame/src/shared/ai/AiMovementPathFollow.cpp index 2105c898..34ab1e1f 100644 --- a/engine/server/library/serverGame/src/shared/ai/AiMovementPathFollow.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiMovementPathFollow.cpp @@ -73,7 +73,7 @@ AiMovementPathFollow::AiMovementPathFollow( AICreatureController * controller, A : AiMovementWaypoint( controller, source ), m_path( new AiPath() ) { - if (m_path != NULL) + if (m_path != nullptr) Archive::get(source, *m_path); } @@ -84,7 +84,7 @@ AiMovementPathFollow::~AiMovementPathFollow() clearPath(); delete m_path; - m_path = NULL; + m_path = nullptr; } // ---------------------------------------------------------------------- @@ -92,7 +92,7 @@ AiMovementPathFollow::~AiMovementPathFollow() void AiMovementPathFollow::pack( Archive::ByteStream & target ) const { AiMovementWaypoint::pack(target); - if (m_path != NULL) + if (m_path != nullptr) Archive::put(target, *m_path); else Archive::put(target, static_cast(0)); @@ -288,7 +288,7 @@ AiPath const * AiMovementPathFollow::getPath ( void ) const void AiMovementPathFollow::swapPath ( AiPath * newPath ) { - if(newPath == NULL) return; + if(newPath == nullptr) return; AiPath::iterator it; diff --git a/engine/server/library/serverGame/src/shared/ai/AiMovementPatrol.cpp b/engine/server/library/serverGame/src/shared/ai/AiMovementPatrol.cpp index 4ea6a593..c4c73b88 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiMovementPatrol.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiMovementPatrol.cpp @@ -60,7 +60,7 @@ AiMovementPatrol::AiMovementPatrol( AICreatureController * controller, std::vect m_patrolPointIndex(startPoint) { ServerObject * owner = safe_cast(controller->getOwner()); - if (owner != NULL) + if (owner != nullptr) { DEBUG_REPORT_LOG(ConfigServerGame::isAiLoggingEnabled(), ("AiMovementPatrol creating named path for %s\n", owner->getNetworkId().getValueString().c_str())); @@ -98,7 +98,7 @@ AiMovementPatrol::AiMovementPatrol( AICreatureController * controller, std::vect { const Unicode::String & pointName = *i; const CityPathNode * node = CityPathGraphManager::getNamedNodeFor(*owner, pointName); - if (node != NULL) + if (node != nullptr) { m_patrolPath.push_back(AiLocation(node->getSourceId())); } @@ -118,16 +118,16 @@ AiMovementPatrol::AiMovementPatrol( AICreatureController * controller, std::vect // try an find a node on the path that is a previous root node, or isn't // being used in any other path std::vector::iterator i; - const ServerObject * node = NULL; - const ServerObject * root = NULL; + const ServerObject * node = nullptr; + const ServerObject * root = nullptr; for (i = m_patrolPath.begin(); i != m_patrolPath.end(); ++i) { node = safe_cast(i->getObject()); - if (node != NULL) + if (node != nullptr) { if (node->isPatrolPathRoot()) { - if (root == NULL || !root->isPatrolPathRoot()) + if (root == nullptr || !root->isPatrolPathRoot()) { // if we already have a set up root node, use that root = node; @@ -135,18 +135,18 @@ AiMovementPatrol::AiMovementPatrol( AICreatureController * controller, std::vect else { // we've got two previous root nodes, we can't connect them - root = NULL; + root = nullptr; break; } } - else if (!node->isPatrolPathNode() && root == NULL) + else if (!node->isPatrolPathNode() && root == nullptr) { // found a free node root = node; } } } - if (root != NULL) + if (root != nullptr) { // set up the root node if (!root->isPatrolPathRoot()) @@ -156,7 +156,7 @@ AiMovementPatrol::AiMovementPatrol( AICreatureController * controller, std::vect for (i = m_patrolPath.begin(); i != m_patrolPath.end(); ++i) { node = safe_cast(i->getObject()); - if (node != NULL && node != root) + if (node != nullptr && node != root) const_cast(node)->setPatrolPathRoot(*root); } const_cast(root)->addPatrolPathingObject(*owner); @@ -167,7 +167,7 @@ AiMovementPatrol::AiMovementPatrol( AICreatureController * controller, std::vect for (i = m_patrolPath.begin(); i != m_patrolPath.end(); ++i) { node = safe_cast(i->getObject()); - if (node != NULL) + if (node != nullptr) nodes += node->getNetworkId().getValueString() + " "; } WARNING(true, ("AiMovementPatrol unable to find root node for path: %s", nodes.c_str())); @@ -266,15 +266,15 @@ void AiMovementPatrol::getDebugInfo ( std::string & outString ) const void AiMovementPatrol::endBehavior() { - if (!m_patrolPath.empty() && m_controller != NULL) + if (!m_patrolPath.empty() && m_controller != nullptr) { const ServerObject * owner = safe_cast(m_controller->getOwner()); - if (owner != NULL) + if (owner != nullptr) { for (std::vector::iterator i = m_patrolPath.begin(); i != m_patrolPath.end(); ++i) { const ServerObject * node = safe_cast(i->getObject()); - if (node != NULL && node->isPatrolPathRoot()) + if (node != nullptr && node->isPatrolPathRoot()) { const_cast(node)->removePatrolPathingObject(*owner); break; @@ -304,7 +304,7 @@ bool AiMovementPatrol::getHibernateOk() const if (!m_patrolPath.empty()) { const ServerObject * node = safe_cast(m_patrolPath.front().getObject()); - if (node != NULL) + if (node != nullptr) { return node->getPatrolPathObservers() == 0; } diff --git a/engine/server/library/serverGame/src/shared/ai/AiMovementSwarm.cpp b/engine/server/library/serverGame/src/shared/ai/AiMovementSwarm.cpp index 52a3e701..f9593a06 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiMovementSwarm.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiMovementSwarm.cpp @@ -104,10 +104,10 @@ void AiMovementSwarm::alter ( float time ) } // update the offset from our target we want to go to - if (m_target.getObject() != NULL) + if (m_target.getObject() != nullptr) { const CreatureObject * owner = m_controller->getCreature(); - if (owner != NULL) + if (owner != nullptr) { offsetMap::const_iterator found = s_offsetMap.find(CachedNetworkId(*owner)); if (found != s_offsetMap.end()) @@ -179,7 +179,7 @@ AiStateResult AiMovementSwarm::triggerWaiting() { // note: don't use the m_target position function, because it includes the offset position const Object * target = m_target.getObject(); - if (target != NULL) + if (target != nullptr) m_controller->turnToward(target->getParentCell(), target->getPosition_p()); return AiMovementFollow::triggerWaiting(); } @@ -196,7 +196,7 @@ void AiMovementSwarm::init() const CreatureObject * creatureOwner = m_controller->getCreature(); const CreatureObject * creatureTarget = CreatureObject::asCreatureObject(m_target.getObject()); - if (creatureOwner != NULL && creatureTarget != NULL) + if (creatureOwner != nullptr && creatureTarget != nullptr) { CreatureWatcher watchedCreature(creatureOwner); targetMap::iterator found = s_swarmMap.find(CachedNetworkId(*creatureTarget)); @@ -226,7 +226,7 @@ void AiMovementSwarm::cleanup() // note: using static_cast instead of safe_cast because the owner may be in the process of being destructed const CreatureObject * owner = static_cast(m_controller->getOwner()); const CreatureObject * target = static_cast(m_target.getObject()); - if (owner != NULL && target != NULL) + if (owner != nullptr && target != nullptr) { targetMap::iterator found = s_swarmMap.find(CachedNetworkId(*target)); if (found != s_swarmMap.end()) @@ -258,7 +258,7 @@ void AiMovementSwarm::computeGoals() for (targetMap::iterator i = s_swarmMap.begin(); i != s_swarmMap.end();) { const CreatureObject * target = CreatureObject::asCreatureObject((*i).first.getObject()); - if (target != NULL && !target->isDead()) + if (target != nullptr && !target->isDead()) { computeGoals(*target, (*i).second); if ((*i).second.empty()) @@ -294,16 +294,16 @@ void AiMovementSwarm::computeGoals(const CreatureObject & target, std::vectorgetController()); - if (controller != NULL) + if (controller != nullptr) swarmMovement = dynamic_cast(controller->getCurrentMovement()); } - if (mover == NULL || mover->isDead()) + if (mover == nullptr || mover->isDead()) { // dump the mover from our list --count; @@ -314,7 +314,7 @@ void AiMovementSwarm::computeGoals(const CreatureObject & target, std::vectorisDead()) + if (blocker == nullptr || blocker->isDead()) { continue; } @@ -361,7 +361,7 @@ void AiMovementSwarm::computeGoals(const CreatureObject & target, std::vectorasServerObject() != NULL) + if (o != nullptr && o->asServerObject() != nullptr) { // if the target is a player, don't hibernate if (o->asServerObject()->isPlayerControlled()) hibernate = false; // hibernate if who we're following is hibernating - else if (o->asServerObject()->asCreatureObject() != NULL) + else if (o->asServerObject()->asCreatureObject() != nullptr) hibernate = (safe_cast(o->getController()))->getHibernate(); } else @@ -114,7 +114,7 @@ static const AiMovementTarget * preventRecurse = NULL; // clean up recusion checkers if (preventRecurse == this) - preventRecurse = NULL; + preventRecurse = nullptr; --recursionCount; return hibernate; } diff --git a/engine/server/library/serverGame/src/shared/ai/AiMovementWanderInterior.cpp b/engine/server/library/serverGame/src/shared/ai/AiMovementWanderInterior.cpp index 24a4c66a..a5fe327d 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiMovementWanderInterior.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiMovementWanderInterior.cpp @@ -82,23 +82,23 @@ bool AiMovementWanderInterior::updateWaypoint ( void ) { CreatureObject const * creature = m_controller->getCreature(); - if(creature == NULL) return false; + if(creature == nullptr) return false; CellProperty const * cell = creature->getParentCell(); - if(cell == NULL) return false; + if(cell == nullptr) return false; Floor const * floor = cell->getFloor(); - if(floor == NULL) return false; + if(floor == nullptr) return false; FloorMesh const * floorMesh = floor->getFloorMesh(); - if(floorMesh == NULL) return false; + if(floorMesh == nullptr) return false; PathGraph const * graph = safe_cast(floorMesh->getPathGraph()); - if(graph == NULL) return false; + if(graph == nullptr) return false; // ---------- @@ -107,11 +107,11 @@ bool AiMovementWanderInterior::updateWaypoint ( void ) if(closestIndex == -2) { const CellObject *cellObject = dynamic_cast(&cell->getOwner()); - const BuildingObject *building = (cellObject ? cellObject->getOwnerBuilding() : NULL); + const BuildingObject *building = (cellObject ? cellObject->getOwnerBuilding() : nullptr); Vector creaturePosition = creature->getPosition_w(); LOG("building-data-error",("Building id=%s has no path data but creature id=%s at (x=%.2f,y=%.2f,z=%.2f) requires it for wandering, stopping behavior.", - (building ? building->getNetworkId().getValueString().c_str() : ""), + (building ? building->getNetworkId().getValueString().c_str() : ""), creature->getNetworkId().getValueString().c_str(), creaturePosition.x, creaturePosition.y, @@ -132,7 +132,7 @@ bool AiMovementWanderInterior::updateWaypoint ( void ) { PathNode const * closestNode = graph->getNode(closestIndex); - if(closestNode != NULL) + if(closestNode != nullptr) { m_target = AiLocation(m_controller->getCreatureCell(),closestNode->getPosition_p()); diff --git a/engine/server/library/serverGame/src/shared/ai/AiMovementWaypoint.cpp b/engine/server/library/serverGame/src/shared/ai/AiMovementWaypoint.cpp index 3b2b123e..c92d3100 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiMovementWaypoint.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiMovementWaypoint.cpp @@ -34,7 +34,7 @@ float computeMovementModifier (CreatureObject * const object) { if (!object) { - DEBUG_FATAL(true, ("object is NULL.")); + DEBUG_FATAL(true, ("object is nullptr.")); return 0.0f; } @@ -81,7 +81,7 @@ float computeMovementModifier (CreatureObject * const object) // if the creature has a slope effect property, see if it has a greater // (more negative) effect on the creature than the terrain const Property * property = object->getProperty(SlopeEffectProperty::getClassPropertyId()); - if (property != NULL) + if (property != nullptr) { // note we use the creature's base speed modifier, not the one modified by skills // (although for ai they're probably the same) diff --git a/engine/server/library/serverGame/src/shared/ai/AiTargetingSystem.cpp b/engine/server/library/serverGame/src/shared/ai/AiTargetingSystem.cpp index 2afac7bc..050263d3 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiTargetingSystem.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiTargetingSystem.cpp @@ -94,7 +94,7 @@ bool AiTargetingSystem::canAttackTarget(TangibleObject const * target) { bool result = false; - if (target != NULL) + if (target != nullptr) { if ( (m_owner.getDistanceBetweenCollisionSpheres_w(*target) <= ConfigServerGame::getMaxCombatRange()) && m_owner.checkLOSTo(*target)) diff --git a/engine/server/library/serverGame/src/shared/ai/Formation.cpp b/engine/server/library/serverGame/src/shared/ai/Formation.cpp index 713d9b00..415989a2 100755 --- a/engine/server/library/serverGame/src/shared/ai/Formation.cpp +++ b/engine/server/library/serverGame/src/shared/ai/Formation.cpp @@ -128,8 +128,8 @@ void Formation::build(Squad & squad) DEBUG_FATAL(squad.isEmpty(), ("Building a formation on an empty squad.")); Object const * const leaderObject = squad.getLeader().getObject(); - CollisionProperty const * const leaderCollisionProperty = (leaderObject != NULL) ? leaderObject->getCollisionProperty() : NULL; - float const leaderRadius = (leaderCollisionProperty != NULL) ? (leaderCollisionProperty->getBoundingSphere_l().getRadius() * 2.0f) : 1.0f; + CollisionProperty const * const leaderCollisionProperty = (leaderObject != nullptr) ? leaderObject->getCollisionProperty() : nullptr; + float const leaderRadius = (leaderCollisionProperty != nullptr) ? (leaderCollisionProperty->getBoundingSphere_l().getRadius() * 2.0f) : 1.0f; int slotIndex = 0; Squad::UnitMap const & unitSet = squad.getUnitMap(); diff --git a/engine/server/library/serverGame/src/shared/ai/HateList.cpp b/engine/server/library/serverGame/src/shared/ai/HateList.cpp index d57fc5cb..496fb2b9 100755 --- a/engine/server/library/serverGame/src/shared/ai/HateList.cpp +++ b/engine/server/library/serverGame/src/shared/ai/HateList.cpp @@ -41,8 +41,8 @@ // ---------------------------------------------------------------------- HateList::HateList() - : m_owner(NULL) - , m_playerObject(NULL) + : m_owner(nullptr) + , m_playerObject(nullptr) , m_hateList() , m_target(CachedNetworkId::cms_cachedInvalid) , m_maxHate(0.0f) @@ -56,8 +56,8 @@ HateList::HateList() HateList::~HateList() { clear(); - m_owner = NULL; - m_playerObject = NULL; + m_owner = nullptr; + m_playerObject = nullptr; } // ---------------------------------------------------------------------- @@ -119,7 +119,7 @@ bool HateList::addHate(NetworkId const & target, float const hate) // If a target AI has a master, the target and the master needs to be added to the hate list (ie. pets should cause their master to gain hate) { CreatureObject const * const targetCreatureObject = CreatureObject::asCreatureObject(targetObject); - NetworkId const & masterId = (targetCreatureObject != NULL) ? targetCreatureObject->getMasterId() : NetworkId::cms_invalid; + NetworkId const & masterId = (targetCreatureObject != nullptr) ? targetCreatureObject->getMasterId() : NetworkId::cms_invalid; if (masterId != NetworkId::cms_invalid) { @@ -274,7 +274,7 @@ bool HateList::removeTarget(NetworkId const & target) { AggroListProperty * const aggroList = AggroListProperty::getAggroListProperty(*m_owner); - if (aggroList != NULL) + if (aggroList != nullptr) { aggroList->addTarget(target); } @@ -301,7 +301,7 @@ bool HateList::isValidTarget(Object * const target) bool valid = true; TangibleObject * const targetTangibleObject = TangibleObject::asTangibleObject(target); - if (targetTangibleObject == NULL) + if (targetTangibleObject == nullptr) { LOGC(AiLogManager::isLogging(m_owner->getNetworkId()), "debug_ai", ("HateList::isValidTarget() owner(%s:%s) TARGET IS NOT A TANGIBLEOBJECT", m_owner->getNetworkId().getValueString().c_str(), FileNameUtils::get(m_owner->getDebugName(), FileNameUtils::fileName).c_str())); valid = false; @@ -334,7 +334,7 @@ bool HateList::isValidTarget(Object * const target) { CreatureObject const * const targetCreatureObject = targetTangibleObject->asCreatureObject(); - if (targetCreatureObject != NULL) + if (targetCreatureObject != nullptr) { if (targetTangibleObject->isDisabled()) { @@ -355,7 +355,7 @@ bool HateList::isValidTarget(Object * const target) { AICreatureController const * const targetAiCreatureController = AICreatureController::asAiCreatureController(targetCreatureObject->getController()); - if ( (targetAiCreatureController != NULL) + if ( (targetAiCreatureController != nullptr) && targetAiCreatureController->isRetreating()) { LOGC(AiLogManager::isLogging(m_owner->getNetworkId()), "debug_ai", ("HateList::isValidTarget() owner(%s:%s) TARGET IS RETREATING", m_owner->getNetworkId().getValueString().c_str(), FileNameUtils::get(m_owner->getDebugName(), FileNameUtils::fileName).c_str())); @@ -370,7 +370,7 @@ bool HateList::isValidTarget(Object * const target) // themselves towards the player so that they and the player // enter combat correctly. { - if ( (m_owner->asCreatureObject() != NULL) + if ( (m_owner->asCreatureObject() != nullptr) && !Pvp::canAttack(*m_owner, *targetTangibleObject)) { LOGC(AiLogManager::isLogging(m_owner->getNetworkId()), "debug_ai", ("HateList::isValidTarget() owner(%s:%s) PVP CAN'T ATTACK", m_owner->getNetworkId().getValueString().c_str(), FileNameUtils::get(m_owner->getDebugName(), FileNameUtils::fileName).c_str())); @@ -393,7 +393,7 @@ CachedNetworkId const & HateList::getTarget() const if ( (m_target.get() == CachedNetworkId::cms_cachedInvalid) && !isEmpty()) { - WARNING(true, ("HateList::getTarget() owner(%s) m_hateList.size(%u) m_target is NULL but the HateList is not empty.", m_owner->getDebugInformation().c_str(), m_hateList.size())); + WARNING(true, ("HateList::getTarget() owner(%s) m_hateList.size(%u) m_target is nullptr but the HateList is not empty.", m_owner->getDebugInformation().c_str(), m_hateList.size())); } #endif // _DEBUG @@ -458,7 +458,7 @@ void HateList::findNewTarget() for (; iterHateList != m_hateList.end(); ++iterHateList) { - if (iterHateList->first.getObject() == NULL) + if (iterHateList->first.getObject() == nullptr) { // This target will be removed in the next alter call continue; @@ -510,11 +510,11 @@ void HateList::setTarget(CachedNetworkId const & target, float const hate) #ifdef _DEBUG // We should only have tangible objects in our target list - if (m_target.get().getObject() != NULL) + if (m_target.get().getObject() != nullptr) { TangibleObject const * const targetTangibleObject = TangibleObject::asTangibleObject(m_target.get().getObject()->asServerObject()); - if (targetTangibleObject == NULL) + if (targetTangibleObject == nullptr) { WARNING(true, ("HateList::setTarget() owner(%s) How did we get a target(%s) that is not a TangibleObject", m_owner->getDebugInformation().c_str(), m_target.get().getObject()->getDebugInformation().c_str())); } @@ -559,7 +559,7 @@ void HateList::triggerTargetChanged(NetworkId const & target) { GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(m_owner); - if (gameScriptObject != NULL) + if (gameScriptObject != nullptr) { LOGC(AiLogManager::isLogging(m_owner->getNetworkId()), "debug_ai", ("HateList::triggerTargetChanged() owner(%s:%s) target(%s)", m_owner->getNetworkId().getValueString().c_str(), FileNameUtils::get(m_owner->getDebugName(), FileNameUtils::fileName).c_str(), target.getValueString().c_str())); @@ -578,7 +578,7 @@ void HateList::triggerTargetAdded(NetworkId const & target) { GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(m_owner); - if (gameScriptObject != NULL) + if (gameScriptObject != nullptr) { LOGC(AiLogManager::isLogging(m_owner->getNetworkId()), "debug_ai", ("HateList::triggerTargetAdded() owner(%s:%s) target(%s)", m_owner->getNetworkId().getValueString().c_str(), FileNameUtils::get(m_owner->getDebugName(), FileNameUtils::fileName).c_str(), target.getValueString().c_str())); @@ -597,7 +597,7 @@ void HateList::triggerTargetRemoved(NetworkId const & target) { GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(m_owner); - if (gameScriptObject != NULL) + if (gameScriptObject != nullptr) { LOGC(AiLogManager::isLogging(m_owner->getNetworkId()), "debug_ai", ("HateList::triggerTargetRemoved() owner(%s:%s) target(%s)", m_owner->getNetworkId().getValueString().c_str(), FileNameUtils::get(m_owner->getDebugName(), FileNameUtils::fileName).c_str(), target.getValueString().c_str())); @@ -628,7 +628,7 @@ int HateList::getAutoExpireTargetDuration() const bool HateList::isOwnerValid() const { CreatureObject const * const ownerCreature = CreatureObject::asCreatureObject(m_owner); - bool const ownerIncapacitated = (ownerCreature != NULL) ? ownerCreature->isIncapacitated() : false; + bool const ownerIncapacitated = (ownerCreature != nullptr) ? ownerCreature->isIncapacitated() : false; if (ownerIncapacitated) { @@ -636,7 +636,7 @@ bool HateList::isOwnerValid() const return false; } - bool const ownerDead = (ownerCreature != NULL) ? ownerCreature->isDead() : false; + bool const ownerDead = (ownerCreature != nullptr) ? ownerCreature->isDead() : false; if (ownerDead) { @@ -644,7 +644,7 @@ bool HateList::isOwnerValid() const return false; } - bool const ownerDisabled = (ownerCreature != NULL) ? ownerCreature->isDisabled() : false; + bool const ownerDisabled = (ownerCreature != nullptr) ? ownerCreature->isDisabled() : false; if (ownerDisabled) { @@ -653,7 +653,7 @@ bool HateList::isOwnerValid() const } AICreatureController const * const ownerAiCreatureController = AICreatureController::asAiCreatureController(m_owner->getController()); - const bool ownerRetreating = (ownerAiCreatureController != NULL) ? ownerAiCreatureController->isRetreating() : false; + const bool ownerRetreating = (ownerAiCreatureController != nullptr) ? ownerAiCreatureController->isRetreating() : false; if (ownerRetreating) { @@ -752,11 +752,11 @@ void HateList::forceHateTarget(const NetworkId &target) #ifdef _DEBUG // We should only have tangible objects in our target list - if (m_target.get().getObject() != NULL) + if (m_target.get().getObject() != nullptr) { TangibleObject const * const targetTangibleObject = TangibleObject::asTangibleObject(m_target.get().getObject()->asServerObject()); - if (targetTangibleObject == NULL) + if (targetTangibleObject == nullptr) { WARNING(true, ("HateList::setTarget() owner(%s) How did we get a target(%s) that is not a TangibleObject", m_owner->getDebugInformation().c_str(), m_target.get().getObject()->getDebugInformation().c_str())); } diff --git a/engine/server/library/serverGame/src/shared/ai/HateList.h b/engine/server/library/serverGame/src/shared/ai/HateList.h index c4f1b761..38a3a685 100755 --- a/engine/server/library/serverGame/src/shared/ai/HateList.h +++ b/engine/server/library/serverGame/src/shared/ai/HateList.h @@ -99,7 +99,7 @@ private: inline bool HateList::isOwnerPlayer() const { - return (m_playerObject != NULL); + return (m_playerObject != nullptr); } // ====================================================================== diff --git a/engine/server/library/serverGame/src/shared/ai/Squad.cpp b/engine/server/library/serverGame/src/shared/ai/Squad.cpp index caced74f..b4a23b20 100755 --- a/engine/server/library/serverGame/src/shared/ai/Squad.cpp +++ b/engine/server/library/serverGame/src/shared/ai/Squad.cpp @@ -380,7 +380,7 @@ void Squad::buildFormation() { NetworkId const & unit = iterUnitMap->first; PersistentCrcString const * unitName = iterUnitMap->second; - DEBUG_FATAL((unitName == NULL), ("The unit should have a non-null name.")); + DEBUG_FATAL((unitName == nullptr), ("The unit should have a non-nullptr name.")); if (unit == m_leader) { @@ -401,7 +401,7 @@ void Squad::buildFormation() #ifdef DEBUG Object * const unitObject = NetworkIdManager::getObjectById(unit); DEBUG_WARNING(true, ("className(%s) Unable to find the ship(%s) [%s] in the formation priority list.", - getClassName(), unitName->getString(), unitObject ? unitObject->getDebugInformation().c_str() : "NULL")); + getClassName(), unitName->getString(), unitObject ? unitObject->getDebugInformation().c_str() : "nullptr")); #endif } @@ -463,7 +463,7 @@ void Squad::calculateSquadPosition_w() Object * const object = NetworkIdManager::getObjectById(unit); - if (object != NULL) + if (object != nullptr) { m_squadPosition_w += object->getPosition_w(); } diff --git a/engine/server/library/serverGame/src/shared/behavior/AiCreatureStateArchive.cpp b/engine/server/library/serverGame/src/shared/behavior/AiCreatureStateArchive.cpp index 08bba97e..b6c5690b 100755 --- a/engine/server/library/serverGame/src/shared/behavior/AiCreatureStateArchive.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/AiCreatureStateArchive.cpp @@ -28,15 +28,15 @@ namespace Archive #ifdef _DEBUG Object * const object = NetworkIdManager::getObjectById(target.m_networkId); - if (object == NULL) + if (object == nullptr) { WARNING(true, ("AiCreatureStateArchive::get() Unable to resolve networkId(%s) to an Object", target.m_networkId.getValueString().c_str())); return; } - AICreatureController * const controller = (object != NULL) ? AICreatureController::asAiCreatureController(object->getController()) : NULL; + AICreatureController * const controller = (object != nullptr) ? AICreatureController::asAiCreatureController(object->getController()) : nullptr; - if (controller == NULL) + if (controller == nullptr) { WARNING(true, ("AiCreatureStateArchive::get() Message to object(%s) that does not have an AICreatureController", object->getDebugInformation().c_str())); return; diff --git a/engine/server/library/serverGame/src/shared/behavior/AiLocation.cpp b/engine/server/library/serverGame/src/shared/behavior/AiLocation.cpp index 885657b9..d73f1f43 100755 --- a/engine/server/library/serverGame/src/shared/behavior/AiLocation.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/AiLocation.cpp @@ -43,9 +43,9 @@ namespace AiLocationArchive AiLocation::AiLocation ( void ) : m_valid(false), m_attached(false), - m_object(NULL), + m_object(nullptr), m_objectId(), - m_cellObject(NULL), + m_cellObject(nullptr), m_position_p(Vector::zero), m_position_w(Vector::zero), m_radius(0.0f), @@ -60,9 +60,9 @@ AiLocation::AiLocation ( void ) AiLocation::AiLocation ( CellProperty const * cell, Vector const & position, float radius ) : m_valid(true), m_attached(false), - m_object(NULL), + m_object(nullptr), m_objectId(), - m_cellObject(cell ? &cell->getOwner() : NULL), + m_cellObject(cell ? &cell->getOwner() : nullptr), m_position_p(position), m_position_w(CollisionUtils::transformToWorld(cell,position)), m_radius(radius), @@ -78,9 +78,9 @@ AiLocation::AiLocation ( CellProperty const * cell, Vector const & position, flo AiLocation::AiLocation ( NetworkId const & cellId, Vector const & position, float radius ) : m_valid(true), m_attached(false), - m_object(NULL), + m_object(nullptr), m_objectId(), - m_cellObject(NULL), + m_cellObject(nullptr), m_position_p(position), m_position_w(position), m_radius(radius), @@ -110,9 +110,9 @@ AiLocation::AiLocation ( NetworkId const & cellId, Vector const & position, floa AiLocation::AiLocation ( Object const * object ) : m_valid(true), m_attached(true), - m_object(NULL), + m_object(nullptr), m_objectId(), - m_cellObject(NULL), + m_cellObject(nullptr), m_position_p(Vector::zero), m_position_w(Vector::zero), m_radius(0.0f), @@ -129,9 +129,9 @@ AiLocation::AiLocation ( Object const * object ) AiLocation::AiLocation ( NetworkId const & objectId ) : m_valid(true), m_attached(true), - m_object(NULL), + m_object(nullptr), m_objectId(), - m_cellObject(NULL), + m_cellObject(nullptr), m_position_p(Vector::zero), m_position_w(Vector::zero), m_radius(0.0f), @@ -148,9 +148,9 @@ AiLocation::AiLocation ( NetworkId const & objectId ) AiLocation::AiLocation ( Object const * object, Vector const & offset, bool relativeOffset ) : m_valid(true), m_attached(true), - m_object(NULL), + m_object(nullptr), m_objectId(), - m_cellObject(NULL), + m_cellObject(nullptr), m_position_p(Vector::zero), m_position_w(Vector::zero), m_radius(0.0f), @@ -167,9 +167,9 @@ AiLocation::AiLocation ( Object const * object, Vector const & offset, bool rela AiLocation::AiLocation ( NetworkId const & objectId, Vector const & offset, bool relativeOffset ) : m_valid(true), m_attached(true), - m_object(NULL), + m_object(nullptr), m_objectId(), - m_cellObject(NULL), + m_cellObject(nullptr), m_position_p(Vector::zero), m_position_w(Vector::zero), m_radius(0.0f), @@ -365,7 +365,7 @@ void AiLocation::setObject ( Object const * object ) { if(m_attached) { - if (object == NULL) + if (object == nullptr) { clear(); return; @@ -385,7 +385,7 @@ void AiLocation::setObject ( Object const * object ) void AiLocation::detach ( void ) { - m_object = NULL; + m_object = nullptr; m_objectId = NetworkId::cms_invalid; m_attached = false; } @@ -394,7 +394,7 @@ void AiLocation::detach ( void ) CellProperty const * AiLocation::getCell ( void ) const { - return m_cellObject ? m_cellObject->getCellProperty() : NULL; + return m_cellObject ? m_cellObject->getCellProperty() : nullptr; } // ---------- @@ -424,7 +424,7 @@ bool AiLocation::hasChanged ( void ) const Vector AiLocation::getPosition_p ( void ) const { - if(m_cellObject.getPointer() == NULL) + if(m_cellObject.getPointer() == nullptr) { WARNING(ConfigServerGame::getReportAiWarnings(),("AiLocation::getPosition_p - Locations's parent cell has disappeared\n")); @@ -572,8 +572,8 @@ void AiLocation::clear ( void ) m_valid = false; m_attached = false; - m_object = NULL; - m_cellObject = NULL; + m_object = nullptr; + m_cellObject = nullptr; m_position_p = Vector::zero; m_radius = 0.0f; m_offset_p = Vector::zero; @@ -585,7 +585,7 @@ void AiLocation::clear ( void ) bool AiLocation::isInWorldCell ( void ) const { - return isValid() && ( (getCell() == NULL) || (getCell() == CellProperty::getWorldCellProperty()) ); + return isValid() && ( (getCell() == nullptr) || (getCell() == CellProperty::getWorldCellProperty()) ); } @@ -599,7 +599,7 @@ bool AiLocation::validate ( void ) const TerrainObject * terrain = TerrainObject::getInstance(); - if(terrain == NULL) return true; + if(terrain == nullptr) return true; float w = terrain->getMapWidthInMeters() / 2.0f; diff --git a/engine/server/library/serverGame/src/shared/behavior/AiShipAttackTargetList.cpp b/engine/server/library/serverGame/src/shared/behavior/AiShipAttackTargetList.cpp index 08958488..9af5e0c8 100755 --- a/engine/server/library/serverGame/src/shared/behavior/AiShipAttackTargetList.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/AiShipAttackTargetList.cpp @@ -159,7 +159,7 @@ void AiShipAttackTargetList::add(ShipObject & unit, float const damage) AiShipController * const ownerAiShipController = AiShipController::asAiShipController(m_owner->getController()); - if (ownerAiShipController != NULL) + if (ownerAiShipController != nullptr) { if (!ownerAiShipController->isValidTarget(unit)) { @@ -204,7 +204,7 @@ void AiShipAttackTargetList::add(ShipObject & unit, float const damage) ShipController * const attackingUnitShipController = unit.getController()->asShipController(); - if (attackingUnitShipController != NULL) + if (attackingUnitShipController != nullptr) { attackingUnitShipController->addAiTargetingMe(m_owner->getNetworkId()); } @@ -217,7 +217,7 @@ void AiShipAttackTargetList::add(ShipObject & unit, float const damage) // ---------------------------------------------------------------------- bool AiShipAttackTargetList::remove(NetworkId const & unit, bool const inDestructorHack) { - DEBUG_FATAL((unit == NetworkId::cms_invalid), ("Removing a NULL unit")); + DEBUG_FATAL((unit == NetworkId::cms_invalid), ("Removing a nullptr unit")); bool result = false; @@ -238,11 +238,11 @@ bool AiShipAttackTargetList::remove(NetworkId const & unit, bool const inDestruc // Tell this unit that we are no longer targeting it - if (object != NULL) + if (object != nullptr) { ShipController * const shipController = object->getController()->asShipController(); - if (shipController != NULL) + if (shipController != nullptr) { shipController->removeAiTargetingMe(m_owner->getNetworkId()); } @@ -398,12 +398,12 @@ void AiShipAttackTargetList::findNewPrimaryTarget() // We should only have ship objects in our target list - if (m_primaryTarget.getObject() != NULL) + if (m_primaryTarget.getObject() != nullptr) { ServerObject * const targetServerObject = m_primaryTarget.getObject()->asServerObject(); - ShipObject * const targetShipObject = (targetServerObject != NULL) ? targetServerObject->asShipObject() : NULL; + ShipObject * const targetShipObject = (targetServerObject != nullptr) ? targetServerObject->asShipObject() : nullptr; - if (targetShipObject == NULL) + if (targetShipObject == nullptr) { DEBUG_WARNING(true, ("debug_ai: AiShipAttackTargetList::findNewPrimaryTarget() ERROR: How did we get a target that is not a ShipObject (%s)", m_primaryTarget.getObject()->getDebugInformation().c_str())); } @@ -444,7 +444,7 @@ void AiShipAttackTargetList::verify() AiShipController * const ownerAiShipController = AiShipController::asAiShipController(m_owner->getController()); - if (ownerAiShipController != NULL) + if (ownerAiShipController != nullptr) { if (ownerAiShipController->hasExclusiveAggros()) { @@ -457,9 +457,9 @@ void AiShipAttackTargetList::verify() for (; iterTargetList != m_targetList->end(); ++iterTargetList) { ShipObject * const unitShipObject = ShipObject::asShipObject(iterTargetList->first.getObject()); - CreatureObject const * const unitPilot = (unitShipObject != NULL) ? unitShipObject->getPilot() : NULL; + CreatureObject const * const unitPilot = (unitShipObject != nullptr) ? unitShipObject->getPilot() : nullptr; - if ( (unitPilot == NULL) + if ( (unitPilot == nullptr) || !ownerAiShipController->isExclusiveAggro(*unitPilot)) { s_purgeList.push_back(unitShipObject->getNetworkId()); diff --git a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackBomber.cpp b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackBomber.cpp index 239342d3..58e90c58 100755 --- a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackBomber.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackBomber.cpp @@ -56,7 +56,7 @@ AiShipBehaviorAttackBomber::AiShipBehaviorAttackBomber(AiShipController & aiShip m_evadeChangeDirectionTimer(0.5f), m_missilesFired(0) { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackBomber::AiShipBehaviorAttackBomber() unit(%s)", (aiShipController.getOwner() != NULL) ? aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner")); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackBomber::AiShipBehaviorAttackBomber() unit(%s)", (aiShipController.getOwner() != nullptr) ? aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner")); } // ---------------------------------------------------------------------- @@ -73,7 +73,7 @@ AiShipBehaviorAttackBomber::AiShipBehaviorAttackBomber(AiShipBehaviorAttack cons m_evadeChangeDirectionTimer(0.5f), m_missilesFired(0) { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackBomber::AiShipBehaviorAttackBomber(AiShipBehaviorAttack &) unit(%s)", (m_aiShipController.getOwner() != NULL) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner")); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackBomber::AiShipBehaviorAttackBomber(AiShipBehaviorAttack &) unit(%s)", (m_aiShipController.getOwner() != nullptr) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner")); } // ---------------------------------------------------------------------- @@ -293,7 +293,7 @@ ShipObject const * AiShipBehaviorAttackBomber::getTargetCapitalShip() const return targetShipObject; } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackCapitalShip.cpp b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackCapitalShip.cpp index d771b837..a1fe30da 100755 --- a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackCapitalShip.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackCapitalShip.cpp @@ -19,7 +19,7 @@ AiShipBehaviorAttackCapitalShip::AiShipBehaviorAttackCapitalShip(AiShipController & aiShipController) : AiShipBehaviorAttack(aiShipController) { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackCapitalShip::AiShipBehaviorAttackCapitalShip() unit(%s)", (m_aiShipController.getOwner() != NULL) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner")); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackCapitalShip::AiShipBehaviorAttackCapitalShip() unit(%s)", (m_aiShipController.getOwner() != nullptr) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner")); } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackFighter.cpp b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackFighter.cpp index 166eda11..d43510a4 100755 --- a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackFighter.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackFighter.cpp @@ -145,7 +145,7 @@ Vector const AiShipBehaviorAttackFighter::calculateEvadePositionWithinLeashDista AiShipBehaviorAttackFighter::AiShipBehaviorAttackFighter(AiShipController & aiShipController) : AiShipBehaviorAttack(aiShipController) - , m_currentManeuver(NULL) + , m_currentManeuver(nullptr) , m_timeDelta(0.0f) , m_projectileTimer() , m_missileLockOnTimer() @@ -165,7 +165,7 @@ AiShipBehaviorAttackFighter::AiShipBehaviorAttackFighter(AiShipController & aiSh , m_shotErrorPosition_l() , m_nextShotPosition_w() { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackFighter::AiShipBehaviorAttackFighter() unit(%s)", (aiShipController.getOwner() != NULL) ? aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner")); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackFighter::AiShipBehaviorAttackFighter() unit(%s)", (aiShipController.getOwner() != nullptr) ? aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner")); initializeTimers(); calculateEvadeHealthPercent(); calculateNextProjectileShotPerfect(); @@ -178,7 +178,7 @@ AiShipBehaviorAttackFighter::AiShipBehaviorAttackFighter(AiShipController & aiSh AiShipBehaviorAttackFighter::AiShipBehaviorAttackFighter(AiShipBehaviorAttack const & sourceBehavior) : AiShipBehaviorAttack(sourceBehavior) - , m_currentManeuver(NULL) + , m_currentManeuver(nullptr) , m_timeDelta(0.0f) , m_projectileTimer() , m_missileLockOnTimer() @@ -198,7 +198,7 @@ AiShipBehaviorAttackFighter::AiShipBehaviorAttackFighter(AiShipBehaviorAttack co , m_shotErrorPosition_l() , m_nextShotPosition_w() { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackFighter::AiShipBehaviorAttackFighter() unit(%s)", (getAiShipController().getOwner() != NULL) ? getAiShipController().getOwner()->getNetworkId().getValueString().c_str() : "NULL owner")); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackFighter::AiShipBehaviorAttackFighter() unit(%s)", (getAiShipController().getOwner() != nullptr) ? getAiShipController().getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner")); initializeTimers(); calculateEvadeHealthPercent(); calculateNextProjectileShotPerfect(); @@ -214,7 +214,7 @@ AiShipBehaviorAttackFighter::~AiShipBehaviorAttackFighter() delete m_targetInfo; delete m_currentManeuver; - m_currentManeuver = NULL; + m_currentManeuver = nullptr; } // ---------------------------------------------------------------------- @@ -265,7 +265,7 @@ void AiShipBehaviorAttackFighter::alterManeuver() } else { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackFighter::alterManeuver() owner(%s) Why does this ship in the attack state with a NULL attack target?", getAiShipController().getOwner()->getNetworkId().getValueString().c_str())); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackFighter::alterManeuver() owner(%s) Why does this ship in the attack state with a nullptr attack target?", getAiShipController().getOwner()->getNetworkId().getValueString().c_str())); } if (overallHealthPercent > m_lastEvadeHealthPercent) @@ -347,7 +347,7 @@ void AiShipBehaviorAttackFighter::alterWeapons() if (!targetShipObject) { - DEBUG_WARNING(true, ("debug_ai: unit(%s) ERROR: Why is the primary attack target NULL?", getAiShipController().getShipOwner()->getDebugInformation().c_str())); + DEBUG_WARNING(true, ("debug_ai: unit(%s) ERROR: Why is the primary attack target nullptr?", getAiShipController().getShipOwner()->getDebugInformation().c_str())); return; } @@ -584,7 +584,7 @@ void AiShipBehaviorAttackFighter::alterTargetInformation() ShipObject & ownerShipObject = *NON_NULL(getAiShipController().getShipOwner()); ShipObject const * const targetShipObject = getAiShipController().getPrimaryAttackTargetShipObject(); - if (targetShipObject != NULL) + if (targetShipObject != nullptr) { //-- Set pilot data here. AiShipPilotData const * pilotData = NON_NULL(getAiShipController().getPilotData()); @@ -600,7 +600,7 @@ void AiShipBehaviorAttackFighter::alterTargetInformation() CreatureObject const * const targetPilot = targetShipObject->getPilot(); - m_targetInfo->m_playerControlled = (targetPilot != NULL) ? targetPilot->isPlayerControlled() : false; + m_targetInfo->m_playerControlled = (targetPilot != nullptr) ? targetPilot->isPlayerControlled() : false; // Cached target info. bool const includeMissiles = true; @@ -707,7 +707,7 @@ void AiShipBehaviorAttackFighter::alterTargetInformation() } else { - DEBUG_WARNING(true, ("debug_ai: unit(%s) ERROR: The primary attack target is NULL.", ownerShipObject.getDebugInformation().c_str())); + DEBUG_WARNING(true, ("debug_ai: unit(%s) ERROR: The primary attack target is nullptr.", ownerShipObject.getDebugInformation().c_str())); } } @@ -956,7 +956,7 @@ void AiShipBehaviorAttackFighter::calculateNextShotPosition_w() if (!targetShipObject) { - DEBUG_WARNING(true, ("debug_ai: unit(%s) ERROR: Why is the primary attack target NULL?", getAiShipController().getShipOwner()->getDebugInformation().c_str())); + DEBUG_WARNING(true, ("debug_ai: unit(%s) ERROR: Why is the primary attack target nullptr?", getAiShipController().getShipOwner()->getDebugInformation().c_str())); return; } @@ -1014,7 +1014,7 @@ void AiShipBehaviorAttackFighter::addDebug(AiDebugString & aiDebugString) AiShipBehaviorAttackFighter::Maneuver::Path const * path = m_currentManeuver->getCurrentPath(); char pathSizeText[256]; - if (path != NULL) + if (path != nullptr) { snprintf(pathSizeText, sizeof(pathSizeText) - 1, "PATH(%d)", path->getLength()); } @@ -1027,7 +1027,7 @@ void AiShipBehaviorAttackFighter::addDebug(AiDebugString & aiDebugString) // Show the current maneuver { - char const * const text = FormattedString<512>().sprintf("attack[%s%s%s] %d %s\n", AiDebugString::getColorCode(PackedRgb::solidWhite).c_str(), (m_currentManeuver != NULL) ? m_currentManeuver->getFighterManeuverString() : "NULL", AiDebugString::getResetColorCode(), (m_currentManeuver != NULL) ? m_currentManeuver->getSequenceId() : -1, pathSizeText); + char const * const text = FormattedString<512>().sprintf("attack[%s%s%s] %d %s\n", AiDebugString::getColorCode(PackedRgb::solidWhite).c_str(), (m_currentManeuver != nullptr) ? m_currentManeuver->getFighterManeuverString() : "nullptr", AiDebugString::getResetColorCode(), (m_currentManeuver != nullptr) ? m_currentManeuver->getSequenceId() : -1, pathSizeText); aiDebugString.addText(text, PackedRgb::solidCyan); } @@ -1060,7 +1060,7 @@ void AiShipBehaviorAttackFighter::addDebug(AiDebugString & aiDebugString) // Show the maneuver path - if ( (path != NULL) + if ( (path != nullptr) && !path->isEmpty()) { AiDebugString::TransformList transformList; diff --git a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackFighter_Maneuver.cpp b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackFighter_Maneuver.cpp index 17fa39ea..c3b9d975 100755 --- a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackFighter_Maneuver.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackFighter_Maneuver.cpp @@ -72,7 +72,7 @@ AiShipBehaviorAttackFighter::Maneuver::~Maneuver() delete m_pathList; - //m_currentPath = NULL; + //m_currentPath = nullptr; } // ---------------------------------------------------------------------- @@ -128,7 +128,7 @@ void AiShipBehaviorAttackFighter::Maneuver::addPath(Path * const path) AiShipBehaviorAttackFighter::Maneuver::Path * AiShipBehaviorAttackFighter::Maneuver::getCurrentPath() { - Path * currentPath = NULL; + Path * currentPath = nullptr; if (!m_pathList->empty() && m_currentPath != m_pathList->end()) { @@ -230,7 +230,7 @@ void AiShipBehaviorAttackFighter::Maneuver::alterThrottle(float const /*timeDelt AiShipBehaviorAttackFighter::Maneuver * AiShipBehaviorAttackFighter::Maneuver::createManeuver(FighterManeuver const manueverType, AiShipBehaviorAttackFighter & aiShipBehaviorAttack, AiAttackTargetInformation const & targetInfo) { - Maneuver * aiManeuver = NULL; + Maneuver * aiManeuver = nullptr; switch(manueverType) { @@ -298,7 +298,7 @@ public: ShipObject const * const primaryTargetShipObject = getAiShipController().getPrimaryAttackTargetShipObject(); - if (primaryTargetShipObject != NULL) + if (primaryTargetShipObject != nullptr) { float const ownerShipRadius = getAiShipController().getShipOwner()->getRadius(); float const ownerTurnRadius = getAiShipController().getLargestTurnRadius(); @@ -337,7 +337,7 @@ protected: ShipObject const * const primaryTargetShipObject = getAiShipController().getPrimaryAttackTargetShipObject(); - if (primaryTargetShipObject != NULL) + if (primaryTargetShipObject != nullptr) { bool const facingTarget = m_aiShipBehaviorAttack.isFacingTarget(); @@ -450,7 +450,7 @@ private: { ShipObject const * const primaryTargetShipObject = getAiShipController().getPrimaryAttackTargetShipObject(); - if (primaryTargetShipObject != NULL) + if (primaryTargetShipObject != nullptr) { AiShipPilotData const & pilotData = *NON_NULL(getAiShipController().getPilotData()); float const currentSpeed = getAiShipController().getShipOwner()->getCurrentSpeed(); @@ -665,11 +665,11 @@ private: { ShipObject const * const primaryTargetShipObject = getAiShipController().getPrimaryAttackTargetShipObject(); - if (primaryTargetShipObject!= NULL) + if (primaryTargetShipObject!= nullptr) { ShipController const * const targetShipController = primaryTargetShipObject->getController()->asShipController(); - if (targetShipController != NULL) + if (targetShipController != nullptr) { Transform transform; Vector velocity; diff --git a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorDock.cpp b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorDock.cpp index e8c1aede..f023331c 100755 --- a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorDock.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorDock.cpp @@ -66,7 +66,7 @@ AiShipBehaviorDock::AiShipBehaviorDock(ShipController & shipController, ShipObje , m_goalPosition_w() , m_wingsOpenedBeforeDock(m_shipController.getShipOwner()->hasWings() && m_shipController.getShipOwner()->wingsOpened()) { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipBehaviorDock: [1/6] unit(%s) dockTarget(%s) secondsAtDock(%.2f) landingHardPoint(%s)", (shipController.getOwner() != NULL) ? shipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner", dockTarget.getNetworkId().getValueString().c_str(), secondsAtDock, m_hasLandingHardPoint ? "yes" : "no")); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipBehaviorDock: [1/6] unit(%s) dockTarget(%s) secondsAtDock(%.2f) landingHardPoint(%s)", (shipController.getOwner() != nullptr) ? shipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner", dockTarget.getNetworkId().getValueString().c_str(), secondsAtDock, m_hasLandingHardPoint ? "yes" : "no")); if (m_shipController.isBeingDocked()) { @@ -119,7 +119,7 @@ AiShipBehaviorDock::AiShipBehaviorDock(ShipController & shipController, ShipObje ShipController * const dockTargetShipController = dockTarget.getController()->asShipController(); - if (dockTargetShipController != NULL) + if (dockTargetShipController != nullptr) { dockTargetShipController->addDockedBy(*shipController.getOwner()); } @@ -146,7 +146,7 @@ AiShipBehaviorDock::AiShipBehaviorDock(ShipController & shipController, ShipObje m_initialApproachHardPointCount = static_cast(m_approachHardPointList->size()); - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipBehaviorDock() unit(%s) dockTarget(%s) approachHardPointCount(%u) exitHardPointCount(%u)", (shipController.getOwner() != NULL) ? shipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner", dockTarget.getNetworkId().getValueString().c_str(), m_approachHardPointList->size(), m_exitHardPointList->size())); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipBehaviorDock() unit(%s) dockTarget(%s) approachHardPointCount(%u) exitHardPointCount(%u)", (shipController.getOwner() != nullptr) ? shipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner", dockTarget.getNetworkId().getValueString().c_str(), m_approachHardPointList->size(), m_exitHardPointList->size())); } // ---------------------------------------------------------------------- @@ -156,7 +156,7 @@ AiShipBehaviorDock::~AiShipBehaviorDock() // Open the wings - if ( (ownerShipObject != NULL) + if ( (ownerShipObject != nullptr) && m_wingsOpenedBeforeDock) { m_shipController.getShipOwner()->openWings(); @@ -168,7 +168,7 @@ AiShipBehaviorDock::~AiShipBehaviorDock() { CollisionCallbackManager::removeIgnoreIntersect(m_shipController.getOwner()->getNetworkId(), m_dockTarget); - if ( (ownerShipObject != NULL) + if ( (ownerShipObject != nullptr) && ownerShipObject->isPlayerShip()) { m_shipController.appendMessage(CM_removeIgnoreIntersect, 0.0f, new MessageQueueGenericValueType(m_dockTarget), GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_CLIENT); @@ -179,11 +179,11 @@ AiShipBehaviorDock::~AiShipBehaviorDock() Object * const dockTarget = m_dockTarget.getObject(); - if (dockTarget != NULL) + if (dockTarget != nullptr) { ShipController * const dockTargetShipController = dockTarget->getController()->asShipController(); - if (dockTargetShipController != NULL) + if (dockTargetShipController != nullptr) { dockTargetShipController->removeDockedBy(*m_shipController.getOwner()); } @@ -200,7 +200,7 @@ void AiShipBehaviorDock::alter(float deltaSeconds) bool abortDocking = false; - if (m_dockTarget.getObject() == NULL) + if (m_dockTarget.getObject() == nullptr) { // If we lose the dock target, fail the docking procedure. @@ -213,7 +213,7 @@ void AiShipBehaviorDock::alter(float deltaSeconds) AiShipController * const dockTargetAiShipController = AiShipController::asAiShipController(m_dockTarget.getObject()->getController()); - if ( (dockTargetAiShipController != NULL) + if ( (dockTargetAiShipController != nullptr) && dockTargetAiShipController->isAttacking()) { LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipBehaviorDock::alter() unit(%s) dockTarget(%s) DOCK TARGET IS ATTACKING...UNDOCKING", m_shipController.getOwner()->getDebugInformation().c_str(), m_dockTarget.getValueString().c_str())); @@ -478,7 +478,7 @@ void AiShipBehaviorDock::triggerDocked() GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(m_shipController.getOwner()); - if(gameScriptObject != NULL) + if(gameScriptObject != nullptr) { ScriptParams scriptParams; scriptParams.addParam(m_dockTarget); @@ -499,7 +499,7 @@ void AiShipBehaviorDock::triggerStartUnDock() GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(m_shipController.getOwner()); - if(gameScriptObject != NULL) + if(gameScriptObject != nullptr) { ScriptParams scriptParams; scriptParams.addParam(m_dockTarget); @@ -520,7 +520,7 @@ void AiShipBehaviorDock::triggerUnDockWithSuccess() GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(m_shipController.getOwner()); - if(gameScriptObject != NULL) + if(gameScriptObject != nullptr) { ScriptParams scriptParams; scriptParams.addParam(m_dockTarget); @@ -542,7 +542,7 @@ void AiShipBehaviorDock::triggerUnDockWithFailure() GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(m_shipController.getOwner()); - if(gameScriptObject != NULL) + if(gameScriptObject != nullptr) { ScriptParams scriptParams; scriptParams.addParam(m_dockTarget); @@ -622,7 +622,7 @@ float AiShipBehaviorDock::getMaxTractorBeamSpeed() const float const shipActualSpeedMaximum = m_shipController.getShipOwner()->getShipActualSpeedMaximum(); AiShipController * const aiShipController = m_shipController.asAiShipController(); - return (aiShipController != NULL) ? (shipActualSpeedMaximum * aiShipController->getPilotData()->m_nonCombatMaxSpeedPercent) : shipActualSpeedMaximum; + return (aiShipController != nullptr) ? (shipActualSpeedMaximum * aiShipController->getPilotData()->m_nonCombatMaxSpeedPercent) : shipActualSpeedMaximum; } // ---------------------------------------------------------------------- @@ -676,7 +676,7 @@ void AiShipBehaviorDock::addDebug(AiDebugString & aiDebugString) aiDebugString.addLineToPosition(m_goalPosition_w, PackedRgb::solidCyan); - if (m_dockTarget.getObject() != NULL) + if (m_dockTarget.getObject() != nullptr) { Transform transform; transform.multiply(m_dockTarget.getObject()->getTransform_o2w(), m_dockHardPoint); diff --git a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorFollow.cpp b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorFollow.cpp index dedc3fda..e8ca1bd5 100755 --- a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorFollow.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorFollow.cpp @@ -45,9 +45,9 @@ AiShipBehaviorFollow::AiShipBehaviorFollow(AiShipController & aiShipController, , m_followedUnit(followedUnit) , m_followedUnitLost(false) { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorFollow::AiShipBehaviorFollow() unit(%s) followedUnit(%s)", (m_aiShipController.getOwner() != NULL) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner", followedUnit.getValueString().c_str())); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorFollow::AiShipBehaviorFollow() unit(%s) followedUnit(%s)", (m_aiShipController.getOwner() != nullptr) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner", followedUnit.getValueString().c_str())); - DEBUG_WARNING((m_followedUnit.getObject() == NULL), ("Trying to follow a NULL object.")); + DEBUG_WARNING((m_followedUnit.getObject() == nullptr), ("Trying to follow a nullptr object.")); } // ---------------------------------------------------------------------- @@ -60,7 +60,7 @@ void AiShipBehaviorFollow::alter(float const deltaSeconds) Object * const followedUnitObject = m_followedUnit.getObject(); Vector goalPosition_w; - if (followedUnitObject != NULL) + if (followedUnitObject != nullptr) { goalPosition_w = Formation::getPosition_w(followedUnitObject->getTransform_o2w(), m_aiShipController.getFormationPosition_l()); @@ -69,9 +69,9 @@ void AiShipBehaviorFollow::alter(float const deltaSeconds) if (m_aiShipController.getOwner()->getPosition_w().magnitudeBetweenSquared(goalPosition_w) > sqr(m_aiShipController.getLargestTurnRadius() * slowDownRequestRadiusGain)) { ShipController * const shipController = followedUnitObject->getController()->asShipController(); - AiShipController * const aiShipController = (shipController != NULL) ? shipController->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipController != nullptr) ? shipController->asAiShipController() : nullptr; - if (aiShipController != NULL) + if (aiShipController != nullptr) { aiShipController->requestSlowDown(); } @@ -90,7 +90,7 @@ void AiShipBehaviorFollow::alter(float const deltaSeconds) Object const * const object = m_aiShipController.getOwner(); - if (object != NULL) + if (object != nullptr) { goalPosition_w = object->getPosition_w(); } @@ -109,10 +109,10 @@ void AiShipBehaviorFollow::alter(float const deltaSeconds) void AiShipBehaviorFollow::triggerFollowedUnitLost() { Object * object = m_aiShipController.getOwner(); - ServerObject *serverObject = (object != NULL) ? object->asServerObject() : NULL; - GameScriptObject * gameScriptObject = (serverObject != NULL) ? serverObject->getScriptObject() : NULL; + ServerObject *serverObject = (object != nullptr) ? object->asServerObject() : nullptr; + GameScriptObject * gameScriptObject = (serverObject != nullptr) ? serverObject->getScriptObject() : nullptr; - if(gameScriptObject != NULL) + if(gameScriptObject != nullptr) { ScriptParams scriptParams; scriptParams.addParam(m_followedUnit); diff --git a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorIdle.cpp b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorIdle.cpp index 14d8253c..1654e5c8 100755 --- a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorIdle.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorIdle.cpp @@ -25,7 +25,7 @@ AiShipBehaviorIdle::AiShipBehaviorIdle(AiShipController & aiShipController) : AiShipBehaviorBase(aiShipController) { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorIdle() unit(%s)", (m_aiShipController.getOwner() != NULL) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner")); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorIdle() unit(%s)", (m_aiShipController.getOwner() != nullptr) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner")); } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorTrack.cpp b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorTrack.cpp index 68a47863..c1aa8506 100755 --- a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorTrack.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorTrack.cpp @@ -27,7 +27,7 @@ AiShipBehaviorTrack::AiShipBehaviorTrack(AiShipController & aiShipController, Ob : AiShipBehaviorBase(aiShipController) , m_target(&target) { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorTrack() unit(%s) target(%s)", (m_aiShipController.getOwner() != NULL) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner", target.getNetworkId().getValueString().c_str())); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorTrack() unit(%s) target(%s)", (m_aiShipController.getOwner() != nullptr) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner", target.getNetworkId().getValueString().c_str())); } // ---------------------------------------------------------------------- @@ -36,7 +36,7 @@ void AiShipBehaviorTrack::alter(float deltaSeconds) { PROFILER_AUTO_BLOCK_DEFINE("AiShipBehaviorTrack::alter"); - if (m_target != NULL) + if (m_target != nullptr) { IGNORE_RETURN(m_aiShipController.face(m_target->getPosition_w(), deltaSeconds)); } diff --git a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorWaypoint.cpp b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorWaypoint.cpp index f68335b9..6302a8f9 100755 --- a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorWaypoint.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorWaypoint.cpp @@ -35,7 +35,7 @@ AiShipBehaviorWaypoint::AiShipBehaviorWaypoint(AiShipController & aiShipControll , m_cyclic(cyclic) , m_moveToCompleteTriggerSent(false) { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorWaypoint::AiShipBehaviorWaypoint() unit(%s) cyclic(%s)", (aiShipController.getOwner() != NULL) ? aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner", cyclic ? "yes" : "no")); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorWaypoint::AiShipBehaviorWaypoint() unit(%s) cyclic(%s)", (aiShipController.getOwner() != nullptr) ? aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner", cyclic ? "yes" : "no")); } // ---------------------------------------------------------------------- @@ -61,7 +61,7 @@ void AiShipBehaviorWaypoint::alter(float deltaSeconds) { SpacePath const * const path = m_aiShipController.getPath(); - if ( (path != NULL) + if ( (path != nullptr) && !m_cyclic && (m_aiShipController.getCurrentPathIndex() == (path->getTransformList().size() - 1))) { @@ -76,7 +76,7 @@ void AiShipBehaviorWaypoint::alter(float deltaSeconds) GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(m_aiShipController.getOwner()); - if(gameScriptObject != NULL) + if(gameScriptObject != nullptr) { ScriptParams scriptParams; IGNORE_RETURN(gameScriptObject->trigAllScripts(Scripting::TRIG_SPACE_UNIT_MOVE_TO_COMPLETE, scriptParams)); @@ -104,13 +104,13 @@ bool AiShipBehaviorWaypoint::getNextPosition_w(Vector & position_w) SpacePath * const path = m_aiShipController.getPath(); - if ( (path != NULL) + if ( (path != nullptr) && !path->isEmpty() && (m_aiShipController.getCurrentPathIndex() < path->getTransformList().size())) { ShipObject const * const shipObject = m_aiShipController.getShipOwner(); - if (shipObject != NULL) + if (shipObject != nullptr) { SpacePath::TransformList const & transformList = path->getTransformList(); Vector const & nextPosition = getGoalPosition_w(); @@ -166,7 +166,7 @@ Vector AiShipBehaviorWaypoint::getGoalPosition_w() const SpacePath * const path = m_aiShipController.getPath(); - if ( (path != NULL) + if ( (path != nullptr) && !path->isEmpty()) { SpacePath::TransformList const & transformList = path->getTransformList(); @@ -245,7 +245,7 @@ void AiShipBehaviorWaypoint::addDebug(AiDebugString & aiDebugString) { SpacePath const * const path = m_aiShipController.getPath(); - if (path != NULL) + if (path != nullptr) { aiDebugString.addLineToPosition(m_aiShipController.getMoveToGoalPosition_w(), PackedRgb::solidGreen); aiDebugString.addCircle(m_aiShipController.getMoveToGoalPosition_w(), m_aiShipController.getLargestTurnRadius(), PackedRgb::solidGreen); diff --git a/engine/server/library/serverGame/src/shared/behavior/ShipTurretTargetingSystem.cpp b/engine/server/library/serverGame/src/shared/behavior/ShipTurretTargetingSystem.cpp index 23cbc81f..cf1af6f8 100755 --- a/engine/server/library/serverGame/src/shared/behavior/ShipTurretTargetingSystem.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/ShipTurretTargetingSystem.cpp @@ -124,7 +124,7 @@ void ShipTurretTargetingSystem::onTargetLost(NetworkId const & target) ShipObject * const shipObject = NON_NULL(NON_NULL(NON_NULL(m_shipController.getOwner())->asServerObject())->asShipObject()); if (!shipObject) // for release builds { - WARNING(true,("Programmer bug: got a NULL ShipObject in ShipTurretTargetingSystem::onTargetLost(). May indicate that the ShipObject has already been partially deconstructed.")); + WARNING(true,("Programmer bug: got a nullptr ShipObject in ShipTurretTargetingSystem::onTargetLost(). May indicate that the ShipObject has already been partially deconstructed.")); return; } @@ -168,7 +168,7 @@ bool ShipTurretTargetingSystem::buildTargetList() bool result = false; m_targetList->clear(); - if (ownerShipController != NULL) + if (ownerShipController != nullptr) { if (!ownerShipController->getAttackTargetList().isEmpty()) { diff --git a/engine/server/library/serverGame/src/shared/collision/CollisionCallbacks.cpp b/engine/server/library/serverGame/src/shared/collision/CollisionCallbacks.cpp index 99c4f3cb..9bce1404 100755 --- a/engine/server/library/serverGame/src/shared/collision/CollisionCallbacks.cpp +++ b/engine/server/library/serverGame/src/shared/collision/CollisionCallbacks.cpp @@ -86,7 +86,7 @@ void CollisionCallbacksNamespace::remove() int CollisionCallbacksNamespace::convertObjectToIndex(Object * const object) { - FATAL(!object, ("CollisionCallbacksNamespace::convertObjectToIndex: object == NULL.")); + FATAL(!object, ("CollisionCallbacksNamespace::convertObjectToIndex: object == nullptr.")); ServerObject const * serverObject = object->asServerObject(); if (serverObject) @@ -99,11 +99,11 @@ int CollisionCallbacksNamespace::convertObjectToIndex(Object * const object) bool CollisionCallbacksNamespace::onHitDoCollisionWith(Object * const object, Object * const wasHitByThisObject) { - DEBUG_WARNING(!object, ("CollisionCallbacksNamespace::onHitDoCollisionWith: Object == NULL")); - DEBUG_WARNING(!wasHitByThisObject, ("CollisionCallbacksNamespace::onHitDoCollisionWith: wasHitByThisObject == NULL")); + DEBUG_WARNING(!object, ("CollisionCallbacksNamespace::onHitDoCollisionWith: Object == nullptr")); + DEBUG_WARNING(!wasHitByThisObject, ("CollisionCallbacksNamespace::onHitDoCollisionWith: wasHitByThisObject == nullptr")); ShipObject * shipObject = safe_cast(object); - DEBUG_WARNING(!shipObject, ("CollisionCallbacksNamespace::onHitDoCollisionWith: shipObject == NULL")); + DEBUG_WARNING(!shipObject, ("CollisionCallbacksNamespace::onHitDoCollisionWith: shipObject == nullptr")); CollisionCallbackManager::Result result; if (CollisionCallbackManager::intersectAndReflect(object, wasHitByThisObject, result)) @@ -123,10 +123,10 @@ bool CollisionCallbacksNamespace::onHitDoCollisionWith(Object * const object, Ob bool CollisionCallbacksNamespace::onDoCollisionWithTerrain(Object * const object) { - DEBUG_FATAL (!object, ("CollisionCallbacksNamespace::onDoCollisionWithTerrain: Object == NULL")); + DEBUG_FATAL (!object, ("CollisionCallbacksNamespace::onDoCollisionWithTerrain: Object == nullptr")); ShipObject * shipObject = safe_cast(object); - DEBUG_FATAL (!shipObject, ("CollisionCallbacksNamespace::onDoCollisionWithTerrain: shipObject == NULL")); + DEBUG_FATAL (!shipObject, ("CollisionCallbacksNamespace::onDoCollisionWithTerrain: shipObject == nullptr")); CollisionCallbackManager::Result result; if (CollisionCallbackManager::intersectAndReflectWithTerrain(object, result)) diff --git a/engine/server/library/serverGame/src/shared/command/CommandCppFuncs.cpp b/engine/server/library/serverGame/src/shared/command/CommandCppFuncs.cpp index ff3f058c..f39fcae2 100755 --- a/engine/server/library/serverGame/src/shared/command/CommandCppFuncs.cpp +++ b/engine/server/library/serverGame/src/shared/command/CommandCppFuncs.cpp @@ -145,13 +145,13 @@ namespace CommandCppFuncsNamespace void internalSetBoosterOnOff(NetworkId const & actor, bool onOff) { ServerObject * const actorServerObj = safe_cast(NetworkIdManager::getObjectById(actor)); - CreatureObject * const actorCreature = actorServerObj != NULL ? actorServerObj->asCreatureObject() : NULL; + CreatureObject * const actorCreature = actorServerObj != nullptr ? actorServerObj->asCreatureObject() : nullptr; - if (actorCreature == NULL) + if (actorCreature == nullptr) return; ShipObject * const shipObject = actorCreature->getPilotedShip(); - if (shipObject == NULL) + if (shipObject == nullptr) return; if (!shipObject->isSlotInstalled(ShipChassisSlotType::SCST_booster)) @@ -212,22 +212,22 @@ namespace CommandCppFuncsNamespace CreatureObject * findAndResolveCreatureByNetworkId(NetworkId const & targetId) { - CreatureObject * targetCreatureObject = NULL; + CreatureObject * targetCreatureObject = nullptr; { // find the target. the target could be either a creature or ship ServerObject * const serverObject = ServerWorld::findObjectByNetworkId(targetId); - targetCreatureObject = (serverObject != NULL) ? serverObject->asCreatureObject() : NULL; + targetCreatureObject = (serverObject != nullptr) ? serverObject->asCreatureObject() : nullptr; - if (targetCreatureObject == NULL) + if (targetCreatureObject == nullptr) { - ShipObject * const shipObject = (serverObject != NULL) ? serverObject->asShipObject() : NULL; + ShipObject * const shipObject = (serverObject != nullptr) ? serverObject->asShipObject() : nullptr; - if (shipObject != NULL) + if (shipObject != nullptr) { targetCreatureObject = shipObject->getPilot(); - if (targetCreatureObject == NULL) + if (targetCreatureObject == nullptr) { // this means that it is a POB ship that doesn't have a pilot // in this case we find the owner @@ -237,7 +237,7 @@ namespace CommandCppFuncsNamespace std::vector::const_iterator ii = passengers.begin(); std::vector::const_iterator iiEnd = passengers.end(); - for (; ii != iiEnd && targetCreatureObject == NULL; ++ii) + for (; ii != iiEnd && targetCreatureObject == nullptr; ++ii) { if ((*ii)->getNetworkId() == shipObject->getOwnerId()) { @@ -290,7 +290,7 @@ namespace CommandCppFuncsNamespace Container::ContainerErrorCode errorCode = Container::CEC_Success; for (std::vector >::const_iterator i = oldItems.begin(); i != oldItems.end(); ++i) { - IGNORE_RETURN(ContainerInterface::transferItemToSlottedContainer(destination, *((*i).first), (*i).second, NULL, errorCode)); + IGNORE_RETURN(ContainerInterface::transferItemToSlottedContainer(destination, *((*i).first), (*i).second, nullptr, errorCode)); } } @@ -411,7 +411,7 @@ void CommandCppFuncsNamespace::triggerSpaceEjectPlayerFromShip(CreatureObject * { if (creatureObject == 0) { - WARNING(true, ("CommandCppFuncsNamespace::triggerSpaceEjectPlayerFromShip: NULL CreatureObject.")); + WARNING(true, ("CommandCppFuncsNamespace::triggerSpaceEjectPlayerFromShip: nullptr CreatureObject.")); return; } @@ -424,7 +424,7 @@ void CommandCppFuncsNamespace::triggerSpaceEjectPlayerFromShip(CreatureObject * } else { - WARNING(true, ("CommandCppFuncsNamespace::triggerSpaceEjectPlayerFromShip: NULL ScriptObject.")); + WARNING(true, ("CommandCppFuncsNamespace::triggerSpaceEjectPlayerFromShip: nullptr ScriptObject.")); } } @@ -432,7 +432,7 @@ void CommandCppFuncsNamespace::triggerSpaceEjectPlayerFromShip(CreatureObject * TravelPoint const * CommandCppFuncsNamespace::GroupHelpers::getNearestTravelPoint(std::string const & planetName, Vector const & location, std::vector const & cityBanList, uint32 faction, bool starPortAndShuttleportOnly) { - TravelPoint const * nearestTravelPoint = NULL; + TravelPoint const * nearestTravelPoint = nullptr; PlanetObject const * const planetObject = ServerUniverse::getInstance().getPlanetByName(planetName); if (planetObject) { @@ -537,7 +537,7 @@ static NetworkId nextOidParm(Unicode::String const &str, size_t &curpos) static float nextFloatParm(Unicode::String const &str, size_t &curpos) { - return static_cast(strtod(nextStringParm(str, curpos).c_str(), NULL)); + return static_cast(strtod(nextStringParm(str, curpos).c_str(), nullptr)); } @@ -821,7 +821,7 @@ static void commandFuncLocateStructure(Command const &, NetworkId const &actor, ownerId = actor; } - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); if (!isGod && actorObj->getObjVars().hasItem("timeNextLocateStructureCommandAllowed") && (actorObj->getObjVars().getType("timeNextLocateStructureCommandAllowed") == DynamicVariable::INT)) { int timeNextLocateStructureCommandAllowed = 0; @@ -889,7 +889,7 @@ static void commandFuncLocateVendor(Command const &, NetworkId const &actor, Net ownerId = actor; } - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); if (!isGod && actorObj->getObjVars().hasItem("timeNextLocateVendorCommandAllowed") && (actorObj->getObjVars().getType("timeNextLocateVendorCommandAllowed") == DynamicVariable::INT)) { int timeNextLocateVendorCommandAllowed = 0; @@ -956,7 +956,7 @@ static void commandFuncShowCtsHistory(Command const &, NetworkId const &actor, N if (target != actor) { targetObj = dynamic_cast(ServerWorld::findObjectByNetworkId(target)); - targetPlayerObj = (targetObj ? PlayerCreatureController::getPlayerObject(targetObj) : NULL); + targetPlayerObj = (targetObj ? PlayerCreatureController::getPlayerObject(targetObj) : nullptr); if (!targetPlayerObj) { ConsoleMgr::broadcastString(FormattedString<1024>().sprintf("%s is not a valid or nearby player character.", target.getValueString().c_str()), clientObj); @@ -980,7 +980,7 @@ static void commandFuncShowCtsHistory(Command const &, NetworkId const &actor, N if (i.getValue(ctsTransactionDetail)) { Unicode::UnicodeStringVector tokens; - if (Unicode::tokenize(ctsTransactionDetail, tokens, NULL, NULL) && (tokens.size() >= 4)) + if (Unicode::tokenize(ctsTransactionDetail, tokens, nullptr, nullptr) && (tokens.size() >= 4)) { Unicode::String characterName; for (size_t i = 3, j = tokens.size(); i < j; ++i) @@ -1196,7 +1196,7 @@ static void commandFuncAdminEditBank(Command const &cmd, NetworkId const &actor, CreatureObject * targetCreature = safe_cast(ServerWorld::findObjectByNetworkId(target)); if (!targetCreature || !actorCreature) { - DEBUG_REPORT_LOG(true, ("Received open command for null player or target.\n")); + DEBUG_REPORT_LOG(true, ("Received open command for nullptr player or target.\n")); return; } @@ -1241,14 +1241,14 @@ static void commandFuncAdminEditStats(Command const &, NetworkId const &actor, N CreatureObject* const creatureActor = dynamic_cast(NetworkIdManager::getObjectById (actor)); if (!creatureActor) { - WARNING (true, ("commandFuncAdminEditStats: null actor")); + WARNING (true, ("commandFuncAdminEditStats: nullptr actor")); return; } CreatureObject* const creatureTarget = dynamic_cast(NetworkIdManager::getObjectById (target)); if (!creatureTarget) { - WARNING (true, ("commandFuncAdminEditStats: null target")); + WARNING (true, ("commandFuncAdminEditStats: nullptr target")); return; } @@ -1265,14 +1265,14 @@ static void commandFuncAdminEditAppearance(Command const &, NetworkId const &act CreatureObject* const creatureActor = dynamic_cast(NetworkIdManager::getObjectById (actor)); if (!creatureActor) { - WARNING (true, ("commandFuncAdminEditAppearance: null actor")); + WARNING (true, ("commandFuncAdminEditAppearance: nullptr actor")); return; } CreatureObject* const creatureTarget = dynamic_cast(NetworkIdManager::getObjectById (target)); if (!creatureTarget) { - WARNING (true, ("commandFuncAdminEditAppearance: null target")); + WARNING (true, ("commandFuncAdminEditAppearance: nullptr target")); return; } @@ -1819,7 +1819,7 @@ static void commandFuncSpatialChatInternal(Command const &, NetworkId const &act else if (!squelched && (ConfigServerGame::getChatSpamNotifyPlayerWhenLimitedIntervalSeconds() > 0) && obj->getClient()) { // send message telling character he can no longer talk - const int timeNow = static_cast(::time(NULL)); + const int timeNow = static_cast(::time(nullptr)); const int chatSpamTimeEndInterval = playerObject->getChatSpamTimeEndInterval(); if ((chatSpamTimeEndInterval > timeNow) && (timeNow >= playerObject->getChatSpamNextTimeToNotifyPlayerWhenLimited())) { @@ -1837,7 +1837,7 @@ static void commandFuncSpatialChatInternal(Command const &, NetworkId const &act // ---------------------------------------------------------------------- /** -* Parameters: [null terminator + oob] +* Parameters: [nullptr terminator + oob] * All parameters are strings */ @@ -1957,7 +1957,7 @@ static void commandFuncSpatialChat(Command const &, NetworkId const &actor, Netw else if (!squelched && (ConfigServerGame::getChatSpamNotifyPlayerWhenLimitedIntervalSeconds() > 0) && obj->getClient()) { // send message telling character he can no longer talk - const int timeNow = static_cast(::time(NULL)); + const int timeNow = static_cast(::time(nullptr)); const int chatSpamTimeEndInterval = playerObject->getChatSpamTimeEndInterval(); if ((chatSpamTimeEndInterval > timeNow) && (timeNow >= playerObject->getChatSpamNextTimeToNotifyPlayerWhenLimited())) { @@ -1992,7 +1992,7 @@ static void commandFuncCombatSpam (Command const &, NetworkId const &actor, Netw ServerObject * const obj = safe_cast(actorId.getObject ()); if (!obj) { - WARNING (true, ("null actor in commandFuncCombatSpam")); + WARNING (true, ("nullptr actor in commandFuncCombatSpam")); return; } @@ -2213,10 +2213,10 @@ static void commandFuncSetWaypointName(Command const &, NetworkId const & actor, static void commandSetPosture(Command const &command, NetworkId const &actor, NetworkId const &, Unicode::String const &) { CachedNetworkId actorId(actor); - if (actorId.getObject() != NULL) + if (actorId.getObject() != nullptr) { CreatureController * const controller = dynamic_cast(actorId.getObject()->getController()); - if (controller != NULL) + if (controller != nullptr) { CreatureObject * const creature = safe_cast(actorId.getObject()); NOT_NULL (creature); @@ -2247,15 +2247,15 @@ static void commandSetPosture(Command const &command, NetworkId const &actor, Ne static void commandFuncJumpServer(Command const &command, NetworkId const &actor, NetworkId const &, Unicode::String const &) { CachedNetworkId actorId(actor); - if (actorId.getObject() != NULL) + if (actorId.getObject() != nullptr) { CreatureController * const controller = dynamic_cast(actorId.getObject()->getController()); - if (controller != NULL) + if (controller != nullptr) { controller->appendMessage( CM_jump, 0.0f, - NULL, + nullptr, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_ALL_CLIENT @@ -2621,7 +2621,7 @@ static void commandFuncEndDuel(Command const &, NetworkId const &actor, NetworkI params.addParam(targetObj->getNetworkId(), "target"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(actorFlagObj->getNetworkId(), @@ -2634,7 +2634,7 @@ static void commandFuncEndDuel(Command const &, NetworkId const &actor, NetworkI params.addParam(actorFlagObj->getNetworkId(), "target"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(targetObj->getNetworkId(), @@ -2867,7 +2867,7 @@ static void commandFuncFactoryCrateSplit(Command const &, NetworkId const &actor const int amount = nextIntParm(params,pos); const CachedNetworkId destContainerId (nextOidParm(params,pos)); ServerObject * destContainer = safe_cast(destContainerId.getObject()); - if (destContainer == NULL || ContainerInterface::getVolumeContainer(*destContainer) == NULL) + if (destContainer == nullptr || ContainerInterface::getVolumeContainer(*destContainer) == nullptr) { ContainerInterface::sendContainerMessageToClient(*player, Container::CEC_NotFound); return; @@ -2878,7 +2878,7 @@ static void commandFuncFactoryCrateSplit(Command const &, NetworkId const &actor { ContainerInterface::sendContainerMessageToClient(*player, error, sourceObj); } - else if (sourceObj->makeCopy(*destContainer, amount) == NULL) + else if (sourceObj->makeCopy(*destContainer, amount) == nullptr) { ContainerInterface::sendContainerMessageToClient(*player, Container::CEC_Full, destContainer); @@ -2952,7 +2952,7 @@ static void commandFuncTransferItem(Command const &, NetworkId const &actor, Net if (!playerSo || !item) { - DEBUG_REPORT_LOG(true, ("Received transfer item command for null player or target.\n")); + DEBUG_REPORT_LOG(true, ("Received transfer item command for nullptr player or target.\n")); return; } @@ -3185,7 +3185,7 @@ static void commandFuncTransferItem(Command const &, NetworkId const &actor, Net retval = false; } - else if (destination == player->getAppearanceInventory() && ContainerInterface::getContainer(*item) != NULL) + else if (destination == player->getAppearanceInventory() && ContainerInterface::getContainer(*item) != nullptr) { const Container * itemContainer = ContainerInterface::getContainer(*item); if(itemContainer && itemContainer->getNumberOfItems() == 0) @@ -3215,7 +3215,7 @@ static void commandFuncTransferItem(Command const &, NetworkId const &actor, Net const SlottedContainer * equipment = ContainerInterface::getSlottedContainer(*player); const SlottedContainmentProperty * itemContainmentProperty = ContainerInterface::getSlottedContainmentProperty(*item); - if (inventory != NULL && equipment != NULL && itemContainmentProperty != NULL) + if (inventory != nullptr && equipment != nullptr && itemContainmentProperty != nullptr) { std::vector > oldItems; retval = true; @@ -3225,7 +3225,7 @@ static void commandFuncTransferItem(Command const &, NetworkId const &actor, Net SlotId slot = itemContainmentProperty->getSlotId(arrangement, i); const Container::ContainedItem & currentWeaponId = equipment->getObjectInSlot(slot, errorCode); ServerObject * oldItem = safe_cast(currentWeaponId.getObject()); - if (oldItem != NULL) + if (oldItem != nullptr) { if (ContainerInterface::transferItemToVolumeContainer(*inventory, *oldItem, player, errorCode, true)) { @@ -3280,7 +3280,7 @@ static void commandFuncTransferItem(Command const &, NetworkId const &actor, Net SlotId slot = itemContainmentProperty->getSlotId(arrangement, i); const Container::ContainedItem & currentWeaponId = equipment->getObjectInSlot(slot, errorCode); ServerObject * oldItem = safe_cast(currentWeaponId.getObject()); - if (oldItem != NULL) + if (oldItem != nullptr) { if( std::find(objectsToSend.begin(), objectsToSend.end(), oldItem) == objectsToSend.end() ) objectsToSend.push_back(oldItem); @@ -3291,7 +3291,7 @@ static void commandFuncTransferItem(Command const &, NetworkId const &actor, Net for(; iter != objectsToSend.end(); ++iter) { // No idea how this could happen, but just incase. - if((*iter) == NULL) + if((*iter) == nullptr) continue; StringId const code("container_error_message", "container32_prose"); @@ -3411,7 +3411,7 @@ static void commandFuncOpenContainer(Command const & cmd, NetworkId const &actor CreatureObject * player = safe_cast(ServerWorld::findObjectByNetworkId(actor)); if (!container || !player) { - DEBUG_REPORT_LOG(true, ("Received open command for null player or target.\n")); + DEBUG_REPORT_LOG(true, ("Received open command for nullptr player or target.\n")); return; } //@todo check permissions @@ -3428,14 +3428,14 @@ static void commandFuncOpenContainer(Command const & cmd, NetworkId const &actor //-- if they are opening a crafting station, what they really want is the hopper //-- but only if the object is not a volume container if (container->getGameObjectType () == SharedObjectTemplate::GOT_misc_crafting_station - && (NULL == ContainerInterface::getVolumeContainer (*container))) + && (nullptr == ContainerInterface::getVolumeContainer (*container))) { static const SlotId inputHopperId(SlotIdManager::findSlotId(CrcLowerString("ingredient_hopper"))); ServerObject const * const station = container; - ServerObject * hopper = NULL; + ServerObject * hopper = nullptr; const SlottedContainer * stationContainer = ContainerInterface::getSlottedContainer (*station); - if (stationContainer != NULL) + if (stationContainer != nullptr) { Container::ContainerErrorCode tmp = Container::CEC_Success; Object* tmpHopperObj = (stationContainer->getObjectInSlot (inputHopperId, tmp)).getObject(); @@ -3526,7 +3526,7 @@ static void commandFuncCloseContainer(Command const &, NetworkId const &actor, N ServerObject * const player = ServerWorld::findObjectByNetworkId(actor); if (!container || !player) { - DEBUG_REPORT_LOG(true, ("Received close command for null player or target.\n")); + DEBUG_REPORT_LOG(true, ("Received close command for nullptr player or target.\n")); return; } @@ -3615,7 +3615,7 @@ static void commandFuncGiveItem(Command const &, NetworkId const &actor, Network ServerObject * const player = ServerWorld::findObjectByNetworkId(actor); if (!player || !item) { - DEBUG_REPORT_LOG(true, ("Received give item command for null player or target.\n")); + DEBUG_REPORT_LOG(true, ("Received give item command for nullptr player or target.\n")); return; } size_t curpos = 0; @@ -3669,10 +3669,10 @@ static void commandFuncGiveItem(Command const &, NetworkId const &actor, Network // check and see if this is a gem->socket operation, which is handled by our code TangibleObject * const socket = dynamic_cast(destination); - if (socket != NULL) + if (socket != nullptr) { TangibleObject * const gem = dynamic_cast(item); - if (gem != NULL) + if (gem != nullptr) { const int destGot = socket->getGameObjectType(); const SharedTangibleObjectTemplate * const gemTemplate = safe_cast(gem->getSharedTemplate()); @@ -3692,13 +3692,13 @@ static void commandFuncGiveItem(Command const &, NetworkId const &actor, Network } // if the socketed item is equipped, unequip it temporarily - CreatureObject * owner = NULL; + CreatureObject * owner = nullptr; Object * container = ContainerInterface::getContainedByObject(*socket); - if (container != NULL && container->asServerObject()->asCreatureObject() != NULL) + if (container != nullptr && container->asServerObject()->asCreatureObject() != nullptr) { owner = container->asServerObject()->asCreatureObject(); // fake unequipping the item - owner->onContainerLostItem(NULL, *socket, NULL); + owner->onContainerLostItem(nullptr, *socket, nullptr); } std::vector > skillModBonuses; @@ -3713,10 +3713,10 @@ static void commandFuncGiveItem(Command const &, NetworkId const &actor, Network // tell the player they can't use the gem Chat::sendSystemMessage(*player, SharedStringIds::gem_not_inserted, Unicode::emptyString); } - if (owner != NULL) + if (owner != nullptr) { // "re-equip" the item - owner->onContainerGainItem(*socket, NULL, NULL); + owner->onContainerGainItem(*socket, nullptr, nullptr); } return; } @@ -4138,7 +4138,7 @@ static void commandFuncGroupDisband(Command const &, NetworkId const &actor, Net { GroupMemberParam const & leader = *ii; - // create the new POB groups. notice NULL is passed in for the + // create the new POB groups. notice nullptr is passed in for the // groupToRemoveFrom because the original group has already had // all of the members removed @@ -4389,7 +4389,7 @@ static void commandFuncCreateGroupPickup(Command const &, NetworkId const &actor } // create the group pickup point - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); groupObj->setGroupPickupTimer(timeNow, timeNow + static_cast(ConfigServerGame::getGroupPickupPointTimeLimitSeconds())); groupObj->setGroupPickupLocation(currentScene, currentWorldLocation); @@ -4682,7 +4682,7 @@ static void commandFuncGroupPickRandomGroupMember(Command const &, NetworkId con if (!client) return; - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); if (!client->isGod() && targetObj->getObjVars().hasItem("timeNextGroupPickRandomGroupMemberCommandAllowed") && (targetObj->getObjVars().getType("timeNextGroupPickRandomGroupMemberCommandAllowed") == DynamicVariable::INT)) { int timeNextGroupPickRandomGroupMemberCommandAllowed = 0; @@ -4703,7 +4703,7 @@ static void commandFuncGroupPickRandomGroupMember(Command const &, NetworkId con if (!params.empty()) { Unicode::UnicodeStringVector tokens; - if (Unicode::tokenize(Unicode::toLower(params), tokens, NULL, NULL) && !tokens.empty()) + if (Unicode::tokenize(Unicode::toLower(params), tokens, nullptr, nullptr) && !tokens.empty()) { static Unicode::String const paramsPoint1 = Unicode::narrowToWide("-point"); static Unicode::String const paramsPoint2 = Unicode::narrowToWide("point"); @@ -4805,7 +4805,7 @@ static void commandFuncGroupTextChatRoomRejoin(Command const &, NetworkId const if (!client) return; - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); if (!client->isGod() && targetObj->getObjVars().hasItem("timeNextGroupTextChatRoomRejoinCommandAllowed") && (targetObj->getObjVars().getType("timeNextGroupTextChatRoomRejoinCommandAllowed") == DynamicVariable::INT)) { int timeNextGroupTextChatRoomRejoinCommandAllowed = 0; @@ -4868,7 +4868,7 @@ static void commandFuncGuildTextChatRoomRejoin(Command const &, NetworkId const if (!client) return; - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); if (!client->isGod() && targetObj->getObjVars().hasItem("timeNextGuildTextChatRoomRejoinCommandAllowed") && (targetObj->getObjVars().getType("timeNextGuildTextChatRoomRejoinCommandAllowed") == DynamicVariable::INT)) { int timeNextGuildTextChatRoomRejoinCommandAllowed = 0; @@ -4913,7 +4913,7 @@ static void commandFuncGuildPickRandomGuildMember(Command const &, NetworkId con if (!client) return; - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); if (!client->isGod() && targetObj->getObjVars().hasItem("timeNextGuildPickRandomGuildMemberCommandAllowed") && (targetObj->getObjVars().getType("timeNextGuildPickRandomGuildMemberCommandAllowed") == DynamicVariable::INT)) { int timeNextGuildPickRandomGuildMemberCommandAllowed = 0; @@ -4935,7 +4935,7 @@ static void commandFuncGuildPickRandomGuildMember(Command const &, NetworkId con if (!params.empty()) { Unicode::UnicodeStringVector tokens; - if (Unicode::tokenize(Unicode::toLower(params), tokens, NULL, NULL) && !tokens.empty()) + if (Unicode::tokenize(Unicode::toLower(params), tokens, nullptr, nullptr) && !tokens.empty()) { static Unicode::String const paramsOnline1 = Unicode::narrowToWide("-online"); static Unicode::String const paramsOnline2 = Unicode::narrowToWide("online"); @@ -5074,7 +5074,7 @@ static void commandFuncCityTextChatRoomRejoin(Command const &, NetworkId const & if (!client) return; - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); if (!client->isGod() && targetObj->getObjVars().hasItem("timeNextCityTextChatRoomRejoinCommandAllowed") && (targetObj->getObjVars().getType("timeNextCityTextChatRoomRejoinCommandAllowed") == DynamicVariable::INT)) { int timeNextCityTextChatRoomRejoinCommandAllowed = 0; @@ -5120,7 +5120,7 @@ static void commandFuncCityPickRandomCitizen(Command const &, NetworkId const &a if (!client) return; - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); if (!client->isGod() && targetObj->getObjVars().hasItem("timeNextCityPickRandomCitizenCommandAllowed") && (targetObj->getObjVars().getType("timeNextCityPickRandomCitizenCommandAllowed") == DynamicVariable::INT)) { int timeNextCityPickRandomCitizenCommandAllowed = 0; @@ -5142,7 +5142,7 @@ static void commandFuncCityPickRandomCitizen(Command const &, NetworkId const &a if (!params.empty()) { Unicode::UnicodeStringVector tokens; - if (Unicode::tokenize(Unicode::toLower(params), tokens, NULL, NULL) && !tokens.empty()) + if (Unicode::tokenize(Unicode::toLower(params), tokens, nullptr, nullptr) && !tokens.empty()) { static Unicode::String const paramsOnline1 = Unicode::narrowToWide("-online"); static Unicode::String const paramsOnline2 = Unicode::narrowToWide("online"); @@ -5272,7 +5272,7 @@ static void commandFuncPlaceStructure (const Command& /*command*/, const Network Object* const object = NetworkIdManager::getObjectById (actor); if (!object) { - DEBUG_WARNING (true, ("commandFuncPlaceStructure: PB null actor\n")); + DEBUG_WARNING (true, ("commandFuncPlaceStructure: PB nullptr actor\n")); return; } @@ -5478,9 +5478,9 @@ static void commandFuncPurchaseTicket (const Command& /*command*/, const Network static void commandFuncRequestResourceWeights(const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == NULL) + if (creature == nullptr) { - WARNING (true, ("commandFuncRequestResourceWeights: PB null actor")); + WARNING (true, ("commandFuncRequestResourceWeights: PB nullptr actor")); return; } @@ -5494,9 +5494,9 @@ static void commandFuncRequestResourceWeights(const Command& , const NetworkId& static void commandFuncRequestResourceWeightsBatch(const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) { CreatureObject* const creature = dynamic_cast(NetworkIdManager::getObjectById (actor)); - if (creature == NULL) + if (creature == nullptr) { - WARNING (true, ("commandFuncRequestResourceWeightsBatch: PB null actor")); + WARNING (true, ("commandFuncRequestResourceWeightsBatch: PB nullptr actor")); return; } @@ -5516,14 +5516,14 @@ static void commandFuncRequestResourceWeightsBatch(const Command& , const Networ static void commandFuncRequestDraftSlots (const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == NULL) + if (creature == nullptr) { - WARNING (true, ("commandFuncRequestDraftSlots: PB null actor")); + WARNING (true, ("commandFuncRequestDraftSlots: PB nullptr actor")); return; } PlayerObject * const player = PlayerCreatureController::getPlayerObject(creature); - if (player == NULL) + if (player == nullptr) { WARNING (true, ("commandFuncRequestDraftSlots: no player object for actor ""%s", actor.getValueString().c_str())); return; @@ -5533,7 +5533,7 @@ static void commandFuncRequestDraftSlots (const Command& , const NetworkId& acto sscanf(Unicode::wideToNarrow(params).c_str(), "%lu %lu", &serverCrc, &sharedCrc); MessageQueueDraftSlotsQueryResponse * const message = new MessageQueueDraftSlotsQueryResponse(std::make_pair(serverCrc, sharedCrc)); - if (!player->requestDraftSlots(serverCrc, NULL, message)) + if (!player->requestDraftSlots(serverCrc, nullptr, message)) { WARNING (true, ("commandFuncRequestDraftSlots failed to request draft slots for %u", serverCrc)); delete message; @@ -5545,14 +5545,14 @@ static void commandFuncRequestDraftSlots (const Command& , const NetworkId& acto static void commandFuncRequestDraftSlotsBatch (const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == NULL) + if (creature == nullptr) { - WARNING (true, ("commandFuncRequestDraftSlotsBatch: PB null actor")); + WARNING (true, ("commandFuncRequestDraftSlotsBatch: PB nullptr actor")); return; } PlayerObject * const player = PlayerCreatureController::getPlayerObject(creature); - if (player == NULL) + if (player == nullptr) { WARNING (true, ("commandFuncRequestDraftSlotsBatch: no player object for actor ""%s", actor.getValueString().c_str())); return; @@ -5575,7 +5575,7 @@ static void commandFuncRequestDraftSlotsBatch (const Command& , const NetworkId& while(uServerCrc != 0 && uSharedCrc != 0 && !done) { MessageQueueDraftSlotsQueryResponse * const message = new MessageQueueDraftSlotsQueryResponse(std::make_pair(uServerCrc, uSharedCrc)); - if (!player->requestDraftSlots(uServerCrc, NULL, message)) + if (!player->requestDraftSlots(uServerCrc, nullptr, message)) { WARNING (true, ("commandFuncRequestDraftSlotsBatch failed to request draft slots for %lu", uServerCrc)); delete message; @@ -5596,15 +5596,15 @@ static void commandFuncRequestDraftSlotsBatch (const Command& , const NetworkId& static void commandFuncRequestManfSchematicSlots (const Command& , const NetworkId& actor, const NetworkId& target, const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == NULL) + if (creature == nullptr) { - WARNING (true, ("commandFuncRequestDraftSlots: PB null actor")); + WARNING (true, ("commandFuncRequestDraftSlots: PB nullptr actor")); return; } const ManufactureSchematicObject * schematic = dynamic_cast< const ManufactureSchematicObject *>(NetworkIdManager::getObjectById(target)); - if (schematic != NULL) + if (schematic != nullptr) { schematic->requestSlots(*creature); } @@ -5615,14 +5615,14 @@ static void commandFuncRequestManfSchematicSlots (const Command& , const Network static void commandFuncRequestCraftingSession (const Command& , const NetworkId& actor, const NetworkId& target, const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == NULL) + if (creature == nullptr) { - WARNING (true, ("commandFuncRequestCraftingSession: PB null actor")); + WARNING (true, ("commandFuncRequestCraftingSession: PB nullptr actor")); return; } PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); - if (player == NULL) + if (player == nullptr) { WARNING (true, ("commandFuncRequestCraftingSession: no player object for actor " "%s", actor.getValueString().c_str())); @@ -5668,14 +5668,14 @@ static void commandFuncRequestCraftingSessionFail(Command const &, NetworkId con static void commandFuncSelectDraftSchematic (const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == NULL) + if (creature == nullptr) { - WARNING (true, ("commandFuncSelectDraftSchematic: PB null actor")); + WARNING (true, ("commandFuncSelectDraftSchematic: PB nullptr actor")); return; } PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); - if (player == NULL) + if (player == nullptr) { WARNING (true, ("commandFuncSelectDraftSchematic: no player object for actor " "%s", actor.getValueString().c_str())); @@ -5692,14 +5692,14 @@ static void commandFuncSelectDraftSchematic (const Command& , const NetworkId& a static void commandFuncNextCraftingStage(const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == NULL) + if (creature == nullptr) { - WARNING (true, ("commandFuncNextCraftingStage: PB null actor")); + WARNING (true, ("commandFuncNextCraftingStage: PB nullptr actor")); return; } PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); - if (player == NULL) + if (player == nullptr) { WARNING (true, ("commandFuncNextCraftingStage: no player object for actor " "%s", actor.getValueString().c_str())); @@ -5722,14 +5722,14 @@ static void commandFuncNextCraftingStage(const Command& , const NetworkId& actor static void commandFuncCreatePrototype(const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == NULL) + if (creature == nullptr) { - WARNING (true, ("commandFuncCreatePrototype: PB null actor")); + WARNING (true, ("commandFuncCreatePrototype: PB nullptr actor")); return; } PlayerObject * const player = PlayerCreatureController::getPlayerObject(creature); - if (player == NULL) + if (player == nullptr) { WARNING (true, ("commandFuncCreatePrototype: no player object for actor %s", actor.getValueString().c_str())); return; @@ -5756,14 +5756,14 @@ static void commandFuncCreatePrototype(const Command& , const NetworkId& actor, static void commandFuncCreateManfSchematic(const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == NULL) + if (creature == nullptr) { - WARNING (true, ("commandFuncCreateManfSchematic: PB null actor")); + WARNING (true, ("commandFuncCreateManfSchematic: PB nullptr actor")); return; } PlayerObject * const player = PlayerCreatureController::getPlayerObject(creature); - if (player == NULL) + if (player == nullptr) { WARNING (true, ("commandFuncCreateManfSchematic: no player object for actor %s", actor.getValueString().c_str())); return; @@ -5788,14 +5788,14 @@ static void commandFuncCreateManfSchematic(const Command& , const NetworkId& act static void commandFuncCancelCraftingSession(const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == NULL) + if (creature == nullptr) { - WARNING (true, ("commandFuncCancelCraftingSession: PB null actor")); + WARNING (true, ("commandFuncCancelCraftingSession: PB nullptr actor")); return; } PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); - if (player == NULL) + if (player == nullptr) { WARNING (true, ("commandFuncCancelCraftingSession: no player object for actor " "%s", actor.getValueString().c_str())); @@ -5810,14 +5810,14 @@ static void commandFuncCancelCraftingSession(const Command& , const NetworkId& a static void commandFuncStopCraftingSession(const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == NULL) + if (creature == nullptr) { - WARNING (true, ("commandFuncStopCraftingSession: PB null actor")); + WARNING (true, ("commandFuncStopCraftingSession: PB nullptr actor")); return; } PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); - if (player == NULL) + if (player == nullptr) { WARNING (true, ("commandFuncStopCraftingSession: no player object for actor " "%s", actor.getValueString().c_str())); @@ -5832,14 +5832,14 @@ static void commandFuncStopCraftingSession(const Command& , const NetworkId& act static void commandFuncRestartCraftingSession(const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == NULL) + if (creature == nullptr) { - WARNING (true, ("commandFuncRestartCraftingSession: PB null actor")); + WARNING (true, ("commandFuncRestartCraftingSession: PB nullptr actor")); return; } PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); - if (player == NULL) + if (player == nullptr) { WARNING (true, ("commandFuncRestartCraftingSession: no player object for actor " "%s", actor.getValueString().c_str())); @@ -5866,7 +5866,7 @@ static void commandFuncSetMatchMakingPersonalId(Command const &, NetworkId const PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(actor)); - if (playerObject != NULL) + if (playerObject != nullptr) { MatchMakingId matchMakingId; matchMakingId.unPackIntString(Unicode::wideToNarrow(params)); @@ -5885,7 +5885,7 @@ static void commandFuncSetMatchMakingCharacterId(Command const &, NetworkId cons PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(actor)); - if (playerObject != NULL) + if (playerObject != nullptr) { MatchMakingId matchMakingId; matchMakingId.unPackIntString(Unicode::wideToNarrow(params)); @@ -5902,7 +5902,7 @@ static void commandFuncAddFriend(Command const &, NetworkId const &actor, Networ { ServerObject * const serverObject = ServerObject::getServerObject(actor); - if (serverObject != NULL) + if (serverObject != nullptr) { size_t pos = 0; std::string name(nextStringParm(params, pos)); @@ -5924,7 +5924,7 @@ static void commandFuncRemoveFriend(Command const &, NetworkId const &actor, Net { ServerObject * const serverObject = ServerObject::getServerObject(actor); - if (serverObject != NULL) + if (serverObject != nullptr) { size_t pos = 0; std::string name(nextStringParm(params, pos)); @@ -5946,7 +5946,7 @@ static void commandFuncGetFriendList(Command const &, NetworkId const &actor, Ne { ServerObject * const serverObject = ServerObject::getServerObject(actor); - if (serverObject != NULL) + if (serverObject != nullptr) { std::string player(Chat::constructChatAvatarId(*serverObject).getFullName()); @@ -5962,7 +5962,7 @@ static void commandFuncAddIgnore(Command const &, NetworkId const &actor, Networ { ServerObject * const serverObject = ServerObject::getServerObject(actor); - if (serverObject != NULL) + if (serverObject != nullptr) { size_t pos = 0; std::string name(nextStringParm(params, pos)); @@ -5984,7 +5984,7 @@ static void commandFuncRemoveIgnore(Command const &, NetworkId const &actor, Net { ServerObject * const serverObject = ServerObject::getServerObject(actor); - if (serverObject != NULL) + if (serverObject != nullptr) { size_t pos = 0; std::string name(nextStringParm(params, pos)); @@ -6006,7 +6006,7 @@ static void commandFuncGetIgnoreList(Command const &, NetworkId const &actor, Ne { ServerObject * const serverObject = ServerObject::getServerObject(actor); - if (serverObject != NULL) + if (serverObject != nullptr) { std::string player(Chat::constructChatAvatarId(*serverObject).getFullName()); @@ -6022,7 +6022,7 @@ static void commandFuncRequestBiography(Command const &, NetworkId const &actor, { CreatureObject * const creatureObject = CreatureObject::getCreatureObject(actor); - if (creatureObject != NULL) + if (creatureObject != nullptr) { BiographyManager::requestBiography(target, creatureObject); } @@ -6069,9 +6069,9 @@ static void commandFuncSetBiography(Command const &, NetworkId const & actor, Ne static void commandFuncRequestCharacterSheetInfo(Command const &, NetworkId const &actor, NetworkId const &, Unicode::String const &) { const CreatureObject* const creatureActor = CreatureObject::getCreatureObject(actor); - if (creatureActor == NULL) + if (creatureActor == nullptr) { - WARNING (true, ("commandFuncRequestCharacterSheetInfo: null actor")); + WARNING (true, ("commandFuncRequestCharacterSheetInfo: nullptr actor")); return; } @@ -6090,7 +6090,7 @@ static void commandFuncRequestCharacterSheetInfo(Command const &, NetworkId cons if(bindId != NetworkId::cms_invalid) { const ServerObject* const bindObject = ServerObject::getServerObject(bindId); - if (bindObject != NULL) + if (bindObject != nullptr) { bindLoc = bindObject->getPosition_w(); bindPlanet = bindObject->getSceneId(); @@ -6142,7 +6142,7 @@ static void commandFuncRequestCharacterSheetInfo(Command const &, NetworkId cons houseNetworkId = cityHallOfMayorCity; const ServerObject* const resObject = ServerObject::getServerObject(houseNetworkId); - if (resObject != NULL) + if (resObject != nullptr) { resLoc = resObject->getPosition_w(); resPlanet = ServerWorld::getSceneId(); @@ -6201,13 +6201,13 @@ static void commandFuncRequestCharacterMatch(Command const &, NetworkId const &a static void commandFuncExtractObject(Command const &, NetworkId const &actor, NetworkId const & target, Unicode::String const ¶ms) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == NULL) + if (creature == nullptr) { - WARNING (true, ("commandFuncExtractObject: PB null actor")); + WARNING (true, ("commandFuncExtractObject: PB nullptr actor")); return; } - if (creature->getInventory() == NULL) + if (creature->getInventory() == nullptr) { WARNING (true, ("commandFuncExtractObject: actor %s has no inventory", actor.getValueString().c_str())); @@ -6215,9 +6215,9 @@ static void commandFuncExtractObject(Command const &, NetworkId const &actor, Ne } FactoryObject* const factory = dynamic_cast(NetworkIdManager::getObjectById (target)); - if (factory == NULL) + if (factory == nullptr) { - WARNING (true, ("commandFuncExtractObject: PB null target")); + WARNING (true, ("commandFuncExtractObject: PB nullptr target")); return; } @@ -6233,16 +6233,16 @@ static void commandFuncExtractObject(Command const &, NetworkId const &actor, Ne static void commandFuncRevokeSkill(Command const &, NetworkId const &actor, NetworkId const & target, Unicode::String const ¶ms) { CreatureObject * const creature = CreatureObject::getCreatureObject(actor); - if (creature == NULL) + if (creature == nullptr) { - WARNING (true, ("commandFuncRevokeSkill: PB null actor")); + WARNING (true, ("commandFuncRevokeSkill: PB nullptr actor")); return; } size_t pos = 0; std::string skillName = nextStringParm(params, pos); const SkillObject * skill = SkillManager::getInstance ().getSkill (skillName); - if (skill == NULL) + if (skill == nullptr) { WARNING (true, ("commandFuncRevokeSkill: can't revoke bad skill")); } @@ -6261,7 +6261,7 @@ static void commandFuncSetCurrentSkillTitle(Command const &, NetworkId const &ac CreatureObject * const creatureObject = CreatureObject::getCreatureObject(actor); PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(creatureObject); - if (playerObject != NULL) + if (playerObject != nullptr) { size_t pos = 0; std::string const &title = nextStringParm(params, pos); @@ -6378,7 +6378,7 @@ static void commandFuncSetCurrentSkillTitle(Command const &, NetworkId const &ac { SkillObject const *skillObject = (*iterSkillList); - if ( (skillObject != NULL) + if ( (skillObject != nullptr) && skillObject->isTitle() && (skillObject->getSkillName() == title)) { @@ -6402,16 +6402,16 @@ static void commandFuncSetCurrentSkillTitle(Command const &, NetworkId const &ac static void commandFuncRepair(Command const &, NetworkId const &actor, NetworkId const & target, Unicode::String const ¶ms) { CreatureObject* const creature = dynamic_cast(NetworkIdManager::getObjectById (actor)); - if (creature == NULL) + if (creature == nullptr) { - WARNING (true, ("commandFuncRepair: PB null actor")); + WARNING (true, ("commandFuncRepair: PB nullptr actor")); return; } TangibleObject* const object = dynamic_cast(NetworkIdManager::getObjectById (target)); - if (object == NULL) + if (object == nullptr) { - WARNING (true, ("commandFuncRepair: PB null target")); + WARNING (true, ("commandFuncRepair: PB nullptr target")); return; } } @@ -6424,7 +6424,7 @@ static void commandFuncToggleSearchableByCtsSourceGalaxy(Command const &, Networ PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(actor)); - if (playerObject != NULL) + if (playerObject != nullptr) { playerObject->toggleSearchableByCtsSourceGalaxy(); } @@ -6438,7 +6438,7 @@ static void commandFuncToggleDisplayLocationInSearchResults(Command const &, Net PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(actor)); - if (playerObject != NULL) + if (playerObject != nullptr) { playerObject->toggleDisplayLocationInSearchResults(); } @@ -6452,7 +6452,7 @@ static void commandFuncToggleAnonymous(Command const &, NetworkId const &actor, PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(actor)); - if (playerObject != NULL) + if (playerObject != nullptr) { playerObject->toggleAnonymous(); } @@ -6466,7 +6466,7 @@ static void commandFuncToggleHelper(Command const &, NetworkId const &actor, Net PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(actor)); - if (playerObject != NULL) + if (playerObject != nullptr) { playerObject->toggleHelper(); } @@ -6480,7 +6480,7 @@ static void commandFuncToggleRolePlay(Command const &, NetworkId const &actor, N PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(actor)); - if (playerObject != NULL) + if (playerObject != nullptr) { playerObject->toggleRolePlay(); } @@ -6493,7 +6493,7 @@ static void commandFuncToggleOutOfCharacter(Command const &, NetworkId const &ac { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(actor)); - if (playerObject != NULL) + if (playerObject != nullptr) { playerObject->toggleOutOfCharacter(); } @@ -6505,7 +6505,7 @@ static void commandFuncToggleLookingForWork(Command const &, NetworkId const &ac { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(actor)); - if (playerObject != NULL) + if (playerObject != nullptr) { playerObject->toggleLookingForWork(); } @@ -6520,7 +6520,7 @@ static void commandFuncToggleLookingForGroup(Command const &, NetworkId const &a PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(actor)); - if (playerObject != NULL) + if (playerObject != nullptr) { playerObject->toggleLookingForGroup(); } @@ -6534,7 +6534,7 @@ static void commandFuncToggleAwayFromKeyBoard(Command const &, NetworkId const & PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(actor)); - if (playerObject != NULL) + if (playerObject != nullptr) { playerObject->toggleAwayFromKeyBoard(); } @@ -6546,7 +6546,7 @@ static void commandFuncToggleDisplayingFactionRank(Command const &, NetworkId co { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(actor)); - if (playerObject != NULL) + if (playerObject != nullptr) { playerObject->toggleDisplayingFactionRank(); } @@ -6558,7 +6558,7 @@ static void commandFuncReport(Command const &, NetworkId const &actor, NetworkId { CreatureObject const * const reportingCreatureObject = CreatureObject::getCreatureObject(actor); - if (reportingCreatureObject != NULL) + if (reportingCreatureObject != nullptr) { if (ReportManager::isThrottled(actor)) { @@ -6635,16 +6635,16 @@ static void commandFuncReport(Command const &, NetworkId const &actor, NetworkId static void commandFuncNpcConversationStart(Command const &, NetworkId const &actor, NetworkId const & target, Unicode::String const ¶ms) { ServerObject * const actorObject = safe_cast(NetworkIdManager::getObjectById(actor)); - CreatureObject * const player = actorObject != NULL ? actorObject->asCreatureObject() : NULL; - if (player == NULL) + CreatureObject * const player = actorObject != nullptr ? actorObject->asCreatureObject() : nullptr; + if (player == nullptr) { DEBUG_WARNING(true, ("commandFuncNpcConversationStart: couldn't find actor")); return; } ServerObject * const npcObject = safe_cast(NetworkIdManager::getObjectById(target)); - TangibleObject * const npc = npcObject != NULL ? npcObject->asTangibleObject() : NULL; - if (npc == NULL) + TangibleObject * const npc = npcObject != nullptr ? npcObject->asTangibleObject() : nullptr; + if (npc == nullptr) { DEBUG_WARNING(true, ("commandFuncNpcConversationStart: Couldn't find npc to converse with")); return; @@ -6678,8 +6678,8 @@ static void commandFuncNpcConversationStart(Command const &, NetworkId const &ac static void commandFuncNpcConversationStop(Command const &, NetworkId const &actor, NetworkId const & target, Unicode::String const ¶ms) { ServerObject * const actorObject = safe_cast(NetworkIdManager::getObjectById(actor)); - TangibleObject * const player = actorObject != NULL ? actorObject->asTangibleObject(): NULL; - if (player == NULL) + TangibleObject * const player = actorObject != nullptr ? actorObject->asTangibleObject(): nullptr; + if (player == nullptr) { DEBUG_WARNING(true, ("commandFuncNpcConversationStop: couldn't find actor")); return; @@ -6693,7 +6693,7 @@ static void commandFuncNpcConversationSelect(Command const &, NetworkId const &a { Object * const actorObject = NetworkIdManager::getObjectById(actor); CreatureObject * const player = dynamic_cast(actorObject); - if (player == NULL) + if (player == nullptr) { DEBUG_WARNING(true, ("commandFuncNpcConversationStop: couldn't find actor")); return; @@ -6709,7 +6709,7 @@ static void commandFuncNpcConversationSelect(Command const &, NetworkId const &a static void commandFuncServerDestroyObject (Command const &, NetworkId const & actor, NetworkId const & target, Unicode::String const & params) { CreatureObject * const player = dynamic_cast (NetworkIdManager::getObjectById (actor)); - if (player == NULL) + if (player == nullptr) { DEBUG_WARNING (true, ("commandFuncServerDestroyObject: couldn't find actor")); return; @@ -6792,11 +6792,11 @@ static void commandFuncSetSpokenLanguage(Command const &, NetworkId const &actor Object * const object = NetworkIdManager::getObjectById(actor); CreatureObject * const creatureObject = dynamic_cast(object); - if (creatureObject != NULL) + if (creatureObject != nullptr) { PlayerObject *playerObject = PlayerCreatureController::getPlayerObject(creatureObject); - if (playerObject != NULL) + if (playerObject != nullptr) { size_t pos = 0; int const languageId = nextIntParm(params, pos); @@ -6831,14 +6831,14 @@ static void commandFuncUnstick(Command const &, NetworkId const &actor, NetworkI { Object * const object = NetworkIdManager::getObjectById(actor); CreatureObject * const creatureObject = dynamic_cast(object); - if (creatureObject != NULL) + if (creatureObject != nullptr) { if (!ShipObject::getContainingShipObject(creatureObject)) // no unsticking in ships { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(creatureObject); if (playerObject) { - Chat::sendSystemMessageSimple(*creatureObject, SharedStringIds::unstick_in_progress, NULL); + Chat::sendSystemMessageSimple(*creatureObject, SharedStringIds::unstick_in_progress, nullptr); if (!playerObject->getIsUnsticking()) { Vector position = creatureObject->getPosition_p(); @@ -7324,8 +7324,8 @@ static void commandFuncInstallShipComponents(Command const &, NetworkId const & //params for installShipComponent are " " Object const * const actorObj = NetworkIdManager::getObjectById(actor); - ServerObject const * const actorServerObj = actorObj ? actorObj->asServerObject() : NULL; - CreatureObject const * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : NULL; + ServerObject const * const actorServerObj = actorObj ? actorObj->asServerObject() : nullptr; + CreatureObject const * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : nullptr; if(!actorCreature) { return; @@ -7338,7 +7338,7 @@ static void commandFuncInstallShipComponents(Command const &, NetworkId const & if(!client->isGod()) { Object * const targetObj = NetworkIdManager::getObjectById(target); - ServerObject * const targetServerObj = targetObj ? targetObj->asServerObject() : NULL; + ServerObject * const targetServerObj = targetObj ? targetObj->asServerObject() : nullptr; if( !targetServerObj || ((targetServerObj->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space) && (targetServerObj->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space_npe)) ) return; @@ -7351,16 +7351,16 @@ static void commandFuncInstallShipComponents(Command const &, NetworkId const & size_t pos = 0; NetworkId const & shipId = nextOidParm(params, pos); Object * const shipObj = NetworkIdManager::getObjectById(shipId); - ServerObject * const shipServerObj = shipObj ? shipObj->asServerObject() : NULL; - ShipObject * const ship = shipServerObj ? shipServerObj->asShipObject() : NULL; + ServerObject * const shipServerObj = shipObj ? shipObj->asServerObject() : nullptr; + ShipObject * const ship = shipServerObj ? shipServerObj->asShipObject() : nullptr; if(!ship) return; ShipChassisSlotType::Type const slotType = static_cast(nextIntParm(params, pos)); NetworkId const & componentId = nextOidParm(params, pos); Object * const componentObj = NetworkIdManager::getObjectById(componentId); - ServerObject * const componentServerObj = componentObj ? componentObj->asServerObject() : NULL; - TangibleObject * const component = componentServerObj ? componentServerObj->asTangibleObject() : NULL; + ServerObject * const componentServerObj = componentObj ? componentObj->asServerObject() : nullptr; + TangibleObject * const component = componentServerObj ? componentServerObj->asTangibleObject() : nullptr; if(!component) { return; @@ -7409,8 +7409,8 @@ static void commandFuncUninstallShipComponents(Command const &, NetworkId const //params for uninstallShipComponent are " " Object * const actorObj = NetworkIdManager::getObjectById(actor); - ServerObject * const actorServerObj = actorObj ? actorObj->asServerObject() : NULL; - CreatureObject * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : NULL; + ServerObject * const actorServerObj = actorObj ? actorObj->asServerObject() : nullptr; + CreatureObject * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : nullptr; if(!actorCreature) return; ServerObject * const actorInv = actorCreature->getInventory(); @@ -7424,7 +7424,7 @@ static void commandFuncUninstallShipComponents(Command const &, NetworkId const if(!client->isGod()) { Object * const targetObj = NetworkIdManager::getObjectById(target); - ServerObject * const targetServerObj = targetObj ? targetObj->asServerObject() : NULL; + ServerObject * const targetServerObj = targetObj ? targetObj->asServerObject() : nullptr; if(!targetServerObj || ((targetServerObj->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space) && (targetServerObj->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space_npe)) ) @@ -7456,8 +7456,8 @@ static void commandFuncUninstallShipComponents(Command const &, NetworkId const size_t pos = 0; NetworkId const & shipId = nextOidParm(params, pos); Object * const shipObj = NetworkIdManager::getObjectById(shipId); - ServerObject * const shipServerObj = shipObj ? shipObj->asServerObject() : NULL; - ShipObject * const ship = shipServerObj ? shipServerObj->asShipObject() : NULL; + ServerObject * const shipServerObj = shipObj ? shipObj->asServerObject() : nullptr; + ShipObject * const ship = shipServerObj ? shipServerObj->asShipObject() : nullptr; if(!ship) return; @@ -7474,8 +7474,8 @@ static void commandFuncInsertItemIntoShipComponentSlot(Command const &, NetworkI //params for insertItemIntoShipComponentSlot are " " Object * const actorObj = NetworkIdManager::getObjectById(actor); - ServerObject * const actorServerObj = actorObj ? actorObj->asServerObject() : NULL; - CreatureObject * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : NULL; + ServerObject * const actorServerObj = actorObj ? actorObj->asServerObject() : nullptr; + CreatureObject * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : nullptr; if(!actorCreature) return; @@ -7486,7 +7486,7 @@ static void commandFuncInsertItemIntoShipComponentSlot(Command const &, NetworkI if(!client->isGod()) { Object * const targetObj = NetworkIdManager::getObjectById(target); - ServerObject * const targetServerObj = targetObj ? targetObj->asServerObject() : NULL; + ServerObject * const targetServerObj = targetObj ? targetObj->asServerObject() : nullptr; if(!targetServerObj || ((targetServerObj->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space) && (targetServerObj->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space_npe)) ) return; @@ -7499,8 +7499,8 @@ static void commandFuncInsertItemIntoShipComponentSlot(Command const &, NetworkI size_t pos = 0; NetworkId const & shipId = nextOidParm(params, pos); Object * const shipObj = NetworkIdManager::getObjectById(shipId); - ServerObject * const shipServerObj = shipObj ? shipObj->asServerObject() : NULL; - ShipObject * const ship = shipServerObj ? shipServerObj->asShipObject() : NULL; + ServerObject * const shipServerObj = shipObj ? shipObj->asServerObject() : nullptr; + ShipObject * const ship = shipServerObj ? shipServerObj->asShipObject() : nullptr; if(!ship) return; @@ -7527,8 +7527,8 @@ static void commandFuncAssociateDroidControlDeviceWithShip(Command const &, Netw //params for associateDroidControlDeviceWithShip are " " Object const * const actorObj = NetworkIdManager::getObjectById(actor); - ServerObject const * const actorServerObj = actorObj ? actorObj->asServerObject() : NULL; - CreatureObject const * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : NULL; + ServerObject const * const actorServerObj = actorObj ? actorObj->asServerObject() : nullptr; + CreatureObject const * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : nullptr; if (!actorCreature) return; @@ -7539,7 +7539,7 @@ static void commandFuncAssociateDroidControlDeviceWithShip(Command const &, Netw if(!client->isGod()) { Object * const targetObj = NetworkIdManager::getObjectById(target); - ServerObject * const targetServerObj = targetObj ? targetObj->asServerObject() : NULL; + ServerObject * const targetServerObj = targetObj ? targetObj->asServerObject() : nullptr; if(!targetServerObj || ((targetServerObj->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space) && (targetServerObj->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space_npe)) ) return; @@ -7552,8 +7552,8 @@ static void commandFuncAssociateDroidControlDeviceWithShip(Command const &, Netw size_t pos = 0; NetworkId const & shipId = nextOidParm(params, pos); Object * const shipObj = NetworkIdManager::getObjectById(shipId); - ServerObject * const shipServerObj = shipObj ? shipObj->asServerObject() : NULL; - ShipObject * const ship = shipServerObj ? shipServerObj->asShipObject() : NULL; + ServerObject * const shipServerObj = shipObj ? shipObj->asServerObject() : nullptr; + ShipObject * const ship = shipServerObj ? shipServerObj->asShipObject() : nullptr; if(!ship) return; @@ -7581,8 +7581,8 @@ static void commandFuncAssociateDroidControlDeviceWithShip(Command const &, Netw static void commandFuncServerAsteroidDataListen(Command const &, NetworkId const & actor, NetworkId const & , Unicode::String const & ) { Object const * const actorObj = NetworkIdManager::getObjectById(actor); - ServerObject const * const actorServerObj = actorObj ? actorObj->asServerObject() : NULL; - CreatureObject const * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : NULL; + ServerObject const * const actorServerObj = actorObj ? actorObj->asServerObject() : nullptr; + CreatureObject const * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : nullptr; if(!actorCreature) return; @@ -7594,8 +7594,8 @@ static void commandFuncServerAsteroidDataListen(Command const &, NetworkId const static void commandFuncServerAsteroidDataStopListening(Command const &, NetworkId const & actor, NetworkId const & , Unicode::String const & ) { Object const * const actorObj = NetworkIdManager::getObjectById(actor); - ServerObject const * const actorServerObj = actorObj ? actorObj->asServerObject() : NULL; - CreatureObject const * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : NULL; + ServerObject const * const actorServerObj = actorObj ? actorObj->asServerObject() : nullptr; + CreatureObject const * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : nullptr; if(!actorCreature) return; @@ -7621,8 +7621,8 @@ static void commandFuncBoosterOff(Command const &, NetworkId const & actor, Netw static void commandFuncSetFormation(Command const &, NetworkId const & actor, NetworkId const &, Unicode::String const & params) { Object * const o = NetworkIdManager::getObjectById(actor); - ServerObject * const so = o ? o->asServerObject() : NULL; - CreatureObject * const actorCreature = so ? so->asCreatureObject() : NULL; + ServerObject * const so = o ? o->asServerObject() : nullptr; + CreatureObject * const actorCreature = so ? so->asCreatureObject() : nullptr; if(actorCreature) { GroupObject * const group = actorCreature->getGroup(); @@ -7676,15 +7676,15 @@ static void commandFuncUnDock(Command const &, NetworkId const & actor, NetworkI { Object * const object = NetworkIdManager::getObjectById(actor); - if (object != NULL) + if (object != nullptr) { ShipObject * const shipObject = ShipObject::getContainingShipObject(object->asServerObject()); - if (shipObject != NULL) + if (shipObject != nullptr) { ShipController * const shipController = dynamic_cast(shipObject->getController()); - if (shipController != NULL) + if (shipController != nullptr) { shipController->unDock(); } @@ -7695,12 +7695,12 @@ static void commandFuncUnDock(Command const &, NetworkId const & actor, NetworkI } else { - WARNING(true, ("commandFuncUnDock() Undock requested on an object(%s) contained by a NULL ShipObject.", object->getDebugInformation().c_str())); + WARNING(true, ("commandFuncUnDock() Undock requested on an object(%s) contained by a nullptr ShipObject.", object->getDebugInformation().c_str())); } } else { - WARNING(true, ("commandFuncUnDock() Undock requested on a NULL object(%s).", actor.getValueString().c_str())); + WARNING(true, ("commandFuncUnDock() Undock requested on a nullptr object(%s).", actor.getValueString().c_str())); } } @@ -7709,7 +7709,7 @@ static void commandFuncUnDock(Command const &, NetworkId const & actor, NetworkI static void commandFuncLaunchIntoSpace(Command const &, NetworkId const & actor, NetworkId const & target, Unicode::String const & params) { ServerObject * const actorServerObj = safe_cast(NetworkIdManager::getObjectById(actor)); - CreatureObject * const actorCreature = actorServerObj != NULL ? actorServerObj->asCreatureObject() : NULL; + CreatureObject * const actorCreature = actorServerObj != nullptr ? actorServerObj->asCreatureObject() : nullptr; if(!actorCreature) { WARNING(true, ("No actorCreature in commandFuncLaunchIntoSpace")); @@ -7725,7 +7725,7 @@ static void commandFuncLaunchIntoSpace(Command const &, NetworkId const & actor, //target must be a space terminal Object const * const o = NetworkIdManager::getObjectById(target); - ServerObject const * const so = o ? o->asServerObject() : NULL; + ServerObject const * const so = o ? o->asServerObject() : nullptr; if(!so) { StringId invalidTargetId("player_utility", "target_not_server_object"); @@ -7759,7 +7759,7 @@ static void commandFuncLaunchIntoSpace(Command const &, NetworkId const & actor, return; } Object * const terminalO = NetworkIdManager::getObjectById(target); - ServerObject * const terminalSO = terminalO ? terminalO->asServerObject() : NULL; + ServerObject * const terminalSO = terminalO ? terminalO->asServerObject() : nullptr; if(terminalSO) { std::vector networkIds; @@ -7824,7 +7824,7 @@ static void commandFuncLaunchIntoSpace(Command const &, NetworkId const & actor, static void commandFuncAcceptQuest(Command const &, NetworkId const & actor, NetworkId const & target, Unicode::String const & params) { ServerObject * const actorServerObj = safe_cast(NetworkIdManager::getObjectById(actor)); - CreatureObject * const actorCreature = actorServerObj != NULL ? actorServerObj->asCreatureObject() : NULL; + CreatureObject * const actorCreature = actorServerObj != nullptr ? actorServerObj->asCreatureObject() : nullptr; if(!actorCreature) { WARNING(true, ("No actorCreature in commandFuncAcceptQuest")); @@ -7851,7 +7851,7 @@ static void commandFuncAcceptQuest(Command const &, NetworkId const & actor, Net static void commandFuncReceiveReward(Command const &, NetworkId const & actor, NetworkId const & target, Unicode::String const & params) { ServerObject * const actorServerObj = safe_cast(NetworkIdManager::getObjectById(actor)); - CreatureObject * const actorCreature = actorServerObj != NULL ? actorServerObj->asCreatureObject() : NULL; + CreatureObject * const actorCreature = actorServerObj != nullptr ? actorServerObj->asCreatureObject() : nullptr; if(!actorCreature) { WARNING(true, ("No actorCreature in commandFuncReceiveReward")); @@ -7895,7 +7895,7 @@ static void commandFuncAbandonQuest(Command const &, NetworkId const & actor, Ne if(QuestManager::isQuestAbandonable(questName)) { ServerObject * const actorServerObj = safe_cast(NetworkIdManager::getObjectById(actor)); - CreatureObject * const actorCreature = actorServerObj != NULL ? actorServerObj->asCreatureObject() : NULL; + CreatureObject * const actorCreature = actorServerObj != nullptr ? actorServerObj->asCreatureObject() : nullptr; if(actorCreature) { PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(actorCreature); @@ -7922,7 +7922,7 @@ static void commandFuncAbandonQuest(Command const &, NetworkId const & actor, Ne static void commandFuncExchangeListCredits(Command const &, NetworkId const &actor, NetworkId const &target, Unicode::String const ¶ms) { ServerObject * const actorServerObj = safe_cast(NetworkIdManager::getObjectById(actor)); - CreatureObject * const actorCreature = actorServerObj != NULL ? actorServerObj->asCreatureObject() : NULL; + CreatureObject * const actorCreature = actorServerObj != nullptr ? actorServerObj->asCreatureObject() : nullptr; if(!actorCreature) { WARNING(true, ("No actorCreature in commandFuncReceiveReward")); @@ -8680,7 +8680,7 @@ static void commandFuncOccupyUnlockedSlot(Command const &, NetworkId const &acto } // check to see if there is a cooldown is in effect for the command - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); if (!gmClient->isGod() && gm->getObjVars().hasItem("timeNextOccupyVacateUnlockedSlotCommandAllowed") && (gm->getObjVars().getType("timeNextOccupyVacateUnlockedSlotCommandAllowed") == DynamicVariable::INT)) { int timeNextOccupyVacateUnlockedSlotCommandAllowed = 0; @@ -8746,7 +8746,7 @@ static void commandFuncVacateUnlockedSlot(Command const &, NetworkId const &acto } // check to see if there is a cooldown is in effect for the command - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); if (!gmClient->isGod() && gm->getObjVars().hasItem("timeNextOccupyVacateUnlockedSlotCommandAllowed") && (gm->getObjVars().getType("timeNextOccupyVacateUnlockedSlotCommandAllowed") == DynamicVariable::INT)) { int timeNextOccupyVacateUnlockedSlotCommandAllowed = 0; @@ -8834,7 +8834,7 @@ static void commandFuncSwapUnlockedSlot(Command const &, NetworkId const &actor, } // check to see if there is a cooldown is in effect for the command - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); if (!gmClient->isGod() && gm->getObjVars().hasItem("timeNextOccupyVacateUnlockedSlotCommandAllowed") && (gm->getObjVars().getType("timeNextOccupyVacateUnlockedSlotCommandAllowed") == DynamicVariable::INT)) { int timeNextOccupyVacateUnlockedSlotCommandAllowed = 0; @@ -8902,7 +8902,7 @@ static void commandFuncPickupAllRoomItemsIntoInventory(Command const &, NetworkI return; // don't allow multiple /pickupAllRoomItemsIntoInventory and/or /dropAllInventoryItemsIntoRoom - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); int pickupDropAllItemsOperationTimeout = 0; if (targetObj->getObjVars().getItem("pickupDropAllItemsOperation.timeout", pickupDropAllItemsOperationTimeout) && (pickupDropAllItemsOperationTimeout > timeNow)) { @@ -9051,7 +9051,7 @@ static void commandFuncDropAllInventoryItemsIntoRoom(Command const &, NetworkId return; // don't allow multiple /pickupAllRoomItemsIntoInventory and/or /dropAllInventoryItemsIntoRoom - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); int pickupDropAllItemsOperationTimeout = 0; if (targetObj->getObjVars().getItem("pickupDropAllItemsOperation.timeout", pickupDropAllItemsOperationTimeout) && (pickupDropAllItemsOperationTimeout > timeNow)) { @@ -9255,7 +9255,7 @@ static void commandFuncRestoreDecorationLayout(Command const &, NetworkId const } // don't allow another restore on the pob while one is still in progress - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); int restoreDecorationOperationTimeout = 0; if (targetObj->getObjVars().getItem("restoreDecorationOperation.timeout", restoreDecorationOperationTimeout) && (restoreDecorationOperationTimeout > timeNow)) { @@ -9330,7 +9330,7 @@ static void commandFuncAreaPickRandomPlayer(Command const &, NetworkId const &ac if (!client) return; - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); if (!client->isGod() && targetObj->getObjVars().hasItem("timeNextAreaPickRandomPlayerCommandAllowed") && (targetObj->getObjVars().getType("timeNextAreaPickRandomPlayerCommandAllowed") == DynamicVariable::INT)) { int timeNextAreaPickRandomPlayerCommandAllowed = 0; @@ -9352,7 +9352,7 @@ static void commandFuncAreaPickRandomPlayer(Command const &, NetworkId const &ac if (!params.empty()) { Unicode::UnicodeStringVector tokens; - if (Unicode::tokenize(Unicode::toLower(params), tokens, NULL, NULL) && !tokens.empty()) + if (Unicode::tokenize(Unicode::toLower(params), tokens, nullptr, nullptr) && !tokens.empty()) { static Unicode::String const paramsPoint1 = Unicode::narrowToWide("-point"); static Unicode::String const paramsPoint2 = Unicode::narrowToWide("point"); @@ -9477,7 +9477,7 @@ static void commandFuncRoomPickRandomPlayer(Command const &, NetworkId const &ac if (!client) return; - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); if (!client->isGod() && targetObj->getObjVars().hasItem("timeNextRoomPickRandomPlayerCommandAllowed") && (targetObj->getObjVars().getType("timeNextRoomPickRandomPlayerCommandAllowed") == DynamicVariable::INT)) { int timeNextRoomPickRandomPlayerCommandAllowed = 0; @@ -9498,7 +9498,7 @@ static void commandFuncRoomPickRandomPlayer(Command const &, NetworkId const &ac if (!params.empty()) { Unicode::UnicodeStringVector tokens; - if (Unicode::tokenize(Unicode::toLower(params), tokens, NULL, NULL) && !tokens.empty()) + if (Unicode::tokenize(Unicode::toLower(params), tokens, nullptr, nullptr) && !tokens.empty()) { static Unicode::String const paramsPoint1 = Unicode::narrowToWide("-point"); static Unicode::String const paramsPoint2 = Unicode::narrowToWide("point"); diff --git a/engine/server/library/serverGame/src/shared/command/CommandQueue.cpp b/engine/server/library/serverGame/src/shared/command/CommandQueue.cpp index d581b8ae..913fa7e0 100755 --- a/engine/server/library/serverGame/src/shared/command/CommandQueue.cpp +++ b/engine/server/library/serverGame/src/shared/command/CommandQueue.cpp @@ -309,11 +309,11 @@ void CommandQueue::executeCommandQueue() { CommandQueueEntry &entry = *(m_queue.begin()); - // try to recover from having a null command + // try to recover from having a nullptr command // maybe this should result in a fatal error? if ( entry.m_command == 0 ) { - WARNING( true, ( "executeCommandQueue: entry.m_command was NULL! WTF?\n" ) ); + WARNING( true, ( "executeCommandQueue: entry.m_command was nullptr! WTF?\n" ) ); m_queue.pop(); m_state = State_Waiting; m_nextEventTime = 0.f; @@ -387,7 +387,7 @@ void CommandQueue::executeCommandQueue() // switch state might have removed elements from the queue and invalidated entry // so we can't assume that we're still safe - if(!m_queue.empty() && (&(*(m_queue.begin())) == &entry) && m_queue.begin()->m_command != NULL) + if(!m_queue.empty() && (&(*(m_queue.begin())) == &entry) && m_queue.begin()->m_command != nullptr) { handleEntryRemoved(*(m_queue.begin()), true); m_queue.pop(); @@ -458,7 +458,7 @@ void CommandQueue::updateClient(TimerClass timerClass ) { CreatureObject * const creatureOwner = getServerOwner().asCreatureObject(); - if ( (creatureOwner == NULL) + if ( (creatureOwner == nullptr) || !creatureOwner->getClient()) { return; @@ -475,7 +475,7 @@ void CommandQueue::updateClient(TimerClass timerClass ) if ( entry.m_command == 0 ) // woah that's bad news! { - WARNING( true, ( "CommandQueue::updateClient(): command was NULL!\n" ) ); + WARNING( true, ( "CommandQueue::updateClient(): command was nullptr!\n" ) ); return; } @@ -539,7 +539,7 @@ void CommandQueue::notifyClient() { CreatureObject * const creatureOwner = getServerOwner().asCreatureObject(); - if ( (creatureOwner == NULL) + if ( (creatureOwner == nullptr) || !creatureOwner->getClient()) { return; @@ -555,7 +555,7 @@ void CommandQueue::notifyClient() if ( entry.m_command == 0 ) { - WARNING( true, ( "CommandQueue::notifyClient(): command was NULL!\n" ) ); + WARNING( true, ( "CommandQueue::notifyClient(): command was nullptr!\n" ) ); return; } @@ -612,7 +612,7 @@ bool CommandQueue::doWarmupTrigger(const CommandQueueEntry &entry ) CreatureObject * const creatureOwner = getServerOwner().asCreatureObject(); - if (creatureOwner != NULL) + if (creatureOwner != nullptr) { creatureOwner->doWarmupChecks( *entry.m_command, entry.m_targetId, entry.m_params, m_status, m_statusDetail ); @@ -620,7 +620,7 @@ bool CommandQueue::doWarmupTrigger(const CommandQueueEntry &entry ) if ( m_status == Command::CEC_Success ) { - FATAL( entry.m_command == 0, ( "entry had a null command\n" ) ); + FATAL( entry.m_command == 0, ( "entry had a nullptr command\n" ) ); std::vector timeValues; timeValues.push_back( entry.m_command->m_warmTime ); @@ -659,7 +659,7 @@ uint32 CommandQueue::getCurrentCommand() const if ( entry.m_command == 0 ) { - WARNING( true, ( "CommandQueue::getCurrentCommand(): command was NULL!\n" ) ); + WARNING( true, ( "CommandQueue::getCurrentCommand(): command was nullptr!\n" ) ); return 0; } @@ -680,7 +680,7 @@ void CommandQueue::switchState() if ( entry.m_command == 0 ) { - WARNING( true, ( "CommandQueue::switchState(): command was NULL!\n" ) ); + WARNING( true, ( "CommandQueue::switchState(): command was nullptr!\n" ) ); return; } @@ -726,7 +726,7 @@ void CommandQueue::switchState() bool const targetIsAuthoritative = target && target->isAuthoritative(); REPORT_LOG(true, ("CommandQueue::switchState():QUEUE_ENTRY_COMMAND: commandName=[%s] commandHash=[%lu] owner=[%s][%s][%s] target=[%s][%s][%s] sequenceId=[%lu] params=[%s] clearable=[%s] priority=[%d]\n", - entryCopy.m_command ? entryCopy.m_command->m_commandName.c_str() : "NULL", + entryCopy.m_command ? entryCopy.m_command->m_commandName.c_str() : "nullptr", entryCopy.m_command ? entryCopy.m_command->m_commandHash : 0, NameManager::getInstance().getPlayerName(getOwner().getNetworkId()).c_str(), getOwner().getNetworkId().getValueString().c_str(), @@ -746,7 +746,7 @@ void CommandQueue::switchState() for (; itEntry != m_queue.end(); ++itEntry) { - REPORT_LOG(true, ("CommandQueue::switchState():QUEUE_ENTRY_QUEUE: commandName=[%s]\n", itEntry->m_command ? itEntry->m_command->m_commandName.c_str() : "NULL")); + REPORT_LOG(true, ("CommandQueue::switchState():QUEUE_ENTRY_QUEUE: commandName=[%s]\n", itEntry->m_command ? itEntry->m_command->m_commandName.c_str() : "nullptr")); } } #endif @@ -838,7 +838,7 @@ void CommandQueue::switchState() bool const targetIsAuthoritative = target && target->isAuthoritative(); REPORT_LOG(true, ("CommandQueue::switchState():QUEUE_ENTRY_COMMAND: commandName=[%s] commandHash=[%lu] owner=[%s][%s][%s] target=[%s][%s][%s] sequenceId=[%lu] params=[%s] clearable=[%s] priority=[%d]\n", - entryCopy.m_command ? entryCopy.m_command->m_commandName.c_str() : "NULL", + entryCopy.m_command ? entryCopy.m_command->m_commandName.c_str() : "nullptr", entryCopy.m_command ? entryCopy.m_command->m_commandHash : 0, NameManager::getInstance().getPlayerName(getOwner().getNetworkId()).c_str(), getOwner().getNetworkId().getValueString().c_str(), @@ -858,7 +858,7 @@ void CommandQueue::switchState() for (; itEntry != m_queue.end(); ++itEntry) { - REPORT_LOG(true, ("CommandQueue::switchState():QUEUE_ENTRY_QUEUE: commandName=[%s]\n", itEntry->m_command ? itEntry->m_command->m_commandName.c_str() : "NULL")); + REPORT_LOG(true, ("CommandQueue::switchState():QUEUE_ENTRY_QUEUE: commandName=[%s]\n", itEntry->m_command ? itEntry->m_command->m_commandName.c_str() : "nullptr")); } } #endif @@ -1160,7 +1160,7 @@ void CommandQueue::notifyClientOfCommandRemoval(uint32 sequenceId, float waitTim CreatureObject * const creatureOwner = getServerOwner().asCreatureObject(); - if ( (creatureOwner != NULL) + if ( (creatureOwner != nullptr) && creatureOwner->getClient() && (sequenceId != 0)) { @@ -1359,7 +1359,7 @@ void CommandQueue::executeCommand(Command const &command, NetworkId const &targe CreatureObject * const creatureOwner = getServerOwner().asCreatureObject(); - if (creatureOwner != NULL) + if (creatureOwner != nullptr) { CreatureController * const creatureController = creatureOwner->getCreatureController(); if (creatureController && creatureController->getSecureTrade()) @@ -1399,7 +1399,7 @@ void CommandQueue::executeCommand(Command const &command, NetworkId const &targe TangibleObject * const tangibleOwner = getServerOwner().asTangibleObject(); - if (tangibleOwner != NULL) + if (tangibleOwner != nullptr) { // Really execute the command - swap targets if necessary, and call // forceExecuteCommand (which will handle messaging if not authoritative) @@ -1440,7 +1440,7 @@ CommandQueue * CommandQueue::getCommandQueue(Object & object) { Property * const property = object.getProperty(getClassPropertyId()); - return (property != NULL) ? (static_cast(property)) : NULL; + return (property != nullptr) ? (static_cast(property)) : nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/command/CommandQueue.h b/engine/server/library/serverGame/src/shared/command/CommandQueue.h index bedf3717..03c861e0 100755 --- a/engine/server/library/serverGame/src/shared/command/CommandQueue.h +++ b/engine/server/library/serverGame/src/shared/command/CommandQueue.h @@ -218,7 +218,7 @@ public: void resetCooldowns(); // debug diagnostic - void spew(std::string * output = NULL); + void spew(std::string * output = nullptr); private: CommandQueue(CommandQueue const &); diff --git a/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesMarket.cpp b/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesMarket.cpp index d2d55dfd..7529726f 100755 --- a/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesMarket.cpp +++ b/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesMarket.cpp @@ -201,7 +201,7 @@ namespace CommoditiesMarketNamespace Container::ContainerErrorCode tmp = Container::CEC_Success; ServerObject *bazaarContainer = auctionContainer.getBazaarContainer(); - if (!bazaarContainer || !ContainerInterface::canTransferTo(bazaarContainer, item, NULL, tmp)) + if (!bazaarContainer || !ContainerInterface::canTransferTo(bazaarContainer, item, nullptr, tmp)) { errorCode = ar_INVALID_ITEM_ID; } @@ -326,7 +326,7 @@ bool CommoditiesMarketNamespace::isVendorItemRestriction(ServerObject const & it return false; } - ItemRestriction const * itemRestriction = NULL; + ItemRestriction const * itemRestriction = nullptr; std::map::const_iterator const iterFind = itemRestrictionList.find(itemRestrictionFile); if (iterFind != itemRestrictionList.end()) @@ -1068,7 +1068,7 @@ void CommoditiesMarket::getCommoditiesServerConnection() if (ObjectIdManager::hasAvailableObjectId()) { s_market = new CommoditiesServerConnection(ConfigServerGame::getCommoditiesServerServiceBindInterface(), static_cast(ConfigServerGame::getCommoditiesServerServiceBindPort())); - s_timeMarketConnectionCreated = ::time(NULL); + s_timeMarketConnectionCreated = ::time(nullptr); } } @@ -1082,10 +1082,10 @@ int CommoditiesMarket::getCommoditiesServerConnectionAgeSeconds() if (s_timeMarketConnectionCreated <= 0) return 0; - if (s_market == NULL) + if (s_market == nullptr) return 0; - return static_cast(::time(NULL) - s_timeMarketConnectionCreated); + return static_cast(::time(nullptr) - s_timeMarketConnectionCreated); } // ---------------------------------------------------------------------- @@ -1295,7 +1295,7 @@ void CommoditiesMarket::onAddAuction(int sequence, int32 result, const NetworkId CreatureObject * const auctionCreator = dynamic_cast(NetworkIdManager::getObjectById(auctionOwnerId)); ServerObject * const item = dynamic_cast(NetworkIdManager::getObjectById(itemId)); - Client *client = NULL; + Client *client = nullptr; if (auctionCreator) client = auctionCreator->getClient(); @@ -1347,7 +1347,7 @@ void CommoditiesMarket::onAddAuction(int sequence, int32 result, const NetworkId if (container) { Container::ContainerErrorCode tmp = Container::CEC_Success; - bool result = ContainerInterface::transferItemToVolumeContainer(*container,*item, NULL, tmp); + bool result = ContainerInterface::transferItemToVolumeContainer(*container,*item, nullptr, tmp); if (!result) { LOG("CustomerService", ("Auction: Player %s transfer of item (%Ld) to auction container (%Ld) failed with code %d", @@ -2536,7 +2536,7 @@ void CommoditiesMarket::checkPendingLoads(const NetworkId &itemId) bool transferAllowed = true; Container::ContainerErrorCode error = Container::CEC_Success; - transferAllowed = ContainerInterface::canTransferTo(targetContainer, *item, NULL, error); + transferAllowed = ContainerInterface::canTransferTo(targetContainer, *item, nullptr, error); if (!transferAllowed) { @@ -2603,11 +2603,11 @@ void CommoditiesMarket::onGetItemReply(int32 result, int32 requestId, NetworkId LOG("AuctionRetrieval", ("CommoditiesMarket::received onGetItemReply for loading object %s for retrieval", itemId.getValueString().c_str())); AuctionResult auctionResult = ar_OK; CreatureObject *player = dynamic_cast(NetworkIdManager::getObjectById(itemOwnerId)); - Client *client = player ? player->getClient() : NULL; + Client *client = player ? player->getClient() : nullptr; bool transactionFailed = false; - ServerObject* vendor = NULL; - ServerObject* item = NULL; + ServerObject* vendor = nullptr; + ServerObject* item = nullptr; if (result == ARC_AuctionDoesNotExist) { @@ -2637,7 +2637,7 @@ void CommoditiesMarket::onGetItemReply(int32 result, int32 requestId, NetworkId vendor = safe_cast(ContainerInterface::getContainedByObject(*item)); if (vendor && vendor->getNetworkId() == location) { - bool retval = ContainerInterface::transferItemToVolumeContainer(*inventory, *item, NULL, tmp, false); + bool retval = ContainerInterface::transferItemToVolumeContainer(*inventory, *item, nullptr, tmp, false); if (retval) { @@ -2779,7 +2779,7 @@ void CommoditiesMarket::onIsVendorOwner(const NetworkId & requesterId, const Net ServerObject * const auctionContainer = safe_cast(NetworkIdManager::getObjectById(container)); NetworkId resultContainer = container; - const TangibleObject * resultContainerObject = auctionContainer ? auctionContainer->asTangibleObject() : NULL; + const TangibleObject * resultContainerObject = auctionContainer ? auctionContainer->asTangibleObject() : nullptr; if (auctionContainer) { marketName = getLocationString(*auctionContainer); @@ -2952,7 +2952,7 @@ void CommoditiesMarket::onGetItemDetailsReply(int32 result, int32 requestId, Net OutOfBandBase *base = *it; if (!base) { - WARNING(true, ("NULL OOB Base for Auction Data")); + WARNING(true, ("nullptr OOB Base for Auction Data")); return; } if (base->getTypeId() == OutOfBandPackager::OT_auctionToken) @@ -2979,7 +2979,7 @@ void CommoditiesMarket::onGetItemDetailsReply(int32 result, int32 requestId, Net base = *it; if (!base) { - WARNING(true, ("NULL OOB Base for Auction Data")); + WARNING(true, ("nullptr OOB Base for Auction Data")); return; } if (base->getTypeId() == OutOfBandPackager::OT_objectAttributes) @@ -3624,22 +3624,22 @@ void CommoditiesMarket::updateItemTypeMap(int itemTypeMapVersionNumber, int item // get the server template const ObjectTemplate * ot = ObjectTemplateList::fetch(static_cast(itemTemplateId)); - if (ot != NULL) + if (ot != nullptr) { objectName = StringId(std::string(ot->getName())); // get the shared template const ServerObjectTemplate * serverOt = ot->asServerObjectTemplate(); - if (serverOt != NULL) + if (serverOt != nullptr) { const std::string sharedTemplateName(serverOt->getSharedTemplate()); serverOt->releaseReference(); - serverOt = NULL; + serverOt = nullptr; ot = ObjectTemplateList::fetch(sharedTemplateName); - if (ot != NULL) + if (ot != nullptr) { const SharedObjectTemplate * sharedOt = ot->asSharedObjectTemplate(); - if (sharedOt != NULL) + if (sharedOt != nullptr) { gameObjectType = static_cast(sharedOt->getGameObjectType()); StringId const tempObjectName(objectName); @@ -3649,19 +3649,19 @@ void CommoditiesMarket::updateItemTypeMap(int itemTypeMapVersionNumber, int item objectName = tempObjectName; } sharedOt->releaseReference(); - sharedOt = NULL; + sharedOt = nullptr; } else { ot->releaseReference(); - ot = NULL; + ot = nullptr; } } } else { ot->releaseReference(); - ot = NULL; + ot = nullptr; } } else diff --git a/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesServerConnection.cpp b/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesServerConnection.cpp index 1b7b95c9..ad3ff41c 100755 --- a/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesServerConnection.cpp +++ b/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesServerConnection.cpp @@ -576,7 +576,7 @@ void CommoditiesServerConnection::onReceive(const Archive::ByteStream & message) ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(response.getValue().first.first, diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserAi.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserAi.cpp index 65298e93..994b695b 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserAi.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserAi.cpp @@ -74,7 +74,7 @@ CreatureObject * const ConsoleCommandParserAiNamespace::getAiCreatureObject(Crea CreatureObject * const aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId); - if ( (aiCreatureObject == NULL) + if ( (aiCreatureObject == nullptr) || aiCreatureObject->isPlayerControlled()) { Chat::sendSystemMessage(user, Unicode::narrowToWide(FormattedString<1024>().sprintf("[FAILURE] Unable to resolve %s to an AI", aiNetworkId.getValueString().c_str())), Unicode::emptyString); @@ -113,7 +113,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { CreatureObject * const userCreatureObject = CreatureObject::getCreatureObject(userId); - if (userCreatureObject == NULL) + if (userCreatureObject == nullptr) { result += getErrorMessage(argv[0], ERR_FAIL); } @@ -121,7 +121,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { CreatureObject * const aiCreatureObject = getAiCreatureObject(*userCreatureObject, argv); - if (aiCreatureObject == NULL) + if (aiCreatureObject == nullptr) { result += getErrorMessage(argv[0], ERR_FAIL); } @@ -129,7 +129,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(aiCreatureObject->getController()); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { Chat::sendSystemMessage(*userCreatureObject, Unicode::narrowToWide(fs.sprintf("[FAILURE] Unable to resolve %s to an AI", aiCreatureObject->getNetworkId().getValueString().c_str())), Unicode::emptyString); result += getErrorMessage(argv[0], ERR_FAIL); @@ -148,7 +148,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { CreatureObject * const userCreatureObject = CreatureObject::getCreatureObject(userId); - if (userCreatureObject == NULL) + if (userCreatureObject == nullptr) { result += getErrorMessage(argv[0], ERR_FAIL); } @@ -167,7 +167,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri AICreatureController * const aiCreatureController = AICreatureController::getAiCreatureController(targetNetworkId); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { result = Unicode::narrowToWide(fs.sprintf("[FAILURE] Unable to resolve %s to an AI\n", targetNetworkId.getValueString().c_str())); result += getErrorMessage(argv[0], ERR_FAIL); @@ -190,7 +190,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { CellProperty const * const cellProperty = creatureOwner->getParentCell(); - if (cellProperty != NULL) + if (cellProperty != nullptr) { Vector const & position_p = creatureOwner->getPosition_p(); @@ -245,13 +245,13 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri TangibleObject const * const hateTargetTangibleObject = TangibleObject::asTangibleObject(hateTarget.getObject()); float const hate = iterHateList->second; std::string hateTargetName; - if (hateTargetTangibleObject != NULL) + if (hateTargetTangibleObject != nullptr) { hateTargetName = Unicode::wideToNarrow(hateTargetTangibleObject->getEncodedObjectName()).c_str(); } else { - hateTargetName = "NULL"; + hateTargetName = "nullptr"; } result += Unicode::narrowToWide(fs.sprintf("%s:%s(%.1f)\n", hateTargetName.c_str(), hateTarget.getValueString().c_str(), hate)); @@ -271,13 +271,13 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri CachedNetworkId const hateTarget(iter->first); TangibleObject const * const hateTargetTangibleObject = TangibleObject::asTangibleObject(hateTarget.getObject()); std::string hateTargetName; - if (hateTargetTangibleObject != NULL) + if (hateTargetTangibleObject != nullptr) { hateTargetName = Unicode::wideToNarrow(hateTargetTangibleObject->getEncodedObjectName()).c_str(); } else { - hateTargetName = "NULL"; + hateTargetName = "nullptr"; } result += Unicode::narrowToWide(fs.sprintf("%s:%s (%.2f, %lu, %lu)\n", hateTargetName.c_str(), hateTarget.getValueString().c_str(), iter->second.first, iter->second.second.first, iter->second.second.second)); @@ -295,7 +295,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { CreatureObject * const userCreatureObject = CreatureObject::getCreatureObject(userId); - if (userCreatureObject == NULL) + if (userCreatureObject == nullptr) { result += getErrorMessage(argv[0], ERR_FAIL); } @@ -313,7 +313,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri } TangibleObject const * const to = TangibleObject::asTangibleObject(NetworkIdManager::getObjectById(targetNetworkId)); - if (to == NULL) + if (to == nullptr) { result += Unicode::narrowToWide(fs.sprintf("Target %s not found or not TangibleObject\n", targetNetworkId.getValueString().c_str())); } @@ -342,13 +342,13 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri TangibleObject const * const hateTargetTangibleObject = TangibleObject::asTangibleObject(hateTarget.getObject()); float const hate = iterHateList->second; std::string hateTargetName; - if (hateTargetTangibleObject != NULL) + if (hateTargetTangibleObject != nullptr) { hateTargetName = Unicode::wideToNarrow(hateTargetTangibleObject->getEncodedObjectName()).c_str(); } else { - hateTargetName = "NULL"; + hateTargetName = "nullptr"; } result += Unicode::narrowToWide(fs.sprintf("%s:%s(%.1f)\n", hateTargetName.c_str(), hateTarget.getValueString().c_str(), hate)); @@ -368,13 +368,13 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri CachedNetworkId const hateTarget(iter->first); TangibleObject const * const hateTargetTangibleObject = TangibleObject::asTangibleObject(hateTarget.getObject()); std::string hateTargetName; - if (hateTargetTangibleObject != NULL) + if (hateTargetTangibleObject != nullptr) { hateTargetName = Unicode::wideToNarrow(hateTargetTangibleObject->getEncodedObjectName()).c_str(); } else { - hateTargetName = "NULL"; + hateTargetName = "nullptr"; } result += Unicode::narrowToWide(fs.sprintf("%s:%s (%.2f, %lu, %lu)\n", hateTargetName.c_str(), hateTarget.getValueString().c_str(), iter->second.first, iter->second.second.first, iter->second.second.second)); @@ -390,7 +390,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { CreatureObject * const userCreatureObject = CreatureObject::getCreatureObject(userId); - if (userCreatureObject == NULL) + if (userCreatureObject == nullptr) { result += getErrorMessage(argv[0], ERR_FAIL); } @@ -398,7 +398,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { CreatureObject * const aiCreatureObject = getAiCreatureObject(*userCreatureObject, argv); - if (aiCreatureObject == NULL) + if (aiCreatureObject == nullptr) { result += getErrorMessage(argv[0], ERR_FAIL); } @@ -416,7 +416,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { CreatureObject * const userCreatureObject = CreatureObject::getCreatureObject(userId); - if (userCreatureObject == NULL) + if (userCreatureObject == nullptr) { result += getErrorMessage(argv[0], ERR_FAIL); } @@ -424,7 +424,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { CreatureObject * const aiCreatureObject = getAiCreatureObject(*userCreatureObject, argv); - if (aiCreatureObject == NULL) + if (aiCreatureObject == nullptr) { result += getErrorMessage(argv[0], ERR_FAIL); } @@ -442,14 +442,14 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { CreatureObject * const userCreatureObject = CreatureObject::getCreatureObject(userId); - if (userCreatureObject == NULL) + if (userCreatureObject == nullptr) { result += getErrorMessage(argv[0], ERR_FAIL); } else { NetworkId aiNetworkId; - CreatureObject * aiCreatureObject = NULL; + CreatureObject * aiCreatureObject = nullptr; if (argv.size() > 2) { @@ -458,7 +458,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri aiNetworkId = NetworkId(Unicode::wideToNarrow(argv[1])); aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId); - if ( (aiCreatureObject != NULL) + if ( (aiCreatureObject != nullptr) && !aiCreatureObject->isPlayerControlled()) { aiCreatureObject->setBaseWalkSpeed(Unicode::toFloat(argv[2])); @@ -471,14 +471,14 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri aiNetworkId = userCreatureObject->getLookAtTarget(); aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId); - if ( (aiCreatureObject != NULL) + if ( (aiCreatureObject != nullptr) && !aiCreatureObject->isPlayerControlled()) { aiCreatureObject->setBaseWalkSpeed(Unicode::toFloat(argv[1])); } } - if ( (aiCreatureObject == NULL) + if ( (aiCreatureObject == nullptr) || aiCreatureObject->isPlayerControlled()) { Chat::sendSystemMessage(*userCreatureObject, Unicode::narrowToWide(fs.sprintf("[FAILURE] Unable to resolve %s to an AI", aiNetworkId.getValueString().c_str())), Unicode::emptyString); @@ -495,14 +495,14 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { CreatureObject * const userCreatureObject = CreatureObject::getCreatureObject(userId); - if (userCreatureObject == NULL) + if (userCreatureObject == nullptr) { result += getErrorMessage(argv[0], ERR_FAIL); } else { NetworkId aiNetworkId; - CreatureObject * aiCreatureObject = NULL; + CreatureObject * aiCreatureObject = nullptr; if (argv.size() > 2) { @@ -511,7 +511,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri aiNetworkId = NetworkId(Unicode::wideToNarrow(argv[1])); aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId); - if ( (aiCreatureObject != NULL) + if ( (aiCreatureObject != nullptr) && !aiCreatureObject->isPlayerControlled()) { aiCreatureObject->setBaseRunSpeed(Unicode::toFloat(argv[2])); @@ -524,14 +524,14 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri aiNetworkId = userCreatureObject->getLookAtTarget(); aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId); - if ( (aiCreatureObject != NULL) + if ( (aiCreatureObject != nullptr) && !aiCreatureObject->isPlayerControlled()) { aiCreatureObject->setBaseRunSpeed(Unicode::toFloat(argv[1])); } } - if ( (aiCreatureObject == NULL) + if ( (aiCreatureObject == nullptr) || aiCreatureObject->isPlayerControlled()) { Chat::sendSystemMessage(*userCreatureObject, Unicode::narrowToWide(fs.sprintf("[FAILURE] Unable to resolve %s to an AI", aiNetworkId.getValueString().c_str())), Unicode::emptyString); @@ -549,7 +549,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { CreatureObject * const userCreatureObject = CreatureObject::getCreatureObject(userId); - if (userCreatureObject != NULL) + if (userCreatureObject != nullptr) { NetworkId sparedAiNetworkId; @@ -573,9 +573,9 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri for (int i = 0; i < serverObjectCount; ++i) { ServerObject * const serverObject = ServerWorld::getObject(i); - CreatureObject * const creatureObject = (serverObject != NULL) ? serverObject->asCreatureObject() : NULL; + CreatureObject * const creatureObject = (serverObject != nullptr) ? serverObject->asCreatureObject() : nullptr; - if ( (creatureObject != NULL) + if ( (creatureObject != nullptr) && !creatureObject->isDead() && !creatureObject->isPlayerControlled() && (creatureObject->getNetworkId() != sparedAiNetworkId)) @@ -597,10 +597,10 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri else if (isAbbrev(argv[0], "debug")) { Object * const object = NetworkIdManager::getObjectById(userId); - ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; int temp; - if (serverObject != NULL) + if (serverObject != nullptr) { if ( serverObject->getObjVars().getItem("ai_debug_string", temp) && (temp > 0)) @@ -621,7 +621,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri Client * const client = serverObject->getClient(); - if (client != NULL) + if (client != nullptr) { AiDebugString aiDebugString; aiDebugString.enableClearClientFlag(); @@ -650,9 +650,9 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri else if (isAbbrev(argv[0], "debugText")) { Object * const object = NetworkIdManager::getObjectById(userId); - ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - if (serverObject != NULL) + if (serverObject != nullptr) { AiDebugString::setTextEnabled(!AiDebugString::isTextEnabled()); diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCity.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCity.cpp index 7b4af2ef..5a89f47e 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCity.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCity.cpp @@ -415,7 +415,7 @@ bool ConsoleCommandParserCity::performParsing (const NetworkId & userId, const S } else { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[3]).c_str()) - 1; diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCollection.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCollection.cpp index 442bc622..7397c1e8 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCollection.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCollection.cpp @@ -63,21 +63,21 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -172,21 +172,21 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -249,21 +249,21 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -326,21 +326,21 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -403,21 +403,21 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -466,21 +466,21 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -529,21 +529,21 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -592,21 +592,21 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -719,21 +719,21 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -776,7 +776,7 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c else if (isCommand (argv [0], "setServerFirstTime")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[3]).c_str()) - 1; diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCraft.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCraft.cpp index 6a28b3eb..51b45c94 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCraft.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCraft.cpp @@ -151,7 +151,7 @@ bool ConsoleCommandParserCraft::performParsing (const NetworkId & userId, const else if (isAbbrev( argv [0], "enableSchematicFilter")) { - if (creatureObject->getClient() == NULL || !creatureObject->getClient()->isGod()) + if (creatureObject->getClient() == nullptr || !creatureObject->getClient()->isGod()) result += getErrorMessage (argv[0], ERR_FAIL); else { @@ -164,7 +164,7 @@ bool ConsoleCommandParserCraft::performParsing (const NetworkId & userId, const else if (isAbbrev( argv [0], "disableSchematicFilter")) { - if (creatureObject->getClient() == NULL || !creatureObject->getClient()->isGod()) + if (creatureObject->getClient() == nullptr || !creatureObject->getClient()->isGod()) result += getErrorMessage (argv[0], ERR_FAIL); else { diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCraftStation.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCraftStation.cpp index cc9bebd7..e3a443db 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCraftStation.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCraftStation.cpp @@ -53,19 +53,19 @@ bool ConsoleCommandParserCraftStation::performParsing (const NetworkId & userId, { /* // get the station TangibleObject * station = getStation(argv, result); - if (station == NULL) + if (station == nullptr) return true; // get the ingredient NetworkId ingredientId(Unicode::wideToNarrow (argv[2])); ServerObject * object = ServerWorld::findObjectByNetworkId(ingredientId); - if (object == NULL) + if (object == nullptr) { result += getErrorMessage (argv [0], ERR_INVALID_INGREDIENT); return true; } TangibleObject * ingredient = dynamic_cast(object); - if (ingredient == NULL) + if (ingredient == nullptr) { result += getErrorMessage (argv [0], ERR_INVALID_INGREDIENT); return true; @@ -82,19 +82,19 @@ bool ConsoleCommandParserCraftStation::performParsing (const NetworkId & userId, { /* // get the station TangibleObject * station = getStation(argv, result); - if (station == NULL) + if (station == nullptr) return true; // get the ingredient NetworkId ingredientId(Unicode::wideToNarrow (argv[2])); ServerObject * object = ServerWorld::findObjectByNetworkId(ingredientId); - if (object == NULL) + if (object == nullptr) { result += getErrorMessage (argv [0], ERR_INVALID_INGREDIENT); return true; } TangibleObject * ingredient = dynamic_cast(object); - if (ingredient == NULL) + if (ingredient == nullptr) { result += getErrorMessage (argv [0], ERR_INVALID_INGREDIENT); return true; @@ -112,13 +112,13 @@ bool ConsoleCommandParserCraftStation::performParsing (const NetworkId & userId, /* // get the station NetworkId id(Unicode::wideToNarrow (argv[1])); ServerObject * object = ServerWorld::findObjectByNetworkId(id); - if (object == NULL) + if (object == nullptr) { result += getErrorMessage (argv [0], ERR_INVALID_OBJECT); return true; } TangibleObject * station = dynamic_cast(object); - if (station == NULL) + if (station == nullptr) { result += getErrorMessage (argv [0], ERR_INVALID_OBJECT); return true; @@ -144,33 +144,33 @@ bool ConsoleCommandParserCraftStation::performParsing (const NetworkId & userId, /** * Finds the crafting station for a given id. * - * @return the station or NULL on error + * @return the station or nullptr on error */ TangibleObject * ConsoleCommandParserCraftStation::getStation(const StringVector_t & argv, String_t & result) { NetworkId id(Unicode::wideToNarrow (argv[1])); ServerObject * object = ServerWorld::findObjectByNetworkId(id); - if (object == NULL) + if (object == nullptr) { result += getErrorMessage (argv [0], ERR_INVALID_OBJECT); - return NULL; + return nullptr; } TangibleObject * station = dynamic_cast(object); - if (station == NULL) + if (station == nullptr) { result += getErrorMessage (argv [0], ERR_INVALID_OBJECT); - return NULL; + return nullptr; } // make sure the station is a atation and that it isn't in use if (!station->getObjVars().hasItem("crafting.station")) { result += getErrorMessage (argv [0], ERR_INVALID_STATION); - return NULL; + return nullptr; } if (station->getObjVars().hasItem("crafting.crafter")) { result += getErrorMessage (argv [0], ERR_STATION_IN_USE); - return NULL; + return nullptr; } return station; } // ConsoleCommandParserCraftStation::getStation diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserGuild.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserGuild.cpp index f2ca6349..3484d6c2 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserGuild.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserGuild.cpp @@ -1218,17 +1218,17 @@ bool ConsoleCommandParserGuild::performParsing (const NetworkId & userId, const { // new guild leader is not a guild member, so make a guild member first, then make guild leader ServerObject const* o = dynamic_cast(ServerWorld::findObjectByNetworkId(leaderOid)); - CreatureObject const* c = (o ? o->asCreatureObject() : NULL); - PlayerObject const* p = (c ? PlayerCreatureController::getPlayerObject(c) : NULL); - if (o == NULL) + CreatureObject const* c = (o ? o->asCreatureObject() : nullptr); + PlayerObject const* p = (c ? PlayerCreatureController::getPlayerObject(c) : nullptr); + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); } - else if (c == NULL) + else if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); } - else if (p == NULL) + else if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); } diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserManufacture.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserManufacture.cpp index 1b405dd1..d8af83e3 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserManufacture.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserManufacture.cpp @@ -64,7 +64,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, ManufactureInstallationObject * station = dynamic_cast(stationId.getObject()); ServerObject * ingredient = safe_cast(ingredientId.getObject()); - if (station == NULL || ingredient == NULL) + if (station == nullptr || ingredient == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -77,7 +77,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, } ServerObject * hopper = station->getInputHopper(); - if (hopper == NULL) + if (hopper == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -99,7 +99,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, ManufactureInstallationObject * station = dynamic_cast(stationId.getObject()); ServerObject * ingredient = safe_cast(ingredientId.getObject()); - if (station == NULL || ingredient == NULL) + if (station == nullptr || ingredient == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -112,7 +112,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, } ServerObject * hopper = station->getInputHopper(); - if (hopper == NULL) + if (hopper == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -124,7 +124,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, return true; } - if (playerObject->getInventory() == NULL) + if (playerObject->getInventory() == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -144,7 +144,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, ManufactureInstallationObject * station = dynamic_cast(stationId.getObject()); - if (station == NULL) + if (station == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -157,14 +157,14 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, } ServerObject * hopper = station->getInputHopper(); - if (hopper == NULL) + if (hopper == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } VolumeContainer * container = ContainerInterface::getVolumeContainer(*hopper); - if (container == NULL) + if (container == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -174,7 +174,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, while (iter != container->end()) { const Container::ContainedItem & itemId = *iter; - if (itemId.getObject() != NULL) + if (itemId.getObject() != nullptr) { const ServerObject * item = safe_cast(itemId.getObject()); result += Unicode::narrowToWide("("); @@ -182,7 +182,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, result += Unicode::narrowToWide(") - "); const ResourceContainerObject * crate = dynamic_cast< const ResourceContainerObject *>(item); - if (crate != NULL) + if (crate != nullptr) { char buffer[32]; _itoa(crate->getQuantity(), buffer, 10); @@ -226,7 +226,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, ManufactureInstallationObject * station = dynamic_cast(stationId.getObject()); ManufactureSchematicObject * schematic = dynamic_cast(schematicId.getObject()); - if (station == NULL || schematic == NULL) + if (station == nullptr || schematic == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -239,7 +239,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, } // if (station->addSchematic(*schematic, playerObject)) - if (station->addSchematic(*schematic, NULL)) + if (station->addSchematic(*schematic, nullptr)) result += getErrorMessage(argv[0], ERR_SUCCESS); else result += getErrorMessage(argv[0], ERR_INVALID_CONTAINER_TRANSFER); @@ -253,7 +253,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, ManufactureInstallationObject * station = dynamic_cast(stationId.getObject()); - if (station == NULL) + if (station == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -266,9 +266,9 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, } ManufactureSchematicObject * schematic = station->getSchematic(); - if (schematic != NULL) + if (schematic != nullptr) { - if (playerObject->getDatapad() == NULL) + if (playerObject->getDatapad() == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -291,7 +291,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, ManufactureInstallationObject * station = dynamic_cast(stationId.getObject()); - if (station == NULL) + if (station == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -304,7 +304,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, } ManufactureSchematicObject * schematic = station->getSchematic(); - if (schematic != NULL) + if (schematic != nullptr) { result += Unicode::narrowToWide("("); result += Unicode::narrowToWide(schematic->getNetworkId().getValueString()); @@ -325,7 +325,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, ManufactureInstallationObject * station = dynamic_cast(stationId.getObject()); - if (station == NULL) + if (station == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); } @@ -344,7 +344,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, ManufactureInstallationObject * station = dynamic_cast(stationId.getObject()); - if (station == NULL) + if (station == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); } @@ -360,7 +360,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, else if (isAbbrev( argv [0], "getObjects")) { ServerObject * myInventory = playerObject->getInventory(); - if (myInventory == NULL) + if (myInventory == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -370,21 +370,21 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, ManufactureInstallationObject * station = dynamic_cast(stationId.getObject()); - if (station == NULL) + if (station == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } ServerObject * hopper = station->getOutputHopper(); - if (hopper == NULL) + if (hopper == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } VolumeContainer * container = ContainerInterface::getVolumeContainer(*hopper); - if (container == NULL) + if (container == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -394,7 +394,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, while (iter != container->end()) { const Container::ContainedItem & itemId = *iter; - if (itemId.getObject() != NULL) + if (itemId.getObject() != nullptr) { ContainerInterface::transferItemToVolumeContainer (*myInventory, *safe_cast(itemId.getObject()), playerObject, tmp); } @@ -419,21 +419,21 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, ManufactureInstallationObject * station = dynamic_cast(stationId.getObject()); - if (station == NULL) + if (station == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } ServerObject * hopper = station->getOutputHopper(); - if (hopper == NULL) + if (hopper == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } VolumeContainer * container = ContainerInterface::getVolumeContainer(*hopper); - if (container == NULL) + if (container == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -443,7 +443,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, while (iter != container->end()) { const Container::ContainedItem & itemId = *iter; - if (itemId.getObject() != NULL) + if (itemId.getObject() != nullptr) { const ServerObject * item = safe_cast(itemId.getObject()); result += Unicode::narrowToWide("("); diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserMoney.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserMoney.cpp index 33801387..feff5d1e 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserMoney.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserMoney.cpp @@ -58,7 +58,7 @@ bool ConsoleCommandParserMoney::performParsing (const NetworkId & userId, const { NetworkId sourceId(Unicode::wideToNarrow (argv[1])); NetworkId targetId(Unicode::wideToNarrow (argv[2])); - int amount(strtoul(Unicode::wideToNarrow (argv[3]).c_str (), NULL, 10)); + int amount(strtoul(Unicode::wideToNarrow (argv[3]).c_str (), nullptr, 10)); ServerObject* source = dynamic_cast(NetworkIdManager::getObjectById(sourceId)); if (!source) @@ -75,7 +75,7 @@ bool ConsoleCommandParserMoney::performParsing (const NetworkId & userId, const { NetworkId sourceId(Unicode::wideToNarrow (argv[1])); NetworkId targetId(Unicode::wideToNarrow (argv[2])); - int amount(strtoul(Unicode::wideToNarrow (argv[3]).c_str (), NULL, 10)); + int amount(strtoul(Unicode::wideToNarrow (argv[3]).c_str (), nullptr, 10)); ServerObject* source = dynamic_cast(NetworkIdManager::getObjectById(sourceId)); if (!source) @@ -91,7 +91,7 @@ bool ConsoleCommandParserMoney::performParsing (const NetworkId & userId, const else if (isAbbrev( argv [0], "namedTransfer")) { NetworkId sourceId(Unicode::wideToNarrow (argv[1])); - int amount(strtol(Unicode::wideToNarrow (argv[3]).c_str (), NULL, 10)); + int amount(strtol(Unicode::wideToNarrow (argv[3]).c_str (), nullptr, 10)); ServerObject* source = dynamic_cast(NetworkIdManager::getObjectById(sourceId)); if (!source) @@ -117,7 +117,7 @@ bool ConsoleCommandParserMoney::performParsing (const NetworkId & userId, const else if (isAbbrev( argv [0], "withdraw")) { NetworkId sourceId(Unicode::wideToNarrow (argv[1])); - int amount(strtoul(Unicode::wideToNarrow (argv[2]).c_str (), NULL, 10)); + int amount(strtoul(Unicode::wideToNarrow (argv[2]).c_str (), nullptr, 10)); ServerObject* source = dynamic_cast(NetworkIdManager::getObjectById(sourceId)); if (!source) @@ -133,7 +133,7 @@ bool ConsoleCommandParserMoney::performParsing (const NetworkId & userId, const else if (isAbbrev( argv [0], "deposit")) { NetworkId sourceId(Unicode::wideToNarrow (argv[1])); - int amount(strtoul(Unicode::wideToNarrow (argv[2]).c_str (), NULL, 10)); + int amount(strtoul(Unicode::wideToNarrow (argv[2]).c_str (), nullptr, 10)); ServerObject* source = dynamic_cast(NetworkIdManager::getObjectById(sourceId)); if (!source) @@ -175,7 +175,7 @@ bool ConsoleCommandParserMoney::performParsing (const NetworkId & userId, const } else if (isAbbrev( argv [0], "setGalacticReserve")) { - int const newGalacticReserve(strtoul(Unicode::wideToNarrow (argv[2]).c_str (), NULL, 10)); + int const newGalacticReserve(strtoul(Unicode::wideToNarrow (argv[2]).c_str (), nullptr, 10)); if ((newGalacticReserve < 0) || (newGalacticReserve > ConfigServerGame::getMaxGalacticReserveDepositBillion())) { result += Unicode::narrowToWide(FormattedString<1024>().sprintf("specified galactic reserve balance (%d) must be in the (inclusive) range (0, %d)\n", newGalacticReserve, ConfigServerGame::getMaxGalacticReserveDepositBillion())); diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserNpc.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserNpc.cpp index 929f6413..71f81106 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserNpc.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserNpc.cpp @@ -52,19 +52,19 @@ bool ConsoleCommandParserNpc::performParsing (const NetworkId & userId, const St NetworkId const oid(Unicode::wideToNarrow(argv[1])); ServerObject * const object = ServerWorld::findObjectByNetworkId(oid); - if (object == NULL) + if (object == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } TangibleObject * const npc = object->asTangibleObject(); - if (npc == NULL) + if (npc == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - playerObject->startNpcConversation(*npc, NULL, NpcConversationData::CS_Player, 0); + playerObject->startNpcConversation(*npc, nullptr, NpcConversationData::CS_Player, 0); result += getErrorMessage (argv[0], ERR_SUCCESS); } @@ -82,7 +82,7 @@ bool ConsoleCommandParserNpc::performParsing (const NetworkId & userId, const St else if (isAbbrev( argv [0], "respond")) { TangibleObject * const playerObject = safe_cast(ServerWorld::findObjectByNetworkId(userId)); - int const response = strtol(Unicode::wideToNarrow(argv[1]).c_str (), NULL, 10); + int const response = strtol(Unicode::wideToNarrow(argv[1]).c_str (), nullptr, 10); playerObject->respondToNpc(response); result += getErrorMessage (argv[0], ERR_SUCCESS); } diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserObject.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserObject.cpp index ed626f69..a092fc3a 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserObject.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserObject.cpp @@ -119,23 +119,23 @@ namespace ConsoleCommandParserObjectNamespace { WARNING(true, ("ConsoleCommandParserObject invalid object template [%s]", templateName.c_str())); ot->releaseReference(); - return NULL; + return nullptr; } if (sot->getId() == ServerShipObjectTemplate::ServerShipObjectTemplate_tag) { SharedObjectTemplate const * const sharedTemplate = safe_cast(ObjectTemplateList::fetch(sot->getSharedTemplate())); - if (NULL == sharedTemplate || + if (nullptr == sharedTemplate || (sharedTemplate->getGameObjectType() != SharedObjectTemplate::GOT_ship_mining_asteroid_dynamic && sharedTemplate->getGameObjectType() != SharedObjectTemplate::GOT_ship_mining_asteroid_static)) { ot->releaseReference(); - return NULL; + return nullptr; } } return sot; } - return NULL; + return nullptr; } void checkBadBuildClusterObject(ServerObject *& o) @@ -523,7 +523,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject const * const obj = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (obj == NULL) + if (obj == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -531,7 +531,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const Client const * const client = obj->getClient(); - if(client == NULL) + if(client == nullptr) { result += Unicode::narrowToWide("specified object is not a client object\n"); return true; @@ -561,7 +561,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const } const char *objectTemplateName = obj->getObjectTemplateName(); - result += Unicode::narrowToWide(FormattedString<512>().sprintf("object %s (%s) has %d total opened objects\n", obj->getNetworkId().getValueString().c_str(), (objectTemplateName ? objectTemplateName : "NULL object template"), opened.size())); + result += Unicode::narrowToWide(FormattedString<512>().sprintf("object %s (%s) has %d total opened objects\n", obj->getNetworkId().getValueString().c_str(), (objectTemplateName ? objectTemplateName : "nullptr object template"), opened.size())); if(!text.empty()) { @@ -615,7 +615,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const ServerObject * const object = dynamic_cast(NetworkIdManager::getObjectById(oid)); if (object) { - uint32 const pid = (strtoul(Unicode::wideToNarrow(argv[2]).c_str (), NULL, 10)); + uint32 const pid = (strtoul(Unicode::wideToNarrow(argv[2]).c_str (), nullptr, 10)); GenericValueTypeMessage > const msg( "RequestAuthTransfer", std::make_pair( @@ -646,9 +646,9 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const } real x,y,z; - x = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), NULL)); - y = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL)); - z = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), NULL)); + x = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), nullptr)); + y = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr)); + z = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), nullptr)); ServerObject *newObject = 0; ServerObjectTemplate const * const ot = getObjectTemplateForCreation(tmpString); @@ -706,9 +706,9 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const } real x,y,z; - x = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), NULL)); - y = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL)); - z = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), NULL)); + x = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), nullptr)); + y = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr)); + z = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), nullptr)); // check to see if we're in a region we shouldn't be building in if ( ConfigServerGame::getBlockBuildRegionPlacement() ) @@ -726,10 +726,10 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const } real quatW,quatX,quatY,quatZ; - quatW = static_cast(strtod(Unicode::wideToNarrow(argv[5]).c_str(), NULL)); - quatX = static_cast(strtod(Unicode::wideToNarrow(argv[6]).c_str(), NULL)); - quatY = static_cast(strtod(Unicode::wideToNarrow(argv[7]).c_str(), NULL)); - quatZ = static_cast(strtod(Unicode::wideToNarrow(argv[8]).c_str(), NULL)); + quatW = static_cast(strtod(Unicode::wideToNarrow(argv[5]).c_str(), nullptr)); + quatX = static_cast(strtod(Unicode::wideToNarrow(argv[6]).c_str(), nullptr)); + quatY = static_cast(strtod(Unicode::wideToNarrow(argv[7]).c_str(), nullptr)); + quatZ = static_cast(strtod(Unicode::wideToNarrow(argv[8]).c_str(), nullptr)); ServerObject * const cell = safe_cast(ContainerInterface::getContainingCellObject(*playerObject)); @@ -934,7 +934,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const NetworkId oid(Unicode::wideToNarrow(argv[2])); ServerObject* object = dynamic_cast(NetworkIdManager::getObjectById(oid)); - if (object == NULL) + if (object == nullptr) { //container does not exist result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); @@ -994,7 +994,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId cellId(Unicode::wideToNarrow(argv[2])); ServerObject* cell = dynamic_cast(NetworkIdManager::getObjectById(cellId)); - if (cell == NULL && cellId != NetworkId::cms_invalid) + if (cell == nullptr && cellId != NetworkId::cms_invalid) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1011,9 +1011,9 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const } real x,y,z; - x = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL)); - y = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), NULL)); - z = static_cast(strtod(Unicode::wideToNarrow(argv[5]).c_str(), NULL)); + x = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr)); + y = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), nullptr)); + z = static_cast(strtod(Unicode::wideToNarrow(argv[5]).c_str(), nullptr)); ServerObject *newObject = 0; ServerObjectTemplate const * const ot = getObjectTemplateForCreation(tmpString); @@ -1070,22 +1070,22 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const NetworkId cellId(Unicode::wideToNarrow(argv[2])); ServerObject * const cell = safe_cast(NetworkIdManager::getObjectById(cellId)); - if (cell == NULL && cellId != NetworkId::cms_invalid) + if (cell == nullptr && cellId != NetworkId::cms_invalid) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } real x,y,z; - x = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL)); - y = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), NULL)); - z = static_cast(strtod(Unicode::wideToNarrow(argv[5]).c_str(), NULL)); + x = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr)); + y = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), nullptr)); + z = static_cast(strtod(Unicode::wideToNarrow(argv[5]).c_str(), nullptr)); real quatW,quatX,quatY,quatZ; - quatW = static_cast(strtod(Unicode::wideToNarrow(argv[6]).c_str(), NULL)); - quatX = static_cast(strtod(Unicode::wideToNarrow(argv[7]).c_str(), NULL)); - quatY = static_cast(strtod(Unicode::wideToNarrow(argv[8]).c_str(), NULL)); - quatZ = static_cast(strtod(Unicode::wideToNarrow(argv[9]).c_str(), NULL)); + quatW = static_cast(strtod(Unicode::wideToNarrow(argv[6]).c_str(), nullptr)); + quatX = static_cast(strtod(Unicode::wideToNarrow(argv[7]).c_str(), nullptr)); + quatY = static_cast(strtod(Unicode::wideToNarrow(argv[8]).c_str(), nullptr)); + quatZ = static_cast(strtod(Unicode::wideToNarrow(argv[9]).c_str(), nullptr)); ServerObject *newObject = 0; ServerObjectTemplate const * const ot = getObjectTemplateForCreation(tmpString); @@ -1165,7 +1165,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject* object = dynamic_cast(NetworkIdManager::getObjectById(oid)); - if (object == NULL) + if (object == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1200,7 +1200,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject* object = dynamic_cast(NetworkIdManager::getObjectById(oid)); - if (object == NULL) + if (object == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1236,7 +1236,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const const NetworkId oid (Unicode::wideToNarrow(argv[1])); ServerObject* const object = safe_cast(NetworkIdManager::getObjectById(oid)); - if (object == NULL) + if (object == nullptr) result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); else if (object->getClient()) result += getErrorMessage(argv[0], ERR_INVALID_USER); @@ -1268,7 +1268,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const ServerObject* const object = safe_cast(NetworkIdManager::getObjectById(oid)); - if (object == NULL) + if (object == nullptr) result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); // ---------- @@ -1279,11 +1279,11 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { ServerObject * object = ServerWorld::getObject(i); - if(object == NULL) continue; + if(object == nullptr) continue; CreatureObject * creature = object->asCreatureObject(); - if(creature == NULL) continue; + if(creature == nullptr) continue; if(creature->getNetworkId() == oid) continue; @@ -1307,11 +1307,11 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { ServerObject * object = ServerWorld::getObject(i); - if(object == NULL) continue; + if(object == nullptr) continue; CreatureObject * creature = object->asCreatureObject(); - if(creature == NULL) continue; + if(creature == nullptr) continue; if(creature->getParentCell() != CellProperty::getWorldCellProperty()) continue; @@ -1331,9 +1331,9 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); Vector pos; - pos.x = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), NULL)); - pos.y = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL)); - pos.z = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), NULL)); + pos.x = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), nullptr)); + pos.y = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr)); + pos.z = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), nullptr)); // disallow certain object types from being "move" bool allowMove = true; @@ -1418,7 +1418,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject* o = ServerWorld::findObjectByNetworkId(oid); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1433,9 +1433,9 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); real r,p,y; - r = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), NULL)); - p = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL)); - y = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), NULL)); + r = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), nullptr)); + p = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr)); + y = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), nullptr)); if (rotateObject(oid, r, p, y)) { result += getErrorMessage(argv[0], ERR_SUCCESS); @@ -1450,7 +1450,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject* o = ServerWorld::findObjectByNetworkId(oid); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1479,7 +1479,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const // erase keys assigned to this player. s_playerCreatureNameMap.erase(userId); - if (dataTable != NULL) + if (dataTable != nullptr) { StringVector creatureStrings; { @@ -1548,7 +1548,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId const oid(Unicode::wideToNarrow(argv[1])); ServerObject* const o = ServerWorld::findObjectByNetworkId(oid); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1580,7 +1580,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - o->deletePobPersistedContents(NULL, DeleteReasons::God); + o->deletePobPersistedContents(nullptr, DeleteReasons::God); result += getErrorMessage(argv[0], ERR_SUCCESS); } else if (isCommand( argv[0], "moveItemInHouseToMe")) @@ -1607,7 +1607,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); TangibleObject* vendor = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (vendor == NULL) + if (vendor == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1621,7 +1621,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); TangibleObject* vendor = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (vendor == NULL) + if (vendor == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1699,13 +1699,13 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); CreatureObject* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } real scale; - scale = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), NULL)); + scale = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), nullptr)); o->setMovementScale(scale); result += getErrorMessage(argv[0], ERR_SUCCESS); } @@ -1716,13 +1716,13 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); CreatureObject* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } real scale; - scale = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), NULL)); + scale = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), nullptr)); o->setScaleFactor(scale); result += getErrorMessage(argv[0], ERR_SUCCESS); } @@ -1765,7 +1765,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject* o = ServerWorld::findObjectByNetworkId(oid); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1788,13 +1788,13 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { CachedNetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(oid.getObject()); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } Container const * const container = ContainerInterface::getContainer(*o); - if (container == NULL) + if (container == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1811,7 +1811,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = ServerWorld::findObjectByNetworkId(oid); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1846,7 +1846,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = ServerWorld::findObjectByNetworkId(oid); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1881,7 +1881,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = ServerWorld::findObjectByNetworkId(oid); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1914,7 +1914,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); TangibleObject* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1940,7 +1940,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); const ServerObject* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1976,7 +1976,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const ServerMessageForwarding::end(); - if (ObjectTemplateList::reload(templateFile) == NULL) + if (ObjectTemplateList::reload(templateFile) == nullptr) { result += getErrorMessage(argv[0], ERR_TEMPLATE_NOT_LOADED); return true; @@ -1991,7 +1991,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); CreatureObject * creature = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (creature == NULL || !creature->isIncapacitated()) + if (creature == nullptr || !creature->isIncapacitated()) result += Unicode::narrowToWide("no"); else if (creature->isDead()) result += Unicode::narrowToWide("dead"); @@ -2011,11 +2011,11 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const LocationData d; d.name = argv[2]; Vector pos; - pos.x = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL)); - pos.y = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), NULL)); - pos.z = static_cast(strtod(Unicode::wideToNarrow(argv[5]).c_str(), NULL)); + pos.x = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr)); + pos.y = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), nullptr)); + pos.z = static_cast(strtod(Unicode::wideToNarrow(argv[5]).c_str(), nullptr)); d.location.setCenter(pos); - float radius = static_cast(strtod(Unicode::wideToNarrow(argv[6]).c_str(), NULL)); + float radius = static_cast(strtod(Unicode::wideToNarrow(argv[6]).c_str(), nullptr)); d.location.setRadius(radius); o->addLocationTarget(d); } @@ -2079,7 +2079,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const oid.getObject()); const CreatureObject * creature = dynamic_cast( tangible); - if (creature != NULL) + if (creature != nullptr) { char buffer[1024]; sprintf(buffer, "he:%d, co=%d, ac=%d, st=%d, mi=%d, wi=%d", @@ -2091,7 +2091,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const creature->getAttribute(Attributes::Willpower)); result += Unicode::narrowToWide(buffer); } - else if (tangible != NULL) + else if (tangible != nullptr) { char buffer[1024]; sprintf(buffer, "max hp = %d, damage taken = %d", @@ -2156,13 +2156,13 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const bool value = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), 0, 10) != 0; ServerObject * const o = dynamic_cast(ServerWorld::findObjectByNetworkId(actorId)); - CreatureObject * const c = (o ? o->asCreatureObject() : NULL); - if (o == NULL) + CreatureObject * const c = (o ? o->asCreatureObject() : nullptr); + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; @@ -2261,7 +2261,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const const char *objectTemplateName = obj->getObjectTemplateName(); - result += Unicode::narrowToWide(FormattedString<512>().sprintf("object %s (%s) has %d total observers (%d observers on this game server)\n", obj->getNetworkId().getValueString().c_str(), (objectTemplateName ? objectTemplateName : "NULL object template"), obj->getObserversCount(), observerList.size())); + result += Unicode::narrowToWide(FormattedString<512>().sprintf("object %s (%s) has %d total observers (%d observers on this game server)\n", obj->getNetworkId().getValueString().c_str(), (objectTemplateName ? objectTemplateName : "nullptr object template"), obj->getObserversCount(), observerList.size())); if (!observers.empty()) { @@ -2560,7 +2560,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const else if(isCommand(argv[0], "setPathLinkDistance")) { - float dist = static_cast(strtod(Unicode::wideToNarrow(argv[1]).c_str(), NULL)); + float dist = static_cast(strtod(Unicode::wideToNarrow(argv[1]).c_str(), nullptr)); CityPathGraphManager::setLinkDistance(dist); @@ -2601,7 +2601,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { CachedNetworkId const oid(Unicode::wideToNarrow(argv[1])); TangibleObject * object = dynamic_cast(oid.getObject()); - if (object == NULL) + if (object == nullptr) result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); else { @@ -2619,7 +2619,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { CachedNetworkId const oid(Unicode::wideToNarrow(argv[1])); TangibleObject * object = dynamic_cast(oid.getObject()); - if (object == NULL) + if (object == nullptr) result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); else { @@ -2653,7 +2653,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const ServerObject * object = dynamic_cast(oid.getObject()); CreatureObject * creature = dynamic_cast(object); - if (object == NULL) + if (object == nullptr) result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); else { @@ -2694,7 +2694,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const NetworkId oid(Unicode::wideToNarrow(argv[1])); CreatureObject *creature = dynamic_cast(NetworkIdManager::getObjectById(oid)); - PlayerObject *player = NULL; + PlayerObject *player = nullptr; if (creature) player = PlayerCreatureController::getPlayerObject(creature); if (player) @@ -2739,7 +2739,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const NetworkId oid(Unicode::wideToNarrow(argv[1])); CreatureObject *creature = dynamic_cast(NetworkIdManager::getObjectById(oid)); - PlayerObject *player = NULL; + PlayerObject *player = nullptr; if (creature) player = PlayerCreatureController::getPlayerObject(creature); if (player) @@ -2864,7 +2864,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); const InstallationObject* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -2888,7 +2888,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const NetworkId oid(Unicode::wideToNarrow(argv[1])); InstallationObject* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -2904,7 +2904,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); const InstallationObject* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -2928,7 +2928,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const NetworkId oid(Unicode::wideToNarrow(argv[1])); InstallationObject* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -3056,7 +3056,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject *o = safe_cast(NetworkIdManager::getObjectById(oid)); - if (o != NULL && o->asCreatureObject() != NULL && o->isPlayerControlled()) + if (o != nullptr && o->asCreatureObject() != nullptr && o->isPlayerControlled()) { CreatureObject * creatureTarget = o->asCreatureObject(); @@ -3068,7 +3068,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const for (CreatureObject::SkillList::const_iterator i = skills.begin(); i != skills.end(); ++i) { const SkillObject * profession = (*i)->findProfessionForSkill(); - if (profession != NULL) + if (profession != nullptr) professionName = profession->getSkillName(); } } @@ -3317,7 +3317,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const NetworkId oid (Unicode::wideToNarrow(argv[1])); ServerObject* const object = safe_cast(NetworkIdManager::getObjectById(oid)); - if (object == NULL) + if (object == nullptr) result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); else if (!object->getClient()) result += getErrorMessage(argv[0], ERR_INVALID_USER); @@ -3346,7 +3346,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const NetworkId ownerId (Unicode::wideToNarrow(argv[2])); ServerObject * const object = safe_cast(NetworkIdManager::getObjectById(houseId)); - TangibleObject * const tangible = object ? object->asTangibleObject() : NULL; + TangibleObject * const tangible = object ? object->asTangibleObject() : nullptr; if (!tangible) result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); else @@ -3359,7 +3359,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { ServerObject * object = safe_cast(NetworkIdManager::getObjectById(playerObject->getLookAtTarget())); - if (NULL == object) + if (nullptr == object) object = playerObject; RegionMaster::RegionVector rv; @@ -3373,7 +3373,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const for (RegionMaster::RegionVector::const_iterator it = rv.begin(); it != rv.end(); ++it) { Region const * const r = *it; - if (NULL != r) + if (nullptr != r) { _itoa(r->getGeography(), buf, 10); result += Unicode::narrowToWide(buf); @@ -3390,7 +3390,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { ServerObject * const target = safe_cast(NetworkIdManager::getObjectById(playerObject->getLookAtTarget())); - if (NULL == target) + if (nullptr == target) { result += Unicode::narrowToWide("Invalid target"); return true; @@ -3434,7 +3434,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const ServerObject * object = safe_cast(NetworkIdManager::getObjectById(playerObject->getLookAtTarget())); - if (NULL == object) + if (nullptr == object) object = playerObject; Vector const & pos_w = object->getPosition_w(); @@ -3449,7 +3449,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { ServerObject * object = safe_cast(NetworkIdManager::getObjectById(playerObject->getLookAtTarget())); - if (NULL == object) + if (nullptr == object) object = playerObject; Vector const & pos_w = object->getPosition_w(); @@ -3463,7 +3463,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { ServerObject * object = safe_cast(NetworkIdManager::getObjectById(playerObject->getLookAtTarget())); - if (NULL == object) + if (nullptr == object) object = playerObject; Vector const & pos_w = object->getPosition_w(); @@ -3477,7 +3477,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); const ServerObject* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -3503,7 +3503,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); const ServerObject* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -3576,13 +3576,13 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject const* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - CreatureObject const* c = (o ? o->asCreatureObject() : NULL); - if (o == NULL) + CreatureObject const* c = (o ? o->asCreatureObject() : nullptr); + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - else if (c == NULL) + else if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; @@ -3590,7 +3590,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const else { PlayerObject const* p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -3612,8 +3612,8 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - CreatureObject* c = (o ? o->asCreatureObject() : NULL); - if (o == NULL) + CreatureObject* c = (o ? o->asCreatureObject() : nullptr); + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -3623,7 +3623,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const result += Unicode::narrowToWide("specified object is not authoritative on this game server\n"); return true; } - else if (c == NULL) + else if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; @@ -3631,7 +3631,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const else { PlayerObject* p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -3668,20 +3668,20 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - CreatureObject * c = (o ? o->asCreatureObject() : NULL); - if (o == NULL) + CreatureObject * c = (o ? o->asCreatureObject() : nullptr); + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - else if (c == NULL) + else if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -3755,14 +3755,14 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject const* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } TangibleObject const* t = o->asTangibleObject(); - if (t == NULL) + if (t == nullptr) { result += Unicode::narrowToWide("specified object is not a tangible object\n"); return true; @@ -3797,14 +3797,14 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId sourceOid(Unicode::wideToNarrow(argv[1])); ServerObject * sourceSo = dynamic_cast(ServerWorld::findObjectByNetworkId(sourceOid)); - if (sourceSo == NULL) + if (sourceSo == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is an invalid object\n", sourceOid.getValueString().c_str())); return true; } TangibleObject * sourceTo = sourceSo->asTangibleObject(); - if (sourceTo == NULL) + if (sourceTo == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is not a tangible object\n", sourceOid.getValueString().c_str())); return true; @@ -3812,14 +3812,14 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const NetworkId targetOid(Unicode::wideToNarrow(argv[2])); ServerObject * targetSo = dynamic_cast(ServerWorld::findObjectByNetworkId(targetOid)); - if (targetSo == NULL) + if (targetSo == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is an invalid object\n", targetOid.getValueString().c_str())); return true; } TangibleObject * targetTo = targetSo->asTangibleObject(); - if (targetTo == NULL) + if (targetTo == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is not a tangible object\n", targetOid.getValueString().c_str())); return true; @@ -3839,14 +3839,14 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId sourceOid(Unicode::wideToNarrow(argv[1])); ServerObject * sourceSo = dynamic_cast(ServerWorld::findObjectByNetworkId(sourceOid)); - if (sourceSo == NULL) + if (sourceSo == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is an invalid object\n", sourceOid.getValueString().c_str())); return true; } TangibleObject * sourceTo = sourceSo->asTangibleObject(); - if (sourceTo == NULL) + if (sourceTo == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is not a tangible object\n", sourceOid.getValueString().c_str())); return true; @@ -3866,14 +3866,14 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId sourceOid(Unicode::wideToNarrow(argv[1])); ServerObject * sourceSo = dynamic_cast(ServerWorld::findObjectByNetworkId(sourceOid)); - if (sourceSo == NULL) + if (sourceSo == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is an invalid object\n", sourceOid.getValueString().c_str())); return true; } TangibleObject * sourceTo = sourceSo->asTangibleObject(); - if (sourceTo == NULL) + if (sourceTo == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is not a tangible object\n", sourceOid.getValueString().c_str())); return true; @@ -3891,14 +3891,14 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId sourceOid(Unicode::wideToNarrow(argv[1])); ServerObject const * sourceSo = dynamic_cast(ServerWorld::findObjectByNetworkId(sourceOid)); - if (sourceSo == NULL) + if (sourceSo == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is an invalid object\n", sourceOid.getValueString().c_str())); return true; } CreatureObject const * sourceCo = sourceSo->asCreatureObject(); - if (sourceCo == NULL) + if (sourceCo == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is not a creature object\n", sourceOid.getValueString().c_str())); return true; @@ -3915,14 +3915,14 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId sourceOid(Unicode::wideToNarrow(argv[1])); ServerObject * sourceSo = dynamic_cast(ServerWorld::findObjectByNetworkId(sourceOid)); - if (sourceSo == NULL) + if (sourceSo == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is an invalid object\n", sourceOid.getValueString().c_str())); return true; } CreatureObject * sourceCo = sourceSo->asCreatureObject(); - if (sourceCo == NULL) + if (sourceCo == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is not a creature object\n", sourceOid.getValueString().c_str())); return true; @@ -3931,7 +3931,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const result += Unicode::narrowToWide(FormattedString<512>().sprintf("dumping %s's command queue contents\n", sourceCo->getNetworkId().getValueString().c_str())); CommandQueue * queue = sourceCo->getCommandQueue(); - if (queue != NULL) + if (queue != nullptr) { std::string output; queue->spew(&output); @@ -3947,26 +3947,26 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - CreatureObject * c = (o ? o->asCreatureObject() : NULL); - if (o == NULL) + CreatureObject * c = (o ? o->asCreatureObject() : nullptr); + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - else if (c == NULL) + else if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; } - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); time_t const timeStartInterval = ((p->getChatSpamTimeEndInterval() > 0) ? static_cast(p->getChatSpamTimeEndInterval() - (ConfigServerGame::getChatSpamLimiterIntervalMinutes() * 60)) : 0); if ((timeStartInterval <= 0) || (timeNow < timeStartInterval)) @@ -3986,28 +3986,28 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject const * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject const * c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject const * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; } Client * client = o->getClient(); - if (client == NULL) + if (client == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("specified character object %s (%s) doesn't have a Client object (possible causes are may not be authoritative, or may not be connected)\n", o->getNetworkId().getValueString().c_str(), Unicode::wideToNarrow(o->getAssignedObjectName()).c_str())); return true; @@ -4042,28 +4042,28 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject const * c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject const * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; } Client * client = o->getClient(); - if (client == NULL) + if (client == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("specified character object %s (%s) doesn't have a Client object (possible causes are may not be authoritative, or may not be connected)\n", o->getNetworkId().getValueString().c_str(), Unicode::wideToNarrow(o->getAssignedObjectName()).c_str())); return true; @@ -4083,28 +4083,28 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject const * c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject const * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; } Client * client = o->getClient(); - if (client == NULL) + if (client == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("specified character object %s (%s) doesn't have a Client object (possible causes are may not be authoritative, or may not be connected)\n", o->getNetworkId().getValueString().c_str(), Unicode::wideToNarrow(o->getAssignedObjectName()).c_str())); return true; @@ -4180,12 +4180,12 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const } else { - result += Unicode::narrowToWide(FormattedString<1024>().sprintf("object (%s) getFootprint() returns NULL.\n", oid.getValueString().c_str())); + result += Unicode::narrowToWide(FormattedString<1024>().sprintf("object (%s) getFootprint() returns nullptr.\n", oid.getValueString().c_str())); } } else { - result += Unicode::narrowToWide(FormattedString<1024>().sprintf("object (%s) getCollisionProperty() returns NULL.\n", oid.getValueString().c_str())); + result += Unicode::narrowToWide(FormattedString<1024>().sprintf("object (%s) getCollisionProperty() returns nullptr.\n", oid.getValueString().c_str())); } } else diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserObjvar.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserObjvar.cpp index e4a928c5..77063e84 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserObjvar.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserObjvar.cpp @@ -100,7 +100,7 @@ bool ConsoleCommandParserObjvar::performParsing (const NetworkId & userId, const { NetworkId oid (Unicode::wideToNarrow (argv[1])); ServerObject* object = ServerWorld::findObjectByNetworkId(oid); - if (object == NULL) + if (object == nullptr) { result += getErrorMessage (argv [0], ERR_INVALID_OBJECT); return true; @@ -224,7 +224,7 @@ bool ConsoleCommandParserObjvar::performParsing (const NetworkId & userId, const // This is now a no-op, but left in to avoid breaking the god client // NetworkId oid (Unicode::wideToNarrow (argv[1])); // ServerObject* object = ServerWorld::findObjectByNetworkId(oid); -// if (object == NULL) +// if (object == nullptr) // { // result += getErrorMessage (argv [0], ERR_INVALID_OBJECT); // return true; @@ -241,7 +241,7 @@ bool ConsoleCommandParserObjvar::performParsing (const NetworkId & userId, const { NetworkId oid (Unicode::wideToNarrow(argv[1])); ServerObject* object = ServerWorld::findObjectByNetworkId(oid); - if (object == NULL) + if (object == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -317,7 +317,7 @@ bool ConsoleCommandParserObjvar::performParsing (const NetworkId & userId, const { ServerObject * const userServerObject = ServerWorld::findObjectByNetworkId(userId); - if (userServerObject != NULL) + if (userServerObject != nullptr) { NetworkId specifiedNetworkId; @@ -329,7 +329,7 @@ bool ConsoleCommandParserObjvar::performParsing (const NetworkId & userId, const { CreatureObject * const userCreatureObject = CreatureObject::asCreatureObject(userServerObject); - if (userCreatureObject != NULL) + if (userCreatureObject != nullptr) { specifiedNetworkId = userCreatureObject->getLookAtTarget(); } @@ -337,7 +337,7 @@ bool ConsoleCommandParserObjvar::performParsing (const NetworkId & userId, const ServerObject * const specifiedServerObject = ServerWorld::findObjectByNetworkId(specifiedNetworkId); - if (specifiedServerObject != NULL) + if (specifiedServerObject != nullptr) { DynamicVariableList const & objVarList = specifiedServerObject->getObjVars(); FormattedString<1024> fs; @@ -357,7 +357,7 @@ bool ConsoleCommandParserObjvar::performParsing (const NetworkId & userId, const { NetworkId oid = NetworkId(Unicode::wideToNarrow(argv[1])); ServerObject* object = ServerWorld::findObjectByNetworkId(oid); - if (object == NULL) + if (object == nullptr) { result += getErrorMessage (argv [0], ERR_INVALID_OBJECT); return true; @@ -376,7 +376,7 @@ bool ConsoleCommandParserObjvar::performParsing (const NetworkId & userId, const { NetworkId oid = NetworkId(Unicode::wideToNarrow(argv[1])); ServerObject* object = ServerWorld::findObjectByNetworkId(oid); - if (object == NULL) + if (object == nullptr) { result += getErrorMessage (argv [0], ERR_INVALID_OBJECT); return true; diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserPvp.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserPvp.cpp index d212d0ca..a9f691b6 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserPvp.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserPvp.cpp @@ -103,13 +103,13 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject const* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - CreatureObject const* c = (o ? o->asCreatureObject() : NULL); - if (o == NULL) + CreatureObject const* c = (o ? o->asCreatureObject() : nullptr); + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - else if (c == NULL) + else if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; @@ -117,7 +117,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St else { PlayerObject const* p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -185,7 +185,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St result += Unicode::narrowToWide(FormattedString<512>().sprintf("lifetime PvP kills: %ld\n",p->getLifetimePvpKills())); result += Unicode::narrowToWide(FormattedString<512>().sprintf("next GCW rating calculation time: %ld",p->getNextGcwRatingCalcTime())); - int32 const now = static_cast(::time(NULL)); + int32 const now = static_cast(::time(nullptr)); if (p->getNextGcwRatingCalcTime() > 0) { if (p->getNextGcwRatingCalcTime() >= now) @@ -223,13 +223,13 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - CreatureObject * c = (o ? o->asCreatureObject() : NULL); - if (o == NULL) + CreatureObject * c = (o ? o->asCreatureObject() : nullptr); + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - else if (c == NULL) + else if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; @@ -237,7 +237,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St else { PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -259,13 +259,13 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - CreatureObject * c = (o ? o->asCreatureObject() : NULL); - if (o == NULL) + CreatureObject * c = (o ? o->asCreatureObject() : nullptr); + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - else if (c == NULL) + else if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; @@ -273,7 +273,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St else { PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -295,13 +295,13 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - CreatureObject * c = (o ? o->asCreatureObject() : NULL); - if (o == NULL) + CreatureObject * c = (o ? o->asCreatureObject() : nullptr); + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - else if (c == NULL) + else if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; @@ -309,7 +309,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St else { PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -331,13 +331,13 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - CreatureObject * c = (o ? o->asCreatureObject() : NULL); - if (o == NULL) + CreatureObject * c = (o ? o->asCreatureObject() : nullptr); + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - else if (c == NULL) + else if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; @@ -345,7 +345,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St else { PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -369,13 +369,13 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - CreatureObject * c = (o ? o->asCreatureObject() : NULL); - if (o == NULL) + CreatureObject * c = (o ? o->asCreatureObject() : nullptr); + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - else if (c == NULL) + else if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; @@ -383,7 +383,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St else { PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -405,13 +405,13 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - CreatureObject * c = (o ? o->asCreatureObject() : NULL); - if (o == NULL) + CreatureObject * c = (o ? o->asCreatureObject() : nullptr); + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - else if (c == NULL) + else if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; @@ -419,7 +419,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St else { PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -441,13 +441,13 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - CreatureObject * c = (o ? o->asCreatureObject() : NULL); - if (o == NULL) + CreatureObject * c = (o ? o->asCreatureObject() : nullptr); + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - else if (c == NULL) + else if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; @@ -455,7 +455,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St else { PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -477,21 +477,21 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -585,7 +585,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -612,21 +612,21 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * const o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * const c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * const p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -660,21 +660,21 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * const o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * const c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * const p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -708,21 +708,21 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * const o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * const c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * const p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -756,21 +756,21 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * const o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * const c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * const p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -804,21 +804,21 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * const o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * const c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * const p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -852,14 +852,14 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId const oid(Unicode::wideToNarrow(argv[1])); ServerObject const * const o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject const * const c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; @@ -874,14 +874,14 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId const actorOid(Unicode::wideToNarrow(argv[1])); ServerObject const * const actorSo = dynamic_cast(ServerWorld::findObjectByNetworkId(actorOid)); - if (actorSo == NULL) + if (actorSo == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } TangibleObject const * const actorTo = actorSo->asTangibleObject(); - if (actorTo == NULL) + if (actorTo == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("(%s) is not a TangibleObject\n", actorOid.getValueString().c_str())); return true; @@ -889,14 +889,14 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St NetworkId const targetOid(Unicode::wideToNarrow(argv[2])); ServerObject const * const targetSo = dynamic_cast(ServerWorld::findObjectByNetworkId(targetOid)); - if (targetSo == NULL) + if (targetSo == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } TangibleObject const * const targetTo = targetSo->asTangibleObject(); - if (targetTo == NULL) + if (targetTo == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("(%s) is not a TangibleObject\n", targetOid.getValueString().c_str())); return true; @@ -924,14 +924,14 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId const actorOid(Unicode::wideToNarrow(argv[1])); ServerObject * const actorSo = dynamic_cast(ServerWorld::findObjectByNetworkId(actorOid)); - if (actorSo == NULL) + if (actorSo == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } TangibleObject * const actorTo = actorSo->asTangibleObject(); - if (actorTo == NULL) + if (actorTo == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("(%s) is not a TangibleObject\n", actorOid.getValueString().c_str())); return true; @@ -939,14 +939,14 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St NetworkId const targetOid(Unicode::wideToNarrow(argv[2])); ServerObject * const targetSo = dynamic_cast(ServerWorld::findObjectByNetworkId(targetOid)); - if (targetSo == NULL) + if (targetSo == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } TangibleObject * const targetTo = targetSo->asTangibleObject(); - if (targetTo == NULL) + if (targetTo == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("(%s) is not a TangibleObject\n", targetOid.getValueString().c_str())); return true; @@ -968,28 +968,28 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St NetworkId const oid(Unicode::wideToNarrow(argv[1])); ServerObject const * const o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject const * const c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject const * const p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; } ShipObject const * const ship = ShipObject::getContainingShipObject(c); - if (ship == NULL) + if (ship == nullptr) { result += Unicode::narrowToWide("specified character object is not in a ship\n"); return true; @@ -1042,28 +1042,28 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St NetworkId const oid(Unicode::wideToNarrow(argv[1])); ServerObject const * const o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject const * const c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject const * const p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; } ShipObject const * const ship = ShipObject::getContainingShipObject(c); - if (ship == NULL) + if (ship == nullptr) { result += Unicode::narrowToWide("specified character object is not in a ship\n"); return true; diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserResource.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserResource.cpp index 2d22864d..cde60a8e 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserResource.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserResource.cpp @@ -73,7 +73,7 @@ bool ConsoleCommandParserResource::performParsing (const NetworkId & userId, con CachedNetworkId harvester(Unicode::wideToNarrow (argv[1])); ServerObject* harvesterObject = safe_cast(harvester.getObject()); - if (harvesterObject == NULL) + if (harvesterObject == nullptr) { result += getErrorMessage (argv [0], ERR_INVALID_OBJECT); return true; @@ -90,7 +90,7 @@ bool ConsoleCommandParserResource::performParsing (const NetworkId & userId, con CachedNetworkId harvester(Unicode::wideToNarrow (argv[1])); ServerObject* harvesterObject = safe_cast(harvester.getObject()); - if (harvesterObject == NULL) + if (harvesterObject == nullptr) { result += getErrorMessage (argv [0], ERR_INVALID_OBJECT); return true; @@ -123,7 +123,7 @@ bool ConsoleCommandParserResource::performParsing (const NetworkId & userId, con CachedNetworkId harvester(Unicode::wideToNarrow (argv[1])); ServerObject* harvesterObject = safe_cast(harvester.getObject()); - if (harvesterObject == NULL) + if (harvesterObject == nullptr) { result += getErrorMessage (argv [0], ERR_INVALID_OBJECT); return true; @@ -208,7 +208,7 @@ bool ConsoleCommandParserResource::performParsing (const NetworkId & userId, con ResourceContainerObject * const container = dynamic_cast(NetworkIdManager::getObjectById(contId)); std::string const & resourcePath = Unicode::wideToNarrow(argv[2]); ResourceTypeObject * const resType = ServerUniverse::getInstance().getResourceTypeByName(resourcePath); - int const amount = strtol(Unicode::wideToNarrow (argv[3]).c_str (), NULL, 10); + int const amount = strtol(Unicode::wideToNarrow (argv[3]).c_str (), nullptr, 10); NetworkId const source(Unicode::wideToNarrow (argv[4])); if (container && resType) @@ -228,7 +228,7 @@ bool ConsoleCommandParserResource::performParsing (const NetworkId & userId, con { NetworkId contId (Unicode::wideToNarrow (argv[1])); ResourceContainerObject* container=dynamic_cast(NetworkIdManager::getObjectById(contId)); - if (container != NULL) + if (container != nullptr) { NetworkId sourceId; if (argv.size() >= 3) @@ -251,7 +251,7 @@ bool ConsoleCommandParserResource::performParsing (const NetworkId & userId, con { NetworkId contId (Unicode::wideToNarrow (argv[1])); ResourceContainerObject* container=dynamic_cast(NetworkIdManager::getObjectById(contId)); - if (container != NULL) + if (container != nullptr) { if (container->debugRecycle()) result += getErrorMessage(argv[0], ERR_SUCCESS); @@ -267,7 +267,7 @@ bool ConsoleCommandParserResource::performParsing (const NetworkId & userId, con CachedNetworkId contId (Unicode::wideToNarrow (argv[1])); ResourceContainerObject* container=dynamic_cast(contId.getObject()); ResourceTypeObject *resType=ServerUniverse::getInstance().getResourceTypeByName(Unicode::wideToNarrow(argv[2])); - int amount=strtol(Unicode::wideToNarrow (argv[3]).c_str (), NULL, 10); + int amount=strtol(Unicode::wideToNarrow (argv[3]).c_str (), nullptr, 10); if (container && resType) { @@ -307,8 +307,8 @@ bool ConsoleCommandParserResource::performParsing (const NetworkId & userId, con { const std::string parentResourceClassName (Unicode::wideToNarrow(argv[1])); const std::string resourceTypeName (Unicode::wideToNarrow(argv[2])); - const int surveyRange = strtol(Unicode::wideToNarrow(argv[3]).c_str(),NULL,10); - const int numPoints = strtol(Unicode::wideToNarrow(argv[4]).c_str(),NULL,10); + const int surveyRange = strtol(Unicode::wideToNarrow(argv[3]).c_str(),nullptr,10); + const int numPoints = strtol(Unicode::wideToNarrow(argv[4]).c_str(),nullptr,10); const Object * player = NetworkIdManager::getObjectById(userId); if (player) diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserScript.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserScript.cpp index a2703595..99f1f236 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserScript.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserScript.cpp @@ -62,7 +62,7 @@ bool ConsoleCommandParserScript::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow (argv[2])); ServerObject* object = ServerWorld::findObjectByNetworkId(oid); - if (object == NULL) + if (object == nullptr) { result += getErrorMessage (argv [0], ERR_INVALID_OBJECT); return true; @@ -81,7 +81,7 @@ bool ConsoleCommandParserScript::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[2])); ServerObject* object = ServerWorld::findObjectByNetworkId(oid); - if (object == NULL) + if (object == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -100,7 +100,7 @@ bool ConsoleCommandParserScript::performParsing (const NetworkId & userId, const { ServerObject * const userServerObject = ServerWorld::findObjectByNetworkId(userId); - if (userServerObject != NULL) + if (userServerObject != nullptr) { NetworkId specifiedNetworkId; @@ -112,7 +112,7 @@ bool ConsoleCommandParserScript::performParsing (const NetworkId & userId, const { CreatureObject * const userCreatureObject = CreatureObject::asCreatureObject(userServerObject); - if (userCreatureObject != NULL) + if (userCreatureObject != nullptr) { specifiedNetworkId = userCreatureObject->getLookAtTarget(); } @@ -120,7 +120,7 @@ bool ConsoleCommandParserScript::performParsing (const NetworkId & userId, const ServerObject * const specifiedServerObject = ServerObject::getServerObject(specifiedNetworkId); - if (specifiedServerObject != NULL) + if (specifiedServerObject != nullptr) { ScriptList const & scripts = specifiedServerObject->getScriptObject()->getScripts(); FormattedString<1024> fs; @@ -226,7 +226,7 @@ bool ConsoleCommandParserScript::performParsing (const NetworkId & userId, const // get the object id NetworkId oid(Unicode::wideToNarrow(argv[oidIndex])); ServerObject* object = ServerWorld::findObjectByNetworkId(oid); - if (object == NULL) + if (object == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserServer.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserServer.cpp index f789d127..c81f8966 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserServer.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserServer.cpp @@ -301,7 +301,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const return true; } - unsigned long val = strtoul(Unicode::wideToNarrow(argv[1]).c_str(), NULL, 10); + unsigned long val = strtoul(Unicode::wideToNarrow(argv[1]).c_str(), nullptr, 10); const bool isPublic = (val != 0); SetConnectionServerPublic const p(isPublic); @@ -354,8 +354,8 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const return true; } - unsigned long secsToWait = strtoul(Unicode::wideToNarrow(argv[1]).c_str(), NULL, 10); - unsigned long maxSecs = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), NULL, 10); + unsigned long secsToWait = strtoul(Unicode::wideToNarrow(argv[1]).c_str(), nullptr, 10); + unsigned long maxSecs = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), nullptr, 10); Unicode::String systemMessage; for( size_t i=3; i< argv.size(); ++i) { @@ -386,7 +386,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const return true; } - unsigned long val = strtoul(Unicode::wideToNarrow(argv[1]).c_str (), NULL, 10); + unsigned long val = strtoul(Unicode::wideToNarrow(argv[1]).c_str (), nullptr, 10); switch (val) { case 1: @@ -482,7 +482,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject* object = ServerWorld::findObjectByNetworkId(oid); - if (object == NULL) + if (object == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -574,7 +574,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const } else if (isAbbrev (argv[0], "getSceneId")) { - if (user == NULL) + if (user == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -596,7 +596,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const return true; } - unsigned long val = strtoul(Unicode::wideToNarrow(argv[1]).c_str (), NULL, 10); + unsigned long val = strtoul(Unicode::wideToNarrow(argv[1]).c_str (), nullptr, 10); if (user->getClient()->setGodMode(val != 0)) result += getErrorMessage (argv[0], ERR_SUCCESS); else @@ -637,7 +637,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const { std::string tableName; tableName = Unicode::wideToNarrow(argv[1]); - if (DataTableManager::reload(tableName) != NULL) + if (DataTableManager::reload(tableName) != nullptr) { ServerMessageForwarding::beginBroadcast(); @@ -694,7 +694,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const else { PlanetObject * planet = ServerUniverse::getInstance().getCurrentPlanet(); - if (planet == NULL) + if (planet == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -708,7 +708,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const for (std::vector::const_iterator i = regions.begin(); i != regions.end(); ++i) { const RegionRectangle * ro = dynamic_cast(*i); - if (ro != NULL) + if (ro != nullptr) { float minX, minY, maxX, maxY; ro->getExtent(minX, minY, maxX, maxY); @@ -717,7 +717,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const client->send(mrgrr, true); } const RegionCircle* co = dynamic_cast(*i); - if (co != NULL) + if (co != nullptr) { float centerX, centerY, radius; co->getExtent(centerX, centerY, radius); @@ -743,7 +743,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const { uint32 processId = GameServer::getInstance().getProcessId(); if (argv.size() > 3) - processId = strtoul(Unicode::wideToNarrow(argv[3]).c_str(), NULL, 10); + processId = strtoul(Unicode::wideToNarrow(argv[3]).c_str(), nullptr, 10); std::string op = Unicode::wideToNarrow(argv[1]) + " " + Unicode::wideToNarrow(argv[2]); @@ -760,7 +760,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const { uint32 processId = GameServer::getInstance().getProcessId(); if (argv.size() > 2) - processId = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), NULL, 10); + processId = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), nullptr, 10); std::string op(Unicode::wideToNarrow(argv[1])); if (processId == GameServer::getInstance().getProcessId()) @@ -840,8 +840,8 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const } else if (isAbbrev(argv[0], "getRegionsAt")) { - float x = static_cast(strtod(Unicode::wideToNarrow(argv[1]).c_str(), NULL)); - float z = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), NULL)); + float x = static_cast(strtod(Unicode::wideToNarrow(argv[1]).c_str(), nullptr)); + float z = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), nullptr)); std::vector results; @@ -990,10 +990,10 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const //" ", "Save out an area for buildout datatables" std::string const &serverFilename = Unicode::wideToNarrow(argv[1]); std::string const &clientFilename = Unicode::wideToNarrow(argv[2]); - float x1 = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL)); - float z1 = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), NULL)); - float x2 = static_cast(strtod(Unicode::wideToNarrow(argv[5]).c_str(), NULL)); - float z2 = static_cast(strtod(Unicode::wideToNarrow(argv[6]).c_str(), NULL)); + float x1 = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr)); + float z1 = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), nullptr)); + float x2 = static_cast(strtod(Unicode::wideToNarrow(argv[5]).c_str(), nullptr)); + float z2 = static_cast(strtod(Unicode::wideToNarrow(argv[6]).c_str(), nullptr)); ServerBuildoutManager::saveArea(serverFilename, clientFilename, x1, z1, x2, z2); } else if (isAbbrev(argv[0], "clientSaveBuildoutArea")) @@ -1001,10 +1001,10 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const //" " std::string const &scene = Unicode::wideToNarrow(argv[1]); std::string const &areaName = Unicode::wideToNarrow(argv[2]); - float x1 = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL)); - float z1 = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), NULL)); - float x2 = static_cast(strtod(Unicode::wideToNarrow(argv[5]).c_str(), NULL)); - float z2 = static_cast(strtod(Unicode::wideToNarrow(argv[6]).c_str(), NULL)); + float x1 = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr)); + float z1 = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), nullptr)); + float x2 = static_cast(strtod(Unicode::wideToNarrow(argv[5]).c_str(), nullptr)); + float z2 = static_cast(strtod(Unicode::wideToNarrow(argv[6]).c_str(), nullptr)); if (scene == ConfigServerGame::getSceneID() && user->getClient()) ServerBuildoutManager::clientSaveArea(*user->getClient(), areaName, x1, z1, x2, z2); } @@ -1044,7 +1044,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const if (argv.size() == 2) { // specify server by process id - uint32 serverId = strtoul(Unicode::wideToNarrow(argv[1]).c_str(), NULL, 10); + uint32 serverId = strtoul(Unicode::wideToNarrow(argv[1]).c_str(), nullptr, 10); if (serverId != 0) { ExcommunicateGameServerMessage exmsg(serverId, 0, ""); @@ -1058,7 +1058,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const { // specify server by scene & preload role number std::string const &scene = Unicode::wideToNarrow(argv[1]); - uint32 preloadRole = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), NULL, 10); + uint32 preloadRole = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), nullptr, 10); GenericValueTypeMessage > msg("RestartServerByRoleMessage", std::make_pair(scene, preloadRole)); if (scene == ConfigServerGame::getSceneID()) @@ -1072,8 +1072,8 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const { // specify server by geographic location std::string const &scene = Unicode::wideToNarrow(argv[1]); - int x = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), NULL)); - int z = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL)); + int x = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), nullptr)); + int z = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr)); RestartServerMessage msg(scene, x, z); if (scene == ConfigServerGame::getSceneID()) @@ -1322,14 +1322,14 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const NetworkId oid2(Unicode::wideToNarrow(argv[2])); ServerObject const * const object1 = ServerWorld::findObjectByNetworkId(oid1); - if (object1 == NULL) + if (object1 == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } ServerObject const * const object2 = ServerWorld::findObjectByNetworkId(oid2); - if (object2 == NULL) + if (object2 == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1366,7 +1366,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const TerrainObject const * terrain = TerrainObject::getConstInstance(); if (!terrain) { - result += Unicode::narrowToWide("terrain object is NULL\n"); + result += Unicode::narrowToWide("terrain object is nullptr\n"); return true; } @@ -1443,7 +1443,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const TerrainObject const * terrain = TerrainObject::getConstInstance(); if (!terrain) { - result += Unicode::narrowToWide("terrain object is NULL\n"); + result += Unicode::narrowToWide("terrain object is nullptr\n"); return true; } @@ -1491,7 +1491,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const TerrainObject * terrain = TerrainObject::getInstance(); if (!terrain) { - result += Unicode::narrowToWide("terrain object is NULL\n"); + result += Unicode::narrowToWide("terrain object is nullptr\n"); return true; } @@ -1557,8 +1557,8 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const { result += Unicode::narrowToWide(iterFind->second.getDebugString()); - ServerObject const * const soGroupObject = (iterFind->second.groupId.isValid() ? safe_cast(NetworkIdManager::getObjectById(iterFind->second.groupId)) : NULL); - GroupObject const * const groupObject = (soGroupObject ? soGroupObject->asGroupObject() : NULL); + ServerObject const * const soGroupObject = (iterFind->second.groupId.isValid() ? safe_cast(NetworkIdManager::getObjectById(iterFind->second.groupId)) : nullptr); + GroupObject const * const groupObject = (soGroupObject ? soGroupObject->asGroupObject() : nullptr); if (groupObject) { unsigned int const secondsLeftOnGroupPickup = groupObject->getSecondsLeftOnGroupPickup(); @@ -1717,7 +1717,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const else if (isAbbrev(argv[0], "listCharacterLastLoginTimeBrief")) { int const days = atoi(Unicode::wideToNarrow(argv[1]).c_str()); - time_t const cutoff = std::max(static_cast(0), static_cast(::time(NULL) - (60 * 60 * 24 * days))); + time_t const cutoff = std::max(static_cast(0), static_cast(::time(nullptr) - (60 * 60 * 24 * days))); std::multimap, std::string> > resultList; NameManager::getInstance().getPlayerWithLastLoginTimeAfter(cutoff, resultList); @@ -1726,7 +1726,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "listCharacterLastLoginTimeAfterBrief")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -1749,7 +1749,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "listCharacterLastLoginTimeBeforeBrief")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -1772,7 +1772,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "listCharacterLastLoginTimeBetweenBrief")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -1817,7 +1817,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const else if (isAbbrev(argv[0], "listCharacterLastLoginTimeDetailed")) { int const days = atoi(Unicode::wideToNarrow(argv[1]).c_str()); - time_t const cutoff = std::max(static_cast(0), static_cast(::time(NULL) - (60 * 60 * 24 * days))); + time_t const cutoff = std::max(static_cast(0), static_cast(::time(nullptr) - (60 * 60 * 24 * days))); std::multimap, std::string> > resultList; NameManager::getInstance().getPlayerWithLastLoginTimeAfter(cutoff, resultList); @@ -1829,7 +1829,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "listCharacterLastLoginTimeAfterDetailed")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -1855,7 +1855,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "listCharacterLastLoginTimeBeforeDetailed")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -1881,7 +1881,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "listCharacterLastLoginTimeBetweenDetailed")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -1929,7 +1929,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const else if (isAbbrev(argv[0], "sendMailToCharacterLastLoginTime")) { int const days = atoi(Unicode::wideToNarrow(argv[1]).c_str()); - time_t const cutoff = std::max(static_cast(0), static_cast(::time(NULL) - (60 * 60 * 24 * days))); + time_t const cutoff = std::max(static_cast(0), static_cast(::time(nullptr) - (60 * 60 * 24 * days))); int const argc = argv.size(); Unicode::String mailBody; @@ -1952,7 +1952,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const static Unicode::String s_mailBody; static time_t s_confirmationTimeout = 0; - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); if ((s_days == days) && (s_confirmationTimeout > timeNow) && (s_fromName == Unicode::wideToNarrow(argv[2])) && (s_mailSubject == argv[3]) && (s_mailBody == mailBody)) { @@ -1991,7 +1991,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "sendMailToCharacterLastLoginTimeAfter")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -2028,7 +2028,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const static Unicode::String s_mailBody; static time_t s_confirmationTimeout = 0; - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); if ((s_cutoff == cutoff) && (s_confirmationTimeout > timeNow) && (s_fromName == Unicode::wideToNarrow(argv[7])) && (s_mailSubject == argv[8]) && (s_mailBody == mailBody)) { @@ -2067,7 +2067,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "sendMailToCharacterLastLoginTimeBefore")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -2104,7 +2104,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const static Unicode::String s_mailBody; static time_t s_confirmationTimeout = 0; - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); if ((s_cutoff == cutoff) && (s_confirmationTimeout > timeNow) && (s_fromName == Unicode::wideToNarrow(argv[7])) && (s_mailSubject == argv[8]) && (s_mailBody == mailBody)) { @@ -2143,7 +2143,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "sendMailToCharacterLastLoginTimeBetween")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -2202,7 +2202,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const static Unicode::String s_mailBody; static time_t s_confirmationTimeout = 0; - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); if ((s_cutoffLower == cutoffLower) && (s_cutoffUpper == cutoffUpper) && (s_confirmationTimeout > timeNow) && (s_fromName == Unicode::wideToNarrow(argv[13])) && (s_mailSubject == argv[14]) && (s_mailBody == mailBody)) { @@ -2244,7 +2244,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const else if (isAbbrev(argv[0], "listCharacterCreateTimeBrief")) { int const days = atoi(Unicode::wideToNarrow(argv[1]).c_str()); - time_t const cutoff = std::max(static_cast(0), static_cast(::time(NULL) - (60 * 60 * 24 * days))); + time_t const cutoff = std::max(static_cast(0), static_cast(::time(nullptr) - (60 * 60 * 24 * days))); std::multimap, std::string> > resultList; NameManager::getInstance().getPlayerWithCreateTimeAfter(cutoff, resultList); @@ -2253,7 +2253,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "listCharacterCreateTimeAfterBrief")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -2276,7 +2276,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "listCharacterCreateTimeBeforeBrief")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -2299,7 +2299,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "listCharacterCreateTimeBetweenBrief")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -2344,7 +2344,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const else if (isAbbrev(argv[0], "listCharacterCreateTimeDetailed")) { int const days = atoi(Unicode::wideToNarrow(argv[1]).c_str()); - time_t const cutoff = std::max(static_cast(0), static_cast(::time(NULL) - (60 * 60 * 24 * days))); + time_t const cutoff = std::max(static_cast(0), static_cast(::time(nullptr) - (60 * 60 * 24 * days))); std::multimap, std::string> > resultList; NameManager::getInstance().getPlayerWithCreateTimeAfter(cutoff, resultList); @@ -2356,7 +2356,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "listCharacterCreateTimeAfterDetailed")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -2382,7 +2382,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "listCharacterCreateTimeBeforeDetailed")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -2408,7 +2408,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "listCharacterCreateTimeBetweenDetailed")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -2456,7 +2456,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const else if (isAbbrev(argv[0], "sendMailToCharacterCreateTime")) { int const days = atoi(Unicode::wideToNarrow(argv[1]).c_str()); - time_t const cutoff = std::max(static_cast(0), static_cast(::time(NULL) - (60 * 60 * 24 * days))); + time_t const cutoff = std::max(static_cast(0), static_cast(::time(nullptr) - (60 * 60 * 24 * days))); int const argc = argv.size(); Unicode::String mailBody; @@ -2479,7 +2479,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const static Unicode::String s_mailBody; static time_t s_confirmationTimeout = 0; - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); if ((s_days == days) && (s_confirmationTimeout > timeNow) && (s_fromName == Unicode::wideToNarrow(argv[2])) && (s_mailSubject == argv[3]) && (s_mailBody == mailBody)) { @@ -2518,7 +2518,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "sendMailToCharacterCreateTimeAfter")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -2555,7 +2555,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const static Unicode::String s_mailBody; static time_t s_confirmationTimeout = 0; - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); if ((s_cutoff == cutoff) && (s_confirmationTimeout > timeNow) && (s_fromName == Unicode::wideToNarrow(argv[7])) && (s_mailSubject == argv[8]) && (s_mailBody == mailBody)) { @@ -2594,7 +2594,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "sendMailToCharacterCreateTimeBefore")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -2631,7 +2631,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const static Unicode::String s_mailBody; static time_t s_confirmationTimeout = 0; - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); if ((s_cutoff == cutoff) && (s_confirmationTimeout > timeNow) && (s_fromName == Unicode::wideToNarrow(argv[7])) && (s_mailSubject == argv[8]) && (s_mailBody == mailBody)) { @@ -2670,7 +2670,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "sendMailToCharacterCreateTimeBetween")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -2729,7 +2729,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const static Unicode::String s_mailBody; static time_t s_confirmationTimeout = 0; - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); if ((s_cutoffLower == cutoffLower) && (s_cutoffUpper == cutoffUpper) && (s_confirmationTimeout > timeNow) && (s_fromName == Unicode::wideToNarrow(argv[13])) && (s_mailSubject == argv[14]) && (s_mailBody == mailBody)) { @@ -2776,7 +2776,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const uint32 const targetStationId = static_cast(atoi(Unicode::wideToNarrow(argv[4]).c_str())); std::string const targetCluster = Unicode::wideToNarrow(argv[5]); - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); result += Unicode::narrowToWide(FormattedString<512>().sprintf(" currentTime: %ld, %s\n", timeNow, CalendarTime::convertEpochToTimeStringLocal(timeNow).c_str())); result += Unicode::narrowToWide(FormattedString<512>().sprintf("\n characterCreateTime: %ld\n", sourceCharacterCreateTime)); @@ -2837,7 +2837,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const { std::string const sourceCluster = Unicode::wideToNarrow(argv[1]); - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); result += Unicode::narrowToWide(FormattedString<512>().sprintf(" currentTime: %ld, %s\n", timeNow, CalendarTime::convertEpochToTimeStringLocal(timeNow).c_str())); result += Unicode::narrowToWide(FormattedString<512>().sprintf(" sourceCluster: %s\n", sourceCluster.c_str())); @@ -2893,7 +2893,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const { result += Unicode::narrowToWide(FormattedString<512>().sprintf(" free CTS info file: %s\n", FreeCtsDataTable::getFreeCtsFileName().c_str())); - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); result += Unicode::narrowToWide(FormattedString<512>().sprintf(" currentTime: %ld, %s\n", timeNow, CalendarTime::convertEpochToTimeStringLocal(timeNow).c_str())); } @@ -3125,7 +3125,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const else { result += Unicode::narrowToWide(FormattedString<1024>().sprintf("Requesting adjustment of imperial score for GCW score category (%s) by (%d). It can take up to 1 minute for the adjustment request to be completed.\n", category.c_str(), adjustment)); - ServerUniverse::getInstance().adjustGcwImperialScore("remote server adjustGcwImperialScore", NULL, category, adjustment); + ServerUniverse::getInstance().adjustGcwImperialScore("remote server adjustGcwImperialScore", nullptr, category, adjustment); } } else if (isAbbrev(argv[0], "adjustGcwRebelScore")) @@ -3148,7 +3148,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const else { result += Unicode::narrowToWide(FormattedString<1024>().sprintf("Requesting adjustment of rebel score for GCW score category (%s) by (%d). It can take up to 1 minute for the adjustment request to be completed.\n", category.c_str(), adjustment)); - ServerUniverse::getInstance().adjustGcwRebelScore("remote server adjustGcwRebelScore", NULL, category, adjustment); + ServerUniverse::getInstance().adjustGcwRebelScore("remote server adjustGcwRebelScore", nullptr, category, adjustment); } } else if (isAbbrev(argv[0], "decayGcwScore")) @@ -3202,20 +3202,20 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject const * const o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject const * const c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } - if (PlayerCreatureController::getPlayerObject(c) == NULL) + if (PlayerCreatureController::getPlayerObject(c) == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -3240,21 +3240,21 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject const * const o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject const * const c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject const * const p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserShip.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserShip.cpp index 38efa02a..3fc8ad7d 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserShip.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserShip.cpp @@ -116,7 +116,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S slotNameToken.clear (); } - if (ship == NULL) + if (ship == nullptr) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); return true; @@ -126,7 +126,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S ShipChassis const * const shipChassis = ShipChassis::findShipChassisByCrc (chassisType); - if (shipChassis == NULL) + if (shipChassis == nullptr) { result += Unicode::narrowToWide ("No chassis"); return true; @@ -178,7 +178,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S if (ship->isSlotInstalled(chassisSlot)) shipComponentData = ship->createShipComponentData(chassisSlot); - if (shipComponentData == NULL) + if (shipComponentData == nullptr) { result += Unicode::narrowToWide (" Loaded NONE\n"); } @@ -223,7 +223,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S { TangibleObject * const component = findTangible (user->getLookAtTarget (), argv, 1); - if (component == NULL) + if (component == nullptr) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); return true; @@ -231,7 +231,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S ShipComponentData * const shipComponentData = ShipComponentDataManager::create (*component); - if (shipComponentData == NULL) + if (shipComponentData == nullptr) { result += Unicode::narrowToWide ("Not a ship component"); return true; @@ -252,13 +252,13 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S TangibleObject * const component = findTangible (NetworkId::cms_invalid, argv, 1); std::string const & slotName = Unicode::wideToNarrow (argv [2]); - if (ship == NULL) + if (ship == nullptr) { result += Unicode::narrowToWide ("no ship"); return true; } - if (component == NULL) + if (component == nullptr) { result += Unicode::narrowToWide ("no component"); return true; @@ -279,14 +279,14 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S } ShipChassis const * const shipChassis = ShipChassis::findShipChassisByCrc (ship->getChassisType ()); - if (shipChassis == NULL) + if (shipChassis == nullptr) { result += Unicode::narrowToWide ("Ship chassis invalid"); return true; } ShipChassisSlot const * const slot = shipChassis->getSlot (shipChassisSlotType); - if (slot == NULL) + if (slot == nullptr) { result += Unicode::narrowToWide ("Ship chassis does not support that slot"); return true; @@ -294,7 +294,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S ShipComponentData * const shipComponentData = ShipComponentDataManager::create (*component); - if (shipComponentData == NULL) + if (shipComponentData == nullptr) { result += Unicode::narrowToWide ("Not a ship component"); return true; @@ -325,7 +325,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S std::string const & componentName = Unicode::wideToNarrow (argv [1]); std::string const & slotName = Unicode::wideToNarrow (argv [2]); - if (ship == NULL) + if (ship == nullptr) { result += Unicode::narrowToWide ("no ship"); return true; @@ -334,7 +334,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S uint32 const componentCrc = Crc::normalizeAndCalculate (componentName.c_str ()); ShipComponentDescriptor const * const shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByCrc (componentCrc); - if (shipComponentDescriptor == NULL) + if (shipComponentDescriptor == nullptr) { result += Unicode::narrowToWide ("Invalid component name"); return true; @@ -364,13 +364,13 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S TangibleObject * const targetContainer = findTangible (user->getInventory ()->getNetworkId (), argv, 2); std::string const & slotName = Unicode::wideToNarrow (argv [1]); - if (ship == NULL) + if (ship == nullptr) { result += Unicode::narrowToWide ("no ship"); return true; } - if (targetContainer == NULL) + if (targetContainer == nullptr) { result += Unicode::narrowToWide ("no target container"); return true; @@ -405,7 +405,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S ShipObject * const ship = dynamic_cast(findTangible (user->getLookAtTarget (), argv, 2)); std::string const & slotName = Unicode::wideToNarrow (argv [1]); - if (ship == NULL) + if (ship == nullptr) { result += Unicode::narrowToWide ("no ship"); return true; @@ -436,14 +436,14 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S else if (isCommand (argv[0], CommandNames::pseudoDamageShip)) { ShipObject const * const victimShipObject = user->getPilotedShip(); - if (victimShipObject == NULL) + if (victimShipObject == nullptr) { result += Unicode::narrowToWide ("You are not piloting a ship."); return true; } ShipObject const * const attackerShipObject = dynamic_cast(findTangible (user->getLookAtTarget (), argv, 2)); - if (attackerShipObject == NULL) + if (attackerShipObject == nullptr) { result += Unicode::narrowToWide ("You don't have attacker ship targeted."); return true; @@ -486,12 +486,12 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S ShipObject const * const idotShip = idot.getShipObject(); - if (ship != NULL && ship != idotShip) + if (ship != nullptr && ship != idotShip) continue; uint32 const chassisType = idotShip->getChassisType(); ShipChassis const * const chassis = ShipChassis::findShipChassisByCrc(chassisType); - std::string const chassisTypeName = (chassis != NULL) ? chassis->getName().getString() : ""; + std::string const chassisTypeName = (chassis != nullptr) ? chassis->getName().getString() : ""; float hpCur = 0.0f; float hpMax = 0.0f; @@ -522,7 +522,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S { ShipObject * const ship = dynamic_cast(findTangible (user->getLookAtTarget (), argv, 4)); - if (ship == NULL) + if (ship == nullptr) { result += Unicode::narrowToWide ("no ship"); return true; @@ -546,7 +546,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S { ShipObject * const ship = dynamic_cast(findTangible (user->getLookAtTarget (), argv, 4)); - if (ship == NULL) + if (ship == nullptr) { result += Unicode::narrowToWide ("no ship"); return true; diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserSkill.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserSkill.cpp index fc1a1a49..3b356f42 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserSkill.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserSkill.cpp @@ -99,7 +99,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 2); - if (creature == NULL) + if (creature == nullptr) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -107,7 +107,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { const std::string skillName = Unicode::wideToNarrow (argv[1]); const SkillObject * const skill = SkillManager::getInstance ().getSkill (skillName); - if (skill == NULL) + if (skill == nullptr) { result += Unicode::narrowToWide ("unknown skill"); } @@ -126,7 +126,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 3); - if (creature == NULL) + if (creature == nullptr) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -146,7 +146,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 2); - if (creature == NULL) + if (creature == nullptr) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -198,7 +198,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 1); - if (creature == NULL) + if (creature == nullptr) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -233,7 +233,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 1); - if (creature == NULL) + if (creature == nullptr) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -262,7 +262,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 1); - if (creature == NULL) + if (creature == nullptr) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -288,7 +288,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 2); - if (creature == NULL) + if (creature == nullptr) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -296,7 +296,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { std::string skillName = Unicode::wideToNarrow (argv[1]); const SkillObject * skill = SkillManager::getInstance ().getSkill (skillName); - if (skill == NULL) + if (skill == nullptr) { result += Unicode::narrowToWide ("unknown skill"); } @@ -317,7 +317,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 2); - if (creature == NULL) + if (creature == nullptr) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -336,7 +336,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 1); - if (creature == NULL) + if (creature == nullptr) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -367,7 +367,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 2); - if (creature == NULL) + if (creature == nullptr) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -384,7 +384,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 2); - if (creature == NULL) + if (creature == nullptr) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -401,7 +401,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 2); - if (creature == NULL) + if (creature == nullptr) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -418,7 +418,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 2); - if (creature == NULL) + if (creature == nullptr) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -435,7 +435,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 1); - if (creature == NULL) + if (creature == nullptr) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserSpaceAi.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserSpaceAi.cpp index 9972dcf5..0964cdac 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserSpaceAi.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserSpaceAi.cpp @@ -66,9 +66,9 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const AiShipController::setAttackingEnabled(true); Object * const object = NetworkIdManager::getObjectById(userId); - ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - if (serverObject != NULL) + if (serverObject != nullptr) { Chat::sendSystemMessage(*serverObject, Unicode::narrowToWide("[WAR] AI will now attack."), Unicode::emptyString); } @@ -80,9 +80,9 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const AiShipController::setAttackingEnabled(false); Object * const object = NetworkIdManager::getObjectById(userId); - ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - if (serverObject != NULL) + if (serverObject != nullptr) { Chat::sendSystemMessage(*serverObject, Unicode::narrowToWide("[PEACE] AI will no longer attack."), Unicode::emptyString); } @@ -92,20 +92,20 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const else if (isAbbrev(argv[0], "path")) { Object * const object = NetworkIdManager::getObjectById(userId); - ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - if ( (serverObject != NULL) + if ( (serverObject != nullptr) && (argv.size () > 1)) { NetworkId networkId(Unicode::wideToNarrow(argv[1])); AiShipController * const aiShipController = AiShipController::getAiShipController(networkId); - if (aiShipController != NULL) + if (aiShipController != nullptr) { SpacePath * const spacePath = aiShipController->getPath(); - if (spacePath != NULL) + if (spacePath != nullptr) { SpacePath::TransformList const & transformList = spacePath->getTransformList(); SpacePath::TransformList::const_iterator iterTransformList = transformList.begin(); @@ -127,7 +127,7 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const } else { - Chat::sendSystemMessage(*serverObject, Unicode::narrowToWide("NULL path"), Unicode::emptyString); + Chat::sendSystemMessage(*serverObject, Unicode::narrowToWide("nullptr path"), Unicode::emptyString); } } else @@ -141,9 +141,9 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const else if (isAbbrev(argv[0], "reloaddata")) { Object * const object = NetworkIdManager::getObjectById(userId); - ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - if (serverObject != NULL) + if (serverObject != nullptr) { AiShipPilotData::reload(); @@ -156,10 +156,10 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const else if (isAbbrev(argv[0], "clientDebug")) { Object * const object = NetworkIdManager::getObjectById(userId); - ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; int temp; - if (serverObject != NULL) + if (serverObject != nullptr) { if ( serverObject->getObjVars().getItem("ai_debug_string", temp) && (temp > 0)) @@ -180,7 +180,7 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const Client * const client = serverObject->getClient(); - if (client != NULL) + if (client != nullptr) { AiDebugString aiDebugString; aiDebugString.enableClearClientFlag(); @@ -209,9 +209,9 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const else if (isAbbrev(argv[0], "serverDebug")) { Object * const object = NetworkIdManager::getObjectById(userId); - ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - if (serverObject != NULL) + if (serverObject != nullptr) { AiShipController::setClientDebugEnabled(!AiShipController::isClientDebugEnabled()); @@ -225,9 +225,9 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const else if (isAbbrev(argv[0], "clientDebugText")) { Object * const object = NetworkIdManager::getObjectById(userId); - ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - if (serverObject != NULL) + if (serverObject != nullptr) { AiDebugString::setTextEnabled(!AiDebugString::isTextEnabled()); @@ -241,12 +241,12 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const else if (isAbbrev(argv[0], "maneuver")) { Object * const object = NetworkIdManager::getObjectById(userId); - ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; - CreatureObject const * const creatureObject = serverObject ? serverObject->asCreatureObject() : NULL; + ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; + CreatureObject const * const creatureObject = serverObject ? serverObject->asCreatureObject() : nullptr; if (serverObject) { - if ((creatureObject != NULL) && (argv.size () > 1)) + if ((creatureObject != nullptr) && (argv.size () > 1)) { AiShipController const * const lookAtAiShipController = AiShipController::getAiShipController(creatureObject->getLookAtTarget()); @@ -295,9 +295,9 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const else if (isAbbrev(argv[0], "fastAxis")) { Object * const object = NetworkIdManager::getObjectById(userId); - ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - if (serverObject != NULL) + if (serverObject != nullptr) { Unicode::String systemMessage; diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserVeteran.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserVeteran.cpp index 0152e24d..3b91f7f0 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserVeteran.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserVeteran.cpp @@ -42,7 +42,7 @@ bool ConsoleCommandParserVeteran::performParsing (const NetworkId & userId, cons { NetworkId targetPlayer(Unicode::wideToNarrow (argv[1])); ServerObject const * const so = safe_cast(NetworkIdManager::getObjectById(targetPlayer)); - Client const * const client = so ? so->getClient() : NULL; + Client const * const client = so ? so->getClient() : nullptr; if (client) { std::string output; @@ -107,7 +107,7 @@ bool ConsoleCommandParserVeteran::performParsing (const NetworkId & userId, cons { NetworkId targetPlayer(Unicode::wideToNarrow(argv[1])); ServerObject const * const so = safe_cast(NetworkIdManager::getObjectById(targetPlayer)); - CreatureObject const * const playerCreature = so ? so->asCreatureObject() : NULL; + CreatureObject const * const playerCreature = so ? so->asCreatureObject() : nullptr; if (!playerCreature) result += getErrorMessage(argv[0],ERR_INVALID_OBJECT); else @@ -126,7 +126,7 @@ bool ConsoleCommandParserVeteran::performParsing (const NetworkId & userId, cons { std::string url(Unicode::wideToNarrow(argv[1])); ServerObject const * const so = safe_cast(NetworkIdManager::getObjectById(userId)); - Client const * const client = so ? so->getClient() : NULL; + Client const * const client = so ? so->getClient() : nullptr; if (client) { client->launchWebBrowser(url); diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleManager.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleManager.cpp index 46e4a6fd..f31601df 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleManager.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleManager.cpp @@ -41,14 +41,14 @@ #include "sharedCommandParser/CommandParser.h" #include "sharedNetworkMessages/ConsoleChannelMessages.h" -CommandParser * ConsoleMgr::ms_parser = NULL; +CommandParser * ConsoleMgr::ms_parser = nullptr; //----------------------------------------------------------------------- void ConsoleMgr::install() { - if (ms_parser == NULL) + if (ms_parser == nullptr) { ms_parser = new ConsoleCommandParserDefault(); ms_parser->addSubCommand(new ConsoleCommandParserCombatEngine ()); @@ -80,10 +80,10 @@ void ConsoleMgr::install() void ConsoleMgr::remove() { - if (ms_parser != NULL) + if (ms_parser != nullptr) { delete ms_parser; - ms_parser = NULL; + ms_parser = nullptr; } } // ConsoleMgr::remove @@ -93,7 +93,7 @@ void ConsoleMgr::processString(const std::string & msg, Client *from, uint32 msg { DEBUG_REPORT_LOG_PRINT(true, ("Console Message Received: %s\n",(msg.c_str()))); - if (ms_parser == NULL) + if (ms_parser == nullptr) { DEBUG_WARNING(true, ("Console command parser has not been created!")); return; diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleManager.h b/engine/server/library/serverGame/src/shared/console/ConsoleManager.h index f32ac0a3..8f71dbd6 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleManager.h +++ b/engine/server/library/serverGame/src/shared/console/ConsoleManager.h @@ -17,9 +17,9 @@ public: static void install(); static void remove(); - static void processString(const std::string & msg, Client *from = NULL,uint32 msgId = 0); - static void broadcastString(const std::string & msg, Client *to = NULL, uint32 msgId = 0); - static void broadcastString(const CommandParser::String_t & msg, Client *to = NULL, uint32 msgId = 0); + static void processString(const std::string & msg, Client *from = nullptr,uint32 msgId = 0); + static void broadcastString(const std::string & msg, Client *to = nullptr, uint32 msgId = 0); + static void broadcastString(const CommandParser::String_t & msg, Client *to = nullptr, uint32 msgId = 0); static void broadcastString(const std::string & msg, NetworkId to, uint32 msgId = 0); private: diff --git a/engine/server/library/serverGame/src/shared/controller/AiCreatureController.cpp b/engine/server/library/serverGame/src/shared/controller/AiCreatureController.cpp index 040d0a9c..14425612 100755 --- a/engine/server/library/serverGame/src/shared/controller/AiCreatureController.cpp +++ b/engine/server/library/serverGame/src/shared/controller/AiCreatureController.cpp @@ -83,7 +83,7 @@ namespace AiCreatureControllerNamespace bool s_installed = false; typedef std::set ObserverList; - PersistentCrcString * s_defaultCreatureName = NULL; + PersistentCrcString * s_defaultCreatureName = nullptr; void remove(); Location getLocation(ServerObject const & serverObject); @@ -97,7 +97,7 @@ void AiCreatureControllerNamespace::remove() DEBUG_FATAL(!s_installed, ("Not installed.")); delete s_defaultCreatureName; - s_defaultCreatureName = NULL; + s_defaultCreatureName = nullptr; s_installed = false; } @@ -106,9 +106,9 @@ void AiCreatureControllerNamespace::remove() Location AiCreatureControllerNamespace::getLocation(ServerObject const & serverObject) { CellProperty const * const cellProperty = serverObject.getParentCell(); - Object const * const cellObject = (cellProperty != NULL) ? &cellProperty->getOwner() : NULL; - Vector const & positionRelativeToCellOrWorld = (cellObject != NULL) ? serverObject.getPosition_c() : serverObject.getPosition_w(); - NetworkId const & networkIdForCellOrWorld = (cellObject != NULL) ? cellObject->getNetworkId() : NetworkId::cms_invalid; + Object const * const cellObject = (cellProperty != nullptr) ? &cellProperty->getOwner() : nullptr; + Vector const & positionRelativeToCellOrWorld = (cellObject != nullptr) ? serverObject.getPosition_c() : serverObject.getPosition_w(); + NetworkId const & networkIdForCellOrWorld = (cellObject != nullptr) ? cellObject->getNetworkId() : NetworkId::cms_invalid; return Location(positionRelativeToCellOrWorld, networkIdForCellOrWorld, Location::getCrcBySceneName(serverObject.getSceneId())); } @@ -164,10 +164,10 @@ AICreatureController::~AICreatureController() Object * const owner = getOwner(); - if (owner != NULL && owner->isAuthoritative() && !getHibernate() && m_hibernationDelay.get() > 0 && m_hibernationTimer.get() > 0) + if (owner != nullptr && owner->isAuthoritative() && !getHibernate() && m_hibernationDelay.get() > 0 && m_hibernationTimer.get() > 0) ObjectTracker::removeDelayedHibernatingAI(); - if ( (owner != NULL) + if ( (owner != nullptr) && AiLogManager::isLogging(owner->getNetworkId())) { AiLogManager::setLogging(owner->getNetworkId(), false); @@ -205,9 +205,9 @@ void AICreatureController::CreatureNameChangedCallback::modified(AICreatureContr void AICreatureController::handleMessage (int message, float value, const MessageQueue::Data* const data, uint32 flags) { CreatureObject * const owner = static_cast(getOwner()); - if (owner == NULL) + if (owner == nullptr) { - DEBUG_FATAL(true, ("Owner is NULL in AiCreatureController::handleMessage\n")); + DEBUG_FATAL(true, ("Owner is nullptr in AiCreatureController::handleMessage\n")); return; } @@ -219,7 +219,7 @@ void AICreatureController::handleMessage (int message, float value, const Messag AiMovementMessage const * const msg = safe_cast(data); - if (msg != NULL) + if (msg != nullptr) { if (owner->isAuthoritative()) { @@ -256,7 +256,7 @@ void AICreatureController::handleMessage (int message, float value, const Messag LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::handleMessage(CM_aiSetCreatureName) owner(%s)", getDebugInformation().c_str())); MessageQueueGenericValueType const * const msg = safe_cast const *>(data); - if (msg != NULL) + if (msg != nullptr) { setCreatureName(msg->getValue()); } @@ -267,7 +267,7 @@ void AICreatureController::handleMessage (int message, float value, const Messag LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::handleMessage(CM_aiSetHomeLocation) owner(%s)", getDebugInformation().c_str())); MessageQueueGenericValueType const * const msg = safe_cast const *>(data); - if (msg != NULL) + if (msg != nullptr) { setHomeLocation(msg->getValue()); } @@ -278,7 +278,7 @@ void AICreatureController::handleMessage (int message, float value, const Messag LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::handleMessage(CM_aiSetFrozen) owner(%s)", getDebugInformation().c_str())); MessageQueueGenericValueType const * const msg = safe_cast const *>(data); - if (msg != NULL) + if (msg != nullptr) { setFrozen(msg->getValue()); } @@ -289,7 +289,7 @@ void AICreatureController::handleMessage (int message, float value, const Messag LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::handleMessage(CM_aiSetRetreating) owner(%s)", getDebugInformation().c_str())); MessageQueueGenericValueType const * const msg = safe_cast const *>(data); - if (msg != NULL) + if (msg != nullptr) { setRetreating(msg->getValue()); } @@ -300,7 +300,7 @@ void AICreatureController::handleMessage (int message, float value, const Messag LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::handleMessage(CM_aiSetLogging) owner(%s)", getDebugInformation().c_str())); MessageQueueGenericValueType const * const msg = safe_cast const *>(data); - if (msg != NULL) + if (msg != nullptr) { setLogging(msg->getValue()); } @@ -333,7 +333,7 @@ void AICreatureController::handleMessage (int message, float value, const Messag case CM_setHibernationDelay: { MessageQueueGenericValueType const * const msg = safe_cast const *>(data); - if (msg != NULL) + if (msg != nullptr) setHibernationDelay(msg->getValue()); } break; @@ -469,7 +469,7 @@ float AICreatureController::realAlter(float time) CreatureObject * const creatureOwner = getCreature(); #ifdef _DEBUG - AiDebugString * aiDebugString = NULL; + AiDebugString * aiDebugString = nullptr; if (!creatureOwner->getObservers().empty()) { aiDebugString = new AiDebugString; @@ -508,7 +508,7 @@ float AICreatureController::realAlter(float time) if (!creatureOwner->isInWorld() || getHibernate()) { #ifdef _DEBUG - if (aiDebugString != NULL) + if (aiDebugString != nullptr) { sendDebugAiToClients(*aiDebugString); delete aiDebugString; @@ -522,8 +522,8 @@ float AICreatureController::realAlter(float time) // check floating { CollisionProperty const * const collision = creatureOwner->getCollisionProperty(); - Footprint const * const foot = (collision != NULL) ? collision->getFootprint() : NULL; - bool floating = (foot != NULL) ? foot->isFloating() : false; + Footprint const * const foot = (collision != nullptr) ? collision->getFootprint() : nullptr; + bool floating = (foot != nullptr) ? foot->isFloating() : false; if (floating) { @@ -547,7 +547,7 @@ float AICreatureController::realAlter(float time) // Update our inPathfindingRegion flag whenever the behavior changes CityPathGraph const * graph = CityPathGraphManager::getCityGraphFor(creatureOwner); - m_inPathfindingRegion = (graph != NULL); + m_inPathfindingRegion = (graph != nullptr); applyMovementChange(); } @@ -589,10 +589,10 @@ float AICreatureController::realAlter(float time) bool resetHateTimer = false; CachedNetworkId const & hateTarget = creatureOwner->getHateTarget(); CreatureObject * const hateTargetCreatureObject = CreatureObject::asCreatureObject(hateTarget.getObject()); - CreatureController const * const hateTargetCreatureController = (hateTargetCreatureObject != NULL) ? CreatureController::asCreatureController(hateTargetCreatureObject->getController()) : NULL; + CreatureController const * const hateTargetCreatureController = (hateTargetCreatureObject != nullptr) ? CreatureController::asCreatureController(hateTargetCreatureObject->getController()) : nullptr; - if ( (hateTargetCreatureObject != NULL) - && (hateTargetCreatureController != NULL)) + if ( (hateTargetCreatureObject != nullptr) + && (hateTargetCreatureController != nullptr)) { float const hateTargetMovementSpeedSquared = hateTargetCreatureController->getCurrentVelocity().magnitudeSquared(); float const hateTargetWalkSpeedSquared = sqr(hateTargetCreatureObject->getWalkSpeed()); @@ -605,7 +605,7 @@ float AICreatureController::realAlter(float time) { Object * const combatStartLocationCell = NetworkIdManager::getObjectById(m_combatStartLocation.get().getCell()); Vector const & combatStartPosition_c = m_combatStartLocation.get().getCoordinates(); - Vector const & combatStartPosition_w = (combatStartLocationCell != NULL) ? combatStartLocationCell->rotateTranslate_o2w(combatStartPosition_c) : combatStartPosition_c; + Vector const & combatStartPosition_w = (combatStartLocationCell != nullptr) ? combatStartLocationCell->rotateTranslate_o2w(combatStartPosition_c) : combatStartPosition_c; float const distanceToCombatStartLocationSquared = creatureOwner->getPosition_w().magnitudeBetweenSquared(combatStartPosition_w); float const aggroRadius = getAggroRadius(); @@ -621,7 +621,7 @@ float AICreatureController::realAlter(float time) hateTargetCreatureObject->resetHateTimer(); } } - else if (hateTarget.getObject() != NULL) + else if (hateTarget.getObject() != nullptr) { // AI don't need to lose interest in stationary AI @@ -662,7 +662,7 @@ float AICreatureController::realAlter(float time) } #ifdef _DEBUG - if (aiDebugString != NULL) + if (aiDebugString != nullptr) { m_movement->addDebug(*aiDebugString); } @@ -697,7 +697,7 @@ float AICreatureController::realAlter(float time) updateMovementType(); #ifdef _DEBUG - if (aiDebugString != NULL) + if (aiDebugString != nullptr) { sendDebugAiToClients(*aiDebugString); delete aiDebugString; @@ -711,7 +711,7 @@ float AICreatureController::realAlter(float time) //---------------------------------------------------------------------- void AICreatureController::changeMovement(AiMovementBasePtr newMovement) { - LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::changeMovement() movement(%s)", (newMovement != AiMovementBaseNullPtr) ? AiMovementBase::getMovementString(newMovement->getType()) : "NULL")); + LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::changeMovement() movement(%s)", (newMovement != AiMovementBaseNullPtr) ? AiMovementBase::getMovementString(newMovement->getType()) : "nullptr")); if (getOwner()->isAuthoritative()) { @@ -876,11 +876,11 @@ void AICreatureController::loiter(CellProperty const * homeCell, Vector const & { if (isRetreating()) { - WARNING(true, ("AICreatureController::loiter() owner(%s) cell(%s) home(%.0f, %.0f, %.0f) distance[%.2f...%.2f] delay[%.0f...%.0f] Trying to loiter while retreating, failing request.", getDebugInformation().c_str(), ((homeCell != NULL) ? homeCell->getCellName() : "NULL"), home_p.x, home_p.y, home_p.z, minDistance, maxDistance, minDelay, maxDelay)); + WARNING(true, ("AICreatureController::loiter() owner(%s) cell(%s) home(%.0f, %.0f, %.0f) distance[%.2f...%.2f] delay[%.0f...%.0f] Trying to loiter while retreating, failing request.", getDebugInformation().c_str(), ((homeCell != nullptr) ? homeCell->getCellName() : "nullptr"), home_p.x, home_p.y, home_p.z, minDistance, maxDistance, minDelay, maxDelay)); return; } - LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::loiter() owner(%s) cell(%s) home(%.0f, %.0f, %.0f) distance[%.2f...%.2f] delay[%.0f...%.0f]", getDebugInformation().c_str(), ((homeCell != NULL) ? homeCell->getCellName() : "NULL"), home_p.x, home_p.y, home_p.z, minDistance, maxDistance, minDelay, maxDelay)); + LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::loiter() owner(%s) cell(%s) home(%.0f, %.0f, %.0f) distance[%.2f...%.2f] delay[%.0f...%.0f]", getDebugInformation().c_str(), ((homeCell != nullptr) ? homeCell->getCellName() : "nullptr"), home_p.x, home_p.y, home_p.z, minDistance, maxDistance, minDelay, maxDelay)); AiMovementBasePtr movement(new AiMovementLoiter(this, homeCell, home_p, minDistance, maxDistance, minDelay, maxDelay)); @@ -910,7 +910,7 @@ void AICreatureController::moveTo(CellProperty const * cell, Vector const & targ { if (isRetreating()) { - WARNING(true, ("AICreatureController::moveTo() owner(%s) cell(%s) position(%.0f, %.0f, %.0f) radius(%.2f) Trying to moveTo while retreating, failing request.", getDebugInformation().c_str(), ((cell != NULL) ? cell->getCellName() : "NULL"), target_p.x, target_p.y, target_p.z, radius)); + WARNING(true, ("AICreatureController::moveTo() owner(%s) cell(%s) position(%.0f, %.0f, %.0f) radius(%.2f) Trying to moveTo while retreating, failing request.", getDebugInformation().c_str(), ((cell != nullptr) ? cell->getCellName() : "nullptr"), target_p.x, target_p.y, target_p.z, radius)); return; } @@ -918,9 +918,9 @@ void AICreatureController::moveTo(CellProperty const * cell, Vector const & targ if (getMovementType() == AMT_move) { - AiMovementMove * const aiMovementMove = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementMove() : NULL; + AiMovementMove * const aiMovementMove = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementMove() : nullptr; - if (aiMovementMove != NULL) + if (aiMovementMove != nullptr) { AiLocation const & target = aiMovementMove->getTarget(); @@ -935,7 +935,7 @@ void AICreatureController::moveTo(CellProperty const * cell, Vector const & targ if (!duplicateMovement) { - LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::moveTo() owner(%s) cell(%s) position(%.0f, %.0f, %.0f) radius(%.2f)", getDebugInformation().c_str(), ((cell != NULL) ? cell->getCellName() : "NULL"), target_p.x, target_p.y, target_p.z, radius)); + LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::moveTo() owner(%s) cell(%s) position(%.0f, %.0f, %.0f) radius(%.2f)", getDebugInformation().c_str(), ((cell != nullptr) ? cell->getCellName() : "nullptr"), target_p.x, target_p.y, target_p.z, radius)); AiMovementBasePtr movement(new AiMovementMove(this, cell, target_p, radius)); @@ -957,9 +957,9 @@ void AICreatureController::moveTo(Unicode::String const & targetName) if (getMovementType() == AMT_move) { - AiMovementMove * const aiMovementMove = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementMove() : NULL; + AiMovementMove * const aiMovementMove = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementMove() : nullptr; - if (aiMovementMove != NULL) + if (aiMovementMove != nullptr) { if (aiMovementMove->getTargetName() == targetName) { @@ -992,8 +992,8 @@ void AICreatureController::patrol( std::vector const & locations, bool if (getMovementType() == AMT_patrol) { - AiMovementPatrol * const aiMovementPatrol = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementPatrol() : NULL; - if (aiMovementPatrol != NULL) + AiMovementPatrol * const aiMovementPatrol = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementPatrol() : nullptr; + if (aiMovementPatrol != nullptr) { // if () // { @@ -1026,8 +1026,8 @@ void AICreatureController::patrol( std::vector const & location if (getMovementType() == AMT_patrol) { - AiMovementPatrol * const aiMovementPatrol = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementPatrol() : NULL; - if (aiMovementPatrol != NULL) + AiMovementPatrol * const aiMovementPatrol = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementPatrol() : nullptr; + if (aiMovementPatrol != nullptr) { // if () // { @@ -1071,7 +1071,7 @@ bool AICreatureController::faceTo(CellProperty const * targetCell, Vector const { if (isRetreating()) { - WARNING(true, ("AICreatureController::faceTo() owner(%s) cell(%s) position(%.0f, %.0f, %.0f) Trying to faceTo while retreating, failing faceTo request.", getDebugInformation().c_str(), ((targetCell != NULL) ? targetCell->getCellName() : "NULL"), target_p.x, target_p.y, target_p.z)); + WARNING(true, ("AICreatureController::faceTo() owner(%s) cell(%s) position(%.0f, %.0f, %.0f) Trying to faceTo while retreating, failing faceTo request.", getDebugInformation().c_str(), ((targetCell != nullptr) ? targetCell->getCellName() : "nullptr"), target_p.x, target_p.y, target_p.z)); return false; } @@ -1079,9 +1079,9 @@ bool AICreatureController::faceTo(CellProperty const * targetCell, Vector const if (getMovementType() == AMT_face) { - AiMovementFace * const aiMovementFace = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementFace() : NULL; + AiMovementFace * const aiMovementFace = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementFace() : nullptr; - if (aiMovementFace != NULL) + if (aiMovementFace != nullptr) { AiLocation const & target = aiMovementFace->getTarget(); @@ -1095,7 +1095,7 @@ bool AICreatureController::faceTo(CellProperty const * targetCell, Vector const if (!duplicateMovement) { - LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::faceTo() owner(%s) cell(%s) position(%.0f, %.0f, %.0f)", getDebugInformation().c_str(), ((targetCell != NULL) ? targetCell->getCellName() : "NULL"), target_p.x, target_p.y, target_p.z)); + LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::faceTo() owner(%s) cell(%s) position(%.0f, %.0f, %.0f)", getDebugInformation().c_str(), ((targetCell != nullptr) ? targetCell->getCellName() : "nullptr"), target_p.x, target_p.y, target_p.z)); AiMovementBasePtr behavior(new AiMovementFace(this, targetCell, target_p)); @@ -1126,9 +1126,9 @@ bool AICreatureController::faceTo( NetworkId const & targetId ) if (getMovementType() == AMT_face) { - AiMovementFace * const aiMovementFace = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementFace() : NULL; + AiMovementFace * const aiMovementFace = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementFace() : nullptr; - if (aiMovementFace != NULL) + if (aiMovementFace != nullptr) { AiLocation const & target = aiMovementFace->getTarget(); @@ -1171,9 +1171,9 @@ bool AICreatureController::follow( NetworkId const & targetId, float minDistance if (getMovementType() == AMT_follow) { - AiMovementFollow * const aiMovementFollow = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementFollow() : NULL; + AiMovementFollow * const aiMovementFollow = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementFollow() : nullptr; - if (aiMovementFollow != NULL) + if (aiMovementFollow != nullptr) { AiLocation const & target = aiMovementFollow->getTarget(); @@ -1219,9 +1219,9 @@ bool AICreatureController::follow( NetworkId const & targetId, Vector const & of if (getMovementType() == AMT_follow) { - AiMovementFollow * const aiMovementFollow = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementFollow() : NULL; + AiMovementFollow * const aiMovementFollow = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementFollow() : nullptr; - if (aiMovementFollow != NULL) + if (aiMovementFollow != nullptr) { AiLocation const & offsetTarget = aiMovementFollow->getOffsetTarget(); @@ -1403,9 +1403,9 @@ void AICreatureController::moveCreature( CellProperty const * newCell, Vector co CellProperty * currentCell = getOwner()->getParentCell(); - CellObject * newCellObject = NULL; + CellObject * newCellObject = nullptr; - if( (newCell != NULL) && (newCell != CellProperty::getWorldCellProperty()) ) + if( (newCell != nullptr) && (newCell != CellProperty::getWorldCellProperty()) ) { newCellObject = const_cast(safe_cast(&newCell->getOwner())); } @@ -1422,12 +1422,12 @@ void AICreatureController::moveCreature( CellProperty const * newCell, Vector co CellProperty const * destCell = getCreatureCell()->getDestinationCell(oldPosition+offset,newPosition+offset,dummy); - if((destCell != NULL) && (destCell != newCell)) + if((destCell != nullptr) && (destCell != newCell)) { newPosition = CollisionUtils::transformToCell(newCell,newPosition,destCell); newCell = destCell; - newCellObject = NULL; + newCellObject = nullptr; if(newCell != CellProperty::getWorldCellProperty()) { @@ -1820,15 +1820,15 @@ AICreatureController * AICreatureController::getAiCreatureController(NetworkId c { Object * const object = NetworkIdManager::getObjectById(networkId); - return (object != NULL) ? AICreatureController::asAiCreatureController(object->getController()) : NULL; + return (object != nullptr) ? AICreatureController::asAiCreatureController(object->getController()) : nullptr; } // ---------------------------------------------------------------------- AICreatureController * AICreatureController::asAiCreatureController(Controller * controller) { - CreatureController * const creatureController = (controller != NULL) ? controller->asCreatureController() : NULL; - AICreatureController * const aiCreatureController = (creatureController != NULL) ? creatureController->asAiCreatureController() : NULL; + CreatureController * const creatureController = (controller != nullptr) ? controller->asCreatureController() : nullptr; + AICreatureController * const aiCreatureController = (creatureController != nullptr) ? creatureController->asAiCreatureController() : nullptr; return aiCreatureController; } @@ -1837,8 +1837,8 @@ AICreatureController * AICreatureController::asAiCreatureController(Controller * AICreatureController const * AICreatureController::asAiCreatureController(Controller const * controller) { - CreatureController const * const creatureController = (controller != NULL) ? controller->asCreatureController() : NULL; - AICreatureController const * const aiCreatureController = (creatureController != NULL) ? creatureController->asAiCreatureController() : NULL; + CreatureController const * const creatureController = (controller != nullptr) ? controller->asCreatureController() : nullptr; + AICreatureController const * const aiCreatureController = (creatureController != nullptr) ? creatureController->asAiCreatureController() : nullptr; return aiCreatureController; } @@ -1880,7 +1880,7 @@ float AICreatureController::getRespectRadius(NetworkId const & target) const CreatureObject const * respectCreatureObject = CreatureObject::getCreatureObject(target); - if (respectCreatureObject != NULL) + if (respectCreatureObject != nullptr) { // If the target has a master, then use the master's level for the respect calculation @@ -1893,7 +1893,7 @@ float AICreatureController::getRespectRadius(NetworkId const & target) const // Respect is only towards players - if ( (respectCreatureObject != NULL) + if ( (respectCreatureObject != nullptr) && respectCreatureObject->isPlayerControlled()) { CreatureObject const * const creatureOwner = getCreature(); @@ -1906,7 +1906,7 @@ float AICreatureController::getRespectRadius(NetworkId const & target) const } else { - WARNING(true, ("AICreatureController::getRespectRadius() owner(%s) master(%s) The owner has a master who is not a player. Why does this happen?", getDebugInformation().c_str(), (respectCreatureObject != NULL) ? respectCreatureObject->getDebugInformation().c_str() : masterId.getValueString().c_str())); + WARNING(true, ("AICreatureController::getRespectRadius() owner(%s) master(%s) The owner has a master who is not a player. Why does this happen?", getDebugInformation().c_str(), (respectCreatureObject != nullptr) ? respectCreatureObject->getDebugInformation().c_str() : masterId.getValueString().c_str())); } } @@ -1942,7 +1942,7 @@ void AICreatureController::sendDebugAiToClients(AiDebugString & aiDebugString) // Display the name and level { - aiDebugString.addText(fs.sprintf("%d %s\n", creatureOwner->getLevel(), (getCreatureName().isEmpty() ? "NULL" : getCreatureName().getString())), PackedRgb::solidWhite); + aiDebugString.addText(fs.sprintf("%d %s\n", creatureOwner->getLevel(), (getCreatureName().isEmpty() ? "nullptr" : getCreatureName().getString())), PackedRgb::solidWhite); } // Display the look at target @@ -1990,7 +1990,7 @@ void AICreatureController::sendDebugAiToClients(AiDebugString & aiDebugString) { Floor const * const floor = CollisionWorld::getFloorStandingOn(*creatureOwner); - aiDebugString.addText(fs.sprintf("floor (%s)\n", (floor == NULL) ? "none" : floor->getId().getValueString().c_str()), PackedRgb::solidWhite); + aiDebugString.addText(fs.sprintf("floor (%s)\n", (floor == nullptr) ? "none" : floor->getId().getValueString().c_str()), PackedRgb::solidWhite); } // Display the AI movement speed @@ -2008,15 +2008,15 @@ void AICreatureController::sendDebugAiToClients(AiDebugString & aiDebugString) // Primary Weapon { ServerObject const * const primaryServerObject = ServerObject::getServerObject(getPrimaryWeapon()); - WeaponObject const * const primaryWeaponObject = (primaryServerObject != NULL) ? primaryServerObject->asWeaponObject() : NULL; + WeaponObject const * const primaryWeaponObject = (primaryServerObject != nullptr) ? primaryServerObject->asWeaponObject() : nullptr; - if (primaryWeaponObject != NULL) + if (primaryWeaponObject != nullptr) { aiDebugString.addText(fs.sprintf("%s pri(%s) [%.0f...%.0f] sp(%s)\n", (usingPrimaryWeapon() ? "->" : ""), FileNameUtils::get(primaryWeaponObject->getObjectTemplateName(), FileNameUtils::fileName).c_str(), primaryWeaponObject->getMinRange(), primaryWeaponObject->getMaxRange(), m_aiCreatureData->m_primarySpecials.isEmpty() ? "none" : m_aiCreatureData->m_primarySpecials.getString()), PackedRgb::solidWhite); } else { - aiDebugString.addText(fs.sprintf("pri(NULL:ERROR)\n"), PackedRgb::solidWhite); + aiDebugString.addText(fs.sprintf("pri(nullptr:ERROR)\n"), PackedRgb::solidWhite); } //if (usingPrimaryWeapon()) @@ -2040,9 +2040,9 @@ void AICreatureController::sendDebugAiToClients(AiDebugString & aiDebugString) // Secondary Weapon { ServerObject const * const secondaryServerObject = ServerObject::getServerObject(getSecondaryWeapon()); - WeaponObject const * const secondaryWeaponObject = (secondaryServerObject != NULL) ? secondaryServerObject->asWeaponObject() : NULL; + WeaponObject const * const secondaryWeaponObject = (secondaryServerObject != nullptr) ? secondaryServerObject->asWeaponObject() : nullptr; - if (secondaryWeaponObject != NULL) + if (secondaryWeaponObject != nullptr) { aiDebugString.addText(fs.sprintf("%s sec (%s) [%.0f...%.0f] sp(%s)\n", (usingSecondaryWeapon() ? "->" : ""), FileNameUtils::get(secondaryWeaponObject->getObjectTemplateName(), FileNameUtils::fileName).c_str(), secondaryWeaponObject->getMinRange(), secondaryWeaponObject->getMaxRange(), m_aiCreatureData->m_secondarySpecials.isEmpty() ? "none" : m_aiCreatureData->m_secondarySpecials.getString()), PackedRgb::solidWhite); } @@ -2113,13 +2113,13 @@ void AICreatureController::sendDebugAiToClients(AiDebugString & aiDebugString) TangibleObject const * const hateTargetTangibleObject = TangibleObject::asTangibleObject(hateTarget.getObject()); float const hate = iterHateList->second; std::string hateTargetName; - if (hateTargetTangibleObject != NULL) + if (hateTargetTangibleObject != nullptr) { hateTargetName = Unicode::wideToNarrow(hateTargetTangibleObject->getEncodedObjectName()).c_str(); } else { - hateTargetName = "NULL"; + hateTargetName = "nullptr"; } aiDebugString.addText(fs.sprintf("%s:%s(%.1f)\n", hateTargetName.c_str(), hateTarget.getValueString().c_str(), hate), (iterHateList == hateList.begin()) ? PackedRgb::solidGreen : PackedRgb::solidRed); @@ -2174,7 +2174,7 @@ void AICreatureController::sendDebugAiToClients(AiDebugString & aiDebugString) // Only send to the client if the objvar is set int temp = 0; - if ( (characterObject != NULL) + if ( (characterObject != nullptr) && characterObject->getObjVars().getItem("ai_debug_string", temp)) { if (temp > 0) @@ -2196,7 +2196,7 @@ void AICreatureController::setHomeLocation(Location const & location) { if (getOwner()->isAuthoritative()) { - LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::setHomeLocation() owner(%s) sceneId(%u:%s) cell(%s) coordinates(%.2f, %.2f, %.2f)", getDebugInformation().c_str(), location.getSceneIdCrc(), (location.getSceneId() != NULL) ? location.getSceneId() : "NULL", location.getCell().getValueString().c_str(), location.getCoordinates().x, location.getCoordinates().y, location.getCoordinates().z)); + LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::setHomeLocation() owner(%s) sceneId(%u:%s) cell(%s) coordinates(%.2f, %.2f, %.2f)", getDebugInformation().c_str(), location.getSceneIdCrc(), (location.getSceneId() != nullptr) ? location.getSceneId() : "nullptr", location.getCell().getValueString().c_str(), location.getCoordinates().x, location.getCoordinates().y, location.getCoordinates().z)); m_homeLocation = location; } @@ -2221,7 +2221,7 @@ void AICreatureController::markCombatStartLocation() { m_combatStartLocation = getLocation(*creatureOwner); - LOGC(AiLogManager::isLogging(creatureOwner->getNetworkId()), "debug_ai", ("AICreatureController::markCombatStartLocation() owner(%s) sceneId(%u:%s) cell(%s) coordinates(%.2f, %.2f, %.2f)", getDebugInformation().c_str(), m_combatStartLocation.get().getSceneIdCrc(), (m_combatStartLocation.get().getSceneId() != NULL) ? m_combatStartLocation.get().getSceneId() : "NULL", m_combatStartLocation.get().getCell().getValueString().c_str(), m_combatStartLocation.get().getCoordinates().x, m_combatStartLocation.get().getCoordinates().y, m_combatStartLocation.get().getCoordinates().z)); + LOGC(AiLogManager::isLogging(creatureOwner->getNetworkId()), "debug_ai", ("AICreatureController::markCombatStartLocation() owner(%s) sceneId(%u:%s) cell(%s) coordinates(%.2f, %.2f, %.2f)", getDebugInformation().c_str(), m_combatStartLocation.get().getSceneIdCrc(), (m_combatStartLocation.get().getSceneId() != nullptr) ? m_combatStartLocation.get().getSceneId() : "nullptr", m_combatStartLocation.get().getCell().getValueString().c_str(), m_combatStartLocation.get().getCoordinates().x, m_combatStartLocation.get().getCoordinates().y, m_combatStartLocation.get().getCoordinates().z)); m_primaryWeaponActions.reset(); m_secondaryWeaponActions.reset(); @@ -2279,14 +2279,14 @@ void AICreatureController::onCreatureNameChanged(std::string const & creatureNam AiCreatureCombatProfile const * const primaryWeaponCombatProfile = AiCreatureCombatProfile::getCombatProfile(m_aiCreatureData->m_primarySpecials); - if (primaryWeaponCombatProfile != NULL) + if (primaryWeaponCombatProfile != nullptr) { m_primaryWeaponActions.setCombatProfile(*creatureOwner, *primaryWeaponCombatProfile); } AiCreatureCombatProfile const * const secondaryWeaponCombatProfile = AiCreatureCombatProfile::getCombatProfile(m_aiCreatureData->m_secondarySpecials); - if (secondaryWeaponCombatProfile != NULL) + if (secondaryWeaponCombatProfile != nullptr) { m_secondaryWeaponActions.setCombatProfile(*creatureOwner, *secondaryWeaponCombatProfile); } @@ -2326,7 +2326,7 @@ void AICreatureController::destroyPrimaryWeapon() { WeaponObject * const primaryWeapon = WeaponObject::getWeaponObject(getPrimaryWeapon()); - if (primaryWeapon != NULL) + if (primaryWeapon != nullptr) { unEquipWeapons(); primaryWeapon->permanentlyDestroy(DeleteReasons::God); @@ -2361,7 +2361,7 @@ void AICreatureController::destroySecondaryWeapon() { WeaponObject * const secondaryWeapon = WeaponObject::getWeaponObject(getSecondaryWeapon()); - if (secondaryWeapon != NULL) + if (secondaryWeapon != nullptr) { unEquipWeapons(); secondaryWeapon->permanentlyDestroy(DeleteReasons::God); @@ -2372,7 +2372,7 @@ void AICreatureController::destroySecondaryWeapon() PersistentCrcString const & AICreatureController::getCreatureName() const { - if (m_aiCreatureData->m_name == NULL) + if (m_aiCreatureData->m_name == nullptr) { return *s_defaultCreatureName; } @@ -2401,7 +2401,7 @@ NetworkId AICreatureController::createWeapon(char const * const functionName, Cr CreatureObject * const creatureOwner = getCreature(); ServerObject * const inventory = creatureOwner->getInventory(); - if (inventory == NULL) + if (inventory == nullptr) { WARNING(true, ("AICreatureController::%s() Unable to find inventory for (%s) to place a weapon(%s)", functionName, getDebugInformation().c_str(), weaponName.getString())); } @@ -2440,7 +2440,7 @@ NetworkId AICreatureController::createWeapon(char const * const functionName, Cr bool const persisted = false; ServerObject * const newObject = ServerWorld::createNewObject(weaponCrcName.getCrc(), *inventory, persisted); - if (newObject != NULL) + if (newObject != nullptr) { result = newObject->getNetworkId(); } @@ -2464,7 +2464,7 @@ NetworkId AICreatureController::getUnarmedWeapon() CreatureObject * const creatureOwner = getCreature(); WeaponObject * const defaultWeapon = creatureOwner->getDefaultWeapon(); - if (defaultWeapon != NULL) + if (defaultWeapon != nullptr) { result = defaultWeapon->getNetworkId(); } @@ -2492,9 +2492,9 @@ void AICreatureController::equipPrimaryWeapon() if (!usingPrimaryWeapon()) { ServerObject * const primaryWeaponServerObject = ServerObject::getServerObject(getPrimaryWeapon()); - WeaponObject * const primaryWeaponObject = (primaryWeaponServerObject != NULL) ? primaryWeaponServerObject->asWeaponObject() : NULL; + WeaponObject * const primaryWeaponObject = (primaryWeaponServerObject != nullptr) ? primaryWeaponServerObject->asWeaponObject() : nullptr; - if (primaryWeaponObject != NULL) + if (primaryWeaponObject != nullptr) { unEquipWeapons(); @@ -2508,7 +2508,7 @@ void AICreatureController::equipPrimaryWeapon() { Container::ContainerErrorCode errorCode; - if (ContainerInterface::transferItemToGeneralContainer(*creatureOwner, *primaryWeaponServerObject, NULL, errorCode)) + if (ContainerInterface::transferItemToGeneralContainer(*creatureOwner, *primaryWeaponServerObject, nullptr, errorCode)) { LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::equipPrimaryWeapon() owner(%s) primaryWeapon(%s)\n", getDebugInformation().c_str(), primaryWeaponServerObject->getDebugInformation().c_str())); @@ -2516,7 +2516,7 @@ void AICreatureController::equipPrimaryWeapon() GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(creatureOwner); - if (gameScriptObject != NULL) + if (gameScriptObject != nullptr) { ScriptParams scriptParams; scriptParams.addParam(primaryWeaponObject->getNetworkId()); @@ -2557,9 +2557,9 @@ void AICreatureController::equipSecondaryWeapon() if (!usingSecondaryWeapon()) { ServerObject * const secondaryWeaponServerObject = ServerObject::getServerObject(getSecondaryWeapon()); - WeaponObject * const secondaryWeaponObject = (secondaryWeaponServerObject != NULL) ? secondaryWeaponServerObject->asWeaponObject() : NULL; + WeaponObject * const secondaryWeaponObject = (secondaryWeaponServerObject != nullptr) ? secondaryWeaponServerObject->asWeaponObject() : nullptr; - if (secondaryWeaponObject != NULL) + if (secondaryWeaponObject != nullptr) { unEquipWeapons(); @@ -2573,7 +2573,7 @@ void AICreatureController::equipSecondaryWeapon() { Container::ContainerErrorCode errorCode; - if (ContainerInterface::transferItemToGeneralContainer(*creatureOwner, *secondaryWeaponServerObject, NULL, errorCode)) + if (ContainerInterface::transferItemToGeneralContainer(*creatureOwner, *secondaryWeaponServerObject, nullptr, errorCode)) { LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::equipSecondaryWeapon() owner(%s) secondaryWeapon(%s) errorCode(%d)\n", getDebugInformation().c_str(), secondaryWeaponServerObject->getDebugInformation().c_str())); @@ -2581,7 +2581,7 @@ void AICreatureController::equipSecondaryWeapon() GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(creatureOwner); - if (gameScriptObject != NULL) + if (gameScriptObject != nullptr) { ScriptParams scriptParams; scriptParams.addParam(secondaryWeaponObject->getNetworkId()); @@ -2631,7 +2631,7 @@ void AICreatureController::unEquipWeapons() { ServerObject * const inventory = creatureOwner->getInventory(); - if (inventory != NULL) + if (inventory != nullptr) { Container::ContainerErrorCode error; @@ -2648,13 +2648,13 @@ void AICreatureController::unEquipWeapons() // Equip the default weapon { - if (defaultWeapon != NULL) + if (defaultWeapon != nullptr) { creatureOwner->setCurrentWeapon(*defaultWeapon); } else { - WARNING(true, ("AICreatureController::unEquipWeapons() owner(%s) NULL default weapon", getDebugInformation().c_str())); + WARNING(true, ("AICreatureController::unEquipWeapons() owner(%s) nullptr default weapon", getDebugInformation().c_str())); } } } @@ -2690,7 +2690,7 @@ bool AICreatureController::usingPrimaryWeapon() { WeaponObject const * const currentWeaponObject = getCreature()->getCurrentWeapon(); - if (currentWeaponObject != NULL) + if (currentWeaponObject != nullptr) { result = (getPrimaryWeapon() == currentWeaponObject->getNetworkId()); } @@ -2708,7 +2708,7 @@ bool AICreatureController::usingSecondaryWeapon() { WeaponObject const * const currentWeaponObject = getCreature()->getCurrentWeapon(); - if (currentWeaponObject != NULL) + if (currentWeaponObject != nullptr) { result = (getSecondaryWeapon() == currentWeaponObject->getNetworkId()); } @@ -2815,7 +2815,7 @@ void AICreatureController::setRetreating(bool const retreating) { CellObject const * const cellObject = CellObject::getCellObject(cellId); - if (cellObject != NULL) + if (cellObject != nullptr) { CellProperty const * const cellProperty = cellObject->getCellProperty(); @@ -2965,7 +2965,7 @@ time_t AICreatureController::getKnockDownRecoveryTime() const { AiCreatureCombatProfile const * const combatProfile = AiCreatureCombatProfile::getCombatProfile(m_aiCreatureData->m_primarySpecials); - return (combatProfile != NULL) ? combatProfile->m_knockDownRecoveryTime : 0; + return (combatProfile != nullptr) ? combatProfile->m_knockDownRecoveryTime : 0; } //----------------------------------------------------------------------- std::string const AICreatureController::getCombatActionsString() @@ -2979,7 +2979,7 @@ std::string const AICreatureController::getCombatActionsString() { WeaponObject const * const primaryWeaponObject = WeaponObject::getWeaponObject(getPrimaryWeapon()); - if (primaryWeaponObject != NULL) + if (primaryWeaponObject != nullptr) { result += fs.sprintf("PRIMARY WEAPON >>> %s range[%.0f...%.0f] %s\n", FileNameUtils::get(primaryWeaponObject->getObjectTemplateName(), FileNameUtils::fileName).c_str(), primaryWeaponObject->getMinRange(), primaryWeaponObject->getMaxRange(), usingPrimaryWeapon() ? "(active)" : ""); } @@ -2989,7 +2989,7 @@ std::string const AICreatureController::getCombatActionsString() } AiCreatureCombatProfile const * const primaryWeaponCombatProfile = AiCreatureCombatProfile::getCombatProfile(m_aiCreatureData->m_primarySpecials); - if (primaryWeaponCombatProfile != NULL) + if (primaryWeaponCombatProfile != nullptr) { result += primaryWeaponCombatProfile->toString(); } @@ -3003,7 +3003,7 @@ std::string const AICreatureController::getCombatActionsString() { WeaponObject const * const secondaryWeaponObject = WeaponObject::getWeaponObject(getSecondaryWeapon()); - if (secondaryWeaponObject != NULL) + if (secondaryWeaponObject != nullptr) { result += fs.sprintf("SECONDARY WEAPON >>> %s range[%.0f...%.0f] %s\n", FileNameUtils::get(secondaryWeaponObject->getObjectTemplateName(), FileNameUtils::fileName).c_str(), secondaryWeaponObject->getMinRange(), secondaryWeaponObject->getMaxRange(), usingSecondaryWeapon() ? "(active)" : ""); } @@ -3014,7 +3014,7 @@ std::string const AICreatureController::getCombatActionsString() AiCreatureCombatProfile const * const secondaryWeaponCombatProfile = AiCreatureCombatProfile::getCombatProfile(m_aiCreatureData->m_secondarySpecials); - if (secondaryWeaponCombatProfile != NULL) + if (secondaryWeaponCombatProfile != nullptr) { result += secondaryWeaponCombatProfile->toString(); } diff --git a/engine/server/library/serverGame/src/shared/controller/AiShipController.cpp b/engine/server/library/serverGame/src/shared/controller/AiShipController.cpp index d2bf69f7..3fe9a88f 100755 --- a/engine/server/library/serverGame/src/shared/controller/AiShipController.cpp +++ b/engine/server/library/serverGame/src/shared/controller/AiShipController.cpp @@ -127,15 +127,15 @@ AiShipController * AiShipController::getAiShipController(NetworkId const & unit) { Object * const object = NetworkIdManager::getObjectById(unit); - return (object != NULL) ? AiShipController::asAiShipController(object->getController()) : NULL; + return (object != nullptr) ? AiShipController::asAiShipController(object->getController()) : nullptr; } // ---------------------------------------------------------------------- AiShipController * AiShipController::asAiShipController(Controller * const controller) { - ShipController * const shipController = (controller != NULL) ? controller->asShipController() : NULL; - AiShipController * const aiShipController = (shipController != NULL) ? shipController->asAiShipController() : NULL; + ShipController * const shipController = (controller != nullptr) ? controller->asShipController() : nullptr; + AiShipController * const aiShipController = (shipController != nullptr) ? shipController->asAiShipController() : nullptr; return aiShipController; } @@ -144,8 +144,8 @@ AiShipController * AiShipController::asAiShipController(Controller * const contr AiShipController const * AiShipController::asAiShipController(Controller const * const controller) { - ShipController const * const shipController = (controller != NULL) ? controller->asShipController() : NULL; - AiShipController const * const aiShipController = (shipController != NULL) ? shipController->asAiShipController() : NULL; + ShipController const * const shipController = (controller != nullptr) ? controller->asShipController() : nullptr; + AiShipController const * const aiShipController = (shipController != nullptr) ? shipController->asAiShipController() : nullptr; return aiShipController; } @@ -155,18 +155,18 @@ AiShipController const * AiShipController::asAiShipController(Controller const * AiShipController::AiShipController(ShipObject * const owner) : ShipController(owner), m_pilotData(&AiShipPilotData::getDefaultPilotData()), - m_pendingNonAttackBehavior(NULL), - m_nonAttackBehavior(NULL), - m_pendingAttackBehavior(NULL), - m_attackBehavior(NULL), + m_pendingNonAttackBehavior(nullptr), + m_nonAttackBehavior(nullptr), + m_pendingAttackBehavior(nullptr), + m_attackBehavior(nullptr), m_shipName(), m_shipClass(ShipAiReactionManager::SC_invalid), m_requestedSlowDown(false), - m_squad(NULL), - m_attackSquad(NULL), + m_squad(nullptr), + m_attackSquad(nullptr), m_formationPosition_l(), m_attackFormationPosition_l(), - m_path(NULL), + m_path(nullptr), m_currentPathIndex(0), m_aggroRadius(200.0f), m_countermeasureState(CS_none), @@ -190,22 +190,22 @@ AiShipController::~AiShipController() // Remove this unit from its squad - if (m_squad != NULL) + if (m_squad != nullptr) { // The owner of the squad is SpaceSquadManager getSquad().removeUnit(getOwner()->getNetworkId()); - m_squad = NULL; + m_squad = nullptr; } // Remove this unit from its attack squad - if (m_attackSquad != NULL) + if (m_attackSquad != nullptr) { // The owner of the attack squad is SpaceSquad m_attackSquad->removeUnit(getOwner()->getNetworkId()); - m_attackSquad = NULL; + m_attackSquad = nullptr; } else { @@ -215,17 +215,17 @@ AiShipController::~AiShipController() // Remove path here. SpacePathManager::release(m_path, getOwner()); - m_path = NULL; - m_pilotData = NULL; + m_path = nullptr; + m_pilotData = nullptr; delete m_nonAttackBehavior; - m_nonAttackBehavior = NULL; + m_nonAttackBehavior = nullptr; delete m_pendingNonAttackBehavior; - m_pendingNonAttackBehavior = NULL; + m_pendingNonAttackBehavior = nullptr; delete m_pendingAttackBehavior; - m_pendingAttackBehavior = NULL; + m_pendingAttackBehavior = nullptr; delete m_attackBehavior; - m_attackBehavior = NULL; + m_attackBehavior = nullptr; delete m_reactToMissileTimer; delete m_pilotManagerInfo; delete m_exclusiveAggroSet; @@ -234,7 +234,7 @@ AiShipController::~AiShipController() // ---------------------------------------------------------------------- void AiShipController::endBaselines() { - DEBUG_FATAL((m_squad != NULL), ("m_squad should be NULL")); + DEBUG_FATAL((m_squad != nullptr), ("m_squad should be nullptr")); m_squad = SpaceSquadManager::createSquad(); getSquad().addUnit(getOwner()->getNetworkId()); @@ -252,7 +252,7 @@ float AiShipController::realAlter(float const elapsedTime) #ifdef _DEBUG - AiDebugString * aiDebugString = NULL; + AiDebugString * aiDebugString = nullptr; if ( s_spaceAiClientDebugEnabled && !getShipOwner()->getObservers().empty()) { @@ -263,25 +263,25 @@ float AiShipController::realAlter(float const elapsedTime) // We have to have a pending behavior because while in a behavior a trigger can get called which can then kill that behavior, so we have to wait until the next frame to switch behaviors so they don't stomp each other from triggers. - if (m_pendingNonAttackBehavior != NULL) + if (m_pendingNonAttackBehavior != nullptr) { delete m_nonAttackBehavior; m_nonAttackBehavior = m_pendingNonAttackBehavior; - m_pendingNonAttackBehavior = NULL; + m_pendingNonAttackBehavior = nullptr; } - if (m_pendingDockingBehavior != NULL) + if (m_pendingDockingBehavior != nullptr) { delete m_dockingBehavior; m_dockingBehavior = m_pendingDockingBehavior; - m_pendingDockingBehavior = NULL; + m_pendingDockingBehavior = nullptr; } - if ( (m_dockingBehavior != NULL) + if ( (m_dockingBehavior != nullptr) && (m_dockingBehavior->isDockFinished())) { delete m_dockingBehavior; - m_dockingBehavior = NULL; + m_dockingBehavior = nullptr; } m_yawPosition = 0.f; @@ -292,7 +292,7 @@ float AiShipController::realAlter(float const elapsedTime) ShipObject * const shipOwner = NON_NULL(getShipOwner()); PROFILER_AUTO_BLOCK_DEFINE("behaviors"); - if (m_attackBehavior != NULL) // This was added for ships that are contructed for AI but not fully contructed proper using the space_mobile.tab + if (m_attackBehavior != nullptr) // This was added for ships that are contructed for AI but not fully contructed proper using the space_mobile.tab { if (isAttacking()) // Capital ships never go into attack mode as such, always follow their non-attacking behavior (although they may fire turrets as they go) { @@ -314,7 +314,7 @@ float AiShipController::realAlter(float const elapsedTime) shipOwner->openWings(); } - if (m_dockingBehavior != NULL) + if (m_dockingBehavior != nullptr) { m_dockingBehavior->unDock(); } @@ -325,7 +325,7 @@ float AiShipController::realAlter(float const elapsedTime) m_attackBehavior->alter(elapsedTime); #ifdef _DEBUG - if (aiDebugString != NULL) + if (aiDebugString != nullptr) { m_attackBehavior->addDebug(*aiDebugString); } @@ -337,9 +337,9 @@ float AiShipController::realAlter(float const elapsedTime) Object * const leaderObject = getAttackSquad().getLeader().getObject(); ShipController * const leaderShipController = leaderObject->getController()->asShipController(); - AiShipController * const leaderAiShipController = (leaderShipController != NULL) ? leaderShipController->asAiShipController() : NULL; + AiShipController * const leaderAiShipController = (leaderShipController != nullptr) ? leaderShipController->asAiShipController() : nullptr; - if (leaderAiShipController != NULL) + if (leaderAiShipController != nullptr) { Transform transform(leaderObject->getTransform_o2w()); transform.setPosition_p(leaderAiShipController->getMoveToGoalPosition_w()); @@ -361,7 +361,7 @@ float AiShipController::realAlter(float const elapsedTime) { delete m_attackBehavior; m_attackBehavior = m_pendingAttackBehavior; - m_pendingAttackBehavior = NULL; + m_pendingAttackBehavior = nullptr; } } else if (isBeingDocked()) @@ -370,18 +370,18 @@ float AiShipController::realAlter(float const elapsedTime) setThrottle(0.0f); } - else if (m_dockingBehavior != NULL) + else if (m_dockingBehavior != nullptr) { m_dockingBehavior->alter(elapsedTime); #ifdef _DEBUG - if (aiDebugString != NULL) + if (aiDebugString != nullptr) { m_dockingBehavior->addDebug(*aiDebugString); } #endif // _DEBUG } - else if (m_nonAttackBehavior != NULL) + else if (m_nonAttackBehavior != nullptr) { PROFILER_AUTO_BLOCK_DEFINE("non-attack behaviors"); @@ -413,7 +413,7 @@ float AiShipController::realAlter(float const elapsedTime) m_nonAttackBehavior->alter(elapsedTime); #ifdef _DEBUG - if (aiDebugString != NULL) + if (aiDebugString != nullptr) { m_nonAttackBehavior->addDebug(*aiDebugString); } @@ -425,7 +425,7 @@ float AiShipController::realAlter(float const elapsedTime) Object * const squadLeader = getSquad().getLeader().getObject(); - if (squadLeader != NULL) + if (squadLeader != nullptr) { Vector goalPosition_w(Formation::getPosition_w(squadLeader->getTransform_o2w(), getFormationPosition_l())); @@ -434,9 +434,9 @@ float AiShipController::realAlter(float const elapsedTime) if (getOwner()->getPosition_w().magnitudeBetweenSquared(goalPosition_w) > sqr(getLargestTurnRadius() * s_slowDownTurnRadiusGain)) { ShipController * const followedUnitShipController = squadLeader->getController()->asShipController(); - AiShipController * const followedUnitAiShipController = (followedUnitShipController != NULL) ? followedUnitShipController->asAiShipController() : NULL; + AiShipController * const followedUnitAiShipController = (followedUnitShipController != nullptr) ? followedUnitShipController->asAiShipController() : nullptr; - if (followedUnitAiShipController != NULL) + if (followedUnitAiShipController != nullptr) { followedUnitAiShipController->requestSlowDown(); } @@ -462,7 +462,7 @@ float AiShipController::realAlter(float const elapsedTime) } #ifdef _DEBUG - if (aiDebugString != NULL) + if (aiDebugString != nullptr) { m_nonAttackBehavior->addDebug(*aiDebugString); } @@ -476,7 +476,7 @@ float AiShipController::realAlter(float const elapsedTime) } else { - DEBUG_WARNING(true, ("debug_ai: There should never be a NULL non-attacking behavior %s", getOwner()->getDebugInformation().c_str())); + DEBUG_WARNING(true, ("debug_ai: There should never be a nullptr non-attacking behavior %s", getOwner()->getDebugInformation().c_str())); } } @@ -551,8 +551,8 @@ float AiShipController::realAlter(float const elapsedTime) } #ifdef _DEBUG - if ( (m_attackBehavior != NULL) - && (aiDebugString != NULL)) + if ( (m_attackBehavior != nullptr) + && (aiDebugString != nullptr)) { PROFILER_AUTO_BLOCK_DEFINE("sendDebugAiToClients"); sendDebugAiToClients(*aiDebugString); @@ -574,7 +574,7 @@ void AiShipController::moveTo(Vector const & position_w, float const throttle, f // If we are not following a unit, see if we need to slow down for someone - if ( (m_nonAttackBehavior != NULL) + if ( (m_nonAttackBehavior != nullptr) && (m_nonAttackBehavior->getBehaviorType() != ASBT_follow) && m_requestedSlowDown && !isAttacking()) @@ -645,16 +645,16 @@ bool AiShipController::addDamageTaken(NetworkId const & attackingUnit, float con { ShipObject const * const attackingShipObject = ShipObject::asShipObject(NetworkIdManager::getObjectById(attackingUnit)); - if (attackingShipObject != NULL) + if (attackingShipObject != nullptr) { CreatureObject const * const attackingPilotCreatureObject = attackingShipObject->getPilot(); - if ( (attackingPilotCreatureObject != NULL) + if ( (attackingPilotCreatureObject != nullptr) && attackingPilotCreatureObject->isPlayerControlled()) { GroupObject * const groupObject = attackingPilotCreatureObject->getGroup(); - if (groupObject != NULL) + if (groupObject != nullptr) { GroupObject::GroupMemberVector const & groupMembers = groupObject->getGroupMembers(); GroupObject::GroupMemberVector::const_iterator iterGroupMembers = groupMembers.begin(); @@ -665,11 +665,11 @@ bool AiShipController::addDamageTaken(NetworkId const & attackingUnit, float con NetworkId const & groupMemberPilotNetworkId = groupMember.first; CreatureObject const * const groupMemberPilotCreatureObject = CreatureObject::asCreatureObject(NetworkIdManager::getObjectById(groupMemberPilotNetworkId)); - if (groupMemberPilotCreatureObject != NULL) + if (groupMemberPilotCreatureObject != nullptr) { ShipObject const * const groupMemberShipObject = groupMemberPilotCreatureObject->getPilotedShip(); - if (groupMemberShipObject != NULL) + if (groupMemberShipObject != nullptr) { if (groupMemberShipObject != attackingShipObject) { @@ -749,24 +749,24 @@ void AiShipController::follow(NetworkId const & followedUnit, Vector const & dir LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipController::follow() owner(%s) followedUnit(%s) direction_o(%.1f, %.1f, %.1f) offset(%.1f)", getOwner()->getNetworkId().getValueString().c_str(), followedUnit.getValueString().c_str(), direction_l.x, direction_l.y, direction_l.z, distance)); SpacePathManager::release(m_path, getOwner()); - m_path = NULL; + m_path = nullptr; float appearanceRadius = 0.0f; Object const * const followedObject = NetworkIdManager::getObjectById(followedUnit); - if (followedObject != NULL) + if (followedObject != nullptr) { //-- This needs to be improved to cast a ray from this position back towards the ship and get the actual collision position CollisionProperty const * const ownerCollisionProperty = getOwner()->getCollisionProperty(); CollisionProperty const * const followedObjectCollisionProperty = followedObject->getCollisionProperty(); - if (ownerCollisionProperty != NULL) + if (ownerCollisionProperty != nullptr) { appearanceRadius += ownerCollisionProperty->getBoundingSphere_l().getRadius(); } - if (followedObjectCollisionProperty != NULL) + if (followedObjectCollisionProperty != nullptr) { appearanceRadius += followedObjectCollisionProperty ->getBoundingSphere_l().getRadius(); } @@ -786,7 +786,7 @@ int AiShipController::getBehaviorType() const { AiShipBehaviorType result = ASBT_idle; - if (m_nonAttackBehavior != NULL) + if (m_nonAttackBehavior != nullptr) { result = m_nonAttackBehavior->getBehaviorType(); } @@ -803,7 +803,7 @@ void AiShipController::idle() LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipController::idle() owner(%s)", getOwner()->getNetworkId().getValueString().c_str())); SpacePathManager::release(m_path, getOwner()); - m_path = NULL; + m_path = nullptr; delete m_pendingNonAttackBehavior; m_pendingNonAttackBehavior = new AiShipBehaviorIdle(*this);; @@ -818,7 +818,7 @@ void AiShipController::track(Object const & target) LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipController::track() owner(%s) target(%s)", getOwner()->getNetworkId().getValueString().c_str(), target.getNetworkId().getValueString().c_str())); SpacePathManager::release(m_path, getOwner()); - m_path = NULL; + m_path = nullptr; delete m_pendingNonAttackBehavior; m_pendingNonAttackBehavior = new AiShipBehaviorTrack(*this, target); @@ -871,7 +871,7 @@ void AiShipController::clearPatrolPath() { LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipController::clearPatrolPath() owner(%s)", getOwner()->getNetworkId().getValueString().c_str())); - if (m_path != NULL) + if (m_path != nullptr) { m_path->clear(); } @@ -896,15 +896,15 @@ void AiShipController::triggerBehaviorChanged(AiShipBehaviorType const newBehavi { // Only send the trigger if the new behavior is different from the old behavior - AiShipBehaviorType const oldBehavior = (m_nonAttackBehavior != NULL) ? m_nonAttackBehavior->getBehaviorType() : ASBT_idle; + AiShipBehaviorType const oldBehavior = (m_nonAttackBehavior != nullptr) ? m_nonAttackBehavior->getBehaviorType() : ASBT_idle; if (oldBehavior != newBehavior) { Object * const object = getOwner(); - ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; - GameScriptObject * const gameScriptObject = (serverObject != NULL) ? serverObject->getScriptObject() : NULL; + ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; + GameScriptObject * const gameScriptObject = (serverObject != nullptr) ? serverObject->getScriptObject() : nullptr; - if (gameScriptObject != NULL) + if (gameScriptObject != nullptr) { LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipController::triggerBehaviorChanged() unit(%s) old(%s) new(%s)", getOwner()->getNetworkId().getValueString().c_str(), AiShipBehaviorBase::getBehaviorString(oldBehavior), AiShipBehaviorBase::getBehaviorString(newBehavior))); @@ -925,10 +925,10 @@ void AiShipController::triggerBehaviorChanged(AiShipBehaviorType const newBehavi void AiShipController::triggerEnterCombat(NetworkId const & attackTarget) { Object * const object = getOwner(); - ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; - GameScriptObject * const gameScriptObject = (serverObject != NULL) ? serverObject->getScriptObject() : NULL; + ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; + GameScriptObject * const gameScriptObject = (serverObject != nullptr) ? serverObject->getScriptObject() : nullptr; - if (gameScriptObject != NULL) + if (gameScriptObject != nullptr) { LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipController::triggerEnterCombat() unit(%s) attackTarget(%s)", getOwner()->getNetworkId().getValueString().c_str(), attackTarget.getValueString().c_str())); @@ -968,7 +968,7 @@ void AiShipController::setPilotType(std::string const & pilotType) AiPilotManager::getPilotData(*m_pilotData, *m_pilotManagerInfo); // Make sure the ship name is set - if (shipObject != NULL) + if (shipObject != nullptr) { std::string shipName; @@ -986,7 +986,7 @@ void AiShipController::setPilotType(std::string const & pilotType) // Create the attack behavior based on the ship class delete m_attackBehavior; - m_attackBehavior = NULL; + m_attackBehavior = nullptr; m_shipClass = ShipAiReactionManager::getShipClass(m_shipName); @@ -1009,7 +1009,7 @@ void AiShipController::setPilotType(std::string const & pilotType) setAggroRadius(m_pilotData->m_aggroRadius); - FATAL((m_attackBehavior == NULL), ("The attack behavior can not be NULL.")); + FATAL((m_attackBehavior == nullptr), ("The attack behavior can not be nullptr.")); } // ---------------------------------------------------------------------- @@ -1029,8 +1029,8 @@ CachedNetworkId const & AiShipController::getPrimaryAttackTarget() const ShipObject const * AiShipController::getPrimaryAttackTargetShipObject() const { Object const * const targetObject = getPrimaryAttackTarget().getObject(); - ServerObject const * const targetServerObject = (targetObject != NULL) ? targetObject->asServerObject() : NULL; - ShipObject const * const targetShipObject = (targetServerObject != NULL) ? targetServerObject->asShipObject() : NULL; + ServerObject const * const targetServerObject = (targetObject != nullptr) ? targetObject->asServerObject() : nullptr; + ShipObject const * const targetShipObject = (targetServerObject != nullptr) ? targetServerObject->asShipObject() : nullptr; return targetShipObject; } @@ -1097,7 +1097,7 @@ void AiShipController::setSquad(SpaceSquad * const squad) { // Remove the unit from its previous squad - if ( (m_squad != NULL) + if ( (m_squad != nullptr) && !m_squad->isEmpty()) { m_squad->removeUnit(getOwner()->getNetworkId()); @@ -1170,7 +1170,7 @@ void AiShipController::setAttackSquad(SpaceAttackSquad * const attackSquad) { // Remove the unit from its pervious attack squad - if (m_attackSquad != NULL) + if (m_attackSquad != nullptr) { m_attackSquad->removeUnit(getOwner()->getNetworkId()); } @@ -1210,7 +1210,7 @@ float AiShipController::getShipRadius() const ShipObject const * const shipObject = getShipOwner(); CollisionProperty const * const shipCollision = shipObject->getCollisionProperty(); - if (shipCollision != NULL) + if (shipCollision != nullptr) { result = shipCollision->getBoundingSphere_l().getRadius(); } @@ -1288,9 +1288,9 @@ bool AiShipController::shouldCheckForEnemies() const void AiShipController::setCurrentPathIndex(unsigned int const index) { - //LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipController::setCurrentPathIndex() unit(%s) pathIndex(%u) pathSize(%u)", getOwner()->getNetworkId().getValueString().c_str(), index, (m_path != NULL) ? m_path->getTransformList().size() : 0)); + //LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipController::setCurrentPathIndex() unit(%s) pathIndex(%u) pathSize(%u)", getOwner()->getNetworkId().getValueString().c_str(), index, (m_path != nullptr) ? m_path->getTransformList().size() : 0)); - if ( (m_path != NULL) + if ( (m_path != nullptr) && !m_path->isEmpty()) { m_currentPathIndex = index; @@ -1298,7 +1298,7 @@ void AiShipController::setCurrentPathIndex(unsigned int const index) else { m_currentPathIndex = 0; - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled() && (m_currentPathIndex > 0), "debug_ai", ("AiShipController::setCurrentPathIndex() Setting a non-zero path index(%d) on a NULL or empty path", index)); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled() && (m_currentPathIndex > 0), "debug_ai", ("AiShipController::setCurrentPathIndex() Setting a non-zero path index(%d) on a nullptr or empty path", index)); } } @@ -1317,7 +1317,7 @@ float AiShipController::calculateThrottleToPosition_w(Vector const & position_w, Object const * const object = getOwner(); - if (object != NULL) + if (object != nullptr) { float const distanceToGoalSquared = object->getPosition_w().magnitudeBetweenSquared(position_w); @@ -1420,7 +1420,7 @@ void AiShipController::switchToBomberAttack() bool AiShipController::removeAttackTarget(NetworkId const & unit) { LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipController::removeAttackTarget() owner(%s) unit(%s)", getOwner()->getNetworkId().getValueString().c_str(), unit.getValueString().c_str())); - DEBUG_WARNING((unit == NetworkId::cms_invalid), ("debug_ai: owner(%s) ERROR: Trying to remove a NULL unit(%s) from the attack target list.", getOwner()->getNetworkId().getValueString().c_str(), unit.getValueString().c_str())); + DEBUG_WARNING((unit == NetworkId::cms_invalid), ("debug_ai: owner(%s) ERROR: Trying to remove a nullptr unit(%s) from the attack target list.", getOwner()->getNetworkId().getValueString().c_str(), unit.getValueString().c_str())); return ShipController::removeAttackTarget(unit); } @@ -1637,7 +1637,7 @@ void AiShipController::sendDebugAiToClients(AiDebugString & aiDebugString) bool const checkForEnemies = shouldCheckForEnemies(); float const leashRadius = m_attackBehavior->getLeashRadius(); - aiDebugString.addText(formattedString.sprintf("%s agg(%.0f) lsh(%.0f) %s\n", AiShipController::getAttackOrdersString(getAttackOrders()), m_aggroRadius, leashRadius, (m_attackBehavior == NULL) ? " [NO ATTACK BEHAVIOR]" : (checkForEnemies ? " [LFE]" : ""))); + aiDebugString.addText(formattedString.sprintf("%s agg(%.0f) lsh(%.0f) %s\n", AiShipController::getAttackOrdersString(getAttackOrders()), m_aggroRadius, leashRadius, (m_attackBehavior == nullptr) ? " [NO ATTACK BEHAVIOR]" : (checkForEnemies ? " [LFE]" : ""))); } } @@ -1687,7 +1687,7 @@ void AiShipController::sendDebugAiToClients(AiDebugString & aiDebugString) // Only send to the client if the objvar is set int temp = 0; - if ( (characterObject != NULL) + if ( (characterObject != nullptr) && characterObject->getObjVars().getItem("ai_debug_string", temp)) { if (temp > 0) @@ -1768,8 +1768,8 @@ void AiShipController::addExclusiveAggro(NetworkId const & unit) // Make sure this is a player Object * const unitObject = NetworkIdManager::getObjectById(unit); - ServerObject * const unitServerObject = (unitObject != NULL) ? unitObject->asServerObject() : NULL; - CreatureObject * const unitCreatureObject = (unitServerObject != NULL) ? unitServerObject->asCreatureObject() : NULL; + ServerObject * const unitServerObject = (unitObject != nullptr) ? unitObject->asServerObject() : nullptr; + CreatureObject * const unitCreatureObject = (unitServerObject != nullptr) ? unitServerObject->asCreatureObject() : nullptr; if ( !unitCreatureObject || !unitCreatureObject->isPlayerControlled()) @@ -1829,11 +1829,11 @@ bool AiShipController::isExclusiveAggro(CreatureObject const & pilot) const CreatureObject const * const aggroCreatureObject = CreatureObject::asCreatureObject(aggroCachedNetworkId.getObject()); - if (aggroCreatureObject != NULL) + if (aggroCreatureObject != nullptr) { GroupObject * const groupObject = aggroCreatureObject->getGroup(); - if (groupObject != NULL) + if (groupObject != nullptr) { GroupObject::GroupMemberVector const & groupMembers = groupObject->getGroupMembers(); GroupObject::GroupMemberVector::const_iterator iterGroupMembers = groupMembers.begin(); @@ -1871,7 +1871,7 @@ bool AiShipController::isValidTarget(ShipObject const & unit) const CreatureObject const * const pilotCreatureObject = unit.getPilot(); - if (pilotCreatureObject != NULL) + if (pilotCreatureObject != nullptr) { if (pilotCreatureObject->isPlayerControlled()) { diff --git a/engine/server/library/serverGame/src/shared/controller/AiShipControllerInterface.cpp b/engine/server/library/serverGame/src/shared/controller/AiShipControllerInterface.cpp index 3e4549aa..21fef53d 100755 --- a/engine/server/library/serverGame/src/shared/controller/AiShipControllerInterface.cpp +++ b/engine/server/library/serverGame/src/shared/controller/AiShipControllerInterface.cpp @@ -25,7 +25,7 @@ bool AiShipControllerInterface::addDamageTaken(NetworkId const & unit, NetworkId bool result = false; AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != NULL) + if (aiShipController != nullptr) { bool const verifyAttacker = false; @@ -45,7 +45,7 @@ bool AiShipControllerInterface::setAttackOrders(NetworkId const & unit, AiShipCo bool result = false; AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != NULL) + if (aiShipController != nullptr) { result = true; aiShipController->setAttackOrders(attackOrders); @@ -64,7 +64,7 @@ bool AiShipControllerInterface::idle(NetworkId const & unit) bool result = false; AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != NULL) + if (aiShipController != nullptr) { result = true; aiShipController->idle(); @@ -83,7 +83,7 @@ bool AiShipControllerInterface::track(NetworkId const & unit, Object const & tar bool result = false; AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != NULL) + if (aiShipController != nullptr) { result = true; aiShipController->track(target); @@ -102,7 +102,7 @@ bool AiShipControllerInterface::setLeashRadius(NetworkId const & unit, float con bool result = false; AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != NULL) + if (aiShipController != nullptr) { result = true; aiShipController->setLeashRadius(radius); @@ -121,7 +121,7 @@ bool AiShipControllerInterface::follow(NetworkId const & unit, NetworkId const & bool result = false; AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != NULL) + if (aiShipController != nullptr) { result = true; aiShipController->follow(followedUnit, direction_o, direction); @@ -140,7 +140,7 @@ bool AiShipControllerInterface::addPatrolPath(NetworkId const & unit, SpacePath bool result = false; AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != NULL) + if (aiShipController != nullptr) { result = true; aiShipController->addPatrolPath(path); @@ -159,7 +159,7 @@ bool AiShipControllerInterface::clearPatrolPath(NetworkId const & unit) bool result = false; AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != NULL) + if (aiShipController != nullptr) { result = true; aiShipController->clearPatrolPath(); @@ -178,7 +178,7 @@ bool AiShipControllerInterface::moveTo(NetworkId const & unit, SpacePath * const bool result = false; AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != NULL) + if (aiShipController != nullptr) { result = true; aiShipController->moveTo(path); diff --git a/engine/server/library/serverGame/src/shared/controller/CreatureController.cpp b/engine/server/library/serverGame/src/shared/controller/CreatureController.cpp index 067da019..f25d0fb1 100755 --- a/engine/server/library/serverGame/src/shared/controller/CreatureController.cpp +++ b/engine/server/library/serverGame/src/shared/controller/CreatureController.cpp @@ -122,7 +122,7 @@ CreatureController::~CreatureController() void CreatureController::handleMessage (const int message, const float value, const MessageQueue::Data* const data, const uint32 flags) { CreatureObject * const owner = static_cast(getOwner()); - DEBUG_FATAL(!owner, ("Owner is NULL in CreatureController::handleMessage\n")); + DEBUG_FATAL(!owner, ("Owner is nullptr in CreatureController::handleMessage\n")); switch(message) { @@ -629,7 +629,7 @@ void CreatureController::handleMessage (const int message, const float value, co case CM_setIncapacitated: { const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); - if (msg != NULL) + if (msg != nullptr) owner->setIncapacitated(msg->getValue().first, msg->getValue().second); } break; @@ -853,7 +853,7 @@ void CreatureController::handleMessage (const int message, const float value, co if (owner && msg) owner->setAlternateAppearance(msg->getValue()); else - WARNING(true, ("CreatureController: received CM_setAppearanceFromObjectTemplate but owner or message was NULL.")); + WARNING(true, ("CreatureController: received CM_setAppearanceFromObjectTemplate but owner or message was nullptr.")); } break; @@ -873,9 +873,9 @@ void CreatureController::handleMessage (const int message, const float value, co if (msg) { ServerObject * defender = safe_cast(NetworkIdManager::getObjectById(msg->getDefender())); - if (defender != NULL) + if (defender != nullptr) { - if (defender->asCreatureObject() != NULL) + if (defender->asCreatureObject() != nullptr) { defender->asCreatureObject()->pushedMe(msg->getAttacker(), msg->getAttackerPos(), msg->getDefenderPos(), msg->getDistance()); } @@ -894,7 +894,7 @@ void CreatureController::handleMessage (const int message, const float value, co if (msg) { ServerObject * target = safe_cast(NetworkIdManager::getObjectById(msg->getTarget())); - if (target != NULL && target->asTangibleObject() != NULL) + if (target != nullptr && target->asTangibleObject() != nullptr) { if (owner->isAuthoritative()) owner->addSlowDownEffect(*(target->asTangibleObject()), msg->getConeLength(), msg->getConeAngle(), msg->getSlopeAngle(), msg->getExpireTime()); @@ -964,7 +964,7 @@ void CreatureController::handleMessage (const int message, const float value, co { MessageQueueCyberneticsChangeRequest const * const msg = safe_cast(data); NOT_NULL(msg); - if (msg != NULL) + if (msg != nullptr) { NetworkId const & playerId = msg->getTarget(); GameScriptObject * const scriptObject = owner->getScriptObject(); @@ -984,10 +984,10 @@ void CreatureController::handleMessage (const int message, const float value, co case CM_setCurrentQuest: { MessageQueueGenericValueType const * const msg = safe_cast const *>(data); - if (msg != NULL) + if (msg != nullptr) { PlayerObject * player = PlayerCreatureController::getPlayerObject(owner); - if (player != NULL) + if (player != nullptr) { player->setCurrentQuest(msg->getValue()); } @@ -1003,7 +1003,7 @@ void CreatureController::handleMessage (const int message, const float value, co case CM_setRegenRate: { MessageQueueGenericValueType > const * const msg = safe_cast > const *>(data); - if (msg != NULL) + if (msg != nullptr) { owner->setRegenRate(static_cast(msg->getValue().first), msg->getValue().second); } @@ -1516,7 +1516,7 @@ void CreatureController::conclude() // combatants must be adjusted to reflect the server's idea of the post-alter end posture. // This information was not known at the time the message was constructed. MessageQueueCombatAction * combatMessage = safe_cast(data); - if (combatMessage != NULL) + if (combatMessage != nullptr) { //-- Fix up end postures in messages. @@ -1527,7 +1527,7 @@ void CreatureController::conclude() combatMessage->getAttacker()); const CreatureObject * attacker = dynamic_cast( NetworkIdManager::getObjectById(attackerData.id)); - attackerData.endPosture = (attacker != NULL) ? attacker->getPosture() : static_cast(0); + attackerData.endPosture = (attacker != nullptr) ? attacker->getPosture() : static_cast(0); // set the defenders' posture const MessageQueueCombatAction::DefenderDataVector & defenderData = @@ -1539,7 +1539,7 @@ void CreatureController::conclude() const_cast(*iter); const CreatureObject * defender = dynamic_cast( NetworkIdManager::getObjectById(defenderData.id)); - defenderData.endPosture = (defender != NULL) ? defender->getPosture() : static_cast(0); + defenderData.endPosture = (defender != nullptr) ? defender->getPosture() : static_cast(0); } } } @@ -1667,7 +1667,7 @@ void CreatureController::handleSecureTradeMessage(const MessageQueueSecureTrade )); } } - else if (recipient->getClient() == NULL) + else if (recipient->getClient() == nullptr) { // GameServer::getInstance().sendToPlanetServer( // GenericValueTypeMessage >( @@ -1862,7 +1862,7 @@ void CreatureController::setAppearanceFromObjectTemplate(std::string const &serv CreatureObject * owner = dynamic_cast(getOwner()); if (!owner) { - WARNING(true, ("setAppearanceFromObjectTemplate(): owner is NULL or not a CreatureObject.")); + WARNING(true, ("setAppearanceFromObjectTemplate(): owner is nullptr or not a CreatureObject.")); return; } @@ -2007,7 +2007,7 @@ void CreatureController::calculateWaterState(bool& isSwimming, bool &isBurning, if (ownerCreature->getState(States::RidingMount)) { CreatureObject const *const mountCreature = ownerCreature->getMountedCreature(); - CreatureController const *const mountCreatureController = mountCreature ? safe_cast(mountCreature->getController()) : NULL; + CreatureController const *const mountCreatureController = mountCreature ? safe_cast(mountCreature->getController()) : nullptr; if (mountCreatureController) { // Note: we do the real computation for the mount here because the rider gets @@ -2135,28 +2135,28 @@ CreatureController const * CreatureController::asCreatureController() const PlayerCreatureController * CreatureController::asPlayerCreatureController() { - return NULL; + return nullptr; } //---------------------------------------------------------------------- PlayerCreatureController const * CreatureController::asPlayerCreatureController() const { - return NULL; + return nullptr; } //---------------------------------------------------------------------- AICreatureController * CreatureController::asAiCreatureController() { - return NULL; + return nullptr; } //---------------------------------------------------------------------- AICreatureController const * CreatureController::asAiCreatureController() const { - return NULL; + return nullptr; } //----------------------------------------------------------------------- @@ -2170,23 +2170,23 @@ CreatureController * CreatureController::getCreatureController(NetworkId const & CreatureController * CreatureController::getCreatureController(Object * object) { - Controller * controller = (object != NULL) ? object->getController() : NULL; + Controller * controller = (object != nullptr) ? object->getController() : nullptr; - return (controller != NULL) ? controller->asCreatureController() : NULL; + return (controller != nullptr) ? controller->asCreatureController() : nullptr; } // ---------------------------------------------------------------------- CreatureController * CreatureController::asCreatureController(Controller * controller) { - return (controller != NULL) ? controller->asCreatureController() : NULL; + return (controller != nullptr) ? controller->asCreatureController() : nullptr; } // ---------------------------------------------------------------------- CreatureController const * CreatureController::asCreatureController(Controller const * controller) { - return (controller != NULL) ? controller->asCreatureController() : NULL; + return (controller != nullptr) ? controller->asCreatureController() : nullptr; } // ====================================================================== diff --git a/engine/server/library/serverGame/src/shared/controller/PlanetController.cpp b/engine/server/library/serverGame/src/shared/controller/PlanetController.cpp index 97a826ba..465bb3d5 100755 --- a/engine/server/library/serverGame/src/shared/controller/PlanetController.cpp +++ b/engine/server/library/serverGame/src/shared/controller/PlanetController.cpp @@ -61,7 +61,7 @@ void PlanetController::handleMessage (const int message, const float value, cons case CM_setWeather: { const MessageQueueGenericValueType >* const message = safe_cast >*> (data); - if (message != NULL) + if (message != nullptr) { owner->setWeather( message->getValue().first, @@ -280,7 +280,7 @@ void PlanetController::handleMessage (const int message, const float value, cons const std::map & data = message->getValue(); for (std::map::const_iterator iter = data.begin(); iter != data.end(); ++iter) - owner->adjustGcwImperialScore("CM_adjustGcwImperialScore", NULL, iter->first, iter->second); + owner->adjustGcwImperialScore("CM_adjustGcwImperialScore", nullptr, iter->first, iter->second); } } break; @@ -293,7 +293,7 @@ void PlanetController::handleMessage (const int message, const float value, cons const std::map & data = message->getValue(); for (std::map::const_iterator iter = data.begin(); iter != data.end(); ++iter) - owner->adjustGcwRebelScore("CM_adjustGcwRebelScore", NULL, iter->first, iter->second); + owner->adjustGcwRebelScore("CM_adjustGcwRebelScore", nullptr, iter->first, iter->second); } } break; diff --git a/engine/server/library/serverGame/src/shared/controller/PlayerCreatureController.cpp b/engine/server/library/serverGame/src/shared/controller/PlayerCreatureController.cpp index df4260bc..1097566c 100755 --- a/engine/server/library/serverGame/src/shared/controller/PlayerCreatureController.cpp +++ b/engine/server/library/serverGame/src/shared/controller/PlayerCreatureController.cpp @@ -164,7 +164,7 @@ namespace PlayerCreatureControllerNamespace if(!mount) { - LOG("mounts-bug", ("PlayerCreatureControllerNamespace::isCreaturePassenger(): server id=[%d],object id=[%s] creature has state RidingMount but getMountedCreature() returns NULL.", static_cast(GameServer::getInstance().getProcessId()), creature.getNetworkId().getValueString().c_str())); + LOG("mounts-bug", ("PlayerCreatureControllerNamespace::isCreaturePassenger(): server id=[%d],object id=[%s] creature has state RidingMount but getMountedCreature() returns nullptr.", static_cast(GameServer::getInstance().getProcessId()), creature.getNetworkId().getValueString().c_str())); return false; } @@ -172,7 +172,7 @@ namespace PlayerCreatureControllerNamespace if(!primaryRider) { - LOG("mounts-bug", ("PlayerCreatureControllerNamespace::isCreaturePassenger(): server id=[%d],object id=[%s] creature has state RidingMount but mount->getPrimaryMountingRider() returns NULL.", static_cast(GameServer::getInstance().getProcessId()), creature.getNetworkId().getValueString().c_str())); + LOG("mounts-bug", ("PlayerCreatureControllerNamespace::isCreaturePassenger(): server id=[%d],object id=[%s] creature has state RidingMount but mount->getPrimaryMountingRider() returns nullptr.", static_cast(GameServer::getInstance().getProcessId()), creature.getNetworkId().getValueString().c_str())); return false; } @@ -411,7 +411,7 @@ void PlayerCreatureController::logMoveFailed(char const *reason) "movement", ( "move fail - object %s stationId %u - %s", - creature ? creature->getNetworkId().getValueString().c_str() : "", + creature ? creature->getNetworkId().getValueString().c_str() : "", stationId, reason)); } @@ -425,7 +425,7 @@ bool PlayerCreatureController::isLocationValid(Vector const &position_w, CellObj return false; TerrainObject const *const terrainObject = TerrainObject::getConstInstance(); - if (NULL != terrainObject && (NULL == cell || cell->getCellProperty()->isWorldCell())) + if (nullptr != terrainObject && (nullptr == cell || cell->getCellProperty()->isWorldCell())) { if (!terrainObject->isPassableForceChunkCreation(position_w)) return false; @@ -445,7 +445,7 @@ bool PlayerCreatureController::isLocationValid(Vector const &position_w, CellObj Sphere testSphere(position_w + localSphere.getCenter(), localSphere.getRadius()); - if (CollisionWorld::query(testSphere, NULL)) + if (CollisionWorld::query(testSphere, nullptr)) return false; } return true; @@ -464,7 +464,7 @@ bool PlayerCreatureController::checkValidMove(MoveSnapshot const &m, float const CreatureObject * const creature = NON_NULL(getCreature()); // update the velocity in the serverController - if (creature != NULL) + if (creature != nullptr) { Vector moveDistance = m.getPosition_w() - creature->getPosition_w(); moveDistance.y = 0.0f; @@ -495,8 +495,8 @@ bool PlayerCreatureController::checkValidMove(MoveSnapshot const &m, float const if (!m.isValid()) return handleInvalidMove("invalid destination"); - if (creature == NULL) - return handleInvalidMove("creature is null"); + if (creature == nullptr) + return handleInvalidMove("creature is nullptr"); if (!m.isAllowed(*creature)) return handleInvalidMove("not allowed in dest cell"); @@ -513,7 +513,7 @@ bool PlayerCreatureController::checkValidMove(MoveSnapshot const &m, float const PortalProperty const *destPortalProperty = destCell ? ContainerInterface::getContainedByObject(*destCell)->getPortalProperty() : 0; if (sourcePortalProperty != destPortalProperty) { - // Moving between pobs. This is only valid if one of these is null, since pobs only connect to the world + // Moving between pobs. This is only valid if one of these is nullptr, since pobs only connect to the world if (sourcePortalProperty && destPortalProperty) return handleInvalidMove("tried to move from one pob to another without passing through the world cell"); if (sourcePortalProperty && !sourcePortalProperty->hasPassablePortalToParentCell()) @@ -548,7 +548,7 @@ bool PlayerCreatureController::checkValidMove(MoveSnapshot const &m, float const Client * const client = creature->getClient(); if (!client) - return handleInvalidMove("Creature's client is NULL"); + return handleInvalidMove("Creature's client is nullptr"); uint32 const currentServerSyncStamp = client->getServerSyncStampLong(); @@ -741,7 +741,7 @@ bool PlayerCreatureController::checkValidMove(MoveSnapshot const &m, float const } - m_lastSpeedCheckFailureTime = ::time(NULL); + m_lastSpeedCheckFailureTime = ::time(nullptr); ++m_speedCheckConsecutiveFailureCount; // if this is the first validation failure "in a while", let it pass, because it may be a false positive @@ -1153,11 +1153,11 @@ void PlayerCreatureController::handleMessage (const int message, const float val NetworkId const & designerId = inMsg->getDesignerId(); NetworkId const & recipientId = inMsg->getRecipientId(); Object const * const designerObj = NetworkIdManager::getObjectById(designerId); - ServerObject const * const designerServer = designerObj ? designerObj->asServerObject() : NULL; - CreatureObject const * const designer = designerServer ? designerServer->asCreatureObject() : NULL; + ServerObject const * const designerServer = designerObj ? designerObj->asServerObject() : nullptr; + CreatureObject const * const designer = designerServer ? designerServer->asCreatureObject() : nullptr; Object * const recipientObj = NetworkIdManager::getObjectById(recipientId); - ServerObject * const recipientServer = recipientObj ? recipientObj->asServerObject() : NULL; - CreatureObject * const recipient = recipientServer ? recipientServer->asCreatureObject() : NULL; + ServerObject * const recipientServer = recipientObj ? recipientObj->asServerObject() : nullptr; + CreatureObject * const recipient = recipientServer ? recipientServer->asCreatureObject() : nullptr; if(designer && recipient) { //designer-sent message, either data to sync to the recipient, or committed data to check and apply @@ -1167,7 +1167,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val { //designer hasn't accepted yet, send change to the client so they can see it before agreeing Object * const recipientObject = NetworkIdManager::getObjectById(inMsg->getRecipientId()); - Controller * const recipientController = recipientObject ? recipientObject->getController() : NULL; + Controller * const recipientController = recipientObject ? recipientObject->getController() : nullptr; if(recipientController) { ImageDesignChangeMessage * outMsg = new ImageDesignChangeMessage(); @@ -1182,7 +1182,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val { //check and apply this data once the recipient also accepts Object * const recipientObject = NetworkIdManager::getObjectById(inMsg->getRecipientId()); - Controller * const recipientController = recipientObject ? recipientObject->getController() : NULL; + Controller * const recipientController = recipientObject ? recipientObject->getController() : nullptr; if(recipientController) { ImageDesignChangeMessage * outMsg = new ImageDesignChangeMessage(); @@ -1201,7 +1201,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val //recipient hasn't accepted yet, send the data to the designer to update the recipient-sent amount of money //designer hasn't accepted yet, send change to the client so they can see it before agreeing Object * const designerObject = NetworkIdManager::getObjectById(inMsg->getDesignerId()); - Controller * const designerController = designerObject ? designerObject->getController() : NULL; + Controller * const designerController = designerObject ? designerObject->getController() : nullptr; if(designerController) { ImageDesignChangeMessage * outMsg = new ImageDesignChangeMessage(); @@ -1232,8 +1232,8 @@ void PlayerCreatureController::handleMessage (const int message, const float val std::string const recipientSpeciesGender = CustomizationManager::getServerSpeciesGender(*recipient); CustomizationData * const customizationData = recipient->fetchCustomizationData(); ServerObject * const hair = recipient->getHair(); - TangibleObject * const tangibleHair = hair ? hair->asTangibleObject() : NULL; - CustomizationData * customizationDataHair = NULL; + TangibleObject * const tangibleHair = hair ? hair->asTangibleObject() : nullptr; + CustomizationData * customizationDataHair = nullptr; if(tangibleHair) customizationDataHair = tangibleHair->fetchCustomizationData(); if(customizationData) @@ -1285,7 +1285,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val { //if the recipient canceled the session, tell the designer Object const * const designerObject = NetworkIdManager::getObjectById(session.designerId); - ServerObject const * const designer = designerObject ? designerObject->asServerObject() : NULL; + ServerObject const * const designer = designerObject ? designerObject->asServerObject() : nullptr; if(designer && (owner->getNetworkId() != session.designerId)) Chat::sendSystemMessage(*designer, SharedStringIds::imagedesigner_canceled_by_recip, Unicode::emptyString); @@ -1304,11 +1304,11 @@ void PlayerCreatureController::handleMessage (const int message, const float val NetworkId const & bufferId = inMsg->getBufferId(); NetworkId const & recipientId = inMsg->getRecipientId(); Object const * const bufferObj = NetworkIdManager::getObjectById(bufferId); - ServerObject const * const bufferServer = bufferObj ? bufferObj->asServerObject() : NULL; - CreatureObject const * const buffer = bufferServer ? bufferServer->asCreatureObject() : NULL; + ServerObject const * const bufferServer = bufferObj ? bufferObj->asServerObject() : nullptr; + CreatureObject const * const buffer = bufferServer ? bufferServer->asCreatureObject() : nullptr; Object * const recipientObj = NetworkIdManager::getObjectById(recipientId); - ServerObject * const recipientServer = recipientObj ? recipientObj->asServerObject() : NULL; - CreatureObject * const recipient = recipientServer ? recipientServer->asCreatureObject() : NULL; + ServerObject * const recipientServer = recipientObj ? recipientObj->asServerObject() : nullptr; + CreatureObject * const recipient = recipientServer ? recipientServer->asCreatureObject() : nullptr; if(buffer && recipient) { //buffer-sent message, either data to sync to the recipient, or committed data to check and apply @@ -1318,7 +1318,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val { //buffer hasn't accepted yet, send change to the client so they can see it before agreeing Object * const recipientObject = NetworkIdManager::getObjectById(inMsg->getRecipientId()); - Controller * const recipientController = recipientObject ? recipientObject->getController() : NULL; + Controller * const recipientController = recipientObject ? recipientObject->getController() : nullptr; if(recipientController) { BuffBuilderChangeMessage * outMsg = new BuffBuilderChangeMessage(); @@ -1333,7 +1333,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val { //check and apply this data once the recipient also accepts Object * const recipientObject = NetworkIdManager::getObjectById(inMsg->getRecipientId()); - Controller * const recipientController = recipientObject ? recipientObject->getController() : NULL; + Controller * const recipientController = recipientObject ? recipientObject->getController() : nullptr; if(recipientController) { BuffBuilderChangeMessage * outMsg = new BuffBuilderChangeMessage(); @@ -1351,7 +1351,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val //recipient hasn't accepted yet, send the data to the buffer to update the recipient-sent amount of money //buffer hasn't accepted yet, send change to the client so they can see it before agreeing Object * const bufferObject = NetworkIdManager::getObjectById(inMsg->getBufferId()); - Controller * const bufferController = bufferObject ? bufferObject->getController() : NULL; + Controller * const bufferController = bufferObject ? bufferObject->getController() : nullptr; if(bufferController) { BuffBuilderChangeMessage * outMsg = new BuffBuilderChangeMessage(); @@ -1425,7 +1425,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val { //if the recipient canceled the session, tell the designer Object const * const bufferObject = NetworkIdManager::getObjectById(session.bufferId); - ServerObject const * const buffer = bufferObject ? bufferObject->asServerObject() : NULL; + ServerObject const * const buffer = bufferObject ? bufferObject->asServerObject() : nullptr; if(buffer && (owner->getNetworkId() != session.bufferId)) { @@ -1447,7 +1447,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val if(msg) { Object const * const terminalO = NetworkIdManager::getObjectById(msg->getValue()); - ServerObject const * const terminal = terminalO ? terminalO->asServerObject() : NULL; + ServerObject const * const terminal = terminalO ? terminalO->asServerObject() : nullptr; if(terminal) { Client const * const client = owner->getClient(); @@ -1461,7 +1461,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val if(!client->isGod()) { Object const * const buildingO = ContainerInterface::getTopmostContainer(*terminal); - ServerObject const * const building = buildingO ? buildingO->asServerObject() : NULL; + ServerObject const * const building = buildingO ? buildingO->asServerObject() : nullptr; if(building) { DynamicVariableList const & buildingObjVars = building->getObjVars(); @@ -1478,13 +1478,13 @@ void PlayerCreatureController::handleMessage (const int message, const float val for(std::vector::const_iterator i = ships.begin(); i != ships.end(); ++i) { Object const * const shipO = NetworkIdManager::getObjectById(*i); - ServerObject const * const shipSO = shipO ? shipO->asServerObject() : NULL; - ShipObject const * const ship = shipSO ? shipSO->asShipObject() : NULL; + ServerObject const * const shipSO = shipO ? shipO->asServerObject() : nullptr; + ShipObject const * const ship = shipSO ? shipSO->asShipObject() : nullptr; if(ship) { ContainedByProperty const * const contained = ship->getContainedByProperty(); - Object const * const containerO = contained ? contained->getContainedBy() : NULL; - ServerObject const * const container = containerO ? containerO->asServerObject() : NULL; + Object const * const containerO = contained ? contained->getContainedBy() : nullptr; + ServerObject const * const container = containerO ? containerO->asServerObject() : nullptr; if(container) { DynamicVariableList const & shipControlDeviceObjVars = container->getObjVars(); @@ -1665,14 +1665,14 @@ void PlayerCreatureController::handleMessage (const int message, const float val { MessageQueueCyberneticsChangeRequest const * const msg = dynamic_cast(data); NOT_NULL(msg); - if (msg != NULL) + if (msg != nullptr) { CreatureObject * const owner = NON_NULL(getCreature()); if(owner) { NetworkId const & npcId = msg->getTarget(); Object * const o = NetworkIdManager::getObjectById(npcId); - ServerObject * const so = o ? o->asServerObject() : NULL; + ServerObject * const so = o ? o->asServerObject() : nullptr; if(so) { Controller * const npcController = so->getController(); @@ -1696,10 +1696,10 @@ void PlayerCreatureController::handleMessage (const int message, const float val case CM_spaceMiningSaleSellResource: { MessageQueueSpaceMiningSellResource const * const msg = dynamic_cast(data); - if (msg != NULL) + if (msg != nullptr) { ServerObject * const spaceStation = safe_cast(NetworkIdManager::getObjectById(msg->m_spaceStationId)); - if (NULL == spaceStation) + if (nullptr == spaceStation) { WARNING(true, ("PlayerCreatureController CM_spaceMiningSaleSellResource invalid station [%s]", msg->m_spaceStationId.getValueString().c_str())); } @@ -1784,7 +1784,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val DictionaryValueMap::const_iterator itr = valueMap.find(minigameResultTargetName); - if(itr != valueMap.end() && itr->second != NULL) + if(itr != valueMap.end() && itr->second != nullptr) { if(itr->second->getType() == ValueTypeObjId::ms_type) { @@ -1798,7 +1798,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(tableOid, @@ -1859,7 +1859,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val params.addParam(paramsDict, "taskDictionary"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(owner->getNetworkId(), diff --git a/engine/server/library/serverGame/src/shared/controller/PlayerShipController.cpp b/engine/server/library/serverGame/src/shared/controller/PlayerShipController.cpp index 6350d91b..921e3980 100755 --- a/engine/server/library/serverGame/src/shared/controller/PlayerShipController.cpp +++ b/engine/server/library/serverGame/src/shared/controller/PlayerShipController.cpp @@ -295,10 +295,10 @@ void PlayerShipController::handleMessage(int const message, float const value, M case CM_spaceMiningSaleSellResource: { MessageQueueSpaceMiningSellResource const * const msg = dynamic_cast(data); - if (msg != NULL) + if (msg != nullptr) { ServerObject * const spaceStation = safe_cast(NetworkIdManager::getObjectById(msg->m_spaceStationId)); - if (NULL == spaceStation) + if (nullptr == spaceStation) { WARNING(true, ("PlayerCreatureController CM_spaceMiningSaleSellResource invalid station [%s]", msg->m_spaceStationId.getValueString().c_str())); } @@ -376,16 +376,16 @@ float PlayerShipController::realAlter(float const elapsedTime) if (owner && owner->isInitialized()) { - if (m_pendingDockingBehavior != NULL) + if (m_pendingDockingBehavior != nullptr) { delete m_dockingBehavior; m_dockingBehavior = m_pendingDockingBehavior; - m_pendingDockingBehavior = NULL; + m_pendingDockingBehavior = nullptr; getShipOwner()->setCondition(static_cast(TangibleObject::C_docking)); Client * const client = owner->getClient(); - if (client != NULL) + if (client != nullptr) { ShipClientUpdateTracker::queueForUpdate(*client, *owner); } @@ -395,16 +395,16 @@ float PlayerShipController::realAlter(float const elapsedTime) } } - if ( (m_dockingBehavior != NULL) + if ( (m_dockingBehavior != nullptr) && m_dockingBehavior->isDockFinished()) { delete m_dockingBehavior; - m_dockingBehavior = NULL; + m_dockingBehavior = nullptr; getShipOwner()->clearCondition(static_cast(TangibleObject::C_docking)); } - if (m_dockingBehavior != NULL) + if (m_dockingBehavior != nullptr) { //-- The docking behavior will calculate new values for m_yaw/m_pitch/m_roll/m_throttle[Position] implicitly through calling ShipController members m_dockingBehavior->alter(elapsedTime); @@ -806,7 +806,7 @@ void PlayerShipController::setWeaponIndexPlayerControlled(int const weaponIndex, { DEBUG_FATAL((weaponIndex < 0), ("Invalid weaponIndex(%d)", weaponIndex)); - if (m_turretTargetingSystem != NULL) + if (m_turretTargetingSystem != nullptr) { safe_cast(m_turretTargetingSystem)->setWeaponIndexPlayerControlled(weaponIndex, playerControlled); } diff --git a/engine/server/library/serverGame/src/shared/controller/ServerController.cpp b/engine/server/library/serverGame/src/shared/controller/ServerController.cpp index bd5ffc3f..535341e6 100755 --- a/engine/server/library/serverGame/src/shared/controller/ServerController.cpp +++ b/engine/server/library/serverGame/src/shared/controller/ServerController.cpp @@ -55,7 +55,7 @@ CellProperty const * getCell(Object const * obj) { - if(obj == NULL) return NULL; + if(obj == nullptr) return nullptr; return obj->getCellProperty(); } @@ -74,7 +74,7 @@ Vector movePointBetweenCells ( Object const * oldCellObject, Object const * new Transform toWorld = Transform::identity; Transform toCell = Transform::identity; - if(oldCellObject != NULL) + if(oldCellObject != nullptr) { CellProperty const * oldCell = getCell(oldCellObject); @@ -84,7 +84,7 @@ Vector movePointBetweenCells ( Object const * oldCellObject, Object const * new } } - if(newCellObject != NULL) + if(newCellObject != nullptr) { CellProperty const * newCell = getCell(newCellObject); @@ -115,7 +115,7 @@ Transform moveTransformBetweenCells ( Object const * oldCellObject, Object const Transform toWorld = Transform::identity; Transform toCell = Transform::identity; - if(oldCellObject != NULL) + if(oldCellObject != nullptr) { CellProperty const * oldCell = getCell(oldCellObject); @@ -125,7 +125,7 @@ Transform moveTransformBetweenCells ( Object const * oldCellObject, Object const } } - if(newCellObject != NULL) + if(newCellObject != nullptr) { CellProperty const * newCell = getCell(newCellObject); @@ -220,7 +220,7 @@ void ServerController::setAuthoritative(bool newAuthoritative) { if (!newAuthoritative && m_bHasGoal && m_goalCellObject) { - m_goalCellObject = NULL; + m_goalCellObject = nullptr; m_bHasGoal = false; m_bAtGoal = true; } @@ -420,7 +420,7 @@ bool changeCells(ServerObject &object, ServerObject *newCellObject) // ---------- - if (newCellObject == NULL) + if (newCellObject == nullptr) { // Object was in a cell and is moving to the world, transfer from cell container to world @@ -428,7 +428,7 @@ bool changeCells(ServerObject &object, ServerObject *newCellObject) Transform const &newTransform = oldCellObject->getTransform_o2w().rotateTranslate_l2p(objectTransform); Container::ContainerErrorCode tmp = Container::CEC_Success; - result = ContainerInterface::transferItemToWorld(object, newTransform, NULL, tmp); + result = ContainerInterface::transferItemToWorld(object, newTransform, nullptr, tmp); if (!result) { @@ -444,13 +444,13 @@ bool changeCells(ServerObject &object, ServerObject *newCellObject) CellProperty * const pCell = ContainerInterface::getCell(*newCellObject); - DEBUG_REPORT_LOG(pCell == NULL, ("changeCells - Received transform with parent to a non-cell object. This should only happen from the DB\n")); + DEBUG_REPORT_LOG(pCell == nullptr, ("changeCells - Received transform with parent to a non-cell object. This should only happen from the DB\n")); if (pCell) { Transform objectTransform = object.getTransform_o2p(); Container::ContainerErrorCode tmp = Container::CEC_Success; - result = ContainerInterface::transferItemToCell(*newCellObject, object, NULL, tmp); + result = ContainerInterface::transferItemToCell(*newCellObject, object, nullptr, tmp); if (!result) { @@ -537,7 +537,7 @@ void ServerController::handleNetUpdateTransform(const MessageQueueDataTransform& return; } - setGoal( message.getTransform(), NULL ); + setGoal( message.getTransform(), nullptr ); } //----------------------------------------------------------------------- @@ -566,7 +566,7 @@ void ServerController::handleNetUpdateTransformWithParent(const MessageQueueData #if 1 Transform start = Transform::identity; start.setPosition_p(ConfigServerGame::getStartingPosition()); - setGoal( start, NULL ); + setGoal( start, nullptr ); #endif return; } diff --git a/engine/server/library/serverGame/src/shared/controller/ShipController.cpp b/engine/server/library/serverGame/src/shared/controller/ShipController.cpp index 3367476d..312131a9 100755 --- a/engine/server/library/serverGame/src/shared/controller/ShipController.cpp +++ b/engine/server/library/serverGame/src/shared/controller/ShipController.cpp @@ -58,12 +58,12 @@ ShipController::ShipController(ShipObject * newOwner) : m_pitchPosition(0.0f), m_rollPosition(0.0f), m_throttlePosition(0.0f), - m_pendingDockingBehavior(NULL), - m_dockingBehavior(NULL), + m_pendingDockingBehavior(nullptr), + m_dockingBehavior(nullptr), m_attackTargetList(new AiShipAttackTargetList(newOwner)), m_attackTargetDecayTimer(new Timer(static_cast(s_maxTargetAge))), m_enemyCheckQueued(false), - m_turretTargetingSystem(NULL), + m_turretTargetingSystem(nullptr), m_dockedByList(new DockedByList), m_aiTargetingMeList(new CachedNetworkIdList) { @@ -77,7 +77,7 @@ ShipController::~ShipController() // The turret targeting system must be deleted before clearAiTargetingMeList(), because // otherwise it will try to acquire new targets as the list is being cleared delete m_turretTargetingSystem; - m_turretTargetingSystem = NULL; + m_turretTargetingSystem = nullptr; clearAiTargetingMeList(); @@ -85,9 +85,9 @@ ShipController::~ShipController() delete m_dockedByList; delete m_aiTargetingMeList; delete m_pendingDockingBehavior; - m_pendingDockingBehavior = NULL; + m_pendingDockingBehavior = nullptr; delete m_dockingBehavior; - m_dockingBehavior = NULL; + m_dockingBehavior = nullptr; delete m_attackTargetList; delete m_attackTargetDecayTimer; } @@ -226,7 +226,7 @@ void ShipController::handleMessage (const int message, const float value, const UNREF(flags); UNREF(value); ShipObject * const owner = getShipOwner(); - DEBUG_FATAL(!owner, ("Owner is NULL in ShipController::handleMessage\n")); + DEBUG_FATAL(!owner, ("Owner is nullptr in ShipController::handleMessage\n")); switch(message) { case CM_clientLookAtTarget: @@ -265,7 +265,7 @@ void ShipController::addTurretTargetingSystem(ShipTurretTargetingSystem * newSys void ShipController::removeTurretTargetingSystem() { delete m_turretTargetingSystem; - m_turretTargetingSystem = NULL; + m_turretTargetingSystem = nullptr; } // ---------------------------------------------------------------------- @@ -281,7 +281,7 @@ void ShipController::addDockedBy(Object const & unit) { IGNORE_RETURN(m_dockedByList->insert(CachedNetworkId(unit))); - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("ShipController::addDockedBy() owner(%s) dockedBy(%s) dockedByListSize(%u)", (getOwner() != NULL) ? getOwner()->getNetworkId().getValueString().c_str() : "NULL", unit.getNetworkId().getValueString().c_str(), m_dockedByList->size())); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("ShipController::addDockedBy() owner(%s) dockedBy(%s) dockedByListSize(%u)", (getOwner() != nullptr) ? getOwner()->getNetworkId().getValueString().c_str() : "nullptr", unit.getNetworkId().getValueString().c_str(), m_dockedByList->size())); } // ---------------------------------------------------------------------- @@ -294,7 +294,7 @@ void ShipController::removeDockedBy(Object const & unit) { m_dockedByList->erase(iterDockedByList); - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("ShipController::removeDockedBy() owner(%s) dockedBy(%s) dockedByListSize(%u)", (getOwner() != NULL) ? getOwner()->getNetworkId().getValueString().c_str() : "NULL", unit.getNetworkId().getValueString().c_str(), m_dockedByList->size())); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("ShipController::removeDockedBy() owner(%s) dockedBy(%s) dockedByListSize(%u)", (getOwner() != nullptr) ? getOwner()->getNetworkId().getValueString().c_str() : "nullptr", unit.getNetworkId().getValueString().c_str(), m_dockedByList->size())); } else { @@ -314,7 +314,7 @@ ShipController::DockedByList const & ShipController::getDockedByList() const void ShipController::addAiTargetingMe(NetworkId const & unit) { //LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("ShipController::addAiTargetingMe() owner(%s) unit(%s) m_aiTargetingMeList->size(%u+1)", getOwner()->getNetworkId().getValueString().c_str(), unit.getValueString().c_str(), m_aiTargetingMeList->size())); - DEBUG_FATAL((NetworkIdManager::getObjectById(unit) == NULL), ("ShipController::addAiTargetingMe() owner(%s) unit(%s) ERROR: The Ai who is targeting you is not a valid networkId", getOwner()->getNetworkId().getValueString().c_str(), unit.getValueString().c_str())); + DEBUG_FATAL((NetworkIdManager::getObjectById(unit) == nullptr), ("ShipController::addAiTargetingMe() owner(%s) unit(%s) ERROR: The Ai who is targeting you is not a valid networkId", getOwner()->getNetworkId().getValueString().c_str(), unit.getValueString().c_str())); // Make sure this is a valid networkId of an alive object @@ -346,11 +346,11 @@ void ShipController::removeAiTargetingMe(NetworkId const & unit) { ShipObject * const shipOwner = getShipOwner(); - if (shipOwner != NULL) + if (shipOwner != nullptr) { CreatureObject * const pilotOwner = CreatureObject::asCreatureObject(shipOwner->getPilot()); - if ( (pilotOwner != NULL) + if ( (pilotOwner != nullptr) && pilotOwner->isPlayerControlled()) { shipOwner->clearCondition(static_cast(TangibleObject::C_spaceCombatMusic)); @@ -442,7 +442,7 @@ bool ShipController::face(Vector const & goalPosition_w, float elapsedTime) bool useFastAxis = true; AiShipController const * const aiShipController = asAiShipController(); - if (aiShipController != NULL) + if (aiShipController != nullptr) { if ( (aiShipController->getShipClass() == ShipAiReactionManager::SC_capitalShip) || (aiShipController->getShipClass() == ShipAiReactionManager::SC_transport) @@ -620,7 +620,7 @@ float ShipController::getLargestTurnRadius() const ShipObject const * const shipObject = getShipOwner(); - if (shipObject != NULL) + if (shipObject != nullptr) { float const maxYawRate = shipObject->getShipActualYawRateMaximum(); float const maxPitchRate = shipObject->getShipActualPitchRateMaximum(); @@ -650,11 +650,11 @@ void ShipController::dock(ShipObject & dockTarget, float const secondsAtDock) void ShipController::unDock() { - if (m_pendingDockingBehavior != NULL) + if (m_pendingDockingBehavior != nullptr) { m_pendingDockingBehavior->unDock(); } - else if (m_dockingBehavior != NULL) + else if (m_dockingBehavior != nullptr) { m_dockingBehavior->unDock(); } @@ -664,14 +664,14 @@ void ShipController::unDock() bool ShipController::isDocking() const { - return (m_dockingBehavior != NULL) || (m_pendingDockingBehavior != NULL); + return (m_dockingBehavior != nullptr) || (m_pendingDockingBehavior != nullptr); } // ---------------------------------------------------------------------- bool ShipController::isDocked() const { - return ((m_dockingBehavior != NULL) && m_dockingBehavior->isDocked()); + return ((m_dockingBehavior != nullptr) && m_dockingBehavior->isDocked()); } // ---------------------------------------------------------------------- @@ -698,28 +698,28 @@ ShipController const * ShipController::asShipController() const PlayerShipController * ShipController::asPlayerShipController() { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- PlayerShipController const * ShipController::asPlayerShipController() const { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- AiShipController * ShipController::asAiShipController() { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- AiShipController const * ShipController::asAiShipController() const { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -736,7 +736,7 @@ bool ShipController::addDamageTaken(NetworkId const & attackingUnit, float const bool result = false; ShipObject * const attackingUnitShipObject = ShipObject::asShipObject(NetworkIdManager::getObjectById(attackingUnit)); - if ( (attackingUnitShipObject != NULL) + if ( (attackingUnitShipObject != nullptr) && !attackingUnitShipObject->isDamageAggroImmune()) { result = verifyAttacker ? Pvp::canAttack(*attackingUnitShipObject, *NON_NULL(getShipOwner())) : true; @@ -754,7 +754,7 @@ bool ShipController::addDamageTaken(NetworkId const & attackingUnit, float const bool ShipController::hasTurretTargetingSystem() const { - return (m_turretTargetingSystem != NULL); + return (m_turretTargetingSystem != nullptr); } // ---------------------------------------------------------------------- @@ -792,7 +792,7 @@ bool ShipController::removeAttackTarget(NetworkId const & unit) void ShipController::onAttackTargetChanged(NetworkId const & target) { - if (m_turretTargetingSystem != NULL) + if (m_turretTargetingSystem != nullptr) { m_turretTargetingSystem->onTargetChanged(target); } @@ -802,7 +802,7 @@ void ShipController::onAttackTargetChanged(NetworkId const & target) void ShipController::onAttackTargetLost(NetworkId const & target) { - if (m_turretTargetingSystem != NULL) + if (m_turretTargetingSystem != nullptr) { m_turretTargetingSystem->onTargetLost(target); } @@ -834,12 +834,12 @@ int ShipController::getNumberOfAiUnitsAttackingMe() const CachedNetworkId const & ai = (*iterAiTargetingMeList); Object const * const aiObject = ai.getObject(); - if (aiObject != NULL) + if (aiObject != nullptr) { ShipController const * const shipController = aiObject->getController()->asShipController(); - AiShipController const * const aiShipController = (shipController != NULL) ? shipController->asAiShipController() : NULL; + AiShipController const * const aiShipController = (shipController != nullptr) ? shipController->asAiShipController() : nullptr; - if (aiShipController != NULL) + if (aiShipController != nullptr) { if (aiShipController->getPrimaryAttackTarget() == getOwner()->getNetworkId()) { @@ -849,7 +849,7 @@ int ShipController::getNumberOfAiUnitsAttackingMe() const } else { - DEBUG_WARNING(true, ("ShipController::getNumberOfAiShipAttackingMe() ERROR: Why am I(%s) being targeted by a NULL object(%s)?", getOwner()->getDebugInformation().c_str(), ai.getValueString().c_str())); + DEBUG_WARNING(true, ("ShipController::getNumberOfAiShipAttackingMe() ERROR: Why am I(%s) being targeted by a nullptr object(%s)?", getOwner()->getDebugInformation().c_str(), ai.getValueString().c_str())); } } @@ -910,11 +910,11 @@ void ShipController::clearAiTargetingMeList() { CachedNetworkId const & id = (*iterPurgeList); - if (id.getObject() != NULL) + if (id.getObject() != nullptr) { ShipController * const shipController = id.getObject()->getController()->asShipController(); - if (shipController != NULL) + if (shipController != nullptr) { IGNORE_RETURN(shipController->removeAttackTarget(getOwner()->getNetworkId())); } diff --git a/engine/server/library/serverGame/src/shared/controller/TangibleController.cpp b/engine/server/library/serverGame/src/shared/controller/TangibleController.cpp index d4e90806..ee670607 100755 --- a/engine/server/library/serverGame/src/shared/controller/TangibleController.cpp +++ b/engine/server/library/serverGame/src/shared/controller/TangibleController.cpp @@ -222,7 +222,7 @@ void TangibleController::handleMessage (const int message, const float value, co case CM_addHate: { const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); - WARNING((msg == NULL), ("TangibleController::handleMessage(CM_addHate) The message data should never be NULL")); + WARNING((msg == nullptr), ("TangibleController::handleMessage(CM_addHate) The message data should never be nullptr")); if(msg) { @@ -233,7 +233,7 @@ void TangibleController::handleMessage (const int message, const float value, co case CM_setHate: { const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); - WARNING((msg == NULL), ("TangibleController::handleMessage(CM_setHate) The message data should never be NULL")); + WARNING((msg == nullptr), ("TangibleController::handleMessage(CM_setHate) The message data should never be nullptr")); if(msg) { @@ -244,7 +244,7 @@ void TangibleController::handleMessage (const int message, const float value, co case CM_removeHateTarget: { const MessageQueueGenericValueType * const msg = safe_cast *>(data); - WARNING((msg == NULL), ("TangibleController::handleMessage(CM_removeHateTarget) The message data should never be NULL")); + WARNING((msg == nullptr), ("TangibleController::handleMessage(CM_removeHateTarget) The message data should never be nullptr")); if(msg) { @@ -265,7 +265,7 @@ void TangibleController::handleMessage (const int message, const float value, co case CM_forceHateTarget: { const MessageQueueGenericValueType * const msg = safe_cast *>(data); - WARNING((msg == NULL), ("TangibleController::handleMessage(CM_removeHateTarget) The message data should never be NULL")); + WARNING((msg == nullptr), ("TangibleController::handleMessage(CM_removeHateTarget) The message data should never be nullptr")); if(msg) { @@ -276,9 +276,9 @@ void TangibleController::handleMessage (const int message, const float value, co case CM_autoExpireHateListTargetEnabled: { const MessageQueueGenericValueType * const msg = safe_cast *>(data); - WARNING((msg == NULL), ("TangibleController::handleMessage(CM_setHateListExpireTargetEnabled) The message data should never be NULL")); + WARNING((msg == nullptr), ("TangibleController::handleMessage(CM_setHateListExpireTargetEnabled) The message data should never be nullptr")); - if (msg != NULL) + if (msg != nullptr) { owner->setHateListAutoExpireTargetEnabled(msg->getValue()); } @@ -315,7 +315,7 @@ void TangibleController::handleMessage (const int message, const float value, co if(object) { ServerObject * transferer = safe_cast(NetworkIdManager::getObjectById(msg->getValue().second)); - // transferer is allowed to be null + // transferer is allowed to be nullptr owner->addObjectToOutputSlot(*object, transferer); } } @@ -576,7 +576,7 @@ void TangibleController::handleMessage (const int message, const float value, co case CM_addUserToAccessList: { MessageQueueGenericValueType > const *msg = safe_cast > const *>(data); - WARNING((msg == NULL), ("TangibleController::handleMessage(CM_addUserToAccessList) The message data should never be NULL")); + WARNING((msg == nullptr), ("TangibleController::handleMessage(CM_addUserToAccessList) The message data should never be nullptr")); if(msg) { @@ -590,7 +590,7 @@ void TangibleController::handleMessage (const int message, const float value, co case CM_removeUserFromAccessList: { MessageQueueGenericValueType > const *msg = safe_cast > const *>(data); - WARNING((msg == NULL), ("TangibleController::handleMessage(CM_removeUserFromAccessList) The message data should never be NULL")); + WARNING((msg == nullptr), ("TangibleController::handleMessage(CM_removeUserFromAccessList) The message data should never be nullptr")); if(msg) { @@ -722,14 +722,14 @@ TangibleController const * TangibleController::asTangibleController() const AiTurretController * TangibleController::asAiTurretController() { - return NULL; + return nullptr; } //---------------------------------------------------------------------- AiTurretController const * TangibleController::asAiTurretController() const { - return NULL; + return nullptr; } //======================================================================== diff --git a/engine/server/library/serverGame/src/shared/core/AttribModNameManager.cpp b/engine/server/library/serverGame/src/shared/core/AttribModNameManager.cpp index 8cf03ed4..f2104fad 100755 --- a/engine/server/library/serverGame/src/shared/core/AttribModNameManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/AttribModNameManager.cpp @@ -24,7 +24,7 @@ namespace AttribModNameManagerNamespace std::set unknownCrcs; } -AttribModNameManager * AttribModNameManager::ms_attribModNameManager = NULL; +AttribModNameManager * AttribModNameManager::ms_attribModNameManager = nullptr; //======================================================================== @@ -65,8 +65,8 @@ AttribModNameManager::~AttribModNameManager() { delete m_names; delete m_crcMap; - m_names = NULL; - m_crcMap = NULL; + m_names = nullptr; + m_crcMap = nullptr; } // AttribModNameManager::~AttribModNameManager // ---------------------------------------------------------------------- @@ -76,7 +76,7 @@ AttribModNameManager::~AttribModNameManager() */ void AttribModNameManager::install() { - if (ms_attribModNameManager == NULL) + if (ms_attribModNameManager == nullptr) { ms_attribModNameManager = new AttribModNameManager; ExitChain::add(AttribModNameManager::remove, "AttribModNameManager::remove"); @@ -90,10 +90,10 @@ void AttribModNameManager::install() */ void AttribModNameManager::remove() { - if (ms_attribModNameManager != NULL) + if (ms_attribModNameManager != nullptr) { delete ms_attribModNameManager; - ms_attribModNameManager = NULL; + ms_attribModNameManager = nullptr; } } // AttribModNameManager::remove @@ -263,7 +263,7 @@ void AttribModNameManager::sendAllNamesToServer(std::vector const & serv * * @param crc the crc value to look up * - * @return the attrib mod name, or NULL if there was no name for the crc + * @return the attrib mod name, or nullptr if there was no name for the crc */ const char * AttribModNameManager::getAttribModName(uint32 crc) const { @@ -277,7 +277,7 @@ const char * AttribModNameManager::getAttribModName(uint32 crc) const ServerClock::getInstance().getServerFrame())); AttribModNameManagerNamespace::unknownCrcs.insert(crc); } - return NULL; + return nullptr; } // AttribModNameManager::getAttribModName // ---------------------------------------------------------------------- @@ -350,7 +350,7 @@ void AttribModNameManager::getAttribModNamesFromBase(uint32 base, std::vector & names) const { const char * baseName = getAttribModName(base); - if (baseName != NULL) + if (baseName != nullptr) getAttribModNamesFromBase(baseName, names); } // AttribModNameManager::getAttribModNamesFromBase @@ -366,7 +366,7 @@ void AttribModNameManager::getAttribModCrcsFromBase(uint32 base, std::vector & crcs) const { const char * baseName = getAttribModName(base); - if (baseName != NULL) + if (baseName != nullptr) getAttribModCrcsFromBase(baseName, crcs); } // AttribModNameManager::getAttribModCrcsFromBase diff --git a/engine/server/library/serverGame/src/shared/core/BiographyManager.cpp b/engine/server/library/serverGame/src/shared/core/BiographyManager.cpp index 6febe92c..6996f5fc 100755 --- a/engine/server/library/serverGame/src/shared/core/BiographyManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/BiographyManager.cpp @@ -133,7 +133,7 @@ void BiographyManager::deleteBiography(const NetworkId &owner) DEBUG_FATAL(!m_installed, ("BioManager not installed")); - BiographyMessage const msg(owner,NULL); + BiographyMessage const msg(owner,nullptr); GameServer::getInstance().sendToDatabaseServer(msg); // Save off the bio for viewing by other players diff --git a/engine/server/library/serverGame/src/shared/core/CharacterMatchManager.cpp b/engine/server/library/serverGame/src/shared/core/CharacterMatchManager.cpp index ce305b38..89668966 100755 --- a/engine/server/library/serverGame/src/shared/core/CharacterMatchManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/CharacterMatchManager.cpp @@ -55,7 +55,7 @@ namespace CharacterMatchManagerNamespace // used when invoking LfgDataTable::LfgNode::internalAttributeMatchFunction struct LfgInternalAttributeMatchFunctionParams { - LfgInternalAttributeMatchFunctionParams() : param1(NULL), param2(NULL), param3(NULL), param4(NULL), param5(NULL) {} + LfgInternalAttributeMatchFunctionParams() : param1(nullptr), param2(nullptr), param3(nullptr), param4(nullptr), param5(nullptr) {} void const * param1; void const * param2; @@ -151,8 +151,8 @@ bool CharacterMatchManagerNamespace::isMatch(std::map(NetworkIdManager::getObjectById(networkId)); - Client * const requestClient = (requestServerObject ? requestServerObject->getClient() : NULL); - CreatureObject * const requestCreatureObject = (requestServerObject ? requestServerObject->asCreatureObject() : NULL); - PlayerObject * const requestPlayerObject = (requestCreatureObject ? PlayerCreatureController::getPlayerObject(requestCreatureObject) : NULL); + Client * const requestClient = (requestServerObject ? requestServerObject->getClient() : nullptr); + CreatureObject * const requestCreatureObject = (requestServerObject ? requestServerObject->asCreatureObject() : nullptr); + PlayerObject * const requestPlayerObject = (requestCreatureObject ? PlayerCreatureController::getPlayerObject(requestCreatureObject) : nullptr); if (requestCreatureObject && requestPlayerObject && requestClient) { @@ -210,10 +210,10 @@ void CharacterMatchManager::requestMatch(NetworkId const &networkId, MatchMaking } // if "friend" is one of the search criteria, this will contain the requester's friends list - PlayerObject::StringVector const * requestPlayerObjectSortedLowercaseFriendList = NULL; + PlayerObject::StringVector const * requestPlayerObjectSortedLowercaseFriendList = nullptr; // if "cts_source_galaxy" is one of the search criteria, this will contain the requester's CTS source galaxy list - std::set const * requestPlayerObjectCtsSourceGalaxy = NULL; + std::set const * requestPlayerObjectCtsSourceGalaxy = nullptr; // if "in_same_guild" is one of the search criteria, this will contain the requester's guild abbrev bool inSameGuildSearch = false; @@ -224,7 +224,7 @@ void CharacterMatchManager::requestMatch(NetworkId const &networkId, MatchMaking std::string requestPlayerObjectCitizenOfCity; // if "cts_source_galaxy" is one of the search criteria, this will contain the list of matching CTS source galaxy - std::vector * matchingCtsSourceGalaxy = NULL; + std::vector * matchingCtsSourceGalaxy = nullptr; // allows search of characters marked anonymous bool bypassAnonymous = false; @@ -271,7 +271,7 @@ void CharacterMatchManager::requestMatch(NetworkId const &networkId, MatchMaking // special handling for "friend" search attribute if (iterLeafNode->second->name == "friend") { - if (requestPlayerObjectSortedLowercaseFriendList == NULL) + if (requestPlayerObjectSortedLowercaseFriendList == nullptr) { requestPlayerObjectSortedLowercaseFriendList = &(requestPlayerObject->getSortedLowercaseFriendList()); } @@ -284,7 +284,7 @@ void CharacterMatchManager::requestMatch(NetworkId const &networkId, MatchMaking // special handling for "cts_source_galaxy" search attribute else if (iterLeafNode->second->name == "cts_source_galaxy") { - if (requestPlayerObjectCtsSourceGalaxy == NULL) + if (requestPlayerObjectCtsSourceGalaxy == nullptr) { std::map const & connectedCharacterLfgData = ServerUniverse::getConnectedCharacterLfgData(); std::map::const_iterator iterFindLfg = connectedCharacterLfgData.find(networkId); @@ -292,7 +292,7 @@ void CharacterMatchManager::requestMatch(NetworkId const &networkId, MatchMaking requestPlayerObjectCtsSourceGalaxy = &(iterFindLfg->second.ctsSourceGalaxy); } - if (matchingCtsSourceGalaxy == NULL) + if (matchingCtsSourceGalaxy == nullptr) matchingCtsSourceGalaxy = new std::vector; LfgInternalAttributeMatchFunctionParams params; @@ -421,7 +421,7 @@ void CharacterMatchManager::requestMatch(NetworkId const &networkId, MatchMaking } else { - ConsoleMgr::broadcastString("(NULL) (All)", requestClient); + ConsoleMgr::broadcastString("(nullptr) (All)", requestClient); } for (std::vector >::const_iterator iterSearchAttribute = iterAnyAllParentNode->second.begin(); iterSearchAttribute != iterAnyAllParentNode->second.end(); ++iterSearchAttribute) @@ -544,7 +544,7 @@ void CharacterMatchManager::requestMatch(NetworkId const &networkId, MatchMaking if (lfgCharacterData.groupId.isValid() && (mmcr.m_matchingCharacterGroup.count(lfgCharacterData.groupId) == 0)) { ServerObject const * const soGroupObject = safe_cast(NetworkIdManager::getObjectById(lfgCharacterData.groupId)); - GroupObject const * const groupObject = (soGroupObject ? soGroupObject->asGroupObject() : NULL); + GroupObject const * const groupObject = (soGroupObject ? soGroupObject->asGroupObject() : nullptr); if (groupObject) { std::vector & groupInfo = mmcr.m_matchingCharacterGroup[lfgCharacterData.groupId]; diff --git a/engine/server/library/serverGame/src/shared/core/Client.cpp b/engine/server/library/serverGame/src/shared/core/Client.cpp index ab4e4e97..cdef65db 100755 --- a/engine/server/library/serverGame/src/shared/core/Client.cpp +++ b/engine/server/library/serverGame/src/shared/core/Client.cpp @@ -263,8 +263,8 @@ Client::Client(ConnectionServerConnection & connection, const NetworkId & charac { // Don't ever put the character into a packed house ServerObject * const serverObject = containerObject->asServerObject(); - CellObject * const cellObject = (serverObject ? serverObject->asCellObject() : NULL); - BuildingObject * const buildingObject = (cellObject ? cellObject->getOwnerBuilding() : NULL); + CellObject * const cellObject = (serverObject ? serverObject->asCellObject() : nullptr); + BuildingObject * const buildingObject = (cellObject ? cellObject->getOwnerBuilding() : nullptr); if ((buildingObject) && (!buildingObject->isInWorld())) { @@ -713,8 +713,8 @@ void Client::receiveClientMessage(const GameNetworkMessage & message) SlottedContainer const * const slottedContainer = ContainerInterface::getSlottedContainer(*containedBy); ShipObject * const shipObject = ShipObject::getContainingShipObject(containedBy); - if ( (shipObject != NULL) - && (slottedContainer != NULL) + if ( (shipObject != nullptr) + && (slottedContainer != nullptr) && !shipObject->hasCondition(TangibleObject::C_docking)) { bool shotOk = false; @@ -958,7 +958,7 @@ void Client::receiveClientMessage(const GameNetworkMessage & message) const ObjectMenuSelectMessage m (ri); ServerObject * const target = safe_cast(NetworkIdManager::getObjectById (m.getNetworkId())); GameScriptObject * const scriptObject = target ? target->getScriptObject() : 0; - Object * const targetContainedBy = target ? ContainerInterface::getContainedByObject(*target) : NULL; + Object * const targetContainedBy = target ? ContainerInterface::getContainedByObject(*target) : nullptr; const int menuType = m.getSelectedItemId(); static int examineMenuType = RadialMenuManager::getMenuTypeByName("EXAMINE"); @@ -1080,7 +1080,7 @@ void Client::receiveClientMessage(const GameNetworkMessage & message) { // apply the controller message ServerController * controller = dynamic_cast(target->getController()); - if (controller != NULL) + if (controller != nullptr) { uint32 flags = o.getFlags(); flags &= ~GameControllerMessageFlags::SOURCE_REMOTE; @@ -1096,7 +1096,7 @@ void Client::receiveClientMessage(const GameNetworkMessage & message) if (target) { ServerController * controller = dynamic_cast(target->getController()); - if (controller != NULL) + if (controller != nullptr) { uint32 flags = o.getFlags(); flags &= ~GameControllerMessageFlags::SOURCE_REMOTE; @@ -1315,11 +1315,11 @@ void Client::receiveClientMessage(const GameNetworkMessage & message) { CreatureObject *creatureObject = dynamic_cast(getCharacterObject()); - if (creatureObject != NULL) + if (creatureObject != nullptr) { GameScriptObject *gameScriptObject = creatureObject->getScriptObject(); - if(gameScriptObject != NULL) + if(gameScriptObject != nullptr) { ScriptParams scriptParams; IGNORE_RETURN(gameScriptObject->trigAllScripts(Scripting::TRIG_STOMACH_UPDATE, scriptParams)); @@ -1964,7 +1964,7 @@ void Client::receiveClientMessage(const GameNetworkMessage & message) GenericValueTypeMessage > > const msgPlayTimeInfo(readIterator); PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(safe_cast(getCharacterObject())); - if (playerObject != NULL) + if (playerObject != nullptr) { playerObject->setSessionPlayTimeInfo(msgPlayTimeInfo.getValue().first, msgPlayTimeInfo.getValue().second.first, msgPlayTimeInfo.getValue().second.second); } @@ -2222,7 +2222,7 @@ void Client::addObserving(ServerObject* o) { IGNORE_RETURN(m_observing.insert(o)); TangibleObject *to = o->asTangibleObject(); - if (to && PvpUpdateObserver::satisfyPvpSyncCondition(to->isNonPvpObject(), to->hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (o->asCreatureObject() != NULL), to->getPvpFaction())) + if (to && PvpUpdateObserver::satisfyPvpSyncCondition(to->isNonPvpObject(), to->hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (o->asCreatureObject() != nullptr), to->getPvpFaction())) addObservingPvpSync(to); } } diff --git a/engine/server/library/serverGame/src/shared/core/ClusterWideDataClient.cpp b/engine/server/library/serverGame/src/shared/core/ClusterWideDataClient.cpp index a0c10d82..ddf92605 100755 --- a/engine/server/library/serverGame/src/shared/core/ClusterWideDataClient.cpp +++ b/engine/server/library/serverGame/src/shared/core/ClusterWideDataClient.cpp @@ -115,7 +115,7 @@ bool ClusterWideDataClient::handleMessage(const MessageDispatch::Emitter &, cons // locate the callback object ClusterWideDataClientNamespace::CallbackObjectIdList::iterator iter = ClusterWideDataClientNamespace::callbackObjectIdList.find(msg.getRequestId()); - ServerObject * object = NULL; + ServerObject * object = nullptr; if (iter != ClusterWideDataClientNamespace::callbackObjectIdList.end()) object = dynamic_cast(NetworkIdManager::getObjectById(iter->second)); diff --git a/engine/server/library/serverGame/src/shared/core/CombatTracker.cpp b/engine/server/library/serverGame/src/shared/core/CombatTracker.cpp index 3c0882b9..ed0b1ffd 100755 --- a/engine/server/library/serverGame/src/shared/core/CombatTracker.cpp +++ b/engine/server/library/serverGame/src/shared/core/CombatTracker.cpp @@ -45,7 +45,7 @@ void CombatTracker::getInterestedViewers(TangibleObject const *defender, std::ve AICreatureController const * const defenderAiCreatureController = AICreatureController::asAiCreatureController(defender->getController()); bool const defenderIsInWorldCell = defender->isInWorldCell(); - if (defenderAiCreatureController != NULL) + if (defenderAiCreatureController != nullptr) { ServerWorld::findObjectsInRange(defender->getPosition_w(), defenderAiCreatureController->getAssistRadius(), unfilteredViewers); @@ -54,7 +54,7 @@ void CombatTracker::getInterestedViewers(TangibleObject const *defender, std::ve bool interested = true; ServerObject const * const serverObject = *i; - if ( (serverObject == NULL) + if ( (serverObject == nullptr) || (serverObject == defender) || serverObject->isPlayerControlled() || !serverObject->wantSawAttackTriggers()) @@ -65,7 +65,7 @@ void CombatTracker::getInterestedViewers(TangibleObject const *defender, std::ve { TangibleObject const * const tangibleObject = serverObject->asTangibleObject(); - if (tangibleObject != NULL) + if (tangibleObject != nullptr) { if ( tangibleObject->isInCombat() || tangibleObject->isDisabled() @@ -77,7 +77,7 @@ void CombatTracker::getInterestedViewers(TangibleObject const *defender, std::ve { CreatureObject const * const creatureObject = tangibleObject->asCreatureObject(); - if (creatureObject != NULL) + if (creatureObject != nullptr) { if ( creatureObject->isIncapacitated() || creatureObject->isDead()) @@ -88,7 +88,7 @@ void CombatTracker::getInterestedViewers(TangibleObject const *defender, std::ve { AICreatureController const * const aiCreatureController = AICreatureController::asAiCreatureController(creatureObject->getController()); - if (aiCreatureController != NULL) + if (aiCreatureController != nullptr) { if (aiCreatureController->isRetreating()) { @@ -138,7 +138,7 @@ void CombatTracker::update() { TangibleObject const * const attackerTangibleObject = TangibleObject::asTangibleObject(iterAttackers->getObject()); - if (attackerTangibleObject != NULL) + if (attackerTangibleObject != nullptr) { localAttackers.push_back(attackerTangibleObject->getNetworkId()); } @@ -158,7 +158,7 @@ void CombatTracker::update() ServerObject * const combatViewer = *iterCombatViewers; GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(combatViewer); - if (gameScriptObject != NULL) + if (gameScriptObject != nullptr) { ScriptParams scriptParams; scriptParams.addParam(defender->getNetworkId()); diff --git a/engine/server/library/serverGame/src/shared/core/CommunityManager.cpp b/engine/server/library/serverGame/src/shared/core/CommunityManager.cpp index dc479216..cc7f46e5 100755 --- a/engine/server/library/serverGame/src/shared/core/CommunityManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/CommunityManager.cpp @@ -42,14 +42,14 @@ using namespace CommunityManagerNameSpace; //----------------------------------------------------------------------------- PlayerObject *CommunityManagerNameSpace::getPlayerObject(NetworkId const &networkId) { - PlayerObject *result = NULL; + PlayerObject *result = nullptr; Object *object = NetworkIdManager::getObjectById(networkId); - if (object != NULL) + if (object != nullptr) { CreatureObject *creatureObject = dynamic_cast(object); - if (creatureObject != NULL) + if (creatureObject != nullptr) { result = PlayerCreatureController::getPlayerObject(creatureObject); } @@ -61,10 +61,10 @@ PlayerObject *CommunityManagerNameSpace::getPlayerObject(NetworkId const &networ //----------------------------------------------------------------------------- ServerObject *CommunityManagerNameSpace::getServerObject(NetworkId const &networkId) { - ServerObject *result = NULL; + ServerObject *result = nullptr; Object *object = NetworkIdManager::getObjectById(networkId); - if (object != NULL) + if (object != nullptr) { result = dynamic_cast(object); } @@ -77,11 +77,11 @@ void CommunityManagerNameSpace::sendProseChatMessage(NetworkId const &networkId, { Object *object = NetworkIdManager::getObjectById(networkId); - if (object != NULL) + if (object != nullptr) { ServerObject *serverObject = dynamic_cast(object); - if (serverObject != NULL) + if (serverObject != nullptr) { ProsePackage prosePackage; prosePackage.stringId = stringId; @@ -117,7 +117,7 @@ void CommunityManager::handleMessage(ChatOnChangeFriendStatus const &message) PlayerObject *playerObject = getPlayerObject(message.getCharacter()); - if (playerObject != NULL) + if (playerObject != nullptr) { if (message.getAdd()) { @@ -170,7 +170,7 @@ void CommunityManager::handleMessage(ChatOnGetFriendsList const &message) PlayerObject *playerObject = getPlayerObject(message.getCharacter()); - if (playerObject != NULL) + if (playerObject != nullptr) { typedef std::vector StringVector; StringVector friendList; @@ -231,7 +231,7 @@ void CommunityManager::handleMessage(ChatOnChangeIgnoreStatus const &message) PlayerObject *playerObject = getPlayerObject(message.getCharacter()); - if (playerObject != NULL) + if (playerObject != nullptr) { if (message.getIgnore()) { @@ -284,7 +284,7 @@ void CommunityManager::handleMessage(ChatOnGetIgnoreList const &message) PlayerObject *playerObject = getPlayerObject(message.getCharacter()); - if (playerObject != NULL) + if (playerObject != nullptr) { typedef std::vector StringVector; StringVector ignoreList; diff --git a/engine/server/library/serverGame/src/shared/core/ConfigServerGame.cpp b/engine/server/library/serverGame/src/shared/core/ConfigServerGame.cpp index cc5f64d9..03a9061f 100755 --- a/engine/server/library/serverGame/src/shared/core/ConfigServerGame.cpp +++ b/engine/server/library/serverGame/src/shared/core/ConfigServerGame.cpp @@ -528,10 +528,10 @@ void ConfigServerGame::install(void) // GCW score decay time(s) data->gcwScoreDecayTime.clear(); int index = 0; - char const * dayOfWeek = NULL; - char const * hour = NULL; - char const * minute = NULL; - char const * second = NULL; + char const * dayOfWeek = nullptr; + char const * hour = nullptr; + char const * minute = nullptr; + char const * second = nullptr; do { dayOfWeek = ConfigFile::getKeyString("GameServer", "gcwScoreDecayTimeDayOfWeek", index, 0); diff --git a/engine/server/library/serverGame/src/shared/core/ConfigServerGame.h b/engine/server/library/serverGame/src/shared/core/ConfigServerGame.h index 20465d94..0426f519 100755 --- a/engine/server/library/serverGame/src/shared/core/ConfigServerGame.h +++ b/engine/server/library/serverGame/src/shared/core/ConfigServerGame.h @@ -87,7 +87,7 @@ class ConfigServerGame int scriptWatcherInterruptTime; // time in ms (after scriptWatcherWarnTime) before we abort a script int scriptStackErrorLimit; // depth of stack error we assume to be a legit error int scriptStackErrorLevel; // how we handle a stack error: 0=recover, 1=javacore, 2=fatal - bool disableObjvarNullCheck; // flag to disable the check for a null object when get/setting objvars + bool disableObjvarNullCheck; // flag to disable the check for a nullptr object when get/setting objvars // throttle to limit how universe data is sent from // the universe game server to the other game servers; diff --git a/engine/server/library/serverGame/src/shared/core/ContainerInterface.cpp b/engine/server/library/serverGame/src/shared/core/ContainerInterface.cpp index 2fa62423..fdd5c6f2 100755 --- a/engine/server/library/serverGame/src/shared/core/ContainerInterface.cpp +++ b/engine/server/library/serverGame/src/shared/core/ContainerInterface.cpp @@ -68,7 +68,7 @@ namespace ContainerInterfaceNamespace if (creature->getBank() == lastContainer) { - //-- if player is passed in non-null, the found creature must match it + //-- if player is passed in non-nullptr, the found creature must match it if (player && player != creature) return false; @@ -340,8 +340,8 @@ namespace ContainerInterfaceNamespace { // This item is not contained by anything! // This means it is in the world! - // Return null for the source container, but succeed. - sourceContainer = NULL; + // Return nullptr for the source container, but succeed. + sourceContainer = nullptr; return true; } @@ -550,7 +550,7 @@ bool ContainerInterface::canTransferTo(ServerObject *destination, ServerObject & if (transfererCreatureObject->getObjVars().getItem("lotOverlimit.structure_id", lotOverlimitStructure) && lotOverlimitStructure.isValid()) { // determine the destination type - ServerObject const * topmostDestinationParent = NULL; + ServerObject const * topmostDestinationParent = nullptr; ServerObject const * destinationParent = destination; while (destinationParent) { @@ -734,8 +734,8 @@ bool ContainerInterface::transferItemToSlottedContainer(ServerObject &destinatio } } - ServerObject *sourceObject = NULL; - Container *sourceContainer = NULL; + ServerObject *sourceObject = nullptr; + Container *sourceContainer = nullptr; if (!sharedTransferBegin(item, sourceObject, sourceContainer, error)) return false; @@ -829,8 +829,8 @@ bool ContainerInterface::transferItemToVolumeContainer(ServerObject &destination { error = Container::CEC_Success; - ServerObject *sourceObject = NULL; - Container *sourceContainer = NULL; + ServerObject *sourceObject = nullptr; + Container *sourceContainer = nullptr; if (!sharedTransferBegin(item, sourceObject, sourceContainer, error)) return false; @@ -898,8 +898,8 @@ bool ContainerInterface::transferItemToCell(ServerObject &destination, ServerObj { error = Container::CEC_Success; - ServerObject *sourceObject = NULL; - Container *sourceContainer = NULL; + ServerObject *sourceObject = nullptr; + Container *sourceContainer = nullptr; //check source & item if (!sharedTransferBegin(item, sourceObject, sourceContainer, error)) @@ -980,13 +980,13 @@ bool ContainerInterface::transferItemToWorld(ServerObject &item, Transform const return false; } - if (!canTransferTo(NULL, item, transferer, error)) + if (!canTransferTo(nullptr, item, transferer, error)) { return false; } - ServerObject *sourceObject = NULL; - Container *sourceContainer = NULL; + ServerObject *sourceObject = nullptr; + Container *sourceContainer = nullptr; if (!sharedTransferBegin(item, sourceObject, sourceContainer, error)) { @@ -1009,8 +1009,8 @@ bool ContainerInterface::transferItemToWorld(ServerObject &item, Transform const item.setTransform_o2p(pos); - item.onContainerTransferComplete(sourceObject, NULL); - handleTransferScripts(item, sourceObject, NULL, transferer, error); + item.onContainerTransferComplete(sourceObject, nullptr); + handleTransferScripts(item, sourceObject, nullptr, transferer, error); return true; } @@ -1084,7 +1084,7 @@ Object *ContainerInterface::getContainedByObject(Object &obj) ContainedByProperty * const containedBy = getContainedByProperty(obj); if (containedBy) return containedBy->getContainedBy(); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -1094,7 +1094,7 @@ Object const *ContainerInterface::getContainedByObject(Object const &obj) ContainedByProperty const * const containedBy = getContainedByProperty(obj); if (containedBy) return containedBy->getContainedBy(); - return NULL; + return nullptr; } // ----------------------------------------------------------------------- @@ -1180,7 +1180,7 @@ Object const *ContainerInterface::getTopmostContainer(Object const &obj) // ----------------------------------------------------------------------- // Returns the object if it is in the world, or the first parent of the object -// that is in the world. This returns null, if the none of the parents of the object are in the world. +// that is in the world. This returns nullptr, if the none of the parents of the object are in the world. Object *ContainerInterface::getFirstParentInWorld(Object &obj) { @@ -1193,20 +1193,20 @@ Object *ContainerInterface::getFirstParentInWorld(Object &obj) if (!containedBy) { WARNING_STRICT_FATAL(true, ("All objects should have a containedby property")); - return NULL; + return nullptr; } // Is my containedBy property empty? If so I am topmost but am not in the world Object *currentContainer = containedBy->getContainedBy(); if (!currentContainer) { - return NULL; + return nullptr; } - // Does my parent expose contents? If it does, then return NULL since I have been removed from the world. + // Does my parent expose contents? If it does, then return nullptr since I have been removed from the world. if (!getContainer(*currentContainer) || getContainer(*currentContainer)->isContentItemExposedWith(*currentContainer)) { - return NULL; + return nullptr; } // Is my parent in the world? If so, he is topmost @@ -1218,7 +1218,7 @@ Object *ContainerInterface::getFirstParentInWorld(Object &obj) if (!containedBy) { WARNING_STRICT_FATAL(true, ("All objects should have a containedby property")); - return (currentContainer->isInWorld()) ? currentContainer : NULL; + return (currentContainer->isInWorld()) ? currentContainer : nullptr; } // Iterate from here. @@ -1236,12 +1236,12 @@ Object *ContainerInterface::getFirstParentInWorld(Object &obj) if (!containedBy) { WARNING_STRICT_FATAL(true, ("All objects should have a containedby property")); - return NULL; + return nullptr; } nextContainer = containedBy->getContainedBy(); } - return currentContainer->isInWorld() ? currentContainer : NULL; + return currentContainer->isInWorld() ? currentContainer : nullptr; } // ----------------------------------------------------------------------- @@ -1388,7 +1388,7 @@ bool ContainerInterface::onObjectDestroy(ServerObject& item) // currently only c return false; } - handleTransferScripts(item, parentObject, NULL, NULL, error); + handleTransferScripts(item, parentObject, nullptr, nullptr, error); } } return true; diff --git a/engine/server/library/serverGame/src/shared/core/FormManagerServer.cpp b/engine/server/library/serverGame/src/shared/core/FormManagerServer.cpp index 5a1c4b15..7fc312fa 100755 --- a/engine/server/library/serverGame/src/shared/core/FormManagerServer.cpp +++ b/engine/server/library/serverGame/src/shared/core/FormManagerServer.cpp @@ -101,7 +101,7 @@ void FormManagerServer::handleCreateObjectData(NetworkId const & actor, std::str Transform tr; tr.setPosition_p(position); ServerObject * const newObject = ServerWorld::createNewObject(crc, tr, cell, false); - if (newObject == NULL) + if (newObject == nullptr) return; if (cellId == NetworkId::cms_invalid) @@ -114,7 +114,7 @@ void FormManagerServer::handleCreateObjectData(NetworkId const & actor, std::str { //tell script to create the object in it's own special manner (since the datatable requests that) Object * const obj = NetworkIdManager::getObjectById(actor); - ServerObject * const serverObj = obj ? obj->asServerObject() : NULL; + ServerObject * const serverObj = obj ? obj->asServerObject() : nullptr; if(serverObj) { std::vector keys; @@ -151,11 +151,11 @@ void FormManagerServer::handleEditObjectData(NetworkId const & actor, NetworkId return; Object * const actorObj = NetworkIdManager::getObjectById(actor); - ServerObject * const actorServerObj = actorObj ? actorObj->asServerObject() : NULL; + ServerObject * const actorServerObj = actorObj ? actorObj->asServerObject() : nullptr; if(actorServerObj) { Object * const objectToEditObj = NetworkIdManager::getObjectById(objectToEdit); - ServerObject * const objectToEditServerObj = objectToEditObj ? objectToEditObj->asServerObject() : NULL; + ServerObject * const objectToEditServerObj = objectToEditObj ? objectToEditObj->asServerObject() : nullptr; if(objectToEditServerObj) { //get matching form @@ -207,11 +207,11 @@ void FormManagerServer::handleEditObjectData(NetworkId const & actor, NetworkId void FormManagerServer::requestEditObjectDataForClient(NetworkId const & actor, NetworkId const & objectToEdit) { Object * const actorObj = NetworkIdManager::getObjectById(actor); - ServerObject * const actorServerObj = actorObj ? actorObj->asServerObject() : NULL; + ServerObject * const actorServerObj = actorObj ? actorObj->asServerObject() : nullptr; if(actorServerObj) { Object * const objectToEditObj = NetworkIdManager::getObjectById(objectToEdit); - ServerObject * const objectToEditServerObj = objectToEditObj ? objectToEditObj->asServerObject() : NULL; + ServerObject * const objectToEditServerObj = objectToEditObj ? objectToEditObj->asServerObject() : nullptr; if(objectToEditServerObj) { //get matching form @@ -277,8 +277,8 @@ void FormManagerServer::sendEditObjectDataToClient(NetworkId const & client, Net return; Object * const playerObject = NetworkIdManager::getObjectById(client); - ServerObject * const playerServer = playerObject ? playerObject->asServerObject() : NULL; - CreatureObject * const playerCreature = playerServer ? playerServer->asCreatureObject() : NULL; + ServerObject * const playerServer = playerObject ? playerObject->asServerObject() : nullptr; + CreatureObject * const playerCreature = playerServer ? playerServer->asCreatureObject() : nullptr; if(playerCreature) { diff --git a/engine/server/library/serverGame/src/shared/core/GameServer.cpp b/engine/server/library/serverGame/src/shared/core/GameServer.cpp index 865b1078..30af19ef 100755 --- a/engine/server/library/serverGame/src/shared/core/GameServer.cpp +++ b/engine/server/library/serverGame/src/shared/core/GameServer.cpp @@ -317,11 +317,11 @@ namespace GameServerNamespace bool getConfigSetting(const char *section, const char *key, int & value) { const ConfigFile::Section * sec = ConfigFile::getSection(section); - if (sec == NULL) + if (sec == nullptr) return false; const ConfigFile::Key * ky = sec->findKey(key); - if (ky == NULL) + if (ky == nullptr) return false; value = ky->getAsInt(ky->getCount()-1, value); @@ -753,7 +753,7 @@ Client * GameServer::getClient(const NetworkId& networkId) { return i->second; } - return NULL; + return nullptr; } //----------------------------------------------------------------------- @@ -837,7 +837,7 @@ void GameServer::loadTerrain () terrainObject->setDebugName("terrain"); Appearance * const appearance = AppearanceTemplateList::createAppearance(terrainFileName); - if (appearance != NULL) { + if (appearance != nullptr) { terrainObject->setAppearance(appearance); } else { DEBUG_WARNING(true, ("FIX ME: Appearance template for GameServer::loadTerrain missing for %s.", terrainFileName)); @@ -866,7 +866,7 @@ void GameServer::shutdown() m_centralService = 0; m_planetServerConnection = 0; - if (m_customerServiceServerConnection != NULL) + if (m_customerServiceServerConnection != nullptr) { m_customerServiceServerConnection->disconnect(); } @@ -909,7 +909,7 @@ void GameServer::receiveMessage(const MessageDispatch::Emitter & source, const M DEBUG_REPORT_LOG(true, ("GameServer: Creating customer service server connection @ (%s:%d)\n", address.getValue().first.c_str(), address.getValue().second)); - if (m_customerServiceServerConnection != NULL) + if (m_customerServiceServerConnection != nullptr) { m_customerServiceServerConnection->disconnect(); } @@ -949,7 +949,7 @@ void GameServer::receiveMessage(const MessageDispatch::Emitter & source, const M std::vector const & baselines = m.getData(); - ServerObject * lastObject = NULL; + ServerObject * lastObject = nullptr; for (std::vector::const_iterator i=baselines.begin(); i!=baselines.end(); ++i) { @@ -1286,7 +1286,7 @@ void GameServer::receiveMessage(const MessageDispatch::Emitter & source, const M if (topmostContainer != object) { - WARNING(true, ("Denying authority transfer for (%s) from game server (%lu) to game server (%lu) because it is contained by (%s)", object->getDebugInformation().c_str(), GameServer::getInstance().getProcessId(), t.getProcess(), (topmostContainer ? topmostContainer->getDebugInformation().c_str() : "NULL"))); + WARNING(true, ("Denying authority transfer for (%s) from game server (%lu) to game server (%lu) because it is contained by (%s)", object->getDebugInformation().c_str(), GameServer::getInstance().getProcessId(), t.getProcess(), (topmostContainer ? topmostContainer->getDebugInformation().c_str() : "nullptr"))); allowed = false; @@ -1425,11 +1425,11 @@ void GameServer::receiveMessage(const MessageDispatch::Emitter & source, const M bool appended = false; ServerObject * const target = safe_cast(NetworkIdManager::getObjectById(c.getNetworkId())); - if (target != NULL) + if (target != nullptr) { // valid target, get its controller ServerController * const controller = safe_cast(target->getController()); - if (controller != NULL) + if (controller != nullptr) { uint32 flags = c.getFlags(); if(flags & GameControllerMessageFlags::DEST_AUTH_SERVER) @@ -1473,7 +1473,7 @@ void GameServer::receiveMessage(const MessageDispatch::Emitter & source, const M ri = static_cast(message).getByteStream().begin(); EndBaselinesMessage const t(ri); ServerObject * const object = ServerWorld::findUninitializedObjectByNetworkId(t.getId()); - if (object != NULL) + if (object != nullptr) { DEBUG_REPORT_LOG(ConfigServerGame::getLogObjectLoading(), ("Received EndBaselinesMessage for %s\n", t.getId().getValueString().c_str())); ServerController * const controller = dynamic_cast(object->getController()); @@ -1778,7 +1778,7 @@ void GameServer::receiveMessage(const MessageDispatch::Emitter & source, const M } else { - LOG("mounts-bug", ("GS::SceneTransferMessage: server id=[%d],rider id=[%s] has RidingMount state but getMountedCreature() returns NULL.", static_cast(getProcessId()), obj->getNetworkId().getValueString().c_str())); + LOG("mounts-bug", ("GS::SceneTransferMessage: server id=[%d],rider id=[%s] has RidingMount state but getMountedCreature() returns nullptr.", static_cast(getProcessId()), obj->getNetworkId().getValueString().c_str())); objAsCreature->emergencyDismountForRider(); } } @@ -2297,7 +2297,7 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const if (creatureObj->isAuthoritative()) { AICreatureController const * const aiCreatureController = AICreatureController::asAiCreatureController(creatureObj->getController()); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { continue; } @@ -2359,7 +2359,7 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const #endif std::string time = FormattedString<1024>().sprintf("(%3d,%5dms) %30s.%-2lu (%3lu) on %35s:%-7d (%lu) ", ObjectTracker::getNumPlayers(), static_cast(Clock::frameTime()*1000), ServerWorld::getSceneId().c_str(), m_preloadAreaId, m_processId, hostName.c_str(), Os::getProcessId(), ServerClock::getInstance().getGameTimeSeconds()); - time += CalendarTime::convertEpochToTimeStringGMT(::time(NULL)); + time += CalendarTime::convertEpochToTimeStringGMT(::time(nullptr)); GenericValueTypeMessage > > rsctr( "ReportSystemClockTimeResponse", std::make_pair(msg.getValue().first, std::make_pair(time, msg.getValue().second))); @@ -2378,7 +2378,7 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const ri = static_cast(message).getByteStream().begin(); GenericValueTypeMessage > const msg(ri); - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); std::string time = FormattedString<1024>().sprintf("%30s.%-2lu (%3lu) (%lu) (%ld, ", ServerWorld::getSceneId().c_str(), m_preloadAreaId, m_processId, ServerClock::getInstance().getGameTimeSeconds(), timeNow); time += CalendarTime::convertEpochToTimeStringGMT(timeNow); time += ")"; @@ -2404,7 +2404,7 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const } else { - time += " (terrainObject is NULL)"; + time += " (terrainObject is nullptr)"; } GenericValueTypeMessage > > rptr( @@ -2596,7 +2596,7 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const bool removeCurrentCitizenDeleted; bool removeCurrentCitizenInactive; bool hasDeclaredResidence; - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); bool const citizenInactivePackupActive = (ConfigServerGame::getCityCitizenshipInactivePackupStartTimeEpoch() <= timeNow); std::map, CitizenInfo> const & allCitizens = CityInterface::getAllCitizensInfo(); for (std::map >::iterator iterCityId = s_clusterStartupResidenceStructureListByCity.begin(); iterCityId != s_clusterStartupResidenceStructureListByCity.end(); ++iterCityId) @@ -2614,7 +2614,7 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const if (currentCityMayor.isValid()) currentCityMayorCitizenInfo = CityInterface::getCitizenInfo(iterCityId->first, currentCityMayor); else - currentCityMayorCitizenInfo = NULL; + currentCityMayorCitizenInfo = nullptr; if (currentCityMayorCitizenInfo) currentCityMayorName = currentCityMayorCitizenInfo->m_citizenName; @@ -2958,7 +2958,7 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const ScriptDictionaryPtr dictionary; responseObject->getScriptObject()->makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(responseObject->getNetworkId(), "foundObject", dictionary->getSerializedData(), 0, false); @@ -3140,11 +3140,11 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const CreatureObject * const creatureObject = CreatureObject::getCreatureObject(networkId); - if (creatureObject != NULL) + if (creatureObject != nullptr) { Controller * const controller = creatureObject->getController(); - if (controller != NULL) + if (controller != nullptr) { DEBUG_LOG("debug_ai", ("GameServer::receiveMessage() Received AiCreatureStateMessage for networkId(%s) movementType(%s)", networkId.getValueString().c_str(), AiMovementBase::getMovementString(movement.getMovementType()))); @@ -3211,7 +3211,7 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); PlayedTimeAccumMessage const ptam(ri); Object * obj = NetworkIdManager::getObjectById(ptam.getNetworkId()); - if (obj != NULL && obj->asServerObject() != NULL && obj->asServerObject()->asCreatureObject() != NULL) + if (obj != nullptr && obj->asServerObject() != nullptr && obj->asServerObject()->asCreatureObject() != nullptr) { CreatureObject * target = obj->asServerObject()->asCreatureObject(); PlayerObject *targetPlayer = target->asPlayerObject(); @@ -3260,13 +3260,13 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const // get the attacker Object * obj = NetworkIdManager::getObjectById(msg.getSource()); - if (obj != NULL && obj->asServerObject() != NULL && obj->asServerObject()->asCreatureObject() != NULL) + if (obj != nullptr && obj->asServerObject() != nullptr && obj->asServerObject()->asCreatureObject() != nullptr) { CreatureObject * attacker = obj->asServerObject()->asCreatureObject(); // get the target obj = NetworkIdManager::getObjectById(msg.getTarget()); - if (obj != NULL && obj->asServerObject() != NULL && obj->asServerObject()->asTangibleObject() != NULL) + if (obj != nullptr && obj->asServerObject() != nullptr && obj->asServerObject()->asTangibleObject() != nullptr) { TangibleObject * defender = obj->asServerObject()->asTangibleObject(); if (attacker->isAuthoritative()) @@ -3597,7 +3597,7 @@ bool GameServer::isPlanetEnabledForCluster(std::string const &sceneName) const void GameServerNamespace::broadCastHyperspaceOnWarp(ServerObject const * const owner) { - // warpingClient can be NULL if the owner is AI + // warpingClient can be nullptr if the owner is AI Client const * const warpingClient = owner->getClient(); typedef std::map > DistributionList; @@ -4098,13 +4098,13 @@ void GameServer::sendToConnectionServers(GameNetworkMessage const &message) void GameServer::sendToCustomerServiceServer(GameNetworkMessage const &message) { - if (m_customerServiceServerConnection != NULL) + if (m_customerServiceServerConnection != nullptr) { m_customerServiceServerConnection->send(message, true); } else { - REPORT_LOG(true, ("GameServer::sendToCustomerServiceServer() ERROR: Unable to send to NULL customer service server connection\n")); + REPORT_LOG(true, ("GameServer::sendToCustomerServiceServer() ERROR: Unable to send to nullptr customer service server connection\n")); } } @@ -4112,12 +4112,12 @@ void GameServer::sendToCustomerServiceServer(GameNetworkMessage const &message) void GameServer::clearCustomerServiceServerConnection() { - if (m_customerServiceServerConnection != NULL) + if (m_customerServiceServerConnection != nullptr) { m_customerServiceServerConnection->disconnect(); } - m_customerServiceServerConnection = NULL; + m_customerServiceServerConnection = nullptr; } // ---------------------------------------------------------------------- @@ -4600,7 +4600,7 @@ void GameServer::handleCharacterCreateNameVerification(const VerifyNameResponse { Container::ContainedItem itemId = container->getObjectInSlot(slot, tmp); Object* appearanceInventory = itemId.getObject(); - if(appearanceInventory == NULL) + if(appearanceInventory == nullptr) { WARNING(true, ("Player %s has lost their appearance inventory", newCharacterObject->getNetworkId().getValueString().c_str())); appearanceInventory = ServerWorld::createNewObject(s_appearanceTemplate, *newCharacterObject, slot, false); @@ -4663,7 +4663,7 @@ void GameServer::handleVerifyAndLockNameVerification(const VerifyNameResponse &v params.addParam(errorText.c_str(), "reason"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(vrn.getCharacterId(), "renameCharacterNameValidationFail", dictionary->getSerializedData(), 0, false); @@ -4943,7 +4943,7 @@ bool GameServer::addPendingLoadRequest(NetworkId const & id) if (s_pendingLoadRequests.find(id) != s_pendingLoadRequests.end()) return false; - s_pendingLoadRequests[id] = (unsigned int)::time(NULL); + s_pendingLoadRequests[id] = (unsigned int)::time(nullptr); return true; } @@ -5113,11 +5113,11 @@ void GameServerNamespace::loadRetroactiveCtsHistory() { int index = 0; - char const * pszCtsDataFromConfig = NULL; + char const * pszCtsDataFromConfig = nullptr; do { - pszCtsDataFromConfig = ConfigFile::getKeyString("GameServer", "retroactiveCtsHistory", index++, NULL); - if (pszCtsDataFromConfig != NULL) + pszCtsDataFromConfig = ConfigFile::getKeyString("GameServer", "retroactiveCtsHistory", index++, nullptr); + if (pszCtsDataFromConfig != nullptr) { ctsDataFromConfig.push_back(pszCtsDataFromConfig); } @@ -5196,7 +5196,7 @@ void GameServerNamespace::loadRetroactiveCtsHistory() else { ctsDataFromConfigTokens.clear(); - if ((Unicode::tokenize(Unicode::narrowToWide(*iterCtsDataFromConfig), ctsDataFromConfigTokens, &ctsDataFromConfigDelimiter, NULL)) && (ctsDataFromConfigTokens.size() == 7)) + if ((Unicode::tokenize(Unicode::narrowToWide(*iterCtsDataFromConfig), ctsDataFromConfigTokens, &ctsDataFromConfigDelimiter, nullptr)) && (ctsDataFromConfigTokens.size() == 7)) { // sanity check ctsDataFromConfigParsedData = FormattedString<2048>().sprintf("%s|%s|%s|%s|%s|%s|%s", Unicode::wideToNarrow(ctsDataFromConfigTokens[0]).c_str(), Unicode::wideToNarrow(ctsDataFromConfigTokens[1]).c_str(), Unicode::wideToNarrow(ctsDataFromConfigTokens[2]).c_str(), Unicode::wideToNarrow(ctsDataFromConfigTokens[3]).c_str(), Unicode::wideToNarrow(ctsDataFromConfigTokens[4]).c_str(), Unicode::wideToNarrow(ctsDataFromConfigTokens[5]).c_str(), Unicode::wideToNarrow(ctsDataFromConfigTokens[6]).c_str()); @@ -5225,7 +5225,7 @@ void GameServerNamespace::loadRetroactiveCtsHistory() FATAL(((sourceCharacterInfo.sourceCharacterBornDate > 0) && (sourceCharacterInfo.sourceCharacterBornDate < 907)), ("source character (%s, %s) has born date (%d) < 907", sourceCharacterInfo.sourceCluster.c_str(), sourceCharacterInfo.sourceCharacterId.getValueString().c_str(), sourceCharacterInfo.sourceCharacterBornDate)); FATAL((sourceCharacterInfo.sourceCharacterBornDate > currentBornDate), ("source character (%s, %s) has born date (%d) > current born date (%d)", sourceCharacterInfo.sourceCluster.c_str(), sourceCharacterInfo.sourceCharacterId.getValueString().c_str(), sourceCharacterInfo.sourceCharacterBornDate, currentBornDate)); - std::map > * clusterCtsHistory = NULL; + std::map > * clusterCtsHistory = nullptr; #ifdef _DEBUG IGNORE_RETURN(allCtsSourceCluster.insert(sourceCharacterInfo.sourceCluster)); clusterCtsHistory = &(s_retroactiveCtsHistoryList[targetCluster]); @@ -5381,11 +5381,11 @@ void GameServerNamespace::loadRetroactivePlayerCityCreationTime() { int index = 0; - char const * pszPlayerCityCreationTimeDataFromConfig = NULL; + char const * pszPlayerCityCreationTimeDataFromConfig = nullptr; do { - pszPlayerCityCreationTimeDataFromConfig = ConfigFile::getKeyString("GameServer", "retroactivePlayerCityCreationTime", index++, NULL); - if (pszPlayerCityCreationTimeDataFromConfig != NULL) + pszPlayerCityCreationTimeDataFromConfig = ConfigFile::getKeyString("GameServer", "retroactivePlayerCityCreationTime", index++, nullptr); + if (pszPlayerCityCreationTimeDataFromConfig != nullptr) { playerCityCreationTimeDataFromConfig.push_back(pszPlayerCityCreationTimeDataFromConfig); } @@ -5427,7 +5427,7 @@ void GameServerNamespace::loadRetroactivePlayerCityCreationTime() else { playerCityCreationTimeDataFromConfigTokens.clear(); - if ((Unicode::tokenize(Unicode::narrowToWide(*iterPlayerCityCreationTimeDataFromConfig), playerCityCreationTimeDataFromConfigTokens, &playerCityCreationTimeDataFromConfigDelimiter, NULL)) && (playerCityCreationTimeDataFromConfigTokens.size() == 3)) + if ((Unicode::tokenize(Unicode::narrowToWide(*iterPlayerCityCreationTimeDataFromConfig), playerCityCreationTimeDataFromConfigTokens, &playerCityCreationTimeDataFromConfigDelimiter, nullptr)) && (playerCityCreationTimeDataFromConfigTokens.size() == 3)) { // sanity check playerCityCreationTimeDataFromConfigParsedData = FormattedString<2048>().sprintf("%s|%s|%s", Unicode::wideToNarrow(playerCityCreationTimeDataFromConfigTokens[0]).c_str(), Unicode::wideToNarrow(playerCityCreationTimeDataFromConfigTokens[1]).c_str(), Unicode::wideToNarrow(playerCityCreationTimeDataFromConfigTokens[2]).c_str()); @@ -5449,7 +5449,7 @@ void GameServerNamespace::loadRetroactivePlayerCityCreationTime() ++iterPlayerCityCreationTimeDataFromConfig; } - std::map * clusterPlayerCityCreationTimeHistory = NULL; + std::map * clusterPlayerCityCreationTimeHistory = nullptr; #ifdef _DEBUG clusterPlayerCityCreationTimeHistory = &(s_retroactivePlayerCityCreationTime[cluster]); #else @@ -5475,7 +5475,7 @@ void GameServerNamespace::loadRetroactivePlayerCityCreationTime() bool GameServerNamespace::checkAndSetOutstandingRequestSceneTransfer(ServerObject & object) { - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); // don't send multiple RequestSceneTransfer message if (object.getObjVars().hasItem(OBJVAR_HAS_OUTSTANDING_REQUEST_SCENE_TRANSFER) && (object.getObjVars().getType(OBJVAR_HAS_OUTSTANDING_REQUEST_SCENE_TRANSFER) == DynamicVariable::INT)) @@ -5846,7 +5846,7 @@ void GameServerNamespace::handleAccountFeatureIdResponse(AccountFeatureIdRespons std::string GameServer::getRetroactiveCtsHistory(std::string const & clusterName, NetworkId const & characterId) { std::string result; - std::map > const * clusterCtsHistory = NULL; + std::map > const * clusterCtsHistory = nullptr; #ifdef _DEBUG std::map > >::const_iterator const iterFindCluster = s_retroactiveCtsHistoryList.find(clusterName); @@ -5901,7 +5901,7 @@ void GameServer::setRetroactiveCtsHistory(CreatureObject & player) if (!playerObject->isAuthoritative()) return; - std::map > const * clusterCtsHistory = NULL; + std::map > const * clusterCtsHistory = nullptr; #ifdef _DEBUG std::map > >::const_iterator const iterFindCluster = s_retroactiveCtsHistoryList.find(GameServer::getInstance().getClusterName()); @@ -5990,7 +5990,7 @@ std::vector > const *> const static std::vector > const *> returnValue; returnValue.clear(); - std::map > const * clusterCtsHistory = NULL; + std::map > const * clusterCtsHistory = nullptr; #ifdef _DEBUG std::map > >::const_iterator const iterFindCluster = s_retroactiveCtsHistoryList.find(GameServer::getInstance().getClusterName()); @@ -6028,7 +6028,7 @@ std::vector > const *> const time_t GameServer::getRetroactivePlayerCityCreationTime(std::string const & clusterName, int cityId) { - std::map const * clusterPlayerCityCreationTimeHistory = NULL; + std::map const * clusterPlayerCityCreationTimeHistory = nullptr; #ifdef _DEBUG std::map >::const_iterator const iterFindCluster = s_retroactivePlayerCityCreationTime.find(clusterName); diff --git a/engine/server/library/serverGame/src/shared/core/GameServer.h b/engine/server/library/serverGame/src/shared/core/GameServer.h index c3036761..2723090a 100755 --- a/engine/server/library/serverGame/src/shared/core/GameServer.h +++ b/engine/server/library/serverGame/src/shared/core/GameServer.h @@ -92,10 +92,10 @@ public: uint32 getProcessId () const; uint32 getPreloadAreaId () const; virtual void receiveMessage (const MessageDispatch::Emitter & source, const MessageDispatch::MessageBase & message); - bool requestSceneWarp (const CachedNetworkId &objectId, const std::string &sceneName, const Vector &newPosition_w, const NetworkId &newContainer, const Vector &newPosition_p, const char * scriptCallback = NULL, bool forceLoadScreen = false); - bool requestSceneWarp (const CachedNetworkId &objectId, const std::string &sceneName, const Vector &newPosition_w, const NetworkId &newBuilding, const std::string &newCellName, const Vector &newPosition_p, const char * scriptCallback = NULL, bool forceLoadScreen = false); - bool requestSceneWarpDelayed (const CachedNetworkId &objectId, const std::string &sceneName, const Vector &newPosition_w, const NetworkId &newContainer, const Vector &newPosition_p, float delayTime, const char * scriptCallback = NULL, bool forceLoadScreen = false); - bool requestSceneWarpDelayed (const CachedNetworkId &objectId, const std::string &sceneName, const Vector &newPosition_w, const NetworkId &newBuilding, const std::string &newCellName, const Vector &newPosition_p, float delayTime, const char * scriptCallback = NULL, bool forceLoadScreen = false); + bool requestSceneWarp (const CachedNetworkId &objectId, const std::string &sceneName, const Vector &newPosition_w, const NetworkId &newContainer, const Vector &newPosition_p, const char * scriptCallback = nullptr, bool forceLoadScreen = false); + bool requestSceneWarp (const CachedNetworkId &objectId, const std::string &sceneName, const Vector &newPosition_w, const NetworkId &newBuilding, const std::string &newCellName, const Vector &newPosition_p, const char * scriptCallback = nullptr, bool forceLoadScreen = false); + bool requestSceneWarpDelayed (const CachedNetworkId &objectId, const std::string &sceneName, const Vector &newPosition_w, const NetworkId &newContainer, const Vector &newPosition_p, float delayTime, const char * scriptCallback = nullptr, bool forceLoadScreen = false); + bool requestSceneWarpDelayed (const CachedNetworkId &objectId, const std::string &sceneName, const Vector &newPosition_w, const NetworkId &newBuilding, const std::string &newCellName, const Vector &newPosition_p, float delayTime, const char * scriptCallback = nullptr, bool forceLoadScreen = false); static void run (); void sendToCentralServer (GameNetworkMessage const &message); diff --git a/engine/server/library/serverGame/src/shared/core/InstantDeleteList.cpp b/engine/server/library/serverGame/src/shared/core/InstantDeleteList.cpp index a96e6cfa..4e645492 100755 --- a/engine/server/library/serverGame/src/shared/core/InstantDeleteList.cpp +++ b/engine/server/library/serverGame/src/shared/core/InstantDeleteList.cpp @@ -20,7 +20,7 @@ // ====================================================================== -InstantDeleteList::ListType *InstantDeleteList::ms_theList = NULL; +InstantDeleteList::ListType *InstantDeleteList::ms_theList = nullptr; // ====================================================================== @@ -47,7 +47,7 @@ void InstantDeleteList::install() void InstantDeleteList::remove() { delete ms_theList; - ms_theList = NULL; + ms_theList = nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/core/LogoutTracker.cpp b/engine/server/library/serverGame/src/shared/core/LogoutTracker.cpp index 77454c88..5d49ac3a 100755 --- a/engine/server/library/serverGame/src/shared/core/LogoutTracker.cpp +++ b/engine/server/library/serverGame/src/shared/core/LogoutTracker.cpp @@ -87,7 +87,7 @@ void LogoutTracker::add(NetworkId const &networkId) } // set the callback - getScheduler().setCallback(handleLogoutCallback, NULL, ConfigServerGame::getUnsafeLogoutTimeMs()); + getScheduler().setCallback(handleLogoutCallback, nullptr, ConfigServerGame::getUnsafeLogoutTimeMs()); } // ---------------------------------------------------------------------- @@ -223,7 +223,7 @@ ServerObject *LogoutTracker::findPendingCharacterSave(const NetworkId &character return obj; } else - return NULL; + return nullptr; } // ====================================================================== diff --git a/engine/server/library/serverGame/src/shared/core/MessageToQueue.cpp b/engine/server/library/serverGame/src/shared/core/MessageToQueue.cpp index 005a6260..847b6ff6 100755 --- a/engine/server/library/serverGame/src/shared/core/MessageToQueue.cpp +++ b/engine/server/library/serverGame/src/shared/core/MessageToQueue.cpp @@ -88,7 +88,7 @@ namespace MessageToQueueNamespace typedef std::set SchedulerItemsType; typedef std::vector FrameMessagesType; - MessageToQueue * ms_instance=NULL; + MessageToQueue * ms_instance=nullptr; LastKnownLocationsType ms_lastKnownLocations; ObjectLocatorsType ms_objectLocators; SchedulerItemsType ms_schedulerItems; @@ -134,7 +134,7 @@ void MessageToQueue::install() void MessageToQueue::remove() { delete ms_instance; - ms_instance = NULL; + ms_instance = nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/core/NameManager.cpp b/engine/server/library/serverGame/src/shared/core/NameManager.cpp index 6366130f..65453d39 100755 --- a/engine/server/library/serverGame/src/shared/core/NameManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/NameManager.cpp @@ -27,7 +27,7 @@ // ====================================================================== -NameManager *NameManager::ms_instance = NULL; +NameManager *NameManager::ms_instance = nullptr; // ====================================================================== @@ -45,14 +45,14 @@ void NameManager::remove() { NOT_NULL(ms_instance); delete ms_instance; - ms_instance = NULL; + ms_instance = nullptr; } // ---------------------------------------------------------------------- NameManager::NameManager() : m_nameGenerators (new NameGeneratorMapType), - m_reservedNames (NULL), + m_reservedNames (nullptr), m_nameToIdMap (new NameToIdMapType), m_idToCharacterDataMap(new IdToCharacterDataMapType) { @@ -72,20 +72,20 @@ NameManager::~NameManager() delete i->second; } delete m_nameGenerators; - m_nameGenerators = NULL; + m_nameGenerators = nullptr; delete m_reservedNames; - m_reservedNames = NULL; + m_reservedNames = nullptr; delete m_nameToIdMap; - m_nameToIdMap = NULL; + m_nameToIdMap = nullptr; delete m_idToCharacterDataMap; - m_idToCharacterDataMap = NULL; + m_idToCharacterDataMap = nullptr; } // ---------------------------------------------------------------------- const NameGenerator & NameManager::getNameGenerator(const std::string &directory, const std::string &nameTable) const { - NameGenerator *generator=NULL; + NameGenerator *generator=nullptr; NOT_NULL(m_nameGenerators); NameGeneratorMapType::const_iterator i=m_nameGenerators->find(NameTableIdentifier(directory,nameTable)); if (i==m_nameGenerators->end()) @@ -204,7 +204,7 @@ void NameManager::addPlayer(const NetworkId &id, uint32 stationId, const std::st { createTime = static_cast(getPlayerCreateTime(id)); if (createTime <= 0) - createTime = ::time(NULL); + createTime = ::time(nullptr); } characterData.createTime = createTime; @@ -212,7 +212,7 @@ void NameManager::addPlayer(const NetworkId &id, uint32 stationId, const std::st { lastLoginTime = static_cast(getPlayerLastLoginTime(id)); if (lastLoginTime <= 0) - lastLoginTime = ::time(NULL); + lastLoginTime = ::time(nullptr); } characterData.lastLoginTime = lastLoginTime; @@ -382,7 +382,7 @@ void NameManager::getPlayerWithLastLoginTimeAfterDistribution(std::map >::iterator iter = result.begin(); iter != result.end(); ++iter) iter->second.second = 0; - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); for (IdToCharacterDataMapType::const_iterator i = m_idToCharacterDataMap->begin(); i != m_idToCharacterDataMap->end(); ++i) { int const lastLoginTimeSecondsAgo = std::max(static_cast(0), static_cast(timeNow - static_cast(i->second.lastLoginTime))); @@ -439,7 +439,7 @@ void NameManager::getPlayerWithCreateTimeAfterDistribution(std::map >::iterator iter = result.begin(); iter != result.end(); ++iter) iter->second.second = 0; - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); for (IdToCharacterDataMapType::const_iterator i = m_idToCharacterDataMap->begin(); i != m_idToCharacterDataMap->end(); ++i) { int const createTimeSecondsAgo = std::max(static_cast(0), static_cast(timeNow - static_cast(i->second.createTime))); diff --git a/engine/server/library/serverGame/src/shared/core/NewbieTutorial.cpp b/engine/server/library/serverGame/src/shared/core/NewbieTutorial.cpp index 4388ad2a..98fdebc8 100755 --- a/engine/server/library/serverGame/src/shared/core/NewbieTutorial.cpp +++ b/engine/server/library/serverGame/src/shared/core/NewbieTutorial.cpp @@ -257,10 +257,10 @@ void NewbieTutorial::getNonFreeObjectsForDeletion(const Container* const contain { const CachedNetworkId & itemId = *i; ServerObject * item = safe_cast(itemId.getObject()); - if (item != NULL) + if (item != nullptr) { TangibleObject *itemTangible = item->asTangibleObject(); - if (itemTangible != NULL) + if (itemTangible != nullptr) { const char *templateName = itemTangible->getSharedTemplateName(); if (!FileManifest::contains(templateName)) @@ -273,7 +273,7 @@ void NewbieTutorial::getNonFreeObjectsForDeletion(const Container* const contain { // see if the item is a container and go through its contents const Container * const itemContainer = ContainerInterface::getContainer(*item); - if (itemContainer != NULL) + if (itemContainer != nullptr) getNonFreeObjectsForDeletion(itemContainer, objectsToDelete, character); } } diff --git a/engine/server/library/serverGame/src/shared/core/NpcConversation.cpp b/engine/server/library/serverGame/src/shared/core/NpcConversation.cpp index bc457bbd..e3c56b3e 100755 --- a/engine/server/library/serverGame/src/shared/core/NpcConversation.cpp +++ b/engine/server/library/serverGame/src/shared/core/NpcConversation.cpp @@ -81,7 +81,7 @@ NpcConversation::NpcConversation(TangibleObject & player, TangibleObject & npc, NpcConversation::~NpcConversation() { TangibleObject * const player = safe_cast(m_player.getObject()); - if (player != NULL) + if (player != nullptr) { MessageQueueStopNpcConversation * const message = new MessageQueueStopNpcConversation; @@ -110,13 +110,13 @@ void NpcConversation::sendMessage(const Response & npcMessage, const Unicode::St TangibleObject * const player = safe_cast(m_player.getObject()); TangibleObject * const npc = safe_cast(m_npc.getObject()); - if (player == NULL) + if (player == nullptr) { - if (npc != NULL) + if (npc != nullptr) npc->removeConversation(m_player); return; } - if (npc == NULL) + if (npc == nullptr) { player->endNpcConversation(); return; @@ -216,13 +216,13 @@ void NpcConversation::sendResponses() const int count = static_cast(m_responses->size()); - if (player == NULL) + if (player == nullptr) { - if (npc != NULL) + if (npc != nullptr) npc->removeConversation(m_player); return; } - if (npc == NULL) + if (npc == nullptr) { player->endNpcConversation(); return; diff --git a/engine/server/library/serverGame/src/shared/core/ObserveTracker.cpp b/engine/server/library/serverGame/src/shared/core/ObserveTracker.cpp index 78fe2d74..95bc6594 100755 --- a/engine/server/library/serverGame/src/shared/core/ObserveTracker.cpp +++ b/engine/server/library/serverGame/src/shared/core/ObserveTracker.cpp @@ -353,14 +353,14 @@ void ObserveTracker::onObjectContainerChanged(ServerObject &obj) bool isObservedWith = (newContainer->getContainerProperty() ? newContainer->getContainerProperty()->isContentItemObservedWith(obj) : false); CellProperty * newContainerCell = newContainer->getCellProperty(); ServerObject const * newContainerContainer = safe_cast(ContainerInterface::getContainedByObject(*newContainer)); - if (newContainerCell == NULL || newContainerContainer != NULL) + if (newContainerCell == nullptr || newContainerContainer != nullptr) { std::set const &newObservers = newContainer->getObservers(); for (std::set::const_iterator i = newObservers.begin(); i != newObservers.end(); ++i) { if (isObservedWith || (*i)->getOpenedContainers().count(newContainer) || - (newContainerCell != NULL && shouldObserveCellContentsDueToClientContainmentChain(**i, *newContainerContainer))) + (newContainerCell != nullptr && shouldObserveCellContentsDueToClientContainmentChain(**i, *newContainerContainer))) { IGNORE_RETURN(observe(**i, obj)); } diff --git a/engine/server/library/serverGame/src/shared/core/PlayerCreationManagerServer.cpp b/engine/server/library/serverGame/src/shared/core/PlayerCreationManagerServer.cpp index 9b2d5d2e..62cc2fb3 100755 --- a/engine/server/library/serverGame/src/shared/core/PlayerCreationManagerServer.cpp +++ b/engine/server/library/serverGame/src/shared/core/PlayerCreationManagerServer.cpp @@ -122,7 +122,7 @@ bool PlayerCreationManagerServer::setupPlayer(CreatureObject & obj, const std::s else { //Attach insurance variables here: - if (item->asTangibleObject() != NULL) + if (item->asTangibleObject() != nullptr) item->asTangibleObject()->setUninsurable(true); } } @@ -204,7 +204,7 @@ bool PlayerCreationManagerServer::setupPlayer(CreatureObject & obj, const std::s for (size_t i = 0; i < numSkills; ++i) { const SkillObject * skill = SkillManager::getInstance().getSkill(bounty_skills[i]); - if (skill != NULL) + if (skill != nullptr) obj.grantSkill(*skill); } } diff --git a/engine/server/library/serverGame/src/shared/core/PositionUpdateTracker.cpp b/engine/server/library/serverGame/src/shared/core/PositionUpdateTracker.cpp index 5d95b59b..a28ee96b 100755 --- a/engine/server/library/serverGame/src/shared/core/PositionUpdateTracker.cpp +++ b/engine/server/library/serverGame/src/shared/core/PositionUpdateTracker.cpp @@ -122,7 +122,7 @@ bool PositionUpdateTracker::shouldSendPositionUpdate(ServerObject const &obj) return false; ServerObject const *containedByObj = safe_cast(ContainerInterface::getContainedByObject(obj)); - CreatureObject const *creatureContainer = (containedByObj ? containedByObj->asCreatureObject() : NULL); + CreatureObject const *creatureContainer = (containedByObj ? containedByObj->asCreatureObject() : nullptr); bool const objectIsRidingMount = (creatureContainer && creatureContainer->isMountable()); if (containedByObj && !isContainerConsideredPersisted(obj, *containedByObj) && !objectIsRidingMount) @@ -204,7 +204,7 @@ void PositionUpdateTracker::sendPositionUpdate(ServerObject &obj) else { ServerObject const * const container = safe_cast(ContainerInterface::getContainedByObject(obj)); - CreatureObject const * const creatureContainer = (container ? container->asCreatureObject() : NULL); + CreatureObject const * const creatureContainer = (container ? container->asCreatureObject() : nullptr); if (creatureContainer && creatureContainer->isMountable()) { // Riders of mounts persist at the location of the mount diff --git a/engine/server/library/serverGame/src/shared/core/RegexList.cpp b/engine/server/library/serverGame/src/shared/core/RegexList.cpp index 5244818e..29c7ae32 100755 --- a/engine/server/library/serverGame/src/shared/core/RegexList.cpp +++ b/engine/server/library/serverGame/src/shared/core/RegexList.cpp @@ -55,7 +55,7 @@ RegexList::Entry::Entry(char const *pattern, bool matchWords, char const *reason char const *errorString = 0; int errorOffset = 0; - m_pcre = pcre_compile(pattern, 0, &errorString, &errorOffset, NULL); + m_pcre = pcre_compile(pattern, 0, &errorString, &errorOffset, nullptr); WARNING(!m_pcre, ("failed to compile regex pattern [%s] into a pcre regex.", pattern)); } @@ -175,7 +175,7 @@ bool RegexList::doesStringMatch(const Unicode::String &name, std::string &ruleDe std::vector::iterator nameIter; for (nameIter = names.begin(); nameIter != names.end(); ++nameIter) { - int const returnCode = pcre_exec(compiledRegex, NULL, nameIter->c_str(), nameIter->length(), 0, 0, captureData, dataElementCount); + int const returnCode = pcre_exec(compiledRegex, nullptr, nameIter->c_str(), nameIter->length(), 0, 0, captureData, dataElementCount); if (returnCode >= 0) { ruleDescription = entry->getReason(); @@ -187,7 +187,7 @@ bool RegexList::doesStringMatch(const Unicode::String &name, std::string &ruleDe } else { - int const returnCode = pcre_exec(compiledRegex, NULL, testName.c_str(), testName.length(), 0, 0, captureData, dataElementCount); + int const returnCode = pcre_exec(compiledRegex, nullptr, testName.c_str(), testName.length(), 0, 0, captureData, dataElementCount); if (returnCode >= 0) { ruleDescription = entry->getReason(); diff --git a/engine/server/library/serverGame/src/shared/core/ReportManager.cpp b/engine/server/library/serverGame/src/shared/core/ReportManager.cpp index 4bac637e..b73e89ff 100755 --- a/engine/server/library/serverGame/src/shared/core/ReportManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/ReportManager.cpp @@ -247,7 +247,7 @@ void ReportManager::handleMessage(ChatOnRequestLog const &chatOnRequestLog) CreatureObject * const reportingCreatureObject = CreatureObject::asCreatureObject(NetworkIdManager::getObjectById(reportData.m_reportingNetworkId)); PlayerObject * const reportingPlayerObject = PlayerCreatureController::getPlayerObject(reportingCreatureObject); - if (reportingPlayerObject != NULL) + if (reportingPlayerObject != nullptr) { // Make sure the chat log does not have any extra data in it @@ -297,7 +297,7 @@ void ReportManager::handleMessage(ChatOnRequestLog const &chatOnRequestLog) } if ( !foundHarassingPlayer - && (reportingCreatureObject != NULL)) + && (reportingCreatureObject != nullptr)) { // No harassing player match @@ -345,7 +345,7 @@ void ReportManager::handleMessage(ChatOnRequestLog const &chatOnRequestLog) target.str = reportData.m_harassingName; prosePackage.target = target; - if (reportingCreatureObject != NULL) + if (reportingCreatureObject != nullptr) { Chat::sendSystemMessage(*reportingCreatureObject, prosePackage); } diff --git a/engine/server/library/serverGame/src/shared/core/SceneGlobalData.cpp b/engine/server/library/serverGame/src/shared/core/SceneGlobalData.cpp index 5a7c12b8..5c25017b 100755 --- a/engine/server/library/serverGame/src/shared/core/SceneGlobalData.cpp +++ b/engine/server/library/serverGame/src/shared/core/SceneGlobalData.cpp @@ -113,7 +113,7 @@ SceneData * SceneGlobalDataNamespace::getSceneDataByName(std::string const & sce if (i!=ms_SceneDataItems.end()) return i->second; else - return NULL; + return nullptr; } // ====================================================================== diff --git a/engine/server/library/serverGame/src/shared/core/ServerBuffBuilderManager.cpp b/engine/server/library/serverGame/src/shared/core/ServerBuffBuilderManager.cpp index 829055b8..fcf18e02 100755 --- a/engine/server/library/serverGame/src/shared/core/ServerBuffBuilderManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/ServerBuffBuilderManager.cpp @@ -58,7 +58,7 @@ void ServerBuffBuilderManager::remove() ms_installed = false; delete ms_callback; - ms_callback = NULL; + ms_callback = nullptr; } //----------------------------------------------------------------------------- @@ -73,12 +73,12 @@ bool ServerBuffBuilderManager::makeChanges(SharedBuffBuilderManager::Session con NetworkId const & recipientId = session.recipientId; Object * const recipientObj = NetworkIdManager::getObjectById(recipientId); - ServerObject * const recipientServerObj = recipientObj ? recipientObj->asServerObject() : NULL; - CreatureObject * const recipient = recipientServerObj ? recipientServerObj->asCreatureObject() : NULL; + ServerObject * const recipientServerObj = recipientObj ? recipientObj->asServerObject() : nullptr; + CreatureObject * const recipient = recipientServerObj ? recipientServerObj->asCreatureObject() : nullptr; NetworkId const & bufferId = session.bufferId; Object * const bufferObj = NetworkIdManager::getObjectById(bufferId); - ServerObject * const bufferServerObj = bufferObj ? bufferObj->asServerObject() : NULL; - CreatureObject * const buffer = bufferServerObj ? bufferServerObj->asCreatureObject() : NULL; + ServerObject * const bufferServerObj = bufferObj ? bufferObj->asServerObject() : nullptr; + CreatureObject * const buffer = bufferServerObj ? bufferServerObj->asCreatureObject() : nullptr; if(buffer && recipient) { sendSessionToScript(session, session.bufferId, static_cast(Scripting::TRIG_BUFF_BUILDER_COMPLETED)); @@ -93,11 +93,11 @@ void ServerBuffBuilderManager::sendSessionToScriptForValidation(SharedBuffBuilde NetworkId const & bufferId = session.bufferId; NetworkId const & recipientId = session.recipientId; Object const * const bufferObj = NetworkIdManager::getObjectById(bufferId); - ServerObject const * const bufferServer = bufferObj ? bufferObj->asServerObject() : NULL; - CreatureObject const * const buffer = bufferServer ? bufferServer->asCreatureObject() : NULL; + ServerObject const * const bufferServer = bufferObj ? bufferObj->asServerObject() : nullptr; + CreatureObject const * const buffer = bufferServer ? bufferServer->asCreatureObject() : nullptr; Object * const recipientObj = NetworkIdManager::getObjectById(recipientId); - ServerObject * const recipientServer = recipientObj ? recipientObj->asServerObject() : NULL; - CreatureObject * const recipient = recipientServer ? recipientServer->asCreatureObject() : NULL; + ServerObject * const recipientServer = recipientObj ? recipientObj->asServerObject() : nullptr; + CreatureObject * const recipient = recipientServer ? recipientServer->asCreatureObject() : nullptr; if(buffer && recipient) { sendSessionToScript(session, session.bufferId, static_cast(Scripting::TRIG_BUFF_BUILDER_VALIDATE)); @@ -109,7 +109,7 @@ void ServerBuffBuilderManager::sendSessionToScriptForValidation(SharedBuffBuilde void ServerBuffBuilderManager::sendSessionToScript(SharedBuffBuilderManager::Session const & session, NetworkId const & objectToTriggerId, int const trigger) { Object * const objectToTrigger = NetworkIdManager::getObjectById(objectToTriggerId); - ServerObject * const serverObjectToTrigger = objectToTrigger ? objectToTrigger->asServerObject() : NULL; + ServerObject * const serverObjectToTrigger = objectToTrigger ? objectToTrigger->asServerObject() : nullptr; if(serverObjectToTrigger) { GameScriptObject * const scriptObject = serverObjectToTrigger->getScriptObject(); @@ -144,7 +144,7 @@ void ServerBuffBuilderManager::cancelSession(NetworkId const & bufferId, Network { //send the cancel message to the buffer Object * const bufferObject = NetworkIdManager::getObjectById(bufferId); - Controller * const bufferController = bufferObject ? bufferObject->getController() : NULL; + Controller * const bufferController = bufferObject ? bufferObject->getController() : nullptr; if(bufferController) { BuffBuilderChangeMessage * outMsg = new BuffBuilderChangeMessage(); @@ -157,7 +157,7 @@ void ServerBuffBuilderManager::cancelSession(NetworkId const & bufferId, Network //send the cancel message to the recipient Object * const recipientObject = NetworkIdManager::getObjectById(recipientId); - Controller * const recipientController = recipientObject ? recipientObject->getController() : NULL; + Controller * const recipientController = recipientObject ? recipientObject->getController() : nullptr; if(recipientController && bufferController != recipientController) { BuffBuilderChangeMessage * outMsg = new BuffBuilderChangeMessage(); @@ -169,7 +169,7 @@ void ServerBuffBuilderManager::cancelSession(NetworkId const & bufferId, Network } //send cancel trigger to buffer player - ServerObject * const bufferServerObject = bufferObject ? bufferObject->asServerObject() : NULL; + ServerObject * const bufferServerObject = bufferObject ? bufferObject->asServerObject() : nullptr; if(bufferServerObject) { GameScriptObject * const scriptObject = bufferServerObject->getScriptObject(); @@ -181,7 +181,7 @@ void ServerBuffBuilderManager::cancelSession(NetworkId const & bufferId, Network } //send cancel trigger to recipient player - ServerObject * const recipientServerObject = recipientObject ? recipientObject->asServerObject() : NULL; + ServerObject * const recipientServerObject = recipientObject ? recipientObject->asServerObject() : nullptr; if(recipientServerObject && recipientServerObject != bufferServerObject) { GameScriptObject * const scriptObject = recipientServerObject->getScriptObject(); diff --git a/engine/server/library/serverGame/src/shared/core/ServerBuildoutManager.cpp b/engine/server/library/serverGame/src/shared/core/ServerBuildoutManager.cpp index f371ee83..e38943e1 100755 --- a/engine/server/library/serverGame/src/shared/core/ServerBuildoutManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/ServerBuildoutManager.cpp @@ -81,8 +81,8 @@ namespace ServerBuildoutManagerNamespace struct ServerEventAreaInfo { ServerEventAreaInfo(): - buildOut(NULL), - loadedObject(NULL) + buildOut(nullptr), + loadedObject(nullptr) { } @@ -892,7 +892,7 @@ void ServerBuildoutManagerNamespace::instantiateAreaNode(AreaInfo const &areaInf ServerEventMap::iterator searchIter = s_eventObjects.find(buildoutRow.m_eventRequired); if(searchIter != s_eventObjects.end()) { - ServerEventAreaInfo newEventObj(&buildoutRow, NULL); + ServerEventAreaInfo newEventObj(&buildoutRow, nullptr); (*searchIter).second.push_back(newEventObj); } else @@ -947,7 +947,7 @@ void ServerBuildoutManagerNamespace::instantiateAreaNode(AreaInfo const &areaInf newObject->setAuthority(); - if (newObject->asTangibleObject() != NULL) + if (newObject->asTangibleObject() != nullptr) newObject->asTangibleObject()->initializeVisibility(); // @@ -1033,7 +1033,7 @@ void ServerBuildoutManagerNamespace::instantiateAreaNode(AreaInfo const &areaInf { GameScriptObject * const gso = newObject->getScriptObject(); - if (NULL != gso) + if (nullptr != gso) { std::string const &scripts = buildoutRow.m_scripts; unsigned int pos = 0; @@ -1077,7 +1077,7 @@ void ServerBuildoutManagerNamespace::instantiateAreaNode(AreaInfo const &areaInf if ( controllerObjectId.isValid() ) { ServerObject * const controllerObject = safe_cast(NetworkIdManager::getObjectById(controllerObjectId)); - if (NULL != controllerObject) + if (nullptr != controllerObject) { GameScriptObject * const script = controllerObject->getScriptObject(); @@ -1092,7 +1092,7 @@ void ServerBuildoutManagerNamespace::instantiateAreaNode(AreaInfo const &areaInf { if (registerWithController) { - if (NULL != script) + if (nullptr != script) { ScriptParams p; p.addParam(obj->getNetworkId()); @@ -1279,7 +1279,7 @@ void ServerBuildoutManager::onEventStarted(std::string const & eventName) newObject->setAuthority(); - if (newObject->asTangibleObject() != NULL) + if (newObject->asTangibleObject() != nullptr) newObject->asTangibleObject()->initializeVisibility(); // @@ -1369,7 +1369,7 @@ void ServerBuildoutManager::onEventStarted(std::string const & eventName) { GameScriptObject * const gso = newObject->getScriptObject(); - if (NULL != gso) + if (nullptr != gso) { std::string const &scripts = buildoutRow.m_scripts; unsigned int pos = 0; @@ -1407,7 +1407,7 @@ void ServerBuildoutManager::onEventStarted(std::string const & eventName) if ( controllerObjectId.isValid() ) { ServerObject * const controllerObject = safe_cast(NetworkIdManager::getObjectById(controllerObjectId)); - if (NULL != controllerObject) + if (nullptr != controllerObject) { GameScriptObject * const script = controllerObject->getScriptObject(); @@ -1422,7 +1422,7 @@ void ServerBuildoutManager::onEventStarted(std::string const & eventName) { if (registerWithController) { - if (NULL != script) + if (nullptr != script) { ScriptParams p; p.addParam(obj->getNetworkId()); @@ -1483,7 +1483,7 @@ void ServerBuildoutManager::onEventStopped(std::string const & eventName) object->unload(); - (*objIter).loadedObject = NULL; + (*objIter).loadedObject = nullptr; } } } diff --git a/engine/server/library/serverGame/src/shared/core/ServerImageDesignerManager.cpp b/engine/server/library/serverGame/src/shared/core/ServerImageDesignerManager.cpp index fe976e69..2fd9b849 100755 --- a/engine/server/library/serverGame/src/shared/core/ServerImageDesignerManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/ServerImageDesignerManager.cpp @@ -56,8 +56,8 @@ namespace ServerImageDesignerManagerNamespace { NetworkId const & nid = payload.first; Object * const o = NetworkIdManager::getObjectById(nid); - ServerObject * const so = o ? o->asServerObject() : NULL; - CreatureObject * const creature = so ? so->asCreatureObject() : NULL; + ServerObject * const so = o ? o->asServerObject() : nullptr; + CreatureObject * const creature = so ? so->asCreatureObject() : nullptr; if (creature) { ObjectTemplate const * const tmp = creature->getSharedTemplate(); @@ -157,7 +157,7 @@ void ServerImageDesignerManager::remove() ms_genderSpeciesToAllowBald.clear(); delete ms_callback; - ms_callback = NULL; + ms_callback = nullptr; } //----------------------------------------------------------------------------- @@ -172,12 +172,12 @@ bool ServerImageDesignerManager::makeChanges(SharedImageDesignerManager::Session NetworkId const & recipientId = session.recipientId; Object * const recipientObj = NetworkIdManager::getObjectById(recipientId); - ServerObject * const recipientServerObj = recipientObj ? recipientObj->asServerObject() : NULL; - CreatureObject * const recipient = recipientServerObj ? recipientServerObj->asCreatureObject() : NULL; + ServerObject * const recipientServerObj = recipientObj ? recipientObj->asServerObject() : nullptr; + CreatureObject * const recipient = recipientServerObj ? recipientServerObj->asCreatureObject() : nullptr; NetworkId const & designerId = session.designerId; Object * const designerObj = NetworkIdManager::getObjectById(designerId); - ServerObject * const designerServerObj = designerObj ? designerObj->asServerObject() : NULL; - CreatureObject * const designer = designerServerObj ? designerServerObj->asCreatureObject() : NULL; + ServerObject * const designerServerObj = designerObj ? designerObj->asServerObject() : nullptr; + CreatureObject * const designer = designerServerObj ? designerServerObj->asCreatureObject() : nullptr; if(designer && recipient) { @@ -332,8 +332,8 @@ bool ServerImageDesignerManager::makeChanges(SharedImageDesignerManager::Session SlotId const slot = SlotIdManager::findSlotId (ConstCharCrcLowerString (cms_hairSlotName)); Container::ContainerErrorCode tmp = Container::CEC_Success; Object * const originalHairObject = slotted->getObjectInSlot(slot, tmp).getObject(); - ServerObject * const originalHairServerObject = originalHairObject ? originalHairObject->asServerObject() : NULL; - TangibleObject * const orignalHair = originalHairServerObject ? originalHairServerObject->asTangibleObject() : NULL; + ServerObject * const originalHairServerObject = originalHairObject ? originalHairObject->asServerObject() : nullptr; + TangibleObject * const orignalHair = originalHairServerObject ? originalHairServerObject->asTangibleObject() : nullptr; std::string originalHairCustomizationData; if(orignalHair) { @@ -434,8 +434,8 @@ SharedImageDesignerManager::SkillMods ServerImageDesignerManager::getSkillModsFo } Object const * const o = NetworkIdManager::getObjectById(designerId); - ServerObject const * const so = o ? o->asServerObject() : NULL; - CreatureObject const * const designer = so ? so->asCreatureObject() : NULL; + ServerObject const * const so = o ? o->asServerObject() : nullptr; + CreatureObject const * const designer = so ? so->asCreatureObject() : nullptr; if(designer) { skillMods.bodySkillMod = designer->getModValue(SharedImageDesignerManager::cms_bodySkillModName); @@ -466,7 +466,7 @@ void ServerImageDesignerManager::updateGradualCustomizations(CreatureObject * ta //do this one immediately SlotId const slot = SlotIdManager::findSlotId (ConstCharCrcLowerString (cms_hairCustomizationName.c_str())); ServerObject * const hair = ServerWorld::createNewObject(i->second.templateName, *target, slot, true); - TangibleObject * const tangibleHair = hair ? hair->asTangibleObject() : NULL; + TangibleObject * const tangibleHair = hair ? hair->asTangibleObject() : nullptr; if(tangibleHair) { //first set hair color to colors from old hair (if any) @@ -503,11 +503,11 @@ void ServerImageDesignerManager::sendSessionToScriptForValidation(SharedImageDes NetworkId const & designerId = session.designerId; NetworkId const & recipientId = session.recipientId; Object const * const designerObj = NetworkIdManager::getObjectById(designerId); - ServerObject const * const designerServer = designerObj ? designerObj->asServerObject() : NULL; - CreatureObject const * const designer = designerServer ? designerServer->asCreatureObject() : NULL; + ServerObject const * const designerServer = designerObj ? designerObj->asServerObject() : nullptr; + CreatureObject const * const designer = designerServer ? designerServer->asCreatureObject() : nullptr; Object * const recipientObj = NetworkIdManager::getObjectById(recipientId); - ServerObject * const recipientServer = recipientObj ? recipientObj->asServerObject() : NULL; - CreatureObject * const recipient = recipientServer ? recipientServer->asCreatureObject() : NULL; + ServerObject * const recipientServer = recipientObj ? recipientObj->asServerObject() : nullptr; + CreatureObject * const recipient = recipientServer ? recipientServer->asCreatureObject() : nullptr; if(designer && recipient) { sendSessionToScript(session, session.designerId, static_cast(Scripting::TRIG_IMAGE_DESIGN_VALIDATE)); @@ -519,7 +519,7 @@ void ServerImageDesignerManager::sendSessionToScriptForValidation(SharedImageDes void ServerImageDesignerManager::sendSessionToScript(SharedImageDesignerManager::Session const & session, NetworkId const & objectToTriggerId, int const trigger) { Object * const objectToTrigger = NetworkIdManager::getObjectById(objectToTriggerId); - ServerObject * const serverObjectToTrigger = objectToTrigger ? objectToTrigger->asServerObject() : NULL; + ServerObject * const serverObjectToTrigger = objectToTrigger ? objectToTrigger->asServerObject() : nullptr; if(serverObjectToTrigger) { GameScriptObject * const scriptObject = serverObjectToTrigger->getScriptObject(); @@ -571,11 +571,11 @@ CustomizationData * ServerImageDesignerManager::fetchCustomizationDataForCustomi if(customization.isVarHairColor) { ServerObject * const hair = creature.getHair(); - TangibleObject * const tangibleHair = hair ? hair->asTangibleObject() : NULL; + TangibleObject * const tangibleHair = hair ? hair->asTangibleObject() : nullptr; if(tangibleHair) objectToQuery = tangibleHair; else - return NULL; + return nullptr; } return objectToQuery->fetchCustomizationData(); } @@ -586,7 +586,7 @@ void ServerImageDesignerManager::cancelSession(NetworkId const & designerId, Net { //send the cancel message to the designer Object * const designerObject = NetworkIdManager::getObjectById(designerId); - Controller * const designerController = designerObject ? designerObject->getController() : NULL; + Controller * const designerController = designerObject ? designerObject->getController() : nullptr; if(designerController) { ImageDesignChangeMessage * outMsg = new ImageDesignChangeMessage(); @@ -599,7 +599,7 @@ void ServerImageDesignerManager::cancelSession(NetworkId const & designerId, Net //send the cancel message to the recipient Object * const recipientObject = NetworkIdManager::getObjectById(recipientId); - Controller * const recipientController = recipientObject ? recipientObject->getController() : NULL; + Controller * const recipientController = recipientObject ? recipientObject->getController() : nullptr; if(recipientController && designerController != recipientController) { ImageDesignChangeMessage * outMsg = new ImageDesignChangeMessage(); @@ -611,7 +611,7 @@ void ServerImageDesignerManager::cancelSession(NetworkId const & designerId, Net } //send cancel trigger to designer player - ServerObject * const designerServerObject = designerObject ? designerObject->asServerObject() : NULL; + ServerObject * const designerServerObject = designerObject ? designerObject->asServerObject() : nullptr; if(designerServerObject) { GameScriptObject * const scriptObject = designerServerObject->getScriptObject(); @@ -623,7 +623,7 @@ void ServerImageDesignerManager::cancelSession(NetworkId const & designerId, Net } //send cancel trigger to recipient player - ServerObject * const recipientServerObject = recipientObject ? recipientObject->asServerObject() : NULL; + ServerObject * const recipientServerObject = recipientObject ? recipientObject->asServerObject() : nullptr; if(recipientServerObject && recipientServerObject != designerServerObject) { GameScriptObject * const scriptObject = recipientServerObject->getScriptObject(); @@ -644,8 +644,8 @@ void ServerImageDesignerManager::cancelSession(NetworkId const & designerId, Net std::map ServerImageDesignerManager::getHairCustomizations(SharedImageDesignerManager::Session const & session) { Object * const o = NetworkIdManager::getObjectById(session.recipientId); - ServerObject * const so = o ? o->asServerObject() : NULL; - CreatureObject * const recipient = so ? so->asCreatureObject() : NULL; + ServerObject * const so = o ? o->asServerObject() : nullptr; + CreatureObject * const recipient = so ? so->asCreatureObject() : nullptr; CustomizationManager::Customization customization; bool result = false; std::map hairCustomizations; diff --git a/engine/server/library/serverGame/src/shared/core/ServerUIManager.cpp b/engine/server/library/serverGame/src/shared/core/ServerUIManager.cpp index f94b1eee..be9ccc62 100755 --- a/engine/server/library/serverGame/src/shared/core/ServerUIManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/ServerUIManager.cpp @@ -105,7 +105,7 @@ int ServerUIManager::createPage(const std::string& pageName, const ServerObject& return pageId; ServerUIPage * const serverUIPage = ServerUIManager::getPage(pageId); - if (serverUIPage != NULL) + if (serverUIPage != nullptr) { serverUIPage->setCallback(callbackFunction); return pageId; @@ -153,7 +153,7 @@ ServerUIPage* ServerUIManager::getPage(int pageId) { std::map::const_iterator iterFind = m_pages.find(pageId); if (iterFind == m_pages.end()) - return NULL; + return nullptr; else return iterFind->second; } @@ -163,7 +163,7 @@ ServerUIPage* ServerUIManager::getPage(int pageId) bool ServerUIManager::showPage(int pageId) { ServerUIPage * const page = getPage(pageId); - if (page != NULL) + if (page != nullptr) return showPage(*page); WARNING(true, ("ServerUIManager::showPage(%d) invalid page", pageId)); @@ -175,14 +175,14 @@ bool ServerUIManager::showPage(int pageId) bool ServerUIManager::showPage(ServerUIPage & page) { Client * const client = page.getClient(); - if (client == NULL) + if (client == nullptr) { -// WARNING(true, ("ServerUIManager::showPage attempt to show page on null client")); +// WARNING(true, ("ServerUIManager::showPage attempt to show page on nullptr client")); return false; } ServerObject const * const characterObject = client->getCharacterObject(); - if (characterObject == NULL) + if (characterObject == nullptr) { WARNING(true, ("ServerUIManager::showPage attempt to show page to client with no character object")); return false; @@ -219,11 +219,11 @@ bool ServerUIManager::closePage(int pageId) { //send close_page message const ServerUIPage * const page = getPage(pageId); - if(page == NULL) + if(page == nullptr) return false; Client * const client = page->getClient(); - if(client == NULL) + if(client == nullptr) return false; SuiForceClosePage msg; @@ -239,7 +239,7 @@ bool ServerUIManager::removePage(int pageId) { //send close_page message const ServerUIPage * const page = getPage(pageId); - if(page == NULL) + if(page == nullptr) return false; NetworkId const & primaryControlledObject = page->getPrimaryControlledObject(); @@ -275,11 +275,11 @@ void ServerUIManager::receiveMessage(const MessageDispatch::MessageBase& message int const pageId = suiEventNotification.getPageId(); ServerUIPage const * const page = getPage(pageId); - if (page == NULL) + if (page == nullptr) return; Client * const client = page->getClient(); - if (client == NULL) + if (client == nullptr) { removePage(pageId); return; @@ -287,9 +287,9 @@ void ServerUIManager::receiveMessage(const MessageDispatch::MessageBase& message ServerObject * const characterObject = client->getCharacterObject(); - if (characterObject == NULL) + if (characterObject == nullptr) { - WARNING(true, ("ServerUIManager::recieveMessage got SuiEventNotification for null character object")); + WARNING(true, ("ServerUIManager::recieveMessage got SuiEventNotification for nullptr character object")); removePage(pageId); return; } @@ -300,15 +300,15 @@ void ServerUIManager::receiveMessage(const MessageDispatch::MessageBase& message ServerObject * const ownerObject = ServerWorld::findObjectByNetworkId(suiPageDataServer.getOwnerId()); - if (ownerObject == NULL) + if (ownerObject == nullptr) { - WARNING(true, ("ServerUIManager::recieveMessage got SuiEventNotification for null owner object")); + WARNING(true, ("ServerUIManager::recieveMessage got SuiEventNotification for nullptr owner object")); removePage(pageId); return; } GameScriptObject * const gso = ownerObject->getScriptObject(); - if (gso == NULL) + if (gso == nullptr) { WARNING(true, ("ServerUIManager::recieveMessage got SuiEventNotification for owner object with no scripts")); removePage(pageId); @@ -318,7 +318,7 @@ void ServerUIManager::receiveMessage(const MessageDispatch::MessageBase& message int const eventIndex = suiEventNotification.getSubscribedEventIndex(); SuiCommand const * const command = suiPageData.findSubscribeToEventCommandByIndex(eventIndex); - if (command == NULL) + if (command == nullptr) { WARNING(true, ("ServerUIManager::recieveMessage got SuiEventNotification invalid notification index [%d]", eventIndex)); return; @@ -385,7 +385,7 @@ void ServerUIManager::receiveMessage(const MessageDispatch::MessageBase& message ScriptDictionaryPtr sd; //it allocates sd, we have to clean it up later gso->makeScriptDictionary(sp, sd); - if(sd.get() == NULL) + if(sd.get() == nullptr) return; //call the script callback function diff --git a/engine/server/library/serverGame/src/shared/core/ServerUIPage.cpp b/engine/server/library/serverGame/src/shared/core/ServerUIPage.cpp index 289f1ada..1fc5e64a 100755 --- a/engine/server/library/serverGame/src/shared/core/ServerUIPage.cpp +++ b/engine/server/library/serverGame/src/shared/core/ServerUIPage.cpp @@ -36,7 +36,7 @@ m_pageDataServer(pageDataServer) ServerUIPage::~ServerUIPage() { delete m_pageDataServer; - m_pageDataServer = NULL; + m_pageDataServer = nullptr; } //----------------------------------------------------------------------- @@ -52,19 +52,19 @@ Client* ServerUIPage::getClient() const if(!object) { WARNING(true, ("ServerUIPage PrimaryControlledObject doesn't exist")); - return NULL; + return nullptr; } ServerObject *const serverObject = object->asServerObject(); if(!serverObject) { WARNING(true, ("ServerUIPage PrimaryControlledObject isn't a server object")); - return NULL; + return nullptr; } Client * const result = serverObject->getClient(); if(!result) { WARNING(true, ("ServerUIPage PrimaryControlledObject has no client yet")); - return NULL; + return nullptr; } return result; } @@ -74,9 +74,9 @@ Client* ServerUIPage::getClient() const ServerObject* ServerUIPage::getOwner() const { Object * const object = NetworkIdManager::getObjectById(getPageDataServer().getOwnerId()); - if (object != NULL) + if (object != nullptr) return object->asServerObject(); - return NULL; + return nullptr; } //----------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/core/ServerUniverse.cpp b/engine/server/library/serverGame/src/shared/core/ServerUniverse.cpp index 9729c039..29f8e60e 100755 --- a/engine/server/library/serverGame/src/shared/core/ServerUniverse.cpp +++ b/engine/server/library/serverGame/src/shared/core/ServerUniverse.cpp @@ -65,15 +65,15 @@ ServerUniverse::ServerUniverse() : m_universeProcess (0), m_nextCheckTimer (static_cast(ConfigServerGame::getUniverseCheckFrequencySeconds())), m_doImmediateCheck (false), - m_thisPlanet (NULL), - m_tatooinePlanet (NULL), + m_thisPlanet (nullptr), + m_tatooinePlanet (nullptr), m_planetNameMap (new PlanetNameMap), m_resourceTypeNameMap (new ResourceTypeNameMap), m_resourceTypeIdMap (new ResourceTypeIdMap), m_importedResourceTypeIdMap(new ResourceTypeIdMap), m_resourcesToSend (new ResourcesToSendType), - m_masterGuildObject (NULL), - m_masterCityObject (NULL), + m_masterGuildObject (nullptr), + m_masterCityObject (nullptr), m_theaterNameIdMap (new TheaterNameIdMap), m_theaterIdNameMap (new TheaterIdNameMap), m_populationList (new PopulationList), @@ -152,7 +152,7 @@ ResourceTypeObject *ServerUniverse::getResourceTypeByName(std::string const & na ResourceTypeObject * ServerUniverse::getResourceTypeById(NetworkId const & id) const { if (id==NetworkId::cms_invalid) - return NULL; + return nullptr; if (id.getValue() <= NetworkId::cms_maxNetworkIdWithoutClusterId) { @@ -160,7 +160,7 @@ ResourceTypeObject * ServerUniverse::getResourceTypeById(NetworkId const & id) c if (i!=m_resourceTypeIdMap->end()) return (*i).second; else - return NULL; + return nullptr; } else { @@ -168,7 +168,7 @@ ResourceTypeObject * ServerUniverse::getResourceTypeById(NetworkId const & id) c if (i!=m_importedResourceTypeIdMap->end()) return (*i).second; else - return NULL; + return nullptr; } } @@ -177,13 +177,13 @@ ResourceTypeObject * ServerUniverse::getResourceTypeById(NetworkId const & id) c ResourceTypeObject * ServerUniverse::getImportedResourceTypeById(NetworkId const & id) const { if (id==NetworkId::cms_invalid) - return NULL; + return nullptr; ResourceTypeIdMap::const_iterator i=m_importedResourceTypeIdMap->find(id); if (i!=m_importedResourceTypeIdMap->end()) return (*i).second; else - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -329,7 +329,7 @@ void ServerUniverse::createProxiesOnServer(std::vector const & remotePro LOG("UniverseLoading", ("Game Server %lu sent UniverseComplete to Game Servers %s.", GameServer::getInstance().getProcessId(), serverListAsString.c_str())); if (ConfigServerGame::getTimeoutToAckUniverseDataReceived() > 0) - m_timeUniverseDataSent = ::time(NULL); + m_timeUniverseDataSent = ::time(nullptr); } } else @@ -519,7 +519,7 @@ std::string ServerUniverse::generateRandomResourceName(const std::string &nameTa std::string newName(Unicode::wideToNarrow(NameManager::getInstance().generateRandomName("name_resource",nameTable))); // name generator always builds ASCII names, although it returns a Unicode string int failCount = 0; UNREF(failCount); // because of Windows release build - for(; getResourceTypeByName(newName) != NULL; newName = Unicode::wideToNarrow(NameManager::getInstance().generateRandomName("name_resource",nameTable))) // generate names until we find an unused one + for(; getResourceTypeByName(newName) != nullptr; newName = Unicode::wideToNarrow(NameManager::getInstance().generateRandomName("name_resource",nameTable))) // generate names until we find an unused one DEBUG_FATAL(++failCount > 100,("Failed to generate an unused resource name in 100 tries.\n")); return newName; @@ -725,7 +725,7 @@ void ServerUniverse::update(float frameTime) { if (!m_pendingUniverseLoadedAckList.empty()) { - time_t const nowTime = ::time(NULL); + time_t const nowTime = ::time(nullptr); int const secondsSinceUniverseDataSent = (int)(nowTime - m_timeUniverseDataSent); // don't wait forever for ack from another game server @@ -866,7 +866,7 @@ void ServerUniverse::handleAddResourceTypeMessage(AddResourceTypeMessage const & const NetworkId & ServerUniverse::findTheaterId(const std::string & name) { - if (m_theaterNameIdMap == NULL) + if (m_theaterNameIdMap == nullptr) return NetworkId::cms_invalid; TheaterNameIdMap::const_iterator result = m_theaterNameIdMap->find(name); @@ -882,7 +882,7 @@ const std::string & ServerUniverse::findTheaterName(const NetworkId & id) { static const std::string emptyString; - if (m_theaterIdNameMap == NULL) + if (m_theaterIdNameMap == nullptr) return emptyString; TheaterIdNameMap::const_iterator result = m_theaterIdNameMap->find(id); @@ -924,9 +924,9 @@ bool ServerUniverse::remoteSetTheater(const std::string & name, const NetworkId return false; } - if (m_theaterNameIdMap != NULL) + if (m_theaterNameIdMap != nullptr) m_theaterNameIdMap->insert(std::make_pair(name, id)); - if (m_theaterIdNameMap != NULL) + if (m_theaterIdNameMap != nullptr) m_theaterIdNameMap->insert(std::make_pair(id, name)); return true; } @@ -953,9 +953,9 @@ void ServerUniverse::remoteClearTheater(const std::string & name) { const NetworkId & id = findTheaterId(name); - if (m_theaterNameIdMap != NULL) + if (m_theaterNameIdMap != nullptr) m_theaterNameIdMap->erase(name); - if (m_theaterIdNameMap != NULL) + if (m_theaterIdNameMap != nullptr) m_theaterIdNameMap->erase(id); } diff --git a/engine/server/library/serverGame/src/shared/core/ServerWorld.cpp b/engine/server/library/serverGame/src/shared/core/ServerWorld.cpp index fefa1117..3b76b5db 100755 --- a/engine/server/library/serverGame/src/shared/core/ServerWorld.cpp +++ b/engine/server/library/serverGame/src/shared/core/ServerWorld.cpp @@ -415,7 +415,7 @@ class AuthoritativeNonPlayerCreatureFilter: public SpatialSubdivisionFilterisAuthoritative() && object->asCreatureObject() != NULL && !object->isPlayerControlled()); } + return (object->isAuthoritative() && object->asCreatureObject() != nullptr && !object->isPlayerControlled()); } }; class TriggerVolumeFilter: public SpatialSubdivisionFilter @@ -905,26 +905,26 @@ ManufactureSchematicObject* ServerWorld::createNewManufacturingSchematic ( bool persisted) { CreatureObject * const creature = dynamic_cast(creator.getObject()); - if (creature == NULL) - return NULL; + if (creature == nullptr) + return nullptr; PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); - if (player == NULL) - return NULL; + if (player == nullptr) + return nullptr; const DraftSchematicObject * const draftSchematic = player->getCurrentDraftSchematic(); - if (draftSchematic == NULL) - return NULL; + if (draftSchematic == nullptr) + return nullptr; ManufactureSchematicObject * const manfSchematic = draftSchematic->createManufactureSchematic(creator); - if (manfSchematic == NULL) - return NULL; + if (manfSchematic == nullptr) + return nullptr; if (createNewObjectIntermediate(manfSchematic, container, slotId, - persisted) == NULL) + persisted) == nullptr) { delete manfSchematic; - return NULL; + return nullptr; } return manfSchematic; @@ -948,15 +948,15 @@ ManufactureSchematicObject* ServerWorld::createNewManufacturingSchematic ( { ManufactureSchematicObject * const manfSchematic = source.createManufactureSchematic(CachedNetworkId::cms_cachedInvalid); - if (manfSchematic == NULL) - return NULL; + if (manfSchematic == nullptr) + return nullptr; Transform transform; transform.setPosition_p(position); - if (createNewObjectIntermediate(manfSchematic, transform, 0, persisted) == NULL) + if (createNewObjectIntermediate(manfSchematic, transform, 0, persisted) == nullptr) { delete manfSchematic; - return NULL; + return nullptr; } return manfSchematic; @@ -980,11 +980,11 @@ ManufactureSchematicObject* ServerWorld::createNewManufacturingSchematic ( { ManufactureSchematicObject * const manfSchematic = source.createManufactureSchematic(CachedNetworkId::cms_cachedInvalid); - if (manfSchematic == NULL) - return NULL; + if (manfSchematic == nullptr) + return nullptr; - if (createNewObjectIntermediate(manfSchematic, container, persisted, false) == NULL) - return NULL; + if (createNewObjectIntermediate(manfSchematic, container, persisted, false) == nullptr) + return nullptr; return manfSchematic; } // ServerWorld::createNewManufacturingSchematic @@ -1008,11 +1008,11 @@ ServerObject* ServerWorld::createNewObjectIntermediate(ServerObject *newObject, if (newObject->getNetworkId() == NetworkId::cms_invalid) { WARNING_STRICT_FATAL(true, ("Tried to create an object with network id 0.")); - return NULL; + return nullptr; } NetworkController *objectController = dynamic_cast(newObject->getController()); - if (objectController == NULL) + if (objectController == nullptr) objectController = dynamic_cast(newObject->createDefaultController()); NOT_NULL(objectController); @@ -1022,7 +1022,7 @@ ServerObject* ServerWorld::createNewObjectIntermediate(ServerObject *newObject, if (!newObject->serverObjectInitializeFirstTimeObject(cell, transform)) { delete newObject; - return NULL; + return nullptr; } // prevent initial object data from being re-sent as deltas @@ -1057,11 +1057,11 @@ ServerObject* ServerWorld::createNewObjectIntermediate(ServerObject* newObject, if (newObject->getNetworkId() == NetworkId::cms_invalid) { WARNING_STRICT_FATAL(true, ("Tried to create an object with network id 0.")); - return NULL; + return nullptr; } NetworkController *objectController = dynamic_cast(newObject->getController()); - if (objectController == NULL) + if (objectController == nullptr) objectController = dynamic_cast(newObject->createDefaultController()); NOT_NULL(objectController); @@ -1073,10 +1073,10 @@ ServerObject* ServerWorld::createNewObjectIntermediate(ServerObject* newObject, // prevent initial object data from being re-sent as deltas newObject->clearDeltas(); Container::ContainerErrorCode tmp = Container::CEC_Success; - if (!ContainerInterface::transferItemToGeneralContainer(container, *newObject, NULL, tmp, allowOverload)) + if (!ContainerInterface::transferItemToGeneralContainer(container, *newObject, nullptr, tmp, allowOverload)) { IGNORE_RETURN(newObject->permanentlyDestroy(DeleteReasons::BadContainerTransfer)); - newObject = NULL; + newObject = nullptr; } else { @@ -1101,13 +1101,13 @@ ServerObject* ServerWorld::createNewObjectIntermediate(ServerObject* newObject, if (newObject->getNetworkId() == NetworkId::cms_invalid) { WARNING_STRICT_FATAL(true, ("Tried to create an object with network id 0.")); - return NULL; + return nullptr; } { PROFILER_AUTO_BLOCK_DEFINE("createNewObjectIntermedate,getController"); NetworkController *objectController = dynamic_cast(newObject->getController()); - if (objectController == NULL) + if (objectController == nullptr) objectController = dynamic_cast(newObject->createDefaultController()); NOT_NULL(objectController); } @@ -1130,11 +1130,11 @@ ServerObject* ServerWorld::createNewObjectIntermediate(ServerObject* newObject, { PROFILER_AUTO_BLOCK_DEFINE("transferItem"); Container::ContainerErrorCode tmp = Container::CEC_Success; - if (!ContainerInterface::transferItemToSlottedContainer(container, *newObject, slotId, NULL, tmp)) + if (!ContainerInterface::transferItemToSlottedContainer(container, *newObject, slotId, nullptr, tmp)) { PROFILER_AUTO_BLOCK_DEFINE("failedTransfer"); IGNORE_RETURN(newObject->permanentlyDestroy(DeleteReasons::BadContainerTransfer)); - newObject = NULL; + newObject = nullptr; } else { @@ -1189,7 +1189,7 @@ ServerObject* ServerWorld::createProxyObject(uint32 templateCrc, const NetworkId if(newObject) { ServerController *objectController = dynamic_cast(newObject->getController()); - if (objectController == NULL) + if (objectController == nullptr) objectController = dynamic_cast(newObject->createDefaultController()); NOT_NULL(objectController); @@ -1455,10 +1455,10 @@ static void _isObjectInConeLoopSetup(const Object & coneCenterObject, const Loca // NOTE: all calculations are made within the object space of coneCenterObject. //-- Compute cone axis vector. - const ServerObject * cell = NULL; + const ServerObject * cell = nullptr; if (coneDirection.getCell() != NetworkId::cms_invalid) cell = safe_cast(NetworkIdManager::getObjectById(coneDirection.getCell())); - if (cell == NULL) + if (cell == nullptr) coneAxisVector = coneCenterObject.rotateTranslate_w2o(coneDirection.getCoordinates()); else { @@ -1984,7 +1984,7 @@ CellProperty const * ServerWorld::findCellAtLocation(const Vector & location_w) */ ServerObject *ServerWorld::findClosestObjectInList(const Vector &location, const std::vector &candidates) { - if (candidates.empty()) return NULL; + if (candidates.empty()) return nullptr; typedef std::vector CandidatesType; @@ -2097,7 +2097,7 @@ void ServerWorld::install() data.installExtents = true; data.installCollisionWorld = true; - data.playEffect = NULL; + data.playEffect = nullptr; data.isPlayerHouse = &isPlayerHouseHook; data.serverSide = true; @@ -2187,7 +2187,7 @@ void ServerWorld::install() m_sceneId = new std::string(ConfigServerGame::getSceneID()); - Pvp::getScheduler().setCallback(Pvp::updateTimedFlags, NULL, ConfigServerGame::getPvpUpdateTimeMs()); + Pvp::getScheduler().setCallback(Pvp::updateTimedFlags, nullptr, ConfigServerGame::getPvpUpdateTimeMs()); NebulaManagerServer::loadScene(*m_sceneId); @@ -2420,7 +2420,7 @@ void ServerWorld::triggerMovingTriggers(ServerObject &movingObject, Vector const clcount++; } - if (object != NULL) + if (object != nullptr) t->moveTriggerVolume(*object, start, end); } DEBUG_REPORT_LOG(ms_logTriggerStats, (" Creature count: %d Client count: %d\n", crcount, clcount)); @@ -2559,8 +2559,8 @@ void ServerWorld::remove() gs_pendingConcludeVector.clear(); - CollisionWorld::setNearWarpWarningCallback(NULL); - CollisionWorld::setFarWarpWarningCallback(NULL); + CollisionWorld::setNearWarpWarningCallback(nullptr); + CollisionWorld::setFarWarpWarningCallback(nullptr); Pvp::remove(); @@ -2629,7 +2629,7 @@ void ServerWorld::removeObjectFromGame(const ServerObject& object) void ServerWorld::removeTangibleObject(ServerObject *object) { PROFILER_AUTO_BLOCK_DEFINE("ServerWorld::removeTangibleObject"); - DEBUG_WARNING(!object, ("removeTangibleObject() was called with a NULL object parameter, this is probably not what the program intended to do")); + DEBUG_WARNING(!object, ("removeTangibleObject() was called with a nullptr object parameter, this is probably not what the program intended to do")); if (!object) return; @@ -2643,7 +2643,7 @@ void ServerWorld::removeTangibleObject(ServerObject *object) // if the object is being destroyed, the trigger has already gone off // player creatures aren't destroyed before being removed, so it's safe to invoke // the trigger here - if (object->isAuthoritative() && (object->getScriptObject() != NULL) && !object->isBeingDestroyed()) + if (object->isAuthoritative() && (object->getScriptObject() != nullptr) && !object->isBeingDestroyed()) { ScriptParams params; IGNORE_RETURN(object->getScriptObject()->trigAllScripts(Scripting::TRIG_REMOVING_FROM_WORLD, params)); @@ -2897,7 +2897,7 @@ void ServerWorld::update(real time) for(concludeIter = gs_pendingConcludeVector.begin(); concludeIter != gs_pendingConcludeVector.end(); ++concludeIter) { ServerObject *o = (*concludeIter)->asServerObject(); - WARNING_STRICT_FATAL(!o, ("NULL object in conclude list!")); + WARNING_STRICT_FATAL(!o, ("nullptr object in conclude list!")); if (o) { if (o->isInitialized()) diff --git a/engine/server/library/serverGame/src/shared/core/SetupServerGame.cpp b/engine/server/library/serverGame/src/shared/core/SetupServerGame.cpp index a8dadf30..7a047ac5 100755 --- a/engine/server/library/serverGame/src/shared/core/SetupServerGame.cpp +++ b/engine/server/library/serverGame/src/shared/core/SetupServerGame.cpp @@ -65,8 +65,8 @@ void SetupServerGame::install() PositionUpdateTracker::install(); LogoutTracker::install(); AuthTransferTracker::install(); - NonCriticalTaskQueue::install(static_cast(NULL)); - SurveySystem::install(static_cast(NULL)); + NonCriticalTaskQueue::install(static_cast(nullptr)); + SurveySystem::install(static_cast(nullptr)); CreatureObject::install(); NameManager::install(); MessageToQueue::install(); diff --git a/engine/server/library/serverGame/src/shared/core/StaticLootItemManager.cpp b/engine/server/library/serverGame/src/shared/core/StaticLootItemManager.cpp index 8202f8d1..9da3852f 100755 --- a/engine/server/library/serverGame/src/shared/core/StaticLootItemManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/StaticLootItemManager.cpp @@ -26,8 +26,8 @@ int const MAX_ATTRIBS = 2000; void StaticLootItemManager::sendDataToClient(NetworkId const & playerId, std::string const & staticItemName) { Object * const o = NetworkIdManager::getObjectById(playerId); - ServerObject * const so = o ? o->asServerObject() : NULL; - CreatureObject * const co = so ? so->asCreatureObject() : NULL; + ServerObject * const so = o ? o->asServerObject() : nullptr; + CreatureObject * const co = so ? so->asCreatureObject() : nullptr; if(co) { @@ -45,8 +45,8 @@ void StaticLootItemManager::sendDataToClient(NetworkId const & playerId, std::st void StaticLootItemManager::getAttributes(NetworkId const & playerId, std::string const & staticItemName, AttributeVector & data) { Object * const o = NetworkIdManager::getObjectById(playerId); - ServerObject * const so = o ? o->asServerObject() : NULL; - CreatureObject * const co = so ? so->asCreatureObject() : NULL; + ServerObject * const so = o ? o->asServerObject() : nullptr; + CreatureObject * const co = so ? so->asCreatureObject() : nullptr; if(co) { GameScriptObject * const gso = const_cast(co->getScriptObject()); diff --git a/engine/server/library/serverGame/src/shared/core/VeteranRewardManager.cpp b/engine/server/library/serverGame/src/shared/core/VeteranRewardManager.cpp index c9bb11a0..fcc97af2 100755 --- a/engine/server/library/serverGame/src/shared/core/VeteranRewardManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/VeteranRewardManager.cpp @@ -312,7 +312,7 @@ RewardEvent * VeteranRewardManagerNamespace::getRewardEventByName(std::string co if (i!=ms_rewardEvents.end()) return i->second; else - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -323,7 +323,7 @@ RewardItem * VeteranRewardManagerNamespace::getRewardItemByName(std::string cons if (i!=ms_rewardItems.end()) return i->second; else - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -389,7 +389,7 @@ void VeteranRewardManager::getTriggeredEventsIds(CreatureObject const & playerCr if (((*i)->getAccountFeatureId() > 0) && (*i)->getConsumeAccountFeatureId()) { std::vector rewardItems; - getAvailableRewardItemsForEvent(playerCreature, (*i)->getId(), rewardItems, NULL); + getAvailableRewardItemsForEvent(playerCreature, (*i)->getId(), rewardItems, nullptr); if (rewardItems.empty()) continue; @@ -512,7 +512,7 @@ bool VeteranRewardManager::claimRewards(CreatureObject const & playerCreature, s } std::vector possibleRewardItems; - getAvailableRewardItemsForEvent(playerCreature, rewardEventName, possibleRewardItems, NULL); + getAvailableRewardItemsForEvent(playerCreature, rewardEventName, possibleRewardItems, nullptr); if (possibleRewardItems.empty()) { if (debugMessage) @@ -589,7 +589,7 @@ void VeteranRewardManager::handleClaimRewardsReply(StationId stationId, NetworkI static std::vector const emptyMessageData; ServerObject * const so = safe_cast(NetworkIdManager::getObjectById(player)); - CreatureObject * const playerCreature = so ? so->asCreatureObject() : NULL; + CreatureObject * const playerCreature = so ? so->asCreatureObject() : nullptr; if (!playerCreature) return; // player has vanished -- reward claim will be handled by the recovery code at the next login if (!playerCreature->isAuthoritative()) @@ -628,7 +628,7 @@ void VeteranRewardManager::handleClaimRewardsReply(StationId stationId, NetworkI // Check that the requested item can be claimed with this event std::vector possibleRewardItems; - getAvailableRewardItemsForEvent(*playerCreature, rewardEvent, possibleRewardItems, NULL); + getAvailableRewardItemsForEvent(*playerCreature, rewardEvent, possibleRewardItems, nullptr); bool found = false; for (std::vector::const_iterator j=possibleRewardItems.begin(); j!=possibleRewardItems.end(); ++j) @@ -704,7 +704,7 @@ void VeteranRewardManager::handleClaimRewardsReply(StationId stationId, NetworkI params.addParam(item->getCanTradeIn(), "canTradeIn"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(player, "veteranItemGrantSucceeded",dictionary->getSerializedData(),0,false); @@ -808,11 +808,11 @@ time_t VeteranRewardManagerNamespace::yyyymmddToTime(int const yyyy, int const m FATAL(((mm < 1) || (mm > 12)),("Data bug: Reward event date (%d / %d / %d) - month %d specified for a reward event must be between 1 - 12.",mm,dd,yyyy,mm)); FATAL(((dd < 1) || (dd > 31)),("Data bug: Reward event date (%d / %d / %d) - day %d specified for a reward event must be between 1 - 31.",mm,dd,yyyy,dd)); - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * const timeinfo = ::localtime(&rawtime); if (!timeinfo) { - FATAL(true,(":localtime() returns NULL")); + FATAL(true,(":localtime() returns nullptr")); return 0; } @@ -848,7 +848,7 @@ void VeteranRewardManager::getRewardChoicesTags(CreatureObject const & playerCre std::vector rewardItems; - getAvailableRewardItemsForEvent(playerCreature, eventName, rewardItems, NULL); + getAvailableRewardItemsForEvent(playerCreature, eventName, rewardItems, nullptr); for (std::vector::const_iterator i=rewardItems.begin(); i!=rewardItems.end(); ++i) { rewardTagsUnicode.push_back(Unicode::narrowToWide(*i)); @@ -866,7 +866,7 @@ StringId const * VeteranRewardManager::getEventAnnouncement(std::string const & { return &(event->getAnnouncement()); } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -880,7 +880,7 @@ StringId const * VeteranRewardManager::getEventDescription(std::string const & e { return &(event->getDescription()); } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -894,7 +894,7 @@ std::string const * VeteranRewardManager::getEventUrl(std::string const & eventN { return &(event->getUrl()); } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -1147,7 +1147,7 @@ void VeteranRewardManager::tcgRedemption(CreatureObject const & playerCreature, // the redemption int const redemptionTimeout = 300; // 5 minutes; item.removeObjVarItem(ms_tcgRedemptionInProgressObjvar); - item.setObjVarItem(ms_tcgRedemptionInProgressObjvar, static_cast(::time(NULL) + redemptionTimeout)); // 5 minutes + item.setObjVarItem(ms_tcgRedemptionInProgressObjvar, static_cast(::time(nullptr) + redemptionTimeout)); // 5 minutes // send off request to adjust the account feature Id AdjustAccountFeatureIdRequest const msg(NetworkId::cms_invalid, GameServer::getInstance().getProcessId(), playerCreature.getNetworkId(), PlayerObject::getAccountDescription(&playerCreature), playerPlayer->getStationId(), item.getNetworkId(), ServerObject::getLogDescription(&item), PlatformGameCode::SWGTCG, static_cast(featureId), adjustment); @@ -1169,7 +1169,7 @@ bool VeteranRewardManager::checkForTcgRedemptionInProgress(ServerObject const & int redemptionTimeout; IGNORE_RETURN(item.getObjVars().getItem(ms_tcgRedemptionInProgressObjvar, redemptionTimeout)); - time_t const currentTime = ::time(NULL); + time_t const currentTime = ::time(nullptr); if (redemptionTimeout > currentTime) { // item should be in top level inventory; get the player object the item is in @@ -1308,7 +1308,7 @@ bool VeteranRewardManager::tradeInReward(CreatureObject const & playerCreature, if (itemClaimTime > 0) { time_t timeRedeem = itemClaimTime + static_cast(ConfigServerGame::getVeteranRewardTradeInWaitPeriodSeconds()); - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); // see if the item has its own trade-in wait period if (itemObjvar.hasItem("rewardTradeInWaitPeriod") && (itemObjvar.getType("rewardTradeInWaitPeriod") == DynamicVariable::INT)) @@ -1337,7 +1337,7 @@ bool VeteranRewardManager::tradeInReward(CreatureObject const & playerCreature, // the trade in int const redemptionTimeout = 300; // 5 minutes; item.removeObjVarItem(ms_tradeInInProgressObjvar); - item.setObjVarItem(ms_tradeInInProgressObjvar, static_cast(::time(NULL) + redemptionTimeout)); // 5 minutes + item.setObjVarItem(ms_tradeInInProgressObjvar, static_cast(::time(nullptr) + redemptionTimeout)); // 5 minutes // send off request to adjust the account feature Id AdjustAccountFeatureIdRequest const msg(NetworkId::cms_invalid, GameServer::getInstance().getProcessId(), playerCreature.getNetworkId(), PlayerObject::getAccountDescription(&playerCreature), playerPlayer->getStationId(), item.getNetworkId(), ServerObject::getLogDescription(&item), PlatformGameCode::SWG, static_cast(featureId), 1); @@ -1361,7 +1361,7 @@ bool VeteranRewardManager::checkForTradeInInProgress(ServerObject const & item) int redemptionTimeout; IGNORE_RETURN(item.getObjVars().getItem(ms_tradeInInProgressObjvar, redemptionTimeout)); - time_t const currentTime = ::time(NULL); + time_t const currentTime = ::time(nullptr); if (redemptionTimeout > currentTime) { // item should be in top level inventory; get the player object the item is in @@ -1742,7 +1742,7 @@ RewardEvent::RewardEvent(DataTable const & dataTable, int row) : m_id(dataTable.getStringValue("id",row)), m_specificItems(buildVectorFromString(dataTable.getStringValue("Items",row))), m_includeItemsFrom(buildVectorFromString(dataTable.getStringValue("Include Items From",row))), - m_allItems(NULL), + m_allItems(nullptr), m_category(dataTable.getIntValue("Category", row)), m_featureBitRewardExclusionMask(dataTable.getIntValue("Feature Bit Reward Exclusion Mask", row)), m_accountFlags(static_cast(dataTable.getIntValue("Account Flags",row))), @@ -1839,7 +1839,7 @@ bool RewardEvent::hasPlayerTriggered(CreatureObject const & playerCreature) cons if (m_startDate != 0 || m_endDate != 0) { - time_t currentTime = time(NULL); + time_t currentTime = time(nullptr); if ((m_startDate != 0 && currentTime < m_startDate) || (m_endDate != 0 && currentTime > m_endDate)) return false; diff --git a/engine/server/library/serverGame/src/shared/guild/GuildInterface.cpp b/engine/server/library/serverGame/src/shared/guild/GuildInterface.cpp index f30669aa..7f8f07c8 100755 --- a/engine/server/library/serverGame/src/shared/guild/GuildInterface.cpp +++ b/engine/server/library/serverGame/src/shared/guild/GuildInterface.cpp @@ -43,11 +43,11 @@ namespace GuildInterfaceNamespace bool s_needEnemiesRebuild; // dictionary containing the table showing all active guild wars with at least 1 kill - ScriptParams * s_activeGuildWars = NULL; + ScriptParams * s_activeGuildWars = nullptr; bool s_activeGuildWarsNeedRebuild = true; // dictionary containing the table showing the 100 most recently ended guild wars with at least 1 kill - ScriptParams * s_inactiveGuildWars = NULL; + ScriptParams * s_inactiveGuildWars = nullptr; int s_inactiveGuildWarsMostRecentUpdateIndex = 0; typedef std::map PendingChannelAddList; //using a map to make it easier to prevent redundant entries @@ -99,7 +99,7 @@ namespace GuildInterfaceNamespace const char * makeCopyOfString(const char * rhs) { - char * lhs = NULL; + char * lhs = nullptr; if (rhs) { lhs = new char[strlen(rhs) + 1]; @@ -245,7 +245,7 @@ std::pair const *GuildInterface::hasDeclaredWarAgainst(int actorGui } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -662,7 +662,7 @@ ScriptParams const *GuildInterface::getMasterGuildWarTableDictionary() } delete s_activeGuildWars; - s_activeGuildWars = NULL; + s_activeGuildWars = nullptr; // build the table if (!guildMutuallyAtWarWithKillSummary.empty()) @@ -810,9 +810,9 @@ void GuildInterface::updateInactiveGuildWarTrackingInfo(GuildObject &masterGuild // guild with higher kill count appears first if (guildAKillCount > guildBKillCount) - IGNORE_RETURN(masterGuildObject.setObjVarItem(FormattedString<32>().sprintf("%s.%d", s_objvarInactiveGuildWarsPrefix.c_str(), nextIndex), FormattedString<512>().sprintf("%s~%s~%d~%s~%s~%d~%ld", giA->m_name.c_str(), giA->m_abbrev.c_str(), guildAKillCount, giB->m_name.c_str(), giB->m_abbrev.c_str(), guildBKillCount, ::time(NULL)))); + IGNORE_RETURN(masterGuildObject.setObjVarItem(FormattedString<32>().sprintf("%s.%d", s_objvarInactiveGuildWarsPrefix.c_str(), nextIndex), FormattedString<512>().sprintf("%s~%s~%d~%s~%s~%d~%ld", giA->m_name.c_str(), giA->m_abbrev.c_str(), guildAKillCount, giB->m_name.c_str(), giB->m_abbrev.c_str(), guildBKillCount, ::time(nullptr)))); else - IGNORE_RETURN(masterGuildObject.setObjVarItem(FormattedString<32>().sprintf("%s.%d", s_objvarInactiveGuildWarsPrefix.c_str(), nextIndex), FormattedString<512>().sprintf("%s~%s~%d~%s~%s~%d~%ld", giB->m_name.c_str(), giB->m_abbrev.c_str(), guildBKillCount, giA->m_name.c_str(), giA->m_abbrev.c_str(), guildAKillCount, ::time(NULL)))); + IGNORE_RETURN(masterGuildObject.setObjVarItem(FormattedString<32>().sprintf("%s.%d", s_objvarInactiveGuildWarsPrefix.c_str(), nextIndex), FormattedString<512>().sprintf("%s~%s~%d~%s~%s~%d~%ld", giB->m_name.c_str(), giB->m_abbrev.c_str(), guildBKillCount, giA->m_name.c_str(), giA->m_abbrev.c_str(), guildAKillCount, ::time(nullptr)))); IGNORE_RETURN(masterGuildObject.setObjVarItem(s_objvarInactiveGuildWarsMostRecentIndex, nextIndex)); } @@ -869,7 +869,7 @@ ScriptParams const *GuildInterface::getInactiveGuildWarTableDictionary() if (!objVars.getItem(FormattedString<32>().sprintf("%s.%d", s_objvarInactiveGuildWarsPrefix.c_str(), currentIndex), guildWarData)) break; - if (!Unicode::tokenize(guildWarData, tokens, &delimiters, NULL) || (tokens.size() != 7)) + if (!Unicode::tokenize(guildWarData, tokens, &delimiters, nullptr) || (tokens.size() != 7)) break; scriptParamsGuildAName->push_back(new Unicode::String(tokens[0])); @@ -891,7 +891,7 @@ ScriptParams const *GuildInterface::getInactiveGuildWarTableDictionary() } delete s_inactiveGuildWars; - s_inactiveGuildWars = NULL; + s_inactiveGuildWars = nullptr; if (!scriptParamsGuildAName->empty()) { @@ -1120,7 +1120,7 @@ void GuildInterface::updateGuildWarKillTracking(CreatureObject const &killer, Cr && hasDeclaredWarAgainst(killer.getGuildId(), victim.getGuildId()) && hasDeclaredWarAgainst(victim.getGuildId(), killer.getGuildId())) { - ServerUniverse::getInstance().getMasterGuildObject()->modifyGuildWarKillTracking(killer.getGuildId(), victim.getGuildId(), 1, static_cast(::time(NULL))); + ServerUniverse::getInstance().getMasterGuildObject()->modifyGuildWarKillTracking(killer.getGuildId(), victim.getGuildId(), 1, static_cast(::time(nullptr))); } } diff --git a/engine/server/library/serverGame/src/shared/metrics/GameServerMetricsData.cpp b/engine/server/library/serverGame/src/shared/metrics/GameServerMetricsData.cpp index 96c0d19b..170181d6 100755 --- a/engine/server/library/serverGame/src/shared/metrics/GameServerMetricsData.cpp +++ b/engine/server/library/serverGame/src/shared/metrics/GameServerMetricsData.cpp @@ -239,7 +239,7 @@ void GameServerMetricsData::updateData() "Max: %s requested load on %s which has been pending for %s. Limit = %d.", id.getValueString().c_str(), CalendarTime::convertEpochToTimeStringLocal(oldestPendingLoadRequestTime).c_str(), - CalendarTime::convertSecondsToMS((int)::time(NULL) - oldestPendingLoadRequestTime).c_str(), + CalendarTime::convertSecondsToMS((int)::time(nullptr) - oldestPendingLoadRequestTime).c_str(), GameServer::getPendingLoadRequestLimit() ); else diff --git a/engine/server/library/serverGame/src/shared/network/Chat.cpp b/engine/server/library/serverGame/src/shared/network/Chat.cpp index 209ee89d..fede9920 100755 --- a/engine/server/library/serverGame/src/shared/network/Chat.cpp +++ b/engine/server/library/serverGame/src/shared/network/Chat.cpp @@ -64,7 +64,7 @@ using namespace ChatNamespace; //----------------------------------------------------------------------- -Chat *Chat::m_instance = NULL; +Chat *Chat::m_instance = nullptr; Chat::Chat () : diff --git a/engine/server/library/serverGame/src/shared/network/ConnectionServerConnection.cpp b/engine/server/library/serverGame/src/shared/network/ConnectionServerConnection.cpp index b6af7d42..f47cfe43 100755 --- a/engine/server/library/serverGame/src/shared/network/ConnectionServerConnection.cpp +++ b/engine/server/library/serverGame/src/shared/network/ConnectionServerConnection.cpp @@ -194,7 +194,7 @@ void ConnectionServerConnection::onReceive (const Archive::ByteStream & message) } } else - LOG("CustomerService", ("CharacterTransfer: character object was NULL so unable to check if bank is loaded")); + LOG("CustomerService", ("CharacterTransfer: character object was nullptr so unable to check if bank is loaded")); } @@ -224,10 +224,10 @@ void ConnectionServerConnection::onReceive (const Archive::ByteStream & message) } } else - LOG("CustomerService", ("CharacterTransfer: bank container object was NULL for getBankContainer call")); + LOG("CustomerService", ("CharacterTransfer: bank container object was nullptr for getBankContainer call")); } else - LOG("CustomerService", ("CharacterTransfer: character object was NULL so unable to check if bank is loaded")); + LOG("CustomerService", ("CharacterTransfer: character object was nullptr so unable to check if bank is loaded")); } else if (m.isType("RequestTransferData")) { @@ -237,7 +237,7 @@ void ConnectionServerConnection::onReceive (const Archive::ByteStream & message) CreatureObject * const character = dynamic_cast(NetworkIdManager::getObjectById(requestTransferData.getValue().getCharacterId())); PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(character); time_t characterCreateTime = -1; - FreeCtsDataTable::FreeCtsInfo const * freeCtsInfo = NULL; + FreeCtsDataTable::FreeCtsInfo const * freeCtsInfo = nullptr; bool freeCtsBypassTimeRestriction = false; if (character && playerObject) { @@ -292,7 +292,7 @@ void ConnectionServerConnection::onReceive (const Archive::ByteStream & message) for (CreatureObject::SkillList::const_iterator i = skills.begin(); i != skills.end(); ++i) { const SkillObject * profession = (*i)->findProfessionForSkill(); - if (profession != NULL) + if (profession != nullptr) professionName = profession->getSkillName(); } } @@ -414,7 +414,7 @@ void ConnectionServerConnection::onReceive (const Archive::ByteStream & message) unsigned int result = CHATRESULT_SUCCESS; ServerObject const * const o = ServerWorld::findObjectByNetworkId(cervreq.getValue().first.first); - CreatureObject const * const co = (o ? o->asCreatureObject() : NULL); + CreatureObject const * const co = (o ? o->asCreatureObject() : nullptr); if (co) { result = Chat::isAllowedToEnterRoom(*co, cervreq.getValue().first.second); @@ -440,7 +440,7 @@ void ConnectionServerConnection::onReceive (const Archive::ByteStream & message) bool success = false; ServerObject const * const o = ServerWorld::findObjectByNetworkId(cqrvreq.getValue().first.first); - CreatureObject const * const co = (o ? o->asCreatureObject() : NULL); + CreatureObject const * const co = (o ? o->asCreatureObject() : nullptr); if (co) { success = (CHATRESULT_SUCCESS == Chat::isAllowedToEnterRoom(*co, cqrvreq.getValue().first.second)); diff --git a/engine/server/library/serverGame/src/shared/network/CustomerServiceServerConnection.cpp b/engine/server/library/serverGame/src/shared/network/CustomerServiceServerConnection.cpp index 456ec031..cb1df8fd 100755 --- a/engine/server/library/serverGame/src/shared/network/CustomerServiceServerConnection.cpp +++ b/engine/server/library/serverGame/src/shared/network/CustomerServiceServerConnection.cpp @@ -58,12 +58,12 @@ void CustomerServiceServerConnection::onReceive(const Archive::ByteStream & mess ChatRequestLog chatRequestLog(ri); Object * const reportingObject = NetworkIdManager::getObjectById(NetworkId(Unicode::wideToNarrow(chatRequestLog.getPlayer()))); - if ( (reportingObject != NULL) + if ( (reportingObject != nullptr) && reportingObject->isAuthoritative()) { PlayerObject const * const reportingPlayerObject = PlayerCreatureController::getPlayerObject(CreatureObject::asCreatureObject(reportingObject)); - if (reportingPlayerObject != NULL) + if (reportingPlayerObject != nullptr) { PlayerObject::ChatLog const &reportingPlayerChatLog = reportingPlayerObject->getChatLog(); PlayerObject::ChatLog::const_iterator iterReportingPlayerChatLog = reportingPlayerChatLog.begin(); diff --git a/engine/server/library/serverGame/src/shared/network/GameServerMessageArchive.cpp b/engine/server/library/serverGame/src/shared/network/GameServerMessageArchive.cpp index bf76972f..d66d70fb 100755 --- a/engine/server/library/serverGame/src/shared/network/GameServerMessageArchive.cpp +++ b/engine/server/library/serverGame/src/shared/network/GameServerMessageArchive.cpp @@ -31,7 +31,7 @@ GameServerMessageArchive::~GameServerMessageArchive() void GameServerMessageArchive::install() { - if (getInstance() == NULL) + if (getInstance() == nullptr) { setInstance(new GameServerMessageArchive); ExitChain::add(GameServerMessageArchive::remove, "GameServerMessageArchive::remove"); diff --git a/engine/server/library/serverGame/src/shared/object/BuildingObject.cpp b/engine/server/library/serverGame/src/shared/object/BuildingObject.cpp index ed2eb7de..cdc6289f 100755 --- a/engine/server/library/serverGame/src/shared/object/BuildingObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/BuildingObject.cpp @@ -140,7 +140,7 @@ using namespace BuildingObjectNamespace; // ====================================================================== -const SharedObjectTemplate * BuildingObject::m_defaultSharedTemplate = NULL; +const SharedObjectTemplate * BuildingObject::m_defaultSharedTemplate = nullptr; // ====================================================================== @@ -380,13 +380,13 @@ const SharedObjectTemplate * BuildingObject::getDefaultSharedTemplate(void) cons { static const ConstCharCrcLowerString templateName("object/building/base/shared_building_default.iff"); - if (m_defaultSharedTemplate == NULL) + if (m_defaultSharedTemplate == nullptr) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create " + WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create " "default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) ExitChain::add (removeDefaultTemplate, "BuildingObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -399,10 +399,10 @@ static const ConstCharCrcLowerString templateName("object/building/base/shared_b */ void BuildingObject::removeDefaultTemplate(void) { - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } // BuildingObject::removeDefaultTemplate @@ -432,7 +432,7 @@ void BuildingObject::expelObject(ServerObject &who) if (controller) { CellProperty *parentCell = getParentCell(); - ServerObject *destinationCellObject = NULL; + ServerObject *destinationCellObject = nullptr; if (!parentCell->isWorldCell()) destinationCellObject = safe_cast(&parentCell->getOwner()); @@ -902,7 +902,7 @@ void BuildingObject::changeTeleportDestination(Vector & position, float & yaw) c { DataTable * respawnTable = DataTableManager::getTable(CLONE_RESPAWN_TABLE, true); - if (respawnTable != NULL) + if (respawnTable != nullptr) { int row = respawnTable->searchColumnString(0, getTemplateName()); if (row >= 0) diff --git a/engine/server/library/serverGame/src/shared/object/CellObject.cpp b/engine/server/library/serverGame/src/shared/object/CellObject.cpp index b2c6f994..e0211aa5 100755 --- a/engine/server/library/serverGame/src/shared/object/CellObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/CellObject.cpp @@ -39,7 +39,7 @@ #include -const SharedObjectTemplate * CellObject::m_defaultSharedTemplate = NULL; +const SharedObjectTemplate * CellObject::m_defaultSharedTemplate = nullptr; // ====================================================================== @@ -99,13 +99,13 @@ const SharedObjectTemplate * CellObject::getDefaultSharedTemplate(void) const { static const ConstCharCrcLowerString templateName("object/cell/base/shared_cell_default.iff"); - if (m_defaultSharedTemplate == NULL) + if (m_defaultSharedTemplate == nullptr) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create " + WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create " "default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) ExitChain::add (removeDefaultTemplate, "CellObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -118,10 +118,10 @@ static const ConstCharCrcLowerString templateName("object/cell/base/shared_cell_ */ void CellObject::removeDefaultTemplate(void) { - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } // CellObject::removeDefaultTemplate @@ -161,7 +161,7 @@ void CellObject::endBaselines() } Object *container = ContainerInterface::getContainedByObject(*this); - PortalProperty *portalProperty = NULL; + PortalProperty *portalProperty = nullptr; if (container) { portalProperty = container->getPortalProperty(); @@ -531,31 +531,31 @@ bool CellObject::isAllowed(CreatureObject const &who) const bool CellObject::getClosestPathNodePos( const ServerObject & object, Vector & outPos ) const { - const PathNode * closestNode = NULL; + const PathNode * closestNode = nullptr; float closestDistance = 0; const Vector objectPos = object.getPosition_w(); const CellProperty * cell = ContainerInterface::getCell(*this); - if (cell != NULL) + if (cell != nullptr) { const Floor * floor = cell->getFloor(); - if (floor != NULL) + if (floor != nullptr) { const FloorMesh * mesh = floor->getFloorMesh(); - if (mesh != NULL) + if (mesh != nullptr) { const PathGraph * path = safe_cast(mesh->getPathGraph()); - if (path != NULL) + if (path != nullptr) { int nodeCount = path->getNodeCount(); for (int i = 0; i < nodeCount; ++i) { const PathNode * node = path->getNode(i); - if (node != NULL) + if (node != nullptr) { float distance = objectPos.magnitudeBetweenSquared( rotateTranslate_p2w(node->getPosition_p())); - if (closestNode == NULL || distance < closestDistance) + if (closestNode == nullptr || distance < closestDistance) { closestNode = node; closestDistance = distance; @@ -567,9 +567,9 @@ bool CellObject::getClosestPathNodePos( const ServerObject & object, Vector & ou } } - if (closestNode != NULL) + if (closestNode != nullptr) outPos = closestNode->getPosition_p(); - return closestNode != NULL; + return closestNode != nullptr; } // ---------------------------------------------------------------------- @@ -648,7 +648,7 @@ void CellObject::onContainerLostItem(ServerObject * destination, ServerObject& i obj->getScriptObject()->trigAllScripts(Scripting::TRIG_LOST_ITEM, params); BuildingObject * const b_obj = getOwnerBuilding(); - if (b_obj && item.isPlayerControlled() && destination == NULL) + if (b_obj && item.isPlayerControlled() && destination == nullptr) { b_obj->lostPlayer(item); } @@ -772,8 +772,8 @@ CellObject * CellObject::getCellObject(NetworkId const & networkId) CellObject * CellObject::asCellObject(Object * object) { - ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; - CellObject * const cellObject = (serverObject != NULL) ? serverObject->asCellObject() : NULL; + ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; + CellObject * const cellObject = (serverObject != nullptr) ? serverObject->asCellObject() : nullptr; return cellObject; } @@ -782,8 +782,8 @@ CellObject * CellObject::asCellObject(Object * object) CellObject const * CellObject::asCellObject(Object const * object) { - ServerObject const * const serverObject = (object != NULL) ? object->asServerObject() : NULL; - CellObject const * const cellObject = (serverObject != NULL) ? serverObject->asCellObject() : NULL; + ServerObject const * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; + CellObject const * const cellObject = (serverObject != nullptr) ? serverObject->asCellObject() : nullptr; return cellObject; } diff --git a/engine/server/library/serverGame/src/shared/object/CityObject.cpp b/engine/server/library/serverGame/src/shared/object/CityObject.cpp index f8fd1778..da741dbf 100755 --- a/engine/server/library/serverGame/src/shared/object/CityObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/CityObject.cpp @@ -130,9 +130,9 @@ void CityObject::setupUniverse() // build the city info from data read in from DB // disable notification while building the initial list - m_citizensInfo.setOnErase(NULL, NULL); - m_citizensInfo.setOnInsert(NULL, NULL); - m_citizensInfo.setOnSet(NULL, NULL); + m_citizensInfo.setOnErase(nullptr, nullptr); + m_citizensInfo.setOnInsert(nullptr, nullptr); + m_citizensInfo.setOnSet(nullptr, nullptr); // build cities std::map tempCities; @@ -462,7 +462,7 @@ int CityObject::createCity(std::string const &cityName, NetworkId const &cityHal incomeTax, propertyTax, salesTax, travelLoc, travelCost, travelInterplanetary, cloneLoc, cloneRespawn, cloneRespawnCell, cloneId); - ci.setCityCreationTime(static_cast(::time(NULL))); + ci.setCityCreationTime(static_cast(::time(nullptr))); m_citiesInfo.set(cityId, ci); std::string citySpec; @@ -1724,7 +1724,7 @@ CitizenInfo const * CityObject::getCitizenSpec(int cityId, NetworkId const &citi } result.clear(); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -1739,7 +1739,7 @@ CityStructureInfo const * CityObject::getCityStructureSpec(int cityId, NetworkId } result.clear(); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -1975,7 +1975,7 @@ CitizenInfo const *CityObject::getCitizenInfo(int cityId, NetworkId const &citiz if (iterFind != m_citizensInfo.end()) return &(iterFind->second); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -2008,7 +2008,7 @@ CityStructureInfo const *CityObject::getCityStructureInfo(int cityId, NetworkId if (iterFind != m_structuresInfo.end()) return &(iterFind->second); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -2071,7 +2071,7 @@ PgcRatingInfo const * CityObject::getPgcRating(NetworkId const &chroniclerId) co if (iterFind != m_pgcRatingInfo.end()) return &(iterFind->second); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -2141,7 +2141,7 @@ void CityObject::adjustPgcRating(NetworkId const &chroniclerId, std::string cons m_pgcRatingChroniclerId.insert(std::make_pair(NameManager::normalizeName(updatedPgcRating.m_chroniclerName), chroniclerId)); } - updatedPgcRating.m_lastRatingTime = static_cast(::time(NULL)); + updatedPgcRating.m_lastRatingTime = static_cast(::time(nullptr)); std::string updatedPgcRatingSpec; CityStringParser::buildPgcRatingSpec(chroniclerId, updatedPgcRating, updatedPgcRatingSpec); diff --git a/engine/server/library/serverGame/src/shared/object/CreatureObject.cpp b/engine/server/library/serverGame/src/shared/object/CreatureObject.cpp index 336f2058..73803c0a 100755 --- a/engine/server/library/serverGame/src/shared/object/CreatureObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/CreatureObject.cpp @@ -189,7 +189,7 @@ //---------------------------------------------------------------------- // static CreatureObject vars -const SharedObjectTemplate * CreatureObject::m_defaultSharedTemplate = NULL; +const SharedObjectTemplate * CreatureObject::m_defaultSharedTemplate = nullptr; //---------------------------------------------------------------------- @@ -661,9 +661,9 @@ float MonitoredCreatureMovement::operator-(MonitoredCreatureMovement const &othe CreatureObject::CreatureObject(const ServerCreatureObjectTemplate* newTemplate) : TangibleObject(newTemplate), - m_commandQueue(NULL), + m_commandQueue(nullptr), m_isStatic(false), - m_shield(NULL), + m_shield(nullptr), m_regenerationTime(0), m_attributes(Attributes::NumberOfAttributes), m_maxAttributes(Attributes::NumberOfAttributes), @@ -942,7 +942,7 @@ CreatureObject::~CreatureObject() trade->cancelTrade(*this); } // AICreatureController * aiController = AICreatureController::asAiCreatureController(controller); -// if (aiController != NULL) +// if (aiController != nullptr) // { // aiController->stop(); // } @@ -1083,15 +1083,15 @@ const SharedObjectTemplate * CreatureObject::getDefaultSharedTemplate() const { static const ConstCharCrcLowerString templateName("object/creature/base/shared_creature_default.iff"); - if (m_defaultSharedTemplate == NULL) + if (m_defaultSharedTemplate == nullptr) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - DEBUG_WARNING(m_defaultSharedTemplate == NULL, ("Cannot create " + DEBUG_WARNING(m_defaultSharedTemplate == nullptr, ("Cannot create " "default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) ExitChain::add (removeDefaultTemplate, "CreatureObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -1104,10 +1104,10 @@ static const ConstCharCrcLowerString templateName("object/creature/base/shared_c */ void CreatureObject::removeDefaultTemplate() { - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } // CreatureObject::removeDefaultTemplate @@ -1192,7 +1192,7 @@ void CreatureObject::runSpawnQueue() ScriptParams params; ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(id, "spawn_Trigger", dictionary->getSerializedData(), 0, false); @@ -1263,7 +1263,7 @@ bool CreatureObject::assignMission(MissionObject * missionObject) } Container::ContainerErrorCode tmp = Container::CEC_Success; - result = ContainerInterface::transferItemToGeneralContainer(*datapad, *missionObject, NULL, tmp); + result = ContainerInterface::transferItemToGeneralContainer(*datapad, *missionObject, nullptr, tmp); if(result) { missionObject->setMissionHolderId(getNetworkId()); @@ -1725,7 +1725,7 @@ void CreatureObject::forwardServerObjectSpecificBaselines() const TangibleObject::forwardServerObjectSpecificBaselines(); Property const * const property = getProperty(SlowDownProperty::getClassPropertyId()); - if (property != NULL) + if (property != nullptr) { SlowDownProperty const * const slowdownProperty = safe_cast(property); @@ -1736,7 +1736,7 @@ void CreatureObject::forwardServerObjectSpecificBaselines() const // if we are an ai creature, have our controller send our current ai state AICreatureController const * const aiCreatureController = AICreatureController::asAiCreatureController(getController()); - if (aiCreatureController != NULL) + if (aiCreatureController != nullptr) { aiCreatureController->forwardServerObjectSpecificBaselines(); } @@ -1749,7 +1749,7 @@ void CreatureObject::sendObjectSpecificBaselinesToClient(Client const &client) c TangibleObject::sendObjectSpecificBaselinesToClient(client); Property const * const property = getProperty(SlowDownProperty::getClassPropertyId()); - if (property != NULL) + if (property != nullptr) { SlowDownProperty const * const slowdownProperty = safe_cast(property); @@ -1778,7 +1778,7 @@ void CreatureObject::initializeFirstTimeObject() // set the current weapon WeaponObject * weapon = getReadiedWeapon(); - if (weapon != NULL) + if (weapon != nullptr) setCurrentWeapon(*weapon); #ifdef _DEBUG @@ -1835,7 +1835,7 @@ void CreatureObject::onLoadedFromDatabase() { Container::ContainedItem itemId = container->getObjectInSlot(slot, tmp); Object* appearanceInventory = itemId.getObject(); - if(appearanceInventory == NULL) + if(appearanceInventory == nullptr) { WARNING(true, ("Player %s has lost their appearance inventory", getNetworkId().getValueString().c_str())); appearanceInventory = ServerWorld::createNewObject(s_appearanceTemplate, *this, slot, false); @@ -1941,7 +1941,7 @@ void CreatureObject::onLoadedFromDatabase() if (i.getValue(ctsTransactionDetail)) { Unicode::UnicodeStringVector tokens; - if (Unicode::tokenize(ctsTransactionDetail, tokens, NULL, NULL) && (tokens.size() >= 4)) + if (Unicode::tokenize(ctsTransactionDetail, tokens, nullptr, nullptr) && (tokens.size() >= 4)) { int const transferTime = atoi(Unicode::wideToNarrow(tokens[0]).c_str()); if ((earliestTransferTime == -1) || (transferTime < earliestTransferTime)) @@ -1978,7 +1978,7 @@ void CreatureObject::onLoadedFromDatabase() } // set "born on " collection slot and clear all the other "born on " collection slots; - // this still needs to be run even if collectionSlot is NULL in order to forcefully clear all of the + // this still needs to be run even if collectionSlot is nullptr in order to forcefully clear all of the // other "born on " collection slots, since we are reusing deleted/no longer used collection // slot bits, and those bits may be left in a set state at the time they were deleted/no longer used std::vector const & slots = CollectionsDataTable::getSlotsInCollection("born_on_collection"); @@ -2064,7 +2064,7 @@ void CreatureObject::onLoadedFromDatabase() std::vector > skillModBonuses; std::vector > attribBonuses; Container const * const equipment = ContainerInterface::getContainer(*this); - if (equipment != NULL) + if (equipment != nullptr) { for (ContainerConstIterator i(equipment->begin()); i != equipment->end(); ++i) { @@ -2072,7 +2072,7 @@ void CreatureObject::onLoadedFromDatabase() if (so) { TangibleObject const * const equippedItem = so->asTangibleObject(); - if (equippedItem != NULL) + if (equippedItem != nullptr) { equippedItem->getSkillModBonuses(skillModBonuses); int bonusCount = skillModBonuses.size(); @@ -2110,7 +2110,7 @@ void CreatureObject::onLoadedFromDatabase() setDefaultAlterTime(defaultAlterTime); CreatureController * controller = getCreatureController(); - if (controller != NULL) + if (controller != nullptr) controller->updateHibernate(); } } @@ -2379,7 +2379,7 @@ void CreatureObject::endBaselines() void CreatureObject::checkAndRestoreRequiredSlots() { SlottedContainer * const container = ContainerInterface::getSlottedContainer(*this); - if (container == NULL) + if (container == nullptr) { WARNING_STRICT_FATAL(true, ("This creature is not slotted!")); return; @@ -2422,7 +2422,7 @@ void CreatureObject::checkAndRestoreRequiredSlots() { Container::ContainedItem itemId = container->getObjectInSlot(slot, tmp); Object* inventory = itemId.getObject(); - if (inventory == NULL) + if (inventory == nullptr) { WARNING(true, ("Player %s has lost their inventory", getNetworkId().getValueString().c_str())); inventory = ServerWorld::createNewObject(s_inventoryTemplate, *this, slot, false); @@ -2438,7 +2438,7 @@ void CreatureObject::checkAndRestoreRequiredSlots() { Container::ContainedItem itemId = container->getObjectInSlot(slot, tmp); Object* datapad = itemId.getObject(); - if (datapad == NULL) + if (datapad == nullptr) { WARNING(true, ("Player %s has lost their datapad", getNetworkId().getValueString().c_str())); datapad = ServerWorld::createNewObject(s_datapadTemplate, *this, slot, false); @@ -2454,7 +2454,7 @@ void CreatureObject::checkAndRestoreRequiredSlots() { Container::ContainedItem itemId = container->getObjectInSlot(slot, tmp); ServerObject* missionBag = safe_cast(itemId.getObject()); - if (missionBag == NULL) + if (missionBag == nullptr) { WARNING(true, ("Player %s has lost their mission bag", getNetworkId().getValueString().c_str())); missionBag = ServerWorld::createNewObject(s_missionBagTemplate, *this, slot, false); @@ -2472,7 +2472,7 @@ void CreatureObject::checkAndRestoreRequiredSlots() { Container::ContainedItem itemId = container->getObjectInSlot(slot, tmp); ServerObject* bank = safe_cast(itemId.getObject()); - if (bank == NULL) + if (bank == nullptr) { WARNING(true, ("Player %s has lost their bank", getNetworkId().getValueString().c_str())); bank = ServerWorld::createNewObject(s_bankTemplate, *this, slot, false); @@ -2502,7 +2502,7 @@ void CreatureObject::onRemovingFromWorld() { // if we are crafting, end the crafting session PlayerObject * const player = PlayerCreatureController::getPlayerObject(this); - if (player != NULL && player->isCrafting()) + if (player != nullptr && player->isCrafting()) player->stopCrafting(false); // exit all notify regions @@ -2541,7 +2541,7 @@ void CreatureObject::addToWorld() Object::addToWorld(); updateTriggerVolumes(); - if (getScriptObject() != NULL) + if (getScriptObject() != nullptr) getScriptObject()->setOwnerIsLoaded(); ContainedByProperty * const containedByProperty = getContainedByProperty(); @@ -2607,7 +2607,7 @@ void CreatureObject::setupSkillData() clearCommands(); PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if (playerObject != NULL) + if (playerObject != nullptr) { playerObject->clearSchematics(); } @@ -2679,7 +2679,7 @@ void CreatureObject::setupSkillData() DynamicVariableList::NestedList::const_iterator i(schematics.begin()); for (; i != schematics.end(); ++i) { - grantSchematic(strtoul(i.getName().c_str(), NULL, 10), true); + grantSchematic(strtoul(i.getName().c_str(), nullptr, 10), true); } } @@ -2711,7 +2711,7 @@ Controller* CreatureObject::createDefaultController () AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(controller); - if (aiCreatureController != NULL) + if (aiCreatureController != nullptr) { aiCreatureController->addServerNpAutoDeltaVariables(m_serverPackage_np); } @@ -2758,7 +2758,7 @@ void CreatureObject::setAuthServerProcessId(uint32 processId) if (oldProcess != getAuthServerProcessId()) { // we can't trade if we are on different servers, so cancel it - if (getCreatureController()->getSecureTrade() != NULL) + if (getCreatureController()->getSecureTrade() != nullptr) { getCreatureController()->getSecureTrade()->cancelTrade(*this); } @@ -2786,7 +2786,7 @@ float CreatureObject::alter(float time) // If the player is trading, cancel the trade. // We need to force the issue to catch edge cases. ServerSecureTrade * const secureTradeObject = getCreatureController()->getSecureTrade(); - if (secureTradeObject != NULL) + if (secureTradeObject != nullptr) { secureTradeObject->cancelTrade(*this); } @@ -2854,7 +2854,7 @@ float CreatureObject::alter(float time) if (playerObject->getIsUnsticking() && getPositionChanged()) { - Chat::sendSystemMessageSimple(*this, SharedStringIds::unstick_request_cancelled, NULL); + Chat::sendSystemMessageSimple(*this, SharedStringIds::unstick_request_cancelled, nullptr); playerObject->setIsUnsticking(false); } } @@ -2862,13 +2862,13 @@ float CreatureObject::alter(float time) if (!ServerWorld::isSpaceScene()) { // if we're in a conversation, end it if we move too far from the npc - if (m_npcConversation != NULL) + if (m_npcConversation != nullptr) { PROFILER_AUTO_BLOCK_DEFINE("CreatureObject::alter::npcConvCheck"); bool endConversation = false; // check the distance to the npc ServerObject const * const npc = safe_cast(m_npcConversation->getNPC().getObject()); - if (npc != NULL) + if (npc != nullptr) { float distance = findPosition_w().magnitudeBetween(npc->findPosition_w()); distance -= getRadius(); @@ -2894,7 +2894,7 @@ float CreatureObject::alter(float time) // see if we are performing a slow down effect Property * property = getProperty(SlowDownProperty::getClassPropertyId()); - if (property != NULL) + if (property != nullptr) { // has it expired? SlowDownProperty * slowdown = safe_cast(property); @@ -2909,7 +2909,7 @@ float CreatureObject::alter(float time) // area, and and tell them they are moving on our effect "hill" during their next alter // (player creatures are handled on the player's client) Object * target = slowdown->getTarget().getObject(); - if (target != NULL) + if (target != nullptr) { std::vector found; ServerWorld::findAuthoritativeNonPlayerCreaturesInCone(*this, *target, slowdown->getConeLength(), slowdown->getConeAngle(), found); @@ -2974,14 +2974,14 @@ bool CreatureObject::canDestroy() const // turn off our default weapon so it won't prevent us from getting // destroyed WeaponObject * defaultWeapon = getDefaultWeapon(); - if (defaultWeapon != NULL) + if (defaultWeapon != nullptr) defaultWeapon->setAsDefaultWeapon(false); bool result = TangibleObject::canDestroy(); if (!result) { // we're not being destroyed, turn our default weapon back on - if (defaultWeapon != NULL) + if (defaultWeapon != nullptr) defaultWeapon->setAsDefaultWeapon(true); } @@ -3007,22 +3007,22 @@ void CreatureObject::initializeDefaultWeapon() FATAL(!isAuthoritative(), ("CreatureObject::initializeDefaultWeapon: obj %s, while nonauth", getDebugInformation().c_str())); ServerCreatureObjectTemplate const * const myTemplate = safe_cast(getObjectTemplate()); - if (myTemplate != NULL) + if (myTemplate != nullptr) { ServerWeaponObjectTemplate const *weaponTemplate = myTemplate->getDefaultWeapon(); - if (weaponTemplate == NULL) + if (weaponTemplate == nullptr) { WARNING(true, ("Creature template %s has no valid default weapon!", getTemplateName())); // try to use the fallback weapon weaponTemplate = dynamic_cast(ObjectTemplateList::fetch(ConfigServerGame::getFallbackDefaultWeapon())); - FATAL(weaponTemplate == NULL, ("CreatureObject::initializeFirstTimeObject fallback weapon template %s is bad!", ConfigServerGame::getFallbackDefaultWeapon())); + FATAL(weaponTemplate == nullptr, ("CreatureObject::initializeFirstTimeObject fallback weapon template %s is bad!", ConfigServerGame::getFallbackDefaultWeapon())); } WeaponObject * const weapon = safe_cast(ServerWorld::createNewObject(*weaponTemplate, *this, s_defaultWeaponSlotId, false)); - if (weapon != NULL) + if (weapon != nullptr) { weapon->setAsDefaultWeapon(true); } @@ -3044,7 +3044,7 @@ bool CreatureObject::swapDefaultWeapons(WeaponObject &newDefaultWeapon, ServerOb FATAL(!newDefaultWeapon.isAuthoritative(), ("CreatureObject::swapDefaultWeapons: obj %s, weapon %s, weaponContainer %s, while newDefaultWeapon nonauth", getDebugInformation().c_str(), newDefaultWeapon.getDebugInformation().c_str(), weaponContainer.getDebugInformation().c_str())); FATAL(!weaponContainer.isAuthoritative(), ("CreatureObject::swapDefaultWeapons: obj %s, weapon %s, weaponContainer %s, while weaponContainer nonauth", getDebugInformation().c_str(), newDefaultWeapon.getDebugInformation().c_str(), weaponContainer.getDebugInformation().c_str())); - // There is a window here where the default weapon can be null, so we + // There is a window here where the default weapon can be nullptr, so we // set a flag that it's ok until we've finished the transfer. FATAL(s_allowNullDefaultWeapon, ("CreatureObject::swapDefaultWeapons has been recursively called!")); @@ -3080,12 +3080,12 @@ bool CreatureObject::swapDefaultWeapons(WeaponObject &newDefaultWeapon, ServerOb WeaponObject *CreatureObject::getDefaultWeapon() const { SlottedContainer const * const container = ContainerInterface::getSlottedContainer(*this); - if (container == NULL) + if (container == nullptr) { - return NULL; + return nullptr; } - WeaponObject * defaultWeapon = NULL; + WeaponObject * defaultWeapon = nullptr; Container::ContainerErrorCode error; Container::ContainedItem itemId = container->getObjectInSlot(s_defaultWeaponSlotId, error); if (error == Container::CEC_Success) @@ -3097,7 +3097,7 @@ WeaponObject *CreatureObject::getDefaultWeapon() const if (so) defaultWeapon = so->asWeaponObject(); } - FATAL(!s_allowNullDefaultWeapon && defaultWeapon == NULL, ("CreatureObject::getDefaultWeapon, weapon is NULL! Object in default slot is %s", itemId.getValueString().c_str())); + FATAL(!s_allowNullDefaultWeapon && defaultWeapon == nullptr, ("CreatureObject::getDefaultWeapon, weapon is nullptr! Object in default slot is %s", itemId.getValueString().c_str())); } return defaultWeapon; } @@ -3376,7 +3376,7 @@ void CreatureObject::updateSlopeMovement(const std::string & modName) recomputeSlopeModPercent(); // if I'm modifiying the group slope mod and I'm a group leader, // update my group's speed - else if (modName == GROUP_SLOPE_MOD && getGroup() != NULL && + else if (modName == GROUP_SLOPE_MOD && getGroup() != nullptr && getGroup()->getGroupLeaderId() == getNetworkId()) { const GroupObject::GroupMemberVector & members = getGroup()->getGroupMembers(); @@ -3385,7 +3385,7 @@ void CreatureObject::updateSlopeMovement(const std::string & modName) { CreatureObject * member = safe_cast( NetworkIdManager::getObjectById((*iter).first)); - if (member != NULL) + if (member != nullptr) member->recomputeSlopeModPercent(); } } @@ -3581,7 +3581,7 @@ int CreatureObject::getExperiencePoints(const std::string & experienceType) cons if (isPlayerControlled()) { const PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if (playerObject != NULL) + if (playerObject != nullptr) return playerObject->getExperiencePoints(experienceType); } return 0; @@ -3595,7 +3595,7 @@ const std::map & CreatureObject::getExperiencePoints() const if(isPlayerControlled()) { const PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if(playerObject != NULL) + if(playerObject != nullptr) { return playerObject->getExperiencePoints(); } @@ -3617,7 +3617,7 @@ const int CreatureObject::grantExperiencePoints(const std::string & experienceTy if (isPlayerControlled()) { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if (playerObject != NULL) + if (playerObject != nullptr) { int const amountGranted = playerObject->grantExperiencePoints(experienceType, amount); @@ -3770,7 +3770,7 @@ void CreatureObject::revokeSkill(const SkillObject & oldSkill, bool silent) PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if ((playerObject != NULL) && + if ((playerObject != nullptr) && (oldSkill.getSkillName() == playerObject->getTitle())) { StringId message("shared", "skill_title_removed"); @@ -3809,7 +3809,7 @@ const bool CreatureObject::grantSchematicGroup(const std::string & groupNameWith if (isPlayerControlled()) { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if (playerObject != NULL) + if (playerObject != nullptr) return playerObject->grantSchematicGroup(groupNameWithModifier, fromSkill); } return false; @@ -3829,7 +3829,7 @@ const bool CreatureObject::grantSchematic(uint32 schematicCrc, bool fromSkill) if (isPlayerControlled()) { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if (playerObject != NULL) + if (playerObject != nullptr) return playerObject->grantSchematic(schematicCrc, fromSkill); } return false; @@ -3849,7 +3849,7 @@ const bool CreatureObject::revokeSchematic(uint32 schematicCrc, bool fromSkill) if (isPlayerControlled()) { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if (playerObject != NULL) + if (playerObject != nullptr) return playerObject->revokeSchematic(schematicCrc, fromSkill); } return false; @@ -3869,7 +3869,7 @@ const bool CreatureObject::hasSchematic(uint32 schematicCrc) if (isPlayerControlled()) { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if (playerObject != NULL) + if (playerObject != nullptr) return playerObject->hasSchematic(schematicCrc); } return false; @@ -3909,7 +3909,7 @@ void CreatureObject::setInCombat(bool inCombat) PlayerObject * const player = PlayerCreatureController::getPlayerObject(this); - if (player != NULL && player->isCrafting()) + if (player != nullptr && player->isCrafting()) { player->stopCrafting(false); } @@ -4274,10 +4274,10 @@ static const int internalTagBufLen = strlen(internalTagBuf); mod.value, m_attributes[mod.attrib] + mod.value); DEBUG_REPORT_LOG (true, ("%s", debugBuffer)); - if (attacker != NULL) + if (attacker != nullptr) { Client *client = attacker->getClient(); - if (client != NULL) + if (client != nullptr) ConsoleMgr::broadcastString(debugBuffer, client); } } @@ -4359,8 +4359,8 @@ static const int internalTagBufLen = strlen(internalTagBuf); else { const char * modName = AttribModNameManager::getInstance().getAttribModName(mod.tag); - if (modName == NULL) - modName = ""; + if (modName == nullptr) + modName = ""; WARNING(true, ("Creature %s received a mod %s with invalid " "attack(%.2f) or duration(%.2f)", getNetworkId().getValueString().c_str(), modName, mod.attack, @@ -4438,7 +4438,7 @@ void CreatureObject::removeAttributeModifier (const std::string & modName) if (AttribMod::isSkillMod(m.mod)) { const char * skillModName = AttribModNameManager::getInstance().getAttribModName(m.mod.skill); - if (skillModName != NULL) + if (skillModName != nullptr) addModValue(skillModName, -m.maxVal, true); else { @@ -4569,7 +4569,7 @@ void CreatureObject::removeAllAttributeAndSkillmodMods () if (AttribMod::isSkillMod(m.mod)) { const char * skillModName = AttribModNameManager::getInstance().getAttribModName(m.mod.skill); - if (skillModName != NULL) + if (skillModName != nullptr) addModValue(skillModName, -m.maxVal, true); } // if the mod is visible, we need to tell the player it's being @@ -4582,7 +4582,7 @@ void CreatureObject::removeAllAttributeAndSkillmodMods () if (m.mod.flags & AttribMod::AMF_triggerOnDone) { const char * modName = AttribModNameManager::getInstance().getAttribModName(m.mod.tag); - if (modName != NULL) + if (modName != nullptr) { ScriptParams params; params.addParam(modName); @@ -4624,7 +4624,7 @@ void CreatureObject::removeAllAttributeAndSkillmodMods () * * @param modName the mod to look for * - * @return the mod, or NULL if there is no mod with that name attached to us + * @return the mod, or nullptr if there is no mod with that name attached to us */ const AttribMod::AttribMod * CreatureObject::getAttributeModifier( const std::string & modName) const @@ -4642,7 +4642,7 @@ const AttribMod::AttribMod * CreatureObject::getAttributeModifier( if (found != m_attributeModList.end()) return &((*found).second.mod); } - return NULL; + return nullptr; } // CreatureObject::getAttributeModifier //----------------------------------------------------------------------- @@ -4666,7 +4666,7 @@ const std::map & CreatureObject::getAttributeModifiers() co */ void CreatureObject::sendTimedModData(uint32 id, float time, bool updateCache/* = true*/) { - if (isPlayerControlled() && getController() != NULL && id != 0) + if (isPlayerControlled() && getController() != nullptr && id != 0) { MessageQueueGenericValueType > * const msg = new MessageQueueGenericValueType >( @@ -4707,7 +4707,7 @@ void CreatureObject::sendTimedModData(uint32 id, float time, bool updateCache/* */ void CreatureObject::sendCancelTimedMod(uint32 id) { - if (isPlayerControlled() && getController() != NULL && id != 0) + if (isPlayerControlled() && getController() != nullptr && id != 0) { MessageQueueGenericValueType * const msg = new MessageQueueGenericValueType(id); @@ -4764,7 +4764,7 @@ void CreatureObject::applyDamage(const CombatEngineData::DamageData &damageData) // if the attacker is a player and we are not, and we are incapped/dead, // don't allow additional damage - if (attacker != NULL && attacker->isPlayerControlled() && !isPlayerControlled() && + if (attacker != nullptr && attacker->isPlayerControlled() && !isPlayerControlled() && (isIncapacitated() || isDead())) { return; @@ -5018,7 +5018,7 @@ void CreatureObject::decayAttributes(float time) if (AttribMod::isSkillMod(m.mod)) { const char * skillModName = AttribModNameManager::getInstance().getAttribModName(m.mod.skill); - if (skillModName != NULL) + if (skillModName != nullptr) { addModValue(skillModName, -m.maxVal, true); @@ -5051,7 +5051,7 @@ void CreatureObject::decayAttributes(float time) { // tell scripts the mod has ended const char * modName = AttribModNameManager::getInstance().getAttribModName(m.mod.tag); - if (modName != NULL) + if (modName != nullptr) { ScriptParams params; params.addParam(modName); @@ -5112,7 +5112,7 @@ void CreatureObject::decayAttributes(float time) // add the skillmod mod as if it were from a skill, // which makes it temporary const char * skillModName = AttribModNameManager::getInstance().getAttribModName(m.mod.skill); - if (skillModName != NULL) + if (skillModName != nullptr) addModValue(skillModName, delta, true); else { @@ -6014,7 +6014,7 @@ static const std::map,int> npcSchematics; if (isPlayerControlled()) { PlayerObject const * const playerObject = PlayerCreatureController::getPlayerObject(this); - if (playerObject != NULL) + if (playerObject != nullptr) return playerObject->getDraftSchematics(); } return npcSchematics; @@ -6032,11 +6032,11 @@ static const std::map,int> npcSchematics; bool CreatureObject::isIngredientInInventory(const Object & ingredient) const { const ServerObject * inventory = getInventory(); - if (inventory == NULL) + if (inventory == nullptr) return false; const Object * container = ContainerInterface::getContainedByObject(ingredient); - while (container != NULL) + while (container != nullptr) { if (inventory->getNetworkId() == container->getNetworkId() || getNetworkId() == container->getNetworkId()) @@ -6057,7 +6057,7 @@ bool CreatureObject::isIngredientInInventory(const Object & ingredient) const */ void CreatureObject::disableSchematicFiltering() { - if (getClient() == NULL || !getClient()->isGod()) + if (getClient() == nullptr || !getClient()->isGod()) return; setObjVarItem(OBJVAR_DISABLE_SCHEMATIC_FILTER, 1); @@ -6071,7 +6071,7 @@ void CreatureObject::disableSchematicFiltering() */ void CreatureObject::enableSchematicFiltering() { - if (getClient() == NULL || !getClient()->isGod()) + if (getClient() == nullptr || !getClient()->isGod()) return; removeObjVarItem(OBJVAR_DISABLE_SCHEMATIC_FILTER); @@ -6087,7 +6087,7 @@ void CreatureObject::enableSchematicFiltering() */ bool CreatureObject::isSchematicFilteringEnabled() { - if (getClient() == NULL || !getClient()->isGod()) + if (getClient() == nullptr || !getClient()->isGod()) return true; return (!getObjVars().hasItem(OBJVAR_DISABLE_SCHEMATIC_FILTER)); @@ -6103,17 +6103,17 @@ bool CreatureObject::isSchematicFilteringEnabled() void CreatureObject::getManufactureSchematics(std::vector & schematics) { const ServerObject * datapad = getDatapad(); - if (datapad == NULL) + if (datapad == nullptr) return; const VolumeContainer * container = ContainerInterface::getVolumeContainer(*datapad); - if (container == NULL) + if (container == nullptr) return; for (ContainerConstIterator iter = container->begin(); iter != container->end(); ++iter) { const ManufactureSchematicObject * schematic = dynamic_cast((*iter).getObject()); - if (schematic != NULL) + if (schematic != nullptr) schematics.push_back(schematic); } } // CreatureObject::getManufactureSchematics(unfiltered) @@ -6130,17 +6130,17 @@ void CreatureObject::getManufactureSchematics(std::vector & schematics, uint32 craftingTypes) { const ServerObject * datapad = getDatapad(); - if (datapad == NULL) + if (datapad == nullptr) return; const VolumeContainer * container = ContainerInterface::getVolumeContainer(*datapad); - if (container == NULL) + if (container == nullptr) return; for (ContainerConstIterator iter = container->begin(); iter != container->end(); ++iter) { const ManufactureSchematicObject * schematic = dynamic_cast((*iter).getObject()); - if (schematic != NULL && ((schematic->getCategory() & craftingTypes) != 0)) + if (schematic != nullptr && ((schematic->getCategory() & craftingTypes) != 0)) schematics.push_back(schematic); } } // CreatureObject::getManufactureSchematics(filtered) @@ -6278,7 +6278,7 @@ void CreatureObject::setIncapacitated(bool flag, const NetworkId & attackerId) // if we are crafting, end the crafting session PlayerObject * const player = PlayerCreatureController::getPlayerObject(this); - if (player != NULL && player->isCrafting()) + if (player != nullptr && player->isCrafting()) player->stopCrafting(false); if (isInNpcConversation()) @@ -6299,7 +6299,7 @@ void CreatureObject::setIncapacitated(bool flag, const NetworkId & attackerId) // invoke incapacitation script on who incapacitated us ServerObject * attacker = safe_cast( NetworkIdManager::getObjectById(attackerId)); - if (attacker != NULL) + if (attacker != nullptr) { params.clear(); params.addParam(getNetworkId()); @@ -6308,7 +6308,7 @@ void CreatureObject::setIncapacitated(bool flag, const NetworkId & attackerId) TangibleObject * const tangibleAttacker = attacker->asTangibleObject(); - if (tangibleAttacker != NULL) + if (tangibleAttacker != nullptr) { tangibleAttacker->verifyHateList(); } @@ -6335,7 +6335,7 @@ void CreatureObject::setIncapacitated(bool flag, const NetworkId & attackerId) setPosture(Postures::Upright); } // if we are a player, send us our new posture - if ((getController() != NULL) && !isInCombat()) + if ((getController() != nullptr) && !isInCombat()) { getController()->appendMessage( CM_setPosture, @@ -6466,7 +6466,7 @@ void CreatureObject::updateMovementInfo() rider->requestMovementInfoUpdate(); else { - LOG("mounts-bug", ("CreatureObject::updateMovementInfo(): server id=[%d],mount id=[%s],has MountedCreature state but getMountingRider() returns null.", static_cast(GameServer::getInstance().getProcessId()), getNetworkId().getValueString().c_str())); + LOG("mounts-bug", ("CreatureObject::updateMovementInfo(): server id=[%d],mount id=[%s],has MountedCreature state but getMountingRider() returns nullptr.", static_cast(GameServer::getInstance().getProcessId()), getNetworkId().getValueString().c_str())); detachAllRiders(); } } @@ -6538,7 +6538,7 @@ void CreatureObject::setPosture(Postures::Enumerator newPosture, bool isClientIm // guaranteed to be the authoritative object, this is an invalid thing to do. requestMovementInfoUpdate(); - if (getScriptObject() != NULL) + if (getScriptObject() != nullptr) { ScriptParams params; params.addParam(oldPosture); @@ -6950,13 +6950,13 @@ bool CreatureObject::onContainerAboutToTransfer(ServerObject * destination, Serv int CreatureObject::onContainerAboutToGainItem(ServerObject& item, ServerObject* transferer) { TangibleObject const * const object = item.asTangibleObject(); - if (object != NULL) + if (object != nullptr) { // See if this item is equippable const char *sharedTemplateName = item.getSharedTemplateName(); if (!isAppearanceEquippable(sharedTemplateName)) { - if (getClient() != NULL) + if (getClient() != nullptr) { StringId message("shared", "item_not_equippable"); Unicode::String outOfBand; @@ -6984,7 +6984,7 @@ int CreatureObject::onContainerAboutToGainItem(ServerObject& item, ServerObject* void CreatureObject::onContainerLostItem(ServerObject *destination, ServerObject &item, ServerObject *transferer) { TangibleObject const * const tangibleObject = item.asTangibleObject(); - if (tangibleObject == NULL) + if (tangibleObject == nullptr) return; // check if the object applies skill mod bonuses when equipped @@ -7026,12 +7026,12 @@ void CreatureObject::onContainerLostItem(ServerObject *destination, ServerObject // if the item is a weapon, make our current weapon our default weapon WeaponObject const * const weaponObject = tangibleObject->asWeaponObject(); - if (weaponObject != NULL && getDefaultWeapon() != NULL) + if (weaponObject != nullptr && getDefaultWeapon() != nullptr) setCurrentWeapon(*getDefaultWeapon()); // check if the object is our shield if (tangibleObject == m_shield) - m_shield = NULL; + m_shield = nullptr; //Update wearbles data SlottedContainmentProperty* scp = ContainerInterface::getSlottedContainmentProperty(item); @@ -7060,7 +7060,7 @@ void CreatureObject::onContainerLostItem(ServerObject *destination, ServerObject void CreatureObject::onContainerGainItem(ServerObject& item, ServerObject* source, ServerObject* transferer) { TangibleObject * const tangibleObject = item.asTangibleObject(); - if (tangibleObject == NULL) + if (tangibleObject == nullptr) return; // check if the object applies skill mod bonuses when equipped @@ -7100,7 +7100,7 @@ void CreatureObject::onContainerGainItem(ServerObject& item, ServerObject* sourc // if the item is a weapon, make it our current weapon WeaponObject * const weaponObject = tangibleObject->asWeaponObject(); - if (weaponObject != NULL) + if (weaponObject != nullptr) setCurrentWeapon(*weaponObject); //Update wearables data @@ -7141,7 +7141,7 @@ void CreatureObject::onContainerGainItem(ServerObject& item, ServerObject* sourc ConstCharCrcString clientSharedTemplateNameCrcString = ObjectTemplateList::lookUp(tangibleObject->getClientSharedTemplateName()); if (clientSharedTemplateNameCrcString.isEmpty()) WARNING(true, ("Could not find crc for %s. Wearable will not be streamed to client", tangibleObject->getClientSharedTemplateName())); - else if (tangibleObject->asWeaponObject() != NULL) + else if (tangibleObject->asWeaponObject() != nullptr) { addPackedWearable(tangibleObject->getAppearanceData(), scp->getCurrentArrangement(), tangibleObject->getNetworkId(), clientSharedTemplateNameCrcString.getCrc(), tangibleObject->createSharedBaselinesMessage(), tangibleObject->createSharedNpBaselinesMessage()); @@ -7591,7 +7591,7 @@ void CreatureObject::onClientReady(Client *c) { time_t timeUnsquelch = static_cast(player->getSecondsUntilUnsquelched()); if (timeUnsquelch > 0) - timeUnsquelch += ::time(NULL); + timeUnsquelch += ::time(nullptr); GenericValueTypeMessage, int>, std::pair > > chatStatistics("ChatStatisticsGS", std::make_pair(std::make_pair(std::make_pair(getNetworkId(), static_cast(timeUnsquelch)), player->getChatSpamTimeEndInterval()), std::make_pair(player->getChatSpamSpatialNumCharacters(), player->getChatSpamNonSpatialNumCharacters()))); Chat::sendToChatServer(chatStatistics); @@ -7926,7 +7926,7 @@ bool CreatureObject::makeDead(const NetworkId & killer, const NetworkId & corpse // if we are crafting, end the crafting session PlayerObject * const player = PlayerCreatureController::getPlayerObject(this); - if (player != NULL && player->isCrafting()) + if (player != nullptr && player->isCrafting()) player->stopCrafting(false); // if we are in a conversation, end it @@ -7991,7 +7991,7 @@ bool CreatureObject::makeDead(const NetworkId & killer, const NetworkId & corpse if (AttribMod::isSkillMod(m.mod)) { const char * skillModName = AttribModNameManager::getInstance().getAttribModName(m.mod.skill); - if (skillModName != NULL) + if (skillModName != nullptr) addModValue(skillModName, -m.maxVal, true); } // if the mod is visible, we need to tell the player it's being @@ -8004,7 +8004,7 @@ bool CreatureObject::makeDead(const NetworkId & killer, const NetworkId & corpse if (m.mod.flags & AttribMod::AMF_triggerOnDone) { const char * modName = AttribModNameManager::getInstance().getAttribModName(m.mod.tag); - if (modName != NULL) + if (modName != nullptr) { ScriptParams params; params.addParam(modName); @@ -8149,7 +8149,7 @@ Object const * CreatureObject::getStandingOn() const } else { - return NULL; + return nullptr; } } @@ -8302,7 +8302,7 @@ bool CreatureObject::setSlopeModPercent(float percent) // get my skill mod int movementMod = getEnhancedModValue(SLOPE_MOD); - if (getGroup() != NULL) + if (getGroup() != nullptr) { // get my group leader skill mod const NetworkId & leaderId = getGroup()->getGroupLeaderId(); @@ -8310,7 +8310,7 @@ bool CreatureObject::setSlopeModPercent(float percent) { const CreatureObject * leader = safe_cast( NetworkIdManager::getObjectById(leaderId)); - if (leader != NULL) + if (leader != nullptr) { movementMod += leader->getEnhancedModValue(GROUP_SLOPE_MOD); } @@ -8519,7 +8519,7 @@ void CreatureObject::onBiographyRetrieved(const NetworkId &owner, const Unicode: CreatureController *creatureController = getCreatureController(); - if (creatureController != NULL) + if (creatureController != nullptr) { typedef std::pair Payload; @@ -8535,7 +8535,7 @@ void CreatureObject::onCharacterMatchRetrieved(MatchMakingCharacterResult const { CreatureController *creatureController = getCreatureController(); - if (creatureController != NULL) + if (creatureController != nullptr) { MessageQueueGenericValueType * const msg = new MessageQueueGenericValueType(results); @@ -8939,7 +8939,7 @@ bool CreatureObject::isAppearanceEquippable(const char *appearanceTemplateName) // Make sure this object has a valid appearance - if (appearanceTemplateName == NULL) + if (appearanceTemplateName == nullptr) { result = false; } @@ -9063,7 +9063,7 @@ void CreatureObject::updatePlanetServerInternal(const bool forceUpdate) const AICreatureController const * const aiCreatureController = dynamic_cast(getCreatureController()); Object const * const topmostContainer = ContainerInterface::getTopmostContainer(*this); - FATAL(!topmostContainer, ("Object %s was contained by something, but getTopmostContainer() returned NULL", getNetworkId().getValueString().c_str())); + FATAL(!topmostContainer, ("Object %s was contained by something, but getTopmostContainer() returned nullptr", getNetworkId().getValueString().c_str())); Vector const &position = topmostContainer->getPosition_p(); UpdateObjectOnPlanetMessage const msg( getNetworkId(), @@ -9265,7 +9265,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) // set objvar to indicate there's a pending rename request for this character, // and the time of the rename request, to enforce the 90 days wait between rename if (!getClient() || !getClient()->isGod()) - setObjVarItem("renameCharacterRequest.requestTime", static_cast(::time(NULL))); + setObjVarItem("renameCharacterRequest.requestTime", static_cast(::time(nullptr))); std::string const newName(message.getDataAsString()); if (getObjVars().hasItem("renameCharacterRequest.requestTime") && !newName.empty()) @@ -9306,7 +9306,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) if (!getObjVars().hasItem(OBJVAR_ADD_JEDI_ACK)) { PlayerObject * const player = PlayerCreatureController::getPlayerObject(this); - if (player != NULL) + if (player != nullptr) { player->addJediToAccount(); MessageToQueue::getInstance().sendMessageToC(getNetworkId(), @@ -9461,7 +9461,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) MessageToQueue::cancelRecurringMessageTo(getNetworkId(), "C++WaitForPatrolPreload"); AICreatureController * const aiCreatureController = safe_cast(getController()); - if (aiCreatureController != NULL) + if (aiCreatureController != nullptr) { const std::string data = message.getDataAsString(); std::string::size_type locationStart = 0; @@ -9797,7 +9797,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) Unicode::String const delimiters(Unicode::narrowToWide("|")); Unicode::UnicodeStringVector tokens; - if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, NULL)) && (tokens.size() == 2)) + if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, nullptr)) && (tokens.size() == 2)) { existingWarden = NetworkId(Unicode::wideToNarrow(tokens[0])); @@ -9874,7 +9874,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) Unicode::String const delimiters(Unicode::narrowToWide("|")); Unicode::UnicodeStringVector tokens; - if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, NULL)) && (tokens.size() == 2)) + if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, nullptr)) && (tokens.size() == 2)) { existingWarden = NetworkId(Unicode::wideToNarrow(tokens[0])); @@ -9970,12 +9970,12 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) bool success = false; NetworkId actor, actorShip, group; std::string actorName; - GroupObject const * groupObject = NULL; + GroupObject const * groupObject = nullptr; StringId responseSid; Unicode::String const delimiters(Unicode::narrowToWide("|")); Unicode::UnicodeStringVector tokens; - if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, NULL)) && (tokens.size() == 4)) + if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, nullptr)) && (tokens.size() == 4)) { success = true; actor = NetworkId(Unicode::wideToNarrow(tokens[0])); @@ -9983,8 +9983,8 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) group = NetworkId(Unicode::wideToNarrow(tokens[2])); actorName = Unicode::wideToNarrow(tokens[3]); - ServerObject const * so = (group.isValid() ? safe_cast(NetworkIdManager::getObjectById(group)) : NULL); - groupObject = (so ? so->asGroupObject() : NULL); + ServerObject const * so = (group.isValid() ? safe_cast(NetworkIdManager::getObjectById(group)) : nullptr); + groupObject = (so ? so->asGroupObject() : nullptr); } if (success) @@ -10011,7 +10011,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) if (success) { GameScriptObject* const gso = getScriptObject(); - if (gso != NULL && gso->hasScript("ai.beast")) + if (gso != nullptr && gso->hasScript("ai.beast")) { responseSid = GroupStringId::SID_GROUP_BEASTS_CANT_JOIN; success = false; @@ -10092,7 +10092,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) } else if (message.getMethod() == "C++InviteToGroupRspTargetNotFound") { - Chat::sendSystemMessageSimple(*this, GroupStringId::SID_GROUP_INVITE_NO_TARGET_SELF, NULL); + Chat::sendSystemMessageSimple(*this, GroupStringId::SID_GROUP_INVITE_NO_TARGET_SELF, nullptr); } else if (message.getMethod() == "C++GroupOperationGenericRsp") { @@ -10101,7 +10101,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) std::string const result(message.getPackedDataVector().begin(), message.getPackedDataVector().end()); Unicode::String const delimiters(Unicode::narrowToWide("|")); Unicode::UnicodeStringVector tokens; - if ((Unicode::tokenize(Unicode::narrowToWide(result), tokens, &delimiters, NULL)) && (tokens.size() == 3)) + if ((Unicode::tokenize(Unicode::narrowToWide(result), tokens, &delimiters, nullptr)) && (tokens.size() == 3)) { std::string const response(Unicode::wideToNarrow(tokens[0])); std::string const responseParmType(Unicode::wideToNarrow(tokens[1])); @@ -10138,7 +10138,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) Unicode::String const delimiters(Unicode::narrowToWide("|")); Unicode::UnicodeStringVector tokens; - if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, NULL)) && (tokens.size() == 2)) + if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, nullptr)) && (tokens.size() == 2)) { success = true; actor = NetworkId(Unicode::wideToNarrow(tokens[0])); @@ -10194,7 +10194,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) } else if (message.getMethod() == "C++UninviteFromGroupRspTargetNotFound") { - Chat::sendSystemMessageSimple(*this, GroupStringId::SID_GROUP_UNINVITE_NO_TARGET_SELF, NULL); + Chat::sendSystemMessageSimple(*this, GroupStringId::SID_GROUP_UNINVITE_NO_TARGET_SELF, nullptr); } else if (message.getMethod() == "C++GroupJoinInviterInfoReq") { @@ -10250,7 +10250,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) Unicode::String const delimiters(Unicode::narrowToWide("|")); Unicode::UnicodeStringVector tokens; - if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, NULL)) && (tokens.size() == 10)) + if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, nullptr)) && (tokens.size() == 10)) { success = true; existingGroupId = NetworkId(Unicode::wideToNarrow(tokens[0])); @@ -10265,17 +10265,17 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) inviterInCombat = (atoi(Unicode::wideToNarrow(tokens[9]).c_str()) != 0); } - GroupObject * existingGroup = NULL; + GroupObject * existingGroup = nullptr; if (success) { if (existingGroupId.isValid()) { ServerObject * so = safe_cast(NetworkIdManager::getObjectById(existingGroupId)); - existingGroup = (so ? so->asGroupObject() : NULL); + existingGroup = (so ? so->asGroupObject() : nullptr); if (!existingGroup) { success = false; - Chat::sendSystemMessageSimple(*this, GroupStringId::SID_GROUP_EXISTING_GROUP_NOT_FOUND, NULL); + Chat::sendSystemMessageSimple(*this, GroupStringId::SID_GROUP_EXISTING_GROUP_NOT_FOUND, nullptr); } } } @@ -10318,7 +10318,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) if (existingGroup && !GroupHelpers::roomInGroup(existingGroup, targets.size())) { success = false; - Chat::sendSystemMessageSimple(*this, GroupStringId::SID_GROUP_JOIN_FULL, NULL); + Chat::sendSystemMessageSimple(*this, GroupStringId::SID_GROUP_JOIN_FULL, nullptr); } } @@ -10390,7 +10390,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) } else if (message.getMethod() == "C++GroupJoinInviterInfoReqInviterNotFound") { - Chat::sendSystemMessageSimple(*this, GroupStringId::SID_GROUP_MUST_BE_INVITED, NULL); + Chat::sendSystemMessageSimple(*this, GroupStringId::SID_GROUP_MUST_BE_INVITED, nullptr); } else if (message.getMethod() == "C++LeaveGroupReq") { @@ -10417,7 +10417,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) Unicode::String const delimiters(Unicode::narrowToWide("|")); Unicode::UnicodeStringVector tokens; - if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, NULL)) && (tokens.size() == 5)) + if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, nullptr)) && (tokens.size() == 5)) { // tell group member that the group pickup point has been created if (getClient()) @@ -10767,7 +10767,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) params.addParam(msg.getDestinationGalaxy().c_str(), "destinationGalaxy"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(getNetworkId(), "handleFreeCtsValidateFailCannotCreateCharacter", dictionary->getSerializedData(), 0, false); @@ -10781,7 +10781,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) params.addParam(msg.getDestinationGalaxy().c_str(), "destinationGalaxy"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(getNetworkId(), "handleFreeCtsValidateFailDestGalaxyUnavailable", dictionary->getSerializedData(), 0, false); @@ -10801,7 +10801,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) params.addParam(msg.getDestinationGalaxy().c_str(), "destinationGalaxy"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(getNetworkId(), "handleCtsValidateFailCannotCreateCharacter", dictionary->getSerializedData(), 0, false); @@ -10815,7 +10815,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) params.addParam(msg.getDestinationGalaxy().c_str(), "destinationGalaxy"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(getNetworkId(), "handleCtsValidateFailDestGalaxyUnavailable", dictionary->getSerializedData(), 0, false); @@ -10854,7 +10854,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) params.addParam(msg.getValue().first.c_str(), "reason"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(getNetworkId(), "handleFreeCtsValidateFailNameValidation", dictionary->getSerializedData(), 0, false); @@ -10868,7 +10868,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) params.addParam(msg.getValue().first.c_str(), "reason"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(getNetworkId(), "handleCtsValidateFailNameValidation", dictionary->getSerializedData(), 0, false); @@ -10882,7 +10882,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) params.addParam(msg.getValue().second.getDestinationCharacterName().c_str(), "destinationCharacterName"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(getNetworkId(), "handleFreeCtsValidateSuccess", dictionary->getSerializedData(), 0, false); @@ -10895,7 +10895,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) params.addParam(msg.getValue().second.getDestinationCharacterName().c_str(), "destinationCharacterName"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(getNetworkId(), "handleCtsValidateSuccess", dictionary->getSerializedData(), 0, false); @@ -10906,7 +10906,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) else if (message.getMethod() == "C++PickupAllRoomItemsIntoInventory") { // use while(true) loop to use break to discontinue processing and go to the end of loop to run cleanup code - PlayerObject * playerObject = NULL; + PlayerObject * playerObject = nullptr; while (true) { playerObject = PlayerCreatureController::getPlayerObject(this); @@ -11148,7 +11148,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) else if (message.getMethod() == "C++DropAllInventoryItemsIntoRoom") { // use while(true) loop to use break to discontinue processing and go to the end of loop to run cleanup code - PlayerObject * playerObject = NULL; + PlayerObject * playerObject = nullptr; while (true) { playerObject = PlayerCreatureController::getPlayerObject(this); @@ -11355,7 +11355,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) else if (message.getMethod() == "C++RestoreDecorationLayout") { // use while(true) loop to use break to discontinue processing and go to the end of loop to run cleanup code - PlayerObject * playerObject = NULL; + PlayerObject * playerObject = nullptr; while (true) { playerObject = PlayerCreatureController::getPlayerObject(this); @@ -11681,7 +11681,7 @@ void CreatureObject::virtualOnReleaseAuthority() if(controller) { - if (getProperty(SlopeEffectProperty::getClassPropertyId()) != NULL) + if (getProperty(SlopeEffectProperty::getClassPropertyId()) != nullptr) removeProperty(SlopeEffectProperty::getClassPropertyId()); controller->setAuthority(false); } @@ -11693,7 +11693,7 @@ void CreatureObject::virtualOnLogout() { TangibleObject::virtualOnLogout(); PlayerObject * const player = PlayerCreatureController::getPlayerObject(this); - if (player != NULL) + if (player != nullptr) player->virtualOnLogout(); } @@ -11789,7 +11789,7 @@ void CreatureObject::packWearables() ConstCharCrcString clientSharedTemplateNameCrcString = ObjectTemplateList::lookUp(tang->getClientSharedTemplateName()); if (clientSharedTemplateNameCrcString.isEmpty()) WARNING(true, ("Could not find crc for [%s]. Wearable will not be streamed to client", tang->getClientSharedTemplateName())); - else if (so->asWeaponObject() != NULL) + else if (so->asWeaponObject() != nullptr) { addPackedWearable(tang->getAppearanceData(), scp->getCurrentArrangement(), tang->getNetworkId(), clientSharedTemplateNameCrcString.getCrc(), tang->createSharedBaselinesMessage(), tang->createSharedNpBaselinesMessage()); @@ -12048,7 +12048,7 @@ int CreatureObject::loadPackedHouses() ++hcdIter) { Object * const houseId = (*hcdIter).getObject(); - BuildingObject * const house = (houseId ? houseId->asServerObject()->asBuildingObject() : NULL); + BuildingObject * const house = (houseId ? houseId->asServerObject()->asBuildingObject() : nullptr); if (house && !house->getContentsLoaded()) { LOG("CustomerService", ("CharacterTransfer: starting packed house load (%s) for CTS character %s", house->getNetworkId().getValueString().c_str(), PlayerObject::getAccountDescription(this).c_str())); @@ -12612,7 +12612,7 @@ void CreatureObject::unequipAllItems() Container::ContainerErrorCode errorCode = Container::CEC_Success; Container::ContainedItem inventoryContainedItem = equipmentContainer->getObjectInSlot(s_inventorySlotId, errorCode); Object *const inventoryObjectBase = inventoryContainedItem.getObject(); - ServerObject *const inventoryObject = inventoryObjectBase ? inventoryObjectBase->asServerObject() : NULL; + ServerObject *const inventoryObject = inventoryObjectBase ? inventoryObjectBase->asServerObject() : nullptr; if (!inventoryObject || (errorCode != Container::CEC_Success)) { WARNING(true, @@ -12629,7 +12629,7 @@ void CreatureObject::unequipAllItems() if (!inventoryContainer) { WARNING(true, - ("unequipAllItems() called on object id=[%s], template=[%s] on server id=[%d]: inventory object is NULL.", + ("unequipAllItems() called on object id=[%s], template=[%s] on server id=[%d]: inventory object is nullptr.", getNetworkId().getValueString().c_str(), getObjectTemplateName(), static_cast(GameServer::getInstance().getProcessId()) @@ -12648,11 +12648,11 @@ void CreatureObject::unequipAllItems() // Get the equipment item. Container::ContainedItem containedItem = *it; Object *const objectBase = containedItem.getObject(); - ServerObject *const object = objectBase ? objectBase->asServerObject() : NULL; + ServerObject *const object = objectBase ? objectBase->asServerObject() : nullptr; if (!object) { WARNING(true, - ("null object in equipment container for object id=[%s]: equipment item id=[%s].", + ("nullptr object in equipment container for object id=[%s]: equipment item id=[%s].", getNetworkId().getValueString().c_str(), containedItem.getValueString().c_str() )); @@ -12686,7 +12686,7 @@ void CreatureObject::unequipAllItems() if (!object) continue; - ContainerInterface::transferItemToVolumeContainer(*inventoryObject, *object, NULL, errorCode); + ContainerInterface::transferItemToVolumeContainer(*inventoryObject, *object, nullptr, errorCode); WARNING(errorCode != Container::CEC_Success, ("unequipAllItems(): CreatureObject id=[%s] failed to transfer item id=[%s], template=[%s] from equipment to inventory container, container error code [%d].", getNetworkId().getValueString().c_str(), @@ -13322,18 +13322,18 @@ CreatureObject * CreatureObject::getCreatureObject(NetworkId const & networkId) CreatureObject const * CreatureObject::asCreatureObject(Object const * object) { - ServerObject const * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + ServerObject const * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - return (serverObject != NULL) ? serverObject->asCreatureObject() : NULL; + return (serverObject != nullptr) ? serverObject->asCreatureObject() : nullptr; } // ---------------------------------------------------------------------- CreatureObject * CreatureObject::asCreatureObject(Object * object) { - ServerObject * serverObject = (object != NULL) ? object->asServerObject() : NULL; + ServerObject * serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - return (serverObject != NULL) ? serverObject->asCreatureObject() : NULL; + return (serverObject != nullptr) ? serverObject->asCreatureObject() : nullptr; } // ---------------------------------------------------------------------- @@ -13474,7 +13474,7 @@ void CreatureObject::pushedMe(const NetworkId & attackerId, UNREF(defenderPos); Vector offset(getPosition_w()); - if (attacker != NULL) + if (attacker != nullptr) offset -= attacker->getPosition_w(); else offset -= attackerPos; @@ -13489,14 +13489,14 @@ void CreatureObject::pushedMe(const NetworkId & attackerId, move_p(rotate_w2p(offset)); AICreatureController *controller = dynamic_cast(getController()); - if (controller != NULL) + if (controller != nullptr) { // we only need to do this for npcs, because we'll use the update from a player's client for players // we need to do this for npcs to prevent the ai from moving them back to their previous position const Vector newPos(getPosition_p()); float closestPortalT = 0.0f; const CellProperty * destinationCell = getParentCell()->getDestinationCell(oldPos, newPos, closestPortalT); - if (destinationCell == NULL || destinationCell == getParentCell()) + if (destinationCell == nullptr || destinationCell == getParentCell()) { // no cell change controller->warpTo(getParentCell(), newPos); @@ -13576,7 +13576,7 @@ bool CreatureObject::addSlowDownEffectProxy(const TangibleObject & defender, flo { // if we already are doing a slowdown, don't do another Property * property = getProperty(SlowDownProperty::getClassPropertyId()); - if (property != NULL) + if (property != nullptr) return false; property = new SlowDownProperty(*this, CachedNetworkId(defender), coneLength, coneAngle, slopeAngle, expireTime); @@ -13598,11 +13598,11 @@ void CreatureObject::removeSlowDownEffect() // tell all my proxies (client and server) to remove the effect Controller * const controller = getController(); if (controller) - controller->appendMessage(CM_removeSlowDownEffectProxy, 0, NULL, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_ALL_CLIENT | GameControllerMessageFlags::DEST_PROXY_SERVER); + controller->appendMessage(CM_removeSlowDownEffectProxy, 0, nullptr, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_ALL_CLIENT | GameControllerMessageFlags::DEST_PROXY_SERVER); } else { - sendControllerMessageToAuthServer(CM_removeSlowDownEffect, NULL); + sendControllerMessageToAuthServer(CM_removeSlowDownEffect, nullptr); } } @@ -13613,7 +13613,7 @@ void CreatureObject::removeSlowDownEffect() */ void CreatureObject::removeSlowDownEffectProxy() { - if (getProperty(SlowDownProperty::getClassPropertyId()) != NULL) + if (getProperty(SlowDownProperty::getClassPropertyId()) != nullptr) removeProperty(SlowDownProperty::getClassPropertyId()); } @@ -13631,7 +13631,7 @@ void CreatureObject::addTerrainSlopeEffect(const Vector & normal) if (isAuthoritative() && !isPlayerControlled()) { Property * property = getProperty(SlopeEffectProperty::getClassPropertyId()); - if (property == NULL) + if (property == nullptr) { property = new SlopeEffectProperty(*this); addProperty(*property, true); @@ -13994,7 +13994,7 @@ void CreatureObject::setLevel(int level) else { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if (playerObject == NULL) + if (playerObject == nullptr) { // this is an ai, so just set the level m_level = (int16) level; @@ -14014,7 +14014,7 @@ void CreatureObject::setLevel(int level) void CreatureObject::recalculateLevel() { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if (playerObject != NULL) + if (playerObject != nullptr) { if (!isAuthoritative()) { @@ -14044,7 +14044,7 @@ void CreatureObject::recalculateLevel() void CreatureObject::setLevelData(int16 level, int levelXp, int health) { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if (playerObject != NULL) + if (playerObject != nullptr) { m_totalLevelXp = levelXp; @@ -14278,7 +14278,7 @@ bool CreatureObject::doesLocomotionInvalidateCommand(Command const &cmd) const CommandQueue * CreatureObject::getCommandQueue() const { - if (m_commandQueue == NULL) + if (m_commandQueue == nullptr) { m_commandQueue = CommandQueue::getCommandQueue(*const_cast(this)); } @@ -14667,7 +14667,7 @@ void CreatureObject::incrementKillMeter(int amount) if (isPlayerControlled()) { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if (playerObject != NULL) + if (playerObject != nullptr) { playerObject->incrementKillMeter(amount); } @@ -14812,7 +14812,7 @@ void CreatureObject::getLfgCharacterData(LfgCharacterData & lfgCharacterData) co Vector const creaturePosition = findPosition_w(); Region const * const region = RegionMaster::getSmallestVisibleRegionAtPoint(planetObject->getName(), creaturePosition.x, creaturePosition.z); - if (region != NULL) + if (region != nullptr) lfgCharacterData.locationRegion = Unicode::wideToNarrow(region->getName()); // handle factional presence @@ -14853,7 +14853,7 @@ void CreatureObject::getLfgCharacterData(LfgCharacterData & lfgCharacterData) co { // is factional presence allowed while mounted? if (ConfigServerGame::getGcwFactionalPresenceMountedPct() <= 0) - playerOrMount = NULL; + playerOrMount = nullptr; } else { @@ -14863,7 +14863,7 @@ void CreatureObject::getLfgCharacterData(LfgCharacterData & lfgCharacterData) co if (playerOrMount) { CollisionProperty const * const collisionProperty = playerOrMount->getCollisionProperty(); - Footprint const * const footprint = (collisionProperty ? collisionProperty->getFootprint() : NULL); + Footprint const * const footprint = (collisionProperty ? collisionProperty->getFootprint() : nullptr); bool isOnSolidFloor = (footprint && footprint->isOnSolidFloor()); if (isOnSolidFloor) { @@ -14939,7 +14939,7 @@ void CreatureObject::getLfgCharacterData(LfgCharacterData & lfgCharacterData) co if (i.getValue(ctsTransactionDetail)) { Unicode::UnicodeStringVector tokens; - if (Unicode::tokenize(ctsTransactionDetail, tokens, NULL, NULL) && (tokens.size() >= 4)) + if (Unicode::tokenize(ctsTransactionDetail, tokens, nullptr, nullptr) && (tokens.size() >= 4)) { IGNORE_RETURN(lfgCharacterData.ctsSourceGalaxy.insert(Unicode::wideToNarrow(tokens[1]))); } @@ -15094,7 +15094,7 @@ void CreatureObjectNamespace::restoreItemDecorationLayout(CreatureObject & decor // item is not currently in the target room, need to move it bool needToMoveItem = false; bool needToRotateItem = false; - Transform const * itemCurrentTransform = NULL; + Transform const * itemCurrentTransform = nullptr; if (itemContainingCell->getNetworkId() != cellSo->getNetworkId()) { needToMoveItem = true; @@ -15344,7 +15344,7 @@ void CreatureObject::addPackedAppearanceWearable(std::string const &appearanceDa } } //-- Add the new entry. - m_wearableAppearanceData.push_back(WearableEntry(appearanceData, arrangementIndex, networkId, sharedTemplateCrcValue, NULL, NULL)); + m_wearableAppearanceData.push_back(WearableEntry(appearanceData, arrangementIndex, networkId, sharedTemplateCrcValue, nullptr, nullptr)); } // ---------------------------------------------------------------------- @@ -15511,7 +15511,7 @@ void CreatureObject::saveDecorationLayout(ServerObject const & pobSourceObject, } snprintf(buffer1, sizeof(buffer1)-1, "savedDecoration%d.saveTime", saveSlotNumber); - playerObj->setObjVarItem(buffer1, static_cast(::time(NULL))); + playerObj->setObjVarItem(buffer1, static_cast(::time(nullptr))); snprintf(buffer1, sizeof(buffer1)-1, "savedDecoration%d.pobName", saveSlotNumber); playerObj->setObjVarItem(buffer1, containingPOB->getObjectNameStringId().localize()); @@ -15607,7 +15607,7 @@ void CreatureObject::restoreDecorationLayout(ServerObject const & pobTargetObjec } // don't allow another restore on the pob while one is still in progress - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); int restoreDecorationOperationTimeout = 0; if (getObjVars().getItem("restoreDecorationOperation.timeout", restoreDecorationOperationTimeout) && (restoreDecorationOperationTimeout > timeNow)) { diff --git a/engine/server/library/serverGame/src/shared/object/CreatureObject.h b/engine/server/library/serverGame/src/shared/object/CreatureObject.h index f2fb0607..a1fab43b 100755 --- a/engine/server/library/serverGame/src/shared/object/CreatureObject.h +++ b/engine/server/library/serverGame/src/shared/object/CreatureObject.h @@ -194,7 +194,7 @@ public: virtual void onClientReady (Client *c); virtual void onClientAboutToLoad(); virtual void onLoadingScreenComplete(); - virtual bool canManipulateObject(ServerObject const &target, bool movingObject, bool doPermissionCheckOnItem, bool doPermissionCheckOnParent, float maxDistance, Container::ContainerErrorCode&, bool skipNoTradeCheck = false, bool * allowedByGodMode = NULL) const; + virtual bool canManipulateObject(ServerObject const &target, bool movingObject, bool doPermissionCheckOnItem, bool doPermissionCheckOnParent, float maxDistance, Container::ContainerErrorCode&, bool skipNoTradeCheck = false, bool * allowedByGodMode = nullptr) const; virtual void onRemovingFromWorld(); void addMembersToPackages(); @@ -330,7 +330,7 @@ public: void addAttributeModifier(const std::string & name, Attributes::Enumerator attrib, int value, float duration, float attackRate, float decayRate, int flags); void addSkillmodModifier(const std::string & name, const std::string & skill, int value, float duration, int flags); - int addAttributeModifier(const AttribMod::AttribMod & mod, ServerObject * attacker = NULL); + int addAttributeModifier(const AttribMod::AttribMod & mod, ServerObject * attacker = nullptr); bool hasAttribModifier(const std::string & modName) const; void removeAttributeModifier(const std::string & modName); void removeAttributeModifiers(Attributes::Enumerator attribute); @@ -747,7 +747,7 @@ private: void testIncapacitation(const NetworkId & attackerId); void initializeNewPlayer (); - void addPackedWearable(std::string const &appearanceData, int arrangementIndex, NetworkId const &networkId, uint32 sharedTemplateCrcValue, const BaselinesMessage * weaponSharedBaselines = NULL, const BaselinesMessage * weaponSharedNpBaselines = NULL); + void addPackedWearable(std::string const &appearanceData, int arrangementIndex, NetworkId const &networkId, uint32 sharedTemplateCrcValue, const BaselinesMessage * weaponSharedBaselines = nullptr, const BaselinesMessage * weaponSharedNpBaselines = nullptr); void addPackedAppearanceWearable(std::string const &appearanceData, int arrangementIndex, NetworkId const &networkId, uint32 sharedTemplateCrcValue); void packWearables(); void computeTotalAttributes (); diff --git a/engine/server/library/serverGame/src/shared/object/CreatureObject_Mounts.cpp b/engine/server/library/serverGame/src/shared/object/CreatureObject_Mounts.cpp index 1b164c1e..a0367619 100755 --- a/engine/server/library/serverGame/src/shared/object/CreatureObject_Mounts.cpp +++ b/engine/server/library/serverGame/src/shared/object/CreatureObject_Mounts.cpp @@ -77,18 +77,18 @@ CreatureObject * CreatureObjectNamespace::realGetMountingRider(CreatureObject co { //-- Ensure mounts are enabled. if (!ConfigServerGame::getMountsEnabled()) - return NULL; + return nullptr; //-- Get the rider element from the slotted container. SlottedContainer const * const slottedContainer = ContainerInterface::getSlottedContainer(*mount); if (!slottedContainer) - return NULL; + return nullptr; //-- Check for a rider. Container::ContainerErrorCode errorCode = Container::CEC_Success; CachedNetworkId riderId = slottedContainer->getObjectInSlot(slot, errorCode); if (errorCode != Container::CEC_Success) - return NULL; + return nullptr; Object * const riderObject = riderId.getObject(); @@ -236,7 +236,7 @@ bool CreatureObjectNamespace::realDetachRider(CreatureObject * const mount, Slot { // Transfer rider to world. // @todo: -TRF- transfer to mount's cell if we allow mounts inside cells. - IGNORE_RETURN(ContainerInterface::transferItemToWorld(*rider, mount->getTransform_o2w(), NULL, errorCode)); + IGNORE_RETURN(ContainerInterface::transferItemToWorld(*rider, mount->getTransform_o2w(), nullptr, errorCode)); if (errorCode == Container::CEC_Success) { detachedRider = true; @@ -318,7 +318,7 @@ void CreatureObject::transferRiderPositionToMount() CreatureObject *const mountObject = getMountedCreature(); if (!mountObject) { - LOG("mounts-bug", ("CreatureObject::transferRiderPositionToMount(): server id=[%d],object id=[%s] has state RidingMount but getMountedCreature() returns NULL.", static_cast(GameServer::getInstance().getProcessId()), getNetworkId().getValueString().c_str())); + LOG("mounts-bug", ("CreatureObject::transferRiderPositionToMount(): server id=[%d],object id=[%s] has state RidingMount but getMountedCreature() returns nullptr.", static_cast(GameServer::getInstance().getProcessId()), getNetworkId().getValueString().c_str())); emergencyDismountForRider(); return; } @@ -397,7 +397,7 @@ void CreatureObject::alterAuthoritativeForMounts() } } else - LOG(cs_mountErrorChannelName, ("unexpected: rider object id=[%s],template=[%s] is reporting state States::RidingMount turned on but getMountedCreature() returned NULL.", getNetworkId().getValueString().c_str(), getObjectTemplateName())); + LOG(cs_mountErrorChannelName, ("unexpected: rider object id=[%s],template=[%s] is reporting state States::RidingMount turned on but getMountedCreature() returned nullptr.", getNetworkId().getValueString().c_str(), getObjectTemplateName())); } else if (getState(States::MountedCreature)) { @@ -484,7 +484,7 @@ void CreatureObject::alterAnyForMounts() if (isAuthoritative() && !getState(States::MountedCreature)) { WARNING(true, - ("mounts sanity check failure: game server id=[%d], mount id=[%s,%s], rider id=[%s,%s]: authoritative mount does not have MountedCreature state set but getMountingRider returned a non-NULL value.", + ("mounts sanity check failure: game server id=[%d], mount id=[%s,%s], rider id=[%s,%s]: authoritative mount does not have MountedCreature state set but getMountingRider returned a non-nullptr value.", static_cast(GameServer::getInstance().getProcessId()), getNetworkId().getValueString().c_str(), isAuthoritative() ? "authoritative" : "proxy", @@ -511,7 +511,7 @@ void CreatureObject::alterAnyForMounts() // Ensure we don't have the mounted creature state set (only do check on authoritative mount). WARNING(isAuthoritative() && getState(States::MountedCreature), - ("mounts sanity check failure: game server id=[%d], mount id=[%s,%s]: authoritative mount does have MountedCreature state set but getMountingRider() returned a NULL value.", + ("mounts sanity check failure: game server id=[%d], mount id=[%s,%s]: authoritative mount does have MountedCreature state set but getMountingRider() returned a nullptr value.", static_cast(GameServer::getInstance().getProcessId()), getNetworkId().getValueString().c_str(), isAuthoritative() ? "authoritative" : "proxy" @@ -550,7 +550,7 @@ void CreatureObject::alterAnyForMounts() if (isAuthoritative() && !getState(States::RidingMount)) { WARNING(true, - ("mounts sanity check failure: game server id=[%d], rider id=[%s,%s], mount id=[%s,%s]: authoritative rider does not have RidingMount state set but getMountedCreature() returned a non-NULL value.", + ("mounts sanity check failure: game server id=[%d], rider id=[%s,%s], mount id=[%s,%s]: authoritative rider does not have RidingMount state set but getMountedCreature() returned a non-nullptr value.", static_cast(GameServer::getInstance().getProcessId()), getNetworkId().getValueString().c_str(), isAuthoritative() ? "authoritative" : "proxy", @@ -576,7 +576,7 @@ void CreatureObject::alterAnyForMounts() { // Ensure we don't have the RidingMount state set (only do check on authoritative rider). WARNING(isAuthoritative() && getState(States::RidingMount), - ("mounts sanity check failure: game server id=[%d], rider id=[%s,%s]: authoritative rider does have RidingMount state set but getMountedCreature() returned a NULL value.", + ("mounts sanity check failure: game server id=[%d], rider id=[%s,%s]: authoritative rider does have RidingMount state set but getMountedCreature() returned a nullptr value.", static_cast(GameServer::getInstance().getProcessId()), getNetworkId().getValueString().c_str(), isAuthoritative() ? "authoritative" : "proxy" @@ -599,13 +599,13 @@ bool CreatureObject::onContainerAboutToTransferForMounts(ServerObject const * de // (i.e. the container creature has not yet been set.) We must clear the RidingMount // state on a rider prior to intentionally dismounting the rider (see and use detachRider() // on the mount object. - bool const canChangeContainerNow = (getMountedCreature() == NULL); + bool const canChangeContainerNow = (getMountedCreature() == nullptr); if (!canChangeContainerNow) { LOG("mounts-bug", ("CO::onContainerAboutToTransferForMounts():server id=[%d],rider id=[%s] erroneously tried to transfer the player into object id=[%s].", static_cast(GameServer::getInstance().getProcessId()), getNetworkId().getValueString().c_str(), - (destination == NULL) ? "" : destination->getNetworkId().getValueString().c_str())); + (destination == nullptr) ? "" : destination->getNetworkId().getValueString().c_str())); } return canChangeContainerNow; } @@ -839,7 +839,7 @@ bool CreatureObject::detachAllRiders() if (!isAuthoritative()) { // add a plural message - sendControllerMessageToAuthServer(CM_detachAllRidersForMount, NULL); + sendControllerMessageToAuthServer(CM_detachAllRidersForMount, nullptr); return true; } @@ -988,9 +988,9 @@ bool CreatureObject::mountCreature(CreatureObject &mountObject) for (int i = 0; i < maxSlots; ++i) { - if (ContainerInterface::canTransferToSlot(mountObject, *this, s_riderSlotId[i], NULL, errorCode)) + if (ContainerInterface::canTransferToSlot(mountObject, *this, s_riderSlotId[i], nullptr, errorCode)) { - transferSuccess = ContainerInterface::transferItemToSlottedContainer(mountObject, *this, s_riderSlotId[i], NULL, errorCode); + transferSuccess = ContainerInterface::transferItemToSlottedContainer(mountObject, *this, s_riderSlotId[i], nullptr, errorCode); if ((transferSuccess) && (errorCode == Container::CEC_Success)) { @@ -1051,20 +1051,20 @@ CreatureObject *CreatureObject::getMountedCreature() { //-- Ensure mounts are enabled. if (!ConfigServerGame::getMountsEnabled()) - return NULL; + return nullptr; //-- Check this creature's container object. ServerObject *const container = safe_cast(ContainerInterface::getContainedByObject(*this)); if (!container) - return NULL; + return nullptr; //-- Check if the container is a creature. CreatureObject *const creatureContainer = container->asCreatureObject(); if (!creatureContainer) - return NULL; + return nullptr; //-- Ignore non-mountable creature objects. - CreatureObject *const mount = creatureContainer->isMountable() ? creatureContainer : NULL; + CreatureObject *const mount = creatureContainer->isMountable() ? creatureContainer : nullptr; return mount; } @@ -1096,7 +1096,7 @@ void CreatureObject::emergencyDismountForRider() //-- Pass request along to authoritative server if we're not it. if (!isAuthoritative()) { - sendControllerMessageToAuthServer(CM_emergencyDismountForRider, NULL); + sendControllerMessageToAuthServer(CM_emergencyDismountForRider, nullptr); return; } @@ -1116,7 +1116,7 @@ void CreatureObject::emergencyDismountForRider() //-- Transfer the rider to the world cell. Container::ContainerErrorCode errorCode = Container::CEC_Success; - bool const transferSucceeded = ContainerInterface::transferItemToWorld (*this, this->getTransform_o2w(), NULL, errorCode); + bool const transferSucceeded = ContainerInterface::transferItemToWorld (*this, this->getTransform_o2w(), nullptr, errorCode); WARNING(!transferSucceeded || (errorCode != Container::CEC_Success), ("Transfer to world failed, return value=[%s], error code=[%d].", transferSucceeded ? "true" : "false", static_cast(errorCode))); } diff --git a/engine/server/library/serverGame/src/shared/object/CreatureObject_Ships.cpp b/engine/server/library/serverGame/src/shared/object/CreatureObject_Ships.cpp index 3f9de076..a72020be 100755 --- a/engine/server/library/serverGame/src/shared/object/CreatureObject_Ships.cpp +++ b/engine/server/library/serverGame/src/shared/object/CreatureObject_Ships.cpp @@ -71,7 +71,7 @@ bool CreatureObject::pilotShip(ServerObject &pilotSlotObject) SlotId const pilotSlotId = pilotSlotObject.asShipObject() ? ShipSlotIdManager::getShipPilotSlotId() : ShipSlotIdManager::getPobShipPilotSlotId(); Container::ContainerErrorCode errorCode = Container::CEC_Success; - bool const transferSuccess = ContainerInterface::transferItemToSlottedContainer(pilotSlotObject, *this, pilotSlotId, NULL, errorCode); + bool const transferSuccess = ContainerInterface::transferItemToSlottedContainer(pilotSlotObject, *this, pilotSlotId, nullptr, errorCode); DEBUG_FATAL(transferSuccess && (errorCode != Container::CEC_Success), ("pilotShip(): transferItemToSlottedContainer() returned success but container error code returned error %d.", static_cast(errorCode))); if (transferSuccess) @@ -199,7 +199,7 @@ void CreatureObject::getAllShipsInDatapad(std::vector & result) const for(ContainerConstIterator iter = datapadContainer->begin(); iter != datapadContainer->end(); ++iter) { Object const * const itemO = (*iter).getObject(); - ServerObject const * const itemSO = itemO ? itemO->asServerObject() : NULL; + ServerObject const * const itemSO = itemO ? itemO->asServerObject() : nullptr; if(itemSO && (itemSO->getGameObjectType() == SharedObjectTemplate::GOT_data_ship_control_device)) { Container const * const itemContainer = ContainerInterface::getContainer(*itemSO); @@ -211,8 +211,8 @@ void CreatureObject::getAllShipsInDatapad(std::vector & result) const for(ContainerConstIterator iter2 = itemContainer->begin(); iter2 != itemContainer->end(); ++iter2) { Object const * const o = (*iter2).getObject(); - ServerObject const * const so = o ? o->asServerObject() : NULL; - ShipObject const * const ship = so ? so->asShipObject() : NULL; + ServerObject const * const so = o ? o->asServerObject() : nullptr; + ShipObject const * const ship = so ? so->asShipObject() : nullptr; if(ship) { result.push_back(ship->getNetworkId()); diff --git a/engine/server/library/serverGame/src/shared/object/DraftSchematicObject.cpp b/engine/server/library/serverGame/src/shared/object/DraftSchematicObject.cpp index 37ea045c..b0ec57ba 100755 --- a/engine/server/library/serverGame/src/shared/object/DraftSchematicObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/DraftSchematicObject.cpp @@ -36,8 +36,8 @@ static const std::string REQUEST_RESOURCE_WEIGHTS_SCRIPT_METHOD("OnRequestResour // ====================================================================== // static members -DraftSchematicObject::SchematicMap * DraftSchematicObject::m_schematics = NULL; -const SharedObjectTemplate * DraftSchematicObject::m_defaultSharedTemplate = NULL; +DraftSchematicObject::SchematicMap * DraftSchematicObject::m_schematics = nullptr; +const SharedObjectTemplate * DraftSchematicObject::m_defaultSharedTemplate = nullptr; // ====================================================================== @@ -105,13 +105,13 @@ const SharedObjectTemplate * DraftSchematicObject::getDefaultSharedTemplate(void { static const ConstCharCrcLowerString templateName("object/draft_schematic/base/shared_draft_schematic_default.iff"); - if (m_defaultSharedTemplate == NULL) + if (m_defaultSharedTemplate == nullptr) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create " + WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create " "default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) ExitChain::add (removeDefaultTemplate, "DraftSchematicObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -124,10 +124,10 @@ static const ConstCharCrcLowerString templateName("object/draft_schematic/base/s */ void DraftSchematicObject::removeDefaultTemplate(void) { - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } // DraftSchematicObject::removeDefaultTemplate @@ -141,21 +141,21 @@ void DraftSchematicObject::removeDefaultTemplate(void) */ void DraftSchematicObject::requestResourceWeights(ServerObject & requester, uint32 draftSchematicCrc) { - if (requester.getClient() == NULL) + if (requester.getClient() == nullptr) { WARNING (true, ("DraftSchematicObject::requestResourceWeights invalid client for [%s]", requester.getNetworkId ().getValueString ().c_str ())); return; } const DraftSchematicObject * const schematic = getSchematic(draftSchematicCrc); - if (schematic == NULL) + if (schematic == nullptr) { WARNING (true, ("DraftSchematicObject::requestResourceWeights invalid schematic [%lu] for [%s]", draftSchematicCrc, requester.getNetworkId ().getValueString ().c_str ())); return; } const ServerDraftSchematicObjectTemplate * const schematicTemplate = safe_cast(schematic->getObjectTemplate()); - if (schematicTemplate == NULL) + if (schematicTemplate == nullptr) { WARNING (true, ("DraftSchematicObject::requestResourceWeights invalid schematic template [%lu] for [%s]", draftSchematicCrc, requester.getNetworkId ().getValueString ().c_str ())); return; @@ -167,7 +167,7 @@ void DraftSchematicObject::requestResourceWeights(ServerObject & requester, uint desiredAttribs.push_back((*i).first.getText().c_str()); } - std::vector attributes(MAX_ATTRIBUTES * 2, static_cast(NULL)); + std::vector attributes(MAX_ATTRIBUTES * 2, static_cast(nullptr)); std::vector slots(MAX_ATTRIBUTES * 2, 0); std::vector counts(MAX_ATTRIBUTES * 2, 0); std::vector weights(MAX_ATTRIBUTES * 2 * Crafting::RA_numResourceAttributes * 2, 0); @@ -198,7 +198,7 @@ void DraftSchematicObject::requestResourceWeights(ServerObject & requester, uint for (std::vector::const_iterator i(newAttributes.begin()); i != newAttributes.end(); ++i, ++attribCount) { - if (*i == NULL) + if (*i == nullptr) break; } } @@ -257,8 +257,8 @@ ManufactureSchematicObject * DraftSchematicObject::createManufactureSchematic( { Object * object = ServerManufactureSchematicObjectTemplate::createObject( "object/manufacture_schematic/generic_schematic.iff", *this); - if (object == NULL) - return NULL; + if (object == nullptr) + return nullptr; ManufactureSchematicObject * schematic = safe_cast(object); schematic->init(*this, creator); schematic->setNetworkId(ObjectIdManager::getInstance().getNewObjectId()); @@ -478,8 +478,8 @@ const DraftSchematicObject * DraftSchematicObject::getSchematic( const DraftSchematicObject * DraftSchematicObject::getSchematic(uint32 crc) { NOT_NULL(m_schematics); - if (m_schematics == NULL || crc == 0) - return NULL; + if (m_schematics == nullptr || crc == 0) + return nullptr; // see if the schematic is already loaded SchematicMap::iterator result = m_schematics->find(crc); @@ -491,30 +491,30 @@ const DraftSchematicObject * DraftSchematicObject::getSchematic(uint32 crc) if (name.isEmpty()) { WARNING(true, ("Unable to find template name for crc %u", crc)); - return NULL; + return nullptr; } // create a new schematic if (!TreeFile::exists(name.getString())) { WARNING(true, ("Draft schematic template %s file not found", name.getString())); - return NULL; + return nullptr; } const ObjectTemplate * objTemplate = ObjectTemplateList::fetch(name); - if (objTemplate == NULL) + if (objTemplate == nullptr) { WARNING(true, ("Can't create object template %s", name.getString())); - return NULL; + return nullptr; } const ServerDraftSchematicObjectTemplate * schematicTemplate = dynamic_cast(objTemplate); - if (schematicTemplate == NULL) + if (schematicTemplate == nullptr) { WARNING(true, ("Template %s is not a draft schematic", name.getString())); objTemplate->releaseReference(); - return NULL; + return nullptr; } const DraftSchematicObject * schematic = new DraftSchematicObject(schematicTemplate); @@ -531,7 +531,7 @@ const DraftSchematicObject * DraftSchematicObject::getSchematic(uint32 crc) */ void DraftSchematicObject::install() { - if (m_schematics == NULL) + if (m_schematics == nullptr) m_schematics = new SchematicMap(); } // DraftSchematicObject::install @@ -542,16 +542,16 @@ void DraftSchematicObject::install() */ void DraftSchematicObject::remove() { - if (m_schematics != NULL) + if (m_schematics != nullptr) { SchematicMap::iterator iter; for (iter = m_schematics->begin(); iter != m_schematics->end(); ++iter) { delete (*iter).second; - (*iter).second = NULL; + (*iter).second = nullptr; } delete m_schematics; - m_schematics = NULL; + m_schematics = nullptr; } } // DraftSchematicObject::remove diff --git a/engine/server/library/serverGame/src/shared/object/FactoryObject.cpp b/engine/server/library/serverGame/src/shared/object/FactoryObject.cpp index 77e6780b..66481dad 100755 --- a/engine/server/library/serverGame/src/shared/object/FactoryObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/FactoryObject.cpp @@ -58,7 +58,7 @@ static const StringId STRING_ID_CANT_SPLIT("system_msg", "cant_split_crate"); //---------------------------------------------------------------------- -const SharedObjectTemplate * FactoryObject::m_defaultSharedTemplate = NULL; +const SharedObjectTemplate * FactoryObject::m_defaultSharedTemplate = nullptr; //----------------------------------------------------------------------- @@ -176,7 +176,7 @@ void FactoryObject::onLoadedFromDatabase() if (getLoadContents() && getCount() > 0) { // verify that we have a contained object - if (getContainedObject() == NULL) + if (getContainedObject() == nullptr) { WARNING_STRICT_FATAL(true, ("Factory object %s has a count of %d, " "but no contained object! We are setting the count to 0.", @@ -197,11 +197,11 @@ const SharedObjectTemplate * FactoryObject::getDefaultSharedTemplate() const { static const ConstCharCrcLowerString templateName("object/factory/base/shared_factory_default.iff"); - if (m_defaultSharedTemplate == NULL) + if (m_defaultSharedTemplate == nullptr) { m_defaultSharedTemplate = safe_cast(ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != NULL) + WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create default shared object template %s", templateName.getString())); + if (m_defaultSharedTemplate != nullptr) ExitChain::add (removeDefaultTemplate, "FactoryObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -214,10 +214,10 @@ const SharedObjectTemplate * FactoryObject::getDefaultSharedTemplate() const */ void FactoryObject::removeDefaultTemplate() { - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } // FactoryObject::removeDefaultTemplate @@ -288,10 +288,10 @@ bool FactoryObject::isFactoryOk() const char errBuffer[BUFSIZE]; const DraftSchematicObject * draft = DraftSchematicObject::getSchematic( getDraftSchematic()); - if (draft != NULL) + if (draft != nullptr) { // make sure we have an object instance defined - if (getCount() > 0 && getContainedObject() == NULL) + if (getCount() > 0 && getContainedObject() == nullptr) { sprintf(errBuffer, "not having a contained object instance"); factoryOk = false; @@ -307,16 +307,16 @@ bool FactoryObject::isFactoryOk() const { // send out logs/emails m_badFactoryLogged = true; - const ServerObject * owner = NULL; + const ServerObject * owner = nullptr; const Object * object = NetworkIdManager::getObjectById(getOwnerId()); - if (object != NULL) + if (object != nullptr) owner = object->asServerObject(); // log that the schematic can't be used LOG("CustomerService", ("Crafting: factory crate object %s " "owned by %s is unuseable due to %s", getNetworkId().getValueString().c_str(), PlayerObject::getAccountDescription(owner).c_str(), errBuffer)); - if (owner != NULL) + if (owner != nullptr) { // send mail to the owner telling them their schematic can't be used const static StringId message("system_msg", "crate_unuseable"); @@ -351,7 +351,7 @@ bool FactoryObject::canDestroy() const OutOfBandPackager::pack(pp, -1, oob); } const Object * const owner = NetworkIdManager::getObjectById(getOwnerId()); - if (owner != NULL) + if (owner != nullptr) { Chat::sendSystemMessage(*(owner->asServerObject()), Unicode::emptyString, oob); } @@ -367,14 +367,14 @@ bool FactoryObject::canDestroy() const void FactoryObject::onContainerTransfer(ServerObject * destination, ServerObject* transferer) { - if (inCraftingSession() && destination != NULL && + if (inCraftingSession() && destination != nullptr && destination->getNetworkId() != m_craftingSchematic.get()) { if (!isFactoryOk()) return; Object * schematic = m_craftingSchematic.get().getObject(); - if (schematic == NULL) + if (schematic == nullptr) { WARNING(true, ("FactoryObject::onContainerTransfer: could not get the schematic for factory %s", getNetworkId().getValueString().c_str())); return; @@ -387,13 +387,13 @@ void FactoryObject::onContainerTransfer(ServerObject * destination, // our components to reference if (m_craftingCount.get() != 0) { - FactoryObject * newFactory = NULL; + FactoryObject * newFactory = nullptr; if (getCount() > 1) { // make a new factory in the manf schematic newFactory = makeCopy(*(m_craftingSchematic.get().getObject()-> asServerObject()), 1); - if (newFactory != NULL) + if (newFactory != nullptr) { // NOTE: potential dupe here, but the player shouldn't be able to // remove the new factory without decreasing the component count @@ -403,26 +403,26 @@ void FactoryObject::onContainerTransfer(ServerObject * destination, // swap the contained item instances so that any current references // will point to a local object TangibleObject * myObject = const_cast(getContainedObject()); - if (myObject == NULL) + if (myObject == nullptr) { - WARNING(true, ("FactoryObject::onContainerTransfer: getContainedObject for %s returned NULL", getNetworkId().getValueString().c_str())); + WARNING(true, ("FactoryObject::onContainerTransfer: getContainedObject for %s returned nullptr", getNetworkId().getValueString().c_str())); return; } TangibleObject * newObject = const_cast(newFactory->getContainedObject()); - if (newObject == NULL) + if (newObject == nullptr) { - WARNING(true, ("FactoryObject::onContainerTransfer: getContainedObject for %s returned NULL", newFactory->getNetworkId().getValueString().c_str())); + WARNING(true, ("FactoryObject::onContainerTransfer: getContainedObject for %s returned nullptr", newFactory->getNetworkId().getValueString().c_str())); newFactory->permanentlyDestroy(DeleteReasons::SetupFailed); return; } Container::ContainerErrorCode error; - if (!ContainerInterface::transferItemToVolumeContainer (*newFactory, *myObject, NULL, error)) + if (!ContainerInterface::transferItemToVolumeContainer (*newFactory, *myObject, nullptr, error)) { WARNING(true, ("FactoryObject::onContainerTransfer: could not transfer factory %s to container %s", newFactory->getNetworkId().getValueString().c_str(), myObject->getNetworkId().getValueString().c_str())); newFactory->permanentlyDestroy(DeleteReasons::SetupFailed); return; } - if (!ContainerInterface::transferItemToVolumeContainer (*this, *newObject, NULL, error)) + if (!ContainerInterface::transferItemToVolumeContainer (*this, *newObject, nullptr, error)) { WARNING(true, ("FactoryObject::onContainerTransfer: could not transfer factory %s to container %s", getNetworkId().getValueString().c_str(), newObject->getNetworkId().getValueString().c_str())); return; @@ -434,7 +434,7 @@ void FactoryObject::onContainerTransfer(ServerObject * destination, // make a new factory with one item, but don't destroy ourself newFactory = makeCopy(*(m_craftingSchematic.get().getObject()-> asServerObject()), 1, false); - if (newFactory == NULL) + if (newFactory == nullptr) { WARNING(true, ("FactoryObject::onContainerTransfer: could not make a copy of factory %s", getNetworkId().getValueString().c_str())); return; @@ -448,9 +448,9 @@ void FactoryObject::onContainerTransfer(ServerObject * destination, // update the crafting status of ourself and the new factory ManufactureSchematicObject * schematic = safe_cast( m_craftingSchematic.get().getObject()); - if (schematic != NULL) + if (schematic != nullptr) { - if (newFactory != NULL) + if (newFactory != nullptr) { // set up the new factory to have the same crafting info // that we do @@ -525,7 +525,7 @@ bool FactoryObject::inCraftingSession() const return false; // make sure the crafting schematic id is a valid object - if (m_craftingSchematic.get().getObject() == NULL) + if (m_craftingSchematic.get().getObject() == nullptr) { WARNING_STRICT_FATAL(true, ("FactoryObject %s has a schematic id of %s " "that isn't a valid object!!!", getNetworkId().getValueString().c_str(), @@ -598,7 +598,7 @@ bool FactoryObject::addObject() if (getCount() == 0) { TangibleObject * object = manufactureObject(); - if (object != NULL) + if (object != nullptr) { setObjectName(object->getObjectName()); setComplexity(object->getComplexity()); @@ -615,7 +615,7 @@ bool FactoryObject::addObject() } const ServerObject * parent = safe_cast(ContainerInterface::getFirstParentInWorld(*this)); - if (parent != NULL) + if (parent != nullptr) LOG("CustomerService", ("Crafting:incrementing count of crate %s (owner %s) to %d", getNetworkId().getValueString().c_str(), PlayerObject::getAccountDescription(parent->getOwnerId()).c_str(), getCount())); else LOG("CustomerService", ("Crafting:incrementing count of crate %s to %d", getNetworkId().getValueString().c_str(), getCount())); @@ -645,7 +645,7 @@ bool FactoryObject::removeObject(ServerObject & destination) if (!isFactoryOk()) return false; - if (getCount() > 0 && ContainerInterface::getVolumeContainer(destination) != NULL) + if (getCount() > 0 && ContainerInterface::getVolumeContainer(destination) != nullptr) { if (!getLoadContents()) { @@ -665,7 +665,7 @@ bool FactoryObject::removeObject(ServerObject & destination) else { // new style factory - TangibleObject * object = NULL; + TangibleObject * object = nullptr; if (getCount() > 1) { object = manufactureObject(); @@ -686,7 +686,7 @@ bool FactoryObject::removeObject(ServerObject & destination) } const CachedNetworkId & id = *(container->begin()); Object * obj = id.getObject(); - if (obj != NULL && obj->asServerObject()->asTangibleObject() != NULL) + if (obj != nullptr && obj->asServerObject()->asTangibleObject() != nullptr) { object = obj->asServerObject()->asTangibleObject(); } @@ -706,15 +706,15 @@ bool FactoryObject::removeObject(ServerObject & destination) object = manufactureObject(); } } - if (object != NULL) + if (object != nullptr) { Container::ContainerErrorCode error; - if (ContainerInterface::transferItemToVolumeContainer(destination, *object, NULL, error)) + if (ContainerInterface::transferItemToVolumeContainer(destination, *object, nullptr, error)) { incrementCount(-1); const ServerObject * parent = safe_cast(ContainerInterface::getFirstParentInWorld(destination)); - if (parent != NULL) + if (parent != nullptr) LOG("CustomerService", ("Crafting:removed object %s from crate %s to container %s of player %s. Crate count = %d", object->getNetworkId().getValueString().c_str(), getNetworkId().getValueString().c_str(), destination.getNetworkId().getValueString().c_str(), PlayerObject::getAccountDescription(parent->getNetworkId()).c_str(), getCount())); else LOG("CustomerService", ("Crafting:removed object %s from crate %s to container %s. Crate count = %d", object->getNetworkId().getValueString().c_str(), getNetworkId().getValueString().c_str(), destination.getNetworkId().getValueString().c_str(), getCount())); @@ -828,14 +828,14 @@ void FactoryObject::onContainedObjectLoaded(const NetworkId &oid) // check if the object is on our pending list ServerObject * destination = removeIdFromPendingList(oid); - if (destination != NULL) + if (destination != nullptr) { TangibleObject * item = safe_cast(NetworkIdManager::getObjectById( oid)); - if (item != NULL) + if (item != nullptr) { Container::ContainerErrorCode error = Container::CEC_Success; - if (ContainerInterface::transferItemToVolumeContainer(*destination, *item, NULL, error)) + if (ContainerInterface::transferItemToVolumeContainer(*destination, *item, nullptr, error)) { // if that was the last item of ours, delete ourself if (getCount() == 0 && getPendingListCount() == 0) @@ -849,7 +849,7 @@ void FactoryObject::onContainedObjectLoaded(const NetworkId &oid) item->unload(); // tell the owner something went wrong Object * owner = NetworkIdManager::getObjectById(getOwnerId()); - if (owner != NULL) + if (owner != nullptr) { ContainerInterface::sendContainerMessageToClient(*safe_cast(owner), error); } @@ -873,35 +873,35 @@ void FactoryObject::onContainedObjectLoaded(const NetworkId &oid) * functionality of ManufactureSchematicObject::manufactureObject; if that * function changes, this one should too. * - * @return the new object, or NULL on error + * @return the new object, or nullptr on error */ TangibleObject * FactoryObject::manufactureObject() { if (!isFactoryOk()) - return NULL; + return nullptr; const DraftSchematicObject * draftSchematic = DraftSchematicObject::getSchematic(getDraftSchematic()); - if (draftSchematic == NULL) + if (draftSchematic == nullptr) { - return NULL; + return nullptr; } - if (draftSchematic->getCraftedObjectTemplate() == NULL) + if (draftSchematic->getCraftedObjectTemplate() == nullptr) { DEBUG_WARNING(true, ("Draft schematic %s does not have a craftable object template!\n", draftSchematic->getTemplateName())); - return NULL; + return nullptr; } // create the item TangibleObject * const object = dynamic_cast( ServerWorld::createNewObject(*draftSchematic->getCraftedObjectTemplate(), *this, false)); - if (object == NULL) + if (object == nullptr) { DEBUG_WARNING(true, ("Player %s failed to create object for template " "%s.\n", getOwnerId().getValueString().c_str(), draftSchematic->getCraftedObjectTemplate()->getName())); - return NULL; + return nullptr; } if (!getAssignedObjectName().empty()) @@ -928,7 +928,7 @@ TangibleObject * FactoryObject::manufactureObject() // set the creator xp type from the schematic template const ServerObjectTemplate * schematicTemplate = safe_cast(draftSchematic->getObjectTemplate()); - if (schematicTemplate != NULL && schematicTemplate->getXpPointsCount() > 0) + if (schematicTemplate != nullptr && schematicTemplate->getXpPointsCount() > 0) { ServerObjectTemplate::Xp xpData; schematicTemplate->getXpPoints(xpData, 0); @@ -948,7 +948,7 @@ TangibleObject * FactoryObject::manufactureObject() if (result == SCRIPT_OVERRIDE) { object->permanentlyDestroy(DeleteReasons::Script); - return NULL; + return nullptr; } return object; @@ -968,10 +968,10 @@ const char * FactoryObject::getContainedTemplateName() const const VolumeContainer * container = ContainerInterface::getVolumeContainer(*this); const CachedNetworkId & id = *(container->begin()); const Object * obj = id.getObject(); - if (obj != NULL && obj->asServerObject() != NULL) + if (obj != nullptr && obj->asServerObject() != nullptr) return obj->asServerObject()->getTemplateName(); } - return NULL; + return nullptr; } // FactoryObject::getContainedTemplateName // ---------------------------------------------------------------------- @@ -997,10 +997,10 @@ static std::string sharedTemplateName; const VolumeContainer * container = ContainerInterface::getVolumeContainer(*this); const CachedNetworkId & id = *(container->begin()); const Object * obj = id.getObject(); - if (obj != NULL && obj->asServerObject() != NULL) + if (obj != nullptr && obj->asServerObject() != nullptr) return obj->asServerObject()->getSharedTemplateName(); } - return NULL; + return nullptr; } // FactoryObject::getContainedSharedTemplateName // ---------------------------------------------------------------------- @@ -1017,10 +1017,10 @@ const ObjectTemplate * FactoryObject::getContainedObjectTemplate() const const VolumeContainer * container = ContainerInterface::getVolumeContainer(*this); const CachedNetworkId & id = *(container->begin()); const Object * obj = id.getObject(); - if (obj != NULL && obj->asServerObject() != NULL) + if (obj != nullptr && obj->asServerObject() != nullptr) return obj->asServerObject()->getObjectTemplate(); } - return NULL; + return nullptr; } // FactoryObject::getContainedObjectTemplate // ---------------------------------------------------------------------- @@ -1037,12 +1037,12 @@ const TangibleObject * FactoryObject::getContainedObject() const const VolumeContainer * container = ContainerInterface::getVolumeContainer(*this); const CachedNetworkId & id = *(container->begin()); const Object * obj = id.getObject(); - if (obj != NULL && obj->asServerObject() != NULL) + if (obj != nullptr && obj->asServerObject() != nullptr) { return obj->asServerObject()->asTangibleObject(); } } - return NULL; + return nullptr; } // FactoryObject::getContainedObject // ---------------------------------------------------------------------- @@ -1109,7 +1109,7 @@ ServerObject * FactoryObject::removeIdFromPendingList(const NetworkId & id) NetworkId objectId; if (!pendingList.getItem(idString,objectId)) - return NULL; + return nullptr; ServerObject * const object = safe_cast(NetworkIdManager::getObjectById(objectId)); removeObjVarItem(pendingList.getContextName() + idString); @@ -1415,7 +1415,7 @@ FactoryObject * FactoryObject::makeCopy(ServerObject & destination, int count, bool destroySource) { if (!isFactoryOk()) - return NULL; + return nullptr; // don't allow making a copy if we are an old crate if (!getLoadContents()) @@ -1428,52 +1428,52 @@ FactoryObject * FactoryObject::makeCopy(ServerObject & destination, int count, OutOfBandPackager::pack(pp, -1, oob); } const Object * const owner = NetworkIdManager::getObjectById(getOwnerId()); - if (owner != NULL) + if (owner != nullptr) { Chat::sendSystemMessage(*(owner->asServerObject()), Unicode::emptyString, oob); } - return NULL; + return nullptr; } if (count <= 0) { WARNING_STRICT_FATAL(true, ("FactoryObject::makeCopy %s passed invalid " "count %d", getNetworkId().getValueString().c_str(), count)); - return NULL; + return nullptr; } if (count > getCount()) { WARNING_STRICT_FATAL(true, ("FactoryObject::makeCopy %s given count %d " "that is > than our count %d", getNetworkId().getValueString().c_str(), count, getCount())); - return NULL; + return nullptr; } VolumeContainer *destVolumeContainer = ContainerInterface::getVolumeContainer(destination); - if (destVolumeContainer == NULL) + if (destVolumeContainer == nullptr) { WARNING_STRICT_FATAL(true, ("FactoryObject::makeCopy %s passed " "destination %s that is not a volume container", getNetworkId().getValueString().c_str(), destination.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } // create the new factory - if (safe_cast(getObjectTemplate()) == NULL) + if (safe_cast(getObjectTemplate()) == nullptr) { WARNING_STRICT_FATAL(true, ("FactoryObject::makeCopy: %s has no object template!", getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } FactoryObject * newFactory = safe_cast(ServerWorld::createNewObject( *safe_cast(getObjectTemplate()), destination, false)); - if (newFactory == NULL) + if (newFactory == nullptr) { WARNING_STRICT_FATAL(true, ("FactoryObject::makeCopy %s could not create " "the new factory", getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } // copy our objvars and scripts to the new factory @@ -1523,11 +1523,11 @@ FactoryObject * FactoryObject::makeCopy(ServerObject & destination, int count, // move our contained object to the new factory, and delete ourself if // we aren't already being deleted const TangibleObject * object = FactoryObject::getContainedObject(); - if (object != NULL) + if (object != nullptr) { Container::ContainerErrorCode error; ContainerInterface::transferItemToVolumeContainer(*newFactory, - *const_cast(object), NULL, error); + *const_cast(object), nullptr, error); newFactory->setCount(count); setCount(0); if (destroySource && !isBeingDestroyed()) @@ -1545,7 +1545,7 @@ FactoryObject * FactoryObject::makeCopy(ServerObject & destination, int count, else { newFactory->permanentlyDestroy(DeleteReasons::SetupFailed); - newFactory = NULL; + newFactory = nullptr; } } return newFactory; @@ -1575,7 +1575,7 @@ void FactoryObject::getAttributes(AttributeVector & data) const { // new-style crate const ServerObject * const storedObject = getContainedObject(); - if (storedObject != NULL) + if (storedObject != nullptr) { data.reserve (data.size () + 2); diff --git a/engine/server/library/serverGame/src/shared/object/GroupIdObserver.cpp b/engine/server/library/serverGame/src/shared/object/GroupIdObserver.cpp index 50373712..60b827ca 100755 --- a/engine/server/library/serverGame/src/shared/object/GroupIdObserver.cpp +++ b/engine/server/library/serverGame/src/shared/object/GroupIdObserver.cpp @@ -31,11 +31,11 @@ GroupIdObserver::~GroupIdObserver() if (m_group && m_creature->getGroup() != m_group) m_group->removeGroupMember(m_creature->getNetworkId()); - if (m_creature->getGroup() != NULL) + if (m_creature->getGroup() != nullptr) { PlayerObject *playerObject = PlayerCreatureController::getPlayerObject(m_creature); - if ((playerObject != NULL) && + if ((playerObject != nullptr) && playerObject->isLookingForGroup()) { playerObject->setLookingForGroup(false); diff --git a/engine/server/library/serverGame/src/shared/object/GroupObject.cpp b/engine/server/library/serverGame/src/shared/object/GroupObject.cpp index 76390349..4c8d69e4 100755 --- a/engine/server/library/serverGame/src/shared/object/GroupObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/GroupObject.cpp @@ -1412,7 +1412,7 @@ unsigned int GroupObject::getSecondsLeftOnGroupPickup() const std::pair const & groupPickupTimer = m_groupPickupTimer.get(); if ((groupPickupTimer.first > 0) && (groupPickupTimer.second > 0)) { - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); if (groupPickupTimer.second > timeNow) return (groupPickupTimer.second - (int)timeNow); } diff --git a/engine/server/library/serverGame/src/shared/object/GuildObject.cpp b/engine/server/library/serverGame/src/shared/object/GuildObject.cpp index f0215358..0ee903a1 100755 --- a/engine/server/library/serverGame/src/shared/object/GuildObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/GuildObject.cpp @@ -140,9 +140,9 @@ void GuildObject::setupUniverse() // build the guild and guild member info from data read in from DB // disable notification while building the initial list - m_membersInfo.setOnErase(NULL, NULL); - m_membersInfo.setOnInsert(NULL, NULL); - m_membersInfo.setOnSet(NULL, NULL); + m_membersInfo.setOnErase(nullptr, nullptr); + m_membersInfo.setOnInsert(nullptr, nullptr); + m_membersInfo.setOnSet(nullptr, nullptr); // build names { @@ -238,7 +238,7 @@ void GuildObject::setupUniverse() // update guild info members count GuildInfo & gi = guildInfoMembersCount[guildId]; GuildMemberInfo const * const existingGmi = getGuildMemberInfo(guildId, memberId); - updateGuildInfoMembersCount(gi, (existingGmi ? ((existingGmi->m_permissions == -1) ? &allAdministrativePermissions : &(existingGmi->m_permissions)) : NULL), ((permissions == -1) ? &allAdministrativePermissions : &permissions)); + updateGuildInfoMembersCount(gi, (existingGmi ? ((existingGmi->m_permissions == -1) ? &allAdministrativePermissions : &(existingGmi->m_permissions)) : nullptr), ((permissions == -1) ? &allAdministrativePermissions : &permissions)); if (existingGmi) { @@ -391,7 +391,7 @@ GuildInfo const * GuildObject::getGuildInfo(int guildId) const if (iterFind != m_guildsInfo.end()) return &(iterFind->second); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -402,7 +402,7 @@ GuildMemberInfo const * GuildObject::getGuildMemberInfo(int guildId, NetworkId c if (iterFind != m_membersInfo.end()) return &(iterFind->second); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -738,7 +738,7 @@ void GuildObject::removeGuildMember(int guildId, NetworkId const &memberId) m_members.erase(memberSpec); GuildInfo updatedGi(gi); - updateGuildInfoMembersCount(updatedGi, &(gmi->m_permissions), NULL); + updateGuildInfoMembersCount(updatedGi, &(gmi->m_permissions), nullptr); m_guildsInfo.set(guildId, updatedGi); std::map::const_iterator iterFind = m_fullMembers.find(memberId); @@ -771,7 +771,7 @@ void GuildObject::addGuildCreatorMember(int guildId, NetworkId const &memberId, if (realMemberName.empty() && existingGmi) realMemberName = existingGmi->m_name; - ServerObject const *so = NULL; + ServerObject const *so = nullptr; if (realMemberName.empty()) { so = ServerWorld::findObjectByNetworkId(memberId); @@ -848,7 +848,7 @@ void GuildObject::addGuildCreatorMember(int guildId, NetworkId const &memberId, m_members.insert(memberSpec); GuildInfo updatedGi(gi); - updateGuildInfoMembersCount(updatedGi, (existingGmi ? &(existingGmi->m_permissions) : NULL), &permissions); + updateGuildInfoMembersCount(updatedGi, (existingGmi ? &(existingGmi->m_permissions) : nullptr), &permissions); m_guildsInfo.set(guildId, updatedGi); if (existingGmi) @@ -883,7 +883,7 @@ void GuildObject::addGuildSponsorMember(int guildId, NetworkId const &memberId, if (realMemberName.empty() && existingGmi) realMemberName = existingGmi->m_name; - ServerObject const *so = NULL; + ServerObject const *so = nullptr; if (realMemberName.empty()) { so = ServerWorld::findObjectByNetworkId(memberId); @@ -958,7 +958,7 @@ void GuildObject::addGuildSponsorMember(int guildId, NetworkId const &memberId, m_members.insert(memberSpec); GuildInfo updatedGi(gi); - updateGuildInfoMembersCount(updatedGi, (existingGmi ? &(existingGmi->m_permissions) : NULL), &permissions); + updateGuildInfoMembersCount(updatedGi, (existingGmi ? &(existingGmi->m_permissions) : nullptr), &permissions); m_guildsInfo.set(guildId, updatedGi); if (existingGmi) @@ -1465,7 +1465,7 @@ void GuildObject::modifyGuildWarKillTracking(int killerGuildId, int victimGuildI } if (updateTime <= 0) - updateTime = static_cast(::time(NULL)); + updateTime = static_cast(::time(nullptr)); // queue up adjustments and periodically update the data std::pair, std::pair >::iterator, bool> result = m_guildWarKillTrackingAdjustment.insert(std::make_pair(std::make_pair(killerGuildId, victimGuildId), std::make_pair(adjustment, updateTime))); @@ -1635,7 +1635,7 @@ void GuildObject::setGuildFaction(int guildId, uint32 guildFaction) if (factionChange) { - int const timeLeftGuildFaction = static_cast(::time(NULL)); + int const timeLeftGuildFaction = static_cast(::time(nullptr)); std::string oldNameSpec, newNameSpec; GuildStringParser::buildNameSpec(guildId, gi->m_name, gi->m_guildElectionPreviousEndTime, gi->m_guildElectionNextEndTime, gi->m_guildFaction, gi->m_timeLeftGuildFaction, gi->m_guildGcwDefenderRegion, gi->m_timeJoinedGuildGcwDefenderRegion, gi->m_timeLeftGuildGcwDefenderRegion, oldNameSpec); @@ -1723,7 +1723,7 @@ void GuildObject::setGuildGcwDefenderRegion(int guildId, std::string const &guil if ((gi->m_guildGcwDefenderRegion == guildGcwDefenderRegion) && (gi->m_timeJoinedGuildGcwDefenderRegion > 0)) timeJoinedGuildGcwDefenderRegion = gi->m_timeJoinedGuildGcwDefenderRegion; else - timeJoinedGuildGcwDefenderRegion = static_cast(::time(NULL)); + timeJoinedGuildGcwDefenderRegion = static_cast(::time(nullptr)); } } else if (gi->m_guildGcwDefenderRegion != guildGcwDefenderRegion) @@ -1732,13 +1732,13 @@ void GuildObject::setGuildGcwDefenderRegion(int guildId, std::string const &guil if (!guildGcwDefenderRegion.empty()) { - timeJoinedGuildGcwDefenderRegion = static_cast(::time(NULL)); + timeJoinedGuildGcwDefenderRegion = static_cast(::time(nullptr)); } else { // stop defending timeJoinedGuildGcwDefenderRegion = gi->m_timeJoinedGuildGcwDefenderRegion; - timeLeftGuildGcwDefenderRegion = static_cast(::time(NULL)); + timeLeftGuildGcwDefenderRegion = static_cast(::time(nullptr)); } } @@ -2052,7 +2052,7 @@ void GuildObject::depersistGcwImperialScorePercentile() // GCW category { - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); int gcwImperialScorePercentile; std::map const & allGcwScoreCategory = Pvp::getAllGcwScoreCategory(); for (std::map::const_iterator iter = allGcwScoreCategory.begin(); iter != allGcwScoreCategory.end(); ++iter) @@ -2154,7 +2154,7 @@ void GuildObject::updateGcwImperialScorePercentile(std::set const & if (m_gcwImperialScorePercentileThisGalaxy.empty()) depersistGcwImperialScorePercentile(); - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); GameScriptObject * const gameScriptObject = tatooine->getScriptObject(); int currentScorePercentile, newScorePercentile, newGroupCategoryScoreRaw, scoreCategoryGroupTotalPoints, deltaGroupCategoryScoreRaw; std::map, int>::const_iterator iterGroupCategoryScoreRaw; @@ -2515,8 +2515,8 @@ void GuildObjectNamespace::replaceSetIfNeeded(char const *label, Archive::AutoDe } // ---------------------------------------------------------------------- -// NULL oldPermissions means wasn't an existing guild member -// NULL newPermissions means will not be a guild member +// nullptr oldPermissions means wasn't an existing guild member +// nullptr newPermissions means will not be a guild member void GuildObjectNamespace::updateGuildInfoMembersCount(GuildInfo & gi, int const * const oldPermissions, int const * const newPermissions) { bool existingMember = false; @@ -2596,7 +2596,7 @@ void GuildObjectNamespace::updateGcwPercentileHistory(Archive::AutoDeltaMap(::time(NULL))), score); + history.set(std::make_pair(scoreName, static_cast(::time(nullptr))), score); int newCount = 1; Archive::AutoDeltaMap::const_iterator const iterHistoryCount = historyCount.find(scoreName); diff --git a/engine/server/library/serverGame/src/shared/object/HarvesterInstallationObject.cpp b/engine/server/library/serverGame/src/shared/object/HarvesterInstallationObject.cpp index c8c7ad75..92f77f36 100755 --- a/engine/server/library/serverGame/src/shared/object/HarvesterInstallationObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/HarvesterInstallationObject.cpp @@ -67,7 +67,7 @@ HarvesterInstallationObject::HarvesterInstallationObject(const ServerHarvesterIn m_maxHopperAmount(newTemplate->getMaxHopperSize()), m_hopperResource(NetworkId::cms_invalid), m_hopperAmount(0.0f), - m_survey(NULL), + m_survey(nullptr), m_surveyTime(0) { //Installation objects have real time updated UI @@ -79,7 +79,7 @@ HarvesterInstallationObject::HarvesterInstallationObject(const ServerHarvesterIn HarvesterInstallationObject::~HarvesterInstallationObject() { delete m_survey; - m_survey = NULL; + m_survey = nullptr; // m_synchronizedUi deleted by superclass } @@ -397,7 +397,7 @@ std::vector const & HarvesterInstallationObject::get if (!m_survey || ServerClock::getInstance().getGameTimeSeconds() - m_surveyTime > (60*60)) { delete m_survey; - m_survey = NULL; + m_survey = nullptr; takeSurvey(); } @@ -728,7 +728,7 @@ void HarvesterInstallationObject::handleCMessageTo (const MessageToPayload &mess ResourceClassObject *HarvesterInstallationObject::getMasterClass() const { - ResourceClassObject *obj = NULL; + ResourceClassObject *obj = nullptr; const ServerHarvesterInstallationObjectTemplate *harvesterTemplate = dynamic_cast(getObjectTemplate()); if (harvesterTemplate) obj=ServerUniverse::getInstance().getResourceClassByName(harvesterTemplate->getMasterClassName()); @@ -855,7 +855,7 @@ NetworkId const &HarvesterInstallationObject::getSelectedResourceTypeId() const ResourcePoolObject const * HarvesterInstallationObject::getSelectedResourcePool() const { if (getSelectedResourceTypeId() == NetworkId::cms_invalid) - return NULL; + return nullptr; ResourceTypeObject const * const typeObject = ServerUniverse::getInstance().getResourceTypeById(getSelectedResourceTypeId()); if (typeObject) @@ -863,7 +863,7 @@ ResourcePoolObject const * HarvesterInstallationObject::getSelectedResourcePool( return typeObject->getPoolForCurrentPlanet(); } else - return NULL; + return nullptr; } // ====================================================================== diff --git a/engine/server/library/serverGame/src/shared/object/HarvesterInstallationObject.h b/engine/server/library/serverGame/src/shared/object/HarvesterInstallationObject.h index 7616aba5..1ea65df3 100755 --- a/engine/server/library/serverGame/src/shared/object/HarvesterInstallationObject.h +++ b/engine/server/library/serverGame/src/shared/object/HarvesterInstallationObject.h @@ -52,7 +52,7 @@ public: typedef std::pair HopperContentElement; typedef stdvector::fwd HopperContentsVector; - float getHopperContents(HopperContentsVector * data=NULL) const; + float getHopperContents(HopperContentsVector * data=nullptr) const; void getResourceData(ResourceDataVector & data); std::vector const & getSurveyTypes(); int getMaxExtractionRate() const; diff --git a/engine/server/library/serverGame/src/shared/object/InstallationObject.cpp b/engine/server/library/serverGame/src/shared/object/InstallationObject.cpp index 2f5b622b..97ddeef9 100755 --- a/engine/server/library/serverGame/src/shared/object/InstallationObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/InstallationObject.cpp @@ -45,7 +45,7 @@ static const std::string OBJVAR_ACCUMULATED_TIME("_installation.acclTime"); -const SharedObjectTemplate * InstallationObject::m_defaultSharedTemplate = NULL; +const SharedObjectTemplate * InstallationObject::m_defaultSharedTemplate = nullptr; namespace InstallationObjectNamespace { @@ -93,13 +93,13 @@ const SharedObjectTemplate * InstallationObject::getDefaultSharedTemplate(void) { static const ConstCharCrcLowerString templateName("object/installation/base/shared_installation_default.iff"); - if (m_defaultSharedTemplate == NULL) + if (m_defaultSharedTemplate == nullptr) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create " + WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create " "default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) ExitChain::add (removeDefaultTemplate, "InstallationObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -112,10 +112,10 @@ static const ConstCharCrcLowerString templateName("object/installation/base/shar */ void InstallationObject::removeDefaultTemplate(void) { - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } // InstallationObject::removeDefaultTemplate diff --git a/engine/server/library/serverGame/src/shared/object/IntangibleObject.cpp b/engine/server/library/serverGame/src/shared/object/IntangibleObject.cpp index 6d7b57c4..5d32403f 100755 --- a/engine/server/library/serverGame/src/shared/object/IntangibleObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/IntangibleObject.cpp @@ -43,7 +43,7 @@ // ====================================================================== -const SharedObjectTemplate * IntangibleObject::m_defaultSharedTemplate = NULL; +const SharedObjectTemplate * IntangibleObject::m_defaultSharedTemplate = nullptr; uint32 IntangibleObject::ms_lastFrame = 0; uint32 IntangibleObject::ms_theaterTime = 0; @@ -82,7 +82,7 @@ IntangibleObject::IntangibleObject(const ServerIntangibleObjectTemplate* newTemp #endif { - WARNING_STRICT_FATAL(!getSharedTemplate(), ("Shared template for %s is NULL", getTemplateName())); + WARNING_STRICT_FATAL(!getSharedTemplate(), ("Shared template for %s is nullptr", getTemplateName())); addMembersToPackages(); ObjectTracker::addIntangible(); } @@ -105,13 +105,13 @@ const SharedObjectTemplate * IntangibleObject::getDefaultSharedTemplate(void) co { static const ConstCharCrcLowerString templateName("object/intangible/base/shared_intangible_default.iff"); - if (m_defaultSharedTemplate == NULL) + if (m_defaultSharedTemplate == nullptr) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create " + WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create " "default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) ExitChain::add (removeDefaultTemplate, "IntangibleObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -124,10 +124,10 @@ static const ConstCharCrcLowerString templateName("object/intangible/base/shared */ void IntangibleObject::removeDefaultTemplate(void) { - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } // IntangibleObject::removeDefaultTemplate @@ -161,7 +161,7 @@ void IntangibleObject::onLoadedFromDatabase() if (flatten != 0) { TerrainGenerator::Layer * layer = TerrainModificationHelper::importLayer(THEATER_FLATTEN_LAYER.c_str()); - if (layer != NULL) + if (layer != nullptr) { setLayer(layer); } @@ -192,7 +192,7 @@ void IntangibleObject::onLoadedFromDatabase() void IntangibleObject::sendObjectSpecificBaselinesToClient(Client const &client) const { ServerObject::sendObjectSpecificBaselinesToClient(client); - if (getLayer() != NULL) + if (getLayer() != nullptr) { client.send(GenericValueTypeMessage >( "IsFlattenedTheaterMessage", std::make_pair(getNetworkId(), true)), true); @@ -235,9 +235,9 @@ size_t i; Transform tr; tr.setPosition_p(myPos+m_positions[i]); ServerObject * newObject = ServerWorld::createNewObject(m_crcs[i], tr, 0, false); - if (newObject != NULL) + if (newObject != nullptr) { - if (newObject->asTangibleObject() != NULL) + if (newObject->asTangibleObject() != nullptr) newObject->asTangibleObject()->setVisible(false); newObject->addToWorld(); m_objects.push_back(CachedNetworkId(*newObject)); @@ -300,7 +300,7 @@ size_t i; for (i = 0; i < count; ++i) { ServerObject * object = safe_cast(m_objects[i].getObject()); - if (object != NULL && object->asTangibleObject() != NULL) + if (object != nullptr && object->asTangibleObject() != nullptr) { const ServerObjectTemplate * objTemplate = safe_cast(object->getObjectTemplate()); for (size_t j = 0; j < objTemplate->getVisibleFlagsCount(); ++j) @@ -360,7 +360,7 @@ bool IntangibleObject::isVisibleOnClient (const Client & client) const { if (isTheater()) { - return getLayer() != NULL; + return getLayer() != nullptr; } return true; } @@ -388,7 +388,7 @@ void IntangibleObject::onPermanentlyDestroyed() for (size_t i = 0; i < count; ++i) { ServerObject * object = safe_cast(m_objects[i].getObject()); - if (object != NULL) + if (object != nullptr) object->permanentlyDestroy(DeleteReasons::Consumed); } if (!m_theaterName.get().empty()) @@ -439,7 +439,7 @@ bool IntangibleObject::persist() splitCount = 0; } ServerObject * o = safe_cast((*i).getObject()); - if (o != NULL) + if (o != nullptr) { o->persist(); splitObjects.back().push_back(*i); @@ -452,7 +452,7 @@ bool IntangibleObject::persist() if (m_player.get() != CachedNetworkId::cms_cachedInvalid) setObjVarItem(OBJVAR_THEATER_PLAYER, m_player.get()); setObjVarItem(OBJVAR_THEATER_NAME, m_theaterName.get()); - if (getLayer() != NULL) + if (getLayer() != nullptr) setObjVarItem(OBJVAR_THEATER_FLATTEN, 1); char buffer[32]; @@ -551,7 +551,7 @@ int IntangibleObject::getObjectsCreatedPerFrame() int IntangibleObject::getNumObjects(const std::string & datatable) { DataTable * dt = DataTableManager::getTable(datatable, true); - if (dt == NULL) + if (dt == nullptr) { WARNING(true, ("IntangibleObject::getNumObjects could not open " "datatable %s", datatable.c_str())); @@ -586,7 +586,7 @@ int IntangibleObject::getNumObjects(const std::string & datatable) float IntangibleObject::getRadius(const std::string & datatable) { DataTable * dt = DataTableManager::getTable(datatable, true); - if (dt == NULL) + if (dt == nullptr) { WARNING(true, ("IntangibleObject::getRadius could not open " "datatable %s", datatable.c_str())); @@ -648,18 +648,18 @@ IntangibleObject * IntangibleObject::spawnTheater(const std::string & datatable, const Vector & position, const std::string & script, TheaterLocationType locationType) { DataTable * dt = DataTableManager::getTable(datatable, true); - if (dt == NULL) + if (dt == nullptr) { WARNING(true, ("IntangibleObject::spawnTheater could not open " "datatable %s", datatable.c_str())); - return NULL; + return nullptr; } int rows = dt->getNumRows(); if (rows <= 0) { WARNING(true, ("IntangibleObject::spawnTheater datatable %s has no " "rows", datatable.c_str())); - return NULL; + return nullptr; } int templateColumn = dt->findColumnNumber("template"); @@ -684,7 +684,7 @@ IntangibleObject * IntangibleObject::spawnTheater(const std::string & datatable, { WARNING(true, ("IntangibleObject::spawnTheater datatable %s has no " "objects", datatable.c_str())); - return NULL; + return nullptr; } skipFirstRow = true; objectCrcs.erase(objectCrcs.begin()); @@ -737,11 +737,11 @@ IntangibleObject * IntangibleObject::spawnTheater(const std::string & datatable, float centerX = minx + dx / 2.0f + position.x; float centerZ = minz + dz / 2.0f + position.z; - TerrainGenerator::Layer * layer = NULL; + TerrainGenerator::Layer * layer = nullptr; if (locationType == TLT_flatten) { layer = TerrainModificationHelper::importLayer(THEATER_FLATTEN_LAYER.c_str()); - if (layer == NULL) + if (layer == nullptr) { WARNING (true, ("Layer %s not found for theater %s, using getGoodLocation " "instead", THEATER_FLATTEN_LAYER.c_str(), datatable.c_str())); @@ -770,7 +770,7 @@ IntangibleObject * IntangibleObject::spawnTheater(const std::string & datatable, iter != regions.end(); ++iter) { const Region * region = *iter; - if (region != NULL) + if (region != nullptr) { if (region->getPvp() == RegionNamespace::RP_pvpBattlefield || region->getPvp() == RegionNamespace::RP_pveBattlefield || @@ -796,7 +796,7 @@ IntangibleObject * IntangibleObject::spawnTheater(const std::string & datatable, IntangibleObject * theater = safe_cast(ServerWorld::createNewObject(THEATER_TEMPLATE, tr, 0, false)); NOT_NULL(theater); - if (layer != NULL) + if (layer != nullptr) { theater->setLayer(layer); } diff --git a/engine/server/library/serverGame/src/shared/object/LineOfSightCache.cpp b/engine/server/library/serverGame/src/shared/object/LineOfSightCache.cpp index a7de4055..3d3c72ff 100755 --- a/engine/server/library/serverGame/src/shared/object/LineOfSightCache.cpp +++ b/engine/server/library/serverGame/src/shared/object/LineOfSightCache.cpp @@ -308,14 +308,14 @@ bool LineOfSightCache::checkLOS(Object const &a, Location const &b) Clock::getFrameStartTimeMs() + ConfigServerGame::getLineOfSightCacheDurationMs())); CellProperty const * const sourceCell = source->getParentCell(); - CellProperty const * targetCell = NULL; + CellProperty const * targetCell = nullptr; if (b.getCell() != NetworkId::cms_invalid) { Object const * cellObject = NetworkIdManager::getObjectById(b.getCell()); - if (cellObject != NULL) + if (cellObject != nullptr) targetCell = ContainerInterface::getCell(*cellObject); } - if (targetCell == NULL) + if (targetCell == nullptr) targetCell = CellProperty::getWorldCellProperty(); // if source and target are in the same cell in a player structure, skip LOS check; @@ -418,7 +418,7 @@ bool LineOfSightCache::checkLOS(Object const &a, Location const &b) qirResult = CollisionWorld::queryInteraction( targetCell, b.getCoordinates(), sourceCell, sourceTop, - NULL, + nullptr, (!ConfigSharedCollision::getIgnoreTerrainLos() && !ConfigSharedCollision::getGenerateTerrainLos()), false, ConfigSharedCollision::getTerrainLOSMinDistance(), diff --git a/engine/server/library/serverGame/src/shared/object/ManufactureInstallationObject.cpp b/engine/server/library/serverGame/src/shared/object/ManufactureInstallationObject.cpp index c199bd84..50fec4c8 100755 --- a/engine/server/library/serverGame/src/shared/object/ManufactureInstallationObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/ManufactureInstallationObject.cpp @@ -99,11 +99,11 @@ namespace ManufactureInstallationObjectNamespace bool isOutputHopperFull(ManufactureInstallationObject const & mio) { ServerObject const * const outputHopper = mio.getOutputHopper(); - if (outputHopper == NULL) + if (outputHopper == nullptr) return false; VolumeContainer const * const hopperContainer = ContainerInterface::getVolumeContainer(*outputHopper); - if (hopperContainer == NULL) + if (hopperContainer == nullptr) return false; return (hopperContainer->getCurrentVolume() >= hopperContainer->getTotalVolume()); @@ -170,7 +170,7 @@ void ManufactureInstallationObject::endBaselines() // if we are active, make sure we have the right data if (isAuthoritative() && isActive()) { - if (getSchematic() == NULL) + if (getSchematic() == nullptr) { WARNING(true, ("Manufacture installation %s is set to active but has not schematic available!", getNetworkId().getValueString().c_str())); @@ -302,17 +302,17 @@ void ManufactureInstallationObject::setOwnerId(const NetworkId &id) InstallationObject::setOwnerId(id); const Object * const object = NetworkIdManager::getObjectById(id); - if (object != NULL) + if (object != nullptr) { const ServerObject * const owner = safe_cast(object); setObjVarItem(OBJVAR_OWNER_NAME, Unicode::wideToNarrow(owner->getObjectName())); // we need to store the owner's Station id for logging purposes const CreatureObject * const creatureOwner = owner->asCreatureObject(); - if (creatureOwner != NULL) + if (creatureOwner != nullptr) { const PlayerObject * const player = PlayerCreatureController::getPlayerObject(creatureOwner); - if (player != NULL) + if (player != nullptr) { setObjVarItem(OBJVAR_OWNER_STATION_ID, static_cast(player->getStationId())); } @@ -331,10 +331,10 @@ ServerObject * ManufactureInstallationObject::getInputHopper() const { SlottedContainer const * const container = ContainerInterface::getSlottedContainer(*this); - if (container == NULL) + if (container == nullptr) { DEBUG_WARNING(true, ("Manufacture installation %s does not have a container!", getDebugInformation().c_str())); - return NULL; + return nullptr; } Container::ContainerErrorCode tmp = Container::CEC_Success; @@ -342,7 +342,7 @@ ServerObject * ManufactureInstallationObject::getInputHopper() const if (hopperId == NetworkId::cms_invalid) { DEBUG_WARNING(true, ("Manufacture installation %s does not have an input hopper!", getDebugInformation().c_str())); - return NULL; + return nullptr; } return safe_cast(hopperId.getObject()); @@ -359,10 +359,10 @@ ServerObject * ManufactureInstallationObject::getOutputHopper() const { SlottedContainer const * const container = ContainerInterface::getSlottedContainer(*this); - if (container == NULL) + if (container == nullptr) { DEBUG_WARNING(true, ("Manufacture installation %s does not have a container!", getDebugInformation().c_str())); - return NULL; + return nullptr; } Container::ContainerErrorCode tmp = Container::CEC_Success; @@ -370,7 +370,7 @@ ServerObject * ManufactureInstallationObject::getOutputHopper() const if (hopperId == NetworkId::cms_invalid) { DEBUG_WARNING(true, ("Manufacture installation %s does not have an output hopper!", getDebugInformation().c_str())); - return NULL; + return nullptr; } return safe_cast(hopperId.getObject()); @@ -399,7 +399,7 @@ bool ManufactureInstallationObject::addSchematic(ManufactureSchematicObject & sc SlottedContainer const * const container = ContainerInterface::getSlottedContainer(*this); - if (container == NULL) + if (container == nullptr) { DEBUG_WARNING(true, ("Manufacture installation %s does not have a container!", getDebugInformation().c_str())); return false; @@ -433,7 +433,7 @@ bool ManufactureInstallationObject::onContainerAboutToLoseItem(ServerObject * de { bool isSchematic = false; const ManufactureSchematicObject * const schematic = getSchematic(); - if (schematic != NULL && schematic->getNetworkId() == item.getNetworkId()) + if (schematic != nullptr && schematic->getNetworkId() == item.getNetworkId()) { isSchematic = true; if (isActive()) @@ -465,10 +465,10 @@ ManufactureSchematicObject * ManufactureInstallationObject::getSchematic() const // get our manufacturing schematic SlottedContainer const * const container = ContainerInterface::getSlottedContainer(*this); - if (container == NULL) + if (container == nullptr) { DEBUG_WARNING(true, ("Manufacture installation %s does not have a container!", getDebugInformation().c_str())); - return NULL; + return nullptr; } Container::ContainerErrorCode tmp = Container::CEC_Success; @@ -486,7 +486,7 @@ ManufactureSchematicObject * ManufactureInstallationObject::getSchematic() const float ManufactureInstallationObject::getTimePerObject() const { ManufactureSchematicObject * const schematic = getSchematic(); - if (schematic == NULL) + if (schematic == nullptr) return 0; #ifdef _DEBUG @@ -516,7 +516,7 @@ float ManufactureInstallationObject::getTimePerObject() const getObjVars().getItem(OBJVAR_OWNER_SKILL,ownerSkill); int skill = 0; - if (owner != NULL) + if (owner != nullptr) { skill = owner->getEnhancedModValue(FACTORY_SKILL_MOD); @@ -551,7 +551,7 @@ void ManufactureInstallationObject::activate(const NetworkId &actorId) { if (isAuthoritative() && !isActive()) { - if (getSchematic() == NULL) + if (getSchematic() == nullptr) { WARNING(true, ("Manufacture installation %s tried to activate with " "no schematic available!", getNetworkId().getValueString().c_str())); @@ -588,7 +588,7 @@ void ManufactureInstallationObject::activate(const NetworkId &actorId) OutOfBandPackager::pack(pp, -1, oob); } const Object * const owner = NetworkIdManager::getObjectById(getOwnerId()); - if (owner != NULL) + if (owner != nullptr) { Chat::sendSystemMessage(getOwnerName(), Unicode::emptyString, oob); } @@ -615,7 +615,7 @@ void ManufactureInstallationObject::deactivate() OutOfBandPackager::pack(pp, -1, oob); } const Object * const owner = NetworkIdManager::getObjectById(getOwnerId()); - if (owner != NULL) + if (owner != nullptr) { Chat::sendSystemMessage(getOwnerName(), Unicode::emptyString, oob); } @@ -645,13 +645,13 @@ void ManufactureInstallationObject::harvest() maxItemCount = schematic->getCount(); } - if (schematic == NULL || maxItemCount <= 0) + if (schematic == nullptr || maxItemCount <= 0) { setTickCount(0); // to avoid recursion deactivate(); - if (schematic == NULL) + if (schematic == nullptr) { - WARNING(true, ("ManufactureInstallationObject::harvest called on object %s with a NULL schematic", + WARNING(true, ("ManufactureInstallationObject::harvest called on object %s with a nullptr schematic", getNetworkId().getValueString().c_str())); Chat::sendPersistentMessage(*this, getOwnerName(), StringIds::manf_error, StringIds::manf_error_1, Unicode::emptyString); @@ -694,7 +694,7 @@ void ManufactureInstallationObject::harvest() OutOfBandPackager::pack(pp, -1, oob); } const Object * owner = NetworkIdManager::getObjectById(getOwnerId()); - if (owner != NULL) + if (owner != nullptr) { Chat::sendSystemMessage(getOwnerName(), Unicode::emptyString, oob); } @@ -748,7 +748,7 @@ bool ManufactureInstallationObject::createObject(bool testOnly) int i; ManufactureSchematicObject * schematic = getSchematic(); - if (schematic == NULL) + if (schematic == nullptr) { WARNING(true, ("ManufactureInstallationObject::createObject can't find schematic for station %s", getNetworkId().getValueString().c_str())); @@ -771,7 +771,7 @@ bool ManufactureInstallationObject::createObject(bool testOnly) } ServerObject * inputHopper = getInputHopper(); - if (inputHopper == NULL) + if (inputHopper == nullptr) { WARNING_STRICT_FATAL(true, ("ManufactureInstallationObject::createObject can't find input hopper for station %s", getNetworkId().getValueString().c_str())); @@ -782,7 +782,7 @@ bool ManufactureInstallationObject::createObject(bool testOnly) } ServerObject * outputHopper = getOutputHopper(); - if (outputHopper == NULL) + if (outputHopper == nullptr) { WARNING_STRICT_FATAL(true, ("ManufactureInstallationObject::createObject can't find output hopper for station %s", getNetworkId().getValueString().c_str())); @@ -803,7 +803,7 @@ bool ManufactureInstallationObject::createObject(bool testOnly) { // is there a current crate in the output hopper put we can stuff objects into FactoryObject * crate = getCurrentCrate(*schematic); - if (crate == NULL) + if (crate == nullptr) { // is there room in the output hopper for a new crate outputHopperFull = isOutputHopperFull(*this); @@ -819,7 +819,7 @@ bool ManufactureInstallationObject::createObject(bool testOnly) OutOfBandPackager::pack(pp, -1, oob); } const Object * const owner = NetworkIdManager::getObjectById(getOwnerId()); - if (owner != NULL) + if (owner != nullptr) { Chat::sendSystemMessage(getOwnerName(), Unicode::emptyString, oob); } @@ -894,7 +894,7 @@ bool ManufactureInstallationObject::createObject(bool testOnly) // the ingredient needs to be made with the same template const ObjectTemplate * componentTemplate = ObjectTemplateList::fetch( componentInfo->templateName); - if (componentTemplate != NULL) + if (componentTemplate != nullptr) { for (j = 0; j < ingredientCount; ++j) { @@ -945,7 +945,7 @@ bool ManufactureInstallationObject::createObject(bool testOnly) ProsePackage pp; ProsePackageManagerServer::createSimpleProsePackageParticipant (*this, pp.target); - if (resource != NULL) + if (resource != nullptr) { pp.stringId = StringIds::manf_no_named_resource; pp.other.str = Unicode::narrowToWide(resource->getResourceName()); @@ -957,7 +957,7 @@ bool ManufactureInstallationObject::createObject(bool testOnly) } const Object * const owner = NetworkIdManager::getObjectById(getOwnerId()); - if (owner != NULL) + if (owner != nullptr) Chat::sendSystemMessage(getOwnerName(), Unicode::emptyString, oob); Chat::sendPersistentMessage(*this, getOwnerName(), StringIds::no_ingredients, Unicode::emptyString, oob); @@ -1000,7 +1000,7 @@ bool ManufactureInstallationObject::createObject(bool testOnly) { TangibleObject * object = safe_cast(schematic-> manufactureObject(getOwnerId(), *this, newObjectSlotId, false)); - if (object == NULL) + if (object == nullptr) { WARNING_STRICT_FATAL(true, ("ManufactureInstallationObject::createObject, Unable to create object for station %s", getNetworkId().getValueString().c_str())); @@ -1009,7 +1009,7 @@ bool ManufactureInstallationObject::createObject(bool testOnly) return false; } - if (!ContainerInterface::transferItemToVolumeContainer(*outputHopper, *object, NULL, tmp)) + if (!ContainerInterface::transferItemToVolumeContainer(*outputHopper, *object, nullptr, tmp)) { object->permanentlyDestroy(DeleteReasons::BadContainerTransfer); WARNING_STRICT_FATAL(true, ("ManufactureInstallationObject::createObject, Unable to transfer new object for station %s, error code = %d", @@ -1024,12 +1024,12 @@ bool ManufactureInstallationObject::createObject(bool testOnly) { // put the object in a box of objects FactoryObject * crate = getCurrentCrate(*schematic); - if (crate == NULL) + if (crate == nullptr) { // make a new crate to put the object in crate = makeNewCrate(*schematic); } - if (crate == NULL) + if (crate == nullptr) { WARNING_STRICT_FATAL(true, ("ManufactureInstallationObject::createObject, Unable to create factory crate for station %s", getNetworkId().getValueString().c_str())); @@ -1082,7 +1082,7 @@ void ManufactureInstallationObject::restoreIngredients(IngredientVector const &i if (count != 0) { FactoryObject * crate = dynamic_cast(itemId.getObject()); - if (crate != NULL) + if (crate != nullptr) crate->incrementCount(count); } } @@ -1109,7 +1109,7 @@ void ManufactureInstallationObject::destroyIngredients(IngredientVector const &i else { FactoryObject * crate = dynamic_cast(itemId.getObject()); - if (crate != NULL) + if (crate != nullptr) { LOG("CustomerService", ("Crafting:destroying %d ingredients from crate %s in manf station %s owned by %s", count, itemId.getValueString().c_str(), getNetworkId().getValueString().c_str(), PlayerObject::getAccountDescription(getOwnerId()).c_str())); if (crate->getCount() == 0) @@ -1149,7 +1149,7 @@ bool ManufactureInstallationObject::transferCraftedIngredientToSchematic( // crafted id as the component wanted VolumeContainer * container = ContainerInterface::getVolumeContainer(inputHopper); - if (container == NULL) + if (container == nullptr) return false; // stuff to keep track of crates that don't have enough ingredients @@ -1160,11 +1160,11 @@ bool ManufactureInstallationObject::transferCraftedIngredientToSchematic( { const Container::ContainedItem & itemId = *iter; TangibleObject * object = safe_cast(itemId.getObject()); - if (object != NULL && object->getCraftedId() == craftedId) + if (object != nullptr && object->getCraftedId() == craftedId) { // see if the object is a factory or not FactoryObject * crate = dynamic_cast(object); - if (crate != NULL) + if (crate != nullptr) { // see if the crate has enough objects or not int crateCount = crate->getCount(); @@ -1247,18 +1247,18 @@ const NetworkId & ManufactureInstallationObject::transferTemplateIngredientToSch VolumeContainer * container = ContainerInterface::getVolumeContainer( inputHopper); - if (container == NULL) + if (container == nullptr) return NetworkId::cms_invalid; for (ContainerIterator iter = container->begin(); iter != container->end(); ++iter) { const Container::ContainedItem & itemId = *iter; TangibleObject * object = safe_cast(itemId.getObject()); - if (object != NULL) + if (object != nullptr) { // see if the object is a factory or not FactoryObject * crate = dynamic_cast(object); - if (crate != NULL && crate->getCount() > 0) + if (crate != nullptr && crate->getCount() > 0) { if (crate->getContainedObjectTemplate() == &componentTemplate) { @@ -1300,7 +1300,7 @@ const NetworkId & ManufactureInstallationObject::transferResourceTypeToSchematic const NetworkId & resourceTypeId, int resourceCount) { VolumeContainer * const container = ContainerInterface::getVolumeContainer(inputHopper); - if (container == NULL) + if (container == nullptr) return NetworkId::cms_invalid; // keep a map of the sources that are providing the resources @@ -1317,7 +1317,7 @@ const NetworkId & ManufactureInstallationObject::transferResourceTypeToSchematic const Container::ContainedItem & itemId = *iter; ResourceContainerObject * object = dynamic_cast( itemId.getObject()); - if (object != NULL && object->getResourceTypeId() == resourceTypeId) + if (object != nullptr && object->getResourceTypeId() == resourceTypeId) { // see if this crate fills our requirements if (object->getQuantity() >= resourceCount) @@ -1346,7 +1346,7 @@ const NetworkId & ManufactureInstallationObject::transferResourceTypeToSchematic if (!smallCrate->removeResource(resourceTypeId, smallCrate->getQuantity(), &sources)) return NetworkId::cms_invalid; // small crate has been deleted by the resource system - *crateIter = NULL; + *crateIter = nullptr; ++crateIter; } else @@ -1390,41 +1390,41 @@ const NetworkId & ManufactureInstallationObject::transferResourceTypeToSchematic * * @param contents an object we want to put in the crate * - * @return the crate, or NULL if we have no crate + * @return the crate, or nullptr if we have no crate */ FactoryObject * ManufactureInstallationObject::getCurrentCrate(const ManufactureSchematicObject & source) { - FactoryObject * crate = NULL; + FactoryObject * crate = nullptr; ServerObject * outputHopper = getOutputHopper(); - if (outputHopper == NULL) - return NULL; + if (outputHopper == nullptr) + return nullptr; - if (m_currentCrate.getObject() != NULL) + if (m_currentCrate.getObject() != nullptr) { crate = safe_cast(m_currentCrate.getObject()); // make sure the crate is still in our hopper and is not full - if (crate != NULL && ContainerInterface::getContainedByObject(*crate) == outputHopper && + if (crate != nullptr && ContainerInterface::getContainedByObject(*crate) == outputHopper && crate->getCraftedId() == source.getOriginalId()) { if (crate->getCount() < source.getItemsPerContainer()) return crate; else - return NULL; + return nullptr; } } // see if there is another non-full crate in the output hopper we could use const VolumeContainer * hopperContainer = ContainerInterface::getVolumeContainer( *outputHopper); - if (hopperContainer != NULL) + if (hopperContainer != nullptr) { for (ContainerConstIterator iter = hopperContainer->begin(); iter != hopperContainer->end(); ++iter) { crate = dynamic_cast((*iter).getObject()); - if (crate != NULL && crate->getCraftedId() == source.getOriginalId() && crate->getCount() < source.getItemsPerContainer()) + if (crate != nullptr && crate->getCraftedId() == source.getOriginalId() && crate->getCount() < source.getItemsPerContainer()) { // change our current crate to the one we found m_currentCrate = CachedNetworkId(*crate); @@ -1433,7 +1433,7 @@ FactoryObject * ManufactureInstallationObject::getCurrentCrate(const Manufacture } } - return NULL; + return nullptr; } // ManufactureInstallationObject::getCurrentCrate // ---------------------------------------------------------------------- @@ -1449,21 +1449,21 @@ FactoryObject * ManufactureInstallationObject::getCurrentCrate(const Manufacture FactoryObject * ManufactureInstallationObject::makeNewCrate(const ManufactureSchematicObject & source) { ServerObject * outputHopper = getOutputHopper(); - if (outputHopper == NULL) - return NULL; + if (outputHopper == nullptr) + return nullptr; // get the correct factory object template from the draft schematic const ManufactureSchematicObject * manfSchematic = getSchematic(); - if (manfSchematic == NULL) - return NULL; + if (manfSchematic == nullptr) + return nullptr; const DraftSchematicObject * draftSchematic = DraftSchematicObject::getSchematic( manfSchematic->getDraftSchematic()); - if (draftSchematic == NULL) - return NULL; + if (draftSchematic == nullptr) + return nullptr; - ServerObject * object = NULL; + ServerObject * object = nullptr; const ServerFactoryObjectTemplate * crateTemplate = draftSchematic->getCrateObjectTemplate(); - if (crateTemplate != NULL) + if (crateTemplate != nullptr) { object = ServerWorld::createNewObject(*crateTemplate, *outputHopper, false); } @@ -1472,11 +1472,11 @@ FactoryObject * ManufactureInstallationObject::makeNewCrate(const ManufactureSch object = ServerWorld::createNewObject(DEFAULT_FACTORY_OBJECT_TEMPLATE, *outputHopper, false); } - if (object == NULL) - return NULL; + if (object == nullptr) + return nullptr; FactoryObject * crate = dynamic_cast(object); - if (crate == NULL) + if (crate == nullptr) object->permanentlyDestroy(DeleteReasons::SetupFailed); else { @@ -1526,7 +1526,7 @@ bool ManufactureInstallationObject::TaskManufactureObject::run() { ManufactureInstallationObject * manfInst = safe_cast (m_manfInstallation.getObject()); - if (manfInst == NULL || !manfInst->isActive()) + if (manfInst == nullptr || !manfInst->isActive()) return true; if (!manfInst->createObject()) @@ -1545,7 +1545,7 @@ void ManufactureInstallationObject::getAttributes(AttributeVector & data) const InstallationObject::getAttributes(data); ManufactureSchematicObject * schematic = getSchematic(); - if (schematic != NULL) + if (schematic != nullptr) { char valueBuffer[32]; const size_t valueBuffer_size = sizeof (valueBuffer); diff --git a/engine/server/library/serverGame/src/shared/object/ManufactureSchematicObject.cpp b/engine/server/library/serverGame/src/shared/object/ManufactureSchematicObject.cpp index 00b51fc1..e4646395 100755 --- a/engine/server/library/serverGame/src/shared/object/ManufactureSchematicObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/ManufactureSchematicObject.cpp @@ -96,7 +96,7 @@ using namespace ManufactureSchematicObjectNamespace; //---------------------------------------------------------------------- -const SharedObjectTemplate * ManufactureSchematicObject::m_defaultSharedTemplate = NULL; +const SharedObjectTemplate * ManufactureSchematicObject::m_defaultSharedTemplate = nullptr; //======================================================================== @@ -170,11 +170,11 @@ const SharedObjectTemplate * ManufactureSchematicObject::getDefaultSharedTemplat { static const ConstCharCrcLowerString templateName("object/manufacture_schematic/base/shared_manufacture_schematic_default.iff"); - if (m_defaultSharedTemplate == NULL) + if (m_defaultSharedTemplate == nullptr) { m_defaultSharedTemplate = safe_cast(ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != NULL) + WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create default shared object template %s", templateName.getString())); + if (m_defaultSharedTemplate != nullptr) ExitChain::add (removeDefaultTemplate, "ManufactureSchematicObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -187,10 +187,10 @@ const SharedObjectTemplate * ManufactureSchematicObject::getDefaultSharedTemplat */ void ManufactureSchematicObject::removeDefaultTemplate() { - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } // ManufactureSchematicObject::removeDefaultTemplate @@ -209,7 +209,7 @@ void ManufactureSchematicObject::init(const DraftSchematicObject & schematic, co m_draftSchematicSharedTemplate = schematic.getSharedTemplate()->getCrcName().getCrc(); m_creatorId = creator; - if (creator.getObject() != NULL) + if (creator.getObject() != nullptr) { m_creatorName = safe_cast(creator.getObject())-> getObjectName(); @@ -481,7 +481,7 @@ ServerIntangibleObjectTemplate::CraftingType ManufactureSchematicObject::getCate { schematicOk = false; } - else if (draft != NULL) + else if (draft != nullptr) { // test the ingredients Crafting::IngredientSlot sourceSlot; @@ -520,11 +520,11 @@ ServerIntangibleObjectTemplate::CraftingType ManufactureSchematicObject::getCate return draft->getCategory(); // this schematic can't be used, inform the player - const CreatureObject * owner = NULL; + const CreatureObject * owner = nullptr; const Object * object = ContainerInterface::getContainedByObject(*this); - while (owner == NULL && object != NULL && object->asServerObject() != NULL) + while (owner == nullptr && object != nullptr && object->asServerObject() != nullptr) { - if (object->asServerObject()->asCreatureObject() != NULL) + if (object->asServerObject()->asCreatureObject() != nullptr) owner = object->asServerObject()->asCreatureObject(); else object = ContainerInterface::getContainedByObject(*object); @@ -534,7 +534,7 @@ ServerIntangibleObjectTemplate::CraftingType ManufactureSchematicObject::getCate LOG("CustomerService", ("Crafting:Manufacturing schematic %s " "owned by %s is unuseable due to %s", getNetworkId().getValueString().c_str(), PlayerObject::getAccountDescription(owner).c_str(), errBuffer)); - if (owner != NULL) + if (owner != nullptr) { // send mail to the owner telling them their schematic can't be used const static StringId message("system_msg", "manf_schematic_unuseable"); @@ -562,7 +562,7 @@ bool ManufactureSchematicObject::mustDestroyIngredients() const const DraftSchematicObject * draft = DraftSchematicObject::getSchematic( m_draftSchematic.get()); NOT_NULL(draft); - if (draft != NULL) + if (draft != nullptr) return draft->mustDestroyIngredients(); return false; } // ManufactureSchematicObject::mustDestroyIngredients @@ -701,12 +701,12 @@ bool ManufactureSchematicObject::getSlot(int index, Crafting::IngredientSlot & d // get the xp type based on the resource container int xpType = 0; const ResourceTypeObject * const resourceType = ServerUniverse::getInstance().getResourceTypeById(ingredientId); - if (resourceType != NULL) + if (resourceType != nullptr) { std::string crateTemplateName; resourceType->getCrateTemplate(crateTemplateName); const ServerObjectTemplate * crateTemplate = safe_cast(ObjectTemplateList::fetch(crateTemplateName)); - if (crateTemplate != NULL && crateTemplate->getXpPointsCount() > 0) + if (crateTemplate != nullptr && crateTemplate->getXpPointsCount() > 0) { ServerObjectTemplate::Xp xpData; crateTemplate->getXpPoints(xpData, 0); @@ -1024,10 +1024,10 @@ void ManufactureSchematicObject::addSlotComponent(const StringId & name, // Check if the object being added is a factory const TangibleObject * componentPtr = &component; const FactoryObject * factory = dynamic_cast(&component); - if (factory != NULL) + if (factory != nullptr) { componentPtr = factory->getContainedObject(); - if (componentPtr == NULL) + if (componentPtr == nullptr) { WARNING(true, ("ManufactureSchematicObject::addSlotComponent passed " "FactoryObject %s with no contained object", @@ -1112,11 +1112,11 @@ TangibleObject * ManufactureSchematicObject::getComponent( const Crafting::ComponentIngredient & info) const { const VolumeContainer * volumeContainer = ContainerInterface::getVolumeContainer(*this); - if (volumeContainer == NULL) + if (volumeContainer == nullptr) { DEBUG_WARNING(true, ("Manf schematic %s does not have a volume container!", getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } // check if the component is in a FactoryObject; if it is, return the factory, @@ -1124,10 +1124,10 @@ TangibleObject * ManufactureSchematicObject::getComponent( if (info.ingredient != NetworkId::cms_invalid) { ServerObject * object = ServerWorld::findObjectByNetworkId(info.ingredient); - if (object != NULL) + if (object != nullptr) { Object * container = ContainerInterface::getContainedByObject(*object); - if (container != NULL && dynamic_cast(container) != NULL) + if (container != nullptr && dynamic_cast(container) != nullptr) return safe_cast(container); } } @@ -1137,7 +1137,7 @@ TangibleObject * ManufactureSchematicObject::getComponent( { const Container::ContainedItem & item = *iter; TangibleObject * object = safe_cast(item.getObject()); - if (object != NULL) + if (object != nullptr) { if (info.ingredient != NetworkId::cms_invalid) { @@ -1154,7 +1154,7 @@ TangibleObject * ManufactureSchematicObject::getComponent( } } } - return NULL; + return nullptr; } // ManufactureSchematicObject::getComponent //----------------------------------------------------------------------- @@ -1295,7 +1295,7 @@ void ManufactureSchematicObject::clearSlotSources() m_factories.begin(); iter != m_factories.end(); ++iter) { FactoryObject * factory = safe_cast((*iter).getObject()); - if (factory != NULL) + if (factory != nullptr) { factory->endCraftingSession(); } @@ -1305,23 +1305,23 @@ void ManufactureSchematicObject::clearSlotSources() // get rid of all our held ingredients VolumeContainer * volumeContainer = ContainerInterface::getVolumeContainer(*this); - if (volumeContainer != NULL && volumeContainer->getNumberOfItems() > 0) + if (volumeContainer != nullptr && volumeContainer->getNumberOfItems() > 0) { // for a stacked ingredient, if there are still more than one items in the stack, // "consume" 1 item from the stack, and return it to the player's inventory std::set itemsToReturnToInventory; - ServerObject* inventory = NULL; + ServerObject* inventory = nullptr; for (ContainerIterator iter = volumeContainer->begin(); iter != volumeContainer->end(); ++iter) { - if ((*iter).getObject() != NULL) + if ((*iter).getObject() != nullptr) { bool destroyItem = true; TangibleObject* to = safe_cast((*iter).getObject())->asTangibleObject(); - if (to && (to->getCount() > 1) && (dynamic_cast(to) == NULL)) + if (to && (to->getCount() > 1) && (dynamic_cast(to) == nullptr)) { - if (inventory == NULL) + if (inventory == nullptr) { ServerObject * o = safe_cast(ContainerInterface::getContainedByObject(*to)); while (o) @@ -1357,7 +1357,7 @@ void ManufactureSchematicObject::clearSlotSources() Container::ContainerErrorCode errCode; for (std::set::const_iterator iter = itemsToReturnToInventory.begin(); iter != itemsToReturnToInventory.end(); ++iter) { - if (!ContainerInterface::transferItemToVolumeContainer(*inventory, **iter, NULL, errCode)) + if (!ContainerInterface::transferItemToVolumeContainer(*inventory, **iter, nullptr, errCode)) { (*iter)->permanentlyDestroy(DeleteReasons::Replaced); } @@ -1741,11 +1741,11 @@ bool ManufactureSchematicObject::getCustomization(const std::string & name, const DynamicVariableList * objvars = getObjVars(); NOT_NULL(objvars); const DynamicVariableList * customs = safe_cast(objvars->getItemByName("cust")); - if (customs == NULL) + if (customs == nullptr) return false; const DynamicVariableList * custom = safe_cast(customs->getItemByName(name)); - if (custom == NULL) + if (custom == nullptr) return false; data.name = name; @@ -1771,7 +1771,7 @@ bool ManufactureSchematicObject::getCustomization(int index, const DynamicVariableList * objvars = getObjVars(); NOT_NULL(objvars); const DynamicVariableList * customs = safe_cast(objvars->getItemByName("cust")); - if (customs == NULL) + if (customs == nullptr) return false; int count = customs->getCount(); @@ -1799,7 +1799,7 @@ int ManufactureSchematicObject::getCustomizationsCount() const const DynamicVariableList * objvars = getObjVars(); NOT_NULL(objvars); const DynamicVariableList * customs = safe_cast(objvars->getItemByName("cust")); - if (customs == NULL) + if (customs == nullptr) return 0; return customs->getCount(); @@ -1838,7 +1838,7 @@ bool ManufactureSchematicObject::setCustomization(int index, int value, ServerObject & prototype) { ManufactureSchematicSynchronizedUi * sync = safe_cast(getSynchronizedUi ()); - if (sync == NULL) + if (sync == nullptr) return false; const std::string & customName = sync->getCustomizationName(index); @@ -1863,7 +1863,7 @@ bool ManufactureSchematicObject::setCustomization(const std::string & name, int value, ServerObject & prototype) { ManufactureSchematicSynchronizedUi * sync = safe_cast(getSynchronizedUi ()); - if (sync == NULL) + if (sync == nullptr) return false; // make sure the value is within range @@ -1878,10 +1878,10 @@ bool ManufactureSchematicObject::setCustomization(const std::string & name, // save the customization string CustomizationDataProperty * const cdProperty = safe_cast(prototype.getProperty(CustomizationDataProperty::getClassPropertyId())); - if (cdProperty != NULL) + if (cdProperty != nullptr) { CustomizationData *const customizationData = cdProperty->fetchCustomizationData(); - if (customizationData != NULL) + if (customizationData != nullptr) { m_appearanceData = customizationData->writeLocalDataToString(); setObjVarItem("customization_data", m_appearanceData.get()); @@ -1993,7 +1993,7 @@ void ManufactureSchematicObject::removeCraftingFactory(const FactoryObject & fac bool ManufactureSchematicObject::addIngredient(ServerObject & component) { Container::ContainerErrorCode tmp = Container::CEC_Success; - return ContainerInterface::transferItemToVolumeContainer(*this, component, NULL, tmp); + return ContainerInterface::transferItemToVolumeContainer(*this, component, nullptr, tmp); } // ManufactureSchematicObject::addIngredient //----------------------------------------------------------------------- @@ -2037,7 +2037,7 @@ bool ManufactureSchematicObject::removeIngredient(ServerObject & component, { // if the component is a factory, treat is differently FactoryObject * factory = dynamic_cast(&component); - if (factory != NULL) + if (factory != nullptr) { // if the factory is contained by us, move it to the destination, // making sure that its count is 1; if it is not contained by us, @@ -2050,7 +2050,7 @@ bool ManufactureSchematicObject::removeIngredient(ServerObject & component, factory->removeCraftingReferences(factory->getCount() - 1); Container::ContainerErrorCode errCode; return ContainerInterface::transferItemToVolumeContainer(destination, - *factory, NULL, errCode); + *factory, nullptr, errCode); } else { @@ -2064,17 +2064,17 @@ bool ManufactureSchematicObject::removeIngredient(ServerObject & component, { // make sure the component is in our container Object * container = ContainerInterface::getContainedByObject(component); - if (container == NULL || container->getNetworkId() != getNetworkId()) + if (container == nullptr || container->getNetworkId() != getNetworkId()) { FactoryObject * factory = dynamic_cast(container); - if (factory != NULL) + if (factory != nullptr) return removeIngredient(*factory, destination); return false; } Container::ContainerErrorCode errCode; return ContainerInterface::transferItemToVolumeContainer(destination, component, - NULL, errCode); + nullptr, errCode); } } // ManufactureSchematicObject::removeIngredient @@ -2169,7 +2169,7 @@ void ManufactureSchematicObject::destroyAllIngredients() m_factories.begin(); iter != m_factories.end(); ++iter) { FactoryObject * factory = safe_cast((*iter).getObject()); - if (factory != NULL) + if (factory != nullptr) { factory->endCraftingSession(); } @@ -2179,24 +2179,24 @@ void ManufactureSchematicObject::destroyAllIngredients() // empty our volume container VolumeContainer * const container = ContainerInterface::getVolumeContainer(*this); - if (container != NULL) + if (container != nullptr) { // for a stacked ingredient, if there are still more than one items in the stack, // "consume" 1 item from the stack, and return it to the player's inventory std::set itemsToReturnToInventory; - ServerObject* inventory = NULL; + ServerObject* inventory = nullptr; ContainerIterator iter; for (iter = container->begin(); iter != container->end(); ++iter) { CachedNetworkId & itemId = *iter; - if (itemId.getObject() != NULL) + if (itemId.getObject() != nullptr) { bool destroyItem = true; TangibleObject* to = safe_cast(itemId.getObject())->asTangibleObject(); - if (to && (to->getCount() > 1) && (dynamic_cast(to) == NULL)) + if (to && (to->getCount() > 1) && (dynamic_cast(to) == nullptr)) { - if (inventory == NULL) + if (inventory == nullptr) { ServerObject * o = safe_cast(ContainerInterface::getContainedByObject(*to)); while (o) @@ -2235,7 +2235,7 @@ void ManufactureSchematicObject::destroyAllIngredients() Container::ContainerErrorCode errCode; for (std::set::const_iterator iter = itemsToReturnToInventory.begin(); iter != itemsToReturnToInventory.end(); ++iter) { - if (!ContainerInterface::transferItemToVolumeContainer(*inventory, **iter, NULL, errCode)) + if (!ContainerInterface::transferItemToVolumeContainer(*inventory, **iter, nullptr, errCode)) { (*iter)->permanentlyDestroy(DeleteReasons::Consumed); } @@ -2281,29 +2281,29 @@ void ManufactureSchematicObject::destroyAllIngredients() ServerObject * ManufactureSchematicObject::manufactureObject(const NetworkId & creatorId, ServerObject & container, const SlotId & containerSlotId, bool prototype) { if (getCount() <= 0) - return NULL; + return nullptr; const DraftSchematicObject * draftSchematic = DraftSchematicObject::getSchematic(m_draftSchematic.get()); - if (draftSchematic == NULL) + if (draftSchematic == nullptr) { - return NULL; + return nullptr; } - if (draftSchematic->getCraftedObjectTemplate() == NULL) + if (draftSchematic->getCraftedObjectTemplate() == nullptr) { DEBUG_WARNING(true, ("Draft schematic %s does not have a craftable object template!\n", draftSchematic->getTemplateName())); - return NULL; + return nullptr; } // create the item TangibleObject * const object = dynamic_cast(ServerWorld::createNewObject(*draftSchematic->getCraftedObjectTemplate(), container, containerSlotId, false)); - if (object == NULL) + if (object == nullptr) { DEBUG_WARNING(true, ("Player %s failed to create object for template " "%s.\n", creatorId.getValueString().c_str(), draftSchematic->getCraftedObjectTemplate()->getName())); - return NULL; + return nullptr; } if (!getAssignedObjectName().empty()) @@ -2327,7 +2327,7 @@ ServerObject * ManufactureSchematicObject::manufactureObject(const NetworkId & c // set the creator xp type from the schematic template const ServerObjectTemplate * schematicTemplate = safe_cast(draftSchematic->getObjectTemplate()); - if (schematicTemplate != NULL && schematicTemplate->getXpPointsCount() > 0) + if (schematicTemplate != nullptr && schematicTemplate->getXpPointsCount() > 0) { ServerObjectTemplate::Xp xpData; schematicTemplate->getXpPoints(xpData, 0); @@ -2339,7 +2339,7 @@ ServerObject * ManufactureSchematicObject::manufactureObject(const NetworkId & c if (!setObjectComponents(object, true)) { object->permanentlyDestroy(DeleteReasons::BadContainerTransfer); - return NULL; + return nullptr; } // allow the schematic scripts to modify the object @@ -2356,7 +2356,7 @@ ServerObject * ManufactureSchematicObject::manufactureObject(const NetworkId & c if (result == SCRIPT_OVERRIDE) { object->permanentlyDestroy(DeleteReasons::Script); - return NULL; + return nullptr; } incrementCount(-1); @@ -2392,15 +2392,15 @@ ServerObject * ManufactureSchematicObject::manufactureObject(const Vector & posi { const DraftSchematicObject * draftSchematic = DraftSchematicObject::getSchematic( m_draftSchematic.get()); - if (draftSchematic == NULL) + if (draftSchematic == nullptr) { - return NULL; + return nullptr; } - if (draftSchematic->getCraftedObjectTemplate() == NULL) + if (draftSchematic->getCraftedObjectTemplate() == nullptr) { DEBUG_WARNING(true, ("Draft schematic %s does not have a craftable " "object template!\n", draftSchematic->getTemplateName())); - return NULL; + return nullptr; } Transform tr; @@ -2409,11 +2409,11 @@ ServerObject * ManufactureSchematicObject::manufactureObject(const Vector & posi TangibleObject * object = dynamic_cast(ServerWorld::createNewObject( *draftSchematic->getCraftedObjectTemplate(), tr, 0, false)); - if (object == NULL) + if (object == nullptr) { DEBUG_WARNING(true, ("Failed to create object for template " "%s.\n", draftSchematic->getCraftedObjectTemplate()->getName())); - return NULL; + return nullptr; } if (!getAssignedObjectName().empty()) @@ -2468,7 +2468,7 @@ bool ManufactureSchematicObject::setObjectComponents(TangibleObject * object, bo // check the objects in the schematic volume container to make sure they match VolumeContainer * volumeContainer = ContainerInterface::getVolumeContainer(*this); - if (volumeContainer == NULL) + if (volumeContainer == nullptr) { DEBUG_WARNING(true, ("Manf schematic %s does not have a volume container!", getNetworkId().getValueString().c_str())); @@ -2478,7 +2478,7 @@ bool ManufactureSchematicObject::setObjectComponents(TangibleObject * object, bo // for a stacked ingredient, if there are still more than one items in the stack, // "consume" 1 item from the stack, and return it to the player's inventory std::set itemsToReturnToInventory; - ServerObject* inventory = NULL; + ServerObject* inventory = nullptr; DynamicVariableList::NestedList slots(getObjVars(),OBJVAR_SLOTS); @@ -2533,11 +2533,11 @@ bool ManufactureSchematicObject::setObjectComponents(TangibleObject * object, bo { Container::ContainedItem & item = *iter; TangibleObject * const testComponent = dynamic_cast(item.getObject()); - if (testComponent == NULL) + if (testComponent == nullptr) continue; if (itemsToReturnToInventory.count(testComponent) > 0) continue; - FactoryObject * crate = NULL; + FactoryObject * crate = nullptr; bool found = false; bool foundCrate = false; if (component->ingredient != NetworkId::cms_invalid) @@ -2548,7 +2548,7 @@ bool ManufactureSchematicObject::setObjectComponents(TangibleObject * object, bo // see if the test component is a crate crate = dynamic_cast(testComponent); - if (crate != NULL && crate->getCount() == ingredientCount) + if (crate != nullptr && crate->getCount() == ingredientCount) { foundCrate = true; } @@ -2598,7 +2598,7 @@ bool ManufactureSchematicObject::setObjectComponents(TangibleObject * object, bo if (!componentTableName.empty()) { DataTable * componentTable = DataTableManager::getTable(componentTableName, true); - if (componentTable != NULL) + if (componentTable != nullptr) { uint32 value = INVALID_CRC; if (draftSlot.appearance == "component") @@ -2645,9 +2645,9 @@ bool ManufactureSchematicObject::setObjectComponents(TangibleObject * object, bo } bool destroyItem = true; - if ((testComponent->getCount() > 1) && (dynamic_cast(testComponent) == NULL)) + if ((testComponent->getCount() > 1) && (dynamic_cast(testComponent) == nullptr)) { - if (inventory == NULL) + if (inventory == nullptr) { ServerObject * o = safe_cast(ContainerInterface::getContainedByObject(*testComponent)); while (o) @@ -2701,7 +2701,7 @@ bool ManufactureSchematicObject::setObjectComponents(TangibleObject * object, bo Container::ContainerErrorCode errCode; for (std::set::const_iterator iter = itemsToReturnToInventory.begin(); iter != itemsToReturnToInventory.end(); ++iter) { - if (!ContainerInterface::transferItemToVolumeContainer(*inventory, **iter, NULL, errCode)) + if (!ContainerInterface::transferItemToVolumeContainer(*inventory, **iter, nullptr, errCode)) { (*iter)->permanentlyDestroy(DeleteReasons::Consumed); } @@ -2723,15 +2723,15 @@ bool ManufactureSchematicObject::setObjectComponents(TangibleObject * object, bo for (iter = volumeContainer->begin(); iter != volumeContainer->end(); ++iter) { - if ((*iter).getObject() != NULL) + if ((*iter).getObject() != nullptr) { ServerObject * temp = safe_cast((*iter).getObject()); bool destroyItem = true; TangibleObject* to = temp->asTangibleObject(); - if (to && (to->getCount() > 1) && (dynamic_cast(to) == NULL)) + if (to && (to->getCount() > 1) && (dynamic_cast(to) == nullptr)) { - if (inventory == NULL) + if (inventory == nullptr) { ServerObject * o = safe_cast(ContainerInterface::getContainedByObject(*to)); while (o) @@ -2787,7 +2787,7 @@ bool ManufactureSchematicObject::setObjectComponents(TangibleObject * object, bo Container::ContainerErrorCode errCode; for (std::set::const_iterator iter = itemsToReturnToInventory.begin(); iter != itemsToReturnToInventory.end(); ++iter) { - if (!ContainerInterface::transferItemToVolumeContainer(*inventory, **iter, NULL, errCode)) + if (!ContainerInterface::transferItemToVolumeContainer(*inventory, **iter, nullptr, errCode)) { (*iter)->permanentlyDestroy(DeleteReasons::Replaced); } @@ -2847,7 +2847,7 @@ void ManufactureSchematicObject::requestSlots(ServerObject & player) const case Crafting::IT_schematicGeneric: { const TangibleObject * const ingredient = dynamic_cast(NetworkIdManager::getObjectById(ingredientId)); - if (ingredient != NULL) + if (ingredient != nullptr) { optionInfo.ingredient = ingredient->getEncodedObjectName(); // since names can be duplicated, concatinate the id of @@ -2870,7 +2870,7 @@ void ManufactureSchematicObject::requestSlots(ServerObject & player) const case Crafting::IT_resourceClass: { ResourceTypeObject const * const ingredient = ServerUniverse::getInstance().getResourceTypeById(ingredientId); - if (ingredient != NULL) + if (ingredient != nullptr) optionInfo.ingredient = Unicode::narrowToWide(ingredient->getResourceName()); else optionInfo.ingredient = Unicode::narrowToWide("unknown"); @@ -2942,7 +2942,7 @@ void ManufactureSchematicObject::getIngredientInfo (IngredientInfoVector & iiv) // the manf schematic to the name if (component->ingredient != NetworkId::cms_invalid) { - //-- null-separate the string if needed + //-- nullptr-separate the string if needed if (!ingredientName.empty () && ingredientName [0] == '@') ingredientName.push_back ('\0'); @@ -2990,7 +2990,7 @@ void ManufactureSchematicObject::getIngredientInfo (IngredientInfoVector & iiv) case Crafting::IT_resourceClass: { ResourceTypeObject const * const ingredient = ServerUniverse::getInstance().getResourceTypeById(ingredientId); - if (ingredient != NULL) + if (ingredient != nullptr) ingredientName = Unicode::narrowToWide(ingredient->getResourceName ()); } break; @@ -3125,7 +3125,7 @@ const std::map & ManufactureSchematicObject::getAttributes() co int ManufactureSchematicObject::getVolume() const { const DraftSchematicObject * const schematic = DraftSchematicObject::getSchematic(getDraftSchematic()); - if (schematic != NULL) + if (schematic != nullptr) return schematic->getObjectTemplate()->asServerObjectTemplate()->getVolume(); return IntangibleObject::getVolume(); } // ManufactureSchematicObject::getVolume @@ -3212,7 +3212,7 @@ void ManufactureSchematicObject::recalculateData() else { const DraftSchematicObject * const missingSchematic = DraftSchematicObject::getSchematic(MISSING_SCHEMATIC_SUBSTITUTE); - if (missingSchematic != NULL) + if (missingSchematic != nullptr) m_draftSchematicSharedTemplate = missingSchematic->getSharedTemplate()->getCrcName().getCrc(); else WARNING_STRICT_FATAL(true, ("Cannot find draft schematic %s! This must always exist!", MISSING_SCHEMATIC_SUBSTITUTE.c_str())); @@ -3262,7 +3262,7 @@ void ManufactureSchematicObject::getByteStreamFromAutoVariable(const std::string if (name == "msoCtsPackUnpack") { // creator Id/Name - CreatureObject const * containingPlayer = NULL; + CreatureObject const * containingPlayer = nullptr; ServerObject const * parent = safe_cast(ContainerInterface::getContainedByObject(*this)); while (parent) @@ -3271,7 +3271,7 @@ void ManufactureSchematicObject::getByteStreamFromAutoVariable(const std::string if (containingPlayer && PlayerCreatureController::getPlayerObject(containingPlayer)) break; - containingPlayer = NULL; + containingPlayer = nullptr; parent = safe_cast(ContainerInterface::getContainedByObject(*parent)); } @@ -3329,7 +3329,7 @@ void ManufactureSchematicObject::setAutoVariableFromByteStream(const std::string Archive::AutoDeltaVariable creatorIsOwner; creatorIsOwner.unpackDelta(ri); - CreatureObject const * containingPlayer = NULL; + CreatureObject const * containingPlayer = nullptr; if (creatorIsOwner.get()) { @@ -3340,7 +3340,7 @@ void ManufactureSchematicObject::setAutoVariableFromByteStream(const std::string if (containingPlayer && PlayerCreatureController::getPlayerObject(containingPlayer)) break; - containingPlayer = NULL; + containingPlayer = nullptr; parent = safe_cast(ContainerInterface::getContainedByObject(*parent)); } } diff --git a/engine/server/library/serverGame/src/shared/object/MissionObject.cpp b/engine/server/library/serverGame/src/shared/object/MissionObject.cpp index 9aa5873a..fb7504f0 100755 --- a/engine/server/library/serverGame/src/shared/object/MissionObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/MissionObject.cpp @@ -32,7 +32,7 @@ //----------------------------------------------------------------------- -const SharedObjectTemplate * MissionObject::m_defaultSharedTemplate = NULL; +const SharedObjectTemplate * MissionObject::m_defaultSharedTemplate = nullptr; const char * const s_missionObjectTemplateName = "object/mission/base_mission_object.iff"; //----------------------------------------------------------------------- @@ -125,13 +125,13 @@ const SharedObjectTemplate * MissionObject::getDefaultSharedTemplate(void) const { static const ConstCharCrcLowerString templateName("object/mission/base/shared_mission_default.iff"); - if (m_defaultSharedTemplate == NULL) + if (m_defaultSharedTemplate == nullptr) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create " + WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create " "default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) ExitChain::add (removeDefaultTemplate, "MissionObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -144,10 +144,10 @@ static const ConstCharCrcLowerString templateName("object/mission/base/shared_mi */ void MissionObject::removeDefaultTemplate(void) { - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } // MissionObject::removeDefaultTemplate @@ -158,7 +158,7 @@ void MissionObject::abortMission() ScriptParams params; ScriptDictionaryPtr dictionary; getScriptObject()->makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(getNetworkId(), @@ -710,7 +710,7 @@ void MissionObject::getByteStreamFromAutoVariable(const std::string & name, Arch Archive::put(target, m_waypoint.get().getWaypointDataBase()); // mission location target - CreatureObject const * containingPlayer = NULL; + CreatureObject const * containingPlayer = nullptr; ServerObject const * parent = safe_cast(ContainerInterface::getContainedByObject(*this)); while (parent) { @@ -718,7 +718,7 @@ void MissionObject::getByteStreamFromAutoVariable(const std::string & name, Arch if (containingPlayer && PlayerCreatureController::getPlayerObject(containingPlayer)) break; - containingPlayer = NULL; + containingPlayer = nullptr; parent = safe_cast(ContainerInterface::getContainedByObject(*parent)); } @@ -785,7 +785,7 @@ void MissionObject::setAutoVariableFromByteStream(const std::string & name, cons m_title.unpackDelta(ri); // mission holder id - CreatureObject * containingPlayer = NULL; + CreatureObject * containingPlayer = nullptr; ServerObject * parent = safe_cast(ContainerInterface::getContainedByObject(*this)); while (parent) { @@ -793,7 +793,7 @@ void MissionObject::setAutoVariableFromByteStream(const std::string & name, cons if (containingPlayer && PlayerCreatureController::getPlayerObject(containingPlayer)) break; - containingPlayer = NULL; + containingPlayer = nullptr; parent = safe_cast(ContainerInterface::getContainedByObject(*parent)); } diff --git a/engine/server/library/serverGame/src/shared/object/ObjectFactory.cpp b/engine/server/library/serverGame/src/shared/object/ObjectFactory.cpp index bcba1d72..e23c7d1d 100755 --- a/engine/server/library/serverGame/src/shared/object/ObjectFactory.cpp +++ b/engine/server/library/serverGame/src/shared/object/ObjectFactory.cpp @@ -53,14 +53,14 @@ ServerObject * ServerWorld::createObjectFromTemplate(uint32 templateCrc, const N WARNING(!objectTemplate, ("Missing Template! Can't create object from " "template crc %lu(%s), file not found", templateCrc, ObjectTemplateList::lookUp(templateCrc).getString())); - Object *object = NULL; + Object *object = nullptr; if (objectTemplate) { ServerObjectTemplate const * serverObjectTemplate = objectTemplate->asServerObjectTemplate(); - if ( (serverObjectTemplate == NULL) - || ((serverObjectTemplate != NULL) && (ObjectTemplateList::lookUp(serverObjectTemplate->getSharedTemplate().c_str()).getCrc() != 0))) + if ( (serverObjectTemplate == nullptr) + || ((serverObjectTemplate != nullptr) && (ObjectTemplateList::lookUp(serverObjectTemplate->getSharedTemplate().c_str()).getCrc() != 0))) { PROFILER_AUTO_BLOCK_DEFINE("ObjectTemplate::createObject"); object = objectTemplate->createObject(); diff --git a/engine/server/library/serverGame/src/shared/object/ObjectTracker.cpp b/engine/server/library/serverGame/src/shared/object/ObjectTracker.cpp index 888b5d77..23b38bfe 100755 --- a/engine/server/library/serverGame/src/shared/object/ObjectTracker.cpp +++ b/engine/server/library/serverGame/src/shared/object/ObjectTracker.cpp @@ -81,7 +81,7 @@ int ObjectTracker::getNumPlayers() void ObjectTracker::getNumPlayersByFaction(int & imperial, int & rebel, int & neutral) { - time_t const now = ::time(NULL); + time_t const now = ::time(nullptr); if ((now - m_lastTimeCalculateFactionalPlayersCount) > 60) { m_numPlayersImperial = 0; diff --git a/engine/server/library/serverGame/src/shared/object/PatrolPathNodeProperty.cpp b/engine/server/library/serverGame/src/shared/object/PatrolPathNodeProperty.cpp index c17b6ca6..4731fcd7 100755 --- a/engine/server/library/serverGame/src/shared/object/PatrolPathNodeProperty.cpp +++ b/engine/server/library/serverGame/src/shared/object/PatrolPathNodeProperty.cpp @@ -36,7 +36,7 @@ m_roots(new std::set) PatrolPathNodeProperty::~PatrolPathNodeProperty() { delete m_roots; - m_roots = NULL; + m_roots = nullptr; } //------------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/object/PlanetObject.cpp b/engine/server/library/serverGame/src/shared/object/PlanetObject.cpp index f6a57df4..0ecbb8d6 100755 --- a/engine/server/library/serverGame/src/shared/object/PlanetObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/PlanetObject.cpp @@ -126,7 +126,7 @@ namespace PlanetObjectNamespace const char * makeCopyOfString(const char * rhs) { - char * lhs = NULL; + char * lhs = nullptr; if (rhs) { lhs = new char[strlen(rhs) + 1]; @@ -144,7 +144,7 @@ namespace PlanetObjectNamespace int getNextGcwScoreDecayTime(int base); // dictionary containing the table showing factional presence activity - ScriptParams * s_factionalPresenceSuiTable = NULL; + ScriptParams * s_factionalPresenceSuiTable = nullptr; bool s_factionalPresenceSuiTableNeedRebuild = true; void decrementConnectedCharacterLfgDataFactionalPresenceCount(Archive::AutoDeltaMap, PlanetObject> & connectedCharacterLfgDataFactionalPresence, const LfgCharacterData & lfgCharacterData); @@ -914,7 +914,7 @@ void PlanetObject::onLoadedFromDatabase() // "server first" information and manually create the CollectionServerFirstObserver // object, so that there will only be 1 call to the CollectionServerFirstObserver // object when it goes out of scope at the end of the function - m_collectionServerFirst.setSourceObject(NULL); + m_collectionServerFirst.setSourceObject(nullptr); CollectionServerFirstObserver observer(this, Archive::ADOO_set); const DynamicVariableList & objvars = getObjVars(); @@ -1004,7 +1004,7 @@ void PlanetObject::setCollectionServerFirst(const CollectionsDataTable::Collecti if (objvars.hasItem(objvar) && (DynamicVariable::STRING_ARRAY == objvars.getType(objvar))) return; - const time_t timeNow = ::time(NULL); + const time_t timeNow = ::time(nullptr); char buffer[64]; snprintf(buffer, sizeof(buffer)-1, "%ld", timeNow); buffer[sizeof(buffer)-1] = '\0'; @@ -1131,7 +1131,7 @@ void PlanetObject::handleCMessageTo(MessageToPayload const &message) std::string const params(message.getPackedDataVector().begin(), message.getPackedDataVector().end()); Unicode::String const delimiters(Unicode::narrowToWide("|")); Unicode::UnicodeStringVector tokens; - if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, NULL)) && (tokens.size() == 2)) + if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, nullptr)) && (tokens.size() == 2)) { CollectionsDataTable::CollectionInfoCollection const * const collectionInfo = CollectionsDataTable::getCollectionByName(Unicode::wideToNarrow(tokens[0])); if (collectionInfo && collectionInfo->trackServerFirst && (collectionInfo->serverFirstClaimTime > 0)) @@ -1193,7 +1193,7 @@ void PlanetObject::handleCMessageTo(MessageToPayload const &message) else if (message.getMethod() == "C++DoGcwDecay") { // start decay handling loop - int const now = static_cast(::time(NULL)); + int const now = static_cast(::time(nullptr)); int timeNextGcwScoreDecay; if (!getObjVars().getItem("gcwScore.nextDecayTime", timeNextGcwScoreDecay) || (timeNextGcwScoreDecay <= 0)) { @@ -1397,7 +1397,7 @@ void PlanetObject::endBaselines() } // start decay handling loop - int const now = static_cast(::time(NULL)); + int const now = static_cast(::time(nullptr)); int timeNextGcwScoreDecay; if (!getObjVars().getItem("gcwScore.nextDecayTime", timeNextGcwScoreDecay) || (timeNextGcwScoreDecay <= 0)) { @@ -1481,7 +1481,7 @@ ScriptParams const *PlanetObject::getConnectedCharacterLfgDataFactionalPresenceT if (s_factionalPresenceSuiTableNeedRebuild) { delete s_factionalPresenceSuiTable; - s_factionalPresenceSuiTable = NULL; + s_factionalPresenceSuiTable = nullptr; PlanetObject const * const tatooine = ServerUniverse::getInstance().getTatooinePlanet(); if (tatooine) @@ -2156,8 +2156,8 @@ void PlanetObject::updateGcwTrackingData() // send our GCW score to the other clusters and process GCW scores we received from other clusters if (isAuthoritative() && (ConfigServerGame::getBroadcastGcwScoreToOtherGalaxies() || ConfigServerGame::getReceiveGcwScoreFromOtherGalaxies())) { - static time_t timeNextBroadcast = ::time(NULL) + ConfigServerGame::getBroadcastGcwScoreToOtherGalaxiesIntervalSeconds(); - time_t const timeNow = ::time(NULL); + static time_t timeNextBroadcast = ::time(nullptr) + ConfigServerGame::getBroadcastGcwScoreToOtherGalaxiesIntervalSeconds(); + time_t const timeNow = ::time(nullptr); if (timeNextBroadcast < timeNow) { if (ConfigServerGame::getBroadcastGcwScoreToOtherGalaxies()) @@ -2342,7 +2342,7 @@ void PlanetObject::adjustGcwImperialScore(std::string const & source, CreatureOb PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(sourceObject); if (playerObject) { - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); IGNORE_RETURN(playerObject->setObjVarItem(std::string("gcwContributionTracking.") + gcwCategory, timeNow)); IGNORE_RETURN(playerObject->setObjVarItem(std::string("gcwContributionTrackingLastUpdated"), timeNow)); @@ -2387,7 +2387,7 @@ void PlanetObject::adjustGcwRebelScore(std::string const & source, CreatureObjec PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(sourceObject); if (playerObject) { - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); IGNORE_RETURN(playerObject->setObjVarItem(std::string("gcwContributionTracking.") + gcwCategory, timeNow)); IGNORE_RETURN(playerObject->setObjVarItem(std::string("gcwContributionTrackingLastUpdated"), timeNow)); @@ -2441,7 +2441,7 @@ int PlanetObjectNamespace::getNextGcwScoreDecayTime(int base) } if (nextTime < 0) - nextTime = static_cast(::time(NULL)) + (60 * 60 * 24 * 7); + nextTime = static_cast(::time(nullptr)) + (60 * 60 * 24 * 7); return nextTime; } diff --git a/engine/server/library/serverGame/src/shared/object/PlayerObject.cpp b/engine/server/library/serverGame/src/shared/object/PlayerObject.cpp index 1e574c40..5a481653 100755 --- a/engine/server/library/serverGame/src/shared/object/PlayerObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/PlayerObject.cpp @@ -95,7 +95,7 @@ #include #include -const SharedObjectTemplate * PlayerObject::m_defaultSharedTemplate = NULL; +const SharedObjectTemplate * PlayerObject::m_defaultSharedTemplate = nullptr; bool PlayerObject::m_allowEmptySlot = false; @@ -317,7 +317,7 @@ PlayerObject::PlayerObject(const ServerPlayerObjectTemplate* newTemplate) : m_craftingStation(), m_craftingComponentBioLink(), m_useableDraftSchematics(), - m_draftSchematic(NULL), + m_draftSchematic(nullptr), m_matchMakingPersonalProfileId(), m_matchMakingCharacterProfileId(), m_friendList(), @@ -451,13 +451,13 @@ const SharedObjectTemplate * PlayerObject::getDefaultSharedTemplate() const { static const ConstCharCrcLowerString templateName("object/player/base/shared_player_default.iff"); - if (m_defaultSharedTemplate == NULL) + if (m_defaultSharedTemplate == nullptr) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create " + WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create " "default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) ExitChain::add (removeDefaultTemplate, "PlayerObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -470,10 +470,10 @@ static const ConstCharCrcLowerString templateName("object/player/base/shared_pla */ void PlayerObject::removeDefaultTemplate() { - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } // PlayerObject::removeDefaultTemplate @@ -514,7 +514,7 @@ int PlayerObject::getCurrentBornDate() time_t baseTime = mktime(&baseTimeData); // get the current time and compute the birth date - time_t currentTime = time(NULL); + time_t currentTime = time(nullptr); time_t delta = (currentTime - baseTime) / (60 * 60 * 24); delta += ((currentTime - baseTime) % (60 * 60 * 24) != 0 ? 1 : 0); return int(delta); @@ -631,14 +631,14 @@ void PlayerObject::virtualOnSetAuthority() if (isCrafting()) { const TangibleObject * tool = safe_cast(getCraftingTool().getObject()); - if (tool != NULL) + if (tool != nullptr) { const ManufactureSchematicObject * manfSchematic = tool->getCraftingManufactureSchematic(); - if (manfSchematic != NULL) + if (manfSchematic != nullptr) { m_draftSchematic = DraftSchematicObject::getSchematic( manfSchematic->getDraftSchematic()); - if (m_draftSchematic.getPointer() == NULL) + if (m_draftSchematic.getPointer() == nullptr) { WARNING(true, ("PlayerObject::virtualOnSetAuthority object " "%s is flagged as crafting, but has bad manf schematic %lu", @@ -749,7 +749,7 @@ int PlayerObject::getExperienceLimit(const std::string & experienceType) const if((*iter)) { const SkillObject::ExperiencePair * xpInfo = (*iter)->getPrerequisiteExperience(); - if (xpInfo != NULL && experienceType == xpInfo->first && xpInfo->second.second > 0) + if (xpInfo != nullptr && experienceType == xpInfo->first && xpInfo->second.second > 0) { if (limit == static_cast(-1) || limit < static_cast(xpInfo->second.second)) @@ -797,9 +797,9 @@ int PlayerObject::grantExperiencePoints(const std::string & experienceType, int // adjust the xp based on what faction is doing best // NOTE: HACK HACK HACK! const PlanetObject * tatooine = ServerUniverse::getInstance().getTatooinePlanet(); - if (tatooine == NULL) + if (tatooine == nullptr) tatooine = ServerUniverse::getInstance().getPlanetByName("Tatooine"); - if (tatooine == NULL) + if (tatooine == nullptr) { WARNING(true, ("Can't find planet tatooine from ServerUniverse")); } @@ -932,7 +932,7 @@ bool PlayerObject::grantSchematic(uint32 schematicCrc, bool fromSkill) const DraftSchematicObject * schematic = DraftSchematicObject::getSchematic( schematicCrc); - if (schematic != NULL) + if (schematic != nullptr) { // add the schematic to the player's draft schematic list Archive::AutoDeltaMap, int>::const_iterator found = m_draftSchematics.find(schematic->getCombinedCrc()); @@ -982,7 +982,7 @@ bool PlayerObject::revokeSchematic(uint32 schematicCrc, bool fromSkill) stopCrafting(false); const DraftSchematicObject * schematic = DraftSchematicObject::getSchematic(schematicCrc); - if (schematic != NULL) + if (schematic != nullptr) { // remove the schematic from the player's draft schematic list Archive::AutoDeltaMap, int>::const_iterator found = m_draftSchematics.find(schematic->getCombinedCrc()); @@ -1028,7 +1028,7 @@ bool PlayerObject::revokeSchematic(uint32 schematicCrc, bool fromSkill) bool PlayerObject::hasSchematic(uint32 schematicCrc) { const DraftSchematicObject * schematic = DraftSchematicObject::getSchematic(schematicCrc); - if (schematic != NULL) + if (schematic != nullptr) { std::map,int>::const_iterator found = m_draftSchematics.find(schematic->getCombinedCrc()); if (found != m_draftSchematics.end()) @@ -1065,7 +1065,7 @@ void PlayerObject::setCraftingTool(const TangibleObject & tool) */ void PlayerObject::setCraftingStation(const TangibleObject * station) { - if (station != NULL) + if (station != nullptr) { // verify the crafting station is valid if (station->getObjVars().hasItem(OBJVAR_CRAFTING_STATION)) @@ -1075,7 +1075,7 @@ void PlayerObject::setCraftingStation(const TangibleObject * station) // if we are private, make sure we have an ingredient hopper int privateStation = 0; station->getObjVars().getItem(OBJVAR_PRIVATE_STATION, privateStation); - if (privateStation == 1 && getCraftingLevel() == 3 && station->getIngredientHopper() == NULL) + if (privateStation == 1 && getCraftingLevel() == 3 && station->getIngredientHopper() == nullptr) { CreatureObject * const owner = getCreatureObject(); NOT_NULL(owner); @@ -1105,7 +1105,7 @@ void PlayerObject::setCraftingStation(const TangibleObject * station) bool PlayerObject::requestCraftingSession(const NetworkId & toolId) { CreatureObject * const owner = getCreatureObject(); - if (owner == NULL) + if (owner == nullptr) return false; const std::string myId = getNetworkId().getValueString(); @@ -1133,7 +1133,7 @@ bool PlayerObject::requestCraftingSession(const NetworkId & toolId) } TangibleObject * const tool = dynamic_cast(CachedNetworkId(toolId).getObject()); - if (tool == NULL) + if (tool == nullptr) { DEBUG_WARNING(true, ("Player %s requesting crafting session with invalid " "object %s", myIdString, toolIdString)); @@ -1155,7 +1155,7 @@ bool PlayerObject::requestCraftingSession(const NetworkId & toolId) { CachedNetworkId const & objId = (*iter); TangibleObject * const obj = safe_cast(objId.getObject()); - if ((obj != NULL) && obj->isCraftingTool() && (toolType & obj->getCraftingType())) + if ((obj != nullptr) && obj->isCraftingTool() && (toolType & obj->getCraftingType())) { return requestCraftingSession(objId) ; } @@ -1182,7 +1182,7 @@ bool PlayerObject::requestCraftingSession(const NetworkId & toolId) void PlayerObject::sendUseableDraftSchematics(std::vector & schematicNames) { CreatureObject * const owner = getCreatureObject(); - if (owner == NULL) + if (owner == nullptr) return; // keep around the names since we are just going to get an index back from @@ -1198,7 +1198,7 @@ void PlayerObject::sendUseableDraftSchematics(std::vector & schematicNam if (*iter != 0) { const DraftSchematicObject * const schematic = DraftSchematicObject::getSchematic(*iter); - if (schematic != NULL) + if (schematic != nullptr) { message->addSchematic(schematic->getCombinedCrc(), static_cast(schematic->getCategory())); @@ -1248,37 +1248,37 @@ void PlayerObject::sendUseableDraftSchematics(std::vector & schematicNam */ bool PlayerObject::requestDraftSlots(uint32 draftSchematicCrc, MessageQueueDraftSlots * message, MessageQueueDraftSlotsQueryResponse * queryMessage) { - ManufactureSchematicObject * manfSchematic = NULL; + ManufactureSchematicObject * manfSchematic = nullptr; MessageQueueDraftSlots::Slot slotInfo; MessageQueueDraftSlots::Option optionInfo; - if ((message == NULL && queryMessage == NULL) || - (message != NULL && queryMessage != NULL)) + if ((message == nullptr && queryMessage == nullptr) || + (message != nullptr && queryMessage != nullptr)) { return false; } CreatureObject * const owner = getCreatureObject(); - if (owner == NULL) + if (owner == nullptr) return false; const ConstCharCrcString & schematicName = ObjectTemplateList::lookUp(draftSchematicCrc); UNREF(schematicName); const DraftSchematicObject * const draftSchematic = DraftSchematicObject::getSchematic(draftSchematicCrc); - if (draftSchematic == NULL) + if (draftSchematic == nullptr) { DEBUG_WARNING(true, ("Player %s requested invalid draft schematic %s", owner->getNetworkId().getValueString().c_str(), schematicName.getString())); return false; } - if (message != NULL) + if (message != nullptr) { m_draftSchematic = draftSchematic; TangibleObject * const tool = safe_cast(getCraftingTool().getObject()); NOT_NULL(tool); - if (tool == NULL) + if (tool == nullptr) return false; tool->clearCraftingManufactureSchematic(); @@ -1287,7 +1287,7 @@ bool PlayerObject::requestDraftSlots(uint32 draftSchematicCrc, MessageQueueDraft // make a temporary manufacturing schematic based on the draft scematic manfSchematic = ServerWorld::createNewManufacturingSchematic(CachedNetworkId( *owner), *tool, tool->getCraftingManufactureSchematicSlotId(), false); - if (manfSchematic == NULL) + if (manfSchematic == nullptr) { DEBUG_WARNING(true, ("Error creating manufacturing schematic!")); return false; @@ -1305,7 +1305,7 @@ bool PlayerObject::requestDraftSlots(uint32 draftSchematicCrc, MessageQueueDraft // being made ServerObject * prototype = manfSchematic->manufactureObject(owner->getNetworkId(), *tool, tool->getCraftingPrototypeSlotId(), true); - if (prototype == NULL) + if (prototype == nullptr) { DEBUG_WARNING(true, ("Error creating temp prototype!")); return false; @@ -1322,7 +1322,7 @@ bool PlayerObject::requestDraftSlots(uint32 draftSchematicCrc, MessageQueueDraft getAccountDescription().c_str())); } - if (queryMessage != NULL) + if (queryMessage != nullptr) { queryMessage->setComplexity(static_cast(draftSchematic->getComplexity())); queryMessage->setVolume(draftSchematic->getVolume()); @@ -1343,7 +1343,7 @@ bool PlayerObject::requestDraftSlots(uint32 draftSchematicCrc, MessageQueueDraft if (!slot.optional || slot.optionalSkillCommand.empty() || owner->hasCommand(slot.optionalSkillCommand)) { - if (manfSchematic != NULL) + if (manfSchematic != nullptr) { // create the slot IGNORE_RETURN(manfSchematic->getSlot(slot.name, manfSlot)); @@ -1370,13 +1370,13 @@ bool PlayerObject::requestDraftSlots(uint32 draftSchematicCrc, MessageQueueDraft { // get the default object name from the shared template const ObjectTemplate *const ingredientTemplate = ObjectTemplateList::fetch(simple.ingredient); - if (ingredientTemplate == NULL) + if (ingredientTemplate == nullptr) { DEBUG_WARNING(true, ("draft schematic component ingredient %s not found!", simple.ingredient.c_str())); continue; } const SharedObjectTemplate * const sharedTemplate = safe_cast(ObjectTemplateList::fetch((safe_cast(ingredientTemplate))->getSharedTemplate())); - if (sharedTemplate == NULL) + if (sharedTemplate == nullptr) { DEBUG_WARNING(true, ("draft schematic component ingredient %s shared template not found!", simple.ingredient.c_str())); continue; @@ -1391,19 +1391,19 @@ bool PlayerObject::requestDraftSlots(uint32 draftSchematicCrc, MessageQueueDraft { // get the default object name from the shared template of the crafted object const ObjectTemplate * const ingredientTemplate = ObjectTemplateList::fetch(simple.ingredient); - if (ingredientTemplate == NULL) + if (ingredientTemplate == nullptr) { DEBUG_WARNING(true, ("draft schematic schematic ingredient %s not found!", simple.ingredient.c_str())); continue; } const ServerObjectTemplate * const craftedTemplate = safe_cast(ingredientTemplate)->getCraftedObjectTemplate(); - if (craftedTemplate == NULL) + if (craftedTemplate == nullptr) { DEBUG_WARNING(true, ("draft schematic schematic ingredient %s not found!", simple.ingredient.c_str())); continue; } const SharedObjectTemplate * const sharedTemplate = safe_cast(ObjectTemplateList::fetch((safe_cast(craftedTemplate))->getSharedTemplate())); - if (sharedTemplate == NULL) + if (sharedTemplate == nullptr) { DEBUG_WARNING(true, ("draft schematic component ingredient %s shared template not found!", simple.ingredient.c_str())); continue; @@ -1434,7 +1434,7 @@ bool PlayerObject::requestDraftSlots(uint32 draftSchematicCrc, MessageQueueDraft } // for (int j = 0; j < optionsCount; ++j) if (componentSlot) slotInfo.hardpoint = slot.appearance; - if (message != NULL) + if (message != nullptr) message->addSlot(slotInfo); else queryMessage->addSlot(slotInfo); @@ -1443,7 +1443,7 @@ bool PlayerObject::requestDraftSlots(uint32 draftSchematicCrc, MessageQueueDraft } // for (int i = 0; i < slotCount; ++i) // send the slot info to the player - if (message != NULL) + if (message != nullptr) { (safe_cast(owner->getController()))->appendMessage( static_cast(CM_draftSlotsMessage), 0.0f, message, @@ -1475,7 +1475,7 @@ bool PlayerObject::requestDraftSlots(uint32 draftSchematicCrc, MessageQueueDraft void PlayerObject::selectDraftSchematic(int index) { CreatureObject * const owner = getCreatureObject(); - if (owner == NULL) + if (owner == nullptr) return; const std::string myId = getNetworkId().getValueString(); @@ -1510,7 +1510,7 @@ void PlayerObject::selectDraftSchematic(int index) MessageQueueDraftSlots * message = new MessageQueueDraftSlots( getCraftingTool(), NetworkId::cms_invalid); - if (requestDraftSlots(m_useableDraftSchematics[static_cast(index)], message, NULL)) + if (requestDraftSlots(m_useableDraftSchematics[static_cast(index)], message, nullptr)) { m_craftingStage = static_cast(Crafting::CS_assembly); m_craftingComponentBioLink = NetworkId::cms_invalid; @@ -1540,11 +1540,11 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde UNREF(myIdString); // needed for release mode CreatureObject * const owner = getCreatureObject(); - if (owner == NULL) + if (owner == nullptr) return Crafting::CE_noOwner; // check the draft schematic - if (m_draftSchematic.getPointer() == NULL) + if (m_draftSchematic.getPointer() == nullptr) { WARNING(true, ("Player %s trying to fill slot with no draft schematic!", myIdString)); return Crafting::CE_noDraftSchematic; @@ -1572,9 +1572,9 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde } TangibleObject * const tool = safe_cast(getCraftingTool().getObject()); - if (tool == NULL) + if (tool == nullptr) { - WARNING(true, ("Player %s trying to fill slot with crafting tool %s, but tool is NULL!", myIdString, getCraftingTool().getValueString().c_str())); + WARNING(true, ("Player %s trying to fill slot with crafting tool %s, but tool is nullptr!", myIdString, getCraftingTool().getValueString().c_str())); return Crafting::CE_noCraftingTool; } @@ -1583,7 +1583,7 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde // check the manufacturing schematic ManufactureSchematicObject * const manfSchematic = tool->getCraftingManufactureSchematic(); - if (manfSchematic == NULL) + if (manfSchematic == nullptr) { WARNING(true, ("Player %s trying to fill slot with no manufacturing schematic!", myIdString)); return Crafting::CE_noManfSchematic; @@ -1614,7 +1614,7 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde // get the draft schematic option, convert the passed-in option index to the // unfiltered index int i, j; - const ServerIntangibleObjectTemplate::Ingredient * slotOption = NULL; + const ServerIntangibleObjectTemplate::Ingredient * slotOption = nullptr; const int optionsCount = static_cast(draftSlot.options.size()); for (i = 0, j = 0; i < optionsCount; ++i) { @@ -1637,9 +1637,9 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde } slotOptionIndex = i; - if (slotOption == NULL || slotOption->ingredients.size() != 1) + if (slotOption == nullptr || slotOption->ingredients.size() != 1) { - WARNING(true, ("slotOption is NULL or ingredient %d for draft schematic %s, slot %s, has ingredient count != 1", + WARNING(true, ("slotOption is nullptr or ingredient %d for draft schematic %s, slot %s, has ingredient count != 1", slotOptionIndex, m_draftSchematic->getTemplateName(), draftSlot.name.getText().c_str())); return Crafting::CE_invalidIngredientSize; } @@ -1671,7 +1671,7 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde int numIngredientsToAdd = neededIngredientCount - currentIngredientCount; TangibleObject * const ingredient = dynamic_cast(NetworkIdManager::getObjectById(ingredientId)); - if (ingredient == NULL) + if (ingredient == nullptr) { WARNING(true, ("No object for ingredient id %s", ingredientId.getValueString().c_str())); return Crafting::CE_invalidIngredient; @@ -1698,7 +1698,7 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde if (!owner->isIngredientInInventory(*ingredient)) { // if we are crafting level 3, also check the crafting station's hopper - if (getCraftingLevel() != 3 || (station != NULL && + if (getCraftingLevel() != 3 || (station != nullptr && !station->isIngredientInHopper(ingredientId))) { DEBUG_WARNING(true, ("Player %s chose invalid ingredient %s", myIdString, ingredientId.getValueString().c_str())); @@ -1709,7 +1709,7 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde // see if the ingredient is a resource or component ResourceContainerObject * const crate = dynamic_cast(ingredient); - if (crate != NULL) + if (crate != nullptr) { // get the resource type name and class name ResourceTypeObject const * const resource = crate->getResourceType(); @@ -1731,7 +1731,7 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde else if (slotOption->ingredientType == ServerIntangibleObjectTemplate::IT_resourceClass) { ResourceClassObject const * resourceClass = &(resource->getParentClass()); - while (resourceClass != NULL) + while (resourceClass != nullptr) { const std::string className (resourceClass->getResourceClassName()); if (className == slotIngredient.ingredient) @@ -1805,11 +1805,11 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde FactoryObject * factory = dynamic_cast(ingredient); // if this is an old-style factory, we can't use it directly in crafting - if (factory != NULL && !factory->getLoadContents()) - factory = NULL; + if (factory != nullptr && !factory->getLoadContents()) + factory = nullptr; // make sure the component isn't damaged - if (factory == NULL && ingredient->getDamageTaken() != 0 && + if (factory == nullptr && ingredient->getDamageTaken() != 0 && !ingredient->getObjVars().hasItem(OBJVAR_CRAFTING_COMPONENT_CAN_BE_DAMAGED)) { DEBUG_WARNING(true, ("Tried to use damaged component %s for draft schematic %s, slot %s, option %d", @@ -1853,27 +1853,27 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde // check the ingredient template name for every template in it's // heirarchy - const ObjectTemplate * testTemplate = NULL; + const ObjectTemplate * testTemplate = nullptr; if (slotOption->ingredientType == ServerIntangibleObjectTemplate::IT_template || slotOption->ingredientType == ServerIntangibleObjectTemplate::IT_templateGeneric) { - if (factory == NULL) + if (factory == nullptr) testTemplate = ingredient->getObjectTemplate(); else testTemplate = factory->getContainedObjectTemplate(); } else { - const DraftSchematicObject * itemSchematic = NULL; - if (factory == NULL) + const DraftSchematicObject * itemSchematic = nullptr; + if (factory == nullptr) itemSchematic = DraftSchematicObject::getSchematic(ingredient->getSourceDraftSchematic()); else itemSchematic = DraftSchematicObject::getSchematic(factory->getDraftSchematic()); - if (itemSchematic != NULL) + if (itemSchematic != nullptr) testTemplate = itemSchematic->getObjectTemplate(); } - while (testTemplate != NULL) + while (testTemplate != nullptr) { const std::string ingredientName(testTemplate->getName()); if (ingredientName == requiredIngredientName) @@ -1896,7 +1896,7 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde // this is a configureable setting const Crafting::ComponentIngredient * testComponent = dynamic_cast< const Crafting::ComponentIngredient *>(manfSlot.ingredients.front().get()); - if (testComponent != NULL) + if (testComponent != nullptr) { if (ConfigServerGame::getCraftingComponentStrict() && (slotOption->ingredientType != ServerIntangibleObjectTemplate::IT_templateGeneric && @@ -1909,15 +1909,15 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde else { // component from same template - if (factory == NULL) + if (factory == nullptr) { - if (ingredient->getObjectTemplateName() != NULL && + if (ingredient->getObjectTemplateName() != nullptr && ingredient->getObjectTemplateName() == testComponent->templateName) { slotOk = true; } } - else if (factory->getContainedTemplateName() != NULL && + else if (factory->getContainedTemplateName() != nullptr && factory->getContainedTemplateName() == testComponent->templateName) { slotOk = true; @@ -1927,7 +1927,7 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde } if (slotOk) { - if (factory == NULL || factory->getCount() <= numIngredientsToAdd) + if (factory == nullptr || factory->getCount() <= numIngredientsToAdd) { // adding normal component or a complete factory object if (manfSchematic->addIngredient(*ingredient)) @@ -1938,7 +1938,7 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde manfSchematic->setSlotOption(manfSlot.name, slotOptionIndex); manfSchematic->modifySlotComplexity(manfSlot.name, slotOption->complexity); } - if (factory == NULL) + if (factory == nullptr) { manfSchematic->addSlotComponent(manfSlot.name, *ingredient, slotOption->ingredientType); @@ -2014,7 +2014,7 @@ Crafting::CraftingError PlayerObject::emptySlot(int slotIndex, const NetworkId & UNREF(myIdString); // needed for release mode CreatureObject * const owner = getCreatureObject(); - if (owner == NULL) + if (owner == nullptr) return Crafting::CE_noOwner; if (getCraftingStage() != Crafting::CS_assembly && !m_allowEmptySlot) @@ -2024,7 +2024,7 @@ Crafting::CraftingError PlayerObject::emptySlot(int slotIndex, const NetworkId & } // check the draft schematic - if (m_draftSchematic.getPointer() == NULL) + if (m_draftSchematic.getPointer() == nullptr) { WARNING(true, ("Player %s trying to empty slot with no draft schematic!", myIdString)); return Crafting::CE_noDraftSchematic; @@ -2037,15 +2037,15 @@ Crafting::CraftingError PlayerObject::emptySlot(int slotIndex, const NetworkId & return Crafting::CE_noCraftingTool; } TangibleObject * const tool = safe_cast(getCraftingTool().getObject()); - if (tool == NULL) + if (tool == nullptr) { - WARNING(true, ("Player %s trying to empty slot with crafting tool %s, but tool is NULL!", myIdString, getCraftingTool().getValueString().c_str())); + WARNING(true, ("Player %s trying to empty slot with crafting tool %s, but tool is nullptr!", myIdString, getCraftingTool().getValueString().c_str())); return Crafting::CE_noCraftingTool; } // get the crafting station (if any) TangibleObject * station = dynamic_cast(getCraftingStation().getObject()); - if (station != NULL && getCraftingLevel() == 3 && station->getIngredientHopper() == NULL) + if (station != nullptr && getCraftingLevel() == 3 && station->getIngredientHopper() == nullptr) { WARNING_STRICT_FATAL(true, ("Player %s trying to empty crafting slot near " "a crafting station %s that has no ingredient hopper!", @@ -2055,7 +2055,7 @@ Crafting::CraftingError PlayerObject::emptySlot(int slotIndex, const NetworkId & } ServerObject * const inventory = owner->getInventory(); - if (inventory == NULL) + if (inventory == nullptr) { WARNING (true, ("Player %s has no inventory.", myIdString)); return Crafting::CE_noInventory; @@ -2077,7 +2077,7 @@ Crafting::CraftingError PlayerObject::emptySlot(int slotIndex, const NetworkId & // if we are crafting level 3, also check the crafting station's hopper if (!containerIsWorn && - (getCraftingLevel() != 3 || (station != NULL && + (getCraftingLevel() != 3 || (station != nullptr && !isNestedInContainer (targetContainerId, station->getIngredientHopper()->getNetworkId())))) { WARNING (true, ("Player %s attempted to empty slot into invalid container [%s].", myIdString, targetContainerId.getValueString().c_str())); @@ -2087,7 +2087,7 @@ Crafting::CraftingError PlayerObject::emptySlot(int slotIndex, const NetworkId & targetContainer = safe_cast(NetworkIdManager::getObjectById (targetContainerId)); - if (targetContainer == NULL) + if (targetContainer == nullptr) { WARNING (true, ("Player %s attempted to empty slot into non-existant container [%s].", myIdString, targetContainerId.getValueString ().c_str ())); return Crafting::CE_badTargetContainer; @@ -2102,7 +2102,7 @@ Crafting::CraftingError PlayerObject::emptySlot(int slotIndex, const NetworkId & // check the manufacturing schematic ManufactureSchematicObject * const manfSchematic = tool->getCraftingManufactureSchematic(); - if (manfSchematic == NULL) + if (manfSchematic == nullptr) { WARNING(true, ("Player %s trying to empty slot with no manufacturing schematic!", myIdString)); return Crafting::CE_noManfSchematic; @@ -2154,7 +2154,7 @@ Crafting::CraftingError PlayerObject::emptySlot(int slotIndex, const NetworkId & const Crafting::ComponentIngredient * const componentInfo = dynamic_cast((*iter).get()); NOT_NULL(componentInfo); TangibleObject * const component = manfSchematic->getComponent(*componentInfo); - if (component != NULL) + if (component != nullptr) { // move the component from the schematic to the player if (!manfSchematic->removeIngredient(*component, *targetContainer)) @@ -2180,7 +2180,7 @@ Crafting::CraftingError PlayerObject::emptySlot(int slotIndex, const NetworkId & { // ingredient is a resource VolumeContainer * const targetVolumeContainer = ContainerInterface::getVolumeContainer(*targetContainer); - if (targetVolumeContainer == NULL) + if (targetVolumeContainer == nullptr) { DEBUG_WARNING(true, ("PlayerObject::emptySlot: targetContainer %s does not have a volume container", targetContainer->getNetworkId().getValueString().c_str())); @@ -2203,7 +2203,7 @@ Crafting::CraftingError PlayerObject::emptySlot(int slotIndex, const NetworkId & { ResourceContainerObject * crate = dynamic_cast< ResourceContainerObject *>(NetworkIdManager::getObjectById((*iter2))); - if (crate != NULL && crate->getResourceTypeId() == resourceId) + if (crate != nullptr && crate->getResourceTypeId() == resourceId) { int emptySpace = crate->getMaxQuantity() - crate->getQuantity(); if (emptySpace > 0) @@ -2236,7 +2236,7 @@ Crafting::CraftingError PlayerObject::emptySlot(int slotIndex, const NetworkId & { ServerObject * crateObject = ServerWorld::createNewObject( crateTemplateName, *targetContainer, true); - if (crateObject == NULL) + if (crateObject == nullptr) { // @todo: inform the player DEBUG_WARNING(true, ("PlayerObject::emptySlot tried to " @@ -2322,14 +2322,14 @@ int PlayerObject::startCraftingExperiment () int i; CreatureObject * const owner = getCreatureObject(); - if (owner == NULL) + if (owner == nullptr) return -Crafting::CE_noOwner; std::string myId = getNetworkId().getValueString(); const char * myIdString = myId.c_str(); UNREF(myIdString); // needed for release mode - if (m_draftSchematic.getPointer() == NULL) + if (m_draftSchematic.getPointer() == nullptr) { DEBUG_WARNING(true, ("Player %s tried to start crafting experimentation with invalid schematic.", myIdString)); return -Crafting::CE_noDraftSchematic; @@ -2350,13 +2350,13 @@ int PlayerObject::startCraftingExperiment () if (!tool) { - DEBUG_WARNING(true, ("Player %s tried to start crafting experimentation with null crafting tool [%s].", myIdString, getCraftingTool().getValueString().c_str())); + DEBUG_WARNING(true, ("Player %s tried to start crafting experimentation with nullptr crafting tool [%s].", myIdString, getCraftingTool().getValueString().c_str())); return -Crafting::CE_noCraftingTool; } // check the manufacturing schematic ManufactureSchematicObject * const manfSchematic = tool->getCraftingManufactureSchematic(); - if (manfSchematic == NULL) + if (manfSchematic == nullptr) { DEBUG_WARNING(true, ("Player %s tried to start crafting experimentation with invalid manufacture schematic.", myIdString)); return -Crafting::CE_noManfSchematic; @@ -2425,7 +2425,7 @@ int PlayerObject::startCraftingExperiment () } ServerObject * prototype = tool->getCraftingPrototype(); - if (prototype == NULL) + if (prototype == nullptr) { DEBUG_WARNING(true, ("PlayerObject::startCraftingExperiment crafting " "tool %s has no prototype object!", @@ -2530,7 +2530,7 @@ int PlayerObject::startCraftingExperiment () Crafting::CraftingResult PlayerObject::experiment(const std::vector & experiments, int totalPoints, int corelevel) { CreatureObject * const owner = getCreatureObject(); - if (owner == NULL) + if (owner == nullptr) return Crafting::CR_internalFailure; std::string myId = getNetworkId().getValueString(); @@ -2554,7 +2554,7 @@ Crafting::CraftingResult PlayerObject::experiment(const std::vectorgetCraftingManufactureSchematic(); - if (manfSchematic == NULL) + if (manfSchematic == nullptr) { DEBUG_WARNING(true, ("Player %s tried to experiment with invalid " "manufacture schematic.", myIdString)); @@ -2577,7 +2577,7 @@ Crafting::CraftingResult PlayerObject::experiment(const std::vectorgetCraftingPrototype(); - if (prototype == NULL) + if (prototype == nullptr) { DEBUG_WARNING(true, ("Player %s tried to experiment with invalid test " "prototype.", myIdString)); @@ -2680,7 +2680,7 @@ bool PlayerObject::customize(int property, int value) const return false; } - if (m_draftSchematic.getPointer() == NULL || getCraftingTool() == NetworkId::cms_invalid) + if (m_draftSchematic.getPointer() == nullptr || getCraftingTool() == NetworkId::cms_invalid) { DEBUG_WARNING(true, ("Player %s tried to customize with invalid " "schematic or crafting tool.", myIdString)); @@ -2732,7 +2732,7 @@ int PlayerObject::setCustomizationData(const Unicode::String & name, return Crafting::CE_notCustomizeStage; } - if (m_draftSchematic.getPointer() == NULL) + if (m_draftSchematic.getPointer() == nullptr) { DEBUG_WARNING(true, ("Player %s tried to customize with invalid schematic.", myIdString)); return Crafting::CE_noDraftSchematic; @@ -2804,7 +2804,7 @@ int PlayerObject::setCustomizationData(const Unicode::String & name, bool PlayerObject::createPrototype(bool keepPrototype) { CreatureObject * const owner = getCreatureObject(); - if (owner == NULL) + if (owner == nullptr) return false; std::string myId = getNetworkId().getValueString(); @@ -2821,7 +2821,7 @@ bool PlayerObject::createPrototype(bool keepPrototype) return false; } - if (m_draftSchematic.getPointer() == NULL || getCraftingTool() == NetworkId::cms_invalid) + if (m_draftSchematic.getPointer() == nullptr || getCraftingTool() == NetworkId::cms_invalid) { DEBUG_WARNING(true, ("Player %s tried to create prototype with invalid " "schematic or crafting tool.", myIdString)); @@ -2842,7 +2842,7 @@ bool PlayerObject::createPrototype(bool keepPrototype) } ManufactureSchematicObject * const manfSchematic = tool->getCraftingManufactureSchematic(); - if (manfSchematic == NULL) + if (manfSchematic == nullptr) { WARNING_STRICT_FATAL(true, ("No manf schematic in crafting tool %s", tool->getNetworkId().getValueString().c_str())); @@ -2961,7 +2961,7 @@ bool PlayerObject::createPrototype(bool keepPrototype) params.addParam(prototype->getNetworkId(), "prototype"); ScriptDictionaryPtr dictionary; getScriptObject()->makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); @@ -2969,7 +2969,7 @@ bool PlayerObject::createPrototype(bool keepPrototype) { Client * client = owner->getClient(); - if (client != NULL && client->isGod()) + if (client != nullptr && client->isGod()) { Chat::sendSystemMessage(*owner, Unicode::narrowToWide("Crafting time changed due to god mode and crafting_qa objvar."), Unicode::emptyString); prototypeTime = 1; @@ -3022,7 +3022,7 @@ bool PlayerObject::createManufacturingSchematic() return false; CreatureObject * const owner = getCreatureObject(); - if (owner == NULL) + if (owner == nullptr) return false; // @todo: need to filter the name @@ -3034,7 +3034,7 @@ bool PlayerObject::createManufacturingSchematic() return false; } - if (m_draftSchematic.getPointer() == NULL || getCraftingTool() == NetworkId::cms_invalid) + if (m_draftSchematic.getPointer() == nullptr || getCraftingTool() == NetworkId::cms_invalid) { WARNING(true, ("Player %s tried to create manf schematic with invalid schematic or crafting tool.", getNetworkId().getValueString().c_str ())); return false; @@ -3048,19 +3048,19 @@ bool PlayerObject::createManufacturingSchematic() } TangibleObject * const tool = safe_cast(getCraftingTool().getObject()); - if (tool == NULL) + if (tool == nullptr) { WARNING_STRICT_FATAL(true, ("Could not find crafting tool during create manf schematic phase.")); return false; } ManufactureSchematicObject * const manfSchematic = tool->removeCraftingManufactureSchematic(); - if (manfSchematic == NULL) + if (manfSchematic == nullptr) { WARNING_STRICT_FATAL(true, ("Could not find manf schematic during create manf schematic phase.")); return false; } TangibleObject * const prototype = safe_cast(tool->getCraftingPrototype()); - if (prototype == NULL) + if (prototype == nullptr) { WARNING_STRICT_FATAL(true, ("Could not find prototype during create manf schematic phase.")); return false; @@ -3141,14 +3141,14 @@ bool PlayerObject::createManufacturingSchematic() manfSchematic->persist(); ServerObject * const datapad = owner->getDatapad (); - if (datapad == NULL) + if (datapad == nullptr) { DEBUG_WARNING(true, ("Can't find datapad for player %s", getAccountDescription().c_str())); return false; } Container::ContainerErrorCode tmp = Container::CEC_Success; - if (!ContainerInterface::transferItemToVolumeContainer(*datapad, *manfSchematic, NULL, tmp)) + if (!ContainerInterface::transferItemToVolumeContainer(*datapad, *manfSchematic, nullptr, tmp)) { return false; } @@ -3173,7 +3173,7 @@ bool PlayerObject::createManufacturingSchematic() bool PlayerObject::restartCrafting () { CreatureObject * const owner = getCreatureObject(); - if (owner == NULL) + if (owner == nullptr) return false; std::string myId = getNetworkId().getValueString(); @@ -3195,7 +3195,7 @@ bool PlayerObject::restartCrafting () } // verify the tool - if (m_draftSchematic.getPointer() == NULL || getCraftingTool() == NetworkId::cms_invalid) + if (m_draftSchematic.getPointer() == nullptr || getCraftingTool() == NetworkId::cms_invalid) { DEBUG_WARNING(true, ("Player %s tried to start crafting experimentation " "with invalid schematic or crafting tool.", myIdString)); @@ -3208,7 +3208,7 @@ bool PlayerObject::restartCrafting () // reset the manf schematic ManufactureSchematicObject * manfSchematic = tool->getCraftingManufactureSchematic(); - if (manfSchematic == NULL) + if (manfSchematic == nullptr) { DEBUG_WARNING(true, ("Player %s has no manufacturing schematic!", myIdString)); return false; @@ -3262,21 +3262,21 @@ void PlayerObject::stopCrafting (bool normalExit) { CreatureObject * const owner = getCreatureObject(); - if (getCraftingTool().getObject() != NULL) + if (getCraftingTool().getObject() != nullptr) { TangibleObject * tool = dynamic_cast(getCraftingTool().getObject()); - if (tool != NULL) + if (tool != nullptr) { IGNORE_RETURN(tool->stopCraftingSession()); } // tell scripts that the session has ended ScriptParams params; - if (owner != NULL) + if (owner != nullptr) params.addParam(owner->getNetworkId()); else params.addParam(getNetworkId()); - if (getCurrentDraftSchematic() != NULL) + if (getCurrentDraftSchematic() != nullptr) params.addParam(getCurrentDraftSchematic()->getTemplateName()); else params.addParam(""); @@ -3292,7 +3292,7 @@ void PlayerObject::stopCrafting (bool normalExit) m_craftingComponentBioLink = NetworkId::cms_invalid; // tell the player crafting has ended - if (owner != NULL && owner->getController() != NULL) + if (owner != nullptr && owner->getController() != nullptr) { (safe_cast(owner->getController()))->appendMessage( static_cast(CM_craftingSessionEnded), 0.0f, @@ -3348,7 +3348,7 @@ void PlayerObject::requestFriendList() const { CreatureObject const *owner = safe_cast(ContainerInterface::getContainedByObject(*this)); - if (owner != NULL) + if (owner != nullptr) { ChatAvatarId chatAvatarId(Chat::constructChatAvatarId(*owner)); @@ -3410,7 +3410,7 @@ void PlayerObject::requestIgnoreList() const { CreatureObject const *owner = safe_cast(ContainerInterface::getContainedByObject(*this)); - if (owner != NULL) + if (owner != nullptr) { ChatAvatarId chatAvatarId(Chat::constructChatAvatarId(*owner)); @@ -3767,7 +3767,7 @@ void PlayerObject::setTitle(std::string const &title) m_skillTitle = title; } } - else if (title.empty() || (title == "citizenship") || (SkillManager::getInstance().getSkill(title) != NULL) || (CollectionsDataTable::isASlotTitle(title) != NULL) || (CollectionsDataTable::isACollectionTitle(title) != NULL) || (CollectionsDataTable::isAPageTitle(title) != NULL) || (GuildRankDataTable::isARankTitle(title) != NULL) || (CitizenRankDataTable::isARankTitle(title) != NULL)) + else if (title.empty() || (title == "citizenship") || (SkillManager::getInstance().getSkill(title) != nullptr) || (CollectionsDataTable::isASlotTitle(title) != nullptr) || (CollectionsDataTable::isACollectionTitle(title) != nullptr) || (CollectionsDataTable::isAPageTitle(title) != nullptr) || (GuildRankDataTable::isARankTitle(title) != nullptr) || (CitizenRankDataTable::isARankTitle(title) != nullptr)) { if (title != m_skillTitle.get()) m_skillTitle = title; @@ -4075,7 +4075,7 @@ void PlayerObject::handleCMessageTo(const MessageToPayload &message) } { - BiographyManager::requestBiography(owner->getNetworkId(), NULL); + BiographyManager::requestBiography(owner->getNetworkId(), nullptr); } bool needsTitleCheck = false; @@ -4139,7 +4139,7 @@ void PlayerObject::handleCMessageTo(const MessageToPayload &message) // also check to see if the citizen rank has changed, and if so, update the citizen rank information { std::vector const & cityIds = CityInterface::getCitizenOfCityId(owner->getNetworkId()); - CitizenInfo const * const citizenInfo = (!cityIds.empty() ? CityInterface::getCitizenInfo(cityIds.front(), owner->getNetworkId()) : NULL); + CitizenInfo const * const citizenInfo = (!cityIds.empty() ? CityInterface::getCitizenInfo(cityIds.front(), owner->getNetworkId()) : nullptr); if (!citizenInfo) { // not a citizen, so make sure the citizen rank is empty @@ -4265,12 +4265,12 @@ void PlayerObject::endBaselines() const CreatureObject * owner = safe_cast(ContainerInterface::getContainedByObject(*this)); - if (owner != NULL) + if (owner != nullptr) { SharedCreatureObjectTemplate::Species const species = owner->getSpecies(); setSpokenLanguage(GameLanguageManager::getStartingLanguage(species)); -// if (owner->isAuthoritative() && ServerUniverse::getInstance().getXpManager() != NULL) +// if (owner->isAuthoritative() && ServerUniverse::getInstance().getXpManager() != nullptr) // { // // get any xp we earned while offline // ServerUniverse::getInstance().getXpManager()->requestXp(*this); @@ -4326,7 +4326,7 @@ void PlayerObject::endBaselines() } else { - m_chatSpamTimeEndInterval = static_cast(::time(NULL)) + (ConfigServerGame::getChatSpamLimiterIntervalMinutes() * 60); + m_chatSpamTimeEndInterval = static_cast(::time(nullptr)) + (ConfigServerGame::getChatSpamLimiterIntervalMinutes() * 60); m_chatSpamSpatialNumCharacters = 0; m_chatSpamNonSpatialNumCharacters = 0; m_chatSpamNextTimeToSyncWithChatServer = 0; @@ -4362,7 +4362,7 @@ void PlayerObject::endBaselines() { m_squelchedById = tempNetworkId; m_squelchedByName = tempString; - m_squelchExpireTime = static_cast(::time(NULL)) + (temp - gameTimeNow); + m_squelchExpireTime = static_cast(::time(nullptr)) + (temp - gameTimeNow); } } } @@ -4373,7 +4373,7 @@ void PlayerObject::endBaselines() DynamicVariableList::NestedList const gcwContribution(getObjVars(), "gcwContributionTracking"); if (!gcwContribution.empty()) { - int const timeExpired = static_cast(::time(NULL)) - (60 * 60 * 24 * 30); // 30 days + int const timeExpired = static_cast(::time(nullptr)) - (60 * 60 * 24 * 30); // 30 days std::list gcwContributionToRemove; int timeLastContributed; for (DynamicVariableList::NestedList::const_iterator i = gcwContribution.begin(); i != gcwContribution.end(); ++i) @@ -4724,12 +4724,12 @@ std::string PlayerObject::getAccountDescription() const { const ServerObject * owner = safe_cast( ContainerInterface::getContainedByObject(*this)); - if (owner == NULL) + if (owner == nullptr) return "UNKNOWN"; bool isGod = false; bool isSecure = false; - Client * client = NULL; + Client * client = nullptr; if (owner && owner->getClient()) { client = owner->getClient(); @@ -4768,7 +4768,7 @@ std::string PlayerObject::getAccountDescription() const void PlayerObject::logChat(int const logIndex) { - if (m_chatLog != NULL) + if (m_chatLog != nullptr) { time_t const logTime = Os::getRealSystemTime(); @@ -5276,10 +5276,10 @@ void PlayerObject::checkTheater(const Vector & pos, const std::string & scene, IntangibleObject * theater = IntangibleObject::spawnTheater(m_theaterDatatable.get(), m_theaterPosition.get(), m_theaterScript.get(), static_cast(m_theaterLocationType.get())); - if (theater != NULL) + if (theater != nullptr) { const CreatureObject * owner = getCreatureObject(); - if (owner != NULL) + if (owner != nullptr) theater->setPlayer(*owner); theater->setTheaterCreator(m_theaterCreator.get()); if (!theater->setTheaterName(m_theaterName.get())) @@ -5287,10 +5287,10 @@ void PlayerObject::checkTheater(const Vector & pos, const std::string & scene, WARNING(true, ("PlayerObject::checkTheater could not create " "theater with name %s", m_theaterName.get().c_str())); theater->permanentlyDestroy(DeleteReasons::SetupFailed); - theater = NULL; + theater = nullptr; } } - if (theater == NULL) + if (theater == nullptr) { CreatureObject * creatureObject = getCreatureObject(); if (creatureObject) @@ -5357,7 +5357,7 @@ bool PlayerObject::setTheater(const std::string & datatable, const Vector & posi return false; } - if (ServerUniverse::getInstance().getPlanetByName(scene) == NULL) + if (ServerUniverse::getInstance().getPlanetByName(scene) == nullptr) { WARNING(true, ("PlayerObject::setTheater called with invalid scene %s", scene.c_str())); @@ -6342,7 +6342,7 @@ unsigned long PlayerObject::getSessionPlayTimeDuration() const time_t const sessionStartPlayTime = static_cast(m_sessionStartPlayTime.get()); if (sessionStartPlayTime > 0) { - time_t const now = ::time(NULL); + time_t const now = ::time(nullptr); if (now > sessionStartPlayTime) return static_cast(now - sessionStartPlayTime); } @@ -6359,7 +6359,7 @@ unsigned long PlayerObject::getSessionActivePlayTimeDuration() const time_t const sessionLastActiveTime = static_cast(m_sessionLastActiveTime.get()); if (sessionLastActiveTime > 0) { - time_t const now = ::time(NULL); + time_t const now = ::time(nullptr); if (now > sessionLastActiveTime) activePlayTimeDuration += static_cast(now - sessionLastActiveTime); } @@ -6393,7 +6393,7 @@ void PlayerObject::setSessionPlayTimeInfo(int32 sessionStartPlayTime, int32 sess ServerUniverse::setConnectedCharacterLfgData(owner->getNetworkId(), lfgCharacterData); - BiographyManager::requestBiography(owner->getNetworkId(), NULL); + BiographyManager::requestBiography(owner->getNetworkId(), nullptr); // check/set "account age" title checkAndSetAccountAgeTitle(*this); @@ -7040,7 +7040,7 @@ void PlayerObject::modifyNextGcwRatingCalcTime(int const weekCount) return; static int32 const max = std::numeric_limits::max(); - int32 const now = static_cast(::time(NULL)); + int32 const now = static_cast(::time(nullptr)); // m_nextGcwRatingCalcTime should always be >= 0 int32 const currentValue = std::max(static_cast(0), m_nextGcwRatingCalcTime.get()); @@ -7176,7 +7176,7 @@ void PlayerObject::setNextGcwRatingCalcTime(bool const alwaysSendMessageToForRec return; bool needToSendMessageTo = alwaysSendMessageToForRecalc; - int32 const now = static_cast(::time(NULL)); + int32 const now = static_cast(::time(nullptr)); // if the player needs a rating recalculation, // make sure that m_nextGcwRatingCalcTime is set so that the @@ -7232,7 +7232,7 @@ void PlayerObject::handleRecalculateGcwRating() return; // is it time to recalculate? - int32 const now = static_cast(::time(NULL)); + int32 const now = static_cast(::time(nullptr)); if ((m_nextGcwRatingCalcTime.get() > 0) && (m_nextGcwRatingCalcTime.get() <= now)) { // is recalculation required? @@ -7367,7 +7367,7 @@ void PlayerObject::sendRecalculateGcwRatingMessageTo(int delay) // send new messageTo int const adjustedDelay = std::max(5, delay); MessageToQueue::getInstance().sendMessageToC(getNetworkId(), "C++RecalculateGcwRating", "", adjustedDelay, false); - m_gcwRatingActualCalcTime = static_cast(::time(NULL) + adjustedDelay); + m_gcwRatingActualCalcTime = static_cast(::time(nullptr) + adjustedDelay); } // ---------------------------------------------------------------------- @@ -7728,7 +7728,7 @@ bool PlayerObject::getCollectionSlotValue(CollectionsDataTable::CollectionInfoSl // ---------------------------------------------------------------------- -bool PlayerObject::hasCompletedCollectionSlotPrereq(std::string const & slotName, std::vector * collectionInfo /*= NULL*/) const +bool PlayerObject::hasCompletedCollectionSlotPrereq(std::string const & slotName, std::vector * collectionInfo /*= nullptr*/) const { CollectionsDataTable::CollectionInfoSlot const * slotInfo = CollectionsDataTable::getSlotByName(slotName); if (!slotInfo) @@ -7742,7 +7742,7 @@ bool PlayerObject::hasCompletedCollectionSlotPrereq(std::string const & slotName // ---------------------------------------------------------------------- -bool PlayerObject::hasCompletedCollectionSlotPrereq(CollectionsDataTable::CollectionInfoSlot const & slotInfo, std::vector * collectionInfo /*= NULL*/) const +bool PlayerObject::hasCompletedCollectionSlotPrereq(CollectionsDataTable::CollectionInfoSlot const & slotInfo, std::vector * collectionInfo /*= nullptr*/) const { if (collectionInfo) collectionInfo->clear(); @@ -7862,7 +7862,7 @@ bool PlayerObject::hasCompletedCollectionBook(std::string const & bookName) cons // ---------------------------------------------------------------------- -int PlayerObject::getCompletedCollectionSlotCountInCollection(std::string const & collectionName, stdvector::fwd * collectionInfo /*= NULL*/) const +int PlayerObject::getCompletedCollectionSlotCountInCollection(std::string const & collectionName, stdvector::fwd * collectionInfo /*= nullptr*/) const { if (collectionInfo) collectionInfo->clear(); @@ -7885,7 +7885,7 @@ int PlayerObject::getCompletedCollectionSlotCountInCollection(std::string const // ---------------------------------------------------------------------- -int PlayerObject::getCompletedCollectionSlotCountInPage(std::string const & pageName, std::vector * collectionInfo /*= NULL*/) const +int PlayerObject::getCompletedCollectionSlotCountInPage(std::string const & pageName, std::vector * collectionInfo /*= nullptr*/) const { if (collectionInfo) collectionInfo->clear(); @@ -7908,7 +7908,7 @@ int PlayerObject::getCompletedCollectionSlotCountInPage(std::string const & page // ---------------------------------------------------------------------- -int PlayerObject::getCompletedCollectionCountInPage(std::string const & pageName, std::vector * collectionInfo /*= NULL*/) const +int PlayerObject::getCompletedCollectionCountInPage(std::string const & pageName, std::vector * collectionInfo /*= nullptr*/) const { if (collectionInfo) collectionInfo->clear(); @@ -7931,7 +7931,7 @@ int PlayerObject::getCompletedCollectionCountInPage(std::string const & pageName // ---------------------------------------------------------------------- -int PlayerObject::getCompletedCollectionSlotCountInBook(std::string const & bookName, std::vector * collectionInfo /*= NULL*/) const +int PlayerObject::getCompletedCollectionSlotCountInBook(std::string const & bookName, std::vector * collectionInfo /*= nullptr*/) const { if (collectionInfo) collectionInfo->clear(); @@ -7954,7 +7954,7 @@ int PlayerObject::getCompletedCollectionSlotCountInBook(std::string const & book // ---------------------------------------------------------------------- -int PlayerObject::getCompletedCollectionCountInBook(std::string const & bookName, std::vector * collectionInfo /*= NULL*/) const +int PlayerObject::getCompletedCollectionCountInBook(std::string const & bookName, std::vector * collectionInfo /*= nullptr*/) const { if (collectionInfo) collectionInfo->clear(); @@ -7977,7 +7977,7 @@ int PlayerObject::getCompletedCollectionCountInBook(std::string const & bookName // ---------------------------------------------------------------------- -int PlayerObject::getCompletedCollectionPageCountInBook(std::string const & bookName, std::vector * collectionInfo /*= NULL*/) const +int PlayerObject::getCompletedCollectionPageCountInBook(std::string const & bookName, std::vector * collectionInfo /*= nullptr*/) const { if (collectionInfo) collectionInfo->clear(); @@ -8000,7 +8000,7 @@ int PlayerObject::getCompletedCollectionPageCountInBook(std::string const & book // ---------------------------------------------------------------------- -int PlayerObject::getCompletedCollectionBookCount(std::vector * collectionInfo /*= NULL*/) const +int PlayerObject::getCompletedCollectionBookCount(std::vector * collectionInfo /*= nullptr*/) const { if (collectionInfo) collectionInfo->clear(); @@ -8103,7 +8103,7 @@ void PlayerObject::updateChatSpamSpatialNumCharacters(NetworkId const & characte if (!isAuthoritative()) return; - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); bool syncChatServer = false; // new interval, reset @@ -8125,7 +8125,7 @@ void PlayerObject::updateChatSpamSpatialNumCharacters(NetworkId const & characte { time_t timeUnsquelch = static_cast(getSecondsUntilUnsquelched()); if (timeUnsquelch > 0) - timeUnsquelch += ::time(NULL); + timeUnsquelch += ::time(nullptr); GenericValueTypeMessage, int>, std::pair > > chatStatistics("ChatStatisticsGS", std::make_pair(std::make_pair(std::make_pair(character, static_cast(timeUnsquelch)), m_chatSpamTimeEndInterval.get()), std::make_pair(m_chatSpamSpatialNumCharacters.get(), m_chatSpamNonSpatialNumCharacters.get()))); Chat::sendToChatServer(chatStatistics); @@ -8140,7 +8140,7 @@ void PlayerObject::handleChatStatisticsFromChatServer(NetworkId const & characte if (!isAuthoritative()) return; - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); bool syncChatServer = false; // new interval, reset @@ -8168,7 +8168,7 @@ void PlayerObject::handleChatStatisticsFromChatServer(NetworkId const & characte { time_t timeUnsquelch = static_cast(getSecondsUntilUnsquelched()); if (timeUnsquelch > 0) - timeUnsquelch += ::time(NULL); + timeUnsquelch += ::time(nullptr); GenericValueTypeMessage, int>, std::pair > > chatStatistics("ChatStatisticsGS", std::make_pair(std::make_pair(std::make_pair(character, static_cast(timeUnsquelch)), m_chatSpamTimeEndInterval.get()), std::make_pair(m_chatSpamSpatialNumCharacters.get(), m_chatSpamNonSpatialNumCharacters.get()))); Chat::sendToChatServer(chatStatistics); @@ -8274,7 +8274,7 @@ void PlayerObject::updateGcwDefenderRegionInfo() cityGcwDefenderRegion = gcwDefenderRegion; int const timeJoinedGcwDefenderRegion = cityInfo.getTimeJoinedGcwDefenderRegion(); - timeQualifyForBonus = static_cast(::time(NULL)) - (ConfigServerGame::getGcwDaysRequiredForGcwRegionDefenderBonus() * 86400); + timeQualifyForBonus = static_cast(::time(nullptr)) - (ConfigServerGame::getGcwDaysRequiredForGcwRegionDefenderBonus() * 86400); if (!PvpData::isNeutralFactionId(cityFaction) && (cityFaction == owner->getPvpFaction()) && (timeJoinedGcwDefenderRegion < timeQualifyForBonus)) { cityGcwDefenderRegionHasBonus = true; @@ -8316,7 +8316,7 @@ void PlayerObject::updateGcwDefenderRegionInfo() int const timeJoinedGcwDefenderRegion = GuildInterface::getTimeJoinedGuildCurrentGcwDefenderRegion(*gi); if (timeQualifyForBonus < 0) - timeQualifyForBonus = static_cast(::time(NULL)) - (ConfigServerGame::getGcwDaysRequiredForGcwRegionDefenderBonus() * 86400); + timeQualifyForBonus = static_cast(::time(nullptr)) - (ConfigServerGame::getGcwDaysRequiredForGcwRegionDefenderBonus() * 86400); if (!PvpData::isNeutralFactionId(guildFaction) && (guildFaction == owner->getPvpFaction()) && (timeJoinedGcwDefenderRegion < timeQualifyForBonus)) { @@ -8417,7 +8417,7 @@ void PlayerObject::squelch(NetworkId const & squelchedById, std::string const & } else { - m_squelchExpireTime = static_cast(::time(NULL)) + squelchDurationSeconds; + m_squelchExpireTime = static_cast(::time(nullptr)) + squelchDurationSeconds; // persist squelch info setObjVarItem(OBJVAR_SQUELCH_EXPIRE, static_cast(ServerClock::getInstance().getGameTimeSeconds()) + squelchDurationSeconds); @@ -8466,7 +8466,7 @@ void PlayerObject::unsquelch() { CreatureObject * const owner = getCreatureObject(); if (owner) - owner->sendControllerMessageToAuthServer(CM_unsquelch, NULL); + owner->sendControllerMessageToAuthServer(CM_unsquelch, nullptr); } } @@ -8482,7 +8482,7 @@ int PlayerObject::getSecondsUntilUnsquelched() if (m_squelchExpireTime.get() < 0) // squelched indefinitely return -1; - int32 const timeNow = static_cast(::time(NULL)); + int32 const timeNow = static_cast(::time(nullptr)); if (timeNow < m_squelchExpireTime.get()) // still in squelch period return (m_squelchExpireTime.get() - timeNow); @@ -8570,7 +8570,7 @@ void PlayerObject::setAccountNumLotsOverLimitSpam() { m_accountNumLotsOverLimitSpam = m_accountNumLots.get() - owner->getMaxNumberOfLots(); - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); int violationTime = 0; if (!owner->getObjVars().getItem("lotOverlimit.violation_time", violationTime)) { @@ -9010,7 +9010,7 @@ void PlayerObjectNamespace::grantGcwFactionalPresenceScore(std::string const & g // // for space, give bonus if the player's citizenship city is on the // corresponding ground planet and is the same faction as the player - CityInfo const * ci = NULL; + CityInfo const * ci = nullptr; if (!ServerWorld::isSpaceScene()) { Vector const creaturePosition = co.findPosition_w(); @@ -9132,7 +9132,7 @@ void PlayerObjectNamespace::grantGcwFactionalPresenceScore(std::string const & g playerCitySpaceZone = std::string("space_") + playerCityPlanet; if (playerCitySpaceZone != ServerWorld::getSceneId()) - ci = NULL; + ci = nullptr; } } @@ -9155,7 +9155,7 @@ void PlayerObjectNamespace::grantGcwFactionalPresenceScore(std::string const & g bonus += (cityRank * ConfigServerGame::getGcwFactionalPresenceAlignedCityRankBonusPct()); if (ci->getCreationTime() > 0) - bonus += std::max(0, (static_cast(::time(NULL)) - std::max(1041408000, ci->getCreationTime())) / 31536000 * ConfigServerGame::getGcwFactionalPresenceAlignedCityAgeBonusPct()); + bonus += std::max(0, (static_cast(::time(nullptr)) - std::max(1041408000, ci->getCreationTime())) / 31536000 * ConfigServerGame::getGcwFactionalPresenceAlignedCityAgeBonusPct()); } } diff --git a/engine/server/library/serverGame/src/shared/object/PlayerObject.h b/engine/server/library/serverGame/src/shared/object/PlayerObject.h index 2298e6bd..da5386d8 100755 --- a/engine/server/library/serverGame/src/shared/object/PlayerObject.h +++ b/engine/server/library/serverGame/src/shared/object/PlayerObject.h @@ -361,8 +361,8 @@ public: bool getCollectionSlotValue(std::string const & slotName, unsigned long & value) const; bool getCollectionSlotValue(CollectionsDataTable::CollectionInfoSlot const & slotInfo, unsigned long & value) const; - bool hasCompletedCollectionSlotPrereq(std::string const & slotName, stdvector::fwd * collectionInfo = NULL) const; - bool hasCompletedCollectionSlotPrereq(CollectionsDataTable::CollectionInfoSlot const & slotInfo, stdvector::fwd * collectionInfo = NULL) const; + bool hasCompletedCollectionSlotPrereq(std::string const & slotName, stdvector::fwd * collectionInfo = nullptr) const; + bool hasCompletedCollectionSlotPrereq(CollectionsDataTable::CollectionInfoSlot const & slotInfo, stdvector::fwd * collectionInfo = nullptr) const; bool hasCompletedCollectionSlot(std::string const & slotName) const; bool hasCompletedCollectionSlot(CollectionsDataTable::CollectionInfoSlot const & slotInfo) const; @@ -374,15 +374,15 @@ public: bool hasCompletedCollectionBook(std::string const & bookName) const; - int getCompletedCollectionSlotCountInCollection(std::string const & collectionName, stdvector::fwd * collectionInfo = NULL) const; + int getCompletedCollectionSlotCountInCollection(std::string const & collectionName, stdvector::fwd * collectionInfo = nullptr) const; - int getCompletedCollectionSlotCountInPage(std::string const & pageName, stdvector::fwd * collectionInfo = NULL) const; - int getCompletedCollectionCountInPage(std::string const & pageName, stdvector::fwd * collectionInfo = NULL) const; + int getCompletedCollectionSlotCountInPage(std::string const & pageName, stdvector::fwd * collectionInfo = nullptr) const; + int getCompletedCollectionCountInPage(std::string const & pageName, stdvector::fwd * collectionInfo = nullptr) const; - int getCompletedCollectionSlotCountInBook(std::string const & bookName, stdvector::fwd * collectionInfo = NULL) const; - int getCompletedCollectionCountInBook(std::string const & bookName, stdvector::fwd * collectionInfo = NULL) const; - int getCompletedCollectionPageCountInBook(std::string const & bookName, stdvector::fwd * collectionInfo = NULL) const; - int getCompletedCollectionBookCount(stdvector::fwd * collectionInfo = NULL) const; + int getCompletedCollectionSlotCountInBook(std::string const & bookName, stdvector::fwd * collectionInfo = nullptr) const; + int getCompletedCollectionCountInBook(std::string const & bookName, stdvector::fwd * collectionInfo = nullptr) const; + int getCompletedCollectionPageCountInBook(std::string const & bookName, stdvector::fwd * collectionInfo = nullptr) const; + int getCompletedCollectionBookCount(stdvector::fwd * collectionInfo = nullptr) const; void migrateLegacyBadgesToCollection(stdvector::fwd const & badges); diff --git a/engine/server/library/serverGame/src/shared/object/PlayerQuestObject.cpp b/engine/server/library/serverGame/src/shared/object/PlayerQuestObject.cpp index 54e63df9..dca33824 100755 --- a/engine/server/library/serverGame/src/shared/object/PlayerQuestObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/PlayerQuestObject.cpp @@ -27,7 +27,7 @@ //----------------------------------------------------------------------- -const SharedObjectTemplate * PlayerQuestObject::m_defaultSharedTemplate = NULL; +const SharedObjectTemplate * PlayerQuestObject::m_defaultSharedTemplate = nullptr; namespace PlayerQuestObjectNamespace { @@ -156,7 +156,7 @@ void PlayerQuestObject::removeDefaultTemplate() if(m_defaultSharedTemplate) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } diff --git a/engine/server/library/serverGame/src/shared/object/ResourceContainerObject.cpp b/engine/server/library/serverGame/src/shared/object/ResourceContainerObject.cpp index 9b47248b..398adf07 100755 --- a/engine/server/library/serverGame/src/shared/object/ResourceContainerObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/ResourceContainerObject.cpp @@ -27,7 +27,7 @@ // ====================================================================== -const SharedObjectTemplate * ResourceContainerObject::m_defaultSharedTemplate = NULL; +const SharedObjectTemplate * ResourceContainerObject::m_defaultSharedTemplate = nullptr; namespace ResourceContainerObjectNamespace { @@ -66,11 +66,11 @@ const SharedObjectTemplate * ResourceContainerObject::getDefaultSharedTemplate(v { static const ConstCharCrcLowerString templateName("object/resource_container/base/shared_resource_container_default.iff"); - if (m_defaultSharedTemplate == NULL) + if (m_defaultSharedTemplate == nullptr) { m_defaultSharedTemplate = safe_cast(ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != NULL) + WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create default shared object template %s", templateName.getString())); + if (m_defaultSharedTemplate != nullptr) ExitChain::add (removeDefaultTemplate, "ResourceContainerObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -83,10 +83,10 @@ const SharedObjectTemplate * ResourceContainerObject::getDefaultSharedTemplate(v */ void ResourceContainerObject::removeDefaultTemplate(void) { - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } // ResourceContainerObject::removeDefaultTemplate @@ -398,7 +398,7 @@ bool ResourceContainerObject::transferTo(ResourceContainerObject &destination, i * @param destContainer The container into which the new ResourceContainer should be placed, or cms_Invalid if no container * @param arrangementId -1 If destContainer is not slotted, otherwise the ID of the arrangement to use * @param newLocation The coordinates at which to place the new ResourceContainer. (Ignored if it is going into a non-positional container.) - * @param actor The player making the split, or NULL + * @param actor The player making the split, or nullptr */ bool ResourceContainerObject::splitContainer(int amount, const CachedNetworkId &destContainer, int arrangementId, const Vector &newLocation, ServerObject *actor) @@ -407,7 +407,7 @@ bool ResourceContainerObject::splitContainer(int amount, const CachedNetworkId & bool result = false; - ResourceContainerObject *newCrate = NULL; + ResourceContainerObject *newCrate = nullptr; if (destContainer == CachedNetworkId::cms_cachedInvalid) { @@ -420,7 +420,7 @@ bool ResourceContainerObject::splitContainer(int amount, const CachedNetworkId & { // create in volume container ServerObject * destObject = safe_cast(destContainer.getObject()); - if (destObject == NULL) + if (destObject == nullptr) return false; newCrate = dynamic_cast(ServerWorld::createNewObject(getObjectTemplateName(), *destObject, isPersisted())); } @@ -428,10 +428,10 @@ bool ResourceContainerObject::splitContainer(int amount, const CachedNetworkId & { // create in slotted container ServerObject * destObject = safe_cast(destContainer.getObject()); - if (destObject == NULL) + if (destObject == nullptr) return false; const SlottedContainmentProperty* containmentProperty = ContainerInterface::getSlottedContainmentProperty(*destObject); - if (containmentProperty == NULL) + if (containmentProperty == nullptr) return false; const SlottedContainmentProperty::SlotArrangement & slots = containmentProperty->getSlotArrangement(arrangementId); if (slots.empty()) diff --git a/engine/server/library/serverGame/src/shared/object/ResourcePoolObject.cpp b/engine/server/library/serverGame/src/shared/object/ResourcePoolObject.cpp index c5efc41b..82e2a710 100755 --- a/engine/server/library/serverGame/src/shared/object/ResourcePoolObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/ResourcePoolObject.cpp @@ -30,7 +30,7 @@ ResourcePoolObject::ResourcePoolObject(ResourceTypeObject const & resourceType, m_fractalData(resourceType.getFractalData()), m_fractalSeed(fractalSeed), m_depletedTimestamp(resourceType.getDepletedTimestamp()), - m_efficiencyMap(NULL) + m_efficiencyMap(nullptr) { } @@ -39,7 +39,7 @@ ResourcePoolObject::ResourcePoolObject(ResourceTypeObject const & resourceType, ResourcePoolObject::~ResourcePoolObject() { delete m_efficiencyMap; - m_efficiencyMap=NULL; + m_efficiencyMap=nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/object/ResourceTypeObject.cpp b/engine/server/library/serverGame/src/shared/object/ResourceTypeObject.cpp index 536c4e4f..d0b9123a 100755 --- a/engine/server/library/serverGame/src/shared/object/ResourceTypeObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/ResourceTypeObject.cpp @@ -146,7 +146,7 @@ void ResourceTypeObject::setName(const std::string &newName) ResourcePoolObject *ResourceTypeObject::getPoolForPlanet(PlanetObject const &planetObject) const { if (isRecycled()) - return NULL; + return nullptr; std::map::const_iterator i=m_pools.find(planetObject.getNetworkId()); if (i==m_pools.end()) @@ -167,7 +167,7 @@ ResourcePoolObject *ResourceTypeObject::getPoolForPlanet(PlanetObject const &pla m_pools[planetObject.getNetworkId()]=obj; return obj; } - return NULL; // no pool for this planet + return nullptr; // no pool for this planet } } else @@ -377,7 +377,7 @@ ResourceTypeObject const * ResourceTypeObject::getRecycledVersion() const return result; } else - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -437,7 +437,7 @@ NetworkId ResourceTypeObject::addImportedResourceType(std::string const & resour static Unicode::String const attributeDelimiters(Unicode::narrowToWide(" ")); Unicode::UnicodeStringVector tokens; static size_t const resourceAttributeIndex = 5; - if ((Unicode::tokenize(Unicode::narrowToWide(resourceData), tokens, &delimiters, NULL)) && (tokens.size() > resourceAttributeIndex)) + if ((Unicode::tokenize(Unicode::narrowToWide(resourceData), tokens, &delimiters, nullptr)) && (tokens.size() > resourceAttributeIndex)) { AddResourceTypeMessageNamespace::ResourceTypeData rtd; rtd.m_depletedTimestamp = 1; @@ -453,7 +453,7 @@ NetworkId ResourceTypeObject::addImportedResourceType(std::string const & resour for (size_t i = resourceAttributeIndex; i < tokens.size(); ++i) { attributeTokens.clear(); - if ((Unicode::tokenize(tokens[i], attributeTokens, &attributeDelimiters, NULL)) && (attributeTokens.size() == 2)) + if ((Unicode::tokenize(tokens[i], attributeTokens, &attributeDelimiters, nullptr)) && (attributeTokens.size() == 2)) { rtd.m_attributes.push_back(std::make_pair(Unicode::wideToNarrow(attributeTokens[0]), ::atoi(Unicode::wideToNarrow(attributeTokens[1]).c_str()))); } diff --git a/engine/server/library/serverGame/src/shared/object/ServerObject.cpp b/engine/server/library/serverGame/src/shared/object/ServerObject.cpp index d2598408..e96fc5b1 100755 --- a/engine/server/library/serverGame/src/shared/object/ServerObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/ServerObject.cpp @@ -507,7 +507,7 @@ using namespace ServerObjectNamespace; // ====================================================================== -const SharedObjectTemplate * ServerObject::m_defaultSharedTemplate = NULL; +const SharedObjectTemplate * ServerObject::m_defaultSharedTemplate = nullptr; float ServerObject::ms_buildingUpdateRadiusMultiplier = 0; // ====================================================================== @@ -691,7 +691,7 @@ void ServerObject::ObserversCountCallback::modified(ServerObject &target, int ol ServerObject::ServerObject(const ServerObjectTemplate* newTemplate, const ObjectNotification ¬ification, bool const hyperspaceOnCreate) : Object (newTemplate, NetworkId::cms_invalid), m_oldPosition (), -m_sharedTemplate (NULL), +m_sharedTemplate (nullptr), m_client (0), m_observers (), m_localFlags (0), @@ -732,7 +732,7 @@ m_serverPackage (), m_serverPackage_np (), m_sharedPackage (), m_sharedPackage_np (), -m_networkUpdateFar (NULL), +m_networkUpdateFar (nullptr), m_triggerVolumes (), m_attributesAttained (), m_attributesInterested (), @@ -765,13 +765,13 @@ m_loadCTSPackedHouses(false) const std::string & sharedTemplateName = newTemplate->getSharedTemplate(); m_sharedTemplate = dynamic_cast(ObjectTemplateList::fetch(sharedTemplateName)); - if (m_sharedTemplate == NULL) + if (m_sharedTemplate == nullptr) { WARNING_STRICT_FATAL(!sharedTemplateName.empty(), ("Template %s has an invalid shared template %s. We will use the default shared template for now.", newTemplate->getName(), sharedTemplateName.c_str())); } - if (getSharedTemplate() != NULL) + if (getSharedTemplate() != nullptr) { m_nameStringId = getSharedTemplate()->getObjectName(); m_descriptionStringId = getSharedTemplate()->getDetailedDescription(); @@ -779,7 +779,7 @@ m_loadCTSPackedHouses(false) m_scriptObject->setOwner(this); - ContainedByProperty *containedBy = new ContainedByProperty(*this, NULL); + ContainedByProperty *containedBy = new ContainedByProperty(*this, nullptr); addProperty(*containedBy); //-- create the SlottedContainment property @@ -787,7 +787,7 @@ m_loadCTSPackedHouses(false) addProperty(*slottedProperty); //-- get ArrangementDescriptor if specified - if (getSharedTemplate() != NULL) + if (getSharedTemplate() != nullptr) { const ArrangementDescriptor *const arrangementDescriptor = getSharedTemplate()->getArrangementDescriptor(); if (arrangementDescriptor) @@ -801,7 +801,7 @@ m_loadCTSPackedHouses(false) } //set up containers on this object if it has any - if (getSharedTemplate() != NULL) + if (getSharedTemplate() != nullptr) { SharedObjectTemplate::ContainerType const containerType = getSharedTemplate()->getContainerType(); @@ -883,7 +883,7 @@ m_loadCTSPackedHouses(false) // add the portal property if one is requested - if (getSharedTemplate() != NULL) + if (getSharedTemplate() != nullptr) { const std::string &portalLayoutFileName = getSharedTemplate()->getPortalLayoutFilename(); if (!portalLayoutFileName.empty()) @@ -952,10 +952,10 @@ ServerObject::~ServerObject() destroyTriggerVolumes(); } - if (m_sharedTemplate != NULL) + if (m_sharedTemplate != nullptr) { m_sharedTemplate->releaseReference(); - m_sharedTemplate = NULL; + m_sharedTemplate = nullptr; } if (getClient()) @@ -982,7 +982,7 @@ ServerObject::~ServerObject() PROFILER_AUTO_BLOCK_DEFINE("ServerObject::~ServerObject delete script object"); delete m_scriptObject; } - m_scriptObject = NULL; + m_scriptObject = nullptr; gs_objectCount--; @@ -1038,14 +1038,14 @@ ServerObject * ServerObject::getServerObject(NetworkId const & networkId) ServerObject * ServerObject::asServerObject(Object * const object) { - return (object != NULL) ? object->asServerObject() : NULL; + return (object != nullptr) ? object->asServerObject() : nullptr; } //----------------------------------------------------------------------- ServerObject const * ServerObject::asServerObject(Object const * const object) { - return (object != NULL) ? object->asServerObject() : NULL; + return (object != nullptr) ? object->asServerObject() : nullptr; } //----------------------------------------------------------------------- @@ -1255,12 +1255,12 @@ const SharedObjectTemplate * ServerObject::getDefaultSharedTemplate(void) const { static const ConstCharCrcLowerString templateName("object/object/base/shared_object_default.iff"); - if (m_defaultSharedTemplate == NULL) + if (m_defaultSharedTemplate == nullptr) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != NULL) + WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create default shared object template %s", templateName.getString())); + if (m_defaultSharedTemplate != nullptr) ExitChain::add (removeDefaultTemplate, "ServerObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -1280,10 +1280,10 @@ const unsigned long ServerObject::getObjectCount() */ void ServerObject::removeDefaultTemplate(void) { - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } // ServerObject::removeDefaultTemplate @@ -1570,7 +1570,7 @@ bool ServerObject::isInBazaarOrVendor() const { bool inBazaarOrVendor = false; const ServerObject *parent = safe_cast(ContainerInterface::getFirstParentInWorld(*this)); - const ServerObject *grandParent = NULL; + const ServerObject *grandParent = nullptr; if( parent ) { grandParent = safe_cast(ContainerInterface::getFirstParentInWorld(*parent)); @@ -1821,7 +1821,7 @@ void ServerObject::addTriggerVolume(TriggerVolume * t) { if (!t) { - WARNING_STRICT_FATAL(true, ("Cannot add null volume")); + WARNING_STRICT_FATAL(true, ("Cannot add nullptr volume")); return; } m_triggerVolumes.insert(std::make_pair(t->getName(), t)); @@ -1917,7 +1917,7 @@ void ServerObject::serverObjectEndBaselines(bool fromDatabase) onLoadedFromDatabase(); updateWorldSphere(); - if (getScriptObject() != NULL) + if (getScriptObject() != nullptr) { endBaselinesInitializeScript(*this, true); // If the object was created authoritative, trigger if needed @@ -2059,7 +2059,7 @@ void ServerObject::endBaselines() // and that buildout id got changed to some other object, like a rock if (isPlayerControlled() && isAuthoritative() && (immediateContainer->getNetworkId().getValue() < static_cast(0))) { - if (immediateContainer->asCellObject() != NULL || ContainerInterface::getCell(*immediateContainer) != NULL) + if (immediateContainer->asCellObject() != nullptr || ContainerInterface::getCell(*immediateContainer) != nullptr) ObserveTracker::onObjectContainerChanged(*this); else { @@ -2149,7 +2149,7 @@ bool ServerObject::handlePlayerInInteriorSetup(ContainedByProperty *containedBy) containedBy->setContainedBy(NetworkId::cms_invalid); fixOk = portal->fixupObject(*this, saveTransform); - containerHandleUpdateProxies(NULL, safe_cast(ContainerInterface::getContainedByObject(*this))); + containerHandleUpdateProxies(nullptr, safe_cast(ContainerInterface::getContainedByObject(*this))); if (building) building->gainedPlayer(*this); @@ -2306,8 +2306,8 @@ const int ServerObject::getCacheVersion() const const char * ServerObject::getSharedTemplateName() const { - if (getSharedTemplate() == NULL) - return NULL; + if (getSharedTemplate() == nullptr) + return nullptr; return getSharedTemplate()->ObjectTemplate::getName(); } @@ -2535,7 +2535,7 @@ bool ServerObject::serverObjectInitializeFirstTimeObject(ServerObject *cell, Tra if (cell) { Container::ContainerErrorCode tmp = Container::CEC_Success; - if (!ContainerInterface::transferItemToCell(*cell, *this, transform, NULL, tmp)) + if (!ContainerInterface::transferItemToCell(*cell, *this, transform, nullptr, tmp)) { WARNING(true, ("ServerWorld::createNewObjectIntermediate tried to create a new object in a cell, but it failed.")); return false; @@ -2587,7 +2587,7 @@ void ServerObject::initializeFirstTimeObject() //Don't move this declaration of contents out of the loop or you will leak a ref. ServerObjectTemplate::Contents contents; newTemplate->getContents(contents, i); - if (contents.content == NULL) + if (contents.content == nullptr) { DEBUG_WARNING(true, ("No template for contents item %d", i)); continue; @@ -2600,7 +2600,7 @@ void ServerObject::initializeFirstTimeObject() { //We'll persist the contents automatically if the parent object is persisted. ServerObject * newObject = ServerWorld::createNewObject(*(safe_cast(contents.content)), *this,slotId, false); - if (newObject == NULL) + if (newObject == nullptr) { DEBUG_WARNING(true, ("Can't create object from template %s",contents.content->getName())); } @@ -2615,7 +2615,7 @@ void ServerObject::initializeFirstTimeObject() // get the object (which we assume is a volume container) in the // desired slot SlottedContainer * const container = ContainerInterface::getSlottedContainer(*this); - if (container != NULL) + if (container != nullptr) { Container::ContainerErrorCode tmp = Container::CEC_Success; CachedNetworkId equippedObjectId = container->getObjectInSlot(SlotIdManager::findSlotId(CrcLowerString(contents.slotName.c_str())), tmp); @@ -2623,12 +2623,12 @@ void ServerObject::initializeFirstTimeObject() { // put the contents in the volume container ServerObject * equippedObject = safe_cast(equippedObjectId.getObject()); - if (equippedObject != NULL) + if (equippedObject != nullptr) { //We'll persist the contents automatically if the parent object is persisted. ServerObject * newObject = ServerWorld::createNewObject(*(safe_cast(contents.content)), *equippedObject,false); - if (newObject == NULL) + if (newObject == nullptr) { DEBUG_WARNING(true, ("Can't create object from template %s", contents.content->getName())); } @@ -2714,7 +2714,7 @@ void ServerObject::addToWorld() Object::addToWorld(); updateTriggerVolumes(); - if (getScriptObject() != NULL) + if (getScriptObject() != nullptr) getScriptObject()->setOwnerIsLoaded(); onAddedToWorld(); @@ -3012,8 +3012,8 @@ void ServerObject::onContainerTransferComplete(ServerObject *oldContainer, Serve void ServerObject::containerDepersistContents(ServerObject * oldParent, ServerObject * newParent) { - Container * const oldContainer = oldParent ? ContainerInterface::getContainer(*oldParent) : NULL; - Container * const newContainer = newParent ? ContainerInterface::getContainer(*newParent) : NULL; + Container * const oldContainer = oldParent ? ContainerInterface::getContainer(*oldParent) : nullptr; + Container * const newContainer = newParent ? ContainerInterface::getContainer(*newParent) : nullptr; if (oldContainer) oldContainer->internalItemRemoved(*this); @@ -3410,7 +3410,7 @@ void ServerObject::sendToClientsInUpdateRange(const GameNetworkMessage & message ServerObject * const obj = c->getCharacterObject(); - if (obj != NULL) + if (obj != nullptr) { if ( (ConfigServerGame::getSkipUnreliableTransformsForOtherCells() && obj->getAttachedTo() != getAttachedTo()) || (obj->getPosition_w().magnitudeBetweenSquared(getPosition_w()) > minDistanceSquared) @@ -3447,7 +3447,7 @@ void ServerObject::sendToSpecifiedClients(const GameNetworkMessage & message, bo for (std::vector::const_iterator i = clients.begin(); i != clients.end(); ++i) { ServerObject * o = safe_cast(NetworkIdManager::getObjectById(*i)); - if (o != NULL && o->getClient() != NULL) + if (o != nullptr && o->getClient() != nullptr) o->getClient()->send(message, reliable); } } @@ -3685,8 +3685,8 @@ void ServerObject::setParentCell(CellProperty * newCell) CellProperty * oldCell = getParentCell(); - if(oldCell == NULL) oldCell = CellProperty::getWorldCellProperty(); - if(newCell == NULL) newCell = CellProperty::getWorldCellProperty(); + if(oldCell == nullptr) oldCell = CellProperty::getWorldCellProperty(); + if(newCell == nullptr) newCell = CellProperty::getWorldCellProperty(); // ---------- @@ -3707,7 +3707,7 @@ void ServerObject::setParentCell(CellProperty * newCell) newTransform.multiply(oldCellTransform,oldTransform); Container::ContainerErrorCode tmp = Container::CEC_Success; - result = ContainerInterface::transferItemToWorld(*this, newTransform, NULL, tmp); + result = ContainerInterface::transferItemToWorld(*this, newTransform, nullptr, tmp); DEBUG_REPORT_LOG(!result, ("Object %s (id=%s) transfer to world was denied via ContainerInterface::transferItemToWorld()\n", getObjectTemplateName(), getNetworkId().getValueString().c_str())); } @@ -3720,7 +3720,7 @@ void ServerObject::setParentCell(CellProperty * newCell) ServerObject * newCellServerObject = safe_cast(newCellObject); Container::ContainerErrorCode tmp = Container::CEC_Success; - result = ContainerInterface::transferItemToCell(*newCellServerObject, *this, NULL, tmp); + result = ContainerInterface::transferItemToCell(*newCellServerObject, *this, nullptr, tmp); DEBUG_REPORT_LOG(!result, ("Object %s (id=%s) transfer to cell (id=%s) was denied via ContainerInterface::transferItemToCell()\n", getObjectTemplateName(), getNetworkId().getValueString().c_str(), newCellObject->getNetworkId().getValueString().c_str())); } @@ -4024,11 +4024,11 @@ void ServerObject::hearText(ServerObject const &source, MessageQueueSpatialChat CreatureObject * const creatureObject = asCreatureObject(); - if (creatureObject != NULL) + if (creatureObject != nullptr) { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(creatureObject); - if (playerObject != NULL) + if (playerObject != nullptr) { ChatAvatarId playerChatAvatarId(Chat::constructChatAvatarId(source)); Unicode::String playerName(Unicode::narrowToWide(playerChatAvatarId.getFullName())); @@ -4104,7 +4104,7 @@ void ServerObject::performSocial (const MessageQueueSocial & socialMsg) // allow scripts to prevent the player from performing the emote ScriptParams params; - if (getScriptObject() != NULL) + if (getScriptObject() != nullptr) { params.addParam(unicodeSocialTypeName); if (getScriptObject()->trigAllScripts(Scripting::TRIG_PERFORM_EMOTE, params) != SCRIPT_CONTINUE) @@ -4159,7 +4159,7 @@ void ServerObject::performCombatSpam (const MessageQueueCombatSpam & spamMsg, bo target->seeCombatSpam (spamMsg); } } else { - WARNING_STRICT_FATAL (!sendToSelf && !sendToBystanders, ("null target_obj in commandFuncCombatSpam, when sendToTarget was set true")); + WARNING_STRICT_FATAL (!sendToSelf && !sendToBystanders, ("nullptr target_obj in commandFuncCombatSpam, when sendToTarget was set true")); } } @@ -4217,10 +4217,10 @@ void ServerObject::teleportObject(Vector const &position_w, NetworkId const &tar { PortalProperty *portalProp = targetContainerObject->getPortalProperty(); targetContainerObject = 0; // clear in case we have a building that doesn't have the cell - if (portalProp != NULL) + if (portalProp != nullptr) { CellProperty *cellProp = portalProp->getCell(targetCellName.c_str()); - if (cellProp != NULL) + if (cellProp != nullptr) targetContainerObject = safe_cast(&(cellProp->getOwner())); } if (!targetContainerObject) @@ -4312,7 +4312,7 @@ void ServerObject::teleportObject(Vector const &position_w, NetworkId const &tar // Moves the object. If the new area is on a different server, the PlanetServer will change our authority. // What we really want to check here is whether we want to use the ServerController's teleport - // if a player has logged out, but we still have them loaded in game, their client will be null, + // if a player has logged out, but we still have them loaded in game, their client will be nullptr, // but we still want to use the ServerController's teleport method // so, we check against the player creature controller and player ship controller as well ServerController * controller = safe_cast(getController()); @@ -4383,7 +4383,7 @@ void ServerObject::updatePlanetServerInternal(bool) const /** * Attempts to create a synchronized ui object. If the synchronized ui object * does not exist, its creation is attempted via createSynchronizedUi. The default implementation -* of createSynchronizedUi returns null, and renders this method a no-op. +* of createSynchronizedUi returns nullptr, and renders this method a no-op. */ void ServerObject::addSynchronizedUi(const std::vector & clients) { @@ -4396,9 +4396,9 @@ void ServerObject::addSynchronizedUi(const std::vector & clients) { ServerObject * client = safe_cast( NetworkIdManager::getObjectById(*i)); - if (client != NULL) + if (client != nullptr) { - if (client->getClient() != NULL) + if (client->getClient() != nullptr) m_synchronizedUi->addClientObject (*client); else { @@ -4420,7 +4420,7 @@ void ServerObject::addSynchronizedUi(const std::vector & clients) /** * Attempts to add a client to the synchronized ui object. If the synchronized ui object * does not exist, its creation is attempted via createSynchronizedUi. The default implementation -* of createSynchronizedUi returns null, and renders this method a no-op. +* of createSynchronizedUi returns nullptr, and renders this method a no-op. * */ void ServerObject::addSynchronizedUiClient(ServerObject & client) @@ -4466,7 +4466,7 @@ void ServerObject::removeSynchronizedUiClient(const NetworkId & clientId) /** * Subclasses implement this if they have an appropriate synchronized ui object. -* Base class implementation returns null. +* Base class implementation returns nullptr. */ ServerSynchronizedUi * ServerObject::createSynchronizedUi () { @@ -4483,13 +4483,13 @@ ServerSynchronizedUi * ServerObject::createSynchronizedUi () */ void ServerObject::addPendingSynchronizedUi(const ServerObject & uiObject) { - if (getClient() != NULL) + if (getClient() != nullptr) { WARNING(true, ("ServerObject::addPendingSynchronizedUi called on object %s that already has a client", getNetworkId().getValueString().c_str())); return; } - if (m_pendingSyncUi == NULL) + if (m_pendingSyncUi == nullptr) m_pendingSyncUi = new std::vector; m_pendingSyncUi->push_back(uiObject.getNetworkId()); } @@ -5057,7 +5057,7 @@ std::string ServerObject::debugGetMessageToList() const { unsigned long const now = ServerClock::getInstance().getGameTimeSeconds(); std::string result; - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); for (Archive::AutoDeltaMap, MessageToId>, MessageToPayload>::const_iterator i=m_messageTos.begin(); i!=m_messageTos.end(); ++i) { char temp[256]; @@ -5126,7 +5126,7 @@ unsigned long ServerObject::processQueuedMessageTos(unsigned long effectiveMessa // if the message is going to be recurring, create a // new messageTo to reschedule the recurring message - MessageToPayload * copyOfRecurringMessage = NULL; + MessageToPayload * copyOfRecurringMessage = nullptr; if (message->second.getRecurringTime() > 0) { copyOfRecurringMessage = new MessageToPayload( @@ -5331,7 +5331,7 @@ void ServerObject::handleCMessageTo(const MessageToPayload &message) { //handle unstick static MessageDispatch::Emitter e; - Chat::sendSystemMessageSimple(*this, SharedStringIds::unstick_request_complete, NULL); + Chat::sendSystemMessageSimple(*this, SharedStringIds::unstick_request_complete, nullptr); RequestUnstick r; r.setClientId(getNetworkId()); e.emitMessage(r); @@ -5587,7 +5587,7 @@ bool ServerObject::handleTeleportFixup(bool force) } else if (destContainer != NetworkId::cms_invalid && !force) { - LOG("TeleportFixup", ("Failing teleport fixup because object %s is in a null dest container and force was passed in\n", getNetworkId().getValueString().c_str())); + LOG("TeleportFixup", ("Failing teleport fixup because object %s is in a nullptr dest container and force was passed in\n", getNetworkId().getValueString().c_str())); return false; // going to a container and it wasn't loaded, defer } } @@ -5626,15 +5626,15 @@ void ServerObject::customize(const std::string & customName, int value) if(isAuthoritative()) { CustomizationDataProperty *const cdProperty = safe_cast(getProperty(CustomizationDataProperty::getClassPropertyId())); - if (cdProperty != NULL) + if (cdProperty != nullptr) { CustomizationData *const customizationData = cdProperty->fetchCustomizationData(); - if (customizationData != NULL) + if (customizationData != nullptr) { RangedIntCustomizationVariable * variable = dynamic_cast< RangedIntCustomizationVariable*>(customizationData->findVariable( customName)); - if (variable != NULL) + if (variable != nullptr) variable->setValue(value); else { @@ -5646,7 +5646,7 @@ void ServerObject::customize(const std::string & customName, int value) else { // this shouldn't happen - DEBUG_WARNING(true, ("CustomizationDataProperty returned NULL CustomizationData on fetch.")); + DEBUG_WARNING(true, ("CustomizationDataProperty returned nullptr CustomizationData on fetch.")); } } else @@ -5725,7 +5725,7 @@ bool ServerObject::permanentlyDestroy(DeleteReasons::Enumerator reason) const bool houseDestroyedByScript = (reason == DeleteReasons::Script && buildingObject && buildingObject->isPlayerPlaced()); // tell scripts we want to destroy the object - if (getScriptObject() != NULL && !m_calledTriggerDestroy) + if (getScriptObject() != nullptr && !m_calledTriggerDestroy) { m_calledTriggerDestroy = true; ScriptParams params; @@ -5739,7 +5739,7 @@ bool ServerObject::permanentlyDestroy(DeleteReasons::Enumerator reason) } } - if (isAuthoritative() && (getScriptObject() != NULL) && !m_calledTriggerRemovingFromWorld) + if (isAuthoritative() && (getScriptObject() != nullptr) && !m_calledTriggerRemovingFromWorld) { ScriptParams params; m_calledTriggerRemovingFromWorld = true; @@ -6517,8 +6517,8 @@ void ServerObject::onAllContentsLoaded() if (isAuthoritative()) { - ServerObject *player = NULL; - if ((player = getServerObject(playerId)) != NULL) + ServerObject *player = nullptr; + if ((player = getServerObject(playerId)) != nullptr) { //Tell scripts we are loaded ScriptParams params; @@ -6588,7 +6588,7 @@ void ServerObject::handleDisconnect(bool immediate) { // client has disconnected, log pertinent information about the play session CreatureObject * const creatureObject = asCreatureObject(); - PlayerObject * playerObject = NULL; + PlayerObject * playerObject = nullptr; if (creatureObject) { playerObject = PlayerCreatureController::getPlayerObject(creatureObject); @@ -6927,13 +6927,13 @@ ServerObject * ServerObject::combineResourceContainers(ServerObject &item) { ResourceContainerObject *resourceContainerObject = safe_cast(&item); - if (resourceContainerObject != NULL) + if (resourceContainerObject != nullptr) { // If this is a container, see if it contains another resource container of the same type Container *container = ContainerInterface::getContainer(*this); - if (container != NULL) + if (container != nullptr) { ContainerIterator iterContainer = container->begin(); @@ -6945,12 +6945,12 @@ ServerObject * ServerObject::combineResourceContainers(ServerObject &item) // the item is a resource container if ((containedObject != &item) && - (containedObject != NULL) && + (containedObject != nullptr) && (containedObject->getObjectType() == ServerResourceContainerObjectTemplate::ServerResourceContainerObjectTemplate_tag)) { ResourceContainerObject *containedResourceContainerObject = safe_cast(containedObject); - if ((containedResourceContainerObject != NULL) && + if ((containedResourceContainerObject != nullptr) && (resourceContainerObject->getResourceType() == containedResourceContainerObject->getResourceType())) { // This is a container of similar type, if it is not full, save it to the list @@ -7064,7 +7064,7 @@ bool ServerObject::isContainedBy(const ServerObject & container, bool includeCon // our container is the desired container return true; } - else if (test != NULL && test != this && includeContents) + else if (test != nullptr && test != this && includeContents) { // our container isn't the desired container, see if it is contained return safe_cast(test)->isContainedBy(container, true); @@ -7564,7 +7564,7 @@ void ServerObject::sendDirtyObjectMenuNotification() Controller * const controller = getController(); if (controller) - controller->appendMessage(CM_objectMenuDirty, 0, NULL, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_ALL_CLIENT); + controller->appendMessage(CM_objectMenuDirty, 0, nullptr, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_ALL_CLIENT); } // ---------------------------------------------------------------------- @@ -7577,7 +7577,7 @@ void ServerObject::sendDirtyAttributesNotification() Controller * const controller = getController(); if (controller) - controller->appendMessage(CM_attributesDirty, 0, NULL, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_ALL_CLIENT); + controller->appendMessage(CM_attributesDirty, 0, nullptr, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_ALL_CLIENT); } //------------------------------------------------------------------------------------------ @@ -7615,15 +7615,15 @@ void ServerObject::triggerMadeAuthoritative() void ServerObject::setLayer(TerrainGenerator::Layer* layer) { - LayerProperty * layerProperty = NULL; + LayerProperty * layerProperty = nullptr; Property * property = getProperty(LayerProperty::getClassPropertyId()); - if (property != NULL) + if (property != nullptr) layerProperty = safe_cast(property); else layerProperty = new LayerProperty(*this); layerProperty->setLayer(layer); - if (property == NULL) + if (property == nullptr) { addProperty(*layerProperty, true); ObjectTracker::addRunTimeRule(); @@ -7636,12 +7636,12 @@ void ServerObject::setLayer(TerrainGenerator::Layer* layer) TerrainGenerator::Layer* ServerObject::getLayer() const { const Property * property = getProperty(LayerProperty::getClassPropertyId()); - if (property != NULL) + if (property != nullptr) { const LayerProperty * layerProperty = safe_cast(property); return layerProperty->getLayer(); } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------ @@ -7853,7 +7853,7 @@ void ServerObject::setPatrolPathRoot(const ServerObject & root) // make sure we aren't already a root node Property * p = getProperty(PatrolPathRootProperty::getClassPropertyId()); - if (p != NULL) + if (p != nullptr) { if (root.getNetworkId() != getNetworkId()) { @@ -7873,7 +7873,7 @@ void ServerObject::setPatrolPathRoot(const ServerObject & root) { // add the root node to our node list p = getProperty(PatrolPathNodeProperty::getClassPropertyId()); - if (p == NULL) + if (p == nullptr) { p = new PatrolPathNodeProperty(*this); addProperty(*p, true); @@ -7893,15 +7893,15 @@ void ServerObject::setPatrolPathRoot(const ServerObject & root) // we need to add any players in range to our path observer count TriggerVolume * triggerVolume = getNetworkTriggerVolume(); - if (triggerVolume != NULL) + if (triggerVolume != nullptr) { TriggerVolume::ContentsSet const & contents = triggerVolume->getContents(); for (TriggerVolume::ContentsSet::const_iterator i = contents.begin(); i != contents.end(); ++i) { - if (*i != NULL) + if (*i != nullptr) { Client * client = (*i)->getClient(); - if (client != NULL) + if (client != nullptr) { if (!ObserveTracker::isObserving(*client, *this)) ObserveTracker::onClientEnteredNetworkTriggerVolume(*client, *triggerVolume); @@ -7922,14 +7922,14 @@ void ServerObject::setPatrolPathRoot(const ServerObject & root) /** * Returns the root node for a patrol path node. * - * @return the root node, or NULL if this isn't a patrol path node + * @return the root node, or nullptr if this isn't a patrol path node */ const std::set & ServerObject::getPatrolPathRoots() const { static const std::set noRoots; const Property * p = getProperty(PatrolPathNodeProperty::getClassPropertyId()); - if (p != NULL) + if (p != nullptr) { return safe_cast(p)->getRoots(); } @@ -7957,7 +7957,7 @@ void ServerObject::addPatrolPathingObject(const ServerObject & ai) } Property * p = getProperty(PatrolPathRootProperty::getClassPropertyId()); - if (p != NULL) + if (p != nullptr) { safe_cast(p)->addPatrollingObject(ai); DEBUG_REPORT_LOG(true, ("[patrolpath] add patrol ai %s to root %s\n", @@ -7974,7 +7974,7 @@ void ServerObject::addPatrolPathingObject(const ServerObject & ai) if (roots.size() == 1) { ServerObject * root = safe_cast(roots.begin()->getObject()); - if (root != NULL) + if (root != nullptr) root->addPatrolPathingObject(ai); } else @@ -8004,7 +8004,7 @@ void ServerObject::removePatrolPathingObject(const ServerObject & ai) } Property * p = getProperty(PatrolPathRootProperty::getClassPropertyId()); - if (p != NULL) + if (p != nullptr) { safe_cast(p)->removePatrollingObject(ai); DEBUG_REPORT_LOG(true, ("[patrolpath] remove patrol ai %s from root %s\n", @@ -8019,7 +8019,7 @@ void ServerObject::removePatrolPathingObject(const ServerObject & ai) if (roots.size() == 1) { ServerObject * root = safe_cast(roots.begin()->getObject()); - if (root != NULL) + if (root != nullptr) root->removePatrolPathingObject(ai); } else @@ -8049,7 +8049,7 @@ void ServerObject::addPatrolPathObserver() // if we are a root node, increment our observer count Property * p = getProperty(PatrolPathRootProperty::getClassPropertyId()); - if (p != NULL) + if (p != nullptr) { PatrolPathRootProperty * pprp = safe_cast(p); pprp->incrementObserverCount(); @@ -8061,10 +8061,10 @@ void ServerObject::addPatrolPathObserver() const std::set > & ai = pprp->getPatrollingObjects(); for (std::set >::const_iterator i = ai.begin(); i != ai.end(); ++i) { - if (*i != NULL) + if (*i != nullptr) { const ServerObject * ai = *i; - if (ai->getController()->asCreatureController() != NULL) + if (ai->getController()->asCreatureController() != nullptr) { const CreatureController * controller = ai->getController()->asCreatureController(); if (controller->getHibernate()) @@ -8086,7 +8086,7 @@ void ServerObject::addPatrolPathObserver() for (std::set::const_iterator i = roots.begin(); i != roots.end(); ++i) { ServerObject * root = safe_cast(i->getObject()); - if (root != NULL) + if (root != nullptr) { root->addPatrolPathObserver(); } @@ -8112,7 +8112,7 @@ void ServerObject::removePatrolPathObserver() // if we are a root node, decrement our observer count Property * p = getProperty(PatrolPathRootProperty::getClassPropertyId()); - if (p != NULL) + if (p != nullptr) { PatrolPathRootProperty * pprp = safe_cast(p); pprp->decrementObserverCount(); @@ -8131,7 +8131,7 @@ void ServerObject::removePatrolPathObserver() for (std::set::const_iterator i = roots.begin(); i != roots.end(); ++i) { ServerObject * root = safe_cast(i->getObject()); - if (root != NULL) + if (root != nullptr) { root->removePatrolPathObserver(); } @@ -8152,7 +8152,7 @@ int ServerObject::getPatrolPathObservers() const int observers = 0; const Property * p = getProperty(PatrolPathRootProperty::getClassPropertyId()); - if (p != NULL) + if (p != nullptr) { observers = safe_cast(p)->getObserverCount(); } @@ -8162,7 +8162,7 @@ int ServerObject::getPatrolPathObservers() const for (std::set::const_iterator i = roots.begin(); i != roots.end(); ++i) { const ServerObject * root = safe_cast(i->getObject()); - if (root != NULL && root->isPatrolPathRoot()) + if (root != nullptr && root->isPatrolPathRoot()) { observers += root->getPatrolPathObservers(); } @@ -8175,14 +8175,14 @@ int ServerObject::getPatrolPathObservers() const bool ServerObject::isPatrolPathNode() const { - return (getProperty(PatrolPathNodeProperty::getClassPropertyId()) != NULL) || isPatrolPathRoot(); + return (getProperty(PatrolPathNodeProperty::getClassPropertyId()) != nullptr) || isPatrolPathRoot(); } // ---------------------------------------------------------------------- bool ServerObject::isPatrolPathRoot() const { - return getProperty(PatrolPathRootProperty::getClassPropertyId()) != NULL; + return getProperty(PatrolPathRootProperty::getClassPropertyId()) != nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/object/ServerObject.h b/engine/server/library/serverGame/src/shared/object/ServerObject.h index 32192ce3..5cdaed82 100755 --- a/engine/server/library/serverGame/src/shared/object/ServerObject.h +++ b/engine/server/library/serverGame/src/shared/object/ServerObject.h @@ -317,7 +317,7 @@ public: // Can this object manipulate other objects. CreatureObject overrides. Base class returns false. // generally an object is allowed to manipulate another object if it is container or "nearby". public: - virtual bool canManipulateObject(ServerObject const &target, bool movingObject, bool checkPermission, bool checkPermissionOnParent, float maxDistance, Container::ContainerErrorCode&, bool skipNoTradeCheck = false, bool * allowedByGodMode = NULL) const; + virtual bool canManipulateObject(ServerObject const &target, bool movingObject, bool checkPermission, bool checkPermissionOnParent, float maxDistance, Container::ContainerErrorCode&, bool skipNoTradeCheck = false, bool * allowedByGodMode = nullptr) const; //----------------------------------------------------------------------- // container support @@ -738,7 +738,7 @@ private: static float ms_buildingUpdateRadiusMultiplier; static void setBuildingUpdateRadiusMultiplier(float m); - /** If this object is being controlled by a client, this pointer will be set. NULL otherwise + /** If this object is being controlled by a client, this pointer will be set. nullptr otherwise */ Client * m_client; std::set m_observers; @@ -871,7 +871,7 @@ inline Client * ServerObject::getClient(void) const inline const SharedObjectTemplate * ServerObject::getSharedTemplate() const { - if (m_sharedTemplate != NULL) + if (m_sharedTemplate != nullptr) return m_sharedTemplate; return getDefaultSharedTemplate(); } @@ -936,7 +936,7 @@ inline ServerObject::TriggerVolumeMap & ServerObject::getTriggerVolumeMap() inline const std::set * ServerObject::getTriggerVolumeEntered() const { - return NULL; + return nullptr; } //----------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/object/ServerObject_AuthTransfer.cpp b/engine/server/library/serverGame/src/shared/object/ServerObject_AuthTransfer.cpp index 65655198..b7075ece 100755 --- a/engine/server/library/serverGame/src/shared/object/ServerObject_AuthTransfer.cpp +++ b/engine/server/library/serverGame/src/shared/object/ServerObject_AuthTransfer.cpp @@ -162,7 +162,7 @@ void ServerObject::transferAuthoritySceneChange(uint32 pid) client->getIpAddress(), client->isSecure(), client->getStationId(), - NULL, + nullptr, client->getGameFeatures(), client->getSubscriptionFeatures(), client->getAccountFeatureIds(), @@ -265,7 +265,7 @@ void ServerObject::transferAuthorityNoSceneChange(uint32 pid, bool skipLoadScree client->getIpAddress(), client->isSecure(), client->getStationId(), - (observeListIds.empty() ? NULL : &observeListIds), + (observeListIds.empty() ? nullptr : &observeListIds), client->getGameFeatures(), client->getSubscriptionFeatures(), client->getAccountFeatureIds(), diff --git a/engine/server/library/serverGame/src/shared/object/ServerResourceClassObject.cpp b/engine/server/library/serverGame/src/shared/object/ServerResourceClassObject.cpp index 5bb2df2f..49c6bd09 100755 --- a/engine/server/library/serverGame/src/shared/object/ServerResourceClassObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/ServerResourceClassObject.cpp @@ -577,7 +577,7 @@ ResourceTypeObject const * ServerResourceClassObject::getAResourceType() const if (!m_types.empty()) return m_types.front(); else - return NULL; + return nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/object/ShipObject.cpp b/engine/server/library/serverGame/src/shared/object/ShipObject.cpp index badd8030..2408018b 100755 --- a/engine/server/library/serverGame/src/shared/object/ShipObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/ShipObject.cpp @@ -110,9 +110,9 @@ namespace ShipObjectNamespace typedef std::map ShipTypeShipDataMap; ShipTypeShipDataMap ms_shipTypeShipDataMap; - ShipData const * ms_defaultShipData = NULL; + ShipData const * ms_defaultShipData = nullptr; - ShipComponentDataEngine * ms_defaultEngine = NULL; + ShipComponentDataEngine * ms_defaultEngine = nullptr; unsigned int s_lastShipId = 0; unsigned int const s_maxShipId = 4096; @@ -180,7 +180,7 @@ void ShipObject::install() DataTableManager::addReloadCallback(cs_shipTypeFileName, loadShipTypeDataTable); ShipComponentDescriptor const * const genericEngineDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByName(ConstCharCrcString("eng_generic")); - FATAL(genericEngineDescriptor == NULL, ("ShipObject genericEngineDescriptor [eng_generic] not found")); + FATAL(genericEngineDescriptor == nullptr, ("ShipObject genericEngineDescriptor [eng_generic] not found")); ms_defaultEngine = new ShipComponentDataEngine(*genericEngineDescriptor); // mark shipId 0 as used @@ -243,10 +243,10 @@ ShipObject * ShipObject::getContainingShipObject(ServerObject * serverObject) void ShipObjectNamespace::remove() { - ms_defaultShipData = NULL; + ms_defaultShipData = nullptr; delete ms_defaultEngine; - ms_defaultEngine = NULL; + ms_defaultEngine = nullptr; //-- Delete the ship type to ship data map std::for_each(ms_shipTypeShipDataMap.begin(), ms_shipTypeShipDataMap.end(), PointerDeleterPairSecond()); @@ -270,7 +270,7 @@ ShipObject::ShipObject(ServerShipObjectTemplate const *newTemplate) : m_currentRoll(0.f), m_currentChassisHitPoints(0.f), m_maximumChassisHitPoints(0.f), - m_weaponRefireTimers(NULL), + m_weaponRefireTimers(nullptr), m_numberOfHits(0), m_chassisType (0), m_chassisComponentMassMaximum(0.0f), @@ -406,19 +406,19 @@ ShipObject::~ShipObject() nullWatchers(); delete m_boosterAvailableTimer; - m_boosterAvailableTimer = NULL; + m_boosterAvailableTimer = nullptr; if (getLocalFlag(LocalObjectFlags::ShipObject_ShipIdAssigned)) freeShipId(m_shipId.get()); delete m_fireShotQueue; - m_fireShotQueue = NULL; + m_fireShotQueue = nullptr; delete[] m_weaponRefireTimers; - m_weaponRefireTimers = NULL; + m_weaponRefireTimers = nullptr; delete m_nebulas; - m_nebulas = NULL; + m_nebulas = nullptr; delete m_autoAggroImmuneTimer; delete m_turretWeaponIndices; @@ -465,7 +465,7 @@ void ShipObject::endBaselines() NetworkId const & resourceTypeId = (*it).first; ResourceTypeObject const * const resourceTypeObject = ServerUniverse::getInstance().getResourceTypeById(resourceTypeId); - if (NULL == ServerUniverse::getInstance().getResourceTypeById(resourceTypeId)) + if (nullptr == ServerUniverse::getInstance().getResourceTypeById(resourceTypeId)) { WARNING(true, ("ShipObject::endBaselines invalid resource type [%s]", resourceTypeId.getValueString().c_str())); continue; @@ -946,7 +946,7 @@ Controller *ShipObject::createDefaultController() /** * Get the ship's pilot, if any. * - * @return the pilot if there is one, otherwise NULL + * @return the pilot if there is one, otherwise nullptr */ CreatureObject *ShipObject::getPilot() { @@ -1180,7 +1180,7 @@ void ShipObject::internalHandleFireShot(Client const *gunnerClient, int const we { if (!gunnerCreature) { - WARNING(true, ("ShipObject::internalHandleFireShot cannot fire missile with a null gunner")); + WARNING(true, ("ShipObject::internalHandleFireShot cannot fire missile with a nullptr gunner")); return; } @@ -1284,14 +1284,14 @@ void ShipObject::fireShotTurretServer(int const weaponIndex, NetworkId const & t Object const * const targetObject = NetworkIdManager::getObjectById(targetId); - if (targetObject == NULL) + if (targetObject == nullptr) { WARNING(true, ("ERROR: The targetId(%s) could not be resolved to an Object. A turret shot will NOT be fired.", targetId.getValueString().c_str())); return; } ServerObject const * const targetServerObject = targetObject->asServerObject(); - ShipObject const * const targetShipObject = (targetServerObject != NULL) ? targetServerObject->asShipObject() : NULL; + ShipObject const * const targetShipObject = (targetServerObject != nullptr) ? targetServerObject->asShipObject() : nullptr; if ( !targetShipObject && goodShot) @@ -1299,7 +1299,7 @@ void ShipObject::fireShotTurretServer(int const weaponIndex, NetworkId const & t WARNING(true, ("ERROR: The targetId(%s) could not be resolved to a ShipObject. Perfect shot requested, but there is no way to lead with a perfect shot.", targetId.getValueString().c_str())); } - if ( (targetShipObject != NULL) + if ( (targetShipObject != nullptr) && goodShot) { // If its a good shot, lead perfectly @@ -1335,8 +1335,8 @@ void ShipObject::fireShotTurretServer(int const weaponIndex, NetworkId const & t ShipController const * const ownerShipController = getController()->asShipController(); DEBUG_WARNING(!ownerShipController, ("ERROR: Controller could not be resolved to a ShipController(%s)", getDebugInformation().c_str())); - float const missHalfAngle = (ownerShipController != NULL) ? (ownerShipController->getTurretMissAngle() / 2.0f) : 0.0f; - float const targetRadius = (targetServerObject != NULL) ? targetServerObject->getRadius() : 0.0f; + float const missHalfAngle = (ownerShipController != nullptr) ? (ownerShipController->getTurretMissAngle() / 2.0f) : 0.0f; + float const targetRadius = (targetServerObject != nullptr) ? targetServerObject->getRadius() : 0.0f; Transform transform; transform.roll_l(Random::randomReal() * PI_TIMES_2); @@ -1442,13 +1442,13 @@ void ShipObject::constructFromTemplate() //-- setup ship chassis ShipChassis const * shipChassis = ShipChassis::findShipChassisByName (TemporaryCrcString (shipType.c_str (), true)); - if (shipChassis == NULL) + if (shipChassis == nullptr) { WARNING (true, ("ShipObject::constructFromTemplate failed to find a valid ship chassis for [%s], trying generic", shipType.c_str ())); shipChassis = ShipChassis::findShipChassisByName (TemporaryCrcString ("generic", true)); } - if (shipChassis != NULL) + if (shipChassis != nullptr) m_chassisType = shipChassis->getCrc (); else { @@ -1456,7 +1456,7 @@ void ShipObject::constructFromTemplate() } //set initial slot targetability from the chassis setttings. Code or script can change these at runtime - if(shipChassis != NULL) + if(shipChassis != nullptr) { for (int slot = 0; slot < static_cast(ShipChassisSlotType::SCST_num_types); ++slot) { @@ -1473,7 +1473,7 @@ void ShipObject::constructFromTemplate() { ShipComponentData * const shipComponentData = shipData->m_components[i]; - if (shipComponentData != NULL) + if (shipComponentData != nullptr) { if (!installComponentFromData(i, *shipComponentData)) { std::string chassis = shipChassis->getName().getString(); @@ -1732,7 +1732,7 @@ ShipComponentDataEngine const & ShipObject::getShipDataEngine() const ShipComponentDataEngine const * const engine = safe_cast(shipData->m_components[static_cast(ShipChassisSlotType::SCST_engine)]); - if (engine == NULL) + if (engine == nullptr) return *ms_defaultEngine; return *engine; @@ -1761,9 +1761,9 @@ void ShipObject::handleGunnerChange(ServerObject const &player) } ShipController * const shipController = getController()->asShipController(); - PlayerShipController * const playerShipController = (shipController != NULL) ? shipController->asPlayerShipController() : NULL; + PlayerShipController * const playerShipController = (shipController != nullptr) ? shipController->asPlayerShipController() : nullptr; - if (playerShipController != NULL) + if (playerShipController != nullptr) { playerShipController->updateGunnerWeaponIndex(player.getNetworkId(), gunnerWeaponIndex); } @@ -2152,7 +2152,7 @@ void ShipObjectNamespace::loadShipTypeDataTable(DataTable const &dataTable) //-- find components for (int i = 0; i < static_cast(ShipChassisSlotType::SCST_num_types); ++i) { - shipData->m_components [i] = NULL; + shipData->m_components [i] = nullptr; std::string const & slotName = ShipChassisSlotType::getNameFromType (static_cast(i)); if (!dataTable.doesColumnExist (slotName)) continue; @@ -2164,14 +2164,14 @@ void ShipObjectNamespace::loadShipTypeDataTable(DataTable const &dataTable) uint32 const componentCrc = Crc::normalizeAndCalculate (componentName.c_str ()); ShipComponentDescriptor const * const shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByCrc (componentCrc); - if (shipComponentDescriptor == NULL) + if (shipComponentDescriptor == nullptr) WARNING (true, ("ShipObject ship type [%s] specified invalid [%s] component [%s]", name.c_str (), slotName.c_str (), componentName.c_str ())); else shipData->m_components[i] = ShipComponentDataManager::create(*shipComponentDescriptor); ShipComponentData * const shipComponentData = shipData->m_components[i]; - if (shipComponentData == NULL) + if (shipComponentData == nullptr) continue; //-- get common data @@ -2532,18 +2532,18 @@ void ShipObjectNamespace::freeShipId(uint16 shipId) ShipObject const * ShipObject::asShipObject(Object const * object) { - ServerObject const * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + ServerObject const * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - return (serverObject != NULL) ? serverObject->asShipObject() : NULL; + return (serverObject != nullptr) ? serverObject->asShipObject() : nullptr; } // ---------------------------------------------------------------------- ShipObject * ShipObject::asShipObject(Object * object) { - ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - return (serverObject != NULL) ? serverObject->asShipObject() : NULL; + return (serverObject != nullptr) ? serverObject->asShipObject() : nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/object/ShipObject_Components.cpp b/engine/server/library/serverGame/src/shared/object/ShipObject_Components.cpp index e6f4cb22..667c9ae7 100755 --- a/engine/server/library/serverGame/src/shared/object/ShipObject_Components.cpp +++ b/engine/server/library/serverGame/src/shared/object/ShipObject_Components.cpp @@ -1638,7 +1638,7 @@ bool ShipObject::canInstallComponent (int chassisSlot, TangibleObject const ShipChassisSlot const * const slot = shipChassis->getSlot (static_cast(effectiveCompatibilitySlot)); - if (slot != NULL) + if (slot != nullptr) { if (slot->canAcceptComponent (shipComponentData->getDescriptor ())) { @@ -1721,7 +1721,7 @@ bool ShipObject::installComponent (NetworkId const & installerId, int chassisS void ShipObject::purgeComponent (int chassisSlot) { - IGNORE_RETURN (internalUninstallComponent (NetworkId::cms_invalid, chassisSlot, NULL)); + IGNORE_RETURN (internalUninstallComponent (NetworkId::cms_invalid, chassisSlot, nullptr)); } //---------------------------------------------------------------------- @@ -1731,16 +1731,16 @@ TangibleObject * ShipObject::internalUninstallComponent (NetworkId const if (!isSlotInstalled (chassisSlot)) { WARNING (true, ("ShipObject::internalUninstallComponent failed... no component installed in slot")); - return NULL; + return nullptr; } ShipComponentData * const shipComponentData = createShipComponentData (chassisSlot); - if (shipComponentData == NULL) + if (shipComponentData == nullptr) { - WARNING (true, ("ShipObject::internalUninstallComponent failed null data")); + WARNING (true, ("ShipObject::internalUninstallComponent failed nullptr data")); delete shipComponentData; - return NULL; + return nullptr; } if(getScriptObject()) @@ -1751,7 +1751,7 @@ TangibleObject * ShipObject::internalUninstallComponent (NetworkId const p.addParam (containerTarget ? containerTarget->getNetworkId () : NetworkId::cms_invalid); if (getScriptObject()->trigAllScripts(Scripting::TRIG_SHIP_COMPONENT_UNINSTALLING, p) == SCRIPT_OVERRIDE) - return NULL; + return nullptr; } TangibleObject * tangible = 0; @@ -1765,7 +1765,7 @@ TangibleObject * ShipObject::internalUninstallComponent (NetworkId const { VolumeContainer * volContainer = ContainerInterface::getVolumeContainer(*containerTarget); - if (volContainer == NULL) + if (volContainer == nullptr) return 0; int oldCapacity = volContainer->debugDoNotUseSetCapacity(-1); @@ -1780,21 +1780,21 @@ TangibleObject * ShipObject::internalUninstallComponent (NetworkId const obj = safe_cast(ServerWorld::createNewObject (objectTemplateCrc, *containerTarget, true)); } - if (obj == NULL) + if (obj == nullptr) { WARNING (true, ("ShipObject::internalUninstallComponent failed for slot [%d] because ServerWorld could not create an object for [%d], or container is full", chassisSlot, objectTemplateCrc)); delete shipComponentData; - return NULL; + return nullptr; } tangible = obj->asTangibleObject (); - if (tangible == NULL) + if (tangible == nullptr) { WARNING (true, ("ShipObject::internalUninstallComponent failed for slot [%d] because object template [%d] is not tangible", chassisSlot, objectTemplateCrc)); delete shipComponentData; IGNORE_RETURN (obj->permanentlyDestroy (DeleteReasons::SetupFailed)); - return NULL; + return nullptr; } shipComponentData->writeDataToComponent (*tangible); @@ -1897,7 +1897,7 @@ TangibleObject * ShipObject::uninstallComponent (NetworkId const & uninstallerId bool ShipObject::installComponentFromData(int chassisSlot, ShipComponentData const & shipComponentData) { ShipChassis const * const shipChassis = ShipChassis::findShipChassisByCrc (getChassisType ()); - if (shipChassis == NULL) + if (shipChassis == nullptr) { DEBUG_WARNING (true, ("Ship [%s] chassis [%d] is invalid for installing component [%s]", getNetworkId().getValueString().c_str(), @@ -1922,7 +1922,7 @@ bool ShipObject::installComponentFromData(int chassisSlot, ShipComponentData con effectiveCompatibilitySlot = ShipChassisSlotType::SCST_weapon_first+((chassisSlot-ShipChassisSlotType::SCST_weapon_first)&7); ShipChassisSlot const * const slot = shipChassis->getSlot (static_cast(effectiveCompatibilitySlot)); - if (slot == NULL) + if (slot == nullptr) { DEBUG_WARNING (true, ("Ship [%s] chassis [%s] does not support slot [%s] for installing component [%s]", getNetworkId().getValueString().c_str(), @@ -1957,7 +1957,7 @@ bool ShipObject::installComponentFromData(int chassisSlot, ShipComponentData con bool ShipObject::pseudoInstallComponent(int chassisSlot, uint32 componentCrc) { ShipComponentDescriptor const * const shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByCrc (componentCrc); - if (shipComponentDescriptor == NULL) + if (shipComponentDescriptor == nullptr) { WARNING (true, ("Invalid component name")); return false; @@ -1965,7 +1965,7 @@ bool ShipObject::pseudoInstallComponent(int chassisSlot, uint32 componentCrc) ShipComponentData * const shipComponentData = ShipComponentDataManager::create (*shipComponentDescriptor); - if (shipComponentData == NULL) + if (shipComponentData == nullptr) { WARNING(true, ("ShipObject::pseudoInstallComponent invalid descriptor")); return false; @@ -1982,27 +1982,27 @@ bool ShipObject::pseudoInstallComponent(int chassisSlot, uint32 componentCrc) ShipComponentData * ShipObject::createShipComponentData (int chassisSlot) const { - ShipComponentDescriptor const * shipComponentDescriptor = NULL; + ShipComponentDescriptor const * shipComponentDescriptor = nullptr; uint32 const componentCrc = getComponentCrc (chassisSlot); if (componentCrc) { shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByCrc (componentCrc); - if (shipComponentDescriptor == NULL) + if (shipComponentDescriptor == nullptr) { WARNING (true, ("ShipObject::createShipComponentData failed for slot [%d] because component crc [%d] could not map to a component descriptor", chassisSlot, componentCrc)); - return NULL; + return nullptr; } } else - return NULL; + return nullptr; ShipComponentData * const shipComponentData = ShipComponentDataManager::create (*shipComponentDescriptor); - if (shipComponentData == NULL) + if (shipComponentData == nullptr) { WARNING (true, ("ShipObject::createShipComponentData failed for slot [%d] ship Component data could not be constructed", chassisSlot)); delete(shipComponentData); - return NULL; + return nullptr; } if (!shipComponentData->readDataFromShip (chassisSlot, *this)) @@ -2334,7 +2334,7 @@ float ShipObject::computeShipActualSpeedMaximum () const if (hasWings() && hasCondition(TangibleObject::C_wingsOpened)) { ShipChassis const * const shipChassis = ShipChassis::findShipChassisByCrc(getChassisType()); - if (NULL != shipChassis) + if (nullptr != shipChassis) { float const wingOpenSpeedFactor = shipChassis->getWingOpenSpeedFactor(); rate *= wingOpenSpeedFactor; @@ -2673,7 +2673,7 @@ void ShipObject::handlePowerPulse (float timeElapsedSecs) if (boosterEnergyCurrent <= 0.0f) { IGNORE_RETURN(setComponentActive(ShipChassisSlotType::SCST_booster, false)); - if (pilot != NULL) + if (pilot != nullptr) Chat::sendSystemMessage(*pilot, SharedStringIds::booster_energy_depleted, Unicode::emptyString); restartBoosterTimer(); @@ -3368,7 +3368,7 @@ void ShipObject::setCargoHoldContent(NetworkId const & resourceTypeId, int amoun else { ResourceTypeObject const * const resourceTypeObject = ServerUniverse::getInstance().getResourceTypeById(resourceTypeId); - if (NULL == ServerUniverse::getInstance().getResourceTypeById(resourceTypeId)) + if (nullptr == ServerUniverse::getInstance().getResourceTypeById(resourceTypeId)) { WARNING(true, ("ShipObject::setCargoHoldContent invalid resource type [%s]", resourceTypeId.getValueString().c_str())); return; diff --git a/engine/server/library/serverGame/src/shared/object/StaticObject.cpp b/engine/server/library/serverGame/src/shared/object/StaticObject.cpp index 8a9dfc3f..35366239 100755 --- a/engine/server/library/serverGame/src/shared/object/StaticObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/StaticObject.cpp @@ -21,7 +21,7 @@ #include "sharedObject/AppearanceTemplateList.h" #include "sharedObject/ObjectTemplateList.h" -const SharedObjectTemplate * StaticObject::m_defaultSharedTemplate = NULL; +const SharedObjectTemplate * StaticObject::m_defaultSharedTemplate = nullptr; //----------------------------------------------------------------------- @@ -39,7 +39,7 @@ StaticObject::StaticObject(const ServerStaticObjectTemplate* newTemplate) : { Appearance * newAppearance = AppearanceTemplateList::createAppearance(appearanceString.c_str()); - if(newAppearance != NULL) + if(newAppearance != nullptr) { setAppearance(newAppearance); } else { @@ -82,13 +82,13 @@ const SharedObjectTemplate * StaticObject::getDefaultSharedTemplate(void) const { static const ConstCharCrcLowerString templateName("object/static/base/shared_static_default.iff"); - if (m_defaultSharedTemplate == NULL) + if (m_defaultSharedTemplate == nullptr) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create " + WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create " "default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) ExitChain::add (removeDefaultTemplate, "StaticObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -101,10 +101,10 @@ static const ConstCharCrcLowerString templateName("object/static/base/shared_sta */ void StaticObject::removeDefaultTemplate(void) { - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } // StaticObject::removeDefaultTemplate diff --git a/engine/server/library/serverGame/src/shared/object/TangibleConditionObserver.cpp b/engine/server/library/serverGame/src/shared/object/TangibleConditionObserver.cpp index ab9526b4..b9f4cad8 100755 --- a/engine/server/library/serverGame/src/shared/object/TangibleConditionObserver.cpp +++ b/engine/server/library/serverGame/src/shared/object/TangibleConditionObserver.cpp @@ -27,10 +27,10 @@ TangibleConditionObserver::TangibleConditionObserver(TangibleObject const *who, TangibleConditionObserver::~TangibleConditionObserver() { - if (m_tangibleObject != NULL) + if (m_tangibleObject != nullptr) { const CreatureObject * creature = m_tangibleObject->asCreatureObject(); - if (creature != NULL) + if (creature != nullptr) { int currentCondition = creature->getCondition(); if ((m_oldCondition & TangibleObject::C_hibernating) != 0 && (currentCondition & TangibleObject::C_hibernating) == 0) @@ -50,8 +50,8 @@ TangibleConditionObserver::~TangibleConditionObserver() if ((wasInvulnerable != isInvulnerable) && !m_tangibleObject->getObservers().empty()) { // did the object's "pvp sync" status change because of the invulnerability change? - bool const wasPvpSync = PvpUpdateObserver::satisfyPvpSyncCondition(m_tangibleObject->isNonPvpObject(), wasInvulnerable, (m_tangibleObject->asCreatureObject() != NULL), m_tangibleObject->getPvpFaction()); - bool const isPvpSync = PvpUpdateObserver::satisfyPvpSyncCondition(m_tangibleObject->isNonPvpObject(), isInvulnerable, (m_tangibleObject->asCreatureObject() != NULL), m_tangibleObject->getPvpFaction()); + bool const wasPvpSync = PvpUpdateObserver::satisfyPvpSyncCondition(m_tangibleObject->isNonPvpObject(), wasInvulnerable, (m_tangibleObject->asCreatureObject() != nullptr), m_tangibleObject->getPvpFaction()); + bool const isPvpSync = PvpUpdateObserver::satisfyPvpSyncCondition(m_tangibleObject->isNonPvpObject(), isInvulnerable, (m_tangibleObject->asCreatureObject() != nullptr), m_tangibleObject->getPvpFaction()); if (wasPvpSync != isPvpSync) { diff --git a/engine/server/library/serverGame/src/shared/object/TangibleObject.cpp b/engine/server/library/serverGame/src/shared/object/TangibleObject.cpp index 196f9ce9..3602f9a6 100755 --- a/engine/server/library/serverGame/src/shared/object/TangibleObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/TangibleObject.cpp @@ -354,13 +354,13 @@ static const std::string NOMOVE_SCRIPT = "item.special.nomove"; static const std::string OBJVAR_DECLINE_DUEL = "decline_duel"; -const SharedObjectTemplate * TangibleObject::m_defaultSharedTemplate = NULL; +const SharedObjectTemplate * TangibleObject::m_defaultSharedTemplate = nullptr; //----------------------------------------------------------------------- TangibleObject::TangibleObject(const ServerTangibleObjectTemplate* newTemplate) : ServerObject(newTemplate), - m_combatData(NULL), + m_combatData(nullptr), m_pvpType(), m_pvpMercenaryType(PvpType_Neutral), m_pvpFutureType(-1), @@ -392,7 +392,7 @@ TangibleObject::TangibleObject(const ServerTangibleObjectTemplate* newTemplate) m_accessList(), m_guildAccessList(), m_effectsMap(), - m_npcConversation(NULL), + m_npcConversation(nullptr), m_conversations() { WARNING_STRICT_FATAL(!getSharedTemplate(), ("Tried to create a TANGIBLE %s object without a shared template!\n", newTemplate->DataResource::getName())); @@ -469,7 +469,7 @@ TangibleObject::TangibleObject(const ServerTangibleObjectTemplate* newTemplate) { Appearance * newAppearance = AppearanceTemplateList::createAppearance(appearanceString.c_str()); - if(newAppearance != NULL) + if(newAppearance != nullptr) { setAppearance(newAppearance); } else { @@ -522,11 +522,11 @@ TangibleObject::~TangibleObject() //-- This must be the first line in the destructor to invalidate any watchers watching this object nullWatchers(); - if (getSynchronizedUi() != NULL) + if (getSynchronizedUi() != nullptr) { CraftingToolSyncUi * sync = dynamic_cast( getSynchronizedUi()); - if (sync != NULL) + if (sync != nullptr) { if (isAuthoritative() && isCraftingTool()) { @@ -561,7 +561,7 @@ TangibleObject::~TangibleObject() CombatTracker::removeDefender(this); - if (m_combatData != NULL) + if (m_combatData != nullptr) { if (isAuthoritative()) { @@ -598,16 +598,16 @@ TangibleObject::~TangibleObject() } delete m_combatData; - m_combatData = NULL; + m_combatData = nullptr; if (!isPlayerControlled()) ObjectTracker::removeCombatAI(); } - if (m_npcConversation != NULL) + if (m_npcConversation != nullptr) { delete m_npcConversation; - m_npcConversation = NULL; + m_npcConversation = nullptr; } ObjectTracker::removeTangible(); @@ -625,7 +625,7 @@ void TangibleObject::initializeFirstTimeObject() // set up armor from the template const ServerTangibleObjectTemplate * newTemplate = safe_cast< const ServerTangibleObjectTemplate *>(getObjectTemplate()); - if (newTemplate != NULL) + if (newTemplate != nullptr) { setInvulnerable(newTemplate->getInvulnerable()); @@ -634,7 +634,7 @@ void TangibleObject::initializeFirstTimeObject() initializeVisibility(); const ServerArmorTemplate * armorTemplate = newTemplate->getArmor(); - if (armorTemplate != NULL) + if (armorTemplate != nullptr) { int const rating = static_cast(armorTemplate->getRating()); if ( rating < static_cast(ServerArmorTemplate::AR_armorNone) @@ -729,7 +729,7 @@ void TangibleObject::endBaselines() // check for existence of objvar to enable/disable m_logCommandEnqueue CommandQueue * const queue = getCommandQueue(); - if (queue != NULL) + if (queue != nullptr) { queue->setLogCommandEnqueue(getObjVars().hasItem("debuggingLogCommandEnqueue")); } @@ -781,7 +781,7 @@ void TangibleObject::onLoadedFromDatabase() params.addParam(prototypeId, "prototype"); ScriptDictionaryPtr dictionary; getScriptObject()->makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(getNetworkId(), @@ -973,16 +973,16 @@ TangibleObject * TangibleObject::getTangibleObject(NetworkId const & networkId) TangibleObject * TangibleObject::asTangibleObject(Object * object) { - ServerObject * serverObject = (object != NULL) ? object->asServerObject() : NULL; - return (serverObject != NULL) ? serverObject->asTangibleObject() : NULL; + ServerObject * serverObject = (object != nullptr) ? object->asServerObject() : nullptr; + return (serverObject != nullptr) ? serverObject->asTangibleObject() : nullptr; } //----------------------------------------------------------------------- TangibleObject const * TangibleObject::asTangibleObject(Object const * object) { - ServerObject const * serverObject = (object != NULL) ? object->asServerObject() : NULL; - return (serverObject != NULL) ? serverObject->asTangibleObject() : NULL; + ServerObject const * serverObject = (object != nullptr) ? object->asServerObject() : nullptr; + return (serverObject != nullptr) ? serverObject->asTangibleObject() : nullptr; } //----------------------------------------------------------------------- @@ -1010,13 +1010,13 @@ const SharedObjectTemplate * TangibleObject::getDefaultSharedTemplate(void) cons { static const ConstCharCrcLowerString templateName("object/tangible/base/shared_tangible_default.iff"); - if (m_defaultSharedTemplate == NULL) + if (m_defaultSharedTemplate == nullptr) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create " + WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create " "default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) ExitChain::add (removeDefaultTemplate, "TangibleObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -1029,10 +1029,10 @@ static const ConstCharCrcLowerString templateName("object/tangible/base/shared_t */ void TangibleObject::removeDefaultTemplate(void) { - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } // TangibleObject::removeDefaultTemplate @@ -1184,7 +1184,7 @@ void TangibleObject::appearanceDataModified(const std::string& value) void TangibleObject::getEquippedItems(uint32 combatBone, std::vector &items) const { SlottedContainer const * const container = ContainerInterface::getSlottedContainer(*this); - if (container == NULL) + if (container == nullptr) return; std::vector itemIds; @@ -1194,10 +1194,10 @@ void TangibleObject::getEquippedItems(uint32 combatBone, std::vector(object); - if (item != NULL) + if (item != nullptr) items.push_back(item); } } @@ -1219,7 +1219,7 @@ TangibleObject * TangibleObject::getRandomEquippedItem(uint32 combatBone) const if (items.empty()) { - return NULL; + return nullptr; } int index = Random::random(0, items.size() - 1); @@ -1401,17 +1401,17 @@ void TangibleObject::conclude() PROFILER_AUTO_BLOCK_DEFINE("TangibleObject::conclude"); // if we are a crafting tool, conclude our prototype and manf schematic - if (getSynchronizedUi() != NULL) + if (getSynchronizedUi() != nullptr) { const CraftingToolSyncUi * sync = dynamic_cast( getSynchronizedUi()); - if (sync != NULL) + if (sync != nullptr) { Object * object = sync->getPrototype().getObject(); - if (object != NULL) + if (object != nullptr) object->conclude(); object = sync->getManfSchematic().getObject(); - if (object != NULL) + if (object != nullptr) object->conclude(); } } @@ -1683,12 +1683,12 @@ void TangibleObject::setPvpMercenaryFaction(Pvp::FactionId factionId, Pvp::PvpTy { if (PvpData::isImperialFactionId(m_pvpMercenaryFaction.get())) { - IGNORE_RETURN(setObjVarItem("factionalHelper.timeStopHelpingImperial", static_cast(::time(NULL)))); + IGNORE_RETURN(setObjVarItem("factionalHelper.timeStopHelpingImperial", static_cast(::time(nullptr)))); removeObjVarItem("factionalHelper.timeStopHelpingRebel"); } else if (PvpData::isRebelFactionId(m_pvpMercenaryFaction.get())) { - IGNORE_RETURN(setObjVarItem("factionalHelper.timeStopHelpingRebel", static_cast(::time(NULL)))); + IGNORE_RETURN(setObjVarItem("factionalHelper.timeStopHelpingRebel", static_cast(::time(nullptr)))); removeObjVarItem("factionalHelper.timeStopHelpingImperial"); } } @@ -1821,11 +1821,11 @@ void TangibleObject::onPermanentlyDestroyed() if (isCraftingTool()) { ServerObject * owner = ServerWorld::findObjectByNetworkId(getOwnerId()); - if (owner != NULL && owner->asCreatureObject() != NULL) + if (owner != nullptr && owner->asCreatureObject() != nullptr) { PlayerObject * player = PlayerCreatureController::getPlayerObject( owner->asCreatureObject()); - if (player != NULL && player->isCrafting() && player->getCraftingTool() == getNetworkId()) + if (player != nullptr && player->isCrafting() && player->getCraftingTool() == getNetworkId()) player->stopCrafting(false); } } @@ -1942,11 +1942,11 @@ bool TangibleObject::onContainerAboutToTransfer(ServerObject * destination, Serv } } } - if (destination != NULL && getObjVars().hasItem(OBJVAR_BIO_LINK_ID)) + if (destination != nullptr && getObjVars().hasItem(OBJVAR_BIO_LINK_ID)) { // if this item is bio-linked and a player is trying to equip it, make // sure the link id matches the player's id - if (destination->asCreatureObject() != NULL) + if (destination->asCreatureObject() != nullptr) { // allow holograms to have biolinked items transferred to them int hologramVal = 0; @@ -2058,7 +2058,7 @@ Footprint *TangibleObject::getFootprint() if (property) return property->getFootprint(); else - return NULL; + return nullptr; } //----------------------------------------------------------------------- @@ -2069,7 +2069,7 @@ Footprint const *TangibleObject::getFootprint() const if (property) return property->getFootprint(); else - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -2151,9 +2151,9 @@ int TangibleObject::alterHitPoints(int delta, bool ignoreInvulnerable, #ifdef _DEBUG char debugBuffer[1024]; const char * craftedString = ""; - Client *client = NULL; + Client *client = nullptr; ServerObject * sourceObject = safe_cast(NetworkIdManager::getObjectById(source)); - if (source != NetworkId::cms_invalid && sourceObject != NULL) + if (source != NetworkId::cms_invalid && sourceObject != nullptr) client = sourceObject->getClient(); #endif @@ -2171,7 +2171,7 @@ int TangibleObject::alterHitPoints(int delta, bool ignoreInvulnerable, "from %d to %d\n", craftedString, getNetworkId().getValueString().c_str(), totalHitPoints, m_damageTaken.get(), totalDamageTaken); DEBUG_REPORT_LOG (true, ("%s", debugBuffer)); - if (source != NetworkId::cms_invalid && client != NULL) + if (source != NetworkId::cms_invalid && client != nullptr) ConsoleMgr::broadcastString(debugBuffer, client); } #endif @@ -2200,7 +2200,7 @@ int TangibleObject::alterHitPoints(int delta, bool ignoreInvulnerable, snprintf(debugBuffer, sizeof(debugBuffer), "%s object %s has been " "disabled\n", craftedString, getNetworkId().getValueString().c_str()); DEBUG_REPORT_LOG (true, ("%s", debugBuffer)); - if (source != NetworkId::cms_invalid && client != NULL) + if (source != NetworkId::cms_invalid && client != nullptr) ConsoleMgr::broadcastString(debugBuffer, client); } #endif @@ -2283,7 +2283,7 @@ void TangibleObject::updatePlanetServerInternal(const bool forceUpdate) const if ((forceUpdate || getPositionChanged()) && (!ContainerInterface::getContainedByObject(*this) || getInterestRadius() > 0)) { Object const * const topmostContainer = ContainerInterface::getTopmostContainer(*this); - FATAL(!topmostContainer, ("Object %s was contained by something, but getTopmostContainer() returned NULL\n",getNetworkId().getValueString().c_str())); + FATAL(!topmostContainer, ("Object %s was contained by something, but getTopmostContainer() returned nullptr\n",getNetworkId().getValueString().c_str())); Vector const &position = topmostContainer->getPosition_p(); UpdateObjectOnPlanetMessage const msg( @@ -2313,7 +2313,7 @@ void TangibleObject::updatePlanetServerInternal(const bool forceUpdate) const */ void TangibleObject::clearDamageList(void) { - if (m_combatData != NULL) + if (m_combatData != nullptr) { m_combatData->defenseData.damage.clear(); } @@ -2442,7 +2442,7 @@ void TangibleObject::clearHateList() } else { - sendControllerMessageToAuthServer(CM_clearHateList, NULL); + sendControllerMessageToAuthServer(CM_clearHateList, nullptr); } } @@ -2476,7 +2476,7 @@ bool TangibleObject::isHatedBy(Object * const object) bool result = false; TangibleObject * const hatedByTangibleObject = TangibleObject::asTangibleObject(object); - if (hatedByTangibleObject != NULL) + if (hatedByTangibleObject != nullptr) { HateList::UnSortedList const & hateList = hatedByTangibleObject->getUnSortedHateList(); @@ -2534,7 +2534,7 @@ void TangibleObject::resetHateTimer() } else { - sendControllerMessageToAuthServer(CM_resetHateTimer, NULL); + sendControllerMessageToAuthServer(CM_resetHateTimer, nullptr); } } @@ -2625,11 +2625,11 @@ void TangibleObject::setCraftedId(const NetworkId & id) IGNORE_RETURN(setObjVarItem(OBJVAR_CRAFTING_SCHEMATIC, id)); setCondition(C_crafted); const Object * object = NetworkIdManager::getObjectById(id); - if (object != NULL) + if (object != nullptr) { const ManufactureSchematicObject * schematic = dynamic_cast< const ManufactureSchematicObject *>(object); - if (schematic != NULL) + if (schematic != nullptr) m_sourceDraftSchematic = schematic->getDraftSchematic(); } } @@ -2869,7 +2869,7 @@ bool TangibleObject::startCraftingSession(CreatureObject & crafter) UNREF(myIdString); // needed for release mode PlayerObject * crafterPlayer = PlayerCreatureController::getPlayerObject(&crafter); - if (crafterPlayer == NULL) + if (crafterPlayer == nullptr) return false; // make sure we are a crafting tool @@ -2909,7 +2909,7 @@ bool TangibleObject::startCraftingSession(CreatureObject & crafter) // make sure the output slot is empty SlottedContainer const * const slotContainer = ContainerInterface::getSlottedContainer(*this); - if (slotContainer == NULL) + if (slotContainer == nullptr) { DEBUG_WARNING(true, ("Crafting tool %s does not have a container!", myIdString)); return false; @@ -2938,7 +2938,7 @@ bool TangibleObject::startCraftingSession(CreatureObject & crafter) for (iter = schematics.begin(); iter != schematics.end(); ++iter) { const DraftSchematicObject * schematic = DraftSchematicObject::getSchematic((*iter).first.first); - if (schematic != NULL && ((myType & ServerObjectTemplate::CT_genericItem) != 0 || + if (schematic != nullptr && ((myType & ServerObjectTemplate::CT_genericItem) != 0 || ((schematic->getCategory() & myType) != 0))) { // make sure the player has all the skill commands needed for the @@ -3068,11 +3068,11 @@ bool TangibleObject::stopCraftingSession(void) bool TangibleObject::isIngredientInHopper(const NetworkId & ingredientId) const { ServerObject const * const hopper = getIngredientHopper(); - if (hopper == NULL) + if (hopper == nullptr) return false; Object const * const ingredient = CachedNetworkId(ingredientId).getObject(); - if (ingredient == NULL) + if (ingredient == nullptr) return false; return ContainerInterface::isNestedWithin(*ingredient, getNetworkId()); @@ -3098,15 +3098,15 @@ static const SlotId hopperSlotId(SlotIdManager::findSlotId(INGREDIENT_HOPPER_SLO { DEBUG_WARNING(true, ("Tried to get input hopper for non-crafting station " "object %s", myIdString)); - return NULL; + return nullptr; } // get the ingredient hopper SlottedContainer const * const container = ContainerInterface::getSlottedContainer(*this); - if (container == NULL) + if (container == nullptr) { DEBUG_WARNING(true, ("Crafting tool %s does not have a container!", myIdString)); - return NULL; + return nullptr; } Container::ContainerErrorCode tmp = Container::CEC_Success; Container::ContainedItem hopperId = container->getObjectInSlot(hopperSlotId, tmp); @@ -3114,14 +3114,14 @@ static const SlotId hopperSlotId(SlotIdManager::findSlotId(INGREDIENT_HOPPER_SLO { DEBUG_WARNING(true, ("Crafting tool %s does not have a ingredient " "hopper!", myIdString)); - return NULL; + return nullptr; } ServerObject * hopper = safe_cast(hopperId.getObject()); - if (hopper == NULL) + if (hopper == nullptr) { DEBUG_WARNING(true, ("Can't find object for ingredient hopper id %s", hopperId.getValueString().c_str())); - return NULL; + return nullptr; } return hopper; @@ -3150,16 +3150,16 @@ static const SlotId outputSlotId(SlotIdManager::findSlotId(MANF_OUTPUT_SLOT_NAME // get output slot SlottedContainer const * const slotContainer = ContainerInterface::getSlottedContainer(*this); - if (slotContainer == NULL) + if (slotContainer == nullptr) { DEBUG_WARNING(true, ("Crafting tool %s does not have a container!", myIdString)); return false; } // make sure the transferer is in the final stage of crafting - if (transferer == NULL) + if (transferer == nullptr) { - DEBUG_WARNING(true, ("addObjectToOutputSlot, NULL transferer")); + DEBUG_WARNING(true, ("addObjectToOutputSlot, nullptr transferer")); return false; } NetworkId crafterVarId(NetworkId::cms_invalid); @@ -3178,14 +3178,14 @@ static const SlotId outputSlotId(SlotIdManager::findSlotId(MANF_OUTPUT_SLOT_NAME return false; } CreatureObject const * const creatureTransferer = transferer->asCreatureObject(); - if (creatureTransferer == NULL) + if (creatureTransferer == nullptr) { DEBUG_WARNING(true, ("addObjectToOutputSlot, transferer %s is not a " "creature", transferer->getNetworkId().getValueString().c_str())); return false; } PlayerObject const * const creaturePlayer = PlayerCreatureController::getPlayerObject(creatureTransferer); - if (creaturePlayer == NULL) + if (creaturePlayer == nullptr) return false; if (creaturePlayer->getCraftingStage() != Crafting::CS_finish) @@ -3197,11 +3197,11 @@ static const SlotId outputSlotId(SlotIdManager::findSlotId(MANF_OUTPUT_SLOT_NAME } // if the object is our prototype, clear the prototype - if (getSynchronizedUi() != NULL) + if (getSynchronizedUi() != nullptr) { CraftingToolSyncUi * sync = dynamic_cast( getSynchronizedUi()); - if (sync != NULL) + if (sync != nullptr) { if (sync->getPrototype() == object.getNetworkId()) { @@ -3212,7 +3212,7 @@ static const SlotId outputSlotId(SlotIdManager::findSlotId(MANF_OUTPUT_SLOT_NAME // put the object in the slot Container::ContainerErrorCode tmp = Container::CEC_Success; - if (!ContainerInterface::transferItemToSlottedContainer(*this, object, outputSlotId, NULL, tmp)) + if (!ContainerInterface::transferItemToSlottedContainer(*this, object, outputSlotId, nullptr, tmp)) { DEBUG_WARNING(true, ("Failed to transfer object %s to crafting " "tool %s", object.getNetworkId().getValueString().c_str(), @@ -3250,7 +3250,7 @@ ManufactureSchematicObject * TangibleObject::getCraftingManufactureSchematic(voi { DEBUG_WARNING(true, ("Tried to get non-crafting tool " "object %s", myIdString)); - return NULL; + return nullptr; } SlottedContainer const * const container = ContainerInterface::getSlottedContainer(*this); @@ -3264,7 +3264,7 @@ ManufactureSchematicObject * TangibleObject::getCraftingManufactureSchematic(voi else { DEBUG_WARNING(true, ("ManufactureSchematicObject doesn't have a slotted container.")); - return NULL; + return nullptr; } } // TangibleObject::getCraftingManufactureSchematic @@ -3282,17 +3282,17 @@ ManufactureSchematicObject * TangibleObject::removeCraftingManufactureSchematic( UNREF(myIdString); // needed for release mode // make sure we are a crafting tool - if (!isCraftingTool() || getSynchronizedUi() == NULL) + if (!isCraftingTool() || getSynchronizedUi() == nullptr) { DEBUG_WARNING(true, ("Tried to get non-crafting tool " "object %s", myIdString)); - return NULL; + return nullptr; } CraftingToolSyncUi * sync = dynamic_cast( getSynchronizedUi()); - if (sync == NULL) - return NULL; + if (sync == nullptr) + return nullptr; ManufactureSchematicObject * schematic = safe_cast( sync->getManfSchematic().getObject()); @@ -3320,7 +3320,7 @@ void TangibleObject::setCraftingManufactureSchematic(ManufactureSchematicObject UNREF(myIdString); // needed for release mode // make sure we are a crafting tool - if (!isCraftingTool() || getSynchronizedUi() == NULL) + if (!isCraftingTool() || getSynchronizedUi() == nullptr) { DEBUG_WARNING(true, ("Tried to get non-crafting tool " "object %s", myIdString)); @@ -3329,7 +3329,7 @@ void TangibleObject::setCraftingManufactureSchematic(ManufactureSchematicObject CraftingToolSyncUi * sync = dynamic_cast( getSynchronizedUi()); - if (sync == NULL) + if (sync == nullptr) return; // see if there is already a schematic object set @@ -3339,7 +3339,7 @@ void TangibleObject::setCraftingManufactureSchematic(ManufactureSchematicObject // remove the old schematic ServerObject * object = safe_cast(schematicId.getObject()); - if (object == NULL) + if (object == nullptr) { if (schematicId != NetworkId::cms_invalid) { @@ -3358,13 +3358,13 @@ void TangibleObject::setCraftingManufactureSchematic(ManufactureSchematicObject // the schematic isn't in the world or in a container, so we need to // tell the client about it int stationBonus = 0; - ServerObject * crafter = NULL; + ServerObject * crafter = nullptr; NetworkId crafterId; if (getObjVars().getItem(OBJVAR_CRAFTING_CRAFTER,crafterId)) { crafter = safe_cast(NetworkIdManager::getObjectById(crafterId)); } - if (crafter != NULL) + if (crafter != nullptr) { sync->setManfSchematic(CachedNetworkId(schematic), CachedNetworkId(*crafter), true); @@ -3373,7 +3373,7 @@ void TangibleObject::setCraftingManufactureSchematic(ManufactureSchematicObject // it has const PlayerObject * player = PlayerCreatureController::getPlayerObject( crafter->asCreatureObject()); - if (player != NULL && player->getCraftingStation().getObject() != NULL) + if (player != nullptr && player->getCraftingStation().getObject() != nullptr) { player->getCraftingStation().getObject()->asServerObject()-> getObjVars().getItem(OBJVAR_CRAFTING_STATIONMOD, stationBonus); @@ -3436,11 +3436,11 @@ void TangibleObject::clearCraftingManufactureSchematic(void) } // get our ui - CraftingToolSyncUi * sync = NULL; - if (getSynchronizedUi() != NULL) + CraftingToolSyncUi * sync = nullptr; + if (getSynchronizedUi() != nullptr) sync = dynamic_cast(getSynchronizedUi()); - if (schematicId == CachedNetworkId::cms_cachedInvalid && sync == NULL) + if (schematicId == CachedNetworkId::cms_cachedInvalid && sync == nullptr) { // no schematic return; @@ -3448,7 +3448,7 @@ void TangibleObject::clearCraftingManufactureSchematic(void) if (schematicId == CachedNetworkId::cms_invalid) schematicId = sync->getManfSchematic(); - else if (sync != NULL && sync->getManfSchematic() != CachedNetworkId::cms_invalid && + else if (sync != nullptr && sync->getManfSchematic() != CachedNetworkId::cms_invalid && schematicId != sync->getManfSchematic()) { WARNING(true, ("TangibleObject::clearCraftingManufactureSchematic " @@ -3456,7 +3456,7 @@ void TangibleObject::clearCraftingManufactureSchematic(void) "in its ui!!!", getNetworkId().getValueString().c_str(), schematicId.getValueString().c_str(), sync->getManfSchematic().getValueString().c_str())); - if (schematicId.getObject() != NULL) + if (schematicId.getObject() != nullptr) { schematicId.getObject()->asServerObject()->permanentlyDestroy( DeleteReasons::Consumed); @@ -3472,9 +3472,9 @@ void TangibleObject::clearCraftingManufactureSchematic(void) } // get the schematic - ManufactureSchematicObject * manfSchematic = NULL; + ManufactureSchematicObject * manfSchematic = nullptr; ServerObject * object = safe_cast(schematicId.getObject()); - if (object == NULL && schematicId != CachedNetworkId::cms_invalid) + if (object == nullptr && schematicId != CachedNetworkId::cms_invalid) { WARNING_STRICT_FATAL(true, ("Can't find object for manufactring schematic " "id %s", schematicId.getValueString().c_str())); @@ -3482,7 +3482,7 @@ void TangibleObject::clearCraftingManufactureSchematic(void) else manfSchematic = safe_cast(object); - if (manfSchematic != NULL) + if (manfSchematic != nullptr) { NetworkId crafterId; if (getObjVars().getItem(OBJVAR_CRAFTING_CRAFTER,crafterId)) @@ -3492,7 +3492,7 @@ void TangibleObject::clearCraftingManufactureSchematic(void) // in the tool CreatureObject * const crafter = dynamic_cast(NetworkIdManager::getObjectById(crafterId)); PlayerObject * const crafterPlayer = PlayerCreatureController::getPlayerObject(crafter); - if (!manfSchematic->mustDestroyIngredients() || (crafterPlayer != NULL && + if (!manfSchematic->mustDestroyIngredients() || (crafterPlayer != nullptr && crafterPlayer->getCraftingStage() == Crafting::CS_assembly)) { crafterPlayer->setAllowEmptySlot(true); @@ -3526,9 +3526,9 @@ void TangibleObject::clearCraftingManufactureSchematic(void) } } - if (sync != NULL) + if (sync != nullptr) sync->setManfSchematic(CachedNetworkId::cms_cachedInvalid, CachedNetworkId::cms_cachedInvalid, true); - if (object != NULL) + if (object != nullptr) { object->permanentlyDestroy(DeleteReasons::Consumed); } @@ -3554,17 +3554,17 @@ ServerObject * TangibleObject::getCraftingPrototype(void) const UNREF(myIdString); // needed for release mode // make sure we are a crafting tool - if (!isCraftingTool() || getSynchronizedUi() == NULL) + if (!isCraftingTool() || getSynchronizedUi() == nullptr) { DEBUG_WARNING(true, ("Tried to get non-crafting tool " "object %s", myIdString)); - return NULL; + return nullptr; } const CraftingToolSyncUi * sync = dynamic_cast( getSynchronizedUi()); - if (sync == NULL) - return NULL; + if (sync == nullptr) + return nullptr; return safe_cast(sync->getPrototype().getObject()); } // TangibleObject::getCraftingPrototype @@ -3586,7 +3586,7 @@ void TangibleObject::setCraftingPrototype(ServerObject & prototype) UNREF(myIdString); // needed for release mode // make sure we are a crafting tool - if (!isCraftingTool() || getSynchronizedUi() == NULL) + if (!isCraftingTool() || getSynchronizedUi() == nullptr) { DEBUG_WARNING(true, ("Tried to get non-crafting tool " "object %s", myIdString)); @@ -3595,7 +3595,7 @@ void TangibleObject::setCraftingPrototype(ServerObject & prototype) CraftingToolSyncUi * sync = dynamic_cast( getSynchronizedUi()); - if (sync == NULL) + if (sync == nullptr) return; // see if there is already a prototype object set @@ -3605,7 +3605,7 @@ void TangibleObject::setCraftingPrototype(ServerObject & prototype) // remove the old prototype ServerObject * object = safe_cast(prototypeId.getObject()); - if (object == NULL) + if (object == nullptr) { if (prototypeId != NetworkId::cms_invalid) { @@ -3624,7 +3624,7 @@ void TangibleObject::setCraftingPrototype(ServerObject & prototype) // about it Container::ContainerErrorCode tmp = Container::CEC_Success; if (!ContainerInterface::transferItemToSlottedContainer(*this, prototype, - getCraftingPrototypeSlotId(), NULL, tmp)) + getCraftingPrototypeSlotId(), nullptr, tmp)) { // see if there is something in the slot, and delete it if there is bool failed = true; @@ -3634,13 +3634,13 @@ void TangibleObject::setCraftingPrototype(ServerObject & prototype) getCraftingPrototypeSlotId(), tmp); if (oldItem != prototype.getNetworkId()) { - if (oldItem.getObject() != NULL) + if (oldItem.getObject() != nullptr) { safe_cast(oldItem.getObject())->permanentlyDestroy( DeleteReasons::Consumed); // try the transfer again if (ContainerInterface::transferItemToSlottedContainer(*this, - prototype, getCraftingPrototypeSlotId(), NULL, tmp)) + prototype, getCraftingPrototypeSlotId(), nullptr, tmp)) { failed = false; } @@ -3678,7 +3678,7 @@ void TangibleObject::clearCraftingPrototype(void) UNREF(myIdString); // needed for release mode // make sure we are a crafting tool - if (!isCraftingTool() || getSynchronizedUi() == NULL) + if (!isCraftingTool() || getSynchronizedUi() == nullptr) { DEBUG_WARNING(true, ("Tried to get non-crafting tool " "object %s", myIdString)); @@ -3687,12 +3687,12 @@ void TangibleObject::clearCraftingPrototype(void) CraftingToolSyncUi * sync = dynamic_cast( getSynchronizedUi()); - if (sync == NULL) + if (sync == nullptr) return; const CachedNetworkId & prototypeId = sync->getPrototype(); ServerObject * object = safe_cast(prototypeId.getObject()); - if (object != NULL) + if (object != nullptr) { object->permanentlyDestroy(DeleteReasons::Consumed); } @@ -3704,7 +3704,7 @@ void TangibleObject::clearCraftingPrototype(void) Container::ContainerErrorCode error; const Container::ContainedItem & contents = container->getObjectInSlot( getCraftingPrototypeSlotId(), error); - if (contents.getObject() != NULL) + if (contents.getObject() != nullptr) { safe_cast(contents.getObject())->permanentlyDestroy( DeleteReasons::Consumed); @@ -3856,7 +3856,7 @@ void TangibleObject::forceExecuteCommand(Command const &command, NetworkId const { CommandQueue * const queue = getCommandQueue(); - if (queue != NULL) + if (queue != nullptr) { queue->cancelCurrentCommand(); } @@ -3948,7 +3948,7 @@ void TangibleObject::initializeVisibility() { const ServerTangibleObjectTemplate * myTemplate = safe_cast< const ServerTangibleObjectTemplate *>(getObjectTemplate()); - if (myTemplate != NULL) + if (myTemplate != nullptr) { bool visible = false; for (size_t i = 0; i < myTemplate->getVisibleFlagsCount(); ++i) @@ -3999,7 +3999,7 @@ void TangibleObject::visibilityDataModified() { // show the object const TriggerVolume * triggerVolume = getTriggerVolume(NetworkTriggerVolumeNamespace::NetworkTriggerVolumeName); - if (triggerVolume != NULL) + if (triggerVolume != nullptr) { std::vector observers; ServerWorld::findPlayerCreaturesInRange(getPosition_w(), triggerVolume->getRadius(), observers); @@ -4017,7 +4017,7 @@ void TangibleObject::visibilityDataModified() if (isVisible() && isHidden() && !m_passiveRevealPlayerCharacter.empty()) { const TriggerVolume * triggerVolume = getTriggerVolume(NetworkTriggerVolumeNamespace::NetworkTriggerVolumeName); - if (triggerVolume != NULL) + if (triggerVolume != nullptr) { std::vector possibleObservers; ServerWorld::findPlayerCreaturesInRange(getPosition_w(), triggerVolume->getRadius(), possibleObservers); @@ -4077,10 +4077,10 @@ bool TangibleObject::isVisibleOnClient(Client const &client) const // if the client's character is grouped with the the owner, then he can see it. const CreatureObject * owner = safe_cast(ownerId.getObject()); - if (owner != NULL) + if (owner != nullptr) { const GroupObject * group = owner->getGroup(); - if (group != NULL) + if (group != nullptr) { if (group->isGroupMember(characterObject->getNetworkId())) return true; @@ -4129,7 +4129,7 @@ static int datatable_max_encumbrance_col = -1; encumbrances.clear(); DataTable * dt = DataTableManager::getTable(DATATABLE_ARMOR, true); - if (dt == NULL) + if (dt == nullptr) return false; else if (datatable_type_col == -1) { @@ -4690,7 +4690,7 @@ void TangibleObject::getAttributesForCraftingTool (AttributeVector & data) const // see if there is an object in the output hopper bool hasPrototype = false; SlottedContainer const * const slotContainer = ContainerInterface::getSlottedContainer(*this); - if (slotContainer != NULL) + if (slotContainer != nullptr) { Container::ContainerErrorCode tmp = Container::CEC_Success; if (slotContainer->getObjectInSlot(outputSlotId, tmp) != Container::ContainedItem::cms_invalid) @@ -5121,7 +5121,7 @@ void TangibleObject::handleCMessageTo(const MessageToPayload &message) std::string const & sceneId = ServerWorld::getSceneId(); Vector const &position = findPosition_w(); Region const * const region = RegionMaster::getSmallestVisibleRegionAtPoint(sceneId, position.x, position.z); - if (region != NULL) + if (region != nullptr) regionName = Unicode::wideToNarrow(region->getName()); int const cityId = CityInterface::getCityAtLocation(sceneId, static_cast(position.x), static_cast(position.z), 0); @@ -5248,7 +5248,7 @@ void TangibleObject::setInvulnerable(bool invulnerable) GameScriptObject * const gameScriptObject = getScriptObject(); - if (gameScriptObject != NULL) + if (gameScriptObject != nullptr) { ScriptParams scriptParams; scriptParams.addParam(hasCondition(ServerTangibleObjectTemplate::C_invulnerable)); @@ -5451,8 +5451,8 @@ void TangibleObject::setPvpable(bool pvpable) if ((oldPvpable != pvpable) && !getObservers().empty()) { // did the object's "pvp sync" status change because of the Pvpable change? - bool const wasPvpSync = PvpUpdateObserver::satisfyPvpSyncCondition(!oldPvpable, hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (asCreatureObject() != NULL), getPvpFaction()); - bool const isPvpSync = PvpUpdateObserver::satisfyPvpSyncCondition(!pvpable, hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (asCreatureObject() != NULL), getPvpFaction()); + bool const wasPvpSync = PvpUpdateObserver::satisfyPvpSyncCondition(!oldPvpable, hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (asCreatureObject() != nullptr), getPvpFaction()); + bool const isPvpSync = PvpUpdateObserver::satisfyPvpSyncCondition(!pvpable, hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (asCreatureObject() != nullptr), getPvpFaction()); if (wasPvpSync != isPvpSync) { @@ -5557,8 +5557,8 @@ void TangibleObject::AppearanceDataCallback::modified(TangibleObject &target, co target.appearanceDataModified(value); Object * const objectContainer = ContainerInterface::getContainedByObject(target); - ServerObject * const serverContainer = objectContainer ? objectContainer->asServerObject() : NULL; - TangibleObject * const tangibleContainer = serverContainer ? serverContainer->asTangibleObject() : NULL; + ServerObject * const serverContainer = objectContainer ? objectContainer->asServerObject() : nullptr; + TangibleObject * const tangibleContainer = serverContainer ? serverContainer->asTangibleObject() : nullptr; if(tangibleContainer) tangibleContainer->onContainedItemAppearanceDataModified(target, oldValue, value); } @@ -5802,7 +5802,7 @@ void TangibleObject::commandQueueEnqueue(Command const &command, NetworkId const else { CommandQueue * const queue = getCommandQueue(); - if (queue != NULL) + if (queue != nullptr) { queue->enqueue(command, targetId, params, sequenceId, clearable, priority); } @@ -5820,7 +5820,7 @@ void TangibleObject::commandQueueRemove(uint32 const sequenceId) else { CommandQueue * const queue = getCommandQueue(); - if (queue != NULL) + if (queue != nullptr) { queue->remove(sequenceId); } @@ -5840,7 +5840,7 @@ void TangibleObject::commandQueueClear() bool TangibleObject::commandQueueHasCommandFromGroup(uint32 groupHash) const { CommandQueue * const queue = getCommandQueue(); - if (queue != NULL) + if (queue != nullptr) { return queue->hasCommandFromGroup(groupHash); } @@ -5852,7 +5852,7 @@ bool TangibleObject::commandQueueHasCommandFromGroup(uint32 groupHash) const void TangibleObject::commandQueueClearCommandsFromGroup(uint32 groupHash, bool force) { CommandQueue * const queue = getCommandQueue(); - if (queue != NULL) + if (queue != nullptr) { queue->clearCommandsFromGroup(groupHash, force); } @@ -5895,12 +5895,12 @@ void TangibleObject::CombatStateChangedCallback::modified(TangibleObject & targe AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(target.getController()); - if (aiCreatureController != NULL) + if (aiCreatureController != nullptr) { aiCreatureController->markCombatStartLocation(); } - if (target.getScriptObject() != NULL) + if (target.getScriptObject() != nullptr) { ScriptParams params; IGNORE_RETURN(target.getScriptObject()->trigAllScripts(Scripting::TRIG_ENTERED_COMBAT, params)); @@ -5926,7 +5926,7 @@ void TangibleObject::CombatStateChangedCallback::modified(TangibleObject & targe target.commandQueueClearCommandsFromGroup(COMMAND_GROUP_COMBAT.getCrc()); - if (target.getScriptObject() != NULL) + if (target.getScriptObject() != nullptr) { ScriptParams params; IGNORE_RETURN(target.getScriptObject()->trigAllScripts(Scripting::TRIG_EXITED_COMBAT, params)); @@ -5985,7 +5985,7 @@ int TangibleObject::getPassiveRevealRange(NetworkId const & target) const void TangibleObject::addPassiveReveal(TangibleObject const & target, int range) { - addPassiveReveal(target.getNetworkId(), range, (NULL != PlayerCreatureController::getPlayerObject(target.asCreatureObject()))); + addPassiveReveal(target.getNetworkId(), range, (nullptr != PlayerCreatureController::getPlayerObject(target.asCreatureObject()))); } //---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/object/TangibleObject.h b/engine/server/library/serverGame/src/shared/object/TangibleObject.h index c05f93bf..f4b80817 100755 --- a/engine/server/library/serverGame/src/shared/object/TangibleObject.h +++ b/engine/server/library/serverGame/src/shared/object/TangibleObject.h @@ -777,7 +777,7 @@ inline uint32 TangibleObject::getSourceDraftSchematic() const inline void TangibleObject::createCombatData() { - if (m_combatData == NULL) + if (m_combatData == nullptr) { m_combatData = new CombatEngineData::CombatData; } diff --git a/engine/server/library/serverGame/src/shared/object/TangibleObject_Conversation.cpp b/engine/server/library/serverGame/src/shared/object/TangibleObject_Conversation.cpp index 7f7aafe5..fbf7881e 100755 --- a/engine/server/library/serverGame/src/shared/object/TangibleObject_Conversation.cpp +++ b/engine/server/library/serverGame/src/shared/object/TangibleObject_Conversation.cpp @@ -47,7 +47,7 @@ bool TangibleObject::startNpcConversation(TangibleObject & npc, const std::strin return false; // test if already in a conversation - if (m_npcConversation != NULL) + if (m_npcConversation != nullptr) return false; if (starter == NpcConversationData::CS_Player) @@ -120,7 +120,7 @@ void TangibleObject::endNpcConversation() { if (isAuthoritative()) { - if (m_npcConversation != NULL) + if (m_npcConversation != nullptr) { // I am a player, end my conversation @@ -128,7 +128,7 @@ void TangibleObject::endNpcConversation() if (isPlayerControlled()) { TangibleObject * const npc = safe_cast(m_npcConversation->getNPC().getObject()); - if (npc != NULL) + if (npc != nullptr) { // trigger OnEndNpcConversation ScriptParams params; @@ -157,13 +157,13 @@ void TangibleObject::endNpcConversation() } else { - WARNING(true,("TangibleObject::endNpcConversation: creature %s has a non-null m_npcConversation pointer %p but is not a player-controlled object!", + WARNING(true,("TangibleObject::endNpcConversation: creature %s has a non-nullptr m_npcConversation pointer %p but is not a player-controlled object!", getNetworkId().getValueString().c_str(), m_npcConversation)); m_conversations.clear(); } delete m_npcConversation; - m_npcConversation = NULL; + m_npcConversation = nullptr; } else { @@ -182,14 +182,14 @@ void TangibleObject::endNpcConversation() { NetworkId const & networkId = *it; TangibleObject * const player = dynamic_cast(NetworkIdManager::getObjectById(networkId)); - if (player != NULL) + if (player != nullptr) player->endNpcConversation(); } } } else { - WARNING(true,("TangibleObject::endNpcConversation: creature %s has a null m_npcConversation pointer but is a player-controlled object!", + WARNING(true,("TangibleObject::endNpcConversation: creature %s has a nullptr m_npcConversation pointer but is a player-controlled object!", getNetworkId().getValueString().c_str())); m_conversations.clear(); } @@ -217,7 +217,7 @@ void TangibleObject::endNpcConversation() */ void TangibleObject::clearNpcConversation() { - if (m_npcConversation != NULL) + if (m_npcConversation != nullptr) { m_npcConversation->clearResponses(); } @@ -234,7 +234,7 @@ void TangibleObject::sendNpcConversationMessage(const StringId & stringId, const { if (isAuthoritative()) { - if (m_npcConversation != NULL) + if (m_npcConversation != nullptr) { NpcConversation::Response response; response.stringId = stringId; @@ -262,7 +262,7 @@ bool TangibleObject::addNpcConversationResponse(const StringId & stringId, const { if (isAuthoritative()) { - if (m_npcConversation != NULL) + if (m_npcConversation != nullptr) { NpcConversation::Response response; response.stringId = stringId; @@ -293,7 +293,7 @@ bool TangibleObject::removeNpcConversationResponse(const StringId & stringId, co bool result = false; if (isAuthoritative()) { - if (m_npcConversation != NULL) + if (m_npcConversation != nullptr) { NpcConversation::Response response; response.stringId = stringId; @@ -319,7 +319,7 @@ void TangibleObject::sendNpcConversationResponses() { if (isAuthoritative()) { - if (m_npcConversation != NULL) + if (m_npcConversation != nullptr) { m_npcConversation->sendResponses(); } @@ -327,7 +327,7 @@ void TangibleObject::sendNpcConversationResponses() else { Controller * const controller = NON_NULL(getController()); - controller->appendMessage(CM_sendNpcConversationResponses, 0.0f, NULL, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_SERVER); + controller->appendMessage(CM_sendNpcConversationResponses, 0.0f, nullptr, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_SERVER); } } @@ -342,10 +342,10 @@ void TangibleObject::respondToNpc(int responseIndex) { if (isAuthoritative()) { - if (m_npcConversation != NULL) + if (m_npcConversation != nullptr) { TangibleObject * const npc = safe_cast(m_npcConversation->getNPC().getObject()); - if (npc == NULL) + if (npc == nullptr) { endNpcConversation(); return; @@ -363,7 +363,7 @@ void TangibleObject::respondToNpc(int responseIndex) { Controller * const controller = getController(); if (controller) - controller->appendMessage(CM_npcConversationSelect, static_cast(responseIndex), NULL, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_SERVER); + controller->appendMessage(CM_npcConversationSelect, static_cast(responseIndex), nullptr, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_SERVER); } } @@ -374,7 +374,7 @@ void TangibleObject::handlePlayerResponseToNpcConversation(const std::string & c if (isAuthoritative()) { TangibleObject * const playerObject = safe_cast(NetworkIdManager::getObjectById(player)); - if (playerObject != NULL) + if (playerObject != nullptr) { // trigger OnNpcConversationResponse ScriptParams params; diff --git a/engine/server/library/serverGame/src/shared/object/UniverseObject.cpp b/engine/server/library/serverGame/src/shared/object/UniverseObject.cpp index 6b283f5e..6e6b8d6c 100755 --- a/engine/server/library/serverGame/src/shared/object/UniverseObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/UniverseObject.cpp @@ -20,7 +20,7 @@ // objvars for dynamic regions const static std::string OBJVAR_DYNAMIC_REGION("dynamic_region"); -const SharedObjectTemplate * UniverseObject::m_defaultSharedTemplate = NULL; +const SharedObjectTemplate * UniverseObject::m_defaultSharedTemplate = nullptr; // ====================================================================== @@ -56,13 +56,13 @@ const SharedObjectTemplate * UniverseObject::getDefaultSharedTemplate(void) cons { static const ConstCharCrcLowerString templateName("object/universe/base/shared_universe_default.iff"); - if (m_defaultSharedTemplate == NULL) + if (m_defaultSharedTemplate == nullptr) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create " + WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create " "default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) ExitChain::add (removeDefaultTemplate, "UniverseObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -75,10 +75,10 @@ static const ConstCharCrcLowerString templateName("object/universe/base/shared_u */ void UniverseObject::removeDefaultTemplate(void) { - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } // UniverseObject::removeDefaultTemplate diff --git a/engine/server/library/serverGame/src/shared/object/WeaponObject.cpp b/engine/server/library/serverGame/src/shared/object/WeaponObject.cpp index 320d0c0b..b19b7cfb 100755 --- a/engine/server/library/serverGame/src/shared/object/WeaponObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/WeaponObject.cpp @@ -25,7 +25,7 @@ //---------------------------------------------------------------------- -const SharedObjectTemplate * WeaponObject::m_defaultSharedTemplate = NULL; +const SharedObjectTemplate * WeaponObject::m_defaultSharedTemplate = nullptr; static const std::string OBJVAR_CERTIFICATION = "weapon.strCertUsed"; @@ -68,13 +68,13 @@ const SharedObjectTemplate * WeaponObject::getDefaultSharedTemplate(void) const { static const ConstCharCrcLowerString templateName("object/weapon/base/shared_weapon_default.iff"); - if (m_defaultSharedTemplate == NULL) + if (m_defaultSharedTemplate == nullptr) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create " + WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create " "default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) ExitChain::add (removeDefaultTemplate, "WeaponObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -87,10 +87,10 @@ static const ConstCharCrcLowerString templateName("object/weapon/base/shared_wea */ void WeaponObject::removeDefaultTemplate(void) { - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } // WeaponObject::removeDefaultTemplate @@ -323,7 +323,7 @@ WeaponObject * WeaponObject::getWeaponObject(NetworkId const & networkId) { ServerObject * serverObject = ServerObject::getServerObject(networkId); - return (serverObject != NULL) ? serverObject->asWeaponObject() : NULL; + return (serverObject != nullptr) ? serverObject->asWeaponObject() : nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerArmorTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerArmorTemplate.cpp index a387b645..2e429325 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerArmorTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerArmorTemplate.cpp @@ -53,7 +53,7 @@ ServerArmorTemplate::~ServerArmorTemplate() for (iter = m_specialProtection.begin(); iter != m_specialProtection.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_specialProtection.clear(); } @@ -105,10 +105,10 @@ Tag ServerArmorTemplate::getTemplateVersion(void) const */ Tag ServerArmorTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerArmorTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerArmorTemplate::getHighestTemplateVersion @@ -122,33 +122,33 @@ ServerArmorTemplate::ArmorRating testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getRating(true); #endif } if (!m_rating.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter rating in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter rating has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter rating has not been defined in template %s!", DataResource::getName())); return base->getRating(); } } ArmorRating value = static_cast(m_rating.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -164,26 +164,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerArmorTemplate * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getIntegrity(true); #endif } if (!m_integrity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter integrity in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter integrity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter integrity has not been defined in template %s!", DataResource::getName())); return base->getIntegrity(); } } @@ -193,9 +193,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getIntegrity(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -212,7 +212,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -228,26 +228,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerArmorTemplate * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getIntegrityMin(true); #endif } if (!m_integrity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter integrity in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter integrity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter integrity has not been defined in template %s!", DataResource::getName())); return base->getIntegrityMin(); } } @@ -257,9 +257,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getIntegrityMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -276,7 +276,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -292,26 +292,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerArmorTemplate * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getIntegrityMax(true); #endif } if (!m_integrity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter integrity in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter integrity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter integrity has not been defined in template %s!", DataResource::getName())); return base->getIntegrityMax(); } } @@ -321,9 +321,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getIntegrityMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -340,7 +340,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -356,26 +356,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerArmorTemplate * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getEffectiveness(true); #endif } if (!m_effectiveness.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter effectiveness in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter effectiveness has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter effectiveness has not been defined in template %s!", DataResource::getName())); return base->getEffectiveness(); } } @@ -385,9 +385,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getEffectiveness(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -404,7 +404,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -420,26 +420,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerArmorTemplate * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getEffectivenessMin(true); #endif } if (!m_effectiveness.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter effectiveness in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter effectiveness has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter effectiveness has not been defined in template %s!", DataResource::getName())); return base->getEffectivenessMin(); } } @@ -449,9 +449,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getEffectivenessMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -468,7 +468,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -484,26 +484,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerArmorTemplate * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getEffectivenessMax(true); #endif } if (!m_effectiveness.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter effectiveness in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter effectiveness has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter effectiveness has not been defined in template %s!", DataResource::getName())); return base->getEffectivenessMax(); } } @@ -513,9 +513,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getEffectivenessMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -532,7 +532,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -542,28 +542,28 @@ UNREF(testData); void ServerArmorTemplate::getSpecialProtection(SpecialProtection &data, int index) const { - const ServerArmorTemplate * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_specialProtectionLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter specialProtection in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter specialProtection has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter specialProtection has not been defined in template %s!", DataResource::getName())); base->getSpecialProtection(data, index); return; } } - if (m_specialProtectionAppend && base != NULL) + if (m_specialProtectionAppend && base != nullptr) { int baseCount = base->getSpecialProtectionCount(); if (index < baseCount) @@ -585,28 +585,28 @@ void ServerArmorTemplate::getSpecialProtection(SpecialProtection &data, int inde void ServerArmorTemplate::getSpecialProtectionMin(SpecialProtection &data, int index) const { - const ServerArmorTemplate * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_specialProtectionLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter specialProtection in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter specialProtection has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter specialProtection has not been defined in template %s!", DataResource::getName())); base->getSpecialProtectionMin(data, index); return; } } - if (m_specialProtectionAppend && base != NULL) + if (m_specialProtectionAppend && base != nullptr) { int baseCount = base->getSpecialProtectionCount(); if (index < baseCount) @@ -628,28 +628,28 @@ void ServerArmorTemplate::getSpecialProtectionMin(SpecialProtection &data, int i void ServerArmorTemplate::getSpecialProtectionMax(SpecialProtection &data, int index) const { - const ServerArmorTemplate * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_specialProtectionLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter specialProtection in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter specialProtection has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter specialProtection has not been defined in template %s!", DataResource::getName())); base->getSpecialProtectionMax(data, index); return; } } - if (m_specialProtectionAppend && base != NULL) + if (m_specialProtectionAppend && base != nullptr) { int baseCount = base->getSpecialProtectionCount(); if (index < baseCount) @@ -673,20 +673,20 @@ size_t ServerArmorTemplate::getSpecialProtectionCount(void) const { if (!m_specialProtectionLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const ServerArmorTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getSpecialProtectionCount(); } size_t count = m_specialProtection.size(); // if we are extending our base template, add it's count - if (m_specialProtectionAppend && m_baseData != NULL) + if (m_specialProtectionAppend && m_baseData != nullptr) { const ServerArmorTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getSpecialProtectionCount(); } @@ -701,26 +701,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerArmorTemplate * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getVulnerability(true); #endif } if (!m_vulnerability.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter vulnerability in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter vulnerability has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter vulnerability has not been defined in template %s!", DataResource::getName())); return base->getVulnerability(); } } @@ -730,9 +730,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getVulnerability(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -749,7 +749,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -765,26 +765,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerArmorTemplate * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getVulnerabilityMin(true); #endif } if (!m_vulnerability.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter vulnerability in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter vulnerability has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter vulnerability has not been defined in template %s!", DataResource::getName())); return base->getVulnerabilityMin(); } } @@ -794,9 +794,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getVulnerabilityMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -813,7 +813,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -829,26 +829,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerArmorTemplate * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getVulnerabilityMax(true); #endif } if (!m_vulnerability.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter vulnerability in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter vulnerability has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter vulnerability has not been defined in template %s!", DataResource::getName())); return base->getVulnerabilityMax(); } } @@ -858,9 +858,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getVulnerabilityMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -877,7 +877,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -887,8 +887,8 @@ UNREF(testData); int ServerArmorTemplate::getEncumbrance(int index) const { - const ServerArmorTemplate * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -896,14 +896,14 @@ int ServerArmorTemplate::getEncumbrance(int index) const DEBUG_FATAL(index < 0 || index >= 3, ("template param index out of range")); if (!m_encumbrance[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter encumbrance in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter encumbrance has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter encumbrance has not been defined in template %s!", DataResource::getName())); return base->getEncumbrance(index); } } @@ -913,9 +913,9 @@ int ServerArmorTemplate::getEncumbrance(int index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getEncumbrance(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -936,8 +936,8 @@ int ServerArmorTemplate::getEncumbrance(int index) const int ServerArmorTemplate::getEncumbranceMin(int index) const { - const ServerArmorTemplate * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -945,14 +945,14 @@ int ServerArmorTemplate::getEncumbranceMin(int index) const DEBUG_FATAL(index < 0 || index >= 3, ("template param index out of range")); if (!m_encumbrance[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter encumbrance in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter encumbrance has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter encumbrance has not been defined in template %s!", DataResource::getName())); return base->getEncumbranceMin(index); } } @@ -962,9 +962,9 @@ int ServerArmorTemplate::getEncumbranceMin(int index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getEncumbranceMin(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -985,8 +985,8 @@ int ServerArmorTemplate::getEncumbranceMin(int index) const int ServerArmorTemplate::getEncumbranceMax(int index) const { - const ServerArmorTemplate * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -994,14 +994,14 @@ int ServerArmorTemplate::getEncumbranceMax(int index) const DEBUG_FATAL(index < 0 || index >= 3, ("template param index out of range")); if (!m_encumbrance[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter encumbrance in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter encumbrance has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter encumbrance has not been defined in template %s!", DataResource::getName())); return base->getEncumbranceMax(index); } } @@ -1011,9 +1011,9 @@ int ServerArmorTemplate::getEncumbranceMax(int index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getEncumbranceMax(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1074,12 +1074,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -1114,7 +1114,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_specialProtection.begin(); iter != m_specialProtection.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_specialProtection.clear(); m_specialProtectionAppend = file.read_bool8(); @@ -1205,33 +1205,33 @@ ServerArmorTemplate::DamageType testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getType(true); #endif } if (!m_type.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter type in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter type has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter type has not been defined in template %s!", DataResource::getName())); return base->getType(versionOk); } } DamageType value = static_cast(m_type.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1247,26 +1247,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerArmorTemplate::_SpecialProtection * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate::_SpecialProtection * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getEffectiveness(true); #endif } if (!m_effectiveness.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter effectiveness in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter effectiveness has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter effectiveness has not been defined in template %s!", DataResource::getName())); return base->getEffectiveness(versionOk); } } @@ -1276,9 +1276,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getEffectiveness(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1295,7 +1295,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1311,26 +1311,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerArmorTemplate::_SpecialProtection * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate::_SpecialProtection * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getEffectivenessMin(true); #endif } if (!m_effectiveness.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter effectiveness in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter effectiveness has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter effectiveness has not been defined in template %s!", DataResource::getName())); return base->getEffectivenessMin(versionOk); } } @@ -1340,9 +1340,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getEffectivenessMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1359,7 +1359,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1375,26 +1375,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerArmorTemplate::_SpecialProtection * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate::_SpecialProtection * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getEffectivenessMax(true); #endif } if (!m_effectiveness.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter effectiveness in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter effectiveness has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter effectiveness has not been defined in template %s!", DataResource::getName())); return base->getEffectivenessMax(versionOk); } } @@ -1404,9 +1404,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getEffectivenessMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1423,7 +1423,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerBattlefieldMarkerObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerBattlefieldMarkerObjectTemplate.cpp index 98360e9b..0a63ff2d 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerBattlefieldMarkerObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerBattlefieldMarkerObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag ServerBattlefieldMarkerObjectTemplate::getTemplateVersion(void) const */ Tag ServerBattlefieldMarkerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerBattlefieldMarkerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerBattlefieldMarkerObjectTemplate::getHighestTemplateVersion @@ -150,12 +150,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerBuildingObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerBuildingObjectTemplate.cpp index 57086652..57d3ab90 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerBuildingObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerBuildingObjectTemplate.cpp @@ -93,10 +93,10 @@ Tag ServerBuildingObjectTemplate::getTemplateVersion(void) const */ Tag ServerBuildingObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerBuildingObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerBuildingObjectTemplate::getHighestTemplateVersion @@ -120,26 +120,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerBuildingObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerBuildingObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaintenanceCost(true); #endif } if (!m_maintenanceCost.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maintenanceCost in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maintenanceCost has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maintenanceCost has not been defined in template %s!", DataResource::getName())); return base->getMaintenanceCost(); } } @@ -149,9 +149,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaintenanceCost(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -168,7 +168,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -184,26 +184,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerBuildingObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerBuildingObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaintenanceCostMin(true); #endif } if (!m_maintenanceCost.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maintenanceCost in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maintenanceCost has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maintenanceCost has not been defined in template %s!", DataResource::getName())); return base->getMaintenanceCostMin(); } } @@ -213,9 +213,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaintenanceCostMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -232,7 +232,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -248,26 +248,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerBuildingObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerBuildingObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaintenanceCostMax(true); #endif } if (!m_maintenanceCost.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maintenanceCost in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maintenanceCost has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maintenanceCost has not been defined in template %s!", DataResource::getName())); return base->getMaintenanceCostMax(); } } @@ -277,9 +277,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaintenanceCostMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -296,7 +296,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -312,33 +312,33 @@ bool testDataValue = false; UNREF(testData); #endif - const ServerBuildingObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerBuildingObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getIsPublic(true); #endif } if (!m_isPublic.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter isPublic in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter isPublic has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter isPublic has not been defined in template %s!", DataResource::getName())); return base->getIsPublic(); } } bool value = m_isPublic.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -386,12 +386,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerCellObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerCellObjectTemplate.cpp index 5a35a6f9..0c39dc7c 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerCellObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerCellObjectTemplate.cpp @@ -99,10 +99,10 @@ Tag ServerCellObjectTemplate::getTemplateVersion(void) const */ Tag ServerCellObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerCellObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerCellObjectTemplate::getHighestTemplateVersion @@ -155,12 +155,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerCityObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerCityObjectTemplate.cpp index 0b59a960..0f328d56 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerCityObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerCityObjectTemplate.cpp @@ -95,10 +95,10 @@ Tag ServerCityObjectTemplate::getTemplateVersion(void) const */ Tag ServerCityObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerCityObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerCityObjectTemplate::getHighestTemplateVersion @@ -151,12 +151,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerConstructionContractObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerConstructionContractObjectTemplate.cpp index 6daeee45..ba882146 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerConstructionContractObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerConstructionContractObjectTemplate.cpp @@ -84,10 +84,10 @@ Tag ServerConstructionContractObjectTemplate::getTemplateVersion(void) const */ Tag ServerConstructionContractObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerConstructionContractObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerConstructionContractObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerCreatureObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerCreatureObjectTemplate.cpp index babf8d0a..f1be807d 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerCreatureObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerCreatureObjectTemplate.cpp @@ -56,7 +56,7 @@ ServerCreatureObjectTemplate::~ServerCreatureObjectTemplate() for (iter = m_attribMods.begin(); iter != m_attribMods.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_attribMods.clear(); } @@ -108,10 +108,10 @@ Tag ServerCreatureObjectTemplate::getTemplateVersion(void) const */ Tag ServerCreatureObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerCreatureObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerCreatureObjectTemplate::getHighestTemplateVersion @@ -129,32 +129,32 @@ Object * ServerCreatureObjectTemplate::createObject(void) const //@BEGIN TFD const ServerWeaponObjectTemplate * ServerCreatureObjectTemplate::getDefaultWeapon() const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_defaultWeapon.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter defaultWeapon in template %s", DataResource::getName())); - return NULL; + return nullptr; } else { - DEBUG_FATAL(base == NULL, ("Template parameter defaultWeapon has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter defaultWeapon has not been defined in template %s!", DataResource::getName())); return base->getDefaultWeapon(); } } - const ServerWeaponObjectTemplate * returnValue = NULL; + const ServerWeaponObjectTemplate * returnValue = nullptr; const std::string & templateName = m_defaultWeapon.getValue(); if (!templateName.empty()) { returnValue = dynamic_cast(ObjectTemplateList::fetch(templateName)); - if (returnValue == NULL) + if (returnValue == nullptr) WARNING_STRICT_FATAL(true, ("Error loading template %s",templateName.c_str())); } return returnValue; @@ -162,8 +162,8 @@ const ServerWeaponObjectTemplate * ServerCreatureObjectTemplate::getDefaultWeapo int ServerCreatureObjectTemplate::getAttributes(Attributes index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -171,14 +171,14 @@ int ServerCreatureObjectTemplate::getAttributes(Attributes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 6, ("template param static_cast(index) getAttributes(index); } } @@ -188,9 +188,9 @@ int ServerCreatureObjectTemplate::getAttributes(Attributes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAttributes(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -211,8 +211,8 @@ int ServerCreatureObjectTemplate::getAttributes(Attributes index) const int ServerCreatureObjectTemplate::getAttributesMin(Attributes index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -220,14 +220,14 @@ int ServerCreatureObjectTemplate::getAttributesMin(Attributes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 6, ("template param static_cast(index) getAttributesMin(index); } } @@ -237,9 +237,9 @@ int ServerCreatureObjectTemplate::getAttributesMin(Attributes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAttributesMin(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -260,8 +260,8 @@ int ServerCreatureObjectTemplate::getAttributesMin(Attributes index) const int ServerCreatureObjectTemplate::getAttributesMax(Attributes index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -269,14 +269,14 @@ int ServerCreatureObjectTemplate::getAttributesMax(Attributes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 6, ("template param static_cast(index) getAttributesMax(index); } } @@ -286,9 +286,9 @@ int ServerCreatureObjectTemplate::getAttributesMax(Attributes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAttributesMax(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -309,8 +309,8 @@ int ServerCreatureObjectTemplate::getAttributesMax(Attributes index) const int ServerCreatureObjectTemplate::getMinAttributes(Attributes index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -318,14 +318,14 @@ int ServerCreatureObjectTemplate::getMinAttributes(Attributes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 6, ("template param static_cast(index) getMinAttributes(index); } } @@ -335,9 +335,9 @@ int ServerCreatureObjectTemplate::getMinAttributes(Attributes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinAttributes(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -358,8 +358,8 @@ int ServerCreatureObjectTemplate::getMinAttributes(Attributes index) const int ServerCreatureObjectTemplate::getMinAttributesMin(Attributes index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -367,14 +367,14 @@ int ServerCreatureObjectTemplate::getMinAttributesMin(Attributes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 6, ("template param static_cast(index) getMinAttributesMin(index); } } @@ -384,9 +384,9 @@ int ServerCreatureObjectTemplate::getMinAttributesMin(Attributes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinAttributesMin(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -407,8 +407,8 @@ int ServerCreatureObjectTemplate::getMinAttributesMin(Attributes index) const int ServerCreatureObjectTemplate::getMinAttributesMax(Attributes index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -416,14 +416,14 @@ int ServerCreatureObjectTemplate::getMinAttributesMax(Attributes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 6, ("template param static_cast(index) getMinAttributesMax(index); } } @@ -433,9 +433,9 @@ int ServerCreatureObjectTemplate::getMinAttributesMax(Attributes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinAttributesMax(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -456,8 +456,8 @@ int ServerCreatureObjectTemplate::getMinAttributesMax(Attributes index) const int ServerCreatureObjectTemplate::getMaxAttributes(Attributes index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -465,14 +465,14 @@ int ServerCreatureObjectTemplate::getMaxAttributes(Attributes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 6, ("template param static_cast(index) getMaxAttributes(index); } } @@ -482,9 +482,9 @@ int ServerCreatureObjectTemplate::getMaxAttributes(Attributes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxAttributes(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -505,8 +505,8 @@ int ServerCreatureObjectTemplate::getMaxAttributes(Attributes index) const int ServerCreatureObjectTemplate::getMaxAttributesMin(Attributes index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -514,14 +514,14 @@ int ServerCreatureObjectTemplate::getMaxAttributesMin(Attributes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 6, ("template param static_cast(index) getMaxAttributesMin(index); } } @@ -531,9 +531,9 @@ int ServerCreatureObjectTemplate::getMaxAttributesMin(Attributes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxAttributesMin(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -554,8 +554,8 @@ int ServerCreatureObjectTemplate::getMaxAttributesMin(Attributes index) const int ServerCreatureObjectTemplate::getMaxAttributesMax(Attributes index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -563,14 +563,14 @@ int ServerCreatureObjectTemplate::getMaxAttributesMax(Attributes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 6, ("template param static_cast(index) getMaxAttributesMax(index); } } @@ -580,9 +580,9 @@ int ServerCreatureObjectTemplate::getMaxAttributesMax(Attributes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxAttributesMax(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -609,26 +609,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMinDrainModifier(true); #endif } if (!m_minDrainModifier.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter minDrainModifier in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter minDrainModifier has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter minDrainModifier has not been defined in template %s!", DataResource::getName())); return base->getMinDrainModifier(); } } @@ -638,9 +638,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinDrainModifier(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -657,7 +657,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -673,26 +673,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMinDrainModifierMin(true); #endif } if (!m_minDrainModifier.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter minDrainModifier in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter minDrainModifier has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter minDrainModifier has not been defined in template %s!", DataResource::getName())); return base->getMinDrainModifierMin(); } } @@ -702,9 +702,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinDrainModifierMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -721,7 +721,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -737,26 +737,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMinDrainModifierMax(true); #endif } if (!m_minDrainModifier.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter minDrainModifier in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter minDrainModifier has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter minDrainModifier has not been defined in template %s!", DataResource::getName())); return base->getMinDrainModifierMax(); } } @@ -766,9 +766,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinDrainModifierMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -785,7 +785,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -801,26 +801,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxDrainModifier(true); #endif } if (!m_maxDrainModifier.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxDrainModifier in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxDrainModifier has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxDrainModifier has not been defined in template %s!", DataResource::getName())); return base->getMaxDrainModifier(); } } @@ -830,9 +830,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxDrainModifier(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -849,7 +849,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -865,26 +865,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxDrainModifierMin(true); #endif } if (!m_maxDrainModifier.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxDrainModifier in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxDrainModifier has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxDrainModifier has not been defined in template %s!", DataResource::getName())); return base->getMaxDrainModifierMin(); } } @@ -894,9 +894,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxDrainModifierMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -913,7 +913,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -929,26 +929,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxDrainModifierMax(true); #endif } if (!m_maxDrainModifier.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxDrainModifier in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxDrainModifier has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxDrainModifier has not been defined in template %s!", DataResource::getName())); return base->getMaxDrainModifierMax(); } } @@ -958,9 +958,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxDrainModifierMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -977,7 +977,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -993,26 +993,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMinFaucetModifier(true); #endif } if (!m_minFaucetModifier.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter minFaucetModifier in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter minFaucetModifier has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter minFaucetModifier has not been defined in template %s!", DataResource::getName())); return base->getMinFaucetModifier(); } } @@ -1022,9 +1022,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinFaucetModifier(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1041,7 +1041,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1057,26 +1057,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMinFaucetModifierMin(true); #endif } if (!m_minFaucetModifier.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter minFaucetModifier in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter minFaucetModifier has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter minFaucetModifier has not been defined in template %s!", DataResource::getName())); return base->getMinFaucetModifierMin(); } } @@ -1086,9 +1086,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinFaucetModifierMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1105,7 +1105,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1121,26 +1121,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMinFaucetModifierMax(true); #endif } if (!m_minFaucetModifier.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter minFaucetModifier in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter minFaucetModifier has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter minFaucetModifier has not been defined in template %s!", DataResource::getName())); return base->getMinFaucetModifierMax(); } } @@ -1150,9 +1150,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinFaucetModifierMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1169,7 +1169,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1185,26 +1185,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxFaucetModifier(true); #endif } if (!m_maxFaucetModifier.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxFaucetModifier in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxFaucetModifier has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxFaucetModifier has not been defined in template %s!", DataResource::getName())); return base->getMaxFaucetModifier(); } } @@ -1214,9 +1214,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxFaucetModifier(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1233,7 +1233,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1249,26 +1249,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxFaucetModifierMin(true); #endif } if (!m_maxFaucetModifier.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxFaucetModifier in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxFaucetModifier has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxFaucetModifier has not been defined in template %s!", DataResource::getName())); return base->getMaxFaucetModifierMin(); } } @@ -1278,9 +1278,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxFaucetModifierMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1297,7 +1297,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1313,26 +1313,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxFaucetModifierMax(true); #endif } if (!m_maxFaucetModifier.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxFaucetModifier in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxFaucetModifier has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxFaucetModifier has not been defined in template %s!", DataResource::getName())); return base->getMaxFaucetModifierMax(); } } @@ -1342,9 +1342,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxFaucetModifierMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1361,7 +1361,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1371,28 +1371,28 @@ UNREF(testData); void ServerCreatureObjectTemplate::getAttribMods(AttribMod &data, int index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_attribModsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attribMods in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter attribMods has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attribMods has not been defined in template %s!", DataResource::getName())); base->getAttribMods(data, index); return; } } - if (m_attribModsAppend && base != NULL) + if (m_attribModsAppend && base != nullptr) { int baseCount = base->getAttribModsCount(); if (static_cast(index) < baseCount) @@ -1417,28 +1417,28 @@ void ServerCreatureObjectTemplate::getAttribMods(AttribMod &data, int index) con void ServerCreatureObjectTemplate::getAttribModsMin(AttribMod &data, int index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_attribModsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attribMods in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter attribMods has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attribMods has not been defined in template %s!", DataResource::getName())); base->getAttribModsMin(data, index); return; } } - if (m_attribModsAppend && base != NULL) + if (m_attribModsAppend && base != nullptr) { int baseCount = base->getAttribModsCount(); if (static_cast(index) < baseCount) @@ -1463,28 +1463,28 @@ void ServerCreatureObjectTemplate::getAttribModsMin(AttribMod &data, int index) void ServerCreatureObjectTemplate::getAttribModsMax(AttribMod &data, int index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_attribModsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attribMods in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter attribMods has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attribMods has not been defined in template %s!", DataResource::getName())); base->getAttribModsMax(data, index); return; } } - if (m_attribModsAppend && base != NULL) + if (m_attribModsAppend && base != nullptr) { int baseCount = base->getAttribModsCount(); if (static_cast(index) < baseCount) @@ -1511,20 +1511,20 @@ size_t ServerCreatureObjectTemplate::getAttribModsCount(void) const { if (!m_attribModsLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const ServerCreatureObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getAttribModsCount(); } size_t count = m_attribMods.size(); // if we are extending our base template, add it's count - if (m_attribModsAppend && m_baseData != NULL) + if (m_attribModsAppend && m_baseData != nullptr) { const ServerCreatureObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getAttribModsCount(); } @@ -1539,26 +1539,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getShockWounds(true); #endif } if (!m_shockWounds.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter shockWounds in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter shockWounds has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter shockWounds has not been defined in template %s!", DataResource::getName())); return base->getShockWounds(); } } @@ -1568,9 +1568,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getShockWounds(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1587,7 +1587,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1603,26 +1603,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getShockWoundsMin(true); #endif } if (!m_shockWounds.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter shockWounds in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter shockWounds has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter shockWounds has not been defined in template %s!", DataResource::getName())); return base->getShockWoundsMin(); } } @@ -1632,9 +1632,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getShockWoundsMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1651,7 +1651,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1667,26 +1667,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getShockWoundsMax(true); #endif } if (!m_shockWounds.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter shockWounds in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter shockWounds has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter shockWounds has not been defined in template %s!", DataResource::getName())); return base->getShockWoundsMax(); } } @@ -1696,9 +1696,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getShockWoundsMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1715,7 +1715,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1731,33 +1731,33 @@ bool testDataValue = false; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCanCreateAvatar(true); #endif } if (!m_canCreateAvatar.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter canCreateAvatar in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter canCreateAvatar has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter canCreateAvatar has not been defined in template %s!", DataResource::getName())); return base->getCanCreateAvatar(); } } bool value = m_canCreateAvatar.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1773,33 +1773,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getNameGeneratorType(true); #endif } if (!m_nameGeneratorType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter nameGeneratorType in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter nameGeneratorType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter nameGeneratorType has not been defined in template %s!", DataResource::getName())); return base->getNameGeneratorType(); } } const std::string & value = m_nameGeneratorType.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1815,26 +1815,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getApproachTriggerRange(true); #endif } if (!m_approachTriggerRange.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter approachTriggerRange in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter approachTriggerRange has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter approachTriggerRange has not been defined in template %s!", DataResource::getName())); return base->getApproachTriggerRange(); } } @@ -1844,9 +1844,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getApproachTriggerRange(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1863,7 +1863,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1879,26 +1879,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getApproachTriggerRangeMin(true); #endif } if (!m_approachTriggerRange.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter approachTriggerRange in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter approachTriggerRange has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter approachTriggerRange has not been defined in template %s!", DataResource::getName())); return base->getApproachTriggerRangeMin(); } } @@ -1908,9 +1908,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getApproachTriggerRangeMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1927,7 +1927,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1943,26 +1943,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getApproachTriggerRangeMax(true); #endif } if (!m_approachTriggerRange.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter approachTriggerRange in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter approachTriggerRange has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter approachTriggerRange has not been defined in template %s!", DataResource::getName())); return base->getApproachTriggerRangeMax(); } } @@ -1972,9 +1972,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getApproachTriggerRangeMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1991,7 +1991,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2001,8 +2001,8 @@ UNREF(testData); float ServerCreatureObjectTemplate::getMaxMentalStates(MentalStates index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -2010,14 +2010,14 @@ float ServerCreatureObjectTemplate::getMaxMentalStates(MentalStates index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 4, ("template param static_cast(index) getMaxMentalStates(index); } } @@ -2027,9 +2027,9 @@ float ServerCreatureObjectTemplate::getMaxMentalStates(MentalStates index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxMentalStates(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2050,8 +2050,8 @@ float ServerCreatureObjectTemplate::getMaxMentalStates(MentalStates index) const float ServerCreatureObjectTemplate::getMaxMentalStatesMin(MentalStates index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -2059,14 +2059,14 @@ float ServerCreatureObjectTemplate::getMaxMentalStatesMin(MentalStates index) co DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 4, ("template param static_cast(index) getMaxMentalStatesMin(index); } } @@ -2076,9 +2076,9 @@ float ServerCreatureObjectTemplate::getMaxMentalStatesMin(MentalStates index) co if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxMentalStatesMin(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2099,8 +2099,8 @@ float ServerCreatureObjectTemplate::getMaxMentalStatesMin(MentalStates index) co float ServerCreatureObjectTemplate::getMaxMentalStatesMax(MentalStates index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -2108,14 +2108,14 @@ float ServerCreatureObjectTemplate::getMaxMentalStatesMax(MentalStates index) co DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 4, ("template param static_cast(index) getMaxMentalStatesMax(index); } } @@ -2125,9 +2125,9 @@ float ServerCreatureObjectTemplate::getMaxMentalStatesMax(MentalStates index) co if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxMentalStatesMax(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2148,8 +2148,8 @@ float ServerCreatureObjectTemplate::getMaxMentalStatesMax(MentalStates index) co float ServerCreatureObjectTemplate::getMentalStatesDecay(MentalStates index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -2157,14 +2157,14 @@ float ServerCreatureObjectTemplate::getMentalStatesDecay(MentalStates index) con DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 4, ("template param static_cast(index) getMentalStatesDecay(index); } } @@ -2174,9 +2174,9 @@ float ServerCreatureObjectTemplate::getMentalStatesDecay(MentalStates index) con if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMentalStatesDecay(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2197,8 +2197,8 @@ float ServerCreatureObjectTemplate::getMentalStatesDecay(MentalStates index) con float ServerCreatureObjectTemplate::getMentalStatesDecayMin(MentalStates index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -2206,14 +2206,14 @@ float ServerCreatureObjectTemplate::getMentalStatesDecayMin(MentalStates index) DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 4, ("template param static_cast(index) getMentalStatesDecayMin(index); } } @@ -2223,9 +2223,9 @@ float ServerCreatureObjectTemplate::getMentalStatesDecayMin(MentalStates index) if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMentalStatesDecayMin(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2246,8 +2246,8 @@ float ServerCreatureObjectTemplate::getMentalStatesDecayMin(MentalStates index) float ServerCreatureObjectTemplate::getMentalStatesDecayMax(MentalStates index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -2255,14 +2255,14 @@ float ServerCreatureObjectTemplate::getMentalStatesDecayMax(MentalStates index) DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 4, ("template param static_cast(index) getMentalStatesDecayMax(index); } } @@ -2272,9 +2272,9 @@ float ServerCreatureObjectTemplate::getMentalStatesDecayMax(MentalStates index) if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMentalStatesDecayMax(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2344,12 +2344,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -2430,7 +2430,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_attribMods.begin(); iter != m_attribMods.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_attribMods.clear(); m_attribModsAppend = file.read_bool8(); diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerDraftSchematicObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerDraftSchematicObjectTemplate.cpp index 6ed8a518..5cfd4169 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerDraftSchematicObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerDraftSchematicObjectTemplate.cpp @@ -58,7 +58,7 @@ ServerDraftSchematicObjectTemplate::~ServerDraftSchematicObjectTemplate() for (iter = m_slots.begin(); iter != m_slots.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_slots.clear(); } @@ -67,7 +67,7 @@ ServerDraftSchematicObjectTemplate::~ServerDraftSchematicObjectTemplate() for (iter = m_skillCommands.begin(); iter != m_skillCommands.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_skillCommands.clear(); } @@ -76,7 +76,7 @@ ServerDraftSchematicObjectTemplate::~ServerDraftSchematicObjectTemplate() for (iter = m_manufactureScripts.begin(); iter != m_manufactureScripts.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_manufactureScripts.clear(); } @@ -128,10 +128,10 @@ Tag ServerDraftSchematicObjectTemplate::getTemplateVersion(void) const */ Tag ServerDraftSchematicObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerDraftSchematicObjectTemplate::getHighestTemplateVersion @@ -152,7 +152,7 @@ Object * ServerDraftSchematicObjectTemplate::createObject(void) const WARNING(true, ("Trying to create a draft schematic %s outside the draft " "schematic factory!\n", getName())); - return NULL; + return nullptr; } // ServerDraftSchematicObjectTemplate::createObject /** @@ -188,33 +188,33 @@ ServerDraftSchematicObjectTemplate::CraftingType testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCategory(true); #endif } if (!m_category.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter category in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter category has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter category has not been defined in template %s!", DataResource::getName())); return base->getCategory(); } } CraftingType value = static_cast(m_category.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -224,86 +224,86 @@ UNREF(testData); const ServerObjectTemplate * ServerDraftSchematicObjectTemplate::getCraftedObjectTemplate() const { - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_craftedObjectTemplate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter craftedObjectTemplate in template %s", DataResource::getName())); - return NULL; + return nullptr; } else { - DEBUG_FATAL(base == NULL, ("Template parameter craftedObjectTemplate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter craftedObjectTemplate has not been defined in template %s!", DataResource::getName())); return base->getCraftedObjectTemplate(); } } const std::string & templateName = m_craftedObjectTemplate.getValue(); const ServerObjectTemplate * returnValue = dynamic_cast(ObjectTemplateList::fetch(templateName)); - if (returnValue == NULL) + if (returnValue == nullptr) WARNING_STRICT_FATAL(true, ("Error loading template %s",templateName.c_str())); return returnValue; } // ServerDraftSchematicObjectTemplate::getCraftedObjectTemplate const ServerFactoryObjectTemplate * ServerDraftSchematicObjectTemplate::getCrateObjectTemplate() const { - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_crateObjectTemplate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter crateObjectTemplate in template %s", DataResource::getName())); - return NULL; + return nullptr; } else { - DEBUG_FATAL(base == NULL, ("Template parameter crateObjectTemplate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter crateObjectTemplate has not been defined in template %s!", DataResource::getName())); return base->getCrateObjectTemplate(); } } const std::string & templateName = m_crateObjectTemplate.getValue(); const ServerFactoryObjectTemplate * returnValue = dynamic_cast(ObjectTemplateList::fetch(templateName)); - if (returnValue == NULL) + if (returnValue == nullptr) WARNING_STRICT_FATAL(true, ("Error loading template %s",templateName.c_str())); return returnValue; } // ServerDraftSchematicObjectTemplate::getCrateObjectTemplate void ServerDraftSchematicObjectTemplate::getSlots(IngredientSlot &data, int index) const { - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_slotsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slots in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slots has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slots has not been defined in template %s!", DataResource::getName())); base->getSlots(data, index); return; } } - if (m_slotsAppend && base != NULL) + if (m_slotsAppend && base != nullptr) { int baseCount = base->getSlotsCount(); if (index < baseCount) @@ -335,28 +335,28 @@ void ServerDraftSchematicObjectTemplate::getSlots(IngredientSlot &data, int inde void ServerDraftSchematicObjectTemplate::getSlotsMin(IngredientSlot &data, int index) const { - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_slotsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slots in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slots has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slots has not been defined in template %s!", DataResource::getName())); base->getSlotsMin(data, index); return; } } - if (m_slotsAppend && base != NULL) + if (m_slotsAppend && base != nullptr) { int baseCount = base->getSlotsCount(); if (index < baseCount) @@ -388,28 +388,28 @@ void ServerDraftSchematicObjectTemplate::getSlotsMin(IngredientSlot &data, int i void ServerDraftSchematicObjectTemplate::getSlotsMax(IngredientSlot &data, int index) const { - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_slotsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slots in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slots has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slots has not been defined in template %s!", DataResource::getName())); base->getSlotsMax(data, index); return; } } - if (m_slotsAppend && base != NULL) + if (m_slotsAppend && base != nullptr) { int baseCount = base->getSlotsCount(); if (index < baseCount) @@ -443,20 +443,20 @@ size_t ServerDraftSchematicObjectTemplate::getSlotsCount(void) const { if (!m_slotsLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const ServerDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getSlotsCount(); } size_t count = m_slots.size(); // if we are extending our base template, add it's count - if (m_slotsAppend && m_baseData != NULL) + if (m_slotsAppend && m_baseData != nullptr) { const ServerDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getSlotsCount(); } @@ -465,27 +465,27 @@ size_t ServerDraftSchematicObjectTemplate::getSlotsCount(void) const const std::string & ServerDraftSchematicObjectTemplate::getSkillCommands(int index) const { - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_skillCommandsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter skillCommands in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter skillCommands has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter skillCommands has not been defined in template %s!", DataResource::getName())); return base->getSkillCommands(index); } } - if (m_skillCommandsAppend && base != NULL) + if (m_skillCommandsAppend && base != nullptr) { int baseCount = base->getSkillCommandsCount(); if (index < baseCount) @@ -502,20 +502,20 @@ size_t ServerDraftSchematicObjectTemplate::getSkillCommandsCount(void) const { if (!m_skillCommandsLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const ServerDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getSkillCommandsCount(); } size_t count = m_skillCommands.size(); // if we are extending our base template, add it's count - if (m_skillCommandsAppend && m_baseData != NULL) + if (m_skillCommandsAppend && m_baseData != nullptr) { const ServerDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getSkillCommandsCount(); } @@ -530,33 +530,33 @@ bool testDataValue = false; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDestroyIngredients(true); #endif } if (!m_destroyIngredients.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter destroyIngredients in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter destroyIngredients has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter destroyIngredients has not been defined in template %s!", DataResource::getName())); return base->getDestroyIngredients(); } } bool value = m_destroyIngredients.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -566,27 +566,27 @@ UNREF(testData); const std::string & ServerDraftSchematicObjectTemplate::getManufactureScripts(int index) const { - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_manufactureScriptsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter manufactureScripts in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter manufactureScripts has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter manufactureScripts has not been defined in template %s!", DataResource::getName())); return base->getManufactureScripts(index); } } - if (m_manufactureScriptsAppend && base != NULL) + if (m_manufactureScriptsAppend && base != nullptr) { int baseCount = base->getManufactureScriptsCount(); if (index < baseCount) @@ -603,20 +603,20 @@ size_t ServerDraftSchematicObjectTemplate::getManufactureScriptsCount(void) cons { if (!m_manufactureScriptsLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const ServerDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getManufactureScriptsCount(); } size_t count = m_manufactureScripts.size(); // if we are extending our base template, add it's count - if (m_manufactureScriptsAppend && m_baseData != NULL) + if (m_manufactureScriptsAppend && m_baseData != nullptr) { const ServerDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getManufactureScriptsCount(); } @@ -631,26 +631,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getItemsPerContainer(true); #endif } if (!m_itemsPerContainer.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter itemsPerContainer in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter itemsPerContainer has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter itemsPerContainer has not been defined in template %s!", DataResource::getName())); return base->getItemsPerContainer(); } } @@ -660,9 +660,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getItemsPerContainer(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -679,7 +679,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -695,26 +695,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getItemsPerContainerMin(true); #endif } if (!m_itemsPerContainer.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter itemsPerContainer in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter itemsPerContainer has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter itemsPerContainer has not been defined in template %s!", DataResource::getName())); return base->getItemsPerContainerMin(); } } @@ -724,9 +724,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getItemsPerContainerMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -743,7 +743,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -759,26 +759,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getItemsPerContainerMax(true); #endif } if (!m_itemsPerContainer.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter itemsPerContainer in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter itemsPerContainer has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter itemsPerContainer has not been defined in template %s!", DataResource::getName())); return base->getItemsPerContainerMax(); } } @@ -788,9 +788,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getItemsPerContainerMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -807,7 +807,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -823,26 +823,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getManufactureTime(true); #endif } if (!m_manufactureTime.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter manufactureTime in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter manufactureTime has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter manufactureTime has not been defined in template %s!", DataResource::getName())); return base->getManufactureTime(); } } @@ -852,9 +852,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getManufactureTime(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -871,7 +871,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -887,26 +887,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getManufactureTimeMin(true); #endif } if (!m_manufactureTime.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter manufactureTime in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter manufactureTime has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter manufactureTime has not been defined in template %s!", DataResource::getName())); return base->getManufactureTimeMin(); } } @@ -916,9 +916,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getManufactureTimeMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -935,7 +935,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -951,26 +951,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getManufactureTimeMax(true); #endif } if (!m_manufactureTime.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter manufactureTime in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter manufactureTime has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter manufactureTime has not been defined in template %s!", DataResource::getName())); return base->getManufactureTimeMax(); } } @@ -980,9 +980,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getManufactureTimeMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -999,7 +999,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1015,26 +1015,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getPrototypeTime(true); #endif } if (!m_prototypeTime.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter prototypeTime in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter prototypeTime has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter prototypeTime has not been defined in template %s!", DataResource::getName())); return base->getPrototypeTime(); } } @@ -1044,9 +1044,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getPrototypeTime(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1063,7 +1063,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1079,26 +1079,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getPrototypeTimeMin(true); #endif } if (!m_prototypeTime.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter prototypeTime in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter prototypeTime has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter prototypeTime has not been defined in template %s!", DataResource::getName())); return base->getPrototypeTimeMin(); } } @@ -1108,9 +1108,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getPrototypeTimeMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1127,7 +1127,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1143,26 +1143,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getPrototypeTimeMax(true); #endif } if (!m_prototypeTime.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter prototypeTime in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter prototypeTime has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter prototypeTime has not been defined in template %s!", DataResource::getName())); return base->getPrototypeTimeMax(); } } @@ -1172,9 +1172,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getPrototypeTimeMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1191,7 +1191,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1244,12 +1244,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -1284,7 +1284,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_slots.begin(); iter != m_slots.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_slots.clear(); m_slotsAppend = file.read_bool8(); @@ -1303,7 +1303,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_skillCommands.begin(); iter != m_skillCommands.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_skillCommands.clear(); m_skillCommandsAppend = file.read_bool8(); @@ -1324,7 +1324,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_manufactureScripts.begin(); iter != m_manufactureScripts.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_manufactureScripts.clear(); m_manufactureScriptsAppend = file.read_bool8(); @@ -1376,7 +1376,7 @@ ServerDraftSchematicObjectTemplate::_IngredientSlot::~_IngredientSlot() for (iter = m_options.begin(); iter != m_options.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_options.clear(); } @@ -1418,33 +1418,33 @@ bool testDataValue = false; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getOptional(true); #endif } if (!m_optional.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter optional in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter optional has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter optional has not been defined in template %s!", DataResource::getName())); return base->getOptional(versionOk); } } bool value = m_optional.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1460,33 +1460,33 @@ StringId testDataValue = DefaultStringId; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getName(true); #endif } if (!m_name.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter name in template %s", DataResource::getName())); return DefaultStringId; } else { - DEBUG_FATAL(base == NULL, ("Template parameter name has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter name has not been defined in template %s!", DataResource::getName())); return base->getName(versionOk); } } const StringId value = m_name.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1496,28 +1496,28 @@ UNREF(testData); void ServerDraftSchematicObjectTemplate::_IngredientSlot::getOptions(Ingredient &data, int index, bool versionOk) const { - const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_optionsLoaded) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter options in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter options has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter options has not been defined in template %s!", DataResource::getName())); base->getOptions(data, index, versionOk); return; } } - if (m_optionsAppend && base != NULL) + if (m_optionsAppend && base != nullptr) { int baseCount = base->getOptionsCount(); if (index < baseCount) @@ -1547,28 +1547,28 @@ void ServerDraftSchematicObjectTemplate::_IngredientSlot::getOptions(Ingredient void ServerDraftSchematicObjectTemplate::_IngredientSlot::getOptionsMin(Ingredient &data, int index, bool versionOk) const { - const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_optionsLoaded) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter options in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter options has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter options has not been defined in template %s!", DataResource::getName())); base->getOptionsMin(data, index, versionOk); return; } } - if (m_optionsAppend && base != NULL) + if (m_optionsAppend && base != nullptr) { int baseCount = base->getOptionsCount(); if (index < baseCount) @@ -1598,28 +1598,28 @@ void ServerDraftSchematicObjectTemplate::_IngredientSlot::getOptionsMin(Ingredie void ServerDraftSchematicObjectTemplate::_IngredientSlot::getOptionsMax(Ingredient &data, int index, bool versionOk) const { - const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_optionsLoaded) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter options in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter options has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter options has not been defined in template %s!", DataResource::getName())); base->getOptionsMax(data, index, versionOk); return; } } - if (m_optionsAppend && base != NULL) + if (m_optionsAppend && base != nullptr) { int baseCount = base->getOptionsCount(); if (index < baseCount) @@ -1651,20 +1651,20 @@ size_t ServerDraftSchematicObjectTemplate::_IngredientSlot::getOptionsCount(void { if (!m_optionsLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getOptionsCount(); } size_t count = m_options.size(); // if we are extending our base template, add it's count - if (m_optionsAppend && m_baseData != NULL) + if (m_optionsAppend && m_baseData != nullptr) { const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getOptionsCount(); } @@ -1679,33 +1679,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getOptionalSkillCommand(true); #endif } if (!m_optionalSkillCommand.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter optionalSkillCommand in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter optionalSkillCommand has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter optionalSkillCommand has not been defined in template %s!", DataResource::getName())); return base->getOptionalSkillCommand(versionOk); } } const std::string & value = m_optionalSkillCommand.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1721,26 +1721,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getComplexity(true); #endif } if (!m_complexity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter complexity in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); return base->getComplexity(versionOk); } } @@ -1750,9 +1750,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getComplexity(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1769,7 +1769,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1785,26 +1785,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getComplexityMin(true); #endif } if (!m_complexity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter complexity in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); return base->getComplexityMin(versionOk); } } @@ -1814,9 +1814,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getComplexityMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1833,7 +1833,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1849,26 +1849,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getComplexityMax(true); #endif } if (!m_complexity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter complexity in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); return base->getComplexityMax(versionOk); } } @@ -1878,9 +1878,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getComplexityMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1897,7 +1897,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1913,33 +1913,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAppearance(true); #endif } if (!m_appearance.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter appearance in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter appearance has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter appearance has not been defined in template %s!", DataResource::getName())); return base->getAppearance(versionOk); } } const std::string & value = m_appearance.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1992,7 +1992,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_options.begin(); iter != m_options.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_options.clear(); m_optionsAppend = file.read_bool8(); diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerFactoryObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerFactoryObjectTemplate.cpp index 413f930b..21075a19 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerFactoryObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerFactoryObjectTemplate.cpp @@ -93,10 +93,10 @@ Tag ServerFactoryObjectTemplate::getTemplateVersion(void) const */ Tag ServerFactoryObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerFactoryObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerFactoryObjectTemplate::getHighestTemplateVersion @@ -149,12 +149,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerGroupObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerGroupObjectTemplate.cpp index 9f63f2db..d026ef4f 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerGroupObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerGroupObjectTemplate.cpp @@ -95,10 +95,10 @@ Tag ServerGroupObjectTemplate::getTemplateVersion(void) const */ Tag ServerGroupObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerGroupObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerGroupObjectTemplate::getHighestTemplateVersion @@ -151,12 +151,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerGuildObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerGuildObjectTemplate.cpp index 00d26b3f..d7a9bcef 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerGuildObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerGuildObjectTemplate.cpp @@ -95,10 +95,10 @@ Tag ServerGuildObjectTemplate::getTemplateVersion(void) const */ Tag ServerGuildObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerGuildObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerGuildObjectTemplate::getHighestTemplateVersion @@ -151,12 +151,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerHarvesterInstallationObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerHarvesterInstallationObjectTemplate.cpp index a226afb3..16bf4a31 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerHarvesterInstallationObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerHarvesterInstallationObjectTemplate.cpp @@ -93,10 +93,10 @@ Tag ServerHarvesterInstallationObjectTemplate::getTemplateVersion(void) const */ Tag ServerHarvesterInstallationObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerHarvesterInstallationObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerHarvesterInstallationObjectTemplate::getHighestTemplateVersion @@ -120,26 +120,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerHarvesterInstallationObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerHarvesterInstallationObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxExtractionRate(true); #endif } if (!m_maxExtractionRate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxExtractionRate in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxExtractionRate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxExtractionRate has not been defined in template %s!", DataResource::getName())); return base->getMaxExtractionRate(); } } @@ -149,9 +149,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxExtractionRate(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -168,7 +168,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -184,26 +184,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerHarvesterInstallationObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerHarvesterInstallationObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxExtractionRateMin(true); #endif } if (!m_maxExtractionRate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxExtractionRate in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxExtractionRate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxExtractionRate has not been defined in template %s!", DataResource::getName())); return base->getMaxExtractionRateMin(); } } @@ -213,9 +213,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxExtractionRateMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -232,7 +232,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -248,26 +248,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerHarvesterInstallationObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerHarvesterInstallationObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxExtractionRateMax(true); #endif } if (!m_maxExtractionRate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxExtractionRate in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxExtractionRate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxExtractionRate has not been defined in template %s!", DataResource::getName())); return base->getMaxExtractionRateMax(); } } @@ -277,9 +277,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxExtractionRateMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -296,7 +296,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -312,26 +312,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerHarvesterInstallationObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerHarvesterInstallationObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCurrentExtractionRate(true); #endif } if (!m_currentExtractionRate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter currentExtractionRate in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter currentExtractionRate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter currentExtractionRate has not been defined in template %s!", DataResource::getName())); return base->getCurrentExtractionRate(); } } @@ -341,9 +341,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCurrentExtractionRate(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -360,7 +360,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -376,26 +376,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerHarvesterInstallationObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerHarvesterInstallationObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCurrentExtractionRateMin(true); #endif } if (!m_currentExtractionRate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter currentExtractionRate in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter currentExtractionRate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter currentExtractionRate has not been defined in template %s!", DataResource::getName())); return base->getCurrentExtractionRateMin(); } } @@ -405,9 +405,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCurrentExtractionRateMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -424,7 +424,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -440,26 +440,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerHarvesterInstallationObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerHarvesterInstallationObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCurrentExtractionRateMax(true); #endif } if (!m_currentExtractionRate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter currentExtractionRate in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter currentExtractionRate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter currentExtractionRate has not been defined in template %s!", DataResource::getName())); return base->getCurrentExtractionRateMax(); } } @@ -469,9 +469,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCurrentExtractionRateMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -488,7 +488,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -504,26 +504,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerHarvesterInstallationObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerHarvesterInstallationObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxHopperSize(true); #endif } if (!m_maxHopperSize.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxHopperSize in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxHopperSize has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxHopperSize has not been defined in template %s!", DataResource::getName())); return base->getMaxHopperSize(); } } @@ -533,9 +533,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxHopperSize(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -552,7 +552,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -568,26 +568,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerHarvesterInstallationObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerHarvesterInstallationObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxHopperSizeMin(true); #endif } if (!m_maxHopperSize.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxHopperSize in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxHopperSize has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxHopperSize has not been defined in template %s!", DataResource::getName())); return base->getMaxHopperSizeMin(); } } @@ -597,9 +597,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxHopperSizeMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -616,7 +616,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -632,26 +632,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerHarvesterInstallationObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerHarvesterInstallationObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxHopperSizeMax(true); #endif } if (!m_maxHopperSize.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxHopperSize in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxHopperSize has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxHopperSize has not been defined in template %s!", DataResource::getName())); return base->getMaxHopperSizeMax(); } } @@ -661,9 +661,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxHopperSizeMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -680,7 +680,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -696,33 +696,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerHarvesterInstallationObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerHarvesterInstallationObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMasterClassName(true); #endif } if (!m_masterClassName.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter masterClassName in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter masterClassName has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter masterClassName has not been defined in template %s!", DataResource::getName())); return base->getMasterClassName(); } } const std::string & value = m_masterClassName.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -774,12 +774,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerInstallationObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerInstallationObjectTemplate.cpp index ad1661bb..8bb94ce5 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerInstallationObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerInstallationObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag ServerInstallationObjectTemplate::getTemplateVersion(void) const */ Tag ServerInstallationObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerInstallationObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerInstallationObjectTemplate::getHighestTemplateVersion @@ -150,12 +150,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerIntangibleObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerIntangibleObjectTemplate.cpp index 992bf06d..18cce6b3 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerIntangibleObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerIntangibleObjectTemplate.cpp @@ -93,10 +93,10 @@ Tag ServerIntangibleObjectTemplate::getTemplateVersion(void) const */ Tag ServerIntangibleObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerIntangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerIntangibleObjectTemplate::getHighestTemplateVersion @@ -120,26 +120,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerIntangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCount(true); #endif } if (!m_count.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter count in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter count has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter count has not been defined in template %s!", DataResource::getName())); return base->getCount(); } } @@ -149,9 +149,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCount(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -168,7 +168,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -184,26 +184,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerIntangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCountMin(true); #endif } if (!m_count.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter count in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter count has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter count has not been defined in template %s!", DataResource::getName())); return base->getCountMin(); } } @@ -213,9 +213,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCountMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -232,7 +232,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -248,26 +248,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerIntangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCountMax(true); #endif } if (!m_count.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter count in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter count has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter count has not been defined in template %s!", DataResource::getName())); return base->getCountMax(); } } @@ -277,9 +277,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCountMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -296,7 +296,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -343,12 +343,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -406,7 +406,7 @@ ServerIntangibleObjectTemplate::_Ingredient::~_Ingredient() for (iter = m_ingredients.begin(); iter != m_ingredients.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_ingredients.clear(); } @@ -448,33 +448,33 @@ ServerIntangibleObjectTemplate::IngredientType testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getIngredientType(true); #endif } if (!m_ingredientType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredientType in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter ingredientType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter ingredientType has not been defined in template %s!", DataResource::getName())); return base->getIngredientType(versionOk); } } IngredientType value = static_cast(m_ingredientType.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -484,28 +484,28 @@ UNREF(testData); void ServerIntangibleObjectTemplate::_Ingredient::getIngredients(SimpleIngredient &data, int index, bool versionOk) const { - const ServerIntangibleObjectTemplate::_Ingredient * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate::_Ingredient * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_ingredientsLoaded) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredients in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter ingredients has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter ingredients has not been defined in template %s!", DataResource::getName())); base->getIngredients(data, index, versionOk); return; } } - if (m_ingredientsAppend && base != NULL) + if (m_ingredientsAppend && base != nullptr) { int baseCount = base->getIngredientsCount(); if (index < baseCount) @@ -528,28 +528,28 @@ void ServerIntangibleObjectTemplate::_Ingredient::getIngredients(SimpleIngredien void ServerIntangibleObjectTemplate::_Ingredient::getIngredientsMin(SimpleIngredient &data, int index, bool versionOk) const { - const ServerIntangibleObjectTemplate::_Ingredient * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate::_Ingredient * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_ingredientsLoaded) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredients in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter ingredients has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter ingredients has not been defined in template %s!", DataResource::getName())); base->getIngredientsMin(data, index, versionOk); return; } } - if (m_ingredientsAppend && base != NULL) + if (m_ingredientsAppend && base != nullptr) { int baseCount = base->getIngredientsCount(); if (index < baseCount) @@ -572,28 +572,28 @@ void ServerIntangibleObjectTemplate::_Ingredient::getIngredientsMin(SimpleIngred void ServerIntangibleObjectTemplate::_Ingredient::getIngredientsMax(SimpleIngredient &data, int index, bool versionOk) const { - const ServerIntangibleObjectTemplate::_Ingredient * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate::_Ingredient * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_ingredientsLoaded) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredients in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter ingredients has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter ingredients has not been defined in template %s!", DataResource::getName())); base->getIngredientsMax(data, index, versionOk); return; } } - if (m_ingredientsAppend && base != NULL) + if (m_ingredientsAppend && base != nullptr) { int baseCount = base->getIngredientsCount(); if (index < baseCount) @@ -618,20 +618,20 @@ size_t ServerIntangibleObjectTemplate::_Ingredient::getIngredientsCount(void) co { if (!m_ingredientsLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const ServerIntangibleObjectTemplate::_Ingredient * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getIngredientsCount(); } size_t count = m_ingredients.size(); // if we are extending our base template, add it's count - if (m_ingredientsAppend && m_baseData != NULL) + if (m_ingredientsAppend && m_baseData != nullptr) { const ServerIntangibleObjectTemplate::_Ingredient * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getIngredientsCount(); } @@ -646,26 +646,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_Ingredient * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate::_Ingredient * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getComplexity(true); #endif } if (!m_complexity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter complexity in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); return base->getComplexity(versionOk); } } @@ -675,9 +675,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getComplexity(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -694,7 +694,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -710,26 +710,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_Ingredient * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate::_Ingredient * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getComplexityMin(true); #endif } if (!m_complexity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter complexity in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); return base->getComplexityMin(versionOk); } } @@ -739,9 +739,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getComplexityMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -758,7 +758,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -774,26 +774,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_Ingredient * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate::_Ingredient * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getComplexityMax(true); #endif } if (!m_complexity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter complexity in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); return base->getComplexityMax(versionOk); } } @@ -803,9 +803,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getComplexityMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -822,7 +822,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -838,33 +838,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_Ingredient * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate::_Ingredient * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSkillCommand(true); #endif } if (!m_skillCommand.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter skillCommand in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter skillCommand has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter skillCommand has not been defined in template %s!", DataResource::getName())); return base->getSkillCommand(versionOk); } } const std::string & value = m_skillCommand.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -913,7 +913,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_ingredients.begin(); iter != m_ingredients.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_ingredients.clear(); m_ingredientsAppend = file.read_bool8(); @@ -992,33 +992,33 @@ StringId testDataValue = DefaultStringId; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_SchematicAttribute * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate::_SchematicAttribute * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getName(true); #endif } if (!m_name.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter name in template %s", DataResource::getName())); return DefaultStringId; } else { - DEBUG_FATAL(base == NULL, ("Template parameter name has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter name has not been defined in template %s!", DataResource::getName())); return base->getName(versionOk); } } const StringId value = m_name.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1034,26 +1034,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_SchematicAttribute * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate::_SchematicAttribute * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getValue(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValue(versionOk); } } @@ -1063,9 +1063,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getValue(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1082,7 +1082,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1098,26 +1098,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_SchematicAttribute * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate::_SchematicAttribute * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getValueMin(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValueMin(versionOk); } } @@ -1127,9 +1127,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getValueMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1146,7 +1146,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1162,26 +1162,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_SchematicAttribute * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate::_SchematicAttribute * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getValueMax(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValueMax(versionOk); } } @@ -1191,9 +1191,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getValueMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1210,7 +1210,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1316,33 +1316,33 @@ StringId testDataValue = DefaultStringId; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_SimpleIngredient * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate::_SimpleIngredient * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getName(true); #endif } if (!m_name.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter name in template %s", DataResource::getName())); return DefaultStringId; } else { - DEBUG_FATAL(base == NULL, ("Template parameter name has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter name has not been defined in template %s!", DataResource::getName())); return base->getName(versionOk); } } const StringId value = m_name.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1358,33 +1358,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_SimpleIngredient * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate::_SimpleIngredient * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getIngredient(true); #endif } if (!m_ingredient.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredient in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter ingredient has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter ingredient has not been defined in template %s!", DataResource::getName())); return base->getIngredient(versionOk); } } const std::string & value = m_ingredient.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1400,26 +1400,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_SimpleIngredient * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate::_SimpleIngredient * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCount(true); #endif } if (!m_count.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter count in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter count has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter count has not been defined in template %s!", DataResource::getName())); return base->getCount(versionOk); } } @@ -1429,9 +1429,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCount(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1448,7 +1448,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1464,26 +1464,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_SimpleIngredient * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate::_SimpleIngredient * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCountMin(true); #endif } if (!m_count.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter count in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter count has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter count has not been defined in template %s!", DataResource::getName())); return base->getCountMin(versionOk); } } @@ -1493,9 +1493,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCountMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1512,7 +1512,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1528,26 +1528,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_SimpleIngredient * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate::_SimpleIngredient * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCountMax(true); #endif } if (!m_count.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter count in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter count has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter count has not been defined in template %s!", DataResource::getName())); return base->getCountMax(versionOk); } } @@ -1557,9 +1557,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCountMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1576,7 +1576,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureInstallationObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureInstallationObjectTemplate.cpp index 373a81f7..57b4db42 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureInstallationObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureInstallationObjectTemplate.cpp @@ -93,10 +93,10 @@ Tag ServerManufactureInstallationObjectTemplate::getTemplateVersion(void) const */ Tag ServerManufactureInstallationObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerManufactureInstallationObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerManufactureInstallationObjectTemplate::getHighestTemplateVersion @@ -149,12 +149,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureSchematicObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureSchematicObjectTemplate.cpp index 0f00a74b..3aee1103 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureSchematicObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureSchematicObjectTemplate.cpp @@ -54,7 +54,7 @@ ServerManufactureSchematicObjectTemplate::~ServerManufactureSchematicObjectTempl for (iter = m_ingredients.begin(); iter != m_ingredients.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_ingredients.clear(); } @@ -63,7 +63,7 @@ ServerManufactureSchematicObjectTemplate::~ServerManufactureSchematicObjectTempl for (iter = m_attributes.begin(); iter != m_attributes.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_attributes.clear(); } @@ -115,17 +115,17 @@ Tag ServerManufactureSchematicObjectTemplate::getTemplateVersion(void) const */ Tag ServerManufactureSchematicObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerManufactureSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerManufactureSchematicObjectTemplate::getHighestTemplateVersion /** * Called when the game tries to create a manf schematic via the default method. - * Manf must be created via a draft schematic, so we always return NULL; + * Manf must be created via a draft schematic, so we always return nullptr; * * @return the object */ @@ -146,17 +146,17 @@ Object * ServerManufactureSchematicObjectTemplate::createObject(const char *cons const ObjectTemplate *const objectTemplate = ObjectTemplateList::fetch(fileName); if (objectTemplate) { - Object * object = NULL; + Object * object = nullptr; const ServerManufactureSchematicObjectTemplate * const manfTemplate = dynamic_cast( objectTemplate); - if (manfTemplate != NULL) + if (manfTemplate != nullptr) object = manfTemplate->createObject(schematic); objectTemplate->releaseReference (); return object; } - return NULL; + return nullptr; } // ServerManufactureSchematicObjectTemplate::createObject /** @@ -178,33 +178,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerManufactureSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerManufactureSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDraftSchematic(true); #endif } if (!m_draftSchematic.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter draftSchematic in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter draftSchematic has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter draftSchematic has not been defined in template %s!", DataResource::getName())); return base->getDraftSchematic(); } } const std::string & value = m_draftSchematic.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -220,33 +220,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerManufactureSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerManufactureSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCreator(true); #endif } if (!m_creator.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter creator in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter creator has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter creator has not been defined in template %s!", DataResource::getName())); return base->getCreator(); } } const std::string & value = m_creator.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -256,28 +256,28 @@ UNREF(testData); void ServerManufactureSchematicObjectTemplate::getIngredients(IngredientSlot &data, int index) const { - const ServerManufactureSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerManufactureSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_ingredientsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredients in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter ingredients has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter ingredients has not been defined in template %s!", DataResource::getName())); base->getIngredients(data, index); return; } } - if (m_ingredientsAppend && base != NULL) + if (m_ingredientsAppend && base != nullptr) { int baseCount = base->getIngredientsCount(); if (index < baseCount) @@ -299,28 +299,28 @@ void ServerManufactureSchematicObjectTemplate::getIngredients(IngredientSlot &da void ServerManufactureSchematicObjectTemplate::getIngredientsMin(IngredientSlot &data, int index) const { - const ServerManufactureSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerManufactureSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_ingredientsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredients in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter ingredients has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter ingredients has not been defined in template %s!", DataResource::getName())); base->getIngredientsMin(data, index); return; } } - if (m_ingredientsAppend && base != NULL) + if (m_ingredientsAppend && base != nullptr) { int baseCount = base->getIngredientsCount(); if (index < baseCount) @@ -342,28 +342,28 @@ void ServerManufactureSchematicObjectTemplate::getIngredientsMin(IngredientSlot void ServerManufactureSchematicObjectTemplate::getIngredientsMax(IngredientSlot &data, int index) const { - const ServerManufactureSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerManufactureSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_ingredientsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredients in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter ingredients has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter ingredients has not been defined in template %s!", DataResource::getName())); base->getIngredientsMax(data, index); return; } } - if (m_ingredientsAppend && base != NULL) + if (m_ingredientsAppend && base != nullptr) { int baseCount = base->getIngredientsCount(); if (index < baseCount) @@ -387,20 +387,20 @@ size_t ServerManufactureSchematicObjectTemplate::getIngredientsCount(void) const { if (!m_ingredientsLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const ServerManufactureSchematicObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getIngredientsCount(); } size_t count = m_ingredients.size(); // if we are extending our base template, add it's count - if (m_ingredientsAppend && m_baseData != NULL) + if (m_ingredientsAppend && m_baseData != nullptr) { const ServerManufactureSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getIngredientsCount(); } @@ -415,26 +415,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerManufactureSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerManufactureSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getItemCount(true); #endif } if (!m_itemCount.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter itemCount in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter itemCount has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter itemCount has not been defined in template %s!", DataResource::getName())); return base->getItemCount(); } } @@ -444,9 +444,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getItemCount(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -463,7 +463,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -479,26 +479,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerManufactureSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerManufactureSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getItemCountMin(true); #endif } if (!m_itemCount.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter itemCount in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter itemCount has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter itemCount has not been defined in template %s!", DataResource::getName())); return base->getItemCountMin(); } } @@ -508,9 +508,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getItemCountMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -527,7 +527,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -543,26 +543,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerManufactureSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerManufactureSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getItemCountMax(true); #endif } if (!m_itemCount.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter itemCount in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter itemCount has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter itemCount has not been defined in template %s!", DataResource::getName())); return base->getItemCountMax(); } } @@ -572,9 +572,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getItemCountMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -591,7 +591,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -601,28 +601,28 @@ UNREF(testData); void ServerManufactureSchematicObjectTemplate::getAttributes(SchematicAttribute &data, int index) const { - const ServerManufactureSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerManufactureSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_attributesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attributes in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter attributes has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attributes has not been defined in template %s!", DataResource::getName())); base->getAttributes(data, index); return; } } - if (m_attributesAppend && base != NULL) + if (m_attributesAppend && base != nullptr) { int baseCount = base->getAttributesCount(); if (index < baseCount) @@ -644,28 +644,28 @@ void ServerManufactureSchematicObjectTemplate::getAttributes(SchematicAttribute void ServerManufactureSchematicObjectTemplate::getAttributesMin(SchematicAttribute &data, int index) const { - const ServerManufactureSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerManufactureSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_attributesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attributes in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter attributes has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attributes has not been defined in template %s!", DataResource::getName())); base->getAttributesMin(data, index); return; } } - if (m_attributesAppend && base != NULL) + if (m_attributesAppend && base != nullptr) { int baseCount = base->getAttributesCount(); if (index < baseCount) @@ -687,28 +687,28 @@ void ServerManufactureSchematicObjectTemplate::getAttributesMin(SchematicAttribu void ServerManufactureSchematicObjectTemplate::getAttributesMax(SchematicAttribute &data, int index) const { - const ServerManufactureSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerManufactureSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_attributesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attributes in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter attributes has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attributes has not been defined in template %s!", DataResource::getName())); base->getAttributesMax(data, index); return; } } - if (m_attributesAppend && base != NULL) + if (m_attributesAppend && base != nullptr) { int baseCount = base->getAttributesCount(); if (index < baseCount) @@ -732,20 +732,20 @@ size_t ServerManufactureSchematicObjectTemplate::getAttributesCount(void) const { if (!m_attributesLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const ServerManufactureSchematicObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getAttributesCount(); } size_t count = m_attributes.size(); // if we are extending our base template, add it's count - if (m_attributesAppend && m_baseData != NULL) + if (m_attributesAppend && m_baseData != nullptr) { const ServerManufactureSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getAttributesCount(); } @@ -793,12 +793,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -831,7 +831,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_ingredients.begin(); iter != m_ingredients.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_ingredients.clear(); m_ingredientsAppend = file.read_bool8(); @@ -852,7 +852,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_attributes.begin(); iter != m_attributes.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_attributes.clear(); m_attributesAppend = file.read_bool8(); @@ -929,33 +929,33 @@ StringId testDataValue = DefaultStringId; UNREF(testData); #endif - const ServerManufactureSchematicObjectTemplate::_IngredientSlot * base = NULL; - if (m_baseData != NULL) + const ServerManufactureSchematicObjectTemplate::_IngredientSlot * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getName(true); #endif } if (!m_name.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter name in template %s", DataResource::getName())); return DefaultStringId; } else { - DEBUG_FATAL(base == NULL, ("Template parameter name has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter name has not been defined in template %s!", DataResource::getName())); return base->getName(versionOk); } } const StringId value = m_name.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -965,22 +965,22 @@ UNREF(testData); void ServerManufactureSchematicObjectTemplate::_IngredientSlot::getIngredient(Ingredient &data, bool versionOk) const { - const ServerManufactureSchematicObjectTemplate::_IngredientSlot * base = NULL; - if (m_baseData != NULL) + const ServerManufactureSchematicObjectTemplate::_IngredientSlot * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_ingredient.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredient in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter ingredient has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter ingredient has not been defined in template %s!", DataResource::getName())); base->getIngredient(data, versionOk); return; } @@ -1004,22 +1004,22 @@ void ServerManufactureSchematicObjectTemplate::_IngredientSlot::getIngredient(In void ServerManufactureSchematicObjectTemplate::_IngredientSlot::getIngredientMin(Ingredient &data, bool versionOk) const { - const ServerManufactureSchematicObjectTemplate::_IngredientSlot * base = NULL; - if (m_baseData != NULL) + const ServerManufactureSchematicObjectTemplate::_IngredientSlot * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_ingredient.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredient in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter ingredient has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter ingredient has not been defined in template %s!", DataResource::getName())); base->getIngredientMin(data, versionOk); return; } @@ -1043,22 +1043,22 @@ void ServerManufactureSchematicObjectTemplate::_IngredientSlot::getIngredientMin void ServerManufactureSchematicObjectTemplate::_IngredientSlot::getIngredientMax(Ingredient &data, bool versionOk) const { - const ServerManufactureSchematicObjectTemplate::_IngredientSlot * base = NULL; - if (m_baseData != NULL) + const ServerManufactureSchematicObjectTemplate::_IngredientSlot * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_ingredient.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredient in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter ingredient has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter ingredient has not been defined in template %s!", DataResource::getName())); base->getIngredientMax(data, versionOk); return; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerMissionObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerMissionObjectTemplate.cpp index 66ee2754..9417be44 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerMissionObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerMissionObjectTemplate.cpp @@ -93,10 +93,10 @@ Tag ServerMissionObjectTemplate::getTemplateVersion(void) const */ Tag ServerMissionObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerMissionObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerMissionObjectTemplate::getHighestTemplateVersion @@ -149,12 +149,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerObjectTemplate.cpp index 78810b18..5e11c2e7 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerObjectTemplate.cpp @@ -32,7 +32,7 @@ const TriggerVolumeData DefaultTriggerVolumeData; bool ServerObjectTemplate::ms_allowDefaultTemplateParams = true; typedef std::unordered_map > XP_MAP; -static XP_MAP * XpMap = NULL; +static XP_MAP * XpMap = nullptr; /** @@ -74,7 +74,7 @@ ServerObjectTemplate::~ServerObjectTemplate() for (iter = m_scripts.begin(); iter != m_scripts.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_scripts.clear(); } @@ -83,7 +83,7 @@ ServerObjectTemplate::~ServerObjectTemplate() for (iter = m_visibleFlags.begin(); iter != m_visibleFlags.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_visibleFlags.clear(); } @@ -92,7 +92,7 @@ ServerObjectTemplate::~ServerObjectTemplate() for (iter = m_deleteFlags.begin(); iter != m_deleteFlags.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_deleteFlags.clear(); } @@ -101,7 +101,7 @@ ServerObjectTemplate::~ServerObjectTemplate() for (iter = m_moveFlags.begin(); iter != m_moveFlags.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_moveFlags.clear(); } @@ -110,7 +110,7 @@ ServerObjectTemplate::~ServerObjectTemplate() for (iter = m_contents.begin(); iter != m_contents.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_contents.clear(); } @@ -119,7 +119,7 @@ ServerObjectTemplate::~ServerObjectTemplate() for (iter = m_xpPoints.begin(); iter != m_xpPoints.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_xpPoints.clear(); } @@ -133,7 +133,7 @@ void ServerObjectTemplate::registerMe(void) { ObjectTemplateList::registerTemplate(ServerObjectTemplate_tag, create); - if (XpMap == NULL) + if (XpMap == nullptr) { XpMap = new XP_MAP(); ExitChain::add(exit, "ServerObjectTemplate"); @@ -208,10 +208,10 @@ void ServerObjectTemplate::registerMe(void) */ void ServerObjectTemplate::exit() { - if (XpMap != NULL) + if (XpMap != nullptr) { delete XpMap; - XpMap = NULL; + XpMap = nullptr; } } // ServerObjectTemplate::exit @@ -252,10 +252,10 @@ Tag ServerObjectTemplate::getTemplateVersion(void) const */ Tag ServerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerObjectTemplate::getHighestTemplateVersion @@ -287,7 +287,7 @@ const std::string & ServerObjectTemplate::getXpString(XpTypes type) { static const std::string emptyString; - if (XpMap != NULL) + if (XpMap != nullptr) { XP_MAP::const_iterator result = XpMap->find(type); if (result != XpMap->end()) @@ -371,33 +371,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSharedTemplate(true); #endif } if (!m_sharedTemplate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter sharedTemplate in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter sharedTemplate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter sharedTemplate has not been defined in template %s!", DataResource::getName())); return base->getSharedTemplate(); } } const std::string & value = m_sharedTemplate.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -407,27 +407,27 @@ UNREF(testData); const std::string & ServerObjectTemplate::getScripts(int index) const { - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_scriptsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter scripts in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter scripts has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter scripts has not been defined in template %s!", DataResource::getName())); return base->getScripts(index); } } - if (m_scriptsAppend && base != NULL) + if (m_scriptsAppend && base != nullptr) { int baseCount = base->getScriptsCount(); if (index < baseCount) @@ -444,20 +444,20 @@ size_t ServerObjectTemplate::getScriptsCount(void) const { if (!m_scriptsLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const ServerObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getScriptsCount(); } size_t count = m_scripts.size(); // if we are extending our base template, add it's count - if (m_scriptsAppend && m_baseData != NULL) + if (m_scriptsAppend && m_baseData != nullptr) { const ServerObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getScriptsCount(); } @@ -466,28 +466,28 @@ size_t ServerObjectTemplate::getScriptsCount(void) const void ServerObjectTemplate::getObjvars(DynamicVariableList &list) const { - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_objvars.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter objvars in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter objvars has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter objvars has not been defined in template %s!", DataResource::getName())); base->getObjvars(list); return; } } - if (m_objvars.isExtendingBaseList() && base != NULL) + if (m_objvars.isExtendingBaseList() && base != nullptr) base->getObjvars(list); m_objvars.getDynamicVariableList(list); } // ServerObjectTemplate::getObjvars @@ -500,26 +500,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getVolume(true); #endif } if (!m_volume.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter volume in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter volume has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter volume has not been defined in template %s!", DataResource::getName())); return base->getVolume(); } } @@ -529,9 +529,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getVolume(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -548,7 +548,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -564,26 +564,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getVolumeMin(true); #endif } if (!m_volume.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter volume in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter volume has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter volume has not been defined in template %s!", DataResource::getName())); return base->getVolumeMin(); } } @@ -593,9 +593,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getVolumeMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -612,7 +612,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -628,26 +628,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getVolumeMax(true); #endif } if (!m_volume.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter volume in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter volume has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter volume has not been defined in template %s!", DataResource::getName())); return base->getVolumeMax(); } } @@ -657,9 +657,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getVolumeMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -676,7 +676,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -686,27 +686,27 @@ UNREF(testData); ServerObjectTemplate::VisibleFlags ServerObjectTemplate::getVisibleFlags(int index) const { - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_visibleFlagsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter visibleFlags in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter visibleFlags has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter visibleFlags has not been defined in template %s!", DataResource::getName())); return base->getVisibleFlags(index); } } - if (m_visibleFlagsAppend && base != NULL) + if (m_visibleFlagsAppend && base != nullptr) { int baseCount = base->getVisibleFlagsCount(); if (index < baseCount) @@ -722,20 +722,20 @@ size_t ServerObjectTemplate::getVisibleFlagsCount(void) const { if (!m_visibleFlagsLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const ServerObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getVisibleFlagsCount(); } size_t count = m_visibleFlags.size(); // if we are extending our base template, add it's count - if (m_visibleFlagsAppend && m_baseData != NULL) + if (m_visibleFlagsAppend && m_baseData != nullptr) { const ServerObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getVisibleFlagsCount(); } @@ -744,27 +744,27 @@ size_t ServerObjectTemplate::getVisibleFlagsCount(void) const ServerObjectTemplate::DeleteFlags ServerObjectTemplate::getDeleteFlags(int index) const { - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_deleteFlagsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter deleteFlags in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter deleteFlags has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter deleteFlags has not been defined in template %s!", DataResource::getName())); return base->getDeleteFlags(index); } } - if (m_deleteFlagsAppend && base != NULL) + if (m_deleteFlagsAppend && base != nullptr) { int baseCount = base->getDeleteFlagsCount(); if (index < baseCount) @@ -780,20 +780,20 @@ size_t ServerObjectTemplate::getDeleteFlagsCount(void) const { if (!m_deleteFlagsLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const ServerObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getDeleteFlagsCount(); } size_t count = m_deleteFlags.size(); // if we are extending our base template, add it's count - if (m_deleteFlagsAppend && m_baseData != NULL) + if (m_deleteFlagsAppend && m_baseData != nullptr) { const ServerObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getDeleteFlagsCount(); } @@ -802,27 +802,27 @@ size_t ServerObjectTemplate::getDeleteFlagsCount(void) const ServerObjectTemplate::MoveFlags ServerObjectTemplate::getMoveFlags(int index) const { - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_moveFlagsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter moveFlags in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter moveFlags has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter moveFlags has not been defined in template %s!", DataResource::getName())); return base->getMoveFlags(index); } } - if (m_moveFlagsAppend && base != NULL) + if (m_moveFlagsAppend && base != nullptr) { int baseCount = base->getMoveFlagsCount(); if (index < baseCount) @@ -838,20 +838,20 @@ size_t ServerObjectTemplate::getMoveFlagsCount(void) const { if (!m_moveFlagsLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const ServerObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getMoveFlagsCount(); } size_t count = m_moveFlags.size(); // if we are extending our base template, add it's count - if (m_moveFlagsAppend && m_baseData != NULL) + if (m_moveFlagsAppend && m_baseData != nullptr) { const ServerObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getMoveFlagsCount(); } @@ -866,33 +866,33 @@ bool testDataValue = false; UNREF(testData); #endif - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getInvulnerable(true); #endif } if (!m_invulnerable.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter invulnerable in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter invulnerable has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter invulnerable has not been defined in template %s!", DataResource::getName())); return base->getInvulnerable(); } } bool value = m_invulnerable.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -908,26 +908,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getComplexity(true); #endif } if (!m_complexity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter complexity in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); return base->getComplexity(); } } @@ -937,9 +937,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getComplexity(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -956,7 +956,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -972,26 +972,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getComplexityMin(true); #endif } if (!m_complexity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter complexity in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); return base->getComplexityMin(); } } @@ -1001,9 +1001,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getComplexityMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1020,7 +1020,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1036,26 +1036,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getComplexityMax(true); #endif } if (!m_complexity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter complexity in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); return base->getComplexityMax(); } } @@ -1065,9 +1065,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getComplexityMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1084,7 +1084,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1100,26 +1100,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTintIndex(true); #endif } if (!m_tintIndex.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter tintIndex in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter tintIndex has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter tintIndex has not been defined in template %s!", DataResource::getName())); return base->getTintIndex(); } } @@ -1129,9 +1129,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTintIndex(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1148,7 +1148,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1164,26 +1164,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTintIndexMin(true); #endif } if (!m_tintIndex.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter tintIndex in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter tintIndex has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter tintIndex has not been defined in template %s!", DataResource::getName())); return base->getTintIndexMin(); } } @@ -1193,9 +1193,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTintIndexMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1212,7 +1212,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1228,26 +1228,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTintIndexMax(true); #endif } if (!m_tintIndex.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter tintIndex in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter tintIndex has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter tintIndex has not been defined in template %s!", DataResource::getName())); return base->getTintIndexMax(); } } @@ -1257,9 +1257,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTintIndexMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1276,7 +1276,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1286,8 +1286,8 @@ UNREF(testData); float ServerObjectTemplate::getUpdateRanges(UpdateRanges index) const { - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -1295,14 +1295,14 @@ float ServerObjectTemplate::getUpdateRanges(UpdateRanges index) const DEBUG_FATAL(index < 0 || index >= 3, ("template param index out of range")); if (!m_updateRanges[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter updateRanges in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter updateRanges has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter updateRanges has not been defined in template %s!", DataResource::getName())); return base->getUpdateRanges(index); } } @@ -1312,9 +1312,9 @@ float ServerObjectTemplate::getUpdateRanges(UpdateRanges index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getUpdateRanges(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1335,8 +1335,8 @@ float ServerObjectTemplate::getUpdateRanges(UpdateRanges index) const float ServerObjectTemplate::getUpdateRangesMin(UpdateRanges index) const { - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -1344,14 +1344,14 @@ float ServerObjectTemplate::getUpdateRangesMin(UpdateRanges index) const DEBUG_FATAL(index < 0 || index >= 3, ("template param index out of range")); if (!m_updateRanges[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter updateRanges in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter updateRanges has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter updateRanges has not been defined in template %s!", DataResource::getName())); return base->getUpdateRangesMin(index); } } @@ -1361,9 +1361,9 @@ float ServerObjectTemplate::getUpdateRangesMin(UpdateRanges index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getUpdateRangesMin(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1384,8 +1384,8 @@ float ServerObjectTemplate::getUpdateRangesMin(UpdateRanges index) const float ServerObjectTemplate::getUpdateRangesMax(UpdateRanges index) const { - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -1393,14 +1393,14 @@ float ServerObjectTemplate::getUpdateRangesMax(UpdateRanges index) const DEBUG_FATAL(index < 0 || index >= 3, ("template param index out of range")); if (!m_updateRanges[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter updateRanges in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter updateRanges has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter updateRanges has not been defined in template %s!", DataResource::getName())); return base->getUpdateRangesMax(index); } } @@ -1410,9 +1410,9 @@ float ServerObjectTemplate::getUpdateRangesMax(UpdateRanges index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getUpdateRangesMax(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1433,28 +1433,28 @@ float ServerObjectTemplate::getUpdateRangesMax(UpdateRanges index) const void ServerObjectTemplate::getContents(Contents &data, int index) const { - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_contentsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter contents in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter contents has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter contents has not been defined in template %s!", DataResource::getName())); base->getContents(data, index); return; } } - if (m_contentsAppend && base != NULL) + if (m_contentsAppend && base != nullptr) { int baseCount = base->getContentsCount(); if (index < baseCount) @@ -1477,28 +1477,28 @@ void ServerObjectTemplate::getContents(Contents &data, int index) const void ServerObjectTemplate::getContentsMin(Contents &data, int index) const { - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_contentsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter contents in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter contents has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter contents has not been defined in template %s!", DataResource::getName())); base->getContentsMin(data, index); return; } } - if (m_contentsAppend && base != NULL) + if (m_contentsAppend && base != nullptr) { int baseCount = base->getContentsCount(); if (index < baseCount) @@ -1521,28 +1521,28 @@ void ServerObjectTemplate::getContentsMin(Contents &data, int index) const void ServerObjectTemplate::getContentsMax(Contents &data, int index) const { - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_contentsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter contents in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter contents has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter contents has not been defined in template %s!", DataResource::getName())); base->getContentsMax(data, index); return; } } - if (m_contentsAppend && base != NULL) + if (m_contentsAppend && base != nullptr) { int baseCount = base->getContentsCount(); if (index < baseCount) @@ -1567,20 +1567,20 @@ size_t ServerObjectTemplate::getContentsCount(void) const { if (!m_contentsLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const ServerObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getContentsCount(); } size_t count = m_contents.size(); // if we are extending our base template, add it's count - if (m_contentsAppend && m_baseData != NULL) + if (m_contentsAppend && m_baseData != nullptr) { const ServerObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getContentsCount(); } @@ -1589,28 +1589,28 @@ size_t ServerObjectTemplate::getContentsCount(void) const void ServerObjectTemplate::getXpPoints(Xp &data, int index) const { - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_xpPointsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter xpPoints in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter xpPoints has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter xpPoints has not been defined in template %s!", DataResource::getName())); base->getXpPoints(data, index); return; } } - if (m_xpPointsAppend && base != NULL) + if (m_xpPointsAppend && base != nullptr) { int baseCount = base->getXpPointsCount(); if (index < baseCount) @@ -1633,28 +1633,28 @@ void ServerObjectTemplate::getXpPoints(Xp &data, int index) const void ServerObjectTemplate::getXpPointsMin(Xp &data, int index) const { - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_xpPointsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter xpPoints in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter xpPoints has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter xpPoints has not been defined in template %s!", DataResource::getName())); base->getXpPointsMin(data, index); return; } } - if (m_xpPointsAppend && base != NULL) + if (m_xpPointsAppend && base != nullptr) { int baseCount = base->getXpPointsCount(); if (index < baseCount) @@ -1677,28 +1677,28 @@ void ServerObjectTemplate::getXpPointsMin(Xp &data, int index) const void ServerObjectTemplate::getXpPointsMax(Xp &data, int index) const { - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_xpPointsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter xpPoints in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter xpPoints has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter xpPoints has not been defined in template %s!", DataResource::getName())); base->getXpPointsMax(data, index); return; } } - if (m_xpPointsAppend && base != NULL) + if (m_xpPointsAppend && base != nullptr) { int baseCount = base->getXpPointsCount(); if (index < baseCount) @@ -1723,20 +1723,20 @@ size_t ServerObjectTemplate::getXpPointsCount(void) const { if (!m_xpPointsLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const ServerObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getXpPointsCount(); } size_t count = m_xpPoints.size(); // if we are extending our base template, add it's count - if (m_xpPointsAppend && m_baseData != NULL) + if (m_xpPointsAppend && m_baseData != nullptr) { const ServerObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getXpPointsCount(); } @@ -1751,33 +1751,33 @@ bool testDataValue = false; UNREF(testData); #endif - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getPersistByDefault(true); #endif } if (!m_persistByDefault.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter persistByDefault in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter persistByDefault has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter persistByDefault has not been defined in template %s!", DataResource::getName())); return base->getPersistByDefault(); } } bool value = m_persistByDefault.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1793,33 +1793,33 @@ bool testDataValue = false; UNREF(testData); #endif - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getPersistContents(true); #endif } if (!m_persistContents.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter persistContents in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter persistContents has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter persistContents has not been defined in template %s!", DataResource::getName())); return base->getPersistContents(); } } bool value = m_persistContents.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1872,12 +1872,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -1908,7 +1908,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_scripts.begin(); iter != m_scripts.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_scripts.clear(); m_scriptsAppend = file.read_bool8(); @@ -1931,7 +1931,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_visibleFlags.begin(); iter != m_visibleFlags.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_visibleFlags.clear(); m_visibleFlagsAppend = file.read_bool8(); @@ -1950,7 +1950,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_deleteFlags.begin(); iter != m_deleteFlags.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_deleteFlags.clear(); m_deleteFlagsAppend = file.read_bool8(); @@ -1969,7 +1969,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_moveFlags.begin(); iter != m_moveFlags.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_moveFlags.clear(); m_moveFlagsAppend = file.read_bool8(); @@ -2008,7 +2008,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_contents.begin(); iter != m_contents.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_contents.clear(); m_contentsAppend = file.read_bool8(); @@ -2027,7 +2027,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_xpPoints.begin(); iter != m_xpPoints.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_xpPoints.clear(); m_xpPointsAppend = file.read_bool8(); @@ -2106,33 +2106,33 @@ ServerObjectTemplate::Attributes testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTarget(true); #endif } if (!m_target.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter target in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter target has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter target has not been defined in template %s!", DataResource::getName())); return base->getTarget(versionOk); } } Attributes value = static_cast(m_target.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2148,26 +2148,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate::_AttribMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_AttribMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getValue(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValue(versionOk); } } @@ -2177,9 +2177,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getValue(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2196,7 +2196,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2212,26 +2212,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate::_AttribMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_AttribMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getValueMin(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValueMin(versionOk); } } @@ -2241,9 +2241,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getValueMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2260,7 +2260,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2276,26 +2276,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate::_AttribMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_AttribMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getValueMax(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValueMax(versionOk); } } @@ -2305,9 +2305,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getValueMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2324,7 +2324,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2340,26 +2340,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_AttribMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_AttribMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTime(true); #endif } if (!m_time.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter time in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter time has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter time has not been defined in template %s!", DataResource::getName())); return base->getTime(versionOk); } } @@ -2369,9 +2369,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTime(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2388,7 +2388,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2404,26 +2404,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_AttribMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_AttribMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTimeMin(true); #endif } if (!m_time.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter time in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter time has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter time has not been defined in template %s!", DataResource::getName())); return base->getTimeMin(versionOk); } } @@ -2433,9 +2433,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTimeMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2452,7 +2452,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2468,26 +2468,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_AttribMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_AttribMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTimeMax(true); #endif } if (!m_time.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter time in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter time has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter time has not been defined in template %s!", DataResource::getName())); return base->getTimeMax(versionOk); } } @@ -2497,9 +2497,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTimeMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2516,7 +2516,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2532,26 +2532,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_AttribMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_AttribMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTimeAtValue(true); #endif } if (!m_timeAtValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter timeAtValue in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter timeAtValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter timeAtValue has not been defined in template %s!", DataResource::getName())); return base->getTimeAtValue(versionOk); } } @@ -2561,9 +2561,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTimeAtValue(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2580,7 +2580,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2596,26 +2596,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_AttribMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_AttribMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTimeAtValueMin(true); #endif } if (!m_timeAtValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter timeAtValue in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter timeAtValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter timeAtValue has not been defined in template %s!", DataResource::getName())); return base->getTimeAtValueMin(versionOk); } } @@ -2625,9 +2625,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTimeAtValueMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2644,7 +2644,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2660,26 +2660,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_AttribMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_AttribMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTimeAtValueMax(true); #endif } if (!m_timeAtValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter timeAtValue in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter timeAtValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter timeAtValue has not been defined in template %s!", DataResource::getName())); return base->getTimeAtValueMax(versionOk); } } @@ -2689,9 +2689,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTimeAtValueMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2708,7 +2708,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2724,26 +2724,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_AttribMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_AttribMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDecay(true); #endif } if (!m_decay.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter decay in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter decay has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter decay has not been defined in template %s!", DataResource::getName())); return base->getDecay(versionOk); } } @@ -2753,9 +2753,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getDecay(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2772,7 +2772,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2788,26 +2788,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_AttribMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_AttribMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDecayMin(true); #endif } if (!m_decay.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter decay in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter decay has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter decay has not been defined in template %s!", DataResource::getName())); return base->getDecayMin(versionOk); } } @@ -2817,9 +2817,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getDecayMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2836,7 +2836,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2852,26 +2852,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_AttribMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_AttribMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDecayMax(true); #endif } if (!m_decay.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter decay in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter decay has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter decay has not been defined in template %s!", DataResource::getName())); return base->getDecayMax(versionOk); } } @@ -2881,9 +2881,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getDecayMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2900,7 +2900,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2972,7 +2972,7 @@ char paramName[MAX_NAME_SIZE]; */ ServerObjectTemplate::Contents::Contents(void) { - content = NULL; + content = nullptr; } // ServerObjectTemplate::Contents::Contents() /** @@ -2983,7 +2983,7 @@ ServerObjectTemplate::Contents::Contents(const ServerObjectTemplate::Contents & equipObject(source.equipObject), content(source.content) { - if (content != NULL) + if (content != nullptr) const_cast(content)->addReference(); } // ServerObjectTemplate::Contents::Contents(const ServerObjectTemplate::Contents &) @@ -2992,10 +2992,10 @@ ServerObjectTemplate::Contents::Contents(const ServerObjectTemplate::Contents & */ ServerObjectTemplate::Contents::~Contents() { - if (content != NULL) + if (content != nullptr) { content->releaseReference(); - content = NULL; + content = nullptr; } } // ServerObjectTemplate::Contents::~Contents @@ -3065,33 +3065,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerObjectTemplate::_Contents * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_Contents * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSlotName(true); #endif } if (!m_slotName.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slotName in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slotName has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slotName has not been defined in template %s!", DataResource::getName())); return base->getSlotName(versionOk); } } const std::string & value = m_slotName.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3107,33 +3107,33 @@ bool testDataValue = false; UNREF(testData); #endif - const ServerObjectTemplate::_Contents * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_Contents * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getEquipObject(true); #endif } if (!m_equipObject.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter equipObject in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter equipObject has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter equipObject has not been defined in template %s!", DataResource::getName())); return base->getEquipObject(versionOk); } } bool value = m_equipObject.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3143,32 +3143,32 @@ UNREF(testData); const ServerObjectTemplate * ServerObjectTemplate::_Contents::getContent(bool versionOk) const { - const ServerObjectTemplate::_Contents * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_Contents * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_content.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter content in template %s", DataResource::getName())); - return NULL; + return nullptr; } else { - DEBUG_FATAL(base == NULL, ("Template parameter content has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter content has not been defined in template %s!", DataResource::getName())); return base->getContent(versionOk); } } - const ServerObjectTemplate * returnValue = NULL; + const ServerObjectTemplate * returnValue = nullptr; const std::string & templateName = m_content.getValue(); if (!templateName.empty()) { returnValue = dynamic_cast(ObjectTemplateList::fetch(templateName)); - if (returnValue == NULL) + if (returnValue == nullptr) WARNING_STRICT_FATAL(true, ("Error loading template %s",templateName.c_str())); } return returnValue; @@ -3273,33 +3273,33 @@ ServerObjectTemplate::MentalStates testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTarget(true); #endif } if (!m_target.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter target in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter target has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter target has not been defined in template %s!", DataResource::getName())); return base->getTarget(versionOk); } } MentalStates value = static_cast(m_target.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3315,26 +3315,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_MentalStateMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_MentalStateMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getValue(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValue(versionOk); } } @@ -3344,9 +3344,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getValue(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3363,7 +3363,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3379,26 +3379,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_MentalStateMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_MentalStateMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getValueMin(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValueMin(versionOk); } } @@ -3408,9 +3408,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getValueMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3427,7 +3427,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3443,26 +3443,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_MentalStateMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_MentalStateMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getValueMax(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValueMax(versionOk); } } @@ -3472,9 +3472,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getValueMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3491,7 +3491,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3507,26 +3507,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_MentalStateMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_MentalStateMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTime(true); #endif } if (!m_time.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter time in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter time has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter time has not been defined in template %s!", DataResource::getName())); return base->getTime(versionOk); } } @@ -3536,9 +3536,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTime(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3555,7 +3555,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3571,26 +3571,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_MentalStateMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_MentalStateMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTimeMin(true); #endif } if (!m_time.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter time in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter time has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter time has not been defined in template %s!", DataResource::getName())); return base->getTimeMin(versionOk); } } @@ -3600,9 +3600,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTimeMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3619,7 +3619,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3635,26 +3635,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_MentalStateMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_MentalStateMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTimeMax(true); #endif } if (!m_time.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter time in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter time has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter time has not been defined in template %s!", DataResource::getName())); return base->getTimeMax(versionOk); } } @@ -3664,9 +3664,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTimeMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3683,7 +3683,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3699,26 +3699,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_MentalStateMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_MentalStateMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTimeAtValue(true); #endif } if (!m_timeAtValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter timeAtValue in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter timeAtValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter timeAtValue has not been defined in template %s!", DataResource::getName())); return base->getTimeAtValue(versionOk); } } @@ -3728,9 +3728,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTimeAtValue(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3747,7 +3747,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3763,26 +3763,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_MentalStateMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_MentalStateMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTimeAtValueMin(true); #endif } if (!m_timeAtValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter timeAtValue in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter timeAtValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter timeAtValue has not been defined in template %s!", DataResource::getName())); return base->getTimeAtValueMin(versionOk); } } @@ -3792,9 +3792,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTimeAtValueMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3811,7 +3811,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3827,26 +3827,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_MentalStateMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_MentalStateMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTimeAtValueMax(true); #endif } if (!m_timeAtValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter timeAtValue in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter timeAtValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter timeAtValue has not been defined in template %s!", DataResource::getName())); return base->getTimeAtValueMax(versionOk); } } @@ -3856,9 +3856,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTimeAtValueMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3875,7 +3875,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3891,26 +3891,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_MentalStateMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_MentalStateMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDecay(true); #endif } if (!m_decay.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter decay in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter decay has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter decay has not been defined in template %s!", DataResource::getName())); return base->getDecay(versionOk); } } @@ -3920,9 +3920,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getDecay(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3939,7 +3939,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3955,26 +3955,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_MentalStateMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_MentalStateMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDecayMin(true); #endif } if (!m_decay.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter decay in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter decay has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter decay has not been defined in template %s!", DataResource::getName())); return base->getDecayMin(versionOk); } } @@ -3984,9 +3984,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getDecayMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -4003,7 +4003,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -4019,26 +4019,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_MentalStateMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_MentalStateMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDecayMax(true); #endif } if (!m_decay.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter decay in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter decay has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter decay has not been defined in template %s!", DataResource::getName())); return base->getDecayMax(versionOk); } } @@ -4048,9 +4048,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getDecayMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -4067,7 +4067,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -4185,33 +4185,33 @@ ServerObjectTemplate::XpTypes testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getType(true); #endif } if (!m_type.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter type in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter type has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter type has not been defined in template %s!", DataResource::getName())); return base->getType(versionOk); } } XpTypes value = static_cast(m_type.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -4227,26 +4227,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate::_Xp * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_Xp * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getLevel(true); #endif } if (!m_level.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter level in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter level has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter level has not been defined in template %s!", DataResource::getName())); return base->getLevel(versionOk); } } @@ -4256,9 +4256,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getLevel(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -4275,7 +4275,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -4291,26 +4291,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate::_Xp * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_Xp * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getLevelMin(true); #endif } if (!m_level.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter level in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter level has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter level has not been defined in template %s!", DataResource::getName())); return base->getLevelMin(versionOk); } } @@ -4320,9 +4320,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getLevelMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -4339,7 +4339,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -4355,26 +4355,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate::_Xp * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_Xp * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getLevelMax(true); #endif } if (!m_level.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter level in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter level has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter level has not been defined in template %s!", DataResource::getName())); return base->getLevelMax(versionOk); } } @@ -4384,9 +4384,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getLevelMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -4403,7 +4403,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -4419,26 +4419,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate::_Xp * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_Xp * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getValue(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValue(versionOk); } } @@ -4448,9 +4448,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getValue(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -4467,7 +4467,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -4483,26 +4483,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate::_Xp * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_Xp * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getValueMin(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValueMin(versionOk); } } @@ -4512,9 +4512,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getValueMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -4531,7 +4531,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -4547,26 +4547,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate::_Xp * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_Xp * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getValueMax(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValueMax(versionOk); } } @@ -4576,9 +4576,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getValueMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -4595,7 +4595,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlanetObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlanetObjectTemplate.cpp index 985007c1..3c4e1053 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlanetObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlanetObjectTemplate.cpp @@ -93,10 +93,10 @@ Tag ServerPlanetObjectTemplate::getTemplateVersion(void) const */ Tag ServerPlanetObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerPlanetObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerPlanetObjectTemplate::getHighestTemplateVersion @@ -120,33 +120,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerPlanetObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerPlanetObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getPlanetName(true); #endif } if (!m_planetName.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter planetName in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter planetName has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter planetName has not been defined in template %s!", DataResource::getName())); return base->getPlanetName(); } } const std::string & value = m_planetName.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -192,12 +192,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerObjectTemplate.cpp index 9051a1f9..effe5904 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerObjectTemplate.cpp @@ -95,10 +95,10 @@ Tag ServerPlayerObjectTemplate::getTemplateVersion(void) const */ Tag ServerPlayerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerPlayerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerPlayerObjectTemplate::getHighestTemplateVersion @@ -151,12 +151,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerQuestObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerQuestObjectTemplate.cpp index ea316d04..5949f691 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerQuestObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerQuestObjectTemplate.cpp @@ -95,10 +95,10 @@ Tag ServerPlayerQuestObjectTemplate::getTemplateVersion(void) const */ Tag ServerPlayerQuestObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerPlayerQuestObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerPlayerQuestObjectTemplate::getHighestTemplateVersion @@ -152,12 +152,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerResourceContainerObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerResourceContainerObjectTemplate.cpp index bdd03637..a5512489 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerResourceContainerObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerResourceContainerObjectTemplate.cpp @@ -93,10 +93,10 @@ Tag ServerResourceContainerObjectTemplate::getTemplateVersion(void) const */ Tag ServerResourceContainerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerResourceContainerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerResourceContainerObjectTemplate::getHighestTemplateVersion @@ -120,26 +120,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerResourceContainerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerResourceContainerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxResources(true); #endif } if (!m_maxResources.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxResources in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxResources has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxResources has not been defined in template %s!", DataResource::getName())); return base->getMaxResources(); } } @@ -149,9 +149,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxResources(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -168,7 +168,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -184,26 +184,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerResourceContainerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerResourceContainerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxResourcesMin(true); #endif } if (!m_maxResources.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxResources in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxResources has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxResources has not been defined in template %s!", DataResource::getName())); return base->getMaxResourcesMin(); } } @@ -213,9 +213,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxResourcesMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -232,7 +232,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -248,26 +248,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerResourceContainerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerResourceContainerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxResourcesMax(true); #endif } if (!m_maxResources.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxResources in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxResources has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxResources has not been defined in template %s!", DataResource::getName())); return base->getMaxResourcesMax(); } } @@ -277,9 +277,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxResourcesMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -296,7 +296,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -343,12 +343,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerShipObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerShipObjectTemplate.cpp index 1acde7a0..a2d12972 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerShipObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerShipObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag ServerShipObjectTemplate::getTemplateVersion(void) const */ Tag ServerShipObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerShipObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerShipObjectTemplate::getHighestTemplateVersion @@ -121,33 +121,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerShipObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerShipObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getShipType(true); #endif } if (!m_shipType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter shipType in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter shipType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter shipType has not been defined in template %s!", DataResource::getName())); return base->getShipType(); } } const std::string & value = m_shipType.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -193,12 +193,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerStaticObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerStaticObjectTemplate.cpp index 767901e7..f2e49fba 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerStaticObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerStaticObjectTemplate.cpp @@ -93,10 +93,10 @@ Tag ServerStaticObjectTemplate::getTemplateVersion(void) const */ Tag ServerStaticObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerStaticObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerStaticObjectTemplate::getHighestTemplateVersion @@ -120,33 +120,33 @@ bool testDataValue = false; UNREF(testData); #endif - const ServerStaticObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerStaticObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getClientOnlyBuildout(true); #endif } if (!m_clientOnlyBuildout.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter clientOnlyBuildout in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter clientOnlyBuildout has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter clientOnlyBuildout has not been defined in template %s!", DataResource::getName())); return base->getClientOnlyBuildout(); } } bool value = m_clientOnlyBuildout.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -192,12 +192,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerTangibleObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerTangibleObjectTemplate.cpp index 39d5e817..3bdb728d 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerTangibleObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerTangibleObjectTemplate.cpp @@ -53,7 +53,7 @@ ServerTangibleObjectTemplate::~ServerTangibleObjectTemplate() for (iter = m_triggerVolumes.begin(); iter != m_triggerVolumes.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_triggerVolumes.clear(); } @@ -105,10 +105,10 @@ Tag ServerTangibleObjectTemplate::getTemplateVersion(void) const */ Tag ServerTangibleObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerTangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerTangibleObjectTemplate::getHighestTemplateVersion @@ -126,27 +126,27 @@ Object * ServerTangibleObjectTemplate::createObject(void) const //@BEGIN TFD const TriggerVolumeData ServerTangibleObjectTemplate::getTriggerVolumes(int index) const { - const ServerTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_triggerVolumesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter triggerVolumes in template %s", DataResource::getName())); return DefaultTriggerVolumeData; } else { - DEBUG_FATAL(base == NULL, ("Template parameter triggerVolumes has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter triggerVolumes has not been defined in template %s!", DataResource::getName())); return base->getTriggerVolumes(index); } } - if (m_triggerVolumesAppend && base != NULL) + if (m_triggerVolumesAppend && base != nullptr) { int baseCount = base->getTriggerVolumesCount(); if (index < baseCount) @@ -164,20 +164,20 @@ size_t ServerTangibleObjectTemplate::getTriggerVolumesCount(void) const { if (!m_triggerVolumesLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const ServerTangibleObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getTriggerVolumesCount(); } size_t count = m_triggerVolumes.size(); // if we are extending our base template, add it's count - if (m_triggerVolumesAppend && m_baseData != NULL) + if (m_triggerVolumesAppend && m_baseData != nullptr) { const ServerTangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getTriggerVolumesCount(); } @@ -192,33 +192,33 @@ ServerTangibleObjectTemplate::CombatSkeleton testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCombatSkeleton(true); #endif } if (!m_combatSkeleton.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter combatSkeleton in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter combatSkeleton has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter combatSkeleton has not been defined in template %s!", DataResource::getName())); return base->getCombatSkeleton(); } } CombatSkeleton value = static_cast(m_combatSkeleton.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -234,26 +234,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxHitPoints(true); #endif } if (!m_maxHitPoints.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxHitPoints in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxHitPoints has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxHitPoints has not been defined in template %s!", DataResource::getName())); return base->getMaxHitPoints(); } } @@ -263,9 +263,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxHitPoints(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -282,7 +282,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -298,26 +298,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxHitPointsMin(true); #endif } if (!m_maxHitPoints.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxHitPoints in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxHitPoints has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxHitPoints has not been defined in template %s!", DataResource::getName())); return base->getMaxHitPointsMin(); } } @@ -327,9 +327,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxHitPointsMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -346,7 +346,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -362,26 +362,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxHitPointsMax(true); #endif } if (!m_maxHitPoints.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxHitPoints in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxHitPoints has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxHitPoints has not been defined in template %s!", DataResource::getName())); return base->getMaxHitPointsMax(); } } @@ -391,9 +391,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxHitPointsMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -410,7 +410,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -420,32 +420,32 @@ UNREF(testData); const ServerArmorTemplate * ServerTangibleObjectTemplate::getArmor() const { - const ServerTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_armor.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter armor in template %s", DataResource::getName())); - return NULL; + return nullptr; } else { - DEBUG_FATAL(base == NULL, ("Template parameter armor has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter armor has not been defined in template %s!", DataResource::getName())); return base->getArmor(); } } - const ServerArmorTemplate * returnValue = NULL; + const ServerArmorTemplate * returnValue = nullptr; const std::string & templateName = m_armor.getValue(); if (!templateName.empty()) { returnValue = dynamic_cast(ObjectTemplateList::fetch(templateName)); - if (returnValue == NULL) + if (returnValue == nullptr) WARNING_STRICT_FATAL(true, ("Error loading template %s",templateName.c_str())); } return returnValue; @@ -459,26 +459,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getInterestRadius(true); #endif } if (!m_interestRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter interestRadius in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter interestRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter interestRadius has not been defined in template %s!", DataResource::getName())); return base->getInterestRadius(); } } @@ -488,9 +488,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getInterestRadius(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -507,7 +507,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -523,26 +523,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getInterestRadiusMin(true); #endif } if (!m_interestRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter interestRadius in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter interestRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter interestRadius has not been defined in template %s!", DataResource::getName())); return base->getInterestRadiusMin(); } } @@ -552,9 +552,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getInterestRadiusMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -571,7 +571,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -587,26 +587,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getInterestRadiusMax(true); #endif } if (!m_interestRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter interestRadius in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter interestRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter interestRadius has not been defined in template %s!", DataResource::getName())); return base->getInterestRadiusMax(); } } @@ -616,9 +616,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getInterestRadiusMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -635,7 +635,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -651,26 +651,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCount(true); #endif } if (!m_count.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter count in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter count has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter count has not been defined in template %s!", DataResource::getName())); return base->getCount(); } } @@ -680,9 +680,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCount(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -699,7 +699,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -715,26 +715,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCountMin(true); #endif } if (!m_count.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter count in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter count has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter count has not been defined in template %s!", DataResource::getName())); return base->getCountMin(); } } @@ -744,9 +744,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCountMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -763,7 +763,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -779,26 +779,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCountMax(true); #endif } if (!m_count.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter count in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter count has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter count has not been defined in template %s!", DataResource::getName())); return base->getCountMax(); } } @@ -808,9 +808,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCountMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -827,7 +827,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -843,26 +843,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCondition(true); #endif } if (!m_condition.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter condition in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter condition has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter condition has not been defined in template %s!", DataResource::getName())); return base->getCondition(); } } @@ -872,9 +872,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCondition(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -891,7 +891,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -907,26 +907,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getConditionMin(true); #endif } if (!m_condition.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter condition in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter condition has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter condition has not been defined in template %s!", DataResource::getName())); return base->getConditionMin(); } } @@ -936,9 +936,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getConditionMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -955,7 +955,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -971,26 +971,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getConditionMax(true); #endif } if (!m_condition.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter condition in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter condition has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter condition has not been defined in template %s!", DataResource::getName())); return base->getConditionMax(); } } @@ -1000,9 +1000,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getConditionMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1019,7 +1019,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1035,33 +1035,33 @@ bool testDataValue = false; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getWantSawAttackTriggers(true); #endif } if (!m_wantSawAttackTriggers.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter wantSawAttackTriggers in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter wantSawAttackTriggers has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter wantSawAttackTriggers has not been defined in template %s!", DataResource::getName())); return base->getWantSawAttackTriggers(); } } bool value = m_wantSawAttackTriggers.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1116,12 +1116,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -1150,7 +1150,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_triggerVolumes.begin(); iter != m_triggerVolumes.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_triggerVolumes.clear(); m_triggerVolumesAppend = file.read_bool8(); diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerUniverseObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerUniverseObjectTemplate.cpp index 03a16459..9bba2b4b 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerUniverseObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerUniverseObjectTemplate.cpp @@ -93,10 +93,10 @@ Tag ServerUniverseObjectTemplate::getTemplateVersion(void) const */ Tag ServerUniverseObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerUniverseObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerUniverseObjectTemplate::getHighestTemplateVersion @@ -149,12 +149,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerVehicleObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerVehicleObjectTemplate.cpp index 501b241a..838e7107 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerVehicleObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerVehicleObjectTemplate.cpp @@ -93,10 +93,10 @@ Tag ServerVehicleObjectTemplate::getTemplateVersion(void) const */ Tag ServerVehicleObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerVehicleObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerVehicleObjectTemplate::getHighestTemplateVersion @@ -120,33 +120,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getFuelType(true); #endif } if (!m_fuelType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter fuelType in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter fuelType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter fuelType has not been defined in template %s!", DataResource::getName())); return base->getFuelType(); } } const std::string & value = m_fuelType.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -162,26 +162,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCurrentFuel(true); #endif } if (!m_currentFuel.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter currentFuel in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter currentFuel has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter currentFuel has not been defined in template %s!", DataResource::getName())); return base->getCurrentFuel(); } } @@ -191,9 +191,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCurrentFuel(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -210,7 +210,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -226,26 +226,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCurrentFuelMin(true); #endif } if (!m_currentFuel.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter currentFuel in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter currentFuel has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter currentFuel has not been defined in template %s!", DataResource::getName())); return base->getCurrentFuelMin(); } } @@ -255,9 +255,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCurrentFuelMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -274,7 +274,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -290,26 +290,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCurrentFuelMax(true); #endif } if (!m_currentFuel.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter currentFuel in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter currentFuel has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter currentFuel has not been defined in template %s!", DataResource::getName())); return base->getCurrentFuelMax(); } } @@ -319,9 +319,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCurrentFuelMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -338,7 +338,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -354,26 +354,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxFuel(true); #endif } if (!m_maxFuel.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxFuel in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxFuel has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxFuel has not been defined in template %s!", DataResource::getName())); return base->getMaxFuel(); } } @@ -383,9 +383,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxFuel(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -402,7 +402,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -418,26 +418,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxFuelMin(true); #endif } if (!m_maxFuel.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxFuel in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxFuel has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxFuel has not been defined in template %s!", DataResource::getName())); return base->getMaxFuelMin(); } } @@ -447,9 +447,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxFuelMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -466,7 +466,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -482,26 +482,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxFuelMax(true); #endif } if (!m_maxFuel.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxFuel in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxFuel has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxFuel has not been defined in template %s!", DataResource::getName())); return base->getMaxFuelMax(); } } @@ -511,9 +511,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxFuelMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -530,7 +530,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -546,26 +546,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getConsumpsion(true); #endif } if (!m_consumpsion.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter consumpsion in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter consumpsion has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter consumpsion has not been defined in template %s!", DataResource::getName())); return base->getConsumpsion(); } } @@ -575,9 +575,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getConsumpsion(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -594,7 +594,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -610,26 +610,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getConsumpsionMin(true); #endif } if (!m_consumpsion.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter consumpsion in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter consumpsion has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter consumpsion has not been defined in template %s!", DataResource::getName())); return base->getConsumpsionMin(); } } @@ -639,9 +639,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getConsumpsionMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -658,7 +658,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -674,26 +674,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getConsumpsionMax(true); #endif } if (!m_consumpsion.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter consumpsion in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter consumpsion has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter consumpsion has not been defined in template %s!", DataResource::getName())); return base->getConsumpsionMax(); } } @@ -703,9 +703,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getConsumpsionMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -722,7 +722,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -774,12 +774,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerWeaponObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerWeaponObjectTemplate.cpp index 8d4bbfa0..bf2ee2cb 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerWeaponObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerWeaponObjectTemplate.cpp @@ -93,10 +93,10 @@ Tag ServerWeaponObjectTemplate::getTemplateVersion(void) const */ Tag ServerWeaponObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerWeaponObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerWeaponObjectTemplate::getHighestTemplateVersion @@ -120,33 +120,33 @@ ServerWeaponObjectTemplate::WeaponType testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getWeaponType(true); #endif } if (!m_weaponType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter weaponType in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter weaponType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter weaponType has not been defined in template %s!", DataResource::getName())); return base->getWeaponType(); } } WeaponType value = static_cast(m_weaponType.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -162,33 +162,33 @@ ServerWeaponObjectTemplate::AttackType testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAttackType(true); #endif } if (!m_attackType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attackType in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter attackType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attackType has not been defined in template %s!", DataResource::getName())); return base->getAttackType(); } } AttackType value = static_cast(m_attackType.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -204,33 +204,33 @@ ServerWeaponObjectTemplate::DamageType testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDamageType(true); #endif } if (!m_damageType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter damageType in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter damageType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter damageType has not been defined in template %s!", DataResource::getName())); return base->getDamageType(); } } DamageType value = static_cast(m_damageType.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -246,33 +246,33 @@ ServerWeaponObjectTemplate::DamageType testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getElementalType(true); #endif } if (!m_elementalType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter elementalType in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter elementalType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter elementalType has not been defined in template %s!", DataResource::getName())); return base->getElementalType(); } } DamageType value = static_cast(m_elementalType.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -288,26 +288,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getElementalValue(true); #endif } if (!m_elementalValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter elementalValue in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter elementalValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter elementalValue has not been defined in template %s!", DataResource::getName())); return base->getElementalValue(); } } @@ -317,9 +317,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getElementalValue(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -336,7 +336,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -352,26 +352,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getElementalValueMin(true); #endif } if (!m_elementalValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter elementalValue in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter elementalValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter elementalValue has not been defined in template %s!", DataResource::getName())); return base->getElementalValueMin(); } } @@ -381,9 +381,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getElementalValueMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -400,7 +400,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -416,26 +416,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getElementalValueMax(true); #endif } if (!m_elementalValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter elementalValue in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter elementalValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter elementalValue has not been defined in template %s!", DataResource::getName())); return base->getElementalValueMax(); } } @@ -445,9 +445,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getElementalValueMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -464,7 +464,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -480,26 +480,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMinDamageAmount(true); #endif } if (!m_minDamageAmount.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter minDamageAmount in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter minDamageAmount has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter minDamageAmount has not been defined in template %s!", DataResource::getName())); return base->getMinDamageAmount(); } } @@ -509,9 +509,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinDamageAmount(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -528,7 +528,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -544,26 +544,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMinDamageAmountMin(true); #endif } if (!m_minDamageAmount.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter minDamageAmount in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter minDamageAmount has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter minDamageAmount has not been defined in template %s!", DataResource::getName())); return base->getMinDamageAmountMin(); } } @@ -573,9 +573,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinDamageAmountMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -592,7 +592,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -608,26 +608,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMinDamageAmountMax(true); #endif } if (!m_minDamageAmount.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter minDamageAmount in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter minDamageAmount has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter minDamageAmount has not been defined in template %s!", DataResource::getName())); return base->getMinDamageAmountMax(); } } @@ -637,9 +637,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinDamageAmountMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -656,7 +656,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -672,26 +672,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxDamageAmount(true); #endif } if (!m_maxDamageAmount.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxDamageAmount in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxDamageAmount has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxDamageAmount has not been defined in template %s!", DataResource::getName())); return base->getMaxDamageAmount(); } } @@ -701,9 +701,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxDamageAmount(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -720,7 +720,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -736,26 +736,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxDamageAmountMin(true); #endif } if (!m_maxDamageAmount.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxDamageAmount in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxDamageAmount has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxDamageAmount has not been defined in template %s!", DataResource::getName())); return base->getMaxDamageAmountMin(); } } @@ -765,9 +765,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxDamageAmountMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -784,7 +784,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -800,26 +800,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxDamageAmountMax(true); #endif } if (!m_maxDamageAmount.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxDamageAmount in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxDamageAmount has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxDamageAmount has not been defined in template %s!", DataResource::getName())); return base->getMaxDamageAmountMax(); } } @@ -829,9 +829,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxDamageAmountMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -848,7 +848,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -864,26 +864,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAttackSpeed(true); #endif } if (!m_attackSpeed.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attackSpeed in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter attackSpeed has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attackSpeed has not been defined in template %s!", DataResource::getName())); return base->getAttackSpeed(); } } @@ -893,9 +893,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAttackSpeed(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -912,7 +912,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -928,26 +928,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAttackSpeedMin(true); #endif } if (!m_attackSpeed.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attackSpeed in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter attackSpeed has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attackSpeed has not been defined in template %s!", DataResource::getName())); return base->getAttackSpeedMin(); } } @@ -957,9 +957,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAttackSpeedMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -976,7 +976,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -992,26 +992,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAttackSpeedMax(true); #endif } if (!m_attackSpeed.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attackSpeed in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter attackSpeed has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attackSpeed has not been defined in template %s!", DataResource::getName())); return base->getAttackSpeedMax(); } } @@ -1021,9 +1021,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAttackSpeedMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1040,7 +1040,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1056,26 +1056,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAudibleRange(true); #endif } if (!m_audibleRange.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter audibleRange in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter audibleRange has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter audibleRange has not been defined in template %s!", DataResource::getName())); return base->getAudibleRange(); } } @@ -1085,9 +1085,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAudibleRange(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1104,7 +1104,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1120,26 +1120,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAudibleRangeMin(true); #endif } if (!m_audibleRange.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter audibleRange in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter audibleRange has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter audibleRange has not been defined in template %s!", DataResource::getName())); return base->getAudibleRangeMin(); } } @@ -1149,9 +1149,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAudibleRangeMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1168,7 +1168,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1184,26 +1184,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAudibleRangeMax(true); #endif } if (!m_audibleRange.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter audibleRange in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter audibleRange has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter audibleRange has not been defined in template %s!", DataResource::getName())); return base->getAudibleRangeMax(); } } @@ -1213,9 +1213,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAudibleRangeMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1232,7 +1232,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1248,26 +1248,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMinRange(true); #endif } if (!m_minRange.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter minRange in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter minRange has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter minRange has not been defined in template %s!", DataResource::getName())); return base->getMinRange(); } } @@ -1277,9 +1277,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinRange(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1296,7 +1296,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1312,26 +1312,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMinRangeMin(true); #endif } if (!m_minRange.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter minRange in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter minRange has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter minRange has not been defined in template %s!", DataResource::getName())); return base->getMinRangeMin(); } } @@ -1341,9 +1341,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinRangeMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1360,7 +1360,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1376,26 +1376,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMinRangeMax(true); #endif } if (!m_minRange.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter minRange in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter minRange has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter minRange has not been defined in template %s!", DataResource::getName())); return base->getMinRangeMax(); } } @@ -1405,9 +1405,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinRangeMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1424,7 +1424,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1440,26 +1440,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxRange(true); #endif } if (!m_maxRange.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxRange in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxRange has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxRange has not been defined in template %s!", DataResource::getName())); return base->getMaxRange(); } } @@ -1469,9 +1469,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxRange(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1488,7 +1488,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1504,26 +1504,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxRangeMin(true); #endif } if (!m_maxRange.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxRange in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxRange has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxRange has not been defined in template %s!", DataResource::getName())); return base->getMaxRangeMin(); } } @@ -1533,9 +1533,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxRangeMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1552,7 +1552,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1568,26 +1568,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxRangeMax(true); #endif } if (!m_maxRange.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxRange in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxRange has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxRange has not been defined in template %s!", DataResource::getName())); return base->getMaxRangeMax(); } } @@ -1597,9 +1597,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxRangeMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1616,7 +1616,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1632,26 +1632,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDamageRadius(true); #endif } if (!m_damageRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter damageRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter damageRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter damageRadius has not been defined in template %s!", DataResource::getName())); return base->getDamageRadius(); } } @@ -1661,9 +1661,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getDamageRadius(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1680,7 +1680,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1696,26 +1696,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDamageRadiusMin(true); #endif } if (!m_damageRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter damageRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter damageRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter damageRadius has not been defined in template %s!", DataResource::getName())); return base->getDamageRadiusMin(); } } @@ -1725,9 +1725,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getDamageRadiusMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1744,7 +1744,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1760,26 +1760,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDamageRadiusMax(true); #endif } if (!m_damageRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter damageRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter damageRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter damageRadius has not been defined in template %s!", DataResource::getName())); return base->getDamageRadiusMax(); } } @@ -1789,9 +1789,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getDamageRadiusMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1808,7 +1808,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1824,26 +1824,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getWoundChance(true); #endif } if (!m_woundChance.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter woundChance in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter woundChance has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter woundChance has not been defined in template %s!", DataResource::getName())); return base->getWoundChance(); } } @@ -1853,9 +1853,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getWoundChance(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1872,7 +1872,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1888,26 +1888,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getWoundChanceMin(true); #endif } if (!m_woundChance.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter woundChance in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter woundChance has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter woundChance has not been defined in template %s!", DataResource::getName())); return base->getWoundChanceMin(); } } @@ -1917,9 +1917,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getWoundChanceMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1936,7 +1936,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1952,26 +1952,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getWoundChanceMax(true); #endif } if (!m_woundChance.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter woundChance in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter woundChance has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter woundChance has not been defined in template %s!", DataResource::getName())); return base->getWoundChanceMax(); } } @@ -1981,9 +1981,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getWoundChanceMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2000,7 +2000,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2016,26 +2016,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAttackCost(true); #endif } if (!m_attackCost.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attackCost in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter attackCost has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attackCost has not been defined in template %s!", DataResource::getName())); return base->getAttackCost(); } } @@ -2045,9 +2045,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAttackCost(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2064,7 +2064,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2080,26 +2080,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAttackCostMin(true); #endif } if (!m_attackCost.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attackCost in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter attackCost has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attackCost has not been defined in template %s!", DataResource::getName())); return base->getAttackCostMin(); } } @@ -2109,9 +2109,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAttackCostMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2128,7 +2128,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2144,26 +2144,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAttackCostMax(true); #endif } if (!m_attackCost.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attackCost in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter attackCost has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attackCost has not been defined in template %s!", DataResource::getName())); return base->getAttackCostMax(); } } @@ -2173,9 +2173,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAttackCostMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2192,7 +2192,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2208,26 +2208,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAccuracy(true); #endif } if (!m_accuracy.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter accuracy in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter accuracy has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter accuracy has not been defined in template %s!", DataResource::getName())); return base->getAccuracy(); } } @@ -2237,9 +2237,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAccuracy(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2256,7 +2256,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2272,26 +2272,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAccuracyMin(true); #endif } if (!m_accuracy.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter accuracy in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter accuracy has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter accuracy has not been defined in template %s!", DataResource::getName())); return base->getAccuracyMin(); } } @@ -2301,9 +2301,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAccuracyMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2320,7 +2320,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2336,26 +2336,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAccuracyMax(true); #endif } if (!m_accuracy.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter accuracy in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter accuracy has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter accuracy has not been defined in template %s!", DataResource::getName())); return base->getAccuracyMax(); } } @@ -2365,9 +2365,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAccuracyMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2384,7 +2384,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2455,12 +2455,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerXpManagerObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerXpManagerObjectTemplate.cpp index 4ee70d19..0fc6ff30 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerXpManagerObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerXpManagerObjectTemplate.cpp @@ -95,10 +95,10 @@ Tag ServerXpManagerObjectTemplate::getTemplateVersion(void) const */ Tag ServerXpManagerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerXpManagerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerXpManagerObjectTemplate::getHighestTemplateVersion @@ -111,7 +111,7 @@ Tag ServerXpManagerObjectTemplate::getHighestTemplateVersion(void) const Object * ServerXpManagerObjectTemplate::createObject(void) const { // return new XpManagerObject(this); - return NULL; + return nullptr; } // ServerXpManagerObjectTemplate::createObject //@BEGIN TFD @@ -152,12 +152,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/pvp/Pvp.cpp b/engine/server/library/serverGame/src/shared/pvp/Pvp.cpp index 4de849cd..d6e291ae 100755 --- a/engine/server/library/serverGame/src/shared/pvp/Pvp.cpp +++ b/engine/server/library/serverGame/src/shared/pvp/Pvp.cpp @@ -613,7 +613,7 @@ void Pvp::updateTimedFlags(const void *context) unsigned long const updateTimeMs = static_cast(ConfigServerGame::getPvpUpdateTimeMs()); PvpInternal::updateTimedFlags(updateTimeMs); - getScheduler().setCallback(Pvp::updateTimedFlags, NULL, updateTimeMs); + getScheduler().setCallback(Pvp::updateTimedFlags, nullptr, updateTimeMs); } // ---------------------------------------------------------------------- @@ -754,7 +754,7 @@ Pvp::GcwScoreCategory const * Pvp::getGcwScoreCategory(std::string const & score if (iterFind != s_gcwScoreCategory.end()) return iterFind->second; - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -765,7 +765,7 @@ Pvp::GcwScoreCategory const * Pvp::getGcwScoreDefaultCategoryForPlanet(std::stri if (iterFind != s_gcwScoreDefaultCategoryForPlanet.end()) return iterFind->second; - return NULL; + return nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/pvp/PvpRuleSetBase.cpp b/engine/server/library/serverGame/src/shared/pvp/PvpRuleSetBase.cpp index 440b0ed7..d0c4212f 100755 --- a/engine/server/library/serverGame/src/shared/pvp/PvpRuleSetBase.cpp +++ b/engine/server/library/serverGame/src/shared/pvp/PvpRuleSetBase.cpp @@ -27,8 +27,8 @@ namespace PvpRuleSetBaseNamespace // if object is authoritative, then apply repercussions immediately; // otherwise, forward repercussions over to the authoritative server - PvpUpdateObserver * o = NULL; - MessageQueuePvpCommand * messageQueuePvpCommand = NULL; + PvpUpdateObserver * o = nullptr; + MessageQueuePvpCommand * messageQueuePvpCommand = nullptr; if (actor.isAuthoritative()) o = new PvpUpdateObserver(&actor, Archive::ADOO_generic); diff --git a/engine/server/library/serverGame/src/shared/pvp/PvpUpdateObserver.cpp b/engine/server/library/serverGame/src/shared/pvp/PvpUpdateObserver.cpp index 70f55095..d333bbb0 100755 --- a/engine/server/library/serverGame/src/shared/pvp/PvpUpdateObserver.cpp +++ b/engine/server/library/serverGame/src/shared/pvp/PvpUpdateObserver.cpp @@ -81,7 +81,7 @@ PvpUpdateObserver::PvpUpdateObserver(TangibleObject const *who, Archive::AutoDel m_pvpFaction = who->getPvpFaction(); // get client visible status for everyone observing this object (including itself) - if ((s_objectsProcessedThisFrame.count(who->getNetworkId()) == 0) && satisfyPvpSyncCondition(who->isNonPvpObject(), who->hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (who->asCreatureObject() != NULL), who->getPvpFaction())) + if ((s_objectsProcessedThisFrame.count(who->getNetworkId()) == 0) && satisfyPvpSyncCondition(who->isNonPvpObject(), who->hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (who->asCreatureObject() != nullptr), who->getPvpFaction())) { std::set const &clients = who->getObservers(); for (std::set::const_iterator i = clients.begin(); i != clients.end(); ++i) @@ -146,8 +146,8 @@ PvpUpdateObserver::~PvpUpdateObserver() PvpData::isRebelFactionId(m_obj->getPvpFaction())) { // did the object's "pvp sync" status change because of the faction change? - bool const wasPvpSync = PvpUpdateObserver::satisfyPvpSyncCondition(m_obj->isNonPvpObject(), m_obj->hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (m_obj->asCreatureObject() != NULL), m_pvpFaction); - bool const isPvpSync = PvpUpdateObserver::satisfyPvpSyncCondition(m_obj->isNonPvpObject(), m_obj->hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (m_obj->asCreatureObject() != NULL), m_obj->getPvpFaction()); + bool const wasPvpSync = PvpUpdateObserver::satisfyPvpSyncCondition(m_obj->isNonPvpObject(), m_obj->hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (m_obj->asCreatureObject() != nullptr), m_pvpFaction); + bool const isPvpSync = PvpUpdateObserver::satisfyPvpSyncCondition(m_obj->isNonPvpObject(), m_obj->hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (m_obj->asCreatureObject() != nullptr), m_obj->getPvpFaction()); if (wasPvpSync != isPvpSync) { @@ -173,7 +173,7 @@ PvpUpdateObserver::~PvpUpdateObserver() void PvpUpdateObserver::updatePvpStatusCache(Client const *client, TangibleObject const &who, uint32 flags, uint32 factionId) { - if (!client || !who.getNetworkId().isValid() || !PvpUpdateObserver::satisfyPvpSyncCondition(who.isNonPvpObject(), who.hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (who.asCreatureObject() != NULL), who.getPvpFaction())) + if (!client || !who.getNetworkId().isValid() || !PvpUpdateObserver::satisfyPvpSyncCondition(who.isNonPvpObject(), who.hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (who.asCreatureObject() != nullptr), who.getPvpFaction())) return; s_pvpUpdateObserverCache[client][who.getNetworkId()] = std::make_pair(flags, factionId); diff --git a/engine/server/library/serverGame/src/shared/region/Region.cpp b/engine/server/library/serverGame/src/shared/region/Region.cpp index fc74229a..c24a3500 100755 --- a/engine/server/library/serverGame/src/shared/region/Region.cpp +++ b/engine/server/library/serverGame/src/shared/region/Region.cpp @@ -22,7 +22,7 @@ static std::map s_nameCrcRegionMap; * Class constructor for a static region. */ Region::Region() : - m_bounds(NULL), + m_bounds(nullptr), m_dynamicRegionId(), m_name(), m_nameCrc(0), @@ -49,7 +49,7 @@ Region::Region() : * @param dynamicRegionId the id of the dynamic region object */ Region::Region(const CachedNetworkId & dynamicRegionId) : - m_bounds(NULL), + m_bounds(nullptr), m_dynamicRegionId(dynamicRegionId), m_name(), m_nameCrc(0), @@ -83,7 +83,7 @@ Region::~Region() } delete const_cast(m_bounds); - m_bounds = NULL; + m_bounds = nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/region/RegionMaster.cpp b/engine/server/library/serverGame/src/shared/region/RegionMaster.cpp index 6cbb7710..d8f734a6 100755 --- a/engine/server/library/serverGame/src/shared/region/RegionMaster.cpp +++ b/engine/server/library/serverGame/src/shared/region/RegionMaster.cpp @@ -82,7 +82,7 @@ struct RegionMaster::RegionData MxCifQuadTree * tree; RegionsMappedByName nameMap; - RegionData() : tree(NULL), nameMap() {} + RegionData() : tree(nullptr), nameMap() {} }; namespace RegionMasterNamspace @@ -133,7 +133,7 @@ void RegionMaster::exit() i1 != ms_planetRegions.end(); ++i1) { delete (*i1).second.tree; - (*i1).second.tree = NULL; + (*i1).second.tree = nullptr; } ms_planetRegions.clear(); } @@ -143,7 +143,7 @@ void RegionMaster::exit() i2 != ms_staticRegions.end(); ++i2) { delete const_cast(*i2); - *i2 = NULL; + *i2 = nullptr; } ms_staticRegions.clear(); } @@ -153,7 +153,7 @@ void RegionMaster::exit() i2 != ms_dynamicRegions.end(); ++i2) { delete const_cast(*i2); - *i2 = NULL; + *i2 = nullptr; } ms_dynamicRegions.clear(); } @@ -178,7 +178,7 @@ void RegionMaster::readRegionDataTables() const char * regionFilesName = ConfigServerGame::getRegionFilesName(); DataTable * const regionFilesTable = DataTableManager::getTable(regionFilesName, true); - if (regionFilesTable == NULL) + if (regionFilesTable == nullptr) { WARNING(true, ("RegionMaster::readRegionDataTables could not open file %s, static regions will not be read!", regionFilesName)); return; @@ -197,14 +197,14 @@ void RegionMaster::readRegionDataTables() float regionMaxY = regionFilesTable->getFloatValue (5, i); DataTable * const regionTable = DataTableManager::getTable(regionFileName, true); - if (regionTable == NULL) + if (regionTable == nullptr) { WARNING(true, ("RegionMaster::readRegionDataTables could not open region file %s.", regionFileName.c_str())); continue; } RegionData & regionData = ms_planetRegions[planetName]; - if (regionData.tree == NULL) + if (regionData.tree == nullptr) { regionData.tree = new MxCifQuadTree(regionMinX, regionMinY, regionMaxX, regionMaxY, ConfigServerGame::getRegionTreeDepth()); } @@ -246,7 +246,7 @@ void RegionMaster::readRegionDataTables() } // create a rectangular or circular region and add it to the region tree - Region * region = NULL; + Region * region = nullptr; switch (geometry) { case RG_rectagle: @@ -284,7 +284,7 @@ void RegionMaster::readRegionDataTables() continue; } // set the rest of the region's data - if (region != NULL) + if (region != nullptr) { region->setName(name); region->setPlanet(planetName); @@ -400,7 +400,7 @@ void RegionMaster::createNewDynamicRegion(float minX, float minZ, * @param visible visible flag * @param notify notify flag * - * @return the new region, or NULL on error + * @return the new region, or nullptr on error */ void RegionMaster::createNewDynamicRegion(float centerX, float centerZ, float radius, const Unicode::String & name, const std::string & planet, int pvp, @@ -512,7 +512,7 @@ const Region * RegionMaster::addDynamicRegion(const UniverseObject & source) if (!ms_installed) { WARNING(true, ("RegionMaster::addDynamicRegion, not installed")); - return NULL; + return nullptr; } DynamicVariableList::NestedList regionObjvars(source.getObjVars(),OBJVAR_DYNAMIC_REGION); @@ -521,124 +521,124 @@ const Region * RegionMaster::addDynamicRegion(const UniverseObject & source) if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_PLANET,planet)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no planet data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } Unicode::String name; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_NAME,name)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no name data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } if (name.empty()) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has empty " "name data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } int geometry = 0; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_GEOMETRY,geometry)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "geometry data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } float minX; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_MINX,minX)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "minX data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } float minY; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_MINY,minY)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "minY data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } float maxX; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_MAXX,maxX)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "maxX data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } float maxY; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_MAXY,maxY)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "maxY data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } int pvp=0; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_PVP,pvp)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "pvp data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } int geography=0; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_GEOGRAPHY,geography)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "geography data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } int minDifficulty = 0; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_MIN_DIFFICULTY, minDifficulty)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "min difficulty data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } int maxDifficulty = 0; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_MAX_DIFFICULTY, maxDifficulty)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "max difficulty data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } int spawn = 0; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_SPAWN,spawn)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "spawn data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } int mission = 0; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_MISSION,mission)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "mission data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } int buildable = 0; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_BUILDABLE,buildable)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "buildable data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } int municipal = 0; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_MUNICIPAL,municipal)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "municipal data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } int visible = 0; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_VISIBLE,visible)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "visible data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } int notify = 0; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_NOTIFY,notify)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "notify data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } // find the appropriate region data for the planet @@ -650,14 +650,14 @@ const Region * RegionMaster::addDynamicRegion(const UniverseObject & source) WARNING(true, ("RegionMaster::addDynamicRegion object %s gave unknown " "planet %s for its region", source.getNetworkId().getValueString().c_str(), Unicode::wideToNarrow(planet).c_str())); - return NULL; + return nullptr; } RegionData & regionData = (*result).second; - if (regionData.tree == NULL) + if (regionData.tree == nullptr) { WARNING_STRICT_FATAL(true, ("RegionMaster::addDynamicRegion planet %s " "has no tree defined!", Unicode::wideToNarrow(planet).c_str())); - return NULL; + return nullptr; } // make sure the region name is unique @@ -666,11 +666,11 @@ const Region * RegionMaster::addDynamicRegion(const UniverseObject & source) WARNING(true, ("RegionMaster::addDynamicRegion object %s is trying " "to add duplicate region %s", source.getNetworkId().getValueString().c_str(), Unicode::wideToNarrow(name).c_str())); - return NULL; + return nullptr; } // create a rectangular or circular region and add it to the region tree - Region * region = NULL; + Region * region = nullptr; switch (geometry) { case RG_rectagle: @@ -706,14 +706,14 @@ const Region * RegionMaster::addDynamicRegion(const UniverseObject & source) DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has unknown " "geometry type", source.getNetworkId().getValueString().c_str(), geometry)); - return NULL; + return nullptr; } - if (region == NULL) + if (region == nullptr) { WARNING(true, ("RegionMaster::readRegionDataTables could " "not add region defined by object %s to region tree", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } // set the rest of the region's data @@ -803,7 +803,7 @@ void RegionMaster::removeDynamicRegion(const UniverseObject & source) return; } RegionData & regionData = (*dataResult).second; - if (regionData.tree == NULL) + if (regionData.tree == nullptr) { WARNING_STRICT_FATAL(true, ("RegionMaster::addDynamicRegion planet %s " "has no tree defined!", Unicode::wideToNarrow(planet).c_str())); @@ -888,7 +888,7 @@ const Region * RegionMaster::getDynamicRegionFromObject(const UniverseObject & s if (!ms_installed) { WARNING(true, ("RegionMaster::getDynamicRegionFromObject, not installed")); - return NULL; + return nullptr; } DynamicVariableList::NestedList regionObjVars(source.getObjVars(),OBJVAR_DYNAMIC_REGION); @@ -898,14 +898,14 @@ const Region * RegionMaster::getDynamicRegionFromObject(const UniverseObject & s { DEBUG_WARNING(true, ("RegionMaster::getDynamicRegionFromObject object %s has no " "planet data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } Unicode::String name; if (!regionObjVars.getItem(OBJVAR_DYNAMIC_REGION_NAME,name)) { DEBUG_WARNING(true, ("RegionMaster::getDynamicRegionFromObject object %s has no " "name data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } return getRegionByName(Unicode::wideToNarrow(planet), name); @@ -921,17 +921,17 @@ Region * RegionMaster::getRegionByName(const std::string & planetName, const Uni if (!ms_installed) { WARNING(true, ("RegionMaster::getRegionByName, not installed")); - return NULL; + return nullptr; } const RegionData & regionData = ms_planetRegions[planetName]; - if (regionData.tree != NULL) + if (regionData.tree != nullptr) { RegionsMappedByName::const_iterator result = regionData.nameMap.find(regionName); if (result != regionData.nameMap.end()) return (*result).second; } - return NULL; + return nullptr; } // RegionMaster::getRegionByName //---------------------------------------------------------------------- @@ -944,18 +944,18 @@ const Region * RegionMaster::getSmallestRegionAtPoint(const std::string & planet if (!ms_installed) { WARNING(true, ("RegionMaster::getSmallestRegionAtPoint, not installed")); - return NULL; + return nullptr; } std::vector regions; getRegionsAtPoint(planet, x, z, regions); float area = 0; - const Region * region = NULL; + const Region * region = nullptr; for (std::vector::const_iterator iter = regions.begin(); iter != regions.end(); ++iter) { - if (region == NULL) + if (region == nullptr) { region = *iter; area = region->getArea(); @@ -983,19 +983,19 @@ const Region * RegionMaster::getSmallestVisibleRegionAtPoint(const std::string & if (!ms_installed) { WARNING(true, ("RegionMaster::getSmallestRegionAtPoint, not installed")); - return NULL; + return nullptr; } std::vector regions; getRegionsAtPoint(planet, x, z, regions); float area = 0; - const Region * region = NULL; + const Region * region = nullptr; for (std::vector::const_iterator iter = regions.begin(); iter != regions.end(); ++iter) { if ((*iter)->isVisible()) { - if (region == NULL) + if (region == nullptr) { region = *iter; area = region->getArea(); @@ -1036,7 +1036,7 @@ void RegionMaster::getRegionsAtPoint(const std::string & planet, float x, float } const RegionData & regionData = ms_planetRegions[planet]; - if (regionData.tree != NULL) + if (regionData.tree != nullptr) { std::vector objects; regionData.tree->getObjectsAt(x, z, objects); @@ -1065,7 +1065,7 @@ void RegionMaster::getRegionsForPlanet(const std::string & planetName, } const RegionData & regionData = ms_planetRegions[planetName]; - if (regionData.tree != NULL) + if (regionData.tree != nullptr) { std::vector objects; regionData.tree->getAllObjects(objects); @@ -1222,7 +1222,7 @@ bool RegionMaster::setDynamicSpawnRegionObjectData(UniverseObject & object, int municipal, int geography, int minDifficulty, int maxDifficulty, int spawnable, int mission, bool visible, bool notify, std::string spawntable, int duration) { - time_t const birthEpoch = ::time(NULL); + time_t const birthEpoch = ::time(nullptr); time_t const endEpoch = birthEpoch + (duration * 60); // Duration is in minutes. object.setObjVarItem(OBJVAR_DYNAMIC_REGION + "." + OBJVAR_DYNAMIC_REGION_NAME, name); diff --git a/engine/server/library/serverGame/src/shared/resource/SurveySystem.cpp b/engine/server/library/serverGame/src/shared/resource/SurveySystem.cpp index cac26554..93c8f549 100755 --- a/engine/server/library/serverGame/src/shared/resource/SurveySystem.cpp +++ b/engine/server/library/serverGame/src/shared/resource/SurveySystem.cpp @@ -132,7 +132,7 @@ bool SurveySystem::TaskSurvey::run() Client const * client = GameServer::getInstance().getClient(m_playerId); ResourceTypeObject const * typeObj = ServerUniverse::getInstance().getResourceTypeByName(*m_resourceTypeName); ResourceClassObject const * parentClass = ServerUniverse::getInstance().getResourceClassByName(*m_parentResourceClassName); - ResourcePoolObject const * pool = typeObj ? typeObj->getPoolForCurrentPlanet() : NULL; + ResourcePoolObject const * pool = typeObj ? typeObj->getPoolForCurrentPlanet() : nullptr; int distBetweenPoints = m_surveyRange / (m_numPoints - 1); // -1 is so that we get points at both ends int radius = m_surveyRange / 2; diff --git a/engine/server/library/serverGame/src/shared/space/Missile.cpp b/engine/server/library/serverGame/src/shared/space/Missile.cpp index bd4400a5..67582022 100755 --- a/engine/server/library/serverGame/src/shared/space/Missile.cpp +++ b/engine/server/library/serverGame/src/shared/space/Missile.cpp @@ -304,7 +304,7 @@ ServerObject * Missile::getSourceServerObject() const if (sourceObject) return sourceObject->asServerObject(); else - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -315,7 +315,7 @@ ServerObject * Missile::getTargetServerObject() const if (targetObject) return targetObject->asServerObject(); else - return NULL; + return nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/space/MissileManager.cpp b/engine/server/library/serverGame/src/shared/space/MissileManager.cpp index ab30ae81..512696ff 100755 --- a/engine/server/library/serverGame/src/shared/space/MissileManager.cpp +++ b/engine/server/library/serverGame/src/shared/space/MissileManager.cpp @@ -21,7 +21,7 @@ // ====================================================================== -MissileManager * MissileManager::ms_instance = NULL; +MissileManager * MissileManager::ms_instance = nullptr; // ====================================================================== @@ -37,7 +37,7 @@ void MissileManager::install() void MissileManager::remove() { delete ms_instance; - ms_instance = NULL; + ms_instance = nullptr; } // ---------------------------------------------------------------------- @@ -217,7 +217,7 @@ Missile * MissileManager::getMissile(int missileId) if (i!=m_missiles.end()) return i->second; else - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -228,7 +228,7 @@ const Missile * MissileManager::getConstMissile(int missileId) const if (i!=m_missiles.end()) return i->second; else - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -241,13 +241,13 @@ int MissileManager::getNearestUnlockedMissileForTarget(const NetworkId &target) { const std::pair range=m_missilesForTarget.equal_range(target); - const Missile *targetedMissile=NULL; + const Missile *targetedMissile=nullptr; for (MissilesForTargetType::const_iterator i=range.first; i!=range.second; ++i) { const Missile * const missile=getConstMissile(i->second); DEBUG_FATAL(!missile,("Programmer bug: Missile %i was in m_missilesForTarget, but was not in m_missiles",i->second)); if (missile && missile->getState() == Missile::MS_Launched && - (!targetedMissile || (missile->getImpactTime() < targetedMissile->getImpactTime()))) //lint !e774: missile is non-null in debug mode + (!targetedMissile || (missile->getImpactTime() < targetedMissile->getImpactTime()))) //lint !e774: missile is non-nullptr in debug mode targetedMissile = missile; } @@ -315,7 +315,7 @@ const MissileManager::MissileTypeDataRecord * MissileManager::getMissileTypeData if (i!=m_missileTypeData.end()) return &(i->second); else - return NULL; + return nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/space/NebulaManagerServer.cpp b/engine/server/library/serverGame/src/shared/space/NebulaManagerServer.cpp index 432d57f6..910cbcc3 100755 --- a/engine/server/library/serverGame/src/shared/space/NebulaManagerServer.cpp +++ b/engine/server/library/serverGame/src/shared/space/NebulaManagerServer.cpp @@ -89,7 +89,7 @@ void NebulaManagerServer::update(float elapsedTime) void NebulaManagerServer::enqueueLightning(NebulaLightningData const & nebulaLightningData) { Nebula const * const nebula = NebulaManager::getNebulaById(nebulaLightningData.nebulaId); - if (nebula == NULL) + if (nebula == nullptr) { WARNING(true, ("NebulaManagerServer::enqueueLightning invalid nebula [%d]", nebulaLightningData.nebulaId)); return; @@ -164,7 +164,7 @@ void NebulaManagerServer::handleEnqueuedLightningEvents() NebulaLightningData const & nebulaLightningData = (*it); Nebula const * const nebula = NebulaManager::getNebulaById(nebulaLightningData.nebulaId); - if (nebula == NULL) + if (nebula == nullptr) { it = s_lightningDataVector.erase(it); continue; @@ -203,7 +203,7 @@ void NebulaManagerServer::handleEnqueuedLightningEvents() ServerObject const * const serverHitObject = hitObject->asServerObject(); ShipObject const * const shipHitObject = serverHitObject->asShipObject(); - if (shipHitObject != NULL) + if (shipHitObject != nullptr) { NetworkIdTimeMap::const_iterator const oit = s_objectsRecentlyHitByLightning.find(CachedNetworkId(*hitObject)); if (oit == s_objectsRecentlyHitByLightning.end() || (*oit).second < clockTimeMs) @@ -304,7 +304,7 @@ void NebulaManagerServer::generateLightningEvents(float elapsedTime) void NebulaManagerServer::handleEnvironmentalDamage(ServerObject & victim, int nebulaId) { Nebula const * const nebula = NebulaManager::getNebulaById(nebulaId); - if (nebula == NULL) + if (nebula == nullptr) return; float const environmentalDamageFrequency = nebula->getEnvironmentalDamageFrequency(); diff --git a/engine/server/library/serverGame/src/shared/space/ProjectileManager.cpp b/engine/server/library/serverGame/src/shared/space/ProjectileManager.cpp index 61ff31b3..2354ae60 100755 --- a/engine/server/library/serverGame/src/shared/space/ProjectileManager.cpp +++ b/engine/server/library/serverGame/src/shared/space/ProjectileManager.cpp @@ -85,7 +85,7 @@ namespace ProjectileManagerNamespace //---------------------------------------------------------------------- Projectile() : - m_owner(NULL), + m_owner(nullptr), m_weaponIndex(0), m_projectileIndex(0), m_targetedComponent(0), @@ -155,7 +155,7 @@ namespace ProjectileManagerNamespace ColliderList collidedWith; CollisionWorld::getDatabase()->queryFor(static_cast(SpatialDatabase::Q_Physicals), CellProperty::getWorldCellProperty(), true, projectileCapsule_w, collidedWith); - Object * closestObject = NULL; + Object * closestObject = nullptr; float smallestTime = 0.0f; Vector collisionPosition_o; @@ -166,14 +166,14 @@ namespace ProjectileManagerNamespace { // find which object it collided with first, and when BaseExtent const * const extent_l = (*i)->getExtent_l(); - if (extent_l == NULL) - WARNING(true, ("ProjectileManager collided with object with null extent. [%s], appearance=[%s]", collider.getDebugName(), collider.getAppearanceTemplateName())); + if (extent_l == nullptr) + WARNING(true, ("ProjectileManager collided with object with nullptr extent. [%s], appearance=[%s]", collider.getDebugName(), collider.getAppearanceTemplateName())); else { Vector const start_o = collider.rotateTranslate_w2o(projectilePosition_w); Vector const end_o = collider.rotateTranslate_w2o(projectilePosition_w + projectilePath); float time; - if (extent_l->intersect(start_o, end_o, NULL, &time)) + if (extent_l->intersect(start_o, end_o, nullptr, &time)) { if (!closestObject || time < smallestTime) { @@ -415,7 +415,7 @@ void ProjectileManager::update(float timePassed) // static ShipObject * const shipObject = projectile.getOwner(); - if (NULL == shipObject) + if (nullptr == shipObject) { WARNING(true, ("ProjectileManager beam weapon [%d] for ship id [%s], ship object no longer exists.", weaponIndex, shipId.getValueString().c_str())); } diff --git a/engine/server/library/serverGame/src/shared/space/ServerAsteroidManager.cpp b/engine/server/library/serverGame/src/shared/space/ServerAsteroidManager.cpp index 1a0cfa50..09fb57d0 100755 --- a/engine/server/library/serverGame/src/shared/space/ServerAsteroidManager.cpp +++ b/engine/server/library/serverGame/src/shared/space/ServerAsteroidManager.cpp @@ -116,10 +116,10 @@ ServerAsteroidManager::FieldHandle ServerAsteroidManager::generateField(Asteroid return BAD_HANDLE; } - ServerObject * newAsteroid = NULL; + ServerObject * newAsteroid = nullptr; //TODO disable server-rotation for now, it apparently spams the client horribly -// RotationDynamics * rotationDynamics = NULL; +// RotationDynamics * rotationDynamics = nullptr; for(std::vector::iterator i = asteroidDatas.begin(); i != asteroidDatas.end(); ++i) { @@ -274,7 +274,7 @@ void ServerAsteroidManager::getServerAsteroidData(std::vector & /*OUT*/ for(std::vector::iterator i = ms_asteroids.begin(); i != ms_asteroids.end(); ++i) { Object const * const o = NetworkIdManager::getObjectById(*i); - ServerObject const * const so = o ? o->asServerObject() : NULL; + ServerObject const * const so = o ? o->asServerObject() : nullptr; if(so) { spheres.push_back(so->getSphereExtent()); @@ -297,9 +297,9 @@ void ServerAsteroidManager::sendServerAsteroidDataToPlayer(NetworkId const & pla MessageQueueGenericValueType > * const msg = new MessageQueueGenericValueType >(spheres); Object * const o = NetworkIdManager::getObjectById(player); - ServerObject * const so = o ? o->asServerObject() : NULL; - CreatureObject * const co = so ? so->asCreatureObject() : NULL; - Client const * const client = co ? co->getClient() : NULL; + ServerObject * const so = o ? o->asServerObject() : nullptr; + CreatureObject * const co = so ? so->asCreatureObject() : nullptr; + Client const * const client = co ? co->getClient() : nullptr; if(client && co && co->isAuthoritative()) { co->getController()->appendMessage(static_cast(CM_serverAsteroidDebugData), 0.0f, msg, diff --git a/engine/server/library/serverGame/src/shared/space/ServerShipComponentData.cpp b/engine/server/library/serverGame/src/shared/space/ServerShipComponentData.cpp index b0817411..0fc6e7a6 100755 --- a/engine/server/library/serverGame/src/shared/space/ServerShipComponentData.cpp +++ b/engine/server/library/serverGame/src/shared/space/ServerShipComponentData.cpp @@ -89,7 +89,7 @@ void ServerShipComponentData::writeDataToShip (int const chassisSlot, Ship bool ServerShipComponentData::readDataFromComponent (TangibleObject const & component) { - if (component.getObjectTemplate () == NULL) + if (component.getObjectTemplate () == nullptr) { WARNING (true, ("ShipComponentData [%s] has no object template", component.getNetworkId ().getValueString ().c_str ())); return false; @@ -137,13 +137,13 @@ bool ServerShipComponentData::readDataFromComponent (TangibleObject const & comp void ServerShipComponentData::writeDataToComponent (TangibleObject & component) const { - if (m_descriptor == NULL) + if (m_descriptor == nullptr) { - WARNING (true, ("ShipComponentData::writeDataToComponent [%s] null descriptor", component.getNetworkId ().getValueString ().c_str ())); + WARNING (true, ("ShipComponentData::writeDataToComponent [%s] nullptr descriptor", component.getNetworkId ().getValueString ().c_str ())); return; } - if (component.getObjectTemplate () == NULL) + if (component.getObjectTemplate () == nullptr) { WARNING (true, ("ShipComponentData::writeDataToComponent [%s] has no object template", component.getNetworkId ().getValueString ().c_str ())); return; @@ -180,7 +180,7 @@ void ServerShipComponentData::writeDataToComponent (TangibleObject & component) void ServerShipComponentData::printDebugString (Unicode::String & result, Unicode::String const & padding) const { - if (m_descriptor == NULL) + if (m_descriptor == nullptr) return; char buf [2048]; diff --git a/engine/server/library/serverGame/src/shared/space/ShipAiEnemySearchManager.cpp b/engine/server/library/serverGame/src/shared/space/ShipAiEnemySearchManager.cpp index aca06580..81586895 100755 --- a/engine/server/library/serverGame/src/shared/space/ShipAiEnemySearchManager.cpp +++ b/engine/server/library/serverGame/src/shared/space/ShipAiEnemySearchManager.cpp @@ -60,8 +60,8 @@ void ShipAiEnemySearchManagerNamespace::checkForEnemies(ShipObject &ship) if (shipController) { - AiShipController * const aiShipController = (shipController != NULL) ? shipController->asAiShipController() : NULL; - float const aggroRadiusSquared = sqr((aiShipController != NULL) ? aiShipController->getAggroRadius() : 512.0f); // 512.0f is the distance at which turrets on player ships start getting targets + AiShipController * const aiShipController = (shipController != nullptr) ? shipController->asAiShipController() : nullptr; + float const aggroRadiusSquared = sqr((aiShipController != nullptr) ? aiShipController->getAggroRadius() : 512.0f); // 512.0f is the distance at which turrets on player ships start getting targets Vector const shipPosition_w = ship.getPosition_w(); static std::vector s_visibilityList; @@ -117,7 +117,7 @@ void ShipAiEnemySearchManagerNamespace::checkForEnemies(ShipObject &ship) ShipObject * const enemy = s_enemyList[randomIndex]; ShipController * const enemyShipController = enemy->getController()->asShipController(); - if (enemyShipController != NULL) + if (enemyShipController != nullptr) { // Limit the number of ships that can attack a single enemy diff --git a/engine/server/library/serverGame/src/shared/space/ShipComponentDataCargoHold.cpp b/engine/server/library/serverGame/src/shared/space/ShipComponentDataCargoHold.cpp index ba495697..bf76572c 100755 --- a/engine/server/library/serverGame/src/shared/space/ShipComponentDataCargoHold.cpp +++ b/engine/server/library/serverGame/src/shared/space/ShipComponentDataCargoHold.cpp @@ -165,7 +165,7 @@ void ShipComponentDataCargoHold::printDebugString (Unicode::String & result int const amount = (*it).second; ResourceTypeObject const * const resourceType = ServerUniverse::getInstance().getResourceTypeById(id); - std::string const resourceName = resourceType ? resourceType->getResourceName() : "NULL RESOURCE"; + std::string const resourceName = resourceType ? resourceType->getResourceName() : "nullptr RESOURCE"; snprintf(buf, buf_size, "%s %15s (%s): %3d\n", nPad.c_str (), id.getValueString().c_str(), resourceName.c_str(), amount); result += Unicode::narrowToWide(buf); diff --git a/engine/server/library/serverGame/src/shared/space/ShipComponentDataManager.cpp b/engine/server/library/serverGame/src/shared/space/ShipComponentDataManager.cpp index 60053125..74e9e4f6 100755 --- a/engine/server/library/serverGame/src/shared/space/ShipComponentDataManager.cpp +++ b/engine/server/library/serverGame/src/shared/space/ShipComponentDataManager.cpp @@ -42,16 +42,16 @@ ShipComponentData * ShipComponentDataManager::create (TangibleObject const & com ShipComponentDescriptor const * const shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByObjectTemplate (component.getObjectTemplate ()->getCrcName ().getCrc ()); - if (shipComponentDescriptor == NULL) + if (shipComponentDescriptor == nullptr) { WARNING (true, ("ShipComponentDataManager [%s] [%s] is not a component", component.getNetworkId ().getValueString ().c_str (), component.getObjectTemplateName())); - return NULL; + return nullptr; } ShipComponentData * const shipComponent = create (*shipComponentDescriptor); if (!shipComponent) - return NULL; + return nullptr; shipComponent->readDataFromComponent (component); return shipComponent; @@ -61,7 +61,7 @@ ShipComponentData * ShipComponentDataManager::create (TangibleObject const & com ShipComponentData * ShipComponentDataManager::create (ShipComponentDescriptor const & shipComponentDescriptor) { - ShipComponentData * shipComponent = NULL; + ShipComponentData * shipComponent = nullptr; switch (shipComponentDescriptor.getComponentType ()) { @@ -106,7 +106,7 @@ ShipComponentData * ShipComponentDataManager::create (ShipComponentDescriptor co break; default: WARNING (true, ("ShipComponentDataManager::create descriptor has type [%d] invalid", shipComponentDescriptor.getComponentType ())); - return NULL; + return nullptr; } return shipComponent; diff --git a/engine/server/library/serverGame/src/shared/space/ShipInternalDamageOverTime.cpp b/engine/server/library/serverGame/src/shared/space/ShipInternalDamageOverTime.cpp index 9411fb1b..98f76860 100755 --- a/engine/server/library/serverGame/src/shared/space/ShipInternalDamageOverTime.cpp +++ b/engine/server/library/serverGame/src/shared/space/ShipInternalDamageOverTime.cpp @@ -41,14 +41,14 @@ void ShipInternalDamageOverTime::setDamageThreshold(float damageThreshold) ShipObject * const ShipInternalDamageOverTime::getShipObject() const { Object * const object = m_shipId.getObject(); - if (object != NULL && object->isAuthoritative()) + if (object != nullptr && object->isAuthoritative()) { ServerObject * const serverObject = object->asServerObject(); - if (serverObject != NULL) + if (serverObject != nullptr) return serverObject->asShipObject(); } - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -56,7 +56,7 @@ ShipObject * const ShipInternalDamageOverTime::getShipObject() const bool ShipInternalDamageOverTime::checkValidity(float & hpCurrent, float & hpMaximum) const { ShipObject * const ship = getShipObject(); - if (ship == NULL) + if (ship == nullptr) return false; if (m_chassisSlot < 0 || m_chassisSlot > ShipChassisSlotType::SCST_num_types) @@ -91,7 +91,7 @@ bool ShipInternalDamageOverTime::checkValidity(float & hpCurrent, float & hpMaxi bool ShipInternalDamageOverTime::applyDamage(float elapsedTime, float & damageApplied) const { ShipObject * const ship = getShipObject(); - if (ship == NULL) + if (ship == nullptr) return false; float hpCurrent = 0.0f; diff --git a/engine/server/library/serverGame/src/shared/space/ShipInternalDamageOverTimeManager.cpp b/engine/server/library/serverGame/src/shared/space/ShipInternalDamageOverTimeManager.cpp index 3cc0f54f..475b2504 100755 --- a/engine/server/library/serverGame/src/shared/space/ShipInternalDamageOverTimeManager.cpp +++ b/engine/server/library/serverGame/src/shared/space/ShipInternalDamageOverTimeManager.cpp @@ -39,7 +39,7 @@ namespace ShipInternalDamageOverTimeManagerNamespace { GameScriptObject * const gameScriptObject = ship.getScriptObject(); - if (gameScriptObject != NULL) + if (gameScriptObject != nullptr) { ScriptParams p; p.addParam(idot.getChassisSlot()); @@ -56,7 +56,7 @@ namespace ShipInternalDamageOverTimeManagerNamespace { GameScriptObject * const gameScriptObject = ship.getScriptObject(); - if (gameScriptObject != NULL) + if (gameScriptObject != nullptr) { ScriptParams p; p.addParam(idot.getChassisSlot()); @@ -128,7 +128,7 @@ void ShipInternalDamageOverTimeManager::update(float elapsedTime) ShipObject * const shipObject = idot.getShipObject(); - if (NULL != shipObject) + if (nullptr != shipObject) notifyIdotDamage(*shipObject, idot, damageApplied); } } @@ -150,7 +150,7 @@ void ShipInternalDamageOverTimeManager::update(float elapsedTime) ShipInternalDamageOverTime const & expiredIdot = *it; ShipObject * const shipObject = expiredIdot.getShipObject(); - if (shipObject != NULL) + if (shipObject != nullptr) notifyIdotRemoval(*shipObject, expiredIdot); } } @@ -219,7 +219,7 @@ bool ShipInternalDamageOverTimeManager::removeEntry(ShipObject const & ship, int IGNORE_RETURN(s_idotVector.erase(lowerBound)); ShipObject * const shipObject = lowerBoundIdot.getShipObject(); - if (shipObject != NULL) + if (shipObject != nullptr) notifyIdotRemoval(*shipObject, lowerBoundIdot); return true; @@ -235,13 +235,13 @@ ShipInternalDamageOverTime const * const ShipInternalDamageOverTimeManager::find //-- there is no lower bound, the idot is not in the vector if (lowerBound == s_idotVector.end()) - return NULL; + return nullptr; ShipInternalDamageOverTime & lowerBoundIdot = *lowerBound; //-- the lower bound sorts greater than the new idot, therefore this is a new insertion if (idot < lowerBoundIdot) - return NULL; + return nullptr; return &lowerBoundIdot; } diff --git a/engine/server/library/serverGame/src/shared/space/SpaceAttackSquad.cpp b/engine/server/library/serverGame/src/shared/space/SpaceAttackSquad.cpp index de7693e5..d344d963 100755 --- a/engine/server/library/serverGame/src/shared/space/SpaceAttackSquad.cpp +++ b/engine/server/library/serverGame/src/shared/space/SpaceAttackSquad.cpp @@ -68,7 +68,7 @@ void SpaceAttackSquad::onAddUnit(NetworkId const & unit) { AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != NULL) + if (aiShipController != nullptr) { aiShipController->setAttackSquad(this); } @@ -96,7 +96,7 @@ void SpaceAttackSquad::onNewLeader(NetworkId const & /*oldLeader*/) { AiShipController * const newLeaderAiShipController = AiShipController::getAiShipController(getLeader()); - if (newLeaderAiShipController != NULL) + if (newLeaderAiShipController != nullptr) { m_leaderOffsetPosition_l = -newLeaderAiShipController->getFormationPosition_l(); } @@ -116,7 +116,7 @@ void SpaceAttackSquad::onSetUnitFormationPosition_l(NetworkId const & unit, Vect { AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != NULL) + if (aiShipController != nullptr) { aiShipController->setAttackFormationPosition_l(position_l); } @@ -154,7 +154,7 @@ CachedNetworkId const & SpaceAttackSquad::getPrimaryAttackTarget() const { Object * const leaderObject = getLeader().getObject(); - if (leaderObject != NULL) + if (leaderObject != nullptr) { AiShipController * const leaderAiShipController = AiShipController::asAiShipController(leaderObject->getController()); @@ -163,7 +163,7 @@ CachedNetworkId const & SpaceAttackSquad::getPrimaryAttackTarget() const #ifdef _DEBUG FormattedString<1024> fs; - char const * const text = fs.sprintf("SpaceAttackSquad::getPrimaryAttackTarget() ERROR: Why is the attack squad leader(%s) object NULL?", getLeader().getValueString().c_str()); + char const * const text = fs.sprintf("SpaceAttackSquad::getPrimaryAttackTarget() ERROR: Why is the attack squad leader(%s) object nullptr?", getLeader().getValueString().c_str()); DEBUG_WARNING(true, (text)); LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", (text)); #endif // _DEBUG @@ -176,7 +176,7 @@ bool SpaceAttackSquad::isAttacking() const { Object * const leaderObject = getLeader().getObject(); - if (leaderObject != NULL) + if (leaderObject != nullptr) { AiShipController * const leaderAiShipController = AiShipController::asAiShipController(leaderObject->getController()); @@ -185,7 +185,7 @@ bool SpaceAttackSquad::isAttacking() const #ifdef _DEBUG FormattedString<1024> fs; - char const * const text = fs.sprintf("SpaceAttackSquad::isAttacking() ERROR: Why is the attack squad leader(%s) object NULL?", getLeader().getValueString().c_str()); + char const * const text = fs.sprintf("SpaceAttackSquad::isAttacking() ERROR: Why is the attack squad leader(%s) object nullptr?", getLeader().getValueString().c_str()); DEBUG_WARNING(true, (text)); LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", (text)); #endif // _DEBUG @@ -231,7 +231,7 @@ int SpaceAttackSquad::getMaxNumberOfUnits() const NetworkId const & unit = unitMap.begin()->first; AiShipController * const unitAiShipController = AiShipController::getAiShipController(unit); - if (unitAiShipController != NULL) + if (unitAiShipController != nullptr) { if (unitAiShipController->getAttackOrders() == AiShipController::AO_holdFire) { @@ -282,10 +282,10 @@ void SpaceAttackSquad::calculateAttackRanges() { CachedNetworkId const & unit = iterUnitMap->first; Object * const unitObject = unit.getObject(); - ServerObject * const unitServerObject = (unitObject != NULL) ? unitObject->asServerObject() : NULL; - ShipObject * const unitShipObject = (unitServerObject != NULL) ? unitServerObject->asShipObject() : NULL; + ServerObject * const unitServerObject = (unitObject != nullptr) ? unitObject->asServerObject() : nullptr; + ShipObject * const unitShipObject = (unitServerObject != nullptr) ? unitServerObject->asShipObject() : nullptr; - if (unitShipObject != NULL) + if (unitShipObject != nullptr) { m_projectileAttackRange = std::min(m_projectileAttackRange, unitShipObject->getApproximateAttackRange()); @@ -328,10 +328,10 @@ void SpaceAttackSquad::assignNewLeader() { CachedNetworkId const & unit = iterUnitMap->first; Object * const unitObject = unit.getObject(); - ServerObject * const unitServerObject = (unitObject != NULL) ? unitObject->asServerObject() : NULL; - ShipObject * const unitShipObject = (unitServerObject != NULL) ? unitServerObject->asShipObject() : NULL; + ServerObject * const unitServerObject = (unitObject != nullptr) ? unitObject->asServerObject() : nullptr; + ShipObject * const unitShipObject = (unitServerObject != nullptr) ? unitServerObject->asShipObject() : nullptr; - if (unitShipObject != NULL) + if (unitShipObject != nullptr) { if (unitShipObject->isComponentFunctional(ShipChassisSlotType::SCST_engine)) { diff --git a/engine/server/library/serverGame/src/shared/space/SpaceDockingManager.cpp b/engine/server/library/serverGame/src/shared/space/SpaceDockingManager.cpp index c836be74..4e4a9821 100755 --- a/engine/server/library/serverGame/src/shared/space/SpaceDockingManager.cpp +++ b/engine/server/library/serverGame/src/shared/space/SpaceDockingManager.cpp @@ -78,7 +78,7 @@ namespace SpaceDockingManagerNamespace explicit DockableShip(Object const & object) : m_dockPadList() { - if (object.getAppearance() != NULL) + if (object.getAppearance() != nullptr) { // What dock pads do we have, and what are their radii @@ -176,7 +176,7 @@ float SpaceDockingManagerNamespace::getCollisionRadius(Object const & object) CollisionProperty const * const collisionProperty = object.getCollisionProperty(); float radius = 0.0f; - if (collisionProperty != NULL) + if (collisionProperty != nullptr) { radius = collisionProperty->getBoundingSphere_l().getRadius(); } @@ -257,7 +257,7 @@ bool SpaceDockingManagerNamespace::getHardPoints(Object const & object, char con hardPointList.clear(); - if (object.getAppearance() != NULL) + if (object.getAppearance() != nullptr) { int hardPointIndex = 1; bool done = false; diff --git a/engine/server/library/serverGame/src/shared/space/SpacePath.cpp b/engine/server/library/serverGame/src/shared/space/SpacePath.cpp index 6c50cee8..9834532b 100755 --- a/engine/server/library/serverGame/src/shared/space/SpacePath.cpp +++ b/engine/server/library/serverGame/src/shared/space/SpacePath.cpp @@ -96,7 +96,7 @@ bool SpacePath::isEmpty() const // ---------------------------------------------------------------------- void SpacePath::addReference(void const * const object, float const objectSize) { - DEBUG_FATAL(object == NULL, ("Passing a NULL object into path 0x%p.", this)); + DEBUG_FATAL(object == nullptr, ("Passing a nullptr object into path 0x%p.", this)); ++m_referenceCount; @@ -112,7 +112,7 @@ void SpacePath::addReference(void const * const object, float const objectSize) // ---------------------------------------------------------------------- void SpacePath::releaseReference(void const * const object) { - DEBUG_FATAL(object == NULL, ("Passing a NULL object into path 0x%p.", this)); + DEBUG_FATAL(object == nullptr, ("Passing a nullptr object into path 0x%p.", this)); if (--m_referenceCount < 0) { @@ -178,7 +178,7 @@ bool SpacePath::refine(int & pathRefinementsAvailable) Vector avoidancePosition_w; - bool const pathAdjusted = SpaceAvoidanceManager::getAvoidancePosition(currentTransform, collisionRadius, sweepVector, nextPosition_w, avoidancePosition_w, NULL); + bool const pathAdjusted = SpaceAvoidanceManager::getAvoidancePosition(currentTransform, collisionRadius, sweepVector, nextPosition_w, avoidancePosition_w, nullptr); if (pathAdjusted) { newTransform.setPosition_p(avoidancePosition_w); @@ -278,7 +278,7 @@ void SpacePath::requestPathResize() // ---------------------------------------------------------------------- bool SpacePath::updateCollisionRadius(void const * const object, float const objectSize) { - DEBUG_FATAL(object == NULL, ("Passing a NULL object into path(0x%p) updateCollisionRadius.", this)); + DEBUG_FATAL(object == nullptr, ("Passing a nullptr object into path(0x%p) updateCollisionRadius.", this)); bool requiresPathUpdate = false; diff --git a/engine/server/library/serverGame/src/shared/space/SpacePathManager.cpp b/engine/server/library/serverGame/src/shared/space/SpacePathManager.cpp index 79256ad5..2d9d088c 100755 --- a/engine/server/library/serverGame/src/shared/space/SpacePathManager.cpp +++ b/engine/server/library/serverGame/src/shared/space/SpacePathManager.cpp @@ -59,9 +59,9 @@ void SpacePathManager::remove() // ---------------------------------------------------------------------- SpacePath * SpacePathManager::fetch(SpacePath * const path, void const * const object, float const objectRadius) { - SpacePath * result = NULL; + SpacePath * result = nullptr; - if (path == NULL) + if (path == nullptr) { // This is a new path, add it to the list @@ -105,7 +105,7 @@ SpacePath * SpacePathManager::fetch(SpacePath * const path, void const * const o // ---------------------------------------------------------------------- void SpacePathManager::release(SpacePath * const path, void const * const object) { - if (path == NULL) + if (path == nullptr) { return; } diff --git a/engine/server/library/serverGame/src/shared/space/SpaceSquad.cpp b/engine/server/library/serverGame/src/shared/space/SpaceSquad.cpp index 332188c6..9b998274 100755 --- a/engine/server/library/serverGame/src/shared/space/SpaceSquad.cpp +++ b/engine/server/library/serverGame/src/shared/space/SpaceSquad.cpp @@ -95,7 +95,7 @@ void SpaceSquad::remove() // ---------------------------------------------------------------------- SpaceSquad::SpaceSquad() : Squad() - , m_guardTarget(NULL) + , m_guardTarget(nullptr) , m_guardedByList(new SpaceSquadList) , m_attackSquadList(new AttackSquadList) , m_guarding(false) @@ -109,10 +109,10 @@ SpaceSquad::~SpaceSquad() { // The the squad that I am guarding that I am no longer guarding it - if (m_guardTarget != NULL) + if (m_guardTarget != nullptr) { removeGuardTarget(); - m_guardTarget = NULL; + m_guardTarget = nullptr; } // Tell all the squads guarding me that I am not longer guardable @@ -156,7 +156,7 @@ SpacePath * SpaceSquad::getPath() const AiShipController * const aiShipController = AiShipController::getAiShipController(getLeader()); - return NULL != aiShipController ? aiShipController->getPath() : NULL; + return nullptr != aiShipController ? aiShipController->getPath() : nullptr; } // ---------------------------------------------------------------------- @@ -194,7 +194,7 @@ void SpaceSquad::track(Object const & target) const // ---------------------------------------------------------------------- void SpaceSquad::moveTo(SpacePath * const path) const { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("SpaceSquad::moveTo() squadId(%d) path(0x%p) pathSize(%u)", getId(), path, (path != NULL) ? path->getTransformList().size() : 0)); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("SpaceSquad::moveTo() squadId(%d) path(0x%p) pathSize(%u)", getId(), path, (path != nullptr) ? path->getTransformList().size() : 0)); UnitMap const & unitMap = getUnitMap(); UnitMap::const_iterator iterUnitMap = unitMap.begin(); @@ -210,7 +210,7 @@ void SpaceSquad::moveTo(SpacePath * const path) const // ---------------------------------------------------------------------- void SpaceSquad::addPatrolPath(SpacePath * const path) const { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("SpaceSquad::addPatrolPath() squadId(%d) squadSize(%u) path(0x%p) pathSize(%u)", getId(), getUnitMap().size(), path, (path != NULL) ? path->getTransformList().size() : 0)); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("SpaceSquad::addPatrolPath() squadId(%d) squadSize(%u) path(0x%p) pathSize(%u)", getId(), getUnitMap().size(), path, (path != nullptr) ? path->getTransformList().size() : 0)); UnitMap const & unitMap = getUnitMap(); UnitMap::const_iterator iterUnitMap = unitMap.begin(); @@ -293,7 +293,7 @@ bool SpaceSquad::setGuardTarget(int const squadId) #endif // _DEBUG } - return (m_guardTarget != NULL); + return (m_guardTarget != nullptr); } // ---------------------------------------------------------------------- @@ -305,14 +305,14 @@ SpaceSquad * SpaceSquad::getGuardTarget() // ---------------------------------------------------------------------- void SpaceSquad::removeGuardTarget() { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("SpaceSquad::removeGuardTarget() squadId(%d) guardedBySquad(%d)", getId(), (m_guardTarget != NULL) ? m_guardTarget->getId() : 0)); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("SpaceSquad::removeGuardTarget() squadId(%d) guardedBySquad(%d)", getId(), (m_guardTarget != nullptr) ? m_guardTarget->getId() : 0)); //-- Tell the guard target it's no longer being guarded - if (m_guardTarget != NULL) + if (m_guardTarget != nullptr) { m_guardTarget->removeGuardedBy(*this); - m_guardTarget = NULL; + m_guardTarget = nullptr; } } @@ -360,7 +360,7 @@ void SpaceSquad::onAddUnit(NetworkId const & unit) { AiShipController * unitAiShipController = AiShipController::getAiShipController(unit); - if (unitAiShipController != NULL) + if (unitAiShipController != nullptr) { unitAiShipController->setSquad(this); @@ -391,12 +391,12 @@ void SpaceSquad::onNewLeader(NetworkId const & oldLeader) { AiShipController * const newLeaderAiShipController = AiShipController::getAiShipController(getLeader()); - if (newLeaderAiShipController != NULL) + if (newLeaderAiShipController != nullptr) { AiShipController * const oldLeaderAiShipController = AiShipController::getAiShipController(oldLeader); - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled() && (oldLeaderAiShipController == NULL) && (getUnitCount() > 1), "space_debug_ai", ("Squad::onNewLeader() ERROR: The old leader(%s) could not resolve to an AiShipController.", oldLeader.getValueString().c_str())); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled() && (oldLeaderAiShipController == nullptr) && (getUnitCount() > 1), "space_debug_ai", ("Squad::onNewLeader() ERROR: The old leader(%s) could not resolve to an AiShipController.", oldLeader.getValueString().c_str())); - if (oldLeaderAiShipController != NULL) + if (oldLeaderAiShipController != nullptr) { newLeaderAiShipController->setCurrentPathIndex(oldLeaderAiShipController->getCurrentPathIndex()); } @@ -420,7 +420,7 @@ void SpaceSquad::onSetUnitFormationPosition_l(NetworkId const & unit, Vector con { AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != NULL) + if (aiShipController != nullptr) { aiShipController->setFormationPosition_l(position_l); } @@ -457,13 +457,13 @@ void SpaceSquad::alter(float const deltaSeconds) AiShipController const * const leaderAiShipController = AiShipController::getAiShipController(getLeader()); - if (leaderAiShipController != NULL) + if (leaderAiShipController != nullptr) { if (isGuarding()) { SpaceSquad * const guardTarget = getGuardTarget(); - if (guardTarget != NULL) + if (guardTarget != nullptr) { m_leashAnchorPosition_w = guardTarget->getSquadPosition_w(); } @@ -499,7 +499,7 @@ void SpaceSquad::assignNewLeader() CachedNetworkId const & unit = iterUnitMap->first; AiShipController const * const unitAiShipController = AiShipController::getAiShipController(unit); - if (unitAiShipController != NULL) + if (unitAiShipController != nullptr) { if ( unitAiShipController->getShipOwner()->isComponentFunctional(ShipChassisSlotType::SCST_engine) && !unitAiShipController->isAttacking() @@ -550,7 +550,7 @@ bool SpaceSquad::isGuarding() const && !m_guardTarget) { FormattedString<1024> fs; - char const * const text = fs.sprintf("SpaceSquad::isGuarding() squadId(%d) ERROR: Why are we guarding a NULL guard target?", getId()); + char const * const text = fs.sprintf("SpaceSquad::isGuarding() squadId(%d) ERROR: Why are we guarding a nullptr guard target?", getId()); DEBUG_WARNING(true, (text)); LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", (text)); } @@ -572,7 +572,7 @@ bool SpaceSquad::isAttackTargetListEmpty() const NetworkId const & unit = iterUnitMap->first; AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if ( (aiShipController != NULL) + if ( (aiShipController != nullptr) && !aiShipController->getAttackTargetList().isEmpty()) { result = false; @@ -623,10 +623,10 @@ Vector SpaceSquad::getAvoidanceVector(ShipObject const & unit) const } Object * const squadUnitObject = squadUnit.getObject(); - ServerObject * const squadUnitServerObject = (squadUnitObject != NULL) ? squadUnitObject->asServerObject() : NULL; - ShipObject * const squadUnitShipObject = (squadUnitServerObject != NULL) ? squadUnitServerObject->asShipObject() : NULL; + ServerObject * const squadUnitServerObject = (squadUnitObject != nullptr) ? squadUnitObject->asServerObject() : nullptr; + ShipObject * const squadUnitShipObject = (squadUnitServerObject != nullptr) ? squadUnitServerObject->asShipObject() : nullptr; - if (squadUnitShipObject != NULL) + if (squadUnitShipObject != nullptr) { Vector const & unitPosition_w = unit.getPosition_w(); Vector const & squadUnitPosition_w = squadUnitShipObject->getPosition_w(); @@ -760,7 +760,7 @@ float SpaceSquad::getLargestShipRadius() const { CachedNetworkId const & unit = iterUnitMap->first; Object const * const unitObject = unit.getObject(); - ServerObject const * const unitServerObject = unitObject ? unitObject->asServerObject() : NULL; + ServerObject const * const unitServerObject = unitObject ? unitObject->asServerObject() : nullptr; if (unitServerObject) { @@ -787,7 +787,7 @@ void SpaceSquad::refreshPathInfo() const { CachedNetworkId const & unit = iterUnitMap->first; Object const * const unitObject = unit.getObject(); - ServerObject const * const unitServerObject = unitObject ? unitObject->asServerObject() : NULL; + ServerObject const * const unitServerObject = unitObject ? unitObject->asServerObject() : nullptr; if (unitObject && unitServerObject) { IGNORE_RETURN(path->updateCollisionRadius(unitObject, unitServerObject->getRadius())); diff --git a/engine/server/library/serverGame/src/shared/space/SpaceSquadManager.cpp b/engine/server/library/serverGame/src/shared/space/SpaceSquadManager.cpp index 3a93d451..f2dc3552 100755 --- a/engine/server/library/serverGame/src/shared/space/SpaceSquadManager.cpp +++ b/engine/server/library/serverGame/src/shared/space/SpaceSquadManager.cpp @@ -194,7 +194,7 @@ bool SpaceSquadManager::setSquadId(NetworkId const & unit, int const newSquadId) bool result = false; AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != NULL) + if (aiShipController != nullptr) { result = true; @@ -239,7 +239,7 @@ bool SpaceSquadManager::setSquadId(NetworkId const & unit, int const newSquadId) // ---------------------------------------------------------------------- SpaceSquad * SpaceSquadManager::getSquad(int const squadId) { - SpaceSquad * result = NULL; + SpaceSquad * result = nullptr; SquadList::const_iterator iterSpaceSquadList = s_squadList.find(squadId); if (iterSpaceSquadList != s_squadList.end()) diff --git a/engine/server/library/serverGame/src/shared/space/SpaceVisibilityManager.cpp b/engine/server/library/serverGame/src/shared/space/SpaceVisibilityManager.cpp index 9113d33f..70f5bbef 100755 --- a/engine/server/library/serverGame/src/shared/space/SpaceVisibilityManager.cpp +++ b/engine/server/library/serverGame/src/shared/space/SpaceVisibilityManager.cpp @@ -141,7 +141,7 @@ void SpaceVisibilityManager::addClient(Client & client, ServerObject & observing DEBUG_REPORT_LOG(ConfigServerGame::getDebugSpaceVisibilityManager(),("SpaceVisibilityManager::addClient(Client & client, %s);\n",observingObject.getNetworkId().getValueString().c_str())); TrackedObjectsType::iterator i=ms_trackedObjects.find(observingObject.getNetworkId()); - TrackedObject *to=NULL; + TrackedObject *to=nullptr; if (i!=ms_trackedObjects.end()) { to=i->second; @@ -244,7 +244,7 @@ void SpaceVisibilityManager::removeObject(ServerObject & object) if (!vis) //lint !e774 //always false (in debug build only) return; delete vis; - vis=NULL; + vis=nullptr; object.removeNotification(VisibleObjectNotification::getInstance(),true); } @@ -534,7 +534,7 @@ TrackedObject::TrackedObject(const ServerObject &object, int updateRadius) : m_object(object), m_updateRadius(updateRadius), m_currentLocation(NodeId(object.getPosition_w())), - m_clients(NULL) + m_clients(nullptr) { ms_trackedObjects[object.getNetworkId()]=this; addToNodesInRange(*this, m_currentLocation, updateRadius); @@ -554,7 +554,7 @@ TrackedObject::~TrackedObject() } delete m_clients; - m_clients=NULL; + m_clients=nullptr; } removeFromNodesInRange(*this, m_currentLocation, m_updateRadius); @@ -572,7 +572,7 @@ const CachedNetworkId & TrackedObject::getNetworkId() const bool TrackedObject::hasClients() const { - return (m_clients != NULL); + return (m_clients != nullptr); } // ---------------------------------------------------------------------- @@ -594,7 +594,7 @@ void TrackedObject::removeClient(Client &client) if (m_clients->empty()) { delete m_clients; - m_clients=NULL; + m_clients=nullptr; getNode(m_currentLocation).removeObservingObject(*this); } diff --git a/engine/server/library/serverGame/src/shared/synchronizedUi/InstallationSynchronizedUi.cpp b/engine/server/library/serverGame/src/shared/synchronizedUi/InstallationSynchronizedUi.cpp index ca2e7048..b074a95d 100755 --- a/engine/server/library/serverGame/src/shared/synchronizedUi/InstallationSynchronizedUi.cpp +++ b/engine/server/library/serverGame/src/shared/synchronizedUi/InstallationSynchronizedUi.cpp @@ -87,7 +87,7 @@ namespace InstallationSynchronizedUiNamespace InstallationResourceData makeInstallationResourceData (const NetworkId & id, const Vector & position) { ResourceTypeObject const * const rto = ServerUniverse::getInstance().getResourceTypeById(id); - ResourcePoolObject const * const pool = rto ? rto->getPoolForCurrentPlanet() : NULL; + ResourcePoolObject const * const pool = rto ? rto->getPoolForCurrentPlanet() : nullptr; if (rto && pool) { std::string const & resourceTypeParent = rto->getParentClass().getResourceClassName(); @@ -219,7 +219,7 @@ void InstallationSynchronizedUi::resetResourcePools () HarvesterInstallationObject * const harvester = dynamic_cast(getOwner ()); NOT_NULL (harvester); - if (harvester) //lint !e774 // harvester is not NULL in debug + if (harvester) //lint !e774 // harvester is not nullptr in debug { std::vector const & pools = harvester->getSurveyTypes(); for (std::vector::const_iterator i=pools.begin(); i!=pools.end(); ++i) diff --git a/engine/server/library/serverGame/src/shared/trading/ServerSecureTrade.cpp b/engine/server/library/serverGame/src/shared/trading/ServerSecureTrade.cpp index a0b2f63b..c486c67f 100755 --- a/engine/server/library/serverGame/src/shared/trading/ServerSecureTrade.cpp +++ b/engine/server/library/serverGame/src/shared/trading/ServerSecureTrade.cpp @@ -385,7 +385,7 @@ void ServerSecureTrade::completeTrade() } if (dynamic_cast(item)) { - if (!ContainerInterface::canTransferTo(recipientInventory, *item, NULL, errorCode)) + if (!ContainerInterface::canTransferTo(recipientInventory, *item, nullptr, errorCode)) { ContainerInterface::sendContainerMessageToClient(*m_initiator, errorCode); ContainerInterface::sendContainerMessageToClient(*m_recipient, errorCode); @@ -397,7 +397,7 @@ void ServerSecureTrade::completeTrade() } else { - if (!ContainerInterface::canTransferTo(recipientDatapad, *item, NULL, errorCode)) + if (!ContainerInterface::canTransferTo(recipientDatapad, *item, nullptr, errorCode)) { ContainerInterface::sendContainerMessageToClient(*m_initiator, errorCode); ContainerInterface::sendContainerMessageToClient(*m_recipient, errorCode); @@ -423,7 +423,7 @@ void ServerSecureTrade::completeTrade() } if (dynamic_cast(item)) { - if (!ContainerInterface::canTransferTo(initiatorInventory, *item, NULL, errorCode)) + if (!ContainerInterface::canTransferTo(initiatorInventory, *item, nullptr, errorCode)) { ContainerInterface::sendContainerMessageToClient(*m_initiator, errorCode); ContainerInterface::sendContainerMessageToClient(*m_recipient, errorCode); @@ -434,7 +434,7 @@ void ServerSecureTrade::completeTrade() } else { - if (!ContainerInterface::canTransferTo(initiatorDatapad, *item, NULL, errorCode)) + if (!ContainerInterface::canTransferTo(initiatorDatapad, *item, nullptr, errorCode)) { ContainerInterface::sendContainerMessageToClient(*m_initiator, errorCode); ContainerInterface::sendContainerMessageToClient(*m_recipient, errorCode); @@ -516,7 +516,7 @@ void ServerSecureTrade::completeTrade() NOT_NULL(item); if (dynamic_cast(item)) { - if (!ContainerInterface::transferItemToVolumeContainer(*recipientInventory, *item, NULL, errorCode)) + if (!ContainerInterface::transferItemToVolumeContainer(*recipientInventory, *item, nullptr, errorCode)) { DEBUG_FATAL(true, ("Secure trade transfer failure in initiator transfer!!\n")); LOG("CustomerService", ("Trade:%s FAILED TO receive %s from %s", PlayerObject::getAccountDescription(m_recipient->getNetworkId()).c_str(), ServerObject::getLogDescription(item).c_str(), PlayerObject::getAccountDescription(m_initiator->getNetworkId()).c_str())); @@ -529,7 +529,7 @@ void ServerSecureTrade::completeTrade() } else { - if (!ContainerInterface::transferItemToVolumeContainer(*recipientDatapad, *item, NULL, errorCode)) + if (!ContainerInterface::transferItemToVolumeContainer(*recipientDatapad, *item, nullptr, errorCode)) { DEBUG_FATAL(true, ("Secure trade transfer failure in initiator transfer!!\n")); LOG("CustomerService", ("Trade:%s FAILED TO receive %s from %s", PlayerObject::getAccountDescription(m_recipient->getNetworkId()).c_str(), ServerObject::getLogDescription(item).c_str(), PlayerObject::getAccountDescription(m_initiator->getNetworkId()).c_str())); @@ -550,7 +550,7 @@ void ServerSecureTrade::completeTrade() NOT_NULL(item); if (dynamic_cast(item)) { - if (!ContainerInterface::transferItemToVolumeContainer(*initiatorInventory, *item, NULL, errorCode)) + if (!ContainerInterface::transferItemToVolumeContainer(*initiatorInventory, *item, nullptr, errorCode)) { DEBUG_FATAL(true, ("Secure trade transfer failure in recipient transfer!!\n")); LOG("CustomerService", ("Trade:%s FAILED TO receive %s from %s", PlayerObject::getAccountDescription(m_initiator->getNetworkId()).c_str(), ServerObject::getLogDescription(item).c_str(), PlayerObject::getAccountDescription(m_recipient->getNetworkId()).c_str())); @@ -564,7 +564,7 @@ void ServerSecureTrade::completeTrade() } else { - if (!ContainerInterface::transferItemToVolumeContainer(*initiatorDatapad, *item, NULL, errorCode)) + if (!ContainerInterface::transferItemToVolumeContainer(*initiatorDatapad, *item, nullptr, errorCode)) { DEBUG_FATAL(true, ("Secure trade transfer failure in recipient transfer!!\n")); LOG("CustomerService", ("Trade:%s FAILED TO receive %s from %s", PlayerObject::getAccountDescription(m_initiator->getNetworkId()).c_str(), ServerObject::getLogDescription(item).c_str(), PlayerObject::getAccountDescription(m_recipient->getNetworkId()).c_str())); @@ -602,12 +602,12 @@ void ServerSecureTrade::logTradeitemContents(const CreatureObject & to, const ServerObject & item, const CreatureObject & from) const { const Container * container = ContainerInterface::getContainer(item); - if (container != NULL) + if (container != nullptr) { for (ContainerConstIterator i = container->begin(); i != container->end(); ++i) { const Object * o = (*i).getObject(); - if (o != NULL) + if (o != nullptr) { const ServerObject * content = safe_cast(o); LOG("CustomerService", ("Trade:%s received %s contained in %s from %s", diff --git a/engine/server/library/serverNetworkMessages/src/shared/TaskConnectionIdMessage.cpp b/engine/server/library/serverNetworkMessages/src/shared/TaskConnectionIdMessage.cpp index 525fc1b6..2f314ed8 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/TaskConnectionIdMessage.cpp +++ b/engine/server/library/serverNetworkMessages/src/shared/TaskConnectionIdMessage.cpp @@ -14,7 +14,7 @@ GameNetworkMessage("TaskConnectionIdMessage"), serverType(static_cast(id)), commandLine(pCommandLine), clusterName(pClusterName), -currentEpochTime(static_cast(::time(NULL))) +currentEpochTime(static_cast(::time(nullptr))) { addVariable(serverType); addVariable(commandLine); diff --git a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AccountFeatureIdResponse.cpp b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AccountFeatureIdResponse.cpp index b7417e7b..f51e9f06 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AccountFeatureIdResponse.cpp +++ b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AccountFeatureIdResponse.cpp @@ -10,7 +10,7 @@ // ====================================================================== -AccountFeatureIdResponse::AccountFeatureIdResponse(NetworkId const & requester, uint32 gameServer, NetworkId const & target, StationId targetStationId, uint32 gameCode, AccountFeatureIdRequest::RequestReason requestReason, unsigned int resultCode, bool resultCameFromSession, std::map const & featureIds, std::map const & sessionFeatureIdsData, const char * sessionResultString /*= NULL*/, const char * sessionResultText /*= NULL*/) : +AccountFeatureIdResponse::AccountFeatureIdResponse(NetworkId const & requester, uint32 gameServer, NetworkId const & target, StationId targetStationId, uint32 gameCode, AccountFeatureIdRequest::RequestReason requestReason, unsigned int resultCode, bool resultCameFromSession, std::map const & featureIds, std::map const & sessionFeatureIdsData, const char * sessionResultString /*= nullptr*/, const char * sessionResultText /*= nullptr*/) : GameNetworkMessage("AccountFeatureIdResponse"), m_requester(requester), m_gameServer(gameServer), diff --git a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AccountFeatureIdResponse.h b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AccountFeatureIdResponse.h index 3bf69cd3..356d75e6 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AccountFeatureIdResponse.h +++ b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AccountFeatureIdResponse.h @@ -19,7 +19,7 @@ class AccountFeatureIdResponse : public GameNetworkMessage { public: - AccountFeatureIdResponse (NetworkId const & requester, uint32 gameServer, NetworkId const & target, StationId targetStationId, uint32 gameCode, AccountFeatureIdRequest::RequestReason requestReason, unsigned int resultCode, bool resultCameFromSession, std::map const & featureIds, std::map const & sessionFeatureIdsData, const char * sessionResultString = NULL, const char * sessionResultText = NULL); + AccountFeatureIdResponse (NetworkId const & requester, uint32 gameServer, NetworkId const & target, StationId targetStationId, uint32 gameCode, AccountFeatureIdRequest::RequestReason requestReason, unsigned int resultCode, bool resultCameFromSession, std::map const & featureIds, std::map const & sessionFeatureIdsData, const char * sessionResultString = nullptr, const char * sessionResultText = nullptr); AccountFeatureIdResponse (Archive::ReadIterator & source); virtual ~AccountFeatureIdResponse (); diff --git a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AdjustAccountFeatureIdResponse.cpp b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AdjustAccountFeatureIdResponse.cpp index 55ec5da9..5a118fce 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AdjustAccountFeatureIdResponse.cpp +++ b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AdjustAccountFeatureIdResponse.cpp @@ -10,7 +10,7 @@ // ====================================================================== -AdjustAccountFeatureIdResponse::AdjustAccountFeatureIdResponse(NetworkId const & requestingPlayer, uint32 gameServer, NetworkId const & targetPlayer, std::string const & targetPlayerDescription, StationId targetStationId, NetworkId const & targetItem, std::string const & targetItemDescription, uint32 gameCode, uint32 featureId, int oldValue, int newValue, unsigned int resultCode, bool resultCameFromSession, const char * sessionResultString /*= NULL*/, const char * sessionResultText /*= NULL*/) : +AdjustAccountFeatureIdResponse::AdjustAccountFeatureIdResponse(NetworkId const & requestingPlayer, uint32 gameServer, NetworkId const & targetPlayer, std::string const & targetPlayerDescription, StationId targetStationId, NetworkId const & targetItem, std::string const & targetItemDescription, uint32 gameCode, uint32 featureId, int oldValue, int newValue, unsigned int resultCode, bool resultCameFromSession, const char * sessionResultString /*= nullptr*/, const char * sessionResultText /*= nullptr*/) : GameNetworkMessage("AdjustAccountFeatureIdResponse"), m_requestingPlayer(requestingPlayer), m_gameServer(gameServer), diff --git a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AdjustAccountFeatureIdResponse.h b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AdjustAccountFeatureIdResponse.h index 940937ac..cecf0530 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AdjustAccountFeatureIdResponse.h +++ b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AdjustAccountFeatureIdResponse.h @@ -18,7 +18,7 @@ class AdjustAccountFeatureIdResponse : public GameNetworkMessage { public: - AdjustAccountFeatureIdResponse (NetworkId const & requestingPlayer, uint32 gameServer, NetworkId const & targetPlayer, std::string const & targetPlayerDescription, StationId targetStationId, NetworkId const & targetItem, std::string const & targetItemDescription, uint32 gameCode, uint32 featureId, int oldValue, int newValue, unsigned int resultCode, bool resultCameFromSession, const char * sessionResultString = NULL, const char * sessionResultText = NULL); + AdjustAccountFeatureIdResponse (NetworkId const & requestingPlayer, uint32 gameServer, NetworkId const & targetPlayer, std::string const & targetPlayerDescription, StationId targetStationId, NetworkId const & targetItem, std::string const & targetItemDescription, uint32 gameCode, uint32 featureId, int oldValue, int newValue, unsigned int resultCode, bool resultCameFromSession, const char * sessionResultString = nullptr, const char * sessionResultText = nullptr); AdjustAccountFeatureIdResponse (Archive::ReadIterator & source); virtual ~AdjustAccountFeatureIdResponse (); @@ -37,7 +37,7 @@ public: bool getResultCameFromSession() const; std::string const & getSessionResultString() const; std::string const & getSessionResultText() const; - void setSessionResultCode(unsigned int resultCode, const char * sessionResultString = NULL, const char * sessionResultText = NULL); + void setSessionResultCode(unsigned int resultCode, const char * sessionResultString = nullptr, const char * sessionResultText = nullptr); private: Archive::AutoVariable m_requestingPlayer; @@ -169,7 +169,7 @@ inline std::string const & AdjustAccountFeatureIdResponse::getSessionResultText( // ---------------------------------------------------------------------- -inline void AdjustAccountFeatureIdResponse::setSessionResultCode(unsigned int resultCode, const char * sessionResultString /*= NULL*/, const char * sessionResultText /*= NULL*/) +inline void AdjustAccountFeatureIdResponse::setSessionResultCode(unsigned int resultCode, const char * sessionResultString /*= nullptr*/, const char * sessionResultText /*= nullptr*/) { m_resultCode.set(resultCode); diff --git a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/SceneTransferMessages.cpp b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/SceneTransferMessages.cpp index 92b86d2c..34c3de3f 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/SceneTransferMessages.cpp +++ b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/SceneTransferMessages.cpp @@ -19,7 +19,7 @@ RequestSceneTransfer::RequestSceneTransfer(const NetworkId &oid, const std::stri m_containerName(), m_scriptCallback() { - if (scriptCallback != NULL) + if (scriptCallback != nullptr) m_scriptCallback.set(scriptCallback); addVariable(m_oid); @@ -45,7 +45,7 @@ RequestSceneTransfer::RequestSceneTransfer(const NetworkId &oid, const std::stri m_containerName(containerName), m_scriptCallback() { - if (scriptCallback != NULL) + if (scriptCallback != nullptr) m_scriptCallback.set(scriptCallback); addVariable(m_oid); diff --git a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/SceneTransferMessages.h b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/SceneTransferMessages.h index e7780d16..0fc2e843 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/SceneTransferMessages.h +++ b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/SceneTransferMessages.h @@ -21,8 +21,8 @@ class RequestSceneTransfer : public GameNetworkMessage { public: - RequestSceneTransfer(const NetworkId &oid, const std::string & sceneName, uint32 sourceGameServer, const Vector &position_p, const Vector &position_w, const NetworkId &containerId, const char * scriptCallback = NULL); - RequestSceneTransfer(const NetworkId &oid, const std::string & sceneName, uint32 sourceGameServer, const Vector &position_p, const Vector &position_w, const NetworkId &buildingId, const std::string &containerName, const char * scriptCallback = NULL); + RequestSceneTransfer(const NetworkId &oid, const std::string & sceneName, uint32 sourceGameServer, const Vector &position_p, const Vector &position_w, const NetworkId &containerId, const char * scriptCallback = nullptr); + RequestSceneTransfer(const NetworkId &oid, const std::string & sceneName, uint32 sourceGameServer, const Vector &position_p, const Vector &position_w, const NetworkId &buildingId, const std::string &containerName, const char * scriptCallback = nullptr); RequestSceneTransfer(Archive::ReadIterator & source); ~RequestSceneTransfer(); diff --git a/engine/server/library/serverNetworkMessages/src/shared/core/SetupServerNetworkMessages.cpp b/engine/server/library/serverNetworkMessages/src/shared/core/SetupServerNetworkMessages.cpp index d976dd62..007706a8 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/core/SetupServerNetworkMessages.cpp +++ b/engine/server/library/serverNetworkMessages/src/shared/core/SetupServerNetworkMessages.cpp @@ -254,7 +254,7 @@ namespace SetupServerNetworkMessagesNamespace } MessageQueue::Data* unpackNothing(Archive::ReadIterator &) { - return NULL; + return nullptr; } void packVectorNetworkIdVector(const MessageQueue::Data * data, Archive::ByteStream & target) diff --git a/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/AiCreatureStateMessage.cpp b/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/AiCreatureStateMessage.cpp index 95dc3fd7..74213208 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/AiCreatureStateMessage.cpp +++ b/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/AiCreatureStateMessage.cpp @@ -37,9 +37,9 @@ void AiCreatureStateMessage::pack(MessageQueue::Data const * const data, Archive { AiCreatureStateMessage const * const msg = safe_cast(data); - if (msg != NULL) + if (msg != nullptr) { - if (GameServerMessageInterface::getInstance() != NULL) + if (GameServerMessageInterface::getInstance() != nullptr) { GameServerMessageInterface::getInstance()->pack(target, *msg); } @@ -52,7 +52,7 @@ MessageQueue::Data * AiCreatureStateMessage::unpack(Archive::ReadIterator & sour { AiCreatureStateMessage * msg = new AiCreatureStateMessage(); - if (GameServerMessageInterface::getInstance() != NULL) + if (GameServerMessageInterface::getInstance() != nullptr) { GameServerMessageInterface::getInstance()->unpack(source, *msg); } diff --git a/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/AiMovementMessage.cpp b/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/AiMovementMessage.cpp index fde8e298..c87b7c66 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/AiMovementMessage.cpp +++ b/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/AiMovementMessage.cpp @@ -61,7 +61,7 @@ void AiMovementMessage::pack(const MessageQueue::Data* const data, Archive::Byte const AiMovementMessage * const msg = safe_cast (data); if (msg) { - if (GameServerMessageInterface::getInstance() != NULL) + if (GameServerMessageInterface::getInstance() != nullptr) GameServerMessageInterface::getInstance()->pack(target, *msg); } } @@ -72,7 +72,7 @@ MessageQueue::Data* AiMovementMessage::unpack(Archive::ReadIterator & source) { AiMovementMessage * msg = new AiMovementMessage(); - if (GameServerMessageInterface::getInstance() != NULL) + if (GameServerMessageInterface::getInstance() != nullptr) GameServerMessageInterface::getInstance()->unpack(source, *msg); return msg; diff --git a/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/GameServerMessageInterface.cpp b/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/GameServerMessageInterface.cpp index 5872a21e..e898606f 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/GameServerMessageInterface.cpp +++ b/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/GameServerMessageInterface.cpp @@ -13,7 +13,7 @@ //----------------------------------------------------------------------- -GameServerMessageInterface * GameServerMessageInterface::ms_instance = NULL; +GameServerMessageInterface * GameServerMessageInterface::ms_instance = nullptr; //======================================================================= @@ -27,14 +27,14 @@ GameServerMessageInterface::GameServerMessageInterface() GameServerMessageInterface::~GameServerMessageInterface() { if (ms_instance == this) - ms_instance = NULL; + ms_instance = nullptr; } //----------------------------------------------------------------------- void GameServerMessageInterface::setInstance(GameServerMessageInterface * instance) { - if (ms_instance == NULL) + if (ms_instance == nullptr) ms_instance = instance; else if (ms_instance != instance) { diff --git a/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/RenameCharacterMessage.cpp b/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/RenameCharacterMessage.cpp index bd4cae1a..8aa0309a 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/RenameCharacterMessage.cpp +++ b/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/RenameCharacterMessage.cpp @@ -64,11 +64,11 @@ RenameCharacterMessageEx::RenameCharacterMessageEx(RenameCharacterMessageSource static Unicode::String const delimiters(Unicode::narrowToWide(" ")); Unicode::UnicodeStringVector newNameTokens; - if (!Unicode::tokenize(newName, newNameTokens, &delimiters, NULL)) + if (!Unicode::tokenize(newName, newNameTokens, &delimiters, nullptr)) newNameTokens.clear(); Unicode::UnicodeStringVector oldNameTokens; - if (!Unicode::tokenize(oldName, oldNameTokens, &delimiters, NULL)) + if (!Unicode::tokenize(oldName, oldNameTokens, &delimiters, nullptr)) oldNameTokens.clear(); m_lastNameChangeOnly.set(((newNameTokens.size() >= 1) && (oldNameTokens.size() >= 1) && Unicode::caseInsensitiveCompare(newNameTokens[0], oldNameTokens[0]))); diff --git a/engine/server/library/serverPathfinding/src/shared/CityPathGraph.cpp b/engine/server/library/serverPathfinding/src/shared/CityPathGraph.cpp index 2f14d0ac..8ec08af5 100755 --- a/engine/server/library/serverPathfinding/src/shared/CityPathGraph.cpp +++ b/engine/server/library/serverPathfinding/src/shared/CityPathGraph.cpp @@ -72,13 +72,13 @@ CityPathGraph::CityPathGraph ( int cityToken ) CityPathGraph::~CityPathGraph() { delete m_namedNodes; - m_namedNodes = NULL; + m_namedNodes = nullptr; delete m_nodeTree; - m_nodeTree = NULL; + m_nodeTree = nullptr; delete m_dirtyBoxes; - m_dirtyBoxes = NULL; + m_dirtyBoxes = nullptr; } // ---------------------------------------------------------------------- @@ -92,7 +92,7 @@ int CityPathGraph::addNode ( DynamicPathNode * newNode ) int index = DynamicPathGraph::addNode(newNode); SpatialHandle * handle = m_nodeTree->addObject( cityNode ); - if (handle != NULL) + if (handle != nullptr) { if (cityNode->getName() != Unicode::emptyString) { @@ -134,7 +134,7 @@ void CityPathGraph::removeNode ( int nodeIndex ) SpatialHandle * handle = cityNode->getSpatialHandle(); - if (m_namedNodes != NULL) + if (m_namedNodes != nullptr) { std::map >::iterator found = m_namedNodes->find(cityNode->getName()); if (found != m_namedNodes->end()) @@ -146,7 +146,7 @@ void CityPathGraph::removeNode ( int nodeIndex ) } m_nodeTree->removeObject( handle ); - cityNode->setSpatialHandle(NULL); + cityNode->setSpatialHandle(nullptr); DynamicPathGraph::removeNode(nodeIndex); } @@ -160,7 +160,7 @@ void CityPathGraph::destroyNode ( int nodeIndex ) { CityPathNode * cityNode = _getNode(nodeIndex); - if(cityNode == NULL) return; + if(cityNode == nullptr) return; // ---------- // Remember which nodes were adjacent to the node we're removing @@ -185,7 +185,7 @@ void CityPathGraph::destroyNode ( int nodeIndex ) m_nodeTree->removeObject( handle ); - cityNode->setSpatialHandle(NULL); + cityNode->setSpatialHandle(nullptr); // ---------- // Remove the node @@ -217,7 +217,7 @@ void CityPathGraph::moveNode ( int nodeIndex, Vector const & newPosition ) { CityPathNode * cityNode = _getNode(nodeIndex); - if(cityNode == NULL) return; + if(cityNode == nullptr) return; // ---------- // Remember which nodes were adjacent to the node we're removing @@ -272,7 +272,7 @@ void CityPathGraph::relinkNode ( int nodeIndex ) { CityPathNode * nodeA = _getNode(nodeIndex); - if(nodeA == NULL) return; + if(nodeA == nullptr) return; // ---------- @@ -293,16 +293,16 @@ void CityPathGraph::relinkNode ( int nodeIndex ) { CityPathNode * nodeB = _getNode(i); - if(nodeB == NULL) continue; + if(nodeB == nullptr) continue; if(nodeA == nodeB) continue; PathNodeType typeB = nodeB->getType(); if(typeB != PNT_CityBuildingEntrance) continue; - if(nodeA->getCreatorObject() == NULL) continue; + if(nodeA->getCreatorObject() == nullptr) continue; - if(nodeB->getCreatorObject() == NULL) continue; + if(nodeB->getCreatorObject() == nullptr) continue; if(nodeA->getCreatorObject() != nodeB->getCreatorObject()) continue; @@ -330,16 +330,16 @@ void CityPathGraph::relinkNode ( int nodeIndex ) { CityPathNode * nodeB = _getNode(i); - if(nodeB == NULL) continue; + if(nodeB == nullptr) continue; if(nodeA == nodeB) continue; PathNodeType typeB = nodeB->getType(); if(typeB != PNT_CityBuilding) continue; - if(nodeA->getCreatorObject() == NULL) continue; + if(nodeA->getCreatorObject() == nullptr) continue; - if(nodeB->getCreatorObject() == NULL) continue; + if(nodeB->getCreatorObject() == nullptr) continue; if(nodeA->getCreatorObject() != nodeB->getCreatorObject()) continue; @@ -367,7 +367,7 @@ void CityPathGraph::relinkNode ( int nodeIndex ) { CityPathNode * nodeB = static_cast(results[i]); - if(nodeB == NULL) continue; + if(nodeB == nullptr) continue; if(nodeA == nodeB) continue; PathNodeType typeB = nodeB->getType(); @@ -420,7 +420,7 @@ void CityPathGraph::relinkNode ( int nodeIndex ) { CityPathNode * neighborNode = _getNode(neighborList[i]); - if(neighborNode != NULL) + if(neighborNode != nullptr) { neighborNode->markRedundantEdges(); neighborNode->removeMarkedEdges(); @@ -467,11 +467,11 @@ CityPathNode * CityPathGraph::findNodeForObject ( ServerObject const & object ) { CityPathNode * node = _getNode(i); - if(node == NULL) continue; + if(node == nullptr) continue; ServerObject const * source = node->getSourceObject(); - if(source == NULL) continue; + if(source == nullptr) continue; if(source == &object) { @@ -479,7 +479,7 @@ CityPathNode * CityPathGraph::findNodeForObject ( ServerObject const & object ) } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -492,11 +492,11 @@ CityPathNode const * CityPathGraph::findNodeForObject ( ServerObject const & obj { CityPathNode const * node = _getNode(i); - if(node == NULL) continue; + if(node == nullptr) continue; ServerObject const * source = node->getSourceObject(); - if(source == NULL) continue; + if(source == nullptr) continue; if(source == &object) { @@ -504,15 +504,15 @@ CityPathNode const * CityPathGraph::findNodeForObject ( ServerObject const & obj } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- CityPathNode * CityPathGraph::findNearestNodeForName( Unicode::String const & nodeName, Vector const & pos ) { - if (m_namedNodes == NULL) - return NULL; + if (m_namedNodes == nullptr) + return nullptr; std::map >::iterator found = m_namedNodes->find(nodeName); if (found != m_namedNodes->end() && !found->second.empty()) @@ -521,12 +521,12 @@ CityPathNode * CityPathGraph::findNearestNodeForName( Unicode::String const & no if (nodes.size() == 1) return *(nodes.begin()); - CityPathNode * node = NULL; + CityPathNode * node = nullptr; float distance = FLT_MAX; for (std::set::iterator i = nodes.begin(); i != nodes.end(); ++i) { float testDistance = pos.magnitudeBetweenSquared((*i)->getPosition_w()); - if (node == NULL || testDistance < distance) + if (node == nullptr || testDistance < distance) { distance = testDistance; node = *i; @@ -535,15 +535,15 @@ CityPathNode * CityPathGraph::findNearestNodeForName( Unicode::String const & no return node; } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- CityPathNode const * CityPathGraph::findNearestNodeForName( Unicode::String const & nodeName, Vector const & pos ) const { - if (m_namedNodes == NULL) - return NULL; + if (m_namedNodes == nullptr) + return nullptr; std::map >::const_iterator found = m_namedNodes->find(nodeName); if (found != m_namedNodes->end() && !found->second.empty()) @@ -552,12 +552,12 @@ CityPathNode const * CityPathGraph::findNearestNodeForName( Unicode::String cons if (nodes.size() == 1) return *(nodes.begin()); - CityPathNode const * node = NULL; + CityPathNode const * node = nullptr; float distance = FLT_MAX; for (std::set::const_iterator i = nodes.begin(); i != nodes.end(); ++i) { float testDistance = pos.magnitudeBetweenSquared((*i)->getPosition_w()); - if (node == NULL || testDistance < distance) + if (node == nullptr || testDistance < distance) { distance = testDistance; node = *i; @@ -566,14 +566,14 @@ CityPathNode const * CityPathGraph::findNearestNodeForName( Unicode::String cons return node; } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- int CityPathGraph::findNearestNode ( Vector const & position ) const { - PathNode * temp = NULL; + PathNode * temp = nullptr; float dummy1 = REAL_MAX; float dummy2 = REAL_MAX; @@ -713,7 +713,7 @@ int CityPathGraph::getNeighborCode ( int whichNode ) const { CityPathNode const * node = _getNode(whichNode); - if(node == NULL) return 0; + if(node == nullptr) return 0; int edgeCount = node->getEdgeCount(); @@ -725,7 +725,7 @@ int CityPathGraph::getNeighborCode ( int whichNode ) const CityPathNode const * neighbor = _getNode(neighborId); - if(neighbor == NULL) continue; + if(neighbor == nullptr) continue; int neighborInt = reinterpret_cast(neighbor); diff --git a/engine/server/library/serverPathfinding/src/shared/CityPathGraphManager.cpp b/engine/server/library/serverPathfinding/src/shared/CityPathGraphManager.cpp index 3e511c3c..9194452e 100755 --- a/engine/server/library/serverPathfinding/src/shared/CityPathGraphManager.cpp +++ b/engine/server/library/serverPathfinding/src/shared/CityPathGraphManager.cpp @@ -58,7 +58,7 @@ struct RegionCacheEntry { RegionCacheEntry ( void ) - : m_shape(), m_graph(NULL) + : m_shape(), m_graph(nullptr) { } @@ -143,7 +143,7 @@ void CityPathGraphManager::update ( float time ) CityPathGraph * graph = g_regionCache[g_scrubberGraphIndex].m_graph; - if(graph == NULL) return; + if(graph == nullptr) return; if(g_scrubberNodeIndex >= graph->getNodeCount()) { @@ -156,7 +156,7 @@ void CityPathGraphManager::update ( float time ) g_scrubberNodeIndex++; - if(node == NULL) return; + if(node == nullptr) return; if(!node->sanityCheck(false)) { @@ -233,14 +233,14 @@ Region const * getCityRegionFor( Vector const & position ) return results[0]; } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- int getCityTokenFor ( Region const * region ) { - if(region == NULL) return -1; + if(region == nullptr) return -1; Unicode::String const & name = region->getName(); @@ -294,7 +294,7 @@ bool checkRegionCache ( Vector const & position, CityPathGraph * & outGraph ) bool addToRegionCache ( MultiShape const & shape, CityPathGraph * graph ) { - if(graph == NULL) return false; + if(graph == nullptr) return false; RegionCacheEntry entry(shape,graph); @@ -325,12 +325,12 @@ bool addToRegionCache ( AxialBox const & box, CityPathGraph * graph ) bool addToRegionCache ( Region const * region, CityPathGraph * graph ) { - if(region == NULL) return false; - if(graph == NULL) return false; + if(region == nullptr) return false; + if(graph == nullptr) return false; MxCifQuadTreeBounds const * bounds = ®ion->getBounds(); - if(bounds == NULL) return false; + if(bounds == nullptr) return false; MxCifQuadTreeCircleBounds const * circleBounds = dynamic_cast(bounds); @@ -390,7 +390,7 @@ CityPathGraph * createCityGraphFor ( Region const * region ) { int token = getCityTokenFor(region); - if(token == -1) return NULL; + if(token == -1) return nullptr; CityPathGraph * graph = new CityPathGraph(token); @@ -401,7 +401,7 @@ CityPathGraph * createCityGraphFor ( Region const * region ) CityPathGraph * createCityGraphFor ( ServerObject const * creator, MultiShape const & shape ) { - if(creator == NULL) return NULL; + if(creator == nullptr) return nullptr; CityPathGraph * newGraph = new CityPathGraph(-1); @@ -416,7 +416,7 @@ CityPathGraph * createCityGraphFor ( ServerObject const * creator, MultiShape co CityPathGraph * _getCityGraphFor ( Vector const & position ) { - CityPathGraph * graph = NULL; + CityPathGraph * graph = nullptr; if(checkRegionCache(position,graph)) { @@ -436,9 +436,9 @@ CityPathGraph * _getCityGraphFor ( Vector const & position ) CityPathGraph * _getCityGraphFor ( ServerObject const * object ) { - if(object == NULL) + if(object == nullptr) { - return NULL; + return nullptr; } else { @@ -450,8 +450,8 @@ CityPathGraph * _getCityGraphFor ( ServerObject const * object ) CityPathNode * _getCityNodeFor ( ServerObject const * object, CityPathGraph * graph ) { - if(object == NULL) return NULL; - if(graph == NULL) return NULL; + if(object == nullptr) return nullptr; + if(graph == nullptr) return nullptr; return graph->findNodeForObject(*object); } @@ -462,7 +462,7 @@ CityPathNode * _getCityNodeFor ( ServerObject const * object ) { CityPathGraph * graph = _getCityGraphFor(object); - if(graph == NULL) return NULL; + if(graph == nullptr) return nullptr; return _getCityNodeFor(object,graph); } @@ -471,19 +471,19 @@ CityPathNode * _getCityNodeFor ( ServerObject const * object ) PathGraph const * _getExteriorGraph ( ServerObject const * object ) { - if(object == NULL) return NULL; + if(object == nullptr) return nullptr; CollisionProperty const * collision = object->getCollisionProperty(); - if(collision == NULL) return NULL; + if(collision == nullptr) return nullptr; Floor const * floor = collision->getFloor(); - if(floor == NULL) return NULL; + if(floor == nullptr) return nullptr; FloorMesh const * floorMesh = floor->getFloorMesh(); - if(floorMesh == NULL) return NULL; + if(floorMesh == nullptr) return nullptr; PathGraph const * pathGraph = safe_cast(floorMesh->getPathGraph()); @@ -507,8 +507,8 @@ CityPathGraph const * CityPathGraphManager::getCityGraphFor ( Vector const & pos CityPathNode const * CityPathGraphManager::getNamedNodeFor( ServerObject const & object, Unicode::String const & nodeName ) { CityPathGraph const * cityGraph = getCityGraphFor(&object); - if (cityGraph == NULL) - return NULL; + if (cityGraph == nullptr) + return nullptr; return cityGraph->findNearestNodeForName(nodeName, object.getPosition_w()); } @@ -517,7 +517,7 @@ CityPathNode const * CityPathGraphManager::getNamedNodeFor( ServerObject const & bool CityPathGraphManager::getClosestPathNodePos ( ServerObject const * object, Vector & outPos ) { - if(object == NULL) return false; + if(object == nullptr) return false; if(object->getParentCell() == CellProperty::getWorldCellProperty()) { @@ -548,11 +548,11 @@ bool CityPathGraphManager::getClosestPathNodePos ( ServerObject const * object, void CityPathGraphManager::addWaypoint ( ServerObject * sourceObject ) { - if(sourceObject == NULL) return; + if(sourceObject == nullptr) return; CityPathGraph * graph = _getCityGraphFor(sourceObject); - if(graph == NULL) + if(graph == nullptr) { return; } @@ -561,7 +561,7 @@ void CityPathGraphManager::addWaypoint ( ServerObject * sourceObject ) DynamicVariableList const & objvars = sourceObject->getObjVars(); - CityPathNode * newNode = NULL; + CityPathNode * newNode = nullptr; Vector sourcePos_w = sourceObject->getPosition_w(); @@ -626,11 +626,11 @@ void CityPathGraphManager::removeWaypoint ( ServerObject * sourceObject ) { CityPathGraph * graph = _getCityGraphFor(sourceObject); - if(graph == NULL) return; + if(graph == nullptr) return; CityPathNode * unloadingNode = _getCityNodeFor(sourceObject,graph); - if(unloadingNode == NULL) return; + if(unloadingNode == nullptr) return; // ---------- @@ -679,15 +679,15 @@ void CityPathGraphManager::moveWaypoint ( ServerObject * sourceObject, Vector co { UNREF(oldPosition); - if(sourceObject == NULL) return; + if(sourceObject == nullptr) return; CityPathGraph * graph = _getCityGraphFor(sourceObject); - if(graph == NULL) return; + if(graph == nullptr) return; CityPathNode * node = _getCityNodeFor(sourceObject,graph); - if(node == NULL) return; + if(node == nullptr) return; // ---------- @@ -719,11 +719,11 @@ void CityPathGraphManager::moveWaypoint ( ServerObject * sourceObject, Vector co void CityPathGraphManager::addBuilding ( BuildingObject * building ) { - if(building == NULL) return; + if(building == nullptr) return; CityPathGraph * graph = _getCityGraphFor(building); - if(graph == NULL) + if(graph == nullptr) { return; } @@ -752,11 +752,11 @@ void CityPathGraphManager::addBuilding ( BuildingObject * building ) { ServerObject * serverObject = ServerWorld::findObjectByNetworkId(ids[i]); - if(serverObject == NULL) continue; + if(serverObject == nullptr) continue; CityPathNode * node = _getCityNodeFor(serverObject,graph); - if(node == NULL) continue; + if(node == nullptr) continue; node->setCreator(building->getNetworkId()); } @@ -783,11 +783,11 @@ void CityPathGraphManager::destroyBuilding ( BuildingObject * building ) void CityPathGraphManager::moveBuilding ( BuildingObject * building, Vector const & oldPosition ) { - if(building == NULL) return; + if(building == nullptr) return; CityPathGraph * graph = _getCityGraphFor(building); - if(graph == NULL) return; + if(graph == nullptr) return; UNREF(oldPosition); @@ -800,11 +800,11 @@ void CityPathGraphManager::moveBuilding ( BuildingObject * building, Vector cons { ServerObject * serverObject = ServerWorld::findObjectByNetworkId(ids[i]); - if(serverObject == NULL) continue; + if(serverObject == nullptr) continue; CityPathNode * node = _getCityNodeFor(serverObject,graph); - if(node == NULL) continue; + if(node == nullptr) continue; Vector relativePos_o = node->getRelativePosition_o(); @@ -851,7 +851,7 @@ bool CityPathGraphManager::destroyPathGraph ( ServerObject const * creator ) bool CityPathGraphManager::createPathNodes ( ServerObject * building ) { - if(building == NULL) return false; + if(building == nullptr) return false; // Destroy any old path nodes for the building @@ -862,7 +862,7 @@ bool CityPathGraphManager::createPathNodes ( ServerObject * building ) PathGraph const * pathGraph = _getExteriorGraph(building); - if(pathGraph == NULL) return false; + if(pathGraph == nullptr) return false; // ---------- // Go through all the nodes in the building's graph and create city @@ -878,7 +878,7 @@ bool CityPathGraphManager::createPathNodes ( ServerObject * building ) { PathNode const * node = pathGraph->getNode(i); - if(node == NULL) continue; + if(node == nullptr) continue; // ---------- @@ -975,11 +975,11 @@ void CityPathGraphManager::destroyWaypoint ( ServerObject * object ) { CityPathGraph * graph = _getCityGraphFor(object); - if(graph == NULL) return; + if(graph == nullptr) return; CityPathNode * deadNode = _getCityNodeFor(object,graph); - if(deadNode == NULL) return; + if(deadNode == nullptr) return; // ---------- @@ -1025,11 +1025,11 @@ void CityPathGraphManager::destroyWaypoint ( ServerObject * object ) bool CityPathGraphManager::destroyPathNodes ( ServerObject * object ) { - if(object == NULL) return false; + if(object == nullptr) return false; BuildingObject * building = dynamic_cast(object); - if(building == NULL) return false; + if(building == nullptr) return false; NetworkIdList ids; if (!building->getObjVars().getItem(OBJVAR_PATHFINDING_BUILDING_WAYPOINTS,ids)) return false; @@ -1044,7 +1044,7 @@ bool CityPathGraphManager::destroyPathNodes ( ServerObject * object ) ServerObject * serverObject = ServerWorld::findObjectByNetworkId(id); - if(serverObject == NULL) continue; + if(serverObject == nullptr) continue; serverObject->permanentlyDestroy(DeleteReasons::Replaced); } @@ -1156,7 +1156,7 @@ void CityPathGraphManager::setLinkDistance ( float dist ) void CityPathGraphManager::relinkGraph ( CityPathGraph const * constGraph ) { - if(constGraph == NULL) return; + if(constGraph == nullptr) return; CityPathGraph * graph = const_cast(constGraph); diff --git a/engine/server/library/serverPathfinding/src/shared/CityPathNode.cpp b/engine/server/library/serverPathfinding/src/shared/CityPathNode.cpp index 8e4df130..11000b37 100755 --- a/engine/server/library/serverPathfinding/src/shared/CityPathNode.cpp +++ b/engine/server/library/serverPathfinding/src/shared/CityPathNode.cpp @@ -46,7 +46,7 @@ CityPathNode::CityPathNode ( Vector const & position_w, NetworkId const & source m_source(sourceId), m_creator(), m_relativePosition_o(Vector::zero), - m_spatialHandle(NULL), + m_spatialHandle(nullptr), m_debugId( gs_debugIdCounter++ ) { snapToTerrain(); @@ -59,7 +59,7 @@ CityPathNode::CityPathNode ( Vector const & position_w, NetworkId const & source m_source(sourceId), m_creator(creatorId), m_relativePosition_o(Vector::zero), - m_spatialHandle(NULL), + m_spatialHandle(nullptr), m_debugId( gs_debugIdCounter++ ) { updateRelativePosition(); @@ -158,7 +158,7 @@ void CityPathNode::loadInfoFromObjvars ( void ) { ServerObject const * sourceObject = getSourceObject(); - if(sourceObject == NULL) return; + if(sourceObject == nullptr) return; const DynamicVariableList & objvars = sourceObject->getObjVars(); @@ -188,7 +188,7 @@ void CityPathNode::loadEdgesFromObjvars ( void ) { ServerObject const * sourceObject = getSourceObject(); - if(sourceObject == NULL) return; + if(sourceObject == nullptr) return; DynamicVariableList const & objvars = sourceObject->getObjVars(); @@ -203,11 +203,11 @@ void CityPathNode::loadEdgesFromObjvars ( void ) { ServerObject * serverObject = ServerWorld::findObjectByNetworkId( idList[i] ); - if(serverObject == NULL) continue; + if(serverObject == nullptr) continue; CityPathNode * otherNode = _getGraph()->findNodeForObject(*serverObject); - if(otherNode == NULL) continue; + if(otherNode == nullptr) continue; addEdge(otherNode->getIndex()); otherNode->addEdge(getIndex()); @@ -233,7 +233,7 @@ void CityPathNode::saveInfoToObjvars ( void ) { ServerObject * sourceObject = getSourceObject(); - if(sourceObject == NULL) return; + if(sourceObject == nullptr) return; // ---------- @@ -294,7 +294,7 @@ void CityPathNode::saveEdgesToObjvars ( void ) CityPathNode * neighborNode = _getGraph()->_getNode(neighborIndex); - if(neighborNode == NULL) continue; + if(neighborNode == nullptr) continue; NetworkId const & neighborSourceId = neighborNode->getSourceId(); @@ -327,7 +327,7 @@ void CityPathNode::saveNeighbors ( void ) CityPathNode * neighborNode = _getGraph()->_getNode(neighborIndex); - if(neighborNode == NULL) continue; + if(neighborNode == nullptr) continue; neighborNode->saveToObjvars(); } @@ -420,7 +420,7 @@ bool CityPathNode::sanityCheck ( bool doWarnings ) const CityPathNode const * neighborNode = _getGraph()->_getNode(neighborIndex); - if(neighborNode == NULL) + if(neighborNode == nullptr) { DEBUG_WARNING(doWarnings,("CityPathNode::sanityCheck - Node has an edge to a non-existent node\n")); insaneCount++; @@ -458,7 +458,7 @@ bool CityPathNode::sanityCheck ( bool doWarnings ) const CityPathNode const * nodeA = this; CityPathNode const * nodeB = _getGraph()->_getNode(getNeighbor(i)); - if(nodeB == NULL) continue; + if(nodeB == nullptr) continue; if(nodeB->getType() == PNT_CityBuilding) continue; @@ -493,7 +493,7 @@ void CityPathNode::reload ( void ) { ServerObject const * sourceObject = getSourceObject(); - if(sourceObject == NULL) return; + if(sourceObject == nullptr) return; // ---------- @@ -521,7 +521,7 @@ bool CityPathNode::hasEdgeTo ( NetworkId const & neighborId ) const CityPathNode const * neighborNode = _getGraph()->_getNode(neighborIndex); - if(neighborNode == NULL) continue; + if(neighborNode == nullptr) continue; if(neighborNode->getSourceId() == neighborId) return true; } @@ -535,7 +535,7 @@ void CityPathNode::snapToTerrain ( void ) { CellProperty const * cell = getCell(); - if((cell == NULL) || (cell == CellProperty::getWorldCellProperty())) + if((cell == nullptr) || (cell == CellProperty::getWorldCellProperty())) { Vector pos_w = getPosition_w(); diff --git a/engine/server/library/serverPathfinding/src/shared/PathAutoGenerator.cpp b/engine/server/library/serverPathfinding/src/shared/PathAutoGenerator.cpp index d5f6cd8e..328a52aa 100755 --- a/engine/server/library/serverPathfinding/src/shared/PathAutoGenerator.cpp +++ b/engine/server/library/serverPathfinding/src/shared/PathAutoGenerator.cpp @@ -48,14 +48,14 @@ Region const * PathAutoGenerator::findPathRegion(Vector const & pos_w) for (RegionMaster::RegionVector::const_iterator it = rv.begin(); it != rv.end(); ++it) { Region const * const r = *it; - if (NULL != r) + if (nullptr != r) { if (r->getGeography() == RegionNamespace::RG_pathfind) return r; } } - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -63,7 +63,7 @@ Region const * PathAutoGenerator::findPathRegion(Vector const & pos_w) void PathAutoGenerator::pathAutoGenerate(Vector const & pos_w, float nodeDistance, float obstacleDistance, Unicode::String & result) { Region const * region = findPathRegion(pos_w); - if (NULL == region) + if (nullptr == region) { result += Unicode::narrowToWide("No pathfinding region at position"); return; @@ -144,7 +144,7 @@ void PathAutoGenerator::pathAutoGenerate(Vector const & pos_w, float nodeDistanc ++obstacleNearbySkipped; #if USE_OBSTACLE_TEMPLATE - if (NULL != PathAutoGeneratorNamespace::s_pathObstacleTemplate) + if (nullptr != PathAutoGeneratorNamespace::s_pathObstacleTemplate) { Transform transform_w; transform_w.setPosition_p(testPos_w); @@ -164,7 +164,7 @@ void PathAutoGenerator::pathAutoGenerate(Vector const & pos_w, float nodeDistanc transform_w.setPosition_p(testPos_w); ServerObject * newObject = ServerWorld::createNewObject(s_pathWaypointTemplate, transform_w, 0, false); - if (NULL != newObject) + if (nullptr != newObject) { newObject->addToWorld(); newObject->persist(); @@ -189,7 +189,7 @@ void PathAutoGenerator::pathAutoGenerate(Vector const & pos_w, float nodeDistanc void PathAutoGenerator::pathAutoCleanup(Vector const & pos_w, Unicode::String & result) { Region const * region = findPathRegion(pos_w); - if (NULL == region) + if (nullptr == region) { result += Unicode::narrowToWide("No pathfinding region at position"); return; @@ -236,7 +236,7 @@ void PathAutoGenerator::pathAutoCleanup(Vector const & pos_w, Unicode::String & } #if USE_OBSTACLE_TEMPLATE - if (NULL != s_pathObstacleTemplate && !strcmp(so->getTemplateName(), s_pathObstacleTemplate)) + if (nullptr != s_pathObstacleTemplate && !strcmp(so->getTemplateName(), s_pathObstacleTemplate)) { so->permanentlyDestroy(DeleteReasons::Script); ++obstacleDestroyCount; diff --git a/engine/server/library/serverPathfinding/src/shared/ServerPathBuilder.cpp b/engine/server/library/serverPathfinding/src/shared/ServerPathBuilder.cpp index 4ffdd288..109ba9c4 100755 --- a/engine/server/library/serverPathfinding/src/shared/ServerPathBuilder.cpp +++ b/engine/server/library/serverPathfinding/src/shared/ServerPathBuilder.cpp @@ -41,7 +41,7 @@ const float gs_maxCanMoveDistance2 = (64.0f * 64.0f); int findClosestReachablePathNode_slow( CreatureObject const * creature, PathGraph const * graph ) { - if(graph == NULL) return -1; + if(graph == nullptr) return -1; Vector creaturePos = creature->getPosition_p(); @@ -53,7 +53,7 @@ int findClosestReachablePathNode_slow( CreatureObject const * creature, PathGrap int resultCount = results.size(); - PathNode const * reachableNode = NULL; + PathNode const * reachableNode = nullptr; float reachableDist2 = gs_maxCanMoveDistance2; for(int i = 0; i < resultCount; i++) @@ -81,7 +81,7 @@ int findClosestReachablePathNode_slow( CreatureObject const * creature, PathGrap int findClosestReachablePathNode( CreatureObject const * creature, PathGraph const * graph ) { - if(graph == NULL) return -1; + if(graph == nullptr) return -1; Vector creaturePos = creature->getPosition_p(); @@ -98,7 +98,7 @@ int findClosestReachablePathNode( CreatureObject const * creature, PathGraph con PathNode const * node = graph->getNode(closestIndex); - if(node == NULL) return -2; + if(node == nullptr) return -2; Vector nodePos = node->getPosition_p(); float dist2 = nodePos.magnitudeBetweenSquared(creaturePos); @@ -135,7 +135,7 @@ int findClosestReachablePathNode_slow ( CellProperty const * cell, Vector const int resultCount = results.size(); - PathNode const * reachableNode = NULL; + PathNode const * reachableNode = nullptr; float reachableDist2 = gs_maxCanMoveDistance2; for(int i = 0; i < resultCount; i++) @@ -173,7 +173,7 @@ int findClosestReachablePathNode ( CellProperty const * cell, Vector const & goa PathNode const * node = graph->getNode(closestIndex); - if(node == NULL) return -2; + if(node == nullptr) return -2; Vector nodePos = node->getPosition_p(); float dist2 = nodePos.magnitudeBetweenSquared(goal); @@ -199,7 +199,7 @@ PathGraph const * getGraph ( CellProperty const * cell ) if(cell) return safe_cast(cell->getPathGraph()); else - return NULL; + return nullptr; } PathGraph const * getGraph ( PortalProperty const * building ) @@ -207,7 +207,7 @@ PathGraph const * getGraph ( PortalProperty const * building ) if(building) return safe_cast(building->getPortalPropertyTemplate().getBuildingPathGraph()); else - return NULL; + return nullptr; } // ---------- @@ -237,19 +237,19 @@ PortalProperty const * getBuilding ( BuildingObject const * buildingObject ) if(buildingObject) return buildingObject->getPortalProperty(); else - return NULL; + return nullptr; } PortalProperty const * getBuilding ( CreatureObject const * creature ) { - if(creature == NULL) return NULL; + if(creature == nullptr) return nullptr; CellProperty const * cell = creature->getParentCell(); if(cell) return cell->getPortalProperty(); else - return NULL; + return nullptr; } PortalProperty const * getBuilding ( AiLocation const & loc ) @@ -259,7 +259,7 @@ PortalProperty const * getBuilding ( AiLocation const & loc ) if(cell) return cell->getPortalProperty(); else - return NULL; + return nullptr; } // ---------- @@ -388,26 +388,26 @@ int getIndexFor ( CellProperty const * cell, PathGraph const * graph, AiLocation // ---------------------------------------------------------------------- ServerPathBuilder::ServerPathBuilder() -: m_creatureCell(NULL), - m_creatureCellGraph(NULL), +: m_creatureCell(nullptr), + m_creatureCellGraph(nullptr), m_creatureCellKey(-1), m_creatureCellNodeIndex(-1), m_creatureCellPart(-1), - m_creatureBuilding(NULL), - m_creatureBuildingGraph(NULL), + m_creatureBuilding(nullptr), + m_creatureBuildingGraph(nullptr), m_creatureBuildingKey(-1), m_creatureBuildingNodeIndex(-1), m_creaturePosition(), - m_goalCell(NULL), - m_goalCellGraph(NULL), + m_goalCell(nullptr), + m_goalCellGraph(nullptr), m_goalCellKey(-1), m_goalCellNodeIndex(-1), m_goalCellPart(-1), - m_goalBuilding(NULL), - m_goalBuildingGraph(NULL), + m_goalBuilding(nullptr), + m_goalBuildingGraph(nullptr), m_goalBuildingKey(-1), m_goalBuildingNodeIndex(-1), - m_goalCityGraph(NULL), + m_goalCityGraph(nullptr), m_goalCityNodeIndex(-1), m_path(new AiPath()), m_async(false), @@ -427,16 +427,16 @@ ServerPathBuilder::~ServerPathBuilder() ServerPathBuildManager::unqueue(this); delete m_path; - m_path = NULL; + m_path = nullptr; delete m_cellSearch; - m_cellSearch = NULL; + m_cellSearch = nullptr; delete m_buildingSearch; - m_buildingSearch = NULL; + m_buildingSearch = nullptr; delete m_citySearch; - m_citySearch = NULL; + m_citySearch = nullptr; } @@ -462,7 +462,7 @@ bool ServerPathBuilder::buildPathInternal( CellProperty const * cell, PathGraph PathNode const * node = graph->getNode(nodeIndex); - if(node == NULL) return false; + if(node == nullptr) return false; addPathNode( cell, node ); } @@ -484,9 +484,9 @@ bool ServerPathBuilder::buildPathInternal ( PortalProperty const * building, Pat // ---------- - PathNode const * nodeA = NULL; - PathNode const * nodeB = NULL; - PathNode const * nodeC = NULL; + PathNode const * nodeA = nullptr; + PathNode const * nodeB = nullptr; + PathNode const * nodeC = nullptr; int pathLength = path.size(); @@ -496,7 +496,7 @@ bool ServerPathBuilder::buildPathInternal ( PortalProperty const * building, Pat { PathNode const * nextNode = graph->getNode(path[i]); - if(nextNode == NULL) continue; + if(nextNode == nullptr) continue; nodeA = nodeB; nodeB = nodeC; @@ -506,10 +506,10 @@ bool ServerPathBuilder::buildPathInternal ( PortalProperty const * building, Pat { nodeA = nodeB; nodeB = nodeC; - nodeC = NULL; + nodeC = nullptr; } - if( nodeB == NULL ) continue; + if( nodeB == nullptr ) continue; // ---------- @@ -519,11 +519,11 @@ bool ServerPathBuilder::buildPathInternal ( PortalProperty const * building, Pat CellProperty const * subobject = building->getCell(cellIndex); - if(subobject == NULL) return false; + if(subobject == nullptr) return false; PathGraph const * subgraph = getGraph(subobject); - if(subgraph == NULL) return false; + if(subgraph == nullptr) return false; // ---------- @@ -576,9 +576,9 @@ bool ServerPathBuilder::buildPathInternal ( CityPathGraph const * graph, int ind bool ServerPathBuilder::expandPath ( CityPathGraph const * graph, IndexList const & path ) { - PathNode const * nodeA = NULL; - PathNode const * nodeB = NULL; - PathNode const * nodeC = NULL; + PathNode const * nodeA = nullptr; + PathNode const * nodeB = nullptr; + PathNode const * nodeC = nullptr; int pathLength = path.size(); @@ -588,7 +588,7 @@ bool ServerPathBuilder::expandPath ( CityPathGraph const * graph, IndexList cons { PathNode const * nextNode = graph->getNode(path[i]); - if(nextNode == NULL) continue; + if(nextNode == nullptr) continue; nodeA = nodeB; nodeB = nodeC; @@ -598,10 +598,10 @@ bool ServerPathBuilder::expandPath ( CityPathGraph const * graph, IndexList cons { nodeA = nodeB; nodeB = nodeC; - nodeC = NULL; + nodeC = nullptr; } - if( nodeB == NULL ) continue; + if( nodeB == nullptr ) continue; // ---------- @@ -609,19 +609,19 @@ bool ServerPathBuilder::expandPath ( CityPathGraph const * graph, IndexList cons { CityPathNode const * cityNode = safe_cast(nodeB); - if(cityNode == NULL) return false; + if(cityNode == nullptr) return false; BuildingObject const * buildingObject = safe_cast(cityNode->getCreatorObject()); - if(buildingObject == NULL) return false; + if(buildingObject == nullptr) return false; PortalProperty const * subobject = getBuilding(buildingObject); - if(subobject == NULL) return false; + if(subobject == nullptr) return false; PathGraph const * subgraph = getGraph(subobject); - if(subgraph == NULL) return false; + if(subgraph == nullptr) return false; // ---------- @@ -652,7 +652,7 @@ bool ServerPathBuilder::buildPath_World ( void ) { Vector exitPoint(m_creature ? m_creature->getPosition_w() : m_creaturePosition); - if((m_creatureCityGraph != NULL) && (m_creatureCityNodeIndex >= 0)) + if((m_creatureCityGraph != nullptr) && (m_creatureCityNodeIndex >= 0)) { int indexA = m_creatureCityNodeIndex; int indexB = m_creatureCityGraph->findNearestNode(m_goal.getPosition_w()); @@ -670,7 +670,7 @@ bool ServerPathBuilder::buildPath_World ( void ) } } - if((m_goalCityGraph != NULL) && (m_goalCityNodeIndex >= 0)) + if((m_goalCityGraph != nullptr) && (m_goalCityNodeIndex >= 0)) { int indexA = m_goalCityGraph->findNearestNode(exitPoint); int indexB = m_goalCityNodeIndex; @@ -701,8 +701,8 @@ bool ServerPathBuilder::buildPath_ToGoal ( void ) m_creatureCell = m_creature->getParentCell(); m_goalCell = m_goal.getCell(); - if(m_creatureCell == NULL) m_creatureCell = worldCell; - if(m_goalCell == NULL) m_goalCell = worldCell; + if(m_creatureCell == nullptr) m_creatureCell = worldCell; + if(m_goalCell == nullptr) m_goalCell = worldCell; { Vector goalPos_p = m_goal.getPosition_p(m_creatureCell); @@ -724,23 +724,23 @@ bool ServerPathBuilder::buildPath_ToGoal ( void ) // we can skip some work with looking up their cell and building // info. - m_creatureCellGraph = NULL; + m_creatureCellGraph = nullptr; m_creatureCellKey = -1; m_creatureCellNodeIndex = -1; m_creatureCellPart = -1; - m_goalCellGraph = NULL; + m_goalCellGraph = nullptr; m_goalCellKey = -1; m_goalCellNodeIndex = -1; m_goalCellPart = -1; - m_creatureBuilding = NULL; - m_creatureBuildingGraph = NULL; + m_creatureBuilding = nullptr; + m_creatureBuildingGraph = nullptr; m_creatureBuildingKey = -1; m_creatureBuildingNodeIndex = -1; - m_goalBuilding = NULL; - m_goalBuildingGraph = NULL; + m_goalBuilding = nullptr; + m_goalBuildingGraph = nullptr; m_goalBuildingKey = -1; m_goalBuildingNodeIndex = -1; } @@ -776,7 +776,7 @@ bool ServerPathBuilder::buildPath_ToGoal ( void ) // If they're in the same cell, start the search in the cell - if((m_creatureCell == m_goalCell) && (m_creatureCell != NULL) && (m_creatureCell != CellProperty::getWorldCellProperty()) && (m_creatureCellPart == m_goalCellPart)) + if((m_creatureCell == m_goalCell) && (m_creatureCell != nullptr) && (m_creatureCell != CellProperty::getWorldCellProperty()) && (m_creatureCellPart == m_goalCellPart)) { return buildPathInternal(m_creatureCell,m_creatureCellGraph,m_creatureCellNodeIndex,m_goalCellNodeIndex); } @@ -795,7 +795,7 @@ bool ServerPathBuilder::buildPath_ToGoal ( void ) // If they're in the same building, start the search in the building - if((m_creatureBuilding == m_goalBuilding) && (m_creatureBuilding != NULL)) + if((m_creatureBuilding == m_goalBuilding) && (m_creatureBuilding != nullptr)) { return buildPathInternal(m_creatureBuilding,m_creatureBuildingGraph,m_creatureBuildingNodeIndex,m_goalBuildingNodeIndex); } @@ -810,7 +810,7 @@ bool ServerPathBuilder::buildPath_ToGoal ( void ) m_goalCityGraph = CityPathGraphManager::getCityGraphFor(m_goal.getPosition_w()); m_goalCityNodeIndex = getIndexFor(m_goalCityGraph,m_goalBuilding,m_goal); - if((m_creatureCityGraph == m_goalCityGraph) && (m_creatureCityGraph != NULL)) + if((m_creatureCityGraph == m_goalCityGraph) && (m_creatureCityGraph != nullptr)) { // hack - If a creature in a city region tries to path search but it's not near a path node, // make its path search succeed @@ -875,7 +875,7 @@ bool ServerPathBuilder::buildPath_Named ( void ) // ---------- - if(m_creatureCityGraph != NULL) + if(m_creatureCityGraph != nullptr) { IndexList goalList; @@ -885,7 +885,7 @@ bool ServerPathBuilder::buildPath_Named ( void ) { CityPathNode const * node = m_creatureCityGraph->_getNode(i); - if(node == NULL) continue; + if(node == nullptr) continue; if(node->getName() == m_goalName) { @@ -954,7 +954,7 @@ void ServerPathBuilder::update ( void ) bool ServerPathBuilder::setupBuildPath ( CreatureObject const * creature, AiLocation const & goal ) { - if(creature == NULL) return false; + if(creature == nullptr) return false; if(!goal.isValid()) return false; m_creature = creature; @@ -971,7 +971,7 @@ bool ServerPathBuilder::setupBuildPath ( CreatureObject const * creature, AiLoca bool ServerPathBuilder::setupBuildPath ( CreatureObject const * creature, Unicode::String const & goalName ) { - if(creature == NULL) return false; + if(creature == nullptr) return false; if(goalName.empty()) return false; m_creature = creature; @@ -1058,23 +1058,23 @@ bool ServerPathBuilder::buildWorldPath(AiLocation const &startLocation, AiLocati // we can skip some work with looking up their cell and building // info. - m_creatureCellGraph = NULL; + m_creatureCellGraph = nullptr; m_creatureCellKey = -1; m_creatureCellNodeIndex = -1; m_creatureCellPart = -1; - m_goalCellGraph = NULL; + m_goalCellGraph = nullptr; m_goalCellKey = -1; m_goalCellNodeIndex = -1; m_goalCellPart = -1; - m_creatureBuilding = NULL; - m_creatureBuildingGraph = NULL; + m_creatureBuilding = nullptr; + m_creatureBuildingGraph = nullptr; m_creatureBuildingKey = -1; m_creatureBuildingNodeIndex = -1; - m_goalBuilding = NULL; - m_goalBuildingGraph = NULL; + m_goalBuilding = nullptr; + m_goalBuildingGraph = nullptr; m_goalBuildingKey = -1; m_goalBuildingNodeIndex = -1; @@ -1134,8 +1134,8 @@ bool ServerPathBuilder::buildWorldPath(AiLocation const &startLocation, AiLocati void ServerPathBuilder::addPathNode ( CellProperty const * cell, PathNode const * node ) { - if(node == NULL) return; - if(cell == NULL) cell = CellProperty::getWorldCellProperty(); + if(node == nullptr) return; + if(cell == nullptr) cell = CellProperty::getWorldCellProperty(); AiLocation loc(cell,node->getPosition_p()); @@ -1173,7 +1173,7 @@ void ServerPathBuilder::addPathNode ( CellProperty const * cell, PathNode const bool ServerPathBuilder::buildPathImmediate(AiLocation const & creature, AiLocation const & goal) { - m_creature = NULL; + m_creature = nullptr; m_goal = goal; m_buildDone = false; m_buildFailed = false; @@ -1190,9 +1190,9 @@ bool ServerPathBuilder::buildPathImmediate(AiLocation const & creature, AiLocati // ---------- CellProperty const * worldCell = CellProperty::getWorldCellProperty(); - if(m_creatureCell == NULL) + if(m_creatureCell == nullptr) m_creatureCell = worldCell; - if(m_goalCell == NULL) + if(m_goalCell == nullptr) m_goalCell = worldCell; @@ -1236,14 +1236,14 @@ bool ServerPathBuilder::buildPathImmediate(AiLocation const & creature, AiLocati m_goalBuildingNodeIndex = getIndexFor(m_goalBuilding, m_goalBuildingGraph, m_goal, m_goalCellPart); // If they're in the same building, start the search in the building - if((m_creatureBuilding == m_goalBuilding) && (m_creatureBuilding != NULL)) + if((m_creatureBuilding == m_goalBuilding) && (m_creatureBuilding != nullptr)) { if (buildPathInternal(m_creatureBuilding, m_creatureBuildingGraph, m_creatureBuildingNodeIndex, m_goalBuildingNodeIndex)) return true; } // If they're in the same cell, start the search in the cell - if((m_creatureCell == m_goalCell) && (m_creatureCell != NULL) && (m_creatureCell != CellProperty::getWorldCellProperty()) && (m_creatureCellPart == m_goalCellPart)) + if((m_creatureCell == m_goalCell) && (m_creatureCell != nullptr) && (m_creatureCell != CellProperty::getWorldCellProperty()) && (m_creatureCellPart == m_goalCellPart)) { if (buildPathInternal(m_creatureCell, m_creatureCellGraph, m_creatureCellNodeIndex, m_goalCellNodeIndex)) return true; @@ -1257,7 +1257,7 @@ bool ServerPathBuilder::buildPathImmediate(AiLocation const & creature, AiLocati m_goalCityGraph = CityPathGraphManager::getCityGraphFor(m_goal.getPosition_w()); m_goalCityNodeIndex = getIndexFor(m_goalCityGraph,m_goalBuilding,m_goal); - if((m_creatureCityGraph == m_goalCityGraph) && (m_creatureCityGraph != NULL)) + if((m_creatureCityGraph == m_goalCityGraph) && (m_creatureCityGraph != nullptr)) { // hack - If a creature in a city region tries to path search but it's not near a path node, // make its path search succeed diff --git a/engine/server/library/serverPathfinding/src/shared/ServerPathfindingMessaging.cpp b/engine/server/library/serverPathfinding/src/shared/ServerPathfindingMessaging.cpp index 068f9d3a..e71513d5 100755 --- a/engine/server/library/serverPathfinding/src/shared/ServerPathfindingMessaging.cpp +++ b/engine/server/library/serverPathfinding/src/shared/ServerPathfindingMessaging.cpp @@ -31,7 +31,7 @@ #include #include -ServerPathfindingMessaging * g_messaging = NULL; +ServerPathfindingMessaging * g_messaging = nullptr; // ====================================================================== @@ -51,7 +51,7 @@ void ServerPathfindingMessaging::remove ( void ) g_messaging->disconnectFromMessage(RequestUnstick::MESSAGE_TYPE); delete g_messaging; - g_messaging = NULL; + g_messaging = nullptr; } ServerPathfindingMessaging & ServerPathfindingMessaging::getInstance ( void ) @@ -75,10 +75,10 @@ ServerPathfindingMessaging::~ServerPathfindingMessaging() } delete m_clientList; - m_clientList = NULL; + m_clientList = nullptr; delete m_callback; - m_callback = NULL; + m_callback = nullptr; } // ---------- @@ -178,7 +178,7 @@ void ServerPathfindingMessaging::receiveMessage(const MessageDispatch::Emitter & { Transform newTransform = Transform::identity; newTransform.setPosition_p(unstickPoint); - controller->teleport(newTransform, NULL); + controller->teleport(newTransform, nullptr); } return; @@ -188,7 +188,7 @@ void ServerPathfindingMessaging::receiveMessage(const MessageDispatch::Emitter & Vector unstickPoint; CellObject * cell = ContainerInterface::getContainingCellObject(*s); - if (cell != NULL && s->asCreatureObject() != NULL) + if (cell != nullptr && s->asCreatureObject() != nullptr) { // try finding a waypoint in the cell first if (!cell->getClosestPathNodePos(*s, unstickPoint)) @@ -266,7 +266,7 @@ void ServerPathfindingMessaging::ignoreObjectPath(Client * client, const Network void ServerPathfindingMessaging::watchPathMap(Client * client) { - if(client == NULL) return; + if(client == nullptr) return; // Add the client to our client list @@ -290,7 +290,7 @@ void ServerPathfindingMessaging::watchPathMap(Client * client) void ServerPathfindingMessaging::ignorePathMap(Client * client) { - if(client == NULL) return; + if(client == nullptr) return; m_clientList->erase(client); @@ -319,7 +319,7 @@ void ServerPathfindingMessaging::onClientDestroy(ClientDestroy & d) void ServerPathfindingMessaging::sendGraphInfo ( CityPathGraph const * graph ) { - if(graph == NULL) return; + if(graph == nullptr) return; for(ClientList::iterator it = m_clientList->begin(); it != m_clientList->end(); ++it) { @@ -331,8 +331,8 @@ void ServerPathfindingMessaging::sendGraphInfo ( CityPathGraph const * graph ) void ServerPathfindingMessaging::sendGraphInfo ( CityPathGraph const * graph, Client * client ) { - if(client == NULL) return; - if(graph == NULL) return; + if(client == nullptr) return; + if(graph == nullptr) return; int nodeCount = graph->getNodeCount(); @@ -348,7 +348,7 @@ void ServerPathfindingMessaging::sendGraphInfo ( CityPathGraph const * graph, Cl void ServerPathfindingMessaging::sendEraseGraph ( CityPathGraph const * graph ) { - if(graph == NULL) return; + if(graph == nullptr) return; for(ClientList::iterator it = m_clientList->begin(); it != m_clientList->end(); ++it) { @@ -360,8 +360,8 @@ void ServerPathfindingMessaging::sendEraseGraph ( CityPathGraph const * graph ) void ServerPathfindingMessaging::sendEraseGraph ( CityPathGraph const * graph, Client * client ) { - if(client == NULL) return; - if(graph == NULL) return; + if(client == nullptr) return; + if(graph == nullptr) return; int nodeCount = graph->getNodeCount(); @@ -377,7 +377,7 @@ void ServerPathfindingMessaging::sendEraseGraph ( CityPathGraph const * graph, C void ServerPathfindingMessaging::sendNodeInfo ( CityPathNode const * node ) { - if(node == NULL) return; + if(node == nullptr) return; for(ClientList::iterator it = m_clientList->begin(); it != m_clientList->end(); ++it) { @@ -389,8 +389,8 @@ void ServerPathfindingMessaging::sendNodeInfo ( CityPathNode const * node ) void ServerPathfindingMessaging::sendNodeInfo ( CityPathNode const * node, Client * client ) { - if(node == NULL) return; - if(client == NULL) return; + if(node == nullptr) return; + if(client == nullptr) return; AINodeInfo m; @@ -428,7 +428,7 @@ void ServerPathfindingMessaging::sendNodeInfo ( CityPathNode const * node, Clien void ServerPathfindingMessaging::sendNeighborInfo ( CityPathNode const * node ) { - if(node == NULL) return; + if(node == nullptr) return; for(ClientList::iterator it = m_clientList->begin(); it != m_clientList->end(); ++it) { @@ -440,8 +440,8 @@ void ServerPathfindingMessaging::sendNeighborInfo ( CityPathNode const * node ) void ServerPathfindingMessaging::sendNeighborInfo ( CityPathNode const * node, Client * client ) { - if(node == NULL) return; - if(client == NULL) return; + if(node == nullptr) return; + if(client == nullptr) return; int edgeCount = node->getEdgeCount(); @@ -459,7 +459,7 @@ void ServerPathfindingMessaging::sendNeighborInfo ( CityPathNode const * node, C void ServerPathfindingMessaging::sendEraseNode ( CityPathNode const * node ) { - if(node == NULL) return; + if(node == nullptr) return; for(ClientList::iterator it = m_clientList->begin(); it != m_clientList->end(); ++it) { @@ -471,8 +471,8 @@ void ServerPathfindingMessaging::sendEraseNode ( CityPathNode const * node ) void ServerPathfindingMessaging::sendEraseNode ( CityPathNode const * node, Client * client ) { - if(node == NULL) return; - if(client == NULL) return; + if(node == nullptr) return; + if(client == nullptr) return; AINodeInfo m; @@ -497,7 +497,7 @@ void ServerPathfindingMessaging::sendWaypointInfo ( AiLocation const & loc ) void ServerPathfindingMessaging::sendWaypointInfo ( AiLocation const & loc, Client * client ) { - if(client == NULL) return; + if(client == nullptr) return; AINodeInfo m; @@ -531,7 +531,7 @@ void ServerPathfindingMessaging::sendEraseWaypoint ( AiLocation const & loc ) void ServerPathfindingMessaging::sendEraseWaypoint ( AiLocation const & loc, Client * client ) { - if(client == NULL) return; + if(client == nullptr) return; AINodeInfo m; diff --git a/engine/server/library/serverPathfinding/src/shared/ServerPathfindingNotification.cpp b/engine/server/library/serverPathfinding/src/shared/ServerPathfindingNotification.cpp index d524776c..25f8a676 100755 --- a/engine/server/library/serverPathfinding/src/shared/ServerPathfindingNotification.cpp +++ b/engine/server/library/serverPathfinding/src/shared/ServerPathfindingNotification.cpp @@ -44,7 +44,7 @@ void ServerPathfindingNotification::addToWorld ( Object & object ) const { CityPathGraphManager::addBuilding( building ); } - else if(object.asServerObject() != NULL && object.asServerObject()->isWaypoint()) + else if(object.asServerObject() != nullptr && object.asServerObject()->isWaypoint()) { CityPathGraphManager::addWaypoint( object.asServerObject() ); } @@ -61,7 +61,7 @@ void ServerPathfindingNotification::removeFromWorld ( Object & object ) const { CityPathGraphManager::removeBuilding( building ); } - else if(object.asServerObject() != NULL && object.asServerObject()->isWaypoint()) + else if(object.asServerObject() != nullptr && object.asServerObject()->isWaypoint()) { CityPathGraphManager::removeWaypoint( object.asServerObject() ); } @@ -79,7 +79,7 @@ bool ServerPathfindingNotification::positionChanged ( Object & object, bool /*du { CityPathGraphManager::moveBuilding( building, oldPosition ); } - else if(object.asServerObject() != NULL && object.asServerObject()->isWaypoint()) + else if(object.asServerObject() != nullptr && object.asServerObject()->isWaypoint()) { CityPathGraphManager::moveWaypoint( object.asServerObject(), oldPosition ); } @@ -95,7 +95,7 @@ bool ServerPathfindingNotification::positionAndRotationChanged ( Object & object { CityPathGraphManager::moveBuilding( building, oldPosition ); } - else if(object.asServerObject() != NULL && object.asServerObject()->isWaypoint()) + else if(object.asServerObject() != nullptr && object.asServerObject()->isWaypoint()) { CityPathGraphManager::moveWaypoint( object.asServerObject(), oldPosition ); } diff --git a/engine/server/library/serverScript/src/shared/GameScriptObject.cpp b/engine/server/library/serverScript/src/shared/GameScriptObject.cpp index c93ebbf4..3e8e9396 100755 --- a/engine/server/library/serverScript/src/shared/GameScriptObject.cpp +++ b/engine/server/library/serverScript/src/shared/GameScriptObject.cpp @@ -40,7 +40,7 @@ // class GameScriptObject static members //======================================================================== -GameScriptObject::ScriptDataMap * GameScriptObject::ms_scriptDataMap = NULL; +GameScriptObject::ScriptDataMap * GameScriptObject::ms_scriptDataMap = nullptr; bool GameScriptObject::m_pauseScripting = false; @@ -52,7 +52,7 @@ bool GameScriptObject::m_pauseScripting = false; * Class constructor. */ GameScriptObject::GameScriptObject(void) : - m_owner(NULL), + m_owner(nullptr), m_scriptList(), m_scriptListInitialized(false), m_scriptListValid(false), @@ -69,11 +69,11 @@ GameScriptObject::~GameScriptObject() { { PROFILER_AUTO_BLOCK_DEFINE("GameScriptObject::~GameScriptObject removeJavaId\n"); - if (JavaLibrary::instance() != NULL /*&& m_javaId != NULL*/) + if (JavaLibrary::instance() != nullptr /*&& m_javaId != nullptr*/) { NOT_NULL(m_owner); JavaLibrary::removeJavaId(m_owner->getNetworkId()); -// m_javaId = NULL; +// m_javaId = nullptr; } } @@ -82,7 +82,7 @@ GameScriptObject::~GameScriptObject() removeAll(); } m_scriptList.clear(); - m_owner = NULL; + m_owner = nullptr; } // GameScriptObject::~GameScriptObject /** @@ -92,7 +92,7 @@ GameScriptObject::~GameScriptObject() */ bool GameScriptObject::installScriptEngine(void) { - if (JavaLibrary::instance() != NULL) + if (JavaLibrary::instance() != nullptr) { DEBUG_WARNING(true, ("Trying to install script engine more than once")); return true; @@ -101,7 +101,7 @@ bool GameScriptObject::installScriptEngine(void) ms_scriptDataMap = new GameScriptObject::ScriptDataMap; Scripting::InitScriptFuncHashMap(); JavaLibrary::install(); - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return false; enableNewJediTracking(ConfigServerGame::getEnableNewJedi()); return true; @@ -114,7 +114,7 @@ void GameScriptObject::removeScriptEngine(void) { JavaLibrary::remove(); delete ms_scriptDataMap; - ms_scriptDataMap = NULL; + ms_scriptDataMap = nullptr; Scripting::RemoveScriptFuncHashMap(); } // GameScriptObject::removeScriptEngine @@ -145,10 +145,10 @@ void GameScriptObject::alter(real time) */ void GameScriptObject::setOwnerIsAuthoritative(bool authoritative, uint32 pid) { - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return; - if (m_owner != NULL && m_owner->getNetworkId() != NetworkId::cms_invalid) + if (m_owner != nullptr && m_owner->getNetworkId() != NetworkId::cms_invalid) { JavaLibrary::instance()->setObjIdAuthoritative(m_owner->getNetworkId(), authoritative, pid); @@ -171,9 +171,9 @@ void GameScriptObject::setOwnerIsAuthoritative(bool authoritative, uint32 pid) */ void GameScriptObject::setOwnerIsLoaded(void) { - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return; - if (m_owner != NULL && m_owner->getNetworkId() != NetworkId::cms_invalid) + if (m_owner != nullptr && m_owner->getNetworkId() != NetworkId::cms_invalid) { JavaLibrary::instance()->setObjIdLoaded(m_owner->getNetworkId()); } @@ -189,9 +189,9 @@ void GameScriptObject::setOwnerIsLoaded(void) */ void GameScriptObject::setOwnerIsInitialized(void) { - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return; - if (m_owner != NULL && m_owner->getNetworkId() != NetworkId::cms_invalid) + if (m_owner != nullptr && m_owner->getNetworkId() != NetworkId::cms_invalid) { JavaLibrary::instance()->setObjIdInitialized(m_owner->getNetworkId()); if (m_owner->isAuthoritative()) @@ -211,10 +211,10 @@ void GameScriptObject::setOwnerIsInitialized(void) */ void GameScriptObject::setOwnerDestroyed(void) { - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return; - if (m_owner != NULL && m_owner->getNetworkId() != NetworkId::cms_invalid && m_owner->isAuthoritative()) + if (m_owner != nullptr && m_owner->getNetworkId() != NetworkId::cms_invalid && m_owner->isAuthoritative()) JavaLibrary::flagDestroyed(m_owner->getNetworkId()); } //lint !e1762 Do not make const @@ -283,7 +283,7 @@ int GameScriptObject::attachScript(const std::string& scriptName, bool runTrigge } else { - if (ms_scriptDataMap == NULL || JavaLibrary::instance() == NULL) + if (ms_scriptDataMap == nullptr || JavaLibrary::instance() == nullptr) return SCRIPT_CONTINUE; if (ms_scriptDataMap->find(scriptName) == ms_scriptDataMap->end()) @@ -379,7 +379,7 @@ int GameScriptObject::detachScript(const std::string& scriptName) else { - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return SCRIPT_CONTINUE; // Make sure to call the detach trigger on this one script if one exists. @@ -420,12 +420,12 @@ void GameScriptObject::initScriptInstances() { m_scriptListInitialized = true; - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return; if (!m_owner) { - WARNING_STRICT_FATAL(true, ("Use of null m_owner in ::initScriptInstances()")); + WARNING_STRICT_FATAL(true, ("Use of nullptr m_owner in ::initScriptInstances()")); return; } @@ -454,7 +454,7 @@ void GameScriptObject::initScriptInstances() */ void GameScriptObject::removeAll(void) { - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return; // removeAll() cannot be overriden by scripts @@ -483,12 +483,12 @@ int GameScriptObject::trigAllScripts(Scripting::TrigId trigId, ScriptParams &par { NOT_NULL(m_owner); - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return SCRIPT_CONTINUE; -// if (m_javaId == NULL && m_owner != NULL && m_owner->getNetworkId().getValue() != 0) +// if (m_javaId == nullptr && m_owner != nullptr && m_owner->getNetworkId().getValue() != 0) // { -// if (JavaLibrary::instance() != NULL) +// if (JavaLibrary::instance() != nullptr) // m_javaId = JavaLibrary::getObjId(m_owner->getNetworkId()); // } @@ -497,7 +497,7 @@ int GameScriptObject::trigAllScripts(Scripting::TrigId trigId, ScriptParams &par //Authoritative check temporarily removed because some triggers aren't being called //because the setAuth message hasn't come in yet from Central on load. - if (m_owner == NULL) //@todo FIX THIS HACK || !m_owner->isAuthoritative()) + if (m_owner == nullptr) //@todo FIX THIS HACK || !m_owner->isAuthoritative()) return SCRIPT_CONTINUE; if(!m_owner->isAuthoritative()) @@ -506,7 +506,7 @@ int GameScriptObject::trigAllScripts(Scripting::TrigId trigId, ScriptParams &par Archive::put(paramArchive, params); MessageQueueScriptTrigger * data = new MessageQueueScriptTrigger(static_cast(trigId), paramArchive); ServerController * controller = dynamic_cast(m_owner->getController()); - if(controller != NULL) + if(controller != nullptr) { controller->appendMessage( CM_scriptTrigger, @@ -557,13 +557,13 @@ int GameScriptObject::trigAllScripts(Scripting::TrigId trigId, ScriptParams &par */ int GameScriptObject::trigOneScript(const std::string& scriptName, Scripting::TrigId trigId, ScriptParams ¶ms) const { - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return SCRIPT_CONTINUE; if (m_pauseScripting) return SCRIPT_CONTINUE; - if (m_owner == NULL /*|| !m_owner->isAuthoritative()*/) + if (m_owner == nullptr /*|| !m_owner->isAuthoritative()*/) return SCRIPT_OVERRIDE; if (!m_owner->isAuthoritative() && (trigId != Scripting::TRIG_ATTACH && @@ -607,7 +607,7 @@ int GameScriptObject::trigOneScript(const std::string& scriptName, Scripting::Tr int GameScriptObject::trigScriptFromConsole(const Scripting::TrigId trigId, const std::string &scriptName, const StringVector_t &args) const { - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) { LOG("ScriptInvestigation", ("Returning script continue from console trigger request because there is no JavaLibrary instance\n")); return SCRIPT_CONTINUE; @@ -619,9 +619,9 @@ int GameScriptObject::trigScriptFromConsole(const Scripting::TrigId trigId, return SCRIPT_CONTINUE; } - if (m_owner == NULL ) + if (m_owner == nullptr ) { - LOG("ScriptInvestigation", ("Returning script override from console trigger request becuase m_owner is null\n")); + LOG("ScriptInvestigation", ("Returning script override from console trigger request becuase m_owner is nullptr\n")); return SCRIPT_OVERRIDE; } @@ -660,14 +660,14 @@ int GameScriptObject::trigScriptFromConsole(const Scripting::TrigId trigId, bool GameScriptObject::handleMessage(const std::string &messageName, const ScriptDictionaryPtr & data) { - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) { WARNING_STRICT_FATAL(true, ("(messageToFailure) GameScriptObject::handleMessage got message " "when Java not running")); return true; } - if (getOwner() == NULL) + if (getOwner() == nullptr) { WARNING_STRICT_FATAL(true, ("(messageToFailure) GameScriptObject::handleMessage got message " "with no owner")); @@ -703,7 +703,7 @@ bool GameScriptObject::handleMessage(const std::string &messageName, const std:: { ScriptDictionaryPtr dictionary; - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return true; if (m_pauseScripting) @@ -733,7 +733,7 @@ bool GameScriptObject::handleMessage(const std::string &messageName, const std:: */ int GameScriptObject::callScriptCommandHandler(std::string const &funcName, ScriptParams ¶ms) const { - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return SCRIPT_CONTINUE; if (m_pauseScripting) @@ -757,7 +757,7 @@ int GameScriptObject::callScriptCommandHandler(std::string const &funcName, Scri */ int GameScriptObject::callScriptBuffHandler(std::string const &funcName, ScriptParams ¶ms) const { - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return SCRIPT_CONTINUE; if (m_pauseScripting) @@ -825,7 +825,7 @@ void GameScriptObject::enumerateScripts(std::vector &scriptNames) c */ void GameScriptObject::makeScriptDictionary(const ScriptParams & params, ScriptDictionaryPtr & dictionary) { - if (JavaLibrary::instance() != NULL) + if (JavaLibrary::instance() != nullptr) { JavaDictionaryPtr jdp; JavaLibrary::instance()->convert(params, jdp); @@ -840,7 +840,7 @@ void GameScriptObject::makeScriptDictionary(const ScriptParams & params, ScriptD */ bool GameScriptObject::isScriptingEnabled(void) { - if (JavaLibrary::instance() != NULL) + if (JavaLibrary::instance() != nullptr) return true; return false; } // GameScriptObject::isScriptingEnabled @@ -854,7 +854,7 @@ bool GameScriptObject::isScriptingEnabled(void) */ bool GameScriptObject::reloadScript(const std::string& scriptName) { - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return false; @@ -904,7 +904,7 @@ bool GameScriptObject::reloadScript(const std::string& scriptName) */ void GameScriptObject::enableLogging(bool enable) { - if (JavaLibrary::instance() != NULL) + if (JavaLibrary::instance() != nullptr) JavaLibrary::instance()->enableLogging(enable); } // GameScriptObject::enableLogging @@ -917,7 +917,7 @@ void GameScriptObject::enableLogging(bool enable) */ void GameScriptObject::enableNewJediTracking(bool enableTracking) { - if (JavaLibrary::instance() != NULL) + if (JavaLibrary::instance() != nullptr) JavaLibrary::instance()->enableNewJediTracking(enableTracking); } // GameScriptObject::enableNewJediTracking @@ -946,7 +946,7 @@ Scheduler & GameScriptObject::getScriptScheduler() void GameScriptObject::onStopWatching(ServerObject & subject) { - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return; if (m_owner) @@ -959,7 +959,7 @@ void GameScriptObject::onStopWatching(ServerObject & subject) void GameScriptObject::onWatching(ServerObject & subject) { - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return; if (m_owner) @@ -972,7 +972,7 @@ void GameScriptObject::onWatching(ServerObject & subject) void GameScriptObject::runOneScript(const std::string & scriptName, const std::string & methodName, const std::string & argTypes, ScriptParams & args) { - if (JavaLibrary::instance() != NULL) + if (JavaLibrary::instance() != nullptr) IGNORE_RETURN( JavaLibrary::instance()->runScript(NetworkId(), scriptName, methodName, argTypes, args) ); } @@ -994,7 +994,7 @@ std::string GameScriptObject::callScriptConsoleHandler(const std::string & scrip { static const std::string errorReturnString; - if (JavaLibrary::instance() != NULL) + if (JavaLibrary::instance() != nullptr) { return JavaLibrary::instance()->callScriptConsoleHandler(scriptName, methodName, argTypes, args); } @@ -1019,7 +1019,7 @@ void GameScriptObject::callSpaceClearOvert(const NetworkId &ship) std::string GameScriptObject::callDumpTargetInfo( NetworkId &id ) { - if( JavaLibrary::instance() != NULL ) + if( JavaLibrary::instance() != nullptr ) { return JavaLibrary::instance()->getObjectDumpInfo( id ); } @@ -1030,7 +1030,7 @@ std::string GameScriptObject::callDumpTargetInfo( NetworkId &id ) void GameScriptObject::setScriptVar(const std::string & name, int value) { - if (JavaLibrary::instance() == NULL || m_owner == NULL) + if (JavaLibrary::instance() == nullptr || m_owner == nullptr) return; JavaLibrary::setScriptVar(*m_owner, name, value); @@ -1040,7 +1040,7 @@ void GameScriptObject::setScriptVar(const std::string & name, int value) void GameScriptObject::setScriptVar(const std::string & name, float value) { - if (JavaLibrary::instance() == NULL || m_owner == NULL) + if (JavaLibrary::instance() == nullptr || m_owner == nullptr) return; JavaLibrary::setScriptVar(*m_owner, name, value); @@ -1050,7 +1050,7 @@ void GameScriptObject::setScriptVar(const std::string & name, float value) void GameScriptObject::setScriptVar(const std::string & name, const std::string & value) { - if (JavaLibrary::instance() == NULL || m_owner == NULL) + if (JavaLibrary::instance() == nullptr || m_owner == nullptr) return; JavaLibrary::setScriptVar(*m_owner, name, value); @@ -1060,7 +1060,7 @@ void GameScriptObject::setScriptVar(const std::string & name, const std::string void GameScriptObject::packAllScriptVarDeltas() { - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return; JavaLibrary::packAllDeltaScriptVars(); @@ -1070,7 +1070,7 @@ void GameScriptObject::packAllScriptVarDeltas() void GameScriptObject::clearScriptVars() { - if (JavaLibrary::instance() == NULL || m_owner == NULL) + if (JavaLibrary::instance() == nullptr || m_owner == nullptr) return; JavaLibrary::clearScriptVars(*m_owner); @@ -1080,7 +1080,7 @@ void GameScriptObject::clearScriptVars() void GameScriptObject::packScriptVars(std::vector & target) const { - if (JavaLibrary::instance() == NULL || m_owner == NULL) + if (JavaLibrary::instance() == nullptr || m_owner == nullptr) return; JavaLibrary::packScriptVars(*m_owner, target); @@ -1090,7 +1090,7 @@ void GameScriptObject::packScriptVars(std::vector & target) const void GameScriptObject::unpackScriptVars(const std::vector & source) const { - if (JavaLibrary::instance() == NULL || m_owner == NULL) + if (JavaLibrary::instance() == nullptr || m_owner == nullptr) return; JavaLibrary::unpackScriptVars(*m_owner, source); @@ -1100,7 +1100,7 @@ void GameScriptObject::unpackScriptVars(const std::vector & source) const void GameScriptObject::unpackDeltaScriptVars(const std::vector & data) const { - if (JavaLibrary::instance() == NULL || m_owner == NULL) + if (JavaLibrary::instance() == nullptr || m_owner == nullptr) return; DEBUG_REPORT_LOG(! m_owner, ("A game script object received a request to unpack script var synchronization data, but it has no owner object!!! All GameScriptObjects MUST have owners!\n")); @@ -1238,18 +1238,18 @@ namespace Archive GameScriptObject * GameScriptObject::asGameScriptObject(Object * const object) { - ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - return (serverObject != NULL) ? serverObject->getScriptObject() : NULL; + return (serverObject != nullptr) ? serverObject->getScriptObject() : nullptr; } // ---------------------------------------------------------------------- GameScriptObject const * GameScriptObject::asGameScriptObject(Object const * const object) { - ServerObject const * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + ServerObject const * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - return (serverObject != NULL) ? serverObject->getScriptObject() : NULL; + return (serverObject != nullptr) ? serverObject->getScriptObject() : nullptr; } // ====================================================================== diff --git a/engine/server/library/serverScript/src/shared/JNIWrappers.cpp b/engine/server/library/serverScript/src/shared/JNIWrappers.cpp index d4746415..d958183a 100755 --- a/engine/server/library/serverScript/src/shared/JNIWrappers.cpp +++ b/engine/server/library/serverScript/src/shared/JNIWrappers.cpp @@ -90,7 +90,7 @@ LocalRefPtr createNewObject(jclass clazz, jmethodID constructorID, ...) JavaStringPtr createNewString(const char * bytes) { - if (bytes != NULL) + if (bytes != nullptr) { JavaStringPtr result(new JavaString(JavaLibrary::getEnv()->NewStringUTF(bytes))); if (result->getValue() != 0) @@ -103,7 +103,7 @@ JavaStringPtr createNewString(const char * bytes) JavaStringPtr createNewString(const jchar * unicodeChars, jsize len) { - if (unicodeChars != NULL && len >= 0) + if (unicodeChars != nullptr && len >= 0) { JavaStringPtr result(new JavaString(JavaLibrary::getEnv()->NewString(unicodeChars, len))); if (result->getValue() != 0) @@ -902,7 +902,7 @@ LocalRef::LocalRef(jobject src) : LocalRef::~LocalRef() { - if (m_ref != 0 && JavaLibrary::getEnv() != NULL) + if (m_ref != 0 && JavaLibrary::getEnv() != nullptr) JavaLibrary::getEnv()->DeleteLocalRef(m_ref); m_ref = 0; } @@ -917,7 +917,7 @@ LocalArrayRef::LocalArrayRef(jarray src) : LocalArrayRef::~LocalArrayRef() { - if (m_ref != 0 && JavaLibrary::getEnv() != NULL) + if (m_ref != 0 && JavaLibrary::getEnv() != nullptr) JavaLibrary::getEnv()->DeleteLocalRef(m_ref); m_ref = 0; } @@ -932,7 +932,7 @@ LocalObjectArrayRef::LocalObjectArrayRef(jobjectArray src) : LocalObjectArrayRef::~LocalObjectArrayRef() { - if (m_ref != 0 && JavaLibrary::getEnv() != NULL) + if (m_ref != 0 && JavaLibrary::getEnv() != nullptr) JavaLibrary::getEnv()->DeleteLocalRef(m_ref); m_ref = 0; } @@ -1002,13 +1002,13 @@ LocalLongArrayRef::~LocalLongArrayRef() GlobalRef::GlobalRef(const LocalRefParam & src) : LocalRefParam(static_cast(0)) { - if (src.getValue() != 0 && JavaLibrary::getEnv() != NULL) + if (src.getValue() != 0 && JavaLibrary::getEnv() != nullptr) m_ref = JavaLibrary::getEnv()->NewGlobalRef(src.getValue()); } GlobalRef::~GlobalRef() { - if (m_ref != 0 && JavaLibrary::getEnv() != NULL) + if (m_ref != 0 && JavaLibrary::getEnv() != nullptr) JavaLibrary::getEnv()->DeleteGlobalRef(m_ref); m_ref = 0; } @@ -1019,13 +1019,13 @@ GlobalRef::~GlobalRef() GlobalArrayRef::GlobalArrayRef(const LocalObjectArrayRefParam & src) : LocalObjectArrayRefParam(static_cast(0)) { - if (src.getValue() != 0 && JavaLibrary::getEnv() != NULL) + if (src.getValue() != 0 && JavaLibrary::getEnv() != nullptr) m_ref = JavaLibrary::getEnv()->NewGlobalRef(src.getValue()); } GlobalArrayRef::~GlobalArrayRef() { - if (m_ref != 0 && JavaLibrary::getEnv() != NULL) + if (m_ref != 0 && JavaLibrary::getEnv() != nullptr) JavaLibrary::getEnv()->DeleteGlobalRef(m_ref); m_ref = 0; } @@ -1048,10 +1048,10 @@ JavaStringParam::~JavaStringParam() int JavaStringParam::fillBuffer(char * buffer, int size) const { - if (m_ref != 0 && buffer != NULL && JavaLibrary::getEnv() != NULL) + if (m_ref != 0 && buffer != nullptr && JavaLibrary::getEnv() != nullptr) { // Get the number of storage bytes required to convert this Java string into a UTF-8 string. - // Include the terminating null byte in the required buffer size. + // Include the terminating nullptr byte in the required buffer size. int requiredBufferSize = JavaLibrary::getEnv()->GetStringUTFLength(static_cast(m_ref)) + 1; if (requiredBufferSize <= size) { @@ -1059,7 +1059,7 @@ int JavaStringParam::fillBuffer(char * buffer, int size) const JavaLibrary::getEnv()->GetStringUTFRegion(static_cast(m_ref), 0, stringLength, buffer); - // Null terminate the string. requiredBufferSize already includes the byte count for the null terminator. + // Null terminate the string. requiredBufferSize already includes the byte count for the nullptr terminator. buffer[requiredBufferSize - 1] = '\0'; return requiredBufferSize; @@ -1077,7 +1077,7 @@ JavaString::JavaString(jstring src) : } JavaString::JavaString(const char * src) : - JavaStringParam(JavaLibrary::getEnv()->NewStringUTF(src != NULL ? src : "")) + JavaStringParam(JavaLibrary::getEnv()->NewStringUTF(src != nullptr ? src : "")) { } @@ -1093,7 +1093,7 @@ JavaString::JavaString(const Unicode::String & src) : JavaString::~JavaString() { - if (m_ref != 0 && JavaLibrary::getEnv() != NULL) + if (m_ref != 0 && JavaLibrary::getEnv() != nullptr) JavaLibrary::getEnv()->DeleteLocalRef(m_ref); m_ref = 0; } diff --git a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp index 39dfced2..0cbc73ac 100755 --- a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp +++ b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp @@ -70,7 +70,7 @@ using namespace JNIWrappersNamespace; #define GET_METHOD(var, clazz, name, sig) var = ms_env->GetMethodID(clazz, name, sig); if (ms_env->ExceptionCheck()) { ms_env->ExceptionDescribe(); WARNING(true, ("Unable to find Java method "#name" for class "#clazz)); return false; } #define GET_STATIC_METHOD(var, clazz, name, sig) var = ms_env->GetStaticMethodID(clazz, name, sig); if (ms_env->ExceptionCheck()) { ms_env->ExceptionDescribe(); WARNING(true, ("Unable to find Java static method "#name" for class "#clazz)); return false; } -#define FREE_CLASS(var) if (ms_env != NULL && var != NULL) { ms_env->DeleteGlobalRef(var); var = NULL; } +#define FREE_CLASS(var) if (ms_env != nullptr && var != nullptr) { ms_env->DeleteGlobalRef(var); var = nullptr; } //======================================================================== // local constants @@ -377,203 +377,203 @@ namespace ScriptMethodsWorldInfoNamespace // class JavaLibrary static members //======================================================================== -JavaLibrary* JavaLibrary::ms_instance = NULL; +JavaLibrary* JavaLibrary::ms_instance = nullptr; int JavaLibrary::ms_javaVmType = JV_none; -//void* JavaLibrary::ms_libHandle = NULL; -JavaVM* JavaLibrary::ms_jvm = NULL; -JNIEnv* JavaLibrary::ms_env = NULL; -Thread * JavaLibrary::m_initializerThread = NULL; +//void* JavaLibrary::ms_libHandle = nullptr; +JavaVM* JavaLibrary::ms_jvm = nullptr; +JNIEnv* JavaLibrary::ms_env = nullptr; +Thread * JavaLibrary::m_initializerThread = nullptr; int JavaLibrary::ms_envCount = 0; int JavaLibrary::ms_currentRecursionCount = 0; bool JavaLibrary::ms_resetJava = false; -jclass JavaLibrary::ms_clsScriptEntry = NULL; -jobject JavaLibrary::ms_scriptEntry = NULL; -jmethodID JavaLibrary::ms_midScriptEntryGetOwnerContext = NULL; -jmethodID JavaLibrary::ms_midScriptEntryEnableLogging = NULL; -jmethodID JavaLibrary::ms_midScriptEntryEnableNewJediTracking = NULL; -jmethodID JavaLibrary::ms_midScriptEntryGetFreeMem = NULL; -jclass JavaLibrary::ms_clsObject = NULL; -jclass JavaLibrary::ms_clsClass = NULL; -jmethodID JavaLibrary::ms_midClassGetName = NULL; -jmethodID JavaLibrary::ms_midClassGetMethods = NULL; -jclass JavaLibrary::ms_clsMethod = NULL; -jmethodID JavaLibrary::ms_midMethodGetName = NULL; -jclass JavaLibrary::ms_clsBoolean = NULL; -jclass JavaLibrary::ms_clsBooleanArray = NULL; -jmethodID JavaLibrary::ms_midBoolean = NULL; -jmethodID JavaLibrary::ms_midBooleanBooleanValue = NULL; -jclass JavaLibrary::ms_clsInteger = NULL; -jclass JavaLibrary::ms_clsIntegerArray = NULL; -jmethodID JavaLibrary::ms_midInteger = NULL; -jmethodID JavaLibrary::ms_midIntegerIntValue = NULL; -jclass JavaLibrary::ms_clsModifiableInt = NULL; -jmethodID JavaLibrary::ms_midModifiableInt = NULL; -jfieldID JavaLibrary::ms_fidModifiableIntData = NULL; -jclass JavaLibrary::ms_clsFloat = NULL; -jclass JavaLibrary::ms_clsFloatArray = NULL; -jmethodID JavaLibrary::ms_midFloat = NULL; -jmethodID JavaLibrary::ms_midFloatFloatValue = NULL; -jclass JavaLibrary::ms_clsModifiableFloat = NULL; -jmethodID JavaLibrary::ms_midModifiableFloat = NULL; -jfieldID JavaLibrary::ms_fidModifiableFloatData = NULL; -jclass JavaLibrary::ms_clsString = NULL; -jclass JavaLibrary::ms_clsStringArray = NULL; -jclass JavaLibrary::ms_clsMap = NULL; -jmethodID JavaLibrary::ms_midMapPut = NULL; -jmethodID JavaLibrary::ms_midMapGet = NULL; -jclass JavaLibrary::ms_clsHashtable = NULL; -jmethodID JavaLibrary::ms_midHashtable = NULL; -jclass JavaLibrary::ms_clsThrowable = NULL; -jclass JavaLibrary::ms_clsError = NULL; -jclass JavaLibrary::ms_clsStackOverflowError = NULL; -jmethodID JavaLibrary::ms_midThrowableGetMessage = NULL; -jclass JavaLibrary::ms_clsThread = NULL; -jmethodID JavaLibrary::ms_midThreadDumpStack = NULL; -jclass JavaLibrary::ms_clsInternalScriptError = NULL; -jclass JavaLibrary::ms_clsInternalScriptSeriousError = NULL; -jfieldID JavaLibrary::ms_fidInternalScriptSeriousErrorError = NULL; -jclass JavaLibrary::ms_clsDictionary = NULL; -jmethodID JavaLibrary::ms_midDictionary = NULL; -jmethodID JavaLibrary::ms_midDictionaryPack = NULL; -jmethodID JavaLibrary::ms_midDictionaryUnpack = NULL; -jmethodID JavaLibrary::ms_midDictionaryKeys = NULL; -jmethodID JavaLibrary::ms_midDictionaryValues = NULL; -jmethodID JavaLibrary::ms_midDictionaryPut = NULL; -jmethodID JavaLibrary::ms_midDictionaryPutInt = NULL; -jmethodID JavaLibrary::ms_midDictionaryPutFloat = NULL; -jmethodID JavaLibrary::ms_midDictionaryPutBool = NULL; -jmethodID JavaLibrary::ms_midDictionaryGet = NULL; -jclass JavaLibrary::ms_clsCollection = NULL; -jmethodID JavaLibrary::ms_midCollectionToArray = NULL; -jclass JavaLibrary::ms_clsEnumeration = NULL; -jmethodID JavaLibrary::ms_midEnumerationHasMoreElements = NULL; -jmethodID JavaLibrary::ms_midEnumerationNextElement = NULL; -jclass JavaLibrary::ms_clsBaseClassRangeInfo = NULL; -jfieldID JavaLibrary::ms_fidBaseClassRangeInfoMinRange = NULL; -jfieldID JavaLibrary::ms_fidBaseClassRangeInfoMaxRange = NULL; -jclass JavaLibrary::ms_clsBaseClassAttackerResults = NULL; -jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsId = NULL; -jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsWeapon = NULL; -jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsPosture = NULL; -jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsTrailBits = NULL; -jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsClientEffectId = NULL; -jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsActionName = NULL; -jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsUseLocation = NULL; -jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsTargetLocation = NULL; -jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsTargetCell = NULL; -jclass JavaLibrary::ms_clsBaseClassDefenderResults = NULL; -jfieldID JavaLibrary::ms_fidBaseClassDefenderResultsId = NULL; -jfieldID JavaLibrary::ms_fidBaseClassDefenderResultsPosture = NULL; -jfieldID JavaLibrary::ms_fidBaseClassDefenderResultsResult = NULL; -jfieldID JavaLibrary::ms_fidBaseClassDefenderResultsClientEffectId = NULL; -jfieldID JavaLibrary::ms_fidBaseClassDefenderResultsHitLocation = NULL; -jfieldID JavaLibrary::ms_fidBaseClassDefenderDamageAmount = NULL; -jclass JavaLibrary::ms_clsDynamicVariable = NULL; -jfieldID JavaLibrary::ms_fidDynamicVariableName = NULL; -jfieldID JavaLibrary::ms_fidDynamicVariableData = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableInt = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableIntArray = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableFloat = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableFloatArray = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableString = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableStringArray = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableObjId = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableObjIdArray = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableLocation = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableLocationArray = NULL; -jclass JavaLibrary::ms_clsDynamicVariableList = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableList = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSet = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSetInt = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSetIntArray = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSetFloat = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSetFloatArray = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSetString = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSetStringArray = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSetObjId = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSetObjIdArray = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSetLocation = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSetLocationArray = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSetStringId = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSetStringIdArray = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSetTransform = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSetTransformArray = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSetVector = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSetVectorArray = NULL; -jclass JavaLibrary::ms_clsObjId = NULL; -jclass JavaLibrary::ms_clsObjIdArray = NULL; -jmethodID JavaLibrary::ms_midObjIdGetValue = NULL; -jmethodID JavaLibrary::ms_midObjIdGetObjId = NULL; -jmethodID JavaLibrary::ms_midObjIdClearObjId = NULL; -jmethodID JavaLibrary::ms_midObjIdFlagDestroyed = NULL; -jmethodID JavaLibrary::ms_midObjIdSetAuthoritative = NULL; -jmethodID JavaLibrary::ms_midObjIdSetLoaded = NULL; -jmethodID JavaLibrary::ms_midObjIdSetInitialized = NULL; -jmethodID JavaLibrary::ms_midObjIdSetLoggedIn = NULL; -jmethodID JavaLibrary::ms_midObjIdPackAllDeltaScriptVars = NULL; -jmethodID JavaLibrary::ms_midObjIdSetScriptVarInt = NULL; -jmethodID JavaLibrary::ms_midObjIdSetScriptVarFloat = NULL; -jmethodID JavaLibrary::ms_midObjIdSetScriptVarString = NULL; -jmethodID JavaLibrary::ms_midObjIdClearScriptVars = NULL; -jmethodID JavaLibrary::ms_midObjIdPackScriptVars = NULL; -jmethodID JavaLibrary::ms_midObjIdUnpackDeltaScriptVars = NULL; -jmethodID JavaLibrary::ms_midObjIdUnpackScriptVars = NULL; -jmethodID JavaLibrary::ms_midObjIdAttachScript = NULL; -jmethodID JavaLibrary::ms_midObjIdAttachScripts = NULL; -jmethodID JavaLibrary::ms_midObjIdDetachScript = NULL; -jmethodID JavaLibrary::ms_midObjIdDetachAllScripts = NULL; -jclass JavaLibrary::ms_clsStringId = NULL; -jmethodID JavaLibrary::ms_midStringId = NULL; -jclass JavaLibrary::ms_clsStringIdArray = NULL; -jfieldID JavaLibrary::ms_fidStringIdTable = NULL; -jfieldID JavaLibrary::ms_fidStringIdAsciiId = NULL; -jfieldID JavaLibrary::ms_fidStringIdIndexId = NULL; -jclass JavaLibrary::ms_clsModifiableStringId = NULL; -jclass JavaLibrary::ms_clsAttribute = NULL; -jmethodID JavaLibrary::ms_midAttribute = NULL; -jfieldID JavaLibrary::ms_fidAttributeType = NULL; -jfieldID JavaLibrary::ms_fidAttributeValue = NULL; -jclass JavaLibrary::ms_clsAttribMod = NULL; -jmethodID JavaLibrary::ms_midAttribMod = NULL; -jfieldID JavaLibrary::ms_fidAttribModName = NULL; -jfieldID JavaLibrary::ms_fidAttribModSkill = NULL; -jfieldID JavaLibrary::ms_fidAttribModType = NULL; -jfieldID JavaLibrary::ms_fidAttribModValue = NULL; -jfieldID JavaLibrary::ms_fidAttribModTime = NULL; -jfieldID JavaLibrary::ms_fidAttribModAttack = NULL; -jfieldID JavaLibrary::ms_fidAttribModDecay = NULL; -jfieldID JavaLibrary::ms_fidAttribModFlags = NULL; -jclass JavaLibrary::ms_clsMentalState = NULL; -jmethodID JavaLibrary::ms_midMentalState = NULL; -jfieldID JavaLibrary::ms_fidMentalStateType = NULL; -jfieldID JavaLibrary::ms_fidMentalStateValue = NULL; -jclass JavaLibrary::ms_clsMentalStateMod = NULL; -jmethodID JavaLibrary::ms_midMentalStateMod = NULL; -jfieldID JavaLibrary::ms_fidMentalStateModType = NULL; -jfieldID JavaLibrary::ms_fidMentalStateModValue = NULL; -jfieldID JavaLibrary::ms_fidMentalStateModTime = NULL; -jfieldID JavaLibrary::ms_fidMentalStateModAttack = NULL; -jfieldID JavaLibrary::ms_fidMentalStateModDecay = NULL; -jclass JavaLibrary::ms_clsLocation = NULL; -jclass JavaLibrary::ms_clsLocationArray = NULL; -jfieldID JavaLibrary::ms_fidLocationX = NULL; -jfieldID JavaLibrary::ms_fidLocationY = NULL; -jfieldID JavaLibrary::ms_fidLocationZ = NULL; -jfieldID JavaLibrary::ms_fidLocationArea = NULL; -jfieldID JavaLibrary::ms_fidLocationCell = NULL; -jmethodID JavaLibrary::ms_midRunOne = NULL; -jmethodID JavaLibrary::ms_midRunAll = NULL; -jmethodID JavaLibrary::ms_midCallMessages = NULL; -jmethodID JavaLibrary::ms_midRunConsoleHandler = NULL; -jmethodID JavaLibrary::ms_midUnload = NULL; -jmethodID JavaLibrary::ms_midGetClass = NULL; -jmethodID JavaLibrary::ms_midGetScriptFunctions = NULL; -jclass JavaLibrary::ms_clsMenuInfo = NULL; -jmethodID JavaLibrary::ms_midMenuInfo = NULL; -jmethodID JavaLibrary::ms_midMenuInfoSetMenuItemsInternal = NULL; -jmethodID JavaLibrary::ms_midMenuInfoGetMenuItemsInternal = NULL; -jclass JavaLibrary::ms_clsMenuInfoData = NULL; -jmethodID JavaLibrary::ms_midMenuInfoData = NULL; +jclass JavaLibrary::ms_clsScriptEntry = nullptr; +jobject JavaLibrary::ms_scriptEntry = nullptr; +jmethodID JavaLibrary::ms_midScriptEntryGetOwnerContext = nullptr; +jmethodID JavaLibrary::ms_midScriptEntryEnableLogging = nullptr; +jmethodID JavaLibrary::ms_midScriptEntryEnableNewJediTracking = nullptr; +jmethodID JavaLibrary::ms_midScriptEntryGetFreeMem = nullptr; +jclass JavaLibrary::ms_clsObject = nullptr; +jclass JavaLibrary::ms_clsClass = nullptr; +jmethodID JavaLibrary::ms_midClassGetName = nullptr; +jmethodID JavaLibrary::ms_midClassGetMethods = nullptr; +jclass JavaLibrary::ms_clsMethod = nullptr; +jmethodID JavaLibrary::ms_midMethodGetName = nullptr; +jclass JavaLibrary::ms_clsBoolean = nullptr; +jclass JavaLibrary::ms_clsBooleanArray = nullptr; +jmethodID JavaLibrary::ms_midBoolean = nullptr; +jmethodID JavaLibrary::ms_midBooleanBooleanValue = nullptr; +jclass JavaLibrary::ms_clsInteger = nullptr; +jclass JavaLibrary::ms_clsIntegerArray = nullptr; +jmethodID JavaLibrary::ms_midInteger = nullptr; +jmethodID JavaLibrary::ms_midIntegerIntValue = nullptr; +jclass JavaLibrary::ms_clsModifiableInt = nullptr; +jmethodID JavaLibrary::ms_midModifiableInt = nullptr; +jfieldID JavaLibrary::ms_fidModifiableIntData = nullptr; +jclass JavaLibrary::ms_clsFloat = nullptr; +jclass JavaLibrary::ms_clsFloatArray = nullptr; +jmethodID JavaLibrary::ms_midFloat = nullptr; +jmethodID JavaLibrary::ms_midFloatFloatValue = nullptr; +jclass JavaLibrary::ms_clsModifiableFloat = nullptr; +jmethodID JavaLibrary::ms_midModifiableFloat = nullptr; +jfieldID JavaLibrary::ms_fidModifiableFloatData = nullptr; +jclass JavaLibrary::ms_clsString = nullptr; +jclass JavaLibrary::ms_clsStringArray = nullptr; +jclass JavaLibrary::ms_clsMap = nullptr; +jmethodID JavaLibrary::ms_midMapPut = nullptr; +jmethodID JavaLibrary::ms_midMapGet = nullptr; +jclass JavaLibrary::ms_clsHashtable = nullptr; +jmethodID JavaLibrary::ms_midHashtable = nullptr; +jclass JavaLibrary::ms_clsThrowable = nullptr; +jclass JavaLibrary::ms_clsError = nullptr; +jclass JavaLibrary::ms_clsStackOverflowError = nullptr; +jmethodID JavaLibrary::ms_midThrowableGetMessage = nullptr; +jclass JavaLibrary::ms_clsThread = nullptr; +jmethodID JavaLibrary::ms_midThreadDumpStack = nullptr; +jclass JavaLibrary::ms_clsInternalScriptError = nullptr; +jclass JavaLibrary::ms_clsInternalScriptSeriousError = nullptr; +jfieldID JavaLibrary::ms_fidInternalScriptSeriousErrorError = nullptr; +jclass JavaLibrary::ms_clsDictionary = nullptr; +jmethodID JavaLibrary::ms_midDictionary = nullptr; +jmethodID JavaLibrary::ms_midDictionaryPack = nullptr; +jmethodID JavaLibrary::ms_midDictionaryUnpack = nullptr; +jmethodID JavaLibrary::ms_midDictionaryKeys = nullptr; +jmethodID JavaLibrary::ms_midDictionaryValues = nullptr; +jmethodID JavaLibrary::ms_midDictionaryPut = nullptr; +jmethodID JavaLibrary::ms_midDictionaryPutInt = nullptr; +jmethodID JavaLibrary::ms_midDictionaryPutFloat = nullptr; +jmethodID JavaLibrary::ms_midDictionaryPutBool = nullptr; +jmethodID JavaLibrary::ms_midDictionaryGet = nullptr; +jclass JavaLibrary::ms_clsCollection = nullptr; +jmethodID JavaLibrary::ms_midCollectionToArray = nullptr; +jclass JavaLibrary::ms_clsEnumeration = nullptr; +jmethodID JavaLibrary::ms_midEnumerationHasMoreElements = nullptr; +jmethodID JavaLibrary::ms_midEnumerationNextElement = nullptr; +jclass JavaLibrary::ms_clsBaseClassRangeInfo = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassRangeInfoMinRange = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassRangeInfoMaxRange = nullptr; +jclass JavaLibrary::ms_clsBaseClassAttackerResults = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsId = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsWeapon = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsPosture = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsTrailBits = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsClientEffectId = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsActionName = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsUseLocation = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsTargetLocation = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsTargetCell = nullptr; +jclass JavaLibrary::ms_clsBaseClassDefenderResults = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassDefenderResultsId = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassDefenderResultsPosture = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassDefenderResultsResult = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassDefenderResultsClientEffectId = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassDefenderResultsHitLocation = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassDefenderDamageAmount = nullptr; +jclass JavaLibrary::ms_clsDynamicVariable = nullptr; +jfieldID JavaLibrary::ms_fidDynamicVariableName = nullptr; +jfieldID JavaLibrary::ms_fidDynamicVariableData = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableInt = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableIntArray = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableFloat = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableFloatArray = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableString = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableStringArray = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableObjId = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableObjIdArray = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableLocation = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableLocationArray = nullptr; +jclass JavaLibrary::ms_clsDynamicVariableList = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableList = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSet = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSetInt = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSetIntArray = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSetFloat = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSetFloatArray = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSetString = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSetStringArray = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSetObjId = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSetObjIdArray = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSetLocation = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSetLocationArray = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSetStringId = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSetStringIdArray = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSetTransform = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSetTransformArray = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSetVector = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSetVectorArray = nullptr; +jclass JavaLibrary::ms_clsObjId = nullptr; +jclass JavaLibrary::ms_clsObjIdArray = nullptr; +jmethodID JavaLibrary::ms_midObjIdGetValue = nullptr; +jmethodID JavaLibrary::ms_midObjIdGetObjId = nullptr; +jmethodID JavaLibrary::ms_midObjIdClearObjId = nullptr; +jmethodID JavaLibrary::ms_midObjIdFlagDestroyed = nullptr; +jmethodID JavaLibrary::ms_midObjIdSetAuthoritative = nullptr; +jmethodID JavaLibrary::ms_midObjIdSetLoaded = nullptr; +jmethodID JavaLibrary::ms_midObjIdSetInitialized = nullptr; +jmethodID JavaLibrary::ms_midObjIdSetLoggedIn = nullptr; +jmethodID JavaLibrary::ms_midObjIdPackAllDeltaScriptVars = nullptr; +jmethodID JavaLibrary::ms_midObjIdSetScriptVarInt = nullptr; +jmethodID JavaLibrary::ms_midObjIdSetScriptVarFloat = nullptr; +jmethodID JavaLibrary::ms_midObjIdSetScriptVarString = nullptr; +jmethodID JavaLibrary::ms_midObjIdClearScriptVars = nullptr; +jmethodID JavaLibrary::ms_midObjIdPackScriptVars = nullptr; +jmethodID JavaLibrary::ms_midObjIdUnpackDeltaScriptVars = nullptr; +jmethodID JavaLibrary::ms_midObjIdUnpackScriptVars = nullptr; +jmethodID JavaLibrary::ms_midObjIdAttachScript = nullptr; +jmethodID JavaLibrary::ms_midObjIdAttachScripts = nullptr; +jmethodID JavaLibrary::ms_midObjIdDetachScript = nullptr; +jmethodID JavaLibrary::ms_midObjIdDetachAllScripts = nullptr; +jclass JavaLibrary::ms_clsStringId = nullptr; +jmethodID JavaLibrary::ms_midStringId = nullptr; +jclass JavaLibrary::ms_clsStringIdArray = nullptr; +jfieldID JavaLibrary::ms_fidStringIdTable = nullptr; +jfieldID JavaLibrary::ms_fidStringIdAsciiId = nullptr; +jfieldID JavaLibrary::ms_fidStringIdIndexId = nullptr; +jclass JavaLibrary::ms_clsModifiableStringId = nullptr; +jclass JavaLibrary::ms_clsAttribute = nullptr; +jmethodID JavaLibrary::ms_midAttribute = nullptr; +jfieldID JavaLibrary::ms_fidAttributeType = nullptr; +jfieldID JavaLibrary::ms_fidAttributeValue = nullptr; +jclass JavaLibrary::ms_clsAttribMod = nullptr; +jmethodID JavaLibrary::ms_midAttribMod = nullptr; +jfieldID JavaLibrary::ms_fidAttribModName = nullptr; +jfieldID JavaLibrary::ms_fidAttribModSkill = nullptr; +jfieldID JavaLibrary::ms_fidAttribModType = nullptr; +jfieldID JavaLibrary::ms_fidAttribModValue = nullptr; +jfieldID JavaLibrary::ms_fidAttribModTime = nullptr; +jfieldID JavaLibrary::ms_fidAttribModAttack = nullptr; +jfieldID JavaLibrary::ms_fidAttribModDecay = nullptr; +jfieldID JavaLibrary::ms_fidAttribModFlags = nullptr; +jclass JavaLibrary::ms_clsMentalState = nullptr; +jmethodID JavaLibrary::ms_midMentalState = nullptr; +jfieldID JavaLibrary::ms_fidMentalStateType = nullptr; +jfieldID JavaLibrary::ms_fidMentalStateValue = nullptr; +jclass JavaLibrary::ms_clsMentalStateMod = nullptr; +jmethodID JavaLibrary::ms_midMentalStateMod = nullptr; +jfieldID JavaLibrary::ms_fidMentalStateModType = nullptr; +jfieldID JavaLibrary::ms_fidMentalStateModValue = nullptr; +jfieldID JavaLibrary::ms_fidMentalStateModTime = nullptr; +jfieldID JavaLibrary::ms_fidMentalStateModAttack = nullptr; +jfieldID JavaLibrary::ms_fidMentalStateModDecay = nullptr; +jclass JavaLibrary::ms_clsLocation = nullptr; +jclass JavaLibrary::ms_clsLocationArray = nullptr; +jfieldID JavaLibrary::ms_fidLocationX = nullptr; +jfieldID JavaLibrary::ms_fidLocationY = nullptr; +jfieldID JavaLibrary::ms_fidLocationZ = nullptr; +jfieldID JavaLibrary::ms_fidLocationArea = nullptr; +jfieldID JavaLibrary::ms_fidLocationCell = nullptr; +jmethodID JavaLibrary::ms_midRunOne = nullptr; +jmethodID JavaLibrary::ms_midRunAll = nullptr; +jmethodID JavaLibrary::ms_midCallMessages = nullptr; +jmethodID JavaLibrary::ms_midRunConsoleHandler = nullptr; +jmethodID JavaLibrary::ms_midUnload = nullptr; +jmethodID JavaLibrary::ms_midGetClass = nullptr; +jmethodID JavaLibrary::ms_midGetScriptFunctions = nullptr; +jclass JavaLibrary::ms_clsMenuInfo = nullptr; +jmethodID JavaLibrary::ms_midMenuInfo = nullptr; +jmethodID JavaLibrary::ms_midMenuInfoSetMenuItemsInternal = nullptr; +jmethodID JavaLibrary::ms_midMenuInfoGetMenuItemsInternal = nullptr; +jclass JavaLibrary::ms_clsMenuInfoData = nullptr; +jmethodID JavaLibrary::ms_midMenuInfoData = nullptr; jfieldID JavaLibrary::ms_fidMenuInfoDataId; jfieldID JavaLibrary::ms_fidMenuInfoDataParent; jfieldID JavaLibrary::ms_fidMenuInfoDataType; @@ -588,82 +588,82 @@ jclass JavaLibrary::ms_clsPalcolorCustomVar; jmethodID JavaLibrary::ms_midPalcolorCustomVar; jclass JavaLibrary::ms_clsColor; jmethodID JavaLibrary::ms_midColor; -jclass JavaLibrary::ms_clsDraftSchematic = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicCategory = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicComplexity = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicSlots = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicAttribs = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicExperimentalAttribs = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicCustomizations = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicAttribMap = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicObjectTemplateCreated = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicScripts = NULL; -jclass JavaLibrary::ms_clsDraftSchematicSlot = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicSlotName = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicSlotOption = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicSlotIngredientType = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicSlotIngredientName = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicSlotIngredients = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicSlotComplexity = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicSlotAmountRequired = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicSlotAppearance = NULL; -jclass JavaLibrary::ms_clsDraftSchematicAttrib = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicAttribName = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicAttribMinValue = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicAttribMaxValue = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicAttribResourceMaxValue = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicAttribCurrentValue = NULL; -jclass JavaLibrary::ms_clsDraftSchematicSimpleIngredient = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicSimpleIngredientIngredient = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicSimpleIngredientCount = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicSimpleIngredientSource = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicSimpleIngredientXpType = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicSimpleIngredientXpAmount = NULL; -jclass JavaLibrary::ms_clsDraftSchematicCustom = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicCustomName = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicCustomValue = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicCustomMinValue = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicCustomMaxValue = NULL; -//jfieldID JavaLibrary::ms_fidDraftSchematicCustomLocked = NULL; -jclass JavaLibrary::ms_clsMapLocation = NULL; -jmethodID JavaLibrary::ms_midMapLocation = NULL; -jclass JavaLibrary::ms_clsRegion = NULL; -jmethodID JavaLibrary::ms_midRegion = NULL; -jfieldID JavaLibrary::ms_fidRegionName = NULL; -jfieldID JavaLibrary::ms_fidRegionPlanet = NULL; -jclass JavaLibrary::ms_clsCombatEngine = NULL; -jclass JavaLibrary::ms_clsCombatEngineCombatantData = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataPos = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataWorldPos = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataRadius = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataIsCreature = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataPosture = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataLocomotion = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataScriptMod = NULL; -jclass JavaLibrary::ms_clsCombatEngineAttackerData = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineAttackerDataWeaponSkill = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineAttackerDataAims = NULL; -jclass JavaLibrary::ms_clsCombatEngineDefenderData = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineDefenderDataCombatSkeleton = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineDefenderDataCover = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineDefenderDataHitLocationChances = NULL; -jclass JavaLibrary::ms_clsCombatEngineWeaponData = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataId = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataMinDamage = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataMaxDamage = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataWeaponType = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataAttackType = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataDamageType = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataElementalType = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataElementalValue = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataAttackSpeed = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataWoundChance = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataAccuracy = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataMinRange = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataMaxRange = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataDamageRadius = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataAttackCost = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataIsDisabled = NULL; +jclass JavaLibrary::ms_clsDraftSchematic = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicCategory = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicComplexity = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicSlots = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicAttribs = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicExperimentalAttribs = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicCustomizations = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicAttribMap = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicObjectTemplateCreated = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicScripts = nullptr; +jclass JavaLibrary::ms_clsDraftSchematicSlot = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicSlotName = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicSlotOption = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicSlotIngredientType = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicSlotIngredientName = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicSlotIngredients = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicSlotComplexity = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicSlotAmountRequired = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicSlotAppearance = nullptr; +jclass JavaLibrary::ms_clsDraftSchematicAttrib = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicAttribName = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicAttribMinValue = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicAttribMaxValue = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicAttribResourceMaxValue = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicAttribCurrentValue = nullptr; +jclass JavaLibrary::ms_clsDraftSchematicSimpleIngredient = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicSimpleIngredientIngredient = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicSimpleIngredientCount = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicSimpleIngredientSource = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicSimpleIngredientXpType = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicSimpleIngredientXpAmount = nullptr; +jclass JavaLibrary::ms_clsDraftSchematicCustom = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicCustomName = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicCustomValue = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicCustomMinValue = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicCustomMaxValue = nullptr; +//jfieldID JavaLibrary::ms_fidDraftSchematicCustomLocked = nullptr; +jclass JavaLibrary::ms_clsMapLocation = nullptr; +jmethodID JavaLibrary::ms_midMapLocation = nullptr; +jclass JavaLibrary::ms_clsRegion = nullptr; +jmethodID JavaLibrary::ms_midRegion = nullptr; +jfieldID JavaLibrary::ms_fidRegionName = nullptr; +jfieldID JavaLibrary::ms_fidRegionPlanet = nullptr; +jclass JavaLibrary::ms_clsCombatEngine = nullptr; +jclass JavaLibrary::ms_clsCombatEngineCombatantData = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataPos = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataWorldPos = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataRadius = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataIsCreature = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataPosture = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataLocomotion = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataScriptMod = nullptr; +jclass JavaLibrary::ms_clsCombatEngineAttackerData = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineAttackerDataWeaponSkill = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineAttackerDataAims = nullptr; +jclass JavaLibrary::ms_clsCombatEngineDefenderData = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineDefenderDataCombatSkeleton = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineDefenderDataCover = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineDefenderDataHitLocationChances = nullptr; +jclass JavaLibrary::ms_clsCombatEngineWeaponData = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataId = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataMinDamage = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataMaxDamage = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataWeaponType = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataAttackType = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataDamageType = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataElementalType = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataElementalValue = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataAttackSpeed = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataWoundChance = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataAccuracy = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataMinRange = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataMaxRange = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataDamageRadius = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataAttackCost = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataIsDisabled = nullptr; jclass JavaLibrary::ms_clsCombatEngineHitResult; jfieldID JavaLibrary::ms_fidCombatEngineHitResultSuccess; jfieldID JavaLibrary::ms_fidCombatEngineHitResultCritical; @@ -693,40 +693,40 @@ jfieldID JavaLibrary::ms_fidCombatEngineHitResultCritDamage; jfieldID JavaLibrary::ms_fidCombatEngineHitResultBlockedDamage; jfieldID JavaLibrary::ms_fidCombatEngineHitResultBlockingArmor; jfieldID JavaLibrary::ms_fidCombatEngineHitResultBleedingChance; -jclass JavaLibrary::ms_clsTransform = NULL; -jclass JavaLibrary::ms_clsTransformArray = NULL; -jmethodID JavaLibrary::ms_midTransform = NULL; -jfieldID JavaLibrary::ms_fidTransformMatrix = NULL; -jclass JavaLibrary::ms_clsVector = NULL; -jclass JavaLibrary::ms_clsVectorArray = NULL; -jfieldID JavaLibrary::ms_fidVectorX = NULL; -jfieldID JavaLibrary::ms_fidVectorY = NULL; -jfieldID JavaLibrary::ms_fidVectorZ = NULL; -jclass JavaLibrary::ms_clsResourceDensity = NULL; -jfieldID JavaLibrary::ms_fidResourceDensityResourceType = NULL; -jfieldID JavaLibrary::ms_fidResourceDensityDensity = NULL; -jclass JavaLibrary::ms_clsResourceAttribute = NULL; -jfieldID JavaLibrary::ms_fidResourceAttributeName = NULL; -jfieldID JavaLibrary::ms_fidResourceAttributeValue = NULL; -jclass JavaLibrary::ms_clsLibrarySpaceTransition = NULL; -jmethodID JavaLibrary::ms_midLibrarySpaceTransitionSetPlayerOvert = NULL; -jmethodID JavaLibrary::ms_midLibrarySpaceTransitionClearOvertStatus = NULL; +jclass JavaLibrary::ms_clsTransform = nullptr; +jclass JavaLibrary::ms_clsTransformArray = nullptr; +jmethodID JavaLibrary::ms_midTransform = nullptr; +jfieldID JavaLibrary::ms_fidTransformMatrix = nullptr; +jclass JavaLibrary::ms_clsVector = nullptr; +jclass JavaLibrary::ms_clsVectorArray = nullptr; +jfieldID JavaLibrary::ms_fidVectorX = nullptr; +jfieldID JavaLibrary::ms_fidVectorY = nullptr; +jfieldID JavaLibrary::ms_fidVectorZ = nullptr; +jclass JavaLibrary::ms_clsResourceDensity = nullptr; +jfieldID JavaLibrary::ms_fidResourceDensityResourceType = nullptr; +jfieldID JavaLibrary::ms_fidResourceDensityDensity = nullptr; +jclass JavaLibrary::ms_clsResourceAttribute = nullptr; +jfieldID JavaLibrary::ms_fidResourceAttributeName = nullptr; +jfieldID JavaLibrary::ms_fidResourceAttributeValue = nullptr; +jclass JavaLibrary::ms_clsLibrarySpaceTransition = nullptr; +jmethodID JavaLibrary::ms_midLibrarySpaceTransitionSetPlayerOvert = nullptr; +jmethodID JavaLibrary::ms_midLibrarySpaceTransitionClearOvertStatus = nullptr; ////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// // CS handlers -jclass JavaLibrary::ms_clsLibraryDump = NULL; -jmethodID JavaLibrary::ms_midLibraryDumpDumpTargetInfo = NULL; +jclass JavaLibrary::ms_clsLibraryDump = nullptr; +jmethodID JavaLibrary::ms_midLibraryDumpDumpTargetInfo = nullptr; -jclass JavaLibrary::ms_clsLibraryGMLib = NULL; -jmethodID JavaLibrary::ms_midLibraryGMLibFreeze = NULL; -jmethodID JavaLibrary::ms_midLibraryGMLibUnfreeze = NULL; +jclass JavaLibrary::ms_clsLibraryGMLib = nullptr; +jmethodID JavaLibrary::ms_midLibraryGMLibFreeze = nullptr; +jmethodID JavaLibrary::ms_midLibraryGMLibUnfreeze = nullptr; ////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// int JavaLibrary::ms_loaded = 0; -Semaphore * JavaLibrary::ms_shutdownJava = NULL; +Semaphore * JavaLibrary::ms_shutdownJava = nullptr; int JavaLibrary::GlobalInstances::ms_stringIdIndex = 0; int JavaLibrary::GlobalInstances::ms_attribModIndex = 0; @@ -765,7 +765,7 @@ void JavaLibrary::throwScriptException(char const * const format, ...) void JavaLibrary::throwScriptException(char const * const format, va_list va) { - DEBUG_FATAL(!ms_env, ("JavaLibrary::throwScriptException: ms_env is NULL")); + DEBUG_FATAL(!ms_env, ("JavaLibrary::throwScriptException: ms_env is nullptr")); if (ms_env) { char buffer[1024]; @@ -805,28 +805,28 @@ void JavaLibrary::fatalHandler(int signum) // it turns out that in some java crashes we don't even have 2 return // addresses, so check 0 and 1 just to make sure bool result2 = false; - void *crashAddress2a = NULL; - void *crashAddress2b = NULL; - void *crashAddress2c = NULL; - void *frameAddressA = NULL; - void *frameAddressB = NULL; + void *crashAddress2a = nullptr; + void *crashAddress2b = nullptr; + void *crashAddress2c = nullptr; + void *frameAddressA = nullptr; + void *frameAddressB = nullptr; uint32 frameAddressHigh = (reinterpret_cast(frameAddress) >> 16); crashAddress2a = __builtin_return_address(0); - if (crashAddress2a != NULL) + if (crashAddress2a != nullptr) { frameAddressA = __builtin_frame_address(1); - if (frameAddressA != NULL && + if (frameAddressA != nullptr && (reinterpret_cast(frameAddressA) >> 16 == frameAddressHigh)) { crashAddress2b = __builtin_return_address(1); - if (crashAddress2b != NULL) + if (crashAddress2b != nullptr) { frameAddressB = __builtin_frame_address(2); - if (frameAddressB != NULL && + if (frameAddressB != nullptr && (reinterpret_cast(frameAddressB) >> 16 == frameAddressHigh)) { crashAddress2c = __builtin_return_address(2); - if (crashAddress2c != NULL) + if (crashAddress2c != nullptr) { result2 = DebugHelp::lookupAddress(reinterpret_cast( crashAddress2c), lib2, file2, BUFLEN, line2); @@ -837,7 +837,7 @@ void JavaLibrary::fatalHandler(int signum) } bool javaCrash = true; - if ((result1 || result2) && strstr(lib1, "libjvm.so") == NULL && strstr(lib2, "libjvm.so") == NULL) + if ((result1 || result2) && strstr(lib1, "libjvm.so") == nullptr && strstr(lib2, "libjvm.so") == nullptr) { if (result1 && result2) { @@ -860,7 +860,7 @@ void JavaLibrary::fatalHandler(int signum) if (javaCrash) { fprintf(stderr, "I think I crashed in Java, calling the Java segfault hanlder.\n"); - IGNORE_RETURN(sigaction(SIGSEGV, &JavaSa, NULL)); + IGNORE_RETURN(sigaction(SIGSEGV, &JavaSa, nullptr)); IGNORE_RETURN(pthread_kill(pthread_self(), SIGSEGV)); } else @@ -868,11 +868,11 @@ void JavaLibrary::fatalHandler(int signum) // destroy Java threads // this pthread method is not in later versions of glibc as the kernel should handle the kill //pthread_kill_other_threads_np(); - ms_instance = NULL; - ms_env = NULL; - ms_jvm = NULL; + ms_instance = nullptr; + ms_env = nullptr; + ms_jvm = nullptr; // restore original signal handler and rethrow signal - IGNORE_RETURN(sigaction(SIGSEGV, &OrgSa, NULL)); + IGNORE_RETURN(sigaction(SIGSEGV, &OrgSa, nullptr)); IGNORE_RETURN(pthread_kill(pthread_self(), SIGSEGV)); } } @@ -888,7 +888,7 @@ JavaLibrary::JavaLibrary(void) { int i; - if (ms_instance != NULL || ms_loaded != 0) + if (ms_instance != nullptr || ms_loaded != 0) return; ms_shutdownJava = new Semaphore(); @@ -938,7 +938,7 @@ JavaLibrary::~JavaLibrary() { disconnectFromJava(); - if (ms_shutdownJava != NULL) + if (ms_shutdownJava != nullptr) { // tell the initialize thread to shut down if (ms_loaded > 0) @@ -948,10 +948,10 @@ JavaLibrary::~JavaLibrary() Os::sleep(100); } delete ms_shutdownJava; - ms_shutdownJava = NULL; + ms_shutdownJava = nullptr; } - ms_instance = NULL; + ms_instance = nullptr; } // JavaLibrary::~JavaLibrary //---------------------------------------------------------------------- @@ -961,12 +961,12 @@ JavaLibrary::~JavaLibrary() */ void JavaLibrary::install(void) { - if (ms_instance == NULL) + if (ms_instance == nullptr) { JavaLibrary *lib = new JavaLibrary; if (lib != ms_instance) { - if (ms_instance == NULL) + if (ms_instance == nullptr) { delete lib; if (ms_javaVmType != JV_none) @@ -985,10 +985,10 @@ void JavaLibrary::install(void) */ void JavaLibrary::remove(void) { - if (ms_instance != NULL) + if (ms_instance != nullptr) { JavaLibrary * temp = ms_instance; - ms_instance = NULL; + ms_instance = nullptr; delete temp; s_profileSections.clear(); } @@ -1010,7 +1010,7 @@ void JavaLibrary::initializeJavaThread() } const char *javaVMName = ConfigServerGame::getJavaVMName(); - if (javaVMName == NULL || ( + if (javaVMName == nullptr || ( strcmp(javaVMName, "none") != 0 && strcmp(javaVMName, "ibm") != 0 && strcmp(javaVMName, "sun") != 0 && @@ -1038,21 +1038,21 @@ void JavaLibrary::initializeJavaThread() #ifdef linux // get the default signal handler - IGNORE_RETURN(sigaction(SIGSEGV, NULL, &OrgSa)); + IGNORE_RETURN(sigaction(SIGSEGV, nullptr, &OrgSa)); if (ms_javaVmType == JV_ibm) { // check PATH to make sure that it has /usr/bin/java const char * env = getenv("PATH"); - const char * bin = NULL; + const char * bin = nullptr; int envlen = 0; - if (env != NULL) + if (env != nullptr) { bin = strstr(env, "/usr/java/bin"); envlen = strlen(env); } - if (bin == NULL) + if (bin == nullptr) { WARNING(true, ("/usr/java/bin not found in PATH which is needed for IBM Java VM. Adding it now")); char * tmpbuffer = new char[envlen + 128]; @@ -1065,18 +1065,18 @@ void JavaLibrary::initializeJavaThread() // check LD_LIBRARY_PATH for /usr/java/jre/bin and /usr/java/jre/bin/classic env = getenv("LD_LIBRARY_PATH"); - bin = NULL; + bin = nullptr; envlen = 0; - const char * classic = NULL; - if (env != NULL) + const char * classic = nullptr; + if (env != nullptr) { bin = strstr(env, "/usr/java/jre/bin"); classic = strstr(env, "/usr/java/jre/bin/classic"); - if (bin == classic && bin != NULL) + if (bin == classic && bin != nullptr) bin = strstr(classic + 1, "/usr/java/jre/bin"); envlen = strlen(env); } - if (bin == NULL || classic == NULL) + if (bin == nullptr || classic == nullptr) { WARNING(true, ("/usr/java/jre/bin or /usr/java/jre/bin/classic not found " "in LD_LIBRARY_PATH, needed for IBM Java VM. Adding them both now.")); @@ -1093,12 +1093,12 @@ void JavaLibrary::initializeJavaThread() #endif // linux // dynamically load the jni dll and JNI_CreateJavaVM - void * libHandle = NULL; + void * libHandle = nullptr; JNI_CREATEJAVAVMPROC JNI_CreateJavaVMProc; #if defined(WIN32) std::string dllPath = ConfigServerGame::getJavaLibPath(); HINSTANCE hVm = LoadLibrary(dllPath.c_str()); - if (hVm == NULL) + if (hVm == nullptr) { FATAL(true, ("jvm open fail error: could not open %s", dllPath.c_str())); ms_loaded = -1; @@ -1108,10 +1108,10 @@ void JavaLibrary::initializeJavaThread() JNI_CreateJavaVMProc = (JNI_CREATEJAVAVMPROC)GetProcAddress(hVm, "JNI_CreateJavaVM"); //lint !e1924 C-style cast #else - void *libVM = NULL; + void *libVM = nullptr; std::string dllPath = ConfigServerGame::getJavaLibPath(); libVM = dlopen(dllPath.c_str(), RTLD_LAZY); - if (libVM == NULL) + if (libVM == nullptr) { FATAL(true, ("jvm open fail! error: %s", dlerror())); ms_loaded = -1; @@ -1121,7 +1121,7 @@ void JavaLibrary::initializeJavaThread() JNI_CreateJavaVMProc = (JNI_CREATEJAVAVMPROC)dlsym(libVM, "JNI_CreateJavaVM"); #endif - if (JNI_CreateJavaVMProc == NULL) + if (JNI_CreateJavaVMProc == nullptr) { FATAL(true, ("Error getting JNI_CreateJavaVM from jvm shared library")); ms_loaded = -1; @@ -1137,9 +1137,9 @@ void JavaLibrary::initializeJavaThread() classPath += ConfigServerGame::getScriptPath(); JavaVMInitArgs vm_args; - JavaVMOption tempOption = {NULL, NULL}; + JavaVMOption tempOption = {nullptr, nullptr}; std::vector options; - char *jdwpBuffer = NULL; + char *jdwpBuffer = nullptr; UNREF(jdwpBuffer); @@ -1206,7 +1206,7 @@ void JavaLibrary::initializeJavaThread() } #ifdef REMOTE_DEBUG_ON - char *jdwpBuffer = NULL; + char *jdwpBuffer = nullptr; if (ConfigServerGame::getUseRemoteDebugJava()) { if (ms_javaVmType == JV_ibm) @@ -1305,14 +1305,14 @@ void JavaLibrary::initializeJavaThread() vm_args.ignoreUnrecognized = JNI_TRUE; // create the JVM - JNIEnv * env = NULL; + JNIEnv * env = nullptr; jint result = (*JNI_CreateJavaVMProc)(&ms_jvm, reinterpret_cast(&env), &vm_args); #ifdef REMOTE_DEBUG_ON - if (jdwpBuffer != NULL) + if (jdwpBuffer != nullptr) { delete[] jdwpBuffer; - jdwpBuffer = NULL; + jdwpBuffer = nullptr; } #endif @@ -1329,7 +1329,7 @@ void JavaLibrary::initializeJavaThread() // clean up IGNORE_RETURN(ms_jvm->DestroyJavaVM()); - ms_jvm = NULL; + ms_jvm = nullptr; #if defined(_WIN32) @@ -1356,7 +1356,7 @@ bool JavaLibrary::connectToJava() return false; // attach our thread to the VM - jint result = ms_jvm->AttachCurrentThread(reinterpret_cast(&ms_env), NULL); + jint result = ms_jvm->AttachCurrentThread(reinterpret_cast(&ms_env), nullptr); if (result != 0) { FATAL(true, ("Failed to attach to the Java VM! Error code returned = %d", result)); @@ -1927,7 +1927,7 @@ bool JavaLibrary::connectToJava() for (i = 0; i < MAX_STRING_ID_PARAMS; ++i) { - localInstance = createNewObject(ms_clsStringId, ms_midStringId, NULL, -1); + localInstance = createNewObject(ms_clsStringId, ms_midStringId, nullptr, -1); if (ms_env->ExceptionCheck()) { ms_env->ExceptionDescribe(); @@ -1945,7 +1945,7 @@ bool JavaLibrary::connectToJava() for (i = 0; i < MAX_MODIFIABLE_STRING_ID_PARAMS; ++i) { localInstance = createNewObject(ms_clsModifiableStringId, constructor, - NULL, -1); + nullptr, -1); if (ms_env->ExceptionCheck()) { ms_env->ExceptionDescribe(); @@ -2100,7 +2100,7 @@ bool JavaLibrary::registerNatives(const JNINativeMethod natives[], int count) { if (!natives[i].signature) { - DEBUG_REPORT_LOG(true, ("RegisterNatives failed: %s - NULL signature\n", natives[i].name)); + DEBUG_REPORT_LOG(true, ("RegisterNatives failed: %s - nullptr signature\n", natives[i].name)); result = 1; continue; } @@ -2208,11 +2208,11 @@ int i; FREE_CLASS(ms_clsLibraryDump); FREE_CLASS(ms_clsLibraryGMLib); - if (ms_scriptEntry != NULL) + if (ms_scriptEntry != nullptr) { if (ms_env) ms_env->DeleteGlobalRef(ms_scriptEntry); - ms_scriptEntry = NULL; + ms_scriptEntry = nullptr; } for (i = 0; i < MAX_RECURSION_COUNT; ++i) @@ -2235,7 +2235,7 @@ int i; GlobalInstances::ms_menuInfo = GlobalRef::cms_nullPtr; IGNORE_RETURN(ms_jvm->DetachCurrentThread()); - ms_env = NULL; + ms_env = nullptr; } // JavaLibrary::disconnectFromJava //---------------------------------------------------------------------- @@ -2272,7 +2272,7 @@ void JavaLibrary::resetJavaConnection() */ bool JavaLibrary::queryScriptFunctions(const std::string & scriptName) { - if (ms_instance == NULL) + if (ms_instance == nullptr) return false; JavaString scriptClassName(("script." + scriptName).c_str()); @@ -2326,7 +2326,7 @@ bool JavaLibrary::queryScriptFunctions(const std::string & scriptName) */ jlong JavaLibrary::getFreeJavaMemory() { - if (ms_instance == NULL || ms_env == NULL) + if (ms_instance == nullptr || ms_env == nullptr) return 0; return ms_env->CallStaticLongMethod(ms_clsScriptEntry, ms_midScriptEntryGetFreeMem); @@ -2347,7 +2347,7 @@ void JavaLibrary::printJavaStack() */ void JavaLibrary::enableLogging(bool enable) const { - if (ms_instance == NULL || ms_env == NULL) + if (ms_instance == nullptr || ms_env == nullptr) return; ms_env->CallStaticVoidMethod(ms_clsScriptEntry, @@ -2361,7 +2361,7 @@ void JavaLibrary::enableLogging(bool enable) const */ void JavaLibrary::enableNewJediTracking(bool enableTracking) { - if (ms_instance == NULL || ms_env == NULL) + if (ms_instance == nullptr || ms_env == nullptr) return; ms_env->CallStaticVoidMethod(ms_clsScriptEntry, @@ -2401,7 +2401,7 @@ LocalRefPtr JavaLibrary::getObjId(const NetworkId::NetworkIdType & id) */ LocalRefPtr JavaLibrary::getObjId(const NetworkId & id) { - if (ms_env != NULL && ms_instance != NULL) + if (ms_env != nullptr && ms_instance != nullptr) return callStaticObjectMethod(ms_clsObjId, ms_midObjIdGetObjId, id.getValue()); return LocalRef::cms_nullPtr; } // JavaLibrary::getObjId(const CachedNetworkId &) @@ -2490,7 +2490,7 @@ LocalRefPtr JavaLibrary::getVector(Vector const & vector) */ void JavaLibrary::removeJavaId(const NetworkId & id) { - if (ms_env == NULL || ms_clsObjId == NULL || ms_midObjIdClearObjId == NULL) + if (ms_env == nullptr || ms_clsObjId == nullptr || ms_midObjIdClearObjId == nullptr) { return; } @@ -2508,7 +2508,7 @@ void JavaLibrary::removeJavaId(const NetworkId & id) */ void JavaLibrary::flagDestroyed(const NetworkId & id) { - if (ms_env == NULL || ms_clsObjId == NULL || ms_midObjIdFlagDestroyed == NULL) + if (ms_env == nullptr || ms_clsObjId == nullptr || ms_midObjIdFlagDestroyed == nullptr) { return; } @@ -2527,7 +2527,7 @@ void JavaLibrary::flagDestroyed(const NetworkId & id) */ void JavaLibrary::setObjIdAuthoritative(const NetworkId & object, bool authoritative, uint32 pid) { - if (ms_env == NULL || ms_midObjIdSetAuthoritative == NULL) + if (ms_env == nullptr || ms_midObjIdSetAuthoritative == nullptr) { return; } @@ -2550,7 +2550,7 @@ void JavaLibrary::setObjIdAuthoritative(const NetworkId & object, bool authorita */ void JavaLibrary::setObjIdLoaded(const NetworkId &object) { - if (ms_env == NULL || ms_midObjIdSetLoaded == NULL) + if (ms_env == nullptr || ms_midObjIdSetLoaded == nullptr) { return; } @@ -2572,7 +2572,7 @@ void JavaLibrary::setObjIdLoaded(const NetworkId &object) */ void JavaLibrary::setObjIdInitialized(const NetworkId &object) { - if (ms_env == NULL || ms_midObjIdSetInitialized == NULL) + if (ms_env == nullptr || ms_midObjIdSetInitialized == nullptr) { return; } @@ -2594,7 +2594,7 @@ void JavaLibrary::setObjIdInitialized(const NetworkId &object) */ void JavaLibrary::setObjIdLoggedIn(const NetworkId & object, bool loggedIn) { - if (ms_env == NULL || ms_midObjIdSetLoggedIn == NULL) + if (ms_env == nullptr || ms_midObjIdSetLoggedIn == nullptr) { return; } @@ -2617,7 +2617,7 @@ void JavaLibrary::setObjIdLoggedIn(const NetworkId & object, bool loggedIn) void JavaLibrary::attachScriptToObjId(const NetworkId &object, const std::string & script) { - if (ms_env != NULL) + if (ms_env != nullptr) { LocalRefPtr obj_id = getObjId(object); if (obj_id == LocalRef::cms_nullPtr) @@ -2638,7 +2638,7 @@ void JavaLibrary::attachScriptToObjId(const NetworkId &object, void JavaLibrary::attachScriptsToObjId(const NetworkId &object, const ScriptList & scripts) { - if (scripts.size() == 0 || ms_env == NULL) + if (scripts.size() == 0 || ms_env == nullptr) return; LocalRefPtr obj_id = getObjId(object); @@ -2684,7 +2684,7 @@ void JavaLibrary::attachScriptsToObjId(const NetworkId &object, void JavaLibrary::detachScriptFromObjId(const NetworkId &object, const std::string & script) { - if (ms_env != NULL) + if (ms_env != nullptr) { LocalRefPtr obj_id = getObjId(object); if (obj_id == LocalRef::cms_nullPtr) @@ -2703,7 +2703,7 @@ void JavaLibrary::detachScriptFromObjId(const NetworkId &object, */ void JavaLibrary::detachAllScriptsFromObjId(const NetworkId &object) { - if (ms_env != NULL) + if (ms_env != nullptr) { LocalRefPtr obj_id = getObjId(object); if (obj_id == LocalRef::cms_nullPtr) @@ -2766,7 +2766,7 @@ jint JavaLibrary::handleScriptEntryCleanup(jint result) if (ConfigServerGame::getTrapScriptCrashes()) { // the script threw an error or exception, restore our segfault handler - IGNORE_RETURN(sigaction(SIGSEGV, &OurSa, NULL)); + IGNORE_RETURN(sigaction(SIGSEGV, &OurSa, nullptr)); } #endif } @@ -2786,20 +2786,20 @@ jint JavaLibrary::handleScriptEntryCleanup(jint result) jint JavaLibrary::callScriptEntry(const JavaStringParam & script, const JavaStringParam & method, jobjectArray params) { - if (ms_env == NULL || ms_clsScriptEntry == NULL || ms_midRunOne == NULL) + if (ms_env == nullptr || ms_clsScriptEntry == nullptr || ms_midRunOne == nullptr) { - LOG("ScriptInvestigation", ("callScriptEntry failed because something was null")); + LOG("ScriptInvestigation", ("callScriptEntry failed because something was nullptr")); if (!ms_env) { - LOG("ScriptInvestigation", ("callScriptEntry failed because ms_env was null")); + LOG("ScriptInvestigation", ("callScriptEntry failed because ms_env was nullptr")); } if (!ms_clsScriptEntry) { - LOG("ScriptInvestigation", ("callScriptEntry failed because scriptEntry was null")); + LOG("ScriptInvestigation", ("callScriptEntry failed because scriptEntry was nullptr")); } if (!ms_midRunOne) { - LOG("ScriptInvestigation", ("callScriptEntry failed because runOne was null")); + LOG("ScriptInvestigation", ("callScriptEntry failed because runOne was nullptr")); } return SCRIPT_OVERRIDE; @@ -2837,20 +2837,20 @@ jint JavaLibrary::callScriptEntry(const JavaStringParam & script, */ jint JavaLibrary::callScriptEntry(const JavaStringParam & method, jobjectArray params) { - if (ms_env == NULL || ms_clsScriptEntry == NULL || ms_midRunAll == NULL) + if (ms_env == nullptr || ms_clsScriptEntry == nullptr || ms_midRunAll == nullptr) { - LOG("ScriptInvestigation", ("callScriptEntry2 failed because something was null")); + LOG("ScriptInvestigation", ("callScriptEntry2 failed because something was nullptr")); if (!ms_env) { - LOG("ScriptInvestigation", ("callScriptEntry2 failed because ms_env was null")); + LOG("ScriptInvestigation", ("callScriptEntry2 failed because ms_env was nullptr")); } if (!ms_clsScriptEntry) { - LOG("ScriptInvestigation", ("callScriptEntry2 failed because scriptEntry was null")); + LOG("ScriptInvestigation", ("callScriptEntry2 failed because scriptEntry was nullptr")); } if (!ms_midRunOne) { - LOG("ScriptInvestigation", ("callScriptEntry2 failed because runOne was null")); + LOG("ScriptInvestigation", ("callScriptEntry2 failed because runOne was nullptr")); } return SCRIPT_OVERRIDE; } @@ -2886,20 +2886,20 @@ jint JavaLibrary::callScriptEntry(const JavaStringParam & method, jobjectArray p */ jstring JavaLibrary::callScriptConsoleHandlerEntry(const JavaStringParam & script, const JavaStringParam & method, jobjectArray params) { - if (ms_env == NULL || ms_clsScriptEntry == NULL || ms_midRunConsoleHandler == NULL) + if (ms_env == nullptr || ms_clsScriptEntry == nullptr || ms_midRunConsoleHandler == nullptr) { - LOG("ScriptInvestigation", ("callScriptConsoleHandlerEntry failed because something was null")); + LOG("ScriptInvestigation", ("callScriptConsoleHandlerEntry failed because something was nullptr")); if (!ms_env) { - LOG("ScriptInvestigation", ("callScriptConsoleHandlerEntry failed because ms_env was null")); + LOG("ScriptInvestigation", ("callScriptConsoleHandlerEntry failed because ms_env was nullptr")); } if (!ms_clsScriptEntry) { - LOG("ScriptInvestigation", ("callScriptConsoleHandlerEntry failed because scriptEntry was null")); + LOG("ScriptInvestigation", ("callScriptConsoleHandlerEntry failed because scriptEntry was nullptr")); } if (!ms_midRunConsoleHandler) { - LOG("ScriptInvestigation", ("callScriptConsoleHandlerEntry failed because runConsoleHandler was null")); + LOG("ScriptInvestigation", ("callScriptConsoleHandlerEntry failed because runConsoleHandler was nullptr")); } return 0; @@ -2938,7 +2938,7 @@ void JavaLibrary::convert(const ScriptParams & params, JavaDictionaryPtr & dicti { dictionary.reset(); - if (ms_env == NULL) + if (ms_env == nullptr) return; // create the dictionary @@ -3132,7 +3132,7 @@ void JavaLibrary::convert(const ScriptParams & params, JavaDictionaryPtr & dicti for (int j = 0; j < count; ++j) { const std::vector * inner = objIds[j]; - if (inner != NULL) + if (inner != nullptr) { LocalObjectArrayRefPtr innerArray = createNewObjectArray(inner->size(), ms_clsObjId); if (innerArray != LocalObjectArrayRef::cms_nullPtr) @@ -3235,7 +3235,7 @@ void JavaLibrary::convert(const ScriptParams & params, JavaDictionaryPtr & dicti */ LocalObjectArrayRefPtr JavaLibrary::convert(const NetworkId & self, const std::string& argList, const ScriptParams &args) { - if (ms_env == NULL) + if (ms_env == nullptr) return LocalObjectArrayRef::cms_nullPtr; // convert the params to jobjects @@ -3272,7 +3272,7 @@ LocalObjectArrayRefPtr JavaLibrary::convert(const NetworkId & self, const std::s */ LocalObjectArrayRefPtr JavaLibrary::convert(const std::string& argList, const ScriptParams &args) { - if (ms_env == NULL) + if (ms_env == nullptr) return LocalObjectArrayRef::cms_nullPtr; // convert the params to jobjects @@ -3301,7 +3301,7 @@ LocalObjectArrayRefPtr JavaLibrary::convert(const std::string& argList, const Sc */ bool JavaLibrary::convert(LocalObjectArrayRefPtr & javaParams, int startIndex, const std::string& argList, const ScriptParams &args) { - if (ms_env == NULL) + if (ms_env == nullptr) return 0; GlobalInstances globals; @@ -3536,7 +3536,7 @@ bool JavaLibrary::convert(LocalObjectArrayRefPtr & javaParams, int startIndex, c for (i = 0, iter = strings.begin(); iter != strings.end(); ++i, ++iter) { - if (*iter != NULL) + if (*iter != nullptr) { JavaString newString(**iter); setObjectArrayElement(*localInstance, i, newString); @@ -3767,7 +3767,7 @@ bool JavaLibrary::convert(LocalObjectArrayRefPtr & javaParams, int startIndex, c ++paramCount; } } - // fill in the rest of ms_attribModList with null + // fill in the rest of ms_attribModList with nullptr for (; paramCount < MAX_ATTRIB_MOD_PARAMS; ++paramCount) { setObjectArrayElement(*ms_attribModList[ms_currentRecursionCount], static_cast(paramCount), *LocalRefParam::cms_nullPtr); @@ -3846,7 +3846,7 @@ bool JavaLibrary::convert(LocalObjectArrayRefPtr & javaParams, int startIndex, c ++paramCount; } } - // fill in the rest of ms_mentalStateModList with null + // fill in the rest of ms_mentalStateModList with nullptr for (; paramCount < MAX_MENTAL_STATE_MOD_PARAMS; ++paramCount) { setObjectArrayElement( @@ -3932,7 +3932,7 @@ bool JavaLibrary::convert(LocalObjectArrayRefPtr & javaParams, int startIndex, c static_cast(argType))); //lint !e571 suspicious cast return 0; } - if (arg.get() == NULL || arg == LocalRef::cms_nullPtr) + if (arg.get() == nullptr || arg == LocalRef::cms_nullPtr) { DEBUG_REPORT_LOG(true, ("bad parameter, %c%s%d%s\n", argType, modifiable ? "*" : "", @@ -3967,7 +3967,7 @@ bool JavaLibrary::convert(LocalObjectArrayRefPtr & javaParams, int startIndex, c void JavaLibrary::alterScriptParams(jobjectArray jparams, const std::string& argList, ScriptParams &args) { - if (ms_env == NULL) + if (ms_env == nullptr) return; PROFILER_AUTO_BLOCK_CHECK_DEFINE("JavaLibrary::alterScriptParams"); @@ -4003,7 +4003,7 @@ void JavaLibrary::alterScriptParams(jobjectArray jparams, const std::string& arg { int count = getArrayLength(*arg); std::vector * values = new std::vector(count, 0); - jint * jvalues = static_cast(ms_env->GetPrimitiveArrayCritical(static_cast(arg->getValue()), NULL)); + jint * jvalues = static_cast(ms_env->GetPrimitiveArrayCritical(static_cast(arg->getValue()), nullptr)); for (int j = 0; j < count; ++j) { values->at(j) = static_cast(jvalues[j]); @@ -4035,7 +4035,7 @@ void JavaLibrary::alterScriptParams(jobjectArray jparams, const std::string& arg { int count = getArrayLength(*arg); std::vector * values = new std::vector(count, 0); - jbyte * jvalues = static_cast(ms_env->GetPrimitiveArrayCritical(static_cast(arg->getValue()), NULL)); + jbyte * jvalues = static_cast(ms_env->GetPrimitiveArrayCritical(static_cast(arg->getValue()), nullptr)); for (int j = 0; j < count; ++j) { values->at(j) = static_cast(jvalues[j]); @@ -4121,7 +4121,7 @@ void JavaLibrary::alterScriptParams(jobjectArray jparams, const std::string& arg std::string localString; convert(*table, localString); value->setTable(localString); - // get the string id text, if it is not NULL/empty, use it + // get the string id text, if it is not nullptr/empty, use it localString.clear(); JavaStringPtr text = getStringField(*arg, ms_fidStringIdAsciiId); if (text != JavaString::cms_nullPtr) @@ -4197,18 +4197,18 @@ int JavaLibrary::runScripts(const NetworkId & caller, "JavaLibrary::runScripts enter, self = %s, method = %s\n", caller.getValueString().c_str(), method.c_str())); - if (ms_env == NULL || ms_clsObject == NULL) + if (ms_env == nullptr || ms_clsObject == nullptr) { DEBUG_REPORT_LOG(ConfigServerGame::getJavaConsoleDebugMessages(), ( "JavaLibrary::runScripts exit, self = %s, method = %s\n", caller.getValueString().c_str(), method.c_str())); if (!ms_env) { - LOG("ScriptInvestigation", ("runSCripts failed because env was null")); + LOG("ScriptInvestigation", ("runSCripts failed because env was nullptr")); } else { - LOG("ScriptInvestigation", ("runSCripts failed because clsObject was null")); + LOG("ScriptInvestigation", ("runSCripts failed because clsObject was nullptr")); } return SCRIPT_OVERRIDE; } @@ -4335,19 +4335,19 @@ int JavaLibrary::runScript(const NetworkId & caller, const std::string& script, "JavaLibrary::runScript %s enter, self = %s, method = %s\n", script.c_str(), caller.getValueString().c_str(), method.c_str())); - if (ms_env == NULL || ms_midRunOne == NULL || ms_clsObject == NULL) + if (ms_env == nullptr || ms_midRunOne == nullptr || ms_clsObject == nullptr) { if (!ms_env) { - LOG("ScriptInvestigation", ("runSCripts2 failed because env was null")); + LOG("ScriptInvestigation", ("runSCripts2 failed because env was nullptr")); } else if (!ms_midRunOne) { - LOG("ScriptInvestigation", ("runSCripts2 failed because midRunOne was null")); + LOG("ScriptInvestigation", ("runSCripts2 failed because midRunOne was nullptr")); } else { - LOG("ScriptInvestigation", ("runSCripts2 failed because clsObject was null")); + LOG("ScriptInvestigation", ("runSCripts2 failed because clsObject was nullptr")); } return SCRIPT_OVERRIDE; @@ -4455,19 +4455,19 @@ int JavaLibrary::runScript(const NetworkId & caller, const std::string& script, DEBUG_REPORT_LOG(true, ("JavaLibrary::runScript %s enter, method = %s\n", script.c_str(), method.c_str())); - if (ms_env == NULL || ms_midRunOne == NULL || ms_clsObject == NULL) + if (ms_env == nullptr || ms_midRunOne == nullptr || ms_clsObject == nullptr) { if (!ms_env) { - LOG("ScriptInvestigation", ("runSCripts3 failed because env was null")); + LOG("ScriptInvestigation", ("runSCripts3 failed because env was nullptr")); } else if (!ms_midRunOne) { - LOG("ScriptInvestigation", ("runSCripts3 failed because midRunOne was null")); + LOG("ScriptInvestigation", ("runSCripts3 failed because midRunOne was nullptr")); } else { - LOG("ScriptInvestigation", ("runSCripts3 failed because clsObject was null")); + LOG("ScriptInvestigation", ("runSCripts3 failed because clsObject was nullptr")); } return SCRIPT_OVERRIDE; } @@ -4582,19 +4582,19 @@ int JavaLibrary::runScript(const NetworkId & caller, const std::string& script, DEBUG_REPORT_LOG(true, ("JavaLibrary::runScript %s enter, method = %s\n", script.c_str(), method.c_str())); - if (ms_env == NULL || ms_midRunOne == NULL || ms_clsObject == NULL) + if (ms_env == nullptr || ms_midRunOne == nullptr || ms_clsObject == nullptr) { if (!ms_env) { - LOG("ScriptInvestigation", ("runSCripts4 failed because env was null")); + LOG("ScriptInvestigation", ("runSCripts4 failed because env was nullptr")); } else if (!ms_midRunOne) { - LOG("ScriptInvestigation", ("runSCripts4 failed because midRunOne was null")); + LOG("ScriptInvestigation", ("runSCripts4 failed because midRunOne was nullptr")); } else { - LOG("ScriptInvestigation", ("runSCripts4 failed because clsObject was null")); + LOG("ScriptInvestigation", ("runSCripts4 failed because clsObject was nullptr")); } return SCRIPT_OVERRIDE; @@ -4775,19 +4775,19 @@ static const std::string errorReturnString; "JavaLibrary::runScript %s enter, method = %s\n", script.c_str(), method.c_str())); - if (ms_env == NULL || ms_midRunConsoleHandler == NULL || ms_clsObject == NULL) + if (ms_env == nullptr || ms_midRunConsoleHandler == nullptr || ms_clsObject == nullptr) { if (!ms_env) { - LOG("ScriptInvestigation", ("runSCripts2 failed because env was null")); + LOG("ScriptInvestigation", ("runSCripts2 failed because env was nullptr")); } else if (!ms_midRunConsoleHandler) { - LOG("ScriptInvestigation", ("runSCripts2 failed because midRunConsoleHandler was null")); + LOG("ScriptInvestigation", ("runSCripts2 failed because midRunConsoleHandler was nullptr")); } else { - LOG("ScriptInvestigation", ("runSCripts2 failed because clsObject was null")); + LOG("ScriptInvestigation", ("runSCripts2 failed because clsObject was nullptr")); } return errorReturnString; @@ -4877,7 +4877,7 @@ static const std::string errorReturnString; */ bool JavaLibrary::reloadScript(const std::string& scriptName) { - if (ms_env == NULL || ms_clsScriptEntry == NULL || ms_midUnload == NULL) + if (ms_env == nullptr || ms_clsScriptEntry == nullptr || ms_midUnload == nullptr) return false; // convert the script name to jstring @@ -4919,22 +4919,22 @@ int JavaLibrary::callMessages(const NetworkId & caller, const std::string & meth int result = SCRIPT_CONTINUE; - if (ms_env == NULL || ms_midRunOne == NULL || ms_clsObject == NULL) + if (ms_env == nullptr || ms_midRunOne == nullptr || ms_clsObject == nullptr) { DEBUG_REPORT_LOG(ConfigServerGame::getJavaConsoleDebugMessages(), ( "JavaLibrary::callMessages exit, self = %s, method = %s\n", caller.getValueString().c_str(), method.c_str())); if (!ms_env) { - LOG("ScriptInvestigation", ("callMessages failed because env was null")); + LOG("ScriptInvestigation", ("callMessages failed because env was nullptr")); } else if (!ms_midRunOne) { - LOG("ScriptInvestigation", ("callMessages failed because midRunOne was null")); + LOG("ScriptInvestigation", ("callMessages failed because midRunOne was nullptr")); } else { - LOG("ScriptInvestigation", ("callMessages failed because clsObject was null")); + LOG("ScriptInvestigation", ("callMessages failed because clsObject was nullptr")); } return SCRIPT_OVERRIDE; @@ -4951,7 +4951,7 @@ int JavaLibrary::callMessages(const NetworkId & caller, const std::string & meth const JavaDictionary * dictionary = safe_cast(data.get()); jobject jdictionary = 0; - if (dictionary != NULL) + if (dictionary != nullptr) jdictionary = dictionary->getValue(); // convert the method string to jstrings @@ -5013,22 +5013,22 @@ int JavaLibrary::callMessage(const NetworkId & caller, const std::string & scrip "JavaLibrary::callMessage %s enter, self = %s, method = %s\n", script.c_str(), caller.getValueString().c_str(), method.c_str())); - if (ms_env == NULL || ms_midRunOne == NULL || ms_clsObject == NULL) + if (ms_env == nullptr || ms_midRunOne == nullptr || ms_clsObject == nullptr) { DEBUG_REPORT_LOG(ConfigServerGame::getJavaConsoleDebugMessages(), ( "JavaLibrary::callMessage %s exit, self = %s, method = %s\n", script.c_str(), caller.getValueString().c_str(), method.c_str())); if (!ms_env) { - LOG("ScriptInvestigation", ("callMessage failed because env was null")); + LOG("ScriptInvestigation", ("callMessage failed because env was nullptr")); } else if (!ms_midRunOne) { - LOG("ScriptInvestigation", ("callMessage failed because midRunOne was null")); + LOG("ScriptInvestigation", ("callMessage failed because midRunOne was nullptr")); } else { - LOG("ScriptInvestigation", ("callMessage failed because clsObject was null")); + LOG("ScriptInvestigation", ("callMessage failed because clsObject was nullptr")); } return SCRIPT_OVERRIDE; @@ -5044,7 +5044,7 @@ int JavaLibrary::callMessage(const NetworkId & caller, const std::string & scrip } const JavaDictionary * dictionary = dynamic_cast(&data); - if (dictionary == NULL) + if (dictionary == nullptr) { DEBUG_REPORT_LOG(ConfigServerGame::getJavaConsoleDebugMessages(), ( "JavaLibrary::callMessage %s exit, self = %s, method = %s\n", @@ -5218,7 +5218,7 @@ void JavaLibrary::packDictionary(const ScriptDictionary & dictionary, bool JavaLibrary::unpackDictionary(const std::vector & packedData, ScriptDictionaryPtr & dictionary) { - if (ms_env == NULL) + if (ms_env == nullptr) return false; dictionary = JavaDictionary::cms_nullPtr; @@ -5259,7 +5259,7 @@ bool JavaLibrary::unpackDictionary(const std::vector & packedData, } } */ - if (data != NULL && *data != '\0') + if (data != nullptr && *data != '\0') { LocalByteArrayRefPtr jdata = createNewByteArray(dataLen); if (jdata != LocalByteArrayRef::cms_nullPtr) @@ -5335,7 +5335,7 @@ const bool JavaLibrary::convert(const JavaStringParam & source, Unicode::String const bool JavaLibrary::convert(const JavaDictionary & source, std::vector & target) { bool result = false; - if (ms_env != NULL) + if (ms_env != nullptr) { if (source.getValue() != 0) { @@ -5463,7 +5463,7 @@ const bool convert(const std::vector & source, LocalObj result = true; for (int i = 0; i < count; ++i) { - if (source[i] != NULL) + if (source[i] != nullptr) { JavaString targetElement(*source[i]); setObjectArrayElement(*target, i, targetElement); @@ -6160,7 +6160,7 @@ const bool convert(const LocalRefParam & source, const Region * & target) const bool convert(const jobject & source, const Region * &target) { JNIEnv * env = JavaLibrary::getEnv(); - if (env == NULL || source == NULL) + if (env == nullptr || source == nullptr) return false; if (!env->IsInstanceOf(source, JavaLibrary::ms_clsRegion)) return false; @@ -6384,7 +6384,7 @@ const bool convert(const LocalRefParam & sourceVector, Vector & target) const bool convert(const AttribMod::AttribMod & source, LocalRefPtr & target) { JNIEnv * env = JavaLibrary::getEnv(); - if (env == NULL) + if (env == nullptr) return false; target = allocObject(JavaLibrary::ms_clsAttribMod); @@ -6418,7 +6418,7 @@ const bool convert(const AttribMod::AttribMod & source, LocalRefPtr & target) const bool convert(const jobject & source, AttribMod::AttribMod & target) { JNIEnv * env = JavaLibrary::getEnv(); - if (env == NULL) + if (env == nullptr) return false; if (source == 0 || env->IsInstanceOf(source, JavaLibrary::ms_clsAttribMod) == JNI_FALSE) @@ -6477,7 +6477,7 @@ const bool convert(const LocalRefParam & source, AttribMod::AttribMod & target) const bool convert(const std::vector & source, LocalObjectArrayRefPtr & target) { JNIEnv * env = JavaLibrary::getEnv(); - if (env == NULL) + if (env == nullptr) return false; int count = source.size(); @@ -6504,7 +6504,7 @@ const bool convert(const std::vector & source, LocalObject const bool convert(const jobjectArray & source, std::vector & target) { JNIEnv * env = JavaLibrary::getEnv(); - if (env == NULL) + if (env == nullptr) return false; if (source == 0) @@ -6529,7 +6529,7 @@ const bool convert(const jobjectArray & source, std::vector & target) { JNIEnv * env = JavaLibrary::getEnv(); - if (env == NULL) + if (env == nullptr) return false; if (source == 0) @@ -6545,7 +6545,7 @@ const bool convert(const jbyteArray & source, std::vector & target) const bool convert(const LocalByteArrayRef & source, std::vector & target) { JNIEnv * env = JavaLibrary::getEnv(); - if (env == NULL) + if (env == nullptr) return false; if (source.getValue() == 0) @@ -6561,7 +6561,7 @@ const bool convert(const LocalByteArrayRef & source, std::vector & target) const bool convert(const std::vector & source, LocalByteArrayRefPtr & target) { JNIEnv * env = JavaLibrary::getEnv(); - if (env == NULL) + if (env == nullptr) return false; int count = source.size(); @@ -6593,10 +6593,10 @@ CreatureObject *JavaLibrary::getCreatureThrow(JNIEnv *env, jlong objId, char con if (!objId) { - IGNORE_RETURN(snprintf(buffer, sizeof(buffer) - 1, "%s: null object id from script.", errorDescription)); + IGNORE_RETURN(snprintf(buffer, sizeof(buffer) - 1, "%s: nullptr object id from script.", errorDescription)); buffer[sizeof(buffer) - 1] = '\0'; throwInternalScriptError(buffer); - return NULL; + return nullptr; } else { @@ -6606,7 +6606,7 @@ CreatureObject *JavaLibrary::getCreatureThrow(JNIEnv *env, jlong objId, char con IGNORE_RETURN(snprintf(buffer, sizeof(buffer) - 1, "%s: invalid or non-convertable network id [%s].", errorDescription, networkId.getValueString().c_str())); buffer[sizeof(buffer) - 1] = '\0'; throwInternalScriptError(buffer); - return NULL; + return nullptr; } else { @@ -6616,19 +6616,19 @@ CreatureObject *JavaLibrary::getCreatureThrow(JNIEnv *env, jlong objId, char con if (!throwIfNotOnServer) { // The specified object is not on this server. It might not even be a real object. - // Since the caller does not want this to throw, simply return NULL. - return NULL; + // Since the caller does not want this to throw, simply return nullptr. + return nullptr; } IGNORE_RETURN(snprintf(buffer, sizeof(buffer) - 1, "%s: object for network id [%s] not on this server.", errorDescription, networkId.getValueString().c_str())); buffer[sizeof(buffer) - 1] = '\0'; throwInternalScriptError(buffer); - return NULL; + return nullptr; } else { ServerObject *const serverObject = object->asServerObject(); - CreatureObject *const creatureObject = serverObject ? serverObject->asCreatureObject() : NULL; + CreatureObject *const creatureObject = serverObject ? serverObject->asCreatureObject() : nullptr; if (creatureObject) return creatureObject; @@ -6637,7 +6637,7 @@ CreatureObject *JavaLibrary::getCreatureThrow(JNIEnv *env, jlong objId, char con IGNORE_RETURN(snprintf(buffer, sizeof(buffer) - 1, "%s: object id=[%s], template=[%s] is not a CreatureObject.", errorDescription, networkId.getValueString().c_str(), object->getObjectTemplateName())); buffer[sizeof(buffer) - 1] = '\0'; throwInternalScriptError(buffer); - return NULL; + return nullptr; } } } @@ -6654,10 +6654,10 @@ ShipObject *JavaLibrary::getShipThrow(JNIEnv *env, jlong objId, char const *erro if (objId == 0) { - IGNORE_RETURN(snprintf(buffer, sizeof(buffer) - 1, "%s: null object id from script.", errorDescription)); + IGNORE_RETURN(snprintf(buffer, sizeof(buffer) - 1, "%s: nullptr object id from script.", errorDescription)); buffer[sizeof(buffer) - 1] = '\0'; throwInternalScriptError(buffer); - return NULL; + return nullptr; } else { @@ -6667,7 +6667,7 @@ ShipObject *JavaLibrary::getShipThrow(JNIEnv *env, jlong objId, char const *erro IGNORE_RETURN(snprintf(buffer, sizeof(buffer) - 1, "%s: invalid or non-convertable network id [%s].", errorDescription, networkId.getValueString().c_str())); buffer[sizeof(buffer) - 1] = '\0'; throwInternalScriptError(buffer); - return NULL; + return nullptr; } else { @@ -6677,19 +6677,19 @@ ShipObject *JavaLibrary::getShipThrow(JNIEnv *env, jlong objId, char const *erro if (!throwIfNotOnServer) { // The specified object is not on this server. It might not even be a real object. - // Since the caller does not want this to throw, simply return NULL. - return NULL; + // Since the caller does not want this to throw, simply return nullptr. + return nullptr; } IGNORE_RETURN(snprintf(buffer, sizeof(buffer) - 1, "%s: object for network id [%s] not on this server.", errorDescription, networkId.getValueString().c_str())); buffer[sizeof(buffer) - 1] = '\0'; throwInternalScriptError(buffer); - return NULL; + return nullptr; } else { ServerObject *const serverObject = object->asServerObject(); - ShipObject *const shipObject = serverObject ? serverObject->asShipObject() : NULL; + ShipObject *const shipObject = serverObject ? serverObject->asShipObject() : nullptr; if (shipObject) return shipObject; @@ -6698,7 +6698,7 @@ ShipObject *JavaLibrary::getShipThrow(JNIEnv *env, jlong objId, char const *erro IGNORE_RETURN(snprintf(buffer, sizeof(buffer) - 1, "%s: object id=[%s], template=[%s] is not a ShipObject.", errorDescription, networkId.getValueString().c_str(), object->getObjectTemplateName())); buffer[sizeof(buffer) - 1] = '\0'; throwInternalScriptError(buffer); - return NULL; + return nullptr; } } } @@ -6714,7 +6714,7 @@ ShipObject *JavaLibrary::getShipThrow(JNIEnv *env, jlong objId, char const *erro */ void JavaLibrary::throwInternalScriptError(const char * message) { - if (ms_env != NULL && message != NULL) + if (ms_env != nullptr && message != nullptr) { ms_env->ThrowNew(ms_clsInternalScriptError, message); } diff --git a/engine/server/library/serverScript/src/shared/ScriptFunctionTable.cpp b/engine/server/library/serverScript/src/shared/ScriptFunctionTable.cpp index 976743ee..e9f4e88c 100755 --- a/engine/server/library/serverScript/src/shared/ScriptFunctionTable.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptFunctionTable.cpp @@ -434,7 +434,7 @@ static const Scripting::ScriptFuncTable ScriptFuncList[] = //-- finish it up - {Scripting::TRIG_LAST_TRIGGER, NULL, NULL} + {Scripting::TRIG_LAST_TRIGGER, nullptr, nullptr} }; const int NUM_SCRIPT_FUNCTIONS = sizeof(ScriptFuncList) / sizeof(ScriptFuncList[0]) - 1; @@ -444,7 +444,7 @@ const int NUM_SCRIPT_FUNCTIONS = sizeof(ScriptFuncList) / sizeof(ScriptFuncList[ // globals //======================================================================== -Scripting::_ScriptFuncHashMap *Scripting::ScriptFuncHashMap = NULL; +Scripting::_ScriptFuncHashMap *Scripting::ScriptFuncHashMap = nullptr; //======================================================================== @@ -468,6 +468,6 @@ void Scripting::InitScriptFuncHashMap(void) void Scripting::RemoveScriptFuncHashMap(void) { delete Scripting::ScriptFuncHashMap; - Scripting::ScriptFuncHashMap = NULL; + Scripting::ScriptFuncHashMap = nullptr; } diff --git a/engine/server/library/serverScript/src/shared/ScriptListEntry.cpp b/engine/server/library/serverScript/src/shared/ScriptListEntry.cpp index 1f55096a..8725947c 100755 --- a/engine/server/library/serverScript/src/shared/ScriptListEntry.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptListEntry.cpp @@ -16,9 +16,9 @@ std::string const &ScriptListEntry::getScriptName() const { static const std::string emptyString; - if (m_data != NULL) + if (m_data != nullptr) return m_data->first; - WARNING_STRICT_FATAL(true, ("ScriptListEntry::getScriptName called with m_data = NULL")); + WARNING_STRICT_FATAL(true, ("ScriptListEntry::getScriptName called with m_data = nullptr")); return emptyString; } @@ -28,9 +28,9 @@ ScriptData &ScriptListEntry::getScriptData() const { static ScriptData emptyData; - if (m_data != NULL) + if (m_data != nullptr) return m_data->second; - WARNING_STRICT_FATAL(true, ("ScriptListEntry::getScriptData called with m_data = NULL")); + WARNING_STRICT_FATAL(true, ("ScriptListEntry::getScriptData called with m_data = nullptr")); return emptyData; } diff --git a/engine/server/library/serverScript/src/shared/ScriptListEntry.h b/engine/server/library/serverScript/src/shared/ScriptListEntry.h index 1d5e8f66..37349274 100755 --- a/engine/server/library/serverScript/src/shared/ScriptListEntry.h +++ b/engine/server/library/serverScript/src/shared/ScriptListEntry.h @@ -53,7 +53,7 @@ inline bool ScriptListEntry::operator==(ScriptListEntry const &rhs) const inline bool ScriptListEntry::isValid() const { - return m_data != NULL; + return m_data != nullptr; } // ====================================================================== diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsAi.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsAi.cpp index eab60dd9..1d12a09a 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsAi.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsAi.cpp @@ -126,18 +126,18 @@ AICreatureController * const ScriptMethodsAiNamespace::getAiCreatureController(j NetworkId const aiNetworkId(ai); CreatureObject * const aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId); - if (aiCreatureObject == NULL) + if (aiCreatureObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("Unable to resolve the ai(%s) to a CreatureObject.", aiNetworkId.getValueString().c_str())); - return NULL; + return nullptr; } AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(aiCreatureObject->getController()); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("Unable to get the ai's(%s) AiCreatureController.", aiCreatureObject->getDebugInformation().c_str())); - return NULL; + return nullptr; } return aiCreatureController; @@ -155,14 +155,14 @@ jint JNICALL ScriptMethodsAiNamespace::aiGetMovementState(JNIEnv * /*env*/, jobj NetworkId const aiNetworkId(ai); CreatureObject * const aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId); - if (aiCreatureObject == NULL) + if (aiCreatureObject == nullptr) { return AMT_invalid; } AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(aiCreatureObject->getController()); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return AMT_invalid; } @@ -187,14 +187,14 @@ jboolean JNICALL ScriptMethodsAiNamespace::aiLoggingEnabled(JNIEnv * /*env*/, jo NetworkId const aiNetworkId(ai); CreatureObject * const aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId); - if (aiCreatureObject == NULL) + if (aiCreatureObject == nullptr) { return JNI_FALSE; } AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(aiCreatureObject->getController()); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return JNI_FALSE; } @@ -212,7 +212,7 @@ jboolean JNICALL ScriptMethodsAiNamespace::aiIsFrozen(JNIEnv * /*env*/, jobject { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return JNI_FALSE; } @@ -226,14 +226,14 @@ jboolean JNICALL ScriptMethodsAiNamespace::aiIsAggressive(JNIEnv * /*env*/, jobj NetworkId const aiNetworkId(ai); CreatureObject * const aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId); - if (aiCreatureObject == NULL) + if (aiCreatureObject == nullptr) { return JNI_FALSE; } AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(aiCreatureObject->getController()); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return JNI_FALSE; } @@ -247,14 +247,14 @@ jboolean JNICALL ScriptMethodsAiNamespace::aiIsAssist(JNIEnv * /*env*/, jobject NetworkId const aiNetworkId(ai); CreatureObject * const aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId); - if (aiCreatureObject == NULL) + if (aiCreatureObject == nullptr) { return JNI_FALSE; } AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(aiCreatureObject->getController()); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return JNI_FALSE; } @@ -267,7 +267,7 @@ jboolean JNICALL ScriptMethodsAiNamespace::aiIsStalker(JNIEnv * /*env*/, jobject { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return JNI_FALSE; } @@ -282,14 +282,14 @@ jboolean JNICALL ScriptMethodsAiNamespace::aiIsKiller(JNIEnv * /*env*/, jobject NetworkId const aiNetworkId(ai); CreatureObject * const aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId); - if (aiCreatureObject == NULL) + if (aiCreatureObject == nullptr) { return JNI_FALSE; } AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(aiCreatureObject->getController()); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return JNI_FALSE; } @@ -302,7 +302,7 @@ void JNICALL ScriptMethodsAiNamespace::aiTether(JNIEnv * /*env*/, jobject /*self { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return; } @@ -316,14 +316,14 @@ jboolean JNICALL ScriptMethodsAiNamespace::aiIsTethered(JNIEnv * /*env*/, jobjec NetworkId const aiNetworkId(ai); CreatureObject * const aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId); - if (aiCreatureObject == NULL) + if (aiCreatureObject == nullptr) { return JNI_FALSE; } AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(aiCreatureObject->getController()); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return JNI_FALSE; } @@ -336,7 +336,7 @@ void JNICALL ScriptMethodsAiNamespace::aiSetHomeLocation(JNIEnv * /*env*/, jobje { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return; } @@ -356,7 +356,7 @@ jobject JNICALL ScriptMethodsAiNamespace::aiGetHomeLocation(JNIEnv * /*env*/, jo { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return JavaLibrary::getVector(Vector::zero)->getReturnValue(); } @@ -373,7 +373,7 @@ jobject JNICALL ScriptMethodsAiNamespace::aiGetLeashAnchorLocation(JNIEnv * /*en { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return JavaLibrary::getVector(Vector::zero)->getReturnValue(); } @@ -396,7 +396,7 @@ jfloat JNICALL ScriptMethodsAiNamespace::aiGetRespectRadius(JNIEnv * /*env*/, jo { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return 0.0f; } @@ -411,7 +411,7 @@ jfloat JNICALL ScriptMethodsAiNamespace::aiGetAggroRadius(JNIEnv * /*env*/, jobj { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return 0.0f; } @@ -424,7 +424,7 @@ void JNICALL ScriptMethodsAiNamespace::aiEquipPrimaryWeapon(JNIEnv * /*env*/, jo { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return; } @@ -437,7 +437,7 @@ void JNICALL ScriptMethodsAiNamespace::aiEquipSecondaryWeapon(JNIEnv * /*env*/, { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return; } @@ -450,7 +450,7 @@ void JNICALL ScriptMethodsAiNamespace::aiUnEquipWeapons(JNIEnv * /*env*/, jobjec { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return; } @@ -463,7 +463,7 @@ jboolean JNICALL ScriptMethodsAiNamespace::aiHasPrimaryWeapon(JNIEnv * /*env*/, { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return JNI_FALSE; } @@ -476,7 +476,7 @@ jboolean JNICALL ScriptMethodsAiNamespace::aiHasSecondaryWeapon(JNIEnv * /*env*/ { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return JNI_FALSE; } @@ -489,7 +489,7 @@ jboolean JNICALL ScriptMethodsAiNamespace::aiUsingPrimaryWeapon(JNIEnv * /*env*/ { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return JNI_FALSE; } @@ -502,7 +502,7 @@ jboolean JNICALL ScriptMethodsAiNamespace::aiUsingSecondaryWeapon(JNIEnv * /*env { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return JNI_FALSE; } @@ -515,7 +515,7 @@ jlong JNICALL ScriptMethodsAiNamespace::aiGetPrimaryWeapon(JNIEnv * /*env*/, job { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return 0; } @@ -528,7 +528,7 @@ jlong JNICALL ScriptMethodsAiNamespace::aiGetSecondaryWeapon(JNIEnv * /*env*/, j { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return 0; } @@ -541,7 +541,7 @@ jfloat JNICALL ScriptMethodsAiNamespace::aiGetMovementSpeedPercent(JNIEnv * /*en { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return 0.0f; } @@ -554,7 +554,7 @@ void JNICALL ScriptMethodsAiNamespace::loiterLocation(JNIEnv * /*env*/, jobject { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return; } @@ -585,7 +585,7 @@ void JNICALL ScriptMethodsAiNamespace::loiterLocation(JNIEnv * /*env*/, jobject CellObject const * const cellObject = CellObject::getCellObject(cellId); - if (cellObject != NULL) + if (cellObject != nullptr) { CellProperty const * const cellProperty = cellObject->getCellProperty(); @@ -608,7 +608,7 @@ void JNICALL ScriptMethodsAiNamespace::loiterTarget(JNIEnv * /*env*/, jobject /* { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return; } @@ -623,7 +623,7 @@ void JNICALL ScriptMethodsAiNamespace::loiterTarget(JNIEnv * /*env*/, jobject /* NetworkId const targetNetworkId(static_cast(target)); Object * const targetObject = NetworkIdManager::getObjectById(targetNetworkId); - if (targetObject == NULL) + if (targetObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsAi::loiterTarget() ai(%s) Unable to resolve the target(%s) to a Object", aiCreatureController->getCreature()->getDebugInformation().c_str(), targetNetworkId.getValueString().c_str())); return; @@ -643,7 +643,7 @@ void JNICALL ScriptMethodsAiNamespace::pathToLocation(JNIEnv * /*env*/, jobject { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return; } @@ -664,7 +664,7 @@ void JNICALL ScriptMethodsAiNamespace::pathToLocation(JNIEnv * /*env*/, jobject { CellObject const * const cellObject = CellObject::getCellObject(cellId); - if (cellObject != NULL) + if (cellObject != nullptr) { CellProperty const * const cellProperty = cellObject->getCellProperty(); @@ -697,7 +697,7 @@ void JNICALL ScriptMethodsAiNamespace::pathToName(JNIEnv * /*env*/, jobject /*se { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return; } @@ -731,7 +731,7 @@ void JNICALL ScriptMethodsAiNamespace::pathToName(JNIEnv * /*env*/, jobject /*se void JNICALL ScriptMethodsAiNamespace::patrolToLocation(JNIEnv *, jobject, jlong ai, jobjectArray targets, jboolean random, jboolean flip, jboolean repeat, jint startPoint) { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) return; std::vector locations; @@ -755,7 +755,7 @@ void JNICALL ScriptMethodsAiNamespace::patrolToLocation(JNIEnv *, jobject, jlong void JNICALL ScriptMethodsAiNamespace::patrolToName(JNIEnv *, jobject, jlong ai, jobjectArray targetNames, jboolean random, jboolean flip, jboolean repeat, jint startPoint) { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) return; std::vector locations; @@ -768,11 +768,11 @@ void JNICALL ScriptMethodsAiNamespace::patrolToName(JNIEnv *, jobject, jlong ai, for (int i = 0; i < count; ++i) { const Unicode::String * location = locations[i]; - if (location != NULL) + if (location != nullptr) { realLocations.push_back(*location); delete location; - locations[i] = NULL; + locations[i] = nullptr; } } aiCreatureController->patrol(realLocations, random, flip, repeat, startPoint); @@ -783,16 +783,16 @@ jstring JNICALL ScriptMethodsAiNamespace::aiGetCombatAction(JNIEnv * /*env*/, jo { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { - return NULL; + return nullptr; } PersistentCrcString const & result = aiCreatureController->getCombatAction(); if (result.isEmpty()) { - return NULL; + return nullptr; } JavaString javaString(result.getString()); @@ -805,7 +805,7 @@ jint JNICALL ScriptMethodsAiNamespace::aiGetKnockDownRecoveryTime(JNIEnv * /*env { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return 0; } @@ -819,7 +819,7 @@ jboolean JNICALL ScriptMethodsAiNamespace::setHibernationDelay(JNIEnv *env, jobj { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(creature); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) return JNI_FALSE; aiCreatureController->setHibernationDelay(delay); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsAnimation.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsAnimation.cpp index d41f22ca..9c2ec894 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsAnimation.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsAnimation.cpp @@ -97,7 +97,7 @@ void JNICALL ScriptMethodsAnimationNamespace::setAnimationMood (JNIEnv *env, job JavaStringParam localMoodName(moodName); - ServerObject * targetObject = NULL; + ServerObject * targetObject = nullptr; if (!JavaLibrary::getObject(target, targetObject)) return; @@ -114,7 +114,7 @@ void JNICALL ScriptMethodsAnimationNamespace::setAnimationMood (JNIEnv *env, job jstring JNICALL ScriptMethodsAnimationNamespace::getAnimationMood (JNIEnv *env, jobject self, jlong target) { - ServerObject * targetObject = NULL; + ServerObject * targetObject = nullptr; if (!JavaLibrary::getObject(target, targetObject)) return 0; @@ -143,7 +143,7 @@ jboolean JNICALL ScriptMethodsAnimationNamespace::sitOnObject (JNIEnv *env, jobj CreatureObject *sitterObject = 0; if (!JavaLibrary::getObject (sitterId, sitterObject) || !sitterObject) { - DEBUG_WARNING (true, ("sitOnObject(): Sitter object is NULL.")); + DEBUG_WARNING (true, ("sitOnObject(): Sitter object is nullptr.")); return JNI_FALSE; } @@ -175,11 +175,11 @@ void JNICALL ScriptMethodsAnimationNamespace::setObjectAppearance(JNIEnv *env, j UNREF(env); UNREF(self); - CreatureObject* creature = NULL; + CreatureObject* creature = nullptr; if(!JavaLibrary::getObject(target, creature) || !creature) { - DEBUG_WARNING(true, ("SetObjectAppearance() : Creature object was NULL.\n")); + DEBUG_WARNING(true, ("SetObjectAppearance() : Creature object was nullptr.\n")); return; } @@ -209,11 +209,11 @@ void JNICALL ScriptMethodsAnimationNamespace::revertObjectAppearance(JNIEnv *env UNREF(env); UNREF(self); - CreatureObject* creature = NULL; + CreatureObject* creature = nullptr; if(!JavaLibrary::getObject(target, creature) || !creature) { - DEBUG_WARNING(true, ("RevertObjectAppearance() : Creature object was NULL.\n")); + DEBUG_WARNING(true, ("RevertObjectAppearance() : Creature object was nullptr.\n")); return; } diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsAttributes.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsAttributes.cpp index 266b10f8..42c47200 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsAttributes.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsAttributes.cpp @@ -549,12 +549,12 @@ jboolean JNICALL ScriptMethodsAttributesNamespace::hasAttribModifier(JNIEnv *env if (!JavaLibrary::convert(jmodName, name)) return JNI_FALSE; - const CreatureObject * creature = NULL; + const CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; const AttribMod::AttribMod * mod = creature->getAttributeModifier(name); - if (mod != NULL && AttribMod::isAttribMod(*mod)) + if (mod != nullptr && AttribMod::isAttribMod(*mod)) return JNI_TRUE; return JNI_FALSE; @@ -582,12 +582,12 @@ jboolean JNICALL ScriptMethodsAttributesNamespace::hasSkillModModifier(JNIEnv *e if (!JavaLibrary::convert(jmodName, name)) return JNI_FALSE; - const CreatureObject * creature = NULL; + const CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; const AttribMod::AttribMod * mod = creature->getAttributeModifier(name); - if (mod != NULL && AttribMod::isSkillMod(*mod)) + if (mod != nullptr && AttribMod::isSkillMod(*mod)) return JNI_TRUE; return JNI_FALSE; @@ -601,7 +601,7 @@ jboolean JNICALL ScriptMethodsAttributesNamespace::hasSkillModModifier(JNIEnv *e * @param target id of creature to access * @param attrib attribute we are interested in * - * @return the attribute modifiers for the creature, or null if it has none + * @return the attribute modifiers for the creature, or nullptr if it has none */ jobjectArray JNICALL ScriptMethodsAttributesNamespace::getAttribModifiers(JNIEnv *env, jobject self, jlong target, jint attrib) { @@ -642,7 +642,7 @@ jobjectArray JNICALL ScriptMethodsAttributesNamespace::getAttribModifiers(JNIEnv * @param self class calling this function * @param target id of creature to access * - * @return the attribute modifiers for the creature, or null if it has none + * @return the attribute modifiers for the creature, or nullptr if it has none */ jobjectArray JNICALL ScriptMethodsAttributesNamespace::getAllAttribModifiers(JNIEnv *env, jobject self, jlong target) { @@ -692,7 +692,7 @@ jboolean JNICALL ScriptMethodsAttributesNamespace::removeAttribModifier(JNIEnv * if (!JavaLibrary::convert(jmodName, name)) return JNI_FALSE; - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -1084,12 +1084,12 @@ jint JNICALL ScriptMethodsAttributesNamespace::getHitpoints(JNIEnv *env, jobject { UNREF(self); - const TangibleObject * object = NULL; + const TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return ATTRIB_ERROR; // make sure the object isn't a creature or is a vehicle - if (object->asCreatureObject () != NULL && + if (object->asCreatureObject () != nullptr && !GameObjectTypes::isTypeOf (object->getGameObjectType (), SharedObjectTemplate::GOT_vehicle)) return ATTRIB_ERROR; @@ -1111,12 +1111,12 @@ jint JNICALL ScriptMethodsAttributesNamespace::getMaxHitpoints(JNIEnv *env, jobj { UNREF(self); - const TangibleObject * object = NULL; + const TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return ATTRIB_ERROR; // make sure the object isn't a creature or is a vehicle - if (object->asCreatureObject () != NULL && + if (object->asCreatureObject () != nullptr && !GameObjectTypes::isTypeOf (object->getGameObjectType (), SharedObjectTemplate::GOT_vehicle)) return ATTRIB_ERROR; @@ -1136,13 +1136,13 @@ jint JNICALL ScriptMethodsAttributesNamespace::getTotalHitpoints(JNIEnv *env, jo { UNREF(self); - const TangibleObject * object = NULL; + const TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return ATTRIB_ERROR; // make sure the object isn't a creature // make sure the object isn't a creature or is a vehicle - if (object->asCreatureObject () != NULL && + if (object->asCreatureObject () != nullptr && !GameObjectTypes::isTypeOf (object->getGameObjectType (), SharedObjectTemplate::GOT_vehicle)) return ATTRIB_ERROR; @@ -1164,12 +1164,12 @@ jboolean JNICALL ScriptMethodsAttributesNamespace::setHitpoints(JNIEnv *env, job { UNREF(self); - TangibleObject * object = NULL; + TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; // make sure the object isn't a creature or is a vehicle - if (object->asCreatureObject () != NULL && + if (object->asCreatureObject () != nullptr && !GameObjectTypes::isTypeOf (object->getGameObjectType (), SharedObjectTemplate::GOT_vehicle)) return JNI_FALSE; @@ -1209,12 +1209,12 @@ jboolean JNICALL ScriptMethodsAttributesNamespace::setMaxHitpoints(JNIEnv *env, { UNREF(self); - TangibleObject * object = NULL; + TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; // make sure the object isn't a creature or is a vehicle - if (object->asCreatureObject () != NULL && + if (object->asCreatureObject () != nullptr && !GameObjectTypes::isTypeOf (object->getGameObjectType (), SharedObjectTemplate::GOT_vehicle)) return JNI_FALSE; @@ -1237,12 +1237,12 @@ jboolean JNICALL ScriptMethodsAttributesNamespace::setInvulnerableHitpoints(JNIE { UNREF(self); - TangibleObject * object = NULL; + TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; // make sure the object isn't a creature or is a vehicle - if (object->asCreatureObject () != NULL && + if (object->asCreatureObject () != nullptr && !GameObjectTypes::isTypeOf (object->getGameObjectType (), SharedObjectTemplate::GOT_vehicle)) return JNI_FALSE; @@ -1280,7 +1280,7 @@ jboolean JNICALL ScriptMethodsAttributesNamespace::setInvulnerableHitpoints(JNIE */ jint JNICALL ScriptMethodsAttributesNamespace::getShockWound(JNIEnv *env, jobject self, jlong target) { - const CreatureObject * creature = NULL; + const CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return ATTRIB_ERROR; @@ -1299,7 +1299,7 @@ jint JNICALL ScriptMethodsAttributesNamespace::getShockWound(JNIEnv *env, jobjec */ jboolean JNICALL ScriptMethodsAttributesNamespace::setShockWound(JNIEnv *env, jobject self, jlong target, jint wound) { - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -1319,7 +1319,7 @@ jboolean JNICALL ScriptMethodsAttributesNamespace::setShockWound(JNIEnv *env, jo */ jboolean JNICALL ScriptMethodsAttributesNamespace::addShockWound(JNIEnv *env, jobject self, jlong target, jint wound) { - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -1339,7 +1339,7 @@ jboolean JNICALL ScriptMethodsAttributesNamespace::addShockWound(JNIEnv *env, jo */ jboolean JNICALL ScriptMethodsAttributesNamespace::healShockWound(JNIEnv *env, jobject self, jlong target, jint value) { - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsAuction.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsAuction.cpp index 0a76643b..e288480b 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsAuction.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsAuction.cpp @@ -110,8 +110,8 @@ void JNICALL ScriptMethodsAuctionNamespace::createVendorMarket(JNIEnv *env, jobj void JNICALL ScriptMethodsAuctionNamespace::auctionCreatePermanent(JNIEnv *env, jobject script, jstring jownerName, jlong jitem, jlong jauctionContainer, jint jprice, jstring juserDescription) { - TangibleObject *itemObject = NULL; - ServerObject *containerObj = NULL; + TangibleObject *itemObject = nullptr; + ServerObject *containerObj = nullptr; if (!JavaLibrary::getObject(jitem, itemObject)) { @@ -194,7 +194,7 @@ void JNICALL ScriptMethodsAuctionNamespace::setSalesTax(JNIEnv *env, jobject scr void JNICALL ScriptMethodsAuctionNamespace::requestVendorItemCount(JNIEnv *env, jobject script, jlong vendor) { - ServerObject* vendorObject = NULL; + ServerObject* vendorObject = nullptr; if( !JavaLibrary::getObject(vendor, vendorObject) ) { WARNING(true, ("[designer bug] requestVendorItemLimit() vendor is invalid.")); @@ -206,7 +206,7 @@ void JNICALL ScriptMethodsAuctionNamespace::requestVendorItemCount(JNIEnv *env, void JNICALL ScriptMethodsAuctionNamespace::requestPlayerVendorCount(JNIEnv *env, jobject script, jlong player) { - ServerObject* playerObject = NULL; + ServerObject* playerObject = nullptr; if( !JavaLibrary::getObject(player, playerObject) ) { WARNING(true, ("[designer bug] requestPlayerVendorCount() player is invalid.")); @@ -218,7 +218,7 @@ void JNICALL ScriptMethodsAuctionNamespace::requestPlayerVendorCount(JNIEnv *env void JNICALL ScriptMethodsAuctionNamespace::updateVendorSearchOption(JNIEnv *env, jobject script, jlong vendor, jboolean enable) { - ServerObject* vendorObject = NULL; + ServerObject* vendorObject = nullptr; bool enabled; if( !JavaLibrary::getObject(vendor, vendorObject) ) { @@ -235,7 +235,7 @@ void JNICALL ScriptMethodsAuctionNamespace::updateVendorSearchOption(JNIEnv *env void JNICALL ScriptMethodsAuctionNamespace::setEntranceCharge(JNIEnv *env, jobject script, jlong vendor, jint entranceCharge) { - ServerObject* vendorObject = NULL; + ServerObject* vendorObject = nullptr; if( !JavaLibrary::getObject(vendor, vendorObject) ) { WARNING(true, ("[designer bug] setEntranceCharge() vendor is invalid.")); @@ -247,7 +247,7 @@ void JNICALL ScriptMethodsAuctionNamespace::setEntranceCharge(JNIEnv *env, jobje void JNICALL ScriptMethodsAuctionNamespace::removeAllAuctions(JNIEnv *env, jobject script, jlong jvendor) { - ServerObject* vendorObject = NULL; + ServerObject* vendorObject = nullptr; if( !JavaLibrary::getObject(jvendor, vendorObject) ) { WARNING(true, ("[designer bug] removeAllAuctions() vendor is invalid.")); @@ -259,21 +259,21 @@ void JNICALL ScriptMethodsAuctionNamespace::removeAllAuctions(JNIEnv *env, jobje void JNICALL ScriptMethodsAuctionNamespace::reinitializeVendor(JNIEnv *env, jobject script, jlong vendor, jlong player) { - ServerObject* vendorObject = NULL; + ServerObject* vendorObject = nullptr; if( !JavaLibrary::getObject(vendor, vendorObject) ) { WARNING(true, ("[designer bug] reinitializeVendor() vendor is invalid.")); return; } ServerObject* auctionContainer = vendorObject->getBazaarContainer(); - if ( auctionContainer == NULL ) + if ( auctionContainer == nullptr ) { WARNING(true, ("[designer bug] reinitializeVendor() vendor doesn't have an auction container.")); return; } - ServerObject* playerObject = NULL; + ServerObject* playerObject = nullptr; if ( !JavaLibrary::getObject(player, playerObject) ) { WARNING(true, ("[designer bug] reinitializeVendor() player is invalid.")); @@ -292,7 +292,7 @@ void JNICALL ScriptMethodsAuctionNamespace::reinitializeVendor(JNIEnv *env, jobj void JNICALL ScriptMethodsAuctionNamespace::updateVendorStatus(JNIEnv *env, jobject script, jlong vendor, jint status) { - ServerObject const * vendorObject = NULL; + ServerObject const * vendorObject = nullptr; if (!JavaLibrary::getObject(vendor, vendorObject)) { diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsBroadcasting.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsBroadcasting.cpp index aaea9f3c..2ee028b5 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsBroadcasting.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsBroadcasting.cpp @@ -63,7 +63,7 @@ void JNICALL ScriptMethodsBroadcastingNamespace::listenToMessage(JNIEnv *env, jo CachedNetworkId emitterId(emitter); ServerObject* listenerObject = dynamic_cast(listenerId.getObject()); - if (listenerObject == NULL) + if (listenerObject == nullptr) return; std::string messageHandlerNameString; @@ -88,7 +88,7 @@ void JNICALL ScriptMethodsBroadcastingNamespace::stopListeningToMessage(JNIEnv * CachedNetworkId emitterId(emitter); ServerObject* listenerObject = dynamic_cast(listenerId.getObject()); - if (listenerObject == NULL) + if (listenerObject == nullptr) return; std::string messageHandlerNameString; @@ -112,7 +112,7 @@ jlongArray JNICALL ScriptMethodsBroadcastingNamespace::getMessageListeners(JNIEn CachedNetworkId emitterId(emitter); ServerObject* emitterObject = dynamic_cast(emitterId.getObject()); - if (emitterObject == NULL) + if (emitterObject == nullptr) return 0; std::string messageHandlerNameString; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsBuffBuilder.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsBuffBuilder.cpp index 9eaabd1f..24289140 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsBuffBuilder.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsBuffBuilder.cpp @@ -162,8 +162,8 @@ jboolean JNICALL ScriptMethodsBuffBuilderNamespace::buffBuilderValidated(JNIEnv WARNING(true, ("index keys and values arrays are of diffent sizes")); return JNI_FALSE; } - jint * const buffComponentsValuesArray = env->GetIntArrayElements(jbuffComponentValues, NULL); - if (buffComponentsValuesArray == NULL) + jint * const buffComponentsValuesArray = env->GetIntArrayElements(jbuffComponentValues, nullptr); + if (buffComponentsValuesArray == nullptr) { return JNI_FALSE; } @@ -194,7 +194,7 @@ jboolean JNICALL ScriptMethodsBuffBuilderNamespace::buffBuilderValidated(JNIEnv { //send the final change message to the buffer to indicate acceptance - Controller * const bufferController = bufferObj ? bufferObj->getController() : NULL; + Controller * const bufferController = bufferObj ? bufferObj->getController() : nullptr; if(bufferController) { BuffBuilderChangeMessage * outMsg = new BuffBuilderChangeMessage(); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsChat.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsChat.cpp index 8e36a847..39fbf062 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsChat.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsChat.cpp @@ -218,7 +218,7 @@ jstring JNICALL ScriptMethodsChatNamespace::chatPackOutOfBandWaypointData(JNIEnv Unicode::String n; //name StringId nid; //nameId - //-- target may be null, we'll just start a new string + //-- target may be nullptr, we'll just start a new string if (target) { const JavaStringParam jtarget(target); @@ -229,7 +229,7 @@ jstring JNICALL ScriptMethodsChatNamespace::chatPackOutOfBandWaypointData(JNIEnv } } - //-- if planet is null, just use the current sceneId + //-- if planet is nullptr, just use the current sceneId if (planet) { const JavaStringParam jplanet(planet); @@ -304,7 +304,7 @@ jstring JNICALL ScriptMethodsChatNamespace::chatPackOutOfBandWaypoint(JNIEnv * e if (!source) { - DEBUG_WARNING (true, ("ScriptMethodsChat JavaLibrary::chatPackOutOfBandWaypoint failed null source")); + DEBUG_WARNING (true, ("ScriptMethodsChat JavaLibrary::chatPackOutOfBandWaypoint failed nullptr source")); return 0; } @@ -340,7 +340,7 @@ jstring JNICALL ScriptMethodsChatNamespace::packOutOfBandProsePackage(JNIEnv * e if (!stringId) { - DEBUG_WARNING (true, ("JavaLibrary::packOutOfBandProsePackage attempt to pack prose package with null stringId")); + DEBUG_WARNING (true, ("JavaLibrary::packOutOfBandProsePackage attempt to pack prose package with nullptr stringId")); return 0; } @@ -644,10 +644,10 @@ void JNICALL ScriptMethodsChatNamespace::chatSendSystemMessageObjId(JNIEnv * env if(!JavaLibrary::getObject(_to, player)) { - DEBUG_WARNING (true, ("ScriptMethodsChat JavaLibrary::chatSendSystemMessageObjId failed bad source object (not null)")); + DEBUG_WARNING (true, ("ScriptMethodsChat JavaLibrary::chatSendSystemMessageObjId failed bad source object (not nullptr)")); if (ConfigServerScript::allowDebugConsoleMessages()) { - fprintf(stderr, "WARNING: JavaLibrary::chatSendSystemMessageObjId: failed bad source object (not null)\n"); + fprintf(stderr, "WARNING: JavaLibrary::chatSendSystemMessageObjId: failed bad source object (not nullptr)\n"); JavaLibrary::printJavaStack(); } return; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsCity.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsCity.cpp index 6843dc85..db7499c7 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsCity.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsCity.cpp @@ -920,7 +920,7 @@ void JNICALL ScriptMethodsCityNamespace::cityRemoveStructure(JNIEnv *env, jobjec jboolean JNICALL ScriptMethodsCityNamespace::cityIsInactivePackupActive(JNIEnv *env, jobject self) { - return (ConfigServerGame::getCityCitizenshipInactivePackupStartTimeEpoch() <= static_cast(::time(NULL))); + return (ConfigServerGame::getCityCitizenshipInactivePackupStartTimeEpoch() <= static_cast(::time(nullptr))); } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsClientEffect.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsClientEffect.cpp index 28cb48e9..b3af259f 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsClientEffect.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsClientEffect.cpp @@ -91,7 +91,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEventObj(JNIEnv * { JavaStringParam localEventType(eventType); - ServerObject* so = NULL; + ServerObject* so = nullptr; if(!JavaLibrary::getObject(client, so)) return JNI_FALSE; Client* c = so->getClient(); @@ -100,7 +100,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEventObj(JNIEnv * if (!objectToPlayEventOn) return JNI_FALSE; - ServerObject* target = NULL; + ServerObject* target = nullptr; if(!JavaLibrary::getObject(objectToPlayEventOn, target)) return JNI_FALSE; if(!target) @@ -114,7 +114,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEventObj(JNIEnv * //get the hardpoint std::string hp; - if (NULL != jHardpoint) + if (nullptr != jHardpoint) { JavaStringParam localHardpoint(jHardpoint); JavaLibrary::convert(localHardpoint, hp); @@ -122,7 +122,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEventObj(JNIEnv * //get the transform Transform transform; - if (NULL != jTransform) + if (nullptr != jTransform) { ScriptConversion::convert(jTransform, transform); } @@ -158,7 +158,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEventObjLimited(J if (!objectToPlayEventOn) return JNI_FALSE; - ServerObject* target = NULL; + ServerObject* target = nullptr; if(!JavaLibrary::getObject(objectToPlayEventOn, target)) return JNI_FALSE; if(!target) @@ -172,7 +172,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEventObjLimited(J //get the hardpoint std::string hp; - if (NULL != jHardpoint) + if (nullptr != jHardpoint) { JavaStringParam localHardpoint(jHardpoint); JavaLibrary::convert(localHardpoint, hp); @@ -180,7 +180,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEventObjLimited(J //get the transform Transform transform; - if (NULL != jTransform) + if (nullptr != jTransform) { ScriptConversion::convert(jTransform, transform); } @@ -210,7 +210,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEventLoc(JNIEnv * JavaStringParam localEventSourceType(eventSourceType); JavaStringParam localEventDestType(eventDestType); - ServerObject* so = NULL; + ServerObject* so = nullptr; if(!JavaLibrary::getObject(client, so)) return JNI_FALSE; Client* c = so->getClient(); @@ -281,7 +281,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEffectObj(JNIEnv { JavaStringParam localEffectName(effectName); - ServerObject* so = NULL; + ServerObject* so = nullptr; if(!JavaLibrary::getObject(objectToPlayEffectOn, so)) return JNI_FALSE; /* TPERRY - This isn't used @@ -293,7 +293,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEffectObj(JNIEnv if (!objectToPlayEffectOn) return JNI_FALSE; - ServerObject* target = NULL; + ServerObject* target = nullptr; if(!JavaLibrary::getObject(objectToPlayEffectOn, target)) return JNI_FALSE; if(!target) @@ -307,7 +307,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEffectObj(JNIEnv //get the hardpoint std::string hp; - if (NULL != jHardpoint) + if (nullptr != jHardpoint) { JavaStringParam localHardpoint(jHardpoint); JavaLibrary::convert(localHardpoint, hp); @@ -315,14 +315,14 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEffectObj(JNIEnv //get the transform Transform transform; - if (NULL != jTransform) + if (nullptr != jTransform) { ScriptConversion::convert(jTransform, transform); } //get the optional labelName std::string strLabelName; - if (NULL != labelName) + if (nullptr != labelName) { JavaStringParam localLabel(labelName); JavaLibrary::convert(localLabel, strLabelName); @@ -360,7 +360,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEffectObjLimited( if (!objectToPlayEffectOn) return JNI_FALSE; - ServerObject* target = NULL; + ServerObject* target = nullptr; if(!JavaLibrary::getObject(objectToPlayEffectOn, target)) return JNI_FALSE; if(!target) @@ -374,7 +374,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEffectObjLimited( //get the hardpoint std::string hp; - if (NULL != jHardpoint) + if (nullptr != jHardpoint) { JavaStringParam localHardpoint(jHardpoint); JavaLibrary::convert(localHardpoint, hp); @@ -382,14 +382,14 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEffectObjLimited( //get the transform Transform transform; - if (NULL != jTransform) + if (nullptr != jTransform) { ScriptConversion::convert(jTransform, transform); } //get the optional labelName std::string strLabelName; - if (NULL != labelName) + if (nullptr != labelName) { JavaStringParam localLabel(labelName); JavaLibrary::convert(localLabel, strLabelName); @@ -419,7 +419,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEffectLoc(JNIEnv { JavaStringParam localEffectName(effectName); - ServerObject* so = NULL; + ServerObject* so = nullptr; if(!JavaLibrary::getObject(client, so)) return JNI_FALSE; @@ -444,7 +444,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEffectLoc(JNIEnv //get the optional labelName std::string strLabelName; - if (NULL != labelName) + if (nullptr != labelName) { JavaStringParam localLabel(labelName); JavaLibrary::convert(localLabel, strLabelName); @@ -482,7 +482,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEffectLocLimited( //get the optional labelName std::string strLabelName; - if (NULL != labelName) + if (nullptr != labelName) { JavaStringParam localLabel(labelName); JavaLibrary::convert(localLabel, strLabelName); @@ -501,7 +501,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playUiEffect(JNIEnv * /*env { JavaStringParam localUiEffectString(uiEffectString); - ServerObject* so = NULL; + ServerObject* so = nullptr; if(!JavaLibrary::getObject(client, so)) { NetworkId const networkId(client); @@ -531,7 +531,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::stopClientEffectObjByLabel( { JavaStringParam localLabel(labelName); - ServerObject* so = NULL; + ServerObject* so = nullptr; if(!JavaLibrary::getObject(objectEffectIsOn, so)) return JNI_FALSE; @@ -545,7 +545,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::stopClientEffectObjByLabel( if (!objectEffectIsOn) return JNI_FALSE; - ServerObject* target = NULL; + ServerObject* target = nullptr; if(!JavaLibrary::getObject(objectEffectIsOn, target)) return JNI_FALSE; if(!target) @@ -578,7 +578,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::stopClientEffectObjByLabelL if (!objectEffectIsOn) return JNI_FALSE; - ServerObject* target = NULL; + ServerObject* target = nullptr; if(!JavaLibrary::getObject(objectEffectIsOn, target)) return JNI_FALSE; if(!target) @@ -604,7 +604,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::play2dNonLoopingMusic(JNIEn { JavaStringParam localMusicName(musicName); - ServerObject* so = NULL; + ServerObject* so = nullptr; if (!JavaLibrary::getObject(client, so)) return JNI_FALSE; Client* c = so->getClient(); @@ -628,7 +628,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::play2dNonLoopingSound(JNIEn { JavaStringParam localMusicName(musicName); - ServerObject* so = NULL; + ServerObject* so = nullptr; if (!JavaLibrary::getObject(client, so)) return JNI_FALSE; Client* c = so->getClient(); @@ -652,7 +652,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playMusicWithParms(JNIEnv * { JavaStringParam localMusicName(musicName); - ServerObject* so = NULL; + ServerObject* so = nullptr; if (!JavaLibrary::getObject(client, so)) return JNI_FALSE; Client* c = so->getClient(); @@ -676,7 +676,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::createClientProjectile(JNIE { JavaStringParam localWeaponObjectTemplateName(weaponObjectTemplateName); - ServerObject* so = NULL; + ServerObject* so = nullptr; if (!JavaLibrary::getObject(client, so)) return JNI_FALSE; @@ -718,7 +718,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::createClientProjectileObjec { JavaStringParam localWeaponObjectTemplateName(weaponObjectTemplateName); - ServerObject* so = NULL; + ServerObject* so = nullptr; if (!JavaLibrary::getObject(client, so)) return JNI_FALSE; @@ -734,14 +734,14 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::createClientProjectileObjec return JNI_FALSE; // Get our source object - ServerObject* sourceObject = NULL; + ServerObject* sourceObject = nullptr; if (!JavaLibrary::getObject(source, sourceObject)) return JNI_FALSE; NetworkId sourceId = sourceObject->getNetworkId(); // The target of our effect - ServerObject* targetObject = NULL; + ServerObject* targetObject = nullptr; if (!JavaLibrary::getObject(target, targetObject)) return JNI_FALSE; @@ -759,8 +759,8 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::createClientProjectileObjec // Source's Cell ID CellProperty const * const cellProperty = sourceObject->getParentCell(); - Object const * const cellObject = (cellProperty != NULL) ? &cellProperty->getOwner() : NULL; - NetworkId const & networkIdForCellOrWorld = (cellObject != NULL) ? cellObject->getNetworkId() : NetworkId::cms_invalid; + Object const * const cellObject = (cellProperty != nullptr) ? &cellProperty->getOwner() : nullptr; + NetworkId const & networkIdForCellOrWorld = (cellObject != nullptr) ? cellObject->getNetworkId() : NetworkId::cms_invalid; CreateClientProjectileObjectToObjectMessage const ccpmoto(weaponObjectTemplateNameString, sourceId, sourceHardpointString, networkIdForCellOrWorld, targetId, targetHardpointString, speed, expiration, trail, PackedArgb(static_cast(a), static_cast(r), static_cast(g), static_cast(b)).getArgb()); @@ -776,7 +776,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::createClientProjectileObje { JavaStringParam localWeaponObjectTemplateName(weaponObjectTemplateName); - ServerObject* so = NULL; + ServerObject* so = nullptr; if (!JavaLibrary::getObject(client, so)) return JNI_FALSE; @@ -792,7 +792,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::createClientProjectileObje return JNI_FALSE; // Get our source object - ServerObject* sourceObject = NULL; + ServerObject* sourceObject = nullptr; if (!JavaLibrary::getObject(source, sourceObject)) return JNI_FALSE; @@ -812,8 +812,8 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::createClientProjectileObje // Source's Cell ID CellProperty const * const cellProperty = sourceObject->getParentCell(); - Object const * const cellObject = (cellProperty != NULL) ? &cellProperty->getOwner() : NULL; - NetworkId const & networkIdForCellOrWorld = (cellObject != NULL) ? cellObject->getNetworkId() : NetworkId::cms_invalid; + Object const * const cellObject = (cellProperty != nullptr) ? &cellProperty->getOwner() : nullptr; + NetworkId const & networkIdForCellOrWorld = (cellObject != nullptr) ? cellObject->getNetworkId() : NetworkId::cms_invalid; CreateClientProjectileObjectToLocationMessage const ccpmotl(weaponObjectTemplateNameString, sourceId, sourceHardpointString, networkIdForCellOrWorld, targetLocationVec, speed, expiration, trail, PackedArgb(static_cast(a), static_cast(r), static_cast(g), static_cast(b)).getArgb()); @@ -829,7 +829,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::createClientProjectileLocat { JavaStringParam localWeaponObjectTemplateName(weaponObjectTemplateName); - ServerObject* so = NULL; + ServerObject* so = nullptr; if (!JavaLibrary::getObject(client, so)) return JNI_FALSE; @@ -845,7 +845,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::createClientProjectileLocat return JNI_FALSE; // Get our target object - ServerObject* targetObject = NULL; + ServerObject* targetObject = nullptr; if (!JavaLibrary::getObject(target, targetObject)) return JNI_FALSE; @@ -865,8 +865,8 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::createClientProjectileLocat // Target's Cell ID CellProperty const * const cellProperty = targetObject->getParentCell(); - Object const * const cellObject = (cellProperty != NULL) ? &cellProperty->getOwner() : NULL; - NetworkId const & networkIdForCellOrWorld = (cellObject != NULL) ? cellObject->getNetworkId() : NetworkId::cms_invalid; + Object const * const cellObject = (cellProperty != nullptr) ? &cellProperty->getOwner() : nullptr; + NetworkId const & networkIdForCellOrWorld = (cellObject != nullptr) ? cellObject->getNetworkId() : NetworkId::cms_invalid; CreateClientProjectileLocationToObjectMessage const ccpmlto(weaponObjectTemplateNameString, sourceLocationVec, networkIdForCellOrWorld, targetId, targetHardpointString, speed, expiration, trail, PackedArgb(static_cast(a), static_cast(r), static_cast(g), static_cast(b)).getArgb()); @@ -878,7 +878,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::createClientProjectileLocat void JNICALL ScriptMethodsClientEffectNamespace::addObjectEffect(JNIEnv * env, jobject self, jlong obj, jstring filename, jstring hardpoint, jobject offset, jfloat scale, jstring label) { - ServerObject* so = NULL; + ServerObject* so = nullptr; if (!JavaLibrary::getObject(obj, so)) return; @@ -909,7 +909,7 @@ void JNICALL ScriptMethodsClientEffectNamespace::addObjectEffect(JNIEnv * env, j } void JNICALL ScriptMethodsClientEffectNamespace::removeObjectEffect(JNIEnv * env, jobject self, jlong obj, jstring label) { - ServerObject* so = NULL; + ServerObject* so = nullptr; if (!JavaLibrary::getObject(obj, so)) return; @@ -929,7 +929,7 @@ void JNICALL ScriptMethodsClientEffectNamespace::removeObjectEffect(JNIEnv * env void JNICALL ScriptMethodsClientEffectNamespace::removeAllObjectEffects(JNIEnv * env, jobject self, jlong obj) { - ServerObject* so = NULL; + ServerObject* so = nullptr; if (!JavaLibrary::getObject(obj, so)) return; @@ -942,7 +942,7 @@ void JNICALL ScriptMethodsClientEffectNamespace::removeAllObjectEffects(JNIEnv * jboolean JNICALL ScriptMethodsClientEffectNamespace::hasObjectEffect(JNIEnv * env, jobject self, jlong obj, jstring label) { - ServerObject* so = NULL; + ServerObject* so = nullptr; if (!JavaLibrary::getObject(obj, so)) return JNI_FALSE; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsClusterWideData.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsClusterWideData.cpp index 19df09ef..a93b72ae 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsClusterWideData.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsClusterWideData.cpp @@ -69,7 +69,7 @@ const JNINativeMethod NATIVES[] = { */ LocalRefPtr JavaLibrary::convert(const ValueDictionary & source) { - if (ms_env == NULL) + if (ms_env == nullptr) return LocalRef::cms_nullPtr; // create the dictionary @@ -150,7 +150,7 @@ void JavaLibrary::convert(const jobject & source, ValueDictionary & target) target.clear(); JNIEnv * env = getEnv(); - if (env == NULL) + if (env == nullptr) return; if (!env->IsInstanceOf(source, ms_clsDictionary)) diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsCombat.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsCombat.cpp index a12763bb..fdb842bc 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsCombat.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsCombat.cpp @@ -211,12 +211,12 @@ const JNINativeMethod NATIVES[] = { void JavaLibrary::setupWeaponCombatData(JNIEnv *env, const WeaponObject * weapon, jobject weaponData) { - if (env == NULL || weaponData == NULL) + if (env == nullptr || weaponData == nullptr) return; - if (weapon == NULL) + if (weapon == nullptr) { - env->SetObjectField(weaponData, ms_fidCombatEngineWeaponDataId, NULL); + env->SetObjectField(weaponData, ms_fidCombatEngineWeaponDataId, nullptr); return; } @@ -252,7 +252,7 @@ jint JNICALL ScriptMethodsCombatNamespace::getCombatDuration(JNIEnv * /*env*/, j NetworkId const networkId(object); TangibleObject const * const tangibleObject = TangibleObject::getTangibleObject(networkId); - if (tangibleObject == NULL) + if (tangibleObject == nullptr) { return 0; } @@ -267,7 +267,7 @@ jint JNICALL ScriptMethodsCombatNamespace::getCombatDuration(JNIEnv * /*env*/, j * @param self class calling this function * @param target id of the creature * - * @return the object id of the weapon, or NULL on error + * @return the object id of the weapon, or nullptr on error */ jlong JNICALL ScriptMethodsCombatNamespace::getCurrentWeapon(JNIEnv *env, jobject self, jlong target) { @@ -278,7 +278,7 @@ jlong JNICALL ScriptMethodsCombatNamespace::getCurrentWeapon(JNIEnv *env, jobjec return 0; const WeaponObject * weapon = creature->getCurrentWeapon(); - if (weapon == NULL) + if (weapon == nullptr) return 0; return (weapon->getNetworkId()).getValue(); @@ -313,7 +313,7 @@ jboolean JNICALL ScriptMethodsCombatNamespace::setCurrentWeapon(JNIEnv *env, job * @param self class calling this function * @param target id of the creature * - * @return the object id of the weapon, or NULL on error + * @return the object id of the weapon, or nullptr on error */ jlong JNICALL ScriptMethodsCombatNamespace::getHeldWeapon(JNIEnv *env, jobject self, jlong target) { @@ -324,7 +324,7 @@ jlong JNICALL ScriptMethodsCombatNamespace::getHeldWeapon(JNIEnv *env, jobject s return 0; const WeaponObject * weapon = creature->getReadiedWeapon(); - if (weapon == NULL) + if (weapon == nullptr) return 0; return (weapon->getNetworkId()).getValue(); @@ -337,7 +337,7 @@ jlong JNICALL ScriptMethodsCombatNamespace::getHeldWeapon(JNIEnv *env, jobject s * @param self class calling this function * @param target id of the creature * - * @return the object id of the default weapon, or NULL on error + * @return the object id of the default weapon, or nullptr on error */ jlong JNICALL ScriptMethodsCombatNamespace::getDefaultWeapon(JNIEnv *env, jobject self, jlong target) { @@ -348,7 +348,7 @@ UNREF(self); return 0; const WeaponObject * weapon = creature->getDefaultWeapon(); - if (weapon == NULL) + if (weapon == nullptr) return 0; return (weapon->getNetworkId()).getValue(); @@ -422,7 +422,7 @@ jboolean JNICALL ScriptMethodsCombatNamespace::isDefaultWeapon(JNIEnv *env, jobj return JNI_FALSE; const CreatureObject * owner = dynamic_cast(ContainerInterface::getContainedByObject(*weapon)); - if (owner == NULL || owner->getDefaultWeapon() != weapon) + if (owner == nullptr || owner->getDefaultWeapon() != weapon) return JNI_FALSE; return JNI_TRUE; @@ -441,7 +441,7 @@ jfloat JNICALL ScriptMethodsCombatNamespace::getMinRange(JNIEnv *env, jobject se { UNREF(self); - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return -1.0f; @@ -462,7 +462,7 @@ jfloat JNICALL ScriptMethodsCombatNamespace::getMaxRange(JNIEnv *env, jobject se { UNREF(self); - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return -1.0f; @@ -483,7 +483,7 @@ jfloat JNICALL ScriptMethodsCombatNamespace::getAverageDamage(JNIEnv *env, jobje { UNREF(self); - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return 0; @@ -506,7 +506,7 @@ jint JNICALL ScriptMethodsCombatNamespace::getWeaponType(JNIEnv *env, jobject se { UNREF(self); - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return -1; @@ -527,7 +527,7 @@ jint JNICALL ScriptMethodsCombatNamespace::getWeaponAttackType(JNIEnv *env, jobj { UNREF(self); - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return -1; @@ -546,7 +546,7 @@ jint JNICALL ScriptMethodsCombatNamespace::getWeaponDamageType(JNIEnv *env, jobj { UNREF(self); - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return -1; @@ -590,7 +590,7 @@ jint JNICALL ScriptMethodsCombatNamespace::getWeaponMinDamage(JNIEnv *env, jobje { UNREF(self); - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return -1; @@ -636,7 +636,7 @@ jint JNICALL ScriptMethodsCombatNamespace::getWeaponMaxDamage(JNIEnv *env, jobje { UNREF(self); - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return -1; @@ -682,7 +682,7 @@ jfloat JNICALL ScriptMethodsCombatNamespace::getWeaponAttackSpeed(JNIEnv *env, j { UNREF(self); - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return -1.0f; @@ -728,7 +728,7 @@ jfloat JNICALL ScriptMethodsCombatNamespace::getWeaponWoundChance(JNIEnv *env, j { UNREF(self); - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return -1.0f; @@ -743,13 +743,13 @@ jfloat JNICALL ScriptMethodsCombatNamespace::getWeaponWoundChance(JNIEnv *env, j * @param self class calling this function * @param weaponId the id of the weapon * - * @return the range info, or null on error + * @return the range info, or nullptr on error */ jobject JNICALL ScriptMethodsCombatNamespace::getWeaponRangeInfo(JNIEnv *env, jobject self, jlong weaponId) { UNREF(self); - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return 0; @@ -827,7 +827,7 @@ jfloat JNICALL ScriptMethodsCombatNamespace::getWeaponDamageRadius(JNIEnv *env, { UNREF(self); - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return -1.0f; @@ -865,7 +865,7 @@ jboolean JNICALL ScriptMethodsCombatNamespace::setWeaponDamageRadius(JNIEnv *env */ jfloat JNICALL ScriptMethodsCombatNamespace::getAudibleRange(JNIEnv *env, jobject self, jlong weaponId) { - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return -1; @@ -887,7 +887,7 @@ jint JNICALL ScriptMethodsCombatNamespace::getWeaponAttackCost(JNIEnv *env, jobj { UNREF(self); - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return 0; @@ -932,7 +932,7 @@ jint JNICALL ScriptMethodsCombatNamespace::getWeaponAccuracy(JNIEnv *env, jobjec { UNREF(self); - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return 0; @@ -977,7 +977,7 @@ jint JNICALL ScriptMethodsCombatNamespace::getWeaponElementalType(JNIEnv *env, j { UNREF(self); - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return 0; @@ -1022,7 +1022,7 @@ jint JNICALL ScriptMethodsCombatNamespace::getWeaponElementalValue(JNIEnv *env, { UNREF(self); - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return 0; @@ -1218,7 +1218,7 @@ void _startCombat(char const * const functionName, jlong attacker, jlong defende NetworkId const attackerId(attacker); TangibleObject * const attackerTangibleObject = TangibleObject::getTangibleObject(attackerId); - if (attackerTangibleObject == NULL) + if (attackerTangibleObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsCombat::%s() Unable to resolve the attacker(%s) to a TangibleObject.", functionName, attackerId.getValueString().c_str())); return; @@ -1227,7 +1227,7 @@ void _startCombat(char const * const functionName, jlong attacker, jlong defende NetworkId const defenderId(defender); TangibleObject * const defenderTangibleObject = TangibleObject::getTangibleObject(defenderId); - if (defenderTangibleObject == NULL) + if (defenderTangibleObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsCombat::%s() attacker(%s) Unable to resolve the defender(%s) to a TangibleObject.", functionName, attackerId.getValueString().c_str(), defenderId.getValueString().c_str())); return; @@ -1302,7 +1302,7 @@ void JNICALL ScriptMethodsCombatNamespace::stopCombat(JNIEnv * /*env*/, jobject NetworkId const objectId(object); TangibleObject * const tangibleObject = TangibleObject::getTangibleObject(objectId); - if (tangibleObject == NULL) + if (tangibleObject == nullptr) { return; } @@ -1334,9 +1334,9 @@ int i; int attackerCount = 0; int defenderCount = 0; - if (attackers != NULL) + if (attackers != nullptr) attackerCount = env->GetArrayLength(attackers); - if (defenders != NULL) + if (defenders != nullptr) defenderCount = env->GetArrayLength(defenders); // get the attacker and weapon data @@ -1348,22 +1348,22 @@ int i; LocalRefPtr weaponData = getObjectArrayElement(LocalObjectArrayRefParam(weaponsData), i); if (!attackerId) { - WARNING(true, ("JavaLibrary::getCombatData got null attacker id")); + WARNING(true, ("JavaLibrary::getCombatData got nullptr attacker id")); return JNI_FALSE; } if (attackerData == LocalRef::cms_nullPtr) { - WARNING(true, ("JavaLibrary::getCombatData got null attacker data")); + WARNING(true, ("JavaLibrary::getCombatData got nullptr attacker data")); return JNI_FALSE; } if (weaponData == LocalRef::cms_nullPtr) { - WARNING(true, ("JavaLibrary::getCombatData got null weapon data")); + WARNING(true, ("JavaLibrary::getCombatData got nullptr weapon data")); return JNI_FALSE; } // set up the attacker data - const TangibleObject * attacker = NULL; + const TangibleObject * attacker = nullptr; if (!JavaLibrary::getObject(attackerId, attacker)) { WARNING(true, ("JavaLibrary::getCombatData cannot get attacker object")); @@ -1377,7 +1377,7 @@ int i; ScriptConversion::convert(attacker->getPosition_p(), attacker->getSceneId(), attackerCell ? attackerCell->getNetworkId() : NetworkId::cms_invalid, location); - if (location.get() == NULL || location == LocalRef::cms_nullPtr) + if (location.get() == nullptr || location == LocalRef::cms_nullPtr) { WARNING(true, ("JavaLibrary::getCombatData cannot convert local position " "of attacker %s to Java", attacker->getNetworkId().getValueString().c_str())); @@ -1390,7 +1390,7 @@ int i; ScriptConversion::convert(attacker->getPosition_w(), attacker->getSceneId(), CellProperty::getWorldCellProperty()->getOwner().getNetworkId(), worldLocation); - if (worldLocation.get() == NULL || worldLocation == LocalRef::cms_nullPtr) + if (worldLocation.get() == nullptr || worldLocation == LocalRef::cms_nullPtr) { WARNING(true, ("JavaLibrary::getCombatData cannot convert world position " "of attacker %s to Java", attacker->getNetworkId().getValueString().c_str())); @@ -1398,14 +1398,14 @@ int i; } } - const WeaponObject * weapon = NULL; + const WeaponObject * weapon = nullptr; bool isCreature = false; int posture = 0; int locomotion = 0; int weaponSkill = 0; int aims = 0; const CreatureObject * creature = dynamic_cast(attacker); - if (creature != NULL) + if (creature != nullptr) { isCreature = true; posture = creature->getPosture(); @@ -1419,7 +1419,7 @@ int i; CombatEngineData::CombatData const * combatData = attacker->getCombatData(); - if (combatData != NULL) + if (combatData != nullptr) { aims = combatData->attackData.aims; } @@ -1446,17 +1446,17 @@ int i; LocalRefPtr defenderData = getObjectArrayElement(LocalObjectArrayRefParam(defendersData), i); if (!defenderId) { - WARNING(true, ("JavaLibrary::getCombatData got null defender id")); + WARNING(true, ("JavaLibrary::getCombatData got nullptr defender id")); return JNI_FALSE; } if (defenderData == LocalRef::cms_nullPtr) { - WARNING(true, ("JavaLibrary::getCombatData got null defender data")); + WARNING(true, ("JavaLibrary::getCombatData got nullptr defender data")); return JNI_FALSE; } // set up the defender data - const TangibleObject * defender = NULL; + const TangibleObject * defender = nullptr; if (!JavaLibrary::getObject(defenderId, defender)) { WARNING(true, ("JavaLibrary::getCombatData cannot get defender object")); @@ -1470,7 +1470,7 @@ int i; ScriptConversion::convert(defender->getPosition_p(), defender->getSceneId(), defenderCell ? defenderCell->getNetworkId() : NetworkId::cms_invalid, location); - if (location.get() == NULL || location == LocalRef::cms_nullPtr) + if (location.get() == nullptr || location == LocalRef::cms_nullPtr) { WARNING(true, ("JavaLibrary::getCombatData cannot convert local position " "of defender %s to Java", defender->getNetworkId().getValueString().c_str())); @@ -1483,7 +1483,7 @@ int i; ScriptConversion::convert(defender->getPosition_w(), defender->getSceneId(), CellProperty::getWorldCellProperty()->getOwner().getNetworkId(), worldLocation); - if (worldLocation.get() == NULL || worldLocation == LocalRef::cms_nullPtr) + if (worldLocation.get() == nullptr || worldLocation == LocalRef::cms_nullPtr) { WARNING(true, ("JavaLibrary::getCombatData cannot convert world position " "of defender %s to Java", defender->getNetworkId().getValueString().c_str())); @@ -1497,7 +1497,7 @@ int i; int combatSkeleton = defender->getCombatSkeleton(); int cover = 0; const CreatureObject * creature = dynamic_cast(defender); - if (creature != NULL) + if (creature != nullptr) { isCreature = true; posture = creature->getPosture(); @@ -1557,7 +1557,7 @@ jboolean JNICALL ScriptMethodsCombatNamespace::getWeaponData(JNIEnv *env, jobjec if (weapon == 0 || weaponData == 0) return JNI_FALSE; - const WeaponObject * localWeapon = NULL; + const WeaponObject * localWeapon = nullptr; if (!JavaLibrary::getObject(weapon, localWeapon)) return JNI_FALSE; @@ -1587,15 +1587,15 @@ jboolean JNICALL ScriptMethodsCombatNamespace::doDamage(JNIEnv *env, jobject sel if (damage <= 0) return JNI_TRUE; - TangibleObject * attacker = NULL; + TangibleObject * attacker = nullptr; if (!JavaLibrary::getObject(attackerId, attacker)) return JNI_FALSE; - TangibleObject * defender = NULL; + TangibleObject * defender = nullptr; if (!JavaLibrary::getObject(defenderId, defender)) return JNI_FALSE; - WeaponObject * weapon = NULL; + WeaponObject * weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return JNI_FALSE; @@ -1627,11 +1627,11 @@ jboolean JNICALL ScriptMethodsCombatNamespace::doDamageNoWeapon(JNIEnv *env, job if (damage <= 0) return JNI_TRUE; - TangibleObject * attacker = NULL; + TangibleObject * attacker = nullptr; if (!JavaLibrary::getObject(attackerId, attacker)) return JNI_FALSE; - TangibleObject * defender = NULL; + TangibleObject * defender = nullptr; if (!JavaLibrary::getObject(defenderId, defender)) return JNI_FALSE; @@ -1699,7 +1699,7 @@ jboolean JNICALL ScriptMethodsCombatNamespace::doCombatResults(JNIEnv *env, jobj { message->setAttacker(attacker, weapon); CreatureObject * creature = dynamic_cast(attacker.getObject()); - if (creature != NULL) + if (creature != nullptr) { Postures::Enumerator posture = static_cast( env->GetIntField(attackerResult, JavaLibrary::getFidBaseClassAttackerResultsPosture())); @@ -1816,7 +1816,7 @@ jboolean JNICALL ScriptMethodsCombatNamespace::doCombatResults(JNIEnv *env, jobj // send the message Controller *const controller = attacker.getObject()->getController(); - if (controller != NULL) + if (controller != nullptr) { float f_hold_ms = ConfigServerGame::getCombatDamageDelaySeconds() * 1000.0f; if ( f_hold_ms < 1.0 ) // 0 hold time (allowing for rounding error) @@ -1834,7 +1834,7 @@ jboolean JNICALL ScriptMethodsCombatNamespace::doCombatResults(JNIEnv *env, jobj { MessageQueueCombatAction *held = (MessageQueueCombatAction*)controller->peekHeldMessage( CM_combatAction ); bool b_merge = true; - if ( held == NULL ) + if ( held == nullptr ) b_merge = false; else if ( held->getComparisonChecksum() != message->getComparisonChecksum() ) b_merge = false; @@ -1900,24 +1900,24 @@ jboolean JNICALL ScriptMethodsCombatNamespace::callDefenderCombatAction(JNIEnv * { // use the attacker's current weapon CreatureObject * creatureAttacker = dynamic_cast(attackerId.getObject()); - if (creatureAttacker != NULL) + if (creatureAttacker != nullptr) { const WeaponObject * weaponObject = creatureAttacker->getCurrentWeapon(); - if (weaponObject != NULL) + if (weaponObject != nullptr) weaponId = weaponObject->getNetworkId(); } else { const WeaponObject * weaponAttacker = dynamic_cast( attackerId.getObject()); - if (weaponAttacker != NULL) + if (weaponAttacker != nullptr) weaponId = weaponAttacker->getNetworkId(); } } // call the trigger for each defender - jint * resultsArray = env->GetIntArrayElements(results, NULL); - if (resultsArray == NULL) + jint * resultsArray = env->GetIntArrayElements(results, nullptr); + if (resultsArray == nullptr) return JNI_FALSE; for (jsize i = 0; i < defenderCount; ++i) @@ -1927,11 +1927,11 @@ jboolean JNICALL ScriptMethodsCombatNamespace::callDefenderCombatAction(JNIEnv * if (defender) { CachedNetworkId defenderId(defender); - if (defenderId.getObject() != NULL) + if (defenderId.getObject() != nullptr) { ServerObject * defenderObject = safe_cast( defenderId.getObject()); - if (defenderObject->getScriptObject() != NULL) + if (defenderObject->getScriptObject() != nullptr) { ScriptParams params; params.addParam(attackerId); @@ -1961,7 +1961,7 @@ jboolean JNICALL ScriptMethodsCombatNamespace::callDefenderCombatAction(JNIEnv * */ void JNICALL ScriptMethodsCombatNamespace::setWantSawAttackTriggers(JNIEnv *env, jobject self, jlong obj, jboolean enable) { - TangibleObject * tangible = NULL; + TangibleObject * tangible = nullptr; if (!JavaLibrary::getObject(obj, tangible)) { @@ -2021,7 +2021,7 @@ jboolean JNICALL ScriptMethodsCombatNamespace::addSlowDownEffect(JNIEnv *env, jo return JNI_FALSE; } - CreatureObject * attackerObject = NULL; + CreatureObject * attackerObject = nullptr; if (!JavaLibrary::getObject(attacker, attackerObject)) { WARNING(true, ("[script bug] JavaLibrary::addSlowDownEffect called " @@ -2029,7 +2029,7 @@ jboolean JNICALL ScriptMethodsCombatNamespace::addSlowDownEffect(JNIEnv *env, jo return JNI_FALSE; } - const TangibleObject * defenderObject = NULL; + const TangibleObject * defenderObject = nullptr; if (!JavaLibrary::getObject(defender, defenderObject)) { WARNING(true, ("[script bug] JavaLibrary::addSlowDownEffect called " @@ -2057,7 +2057,7 @@ jboolean JNICALL ScriptMethodsCombatNamespace::addSlowDownEffect(JNIEnv *env, jo */ jboolean JNICALL ScriptMethodsCombatNamespace::removeSlowDownEffect(JNIEnv *env, jobject self, jlong attacker) { - CreatureObject * attackerObject = NULL; + CreatureObject * attackerObject = nullptr; if (!JavaLibrary::getObject(attacker, attackerObject)) { WARNING(true, ("[script bug] JavaLibrary::removeSlowDownEffect called " @@ -2090,14 +2090,14 @@ void JNICALL ScriptMethodsCombatNamespace::sendCombatSpam(JNIEnv *env, jobject s { NetworkId attackerId(attacker); ServerObject * attackerObj = safe_cast(NetworkIdManager::getObjectById(attackerId)); - if (attackerObj == NULL) + if (attackerObj == nullptr) { WARNING(true, ("WARNING: JavaLibrary::sendCombatSpam could not find attacker for id %s", attackerId.getValueString().c_str())); return; } NetworkId defenderId(defender); - Object const * const defenderObj = (defenderId.isValid() ? NetworkIdManager::getObjectById(defenderId) : NULL); + Object const * const defenderObj = (defenderId.isValid() ? NetworkIdManager::getObjectById(defenderId) : nullptr); NetworkId weaponId(weapon); StringId attackNameSid; @@ -2189,14 +2189,14 @@ void JNICALL ScriptMethodsCombatNamespace::sendCombatSpamWeaponString(JNIEnv *en { NetworkId attackerId(attacker); ServerObject * attackerObj = safe_cast(NetworkIdManager::getObjectById(attackerId)); - if (attackerObj == NULL) + if (attackerObj == nullptr) { WARNING(true, ("WARNING: JavaLibrary::sendCombatSpam could not find attacker for id %s", attackerId.getValueString().c_str())); return; } NetworkId defenderId(defender); - Object const * const defenderObj = (defenderId.isValid() ? NetworkIdManager::getObjectById(defenderId) : NULL); + Object const * const defenderObj = (defenderId.isValid() ? NetworkIdManager::getObjectById(defenderId) : nullptr); StringId weaponNameSid; if (!ScriptConversion::convert(weaponName, weaponNameSid)) @@ -2287,12 +2287,12 @@ void JNICALL ScriptMethodsCombatNamespace::sendCombatSpamWeaponString(JNIEnv *en */ void JNICALL ScriptMethodsCombatNamespace::sendCombatSpamMessage(JNIEnv *env, jobject self, jlong attacker, jlong defender, jobject message, jboolean sendToAttacker, jboolean sendToDefender, jboolean sendToBystanders, jint spamType) { - ServerObject * attackerObj = NULL; + ServerObject * attackerObj = nullptr; if (!JavaLibrary::getObject(attacker, attackerObj)) return; NetworkId defenderId(defender); - Object const * const defenderObj = (defenderId.isValid() ? NetworkIdManager::getObjectById(defenderId) : NULL); + Object const * const defenderObj = (defenderId.isValid() ? NetworkIdManager::getObjectById(defenderId) : nullptr); StringId messageSid; if (!ScriptConversion::convert(message, messageSid)) @@ -2322,12 +2322,12 @@ void JNICALL ScriptMethodsCombatNamespace::sendCombatSpamMessage(JNIEnv *env, jo */ void JNICALL ScriptMethodsCombatNamespace::sendCombatSpamMessageCGP(JNIEnv *env, jobject self, jlong attacker, jlong defender, jobject message, jboolean sendToAttacker, jboolean sendToDefender, jboolean sendToBystanders, jboolean critical, jboolean glancing, jboolean proc, jint spamType) { - ServerObject * attackerObj = NULL; + ServerObject * attackerObj = nullptr; if (!JavaLibrary::getObject(attacker, attackerObj)) return; NetworkId defenderId(defender); - Object const * const defenderObj = (defenderId.isValid() ? NetworkIdManager::getObjectById(defenderId) : NULL); + Object const * const defenderObj = (defenderId.isValid() ? NetworkIdManager::getObjectById(defenderId) : nullptr); StringId messageSid; if (!ScriptConversion::convert(message, messageSid)) @@ -2353,12 +2353,12 @@ void JNICALL ScriptMethodsCombatNamespace::sendCombatSpamMessageCGP(JNIEnv *env, */ void JNICALL ScriptMethodsCombatNamespace::sendCombatSpamMessageOob(JNIEnv *env, jobject self, jlong attacker, jlong defender, jstring oob, jboolean sendToAttacker, jboolean sendToDefender, jboolean sendToBystanders, jint spamType) { - ServerObject * attackerObj = NULL; + ServerObject * attackerObj = nullptr; if (!JavaLibrary::getObject(attacker, attackerObj)) return; NetworkId defenderId(defender); - Object const * const defenderObj = (defenderId.isValid() ? NetworkIdManager::getObjectById(defenderId) : NULL); + Object const * const defenderObj = (defenderId.isValid() ? NetworkIdManager::getObjectById(defenderId) : nullptr); Unicode::String oobString; if (!JavaLibrary::convert(JavaStringParam(oob), oobString)) diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsCommandQueue.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsCommandQueue.cpp index 2e400a0b..c95a74cb 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsCommandQueue.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsCommandQueue.cpp @@ -97,7 +97,7 @@ jboolean JNICALL ScriptMethodsCommandQueueNamespace::queueCommand(JNIEnv *env, j NetworkId actorId(actor); TangibleObject * const actorTangibleObject = TangibleObject::getTangibleObject(actorId); - if (actorTangibleObject == NULL) + if (actorTangibleObject == nullptr) { WARNING(true, ("JavaLibrary::queueCommand() Unable to resolve actor(%s) to a TangibleObject", actorId.getValueString().c_str())); return JNI_FALSE; @@ -142,7 +142,7 @@ jboolean JNICALL ScriptMethodsCommandQueueNamespace::queueClear(JNIEnv *env, job NetworkId actorId(actor); TangibleObject * const actorTangibleObject = TangibleObject::getTangibleObject(actorId); - if (actorTangibleObject == NULL) + if (actorTangibleObject == nullptr) { WARNING(true, ("JavaLibrary::queueClear() Unable to resolve actor(%s) to a TangibleObject", actorId.getValueString().c_str())); return JNI_FALSE; @@ -170,7 +170,7 @@ jboolean JNICALL ScriptMethodsCommandQueueNamespace::queueHasCommandFromGroup(JN NetworkId actorId(actor); TangibleObject * const actorTangibleObject = TangibleObject::getTangibleObject(actorId); - if (actorTangibleObject == NULL) + if (actorTangibleObject == nullptr) { WARNING(true, ("JavaLibrary::queueHasCommandFromGroup() Unable to resolve actor(%s) to a TangibleObject", actorId.getValueString().c_str())); return JNI_FALSE; @@ -196,7 +196,7 @@ jboolean JNICALL ScriptMethodsCommandQueueNamespace::queueClearCommandsFromGroup NetworkId actorId(actor); TangibleObject * const actorTangibleObject = TangibleObject::getTangibleObject(actorId); - if (actorTangibleObject == NULL) + if (actorTangibleObject == nullptr) { WARNING(true, ("JavaLibrary::queueClearCommandsFromGroup() Unable to resolve actor(%s) to a TangibleObject", actorId.getValueString().c_str())); return JNI_FALSE; @@ -239,14 +239,14 @@ jboolean JNICALL ScriptMethodsCommandQueueNamespace::setCommandTimerValue( JNIEn NetworkId actorId(actor); TangibleObject * const actorTangibleObject = TangibleObject::getTangibleObject(actorId); - if (actorTangibleObject == NULL) + if (actorTangibleObject == nullptr) { WARNING(true, ("JavaLibrary::setCommandTimerValue() Unable to resolve actor(%s) to a TangibleObject", actorId.getValueString().c_str())); return JNI_FALSE; } CommandQueue * const queue = actorTangibleObject->getCommandQueue(); - if (queue == NULL) + if (queue == nullptr) { WARNING(true, ("JavaLibrary::setCommandTimerValue() object(%s) does not have a CommandQueue", actorTangibleObject->getDebugInformation().c_str())); return JNI_FALSE; @@ -267,7 +267,7 @@ jint JNICALL ScriptMethodsCommandQueueNamespace::getCurrentCommand( JNIEnv *env, NetworkId actorId(actor); TangibleObject * const actorTangibleObject = TangibleObject::getTangibleObject(actorId); - if (actorTangibleObject == NULL) + if (actorTangibleObject == nullptr) { WARNING(true, ("JavaLibrary::getCurrentCommand() Unable to resolve actor(%s) to a TangibleObject", actorId.getValueString().c_str())); return 0; @@ -275,7 +275,7 @@ jint JNICALL ScriptMethodsCommandQueueNamespace::getCurrentCommand( JNIEnv *env, CommandQueue const * const queue = actorTangibleObject->getCommandQueue(); - if (queue == NULL) + if (queue == nullptr) { WARNING(true, ("JavaLibrary::getCurrentCommand() object(%s) does not have a CommandQueue", actorTangibleObject->getDebugInformation().c_str())); return 0; @@ -298,7 +298,7 @@ jfloat JNICALL ScriptMethodsCommandQueueNamespace::getCooldownTimeLeft( JNIEnv * NetworkId actorId(actor); TangibleObject * const actorTangibleObject = TangibleObject::getTangibleObject(actorId); - if (actorTangibleObject == NULL) + if (actorTangibleObject == nullptr) { WARNING(true, ("JavaLibrary::getCooldownTimeLeft() Unable to resolve actor(%s) to a TangibleObject", actorId.getValueString().c_str())); return 0.0f; @@ -306,7 +306,7 @@ jfloat JNICALL ScriptMethodsCommandQueueNamespace::getCooldownTimeLeft( JNIEnv * CommandQueue const * const queue = actorTangibleObject->getCommandQueue(); - if (queue == NULL) + if (queue == nullptr) { WARNING(true, ("JavaLibrary::getCooldownTimeLeft() object(%s) does not have a CommandQueue", actorTangibleObject->getDebugInformation().c_str())); return 0.0f; @@ -329,7 +329,7 @@ jfloat JNICALL ScriptMethodsCommandQueueNamespace::getCooldownTimeLeftString( JN NetworkId actorId(actor); TangibleObject * const actorTangibleObject = TangibleObject::getTangibleObject(actorId); - if (actorTangibleObject == NULL) + if (actorTangibleObject == nullptr) { WARNING(true, ("JavaLibrary::getCooldownTimeLeftString() Unable to resolve actor(%s) to a TangibleObject", actorId.getValueString().c_str())); return 0.0f; @@ -347,13 +347,13 @@ jfloat JNICALL ScriptMethodsCommandQueueNamespace::getCooldownTimeLeftString( JN CommandQueue const * const queue = actorTangibleObject->getCommandQueue(); float value = 0.0f; - if (queue == NULL) + if (queue == nullptr) { WARNING(true, ("JavaLibrary::getCooldownTimeLeftString() object(%s) does not have a CommandQueue", actorTangibleObject->getDebugInformation().c_str())); return 0.0f; } - if (queue != NULL) + if (queue != nullptr) { value = queue->getCooldownTimeLeft( out ); } @@ -369,7 +369,7 @@ void JNICALL ScriptMethodsCommandQueueNamespace::sendCooldownGroupTimingOnly(JNI NetworkId actorId(actor); CreatureObject * const actorCreatureObject = CreatureObject::getCreatureObject(actorId); - if (actorCreatureObject == NULL) + if (actorCreatureObject == nullptr) { WARNING(true, ("JavaLibrary::sendCooldownGroupTimingOnly() Unable to resolve actor(%s) to a CreatureObject", actorId.getValueString().c_str())); return; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsConsole.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsConsole.cpp index 9392677f..0355fb72 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsConsole.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsConsole.cpp @@ -52,10 +52,10 @@ void JNICALL ScriptMethodsConsoleNamespace::consoleSendMessageObjId(JNIEnv * env const ServerObject* player = 0; if(!JavaLibrary::getObject(_to, player)) { - DEBUG_WARNING (true, ("ScriptMethodsConsole JavaLibrary::consoleSendMessageObjId failed bad source object (not null)")); + DEBUG_WARNING (true, ("ScriptMethodsConsole JavaLibrary::consoleSendMessageObjId failed bad source object (not nullptr)")); if (ConfigServerScript::allowDebugConsoleMessages()) { - fprintf(stderr, "WARNING: ScriptMethodsConsole JavaLibrary::consoleSendMessageObjId: failed bad source object (not null)\n"); + fprintf(stderr, "WARNING: ScriptMethodsConsole JavaLibrary::consoleSendMessageObjId: failed bad source object (not nullptr)\n"); JavaLibrary::printJavaStack(); } return; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsContainers.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsContainers.cpp index 12a63612..acb9aba9 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsContainers.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsContainers.cpp @@ -136,7 +136,7 @@ const JNINativeMethod NATIVES[] = { jint JNICALL ScriptMethodsContainersNamespace::getContainerType(JNIEnv *env, jobject self, jlong container) { //@todo use enum - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) return 0; @@ -151,7 +151,7 @@ jint JNICALL ScriptMethodsContainersNamespace::getContainerType(JNIEnv *env, job jlongArray JNICALL ScriptMethodsContainersNamespace::getContents(JNIEnv *env, jobject self, jlong containerObj) { - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(containerObj, containerOwner)) return 0; @@ -190,7 +190,7 @@ jlongArray JNICALL ScriptMethodsContainersNamespace::getContents(JNIEnv *env, jo jlong JNICALL ScriptMethodsContainersNamespace::getContainedBy(JNIEnv *env, jobject self, jlong item) { - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(item, itemObj)) return 0; @@ -211,7 +211,7 @@ jboolean JNICALL ScriptMethodsContainersNamespace::contains(JNIEnv *env, jobject if (container_id.getValue() == 0) return JNI_FALSE; - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(item, itemObj)) return JNI_FALSE; @@ -226,11 +226,11 @@ jboolean JNICALL ScriptMethodsContainersNamespace::contains(JNIEnv *env, jobject jint JNICALL ScriptMethodsContainersNamespace::canPutIn(JNIEnv *env, jobject self, jlong target, jlong jcontainer) { const int unknownError = static_cast(Container::CEC_Unknown); - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(jcontainer, containerOwner)) return unknownError; - ServerObject * item = NULL; + ServerObject * item = nullptr; if (!JavaLibrary::getObject(target, item)) return unknownError; @@ -248,11 +248,11 @@ jint JNICALL ScriptMethodsContainersNamespace::canPutIn(JNIEnv *env, jobject sel jint JNICALL ScriptMethodsContainersNamespace::canPutInSlot(JNIEnv *env, jobject self, jlong target, jlong jcontainer, jstring slot) { const int unknownError = static_cast(Container::CEC_Unknown); - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(jcontainer, containerOwner)) return unknownError; - ServerObject * item = NULL; + ServerObject * item = nullptr; if (!JavaLibrary::getObject(target, item)) return unknownError; @@ -268,7 +268,7 @@ jint JNICALL ScriptMethodsContainersNamespace::canPutInSlot(JNIEnv *env, jobject if (slotId == SlotId::invalid) return static_cast(Container::CEC_NoSlot); - IGNORE_RETURN(ContainerInterface::canTransferToSlot(*containerOwner, *item, slotId, NULL, tmp)); + IGNORE_RETURN(ContainerInterface::canTransferToSlot(*containerOwner, *item, slotId, nullptr, tmp)); return static_cast(tmp); } @@ -279,7 +279,7 @@ jlong JNICALL ScriptMethodsContainersNamespace::getObjectInSlot(JNIEnv *env, job { JavaStringParam localSlot(slot); - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) return 0; @@ -301,7 +301,7 @@ jlong JNICALL ScriptMethodsContainersNamespace::getObjectInSlot(JNIEnv *env, job jlong JNICALL ScriptMethodsContainersNamespace::getFirstParentInWorld(JNIEnv *env, jobject self, jlong item) { - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(item, itemObj)) return 0; @@ -316,7 +316,7 @@ jlong JNICALL ScriptMethodsContainersNamespace::getFirstParentInWorld(JNIEnv *en jlong JNICALL ScriptMethodsContainersNamespace::getTopMostContainer(JNIEnv *env, jobject self, jlong item) { - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(item, itemObj)) return 0; @@ -331,7 +331,7 @@ jlong JNICALL ScriptMethodsContainersNamespace::getTopMostContainer(JNIEnv *env, jint JNICALL ScriptMethodsContainersNamespace::getNumItemsIn(JNIEnv *env, jobject self, jlong container) { - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) return 0; @@ -347,7 +347,7 @@ jint JNICALL ScriptMethodsContainersNamespace::getNumItemsIn(JNIEnv *env, jobjec void JNICALL ScriptMethodsContainersNamespace::destroyContents(JNIEnv *env, jobject self, jlong container) { #if 0 //@todo implement - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) return; @@ -359,11 +359,11 @@ void JNICALL ScriptMethodsContainersNamespace::destroyContents(JNIEnv *env, jobj jint JNICALL ScriptMethodsContainersNamespace::moveContents(JNIEnv *env, jobject self, jlong containerA, jlong containerB) { - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(containerA, containerOwner)) return 0; - ServerObject * targetContainer = NULL; + ServerObject * targetContainer = nullptr; if (!JavaLibrary::getObject(containerB, targetContainer)) return 0; @@ -377,7 +377,7 @@ jint JNICALL ScriptMethodsContainersNamespace::moveContents(JNIEnv *env, jobject for (; iter != container->end(); ++iter) { ServerObject* item = safe_cast((*iter).getObject()); - if (item && ContainerInterface::transferItemToGeneralContainer(*targetContainer, *item, NULL, tmp)) + if (item && ContainerInterface::transferItemToGeneralContainer(*targetContainer, *item, nullptr, tmp)) { ++count; } @@ -389,20 +389,20 @@ jint JNICALL ScriptMethodsContainersNamespace::moveContents(JNIEnv *env, jobject jint JNICALL ScriptMethodsContainersNamespace::moveObjects(JNIEnv *env, jobject self, jlongArray targets, jlong container) { - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) return 0; int count = 0; for (int i = 0; i < env->GetArrayLength(targets); ++i) { - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; jlong jlongTmp; env->GetLongArrayRegion(targets, i, 1, &jlongTmp); if (JavaLibrary::getObject(jlongTmp, itemObj)) { Container::ContainerErrorCode tmp = Container::CEC_Success; - if (ContainerInterface::transferItemToGeneralContainer(*containerOwner, *itemObj, NULL, tmp)) + if (ContainerInterface::transferItemToGeneralContainer(*containerOwner, *itemObj, nullptr, tmp)) { ++count; } @@ -417,15 +417,15 @@ jint JNICALL ScriptMethodsContainersNamespace::moveObjects(JNIEnv *env, jobject jboolean JNICALL ScriptMethodsContainersNamespace::putIn(JNIEnv *env, jobject self, jlong item, jlong container) { - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) return JNI_FALSE; - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(item, itemObj)) return JNI_FALSE; Container::ContainerErrorCode tmp = Container::CEC_Success; - return ContainerInterface::transferItemToGeneralContainer(*containerOwner, *itemObj, NULL, tmp); + return ContainerInterface::transferItemToGeneralContainer(*containerOwner, *itemObj, nullptr, tmp); } @@ -434,11 +434,11 @@ jboolean JNICALL ScriptMethodsContainersNamespace::putIn(JNIEnv *env, jobject se jboolean JNICALL ScriptMethodsContainersNamespace::putInPosition(JNIEnv *env, jobject self, jlong item, jlong container, jobject pos) { - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) return JNI_FALSE; - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(item, itemObj)) return JNI_FALSE; @@ -451,7 +451,7 @@ jboolean JNICALL ScriptMethodsContainersNamespace::putInPosition(JNIEnv *env, jo tr.setPosition_p(newPos); Container::ContainerErrorCode tmp = Container::CEC_Success; - return ContainerInterface::transferItemToCell(*containerOwner, *itemObj, tr, NULL, tmp); + return ContainerInterface::transferItemToCell(*containerOwner, *itemObj, tr, nullptr, tmp); } //-------------------------------------------------------------------------------------- @@ -459,20 +459,20 @@ jboolean JNICALL ScriptMethodsContainersNamespace::putInPosition(JNIEnv *env, jo jboolean JNICALL ScriptMethodsContainersNamespace::putInAndSendError(JNIEnv *env, jobject self, jlong item, jlong container, jlong player) { - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) return JNI_FALSE; - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(item, itemObj)) return JNI_FALSE; Container::ContainerErrorCode tmp = Container::CEC_Success; - bool retval = ContainerInterface::transferItemToGeneralContainer(*containerOwner, *itemObj, NULL, tmp); + bool retval = ContainerInterface::transferItemToGeneralContainer(*containerOwner, *itemObj, nullptr, tmp); if (!retval) { - ServerObject * playerObj = NULL; + ServerObject * playerObj = nullptr; if (!JavaLibrary::getObject(player, playerObj)) return JNI_FALSE; ContainerInterface::sendContainerMessageToClient(*playerObj, tmp); @@ -483,11 +483,11 @@ jboolean JNICALL ScriptMethodsContainersNamespace::putInAndSendError(JNIEnv *env //-------------------------------------------------------------------------------------- jboolean JNICALL ScriptMethodsContainersNamespace::putInOverloaded(JNIEnv *env, jobject self, jlong item, jlong container) { - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) return JNI_FALSE; - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(item, itemObj)) return JNI_FALSE; @@ -500,7 +500,7 @@ jboolean JNICALL ScriptMethodsContainersNamespace::putInOverloaded(JNIEnv *env, } else { - retval = ContainerInterface::transferItemToVolumeContainer(*containerOwner, *itemObj, NULL, tmp, true); + retval = ContainerInterface::transferItemToVolumeContainer(*containerOwner, *itemObj, nullptr, tmp, true); } return retval; @@ -509,11 +509,11 @@ jboolean JNICALL ScriptMethodsContainersNamespace::putInOverloaded(JNIEnv *env, //-------------------------------------------------------------------------------------- jboolean JNICALL ScriptMethodsContainersNamespace::equip(JNIEnv *env, jobject self, jlong item, jlong container) { - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) return JNI_FALSE; - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(item, itemObj)) return JNI_FALSE; @@ -521,7 +521,7 @@ jboolean JNICALL ScriptMethodsContainersNamespace::equip(JNIEnv *env, jobject se if (!test) return JNI_FALSE; Container::ContainerErrorCode tmp = Container::CEC_Success; - return ContainerInterface::transferItemToGeneralContainer(*containerOwner, *itemObj, NULL, tmp); + return ContainerInterface::transferItemToGeneralContainer(*containerOwner, *itemObj, nullptr, tmp); } @@ -532,11 +532,11 @@ jboolean JNICALL ScriptMethodsContainersNamespace::equipIn(JNIEnv *env, jobject JavaStringParam localSlot(slot); //@todo better error checking for invalid slot name. Do it above too. - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) return JNI_FALSE; - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(item, itemObj)) return JNI_FALSE; @@ -554,7 +554,7 @@ jboolean JNICALL ScriptMethodsContainersNamespace::equipIn(JNIEnv *env, jobject Container::ContainerErrorCode tmp = Container::CEC_Success; int arrangement = slotted ? slotted->getBestArrangementForSlot(slotName) : -1; - return ContainerInterface::transferItemToSlottedContainer(*containerOwner, *itemObj, arrangement, NULL, tmp); + return ContainerInterface::transferItemToSlottedContainer(*containerOwner, *itemObj, arrangement, nullptr, tmp); } @@ -565,14 +565,14 @@ jboolean JNICALL ScriptMethodsContainersNamespace::equipOverride(JNIEnv *env, j //This function will equip and object into the first valid arrangement, deleting objects if necessary. //Before it deletes things, it looks for a valid unoccupied arrangement. - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) { DEBUG_WARNING(true, ("JNI: EquipOverride param container could not be found")); return JNI_FALSE; } - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(item, itemObj)) { DEBUG_WARNING(true, ("JNI: EquipOverride param item could not be found")); @@ -592,7 +592,7 @@ jboolean JNICALL ScriptMethodsContainersNamespace::equipOverride(JNIEnv *env, j if (slotContainer->getFirstUnoccupiedArrangement(*itemObj, arrangement, tmp)) { //Found one - return ContainerInterface::transferItemToSlottedContainer(*containerOwner, *itemObj, arrangement, NULL, tmp); + return ContainerInterface::transferItemToSlottedContainer(*containerOwner, *itemObj, arrangement, nullptr, tmp); } //Couldn't find an unoccupied arrangement, so it's time to delete objects to make room for this one @@ -634,14 +634,14 @@ jboolean JNICALL ScriptMethodsContainersNamespace::equipOverride(JNIEnv *env, j } } - return ContainerInterface::transferItemToSlottedContainer(*containerOwner, *itemObj, arrangement, NULL, tmp); + return ContainerInterface::transferItemToSlottedContainer(*containerOwner, *itemObj, arrangement, nullptr, tmp); } //-------------------------------------------------------------------------------------- jint JNICALL ScriptMethodsContainersNamespace::getFilledVolume(JNIEnv *env, jobject self, jlong container) { - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) return 0; @@ -656,7 +656,7 @@ jint JNICALL ScriptMethodsContainersNamespace::getFilledVolume(JNIEnv *env, jobj jint JNICALL ScriptMethodsContainersNamespace::getTotalVolume(JNIEnv *env, jobject self, jlong container) { - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) return 0; @@ -672,7 +672,7 @@ jint JNICALL ScriptMethodsContainersNamespace::getTotalVolume(JNIEnv *env, jobje jint JNICALL ScriptMethodsContainersNamespace::getVolumeFree(JNIEnv *env, jobject self, jlong container) { - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) return 0; @@ -691,7 +691,7 @@ void JNICALL ScriptMethodsContainersNamespace::sendContainerErrorToClient(JNIEnv if (errorCode == 0) return; - ServerObject * playerObject = NULL; + ServerObject * playerObject = nullptr; if (!JavaLibrary::getObject(player, playerObject)) { DEBUG_WARNING(true, ("Player object not found in sendContainerErrorToClient")); @@ -767,7 +767,7 @@ void JNICALL ScriptMethodsContainersNamespace::moveToOfflinePlayerDatapadAndUnlo jboolean JNICALL ScriptMethodsContainersNamespace::isInSecureTrade(JNIEnv *env, jobject self, jlong item) { - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(item, itemObj)) return JNI_FALSE; @@ -807,7 +807,7 @@ void JNICALL ScriptMethodsContainersNamespace::fixLoadWith(JNIEnv *env, jobject jboolean JNICALL ScriptMethodsContainersNamespace::addUserToAccessList(JNIEnv *env, jobject self, jlong object, jlong user) { - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(object, itemObj)) return JNI_FALSE; @@ -829,7 +829,7 @@ jboolean JNICALL ScriptMethodsContainersNamespace::addUserToAccessList(JNIEnv *e jboolean JNICALL ScriptMethodsContainersNamespace::removeUserFromAccessList(JNIEnv * env, jobject self, jlong object, jlong user) { - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(object, itemObj)) return JNI_FALSE; @@ -851,7 +851,7 @@ jboolean JNICALL ScriptMethodsContainersNamespace::removeUserFromAccessList(JNIE jboolean JNICALL ScriptMethodsContainersNamespace::clearUserAccessList(JNIEnv * env, jobject self, jlong object) { - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(object, itemObj)) return JNI_FALSE; @@ -871,7 +871,7 @@ jboolean JNICALL ScriptMethodsContainersNamespace::clearUserAccessList(JNIEnv * jboolean JNICALL ScriptMethodsContainersNamespace::addGuildToAccessList(JNIEnv *env, jobject self, jlong object, jint guild) { - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(object, itemObj)) return JNI_FALSE; @@ -891,7 +891,7 @@ jboolean JNICALL ScriptMethodsContainersNamespace::addGuildToAccessList(JNIEnv * jboolean JNICALL ScriptMethodsContainersNamespace::removeGuildFromAccessList(JNIEnv * env, jobject self, jlong object, jint guild) { - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(object, itemObj)) return JNI_FALSE; @@ -911,7 +911,7 @@ jboolean JNICALL ScriptMethodsContainersNamespace::removeGuildFromAccessList(JNI jboolean JNICALL ScriptMethodsContainersNamespace::clearGuildAccessList(JNIEnv * env, jobject self, jlong object) { - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(object, itemObj)) return JNI_FALSE; @@ -931,7 +931,7 @@ jboolean JNICALL ScriptMethodsContainersNamespace::clearGuildAccessList(JNIEnv * jlongArray JNICALL ScriptMethodsContainersNamespace::getUserAccessList(JNIEnv * env, jobject self, jlong object) { - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(object, itemObj)) return JNI_FALSE; @@ -970,7 +970,7 @@ jlongArray JNICALL ScriptMethodsContainersNamespace::getUserAccessList(JNIEnv * jintArray JNICALL ScriptMethodsContainersNamespace::getGuildAccessList(JNIEnv * env, jobject self, jlong object) { - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(object, itemObj)) return JNI_FALSE; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsCrafting.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsCrafting.cpp index b5d325eb..735a0d23 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsCrafting.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsCrafting.cpp @@ -232,7 +232,7 @@ void ScriptMethodsCraftingNamespace::collectRangedIntVariableCallback(const std: * @param draftSchematic draft schematic the attribute belongs to * @param attribIndex index of the attribute * - * @return the attribute instance, or NULL on error + * @return the attribute instance, or nullptr on error */ LocalRefPtr JavaLibrary::createObjectAttribute(const ManufactureObjectInterface & manfSchematic, const DraftSchematicObject & draftSchematic, int attribIndex) @@ -291,7 +291,7 @@ LocalRefPtr JavaLibrary::createObjectAttribute(const ManufactureObjectInterface * @param manfSchematic manufacture schematic the attribute belongs to * @param attribName name of the attribute * - * @return the attribute instance, or NULL on error + * @return the attribute instance, or nullptr on error */ LocalRefPtr JavaLibrary::createExperimentAttribute(const ManufactureObjectInterface & manfSchematic, const StringId & attribName) @@ -341,7 +341,7 @@ int i; const DraftSchematicObject * draft = DraftSchematicObject::getSchematic( source.getDraftSchematic()); - if (draft == NULL) + if (draft == nullptr) return LocalRef::cms_nullPtr; LocalRefPtr target = allocObject(ms_clsDraftSchematic); @@ -501,7 +501,7 @@ int i; // set the customization info from the shared object template const ServerObjectTemplate * objectTemplate = draft->getCraftedObjectTemplate(); - if (objectTemplate == NULL) + if (objectTemplate == nullptr) { return LocalRef::cms_nullPtr; } @@ -509,7 +509,7 @@ int i; ObjectTemplateList::fetch(objectTemplate->getSharedTemplate())); const SharedTangibleObjectTemplate * sharedTangibleTemplate = dynamic_cast< const SharedTangibleObjectTemplate *>(sharedTemplate); - if (sharedTangibleTemplate != NULL) + if (sharedTangibleTemplate != nullptr) { // New method using the AssetCustomizationManager mechanism. @@ -818,9 +818,9 @@ int i; // set the created item template crc value const ServerObjectTemplate * craftedTemplate = source.getCraftedObjectTemplate(); - if (craftedTemplate == NULL) + if (craftedTemplate == nullptr) { - WARNING(true, ("JavaLibrary::convert DraftSchematicObject got null crafted " + WARNING(true, ("JavaLibrary::convert DraftSchematicObject got nullptr crafted " "template for draft schematic %s", source.getObjectTemplateName())); return 0; } @@ -830,7 +830,7 @@ int i; const ServerDraftSchematicObjectTemplate * const sourceSchematicTemplate = safe_cast(source.getObjectTemplate()); NOT_NULL(sourceSchematicTemplate); - if (sourceSchematicTemplate == NULL) + if (sourceSchematicTemplate == nullptr) { // emergency case for release mode return 0; @@ -873,11 +873,11 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::startCraftingSession(JNIEnv *en UNREF(env); UNREF(self); - CreatureObject* playerObj = NULL; + CreatureObject* playerObj = nullptr; if (!JavaLibrary::getObject(player, playerObj)) return JNI_FALSE; - TangibleObject* stationObj = NULL; + TangibleObject* stationObj = nullptr; if (!JavaLibrary::getObject(station, stationObj)) return JNI_FALSE; @@ -894,7 +894,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::startCraftingSession(JNIEnv *en * @param self class calling this function * @param crafter the player that was crafting * @param tool the crafting tool that was being used - * @param prototype the prototype that was created (may be null) + * @param prototype the prototype that was created (may be nullptr) * * @return true on success, false on fail */ @@ -908,11 +908,11 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::endCraftingSession(JNIEnv *env, if (prototype == 0) return JNI_TRUE; - CreatureObject * crafterObj = NULL; + CreatureObject * crafterObj = nullptr; if (!JavaLibrary::getObject(crafter, crafterObj)) return JNI_FALSE; - TangibleObject * prototypeObj = NULL; + TangibleObject * prototypeObj = nullptr; if (!JavaLibrary::getObject(prototype, prototypeObj)) return JNI_FALSE; @@ -937,11 +937,11 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setCraftingLevelAndStation(JNIE { UNREF(self); - CreatureObject* creatureObject = NULL; + CreatureObject* creatureObject = nullptr; if (!JavaLibrary::getObject(player, creatureObject)) return JNI_FALSE; PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(creatureObject); - if (playerObject == NULL) + if (playerObject == nullptr) return JNI_FALSE; if (craftingLevel >= 0 && craftingLevel <= Crafting::MAX_CRAFTING_LEVEL) @@ -949,12 +949,12 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setCraftingLevelAndStation(JNIE if (station != 0) { - const TangibleObject * stationObject = NULL; + const TangibleObject * stationObject = nullptr; const NetworkId stationId(station); if (stationId != NetworkId::cms_invalid) { stationObject = dynamic_cast(ServerWorld::findObjectByNetworkId(stationId)); - if (stationObject == NULL) + if (stationObject == nullptr) return JNI_FALSE; } playerObject->setCraftingStation(stationObject); @@ -976,11 +976,11 @@ jint JNICALL ScriptMethodsCraftingNamespace::getCraftingLevel(JNIEnv *env, jobje { UNREF(self); - const CreatureObject* creatureObject = NULL; + const CreatureObject* creatureObject = nullptr; if (!JavaLibrary::getObject(player, creatureObject)) return -1; const PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(creatureObject); - if (playerObject == NULL) + if (playerObject == nullptr) return -1; return playerObject->getCraftingLevel(); @@ -999,11 +999,11 @@ jlong JNICALL ScriptMethodsCraftingNamespace::getCraftingStation(JNIEnv *env, jo { UNREF(self); - const CreatureObject* creatureObject = NULL; + const CreatureObject* creatureObject = nullptr; if (!JavaLibrary::getObject(player, creatureObject)) return 0; const PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(creatureObject); - if (playerObject == NULL) + if (playerObject == nullptr) return 0; return (playerObject->getCraftingStation()).getValue(); @@ -1023,11 +1023,11 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::sendUseableDraftSchematics(JNIE { UNREF(self); - CreatureObject* creatureObject = NULL; + CreatureObject* creatureObject = nullptr; if (!JavaLibrary::getObject(player, creatureObject)) return JNI_FALSE; PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(creatureObject); - if (playerObject == NULL) + if (playerObject == nullptr) { DEBUG_WARNING(true, ("JavaLibrary::sendUseableDraftSchematics non-player " "object %s\n", creatureObject->getNetworkId().getValueString().c_str())); @@ -1038,8 +1038,8 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::sendUseableDraftSchematics(JNIE if (count == 0) return JNI_FALSE; - jint * schematicsArray = env->GetIntArrayElements(schematics, NULL); - if (schematicsArray != NULL) + jint * schematicsArray = env->GetIntArrayElements(schematics, nullptr); + if (schematicsArray != nullptr) { std::vector schematicCrcs(schematicsArray, &schematicsArray[count]); playerObject->sendUseableDraftSchematics(schematicCrcs); @@ -1072,7 +1072,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSchematicAttribute(JNIEnv *e if (manufacturingSchematic == 0 || attribute == 0) return JNI_FALSE; - ManufactureObjectInterface * schematic = NULL; + ManufactureObjectInterface * schematic = nullptr; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return JNI_FALSE; @@ -1120,7 +1120,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSchematicAttributes(JNIEnv * if (manufacturingSchematic == 0 || attributes == 0) return JNI_FALSE; - ManufactureObjectInterface * schematic = NULL; + ManufactureObjectInterface * schematic = nullptr; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return JNI_FALSE; @@ -1169,7 +1169,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSchematicAttributes(JNIEnv * * @param name name of the attribute to get * @param experiment flag that these are experimental attributes * - * @return the attribute, or null on error + * @return the attribute, or nullptr on error */ jobject JNICALL ScriptMethodsCraftingNamespace::getSchematicAttribute(JNIEnv *env, jobject self, jlong manufacturingSchematic, jobject name, jboolean experiment) { @@ -1178,13 +1178,13 @@ jobject JNICALL ScriptMethodsCraftingNamespace::getSchematicAttribute(JNIEnv *en if (manufacturingSchematic == 0 || name == 0) return 0; - ManufactureObjectInterface * schematic = NULL; + ManufactureObjectInterface * schematic = nullptr; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return 0; const DraftSchematicObject * draft = DraftSchematicObject::getSchematic( schematic->getDraftSchematic()); - if (draft == NULL) + if (draft == nullptr) return 0; StringId nameId; @@ -1210,7 +1210,7 @@ jobject JNICALL ScriptMethodsCraftingNamespace::getSchematicAttribute(JNIEnv *en * @param names names of the attributes to get * @param experiment flag that these are experimental attributes * - * @return the attributes, or null on error + * @return the attributes, or nullptr on error */ jobjectArray JNICALL ScriptMethodsCraftingNamespace::getSchematicAttributes(JNIEnv *env, jobject self, jlong manufacturingSchematic, jobjectArray names, jboolean experiment) { @@ -1219,13 +1219,13 @@ jobjectArray JNICALL ScriptMethodsCraftingNamespace::getSchematicAttributes(JNIE if (manufacturingSchematic == 0) return 0; - ManufactureObjectInterface * schematic = NULL; + ManufactureObjectInterface * schematic = nullptr; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return 0; const DraftSchematicObject * draft = DraftSchematicObject::getSchematic( schematic->getDraftSchematic()); - if (draft == NULL) + if (draft == nullptr) return 0; int numAttribs = env->GetArrayLength(names); @@ -1276,7 +1276,7 @@ jobjectArray JNICALL ScriptMethodsCraftingNamespace::getSchematicAttributes(JNIE * @param manufacturingSchematic the schematic * @param experiment flag that these are experimental attributes * - * @return the attributes, or null on error + * @return the attributes, or nullptr on error */ jobjectArray JNICALL ScriptMethodsCraftingNamespace::getAllSchematicAttributes(JNIEnv *env, jobject self, jlong manufacturingSchematic, jboolean experiment) { @@ -1286,13 +1286,13 @@ jobjectArray JNICALL ScriptMethodsCraftingNamespace::getAllSchematicAttributes(J if (manufacturingSchematic == 0) return 0; - ManufactureObjectInterface * schematic = NULL; + ManufactureObjectInterface * schematic = nullptr; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return 0; const DraftSchematicObject * draft = DraftSchematicObject::getSchematic( schematic->getDraftSchematic()); - if (draft == NULL) + if (draft == nullptr) return 0; // set the attributes @@ -1337,7 +1337,7 @@ jobjectArray JNICALL ScriptMethodsCraftingNamespace::getAllSchematicAttributes(J * @param manufacturingSchematic the schematic to get the data from * @param attributeNames the experimental attributes we're interested about * - * @return the draft_schematic object, or null on error + * @return the draft_schematic object, or nullptr on error */ jobject JNICALL ScriptMethodsCraftingNamespace::getSchematicForExperimentalAttributes(JNIEnv *env, jobject self, jlong manufacturingSchematic, jobjectArray attributeNames) { @@ -1348,13 +1348,13 @@ int i; if (manufacturingSchematic == 0 || attributeNames == 0) return 0; - const ManufactureObjectInterface * manfSchematic = NULL; + const ManufactureObjectInterface * manfSchematic = nullptr; if (!JavaLibrary::getObject(manufacturingSchematic, manfSchematic)) return 0; const DraftSchematicObject * draftSchematic = DraftSchematicObject::getSchematic( manfSchematic->getDraftSchematic()); - if (draftSchematic == NULL) + if (draftSchematic == nullptr) return 0; // create a draft_schematic object to return @@ -1481,7 +1481,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSchematicExperimentMod(JNIEn { UNREF(self); - ManufactureSchematicObject * schematic = NULL; + ManufactureSchematicObject * schematic = nullptr; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return JNI_FALSE; @@ -1510,7 +1510,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSchematicAppearances(JNIEnv if (manufacturingSchematic == 0 || appearances == 0) return JNI_FALSE; - ManufactureSchematicObject * schematic = NULL; + ManufactureSchematicObject * schematic = nullptr; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return JNI_FALSE; @@ -1550,7 +1550,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSchematicCustomizations(JNIE if (manufacturingSchematic == 0 || customizations == 0) return JNI_FALSE; - ManufactureSchematicObject * schematic = NULL; + ManufactureSchematicObject * schematic = nullptr; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return JNI_FALSE; @@ -1596,7 +1596,7 @@ jint JNICALL ScriptMethodsCraftingNamespace::getSchematicItemCount(JNIEnv *env, if (manufacturingSchematic == 0) return -1; - const ManufactureSchematicObject * schematic = NULL; + const ManufactureSchematicObject * schematic = nullptr; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return -1; @@ -1622,7 +1622,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSchematicItemCount(JNIEnv *e if (manufacturingSchematic == 0) return JNI_FALSE; - ManufactureSchematicObject * schematic = NULL; + ManufactureSchematicObject * schematic = nullptr; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return JNI_FALSE; @@ -1649,7 +1649,7 @@ jint JNICALL ScriptMethodsCraftingNamespace::getSchematicItemsPerContainer(JNIEn if (manufacturingSchematic == 0) return -1; - const ManufactureSchematicObject * schematic = NULL; + const ManufactureSchematicObject * schematic = nullptr; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return -1; @@ -1676,7 +1676,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSchematicItemsPerContainer(J if (manufacturingSchematic == 0) return JNI_FALSE; - ManufactureSchematicObject * schematic = NULL; + ManufactureSchematicObject * schematic = nullptr; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return JNI_FALSE; @@ -1703,7 +1703,7 @@ jfloat JNICALL ScriptMethodsCraftingNamespace::getSchematicManufactureTime(JNIEn if (manufacturingSchematic == 0) return -1.0f; - const ManufactureSchematicObject * schematic = NULL; + const ManufactureSchematicObject * schematic = nullptr; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return -1.0f; @@ -1730,7 +1730,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSchematicManufactureTime(JNI if (manufacturingSchematic == 0) return JNI_FALSE; - ManufactureSchematicObject * schematic = NULL; + ManufactureSchematicObject * schematic = nullptr; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return JNI_FALSE; @@ -1754,7 +1754,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setCreatorXp(JNIEnv *env, jobje { UNREF(self); - TangibleObject * target = NULL; + TangibleObject * target = nullptr; if (!JavaLibrary::getObject(object, target)) return JNI_FALSE; @@ -1778,7 +1778,7 @@ void JNICALL ScriptMethodsCraftingNamespace::getIngredientsForManufactureStation if (station == 0 || ingredients == 0) return; - const ManufactureInstallationObject * manfStation = NULL; + const ManufactureInstallationObject * manfStation = nullptr; if (!JavaLibrary::getObject(station, manfStation)) return; @@ -1786,7 +1786,7 @@ void JNICALL ScriptMethodsCraftingNamespace::getIngredientsForManufactureStation return; const ManufactureSchematicObject * const schematic = manfStation->getSchematic(); - if (schematic == NULL) + if (schematic == nullptr) return; static ManufactureSchematicObject::IngredientInfoVector iiv; @@ -1841,7 +1841,7 @@ void JNICALL ScriptMethodsCraftingNamespace::getIngredientsForManufactureStation * @param self class calling this function * @param station the station id * - * @return the hopper id, or null on error + * @return the hopper id, or nullptr on error */ jlong JNICALL ScriptMethodsCraftingNamespace::getManufactureStationInputHopper(JNIEnv *env, jobject self, jlong station) { @@ -1850,12 +1850,12 @@ jlong JNICALL ScriptMethodsCraftingNamespace::getManufactureStationInputHopper(J if (station == 0) return 0; - const ManufactureInstallationObject * manfStation = NULL; + const ManufactureInstallationObject * manfStation = nullptr; if (!JavaLibrary::getObject(station, manfStation)) return 0; ServerObject * hopper = manfStation->getInputHopper(); - if (hopper == NULL) + if (hopper == nullptr) return 0; return (hopper->getNetworkId()).getValue(); @@ -1870,7 +1870,7 @@ jlong JNICALL ScriptMethodsCraftingNamespace::getManufactureStationInputHopper(J * @param self class calling this function * @param station the station id * - * @return the hopper id, or null on error + * @return the hopper id, or nullptr on error */ jlong JNICALL ScriptMethodsCraftingNamespace::getManufactureStationOutputHopper(JNIEnv *env, jobject self, jlong station) { @@ -1879,12 +1879,12 @@ jlong JNICALL ScriptMethodsCraftingNamespace::getManufactureStationOutputHopper( if (station == 0) return 0; - const ManufactureInstallationObject * manfStation = NULL; + const ManufactureInstallationObject * manfStation = nullptr; if (!JavaLibrary::getObject(station, manfStation)) return 0; ServerObject * hopper = manfStation->getOutputHopper(); - if (hopper == NULL) + if (hopper == nullptr) return 0; return (hopper->getNetworkId()).getValue(); @@ -1899,7 +1899,7 @@ jlong JNICALL ScriptMethodsCraftingNamespace::getManufactureStationOutputHopper( * @param self class calling this function * @param station the station id * - * @return a string of the form "*" , or null if the station has no schematic + * @return a string of the form "*" , or nullptr if the station has no schematic */ jstring JNICALL ScriptMethodsCraftingNamespace::getManufactureStationSchematic(JNIEnv *env, jobject self, jlong station) { @@ -1907,12 +1907,12 @@ jstring JNICALL ScriptMethodsCraftingNamespace::getManufactureStationSchematic(J UNREF(self); - const ManufactureInstallationObject * manfStation = NULL; + const ManufactureInstallationObject * manfStation = nullptr; if (!JavaLibrary::getObject(station, manfStation)) return 0; const ManufactureSchematicObject * manfSchematic = manfStation->getSchematic(); - if (manfSchematic == NULL) + if (manfSchematic == nullptr) return 0; return JavaString( @@ -1943,11 +1943,11 @@ void JNICALL ScriptMethodsCraftingNamespace::getValidManufactureSchematicsForSta if (player == 0 || station == 0 || schematics == 0) return; - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature)) return; - const ManufactureInstallationObject * manfStation = NULL; + const ManufactureInstallationObject * manfStation = nullptr; if (!JavaLibrary::getObject(station, manfStation)) return; @@ -1997,11 +1997,11 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::hasValidManufactureSchematicsFo if (player == 0 || station == 0) return JNI_FALSE; - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature)) return JNI_FALSE; - const ManufactureInstallationObject * manfStation = NULL; + const ManufactureInstallationObject * manfStation = nullptr; if (!JavaLibrary::getObject(station, manfStation)) return JNI_FALSE; @@ -2030,24 +2030,24 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::transferManufactureSchematicToP { UNREF(self); - const ManufactureInstallationObject * manfStation = NULL; + const ManufactureInstallationObject * manfStation = nullptr; if (!JavaLibrary::getObject(station, manfStation)) return JNI_FALSE; ManufactureSchematicObject * schematic = manfStation->getSchematic(); - if (schematic == NULL) + if (schematic == nullptr) return JNI_TRUE; - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature)) return JNI_FALSE; ServerObject * datapad = playerCreature->getDatapad(); - if (datapad == NULL) + if (datapad == nullptr) return JNI_FALSE; Container::ContainerErrorCode tmp = Container::CEC_Success; - if (ContainerInterface::transferItemToVolumeContainer(*datapad, *schematic, NULL, tmp)) + if (ContainerInterface::transferItemToVolumeContainer(*datapad, *schematic, nullptr, tmp)) return JNI_TRUE; return JNI_FALSE; } // JavaLibrary::transferManufactureSchematicToPlayer @@ -2068,15 +2068,15 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::transferManufactureSchematicToS { UNREF(self); - ManufactureSchematicObject * manfSchematic = NULL; + ManufactureSchematicObject * manfSchematic = nullptr; if (!JavaLibrary::getObject(schematic, manfSchematic)) return JNI_FALSE; - ManufactureInstallationObject * manfStation = NULL; + ManufactureInstallationObject * manfStation = nullptr; if (!JavaLibrary::getObject(station, manfStation)) return JNI_FALSE; - if (manfStation->addSchematic(*manfSchematic, NULL)) + if (manfStation->addSchematic(*manfSchematic, nullptr)) return JNI_TRUE; return JNI_FALSE; } // JavaLibrary::transferManufactureSchematicToStation @@ -2099,11 +2099,11 @@ void JNICALL ScriptMethodsCraftingNamespace::getRepairableObjectsForTool(JNIEnv if (player == 0 || tool == 0 || objects == 0) return; - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature)) return; - const TangibleObject * toolObject = NULL; + const TangibleObject * toolObject = nullptr; if (!JavaLibrary::getObject(tool, toolObject)) return; if (!toolObject->isRepairTool()) @@ -2123,11 +2123,11 @@ void JNICALL ScriptMethodsCraftingNamespace::getRepairableObjectsForTool(JNIEnv // objects const ServerObject * inventory = playerCreature->getInventory(); - if (inventory == NULL) + if (inventory == nullptr) return; const VolumeContainer * inventoryContainer = ContainerInterface::getVolumeContainer(*inventory); - if (inventoryContainer == NULL) + if (inventoryContainer == nullptr) return; std::vector objList; @@ -2136,7 +2136,7 @@ void JNICALL ScriptMethodsCraftingNamespace::getRepairableObjectsForTool(JNIEnv { const CachedNetworkId & objId = (*iter); const TangibleObject * obj = safe_cast(objId.getObject()); - if (obj != NULL && !obj->isCraftingTool() && !obj->isRepairTool() && + if (obj != nullptr && !obj->isCraftingTool() && !obj->isRepairTool() && obj->getDamageTaken() > 0) { if ((genericTool && (toolType & obj->getGameObjectType()) != 0) || @@ -2172,22 +2172,22 @@ void JNICALL ScriptMethodsCraftingNamespace::getRepairableObjectsForTool(JNIEnv * @param self class calling this function * @param target the object * - * @return an array with the bonus for each attribute, or null on error + * @return an array with the bonus for each attribute, or nullptr on error */ jintArray JNICALL ScriptMethodsCraftingNamespace::getAttributeBonuses(JNIEnv *env, jobject self, jlong target) { UNREF(self); - const ServerObject * object = NULL; + const ServerObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return 0; std::vector > bonuses; - if (object->asTangibleObject() != NULL) + if (object->asTangibleObject() != nullptr) { object->asTangibleObject()->getAttribBonuses(bonuses); } - else if (object->asManufactureSchematicObject() != NULL) + else if (object->asManufactureSchematicObject() != nullptr) { object->asManufactureSchematicObject()->getAttribBonuses(bonuses); } @@ -2235,16 +2235,16 @@ jint JNICALL ScriptMethodsCraftingNamespace::getAttributeBonus(JNIEnv *env, jobj if (attribute < 0 || attribute >= Attributes::NumberOfAttributes) return 0; - const ServerObject * object = NULL; + const ServerObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return 0; jint bonus = 0; - if (object->asTangibleObject() != NULL) + if (object->asTangibleObject() != nullptr) { bonus = object->asTangibleObject()->getAttribBonus(attribute); } - else if (object->asManufactureSchematicObject() != NULL) + else if (object->asManufactureSchematicObject() != nullptr) { bonus = object->asManufactureSchematicObject()->getAttribBonus(attribute); } @@ -2271,15 +2271,15 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setAttributeBonus(JNIEnv *env, if (attribute < 0 || attribute >= Attributes::NumberOfAttributes) return JNI_FALSE; - ServerObject * object = NULL; + ServerObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; - if (object->asTangibleObject() != NULL) + if (object->asTangibleObject() != nullptr) { object->asTangibleObject()->setAttribBonus(attribute, bonus); } - else if (object->asManufactureSchematicObject() != NULL) + else if (object->asManufactureSchematicObject() != nullptr) { object->asManufactureSchematicObject()->setAttribBonus(attribute, bonus); } @@ -2307,7 +2307,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setAttributeBonuses(JNIEnv *env if (bonuses == 0) return JNI_FALSE; - ServerObject * object = NULL; + ServerObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -2322,13 +2322,13 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setAttributeBonuses(JNIEnv *env jint buffer[Attributes::NumberOfAttributes]; env->GetIntArrayRegion(bonuses, 0, count, buffer); - if (object->asTangibleObject() != NULL) + if (object->asTangibleObject() != nullptr) { TangibleObject * tangibleObject = object->asTangibleObject(); for (jsize i = 0; i < count; ++i) tangibleObject->setAttribBonus(i, buffer[i]); } - else if (object->asManufactureSchematicObject() != NULL) + else if (object->asManufactureSchematicObject() != nullptr) { ManufactureSchematicObject * manufactureSchematicObject = object->asManufactureSchematicObject(); for (jsize i = 0; i < count; ++i) @@ -2349,13 +2349,13 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setAttributeBonuses(JNIEnv *env * @param self class calling this function * @param target the object * - * @return a dictionary of skill mod names -> mod values, or null on error + * @return a dictionary of skill mod names -> mod values, or nullptr on error */ jobject JNICALL ScriptMethodsCraftingNamespace::getSkillModBonuses(JNIEnv *env, jobject self, jlong target) { UNREF(self); - const TangibleObject * object = NULL; + const TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return 0; @@ -2393,7 +2393,7 @@ jint JNICALL ScriptMethodsCraftingNamespace::getSkillModBonus(JNIEnv *env, jobje JavaStringParam jskillMod(skillMod); - const TangibleObject * object = NULL; + const TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return 0; @@ -2423,7 +2423,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSkillModBonus(JNIEnv *env, j JavaStringParam jskillMod(skillMod); - TangibleObject * object = NULL; + TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -2452,7 +2452,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSkillModBonuses(JNIEnv *env, { UNREF(self); - TangibleObject * object = NULL; + TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -2469,7 +2469,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSkillModBonuses(JNIEnv *env, } std::string skillName; - const jint * bonusArray = env->GetIntArrayElements(bonus, NULL); + const jint * bonusArray = env->GetIntArrayElements(bonus, nullptr); for (int i = 0; i < skillModCount; ++i) { JavaStringParam jskillName(static_cast(env->GetObjectArrayElement(skillMod, i))); @@ -2505,7 +2505,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setCategorizedSkillModBonus(JNI JavaStringParam jcategory(category); JavaStringParam jskillMod(skillMod); - TangibleObject * object = NULL; + TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -2540,7 +2540,7 @@ void JNICALL ScriptMethodsCraftingNamespace::removeCategorizedSkillModBonuses(JN JavaStringParam jcategory(category); - TangibleObject * object = NULL; + TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return; @@ -2566,7 +2566,7 @@ jint JNICALL ScriptMethodsCraftingNamespace::getSkillModSockets(JNIEnv *env, job { UNREF(self); - const TangibleObject * object = NULL; + const TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return 0; @@ -2589,7 +2589,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSkillModSockets(JNIEnv *env, { UNREF(self); - TangibleObject * object = NULL; + TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -2610,7 +2610,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSkillModSockets(JNIEnv *env, * @param qualityPercent % stat adjustment * @param container the container to create the item in * - * @return the item, or null on error + * @return the item, or nullptr on error */ jlong JNICALL ScriptMethodsCraftingNamespace::makeCraftedItem(JNIEnv *env, jobject self, jstring draftSchematic, jfloat qualityPercent, jlong container) { @@ -2618,7 +2618,7 @@ jlong JNICALL ScriptMethodsCraftingNamespace::makeCraftedItem(JNIEnv *env, jobje if (draftSchematic == 0 || container == 0) { - WARNING(true, ("[script bug] null schematic or container passed to " + WARNING(true, ("[script bug] nullptr schematic or container passed to " "makeCraftedItem")); return 0; } @@ -2634,21 +2634,21 @@ jlong JNICALL ScriptMethodsCraftingNamespace::makeCraftedItem(JNIEnv *env, jobje const DraftSchematicObject * schematic = DraftSchematicObject::getSchematic( draftSchematicName); - if (schematic == NULL) + if (schematic == nullptr) { WARNING(true, ("[script bug] bad schematic name %s passed to " "makeCraftedItem", draftSchematicName.c_str())); return 0; } - ServerObject * target = NULL; + ServerObject * target = nullptr; if (!JavaLibrary::getObject(container, target)) { WARNING(true, ("[script bug] bad container id passed to makeCraftedItem")); return 0; } Object * targetParent = ContainerInterface::getFirstParentInWorld(*target); - if (targetParent == NULL) + if (targetParent == nullptr) { WARNING(true, ("JavaLibrary::makeCraftedItem can't find parent in world " "for container %s", target->getNetworkId().getValueString().c_str())); @@ -2660,14 +2660,14 @@ jlong JNICALL ScriptMethodsCraftingNamespace::makeCraftedItem(JNIEnv *env, jobje // create a manf schematic and prototype ManufactureSchematicObject * manfSchematic = ServerWorld::createNewManufacturingSchematic( *schematic, createPos, false); - if (manfSchematic == NULL) + if (manfSchematic == nullptr) { WARNING(true, ("JavaLibrary::makeCraftedItem: error creating manf " "schematic!")); return 0; } ServerObject * prototype = manfSchematic->manufactureObject(createPos); - if (prototype == NULL) + if (prototype == nullptr) { WARNING(true, ("JavaLibrary::makeCraftedItem: error creating " "prototype!")); @@ -2690,7 +2690,7 @@ jlong JNICALL ScriptMethodsCraftingNamespace::makeCraftedItem(JNIEnv *env, jobje manfSchematic->permanentlyDestroy(DeleteReasons::Consumed); Container::ContainerErrorCode error; if (!ContainerInterface::transferItemToVolumeContainer (*target, *prototype, - NULL, error, true)) + nullptr, error, true)) { WARNING(true, ("JavaLibrary::makeCraftedItem: error can't store prototype " "in container, error = %d", error)); @@ -2711,14 +2711,14 @@ jlong JNICALL ScriptMethodsCraftingNamespace::makeCraftedItem(JNIEnv *env, jobje * @param self class calling this function * @param manufacturingSchematic the schematic to get the data from * - * @return the draft_schematic object, or null on error + * @return the draft_schematic object, or nullptr on error */ jobject JNICALL ScriptMethodsCraftingNamespace::getSchematicData(JNIEnv *env, jobject self, jlong manufacturingSchematic) { if (manufacturingSchematic == 0) return 0; - const ManufactureSchematicObject * schematicObject = NULL; + const ManufactureSchematicObject * schematicObject = nullptr; if (!JavaLibrary::getObject(manufacturingSchematic, schematicObject)) return 0; @@ -2735,7 +2735,7 @@ jobject JNICALL ScriptMethodsCraftingNamespace::getSchematicData(JNIEnv *env, jo * @param self class calling this function * @param draftSchematic the schematic to get the data from * - * @return the draft_schematic object, or null on error + * @return the draft_schematic object, or nullptr on error */ jobject JNICALL ScriptMethodsCraftingNamespace::getDraftSchematicData(JNIEnv *env, jobject self, jstring draftSchematic) @@ -2749,7 +2749,7 @@ jobject JNICALL ScriptMethodsCraftingNamespace::getDraftSchematicData(JNIEnv *en return 0; const DraftSchematicObject * schematicObject = DraftSchematicObject::getSchematic(schematicName); - if (schematicObject == NULL) + if (schematicObject == nullptr) return 0; return JavaLibrary::convert(*schematicObject); @@ -2765,7 +2765,7 @@ jobject JNICALL ScriptMethodsCraftingNamespace::getDraftSchematicData(JNIEnv *en * @param self class calling this function * @param draftSchematicCrc the schematic to get the data from * - * @return the draft_schematic object, or null on error + * @return the draft_schematic object, or nullptr on error */ jobject JNICALL ScriptMethodsCraftingNamespace::getDraftSchematicDataCrc(JNIEnv *env, jobject self, jint draftSchematicCrc) @@ -2774,7 +2774,7 @@ jobject JNICALL ScriptMethodsCraftingNamespace::getDraftSchematicDataCrc(JNIEnv return 0; const DraftSchematicObject * schematicObject = DraftSchematicObject::getSchematic(draftSchematicCrc); - if (schematicObject == NULL) + if (schematicObject == nullptr) return 0; return JavaLibrary::convert(*schematicObject); @@ -2794,7 +2794,7 @@ jobject JNICALL ScriptMethodsCraftingNamespace::getDraftSchematicDataCrc(JNIEnv */ void JNICALL ScriptMethodsCraftingNamespace::recomputeCrateAttributes(JNIEnv *env, jobject self, jlong crate) { - FactoryObject * factory = NULL; + FactoryObject * factory = nullptr; if (!JavaLibrary::getObject(crate, factory)) return; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsDebug.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsDebug.cpp index 9946fc28..6769ff57 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsDebug.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsDebug.cpp @@ -188,7 +188,7 @@ void JNICALL ScriptMethodsDebugNamespace::debugServerConsoleMsg(JNIEnv *env, job ServerObject * object = 0; JavaLibrary::getObject(objId, object); - if (object == NULL) + if (object == nullptr) { DEBUG_REPORT_LOG(true, ("debugServerConsoleMsg from : %s\n", msgString.c_str())); @@ -212,8 +212,8 @@ void JNICALL ScriptMethodsDebugNamespace::debugServerConsoleMsg(JNIEnv *env, job * @param channel the channel to log to * @param msg the message to log * @param logger id of the object where the log is coming from - * @param player1 the 1st player for the message (may be null) - * @param player2 the 2nd player for the message (may be null) + * @param player1 the 1st player for the message (may be nullptr) + * @param player2 the 2nd player for the message (may be nullptr) * @param alwaysLog flag to ignore the disableScriptLogs flag and always log this message */ void JNICALL ScriptMethodsDebugNamespace::log(JNIEnv *env, jobject self, jstring channel, jstring msg, jlong logger, jlong player1, jlong player2, jboolean alwaysLog) @@ -222,7 +222,7 @@ void JNICALL ScriptMethodsDebugNamespace::log(JNIEnv *env, jobject self, jstring if (channel == 0 || msg == 0) { - JavaLibrary::throwInternalScriptError("[designer bug] JavaLibrary::log called with null channel or message"); + JavaLibrary::throwInternalScriptError("[designer bug] JavaLibrary::log called with nullptr channel or message"); return; } @@ -248,7 +248,7 @@ void JNICALL ScriptMethodsDebugNamespace::log(JNIEnv *env, jobject self, jstring if (player1 != 0) { - const ServerObject * playerObject = NULL; + const ServerObject * playerObject = nullptr; if (JavaLibrary::getObject(player1, playerObject)) { std::string::size_type p = msgStr.find("%TU"); @@ -264,7 +264,7 @@ void JNICALL ScriptMethodsDebugNamespace::log(JNIEnv *env, jobject self, jstring if (player2 != 0) { - const ServerObject * playerObject = NULL; + const ServerObject * playerObject = nullptr; if (JavaLibrary::getObject(player2, playerObject)) { std::string::size_type p = msgStr.find("%TT"); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsDynamicVariable.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsDynamicVariable.cpp index dbf13ac0..effd5bed 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsDynamicVariable.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsDynamicVariable.cpp @@ -39,7 +39,7 @@ namespace NonAuthObjvarNamespace if (!ConfigServerGame::getTrackNonAuthoritativeObjvarSets()) return; - if (name == NULL || *name == '\0') + if (name == nullptr || *name == '\0') return; if (obj.isAuthoritative()) return; @@ -504,13 +504,13 @@ LocalRefPtr ScriptMethodsDynamicVariableNamespace::convertDynamicVariableListToO * @param buffer a buffer to be filled in with the converted C name * @param bufferSize the length of buffer * - * @return the ServerObject * for the obj_id, or null on error + * @return the ServerObject * for the obj_id, or nullptr on error */ ServerObject * ScriptMethodsDynamicVariableNamespace::getObjectAndName(JNIEnv *env, jlong objId, jstring name, char * buffer, size_t bufferSize) { NOT_NULL(buffer); - ServerObject * object = NULL; + ServerObject * object = nullptr; JavaStringParam localName(name); if (localName.fillBuffer(buffer, bufferSize) > 1) { @@ -523,7 +523,7 @@ ServerObject * ScriptMethodsDynamicVariableNamespace::getObjectAndName(JNIEnv *e { fprintf(stderr, "WARNING: Could not get objvar name\n"); } - if (object == NULL && !ConfigServerGame::getDisableObjvarNullCheck()) + if (object == nullptr && !ConfigServerGame::getDisableObjvarNullCheck()) JavaLibrary::printJavaStack(); return object; @@ -540,15 +540,15 @@ ServerObject * ScriptMethodsDynamicVariableNamespace::getObjectAndName(JNIEnv *e * @param buffer a buffer to be filled in with the converted C name * @param bufferSize the length of buffer * - * @return the DynamicVariableList * for the obj_id, or null on error + * @return the DynamicVariableList * for the obj_id, or nullptr on error */ const DynamicVariableList * ScriptMethodsDynamicVariableNamespace::getObjvarsAndName(JNIEnv *env, jlong objId, jstring name, char * buffer, size_t bufferSize) { NOT_NULL(buffer); - const DynamicVariableList * objvars = NULL; + const DynamicVariableList * objvars = nullptr; const ServerObject * object = getObjectAndName(env, objId, name, buffer, bufferSize); - if (object != NULL) + if (object != nullptr) { testIsSafeToReadObjvar(*object, buffer); objvars = &object->getObjVars(); @@ -582,7 +582,7 @@ jobject JNICALL ScriptMethodsDynamicVariableNamespace::getDynamicVariable(JNIEnv char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvars = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvars == NULL) + if (objvars == nullptr) return 0; const std::string objvarName(buffer); @@ -751,7 +751,7 @@ jint JNICALL ScriptMethodsDynamicVariableNamespace::getIntDynamicVariable(JNIEnv char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == NULL) + if (objvarList == nullptr) return 0; int localValue=0; @@ -781,7 +781,7 @@ jintArray JNICALL ScriptMethodsDynamicVariableNamespace::getIntArrayDynamicVaria char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == NULL) + if (objvarList == nullptr) return 0; std::vector value; @@ -816,7 +816,7 @@ jfloat JNICALL ScriptMethodsDynamicVariableNamespace::getFloatDynamicVariable(JN char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == NULL) + if (objvarList == nullptr) return 0; float localValue = 0; @@ -846,7 +846,7 @@ jfloatArray JNICALL ScriptMethodsDynamicVariableNamespace::getFloatArrayDynamicV char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == NULL) + if (objvarList == nullptr) return 0; std::vector value; @@ -878,7 +878,7 @@ jstring JNICALL ScriptMethodsDynamicVariableNamespace::getStringDynamicVariable( char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == NULL) + if (objvarList == nullptr) return 0; Unicode::String value; @@ -908,7 +908,7 @@ jobjectArray JNICALL ScriptMethodsDynamicVariableNamespace::getStringArrayDynami char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == NULL) + if (objvarList == nullptr) return 0; std::vector value; @@ -944,7 +944,7 @@ jlong JNICALL ScriptMethodsDynamicVariableNamespace::getObjIdDynamicVariable(JNI char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == NULL) + if (objvarList == nullptr) return 0; NetworkId localValue; @@ -972,7 +972,7 @@ jlongArray JNICALL ScriptMethodsDynamicVariableNamespace::getObjIdArrayDynamicVa char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList *objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == NULL) + if (objvarList == nullptr) return 0; std::vector value; @@ -1013,7 +1013,7 @@ jobject JNICALL ScriptMethodsDynamicVariableNamespace::getLocationDynamicVariabl char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == NULL) + if (objvarList == nullptr) return 0; DynamicVariableLocationData value; @@ -1046,7 +1046,7 @@ jobjectArray JNICALL ScriptMethodsDynamicVariableNamespace::getLocationArrayDyna char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == NULL) + if (objvarList == nullptr) return 0; std::vector value; @@ -1092,7 +1092,7 @@ jobject JNICALL ScriptMethodsDynamicVariableNamespace::getStringIdDynamicVariabl char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == NULL) + if (objvarList == nullptr) return 0; StringId value; @@ -1125,7 +1125,7 @@ jobjectArray JNICALL ScriptMethodsDynamicVariableNamespace::getStringIdArrayDyna char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == NULL) + if (objvarList == nullptr) return 0; std::vector value; @@ -1168,7 +1168,7 @@ jobject JNICALL ScriptMethodsDynamicVariableNamespace::getTransformDynamicVariab char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == NULL) + if (objvarList == nullptr) return 0; Transform value; @@ -1201,7 +1201,7 @@ jobjectArray JNICALL ScriptMethodsDynamicVariableNamespace::getTransformArrayDyn char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == NULL) + if (objvarList == nullptr) return 0; std::vector value; @@ -1244,7 +1244,7 @@ jobject JNICALL ScriptMethodsDynamicVariableNamespace::getVectorDynamicVariable( char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == NULL) + if (objvarList == nullptr) return 0; Vector value; @@ -1277,7 +1277,7 @@ jobjectArray JNICALL ScriptMethodsDynamicVariableNamespace::getVectorArrayDynami char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == NULL) + if (objvarList == nullptr) return 0; std::vector value; @@ -1320,7 +1320,7 @@ jobject JNICALL ScriptMethodsDynamicVariableNamespace::getDynamicVariableList(JN JavaStringParam localName(name); - const ServerObject* object = NULL; + const ServerObject* object = nullptr; if (!JavaLibrary::getObject(objId, object)) return 0; @@ -1342,7 +1342,7 @@ jobject JNICALL ScriptMethodsDynamicVariableNamespace::getDynamicVariableList(JN } } - if (result.get() == NULL) + if (result.get() == nullptr) return 0; return result->getReturnValue(); } // JavaLibrary::getDynamicVariableList @@ -1364,7 +1364,7 @@ void JNICALL ScriptMethodsDynamicVariableNamespace::removeDynamicVariable(JNIEnv char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return; object->removeObjVarItem(buffer); @@ -1384,7 +1384,7 @@ void JNICALL ScriptMethodsDynamicVariableNamespace::removeAllDynamicVariables(JN if (objId == 0) return; - ServerObject* object = NULL; + ServerObject* object = nullptr; if (!JavaLibrary::getObject(objId, object)) return; @@ -1410,7 +1410,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::hasDynamicVariable(JNIEn char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return 0; const DynamicVariableList &objvarList = object->getObjVars(); @@ -1441,11 +1441,11 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setDynamicVariable(JNIEn char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; const DynamicVariableList *objvarList = &(object->getObjVars()); - if (objvarList == NULL) + if (objvarList == nullptr) return JNI_FALSE; // determine what type the data is @@ -1454,9 +1454,9 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setDynamicVariable(JNIEn { // name is the name of an objvar list we will add data to DynamicVariable *objvar = objvarList->getItemByName(localName); - if (objvar == NULL) + if (objvar == nullptr) objvar = objvarList->addNestedList(localName); - if (objvar != NULL && objvar->getType() == DynamicVariable::LIST) + if (objvar != nullptr && objvar->getType() == DynamicVariable::LIST) return updateDynamicVariableList(env, *dynamic_cast(objvar), data); return JNI_FALSE; } @@ -1474,7 +1474,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setDynamicVariable(JNIEn } else if (env->IsInstanceOf(data, ms_clsString) == JNI_TRUE) { - if (objvarList->setItem(localName, Unicode::String(env->GetStringChars(static_cast(data), NULL)))) + if (objvarList->setItem(localName, Unicode::String(env->GetStringChars(static_cast(data), nullptr)))) #error must release characters return JNI_TRUE; return JNI_FALSE; @@ -1503,7 +1503,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setIntDynamicVariable(JN char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; addSetObjvar(*object, buffer); @@ -1531,7 +1531,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setIntArrayDynamicVariab char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; size_t size = env->GetArrayLength(value); @@ -1574,7 +1574,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setFloatDynamicVariable( char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; addSetObjvar(*object, buffer); @@ -1602,7 +1602,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setFloatArrayDynamicVari char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; size_t size = env->GetArrayLength(value); @@ -1645,7 +1645,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setStringDynamicVariable if (name == 0) { - DEBUG_WARNING(true, ("NULL name passed from script to JavaLibrary::setStringDynamicValue")); + DEBUG_WARNING(true, ("nullptr name passed from script to JavaLibrary::setStringDynamicValue")); return JNI_FALSE; } @@ -1653,17 +1653,17 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setStringDynamicVariable char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; if (value == 0) { - DEBUG_WARNING(true, ("NULL string passed from script to JavaLibrary::setStringDynamicValue (%s)",buffer)); + DEBUG_WARNING(true, ("nullptr string passed from script to JavaLibrary::setStringDynamicValue (%s)",buffer)); return JNI_FALSE; } const DynamicVariableList *objvarList = &(object->getObjVars()); - if (objvarList == NULL) + if (objvarList == nullptr) return JNI_FALSE; Unicode::String valueString; @@ -1698,7 +1698,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setStringArrayDynamicVar char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; std::vector valueArray; @@ -1754,7 +1754,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setObjIdDynamicVariable( char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; NetworkId oidValue(static_cast @@ -1785,7 +1785,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setObjIdArrayDynamicVari char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; std::vector valueArray; @@ -1838,7 +1838,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setLocationDynamicVariab char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; DynamicVariableLocationData locValue; @@ -1878,7 +1878,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setLocationArrayDynamicV char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; std::vector valueArray; @@ -1942,7 +1942,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setStringIdDynamicVariab char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; StringId locValue; @@ -1977,7 +1977,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setStringIdArrayDynamicV char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; std::vector valueArray; @@ -2033,7 +2033,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setTransformDynamicVaria char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; Transform locValue; @@ -2068,7 +2068,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setTransformArrayDynamic char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; std::vector valueArray; @@ -2120,7 +2120,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setVectorDynamicVariable char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; Vector locValue; @@ -2155,7 +2155,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setVectorArrayDynamicVar char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; std::vector valueArray; @@ -2227,10 +2227,10 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::copyDynamicVariable(JNIE return JNI_TRUE; ServerObject* fromObject = dynamic_cast(from.getObject()); - if (fromObject == NULL) + if (fromObject == nullptr) return JNI_FALSE; ServerObject* toObject = dynamic_cast(to.getObject()); - if (toObject == NULL) + if (toObject == nullptr) return JNI_FALSE; char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsForm.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsForm.cpp index 3ca7c226..3247b76e 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsForm.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsForm.cpp @@ -48,7 +48,7 @@ const JNINativeMethod NATIVES[] = { jboolean JNICALL ScriptMethodsFormNamespace::editFormData(JNIEnv * env, jobject self, jlong player, jlong jObjectToEdit, jobjectArray jKeys, jobjectArray jValues) { UNREF(self); - ServerObject * playerServerObject = NULL; + ServerObject * playerServerObject = nullptr; if (!JavaLibrary::getObject(player, playerServerObject) || !playerServerObject) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("[script bug] can't get player in editFormData")); @@ -62,7 +62,7 @@ jboolean JNICALL ScriptMethodsFormNamespace::editFormData(JNIEnv * env, jobject return JNI_FALSE; } - ServerObject * objectToEditServerObject = NULL; + ServerObject * objectToEditServerObject = nullptr; if (!JavaLibrary::getObject(jObjectToEdit, objectToEditServerObject) || !objectToEditServerObject) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("[script bug] objectToEdit is not a ServerObject in editFormData")); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsHateList.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsHateList.cpp index 324d719e..758d57e9 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsHateList.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsHateList.cpp @@ -90,7 +90,7 @@ void JNICALL ScriptMethodsHateListNamespace::setAggroImmuneDuration(JNIEnv * /*e NetworkId const playerNetworkId(player); PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(playerNetworkId)); - if (playerObject == NULL) + if (playerObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsHateList::setAggroImmuneDuration() player(%s) Unable to resolve the object to a PlayerObject.", playerNetworkId.getValueString().c_str())); return; @@ -105,7 +105,7 @@ jboolean JNICALL ScriptMethodsHateListNamespace::isAggroImmune(JNIEnv * /*env*/, NetworkId const playerNetworkId(player); PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(playerNetworkId)); - if (playerObject == NULL) + if (playerObject == nullptr) { return JNI_FALSE; } @@ -120,7 +120,7 @@ void JNICALL ScriptMethodsHateListNamespace::addHate(JNIEnv * /*env*/, jobject / NetworkId const hateTargetNetworkId(hateTarget); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == NULL) + if (objectTangibleObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsHateList::addHate() object(%s) hateTarget(%s) hate(%.2f) Unable to resolve the object to a TangibleObject.", networkId.getValueString().c_str(), hateTargetNetworkId.getValueString().c_str(), hate)); return; @@ -148,7 +148,7 @@ void JNICALL ScriptMethodsHateListNamespace::addHateDot(JNIEnv * /*env*/, jobjec NetworkId const hateTargetNetworkId(hateTarget); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == NULL) + if (objectTangibleObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsHateList::addHateDot() object(%s) hateTarget(%s) hate(%.2f) seconds(%d) Unable to resolve the object to a TangibleObject.", networkId.getValueString().c_str(), hateTargetNetworkId.getValueString().c_str(), hate, seconds)); return; @@ -178,7 +178,7 @@ void JNICALL ScriptMethodsHateListNamespace::setHate(JNIEnv * /*env*/, jobject / NetworkId const hateTargetNetworkId(hateTarget); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == NULL) + if (objectTangibleObject == nullptr) { WARNING(true, ("ScriptMethodsHateList::setHate() object(%s) hateTarget(%s) hate(%.2f) Unable to resolve the object to a TangibleObject.", networkId.getValueString().c_str(), hateTargetNetworkId.getValueString().c_str(), hate)); return; @@ -208,7 +208,7 @@ void JNICALL ScriptMethodsHateListNamespace::removeHateTarget(JNIEnv * /*env*/, NetworkId const hateTargetNetworkId(hateTarget); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == NULL) + if (objectTangibleObject == nullptr) { WARNING(true, ("ScriptMethodsHateList::removeHateTarget() object(%s) hateTarget(%s) Unable to resolve the object to a TangibleObject.", networkId.getValueString().c_str(), hateTargetNetworkId.getValueString().c_str())); return; @@ -238,7 +238,7 @@ jfloat JNICALL ScriptMethodsHateListNamespace::getHate(JNIEnv * /*env*/, jobject NetworkId const hateTargetNetworkId(hateTarget); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == NULL) + if (objectTangibleObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsHateList::getHate() object(%s) hateTarget(%s) Unable to resolve the object to a TangibleObject.", networkId.getValueString().c_str(), hateTargetNetworkId.getValueString().c_str())); return 0.0f; @@ -264,7 +264,7 @@ jfloat JNICALL ScriptMethodsHateListNamespace::getMaxHate(JNIEnv * /*env*/, jobj NetworkId const networkId(object); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == NULL) + if (objectTangibleObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsHateList::getMaxHate() object(%s) Unable to resolve the object to a TangibleObject.", networkId.getValueString().c_str())); return 0.0f; @@ -281,7 +281,7 @@ void JNICALL ScriptMethodsHateListNamespace::clearHateList(JNIEnv * /*env*/, job NetworkId const networkId(object); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == NULL) + if (objectTangibleObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsHateList::clearHateList() Unable to resolve the object(%s) to a TangibleObject.", networkId.getValueString().c_str())); return; @@ -298,7 +298,7 @@ jlong JNICALL ScriptMethodsHateListNamespace::getHateTarget(JNIEnv * /*env*/, jo NetworkId const networkId(object); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == NULL) + if (objectTangibleObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsHateList::getHateTarget() Unable to resolve the object(%s) to a TangibleObject.", networkId.getValueString().c_str())); return 0; @@ -317,7 +317,7 @@ jlongArray JNICALL ScriptMethodsHateListNamespace::getHateList(JNIEnv * /*env*/, LOGC(AiLogManager::isLogging(networkId), "debug_ai", ("ScriptMethodsHateList::getHateList() object(%s)", networkId.getValueString().c_str())); - if (objectTangibleObject == NULL) + if (objectTangibleObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsHateList::getHateList() Unable to resolve the object(%s) to a TangibleObject.", networkId.getValueString().c_str())); return 0; @@ -348,7 +348,7 @@ jboolean JNICALL ScriptMethodsHateListNamespace::isOnHateList(JNIEnv * /*env*/, NetworkId const targetNetworkId(target); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == NULL) + if (objectTangibleObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsHateList::isOnHateList() object(%s) target(%s) Unable to resolve the object to a TangibleObject.", networkId.getValueString().c_str(), targetNetworkId.getValueString().c_str())); return JNI_FALSE; @@ -369,7 +369,7 @@ void JNICALL ScriptMethodsHateListNamespace::resetHateTimer(JNIEnv * /*env*/, jo NetworkId const networkId(object); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == NULL) + if (objectTangibleObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsHateList::resetHateTimer() object(%s) Unable to resolve the object to a TangibleObject.", networkId.getValueString().c_str())); return; @@ -385,7 +385,7 @@ void JNICALL ScriptMethodsHateListNamespace::setAILeashTime(JNIEnv * /*env*/, jo NetworkId const networkId(object); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == NULL) + if (objectTangibleObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsHateList::setAILeashTime() object(%s) time(%.2f) Unable to resolve the object to a TangibleObject.", networkId.getValueString().c_str(), time)); return; @@ -408,7 +408,7 @@ jfloat JNICALL ScriptMethodsHateListNamespace::getAILeashTime(JNIEnv * /*env*/, NetworkId const networkId(object); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == NULL) + if (objectTangibleObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsHateList::setAILeashTime() object(%s) time(%.2f) Unable to resolve the object to a TangibleObject.", networkId.getValueString().c_str(), time)); return 0.0; @@ -434,7 +434,7 @@ void JNICALL ScriptMethodsHateListNamespace::forceHateTarget(JNIEnv * env, jobje NetworkId const hateTargetNetworkId(target); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == NULL) + if (objectTangibleObject == nullptr) { WARNING(true, ("ScriptMethodsHateList::forceHateTarget() object(%s) hateTarget(%s) Unable to resolve the object to a TangibleObject.", networkId.getValueString().c_str(), hateTargetNetworkId.getValueString().c_str())); return; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsHolocube.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsHolocube.cpp index 51088b13..31a83e7c 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsHolocube.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsHolocube.cpp @@ -47,7 +47,7 @@ jboolean JNICALL ScriptMethodsHolocubeNamespace::openHolocronToPage(JNIEnv *env, { JavaStringParam localPage(jpage); - ServerObject* so = NULL; + ServerObject* so = nullptr; if(!JavaLibrary::getObject(client, so)) { WARNING (true, ("[Script bug] Could not get ServerObject for value passed in for paramter:client in JavaLibrary::openHolocronToPage")); @@ -76,7 +76,7 @@ jboolean JNICALL ScriptMethodsHolocubeNamespace::openHolocronToPage(JNIEnv *env, jboolean JNICALL ScriptMethodsHolocubeNamespace::closeHolocron(JNIEnv *env, jobject self, jlong client) { - ServerObject* so = NULL; + ServerObject* so = nullptr; if(!JavaLibrary::getObject(client, so)) { WARNING (true, ("[Script bug] Could not get ServerObject for value passed in for paramter:client in JavaLibrary::closeHolocron")); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsHyperspace.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsHyperspace.cpp index 665f9460..784a2717 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsHyperspace.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsHyperspace.cpp @@ -131,10 +131,10 @@ void JNICALL ScriptMethodsHyperspaceNamespace::hyperspacePlayerToLocation(JNIEnv // Make sure the ship is not docking - Controller const * const controller = (shipObject != NULL) ? shipObject->getController() : NULL; - ShipController const * const shipController = (controller != NULL) ? controller->asShipController() : NULL; + Controller const * const controller = (shipObject != nullptr) ? shipObject->getController() : nullptr; + ShipController const * const shipController = (controller != nullptr) ? controller->asShipController() : nullptr; - if ( (shipController != NULL) + if ( (shipController != nullptr) && shipController->isDocking()) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("hyperspacePlayerToLocation - Hyperspacing is not allowed on ships that are currently docking: %s", shipObject->getDebugInformation().c_str())); @@ -211,10 +211,10 @@ void JNICALL ScriptMethodsHyperspaceNamespace::hyperspacePlayerToLocationCellNam // Make sure the ship is not docking - Controller const * const controller = (shipObject != NULL) ? shipObject->getController() : NULL; - ShipController const * const shipController = (controller != NULL) ? controller->asShipController() : NULL; + Controller const * const controller = (shipObject != nullptr) ? shipObject->getController() : nullptr; + ShipController const * const shipController = (controller != nullptr) ? controller->asShipController() : nullptr; - if ( (shipController != NULL) + if ( (shipController != nullptr) && shipController->isDocking()) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("hyperspacePlayerToLocation - Hyperspacing is not allowed on ships that are currently docking: %s", shipObject->getDebugInformation().c_str())); @@ -272,7 +272,7 @@ void JNICALL ScriptMethodsHyperspaceNamespace::hyperspacePlayerToHyperspacePoint return; } - CreatureObject * const playerCreature = playerObject ? playerObject->asCreatureObject() : NULL; + CreatureObject * const playerCreature = playerObject ? playerObject->asCreatureObject() : nullptr; if(!playerCreature) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("hyperspacePlayerToHyperspacePoint - player is not a creature")); @@ -309,10 +309,10 @@ void JNICALL ScriptMethodsHyperspaceNamespace::hyperspacePlayerToHyperspacePoint // Make sure the ship is not docking - Controller const * const controller = (shipObject != NULL) ? shipObject->getController() : NULL; - ShipController const * const shipController = (controller != NULL) ? controller->asShipController() : NULL; + Controller const * const controller = (shipObject != nullptr) ? shipObject->getController() : nullptr; + ShipController const * const shipController = (controller != nullptr) ? controller->asShipController() : nullptr; - if ( (shipController != NULL) + if ( (shipController != nullptr) && shipController->isDocking()) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("hyperspacePlayerToHyperspacePoint - Hyperspacing is not allowed on ships that are currently docking: %s", shipObject->getDebugInformation().c_str())); @@ -395,7 +395,7 @@ void JNICALL ScriptMethodsHyperspaceNamespace::hyperspacePrepareShipOnClient(JNI return; } - CreatureObject * const playerCreature = playerObject ? playerObject->asCreatureObject() : NULL; + CreatureObject * const playerCreature = playerObject ? playerObject->asCreatureObject() : nullptr; if(playerCreature == 0) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("hyperspacePlayerToHyperspacePoint - player is not a creature")); @@ -425,8 +425,8 @@ void JNICALL ScriptMethodsHyperspaceNamespace::hyperspacePrepareShipOnClient(JNI if (HyperspaceManager::getHyperspacePoint(hyperspacePoint, location)) { - Controller const * const controller = (shipObject != NULL) ? shipObject->getController() : NULL; - ShipController const * const shipController = (controller != NULL) ? controller->asShipController() : NULL; + Controller const * const controller = (shipObject != nullptr) ? shipObject->getController() : nullptr; + ShipController const * const shipController = (controller != nullptr) ? controller->asShipController() : nullptr; if (shipController != 0) { @@ -467,7 +467,7 @@ void JNICALL ScriptMethodsHyperspaceNamespace::hyperspaceRestoreShipOnClientFrom return; } - CreatureObject * const playerCreature = playerObject ? playerObject->asCreatureObject() : NULL; + CreatureObject * const playerCreature = playerObject ? playerObject->asCreatureObject() : nullptr; if(playerCreature == 0) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("hyperspacePlayerToHyperspacePoint - player is not a creature")); @@ -482,8 +482,8 @@ void JNICALL ScriptMethodsHyperspaceNamespace::hyperspaceRestoreShipOnClientFrom return; } - Controller const * const controller = (shipObject != NULL) ? shipObject->getController() : NULL; - ShipController const * const shipController = (controller != NULL) ? controller->asShipController() : NULL; + Controller const * const controller = (shipObject != nullptr) ? shipObject->getController() : nullptr; + ShipController const * const shipController = (controller != nullptr) ? controller->asShipController() : nullptr; if (shipController != 0) { @@ -514,7 +514,7 @@ jstring JNICALL ScriptMethodsHyperspaceNamespace::getSceneForHyperspacePoint(JNI if (!JavaLibrary::convert(localHyperspacePoint, hyperspacePoint)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("getSceneForHyperspacePoint - could not get hyperspace point name")); - return NULL; + return nullptr; } if(HyperspaceManager::isValidHyperspacePoint(hyperspacePoint)) @@ -528,7 +528,7 @@ jstring JNICALL ScriptMethodsHyperspaceNamespace::getSceneForHyperspacePoint(JNI return str.getReturnValue(); } } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------ diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsImageDesign.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsImageDesign.cpp index b85f1516..4866318b 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsImageDesign.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsImageDesign.cpp @@ -70,7 +70,7 @@ void JNICALL ScriptMethodsImageDesignNamespace::imagedesignStart(JNIEnv *env, jo return; } - //the terminal can be NULL (that means no ID terminal is being used, which is fine) + //the terminal can be nullptr (that means no ID terminal is being used, which is fine) ServerObject * terminalObj = 0; JavaLibrary::getObject(jterminalId, terminalObj); @@ -185,8 +185,8 @@ jboolean JNICALL ScriptMethodsImageDesignNamespace::imagedesignValidated(JNIEnv WARNING(true, ("morph keys and values arrays are of diffent sizes")); return JNI_FALSE; } - jfloat * const morphChangesValuesArray = env->GetFloatArrayElements(jmorphChangesValues, NULL); - if (morphChangesValuesArray == NULL) + jfloat * const morphChangesValuesArray = env->GetFloatArrayElements(jmorphChangesValues, nullptr); + if (morphChangesValuesArray == nullptr) { return JNI_FALSE; } @@ -211,8 +211,8 @@ jboolean JNICALL ScriptMethodsImageDesignNamespace::imagedesignValidated(JNIEnv WARNING(true, ("index keys and values arrays are of diffent sizes")); return JNI_FALSE; } - jint * const indexChangesValuesArray = env->GetIntArrayElements(jindexChangesValues, NULL); - if (indexChangesValuesArray == NULL) + jint * const indexChangesValuesArray = env->GetIntArrayElements(jindexChangesValues, nullptr); + if (indexChangesValuesArray == nullptr) { return JNI_FALSE; } diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsInstallation.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsInstallation.cpp index b96b27d2..5c159849 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsInstallation.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsInstallation.cpp @@ -224,7 +224,7 @@ void JNICALL ScriptMethodsInstallationNamespace::displayStructurePermissionData( UNREF(self); //get the player id from player - CreatureObject* creatureObject = NULL; + CreatureObject* creatureObject = nullptr; if (!JavaLibrary::getObject(player, creatureObject)) return; @@ -290,7 +290,7 @@ jfloat JNICALL ScriptMethodsInstallationNamespace::getPowerValue(JNIEnv *env, jo UNREF(self); //get the player id from player - const InstallationObject * installation = NULL; + const InstallationObject * installation = nullptr; if (!JavaLibrary::getObject(target, installation)) return 0; @@ -314,7 +314,7 @@ jboolean JNICALL ScriptMethodsInstallationNamespace::setPowerValue(JNIEnv *env, UNREF(self); //get the player id from player - InstallationObject * installation = NULL; + InstallationObject * installation = nullptr; if (!JavaLibrary::getObject(target, installation)) return JNI_FALSE; @@ -340,7 +340,7 @@ jboolean JNICALL ScriptMethodsInstallationNamespace::incrementPowerValue(JNIEnv UNREF(self); //get the player id from player - InstallationObject * installation = NULL; + InstallationObject * installation = nullptr; if (!JavaLibrary::getObject(target, installation)) return JNI_FALSE; @@ -365,7 +365,7 @@ jfloat JNICALL ScriptMethodsInstallationNamespace::getPowerRate(JNIEnv *env, job UNREF(self); //get the player id from player - const InstallationObject * installation = NULL; + const InstallationObject * installation = nullptr; if (!JavaLibrary::getObject(target, installation)) return 0; @@ -389,7 +389,7 @@ jboolean JNICALL ScriptMethodsInstallationNamespace::setPowerRate(JNIEnv *env, j UNREF(self); //get the player id from player - InstallationObject * installation = NULL; + InstallationObject * installation = nullptr; if (!JavaLibrary::getObject(target, installation)) return JNI_FALSE; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsInteriors.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsInteriors.cpp index fb6c3557..da0c833b 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsInteriors.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsInteriors.cpp @@ -137,7 +137,7 @@ jlong JNICALL ScriptMethodsInteriorsNamespace::createObjectInCell(JNIEnv *env, j return 0; std::string templateName; - ServerObject* sourceObject = NULL; + ServerObject* sourceObject = nullptr; if (!JavaLibrary::getObject(source, sourceObject)) return 0; templateName = sourceObject->getTemplateName(); @@ -149,7 +149,7 @@ jlong JNICALL ScriptMethodsInteriorsNamespace::_createObjectInCellInternal(JNIEn { JavaStringParam localCellName(cellName); - ServerObject * portallizedObject = NULL; + ServerObject * portallizedObject = nullptr; if (!JavaLibrary::getObject(building, portallizedObject)) return 0; @@ -183,7 +183,7 @@ jlong JNICALL ScriptMethodsInteriorsNamespace::_createObjectInCellInternal(JNIEn Transform tr; tr.setPosition_p(newPos); ServerObject *newObject = ServerWorld::createNewObject(templateName, tr, cellObject, false); - if (newObject == NULL) + if (newObject == nullptr) return 0; //@todo do we need to snap to floor or something? @@ -226,7 +226,7 @@ jlong JNICALL ScriptMethodsInteriorsNamespace::createObjectInCellAnywhere(JNIEnv return 0; std::string templateName; - ServerObject* sourceObject = NULL; + ServerObject* sourceObject = nullptr; if (!JavaLibrary::getObject(source, sourceObject)) return 0; templateName = sourceObject->getTemplateName(); @@ -261,7 +261,7 @@ jlong JNICALL ScriptMethodsInteriorsNamespace::_createObjectInCellAnywhereIntern //@todo need to find a way to get a good location in a cell. For now just use the coordinates of the cell? JavaStringParam localCellName(cellName); - ServerObject *portallizedObject = NULL; + ServerObject *portallizedObject = nullptr; if (!JavaLibrary::getObject(building, portallizedObject)) return 0; @@ -289,7 +289,7 @@ jlong JNICALL ScriptMethodsInteriorsNamespace::_createObjectInCellAnywhereIntern Transform tr; tr.setPosition_p(createPosition); ServerObject *newObject = ServerWorld::createNewObject(templateName, tr, cellObject, false); - if (newObject == NULL) + if (newObject == nullptr) return 0; // create an networkId to return @@ -306,7 +306,7 @@ jlong JNICALL ScriptMethodsInteriorsNamespace::_createObjectInCellAnywhereIntern jobjectArray JNICALL ScriptMethodsInteriorsNamespace::getCellNames(JNIEnv *env, jobject self, jlong target) { - ServerObject const *portallizedObject = NULL; + ServerObject const *portallizedObject = nullptr; if (!JavaLibrary::getObject(target, portallizedObject)) return 0; @@ -329,7 +329,7 @@ jobjectArray JNICALL ScriptMethodsInteriorsNamespace::getCellNames(JNIEnv *env, jstring JNICALL ScriptMethodsInteriorsNamespace::getCellName(JNIEnv *env, jobject self, jlong target) { - CellObject const *cellObject = NULL; + CellObject const *cellObject = nullptr; if (!JavaLibrary::getObject(target, cellObject)) return 0; @@ -342,7 +342,7 @@ jstring JNICALL ScriptMethodsInteriorsNamespace::getCellName(JNIEnv *env, jobjec } ServerObject const * const portallizedObject = safe_cast(ContainerInterface::getContainedByObject(*cellObject)); - if (portallizedObject == NULL) + if (portallizedObject == nullptr) return 0; PortalProperty const * const cellProp = portallizedObject->getPortalProperty(); @@ -370,7 +370,7 @@ jstring JNICALL ScriptMethodsInteriorsNamespace::getCellName(JNIEnv *env, jobjec jlongArray JNICALL ScriptMethodsInteriorsNamespace::getCellIds(JNIEnv *env, jobject self, jlong target) { - ServerObject const *portallizedObject = NULL; + ServerObject const *portallizedObject = nullptr; if (!JavaLibrary::getObject(target, portallizedObject)) return 0; @@ -387,11 +387,11 @@ jlongArray JNICALL ScriptMethodsInteriorsNamespace::getCellIds(JNIEnv *env, jobj cellIds.reserve(count); for (int i = 0; i < count; ++i) { - ServerObject const * cellObject = NULL; + ServerObject const * cellObject = nullptr; CellProperty const * const cellProp = portalProp->getCell(nameList[i]); - if (cellProp != NULL) + if (cellProp != nullptr) cellObject = cellProp->getOwner().asServerObject(); - if (cellObject != NULL) + if (cellObject != nullptr) { cellIds.push_back(cellObject->getNetworkId()); } @@ -412,7 +412,7 @@ jboolean JNICALL ScriptMethodsInteriorsNamespace::hasCell(JNIEnv *env, jobject s { JavaStringParam localCellName(cellName); - ServerObject const * serverObject = NULL; + ServerObject const * serverObject = nullptr; if (!JavaLibrary::getObject(portallizedObject, serverObject)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("JavaLibrary::hasCell passed invalid object")); @@ -448,7 +448,7 @@ jlong JNICALL ScriptMethodsInteriorsNamespace::getCellId(JNIEnv *env, jobject se { JavaStringParam localCellName(cellName); - ServerObject const * serverObject = NULL; + ServerObject const * serverObject = nullptr; if (!JavaLibrary::getObject(portallizedObject, serverObject)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("[script bug] JavaLibrary::getCellId passed invalid object")); @@ -571,7 +571,7 @@ jobject JNICALL ScriptMethodsInteriorsNamespace::getBuildingEjectLocation(JNIEnv if (building == 0) { - DEBUG_WARNING(true, ("[designer bug] getBuildingEjectLocation was passed a NULL building objid")); + DEBUG_WARNING(true, ("[designer bug] getBuildingEjectLocation was passed a nullptr building objid")); return 0; } @@ -598,7 +598,7 @@ jobject JNICALL ScriptMethodsInteriorsNamespace::getBuildingEjectLocation(JNIEnv CellProperty const *worldCell = CellProperty::getWorldCellProperty(); if (!worldCell) { - DEBUG_WARNING(true, ("getBuildingEjectLocation get a NULL worldCell back from CellProperty::getWorldCellProperty()")); + DEBUG_WARNING(true, ("getBuildingEjectLocation get a nullptr worldCell back from CellProperty::getWorldCellProperty()")); return 0; } @@ -666,7 +666,7 @@ jlong JNICALL ScriptMethodsInteriorsNamespace::moveHouseItemToPlayer(JNIEnv * /* { if (building == 0) { - DEBUG_WARNING(true, ("[designer bug] moveHouseItemToPlayer was passed a NULL building objid")); + DEBUG_WARNING(true, ("[designer bug] moveHouseItemToPlayer was passed a nullptr building objid")); return 0; } @@ -693,7 +693,7 @@ jlong JNICALL ScriptMethodsInteriorsNamespace::moveHouseItemToPlayer2(JNIEnv * / { if (building == 0) { - DEBUG_WARNING(true, ("[designer bug] moveHouseItemToPlayer2 was passed a NULL building objid")); + DEBUG_WARNING(true, ("[designer bug] moveHouseItemToPlayer2 was passed a nullptr building objid")); return 0; } @@ -721,7 +721,7 @@ void JNICALL ScriptMethodsInteriorsNamespace::deleteAllHouseItems(JNIEnv * /*env { if (building == 0) { - DEBUG_WARNING(true, ("[designer bug] deleteAllHouseItems was passed a NULL building objid")); + DEBUG_WARNING(true, ("[designer bug] deleteAllHouseItems was passed a nullptr building objid")); return ; } @@ -747,11 +747,11 @@ jboolean JNICALL ScriptMethodsInteriorsNamespace::areAllContentsLoaded(JNIEnv * { if (building == 0) { - DEBUG_WARNING(true, ("[designer bug] areAllContentsLoaded was passed a NULL building objid")); + DEBUG_WARNING(true, ("[designer bug] areAllContentsLoaded was passed a nullptr building objid")); return JNI_FALSE; } - const BuildingObject * buildingObject = NULL; + const BuildingObject * buildingObject = nullptr; if (!JavaLibrary::getObject(building, buildingObject)) { DEBUG_WARNING(true, ("[designer bug] areAllContentsLoaded was passed a non-ServerObject objid")); @@ -767,11 +767,11 @@ void JNICALL ScriptMethodsInteriorsNamespace::loadBuildingContents(JNIEnv * /*en { if (building == 0) { - DEBUG_WARNING(true, ("[designer bug] loadBuildingContents was passed a NULL building objid")); + DEBUG_WARNING(true, ("[designer bug] loadBuildingContents was passed a nullptr building objid")); return; } - BuildingObject * buildingObject = NULL; + BuildingObject * buildingObject = nullptr; if (!JavaLibrary::getObject(building, buildingObject)) { DEBUG_WARNING(true, ("[designer bug] loadBuildingContents was passed a non-ServerObject objid")); @@ -815,9 +815,9 @@ jboolean JNICALL ScriptMethodsInteriorsNamespace::isAtPendingLoadRequestLimit(JN jstring JNICALL ScriptMethodsInteriorsNamespace::getCellLabel(JNIEnv * env, jobject self, jlong target) { - CellObject const *cellObject = NULL; + CellObject const *cellObject = nullptr; if (!JavaLibrary::getObject(target, cellObject)) - return NULL; + return nullptr; JavaString cellLabel(cellObject->getCellLabel()); return cellLabel.getReturnValue(); @@ -833,7 +833,7 @@ jboolean JNICALL ScriptMethodsInteriorsNamespace::setCellLabel(JNIEnv * env, job if (!JavaLibrary::convert(localCellLabel, cellLabelString)) return JNI_FALSE; - CellObject * cellObject = NULL; + CellObject * cellObject = nullptr; if (!JavaLibrary::getObject(target, cellObject)) return JNI_FALSE; @@ -846,7 +846,7 @@ jboolean JNICALL ScriptMethodsInteriorsNamespace::setCellLabel(JNIEnv * env, job jboolean JNICALL ScriptMethodsInteriorsNamespace::setCellLabelOffset(JNIEnv * env, jobject self, jlong target, jfloat x, jfloat y, jfloat z) { - CellObject * cellObject = NULL; + CellObject * cellObject = nullptr; if (!JavaLibrary::getObject(target, cellObject)) return JNI_FALSE; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsJedi.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsJedi.cpp index 1afeec06..188193c7 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsJedi.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsJedi.cpp @@ -120,7 +120,7 @@ jint JNICALL ScriptMethodsJediNamespace::getMaxForcePower(JNIEnv *env, jobject s { UNREF(self); - const CreatureObject * creature = NULL; + const CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return 0; @@ -128,7 +128,7 @@ jint JNICALL ScriptMethodsJediNamespace::getMaxForcePower(JNIEnv *env, jobject s return 0; PlayerObject const * const playerObject = PlayerCreatureController::getPlayerObject(creature); - if (playerObject == NULL) + if (playerObject == nullptr) return 0; return playerObject->getMaxForcePower(); @@ -148,7 +148,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::setMaxForcePower(JNIEnv *env, jobje { UNREF(self); - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -159,7 +159,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::setMaxForcePower(JNIEnv *env, jobje } PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(creature); - if (playerObject == NULL) + if (playerObject == nullptr) return JNI_FALSE; playerObject->setMaxForcePower(value); @@ -180,7 +180,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::alterMaxForcePower(JNIEnv *env, job { UNREF(self); - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -191,7 +191,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::alterMaxForcePower(JNIEnv *env, job } PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(creature); - if (playerObject == NULL) + if (playerObject == nullptr) return JNI_FALSE; playerObject->setMaxForcePower(playerObject->getMaxForcePower() + delta); @@ -211,7 +211,7 @@ jint JNICALL ScriptMethodsJediNamespace::getForcePower(JNIEnv *env, jobject self { UNREF(self); - const CreatureObject * creature = NULL; + const CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return 0; @@ -219,7 +219,7 @@ jint JNICALL ScriptMethodsJediNamespace::getForcePower(JNIEnv *env, jobject self return 0; PlayerObject const * const playerObject = PlayerCreatureController::getPlayerObject(creature); - if (playerObject == NULL) + if (playerObject == nullptr) return 0; return playerObject->getForcePower(); @@ -239,7 +239,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::setForcePower(JNIEnv *env, jobject { UNREF(self); - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -250,7 +250,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::setForcePower(JNIEnv *env, jobject } PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(creature); - if (playerObject == NULL) + if (playerObject == nullptr) return JNI_FALSE; playerObject->setForcePower(value); @@ -271,7 +271,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::alterForcePower(JNIEnv *env, jobjec { UNREF(self); - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -282,7 +282,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::alterForcePower(JNIEnv *env, jobjec } PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(creature); - if (playerObject == NULL) + if (playerObject == nullptr) return JNI_FALSE; playerObject->setForcePower(playerObject->getForcePower() + delta); @@ -302,7 +302,7 @@ jfloat JNICALL ScriptMethodsJediNamespace::getForcePowerRegenRate(JNIEnv *env, j { UNREF(self); - const CreatureObject * creature = NULL; + const CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return 0; @@ -310,7 +310,7 @@ jfloat JNICALL ScriptMethodsJediNamespace::getForcePowerRegenRate(JNIEnv *env, j return 0; PlayerObject const * const playerObject = PlayerCreatureController::getPlayerObject(creature); - if (playerObject == NULL) + if (playerObject == nullptr) return 0; return playerObject->getForcePowerRegenRate(); @@ -330,7 +330,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::setForcePowerRegenRate(JNIEnv *env, { UNREF(self); - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -341,7 +341,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::setForcePowerRegenRate(JNIEnv *env, } PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(creature); - if (playerObject == NULL) + if (playerObject == nullptr) return JNI_FALSE; playerObject->setForcePowerRegenRate(rate); @@ -359,7 +359,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::setForcePowerRegenRate(JNIEnv *env, */ jint JNICALL ScriptMethodsJediNamespace::getJediState(JNIEnv *env, jobject self, jlong jedi) { - const CreatureObject * object = NULL; + const CreatureObject * object = nullptr; if (!JavaLibrary::getObject(jedi, object)) { WARNING(true, ("JavaLibrary::getJediState did not find creature for id passed in")); @@ -367,7 +367,7 @@ jint JNICALL ScriptMethodsJediNamespace::getJediState(JNIEnv *env, jobject self, } const SwgPlayerObject * player = safe_cast(PlayerCreatureController::getPlayerObject(object)); - if (player == NULL) + if (player == nullptr) { WARNING(true, ("JavaLibrary::getJediState did not find player for creature " "%s", object->getNetworkId().getValueString().c_str())); @@ -389,12 +389,12 @@ jint JNICALL ScriptMethodsJediNamespace::getJediState(JNIEnv *env, jobject self, */ jboolean JNICALL ScriptMethodsJediNamespace::setJediState(JNIEnv *env, jobject self, jlong jedi, jint state) { - CreatureObject * object = NULL; + CreatureObject * object = nullptr; if (!JavaLibrary::getObject(jedi, object)) return JNI_FALSE; SwgPlayerObject * const player = safe_cast(PlayerCreatureController::getPlayerObject(object)); - if (player == NULL) + if (player == nullptr) return JNI_FALSE; if (state == JS_none || @@ -424,7 +424,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::setJediState(JNIEnv *env, jobject s */ jboolean JNICALL ScriptMethodsJediNamespace::hasJediSlot(JNIEnv * env, jobject self, jlong target) { - const ServerObject * player = NULL; + const ServerObject * player = nullptr; if (!JavaLibrary::getObject(target, player)) return JNI_FALSE; @@ -444,12 +444,12 @@ jboolean JNICALL ScriptMethodsJediNamespace::hasJediSlot(JNIEnv * env, jobject s */ jboolean JNICALL ScriptMethodsJediNamespace::addJediSlot(JNIEnv * env, jobject self, jlong target) { - const CreatureObject * object = NULL; + const CreatureObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; PlayerObject const * const player = PlayerCreatureController::getPlayerObject(object); - if (player == NULL) + if (player == nullptr) return JNI_FALSE; player->addJediToAccount(); @@ -475,12 +475,12 @@ jboolean JNICALL ScriptMethodsJediNamespace::isJedi(JNIEnv * env, jobject self, { UNREF(self); - const CreatureObject * creature = NULL; + const CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; const PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); - if (player == NULL) + if (player == nullptr) return JNI_FALSE; const SwgPlayerObject * jedi = safe_cast(player); @@ -502,12 +502,12 @@ jint JNICALL ScriptMethodsJediNamespace::getJediVisibility(JNIEnv * env, jobject { UNREF(self); - const CreatureObject * creature = NULL; + const CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return -1; const PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); - if (player == NULL) + if (player == nullptr) return JNI_FALSE; const SwgPlayerObject * jedi = safe_cast(player); @@ -531,12 +531,12 @@ jboolean JNICALL ScriptMethodsJediNamespace::setJediVisibility(JNIEnv * env, job { UNREF(self); - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); - if (player == NULL) + if (player == nullptr) return JNI_FALSE; SwgPlayerObject * jedi = safe_cast(player); @@ -561,12 +561,12 @@ jboolean JNICALL ScriptMethodsJediNamespace::changeJediVisibility(JNIEnv * env, { UNREF(self); - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); - if (player == NULL) + if (player == nullptr) return JNI_FALSE; SwgPlayerObject * jedi = safe_cast(player); @@ -591,19 +591,19 @@ jboolean JNICALL ScriptMethodsJediNamespace::setJediBountyValue(JNIEnv * env, jo { UNREF(self); - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; SwgCreatureObject const * jediCreature = safe_cast(creature); PlayerObject const * player = PlayerCreatureController::getPlayerObject(creature); - if (player == NULL) + if (player == nullptr) return JNI_FALSE; SwgPlayerObject const * jediPlayer = safe_cast(player); JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager == NULL) + if (jediManager == nullptr) return JNI_FALSE; jediManager->addJedi(creature->getNetworkId(), creature->getObjectName(), @@ -631,7 +631,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::setJediBountyValue(JNIEnv * env, jo * @param bounties limit for number of bounties on the Jedi statistic * @param state what state(s) the Jedi should have * - * @return a dictionary with the Jedi data on success, null on error + * @return a dictionary with the Jedi data on success, nullptr on error */ jobject JNICALL ScriptMethodsJediNamespace::requestJedi(JNIEnv * env, jobject self, jint visibility, jint bountyValue, jint minLevel, jint maxLevel, jint hoursAlive, jint bounties, jint state) @@ -640,7 +640,7 @@ jobject JNICALL ScriptMethodsJediNamespace::requestJedi(JNIEnv * env, jobject se JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager == NULL) + if (jediManager == nullptr) return 0; ScriptParams params; @@ -658,7 +658,7 @@ jobject JNICALL ScriptMethodsJediNamespace::requestJedi(JNIEnv * env, jobject se * @param self class calling this function * @param target the id of the Jedi * - * @return a dictionary with the Jedi data on success, null on error + * @return a dictionary with the Jedi data on success, nullptr on error */ jobject JNICALL ScriptMethodsJediNamespace::requestOneJedi(JNIEnv * env, jobject self, jlong target) { @@ -666,7 +666,7 @@ jobject JNICALL ScriptMethodsJediNamespace::requestOneJedi(JNIEnv * env, jobject JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager == NULL) + if (jediManager == nullptr) return 0; const NetworkId id(target); @@ -704,7 +704,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::requestJediBounty(JNIEnv * env, job JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager == NULL) + if (jediManager == nullptr) return JNI_FALSE; const NetworkId targetId(target); @@ -751,7 +751,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::removeJediBounty(JNIEnv * env, jobj JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager == NULL) + if (jediManager == nullptr) return JNI_FALSE; const NetworkId targetId(target); @@ -781,7 +781,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::removeAllJediBounties(JNIEnv * env, JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager == NULL) + if (jediManager == nullptr) return JNI_FALSE; const NetworkId targetId(target); @@ -799,7 +799,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::removeAllJediBounties(JNIEnv * env, * @param self class calling this function * @param target the Jedi * - * @return an array of hunter ids, or null on error + * @return an array of hunter ids, or nullptr on error */ jlongArray JNICALL ScriptMethodsJediNamespace::getJediBounties(JNIEnv * env, jobject self, jlong target) { @@ -807,7 +807,7 @@ jlongArray JNICALL ScriptMethodsJediNamespace::getJediBounties(JNIEnv * env, job JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager == NULL) + if (jediManager == nullptr) return 0; const NetworkId targetId(target); @@ -837,7 +837,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::isBeingHuntedByBountyHunter(JNIEnv JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager == NULL) + if (jediManager == nullptr) return JNI_FALSE; const NetworkId targetId(target); @@ -861,7 +861,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::isBeingHuntedByBountyHunter(JNIEnv * @param self class calling this function * @param hunter the bounty hunter * - * @return an array of jedi ids, or null on error + * @return an array of jedi ids, or nullptr on error */ jlongArray JNICALL ScriptMethodsJediNamespace::getBountyHunterBounties(JNIEnv * env, jobject self, jlong hunter) { @@ -869,7 +869,7 @@ jlongArray JNICALL ScriptMethodsJediNamespace::getBountyHunterBounties(JNIEnv * JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager == NULL) + if (jediManager == nullptr) return 0; const NetworkId hunterId(hunter); @@ -899,7 +899,7 @@ void JNICALL ScriptMethodsJediNamespace::updateJediScriptData(JNIEnv * env, jobj { JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager == NULL) + if (jediManager == nullptr) return; const NetworkId targetId(target); @@ -926,7 +926,7 @@ void JNICALL ScriptMethodsJediNamespace::removeJediScriptData(JNIEnv * env, jobj { JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager == NULL) + if (jediManager == nullptr) return; const NetworkId targetId(target); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsMap.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsMap.cpp index 9bcaa8d8..9d7f4dc1 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsMap.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsMap.cpp @@ -253,7 +253,7 @@ jobjectArray JNICALL ScriptMethodsMapNamespace::getPlanetaryMapLocations( if(!JavaLibrary::convert(localCategory, categoryName)) { DEBUG_WARNING(true, ("[script bug] invalid category passed to getPlanetaryMapLocations")); - return NULL; + return nullptr; } } @@ -264,7 +264,7 @@ jobjectArray JNICALL ScriptMethodsMapNamespace::getPlanetaryMapLocations( if(!JavaLibrary::convert(localSubCategory, subCategoryName)) { DEBUG_WARNING(true, ("[script bug] invalid SubCategory passed to getPlanetaryMapLocations")); - return NULL; + return nullptr; } } @@ -282,12 +282,12 @@ jobjectArray JNICALL ScriptMethodsMapNamespace::getPlanetaryMapLocations( jlong jLocationId = mapLocation.getLocationId().getValue(); if (!jLocationId) - return NULL; + return nullptr; JavaString jNameString(mapLocation.getLocationName()); if (jNameString.getValue() == 0) - return NULL; + return nullptr; LocalRefPtr jMapLocation = createNewObject(JavaLibrary::getClsMapLocation(), JavaLibrary::getMidMapLocation(), @@ -299,7 +299,7 @@ jobjectArray JNICALL ScriptMethodsMapNamespace::getPlanetaryMapLocations( static_cast (mapLocation.getFlags())); if (jMapLocation == LocalRef::cms_nullPtr) - return NULL; + return nullptr; setObjectArrayElement(*jlocs, index, *jMapLocation); } @@ -318,7 +318,7 @@ jobjectArray JNICALL ScriptMethodsMapNamespace::getPlanetaryMapCategories (JNI if(!JavaLibrary::convert(localCategory, categoryName)) { DEBUG_WARNING(true, ("[script bug] invalid category passed to getPlanetaryMapCategories")); - return NULL; + return nullptr; } } @@ -350,14 +350,14 @@ jobject JNICALL ScriptMethodsMapNamespace::getPlanetaryMapLocation (JNI if (id == NetworkId::cms_invalid) { DEBUG_WARNING(true, ("[script bug] invalid locationId passed to getPlanetaryMapCategories")); - return NULL; + return nullptr; } int mlt = 0; const MapLocation * const mapLocation = PlanetMapManagerServer::getLocation (id, mlt); if (!mapLocation) - return NULL; + return nullptr; const JavaString jLocName (mapLocation->m_locationName); const JavaString jLocCategoryName (PlanetMapManager::findCategoryName (mapLocation->m_category)); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsMentalStates.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsMentalStates.cpp index c4dd20c1..fc11623f 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsMentalStates.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsMentalStates.cpp @@ -310,7 +310,7 @@ jboolean JNICALL ScriptMethodsMentalStatesNamespace::addMentalStateModifier(JNIE * @param mob id of creature to access * @param mentalState mental state we are interested in * - * @return the mental state modifiers for the creature, or null if it has none + * @return the mental state modifiers for the creature, or nullptr if it has none */ jobjectArray JNICALL ScriptMethodsMentalStatesNamespace::getMentalStateModifiers(JNIEnv *env, jobject self, jlong mob, jint mentalState) { @@ -697,7 +697,7 @@ jboolean JNICALL ScriptMethodsMentalStatesNamespace::addMentalStateModifierTowar * @param mob id of creature to access * @param mentalState mental state we are interested in * - * @return the mental state modifiers for the creature, or null if it has none + * @return the mental state modifiers for the creature, or nullptr if it has none */ jobjectArray JNICALL ScriptMethodsMentalStatesNamespace::getMentalStateModifiersToward(JNIEnv *env, jobject self, jlong mob, jlong target, jint mentalState) { diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsMission.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsMission.cpp index 815bb35a..13e82707 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsMission.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsMission.cpp @@ -170,17 +170,17 @@ void JNICALL ScriptMethodsMissionNamespace::abortMission(JNIEnv * env, jobject s } else { - DEBUG_WARNING(true, ("[designer bug] abortMission() missionObject is NULL")); + DEBUG_WARNING(true, ("[designer bug] abortMission() missionObject is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] abortMission() self is NULL")); + DEBUG_WARNING(true, ("[programmer bug] abortMission() self is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] abortMission() JNIEnv is NULL")); + DEBUG_WARNING(true, ("[programmer bug] abortMission() JNIEnv is nullptr")); } } @@ -283,17 +283,17 @@ jstring JNICALL ScriptMethodsMissionNamespace::getMissionCreator(JNIEnv * env, j } else { - DEBUG_WARNING(true, ("[designer bug] getMissionCreator() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] getMissionCreator() missionObject (parameter 1) is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] getMissionCreator() self is NULL")); + DEBUG_WARNING(true, ("[programmer bug] getMissionCreator() self is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] getMissionCreator() JNIEnv is NULL")); + DEBUG_WARNING(true, ("[programmer bug] getMissionCreator() JNIEnv is nullptr")); } return result; } @@ -304,13 +304,13 @@ jobject JNICALL ScriptMethodsMissionNamespace::getMissionDescription(JNIEnv * en { if(! env) { - DEBUG_WARNING(true, ("[programmer bug] getMissionDescription() JNIEnv is NULL")); + DEBUG_WARNING(true, ("[programmer bug] getMissionDescription() JNIEnv is nullptr")); return 0; } if(! missionObject) { - DEBUG_WARNING(true, ("[designer bug] getMissionDescription() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] getMissionDescription() missionObject (parameter 1) is nullptr")); return 0; } @@ -352,17 +352,17 @@ jint JNICALL ScriptMethodsMissionNamespace::getMissionDifficulty(JNIEnv * env, j } else { - DEBUG_WARNING(true, ("[designer bug] getMissionDifficulty() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] getMissionDifficulty() missionObject (parameter 1) is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] getMissionDifficulty() self is NULL")); + DEBUG_WARNING(true, ("[programmer bug] getMissionDifficulty() self is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] getMissionDifficulty() JNIEnv is NULL")); + DEBUG_WARNING(true, ("[programmer bug] getMissionDifficulty() JNIEnv is nullptr")); } return result; } @@ -390,7 +390,7 @@ jobject JNICALL ScriptMethodsMissionNamespace::getMissionEndLocation(JNIEnv * en } else { - DEBUG_WARNING(true, ("[designer bug] getMissionEndLocation() missionObject (parameter1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] getMissionEndLocation() missionObject (parameter1) is nullptr")); } return 0; } @@ -418,17 +418,17 @@ jint JNICALL ScriptMethodsMissionNamespace::getMissionReward(JNIEnv * env, jobje } else { - DEBUG_WARNING(true, ("[designer bug] getMissionReward() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] getMissionReward() missionObject (parameter 1) is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] getMissionReward() self is NULL")); + DEBUG_WARNING(true, ("[programmer bug] getMissionReward() self is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] getMissionReward() JNIEnv is NULL")); + DEBUG_WARNING(true, ("[programmer bug] getMissionReward() JNIEnv is nullptr")); } return result; } @@ -454,7 +454,7 @@ jobject JNICALL ScriptMethodsMissionNamespace::getMissionStartLocation(JNIEnv * } else { - DEBUG_WARNING(true, ("[designer bug] getMissionStartLocation() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] getMissionStartLocation() missionObject (parameter 1) is nullptr")); } return 0; } @@ -483,7 +483,7 @@ jstring JNICALL ScriptMethodsMissionNamespace::getMissionTargetName(JNIEnv * env } else { - DEBUG_WARNING(true, ("[designer bug] getMissionTargetName() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] getMissionTargetName() missionObject (parameter 1) is nullptr")); } return 0; } @@ -494,7 +494,7 @@ jobject JNICALL ScriptMethodsMissionNamespace::getMissionTitle(JNIEnv * env, job { if(! missionObject) { - DEBUG_WARNING(true, ("[designer bug] getMissionTitle() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] getMissionTitle() missionObject (parameter 1) is nullptr")); return 0; } @@ -537,7 +537,7 @@ jstring JNICALL ScriptMethodsMissionNamespace::getMissionType(JNIEnv * env, jobj } else { - DEBUG_WARNING(true, ("[designer bug] getMissionType() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] getMissionType() missionObject (parameter 1) is nullptr")); } return 0; } @@ -556,7 +556,7 @@ jlong JNICALL ScriptMethodsMissionNamespace::getMissionHolder(JNIEnv * env, jobj MissionObject * mo = 0; if(JavaLibrary::getObject(missionObject, mo)) { - if (mo != NULL && mo->getMissionHolderId() != NetworkId::cms_invalid) + if (mo != nullptr && mo->getMissionHolderId() != NetworkId::cms_invalid) { result = (mo->getMissionHolderId()).getValue(); } @@ -572,17 +572,17 @@ jlong JNICALL ScriptMethodsMissionNamespace::getMissionHolder(JNIEnv * env, jobj } else { - DEBUG_WARNING(true, ("[designer bug] getMissionHolder() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] getMissionHolder() missionObject (parameter 1) is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] getMissionHolder() self is NULL")); + DEBUG_WARNING(true, ("[programmer bug] getMissionHolder() self is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] getMissionHolder() JNIEnv is NULL")); + DEBUG_WARNING(true, ("[programmer bug] getMissionHolder() JNIEnv is nullptr")); } return result; } @@ -609,7 +609,7 @@ jstring JNICALL ScriptMethodsMissionNamespace::getMissionRootScriptName(JNIEnv * } else { - DEBUG_WARNING(true, ("[designer bug] getMissionRootScriptName() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] getMissionRootScriptName() missionObject (parameter 1) is nullptr")); } return 0; } @@ -641,22 +641,22 @@ void JNICALL ScriptMethodsMissionNamespace::setMissionCreator(JNIEnv *env, jobje } else { - DEBUG_WARNING(true, ("[designer bug] setMissionCreator() creator (parameter 2) is NULL")); + DEBUG_WARNING(true, ("[designer bug] setMissionCreator() creator (parameter 2) is nullptr")); } } else { - DEBUG_WARNING(true, ("[designer bug] setMissionCreator() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] setMissionCreator() missionObject (parameter 1) is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionCreator() self is NULL")); + DEBUG_WARNING(true, ("[programmer bug] setMissionCreator() self is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionCreator() JNIEnv is NULL")); + DEBUG_WARNING(true, ("[programmer bug] setMissionCreator() JNIEnv is nullptr")); } } @@ -686,7 +686,7 @@ void JNICALL ScriptMethodsMissionNamespace::setMissionDescription(JNIEnv * env, } else { - DEBUG_WARNING(true, ("[designer bug] setMissionDescription() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] setMissionDescription() missionObject (parameter 1) is nullptr")); } } @@ -708,7 +708,7 @@ void JNICALL ScriptMethodsMissionNamespace::setMissionDifficulty(JNIEnv * env, j } else { - DEBUG_WARNING(true, ("[designer bug] setMissionDifficulty() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] setMissionDifficulty() missionObject (parameter 1) is nullptr")); } } @@ -764,17 +764,17 @@ void JNICALL ScriptMethodsMissionNamespace::setMissionReward(JNIEnv * env, jobje } else { - DEBUG_WARNING(true, ("[designer bug] setMissionProfessionRank() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] setMissionProfessionRank() missionObject (parameter 1) is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionProfessionRank() self is NULL")); + DEBUG_WARNING(true, ("[programmer bug] setMissionProfessionRank() self is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionProfessionRank() JNIEnv is NULL")); + DEBUG_WARNING(true, ("[programmer bug] setMissionProfessionRank() JNIEnv is nullptr")); } } @@ -806,7 +806,7 @@ void JNICALL ScriptMethodsMissionNamespace::setMissionStartLocation(JNIEnv * env } else { - DEBUG_WARNING(true, ("[designer bug] setMissionStartLocation() location (parameter 2) is NULL")); + DEBUG_WARNING(true, ("[designer bug] setMissionStartLocation() location (parameter 2) is nullptr")); } } else @@ -816,17 +816,17 @@ void JNICALL ScriptMethodsMissionNamespace::setMissionStartLocation(JNIEnv * env } else { - DEBUG_WARNING(true, ("[designer bug] setMissionStartLocation() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] setMissionStartLocation() missionObject (parameter 1) is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionStartLocation() self is NULL")); + DEBUG_WARNING(true, ("[programmer bug] setMissionStartLocation() self is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionStartLocation() JNIEnv is NULL")); + DEBUG_WARNING(true, ("[programmer bug] setMissionStartLocation() JNIEnv is nullptr")); } } @@ -856,17 +856,17 @@ void JNICALL ScriptMethodsMissionNamespace::setMissionTargetAppearance(JNIEnv * } else { - DEBUG_WARNING(true, ("[designer bug] setMissionTarget() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] setMissionTarget() missionObject (parameter 1) is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionTarget() self is NULL")); + DEBUG_WARNING(true, ("[programmer bug] setMissionTarget() self is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionTarget() JNIEnv is NULL")); + DEBUG_WARNING(true, ("[programmer bug] setMissionTarget() JNIEnv is nullptr")); } } @@ -896,17 +896,17 @@ void JNICALL ScriptMethodsMissionNamespace::setMissionTargetName(JNIEnv * env, j } else { - DEBUG_WARNING(true, ("[designer bug] setMissionTarget() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] setMissionTarget() missionObject (parameter 1) is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionTarget() self is NULL")); + DEBUG_WARNING(true, ("[programmer bug] setMissionTarget() self is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionTarget() JNIEnv is NULL")); + DEBUG_WARNING(true, ("[programmer bug] setMissionTarget() JNIEnv is nullptr")); } } @@ -936,7 +936,7 @@ void JNICALL ScriptMethodsMissionNamespace::setMissionTitle(JNIEnv * env, jobjec } else { - DEBUG_WARNING(true, ("[designer bug] setMissionTitle() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] setMissionTitle() missionObject (parameter 1) is nullptr")); } } @@ -969,22 +969,22 @@ void JNICALL ScriptMethodsMissionNamespace::setMissionType(JNIEnv *env, jobject } else { - DEBUG_WARNING(true, ("[designer bug] setMissionType() typeName (parameter 2) is NULL")); + DEBUG_WARNING(true, ("[designer bug] setMissionType() typeName (parameter 2) is nullptr")); } } else { - DEBUG_WARNING(true, ("[designer bug] setMissionType() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] setMissionType() missionObject (parameter 1) is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionType() self is NULL")); + DEBUG_WARNING(true, ("[programmer bug] setMissionType() self is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionType() JNIEnv is NULL")); + DEBUG_WARNING(true, ("[programmer bug] setMissionType() JNIEnv is nullptr")); } } @@ -1022,22 +1022,22 @@ void JNICALL ScriptMethodsMissionNamespace::setMissionRootScriptName(JNIEnv *env } else { - DEBUG_WARNING(true, ("[designer bug] setMissionRootScriptName() rootScriptName (parameter 2) is NULL")); + DEBUG_WARNING(true, ("[designer bug] setMissionRootScriptName() rootScriptName (parameter 2) is nullptr")); } } else { - DEBUG_WARNING(true, ("[designer bug] setMissionRootScriptName() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] setMissionRootScriptName() missionObject (parameter 1) is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionRootScriptName() self is NULL")); + DEBUG_WARNING(true, ("[programmer bug] setMissionRootScriptName() self is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionRootScriptName() JNIEnv is NULL")); + DEBUG_WARNING(true, ("[programmer bug] setMissionRootScriptName() JNIEnv is nullptr")); } } diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsMoney.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsMoney.cpp index 542b801e..d0afcd98 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsMoney.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsMoney.cpp @@ -110,7 +110,7 @@ jboolean JNICALL ScriptMethodsMoneyNamespace::transferCashTo(JNIEnv *env, jobjec return JNI_FALSE; ServerObject *sourceObj = ServerWorld::findObjectByNetworkId(sourceObjId); - if (sourceObj == NULL || targetObjId == NetworkId::cms_invalid || ownerOID == NetworkId::cms_invalid) + if (sourceObj == nullptr || targetObjId == NetworkId::cms_invalid || ownerOID == NetworkId::cms_invalid) return JNI_FALSE; // Do money transfer (will be forwarded if object is not authoritative) @@ -157,7 +157,7 @@ jboolean JNICALL ScriptMethodsMoneyNamespace::transferBankCreditsTo(JNIEnv *env, return JNI_FALSE; ServerObject *sourceObj = ServerWorld::findObjectByNetworkId(sourceObjId); - if (sourceObj == NULL || targetObjId == NetworkId::cms_invalid || ownerOID == NetworkId::cms_invalid) + if (sourceObj == nullptr || targetObjId == NetworkId::cms_invalid || ownerOID == NetworkId::cms_invalid) return JNI_FALSE; // Do money transfer (will be forwarded if object is not authoritative) @@ -203,7 +203,7 @@ jboolean JNICALL ScriptMethodsMoneyNamespace::withdrawCashFromBank (JNIEnv *env, return JNI_FALSE; ServerObject *sourceObj = ServerWorld::findObjectByNetworkId(sourceObjId); - if (sourceObj == NULL || ownerOID == NetworkId::cms_invalid) + if (sourceObj == nullptr || ownerOID == NetworkId::cms_invalid) return JNI_FALSE; // Do money transfer (will be forwarded if object is not authoritative) @@ -243,7 +243,7 @@ jboolean JNICALL ScriptMethodsMoneyNamespace::depositCashToBank(JNIEnv *env, job if (failCallbackFunction != 0 && !JavaLibrary::convert(JavaStringParam(failCallbackFunction), failCallback)) return JNI_FALSE; - ServerObject *sourceObj = NULL; + ServerObject *sourceObj = nullptr; if (!JavaLibrary::getObject(source, sourceObj)) return JNI_FALSE; @@ -260,7 +260,7 @@ jboolean JNICALL ScriptMethodsMoneyNamespace::depositCashToBank(JNIEnv *env, job void JNICALL ScriptMethodsMoneyNamespace::depositToGalacticReserve(JNIEnv *env, jobject self, jlong player) { - CreatureObject * objPlayer = NULL; + CreatureObject * objPlayer = nullptr; if (!JavaLibrary::getObject(player, objPlayer) || !objPlayer) return; @@ -275,7 +275,7 @@ void JNICALL ScriptMethodsMoneyNamespace::depositToGalacticReserve(JNIEnv *env, void JNICALL ScriptMethodsMoneyNamespace::withdrawFromGalacticReserve(JNIEnv *env, jobject self, jlong player) { - CreatureObject * objPlayer = NULL; + CreatureObject * objPlayer = nullptr; if (!JavaLibrary::getObject(player, objPlayer) || !objPlayer) return; @@ -290,7 +290,7 @@ void JNICALL ScriptMethodsMoneyNamespace::withdrawFromGalacticReserve(JNIEnv *en jboolean JNICALL ScriptMethodsMoneyNamespace::canAccessGalacticReserve(JNIEnv *env, jobject self, jlong player) { - CreatureObject * objPlayer = NULL; + CreatureObject * objPlayer = nullptr; if (!JavaLibrary::getObject(player, objPlayer) || !objPlayer) return JNI_FALSE; @@ -376,7 +376,7 @@ jboolean JNICALL ScriptMethodsMoneyNamespace::transferBankCreditsToNamedAccount( return JNI_FALSE; ServerObject *sourceObj = ServerWorld::findObjectByNetworkId(sourceObjId); - if (sourceObj == NULL || targetString.size() == 0 || ownerOID == NetworkId::cms_invalid) + if (sourceObj == nullptr || targetString.size() == 0 || ownerOID == NetworkId::cms_invalid) return JNI_FALSE; // Do money transfer (will be forwarded if object is not authoritative) @@ -426,7 +426,7 @@ jboolean JNICALL ScriptMethodsMoneyNamespace::transferBankCreditsFromNamedAccoun return JNI_FALSE; ServerObject *targetObj = ServerWorld::findObjectByNetworkId(targetObjId); - if (targetObj == NULL || sourceString.size() == 0 || ownerOID == NetworkId::cms_invalid) + if (targetObj == nullptr || sourceString.size() == 0 || ownerOID == NetworkId::cms_invalid) return JNI_FALSE; // Do money transfer (will be forwarded if object is not authoritative) diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsMount.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsMount.cpp index 4f0e9c9f..2779be7b 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsMount.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsMount.cpp @@ -235,7 +235,7 @@ void JNICALL ScriptMethodsMountNamespace::dismountCreature(JNIEnv *env, jobject CreatureObject *const mountObject = riderObject->getMountedCreature(); if (!mountObject) { - LOG(LOCAL_LOG_CHANNEL, ("JavaLibrary::dismountCreature(): server id=[%d],rider id=[%s] has RidingMount state but CreatureObject::getMountedCreature() returns NULL, skipping dismount.", GameServer::getInstance().getProcessId(), riderObject->getNetworkId().getValueString().c_str())); + LOG(LOCAL_LOG_CHANNEL, ("JavaLibrary::dismountCreature(): server id=[%d],rider id=[%s] has RidingMount state but CreatureObject::getMountedCreature() returns nullptr, skipping dismount.", GameServer::getInstance().getProcessId(), riderObject->getNetworkId().getValueString().c_str())); return; } @@ -393,7 +393,7 @@ void JNICALL JNICALL ScriptMethodsMountNamespace::makeContainerStateInconsistent //-- Get the ServerObject from the object id. if (!containedObjectId) { - LOG("script-bug", ("makeContainerStateInconsistentTestOnly(): containedObjectId is NULL")); + LOG("script-bug", ("makeContainerStateInconsistentTestOnly(): containedObjectId is nullptr")); return; } @@ -428,7 +428,7 @@ void JNICALL JNICALL ScriptMethodsMountNamespace::makeContainerStateInconsistent Container* container = ContainerInterface::getContainer(*containerObject); if (!container) { - LOG("script-bug", ("makeContainerStateInconsistentTestOnly(): containerObject [%s] returned a NULL container", containerObject->getNetworkId().getValueString().c_str())); + LOG("script-bug", ("makeContainerStateInconsistentTestOnly(): containerObject [%s] returned a nullptr container", containerObject->getNetworkId().getValueString().c_str())); return; } diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsNewbieTutorial.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsNewbieTutorial.cpp index b94f7349..037b7ff5 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsNewbieTutorial.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsNewbieTutorial.cpp @@ -439,7 +439,7 @@ jobject JNICALL ScriptMethodsNewbieTutorialNamespace::getStartingLocationInf if (!jName) { - WARNING (true, ("getStartingLocationInfo null name")); + WARNING (true, ("getStartingLocationInfo nullptr name")); return JNI_FALSE; } diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsNotification.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsNotification.cpp index 8c8cff43..06d6b672 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsNotification.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsNotification.cpp @@ -52,7 +52,7 @@ const JNINativeMethod NATIVES[] = { jint JNICALL ScriptMethodsNotificationNamespace::addNotification(JNIEnv *env, jobject self, jlong player, jstring contents, jboolean useNotificationIcon, jint iconStyle, jfloat timeout, jint channel, jstring sound) { - CreatureObject const * playerObject = NULL; + CreatureObject const * playerObject = nullptr; if (!JavaLibrary::getObject(player, playerObject)) return 0; @@ -79,7 +79,7 @@ jint JNICALL ScriptMethodsNotificationNamespace::addNotification(JNIEnv *env, jo void JNICALL ScriptMethodsNotificationNamespace::cancelNotification(JNIEnv *env, jobject self, jlong player, jint notification) { - CreatureObject const * playerObject = NULL; + CreatureObject const * playerObject = nullptr; if (!JavaLibrary::getObject(player, playerObject)) return; ClientNotificationBoxMessage cnbm(notification, playerObject->getNetworkId(), Unicode::emptyString, FALSE, 0, 0.0f, ClientNotificationBoxMessage::NC_SPECIAL_CANCEL, std::string("")); @@ -94,7 +94,7 @@ void JNICALL ScriptMethodsNotificationNamespace::cancelNotification(JNIEnv *env, void JNICALL ScriptMethodsNotificationNamespace::cancelAllNotifications(JNIEnv *env, jobject self, jlong player) { - CreatureObject const * playerObject = NULL; + CreatureObject const * playerObject = nullptr; if (!JavaLibrary::getObject(player, playerObject)) return; ClientNotificationBoxMessage cnbm(0, playerObject->getNetworkId(), Unicode::emptyString, FALSE, 0, 0.0f, ClientNotificationBoxMessage::NC_SPECIAL_CANCEL_ALL, std::string("")); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsNpc.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsNpc.cpp index a617593b..f9c5e4ed 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsNpc.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsNpc.cpp @@ -190,14 +190,14 @@ jboolean JNICALL ScriptMethodsNpcNamespace::_npcStartConversation(JNIEnv *env, j if (!JavaLibrary::convert (localConvoName, convoNameStr)) return JNI_FALSE; - TangibleObject * playerObject = NULL; + TangibleObject * playerObject = nullptr; if (!JavaLibrary::getObject(player, playerObject)) return JNI_FALSE; if (playerObject->isInNpcConversation()) return JNI_FALSE; - TangibleObject * npcObject = NULL; + TangibleObject * npcObject = nullptr; if (!JavaLibrary::getObject(npc, npcObject)) return JNI_FALSE; @@ -234,7 +234,7 @@ jboolean JNICALL ScriptMethodsNpcNamespace::_npcStartConversation(JNIEnv *env, j jboolean JNICALL ScriptMethodsNpcNamespace::npcStartConversation(JNIEnv *env, jobject self, jlong player, jlong npc, jstring convoName, jobject greeting, jstring greetingOob, jobjectArray responses) { - TangibleObject * speakerObject = NULL; + TangibleObject * speakerObject = nullptr; if (!JavaLibrary::getObject(npc, speakerObject) || !speakerObject) return JNI_FALSE; @@ -243,7 +243,7 @@ jboolean JNICALL ScriptMethodsNpcNamespace::npcStartConversation(JNIEnv *env, jo uint32 crc = Crc::crcNull; ObjectTemplate const * const ot = ObjectTemplateList::fetch(conversationAppearanceOverride); - ServerObjectTemplate const * const sot = ot ? ot->asServerObjectTemplate() : NULL; + ServerObjectTemplate const * const sot = ot ? ot->asServerObjectTemplate() : nullptr; if(sot) { std::string const & sharedTemplateName = sot->getSharedTemplate(); @@ -263,7 +263,7 @@ jboolean JNICALL ScriptMethodsNpcNamespace::npcStartConversationAppearanceOverri return JNI_FALSE; ObjectTemplate const * const ot = ObjectTemplateList::fetch(appearanceOverrideSharedTemplateNameStr); - ServerObjectTemplate const * const sot = ot ? ot->asServerObjectTemplate() : NULL; + ServerObjectTemplate const * const sot = ot ? ot->asServerObjectTemplate() : nullptr; if(!sot) { return JNI_FALSE; @@ -290,7 +290,7 @@ jboolean JNICALL ScriptMethodsNpcNamespace::npcEndConversation(JNIEnv *env, jobj { UNREF(self); - TangibleObject * playerObject = NULL; + TangibleObject * playerObject = nullptr; if (!JavaLibrary::getObject(player, playerObject)) return JNI_FALSE; @@ -318,7 +318,7 @@ jboolean JNICALL ScriptMethodsNpcNamespace::npcSpeak(JNIEnv *env, jobject self, { UNREF(self); - TangibleObject * playerObject = NULL; + TangibleObject * playerObject = nullptr; if (!JavaLibrary::getObject(player, playerObject)) return JNI_FALSE; @@ -367,7 +367,7 @@ jboolean JNICALL ScriptMethodsNpcNamespace::npcSetConversationResponses(JNIEnv * { UNREF(self); - TangibleObject * playerObject = NULL; + TangibleObject * playerObject = nullptr; if (!JavaLibrary::getObject(player, playerObject)) return JNI_FALSE; @@ -396,7 +396,7 @@ jboolean JNICALL ScriptMethodsNpcNamespace::npcAddConversationResponse(JNIEnv *e { UNREF(self); - TangibleObject * playerObject = NULL; + TangibleObject * playerObject = nullptr; if (!JavaLibrary::getObject(player, playerObject)) return JNI_FALSE; @@ -455,7 +455,7 @@ jboolean JNICALL ScriptMethodsNpcNamespace::npcRemoveConversationResponse(JNIEnv { UNREF(self); - TangibleObject * playerObject = NULL; + TangibleObject * playerObject = nullptr; if (!JavaLibrary::getObject(player, playerObject)) return JNI_FALSE; @@ -488,7 +488,7 @@ jboolean JNICALL ScriptMethodsNpcNamespace::isInNpcConversation(JNIEnv *env, job { UNREF(self); - TangibleObject * tangibleObject = NULL; + TangibleObject * tangibleObject = nullptr; if (!JavaLibrary::getObject(creature, tangibleObject)) return JNI_FALSE; @@ -506,13 +506,13 @@ jboolean JNICALL ScriptMethodsNpcNamespace::isInNpcConversation(JNIEnv *env, job * @param self class calling this function * @param creature creature being asked about * - * @return an array of obj_ids the creature is in conversation with, or null on error + * @return an array of obj_ids the creature is in conversation with, or nullptr on error */ jlongArray JNICALL ScriptMethodsNpcNamespace::getNpcConversants(JNIEnv *env, jobject self, jlong creature) { UNREF(self); - TangibleObject * tangibleObject = NULL; + TangibleObject * tangibleObject = nullptr; if (!JavaLibrary::getObject(creature, tangibleObject)) return 0; @@ -621,7 +621,7 @@ jboolean JNICALL ScriptMethodsNpcNamespace::isNameReservedIgnoreRules(JNIEnv *en jboolean JNICALL ScriptMethodsNpcNamespace::npcEndConversationWithMessage(JNIEnv * /*env*/, jobject /*self*/, jlong player, jobject response, jstring responseOob) { - TangibleObject * playerObject = NULL; + TangibleObject * playerObject = nullptr; if(!JavaLibrary::getObject(player, playerObject)) return JNI_FALSE; @@ -658,7 +658,7 @@ jboolean JNICALL ScriptMethodsNpcNamespace::npcEndConversationWithMessage(JNIEnv jboolean JNICALL ScriptMethodsNpcNamespace::setNpcDifficulty(JNIEnv *env, jobject self, jlong npc, jlong difficulty) { - TangibleObject * npcObject = NULL; + TangibleObject * npcObject = nullptr; if (!JavaLibrary::getObject(npc, npcObject)) return JNI_FALSE; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsObjectCreate.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsObjectCreate.cpp index 37ab2bac..2f967f59 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsObjectCreate.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsObjectCreate.cpp @@ -257,11 +257,11 @@ jlong ScriptMethodsObjectCreateNamespace::createTheater(const std::vector float centerX = minx + dx / 2.0f + center.x; float centerZ = minz + dz / 2.0f + center.z; - TerrainGenerator::Layer * layer = NULL; + TerrainGenerator::Layer * layer = nullptr; if (locationType == IntangibleObject::TLT_flatten) { layer = TerrainModificationHelper::importLayer(THEATER_FLATTEN_LAYER.c_str()); - if (layer == NULL) + if (layer == nullptr) { WARNING (true, ("Layer %s not found for theater, using getGoodLocation " "instead", THEATER_FLATTEN_LAYER.c_str())); @@ -292,7 +292,7 @@ jlong ScriptMethodsObjectCreateNamespace::createTheater(const std::vector IntangibleObject * theater = safe_cast(ServerWorld::createNewObject(THEATER_TEMPLATE, tr, 0, false)); NOT_NULL(theater); theater->setTheater(); - if (layer != NULL) + if (layer != nullptr) { theater->setLayer(layer); } @@ -328,7 +328,7 @@ jlong ScriptMethodsObjectCreateNamespace::createTheater(const std::vector * @param source the template id or the object id to create the object with * @param location where to put the object * - * @return the new object, or null on error + * @return the new object, or nullptr on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInWorld(JNIEnv *env, jobject self, jlong source, jobject location) { @@ -340,7 +340,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInWorld(JNIEnv // determine what source is and create the object std::string localName; - ServerObject* object = NULL; + ServerObject* object = nullptr; if (!JavaLibrary::getObject(source, object)) return 0; localName = object->getTemplateName(); @@ -366,7 +366,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInWorld(JNIEnv * @param source the template id or the object id to create the object with * @param location where to put the object * - * @return the new object, or null on error + * @return the new object, or nullptr on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInWorldString(JNIEnv *env, jobject self, jobject source, jobject location) { @@ -445,7 +445,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectAt(JNIEnv *env, * @param container the object we want to put our new object into * @param slot the container slot we want to put the object in * - * @return the new object, or null on error + * @return the new object, or nullptr on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInContainer(JNIEnv *env, jobject self, jlong source, jlong container, jstring slot) { @@ -457,7 +457,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInContainer(JNI // determine what source is and create the object std::string templateName; - const ServerObject* object = NULL; + const ServerObject* object = nullptr; if (!JavaLibrary::getObject(source, object)) return 0; templateName = object->getTemplateName(); @@ -536,7 +536,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInContainerOver // determine what source is and create the object std::string templateName; - const ServerObject* object = NULL; + const ServerObject* object = nullptr; if (!JavaLibrary::getObject(source, object)) return 0; templateName = object->getTemplateName(); @@ -598,7 +598,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInContainerOver * @param sourceName the template name used to create the object * @param target the creature to create the object in * - * @return the obj_id of the created object, or null on error + * @return the obj_id of the created object, or nullptr on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInInventoryOverloaded(JNIEnv *env, jobject self, jstring sourceName, jlong target) { @@ -624,7 +624,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInInventoryOver * @param sourceCrc the template crc to create the object with * @param location where to put the object * - * @return the new object, or null on error + * @return the new object, or nullptr on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectCrc(JNIEnv *env, jobject self, int sourceCrc, jobject location) { @@ -656,7 +656,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectCrc(JNIEnv *env Transform tr; tr.setPosition_p(newPos); ServerObject *newObject = ServerWorld::createNewObject(sourceCrc, tr, cell, false); - if (newObject != NULL) + if (newObject != nullptr) { // get the networkId to return NetworkId netId = newObject->getNetworkId(); @@ -693,7 +693,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectCrc(JNIEnv *env * @param container the object we want to put our new object into * @param slot the container slot we want to put the object in * - * @return the new object, or null on error + * @return the new object, or nullptr on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInContainerCrc(JNIEnv *env, jobject self, int sourceCrc, jlong container, jstring slot) { @@ -707,10 +707,10 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInContainerCrc( return 0; // make sure the container exists - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) return 0; - if (ContainerInterface::getContainer(*containerOwner) == NULL) + if (ContainerInterface::getContainer(*containerOwner) == nullptr) return 0; //Create the object @@ -773,10 +773,10 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInContainerOver return 0; // make sure the container exists - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) return 0; - if (ContainerInterface::getVolumeContainer(*containerOwner) == NULL) + if (ContainerInterface::getVolumeContainer(*containerOwner) == nullptr) { DEBUG_WARNING(true, ("createObjectin an overloaded container only works on volume containers")); return 0; @@ -811,7 +811,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInContainerOver * @param sourceCrc the template crc used to create the object * @param target the creature to create the object in * - * @return the obj_id of the created object, or null on error + * @return the obj_id of the created object, or nullptr on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInInventoryOverloadedCrc( JNIEnv *env, jobject self, int sourceCrc, jlong target) @@ -819,16 +819,16 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInInventoryOver if (sourceCrc == 0 || target == 0) return 0; - CreatureObject * targetObject = NULL; + CreatureObject * targetObject = nullptr; if (!JavaLibrary::getObject(target, targetObject)) return 0; ServerObject * inventory = targetObject->getInventory(); - if (inventory == NULL) + if (inventory == nullptr) return 0; VolumeContainer * volContainer = ContainerInterface::getVolumeContainer(*inventory); - if (volContainer == NULL) + if (volContainer == nullptr) return 0; int oldCapacity = volContainer->debugDoNotUseSetCapacity(-1); @@ -838,7 +838,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInInventoryOver volContainer->debugDoNotUseSetCapacity(oldCapacity); volContainer->recalculateVolume(); - if (newObject == NULL) + if (newObject == nullptr) return 0; return (newObject->getNetworkId()).getValue(); @@ -852,7 +852,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInInventoryOver * @param self class calling this function * @param sourceCrc the template crc of the new object to create * @param target an object whose location and container/cell will be used to create the object. - * @return the obj_id of the created object, or null on error + * @return the obj_id of the created object, or nullptr on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectAtCrc(JNIEnv *env, jobject self, int sourceCrc, jlong target) { @@ -863,7 +863,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectAtCrc(JNIEnv *e if (target == 0) return 0; - ServerObject *sourceObject = NULL; + ServerObject *sourceObject = nullptr; if (!JavaLibrary::getObject(target, sourceObject)) return 0; @@ -878,7 +878,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectAtCrc(JNIEnv *e Transform tr; tr.setPosition_p(sourceObject->getPosition_p()); ServerObject *newObject = ServerWorld::createNewObject(sourceCrc, tr, cell, false); - if (newObject == NULL) + if (newObject == nullptr) { fprintf(stderr, "WARNING: Could not create object from crc %d\n", sourceCrc); JavaLibrary::printJavaStack(); @@ -911,7 +911,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectAtCrc(JNIEnv *e * @param source the template id or the object id to create the object with * @param location where to put the object * - * @return the new object, or null on error + * @return the new object, or nullptr on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectSimulator(JNIEnv *env, jobject self, jstring source, jobject location) { @@ -963,7 +963,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectSimulator(JNIEn Transform tr; tr.setPosition_p(newPos); ServerObject *newObject = ServerWorld::createNewObject(sourceCrc, tr, cell, false); - if (newObject != NULL) + if (newObject != nullptr) { // add on the player object CreatureObject * creature = dynamic_cast(newObject); @@ -1007,7 +1007,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectSimulator(JNIEn */ jboolean JNICALL ScriptMethodsObjectCreateNamespace::destroyObjectSimulator(JNIEnv *env, jobject self, jlong target) { - CreatureObject *playerObject = NULL; + CreatureObject *playerObject = nullptr; // get the object if (!JavaLibrary::getObject(target, playerObject)) { @@ -1046,7 +1046,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::destroyObject(JNIEnv *env, if (targetId == NetworkId::cms_invalid) return JNI_FALSE; - ServerObject* object = NULL; + ServerObject* object = nullptr; bool retval = JavaLibrary::getObject(target, object); if (!retval || !object) // || object->isPersisted()) will be done in permanently destroy @@ -1060,7 +1060,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::destroyObject(JNIEnv *env, { // check if the object is in a FactoryObject crate Object * container = ContainerInterface::getContainedByObject(*object); - if (container != NULL && dynamic_cast(container) != NULL) + if (container != nullptr && dynamic_cast(container) != nullptr) { // destroy an object in the factory; if it is the last object, // the factory will destroy itself @@ -1093,7 +1093,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::destroyObjectHyperspace(JNI if (targetId == NetworkId::cms_invalid) return JNI_FALSE; - ServerObject * object = NULL; + ServerObject * object = nullptr; bool retval = JavaLibrary::getObject(target, object); if(retval && object) { @@ -1120,7 +1120,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::persistObject(JNIEnv *env, UNREF(self); NOT_NULL(env); - ServerObject* object = NULL; + ServerObject* object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; if (object->persist()) { @@ -1144,7 +1144,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::isObjectPersisted(JNIEnv *e UNREF(self); NOT_NULL(env); - ServerObject* object = NULL; + ServerObject* object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -1320,7 +1320,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectTransformCrcInt * @param name the name of the theater * @param locationType how to create the theater * - * @return the id of the master theater object, or null on error (bad datatable name or position) + * @return the id of the master theater object, or nullptr on error (bad datatable name or position) */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createTheaterDatatableOnly(JNIEnv *env, jobject self, jstring datatable, jlong caller, jstring name, jint locationType) { @@ -1347,7 +1347,7 @@ int i; // read the object data from the datatable DataTable * dt = DataTableManager::getTable(datatableName, true); - if (dt == NULL) + if (dt == nullptr) { WARNING(true, ("JavaLibrary::createTheaterDatatable could not open " "datatable %s", datatableName.c_str())); @@ -1429,7 +1429,7 @@ int i; * @param name the name of the theater * @param locationType how to create the theater * - * @return the id of the master theater object, or null on error (bad datatable name or position) + * @return the id of the master theater object, or nullptr on error (bad datatable name or position) */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createTheaterDatatable(JNIEnv *env, jobject self, jstring datatable, jobject basePosition, jstring script, jlong caller, jstring name, jint locationType) { @@ -1466,7 +1466,7 @@ int i; // read the object data from the datatable DataTable * dt = DataTableManager::getTable(datatableName, true); - if (dt == NULL) + if (dt == nullptr) { WARNING(true, ("JavaLibrary::createTheaterDatatable could not open " "datatable %s", datatableName.c_str())); @@ -1567,7 +1567,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::createRemoteTheaterDatatabl // read the object data from the datatable DataTable * dt = DataTableManager::getTable(datatableName, true); - if (dt == NULL) + if (dt == nullptr) { WARNING(true, ("JavaLibrary::createRemoteTheaterDatatable could not open " "datatable %s", datatableName.c_str())); @@ -1613,7 +1613,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::createRemoteTheaterDatatabl params.addParam(locationType, "locationType"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() == NULL) + if (dictionary.get() == nullptr) { WARNING(true, ("JavaLibrary::createRemoteTheaterDatatable could not " "create dictionary for theater datatable %s", datatableName.c_str())); @@ -1624,7 +1624,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::createRemoteTheaterDatatabl Transform tr; tr.setPosition_p(location); ServerObject * spawner = ServerWorld::createNewObject("object/tangible/spawning/remote_theater_spawner.iff", tr, 0, false); - if (spawner == NULL) + if (spawner == nullptr) { WARNING(true, ("JavaLibrary::createRemoteTheaterDatatable unable to " "create remote theater spawner for datatable %s", datatableName.c_str())); @@ -1704,7 +1704,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::createRemoteTheaterDatatabl // read the object data from the datatable DataTable * dt = DataTableManager::getTable(datatableName, true); - if (dt == NULL) + if (dt == nullptr) { WARNING(true, ("JavaLibrary::createRemoteTheaterDatatable could not open " "datatable %s", datatableName.c_str())); @@ -1734,7 +1734,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::createRemoteTheaterDatatabl params.addParam(locationType, "locationType"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() == NULL) + if (dictionary.get() == nullptr) { WARNING(true, ("JavaLibrary::createRemoteTheaterDatatable could not " "create dictionary for theater datatable %s", datatableName.c_str())); @@ -1747,7 +1747,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::createRemoteTheaterDatatabl Transform tr; tr.setPosition_p(theaterCenter); ServerObject * spawner = ServerWorld::createNewObject("object/tangible/spawning/remote_theater_spawner.iff", tr, 0, false); - if (spawner == NULL) + if (spawner == nullptr) { WARNING(true, ("JavaLibrary::createRemoteTheaterDatatable unable to " "create remote theater spawner for datatable %s", datatableName.c_str())); @@ -1778,7 +1778,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::createRemoteTheaterDatatabl * theater objects have been created * @param caller who's creating the theater * - * @return the id of the master theater object, or null on error + * @return the id of the master theater object, or nullptr on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createTheaterCrc(JNIEnv *env, jobject self, jintArray crcs, jobjectArray positions, jobject basePosition, jstring script, jlong caller) { @@ -1843,7 +1843,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createTheaterCrc(JNIEnv *env, * theater objects have been created * @param caller who's creating the theater * - * @return the id of the master theater object, or null on error + * @return the id of the master theater object, or nullptr on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createTheaterString(JNIEnv *env, jobject self, jobjectArray templates, jobjectArray positions, jobject basePosition, jstring script, jlong caller) { @@ -1922,13 +1922,13 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::assignTheaterToPlayer(JNIEn JavaStringParam jdatatable(datatable); - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(playerId, playerCreature)) return JNI_FALSE; PlayerObject * const player = PlayerCreatureController::getPlayerObject( playerCreature); - if (player == NULL) + if (player == nullptr) return JNI_FALSE; if (player->hasTheater()) @@ -1962,7 +1962,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::assignTheaterToPlayer(JNIEn // read the object data from the datatable DataTable * dt = DataTableManager::getTable(datatableName, true); - if (dt == NULL) + if (dt == nullptr) { WARNING(true, ("JavaLibrary::assignTheaterToPlayer could not open " "datatable %s", datatableName.c_str())); @@ -2026,13 +2026,13 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::assignTheaterToPlayerLocati JavaStringParam jdatatable(datatable); JavaStringParam jscript(script); - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(playerId, playerCreature)) return JNI_FALSE; PlayerObject * const player = PlayerCreatureController::getPlayerObject( playerCreature); - if (player == NULL) + if (player == nullptr) return JNI_FALSE; std::string datatableName; @@ -2094,13 +2094,13 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::unassignTheaterFromPlayer(J if (playerId == 0) return JNI_FALSE; - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(playerId, playerCreature)) return JNI_FALSE; PlayerObject * const player = PlayerCreatureController::getPlayerObject( playerCreature); - if (player == NULL) + if (player == nullptr) return JNI_FALSE; player->clearTheater(); @@ -2123,13 +2123,13 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::hasTheaterAssigned(JNIEnv * if (playerId == 0) return JNI_FALSE; - const CreatureObject * playerCreature = NULL; + const CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(playerId, playerCreature)) return JNI_FALSE; const PlayerObject * player = PlayerCreatureController::getPlayerObject( playerCreature); - if (player == NULL) + if (player == nullptr) return JNI_FALSE; return player->hasTheater(); @@ -2142,7 +2142,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::hasTheaterAssigned(JNIEnv * * * @param theater the theater id * - * @return the theater's name, or null if it doesn't have one + * @return the theater's name, or nullptr if it doesn't have one */ jstring JNICALL ScriptMethodsObjectCreateNamespace::getTheaterName(JNIEnv *env, jobject self, jlong theater) { @@ -2167,7 +2167,7 @@ jstring JNICALL ScriptMethodsObjectCreateNamespace::getTheaterName(JNIEnv *env, * * @param name the theater name to look for * - * @return the theater's id, or null if the theater doesn't exist + * @return the theater's id, or nullptr if the theater doesn't exist */ jlong JNICALL ScriptMethodsObjectCreateNamespace::findTheater(JNIEnv *env, jobject self, jstring name) { @@ -2196,7 +2196,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::findTheater(JNIEnv *env, jobje * @param draftSchematic the draft schematic template to create the manufacturing schematic from * @param container the container to put the manufacturing schematic in * - * @return the id of the manufacturing schematic, or null on error + * @return the id of the manufacturing schematic, or nullptr on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createSchematicString(JNIEnv *env, jobject self, jstring draftSchematic, jlong container) { @@ -2222,25 +2222,25 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createSchematicString(JNIEnv * * @param draftSchematicCrc the draft schematic template crc value to create the manufacturing schematic from * @param container the container to put the manufacturing schematic in * - * @return the id of the manufacturing schematic, or null on error + * @return the id of the manufacturing schematic, or nullptr on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createSchematicCrc(JNIEnv *env, jobject self, jint draftSchematicCrc, jlong container) { if (draftSchematicCrc == 0 || container == 0) return 0; - ServerObject * containerObject = NULL; + ServerObject * containerObject = nullptr; if (!JavaLibrary::getObject(container, containerObject)) return 0; const DraftSchematicObject * const draftSchematic = DraftSchematicObject::getSchematic( draftSchematicCrc); - if (draftSchematic == NULL) + if (draftSchematic == nullptr) return 0; ManufactureSchematicObject * manfSchematic = ServerWorld::createNewManufacturingSchematic( *draftSchematic, *containerObject, false); - if (manfSchematic == NULL) + if (manfSchematic == nullptr) return 0; return (manfSchematic->getNetworkId()).getValue(); @@ -2260,7 +2260,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createSchematicCrc(JNIEnv *env jboolean JNICALL ScriptMethodsObjectCreateNamespace::updateNetworkTriggerVolume(JNIEnv *env, jobject self, jlong target, jfloat radius) { - ServerObject * object = NULL; + ServerObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsObjectInfo.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsObjectInfo.cpp index c50ab576..b285e0be 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsObjectInfo.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsObjectInfo.cpp @@ -561,15 +561,15 @@ void ScriptMethodsObjectInfoNamespace::getGoodItemsFromContainer(const Container { const ServerObject * owner = safe_cast( ContainerInterface::getFirstParentInWorld(container.getOwner())); - const ServerObject * ownerInventory = NULL; - const ServerObject * ownerDatapad = NULL; - const ServerObject * ownerAppearanceInventory = NULL; - const ServerObject * ownerHangar = NULL; + const ServerObject * ownerInventory = nullptr; + const ServerObject * ownerDatapad = nullptr; + const ServerObject * ownerAppearanceInventory = nullptr; + const ServerObject * ownerHangar = nullptr; - if (owner != NULL) + if (owner != nullptr) { const CreatureObject * creature = owner->asCreatureObject(); - if (creature != NULL) + if (creature != nullptr) { ownerInventory = creature->getInventory(); ownerDatapad = creature->getDatapad(); @@ -583,7 +583,7 @@ void ScriptMethodsObjectInfoNamespace::getGoodItemsFromContainer(const Container const CachedNetworkId & itemId = *i; const ServerObject * item = safe_cast( itemId.getObject()); - if (item != NULL && item->asTangibleObject() != NULL && + if (item != nullptr && item->asTangibleObject() != nullptr && item->asTangibleObject()->isVisible()) { // @@ -591,14 +591,14 @@ void ScriptMethodsObjectInfoNamespace::getGoodItemsFromContainer(const Container // // no player inventory - if (ownerInventory != NULL && ownerInventory->getNetworkId() == + if (ownerInventory != nullptr && ownerInventory->getNetworkId() == item->getNetworkId()) { continue; } // no player datapad - if (ownerDatapad != NULL && ownerDatapad->getNetworkId() == + if (ownerDatapad != nullptr && ownerDatapad->getNetworkId() == item->getNetworkId()) { continue; @@ -613,14 +613,14 @@ void ScriptMethodsObjectInfoNamespace::getGoodItemsFromContainer(const Container continue; // no creatures (pets/droids) - if (item->asCreatureObject() != NULL) + if (item->asCreatureObject() != nullptr) continue; // no hair const ServerObjectTemplate * itemTemplate = safe_cast< const ServerObjectTemplate *>(item->getObjectTemplate()); NOT_NULL(itemTemplate); - if (strstr(itemTemplate->getName(), "tangible/hair") != NULL) + if (strstr(itemTemplate->getName(), "tangible/hair") != nullptr) continue; // no Trandoshan feet @@ -631,7 +631,7 @@ void ScriptMethodsObjectInfoNamespace::getGoodItemsFromContainer(const Container // see if the item is a container and go through its contents const Container * itemContainer = ContainerInterface::getContainer(*item); - if (itemContainer != NULL) + if (itemContainer != nullptr) getGoodItemsFromContainer(*itemContainer, goodItems); } } @@ -644,7 +644,7 @@ void ScriptMethodsObjectInfoNamespace::getGoodItemsFromContainer(const Container * @param self class calling this function * @param jtemplateCrcs the template crcs * - * @return the names, or null on error + * @return the names, or nullptr on error */ jobjectArray ScriptMethodsObjectInfoNamespace::getNamesFromCrcs(JNIEnv *env, const std::vector & templateCrcs) @@ -661,7 +661,7 @@ jobjectArray ScriptMethodsObjectInfoNamespace::getNamesFromCrcs(JNIEnv *env, // get the server template const ObjectTemplate * ot = ObjectTemplateList::fetch(templateCrcs[i]); - if (ot == NULL) + if (ot == nullptr) { WARNING(true, ("JavaLibrary::getNamesFromTemplateCrcs: Could not " "find object template for crc %d", templateCrcs[i])); @@ -670,13 +670,13 @@ jobjectArray ScriptMethodsObjectInfoNamespace::getNamesFromCrcs(JNIEnv *env, // get the shared template const ServerObjectTemplate * serverOt = ot->asServerObjectTemplate(); - if (serverOt != NULL) + if (serverOt != nullptr) { const std::string sharedTemplateName(serverOt->getSharedTemplate()); serverOt->releaseReference(); - serverOt = NULL; + serverOt = nullptr; ot = ObjectTemplateList::fetch(sharedTemplateName); - if (ot == NULL) + if (ot == nullptr) { WARNING(true, ("JavaLibrary::getNamesFromTemplateCrcs: Could not " "find shared object template %s", sharedTemplateName.c_str())); @@ -685,18 +685,18 @@ jobjectArray ScriptMethodsObjectInfoNamespace::getNamesFromCrcs(JNIEnv *env, } const SharedObjectTemplate * sharedOt = ot->asSharedObjectTemplate(); - if (sharedOt == NULL) + if (sharedOt == nullptr) { WARNING(true, ("JavaLibrary::getNamesFromTemplateCrcs: template %s " "is not a shared template", ot->getName())); ot->releaseReference(); continue; } - ot = NULL; + ot = nullptr; const StringId objectName(sharedOt->getObjectName()); sharedOt->releaseReference(); - sharedOt = NULL; + sharedOt = nullptr; LocalRefPtr jobjectName; if (ScriptConversion::convert(objectName, jobjectName)) @@ -734,7 +734,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setNameFromString(JNIEnv *env JavaStringParam localName(name); - ServerObject* object = NULL; + ServerObject* object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -813,7 +813,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::setDescriptionStringId(JNIEnv * e * @param self class calling this function * @param target id of object whose name to get * -* @return the description, or null on error +* @return the description, or nullptr on error */ jobject JNICALL ScriptMethodsObjectInfoNamespace::getDescriptionStringId(JNIEnv * env, jobject self, jlong target) { @@ -837,13 +837,13 @@ jobject JNICALL ScriptMethodsObjectInfoNamespace::getDescriptionStringId(JNIEnv * @param self class calling this function * @param target id of object whose name to get * - * @return the name, or null on error + * @return the name, or nullptr on error */ jstring JNICALL ScriptMethodsObjectInfoNamespace::getName(JNIEnv *env, jobject self, jlong target) { UNREF(self); - ServerObject* object = NULL; + ServerObject* object = nullptr; if (!JavaLibrary::getObject(target, object)) return 0; @@ -859,7 +859,7 @@ jstring JNICALL ScriptMethodsObjectInfoNamespace::getName(JNIEnv *env, jobject s * @param self class calling this function * @param player id of the player to get * - * @return the name, or null on error + * @return the name, or nullptr on error */ jstring JNICALL ScriptMethodsObjectInfoNamespace::getPlayerName(JNIEnv *env, jobject self, jlong target) { @@ -894,13 +894,13 @@ jstring JNICALL ScriptMethodsObjectInfoNamespace::getPlayerFullName(JNIEnv *env, * @param self class calling this function * @param target id of object whose name to get * - * @return the name, or null on error + * @return the name, or nullptr on error */ jstring JNICALL ScriptMethodsObjectInfoNamespace::getAssignedName(JNIEnv *env, jobject self, jlong target) { UNREF(self); - ServerObject* object = NULL; + ServerObject* object = nullptr; if (!JavaLibrary::getObject(target, object)) return 0; @@ -915,7 +915,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::setCreatureName(JNIEnv * /*env*/, NetworkId const networkId(creature); CreatureObject * const creatureObject = CreatureObject::getCreatureObject(networkId); - if (creatureObject == NULL) + if (creatureObject == nullptr) { WARNING(true, ("ERROR: ScriptMethodsObjectInfo::setCreatureName() Unable to resolve the object(%s) to a CreatureObject.", networkId.getValueString().c_str())); return; @@ -923,7 +923,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::setCreatureName(JNIEnv * /*env*/, AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(creatureObject->getController()); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { WARNING(true, ("ERROR: ScriptMethodsObjectInfo::setCreatureName() Unable to resolve the object's(%s) controller to an AiCreatureController.", creatureObject->getDebugInformation().c_str())); return; @@ -941,14 +941,14 @@ jstring JNICALL ScriptMethodsObjectInfoNamespace::getCreatureName(JNIEnv * /*env NetworkId const networkId(creature); CreatureObject * const creatureObject = CreatureObject::getCreatureObject(networkId); - if (creatureObject == NULL) + if (creatureObject == nullptr) { return 0; } AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(creatureObject->getController()); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return 0; } @@ -972,13 +972,13 @@ jstring JNICALL ScriptMethodsObjectInfoNamespace::getCreatureName(JNIEnv * /*env * @param self class calling this function * @param target id of object whose name to get * - * @return the name, or null on error + * @return the name, or nullptr on error */ jobject JNICALL ScriptMethodsObjectInfoNamespace::getNameStringId(JNIEnv *env, jobject self, jlong target) { UNREF(self); - ServerObject* object = NULL; + ServerObject* object = nullptr; if (!JavaLibrary::getObject(target, object)) return 0; @@ -997,7 +997,7 @@ jobject JNICALL ScriptMethodsObjectInfoNamespace::getNameStringId(JNIEnv *env, j * @param self class calling this function * @param jtemplateName the template name * - * @return the name, or null if the template doesn't exist + * @return the name, or nullptr if the template doesn't exist */ jobject JNICALL ScriptMethodsObjectInfoNamespace::getNameFromTemplate(JNIEnv *env, jobject self, jstring jtemplateName) @@ -1020,41 +1020,41 @@ jobject JNICALL ScriptMethodsObjectInfoNamespace::getNameFromTemplate(JNIEnv *en * @param self class calling this function * @param templateCrc the template crc * - * @return the name, or null if the template doesn't exist + * @return the name, or nullptr if the template doesn't exist */ jobject JNICALL ScriptMethodsObjectInfoNamespace::getNameFromTemplateCrc(JNIEnv *env, jobject self, jint templateCrc) { const ObjectTemplate * ot = ObjectTemplateList::fetch(templateCrc); - if (ot == NULL) + if (ot == nullptr) return 0; // the name is stored in the shared template, so if this is a server template, // get the shared one from it - const SharedObjectTemplate * sharedOt = NULL; + const SharedObjectTemplate * sharedOt = nullptr; const ServerObjectTemplate * serverOt = dynamic_cast( ot); - if (serverOt != NULL) + if (serverOt != nullptr) { const std::string sharedTemplateName(serverOt->getSharedTemplate()); serverOt->releaseReference(); - serverOt = NULL; + serverOt = nullptr; ot = ObjectTemplateList::fetch(sharedTemplateName); - if (ot == NULL) + if (ot == nullptr) return 0; } sharedOt = dynamic_cast(ot); - if (sharedOt == NULL) + if (sharedOt == nullptr) { ot->releaseReference(); return 0; } - ot = NULL; + ot = nullptr; const StringId objectName(sharedOt->getObjectName()); sharedOt->releaseReference(); - sharedOt = NULL; + sharedOt = nullptr; LocalRefPtr jobjectName; if (!ScriptConversion::convert(objectName, jobjectName)) @@ -1069,7 +1069,7 @@ jobject JNICALL ScriptMethodsObjectInfoNamespace::getNameFromTemplateCrc(JNIEnv * @param self class calling this function * @param jtemplateNames the template names * - * @return the names, or null on error + * @return the names, or nullptr on error */ jobjectArray JNICALL ScriptMethodsObjectInfoNamespace::getNamesFromTemplates(JNIEnv *env, jobject self, jobjectArray jtemplateNames) @@ -1102,7 +1102,7 @@ jobjectArray JNICALL ScriptMethodsObjectInfoNamespace::getNamesFromTemplates(JNI * @param self class calling this function * @param jtemplateCrcs the template crcs * - * @return the names, or null on error + * @return the names, or nullptr on error */ jobjectArray JNICALL ScriptMethodsObjectInfoNamespace::getNamesFromTemplateCrcs(JNIEnv *env, jobject self, jintArray jtemplateCrcs) @@ -1140,7 +1140,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::internalIsAuthoritative(JNIEn { UNREF(self); - const ServerObject * object = NULL; + const ServerObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -1173,7 +1173,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::hasProxyOrAuthObject(JNIEnv * UNREF(self); - const ServerObject * object = NULL; + const ServerObject * object = nullptr; // if I'm not authoritative, then I must have an authoritative object on another game server // if I'm authoritative, then see if I'm proxied on any other game server @@ -1447,12 +1447,12 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isAwayFromKeyBoard(JNIEnv *en { UNREF(self); - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature)) return JNI_FALSE; PlayerObject * const playerObj = PlayerCreatureController::getPlayerObject(playerCreature); - if (playerObj != NULL && playerObj->isAwayFromKeyBoard()) + if (playerObj != nullptr && playerObj->isAwayFromKeyBoard()) { return JNI_TRUE; } @@ -1473,7 +1473,7 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getObjType(JNIEnv *env, jobject s { UNREF(self); - const Object *object = NULL; + const Object *object = nullptr; if (!JavaLibrary::getObject(target, object)) return -1; @@ -1487,13 +1487,13 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getObjType(JNIEnv *env, jobject s * @param self class calling this function * @param target object we want to check * - * @return the template type, or null on error + * @return the template type, or nullptr on error */ jstring JNICALL ScriptMethodsObjectInfoNamespace::getTemplateId(JNIEnv *env, jobject self, jlong target) { UNREF(self); - const Object *object = NULL; + const Object *object = nullptr; if (!JavaLibrary::getObject(target, object)) return 0; @@ -1507,12 +1507,12 @@ jstring JNICALL ScriptMethodsObjectInfoNamespace::getTemplateId(JNIEnv *env, job * @param self class calling this function * @param target object we want to check * - * @return the template type, or null on error + * @return the template type, or nullptr on error */ jstring JNICALL ScriptMethodsObjectInfoNamespace::getSharedObjectTemplateName(JNIEnv * /*env*/, jobject /*self*/, jlong target) { - Object const * object = NULL; + Object const * object = nullptr; if (!JavaLibrary::getObject(target, object)) return 0; @@ -2039,7 +2039,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isDisabled(JNIEnv *env, jobje return JNI_FALSE; // make sure the object isn't a creature or is a vehicle - if (object->asCreatureObject () != NULL && + if (object->asCreatureObject () != nullptr && !GameObjectTypes::isTypeOf (object->getGameObjectType (), SharedObjectTemplate::GOT_vehicle)) return JNI_FALSE; @@ -2093,7 +2093,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isCrafted(JNIEnv *env, jobjec return JNI_FALSE; // make sure the object isn't a creature - if (dynamic_cast(object) != NULL) + if (dynamic_cast(object) != nullptr) return JNI_FALSE; if (object->isCrafted()) @@ -2110,7 +2110,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isCrafted(JNIEnv *env, jobjec * @param self class calling this function * @param target object we want to know about * - * @return the crafter id, or null on error or if the item was not crafted + * @return the crafter id, or nullptr on error or if the item was not crafted */ jlong JNICALL ScriptMethodsObjectInfoNamespace::getCrafter(JNIEnv *env, jobject self, jlong target) { @@ -2168,7 +2168,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setCrafter(JNIEnv *env, jobje */ jfloat JNICALL ScriptMethodsObjectInfoNamespace::getScale(JNIEnv *env, jobject self, jlong target) { - const CreatureObject * creature = NULL; + const CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return -1.0f; @@ -2190,7 +2190,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setScale(JNIEnv *env, jobject if (scale <= 0) return JNI_FALSE; - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -2375,11 +2375,11 @@ jfloat JNICALL ScriptMethodsObjectInfoNamespace::getLocationDistance(JNIEnv *env // translate local coordinates to world coordinates Object * cell1 = NetworkIdManager::getObjectById(targetCell1); - if (cell1 == NULL) + if (cell1 == nullptr) return -1; const Vector & worldLoc1 = cell1->rotateTranslate_o2w(targetLoc1); Object * cell2 = NetworkIdManager::getObjectById(targetCell2); - if (cell2 == NULL) + if (cell2 == nullptr) return -1; const Vector & worldLoc2 = cell2->rotateTranslate_o2w(targetLoc2); @@ -2433,13 +2433,13 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isLocationInConicalFrustum(JN // translate local coordinates to world coordinates if they are in cells Object * testCell = NetworkIdManager::getObjectById(testCellId); - Vector testWorldLoc = (testCell != NULL) ? testCell->rotateTranslate_o2w(testLoc) : testLoc; + Vector testWorldLoc = (testCell != nullptr) ? testCell->rotateTranslate_o2w(testLoc) : testLoc; Object * startCell = NetworkIdManager::getObjectById(startCellId); - Vector startWorldLoc = (startCell != NULL) ? startCell->rotateTranslate_o2w(startLoc) : startLoc; + Vector startWorldLoc = (startCell != nullptr) ? startCell->rotateTranslate_o2w(startLoc) : startLoc; Object * endCell = NetworkIdManager::getObjectById(endCellId); - Vector endWorldLoc = (endCell != NULL) ? endCell->rotateTranslate_o2w(endLoc) : endLoc; + Vector endWorldLoc = (endCell != nullptr) ? endCell->rotateTranslate_o2w(endLoc) : endLoc; if(use2d) { @@ -2504,13 +2504,13 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isLocationInCone(JNIEnv *env, // translate local coordinates to world coordinates if they are in cells Object * testCell = NetworkIdManager::getObjectById(testCellId); - Vector const& testWorldLoc = (testCell != NULL) ? testCell->rotateTranslate_o2w(testLoc) : testLoc; + Vector const& testWorldLoc = (testCell != nullptr) ? testCell->rotateTranslate_o2w(testLoc) : testLoc; Object * startCell = NetworkIdManager::getObjectById(startCellId); - Vector const & startWorldLoc = (startCell != NULL) ? startCell->rotateTranslate_o2w(startLoc) : startLoc; + Vector const & startWorldLoc = (startCell != nullptr) ? startCell->rotateTranslate_o2w(startLoc) : startLoc; Object * endCell = NetworkIdManager::getObjectById(endCellId); - Vector const & endWorldLoc = (endCell != NULL) ? endCell->rotateTranslate_o2w(endLoc) : endLoc; + Vector const & endWorldLoc = (endCell != nullptr) ? endCell->rotateTranslate_o2w(endLoc) : endLoc; Vector testPointConeSpace = testWorldLoc - startWorldLoc; if(use2d) @@ -2606,7 +2606,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isInWorldCell(JNIEnv *env, jo UNREF(self); NOT_NULL(env); - ServerObject* object = NULL; + ServerObject* object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -2704,7 +2704,7 @@ namespace //-- validate arguments if (!customizationVariable || !context) { - DEBUG_FATAL(true, ("programmer error: callback made with NULL arguments.\n")); + DEBUG_FATAL(true, ("programmer error: callback made with nullptr arguments.\n")); return; } @@ -2736,7 +2736,7 @@ namespace * Java custom_var. * * @return the Java-accessible custom_var instance, the script-side counterpart to - * the given C++-side CustomizationVariable. Will return NULL if + * the given C++-side CustomizationVariable. Will return nullptr if * a Java exception or other error occurs. */ LocalRefPtr ScriptMethodsObjectInfoNamespace::createCustomVar(const jlong &objId, const std::string &variablePathName, CustomizationVariable &variable) @@ -2779,7 +2779,7 @@ LocalRefPtr ScriptMethodsObjectInfoNamespace::createCustomVar(const jlong &objId * Java custom_var. * * @return the Java-accessible ranged_int_custom_var instance, the script-side counterpart to - * the given C++-side CustomizationVariable. Will return NULL if + * the given C++-side CustomizationVariable. Will return nullptr if * a Java exception or other error occurs. */ LocalRefPtr ScriptMethodsObjectInfoNamespace::createRangedIntCustomVar(const jlong &objId, const std::string &variablePathName, RangedIntCustomizationVariable &rangedIntVariable) @@ -2818,7 +2818,7 @@ LocalRefPtr ScriptMethodsObjectInfoNamespace::createRangedIntCustomVar(const jlo * Java custom_var. * * @return the Java-accessible palcolor_custom_var instance, the script-side counterpart to - * the given C++-side CustomizationVariable. Will return NULL if + * the given C++-side CustomizationVariable. Will return nullptr if * a Java exception or other error occurs. */ LocalRefPtr ScriptMethodsObjectInfoNamespace::createPalcolorCustomVar(const jlong &objId, const std::string &variablePathName, PaletteColorCustomizationVariable &variable) @@ -2854,10 +2854,10 @@ LocalRefPtr ScriptMethodsObjectInfoNamespace::createColor(int r, int g, int b, i * Fetch the CustomizationData instance associated with the Object * specified by the given obj_id. * - * This function may return NULL if the specified object doesn't have + * This function may return nullptr if the specified object doesn't have * customization data or if some other error occurs. * - * The caller must call CustomizationData::release() on the non-NULL return + * The caller must call CustomizationData::release() on the non-nullptr return * value when the reference no longer is needed. Failure to do so will cause * a memory leak. * @@ -2865,21 +2865,21 @@ LocalRefPtr ScriptMethodsObjectInfoNamespace::createColor(int r, int g, int b, i * CustomizationData instance should be retrieved. * * @return the CustomizationData instance associated with the specified - * Object. May return NULL if the Object doesn't have customization + * Object. May return nullptr if the Object doesn't have customization * data or if an error occurs. */ CustomizationData *ScriptMethodsObjectInfoNamespace::fetchCustomizationDataFromObjId(jlong objId) { PROFILER_AUTO_BLOCK_DEFINE("JNI::fetchCustomizationDataFromObjId"); if (!objId) - return NULL; + return nullptr; //-- Get the target TangibleObject. TangibleObject *object = 0; if (!JavaLibrary::getObject(objId, object)) { // this Object doesn't exist or isn't derived from TangibleObject - return NULL; + return nullptr; } //-- Fetch the CustomizationData. @@ -2887,15 +2887,15 @@ CustomizationData *ScriptMethodsObjectInfoNamespace::fetchCustomizationDataFromO if (!cdProperty) { // this Object doesn't expose any customization data - return NULL; + return nullptr; } CustomizationData *const customizationData = cdProperty->fetchCustomizationData(); if (!customizationData) { // this shouldn't happen - DEBUG_WARNING(true, ("CustomizationDataProperty returned NULL CustomizationData on fetch().\n")); - return NULL; + DEBUG_WARNING(true, ("CustomizationDataProperty returned nullptr CustomizationData on fetch().\n")); + return nullptr; } //-- return the CustomizationData instance. @@ -2910,7 +2910,7 @@ jobjectArray JNICALL ScriptMethodsObjectInfoNamespace::getAllCustomVars(JNIEnv * //-- get the CustomizationData instance for the target object. CustomizationData *const customizationData = fetchCustomizationDataFromObjId(target); if (!customizationData) - return NULL; + return nullptr; //-- collect all local CustomizationVariable instances. // NOTE: if we allow multithreaded access to this code from script, we cannot use this static @@ -2961,7 +2961,7 @@ jobjectArray JNICALL ScriptMethodsObjectInfoNamespace::getAllCustomVars(JNIEnv * customizationData->release(); //-- return result - if (customVarArray.get() != NULL) + if (customVarArray.get() != nullptr) return customVarArray->getReturnValue(); return 0; } @@ -2975,7 +2975,7 @@ jobject JNICALL ScriptMethodsObjectInfoNamespace::getCustomVarByName(JNIEnv * /* //-- get the CustomizationData instance for the target object. CustomizationData *const customizationData = fetchCustomizationDataFromObjId(target); if (!customizationData) - return NULL; + return nullptr; //-- get the CustomizationVariable for the specified variable name std::string nativeVarPathName; @@ -2983,7 +2983,7 @@ jobject JNICALL ScriptMethodsObjectInfoNamespace::getCustomVarByName(JNIEnv * /* CustomizationVariable *const variable = customizationData->findVariable(nativeVarPathName); if (!variable) - return NULL; + return nullptr; //-- create a Java custom_var based on this CustomizationVariable LocalRefPtr newCustomVar = createCustomVar(target, nativeVarPathName, *variable); @@ -3089,7 +3089,7 @@ jobject JNICALL ScriptMethodsObjectInfoNamespace::getPalcolorCustomVarSelectedCo customizationData->release(); if (error) - return NULL; + return nullptr; //-- return value return createColor(color.getR(), color.getG(), color.getB(), color.getA())->getReturnValue(); @@ -3196,7 +3196,7 @@ jobjectArray JNICALL ScriptMethodsObjectInfoNamespace::getPalcolorCustomVarColor customizationData->release(); //-- return result - if (colorArray.get() != NULL) + if (colorArray.get() != nullptr) return colorArray->getReturnValue(); return 0; } @@ -3205,7 +3205,7 @@ jobjectArray JNICALL ScriptMethodsObjectInfoNamespace::getPalcolorCustomVarColor jobjectArray JNICALL ScriptMethodsObjectInfoNamespace::getCtsDestinationClusters(JNIEnv * /*env*/, jobject /*self*/) { - static std::set * s_ctsDestinationClusters = NULL; + static std::set * s_ctsDestinationClusters = nullptr; if (!s_ctsDestinationClusters) { s_ctsDestinationClusters = new std::set; @@ -3449,15 +3449,15 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::kill(JNIEnv *env, jobject sel * @param env Java environment * @param self class calling this function * @param player the player - * @param killer who killed the player (may be null) + * @param killer who killed the player (may be nullptr) * - * @return the corpse id of the player, or null on error + * @return the corpse id of the player, or nullptr on error */ jobject JNICALL ScriptMethodsObjectInfoNamespace::killPlayer(JNIEnv *env, jobject self, jobject player, jobject killer) { static const std::string corpseTemplateName("object/tangible/container/corpse/player_corpse.iff"); - CreatureObject * playerObject = NULL; + CreatureObject * playerObject = nullptr; if (!JavaLibrary::getObject(player, playerObject)) return 0; @@ -3474,7 +3474,7 @@ jobject JNICALL ScriptMethodsObjectInfoNamespace::killPlayer(JNIEnv *env, jobjec Transform tr; tr.setPosition_p(playerObject->getPosition_p()); ServerObject * corpse = ServerWorld::createNewObject(corpseTemplateName, tr, cell, true); - if (corpse == NULL) + if (corpse == nullptr) return 0; if (playerObject->makeDead(killerId, corpse->getNetworkId())) @@ -3557,7 +3557,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setInvulnerable(JNIEnv *env, { UNREF(self); - TangibleObject * object = NULL; + TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -3580,7 +3580,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isInvulnerable(JNIEnv *env, j { UNREF(self); - TangibleObject * object = NULL; + TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -3602,7 +3602,7 @@ jfloat JNICALL ScriptMethodsObjectInfoNamespace::getComplexity(JNIEnv *env, jobj { UNREF(self); - const ServerObject * object = NULL; + const ServerObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return -1; @@ -3625,7 +3625,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setComplexity(JNIEnv *env, jo { UNREF(self); - ServerObject * object = NULL; + ServerObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -3639,7 +3639,7 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getGameObjectType(JNIEnv *env, jo { UNREF (self); - ServerObject * object = NULL; + ServerObject * object = nullptr; if (!JavaLibrary::getObject(obj, object)) return JNI_FALSE; @@ -3662,13 +3662,13 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getGameObjectTypeFromTemplate(JNI jint JNICALL ScriptMethodsObjectInfoNamespace::getGameObjectTypeFromTemplateCrc(JNIEnv *env, jobject self, jint templateCrc) { const ObjectTemplate * objectTemplate = ObjectTemplateList::fetch(templateCrc); - if (objectTemplate == NULL) + if (objectTemplate == nullptr) return 0; const std::string & sharedTemplateName = safe_cast(objectTemplate)->getSharedTemplate(); const ObjectTemplate * sharedTemplate = ObjectTemplateList::fetch(sharedTemplateName); objectTemplate->releaseReference(); - if (sharedTemplate == NULL) + if (sharedTemplate == nullptr) return 0; jint got = safe_cast(sharedTemplate)->getGameObjectType(); @@ -3710,11 +3710,11 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isGod(JNIEnv *env, jobject se { UNREF (self); - const ServerObject * object = NULL; + const ServerObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; - if (object->getClient() == NULL) + if (object->getClient() == nullptr) return JNI_FALSE; return object->getClient()->isGod(); @@ -3735,11 +3735,11 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getGodLevel(JNIEnv *env, jobject { UNREF (self); - const ServerObject * object = NULL; + const ServerObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return 0; - if (object->getClient() == NULL) + if (object->getClient() == nullptr) return 0; if (object->getClient()->isGod()) @@ -3763,13 +3763,13 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getCount(JNIEnv *env, jobject sel // both Tangible and Intangible have counters, so we have to test for both // cases - const TangibleObject * tangibleObject = NULL; + const TangibleObject * tangibleObject = nullptr; if (JavaLibrary::getObject(target, tangibleObject)) { return tangibleObject->getCount(); } - const IntangibleObject * intangibleObject = NULL; + const IntangibleObject * intangibleObject = nullptr; if (JavaLibrary::getObject(target, intangibleObject)) { return intangibleObject->getCount(); @@ -3795,14 +3795,14 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setCount(JNIEnv *env, jobject // both Tangible and Intangible have counters, so we have to test for both // cases - TangibleObject * tangibleObject = NULL; + TangibleObject * tangibleObject = nullptr; if (JavaLibrary::getObject(target, tangibleObject)) { tangibleObject->setCount(value); return JNI_TRUE; } - IntangibleObject * intangibleObject = NULL; + IntangibleObject * intangibleObject = nullptr; if (JavaLibrary::getObject(target, intangibleObject)) { intangibleObject->setCount(value); @@ -3829,14 +3829,14 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::incrementCount(JNIEnv *env, j // both Tangible and Intangible have counters, so we have to test for both // cases - TangibleObject * tangibleObject = NULL; + TangibleObject * tangibleObject = nullptr; if (JavaLibrary::getObject(target, tangibleObject)) { tangibleObject->incrementCount(delta); return JNI_TRUE; } - IntangibleObject * intangibleObject = NULL; + IntangibleObject * intangibleObject = nullptr; if (JavaLibrary::getObject(target, intangibleObject)) { intangibleObject->incrementCount(delta); @@ -3859,7 +3859,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::incrementCount(JNIEnv *env, j */ jint JNICALL ScriptMethodsObjectInfoNamespace::getCondition(JNIEnv *env, jobject self, jlong target) { - const TangibleObject * object = NULL; + const TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return 0; @@ -3880,7 +3880,7 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getCondition(JNIEnv *env, jobject */ jboolean JNICALL ScriptMethodsObjectInfoNamespace::hasCondition(JNIEnv *env, jobject self, jlong target, jint condition) { - const TangibleObject * object = NULL; + const TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -3901,7 +3901,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::hasCondition(JNIEnv *env, job */ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setCondition(JNIEnv *env, jobject self, jlong target, jint condition) { - TangibleObject * object = NULL; + TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -3923,7 +3923,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setCondition(JNIEnv *env, job */ jboolean JNICALL ScriptMethodsObjectInfoNamespace::clearCondition(JNIEnv *env, jobject self, jlong target, jint condition) { - TangibleObject * object = NULL; + TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -4748,7 +4748,7 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getGroupLevel(JNIEnv *, jobject, { if (!target) { - DEBUG_WARNING (true, ("JavaLibrary::getGroupLevel null target ")); + DEBUG_WARNING (true, ("JavaLibrary::getGroupLevel nullptr target ")); return 0; } @@ -4864,18 +4864,18 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::getVisibleOnMapAndRadar(JNIEn * @param self class calling this function * @param target the object * - * @return the appearance name, or null on error + * @return the appearance name, or nullptr on error */ jstring JNICALL ScriptMethodsObjectInfoNamespace::getAppearance(JNIEnv * env, jobject self, jlong target) { UNREF(self); - const ServerObject * object = NULL; + const ServerObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return 0; const SharedObjectTemplate * sharedTemplate = object->getSharedTemplate(); - if (sharedTemplate == NULL) + if (sharedTemplate == nullptr) return 0; JavaString appearance(sharedTemplate->getAppearanceFilename()); @@ -4897,7 +4897,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isInsured(JNIEnv * env, jobje { UNREF(self); - const TangibleObject * object = NULL; + const TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -4919,7 +4919,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isAutoInsured(JNIEnv * env, j { UNREF(self); - const TangibleObject * object = NULL; + const TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -4941,7 +4941,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isUninsurable(JNIEnv * env, j { UNREF(self); - const TangibleObject * object = NULL; + const TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -4959,13 +4959,13 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isUninsurable(JNIEnv * env, j * @param self class calling this function * @param player the player to get objects from * - * @return an array of objects, or null on error + * @return an array of objects, or nullptr on error */ jlongArray JNICALL ScriptMethodsObjectInfoNamespace::getInventoryAndEquipment(JNIEnv * env, jobject self, jlong player) { UNREF(self); - const CreatureObject * playerCreature = NULL; + const CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature)) return 0; @@ -4973,11 +4973,11 @@ jlongArray JNICALL ScriptMethodsObjectInfoNamespace::getInventoryAndEquipment(JN // go through the player's inventory const ServerObject * inventoryObject = playerCreature->getInventory(); - if (inventoryObject != NULL) + if (inventoryObject != nullptr) { const VolumeContainer * inventoryContainer = ContainerInterface::getVolumeContainer(*inventoryObject); - if (inventoryContainer != NULL) + if (inventoryContainer != nullptr) { getGoodItemsFromContainer(*inventoryContainer, objectIds); } @@ -4998,7 +4998,7 @@ jlongArray JNICALL ScriptMethodsObjectInfoNamespace::getInventoryAndEquipment(JN // go through the player's equipment SlottedContainer const * const equipmentContainer = ContainerInterface::getSlottedContainer(*playerCreature); - if (equipmentContainer != NULL) + if (equipmentContainer != nullptr) getGoodItemsFromContainer(*equipmentContainer, objectIds); else { @@ -5022,12 +5022,12 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setCheaterLevel(JNIEnv * env, { UNREF(self); - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature)) return JNI_FALSE; PlayerObject * const playerObj = PlayerCreatureController::getPlayerObject(playerCreature); - if (playerObj != NULL && playerObj->isAuthoritative()) + if (playerObj != nullptr && playerObj->isAuthoritative()) { playerObj->setCheaterLevel(static_cast(level)); return JNI_TRUE; @@ -5042,12 +5042,12 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getCheaterLevel(JNIEnv * env, job { UNREF(self); - const CreatureObject * playerCreature = NULL; + const CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature)) return 0; PlayerObject const * const playerObj = PlayerCreatureController::getPlayerObject(playerCreature); - if (playerObj != NULL) + if (playerObj != nullptr) { return static_cast(playerObj->getCheaterLevel()); } @@ -5071,7 +5071,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setHouseId(JNIEnv * env, jobj { UNREF(self); - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature)) return JNI_FALSE; @@ -5090,13 +5090,13 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setHouseId(JNIEnv * env, jobj * @param self class calling this function * @param player the player * - * @return the house id, or null on error + * @return the house id, or nullptr on error */ jlong JNICALL ScriptMethodsObjectInfoNamespace::getHouseId(JNIEnv * env, jobject self, jlong player) { UNREF(self); - const CreatureObject * playerCreature = NULL; + const CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature)) return 0; @@ -5113,16 +5113,16 @@ jlong JNICALL ScriptMethodsObjectInfoNamespace::getHouseId(JNIEnv * env, jobject * @param self class calling this function * @param object the manf schematic or factory id * - * @return the draft schematic name, or null on error + * @return the draft schematic name, or nullptr on error */ jstring JNICALL ScriptMethodsObjectInfoNamespace::getDraftSchematic(JNIEnv * env, jobject self, jlong object) { UNREF(self); - const ManufactureObjectInterface * craftable = NULL; + const ManufactureObjectInterface * craftable = nullptr; - const FactoryObject * factoryObject = NULL; - const ManufactureSchematicObject * manfSchematicObject = NULL; + const FactoryObject * factoryObject = nullptr; + const ManufactureSchematicObject * manfSchematicObject = nullptr; if (JavaLibrary::getObject(object, manfSchematicObject)) { craftable = manfSchematicObject; @@ -5136,7 +5136,7 @@ jstring JNICALL ScriptMethodsObjectInfoNamespace::getDraftSchematic(JNIEnv * env const ConstCharCrcString draftSchematic(ObjectTemplateList::lookUp( craftable->getDraftSchematic())); - if (draftSchematic.getString() == NULL) + if (draftSchematic.getString() == nullptr) return 0; return JavaString(draftSchematic.getString()).getReturnValue(); @@ -5152,16 +5152,16 @@ jstring JNICALL ScriptMethodsObjectInfoNamespace::getDraftSchematic(JNIEnv * env * @param self class calling this function * @param object the manf schematic or factory id * - * @return the draft schematic name crc, or null on error + * @return the draft schematic name crc, or nullptr on error */ jint JNICALL ScriptMethodsObjectInfoNamespace::getDraftSchematicCrc(JNIEnv * env, jobject self, jlong object) { UNREF(self); - const ManufactureObjectInterface * craftable = NULL; + const ManufactureObjectInterface * craftable = nullptr; - const FactoryObject * factoryObject = NULL; - const ManufactureSchematicObject * manfSchematicObject = NULL; + const FactoryObject * factoryObject = nullptr; + const ManufactureSchematicObject * manfSchematicObject = nullptr; if (JavaLibrary::getObject(object, manfSchematicObject)) { craftable = manfSchematicObject; @@ -5175,7 +5175,7 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getDraftSchematicCrc(JNIEnv * env const ConstCharCrcString draftSchematic(ObjectTemplateList::lookUp( craftable->getDraftSchematic())); - if (draftSchematic.getString() == NULL) + if (draftSchematic.getString() == nullptr) return 0; return draftSchematic.getCrc(); @@ -5196,7 +5196,7 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getSourceDraftSchematic(JNIEnv * { UNREF(self); - const TangibleObject * object = NULL; + const TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return 0; @@ -5219,13 +5219,13 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getPlayerBirthDate(JNIEnv * env, { UNREF(self); - const CreatureObject * playerCreature = NULL; + const CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(playerId, playerCreature)) return -1; const PlayerObject * player = PlayerCreatureController::getPlayerObject( playerCreature); - if (player == NULL) + if (player == nullptr) return -1; return player->getBornDate(); @@ -5263,13 +5263,13 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getPlayerPlayedTime(JNIEnv * env, { UNREF(self); - const CreatureObject * playerCreature = NULL; + const CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(playerId, playerCreature)) return -1; const PlayerObject * player = PlayerCreatureController::getPlayerObject( playerCreature); - if (player == NULL) + if (player == nullptr) return -1; return player->getPlayedTime(); @@ -5306,7 +5306,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::setBuildingCityId(JNIEnv *env, jo * @param self class calling this function * @param jschematicName the schematic name * - * @return the object name, or null if the schematic doesn't exist + * @return the object name, or nullptr if the schematic doesn't exist */ jobject JNICALL ScriptMethodsObjectInfoNamespace::getProductNameFromSchematic(JNIEnv *env, jobject self, jstring jschematicName) @@ -5319,30 +5319,30 @@ jobject JNICALL ScriptMethodsObjectInfoNamespace::getProductNameFromSchematic(JN const DraftSchematicObject * schematic = DraftSchematicObject::getSchematic( schematicName); - if (schematic == NULL) + if (schematic == nullptr) return 0; const ServerObjectTemplate * serverOt = schematic->getCraftedObjectTemplate(); - if (serverOt == NULL) + if (serverOt == nullptr) return 0; const std::string sharedTemplateName(serverOt->getSharedTemplate()); const ObjectTemplate * ot = ObjectTemplateList::fetch(sharedTemplateName); - if (ot == NULL) + if (ot == nullptr) return 0; const SharedObjectTemplate * sharedOt = dynamic_cast( ot); - if (sharedOt == NULL) + if (sharedOt == nullptr) { ot->releaseReference(); return 0; } - ot = NULL; + ot = nullptr; const StringId objectName(sharedOt->getObjectName()); sharedOt->releaseReference(); - sharedOt = NULL; + sharedOt = nullptr; LocalRefPtr jobjectName; if (!ScriptConversion::convert(objectName, jobjectName)) @@ -5360,37 +5360,37 @@ jobject JNICALL ScriptMethodsObjectInfoNamespace::getProductNameFromSchematic(JN * @param self class calling this function * @param schematicCrc the schematic name crc * - * @return the object name, or null if the schematic doesn't exist + * @return the object name, or nullptr if the schematic doesn't exist */ jobject JNICALL ScriptMethodsObjectInfoNamespace::getProductNameFromSchematicCrc(JNIEnv *env, jobject self, jint schematicCrc) { const DraftSchematicObject * schematic = DraftSchematicObject::getSchematic( schematicCrc); - if (schematic == NULL) + if (schematic == nullptr) return 0; const ServerObjectTemplate * serverOt = schematic->getCraftedObjectTemplate(); - if (serverOt == NULL) + if (serverOt == nullptr) return 0; const std::string sharedTemplateName(serverOt->getSharedTemplate()); const ObjectTemplate * ot = ObjectTemplateList::fetch(sharedTemplateName); - if (ot == NULL) + if (ot == nullptr) return 0; const SharedObjectTemplate * sharedOt = dynamic_cast( ot); - if (sharedOt == NULL) + if (sharedOt == nullptr) { ot->releaseReference(); return 0; } - ot = NULL; + ot = nullptr; const StringId objectName(sharedOt->getObjectName()); sharedOt->releaseReference(); - sharedOt = NULL; + sharedOt = nullptr; LocalRefPtr jobjectName; if (!ScriptConversion::convert(objectName, jobjectName)) @@ -5407,7 +5407,7 @@ jobject JNICALL ScriptMethodsObjectInfoNamespace::getProductNameFromSchematicCrc * @param self class calling this function * @param draftSchematic the draft schematic's template * - * @return the template for the item the schematic creates, or null on error + * @return the template for the item the schematic creates, or nullptr on error */ jstring JNICALL ScriptMethodsObjectInfoNamespace::getTemplateCreatedFromSchematic(JNIEnv *env, jobject self, jstring draftSchematic) @@ -5433,7 +5433,7 @@ jstring JNICALL ScriptMethodsObjectInfoNamespace::getTemplateCreatedFromSchemati * @param self class calling this function * @param draftSchematicCrc the draft schematic's template crc * - * @return the template for the item the schematic creates, or null on error + * @return the template for the item the schematic creates, or nullptr on error */ jstring JNICALL ScriptMethodsObjectInfoNamespace::getTemplateCreatedFromSchematicCrc(JNIEnv *env, jobject self, jint draftSchematicCrc) @@ -5445,11 +5445,11 @@ jstring JNICALL ScriptMethodsObjectInfoNamespace::getTemplateCreatedFromSchemati const DraftSchematicObject * schematic = DraftSchematicObject::getSchematic( draftSchematicCrc); - if (schematic == NULL) + if (schematic == nullptr) return 0; const ServerObjectTemplate * serverOt = schematic->getCraftedObjectTemplate(); - if (serverOt == NULL) + if (serverOt == nullptr) return 0; JavaString templateName(serverOt->getName()); @@ -5503,11 +5503,11 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getTemplateCrcCreatedFromSchemati const DraftSchematicObject * schematic = DraftSchematicObject::getSchematic( draftSchematicCrc); - if (schematic == NULL) + if (schematic == nullptr) return 0; const ServerObjectTemplate * serverOt = schematic->getCraftedObjectTemplate(); - if (serverOt == NULL) + if (serverOt == nullptr) return 0; return Crc::calculate(serverOt->getName()); @@ -5717,7 +5717,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::requestPreloadCompleteTrigger(JNI void JNICALL ScriptMethodsObjectInfoNamespace::activateQuest(JNIEnv * env, jobject self, jlong target, jint questId) { - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (JavaLibrary::getObject(target, playerCreature)) { PlayerObject * player = PlayerCreatureController::getPlayerObject(playerCreature); @@ -5733,7 +5733,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::activateQuest(JNIEnv * env, jobje void JNICALL ScriptMethodsObjectInfoNamespace::deactivateQuest(JNIEnv * env, jobject self, jlong target, jint questId) { - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (JavaLibrary::getObject(target, playerCreature)) { PlayerObject * player = PlayerCreatureController::getPlayerObject(playerCreature); @@ -5749,7 +5749,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::deactivateQuest(JNIEnv * env, job void JNICALL ScriptMethodsObjectInfoNamespace::completeQuest(JNIEnv * env, jobject self, jlong target, jint questId) { - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (JavaLibrary::getObject(target, playerCreature)) { PlayerObject * player = PlayerCreatureController::getPlayerObject(playerCreature); @@ -5766,7 +5766,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::completeQuest(JNIEnv * env, jobje jboolean JNICALL ScriptMethodsObjectInfoNamespace::isQuestComplete(JNIEnv * env, jobject self, jlong target, jint questId) { jboolean result = false; - const CreatureObject * playerCreature = NULL; + const CreatureObject * playerCreature = nullptr; if (JavaLibrary::getObject(target, playerCreature)) { const PlayerObject * player = PlayerCreatureController::getPlayerObject(playerCreature); @@ -5783,7 +5783,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isQuestComplete(JNIEnv * env, jboolean JNICALL ScriptMethodsObjectInfoNamespace::isQuestActive(JNIEnv * env, jobject self, jlong target, jint questId) { jboolean result = false; - const CreatureObject * playerCreature = NULL; + const CreatureObject * playerCreature = nullptr; if (JavaLibrary::getObject(target, playerCreature)) { const PlayerObject * player = PlayerCreatureController::getPlayerObject(playerCreature); @@ -5801,7 +5801,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::clearCompletedQuest(JNIEnv * env, { if(questId >= 0) { - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (JavaLibrary::getObject(target, playerCreature)) { PlayerObject * player = PlayerCreatureController::getPlayerObject(playerCreature); @@ -5817,7 +5817,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::clearCompletedQuest(JNIEnv * env, jboolean JNICALL ScriptMethodsObjectInfoNamespace::canTrade(JNIEnv *env, jobject self, jlong target) { - const ServerObject * object = NULL; + const ServerObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -5828,7 +5828,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::canTrade(JNIEnv *env, jobject jboolean JNICALL ScriptMethodsObjectInfoNamespace::isNoTradeShared(JNIEnv *env, jobject self, jlong target) { - const ServerObject * object = NULL; + const ServerObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -5845,16 +5845,16 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isNoTradeShared(JNIEnv *env, * @param self class calling this function * @param player the player to check * - * @return the theater id, or null on error + * @return the theater id, or nullptr on error */ jlong JNICALL ScriptMethodsObjectInfoNamespace::getLastSpawnedTheater(JNIEnv *env, jobject self, jlong player) { - const CreatureObject * creature = NULL; + const CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(player, creature)) return 0; const PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(creature); - if (playerObject == NULL) + if (playerObject == nullptr) return 0; return (playerObject->getTheater()).getValue(); @@ -5930,7 +5930,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::setAutoVariableFromByteStream(JNI */ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setBioLink(JNIEnv *env, jobject self, jlong target, jlong link) { - TangibleObject * object = NULL; + TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -5955,7 +5955,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setBioLink(JNIEnv *env, jobje */ jboolean JNICALL ScriptMethodsObjectInfoNamespace::clearBioLink(JNIEnv *env, jobject self, jlong target) { - TangibleObject * object = NULL; + TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -5972,11 +5972,11 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::clearBioLink(JNIEnv *env, job * @param self class calling this function * @param target the item to get the link from * - * @return the bio-link id, null if the item isn't linked + * @return the bio-link id, nullptr if the item isn't linked */ jlong JNICALL ScriptMethodsObjectInfoNamespace::getBioLink(JNIEnv *env, jobject self, jlong target) { - const TangibleObject * object = NULL; + const TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return 0; @@ -5990,7 +5990,7 @@ jlong JNICALL ScriptMethodsObjectInfoNamespace::getBioLink(JNIEnv *env, jobject float JNICALL ScriptMethodsObjectInfoNamespace::getObjectCollisionRadius(JNIEnv * env, jobject self, jlong jobject_obj) { - const Object * object = NULL; + const Object * object = nullptr; if (!JavaLibrary::getObject(jobject_obj, object)) return 0.0f; @@ -6008,11 +6008,11 @@ float JNICALL ScriptMethodsObjectInfoNamespace::getObjectCollisionRadius(JNIEnv * @param self class calling this function * @param target id of the object * - * @return the name, or null on error + * @return the name, or nullptr on error */ jstring JNICALL ScriptMethodsObjectInfoNamespace::getStaticItemName(JNIEnv * /*env*/, jobject /*self*/, jlong target) { - const ServerObject * o = NULL; + const ServerObject * o = nullptr; if (!JavaLibrary::getObject(target, o)) return 0; @@ -6026,7 +6026,7 @@ jstring JNICALL ScriptMethodsObjectInfoNamespace::getStaticItemName(JNIEnv * /*e jint JNICALL ScriptMethodsObjectInfoNamespace::getStaticItemVersion(JNIEnv *env, jobject /*self*/, jlong target) { - const ServerObject * o = NULL; + const ServerObject * o = nullptr; if (!JavaLibrary::getObject(target, o)) return 0; @@ -6040,7 +6040,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::setStaticItemName(JNIEnv * /*env* NetworkId const networkId(target); ServerObject * const o = ServerObject::getServerObject(networkId); - if (o == NULL) + if (o == nullptr) { WARNING(true, ("ERROR: ScriptMethodsObjectInfo::setStaticItemName() Unable to resolve the object(%s).", networkId.getValueString().c_str())); return; @@ -6058,7 +6058,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::setStaticItemVersion(JNIEnv * /*e NetworkId const networkId(target); ServerObject * const o = ServerObject::getServerObject(networkId); - if (o == NULL) + if (o == nullptr) { WARNING(true, ("ERROR: ScriptMethodsObjectInfo::setStaticItemVersion() Unable to resolve the object(%s).", networkId.getValueString().c_str())); return; @@ -6071,7 +6071,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::setStaticItemVersion(JNIEnv * /*e jint JNICALL ScriptMethodsObjectInfoNamespace::getConversionId(JNIEnv * /*env*/, jobject /*self*/, jlong target) { - const ServerObject * o = NULL; + const ServerObject * o = nullptr; if (!JavaLibrary::getObject(target, o)) return 0; @@ -6085,7 +6085,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::setConversionId(JNIEnv * /*env*/, NetworkId const networkId(target); ServerObject * const o = ServerObject::getServerObject(networkId); - if (o == NULL) + if (o == nullptr) { WARNING(true, ("ERROR: ScriptMethodsObjectInfo::setConversionId() Unable to resolve the object(%s).", networkId.getValueString().c_str())); return; @@ -6098,7 +6098,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::setConversionId(JNIEnv * /*env*/, void JNICALL ScriptMethodsObjectInfoNamespace::openCustomizationWindow(JNIEnv *env, jobject self, jlong player, jlong object, jstring customVarName1, jint minVar1, jint maxVar1, jstring customVarName2, jint minVar2, jint maxVar2, jstring customVarName3, jint minVar3, jint maxVar3, jstring customVarName4, jint minVar4, jint maxVar4) { - CreatureObject * playerObject = NULL; + CreatureObject * playerObject = nullptr; if (!JavaLibrary::getObject(player, playerObject)) return; std::string customVarName1String; @@ -6142,7 +6142,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::openCustomizationWindow(JNIEnv *e NetworkId const objectId(object); - if (playerObject->isPlayerControlled() && playerObject->getController() != NULL) + if (playerObject->isPlayerControlled() && playerObject->getController() != nullptr) { playerObject->getController()->appendMessage( static_cast(CM_openCustomizationWindow), @@ -6253,7 +6253,7 @@ jfloat JNICALL ScriptMethodsObjectInfoNamespace::getDefaultScaleFromSharedObject jboolean JNICALL ScriptMethodsObjectInfoNamespace::setOverrideMapColor(JNIEnv * env, jobject self, jlong object, jint r, jint g, jint b) { - TangibleObject * tangible = NULL; + TangibleObject * tangible = nullptr; if (!JavaLibrary::getObject(object, tangible)) return JNI_FALSE; @@ -6269,7 +6269,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setOverrideMapColor(JNIEnv * jboolean JNICALL ScriptMethodsObjectInfoNamespace::clearOverrideMapColor(JNIEnv * env, jobject self, jlong object) { - TangibleObject * tangible = NULL; + TangibleObject * tangible = nullptr; if (!JavaLibrary::getObject(object, tangible)) return JNI_FALSE; @@ -6285,14 +6285,14 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::clearOverrideMapColor(JNIEnv jobject JNICALL ScriptMethodsObjectInfoNamespace::getOverrideMapColor(JNIEnv * env, jobject self, jlong object) { - TangibleObject * tangible = NULL; + TangibleObject * tangible = nullptr; if (!JavaLibrary::getObject(object, tangible)) - return NULL; + return nullptr; uint8 r, g, b; if(!tangible->getOverrideMapColor(r,g,b)) { - return NULL; + return nullptr; } return createColor(r, g, b, 255)->getReturnValue(); @@ -6302,7 +6302,7 @@ jobject JNICALL ScriptMethodsObjectInfoNamespace::getOverrideMapColor(JNIEnv * e jboolean JNICALL ScriptMethodsObjectInfoNamespace::setForceShowHam(JNIEnv * env, jobject self, jlong object, jboolean show) { - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(object, creature)) return JNI_FALSE; @@ -6317,8 +6317,8 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setForceShowHam(JNIEnv * env, jboolean JNICALL ScriptMethodsObjectInfoNamespace::isContainedByPlayerAppearanceInventory(JNIEnv *env, jobject self, jlong player, jlong item) { UNREF(self); - ServerObject *itemObj = NULL; - CreatureObject *playerObj = NULL; + ServerObject *itemObj = nullptr; + CreatureObject *playerObj = nullptr; if(!JavaLibrary::getObject(item, itemObj)) { @@ -6348,7 +6348,7 @@ jlongArray JNICALL ScriptMethodsObjectInfoNamespace::getAllItemsFromAppearanceIn { UNREF(self); - const CreatureObject * playerCreature = NULL; + const CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature)) return 0; @@ -6356,11 +6356,11 @@ jlongArray JNICALL ScriptMethodsObjectInfoNamespace::getAllItemsFromAppearanceIn // go through the player's appearance inventory const ServerObject * appearanceInventoryObject = playerCreature->getAppearanceInventory(); - if (appearanceInventoryObject != NULL) + if (appearanceInventoryObject != nullptr) { const SlottedContainer * appearanceInvContainer = ContainerInterface::getSlottedContainer(*appearanceInventoryObject); - if (appearanceInvContainer != NULL) + if (appearanceInvContainer != nullptr) { getGoodItemsFromContainer(*appearanceInvContainer, objectIds); } @@ -6395,7 +6395,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isAPlayerAppearanceInventoryC { UNREF(self); - const ServerObject * containerObj = NULL; + const ServerObject * containerObj = nullptr; if (!JavaLibrary::getObject(container, containerObj)) return JNI_FALSE; @@ -6412,7 +6412,7 @@ jlongArray JNICALL ScriptMethodsObjectInfoNamespace::getAllWornItems(JNIEnv *env { UNREF(self); - const CreatureObject * playerCreature = NULL; + const CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature)) return 0; @@ -6428,7 +6428,7 @@ jlongArray JNICALL ScriptMethodsObjectInfoNamespace::getAllWornItems(JNIEnv *env DEBUG_WARNING(true, ("JavaLibrary: getAllWornItems - Tried to get all the worn items(INCLUDING appearance items) from player [%s], but this player has no appearance inventory container.", playerCreature->getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } for (ContainerConstIterator i(appearanceInventory->begin()); i != appearanceInventory->end(); ++i) @@ -6436,7 +6436,7 @@ jlongArray JNICALL ScriptMethodsObjectInfoNamespace::getAllWornItems(JNIEnv *env const CachedNetworkId & itemId = *i; const ServerObject * item = safe_cast( itemId.getObject()); - if (item != NULL && item->asTangibleObject() != NULL && + if (item != nullptr && item->asTangibleObject() != nullptr && item->asTangibleObject()->isVisible()) { @@ -6459,7 +6459,7 @@ jlongArray JNICALL ScriptMethodsObjectInfoNamespace::getAllWornItems(JNIEnv *env DEBUG_WARNING(true, ("JavaLibrary: getAllWornItems - Tried to get all the worn items from player [%s], but this player has no creature slot container.", playerCreature->getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } for (ContainerConstIterator i(inventory->begin()); i != inventory->end(); ++i) @@ -6467,7 +6467,7 @@ jlongArray JNICALL ScriptMethodsObjectInfoNamespace::getAllWornItems(JNIEnv *env const CachedNetworkId & itemId = *i; const ServerObject * item = safe_cast( itemId.getObject()); - if (item != NULL && item->asTangibleObject() != NULL && + if (item != nullptr && item->asTangibleObject() != nullptr && item->asTangibleObject()->isVisible()) { const SlottedContainmentProperty * slottedContainment = ContainerInterface::getSlottedContainmentProperty(*item); // Get the slot property of our item. @@ -6507,7 +6507,7 @@ jlongArray JNICALL ScriptMethodsObjectInfoNamespace::getAllWornItems(JNIEnv *env return returnedIds->getReturnValue(); } - return NULL; + return nullptr; } @@ -6518,7 +6518,7 @@ jlong JNICALL ScriptMethodsObjectInfoNamespace::getAppearanceInventory(JNIEnv *e UNREF(env); UNREF(self); - const CreatureObject * playerCreature = NULL; + const CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature)) return 0; @@ -6536,11 +6536,11 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setDecoyOrigin(JNIEnv *env, j UNREF(env); UNREF(self); - CreatureObject * decoyCreature = NULL; + CreatureObject * decoyCreature = nullptr; if (!JavaLibrary::getObject(creature, decoyCreature)) return JNI_FALSE; - const CreatureObject * originCreature = NULL; + const CreatureObject * originCreature = nullptr; if (!JavaLibrary::getObject(origin, originCreature)) return JNI_FALSE; @@ -6561,7 +6561,7 @@ jlong JNICALL ScriptMethodsObjectInfoNamespace::getDecoyOrigin(JNIEnv *env, jobj UNREF(env); UNREF(self); - CreatureObject * decoyCreature = NULL; + CreatureObject * decoyCreature = nullptr; if (!JavaLibrary::getObject(creature, decoyCreature)) return JNI_FALSE; @@ -6578,7 +6578,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::openRatingWindow(JNIEnv * env UNREF(env); UNREF(self); - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature)) { DEBUG_WARNING(true, ("OpenRatingWindow: Failed to get valid creature object with OID %d", player)); @@ -6603,7 +6603,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::openRatingWindow(JNIEnv * env return JNI_FALSE; } - if (playerCreature->isPlayerControlled() && playerCreature->getController() != NULL) + if (playerCreature->isPlayerControlled() && playerCreature->getController() != nullptr) { playerCreature->getController()->appendMessage( static_cast(CM_openRatingWindow), @@ -6626,13 +6626,13 @@ void JNICALL ScriptMethodsObjectInfoNamespace::openExamineWindow(JNIEnv * env, j UNREF(env); UNREF(self); - CreatureObject const * playerCreature = NULL; + CreatureObject const * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature) || !playerCreature || !playerCreature->getClient()) { return; } - ServerObject const * itemObject = NULL; + ServerObject const * itemObject = nullptr; if (!JavaLibrary::getObject(item, itemObject) || !itemObject) { return; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsObjectMove.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsObjectMove.cpp index d345c4f0..2ba2beda 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsObjectMove.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsObjectMove.cpp @@ -215,7 +215,7 @@ const JNINativeMethod NATIVES[] = { */ bool ScriptMethodsObjectMoveNamespace::testInvalidObjectMove(const ServerObject * object) { - if (object->getCacheVersion() > 0 || object->getCellProperty() != NULL) + if (object->getCacheVersion() > 0 || object->getCellProperty() != nullptr) { char buffer[1024]; sprintf(buffer, "A script is trying to move object %s, which is a cached " @@ -323,7 +323,7 @@ jboolean JNICALL ScriptMethodsObjectMoveNamespace::setLocationFromObj(JNIEnv *en * @param self class calling this function * @param objectId object to get * - * @return the object's location, or null on error + * @return the object's location, or nullptr on error */ jobject JNICALL ScriptMethodsObjectMoveNamespace::getLocation(JNIEnv *env, jobject self, jlong objectId) { @@ -337,13 +337,13 @@ jobject JNICALL ScriptMethodsObjectMoveNamespace::getLocation(JNIEnv *env, jobje // (e.g. for mounts, the immediate Container is the mount). NOT_NULL(object); CellProperty const *const cellProperty = object->getParentCell(); - Object const *const cell = (cellProperty != NULL) ? &(cellProperty->getOwner()) : NULL; + Object const *const cell = (cellProperty != nullptr) ? &(cellProperty->getOwner()) : nullptr; // Remember, just because we're not in a cell doesn't mean we're not contained by something else, // particularly in the case of a rider mounted where the mount is in the world cell. - Vector const positionRelativeToCellOrWorld = (cell != NULL) ? object->getPosition_c() : + Vector const positionRelativeToCellOrWorld = (cell != nullptr) ? object->getPosition_c() : object->getPosition_w(); - NetworkId const &networkIdForCellOrWorld = (cell != NULL) ? cell->getNetworkId() : + NetworkId const &networkIdForCellOrWorld = (cell != nullptr) ? cell->getNetworkId() : NetworkId::cms_invalid; LocalRefPtr location; @@ -362,7 +362,7 @@ jobject JNICALL ScriptMethodsObjectMoveNamespace::getLocation(JNIEnv *env, jobje * @param self class calling this function * @param objectId object to get * - * @return the object's world location, or null on error + * @return the object's world location, or nullptr on error */ jobject JNICALL ScriptMethodsObjectMoveNamespace::getWorldLocation(JNIEnv *env, jobject self, jlong objectId) { @@ -387,7 +387,7 @@ jobject JNICALL ScriptMethodsObjectMoveNamespace::getWorldLocation(JNIEnv *env, * @param self class calling this function * @param objectId object to get * - * @return the object's location, or null on error + * @return the object's location, or nullptr on error */ jobject JNICALL ScriptMethodsObjectMoveNamespace::getHeading(JNIEnv *env, jobject self, jlong objectId) { @@ -553,7 +553,7 @@ jboolean JNICALL ScriptMethodsObjectMoveNamespace::faceToBehavior(JNIEnv *env, j jfloat JNICALL ScriptMethodsObjectMoveNamespace::getYaw(JNIEnv *env, jobject self, jlong target) { - const ServerObject * object = NULL; + const ServerObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return -1.0f; @@ -565,7 +565,7 @@ jfloat JNICALL ScriptMethodsObjectMoveNamespace::getYaw(JNIEnv *env, jobject sel jboolean JNICALL ScriptMethodsObjectMoveNamespace::setYaw(JNIEnv *env, jobject self, jlong target, jfloat yaw) { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::setYaw"); - ServerObject * object = NULL; + ServerObject * object = nullptr; { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::setYaw::getObject"); if (!JavaLibrary::getObject(target, object)) @@ -608,7 +608,7 @@ jboolean JNICALL ScriptMethodsObjectMoveNamespace::setYaw(JNIEnv *env, jobject s void JNICALL ScriptMethodsObjectMoveNamespace::modifyYaw(JNIEnv *env, jobject self, jlong target, jfloat degrees) { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::modifyYaw"); - ServerObject * object = NULL; + ServerObject * object = nullptr; { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::modifyYaw::getObject"); if (!JavaLibrary::getObject(target, object)) @@ -650,7 +650,7 @@ void JNICALL ScriptMethodsObjectMoveNamespace::modifyYaw(JNIEnv *env, jobject se void JNICALL ScriptMethodsObjectMoveNamespace::modifyPitch(JNIEnv *env, jobject self, jlong target, jfloat degrees) { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::modifyPitch"); - ServerObject * object = NULL; + ServerObject * object = nullptr; { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::modifyPitch::getObject"); if (!JavaLibrary::getObject(target, object)) @@ -692,7 +692,7 @@ void JNICALL ScriptMethodsObjectMoveNamespace::modifyPitch(JNIEnv *env, jobject void JNICALL ScriptMethodsObjectMoveNamespace::modifyRoll(JNIEnv *env, jobject self, jlong target, jfloat degrees) { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::modifyRoll"); - ServerObject * object = NULL; + ServerObject * object = nullptr; { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::modifyRoll::getObject"); if (!JavaLibrary::getObject(target, object)) @@ -734,7 +734,7 @@ void JNICALL ScriptMethodsObjectMoveNamespace::modifyRoll(JNIEnv *env, jobject s jfloatArray JNICALL ScriptMethodsObjectMoveNamespace::getQuaternion(JNIEnv *env, jobject self, jlong target) { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::getQuaternion"); - ServerObject * object = NULL; + ServerObject * object = nullptr; { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::getQuaternion::getObject"); if (!JavaLibrary::getObject(target, object)) @@ -771,7 +771,7 @@ jfloatArray JNICALL ScriptMethodsObjectMoveNamespace::getQuaternion(JNIEnv *env, void JNICALL ScriptMethodsObjectMoveNamespace::setQuaternion(JNIEnv *env, jobject self, jlong target, jfloat qw, jfloat qx, jfloat qy, jfloat qz) { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::setQuaternion"); - ServerObject * object = NULL; + ServerObject * object = nullptr; { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::setQuaternion::getObject"); if (!JavaLibrary::getObject(target, object)) @@ -804,7 +804,7 @@ void JNICALL ScriptMethodsObjectMoveNamespace::setQuaternion(JNIEnv *env, jobjec jint JNICALL ScriptMethodsObjectMoveNamespace::getFurnitureRotationDegree(JNIEnv *env, jobject self, jlong player) { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::getFurnitureRotationDegree"); - ServerObject * object = NULL; + ServerObject * object = nullptr; { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::getFurnitureRotationDegree::getObject"); if (!JavaLibrary::getObject(player, object)) @@ -823,11 +823,11 @@ jint JNICALL ScriptMethodsObjectMoveNamespace::getFurnitureRotationDegree(JNIEnv void JNICALL ScriptMethodsObjectMoveNamespace::saveDecorationLayout(JNIEnv *env, jobject self, jlong player, jlong pob, jint saveSlotNumber, jstring description) { - CreatureObject * playerObject = NULL; + CreatureObject * playerObject = nullptr; if (!JavaLibrary::getObject(player, playerObject) || !playerObject) return; - ServerObject const * pobObject = NULL; + ServerObject const * pobObject = nullptr; if (!JavaLibrary::getObject(pob, pobObject) || !pobObject) return; @@ -843,11 +843,11 @@ void JNICALL ScriptMethodsObjectMoveNamespace::saveDecorationLayout(JNIEnv *env, void JNICALL ScriptMethodsObjectMoveNamespace::restoreDecorationLayout(JNIEnv *env, jobject self, jlong player, jlong pob, jint saveSlotNumber) { - CreatureObject * playerObject = NULL; + CreatureObject * playerObject = nullptr; if (!JavaLibrary::getObject(player, playerObject) || !playerObject) return; - ServerObject const * pobObject = NULL; + ServerObject const * pobObject = nullptr; if (!JavaLibrary::getObject(pob, pobObject) || !pobObject) return; @@ -1402,11 +1402,11 @@ jobject JNICALL ScriptMethodsObjectMoveNamespace::getConnectedPlayerLocation(JNI std::map const & connectedCharacterLfgData = ServerUniverse::getConnectedCharacterLfgData(); std::map::const_iterator const iterFind = connectedCharacterLfgData.find(NetworkId(static_cast(player))); if (iterFind == connectedCharacterLfgData.end()) - return NULL; + return nullptr; LocalRefPtr dictionary = createNewObject(JavaLibrary::getClsDictionary(), JavaLibrary::getMidDictionary()); if (dictionary == LocalRef::cms_nullPtr) - return NULL; + return nullptr; callObjectMethod(*dictionary, JavaLibrary::getMidDictionaryPut(), JavaString("planet").getValue(), JavaString(iterFind->second.locationPlanet).getValue()); @@ -1457,7 +1457,7 @@ jfloat JNICALL ScriptMethodsObjectMoveNamespace::getMovementSpeed(JNIEnv * /*env NetworkId const networkId(object); CreatureController * const creatureController = CreatureController::getCreatureController(networkId); - return (creatureController != NULL) ? creatureController->getCurrentVelocity().magnitude() : 0.0f; + return (creatureController != nullptr) ? creatureController->getCurrentVelocity().magnitude() : 0.0f; } // ---------------------------------------------------------------------- @@ -1467,7 +1467,7 @@ jfloat JNICALL ScriptMethodsObjectMoveNamespace::getWalkSpeed(JNIEnv * /*env*/, NetworkId const networkId(object); CreatureObject * const creatureObject = CreatureObject::getCreatureObject(networkId); - return (creatureObject != NULL) ? creatureObject->getWalkSpeed() : 0.0f; + return (creatureObject != nullptr) ? creatureObject->getWalkSpeed() : 0.0f; } // ---------------------------------------------------------------------- @@ -1477,7 +1477,7 @@ jfloat JNICALL ScriptMethodsObjectMoveNamespace::getRunSpeed(JNIEnv * /*env*/, j NetworkId const networkId(object); CreatureObject * const creatureObject = CreatureObject::getCreatureObject(networkId); - return (creatureObject != NULL) ? creatureObject->getRunSpeed() : 0.0f; + return (creatureObject != nullptr) ? creatureObject->getRunSpeed() : 0.0f; } // ---------------------------------------------------------------------- @@ -1487,7 +1487,7 @@ void JNICALL ScriptMethodsObjectMoveNamespace::setBaseWalkSpeed(JNIEnv * /*env*/ NetworkId const networkId(object); CreatureObject * const creatureObject = CreatureObject::getCreatureObject(networkId); - if (creatureObject == NULL) + if (creatureObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsObjectMove::setBaseWalkSpeed() Unable to resolve the object(%s) to a CreatureObject.", networkId.getValueString().c_str())); return; @@ -1505,7 +1505,7 @@ jfloat JNICALL ScriptMethodsObjectMoveNamespace::getBaseWalkSpeed(JNIEnv * /*env NetworkId const networkId(object); CreatureObject * const creatureObject = CreatureObject::getCreatureObject(networkId); - return (creatureObject != NULL) ? creatureObject->getBaseWalkSpeed() : 0.0f; + return (creatureObject != nullptr) ? creatureObject->getBaseWalkSpeed() : 0.0f; } // ---------------------------------------------------------------------- @@ -1515,7 +1515,7 @@ void JNICALL ScriptMethodsObjectMoveNamespace::setBaseRunSpeed(JNIEnv * /*env*/, NetworkId const networkId(object); CreatureObject * const creatureObject = CreatureObject::getCreatureObject(networkId); - if (creatureObject == NULL) + if (creatureObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsObjectMove::setBaseRunSpeed() Unable to resolve the object(%s) to a CreatureObject.", networkId.getValueString().c_str())); return; @@ -1533,7 +1533,7 @@ jfloat JNICALL ScriptMethodsObjectMoveNamespace::getBaseRunSpeed(JNIEnv * /*env* NetworkId const networkId(object); CreatureObject * const creatureObject = CreatureObject::getCreatureObject(networkId); - return (creatureObject != NULL) ? creatureObject->getBaseRunSpeed() : 0.0f; + return (creatureObject != nullptr) ? creatureObject->getBaseRunSpeed() : 0.0f; } // ---------------------------------------------------------------------- @@ -1543,7 +1543,7 @@ void JNICALL ScriptMethodsObjectMoveNamespace::setMovementWalk(JNIEnv * /*env*/, NetworkId const networkId(object); CreatureObject * const creatureObject = CreatureObject::getCreatureObject(networkId); - if (creatureObject == NULL) + if (creatureObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsObjectMove::setMovementWalk() Unable to resolve the object(%s) to a CreatureObject.", networkId.getValueString().c_str())); return; @@ -1551,7 +1551,7 @@ void JNICALL ScriptMethodsObjectMoveNamespace::setMovementWalk(JNIEnv * /*env*/, AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(creatureObject->getController()); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsObjectMove::setMovementWalk() Unable to resolve the object's(%s) controller to an AiCreatureController.", creatureObject->getDebugInformation().c_str())); return; @@ -1569,7 +1569,7 @@ void JNICALL ScriptMethodsObjectMoveNamespace::setMovementRun(JNIEnv * /*env*/, NetworkId const networkId(object); CreatureObject * const creatureObject = CreatureObject::getCreatureObject(networkId); - if (creatureObject == NULL) + if (creatureObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsObjectMove::setMovementRun() Unable to resolve the object(%s) to a CreatureObject.", networkId.getValueString().c_str())); return; @@ -1577,7 +1577,7 @@ void JNICALL ScriptMethodsObjectMoveNamespace::setMovementRun(JNIEnv * /*env*/, AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(creatureObject->getController()); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsObjectMove::setMovementRun() Unable to resolve the object's(%s) controller to an AiCreatureController.", creatureObject->getDebugInformation().c_str())); return; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsPermissions.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsPermissions.cpp index 732a9f6d..82bf242b 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsPermissions.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsPermissions.cpp @@ -85,7 +85,7 @@ jobjectArray JNICALL ScriptMethodsPermissionsNamespace::permissionsGetBanned(JNI { ServerObject *serverObj = 0; if (!JavaLibrary::getObject(target, serverObj)) - return NULL; + return nullptr; LocalObjectArrayRefPtr strArray; BuildingObject *buildingObj = dynamic_cast(serverObj); @@ -96,7 +96,7 @@ jobjectArray JNICALL ScriptMethodsPermissionsNamespace::permissionsGetBanned(JNI if (cellObj) if (ScriptConversion::convert(cellObj->getBanned(), strArray)) return strArray->getReturnValue(); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -114,7 +114,7 @@ jobjectArray JNICALL ScriptMethodsPermissionsNamespace::permissionsGetAllowed(JN { ServerObject *serverObj = 0; if (!JavaLibrary::getObject(target, serverObj)) - return NULL; + return nullptr; LocalObjectArrayRefPtr strArray; BuildingObject *buildingObj = dynamic_cast(serverObj); @@ -125,7 +125,7 @@ jobjectArray JNICALL ScriptMethodsPermissionsNamespace::permissionsGetAllowed(JN if (cellObj) if (ScriptConversion::convert(cellObj->getAllowed(), strArray)) return strArray->getReturnValue(); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsPilot.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsPilot.cpp index 5d216dc2..96bf045b 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsPilot.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsPilot.cpp @@ -177,7 +177,7 @@ jint JNICALL ScriptMethodsPilotNamespace::spaceUnitGetBehavior(JNIEnv * env, job if (!shipObject) return JNI_FALSE; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitGetBehavior() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -200,7 +200,7 @@ jlong JNICALL ScriptMethodsPilotNamespace::spaceUnitGetPrimaryAttackTarget(JNIEn if (!shipObject) return JNI_FALSE; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitGetPrimaryAttackTarget() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -223,7 +223,7 @@ jlongArray JNICALL ScriptMethodsPilotNamespace::spaceUnitGetAttackTargetList(JNI if (!shipObject) return JNI_FALSE; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitGetAttackTargetList() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -311,7 +311,7 @@ jboolean JNICALL ScriptMethodsPilotNamespace::spaceUnitIsAttacking(JNIEnv * env, if (!shipObject) return JNI_FALSE; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitIsAttacking() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -334,7 +334,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitIdle(JNIEnv * env, jobject /* if (!shipObject) return; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitIdle() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -357,14 +357,14 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitTrack(JNIEnv * env, jobject / if (!shipObject) return; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitTrack() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); return; } - Object * target = NULL; + Object * target = nullptr; if (!JavaLibrary::getObject(jobject_target, target)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitTrack() The target did not resolve to an Object")); @@ -387,7 +387,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitMoveTo(JNIEnv * env, jobject if (!shipObject) return; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitMoveTo() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -410,7 +410,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitMoveTo(JNIEnv * env, jobject return; } - SpacePath * const path = SpacePathManager::fetch(NULL, aiShipController->getOwner(), aiShipController->getShipRadius()); + SpacePath * const path = SpacePathManager::fetch(nullptr, aiShipController->getOwner(), aiShipController->getShipRadius()); AiShipController::TransformList::const_iterator iterTransformList = convertedPath.begin(); for (; iterTransformList != convertedPath.end(); ++iterTransformList) @@ -435,7 +435,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitAddPatrolPath(JNIEnv * env, j if (!shipObject) return; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitAddPatrolPath() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -483,7 +483,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitClearPatrolPath(JNIEnv * env, if (!shipObject) return; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitClearPatrolPath() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -506,14 +506,14 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitFollow(JNIEnv * env, jobject if (!shipObject) return; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitFollow() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); return; } - Object * followedUnit = NULL; + Object * followedUnit = nullptr; if (!JavaLibrary::getObject(jobject_followedUnit, followedUnit)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitFollow() followedUnit did not resolve to an Object")); @@ -592,10 +592,10 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitAddDamageTaken(JNIEnv * env, } ShipController * const shipController = shipObject->getController()->asShipController(); - AiShipController * const aiShipController = (shipController != NULL) ? shipController->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipController != nullptr) ? shipController->asAiShipController() : nullptr; bool const verifyAttacker = true; - if (aiShipController != NULL) + if (aiShipController != nullptr) { // This adds damage to an AI unit @@ -607,7 +607,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitAddDamageTaken(JNIEnv * env, LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("ScriptMethodsPilot::spaceUnitAddDamageTaken() targetUnit(%s) is not attackable", targetShipObject->getNetworkId().getValueString().c_str())); } } - else if (shipController != NULL) + else if (shipController != nullptr) { // This adds damage to a player unit @@ -635,7 +635,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitSetAttackOrders(JNIEnv * env, if (!shipObject) return; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitSetAttackOrder() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -665,7 +665,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitSetPilotType(JNIEnv * env, jo if (!shipObject) return; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitSetPilotType() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -697,13 +697,13 @@ jstring JNICALL ScriptMethodsPilotNamespace::spaceUnitGetPilotType(JNIEnv * env, LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("ScriptMethodsPilot::spaceUnitGetPilotType()")); if (!verifyShipsEnabled()) - return NULL; + return nullptr; ShipObject * const shipObject = JavaLibrary::getShipThrow(env, jobject_unit, "ScriptMethodsPilot::spaceUnitGetPilotType() unit did not resolve to a ShipObject"); if (!shipObject) - return NULL; + return nullptr; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitGetPilotType() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -726,7 +726,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitRemoveAttackTarget(JNIEnv * e if (!shipObject) return; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitRemoveAttackTarget() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -765,7 +765,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitSetLeashDistance(JNIEnv * env if (!shipObject) return; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitSetLeashDistance() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -805,7 +805,7 @@ jint JNICALL ScriptMethodsPilotNamespace::spaceUnitGetSquadId(JNIEnv * env, jobj if (!shipObject) return JNI_FALSE; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitGetSquadId() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -849,7 +849,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceSquadMoveTo(JNIEnv * /*env*/, job } float const largestShipRadius = squad->getLargestShipRadius(); - SpacePath * const path = SpacePathManager::fetch(NULL, squad, largestShipRadius); + SpacePath * const path = SpacePathManager::fetch(nullptr, squad, largestShipRadius); AiShipController::TransformList::const_iterator iterTransformList = convertedPath.begin(); for (; iterTransformList != convertedPath.end(); ++iterTransformList) @@ -936,7 +936,7 @@ jint JNICALL ScriptMethodsPilotNamespace::spaceSquadRemoveUnit(JNIEnv * env, job if (!shipObject) return JNI_FALSE; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceSquadRemoveUnit() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -1148,7 +1148,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceSquadTrack(JNIEnv * /*env*/, jobj return; } - Object * target = NULL; + Object * target = nullptr; if (!JavaLibrary::getObject(jobject_target, target)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceSquadTrack() The target did not resolve to an Object")); @@ -1171,7 +1171,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceSquadSetLeader(JNIEnv * env, jobj if (!leaderShipObject) return; - AiShipController * const aiShipController = (leaderShipObject->getController()->asShipController() != NULL) ? leaderShipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (leaderShipObject->getController()->asShipController() != nullptr) ? leaderShipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceSquadSetLeader() called on unit(%s) without AiShipController", leaderShipObject->getNetworkId().getValueString().c_str())); @@ -1251,7 +1251,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceSquadFollow(JNIEnv * /*env*/, job return; } - Object * followedUnit = NULL; + Object * followedUnit = nullptr; if (!JavaLibrary::getObject(jobject_followedUnit, followedUnit)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceSquadFollow() followedUnit did not resolve to an Object")); @@ -1418,7 +1418,7 @@ jint JNICALL ScriptMethodsPilotNamespace::spaceSquadGetGuardTarget(JNIEnv * /*en return JNI_FALSE; } - if (squad->getGuardTarget() == NULL) + if (squad->getGuardTarget() == nullptr) { return 0; } @@ -1463,7 +1463,7 @@ void JNICALL ScriptMethodsPilotNamespace::setShipAggroDistance(JNIEnv * env, job if (!shipObject) return; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::setShipAggroDistance(): unit(%s) does not have an AiShipController",shipObject->getNetworkId().getValueString().c_str())); @@ -1557,14 +1557,14 @@ jobject JNICALL ScriptMethodsPilotNamespace::spaceUnitGetDockTransform(JNIEnv * if (!verifyShipsEnabled()) return 0; - Object * dockTarget = NULL; + Object * dockTarget = nullptr; if (!JavaLibrary::getObject(jobject_dockTarget, dockTarget)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitGetDockTransform() dockTarget did not resolve to an Object")); return 0; } - Object * dockingUnit = NULL; + Object * dockingUnit = nullptr; if (!JavaLibrary::getObject(jobject_dockingUnit, dockingUnit)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitGetDockTransform() dockingUnit did not resolve to an Object")); @@ -1600,14 +1600,14 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitAddExclusiveAggro(JNIEnv * en return; } - AiShipController * const unitAiShipController = (unitShipObject->getController()->asShipController() != NULL) ? unitShipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const unitAiShipController = (unitShipObject->getController()->asShipController() != nullptr) ? unitShipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!unitAiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitAddExclusiveAggro() called on unit(%s) without AiShipController", unitShipObject->getDebugInformation().c_str())); return; } - Object * pilotObject = NULL; + Object * pilotObject = nullptr; if (!JavaLibrary::getObject(jobject_pilot, pilotObject)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitAddExclusiveAggro() pilot did not resolve to an Object")); @@ -1642,14 +1642,14 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitRemoveExclusiveAggro(JNIEnv * return; } - AiShipController * const unitAiShipController = (unitShipObject->getController()->asShipController() != NULL) ? unitShipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const unitAiShipController = (unitShipObject->getController()->asShipController() != nullptr) ? unitShipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!unitAiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitRemoveExclusiveAggro() called on unit(%s) without AiShipController", unitShipObject->getDebugInformation().c_str())); return; } - Object * pilotObject = NULL; + Object * pilotObject = nullptr; if (!JavaLibrary::getObject(jobject_pilot, pilotObject)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitRemoveExclusiveAggro() pilot did not resolve to an Object")); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsPlayerAccount.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsPlayerAccount.cpp index 00aa9c9d..0234a47c 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsPlayerAccount.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsPlayerAccount.cpp @@ -127,7 +127,7 @@ jlong JNICALL ScriptMethodsPlayerAccountNamespace::getPlayerObject(JNIEnv *env, jlong objId = 0; - ServerObject * creatureServerObject = NULL; + ServerObject * creatureServerObject = nullptr; if (JavaLibrary::getObject(creature,creatureServerObject)) { SlotId slot = SlotIdManager::findSlotId(ConstCharCrcLowerString("ghost")); @@ -258,11 +258,11 @@ jobject JNICALL ScriptMethodsPlayerAccountNamespace::getAccountTimeData(JNIEnv * const PlayerObject * player = PlayerCreatureController::getPlayerObject( creature); - if (player == NULL) + if (player == nullptr) return 0; const Client * client = creature->getClient(); - if (client == NULL) + if (client == nullptr) return 0; // get the values that came from Platform @@ -463,7 +463,7 @@ jboolean JNICALL ScriptMethodsPlayerAccountNamespace::isAccountQualifiedForHouse * @returns a dictionary that contains the following data in paralled arrays * with the oldest CTS transaction first and the newest CTS transaction last * -* @returns null if the character doesn't have any CTS history +* @returns nullptr if the character doesn't have any CTS history * * string[] character_name full name of the source character * string[] cluster_name name of the source cluster @@ -471,7 +471,7 @@ jboolean JNICALL ScriptMethodsPlayerAccountNamespace::isAccountQualifiedForHouse */ jobject JNICALL ScriptMethodsPlayerAccountNamespace::getCharacterCtsHistory(JNIEnv * env, jobject self, jlong player) { - CreatureObject const * playerObject = NULL; + CreatureObject const * playerObject = nullptr; if (!JavaLibrary::getObject(player, playerObject)) { DEBUG_WARNING(true, ("JavaLibrary::getCharacterCtsHistory: bad player object")); @@ -491,7 +491,7 @@ jobject JNICALL ScriptMethodsPlayerAccountNamespace::getCharacterCtsHistory(JNIE if (i.getValue(ctsTransactionDetail)) { Unicode::UnicodeStringVector tokens; - if (Unicode::tokenize(ctsTransactionDetail, tokens, NULL, NULL) && (tokens.size() >= 4)) + if (Unicode::tokenize(ctsTransactionDetail, tokens, nullptr, nullptr) && (tokens.size() >= 4)) { Unicode::String * characterName = new Unicode::String(); for (size_t i = 3, j = tokens.size(); i < j; ++i) @@ -538,13 +538,13 @@ jobject JNICALL ScriptMethodsPlayerAccountNamespace::getCharacterCtsHistory(JNIE * for the particular CTS source character that this character at one time transferred from * with the oldest CTS transaction first and the newest CTS transaction last * -* @returns null if the character doesn't have any retroactive CTS objvars history +* @returns nullptr if the character doesn't have any retroactive CTS objvars history */ jobjectArray JNICALL ScriptMethodsPlayerAccountNamespace::getCharacterRetroactiveCtsObjvars(JNIEnv * env, jobject self, jlong player) { std::vector > const *> const & characterRetroactiveCtsObjvars = GameServer::getRetroactiveCtsHistoryObjvars(NetworkId(static_cast(player))); if (characterRetroactiveCtsObjvars.empty()) - return NULL; + return nullptr; LocalObjectArrayRefPtr results = createNewObjectArray(characterRetroactiveCtsObjvars.size(), JavaLibrary::getClsDictionary()); for (size_t i = 0, size = characterRetroactiveCtsObjvars.size(); i < size; ++i) @@ -603,7 +603,7 @@ jobjectArray JNICALL ScriptMethodsPlayerAccountNamespace::qualifyForFreeCts(JNIE // see if we can/should bypass the free CTS time restriction if (!freeCtsInfo && ConfigServerGame::getAllowIgnoreFreeCtsTimeRestriction()) { - CreatureObject const * playerObject = NULL; + CreatureObject const * playerObject = nullptr; if (JavaLibrary::getObject(player, playerObject) && playerObject && playerObject->getClient() && playerObject->getClient()->isGod()) { freeCtsInfo = FreeCtsDataTable::getFreeCtsInfoForCharacter(characterCreateTime, GameServer::getInstance().getClusterName(), true); @@ -615,7 +615,7 @@ jobjectArray JNICALL ScriptMethodsPlayerAccountNamespace::qualifyForFreeCts(JNIE } if (!freeCtsInfo || freeCtsInfo->targetCluster.empty()) - return NULL; + return nullptr; LocalObjectArrayRefPtr valueArray = createNewObjectArray(freeCtsInfo->targetCluster.size(), JavaLibrary::getClsString()); @@ -634,7 +634,7 @@ jobjectArray JNICALL ScriptMethodsPlayerAccountNamespace::qualifyForFreeCts(JNIE */ void JNICALL ScriptMethodsPlayerAccountNamespace::validateFreeCts(JNIEnv * /*env*/, jobject /*self*/, jlong player, jstring destinationGalaxy, jstring destinationCharacterName) { - CreatureObject const * creatureObject = NULL; + CreatureObject const * creatureObject = nullptr; if (!JavaLibrary::getObject(player, creatureObject) || !creatureObject) { DEBUG_WARNING(true, ("JavaLibrary::validateFreeCts: bad CreatureObject")); @@ -674,7 +674,7 @@ void JNICALL ScriptMethodsPlayerAccountNamespace::validateFreeCts(JNIEnv * /*env */ void JNICALL ScriptMethodsPlayerAccountNamespace::performFreeCts(JNIEnv * /*env*/, jobject /*self*/, jlong player, jstring destinationGalaxy, jstring destinationCharacterName) { - CreatureObject const * creatureObject = NULL; + CreatureObject const * creatureObject = nullptr; if (!JavaLibrary::getObject(player, creatureObject) || !creatureObject) { DEBUG_WARNING(true, ("JavaLibrary::performFreeCts: bad CreatureObject")); @@ -713,7 +713,7 @@ void JNICALL ScriptMethodsPlayerAccountNamespace::performFreeCts(JNIEnv * /*env* */ void JNICALL ScriptMethodsPlayerAccountNamespace::validateCts(JNIEnv * /*env*/, jobject /*self*/, jlong player, jstring destinationGalaxy, jstring destinationCharacterName) { - CreatureObject const * creatureObject = NULL; + CreatureObject const * creatureObject = nullptr; if (!JavaLibrary::getObject(player, creatureObject) || !creatureObject) { DEBUG_WARNING(true, ("JavaLibrary::validateCts: bad CreatureObject")); @@ -753,7 +753,7 @@ void JNICALL ScriptMethodsPlayerAccountNamespace::validateCts(JNIEnv * /*env*/, */ void JNICALL ScriptMethodsPlayerAccountNamespace::performCts(JNIEnv * /*env*/, jobject /*self*/, jlong player, jstring destinationGalaxy, jstring destinationCharacterName) { - CreatureObject const * creatureObject = NULL; + CreatureObject const * creatureObject = nullptr; if (!JavaLibrary::getObject(player, creatureObject) || !creatureObject) { DEBUG_WARNING(true, ("JavaLibrary::performCts: bad CreatureObject")); @@ -792,7 +792,7 @@ void JNICALL ScriptMethodsPlayerAccountNamespace::performCts(JNIEnv * /*env*/, j */ void JNICALL ScriptMethodsPlayerAccountNamespace::validateRenameCharacter(JNIEnv *env, jobject self, jlong player, jstring newName) { - CreatureObject const * creatureObject = NULL; + CreatureObject const * creatureObject = nullptr; if (!JavaLibrary::getObject(player, creatureObject) || !creatureObject) { DEBUG_WARNING(true, ("JavaLibrary::validateRenameCharacter: bad CreatureObject")); @@ -819,7 +819,7 @@ void JNICALL ScriptMethodsPlayerAccountNamespace::validateRenameCharacter(JNIEnv bool lastNameChangeOnly = false; static Unicode::String const delimiters(Unicode::narrowToWide(" ")); Unicode::UnicodeStringVector newNameTokens; - if (!Unicode::tokenize(newNameString, newNameTokens, &delimiters, NULL)) + if (!Unicode::tokenize(newNameString, newNameTokens, &delimiters, nullptr)) newNameTokens.clear(); size_t const newNameTokensCount = newNameTokens.size(); @@ -846,7 +846,7 @@ void JNICALL ScriptMethodsPlayerAccountNamespace::validateRenameCharacter(JNIEnv { Unicode::String const uniqueRandomName = NameManager::getInstance().generateUniqueRandomName(ConfigServerGame::getCharacterNameGeneratorDirectory(), creatureTemplate->getNameGeneratorType()); Unicode::UnicodeStringVector uniqueRandomNameTokens; - if (!Unicode::tokenize(uniqueRandomName, uniqueRandomNameTokens, &delimiters, NULL)) + if (!Unicode::tokenize(uniqueRandomName, uniqueRandomNameTokens, &delimiters, nullptr)) uniqueRandomNameTokens.clear(); newNameString = ((uniqueRandomNameTokens.size() >= 1) ? uniqueRandomNameTokens[0] : delimiters) + delimiters + newNameTokens[1]; @@ -861,7 +861,7 @@ void JNICALL ScriptMethodsPlayerAccountNamespace::validateRenameCharacter(JNIEnv params.addParam("@ui:name_declined_racially_inappropriate", "reason"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(creatureObject->getNetworkId(), "renameCharacterNameValidationFail", dictionary->getSerializedData(), 0, false); @@ -879,7 +879,7 @@ void JNICALL ScriptMethodsPlayerAccountNamespace::validateRenameCharacter(JNIEnv params.addParam(errorText.c_str(), "reason"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(creatureObject->getNetworkId(), "renameCharacterNameValidationFail", dictionary->getSerializedData(), 0, false); @@ -906,7 +906,7 @@ void JNICALL ScriptMethodsPlayerAccountNamespace::validateRenameCharacter(JNIEnv */ void JNICALL ScriptMethodsPlayerAccountNamespace::renameCharacterReleaseNameReservation(JNIEnv *env, jobject self, jlong player) { - CreatureObject const * creatureObject = NULL; + CreatureObject const * creatureObject = nullptr; if (!JavaLibrary::getObject(player, creatureObject) || !creatureObject) { DEBUG_WARNING(true, ("JavaLibrary::renameCharacterReleaseNameReservation: bad CreatureObject")); @@ -929,7 +929,7 @@ void JNICALL ScriptMethodsPlayerAccountNamespace::renameCharacterReleaseNameRese */ void JNICALL ScriptMethodsPlayerAccountNamespace::renameCharacter(JNIEnv *env, jobject self, jlong player, jstring newName) { - CreatureObject const * creatureObject = NULL; + CreatureObject const * creatureObject = nullptr; if (!JavaLibrary::getObject(player, creatureObject) || !creatureObject) { DEBUG_WARNING(true, ("JavaLibrary::renameCharacter: bad CreatureObject")); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsPlayerQuest.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsPlayerQuest.cpp index 2e523419..e72745fe 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsPlayerQuest.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsPlayerQuest.cpp @@ -159,7 +159,7 @@ jboolean ScriptMethodsPlayerQuestNamespace::addPlayerQuestTask(JNIEnv * env, job std::string sceneId; if (!ScriptConversion::convertWorld(waypointLocation, waypointVec, sceneId)) { - // NULL or Invalid Location passed in. That's fine, just means no waypoint. + // nullptr or Invalid Location passed in. That's fine, just means no waypoint. if(questObject) { std::string titleString; @@ -456,7 +456,7 @@ jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestWaypoint(JNIEnv * env, if(!JavaLibrary::getObject(quest, questObject)) { WARNING(true, ("getPlayerQuestWaypoint: Could not get valid Player Quest Object from OID: %d", quest)); - return NULL; + return nullptr; } if(questObject) @@ -465,7 +465,7 @@ jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestWaypoint(JNIEnv * env, return jString.getReturnValue(); } - return NULL; + return nullptr; } @@ -520,7 +520,7 @@ jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestTitle(JNIEnv * env, job if(!JavaLibrary::getObject(quest, questObject)) { WARNING(true, ("getPlayerQuestTitle: Could not get valid Player Quest Object from OID: %d", quest)); - return NULL; + return nullptr; } if(questObject) @@ -529,7 +529,7 @@ jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestTitle(JNIEnv * env, job return returnVal.getReturnValue(); } - return NULL; + return nullptr; } jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestDescription(JNIEnv * env, jobject self, jlong quest) @@ -541,7 +541,7 @@ jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestDescription(JNIEnv * en if(!JavaLibrary::getObject(quest, questObject)) { WARNING(true, ("getPlayerQuestDescription: Could not get valid Player Quest Object from OID: %d", quest)); - return NULL; + return nullptr; } if(questObject) @@ -550,7 +550,7 @@ jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestDescription(JNIEnv * en return returnVal.getReturnValue(); } - return NULL; + return nullptr; } jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestTaskTitle(JNIEnv * env, jobject self, jlong quest, jint index) @@ -562,7 +562,7 @@ jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestTaskTitle(JNIEnv * env, if(!JavaLibrary::getObject(quest, questObject)) { WARNING(true, ("getPlayerQuestTaskTitle: Could not get valid Player Quest Object from OID: %d", quest)); - return NULL; + return nullptr; } if(questObject) @@ -571,7 +571,7 @@ jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestTaskTitle(JNIEnv * env, return returnVal.getReturnValue(); } - return NULL; + return nullptr; } jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestTaskDescription(JNIEnv * env, jobject self, jlong quest, jint index) @@ -583,7 +583,7 @@ jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestTaskDescription(JNIEnv if(!JavaLibrary::getObject(quest, questObject)) { WARNING(true, ("getPlayerQuestTaskDescription: Could not get valid Player Quest Object from OID: %d", quest)); - return NULL; + return nullptr; } if(questObject) @@ -592,7 +592,7 @@ jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestTaskDescription(JNIEnv return returnVal.getReturnValue(); } - return NULL; + return nullptr; } void ScriptMethodsPlayerQuestNamespace::setPlayerQuestRecipe(JNIEnv * env, jobject self, jlong quest, jboolean recipe) @@ -768,21 +768,21 @@ void ScriptMethodsPlayerQuestNamespace::openPlayerQuestRecipe(JNIEnv * env, jobj UNREF(env); UNREF(self); - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature)) { DEBUG_WARNING(true, ("openPlayerQuestRecipe: Failed to get valid creature object with OID %d", player)); return; } - ServerObject * recipeObj = NULL; + ServerObject * recipeObj = nullptr; if (!JavaLibrary::getObject(recipe, recipeObj)) { DEBUG_WARNING(true, ("openPlayerQuestRecipe: Failed to get valid recipe object with OID %d", player)); return; } - if (playerCreature->isPlayerControlled() && playerCreature->getController() != NULL) + if (playerCreature->isPlayerControlled() && playerCreature->getController() != nullptr) { playerCreature->getController()->appendMessage( static_cast(CM_openRecipe), @@ -801,7 +801,7 @@ void ScriptMethodsPlayerQuestNamespace::resetAllPlayerQuestData(JNIEnv * env, jo UNREF(env); UNREF(self); - PlayerQuestObject * playerQuest = NULL; + PlayerQuestObject * playerQuest = nullptr; if (!JavaLibrary::getObject(quest, playerQuest)) { DEBUG_WARNING(true, ("resetAllPlayerQuestData: Failed to get valid recipe object with OID %d", quest)); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsPvp.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsPvp.cpp index b27444e7..75b7f1ec 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsPvp.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsPvp.cpp @@ -43,7 +43,7 @@ namespace ScriptMethodsPvpNamespace const char * makeCopyOfString(const char * rhs) { - char * lhs = NULL; + char * lhs = nullptr; if (rhs) { lhs = new char[strlen(rhs) + 1]; @@ -668,7 +668,7 @@ jobjectArray JNICALL ScriptMethodsPvpNamespace::pvpGetEnemyFlags(JNIEnv *env, jo if (ScriptConversion::convert(enemyStrings, strArray)) return strArray->getReturnValue(); } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -749,7 +749,7 @@ jboolean JNICALL ScriptMethodsPvpNamespace::pvpHasBattlefieldEnemyFlag(JNIEnv *e * @param actor The actor for the enemy check * @param from The center of the range * @param range The distance to query. - * @return null if there is an error, or an array of enemy objects which are in range. + * @return nullptr if there is an error, or an array of enemy objects which are in range. */ jlongArray JNICALL ScriptMethodsPvpNamespace::pvpGetEnemiesInRange(JNIEnv *env, jobject self, jlong actor, jlong location, jfloat range) { @@ -799,7 +799,7 @@ jlongArray JNICALL ScriptMethodsPvpNamespace::pvpGetEnemiesInRange(JNIEnv *env, * @param angle The cone angle, in degrees, that the cone sweeps out. The * total cone angle is twice this angle; therefore, this angle * represents the angle swept out to each side of the cone axis. - * @return null if there is an error, or an array of enemy objects which are in range. + * @return nullptr if there is an error, or an array of enemy objects which are in range. */ jlongArray JNICALL ScriptMethodsPvpNamespace::pvpGetEnemiesInCone(JNIEnv *env, jobject self, jlong actor, jlong coneCenterObjectId, jlong coneDirectionObjectId, jfloat range, jfloat angle) { @@ -853,7 +853,7 @@ jlongArray JNICALL ScriptMethodsPvpNamespace::pvpGetEnemiesInCone(JNIEnv *env, j * @param angle The cone angle, in degrees, that the cone sweeps out. The * total cone angle is twice this angle; therefore, this angle * represents the angle swept out to each side of the cone axis. - * @return null if there is an error, or an array of enemy objects which are in range. + * @return nullptr if there is an error, or an array of enemy objects which are in range. */ jlongArray JNICALL ScriptMethodsPvpNamespace::pvpGetEnemiesInConeLocation(JNIEnv *env, jobject self, jlong actor, jlong coneCenterObjectId, jobject coneDirectionLocation, jfloat range, jfloat angle) { @@ -900,7 +900,7 @@ jlongArray JNICALL ScriptMethodsPvpNamespace::pvpGetEnemiesInConeLocation(JNIEnv * @param actor The actor for the canAttack check * @param from The center of the range * @param range The distance to query. - * @return null if there is an error, or an array of attackable objects which are in range. + * @return nullptr if there is an error, or an array of attackable objects which are in range. */ jlongArray JNICALL ScriptMethodsPvpNamespace::pvpGetTargetsInRange(JNIEnv *env, jobject self, jlong actor, jlong location, jfloat range) { @@ -951,7 +951,7 @@ jlongArray JNICALL ScriptMethodsPvpNamespace::pvpGetTargetsInRange(JNIEnv *env, * @param angle The cone angle, in degrees, that the cone sweeps out. The * total cone angle is twice this angle; therefore, this angle * represents the angle swept out to each side of the cone axis. - * @return null if there is an error, or an array of attackable objects which are in range. + * @return nullptr if there is an error, or an array of attackable objects which are in range. */ jlongArray JNICALL ScriptMethodsPvpNamespace::pvpGetTargetsInCone(JNIEnv *env, jobject self, jlong actor, jlong coneCenterObjectId, jlong coneDirectionObjectId, jfloat range, jfloat angle) { @@ -1005,7 +1005,7 @@ jlongArray JNICALL ScriptMethodsPvpNamespace::pvpGetTargetsInCone(JNIEnv *env, j * @param angle The cone angle, in degrees, that the cone sweeps out. The * total cone angle is twice this angle; therefore, this angle * represents the angle swept out to each side of the cone axis. - * @return null if there is an error, or an array of attackable objects which are in range. + * @return nullptr if there is an error, or an array of attackable objects which are in range. */ jlongArray JNICALL ScriptMethodsPvpNamespace::pvpGetTargetsInConeLocation(JNIEnv *env, jobject self, jlong actor, jlong coneCenterObjectId, jobject coneDirectionLocation, jfloat range, jfloat angle) { diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsQuest.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsQuest.cpp index 43d65ff7..ea237c93 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsQuest.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsQuest.cpp @@ -35,7 +35,7 @@ namespace ScriptMethodsQuestNamespace { PlayerObject * getPlayerForCharacter(jlong playerCreatureId) { - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (JavaLibrary::getObject(playerCreatureId, playerCreature)) { return PlayerCreatureController::getPlayerObject(playerCreature); @@ -44,7 +44,7 @@ namespace ScriptMethodsQuestNamespace { NetworkId id(playerCreatureId); JAVA_THROW_SCRIPT_EXCEPTION(true, ("Requested player %s, who could not be found.", id.getValueString().c_str())); - return NULL; + return nullptr; } } @@ -397,8 +397,8 @@ void JNICALL ScriptMethodsQuestNamespace::questSetQuestTaskCounter(JNIEnv *env, } PlayerObject * const playerObject = getPlayerForCharacter(playerId); - CreatureObject * const creatureObject = playerObject ? playerObject->getCreatureObject() : NULL; - Controller * const controller = creatureObject ? creatureObject->getController() : NULL; + CreatureObject * const creatureObject = playerObject ? playerObject->getCreatureObject() : nullptr; + Controller * const controller = creatureObject ? creatureObject->getController() : nullptr; if(!controller) return; @@ -427,8 +427,8 @@ void JNICALL ScriptMethodsQuestNamespace::questSetQuestTaskLocation(JNIEnv *env, } PlayerObject * const playerObject = getPlayerForCharacter(playerId); - CreatureObject * const creatureObject = playerObject ? playerObject->getCreatureObject() : NULL; - Controller * const controller = creatureObject ? creatureObject->getController() : NULL; + CreatureObject * const creatureObject = playerObject ? playerObject->getCreatureObject() : nullptr; + Controller * const controller = creatureObject ? creatureObject->getController() : nullptr; if(!controller) return; @@ -456,8 +456,8 @@ void JNICALL ScriptMethodsQuestNamespace::questSetQuestTaskTimer(JNIEnv *env, jo } PlayerObject * const playerObject = getPlayerForCharacter(playerId); - CreatureObject * const creatureObject = playerObject ? playerObject->getCreatureObject() : NULL; - Controller * const controller = creatureObject ? creatureObject->getController() : NULL; + CreatureObject * const creatureObject = playerObject ? playerObject->getCreatureObject() : nullptr; + Controller * const controller = creatureObject ? creatureObject->getController() : nullptr; if(!controller) return; @@ -487,7 +487,7 @@ void JNICALL ScriptMethodsQuestNamespace::requestActivateQuest(JNIEnv * env, job return; } - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (JavaLibrary::getObject(playerId, playerCreature) && playerCreature) { Quest const * const q = QuestManager::getQuest(questCrc); @@ -557,7 +557,7 @@ void JNICALL ScriptMethodsQuestNamespace::requestCompleteQuest(JNIEnv * env, job return; } - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (JavaLibrary::getObject(playerId, playerCreature) && playerCreature) { Quest const * const q = QuestManager::getQuest(questCrc); @@ -576,14 +576,14 @@ void JNICALL ScriptMethodsQuestNamespace::showCyberneticsPage(JNIEnv *env, jobje { MessageQueueCyberneticsOpen::OpenType const type = static_cast(openType); - CreatureObject * npc = NULL; + CreatureObject * npc = nullptr; if (!JavaLibrary::getObject(npcId, npc)) return; if(!npc) return; - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (JavaLibrary::getObject(playerId, playerCreature)) { Controller * const playerController = playerCreature->getController(); @@ -659,7 +659,7 @@ void JNICALL ScriptMethodsQuestNamespace::sendStaticItemDataToPlayer(JNIEnv *env } //send to player - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (JavaLibrary::getObject(playerId, playerCreature)) { Controller * const playerController = playerCreature->getController(); @@ -683,7 +683,7 @@ void JNICALL ScriptMethodsQuestNamespace::showLootBox(JNIEnv *env, jobject self, return; //send to player - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (JavaLibrary::getObject(playerId, playerCreature)) { Controller * const playerController = playerCreature->getController(); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsRegion.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsRegion.cpp index 9a393578..d028ee48 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsRegion.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsRegion.cpp @@ -115,7 +115,7 @@ LocalObjectArrayRefPtr ScriptMethodsRegionNamespace::_getRegionsAtPoint(jobject std::vector result; RegionMaster::getRegionsAtPoint(sceneId, locationVec.x, locationVec.z, result); - //-- return null instead of a zero-length array + //-- return nullptr instead of a zero-length array if (result.empty ()) return LocalObjectArrayRef::cms_nullPtr; @@ -127,7 +127,7 @@ LocalObjectArrayRefPtr ScriptMethodsRegionNamespace::_getRegionsAtPoint(jobject { LocalRefPtr javaRegion; const Region * r = *it; - if (r != NULL) + if (r != nullptr) { if (!ScriptConversion::convert(*r, javaRegion)) return LocalObjectArrayRef::cms_nullPtr; @@ -195,7 +195,7 @@ void JNICALL ScriptMethodsRegionNamespace::createCircleRegion(JNIEnv *env, jobje UNREF(self); // validate scripter's input - if (center == NULL || radius <= 0 || name == 0) + if (center == nullptr || radius <= 0 || name == 0) return; JavaStringParam jname(name); @@ -239,7 +239,7 @@ jobject JNICALL ScriptMethodsRegionNamespace::getRegion(JNIEnv *env, jobject sel return 0; const Region * r = RegionMaster::getRegionByName(planetName, regionName); - if (r == NULL) + if (r == nullptr) return 0; LocalRefPtr jr; @@ -255,7 +255,7 @@ jobject JNICALL ScriptMethodsRegionNamespace::getRegion(JNIEnv *env, jobject sel jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsAtPoint(JNIEnv *env, jobject self, jobject location) { LocalObjectArrayRefPtr regions = _getRegionsAtPoint(location); - if (regions.get() == NULL) + if (regions.get() == nullptr) return 0; return regions->getReturnValue(); } @@ -279,9 +279,9 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegions(JNIEnv *env, jobje std::vector result; RegionMaster::getRegionsForPlanet(sceneId, result); - //-- return null instead of a zero-length array + //-- return nullptr instead of a zero-length array if (result.empty ()) - return NULL; + return nullptr; //put them into the jobjectarray LocalObjectArrayRefPtr regions = createNewObjectArray(result.size(), JavaLibrary::getClsRegion()); @@ -291,11 +291,11 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegions(JNIEnv *env, jobje { LocalRefPtr javaRegion; const Region * r = *i; - if (r != NULL) + if (r != nullptr) { if (!ScriptConversion::convert(*r, javaRegion)) { - return NULL; + return nullptr; } } setObjectArrayElement(*regions, index, *javaRegion); @@ -329,7 +329,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithPvP(JNIEnv *env goodRegions.push_back(*i); } - //-- return null instead of a zero-length array + //-- return nullptr instead of a zero-length array if (goodRegions.empty()) return 0; @@ -342,7 +342,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithPvP(JNIEnv *env LocalRefPtr javaRegion; if (!ScriptConversion::convert(**it, javaRegion)) { - return NULL; + return nullptr; } setObjectArrayElement(*result, index, *javaRegion); } @@ -375,7 +375,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithBuildable(JNIEn goodRegions.push_back(*i); } - //-- return null instead of a zero-length array + //-- return nullptr instead of a zero-length array if (goodRegions.empty()) return 0; @@ -388,7 +388,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithBuildable(JNIEn LocalRefPtr javaRegion; if (!ScriptConversion::convert(**it, javaRegion)) { - return NULL; + return nullptr; } setObjectArrayElement(*result, index, *javaRegion); } @@ -421,7 +421,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithMunicipal(JNIEn goodRegions.push_back(*i); } - //-- return null instead of a zero-length array + //-- return nullptr instead of a zero-length array if (goodRegions.empty()) return 0; @@ -434,7 +434,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithMunicipal(JNIEn LocalRefPtr javaRegion; if (!ScriptConversion::convert(**it, javaRegion)) { - return NULL; + return nullptr; } setObjectArrayElement(*result, index, *javaRegion); } @@ -467,7 +467,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithGeographical(JN goodRegions.push_back(*i); } - //-- return null instead of a zero-length array + //-- return nullptr instead of a zero-length array if (goodRegions.empty()) return 0; @@ -480,7 +480,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithGeographical(JN LocalRefPtr javaRegion; if (!ScriptConversion::convert(**it, javaRegion)) { - return NULL; + return nullptr; } setObjectArrayElement(*result, index, *javaRegion); } @@ -513,7 +513,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithDifficulty(JNIE goodRegions.push_back(*i); } - //-- return null instead of a zero-length array + //-- return nullptr instead of a zero-length array if (goodRegions.empty()) return 0; @@ -526,7 +526,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithDifficulty(JNIE LocalRefPtr javaRegion; if (!ScriptConversion::convert(**it, javaRegion)) { - return NULL; + return nullptr; } setObjectArrayElement(*result, index, *javaRegion); } @@ -559,7 +559,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithSpawnable(JNIEn goodRegions.push_back(*i); } - //-- return null instead of a zero-length array + //-- return nullptr instead of a zero-length array if (goodRegions.empty()) return 0; @@ -572,7 +572,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithSpawnable(JNIEn LocalRefPtr javaRegion; if (!ScriptConversion::convert(**it, javaRegion)) { - return NULL; + return nullptr; } setObjectArrayElement(*result, index, *javaRegion); } @@ -605,7 +605,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithMission(JNIEnv goodRegions.push_back(*i); } - //-- return null instead of a zero-length array + //-- return nullptr instead of a zero-length array if (goodRegions.empty()) return 0; @@ -618,7 +618,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithMission(JNIEnv LocalRefPtr javaRegion; if (!ScriptConversion::convert(**it, javaRegion)) { - return NULL; + return nullptr; } setObjectArrayElement(*result, index, *javaRegion); } @@ -657,7 +657,7 @@ jboolean JNICALL ScriptMethodsRegionNamespace::deleteRegion(JNIEnv *env, jobject return JNI_FALSE; UniverseObject * regionObject = dynamic_cast(r->getDynamicRegionId().getObject()); - if (regionObject == NULL) + if (regionObject == nullptr) return JNI_FALSE; regionObject->permanentlyDestroy(DeleteReasons::Script); return JNI_TRUE; @@ -711,7 +711,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionExtent(JNIEnv *env, //----------------------------------------------------------------------- /** Find a random point in the given region - * @return a script.location inside the region, or a null reference if any problems occur + * @return a script.location inside the region, or a nullptr reference if any problems occur */ jobject JNICALL ScriptMethodsRegionNamespace::findPointInRegion(JNIEnv *env, jobject self, jobject region) { @@ -732,7 +732,7 @@ jobject JNICALL ScriptMethodsRegionNamespace::findPointInRegion(JNIEnv *env, job Vector loc3d(x, 0, z); LocalRefPtr location; if (!ScriptConversion::convert(loc3d, r->getPlanet(), NetworkId::cms_invalid, location)) - return NULL; + return nullptr; return location->getReturnValue(); } @@ -744,7 +744,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithPvPAtPoint(JNIE { //get all the regions at the given point LocalObjectArrayRefPtr regionsAtPoint = _getRegionsAtPoint(location); - if (regionsAtPoint.get() == NULL || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) + if (regionsAtPoint.get() == nullptr || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) return 0; //parse out the ones with the right property @@ -760,9 +760,9 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithPvPAtPoint(JNIE result.push_back(r); } - //-- return null instead of a zero-length array + //-- return nullptr instead of a zero-length array if (result.empty ()) - return NULL; + return nullptr; //put them into the jobjectarray LocalObjectArrayRefPtr regions = createNewObjectArray(result.size(), JavaLibrary::getClsRegion()); @@ -772,10 +772,10 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithPvPAtPoint(JNIE { LocalRefPtr javaRegion; const Region * r = *it; - if (r != NULL) + if (r != nullptr) { if (!ScriptConversion::convert(*r, javaRegion)) - return NULL; + return nullptr; } setObjectArrayElement(*regions, index, *javaRegion); } @@ -790,7 +790,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithBuildableAtPoin { //get all the regions at the given point LocalObjectArrayRefPtr regionsAtPoint = _getRegionsAtPoint(location); - if (regionsAtPoint.get() == NULL || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) + if (regionsAtPoint.get() == nullptr || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) return 0; //parse out the ones with the right property @@ -806,9 +806,9 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithBuildableAtPoin result.push_back(r); } - //-- return null instead of a zero-length array + //-- return nullptr instead of a zero-length array if (result.empty ()) - return NULL; + return nullptr; //put them into the jobjectarray LocalObjectArrayRefPtr regions = createNewObjectArray(result.size(), JavaLibrary::getClsRegion()); @@ -818,10 +818,10 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithBuildableAtPoin { LocalRefPtr javaRegion; const Region * r = *it; - if (r != NULL) + if (r != nullptr) { if(!ScriptConversion::convert(*r, javaRegion)) - return NULL; + return nullptr; } setObjectArrayElement(*regions, index, *javaRegion); } @@ -837,7 +837,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithMunicipalAtPoin PROFILER_AUTO_BLOCK_DEFINE("JNI::getRegionsWithMunicipalAtPoint"); //get all the regions at the given point LocalObjectArrayRefPtr regionsAtPoint = _getRegionsAtPoint(location); - if (regionsAtPoint.get() == NULL || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) + if (regionsAtPoint.get() == nullptr || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) return 0; //parse out the ones with the right property @@ -853,9 +853,9 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithMunicipalAtPoin result.push_back(r); } - //-- return null instead of a zero-length array + //-- return nullptr instead of a zero-length array if (result.empty ()) - return NULL; + return nullptr; //put them into the jobjectarray LocalObjectArrayRefPtr regions = createNewObjectArray(result.size(), JavaLibrary::getClsRegion()); @@ -865,10 +865,10 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithMunicipalAtPoin { LocalRefPtr javaRegion; const Region * r = *it; - if (r != NULL) + if (r != nullptr) { if(!ScriptConversion::convert(*r, javaRegion)) - return NULL; + return nullptr; } setObjectArrayElement(*regions, index, *javaRegion); } @@ -884,7 +884,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithGeographicalAtP PROFILER_AUTO_BLOCK_DEFINE("JNI::getRegionsWithGeographicalAtPoint"); //get all the regions at the given point LocalObjectArrayRefPtr regionsAtPoint = _getRegionsAtPoint(location); - if (regionsAtPoint.get() == NULL || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) + if (regionsAtPoint.get() == nullptr || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) return 0; //parse out the ones with the right property @@ -900,9 +900,9 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithGeographicalAtP result.push_back(r); } - //-- return null instead of a zero-length array + //-- return nullptr instead of a zero-length array if (result.empty ()) - return NULL; + return nullptr; //put them into the jobjectarray LocalObjectArrayRefPtr regions = createNewObjectArray(result.size(), JavaLibrary::getClsRegion()); @@ -912,10 +912,10 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithGeographicalAtP { LocalRefPtr javaRegion; const Region * r = *it; - if (r != NULL) + if (r != nullptr) { if(!ScriptConversion::convert(*r, javaRegion)) - return NULL; + return nullptr; } setObjectArrayElement(*regions, index, *javaRegion); } @@ -930,7 +930,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithDifficultyAtPoi { //get all the regions at the given point LocalObjectArrayRefPtr regionsAtPoint = _getRegionsAtPoint(location); - if (regionsAtPoint.get() == NULL || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) + if (regionsAtPoint.get() == nullptr || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) return 0; //parse out the ones with the right property @@ -946,9 +946,9 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithDifficultyAtPoi result.push_back(r); } - //-- return null instead of a zero-length array + //-- return nullptr instead of a zero-length array if (result.empty ()) - return NULL; + return nullptr; //put them into the jobjectarray LocalObjectArrayRefPtr regions = createNewObjectArray(result.size(), JavaLibrary::getClsRegion()); @@ -958,10 +958,10 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithDifficultyAtPoi { LocalRefPtr javaRegion; const Region * r = *it; - if (r != NULL) + if (r != nullptr) { if(!ScriptConversion::convert(*r, javaRegion)) - return NULL; + return nullptr; } setObjectArrayElement(*regions, index, *javaRegion); } @@ -976,7 +976,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithSpawnableAtPoin { //get all the regions at the given point LocalObjectArrayRefPtr regionsAtPoint = _getRegionsAtPoint(location); - if (regionsAtPoint.get() == NULL || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) + if (regionsAtPoint.get() == nullptr || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) return 0; //parse out the ones with the right property @@ -992,9 +992,9 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithSpawnableAtPoin result.push_back(r); } - //-- return null instead of a zero-length array + //-- return nullptr instead of a zero-length array if (result.empty ()) - return NULL; + return nullptr; //put them into the jobjectarray LocalObjectArrayRefPtr regions = createNewObjectArray(result.size(), JavaLibrary::getClsRegion()); @@ -1004,10 +1004,10 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithSpawnableAtPoin { LocalRefPtr javaRegion; const Region * r = *it; - if (r != NULL) + if (r != nullptr) { if(!ScriptConversion::convert(*r, javaRegion)) - return NULL; + return nullptr; } setObjectArrayElement(*regions, index, *javaRegion); } @@ -1022,7 +1022,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithMissionAtPoint( { //get all the regions at the given point LocalObjectArrayRefPtr regionsAtPoint = _getRegionsAtPoint(location); - if (regionsAtPoint.get() == NULL || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) + if (regionsAtPoint.get() == nullptr || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) return 0; //parse out the ones with the right property @@ -1038,9 +1038,9 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithMissionAtPoint( result.push_back(r); } - //-- return null instead of a zero-length array + //-- return nullptr instead of a zero-length array if (result.empty ()) - return NULL; + return nullptr; //put them into the jobjectarray LocalObjectArrayRefPtr regions = createNewObjectArray(result.size(), JavaLibrary::getClsRegion()); @@ -1050,10 +1050,10 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithMissionAtPoint( { LocalRefPtr javaRegion; const Region * r = *it; - if (r != NULL) + if (r != nullptr) { if(!ScriptConversion::convert(*r, javaRegion)) - return NULL; + return nullptr; } setObjectArrayElement(*regions, index, *javaRegion); } @@ -1072,16 +1072,16 @@ jobject JNICALL ScriptMethodsRegionNamespace::getSmallestRegionAtPoint(JNIEnv *e Vector locationVec; std::string sceneId; if(!ScriptConversion::convertWorld(location, locationVec, sceneId)) - return NULL; + return nullptr; const Region * r = RegionMaster::getSmallestRegionAtPoint(sceneId, locationVec.x, locationVec.z); - if (r == NULL) - return NULL; + if (r == nullptr) + return nullptr; LocalRefPtr region; if (!ScriptConversion::convert(*r, region)) - return NULL; + return nullptr; return region->getReturnValue(); } @@ -1095,16 +1095,16 @@ jobject JNICALL ScriptMethodsRegionNamespace::getSmallestVisibleRegionAtPoint(JN Vector locationVec; std::string sceneId; if(!ScriptConversion::convertWorld(location, locationVec, sceneId)) - return NULL; + return nullptr; const Region * r = RegionMaster::getSmallestVisibleRegionAtPoint(sceneId, locationVec.x, locationVec.z); - if (r == NULL) - return NULL; + if (r == nullptr) + return nullptr; LocalRefPtr region; if (!ScriptConversion::convert(*r, region)) - return NULL; + return nullptr; return region->getReturnValue(); } @@ -1140,7 +1140,7 @@ jlong JNICALL ScriptMethodsRegionNamespace::createCircleRegionWithSpawn(JNIEnv * UNREF(self); // validate scripter's input - if (center == NULL || radius <= 0 || name == 0) + if (center == nullptr || radius <= 0 || name == 0) return 0; JavaStringParam jname(name); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsRegion3d.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsRegion3d.cpp index 37c9f942..6e209336 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsRegion3d.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsRegion3d.cpp @@ -87,7 +87,7 @@ struct Region3dPtrVolumeComparator ScriptParams *ScriptMethodsRegion3dNamespace::convertRegionDictionaryToScriptParams(jobject regionDictionary) { - // If we're passed a null dictionary, we just don't have any extra data but + // If we're passed a nullptr dictionary, we just don't have any extra data but // we still want to return a ScriptParams to fill in the standard values. if (!regionDictionary) return new ScriptParams; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsResource.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsResource.cpp index e908612c..04404908 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsResource.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsResource.cpp @@ -459,7 +459,7 @@ jstring JNICALL ScriptMethodsResourceNamespace::getResourceContainerForType(JNIE { ResourceTypeObject const * const typeObj = ServerUniverse::getInstance().getResourceTypeById(NetworkId(resourceType)); if (!typeObj) - return NULL; + return nullptr; std::string templateName; typeObj->getCrateTemplate(templateName); @@ -473,7 +473,7 @@ jstring JNICALL ScriptMethodsResourceNamespace::getResourceName(JNIEnv * /*env*/ { if (resourceType == 0) { - WARNING(true, ("JavaLibrary::getResourceName passed null resource type")); + WARNING(true, ("JavaLibrary::getResourceName passed nullptr resource type")); return 0; } @@ -494,7 +494,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::getResourceNames(JNIEnv *en { if (resourceTypes == 0) { - WARNING(true, ("JavaLibrary::getResourceNames passed null resource types")); + WARNING(true, ("JavaLibrary::getResourceNames passed nullptr resource types")); return 0; } @@ -517,7 +517,7 @@ jstring JNICALL ScriptMethodsResourceNamespace::getResourceClassName(JNIEnv *env { if (resourceClass == 0) { - WARNING(true, ("JavaLibrary::getResourceClassName passed null resource class")); + WARNING(true, ("JavaLibrary::getResourceClassName passed nullptr resource class")); return 0; } @@ -531,7 +531,7 @@ jstring JNICALL ScriptMethodsResourceNamespace::getResourceClassName(JNIEnv *env const ServerResourceClassObject * resClass = safe_cast( ServerUniverse::getInstance().getResourceClassByName(resourceClassName)); - if (resClass == NULL) + if (resClass == nullptr) { WARNING(true, ("JavaLibrary::getResourceClassName cannot find resource class for %s", resourceClassName.c_str())); return 0; @@ -547,7 +547,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::getResourceClassNames(JNIEn { if (resourceClasses == 0) { - WARNING(true, ("JavaLibrary::getResourceClassNames passed null resource classes")); + WARNING(true, ("JavaLibrary::getResourceClassNames passed nullptr resource classes")); return 0; } @@ -569,7 +569,7 @@ jlongArray JNICALL ScriptMethodsResourceNamespace::getResourceTypes(JNIEnv * env { if (resourceClass == 0) { - WARNING(true, ("JavaLibrary::getResourceTypes passed null resource class")); + WARNING(true, ("JavaLibrary::getResourceTypes passed nullptr resource class")); return 0; } @@ -583,7 +583,7 @@ jlongArray JNICALL ScriptMethodsResourceNamespace::getResourceTypes(JNIEnv * env const ServerResourceClassObject * resClass = safe_cast( ServerUniverse::getInstance().getResourceClassByName(resourceClassName)); - if (resClass == NULL) + if (resClass == nullptr) { WARNING(true, ("JavaLibrary::getResourceTypes cannot find resource class for %s", resourceClassName.c_str())); return 0; @@ -604,7 +604,7 @@ jlongArray JNICALL ScriptMethodsResourceNamespace::getResourceTypes(JNIEnv * env jlong jlongTmp; for (size_t i = 0; i < count; ++i) { - if (types[i] != NULL) + if (types[i] != nullptr) { jlongTmp = (types[i]->getNetworkId()).getValue(); setLongArrayRegion(*jtypes, i, 1, &jlongTmp); @@ -619,7 +619,7 @@ jstring JNICALL ScriptMethodsResourceNamespace::getResourceClass(JNIEnv * /*env* { if (resourceType == 0) { - WARNING(true, ("JavaLibrary::getResourceClass passed null resource type")); + WARNING(true, ("JavaLibrary::getResourceClass passed nullptr resource type")); return 0; } @@ -642,7 +642,7 @@ jstring JNICALL ScriptMethodsResourceNamespace::getResourceParentClass(JNIEnv * { if (resourceClass == 0) { - WARNING(true, ("JavaLibrary::getResourceParentClass passed null resource class")); + WARNING(true, ("JavaLibrary::getResourceParentClass passed nullptr resource class")); return 0; } @@ -655,14 +655,14 @@ jstring JNICALL ScriptMethodsResourceNamespace::getResourceParentClass(JNIEnv * } const ResourceClassObject * resClass = ServerUniverse::getInstance().getResourceClassByName(resourceClassName); - if (resClass == NULL) + if (resClass == nullptr) { WARNING(true, ("JavaLibrary::getResourceParentClass cannot find resource class for %s", resourceClassName.c_str())); return 0; } const ResourceClassObject * parentClass = resClass->getParent(); - if (parentClass == NULL) + if (parentClass == nullptr) return 0; JavaString parentClassName(parentClass->getResourceClassName()); @@ -675,7 +675,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::getResourceChildClasses(JNI { if (resourceClass == 0) { - WARNING(true, ("JavaLibrary::getResourceChildClasses passed null resource class")); + WARNING(true, ("JavaLibrary::getResourceChildClasses passed nullptr resource class")); return 0; } @@ -688,7 +688,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::getResourceChildClasses(JNI } const ResourceClassObject * resClass = ServerUniverse::getInstance().getResourceClassByName(resourceClassName); - if (resClass == NULL) + if (resClass == nullptr) { WARNING(true, ("JavaLibrary::getResourceChildClasses cannot find resource class for %s", resourceClassName.c_str())); return 0; @@ -701,7 +701,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::getResourceChildClasses(JNI LocalObjectArrayRefPtr childrenArray = createNewObjectArray(static_cast(count), JavaLibrary::getClsString()); for (size_t i = 0; i < count; ++i) { - if (children[i] != NULL) + if (children[i] != nullptr) { JavaString name(children[i]->getResourceClassName()); setObjectArrayElement(*childrenArray, static_cast(i), name); @@ -716,7 +716,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::getImmediateResourceChildCl { if (resourceClass == 0) { - WARNING(true, ("JavaLibrary::getImmediateResourceChildClasses passed null resource class")); + WARNING(true, ("JavaLibrary::getImmediateResourceChildClasses passed nullptr resource class")); return 0; } @@ -729,7 +729,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::getImmediateResourceChildCl } const ResourceClassObject * resClass = ServerUniverse::getInstance().getResourceClassByName(resourceClassName); - if (resClass == NULL) + if (resClass == nullptr) { WARNING(true, ("JavaLibrary::getImmediateResourceChildClasses cannot find resource class for %s", resourceClassName.c_str())); return 0; @@ -742,7 +742,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::getImmediateResourceChildCl LocalObjectArrayRefPtr childrenArray = createNewObjectArray(count, JavaLibrary::getClsString()); for (int i = 0; i < count; ++i) { - if (children[i] != NULL) + if (children[i] != nullptr) { JavaString name(children[i]->getResourceClassName()); setObjectArrayElement(*childrenArray, i, name); @@ -757,7 +757,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::getLeafResourceChildClasses { if (resourceClass == 0) { - WARNING(true, ("JavaLibrary::getLeafResourceChildClasses passed null resource class")); + WARNING(true, ("JavaLibrary::getLeafResourceChildClasses passed nullptr resource class")); return 0; } @@ -770,7 +770,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::getLeafResourceChildClasses } const ResourceClassObject * resClass = ServerUniverse::getInstance().getResourceClassByName(resourceClassName); - if (resClass == NULL) + if (resClass == nullptr) { WARNING(true, ("JavaLibrary::getLeafResourceChildClasses cannot find resource class for %s", resourceClassName.c_str())); return 0; @@ -783,7 +783,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::getLeafResourceChildClasses LocalObjectArrayRefPtr childrenArray = createNewObjectArray(count, JavaLibrary::getClsString()); for (int i = 0; i < count; ++i) { - if (children[i] != NULL) + if (children[i] != nullptr) { JavaString name(children[i]->getResourceClassName()); setObjectArrayElement(*childrenArray, i, name); @@ -798,7 +798,7 @@ jboolean JNICALL ScriptMethodsResourceNamespace::hasResourceType(JNIEnv *env, jo { if (resourceClass == 0) { - WARNING(true, ("JavaLibrary::hasResourceType passed null resource class")); + WARNING(true, ("JavaLibrary::hasResourceType passed nullptr resource class")); return JNI_FALSE; } @@ -811,7 +811,7 @@ jboolean JNICALL ScriptMethodsResourceNamespace::hasResourceType(JNIEnv *env, jo } ServerResourceClassObject const * const resClass = safe_cast(ServerUniverse::getInstance().getResourceClassByName(resourceClassName)); - if (resClass == NULL) + if (resClass == nullptr) { WARNING(true, ("JavaLibrary::hasResourceType cannot find resource class for %s", resourceClassName.c_str())); return JNI_FALSE; @@ -826,13 +826,13 @@ jlong JNICALL ScriptMethodsResourceNamespace::createResourceCrate(JNIEnv * /*env { if (resourceType == 0) { - WARNING(true, ("JavaLibrary::createResourceCrate passed null resource type")); + WARNING(true, ("JavaLibrary::createResourceCrate passed nullptr resource type")); return 0; } if (destination == 0) { - WARNING(true, ("JavaLibrary::createResourceCrate passed null destination")); + WARNING(true, ("JavaLibrary::createResourceCrate passed nullptr destination")); return 0; } @@ -849,7 +849,7 @@ jlong JNICALL ScriptMethodsResourceNamespace::createResourceCrate(JNIEnv * /*env return 0; } - ServerObject * container = NULL; + ServerObject * container = nullptr; if (!JavaLibrary::getObject(destination, container)) { WARNING(true, ("JavaLibrary::createResourceCrate cannot find destination object")); @@ -860,14 +860,14 @@ jlong JNICALL ScriptMethodsResourceNamespace::createResourceCrate(JNIEnv * /*env rt->getCrateTemplate(crateTemplateName); ServerObject * object = ServerWorld::createNewObject(crateTemplateName, *container, true); - if (object == NULL) + if (object == nullptr) { WARNING(true, ("JavaLibrary::createResourceCrate cannot create crate from template %s", crateTemplateName.c_str())); return 0; } ResourceContainerObject * crate = dynamic_cast(object); - if (crate == NULL) + if (crate == nullptr) { IGNORE_RETURN(object->permanentlyDestroy(DeleteReasons::SetupFailed)); WARNING(true, ("JavaLibrary::createResourceCrate crate %s is not a resource container", crateTemplateName.c_str())); @@ -888,13 +888,13 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::requestResourceList(JNIEnv { if (loc == 0) { - WARNING(true, ("JavaLibrary::requestResourceList passed null location")); + WARNING(true, ("JavaLibrary::requestResourceList passed nullptr location")); return 0; } if (resourceClass == 0) { - WARNING(true, ("JavaLibrary::requestResourceList passed null resource class")); + WARNING(true, ("JavaLibrary::requestResourceList passed nullptr resource class")); return 0; } @@ -921,7 +921,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::requestResourceList(JNIEnv const Vector & locationPos = location.getCoordinates(); const PlanetObject * planet = ServerUniverse::getInstance().getPlanetByName(location.getSceneId()); - if (planet == NULL) + if (planet == nullptr) { WARNING(true, ("JavaLibrary::requestResourceList cannot find planet %s", location.getSceneId())); return 0; @@ -929,7 +929,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::requestResourceList(JNIEnv // get the resource class and all its children ServerResourceClassObject const * const resClass = safe_cast(ServerUniverse::getInstance().getResourceClassByName(resourceClassName)); - if (resClass == NULL) + if (resClass == nullptr) { WARNING(true, ("JavaLibrary::requestResourceList cannot find resource class %s", resourceClassName.c_str())); return 0; @@ -951,7 +951,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::requestResourceList(JNIEnv if (!(*i)->isDepleted()) { ResourcePoolObject const * const pool = (*i)->getPoolForPlanet(*planet); - if (pool != NULL) + if (pool != nullptr) { float density = pool->getEfficiencyAtLocation(locationPos.x, locationPos.z); if (density >= minDensity && density <= maxDensity) @@ -1049,7 +1049,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::getScaledResourceAttributes return 0; } ServerResourceClassObject const * const resClass = safe_cast(ServerUniverse::getInstance().getResourceClassByName(resourceClassName)); - if (resClass == NULL) + if (resClass == nullptr) { WARNING(true, ("JavaLibrary::getScaledResourceAttributes cannot find resource class %s", resourceClassName.c_str())); return 0; @@ -1152,7 +1152,7 @@ jint JNICALL ScriptMethodsResourceNamespace::getResourceAttribute(JNIEnv * /*env if (resourceType == 0) { - WARNING(true, ("JavaLibrary::getResourceAttribute passed null resource type")); + WARNING(true, ("JavaLibrary::getResourceAttribute passed nullptr resource type")); return -1; } @@ -1171,7 +1171,7 @@ jint JNICALL ScriptMethodsResourceNamespace::getResourceAttribute(JNIEnv * /*env jlong JNICALL ScriptMethodsResourceNamespace::getRecycledVersionOfResourceType(JNIEnv * /*env*/, jobject /*self*/, jlong resourceType) { ResourceTypeObject const * const resourceTypeObject = ServerUniverse::getInstance().getResourceTypeById(NetworkId(resourceType)); - ResourceTypeObject const * const recycledTypeObject = resourceTypeObject ? resourceTypeObject->getRecycledVersion() : NULL; + ResourceTypeObject const * const recycledTypeObject = resourceTypeObject ? resourceTypeObject->getRecycledVersion() : nullptr; if (recycledTypeObject) return (recycledTypeObject->getNetworkId()).getValue(); else diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsScript.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsScript.cpp index 7d600707..a7e06d57 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsScript.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsScript.cpp @@ -121,7 +121,7 @@ jint JNICALL ScriptMethodsScriptNamespace::attachScript(JNIEnv *env, jobject sel return SCRIPT_OVERRIDE; GameScriptObject* scripts = object->getScriptObject(); - if (scripts == NULL) + if (scripts == nullptr) return SCRIPT_OVERRIDE; char buffer[MAX_SCRIPT_NAME_LEN]; @@ -162,7 +162,7 @@ jboolean JNICALL ScriptMethodsScriptNamespace::detachScript(JNIEnv *env, jobject return JNI_FALSE; GameScriptObject* scripts = object->getScriptObject(); - if (scripts == NULL) + if (scripts == nullptr) return JNI_FALSE; char buffer[MAX_SCRIPT_NAME_LEN]; @@ -192,7 +192,7 @@ jboolean JNICALL ScriptMethodsScriptNamespace::detachAllScripts(JNIEnv *env, job return JNI_FALSE; GameScriptObject* scriptObject = object->getScriptObject(); - if (scriptObject == NULL) + if (scriptObject == nullptr) return JNI_FALSE; std::vector scriptNames; @@ -230,7 +230,7 @@ jboolean JNICALL ScriptMethodsScriptNamespace::hasScript(JNIEnv *env, jobject se return JNI_FALSE; GameScriptObject* scripts = object->getScriptObject(); - if (scripts == NULL) + if (scripts == nullptr) return JNI_FALSE; char buffer[MAX_SCRIPT_NAME_LEN]; @@ -325,7 +325,7 @@ jboolean JNICALL ScriptMethodsScriptNamespace::localMessageTo(JNIEnv *env, jobje else { GameScriptObject* scripts = object->getScriptObject(); - if (scripts == NULL) + if (scripts == nullptr) return JNI_FALSE; ScriptDictionaryPtr dictionary(new JavaDictionary(params)); @@ -400,7 +400,7 @@ jboolean JNICALL ScriptMethodsScriptNamespace::remoteMessageTo(JNIEnv *env, jobj * "messageTo" for players on the current planet * * If you want everyone on the planet to receive the message, -* specify null for loc and -1.0f for radius; otherwise, specify +* specify nullptr for loc and -1.0f for radius; otherwise, specify * a loc and a radius and only players on the planet within the * specified area will receive the message */ @@ -447,7 +447,7 @@ jint JNICALL ScriptMethodsScriptNamespace::remoteMessageToCalendarTimeDayOfWeek( return -1; // calculate the absolute time when the messageTo should go off - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); time_t const timeTarget = CalendarTime::getNextGMTTimeOcurrence(timeNow, dayOfWeek, hour, minute, second); if ((timeTarget <= 0) || (timeTarget <= timeNow)) @@ -487,7 +487,7 @@ jint JNICALL ScriptMethodsScriptNamespace::remoteMessageToCalendarTimeDayOfMonth return -1; // calculate the absolute time when the messageTo should go off - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); time_t const timeTarget = CalendarTime::getNextGMTTimeOcurrence(timeNow, month, dayOfMonth, hour, minute, second); if ((timeTarget <= 0) || (timeTarget <= timeNow)) @@ -562,7 +562,7 @@ void JNICALL ScriptMethodsScriptNamespace::cancelRecurringMessageTo(JNIEnv *env, // returns -1 if object doesn't have the messageTo jint JNICALL ScriptMethodsScriptNamespace::timeUntilMessageTo(JNIEnv *env, jobject self, jlong object, jstring methodName) { - ServerObject const * so = NULL; + ServerObject const * so = nullptr; if (!JavaLibrary::getObject(object, so)) return -1; @@ -606,7 +606,7 @@ jint JNICALL ScriptMethodsScriptNamespace::getCalendarTimeSeconds(JNIEnv * env, if(env == 0) return 0; - return ::time(NULL); + return ::time(nullptr); } //----------------------------------------------------------------------- @@ -616,7 +616,7 @@ jint JNICALL ScriptMethodsScriptNamespace::getCalendarTimeSeconds2(JNIEnv * env, if(env == 0) return -1; - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); if (!timeinfo) return -1; @@ -678,7 +678,7 @@ jint JNICALL ScriptMethodsScriptNamespace::secondsUntilCalendarTimeDayOfWeek(JNI UNREF(self); // calculate the time between now and the specified time - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); time_t const timeTarget = CalendarTime::getNextGMTTimeOcurrence(timeNow, dayOfWeek, hour, minute, second); if ((timeTarget <= 0) || (timeTarget <= timeNow)) @@ -694,7 +694,7 @@ jint JNICALL ScriptMethodsScriptNamespace::secondsUntilCalendarTimeDayOfMonth(JN UNREF(self); // calculate the time between now and the specified time - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); time_t const timeTarget = CalendarTime::getNextGMTTimeOcurrence(timeNow, month, dayOfMonth, hour, minute, second); if ((timeTarget <= 0) || (timeTarget <= timeNow)) diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsServerUI.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsServerUI.cpp index db36bd13..c925aae3 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsServerUI.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsServerUI.cpp @@ -83,14 +83,14 @@ jint JNICALL ScriptMethodsServerUINamespace::createSuiPage(JNIEnv *env, jobject JavaStringParam localPageName(pageName); jint failureCode = -1; - ServerObject* owner = NULL; + ServerObject* owner = nullptr; if(!JavaLibrary::getObject(ownerobject, owner)) { WARNING(true, ("SUI: couldn't get owner ServerObject*, can't create a page")); return failureCode; } - ServerObject* so = NULL; + ServerObject* so = nullptr; if(!JavaLibrary::getObject(client, so)) return failureCode; @@ -296,7 +296,7 @@ jboolean JNICALL ScriptMethodsServerUINamespace::subscribeToSuiEvent(JNIEnv } std::string ewn; - if (eventWidgetName != NULL) + if (eventWidgetName != nullptr) { JavaStringParam localEventWidgetName(eventWidgetName); JavaLibrary::convert(localEventWidgetName, ewn); @@ -323,7 +323,7 @@ jboolean JNICALL ScriptMethodsServerUINamespace::subscribeToSuiPropertyForEv } std::string ewn; - if (eventWidgetName != NULL) + if (eventWidgetName != nullptr) { JavaStringParam localEventWidgetName(eventWidgetName); JavaLibrary::convert(localEventWidgetName, ewn); @@ -411,7 +411,7 @@ jboolean JNICALL ScriptMethodsServerUINamespace::setSuiAssociatedLocation(JN return JNI_FALSE; } - ServerObject* associatedObject = NULL; + ServerObject* associatedObject = nullptr; if(!JavaLibrary::getObject(j_associatedObjectId, associatedObject)) { DEBUG_WARNING(true, ("could not find object for associatedObjectid")); @@ -441,12 +441,12 @@ jboolean JNICALL ScriptMethodsServerUINamespace::setSuiMaxRangeToObject(JNIE jboolean JNICALL ScriptMethodsServerUINamespace::clientMinigameOpen(JNIEnv *env, jobject self, jlong player, jobject data) { - ServerObject* playerServerObject = NULL; + ServerObject* playerServerObject = nullptr; if(!JavaLibrary::getObject(player, playerServerObject)) return JNI_FALSE; CreatureObject * creatureObject = playerServerObject->asCreatureObject(); - if(creatureObject != NULL) + if(creatureObject != nullptr) { ValueDictionary gameData; JavaLibrary::convert(data, gameData); @@ -462,12 +462,12 @@ jboolean JNICALL ScriptMethodsServerUINamespace::clientMinigameOpen(JNIEnv *env, jboolean JNICALL ScriptMethodsServerUINamespace::clientMinigameClose(JNIEnv *env, jobject self, jlong player, jobject data) { - ServerObject* playerServerObject = NULL; + ServerObject* playerServerObject = nullptr; if(!JavaLibrary::getObject(player, playerServerObject)) return JNI_FALSE; CreatureObject * creatureObject = playerServerObject->asCreatureObject(); - if(creatureObject != NULL) + if(creatureObject != nullptr) { ValueDictionary gameData; JavaLibrary::convert(data, gameData); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsShip.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsShip.cpp index 8c40cd6c..4db4502b 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsShip.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsShip.cpp @@ -83,13 +83,13 @@ namespace ScriptMethodsShipNamespace { //-- Make sure ships are enabled if (!verifyShipsEnabled()) - return NULL; + return nullptr; char buf[256]; snprintf(buf, sizeof(buf), "JavaLibrary::%s: ship obj_id did not resolve to a ShipObject", functionName); ShipObject * const shipObject = JavaLibrary::getShipThrow(env, jobject_shipId, buf, throwIfNotOnServer); if (!shipObject) - return NULL; + return nullptr; if (chassisSlot != ShipChassisSlotType::SCST_num_types && !shipObject->isSlotInstalled(chassisSlot)) JAVA_THROW_SCRIPT_EXCEPTION(true, ("JavaLibrary::%s chassisSlot [%d] not installed", functionName, chassisSlot)); @@ -1115,17 +1115,17 @@ jstring JNICALL ScriptMethodsShipNamespace::getShipChassisType(JNIEnv * env, job { //-- Make sure ships are enabled if (!verifyShipsEnabled()) - return NULL; + return nullptr; ShipObject const * const shipObject = JavaLibrary::getShipThrow(env, jobject_shipId, "getShipChassisType(): shipId obj_id did not resolve to a ShipObject", false); if (!shipObject) - return NULL; + return nullptr; ShipChassis const * const shipChassis = ShipChassis::findShipChassisByCrc (shipObject->getChassisType()); if (shipChassis) return JavaString(shipChassis->getName ().getString ()).getReturnValue(); - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -1339,7 +1339,7 @@ jstring JNICALL ScriptMethodsShipNamespace::getShipComponentName(JNIEnv * env, j { ShipObject const * const shipObject = JavaLibrary::getShipThrow(env, jobject_shipId, "getShipComponentName() invalid ship", false); if (!shipObject) - return NULL; + return nullptr; Unicode::String const & name = shipObject->getComponentName(chassisSlot); if (!name.empty()) @@ -1918,9 +1918,9 @@ void JNICALL ScriptMethodsShipNamespace::setShipComponentName(JNIEnv * env, jobj if (!shipObject) return; - if (componentName == NULL) + if (componentName == nullptr) { - JAVA_THROW_SCRIPT_EXCEPTION(true, ("JavaLibrary::setShipComponentName (): null name")); + JAVA_THROW_SCRIPT_EXCEPTION(true, ("JavaLibrary::setShipComponentName (): nullptr name")); return; } @@ -2442,7 +2442,7 @@ jboolean JNICALL ScriptMethodsShipNamespace::shipCanInstallComponent(JNIEnv * en return false; TangibleObject * tangibleComponent = 0; - if (JavaLibrary::getObject (component, tangibleComponent) && tangibleComponent != NULL) + if (JavaLibrary::getObject (component, tangibleComponent) && tangibleComponent != nullptr) return shipObject->canInstallComponent(chassisSlot, *tangibleComponent); else { @@ -2481,7 +2481,7 @@ jboolean JNICALL ScriptMethodsShipNamespace::shipInstallComponent(JNIEnv * env, NetworkId installerId(jobject_installerId); TangibleObject * tangibleComponent = 0; - if (JavaLibrary::getObject (component, tangibleComponent) && tangibleComponent != NULL) + if (JavaLibrary::getObject (component, tangibleComponent) && tangibleComponent != nullptr) return shipObject->installComponent(installerId, chassisSlot, *tangibleComponent); else { @@ -2546,11 +2546,11 @@ jintArray JNICALL ScriptMethodsShipNamespace::getShipChassisSlots(JNIEnv * env, { //-- Make sure ships are enabled if (!verifyShipsEnabled()) - return NULL; + return nullptr; ShipObject const * const shipObject = JavaLibrary::getShipThrow(env, jobject_shipId, "getShipChassisSlots(): shipId obj_id did not resolve to a ShipObject", false); if (!shipObject) - return NULL; + return nullptr; ShipChassis const * const shipChassis = ShipChassis::findShipChassisByCrc (shipObject->getChassisType()); if (shipChassis) @@ -2571,7 +2571,7 @@ jintArray JNICALL ScriptMethodsShipNamespace::getShipChassisSlots(JNIEnv * env, } } - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -2585,7 +2585,7 @@ jint JNICALL ScriptMethodsShipNamespace::getShipComponentDescriptorType(JNIEnv * TangibleObject * tangibleComponent = 0; if (JavaLibrary::getObject (jobject_component, tangibleComponent)) { - if (tangibleComponent != NULL && tangibleComponent->getObjectTemplate () != NULL) + if (tangibleComponent != nullptr && tangibleComponent->getObjectTemplate () != nullptr) { ShipComponentDescriptor const * const shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByObjectTemplate (tangibleComponent->getObjectTemplate ()->getCrcName ().getCrc ()); @@ -2623,7 +2623,7 @@ jstring JNICALL ScriptMethodsShipNamespace::getShipComponentDescriptorTypeNam { //-- Make sure ships are enabled if (!verifyShipsEnabled()) - return NULL; + return nullptr; std::string const & typeName = ShipComponentType::getNameFromType(static_cast(componentType)); @@ -2641,7 +2641,7 @@ jint JNICALL ScriptMethodsShipNamespace::getShipComponentDescriptorCrc(JNI TangibleObject * tangibleComponent = 0; if (JavaLibrary::getObject (jobject_component, tangibleComponent)) { - if (tangibleComponent != NULL && tangibleComponent->getObjectTemplate () != NULL) + if (tangibleComponent != nullptr && tangibleComponent->getObjectTemplate () != nullptr) { ShipComponentDescriptor const * const shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByObjectTemplate (tangibleComponent->getObjectTemplate ()->getCrcName ().getCrc ()); @@ -2659,11 +2659,11 @@ jstring JNICALL ScriptMethodsShipNamespace::getShipComponentDescriptorCrcName { //-- Make sure ships are enabled if (!verifyShipsEnabled()) - return NULL; + return nullptr; ShipComponentDescriptor const * const shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByCrc(static_cast(componentCrc)); - if (shipComponentDescriptor == NULL) - return NULL; + if (shipComponentDescriptor == nullptr) + return nullptr; return JavaString(shipComponentDescriptor->getName().getString()).getReturnValue(); } @@ -2674,11 +2674,11 @@ jstring JNICALL ScriptMethodsShipNamespace::getShipComponentDescriptorCompati { //-- Make sure ships are enabled if (!verifyShipsEnabled()) - return NULL; + return nullptr; ShipComponentDescriptor const * const shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByCrc(static_cast(componentCrc)); - if (shipComponentDescriptor == NULL) - return NULL; + if (shipComponentDescriptor == nullptr) + return nullptr; return JavaString(shipComponentDescriptor->getCompatibility().getString()).getReturnValue(); } @@ -2776,15 +2776,15 @@ void JNICALL ScriptMethodsShipNamespace::notifyShipDamage(JNIEnv * env, jobject if (victimShipObject->isPlayerShip()) { //-- Get the attacker object. It can be any tangible object. - TangibleObject const * attackerTangibleObject = NULL; + TangibleObject const * attackerTangibleObject = nullptr; if (jobject_attacker) IGNORE_RETURN(JavaLibrary::getObject(jobject_attacker, attackerTangibleObject)); Controller * const victimShipController = victimShipObject->getController(); if (victimShipController) { - ShipDamageMessage shipDamage(attackerTangibleObject != NULL ? attackerTangibleObject->getNetworkId() : NetworkId::cms_invalid, - attackerTangibleObject != NULL ? attackerTangibleObject->getPosition_w() : victimShipObject->getPosition_w(), + ShipDamageMessage shipDamage(attackerTangibleObject != nullptr ? attackerTangibleObject->getNetworkId() : NetworkId::cms_invalid, + attackerTangibleObject != nullptr ? attackerTangibleObject->getPosition_w() : victimShipObject->getPosition_w(), totalDamage ); //lint -esym(429, damageMessage) @@ -3008,7 +3008,7 @@ jlong JNICALL ScriptMethodsShipNamespace::getDroidControlDeviceForShip(JNIEnv * NetworkId const & droidControlDeviceId = shipObject->getInstalledDroidControlDevice(); Object const * const droidControlDevice = NetworkIdManager::getObjectById(droidControlDeviceId); - ServerObject const * const serverDroidControlDevice = droidControlDevice ? droidControlDevice->asServerObject() : NULL; + ServerObject const * const serverDroidControlDevice = droidControlDevice ? droidControlDevice->asServerObject() : nullptr; if(!serverDroidControlDevice) return 0; else @@ -3050,7 +3050,7 @@ void JNICALL ScriptMethodsShipNamespace::commPlayers(JNIEnv *env, jobject /*self uint32 appearanceOverloadSharedTemplateCrc = 0; ObjectTemplate const * const ot = ObjectTemplateList::fetch(Unicode::wideToNarrow(appearanceOverloadServerTemplateWide)); - ServerObjectTemplate const * const sot = ot ? ot->asServerObjectTemplate() : NULL; + ServerObjectTemplate const * const sot = ot ? ot->asServerObjectTemplate() : nullptr; if(sot) { std::string const & sharedTemplateName = sot->getSharedTemplate(); @@ -3197,7 +3197,7 @@ jlong JNICALL ScriptMethodsShipNamespace::launchShipFromHangar(JNIEnv *env, jobj Transform const & finalCreateTransform = launchingShip->getTransform_o2p().rotateTranslate_l2p(finalHangarDelta_o); ServerObject * const newShip = ServerWorld::createNewObject(crcName.getCrc(), finalCreateTransform, cell, false); - if (newShip == NULL) + if (newShip == nullptr) return 0; // create an objId to return @@ -3223,7 +3223,7 @@ void JNICALL ScriptMethodsShipNamespace::handleShipDestruction(JNIEnv * en //convert ship ShipObject * const ship = JavaLibrary::getShipThrow(env, jship, "handleShipDestruction(): shipId obj_id did not resolve to a ShipObject", false); - if (ship == NULL) + if (ship == nullptr) return; DestroyShipMessage const msg(ship->getNetworkId(), severity); @@ -3401,7 +3401,7 @@ jfloat JNICALL ScriptMethodsShipNamespace::getShipInternalDamageOverTimeDamageRa return 0.0f; static ShipInternalDamageOverTime const * const idot = ShipInternalDamageOverTimeManager::findEntry(*ship, chassisSlot); - if (idot == NULL) + if (idot == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("JavaLibrary::getShipInternalDamageOverTimeDamageThreshold idot for [%s] slot [%d] not found", ship->getNetworkId().getValueString().c_str(), chassisSlot)); return 0.0f; @@ -3419,7 +3419,7 @@ jfloat JNICALL ScriptMethodsShipNamespace::getShipInternalDamageOverTimeDamageTh return 0.0f; static ShipInternalDamageOverTime const * const idot = ShipInternalDamageOverTimeManager::findEntry(*ship, chassisSlot); - if (idot == NULL) + if (idot == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("JavaLibrary::getShipInternalDamageOverTimeDamageThreshold idot for [%s] slot [%d] not found", ship->getNetworkId().getValueString().c_str(), chassisSlot)); return 0.0f; @@ -3437,11 +3437,11 @@ jboolean JNICALL ScriptMethodsShipNamespace::hasShipInternalDamageOverTime(JNIEn //convert ship ShipObject * const ship = JavaLibrary::getShipThrow(env, jship, "hasShipInternalDamageOverTime(): shipId obj_id did not resolve to a ShipObject", false); - if (ship == NULL) + if (ship == nullptr) return false; static ShipInternalDamageOverTime const * const idot = ShipInternalDamageOverTimeManager::findEntry(*ship, chassisSlot); - return idot != NULL; + return idot != nullptr; } // ---------------------------------------------------------------------- @@ -3576,7 +3576,7 @@ jboolean JNICALL ScriptMethodsShipNamespace::shipIsInNebula(JNIEnv *env, jobject std::string nebulaName; - if (NULL != j_nebulaName) + if (nullptr != j_nebulaName) { JavaStringParam const jsp(j_nebulaName); if (!JavaLibrary::convert(jsp, nebulaName)) @@ -3593,7 +3593,7 @@ jboolean JNICALL ScriptMethodsShipNamespace::shipIsInNebula(JNIEnv *env, jobject { int const id = *it; Nebula const * const nebula = NebulaManager::getNebulaById(id); - if (NULL != nebula) + if (nullptr != nebula) { if (nebula->getName() == nebulaName) return JNI_TRUE; @@ -3637,7 +3637,7 @@ jboolean JNICALL ScriptMethodsShipNamespace::setShipWingName(JNIEnv * /*env*/, j jstring JNICALL ScriptMethodsShipNamespace::getShipWingName(JNIEnv * /*env*/, jobject /*self*/, jlong target) { - ServerObject const * object = NULL; + ServerObject const * object = nullptr; if (!JavaLibrary::getObject(target, object)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("JavaLibrary::getShipWingName (): could not convert the target")); @@ -3686,7 +3686,7 @@ jboolean JNICALL ScriptMethodsShipNamespace::setShipTypeName(JNIEnv * /*env*/, j jstring JNICALL ScriptMethodsShipNamespace::getShipTypeName(JNIEnv * /*env*/, jobject /*self*/, jlong target) { - ServerObject const * object = NULL; + ServerObject const * object = nullptr; if (!JavaLibrary::getObject(target, object)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("JavaLibrary::getShipTypeName (): could not convert the target")); @@ -3735,7 +3735,7 @@ jboolean JNICALL ScriptMethodsShipNamespace::setShipDifficulty(JNIEnv * /*env*/, jstring JNICALL ScriptMethodsShipNamespace::getShipDifficulty(JNIEnv * /*env*/, jobject /*self*/, jlong target) { - ServerObject const * object = NULL; + ServerObject const * object = nullptr; if (!JavaLibrary::getObject(target, object)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("JavaLibrary::getShipDifficulty (): could not convert the target")); @@ -3783,7 +3783,7 @@ jboolean JNICALL ScriptMethodsShipNamespace::setShipFaction(JNIEnv * /*env*/, jo jstring JNICALL ScriptMethodsShipNamespace::getShipFaction(JNIEnv * /*env*/, jobject /*self*/, jlong target) { - ServerObject const * object = NULL; + ServerObject const * object = nullptr; if (!JavaLibrary::getObject(target, object)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("JavaLibrary::getShipFaction (): could not convert the target")); @@ -3871,7 +3871,7 @@ jboolean JNICALL ScriptMethodsShipNamespace::isMissionCriticalObject(JNIEnv * en if (!ship) { - JAVA_THROW_SCRIPT_EXCEPTION(true, ("isMissionCriticalObject(): playerId ship is null")); + JAVA_THROW_SCRIPT_EXCEPTION(true, ("isMissionCriticalObject(): playerId ship is nullptr")); return JNI_FALSE; } @@ -3973,7 +3973,7 @@ void JNICALL ScriptMethodsShipNamespace::setDynamicMiningAsteroidVelocity(JNIEnv } MiningAsteroidController * const miningAsteroidController = dynamic_cast(shipObject->getController()); - if (NULL == miningAsteroidController) + if (nullptr == miningAsteroidController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("setDynamicMiningAsteroidVelocity(): called on a ship which is not a dynamic mining asteroid")); return; @@ -3988,12 +3988,12 @@ jobject JNICALL ScriptMethodsShipNamespace::getDynamicMiningAsteroidVelocity(JNI { ShipObject * const shipObject = JavaLibrary::getShipThrow(env, jobject_asteroidId, "getDynamicMiningAsteroidVelocity(): shipId did not resolve to a ShipObject", false); if (!shipObject) - return NULL; + return nullptr; MiningAsteroidController * const miningAsteroidController = dynamic_cast(shipObject->getController()); - if (NULL == miningAsteroidController) + if (nullptr == miningAsteroidController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("setDynamicMiningAsteroidVelocity(): called on a ship which is not a dynamic mining asteroid")); - return NULL; + return nullptr; } Vector const & velocity_w = miningAsteroidController->getVelocity_w(); @@ -4073,7 +4073,7 @@ jlongArray JNICALL ScriptMethodsShipNamespace::getShipCargoHoldContentsResourceT { ShipObject const * const shipObject = getShipThrowTestSlot(env, jobject_shipId, "getShipCargoHoldContents()", false, static_cast(ShipChassisSlotType::SCST_cargo_hold)); if (!shipObject) - return NULL; + return nullptr; ShipObject::NetworkIdIntMap const & contents = shipObject->getCargoHoldContents(); @@ -4090,7 +4090,7 @@ jlongArray JNICALL ScriptMethodsShipNamespace::getShipCargoHoldContentsResourceT return jids->getReturnValue(); } - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -4099,7 +4099,7 @@ jintArray JNICALL ScriptMethodsShipNamespace::getShipCargoHoldContentsAmounts(JN { ShipObject const * const shipObject = getShipThrowTestSlot(env, jobject_shipId, "getShipCargoHoldContents()", false, static_cast(ShipChassisSlotType::SCST_cargo_hold)); if (!shipObject) - return NULL; + return nullptr; ShipObject::NetworkIdIntMap const & contents = shipObject->getCargoHoldContents(); @@ -4115,7 +4115,7 @@ jintArray JNICALL ScriptMethodsShipNamespace::getShipCargoHoldContentsAmounts(JN return jamounts->getReturnValue(); } - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -4125,9 +4125,9 @@ void JNICALL ScriptMethodsShipNamespace::openSpaceMiningUi(JNIEnv * env, jobject NetworkId const & playerId = NetworkId(jobject_player); NetworkId const & spaceStationId = NetworkId(jobject_spaceStation); - if (jstring_spaceStationName == NULL) + if (jstring_spaceStationName == nullptr) { - JAVA_THROW_SCRIPT_EXCEPTION(true, ("JavaLibrary::setShipComponentName (): null name")); + JAVA_THROW_SCRIPT_EXCEPTION(true, ("JavaLibrary::setShipComponentName (): nullptr name")); return; } @@ -4140,7 +4140,7 @@ void JNICALL ScriptMethodsShipNamespace::openSpaceMiningUi(JNIEnv * env, jobject } Object * const player = NetworkIdManager::getObjectById(playerId); - Controller * const controller = player ? player->getController(): NULL; + Controller * const controller = player ? player->getController(): nullptr; if (!controller) { diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsSkill.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsSkill.cpp index ae184f4b..07533c45 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsSkill.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsSkill.cpp @@ -276,7 +276,7 @@ jobjectArray JNICALL ScriptMethodsSkillNamespace::getSkillCommandsProvided(JNIEn const SkillObject * skill = getSkill(localSkillName); if(! skill) - return NULL; + return nullptr; LocalObjectArrayRefPtr strArray; if(! ScriptConversion::convert(skill->getCommandsProvided(), strArray)) @@ -293,7 +293,7 @@ jobject JNICALL ScriptMethodsSkillNamespace::getSkillPrerequisiteExperience(JNIE const SkillObject * skill = getSkill(localSkillName); if(! skill) - return NULL; + return nullptr; JavaDictionaryPtr dict; if (!JavaLibrary::convert(skill->getPrerequisiteExperienceVector(), dict)) @@ -334,7 +334,7 @@ jobjectArray JNICALL ScriptMethodsSkillNamespace::getSkillPrerequisiteSkills(JNI const SkillObject * skill = getSkill(localSkillName); if(! skill) - return NULL; + return nullptr; std::vector skillNames; std::vector::const_iterator i; @@ -358,7 +358,7 @@ jobject JNICALL ScriptMethodsSkillNamespace::getSkillPrerequisiteSpecies(JNIEnv const SkillObject * skill = getSkill(localSkillName); if(! skill) - return NULL; + return nullptr; JavaDictionaryPtr dict; if (!JavaLibrary::convert(skill->getPrerequisiteSpecies(), dict)) @@ -374,14 +374,14 @@ jstring JNICALL ScriptMethodsSkillNamespace::getSkillProfession(JNIEnv *env, job const SkillObject * const skill = getSkill(localSkillName); if(!skill) - return NULL; + return nullptr; const SkillObject * const prof = skill->findProfessionForSkill (); if(prof) { JavaString str(prof->getSkillName().c_str()); return str.getReturnValue(); } - return NULL; + return nullptr; } //----------------------------------------------------------------------- @@ -423,7 +423,7 @@ jobject JNICALL ScriptMethodsSkillNamespace::getSkillStatisticModifiers(JNIEnv * const SkillObject * skill = getSkill(localSkillName); if(! skill) - return NULL; + return nullptr; JavaDictionaryPtr dict; if (!JavaLibrary::convert(skill->getStatisticModifiers(), dict)) @@ -450,7 +450,7 @@ jint JNICALL ScriptMethodsSkillNamespace::getCreatureSkillStatisticModifier(JNIE JavaStringParam jskillStatName(skillStatName); - const CreatureObject * object = NULL; + const CreatureObject * object = nullptr; if (!JavaLibrary::getObject(creature, object)) return 0; @@ -472,7 +472,7 @@ jint JNICALL ScriptMethodsSkillNamespace::getCreatureSkillStatisticModifier(JNIE * @param creature the creature whose stat mod we want * @param skillStatNames array of names of the skill stat mods we want * - * @return the skill stat mod values, or null on error + * @return the skill stat mod values, or nullptr on error */ jintArray JNICALL ScriptMethodsSkillNamespace::getCreatureSkillStatisticModifiers(JNIEnv *env, jobject self, jlong creature, jobjectArray skillStatNames) { @@ -481,7 +481,7 @@ jintArray JNICALL ScriptMethodsSkillNamespace::getCreatureSkillStatisticModifier if (skillStatNames == 0) return 0; - const CreatureObject * object = NULL; + const CreatureObject * object = nullptr; if (!JavaLibrary::getObject(creature, object)) return 0; @@ -555,7 +555,7 @@ jint JNICALL ScriptMethodsSkillNamespace::internalGetCreatureEnhancedSkillStatis JavaStringParam jskillStatName(skillStatName); - const CreatureObject * object = NULL; + const CreatureObject * object = nullptr; if (!JavaLibrary::getObject(creature, object)) return 0; @@ -577,7 +577,7 @@ jint JNICALL ScriptMethodsSkillNamespace::internalGetCreatureEnhancedSkillStatis * @param creature the creature whose stat mod we want * @param skillStatNames array of names of the skill stat mods we want * - * @return the skill stat mod values, or null on error + * @return the skill stat mod values, or nullptr on error */ jintArray JNICALL ScriptMethodsSkillNamespace::internalGetCreatureEnhancedSkillStatisticModifiers(JNIEnv *env, jobject self, jlong creature, jobjectArray skillStatNames, jboolean useBonusCap) { @@ -586,7 +586,7 @@ jintArray JNICALL ScriptMethodsSkillNamespace::internalGetCreatureEnhancedSkillS if (skillStatNames == 0) return 0; - const CreatureObject * object = NULL; + const CreatureObject * object = nullptr; if (!JavaLibrary::getObject(creature, object)) return 0; @@ -621,7 +621,7 @@ jstring JNICALL ScriptMethodsSkillNamespace::getSkillTitleGranted(JNIEnv *env, j const SkillObject * const skill = getSkill(localSkillName); if(! skill) - return NULL; + return nullptr; if (skill->isTitle ()) return JavaString(skill->getSkillName ().c_str()).getReturnValue(); @@ -665,7 +665,7 @@ jint JNICALL ScriptMethodsSkillNamespace::grantExperiencePointsByString(JNIEnv * if(name.empty()) { // throw java exception - JavaLibrary::throwInternalScriptError("JavaLibrary::grantExperiencePoints() was passed an EMPTY or NULL experience name. This is probably not what the script intends to do, and the database cannot save unnamed XP. Change your script to ensure that it is calling grantExperiencePoints with the intended parameters."); + JavaLibrary::throwInternalScriptError("JavaLibrary::grantExperiencePoints() was passed an EMPTY or nullptr experience name. This is probably not what the script intends to do, and the database cannot save unnamed XP. Change your script to ensure that it is calling grantExperiencePoints with the intended parameters."); } else { @@ -675,7 +675,7 @@ jint JNICALL ScriptMethodsSkillNamespace::grantExperiencePointsByString(JNIEnv * WARNING(true, ("JavaLibrary::grantExperiencePointsByString called " "with target id = 0")); } - else if (targetId.getObject() == NULL) + else if (targetId.getObject() == nullptr) { if (NameManager::getInstance().getPlayerName(targetId).empty()) { @@ -683,7 +683,7 @@ jint JNICALL ScriptMethodsSkillNamespace::grantExperiencePointsByString(JNIEnv * "with target id = %s, who is not in the player name map", targetId.getValueString().c_str())); } -// else if (ServerUniverse::getInstance().getXpManager() != NULL) +// else if (ServerUniverse::getInstance().getXpManager() != nullptr) // { // ServerUniverse::getInstance().getXpManager()->grantXp(targetId, // name, amount); @@ -701,7 +701,7 @@ jint JNICALL ScriptMethodsSkillNamespace::grantExperiencePointsByString(JNIEnv * else { CreatureObject * creature = dynamic_cast(targetId.getObject()); - if (creature != NULL) + if (creature != nullptr) { result = creature->grantExperiencePoints(name, static_cast(amount)); } @@ -741,7 +741,7 @@ jint JNICALL ScriptMethodsSkillNamespace::grantExperiencePointsByInt(JNIEnv *env jint result = INT_MIN; CachedNetworkId targetId(target); - if (targetId.getObject() == NULL) + if (targetId.getObject() == nullptr) { if (targetId == CachedNetworkId::cms_cachedInvalid) { @@ -754,7 +754,7 @@ jint JNICALL ScriptMethodsSkillNamespace::grantExperiencePointsByInt(JNIEnv *env "with target id = %s, who is not in the player name map", targetId.getValueString().c_str())); } -// else if (ServerUniverse::getInstance().getXpManager() != NULL) +// else if (ServerUniverse::getInstance().getXpManager() != nullptr) // { // ServerUniverse::getInstance().getXpManager()->grantXp(targetId, // experienceTypeString, amount); @@ -772,7 +772,7 @@ jint JNICALL ScriptMethodsSkillNamespace::grantExperiencePointsByInt(JNIEnv *env else { CreatureObject * creature = dynamic_cast(targetId.getObject()); - if (creature != NULL) + if (creature != nullptr) { result = creature->grantExperiencePoints(experienceTypeString, static_cast(amount)); } @@ -977,7 +977,7 @@ jboolean JNICALL ScriptMethodsSkillNamespace::grantSchematicGroup(JNIEnv *env, j JavaStringParam groupNameParam(groupName); - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -1010,7 +1010,7 @@ jboolean JNICALL ScriptMethodsSkillNamespace::revokeSchematicGroup(JNIEnv *env, JavaStringParam groupNameParam(groupName); - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -1067,7 +1067,7 @@ jboolean JNICALL ScriptMethodsSkillNamespace::grantSchematicCrc(JNIEnv *env, job { UNREF(self); - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -1120,7 +1120,7 @@ jboolean JNICALL ScriptMethodsSkillNamespace::revokeSchematicCrc(JNIEnv *env, jo { UNREF(self); - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -1173,7 +1173,7 @@ jboolean JNICALL ScriptMethodsSkillNamespace::hasSchematicCrc(JNIEnv *env, jobje { UNREF(self); - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -1191,11 +1191,11 @@ jboolean JNICALL ScriptMethodsSkillNamespace::hasSchematicCrc(JNIEnv *env, jobje * @param self class calling this function * @param player the player * - * @return the skill mod names the player has, or null on error + * @return the skill mod names the player has, or nullptr on error */ jobjectArray JNICALL ScriptMethodsSkillNamespace::getSkillStatModListingForPlayer(JNIEnv *env, jobject self, jlong player) { - const CreatureObject * creature = NULL; + const CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(player, creature)) return 0; @@ -1221,11 +1221,11 @@ jobjectArray JNICALL ScriptMethodsSkillNamespace::getSkillStatModListingForPlaye * @param self class calling this function * @param player the player * - * @return the commands the player has, or null on error + * @return the commands the player has, or nullptr on error */ jobjectArray JNICALL ScriptMethodsSkillNamespace::getCommandListingForPlayer(JNIEnv *env, jobject self, jlong player) { - const CreatureObject * creature = NULL; + const CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(player, creature)) return 0; @@ -1261,7 +1261,7 @@ jintArray JNICALL ScriptMethodsSkillNamespace::getSkillSchematicsGranted(JNIEnv return 0; const SkillObject * skill = SkillManager::getInstance().getSkill(name); - if (skill == NULL) + if (skill == nullptr) return 0; // get all the granted schematics from the skill groups for the skill @@ -1304,11 +1304,11 @@ jintArray JNICALL ScriptMethodsSkillNamespace::getSkillSchematicsGranted(JNIEnv * @param self class calling this function * @param player the player * - * @return the schematics' crc, or null on error + * @return the schematics' crc, or nullptr on error */ jintArray JNICALL ScriptMethodsSkillNamespace::getSchematicListingForPlayer(JNIEnv *env, jobject self, jlong player) { - const CreatureObject * creature = NULL; + const CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(player, creature)) return 0; @@ -1335,7 +1335,7 @@ jintArray JNICALL ScriptMethodsSkillNamespace::getSchematicListingForPlayer(JNIE jboolean JNICALL ScriptMethodsSkillNamespace::hasCertificationsForItem(JNIEnv *env, jobject self, jlong player, jlong item) { - const CreatureObject * creatureObject = NULL; + const CreatureObject * creatureObject = nullptr; if (!JavaLibrary::getObject(player, creatureObject) || !creatureObject) return JNI_FALSE; @@ -1349,7 +1349,7 @@ jboolean JNICALL ScriptMethodsSkillNamespace::hasCertificationsForItem(JNIEnv *e } } - const TangibleObject * itemObject = NULL; + const TangibleObject * itemObject = nullptr; if (!JavaLibrary::getObject(item, itemObject) || !itemObject) return JNI_FALSE; @@ -1360,11 +1360,11 @@ jboolean JNICALL ScriptMethodsSkillNamespace::hasCertificationsForItem(JNIEnv *e jobjectArray JNICALL ScriptMethodsSkillNamespace::getRequiredCertifications(JNIEnv *env, jobject self, jlong item) { - const TangibleObject * itemAsTangible = NULL; + const TangibleObject * itemAsTangible = nullptr; if (!JavaLibrary::getObject(item, itemAsTangible) || !itemAsTangible) { JAVA_THROW_SCRIPT_EXCEPTION(true,("getRequiredCertifications called with an object that does not exist")); - return NULL; + return nullptr; } std::vector certs; @@ -1372,7 +1372,7 @@ jobjectArray JNICALL ScriptMethodsSkillNamespace::getRequiredCertifications(JNIE LocalObjectArrayRefPtr results; if (!ScriptConversion::convert(certs, results)) - return NULL; + return nullptr; return results->getReturnValue(); } @@ -1381,7 +1381,7 @@ jobjectArray JNICALL ScriptMethodsSkillNamespace::getRequiredCertifications(JNIE jstring JNICALL ScriptMethodsSkillNamespace::getSkillTemplate(JNIEnv *env, jobject self, jlong player) { - CreatureObject const * creature = NULL; + CreatureObject const * creature = nullptr; if (JavaLibrary::getObject(player, creature)) { @@ -1393,14 +1393,14 @@ jstring JNICALL ScriptMethodsSkillNamespace::getSkillTemplate(JNIEnv *env, jobje } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- void JNICALL ScriptMethodsSkillNamespace::setSkillTemplate(JNIEnv *env, jobject self, jlong player, jstring skillTemplateName) { - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (JavaLibrary::getObject(player, creature)) { @@ -1422,7 +1422,7 @@ void JNICALL ScriptMethodsSkillNamespace::setSkillTemplate(JNIEnv *env, jobject jstring JNICALL ScriptMethodsSkillNamespace::getWorkingSkill(JNIEnv *env, jobject self, jlong player) { - CreatureObject const * creature = NULL; + CreatureObject const * creature = nullptr; if (JavaLibrary::getObject(player, creature)) { @@ -1435,14 +1435,14 @@ jstring JNICALL ScriptMethodsSkillNamespace::getWorkingSkill(JNIEnv *env, jobjec } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- void JNICALL ScriptMethodsSkillNamespace::setWorkingSkill(JNIEnv *env, jobject self, jlong player, jstring workingSkillName) { - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (JavaLibrary::getObject(player, creature)) { @@ -1464,7 +1464,7 @@ void JNICALL ScriptMethodsSkillNamespace::setWorkingSkill(JNIEnv *env, jobject s void JNICALL ScriptMethodsSkillNamespace::recomputeCommandSeries(JNIEnv *env, jobject self, jlong player) { - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (JavaLibrary::getObject(player, creature)) { @@ -1476,7 +1476,7 @@ void JNICALL ScriptMethodsSkillNamespace::recomputeCommandSeries(JNIEnv *env, jo void JNICALL ScriptMethodsSkillNamespace::resetExpertises(JNIEnv *env, jobject self, jlong player) { - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (JavaLibrary::getObject(player, creature)) { diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsString.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsString.cpp index 344f0207..cb7135e7 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsString.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsString.cpp @@ -56,7 +56,7 @@ const JNINativeMethod NATIVES[] = { * @param self class calling this function * @param id the stringId to find * - * @return the string, or null on error + * @return the string, or nullptr on error */ jstring JNICALL ScriptMethodsStringNamespace::getString(JNIEnv *env, jobject self, jobject id) { @@ -64,7 +64,7 @@ jstring JNICALL ScriptMethodsStringNamespace::getString(JNIEnv *env, jobject sel if (id == 0) { - WARNING(true, ("JavaLibrary::log getString is NULL.")); + WARNING(true, ("JavaLibrary::log getString is nullptr.")); return 0; } @@ -116,7 +116,7 @@ jstring JNICALL ScriptMethodsStringNamespace::getString(JNIEnv *env, jobject sel * @param self class calling this function * @param ids array of stringIds to find * - * @return an array of strings, or null on error + * @return an array of strings, or nullptr on error */ jobjectArray JNICALL ScriptMethodsStringNamespace::getStrings(JNIEnv *env, jobject self, jobjectArray ids) { diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsSystem.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsSystem.cpp index 90861085..7dda71ba 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsSystem.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsSystem.cpp @@ -61,7 +61,7 @@ jboolean JNICALL ScriptMethodsSystemNamespace::sendConsoleCommand(JNIEnv * env, { JavaStringParam localCommand(command); - ServerObject* object = NULL; + ServerObject* object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -86,7 +86,7 @@ jboolean JNICALL ScriptMethodsSystemNamespace::sendConsoleCommand(JNIEnv * env, * @param section the config file section * @param key the config file key * - * @return the key value, or null if the key doesn't exist + * @return the key value, or nullptr if the key doesn't exist */ jstring JNICALL ScriptMethodsSystemNamespace::getConfigSetting(JNIEnv * env, jobject self, jstring section, jstring key) @@ -108,12 +108,12 @@ jstring JNICALL ScriptMethodsSystemNamespace::getConfigSetting(JNIEnv * env, job return 0; const ConfigFile::Section * sec = ConfigFile::getSection(sectionName.c_str()); - if (sec == NULL) + if (sec == nullptr) return 0; const ConfigFile::Key * ky = sec->findKey(keyName.c_str()); - if (ky == NULL) - return NULL; + if (ky == nullptr) + return nullptr; JavaString jvalue(ky->getAsString(ky->getCount()-1, "")); return jvalue.getReturnValue(); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsTerrain.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsTerrain.cpp index c56803c1..fabb32f6 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsTerrain.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsTerrain.cpp @@ -165,16 +165,16 @@ jobject JNICALL ScriptMethodsTerrainNamespace::getGoodLocation(JNIEnv * /*env*/, PROFILER_AUTO_BLOCK_DEFINE("JNI::getGoodLocation"); //validate scripter's input - if (searchRectLowerLeftLocation == NULL) + if (searchRectLowerLeftLocation == nullptr) { - DEBUG_WARNING (true, ("getGoodLocation (): DB lower left is NULL")); - return NULL; + DEBUG_WARNING (true, ("getGoodLocation (): DB lower left is nullptr")); + return nullptr; } - if (searchRectUpperRightLocation == NULL) + if (searchRectUpperRightLocation == nullptr) { - DEBUG_WARNING (true, ("getGoodLocation (): DB upper right is NULL")); - return NULL; + DEBUG_WARNING (true, ("getGoodLocation (): DB upper right is nullptr")); + return nullptr; } //pull the data from the java Location objects. sceneid and cell are not checked or used, but sent back in the good location, if one exists @@ -184,14 +184,14 @@ jobject JNICALL ScriptMethodsTerrainNamespace::getGoodLocation(JNIEnv * /*env*/, if (!ScriptConversion::convertWorld(searchRectLowerLeftLocation, srLLLocationVec, sceneId)) { DEBUG_WARNING (true, ("getGoodLocation (): DB could not convert lower left coordinates")); - return NULL; + return nullptr; } Vector srURLocationVec; if (!ScriptConversion::convertWorld(searchRectUpperRightLocation, srURLocationVec, sceneId)) { DEBUG_WARNING (true, ("getGoodLocation (): DB could not convert upper right coordinates")); - return NULL; + return nullptr; } // get the good location from ServerWorld @@ -199,7 +199,7 @@ jobject JNICALL ScriptMethodsTerrainNamespace::getGoodLocation(JNIEnv * /*env*/, if (successLoc3d.x == 0 && successLoc3d.y == 0 && successLoc3d.z == 0) { // no good location available - return NULL; + return nullptr; } //convert it back into scripter lingo (a "location"), using the default scene and cell ids @@ -207,7 +207,7 @@ jobject JNICALL ScriptMethodsTerrainNamespace::getGoodLocation(JNIEnv * /*env*/, if (!ScriptConversion::convert(successLoc3d, sceneId, NetworkId(), goodLocation)) { DEBUG_WARNING (true, ("getGoodLocation (): PB could not convert result back to a location")); - return NULL; + return nullptr; } return goodLocation->getReturnValue(); @@ -218,16 +218,16 @@ jobject JNICALL ScriptMethodsTerrainNamespace::getGoodLocationAvoidCollidables(J PROFILER_AUTO_BLOCK_DEFINE("JNI::getGoodLocationAvoidCollidables"); //validate scripter's input - if (searchRectLowerLeftLocation == NULL) + if (searchRectLowerLeftLocation == nullptr) { - DEBUG_WARNING (true, ("getGoodLocationAvoidCollidables (): DB lower left is NULL")); - return NULL; + DEBUG_WARNING (true, ("getGoodLocationAvoidCollidables (): DB lower left is nullptr")); + return nullptr; } - if (searchRectUpperRightLocation == NULL) + if (searchRectUpperRightLocation == nullptr) { - DEBUG_WARNING (true, ("getGoodLocationAvoidCollidables (): DB upper right is NULL")); - return NULL; + DEBUG_WARNING (true, ("getGoodLocationAvoidCollidables (): DB upper right is nullptr")); + return nullptr; } //pull the data from the java Location objects. sceneid and cell are not checked or used, but sent back in the good location, if one exists @@ -237,14 +237,14 @@ jobject JNICALL ScriptMethodsTerrainNamespace::getGoodLocationAvoidCollidables(J if (!ScriptConversion::convertWorld(searchRectLowerLeftLocation, srLLLocationVec, sceneId)) { DEBUG_WARNING (true, ("getGoodLocationAvoidCollidables (): DB could not convert lower left coordinates")); - return NULL; + return nullptr; } Vector srURLocationVec; if (!ScriptConversion::convertWorld(searchRectUpperRightLocation, srURLocationVec, sceneId)) { DEBUG_WARNING (true, ("getGoodLocationAvoidCollidables (): DB could not convert upper right coordinates")); - return NULL; + return nullptr; } // get the good location from ServerWorld @@ -252,7 +252,7 @@ jobject JNICALL ScriptMethodsTerrainNamespace::getGoodLocationAvoidCollidables(J if (successLoc3d.x == 0 && successLoc3d.y == 0 && successLoc3d.z == 0) { // no good location available - return NULL; + return nullptr; } //convert it back into scripter lingo (a "location"), using the default scene and cell ids @@ -260,7 +260,7 @@ jobject JNICALL ScriptMethodsTerrainNamespace::getGoodLocationAvoidCollidables(J if (!ScriptConversion::convert(successLoc3d, sceneId, NetworkId(), goodLocation)) { DEBUG_WARNING (true, ("getGoodLocationAvoidCollidables (): PB could not convert result back to a location")); - return NULL; + return nullptr; } return goodLocation->getReturnValue(); @@ -587,7 +587,7 @@ jboolean JNICALL ScriptMethodsTerrainNamespace::setWeatherData (JNIEnv* env, job UNREF(self); PlanetObject * planet = ServerUniverse::getInstance().getCurrentPlanet(); - if (planet != NULL) + if (planet != nullptr) { planet->setWeather(index, windVelocityX, 0.f, windVelocityZ); return JNI_TRUE; @@ -603,9 +603,9 @@ jboolean JNICALL ScriptMethodsTerrainNamespace::setWeatherData (JNIEnv* env, job jboolean JNICALL ScriptMethodsTerrainNamespace::isBelowWater (JNIEnv* /*env*/, jobject /*self*/, jobject location) { - if (location == NULL) + if (location == nullptr) { - DEBUG_WARNING(true, ("[designer bug] isBelowWater script hook was passed a NULL location reference")); + DEBUG_WARNING(true, ("[designer bug] isBelowWater script hook was passed a nullptr location reference")); return JNI_FALSE; } @@ -621,7 +621,7 @@ jboolean JNICALL ScriptMethodsTerrainNamespace::isBelowWater (JNIEnv* /*env*/, j const CellProperty* worldCell = CellProperty::getWorldCellProperty(); if(!worldCell) { - DEBUG_WARNING(true, ("isBelowWater got a NULL worldCell back from CellProperty::getWorldCellProperty()")); + DEBUG_WARNING(true, ("isBelowWater got a nullptr worldCell back from CellProperty::getWorldCellProperty()")); return JNI_FALSE; } const NetworkId& worldCellId = worldCell->getOwner().getNetworkId(); @@ -758,9 +758,9 @@ jfloat JNICALL ScriptMethodsTerrainNamespace::getWaterTableHeight (JNIEnv* /*env { float zero = 0.0f; - if (location == NULL) + if (location == nullptr) { - DEBUG_WARNING(true, ("[designer bug] getWaterTableHeight script hook was passed a NULL location reference")); + DEBUG_WARNING(true, ("[designer bug] getWaterTableHeight script hook was passed a nullptr location reference")); return zero; } @@ -776,7 +776,7 @@ jfloat JNICALL ScriptMethodsTerrainNamespace::getWaterTableHeight (JNIEnv* /*env const CellProperty* worldCell = CellProperty::getWorldCellProperty(); if(!worldCell) { - DEBUG_WARNING(true, ("getWaterTableHeight got a NULL worldCell back from CellProperty::getWorldCellProperty()")); + DEBUG_WARNING(true, ("getWaterTableHeight got a nullptr worldCell back from CellProperty::getWorldCellProperty()")); return zero; } const NetworkId& worldCellId = worldCell->getOwner().getNetworkId(); @@ -862,7 +862,7 @@ jboolean JNICALL ScriptMethodsTerrainNamespace::requestLocation (JNIEnv * /*env* jboolean JNICALL ScriptMethodsTerrainNamespace::isOnAFloor (JNIEnv * env, jobject self, jlong scriptObject) { //-- make sure we have a valid object - ServerObject * theObject = NULL; + ServerObject * theObject = nullptr; if (!JavaLibrary::getObject (scriptObject, theObject)) { DEBUG_WARNING (true, ("isOnAFloor (): could not find scriptObject")); @@ -876,7 +876,7 @@ jboolean JNICALL ScriptMethodsTerrainNamespace::isOnAFloor (JNIEnv * env, jobjec return JNI_FALSE; } - if(objectCollisionProp->getStandingOn() != NULL) + if(objectCollisionProp->getStandingOn() != nullptr) return JNI_TRUE; else return JNI_FALSE; @@ -890,7 +890,7 @@ jboolean JNICALL ScriptMethodsTerrainNamespace::isRelativePointOnSameFloorAsObje return JNI_FALSE; //-- make sure we have a valid object - ServerObject * theObject = NULL; + ServerObject * theObject = nullptr; if (!JavaLibrary::getObject (scriptObject, theObject)) { DEBUG_WARNING (true, ("isRelativePointOnSameFloorAsObject (): could not find scriptObject")); @@ -938,7 +938,7 @@ jfloat JNICALL ScriptMethodsTerrainNamespace::getFloorHeightAtRelativePointOnS return JNI_FALSE; //-- make sure we have a valid object - ServerObject * theObject = NULL; + ServerObject * theObject = nullptr; if (!JavaLibrary::getObject (scriptObject, theObject)) { DEBUG_WARNING (true, ("getFloorHeightAtRelativePointOnSameFloorAsObject (): could not find scriptObject")); @@ -1106,7 +1106,7 @@ jboolean JNICALL ScriptMethodsTerrainNamespace::createClientPathAdvanced(JNIEnv */ jboolean JNICALL ScriptMethodsTerrainNamespace::setCreatureCoverDefault(JNIEnv *env, jobject self, jlong target) { - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -1137,7 +1137,7 @@ jboolean JNICALL ScriptMethodsTerrainNamespace::setCreatureCover(JNIEnv *env, jo { UNREF(self); - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -1149,7 +1149,7 @@ jboolean JNICALL ScriptMethodsTerrainNamespace::setCreatureCover(JNIEnv *env, jo void JNICALL ScriptMethodsTerrainNamespace::setCreatureCoverVisibility(JNIEnv * env, jobject self, jlong target, jboolean isVisible) { - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if(!JavaLibrary::getObject(target, creature)) return; @@ -1160,7 +1160,7 @@ void JNICALL ScriptMethodsTerrainNamespace::setCreatureCoverVisibility(JNIEnv * jboolean JNICALL ScriptMethodsTerrainNamespace::getCreatureCoverVisibility(JNIEnv * env, jobject self, jlong target) { - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if(!JavaLibrary::getObject(target, creature)) return JNI_FALSE; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsVeteran.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsVeteran.cpp index d751acee..ed5f2322 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsVeteran.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsVeteran.cpp @@ -81,7 +81,7 @@ const JNINativeMethod NATIVES[] = { jobjectArray JNICALL ScriptMethodsVeteranNamespace::veteranGetTriggeredEvents(JNIEnv * /*env*/, jobject /*self*/, jlong player) { ServerObject const * const so = safe_cast(NetworkIdManager::getObjectById(NetworkId(player))); - CreatureObject const * const playerCreature = so ? so->asCreatureObject() : NULL; + CreatureObject const * const playerCreature = so ? so->asCreatureObject() : nullptr; if (playerCreature) { @@ -89,7 +89,7 @@ jobjectArray JNICALL ScriptMethodsVeteranNamespace::veteranGetTriggeredEvents(JN VeteranRewardManager::getTriggeredEventsIds(*playerCreature, eventsIds); if (eventsIds.empty()) - return NULL; + return nullptr; int i = 0; LocalObjectArrayRefPtr valueArray = createNewObjectArray(eventsIds.size(), JavaLibrary::getClsString()); @@ -102,7 +102,7 @@ jobjectArray JNICALL ScriptMethodsVeteranNamespace::veteranGetTriggeredEvents(JN return valueArray->getReturnValue(); } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -110,7 +110,7 @@ jobjectArray JNICALL ScriptMethodsVeteranNamespace::veteranGetTriggeredEvents(JN jboolean JNICALL ScriptMethodsVeteranNamespace::veteranAccountFeatureIdRequest(JNIEnv * /*env*/, jobject /*self*/, jlong player) { ServerObject * const so = safe_cast(NetworkIdManager::getObjectById(NetworkId(player))); - CreatureObject * const playerCreature = so ? so->asCreatureObject() : NULL; + CreatureObject * const playerCreature = so ? so->asCreatureObject() : nullptr; if (playerCreature) { @@ -131,7 +131,7 @@ jboolean JNICALL ScriptMethodsVeteranNamespace::veteranAccountFeatureIdRequest(J jobjectArray JNICALL ScriptMethodsVeteranNamespace::veteranGetRewardChoicesDescriptions(JNIEnv * /*env*/, jobject /*self*/, jlong player, jstring event) { ServerObject const * const so = safe_cast(NetworkIdManager::getObjectById(NetworkId(player))); - CreatureObject const * const playerCreature = so ? so->asCreatureObject() : NULL; + CreatureObject const * const playerCreature = so ? so->asCreatureObject() : nullptr; if (playerCreature) { @@ -152,7 +152,7 @@ jobjectArray JNICALL ScriptMethodsVeteranNamespace::veteranGetRewardChoicesDescr } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -160,7 +160,7 @@ jobjectArray JNICALL ScriptMethodsVeteranNamespace::veteranGetRewardChoicesDescr jobjectArray JNICALL ScriptMethodsVeteranNamespace::veteranGetRewardChoicesTags(JNIEnv * /*env*/, jobject /*self*/, jlong player, jstring event) { ServerObject const * const so = safe_cast(NetworkIdManager::getObjectById(NetworkId(player))); - CreatureObject const * const playerCreature = so ? so->asCreatureObject() : NULL; + CreatureObject const * const playerCreature = so ? so->asCreatureObject() : nullptr; if (playerCreature) { @@ -181,7 +181,7 @@ jobjectArray JNICALL ScriptMethodsVeteranNamespace::veteranGetRewardChoicesTags( } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -189,7 +189,7 @@ jobjectArray JNICALL ScriptMethodsVeteranNamespace::veteranGetRewardChoicesTags( jboolean JNICALL ScriptMethodsVeteranNamespace::veteranClaimReward(JNIEnv * /*env*/, jobject /*self*/, jlong player, jstring event, jstring rewardTag) { ServerObject const * const so = safe_cast(NetworkIdManager::getObjectById(NetworkId(player))); - CreatureObject const * const playerCreature = so ? so->asCreatureObject() : NULL; + CreatureObject const * const playerCreature = so ? so->asCreatureObject() : nullptr; if (playerCreature) { @@ -227,7 +227,7 @@ jstring JNICALL ScriptMethodsVeteranNamespace::veteranGetEventAnnouncement(JNIEn return eventAnnouncement.getReturnValue(); } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -245,7 +245,7 @@ jstring JNICALL ScriptMethodsVeteranNamespace::veteranGetEventDescription(JNIEnv return eventDescription.getReturnValue(); } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -263,7 +263,7 @@ jstring JNICALL ScriptMethodsVeteranNamespace::veteranGetEventUrl(JNIEnv * /*env return temp2.getReturnValue(); } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -313,7 +313,7 @@ jboolean JNICALL ScriptMethodsVeteranNamespace::veteranIsItemAccountUniqueFeatur void JNICALL ScriptMethodsVeteranNamespace::veteranWriteAccountDataToObjvars(JNIEnv * /*env*/, jobject /*self*/, jlong player) { ServerObject * const so = safe_cast(NetworkIdManager::getObjectById(NetworkId(player))); - CreatureObject * const playerCreature = so ? so->asCreatureObject() : NULL; + CreatureObject * const playerCreature = so ? so->asCreatureObject() : nullptr; if (playerCreature) VeteranRewardManager::writeAccountDataToObjvars(*playerCreature); @@ -323,11 +323,11 @@ void JNICALL ScriptMethodsVeteranNamespace::veteranWriteAccountDataToObjvars(JNI jboolean JNICALL ScriptMethodsVeteranNamespace::veteranCanTradeInReward(JNIEnv *env, jobject self, jlong player, jlong item) { - CreatureObject const * playerCreature = NULL; + CreatureObject const * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature) || !playerCreature) return JNI_FALSE; - ServerObject * itemObject = NULL; + ServerObject * itemObject = nullptr; if (!JavaLibrary::getObject(item, itemObject) || !itemObject) return JNI_FALSE; @@ -339,11 +339,11 @@ jboolean JNICALL ScriptMethodsVeteranNamespace::veteranCanTradeInReward(JNIEnv * void JNICALL ScriptMethodsVeteranNamespace::veteranTradeInReward(JNIEnv *env, jobject self, jlong player, jlong item) { - CreatureObject const * playerCreature = NULL; + CreatureObject const * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature) || !playerCreature) return; - ServerObject * itemObject = NULL; + ServerObject * itemObject = nullptr; if (!JavaLibrary::getObject(item, itemObject) || !itemObject) return; @@ -355,11 +355,11 @@ void JNICALL ScriptMethodsVeteranNamespace::veteranTradeInReward(JNIEnv *env, jo void JNICALL ScriptMethodsVeteranNamespace::adjustSwgTcgAccountFeatureId(JNIEnv *env, jobject self, jlong player, jlong item, jint featureId, jint adjustment) { - CreatureObject const * playerCreature = NULL; + CreatureObject const * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature) || !playerCreature) return; - ServerObject * itemObject = NULL; + ServerObject * itemObject = nullptr; if (!JavaLibrary::getObject(item, itemObject) || !itemObject) return; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsWaypoint.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsWaypoint.cpp index e9b3c546..18241735 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsWaypoint.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsWaypoint.cpp @@ -306,7 +306,7 @@ jobject JNICALL ScriptMethodsWaypointNamespace::getWaypointRegion(JNIEnv * env, if(w.isValid()) { const Region * region = RegionMaster::getSmallestVisibleRegionAtPoint(w.getLocation().getSceneId(), w.getLocation().getCoordinates().x, w.getLocation().getCoordinates().z); - if (region != NULL) + if (region != nullptr) { LocalRefPtr result; if (ScriptConversion::convert(*region, result)) diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsWorldInfo.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsWorldInfo.cpp index 3cc7c024..ca3d5b8d 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsWorldInfo.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsWorldInfo.cpp @@ -182,7 +182,7 @@ const JNINativeMethod NATIVES[] = { * @param location location that is the center of the search area * @param range radius of search area * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getObjectsInRangeLocation(JNIEnv *env, jobject self, jobject location, jfloat range) { @@ -212,7 +212,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getObjectsInRangeLocation(JN * @param location object that is the center of the search area * @param range radius of search area * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getObjectsInRangeObject(JNIEnv *env, jobject self, jlong object, jfloat range) { @@ -242,7 +242,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getObjectsInRangeObject(JNIE * @param location location that is the center of the search area * @param range radius of search area * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesInRangeLocation(JNIEnv *env, jobject self, jobject location, jfloat range) { @@ -271,7 +271,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesInRangeLocation( * @param location object that is the center of the search area * @param range radius of search area * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesInRangeObject(JNIEnv *env, jobject self, jlong object, jfloat range) { @@ -302,7 +302,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesInRangeObject(JN * @param type * @param mask * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfNicheInRangeLocation(JNIEnv *env, jobject self, jobject location, jfloat range, jint type, jint mask) { @@ -333,7 +333,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfNicheInRangeLo * @param type * @param mask * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfNicheInRangeObject(JNIEnv *env, jobject self, jlong object, jfloat range, jint type, jint mask) { @@ -363,7 +363,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfNicheInRangeOb * @param range radius of search area * @param species * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfSpeciesInRangeLocation(JNIEnv *env, jobject self, jobject location, jfloat range, jint species) { @@ -393,7 +393,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfSpeciesInRange * @param range radius of search area * @param species * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfSpeciesInRangeObject(JNIEnv *env, jobject self, jlong object, jfloat range, jint species) { @@ -424,7 +424,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfSpeciesInRange * @param species * @param race * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfRaceInRangeLocation(JNIEnv *env, jobject self, jobject location, jfloat range, jint species, jint race) { @@ -455,7 +455,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfRaceInRangeLoc * @param species * @param race * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfRaceInRangeObject(JNIEnv *env, jobject self, jlong object, jfloat range, jint species, jint race) { @@ -484,7 +484,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfRaceInRangeObj * @param location location that is the center of the search area * @param range radius of search area * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getNonCreaturesInRangeLocation(JNIEnv *env, jobject self, jobject location, jfloat range) { @@ -513,7 +513,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getNonCreaturesInRangeLocati * @param location object that is the center of the search area * @param range radius of search area * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getNonCreaturesInRangeObject(JNIEnv *env, jobject self, jlong object, jfloat range) { @@ -542,7 +542,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getNonCreaturesInRangeObject * @param location location that is the center of the search area * @param range radius of search area * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getNPCsInRangeLocation(JNIEnv *env, jobject self, jobject location, jfloat range) { @@ -571,7 +571,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getNPCsInRangeLocation(JNIEn * @param location object that is the center of the search area * @param range radius of search area * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getNPCsInRangeObject(JNIEnv *env, jobject self, jlong object, jfloat range) { @@ -600,7 +600,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getNPCsInRangeObject(JNIEnv * @param location location that is the center of the search area * @param range radius of search area * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getPlayerCreaturesInRangeLocation(JNIEnv *env, jobject self, jobject location, jfloat range) { @@ -629,7 +629,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getPlayerCreaturesInRangeLoc * @param location object that is the center of the search area * @param range radius of search area * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getPlayerCreaturesInRangeObject(JNIEnv *env, jobject self, jlong object, jfloat range) { @@ -658,7 +658,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getPlayerCreaturesInRangeObj * @param env Java environment * @param self class calling this function * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getObjectsInCone(JNIEnv *env, jobject self, jlong coneCenterObjectId, jlong coneDirectionObjectId, jfloat range, jfloat angle) { @@ -698,7 +698,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getObjectsInCone(JNIEnv *env * @param env Java environment * @param self class calling this function * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getObjectsInConeLocation(JNIEnv *env, jobject self, jlong coneCenterObjectId, jobject coneDirectionLocation, jfloat range, jfloat angle) { @@ -738,7 +738,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getObjectsInConeLocation(JNI * @param env Java environment * @param self class calling this function * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesInCone(JNIEnv *env, jobject self, jlong coneCenterObjectId, jlong coneDirectionObjectId, jfloat range, jfloat angle) { @@ -779,7 +779,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesInCone(JNIEnv *e * @param env Java environment * @param self class calling this function * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesInConeLocation(JNIEnv *env, jobject self, jlong coneCenterObjectId, jobject coneDirectionLocation, jfloat range, jfloat angle) { @@ -820,7 +820,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesInConeLocation(J * @param env Java environment * @param self class calling this function * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfNicheInCone(JNIEnv *env, jobject self, jlong coneCenterObjectId, jlong coneDirectionObjectId, jfloat range, jfloat angle, jint niche, jint mask) { @@ -860,7 +860,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfNicheInCone(JN * @param env Java environment * @param self class calling this function * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfSpeciesInCone(JNIEnv *env, jobject self, jlong coneCenterObjectId, jlong coneDirectionObjectId, jfloat range, jfloat angle, jint species) { @@ -900,7 +900,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfSpeciesInCone( * @param env Java environment * @param self class calling this function * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfRaceInCone(JNIEnv *env, jobject self, jlong coneCenterObjectId, jlong coneDirectionObjectId, jfloat range, jfloat angle, jint species, jint race) { @@ -940,7 +940,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfRaceInCone(JNI * @param env Java environment * @param self class calling this function * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getNonCreaturesInCone(JNIEnv *env, jobject self, jlong coneCenterObjectId, jlong coneDirectionObjectId, jfloat range, jfloat angle) { @@ -980,7 +980,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getNonCreaturesInCone(JNIEnv * @param env Java environment * @param self class calling this function * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getNPCsInCone(JNIEnv *env, jobject self, jlong coneCenterObjectId, jlong coneDirectionObjectId, jfloat range, jfloat angle) { @@ -1020,7 +1020,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getNPCsInCone(JNIEnv *env, j * @param env Java environment * @param self class calling this function * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getPlayerCreaturesInCone(JNIEnv *env, jobject self, jlong coneCenterObjectId, jlong coneDirectionObjectId, jfloat range, jfloat angle) { @@ -1169,7 +1169,7 @@ jlong JNICALL ScriptMethodsWorldInfoNamespace::getClosestMobile(JNIEnv *env, job return 0; ServerObject * npc = ServerWorld::findClosestNPC(target, radius); - if (npc == NULL) + if (npc == nullptr) return 0; return (npc->getNetworkId()).getValue(); } @@ -1184,7 +1184,7 @@ jlong JNICALL ScriptMethodsWorldInfoNamespace::getClosestPlayer(JNIEnv *env, job return 0; ServerObject * player = ServerWorld::findClosestPlayer(target, radius); - if (player == NULL) + if (player == nullptr) return 0; return (player->getNetworkId()).getValue(); } @@ -1209,7 +1209,7 @@ jlong JNICALL ScriptMethodsWorldInfoNamespace::getFirstObjectWithScript(JNIEnv * for (ResultsType::iterator i=results.begin(); i!=results.end(); ++i) { - if (*i != NULL && (*i)->getScriptObject()->hasScript(scriptName)) + if (*i != nullptr && (*i)->getScriptObject()->hasScript(scriptName)) return ((*i)->getNetworkId()).getValue(); } @@ -1237,7 +1237,7 @@ jlong JNICALL ScriptMethodsWorldInfoNamespace::getFirstObjectWithObjVar(JNIEnv * for (ResultsType::iterator i=results.begin(); i!=results.end(); ++i) { - if (*i != NULL && (*i)->getObjVars().hasItem(objvarName)) + if (*i != nullptr && (*i)->getObjVars().hasItem(objvarName)) return ((*i)->getNetworkId()).getValue(); } @@ -1265,7 +1265,7 @@ jlong JNICALL ScriptMethodsWorldInfoNamespace::getFirstObjectWithTemplate(JNIEnv for (ResultsType::iterator i=results.begin(); i!=results.end(); ++i) { - if (*i != NULL && templateStr == (*i)->getTemplateName()) + if (*i != nullptr && templateStr == (*i)->getTemplateName()) return ((*i)->getNetworkId()).getValue(); } @@ -1434,7 +1434,7 @@ jstring JNICALL ScriptMethodsWorldInfoNamespace::getNameForPlanetObject(JNIEnv * } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -1499,7 +1499,7 @@ jobject JNICALL ScriptMethodsWorldInfoNamespace::getValidLocation(JNIEnv *env, j // Determine if it's a valid point, and if not search for another one. - bool isValid = !CollisionWorld::query( Sphere(corralPoint,objectRadius),NULL); + bool isValid = !CollisionWorld::query( Sphere(corralPoint,objectRadius),nullptr); // ---------- @@ -1517,14 +1517,14 @@ jobject JNICALL ScriptMethodsWorldInfoNamespace::getValidLocation(JNIEnv *env, j // We failed to find a valid location - return NULL; + return nullptr; } // ---------------------------------------------------------------------- jboolean JNICALL ScriptMethodsWorldInfoNamespace::getCollidesWithObject(JNIEnv * env, jobject self, jobject jlocation, jfloat jradius) { - if (jlocation == NULL) + if (jlocation == nullptr) return JNI_FALSE; float const radius = jradius; @@ -1532,7 +1532,7 @@ jboolean JNICALL ScriptMethodsWorldInfoNamespace::getCollidesWithObject(JNIEnv * if (!ScriptConversion::convertWorld(jlocation, location)) return JNI_FALSE; - bool const result = CollisionWorld::query(Sphere(location, radius), NULL); + bool const result = CollisionWorld::query(Sphere(location, radius), nullptr); if(result) return JNI_TRUE; @@ -1556,7 +1556,7 @@ jboolean JNICALL ScriptMethodsWorldInfoNamespace::canSee(JNIEnv *env, jobject se { UNREF(self); - const ServerObject * sourceObject = NULL; + const ServerObject * sourceObject = nullptr; if (!JavaLibrary::getObject(source, sourceObject)) { NetworkId id(source); @@ -1572,7 +1572,7 @@ jboolean JNICALL ScriptMethodsWorldInfoNamespace::canSee(JNIEnv *env, jobject se return JNI_TRUE; } - const ServerObject * targetObject = NULL; + const ServerObject * targetObject = nullptr; if (!JavaLibrary::getObject(target, targetObject)) { NetworkId id(target); @@ -1608,7 +1608,7 @@ jboolean JNICALL ScriptMethodsWorldInfoNamespace::canSeeLocation(JNIEnv *env, jo { UNREF(self); - const ServerObject * sourceObject = NULL; + const ServerObject * sourceObject = nullptr; if (!JavaLibrary::getObject(source, sourceObject)) { NetworkId id(source); @@ -1640,11 +1640,11 @@ jboolean JNICALL ScriptMethodsWorldInfoNamespace::canManipulate(JNIEnv *env, job { UNREF(self); - const CreatureObject * sourceObject = NULL; + const CreatureObject * sourceObject = nullptr; if (!JavaLibrary::getObject(player, sourceObject)) return JNI_FALSE; - const ServerObject * targetObject = NULL; + const ServerObject * targetObject = nullptr; if (!JavaLibrary::getObject(target, targetObject)) return JNI_FALSE; @@ -1663,7 +1663,7 @@ jboolean JNICALL ScriptMethodsWorldInfoNamespace::canManipulate(JNIEnv *env, job * @param performer performer we are looking for listeners of * @param range radius of search area * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getPerformanceListenersInRange(JNIEnv *env, jobject self, jlong performer, jfloat range) { @@ -1697,7 +1697,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getPerformanceListenersInRan * @param performer performer we are looking for watchers of * @param range radius of search area * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getPerformanceWatchersInRange(JNIEnv *env, jobject self, jlong performer, jfloat range) { diff --git a/engine/server/library/serverScript/src/shared/ScriptParamArchive.cpp b/engine/server/library/serverScript/src/shared/ScriptParamArchive.cpp index 967939fb..46799842 100755 --- a/engine/server/library/serverScript/src/shared/ScriptParamArchive.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptParamArchive.cpp @@ -56,7 +56,7 @@ void put(ByteStream & target, const std::vector *> { const std::vector * inner = source[i]; signed int innerLength = 0; - if (inner != NULL) + if (inner != nullptr) innerLength = inner->size(); put(target, innerLength); for (int j = 0; j < innerLength; ++j) diff --git a/engine/server/library/serverScript/src/shared/ScriptParameters.cpp b/engine/server/library/serverScript/src/shared/ScriptParameters.cpp index 78c5fde4..3ea2df78 100755 --- a/engine/server/library/serverScript/src/shared/ScriptParameters.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptParameters.cpp @@ -207,7 +207,7 @@ void ScriptParams::addParam(bool param, const std::string & paramName, bool owne * This call occurs because of a conversion of a datatype passing through this function from std::string to Unicode::String. * Basically, most times it is called with std::string the c_str() function is called. Since this is still valid when the * type is changed to Unicode::String and the const Unicode::unicode_char_t * is successfully auto-converted to const char * - * you wind up having a NULL string when it get explicitly converted to const char * on the other side. So, this should never + * you wind up having a nullptr string when it get explicitly converted to const char * on the other side. So, this should never * be called except in error. * void ScriptParams::addParam(const Unicode::unicode_char_t * param, const std::string & paramName, bool owned) @@ -659,7 +659,7 @@ bool ScriptParams::changeParam(int index, const StringId & param, bool owned) if (p.m_type != Param::STRING_ID) return false; - if (p.m_param.sidParam == NULL) + if (p.m_param.sidParam == nullptr) return false; if (p.m_owned) diff --git a/engine/server/library/serverScript/src/shared/ScriptParameters.h b/engine/server/library/serverScript/src/shared/ScriptParameters.h index 98aa0870..ab7468f2 100755 --- a/engine/server/library/serverScript/src/shared/ScriptParameters.h +++ b/engine/server/library/serverScript/src/shared/ScriptParameters.h @@ -311,7 +311,7 @@ inline const stdvector::fwd & ScriptParams::getLocationArrayPara inline const NetworkId & ScriptParams::getObjIdParam(int index) const { - if (m_params[index].m_param.oidParam != NULL) + if (m_params[index].m_param.oidParam != nullptr) return *m_params[index].m_param.oidParam; return NetworkId::cms_invalid; } // ScriptParams::getObjIdParam diff --git a/engine/server/library/serverUtility/src/shared/AdminAccountManager.cpp b/engine/server/library/serverUtility/src/shared/AdminAccountManager.cpp index 85656cb2..e4075721 100755 --- a/engine/server/library/serverUtility/src/shared/AdminAccountManager.cpp +++ b/engine/server/library/serverUtility/src/shared/AdminAccountManager.cpp @@ -16,7 +16,7 @@ DataTable * AdminAccountManager::ms_adminTable = 0; bool AdminAccountManager::ms_installed = false; -std::string *AdminAccountManager::ms_dataTableName = NULL; +std::string *AdminAccountManager::ms_dataTableName = nullptr; //----------------------------------------------------------------------- @@ -42,7 +42,7 @@ void AdminAccountManager::remove() DataTableManager::close(*ms_dataTableName); ms_installed = false; delete ms_dataTableName; - ms_dataTableName = NULL; + ms_dataTableName = nullptr; } //----------------------------------------------------------------------- diff --git a/engine/server/library/serverUtility/src/shared/ChatLogManager.cpp b/engine/server/library/serverUtility/src/shared/ChatLogManager.cpp index 5f3cd77c..e5283c05 100755 --- a/engine/server/library/serverUtility/src/shared/ChatLogManager.cpp +++ b/engine/server/library/serverUtility/src/shared/ChatLogManager.cpp @@ -135,7 +135,7 @@ void ChatLogManagerNamespace::addChatLogEntry(Unicode::String const &fromPlayer, } else { - Unicode::String const *finalMessage = NULL; + Unicode::String const *finalMessage = nullptr; // Add the new string to the master message list, or if it already exists, just increase the reference count diff --git a/engine/server/library/serverUtility/src/shared/ClusterWideDataManagerList.cpp b/engine/server/library/serverUtility/src/shared/ClusterWideDataManagerList.cpp index 659f1c61..cfda04ff 100755 --- a/engine/server/library/serverUtility/src/shared/ClusterWideDataManagerList.cpp +++ b/engine/server/library/serverUtility/src/shared/ClusterWideDataManagerList.cpp @@ -36,7 +36,7 @@ namespace ClusterWideDataManagerListNamespace struct QueuedRequestInfo { - QueuedRequestInfo() : processId(0), requestTime(0.0), request(NULL), server(NULL) {}; + QueuedRequestInfo() : processId(0), requestTime(0.0), request(nullptr), server(nullptr) {}; unsigned long processId; float requestTime; @@ -272,7 +272,7 @@ void ClusterWideDataManagerList::onGameServerDisconnect(unsigned long const proc ClusterWideDataManagerListNamespace::ServerLockListConstRange range = ClusterWideDataManagerListNamespace::s_serverLockList.equal_range(processId); - ClusterWideDataManager * manager = NULL; + ClusterWideDataManager * manager = nullptr; for (ClusterWideDataManagerListNamespace::ServerLockList::const_iterator iter2 = range.first; iter2 != range.second; ++iter2) { manager = ClusterWideDataManagerListNamespace::getClusterWideDataManager((iter2->second).managerName, false); @@ -327,7 +327,7 @@ ClusterWideDataManager * ClusterWideDataManagerListNamespace::getClusterWideData return manager; } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverUtility/src/shared/FreeCtsDataTable.cpp b/engine/server/library/serverUtility/src/shared/FreeCtsDataTable.cpp index 3be9fe88..9f802549 100755 --- a/engine/server/library/serverUtility/src/shared/FreeCtsDataTable.cpp +++ b/engine/server/library/serverUtility/src/shared/FreeCtsDataTable.cpp @@ -205,7 +205,7 @@ void FreeCtsDataTableNamespace::loadData() tokensSourceClusterList.clear(); tokensTargetClusterList.clear(); - if (Unicode::tokenize(Unicode::narrowToWide(sourceClusterList), tokensSourceClusterList, &clusterListDelimiters, NULL) && (tokensSourceClusterList.size() > 0) && Unicode::tokenize(Unicode::narrowToWide(targetClusterList), tokensTargetClusterList, &clusterListDelimiters, NULL) && (tokensTargetClusterList.size() > 0)) + if (Unicode::tokenize(Unicode::narrowToWide(sourceClusterList), tokensSourceClusterList, &clusterListDelimiters, nullptr) && (tokensSourceClusterList.size() > 0) && Unicode::tokenize(Unicode::narrowToWide(targetClusterList), tokensTargetClusterList, &clusterListDelimiters, nullptr) && (tokensTargetClusterList.size() > 0)) { for (tokensIter = tokensTargetClusterList.begin(); tokensIter != tokensTargetClusterList.end(); ++tokensIter) freeCtsInfo.targetCluster[Unicode::wideToNarrow(Unicode::toLower(*tokensIter))] = Unicode::wideToNarrow(*tokensIter); @@ -258,9 +258,9 @@ void FreeCtsDataTableNamespace::loadData() time_t FreeCtsDataTableNamespace::convertToEpoch(int const year, int const month, int const day, int const hour, int const minute, int const second) { - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); struct tm * timeinfo = ::localtime(&timeNow); - FATAL(!timeinfo, ("::localtime() returns NULL")); + FATAL(!timeinfo, ("::localtime() returns nullptr")); // greater than zero if Daylight Saving Time is in effect, // zero if Daylight Saving Time is not in effect, @@ -288,7 +288,7 @@ time_t FreeCtsDataTableNamespace::convertToEpoch(int const year, int const month // "opposite" standard/daylight period than the current time, // and it should be OK timeinfo = ::localtime(&convertedTime); - FATAL(!timeinfo, ("::localtime() returns NULL")); + FATAL(!timeinfo, ("::localtime() returns nullptr")); if ((timeinfo->tm_year != (year - 1900)) || (timeinfo->tm_mon != (month - 1)) || @@ -342,9 +342,9 @@ FreeCtsDataTable::FreeCtsInfo const * FreeCtsDataTable::isFreeCtsSourceCluster(s loadData(); if (s_freeCtsList.empty()) - return NULL; + return nullptr; - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); std::pair::const_iterator, std::multimap::const_iterator> range = s_freeCtsList.equal_range(Unicode::toLower(sourceCluster)); for (std::multimap::const_iterator iter = range.first; iter != range.second; ++iter) { @@ -355,7 +355,7 @@ FreeCtsDataTable::FreeCtsInfo const * FreeCtsDataTable::isFreeCtsSourceCluster(s return &(iter->second); } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -366,15 +366,15 @@ FreeCtsDataTable::FreeCtsInfo const * FreeCtsDataTable::wouldCharacterTransferBe loadData(); if (s_freeCtsList.empty()) - return NULL; + return nullptr; if ((sourceCharacterCreateTime <= 0) && !ignoreTimeRestriction) - return NULL; + return nullptr; if (sourceStationId != targetStationId) - return NULL; + return nullptr; - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); std::string const lowerTargetCluster(Unicode::toLower(targetCluster)); std::pair::const_iterator, std::multimap::const_iterator> range = s_freeCtsList.equal_range(Unicode::toLower(sourceCluster)); @@ -396,7 +396,7 @@ FreeCtsDataTable::FreeCtsInfo const * FreeCtsDataTable::wouldCharacterTransferBe } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -407,12 +407,12 @@ FreeCtsDataTable::FreeCtsInfo const * FreeCtsDataTable::getFreeCtsInfoForCharact loadData(); if (s_freeCtsList.empty()) - return NULL; + return nullptr; if ((sourceCharacterCreateTime <= 0) && !ignoreTimeRestriction) - return NULL; + return nullptr; - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); std::pair::const_iterator, std::multimap::const_iterator> range = s_freeCtsList.equal_range(Unicode::toLower(sourceCluster)); for (std::multimap::const_iterator iter = range.first; iter != range.second; ++iter) { @@ -429,5 +429,5 @@ FreeCtsDataTable::FreeCtsInfo const * FreeCtsDataTable::getFreeCtsInfoForCharact return &(iter->second); } - return NULL; + return nullptr; } diff --git a/engine/shared/application/DataTableTool/src/shared/DataTableTool.cpp b/engine/shared/application/DataTableTool/src/shared/DataTableTool.cpp index 29d396da..c3dcaf32 100755 --- a/engine/shared/application/DataTableTool/src/shared/DataTableTool.cpp +++ b/engine/shared/application/DataTableTool/src/shared/DataTableTool.cpp @@ -245,7 +245,7 @@ void DataTableTool::createOutputDirectoryForFile(const std::string & fileName) std::string directoryName(fileName, 0, slashPos); #if defined(PLATFORM_WIN32) - int result = CreateDirectory(directoryName.c_str(), NULL); + int result = CreateDirectory(directoryName.c_str(), nullptr); #elif defined(PLATFORM_LINUX) // make sure slashes are forward { diff --git a/engine/shared/application/TemplateCompiler/src/shared/TemplateCompiler.cpp b/engine/shared/application/TemplateCompiler/src/shared/TemplateCompiler.cpp index 8611bb0b..2a3658bb 100755 --- a/engine/shared/application/TemplateCompiler/src/shared/TemplateCompiler.cpp +++ b/engine/shared/application/TemplateCompiler/src/shared/TemplateCompiler.cpp @@ -46,7 +46,7 @@ static const int SUBMIT_NO_FILE_ERR = 17; // need to add file before submitting // virtual ~MyPerforceUser() {} // virtual void HandleError( Error *err ) // { -// if (err != NULL && err->Test()) +// if (err != nullptr && err->Test()) // { // m_errorOccurred = true; // m_lastError = err->GetGeneric(); @@ -154,7 +154,7 @@ int generateTemplate(File &definitionFp, File &templateFp) // we now need to move down the template definition heiarchy and write the // parameters of the base class - Filename basename(NULL, definitionFp.getFilename().getPath().c_str(), + Filename basename(nullptr, definitionFp.getFilename().getPath().c_str(), TemplateDefinitionFile.getBaseFilename().c_str(), TEMPLATE_DEFINITION_EXTENSION); if (basename.getName().size() == 0) return 0; @@ -185,8 +185,8 @@ int generateTemplate(File &definitionFp, File &templateFp) int generateTemplate(const char *definitionFile, const char *templateFile) { // check filename extensions - Filename defFile(NULL, NULL, definitionFile, TEMPLATE_DEFINITION_EXTENSION); - Filename temFile(NULL, NULL, templateFile, TEMPLATE_EXTENSION); + Filename defFile(nullptr, nullptr, definitionFile, TEMPLATE_DEFINITION_EXTENSION); + Filename temFile(nullptr, nullptr, templateFile, TEMPLATE_EXTENSION); File definitionFp; int i = 0; @@ -231,8 +231,8 @@ int generateTemplate(const char *definitionFile, const char *templateFile) int deriveTemplate(const char *baseFile, const char *templateFile) { // check filename extensions - Filename basFile(NULL, NULL, baseFile, TEMPLATE_EXTENSION); - Filename temFile(NULL, NULL, templateFile, TEMPLATE_EXTENSION); + Filename basFile(nullptr, nullptr, baseFile, TEMPLATE_EXTENSION); + Filename temFile(nullptr, nullptr, templateFile, TEMPLATE_EXTENSION); File basFp; if (!basFp.open(basFile, "rt")) @@ -263,7 +263,7 @@ int compileTemplate(const char *filename) { TpfFile templateFile; - Filename templateFileName(NULL, NULL, filename, TEMPLATE_EXTENSION); + Filename templateFileName(nullptr, nullptr, filename, TEMPLATE_EXTENSION); return templateFile.makeIffFiles(templateFileName); } // compileTemplate @@ -279,7 +279,7 @@ int verifyTemplate(const char *filename) TpfFile templateFile; printf("Verifying %s: ", filename); - Filename templateFileName(NULL, NULL, filename, TEMPLATE_EXTENSION); + Filename templateFileName(nullptr, nullptr, filename, TEMPLATE_EXTENSION); int result = templateFile.loadTemplate(templateFileName); if (result == 0) printf("file ok"); @@ -299,7 +299,7 @@ int updateTemplate(const char *filename) { TpfFile templateFile; - Filename templateFileName(NULL, NULL, filename, TEMPLATE_EXTENSION); + Filename templateFileName(nullptr, nullptr, filename, TEMPLATE_EXTENSION); return templateFile.updateTemplate(templateFileName); } // updateTemplate */ @@ -317,7 +317,7 @@ TpfFile templateFile; //Error e; // // // check filename extensions -// Filename templateFileName(NULL, NULL, filename, TEMPLATE_EXTENSION); +// Filename templateFileName(nullptr, nullptr, filename, TEMPLATE_EXTENSION); // Filename iffFileName = templateFileName; // iffFileName.setExtension(IFF_EXTENSION); // @@ -345,7 +345,7 @@ TpfFile templateFile; // IGNORE_RETURN(templateFile.loadTemplate(templateFileName)); // // // check out the client template iff file -// Filename iffName(NULL, templateFile.getIffPath().c_str(), iffFileName, IFF_EXTENSION); +// Filename iffName(nullptr, templateFile.getIffPath().c_str(), iffFileName, IFF_EXTENSION); // commands[1] = iffName; // client.SetArgv( 1, const_cast(&commands[1]) ); // client.Run( commands[0], &ui ); @@ -370,7 +370,7 @@ TpfFile templateFile; //Error e; // // // check filename extensions -// Filename templateFileName(NULL, NULL, filename, TEMPLATE_EXTENSION); +// Filename templateFileName(nullptr, nullptr, filename, TEMPLATE_EXTENSION); // Filename iffFileName = templateFileName; // iffFileName.setExtension(IFF_EXTENSION); // @@ -424,7 +424,7 @@ TpfFile templateFile; // return -1; // // // add the client iff file -// Filename iffName(NULL, templateFile.getIffPath().c_str(), iffFileName, NULL); +// Filename iffName(nullptr, templateFile.getIffPath().c_str(), iffFileName, nullptr); // commands[1] = iffName; // client.SetArgv( 1, const_cast(&commands[1]) ); // client.Run( commands[0], &ui ); @@ -591,7 +591,7 @@ int main(int argc, char *argv[ ]) SetupSharedFoundation::Data data(SetupSharedFoundation::Data::D_console); #ifdef WIN32 char buffer[1024]; - GetModuleFileName(GetModuleHandle(NULL), buffer, 1024); + GetModuleFileName(GetModuleHandle(nullptr), buffer, 1024); Filename configName; configName.setName(buffer); configName.setName("templateCompiler.cfg"); @@ -607,7 +607,7 @@ int main(int argc, char *argv[ ]) // setup the random number generator // @todo need a better seed - SetupSharedRandom::install(static_cast(time(NULL))); + SetupSharedRandom::install(static_cast(time(nullptr))); // install templates SetupSharedTemplate::install(); diff --git a/engine/shared/application/TemplateDefinitionCompiler/src/shared/core/TemplateDefinitionCompiler.cpp b/engine/shared/application/TemplateDefinitionCompiler/src/shared/core/TemplateDefinitionCompiler.cpp index f95e5c6c..a9af01dd 100755 --- a/engine/shared/application/TemplateDefinitionCompiler/src/shared/core/TemplateDefinitionCompiler.cpp +++ b/engine/shared/application/TemplateDefinitionCompiler/src/shared/core/TemplateDefinitionCompiler.cpp @@ -30,7 +30,7 @@ //============================================================================== // file variables -const TemplateData *currentTemplateData = NULL; +const TemplateData *currentTemplateData = nullptr; //============================================================================== @@ -118,7 +118,7 @@ File fp; return; File temp_fp; - if (!temp_fp.open(tmpnam(NULL), "wt")) + if (!temp_fp.open(tmpnam(nullptr), "wt")) { fprintf(stderr, "error opening temp file for template header " "replacement [%s]\n", temp_fp.getFilename().getFullFilename().c_str()); @@ -244,7 +244,7 @@ int result; } File temp_fp; - if (!temp_fp.open(tmpnam(NULL), "wt")) + if (!temp_fp.open(tmpnam(nullptr), "wt")) { fprintf(stderr, "error opening temp file for template source " "replacement [%s]\n", temp_fp.getFilename().getFullFilename().c_str()); @@ -337,8 +337,8 @@ int result; // std::string oldTemplateName = tdfFile.getTemplateName(); // std::string oldBaseName = tdfFile.getBaseName(); - Filename fullName(NULL, path.getPath().c_str(), tdfFile.getTemplateName().c_str(), - NULL); + Filename fullName(nullptr, path.getPath().c_str(), tdfFile.getTemplateName().c_str(), + nullptr); writeTemplateHeader(tdfFile, fullName); result = writeTemplateSource(tdfFile, fullName); @@ -397,7 +397,7 @@ TemplateDefinitionFile tdfFile; //Error e; // // // check filename extensions -// Filename templateFileName(NULL, NULL, filename, TEMPLATE_DEFINITION_EXTENSION); +// Filename templateFileName(nullptr, nullptr, filename, TEMPLATE_DEFINITION_EXTENSION); // // // Connect to Perforce server // client.Init( &e ); @@ -433,7 +433,7 @@ TemplateDefinitionFile tdfFile; // if (tdfFile.getPath().getFullFilename().size() != 0) // { // // check out the source files -// Filename sourceName(NULL, tdfFile.getPath().getPath().c_str(), +// Filename sourceName(nullptr, tdfFile.getPath().getPath().c_str(), // tdfFile.getTemplateName().c_str(), "cpp"); // commands[1] = sourceName; // client.SetArgv( 1, const_cast(&commands[1]) ); @@ -453,7 +453,7 @@ TemplateDefinitionFile tdfFile; // std::string compilerFilename; // compilerFilename = EnumLocationTypes[tdfFile.getTemplateLocation()] + // filenameLowerToUpper(templateFileName.getName()); -// Filename compilerName(NULL, tdfFile.getCompilerPath().getPath().c_str(), +// Filename compilerName(nullptr, tdfFile.getCompilerPath().getPath().c_str(), // tdfFile.getTemplateName().c_str(), "cpp"); // commands[1] = compilerName; // client.SetArgv( 1, const_cast(&commands[1]) ); @@ -485,7 +485,7 @@ TemplateDefinitionFile tdfFile; //Error e; // // // check filename extensions -// Filename templateFileName(NULL, NULL, filename, TEMPLATE_DEFINITION_EXTENSION); +// Filename templateFileName(nullptr, nullptr, filename, TEMPLATE_DEFINITION_EXTENSION); // // // find the client and server paths // File fp(templateFileName, "rt"); @@ -546,7 +546,7 @@ TemplateDefinitionFile tdfFile; // if (tdfFile.getPath().getFullFilename().size() != 0) // { // // check in the source files -// Filename sourceName(NULL, tdfFile.getPath().getPath().c_str(), +// Filename sourceName(nullptr, tdfFile.getPath().getPath().c_str(), // tdfFile.getTemplateName().c_str(), "cpp"); // commands[1] = sourceName; // client.SetArgv( 1, const_cast(&commands[1]) ); @@ -563,7 +563,7 @@ TemplateDefinitionFile tdfFile; // if (tdfFile.getCompilerPath().getFullFilename().size() != 0) // { // // check in the compiler source files -// Filename compilerName(NULL, tdfFile.getCompilerPath().getPath().c_str(), +// Filename compilerName(nullptr, tdfFile.getCompilerPath().getPath().c_str(), // tdfFile.getTemplateName().c_str(), "cpp"); // commands[1] = compilerName; // client.SetArgv( 1, const_cast(&commands[1]) ); @@ -669,7 +669,7 @@ int main(int argc, char *argv[ ]) SetupSharedFoundation::Data data(SetupSharedFoundation::Data::D_console); #ifdef WIN32 char buffer[1024]; - GetModuleFileName(GetModuleHandle(NULL), buffer, 1024); + GetModuleFileName(GetModuleHandle(nullptr), buffer, 1024); Filename configName; configName.setName(buffer); configName.setName("templateCompiler.cfg"); @@ -685,7 +685,7 @@ int main(int argc, char *argv[ ]) // setup the random number generator // @todo need a better seed - SetupSharedRandom::install(static_cast(time(NULL))); + SetupSharedRandom::install(static_cast(time(nullptr))); int result = processArgs(argc, argv); diff --git a/engine/shared/library/sharedCollision/src/shared/core/BarrierObject.cpp b/engine/shared/library/sharedCollision/src/shared/core/BarrierObject.cpp index 204984ad..1c853c1b 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/BarrierObject.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/BarrierObject.cpp @@ -38,14 +38,14 @@ public: virtual bool canCollideWith ( CollisionProperty const * otherCollision ) const { - if(otherCollision == NULL) + if(otherCollision == nullptr) { return false; } BarrierObject const * barrier = safe_cast(&getOwner()); - if(barrier == NULL) + if(barrier == nullptr) { return false; } @@ -180,7 +180,7 @@ void BarrierObject::createAppearance ( void ) Appearance * appearance = CellProperty::createPortalBarrier(verts,gs_barrierColor); - if(appearance != NULL) + if(appearance != nullptr) { setAppearance( appearance ); diff --git a/engine/shared/library/sharedCollision/src/shared/core/BoxTree.cpp b/engine/shared/library/sharedCollision/src/shared/core/BoxTree.cpp index 1f046513..7e2c011b 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/BoxTree.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/BoxTree.cpp @@ -156,8 +156,8 @@ BoxTreeNode::BoxTreeNode() : m_box(), m_index(-1), m_userId(-1), - m_childA(NULL), - m_childB(NULL) + m_childA(nullptr), + m_childB(nullptr) { } @@ -165,8 +165,8 @@ BoxTreeNode::BoxTreeNode ( AxialBox const & box, int userId ) : m_box(box), m_index(-1), m_userId(userId), - m_childA(NULL), - m_childB(NULL) + m_childA(nullptr), + m_childB(nullptr) { } @@ -195,10 +195,10 @@ void BoxTreeNode::drawDebugShapes ( DebugShapeRenderer * renderer, VectorArgb co #ifdef _DEBUG - if(m_childA == NULL) return; - if(m_childB == NULL) return; + if(m_childA == nullptr) return; + if(m_childB == nullptr) return; - if(renderer == NULL) return; + if(renderer == nullptr) return; VectorArgb newColor( color.a, color.r * 0.9f, color.g * 0.9f, color.b * 0.9f ); @@ -227,7 +227,7 @@ int BoxTreeNode::getNodeCount ( void ) const float BoxTreeNode::calcWeight ( void ) const { - if((m_childA == NULL) && (m_childB == NULL)) return 1.0f; + if((m_childA == nullptr) && (m_childB == nullptr)) return 1.0f; float accum = 0.0f; @@ -241,9 +241,9 @@ float BoxTreeNode::calcWeight ( void ) const float BoxTreeNode::calcBalance ( void ) const { - if((m_childA == NULL) && (m_childB == NULL)) return 1.0f; + if((m_childA == nullptr) && (m_childB == nullptr)) return 1.0f; - if((m_childA != NULL) && (m_childB != NULL)) + if((m_childA != nullptr) && (m_childB != nullptr)) { return m_childA->calcWeight() / m_childB->calcWeight(); } @@ -288,8 +288,8 @@ void BoxTreeNode::packInto ( BoxTreeNode * node, BoxTreeNode * base ) const node->m_box = m_box; node->m_index = m_index; - node->m_childA = m_childA ? (base + m_childA->m_index) : NULL; - node->m_childB = m_childB ? (base + m_childB->m_index) : NULL; + node->m_childA = m_childA ? (base + m_childA->m_index) : nullptr; + node->m_childB = m_childB ? (base + m_childB->m_index) : nullptr; node->m_userId = m_userId; } @@ -302,10 +302,10 @@ void BoxTreeNode::deleteChildren ( void ) if(m_childB) m_childB->deleteChildren(); delete m_childA; - m_childA = NULL; + m_childA = nullptr; delete m_childB; - m_childB = NULL; + m_childB = nullptr; } // ---------------------------------------------------------------------- @@ -341,8 +341,8 @@ void BoxTreeNode::read ( Iff & iff, BoxTreeNode * base ) int indexA = iff.read_int32(); int indexB = iff.read_int32(); - m_childA = ( indexA != -1 ? base + indexA : NULL ); - m_childB = ( indexB != -1 ? base + indexB : NULL ); + m_childA = ( indexA != -1 ? base + indexA : nullptr ); + m_childB = ( indexB != -1 ? base + indexB : nullptr ); } // ---------------------------------------------------------------------- @@ -361,7 +361,7 @@ bool BoxTreeNode::findClosest ( Vector const & V, float maxDistance, float & out // ---------- // Leaf node case - this leaf node is closer - if((m_childA == NULL) && (m_childB == NULL)) + if((m_childA == nullptr) && (m_childB == nullptr)) { outDistance = dist; outIndex = m_userId; @@ -417,8 +417,8 @@ void BoxTree::install() // ---------------------------------------------------------------------- BoxTree::BoxTree() -: m_flatNodes(NULL), - m_root(NULL), +: m_flatNodes(nullptr), + m_root(nullptr), m_testCounter(0) { } @@ -443,7 +443,7 @@ void BoxTree::build ( BoxVec const & boxes ) // ---------- - BoxTreeNodePVec nodes(boxes.size(),NULL); + BoxTreeNodePVec nodes(boxes.size(),nullptr); int boxcount = boxes.size(); @@ -488,7 +488,7 @@ void BoxTree::drawDebugShapes ( DebugShapeRenderer * renderer ) const #ifdef _DEBUG - if(renderer == NULL) return; + if(renderer == nullptr) return; if(m_root) m_root->drawDebugShapes( renderer, VectorArgb::solidWhite, 0 ); @@ -546,7 +546,7 @@ static inline void templateTestOverlapRecurse( BoxTreeNode const * node, TestSha template< class TestShape > static inline bool templateTestOverlap( BoxTree const & tree, TestShape const & testShape, IdVec & outIds ) { - if(tree.getRoot() == NULL) return false; + if(tree.getRoot() == nullptr) return false; int oldSize = outIds.size(); @@ -580,7 +580,7 @@ static inline void templateTestOverlapRecurse2( BoxTreeNode const * node, TestSh template< class TestShape > static inline bool templateTestOverlap2( BoxTree const & tree, TestShape const & testShape, IdVec & outIds ) { - if(tree.getRoot() == NULL) return false; + if(tree.getRoot() == nullptr) return false; int oldSize = outIds.size(); @@ -701,11 +701,11 @@ void BoxTree::clear ( void ) m_root->deleteChildren(); delete m_root; - m_root = NULL; + m_root = nullptr; } delete m_flatNodes; - m_flatNodes = NULL; + m_flatNodes = nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedCollision/src/shared/core/BoxTree.h b/engine/shared/library/sharedCollision/src/shared/core/BoxTree.h index 9a2d6545..d32e2fea 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/BoxTree.h +++ b/engine/shared/library/sharedCollision/src/shared/core/BoxTree.h @@ -108,7 +108,7 @@ inline int BoxTree::getTestCounter ( void ) const inline bool BoxTree::isFlat ( void ) const { - return m_flatNodes != NULL; + return m_flatNodes != nullptr; } // ====================================================================== diff --git a/engine/shared/library/sharedCollision/src/shared/core/CollisionBuckets.cpp b/engine/shared/library/sharedCollision/src/shared/core/CollisionBuckets.cpp index af528e5f..c3c6c5c0 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/CollisionBuckets.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/CollisionBuckets.cpp @@ -162,7 +162,7 @@ void CollisionBuckets::build(Vector const & minimumBounds, Vector const & maximu (*m_nodeMatrix)[xx].resize(m_bucketsAlongY); for (unsigned int yy = 0; yy < m_bucketsAlongY; ++yy) { - // note that nodes are initialized to NULL + // note that nodes are initialized to nullptr (*m_nodeMatrix)[xx][yy].resize(m_bucketsAlongZ, 0); } } diff --git a/engine/shared/library/sharedCollision/src/shared/core/CollisionMesh.cpp b/engine/shared/library/sharedCollision/src/shared/core/CollisionMesh.cpp index 80a0e930..cca52f64 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/CollisionMesh.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/CollisionMesh.cpp @@ -106,8 +106,8 @@ CollisionMesh::CollisionMesh() : CollisionSurface(), m_id(0), m_version(1), - m_boxTree(NULL), - m_extent(NULL), + m_boxTree(nullptr), + m_extent(nullptr), m_boundsDirty(true) { m_extent = new SimpleExtent( MultiShape(AxialBox()) ); @@ -116,10 +116,10 @@ CollisionMesh::CollisionMesh() CollisionMesh::~CollisionMesh() { delete m_boxTree; - m_boxTree = NULL; + m_boxTree = nullptr; delete m_extent; - m_extent = NULL; + m_extent = nullptr; } // ---------------------------------------------------------------------- @@ -154,7 +154,7 @@ BaseExtent const * CollisionMesh::getExtent_p ( void ) const void CollisionMesh::clear ( void ) { delete m_boxTree; - m_boxTree = NULL; + m_boxTree = nullptr; } // ---------------------------------------------------------------------- @@ -1010,7 +1010,7 @@ void CollisionMesh::transform( CollisionMesh const * sourceMesh, Transform const bool CollisionMesh::hasBoxTree ( void ) const { - return m_boxTree != NULL; + return m_boxTree != nullptr; } // ---------- diff --git a/engine/shared/library/sharedCollision/src/shared/core/CollisionNotification.cpp b/engine/shared/library/sharedCollision/src/shared/core/CollisionNotification.cpp index 6fba343e..2c5d349d 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/CollisionNotification.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/CollisionNotification.cpp @@ -75,7 +75,7 @@ void CollisionNotification::purgeQueue ( void ) Object * object = entry.m_object; - if(object == NULL) continue; + if(object == nullptr) continue; if(entry.m_added) { diff --git a/engine/shared/library/sharedCollision/src/shared/core/CollisionProperty.cpp b/engine/shared/library/sharedCollision/src/shared/core/CollisionProperty.cpp index 5e22c064..b8cc9332 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/CollisionProperty.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/CollisionProperty.cpp @@ -44,7 +44,7 @@ namespace CollisionPropertyNamespace { - CollisionProperty * ms_activeListHead = NULL; + CollisionProperty * ms_activeListHead = nullptr; }; using namespace CollisionPropertyNamespace; @@ -64,8 +64,8 @@ void CollisionProperty::detachList ( void ) ms_activeListHead = m_next; } - m_prev = NULL; - m_next = NULL; + m_prev = nullptr; + m_next = nullptr; } // ---------- @@ -76,7 +76,7 @@ void CollisionProperty::attachList ( CollisionProperty * & head ) if(head) head->m_prev = this; - m_prev = NULL; + m_prev = nullptr; m_next = head; head = this; @@ -129,7 +129,7 @@ CollisionProperty * CollisionProperty::getActiveHead ( void ) Transform getTransform_o2c( Object const * object ) { - if(object == NULL) return Transform::identity; + if(object == nullptr) return Transform::identity; // If this object is a cell, its o2c transform is the identity transform @@ -164,23 +164,23 @@ CollisionProperty::CollisionProperty( Object & owner ) : Property( CollisionProperty::getClassPropertyId(), owner ), m_lastTransform_w(Transform::identity), m_lastTransform_p(Transform::identity), - m_lastCellObject(NULL), + m_lastCellObject(nullptr), m_stepHeight(0.0f), m_defaultRadius(0.0f), m_offsetX(0.0f), m_offsetZ(0.0f), m_extentsDirty(true), - m_extent_l(NULL), - m_extent_p(NULL), + m_extent_l(nullptr), + m_extent_p(nullptr), m_sphere_l(), m_sphere_w(), m_scale(owner.getScale().x), - m_spatialSubdivisionHandle(NULL), - m_floor(NULL), - m_footprint(NULL), + m_spatialSubdivisionHandle(nullptr), + m_floor(nullptr), + m_footprint(nullptr), m_idleCounter(3), - m_next(NULL), - m_prev(NULL), + m_next(nullptr), + m_prev(nullptr), m_flags(F_collidable), m_spatialDatabaseStorageType(SpatialDatabase::Q_None) { @@ -200,7 +200,7 @@ CollisionProperty::CollisionProperty( Object & owner ) { char const * const found = strstr(templateName,"lair"); - if(found != NULL) + if(found != nullptr) { setCollidable(false); } @@ -214,23 +214,23 @@ CollisionProperty::CollisionProperty( Object & owner, SharedObjectTemplate const : Property( CollisionProperty::getClassPropertyId(), owner ), m_lastTransform_w(Transform::identity), m_lastTransform_p(Transform::identity), - m_lastCellObject(NULL), + m_lastCellObject(nullptr), m_stepHeight(0.0f), m_defaultRadius(0.0f), m_offsetX(0.0f), m_offsetZ(0.0f), m_extentsDirty(true), - m_extent_l(NULL), - m_extent_p(NULL), + m_extent_l(nullptr), + m_extent_p(nullptr), m_sphere_l(), m_sphere_w(), m_scale(owner.getScale().x), - m_spatialSubdivisionHandle(NULL), - m_floor(NULL), - m_footprint(NULL), + m_spatialSubdivisionHandle(nullptr), + m_floor(nullptr), + m_footprint(nullptr), m_idleCounter(3), - m_next(NULL), - m_prev(NULL), + m_next(nullptr), + m_prev(nullptr), m_flags(F_collidable), m_spatialDatabaseStorageType(SpatialDatabase::Q_None) { @@ -248,7 +248,7 @@ CollisionProperty::CollisionProperty( Object & owner, SharedObjectTemplate const { char const * const found = strstr(templateName,"lair"); - if(found != NULL) + if(found != nullptr) { setCollidable(false); } @@ -373,7 +373,7 @@ CollisionProperty::~CollisionProperty() static_cast::NodeHandle *>(m_spatialSubdivisionHandle)->removeObject(); - m_spatialSubdivisionHandle = NULL; + m_spatialSubdivisionHandle = nullptr; } FATAL(CollisionWorld::isUpdating(),("CollisionProperty::~CollisionProperty - Trying to destroy a collision property while the collision world is updating. This is baaaad\n")); @@ -382,16 +382,16 @@ CollisionProperty::~CollisionProperty() detachList(); delete m_extent_l; - m_extent_l = NULL; + m_extent_l = nullptr; delete m_extent_p; - m_extent_p = NULL; + m_extent_p = nullptr; delete m_floor; - m_floor = NULL; + m_floor = nullptr; delete m_footprint; - m_footprint = NULL; + m_footprint = nullptr; } @@ -405,7 +405,7 @@ void CollisionProperty::attachSourceExtent ( BaseExtent * newSourceExtent ) cons m_extent_l = newSourceExtent; delete m_extent_p; - m_extent_p = NULL; + m_extent_p = nullptr; m_extentsDirty = true; } @@ -437,12 +437,12 @@ void CollisionProperty::initFloor ( void ) if (isMobile()) return; - if(m_floor != NULL) + if(m_floor != nullptr) return; // ---------- - char const *floorName = NULL; + char const *floorName = nullptr; Appearance * appearance = getOwner().getAppearance(); if(appearance) @@ -487,7 +487,7 @@ void CollisionProperty::addToCollisionWorld ( void ) if (getOwner().getNetworkId() < NetworkId::cms_invalid) { delete m_footprint; - m_footprint = NULL; + m_footprint = nullptr; } if (m_footprint) @@ -534,7 +534,7 @@ Transform CollisionProperty::getTransform_o2c ( void ) const BaseExtent * convertToSimpleExtent ( BaseExtent const * sourceExtent ) { - if(!sourceExtent) return NULL; + if(!sourceExtent) return nullptr; switch(sourceExtent->getType()) { @@ -549,7 +549,7 @@ BaseExtent * convertToSimpleExtent ( BaseExtent const * sourceExtent ) { Extent const * extent = safe_cast(sourceExtent); - if(!extent) return NULL; + if(!extent) return nullptr; return new SimpleExtent( MultiShape( extent->getShape() ) ); } @@ -558,7 +558,7 @@ BaseExtent * convertToSimpleExtent ( BaseExtent const * sourceExtent ) { CylinderExtent const * extent = safe_cast(sourceExtent); - if(!extent) return NULL; + if(!extent) return nullptr; return new SimpleExtent( MultiShape( extent->getShape() ) ); } @@ -567,7 +567,7 @@ BaseExtent * convertToSimpleExtent ( BaseExtent const * sourceExtent ) { BoxExtent const * extent = safe_cast(sourceExtent); - if(!extent) return NULL; + if(!extent) return nullptr; return new SimpleExtent( MultiShape( extent->getShape() ) ); } @@ -576,7 +576,7 @@ BaseExtent * convertToSimpleExtent ( BaseExtent const * sourceExtent ) { MeshExtent const * extent = safe_cast(sourceExtent); - if(!extent) return NULL; + if(!extent) return nullptr; return extent->clone(); } @@ -585,7 +585,7 @@ BaseExtent * convertToSimpleExtent ( BaseExtent const * sourceExtent ) { DetailExtent const * extent = safe_cast(sourceExtent); - if(!extent) return NULL; + if(!extent) return nullptr; DetailExtent * newExtent = new DetailExtent(); @@ -603,7 +603,7 @@ BaseExtent * convertToSimpleExtent ( BaseExtent const * sourceExtent ) { ComponentExtent const * extent = safe_cast(sourceExtent); - if(!extent) return NULL; + if(!extent) return nullptr; ComponentExtent * newExtent = new ComponentExtent(); @@ -623,7 +623,7 @@ BaseExtent * convertToSimpleExtent ( BaseExtent const * sourceExtent ) case ET_Null: case ET_ExtentTypeCount: default: - return NULL; + return nullptr; } } @@ -653,10 +653,10 @@ void CollisionProperty::updateExtents ( void ) const if(m_scale != newScale) { delete m_extent_l; - m_extent_l = NULL; + m_extent_l = nullptr; delete m_extent_p; - m_extent_p = NULL; + m_extent_p = nullptr; m_scale = newScale; } @@ -960,7 +960,7 @@ void CollisionProperty::drawDebugShapes ( DebugShapeRenderer * renderer ) const #ifdef _DEBUG - if(renderer == NULL) return; + if(renderer == nullptr) return; if(ConfigSharedCollision::getDrawExtents()) { @@ -1274,9 +1274,9 @@ void CollisionProperty::setLastPos ( CellProperty * cell, Transform const & tran { NAN_CHECK(transform_p); - if(cell == NULL) + if(cell == nullptr) { - m_lastCellObject = NULL; + m_lastCellObject = nullptr; m_lastTransform_p = transform_p; m_lastTransform_w = transform_p; } @@ -1298,7 +1298,7 @@ Object const * CollisionProperty::getStandingOn ( void ) const } else { - return NULL; + return nullptr; } } diff --git a/engine/shared/library/sharedCollision/src/shared/core/CollisionResolve.cpp b/engine/shared/library/sharedCollision/src/shared/core/CollisionResolve.cpp index 0638c13c..759a5f30 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/CollisionResolve.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/CollisionResolve.cpp @@ -87,7 +87,7 @@ namespace CollisionResolveNamespace FloorContactList ms_floorContactList; - Floor const * ms_ignoreFloor = NULL; + Floor const * ms_ignoreFloor = nullptr; int ms_ignoreTriId = -1; int ms_ignoreEdge = -1; Vector ms_ignoreNormal = Vector::zero; @@ -312,7 +312,7 @@ ResolutionResult CollisionResolve::resolveCollisions(CollisionProperty * collide if(result == RR_Resolved) { - colliderA->hitBy(NULL); + colliderA->hitBy(nullptr); colliderA->setExtentsDirty(true); Vector resetPos = moveSeg.getBegin(moveSeg.m_cellB); @@ -339,7 +339,7 @@ ResolutionResult CollisionResolve::resolveCollisions ( CellProperty const * cell const int iterationCount = 8; - ms_ignoreFloor = NULL; + ms_ignoreFloor = nullptr; ms_ignoreTriId = -1; ms_ignoreEdge = -1; ms_ignoreTime = REAL_MAX; @@ -484,12 +484,12 @@ ResolutionResult CollisionResolve::resolveCollisions ( CellProperty const * cell // ---------- // Remove the hit obstacle from the extent list - if(obstacleList->at(minIndex).m_extent != NULL) + if(obstacleList->at(minIndex).m_extent != nullptr) { obstacleList->at(minIndex) = obstacleList->back(); obstacleList->resize(obstacleList->size()-1); - ms_ignoreFloor = NULL; + ms_ignoreFloor = nullptr; ms_ignoreTriId = -1; ms_ignoreEdge = -1; ms_ignoreTime = REAL_MAX; @@ -561,13 +561,13 @@ void CollisionResolve::explodeExtent ( CellProperty const * cell, BaseExtent con void CollisionResolve::explodeFootprint ( Footprint * foot, ObstacleList & obstacleList, FloorContactList & floorContacts ) { - if(foot == NULL) return; + if(foot == nullptr) return; for(ContactIterator it(foot->getFloorList()); it; ++it) { FloorContactShape * contact = (*it); - if(contact == NULL) + if(contact == nullptr) continue; obstacleList.push_back( ObstacleInfo(contact->m_contact.getCell(),contact) ); @@ -594,7 +594,7 @@ void CollisionResolve::explodeCollider(CollisionProperty * colliderA, ColliderLi { CollisionProperty const * const colliderB = *ii; - if(colliderB == NULL) continue; + if(colliderB == nullptr) continue; BaseExtent const * const extentB = colliderB->getExtent_p(); @@ -613,7 +613,7 @@ void CollisionResolve::explodeCollider(CollisionProperty * colliderA, ColliderLi { FloorContactShape * const contact = (*it); - if(contact == NULL) continue; + if(contact == nullptr) continue; ms_floorContactList.push_back(contact); } @@ -713,7 +713,7 @@ Contact CollisionResolve::findContactWithFloor ( FloorContactShape * floorContac Floor const * floor = loc.getFloor(); - if(floor == NULL) return Contact::noContact; + if(floor == nullptr) return Contact::noContact; CellProperty const * floorCell = loc.getCell(); @@ -740,7 +740,7 @@ Contact CollisionResolve::findContactWithFloor ( FloorContactShape * floorContac return Contact::noContact; } - if((ms_ignoreFloor == NULL) || (floor != ms_ignoreFloor)) + if((ms_ignoreFloor == nullptr) || (floor != ms_ignoreFloor)) { walkResult = floor->canMove(loc,delta,-1,-1,result); } @@ -776,7 +776,7 @@ Contact CollisionResolve::findContactWithFloor ( FloorContactShape * floorContac tempContact.m_surfaceId2 = result.getHitEdgeId(); tempContact.m_cell = floorCell; - tempContact.m_extent = NULL; + tempContact.m_extent = nullptr; tempContact.m_surface = result.getFloor(); } } diff --git a/engine/shared/library/sharedCollision/src/shared/core/CollisionResolve.h b/engine/shared/library/sharedCollision/src/shared/core/CollisionResolve.h index 7e4b9e44..77bf73b0 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/CollisionResolve.h +++ b/engine/shared/library/sharedCollision/src/shared/core/CollisionResolve.h @@ -27,22 +27,22 @@ class Floor; struct ObstacleInfo { ObstacleInfo() - : m_cell(NULL), - m_extent(NULL), - m_floorContact(NULL) + : m_cell(nullptr), + m_extent(nullptr), + m_floorContact(nullptr) { } ObstacleInfo ( CellProperty const * cell, SimpleExtent const * extent ) : m_cell(cell), m_extent(extent), - m_floorContact(NULL) + m_floorContact(nullptr) { } ObstacleInfo ( CellProperty const * cell, FloorContactShape * contact ) : m_cell(cell), - m_extent(NULL), + m_extent(nullptr), m_floorContact(contact) { } diff --git a/engine/shared/library/sharedCollision/src/shared/core/CollisionUtils.cpp b/engine/shared/library/sharedCollision/src/shared/core/CollisionUtils.cpp index 4c994abf..5d8192b5 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/CollisionUtils.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/CollisionUtils.cpp @@ -881,7 +881,7 @@ void MergePolyPoly ( VertexList & polyA, VertexList & polyB, VertexList & outPol void BuildConvexHull ( Vector const * sortedVerts, int vertCount, VertexList & outPoly ) { - if(sortedVerts == NULL) return; + if(sortedVerts == nullptr) return; if(vertCount <= 0) return; if(vertCount == 1) { outPoly.push_back(sortedVerts[0]); return; } @@ -1104,7 +1104,7 @@ RangeLoop CalcAvoidanceThetas ( Sphere const & S, BaseExtent const * extent ); RangeLoop CalcAvoidanceThetas ( Sphere const & S, SimpleExtent const * extent ) { - if(extent == NULL) return RangeLoop::empty; + if(extent == nullptr) return RangeLoop::empty; return CalcAvoidanceThetas(S,extent->getShape()); } @@ -1113,7 +1113,7 @@ RangeLoop CalcAvoidanceThetas ( Sphere const & S, SimpleExtent const * extent ) RangeLoop CalcAvoidanceThetas ( Sphere const & S, ComponentExtent const * extent ) { - if(extent == NULL) return RangeLoop::empty; + if(extent == nullptr) return RangeLoop::empty; RangeLoop range = RangeLoop::empty; @@ -1123,7 +1123,7 @@ RangeLoop CalcAvoidanceThetas ( Sphere const & S, ComponentExtent const * extent { BaseExtent const * child = extent->getExtent(i); - if(child == NULL) continue; + if(child == nullptr) continue; RangeLoop temp = CalcAvoidanceThetas(S,child); @@ -1137,13 +1137,13 @@ RangeLoop CalcAvoidanceThetas ( Sphere const & S, ComponentExtent const * extent RangeLoop CalcAvoidanceThetas ( Sphere const & S, DetailExtent const * extent ) { - if(extent == NULL) return RangeLoop::empty; + if(extent == nullptr) return RangeLoop::empty; int count = extent->getExtentCount(); BaseExtent const * child = extent->getExtent(count - 1); - if(child == NULL) return RangeLoop::empty; + if(child == nullptr) return RangeLoop::empty; return CalcAvoidanceThetas(S,child); } @@ -1152,7 +1152,7 @@ RangeLoop CalcAvoidanceThetas ( Sphere const & S, DetailExtent const * extent ) RangeLoop CalcAvoidanceThetas ( Sphere const & S, BaseExtent const * extent ) { - if(extent == NULL) return RangeLoop::empty; + if(extent == nullptr) return RangeLoop::empty; ExtentType type = extent->getType(); @@ -1176,7 +1176,7 @@ RangeLoop CalcAvoidanceThetas ( Sphere const & S, ExtentVec const & extents ) { BaseExtent const * child = extents[i]; - if(child == NULL) continue; + if(child == nullptr) continue; RangeLoop temp = CalcAvoidanceThetas(S,child); @@ -1367,7 +1367,7 @@ void explodeObstacle ( Sphere const & sphere, Vector const & delta, SimpleExtent void explodeObstacle ( Sphere const & sphere, Vector const & delta, DetailExtent const * extent, ExtentVec & outList ) { - if(extent == NULL) return; + if(extent == nullptr) return; int count = extent->getExtentCount(); @@ -1376,7 +1376,7 @@ void explodeObstacle ( Sphere const & sphere, Vector const & delta, DetailExtent void explodeObstacle ( Sphere const & sphere, Vector const & delta, ComponentExtent const * extent, ExtentVec & outList ) { - if(extent == NULL) return; + if(extent == nullptr) return; int count = extent->getExtentCount(); @@ -1388,7 +1388,7 @@ void explodeObstacle ( Sphere const & sphere, Vector const & delta, ComponentExt void explodeObstacle ( Sphere const & sphere, Vector const & delta, BaseExtent const * extent, ExtentVec & outList ) { - if(extent == NULL) return; + if(extent == nullptr) return; ExtentType type = extent->getType(); @@ -1411,7 +1411,7 @@ void explodeObstacle ( Sphere const & sphere, Vector const & delta, ExtentVec co bool CalcAvoidancePoint ( Sphere const & sphere, Transform const & sphereTransform_p2w, Vector const & delta, CollisionProperty const * obstacle, Vector & out ) { - if(obstacle == NULL) return false; + if(obstacle == nullptr) return false; static ExtentVec tempExtents; @@ -1455,12 +1455,12 @@ bool CalcAvoidancePoint ( Sphere const & sphere, Transform const & sphereTransfo bool CalcAvoidancePoint ( CollisionProperty const * mob, Vector const & delta, CollisionProperty const * obstacle, Vector & out ) { - if(mob == NULL) return false; - if(obstacle == NULL) return false; + if(mob == nullptr) return false; + if(obstacle == nullptr) return false; BaseExtent const * mobExtent = mob->getExtent_p(); - if(mobExtent == NULL) return false; + if(mobExtent == nullptr) return false; Sphere mobSphere = mobExtent->getBoundingSphere(); @@ -1471,8 +1471,8 @@ bool CalcAvoidancePoint ( CollisionProperty const * mob, Vector const & delta, C bool CalcAvoidancePoint ( Object const * mob, Vector const & delta, Object const * obstacle, Vector & out ) { - if(mob == NULL) return false; - if(obstacle == NULL) return false; + if(mob == nullptr) return false; + if(obstacle == nullptr) return false; CollisionProperty const * mobCollision = mob->getCollisionProperty(); CollisionProperty const * obstacleCollision = obstacle->getCollisionProperty(); @@ -1601,8 +1601,8 @@ Vector transformToCell ( CellProperty const * cellA, Vector const & point_A, Cel { CellProperty const * worldCell = CellProperty::getWorldCellProperty(); - if(cellA == NULL) cellA = worldCell; - if(cellB == NULL) cellB = worldCell; + if(cellA == nullptr) cellA = worldCell; + if(cellB == nullptr) cellB = worldCell; if(cellA == cellB) return point_A; @@ -1627,8 +1627,8 @@ Vector rotateToCell ( CellProperty const * cellA, Vector const & point_A, CellPr { CellProperty const * worldCell = CellProperty::getWorldCellProperty(); - if(cellA == NULL) cellA = worldCell; - if(cellB == NULL) cellB = worldCell; + if(cellA == nullptr) cellA = worldCell; + if(cellB == nullptr) cellB = worldCell; if(cellA == cellB) return point_A; @@ -1655,8 +1655,8 @@ Transform transformToCell ( CellProperty const * cellA, Transform const & transf { CellProperty const * worldCell = CellProperty::getWorldCellProperty(); - if(cellA == NULL) cellA = worldCell; - if(cellB == NULL) cellB = worldCell; + if(cellA == nullptr) cellA = worldCell; + if(cellB == nullptr) cellB = worldCell; if(cellA == cellB) return transform_A; @@ -1743,8 +1743,8 @@ MultiShape transformToCell ( CellProperty const * cellA, MultiShape const & shap bool testPortalVis ( CellProperty const * cellA, Vector const & pointA, CellProperty const * cellB, Vector const & pointB ) { - if(cellA == NULL) return false; - if(cellB == NULL) return false; + if(cellA == nullptr) return false; + if(cellB == nullptr) return false; float hitTime = 0.0f; @@ -1753,7 +1753,7 @@ bool testPortalVis ( CellProperty const * cellA, Vector const & pointA, CellProp if(cellA == cellB) { - return cellA->getDestinationCell(pointA,pointB,hitTime) == NULL; + return cellA->getDestinationCell(pointA,pointB,hitTime) == nullptr; } // ---------- diff --git a/engine/shared/library/sharedCollision/src/shared/core/CollisionWorld.cpp b/engine/shared/library/sharedCollision/src/shared/core/CollisionWorld.cpp index 29d98133..61b199f9 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/CollisionWorld.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/CollisionWorld.cpp @@ -71,7 +71,7 @@ namespace CollisionWorldNamespace // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SpatialDatabase * ms_database = NULL; + SpatialDatabase * ms_database = nullptr; bool ms_updating = false; bool ms_serverSide = false; @@ -94,7 +94,7 @@ namespace CollisionWorldNamespace bool testPassableTerrain(Vector const & startPos, Vector const & delta, float & collisionTime) { TerrainObject const *const terrainObject = TerrainObject::getConstInstance(); - if (NULL != terrainObject) + if (nullptr != terrainObject) { float totalDistance = delta.magnitude(); float distanceTraversed = 0.0f; @@ -134,7 +134,7 @@ namespace CollisionWorldNamespace return; TerrainObject const *const terrainObject = TerrainObject::getConstInstance(); - if (NULL != terrainObject && terrainObject->hasPassableAffectors()) + if (nullptr != terrainObject && terrainObject->hasPassableAffectors()) { // pointA_w is *not* the previous world position, but actually the world @@ -289,7 +289,7 @@ bool CollisionWorldNamespace::testFloorCollision(FloorLocator const &startFloorL if (!floor) { // For some reason this solid floor does not have an attached floor. No collision. - WARNING(true, ("testFloorCollision(): attempted to test floor with a starting floor locator that had a NULL floor, unexpected. Check calling code's assumptions.")); + WARNING(true, ("testFloorCollision(): attempted to test floor with a starting floor locator that had a nullptr floor, unexpected. Check calling code's assumptions.")); return true; } @@ -319,7 +319,7 @@ bool CollisionWorldNamespace::testFloorCollision(FloorLocator const &startFloorL // if statement above. WARNING(true, ("testFloorCollision(): floor collision occurred while checking for floor collisions for floor of object id [%s] but collision floor location has no associated floor. Calling this a non-collision. PathWalkResult was [%d].", - floor->getOwner() ? floor->getOwner()->getNetworkId().getValueString().c_str() : "", + floor->getOwner() ? floor->getOwner()->getNetworkId().getValueString().c_str() : "", static_cast(pathWalkResult) )); return false; @@ -328,8 +328,8 @@ bool CollisionWorldNamespace::testFloorCollision(FloorLocator const &startFloorL collisionObject = destinationFloor->getOwner(); if (!collisionObject) { - // We had a collision on a floor, but the floor had a NULL owner. Consider this a non-collision. - WARNING(true, ("testFloorCollision(): floor collision occurred, destination collision floor location had a floor but floor reported a NULL owner. Calling this a non-collision.")); + // We had a collision on a floor, but the floor had a nullptr owner. Consider this a non-collision. + WARNING(true, ("testFloorCollision(): floor collision occurred, destination collision floor location had a floor but floor reported a nullptr owner. Calling this a non-collision.")); return false; } @@ -447,11 +447,11 @@ void CollisionWorld::remove ( void ) CollisionResolve::remove(); FloorMesh::remove(); - s_nearWarpWarningCallback = NULL; - s_farWarpWarningCallback = NULL; + s_nearWarpWarningCallback = nullptr; + s_farWarpWarningCallback = nullptr; delete ms_database; - ms_database = NULL; + ms_database = nullptr; } // ---------------------------------------------------------------------- @@ -595,7 +595,7 @@ bool CollisionWorld::spatialSweepAndResolve(CollisionProperty * collider) void CollisionWorld::update(CollisionProperty * collider, float time) { - FATAL(!collider, ("CollisionWorld::update(): collider is NULL.")); + FATAL(!collider, ("CollisionWorld::update(): collider is nullptr.")); PROFILER_AUTO_BLOCK_DEFINE("CollisionWorld::update"); @@ -603,9 +603,9 @@ void CollisionWorld::update(CollisionProperty * collider, float time) Footprint * foot = collider->getFootprint(); - if(foot == NULL) + if(foot == nullptr) { - PROFILER_AUTO_BLOCK_DEFINE("CollisionWorld::update: foot == NULL"); + PROFILER_AUTO_BLOCK_DEFINE("CollisionWorld::update: foot == nullptr"); IGNORE_RETURN (CollisionWorld::spatialSweepAndResolve(collider)); collider->storePosition(); @@ -1076,11 +1076,11 @@ void CollisionWorld::setFarWarpWarningCallback(WarpWarningCallback callback) void CollisionWorld::addObject ( Object * object ) { - if(object == NULL) return; + if(object == nullptr) return; CollisionProperty * collision = object->getCollisionProperty(); - if((collision == NULL) || collision->getDisableCollisionWorldAddRemove()) return; + if((collision == nullptr) || collision->getDisableCollisionWorldAddRemove()) return; if(collision->isInCollisionWorld()) return; @@ -1125,7 +1125,7 @@ void CollisionWorld::addObject ( Object * object ) { char const * name = object->getObjectTemplateName(); - if(name == NULL) + if(name == nullptr) { Appearance const * appearance = object->getAppearance(); @@ -1162,11 +1162,11 @@ void CollisionWorld::addObject ( Object * object ) void CollisionWorld::removeObject ( Object * object ) { - if(object == NULL) return; + if(object == nullptr) return; CollisionProperty * collision = object->getCollisionProperty(); - if((collision == NULL) || collision->getDisableCollisionWorldAddRemove()) return; + if((collision == nullptr) || collision->getDisableCollisionWorldAddRemove()) return; if(!collision->isInCollisionWorld()) return; @@ -1218,11 +1218,11 @@ void CollisionWorld::removeObject ( Object * object ) void CollisionWorld::moveObject (Object * object) { - if(object == NULL) return; + if(object == nullptr) return; CollisionProperty * collision = object->getCollisionProperty(); - if(collision == NULL) return; + if(collision == nullptr) return; if(!collision->isInCollisionWorld()) return; @@ -1248,11 +1248,11 @@ void CollisionWorld::moveObject (Object * object) void CollisionWorld::cellChanged ( Object * object ) { - if(object == NULL) return; + if(object == nullptr) return; CollisionProperty * collision = object->getCollisionProperty(); - if(collision == NULL) return; + if(collision == nullptr) return; if(!collision->isInCollisionWorld()) return; @@ -1266,11 +1266,11 @@ void CollisionWorld::cellChanged ( Object * object ) void CollisionWorld::appearanceChanged ( Object * object ) { - if(object == NULL) return; + if(object == nullptr) return; CollisionProperty * collision = object->getCollisionProperty(); - if(collision == NULL) return; + if(collision == nullptr) return; if(!collision->isInCollisionWorld()) return; @@ -1333,12 +1333,12 @@ SpatialDatabase * CollisionWorld::getDatabase ( void ) void CollisionWorld::objectWarped ( Object * object ) { - if(object == NULL) return; + if(object == nullptr) return; CollisionProperty * collision = object->getCollisionProperty(); // object does not have a CollisionProperty - if(collision == NULL) return; + if(collision == nullptr) return; // object is not in CollisionWorld if (!collision->isInCollisionWorld()) return; @@ -1458,7 +1458,7 @@ QueryInteractionResult CollisionWorld::queryInteraction ( CellProperty const * c if(hitTime < hitPortalTime) { outHitTime = hitTime; - outHitObject = NULL; + outHitObject = nullptr; return QIR_HitTerrain; } @@ -1472,12 +1472,12 @@ QueryInteractionResult CollisionWorld::queryInteraction ( CellProperty const * c // If we did not hit a portal, the query ends in this cell. // If this cell is not the goal cell, then the query fails. - if(nextCell == NULL) + if(nextCell == nullptr) { if(cellA != cellB) { outHitTime = 1.0f; - outHitObject = NULL; + outHitObject = nullptr; return QIR_MissedTarget; } @@ -1702,7 +1702,7 @@ CanMoveResult CollisionWorld::canMove ( CellProperty const * startCell, FloorLocator dummy; - return canMove( NULL, startCell, startLoc, goalPos, checkY, checkFlora, checkFauna, dummy ); + return canMove( nullptr, startCell, startLoc, goalPos, checkY, checkFlora, checkFauna, dummy ); } // ---------- @@ -1714,7 +1714,7 @@ CanMoveResult CollisionWorld::canMove ( Object const * object, bool checkFlora, bool checkFauna ) { - if(object == NULL) + if(object == nullptr) { return CMR_Error; } @@ -1766,7 +1766,7 @@ CanMoveResult CollisionWorld::canMove ( Object const * object, bool checkFauna, FloorLocator & endLoc ) { - if(startCell == NULL) + if(startCell == nullptr) { startCell = CellProperty::getWorldCellProperty(); } @@ -1858,7 +1858,7 @@ CanMoveResult CollisionWorld::canMove ( Object const * object, } // ---------- -// A NULL goal cell means we don't care what cell we end up in as long as we make it to the goal +// A nullptr goal cell means we don't care what cell we end up in as long as we make it to the goal CanMoveResult CollisionWorld::canMove ( Object const * object, CellProperty const * startCell, @@ -1871,12 +1871,12 @@ CanMoveResult CollisionWorld::canMove ( Object const * object, { // ---------- - if(startCell == NULL) + if(startCell == nullptr) { startCell = CellProperty::getWorldCellProperty(); } - if(goalCell == NULL) + if(goalCell == nullptr) { FloorLocator dummy; @@ -2233,17 +2233,17 @@ bool CollisionWorld::findFirstObstacle ( Object const * creature, float creature Vector delta = testPos - startPos; - if(creature == NULL) return false; + if(creature == nullptr) return false; CollisionProperty const * collision = creature->getCollisionProperty(); - if(collision == NULL) return false; + if(collision == nullptr) return false; BaseExtent const * baseExtent = collision->getExtent_p(); SimpleExtent const * simpleExtent = dynamic_cast(baseExtent); - if(simpleExtent == NULL) return false; + if(simpleExtent == nullptr) return false; MultiShape const & shape = simpleExtent->getShape(); @@ -2253,7 +2253,7 @@ bool CollisionWorld::findFirstObstacle ( Object const * creature, float creature // Test collision extents DetectResult minResult; - Object const * minObject = NULL; + Object const * minObject = nullptr; typedef std::vector ObjectVector; static ObjectVector statics; @@ -2262,7 +2262,7 @@ bool CollisionWorld::findFirstObstacle ( Object const * creature, float creature statics.clear(); creatures.clear(); - if(ms_database->queryObjects(creature->getParentCell(), shape, delta, (testStatics ? &statics : NULL), (testCreatures ? &creatures : NULL))) + if(ms_database->queryObjects(creature->getParentCell(), shape, delta, (testStatics ? &statics : nullptr), (testCreatures ? &creatures : nullptr))) { ObjectVector::size_type const nStatics = statics.size(); ObjectVector::size_type i; @@ -2271,7 +2271,7 @@ bool CollisionWorld::findFirstObstacle ( Object const * creature, float creature { Object const * obstacle = statics[i]; - if(obstacle == NULL) continue; + if(obstacle == nullptr) continue; if(obstacle == creature) continue; @@ -2292,7 +2292,7 @@ bool CollisionWorld::findFirstObstacle ( Object const * creature, float creature { Object const * obstacle = creatures[i]; - if(obstacle == NULL) continue; + if(obstacle == nullptr) continue; if(obstacle == creature) continue; @@ -2310,10 +2310,10 @@ bool CollisionWorld::findFirstObstacle ( Object const * creature, float creature //-- Check for floor collisions. Footprint const *const footprint = collision->getFootprint(); - FloorLocator const *const floorLocator = (footprint ? footprint->getAnyContact() : NULL); + FloorLocator const *const floorLocator = (footprint ? footprint->getAnyContact() : nullptr); if (floorLocator) { - Object const *floorCollisionObject = NULL; + Object const *floorCollisionObject = nullptr; Vector collisionLocation_w; // Do the floor check. @@ -2372,7 +2372,7 @@ bool CollisionWorld::findFirstObstacle ( Sphere const & sphere, Vector const & g // Test collision extents DetectResult minResult; - Object const * minObject = NULL; + Object const * minObject = nullptr; static std::vector statics; static std::vector creatures; @@ -2380,7 +2380,7 @@ bool CollisionWorld::findFirstObstacle ( Sphere const & sphere, Vector const & g statics.clear(); creatures.clear(); - if(ms_database->queryObjects(CellProperty::getWorldCellProperty(), shape, delta, (testStatics ? &statics : NULL), (testCreatures ? &creatures : NULL))) + if(ms_database->queryObjects(CellProperty::getWorldCellProperty(), shape, delta, (testStatics ? &statics : nullptr), (testCreatures ? &creatures : nullptr))) { size_t const nStatics = statics.size(); size_t i; @@ -2389,7 +2389,7 @@ bool CollisionWorld::findFirstObstacle ( Sphere const & sphere, Vector const & g { Object const * obstacle = statics[i]; - if(obstacle == NULL) continue; + if(obstacle == nullptr) continue; DetectResult result = CollisionDetect::testSphereObject(sphere,delta,obstacle); @@ -2406,7 +2406,7 @@ bool CollisionWorld::findFirstObstacle ( Sphere const & sphere, Vector const & g { Object const * obstacle = creatures[i]; - if(obstacle == NULL) continue; + if(obstacle == nullptr) continue; if(Distance2d::Distance2(obstacle->getPosition_w(),goalPos) < 0.000001) continue; @@ -2437,7 +2437,7 @@ bool CollisionWorld::findFirstObstacle ( Sphere const & sphere, Vector const & g bool CollisionWorld::calcBubble ( CellProperty const * cell, Vector const & point_p, float maxDistance, float & outRadius ) { - return calcBubble(cell,point_p,NULL,maxDistance,outRadius); + return calcBubble(cell,point_p,nullptr,maxDistance,outRadius); } bool CollisionWorld::calcBubble ( CellProperty const * cell, Vector const & point_p, Object const * ignoreObject, float maxDistance, float & outRadius ) @@ -2698,16 +2698,16 @@ void CollisionWorld::handleSceneChange(std::string const & sceneId) Floor const * CollisionWorld::getFloorStandingOn(Object const & object) { CollisionProperty const * const objectCollisionProperty = object.getCollisionProperty(); - Footprint const * const objectFootprint = (objectCollisionProperty != NULL) ? objectCollisionProperty->getFootprint() : NULL; + Footprint const * const objectFootprint = (objectCollisionProperty != nullptr) ? objectCollisionProperty->getFootprint() : nullptr; - if (objectFootprint == NULL) + if (objectFootprint == nullptr) { - return NULL; + return nullptr; } MultiListHandle const & floorList = objectFootprint->getFloorList(); float const objectHeight = object.getPosition_w().y; - Floor const * resultFloor = NULL; + Floor const * resultFloor = nullptr; float resultDistanceBelowObject = 0.0f; float dropTestHeight = std::numeric_limits::min(); @@ -2750,7 +2750,7 @@ Floor const * CollisionWorld::getFloorStandingOn(Object const & object) { TerrainObject const * const terrainObject = TerrainObject::getConstInstance(); - if (terrainObject != NULL) + if (terrainObject != nullptr) { CellProperty const * const parentCell = object.getParentCell(); @@ -2775,7 +2775,7 @@ Floor const * CollisionWorld::getFloorStandingOn(Object const & object) { if (dropTestHeight < terrainHeight) { - resultFloor = NULL; + resultFloor = nullptr; } } } diff --git a/engine/shared/library/sharedCollision/src/shared/core/ConfigSharedCollision.cpp b/engine/shared/library/sharedCollision/src/shared/core/ConfigSharedCollision.cpp index 0b3d4164..b9811896 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/ConfigSharedCollision.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/ConfigSharedCollision.cpp @@ -68,8 +68,8 @@ float ms_terrainLOSMaxDistance = 64.0f; float ms_losUprightScale = 1.5f; float ms_losProneScale = 1.0f; -PlayEffectHook ms_playEffectHook = NULL; -IsPlayerHouseHook ms_isPlayerHouseHook = NULL; +PlayEffectHook ms_playEffectHook = nullptr; +IsPlayerHouseHook ms_isPlayerHouseHook = nullptr; int ms_spatialSweepAndResolveDefaultMask = static_cast(SpatialDatabase::Q_Static); diff --git a/engine/shared/library/sharedCollision/src/shared/core/Contact3d.h b/engine/shared/library/sharedCollision/src/shared/core/Contact3d.h index 2d4d7236..551822e2 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/Contact3d.h +++ b/engine/shared/library/sharedCollision/src/shared/core/Contact3d.h @@ -52,9 +52,9 @@ public: m_normal(newNormal), m_surfaceId1(-1), m_surfaceId2(-1), - m_cell(NULL), - m_extent(NULL), - m_surface(NULL) + m_cell(nullptr), + m_extent(nullptr), + m_surface(nullptr) { } diff --git a/engine/shared/library/sharedCollision/src/shared/core/ContactPoint.cpp b/engine/shared/library/sharedCollision/src/shared/core/ContactPoint.cpp index 304a14b7..be31ca04 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/ContactPoint.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/ContactPoint.cpp @@ -18,7 +18,7 @@ // ---------------------------------------------------------------------- ContactPoint::ContactPoint() -: m_pSurface( NULL ), +: m_pSurface( nullptr ), m_position( Vector::zero ), m_offset( 0.0f ), m_hitId( -1 ) @@ -45,7 +45,7 @@ ContactPoint::ContactPoint ( ContactPoint const & locCopy ) bool ContactPoint::isAttached ( void ) const { - return (m_hitId != -1) && (m_pSurface != NULL); + return (m_hitId != -1) && (m_pSurface != nullptr); } // ---------------------------------------------------------------------- @@ -115,7 +115,7 @@ void ContactPoint::read_0000 ( Iff & iff ) { m_position = iff.read_floatVector(); m_offset = iff.read_float(); - m_pSurface = NULL; + m_pSurface = nullptr; m_hitId = iff.read_int32(); NAN_CHECK(m_position); diff --git a/engine/shared/library/sharedCollision/src/shared/core/DoorObject.cpp b/engine/shared/library/sharedCollision/src/shared/core/DoorObject.cpp index a14c9980..68b421e8 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/DoorObject.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/DoorObject.cpp @@ -99,11 +99,11 @@ DoorObject::DoorObject ( DoorInfo const & info, Portal * portal ) m_doorHelper2 ( info ), m_delta ( info.m_delta ), m_portal ( portal ), - m_neighbor ( NULL ), + m_neighbor ( nullptr ), m_spring ( info.m_spring ), m_smoothness ( info.m_smoothness ), m_draw ( true ), - m_barrier ( NULL ), + m_barrier ( nullptr ), m_oldDoorPos ( Vector::maxXYZ ), m_wasOpen(false), m_isForceField( false ), @@ -119,7 +119,7 @@ DoorObject::DoorObject ( DoorInfo const & info, Portal * portal ) setDebugName("Door object"); for (int i = 0; i < MAX_DRAWN_DOORS; ++i) - m_drawnDoor[i] = NULL; + m_drawnDoor[i] = nullptr; createAppearance(info); createTrigger(info); @@ -131,7 +131,7 @@ DoorObject::DoorObject ( DoorInfo const & info, Portal * portal ) DoorObject::~DoorObject() { m_hitByObjects.clear(); - m_portal = NULL; + m_portal = nullptr; } // ---------------------------------------------------------------------- @@ -181,7 +181,7 @@ DoorObject const * DoorObject::getNeighbor ( void ) const int DoorObject::getNumberOfDrawnDoors ( void ) { for (int i = 0; i < MAX_DRAWN_DOORS; ++i) - if (m_drawnDoor[i] == NULL) + if (m_drawnDoor[i] == nullptr) return i; return MAX_DRAWN_DOORS; @@ -210,7 +210,7 @@ void DoorObject::createAppearance ( DoorInfo const & info ) { Appearance * const appearance = AppearanceTemplateList::createAppearance(info.m_frameAppearance); - if (appearance != NULL) { + if (appearance != nullptr) { setAppearance(appearance); } else { DEBUG_WARNING(true, ("FIX ME: Appearance template for DoorObject::createAppearance missing, first stanza.")); @@ -233,7 +233,7 @@ void DoorObject::createAppearance ( DoorInfo const & info ) Collision3d::MovePolyOnto(verts,Vector::zero); Appearance * appearance = CellProperty::createForceField(verts,gs_forceFieldColor); - if(appearance != NULL) + if(appearance != nullptr) { m_drawnDoor[0]->setAppearance( appearance ); Extent * appearanceExtent = new Extent( Containment3d::EncloseSphere(verts) ); @@ -249,7 +249,7 @@ void DoorObject::createAppearance ( DoorInfo const & info ) { Appearance * const appearance = AppearanceTemplateList::createAppearance(info.m_doorAppearance); - if (appearance != NULL) { + if (appearance != nullptr) { m_drawnDoor[0]->setAppearance(appearance); } else { DEBUG_WARNING(true, ("FIX ME: Appearance template for DoorObject::createAppearance missing, third stanza.")); @@ -263,7 +263,7 @@ void DoorObject::createAppearance ( DoorInfo const & info ) Appearance * const appearance = AppearanceTemplateList::createAppearance(info.m_doorAppearance2); - if (appearance != NULL) { + if (appearance != nullptr) { m_drawnDoor[1]->setAppearance(appearance); } else { DEBUG_WARNING(true, ("FIX ME: Appearance template for DoorObject::createAppearance missing, fourth stanza.")); @@ -476,7 +476,7 @@ float DoorObject::tween ( float t ) const void DoorObject::hitBy( CollisionProperty const * collision ) { - if(collision == NULL) return; + if(collision == nullptr) return; CellProperty const * doorCell = getParentCell(); CellProperty const * doorNeighborCell = m_neighbor ? m_neighbor->getParentCell() : doorCell; @@ -533,7 +533,7 @@ void DoorObject::setNeighbor ( DoorObject * newNeighbor ) if (newNeighbor) m_barrier->setNeighbor( newNeighbor->m_barrier ); else - m_barrier->setNeighbor( NULL ); + m_barrier->setNeighbor( nullptr ); } } @@ -587,7 +587,7 @@ void DoorObject::trackHitByObject(Object const &hitByObject) if (static_cast(m_hitByObjects.size()) >= cs_maxHitByObjectsToTrack) return; - // NOTE: This can't be a set because the key's value can change when a watcher's value changes from non-NULL to NULL. + // NOTE: This can't be a set because the key's value can change when a watcher's value changes from non-nullptr to nullptr. // Check if the object already exists in the list. if (std::find(m_hitByObjects.begin(), m_hitByObjects.end(), ConstWatcher(&hitByObject)) != m_hitByObjects.end()) return; @@ -607,7 +607,7 @@ void DoorObject::maintainHitByObjectVector() // Remove any objects that no longer exist or no longer are within the trigger radius. for (WatcherObjectVector::iterator it = m_hitByObjects.begin(); it != m_hitByObjects.end(); ) { - if (it->getPointer() == NULL) + if (it->getPointer() == nullptr) { // This hit-by object has been deleted so clear it out of the tracking list. it = m_hitByObjects.erase(it); diff --git a/engine/shared/library/sharedCollision/src/shared/core/Floor.cpp b/engine/shared/library/sharedCollision/src/shared/core/Floor.cpp index 4d08d7df..8d23bff3 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/Floor.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/Floor.cpp @@ -49,8 +49,8 @@ Floor::Floor( FloorMesh const * pMesh, Object const * owner, Appearance const * m_mesh(pMesh), m_footList(this,1), m_databaseList(this,1), - m_spatialSubdivisionHandle(NULL), - m_extent(NULL), + m_spatialSubdivisionHandle(nullptr), + m_extent(nullptr), m_extentDirty(true), m_sphere_l(), m_sphere_w() @@ -104,15 +104,15 @@ Floor::~Floor() } const_cast(m_mesh)->releaseReference(); - m_mesh = NULL; + m_mesh = nullptr; - m_owner = NULL; - m_appearance = NULL; + m_owner = nullptr; + m_appearance = nullptr; - m_spatialSubdivisionHandle = NULL; + m_spatialSubdivisionHandle = nullptr; delete m_extent; - m_extent = NULL; + m_extent = nullptr; } // ---------------------------------------------------------------------- @@ -255,7 +255,7 @@ bool Floor::segTestBounds ( Vector const & begin, Vector const & end ) const Object const * Floor::getOwner ( void ) const { - if(m_owner != NULL) + if(m_owner != nullptr) { return m_owner; } @@ -265,7 +265,7 @@ Object const * Floor::getOwner ( void ) const } else { - return NULL; + return nullptr; } } @@ -273,7 +273,7 @@ Object const * Floor::getOwner ( void ) const Appearance const * Floor::getAppearance ( void ) const { - if(m_appearance != NULL) + if(m_appearance != nullptr) { return m_appearance; } @@ -283,7 +283,7 @@ Appearance const * Floor::getAppearance ( void ) const } else { - return NULL; + return nullptr; } } @@ -301,7 +301,7 @@ CellProperty const * Floor::getCell ( void ) const } else { - return NULL; + return nullptr; } } @@ -657,7 +657,7 @@ NetworkId const & Floor::getId() const { CellProperty const * const cellProperty = getCell(); - return (cellProperty != NULL) ? cellProperty->getOwner().getNetworkId() : NetworkId::cms_invalid; + return (cellProperty != nullptr) ? cellProperty->getOwner().getNetworkId() : NetworkId::cms_invalid; } // ====================================================================== diff --git a/engine/shared/library/sharedCollision/src/shared/core/FloorLocator.cpp b/engine/shared/library/sharedCollision/src/shared/core/FloorLocator.cpp index f595384a..5b728aee 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/FloorLocator.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/FloorLocator.cpp @@ -34,7 +34,7 @@ FloorTri gs_dummyFloorTri; FloorLocator::FloorLocator() : ContactPoint(), m_valid(false), - m_floor(NULL), + m_floor(nullptr), m_radius(0.0f), m_time(0.0f), m_edgeId(-1), @@ -47,7 +47,7 @@ FloorLocator::FloorLocator() // ---------- FloorLocator::FloorLocator( Floor const * floor, Vector const & localPoint, int triId, float dist, float radius ) -: ContactPoint((floor ? floor->getFloorMesh() : NULL),localPoint,triId,dist), +: ContactPoint((floor ? floor->getFloorMesh() : nullptr),localPoint,triId,dist), m_valid(true), m_floor(floor), m_radius(radius), @@ -64,7 +64,7 @@ FloorLocator::FloorLocator( Floor const * floor, Vector const & localPoint, int FloorLocator::FloorLocator( CollisionSurface const * mesh, Vector const & point, int triId, float dist, float radius ) : ContactPoint(mesh,point,triId,dist), m_valid(true), - m_floor(NULL), + m_floor(nullptr), m_radius(radius), m_time(0.0f), m_edgeId(-1), @@ -78,7 +78,7 @@ FloorLocator::FloorLocator( CollisionSurface const * mesh, Vector const & point, // ---------- FloorLocator::FloorLocator( Floor const * floor, Vector const & localPoint ) -: ContactPoint((floor ? floor->getFloorMesh() : NULL),localPoint,-1,0.0f), +: ContactPoint((floor ? floor->getFloorMesh() : nullptr),localPoint,-1,0.0f), m_valid(true), m_floor(floor), m_radius(0.0f), @@ -95,7 +95,7 @@ FloorLocator::FloorLocator( Floor const * floor, Vector const & localPoint ) FloorLocator::FloorLocator( CollisionSurface const * mesh, Vector const & point ) : ContactPoint(mesh,point,-1,0.0f), m_valid(true), - m_floor(NULL), + m_floor(nullptr), m_radius(0.0f), m_time(0.0f), m_edgeId(-1), @@ -109,9 +109,9 @@ FloorLocator::FloorLocator( CollisionSurface const * mesh, Vector const & point // ---------- FloorLocator::FloorLocator( Vector const & point, float radius ) -: ContactPoint(NULL,point,-1,0.0f), +: ContactPoint(nullptr,point,-1,0.0f), m_valid(true), - m_floor(NULL), + m_floor(nullptr), m_radius(radius), m_time(0.0f), m_edgeId(-1), @@ -226,7 +226,7 @@ void FloorLocator::setFloor ( Floor const * newFloor ) } else { - if(getFloorMesh() == NULL) + if(getFloorMesh() == nullptr) { Vector oldPos = getPosition_p(); @@ -239,7 +239,7 @@ void FloorLocator::setFloor ( Floor const * newFloor ) } else { - m_floor = NULL; + m_floor = nullptr; } } @@ -289,7 +289,7 @@ CellProperty const * FloorLocator::getCell ( void ) const { if(getFloorMesh()) { - return NULL; + return nullptr; } else { @@ -312,7 +312,7 @@ CellProperty * FloorLocator::getCell ( void ) { if(getFloorMesh()) { - return NULL; + return nullptr; } else { @@ -417,7 +417,7 @@ void FloorLocator::write ( Iff & iff ) const void FloorLocator::detach ( void ) { - setFloor(NULL); + setFloor(nullptr); setId(-1); } diff --git a/engine/shared/library/sharedCollision/src/shared/core/FloorManager.cpp b/engine/shared/library/sharedCollision/src/shared/core/FloorManager.cpp index 677849e7..1ea799b9 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/FloorManager.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/FloorManager.cpp @@ -19,9 +19,9 @@ namespace FloorManagerNamespace { -ObjectFactory ms_pathGraphFactory = NULL; -ObjectWriter ms_pathGraphWriter = NULL; -ObjectRenderer ms_pathGraphRenderer = NULL; +ObjectFactory ms_pathGraphFactory = nullptr; +ObjectWriter ms_pathGraphWriter = nullptr; +ObjectRenderer ms_pathGraphRenderer = nullptr; }; @@ -72,7 +72,7 @@ Floor * FloorManager::createFloor ( const char * floorMeshFilename, Object const if(!pMesh) { WARNING(true, ("Could not find floor mesh %s", floorMeshFilename)); - return NULL; + return nullptr; } // ---------- diff --git a/engine/shared/library/sharedCollision/src/shared/core/FloorMesh.cpp b/engine/shared/library/sharedCollision/src/shared/core/FloorMesh.cpp index 370f13b7..ae508f4a 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/FloorMesh.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/FloorMesh.cpp @@ -78,8 +78,8 @@ const Tag TAG_BTRE = TAG(B,T,R,E); const Tag TAG_BEDG = TAG(B,E,D,G); const Tag TAG_PGRF = TAG(P,G,R,F); -template <> FloorMeshList::CreateDataResourceMap *FloorMeshList::ms_bindings = NULL; -template <> FloorMeshList::LoadedDataResourceMap *FloorMeshList::ms_loaded = NULL; +template <> FloorMeshList::CreateDataResourceMap *FloorMeshList::ms_bindings = nullptr; +template <> FloorMeshList::LoadedDataResourceMap *FloorMeshList::ms_loaded = nullptr; // ---------------------------------------------------------------------- @@ -92,20 +92,20 @@ FloorMesh::FloorMesh(const std::string & filename) m_uncrossableEdges( new FloorEdgeIdVec() ), m_wallBaseEdges( new FloorEdgeIdVec() ), m_wallTopEdges( new FloorEdgeIdVec() ), - m_pathGraph(NULL), - m_appearance(NULL), + m_pathGraph(nullptr), + m_appearance(nullptr), m_triMarkCounter(1000), // just some random number m_objectFloor(false) { #ifdef _DEBUG - m_crossableLines = NULL; - m_uncrossableLines = NULL; - m_interiorLines = NULL; - m_portalLines = NULL; - m_rampLines = NULL; - m_fallthroughTriLines = NULL; - m_solidTriLines = NULL; + m_crossableLines = nullptr; + m_uncrossableLines = nullptr; + m_interiorLines = nullptr; + m_portalLines = nullptr; + m_rampLines = nullptr; + m_fallthroughTriLines = nullptr; + m_solidTriLines = nullptr; #endif } @@ -121,8 +121,8 @@ FloorMesh::FloorMesh( VectorVector const & vertices, IntVector const & indices ) m_uncrossableEdges( new FloorEdgeIdVec() ), m_wallBaseEdges( new FloorEdgeIdVec() ), m_wallTopEdges( new FloorEdgeIdVec() ), - m_pathGraph(NULL), - m_appearance(NULL), + m_pathGraph(nullptr), + m_appearance(nullptr), m_triMarkCounter(1000), m_objectFloor(false) { @@ -130,13 +130,13 @@ FloorMesh::FloorMesh( VectorVector const & vertices, IntVector const & indices ) #ifdef _DEBUG - m_crossableLines = NULL; - m_uncrossableLines = NULL; - m_interiorLines = NULL; - m_portalLines = NULL; - m_rampLines = NULL; - m_fallthroughTriLines = NULL; - m_solidTriLines = NULL; + m_crossableLines = nullptr; + m_uncrossableLines = nullptr; + m_interiorLines = nullptr; + m_portalLines = nullptr; + m_rampLines = nullptr; + m_fallthroughTriLines = nullptr; + m_solidTriLines = nullptr; #endif } @@ -146,50 +146,50 @@ FloorMesh::FloorMesh( VectorVector const & vertices, IntVector const & indices ) FloorMesh::~FloorMesh() { delete m_vertices; - m_vertices = NULL; + m_vertices = nullptr; delete m_floorTris; - m_floorTris = NULL; + m_floorTris = nullptr; delete m_crossableEdges; - m_crossableEdges = NULL; + m_crossableEdges = nullptr; delete m_uncrossableEdges; - m_crossableEdges = NULL; + m_crossableEdges = nullptr; delete m_wallBaseEdges; - m_wallBaseEdges = NULL; + m_wallBaseEdges = nullptr; delete m_wallTopEdges; - m_wallTopEdges = NULL; + m_wallTopEdges = nullptr; delete m_pathGraph; - m_pathGraph = NULL; + m_pathGraph = nullptr; - m_appearance = NULL; + m_appearance = nullptr; #ifdef _DEBUG delete m_crossableLines; - m_crossableLines = NULL; + m_crossableLines = nullptr; delete m_uncrossableLines; - m_uncrossableLines = NULL; + m_uncrossableLines = nullptr; delete m_interiorLines; - m_interiorLines = NULL; + m_interiorLines = nullptr; delete m_portalLines; - m_portalLines = NULL; + m_portalLines = nullptr; delete m_rampLines; - m_rampLines = NULL; + m_rampLines = nullptr; delete m_fallthroughTriLines; - m_fallthroughTriLines = NULL; + m_fallthroughTriLines = nullptr; delete m_solidTriLines; - m_solidTriLines = NULL; + m_solidTriLines = nullptr; #endif } @@ -833,7 +833,7 @@ void FloorMesh::write ( Iff & iff ) // ---------- - if(m_boxTree != NULL) + if(m_boxTree != nullptr) { m_boxTree->write(iff); } @@ -1772,7 +1772,7 @@ bool FloorMesh::canEnterEdge ( FloorLocator const & enterLoc ) const { if(enterLoc.getEdgeId() == -1) return false; if(enterLoc.getTriId() == -1) return false; - if(enterLoc.getFloorMesh() == NULL) return false; + if(enterLoc.getFloorMesh() == nullptr) return false; // Can't enter the tri if it's facing down @@ -1837,7 +1837,7 @@ bool FloorMesh::canExitEdge ( FloorLocator const & exitLoc, Vector const & delta { if(exitLoc.getTriId() == -1) return false; if(exitLoc.getEdgeId() == -1) return false; - if(exitLoc.getFloorMesh() == NULL) return false; + if(exitLoc.getFloorMesh() == nullptr) return false; FloorEdgeType edgeType = exitLoc.getFloorTri().getEdgeType(exitLoc.getEdgeId()); @@ -3808,7 +3808,7 @@ void FloorMesh::drawDebugShapes ( DebugShapeRenderer * renderer, bool drawExtent #ifdef _DEBUG - if(renderer == NULL) return; + if(renderer == nullptr) return; if(ConfigSharedCollision::getDrawFloors()) { diff --git a/engine/shared/library/sharedCollision/src/shared/core/Footprint.cpp b/engine/shared/library/sharedCollision/src/shared/core/Footprint.cpp index 00bec3b3..58471e36 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/Footprint.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/Footprint.cpp @@ -92,7 +92,7 @@ static bool epsilonEqual( float value, float target, float epsilon ) Footprint::Footprint ( Vector const & position, float radius, CollisionProperty * parent, const float swimHeight ) : BaseClass(), m_parent(parent), - m_cellObject(NULL), + m_cellObject(nullptr), m_position_p(Vector::zero), m_position_w(Vector::zero), m_radius(radius), @@ -112,9 +112,9 @@ Footprint::Footprint ( Vector const & position, float radius, CollisionProperty #ifdef _DEBUG , m_backupPosition_p(position), - m_backupCell(NULL), + m_backupCell(nullptr), m_backupObjectPosition_p(position), - m_backupObjectCell(NULL), + m_backupObjectCell(nullptr), m_lineHitTime( -1.0f ), m_lineOrigin( Vector(0.0f,1.5f,0.0f) ), m_lineDelta( Vector(0.0f,0.0f,10.0f) ), @@ -137,8 +137,8 @@ Footprint::~Footprint() { detach(); - m_parent = NULL; - m_cellObject = NULL; + m_parent = nullptr; + m_cellObject = nullptr; } // ====================================================================== @@ -334,7 +334,7 @@ Object * Footprint::getOwner ( void ) void Footprint::addContact ( FloorLocator const & loc ) { - if(loc.getFloor() == NULL) + if(loc.getFloor() == nullptr) { FLOOR_LOG("Footprint::addContact - loc isn't attached to a floor\n"); } @@ -445,7 +445,7 @@ void Footprint::setSwimHeight ( float swimHeight ) Vector const & Footprint::getPosition_p ( void ) const { - if(m_cellObject.getPointer() == NULL) + if(m_cellObject.getPointer() == nullptr) { WARNING(true,("Footprint::getPosition_p - Footprint's parent cell has disappeared")); @@ -525,7 +525,7 @@ void Footprint::setPosition ( CellProperty * pNewCell, Vector const & pos ) { NAN_CHECK(pos); - if(pNewCell == NULL) pNewCell = CellProperty::getWorldCellProperty(); + if(pNewCell == nullptr) pNewCell = CellProperty::getWorldCellProperty(); m_cellObject = &(pNewCell->getOwner()); m_position_p = pos; @@ -808,13 +808,13 @@ void Footprint::runDebugTests ( void ) IGNORE_RETURN(CollisionWorld::calcBubble(getCell(),getPosition_p(),20.0f,m_bubbleSize)); */ - Object const * hitObject = NULL; + Object const * hitObject = nullptr; QueryInteractionResult result = CollisionWorld::queryInteraction(objCell, objPos + m_lineOrigin, objCell, objPos + m_lineOrigin + delta, - NULL, + nullptr, !ConfigSharedCollision::getIgnoreTerrainLos(), ConfigSharedCollision::getGenerateTerrainLos(), ConfigSharedCollision::getTerrainLOSMinDistance(), @@ -843,14 +843,14 @@ FloorLocator const * Footprint::getAnyContact ( void ) const if(contact->m_contact.isAttached()) return &contact->m_contact; } - return NULL; + return nullptr; } // ---------- FloorLocator const * Footprint::getSolidContact ( void ) const { - FloorLocator const * temp = NULL; + FloorLocator const * temp = nullptr; float maxHeight = -REAL_MAX; @@ -883,11 +883,11 @@ Object const * Footprint::getStandingOn ( void ) const { FloorLocator const * contact = getSolidContact(); - if(contact == NULL) return NULL; + if(contact == nullptr) return nullptr; Floor const * floor = contact->getFloor(); - if(floor == NULL) return NULL; + if(floor == nullptr) return nullptr; return floor->getOwner(); } @@ -921,9 +921,9 @@ bool Footprint::snapToCellFloor ( void ) bool Footprint::isAttachedTo ( Floor const * floor ) const { - if(floor == NULL) return false; + if(floor == nullptr) return false; - return getFloorList().find( floor->getFootList() ) != NULL; + return getFloorList().find( floor->getFootList() ) != nullptr; } // ---------------------------------------------------------------------- @@ -1114,7 +1114,7 @@ void Footprint::updateOffsets ( void ) bool Footprint::attachTo ( Floor const * floor, bool fromObject ) { - if(floor == NULL) return false; + if(floor == nullptr) return false; if(isAttachedTo(floor)) return false; @@ -1240,7 +1240,7 @@ int Footprint::elevatorMove ( int nFloors, Transform & outTransform ) // ---------- // Find the contact that's on the cell's floor - FloorContactShape const * cellContact = NULL; + FloorContactShape const * cellContact = nullptr; for(ConstContactIterator it(getFloorList()); it; ++it) { @@ -1261,7 +1261,7 @@ int Footprint::elevatorMove ( int nFloors, Transform & outTransform ) } } - if(cellContact == NULL) + if(cellContact == nullptr) { return 0; } @@ -1328,7 +1328,7 @@ void Footprint::drawDebugShapes ( DebugShapeRenderer * renderer ) const #ifdef _DEBUG - if(renderer == NULL) return; + if(renderer == nullptr) return; if(ConfigSharedCollision::getDrawFootprints()) { @@ -1525,7 +1525,7 @@ void Footprint::alignToGroundNoFloat ( void ) if (owner) DEBUG_WARNING(true, ("Footprint::alignToGroundNoFloat(): called on object id=[%s],template=[%s] when no ground could be found.", owner->getNetworkId().getValueString().c_str(), owner->getObjectTemplateName())); else - DEBUG_WARNING(true, ("Footprint::alignToGroundNoFloat(): called on object id=[],template=[] when no ground could be found.")); + DEBUG_WARNING(true, ("Footprint::alignToGroundNoFloat(): called on object id=[],template=[] when no ground could be found.")); } #endif } diff --git a/engine/shared/library/sharedCollision/src/shared/core/FootprintForceReattachManager.cpp b/engine/shared/library/sharedCollision/src/shared/core/FootprintForceReattachManager.cpp index d0671160..680ff016 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/FootprintForceReattachManager.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/FootprintForceReattachManager.cpp @@ -31,7 +31,7 @@ namespace FootprintForceReattachManagerNamespace DataTable const * const dt = DataTableManager::getTable(ms_datatableName, true); - if (NULL == dt) + if (nullptr == dt) WARNING(true, ("FootprintForceReattachManager unable to find [%s]", ms_datatableName)); else { diff --git a/engine/shared/library/sharedCollision/src/shared/core/MultiList.cpp b/engine/shared/library/sharedCollision/src/shared/core/MultiList.cpp index 3917cd4d..af288bad 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/MultiList.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/MultiList.cpp @@ -14,8 +14,8 @@ MultiListHandle::MultiListHandle( BaseClass * object, int color ) : m_color(color), m_object(object), - m_head(NULL), - m_tail(NULL) + m_head(nullptr), + m_tail(nullptr) { } @@ -23,9 +23,9 @@ MultiListHandle::~MultiListHandle() { IGNORE_RETURN( detach() ); - m_object = NULL; - m_head = NULL; - m_tail = NULL; + m_object = nullptr; + m_head = nullptr; + m_tail = nullptr; } // ---------------------------------------------------------------------- @@ -55,7 +55,7 @@ MultiListNode * MultiListHandle::detachHead ( void ) } else { - return NULL; + return nullptr; } } @@ -72,7 +72,7 @@ MultiListHandle * MultiListHandle::detach ( void ) bool MultiListHandle::isConnected ( void ) const { - return m_head != NULL; + return m_head != nullptr; } // ---------- @@ -97,7 +97,7 @@ void MultiListHandle::erase ( MultiListNode * node ) bool MultiListHandle::isEmpty ( void ) const { - return m_head == NULL; + return m_head == nullptr; } // ---------- @@ -109,8 +109,8 @@ void MultiListHandle::insert( MultiListNode * node, MultiListNode * prev, MultiL DEBUG_FATAL( next == node, ("MultiListHandle::insert - Next and node are the same ")); DEBUG_FATAL( (prev || next) && (prev == next), ("MultiListHandle::insert - Prev and Next are the same")); - // verify that the node to insert is not null - DEBUG_FATAL( node == NULL, ("MultiListHandle::insert - Cannot insert null node")); + // verify that the node to insert is not nullptr + DEBUG_FATAL( node == nullptr, ("MultiListHandle::insert - Cannot insert nullptr node")); // verify that the nodes we're inserting between are adjacent DEBUG_FATAL( prev && (prev->m_next[m_color] != next), ("MultiListHandle::insert - Prev and Next are not adjacent")); @@ -155,7 +155,7 @@ void MultiListHandle::connectTo( MultiListHandle & handle, BaseClass * data ) void MultiListHandle::insert( MultiListNode * node ) { - insert( node, NULL, m_head ); + insert( node, nullptr, m_head ); } // ---------- @@ -175,9 +175,9 @@ MultiListNode * MultiListHandle::detach ( MultiListNode * node ) // ---------- - node->m_next[m_color] = NULL; - node->m_prev[m_color] = NULL; - node->m_list[m_color] = NULL; + node->m_next[m_color] = nullptr; + node->m_prev[m_color] = nullptr; + node->m_list[m_color] = nullptr; } return node; @@ -221,7 +221,7 @@ MultiListNode * MultiListHandle::find ( MultiListHandle & testHandle ) cursor = cursor->m_next[m_color]; } - return NULL; + return nullptr; } //lint !e1764 // testHandle could be made const ref MultiListNode const * MultiListHandle::find ( MultiListHandle const & testHandle ) const @@ -240,7 +240,7 @@ MultiListNode const * MultiListHandle::find ( MultiListHandle const & testHandle cursor = cursor->m_next[m_color]; } - return NULL; + return nullptr; } // ---------- @@ -288,13 +288,13 @@ void MultiListHandle::destroyNodes ( void ) // ====================================================================== MultiListNode::MultiListNode() -: m_data(NULL) +: m_data(nullptr) { for(int i = 0; i < nColors; i++) { - m_next[i] = NULL; - m_prev[i] = NULL; - m_list[i] = NULL; + m_next[i] = nullptr; + m_prev[i] = nullptr; + m_list[i] = nullptr; } } @@ -303,7 +303,7 @@ MultiListNode::~MultiListNode() IGNORE_RETURN( detach() ); BaseClass * data = m_data; - m_data = NULL; + m_data = nullptr; delete data; } @@ -346,7 +346,7 @@ BaseClass * MultiListNode::getObject ( int color ) if(m_list[color]) return m_list[color]->getObject(); else - return NULL; + return nullptr; } //lint !e1762 // function could be const @@ -355,7 +355,7 @@ BaseClass const * MultiListNode::getObject ( int color ) const if(m_list[color]) return m_list[color]->getObject(); else - return NULL; + return nullptr; } // ---------- @@ -375,7 +375,7 @@ void MultiListNode::setData( BaseClass * data ) if(m_data == data) return; BaseClass * deadData = m_data; - m_data = NULL; + m_data = nullptr; delete deadData; m_data = data; } @@ -403,7 +403,7 @@ void MultiListNode::swapNext ( int color ) /* MultiList::MultiList() -: m_free(0,NULL) +: m_free(0,nullptr) { } @@ -411,7 +411,7 @@ MultiList::MultiList() bool MultiList::connect ( MultiListHandle * red, MultiListHandle * blue ) { - return connect(red,blue,NULL); + return connect(red,blue,nullptr); } // ---------- @@ -436,7 +436,7 @@ bool MultiList::connect ( MultiListHandle & red, MultiListHandle & blue, BaseCla bool MultiList::connected( MultiListHandle & red, MultiListHandle & blue ) { - return red.find(blue) != NULL; + return red.find(blue) != nullptr; } // ---------- @@ -450,7 +450,7 @@ bool MultiList::disconnect( MultiListHandle & red, MultiListHandle & blue ) MultiListNode * MultiList::getFreeNode ( void ) { - if(m_free.m_head == NULL) + if(m_free.m_head == nullptr) { return new MultiListNode(); } @@ -502,8 +502,8 @@ void MultiList::insert( MultiListHandle * node, MultiListHandle * prev, MultiLis DEBUG_FATAL( next == node, ("MultiList::insert - Next and Node are the same")); DEBUG_FATAL( prev == next, ("MultiList::insert - Prev and Next are the same")); - // verify that the node to insert is not null - DEBUG_FATAL( node == NULL, ("MultiList::insert - Cannot insert a null node")); + // verify that the node to insert is not nullptr + DEBUG_FATAL( node == nullptr, ("MultiList::insert - Cannot insert a nullptr node")); // verify that the two nodes are adjacent DEBUG_FATAL( prev && (prev->m_next != next), ("MultiList::insert - Prev and Next are not adjacent")); @@ -539,7 +539,7 @@ void MultiList::insert( MultiListHandle * node, MultiListHandle * prev, MultiLis MultiListHandle * MultiList::detach( MultiListHandle * node ) { - DEBUG_FATAL( node == NULL, ("MultiList::detach - Cannot detach null node")); + DEBUG_FATAL( node == nullptr, ("MultiList::detach - Cannot detach nullptr node")); DEBUG_FATAL( node->m_list != this, ("MultiList::detach - Node is not part of this list")); // ---------- @@ -555,9 +555,9 @@ MultiListHandle * MultiList::detach( MultiListHandle * node ) if(m_head[color] == node) m_head[color] = node->m_next; if(m_tail[color] == node) m_tail[color] = node->m_prev; - node->m_prev = NULL; - node->m_next = NULL; - node->m_list = NULL; + node->m_prev = nullptr; + node->m_next = nullptr; + node->m_list = nullptr; return node; } @@ -566,13 +566,13 @@ MultiListHandle * MultiList::detach( MultiListHandle * node ) void MultiList::insert( MultiListHandle * node ) { - DEBUG_FATAL(node == NULL, ("MultiList::insert - Cannot insert NULL node")); + DEBUG_FATAL(node == nullptr, ("MultiList::insert - Cannot insert nullptr node")); // ---------- int color = node->m_color; - insert(node,NULL,m_head[color]); + insert(node,nullptr,m_head[color]); } */ diff --git a/engine/shared/library/sharedCollision/src/shared/core/MultiList.h b/engine/shared/library/sharedCollision/src/shared/core/MultiList.h index 48c5e92d..09d7a4ec 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/MultiList.h +++ b/engine/shared/library/sharedCollision/src/shared/core/MultiList.h @@ -168,12 +168,12 @@ public: if(m_node) return safe_cast(m_node->getObject(m_valueColor)); else - return NULL; + return nullptr; } operator bool ( void ) const { - return m_node != NULL; + return m_node != nullptr; } void operator ++ ( void ) @@ -212,12 +212,12 @@ public: if(m_node) return safe_cast(m_node->getObject(m_valueColor)); else - return NULL; + return nullptr; } operator bool ( void ) const { - return m_node != NULL; + return m_node != nullptr; } void operator ++ ( void ) @@ -246,7 +246,7 @@ public: MultiListConstDataIterator( void ) { - m_node = NULL; + m_node = nullptr; m_color = -1; } @@ -281,12 +281,12 @@ public: if(m_node) return safe_cast(m_node->getData()); else - return NULL; + return nullptr; } operator bool ( void ) const { - return m_node != NULL; + return m_node != nullptr; } void operator ++ ( void ) @@ -310,7 +310,7 @@ public: MultiListDataIterator( void ) { - m_node = NULL; + m_node = nullptr; m_color = -1; } @@ -345,12 +345,12 @@ public: if(m_node) return safe_cast(m_node->getData()); else - return NULL; + return nullptr; } operator bool ( void ) const { - return m_node != NULL; + return m_node != nullptr; } void operator ++ ( void ) diff --git a/engine/shared/library/sharedCollision/src/shared/core/NeighborObject.cpp b/engine/shared/library/sharedCollision/src/shared/core/NeighborObject.cpp index a5a0f37d..006db662 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/NeighborObject.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/NeighborObject.cpp @@ -12,7 +12,7 @@ // ---------------------------------------------------------------------- NeighborObject::NeighborObject() -: m_neighbor(NULL) +: m_neighbor(nullptr) { } diff --git a/engine/shared/library/sharedCollision/src/shared/core/SimpleCollisionMesh.cpp b/engine/shared/library/sharedCollision/src/shared/core/SimpleCollisionMesh.cpp index 3fa962f9..439f6c95 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/SimpleCollisionMesh.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/SimpleCollisionMesh.cpp @@ -48,7 +48,7 @@ SimpleCollisionMesh::SimpleCollisionMesh( IndexedTriangleList * tris ) SimpleCollisionMesh::~SimpleCollisionMesh() { delete m_tris; - m_tris = NULL; + m_tris = nullptr; delete m_bucket; } @@ -178,7 +178,7 @@ void SimpleCollisionMesh::drawDebugShapes ( DebugShapeRenderer * renderer ) cons UNREF(renderer); #ifdef _DEBUG - if(renderer == NULL) return; + if(renderer == nullptr) return; if (s_renderCollisionBuckets) { diff --git a/engine/shared/library/sharedCollision/src/shared/core/SpatialDatabase.cpp b/engine/shared/library/sharedCollision/src/shared/core/SpatialDatabase.cpp index 05abd3be..f2d68e94 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/SpatialDatabase.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/SpatialDatabase.cpp @@ -115,7 +115,7 @@ public: * This functionality is used on the client to prevent a door from visually opening for * a mounted creature or a rider. The actual stop logic for movement is on the server. * - * @param callback If NULL, no check is made. If non-NULL, the callback is called + * @param callback If nullptr, no check is made. If non-nullptr, the callback is called * any time a mobile is detected to have collided with a DoorObject. * The return value of the callback dictates whether the hit() and hitBy() * logic is called on the mobile and door. If the return value of callback @@ -152,29 +152,29 @@ SpatialDatabase::SpatialDatabase() SpatialDatabase::~SpatialDatabase ( void ) { delete m_staticTree; - m_staticTree = NULL; + m_staticTree = nullptr; delete m_dynamicTree; - m_dynamicTree = NULL; + m_dynamicTree = nullptr; delete m_doorTree; - m_doorTree = NULL; + m_doorTree = nullptr; delete m_barrierTree; - m_barrierTree = NULL; + m_barrierTree = nullptr; delete m_floorTree; - m_floorTree = NULL; + m_floorTree = nullptr; delete m_ignoreStack; - m_ignoreStack = NULL; + m_ignoreStack = nullptr; } // ---------------------------------------------------------------------- bool SpatialDatabase::canCollideWithStatics ( CollisionProperty * collision ) const { - if(collision == NULL) return false; + if(collision == nullptr) return false; // On the client, remote creatures and players don't collide with statics @@ -207,10 +207,10 @@ bool SpatialDatabase::canCollideWithStatics ( CollisionProperty * collision ) co bool SpatialDatabase::canCollideWithStatic ( Object const * mobObject, Object * staticObject ) const { - // Objects can't collide with NULL + // Objects can't collide with nullptr - if(mobObject == NULL) return false; - if(staticObject == NULL) return false; + if(mobObject == nullptr) return false; + if(staticObject == nullptr) return false; // Objects can't collide with themselves @@ -223,7 +223,7 @@ bool SpatialDatabase::canCollideWithStatic ( Object const * mobObject, Object * bool SpatialDatabase::canCollideWithCreatures ( CollisionProperty const * collision ) const { - if(collision == NULL) return false; + if(collision == nullptr) return false; if(collision->isPlayerControlled() && collision->isServerSide()) { @@ -253,9 +253,9 @@ bool SpatialDatabase::canCollideWithCreature ( Object * player, Object * creatur bool SpatialDatabase::canWalkOnFloor ( CollisionProperty * collision ) const { - if(collision == NULL) return false; + if(collision == nullptr) return false; - if(collision->getFootprint() == NULL) return false; + if(collision->getFootprint() == nullptr) return false; return true; } @@ -470,12 +470,12 @@ void SpatialDatabase::updateCreatureCollision(CollisionProperty * playerCollisio bool SpatialDatabase::addObject(Query const query, Object * const object) { - if(object == NULL) + if(object == nullptr) return false; CollisionProperty * collision = object->getCollisionProperty(); - if(collision == NULL) + if(collision == nullptr) return false; if(collision->getSpatialSubdivisionHandle()) @@ -511,15 +511,15 @@ bool SpatialDatabase::addObject(Query const query, Object * const object) bool SpatialDatabase::removeObject(Query const query, Object * const object) { - if(object == NULL) + if(object == nullptr) return false; CollisionProperty * collision = object->getCollisionProperty(); - if(collision == NULL) + if(collision == nullptr) return false; - if(collision->getSpatialSubdivisionHandle() == NULL) + if(collision->getSpatialSubdivisionHandle() == nullptr) return false; switch (query) @@ -548,7 +548,7 @@ bool SpatialDatabase::removeObject(Query const query, Object * const object) break; } - collision->setSpatialSubdivisionHandle(NULL); + collision->setSpatialSubdivisionHandle(nullptr); return true; } @@ -645,7 +645,7 @@ bool SpatialDatabase::checkIgnoreObject ( Object const * object ) const bool SpatialDatabase::addFloor ( Floor * floor ) { - if(floor == NULL) return false; + if(floor == nullptr) return false; if(floor->getSpatialSubdivisionHandle()) return false; @@ -660,15 +660,15 @@ bool SpatialDatabase::addFloor ( Floor * floor ) bool SpatialDatabase::removeFloor ( Floor * floor ) { - if(floor == NULL) return false; + if(floor == nullptr) return false; - if(floor->getSpatialSubdivisionHandle() == NULL) return false; + if(floor->getSpatialSubdivisionHandle() == nullptr) return false; // ---------- m_floorTree->removeObject( floor->getSpatialSubdivisionHandle() ); - floor->setSpatialSubdivisionHandle(NULL); + floor->setSpatialSubdivisionHandle(nullptr); return true; } @@ -684,11 +684,11 @@ int SpatialDatabase::getFloorCount ( void ) const bool SpatialDatabase::moveObject ( CollisionProperty * collision ) { - if(collision == NULL) return false; + if(collision == nullptr) return false; SpatialSubdivisionHandle * handle = collision->getSpatialSubdivisionHandle(); - if(handle == NULL) return false; + if(handle == nullptr) return false; // ---------- @@ -729,7 +729,7 @@ bool SpatialDatabase::queryStatics ( AxialBox const & box, ObjectVec * outList ) bool SpatialDatabase::queryStatics ( MultiShape const & shape, ObjectVec * outList ) const { - return queryStatics( NULL, shape, outList ); + return queryStatics( nullptr, shape, outList ); } // ---------- @@ -779,21 +779,21 @@ bool SpatialDatabase::queryStatics ( Line3d const & line, ObjectVec * outList ) bool SpatialDatabase::queryStatics ( CellProperty const * cell, MultiShape const & shape, ObjectVec * outList ) const { - return queryObjects(cell,shape,outList,NULL); + return queryObjects(cell,shape,outList,nullptr); } // ---------------------------------------------------------------------- bool SpatialDatabase::queryDynamics ( Sphere const & sphere, ObjectVec * outList ) const { - return queryObjects( NULL, MultiShape(sphere), NULL, outList ); + return queryObjects( nullptr, MultiShape(sphere), nullptr, outList ); } // ---------- bool SpatialDatabase::queryDynamics ( MultiShape const & shape, ObjectVec * outList ) const { - return queryObjects( NULL, shape, NULL, outList ); + return queryObjects( nullptr, shape, nullptr, outList ); } // ---------------------------------------------------------------------- @@ -982,7 +982,7 @@ bool SpatialDatabase::queryCloseStatics ( Vector const & point_w, float maxDista float minClose; float maxClose; - CollisionProperty * dummy = NULL; + CollisionProperty * dummy = nullptr; if(m_staticTree->findClosest(point_w,maxDistance,dummy,minClose,maxClose)) { @@ -1001,7 +1001,7 @@ bool SpatialDatabase::queryCloseFloors ( Vector const & point_w, float maxDistan float minClose; float maxClose; - Floor * dummy = NULL; + Floor * dummy = nullptr; if(m_floorTree->findClosest(point_w,maxDistance,dummy,minClose,maxClose)) { @@ -1163,7 +1163,7 @@ bool SpatialDatabase::queryMaterial ( CellProperty const * cell, // TODO: why are we skipping out on the tests when the extent is a MeshExtent??? MeshExtent const * mesh = dynamic_cast(extent); - if(mesh != NULL) continue; + if(mesh != nullptr) continue; Range hitRange = extent->rangedIntersect(seg_p); @@ -1244,7 +1244,7 @@ bool SpatialDatabase::queryMaterial ( CellProperty const * cellA, CollisionProperty * collisionB = results[i]; NOT_NULL(collisionB); - if (collisionB == NULL) + if (collisionB == nullptr) continue; // ---------- diff --git a/engine/shared/library/sharedCollision/src/shared/extent/BoxExtent.cpp b/engine/shared/library/sharedCollision/src/shared/extent/BoxExtent.cpp index 3adb1a61..96ce5e4c 100755 --- a/engine/shared/library/sharedCollision/src/shared/extent/BoxExtent.cpp +++ b/engine/shared/library/sharedCollision/src/shared/extent/BoxExtent.cpp @@ -394,7 +394,7 @@ void BoxExtent::drawDebugShapes ( DebugShapeRenderer * renderer ) const #ifdef _DEBUG - if(renderer == NULL) return; + if(renderer == nullptr) return; renderer->setColor( VectorArgb::solidBlue ); renderer->drawBox(m_box); diff --git a/engine/shared/library/sharedCollision/src/shared/extent/CollisionDetect.cpp b/engine/shared/library/sharedCollision/src/shared/extent/CollisionDetect.cpp index 1602025b..6f1dce72 100755 --- a/engine/shared/library/sharedCollision/src/shared/extent/CollisionDetect.cpp +++ b/engine/shared/library/sharedCollision/src/shared/extent/CollisionDetect.cpp @@ -49,11 +49,11 @@ int CollisionDetect::getTestCounter ( void ) BaseExtent const * getCollisionExtent_p ( Object const * obj ) { - if(obj == NULL) return NULL; + if(obj == nullptr) return nullptr; CollisionProperty const * collision = obj->getCollisionProperty(); - if(!collision) return NULL; + if(!collision) return nullptr; return collision->getExtent_p(); } @@ -62,8 +62,8 @@ BaseExtent const * getCollisionExtent_p ( Object const * obj ) DetectResult CollisionDetect::testObjects ( Object const * objA, Object const * objB ) { - if(objA == NULL) return false; - if(objB == NULL) return false; + if(objA == nullptr) return false; + if(objB == nullptr) return false; // ---------- @@ -85,8 +85,8 @@ DetectResult CollisionDetect::testObjects ( Object const * objA, Object const * DetectResult CollisionDetect::testObjects ( Object const * objA, Vector const & velocity, Object const * objB ) { - if(objA == NULL) return false; - if(objB == NULL) return false; + if(objA == nullptr) return false; + if(objB == nullptr) return false; // ---------- @@ -108,8 +108,8 @@ DetectResult CollisionDetect::testObjects ( Object const * objA, Vector const & DetectResult CollisionDetect::testObjectsAsCylinders ( Object const * objA, Object const * objB ) { - if(objA == NULL) return false; - if(objB == NULL) return false; + if(objA == nullptr) return false; + if(objB == nullptr) return false; // ---------- @@ -133,7 +133,7 @@ DetectResult CollisionDetect::testObjectsAsCylinders ( Object const * objA, Obje DetectResult CollisionDetect::testObjectExtent ( Object const * objA, BaseExtent const * extentB ) { - if(objA == NULL) return false; + if(objA == nullptr) return false; CollisionProperty const * collA = objA->getCollisionProperty(); @@ -158,7 +158,7 @@ DetectResult CollisionDetect::testSphereExtent ( Sphere const & sphereA, BaseExt // don't return a DetectResult that contains a pointer to a temporary - result.extentA = NULL; + result.extentA = nullptr; return result; } @@ -175,7 +175,7 @@ DetectResult CollisionDetect::testSphereExtent ( Sphere const & sphereA, Vector // don't return a DetectResult that contains a pointer to a temporary - result.extentA = NULL; + result.extentA = nullptr; return result; } @@ -184,7 +184,7 @@ DetectResult CollisionDetect::testSphereExtent ( Sphere const & sphereA, Vector DetectResult CollisionDetect::testSphereObject ( Sphere const & sphereA, Object const * objB ) { - if(objB == NULL) return false; + if(objB == nullptr) return false; CollisionProperty const * collB = objB->getCollisionProperty(); @@ -201,7 +201,7 @@ DetectResult CollisionDetect::testSphereObject ( Sphere const & sphereA, Object DetectResult CollisionDetect::testSphereObject ( Sphere const & sphereA, Vector const & velocity, Object const * objB ) { - if(objB == NULL) return false; + if(objB == nullptr) return false; CollisionProperty const * collB = objB->getCollisionProperty(); @@ -332,8 +332,8 @@ DetectResult CollisionDetect::testCapsuleObjectAgainstAllTypes(Capsule const & c DetectResult CollisionDetect::testExtents ( BaseExtent const * extentA, BaseExtent const * extentB ) { - if(extentA == NULL) return false; - if(extentB == NULL) return false; + if(extentA == nullptr) return false; + if(extentB == nullptr) return false; ExtentType typeA = extentA->getType(); ExtentType typeB = extentB->getType(); @@ -352,8 +352,8 @@ DetectResult CollisionDetect::testExtents ( BaseExtent const * extentA, BaseExte DetectResult CollisionDetect::testExtents ( BaseExtent const * extentA, Vector const & velocity, BaseExtent const * extentB ) { - if(extentA == NULL) return false; - if(extentB == NULL) return false; + if(extentA == nullptr) return false; + if(extentB == nullptr) return false; ExtentType typeA = extentA->getType(); ExtentType typeB = extentB->getType(); @@ -372,8 +372,8 @@ DetectResult CollisionDetect::testExtents ( BaseExtent const * extentA, Vector c DetectResult CollisionDetect::testExtentsAsCylinders ( BaseExtent const * extentA, BaseExtent const * extentB ) { - if(extentA == NULL) return false; - if(extentB == NULL) return false; + if(extentA == nullptr) return false; + if(extentB == nullptr) return false; SimpleExtent const * simpleExtentA = safe_cast(extentA); SimpleExtent const * simpleExtentB = safe_cast(extentB); diff --git a/engine/shared/library/sharedCollision/src/shared/extent/CollisionDetect.h b/engine/shared/library/sharedCollision/src/shared/extent/CollisionDetect.h index 8bc78848..0974a602 100755 --- a/engine/shared/library/sharedCollision/src/shared/extent/CollisionDetect.h +++ b/engine/shared/library/sharedCollision/src/shared/extent/CollisionDetect.h @@ -25,16 +25,16 @@ public: DetectResult() : collided(false), collisionTime(Range::empty), - extentA(NULL), - extentB(NULL) + extentA(nullptr), + extentB(nullptr) { } DetectResult ( bool result ) : collided(result), collisionTime( result ? Range::inf : Range::empty ), - extentA(NULL), - extentB(NULL) + extentA(nullptr), + extentB(nullptr) { } diff --git a/engine/shared/library/sharedCollision/src/shared/extent/CompositeExtent.cpp b/engine/shared/library/sharedCollision/src/shared/extent/CompositeExtent.cpp index d7a6d91a..e005e711 100755 --- a/engine/shared/library/sharedCollision/src/shared/extent/CompositeExtent.cpp +++ b/engine/shared/library/sharedCollision/src/shared/extent/CompositeExtent.cpp @@ -31,11 +31,11 @@ CompositeExtent::~CompositeExtent() { delete m_extents->at(i); - m_extents->at(i) = NULL; + m_extents->at(i) = nullptr; } delete m_extents; - m_extents = NULL; + m_extents = nullptr; } @@ -116,7 +116,7 @@ void CompositeExtent::drawDebugShapes ( DebugShapeRenderer * renderer ) const #ifdef _DEBUG - if(renderer == NULL) return; + if(renderer == nullptr) return; for(int i = 0; i < getExtentCount(); i++) { diff --git a/engine/shared/library/sharedCollision/src/shared/extent/CylinderExtent.cpp b/engine/shared/library/sharedCollision/src/shared/extent/CylinderExtent.cpp index 04d069c9..26cf80c5 100755 --- a/engine/shared/library/sharedCollision/src/shared/extent/CylinderExtent.cpp +++ b/engine/shared/library/sharedCollision/src/shared/extent/CylinderExtent.cpp @@ -146,7 +146,7 @@ void CylinderExtent::drawDebugShapes ( DebugShapeRenderer * renderer ) const #ifdef _DEBUG - if(renderer == NULL) return; + if(renderer == nullptr) return; renderer->setColor( VectorArgb::solidGreen ); renderer->drawCylinder(m_cylinder); diff --git a/engine/shared/library/sharedCollision/src/shared/extent/DetailExtent.cpp b/engine/shared/library/sharedCollision/src/shared/extent/DetailExtent.cpp index 8ceea23a..1648d2c2 100755 --- a/engine/shared/library/sharedCollision/src/shared/extent/DetailExtent.cpp +++ b/engine/shared/library/sharedCollision/src/shared/extent/DetailExtent.cpp @@ -232,11 +232,11 @@ void DetailExtent::updateBounds ( void ) int countExtents ( BaseExtent const * extent ) { - if(extent == NULL) return 0; + if(extent == nullptr) return 0; CompositeExtent const * composite = dynamic_cast(extent); - if(composite == NULL) return 1; + if(composite == nullptr) return 1; int accum = 0; diff --git a/engine/shared/library/sharedCollision/src/shared/extent/Extent.cpp b/engine/shared/library/sharedCollision/src/shared/extent/Extent.cpp index 24768bf9..248e54f1 100755 --- a/engine/shared/library/sharedCollision/src/shared/extent/Extent.cpp +++ b/engine/shared/library/sharedCollision/src/shared/extent/Extent.cpp @@ -369,7 +369,7 @@ void Extent::drawDebugShapes ( DebugShapeRenderer * renderer ) const #ifdef _DEBUG - if(renderer == NULL) return; + if(renderer == nullptr) return; renderer->setColor( VectorArgb::solidYellow ); renderer->drawSphere(m_sphere); diff --git a/engine/shared/library/sharedCollision/src/shared/extent/ExtentList.cpp b/engine/shared/library/sharedCollision/src/shared/extent/ExtentList.cpp index e77715a1..954aac1a 100755 --- a/engine/shared/library/sharedCollision/src/shared/extent/ExtentList.cpp +++ b/engine/shared/library/sharedCollision/src/shared/extent/ExtentList.cpp @@ -44,7 +44,7 @@ Extent * ExtentList::nullFactory ( Iff & iff ) IGNORE_RETURN( iff.goForward() ); - return NULL; + return nullptr; } // ====================================================================== @@ -110,7 +110,7 @@ void ExtentList::remove(void) void ExtentList::assignBinding(Tag tag, CreateFunction createFunction) { - DEBUG_FATAL(!createFunction, ("createFunction may not be NULL")); + DEBUG_FATAL(!createFunction, ("createFunction may not be nullptr")); (*ms_bindImpl.m_map) [tag] = createFunction; } @@ -133,7 +133,7 @@ void ExtentList::removeBinding(Tag tag) /** * Fetch an Extent. * - * This routine may be passed NULL. + * This routine may be passed nullptr. * * This routine will increase the reference count of the specified extent. * @@ -165,7 +165,7 @@ Extent * ExtentList::create(Iff & iff) // handle no extents if (iff.atEndOfForm()) - return NULL; + return nullptr; const Tag tag = iff.getCurrentName(); @@ -201,7 +201,7 @@ const Extent *ExtentList::fetch(Iff & iff) /** * Release an Extent. * - * This routine may be passed NULL. + * This routine may be passed nullptr. * * This routine will decrement the reference count of the Extent. When * the reference count becomes 0, the Extent will be deleted. diff --git a/engine/shared/library/sharedCollision/src/shared/extent/MeshExtent.cpp b/engine/shared/library/sharedCollision/src/shared/extent/MeshExtent.cpp index 2384b251..c32e7857 100755 --- a/engine/shared/library/sharedCollision/src/shared/extent/MeshExtent.cpp +++ b/engine/shared/library/sharedCollision/src/shared/extent/MeshExtent.cpp @@ -62,15 +62,15 @@ SimpleCollisionMesh * MeshExtent::createMesh( IndexedTriangleList * tris ) MeshExtent::MeshExtent() : Extent(ET_Mesh), - m_mesh(NULL), + m_mesh(nullptr), m_box() { - m_mesh = createMesh(NULL); + m_mesh = createMesh(nullptr); } MeshExtent::MeshExtent( IndexedTriangleList * tris ) : Extent(ET_Mesh), - m_mesh(NULL), + m_mesh(nullptr), m_box() { m_mesh = createMesh(tris); @@ -86,7 +86,7 @@ MeshExtent::MeshExtent( SimpleCollisionMesh * mesh ) MeshExtent::~MeshExtent() { delete m_mesh; - m_mesh = NULL; + m_mesh = nullptr; } // ---------------------------------------------------------------------- @@ -168,7 +168,7 @@ void MeshExtent::drawDebugShapes ( DebugShapeRenderer * renderer ) const #ifdef _DEBUG - if(renderer == NULL) return; + if(renderer == nullptr) return; renderer->setColor( VectorArgb::solidWhite ); m_mesh->drawDebugShapes(renderer); diff --git a/engine/shared/library/sharedCollision/src/shared/extent/OrientedCylinderExtent.cpp b/engine/shared/library/sharedCollision/src/shared/extent/OrientedCylinderExtent.cpp index 234db209..113784a6 100755 --- a/engine/shared/library/sharedCollision/src/shared/extent/OrientedCylinderExtent.cpp +++ b/engine/shared/library/sharedCollision/src/shared/extent/OrientedCylinderExtent.cpp @@ -106,7 +106,7 @@ void OrientedCylinderExtent::drawDebugShapes ( DebugShapeRenderer * renderer ) c #ifdef _DEBUG - if(renderer == NULL) return; + if(renderer == nullptr) return; renderer->setColor( VectorArgb::solidGreen ); renderer->draw(m_cylinder); diff --git a/engine/shared/library/sharedCollision/src/shared/extent/SimpleExtent.cpp b/engine/shared/library/sharedCollision/src/shared/extent/SimpleExtent.cpp index 5e744c37..bc8a27e6 100755 --- a/engine/shared/library/sharedCollision/src/shared/extent/SimpleExtent.cpp +++ b/engine/shared/library/sharedCollision/src/shared/extent/SimpleExtent.cpp @@ -146,7 +146,7 @@ void SimpleExtent::drawDebugShapes ( DebugShapeRenderer * renderer ) const #ifdef _DEBUG - if(renderer == NULL) return; + if(renderer == nullptr) return; switch( getShape().getShapeType() ) { diff --git a/engine/shared/library/sharedCompression/src/shared/BitStream.cpp b/engine/shared/library/sharedCompression/src/shared/BitStream.cpp index 7cc5876c..54d2a244 100755 --- a/engine/shared/library/sharedCompression/src/shared/BitStream.cpp +++ b/engine/shared/library/sharedCompression/src/shared/BitStream.cpp @@ -48,8 +48,8 @@ BitBuffer::BitBuffer(void *buffer, int size, bool inputStream) current(base), bufSize(size) { - DEBUG_FATAL(!buffer, ("buffer null")); - DEBUG_FATAL(!current, ("buffer null")); + DEBUG_FATAL(!buffer, ("buffer nullptr")); + DEBUG_FATAL(!current, ("buffer nullptr")); } // ---------------------------------------------------------------------- @@ -59,8 +59,8 @@ BitBuffer::BitBuffer(void *buffer, int size, bool inputStream) BitBuffer::~BitBuffer(void) { - base = NULL; - current = NULL; + base = nullptr; + current = nullptr; } // ---------------------------------------------------------------------- @@ -181,17 +181,17 @@ BitFile::BitFile(const char *fileName, bool inputStream) { if (isInput) { - hFile = CreateFile(fileName, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + hFile = CreateFile(fileName, GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); } else { // try to truncate it first - hFile = CreateFile(fileName, GENERIC_READ | GENERIC_WRITE, 0, NULL, TRUNCATE_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + hFile = CreateFile(fileName, GENERIC_READ | GENERIC_WRITE, 0, nullptr, TRUNCATE_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); if (hFile == INVALID_HANDLE_VALUE) { //if that fails, create it - hFile = CreateFile(fileName, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + hFile = CreateFile(fileName, GENERIC_READ | GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); } } @@ -215,7 +215,7 @@ BitFile::~BitFile(void) } } - hFile = NULL; + hFile = nullptr; delete [] name; } @@ -224,7 +224,7 @@ BitFile::~BitFile(void) int BitFile::getOffset(void) const { - return static_cast(SetFilePointer(hFile, 0, NULL, FILE_CURRENT)); + return static_cast(SetFilePointer(hFile, 0, nullptr, FILE_CURRENT)); } // ---------------------------------------------------------------------- @@ -254,7 +254,7 @@ void BitFile::outputBits(uint32 code, uint32 count) if (!mask) { uint32 bytesWritten; - if (!WriteFile(hFile, &rack, sizeof(rack), &bytesWritten, NULL)) + if (!WriteFile(hFile, &rack, sizeof(rack), &bytesWritten, nullptr)) { DEBUG_FATAL(true,("BitFile::outputBits error %d.", GetLastError())); } @@ -280,7 +280,7 @@ void BitFile::outputRack(void) if (mask != INITIAL_MASK_VALUE) { - if (!WriteFile(hFile, &rack, sizeof(rack), &bytesWritten, NULL)) + if (!WriteFile(hFile, &rack, sizeof(rack), &bytesWritten, nullptr)) { DEBUG_FATAL(true,("BitFile::outputRack writing error %d.", GetLastError())); } @@ -312,7 +312,7 @@ uint32 BitFile::inputBits(uint32 count) { uint32 bytesRead; - const BOOL result = ReadFile(hFile, &rack, sizeof(rack), &bytesRead, NULL); + const BOOL result = ReadFile(hFile, &rack, sizeof(rack), &bytesRead, nullptr); UNREF(result); DEBUG_FATAL(result && !bytesRead,("BitFile::inputBits hit EOF")); @@ -383,8 +383,8 @@ ByteBuffer::ByteBuffer(void *buffer, int size, bool inputStream) ByteBuffer::~ByteBuffer(void) { - base = NULL; - current = NULL; + base = nullptr; + current = nullptr; } // ---------------------------------------------------------------------- @@ -422,7 +422,7 @@ void ByteBuffer::output(byte b) bool ByteBuffer::input(byte *b) { - DEBUG_FATAL(!b, ("null pointer")); + DEBUG_FATAL(!b, ("nullptr pointer")); DEBUG_FATAL(!isInput,("ByteBuffer::input called on output stream")); if ((current - base) >= bufSize) @@ -446,15 +446,15 @@ ByteFile::ByteFile(const char *fileName, bool inputStream) { if (isInput) { - hFile = CreateFile(fileName, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + hFile = CreateFile(fileName, GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); } else { - hFile = CreateFile(fileName, GENERIC_READ | GENERIC_WRITE, 0, NULL, TRUNCATE_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + hFile = CreateFile(fileName, GENERIC_READ | GENERIC_WRITE, 0, nullptr, TRUNCATE_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); if (hFile == INVALID_HANDLE_VALUE) { - hFile = CreateFile(fileName, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + hFile = CreateFile(fileName, GENERIC_READ | GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); } } @@ -473,7 +473,7 @@ ByteFile::~ByteFile(void) if (hFile != INVALID_HANDLE_VALUE && !CloseHandle(hFile)) DEBUG_FATAL(true,("ByteFile::~ByteFile - Unable to close HANDLE for file %s - Error %d", name, GetLastError())); - hFile = NULL; + hFile = nullptr; delete [] name; } @@ -482,7 +482,7 @@ ByteFile::~ByteFile(void) int ByteFile::getOffset(void) const { - return static_cast(SetFilePointer(hFile, 0, NULL, FILE_CURRENT)); + return static_cast(SetFilePointer(hFile, 0, nullptr, FILE_CURRENT)); } // ---------------------------------------------------------------------- @@ -497,7 +497,7 @@ void ByteFile::output(byte b) byte out = b; uint32 bytesWritten; - if (!WriteFile(hFile, &out, sizeof(byte), &bytesWritten, NULL)) + if (!WriteFile(hFile, &out, sizeof(byte), &bytesWritten, nullptr)) { DEBUG_FATAL(true,("ByteFile::output error %d.", GetLastError())); } @@ -518,7 +518,7 @@ bool ByteFile::input(byte *b) DEBUG_FATAL(!isInput,("ByteFile::input called on output stream.")); uint32 bytesRead; - BOOL result = ReadFile(hFile, b, sizeof(byte), &bytesRead, NULL); + BOOL result = ReadFile(hFile, b, sizeof(byte), &bytesRead, nullptr); // check for EOS return (result && !bytesRead); diff --git a/engine/shared/library/sharedCompression/src/shared/Lz77.cpp b/engine/shared/library/sharedCompression/src/shared/Lz77.cpp index cb18232f..1f630cb8 100755 --- a/engine/shared/library/sharedCompression/src/shared/Lz77.cpp +++ b/engine/shared/library/sharedCompression/src/shared/Lz77.cpp @@ -47,7 +47,7 @@ Lz77::Lz77(uint32 _indexBitCount, uint32 _lengthBitCount) lookAheadSize(rawLookAheadSize + breakEven), treeRoot(windowSize), window(new byte[windowSize]), - tree(NULL) + tree(nullptr) { } @@ -232,10 +232,10 @@ uint32 Lz77::findNextNode(uint32 node) * Delete a string from the tree. * * This routine performs the classic binary tree deletion algorithm. - * If the node to be deleted has a null link in either direction, we - * just pull the non-null link up one to replace the existing link. + * If the node to be deleted has a nullptr link in either direction, we + * just pull the non-nullptr link up one to replace the existing link. * If both links exist, we instead delete the next link in order, which - * is guaranteed to have a null link, then replace the node to be deleted + * is guaranteed to have a nullptr link, then replace the node to be deleted * with the next link. */ @@ -286,7 +286,7 @@ uint32 Lz77::addString(uint32 newNode, uint32 *matchPosition) uint32 *child; int delta = 0; - DEBUG_FATAL(!matchPosition, ("matchPosition is NULL")); + DEBUG_FATAL(!matchPosition, ("matchPosition is nullptr")); if (newNode == endOfStream) return 0; diff --git a/engine/shared/library/sharedCompression/src/shared/ZlibCompressor.cpp b/engine/shared/library/sharedCompression/src/shared/ZlibCompressor.cpp index aedbda00..7f3aed3d 100755 --- a/engine/shared/library/sharedCompression/src/shared/ZlibCompressor.cpp +++ b/engine/shared/library/sharedCompression/src/shared/ZlibCompressor.cpp @@ -121,8 +121,8 @@ void ZlibCompressorNamespace::remove() DEBUG_FATAL(static_cast(ms_memoryPool.size()) != ms_poolElementCount, ("ZLibCompressor memory pool entries not all released")); operator delete(ms_memoryBottom); - ms_memoryBottom = NULL; - ms_memoryTop = NULL; + ms_memoryBottom = nullptr; + ms_memoryTop = nullptr; ms_memoryPool.clear(); ms_mutex.leave(); @@ -155,12 +155,12 @@ int ZlibCompressor::compress(const void *inputBuffer, int inputSize, void *outpu z.avail_out = outputSize; z.total_out = 0; - z.msg = NULL; - z.state = NULL; + z.msg = nullptr; + z.state = nullptr; z.zalloc = allocateWrapper; z.zfree = freeWrapper; - z.opaque = NULL; + z.opaque = nullptr; z.data_type = Z_BINARY; z.adler = 0; @@ -196,12 +196,12 @@ int ZlibCompressor::expand(const void *inputBuffer, int inputSize, void *outputB z.avail_out = outputSize; z.total_out = 0; - z.msg = NULL; - z.state = NULL; + z.msg = nullptr; + z.state = nullptr; z.zalloc = allocateWrapper; z.zfree = freeWrapper; - z.opaque = NULL; + z.opaque = nullptr; z.data_type = Z_BINARY; z.adler = 0; diff --git a/engine/shared/library/sharedDatabaseInterface/src/shared/core/Bindable.h b/engine/shared/library/sharedDatabaseInterface/src/shared/core/Bindable.h index 22617057..03c2d7dc 100755 --- a/engine/shared/library/sharedDatabaseInterface/src/shared/core/Bindable.h +++ b/engine/shared/library/sharedDatabaseInterface/src/shared/core/Bindable.h @@ -1,13 +1,13 @@ /* Bindable.h * * Defines classes based on built-in simple types that know how to bind themselves to - * database queries and support null values. + * database queries and support nullptr values. * * Each class supports the following functions: - * bool isNull -- test whether the value is null - * void setToNull -- set the value to null - * getValue -- return the value (make sure you test for null before calling this. The results - * are undefined if the Bindable is null.) + * bool isNull -- test whether the value is nullptr + * void setToNull -- set the value to nullptr + * getValue -- return the value (make sure you test for nullptr before calling this. The results + * are undefined if the Bindable is nullptr.) * setValue -- set the value * * ODBC version diff --git a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableBase.h b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableBase.h index 51008166..2aa7e5b8 100755 --- a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableBase.h +++ b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableBase.h @@ -31,7 +31,7 @@ namespace DB { explicit Bindable(int _indicator); /** - * The size of the data, or -1 for NULL. + * The size of the data, or -1 for nullptr. */ int indicator; }; diff --git a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableBool.h b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableBool.h index 36929d60..044371fe 100755 --- a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableBool.h +++ b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableBool.h @@ -18,7 +18,7 @@ namespace DB { /** Represents a bool in C++, bound to a CHAR(1) column. The column can have the values 'Y' or 'N'. - * TODO: use a boolean type in the database, if we can find one that allows NULL's and is fairly + * TODO: use a boolean type in the database, if we can find one that allows nullptr's and is fairly * portable. (May not exist -- according to the docs, Oracle does not have a boolean datatype.) */ class BindableBool : public Bindable diff --git a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableString.h b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableString.h index 103b2ada..2548990e 100755 --- a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableString.h +++ b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableString.h @@ -133,11 +133,11 @@ namespace DB std::string getValueASCII() const; /** Allocate a new string and copy the buffer to it. The caller takes responsibility - for delete[]ing it later. (If the string is NULL, this returns a null pointer.) + for delete[]ing it later. (If the string is nullptr, this returns a nullptr pointer.) */ char *makeCopyOfValue() const; -/** Set the value of the bindable string from another (null-terminated) string +/** Set the value of the bindable string from another (nullptr-terminated) string If the source buffer is too big, it FATAL's. Another alternative would be to have it truncate the string. Right now, it's better to FATAL to avoid hard-to-find bugs @@ -168,7 +168,7 @@ namespace DB private: - char m_value[S+1]; // column of size S, plus one byte for a trailing null + char m_value[S+1]; // column of size S, plus one byte for a trailing nullptr }; // ====================================================================== @@ -206,7 +206,7 @@ namespace DB { if (isNull()) { - return strncpy(buffer,"\0",1); // in the database, a zero-length string and a NULL aren't really + return strncpy(buffer,"\0",1); // in the database, a zero-length string and a nullptr aren't really // the same thing, but this is the closest we can do here. } return strncpy(buffer,m_value,(bufsize>(S+1))?(S+1):bufsize); @@ -259,7 +259,7 @@ namespace DB } FATAL((i==S+1) && (m_value[S]!='\0'),("Attempt to save string \"%s\" to the database. It is too long for the column.",buffer)); indicator=i; // set indicator to actual length of string -// m_value[S]='\0'; // guarantee null terminator -- uncomment if you remove the above FATAL +// m_value[S]='\0'; // guarantee nullptr terminator -- uncomment if you remove the above FATAL } template diff --git a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableUnicode.h b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableUnicode.h index 9c85e6d4..544ead4c 100755 --- a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableUnicode.h +++ b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableUnicode.h @@ -143,7 +143,7 @@ namespace DB private: - char m_value[S+1]; // column of size S, plus one byte for a trailing null + char m_value[S+1]; // column of size S, plus one byte for a trailing nullptr }; // ====================================================================== diff --git a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBufferRow.h b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBufferRow.h index 0d1b70d0..550f2896 100755 --- a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBufferRow.h +++ b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBufferRow.h @@ -33,9 +33,9 @@ namespace DB * Combines the values in this row with the values in newRow. * * For each column: - * If the column is null in newRow, do nothing. (Leave the value + * If the column is nullptr in newRow, do nothing. (Leave the value * in this row unchanged.) - * If the column is not null in newRow, replace the value in this + * If the column is not nullptr in newRow, replace the value in this * row with the value in newRow. */ virtual void combine(const DB::Row &newRow) =0; diff --git a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbServer.cpp b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbServer.cpp index 13f7460e..83015b31 100755 --- a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbServer.cpp +++ b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbServer.cpp @@ -29,7 +29,7 @@ using namespace DB; Mutex Server::ms_profileMutex; bool Server::ms_enableProfiling = false; bool Server::ms_enableVerboseMode = false; -DB::Profiler *Server::ms_profiler = NULL; +DB::Profiler *Server::ms_profiler = nullptr; int Server::ms_reconnectTime=0; int Server::ms_maxErrorCountBeforeDisconnect=5; int Server::ms_maxErrorCountBeforeBailout=10; @@ -51,7 +51,7 @@ Server::SesListElem::SesListElem (Session *_ses, SesListElem *_next) : ses (_ses // ---------------------------------------------------------------------- Server::Server(const char *_dsn, const char *_uid, const char *_pwd, bool useMemoryManager) : - sessionList (NULL), + sessionList (nullptr), sessionListLock(), m_useMemoryManager(useMemoryManager) { @@ -194,7 +194,7 @@ Session *Server::popSession() else { sessionListLock.leave(); - return NULL; + return nullptr; } } @@ -294,7 +294,7 @@ void Server::endProfiling() { ms_profileMutex.enter(); delete ms_profiler; - ms_profiler = NULL; + ms_profiler = nullptr; ms_enableProfiling = false; ms_profileMutex.leave(); } diff --git a/engine/shared/library/sharedDatabaseInterface/src/shared/core/NullEncodedStandardString.h b/engine/shared/library/sharedDatabaseInterface/src/shared/core/NullEncodedStandardString.h index ff154c7c..57a4395e 100755 --- a/engine/shared/library/sharedDatabaseInterface/src/shared/core/NullEncodedStandardString.h +++ b/engine/shared/library/sharedDatabaseInterface/src/shared/core/NullEncodedStandardString.h @@ -15,7 +15,7 @@ // ====================================================================== /** - * A unicode-string-compatible class that encodes a null value as a single space + * A unicode-string-compatible class that encodes a nullptr value as a single space */ class NullEncodedStandardString { diff --git a/engine/shared/library/sharedDatabaseInterface/src/shared/core/NullEncodedUnicodeString.h b/engine/shared/library/sharedDatabaseInterface/src/shared/core/NullEncodedUnicodeString.h index b28de588..45a2c521 100755 --- a/engine/shared/library/sharedDatabaseInterface/src/shared/core/NullEncodedUnicodeString.h +++ b/engine/shared/library/sharedDatabaseInterface/src/shared/core/NullEncodedUnicodeString.h @@ -15,7 +15,7 @@ // ====================================================================== /** - * A unicode-string-compatible class that encodes a null value as a single space + * A unicode-string-compatible class that encodes a nullptr value as a single space */ class NullEncodedUnicodeString { diff --git a/engine/shared/library/sharedDatabaseInterface/src_oci/DbBindableVarray.cpp b/engine/shared/library/sharedDatabaseInterface/src_oci/DbBindableVarray.cpp index 7fff3387..b0cec73d 100755 --- a/engine/shared/library/sharedDatabaseInterface/src_oci/DbBindableVarray.cpp +++ b/engine/shared/library/sharedDatabaseInterface/src_oci/DbBindableVarray.cpp @@ -22,9 +22,9 @@ using namespace DB; BindableVarray::BindableVarray() : m_initialized(false), - m_tdo (NULL), - m_data (NULL), - m_session (NULL) + m_tdo (nullptr), + m_data (nullptr), + m_session (nullptr) { } @@ -52,7 +52,7 @@ bool BindableVarray::create(DB::Session *session, const std::string &name, const schema.length(), reinterpret_cast(const_cast(name.c_str())), name.length(), - NULL, + nullptr, 0, OCI_DURATION_SESSION, OCI_TYPEGET_HEADER, @@ -64,7 +64,7 @@ bool BindableVarray::create(DB::Session *session, const std::string &name, const localSession->errhp, localSession->svchp, OCI_TYPECODE_VARRAY, - m_tdo, NULL, + m_tdo, nullptr, OCI_DURATION_DEFAULT, true, reinterpret_cast(&m_data))))) @@ -86,9 +86,9 @@ void BindableVarray::free() OCIObjectFree (localSession->envhp, localSession->errhp, m_data, 0))); m_initialized = false; - m_tdo=NULL; - m_data=NULL; - m_session=NULL; + m_tdo=nullptr; + m_data=nullptr; + m_session=nullptr; } // ---------------------------------------------------------------------- @@ -354,7 +354,7 @@ std::string BindableVarrayNumber::outputValue() const if (exists) { if (*indicator == OCI_IND_NULL) - result += "NULL"; + result += "nullptr"; else { double value; @@ -400,7 +400,7 @@ bool BindableVarrayString::push_back(const Unicode::String &value) bool BindableVarrayString::push_back(const std::string &value) { - OCIString *buffer = NULL; + OCIString *buffer = nullptr; OCIInd buffer_indicator (OCI_IND_NOTNULL); OCISession *localSession = safe_cast(m_session); @@ -437,7 +437,7 @@ bool BindableVarrayString::push_back(bool bvalue) else value = "N"; - OCIString *buffer = NULL; + OCIString *buffer = nullptr; OCIInd buffer_indicator (OCI_IND_NOTNULL); OCISession *localSession = safe_cast(m_session); @@ -469,7 +469,7 @@ bool BindableVarrayString::push_back(bool IsNULL, const Unicode::String &value) bool BindableVarrayString::push_back(bool IsNULL, const std::string &value) { - OCIString *buffer = NULL; + OCIString *buffer = nullptr; OCIInd buffer_indicator; if ( IsNULL ) { @@ -515,7 +515,7 @@ bool BindableVarrayString::push_back(bool IsNULL, bool bvalue) else value = "N"; - OCIString *buffer = NULL; + OCIString *buffer = nullptr; OCIInd buffer_indicator; if ( IsNULL ) { @@ -568,14 +568,14 @@ std::string BindableVarrayString::outputValue() const if (exists) { if (*indicator == OCI_IND_NULL) - result += "NULL"; + result += "nullptr"; else { OraText * text = OCIStringPtr(localSession->envhp, *element); if (text) result += '"' + std::string(reinterpret_cast(text)) + '"'; else - result += "NULL"; + result += "nullptr"; } } else diff --git a/engine/shared/library/sharedDatabaseInterface/src_oci/OciQueryImplementation.cpp b/engine/shared/library/sharedDatabaseInterface/src_oci/OciQueryImplementation.cpp index ab311290..b4486dc8 100755 --- a/engine/shared/library/sharedDatabaseInterface/src_oci/OciQueryImplementation.cpp +++ b/engine/shared/library/sharedDatabaseInterface/src_oci/OciQueryImplementation.cpp @@ -49,13 +49,13 @@ bool DB::OCIQueryImpl::setup(Session *session) { // setSession(session); - DEBUG_FATAL(m_session!=0,("m_session was not NULL")); - DEBUG_FATAL(m_server!=0,("m_server was not NULL")); + DEBUG_FATAL(m_session!=0,("m_session was not nullptr")); + DEBUG_FATAL(m_server!=0,("m_server was not nullptr")); DEBUG_FATAL(m_stmthp!=0,("m_stmthp was not 0")); DEBUG_FATAL(m_cursorhp!=0,("m_cursorhp was not 0")); m_session=dynamic_cast(session); - FATAL((m_session==0),("Must pass a non-NULL OCISession to setup().")); + FATAL((m_session==0),("Must pass a non-nullptr OCISession to setup().")); m_server=m_session->m_server; NOT_NULL(m_server); @@ -180,7 +180,7 @@ bool DB::OCIQueryImpl::exec() m_session->setOkToFetch(); m_session->setLastQueryStatement(m_sql); sword status=OCIStmtExecute(m_session->svchp, m_stmthp, m_session->errhp, 1, 0, - NULL, NULL, OCI_DEFAULT); + nullptr, nullptr, OCI_DEFAULT); if (status == OCI_NO_DATA) { @@ -393,8 +393,8 @@ DB::OCIQueryImpl::BindRec::BindRec(size_t numElements) : length(0), stringAdjust(false), m_numElements(numElements), - m_indicatorArray(NULL), - m_lengthArray(NULL) + m_indicatorArray(nullptr), + m_lengthArray(nullptr) { // This is ugly, but it avoids having to create two different kinds of bindrecs that inherit from an abstract base class if (m_numElements > 1) @@ -714,11 +714,11 @@ bool DB::OCIQueryImpl::bindParameter(BindableVarray &buffer) &(br->bindp), m_session->errhp, nextParameter++, - NULL, + nullptr, 0, SQLT_NTY, - NULL, - NULL, + nullptr, + nullptr, 0, 0, 0, diff --git a/engine/shared/library/sharedDatabaseInterface/src_oci/OciServer.cpp b/engine/shared/library/sharedDatabaseInterface/src_oci/OciServer.cpp index ead0cb9c..7c40e0ae 100755 --- a/engine/shared/library/sharedDatabaseInterface/src_oci/OciServer.cpp +++ b/engine/shared/library/sharedDatabaseInterface/src_oci/OciServer.cpp @@ -63,7 +63,7 @@ bool DB::OCIServer::checkerr(OCISession const & session, int status) text errbuf[512]; sb4 errcode = 0; - OCIErrorGet((dvoid *)(session.errhp), (ub4) 1, (text *) NULL, &errcode, + OCIErrorGet((dvoid *)(session.errhp), (ub4) 1, (text *) nullptr, &errcode, errbuf, (ub4) sizeof(errbuf), OCI_HTYPE_ERROR); WARNING(true,("Database error: %.*s",512,errbuf)); diff --git a/engine/shared/library/sharedDatabaseInterface/src_oci/OciSession.cpp b/engine/shared/library/sharedDatabaseInterface/src_oci/OciSession.cpp index 124998bc..e7e7bc66 100755 --- a/engine/shared/library/sharedDatabaseInterface/src_oci/OciSession.cpp +++ b/engine/shared/library/sharedDatabaseInterface/src_oci/OciSession.cpp @@ -56,11 +56,11 @@ static void freeHook(dvoid *, dvoid *memptr) DB::OCISession::OCISession(DB::OCIServer *server) : m_server(server), - envhp(NULL), - errhp(NULL), - srvhp(NULL), - sesp(NULL), - svchp(NULL), + envhp(nullptr), + errhp(nullptr), + srvhp(nullptr), + sesp(nullptr), + svchp(nullptr), autoCommitMode(true), m_resetTime(server->getReconnectTime()==0 ? 0 : time(0) + server->getReconnectTime()), m_okToFetch(true) @@ -235,11 +235,11 @@ bool DB::OCISession::disconnect() success = false; } - svchp = NULL; - sesp = NULL; - srvhp = NULL; - errhp = NULL; - envhp = NULL; + svchp = nullptr; + sesp = nullptr; + srvhp = nullptr; + errhp = nullptr; + envhp = nullptr; connectLock.leave(); return success; diff --git a/engine/shared/library/sharedDebug/src/linux/DebugMonitor.cpp b/engine/shared/library/sharedDebug/src/linux/DebugMonitor.cpp index 3dff8883..95dfef41 100755 --- a/engine/shared/library/sharedDebug/src/linux/DebugMonitor.cpp +++ b/engine/shared/library/sharedDebug/src/linux/DebugMonitor.cpp @@ -160,7 +160,7 @@ void DebugMonitor::install(void) // handle input from the output terminal, particularly to // handle profiler modifications when the output window // is active. - s_outputScreen = newterm(NULL, s_ttyOutputFile, stdin); + s_outputScreen = newterm(nullptr, s_ttyOutputFile, stdin); if (!s_outputScreen) { DEBUG_WARNING(true, ("DebugMonitor: newterm() failed [%s].", strerror(errno))); diff --git a/engine/shared/library/sharedDebug/src/linux/PerformanceTimer.cpp b/engine/shared/library/sharedDebug/src/linux/PerformanceTimer.cpp index 68c36d8c..f7bd1037 100755 --- a/engine/shared/library/sharedDebug/src/linux/PerformanceTimer.cpp +++ b/engine/shared/library/sharedDebug/src/linux/PerformanceTimer.cpp @@ -39,7 +39,7 @@ PerformanceTimer::~PerformanceTimer() void PerformanceTimer::start() { - int const result = gettimeofday(&startTime, NULL); + int const result = gettimeofday(&startTime, nullptr); FATAL(result != 0,("PerformanceTimer::start failed")); } @@ -55,7 +55,7 @@ void PerformanceTimer::resume() usec += 1000000; } - int const result = gettimeofday(&startTime, NULL); + int const result = gettimeofday(&startTime, nullptr); FATAL(result != 0,("PerformanceTimer::resume failed")); startTime.tv_sec -= sec; @@ -71,7 +71,7 @@ void PerformanceTimer::resume() void PerformanceTimer::stop() { - int result = gettimeofday(&stopTime, NULL); + int result = gettimeofday(&stopTime, nullptr); FATAL(result != 0,("PerformanceTimer::start failed")); } @@ -95,7 +95,7 @@ float PerformanceTimer::getSplitTime() const { timeval currentTime; - int const result = gettimeofday(¤tTime, NULL); + int const result = gettimeofday(¤tTime, nullptr); FATAL(result != 0,("PerformanceTimer::getSplitTime failed")); long sec = currentTime.tv_sec - startTime.tv_sec; @@ -117,7 +117,7 @@ void PerformanceTimer::logElapsedTime(const char* string) const #ifdef _DEBUG static char buffer [1000]; - sprintf(buffer, "%s : %1.5f seconds\n", string ? string : "null", getElapsedTime()); + sprintf(buffer, "%s : %1.5f seconds\n", string ? string : "nullptr", getElapsedTime()); DEBUG_REPORT_LOG_PRINT(true, ("%s", buffer)); #endif } diff --git a/engine/shared/library/sharedDebug/src/shared/DataLint.cpp b/engine/shared/library/sharedDebug/src/shared/DataLint.cpp index 5190728f..8f96856d 100755 --- a/engine/shared/library/sharedDebug/src/shared/DataLint.cpp +++ b/engine/shared/library/sharedDebug/src/shared/DataLint.cpp @@ -35,9 +35,9 @@ namespace DataLintNamespace bool ms_installed = false; DataLint::AssetType m_currentAssetType = DataLint::AT_invalid; bool m_enabled = false; - WarningList * m_warningList = NULL; - StringList * m_assetStack = NULL; - DataLint::StringPairList * m_assetList = NULL; + WarningList * m_warningList = nullptr; + StringList * m_assetStack = nullptr; + DataLint::StringPairList * m_assetList = nullptr; std::string m_dataLintCategorizedAssetsFile("DataLint_CategorizedAssets.txt"); std::string m_dataLintUnSupportedAssetsFile("DataLint_UnSupportedAssets.txt"); Mode m_mode = M_client; @@ -123,17 +123,17 @@ void DataLint::report() // Client only - FILE *assetErrorFileAppearance = NULL; - FILE *assetErrorFileArrangementDescriptor = NULL; - FILE *assetErrorFileLocalizedStringTable = NULL; - FILE *assetErrorFilePortalProperty = NULL; - FILE *assetErrorFileShaderTemplate = NULL; - FILE *assetErrorFileSkyBox = NULL; - FILE *assetErrorFileSlotDescriptor = NULL; - FILE *assetErrorFileSoundTemplate = NULL; - FILE *assetErrorFileTerrain = NULL; - FILE *assetErrorFileTexture = NULL; - FILE *assetErrorFileTextureRenderer = NULL; + FILE *assetErrorFileAppearance = nullptr; + FILE *assetErrorFileArrangementDescriptor = nullptr; + FILE *assetErrorFileLocalizedStringTable = nullptr; + FILE *assetErrorFilePortalProperty = nullptr; + FILE *assetErrorFileShaderTemplate = nullptr; + FILE *assetErrorFileSkyBox = nullptr; + FILE *assetErrorFileSlotDescriptor = nullptr; + FILE *assetErrorFileSoundTemplate = nullptr; + FILE *assetErrorFileTerrain = nullptr; + FILE *assetErrorFileTexture = nullptr; + FILE *assetErrorFileTextureRenderer = nullptr; if (m_mode == M_client) { @@ -450,7 +450,7 @@ std::string DataLintNamespace::formatErrorMessage(WarningPair &warningPair, int char *assetError = strstr(text, " : "); - if (assetError != NULL) + if (assetError != nullptr) { ++assetError; ++assetError; @@ -567,12 +567,12 @@ void DataLint::clearAssetStack() //----------------------------------------------------------------------------- void DataLint::addFilePath(char const *filePath) { - if (filePath == NULL || (strlen(filePath) <= 0)) + if (filePath == nullptr || (strlen(filePath) <= 0)) { return; } - if (m_assetList != NULL) + if (m_assetList != nullptr) { char text[4096]; sprintf(text, "%s", filePath); @@ -592,7 +592,7 @@ void DataLint::addFilePath(char const *filePath) //----------------------------------------------------------------------------- void DataLint::removeFilePath(char const *filePath) { - if (m_assetList != NULL) + if (m_assetList != nullptr) { StringPairList::iterator stringPairListIter = m_assetList->begin(); @@ -611,8 +611,8 @@ void DataLint::removeFilePath(char const *filePath) //----------------------------------------------------------------------------- bool DataLintNamespace::isAnAppearanceAsset(char const *text) { - bool const appearanceAsset = (strstr(text, "appearance/") != NULL); - bool const portalPropertyAsset = (strstr(text, ".pob") != NULL); + bool const appearanceAsset = (strstr(text, "appearance/") != nullptr); + bool const portalPropertyAsset = (strstr(text, ".pob") != nullptr); return (appearanceAsset && !portalPropertyAsset); } @@ -620,7 +620,7 @@ bool DataLintNamespace::isAnAppearanceAsset(char const *text) //----------------------------------------------------------------------------- bool DataLintNamespace::isAnArrangementDescriptorAsset(char const *text) { - bool const arrangementDescriptorAsset = (strstr(text, "slot/arrangement/") != NULL); + bool const arrangementDescriptorAsset = (strstr(text, "slot/arrangement/") != nullptr); return arrangementDescriptorAsset; } @@ -628,7 +628,7 @@ bool DataLintNamespace::isAnArrangementDescriptorAsset(char const *text) //----------------------------------------------------------------------------- bool DataLintNamespace::isALocalizedStringAsset(char const *text) { - bool const localizedStringAsset = (strstr(text, ".stf") != NULL); + bool const localizedStringAsset = (strstr(text, ".stf") != nullptr); return localizedStringAsset; } @@ -638,8 +638,8 @@ bool DataLintNamespace::isAnObjectTemplateAsset(char const *text) { bool result = false; UNREF(text); - bool const isInTheObjectDirectory = (strstr(text, "object/") != NULL); - bool const isInTheAbstractDirectory = (strstr(text, "abstract/") != NULL); + bool const isInTheObjectDirectory = (strstr(text, "object/") != nullptr); + bool const isInTheAbstractDirectory = (strstr(text, "abstract/") != nullptr); if (isInTheObjectDirectory || isInTheAbstractDirectory) { @@ -655,7 +655,7 @@ bool DataLintNamespace::isAnObjectTemplateAsset(char const *text) //----------------------------------------------------------------------------- bool DataLintNamespace::isAPortalProprtyAsset(char const *text) { - bool const portalPropertyAsset = (strstr(text, ".pob") != NULL); + bool const portalPropertyAsset = (strstr(text, ".pob") != nullptr); return portalPropertyAsset; } @@ -663,7 +663,7 @@ bool DataLintNamespace::isAPortalProprtyAsset(char const *text) //----------------------------------------------------------------------------- bool DataLintNamespace::isAShaderTemplateAsset(char const *text) { - bool const shaderTemplateAsset = (strstr(text, "shader/") != NULL); + bool const shaderTemplateAsset = (strstr(text, "shader/") != nullptr); return shaderTemplateAsset; } @@ -671,7 +671,7 @@ bool DataLintNamespace::isAShaderTemplateAsset(char const *text) //----------------------------------------------------------------------------- bool DataLintNamespace::isASkyBoxAsset(char const *text) { - bool const skyBoxAsset = (strstr(text, "skybox/") != NULL); + bool const skyBoxAsset = (strstr(text, "skybox/") != nullptr); return skyBoxAsset; } @@ -679,7 +679,7 @@ bool DataLintNamespace::isASkyBoxAsset(char const *text) //----------------------------------------------------------------------------- bool DataLintNamespace::isASlotDescriptorAsset(char const *text) { - bool const slotDescriptorAsset = (strstr(text, "slot/descriptor/") != NULL); + bool const slotDescriptorAsset = (strstr(text, "slot/descriptor/") != nullptr); return slotDescriptorAsset; } @@ -687,7 +687,7 @@ bool DataLintNamespace::isASlotDescriptorAsset(char const *text) //----------------------------------------------------------------------------- bool DataLintNamespace::isASoundAsset(char const *text) { - bool const soundAsset = (strstr(text, "sound/") != NULL); + bool const soundAsset = (strstr(text, "sound/") != nullptr); return soundAsset; } @@ -701,7 +701,7 @@ bool DataLintNamespace::isATerrainAsset(char const *text) //----------------------------------------------------------------------------- bool DataLintNamespace::isATextureAsset(char const *text) { - bool const textureAsset = (strstr(text, ".dds") != NULL); + bool const textureAsset = (strstr(text, ".dds") != nullptr); return textureAsset; } @@ -709,7 +709,7 @@ bool DataLintNamespace::isATextureAsset(char const *text) //----------------------------------------------------------------------------- bool DataLintNamespace::isATextureRendererTemplateAsset(char const *text) { - bool const textureRendererAsset = (strstr(text, ".trt") != NULL); + bool const textureRendererAsset = (strstr(text, ".trt") != nullptr); return textureRendererAsset; } @@ -749,7 +749,7 @@ bool DataLintNamespace::isAnUnSupportedAsset(char const *text) //----------------------------------------------------------------------------- DataLint::StringPairList DataLintNamespace::getList(int const reserveCount, AssetFunction assetTypeFunction) { - DEBUG_FATAL(!m_assetList, ("DataLint::getList() - m_assetList is NULL")); + DEBUG_FATAL(!m_assetList, ("DataLint::getList() - m_assetList is nullptr")); // Create the list of terrains diff --git a/engine/shared/library/sharedDebug/src/shared/DebugFlags.cpp b/engine/shared/library/sharedDebug/src/shared/DebugFlags.cpp index c676ddeb..c82795d4 100755 --- a/engine/shared/library/sharedDebug/src/shared/DebugFlags.cpp +++ b/engine/shared/library/sharedDebug/src/shared/DebugFlags.cpp @@ -25,8 +25,8 @@ std::vector DebugFlags::ms_flagsSortedByReportPriority; void DebugFlags::config(bool &variable, const char *configSection, const char *configName) { - DEBUG_FATAL(strchr(configSection, ' ') != NULL, ("no spaces are allowed in debug flag section names: %s", configSection)); - DEBUG_FATAL(strchr(configName, ' ') != NULL, ("no spaces are allowed in debug flag names: %s", configName)); + DEBUG_FATAL(strchr(configSection, ' ') != nullptr, ("no spaces are allowed in debug flag section names: %s", configSection)); + DEBUG_FATAL(strchr(configName, ' ') != nullptr, ("no spaces are allowed in debug flag names: %s", configName)); if (configSection && configName && ConfigFile::isInstalled()) { @@ -102,9 +102,9 @@ void DebugFlags::registerFlag(bool &variable, const char *section, const char *n f.section = section; f.name = name; f.reportPriority = 0; - f.reportRoutine1 = NULL; - f.reportRoutine2 = NULL; - f.context = NULL; + f.reportRoutine1 = nullptr; + f.reportRoutine2 = nullptr; + f.context = nullptr; #ifdef _DEBUG f.m_callStack.sample(); #endif @@ -127,8 +127,8 @@ void DebugFlags::registerFlag(bool &variable, const char *section, const char *n f.name = name; f.reportPriority = reportPriority; f.reportRoutine1 = reportRoutine; - f.reportRoutine2 = NULL; - f.context = NULL; + f.reportRoutine2 = nullptr; + f.context = nullptr; #ifdef _DEBUG f.m_callStack.sample(); #endif @@ -150,7 +150,7 @@ void DebugFlags::registerFlag(bool &variable, const char *section, const char *n f.section = section; f.name = name; f.reportPriority = reportPriority; - f.reportRoutine1 = NULL; + f.reportRoutine1 = nullptr; f.reportRoutine2 = reportRoutine; f.context = context; #ifdef _DEBUG @@ -230,7 +230,7 @@ DebugFlags::Flag const * DebugFlags::getFlag(char const * const section, char co return &f; } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedDebug/src/shared/DebugKey.cpp b/engine/shared/library/sharedDebug/src/shared/DebugKey.cpp index 1fb1eefe..3fd2a330 100755 --- a/engine/shared/library/sharedDebug/src/shared/DebugKey.cpp +++ b/engine/shared/library/sharedDebug/src/shared/DebugKey.cpp @@ -108,7 +108,7 @@ bool DebugKey::isDown(int i) bool DebugKey::isActive() { #if PRODUCTION == 0 - return ms_currentFlag != NULL; + return ms_currentFlag != nullptr; #else return false; #endif diff --git a/engine/shared/library/sharedDebug/src/shared/InstallTimer.cpp b/engine/shared/library/sharedDebug/src/shared/InstallTimer.cpp index 5fe48326..80e21bc9 100755 --- a/engine/shared/library/sharedDebug/src/shared/InstallTimer.cpp +++ b/engine/shared/library/sharedDebug/src/shared/InstallTimer.cpp @@ -64,7 +64,7 @@ void InstallTimer::manualExit() unsigned long const endingNumberOfBytesAllocated = MemoryManager::getCurrentNumberOfBytesAllocated(); --ms_indent; REPORT_LOG_PRINT(ms_enabled, ("InstallTimer:%*c%6.4f %d %s\n", ms_indent * 2, ' ', m_performanceTimer.getElapsedTime(), static_cast(endingNumberOfBytesAllocated - m_startingNumberOfBytesAllocated), m_description)); - m_description = NULL; + m_description = nullptr; } } diff --git a/engine/shared/library/sharedDebug/src/shared/PixCounter.cpp b/engine/shared/library/sharedDebug/src/shared/PixCounter.cpp index dcb14966..b0a63e6d 100755 --- a/engine/shared/library/sharedDebug/src/shared/PixCounter.cpp +++ b/engine/shared/library/sharedDebug/src/shared/PixCounter.cpp @@ -83,13 +83,13 @@ void PixCounterNamespace::remove() { #ifdef _WIN32 FreeLibrary(ms_pixDll); - ms_pixDll = NULL; + ms_pixDll = nullptr; #endif - ms_setCounterFloat = NULL; - ms_setCounterInt = NULL; - ms_setCounterInt64 = NULL; - ms_setCounterString = NULL; + ms_setCounterFloat = nullptr; + ms_setCounterInt = nullptr; + ms_setCounterInt64 = nullptr; + ms_setCounterString = nullptr; // Make sure the counter memory gets freed at this point Counters().swap(ms_counters); @@ -379,7 +379,7 @@ PixCounter::String::String() : Counter(), m_enabled(false), m_lastFrameValue(), - m_lastFrameValuePointer(NULL), + m_lastFrameValuePointer(nullptr), m_currentValue() { } diff --git a/engine/shared/library/sharedDebug/src/shared/Profiler.cpp b/engine/shared/library/sharedDebug/src/shared/Profiler.cpp index eb484451..59e92811 100755 --- a/engine/shared/library/sharedDebug/src/shared/Profiler.cpp +++ b/engine/shared/library/sharedDebug/src/shared/Profiler.cpp @@ -238,7 +238,7 @@ void Profiler::install() ms_profilerEntriesCurrent = &ms_profilerEntries1; ms_profilerEntriesLast = &ms_profilerEntries2; - ms_rootVisibleExpandableEntry = new VisibleExpandableEntry(NULL); + ms_rootVisibleExpandableEntry = new VisibleExpandableEntry(nullptr); ms_rootVisibleExpandableEntry->setExpanded(true); ms_selectedVisibleExpandableEntry = ms_rootVisibleExpandableEntry; } @@ -248,13 +248,13 @@ void Profiler::install() void Profiler::remove() { delete ms_rootVisibleExpandableEntry; - ms_rootVisibleExpandableEntry = NULL; - ms_beforeSelectedVisibleExpandableEntry = NULL; - ms_selectedVisibleExpandableEntry = NULL; - ms_afterSelectedVisibleExpandableEntry = NULL; - ms_previousVisibleExpandableEntry = NULL; - ms_profilerEntriesCurrent = NULL; - ms_profilerEntriesLast = NULL; + ms_rootVisibleExpandableEntry = nullptr; + ms_beforeSelectedVisibleExpandableEntry = nullptr; + ms_selectedVisibleExpandableEntry = nullptr; + ms_afterSelectedVisibleExpandableEntry = nullptr; + ms_previousVisibleExpandableEntry = nullptr; + ms_profilerEntriesCurrent = nullptr; + ms_profilerEntriesLast = nullptr; } // ---------------------------------------------------------------------- @@ -374,11 +374,11 @@ bool ProfilerNamespace::formatEntry(int indent, ProfilerTimer::Type totalTime, i void ProfilerNamespace::processEntry(char const *rootName, int indent, ProfilerEntry const & entry, VisibleExpandableEntry * visibleExpandableEntry) { if (rootName == entry.name) - rootName = NULL; + rootName = nullptr; if (!rootName) { - if (!formatEntry(indent, entry.totalTime, entry.totalCalls, visibleExpandableEntry != NULL, visibleExpandableEntry && visibleExpandableEntry->isExpanded(), visibleExpandableEntry == ms_selectedVisibleExpandableEntry, entry.name)) + if (!formatEntry(indent, entry.totalTime, entry.totalCalls, visibleExpandableEntry != nullptr, visibleExpandableEntry && visibleExpandableEntry->isExpanded(), visibleExpandableEntry == ms_selectedVisibleExpandableEntry, entry.name)) return; } @@ -410,7 +410,7 @@ void ProfilerNamespace::processEntry(char const *rootName, int indent, ProfilerE if (child.children.empty()) { - processEntry(rootName, indent, child, NULL); + processEntry(rootName, indent, child, nullptr); } else { @@ -483,9 +483,9 @@ void ProfilerNamespace::generateReport() ms_rootVisibleExpandableEntry->markAllChildrenInvisible(); ms_rootVisibleExpandableEntry->findOrAddExpandableChild(rootEntry.name); - ms_previousVisibleExpandableEntry = NULL; - ms_beforeSelectedVisibleExpandableEntry = NULL; - ms_afterSelectedVisibleExpandableEntry = NULL; + ms_previousVisibleExpandableEntry = nullptr; + ms_beforeSelectedVisibleExpandableEntry = nullptr; + ms_afterSelectedVisibleExpandableEntry = nullptr; processEntry(ms_rootProfilerName, 0, rootEntry, ms_rootVisibleExpandableEntry); if (ms_rootVisibleExpandableEntry->pruneInvisibleChildren()) @@ -494,7 +494,7 @@ void ProfilerNamespace::generateReport() if (ms_setRoot) { if (ms_rootProfilerName) - ms_rootProfilerName = NULL; + ms_rootProfilerName = nullptr; else ms_rootProfilerName = ms_selectedVisibleExpandableEntry->getName(); ms_setRoot = false; @@ -720,7 +720,7 @@ void ProfilerNamespace::enterWithTime(char const *name, ProfilerTimer::Type time // search for another call to this block from the parent int entryIndex = -1; - ProfilerEntry *entry = NULL; + ProfilerEntry *entry = nullptr; if (!ms_profilerEntryStack.empty()) { ProfilerEntry &parent = (*ms_profilerEntriesCurrent)[ms_profilerEntryStack.back()]; diff --git a/engine/shared/library/sharedDebug/src/shared/RemoteDebug.cpp b/engine/shared/library/sharedDebug/src/shared/RemoteDebug.cpp index c9e832b9..e6b40c19 100755 --- a/engine/shared/library/sharedDebug/src/shared/RemoteDebug.cpp +++ b/engine/shared/library/sharedDebug/src/shared/RemoteDebug.cpp @@ -92,10 +92,10 @@ void RemoteDebug::remove(void) return; } - ms_removeFunction = NULL; - ms_openFunction = NULL; - ms_closeFunction = NULL; - ms_sendFunction = NULL; + ms_removeFunction = nullptr; + ms_openFunction = nullptr; + ms_closeFunction = nullptr; + ms_sendFunction = nullptr; //empty out session-level data for (StreamMap::iterator it = ms_streams->begin(); it != ms_streams->end(); ++it) @@ -147,7 +147,7 @@ uint32 RemoteDebug::registerStream(const std::string& streamName) DEBUG_FATAL(!ms_installed, ("remoteDebug not installed")); uint32 streamNum = 0; - Channel *parent = NULL; + Channel *parent = nullptr; std::string base; std::string rest = streamName; //look for subchannels with a double backslash @@ -203,7 +203,7 @@ uint32 RemoteDebug::registerStaticView(const std::string& channelName) { DEBUG_FATAL(!ms_installed, ("remoteDebug not installed")); uint32 staticViewNum = 0; - Channel *parent = NULL; + Channel *parent = nullptr; std::string base; std::string rest = channelName; //look for subchannels with a double backslash @@ -356,7 +356,7 @@ uint32 RemoteDebug::registerVariable(const char* variableName, void *memLoc, VAR std::string variable = variableName; uint32 variableNum = 0; - Channel *parent = NULL; + Channel *parent = nullptr; std::string base; std::string rest = variable; //look for subchannels with a double backslash @@ -375,7 +375,7 @@ uint32 RemoteDebug::registerVariable(const char* variableName, void *memLoc, VAR //only add the variable if we don't have it yet if (variableNumber == -1) { - registerVariable(newBase.c_str(), NULL, BOOL, sendToClients); + registerVariable(newBase.c_str(), nullptr, BOOL, sendToClients); } //look for any other subChannel uint32 oldRestIndex = restIndex; diff --git a/engine/shared/library/sharedDebug/src/shared/RemoteDebug.h b/engine/shared/library/sharedDebug/src/shared/RemoteDebug.h index 8f24d6af..f2b7070c 100755 --- a/engine/shared/library/sharedDebug/src/shared/RemoteDebug.h +++ b/engine/shared/library/sharedDebug/src/shared/RemoteDebug.h @@ -62,7 +62,7 @@ public: { INT, //32 bit signed int FLOAT, //32 bit signed float - CSTRING, //null terminated char[] + CSTRING, //nullptr terminated char[] BOOL //0 or 1 (could use an int, but useful for tools) }; @@ -92,7 +92,7 @@ public: static void install(RemoveFunction, OpenFunction, CloseFunction, SendFunction, IsReadyFunction); ///open a session - static void open(const char *server = NULL, uint16 port = 0); + static void open(const char *server = nullptr, uint16 port = 0); ///packs the data into a packet, and sends it using the client-defined SendFunction static void send(MESSAGE_TYPE type, const char* name = ""); diff --git a/engine/shared/library/sharedDebug/src/shared/RemoteDebug_inner.cpp b/engine/shared/library/sharedDebug/src/shared/RemoteDebug_inner.cpp index da1f9878..e945d875 100755 --- a/engine/shared/library/sharedDebug/src/shared/RemoteDebug_inner.cpp +++ b/engine/shared/library/sharedDebug/src/shared/RemoteDebug_inner.cpp @@ -30,7 +30,7 @@ uint32 RemoteDebugServer::ms_inputTarget; // ====================================================================== RemoteDebug::Channel::Channel(const std::string& name, Channel *parent) -: m_name(NULL), +: m_name(nullptr), m_parent(parent) { m_name = new std::string(name); @@ -41,16 +41,16 @@ RemoteDebug::Channel::Channel(const std::string& name, Channel *parent) RemoteDebug::Channel::~Channel() { - m_parent = NULL; + m_parent = nullptr; if(m_name) { delete m_name; - m_name = NULL; + m_name = nullptr; } if (m_children) { delete m_children; - m_children = NULL; + m_children = nullptr; } } @@ -72,7 +72,7 @@ const std::string& RemoteDebug::Channel::name() RemoteDebug::Variable::Variable(const std::string& name, void *memLoc, VARIABLE_TYPES type) : m_memLoc(memLoc), - m_name(NULL), + m_name(nullptr), m_type(type) { m_name = new std::string(name); @@ -111,7 +111,7 @@ RemoteDebug::Variable::~Variable() if(m_name) { delete m_name; - m_name = NULL; + m_name = nullptr; } } @@ -307,7 +307,7 @@ void RemoteDebugClient::receive(const unsigned char * const message, const uint3 if (channelNumber < ms_nextVariable) return; //do not send value back to server (hence the "false") - registerVariable(ms_buffer, NULL, BOOL, false); + registerVariable(ms_buffer, nullptr, BOOL, false); if (ms_newVariableFunction) ms_newVariableFunction(channelNumber, const_cast(ms_buffer)); break; @@ -477,7 +477,7 @@ void RemoteDebugServer::receive(const unsigned char * const message, const uint3 memcpy(ms_buffer, charMessage + sizeOfMessageType + sizeOfChannelNumber + sizeOfSizeofPayload, sizeOfPayload); } - Variable* v = NULL; + Variable* v = nullptr; switch(type) { case STREAM: @@ -524,27 +524,27 @@ void RemoteDebugServer::receive(const unsigned char * const message, const uint3 break; case STATIC_UP: - if ((*ms_upFunctionMap)[ms_inputTarget] != NULL) + if ((*ms_upFunctionMap)[ms_inputTarget] != nullptr) (*ms_upFunctionMap)[ms_inputTarget](); //lint !e10, !e522 ("expecting a function" and "expected void assignment) break; case STATIC_DOWN: - if ((*ms_downFunctionMap)[ms_inputTarget] != NULL) + if ((*ms_downFunctionMap)[ms_inputTarget] != nullptr) (*ms_downFunctionMap)[ms_inputTarget](); //lint !e10, !e522 ("expecting a function" and "expected void assignment) break; case STATIC_LEFT: - if ((*ms_leftFunctionMap)[ms_inputTarget] != NULL) + if ((*ms_leftFunctionMap)[ms_inputTarget] != nullptr) (*ms_leftFunctionMap)[ms_inputTarget](); //lint !e10, !e522 ("expecting a function" and "expected void assignment) break; case STATIC_RIGHT: - if ((*ms_rightFunctionMap)[ms_inputTarget] != NULL) + if ((*ms_rightFunctionMap)[ms_inputTarget] != nullptr) (*ms_rightFunctionMap)[ms_inputTarget](); //lint !e10, !e522 ("expecting a function" and "expected void assignment) break; case STATIC_ENTER: - if ((*ms_enterFunctionMap)[ms_inputTarget] != NULL) + if ((*ms_enterFunctionMap)[ms_inputTarget] != nullptr) (*ms_enterFunctionMap)[ms_inputTarget](); //lint !e10, !e522 ("expecting a function" and "expected void assignment) break; diff --git a/engine/shared/library/sharedDebug/src/shared/RemoteDebug_inner.h b/engine/shared/library/sharedDebug/src/shared/RemoteDebug_inner.h index d3dd088a..8daccef3 100755 --- a/engine/shared/library/sharedDebug/src/shared/RemoteDebug_inner.h +++ b/engine/shared/library/sharedDebug/src/shared/RemoteDebug_inner.h @@ -29,13 +29,13 @@ class RemoteDebug::Channel NodeList* m_children; ///the fully qualified name of the channel std::string* m_name; - ///its parent (which is NULL for top-level nodes + ///its parent (which is nullptr for top-level nodes Channel *m_parent; }; /** This class stores data about a variable channel, both on the server (where the variable actually * resides), and the client (which just displays it). The client simply creates Variable's with - * NULL'd out memLoc's, since it doesn't have direct access to the memory. + * nullptr'd out memLoc's, since it doesn't have direct access to the memory. */ class RemoteDebug::Variable { diff --git a/engine/shared/library/sharedDebug/src/shared/Report.cpp b/engine/shared/library/sharedDebug/src/shared/Report.cpp index 69de29bd..5f7f8082 100755 --- a/engine/shared/library/sharedDebug/src/shared/Report.cpp +++ b/engine/shared/library/sharedDebug/src/shared/Report.cpp @@ -175,7 +175,7 @@ void Report::puts(const char *buffer) // if (flags & RF_fatal) // title = "Fatal Report"; - // MessageBox(NULL, buffer, title, MB_OK | MB_ICONEXCLAMATION); + // MessageBox(nullptr, buffer, title, MB_OK | MB_ICONEXCLAMATION); //} } @@ -198,7 +198,7 @@ void Report::vprintf(const char *format, va_list va) { char buffer[8 * 1024]; - // make sure the buffer is always NULL terminated + // make sure the buffer is always nullptr terminated buffer[sizeof(buffer)-1] = '\0'; // format the string diff --git a/engine/shared/library/sharedFile/src/shared/AsynchronousLoader.cpp b/engine/shared/library/sharedFile/src/shared/AsynchronousLoader.cpp index be918f39..b810a0b8 100755 --- a/engine/shared/library/sharedFile/src/shared/AsynchronousLoader.cpp +++ b/engine/shared/library/sharedFile/src/shared/AsynchronousLoader.cpp @@ -169,9 +169,9 @@ void AsynchronousLoader::install(const char *fileName) const int numberOfExtensions = iff.getChunkLengthTotal(sizeof(int32)); ms_extensionFunctionsList.reserve(numberOfExtensions); ExtensionFunctions extensionFunctions; - extensionFunctions.extension = NULL; - extensionFunctions.fetchFunction = NULL; - extensionFunctions.releaseFunction = NULL; + extensionFunctions.extension = nullptr; + extensionFunctions.fetchFunction = nullptr; + extensionFunctions.releaseFunction = nullptr; for (int i = 0; i < numberOfExtensions; ++i) { extensionFunctions.extension = ms_fileData + iff.read_int32(); @@ -235,10 +235,10 @@ void AsynchronousLoaderNamespace::remove() { DEBUG_FATAL(!ms_installed, ("not installed")); Request *request = reinterpret_cast(ms_requestMemoryBlockManager->allocate()); - request->fileRecordList = NULL; - request->callback = NULL; - request->data = NULL; - request->cachedFiles = NULL; + request->fileRecordList = nullptr; + request->callback = nullptr; + request->data = nullptr; + request->cachedFiles = nullptr; submitRequest(request); @@ -270,7 +270,7 @@ void AsynchronousLoaderNamespace::remove() ms_cachedFilesPool.clear(); delete ms_requestMemoryBlockManager; - ms_requestMemoryBlockManager = NULL; + ms_requestMemoryBlockManager = nullptr; } // ---------------------------------------------------------------------- @@ -369,7 +369,7 @@ void AsynchronousLoader::add(const char *fileName, Callback callback, void *data request->fileRecordList = i->second; request->callback = callback; request->data = data; - request->cachedFiles = NULL; + request->cachedFiles = nullptr; submitRequest(request); } else @@ -390,8 +390,8 @@ void AsynchronousLoader::remove(Callback callback, void *data) for (Requests::iterator i = ms_pendingRequests.begin(); i != iEnd; ++i) if ((*i)->callback == callback && (*i)->data == data) { - (*i)->callback = NULL; - (*i)->data = NULL; + (*i)->callback = nullptr; + (*i)->data = nullptr; } } @@ -400,8 +400,8 @@ void AsynchronousLoader::remove(Callback callback, void *data) for (Requests::iterator i = ms_completedRequests.begin(); i != iEnd; ++i) if ((*i)->callback == callback && (*i)->data == data) { - (*i)->callback = NULL; - (*i)->data = NULL; + (*i)->callback = nullptr; + (*i)->data = nullptr; } } @@ -466,8 +466,8 @@ void AsynchronousLoaderNamespace::threadRoutine() CachedFile cachedFile; cachedFile.fileRecord = fileRecord; - cachedFile.file = NULL; - cachedFile.resource = NULL; + cachedFile.file = nullptr; + cachedFile.resource = nullptr; // check if the resource is already loaded if (!fileRecord->alreadyCached) @@ -622,7 +622,7 @@ void AsynchronousLoader::processCallbacks() else bytes += cachedFile.file->length(); TreeFile::addCachedFile(cachedFile.fileRecord->fileName, cachedFile.file); - cachedFile.file = NULL; + cachedFile.file = nullptr; } } } @@ -653,13 +653,13 @@ void AsynchronousLoader::processCallbacks() else bytes += cachedFile.file->length(); delete cachedFile.file; - cachedFile.file = NULL; + cachedFile.file = nullptr; } if (cachedFile.resource) { ms_extensionFunctionsList[cachedFile.fileRecord->extensionFunctionsIndex].releaseFunction(cachedFile.resource); - cachedFile.resource = NULL; + cachedFile.resource = nullptr; } } request->cachedFiles->clear(); @@ -667,7 +667,7 @@ void AsynchronousLoader::processCallbacks() ms_mutex.enter(); ms_cachedFilesPool.push_back(request->cachedFiles); - request->cachedFiles = NULL; + request->cachedFiles = nullptr; ms_mutex.leave(); } diff --git a/engine/shared/library/sharedFile/src/shared/FileManifest.cpp b/engine/shared/library/sharedFile/src/shared/FileManifest.cpp index ecf1becf..c5552775 100755 --- a/engine/shared/library/sharedFile/src/shared/FileManifest.cpp +++ b/engine/shared/library/sharedFile/src/shared/FileManifest.cpp @@ -73,8 +73,8 @@ void FileManifest::install() s_accessThreshold = ConfigFile::getKeyInt("SharedFile", "fileManifestAccessThreshold", -1, s_accessThreshold); // if we are developing, and want to update the manifest, read in the tab file as well - const char * manifestFile = ConfigFile::getKeyString("SharedFile", "updateFileManifest", 0, NULL); - if (manifestFile != NULL) + const char * manifestFile = ConfigFile::getKeyString("SharedFile", "updateFileManifest", 0, nullptr); + if (manifestFile != nullptr) { s_updateManifest = true; @@ -183,8 +183,8 @@ void FileManifest::remove() #if PRODUCTION == 0 // dump out the new manifest if requested - const char * manifestFile = ConfigFile::getKeyString("SharedFile", "updateFileManifest", 0, NULL); - if (manifestFile != NULL) + const char * manifestFile = ConfigFile::getKeyString("SharedFile", "updateFileManifest", 0, nullptr); + if (manifestFile != nullptr) { StdioFile outputFile(manifestFile,"w"); DEBUG_FATAL(!outputFile.isOpen(), ("FileManifest::remove(): Could not open %s for writing.", manifestFile)); @@ -201,7 +201,7 @@ void FileManifest::remove() { if (!i->second) { - DEBUG_WARNING(true, ("FileManifest::remove(): Found a null pointer in the fileManifest map!\n")); + DEBUG_WARNING(true, ("FileManifest::remove(): Found a nullptr pointer in the fileManifest map!\n")); continue; } diff --git a/engine/shared/library/sharedFile/src/shared/FileNameUtils.cpp b/engine/shared/library/sharedFile/src/shared/FileNameUtils.cpp index 01ac3c98..58912176 100755 --- a/engine/shared/library/sharedFile/src/shared/FileNameUtils.cpp +++ b/engine/shared/library/sharedFile/src/shared/FileNameUtils.cpp @@ -59,9 +59,9 @@ bool FileNameUtils::isReadable(std::string const &path) { FILE *fp = fopen(path.c_str(), "r"); - result = (fp != NULL); + result = (fp != nullptr); - if (fp != NULL) + if (fp != nullptr) { fclose(fp); } @@ -79,9 +79,9 @@ bool FileNameUtils::isWritable(std::string const &path) { FILE *fp = fopen(path.c_str(), "w"); - result = (fp != NULL); + result = (fp != nullptr); - if (fp != NULL) + if (fp != nullptr) { fclose(fp); } diff --git a/engine/shared/library/sharedFile/src/shared/FileStreamer.cpp b/engine/shared/library/sharedFile/src/shared/FileStreamer.cpp index 6c47b26c..ff5eec8d 100755 --- a/engine/shared/library/sharedFile/src/shared/FileStreamer.cpp +++ b/engine/shared/library/sharedFile/src/shared/FileStreamer.cpp @@ -109,11 +109,11 @@ int FileStreamer::getFileSize(const char *fileName) FileStreamer::File *FileStreamer::open(const char *fileName, bool randomAccess) { DEBUG_FATAL(!ms_installed, ("not installed")); - DEBUG_FATAL(!fileName, ("file name null")); + DEBUG_FATAL(!fileName, ("file name nullptr")); OsFile *osFile = OsFile::open(fileName, randomAccess); if (!osFile) - return NULL; + return nullptr; #if PRODUCTION // Stop checking the fileName if one of these returns true @@ -150,7 +150,7 @@ void FileStreamer::File::install(bool useThread) void FileStreamer::File::remove() { delete ms_memoryBlockManager; - ms_memoryBlockManager = NULL; + ms_memoryBlockManager = nullptr; } // ---------------------------------------------------------------------- @@ -192,7 +192,7 @@ FileStreamer::File::~File() bool FileStreamer::File::isOpen() const { - return m_osFile != NULL; + return m_osFile != nullptr; } // ---------------------------------------------------------------------- @@ -249,7 +249,7 @@ void FileStreamer::File::close() if (isOpen()) { delete m_osFile; - m_osFile = NULL; + m_osFile = nullptr; } } diff --git a/engine/shared/library/sharedFile/src/shared/FileStreamerFile.cpp b/engine/shared/library/sharedFile/src/shared/FileStreamerFile.cpp index d6a798d5..e579ab9e 100755 --- a/engine/shared/library/sharedFile/src/shared/FileStreamerFile.cpp +++ b/engine/shared/library/sharedFile/src/shared/FileStreamerFile.cpp @@ -93,7 +93,7 @@ FileStreamerFile::~FileStreamerFile() bool FileStreamerFile::isOpen() const { - return m_file != NULL; + return m_file != nullptr; } // ---------------------------------------------------------------------- @@ -174,7 +174,7 @@ void FileStreamerFile::close() { if (m_owner) delete m_file; - m_file = NULL; + m_file = nullptr; } // ====================================================================== diff --git a/engine/shared/library/sharedFile/src/shared/FileStreamerThread.cpp b/engine/shared/library/sharedFile/src/shared/FileStreamerThread.cpp index 1d3c0b8c..a0789e5b 100755 --- a/engine/shared/library/sharedFile/src/shared/FileStreamerThread.cpp +++ b/engine/shared/library/sharedFile/src/shared/FileStreamerThread.cpp @@ -294,34 +294,34 @@ void FileStreamerThread::threadRoutine() //get the request to service ms_queueCriticalSection.enter(); - request = NULL; + request = nullptr; //if there is an AudioVideo request, service it first (interrupting any current data request) if (ms_firstAudioVideoRequest) { request = ms_firstAudioVideoRequest; ms_firstAudioVideoRequest = ms_firstAudioVideoRequest->next; - if (ms_firstAudioVideoRequest == NULL) - ms_lastAudioVideoRequest = NULL; - request->next = NULL; + if (ms_firstAudioVideoRequest == nullptr) + ms_lastAudioVideoRequest = nullptr; + request->next = nullptr; } else if (ms_firstDataRequest) { request = ms_firstDataRequest; ms_firstDataRequest = ms_firstDataRequest->next; - if (ms_firstDataRequest == NULL) - ms_lastDataRequest = NULL; - request->next = NULL; + if (ms_firstDataRequest == nullptr) + ms_lastDataRequest = nullptr; + request->next = nullptr; } else if (ms_firstLowRequest) { request = ms_firstLowRequest; ms_firstLowRequest = ms_firstLowRequest->next; - if (ms_firstLowRequest == NULL) - ms_lastLowRequest = NULL; - request->next = NULL; + if (ms_firstLowRequest == nullptr) + ms_lastLowRequest = nullptr; + request->next = nullptr; } else { @@ -369,7 +369,7 @@ void FileStreamerThread::Request::install() void FileStreamerThread::Request::remove() { delete ms_memoryBlockManager; - ms_memoryBlockManager = NULL; + ms_memoryBlockManager = nullptr; } // ---------------------------------------------------------------------- @@ -395,15 +395,15 @@ void FileStreamerThread::Request::operator delete(void *pointer) // ---------------------------------------------------------------------- FileStreamerThread::Request::Request() -: next(NULL), +: next(nullptr), type(Request::Unknown), - osFile(NULL), + osFile(nullptr), buffer(0), bytesToBeRead(0), bytesRead(0), - gate(NULL), + gate(nullptr), priority(AbstractFile::PriorityData), - returnValue(NULL) + returnValue(nullptr) { } @@ -412,10 +412,10 @@ FileStreamerThread::Request::Request() FileStreamerThread::Request::~Request() { #ifdef _DEBUG - next = NULL; - buffer = NULL; - gate = NULL; - returnValue = NULL; + next = nullptr; + buffer = nullptr; + gate = nullptr; + returnValue = nullptr; #endif } diff --git a/engine/shared/library/sharedFile/src/shared/Iff.cpp b/engine/shared/library/sharedFile/src/shared/Iff.cpp index 212ef576..48eaeed1 100755 --- a/engine/shared/library/sharedFile/src/shared/Iff.cpp +++ b/engine/shared/library/sharedFile/src/shared/Iff.cpp @@ -146,11 +146,11 @@ bool Iff::isValid(char const * fileName) int const fileLength = file->length(); byte *data = file->readEntireFileAndClose(); delete file; - file = NULL; + file = nullptr; bool const result = IffNamespace::isValid(data, fileLength); delete [] data; - data = NULL; + data = nullptr; return result; } @@ -167,12 +167,12 @@ bool Iff::isValid(char const * fileName) // Iff::open() Iff::Iff(void) -: fileName(NULL), +: fileName(nullptr), maxStackDepth(DEFAULT_STACK_DEPTH), stackDepth(0), stack(new Stack[DEFAULT_STACK_DEPTH]), length(0), - data(NULL), + data(nullptr), inChunk(false), growable(false), nonlinear(false), @@ -207,7 +207,7 @@ Iff::Iff(void) */ Iff::Iff(int newDataSize, const byte *newData, bool iffOwnsData) : - fileName(NULL), + fileName(nullptr), maxStackDepth(DEFAULT_STACK_DEPTH), stackDepth(0), stack(new Stack[DEFAULT_STACK_DEPTH]), @@ -242,12 +242,12 @@ Iff::Iff(int newDataSize, const byte *newData, bool iffOwnsData) : */ Iff::Iff(const char *newFileName, bool optional) -: fileName(NULL), +: fileName(nullptr), maxStackDepth(DEFAULT_STACK_DEPTH), stackDepth(0), stack(new Stack[DEFAULT_STACK_DEPTH]), length(0), - data(NULL), + data(nullptr), inChunk(false), growable(false), nonlinear(false), @@ -270,7 +270,7 @@ Iff::Iff(const char *newFileName, bool optional) */ Iff::Iff(int initialSize, bool isGrowable, bool clearDataBuffer) -: fileName(NULL), +: fileName(nullptr), maxStackDepth(DEFAULT_STACK_DEPTH), stackDepth(0), stack(new Stack[DEFAULT_STACK_DEPTH]), @@ -384,7 +384,7 @@ void Iff::open(AbstractFile & file, char const * const newFileName) DEBUG_FATAL(data, ("causing memory leak")); data = file.readEntireFileAndClose(); - FATAL(ConfigSharedFile::getValidateIff() && !IffNamespace::isValid(data, length), ("File corruption detected! Iff::isValid failed for %s (size=%d, crc=%08X). Please try a \"Full Scan\" from the LaunchPad.", newFileName ? newFileName : "null", length, Crc::calculate(data, length))); + FATAL(ConfigSharedFile::getValidateIff() && !IffNamespace::isValid(data, length), ("File corruption detected! Iff::isValid failed for %s (size=%d, crc=%08X). Please try a \"Full Scan\" from the LaunchPad.", newFileName ? newFileName : "nullptr", length, Crc::calculate(data, length))); // setup the stack data to know about the data stack[0].start = 0; @@ -406,11 +406,11 @@ void Iff::open(AbstractFile & file, char const * const newFileName) void Iff::close(void) { delete [] fileName; - fileName = NULL; + fileName = nullptr; if (ownsData) delete [] data; - data = NULL; //lint !e672 // possible memory leak in assignment to Iff::data // no, we only delete when we own it + data = nullptr; //lint !e672 // possible memory leak in assignment to Iff::data // no, we only delete when we own it stackDepth = 0; } @@ -886,7 +886,7 @@ void Iff::insertChunkFloatQuaternion(const Quaternion &quaternion) * Insert a string into the current chunk at the current location. * * This routine will call insertChunkData(const void *, int length) - * with the string using its string length (plus one for the null + * with the string using its string length (plus one for the nullptr * terminator). */ @@ -1555,10 +1555,10 @@ void Iff::read_string(char *string, int maxLength) *string = *source; } - // step over the null terminator on the input + // step over the nullptr terminator on the input ++s.used; - // null terminate the output string + // nullptr terminate the output string DEBUG_FATAL(maxLength <= 0, ("destination string too short")); *string = '\0'; } @@ -1594,7 +1594,7 @@ char *Iff::read_string(void) for ( ; sourceLength < maxLength && source[sourceLength]; ++sourceLength) ; - // verify that we found the null terminator + // verify that we found the nullptr terminator DEBUG_FATAL(sourceLength >= maxLength, ("hit end of chunk before string terminator")); // create and copy the string @@ -1634,10 +1634,10 @@ void Iff::read_string(std::string &string) for ( ; sourceLength < maxLength && source[sourceLength]; ++sourceLength) ; - // verify that we found the null terminator + // verify that we found the nullptr terminator DEBUG_FATAL(sourceLength >= maxLength, ("hit end of chunk before string terminator")); - // account for the null terminator + // account for the nullptr terminator ++sourceLength; s.used += sourceLength; diff --git a/engine/shared/library/sharedFile/src/shared/Iff.h b/engine/shared/library/sharedFile/src/shared/Iff.h index 71e07c44..1fe0660a 100755 --- a/engine/shared/library/sharedFile/src/shared/Iff.h +++ b/engine/shared/library/sharedFile/src/shared/Iff.h @@ -250,7 +250,7 @@ public: Unicode::String read_unicodeString(); #if 0 - real *read_float (int count, real *array=NULL); + real *read_float (int count, real *array=nullptr); #endif }; @@ -294,7 +294,7 @@ inline int Iff::getRawDataSize(void) const * to store raw iff data via a mechanism other than Iff::write(). * * @return A read-only pointer to the data buffer containing the raw Iff data - * managed by this Iff object. It may be NULL if no data is currently + * managed by this Iff object. It may be nullptr if no data is currently * managed by the Iff. * @see Iff::getRawDataSize(), Iff::write() */ diff --git a/engine/shared/library/sharedFile/src/shared/IndentedFileWriter.cpp b/engine/shared/library/sharedFile/src/shared/IndentedFileWriter.cpp index 2c5eb7f2..013c7204 100755 --- a/engine/shared/library/sharedFile/src/shared/IndentedFileWriter.cpp +++ b/engine/shared/library/sharedFile/src/shared/IndentedFileWriter.cpp @@ -23,7 +23,7 @@ IndentedFileWriter *IndentedFileWriter::createWriter(char const *filename) { // Kill the new writer since we weren't able to open the file for writing. delete newWriter; - return NULL; + return nullptr; } } @@ -36,7 +36,7 @@ IndentedFileWriter::~IndentedFileWriter() if (m_file) { fclose(m_file); - m_file = NULL; + m_file = nullptr; } } @@ -63,8 +63,8 @@ void IndentedFileWriter::unindent() void IndentedFileWriter::writeLine(char const *line) const { - FATAL(!m_file, ("writeLine(): m_file is NULL, programmer error.")); - FATAL(!line, ("writeLine(): line argument is NULL.")); + FATAL(!m_file, ("writeLine(): m_file is nullptr, programmer error.")); + FATAL(!line, ("writeLine(): line argument is nullptr.")); //-- Write one tab for each indentation level. for (int i = 0; i < m_indentCount; ++i) @@ -92,7 +92,7 @@ void IndentedFileWriter::writeLineFormat(char const *format, ...) const int const formatCount = vsnprintf(buffer, sizeof(buffer), format, varArgList); UNREF(formatCount); - //-- Ensure it's null terminated. + //-- Ensure it's nullptr terminated. buffer[sizeof(buffer) - 1] = '\0'; //-- Do the real print. @@ -108,7 +108,7 @@ void IndentedFileWriter::writeLineFormat(char const *format, ...) const IndentedFileWriter::IndentedFileWriter() : m_indentCount(0), - m_file(NULL) + m_file(nullptr) { } @@ -123,7 +123,7 @@ bool IndentedFileWriter::createFile(char const *filename) } m_file = fopen(filename, "w"); - return (m_file != NULL); + return (m_file != nullptr); } // ====================================================================== diff --git a/engine/shared/library/sharedFile/src/shared/MemoryFile.cpp b/engine/shared/library/sharedFile/src/shared/MemoryFile.cpp index 4c023f8c..d09b3c99 100755 --- a/engine/shared/library/sharedFile/src/shared/MemoryFile.cpp +++ b/engine/shared/library/sharedFile/src/shared/MemoryFile.cpp @@ -70,7 +70,7 @@ MemoryFile::MemoryFile(byte *buffer, int length) MemoryFile::MemoryFile(AbstractFile *file) : AbstractFile(PriorityData), - m_buffer(NULL), + m_buffer(nullptr), m_length(file->length()), m_offset(0) { @@ -88,7 +88,7 @@ MemoryFile::~MemoryFile() bool MemoryFile::isOpen() const { - return m_buffer != NULL; + return m_buffer != nullptr; } // ---------------------------------------------------------------------- @@ -162,7 +162,7 @@ int MemoryFile::write(int, const void *) void MemoryFile::close() { delete [] m_buffer; - m_buffer = NULL; + m_buffer = nullptr; } // ---------------------------------------------------------------------- @@ -170,7 +170,7 @@ void MemoryFile::close() byte *MemoryFile::readEntireFileAndClose() { byte *result = m_buffer; - m_buffer = NULL; + m_buffer = nullptr; return result; } diff --git a/engine/shared/library/sharedFile/src/shared/TreeFile.cpp b/engine/shared/library/sharedFile/src/shared/TreeFile.cpp index 09acf384..6c53bff5 100755 --- a/engine/shared/library/sharedFile/src/shared/TreeFile.cpp +++ b/engine/shared/library/sharedFile/src/shared/TreeFile.cpp @@ -123,7 +123,7 @@ void TreeFile::install(uint32 skuBits) sprintf(buffer, "searchPath%s%d", skuText, priority); char const * result; - for (int index = 0; (result = ConfigFile::getKeyString("SharedFile", buffer, index, NULL)) != NULL; ++index) + for (int index = 0; (result = ConfigFile::getKeyString("SharedFile", buffer, index, nullptr)) != nullptr; ++index) TreeFile::addSearchPath(result, priority); } @@ -133,7 +133,7 @@ void TreeFile::install(uint32 skuBits) sprintf(buffer, "searchTree%s%d", skuText, priority); char const * result; - for (int index = 0; (result = ConfigFile::getKeyString("SharedFile", buffer, index, NULL)) != NULL; ++index) + for (int index = 0; (result = ConfigFile::getKeyString("SharedFile", buffer, index, nullptr)) != nullptr; ++index) TreeFile::addSearchTree(result, priority); } @@ -143,7 +143,7 @@ void TreeFile::install(uint32 skuBits) sprintf(buffer, "searchTOC%s%d", skuText, priority); char const * result; - for (int index = 0; (result = ConfigFile::getKeyString("SharedFile", buffer, index, NULL)) != NULL; ++index) + for (int index = 0; (result = ConfigFile::getKeyString("SharedFile", buffer, index, nullptr)) != nullptr; ++index) TreeFile::addSearchTOC(result, priority); } } @@ -430,7 +430,7 @@ void TreeFile::removeAllSearches(void) * Find the node (if any) the requested file is in. * * @return Pointer to the highest priority node containing the file. If the - * file is not found, NULL is returned. If checking for filename collisions is + * file is not found, nullptr is returned. If checking for filename collisions is * set on, then this function DEBUG_FATALS if multiple files match */ @@ -440,14 +440,14 @@ TreeFile::SearchNode *TreeFile::find(const char *fileName) if (!fileName) { - DEBUG_WARNING(true, ("TreeFile::find() Cannot find a null filename")); - return NULL; + DEBUG_WARNING(true, ("TreeFile::find() Cannot find a nullptr filename")); + return nullptr; } if (fileName[0] == '\0') { DEBUG_WARNING(true, ("TreeFile::find() Cannot find an empty filename")); - return NULL; + return nullptr; } // search the list of nodes looking to see if the specified file exists @@ -457,7 +457,7 @@ TreeFile::SearchNode *TreeFile::find(const char *fileName) if ((*i)->exists(fileName, deleted)) return *i; - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -479,7 +479,7 @@ bool TreeFile::exists(const char *fileName) FileManifest::addNewManifestEntry(fixedFileName, 0); #endif - return (find(fixedFileName) != NULL); + return (find(fixedFileName) != nullptr); } // ---------------------------------------------------------------------- @@ -621,7 +621,7 @@ void TreeFile::fixUpFileName(const char *fileName, char *outName) * Find the node (if any) the requested file is in. * * @return Pointer to the highest priority node containing the file. If the - * file is not found, NULL is returned. + * file is not found, nullptr is returned. */ bool TreeFile::getPathName(const char *fileName, char *pathName, int pathNameLength) @@ -655,12 +655,12 @@ bool TreeFile::getPathName(const char *fileName, char *pathName, int pathNameLen * * @param fileName File name to open * @param allowFail True to return false on failure, otherwise Fatal - * @return pointer to a newly allocated AbstractFile-derived class (caller must delete), NULL if failure. + * @return pointer to a newly allocated AbstractFile-derived class (caller must delete), nullptr if failure. */ AbstractFile* TreeFile::open(const char *fileName, AbstractFile::PriorityType priority, bool allowFail) { - AbstractFile *file = NULL; + AbstractFile *file = nullptr; char fixedFileName[Os::MAX_PATH_LENGTH]; fixUpFileName(fixedFileName, fileName, true); @@ -678,7 +678,7 @@ AbstractFile* TreeFile::open(const char *fileName, AbstractFile::PriorityType pr if (cachedIterator != cachedFilesMap.end()) { file = cachedIterator->second; - cachedIterator->second = NULL; + cachedIterator->second = nullptr; } ms_criticalSection.leave(); @@ -747,7 +747,7 @@ AbstractFile* TreeFile::open(const char *fileName, AbstractFile::PriorityType pr FileManifest::addNewManifestEntry(fixedFileName, 0); #endif - return NULL; + return nullptr; } const int length = file->length(); @@ -787,7 +787,7 @@ const char *TreeFile::getSearchPath(int index) for (SearchNodes::iterator i = ms_searchNodes.begin(); i != iEnd; ++i) { const SearchPath *searchPath = dynamic_cast(*i); - if (searchPath != NULL) + if (searchPath != nullptr) { if (count == index) return searchPath->getPathName(); @@ -795,14 +795,14 @@ const char *TreeFile::getSearchPath(int index) } } - return NULL; + return nullptr; } //----------------------------------------------------------------- /** * This function will return the shortest trailing path of its input that * can be loaded by the TreeFile. If no files can be loaded, this routine - * will return NULL. + * will return nullptr. */ const char *TreeFile::getShortestExistingPath(const char *path) @@ -810,9 +810,9 @@ const char *TreeFile::getShortestExistingPath(const char *path) NOT_NULL(path); if (!*path) - return NULL; + return nullptr; - const char *result = NULL; + const char *result = nullptr; do { // check if this one exists @@ -866,7 +866,7 @@ bool TreeFile::stripTreeFileSearchPathFromFile(const char *inputPath, char *outp { // make sure it's a relative search path const SearchPath *searchPath = dynamic_cast(*i); - if (searchPath != NULL) + if (searchPath != nullptr) { // check to see if the the search path is a prefix for the requested path const char *path = searchPath->getPathName(); diff --git a/engine/shared/library/sharedFile/src/shared/TreeFile_SearchNode.cpp b/engine/shared/library/sharedFile/src/shared/TreeFile_SearchNode.cpp index 9c63e47d..11c7d2e3 100755 --- a/engine/shared/library/sharedFile/src/shared/TreeFile_SearchNode.cpp +++ b/engine/shared/library/sharedFile/src/shared/TreeFile_SearchNode.cpp @@ -53,7 +53,7 @@ TreeFile::SearchNode::~SearchNode(void) TreeFile::SearchPath::SearchPath(int priority, const char *path) : SearchNode(priority), - m_pathName(NULL), + m_pathName(nullptr), m_pathNameLength(0) { NOT_NULL(path); @@ -145,7 +145,7 @@ AbstractFile *TreeFile::SearchPath::open(const char *fileName, AbstractFile::Pri makeAbsolutePath(fileName, buffer); FileStreamer::File *file = FileStreamer::open(buffer); if (!file) - return NULL; + return nullptr; return new FileStreamerFile(priority, *file); } @@ -209,7 +209,7 @@ AbstractFile *TreeFile::SearchAbsolute::open(const char *fileName, AbstractFile: FileStreamer::File *file = FileStreamer::open(fileName); if (!file) - return NULL; + return nullptr; return new FileStreamerFile(priority, *file); } @@ -248,12 +248,12 @@ bool TreeFile::SearchTree::validate(const char *fileName) TreeFile::SearchTree::SearchTree(int priority, const char *fileName) : SearchNode(priority), - m_treeFileName(NULL), - m_treeFile(NULL), + m_treeFileName(nullptr), + m_treeFile(nullptr), m_version(0), m_numberOfFiles(0), - m_fileNames(NULL), - m_tableOfContents(NULL) + m_fileNames(nullptr), + m_tableOfContents(nullptr) { NOT_NULL(fileName); @@ -435,7 +435,7 @@ void TreeFile::SearchTree::debugPrint(void) bool TreeFile::SearchTree::exists(const char *fileName, bool &deleted) const { NOT_NULL(fileName); - return localExists(fileName, NULL, deleted); + return localExists(fileName, nullptr, deleted); } // ---------------------------------------------------------------------- @@ -497,7 +497,7 @@ AbstractFile *TreeFile::SearchTree::open(const char *fileName, AbstractFile::Pri return new ZlibFile(entry.length, compressedBuffer, entry.compressedLength, true); } - return NULL; + return nullptr; } // ====================================================================== @@ -535,14 +535,14 @@ bool TreeFile::SearchTOC::validate(const char *fileName) TreeFile::SearchTOC::SearchTOC(int priority, const char *fileName) : SearchNode(priority), - m_TOCFileName(NULL), - m_TOCFile(NULL), - m_treeFiles(NULL), + m_TOCFileName(nullptr), + m_TOCFile(nullptr), + m_treeFiles(nullptr), m_numberOfFiles(0), - m_treeFileNames(NULL), - m_treeFileNamePointers(NULL), - m_tableOfContents(NULL), - m_fileNames(NULL) + m_treeFileNames(nullptr), + m_treeFileNamePointers(nullptr), + m_tableOfContents(nullptr), + m_fileNames(nullptr) { NOT_NULL(fileName); @@ -587,7 +587,7 @@ TreeFile::SearchTOC::SearchTOC(int priority, const char *fileName) // add on all paths in config file const char * result; - for (int index = 0; (result = ConfigFile::getKeyString("SharedFile", "TOCTreePath", index, NULL)) != NULL; ++index) + for (int index = 0; (result = ConfigFile::getKeyString("SharedFile", "TOCTreePath", index, nullptr)) != nullptr; ++index) treePaths.push_back(result); // read in the tree file names and open the files @@ -598,7 +598,7 @@ TreeFile::SearchTOC::SearchTOC(int priority, const char *fileName) for (int treeFileNameIndex = 0, treeFileNameReadPosition = 0; treeFileNameIndex < static_cast(header.numberOfTreeFiles); treeFileNameIndex++) { m_treeFileNamePointers[treeFileNameIndex] = (m_treeFileNames + treeFileNameReadPosition); - m_treeFiles[treeFileNameIndex] = NULL; + m_treeFiles[treeFileNameIndex] = nullptr; // try to open the tree file in each of the relative paths for (std::vector::const_iterator pathIter = treePaths.begin(); pathIter != treePaths.end(); ++pathIter) @@ -656,7 +656,7 @@ TreeFile::SearchTOC::SearchTOC(int priority, const char *fileName) { currentFileNameLength = m_tableOfContents[i].fileNameOffset; m_tableOfContents[i].fileNameOffset = currentFileNameOffset; - // + 1 for the null termination + // + 1 for the nullptr termination currentFileNameOffset += (currentFileNameLength + 1); } } @@ -792,7 +792,7 @@ bool TreeFile::SearchTOC::exists(const char *fileName, bool &deleted) const { NOT_NULL(fileName); deleted = false; - return localExists(fileName, NULL); + return localExists(fileName, nullptr); } // ---------------------------------------------------------------------- @@ -862,7 +862,7 @@ AbstractFile *TreeFile::SearchTOC::open(const char *fileName, AbstractFile::Prio return new ZlibFile(entry.length, compressedBuffer, entry.compressedLength, true); } - return NULL; + return nullptr; } // ====================================================================== diff --git a/engine/shared/library/sharedFile/src/shared/ZlibFile.cpp b/engine/shared/library/sharedFile/src/shared/ZlibFile.cpp index 7c3778c7..9a498a87 100755 --- a/engine/shared/library/sharedFile/src/shared/ZlibFile.cpp +++ b/engine/shared/library/sharedFile/src/shared/ZlibFile.cpp @@ -66,7 +66,7 @@ ZlibFile::ZlibFile(int uncompressedLength, byte *compressedBuffer, int compresse m_compressedBuffer(compressedBuffer), m_compressedBufferLength(compressedBufferLength), m_ownsCompressedBuffer(ownsCompressedBuffer), - m_decompressedMemoryFile(NULL) + m_decompressedMemoryFile(nullptr) { } @@ -137,10 +137,10 @@ void ZlibFile::close() { if (m_ownsCompressedBuffer) delete [] m_compressedBuffer; - m_compressedBuffer = NULL; + m_compressedBuffer = nullptr; delete m_decompressedMemoryFile; - m_decompressedMemoryFile = NULL; + m_decompressedMemoryFile = nullptr; } // ---------------------------------------------------------------------- @@ -197,7 +197,7 @@ void ZlibFile::getZlibCompressedDataAndClose(byte *& compressedBuffer, int & com if (m_ownsCompressedBuffer) { compressedBuffer = m_compressedBuffer; - m_compressedBuffer = NULL; + m_compressedBuffer = nullptr; compressedBufferLength = m_compressedBufferLength; } else diff --git a/engine/shared/library/sharedFoundation/src/linux/Os.cpp b/engine/shared/library/sharedFoundation/src/linux/Os.cpp index 2ddccf74..b1e26987 100755 --- a/engine/shared/library/sharedFoundation/src/linux/Os.cpp +++ b/engine/shared/library/sharedFoundation/src/linux/Os.cpp @@ -97,7 +97,7 @@ void Os::installCommon(void) mainThreadId = pthread_self(); // get the name of the executable -//Can't find UNIX call for this: DWORD result = GetModuleFileName(NULL, programName, sizeof(programName)); +//Can't find UNIX call for this: DWORD result = GetModuleFileName(nullptr, programName, sizeof(programName)); strcpy(programName, "TempName"); DWORD result = 1; @@ -119,7 +119,7 @@ void Os::installCommon(void) char buffer[512]; while (!feof(f)) { - if (fgets(buffer, 512, f) != NULL) { + if (fgets(buffer, 512, f) != nullptr) { if (strncmp(buffer, "processor\t: ", 12)==0) { processorCount = atoi(buffer+12)+1; @@ -165,13 +165,13 @@ void Os::abort(void) if (!isMainThread()) { threadDied = true; - pthread_exit(NULL); + pthread_exit(nullptr); } if (!shouldReturnFromAbort) { // let the C runtime deal with the abnormal termination - int * dummy = NULL; + int * dummy = nullptr; int forceCrash = *dummy; UNREF(forceCrash); for (;;) @@ -256,14 +256,14 @@ bool Os::writeFile(const char *fileName, const void *data, int length) // Le DWORD written; // open the file for writing - handle = CreateFile(fileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + handle = CreateFile(fileName, GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); // check if it was opened if (handle == INVALID_HANDLE_VALUE) return false; // attempt to write the data - result = WriteFile(handle, data, static_cast(length), &written, NULL); + result = WriteFile(handle, data, static_cast(length), &written, nullptr); // make sure the data was written okay if (!result || written != static_cast(length)) diff --git a/engine/shared/library/sharedFoundation/src/linux/PerThreadData.cpp b/engine/shared/library/sharedFoundation/src/linux/PerThreadData.cpp index 3d7f8584..18bee813 100755 --- a/engine/shared/library/sharedFoundation/src/linux/PerThreadData.cpp +++ b/engine/shared/library/sharedFoundation/src/linux/PerThreadData.cpp @@ -81,7 +81,7 @@ PerThreadData::Data *PerThreadData::getData(bool allowReturnNull) if (!slotCreated) { DEBUG_FATAL(true && !allowReturnNull, ("not installed")); - return NULL; + return nullptr; } Data * const data = reinterpret_cast(pthread_getspecific(slot)); @@ -97,7 +97,7 @@ PerThreadData::Data *PerThreadData::getData(bool allowReturnNull) * * If the client is calling this function on a thread that existed before the engine was * installed, the client should set isNewThread to false. Setting isNewThread to false - * prevents the function from validating that the thread's TLS is NULL. For threads existing + * prevents the function from validating that the thread's TLS is nullptr. For threads existing * before the engine is installed, the TLS data for the thread is undefined. * * @param isNewThread [IN] true if the thread was created after the engine was installed, false otherwise @@ -147,10 +147,10 @@ void PerThreadData::threadRemove(void) //close the event used for file streaming reads delete data->readGate; - data->readGate = NULL; + data->readGate = nullptr; // wipe the data in the thread slot - const BOOL result2 = pthread_setspecific(slot, NULL); + const BOOL result2 = pthread_setspecific(slot, nullptr); UNREF(result2); DEBUG_FATAL(result2, ("TlsSetValue failed")); //NB: unlike Windows, returns 0 on success. diff --git a/engine/shared/library/sharedFoundation/src/linux/PerThreadData.h b/engine/shared/library/sharedFoundation/src/linux/PerThreadData.h index df4fd5f6..86adef53 100755 --- a/engine/shared/library/sharedFoundation/src/linux/PerThreadData.h +++ b/engine/shared/library/sharedFoundation/src/linux/PerThreadData.h @@ -93,7 +93,7 @@ public: * threads existing at the time of slot creation. Thus, if you build a * plugin that only initializes the engine the first time it is * used, and other threads already exist in the app, those threads - * will contain bogus non-null data in the TLS slot. If the plugin really + * will contain bogus non-nullptr data in the TLS slot. If the plugin really * wants to do lazy initialization of the engine, it will need * to handle calling PerThreadData::threadInstall() for all existing threads * (except the thread that initialized the engine, which already @@ -102,7 +102,7 @@ public: inline bool PerThreadData::isThreadInstalled(void) { - return (getData(true) != NULL); + return (getData(true) != nullptr); } // ---------------------------------------------------------------------- @@ -168,7 +168,7 @@ inline void PerThreadData::setExitChainFataling(bool newValue) * Get the first entry for the exit chain. * * This routine is not intended for general use; it should only be used by the ExitChain class. - * This routine may return NULL. + * This routine may return nullptr. * * @return Pointer to the first entry on the exit chain * @see ExitChain::isFataling() @@ -184,7 +184,7 @@ inline ExitChain::Entry *PerThreadData::getExitChainFirstEntry(void) * Set the exit chain fataling flag value. * * This routine is not intended for general use; it should only be used by the ExitChain class. - * The parameter to this routine may be NULL. + * The parameter to this routine may be nullptr. * * @param newValue New value for the exit chain first entry */ diff --git a/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.cpp b/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.cpp index 21668a79..822a4ee5 100755 --- a/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.cpp +++ b/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.cpp @@ -33,7 +33,7 @@ char* _itoa(int value, char* stringOut, int radix) bool QueryPerformanceCounter(__int64* time) { struct timeval tv; - gettimeofday(&tv, NULL); + gettimeofday(&tv, nullptr); *time = static_cast(tv.tv_sec); *time = (*time * 1000000) + static_cast(tv.tv_usec); @@ -107,7 +107,7 @@ FILE* CreateFile(const char* fileName, DWORD access, DWORD shareMode, void* unsu FILE* retval = 0; DEBUG_FATAL(flagsAndAttributes != FILE_ATTRIBUTE_NORMAL, ("Unsupported File mode call to CreateFile()")); - DEBUG_FATAL(unsupB != NULL, ("Unsupported File mode call to CreateFile()")); + DEBUG_FATAL(unsupB != nullptr, ("Unsupported File mode call to CreateFile()")); //DEBUG_FATAL(shareMode != 0, ("Unsupported File mode call to CreateFile()")); DEBUG_FATAL(unsupA != 0, ("Unsupported File mode call to CreateFile()")); @@ -118,7 +118,7 @@ FILE* CreateFile(const char* fileName, DWORD access, DWORD shareMode, void* unsu if (retval) { fclose(retval); - retval = NULL; + retval = nullptr; } else { diff --git a/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.h b/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.h index 5e92921c..0cab423f 100755 --- a/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.h +++ b/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.h @@ -46,7 +46,7 @@ void OutputDebugString(const char* stringOut); typedef FILE* HANDLE; -#define INVALID_HANDLE_VALUE NULL //Have to use a #define because this may be a FILE* +#define INVALID_HANDLE_VALUE nullptr //Have to use a #define because this may be a FILE* const int GENERIC_READ = 1 << 0; @@ -66,8 +66,8 @@ const int FILE_END = SEEK_END; const int FILE_SHARE_READ = 1; -BOOL WriteFile(FILE* hFile, const void* lpBuffer, DWORD numBytesToWrite, DWORD* numBytesWritten, void* unsup=NULL); -BOOL ReadFile(FILE* hFile, void* lpBuffer, DWORD numBytesToWrite, DWORD* numBytesRead, void* unsup=NULL); +BOOL WriteFile(FILE* hFile, const void* lpBuffer, DWORD numBytesToWrite, DWORD* numBytesWritten, void* unsup=nullptr); +BOOL ReadFile(FILE* hFile, void* lpBuffer, DWORD numBytesToWrite, DWORD* numBytesRead, void* unsup=nullptr); DWORD SetFilePointer(FILE* hFile, long lDistanceToMove, long* lpDistanceToMoveHigh, DWORD dwMoveMethod); FILE* CreateFile(const char* fileName, DWORD access, DWORD shareMode, void* unsupA, DWORD creationDisposition, DWORD flagsAndAttributes, FILE* unsup2); BOOL CloseHandle(FILE* hFile); diff --git a/engine/shared/library/sharedFoundation/src/linux/SetupSharedFoundation.cpp b/engine/shared/library/sharedFoundation/src/linux/SetupSharedFoundation.cpp index 07dec783..e54017fc 100755 --- a/engine/shared/library/sharedFoundation/src/linux/SetupSharedFoundation.cpp +++ b/engine/shared/library/sharedFoundation/src/linux/SetupSharedFoundation.cpp @@ -150,11 +150,11 @@ SetupSharedFoundation::Data::Data(Defaults defaults) case D_game: runInBackground = true; - lpCmdLine = NULL; + lpCmdLine = nullptr; argc = 0; - argv = NULL; + argv = nullptr; - configFile = NULL; + configFile = nullptr; frameRateLimit = CONST_REAL(0); break; @@ -162,11 +162,11 @@ SetupSharedFoundation::Data::Data(Defaults defaults) case D_console: runInBackground = true; - lpCmdLine = NULL; + lpCmdLine = nullptr; argc = 0; - argv = NULL; + argv = nullptr; - configFile = NULL; + configFile = nullptr; frameRateLimit = CONST_REAL(0); break; diff --git a/engine/shared/library/sharedFoundation/src/linux/vsnprintf.cpp b/engine/shared/library/sharedFoundation/src/linux/vsnprintf.cpp index 6b4c5647..069dcb48 100755 --- a/engine/shared/library/sharedFoundation/src/linux/vsnprintf.cpp +++ b/engine/shared/library/sharedFoundation/src/linux/vsnprintf.cpp @@ -21,7 +21,7 @@ // // Remarks: // -// If the buffer would overflow, the null terminating character is not written and -1 +// If the buffer would overflow, the nullptr terminating character is not written and -1 // will be returned. #ifdef _MSC_VER diff --git a/engine/shared/library/sharedFoundation/src/shared/BitArray.cpp b/engine/shared/library/sharedFoundation/src/shared/BitArray.cpp index f094d140..502b31a7 100755 --- a/engine/shared/library/sharedFoundation/src/shared/BitArray.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/BitArray.cpp @@ -35,7 +35,7 @@ m_numInUseBits(0) { if (numBits > (m_numAllocatedBytes << 3)) { - m_arrayData = NULL; + m_arrayData = nullptr; m_numAllocatedBytes = 0; reserve(numBits); m_numInUseBytes = 0; @@ -294,7 +294,7 @@ void BitArray::reserve(int const numBits) { signed char * tmp = new signed char[static_cast(m_numInUseBytes)]; memset(&(tmp[oldNumInUseBytes]), 0, static_cast(m_numInUseBytes - oldNumInUseBytes)); - if ((oldNumInUseBytes > 0) && (m_arrayData != NULL)) + if ((oldNumInUseBytes > 0) && (m_arrayData != nullptr)) memcpy(tmp, m_arrayData, static_cast(oldNumInUseBytes)); //lint !e671 !e670 logically, you can't enter this code block unless oldNumInUseBytes is smaller. m_numAllocatedBytes = m_numInUseBytes; diff --git a/engine/shared/library/sharedFoundation/src/shared/BitArray.h b/engine/shared/library/sharedFoundation/src/shared/BitArray.h index 70b04b41..082fa6b4 100755 --- a/engine/shared/library/sharedFoundation/src/shared/BitArray.h +++ b/engine/shared/library/sharedFoundation/src/shared/BitArray.h @@ -58,7 +58,7 @@ public: // for DB persistence purpose, returns the BitArray as a // std::string where each 4 bits are printed as a hex nibble; - // and the converse that takes the null-terminated string + // and the converse that takes the nullptr-terminated string // and converts it back into the BitArray void getAsDbTextString(std::string &result, int maxNibbleCount = 32767) const; void setFromDbTextString(const char * text); diff --git a/engine/shared/library/sharedFoundation/src/shared/CalendarTime.cpp b/engine/shared/library/sharedFoundation/src/shared/CalendarTime.cpp index 64595534..c73395af 100755 --- a/engine/shared/library/sharedFoundation/src/shared/CalendarTime.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/CalendarTime.cpp @@ -17,11 +17,11 @@ std::string CalendarTime::convertEpochToTimeStringGMT(time_t epoch) std::string result; struct tm * timeinfo = ::gmtime(&epoch); - if (timeinfo == NULL) + if (timeinfo == nullptr) return result; char * asciiTime = ::asctime(timeinfo); - if (asciiTime == NULL) + if (asciiTime == nullptr) return result; static char resultBuffer[512]; @@ -48,7 +48,7 @@ std::string CalendarTime::convertEpochToTimeStringGMT_YYYYMMDDHHMMSS(time_t epoc std::string result; struct tm * timeinfo = ::gmtime(&epoch); - if (timeinfo == NULL) + if (timeinfo == nullptr) return result; static char resultBuffer[512]; @@ -64,11 +64,11 @@ std::string CalendarTime::convertEpochToTimeStringLocal(time_t epoch) std::string result; struct tm * timeinfo = ::localtime(&epoch); - if (timeinfo == NULL) + if (timeinfo == nullptr) return result; char * asciiTime = ::asctime(timeinfo); - if (asciiTime == NULL) + if (asciiTime == nullptr) return result; static char resultBuffer[512]; @@ -105,7 +105,7 @@ std::string CalendarTime::convertEpochToTimeStringLocal_YYYYMMDDHHMMSS(time_t ep std::string result; struct tm * timeinfo = ::localtime(&epoch); - if (timeinfo == NULL) + if (timeinfo == nullptr) return result; static char resultBuffer[512]; @@ -218,7 +218,7 @@ time_t CalendarTime::getNextGMTTimeOcurrence(time_t const startTime, int const d // the year, month, day, day of week, hour, minute, second // in GMT time struct tm * timeinfo = ::gmtime(&startTime); - if (timeinfo == NULL) + if (timeinfo == nullptr) return -1; // get number of days until the specified day of week to search for @@ -333,7 +333,7 @@ time_t CalendarTime::getNextGMTTimeOcurrence(time_t const startTime, int const m // the year, month, day, day of week, hour, minute, second // in GMT time struct tm * timeinfo = ::gmtime(&startTime); - if (timeinfo == NULL) + if (timeinfo == nullptr) return -1; // calculate the Epoch GMT time for the specified start time @@ -358,7 +358,7 @@ time_t CalendarTime::getNextGMTTimeOcurrence(time_t const startTime, int const m startTimeAtSpecifiedHourMinuteSecond += (60 * 60 * 24); timeinfo = ::gmtime(&startTimeAtSpecifiedHourMinuteSecond); - if (timeinfo == NULL) + if (timeinfo == nullptr) return -1; if (++sentinel > maxIterations) diff --git a/engine/shared/library/sharedFoundation/src/shared/CommandLine.cpp b/engine/shared/library/sharedFoundation/src/shared/CommandLine.cpp index 1198c252..5209d788 100755 --- a/engine/shared/library/sharedFoundation/src/shared/CommandLine.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/CommandLine.cpp @@ -63,7 +63,7 @@ bool CommandLine::Option::isOptionNext( int optionSpecCount ) { - DEBUG_FATAL(!optionSpec, ("null optionSpec arg")); + DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg")); if (!optionSpecCount) return false; else @@ -77,8 +77,8 @@ CommandLine::Option *CommandLine::Option::createOption( int *optionCount ) { - DEBUG_FATAL(!optionSpec, ("null optionSpec arg")); - DEBUG_FATAL(!optionCount, ("null optionCount arg")); + DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg")); + DEBUG_FATAL(!optionCount, ("nullptr optionCount arg")); DEBUG_FATAL(!isOptionNext(*optionSpec, *optionCount), ("attempted to create option with non-option data")); const char newShortName = (*optionSpec)->char1; @@ -129,7 +129,7 @@ CommandLine::MatchCode CommandLine::Option::match(void) // matching this short or long name. If the arg specs don't match, we've // got an argument matching error. - DEBUG_FATAL(!optionTable, ("internal error: null option table")); + DEBUG_FATAL(!optionTable, ("internal error: nullptr option table")); OptionTable::Record *record = 0; @@ -145,7 +145,7 @@ CommandLine::MatchCode CommandLine::Option::match(void) DEBUG_FATAL(!record, ("failed to find option info record for option --%s", longName)); } else - DEBUG_FATAL(true, ("corrupted option? both short and long name are null")); + DEBUG_FATAL(true, ("corrupted option? both short and long name are nullptr")); // attempt to match against this option against commandline-specified options @@ -200,7 +200,7 @@ bool CommandLine::Collection::isCollectionNext( int optionSpecCount ) { - DEBUG_FATAL(!optionSpec, ("null optionSpec arg")); + DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg")); if (!optionSpecCount) return false; else @@ -214,8 +214,8 @@ CommandLine::Collection *CommandLine::Collection::createCollection( int *optionSpecCount ) { - DEBUG_FATAL(!optionSpec, ("null optionSpec arg")); - DEBUG_FATAL(!optionSpecCount, ("null optionSpecCount arg")); + DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg")); + DEBUG_FATAL(!optionSpecCount, ("nullptr optionSpecCount arg")); DEBUG_FATAL(!isCollectionNext(*optionSpec, *optionSpecCount), ("tried to create collection from non-collection optionSpec")); if ((*optionSpec)->optionType == OST_BeginList) @@ -289,7 +289,7 @@ bool CommandLine::List::Node::isNode( int optionCount ) { - DEBUG_FATAL(!optionSpec, ("null optionSpec arg")); + DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg")); if (!optionCount) return false; else @@ -303,8 +303,8 @@ CommandLine::List::Node *CommandLine::List::Node::createNode( int *optionCount ) { - DEBUG_FATAL(!optionSpec, ("null optionSpec arg")); - DEBUG_FATAL(!optionCount, ("null optionCount arg")); + DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg")); + DEBUG_FATAL(!optionCount, ("nullptr optionCount arg")); DEBUG_FATAL(!isNode(*optionSpec, *optionCount), ("attempted to create list node with non-list-node data")); Option *newOption = 0; @@ -350,7 +350,7 @@ CommandLine::List::List( listType(newListType), minimumNodeCount(0) { - DEBUG_FATAL(!newFirstNode, ("null newFirstNode arg")); + DEBUG_FATAL(!newFirstNode, ("nullptr newFirstNode arg")); DEBUG_FATAL(newListType != OPLT_Normal, ("constructor only good for OPLT_Normal lists, caller passed %d", newListType)); } @@ -366,7 +366,7 @@ CommandLine::List::List( listType(newListType), minimumNodeCount(newMinimumNodeCount) { - DEBUG_FATAL(!newFirstNode, ("null newFirstNode arg")); + DEBUG_FATAL(!newFirstNode, ("nullptr newFirstNode arg")); DEBUG_FATAL(newListType != OPLT_MinimumMatch, ("constructor only good for OPLT_MinimumMatch lists, caller passed %d", newListType)); } @@ -391,7 +391,7 @@ bool CommandLine::List::isListNext( int optionCount ) { - DEBUG_FATAL(!optionSpec, ("null optionSpec arg")); + DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg")); if (!optionCount) return false; else @@ -405,8 +405,8 @@ CommandLine::List *CommandLine::List::createList( int *optionCount ) { - DEBUG_FATAL(!optionSpec, ("null optionSpec arg")); - DEBUG_FATAL(!optionCount, ("null optionCount arg")); + DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg")); + DEBUG_FATAL(!optionCount, ("nullptr optionCount arg")); DEBUG_FATAL(!isListNext(*optionSpec, *optionCount), ("tried to create list from non-list optionSpec")); Node *newFirstNode = 0; @@ -582,7 +582,7 @@ bool CommandLine::Switch::Node::isNode( const OptionSpec *optionSpec, int optionCount) { - DEBUG_FATAL(!optionSpec, ("null optionSpec arg")); + DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg")); if (!optionCount) return false; else @@ -596,8 +596,8 @@ CommandLine::Switch::Node *CommandLine::Switch::Node::createNode( int *optionCount ) { - DEBUG_FATAL(!optionSpec, ("null optionSpec arg")); - DEBUG_FATAL(!optionCount, ("null optionCount arg")); + DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg")); + DEBUG_FATAL(!optionCount, ("nullptr optionCount arg")); DEBUG_FATAL(!isNode(*optionSpec, *optionCount), ("attempted to create list node with non-list-node data")); Option *newOption = 0; @@ -664,7 +664,7 @@ bool CommandLine::Switch::isSwitchNext( int optionCount ) { - DEBUG_FATAL(!optionSpec, ("null optionSpec arg")); + DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg")); if (!optionCount) return false; else @@ -678,8 +678,8 @@ CommandLine::Switch *CommandLine::Switch::createSwitch( int *optionCount ) { - DEBUG_FATAL(!optionSpec, ("null optionSpec arg")); - DEBUG_FATAL(!optionCount, ("null optionCount arg")); + DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg")); + DEBUG_FATAL(!optionCount, ("nullptr optionCount arg")); DEBUG_FATAL(!isSwitchNext(*optionSpec, *optionCount), ("tried to create switch from non-switch option spec")); const bool newOneNodeIsRequired = ((*optionSpec)->int1 != 0); @@ -886,7 +886,7 @@ CommandLine::OptionTable::Record *CommandLine::OptionTable::findOptionRecord( char shortName ) const { - DEBUG_FATAL(!shortName, ("null shortName arg")); + DEBUG_FATAL(!shortName, ("nullptr shortName arg")); // walk the list for (Record *record = firstRecord; record; record = record->getNext()) @@ -960,7 +960,7 @@ CommandLine::Lexer::Lexer( ) : nextCharacter(newBuffer) { - DEBUG_FATAL(!newBuffer, ("null newBuffer arg")); + DEBUG_FATAL(!newBuffer, ("nullptr newBuffer arg")); } // ---------------------------------------------------------------------- @@ -994,10 +994,10 @@ CommandLine::Lexer::~Lexer(void) bool CommandLine::Lexer::gobbleString(bool isRequired, char *stringBuffer, int stringSize) { - DEBUG_FATAL(!stringBuffer, ("null stringStart arg")); + DEBUG_FATAL(!stringBuffer, ("nullptr stringStart arg")); DEBUG_FATAL(!stringSize, ("stringSize is zero")); - DEBUG_FATAL(!nextCharacter, ("null nextChar")); + DEBUG_FATAL(!nextCharacter, ("nullptr nextChar")); int stringLength = 0; @@ -1069,7 +1069,7 @@ bool CommandLine::Lexer::gobbleString(bool isRequired, char *stringBuffer, int s if (isRequired && (stringLength == 0)) return false; - // null-terminate the string + // nullptr-terminate the string *stringBuffer = 0; return true; } @@ -1078,8 +1078,8 @@ bool CommandLine::Lexer::gobbleString(bool isRequired, char *stringBuffer, int s bool CommandLine::Lexer::getNextToken(Token *token) { - DEBUG_FATAL(!token, ("null token arg")); - DEBUG_FATAL(!nextCharacter, ("null nextCharacter")); + DEBUG_FATAL(!token, ("nullptr token arg")); + DEBUG_FATAL(!nextCharacter, ("nullptr nextCharacter")); // clear out the token memset(token, 0, sizeof(*token)); @@ -1204,7 +1204,7 @@ void CommandLine::remove(void) void CommandLine::buildOptionTree(const OptionSpec *specList, int specCount) { - DEBUG_FATAL(!specList, ("null specList arg")); + DEBUG_FATAL(!specList, ("nullptr specList arg")); if (!specCount) { @@ -1247,7 +1247,7 @@ CommandLine::MatchCode CommandLine::parseCommandLineBuffer(void) case Lexer::TT_ShortOption: // we've found a short option, make sure specified short option exists { - DEBUG_FATAL(!optionTable, ("internal error: null optionTable")); + DEBUG_FATAL(!optionTable, ("internal error: nullptr optionTable")); OptionTable::Record *record = optionTable->findOptionRecord(token.getShortName()); if (!record) { @@ -1279,7 +1279,7 @@ CommandLine::MatchCode CommandLine::parseCommandLineBuffer(void) case Lexer::TT_LongOption: // we've found a long option, make sure specified long option exists { - DEBUG_FATAL(!optionTable, ("internal error: null optionTable")); + DEBUG_FATAL(!optionTable, ("internal error: nullptr optionTable")); OptionTable::Record *record = optionTable->findOptionRecord(token.getLongName()); if (!record) { @@ -1322,7 +1322,7 @@ CommandLine::MatchCode CommandLine::parseCommandLineBuffer(void) case Lexer::TT_Argument: { - DEBUG_FATAL(!optionTable, ("internal error: null optionTable")); + DEBUG_FATAL(!optionTable, ("internal error: nullptr optionTable")); OptionTable::Record *record = optionTable->findOptionRecord(OP_SNAME_UNTAGGED); if (!record) { @@ -1382,7 +1382,7 @@ CommandLine::MatchCode CommandLine::parseCommandLineBuffer(void) void CommandLine::absorbString(const char *newString) { DEBUG_FATAL(!installed, ("CommandLine not installed")); - DEBUG_FATAL(!newString, ("null newString arg")); + DEBUG_FATAL(!newString, ("nullptr newString arg")); const int stringLength = static_cast(strlen(newString)); int requiredBufferSpace; @@ -1398,7 +1398,7 @@ void CommandLine::absorbString(const char *newString) buffer[bufferSize++] = ' '; } - // copy contents of buffer, including null + // copy contents of buffer, including nullptr memcpy(buffer + bufferSize, newString, stringLength + 1); bufferSize += stringLength; @@ -1437,7 +1437,7 @@ void CommandLine::absorbString(const char *newString) void CommandLine::absorbStrings(const char **stringArray, int stringCount) { DEBUG_FATAL(!installed, ("CommandLine not installed")); - DEBUG_FATAL(!stringArray, ("null string array")); + DEBUG_FATAL(!stringArray, ("nullptr string array")); for (int i = 0; i < stringCount; ++i) absorbString(stringArray[i]); @@ -1452,7 +1452,7 @@ void CommandLine::absorbStrings(const char **stringArray, int stringCount) * (i.e. "-- ") will be considered part of the post command line string. * * @return A read-only pointer to the portion of the command line not meant - * for CommandLine parsing. May be NULL if the entire command line + * for CommandLine parsing. May be nullptr if the entire command line * was meant for CommandLine or if no command line was specified. */ @@ -1704,7 +1704,7 @@ int CommandLine::getOccurrenceCount(const char *longName) * @param shortName [IN] short name of the option * @param occurrenceIndex [IN] zero-based occurrence number * @return The read-only argument string associated with the specified option occurrence. - * May be NULL if no argument was associated with the specified option. + * May be nullptr if no argument was associated with the specified option. */ const char *CommandLine::getOptionString(char shortName, int occurrenceIndex) @@ -1730,7 +1730,7 @@ const char *CommandLine::getOptionString(char shortName, int occurrenceIndex) * @param longName [IN] long name of the option * @param occurrenceIndex [IN] zero-based occurrence number * @return The read-only argument string associated with the specified option occurrence. - * May be NULL if no argument was associated with the specified option. + * May be nullptr if no argument was associated with the specified option. */ const char *CommandLine::getOptionString(const char *longName, int occurrenceIndex) diff --git a/engine/shared/library/sharedFoundation/src/shared/CommandLine.h b/engine/shared/library/sharedFoundation/src/shared/CommandLine.h index 358b2e40..d4eab6a0 100755 --- a/engine/shared/library/sharedFoundation/src/shared/CommandLine.h +++ b/engine/shared/library/sharedFoundation/src/shared/CommandLine.h @@ -755,7 +755,7 @@ inline const char *CommandLine::Lexer::getNextCharacter(void) inline void CommandLine::Lexer::gobbleWhitespace(void) { - DEBUG_FATAL(!nextCharacter, ("null nextCharacter")); + DEBUG_FATAL(!nextCharacter, ("nullptr nextCharacter")); while (isspace(*nextCharacter)) ++nextCharacter; } diff --git a/engine/shared/library/sharedFoundation/src/shared/ConfigFile.cpp b/engine/shared/library/sharedFoundation/src/shared/ConfigFile.cpp index 341f83e3..07c04692 100755 --- a/engine/shared/library/sharedFoundation/src/shared/ConfigFile.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/ConfigFile.cpp @@ -30,7 +30,7 @@ static char tagBuffer[6]; #define CONFIG_FILE_TEMPLATE_CREATE_INT(section, key, def) DEBUG_REPORT_LOG(true, ("cfg: [%s] %s=%d\n", section, key, def)) #define CONFIG_FILE_TEMPLATE_CREATE_BOOL(section, key, def) DEBUG_REPORT_LOG(true, ("cfg: [%s] %s=%s\n", section, key, def ? "true" : "false")) #define CONFIG_FILE_TEMPLATE_CREATE_FLOAT(section, key, def) DEBUG_REPORT_LOG(true, ("cfg: [%s] %s=%3.1f\n", section, key, def)) -#define CONFIG_FILE_TEMPLATE_CREATE_STRING(section, key, def) DEBUG_REPORT_LOG(true, ("cfg: [%s] %s=%s\n", section, key, def ? def : "NULL")) +#define CONFIG_FILE_TEMPLATE_CREATE_STRING(section, key, def) DEBUG_REPORT_LOG(true, ("cfg: [%s] %s=%s\n", section, key, def ? def : "nullptr")) #define CONFIG_FILE_TEMPLATE_CREATE_TAG(section, key, def) ConvertTagToString(def, tagBuffer), DEBUG_REPORT_LOG(true, ("cfg: [%s] %s=%d\n", section, key, tagBuffer)) #else @@ -43,8 +43,8 @@ static char tagBuffer[6]; #endif -#define NO_SPACE_SECTION(a) DEBUG_FATAL(strchr(a, ' ') != NULL, ("No spaces are allowed in config file section names: %s", a)) -#define NO_SPACE_KEY(a) DEBUG_FATAL(strchr(a, ' ') != NULL, ("No spaces are allowed in config file key names: %s", a)) +#define NO_SPACE_SECTION(a) DEBUG_FATAL(strchr(a, ' ') != nullptr, ("No spaces are allowed in config file section names: %s", a)) +#define NO_SPACE_KEY(a) DEBUG_FATAL(strchr(a, ' ') != nullptr, ("No spaces are allowed in config file key names: %s", a)) // ====================================================================== @@ -81,7 +81,7 @@ void ConfigFile::install(void) #endif ms_sections = new ConfigFile::SectionMap; - ms_currentSection = NULL; + ms_currentSection = nullptr; ExitChain::add(ConfigFile::remove, "ConfigFile::remove"); ms_installed = true; } @@ -110,7 +110,7 @@ void ConfigFile::remove(void) for (std::map::iterator it = ms_sections->begin(); it != ms_sections->end(); ++it) delete it->second; delete ms_sections; - ms_sections = NULL; + ms_sections = nullptr; ms_installed = false; } @@ -142,7 +142,7 @@ bool ConfigFile::loadFromCommandLine(const char *buffer) while (isspace(*buffer)) { ++buffer; - // advancing buffer, check for null (trailing white space on command line) + // advancing buffer, check for nullptr (trailing white space on command line) if(! *buffer) break; } @@ -196,7 +196,7 @@ bool ConfigFile::loadFromCommandLine(const char *buffer) //allocate a new section and set it as the current one Section *newSection = createSection(sectionName); //note that newSection is memory owned by the created Section object - //while sectionName is memory allocated to create a null terminated string + //while sectionName is memory allocated to create a nullptr terminated string ms_currentSection = newSection; } delete[] sectionName; @@ -292,7 +292,7 @@ bool ConfigFile::loadFromBuffer(char const * const buffer, int const length) processLine(currentLine); delete[] currentLine; bufferPosition += lineLength+1; - //trim ending whitespace. Remember that this string is not guaranteed to be NULL terminated. + //trim ending whitespace. Remember that this string is not guaranteed to be nullptr terminated. while (*bufferPosition && (bufferPosition < buffer + length) && isspace(static_cast(*bufferPosition))) ++bufferPosition; } @@ -311,26 +311,26 @@ bool ConfigFile::loadFile(const char *file) { DEBUG_FATAL(!ms_installed, ("ConfigFile not installed")); NOT_NULL(file); - ms_currentSection = NULL; - HANDLE handle = CreateFile(file, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + ms_currentSection = nullptr; + HANDLE handle = CreateFile(file, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); if (handle != INVALID_HANDLE_VALUE) { // get the length of the config file - const DWORD length = GetFileSize(handle, NULL); + const DWORD length = GetFileSize(handle, nullptr); if (length != 0xffffffff) { // create a buffer to load the config file into char * const buffer = new char[length+2]; - // make sure the buffer is null terminated + // make sure the buffer is nullptr terminated buffer[length] = '\n'; buffer[length+1] = '\0'; // read the config file in DWORD readResult; - const BOOL result = ReadFile(handle, buffer, length, &readResult, NULL); + const BOOL result = ReadFile(handle, buffer, length, &readResult, nullptr); // make sure we read all the correct stuff if (result && readResult == length) @@ -360,7 +360,7 @@ void ConfigFile::processLine(const char *line) { DEBUG_FATAL(!ms_installed, ("ConfigFile not installed")); // validate argument - DEBUG_FATAL(!line, ("ConfigFile::processLine NULL")); + DEBUG_FATAL(!line, ("ConfigFile::processLine nullptr")); // check for a full line comment if (*line == '#' || *line == ';') @@ -418,7 +418,7 @@ void ConfigFile::processLine(const char *line) //allocate a new section and set it as the current one Section *newSection = createSection(sectionName); //note that newSection is memory owned by the created Section object - //while sectionName is memory allocated to create a null terminated string + //while sectionName is memory allocated to create a nullptr terminated string ms_currentSection = newSection; } delete[] sectionName; @@ -468,7 +468,7 @@ void ConfigFile::processKeys(const char *line) while (*endValue) { //build the value - char *value = NULL; + char *value = nullptr; while(isspace(*beginValue)) ++beginValue; if (*beginValue != '"') @@ -542,7 +542,7 @@ void ConfigFile::processKeys(const char *line) /** Get a Section pointer from a string * * @param section the name of the section - * @return the pointer if valid, otherwise NULL + * @return the pointer if valid, otherwise nullptr */ ConfigFile::Section *ConfigFile::getSection(const char *section) { @@ -550,7 +550,7 @@ ConfigFile::Section *ConfigFile::getSection(const char *section) if (it != ms_sections->end()) return it->second; - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -581,7 +581,7 @@ void ConfigFile::removeSection(const char *name) if (iter != ms_sections->end()) { delete iter->second; - iter->second = NULL; + iter->second = nullptr; ms_sections->erase(iter); } } @@ -991,7 +991,7 @@ Tag ConfigFile::getKeyTag(const char *section, const char *key, Tag defaultValue ConfigFile::Element::Element(void) : - m_entry(NULL) + m_entry(nullptr) {} // ---------------------------------------------------------------------- @@ -1105,8 +1105,8 @@ Tag ConfigFile::Element::getAsTag(void) const ConfigFile::Key::Key(const char *name, const char *value, bool lazyAdd) : - m_elements(NULL), - m_name(NULL), + m_elements(nullptr), + m_name(nullptr), m_lazyAdd(lazyAdd) { m_name = new char[strlen(name)+1]; @@ -1248,8 +1248,8 @@ void ConfigFile::Key::dump(const char *keyName) const ConfigFile::Section::Section(const char *name) : - m_keys(NULL), - m_name(NULL) + m_keys(nullptr), + m_name(nullptr) { m_name = new char[strlen(name)+1]; strcpy(m_name, name); @@ -1284,7 +1284,7 @@ ConfigFile::Key *ConfigFile::Section::findKey(const char *key) const if (it != m_keys->end()) return it->second; - return NULL; + return nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedFoundation/src/shared/ConfigFile.h b/engine/shared/library/sharedFoundation/src/shared/ConfigFile.h index a4c034ed..09a78599 100755 --- a/engine/shared/library/sharedFoundation/src/shared/ConfigFile.h +++ b/engine/shared/library/sharedFoundation/src/shared/ConfigFile.h @@ -99,7 +99,7 @@ public: int getKeyInt (const char *key, int index, int defaultValue = 0) const; bool getKeyBool (const char *key, int index, bool defaultValue = false) const; float getKeyFloat (const char *key, int index, float defaultValue = 0.f) const; - const char *getKeyString(const char *key, int index, const char *defaultValue = NULL) const; + const char *getKeyString(const char *key, int index, const char *defaultValue = nullptr) const; Tag getKeyTag (const char *key, int index, Tag defaultValue = 0) const; int getKeyCount(const char *key) const; void addKey(const char *keyName, const char *value, bool lazyAdd = false); diff --git a/engine/shared/library/sharedFoundation/src/shared/CrashReportInformation.cpp b/engine/shared/library/sharedFoundation/src/shared/CrashReportInformation.cpp index 920f1ffa..983fd7ff 100755 --- a/engine/shared/library/sharedFoundation/src/shared/CrashReportInformation.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/CrashReportInformation.cpp @@ -87,7 +87,7 @@ char const * CrashReportInformation::getEntry(int index) if (index < static_cast(ms_dynamicText.size())) return ms_dynamicText[index]; - return NULL; + return nullptr; } // ====================================================================== diff --git a/engine/shared/library/sharedFoundation/src/shared/Crc.cpp b/engine/shared/library/sharedFoundation/src/shared/Crc.cpp index 4fddb3b8..28ef3514 100755 --- a/engine/shared/library/sharedFoundation/src/shared/Crc.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/Crc.cpp @@ -99,7 +99,7 @@ uint32 Crc::calculateWithToLower(const char *string) uint32 Crc::calculate(const void *data, int length, uint32 initCrc) { - DEBUG_FATAL(!data, ("null data arg")); + DEBUG_FATAL(!data, ("nullptr data arg")); uint32 crc; const byte *d = reinterpret_cast(data); diff --git a/engine/shared/library/sharedFoundation/src/shared/CrcStringTable.cpp b/engine/shared/library/sharedFoundation/src/shared/CrcStringTable.cpp index 206f0dea..9e8ca2b6 100755 --- a/engine/shared/library/sharedFoundation/src/shared/CrcStringTable.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/CrcStringTable.cpp @@ -31,9 +31,9 @@ using namespace CrcStringTableNamespace; CrcStringTable::CrcStringTable() : m_numberOfEntries(0), - m_crcTable(NULL), - m_stringsOffsetTable(NULL), - m_strings(NULL) + m_crcTable(nullptr), + m_stringsOffsetTable(nullptr), + m_strings(nullptr) { } @@ -42,9 +42,9 @@ CrcStringTable::CrcStringTable() CrcStringTable::CrcStringTable(char const * fileName) : m_numberOfEntries(0), - m_crcTable(NULL), - m_stringsOffsetTable(NULL), - m_strings(NULL) + m_crcTable(nullptr), + m_stringsOffsetTable(nullptr), + m_strings(nullptr) { load(fileName); } @@ -69,7 +69,7 @@ void CrcStringTable::load(char const * fileName) if(fileName) DEBUG_WARNING(true, ("Could not load CrcStringTable %s", fileName)); else - DEBUG_WARNING(true, ("Could not load CrcStringTable, NULL file given")); + DEBUG_WARNING(true, ("Could not load CrcStringTable, nullptr file given")); return; } diff --git a/engine/shared/library/sharedFoundation/src/shared/DataResourceList.h b/engine/shared/library/sharedFoundation/src/shared/DataResourceList.h index c5574f7f..a86629e5 100755 --- a/engine/shared/library/sharedFoundation/src/shared/DataResourceList.h +++ b/engine/shared/library/sharedFoundation/src/shared/DataResourceList.h @@ -82,7 +82,7 @@ private: template inline void DataResourceList::install() { - if (ms_bindings == NULL) + if (ms_bindings == nullptr) { ms_bindings = new CreateDataResourceMap(); ms_loaded = new LoadedDataResourceMap(); @@ -100,7 +100,7 @@ inline void DataResourceList::install() template inline void DataResourceList::remove(void) { - if (ms_loaded != NULL) + if (ms_loaded != nullptr) { #ifdef _DEBUG if (!ms_loaded->empty()) @@ -122,13 +122,13 @@ inline void DataResourceList::remove(void) #endif // _DEBUG delete ms_loaded; - ms_loaded = NULL; + ms_loaded = nullptr; } - if (ms_bindings != NULL) + if (ms_bindings != nullptr) { delete ms_bindings; - ms_bindings = NULL; + ms_bindings = nullptr; } } // DataResourceList::remove @@ -144,7 +144,7 @@ template inline void DataResourceList::registerTemplate(Tag id, CreateDataResourceFunc createFunc) { - if (ms_bindings == NULL) + if (ms_bindings == nullptr) install(); #ifdef _DEBUG @@ -237,7 +237,7 @@ inline T * DataResourceList::fetch(Tag id) typename CreateDataResourceMap::iterator iter = ms_bindings->find(id); if (iter == ms_bindings->end()) - return NULL; + return nullptr; return (*(*iter).second)(""); } // DataResourceList::fetch(Tag) @@ -268,11 +268,11 @@ inline const T * DataResourceList::fetch(Iff &source) char buffer[5]; ConvertTagToString(id, buffer); DEBUG_WARNING(true, ("DataResourceList::fetch Iff: trying to fetch resource for unknown tag %s!", buffer)); - return NULL; + return nullptr; } T *newDataResource = (*(*createIter).second)(source.getFileName()); - if (newDataResource != NULL) + if (newDataResource != nullptr) { // initialize the data resource newDataResource->loadFromIff(source); @@ -310,11 +310,11 @@ inline const T * DataResourceList::fetch(const CrcString &filename) // load the template Iff iff; if (!iff.open(filename.getString(), true)) - return NULL; + return nullptr; // put the template in the loaded list const T * const newDataResource = fetch(iff); - if (newDataResource != NULL) + if (newDataResource != nullptr) { newDataResource->addReference(); ms_loaded->insert(std::make_pair(&newDataResource->getCrcName (), newDataResource)); @@ -337,13 +337,13 @@ inline void DataResourceList::release(const T & dataResource) { NOT_NULL(ms_loaded); - if (ms_loaded != NULL && dataResource.getReferenceCount() == 0) + if (ms_loaded != nullptr && dataResource.getReferenceCount() == 0) { typename LoadedDataResourceMap::iterator iter = ms_loaded->find(&dataResource.getCrcName()); if (iter != ms_loaded->end()) { const T * const temp = (*iter).second; - (*iter).second = NULL; + (*iter).second = nullptr; ms_loaded->erase(iter); delete temp; } @@ -369,11 +369,11 @@ inline T * DataResourceList::reload(Iff &source) if (iter == ms_loaded->end()) { DEBUG_WARNING(true, ("DataResourceList::reload: trying to reload unloaded resource %s!", source.getFileName())); - return NULL; + return nullptr; } T * const dataResource = const_cast((*iter).second); - if (dataResource != NULL) + if (dataResource != nullptr) { // initialize the data resource dataResource->loadFromIff(source); diff --git a/engine/shared/library/sharedFoundation/src/shared/ExitChain.cpp b/engine/shared/library/sharedFoundation/src/shared/ExitChain.cpp index 3b1fb1bf..af70c5a0 100755 --- a/engine/shared/library/sharedFoundation/src/shared/ExitChain.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/ExitChain.cpp @@ -115,7 +115,7 @@ void ExitChain::add(Function function, const char *debugName, int priority, bool #endif // linked list traversal with a back pointer - for (back = NULL, front = PerThreadData::getExitChainFirstEntry(); front && front->priority > priority; back = front, front = front->next) + for (back = nullptr, front = PerThreadData::getExitChainFirstEntry(); front && front->priority > priority; back = front, front = front->next) ; // hook it into the linked list @@ -133,7 +133,7 @@ void ExitChain::add(Function function, const char *debugName, int priority, bool * The ExitChain will automatically remove a function from the ExitChain when it calls the function, so an * exit function should not attempt to remove itself from the ExitChain. * - * Calling this routine with a NULL pointer will cause this routine to call Fatal in debug compilations. + * Calling this routine with a nullptr pointer will cause this routine to call Fatal in debug compilations. * * Calling this routine with a function that is not on the ExitChain will cause this routine to call * Fatal in debug compilations. @@ -145,14 +145,14 @@ void ExitChain::remove(Function function) { Entry *back, *front; - if (function == NULL) + if (function == nullptr) { - DEBUG_FATAL(true, ("ExitChain::remove NULL function")); + DEBUG_FATAL(true, ("ExitChain::remove nullptr function")); return; //lint !e527 // Warning -- Unreachable } // linked list traversal with a back pointer - for (back = NULL, front = PerThreadData::getExitChainFirstEntry(); front && front->function != function; back = front, front = front->next) + for (back = nullptr, front = PerThreadData::getExitChainFirstEntry(); front && front->function != function; back = front, front = front->next) ; // make sure it was found @@ -191,7 +191,7 @@ void ExitChain::run(void) PerThreadData::setExitChainRunning(true); - while ((entry = PerThreadData::getExitChainFirstEntry()) != NULL) + while ((entry = PerThreadData::getExitChainFirstEntry()) != nullptr) { // remove the first entry off the ExitChain PerThreadData::setExitChainFirstEntry(entry->next); diff --git a/engine/shared/library/sharedFoundation/src/shared/Fatal.cpp b/engine/shared/library/sharedFoundation/src/shared/Fatal.cpp index 5d2c7327..37a3884f 100755 --- a/engine/shared/library/sharedFoundation/src/shared/Fatal.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/Fatal.cpp @@ -33,7 +33,7 @@ namespace FatalNamespace int ms_numberOfWarnings = 0; bool ms_strict = false; - WarningCallback s_warningCallback = NULL; + WarningCallback s_warningCallback = nullptr; #if PRODUCTION == 0 PixCounter::ResetInteger ms_numberOfWarningsThisFrame; @@ -70,7 +70,7 @@ static void formatMessage(char *buffer, int bufferLength, int stackDepth, const else DebugHelp::getCallStack(callStack, callStackOffset + stackDepth); - // make sure the buffer is always null terminated + // make sure the buffer is always nullptr terminated buffer[--bufferLength] = '\0'; // look up the caller's file and line @@ -191,7 +191,7 @@ static void InternalWarning(const char *format, int extraFlags, va_list va, int char buffer[4 * 1024]; - if (NULL != s_warningCallback) + if (nullptr != s_warningCallback) { strcpy(buffer, "WARNING: "); vsnprintf(buffer + 9, sizeof(buffer) - 9, format, va); diff --git a/engine/shared/library/sharedFoundation/src/shared/Fatal.h b/engine/shared/library/sharedFoundation/src/shared/Fatal.h index f33eb5ac..14215b90 100755 --- a/engine/shared/library/sharedFoundation/src/shared/Fatal.h +++ b/engine/shared/library/sharedFoundation/src/shared/Fatal.h @@ -68,15 +68,15 @@ void SetWarningCallback(WarningCallback); template inline T *NonNull(T *pointer, const char *name) { - WARNING(!pointer, ("%s pointer is null", name)); + WARNING(!pointer, ("%s pointer is nullptr", name)); return pointer; } #define NON_NULL(a) NonNull(a, #a) - #define NOT_NULL(a) FATAL(!a, ("%s pointer is null", #a)) + #define NOT_NULL(a) FATAL(!a, ("%s pointer is nullptr", #a)) - // FATAL if the specified pointer is not NULL (i.e. assert that the pointer is null, the opposite of NOT_NULL). - #define IS_NULL(a) FATAL(a, ("%s pointer is not null, unexpected.", #a)) + // FATAL if the specified pointer is not nullptr (i.e. assert that the pointer is nullptr, the opposite of NOT_NULL). + #define IS_NULL(a) FATAL(a, ("%s pointer is not nullptr, unexpected.", #a)) #else diff --git a/engine/shared/library/sharedFoundation/src/shared/FormattedString.h b/engine/shared/library/sharedFoundation/src/shared/FormattedString.h index b4e1f6de..d778be27 100755 --- a/engine/shared/library/sharedFoundation/src/shared/FormattedString.h +++ b/engine/shared/library/sharedFoundation/src/shared/FormattedString.h @@ -42,7 +42,7 @@ inline FormattedString::FormattedString() template inline char const * FormattedString::sprintf(char const * const format, ...) { - char const * result = NULL; + char const * result = nullptr; va_list va; va_start(va, format); @@ -64,7 +64,7 @@ inline char const * FormattedString::vsprintf(char const * const for int const charactersWritten = vsnprintf(m_text, lastIndex, format, va); // vsnprintf returns the number of characters written, not including - // the terminating null character, or a negative value if an output error occurs. + // the terminating nullptr character, or a negative value if an output error occurs. // If the number of characters to write exceeds count, then count characters are // written and -1 is returned. diff --git a/engine/shared/library/sharedFoundation/src/shared/LabelHash.cpp b/engine/shared/library/sharedFoundation/src/shared/LabelHash.cpp index 26848b94..2f28a3ca 100755 --- a/engine/shared/library/sharedFoundation/src/shared/LabelHash.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/LabelHash.cpp @@ -109,7 +109,7 @@ const char * LabelHash::findLabel( char const * const domain, uint32 hashValue ) { // Domain not found - return NULL; + return nullptr; } // ---------- @@ -127,6 +127,6 @@ const char * LabelHash::findLabel( char const * const domain, uint32 hashValue ) // ---------- // String not found - return NULL; + return nullptr; } diff --git a/engine/shared/library/sharedFoundation/src/shared/MemoryBlockManager.cpp b/engine/shared/library/sharedFoundation/src/shared/MemoryBlockManager.cpp index c5c86efd..c8067046 100755 --- a/engine/shared/library/sharedFoundation/src/shared/MemoryBlockManager.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/MemoryBlockManager.cpp @@ -138,8 +138,8 @@ using namespace MemoryBlockManagerNamespace; MemoryBlockManager::Allocator::Allocator(const int elementSize) : m_referenceCount(0), - m_firstBlock(NULL), - m_firstFreeElement(NULL), + m_firstBlock(nullptr), + m_firstFreeElement(nullptr), m_elementSize(elementSize), m_elementsPerBlock(64), m_currentNumberOfBlocks(0), @@ -157,8 +157,8 @@ MemoryBlockManager::Allocator::Allocator(const int elementSize) MemoryBlockManager::Allocator::Allocator(int elementSize, int elementsPerBlock, int minimumBlocks, int maximumNumberOfBlocks) : m_referenceCount(0), - m_firstBlock(NULL), - m_firstFreeElement(NULL), + m_firstBlock(nullptr), + m_firstFreeElement(nullptr), m_elementSize(elementSize), m_elementsPerBlock(elementsPerBlock), m_currentNumberOfBlocks(0), @@ -188,8 +188,8 @@ MemoryBlockManager::Allocator::~Allocator() delete block; } - m_firstBlock = NULL; - m_firstFreeElement = NULL; + m_firstBlock = nullptr; + m_firstFreeElement = nullptr; } // ---------------------------------------------------------------------- @@ -427,7 +427,7 @@ MemoryBlockManager::MemoryBlockManager(char const * name, bool shared, int eleme : m_name(name), m_shared(shared), m_currentNumberOfElements(0), - m_allocator(NULL) + m_allocator(nullptr) { //-- Handle config option where we force all MemoryBlockManagers to be non-shared. if (shared && ms_forceAllNonShared) @@ -598,7 +598,7 @@ void *MemoryBlockManager::allocate(bool returnNullOnFailure) { ms_globalCriticalSection.leave(); DEBUG_FATAL(!returnNullOnFailure, ("MBM %s is full %d", m_name, m_currentNumberOfElements)); - return NULL; + return nullptr; } ++m_currentNumberOfElements; diff --git a/engine/shared/library/sharedFoundation/src/shared/MessageQueue.cpp b/engine/shared/library/sharedFoundation/src/shared/MessageQueue.cpp index 5af0285d..4b77315c 100755 --- a/engine/shared/library/sharedFoundation/src/shared/MessageQueue.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/MessageQueue.cpp @@ -105,7 +105,7 @@ void MessageQueue::clearDataFromMessageList(MessageList &messageList, bool destr { DEBUG_WARNING(!destructor, ("clearing message data from beginFrame")); delete message.m_data; - message.m_data = NULL; + message.m_data = nullptr; } } } @@ -199,7 +199,7 @@ void MessageQueue::clearMessage(const int index) VALIDATE_RANGE_INCLUSIVE_EXCLUSIVE(0, index, getNumberOfMessages()); Message& message = (*m_messageQueueRead)[static_cast(index)]; - DEBUG_WARNING(message.m_data, ("MessageQueue::clearMessage - clearing message with non-null data")); + DEBUG_WARNING(message.m_data, ("MessageQueue::clearMessage - clearing message with non-nullptr data")); message.m_message = 0; } diff --git a/engine/shared/library/sharedFoundation/src/shared/Misc.h b/engine/shared/library/sharedFoundation/src/shared/Misc.h index 326d3341..1c29b6ed 100755 --- a/engine/shared/library/sharedFoundation/src/shared/Misc.h +++ b/engine/shared/library/sharedFoundation/src/shared/Misc.h @@ -135,7 +135,7 @@ templateinline void Zero(T &t) * the source string into the new memory, and then returns a pointer to * the new memory. * - * This routine will return NULL if called with NULL. + * This routine will return nullptr if called with nullptr. * * @param source The string to copy * @return A pointer to a copy of the source argument @@ -144,7 +144,7 @@ templateinline void Zero(T &t) inline char *DuplicateString(const char *source) { if (!source) - return NULL; + return nullptr; const uint length = strlen(source)+1; char *result = NON_NULL (new char[length]); @@ -160,7 +160,7 @@ inline char *DuplicateString(const char *source) * the source string into the new memory, and then returns a pointer to * the new memory. * - * This routine will return NULL if called with NULL. + * This routine will return nullptr if called with nullptr. * * @param source The string to copy * @return A pointer to a copy of the source argument @@ -169,7 +169,7 @@ inline char *DuplicateString(const char *source) inline char *DuplicateStringWithToLower(const char *source) { if (!source) - return NULL; + return nullptr; const uint length = strlen(source)+1; char *result = NON_NULL (new char[length]); @@ -193,7 +193,7 @@ inline char *DuplicateStringWithToLower(const char *source) inline void imemset(void *data, int value, int length) { - DEBUG_FATAL(!data, ("null data arg")); + DEBUG_FATAL(!data, ("nullptr data arg")); memset(data, value, static_cast(length)); } @@ -210,8 +210,8 @@ inline void imemset(void *data, int value, int length) inline void imemcpy(void *destination, const void *source, int length) { - DEBUG_FATAL(!destination, ("null destination arg")); - DEBUG_FATAL(!source, ("null source arg")); + DEBUG_FATAL(!destination, ("nullptr destination arg")); + DEBUG_FATAL(!source, ("nullptr source arg")); memcpy(destination, source, static_cast(length)); } @@ -228,8 +228,8 @@ inline void imemcpy(void *destination, const void *source, int length) inline void *memmove(void *destination, const void *source, int length) { - DEBUG_FATAL(!destination, ("null destination arg")); - DEBUG_FATAL(!source, ("null source arg")); + DEBUG_FATAL(!destination, ("nullptr destination arg")); + DEBUG_FATAL(!source, ("nullptr source arg")); return memmove(destination, source, static_cast(length)); } @@ -243,7 +243,7 @@ inline void *memmove(void *destination, const void *source, int length) inline int istrlen(const char *string) { - DEBUG_FATAL(!string, ("null string arg")); + DEBUG_FATAL(!string, ("nullptr string arg")); return static_cast(strlen(string)); } diff --git a/engine/shared/library/sharedFoundation/src/shared/PersistentCrcString.cpp b/engine/shared/library/sharedFoundation/src/shared/PersistentCrcString.cpp index 7de5a7d3..dae8108f 100755 --- a/engine/shared/library/sharedFoundation/src/shared/PersistentCrcString.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/PersistentCrcString.cpp @@ -50,23 +50,23 @@ void PersistentCrcString::install() void PersistentCrcStringNamespace::remove() { delete ms_memoryBlockManager8; - ms_memoryBlockManager8 = NULL; + ms_memoryBlockManager8 = nullptr; delete ms_memoryBlockManager16; - ms_memoryBlockManager16 = NULL; + ms_memoryBlockManager16 = nullptr; delete ms_memoryBlockManager32; - ms_memoryBlockManager32 = NULL; + ms_memoryBlockManager32 = nullptr; delete ms_memoryBlockManager48; - ms_memoryBlockManager48 = NULL; + ms_memoryBlockManager48 = nullptr; delete ms_memoryBlockManager64; - ms_memoryBlockManager64 = NULL; + ms_memoryBlockManager64 = nullptr; } // ====================================================================== PersistentCrcString::PersistentCrcString() : CrcString(), - m_memoryBlockManager(NULL), - m_buffer(NULL) + m_memoryBlockManager(nullptr), + m_buffer(nullptr) { DEBUG_FATAL(!ms_memoryBlockManager8, ("Constructing a PersistentCrcString before the class is installed")); } @@ -75,8 +75,8 @@ PersistentCrcString::PersistentCrcString() PersistentCrcString::PersistentCrcString(CrcString const &rhs) : CrcString(), - m_memoryBlockManager(NULL), - m_buffer(NULL) + m_memoryBlockManager(nullptr), + m_buffer(nullptr) { DEBUG_FATAL(!ms_memoryBlockManager8, ("Constructing a PersistentCrcString before the class is installed")); @@ -88,8 +88,8 @@ PersistentCrcString::PersistentCrcString(CrcString const &rhs) PersistentCrcString::PersistentCrcString(PersistentCrcString const &rhs) : CrcString(), //lint !e1738 // non copy constructor used to initialize base class // this appears to be intentional. - m_memoryBlockManager(NULL), - m_buffer(NULL) + m_memoryBlockManager(nullptr), + m_buffer(nullptr) { DEBUG_FATAL(!ms_memoryBlockManager8, ("Constructing a PersistentCrcString before the class is installed")); @@ -101,8 +101,8 @@ PersistentCrcString::PersistentCrcString(PersistentCrcString const &rhs) PersistentCrcString::PersistentCrcString(char const * string, bool applyNormalize) : CrcString(), - m_memoryBlockManager(NULL), - m_buffer(NULL) + m_memoryBlockManager(nullptr), + m_buffer(nullptr) { DEBUG_FATAL(!ms_memoryBlockManager8, ("Constructing a PersistentCrcString before the class is installed")); @@ -114,8 +114,8 @@ PersistentCrcString::PersistentCrcString(char const * string, bool applyNormaliz PersistentCrcString::PersistentCrcString(char const * string, uint32 crc) : CrcString(), - m_memoryBlockManager(NULL), - m_buffer(NULL) + m_memoryBlockManager(nullptr), + m_buffer(nullptr) { DEBUG_FATAL(!ms_memoryBlockManager8, ("Constructing a PersistentCrcString before the class is installed")); @@ -169,18 +169,18 @@ void PersistentCrcString::internalFree() { if (m_memoryBlockManager == ms_fakeConstCharMemoryBlockManager) { - m_memoryBlockManager = NULL; + m_memoryBlockManager = nullptr; } else { m_memoryBlockManager->free(m_buffer); - m_memoryBlockManager = NULL; + m_memoryBlockManager = nullptr; } } else delete [] m_buffer; - m_buffer = NULL; + m_buffer = nullptr; } } @@ -201,7 +201,7 @@ void PersistentCrcString::internalSet(char const * string, bool applyNormalize) const int stringLength = istrlen(string) + 1; DEBUG_FATAL(stringLength > Os::MAX_PATH_LENGTH, ("string too long for a filename")); - m_memoryBlockManager = NULL; + m_memoryBlockManager = nullptr; if (stringLength <= 8) m_memoryBlockManager = ms_memoryBlockManager8; else diff --git a/engine/shared/library/sharedFoundation/src/shared/Tag.h b/engine/shared/library/sharedFoundation/src/shared/Tag.h index 82a4f393..261b474e 100755 --- a/engine/shared/library/sharedFoundation/src/shared/Tag.h +++ b/engine/shared/library/sharedFoundation/src/shared/Tag.h @@ -158,7 +158,7 @@ inline Tag ConvertIntToTag(int value) * array with the name of the specified tag. If a character of the tag * is not printable, it will be replaced with a question mark. * - * A null-character will be appended to the output buffer. + * A nullptr-character will be appended to the output buffer. * * This routine assumes the specified character buffer is at least 5 characters * in length. @@ -171,7 +171,7 @@ inline void ConvertTagToString(Tag tag, char *buffer) { int i, j, ch; - DEBUG_FATAL(!buffer, ("buffer is null")); + DEBUG_FATAL(!buffer, ("buffer is nullptr")); for (i = 0, j = 24; i < 4; ++i, j -= 8) { diff --git a/engine/shared/library/sharedFoundation/src/shared/Watcher.cpp b/engine/shared/library/sharedFoundation/src/shared/Watcher.cpp index 3ca86728..c56201a6 100755 --- a/engine/shared/library/sharedFoundation/src/shared/Watcher.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/Watcher.cpp @@ -82,7 +82,7 @@ void WatchedByList::install() /** * Destroy a WatchedByList. * - * All watchers currently watching the owner of this object will be reset to NULL. + * All watchers currently watching the owner of this object will be reset to nullptr. */ WatchedByList::~WatchedByList() @@ -92,7 +92,7 @@ WatchedByList::~WatchedByList() if (m_list) { deleteList(m_list); - m_list = NULL; + m_list = nullptr; } } diff --git a/engine/shared/library/sharedFoundation/src/shared/Watcher.h b/engine/shared/library/sharedFoundation/src/shared/Watcher.h index ca637a79..921b91d5 100755 --- a/engine/shared/library/sharedFoundation/src/shared/Watcher.h +++ b/engine/shared/library/sharedFoundation/src/shared/Watcher.h @@ -8,7 +8,7 @@ // @todo How do I get this into doxygen? It's information that really spans multiple classes // // The Watcher system allows pointers to objects to be automatically -// reset to NULL when the object watching them is destoyed. +// reset to nullptr when the object watching them is destoyed. // // For something to be watchable, it must provide a routine of the form: // @@ -66,7 +66,7 @@ class Watcher : public BaseWatcher { public: - explicit Watcher(T *data=NULL); + explicit Watcher(T *data=nullptr); Watcher(const Watcher &newValue); ~Watcher(); //lint !e1509 // Warning -- base class destructor for class is not virtual @@ -96,7 +96,7 @@ class ConstWatcher : public BaseWatcher { public: - explicit ConstWatcher(const T *data=NULL); + explicit ConstWatcher(const T *data=nullptr); ConstWatcher(const ConstWatcher &newValue); ~ConstWatcher(); //lint !e1509 // Warning -- base class destructor for class is not virtual @@ -177,7 +177,7 @@ inline BaseWatcher::BaseWatcher(void *data) inline void BaseWatcher::reset() { - m_data = NULL; + m_data = nullptr; } // ---------------------------------------------------------------------- @@ -190,7 +190,7 @@ inline void BaseWatcher::reset() inline BaseWatcher::~BaseWatcher() { - m_data = NULL; + m_data = nullptr; } // ---------------------------------------------------------------------- @@ -593,11 +593,11 @@ inline const T *ConstWatcher::operator ->() const /** * Construct a WatchedByList. * - * This list of watchers remains NULL until someone first watches the object. + * This list of watchers remains nullptr until someone first watches the object. */ inline WatchedByList::WatchedByList() -: m_list(NULL) +: m_list(nullptr) { } diff --git a/engine/shared/library/sharedFoundation/src/shared/dynamicVariable/DynamicVariable.cpp b/engine/shared/library/sharedFoundation/src/shared/dynamicVariable/DynamicVariable.cpp index f11c603e..ada9369f 100755 --- a/engine/shared/library/sharedFoundation/src/shared/dynamicVariable/DynamicVariable.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/dynamicVariable/DynamicVariable.cpp @@ -106,8 +106,8 @@ m_value(), m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; } // ---------------------------------------------------------------------- @@ -131,8 +131,8 @@ DynamicVariable::DynamicVariable(const DynamicVariable &rhs) : m_position(rhs.m_position), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; } // ---------------------------------------------------------------------- @@ -158,8 +158,8 @@ DynamicVariable& DynamicVariable::operator=(const DynamicVariable &rhs) (*f)(m_cachedValue[0]); } - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; } } @@ -201,8 +201,8 @@ void DynamicVariable::load(int position, int typeId, const Unicode::String &pack (*f)(m_cachedValue[0]); } - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; } } @@ -235,8 +235,8 @@ DynamicVariable::DynamicVariable(int value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; pack(value, m_value); } @@ -249,8 +249,8 @@ DynamicVariable::DynamicVariable(const std::vector & value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; pack(value, m_value); } @@ -263,8 +263,8 @@ DynamicVariable::DynamicVariable(float value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; pack(value, m_value); } @@ -277,8 +277,8 @@ DynamicVariable::DynamicVariable(const std::vector & value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; pack(value, m_value); } @@ -291,8 +291,8 @@ DynamicVariable::DynamicVariable(const Unicode::String &value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; } // ---------------------------------------------------------------------- @@ -303,8 +303,8 @@ DynamicVariable::DynamicVariable(const std::string &value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; } // ---------------------------------------------------------------------- @@ -315,8 +315,8 @@ DynamicVariable::DynamicVariable(const std::vector & value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; pack(value, m_value); } @@ -329,8 +329,8 @@ DynamicVariable::DynamicVariable(const NetworkId & value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; } // ---------------------------------------------------------------------- @@ -341,8 +341,8 @@ DynamicVariable::DynamicVariable(const std::vector & value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; pack(value, m_value); } @@ -355,8 +355,8 @@ DynamicVariable::DynamicVariable(const DynamicVariableLocationData & value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; pack(value, m_value); } @@ -369,8 +369,8 @@ DynamicVariable::DynamicVariable(const std::vector m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; pack(value, m_value); } @@ -383,8 +383,8 @@ DynamicVariable::DynamicVariable(const StringId &value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; } // ---------------------------------------------------------------------- @@ -395,8 +395,8 @@ DynamicVariable::DynamicVariable(const std::vector &value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; pack(value, m_value); } @@ -409,8 +409,8 @@ DynamicVariable::DynamicVariable(const Transform &value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; pack(value, m_value); } @@ -423,8 +423,8 @@ DynamicVariable::DynamicVariable(const std::vector &value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; pack(value, m_value); } @@ -437,8 +437,8 @@ DynamicVariable::DynamicVariable(const Vector &value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; pack(value, m_value); } @@ -451,8 +451,8 @@ DynamicVariable::DynamicVariable(const std::vector &value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; pack(value, m_value); } @@ -786,7 +786,7 @@ bool DynamicVariable::get(DynamicVariableLocationData & value) const char tempCell[BUFSIZE]; std::string data(Unicode::wideToNarrow(m_value)); const char * bufptrStart = data.c_str(); - char * bufptrEnd = NULL; + char * bufptrEnd = nullptr; cachedValue.pos.x = static_cast(strtod(bufptrStart, &bufptrEnd)); bufptrStart = bufptrEnd; while (*bufptrStart != '\0' && isspace(*bufptrStart)) @@ -811,7 +811,7 @@ bool DynamicVariable::get(DynamicVariableLocationData & value) const while (*bufptrStart != '\0' && isspace(*bufptrStart)) ++bufptrStart; bufptrEnd = const_cast(strchr(bufptrStart, ' ')); - if (bufptrEnd == NULL || bufptrEnd - bufptrStart >= BUFSIZE) + if (bufptrEnd == nullptr || bufptrEnd - bufptrStart >= BUFSIZE) { WARNING_STRICT_FATAL(true, ("DynamicVariable::get location buffer overflow in scene")); return false; @@ -875,7 +875,7 @@ bool DynamicVariable::get(std::vector & value) cons char tempCell[BUFSIZE]; const char * bufptrStart = buffer; - char * bufptrEnd = NULL; + char * bufptrEnd = nullptr; temp.pos.x = static_cast(strtod(bufptrStart, &bufptrEnd)); bufptrStart = bufptrEnd; while (*bufptrStart != '\0' && isspace(*bufptrStart)) @@ -900,7 +900,7 @@ bool DynamicVariable::get(std::vector & value) cons while (*bufptrStart != '\0' && isspace(*bufptrStart)) ++bufptrStart; bufptrEnd = const_cast(strchr(bufptrStart, ' ')); - if (bufptrEnd == NULL || bufptrEnd - bufptrStart >= BUFSIZE) + if (bufptrEnd == nullptr || bufptrEnd - bufptrStart >= BUFSIZE) { WARNING_STRICT_FATAL(true, ("DynamicVariable::get location array buffer overflow in scene")); return false; @@ -1430,8 +1430,8 @@ namespace Archive (*f)(target.m_cachedValue[0]); } - target.m_cachedValue[0] = NULL; - target.m_cachedValue[1] = NULL; + target.m_cachedValue[0] = nullptr; + target.m_cachedValue[1] = nullptr; } } diff --git a/engine/shared/library/sharedFoundation/src/shared/dynamicVariable/DynamicVariable.h b/engine/shared/library/sharedFoundation/src/shared/dynamicVariable/DynamicVariable.h index 004de6fc..c69588ba 100755 --- a/engine/shared/library/sharedFoundation/src/shared/dynamicVariable/DynamicVariable.h +++ b/engine/shared/library/sharedFoundation/src/shared/dynamicVariable/DynamicVariable.h @@ -150,8 +150,8 @@ private: // caching the value so we don't constantly convert them from the string representation // // if the value can fit in m_cachedValue, we directly store it there - // int uses m_cachedValue[0], m_cachedValue[1] = NULL - // float uses m_cachedValue[0], m_cachedValue[1] = NULL + // int uses m_cachedValue[0], m_cachedValue[1] = nullptr + // float uses m_cachedValue[0], m_cachedValue[1] = nullptr // NetworkId uses both m_cachedValue[0] and m_cachedValue[1] // // if not, we allocate storage for the value and store the pointer to it diff --git a/engine/shared/library/sharedGame/src/shared/appearance/WearableAppearanceMap.cpp b/engine/shared/library/sharedGame/src/shared/appearance/WearableAppearanceMap.cpp index 63d98b04..5b7e478f 100755 --- a/engine/shared/library/sharedGame/src/shared/appearance/WearableAppearanceMap.cpp +++ b/engine/shared/library/sharedGame/src/shared/appearance/WearableAppearanceMap.cpp @@ -155,9 +155,9 @@ WearableAppearanceMapNamespace::PersistentMapEntry::PersistentMapEntry(char cons MapEntry(), m_sourceWearableAppearanceName(sourceWearableAppearanceName, true), m_wearerAppearanceName(wearerAppearanceName, true), - m_mappedWearableAppearanceName(NULL) + m_mappedWearableAppearanceName(nullptr) { - if (mappedWearableAppearanceName != NULL) + if (mappedWearableAppearanceName != nullptr) m_mappedWearableAppearanceName = new PersistentCrcString(mappedWearableAppearanceName, true); } @@ -218,7 +218,7 @@ CrcString const &WearableAppearanceMapNamespace::TemporaryMapEntry::getWearerApp CrcString const *WearableAppearanceMapNamespace::TemporaryMapEntry::getMappedWearableAppearanceName() const { - return NULL; + return nullptr; } // ====================================================================== @@ -297,7 +297,7 @@ void WearableAppearanceMapNamespace::loadTableData(char const *filename) std::string const &mappedWearableAppearanceName = table->getStringValue(mappedWearableAppearanceNameColumnNumber, rowIndex); //-- Create map entry, add to vector. - s_mapEntries.push_back(new PersistentMapEntry(sourceWearableAppearanceName.c_str(), wearerAppearanceName.c_str(), (mappedWearableAppearanceName == cs_forbiddenWearableCellContents) ? NULL : mappedWearableAppearanceName.c_str())); + s_mapEntries.push_back(new PersistentMapEntry(sourceWearableAppearanceName.c_str(), wearerAppearanceName.c_str(), (mappedWearableAppearanceName == cs_forbiddenWearableCellContents) ? nullptr : mappedWearableAppearanceName.c_str())); } DataTableManager::close(filename); @@ -388,7 +388,7 @@ WearableAppearanceMap::MapResult WearableAppearanceMap::getMapResultForWearableA if (findResult.first == findResult.second) { // We have no mapping for this entry. That implies the source wearable appearance name can be used as is. - return MapResult(false, false, NULL); + return MapResult(false, false, nullptr); } else { @@ -398,7 +398,7 @@ WearableAppearanceMap::MapResult WearableAppearanceMap::getMapResultForWearableA // We have a mapping. Return it. CrcString const *const mappedWearableAppearanceName = mapEntry->getMappedWearableAppearanceName(); - return MapResult(true, mappedWearableAppearanceName == NULL, mappedWearableAppearanceName); + return MapResult(true, mappedWearableAppearanceName == nullptr, mappedWearableAppearanceName); } } diff --git a/engine/shared/library/sharedGame/src/shared/collision/CollisionCallbackManager.cpp b/engine/shared/library/sharedGame/src/shared/collision/CollisionCallbackManager.cpp index fc8d7b13..89f58b9a 100755 --- a/engine/shared/library/sharedGame/src/shared/collision/CollisionCallbackManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/collision/CollisionCallbackManager.cpp @@ -279,8 +279,8 @@ bool CollisionCallbackManager::intersectAndReflectWithTerrain(Object * const obj void CollisionCallbackManagerNamespace::noCollisionDetectionThisFrame(Object * const object) { - FATAL(!ms_convertObjectToIndex, ("CollisionCallbackManagerNamespace::noCollisionDetectionThisFrame: ms_convertObjectToIndex == NULL.")); - FATAL(!object, ("CollisionCallbackManagerNamespace::noCollisionDetectionThisFrame: object == NULL.")); + FATAL(!ms_convertObjectToIndex, ("CollisionCallbackManagerNamespace::noCollisionDetectionThisFrame: ms_convertObjectToIndex == nullptr.")); + FATAL(!object, ("CollisionCallbackManagerNamespace::noCollisionDetectionThisFrame: object == nullptr.")); int const index = ms_convertObjectToIndex(object); @@ -298,9 +298,9 @@ void CollisionCallbackManagerNamespace::noCollisionDetectionThisFrame(Object * c bool CollisionCallbackManagerNamespace::collisionDetectionOnHit(Object * const object, Object * const wasHitByThisObject) { - FATAL(!ms_convertObjectToIndex, ("CollisionCallbackManagerNamespace::collisionDetectionOnHit: ms_convertObjectToIndex == NULL.")); - FATAL(!object, ("CollisionCallbackManagerNamespace::collisionDetectionOnHit: object == NULL.")); - FATAL(!wasHitByThisObject, ("CollisionCallbackManagerNamespace::collisionDetectionOnHit: wasHitByThisObject == NULL.")); + FATAL(!ms_convertObjectToIndex, ("CollisionCallbackManagerNamespace::collisionDetectionOnHit: ms_convertObjectToIndex == nullptr.")); + FATAL(!object, ("CollisionCallbackManagerNamespace::collisionDetectionOnHit: object == nullptr.")); + FATAL(!wasHitByThisObject, ("CollisionCallbackManagerNamespace::collisionDetectionOnHit: wasHitByThisObject == nullptr.")); CollisionCallbackManager::OnHitByObjectFunction function = 0; diff --git a/engine/shared/library/sharedGame/src/shared/core/AiDebugString.cpp b/engine/shared/library/sharedGame/src/shared/core/AiDebugString.cpp index 544cf1af..af8d3ef1 100755 --- a/engine/shared/library/sharedGame/src/shared/core/AiDebugString.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/AiDebugString.cpp @@ -69,7 +69,7 @@ AiDebugString::AiDebugString(std::string const & text) Unicode::String const delimiters(Unicode::narrowToWide("`")); Unicode::UnicodeStringVector result; - if (Unicode::tokenize(Unicode::narrowToWide(text), result, &delimiters, NULL)) + if (Unicode::tokenize(Unicode::narrowToWide(text), result, &delimiters, nullptr)) { Unicode::UnicodeStringVector::const_iterator iterStringVector = result.begin(); diff --git a/engine/shared/library/sharedGame/src/shared/core/AssetCustomizationManager.cpp b/engine/shared/library/sharedGame/src/shared/core/AssetCustomizationManager.cpp index 34acdca1..88432113 100755 --- a/engine/shared/library/sharedGame/src/shared/core/AssetCustomizationManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/AssetCustomizationManager.cpp @@ -192,31 +192,31 @@ void AssetCustomizationManagerNamespace::remove() s_installed = false; delete [] s_nameDataBlock; - s_nameDataBlock = NULL; + s_nameDataBlock = nullptr; s_nameDataBlockSize = 0; delete [] s_paletteIdNameOffsetMap; - s_paletteIdNameOffsetMap = NULL; + s_paletteIdNameOffsetMap = nullptr; s_maxValidPaletteId = 0; delete [] s_variableIdNameOffsetMap; - s_variableIdNameOffsetMap = NULL; + s_variableIdNameOffsetMap = nullptr; s_maxValidVariableId = 0; delete [] s_defaultValueMap; - s_defaultValueMap = NULL; + s_defaultValueMap = nullptr; s_maxValidDefaultId = 0; delete [] s_intRangeMap; - s_intRangeMap = NULL; + s_intRangeMap = nullptr; s_maxValidIntRangeId = 0; delete [] s_rangeTypeMap; - s_rangeTypeMap = NULL; + s_rangeTypeMap = nullptr; s_maxValidRangeId = 0; delete [] s_variableUsageMap; - s_variableUsageMap = NULL; + s_variableUsageMap = nullptr; s_maxValidVariableUsageId = 0; delete [] s_variableUsageList; @@ -224,19 +224,19 @@ void AssetCustomizationManagerNamespace::remove() s_variableUsageListEntryCount = 0; delete [] s_usageIndex; - s_usageIndex = NULL; + s_usageIndex = nullptr; s_usageIndexEntryCount = 0; delete [] s_linkList; - s_linkList = NULL; + s_linkList = nullptr; s_linkListEntryCount = 0; delete [] s_linkIndex; - s_linkIndex = NULL; + s_linkIndex = nullptr; s_linkIndexEntryCount = 0; delete [] s_crcLookupTable; - s_crcLookupTable = NULL; + s_crcLookupTable = nullptr; s_crcLookupEntryCount = 0; } @@ -488,7 +488,7 @@ int AssetCustomizationManagerNamespace::lookupAssetId(CrcString const &assetName uint32 const key = assetName.getCrc(); CrcLookupEntry const *entry = static_cast(bsearch(&key, s_crcLookupTable, static_cast(s_crcLookupEntryCount), sizeof(CrcLookupEntry), compare_uint32)); - return (entry != NULL) ? entry->assetId : 0; + return (entry != nullptr) ? entry->assetId : 0; } // ---------------------------------------------------------------------- @@ -584,7 +584,7 @@ void AssetCustomizationManagerNamespace::addVariablesForAssetAndLinks(int assetI getRangeTypeInfoFromRangeId(variableUsage->rangeId, isPalette, idForRealType); //-- Create variable based on type. - CustomizationVariable *variable = NULL; + CustomizationVariable *variable = nullptr; if (isPalette) { //-- Get palette. diff --git a/engine/shared/library/sharedGame/src/shared/core/CitizenRankDataTable.cpp b/engine/shared/library/sharedGame/src/shared/core/CitizenRankDataTable.cpp index 2edf349d..a5f37664 100755 --- a/engine/shared/library/sharedGame/src/shared/core/CitizenRankDataTable.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/CitizenRankDataTable.cpp @@ -63,7 +63,7 @@ void CitizenRankDataTable::install() FATAL((columnRankSlotId < 0), ("column \"rankSlotId\" not found in %s", cs_citizenRankDataTableName)); FATAL((columnTitle < 0), ("column \"title\" not found in %s", cs_citizenRankDataTableName)); - CitizenRankDataTable::CitizenRank const * currentRank = NULL; + CitizenRankDataTable::CitizenRank const * currentRank = nullptr; int const numRows = table->getNumRows(); std::string rankName, alternateTitle; @@ -199,7 +199,7 @@ CitizenRankDataTable::CitizenRank const * CitizenRankDataTable::getRank(std::str if (iterFind != s_allCitizenRanksByName.end()) return iterFind->second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -210,7 +210,7 @@ CitizenRankDataTable::CitizenRank const * CitizenRankDataTable::isARankTitle(std if (iterFind != s_allCitizenRanksByTitle.end()) return iterFind->second; - return NULL; + return nullptr; } // ====================================================================== diff --git a/engine/shared/library/sharedGame/src/shared/core/CollectionsDataTable.cpp b/engine/shared/library/sharedGame/src/shared/core/CollectionsDataTable.cpp index 74cc78cc..f7402fdb 100755 --- a/engine/shared/library/sharedGame/src/shared/core/CollectionsDataTable.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/CollectionsDataTable.cpp @@ -34,7 +34,7 @@ namespace CollectionsDataTableNamespace // for quick lookup of a slot by begin slot id, we use a vector because // slot id are guaranteed to start at 0 and be contiguous; for counter-type // slot, only the begin slot id index points to the slot; the other slot - // id indices point to NULL + // id indices point to nullptr std::vector s_allSlotsById; // all title(able) slots @@ -232,10 +232,10 @@ void CollectionsDataTable::install() FATAL((columnNoReward < 0), ("column \"noReward\" not found in %s", cs_collectionsDataTableName)); FATAL((columnTrackServerFirst < 0), ("column \"trackServerFirst\" not found in %s", cs_collectionsDataTableName)); - CollectionsDataTable::CollectionInfoBook const * currentBook = NULL; - CollectionsDataTable::CollectionInfoPage const * currentPage = NULL; - CollectionsDataTable::CollectionInfoCollection const * currentCollection = NULL; - CollectionsDataTable::CollectionInfoSlot const * currentSlot = NULL; + CollectionsDataTable::CollectionInfoBook const * currentBook = nullptr; + CollectionsDataTable::CollectionInfoPage const * currentPage = nullptr; + CollectionsDataTable::CollectionInfoCollection const * currentCollection = nullptr; + CollectionsDataTable::CollectionInfoSlot const * currentSlot = nullptr; int const numRows = table->getNumRows(); std::string bookName, pageName, collectionName, slotName, category, prereq, alternateTitle, icon, music; @@ -350,8 +350,8 @@ void CollectionsDataTable::install() FATAL(title, ("%s: book %s cannot be \"titleable\")", cs_collectionsDataTableName, bookName.c_str())); FATAL(!titles.empty(), ("%s: book %s cannot have any alternate titles (books are not \"titleable\")", cs_collectionsDataTableName, bookName.c_str())); currentBook = new CollectionInfoBook(bookName, icon, showIfNotYetEarned, hidden); - currentPage = NULL; - currentCollection = NULL; + currentPage = nullptr; + currentCollection = nullptr; s_allBooks.push_back(currentBook); s_allBooksByName[bookName] = currentBook; } @@ -376,7 +376,7 @@ void CollectionsDataTable::install() // start new page FATAL((!titles.empty() && !title), ("%s: page %s cannot have any alternate titles unless it is defined as \"titleable\")", cs_collectionsDataTableName, pageName.c_str())); currentPage = new CollectionInfoPage(pageName, icon, showIfNotYetEarned, hidden, titles, *currentBook); - currentCollection = NULL; + currentCollection = nullptr; s_pagesInBook[currentBook->name].push_back(currentPage); s_allPagesByName[pageName] = currentPage; @@ -549,7 +549,7 @@ void CollectionsDataTable::install() IGNORE_RETURN(s_slotCategoriesByCollection[currentCollection->name].insert(*iterCategories)); } - currentSlot = NULL; + currentSlot = nullptr; categories.clear(); prereqs.clear(); } @@ -575,7 +575,7 @@ void CollectionsDataTable::install() } // save off all slots ordered by slot ids - s_allSlotsById.resize(allSlotsById.size(), NULL); + s_allSlotsById.resize(allSlotsById.size(), nullptr); beginSlotId = -1; for (std::map::const_iterator iterSlotId = allSlotsById.begin(); iterSlotId != allSlotsById.end(); ++iterSlotId) { @@ -612,7 +612,7 @@ void CollectionsDataTable::install() } else { - s_allSlotsById[iterSlotId->first] = NULL; + s_allSlotsById[iterSlotId->first] = nullptr; } } @@ -733,7 +733,7 @@ CollectionsDataTable::CollectionInfoSlot const * CollectionsDataTable::getSlotBy if (iterFind != s_allSlotsByName.end()) return iterFind->second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -743,7 +743,7 @@ CollectionsDataTable::CollectionInfoSlot const * CollectionsDataTable::getSlotBy CollectionsDataTable::CollectionInfoSlot const * CollectionsDataTable::getSlotByBeginSlotId(int slotId) { if ((slotId < 0) || (slotId >= static_cast(s_allSlotsById.size()))) - return NULL; + return nullptr; return s_allSlotsById[slotId]; } @@ -763,7 +763,7 @@ CollectionsDataTable::CollectionInfoSlot const * CollectionsDataTable::isASlotTi if (iterFind != s_allSlotTitles.end()) return iterFind->second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -796,7 +796,7 @@ CollectionsDataTable::CollectionInfoCollection const * CollectionsDataTable::isA if (iterFind != s_allCollectionTitles.end()) return iterFind->second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -818,7 +818,7 @@ CollectionsDataTable::CollectionInfoCollection const * CollectionsDataTable::get if (iterFind != s_allCollectionsByName.end()) return iterFind->second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -866,7 +866,7 @@ CollectionsDataTable::CollectionInfoPage const * CollectionsDataTable::isAPageTi if (iterFind != s_allPageTitles.end()) return iterFind->second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -879,7 +879,7 @@ CollectionsDataTable::CollectionInfoPage const * CollectionsDataTable::getPageBy if (iterFind != s_allPagesByName.end()) return iterFind->second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -946,7 +946,7 @@ CollectionsDataTable::CollectionInfoBook const * CollectionsDataTable::getBookBy if (iterFind != s_allBooksByName.end()) return iterFind->second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedGame/src/shared/core/CommoditiesAdvancedSearchAttribute.cpp b/engine/shared/library/sharedGame/src/shared/core/CommoditiesAdvancedSearchAttribute.cpp index 585dbd1d..8c896b4f 100755 --- a/engine/shared/library/sharedGame/src/shared/core/CommoditiesAdvancedSearchAttribute.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/CommoditiesAdvancedSearchAttribute.cpp @@ -125,7 +125,7 @@ void CommoditiesAdvancedSearchAttribute::install() { // handle search attribute name alias tokens.clear(); - if (Unicode::tokenize(Unicode::narrowToWide(searchAttributeName), tokens, NULL, NULL) && (tokens.size() > 1)) + if (Unicode::tokenize(Unicode::narrowToWide(searchAttributeName), tokens, nullptr, nullptr) && (tokens.size() > 1)) { // the first value is the search attribute name to display searchAttributeName = Unicode::wideToNarrow(tokens[0]); @@ -177,7 +177,7 @@ void CommoditiesAdvancedSearchAttribute::install() { // for enum, parse out the aliases (if any) for the enum value tokens.clear(); - if (Unicode::tokenize(Unicode::narrowToWide(defaultSearchValue), tokens, NULL, NULL) && !tokens.empty()) + if (Unicode::tokenize(Unicode::narrowToWide(defaultSearchValue), tokens, nullptr, nullptr) && !tokens.empty()) { #ifdef _WIN32 #ifdef _DEBUG @@ -340,7 +340,7 @@ CommoditiesAdvancedSearchAttribute::SearchAttribute const * CommoditiesAdvancedS return iterFindAttribute->second; } - return NULL; + return nullptr; } //---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedGame/src/shared/core/CustomizationManager.cpp b/engine/shared/library/sharedGame/src/shared/core/CustomizationManager.cpp index 051bb14e..77dc02eb 100755 --- a/engine/shared/library/sharedGame/src/shared/core/CustomizationManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/CustomizationManager.cpp @@ -441,7 +441,7 @@ CustomizationVariable * CustomizationManager::findVariable (CustomizationData & if(!ms_installed) { DEBUG_FATAL(true, ("CustomizationManager not installed")); - return NULL; //lint !e527 unreachable (reachable in release) + return nullptr; //lint !e527 unreachable (reachable in release) } PathType type = PT_none; @@ -455,7 +455,7 @@ CustomizationVariable * CustomizationManager::findVariable (CustomizationData & if(!ms_installed) { DEBUG_FATAL(true, ("CustomizationManager not installed")); - return NULL; //lint !e527 unreachable (reachable in release) + return nullptr; //lint !e527 unreachable (reachable in release) } type = PT_none; @@ -467,7 +467,7 @@ CustomizationVariable * CustomizationManager::findVariable (CustomizationData & { //if we have the ranged customization variable is a dependent variable, ignore it (there will be another that controls it) if(rangedCV->getIsDependentVariable()) - cv = NULL; + cv = nullptr; } if (!cv) diff --git a/engine/shared/library/sharedGame/src/shared/core/FormManager.cpp b/engine/shared/library/sharedGame/src/shared/core/FormManager.cpp index 7074ff4c..789c118a 100755 --- a/engine/shared/library/sharedGame/src/shared/core/FormManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/FormManager.cpp @@ -81,10 +81,10 @@ FormManager::Field::Field(Form const * const parent) FormManager::Field::~Field() { delete m_choices; - m_choices = NULL; + m_choices = nullptr; delete m_otherValidationRules; - m_otherValidationRules = NULL; - m_parentForm = NULL; + m_otherValidationRules = nullptr; + m_parentForm = nullptr; } //---------------------------------------------------------------------- @@ -453,12 +453,12 @@ FormManager::Form::~Form() { //this vector does NOT own the pointers delete m_orderedFieldList; - m_orderedFieldList = NULL; + m_orderedFieldList = nullptr; //this list owns the pointers, so release it std::for_each(m_fields->begin(), m_fields->end(), PointerDeleterPairSecond()); delete m_fields; - m_fields = NULL; + m_fields = nullptr; } //---------------------------------------------------------------------- @@ -477,7 +477,7 @@ FormManager::Field const * FormManager::Form::getField(std::string const & field if(i != m_fields->end()) return i->second; else - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -531,13 +531,13 @@ void FormManager::remove () clearData(); delete ms_forms; - ms_forms = NULL; + ms_forms = nullptr; delete ms_serverObjectTemplateToForms; - ms_serverObjectTemplateToForms = NULL; + ms_serverObjectTemplateToForms = nullptr; delete ms_sharedObjectTemplateToForms; - ms_sharedObjectTemplateToForms = NULL; + ms_sharedObjectTemplateToForms = nullptr; delete ms_automaticallyCreateObjectForServerObjectTemplate; - ms_automaticallyCreateObjectForServerObjectTemplate = NULL; + ms_automaticallyCreateObjectForServerObjectTemplate = nullptr; s_tablesLoaded = false; s_installed = false; @@ -764,13 +764,13 @@ FormManager::Form const * FormManager::getFormByName(std::string const & formNam { DEBUG_FATAL (!s_installed, ("not installed")); if(!s_installed) - return NULL; + return nullptr; std::map::iterator i = ms_forms->find(formName); if(i != ms_forms->end()) return i->second; else - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -779,13 +779,13 @@ FormManager::Form const * FormManager::getFormForServerObjectTemplate(std::strin { DEBUG_FATAL (!s_installed, ("not installed")); if(!s_installed) - return NULL; + return nullptr; std::map::iterator i = ms_serverObjectTemplateToForms->find(serverTemplateName); if(i != ms_serverObjectTemplateToForms->end()) return i->second; else - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -794,13 +794,13 @@ FormManager::Form const * FormManager::getFormForSharedObjectTemplate(std::strin { DEBUG_FATAL (!s_installed, ("not installed")); if(!s_installed) - return NULL; + return nullptr; std::map::iterator i = ms_sharedObjectTemplateToForms->find(sharedTemplateName); if(i != ms_sharedObjectTemplateToForms->end()) return i->second; else - return NULL; + return nullptr; } //---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedGame/src/shared/core/GameScheduler.cpp b/engine/shared/library/sharedGame/src/shared/core/GameScheduler.cpp index e0b848ba..9ec51701 100755 --- a/engine/shared/library/sharedGame/src/shared/core/GameScheduler.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/GameScheduler.cpp @@ -74,7 +74,7 @@ void GameScheduler::remove() DEBUG_FATAL(!s_installed, ("GameScheduler not installed.")); delete s_scheduler; - s_scheduler = NULL; + s_scheduler = nullptr; s_installed = false; } diff --git a/engine/shared/library/sharedGame/src/shared/core/GroundZoneManager.cpp b/engine/shared/library/sharedGame/src/shared/core/GroundZoneManager.cpp index bc38d3e0..ddf2992d 100755 --- a/engine/shared/library/sharedGame/src/shared/core/GroundZoneManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/GroundZoneManager.cpp @@ -103,12 +103,12 @@ BuildoutArea const * GroundZoneManager::getZoneName(std::string const & sceneNam if(!SharedBuildoutAreaManager::isBuildoutScene(sceneName)) { - return NULL; + return nullptr; } else { BuildoutArea const * const ba = SharedBuildoutAreaManager::findBuildoutAreaAtPosition(sceneName, location_w.x, location_w.z, true); - if (NULL != ba) + if (nullptr != ba) { if (!ba->compositeName.empty()) zoneName = ba->compositeName; @@ -126,7 +126,7 @@ Vector GroundZoneManager::transformWorldLocationToZoneLocation(std::string const Vector pos_w = location_w; std::string zoneName; BuildoutArea const * const ba = GroundZoneManager::getZoneName(sceneName, location_w, zoneName); - if (NULL != ba) + if (nullptr != ba) { pos_w = ba->getRelativePosition(location_w, true); } diff --git a/engine/shared/library/sharedGame/src/shared/core/GuildRankDataTable.cpp b/engine/shared/library/sharedGame/src/shared/core/GuildRankDataTable.cpp index 2bd66b99..b5f2c62a 100755 --- a/engine/shared/library/sharedGame/src/shared/core/GuildRankDataTable.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/GuildRankDataTable.cpp @@ -65,7 +65,7 @@ void GuildRankDataTable::install() FATAL((columnRankSlotId < 0), ("column \"rankSlotId\" not found in %s", cs_guildRankDataTableName)); FATAL((columnTitle < 0), ("column \"title\" not found in %s", cs_guildRankDataTableName)); - GuildRankDataTable::GuildRank const * currentRank = NULL; + GuildRankDataTable::GuildRank const * currentRank = nullptr; int const numRows = table->getNumRows(); std::string rankName, alternateTitle; @@ -207,7 +207,7 @@ GuildRankDataTable::GuildRank const * GuildRankDataTable::getRank(std::string co if (iterFind != s_allGuildRanksByName.end()) return iterFind->second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -218,7 +218,7 @@ GuildRankDataTable::GuildRank const * GuildRankDataTable::getRankForDisplayRankN if (iterFind != s_allGuildRanksByDisplayName.end()) return iterFind->second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -229,7 +229,7 @@ GuildRankDataTable::GuildRank const * GuildRankDataTable::isARankTitle(std::stri if (iterFind != s_allGuildRanksByTitle.end()) return iterFind->second; - return NULL; + return nullptr; } // ====================================================================== diff --git a/engine/shared/library/sharedGame/src/shared/core/LfgCharacterData.cpp b/engine/shared/library/sharedGame/src/shared/core/LfgCharacterData.cpp index 31a0e655..3f26cadd 100755 --- a/engine/shared/library/sharedGame/src/shared/core/LfgCharacterData.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/LfgCharacterData.cpp @@ -1127,7 +1127,7 @@ std::map const & LfgCharacterData::calculateStatistics(std::ma } } - int32 const timeNow = static_cast(::time(NULL)); + int32 const timeNow = static_cast(::time(nullptr)); for (std::map::const_iterator iterLfgData = connectedCharacterLfgData.begin(); iterLfgData != connectedCharacterLfgData.end(); ++iterLfgData) { // searchable/anonymous diff --git a/engine/shared/library/sharedGame/src/shared/core/LfgDataTable.cpp b/engine/shared/library/sharedGame/src/shared/core/LfgDataTable.cpp index 6acce604..f7cfb688 100755 --- a/engine/shared/library/sharedGame/src/shared/core/LfgDataTable.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/LfgDataTable.cpp @@ -379,10 +379,10 @@ void LfgDataTable::install() unsigned long maxValueForNumBits; std::map names; std::map allSlotsById; - LfgNode * lfgNode = NULL; - LfgNode * currentTier1Node = NULL; - LfgNode * currentTier2Node = NULL; - LfgNode * currentTier3Node = NULL; + LfgNode * lfgNode = nullptr; + LfgNode * currentTier1Node = nullptr; + LfgNode * currentTier2Node = nullptr; + LfgNode * currentTier3Node = nullptr; for (int i = 0; i < numRows; ++i) { @@ -472,15 +472,15 @@ void LfgDataTable::install() FATAL(((minValue > 0) && (maxValueBeginSlotId < 0)), ("%s, row %d: minValueBeginSlotId/minValueEndSlotId/maxValueBeginSlotId/maxValueEndSlotId must be specified if minValue/maxValue is specified", cs_lfgDataTableName, (i+3))); // create a new node - lfgNode = NULL; + lfgNode = nullptr; if (!tier1.empty()) { - lfgNode = new LfgNode(tier1, internalAttribute, minValueBeginSlotId, minValueEndSlotId, maxValueBeginSlotId, maxValueEndSlotId, minValue, maxValue, defaultMatchCondition, NULL); + lfgNode = new LfgNode(tier1, internalAttribute, minValueBeginSlotId, minValueEndSlotId, maxValueBeginSlotId, maxValueEndSlotId, minValue, maxValue, defaultMatchCondition, nullptr); s_topLevelNodes.push_back(lfgNode); currentTier1Node = lfgNode; - currentTier2Node = NULL; - currentTier3Node = NULL; + currentTier2Node = nullptr; + currentTier3Node = nullptr; } else if (!tier2.empty()) { @@ -490,7 +490,7 @@ void LfgDataTable::install() currentTier1Node->children.push_back(lfgNode); currentTier2Node = lfgNode; - currentTier3Node = NULL; + currentTier3Node = nullptr; } else if (!tier3.empty()) { @@ -580,7 +580,7 @@ void LfgDataTable::install() // find out the leaf node's ancestor, if any, that has the Any/All option LfgNode const * parentNode = node.parent; - bool const hasParent = (parentNode != NULL); + bool const hasParent = (parentNode != nullptr); int countParentWithNonNaDefaultMatchCondition = 0; std::string stringParentWithNonNaDefaultMatchCondition; while (parentNode) @@ -670,7 +670,7 @@ LfgDataTable::LfgNode const * LfgDataTable::getLfgNodeByName(std::string const & { std::map::const_iterator iterNode = s_allNodesByName.find(lfgNodeName); if (iterNode == s_allNodesByName.end()) - return NULL; + return nullptr; return iterNode->second; } @@ -681,7 +681,7 @@ LfgDataTable::LfgNode const * LfgDataTable::getLfgLeafNodeByName(std::string con { std::map::const_iterator iterNode = s_allLeafNodesByName.find(lfgNodeName); if (iterNode == s_allLeafNodesByName.end()) - return NULL; + return nullptr; return iterNode->second; } diff --git a/engine/shared/library/sharedGame/src/shared/core/LfgDataTable.h b/engine/shared/library/sharedGame/src/shared/core/LfgDataTable.h index e95f1e85..5ffc3e70 100755 --- a/engine/shared/library/sharedGame/src/shared/core/LfgDataTable.h +++ b/engine/shared/library/sharedGame/src/shared/core/LfgDataTable.h @@ -47,7 +47,7 @@ public: { public: LfgNode(std::string const & pName, bool pInternalAttribute, int pMinValueBeginSlotId, int pMinValueEndSlotId, int pMaxValueBeginSlotId, int pMaxValueEndSlotId, int pMinValue, int pMaxValue, DefaultMatchConditionType pDefaultMatchCondition, LfgNode const * pParent) : - name(pName), internalAttribute(pInternalAttribute), minValueBeginSlotId(pMinValueBeginSlotId), minValueEndSlotId(pMinValueEndSlotId), maxValueBeginSlotId(pMaxValueBeginSlotId), maxValueEndSlotId(pMaxValueEndSlotId), minValue(pMinValue), maxValue(pMaxValue), defaultMatchCondition(pDefaultMatchCondition), actualMatchCondition(DMCT_NA), parent(pParent), anyAllGroupingParent(NULL), children(), hasAnyInternalAttributeLeafNodeDescendants(false), hasAnyExternalAttributeLeafNodeDescendants(false), internalAttributeMatchFunction(NULL) {}; + name(pName), internalAttribute(pInternalAttribute), minValueBeginSlotId(pMinValueBeginSlotId), minValueEndSlotId(pMinValueEndSlotId), maxValueBeginSlotId(pMaxValueBeginSlotId), maxValueEndSlotId(pMaxValueEndSlotId), minValue(pMinValue), maxValue(pMaxValue), defaultMatchCondition(pDefaultMatchCondition), actualMatchCondition(DMCT_NA), parent(pParent), anyAllGroupingParent(nullptr), children(), hasAnyInternalAttributeLeafNodeDescendants(false), hasAnyExternalAttributeLeafNodeDescendants(false), internalAttributeMatchFunction(nullptr) {}; std::string const name; bool const internalAttribute; diff --git a/engine/shared/library/sharedGame/src/shared/core/PlayerCreationManager.cpp b/engine/shared/library/sharedGame/src/shared/core/PlayerCreationManager.cpp index 24efe09a..d089cc2c 100755 --- a/engine/shared/library/sharedGame/src/shared/core/PlayerCreationManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/PlayerCreationManager.cpp @@ -530,9 +530,9 @@ void PlayerCreationManager::buildRacialMinsMaxes() const DataTable * dt = DataTableManager::getTable( "datatables/creation/attribute_limits.iff", true); - WARNING_STRICT_FATAL(dt == NULL, ("Unable to read the " + WARNING_STRICT_FATAL(dt == nullptr, ("Unable to read the " "attribute_limits datatable")); - if (dt == NULL) + if (dt == nullptr) return; int numAttribs = dt->getNumColumns() - 1; diff --git a/engine/shared/library/sharedGame/src/shared/core/SharedBuffBuilderManager.cpp b/engine/shared/library/sharedGame/src/shared/core/SharedBuffBuilderManager.cpp index 40e7ffb8..a9edcafd 100755 --- a/engine/shared/library/sharedGame/src/shared/core/SharedBuffBuilderManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/SharedBuffBuilderManager.cpp @@ -29,7 +29,7 @@ namespace SharedBuffBuilderManagerNamespace const std::string ms_reactiveSecondChanceComponentName = "reactive_second_chance"; } -SharedBuffBuilderManager::BuffBuilderDataType * SharedBuffBuilderManager::ms_buffBuilderData=NULL; +SharedBuffBuilderManager::BuffBuilderDataType * SharedBuffBuilderManager::ms_buffBuilderData=nullptr; using namespace SharedBuffBuilderManagerNamespace; // ====================================================================== diff --git a/engine/shared/library/sharedGame/src/shared/core/SharedBuildoutAreaManager.cpp b/engine/shared/library/sharedGame/src/shared/core/SharedBuildoutAreaManager.cpp index cec5ff33..5786d3e6 100755 --- a/engine/shared/library/sharedGame/src/shared/core/SharedBuildoutAreaManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/SharedBuildoutAreaManager.cpp @@ -321,7 +321,7 @@ std::string SharedBuildoutAreaManager::getBuildoutNameForPosition(std::string co { BuildoutArea const * const ba = findBuildoutAreaAtPosition(sceneName, location_w.x, location_w.z, ignoreInternal, ignoreNonActiveEvents); - if (NULL != ba) + if (nullptr != ba) return sceneName + cms_sceneAndAreaDelimeter + ba->areaName; return sceneName; @@ -537,7 +537,7 @@ SharedBuildoutAreaManager::BuildoutAreaVector const * SharedBuildoutAreaManager: { return &it->second; } - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -546,8 +546,8 @@ BuildoutArea const * SharedBuildoutAreaManager::findBuildoutAreaAtPosition(std:: { BuildoutAreaVector const * const bav = findBuildoutAreasForScene(sceneId); - if (NULL == bav) - return NULL; + if (nullptr == bav) + return nullptr; for (BuildoutAreaVector::const_iterator it = bav->begin(); it != bav->end(); ++it) { @@ -567,7 +567,7 @@ BuildoutArea const * SharedBuildoutAreaManager::findBuildoutAreaAtPosition(std:: } } - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -579,11 +579,11 @@ BuildoutArea const * SharedBuildoutAreaManager::findBuildoutAreaAtPosition(float if (ignoreInternal && buildoutArea.internalBuildoutArea) { - return NULL; + return nullptr; } if(ignoreNonActiveEvents && !buildoutArea.requiredEventName.empty()) - return NULL; + return nullptr; if (buildoutArea.isLocationInside(x, z)) { @@ -591,7 +591,7 @@ BuildoutArea const * SharedBuildoutAreaManager::findBuildoutAreaAtPosition(float } } - return NULL; + return nullptr; } //---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedGame/src/shared/core/SharedImageDesignerManager.cpp b/engine/shared/library/sharedGame/src/shared/core/SharedImageDesignerManager.cpp index 62e46247..c0ee57fa 100755 --- a/engine/shared/library/sharedGame/src/shared/core/SharedImageDesignerManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/SharedImageDesignerManager.cpp @@ -358,7 +358,7 @@ bool SharedImageDesignerManager::isSessionValid(SharedImageDesignerManager::Sess if(customizationDataHair) customizationDataForThisCustomization = customizationDataHair; else - customizationDataForThisCustomization = NULL; + customizationDataForThisCustomization = nullptr; } if(customizationDataForThisCustomization) diff --git a/engine/shared/library/sharedGame/src/shared/core/Universe.cpp b/engine/shared/library/sharedGame/src/shared/core/Universe.cpp index 5d5186d4..60eeba1e 100755 --- a/engine/shared/library/sharedGame/src/shared/core/Universe.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/Universe.cpp @@ -17,14 +17,14 @@ // ====================================================================== -Universe * Universe::ms_theInstance = NULL; +Universe * Universe::ms_theInstance = nullptr; bool Universe::ms_installed = false; //=================================================================== void Universe::installDerived(Universe *derivedInstance) { - DEBUG_FATAL(ms_installed || ms_theInstance!=NULL,("Installed Universe twice.\n")); + DEBUG_FATAL(ms_installed || ms_theInstance!=nullptr,("Installed Universe twice.\n")); ms_theInstance = derivedInstance; ms_installed = true; @@ -43,7 +43,7 @@ void Universe::remove() Universe::Universe() : m_resourceClassNameMap (new ResourceClassNameMap), m_resourceClassNameCrcMap (new ResourceClassNameCrcMap), - m_resourceTreeRoot (NULL) + m_resourceTreeRoot (nullptr) { ResourceClassObject::install(); // sets up some static strings used by the import process } diff --git a/engine/shared/library/sharedGame/src/shared/core/WearableEntry.cpp b/engine/shared/library/sharedGame/src/shared/core/WearableEntry.cpp index 767c20f4..f0c9912a 100755 --- a/engine/shared/library/sharedGame/src/shared/core/WearableEntry.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/WearableEntry.cpp @@ -103,7 +103,7 @@ namespace Archive put(target, source.m_networkId); put(target, source.m_objectTemplate); - bool isWeapon = (source.m_weaponSharedBaselines.get() != NULL); + bool isWeapon = (source.m_weaponSharedBaselines.get() != nullptr); put(target, isWeapon); if (isWeapon) { diff --git a/engine/shared/library/sharedGame/src/shared/mount/MountValidScaleRangeTable.cpp b/engine/shared/library/sharedGame/src/shared/mount/MountValidScaleRangeTable.cpp index 775c8119..4a4139a9 100755 --- a/engine/shared/library/sharedGame/src/shared/mount/MountValidScaleRangeTable.cpp +++ b/engine/shared/library/sharedGame/src/shared/mount/MountValidScaleRangeTable.cpp @@ -248,7 +248,7 @@ void MountValidScaleRangeTableNamespace::loadTableData(char const *filename) TemporaryCrcString const mountableCreatureAppearanceNameCrc(mountableCreatureAppearanceName.c_str(), true); //-- Find or create new MountableCreature instance for this creature name. - MountableCreature *mountableCreature = NULL; + MountableCreature *mountableCreature = nullptr; MountableCreatureTable::iterator lowerBoundIt = s_mountableCreatureTable.lower_bound((const CrcString*)&mountableCreatureAppearanceNameCrc); bool const mountableCreatureEntryExists = ((lowerBoundIt != s_mountableCreatureTable.end()) && !s_mountableCreatureTable.key_comp()(static_cast(&mountableCreatureAppearanceNameCrc), lowerBoundIt->first)); @@ -289,7 +289,7 @@ MountValidScaleRangeTableNamespace::MountableCreature const *MountValidScaleRang else { DEBUG_WARNING(true, ("'datatables/mount/valid_scale_range.iff' missing entry for creature appearance name '%s'", creatureAppearanceName.getString())); - return NULL; + return nullptr; } } diff --git a/engine/shared/library/sharedGame/src/shared/mount/SharedSaddleManager.cpp b/engine/shared/library/sharedGame/src/shared/mount/SharedSaddleManager.cpp index 5c2de639..083ed7c5 100755 --- a/engine/shared/library/sharedGame/src/shared/mount/SharedSaddleManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/mount/SharedSaddleManager.cpp @@ -433,7 +433,7 @@ int SharedSaddleManagerNamespace::TemporaryRiderPoseMapEntry::getRiderSeatIndex( CrcString const *SharedSaddleManagerNamespace::TemporaryRiderPoseMapEntry::getRiderPoseName() const { - return NULL; + return nullptr; } // ====================================================================== diff --git a/engine/shared/library/sharedGame/src/shared/object/ResourceClassObject.cpp b/engine/shared/library/sharedGame/src/shared/object/ResourceClassObject.cpp index 71d3696c..46293784 100755 --- a/engine/shared/library/sharedGame/src/shared/object/ResourceClassObject.cpp +++ b/engine/shared/library/sharedGame/src/shared/object/ResourceClassObject.cpp @@ -39,8 +39,8 @@ using namespace ResourceClassObjectNamespace; ResourceClassObject::ResourceClassObject() : m_resourceClassName(), - m_parentClass(NULL), - m_friendlyName(NULL), + m_parentClass(nullptr), + m_friendlyName(nullptr), m_minTypes(0), m_maxTypes(0), m_minPools(0), @@ -49,7 +49,7 @@ ResourceClassObject::ResourceClassObject() : m_nameTable(), m_recycled(false), m_permanent(false), - m_recycledVersion(NULL), + m_recycledVersion(nullptr), m_resourceAttributeRanges(new ResourceAttributeRangesType()), m_children(new ClassList) { @@ -60,18 +60,18 @@ ResourceClassObject::ResourceClassObject() : ResourceClassObject::~ResourceClassObject() { delete m_children; - m_children = NULL; + m_children = nullptr; delete m_resourceAttributeRanges; - m_resourceAttributeRanges = NULL; + m_resourceAttributeRanges = nullptr; - m_parentClass = NULL; - m_recycledVersion = NULL; + m_parentClass = nullptr; + m_recycledVersion = nullptr; - if (m_friendlyName != NULL) + if (m_friendlyName != nullptr) { delete m_friendlyName; - m_friendlyName = NULL; + m_friendlyName = nullptr; } } @@ -254,7 +254,7 @@ ResourceClassObject::ResourceAttributeRangesType const & ResourceClassObject::ge { static const ResourceAttributeRangesType emptyRanges; - if (m_resourceAttributeRanges != NULL) + if (m_resourceAttributeRanges != nullptr) return *m_resourceAttributeRanges; return emptyRanges; } @@ -304,7 +304,7 @@ void ResourceClassObject::loadTreeFromIff() int numRows = resourceDataTable->getNumRows(); ResourceClassObject * parents[8]; for (int i=0; i<8; ++i) - parents[i]=NULL; + parents[i]=nullptr; static const std::string colName_resourceClassName = "ENUM"; static const std::string colName_maxTypes = "Maximum # types"; @@ -334,7 +334,7 @@ void ResourceClassObject::loadTreeFromIff() if (possibleName.size()!=0) { if (wheresTheName==0) - newClass->m_parentClass = NULL; + newClass->m_parentClass = nullptr; else { newClass->m_parentClass = parents[wheresTheName-1]; @@ -438,12 +438,12 @@ bool ResourceClassObject::isLeaf() const void ResourceClassObject::getChildren(std::vector & children, bool recurse) const { - if (m_children == NULL) + if (m_children == nullptr) return; for (ClassList::const_iterator i = m_children->begin(); i != m_children->end(); ++i) { - if (*i != NULL) + if (*i != nullptr) { children.push_back(*i); if (recurse) @@ -456,12 +456,12 @@ void ResourceClassObject::getChildren(std::vector & void ResourceClassObject::getLeafChildren(std::vector & children) const { - if (m_children == NULL) + if (m_children == nullptr) return; for (ClassList::const_iterator i = m_children->begin(); i != m_children->end(); ++i) { - if (*i != NULL) + if (*i != nullptr) { if ((*i)->isLeaf()) children.push_back(*i); @@ -493,7 +493,7 @@ ResourceClassObject const * ResourceClassObject::getRecycledVersion() const return m_recycledVersion; else if (m_parentClass) return m_parentClass->getRecycledVersion(); - else return NULL; + else return nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedGame/src/shared/object/ResourceClassObject.h b/engine/shared/library/sharedGame/src/shared/object/ResourceClassObject.h index 16de81e8..1361de6e 100755 --- a/engine/shared/library/sharedGame/src/shared/object/ResourceClassObject.h +++ b/engine/shared/library/sharedGame/src/shared/object/ResourceClassObject.h @@ -118,7 +118,7 @@ inline const StringId & ResourceClassObject::getFriendlyName () const inline bool ResourceClassObject::isRoot() const { - return (m_parentClass == NULL); + return (m_parentClass == nullptr); } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedGame/src/shared/object/Waypoint.cpp b/engine/shared/library/sharedGame/src/shared/object/Waypoint.cpp index 08cc4479..74f3f8ba 100755 --- a/engine/shared/library/sharedGame/src/shared/object/Waypoint.cpp +++ b/engine/shared/library/sharedGame/src/shared/object/Waypoint.cpp @@ -160,7 +160,7 @@ WaypointDataBase::WaypointDataBase() : void WaypointDataBase::setName(Unicode::String const &name) { //This magical number (250) is chosen because the waypoint datatable has VARCHAR2(512) in this column, - //and we're assuming 2 bytes per char (which is not quite true actually) plus an extra one for null plus + //and we're assuming 2 bytes per char (which is not quite true actually) plus an extra one for nullptr plus //a few extra for good measure and because nobody needs 251-character waypoint names. if (name.length() > 250) { diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBattlefieldMarkerObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBattlefieldMarkerObjectTemplate.cpp index 9e973c36..a83d8b7f 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBattlefieldMarkerObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBattlefieldMarkerObjectTemplate.cpp @@ -95,10 +95,10 @@ Tag SharedBattlefieldMarkerObjectTemplate::getTemplateVersion(void) const */ Tag SharedBattlefieldMarkerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedBattlefieldMarkerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedBattlefieldMarkerObjectTemplate::getHighestTemplateVersion @@ -112,26 +112,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedBattlefieldMarkerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedBattlefieldMarkerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getNumberOfPoles(true); #endif } if (!m_numberOfPoles.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter numberOfPoles in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter numberOfPoles has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter numberOfPoles has not been defined in template %s!", DataResource::getName())); return base->getNumberOfPoles(); } } @@ -141,9 +141,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getNumberOfPoles(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -160,7 +160,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -176,26 +176,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedBattlefieldMarkerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedBattlefieldMarkerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getNumberOfPolesMin(true); #endif } if (!m_numberOfPoles.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter numberOfPoles in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter numberOfPoles has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter numberOfPoles has not been defined in template %s!", DataResource::getName())); return base->getNumberOfPolesMin(); } } @@ -205,9 +205,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getNumberOfPolesMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -224,7 +224,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -240,26 +240,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedBattlefieldMarkerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedBattlefieldMarkerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getNumberOfPolesMax(true); #endif } if (!m_numberOfPoles.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter numberOfPoles in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter numberOfPoles has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter numberOfPoles has not been defined in template %s!", DataResource::getName())); return base->getNumberOfPolesMax(); } } @@ -269,9 +269,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getNumberOfPolesMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -288,7 +288,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -304,26 +304,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedBattlefieldMarkerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedBattlefieldMarkerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getRadius(true); #endif } if (!m_radius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter radius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter radius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter radius has not been defined in template %s!", DataResource::getName())); return base->getRadius(); } } @@ -333,9 +333,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getRadius(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -352,7 +352,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -368,26 +368,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedBattlefieldMarkerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedBattlefieldMarkerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getRadiusMin(true); #endif } if (!m_radius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter radius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter radius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter radius has not been defined in template %s!", DataResource::getName())); return base->getRadiusMin(); } } @@ -397,9 +397,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getRadiusMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -416,7 +416,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -432,26 +432,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedBattlefieldMarkerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedBattlefieldMarkerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getRadiusMax(true); #endif } if (!m_radius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter radius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter radius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter radius has not been defined in template %s!", DataResource::getName())); return base->getRadiusMax(); } } @@ -461,9 +461,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getRadiusMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -480,7 +480,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -529,12 +529,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBuildingObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBuildingObjectTemplate.cpp index 793143b0..89b64952 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBuildingObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBuildingObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedBuildingObjectTemplate::getTemplateVersion(void) const */ Tag SharedBuildingObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedBuildingObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedBuildingObjectTemplate::getHighestTemplateVersion @@ -111,33 +111,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedBuildingObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedBuildingObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTerrainModificationFileName(true); #endif } if (!m_terrainModificationFileName.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter terrainModificationFileName in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter terrainModificationFileName has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter terrainModificationFileName has not been defined in template %s!", DataResource::getName())); return base->getTerrainModificationFileName(); } } const std::string & value = m_terrainModificationFileName.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -153,33 +153,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedBuildingObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedBuildingObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getInteriorLayoutFileName(true); #endif } if (!m_interiorLayoutFileName.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter interiorLayoutFileName in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter interiorLayoutFileName has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter interiorLayoutFileName has not been defined in template %s!", DataResource::getName())); return base->getInteriorLayoutFileName(); } } const std::string & value = m_interiorLayoutFileName.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -226,12 +226,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCellObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCellObjectTemplate.cpp index 1cdcca72..0c319760 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCellObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCellObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedCellObjectTemplate::getTemplateVersion(void) const */ Tag SharedCellObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedCellObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedCellObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedConstructionContractObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedConstructionContractObjectTemplate.cpp index ba6ece47..ab455e20 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedConstructionContractObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedConstructionContractObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedConstructionContractObjectTemplate::getTemplateVersion(void) const */ Tag SharedConstructionContractObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedConstructionContractObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedConstructionContractObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCreatureObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCreatureObjectTemplate.cpp index 5254f31c..6c5c3db1 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCreatureObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCreatureObjectTemplate.cpp @@ -104,10 +104,10 @@ Tag SharedCreatureObjectTemplate::getTemplateVersion(void) const */ Tag SharedCreatureObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedCreatureObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedCreatureObjectTemplate::getHighestTemplateVersion @@ -175,33 +175,33 @@ SharedCreatureObjectTemplate::Gender testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getGender(true); #endif } if (!m_gender.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter gender in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter gender has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter gender has not been defined in template %s!", DataResource::getName())); return base->getGender(); } } Gender value = static_cast(m_gender.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -217,33 +217,33 @@ SharedCreatureObjectTemplate::Niche testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getNiche(true); #endif } if (!m_niche.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter niche in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter niche has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter niche has not been defined in template %s!", DataResource::getName())); return base->getNiche(); } } Niche value = static_cast(m_niche.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -259,33 +259,33 @@ SharedCreatureObjectTemplate::Species testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSpecies(true); #endif } if (!m_species.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter species in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter species has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter species has not been defined in template %s!", DataResource::getName())); return base->getSpecies(); } } Species value = static_cast(m_species.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -301,33 +301,33 @@ SharedCreatureObjectTemplate::Race testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getRace(true); #endif } if (!m_race.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter race in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter race has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter race has not been defined in template %s!", DataResource::getName())); return base->getRace(); } } Race value = static_cast(m_race.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -337,8 +337,8 @@ UNREF(testData); float SharedCreatureObjectTemplate::getAcceleration(MovementTypes index) const { - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -346,14 +346,14 @@ float SharedCreatureObjectTemplate::getAcceleration(MovementTypes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 2, ("template param index out of range")); if (!m_acceleration[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter acceleration in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter acceleration has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter acceleration has not been defined in template %s!", DataResource::getName())); return base->getAcceleration(index); } } @@ -363,9 +363,9 @@ float SharedCreatureObjectTemplate::getAcceleration(MovementTypes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAcceleration(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -386,8 +386,8 @@ float SharedCreatureObjectTemplate::getAcceleration(MovementTypes index) const float SharedCreatureObjectTemplate::getAccelerationMin(MovementTypes index) const { - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -395,14 +395,14 @@ float SharedCreatureObjectTemplate::getAccelerationMin(MovementTypes index) cons DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 2, ("template param index out of range")); if (!m_acceleration[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter acceleration in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter acceleration has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter acceleration has not been defined in template %s!", DataResource::getName())); return base->getAccelerationMin(index); } } @@ -412,9 +412,9 @@ float SharedCreatureObjectTemplate::getAccelerationMin(MovementTypes index) cons if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAccelerationMin(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -435,8 +435,8 @@ float SharedCreatureObjectTemplate::getAccelerationMin(MovementTypes index) cons float SharedCreatureObjectTemplate::getAccelerationMax(MovementTypes index) const { - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -444,14 +444,14 @@ float SharedCreatureObjectTemplate::getAccelerationMax(MovementTypes index) cons DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 2, ("template param index out of range")); if (!m_acceleration[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter acceleration in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter acceleration has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter acceleration has not been defined in template %s!", DataResource::getName())); return base->getAccelerationMax(index); } } @@ -461,9 +461,9 @@ float SharedCreatureObjectTemplate::getAccelerationMax(MovementTypes index) cons if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAccelerationMax(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -484,8 +484,8 @@ float SharedCreatureObjectTemplate::getAccelerationMax(MovementTypes index) cons float SharedCreatureObjectTemplate::getSpeed(MovementTypes index) const { - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -493,14 +493,14 @@ float SharedCreatureObjectTemplate::getSpeed(MovementTypes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 2, ("template param index out of range")); if (!m_speed[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter speed in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter speed has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter speed has not been defined in template %s!", DataResource::getName())); return base->getSpeed(index); } } @@ -510,9 +510,9 @@ float SharedCreatureObjectTemplate::getSpeed(MovementTypes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSpeed(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -533,8 +533,8 @@ float SharedCreatureObjectTemplate::getSpeed(MovementTypes index) const float SharedCreatureObjectTemplate::getSpeedMin(MovementTypes index) const { - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -542,14 +542,14 @@ float SharedCreatureObjectTemplate::getSpeedMin(MovementTypes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 2, ("template param index out of range")); if (!m_speed[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter speed in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter speed has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter speed has not been defined in template %s!", DataResource::getName())); return base->getSpeedMin(index); } } @@ -559,9 +559,9 @@ float SharedCreatureObjectTemplate::getSpeedMin(MovementTypes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSpeedMin(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -582,8 +582,8 @@ float SharedCreatureObjectTemplate::getSpeedMin(MovementTypes index) const float SharedCreatureObjectTemplate::getSpeedMax(MovementTypes index) const { - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -591,14 +591,14 @@ float SharedCreatureObjectTemplate::getSpeedMax(MovementTypes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 2, ("template param index out of range")); if (!m_speed[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter speed in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter speed has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter speed has not been defined in template %s!", DataResource::getName())); return base->getSpeedMax(index); } } @@ -608,9 +608,9 @@ float SharedCreatureObjectTemplate::getSpeedMax(MovementTypes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSpeedMax(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -631,8 +631,8 @@ float SharedCreatureObjectTemplate::getSpeedMax(MovementTypes index) const float SharedCreatureObjectTemplate::getTurnRate(MovementTypes index) const { - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -640,14 +640,14 @@ float SharedCreatureObjectTemplate::getTurnRate(MovementTypes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 2, ("template param index out of range")); if (!m_turnRate[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter turnRate in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter turnRate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter turnRate has not been defined in template %s!", DataResource::getName())); return base->getTurnRate(index); } } @@ -657,9 +657,9 @@ float SharedCreatureObjectTemplate::getTurnRate(MovementTypes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTurnRate(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -680,8 +680,8 @@ float SharedCreatureObjectTemplate::getTurnRate(MovementTypes index) const float SharedCreatureObjectTemplate::getTurnRateMin(MovementTypes index) const { - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -689,14 +689,14 @@ float SharedCreatureObjectTemplate::getTurnRateMin(MovementTypes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 2, ("template param index out of range")); if (!m_turnRate[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter turnRate in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter turnRate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter turnRate has not been defined in template %s!", DataResource::getName())); return base->getTurnRateMin(index); } } @@ -706,9 +706,9 @@ float SharedCreatureObjectTemplate::getTurnRateMin(MovementTypes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTurnRateMin(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -729,8 +729,8 @@ float SharedCreatureObjectTemplate::getTurnRateMin(MovementTypes index) const float SharedCreatureObjectTemplate::getTurnRateMax(MovementTypes index) const { - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -738,14 +738,14 @@ float SharedCreatureObjectTemplate::getTurnRateMax(MovementTypes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 2, ("template param index out of range")); if (!m_turnRate[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter turnRate in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter turnRate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter turnRate has not been defined in template %s!", DataResource::getName())); return base->getTurnRateMax(index); } } @@ -755,9 +755,9 @@ float SharedCreatureObjectTemplate::getTurnRateMax(MovementTypes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTurnRateMax(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -784,33 +784,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAnimationMapFilename(true); #endif } if (!m_animationMapFilename.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter animationMapFilename in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter animationMapFilename has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter animationMapFilename has not been defined in template %s!", DataResource::getName())); return base->getAnimationMapFilename(); } } const std::string & value = m_animationMapFilename.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -826,26 +826,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSlopeModAngle(true); #endif } if (!m_slopeModAngle.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slopeModAngle in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slopeModAngle has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slopeModAngle has not been defined in template %s!", DataResource::getName())); return base->getSlopeModAngle(); } } @@ -855,9 +855,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSlopeModAngle(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -874,7 +874,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -890,26 +890,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSlopeModAngleMin(true); #endif } if (!m_slopeModAngle.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slopeModAngle in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slopeModAngle has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slopeModAngle has not been defined in template %s!", DataResource::getName())); return base->getSlopeModAngleMin(); } } @@ -919,9 +919,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSlopeModAngleMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -938,7 +938,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -954,26 +954,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSlopeModAngleMax(true); #endif } if (!m_slopeModAngle.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slopeModAngle in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slopeModAngle has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slopeModAngle has not been defined in template %s!", DataResource::getName())); return base->getSlopeModAngleMax(); } } @@ -983,9 +983,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSlopeModAngleMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1002,7 +1002,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1018,26 +1018,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSlopeModPercent(true); #endif } if (!m_slopeModPercent.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slopeModPercent in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slopeModPercent has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slopeModPercent has not been defined in template %s!", DataResource::getName())); return base->getSlopeModPercent(); } } @@ -1047,9 +1047,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSlopeModPercent(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1066,7 +1066,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1082,26 +1082,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSlopeModPercentMin(true); #endif } if (!m_slopeModPercent.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slopeModPercent in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slopeModPercent has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slopeModPercent has not been defined in template %s!", DataResource::getName())); return base->getSlopeModPercentMin(); } } @@ -1111,9 +1111,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSlopeModPercentMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1130,7 +1130,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1146,26 +1146,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSlopeModPercentMax(true); #endif } if (!m_slopeModPercent.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slopeModPercent in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slopeModPercent has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slopeModPercent has not been defined in template %s!", DataResource::getName())); return base->getSlopeModPercentMax(); } } @@ -1175,9 +1175,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSlopeModPercentMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1194,7 +1194,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1210,26 +1210,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getWaterModPercent(true); #endif } if (!m_waterModPercent.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter waterModPercent in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter waterModPercent has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter waterModPercent has not been defined in template %s!", DataResource::getName())); return base->getWaterModPercent(); } } @@ -1239,9 +1239,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getWaterModPercent(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1258,7 +1258,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1274,26 +1274,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getWaterModPercentMin(true); #endif } if (!m_waterModPercent.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter waterModPercent in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter waterModPercent has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter waterModPercent has not been defined in template %s!", DataResource::getName())); return base->getWaterModPercentMin(); } } @@ -1303,9 +1303,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getWaterModPercentMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1322,7 +1322,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1338,26 +1338,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getWaterModPercentMax(true); #endif } if (!m_waterModPercent.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter waterModPercent in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter waterModPercent has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter waterModPercent has not been defined in template %s!", DataResource::getName())); return base->getWaterModPercentMax(); } } @@ -1367,9 +1367,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getWaterModPercentMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1386,7 +1386,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1402,26 +1402,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getStepHeight(true); #endif } if (!m_stepHeight.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter stepHeight in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter stepHeight has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter stepHeight has not been defined in template %s!", DataResource::getName())); return base->getStepHeight(); } } @@ -1431,9 +1431,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getStepHeight(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1450,7 +1450,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1466,26 +1466,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getStepHeightMin(true); #endif } if (!m_stepHeight.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter stepHeight in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter stepHeight has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter stepHeight has not been defined in template %s!", DataResource::getName())); return base->getStepHeightMin(); } } @@ -1495,9 +1495,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getStepHeightMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1514,7 +1514,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1530,26 +1530,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getStepHeightMax(true); #endif } if (!m_stepHeight.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter stepHeight in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter stepHeight has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter stepHeight has not been defined in template %s!", DataResource::getName())); return base->getStepHeightMax(); } } @@ -1559,9 +1559,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getStepHeightMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1578,7 +1578,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1594,26 +1594,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCollisionHeight(true); #endif } if (!m_collisionHeight.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionHeight in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter collisionHeight has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter collisionHeight has not been defined in template %s!", DataResource::getName())); return base->getCollisionHeight(); } } @@ -1623,9 +1623,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCollisionHeight(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1642,7 +1642,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1658,26 +1658,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCollisionHeightMin(true); #endif } if (!m_collisionHeight.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionHeight in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter collisionHeight has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter collisionHeight has not been defined in template %s!", DataResource::getName())); return base->getCollisionHeightMin(); } } @@ -1687,9 +1687,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCollisionHeightMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1706,7 +1706,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1722,26 +1722,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCollisionHeightMax(true); #endif } if (!m_collisionHeight.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionHeight in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter collisionHeight has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter collisionHeight has not been defined in template %s!", DataResource::getName())); return base->getCollisionHeightMax(); } } @@ -1751,9 +1751,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCollisionHeightMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1770,7 +1770,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1786,26 +1786,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCollisionRadius(true); #endif } if (!m_collisionRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter collisionRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter collisionRadius has not been defined in template %s!", DataResource::getName())); return base->getCollisionRadius(); } } @@ -1815,9 +1815,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCollisionRadius(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1834,7 +1834,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1850,26 +1850,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCollisionRadiusMin(true); #endif } if (!m_collisionRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter collisionRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter collisionRadius has not been defined in template %s!", DataResource::getName())); return base->getCollisionRadiusMin(); } } @@ -1879,9 +1879,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCollisionRadiusMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1898,7 +1898,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1914,26 +1914,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCollisionRadiusMax(true); #endif } if (!m_collisionRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter collisionRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter collisionRadius has not been defined in template %s!", DataResource::getName())); return base->getCollisionRadiusMax(); } } @@ -1943,9 +1943,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCollisionRadiusMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1962,7 +1962,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1978,33 +1978,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMovementDatatable(true); #endif } if (!m_movementDatatable.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter movementDatatable in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter movementDatatable has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter movementDatatable has not been defined in template %s!", DataResource::getName())); return base->getMovementDatatable(); } } const std::string & value = m_movementDatatable.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2014,8 +2014,8 @@ UNREF(testData); bool SharedCreatureObjectTemplate::getPostureAlignToTerrain(Postures index) const { - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -2023,14 +2023,14 @@ bool SharedCreatureObjectTemplate::getPostureAlignToTerrain(Postures index) cons DEBUG_FATAL(index < 0 || index >= 15, ("template param index out of range")); if (!m_postureAlignToTerrain[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter postureAlignToTerrain in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter postureAlignToTerrain has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter postureAlignToTerrain has not been defined in template %s!", DataResource::getName())); return base->getPostureAlignToTerrain(index); } } @@ -2047,26 +2047,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSwimHeight(true); #endif } if (!m_swimHeight.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter swimHeight in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter swimHeight has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter swimHeight has not been defined in template %s!", DataResource::getName())); return base->getSwimHeight(); } } @@ -2076,9 +2076,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSwimHeight(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2095,7 +2095,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2111,26 +2111,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSwimHeightMin(true); #endif } if (!m_swimHeight.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter swimHeight in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter swimHeight has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter swimHeight has not been defined in template %s!", DataResource::getName())); return base->getSwimHeightMin(); } } @@ -2140,9 +2140,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSwimHeightMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2159,7 +2159,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2175,26 +2175,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSwimHeightMax(true); #endif } if (!m_swimHeight.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter swimHeight in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter swimHeight has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter swimHeight has not been defined in template %s!", DataResource::getName())); return base->getSwimHeightMax(); } } @@ -2204,9 +2204,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSwimHeightMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2223,7 +2223,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2239,26 +2239,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getWarpTolerance(true); #endif } if (!m_warpTolerance.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter warpTolerance in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter warpTolerance has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter warpTolerance has not been defined in template %s!", DataResource::getName())); return base->getWarpTolerance(); } } @@ -2268,9 +2268,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getWarpTolerance(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2287,7 +2287,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2303,26 +2303,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getWarpToleranceMin(true); #endif } if (!m_warpTolerance.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter warpTolerance in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter warpTolerance has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter warpTolerance has not been defined in template %s!", DataResource::getName())); return base->getWarpToleranceMin(); } } @@ -2332,9 +2332,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getWarpToleranceMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2351,7 +2351,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2367,26 +2367,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getWarpToleranceMax(true); #endif } if (!m_warpTolerance.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter warpTolerance in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter warpTolerance has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter warpTolerance has not been defined in template %s!", DataResource::getName())); return base->getWarpToleranceMax(); } } @@ -2396,9 +2396,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getWarpToleranceMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2415,7 +2415,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2431,26 +2431,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCollisionOffsetX(true); #endif } if (!m_collisionOffsetX.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionOffsetX in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter collisionOffsetX has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter collisionOffsetX has not been defined in template %s!", DataResource::getName())); return base->getCollisionOffsetX(); } } @@ -2460,9 +2460,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCollisionOffsetX(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2479,7 +2479,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2495,26 +2495,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCollisionOffsetXMin(true); #endif } if (!m_collisionOffsetX.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionOffsetX in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter collisionOffsetX has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter collisionOffsetX has not been defined in template %s!", DataResource::getName())); return base->getCollisionOffsetXMin(); } } @@ -2524,9 +2524,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCollisionOffsetXMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2543,7 +2543,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2559,26 +2559,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCollisionOffsetXMax(true); #endif } if (!m_collisionOffsetX.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionOffsetX in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter collisionOffsetX has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter collisionOffsetX has not been defined in template %s!", DataResource::getName())); return base->getCollisionOffsetXMax(); } } @@ -2588,9 +2588,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCollisionOffsetXMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2607,7 +2607,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2623,26 +2623,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCollisionOffsetZ(true); #endif } if (!m_collisionOffsetZ.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionOffsetZ in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter collisionOffsetZ has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter collisionOffsetZ has not been defined in template %s!", DataResource::getName())); return base->getCollisionOffsetZ(); } } @@ -2652,9 +2652,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCollisionOffsetZ(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2671,7 +2671,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2687,26 +2687,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCollisionOffsetZMin(true); #endif } if (!m_collisionOffsetZ.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionOffsetZ in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter collisionOffsetZ has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter collisionOffsetZ has not been defined in template %s!", DataResource::getName())); return base->getCollisionOffsetZMin(); } } @@ -2716,9 +2716,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCollisionOffsetZMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2735,7 +2735,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2751,26 +2751,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCollisionOffsetZMax(true); #endif } if (!m_collisionOffsetZ.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionOffsetZ in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter collisionOffsetZ has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter collisionOffsetZ has not been defined in template %s!", DataResource::getName())); return base->getCollisionOffsetZMax(); } } @@ -2780,9 +2780,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCollisionOffsetZMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2799,7 +2799,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2815,26 +2815,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCollisionLength(true); #endif } if (!m_collisionLength.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionLength in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter collisionLength has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter collisionLength has not been defined in template %s!", DataResource::getName())); return base->getCollisionLength(); } } @@ -2844,9 +2844,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCollisionLength(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2863,7 +2863,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2879,26 +2879,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCollisionLengthMin(true); #endif } if (!m_collisionLength.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionLength in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter collisionLength has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter collisionLength has not been defined in template %s!", DataResource::getName())); return base->getCollisionLengthMin(); } } @@ -2908,9 +2908,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCollisionLengthMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2927,7 +2927,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2943,26 +2943,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCollisionLengthMax(true); #endif } if (!m_collisionLength.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionLength in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter collisionLength has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter collisionLength has not been defined in template %s!", DataResource::getName())); return base->getCollisionLengthMax(); } } @@ -2972,9 +2972,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCollisionLengthMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2991,7 +2991,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3007,26 +3007,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCameraHeight(true); #endif } if (!m_cameraHeight.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter cameraHeight in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter cameraHeight has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter cameraHeight has not been defined in template %s!", DataResource::getName())); return base->getCameraHeight(); } } @@ -3036,9 +3036,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCameraHeight(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3055,7 +3055,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3071,26 +3071,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCameraHeightMin(true); #endif } if (!m_cameraHeight.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter cameraHeight in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter cameraHeight has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter cameraHeight has not been defined in template %s!", DataResource::getName())); return base->getCameraHeightMin(); } } @@ -3100,9 +3100,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCameraHeightMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3119,7 +3119,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3135,26 +3135,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCameraHeightMax(true); #endif } if (!m_cameraHeight.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter cameraHeight in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter cameraHeight has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter cameraHeight has not been defined in template %s!", DataResource::getName())); return base->getCameraHeightMax(); } } @@ -3164,9 +3164,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCameraHeightMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3183,7 +3183,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3258,12 +3258,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedDraftSchematicObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedDraftSchematicObjectTemplate.cpp index fe3956f4..961cebca 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedDraftSchematicObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedDraftSchematicObjectTemplate.cpp @@ -55,7 +55,7 @@ SharedDraftSchematicObjectTemplate::~SharedDraftSchematicObjectTemplate() for (iter = m_slots.begin(); iter != m_slots.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_slots.clear(); } @@ -64,7 +64,7 @@ SharedDraftSchematicObjectTemplate::~SharedDraftSchematicObjectTemplate() for (iter = m_attributes.begin(); iter != m_attributes.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_attributes.clear(); } @@ -116,10 +116,10 @@ Tag SharedDraftSchematicObjectTemplate::getTemplateVersion(void) const */ Tag SharedDraftSchematicObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedDraftSchematicObjectTemplate::getHighestTemplateVersion @@ -127,28 +127,28 @@ Tag SharedDraftSchematicObjectTemplate::getHighestTemplateVersion(void) const //@BEGIN TFD void SharedDraftSchematicObjectTemplate::getSlots(IngredientSlot &data, int index) const { - const SharedDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_slotsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slots in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slots has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slots has not been defined in template %s!", DataResource::getName())); base->getSlots(data, index); return; } } - if (m_slotsAppend && base != NULL) + if (m_slotsAppend && base != nullptr) { int baseCount = base->getSlotsCount(); if (index < baseCount) @@ -170,28 +170,28 @@ void SharedDraftSchematicObjectTemplate::getSlots(IngredientSlot &data, int inde void SharedDraftSchematicObjectTemplate::getSlotsMin(IngredientSlot &data, int index) const { - const SharedDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_slotsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slots in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slots has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slots has not been defined in template %s!", DataResource::getName())); base->getSlotsMin(data, index); return; } } - if (m_slotsAppend && base != NULL) + if (m_slotsAppend && base != nullptr) { int baseCount = base->getSlotsCount(); if (index < baseCount) @@ -213,28 +213,28 @@ void SharedDraftSchematicObjectTemplate::getSlotsMin(IngredientSlot &data, int i void SharedDraftSchematicObjectTemplate::getSlotsMax(IngredientSlot &data, int index) const { - const SharedDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_slotsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slots in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slots has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slots has not been defined in template %s!", DataResource::getName())); base->getSlotsMax(data, index); return; } } - if (m_slotsAppend && base != NULL) + if (m_slotsAppend && base != nullptr) { int baseCount = base->getSlotsCount(); if (index < baseCount) @@ -258,20 +258,20 @@ size_t SharedDraftSchematicObjectTemplate::getSlotsCount(void) const { if (!m_slotsLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const SharedDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getSlotsCount(); } size_t count = m_slots.size(); // if we are extending our base template, add it's count - if (m_slotsAppend && m_baseData != NULL) + if (m_slotsAppend && m_baseData != nullptr) { const SharedDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getSlotsCount(); } @@ -280,28 +280,28 @@ size_t SharedDraftSchematicObjectTemplate::getSlotsCount(void) const void SharedDraftSchematicObjectTemplate::getAttributes(SchematicAttribute &data, int index) const { - const SharedDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_attributesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attributes in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter attributes has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attributes has not been defined in template %s!", DataResource::getName())); base->getAttributes(data, index); return; } } - if (m_attributesAppend && base != NULL) + if (m_attributesAppend && base != nullptr) { int baseCount = base->getAttributesCount(); if (index < baseCount) @@ -324,28 +324,28 @@ void SharedDraftSchematicObjectTemplate::getAttributes(SchematicAttribute &data, void SharedDraftSchematicObjectTemplate::getAttributesMin(SchematicAttribute &data, int index) const { - const SharedDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_attributesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attributes in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter attributes has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attributes has not been defined in template %s!", DataResource::getName())); base->getAttributesMin(data, index); return; } } - if (m_attributesAppend && base != NULL) + if (m_attributesAppend && base != nullptr) { int baseCount = base->getAttributesCount(); if (index < baseCount) @@ -368,28 +368,28 @@ void SharedDraftSchematicObjectTemplate::getAttributesMin(SchematicAttribute &da void SharedDraftSchematicObjectTemplate::getAttributesMax(SchematicAttribute &data, int index) const { - const SharedDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_attributesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attributes in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter attributes has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attributes has not been defined in template %s!", DataResource::getName())); base->getAttributesMax(data, index); return; } } - if (m_attributesAppend && base != NULL) + if (m_attributesAppend && base != nullptr) { int baseCount = base->getAttributesCount(); if (index < baseCount) @@ -414,20 +414,20 @@ size_t SharedDraftSchematicObjectTemplate::getAttributesCount(void) const { if (!m_attributesLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const SharedDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getAttributesCount(); } size_t count = m_attributes.size(); // if we are extending our base template, add it's count - if (m_attributesAppend && m_baseData != NULL) + if (m_attributesAppend && m_baseData != nullptr) { const SharedDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getAttributesCount(); } @@ -442,33 +442,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCraftedSharedTemplate(true); #endif } if (!m_craftedSharedTemplate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter craftedSharedTemplate in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter craftedSharedTemplate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter craftedSharedTemplate has not been defined in template %s!", DataResource::getName())); return base->getCraftedSharedTemplate(); } } const std::string & value = m_craftedSharedTemplate.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -514,12 +514,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -548,7 +548,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_slots.begin(); iter != m_slots.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_slots.clear(); m_slotsAppend = file.read_bool8(); @@ -567,7 +567,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_attributes.begin(); iter != m_attributes.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_attributes.clear(); m_attributesAppend = file.read_bool8(); @@ -646,33 +646,33 @@ StringId testDataValue = DefaultStringId; UNREF(testData); #endif - const SharedDraftSchematicObjectTemplate::_IngredientSlot * base = NULL; - if (m_baseData != NULL) + const SharedDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getName(true); #endif } if (!m_name.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter name in template %s", DataResource::getName())); return DefaultStringId; } else { - DEBUG_FATAL(base == NULL, ("Template parameter name has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter name has not been defined in template %s!", DataResource::getName())); return base->getName(versionOk); } } const StringId value = m_name.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -688,33 +688,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedDraftSchematicObjectTemplate::_IngredientSlot * base = NULL; - if (m_baseData != NULL) + const SharedDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getHardpoint(true); #endif } if (!m_hardpoint.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter hardpoint in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter hardpoint has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter hardpoint has not been defined in template %s!", DataResource::getName())); return base->getHardpoint(versionOk); } } const std::string & value = m_hardpoint.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -819,33 +819,33 @@ StringId testDataValue = DefaultStringId; UNREF(testData); #endif - const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = NULL; - if (m_baseData != NULL) + const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getName(true); #endif } if (!m_name.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter name in template %s", DataResource::getName())); return DefaultStringId; } else { - DEBUG_FATAL(base == NULL, ("Template parameter name has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter name has not been defined in template %s!", DataResource::getName())); return base->getName(versionOk); } } const StringId value = m_name.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -861,33 +861,33 @@ StringId testDataValue = DefaultStringId; UNREF(testData); #endif - const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = NULL; - if (m_baseData != NULL) + const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getExperiment(true); #endif } if (!m_experiment.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter experiment in template %s", DataResource::getName())); return DefaultStringId; } else { - DEBUG_FATAL(base == NULL, ("Template parameter experiment has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter experiment has not been defined in template %s!", DataResource::getName())); return base->getExperiment(versionOk); } } const StringId value = m_experiment.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -903,26 +903,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = NULL; - if (m_baseData != NULL) + const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getValue(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValue(versionOk); } } @@ -932,9 +932,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getValue(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -951,7 +951,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -967,26 +967,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = NULL; - if (m_baseData != NULL) + const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getValueMin(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValueMin(versionOk); } } @@ -996,9 +996,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getValueMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1015,7 +1015,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1031,26 +1031,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = NULL; - if (m_baseData != NULL) + const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getValueMax(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValueMax(versionOk); } } @@ -1060,9 +1060,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getValueMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1079,7 +1079,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedFactoryObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedFactoryObjectTemplate.cpp index 5a07a293..4a7e73fa 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedFactoryObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedFactoryObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedFactoryObjectTemplate::getTemplateVersion(void) const */ Tag SharedFactoryObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedFactoryObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedFactoryObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGroupObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGroupObjectTemplate.cpp index 1c30083d..d3c1d6d0 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGroupObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGroupObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedGroupObjectTemplate::getTemplateVersion(void) const */ Tag SharedGroupObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedGroupObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedGroupObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGuildObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGuildObjectTemplate.cpp index 4243b93c..e57241db 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGuildObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGuildObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedGuildObjectTemplate::getTemplateVersion(void) const */ Tag SharedGuildObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedGuildObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedGuildObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedInstallationObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedInstallationObjectTemplate.cpp index 08158117..5e66bbf1 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedInstallationObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedInstallationObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedInstallationObjectTemplate::getTemplateVersion(void) const */ Tag SharedInstallationObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedInstallationObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedInstallationObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedIntangibleObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedIntangibleObjectTemplate.cpp index 0e9edb7c..4934dd40 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedIntangibleObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedIntangibleObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedIntangibleObjectTemplate::getTemplateVersion(void) const */ Tag SharedIntangibleObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedIntangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedIntangibleObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedJediManagerObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedJediManagerObjectTemplate.cpp index c4840885..3c8ad274 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedJediManagerObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedJediManagerObjectTemplate.cpp @@ -95,10 +95,10 @@ Tag SharedJediManagerObjectTemplate::getTemplateVersion(void) const */ Tag SharedJediManagerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedJediManagerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedJediManagerObjectTemplate::getHighestTemplateVersion @@ -141,12 +141,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedManufactureSchematicObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedManufactureSchematicObjectTemplate.cpp index 8b5e0965..de9c8b4d 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedManufactureSchematicObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedManufactureSchematicObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedManufactureSchematicObjectTemplate::getTemplateVersion(void) const */ Tag SharedManufactureSchematicObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedManufactureSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedManufactureSchematicObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedMissionObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedMissionObjectTemplate.cpp index b2745f8e..10eaba74 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedMissionObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedMissionObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedMissionObjectTemplate::getTemplateVersion(void) const */ Tag SharedMissionObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedMissionObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedMissionObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedObjectTemplate.cpp index 034adea5..dc0fe57a 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedObjectTemplate.cpp @@ -109,8 +109,8 @@ SharedObjectTemplate::SharedObjectTemplate(const std::string & filename) : ObjectTemplate(filename) ,m_versionOk(true) //@END TFD INIT - , m_slotDescriptor(NULL) - , m_arrangementDescriptor(NULL) + , m_slotDescriptor(nullptr) + , m_arrangementDescriptor(nullptr) , m_clientData (0) , m_preloadManager (0) { @@ -232,10 +232,10 @@ Tag SharedObjectTemplate::getTemplateVersion(void) const */ Tag SharedObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedObjectTemplate::getHighestTemplateVersion @@ -274,33 +274,33 @@ StringId testDataValue = DefaultStringId; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getObjectName(true); #endif } if (!m_objectName.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter objectName in template %s", DataResource::getName())); return DefaultStringId; } else { - DEBUG_FATAL(base == NULL, ("Template parameter objectName has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter objectName has not been defined in template %s!", DataResource::getName())); return base->getObjectName(); } } const StringId value = m_objectName.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -316,33 +316,33 @@ StringId testDataValue = DefaultStringId; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDetailedDescription(true); #endif } if (!m_detailedDescription.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter detailedDescription in template %s", DataResource::getName())); return DefaultStringId; } else { - DEBUG_FATAL(base == NULL, ("Template parameter detailedDescription has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter detailedDescription has not been defined in template %s!", DataResource::getName())); return base->getDetailedDescription(); } } const StringId value = m_detailedDescription.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -358,33 +358,33 @@ StringId testDataValue = DefaultStringId; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getLookAtText(true); #endif } if (!m_lookAtText.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter lookAtText in template %s", DataResource::getName())); return DefaultStringId; } else { - DEBUG_FATAL(base == NULL, ("Template parameter lookAtText has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter lookAtText has not been defined in template %s!", DataResource::getName())); return base->getLookAtText(); } } const StringId value = m_lookAtText.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -400,33 +400,33 @@ bool testDataValue = false; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSnapToTerrain(true); #endif } if (!m_snapToTerrain.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter snapToTerrain in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter snapToTerrain has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter snapToTerrain has not been defined in template %s!", DataResource::getName())); return base->getSnapToTerrain(); } } bool value = m_snapToTerrain.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -442,33 +442,33 @@ SharedObjectTemplate::ContainerType testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getContainerType(true); #endif } if (!m_containerType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter containerType in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter containerType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter containerType has not been defined in template %s!", DataResource::getName())); return base->getContainerType(); } } ContainerType value = static_cast(m_containerType.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -484,26 +484,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getContainerVolumeLimit(true); #endif } if (!m_containerVolumeLimit.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter containerVolumeLimit in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter containerVolumeLimit has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter containerVolumeLimit has not been defined in template %s!", DataResource::getName())); return base->getContainerVolumeLimit(); } } @@ -513,9 +513,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getContainerVolumeLimit(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -532,7 +532,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -548,26 +548,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getContainerVolumeLimitMin(true); #endif } if (!m_containerVolumeLimit.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter containerVolumeLimit in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter containerVolumeLimit has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter containerVolumeLimit has not been defined in template %s!", DataResource::getName())); return base->getContainerVolumeLimitMin(); } } @@ -577,9 +577,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getContainerVolumeLimitMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -596,7 +596,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -612,26 +612,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getContainerVolumeLimitMax(true); #endif } if (!m_containerVolumeLimit.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter containerVolumeLimit in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter containerVolumeLimit has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter containerVolumeLimit has not been defined in template %s!", DataResource::getName())); return base->getContainerVolumeLimitMax(); } } @@ -641,9 +641,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getContainerVolumeLimitMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -660,7 +660,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -676,33 +676,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTintPalette(true); #endif } if (!m_tintPalette.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter tintPalette in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter tintPalette has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter tintPalette has not been defined in template %s!", DataResource::getName())); return base->getTintPalette(); } } const std::string & value = m_tintPalette.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -718,33 +718,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSlotDescriptorFilename(true); #endif } if (!m_slotDescriptorFilename.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slotDescriptorFilename in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slotDescriptorFilename has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slotDescriptorFilename has not been defined in template %s!", DataResource::getName())); return base->getSlotDescriptorFilename(); } } const std::string & value = m_slotDescriptorFilename.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -760,33 +760,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getArrangementDescriptorFilename(true); #endif } if (!m_arrangementDescriptorFilename.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter arrangementDescriptorFilename in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter arrangementDescriptorFilename has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter arrangementDescriptorFilename has not been defined in template %s!", DataResource::getName())); return base->getArrangementDescriptorFilename(); } } const std::string & value = m_arrangementDescriptorFilename.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -802,33 +802,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAppearanceFilename(true); #endif } if (!m_appearanceFilename.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter appearanceFilename in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter appearanceFilename has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter appearanceFilename has not been defined in template %s!", DataResource::getName())); return base->getAppearanceFilename(); } } const std::string & value = m_appearanceFilename.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -844,33 +844,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getPortalLayoutFilename(true); #endif } if (!m_portalLayoutFilename.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter portalLayoutFilename in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter portalLayoutFilename has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter portalLayoutFilename has not been defined in template %s!", DataResource::getName())); return base->getPortalLayoutFilename(); } } const std::string & value = m_portalLayoutFilename.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -886,33 +886,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getClientDataFile(true); #endif } if (!m_clientDataFile.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter clientDataFile in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter clientDataFile has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter clientDataFile has not been defined in template %s!", DataResource::getName())); return base->getClientDataFile(); } } const std::string & value = m_clientDataFile.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -928,26 +928,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getScale(true); #endif } if (!m_scale.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter scale in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter scale has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter scale has not been defined in template %s!", DataResource::getName())); return base->getScale(); } } @@ -957,9 +957,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getScale(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -976,7 +976,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -992,26 +992,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getScaleMin(true); #endif } if (!m_scale.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter scale in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter scale has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter scale has not been defined in template %s!", DataResource::getName())); return base->getScaleMin(); } } @@ -1021,9 +1021,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getScaleMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1040,7 +1040,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1056,26 +1056,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getScaleMax(true); #endif } if (!m_scale.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter scale in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter scale has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter scale has not been defined in template %s!", DataResource::getName())); return base->getScaleMax(); } } @@ -1085,9 +1085,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getScaleMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1104,7 +1104,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1120,33 +1120,33 @@ SharedObjectTemplate::GameObjectType testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getGameObjectType(true); #endif } if (!m_gameObjectType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter gameObjectType in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter gameObjectType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter gameObjectType has not been defined in template %s!", DataResource::getName())); return base->getGameObjectType(); } } GameObjectType value = static_cast(m_gameObjectType.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1162,33 +1162,33 @@ bool testDataValue = false; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSendToClient(true); #endif } if (!m_sendToClient.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter sendToClient in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter sendToClient has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter sendToClient has not been defined in template %s!", DataResource::getName())); return base->getSendToClient(); } } bool value = m_sendToClient.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1204,26 +1204,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getScaleThresholdBeforeExtentTest(true); #endif } if (!m_scaleThresholdBeforeExtentTest.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter scaleThresholdBeforeExtentTest in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter scaleThresholdBeforeExtentTest has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter scaleThresholdBeforeExtentTest has not been defined in template %s!", DataResource::getName())); return base->getScaleThresholdBeforeExtentTest(); } } @@ -1233,9 +1233,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getScaleThresholdBeforeExtentTest(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1252,7 +1252,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1268,26 +1268,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getScaleThresholdBeforeExtentTestMin(true); #endif } if (!m_scaleThresholdBeforeExtentTest.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter scaleThresholdBeforeExtentTest in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter scaleThresholdBeforeExtentTest has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter scaleThresholdBeforeExtentTest has not been defined in template %s!", DataResource::getName())); return base->getScaleThresholdBeforeExtentTestMin(); } } @@ -1297,9 +1297,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getScaleThresholdBeforeExtentTestMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1316,7 +1316,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1332,26 +1332,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getScaleThresholdBeforeExtentTestMax(true); #endif } if (!m_scaleThresholdBeforeExtentTest.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter scaleThresholdBeforeExtentTest in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter scaleThresholdBeforeExtentTest has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter scaleThresholdBeforeExtentTest has not been defined in template %s!", DataResource::getName())); return base->getScaleThresholdBeforeExtentTestMax(); } } @@ -1361,9 +1361,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getScaleThresholdBeforeExtentTestMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1380,7 +1380,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1396,26 +1396,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getClearFloraRadius(true); #endif } if (!m_clearFloraRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter clearFloraRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter clearFloraRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter clearFloraRadius has not been defined in template %s!", DataResource::getName())); return base->getClearFloraRadius(); } } @@ -1425,9 +1425,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getClearFloraRadius(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1444,7 +1444,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1460,26 +1460,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getClearFloraRadiusMin(true); #endif } if (!m_clearFloraRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter clearFloraRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter clearFloraRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter clearFloraRadius has not been defined in template %s!", DataResource::getName())); return base->getClearFloraRadiusMin(); } } @@ -1489,9 +1489,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getClearFloraRadiusMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1508,7 +1508,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1524,26 +1524,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getClearFloraRadiusMax(true); #endif } if (!m_clearFloraRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter clearFloraRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter clearFloraRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter clearFloraRadius has not been defined in template %s!", DataResource::getName())); return base->getClearFloraRadiusMax(); } } @@ -1553,9 +1553,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getClearFloraRadiusMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1572,7 +1572,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1588,33 +1588,33 @@ SharedObjectTemplate::SurfaceType testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSurfaceType(true); #endif } if (!m_surfaceType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter surfaceType in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter surfaceType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter surfaceType has not been defined in template %s!", DataResource::getName())); return base->getSurfaceType(); } } SurfaceType value = static_cast(m_surfaceType.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1630,26 +1630,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getNoBuildRadius(true); #endif } if (!m_noBuildRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter noBuildRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter noBuildRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter noBuildRadius has not been defined in template %s!", DataResource::getName())); return base->getNoBuildRadius(); } } @@ -1659,9 +1659,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getNoBuildRadius(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1678,7 +1678,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1694,26 +1694,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getNoBuildRadiusMin(true); #endif } if (!m_noBuildRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter noBuildRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter noBuildRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter noBuildRadius has not been defined in template %s!", DataResource::getName())); return base->getNoBuildRadiusMin(); } } @@ -1723,9 +1723,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getNoBuildRadiusMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1742,7 +1742,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1758,26 +1758,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getNoBuildRadiusMax(true); #endif } if (!m_noBuildRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter noBuildRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter noBuildRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter noBuildRadius has not been defined in template %s!", DataResource::getName())); return base->getNoBuildRadiusMax(); } } @@ -1787,9 +1787,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getNoBuildRadiusMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1806,7 +1806,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1822,33 +1822,33 @@ bool testDataValue = false; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getOnlyVisibleInTools(true); #endif } if (!m_onlyVisibleInTools.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter onlyVisibleInTools in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter onlyVisibleInTools has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter onlyVisibleInTools has not been defined in template %s!", DataResource::getName())); return base->getOnlyVisibleInTools(); } } bool value = m_onlyVisibleInTools.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1864,26 +1864,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getLocationReservationRadius(true); #endif } if (!m_locationReservationRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter locationReservationRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter locationReservationRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter locationReservationRadius has not been defined in template %s!", DataResource::getName())); return base->getLocationReservationRadius(); } } @@ -1893,9 +1893,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getLocationReservationRadius(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1912,7 +1912,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1928,26 +1928,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getLocationReservationRadiusMin(true); #endif } if (!m_locationReservationRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter locationReservationRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter locationReservationRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter locationReservationRadius has not been defined in template %s!", DataResource::getName())); return base->getLocationReservationRadiusMin(); } } @@ -1957,9 +1957,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getLocationReservationRadiusMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1976,7 +1976,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1992,26 +1992,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getLocationReservationRadiusMax(true); #endif } if (!m_locationReservationRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter locationReservationRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter locationReservationRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter locationReservationRadius has not been defined in template %s!", DataResource::getName())); return base->getLocationReservationRadiusMax(); } } @@ -2021,9 +2021,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getLocationReservationRadiusMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2040,7 +2040,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2056,33 +2056,33 @@ bool testDataValue = false; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getForceNoCollision(true); #endif } if (!m_forceNoCollision.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter forceNoCollision in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter forceNoCollision has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter forceNoCollision has not been defined in template %s!", DataResource::getName())); return base->getForceNoCollision(); } } bool value = m_forceNoCollision.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2153,12 +2153,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerObjectTemplate.cpp index 03213f9f..7d020a59 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerObjectTemplate.cpp @@ -95,10 +95,10 @@ Tag SharedPlayerObjectTemplate::getTemplateVersion(void) const */ Tag SharedPlayerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedPlayerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedPlayerObjectTemplate::getHighestTemplateVersion @@ -141,12 +141,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerQuestObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerQuestObjectTemplate.cpp index c475f753..26380963 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerQuestObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerQuestObjectTemplate.cpp @@ -95,10 +95,10 @@ Tag SharedPlayerQuestObjectTemplate::getTemplateVersion(void) const */ Tag SharedPlayerQuestObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedPlayerQuestObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedPlayerQuestObjectTemplate::getHighestTemplateVersion @@ -141,12 +141,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedResourceContainerObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedResourceContainerObjectTemplate.cpp index 9eb6e580..dbb0635d 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedResourceContainerObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedResourceContainerObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedResourceContainerObjectTemplate::getTemplateVersion(void) const */ Tag SharedResourceContainerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedResourceContainerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedResourceContainerObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedShipObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedShipObjectTemplate.cpp index 8dce0c07..e374302c 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedShipObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedShipObjectTemplate.cpp @@ -101,10 +101,10 @@ Tag SharedShipObjectTemplate::getTemplateVersion(void) const */ Tag SharedShipObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedShipObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedShipObjectTemplate::getHighestTemplateVersion @@ -155,33 +155,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedShipObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedShipObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCockpitFilename(true); #endif } if (!m_cockpitFilename.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter cockpitFilename in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter cockpitFilename has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter cockpitFilename has not been defined in template %s!", DataResource::getName())); return base->getCockpitFilename(); } } const std::string & value = m_cockpitFilename.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -197,33 +197,33 @@ bool testDataValue = false; UNREF(testData); #endif - const SharedShipObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedShipObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getHasWings(true); #endif } if (!m_hasWings.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter hasWings in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter hasWings has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter hasWings has not been defined in template %s!", DataResource::getName())); return base->getHasWings(); } } bool value = m_hasWings.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -239,33 +239,33 @@ bool testDataValue = false; UNREF(testData); #endif - const SharedShipObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedShipObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getPlayerControlled(true); #endif } if (!m_playerControlled.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter playerControlled in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter playerControlled has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter playerControlled has not been defined in template %s!", DataResource::getName())); return base->getPlayerControlled(); } } bool value = m_playerControlled.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -281,33 +281,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedShipObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedShipObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getInteriorLayoutFileName(true); #endif } if (!m_interiorLayoutFileName.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter interiorLayoutFileName in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter interiorLayoutFileName has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter interiorLayoutFileName has not been defined in template %s!", DataResource::getName())); return base->getInteriorLayoutFileName(); } } const std::string & value = m_interiorLayoutFileName.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -356,12 +356,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedStaticObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedStaticObjectTemplate.cpp index 597d379a..3de71cf2 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedStaticObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedStaticObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedStaticObjectTemplate::getTemplateVersion(void) const */ Tag SharedStaticObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedStaticObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedStaticObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTangibleObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTangibleObjectTemplate.cpp index 57f841e2..95742f60 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTangibleObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTangibleObjectTemplate.cpp @@ -73,7 +73,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() for (iter = m_paletteColorCustomizationVariables.begin(); iter != m_paletteColorCustomizationVariables.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_paletteColorCustomizationVariables.clear(); } @@ -82,7 +82,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() for (iter = m_rangedIntCustomizationVariables.begin(); iter != m_rangedIntCustomizationVariables.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_rangedIntCustomizationVariables.clear(); } @@ -91,7 +91,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() for (iter = m_constStringCustomizationVariables.begin(); iter != m_constStringCustomizationVariables.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_constStringCustomizationVariables.clear(); } @@ -100,7 +100,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() for (iter = m_socketDestinations.begin(); iter != m_socketDestinations.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_socketDestinations.clear(); } @@ -109,7 +109,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() for (iter = m_certificationsRequired.begin(); iter != m_certificationsRequired.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_certificationsRequired.clear(); } @@ -118,7 +118,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() for (iter = m_customizationVariableMapping.begin(); iter != m_customizationVariableMapping.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_customizationVariableMapping.clear(); } @@ -176,10 +176,10 @@ Tag SharedTangibleObjectTemplate::getTemplateVersion(void) const */ Tag SharedTangibleObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedTangibleObjectTemplate::getHighestTemplateVersion @@ -355,28 +355,28 @@ void SharedTangibleObjectTemplate::createCustomizationDataPropertyAsNeeded(Objec //@BEGIN TFD void SharedTangibleObjectTemplate::getPaletteColorCustomizationVariables(PaletteColorCustomizationVariable &data, int index) const { - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_paletteColorCustomizationVariablesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter paletteColorCustomizationVariables in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter paletteColorCustomizationVariables has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter paletteColorCustomizationVariables has not been defined in template %s!", DataResource::getName())); base->getPaletteColorCustomizationVariables(data, index); return; } } - if (m_paletteColorCustomizationVariablesAppend && base != NULL) + if (m_paletteColorCustomizationVariablesAppend && base != nullptr) { int baseCount = base->getPaletteColorCustomizationVariablesCount(); if (index < baseCount) @@ -399,28 +399,28 @@ void SharedTangibleObjectTemplate::getPaletteColorCustomizationVariables(Palette void SharedTangibleObjectTemplate::getPaletteColorCustomizationVariablesMin(PaletteColorCustomizationVariable &data, int index) const { - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_paletteColorCustomizationVariablesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter paletteColorCustomizationVariables in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter paletteColorCustomizationVariables has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter paletteColorCustomizationVariables has not been defined in template %s!", DataResource::getName())); base->getPaletteColorCustomizationVariablesMin(data, index); return; } } - if (m_paletteColorCustomizationVariablesAppend && base != NULL) + if (m_paletteColorCustomizationVariablesAppend && base != nullptr) { int baseCount = base->getPaletteColorCustomizationVariablesCount(); if (index < baseCount) @@ -443,28 +443,28 @@ void SharedTangibleObjectTemplate::getPaletteColorCustomizationVariablesMin(Pale void SharedTangibleObjectTemplate::getPaletteColorCustomizationVariablesMax(PaletteColorCustomizationVariable &data, int index) const { - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_paletteColorCustomizationVariablesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter paletteColorCustomizationVariables in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter paletteColorCustomizationVariables has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter paletteColorCustomizationVariables has not been defined in template %s!", DataResource::getName())); base->getPaletteColorCustomizationVariablesMax(data, index); return; } } - if (m_paletteColorCustomizationVariablesAppend && base != NULL) + if (m_paletteColorCustomizationVariablesAppend && base != nullptr) { int baseCount = base->getPaletteColorCustomizationVariablesCount(); if (index < baseCount) @@ -489,20 +489,20 @@ size_t SharedTangibleObjectTemplate::getPaletteColorCustomizationVariablesCount( { if (!m_paletteColorCustomizationVariablesLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getPaletteColorCustomizationVariablesCount(); } size_t count = m_paletteColorCustomizationVariables.size(); // if we are extending our base template, add it's count - if (m_paletteColorCustomizationVariablesAppend && m_baseData != NULL) + if (m_paletteColorCustomizationVariablesAppend && m_baseData != nullptr) { const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getPaletteColorCustomizationVariablesCount(); } @@ -511,28 +511,28 @@ size_t SharedTangibleObjectTemplate::getPaletteColorCustomizationVariablesCount( void SharedTangibleObjectTemplate::getRangedIntCustomizationVariables(RangedIntCustomizationVariable &data, int index) const { - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_rangedIntCustomizationVariablesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter rangedIntCustomizationVariables in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter rangedIntCustomizationVariables has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter rangedIntCustomizationVariables has not been defined in template %s!", DataResource::getName())); base->getRangedIntCustomizationVariables(data, index); return; } } - if (m_rangedIntCustomizationVariablesAppend && base != NULL) + if (m_rangedIntCustomizationVariablesAppend && base != nullptr) { int baseCount = base->getRangedIntCustomizationVariablesCount(); if (index < baseCount) @@ -556,28 +556,28 @@ void SharedTangibleObjectTemplate::getRangedIntCustomizationVariables(RangedIntC void SharedTangibleObjectTemplate::getRangedIntCustomizationVariablesMin(RangedIntCustomizationVariable &data, int index) const { - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_rangedIntCustomizationVariablesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter rangedIntCustomizationVariables in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter rangedIntCustomizationVariables has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter rangedIntCustomizationVariables has not been defined in template %s!", DataResource::getName())); base->getRangedIntCustomizationVariablesMin(data, index); return; } } - if (m_rangedIntCustomizationVariablesAppend && base != NULL) + if (m_rangedIntCustomizationVariablesAppend && base != nullptr) { int baseCount = base->getRangedIntCustomizationVariablesCount(); if (index < baseCount) @@ -601,28 +601,28 @@ void SharedTangibleObjectTemplate::getRangedIntCustomizationVariablesMin(RangedI void SharedTangibleObjectTemplate::getRangedIntCustomizationVariablesMax(RangedIntCustomizationVariable &data, int index) const { - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_rangedIntCustomizationVariablesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter rangedIntCustomizationVariables in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter rangedIntCustomizationVariables has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter rangedIntCustomizationVariables has not been defined in template %s!", DataResource::getName())); base->getRangedIntCustomizationVariablesMax(data, index); return; } } - if (m_rangedIntCustomizationVariablesAppend && base != NULL) + if (m_rangedIntCustomizationVariablesAppend && base != nullptr) { int baseCount = base->getRangedIntCustomizationVariablesCount(); if (index < baseCount) @@ -648,20 +648,20 @@ size_t SharedTangibleObjectTemplate::getRangedIntCustomizationVariablesCount(voi { if (!m_rangedIntCustomizationVariablesLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getRangedIntCustomizationVariablesCount(); } size_t count = m_rangedIntCustomizationVariables.size(); // if we are extending our base template, add it's count - if (m_rangedIntCustomizationVariablesAppend && m_baseData != NULL) + if (m_rangedIntCustomizationVariablesAppend && m_baseData != nullptr) { const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getRangedIntCustomizationVariablesCount(); } @@ -670,28 +670,28 @@ size_t SharedTangibleObjectTemplate::getRangedIntCustomizationVariablesCount(voi void SharedTangibleObjectTemplate::getConstStringCustomizationVariables(ConstStringCustomizationVariable &data, int index) const { - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_constStringCustomizationVariablesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter constStringCustomizationVariables in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter constStringCustomizationVariables has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter constStringCustomizationVariables has not been defined in template %s!", DataResource::getName())); base->getConstStringCustomizationVariables(data, index); return; } } - if (m_constStringCustomizationVariablesAppend && base != NULL) + if (m_constStringCustomizationVariablesAppend && base != nullptr) { int baseCount = base->getConstStringCustomizationVariablesCount(); if (index < baseCount) @@ -713,28 +713,28 @@ void SharedTangibleObjectTemplate::getConstStringCustomizationVariables(ConstStr void SharedTangibleObjectTemplate::getConstStringCustomizationVariablesMin(ConstStringCustomizationVariable &data, int index) const { - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_constStringCustomizationVariablesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter constStringCustomizationVariables in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter constStringCustomizationVariables has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter constStringCustomizationVariables has not been defined in template %s!", DataResource::getName())); base->getConstStringCustomizationVariablesMin(data, index); return; } } - if (m_constStringCustomizationVariablesAppend && base != NULL) + if (m_constStringCustomizationVariablesAppend && base != nullptr) { int baseCount = base->getConstStringCustomizationVariablesCount(); if (index < baseCount) @@ -756,28 +756,28 @@ void SharedTangibleObjectTemplate::getConstStringCustomizationVariablesMin(Const void SharedTangibleObjectTemplate::getConstStringCustomizationVariablesMax(ConstStringCustomizationVariable &data, int index) const { - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_constStringCustomizationVariablesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter constStringCustomizationVariables in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter constStringCustomizationVariables has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter constStringCustomizationVariables has not been defined in template %s!", DataResource::getName())); base->getConstStringCustomizationVariablesMax(data, index); return; } } - if (m_constStringCustomizationVariablesAppend && base != NULL) + if (m_constStringCustomizationVariablesAppend && base != nullptr) { int baseCount = base->getConstStringCustomizationVariablesCount(); if (index < baseCount) @@ -801,20 +801,20 @@ size_t SharedTangibleObjectTemplate::getConstStringCustomizationVariablesCount(v { if (!m_constStringCustomizationVariablesLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getConstStringCustomizationVariablesCount(); } size_t count = m_constStringCustomizationVariables.size(); // if we are extending our base template, add it's count - if (m_constStringCustomizationVariablesAppend && m_baseData != NULL) + if (m_constStringCustomizationVariablesAppend && m_baseData != nullptr) { const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getConstStringCustomizationVariablesCount(); } @@ -823,27 +823,27 @@ size_t SharedTangibleObjectTemplate::getConstStringCustomizationVariablesCount(v SharedTangibleObjectTemplate::GameObjectType SharedTangibleObjectTemplate::getSocketDestinations(int index) const { - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_socketDestinationsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter socketDestinations in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter socketDestinations has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter socketDestinations has not been defined in template %s!", DataResource::getName())); return base->getSocketDestinations(index); } } - if (m_socketDestinationsAppend && base != NULL) + if (m_socketDestinationsAppend && base != nullptr) { int baseCount = base->getSocketDestinationsCount(); if (index < baseCount) @@ -859,20 +859,20 @@ size_t SharedTangibleObjectTemplate::getSocketDestinationsCount(void) const { if (!m_socketDestinationsLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getSocketDestinationsCount(); } size_t count = m_socketDestinations.size(); // if we are extending our base template, add it's count - if (m_socketDestinationsAppend && m_baseData != NULL) + if (m_socketDestinationsAppend && m_baseData != nullptr) { const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getSocketDestinationsCount(); } @@ -887,33 +887,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getStructureFootprintFileName(true); #endif } if (!m_structureFootprintFileName.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter structureFootprintFileName in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter structureFootprintFileName has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter structureFootprintFileName has not been defined in template %s!", DataResource::getName())); return base->getStructureFootprintFileName(); } } const std::string & value = m_structureFootprintFileName.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -929,33 +929,33 @@ bool testDataValue = false; UNREF(testData); #endif - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getUseStructureFootprintOutline(true); #endif } if (!m_useStructureFootprintOutline.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter useStructureFootprintOutline in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter useStructureFootprintOutline has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter useStructureFootprintOutline has not been defined in template %s!", DataResource::getName())); return base->getUseStructureFootprintOutline(); } } bool value = m_useStructureFootprintOutline.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -971,33 +971,33 @@ bool testDataValue = false; UNREF(testData); #endif - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTargetable(true); #endif } if (!m_targetable.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter targetable in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter targetable has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter targetable has not been defined in template %s!", DataResource::getName())); return base->getTargetable(); } } bool value = m_targetable.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1007,27 +1007,27 @@ UNREF(testData); const std::string & SharedTangibleObjectTemplate::getCertificationsRequired(int index) const { - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_certificationsRequiredLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter certificationsRequired in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter certificationsRequired has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter certificationsRequired has not been defined in template %s!", DataResource::getName())); return base->getCertificationsRequired(index); } } - if (m_certificationsRequiredAppend && base != NULL) + if (m_certificationsRequiredAppend && base != nullptr) { int baseCount = base->getCertificationsRequiredCount(); if (index < baseCount) @@ -1044,20 +1044,20 @@ size_t SharedTangibleObjectTemplate::getCertificationsRequiredCount(void) const { if (!m_certificationsRequiredLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getCertificationsRequiredCount(); } size_t count = m_certificationsRequired.size(); // if we are extending our base template, add it's count - if (m_certificationsRequiredAppend && m_baseData != NULL) + if (m_certificationsRequiredAppend && m_baseData != nullptr) { const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getCertificationsRequiredCount(); } @@ -1066,28 +1066,28 @@ size_t SharedTangibleObjectTemplate::getCertificationsRequiredCount(void) const void SharedTangibleObjectTemplate::getCustomizationVariableMapping(CustomizationVariableMapping &data, int index) const { - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_customizationVariableMappingLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter customizationVariableMapping in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter customizationVariableMapping has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter customizationVariableMapping has not been defined in template %s!", DataResource::getName())); base->getCustomizationVariableMapping(data, index); return; } } - if (m_customizationVariableMappingAppend && base != NULL) + if (m_customizationVariableMappingAppend && base != nullptr) { int baseCount = base->getCustomizationVariableMappingCount(); if (index < baseCount) @@ -1109,28 +1109,28 @@ void SharedTangibleObjectTemplate::getCustomizationVariableMapping(Customization void SharedTangibleObjectTemplate::getCustomizationVariableMappingMin(CustomizationVariableMapping &data, int index) const { - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_customizationVariableMappingLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter customizationVariableMapping in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter customizationVariableMapping has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter customizationVariableMapping has not been defined in template %s!", DataResource::getName())); base->getCustomizationVariableMappingMin(data, index); return; } } - if (m_customizationVariableMappingAppend && base != NULL) + if (m_customizationVariableMappingAppend && base != nullptr) { int baseCount = base->getCustomizationVariableMappingCount(); if (index < baseCount) @@ -1152,28 +1152,28 @@ void SharedTangibleObjectTemplate::getCustomizationVariableMappingMin(Customizat void SharedTangibleObjectTemplate::getCustomizationVariableMappingMax(CustomizationVariableMapping &data, int index) const { - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_customizationVariableMappingLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter customizationVariableMapping in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter customizationVariableMapping has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter customizationVariableMapping has not been defined in template %s!", DataResource::getName())); base->getCustomizationVariableMappingMax(data, index); return; } } - if (m_customizationVariableMappingAppend && base != NULL) + if (m_customizationVariableMappingAppend && base != nullptr) { int baseCount = base->getCustomizationVariableMappingCount(); if (index < baseCount) @@ -1197,20 +1197,20 @@ size_t SharedTangibleObjectTemplate::getCustomizationVariableMappingCount(void) { if (!m_customizationVariableMappingLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getCustomizationVariableMappingCount(); } size_t count = m_customizationVariableMapping.size(); // if we are extending our base template, add it's count - if (m_customizationVariableMappingAppend && m_baseData != NULL) + if (m_customizationVariableMappingAppend && m_baseData != nullptr) { const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getCustomizationVariableMappingCount(); } @@ -1225,33 +1225,33 @@ SharedTangibleObjectTemplate::ClientVisabilityFlags testDataValue = static_cast< UNREF(testData); #endif - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getClientVisabilityFlag(true); #endif } if (!m_clientVisabilityFlag.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter clientVisabilityFlag in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter clientVisabilityFlag has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter clientVisabilityFlag has not been defined in template %s!", DataResource::getName())); return base->getClientVisabilityFlag(); } } ClientVisabilityFlags value = static_cast(m_clientVisabilityFlag.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1300,12 +1300,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -1334,7 +1334,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_paletteColorCustomizationVariables.begin(); iter != m_paletteColorCustomizationVariables.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_paletteColorCustomizationVariables.clear(); m_paletteColorCustomizationVariablesAppend = file.read_bool8(); @@ -1353,7 +1353,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_rangedIntCustomizationVariables.begin(); iter != m_rangedIntCustomizationVariables.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_rangedIntCustomizationVariables.clear(); m_rangedIntCustomizationVariablesAppend = file.read_bool8(); @@ -1372,7 +1372,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_constStringCustomizationVariables.begin(); iter != m_constStringCustomizationVariables.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_constStringCustomizationVariables.clear(); m_constStringCustomizationVariablesAppend = file.read_bool8(); @@ -1391,7 +1391,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_socketDestinations.begin(); iter != m_socketDestinations.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_socketDestinations.clear(); m_socketDestinationsAppend = file.read_bool8(); @@ -1416,7 +1416,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_certificationsRequired.begin(); iter != m_certificationsRequired.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_certificationsRequired.clear(); m_certificationsRequiredAppend = file.read_bool8(); @@ -1435,7 +1435,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_customizationVariableMapping.begin(); iter != m_customizationVariableMapping.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_customizationVariableMapping.clear(); m_customizationVariableMappingAppend = file.read_bool8(); @@ -1514,33 +1514,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_ConstStringCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_ConstStringCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getVariableName(true); #endif } if (!m_variableName.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter variableName in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter variableName has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter variableName has not been defined in template %s!", DataResource::getName())); return base->getVariableName(versionOk); } } const std::string & value = m_variableName.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1556,33 +1556,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_ConstStringCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_ConstStringCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getConstValue(true); #endif } if (!m_constValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter constValue in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter constValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter constValue has not been defined in template %s!", DataResource::getName())); return base->getConstValue(versionOk); } } const std::string & value = m_constValue.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1687,33 +1687,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_CustomizationVariableMapping * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_CustomizationVariableMapping * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSourceVariable(true); #endif } if (!m_sourceVariable.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter sourceVariable in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter sourceVariable has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter sourceVariable has not been defined in template %s!", DataResource::getName())); return base->getSourceVariable(versionOk); } } const std::string & value = m_sourceVariable.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1729,33 +1729,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_CustomizationVariableMapping * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_CustomizationVariableMapping * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDependentVariable(true); #endif } if (!m_dependentVariable.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter dependentVariable in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter dependentVariable has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter dependentVariable has not been defined in template %s!", DataResource::getName())); return base->getDependentVariable(versionOk); } } const std::string & value = m_dependentVariable.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1860,33 +1860,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getVariableName(true); #endif } if (!m_variableName.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter variableName in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter variableName has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter variableName has not been defined in template %s!", DataResource::getName())); return base->getVariableName(versionOk); } } const std::string & value = m_variableName.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1902,33 +1902,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getPalettePathName(true); #endif } if (!m_palettePathName.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter palettePathName in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter palettePathName has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter palettePathName has not been defined in template %s!", DataResource::getName())); return base->getPalettePathName(versionOk); } } const std::string & value = m_palettePathName.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1944,26 +1944,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDefaultPaletteIndex(true); #endif } if (!m_defaultPaletteIndex.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter defaultPaletteIndex in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter defaultPaletteIndex has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter defaultPaletteIndex has not been defined in template %s!", DataResource::getName())); return base->getDefaultPaletteIndex(versionOk); } } @@ -1973,9 +1973,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getDefaultPaletteIndex(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1992,7 +1992,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2008,26 +2008,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDefaultPaletteIndexMin(true); #endif } if (!m_defaultPaletteIndex.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter defaultPaletteIndex in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter defaultPaletteIndex has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter defaultPaletteIndex has not been defined in template %s!", DataResource::getName())); return base->getDefaultPaletteIndexMin(versionOk); } } @@ -2037,9 +2037,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getDefaultPaletteIndexMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2056,7 +2056,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2072,26 +2072,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDefaultPaletteIndexMax(true); #endif } if (!m_defaultPaletteIndex.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter defaultPaletteIndex in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter defaultPaletteIndex has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter defaultPaletteIndex has not been defined in template %s!", DataResource::getName())); return base->getDefaultPaletteIndexMax(versionOk); } } @@ -2101,9 +2101,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getDefaultPaletteIndexMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2120,7 +2120,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2229,33 +2229,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getVariableName(true); #endif } if (!m_variableName.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter variableName in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter variableName has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter variableName has not been defined in template %s!", DataResource::getName())); return base->getVariableName(versionOk); } } const std::string & value = m_variableName.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2271,26 +2271,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMinValueInclusive(true); #endif } if (!m_minValueInclusive.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter minValueInclusive in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter minValueInclusive has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter minValueInclusive has not been defined in template %s!", DataResource::getName())); return base->getMinValueInclusive(versionOk); } } @@ -2300,9 +2300,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinValueInclusive(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2319,7 +2319,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2335,26 +2335,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMinValueInclusiveMin(true); #endif } if (!m_minValueInclusive.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter minValueInclusive in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter minValueInclusive has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter minValueInclusive has not been defined in template %s!", DataResource::getName())); return base->getMinValueInclusiveMin(versionOk); } } @@ -2364,9 +2364,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinValueInclusiveMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2383,7 +2383,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2399,26 +2399,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMinValueInclusiveMax(true); #endif } if (!m_minValueInclusive.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter minValueInclusive in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter minValueInclusive has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter minValueInclusive has not been defined in template %s!", DataResource::getName())); return base->getMinValueInclusiveMax(versionOk); } } @@ -2428,9 +2428,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinValueInclusiveMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2447,7 +2447,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2463,26 +2463,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDefaultValue(true); #endif } if (!m_defaultValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter defaultValue in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter defaultValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter defaultValue has not been defined in template %s!", DataResource::getName())); return base->getDefaultValue(versionOk); } } @@ -2492,9 +2492,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getDefaultValue(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2511,7 +2511,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2527,26 +2527,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDefaultValueMin(true); #endif } if (!m_defaultValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter defaultValue in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter defaultValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter defaultValue has not been defined in template %s!", DataResource::getName())); return base->getDefaultValueMin(versionOk); } } @@ -2556,9 +2556,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getDefaultValueMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2575,7 +2575,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2591,26 +2591,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDefaultValueMax(true); #endif } if (!m_defaultValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter defaultValue in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter defaultValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter defaultValue has not been defined in template %s!", DataResource::getName())); return base->getDefaultValueMax(versionOk); } } @@ -2620,9 +2620,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getDefaultValueMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2639,7 +2639,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2655,26 +2655,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxValueExclusive(true); #endif } if (!m_maxValueExclusive.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxValueExclusive in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxValueExclusive has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxValueExclusive has not been defined in template %s!", DataResource::getName())); return base->getMaxValueExclusive(versionOk); } } @@ -2684,9 +2684,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxValueExclusive(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2703,7 +2703,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2719,26 +2719,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxValueExclusiveMin(true); #endif } if (!m_maxValueExclusive.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxValueExclusive in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxValueExclusive has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxValueExclusive has not been defined in template %s!", DataResource::getName())); return base->getMaxValueExclusiveMin(versionOk); } } @@ -2748,9 +2748,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxValueExclusiveMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2767,7 +2767,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2783,26 +2783,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxValueExclusiveMax(true); #endif } if (!m_maxValueExclusive.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxValueExclusive in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxValueExclusive has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxValueExclusive has not been defined in template %s!", DataResource::getName())); return base->getMaxValueExclusiveMax(versionOk); } } @@ -2812,9 +2812,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxValueExclusiveMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2831,7 +2831,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTerrainSurfaceObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTerrainSurfaceObjectTemplate.cpp index cd2c216b..b518a9f7 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTerrainSurfaceObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTerrainSurfaceObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedTerrainSurfaceObjectTemplate::getTemplateVersion(void) const */ Tag SharedTerrainSurfaceObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedTerrainSurfaceObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedTerrainSurfaceObjectTemplate::getHighestTemplateVersion @@ -111,26 +111,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedTerrainSurfaceObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTerrainSurfaceObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCover(true); #endif } if (!m_cover.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter cover in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter cover has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter cover has not been defined in template %s!", DataResource::getName())); return base->getCover(); } } @@ -140,9 +140,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCover(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -159,7 +159,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { if (testDataValue == value) DEBUG_WARNING(true, ("Template %s, parameter cover is returning same value as base template.", DataResource::getName())); @@ -177,26 +177,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedTerrainSurfaceObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTerrainSurfaceObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCoverMin(true); #endif } if (!m_cover.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter cover in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter cover has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter cover has not been defined in template %s!", DataResource::getName())); return base->getCoverMin(); } } @@ -206,9 +206,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCoverMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -225,7 +225,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { if (testDataValue == value) DEBUG_WARNING(true, ("Template %s, parameter cover is returning same value as base template.", DataResource::getName())); @@ -243,26 +243,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedTerrainSurfaceObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTerrainSurfaceObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCoverMax(true); #endif } if (!m_cover.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter cover in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter cover has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter cover has not been defined in template %s!", DataResource::getName())); return base->getCoverMax(); } } @@ -272,9 +272,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCoverMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -291,7 +291,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { if (testDataValue == value) DEBUG_WARNING(true, ("Template %s, parameter cover is returning same value as base template.", DataResource::getName())); @@ -309,33 +309,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedTerrainSurfaceObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTerrainSurfaceObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSurfaceType(true); #endif } if (!m_surfaceType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter surfaceType in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter surfaceType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter surfaceType has not been defined in template %s!", DataResource::getName())); return base->getSurfaceType(); } } const std::string & value = m_surfaceType.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { if (testDataValue == value) DEBUG_WARNING(true, ("Template %s, parameter surfaceType is returning same value as base template.", DataResource::getName())); @@ -383,12 +383,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedUniverseObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedUniverseObjectTemplate.cpp index adf09d85..c6e9b692 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedUniverseObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedUniverseObjectTemplate.cpp @@ -95,10 +95,10 @@ Tag SharedUniverseObjectTemplate::getTemplateVersion(void) const */ Tag SharedUniverseObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedUniverseObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedUniverseObjectTemplate::getHighestTemplateVersion @@ -141,12 +141,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedVehicleObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedVehicleObjectTemplate.cpp index ccc2cb77..7467cf59 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedVehicleObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedVehicleObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedVehicleObjectTemplate::getTemplateVersion(void) const */ Tag SharedVehicleObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedVehicleObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedVehicleObjectTemplate::getHighestTemplateVersion @@ -105,8 +105,8 @@ Tag SharedVehicleObjectTemplate::getHighestTemplateVersion(void) const //@BEGIN TFD float SharedVehicleObjectTemplate::getSpeed(MovementTypes index) const { - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -114,14 +114,14 @@ float SharedVehicleObjectTemplate::getSpeed(MovementTypes index) const DEBUG_FATAL(index < 0 || index >= 5, ("template param index out of range")); if (!m_speed[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter speed in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter speed has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter speed has not been defined in template %s!", DataResource::getName())); return base->getSpeed(index); } } @@ -131,9 +131,9 @@ float SharedVehicleObjectTemplate::getSpeed(MovementTypes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSpeed(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -154,8 +154,8 @@ float SharedVehicleObjectTemplate::getSpeed(MovementTypes index) const float SharedVehicleObjectTemplate::getSpeedMin(MovementTypes index) const { - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -163,14 +163,14 @@ float SharedVehicleObjectTemplate::getSpeedMin(MovementTypes index) const DEBUG_FATAL(index < 0 || index >= 5, ("template param index out of range")); if (!m_speed[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter speed in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter speed has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter speed has not been defined in template %s!", DataResource::getName())); return base->getSpeedMin(index); } } @@ -180,9 +180,9 @@ float SharedVehicleObjectTemplate::getSpeedMin(MovementTypes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSpeedMin(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -203,8 +203,8 @@ float SharedVehicleObjectTemplate::getSpeedMin(MovementTypes index) const float SharedVehicleObjectTemplate::getSpeedMax(MovementTypes index) const { - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -212,14 +212,14 @@ float SharedVehicleObjectTemplate::getSpeedMax(MovementTypes index) const DEBUG_FATAL(index < 0 || index >= 5, ("template param index out of range")); if (!m_speed[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter speed in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter speed has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter speed has not been defined in template %s!", DataResource::getName())); return base->getSpeedMax(index); } } @@ -229,9 +229,9 @@ float SharedVehicleObjectTemplate::getSpeedMax(MovementTypes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSpeedMax(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -258,26 +258,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSlopeAversion(true); #endif } if (!m_slopeAversion.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slopeAversion in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slopeAversion has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slopeAversion has not been defined in template %s!", DataResource::getName())); return base->getSlopeAversion(); } } @@ -287,9 +287,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSlopeAversion(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -306,7 +306,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -322,26 +322,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSlopeAversionMin(true); #endif } if (!m_slopeAversion.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slopeAversion in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slopeAversion has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slopeAversion has not been defined in template %s!", DataResource::getName())); return base->getSlopeAversionMin(); } } @@ -351,9 +351,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSlopeAversionMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -370,7 +370,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -386,26 +386,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSlopeAversionMax(true); #endif } if (!m_slopeAversion.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slopeAversion in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slopeAversion has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slopeAversion has not been defined in template %s!", DataResource::getName())); return base->getSlopeAversionMax(); } } @@ -415,9 +415,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSlopeAversionMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -434,7 +434,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -450,26 +450,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getHoverValue(true); #endif } if (!m_hoverValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter hoverValue in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter hoverValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter hoverValue has not been defined in template %s!", DataResource::getName())); return base->getHoverValue(); } } @@ -479,9 +479,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getHoverValue(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -498,7 +498,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -514,26 +514,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getHoverValueMin(true); #endif } if (!m_hoverValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter hoverValue in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter hoverValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter hoverValue has not been defined in template %s!", DataResource::getName())); return base->getHoverValueMin(); } } @@ -543,9 +543,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getHoverValueMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -562,7 +562,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -578,26 +578,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getHoverValueMax(true); #endif } if (!m_hoverValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter hoverValue in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter hoverValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter hoverValue has not been defined in template %s!", DataResource::getName())); return base->getHoverValueMax(); } } @@ -607,9 +607,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getHoverValueMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -626,7 +626,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -642,26 +642,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTurnRate(true); #endif } if (!m_turnRate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter turnRate in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter turnRate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter turnRate has not been defined in template %s!", DataResource::getName())); return base->getTurnRate(); } } @@ -671,9 +671,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTurnRate(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -690,7 +690,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -706,26 +706,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTurnRateMin(true); #endif } if (!m_turnRate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter turnRate in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter turnRate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter turnRate has not been defined in template %s!", DataResource::getName())); return base->getTurnRateMin(); } } @@ -735,9 +735,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTurnRateMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -754,7 +754,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -770,26 +770,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTurnRateMax(true); #endif } if (!m_turnRate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter turnRate in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter turnRate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter turnRate has not been defined in template %s!", DataResource::getName())); return base->getTurnRateMax(); } } @@ -799,9 +799,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTurnRateMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -818,7 +818,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -834,26 +834,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxVelocity(true); #endif } if (!m_maxVelocity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxVelocity in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxVelocity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxVelocity has not been defined in template %s!", DataResource::getName())); return base->getMaxVelocity(); } } @@ -863,9 +863,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxVelocity(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -882,7 +882,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -898,26 +898,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxVelocityMin(true); #endif } if (!m_maxVelocity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxVelocity in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxVelocity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxVelocity has not been defined in template %s!", DataResource::getName())); return base->getMaxVelocityMin(); } } @@ -927,9 +927,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxVelocityMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -946,7 +946,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -962,26 +962,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxVelocityMax(true); #endif } if (!m_maxVelocity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxVelocity in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxVelocity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxVelocity has not been defined in template %s!", DataResource::getName())); return base->getMaxVelocityMax(); } } @@ -991,9 +991,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxVelocityMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1010,7 +1010,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1026,26 +1026,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAcceleration(true); #endif } if (!m_acceleration.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter acceleration in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter acceleration has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter acceleration has not been defined in template %s!", DataResource::getName())); return base->getAcceleration(); } } @@ -1055,9 +1055,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAcceleration(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1074,7 +1074,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1090,26 +1090,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAccelerationMin(true); #endif } if (!m_acceleration.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter acceleration in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter acceleration has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter acceleration has not been defined in template %s!", DataResource::getName())); return base->getAccelerationMin(); } } @@ -1119,9 +1119,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAccelerationMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1138,7 +1138,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1154,26 +1154,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAccelerationMax(true); #endif } if (!m_acceleration.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter acceleration in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter acceleration has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter acceleration has not been defined in template %s!", DataResource::getName())); return base->getAccelerationMax(); } } @@ -1183,9 +1183,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAccelerationMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1202,7 +1202,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1218,26 +1218,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getBraking(true); #endif } if (!m_braking.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter braking in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter braking has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter braking has not been defined in template %s!", DataResource::getName())); return base->getBraking(); } } @@ -1247,9 +1247,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getBraking(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1266,7 +1266,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1282,26 +1282,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getBrakingMin(true); #endif } if (!m_braking.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter braking in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter braking has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter braking has not been defined in template %s!", DataResource::getName())); return base->getBrakingMin(); } } @@ -1311,9 +1311,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getBrakingMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1330,7 +1330,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1346,26 +1346,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getBrakingMax(true); #endif } if (!m_braking.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter braking in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter braking has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter braking has not been defined in template %s!", DataResource::getName())); return base->getBrakingMax(); } } @@ -1375,9 +1375,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getBrakingMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1394,7 +1394,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1451,12 +1451,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWaypointObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWaypointObjectTemplate.cpp index 71ef4b39..2d82cd46 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWaypointObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWaypointObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedWaypointObjectTemplate::getTemplateVersion(void) const */ Tag SharedWaypointObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedWaypointObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedWaypointObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWeaponObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWeaponObjectTemplate.cpp index 7c9fa977..193d4ac7 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWeaponObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWeaponObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedWeaponObjectTemplate::getTemplateVersion(void) const */ Tag SharedWeaponObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedWeaponObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedWeaponObjectTemplate::getHighestTemplateVersion @@ -111,33 +111,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getWeaponEffect(true); #endif } if (!m_weaponEffect.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter weaponEffect in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter weaponEffect has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter weaponEffect has not been defined in template %s!", DataResource::getName())); return base->getWeaponEffect(); } } const std::string & value = m_weaponEffect.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -153,26 +153,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getWeaponEffectIndex(true); #endif } if (!m_weaponEffectIndex.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter weaponEffectIndex in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter weaponEffectIndex has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter weaponEffectIndex has not been defined in template %s!", DataResource::getName())); return base->getWeaponEffectIndex(); } } @@ -182,9 +182,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getWeaponEffectIndex(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -201,7 +201,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -217,26 +217,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getWeaponEffectIndexMin(true); #endif } if (!m_weaponEffectIndex.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter weaponEffectIndex in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter weaponEffectIndex has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter weaponEffectIndex has not been defined in template %s!", DataResource::getName())); return base->getWeaponEffectIndexMin(); } } @@ -246,9 +246,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getWeaponEffectIndexMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -265,7 +265,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -281,26 +281,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getWeaponEffectIndexMax(true); #endif } if (!m_weaponEffectIndex.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter weaponEffectIndex in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter weaponEffectIndex has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter weaponEffectIndex has not been defined in template %s!", DataResource::getName())); return base->getWeaponEffectIndexMax(); } } @@ -310,9 +310,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getWeaponEffectIndexMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -329,7 +329,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -345,33 +345,33 @@ SharedWeaponObjectTemplate::AttackType testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAttackType(true); #endif } if (!m_attackType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attackType in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter attackType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attackType has not been defined in template %s!", DataResource::getName())); return base->getAttackType(); } } AttackType value = static_cast(m_attackType.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -420,12 +420,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/quest/Quest.cpp b/engine/shared/library/sharedGame/src/shared/quest/Quest.cpp index 7cfaccef..14d2fcab 100755 --- a/engine/shared/library/sharedGame/src/shared/quest/Quest.cpp +++ b/engine/shared/library/sharedGame/src/shared/quest/Quest.cpp @@ -358,7 +358,7 @@ int Quest::getNumberOfTasks() const QuestTask const * Quest::getTask(int const taskId) const { if (taskId < 0 || taskId >= getNumberOfTasks()) - return NULL; + return nullptr; return (*m_tasks)[static_cast(taskId)]; } diff --git a/engine/shared/library/sharedGame/src/shared/quest/QuestManager.cpp b/engine/shared/library/sharedGame/src/shared/quest/QuestManager.cpp index ef210b43..3ba36a15 100755 --- a/engine/shared/library/sharedGame/src/shared/quest/QuestManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/quest/QuestManager.cpp @@ -192,7 +192,7 @@ void QuestManager::remove() Quest const * QuestManager::getQuest(CrcString const & fileName) { Quest const * const quest = getQuest(fileName.getCrc()); - DEBUG_WARNING(quest == NULL, ("QuestManager::getQuest(%s): FAILED - testquest not found", fileName.getString())); + DEBUG_WARNING(quest == nullptr, ("QuestManager::getQuest(%s): FAILED - testquest not found", fileName.getString())); return quest; } @@ -200,7 +200,7 @@ Quest const * QuestManager::getQuest(CrcString const & fileName) Quest const * QuestManager::getQuest(uint32 const questCrc) { - Quest * quest = NULL; + Quest * quest = nullptr; //-- Look for the quest in the quest map QuestMap::iterator const iter = s_quests.find(questCrc); @@ -223,7 +223,7 @@ Quest const * QuestManager::getQuest(uint32 const questCrc) } } - DEBUG_WARNING(quest == NULL, ("QuestManager::getQuest: FAILED - testquest not found")); + DEBUG_WARNING(quest == nullptr, ("QuestManager::getQuest: FAILED - testquest not found")); return quest; } @@ -234,7 +234,7 @@ Quest const * QuestManager::getQuest(std::string const & questName) { TemporaryCrcString const fileName(questName.c_str(), true); Quest const * const quest = getQuest(fileName); - DEBUG_WARNING(quest == NULL, ("QuestManager::getQuest(%s): FAILED - testquest not found", questName.c_str())); + DEBUG_WARNING(quest == nullptr, ("QuestManager::getQuest(%s): FAILED - testquest not found", questName.c_str())); return quest; } diff --git a/engine/shared/library/sharedGame/src/shared/space/AsteroidGenerationManager.cpp b/engine/shared/library/sharedGame/src/shared/space/AsteroidGenerationManager.cpp index 26b912b2..2fabba5e 100755 --- a/engine/shared/library/sharedGame/src/shared/space/AsteroidGenerationManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/space/AsteroidGenerationManager.cpp @@ -79,7 +79,7 @@ void AsteroidGenerationManager::install() DEBUG_FATAL(s_installed, ("AsteroidGenerationManager already installed")); s_installed = true; - ms_getRadiusFunction = NULL; + ms_getRadiusFunction = nullptr; ExitChain::add(AsteroidGenerationManager::remove, "AsteroidGenerationManager::remove"); } @@ -88,7 +88,7 @@ void AsteroidGenerationManager::install() void AsteroidGenerationManager::remove() { - ms_getRadiusFunction = NULL; + ms_getRadiusFunction = nullptr; clearStaticFieldData(); clearInstantiatedData(); @@ -381,7 +381,7 @@ bool AsteroidGenerationManager::generateField(AsteroidFieldData const & fieldDat s_randomGenerator.setSeed(fieldData.seed); - WaveForm3D * splineWaveform = NULL; + WaveForm3D * splineWaveform = nullptr; if (fieldData.fieldType == AsteroidFieldData::FT_spline) { splineWaveform = new WaveForm3D; @@ -403,7 +403,7 @@ bool AsteroidGenerationManager::generateField(AsteroidFieldData const & fieldDat { bool valid = false; std::vector collisionResult; - Sphere * s = NULL; + Sphere * s = nullptr; while(!valid) { //create asteroid locations until we find one that doesn't penetrate any existing objects @@ -444,11 +444,11 @@ bool AsteroidGenerationManager::generateField(AsteroidFieldData const & fieldDat { DEBUG_REPORT_LOG_PRINT(ConfigSharedGame::getSpamAsteroidGenerationData(), ("Asteroid creation collision at [%f, %f, %f], radius [%f], trying again...\n", newAsteroid.position.x, newAsteroid.position.y, newAsteroid.position.z, s->getRadius())); delete s; - s = NULL; + s = nullptr; } } - NOT_NULL(s); //lint !e644 // s could be uninitialized (not true -- initialized to NULL above, should be set to a value during the while loop) + NOT_NULL(s); //lint !e644 // s could be uninitialized (not true -- initialized to nullptr above, should be set to a value during the while loop) SpatialSubdivisionHandle* handle = ms_collisionSphereTree.addObject(s); if(handle) diff --git a/engine/shared/library/sharedGame/src/shared/space/NebulaManager.cpp b/engine/shared/library/sharedGame/src/shared/space/NebulaManager.cpp index 803c5a76..e48dc276 100755 --- a/engine/shared/library/sharedGame/src/shared/space/NebulaManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/space/NebulaManager.cpp @@ -52,7 +52,7 @@ namespace NebulaManagerNamespace }; typedef SphereTree NebulaSphereTree; - NebulaSphereTree * s_collisionSphereTree = NULL; + NebulaSphereTree * s_collisionSphereTree = nullptr; enum DatatableColumns { @@ -110,7 +110,7 @@ namespace NebulaManagerNamespace //---------------------------------------------------------------------- - NebulaManager::ImplementationClearFunction s_clearFunction = NULL; + NebulaManager::ImplementationClearFunction s_clearFunction = nullptr; } using namespace NebulaManagerNamespace; @@ -158,10 +158,10 @@ void NebulaManager::clear() s_nebulaMap.clear(); - if (s_collisionSphereTree != NULL) + if (s_collisionSphereTree != nullptr) { delete s_collisionSphereTree; - s_collisionSphereTree = NULL; + s_collisionSphereTree = nullptr; } //-- Remove nebulas for the current scene from the scene map @@ -178,7 +178,7 @@ void NebulaManager::clear() s_currentSceneId.clear(); - if (s_clearFunction != NULL) + if (s_clearFunction != nullptr) s_clearFunction(); } @@ -319,11 +319,11 @@ void NebulaManager::getNebulasInSphere(Vector const & pos, float const radius, N Nebula const * NebulaManager::getClosestNebula(Vector const & pos, float const maxDistance, float & outMinDistance, float & outMaxDistance) { - Nebula const * nebula = NULL; + Nebula const * nebula = nullptr; if (NON_NULL(s_collisionSphereTree)->findClosest(pos, maxDistance, nebula, outMinDistance, outMaxDistance)) return nebula; - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -334,7 +334,7 @@ Nebula const * NebulaManager::getNebulaById(int const id) if (it != s_nebulaMap.end()) return (*it).second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedGame/src/shared/space/ShipChassis.cpp b/engine/shared/library/sharedGame/src/shared/space/ShipChassis.cpp index ab3b0672..6d014f13 100755 --- a/engine/shared/library/sharedGame/src/shared/space/ShipChassis.cpp +++ b/engine/shared/library/sharedGame/src/shared/space/ShipChassis.cpp @@ -211,7 +211,7 @@ bool ShipChassis::save(std::string const & filename) ShipChassisSlot const * const chassisSlot = shipChassis->getSlot(static_cast(chassisSlotType)); - if (NULL == chassisSlot) + if (nullptr == chassisSlot) { tabStr += "\t\t"; continue; @@ -249,7 +249,7 @@ bool ShipChassis::save(std::string const & filename) StdioFileFactory sff; AbstractFile * const af = sff.createFile(filename.c_str(), "wb"); - if (NULL != af && af->isOpen()) + if (nullptr != af && af->isOpen()) { int const bytesWritten = af->write(static_cast(tabStr.size()), tabStr.c_str()); retval = (bytesWritten == static_cast(tabStr.size())); @@ -317,7 +317,7 @@ ShipChassis const * ShipChassis::findShipChassisByName (CrcString const & if (it != s_nameChassisMap->end ()) return (*it).second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -330,7 +330,7 @@ ShipChassis const * ShipChassis::findShipChassisByCrc (uint32 chassis if (it != s_crcChassisMap.end ()) return (*it).second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -365,7 +365,7 @@ void ShipChassis::setSlotTargetable(int const chassisSlotType, bool targetable) { if (targetable) { - if (NULL == getSlot(static_cast(chassisSlotType))) + if (nullptr == getSlot(static_cast(chassisSlotType))) { WARNING(true, ("ShipChassis cannot set non existant slot [%d] targetable", chassisSlotType)); return; @@ -398,7 +398,7 @@ ShipChassisSlot * ShipChassis::getSlot(ShipChassisSlotType::Type shipChassisSlot return &slot; } - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -582,7 +582,7 @@ void ShipChassis::setUseWritableChassis(bool onlyUseThisForTools) bool ShipChassis::addChassis(bool doSort) { - if (doSort && NULL != findShipChassisByCrc(getCrc())) + if (doSort && nullptr != findShipChassisByCrc(getCrc())) { WARNING(true, ("ShipChassis attempt to add multiple [%s] chassis", getName().getString())); return false; @@ -628,7 +628,7 @@ bool ShipChassis::removeChassis() bool ShipChassis::setName(CrcString const & name) { ShipChassis const * const dupeNameShipChassis = findShipChassisByName(name); - if (NULL != dupeNameShipChassis) + if (nullptr != dupeNameShipChassis) { WARNING(true, ("ShipChassis attempt to set name [%s] already exists", name.getString())); return false; diff --git a/engine/shared/library/sharedGame/src/shared/space/ShipChassisSlot.cpp b/engine/shared/library/sharedGame/src/shared/space/ShipChassisSlot.cpp index dec4fd3e..0830d52c 100755 --- a/engine/shared/library/sharedGame/src/shared/space/ShipChassisSlot.cpp +++ b/engine/shared/library/sharedGame/src/shared/space/ShipChassisSlot.cpp @@ -78,7 +78,7 @@ ShipChassisSlot::~ShipChassisSlot () std::for_each(m_compatibilities->begin(), m_compatibilities->end(), PointerDeleter()); m_compatibilities->clear(); delete m_compatibilities; - m_compatibilities = NULL; + m_compatibilities = nullptr; } //---------------------------------------------------------------------- @@ -145,7 +145,7 @@ bool ShipChassisSlot::canAcceptComponentType (int shipComponentType) const bool ShipChassisSlot::canAcceptCompatibility (CrcString const & compatibility) const { - //-- null compatibility components are universally accepted + //-- nullptr compatibility components are universally accepted if (compatibility.isEmpty ()) return true; diff --git a/engine/shared/library/sharedGame/src/shared/space/ShipChassisWritable.cpp b/engine/shared/library/sharedGame/src/shared/space/ShipChassisWritable.cpp index cfc58a90..b4f2c22a 100755 --- a/engine/shared/library/sharedGame/src/shared/space/ShipChassisWritable.cpp +++ b/engine/shared/library/sharedGame/src/shared/space/ShipChassisWritable.cpp @@ -51,7 +51,7 @@ bool ShipChassisWritable::setName(CrcString const & name) { if (ShipChassis::setName(name)) { - if (NULL != findShipChassisByCrc(name.getCrc())) + if (nullptr != findShipChassisByCrc(name.getCrc())) Transceivers::chassisListChanged.emitMessage(true); return true; } @@ -72,7 +72,7 @@ void ShipChassisWritable::setSlotTargetable(int chassisSlotType, bool targetable { ShipChassisSlot * const chassisSlot = getSlot(static_cast(chassisSlotType)); - if (NULL == chassisSlot) + if (nullptr == chassisSlot) { WARNING(true, ("ShipChassisWritable::setSlotTargetable() invalid slot")); } diff --git a/engine/shared/library/sharedGame/src/shared/space/ShipComponentAttachmentManager.cpp b/engine/shared/library/sharedGame/src/shared/space/ShipComponentAttachmentManager.cpp index 14897909..3a8dbd52 100755 --- a/engine/shared/library/sharedGame/src/shared/space/ShipComponentAttachmentManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/space/ShipComponentAttachmentManager.cpp @@ -164,7 +164,7 @@ void ShipComponentAttachmentManager::load() ShipComponentDescriptor const * const shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByName (TemporaryCrcString (componentName.c_str (), true)); - if (shipComponentDescriptor == NULL) + if (shipComponentDescriptor == nullptr) { WARNING (true, ("ShipComponentAttachmentManager chassis [%s] specified invalid component [%s] at row [%d] in file [%s]", name.getString (), componentName.c_str (), row, chassis_filename.c_str())); continue; @@ -266,7 +266,7 @@ bool ShipComponentAttachmentManager::save(std::string const & dsrcPath, std::str bool ShipComponentAttachmentManager::saveChassisInfo(std::string const & chassisName, std::string const & filenameTab, std::string const & filenameIff) { ShipChassis const * const chassis = ShipChassis::findShipChassisByName(ConstCharCrcString(chassisName.c_str())); - if (NULL == chassis) + if (nullptr == chassis) return false; uint32 const chassisCrc = chassis->getCrc(); @@ -283,7 +283,7 @@ bool ShipComponentAttachmentManager::saveChassisInfo(std::string const & chassis std::string const & componentName = *it; ShipComponentDescriptor const * const shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByName(ConstCharCrcString(componentName.c_str())); - if (NULL == shipComponentDescriptor) + if (nullptr == shipComponentDescriptor) return false; uint32 const componentCrc = shipComponentDescriptor->getCrc(); @@ -333,7 +333,7 @@ bool ShipComponentAttachmentManager::saveChassisInfo(std::string const & chassis std::string const & componentName = *it; ShipComponentDescriptor const * const shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByName(ConstCharCrcString(componentName.c_str())); - if (NULL == shipComponentDescriptor) + if (nullptr == shipComponentDescriptor) return false; uint32 const componentCrc = shipComponentDescriptor->getCrc(); @@ -427,7 +427,7 @@ bool ShipComponentAttachmentManager::saveChassisInfo(std::string const & chassis StdioFileFactory sff; AbstractFile * const af = sff.createFile(filenameTab.c_str(), "wb"); - if (NULL != af && af->isOpen()) + if (nullptr != af && af->isOpen()) { int const bytesWritten = af->write(static_cast(tabStr.size()), tabStr.c_str()); retval = (bytesWritten == static_cast(tabStr.size())); @@ -484,7 +484,7 @@ bool ShipComponentAttachmentManager::getAttachmentsForShip(uint32 chassisCrc, ui TemplateHardpointPairVector const & thpv = (*it).second; if (thpv.empty()) { - thpVectors[i] = NULL; + thpVectors[i] = nullptr; } else { @@ -493,7 +493,7 @@ bool ShipComponentAttachmentManager::getAttachmentsForShip(uint32 chassisCrc, ui } } else - thpVectors[i] = NULL; + thpVectors[i] = nullptr; } return found; diff --git a/engine/shared/library/sharedGame/src/shared/space/ShipComponentData.cpp b/engine/shared/library/sharedGame/src/shared/space/ShipComponentData.cpp index 78a26512..ae4882b5 100755 --- a/engine/shared/library/sharedGame/src/shared/space/ShipComponentData.cpp +++ b/engine/shared/library/sharedGame/src/shared/space/ShipComponentData.cpp @@ -53,7 +53,7 @@ ShipComponentData::~ShipComponentData () void ShipComponentData::printDebugString (Unicode::String & result, Unicode::String const & padding) const { - if (m_descriptor == NULL) + if (m_descriptor == nullptr) return; char buf [2048]; diff --git a/engine/shared/library/sharedGame/src/shared/space/ShipComponentDescriptor.cpp b/engine/shared/library/sharedGame/src/shared/space/ShipComponentDescriptor.cpp index 5c3560f0..b9e021b4 100755 --- a/engine/shared/library/sharedGame/src/shared/space/ShipComponentDescriptor.cpp +++ b/engine/shared/library/sharedGame/src/shared/space/ShipComponentDescriptor.cpp @@ -115,7 +115,7 @@ void ShipComponentDescriptor::load() DEBUG_WARNING(!sharedTemplateName.empty() && sharedCrcString.isEmpty(), ("Data error: in ship_components.tab - Component [%s] Shared template [%s] not found for row [%d]", name.c_str(), sharedTemplateName.c_str(), row)); #endif - ShipComponentDescriptor * componentDescriptor = NULL; + ShipComponentDescriptor * componentDescriptor = nullptr; if (s_useWritableComponentDescriptor) componentDescriptor = new ShipComponentDescriptorWritable (TemporaryCrcString (name.c_str (), true), type, TemporaryCrcString (compatibility.c_str (), true), serverObjectTemplateName, sharedTemplateName); @@ -174,7 +174,7 @@ bool ShipComponentDescriptor::save(std::string const & filename) StdioFileFactory sff; AbstractFile * const af = sff.createFile(filename.c_str(), "wb"); - if (NULL != af && af->isOpen()) + if (nullptr != af && af->isOpen()) { int const bytesWritten = af->write(static_cast(tabStr.size()), tabStr.c_str()); retval = (bytesWritten == static_cast(tabStr.size())); @@ -285,7 +285,7 @@ ShipComponentDescriptor const * ShipComponentDescriptor::findShipComponentDescri if (it != s_crcComponentMap.end ()) return (*it).second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -297,7 +297,7 @@ ShipComponentDescriptor const * ShipComponentDescriptor::findShipComponentDescri if (it != s_nameComponentMap->end ()) return (*it).second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -309,7 +309,7 @@ ShipComponentDescriptor const * ShipComponentDescriptor::findShipComponentDescri if (it != s_objectTemplateCrcComponentMap.end ()) return (*it).second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -321,7 +321,7 @@ ShipComponentDescriptor const * ShipComponentDescriptor::findShipComponentDescri if (it != s_sharedObjectTemplateCrcComponentMap.end ()) return (*it).second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -348,7 +348,7 @@ ShipComponentDescriptor::StringVector ShipComponentDescriptor::getComponentDescr bool ShipComponentDescriptor::setName(std::string const & name) { ShipComponentDescriptor const * const dupeNameShipComponentDescriptor = findShipComponentDescriptorByName(ConstCharCrcString(name.c_str())); - if (NULL != dupeNameShipComponentDescriptor) + if (nullptr != dupeNameShipComponentDescriptor) { WARNING(true, ("ShipComponentDescriptor attempt to set name [%s] already exists", name.c_str())); return false; @@ -379,14 +379,14 @@ bool ShipComponentDescriptor::setName(std::string const & name) bool ShipComponentDescriptor::setObjectTemplateCrcs(uint32 crc, uint32 sharedCrc) { ShipComponentDescriptor const * const dupeTemplateShipComponentDescriptor = findShipComponentDescriptorByObjectTemplate(crc); - if (NULL != dupeTemplateShipComponentDescriptor && this != dupeTemplateShipComponentDescriptor) + if (nullptr != dupeTemplateShipComponentDescriptor && this != dupeTemplateShipComponentDescriptor) { WARNING(true, ("ShipComponentDescriptor attempt to set ot crc [%s] already exists", dupeTemplateShipComponentDescriptor->getName().getString())); return false; } ShipComponentDescriptor const * const dupeSharedTemplateShipComponentDescriptor = findShipComponentDescriptorBySharedObjectTemplate(crc); - if (NULL != dupeSharedTemplateShipComponentDescriptor && this != dupeSharedTemplateShipComponentDescriptor) + if (nullptr != dupeSharedTemplateShipComponentDescriptor && this != dupeSharedTemplateShipComponentDescriptor) { WARNING(true, ("ShipComponentDescriptor attempt to set shared ot crc [%s] already exists", dupeSharedTemplateShipComponentDescriptor->getName().getString())); return false; @@ -432,7 +432,7 @@ bool ShipComponentDescriptor::addShipComponentDescriptor(bool checkValidity, boo { { ShipComponentDescriptor const * const shipComponentDescriptor = findShipComponentDescriptorByName(m_name); - if (NULL != shipComponentDescriptor) + if (nullptr != shipComponentDescriptor) { WARNING(true, ("ShipComponentDescriptor::addShipComponentDescriptor name [%s] is already in map", m_name.getString())); return false; @@ -441,7 +441,7 @@ bool ShipComponentDescriptor::addShipComponentDescriptor(bool checkValidity, boo { ShipComponentDescriptor const * const shipComponentDescriptor = findShipComponentDescriptorByCrc(getCrc()); - if (NULL != shipComponentDescriptor) + if (nullptr != shipComponentDescriptor) { WARNING(true, ("ShipComponentDescriptor::addShipComponentDescriptor [%s] crc [0x%x] is already in map via [%s]", m_name.getString(), static_cast(getCrc()), shipComponentDescriptor->getName().getString())); return false; @@ -453,7 +453,7 @@ bool ShipComponentDescriptor::addShipComponentDescriptor(bool checkValidity, boo if (0 != objectTemplateCrc) { ShipComponentDescriptor const * const shipComponentDescriptor = findShipComponentDescriptorByObjectTemplate(objectTemplateCrc); - if (NULL != shipComponentDescriptor) + if (nullptr != shipComponentDescriptor) { WARNING(true, ("ShipComponentDescriptor::addShipComponentDescriptor [%s] server template [%s] [0x%x] is already in map via [%s]", m_name.getString(), getObjectTemplateName().c_str(), static_cast(getObjectTemplateCrc()), shipComponentDescriptor->getName().getString())); if (strict) @@ -467,7 +467,7 @@ bool ShipComponentDescriptor::addShipComponentDescriptor(bool checkValidity, boo if (0 != sharedObjectTemplateCrc) { ShipComponentDescriptor const * const shipComponentDescriptor = findShipComponentDescriptorBySharedObjectTemplate(sharedObjectTemplateCrc); - if (NULL != shipComponentDescriptor) + if (nullptr != shipComponentDescriptor) { WARNING(true, ("ShipComponentDescriptor::addShipComponentDescriptor [%s] shared template [%s] [0x%x] is already in map via [%s]", m_name.getString(), getSharedTemplateName().c_str(), static_cast(getSharedObjectTemplateCrc()), shipComponentDescriptor->getName().getString())); if (strict) diff --git a/engine/shared/library/sharedGame/src/shared/space/ShipComponentDescriptorWritable.cpp b/engine/shared/library/sharedGame/src/shared/space/ShipComponentDescriptorWritable.cpp index 8e3cf0fb..aa3e25a3 100755 --- a/engine/shared/library/sharedGame/src/shared/space/ShipComponentDescriptorWritable.cpp +++ b/engine/shared/library/sharedGame/src/shared/space/ShipComponentDescriptorWritable.cpp @@ -85,7 +85,7 @@ bool ShipComponentDescriptorWritable::setName(std::string const & name) { if (ShipComponentDescriptor::setName(name)) { - if (NULL != ShipComponentDescriptor::findShipComponentDescriptorByCrc(Crc::normalizeAndCalculate(name.c_str()))) + if (nullptr != ShipComponentDescriptor::findShipComponentDescriptorByCrc(Crc::normalizeAndCalculate(name.c_str()))) { notifyChanged(); Transceivers::componentListChanged.emitMessage(true); diff --git a/engine/shared/library/sharedGame/src/shared/space/ShipComponentWeaponManager.cpp b/engine/shared/library/sharedGame/src/shared/space/ShipComponentWeaponManager.cpp index 4e6559c7..f929434c 100755 --- a/engine/shared/library/sharedGame/src/shared/space/ShipComponentWeaponManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/space/ShipComponentWeaponManager.cpp @@ -76,7 +76,7 @@ void ShipComponentWeaponManager::install() DataTable * const dt = DataTableManager::getTable(filename, true); - if (dt == NULL) + if (dt == nullptr) { WARNING(true, ("ShipComponentWeaponManager no such datatable [%s]", filename.c_str())); return; @@ -90,7 +90,7 @@ void ShipComponentWeaponManager::install() ShipComponentDescriptor const * const shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByName(TemporaryCrcString(componentName.c_str(), true)); - if (shipComponentDescriptor == NULL) + if (shipComponentDescriptor == nullptr) { WARNING(true, ("getComponentType datatable specified invalid component [%s]", componentName.c_str())); continue; diff --git a/engine/shared/library/sharedGame/src/shared/sui/SuiPageData.cpp b/engine/shared/library/sharedGame/src/shared/sui/SuiPageData.cpp index c0941d98..92c8403c 100755 --- a/engine/shared/library/sharedGame/src/shared/sui/SuiPageData.cpp +++ b/engine/shared/library/sharedGame/src/shared/sui/SuiPageData.cpp @@ -93,7 +93,7 @@ bool SuiPageData::addCommand(SuiCommand const & command) SuiCommand const * const oldCommand = findSubscribeToEventCommand(eventType, targetWidget); - if (oldCommand != NULL) + if (oldCommand != nullptr) { WARNING(true, ("SuiPageData::addCommand attempt to add duplicate SCT_subscribeToEvent command. Type=[%d], target=[%s]", eventType, targetWidget.c_str())); return false; @@ -130,7 +130,7 @@ void SuiPageData::subscribeToPropertyForEvent(int eventType, std::string const & { SuiCommand * const command = findSubscribeToEventCommand(eventType, eventWidgetName); - if (command == NULL) + if (command == nullptr) { SuiCommand newCommand(SuiCommand::SCT_subscribeToEvent, eventWidgetName); newCommand.initSubscribeToEvent(eventType, std::string()); @@ -148,7 +148,7 @@ bool SuiPageData::subscribeToEvent(int eventType, std::string const & eventWidge { SuiCommand * const command = findSubscribeToEventCommand(eventType, eventWidgetName); - if (command == NULL) + if (command == nullptr) { SuiCommand newCommand(SuiCommand::SCT_subscribeToEvent, eventWidgetName); newCommand.initSubscribeToEvent(eventType, callback); @@ -182,7 +182,7 @@ SuiCommand * SuiPageData::findSubscribeToEventCommand(int const eventType, std:: } } - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -203,7 +203,7 @@ SuiCommand * SuiPageData::findSubscribeToEventCommandByIndex(int const index) } } - return NULL; + return nullptr; } //---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedImage/src/shared/TargaFormat.cpp b/engine/shared/library/sharedImage/src/shared/TargaFormat.cpp index 3957c9ab..e8f6f545 100755 --- a/engine/shared/library/sharedImage/src/shared/TargaFormat.cpp +++ b/engine/shared/library/sharedImage/src/shared/TargaFormat.cpp @@ -224,7 +224,7 @@ bool TargaFormat::loadImage(const char *filename, Image **image) const if (!image) { - REPORT_LOG(true, ("TargaFormat::loadImage(): null image pointer\n")); + REPORT_LOG(true, ("TargaFormat::loadImage(): nullptr image pointer\n")); return false; } *image = 0; @@ -257,7 +257,7 @@ bool TargaFormat::loadImageReformat(const char *filename, Image **image, Image:: if (!image) { - REPORT_LOG(true, ("TargaFormat::loadImage(): null image pointer\n")); + REPORT_LOG(true, ("TargaFormat::loadImage(): nullptr image pointer\n")); return false; } *image = 0; diff --git a/engine/shared/library/sharedIoWin/src/shared/IoWin.cpp b/engine/shared/library/sharedIoWin/src/shared/IoWin.cpp index 2d4eff3e..3cb565b1 100755 --- a/engine/shared/library/sharedIoWin/src/shared/IoWin.cpp +++ b/engine/shared/library/sharedIoWin/src/shared/IoWin.cpp @@ -22,7 +22,7 @@ IoWin::IoWin( const char *debugName // Name used for debugging purposes ) : ioDebugName(DuplicateString(debugName)), - ioNext(NULL) + ioNext(nullptr) { } @@ -37,9 +37,9 @@ IoWin::IoWin( IoWin::~IoWin(void) { delete [] ioDebugName; - ioDebugName = NULL; + ioDebugName = nullptr; - ioNext = NULL; + ioNext = nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedIoWin/src/shared/IoWinManager.cpp b/engine/shared/library/sharedIoWin/src/shared/IoWinManager.cpp index 5fc8ea5e..11da17d5 100755 --- a/engine/shared/library/sharedIoWin/src/shared/IoWinManager.cpp +++ b/engine/shared/library/sharedIoWin/src/shared/IoWinManager.cpp @@ -35,7 +35,7 @@ namespace IoWinManagerNamespace // Inactivity timer. float const s_defaultInactivityTimeSeconds = 15.0f * 60.0f; - IoWinManager::InactivityCallback s_inactivityCallback = NULL; + IoWinManager::InactivityCallback s_inactivityCallback = nullptr; Timer s_inactivityTimer(s_defaultInactivityTimeSeconds); bool s_isInactive = true; @@ -76,7 +76,7 @@ void IoWinManagerNamespace::triggerInactive(bool inactive) { if (!boolEqual(s_isInactive, inactive)) { - if (s_inactivityCallback != NULL) + if (s_inactivityCallback != nullptr) { (*s_inactivityCallback)(inactive); } @@ -105,7 +105,7 @@ IoEvent *IoWinManager::firstEvent; IoEvent *IoWinManager::lastEvent; MemoryBlockManager *IoWinManager::eventBlockManager; -IoWinManager::IMEFunctionPointer IoWinManager::imeFunction = NULL; +IoWinManager::IMEFunctionPointer IoWinManager::imeFunction = nullptr; // ====================================================================== // Install the IoWinManager @@ -122,8 +122,8 @@ IoWinManager::IMEFunctionPointer IoWinManager::imeFunction = NULL; void IoWinManager::install() { DEBUG_FATAL(installed, ("double install")); - top = NULL; - captured = NULL; + top = nullptr; + captured = nullptr; ExitChain::add(IoWinManager::remove, "IoWinManager::remove"); eventBlockManager = new MemoryBlockManager("IoWinManager eventBlockManager", true, sizeof(IoEvent), 0, 0, 0); installed = true; @@ -162,9 +162,9 @@ void IoWinManager::remove(void) IoResult result; IoEvent *event; - Os::setQueueCharacterHookFunction(NULL); - Os::setSetSystemMouseCursorPositionHookFunction(NULL); - Os::setQueueKeyDownHookFunction(NULL); + Os::setQueueCharacterHookFunction(nullptr); + Os::setSetSystemMouseCursorPositionHookFunction(nullptr); + Os::setQueueKeyDownHookFunction(nullptr); DEBUG_FATAL(!installed, ("not installed")); installed = false; @@ -191,7 +191,7 @@ void IoWinManager::remove(void) delete eventBlockManager; // Remove the inactivity timer. - registerInactivityCallback(NULL, 0.0f); + registerInactivityCallback(nullptr, 0.0f); } // ---------------------------------------------------------------------- @@ -229,10 +229,10 @@ void IoWinManager::debugReport() void IoWinManager::processEvents(float elapsedTime) { - IoWin * w = NULL; - IoWin * next = NULL; - IoEvent * queue = NULL; - IoEvent * event = NULL; + IoWin * w = nullptr; + IoWin * next = nullptr; + IoEvent * queue = nullptr; + IoEvent * event = nullptr; IoResult result; @@ -244,8 +244,8 @@ void IoWinManager::processEvents(float elapsedTime) queue->next = firstEvent; // the event list is now empty - firstEvent = NULL; - lastEvent = NULL; + firstEvent = nullptr; + lastEvent = nullptr; // Update the activity timer. if (!s_isInactive) @@ -267,7 +267,7 @@ void IoWinManager::processEvents(float elapsedTime) queue = queue->next; // keep people from peeking ahead in the event queue - event->next = NULL; + event->next = nullptr; // Check to see if the event resets @@ -310,7 +310,7 @@ void IoWinManager::processEvents(float elapsedTime) if (debugReportEvents) { - const char *name = NULL; + const char *name = nullptr; switch (event->type) { @@ -434,7 +434,7 @@ void IoWinManager::open(IoWin *window) // validate the arguments if (!window) { - DEBUG_FATAL(true, ("null window")); + DEBUG_FATAL(true, ("nullptr window")); return; //lint !e527 // Warning -- Unreachable } @@ -511,13 +511,13 @@ void IoWinManager::close(IoWin *window, bool allowDelete) // validate the arguments if (!window) { - DEBUG_FATAL(true, ("null window")); + DEBUG_FATAL(true, ("nullptr window")); return; //lint !e527 // Warning -- Unreachable } // linked list traversal with a back pointer IoWin *back, *front; - for (back = NULL, front = top; front && front != window; back = front, front = front->ioNext) + for (back = nullptr, front = top; front && front != window; back = front, front = front->ioNext) ; // verify the window was found @@ -528,7 +528,7 @@ void IoWinManager::close(IoWin *window, bool allowDelete) } // -qq- lint hack - DEBUG_FATAL(!window, ("null window")); + DEBUG_FATAL(!window, ("nullptr window")); // remove it from the singly linked list if (back) @@ -566,7 +566,7 @@ IoEvent *IoWinManager::newEvent(IoEventType eventType, int arg1, int arg2, real IoEvent * const event = reinterpret_cast(eventBlockManager->allocate()); // fill out the event data - event->next = NULL; + event->next = nullptr; event->type = eventType; event->arg1 = arg1; event->arg2 = arg2; diff --git a/engine/shared/library/sharedIoWin/src/shared/IoWinManager.h b/engine/shared/library/sharedIoWin/src/shared/IoWinManager.h index d0b90b2b..6965393d 100755 --- a/engine/shared/library/sharedIoWin/src/shared/IoWinManager.h +++ b/engine/shared/library/sharedIoWin/src/shared/IoWinManager.h @@ -131,7 +131,7 @@ public: inline bool IoWinManager::haveWindow(void) { - return (top != NULL); + return (top != nullptr); } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedMath/src/shared/MxCifQuadTree.cpp b/engine/shared/library/sharedMath/src/shared/MxCifQuadTree.cpp index 0b77b2ec..92241997 100755 --- a/engine/shared/library/sharedMath/src/shared/MxCifQuadTree.cpp +++ b/engine/shared/library/sharedMath/src/shared/MxCifQuadTree.cpp @@ -32,10 +32,10 @@ MxCifQuadTree::MxCifQuadTree(float minX, float minY, float maxX, float maxY, int m_centerX((m_maxX - m_minX) / 2.0f + m_minX), m_centerY((m_maxY - m_minY) / 2.0f + m_minY), m_maxDepth(maxDepth), - m_urTree(NULL), - m_ulTree(NULL), - m_llTree(NULL), - m_lrTree(NULL), + m_urTree(nullptr), + m_ulTree(nullptr), + m_llTree(nullptr), + m_lrTree(nullptr), m_xAxisTree(minX, maxX, maxDepth), m_yAxisTree(minY, maxY, maxDepth) { @@ -49,13 +49,13 @@ MxCifQuadTree::MxCifQuadTree(float minX, float minY, float maxX, float maxY, int MxCifQuadTree::~MxCifQuadTree() { delete m_urTree; - m_urTree = NULL; + m_urTree = nullptr; delete m_ulTree; - m_ulTree = NULL; + m_ulTree = nullptr; delete m_llTree; - m_llTree = NULL; + m_llTree = nullptr; delete m_lrTree; - m_lrTree = NULL; + m_lrTree = nullptr; } // MxCifQuadTree::~MxCifQuadTree //------------------------------------------------------------------------------ @@ -99,7 +99,7 @@ bool MxCifQuadTree::addObject(const MxCifQuadTreeBounds & object) // try putting the object in a child node if (m_maxDepth > 1) { - if (m_urTree == NULL) + if (m_urTree == nullptr) { if (!split()) return false; @@ -158,7 +158,7 @@ bool MxCifQuadTree::removeObject(const MxCifQuadTreeBounds & object) { if (m_maxDepth > 1) { - if (m_urTree != NULL) + if (m_urTree != nullptr) { // check if the object is in a sub-node if (m_urTree->removeObject(object) || @@ -212,7 +212,7 @@ void MxCifQuadTree::getObjectsAt(float x, float y, y >= m_minY) { // if we have sub-trees, pass the point to the tree that contains it - if (m_urTree != NULL) + if (m_urTree != nullptr) { if (x >= m_centerX && y >= m_centerY) m_urTree->getObjectsAt(x, y, objects); @@ -239,7 +239,7 @@ void MxCifQuadTree::getObjectsAt(float x, float y, void MxCifQuadTree::getAllObjects(std::vector & objects) const { // if we have sub-trees, pass the point to the tree that contains it - if (m_urTree != NULL) + if (m_urTree != nullptr) { m_urTree->getAllObjects(objects); m_ulTree->getAllObjects(objects); @@ -265,8 +265,8 @@ MxCifQuadTree::MxCifBinTree::MxCifBinTree(float min, float max, int maxDepth) : m_max(max), m_center((max - min) / 2.0f + min), m_maxDepth(maxDepth), - m_left(NULL), - m_right(NULL), + m_left(nullptr), + m_right(nullptr), m_objects() { } // MxCifBinTree::MxCifBinTree @@ -277,9 +277,9 @@ MxCifQuadTree::MxCifBinTree::MxCifBinTree(float min, float max, int maxDepth) : MxCifQuadTree::MxCifBinTree::~MxCifBinTree() { delete m_left; - m_left = NULL; + m_left = nullptr; delete m_right; - m_right = NULL; + m_right = nullptr; m_objects.clear(); } // MxCifBinTree::~MxCifBinTree @@ -315,7 +315,7 @@ bool MxCifQuadTree::MxCifBinTree::addObject(const MxCifQuadTreeBounds & object) // try putting the object in a child node if (m_maxDepth > 1) { - if (m_left == NULL) + if (m_left == nullptr) { if (!split()) return false; @@ -348,7 +348,7 @@ bool MxCifQuadTree::MxCifBinTree::removeObject(const MxCifQuadTreeBounds & objec { if (m_maxDepth > 1) { - if (m_left != NULL) + if (m_left != nullptr) { // check if the object is in a sub-node if (m_left->removeObject(object) || @@ -379,7 +379,7 @@ void MxCifQuadTree::MxCifBinTree::getAllObjects( std::vector & objects) const { // if we have sub-trees, pass the point to the tree that contains it - if (m_left != NULL) + if (m_left != nullptr) { m_right->getAllObjects(objects); m_left->getAllObjects(objects); @@ -435,7 +435,7 @@ void MxCifQuadTree::MxCifXBinTree::getObjectsAt(float x, float y, x >= m_min) { // if we have sub-trees, pass the point to the tree that contains it - if (m_left != NULL) + if (m_left != nullptr) { if (x >= m_center) m_right->getObjectsAt(x, y, objects); @@ -498,7 +498,7 @@ void MxCifQuadTree::MxCifYBinTree::getObjectsAt(float x, float y, y >= m_min) { // if we have sub-trees, pass the point to the tree that contains it - if (m_left != NULL) + if (m_left != nullptr) { if (y >= m_center) m_right->getObjectsAt(x, y, objects); diff --git a/engine/shared/library/sharedMath/src/shared/MxCifQuadTreeBounds.h b/engine/shared/library/sharedMath/src/shared/MxCifQuadTreeBounds.h index 27006c07..3362c65a 100755 --- a/engine/shared/library/sharedMath/src/shared/MxCifQuadTreeBounds.h +++ b/engine/shared/library/sharedMath/src/shared/MxCifQuadTreeBounds.h @@ -19,7 +19,7 @@ class MxCifQuadTreeBounds { public: - MxCifQuadTreeBounds(float minX, float minY, float maxX, float maxY, void * data = NULL); + MxCifQuadTreeBounds(float minX, float minY, float maxX, float maxY, void * data = nullptr); virtual ~MxCifQuadTreeBounds(){}; const float getMinX(void) const; @@ -87,7 +87,7 @@ inline void * MxCifQuadTreeBounds::getData(void) const class MxCifQuadTreeCircleBounds : public MxCifQuadTreeBounds { public: - MxCifQuadTreeCircleBounds(float centerX, float centerY, float radius, void * data = NULL); + MxCifQuadTreeCircleBounds(float centerX, float centerY, float radius, void * data = nullptr); float getCenterX() const; float getCenterY() const; diff --git a/engine/shared/library/sharedMath/src/shared/Plane.cpp b/engine/shared/library/sharedMath/src/shared/Plane.cpp index de9e491f..716055b6 100755 --- a/engine/shared/library/sharedMath/src/shared/Plane.cpp +++ b/engine/shared/library/sharedMath/src/shared/Plane.cpp @@ -63,7 +63,7 @@ void Plane::set(const Vector &point0, const Vector &point1, const Vector &point2 * Find the intersection between a line segment and the plane. * * If the line segment does intersect the plane, and the intersection - * pointer is non-NULL, then intersection will be set to the point on + * pointer is non-nullptr, then intersection will be set to the point on * the line segment that crosses the plane. * * @param point0 [IN] Start of the line segment @@ -85,7 +85,7 @@ bool Plane::findIntersection(const Vector &point0, const Vector &point1) const * Find the intersection between a line segment and the plane. * * If the line segment does intersect the plane, and the intersection - * pointer is non-NULL, then intersection will be set to the point on + * pointer is non-nullptr, then intersection will be set to the point on * the line segment that crosses the plane. * * @param point0 [IN] Start of the line segment @@ -120,7 +120,7 @@ bool Plane::findIntersection(const Vector &point0, const Vector &point1, Vector * Find the intersection between a line segment and the plane. * * If the line segment does intersect the plane, and the intersection - * pointer is non-NULL, then intersection will be set to the point on + * pointer is non-nullptr, then intersection will be set to the point on * the line segment that crosses the plane. * * @param point0 [IN] Start of the line segment @@ -159,7 +159,7 @@ bool Plane::findIntersection(const Vector &point0, const Vector &point1, Vector * Find the intersection between a line segment and the plane. * * If the line segment does intersect the plane, and the intersection - * pointer is non-NULL, then intersection will be set to the point on + * pointer is non-nullptr, then intersection will be set to the point on * the line segment that crosses the plane. * * @param point0 [IN] Start of the line segment @@ -198,7 +198,7 @@ bool Plane::findIntersection(const Vector &point0, const Vector &point1, float & * back side of the plane. * * If the line segment does intersect the plane, and the intersection - * pointer is non-NULL, then intersection will be set to the point on + * pointer is non-nullptr, then intersection will be set to the point on * the line segment that crosses the plane. * * @param point0 [IN] Start of the line segment @@ -224,12 +224,12 @@ bool Plane::findDirectedIntersection(const Vector &point0, const Vector &point1) * back side of the plane. * * If the line segment does intersect the plane, and the intersection - * pointer is non-NULL, then intersection will be set to the point on + * pointer is non-nullptr, then intersection will be set to the point on * the line segment that crosses the plane. * * @param point0 [IN] Start of the line segment * @param point1 [IN] End of the line segment - * @param intersection [OUT] Intersection of the point and the plane (may be NULL) + * @param intersection [OUT] Intersection of the point and the plane (may be nullptr) * @param t [OUT] parameterized t from 0..1 * @return True if the line segment intersects the plane from front-to-rear, otherwise false. */ @@ -265,12 +265,12 @@ bool Plane::findDirectedIntersection(const Vector &point0, const Vector &point1, * back side of the plane. * * If the line segment does intersect the plane, and the intersection - * pointer is non-NULL, then intersection will be set to the point on + * pointer is non-nullptr, then intersection will be set to the point on * the line segment that crosses the plane. * * @param point0 [IN] Start of the line segment * @param point1 [IN] End of the line segment - * @param intersection [OUT] Intersection of the point and the plane (may be NULL) + * @param intersection [OUT] Intersection of the point and the plane (may be nullptr) * @param t [OUT] parameterized t from 0..1 * @return True if the line segment intersects the plane from front-to-rear, otherwise false. */ @@ -308,12 +308,12 @@ bool Plane::findDirectedIntersection(const Vector &point0, const Vector &point1, * back side of the plane. * * If the line segment does intersect the plane, and the intersection - * pointer is non-NULL, then intersection will be set to the point on + * pointer is non-nullptr, then intersection will be set to the point on * the line segment that crosses the plane. * * @param point0 [IN] Start of the line segment * @param point1 [IN] End of the line segment - * @param intersection [OUT] Intersection of the point and the plane (may be NULL) + * @param intersection [OUT] Intersection of the point and the plane (may be nullptr) * @param t [OUT] parameterized t from 0..1 * @return True if the line segment intersects the plane from front-to-rear, otherwise false. */ diff --git a/engine/shared/library/sharedMath/src/shared/Quaternion.cpp b/engine/shared/library/sharedMath/src/shared/Quaternion.cpp index 38ce35b6..15b349a5 100755 --- a/engine/shared/library/sharedMath/src/shared/Quaternion.cpp +++ b/engine/shared/library/sharedMath/src/shared/Quaternion.cpp @@ -138,7 +138,7 @@ void Quaternion::getTransform(Transform *transform) const void Quaternion::getTransformPreserveTranslation(Transform *transform) const { - DEBUG_FATAL(!transform, ("null transform arg")); + DEBUG_FATAL(!transform, ("nullptr transform arg")); if ((w + s_quatEqualityEpsilon) < 1.f) { diff --git a/engine/shared/library/sharedMath/src/shared/SphereTreeNode.h b/engine/shared/library/sharedMath/src/shared/SphereTreeNode.h index 706f846d..3d630b82 100755 --- a/engine/shared/library/sharedMath/src/shared/SphereTreeNode.h +++ b/engine/shared/library/sharedMath/src/shared/SphereTreeNode.h @@ -71,7 +71,7 @@ VectorPointerPool::~VectorPointerPool() } delete v; - v = NULL; + v = nullptr; } } @@ -209,7 +209,7 @@ public: node->move(this); else { - WARNING_STRICT_FATAL(true, ("SphereTree::move was invoked for an object, but the real sphere tree node it refers to is null.")); + WARNING_STRICT_FATAL(true, ("SphereTree::move was invoked for an object, but the real sphere tree node it refers to is nullptr.")); } }; @@ -292,7 +292,7 @@ inline SpatialSubdivisionHandle * SphereTreeNode::ad if(!isValidSphere(sphere)) { WARNING_STRICT_FATAL(true, ("SphereTreeNode::addObject - sphere for the object being added is invalid")); - return NULL; + return nullptr; } SphereTreeNode * candidateNode = 0; diff --git a/engine/shared/library/sharedMath/src/shared/Transform.cpp b/engine/shared/library/sharedMath/src/shared/Transform.cpp index 9cc8c181..ef35b3d0 100755 --- a/engine/shared/library/sharedMath/src/shared/Transform.cpp +++ b/engine/shared/library/sharedMath/src/shared/Transform.cpp @@ -493,7 +493,7 @@ void Transform::reorthonormalize(void) /** * Send this transform to the DebugPrint system. * - * The header parameter may be NULL. + * The header parameter may be nullptr. * * @param header Header for the transform */ @@ -524,8 +524,8 @@ void Transform::debugPrint(const char *header) const void Transform::rotate_l2p(const Vector *source, Vector *result, int count) const { - DEBUG_FATAL(!source, ("source array is NULL")); - DEBUG_FATAL(!result, ("result array is NULL")); + DEBUG_FATAL(!source, ("source array is nullptr")); + DEBUG_FATAL(!result, ("result array is nullptr")); DEBUG_FATAL(source == result, ("source and result array can not be the same")); NOT_NULL(source); @@ -559,8 +559,8 @@ void Transform::rotate_l2p(const Vector *source, Vector *result, int count) cons void Transform::rotateTranslate_l2p(const Vector *source, Vector *result, int count) const { - DEBUG_FATAL(!source, ("source array is NULL")); - DEBUG_FATAL(!result, ("result array is NULL")); + DEBUG_FATAL(!source, ("source array is nullptr")); + DEBUG_FATAL(!result, ("result array is nullptr")); NOT_NULL(source); NOT_NULL(result); @@ -594,8 +594,8 @@ void Transform::rotateTranslate_l2p(const Vector *source, Vector *result, int co void Transform::rotate_p2l(const Vector *source, Vector *result, int count) const { - DEBUG_FATAL(!source, ("source array is NULL")); - DEBUG_FATAL(!result, ("result array is NULL")); + DEBUG_FATAL(!source, ("source array is nullptr")); + DEBUG_FATAL(!result, ("result array is nullptr")); NOT_NULL(source); NOT_NULL(result); @@ -629,8 +629,8 @@ void Transform::rotate_p2l(const Vector *source, Vector *result, int count) cons void Transform::rotateTranslate_p2l(const Vector *source, Vector *result, int count) const { - DEBUG_FATAL(!source, ("source array is NULL")); - DEBUG_FATAL(!result, ("result array is NULL")); + DEBUG_FATAL(!source, ("source array is nullptr")); + DEBUG_FATAL(!result, ("result array is nullptr")); NOT_NULL(source); NOT_NULL(result); diff --git a/engine/shared/library/sharedMath/src/shared/Vector.cpp b/engine/shared/library/sharedMath/src/shared/Vector.cpp index 8f3ee55d..a694ccdd 100755 --- a/engine/shared/library/sharedMath/src/shared/Vector.cpp +++ b/engine/shared/library/sharedMath/src/shared/Vector.cpp @@ -115,7 +115,7 @@ bool Vector::isNormalized(void) const const Vector Vector::findClosestPointOnLine(const Vector &line0, const Vector &line1, real *t) const { - DEBUG_FATAL(!t, ("t arg is null")); + DEBUG_FATAL(!t, ("t arg is nullptr")); NOT_NULL(t); @@ -189,7 +189,7 @@ real Vector::distanceToLineSegment(const Vector &line0, const Vector &line1) con /** * Send this vector to the DebugPrint system. * - * The header parameter may be NULL. + * The header parameter may be nullptr. * * @param header Header for the vector */ diff --git a/engine/shared/library/sharedMath/src/shared/debug/DebugShapeRenderer.cpp b/engine/shared/library/sharedMath/src/shared/debug/DebugShapeRenderer.cpp index 3e4c8d34..4b0dc1ac 100755 --- a/engine/shared/library/sharedMath/src/shared/debug/DebugShapeRenderer.cpp +++ b/engine/shared/library/sharedMath/src/shared/debug/DebugShapeRenderer.cpp @@ -10,7 +10,7 @@ #include "sharedMath/Transform.h" -static DebugShapeRenderer::DebugShapeRendererFactory * gs_factory = NULL; +static DebugShapeRenderer::DebugShapeRendererFactory * gs_factory = nullptr; // ---------------------------------------------------------------------- @@ -145,8 +145,8 @@ void DebugShapeRenderer::setFactory ( DebugShapeRenderer::DebugShapeRendererFact DebugShapeRenderer * DebugShapeRenderer::create ( Object const * object ) { - if(gs_factory == NULL) - return NULL; + if(gs_factory == nullptr) + return nullptr; return gs_factory(object); } diff --git a/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp b/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp index 9c9ab336..a188f56f 100755 --- a/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp +++ b/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp @@ -327,7 +327,7 @@ using namespace MemoryManagerNamespace; SystemAllocation::SystemAllocation(int size) : m_size(size), - m_next(NULL), + m_next(nullptr), m_pad1(0), m_pad2(0) { @@ -343,7 +343,7 @@ SystemAllocation::SystemAllocation(int size) Block * lastMemoryBlock = getLastMemoryBlock(); // set up the prefix sentinel block - firstMemoryBlock->setPrevious(NULL); + firstMemoryBlock->setPrevious(nullptr); firstMemoryBlock->setNext(firstFreeBlock); firstMemoryBlock->setFree(false); @@ -353,7 +353,7 @@ SystemAllocation::SystemAllocation(int size) // set up the suffix sentinel block lastMemoryBlock->setPrevious(firstFreeBlock); - lastMemoryBlock->setNext(NULL); + lastMemoryBlock->setNext(nullptr); lastMemoryBlock->setFree(false); // put the first block on the free list @@ -748,7 +748,7 @@ void MemoryManagerNamespace::allocateSystemMemory(int megabytes) ms_systemMemoryAllocatedMegabytes += megabytes; // insert the memory into the sorted linked list of system allocations - SystemAllocation * back = NULL; + SystemAllocation * back = nullptr; SystemAllocation * front = ms_firstSystemAllocation; for ( ; front && front->getFirstMemoryBlock() < systemAllocation->getFirstMemoryBlock(); back = front, front = front->getNext()) {} @@ -967,7 +967,7 @@ void MemoryManagerNamespace::addToFreeList(Block * block) FreeBlock * freeBlock = static_cast(block); int const freeBlockSize = freeBlock->getSize(); - FreeBlock * parent = NULL; + FreeBlock * parent = nullptr; FreeBlock * * next = &ms_firstFreeBlock; FreeBlock * same = 0; @@ -991,7 +991,7 @@ void MemoryManagerNamespace::addToFreeList(Block * block) { freeBlock->m_smallerFreeBlock = same->m_smallerFreeBlock; - same->m_smallerFreeBlock = NULL; + same->m_smallerFreeBlock = nullptr; if (freeBlock->m_smallerFreeBlock) freeBlock->m_smallerFreeBlock->m_parentFreeBlock = freeBlock; @@ -999,7 +999,7 @@ void MemoryManagerNamespace::addToFreeList(Block * block) same->m_parentFreeBlock = freeBlock; freeBlock->m_largerFreeBlock = same->m_largerFreeBlock; - same->m_largerFreeBlock = NULL; + same->m_largerFreeBlock = nullptr; if (freeBlock->m_largerFreeBlock) freeBlock->m_largerFreeBlock->m_parentFreeBlock = freeBlock; @@ -1009,9 +1009,9 @@ void MemoryManagerNamespace::addToFreeList(Block * block) else { *next = freeBlock; - freeBlock->m_smallerFreeBlock = NULL; - freeBlock->m_sameFreeBlock = NULL; - freeBlock->m_largerFreeBlock = NULL; + freeBlock->m_smallerFreeBlock = nullptr; + freeBlock->m_sameFreeBlock = nullptr; + freeBlock->m_largerFreeBlock = nullptr; freeBlock->m_parentFreeBlock = parent; } @@ -1042,7 +1042,7 @@ void MemoryManagerNamespace::removeFromFreeList(FreeBlock * block) NOT_NULL(block); // find the pointer that points to block - FreeBlock * * parentPointer = NULL; + FreeBlock * * parentPointer = nullptr; FreeBlock * parent = block->m_parentFreeBlock; if (parent) { @@ -1088,7 +1088,7 @@ void MemoryManagerNamespace::removeFromFreeList(FreeBlock * block) { // this is the worst case. this free block has smaller and larger children, but not any same sized children // we're going to take the smallest block off the larger list and use that to replace the current node - FreeBlock * back = NULL; + FreeBlock * back = nullptr; FreeBlock * replacement = block->m_largerFreeBlock; while (replacement->m_smallerFreeBlock) { @@ -1133,16 +1133,16 @@ void MemoryManagerNamespace::removeFromFreeList(FreeBlock * block) else { // this block has no children - *parentPointer = NULL; + *parentPointer = nullptr; } } } // remove all the pointers the block may have had - block->m_smallerFreeBlock = NULL; - block->m_sameFreeBlock = NULL; - block->m_largerFreeBlock = NULL; - block->m_parentFreeBlock = NULL; + block->m_smallerFreeBlock = nullptr; + block->m_sameFreeBlock = nullptr; + block->m_largerFreeBlock = nullptr; + block->m_parentFreeBlock = nullptr; --ms_freeBlocks; } @@ -1151,7 +1151,7 @@ void MemoryManagerNamespace::removeFromFreeList(FreeBlock * block) FreeBlock *MemoryManagerNamespace::searchFreeList(int blockSize) { - FreeBlock * result = NULL; + FreeBlock * result = nullptr; FreeBlock * current = ms_firstFreeBlock; while (current) { @@ -1239,7 +1239,7 @@ void * MemoryManager::allocate(size_t size, uint32 owner, bool array, bool leakT // get the size of the allocation int allocSize = (cms_allocatedBlockSize + cms_guardBandSize + (size ? static_cast(size) : 1) + cms_guardBandSize + 15) & ~15; - FreeBlock * bestFreeBlock = NULL; + FreeBlock * bestFreeBlock = nullptr; for (int tries = 0; !bestFreeBlock && tries < 2; ++tries) { bestFreeBlock = searchFreeList(allocSize); @@ -1396,7 +1396,7 @@ void *MemoryManager::reallocate(void *userPointer, size_t newSize) { MemoryManager::free(userPointer, array); -// DEBUG_REPORT_LOG(ms_logEachAlloc, ("MemoryManager::reallocate() new_requested_size=%d, org ptr=%p, new ptr=NULL\n", newSize, userPointer)); +// DEBUG_REPORT_LOG(ms_logEachAlloc, ("MemoryManager::reallocate() new_requested_size=%d, org ptr=%p, new ptr=nullptr\n", newSize, userPointer)); return 0; } @@ -1440,7 +1440,7 @@ void *MemoryManager::reallocate(void *userPointer, size_t newSize) * Users should not call this routine directly. It should only be called * by operator delete. * - * This routine should not be called with the NULL pointer. + * This routine should not be called with the nullptr pointer. * * @param userPointer Pointer to the memory * @param array True if the array form of operator new was used, false if the scalar form was used diff --git a/engine/shared/library/sharedMessageDispatch/src/shared/Emitter.cpp b/engine/shared/library/sharedMessageDispatch/src/shared/Emitter.cpp index 8d161e58..b8c97860 100755 --- a/engine/shared/library/sharedMessageDispatch/src/shared/Emitter.cpp +++ b/engine/shared/library/sharedMessageDispatch/src/shared/Emitter.cpp @@ -31,7 +31,7 @@ struct Emitter::ReceiverList Emitter::Emitter() : receiverList(new ReceiverList) { - assert (receiverList != NULL); + assert (receiverList != nullptr); } //--------------------------------------------------------------------- diff --git a/engine/shared/library/sharedMessageDispatch/src/shared/Receiver.cpp b/engine/shared/library/sharedMessageDispatch/src/shared/Receiver.cpp index ff929dc2..bc8fc3b3 100755 --- a/engine/shared/library/sharedMessageDispatch/src/shared/Receiver.cpp +++ b/engine/shared/library/sharedMessageDispatch/src/shared/Receiver.cpp @@ -33,7 +33,7 @@ Receiver::Receiver() : emitterTargets(new EmitterTargets), hasTargets(false) { - assert(emitterTargets != NULL); + assert(emitterTargets != nullptr); } //--------------------------------------------------------------------- diff --git a/engine/shared/library/sharedNetwork/src/linux/TcpClient.cpp b/engine/shared/library/sharedNetwork/src/linux/TcpClient.cpp index 8dfa1605..8acf1289 100755 --- a/engine/shared/library/sharedNetwork/src/linux/TcpClient.cpp +++ b/engine/shared/library/sharedNetwork/src/linux/TcpClient.cpp @@ -494,7 +494,7 @@ void TcpClient::update() // disconnected so we can handle cleanup. if (pollResult) { - if (m_recvBuffer == NULL) + if (m_recvBuffer == nullptr) { m_recvBufferLength = 1500; m_recvBuffer = new unsigned char [m_recvBufferLength]; @@ -533,7 +533,7 @@ void TcpClient::update() } else { - LOG("Network", ("(null connection object) Read zero bytes on a successful poll (POLLIN|POLLHUP). Closing socket since we think it is closed.")); + LOG("Network", ("(nullptr connection object) Read zero bytes on a successful poll (POLLIN|POLLHUP). Closing socket since we think it is closed.")); } onConnectionClosed(); } diff --git a/engine/shared/library/sharedNetwork/src/shared/Service.cpp b/engine/shared/library/sharedNetwork/src/shared/Service.cpp index 84ec3dd8..9e0f0c8f 100755 --- a/engine/shared/library/sharedNetwork/src/shared/Service.cpp +++ b/engine/shared/library/sharedNetwork/src/shared/Service.cpp @@ -186,8 +186,8 @@ Service::~Service() delete m_callback; connections.clear(); - connectionAllocator = NULL; - m_callback = NULL; + connectionAllocator = nullptr; + m_callback = nullptr; delete m_tcpServer; } diff --git a/engine/shared/library/sharedNetworkMessages/src/shared/core/SetupSharedNetworkMessages.cpp b/engine/shared/library/sharedNetworkMessages/src/shared/core/SetupSharedNetworkMessages.cpp index e92dd770..134b7a9b 100755 --- a/engine/shared/library/sharedNetworkMessages/src/shared/core/SetupSharedNetworkMessages.cpp +++ b/engine/shared/library/sharedNetworkMessages/src/shared/core/SetupSharedNetworkMessages.cpp @@ -137,7 +137,7 @@ namespace SetupSharedNetworkMessagesNamespace MessageQueue::Data* unpackNothing(Archive::ReadIterator &) { - return NULL; + return nullptr; } void packGenericShipDamageMessage(const MessageQueue::Data * data, Archive::ByteStream & target) diff --git a/engine/shared/library/sharedObject/src/shared/ObjectWatcherList.cpp b/engine/shared/library/sharedObject/src/shared/ObjectWatcherList.cpp index a2cb6e67..fdfb4afa 100755 --- a/engine/shared/library/sharedObject/src/shared/ObjectWatcherList.cpp +++ b/engine/shared/library/sharedObject/src/shared/ObjectWatcherList.cpp @@ -23,7 +23,7 @@ namespace ObjectWatcherListNamespace { void setRegionOfInfluenceEnabled(Object const * const object, bool const enabled, bool skipCell) { - if (skipCell && NULL != object->getCellProperty()) + if (skipCell && nullptr != object->getCellProperty()) return; object->setRegionOfInfluenceEnabled(enabled); @@ -67,7 +67,7 @@ ObjectWatcherList::~ObjectWatcherList(void) /** * Add an Object to the ObjectWatcherList. * - * This routine will call Fatal in debug compiles if it is passed a NULL + * This routine will call Fatal in debug compiles if it is passed a nullptr * object. * * This routine will call Fatal in debug compiles if the object list @@ -85,7 +85,7 @@ void ObjectWatcherList::addObject(Object & objectToAdd) /** * Remove an Object from the ObjectWatcherList. * - * This routine will call Fatal in debug compiles if it is passed a NULL + * This routine will call Fatal in debug compiles if it is passed a nullptr * object. * * @param objectToRemove Pointer to the object to remove @@ -112,13 +112,13 @@ void ObjectWatcherList::removeObjectByIndex (const Object & object, int index) // Remove the last item in the vector. m_objectVector->pop_back(); - // NULL the object from the alter-safe object list. + // nullptr the object from the alter-safe object list. uint size = m_alterSafeObjectVector->size(); for (uint i = 0; i < size; ++i) { if ((*m_alterSafeObjectVector)[i] == &object) { - (*m_alterSafeObjectVector)[i] = NULL; + (*m_alterSafeObjectVector)[i] = nullptr; return; } } @@ -232,7 +232,7 @@ void ObjectWatcherList::alter(real time) // Make sure the object is still in the object list before removing it - if ((*m_alterSafeObjectVector)[i] != NULL) + if ((*m_alterSafeObjectVector)[i] != nullptr) { removeObject(*obj); } diff --git a/engine/shared/library/sharedObject/src/shared/appearance/Appearance.cpp b/engine/shared/library/sharedObject/src/shared/appearance/Appearance.cpp index e1acba39..f899e042 100755 --- a/engine/shared/library/sharedObject/src/shared/appearance/Appearance.cpp +++ b/engine/shared/library/sharedObject/src/shared/appearance/Appearance.cpp @@ -80,8 +80,8 @@ void Appearance::setRenderHardpointFunction(RenderHardpointFunction renderHardpo Appearance::Appearance(const AppearanceTemplate *newAppearanceTemplate) : m_appearanceTemplate(AppearanceTemplateList::fetch(newAppearanceTemplate)), - m_extent(m_appearanceTemplate ? ExtentList::fetch(m_appearanceTemplate->getExtent()) : NULL), - m_owner(NULL), + m_extent(m_appearanceTemplate ? ExtentList::fetch(m_appearanceTemplate->getExtent()) : nullptr), + m_owner(nullptr), m_renderedFrameNumber(0), m_scale(Vector::xyz111), m_keepAlive(false), @@ -100,15 +100,15 @@ Appearance::Appearance(const AppearanceTemplate *newAppearanceTemplate) : Appearance::~Appearance() { ExtentList::release(m_extent); - m_extent = NULL; + m_extent = nullptr; if (m_appearanceTemplate) { AppearanceTemplateList::release(m_appearanceTemplate); - m_appearanceTemplate = NULL; + m_appearanceTemplate = nullptr; } - m_owner = NULL; + m_owner = nullptr; } // ---------------------------------------------------------------------- @@ -269,7 +269,7 @@ void Appearance::render() const void Appearance::objectListCameraRenderDescend(Object const & obj) { //-- don't descend through cells - if (NULL != obj.getCellProperty()) + if (nullptr != obj.getCellProperty()) return; int const childCount = obj.getNumberOfChildObjects(); @@ -378,7 +378,7 @@ bool Appearance::implementsCollide() const * CustomizationDataProperty. If there is such a property, this * function will invoke Appearance::setCustomizationData() with the * appropriate value. If the property doesn't exist, this function - * will invoke Appearance::setCustomizationData() with NULL. Note if + * will invoke Appearance::setCustomizationData() with nullptr. Note if * the caller sets the CustomizationDataProperty for an Object after * associating the Object instance with the appearance, the caller is * responsible for calling Appearance::setCustomizationData(). @@ -457,7 +457,7 @@ const char * Appearance::getFloorName () const if (m_appearanceTemplate) return m_appearanceTemplate->getFloorName(); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -607,7 +607,7 @@ const char * Appearance::getAppearanceTemplateName () const DPVS::Object *Appearance::getDpvsObject() const { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -748,14 +748,14 @@ SkeletalAppearance2 const * Appearance::asSkeletalAppearance2() const ComponentAppearance * Appearance::asComponentAppearance() { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- ComponentAppearance const * Appearance::asComponentAppearance() const { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -783,14 +783,14 @@ void Appearance::onEvent(LabelHash::Id /* eventId */) int Appearance::getHardpointCount() const { - return m_appearanceTemplate != NULL ? m_appearanceTemplate->getHardpointCount() : 0; + return m_appearanceTemplate != nullptr ? m_appearanceTemplate->getHardpointCount() : 0; } // ---------------------------------------------------------------------- int Appearance::getHardpointIndex(CrcString const &hardpointName, bool optional) const { - return m_appearanceTemplate != NULL ? m_appearanceTemplate->getHardpointIndex(hardpointName, optional) : -1; + return m_appearanceTemplate != nullptr ? m_appearanceTemplate->getHardpointIndex(hardpointName, optional) : -1; } // ---------------------------------------------------------------------- @@ -855,42 +855,42 @@ bool Appearance::usesRenderEffectsFlag() const ParticleEffectAppearance * Appearance::asParticleEffectAppearance() { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- ParticleEffectAppearance const * Appearance::asParticleEffectAppearance() const { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- SwooshAppearance * Appearance::asSwooshAppearance() { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- SwooshAppearance const * Appearance::asSwooshAppearance() const { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- LightningAppearance * Appearance::asLightningAppearance() { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- LightningAppearance const * Appearance::asLightningAppearance() const { - return NULL; + return nullptr; } // ====================================================================== diff --git a/engine/shared/library/sharedObject/src/shared/appearance/Appearance.h b/engine/shared/library/sharedObject/src/shared/appearance/Appearance.h index 13b49530..4a7bd5cf 100755 --- a/engine/shared/library/sharedObject/src/shared/appearance/Appearance.h +++ b/engine/shared/library/sharedObject/src/shared/appearance/Appearance.h @@ -206,7 +206,7 @@ private: /** * Get the AppearanceTemplate for this Appearance. * - * The AppearanceTemplate may be NULL. + * The AppearanceTemplate may be nullptr. * * AppearanceTemplates may be shared by multiple Appearances. * diff --git a/engine/shared/library/sharedObject/src/shared/appearance/AppearanceTemplate.cpp b/engine/shared/library/sharedObject/src/shared/appearance/AppearanceTemplate.cpp index 89f44831..0975380d 100755 --- a/engine/shared/library/sharedObject/src/shared/appearance/AppearanceTemplate.cpp +++ b/engine/shared/library/sharedObject/src/shared/appearance/AppearanceTemplate.cpp @@ -97,14 +97,14 @@ AppearanceTemplate::PreloadManager::~PreloadManager () AppearanceTemplate::AppearanceTemplate(const char *newName) : m_referenceCount(0), m_crcName(new CrcLowerString(newName)), - m_extent(NULL), - m_collisionExtent(NULL), - m_hardpoints(NULL), - m_floorName(NULL), + m_extent(nullptr), + m_collisionExtent(nullptr), + m_hardpoints(nullptr), + m_floorName(nullptr), m_preloadManager (0) { //-- Save info on most recently constructed appearance template. - IGNORE_RETURN(snprintf(ms_crashReportInfo, sizeof(ms_crashReportInfo) - 1, "AppearanceTemplate: %s\n", newName ? newName : "")); + IGNORE_RETURN(snprintf(ms_crashReportInfo, sizeof(ms_crashReportInfo) - 1, "AppearanceTemplate: %s\n", newName ? newName : "")); ms_crashReportInfo[sizeof(ms_crashReportInfo) - 1] = '\0'; } @@ -118,10 +118,10 @@ AppearanceTemplate::~AppearanceTemplate(void) delete m_crcName; ExtentList::release(m_extent); - m_extent = NULL; + m_extent = nullptr; ExtentList::release(m_collisionExtent); - m_collisionExtent = NULL; + m_collisionExtent = nullptr; if (m_hardpoints) { @@ -482,7 +482,7 @@ const CrcLowerString &AppearanceTemplate::getCrcName() const /** *Get the name of this AppearanceTemplate. * - *This routine may return NULL. + *This routine may return nullptr. */ const char *AppearanceTemplate::getName() const diff --git a/engine/shared/library/sharedObject/src/shared/appearance/AppearanceTemplateList.cpp b/engine/shared/library/sharedObject/src/shared/appearance/AppearanceTemplateList.cpp index 37439f23..d2afe802 100755 --- a/engine/shared/library/sharedObject/src/shared/appearance/AppearanceTemplateList.cpp +++ b/engine/shared/library/sharedObject/src/shared/appearance/AppearanceTemplateList.cpp @@ -219,7 +219,7 @@ const AppearanceTemplate *AppearanceTemplateList::fetch(const char *const fileNa char const * actualFileName = fileName; if (!fileName) { - DEBUG_WARNING(true, ("AppearanceTemplateList::fetch passed NULL fileName, using default")); + DEBUG_WARNING(true, ("AppearanceTemplateList::fetch passed nullptr fileName, using default")); actualFileName = getDefaultAppearanceTemplateName(); } else if (!*fileName) @@ -246,14 +246,14 @@ const AppearanceTemplate *AppearanceTemplateList::fetch(const char *const fileNa DEBUG_WARNING(true, ("AppearanceTemplateList::fetch actualFileName fetch for %s failed.", actualFileName)); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- /** * Add a reference to the specified Appearance. * - * This routine will do nothing if passed in NULL. Otherwise, it will + * This routine will do nothing if passed in nullptr. Otherwise, it will * increase the reference count of the specified AppearanceTemplate * by one. * @@ -297,7 +297,7 @@ const AppearanceTemplate *AppearanceTemplateList::fetch(Iff *const iff) return 0; //lint !e527 // unreachable } - AppearanceTemplate *const appearanceTemplate = (*iter).second(NULL, iff); + AppearanceTemplate *const appearanceTemplate = (*iter).second(nullptr, iff); NOT_NULL(appearanceTemplate); addAnonymousAppearanceTemplate(appearanceTemplate); @@ -351,7 +351,7 @@ const AppearanceTemplate *AppearanceTemplateList::fetchNew(AppearanceTemplate *c /** * Remove a reference to the specified AppearanceTemplate. * - * This routine will do nothing if passed in NULL. + * This routine will do nothing if passed in nullptr. * * If the reference count drops to 0, the AppearanceTemplate will be deleted. * @@ -404,9 +404,9 @@ Appearance *AppearanceTemplateList::createAppearance(const char *const fileName) #endif //probably should modify the macro sometime to just be quiet if this isn't defined - if (appearanceTemplate == NULL){ + if (appearanceTemplate == nullptr){ DEBUG_WARNING(true, ("FIX ME: Appearance template for %s could not be fetched - is it missing?", fileName)); - return NULL; // Cekis: TODO: Figure out why the template can't be fetched. DarthArgus: always is due to a missing file or one of the redirectors having a bad path + return nullptr; // Cekis: TODO: Figure out why the template can't be fetched. DarthArgus: always is due to a missing file or one of the redirectors having a bad path } //-- creating the appearance will increment the reference count @@ -581,7 +581,7 @@ AppearanceTemplate *AppearanceTemplateListNamespace::create(const char *const fi // DEBUG_REPORT_LOG_PRINT(true, ("Loading mesh %s\n", actualFileName.getString())); TagBindingMap::iterator iter = ms_tagBindingMap.find(TAG_MESH); if (iter != ms_tagBindingMap.end()) - appearanceTemplate = iter->second(actualFileName.getString(), NULL); + appearanceTemplate = iter->second(actualFileName.getString(), nullptr); } //-- we now need to create the appearance from disk diff --git a/engine/shared/library/sharedObject/src/shared/container/ArrangementDescriptorList.cpp b/engine/shared/library/sharedObject/src/shared/container/ArrangementDescriptorList.cpp index 31de898d..ddc27d42 100755 --- a/engine/shared/library/sharedObject/src/shared/container/ArrangementDescriptorList.cpp +++ b/engine/shared/library/sharedObject/src/shared/container/ArrangementDescriptorList.cpp @@ -69,7 +69,7 @@ const ArrangementDescriptor *ArrangementDescriptorList::fetch(const CrcLowerStri } else { - WARNING(true, ("default ArrangementDescriptor [%s] could not be loaded, returning NULL ArrangementDescriptor", filename.getString())); + WARNING(true, ("default ArrangementDescriptor [%s] could not be loaded, returning nullptr ArrangementDescriptor", filename.getString())); return 0; } } diff --git a/engine/shared/library/sharedObject/src/shared/container/ContainedByProperty.cpp b/engine/shared/library/sharedObject/src/shared/container/ContainedByProperty.cpp index 1a25f0cd..74494ba9 100755 --- a/engine/shared/library/sharedObject/src/shared/container/ContainedByProperty.cpp +++ b/engine/shared/library/sharedObject/src/shared/container/ContainedByProperty.cpp @@ -49,7 +49,7 @@ ContainedByProperty::~ContainedByProperty() * property. * * @return Pointer to the object that contains the object with this - * ContainedByProperty. Returns NULL if the object isn't + * ContainedByProperty. Returns nullptr if the object isn't * contained by anything at the moment. */ diff --git a/engine/shared/library/sharedObject/src/shared/container/Container.cpp b/engine/shared/library/sharedObject/src/shared/container/Container.cpp index b85e8f1f..66e9e9f4 100755 --- a/engine/shared/library/sharedObject/src/shared/container/Container.cpp +++ b/engine/shared/library/sharedObject/src/shared/container/Container.cpp @@ -21,13 +21,13 @@ // ====================================================================== //Lint suppressions. -//lint -esym(613, ContainerIterator::m_iterator) // (Warning -- Possible use of null pointer 'ContainerIterator::m_iterator' ) // This is an opaque data type to us. We can only check against a container::end(). +//lint -esym(613, ContainerIterator::m_iterator) // (Warning -- Possible use of nullptr pointer 'ContainerIterator::m_iterator' ) // This is an opaque data type to us. We can only check against a container::end(). //lint -esym(1540, ContainerIterator::m_iterator) // (Warning -- Pointer member 'ContainerIterator::m_iterator' neither freed nor zero'ed by destructor -- Effective C++ #6) // It's okay, the iterator type is opaque to us, we have no idea it's a pointer. //lint -esym(1554, ContainerIterator::m_iterator) // (Warning -- Direct copy of pointer 'ContainerIterator::m_iterator'. // It's okay, the iterator type is opaque to us, we have no idea it's a pointer. //lint -esym(1555, ContainerIterator::m_iterator) // (Warning -- Direct pointer copy of member 'ContainerIterator::m_iterator' within copy assignment operator: 'ContainerIterator::operator=(const ContainerIterator &) // Opaque type, we don't know its a pointer. //lint -esym(1555, ContainerIterator::m_owner) // (Warning -- Direct pointer copy of member 'ContainerIterator::m_owner' within copy assignment operator: 'ContainerIterator::operator=(const ContainerIterator &) // We do not own this memory, so it's okay to overwrite the pointer. We can't leak it. -//lint -esym(613, ContainerConstIterator::m_iterator) // (Warning -- Possible use of null pointer 'ContainerConstIterator::m_iterator' ) // This is an opaque data type to us. We can only check against a container::end(). +//lint -esym(613, ContainerConstIterator::m_iterator) // (Warning -- Possible use of nullptr pointer 'ContainerConstIterator::m_iterator' ) // This is an opaque data type to us. We can only check against a container::end(). //lint -esym(1540, ContainerConstIterator::m_iterator) // (Warning -- Pointer member 'ContainerConstIterator::m_iterator' neither freed nor zero'ed by destructor -- Effective C++ #6) // It's okay, the iterator type is opaque to us, we have no idea it's a pointer. //lint -esym(1554, ContainerConstIterator::m_iterator) // (Warning -- Direct copy of pointer 'ContainerConstIterator::m_iterator'. // It's okay, the iterator type is opaque to us, we have no idea it's a pointer. //lint -esym(1555, ContainerConstIterator::m_iterator) // (Warning -- Direct pointer copy of member 'ContainerConstIterator::m_iterator' within copy assignment operator: 'ContainerConstIterator::operator=(const ContainerConstIterator &) // Opaque type, we don't know its a pointer. @@ -108,7 +108,7 @@ ContainerIterator & ContainerIterator::operator= (const ContainerIterator & rhs) CachedNetworkId & ContainerIterator::operator*() { // @todo fix this interface -- it is broken. It is possible to - // construct a ContainerIterator with a NULL m_iterator, but there is + // construct a ContainerIterator with a nullptr m_iterator, but there is // no way to gracefully exit from this function since it requires a non-const // reference. Otherwise I would return CachedNetworkId::cms_cachedIvalid. NOT_NULL(m_owner); @@ -197,7 +197,7 @@ ContainerConstIterator & ContainerConstIterator::operator= (const ContainerConst const CachedNetworkId & ContainerConstIterator::operator*() const { // @todo fix this interface -- it is broken. It is possible to - // construct a ContainerIterator with a NULL m_iterator, but there is + // construct a ContainerIterator with a nullptr m_iterator, but there is // no way to gracefully exit from this function since it requires a non-const // reference. Otherwise I would return CachedNetworkId::cms_cachedIvalid. NOT_NULL(m_owner); @@ -677,7 +677,7 @@ void Container::debugPrint(std::string &buffer) const { Object const *const object = it->getObject(); - sprintf(tempBuffer, "\tindex [%d]: object id [%s], template [%s]\n", index, it->getValueString().c_str(), object ? object->getObjectTemplateName() : ""); + sprintf(tempBuffer, "\tindex [%d]: object id [%s], template [%s]\n", index, it->getValueString().c_str(), object ? object->getObjectTemplateName() : ""); buffer += tempBuffer; } @@ -699,7 +699,7 @@ void Container::debugLog() const for (Contents::const_iterator it = m_contents.begin(); it != endIt; ++it, ++index) { Object const *const object = it->getObject(); - DEBUG_REPORT_LOG(true, ("\tindex [%d]: object id [%s], template [%s]\n", index, it->getValueString().c_str(), object ? object->getObjectTemplateName() : "")); + DEBUG_REPORT_LOG(true, ("\tindex [%d]: object id [%s], template [%s]\n", index, it->getValueString().c_str(), object ? object->getObjectTemplateName() : "")); } DEBUG_REPORT_LOG(true, ("====[END: container]====\n")); diff --git a/engine/shared/library/sharedObject/src/shared/container/SlotIdManager.cpp b/engine/shared/library/sharedObject/src/shared/container/SlotIdManager.cpp index 9aea59ef..70b6b34d 100755 --- a/engine/shared/library/sharedObject/src/shared/container/SlotIdManager.cpp +++ b/engine/shared/library/sharedObject/src/shared/container/SlotIdManager.cpp @@ -351,7 +351,7 @@ bool SlotIdManager::isSlotPlayerModifiable(const SlotId &slotId) * * If the slot can have something put in it that directly affects what you * see on the client, this will return true. If this returns false, - * getSlotHardpointName() will return a NULL string. + * getSlotHardpointName() will return a nullptr string. * * @param slotId a SlotId instance for the slot under question. * @@ -381,9 +381,9 @@ bool SlotIdManager::isSlotAppearanceRelated(const SlotId &slotId) * * The caller should check the result of isSlotAppearanceRelated() before * calling this function. If the slot is not appearance related, this function - * will always return NULL. Also, if the SlotIdManager is installed such that + * will always return nullptr. Also, if the SlotIdManager is installed such that * hardpoint names are not loaded (currently the server is loaded this way), - * the specified hardpoint name will return NULL. + * the specified hardpoint name will return nullptr. * * @param slotId a SlotId instance for the slot under question. * diff --git a/engine/shared/library/sharedObject/src/shared/container/SlottedContainer.cpp b/engine/shared/library/sharedObject/src/shared/container/SlottedContainer.cpp index b97b1a24..98b85e82 100755 --- a/engine/shared/library/sharedObject/src/shared/container/SlottedContainer.cpp +++ b/engine/shared/library/sharedObject/src/shared/container/SlottedContainer.cpp @@ -49,7 +49,7 @@ SlottedContainer::~SlottedContainer() if (m_slotMap) { delete m_slotMap; - m_slotMap = NULL; + m_slotMap = nullptr; } } diff --git a/engine/shared/library/sharedObject/src/shared/container/VolumeContainer.cpp b/engine/shared/library/sharedObject/src/shared/container/VolumeContainer.cpp index 02433163..fe716109 100755 --- a/engine/shared/library/sharedObject/src/shared/container/VolumeContainer.cpp +++ b/engine/shared/library/sharedObject/src/shared/container/VolumeContainer.cpp @@ -36,7 +36,7 @@ namespace VolumeContainerNamespace return parent->getVolumeContainerProperty(); } } - return NULL; + return nullptr; } const VolumeContainer* getVolumeContainerParent(const VolumeContainer& self) @@ -51,7 +51,7 @@ namespace VolumeContainerNamespace return parent->getVolumeContainerProperty(); } } - return NULL; + return nullptr; } const unsigned int serverHolocronCrc = CrcLowerString::calculateCrc("object/player_quest/pgc_quest_holocron.iff"); diff --git a/engine/shared/library/sharedObject/src/shared/container/VolumeContainer.h b/engine/shared/library/sharedObject/src/shared/container/VolumeContainer.h index 922154f7..f99766dc 100755 --- a/engine/shared/library/sharedObject/src/shared/container/VolumeContainer.h +++ b/engine/shared/library/sharedObject/src/shared/container/VolumeContainer.h @@ -69,8 +69,8 @@ public: private: bool checkVolume(const VolumeContainmentProperty &item) const; - bool internalRemove(const Object & item, const VolumeContainmentProperty *itemProp = NULL); - void insertNewItem(const Object & item, const VolumeContainmentProperty *itemProp = NULL); + bool internalRemove(const Object & item, const VolumeContainmentProperty *itemProp = nullptr); + void insertNewItem(const Object & item, const VolumeContainmentProperty *itemProp = nullptr); void childVolumeChanged(int volume, bool updateParent); diff --git a/engine/shared/library/sharedObject/src/shared/controller/Controller.cpp b/engine/shared/library/sharedObject/src/shared/controller/Controller.cpp index 66572a6a..2483e64b 100755 --- a/engine/shared/library/sharedObject/src/shared/controller/Controller.cpp +++ b/engine/shared/library/sharedObject/src/shared/controller/Controller.cpp @@ -88,7 +88,7 @@ MessageQueue::Data* Controller::peekHeldMessage( int message, float *value, uint { HeldMessageMap::iterator iter = m_heldMessages.find( message ); if ( iter == m_heldMessages.end() ) - return NULL; + return nullptr; if ( value ) *value = iter->second.value; if ( flags ) @@ -216,42 +216,42 @@ MessageQueue * Controller::getMessageQueue() TangibleController * Controller::asTangibleController() { - return NULL; + return nullptr; } //---------------------------------------------------------------------- TangibleController const * Controller::asTangibleController() const { - return NULL; + return nullptr; } //---------------------------------------------------------------------- CreatureController * Controller::asCreatureController() { - return NULL; + return nullptr; } //---------------------------------------------------------------------- CreatureController const * Controller::asCreatureController() const { - return NULL; + return nullptr; } //---------------------------------------------------------------------- ShipController * Controller::asShipController() { - return NULL; + return nullptr; } //---------------------------------------------------------------------- ShipController const * Controller::asShipController() const { - return NULL; + return nullptr; } // ====================================================================== diff --git a/engine/shared/library/sharedObject/src/shared/core/SetupSharedObject.cpp b/engine/shared/library/sharedObject/src/shared/core/SetupSharedObject.cpp index 69799beb..d25d9be1 100755 --- a/engine/shared/library/sharedObject/src/shared/core/SetupSharedObject.cpp +++ b/engine/shared/library/sharedObject/src/shared/core/SetupSharedObject.cpp @@ -55,7 +55,7 @@ SetupSharedObject::Data::Data() customizationIdManagerFilename(0), objectsAlterChildrenAndContents(true), loadObjectTemplateCrcStringTable(true), - pobEjectionTransformFilename(NULL) + pobEjectionTransformFilename(nullptr) { } diff --git a/engine/shared/library/sharedObject/src/shared/core/SetupSharedObject.h b/engine/shared/library/sharedObject/src/shared/core/SetupSharedObject.h index dd38e215..ce43740e 100755 --- a/engine/shared/library/sharedObject/src/shared/core/SetupSharedObject.h +++ b/engine/shared/library/sharedObject/src/shared/core/SetupSharedObject.h @@ -70,7 +70,7 @@ public: // Specifies whether or not ObjectTemplateList should load the object template crc table bool loadObjectTemplateCrcStringTable; - // Specifies the name of the POB ejection point transform override filename to use; use NULL (default) if no ejection point support. + // Specifies the name of the POB ejection point transform override filename to use; use nullptr (default) if no ejection point support. char const *pobEjectionTransformFilename; private: diff --git a/engine/shared/library/sharedObject/src/shared/customization/CustomizationData.cpp b/engine/shared/library/sharedObject/src/shared/customization/CustomizationData.cpp index e27808f2..a05ed186 100755 --- a/engine/shared/library/sharedObject/src/shared/customization/CustomizationData.cpp +++ b/engine/shared/library/sharedObject/src/shared/customization/CustomizationData.cpp @@ -277,10 +277,10 @@ CustomizationData::CustomizationData(Object &owner) : void CustomizationData::addVariableTakeOwnership(const std::string &fullVariablePathName, CustomizationVariable *variable) { - //-- check for null variable + //-- check for nullptr variable if (!variable) { - WARNING(true, ("addVariableTakeOwnership() called with null variable.\n")); + WARNING(true, ("addVariableTakeOwnership() called with nullptr variable.\n")); return; } @@ -591,7 +591,7 @@ std::string CustomizationData::writeLocalDataToString() const saveToByteVector(binaryData); - //-- Convert binary data to string. We're escaping the 0 for the database so this is a non-null string. + //-- Convert binary data to string. We're escaping the 0 for the database so this is a non-nullptr string. // We translate 0x00 => 0xff 0x01 // 0xff => 0xff 0x02 std::string returnValue; @@ -1139,7 +1139,7 @@ void CustomizationData::notifyPendingRemoteDestruction(const CustomizationData * //-- validate arg if (!customizationData) { - DEBUG_WARNING(true, ("notifyPendingRemoteDestruction(): customizationData arg is null")); + DEBUG_WARNING(true, ("notifyPendingRemoteDestruction(): customizationData arg is nullptr")); return; } diff --git a/engine/shared/library/sharedObject/src/shared/customization/CustomizationData_LocalDirectory.cpp b/engine/shared/library/sharedObject/src/shared/customization/CustomizationData_LocalDirectory.cpp index 3a8422cb..1a12a2fd 100755 --- a/engine/shared/library/sharedObject/src/shared/customization/CustomizationData_LocalDirectory.cpp +++ b/engine/shared/library/sharedObject/src/shared/customization/CustomizationData_LocalDirectory.cpp @@ -95,7 +95,7 @@ bool CustomizationData::LocalDirectory::resolvePathNameToDirectory(const std::st //-- ensure we've got a directory if (!subdir) { - WARNING(true, ("resolvePathNameToDirectory(): logic failure, subdir is null")); + WARNING(true, ("resolvePathNameToDirectory(): logic failure, subdir is nullptr")); return false; } @@ -110,7 +110,7 @@ bool CustomizationData::LocalDirectory::addVariableTakeOwnership(const std::stri //-- ensure caller passed in valid customizationVariable if (!variable) { - WARNING(true, ("addVariableTakeOwnership(): caller passed in NULL variable")); + WARNING(true, ("addVariableTakeOwnership(): caller passed in nullptr variable")); return false; } @@ -210,10 +210,10 @@ CustomizationData::Directory *CustomizationData::LocalDirectory::findDirectory(c void CustomizationData::LocalDirectory::deleteDirectory(Directory *childDirectory) { - //-- check for null directory + //-- check for nullptr directory if (!childDirectory) { - WARNING(true, ("deleteDirectory(): NULL childDirectory arg")); + WARNING(true, ("deleteDirectory(): nullptr childDirectory arg")); return; } @@ -255,10 +255,10 @@ void CustomizationData::LocalDirectory::iterateOverConstVariables(const std::str const DirectoryMap::const_iterator endIt = m_directories.end(); for (DirectoryMap::const_iterator it = m_directories.begin(); it != endIt; ++it) { - //-- check for null directory pointer (shouldn't happen but shouldn't FATAL) + //-- check for nullptr directory pointer (shouldn't happen but shouldn't FATAL) if (!it->second) { - WARNING(true, ("iterateOverConstVariables(): directory 0x%08x has null child directory for [%s].", this, it->first.getString())); + WARNING(true, ("iterateOverConstVariables(): directory 0x%08x has nullptr child directory for [%s].", this, it->first.getString())); return; } @@ -292,10 +292,10 @@ void CustomizationData::LocalDirectory::iterateOverVariables(const std::string & const DirectoryMap::iterator endIt = m_directories.end(); for (DirectoryMap::iterator it = m_directories.begin(); it != endIt; ++it) { - //-- check for null directory pointer (shouldn't happen but shouldn't FATAL) + //-- check for nullptr directory pointer (shouldn't happen but shouldn't FATAL) if (!it->second) { - WARNING(true, ("iterateOverConstVariables(): directory 0x%08x has null child directory for [%s].", this, it->first.getString())); + WARNING(true, ("iterateOverConstVariables(): directory 0x%08x has nullptr child directory for [%s].", this, it->first.getString())); return; } @@ -314,10 +314,10 @@ void CustomizationData::LocalDirectory::iterateOverVariables(const std::string & void CustomizationData::LocalDirectory::replaceOrAddDirectory(const std::string &directoryPathName, int directoryNameStartIndex, Directory *directory) { - //-- ensure attached directory is not null + //-- ensure attached directory is not nullptr if (!directory) { - WARNING(true, ("replaceOrAddDirectory(): directory arg is NULL")); + WARNING(true, ("replaceOrAddDirectory(): directory arg is nullptr")); return; } @@ -411,7 +411,7 @@ std::string CustomizationData::LocalDirectory::writeLocalDirectoryToString() con const CustomizationVariableMap::const_iterator endIt = m_variables.end(); for (CustomizationVariableMap::const_iterator it = m_variables.begin(); it != endIt; ++it) { - //-- verify it's a non-null variable + //-- verify it's a non-nullptr variable const CustomizationVariable *const variable = it->second; if (variable && variable->doesVariablePersist()) { @@ -430,11 +430,11 @@ std::string CustomizationData::LocalDirectory::writeLocalDirectoryToString() con const CustomizationVariableMap::const_iterator endIt = m_variables.end(); for (CustomizationVariableMap::const_iterator it = m_variables.begin(); it != endIt; ++it) { - //-- verify it's a non-null variable + //-- verify it's a non-nullptr variable const CustomizationVariable *const variable = it->second; if (!variable) { - WARNING(true, ("writeLocalDirectoryToString: NULL variable for [%s], skipping variable writing.")); + WARNING(true, ("writeLocalDirectoryToString: nullptr variable for [%s], skipping variable writing.")); continue; } diff --git a/engine/shared/library/sharedObject/src/shared/customization/CustomizationIdManager.cpp b/engine/shared/library/sharedObject/src/shared/customization/CustomizationIdManager.cpp index 32208e24..b21696d4 100755 --- a/engine/shared/library/sharedObject/src/shared/customization/CustomizationIdManager.cpp +++ b/engine/shared/library/sharedObject/src/shared/customization/CustomizationIdManager.cpp @@ -189,7 +189,7 @@ bool CustomizationIdManager::mapIdToString(int id, char *variableName, int buffe NOT_NULL(variableName); DEBUG_FATAL(bufferLength < 1, ("CustomizationIdManager: bufferLength of [%d] too small to hold anything.", bufferLength)); - //-- Copy variable name to user buffer, ensure it gets NULL terminated. + //-- Copy variable name to user buffer, ensure it gets nullptr terminated. strncpy(variableName, NON_NULL(s_idToVariableName[static_cast(id)])->getString(), static_cast(bufferLength - 1)); variableName[bufferLength - 1] = '\0'; diff --git a/engine/shared/library/sharedObject/src/shared/customization/ObjectTemplateCustomizationDataWriter.cpp b/engine/shared/library/sharedObject/src/shared/customization/ObjectTemplateCustomizationDataWriter.cpp index a02bf9d0..3e18e9a9 100755 --- a/engine/shared/library/sharedObject/src/shared/customization/ObjectTemplateCustomizationDataWriter.cpp +++ b/engine/shared/library/sharedObject/src/shared/customization/ObjectTemplateCustomizationDataWriter.cpp @@ -149,7 +149,7 @@ bool ObjectTemplateCustomizationDataWriter::writeToFile(const std::string &pathN if (!allowOverwrite) { FILE *const testFile = fopen(pathName.c_str(), "r"); - if (testFile != NULL) + if (testFile != nullptr) { fclose(testFile); DEBUG_REPORT_LOG(true, ("writeToFile(): overwrite attempt: skipped writing [%s] because it already exists and allowOverwrite == false.\n", pathName.c_str())); diff --git a/engine/shared/library/sharedObject/src/shared/lot/LotManager.cpp b/engine/shared/library/sharedObject/src/shared/lot/LotManager.cpp index eb5ee6bf..6d379528 100755 --- a/engine/shared/library/sharedObject/src/shared/lot/LotManager.cpp +++ b/engine/shared/library/sharedObject/src/shared/lot/LotManager.cpp @@ -129,7 +129,7 @@ void LotManager::addNoBuildEntry (Object const & object, float const noBuildRadi bool const result = m_noBuildEntryMap->insert (std::make_pair (&object, noBuildEntry)).second; UNREF (result); DEBUG_FATAL (!result, ("LotManager::addNoBuildEntry - entry already exists")); - DEBUG_REPORT_LOG (ms_logEntries, ("LotManager: added no build entry for object %s [%s] at <%1.2f, %1.2f>\n", object.getNetworkId ().getValueString ().c_str (), object.getObjectTemplateName () ? object.getObjectTemplateName () : "null", position_w.x, position_w.z)); + DEBUG_REPORT_LOG (ms_logEntries, ("LotManager: added no build entry for object %s [%s] at <%1.2f, %1.2f>\n", object.getNetworkId ().getValueString ().c_str (), object.getObjectTemplateName () ? object.getObjectTemplateName () : "nullptr", position_w.x, position_w.z)); } //------------------------------------------------------------------- @@ -150,7 +150,7 @@ void LotManager::removeNoBuildEntry (const Object& object) else DEBUG_FATAL (true, ("LotManager::removeNoBuildEntry - entry not found")); - DEBUG_REPORT_LOG (ms_logEntries, ("LotManager: removed no build entry for object %s [%s]\n", object.getNetworkId ().getValueString ().c_str (), object.getObjectTemplateName () ? object.getObjectTemplateName () : "null")); + DEBUG_REPORT_LOG (ms_logEntries, ("LotManager: removed no build entry for object %s [%s]\n", object.getNetworkId ().getValueString ().c_str (), object.getObjectTemplateName () ? object.getObjectTemplateName () : "nullptr")); } //------------------------------------------------------------------- @@ -177,7 +177,7 @@ void LotManager::addStructureFootprintEntry (const Object& object, const Structu UNREF (result); DEBUG_FATAL (!result, ("LotManager::addStructureFootprintEntry - entry already exists")); - DEBUG_REPORT_LOG (ms_logEntries, ("LotManager: added structure footprint entry for object %s [%s] at <%1.2f, %1.2f>\n", object.getNetworkId ().getValueString ().c_str (), object.getObjectTemplateName () ? object.getObjectTemplateName () : "null", x * m_chunkWidthInMeters + m_chunkWidthInMeters * 0.5f, z * m_chunkWidthInMeters + m_chunkWidthInMeters * 0.5f)); + DEBUG_REPORT_LOG (ms_logEntries, ("LotManager: added structure footprint entry for object %s [%s] at <%1.2f, %1.2f>\n", object.getNetworkId ().getValueString ().c_str (), object.getObjectTemplateName () ? object.getObjectTemplateName () : "nullptr", x * m_chunkWidthInMeters + m_chunkWidthInMeters * 0.5f, z * m_chunkWidthInMeters + m_chunkWidthInMeters * 0.5f)); } //------------------------------------------------------------------- @@ -191,7 +191,7 @@ void LotManager::removeStructureFootprintEntry (const Object& object) else DEBUG_FATAL (true, ("LotManager::removeStructureFootprintEntry - entry not found")); - DEBUG_REPORT_LOG (ms_logEntries, ("LotManager: removed structure footprint entry for object %s [%s]\n", object.getNetworkId ().getValueString ().c_str (), object.getObjectTemplateName () ? object.getObjectTemplateName () : "null")); + DEBUG_REPORT_LOG (ms_logEntries, ("LotManager: removed structure footprint entry for object %s [%s]\n", object.getNetworkId ().getValueString ().c_str (), object.getObjectTemplateName () ? object.getObjectTemplateName () : "nullptr")); } //------------------------------------------------------------------- diff --git a/engine/shared/library/sharedObject/src/shared/object/AlterScheduler.cpp b/engine/shared/library/sharedObject/src/shared/object/AlterScheduler.cpp index e09b9c37..dc2a932c 100755 --- a/engine/shared/library/sharedObject/src/shared/object/AlterScheduler.cpp +++ b/engine/shared/library/sharedObject/src/shared/object/AlterScheduler.cpp @@ -277,13 +277,13 @@ void AlterSchedulerNamespace::reportPrint() // ---------------------------------------------------------------------- /** - * NULL objects are not considered valid by this function. Do not call this on a NULL + * nullptr objects are not considered valid by this function. Do not call this on a nullptr * object if that happens to be valid in the context in which this function is used. */ void AlterSchedulerNamespace::validateObject(Object const *object) { - FATAL(!object, ("validateObject(): alter scheduler found NULL object.")); + FATAL(!object, ("validateObject(): alter scheduler found nullptr object.")); DO_ON_VALIDATE_OBJECTS(bool isInvalid = false); @@ -331,7 +331,7 @@ void AlterSchedulerNamespace::validateObject(Object const *object) if (isInvalid) { //-- Print out object info for the invalid object if we have it. - ObjectInfo *objectInfo = NULL; + ObjectInfo *objectInfo = nullptr; if (s_trackObjectInfo) { ObjectInfoMap::iterator findIt = s_objectInfoMap.find(const_cast(object)); @@ -352,7 +352,7 @@ void AlterSchedulerNamespace::validateObject(Object const *object) // ---------------------------------------------------------------------- /** - * Return true if two strings are the same (or are both NULL); otherwise, return false. + * Return true if two strings are the same (or are both nullptr); otherwise, return false. */ static bool SafeStringEqual(char const *string1, char const *string2) @@ -682,7 +682,7 @@ void AlterScheduler::alter(float elapsedTime) DO_ON_DEBUG(if (s_suspendExecution) return); PROFILER_AUTO_BLOCK_DEFINE("AlterScheduler::alter"); - doAlterAndConcludeForAllObjects(elapsedTime, CS_none, NULL); + doAlterAndConcludeForAllObjects(elapsedTime, CS_none, nullptr); } // ---------------------------------------------------------------------- @@ -702,7 +702,7 @@ void AlterScheduler::alterAndConclude(float elapsedTime) DO_ON_DEBUG(if (s_suspendExecution) return); PROFILER_AUTO_BLOCK_DEFINE("AlterScheduler::alterAndConclude"); - doAlterAndConcludeForAllObjects(elapsedTime, CS_all, NULL); + doAlterAndConcludeForAllObjects(elapsedTime, CS_all, nullptr); } // ---------------------------------------------------------------------- @@ -724,7 +724,7 @@ void AlterScheduler::initializeScheduleTimeMapIterator(Object &object) bool AlterScheduler::isIteratorInScheduleTimeMap(void const *iterator) { - DEBUG_FATAL(!iterator, ("AlterScheduler::isIteratorInScheduleTimeMap(): iterator pointer is NULL.")); + DEBUG_FATAL(!iterator, ("AlterScheduler::isIteratorInScheduleTimeMap(): iterator pointer is nullptr.")); return (*static_cast(iterator) != s_scheduleMap.end()); } @@ -734,7 +734,7 @@ bool AlterScheduler::findObjectInAlterNowList(Object const *object) { DO_ON_HARDCORE_VALIDATION(validateAlterNowList()); - for (Object *searchObject = s_alterNowListFirst->getNextFromAlterNowList(); searchObject != NULL; searchObject = searchObject->getNextFromAlterNowList()) + for (Object *searchObject = s_alterNowListFirst->getNextFromAlterNowList(); searchObject != nullptr; searchObject = searchObject->getNextFromAlterNowList()) { if (searchObject == object) return true; @@ -751,7 +751,7 @@ bool AlterScheduler::findObjectInAlterNextFrameLists(Object const *object) for (int phaseIndex = 0; phaseIndex < AS_MAX_SCHEDULE_PHASE_COUNT; ++phaseIndex) { - for (Object *searchObject = s_alterNextFrameListFirst[phaseIndex]->getNextFromAlterNextFrameList(); searchObject != NULL; searchObject = searchObject->getNextFromAlterNextFrameList()) + for (Object *searchObject = s_alterNextFrameListFirst[phaseIndex]->getNextFromAlterNextFrameList(); searchObject != nullptr; searchObject = searchObject->getNextFromAlterNextFrameList()) { if (searchObject == object) return true; @@ -767,7 +767,7 @@ bool AlterScheduler::findObjectInConcludeList(Object const *object) { DO_ON_HARDCORE_VALIDATION(validateConcludeList()); - for (Object *searchObject = s_concludeListFirst->getNextFromConcludeList(); searchObject != NULL; searchObject = searchObject->getNextFromConcludeList()) + for (Object *searchObject = s_concludeListFirst->getNextFromConcludeList(); searchObject != nullptr; searchObject = searchObject->getNextFromConcludeList()) { if (searchObject == object) return true; @@ -817,7 +817,7 @@ void AlterScheduler::validateAlterNowList() //-- Add each object to the set and list. { - for (Object *object = s_alterNowListFirst->getNextFromAlterNowList(); object != NULL; object = object->getNextFromAlterNowList()) + for (Object *object = s_alterNowListFirst->getNextFromAlterNowList(); object != nullptr; object = object->getNextFromAlterNowList()) { DO_ON_VALIDATE_OBJECTS(validateObject(object)); @@ -836,7 +836,7 @@ void AlterScheduler::validateAlterNowList() { ObjectList::iterator const endIt = objectList.end(); Object *object = s_alterNowListFirst->getNextFromAlterNowList(); - for (ObjectList::iterator it = objectList.begin(); (it != endIt) && (object != NULL); object = object->getNextFromAlterNowList(), ++it) + for (ObjectList::iterator it = objectList.begin(); (it != endIt) && (object != nullptr); object = object->getNextFromAlterNowList(), ++it) { lastObject = object; DEBUG_WARNING(object != *it, ("validateAlterNowList(): forward linkage check failed, stl list: pointer=[%p], object id=[%s], object template=[%s].", *it, (*it)->getNetworkId().getValueString().c_str(), (*it)->getObjectTemplateName())); @@ -848,7 +848,7 @@ void AlterScheduler::validateAlterNowList() { ObjectList::reverse_iterator const endIt = objectList.rend(); Object *object = lastObject; - for (ObjectList::reverse_iterator it = objectList.rbegin(); (it != endIt) && (object != NULL); object = object->getPreviousFromAlterNowList(), ++it) + for (ObjectList::reverse_iterator it = objectList.rbegin(); (it != endIt) && (object != nullptr); object = object->getPreviousFromAlterNowList(), ++it) { DEBUG_WARNING(object != *it, ("validateAlterNowList(): reverse linkage check failed, stl list: pointer=[%p], object id=[%s], object template=[%s].", *it, (*it)->getNetworkId().getValueString().c_str(), (*it)->getObjectTemplateName())); DEBUG_FATAL(object != *it, ("validateAlterNowList(): reverse linkage check failed, alter scheduler list: pointer=[%p], object id=[%s], object template=[%s].", object, object->getNetworkId().getValueString().c_str(), object->getObjectTemplateName())); @@ -867,7 +867,7 @@ void AlterScheduler::validateAlterNextFrameLists() { //-- Add each object to the set and list. { - for (Object *object = s_alterNextFrameListFirst[phaseIndex]->getNextFromAlterNextFrameList(); object != NULL; object = object->getNextFromAlterNextFrameList()) + for (Object *object = s_alterNextFrameListFirst[phaseIndex]->getNextFromAlterNextFrameList(); object != nullptr; object = object->getNextFromAlterNextFrameList()) { DO_ON_VALIDATE_OBJECTS(validateObject(object)); @@ -886,7 +886,7 @@ void AlterScheduler::validateAlterNextFrameLists() { ObjectList::iterator const endIt = objectList.end(); Object *object = s_alterNextFrameListFirst[phaseIndex]->getNextFromAlterNextFrameList(); - for (ObjectList::iterator it = objectList.begin(); (it != endIt) && (object != NULL); object = object->getNextFromAlterNextFrameList(), ++it) + for (ObjectList::iterator it = objectList.begin(); (it != endIt) && (object != nullptr); object = object->getNextFromAlterNextFrameList(), ++it) { lastObject = object; DEBUG_WARNING(object != *it, ("validateAlterNextFrameList(): forward linkage check failed, stl list: pointer=[%p], object id=[%s], object template=[%s].", *it, (*it)->getNetworkId().getValueString().c_str(), (*it)->getObjectTemplateName())); @@ -898,7 +898,7 @@ void AlterScheduler::validateAlterNextFrameLists() { ObjectList::reverse_iterator const endIt = objectList.rend(); Object *object = lastObject; - for (ObjectList::reverse_iterator it = objectList.rbegin(); (it != endIt) && (object != NULL); object = object->getPreviousFromAlterNextFrameList(), ++it) + for (ObjectList::reverse_iterator it = objectList.rbegin(); (it != endIt) && (object != nullptr); object = object->getPreviousFromAlterNextFrameList(), ++it) { DEBUG_WARNING(object != *it, ("validateAlterNextFrameList(): reverse linkage check failed, stl list: pointer=[%p], object id=[%s], object template=[%s].", *it, (*it)->getNetworkId().getValueString().c_str(), (*it)->getObjectTemplateName())); DEBUG_FATAL(object != *it, ("validateAlterNextFrameList(): reverse linkage check failed, alter scheduler list: pointer=[%p], object id=[%s], object template=[%s].", object, object->getNetworkId().getValueString().c_str(), object->getObjectTemplateName())); @@ -919,7 +919,7 @@ void AlterScheduler::validateConcludeList() //-- Add each object to the set and list. { - for (Object *object = s_concludeListFirst->getNextFromConcludeList(); object != NULL; object = object->getNextFromConcludeList()) + for (Object *object = s_concludeListFirst->getNextFromConcludeList(); object != nullptr; object = object->getNextFromConcludeList()) { DO_ON_VALIDATE_OBJECTS(validateObject(object)); @@ -938,7 +938,7 @@ void AlterScheduler::validateConcludeList() { ObjectList::iterator const endIt = objectList.end(); Object *object = s_concludeListFirst->getNextFromConcludeList(); - for (ObjectList::iterator it = objectList.begin(); (it != endIt) && (object != NULL); object = object->getNextFromConcludeList(), ++it) + for (ObjectList::iterator it = objectList.begin(); (it != endIt) && (object != nullptr); object = object->getNextFromConcludeList(), ++it) { lastObject = object; DEBUG_WARNING(object != *it, ("validateConcludeList(): forward linkage check failed, stl list: pointer=[%p], object id=[%s], object template=[%s].", *it, (*it)->getNetworkId().getValueString().c_str(), (*it)->getObjectTemplateName())); @@ -950,7 +950,7 @@ void AlterScheduler::validateConcludeList() { ObjectList::reverse_iterator const endIt = objectList.rend(); Object *object = lastObject; - for (ObjectList::reverse_iterator it = objectList.rbegin(); (it != endIt) && (object != NULL); object = object->getPreviousFromConcludeList(), ++it) + for (ObjectList::reverse_iterator it = objectList.rbegin(); (it != endIt) && (object != nullptr); object = object->getPreviousFromConcludeList(), ++it) { DEBUG_WARNING(object != *it, ("validateConcludeList(): reverse linkage check failed, stl list: pointer=[%p], object id=[%s], object template=[%s].", *it, (*it)->getNetworkId().getValueString().c_str(), (*it)->getObjectTemplateName())); DEBUG_FATAL(object != *it, ("validateConcludeList(): reverse linkage check failed, alter scheduler list: pointer=[%p], object id=[%s], object template=[%s].", object, object->getNetworkId().getValueString().c_str(), object->getObjectTemplateName())); @@ -1184,8 +1184,8 @@ void AlterScheduler::moveObjectsFromAlterNextFrameListToAlterNowList(int schedul { PROFILER_AUTO_BLOCK_DEFINE("copy next frame"); - //if (s_alterNextFrameListFirst != NULL) { - for (Object *object = s_alterNextFrameListFirst[schedulePhaseIndex]->getNextFromAlterNextFrameList(); object != NULL; ) + //if (s_alterNextFrameListFirst != nullptr) { + for (Object *object = s_alterNextFrameListFirst[schedulePhaseIndex]->getNextFromAlterNextFrameList(); object != nullptr; ) { //-- Add object to alter now list. This removes the object from the alter next frame list. DO_ON_VALIDATE_OBJECTS(validateObject(object)); @@ -1222,7 +1222,7 @@ void AlterScheduler::alterSingleObject(Object *object, ConcludeStyle concludeSty DO_ON_DEBUG(s_currentlyAlteringObject = object); #if defined(_WIN32) && defined(_DEBUG) - char const * const typeName = s_profileAlterByType ? typeid(*object).name() : NULL; + char const * const typeName = s_profileAlterByType ? typeid(*object).name() : nullptr; PROFILER_BLOCK_DEFINE(profilerBlock, typeName); if (typeName) PROFILER_BLOCK_ENTER(profilerBlock); @@ -1245,7 +1245,7 @@ void AlterScheduler::alterSingleObject(Object *object, ConcludeStyle concludeSty PROFILER_BLOCK_LEAVE(profilerBlock); #endif - DO_ON_DEBUG(s_currentlyAlteringObject = NULL); + DO_ON_DEBUG(s_currentlyAlteringObject = nullptr); DO_ON_VALIDATE_OBJECTS(validateObject(object)); } @@ -1254,7 +1254,7 @@ void AlterScheduler::alterSingleObject(Object *object, ConcludeStyle concludeSty nextObject = object->getNextFromAlterNowList(); #if VALIDATE_OBJECTS - if (nextObject != NULL) + if (nextObject != nullptr) { DO_ON_HARDCORE_VALIDATION(DEBUG_FATAL(!findObjectInAlterNowList(nextObject), ("didn't find object in alter now list, unexpected."))); validateObject(nextObject); @@ -1343,7 +1343,7 @@ void AlterScheduler::alterSingleObject(Object *object, ConcludeStyle concludeSty ScheduleTime const absoluteScheduleTime = s_currentTime + dt; // Add it to the schedule list for the specified scheduler time. - // If this object is NULL, it means it returned an AlterResult that indicated it should still be alive but it somehow got killed. + // If this object is nullptr, it means it returned an AlterResult that indicated it should still be alive but it somehow got killed. //DEBUG_REPORT_LOG(object->getNetworkId() != NetworkId::cms_invalid, ("[aitest] scheduling %s to alter at %lu (%lu + %lu)\n", // object->getNetworkId().getValueString().c_str(), // static_cast(absoluteScheduleTime), @@ -1363,7 +1363,7 @@ void AlterScheduler::concludeAndRemoveAllConcludeEntries() PROFILER_AUTO_BLOCK_DEFINE("conclude"); Object *nextObject; - for (Object *object = s_concludeListFirst->getNextFromConcludeList(); object != NULL; object = nextObject) + for (Object *object = s_concludeListFirst->getNextFromConcludeList(); object != nullptr; object = nextObject) { //-- Conclude the object. DO_ON_VALIDATE_OBJECTS(validateObject(object)); @@ -1400,7 +1400,7 @@ void AlterScheduler::doAlterAndConcludeForAllObjects(float schedulerElapsedTime, DO_ON_HARDCORE_VALIDATION(validateAllContainers()); Object *nextObject; - for (Object *object = s_alterNowListFirst->getNextFromAlterNowList(); object != NULL; object = nextObject) + for (Object *object = s_alterNowListFirst->getNextFromAlterNowList(); object != nullptr; object = nextObject) alterSingleObject(object, concludeStyle, nextObject); } diff --git a/engine/shared/library/sharedObject/src/shared/object/CachedNetworkId.cpp b/engine/shared/library/sharedObject/src/shared/object/CachedNetworkId.cpp index 47c87004..ea766f6e 100755 --- a/engine/shared/library/sharedObject/src/shared/object/CachedNetworkId.cpp +++ b/engine/shared/library/sharedObject/src/shared/object/CachedNetworkId.cpp @@ -32,7 +32,7 @@ void CachedNetworkId::checkValidity() const CachedNetworkId::CachedNetworkId() : m_id(cms_invalid), -m_object(NULL) +m_object(nullptr) { } @@ -40,7 +40,7 @@ m_object(NULL) CachedNetworkId::CachedNetworkId(const NetworkId& id) : m_id(id), -m_object(NULL) +m_object(nullptr) { } @@ -48,7 +48,7 @@ m_object(NULL) CachedNetworkId::CachedNetworkId(NetworkId::NetworkIdType value) : m_id(value), -m_object(NULL) +m_object(nullptr) { } @@ -66,7 +66,7 @@ m_object(const_cast(&object)) CachedNetworkId::CachedNetworkId(const std::string &value) : m_id(value), -m_object(NULL) +m_object(nullptr) { } @@ -98,7 +98,7 @@ CachedNetworkId& CachedNetworkId::operator= (const CachedNetworkId& rhs) CachedNetworkId& CachedNetworkId::operator= (const NetworkId& rhs) { m_id = rhs; - m_object = NULL; + m_object = nullptr; return *this; } // ---------------------------------------------------------- @@ -178,7 +178,7 @@ Object* CachedNetworkId::getObject() const return m_object; } - return NULL; + return nullptr; } // ---------------------------------------------------------- diff --git a/engine/shared/library/sharedObject/src/shared/object/Object.cpp b/engine/shared/library/sharedObject/src/shared/object/Object.cpp index 73273e36..2cad0571 100755 --- a/engine/shared/library/sharedObject/src/shared/object/Object.cpp +++ b/engine/shared/library/sharedObject/src/shared/object/Object.cpp @@ -515,7 +515,7 @@ void ObjectNamespace::remove() #endif delete ms_transformMemoryBlockManager; - ms_transformMemoryBlockManager = NULL; + ms_transformMemoryBlockManager = nullptr; DEBUG_WARNING(static_cast(ms_freeDpvsObjectsList.size()) != ms_allocatedDpvsObjects, ("Leaked %d DpvsObjects lists", ms_allocatedDpvsObjects - static_cast(ms_freeDpvsObjectsList.size()))); while (!ms_systemAllocatedDpvsObjectsList.empty()) @@ -570,11 +570,11 @@ void ObjectNamespace::validatePosition(Object const & object, Vector const & pos object.getNetworkId().getValueString().c_str(), object.getObjectTemplateName(), &object, - object.getAppearance() ? object.getAppearance()->getAppearanceTemplateName() : NULL, - parent ? parent->getNetworkId().getValueString().c_str() : NULL, - parent ? parent->getObjectTemplateName() : NULL, - parent ? parent : NULL, - parent && parent->getAppearance() ? parent->getAppearance()->getAppearanceTemplateName() : NULL)); + object.getAppearance() ? object.getAppearance()->getAppearanceTemplateName() : nullptr, + parent ? parent->getNetworkId().getValueString().c_str() : nullptr, + parent ? parent->getObjectTemplateName() : nullptr, + parent ? parent : nullptr, + parent && parent->getAppearance() ? parent->getAppearance()->getAppearanceTemplateName() : nullptr)); } } @@ -703,30 +703,30 @@ Object::Object(): #if OBJECT_SUPPORTS_IS_ALTERING_FLAG m_isAltering(false), #endif - m_objectTemplate(NULL), + m_objectTemplate(nullptr), m_notificationList(NotificationListManager::getEmptyNotificationList()), - m_debugName(NULL), + m_debugName(nullptr), m_networkId(NetworkId::cms_invalid), - m_appearance(NULL), - m_controller(NULL), - m_dynamics(NULL), - m_attachedToObject(NULL), - m_attachedObjects(NULL), - m_dpvsObjects(NULL), + m_appearance(nullptr), + m_controller(nullptr), + m_dynamics(nullptr), + m_attachedToObject(nullptr), + m_attachedObjects(nullptr), + m_dpvsObjects(nullptr), m_rotations(0), m_scale(Vector::xyz111), m_objectToParent(), - m_objectToWorld(NULL), + m_objectToWorld(nullptr), m_watchedByList(), - m_containerProperty(NULL), - m_collisionProperty(NULL), + m_containerProperty(nullptr), + m_collisionProperty(nullptr), m_spatialSubdivisionHandle (0), m_useAlterScheduler(true), - m_scheduleData(NULL), + m_scheduleData(nullptr), m_shouldBakeIntoMesh(true), - m_defaultAppearance(NULL), - m_alternateAppearance(NULL), - m_containedBy(NULL) + m_defaultAppearance(nullptr), + m_alternateAppearance(nullptr), + m_containedBy(nullptr) { m_defaultAppearance = m_appearance; } @@ -752,25 +752,25 @@ Object::Object(const ObjectTemplate *objectTemplate, const NetworkId &networkId) m_debugName(0), m_networkId(networkId), m_appearance(0), - m_controller(NULL), - m_dynamics(NULL), - m_attachedToObject(NULL), - m_attachedObjects(NULL), - m_dpvsObjects(NULL), + m_controller(nullptr), + m_dynamics(nullptr), + m_attachedToObject(nullptr), + m_attachedObjects(nullptr), + m_dpvsObjects(nullptr), m_rotations(0), m_scale(Vector::xyz111), m_objectToParent(), - m_objectToWorld(NULL), + m_objectToWorld(nullptr), m_watchedByList(), - m_containerProperty(NULL), - m_collisionProperty(NULL), + m_containerProperty(nullptr), + m_collisionProperty(nullptr), m_spatialSubdivisionHandle (0), m_useAlterScheduler(true), - m_scheduleData(NULL), + m_scheduleData(nullptr), m_shouldBakeIntoMesh(true), - m_defaultAppearance(NULL), - m_alternateAppearance(NULL), - m_containedBy(NULL) + m_defaultAppearance(nullptr), + m_alternateAppearance(nullptr), + m_containedBy(nullptr) { objectTemplate->addReference(); NetworkIdManager::addObject(*this); @@ -799,25 +799,25 @@ Object::Object(const ObjectTemplate *objectTemplate, InitializeFlag): m_debugName(0), m_networkId(NetworkId::cms_invalid), m_appearance(0), - m_controller(NULL), - m_dynamics(NULL), - m_attachedToObject(NULL), - m_attachedObjects(NULL), - m_dpvsObjects(NULL), + m_controller(nullptr), + m_dynamics(nullptr), + m_attachedToObject(nullptr), + m_attachedObjects(nullptr), + m_dpvsObjects(nullptr), m_rotations(0), m_scale(Vector::xyz111), m_objectToParent(), - m_objectToWorld(NULL), + m_objectToWorld(nullptr), m_watchedByList(), - m_containerProperty(NULL), - m_collisionProperty(NULL), + m_containerProperty(nullptr), + m_collisionProperty(nullptr), m_spatialSubdivisionHandle (0), m_useAlterScheduler(true), - m_scheduleData(NULL), + m_scheduleData(nullptr), m_shouldBakeIntoMesh(true), - m_defaultAppearance(NULL), - m_alternateAppearance(NULL), - m_containedBy(NULL) + m_defaultAppearance(nullptr), + m_alternateAppearance(nullptr), + m_containedBy(nullptr) { objectTemplate->addReference(); NetworkIdManager::addObject(*this); @@ -836,7 +836,7 @@ Object::~Object(void) IGNORE_RETURN(snprintf(ms_crashReportInfo, sizeof(ms_crashReportInfo) - 1, "~Object: name=[%s] template=[%s]\n", getDebugName(), getObjectTemplateName())); ms_crashReportInfo[sizeof(ms_crashReportInfo) - 1] = '\0'; - DEBUG_REPORT_LOG(ms_logObjectDelete, ("Deleting object id=[%s], template=[%s], pointer=[%p], appearance=[%s], parent id=[%s], template=[%s], pointer=[%p], appearance=[%s]\n", getNetworkId().getValueString().c_str(), getObjectTemplateName(), this, getAppearance() ? getAppearance()->getAppearanceTemplateName() : NULL, m_attachedToObject ? m_attachedToObject->getNetworkId().getValueString().c_str() : NULL, m_attachedToObject ? m_attachedToObject->getObjectTemplateName() : NULL, m_attachedToObject ? m_attachedToObject : NULL, m_attachedToObject && m_attachedToObject->getAppearance() ? m_attachedToObject->getAppearance()->getAppearanceTemplateName() : NULL)); + DEBUG_REPORT_LOG(ms_logObjectDelete, ("Deleting object id=[%s], template=[%s], pointer=[%p], appearance=[%s], parent id=[%s], template=[%s], pointer=[%p], appearance=[%s]\n", getNetworkId().getValueString().c_str(), getObjectTemplateName(), this, getAppearance() ? getAppearance()->getAppearanceTemplateName() : nullptr, m_attachedToObject ? m_attachedToObject->getNetworkId().getValueString().c_str() : nullptr, m_attachedToObject ? m_attachedToObject->getObjectTemplateName() : nullptr, m_attachedToObject ? m_attachedToObject : nullptr, m_attachedToObject && m_attachedToObject->getAppearance() ? m_attachedToObject->getAppearance()->getAppearanceTemplateName() : nullptr)); FATAL(ConfigSharedObject::getAllowDisallowObjectDelete() && ms_disallowObjectDelete, ("Object id=[%s], template=[%s], pointer=[%p] is deleting itself when delete is not allowed", getNetworkId().getValueString().c_str(), getObjectTemplateName(), this)); #if OBJECT_SUPPORTS_IS_ALTERING_FLAG @@ -905,7 +905,7 @@ Object::~Object(void) } deleteAttachedObjects(m_attachedObjects); - m_attachedObjects = NULL; + m_attachedObjects = nullptr; } if (m_objectToWorld) @@ -914,9 +914,9 @@ Object::~Object(void) m_objectToWorld = 0; } - if (m_objectTemplate != NULL) + if (m_objectTemplate != nullptr) m_objectTemplate->releaseReference(); - m_objectTemplate = NULL; + m_objectTemplate = nullptr; m_notificationList = 0; @@ -1139,7 +1139,7 @@ void Object::removeFromWorld() { if (attached->isInWorld()) { - DEBUG_WARNING(true, ("Removing an object [id=%s template=%s] from the world with non-child attached objects [id=%s ptr=0x%08x template=%s name=%s]", getNetworkId ().getValueString ().c_str (), getObjectTemplateName () ? getObjectTemplateName () : "null", attached->getNetworkId ().getValueString ().c_str (), attached, attached->getObjectTemplateName () ? attached->getObjectTemplateName () : "null", attached->getDebugName())); + DEBUG_WARNING(true, ("Removing an object [id=%s template=%s] from the world with non-child attached objects [id=%s ptr=0x%08x template=%s name=%s]", getNetworkId ().getValueString ().c_str (), getObjectTemplateName () ? getObjectTemplateName () : "nullptr", attached->getNetworkId ().getValueString ().c_str (), attached, attached->getObjectTemplateName () ? attached->getObjectTemplateName () : "nullptr", attached->getDebugName())); attached->detachFromObject(DF_parent); } } @@ -1369,7 +1369,7 @@ bool Object::isInWorldCell() const CellProperty *Object::getParentCell() const { - Property *cell = NULL; + Property *cell = nullptr; for (Object *o = const_cast(getAttachedTo()); o && !cell; o = o->getAttachedTo()) cell = o->getCellProperty(); @@ -1580,7 +1580,7 @@ void Object::setAppearance(Appearance *newAppearance) * Steal the Appearance from this object. * * This routine will return the current appearance of this object, and - * then reset its appearance to NULL. + * then reset its appearance to nullptr. * * @return The current appearance of this object */ @@ -1590,18 +1590,18 @@ Appearance *Object::stealAppearance(void) Appearance *oldAppearance = m_appearance; if(m_appearance == m_defaultAppearance) - m_defaultAppearance = NULL; + m_defaultAppearance = nullptr; else if (m_appearance == m_alternateAppearance) - m_alternateAppearance = NULL; + m_alternateAppearance = nullptr; - m_appearance = NULL; + m_appearance = nullptr; if (oldAppearance) { if (isInWorld()) oldAppearance->removeFromWorld(); - oldAppearance->setOwner(NULL); + oldAppearance->setOwner(nullptr); } return oldAppearance; @@ -1999,7 +1999,7 @@ void Object::detachFromObject(DetachFlags const detachFlags) bool const shouldAttach = (!toParentCell || noCell) ? false : m_attachedToObject != &cellProperty->getOwner(); m_objectToParent = shouldAttach ? getTransform_o2c() : getTransform_o2w(); deleteLocalTransform(m_objectToWorld); - m_objectToWorld = NULL; + m_objectToWorld = nullptr; setObjectToWorldDirty(true); // remove from the attached objects list @@ -2010,7 +2010,7 @@ void Object::detachFromObject(DetachFlags const detachFlags) attachedObjects->pop_back(); // set as unattached - m_attachedToObject = NULL; + m_attachedToObject = nullptr; bool const wasChildObject = isChildObject(); bool const wasInWorld = isInWorld(); @@ -2102,7 +2102,7 @@ void Object::removeChildObject(Object * childObjectToRemove, DetachFlags detachF Object *Object::getRootParent(void) { - DEBUG_FATAL(m_childObject && m_attachedToObject == NULL, ("am a child but attached to is NULL")); + DEBUG_FATAL(m_childObject && m_attachedToObject == nullptr, ("am a child but attached to is nullptr")); return m_childObject ? NON_NULL(m_attachedToObject)->getRootParent() : this; } @@ -2116,7 +2116,7 @@ Object *Object::getRootParent(void) const Object *Object::getRootParent(void) const { - DEBUG_FATAL(m_childObject && m_attachedToObject == NULL, ("am a child but attached to is NULL")); + DEBUG_FATAL(m_childObject && m_attachedToObject == nullptr, ("am a child but attached to is nullptr")); return m_childObject ? NON_NULL(m_attachedToObject)->getRootParent() : this; } @@ -2231,7 +2231,7 @@ void Object::setRecursiveScale(Vector const & scale) Controller* Object::stealController(void) { Controller* returnValue = m_controller; - m_controller = NULL; + m_controller = nullptr; return returnValue; } @@ -2362,7 +2362,7 @@ Property const *Object::getProperty(PropertyId const &id) const if ((*i)->getPropertyId() == id) return *i; - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -2376,7 +2376,7 @@ Property *Object::getProperty(PropertyId const &id) if ((*i)->getPropertyId() == id) return *i; - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -2399,13 +2399,13 @@ void Object::removeProperty(PropertyId const &id) } if (id == CellProperty::getClassPropertyId() || id == PortalProperty::getClassPropertyId() || id == SlottedContainer::getClassPropertyId() || id == VolumeContainer::getClassPropertyId()) - m_containerProperty = NULL; + m_containerProperty = nullptr; else if (id == ContainedByProperty::getClassPropertyId()) - m_containedBy = NULL; + m_containedBy = nullptr; else if (id == CollisionProperty::getClassPropertyId()) - m_collisionProperty = NULL; + m_collisionProperty = nullptr; } // ---------------------------------------------------------------------- @@ -2453,7 +2453,7 @@ void Object::lookAt_o (const Vector &position_o, const Vector &j_o) void Object::setAppearanceByName(char const *path) { - if (path != NULL) + if (path != nullptr) { if (TreeFile::exists(path)) { @@ -2461,7 +2461,7 @@ void Object::setAppearanceByName(char const *path) Appearance *appearance = AppearanceTemplateList::createAppearance(path); - if (appearance != NULL) + if (appearance != nullptr) { setAppearance(appearance); } else { @@ -2475,7 +2475,7 @@ void Object::setAppearanceByName(char const *path) } else { - DEBUG_WARNING(true, ("Object::setAppearanceByName() - NULL appearance path specified for object: %s", (getObjectTemplateName() == NULL) ? "" : getObjectTemplateName())); + DEBUG_WARNING(true, ("Object::setAppearanceByName() - nullptr appearance path specified for object: %s", (getObjectTemplateName() == nullptr) ? "" : getObjectTemplateName())); } } @@ -2539,7 +2539,7 @@ SlottedContainer * Object::getSlottedContainerProperty() Container *container = getContainerProperty(); if (container && container->getPropertyId() == SlottedContainer::getClassPropertyId()) return safe_cast(container); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -2549,7 +2549,7 @@ SlottedContainer const * Object::getSlottedContainerProperty() const Container const *container = getContainerProperty(); if (container && container->getPropertyId() == SlottedContainer::getClassPropertyId()) return safe_cast(container); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -2559,7 +2559,7 @@ VolumeContainer * Object::getVolumeContainerProperty() Container *container = getContainerProperty(); if (container && container->getPropertyId() == VolumeContainer::getClassPropertyId()) return safe_cast(container); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -2569,7 +2569,7 @@ VolumeContainer const * Object::getVolumeContainerProperty() const Container const *container = getContainerProperty(); if (container && container->getPropertyId() == VolumeContainer::getClassPropertyId()) return safe_cast(container); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -2579,7 +2579,7 @@ CellProperty * Object::getCellProperty() Container *container = getContainerProperty(); if (container && container->getPropertyId() == CellProperty::getClassPropertyId()) return safe_cast(container); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -2589,7 +2589,7 @@ CellProperty const * Object::getCellProperty() const Container const *container = getContainerProperty(); if (container && container->getPropertyId() == CellProperty::getClassPropertyId()) return safe_cast(container); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -2599,7 +2599,7 @@ PortalProperty * Object::getPortalProperty() Container *container = getContainerProperty(); if (container && container->getPropertyId() == PortalProperty::getClassPropertyId()) return safe_cast(container); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -2609,7 +2609,7 @@ PortalProperty const * Object::getPortalProperty() const Container const *container = getContainerProperty(); if (container && container->getPropertyId() == PortalProperty::getClassPropertyId()) return safe_cast(container); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -2658,7 +2658,7 @@ ServerObject const * Object::asServerObject() const bool Object::hasScheduleData() const { - return (m_scheduleData != NULL); + return (m_scheduleData != nullptr); } // ---------------------------------------------------------------------- @@ -2697,7 +2697,7 @@ void Object::setMostRecentAlterTime(ScheduleTime mostRecentAlterTime) bool Object::isInAlterNextFrameList() const { - return (m_scheduleData == NULL) ? false : (m_scheduleData->getAlterNextFrameNext() != NULL) || (m_scheduleData->getAlterNextFramePrevious() != NULL); + return (m_scheduleData == nullptr) ? false : (m_scheduleData->getAlterNextFrameNext() != nullptr) || (m_scheduleData->getAlterNextFramePrevious() != nullptr); } // ---------------------------------------------------------------------- @@ -2708,7 +2708,7 @@ void Object::insertIntoAlterNextFrameList(Object *afterThisObject) DEBUG_FATAL(isInAlterNextFrameList(), ("insertIntoAlterNextFrameList(): object id=[%s],template=[%s] already in AlterNextFrame list.", getNetworkId().getValueString().c_str(), getObjectTemplateName())); NOT_NULL(afterThisObject); NOT_NULL(afterThisObject->m_scheduleData); - DEBUG_FATAL(afterThisObject->m_scheduleData->getAlterNextFrameNext() && !afterThisObject->m_scheduleData->getAlterNextFrameNext()->m_scheduleData, ("Non-NULL forward link does not have schedule data.")); + DEBUG_FATAL(afterThisObject->m_scheduleData->getAlterNextFrameNext() && !afterThisObject->m_scheduleData->getAlterNextFrameNext()->m_scheduleData, ("Non-nullptr forward link does not have schedule data.")); DEBUG_FATAL(afterThisObject->m_scheduleData->getAlterNextFrameNext() && (afterThisObject->m_scheduleData->getAlterNextFrameNext()->m_scheduleData->getAlterNextFramePrevious() != afterThisObject), ("List corruption: alter next frame.")); //-- Get new next and previous object for the list. @@ -2745,13 +2745,13 @@ void Object::removeFromAlterNextFrameList() DEBUG_FATAL(newNext && !newNext->m_scheduleData, ("Next node missing schedule data.")); //-- Handle previous. - m_scheduleData->setAlterNextFramePrevious(NULL); + m_scheduleData->setAlterNextFramePrevious(nullptr); if (newPrevious) newPrevious->m_scheduleData->setAlterNextFrameNext(newNext); //-- Handle next. - m_scheduleData->setAlterNextFrameNext(NULL); + m_scheduleData->setAlterNextFrameNext(nullptr); if (newNext) newNext->m_scheduleData->setAlterNextFramePrevious(newPrevious); @@ -2766,7 +2766,7 @@ void Object::removeFromAlterNextFrameList() int Object::getAlterSchedulePhase() const { - DEBUG_FATAL(m_scheduleData == NULL, ("calling Object::getAlterSchedulePhase() when Object has no schedule data: id=[%s], template=[%s]", getNetworkId().getValueString().c_str(), getObjectTemplateName())); + DEBUG_FATAL(m_scheduleData == nullptr, ("calling Object::getAlterSchedulePhase() when Object has no schedule data: id=[%s], template=[%s]", getNetworkId().getValueString().c_str(), getObjectTemplateName())); return m_scheduleData->getSchedulePhase(); } @@ -2774,7 +2774,7 @@ int Object::getAlterSchedulePhase() const void Object::setAlterSchedulePhase(int schedulePhaseIndex) { - DEBUG_FATAL(m_scheduleData == NULL, ("calling Object::setAlterSchedulePhase() when Object has no schedule data: id=[%s], template=[%s]", getNetworkId().getValueString().c_str(), getObjectTemplateName())); + DEBUG_FATAL(m_scheduleData == nullptr, ("calling Object::setAlterSchedulePhase() when Object has no schedule data: id=[%s], template=[%s]", getNetworkId().getValueString().c_str(), getObjectTemplateName())); m_scheduleData->setSchedulePhase(schedulePhaseIndex); } @@ -2782,7 +2782,7 @@ void Object::setAlterSchedulePhase(int schedulePhaseIndex) bool Object::isInAlterNowList() const { - return (m_scheduleData == NULL) ? false : (m_scheduleData->getAlterNowNext() != NULL) || (m_scheduleData->getAlterNowPrevious() != NULL); + return (m_scheduleData == nullptr) ? false : (m_scheduleData->getAlterNowNext() != nullptr) || (m_scheduleData->getAlterNowPrevious() != nullptr); } // ---------------------------------------------------------------------- @@ -2793,7 +2793,7 @@ void Object::insertIntoAlterNowList(Object *afterThisObject) DEBUG_FATAL(isInAlterNowList(), ("insertIntoAlterNowList(): object id=[%s],template=[%s] already in AlterNow list.", getNetworkId().getValueString().c_str(), getObjectTemplateName())); NOT_NULL(afterThisObject); NOT_NULL(afterThisObject->m_scheduleData); - DEBUG_FATAL(afterThisObject->m_scheduleData->getAlterNowNext() && !afterThisObject->m_scheduleData->getAlterNowNext()->m_scheduleData, ("Non-NULL forward link does not have schedule data.")); + DEBUG_FATAL(afterThisObject->m_scheduleData->getAlterNowNext() && !afterThisObject->m_scheduleData->getAlterNowNext()->m_scheduleData, ("Non-nullptr forward link does not have schedule data.")); DEBUG_FATAL(afterThisObject->m_scheduleData->getAlterNowNext() && (afterThisObject->m_scheduleData->getAlterNowNext()->m_scheduleData->getAlterNowPrevious() != afterThisObject), ("List corruption: alter now.")); //-- Get new next and previous object for the list. @@ -2830,12 +2830,12 @@ void Object::removeFromAlterNowList() DEBUG_FATAL(newNext && !newNext->m_scheduleData, ("Next node missing schedule data.")); //-- Handle previous. - m_scheduleData->setAlterNowPrevious(NULL); + m_scheduleData->setAlterNowPrevious(nullptr); if (newPrevious) newPrevious->m_scheduleData->setAlterNowNext(newNext); //-- Handle next. - m_scheduleData->setAlterNowNext(NULL); + m_scheduleData->setAlterNowNext(nullptr); if (newNext) newNext->m_scheduleData->setAlterNowPrevious(newPrevious); @@ -2849,7 +2849,7 @@ void Object::removeFromAlterNowList() bool Object::isInConcludeList() const { - return (m_scheduleData == NULL) ? false : (m_scheduleData->getConcludeNext() != NULL) || (m_scheduleData->getConcludePrevious() != NULL); + return (m_scheduleData == nullptr) ? false : (m_scheduleData->getConcludeNext() != nullptr) || (m_scheduleData->getConcludePrevious() != nullptr); } // ---------------------------------------------------------------------- @@ -2860,7 +2860,7 @@ void Object::insertIntoConcludeList(Object *afterThisObject) DEBUG_FATAL(isInConcludeList(), ("insertIntoConcludeList(): object id=[%s],template=[%s] already in Conclude list.", getNetworkId().getValueString().c_str(), getObjectTemplateName())); NOT_NULL(afterThisObject); NOT_NULL(afterThisObject->m_scheduleData); - DEBUG_FATAL(afterThisObject->m_scheduleData->getConcludeNext() && !afterThisObject->m_scheduleData->getConcludeNext()->m_scheduleData, ("Non-NULL forward link does not have schedule data.")); + DEBUG_FATAL(afterThisObject->m_scheduleData->getConcludeNext() && !afterThisObject->m_scheduleData->getConcludeNext()->m_scheduleData, ("Non-nullptr forward link does not have schedule data.")); DEBUG_FATAL(afterThisObject->m_scheduleData->getConcludeNext() && (afterThisObject->m_scheduleData->getConcludeNext()->m_scheduleData->getConcludePrevious() != afterThisObject), ("List corruption: alter now.")); //-- Get new next and previous object for the list. @@ -2897,12 +2897,12 @@ void Object::removeFromConcludeList() DEBUG_FATAL(newNext && !newNext->m_scheduleData, ("Next node missing schedule data.")); //-- Handle previous. - m_scheduleData->setConcludePrevious(NULL); + m_scheduleData->setConcludePrevious(nullptr); if (newPrevious) newPrevious->m_scheduleData->setConcludeNext(newNext); //-- Handle next. - m_scheduleData->setConcludeNext(NULL); + m_scheduleData->setConcludeNext(nullptr); if (newNext) newNext->m_scheduleData->setConcludePrevious(newPrevious); @@ -3015,7 +3015,7 @@ void Object::scheduleForAlter_scheduleTopmostWorldParent() do { //-- Traverse parent links until there is no more parent. - for (Object *parentObject = alterObject->getParent(); parentObject != NULL; parentObject = alterObject->getParent()) + for (Object *parentObject = alterObject->getParent(); parentObject != nullptr; parentObject = alterObject->getParent()) alterObject = parentObject; //-- Traverse container until we're at a container object that is in the world. @@ -3035,7 +3035,7 @@ void Object::scheduleForAlter_scheduleTopmostWorldParent() if (alterObject->isInWorld()) { // We're done searching. - containedByProperty = NULL; + containedByProperty = nullptr; } else { @@ -3052,7 +3052,7 @@ void Object::scheduleForAlter_scheduleTopmostWorldParent() // New container might be a child object, make sure we test for a parent again. // If a parent exists, we need to run through the loop again to find the parent object. - } while (alterObject->getParent() != NULL); + } while (alterObject->getParent() != nullptr); NOT_NULL(alterObject); if (alterObject->isInitialized()) @@ -3270,13 +3270,13 @@ void Object::setAlternateAppearance(const char * path) if(!path) return; - Appearance *alternateAppearance = NULL; + Appearance *alternateAppearance = nullptr; if (TreeFile::exists(path)) { alternateAppearance = AppearanceTemplateList::createAppearance(path); - if (alternateAppearance == NULL) { + if (alternateAppearance == nullptr) { DEBUG_WARNING(true, ("Object::setAlternateAppearance() - Unable to change the object's appearance because the file does not exist: %s", path)); return; } @@ -3313,7 +3313,7 @@ void Object::setAlternateAppearance(const char * path) delete m_alternateAppearance; - m_alternateAppearance = NULL; + m_alternateAppearance = nullptr; } else { diff --git a/engine/shared/library/sharedObject/src/shared/object/Object.h b/engine/shared/library/sharedObject/src/shared/object/Object.h index 7ac8cfe1..9059b52d 100755 --- a/engine/shared/library/sharedObject/src/shared/object/Object.h +++ b/engine/shared/library/sharedObject/src/shared/object/Object.h @@ -495,7 +495,7 @@ inline const ObjectTemplate *Object::getObjectTemplate() const // // Remarks: // -// This return may return NULL. +// This return may return nullptr. inline const char *Object::getDebugName() const { @@ -518,7 +518,7 @@ inline const Vector &Object::getScale() const /** * Get the controller for an object. * - * The return value may be NULL. + * The return value may be nullptr. * * @return Const pointer to the controller */ @@ -532,7 +532,7 @@ inline const Controller *Object::getController() const /** * Get the controller for an object. * - * The return value may be NULL. + * The return value may be nullptr. * * @return Non-const pointer to the controller */ @@ -546,7 +546,7 @@ inline Controller *Object::getController() /** * Get the dynamics for an object. * - * The return value may be NULL. + * The return value may be nullptr. * * @return Const pointer to the dynamics */ @@ -560,7 +560,7 @@ inline const Dynamics *Object::getDynamics() const /** * Get the dynamics for an object. * - * The return value may be NULL. + * The return value may be nullptr. * * @return Non-const pointer to the dynamics */ @@ -598,24 +598,24 @@ inline Appearance *Object::getAppearance() /** * Get the parent object for this object. * - * This routine will return NULL if the object is not a child object. + * This routine will return nullptr if the object is not a child object. */ inline Object *Object::getParent() { - return m_childObject ? m_attachedToObject : NULL; + return m_childObject ? m_attachedToObject : nullptr; } // ---------------------------------------------------------------------- /** * Get the parent object for this object. * - * This routine will return NULL if the object is not a child object. + * This routine will return nullptr if the object is not a child object. */ inline const Object *Object::getParent() const { - return m_childObject ? m_attachedToObject : NULL; + return m_childObject ? m_attachedToObject : nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedObject/src/shared/object/ObjectList.cpp b/engine/shared/library/sharedObject/src/shared/object/ObjectList.cpp index 9e72d27d..e74133f8 100755 --- a/engine/shared/library/sharedObject/src/shared/object/ObjectList.cpp +++ b/engine/shared/library/sharedObject/src/shared/object/ObjectList.cpp @@ -63,7 +63,7 @@ ObjectList::~ObjectList() /** * Add an Object to the ObjectList. * - * This routine will call Fatal in debug compiles if it is passed a NULL + * This routine will call Fatal in debug compiles if it is passed a nullptr * object. * * This routine will call Fatal in debug compiles if the object list @@ -85,7 +85,7 @@ void ObjectList::addObject(Object *objectToAdd) /** * Remove an Object from the ObjectList. * - * This routine will call Fatal in debug compiles if it is passed a NULL + * This routine will call Fatal in debug compiles if it is passed a nullptr * object. * * @param objectToRemove Pointer to the object to remove @@ -113,13 +113,13 @@ void ObjectList::removeObjectByIndex(const Object* object, int index) // Remove the last item in the vector. m_objectVector->pop_back(); - // NULL the object from the alter-safe object list. + // nullptr the object from the alter-safe object list. uint size = m_alterSafeObjectVector->size(); for (uint i = 0; i < size; ++i) { if ((*m_alterSafeObjectVector)[i] == object) { - (*m_alterSafeObjectVector)[i] = NULL; + (*m_alterSafeObjectVector)[i] = nullptr; return; } } @@ -224,7 +224,7 @@ float ObjectList::alter(real time) if (alterResult == AlterResult::cms_kill) //lint !e777 // Testing floats for equality // It's okay, we're using constants. { // Make sure the object is still in the object list before removing it - if ((*m_alterSafeObjectVector)[i] != NULL) + if ((*m_alterSafeObjectVector)[i] != nullptr) removeObject(obj); delete obj; } diff --git a/engine/shared/library/sharedObject/src/shared/object/ObjectTemplate.cpp b/engine/shared/library/sharedObject/src/shared/object/ObjectTemplate.cpp index 5729afef..789b5d12 100755 --- a/engine/shared/library/sharedObject/src/shared/object/ObjectTemplate.cpp +++ b/engine/shared/library/sharedObject/src/shared/object/ObjectTemplate.cpp @@ -66,7 +66,7 @@ ObjectTemplate::ObjectTemplate(const std::string & filename) : { //-- Track name of most recently loading object template name to give us more // data to work with when we receive crash info. - IGNORE_RETURN(snprintf(s_crashReportInfoConstructor, sizeof(s_crashReportInfoConstructor) - 1, "ObjectTemplate_Constructor: %s\n", !filename.empty() ? filename.c_str() : "")); + IGNORE_RETURN(snprintf(s_crashReportInfoConstructor, sizeof(s_crashReportInfoConstructor) - 1, "ObjectTemplate_Constructor: %s\n", !filename.empty() ? filename.c_str() : "")); s_crashReportInfoConstructor[sizeof(s_crashReportInfoConstructor) - 1] = '\0'; } @@ -165,7 +165,7 @@ Object *ObjectTemplate::createObject() const */ void ObjectTemplate::addReference() const { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->addReference(); DataResource::addReference(); @@ -178,7 +178,7 @@ void ObjectTemplate::addReference() const */ void ObjectTemplate::releaseReference() const { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); DataResource::releaseReference(); @@ -199,7 +199,7 @@ void ObjectTemplate::loadFromIff(Iff &iff) //-- Track name of most recently loading object template name to give us more // data to work with when we receive crash info. char const *const filename = iff.getFileName(); - IGNORE_RETURN(snprintf(s_crashReportInfoLoadFromIff, sizeof(s_crashReportInfoLoadFromIff) - 1, "ObjectTemplate_Iff: %s\n", (filename && *filename) ? filename : "")); + IGNORE_RETURN(snprintf(s_crashReportInfoLoadFromIff, sizeof(s_crashReportInfoLoadFromIff) - 1, "ObjectTemplate_Iff: %s\n", (filename && *filename) ? filename : "")); s_crashReportInfoLoadFromIff[sizeof(s_crashReportInfoLoadFromIff) - 1] = '\0'; preLoad(); diff --git a/engine/shared/library/sharedObject/src/shared/object/ObjectTemplateList.cpp b/engine/shared/library/sharedObject/src/shared/object/ObjectTemplateList.cpp index 4e45484b..96663b8a 100755 --- a/engine/shared/library/sharedObject/src/shared/object/ObjectTemplateList.cpp +++ b/engine/shared/library/sharedObject/src/shared/object/ObjectTemplateList.cpp @@ -24,8 +24,8 @@ typedef DataResourceList ObjectTemplateListDataResourceList; -template <> ObjectTemplateListDataResourceList::CreateDataResourceMap *ObjectTemplateListDataResourceList::ms_bindings = NULL; -template <> ObjectTemplateListDataResourceList::LoadedDataResourceMap *ObjectTemplateListDataResourceList::ms_loaded = NULL; +template <> ObjectTemplateListDataResourceList::CreateDataResourceMap *ObjectTemplateListDataResourceList::ms_bindings = nullptr; +template <> ObjectTemplateListDataResourceList::LoadedDataResourceMap *ObjectTemplateListDataResourceList::ms_loaded = nullptr; namespace ObjectTemplateListNamespace { diff --git a/engine/shared/library/sharedObject/src/shared/object/ScheduleData.cpp b/engine/shared/library/sharedObject/src/shared/object/ScheduleData.cpp index 8de48b15..0b323d4d 100755 --- a/engine/shared/library/sharedObject/src/shared/object/ScheduleData.cpp +++ b/engine/shared/library/sharedObject/src/shared/object/ScheduleData.cpp @@ -20,12 +20,12 @@ MEMORY_BLOCK_MANAGER_IMPLEMENTATION_WITH_INSTALL(ScheduleData, true, 0, 0, 0); ScheduleData::ScheduleData(AlterScheduler::ScheduleTime initialMostRecentAlterTime): m_mostRecentAlterTime(initialMostRecentAlterTime), - m_alterNowNext(NULL), - m_alterNowPrevious(NULL), - m_alterNextFrameNext(NULL), - m_alterNextFramePrevious(NULL), - m_concludeNext(NULL), - m_concludePrevious(NULL), + m_alterNowNext(nullptr), + m_alterNowPrevious(nullptr), + m_alterNextFrameNext(nullptr), + m_alterNextFramePrevious(nullptr), + m_concludeNext(nullptr), + m_concludePrevious(nullptr), m_scheduleTimeMapIterator(), m_schedulePhase(0) { diff --git a/engine/shared/library/sharedObject/src/shared/portal/CellProperty.cpp b/engine/shared/library/sharedObject/src/shared/portal/CellProperty.cpp index d6ae066b..95281e88 100755 --- a/engine/shared/library/sharedObject/src/shared/portal/CellProperty.cpp +++ b/engine/shared/library/sharedObject/src/shared/portal/CellProperty.cpp @@ -70,14 +70,14 @@ namespace CellPropertyNamespace Object *ms_worldCellObject; Notification ms_portalCrossingNotification; bool ms_renderPortals; - CellProperty::CreateDpvsCellHookFunction ms_createDpvsCellHookFunction = NULL; - CellProperty::DestroyDpvsCellHookFunction ms_destroyDpvsCellHookFunction = NULL; - CellProperty::AddToRenderWorldHookFunction ms_addToRenderWorldHook = NULL; + CellProperty::CreateDpvsCellHookFunction ms_createDpvsCellHookFunction = nullptr; + CellProperty::DestroyDpvsCellHookFunction ms_destroyDpvsCellHookFunction = nullptr; + CellProperty::AddToRenderWorldHookFunction ms_addToRenderWorldHook = nullptr; - CellProperty::PolyAppearanceFactory ms_portalBarrierFactory = NULL; - CellProperty::PolyAppearanceFactory ms_forceFieldFactory = NULL; + CellProperty::PolyAppearanceFactory ms_portalBarrierFactory = nullptr; + CellProperty::PolyAppearanceFactory ms_forceFieldFactory = nullptr; - CellProperty::AccessAllowedHookFunction ms_accessAllowedHookFunction = NULL; + CellProperty::AccessAllowedHookFunction ms_accessAllowedHookFunction = nullptr; } using namespace CellPropertyNamespace; @@ -86,9 +86,9 @@ using namespace CellPropertyNamespace; bool CellPropertyNamespace::Notification::ms_enabled = true; CellProperty *CellProperty::ms_worldCellProperty; -CellProperty::TextureFetch CellProperty::ms_textureFetch = NULL; -CellProperty::TextureRelease CellProperty::ms_textureRelease = NULL; -CellProperty::DeleteVisibleCellProperty CellProperty::ms_deleteVisibleCellProperty = NULL; +CellProperty::TextureFetch CellProperty::ms_textureFetch = nullptr; +CellProperty::TextureRelease CellProperty::ms_textureRelease = nullptr; +CellProperty::DeleteVisibleCellProperty CellProperty::ms_deleteVisibleCellProperty = nullptr; // ====================================================================== @@ -148,9 +148,9 @@ bool CellPropertyNamespace::Notification::positionChanged(Object &object, bool c start += objUpW; end += objUpW; - CellProperty *targetCell = NULL; + CellProperty *targetCell = nullptr; - CellProperty *lastCell = NULL; + CellProperty *lastCell = nullptr; CellProperty *currentCell = object.getParentCell(); while(currentCell) @@ -163,7 +163,7 @@ bool CellPropertyNamespace::Notification::positionChanged(Object &object, bool c if(time == 1.0f) break; - if(nextCell == NULL) break; + if(nextCell == nullptr) break; if(nextCell == currentCell) break; if(nextCell == lastCell) break; @@ -235,8 +235,8 @@ void CellProperty::install() void CellProperty::remove() { delete ms_worldCellObject; - ms_worldCellObject = NULL; - ms_worldCellProperty = NULL; + ms_worldCellObject = nullptr; + ms_worldCellProperty = nullptr; } // ---------------------------------------------------------------------- @@ -282,7 +282,7 @@ Appearance *CellProperty::createPortalBarrier(VertexList const & verts, const Ve if (ms_portalBarrierFactory) return ms_portalBarrierFactory(verts,color); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -292,7 +292,7 @@ Appearance *CellProperty::createForceField(VertexList const & verts, const Vecto if (ms_forceFieldFactory) return ms_forceFieldFactory(verts,color); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -342,24 +342,24 @@ void CellProperty::setPortalTransitionsEnabled(bool enabled) CellProperty::CellProperty(Object &owner) : Container(getClassPropertyId(), owner), - m_portalProperty(NULL), + m_portalProperty(nullptr), m_cellIndex(-1), - m_appearanceObject(NULL), + m_appearanceObject(nullptr), m_portalObjectList(new PortalObjectList), m_visible(false), - m_floor(NULL), - m_cellName(NULL), + m_floor(nullptr), + m_cellName(nullptr), m_cellNameCrc(0), - m_dpvsCell(NULL), - m_environmentTexture(NULL), + m_dpvsCell(nullptr), + m_environmentTexture(nullptr), m_fogEnabled(false), m_fogColor(0), m_fogDensity(0.f), m_appliedInteriorLayout(false), - m_preVisibilityTraversalRenderHookFunctionList(NULL), - m_enterRenderHookFunctionList(NULL), - m_preDrawRenderHookFunctionList(NULL), - m_exitRenderHookFunctionList(NULL) + m_preVisibilityTraversalRenderHookFunctionList(nullptr), + m_enterRenderHookFunctionList(nullptr), + m_preDrawRenderHookFunctionList(nullptr), + m_exitRenderHookFunctionList(nullptr) { if (ms_createDpvsCellHookFunction) m_dpvsCell = (*ms_createDpvsCellHookFunction)(this); @@ -379,7 +379,7 @@ CellProperty::~CellProperty() { NOT_NULL(ms_textureRelease); ms_textureRelease(m_environmentTexture); - m_environmentTexture = NULL; + m_environmentTexture = nullptr; } if (!m_portalObjectList->empty()) @@ -391,18 +391,18 @@ CellProperty::~CellProperty() delete portalList; } - m_portalProperty = NULL; + m_portalProperty = nullptr; delete m_appearanceObject; delete m_portalObjectList; delete m_floor; - m_cellName = NULL; + m_cellName = nullptr; m_cellNameCrc = 0; if (m_dpvsCell) { NOT_NULL(ms_destroyDpvsCellHookFunction); (*ms_destroyDpvsCellHookFunction)(m_dpvsCell); - m_dpvsCell = NULL; + m_dpvsCell = nullptr; } delete m_preVisibilityTraversalRenderHookFunctionList; @@ -432,7 +432,7 @@ void CellProperty::initialize(const PortalProperty &portalProperty, int cellInde m_appearanceObject->attachToObject_p(&getOwner(), true); Appearance * const appearance = AppearanceTemplateList::createAppearance(cellTemplate.getAppearanceName()); - if (appearance != NULL) { + if (appearance != nullptr) { appearance->setShadowBlobAllowed(); m_appearanceObject->setAppearance(appearance); @@ -448,7 +448,7 @@ void CellProperty::initialize(const PortalProperty &portalProperty, int cellInde if (cellTemplate.getFloorName()) { - m_floor = FloorManager::createFloor(cellTemplate.getFloorName(),&getOwner(),NULL,false); + m_floor = FloorManager::createFloor(cellTemplate.getFloorName(),&getOwner(),nullptr,false); WARNING(!m_floor, ("Cell %s could not load floor %s", cellTemplate.getAppearanceName(), cellTemplate.getFloorName())); } else @@ -622,8 +622,8 @@ bool CellProperty::areAdjacent(const CellProperty *cellProperty1, const CellProp { bool result = false; - if ( (cellProperty1 != NULL) - && (cellProperty2 != NULL)) + if ( (cellProperty1 != nullptr) + && (cellProperty2 != nullptr)) { if (cellProperty1 == cellProperty2) { @@ -640,8 +640,8 @@ bool CellProperty::areAdjacent(const CellProperty *cellProperty1, const CellProp result = false; } - else if ( (cellProperty1->m_portalObjectList != NULL) - && (cellProperty2->m_portalObjectList != NULL)) + else if ( (cellProperty1->m_portalObjectList != nullptr) + && (cellProperty2->m_portalObjectList != nullptr)) { // Pick the list that is not the world cell property, or the // smallest list @@ -657,7 +657,7 @@ bool CellProperty::areAdjacent(const CellProperty *cellProperty1, const CellProp checkCellProperty = cellProperty1; } - if (portalObjectList != NULL) + if (portalObjectList != nullptr) { //DEBUG_REPORT_LOG((portalObjectList->size() > 1), ("Portal Object List > 1 - size: %d", portalObjectList->size())); @@ -714,7 +714,7 @@ void CellProperty::releaseWorldCellPropertyEnvironmentTexture() * * @param startPosition Starting position, in the space of this cell. * @param endPosition Ending position, in the space of this cell. - * @return The CellProperty that an object traversing the object is in. Will return NULL if remaining in this cell. + * @return The CellProperty that an object traversing the object is in. Will return nullptr if remaining in this cell. */ CellProperty *CellProperty::getDestinationCell(const Vector &startPosition, const Vector &endPosition, float &closestPortalT, bool passableOnly) const @@ -773,8 +773,8 @@ CellProperty *CellProperty::getDestinationCell(const Vector &startPosition, cons CellProperty *CellProperty::getDestinationCell(const Object *object, int portalId) const { - if(portalId < 0) return NULL; - if(object == NULL) return NULL; + if(portalId < 0) return nullptr; + if(object == nullptr) return nullptr; const PortalObjectList::const_iterator iEnd = m_portalObjectList->end(); for (PortalObjectList::const_iterator i = m_portalObjectList->begin(); i != iEnd; ++i) @@ -796,13 +796,13 @@ CellProperty *CellProperty::getDestinationCell(const Object *object, int portalI { DEBUG_WARNING(true,("CellProperty::getDestinationCell(portalId) - tried to get an invalid portal\n")); - return NULL; + return nullptr; } return portalList[static_cast(portalId)]->getNeighbor()->getParentCell(); } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -840,7 +840,7 @@ bool CellProperty::getDestinationCells(const Sphere &sphere, std::vectorgetNeighbor(); - WARNING(neighbor == NULL,("CellProperty::getDestinationCells - Cell %s has a portal without a neighbor\n",getOwner().getNetworkId().getValueString().c_str())); + WARNING(neighbor == nullptr,("CellProperty::getDestinationCells - Cell %s has a portal without a neighbor\n",getOwner().getNetworkId().getValueString().c_str())); if(neighbor) { @@ -864,7 +864,7 @@ bool CellProperty::isAdjacentTo(const CellProperty *cell) const { if(this == cell) return true; - if(cell == NULL) return false; + if(cell == nullptr) return false; // ---------- @@ -964,7 +964,7 @@ const BaseExtent *CellProperty::getCollisionExtent() const } else { - return NULL; + return nullptr; } } @@ -982,7 +982,7 @@ const BaseClass *CellProperty::getPathGraph() const } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -1111,7 +1111,7 @@ void CellProperty::drawDebugShapes(DebugShapeRenderer * const renderer) const #ifdef _DEBUG - if (renderer == NULL) + if (renderer == nullptr) return; Floor const * const floor = getFloor(); @@ -1192,7 +1192,7 @@ CellProperty::PortalObjectEntry const &CellProperty::getPortalObject(int index) bool CellProperty::getAccessAllowed() const { - if (ms_accessAllowedHookFunction != NULL) + if (ms_accessAllowedHookFunction != nullptr) return (*ms_accessAllowedHookFunction)(*this); else return true; @@ -1286,7 +1286,7 @@ Vector const CellProperty::getPosition_w(Location const & location) Vector result = location.getCoordinates(); CellProperty const * const worldCellProperty = CellProperty::getWorldCellProperty(); - if (worldCellProperty != NULL) + if (worldCellProperty != nullptr) { if (location.getCell() != worldCellProperty->getOwner().getNetworkId()) { @@ -1295,7 +1295,7 @@ Vector const CellProperty::getPosition_w(Location const & location) Object const * const cell = NetworkIdManager::getObjectById(location.getCell()); - if (cell != NULL) + if (cell != nullptr) { result = cell->rotateTranslate_o2w(location.getCoordinates()); } diff --git a/engine/shared/library/sharedObject/src/shared/portal/Portal.cpp b/engine/shared/library/sharedObject/src/shared/portal/Portal.cpp index 1fcd8d87..c8658b98 100755 --- a/engine/shared/library/sharedObject/src/shared/portal/Portal.cpp +++ b/engine/shared/library/sharedObject/src/shared/portal/Portal.cpp @@ -64,7 +64,7 @@ void Portal::install() void Portal::remove() { delete ms_doorStyleTable; - ms_doorStyleTable = NULL; + ms_doorStyleTable = nullptr; } // ---------------------------------------------------------------------- @@ -105,11 +105,11 @@ Portal::Portal(const PortalPropertyTemplateCellPortal &portalTemplate, CellPrope m_template(portalTemplate), m_relativeToObject(relativeTo), m_closed(false), - m_neighbor(NULL), + m_neighbor(nullptr), m_parentCell(parentCell), - m_dpvsPortal(NULL), - m_door(NULL), - m_appearance(NULL) + m_dpvsPortal(nullptr), + m_door(nullptr), + m_appearance(nullptr) { if(ms_createDoors) { @@ -126,13 +126,13 @@ Portal::~Portal() m_relativeToObject->removeDpvsObject(m_dpvsPortal); NOT_NULL(ms_destroyDpvsPortalHookFunction); (*ms_destroyDpvsPortalHookFunction)(m_dpvsPortal); - m_dpvsPortal = NULL; + m_dpvsPortal = nullptr; } - m_relativeToObject = NULL; - m_neighbor = NULL; - m_parentCell = NULL; - m_door = NULL; + m_relativeToObject = nullptr; + m_neighbor = nullptr; + m_parentCell = nullptr; + m_door = nullptr; delete m_appearance; } diff --git a/engine/shared/library/sharedObject/src/shared/portal/PortalProperty.cpp b/engine/shared/library/sharedObject/src/shared/portal/PortalProperty.cpp index e88349e2..716b488a 100755 --- a/engine/shared/library/sharedObject/src/shared/portal/PortalProperty.cpp +++ b/engine/shared/library/sharedObject/src/shared/portal/PortalProperty.cpp @@ -57,9 +57,9 @@ PropertyId PortalProperty::getClassPropertyId() PortalProperty::PortalProperty(Object &owner, const char *fileName) : Container(getClassPropertyId(), owner), - m_template(NULL), + m_template(nullptr), m_cellList(new CellList), - m_fixupList(NULL), + m_fixupList(nullptr), m_hasPassablePortalToParentCell(false) { #ifdef _DEBUG @@ -67,7 +67,7 @@ PortalProperty::PortalProperty(Object &owner, const char *fileName) #endif // _DEBUG m_template = PortalPropertyTemplateList::fetch(CrcLowerString(fileName)); - m_cellList->resize(static_cast(m_template->getNumberOfCells()), NULL); + m_cellList->resize(static_cast(m_template->getNumberOfCells()), nullptr); #ifdef _DEBUG DataLint::popAsset(); @@ -139,7 +139,7 @@ void PortalProperty::addToWorld() int unloaded = 0; int const numberOfCells = static_cast(m_cellList->size()); for (int i = 1; i < numberOfCells; ++i) - if ((*m_cellList)[static_cast(i)] == NULL) + if ((*m_cellList)[static_cast(i)] == nullptr) { WARNING(true, ("cell %d/%d not loaded", i, numberOfCells)); ++unloaded; @@ -215,7 +215,7 @@ bool PortalProperty::serverEndBaselines(int serverObjectCrc, std::vectorsize(); for (uint i = 1; i < numberOfCells; ++i) { - if ((*m_cellList)[i] == NULL) + if ((*m_cellList)[i] == nullptr) { Object *object = ms_beginCreateObjectFunction(static_cast(i)); IGNORE_RETURN(addToContents(*object, tmp)); @@ -460,7 +460,7 @@ void PortalProperty::debugPrint(std::string &buffer) const void PortalProperty::createAppearance() { Appearance * const appearance = AppearanceTemplateList::createAppearance(m_template->getExteriorAppearanceName()); - if (appearance != NULL) { + if (appearance != nullptr) { appearance->setShadowBlobAllowed(); getOwner().setAppearance(appearance); } else { @@ -563,7 +563,7 @@ CellProperty *PortalProperty::getCell(const char *desiredCellName) return (*m_cellList)[static_cast(i)]; } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedObject/src/shared/portal/PortalPropertyTemplate.cpp b/engine/shared/library/sharedObject/src/shared/portal/PortalPropertyTemplate.cpp index 09d2e9e1..a21c39b5 100755 --- a/engine/shared/library/sharedObject/src/shared/portal/PortalPropertyTemplate.cpp +++ b/engine/shared/library/sharedObject/src/shared/portal/PortalPropertyTemplate.cpp @@ -41,7 +41,7 @@ typedef BaseClass * (*ExpandBuildingGraphHook)( PortalPropertyTemplate * portalTemplate, BaseClass * baseBuildingGraph ); -ExpandBuildingGraphHook g_expandBuildingGraphHook = NULL; +ExpandBuildingGraphHook g_expandBuildingGraphHook = nullptr; // ====================================================================== @@ -257,8 +257,8 @@ PortalPropertyTemplateCellPortal::PortalPropertyTemplateCellPortal(const PortalP m_disabled(false), m_passable(false), m_geometryWindingClockwise(true), - m_portalGeometry(NULL), - m_doorStyle(NULL), + m_portalGeometry(nullptr), + m_doorStyle(nullptr), m_hasDoorHardpoint(false), m_doorHardpoint(), m_plane(), @@ -272,7 +272,7 @@ PortalPropertyTemplateCellPortal::PortalPropertyTemplateCellPortal(const PortalP PortalPropertyTemplateCellPortal::~PortalPropertyTemplateCellPortal() { - m_portalGeometry = NULL; + m_portalGeometry = nullptr; delete [] m_doorStyle; if (m_preloadManager) @@ -524,14 +524,14 @@ PortalPropertyTemplateCell::PreloadManager::~PreloadManager () PortalPropertyTemplateCell::PortalPropertyTemplateCell(const PortalPropertyTemplate &portalPropertyTemplate, int index, Iff &iff) : - m_name(NULL), - m_appearanceName(NULL), - m_floorName(NULL), - m_floorMesh(NULL), + m_name(nullptr), + m_appearanceName(nullptr), + m_floorName(nullptr), + m_floorMesh(nullptr), m_canSeeParentCell(false), - m_lightList(NULL), + m_lightList(nullptr), m_portalList(new PortalPropertyTemplateCellPortalList), - m_collisionExtent(NULL), + m_collisionExtent(nullptr), m_preloadManager (0) { load(portalPropertyTemplate, index, iff); @@ -556,7 +556,7 @@ PortalPropertyTemplateCell::~PortalPropertyTemplateCell() } delete m_collisionExtent; - m_collisionExtent = NULL; + m_collisionExtent = nullptr; if (m_preloadManager) { @@ -567,7 +567,7 @@ PortalPropertyTemplateCell::~PortalPropertyTemplateCell() if (m_floorMesh) { m_floorMesh->releaseReference (); - m_floorMesh = NULL; + m_floorMesh = nullptr; } } @@ -875,7 +875,7 @@ const char *PortalPropertyTemplateCell::getFloorName() const FloorMesh const * PortalPropertyTemplateCell::getFloorMesh() const { - if(m_floorMesh == NULL) + if(m_floorMesh == nullptr) { if(m_floorName) { @@ -885,7 +885,7 @@ FloorMesh const * PortalPropertyTemplateCell::getFloorMesh() const } else { - //-- cell template r0 always has a null floor name for POBs without accessible exteriors (POB ships & POB-only dungeons) + //-- cell template r0 always has a nullptr floor name for POBs without accessible exteriors (POB ships & POB-only dungeons) //-- don't warn for that cell template DEBUG_WARNING(ConfigSharedCollision::getReportWarnings() && strcmp(m_name, "r0"), ("PortalPropertyTemplateCell::getFloorMesh() - Cell template %s on [%s] has no floor name", m_name, m_appearanceName)); @@ -1039,7 +1039,7 @@ PortalPropertyTemplate::PortalPropertyTemplate(const CrcString &name) m_cellList(new CellList), m_cellNameList(new CellNameList), m_crc(0), - m_pathGraph(NULL), + m_pathGraph(nullptr), m_radarPortalGeometry(0) { FileName shortName(name.getString()); @@ -1079,7 +1079,7 @@ PortalPropertyTemplate::~PortalPropertyTemplate() delete m_portalOwnersList; delete m_pathGraph; - m_pathGraph = NULL; + m_pathGraph = nullptr; delete m_radarPortalGeometry; m_radarPortalGeometry = 0; diff --git a/engine/shared/library/sharedObject/src/shared/portal/SphereGrid.h b/engine/shared/library/sharedObject/src/shared/portal/SphereGrid.h index 00a1ea37..e83e48e3 100755 --- a/engine/shared/library/sharedObject/src/shared/portal/SphereGrid.h +++ b/engine/shared/library/sharedObject/src/shared/portal/SphereGrid.h @@ -373,14 +373,14 @@ inline void SphereGrid::findInRangeCapsule( Object c template inline void SphereGrid::findInRange( const Capsule & range, std::set & results) { - findInRangeCapsule( INVALID_POB, range, NULL, results ); + findInRangeCapsule( INVALID_POB, range, nullptr, results ); } template inline void SphereGrid::findInRange( Vector const ¢er_w, float radius, std::set & results) { - findInRangeSphere( INVALID_POB, center_w, radius, NULL, results ); + findInRangeSphere( INVALID_POB, center_w, radius, nullptr, results ); } @@ -401,7 +401,7 @@ inline void SphereGrid::findInRange( Vector const &c template inline void SphereGrid::findInRange( Object const *pob, Vector const ¢er_w, float radius, std::set & results) { - findInRangeSphere( pob, center_w, radius, NULL, results ); + findInRangeSphere( pob, center_w, radius, nullptr, results ); } template diff --git a/engine/shared/library/sharedObject/src/shared/property/LayerProperty.cpp b/engine/shared/library/sharedObject/src/shared/property/LayerProperty.cpp index 63f5cc57..f331b5a4 100755 --- a/engine/shared/library/sharedObject/src/shared/property/LayerProperty.cpp +++ b/engine/shared/library/sharedObject/src/shared/property/LayerProperty.cpp @@ -23,7 +23,7 @@ PropertyId LayerProperty::getClassPropertyId() LayerProperty::LayerProperty(Object& thisObject) : Property(getClassPropertyId(), thisObject), -m_layer(NULL) +m_layer(nullptr) { } @@ -31,10 +31,10 @@ m_layer(NULL) LayerProperty::~LayerProperty() { - if (m_layer != NULL) + if (m_layer != nullptr) { delete m_layer; - m_layer = NULL; + m_layer = nullptr; } } diff --git a/engine/shared/library/sharedObject/src/shared/world/World.cpp b/engine/shared/library/sharedObject/src/shared/world/World.cpp index e0d90fae..ce2ab931 100755 --- a/engine/shared/library/sharedObject/src/shared/world/World.cpp +++ b/engine/shared/library/sharedObject/src/shared/world/World.cpp @@ -305,7 +305,7 @@ bool World::removeObject (const Object* object, int listIndex) { DEBUG_FATAL (!ms_installed, ("not installed")); NOT_NULL (object); - DEBUG_FATAL (!object, ("World::removeObject - object is null")); + DEBUG_FATAL (!object, ("World::removeObject - object is nullptr")); VALIDATE_RANGE_INCLUSIVE_EXCLUSIVE (0, listIndex, static_cast(WOL_Count)); ms_objectSet.erase(object); @@ -349,7 +349,7 @@ bool World::removeObject (const Object* object, int listIndex) void World::queueObject (Object* object) { DEBUG_FATAL (!ms_installed, ("not installed")); - DEBUG_FATAL (!object, ("World::queueObject - object is null")); + DEBUG_FATAL (!object, ("World::queueObject - object is nullptr")); ms_queuedObjectList->addObject (object); } diff --git a/engine/shared/library/sharedPathfinding/src/shared/DynamicPathGraph.cpp b/engine/shared/library/sharedPathfinding/src/shared/DynamicPathGraph.cpp index 532ade02..8b264ebb 100755 --- a/engine/shared/library/sharedPathfinding/src/shared/DynamicPathGraph.cpp +++ b/engine/shared/library/sharedPathfinding/src/shared/DynamicPathGraph.cpp @@ -25,10 +25,10 @@ DynamicPathGraph::~DynamicPathGraph() clear(); delete m_nodeList; - m_nodeList = NULL; + m_nodeList = nullptr; delete m_dirtyNodes; - m_dirtyNodes = NULL; + m_dirtyNodes = nullptr; } // ---------- @@ -72,7 +72,7 @@ int DynamicPathGraph::getEdgeCount ( int nodeIndex ) const { DynamicPathNode const * node = _getNode(nodeIndex); - if(node == NULL) + if(node == nullptr) { return 0; } @@ -86,13 +86,13 @@ PathEdge * DynamicPathGraph::getEdge ( int nodeIndex, int edgeIndex ) { DynamicPathNode * node = _getNode(nodeIndex); - if(node != NULL) + if(node != nullptr) { return node->getEdge(edgeIndex); } else { - return NULL; + return nullptr; } } @@ -100,13 +100,13 @@ PathEdge const * DynamicPathGraph::getEdge ( int nodeIndex, int edgeIndex ) cons { DynamicPathNode const * node = _getNode(nodeIndex); - if(node != NULL) + if(node != nullptr) { return node->getEdge(edgeIndex); } else { - return NULL; + return nullptr; } } @@ -114,7 +114,7 @@ PathEdge const * DynamicPathGraph::getEdge ( int nodeIndex, int edgeIndex ) cons int DynamicPathGraph::addNode ( DynamicPathNode * newNode ) { - if(newNode == NULL) return -1; + if(newNode == nullptr) return -1; int listSize = m_nodeList->size(); @@ -124,7 +124,7 @@ int DynamicPathGraph::addNode ( DynamicPathNode * newNode ) { for(int i = 0; i < listSize; i++) { - if(m_nodeList->at(i) == NULL) + if(m_nodeList->at(i) == nullptr) { nodeIndex = i; break; @@ -155,11 +155,11 @@ void DynamicPathGraph::removeNode ( int nodeIndex ) DynamicPathNode * node = _getNode(nodeIndex); - if(node != NULL) + if(node != nullptr) { unlinkNode(nodeIndex); - m_nodeList->at(nodeIndex) = NULL; + m_nodeList->at(nodeIndex) = nullptr; delete node; @@ -171,7 +171,7 @@ void DynamicPathGraph::moveNode ( int nodeIndex, Vector const & newPosition ) { DynamicPathNode * node = _getNode(nodeIndex); - if(node != NULL) + if(node != nullptr) { node->setPosition_p(newPosition); @@ -230,7 +230,7 @@ void DynamicPathGraph::unlinkNode ( int nodeIndex ) { DynamicPathNode * node = _getNode(nodeIndex); - if(node == NULL) return; + if(node == nullptr) return; // ---------- @@ -254,7 +254,7 @@ void DynamicPathGraph::relinkNode ( int nodeIndex ) { DynamicPathNode * nodeA = _getNode(nodeIndex); - if(nodeA == NULL) return; + if(nodeA == nullptr) return; // ---------- @@ -268,7 +268,7 @@ void DynamicPathGraph::relinkNode ( int nodeIndex ) { DynamicPathNode * nodeB = _getNode(i); - if(nodeB == NULL) continue; + if(nodeB == nullptr) continue; if(nodeA == nodeB) continue; Vector const & posA = nodeA->getPosition_p(); @@ -314,7 +314,7 @@ void DynamicPathGraph::relinkNode ( int nodeIndex ) { DynamicPathNode * neighborNode = _getNode(neighborList[i]); - if(neighborNode != NULL) + if(neighborNode != nullptr) { neighborNode->markRedundantEdges(); neighborNode->removeMarkedEdges(); @@ -326,7 +326,7 @@ void DynamicPathGraph::relinkNode ( int nodeIndex ) DynamicPathNode * DynamicPathGraph::_getNode ( int nodeIndex ) { - if(nodeIndex == -1) return NULL; + if(nodeIndex == -1) return nullptr; return m_nodeList->at(nodeIndex); } @@ -335,7 +335,7 @@ DynamicPathNode * DynamicPathGraph::_getNode ( int nodeIndex ) DynamicPathNode const * DynamicPathGraph::_getNode ( int nodeIndex ) const { - if(nodeIndex == -1) return NULL; + if(nodeIndex == -1) return nullptr; return m_nodeList->at(nodeIndex); } diff --git a/engine/shared/library/sharedPathfinding/src/shared/DynamicPathGraph.h b/engine/shared/library/sharedPathfinding/src/shared/DynamicPathGraph.h index e2baf1f3..b778ac1a 100755 --- a/engine/shared/library/sharedPathfinding/src/shared/DynamicPathGraph.h +++ b/engine/shared/library/sharedPathfinding/src/shared/DynamicPathGraph.h @@ -20,7 +20,7 @@ class DynamicPathNode; // and remove nodes on the fly (such as city graphs) // DynamicPathGraph uses a sparse array to store its nodes. Calling -// getNode with a nodeIndex in [0,nodeCount) may return NULL. If you +// getNode with a nodeIndex in [0,nodeCount) may return nullptr. If you // want to know the number of live nodes in the graph, call getLiveNodeCount. class DynamicPathGraph : public PathGraph diff --git a/engine/shared/library/sharedPathfinding/src/shared/DynamicPathNode.cpp b/engine/shared/library/sharedPathfinding/src/shared/DynamicPathNode.cpp index 8f3798bf..b82efe57 100755 --- a/engine/shared/library/sharedPathfinding/src/shared/DynamicPathNode.cpp +++ b/engine/shared/library/sharedPathfinding/src/shared/DynamicPathNode.cpp @@ -105,7 +105,7 @@ bool DynamicPathNode::removeEdge ( int nodeIndex ) { DynamicPathNode * neighbor = _getGraph()->_getNode(nodeIndex); - if(neighbor == NULL) return false; + if(neighbor == nullptr) return false; if(!_removeEdge(nodeIndex)) return false; @@ -175,8 +175,8 @@ int DynamicPathNode::markRedundantEdges ( void ) const PathEdge const * edgeA = getEdge(i); PathEdge const * edgeB = getEdge(j); - if(edgeA == NULL) continue; - if(edgeB == NULL) continue; + if(edgeA == nullptr) continue; + if(edgeB == nullptr) continue; int iA = edgeA->getIndexA(); int iB = edgeA->getIndexB(); diff --git a/engine/shared/library/sharedPathfinding/src/shared/PathGraph.cpp b/engine/shared/library/sharedPathfinding/src/shared/PathGraph.cpp index a72faa92..0585dc87 100755 --- a/engine/shared/library/sharedPathfinding/src/shared/PathGraph.cpp +++ b/engine/shared/library/sharedPathfinding/src/shared/PathGraph.cpp @@ -69,7 +69,7 @@ int PathGraph::findNode ( PathNodeType type, int key ) const if(getEdgeCount(i) == 0) continue; - if((node != NULL) && (node->getType() == type) && (node->getKey() == key)) + if((node != nullptr) && (node->getType() == type) && (node->getKey() == key)) { return i; } @@ -88,7 +88,7 @@ int PathGraph::findEntrance ( int key ) const { PathNode const * node = getNode(i); - if(node == NULL) continue; + if(node == nullptr) continue; if(getEdgeCount(i) == 0) continue; @@ -119,7 +119,7 @@ int PathGraph::findNearestNode ( Vector const & position_p ) const { PathNode const * node = getNode(i); - if(node == NULL) continue; + if(node == nullptr) continue; if(getEdgeCount(i) == 0) continue; @@ -148,7 +148,7 @@ int PathGraph::findNearestNode ( PathNodeType searchType, Vector const & positio { PathNode const * node = getNode(i); - if(node == NULL) continue; + if(node == nullptr) continue; if(getEdgeCount(i) == 0) continue; @@ -180,7 +180,7 @@ void PathGraph::findNodesInRange ( Vector const & position_p, float range, PathN { PathNode const * node = getNode(i); - if(node == NULL) continue; + if(node == nullptr) continue; if(getEdgeCount(i) == 0) continue; diff --git a/engine/shared/library/sharedPathfinding/src/shared/PathGraphIterator.cpp b/engine/shared/library/sharedPathfinding/src/shared/PathGraphIterator.cpp index 92a4dc10..d22b581c 100755 --- a/engine/shared/library/sharedPathfinding/src/shared/PathGraphIterator.cpp +++ b/engine/shared/library/sharedPathfinding/src/shared/PathGraphIterator.cpp @@ -14,7 +14,7 @@ // ====================================================================== PathGraphIterator::PathGraphIterator () -: m_graph(NULL), +: m_graph(nullptr), m_nodeIndex(-1) { } @@ -29,18 +29,18 @@ PathGraphIterator::PathGraphIterator ( PathGraph const * graph, int nodeIndex ) bool PathGraphIterator::isValid ( void ) const { - return (m_graph != NULL) && (m_nodeIndex != -1) && (m_graph->getNode(m_nodeIndex) != NULL); + return (m_graph != nullptr) && (m_nodeIndex != -1) && (m_graph->getNode(m_nodeIndex) != nullptr); } PathNode const * PathGraphIterator::getNode ( void ) const { - if( (m_graph != NULL) && (m_nodeIndex != -1) ) + if( (m_graph != nullptr) && (m_nodeIndex != -1) ) { return m_graph->getNode( m_nodeIndex ); } else { - return NULL; + return nullptr; } } @@ -53,7 +53,7 @@ int PathGraphIterator::getNeighborCount ( void ) const PathNode const * PathGraphIterator::getNeighbor ( int whichNeighbor ) const { - if(!isValid()) return NULL; + if(!isValid()) return nullptr; return m_graph->getNode( m_graph->getEdge( m_nodeIndex, whichNeighbor )->getIndexB() ); } diff --git a/engine/shared/library/sharedPathfinding/src/shared/PathNode.cpp b/engine/shared/library/sharedPathfinding/src/shared/PathNode.cpp index 6ff18223..1eec246d 100755 --- a/engine/shared/library/sharedPathfinding/src/shared/PathNode.cpp +++ b/engine/shared/library/sharedPathfinding/src/shared/PathNode.cpp @@ -13,7 +13,7 @@ // ====================================================================== PathNode::PathNode() -: m_graph(NULL), +: m_graph(nullptr), m_index(-1), m_id(-1), m_key(-1), @@ -27,7 +27,7 @@ PathNode::PathNode() } PathNode::PathNode ( Vector const & position ) -: m_graph(NULL), +: m_graph(nullptr), m_index(-1), m_id(-1), m_key(-1), diff --git a/engine/shared/library/sharedPathfinding/src/shared/PathSearch.cpp b/engine/shared/library/sharedPathfinding/src/shared/PathSearch.cpp index 42abd9d7..e09a5cab 100755 --- a/engine/shared/library/sharedPathfinding/src/shared/PathSearch.cpp +++ b/engine/shared/library/sharedPathfinding/src/shared/PathSearch.cpp @@ -137,7 +137,7 @@ MEMORY_BLOCK_MANAGER_IMPLEMENTATION_WITH_INSTALL(PathSearchNode, true, 0, 0, 0); PathSearchNode::PathSearchNode ( PathSearch * search, PathGraph const * graph, PathNode const * node ) : m_search(search), - m_parent(NULL), + m_parent(nullptr), m_graph(graph), m_node(node), m_queued(false), @@ -164,13 +164,13 @@ PathSearchNode * PathSearchNode::getNeighbor ( int whichNeighbor ) PathNode const * neighborNode = m_graph->getNode(neighborIndex); - if(neighborNode != NULL) + if(neighborNode != nullptr) { return getSearchNode(neighborNode); } else { - return NULL; + return nullptr; } } @@ -180,7 +180,7 @@ PathSearchNode * PathSearchNode::createSearchNode( PathNode const * node ) { // doing bad voodoo with the node marks - PathSearchNode * oldNode = NULL; + PathSearchNode * oldNode = nullptr; int mark = node->getMark(3); @@ -206,7 +206,7 @@ PathSearchNode * PathSearchNode::getSearchNode( PathNode const * node ) { // doing bad voodoo with the node marks - PathSearchNode * searchNode = NULL; + PathSearchNode * searchNode = nullptr; int mark = node->getMark(3); @@ -215,7 +215,7 @@ PathSearchNode * PathSearchNode::getSearchNode( PathNode const * node ) searchNode = (PathSearchNode*)((void*)mark); } - if(searchNode == NULL) + if(searchNode == nullptr) { return createSearchNode(node); } @@ -305,9 +305,9 @@ void PathSearch::install() // ---------------------------------------------------------------------- PathSearch::PathSearch ( void ) -: m_graph(NULL), - m_start(NULL), - m_goal(NULL), +: m_graph(nullptr), + m_start(nullptr), + m_goal(nullptr), m_multiGoal(false), m_goals(new NodeList()), m_queue(new PathSearchQueue()), @@ -321,16 +321,16 @@ PathSearch::PathSearch ( void ) PathSearch::~PathSearch() { delete m_goals; - m_goals = NULL; + m_goals = nullptr; delete m_queue; - m_queue = NULL; + m_queue = nullptr; delete m_path; - m_path = NULL; + m_path = nullptr; delete m_visitedNodes; - m_visitedNodes = NULL; + m_visitedNodes = nullptr; } // ---------------------------------------------------------------------- @@ -361,7 +361,7 @@ PathSearchNode * PathSearch::search ( void ) { PathSearchNode * neighbor = node->getNeighbor(i); - if(neighbor != NULL) + if(neighbor != nullptr) { float newCost = node->getCost() + costBetween(node->getPathNode(),neighbor->getPathNode()); @@ -377,7 +377,7 @@ PathSearchNode * PathSearch::search ( void ) } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -395,8 +395,8 @@ bool PathSearch::search ( PathGraph const * graph, int startIndex, int goalIndex m_goal = graph->getNode(goalIndex); m_multiGoal = false; - if(m_start == NULL) return false; - if(m_goal == NULL) return false; + if(m_start == nullptr) return false; + if(m_goal == nullptr) return false; m_path->clear(); @@ -429,7 +429,7 @@ bool PathSearch::search ( PathGraph const * graph, int startIndex, IndexList con int goalCount = goalIndices.size(); if(goalCount == 0) return false; - if(m_start == NULL) return false; + if(m_start == nullptr) return false; m_goals->resize(goalCount); @@ -455,7 +455,7 @@ bool PathSearch::search ( PathGraph const * graph, int startIndex, IndexList con bool PathSearch::buildPath ( PathSearchNode * endNode ) { - if( endNode == NULL ) + if( endNode == nullptr ) { m_path->clear(); return false; @@ -633,13 +633,13 @@ IndexList const & PathSearch::getPath ( void ) const bool PathSearch::atGoal ( PathSearchNode * searchNode ) const { - if(searchNode == NULL) return false; + if(searchNode == nullptr) return false; if(m_multiGoal) { PathNode const * pathNode = searchNode->getPathNode(); - if(pathNode == NULL) return false; + if(pathNode == nullptr) return false; return std::find( m_goals->begin(), m_goals->end(), pathNode ) != m_goals->end(); } diff --git a/engine/shared/library/sharedPathfinding/src/shared/Pathfinding.cpp b/engine/shared/library/sharedPathfinding/src/shared/Pathfinding.cpp index dc532a9a..67dfa06a 100755 --- a/engine/shared/library/sharedPathfinding/src/shared/Pathfinding.cpp +++ b/engine/shared/library/sharedPathfinding/src/shared/Pathfinding.cpp @@ -69,7 +69,7 @@ BaseClass * Pathfinding::graphFactory ( Iff & iff ) { DEBUG_WARNING(true,("Pathfinding::graphFactory - Don't know how to construct a path graph from the IFF in %s\n",iff.getFileName())); - return NULL; + return nullptr; } } diff --git a/engine/shared/library/sharedPathfinding/src/shared/SetupSharedPathfinding.cpp b/engine/shared/library/sharedPathfinding/src/shared/SetupSharedPathfinding.cpp index 304f3504..230186e9 100755 --- a/engine/shared/library/sharedPathfinding/src/shared/SetupSharedPathfinding.cpp +++ b/engine/shared/library/sharedPathfinding/src/shared/SetupSharedPathfinding.cpp @@ -67,7 +67,7 @@ int findNeighbor ( PathNode * node, PathNodeType neighborType, int neighborKey ) BaseClass * expandBuildingGraph ( PortalPropertyTemplate * portalTemplate, BaseClass * baseBuildingGraph ) { - if(baseBuildingGraph == NULL) return NULL; + if(baseBuildingGraph == nullptr) return nullptr; SimplePathGraph * buildingGraph = safe_cast(baseBuildingGraph); @@ -92,11 +92,11 @@ BaseClass * expandBuildingGraph ( PortalPropertyTemplate * portalTemplate, BaseC FloorMesh const * floorMesh = cell->getFloorMesh(); - if(floorMesh == NULL) continue; + if(floorMesh == nullptr) continue; PathGraph const * cellGraph = safe_cast(floorMesh->getPathGraph()); - if(cellGraph == NULL) continue; + if(cellGraph == nullptr) continue; // ---------- diff --git a/engine/shared/library/sharedPathfinding/src/shared/SimplePathGraph.cpp b/engine/shared/library/sharedPathfinding/src/shared/SimplePathGraph.cpp index d408d035..2673b2e6 100755 --- a/engine/shared/library/sharedPathfinding/src/shared/SimplePathGraph.cpp +++ b/engine/shared/library/sharedPathfinding/src/shared/SimplePathGraph.cpp @@ -39,7 +39,7 @@ void readArray_Class ( Iff & iff, T * & array, Tag tag ) { int count = iff.read_int32(); - if(array == NULL) array = new T(); + if(array == nullptr) array = new T(); array->resize(count); @@ -58,7 +58,7 @@ void readArray_Class ( Iff & iff, T * & array, Tag tag, Reader R ) { int count = iff.read_int32(); - if(array == NULL) array = new T(); + if(array == nullptr) array = new T(); array->resize(count); @@ -77,7 +77,7 @@ void readArray_Struct ( Iff & iff, T * & array, Tag tag ) { int count = iff.read_int32(); - if(array == NULL) array = new T(); + if(array == nullptr) array = new T(); array->resize(count); @@ -157,7 +157,7 @@ SimplePathGraph::SimplePathGraph ( PathGraphType type ) { #ifdef _DEBUG - m_debugLines = NULL; + m_debugLines = nullptr; #endif } @@ -181,7 +181,7 @@ SimplePathGraph::SimplePathGraph( SimplePathGraph::NodeList * nodes, SimplePathG #ifdef _DEBUG - m_debugLines = NULL; + m_debugLines = nullptr; #endif } @@ -189,21 +189,21 @@ SimplePathGraph::SimplePathGraph( SimplePathGraph::NodeList * nodes, SimplePathG SimplePathGraph::~SimplePathGraph() { delete m_nodes; - m_nodes = NULL; + m_nodes = nullptr; delete m_edges; - m_edges = NULL; + m_edges = nullptr; delete m_edgeCounts; - m_edgeCounts = NULL; + m_edgeCounts = nullptr; delete m_edgeStarts; - m_edgeStarts = NULL; + m_edgeStarts = nullptr; #ifdef _DEBUG delete m_debugLines; - m_debugLines = NULL; + m_debugLines = nullptr; #endif } @@ -265,7 +265,7 @@ PathNode * SimplePathGraph::getNode ( int nodeIndex ) if (static_cast(nodeIndex) < m_nodes->size()) return &m_nodes->at(nodeIndex); - return NULL; + return nullptr; } PathNode const * SimplePathGraph::getNode ( int nodeIndex ) const @@ -273,7 +273,7 @@ PathNode const * SimplePathGraph::getNode ( int nodeIndex ) const if (static_cast(nodeIndex) < m_nodes->size()) return &m_nodes->at(nodeIndex); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -507,7 +507,7 @@ void SimplePathGraph::drawDebugShapes ( DebugShapeRenderer * renderer ) const #ifdef _DEBUG - if(renderer == NULL) return; + if(renderer == nullptr) return; if( m_debugLines ) renderer->drawLineList( *m_debugLines, VectorArgb::solidYellow ); diff --git a/engine/shared/library/sharedRemoteDebugServer/src/shared/SharedRemoteDebugServer.cpp b/engine/shared/library/sharedRemoteDebugServer/src/shared/SharedRemoteDebugServer.cpp index 0e305c96..f33204ef 100755 --- a/engine/shared/library/sharedRemoteDebugServer/src/shared/SharedRemoteDebugServer.cpp +++ b/engine/shared/library/sharedRemoteDebugServer/src/shared/SharedRemoteDebugServer.cpp @@ -27,8 +27,8 @@ unsigned int SharedRemoteDebugServer::ms_remoteDebugToolChanne void SharedRemoteDebugServer::install() { - ms_serviceHandle = NULL; - ms_connection = NULL; + ms_serviceHandle = nullptr; + ms_connection = nullptr; if (!ConfigSharedFoundation::getUseRemoteDebug()) return; @@ -41,7 +41,7 @@ void SharedRemoteDebugServer::install() ms_serviceHandle = new Service(ConnectionAllocator(), setup); //even though this is the game client, this is a remoteDebug *server*, since it sends data to a Qt app for viewing - RemoteDebugServer::install(NULL, open, close, send, NULL); + RemoteDebugServer::install(nullptr, open, close, send, nullptr); //this value needs to be true before the call to RemoteDebugServer::open ms_installed = true; @@ -84,7 +84,7 @@ void SharedRemoteDebugServer::close(void) { DEBUG_FATAL(!ms_installed, ("sharedRemoteDebugServer not installed")); delete ms_connection; - ms_connection = NULL; + ms_connection = nullptr; } //------------------------------------------------------------------- diff --git a/engine/shared/library/sharedRemoteDebugServer/src/shared/SharedRemoteDebugServerConnection.cpp b/engine/shared/library/sharedRemoteDebugServer/src/shared/SharedRemoteDebugServerConnection.cpp index ef51481a..ac6fcd1b 100755 --- a/engine/shared/library/sharedRemoteDebugServer/src/shared/SharedRemoteDebugServerConnection.cpp +++ b/engine/shared/library/sharedRemoteDebugServer/src/shared/SharedRemoteDebugServerConnection.cpp @@ -16,7 +16,7 @@ SharedRemoteDebugServerConnection::SharedRemoteDebugServerConnection(const std::string & a, const unsigned short p) : Connection(a, p, NetworkSetupData()), -m_remotedebugCommandChannel (NULL) +m_remotedebugCommandChannel (nullptr) { } @@ -24,7 +24,7 @@ m_remotedebugCommandChannel (NULL) SharedRemoteDebugServerConnection::SharedRemoteDebugServerConnection(UdpConnectionMT * u, TcpClient * t) : Connection(u, t), -m_remotedebugCommandChannel (NULL) +m_remotedebugCommandChannel (nullptr) { } diff --git a/engine/shared/library/sharedSkillSystem/src/shared/ExpertiseManager.cpp b/engine/shared/library/sharedSkillSystem/src/shared/ExpertiseManager.cpp index 3326d378..17b9bc40 100755 --- a/engine/shared/library/sharedSkillSystem/src/shared/ExpertiseManager.cpp +++ b/engine/shared/library/sharedSkillSystem/src/shared/ExpertiseManager.cpp @@ -298,7 +298,7 @@ int const ExpertiseManager::getNumExpertiseTiers() * exist. * * @return - skill object for expertise at grid location. - * returns NULL if none found + * returns nullptr if none found */ SkillObject const * ExpertiseManager::getExpertiseSkillAt(int tree, int tier, int grid, int rank) { diff --git a/engine/shared/library/sharedSkillSystem/src/shared/LevelManager.cpp b/engine/shared/library/sharedSkillSystem/src/shared/LevelManager.cpp index 12195492..5c81ffea 100755 --- a/engine/shared/library/sharedSkillSystem/src/shared/LevelManager.cpp +++ b/engine/shared/library/sharedSkillSystem/src/shared/LevelManager.cpp @@ -335,7 +335,7 @@ void LevelManager::updateLevelDataWithSkill(LevelData &levelData, std::string co //====================================================================== // Find the level corresponding to the xp value and -// returns null if not found +// returns nullptr if not found LevelRecord const * LevelManagerNamespace::getLevelRecord(int xp) { LevelRecordsIterator itr = ms_levelRecords.begin(); @@ -365,7 +365,7 @@ LevelRecord const * LevelManagerNamespace::getLevelRecord(int xp) WARNING(true, ("getLevelRecord: Couldn't find level for xp value[%d]\n", xp)); - return NULL; + return nullptr; } //====================================================================== diff --git a/engine/shared/library/sharedSkillSystem/src/shared/SkillManager.cpp b/engine/shared/library/sharedSkillSystem/src/shared/SkillManager.cpp index c92f73c4..e0bc3718 100755 --- a/engine/shared/library/sharedSkillSystem/src/shared/SkillManager.cpp +++ b/engine/shared/library/sharedSkillSystem/src/shared/SkillManager.cpp @@ -18,7 +18,7 @@ #include #include -SkillManager *SkillManager::ms_instance = NULL; +SkillManager *SkillManager::ms_instance = nullptr; const std::string &SkillManager::cms_skillsDatatableName = "datatables/skill/skills.iff"; //----------------------------------------------------------------- @@ -92,7 +92,7 @@ void SkillManager::remove() { DEBUG_FATAL (!ms_instance, ("SkillManager not installed")); delete ms_instance; - ms_instance = NULL; + ms_instance = nullptr; } //---------------------------------------------------------------------- @@ -170,7 +170,7 @@ const SkillObject * SkillManager::loadSkill(const std::string & skillName) uint32 SkillManager::getDefaultXpLimit(const std::string & experienceType) { - if (m_xpLimitMap != NULL) + if (m_xpLimitMap != nullptr) { XpLimitMap::const_iterator result = m_xpLimitMap->find(experienceType); if (result != m_xpLimitMap->end()) @@ -183,13 +183,13 @@ uint32 SkillManager::getDefaultXpLimit(const std::string & experienceType) void SkillManager::initXpLimits() { - if (m_xpLimitTable == NULL) + if (m_xpLimitTable == nullptr) { WARNING(true, ("SkillManager::initXpLimits, m_xpLimitTable not initialized")); return; } - if (m_xpLimitMap == NULL) + if (m_xpLimitMap == nullptr) { WARNING(true, ("SkillManager::initXpLimits, m_xpLimitMap not initialized")); return; diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerArmorTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerArmorTemplate.cpp index d6f5b854..c162ae34 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerArmorTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerArmorTemplate.cpp @@ -45,7 +45,7 @@ ServerArmorTemplate::~ServerArmorTemplate() for (iter = m_specialProtection.begin(); iter != m_specialProtection.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_specialProtection.clear(); } @@ -97,10 +97,10 @@ Tag ServerArmorTemplate::getTemplateVersion(void) const */ Tag ServerArmorTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerArmorTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerArmorTemplate::getHighestTemplateVersion @@ -114,9 +114,9 @@ CompilerIntegerParam * ServerArmorTemplate::getCompilerIntegerParam(const char * { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_rating; } @@ -128,9 +128,9 @@ CompilerIntegerParam * ServerArmorTemplate::getCompilerIntegerParam(const char * { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_integrity; } @@ -142,9 +142,9 @@ CompilerIntegerParam * ServerArmorTemplate::getCompilerIntegerParam(const char * { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_effectiveness; } @@ -156,9 +156,9 @@ CompilerIntegerParam * ServerArmorTemplate::getCompilerIntegerParam(const char * { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_vulnerability; } @@ -170,9 +170,9 @@ CompilerIntegerParam * ServerArmorTemplate::getCompilerIntegerParam(const char * { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_encumbrance[index]; } @@ -180,7 +180,7 @@ CompilerIntegerParam * ServerArmorTemplate::getCompilerIntegerParam(const char * } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerArmorTemplate::getCompilerIntegerParam FloatParam * ServerArmorTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -229,7 +229,7 @@ StructParamOT * ServerArmorTemplate::getStructParamOT(const char *name, bool dee } else return TpfTemplate::getStructParamOT(name, deepCheck, index); - return NULL; + return nullptr; } //ServerArmorTemplate::getStructParamOT TriggerVolumeParam * ServerArmorTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index) @@ -316,12 +316,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -355,7 +355,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_specialProtection.begin(); iter != m_specialProtection.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_specialProtection.clear(); m_specialProtectionAppend = file.read_bool8(); @@ -532,9 +532,9 @@ CompilerIntegerParam * ServerArmorTemplate::_SpecialProtection::getCompilerInteg { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_type; } @@ -546,9 +546,9 @@ CompilerIntegerParam * ServerArmorTemplate::_SpecialProtection::getCompilerInteg { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_effectiveness; } @@ -556,7 +556,7 @@ CompilerIntegerParam * ServerArmorTemplate::_SpecialProtection::getCompilerInteg } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerArmorTemplate::_SpecialProtection::getCompilerIntegerParam FloatParam * ServerArmorTemplate::_SpecialProtection::getFloatParam(const char *name, bool deepCheck, int index) diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerBattlefieldMarkerObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerBattlefieldMarkerObjectTemplate.cpp index 4394895d..aa5440ae 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerBattlefieldMarkerObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerBattlefieldMarkerObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerBattlefieldMarkerObjectTemplate::getTemplateVersion(void) const */ Tag ServerBattlefieldMarkerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerBattlefieldMarkerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerBattlefieldMarkerObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerBuildingObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerBuildingObjectTemplate.cpp index ba0b7c07..40cf8c4e 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerBuildingObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerBuildingObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerBuildingObjectTemplate::getTemplateVersion(void) const */ Tag ServerBuildingObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerBuildingObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerBuildingObjectTemplate::getHighestTemplateVersion @@ -103,9 +103,9 @@ CompilerIntegerParam * ServerBuildingObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_maintenanceCost; } @@ -113,7 +113,7 @@ CompilerIntegerParam * ServerBuildingObjectTemplate::getCompilerIntegerParam(con } else return ServerTangibleObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerBuildingObjectTemplate::getCompilerIntegerParam FloatParam * ServerBuildingObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -129,9 +129,9 @@ BoolParam * ServerBuildingObjectTemplate::getBoolParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_isPublic; } @@ -139,7 +139,7 @@ BoolParam * ServerBuildingObjectTemplate::getBoolParam(const char *name, bool de } else return ServerTangibleObjectTemplate::getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerBuildingObjectTemplate::getBoolParam StringParam * ServerBuildingObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) @@ -227,12 +227,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerCellObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerCellObjectTemplate.cpp index 95175f0f..427b3931 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerCellObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerCellObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerCellObjectTemplate::getTemplateVersion(void) const */ Tag ServerCellObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerCellObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerCellObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerCityObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerCityObjectTemplate.cpp index b3f18a79..ac48b340 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerCityObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerCityObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerCityObjectTemplate::getTemplateVersion(void) const */ Tag ServerCityObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerCityObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerCityObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerConstructionContractObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerConstructionContractObjectTemplate.cpp index 9a0f8848..73096b66 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerConstructionContractObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerConstructionContractObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerConstructionContractObjectTemplate::getTemplateVersion(void) const */ Tag ServerConstructionContractObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerConstructionContractObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerConstructionContractObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerCreatureObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerCreatureObjectTemplate.cpp index 7159e108..f63f0d43 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerCreatureObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerCreatureObjectTemplate.cpp @@ -45,7 +45,7 @@ ServerCreatureObjectTemplate::~ServerCreatureObjectTemplate() for (iter = m_attribMods.begin(); iter != m_attribMods.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_attribMods.clear(); } @@ -97,10 +97,10 @@ Tag ServerCreatureObjectTemplate::getTemplateVersion(void) const */ Tag ServerCreatureObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerCreatureObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerCreatureObjectTemplate::getHighestTemplateVersion @@ -114,9 +114,9 @@ CompilerIntegerParam * ServerCreatureObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_attributes[index]; } @@ -128,9 +128,9 @@ CompilerIntegerParam * ServerCreatureObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_minAttributes[index]; } @@ -142,9 +142,9 @@ CompilerIntegerParam * ServerCreatureObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_maxAttributes[index]; } @@ -156,9 +156,9 @@ CompilerIntegerParam * ServerCreatureObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_shockWounds; } @@ -166,7 +166,7 @@ CompilerIntegerParam * ServerCreatureObjectTemplate::getCompilerIntegerParam(con } else return ServerTangibleObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerCreatureObjectTemplate::getCompilerIntegerParam FloatParam * ServerCreatureObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -177,9 +177,9 @@ FloatParam * ServerCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_minDrainModifier; } @@ -191,9 +191,9 @@ FloatParam * ServerCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_maxDrainModifier; } @@ -205,9 +205,9 @@ FloatParam * ServerCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_minFaucetModifier; } @@ -219,9 +219,9 @@ FloatParam * ServerCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_maxFaucetModifier; } @@ -233,9 +233,9 @@ FloatParam * ServerCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_approachTriggerRange; } @@ -247,9 +247,9 @@ FloatParam * ServerCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_maxMentalStates[index]; } @@ -261,9 +261,9 @@ FloatParam * ServerCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_mentalStatesDecay[index]; } @@ -271,7 +271,7 @@ FloatParam * ServerCreatureObjectTemplate::getFloatParam(const char *name, bool } else return ServerTangibleObjectTemplate::getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerCreatureObjectTemplate::getFloatParam BoolParam * ServerCreatureObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) @@ -282,9 +282,9 @@ BoolParam * ServerCreatureObjectTemplate::getBoolParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_canCreateAvatar; } @@ -292,7 +292,7 @@ BoolParam * ServerCreatureObjectTemplate::getBoolParam(const char *name, bool de } else return ServerTangibleObjectTemplate::getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerCreatureObjectTemplate::getBoolParam StringParam * ServerCreatureObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) @@ -303,9 +303,9 @@ StringParam * ServerCreatureObjectTemplate::getStringParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_defaultWeapon; } @@ -317,9 +317,9 @@ StringParam * ServerCreatureObjectTemplate::getStringParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_nameGeneratorType; } @@ -327,7 +327,7 @@ StringParam * ServerCreatureObjectTemplate::getStringParam(const char *name, boo } else return ServerTangibleObjectTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerCreatureObjectTemplate::getStringParam StringIdParam * ServerCreatureObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -361,7 +361,7 @@ StructParamOT * ServerCreatureObjectTemplate::getStructParamOT(const char *name, } else return ServerTangibleObjectTemplate::getStructParamOT(name, deepCheck, index); - return NULL; + return nullptr; } //ServerCreatureObjectTemplate::getStructParamOT TriggerVolumeParam * ServerCreatureObjectTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index) @@ -464,12 +464,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -549,7 +549,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_attribMods.begin(); iter != m_attribMods.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_attribMods.clear(); m_attribModsAppend = file.read_bool8(); diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerDraftSchematicObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerDraftSchematicObjectTemplate.cpp index 0bc765a5..53c05125 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerDraftSchematicObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerDraftSchematicObjectTemplate.cpp @@ -49,7 +49,7 @@ ServerDraftSchematicObjectTemplate::~ServerDraftSchematicObjectTemplate() for (iter = m_slots.begin(); iter != m_slots.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_slots.clear(); } @@ -58,7 +58,7 @@ ServerDraftSchematicObjectTemplate::~ServerDraftSchematicObjectTemplate() for (iter = m_skillCommands.begin(); iter != m_skillCommands.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_skillCommands.clear(); } @@ -67,7 +67,7 @@ ServerDraftSchematicObjectTemplate::~ServerDraftSchematicObjectTemplate() for (iter = m_manufactureScripts.begin(); iter != m_manufactureScripts.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_manufactureScripts.clear(); } @@ -119,10 +119,10 @@ Tag ServerDraftSchematicObjectTemplate::getTemplateVersion(void) const */ Tag ServerDraftSchematicObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerDraftSchematicObjectTemplate::getHighestTemplateVersion @@ -136,9 +136,9 @@ CompilerIntegerParam * ServerDraftSchematicObjectTemplate::getCompilerIntegerPar { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_category; } @@ -150,9 +150,9 @@ CompilerIntegerParam * ServerDraftSchematicObjectTemplate::getCompilerIntegerPar { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_itemsPerContainer; } @@ -160,7 +160,7 @@ CompilerIntegerParam * ServerDraftSchematicObjectTemplate::getCompilerIntegerPar } else return ServerIntangibleObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerDraftSchematicObjectTemplate::getCompilerIntegerParam FloatParam * ServerDraftSchematicObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -171,9 +171,9 @@ FloatParam * ServerDraftSchematicObjectTemplate::getFloatParam(const char *name, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_manufactureTime; } @@ -185,9 +185,9 @@ FloatParam * ServerDraftSchematicObjectTemplate::getFloatParam(const char *name, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_prototypeTime; } @@ -195,7 +195,7 @@ FloatParam * ServerDraftSchematicObjectTemplate::getFloatParam(const char *name, } else return ServerIntangibleObjectTemplate::getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerDraftSchematicObjectTemplate::getFloatParam BoolParam * ServerDraftSchematicObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) @@ -206,9 +206,9 @@ BoolParam * ServerDraftSchematicObjectTemplate::getBoolParam(const char *name, b { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_destroyIngredients; } @@ -216,7 +216,7 @@ BoolParam * ServerDraftSchematicObjectTemplate::getBoolParam(const char *name, b } else return ServerIntangibleObjectTemplate::getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerDraftSchematicObjectTemplate::getBoolParam StringParam * ServerDraftSchematicObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) @@ -227,9 +227,9 @@ StringParam * ServerDraftSchematicObjectTemplate::getStringParam(const char *nam { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_craftedObjectTemplate; } @@ -241,9 +241,9 @@ StringParam * ServerDraftSchematicObjectTemplate::getStringParam(const char *nam { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_crateObjectTemplate; } @@ -275,7 +275,7 @@ StringParam * ServerDraftSchematicObjectTemplate::getStringParam(const char *nam } else return ServerIntangibleObjectTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerDraftSchematicObjectTemplate::getStringParam StringIdParam * ServerDraftSchematicObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -309,7 +309,7 @@ StructParamOT * ServerDraftSchematicObjectTemplate::getStructParamOT(const char } else return ServerIntangibleObjectTemplate::getStructParamOT(name, deepCheck, index); - return NULL; + return nullptr; } //ServerDraftSchematicObjectTemplate::getStructParamOT TriggerVolumeParam * ServerDraftSchematicObjectTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index) @@ -418,12 +418,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -457,7 +457,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_slots.begin(); iter != m_slots.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_slots.clear(); m_slotsAppend = file.read_bool8(); @@ -476,7 +476,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_skillCommands.begin(); iter != m_skillCommands.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_skillCommands.clear(); m_skillCommandsAppend = file.read_bool8(); @@ -497,7 +497,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_manufactureScripts.begin(); iter != m_manufactureScripts.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_manufactureScripts.clear(); m_manufactureScriptsAppend = file.read_bool8(); @@ -672,7 +672,7 @@ ServerDraftSchematicObjectTemplate::_IngredientSlot::~_IngredientSlot() for (iter = m_options.begin(); iter != m_options.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_options.clear(); } @@ -719,9 +719,9 @@ FloatParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getFloatParam( { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_complexity; } @@ -729,7 +729,7 @@ FloatParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getFloatParam( } else return TpfTemplate::getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerDraftSchematicObjectTemplate::_IngredientSlot::getFloatParam BoolParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getBoolParam(const char *name, bool deepCheck, int index) @@ -740,9 +740,9 @@ BoolParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getBoolParam(co { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_optional; } @@ -750,7 +750,7 @@ BoolParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getBoolParam(co } else return TpfTemplate::getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerDraftSchematicObjectTemplate::_IngredientSlot::getBoolParam StringParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getStringParam(const char *name, bool deepCheck, int index) @@ -761,9 +761,9 @@ StringParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getStringPara { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_optionalSkillCommand; } @@ -775,9 +775,9 @@ StringParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getStringPara { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_appearance; } @@ -785,7 +785,7 @@ StringParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getStringPara } else return TpfTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerDraftSchematicObjectTemplate::_IngredientSlot::getStringParam StringIdParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getStringIdParam(const char *name, bool deepCheck, int index) @@ -796,9 +796,9 @@ StringIdParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getStringId { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_name; } @@ -806,7 +806,7 @@ StringIdParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getStringId } else return TpfTemplate::getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerDraftSchematicObjectTemplate::_IngredientSlot::getStringIdParam VectorParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getVectorParam(const char *name, bool deepCheck, int index) @@ -835,7 +835,7 @@ StructParamOT * ServerDraftSchematicObjectTemplate::_IngredientSlot::getStructPa } else return TpfTemplate::getStructParamOT(name, deepCheck, index); - return NULL; + return nullptr; } //ServerDraftSchematicObjectTemplate::_IngredientSlot::getStructParamOT TriggerVolumeParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getTriggerVolumeParam(const char *name, bool deepCheck, int index) @@ -921,7 +921,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_options.begin(); iter != m_options.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_options.clear(); m_optionsAppend = file.read_bool8(); diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerFactoryObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerFactoryObjectTemplate.cpp index cd7ab927..a4d8ae8d 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerFactoryObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerFactoryObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerFactoryObjectTemplate::getTemplateVersion(void) const */ Tag ServerFactoryObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerFactoryObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerFactoryObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerGroupObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerGroupObjectTemplate.cpp index 647b6606..a4c0367a 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerGroupObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerGroupObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerGroupObjectTemplate::getTemplateVersion(void) const */ Tag ServerGroupObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerGroupObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerGroupObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerGuildObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerGuildObjectTemplate.cpp index 446f3c34..b212df70 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerGuildObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerGuildObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerGuildObjectTemplate::getTemplateVersion(void) const */ Tag ServerGuildObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerGuildObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerGuildObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerHarvesterInstallationObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerHarvesterInstallationObjectTemplate.cpp index 7bfaaf19..6516811d 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerHarvesterInstallationObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerHarvesterInstallationObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerHarvesterInstallationObjectTemplate::getTemplateVersion(void) const */ Tag ServerHarvesterInstallationObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerHarvesterInstallationObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerHarvesterInstallationObjectTemplate::getHighestTemplateVersion @@ -103,9 +103,9 @@ CompilerIntegerParam * ServerHarvesterInstallationObjectTemplate::getCompilerInt { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_maxExtractionRate; } @@ -117,9 +117,9 @@ CompilerIntegerParam * ServerHarvesterInstallationObjectTemplate::getCompilerInt { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_currentExtractionRate; } @@ -131,9 +131,9 @@ CompilerIntegerParam * ServerHarvesterInstallationObjectTemplate::getCompilerInt { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_maxHopperSize; } @@ -141,7 +141,7 @@ CompilerIntegerParam * ServerHarvesterInstallationObjectTemplate::getCompilerInt } else return ServerInstallationObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerHarvesterInstallationObjectTemplate::getCompilerIntegerParam FloatParam * ServerHarvesterInstallationObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -162,9 +162,9 @@ StringParam * ServerHarvesterInstallationObjectTemplate::getStringParam(const ch { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_masterClassName; } @@ -172,7 +172,7 @@ StringParam * ServerHarvesterInstallationObjectTemplate::getStringParam(const ch } else return ServerInstallationObjectTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerHarvesterInstallationObjectTemplate::getStringParam StringIdParam * ServerHarvesterInstallationObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -255,12 +255,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerInstallationObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerInstallationObjectTemplate.cpp index efc11fee..6525ffe2 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerInstallationObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerInstallationObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerInstallationObjectTemplate::getTemplateVersion(void) const */ Tag ServerInstallationObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerInstallationObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerInstallationObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerIntangibleObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerIntangibleObjectTemplate.cpp index efdbfac9..43781914 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerIntangibleObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerIntangibleObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerIntangibleObjectTemplate::getTemplateVersion(void) const */ Tag ServerIntangibleObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerIntangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerIntangibleObjectTemplate::getHighestTemplateVersion @@ -103,9 +103,9 @@ CompilerIntegerParam * ServerIntangibleObjectTemplate::getCompilerIntegerParam(c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_count; } @@ -113,7 +113,7 @@ CompilerIntegerParam * ServerIntangibleObjectTemplate::getCompilerIntegerParam(c } else return ServerObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerIntangibleObjectTemplate::getCompilerIntegerParam FloatParam * ServerIntangibleObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -211,12 +211,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -316,7 +316,7 @@ ServerIntangibleObjectTemplate::_Ingredient::~_Ingredient() for (iter = m_ingredients.begin(); iter != m_ingredients.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_ingredients.clear(); } @@ -358,9 +358,9 @@ CompilerIntegerParam * ServerIntangibleObjectTemplate::_Ingredient::getCompilerI { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_ingredientType; } @@ -368,7 +368,7 @@ CompilerIntegerParam * ServerIntangibleObjectTemplate::_Ingredient::getCompilerI } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerIntangibleObjectTemplate::_Ingredient::getCompilerIntegerParam FloatParam * ServerIntangibleObjectTemplate::_Ingredient::getFloatParam(const char *name, bool deepCheck, int index) @@ -379,9 +379,9 @@ FloatParam * ServerIntangibleObjectTemplate::_Ingredient::getFloatParam(const ch { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_complexity; } @@ -389,7 +389,7 @@ FloatParam * ServerIntangibleObjectTemplate::_Ingredient::getFloatParam(const ch } else return TpfTemplate::getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerIntangibleObjectTemplate::_Ingredient::getFloatParam BoolParam * ServerIntangibleObjectTemplate::_Ingredient::getBoolParam(const char *name, bool deepCheck, int index) @@ -405,9 +405,9 @@ StringParam * ServerIntangibleObjectTemplate::_Ingredient::getStringParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_skillCommand; } @@ -415,7 +415,7 @@ StringParam * ServerIntangibleObjectTemplate::_Ingredient::getStringParam(const } else return TpfTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerIntangibleObjectTemplate::_Ingredient::getStringParam StringIdParam * ServerIntangibleObjectTemplate::_Ingredient::getStringIdParam(const char *name, bool deepCheck, int index) @@ -449,7 +449,7 @@ StructParamOT * ServerIntangibleObjectTemplate::_Ingredient::getStructParamOT(co } else return TpfTemplate::getStructParamOT(name, deepCheck, index); - return NULL; + return nullptr; } //ServerIntangibleObjectTemplate::_Ingredient::getStructParamOT TriggerVolumeParam * ServerIntangibleObjectTemplate::_Ingredient::getTriggerVolumeParam(const char *name, bool deepCheck, int index) @@ -533,7 +533,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_ingredients.begin(); iter != m_ingredients.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_ingredients.clear(); m_ingredientsAppend = file.read_bool8(); @@ -669,9 +669,9 @@ CompilerIntegerParam * ServerIntangibleObjectTemplate::_SchematicAttribute::getC { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_value; } @@ -679,7 +679,7 @@ CompilerIntegerParam * ServerIntangibleObjectTemplate::_SchematicAttribute::getC } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerIntangibleObjectTemplate::_SchematicAttribute::getCompilerIntegerParam FloatParam * ServerIntangibleObjectTemplate::_SchematicAttribute::getFloatParam(const char *name, bool deepCheck, int index) @@ -705,9 +705,9 @@ StringIdParam * ServerIntangibleObjectTemplate::_SchematicAttribute::getStringId { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_name; } @@ -715,7 +715,7 @@ StringIdParam * ServerIntangibleObjectTemplate::_SchematicAttribute::getStringId } else return TpfTemplate::getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerIntangibleObjectTemplate::_SchematicAttribute::getStringIdParam VectorParam * ServerIntangibleObjectTemplate::_SchematicAttribute::getVectorParam(const char *name, bool deepCheck, int index) @@ -889,9 +889,9 @@ CompilerIntegerParam * ServerIntangibleObjectTemplate::_SimpleIngredient::getCom { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_count; } @@ -899,7 +899,7 @@ CompilerIntegerParam * ServerIntangibleObjectTemplate::_SimpleIngredient::getCom } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerIntangibleObjectTemplate::_SimpleIngredient::getCompilerIntegerParam FloatParam * ServerIntangibleObjectTemplate::_SimpleIngredient::getFloatParam(const char *name, bool deepCheck, int index) @@ -920,9 +920,9 @@ StringParam * ServerIntangibleObjectTemplate::_SimpleIngredient::getStringParam( { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_ingredient; } @@ -930,7 +930,7 @@ StringParam * ServerIntangibleObjectTemplate::_SimpleIngredient::getStringParam( } else return TpfTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerIntangibleObjectTemplate::_SimpleIngredient::getStringParam StringIdParam * ServerIntangibleObjectTemplate::_SimpleIngredient::getStringIdParam(const char *name, bool deepCheck, int index) @@ -941,9 +941,9 @@ StringIdParam * ServerIntangibleObjectTemplate::_SimpleIngredient::getStringIdPa { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_name; } @@ -951,7 +951,7 @@ StringIdParam * ServerIntangibleObjectTemplate::_SimpleIngredient::getStringIdPa } else return TpfTemplate::getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerIntangibleObjectTemplate::_SimpleIngredient::getStringIdParam VectorParam * ServerIntangibleObjectTemplate::_SimpleIngredient::getVectorParam(const char *name, bool deepCheck, int index) diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerJediManagerObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerJediManagerObjectTemplate.cpp index 34919f61..acecbef1 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerJediManagerObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerJediManagerObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerJediManagerObjectTemplate::getTemplateVersion(void) const */ Tag ServerJediManagerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerJediManagerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerJediManagerObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerManufactureInstallationObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerManufactureInstallationObjectTemplate.cpp index 82335f44..1747392d 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerManufactureInstallationObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerManufactureInstallationObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerManufactureInstallationObjectTemplate::getTemplateVersion(void) const */ Tag ServerManufactureInstallationObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerManufactureInstallationObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerManufactureInstallationObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerManufactureSchematicObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerManufactureSchematicObjectTemplate.cpp index 54bbda83..73735880 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerManufactureSchematicObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerManufactureSchematicObjectTemplate.cpp @@ -47,7 +47,7 @@ ServerManufactureSchematicObjectTemplate::~ServerManufactureSchematicObjectTempl for (iter = m_ingredients.begin(); iter != m_ingredients.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_ingredients.clear(); } @@ -56,7 +56,7 @@ ServerManufactureSchematicObjectTemplate::~ServerManufactureSchematicObjectTempl for (iter = m_attributes.begin(); iter != m_attributes.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_attributes.clear(); } @@ -108,10 +108,10 @@ Tag ServerManufactureSchematicObjectTemplate::getTemplateVersion(void) const */ Tag ServerManufactureSchematicObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerManufactureSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerManufactureSchematicObjectTemplate::getHighestTemplateVersion @@ -125,9 +125,9 @@ CompilerIntegerParam * ServerManufactureSchematicObjectTemplate::getCompilerInte { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_itemCount; } @@ -135,7 +135,7 @@ CompilerIntegerParam * ServerManufactureSchematicObjectTemplate::getCompilerInte } else return ServerIntangibleObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerManufactureSchematicObjectTemplate::getCompilerIntegerParam FloatParam * ServerManufactureSchematicObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -156,9 +156,9 @@ StringParam * ServerManufactureSchematicObjectTemplate::getStringParam(const cha { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_draftSchematic; } @@ -170,9 +170,9 @@ StringParam * ServerManufactureSchematicObjectTemplate::getStringParam(const cha { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_creator; } @@ -180,7 +180,7 @@ StringParam * ServerManufactureSchematicObjectTemplate::getStringParam(const cha } else return ServerIntangibleObjectTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerManufactureSchematicObjectTemplate::getStringParam StringIdParam * ServerManufactureSchematicObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -226,7 +226,7 @@ StructParamOT * ServerManufactureSchematicObjectTemplate::getStructParamOT(const } else return ServerIntangibleObjectTemplate::getStructParamOT(name, deepCheck, index); - return NULL; + return nullptr; } //ServerManufactureSchematicObjectTemplate::getStructParamOT TriggerVolumeParam * ServerManufactureSchematicObjectTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index) @@ -324,12 +324,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -361,7 +361,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_ingredients.begin(); iter != m_ingredients.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_ingredients.clear(); m_ingredientsAppend = file.read_bool8(); @@ -382,7 +382,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_attributes.begin(); iter != m_attributes.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_attributes.clear(); m_attributesAppend = file.read_bool8(); @@ -563,9 +563,9 @@ StringIdParam * ServerManufactureSchematicObjectTemplate::_IngredientSlot::getSt { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_name; } @@ -573,7 +573,7 @@ StringIdParam * ServerManufactureSchematicObjectTemplate::_IngredientSlot::getSt } else return TpfTemplate::getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerManufactureSchematicObjectTemplate::_IngredientSlot::getStringIdParam VectorParam * ServerManufactureSchematicObjectTemplate::_IngredientSlot::getVectorParam(const char *name, bool deepCheck, int index) @@ -594,9 +594,9 @@ StructParamOT * ServerManufactureSchematicObjectTemplate::_IngredientSlot::getSt { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStructParamOT(name, deepCheck, index); - return NULL; + return nullptr; } return &m_ingredient; } @@ -604,7 +604,7 @@ StructParamOT * ServerManufactureSchematicObjectTemplate::_IngredientSlot::getSt } else return TpfTemplate::getStructParamOT(name, deepCheck, index); - return NULL; + return nullptr; } //ServerManufactureSchematicObjectTemplate::_IngredientSlot::getStructParamOT TriggerVolumeParam * ServerManufactureSchematicObjectTemplate::_IngredientSlot::getTriggerVolumeParam(const char *name, bool deepCheck, int index) diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerMissionObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerMissionObjectTemplate.cpp index 39ab71f1..240882ac 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerMissionObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerMissionObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerMissionObjectTemplate::getTemplateVersion(void) const */ Tag ServerMissionObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerMissionObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerMissionObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerObjectTemplate.cpp index 0307ce8c..5df8660b 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerObjectTemplate.cpp @@ -55,7 +55,7 @@ ServerObjectTemplate::~ServerObjectTemplate() for (iter = m_scripts.begin(); iter != m_scripts.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_scripts.clear(); } @@ -64,7 +64,7 @@ ServerObjectTemplate::~ServerObjectTemplate() for (iter = m_visibleFlags.begin(); iter != m_visibleFlags.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_visibleFlags.clear(); } @@ -73,7 +73,7 @@ ServerObjectTemplate::~ServerObjectTemplate() for (iter = m_deleteFlags.begin(); iter != m_deleteFlags.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_deleteFlags.clear(); } @@ -82,7 +82,7 @@ ServerObjectTemplate::~ServerObjectTemplate() for (iter = m_moveFlags.begin(); iter != m_moveFlags.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_moveFlags.clear(); } @@ -91,7 +91,7 @@ ServerObjectTemplate::~ServerObjectTemplate() for (iter = m_contents.begin(); iter != m_contents.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_contents.clear(); } @@ -100,7 +100,7 @@ ServerObjectTemplate::~ServerObjectTemplate() for (iter = m_xpPoints.begin(); iter != m_xpPoints.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_xpPoints.clear(); } @@ -152,10 +152,10 @@ Tag ServerObjectTemplate::getTemplateVersion(void) const */ Tag ServerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerObjectTemplate::getHighestTemplateVersion @@ -169,9 +169,9 @@ CompilerIntegerParam * ServerObjectTemplate::getCompilerIntegerParam(const char { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_volume; } @@ -219,9 +219,9 @@ CompilerIntegerParam * ServerObjectTemplate::getCompilerIntegerParam(const char { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_tintIndex; } @@ -229,7 +229,7 @@ CompilerIntegerParam * ServerObjectTemplate::getCompilerIntegerParam(const char } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerObjectTemplate::getCompilerIntegerParam FloatParam * ServerObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -240,9 +240,9 @@ FloatParam * ServerObjectTemplate::getFloatParam(const char *name, bool deepChec { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_complexity; } @@ -254,9 +254,9 @@ FloatParam * ServerObjectTemplate::getFloatParam(const char *name, bool deepChec { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_updateRanges[index]; } @@ -264,7 +264,7 @@ FloatParam * ServerObjectTemplate::getFloatParam(const char *name, bool deepChec } else return TpfTemplate::getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerObjectTemplate::getFloatParam BoolParam * ServerObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) @@ -275,9 +275,9 @@ BoolParam * ServerObjectTemplate::getBoolParam(const char *name, bool deepCheck, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_invulnerable; } @@ -289,9 +289,9 @@ BoolParam * ServerObjectTemplate::getBoolParam(const char *name, bool deepCheck, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_persistByDefault; } @@ -303,9 +303,9 @@ BoolParam * ServerObjectTemplate::getBoolParam(const char *name, bool deepCheck, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_persistContents; } @@ -313,7 +313,7 @@ BoolParam * ServerObjectTemplate::getBoolParam(const char *name, bool deepCheck, } else return TpfTemplate::getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerObjectTemplate::getBoolParam StringParam * ServerObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) @@ -324,9 +324,9 @@ StringParam * ServerObjectTemplate::getStringParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_sharedTemplate; } @@ -346,7 +346,7 @@ StringParam * ServerObjectTemplate::getStringParam(const char *name, bool deepCh } else return TpfTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerObjectTemplate::getStringParam StringIdParam * ServerObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -367,9 +367,9 @@ DynamicVariableParam * ServerObjectTemplate::getDynamicVariableParam(const char { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getDynamicVariableParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_objvars; } @@ -377,7 +377,7 @@ DynamicVariableParam * ServerObjectTemplate::getDynamicVariableParam(const char } else return TpfTemplate::getDynamicVariableParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerObjectTemplate::getDynamicVariableParam StructParamOT * ServerObjectTemplate::getStructParamOT(const char *name, bool deepCheck, int index) @@ -408,7 +408,7 @@ StructParamOT * ServerObjectTemplate::getStructParamOT(const char *name, bool de } else return TpfTemplate::getStructParamOT(name, deepCheck, index); - return NULL; + return nullptr; } //ServerObjectTemplate::getStructParamOT TriggerVolumeParam * ServerObjectTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index) @@ -562,12 +562,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -597,7 +597,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_scripts.begin(); iter != m_scripts.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_scripts.clear(); m_scriptsAppend = file.read_bool8(); @@ -620,7 +620,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_visibleFlags.begin(); iter != m_visibleFlags.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_visibleFlags.clear(); m_visibleFlagsAppend = file.read_bool8(); @@ -639,7 +639,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_deleteFlags.begin(); iter != m_deleteFlags.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_deleteFlags.clear(); m_deleteFlagsAppend = file.read_bool8(); @@ -658,7 +658,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_moveFlags.begin(); iter != m_moveFlags.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_moveFlags.clear(); m_moveFlagsAppend = file.read_bool8(); @@ -697,7 +697,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_contents.begin(); iter != m_contents.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_contents.clear(); m_contentsAppend = file.read_bool8(); @@ -716,7 +716,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_xpPoints.begin(); iter != m_xpPoints.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_xpPoints.clear(); m_xpPointsAppend = file.read_bool8(); @@ -980,9 +980,9 @@ CompilerIntegerParam * ServerObjectTemplate::_AttribMod::getCompilerIntegerParam { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_target; } @@ -994,9 +994,9 @@ CompilerIntegerParam * ServerObjectTemplate::_AttribMod::getCompilerIntegerParam { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_value; } @@ -1004,7 +1004,7 @@ CompilerIntegerParam * ServerObjectTemplate::_AttribMod::getCompilerIntegerParam } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerObjectTemplate::_AttribMod::getCompilerIntegerParam FloatParam * ServerObjectTemplate::_AttribMod::getFloatParam(const char *name, bool deepCheck, int index) @@ -1015,9 +1015,9 @@ FloatParam * ServerObjectTemplate::_AttribMod::getFloatParam(const char *name, b { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_time; } @@ -1029,9 +1029,9 @@ FloatParam * ServerObjectTemplate::_AttribMod::getFloatParam(const char *name, b { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_timeAtValue; } @@ -1043,9 +1043,9 @@ FloatParam * ServerObjectTemplate::_AttribMod::getFloatParam(const char *name, b { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_decay; } @@ -1053,7 +1053,7 @@ FloatParam * ServerObjectTemplate::_AttribMod::getFloatParam(const char *name, b } else return TpfTemplate::getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerObjectTemplate::_AttribMod::getFloatParam BoolParam * ServerObjectTemplate::_AttribMod::getBoolParam(const char *name, bool deepCheck, int index) @@ -1276,9 +1276,9 @@ BoolParam * ServerObjectTemplate::_Contents::getBoolParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_equipObject; } @@ -1286,7 +1286,7 @@ BoolParam * ServerObjectTemplate::_Contents::getBoolParam(const char *name, bool } else return TpfTemplate::getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerObjectTemplate::_Contents::getBoolParam StringParam * ServerObjectTemplate::_Contents::getStringParam(const char *name, bool deepCheck, int index) @@ -1297,9 +1297,9 @@ StringParam * ServerObjectTemplate::_Contents::getStringParam(const char *name, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_slotName; } @@ -1311,9 +1311,9 @@ StringParam * ServerObjectTemplate::_Contents::getStringParam(const char *name, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_content; } @@ -1321,7 +1321,7 @@ StringParam * ServerObjectTemplate::_Contents::getStringParam(const char *name, } else return TpfTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerObjectTemplate::_Contents::getStringParam StringIdParam * ServerObjectTemplate::_Contents::getStringIdParam(const char *name, bool deepCheck, int index) @@ -1508,9 +1508,9 @@ CompilerIntegerParam * ServerObjectTemplate::_MentalStateMod::getCompilerInteger { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_target; } @@ -1518,7 +1518,7 @@ CompilerIntegerParam * ServerObjectTemplate::_MentalStateMod::getCompilerInteger } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerObjectTemplate::_MentalStateMod::getCompilerIntegerParam FloatParam * ServerObjectTemplate::_MentalStateMod::getFloatParam(const char *name, bool deepCheck, int index) @@ -1529,9 +1529,9 @@ FloatParam * ServerObjectTemplate::_MentalStateMod::getFloatParam(const char *na { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_value; } @@ -1543,9 +1543,9 @@ FloatParam * ServerObjectTemplate::_MentalStateMod::getFloatParam(const char *na { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_time; } @@ -1557,9 +1557,9 @@ FloatParam * ServerObjectTemplate::_MentalStateMod::getFloatParam(const char *na { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_timeAtValue; } @@ -1571,9 +1571,9 @@ FloatParam * ServerObjectTemplate::_MentalStateMod::getFloatParam(const char *na { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_decay; } @@ -1581,7 +1581,7 @@ FloatParam * ServerObjectTemplate::_MentalStateMod::getFloatParam(const char *na } else return TpfTemplate::getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerObjectTemplate::_MentalStateMod::getFloatParam BoolParam * ServerObjectTemplate::_MentalStateMod::getBoolParam(const char *name, bool deepCheck, int index) @@ -1794,9 +1794,9 @@ CompilerIntegerParam * ServerObjectTemplate::_Xp::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_type; } @@ -1808,9 +1808,9 @@ CompilerIntegerParam * ServerObjectTemplate::_Xp::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_level; } @@ -1822,9 +1822,9 @@ CompilerIntegerParam * ServerObjectTemplate::_Xp::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_value; } @@ -1832,7 +1832,7 @@ CompilerIntegerParam * ServerObjectTemplate::_Xp::getCompilerIntegerParam(const } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerObjectTemplate::_Xp::getCompilerIntegerParam FloatParam * ServerObjectTemplate::_Xp::getFloatParam(const char *name, bool deepCheck, int index) diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerPlanetObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerPlanetObjectTemplate.cpp index 91f52345..fc998c4a 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerPlanetObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerPlanetObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerPlanetObjectTemplate::getTemplateVersion(void) const */ Tag ServerPlanetObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerPlanetObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerPlanetObjectTemplate::getHighestTemplateVersion @@ -118,9 +118,9 @@ StringParam * ServerPlanetObjectTemplate::getStringParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_planetName; } @@ -128,7 +128,7 @@ StringParam * ServerPlanetObjectTemplate::getStringParam(const char *name, bool } else return ServerUniverseObjectTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerPlanetObjectTemplate::getStringParam StringIdParam * ServerPlanetObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -211,12 +211,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerPlayerObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerPlayerObjectTemplate.cpp index 2824f83a..bd678142 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerPlayerObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerPlayerObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerPlayerObjectTemplate::getTemplateVersion(void) const */ Tag ServerPlayerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerPlayerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerPlayerObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerPlayerQuestObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerPlayerQuestObjectTemplate.cpp index 0c05dd79..36c23628 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerPlayerQuestObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerPlayerQuestObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerPlayerQuestObjectTemplate::getTemplateVersion(void) const */ Tag ServerPlayerQuestObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerPlayerQuestObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerPlayerQuestObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerResourceClassObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerResourceClassObjectTemplate.cpp index 2df53960..0a5c1bac 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerResourceClassObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerResourceClassObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerResourceClassObjectTemplate::getTemplateVersion(void) const */ Tag ServerResourceClassObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerResourceClassObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerResourceClassObjectTemplate::getHighestTemplateVersion @@ -103,9 +103,9 @@ CompilerIntegerParam * ServerResourceClassObjectTemplate::getCompilerIntegerPara { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_numTypes; } @@ -117,9 +117,9 @@ CompilerIntegerParam * ServerResourceClassObjectTemplate::getCompilerIntegerPara { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_minTypes; } @@ -131,9 +131,9 @@ CompilerIntegerParam * ServerResourceClassObjectTemplate::getCompilerIntegerPara { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_maxTypes; } @@ -141,7 +141,7 @@ CompilerIntegerParam * ServerResourceClassObjectTemplate::getCompilerIntegerPara } else return ServerUniverseObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerResourceClassObjectTemplate::getCompilerIntegerParam FloatParam * ServerResourceClassObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -162,9 +162,9 @@ StringParam * ServerResourceClassObjectTemplate::getStringParam(const char *name { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_resourceClassName; } @@ -176,9 +176,9 @@ StringParam * ServerResourceClassObjectTemplate::getStringParam(const char *name { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_parentClass; } @@ -186,7 +186,7 @@ StringParam * ServerResourceClassObjectTemplate::getStringParam(const char *name } else return ServerUniverseObjectTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerResourceClassObjectTemplate::getStringParam StringIdParam * ServerResourceClassObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -269,12 +269,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerResourceContainerObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerResourceContainerObjectTemplate.cpp index c5e367cc..c4008c2f 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerResourceContainerObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerResourceContainerObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerResourceContainerObjectTemplate::getTemplateVersion(void) const */ Tag ServerResourceContainerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerResourceContainerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerResourceContainerObjectTemplate::getHighestTemplateVersion @@ -103,9 +103,9 @@ CompilerIntegerParam * ServerResourceContainerObjectTemplate::getCompilerInteger { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_maxResources; } @@ -113,7 +113,7 @@ CompilerIntegerParam * ServerResourceContainerObjectTemplate::getCompilerInteger } else return ServerTangibleObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerResourceContainerObjectTemplate::getCompilerIntegerParam FloatParam * ServerResourceContainerObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -211,12 +211,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerResourcePoolObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerResourcePoolObjectTemplate.cpp index 6aa324d6..15ad8ebc 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerResourcePoolObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerResourcePoolObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerResourcePoolObjectTemplate::getTemplateVersion(void) const */ Tag ServerResourcePoolObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerResourcePoolObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerResourcePoolObjectTemplate::getHighestTemplateVersion @@ -103,9 +103,9 @@ CompilerIntegerParam * ServerResourcePoolObjectTemplate::getCompilerIntegerParam { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_mapSeed; } @@ -117,9 +117,9 @@ CompilerIntegerParam * ServerResourcePoolObjectTemplate::getCompilerIntegerParam { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_amountRemaining; } @@ -127,7 +127,7 @@ CompilerIntegerParam * ServerResourcePoolObjectTemplate::getCompilerIntegerParam } else return ServerUniverseObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerResourcePoolObjectTemplate::getCompilerIntegerParam FloatParam * ServerResourcePoolObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -225,12 +225,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerResourceTypeObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerResourceTypeObjectTemplate.cpp index dd44c902..7ed9954d 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerResourceTypeObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerResourceTypeObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerResourceTypeObjectTemplate::getTemplateVersion(void) const */ Tag ServerResourceTypeObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerResourceTypeObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerResourceTypeObjectTemplate::getHighestTemplateVersion @@ -118,9 +118,9 @@ StringParam * ServerResourceTypeObjectTemplate::getStringParam(const char *name, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_resourceName; } @@ -128,7 +128,7 @@ StringParam * ServerResourceTypeObjectTemplate::getStringParam(const char *name, } else return ServerUniverseObjectTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerResourceTypeObjectTemplate::getStringParam StringIdParam * ServerResourceTypeObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -211,12 +211,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerShipObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerShipObjectTemplate.cpp index 247bda11..c1bb613c 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerShipObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerShipObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerShipObjectTemplate::getTemplateVersion(void) const */ Tag ServerShipObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerShipObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerShipObjectTemplate::getHighestTemplateVersion @@ -118,9 +118,9 @@ StringParam * ServerShipObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_shipType; } @@ -128,7 +128,7 @@ StringParam * ServerShipObjectTemplate::getStringParam(const char *name, bool de } else return ServerTangibleObjectTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerShipObjectTemplate::getStringParam StringIdParam * ServerShipObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -211,12 +211,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerStaticObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerStaticObjectTemplate.cpp index fb078b58..48fe0b50 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerStaticObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerStaticObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerStaticObjectTemplate::getTemplateVersion(void) const */ Tag ServerStaticObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerStaticObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerStaticObjectTemplate::getHighestTemplateVersion @@ -113,9 +113,9 @@ BoolParam * ServerStaticObjectTemplate::getBoolParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_clientOnlyBuildout; } @@ -123,7 +123,7 @@ BoolParam * ServerStaticObjectTemplate::getBoolParam(const char *name, bool deep } else return ServerObjectTemplate::getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerStaticObjectTemplate::getBoolParam StringParam * ServerStaticObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) @@ -211,12 +211,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerTangibleObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerTangibleObjectTemplate.cpp index 5604b102..52fd36b3 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerTangibleObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerTangibleObjectTemplate.cpp @@ -45,7 +45,7 @@ ServerTangibleObjectTemplate::~ServerTangibleObjectTemplate() for (iter = m_triggerVolumes.begin(); iter != m_triggerVolumes.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_triggerVolumes.clear(); } @@ -97,10 +97,10 @@ Tag ServerTangibleObjectTemplate::getTemplateVersion(void) const */ Tag ServerTangibleObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerTangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerTangibleObjectTemplate::getHighestTemplateVersion @@ -114,9 +114,9 @@ CompilerIntegerParam * ServerTangibleObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_combatSkeleton; } @@ -128,9 +128,9 @@ CompilerIntegerParam * ServerTangibleObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_maxHitPoints; } @@ -142,9 +142,9 @@ CompilerIntegerParam * ServerTangibleObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_interestRadius; } @@ -156,9 +156,9 @@ CompilerIntegerParam * ServerTangibleObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_count; } @@ -170,9 +170,9 @@ CompilerIntegerParam * ServerTangibleObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_condition; } @@ -180,7 +180,7 @@ CompilerIntegerParam * ServerTangibleObjectTemplate::getCompilerIntegerParam(con } else return ServerObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerTangibleObjectTemplate::getCompilerIntegerParam FloatParam * ServerTangibleObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -196,9 +196,9 @@ BoolParam * ServerTangibleObjectTemplate::getBoolParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_wantSawAttackTriggers; } @@ -206,7 +206,7 @@ BoolParam * ServerTangibleObjectTemplate::getBoolParam(const char *name, bool de } else return ServerObjectTemplate::getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerTangibleObjectTemplate::getBoolParam StringParam * ServerTangibleObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) @@ -217,9 +217,9 @@ StringParam * ServerTangibleObjectTemplate::getStringParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_armor; } @@ -227,7 +227,7 @@ StringParam * ServerTangibleObjectTemplate::getStringParam(const char *name, boo } else return ServerObjectTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerTangibleObjectTemplate::getStringParam StringIdParam * ServerTangibleObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -266,7 +266,7 @@ TriggerVolumeParam * ServerTangibleObjectTemplate::getTriggerVolumeParam(const c } else return ServerObjectTemplate::getTriggerVolumeParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerTangibleObjectTemplate::getTriggerVolumeParam void ServerTangibleObjectTemplate::initStructParamOT(StructParamOT ¶m, const char *name) @@ -341,12 +341,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -374,7 +374,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_triggerVolumes.begin(); iter != m_triggerVolumes.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_triggerVolumes.clear(); m_triggerVolumesAppend = file.read_bool8(); diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerTokenObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerTokenObjectTemplate.cpp index b63a3f63..a3cac916 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerTokenObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerTokenObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerTokenObjectTemplate::getTemplateVersion(void) const */ Tag ServerTokenObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerTokenObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerTokenObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerUberObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerUberObjectTemplate.cpp index 20c3f1f8..6aba5832 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerUberObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerUberObjectTemplate.cpp @@ -87,7 +87,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_intListSimple.begin(); iter != m_intListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -95,7 +95,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_intListWeightedList.begin(); iter != m_intListWeightedList.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -103,7 +103,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_intListRandomRange.begin(); iter != m_intListRandomRange.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -111,7 +111,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_intListDiceRoll.begin(); iter != m_intListDiceRoll.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -119,7 +119,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_floatListSimple.begin(); iter != m_floatListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -127,7 +127,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_floatListWeightedList.begin(); iter != m_floatListWeightedList.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -135,7 +135,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_floatListRandomRange.begin(); iter != m_floatListRandomRange.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -143,7 +143,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_enumListIndexed.begin(); iter != m_enumListIndexed.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -151,7 +151,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_enumListWeightedList.begin(); iter != m_enumListWeightedList.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -159,7 +159,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_stringIdListSimple.begin(); iter != m_stringIdListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -167,7 +167,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_stringIdListWeightedList.begin(); iter != m_stringIdListWeightedList.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -175,7 +175,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_stringListSimple.begin(); iter != m_stringListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -183,7 +183,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_stringListWeightedList.begin(); iter != m_stringListWeightedList.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -191,7 +191,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_triggerVolumeList.begin(); iter != m_triggerVolumeList.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -199,7 +199,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_triggerVolumesListWeightedList.begin(); iter != m_triggerVolumesListWeightedList.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -207,7 +207,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_boolListDerived.begin(); iter != m_boolListDerived.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -215,7 +215,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_boolListSimple.begin(); iter != m_boolListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -223,7 +223,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_boolListWeightedList.begin(); iter != m_boolListWeightedList.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -231,7 +231,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_vectorListSimple.begin(); iter != m_vectorListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -239,7 +239,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_filenameListSimple.begin(); iter != m_filenameListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -247,7 +247,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_templateListSimple.begin(); iter != m_templateListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -255,7 +255,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_structListSimple.begin(); iter != m_structListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } //@END TFD CLEANUP @@ -306,10 +306,10 @@ Tag ServerUberObjectTemplate::getTemplateVersion(void) const */ Tag ServerUberObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerUberObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerUberObjectTemplate::getHighestTemplateVersion @@ -323,9 +323,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intAtDerived; } @@ -337,9 +337,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intSimple; } @@ -351,9 +351,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intSimpleDeltaPositive; } @@ -365,9 +365,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intSimpleDeltaNegative; } @@ -379,9 +379,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intSimpleDeltaPositivePercent; } @@ -393,9 +393,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intSimpleDeltaNegativePercent; } @@ -407,9 +407,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intWeightedList; } @@ -421,9 +421,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intWeightedListDeltaPositive; } @@ -435,9 +435,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intWeightedListDeltaNegative; } @@ -449,9 +449,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intWeightedListDeltaPositivePercent; } @@ -463,9 +463,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intWeightedListDeltaNegativePercent; } @@ -477,9 +477,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intRandomRange1; } @@ -491,9 +491,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intRandomRange2; } @@ -505,9 +505,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intRandomRange3; } @@ -519,9 +519,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intRandomRange4; } @@ -533,9 +533,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intDiceRoll1; } @@ -547,9 +547,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intDiceRoll2; } @@ -609,9 +609,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_enumIndexedByEnumSingle[index]; } @@ -623,9 +623,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_enumIndexedByEnumWeightedList[index]; } @@ -661,9 +661,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_integerArray[index]; } @@ -671,7 +671,7 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerUberObjectTemplate::getCompilerIntegerParam FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -682,9 +682,9 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_floatAtDerived; } @@ -696,9 +696,9 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_floatSimple; } @@ -710,9 +710,9 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_floatSimpleDeltaPositive; } @@ -724,9 +724,9 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_floatSimpleDeltaNegative; } @@ -738,9 +738,9 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_floatSimpleDeltaPositivePercent; } @@ -752,9 +752,9 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_floatSimpleDeltaNegativePercent; } @@ -766,9 +766,9 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_floatWeightedList; } @@ -780,9 +780,9 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_floatRandomRange1; } @@ -794,9 +794,9 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_floatRandomRange2; } @@ -808,9 +808,9 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_floatRandomRange3; } @@ -822,9 +822,9 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_floatRandomRange4; } @@ -872,9 +872,9 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_floatArray[index]; } @@ -882,7 +882,7 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep } else return TpfTemplate::getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerUberObjectTemplate::getFloatParam BoolParam * ServerUberObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) @@ -893,9 +893,9 @@ BoolParam * ServerUberObjectTemplate::getBoolParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_boolDerived; } @@ -907,9 +907,9 @@ BoolParam * ServerUberObjectTemplate::getBoolParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_boolSimple; } @@ -921,9 +921,9 @@ BoolParam * ServerUberObjectTemplate::getBoolParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_boolWeightedList; } @@ -971,9 +971,9 @@ BoolParam * ServerUberObjectTemplate::getBoolParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_boolArray[index]; } @@ -981,7 +981,7 @@ BoolParam * ServerUberObjectTemplate::getBoolParam(const char *name, bool deepCh } else return TpfTemplate::getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerUberObjectTemplate::getBoolParam StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) @@ -992,9 +992,9 @@ StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_stringDerived; } @@ -1006,9 +1006,9 @@ StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_stringSimple; } @@ -1020,9 +1020,9 @@ StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_stringWeightedList; } @@ -1058,9 +1058,9 @@ StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_filenameAtDerived; } @@ -1072,9 +1072,9 @@ StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_filenameSimple; } @@ -1086,9 +1086,9 @@ StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_filenameWeightedList; } @@ -1112,9 +1112,9 @@ StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_templateDerived; } @@ -1126,9 +1126,9 @@ StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_templateSimple; } @@ -1140,9 +1140,9 @@ StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_templateWeightedList; } @@ -1166,9 +1166,9 @@ StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_stringArray[index]; } @@ -1180,9 +1180,9 @@ StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_fileNameArray[index]; } @@ -1190,7 +1190,7 @@ StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool de } else return TpfTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerUberObjectTemplate::getStringParam StringIdParam * ServerUberObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -1201,9 +1201,9 @@ StringIdParam * ServerUberObjectTemplate::getStringIdParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_stringIdDerived; } @@ -1215,9 +1215,9 @@ StringIdParam * ServerUberObjectTemplate::getStringIdParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_stringIdSimple; } @@ -1229,9 +1229,9 @@ StringIdParam * ServerUberObjectTemplate::getStringIdParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_stringIdWeightedList; } @@ -1267,9 +1267,9 @@ StringIdParam * ServerUberObjectTemplate::getStringIdParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_stringIdArray[index]; } @@ -1277,7 +1277,7 @@ StringIdParam * ServerUberObjectTemplate::getStringIdParam(const char *name, boo } else return TpfTemplate::getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerUberObjectTemplate::getStringIdParam VectorParam * ServerUberObjectTemplate::getVectorParam(const char *name, bool deepCheck, int index) @@ -1288,9 +1288,9 @@ VectorParam * ServerUberObjectTemplate::getVectorParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getVectorParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_vectorAtDerived; } @@ -1302,9 +1302,9 @@ VectorParam * ServerUberObjectTemplate::getVectorParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getVectorParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_vectorSimple; } @@ -1328,9 +1328,9 @@ VectorParam * ServerUberObjectTemplate::getVectorParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getVectorParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_vectorArray[index]; } @@ -1338,7 +1338,7 @@ VectorParam * ServerUberObjectTemplate::getVectorParam(const char *name, bool de } else return TpfTemplate::getVectorParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerUberObjectTemplate::getVectorParam DynamicVariableParam * ServerUberObjectTemplate::getDynamicVariableParam(const char *name, bool deepCheck, int index) @@ -1349,9 +1349,9 @@ DynamicVariableParam * ServerUberObjectTemplate::getDynamicVariableParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getDynamicVariableParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_objvarDerived; } @@ -1363,9 +1363,9 @@ DynamicVariableParam * ServerUberObjectTemplate::getDynamicVariableParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getDynamicVariableParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_objvarSimple; } @@ -1373,7 +1373,7 @@ DynamicVariableParam * ServerUberObjectTemplate::getDynamicVariableParam(const c } else return TpfTemplate::getDynamicVariableParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerUberObjectTemplate::getDynamicVariableParam StructParamOT * ServerUberObjectTemplate::getStructParamOT(const char *name, bool deepCheck, int index) @@ -1384,9 +1384,9 @@ StructParamOT * ServerUberObjectTemplate::getStructParamOT(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStructParamOT(name, deepCheck, index); - return NULL; + return nullptr; } return &m_structAtDerived; } @@ -1398,9 +1398,9 @@ StructParamOT * ServerUberObjectTemplate::getStructParamOT(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStructParamOT(name, deepCheck, index); - return NULL; + return nullptr; } return &m_structSimple; } @@ -1424,9 +1424,9 @@ StructParamOT * ServerUberObjectTemplate::getStructParamOT(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStructParamOT(name, deepCheck, index); - return NULL; + return nullptr; } return &m_structArrayEnum[index]; } @@ -1438,9 +1438,9 @@ StructParamOT * ServerUberObjectTemplate::getStructParamOT(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStructParamOT(name, deepCheck, index); - return NULL; + return nullptr; } return &m_structArrayInteger[index]; } @@ -1448,7 +1448,7 @@ StructParamOT * ServerUberObjectTemplate::getStructParamOT(const char *name, boo } else return TpfTemplate::getStructParamOT(name, deepCheck, index); - return NULL; + return nullptr; } //ServerUberObjectTemplate::getStructParamOT TriggerVolumeParam * ServerUberObjectTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index) @@ -1459,9 +1459,9 @@ TriggerVolumeParam * ServerUberObjectTemplate::getTriggerVolumeParam(const char { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getTriggerVolumeParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_triggerVolumeDerived; } @@ -1473,9 +1473,9 @@ TriggerVolumeParam * ServerUberObjectTemplate::getTriggerVolumeParam(const char { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getTriggerVolumeParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_triggerVolumeSimple; } @@ -1487,9 +1487,9 @@ TriggerVolumeParam * ServerUberObjectTemplate::getTriggerVolumeParam(const char { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getTriggerVolumeParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_triggerVolumeWeightedList; } @@ -1525,9 +1525,9 @@ TriggerVolumeParam * ServerUberObjectTemplate::getTriggerVolumeParam(const char { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getTriggerVolumeParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_triggerArray[index]; } @@ -1535,7 +1535,7 @@ TriggerVolumeParam * ServerUberObjectTemplate::getTriggerVolumeParam(const char } else return TpfTemplate::getTriggerVolumeParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerUberObjectTemplate::getTriggerVolumeParam void ServerUberObjectTemplate::initStructParamOT(StructParamOT ¶m, const char *name) @@ -1942,12 +1942,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -2009,7 +2009,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_intListSimple.begin(); iter != m_intListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_intListSimpleAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2027,7 +2027,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_intListWeightedList.begin(); iter != m_intListWeightedList.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_intListWeightedListAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2045,7 +2045,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_intListRandomRange.begin(); iter != m_intListRandomRange.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_intListRandomRangeAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2063,7 +2063,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_intListDiceRoll.begin(); iter != m_intListDiceRoll.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_intListDiceRollAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2103,7 +2103,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_floatListSimple.begin(); iter != m_floatListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_floatListSimpleAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2121,7 +2121,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_floatListWeightedList.begin(); iter != m_floatListWeightedList.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_floatListWeightedListAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2139,7 +2139,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_floatListRandomRange.begin(); iter != m_floatListRandomRange.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_floatListRandomRangeAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2185,7 +2185,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_enumListIndexed.begin(); iter != m_enumListIndexed.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_enumListIndexedAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2203,7 +2203,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_enumListWeightedList.begin(); iter != m_enumListWeightedList.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_enumListWeightedListAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2227,7 +2227,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_stringIdListSimple.begin(); iter != m_stringIdListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_stringIdListSimpleAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2245,7 +2245,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_stringIdListWeightedList.begin(); iter != m_stringIdListWeightedList.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_stringIdListWeightedListAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2269,7 +2269,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_stringListSimple.begin(); iter != m_stringListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_stringListSimpleAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2287,7 +2287,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_stringListWeightedList.begin(); iter != m_stringListWeightedList.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_stringListWeightedListAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2311,7 +2311,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_triggerVolumeList.begin(); iter != m_triggerVolumeList.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_triggerVolumeListAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2329,7 +2329,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_triggerVolumesListWeightedList.begin(); iter != m_triggerVolumesListWeightedList.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_triggerVolumesListWeightedListAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2353,7 +2353,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_boolListDerived.begin(); iter != m_boolListDerived.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_boolListDerivedAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2371,7 +2371,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_boolListSimple.begin(); iter != m_boolListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_boolListSimpleAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2389,7 +2389,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_boolListWeightedList.begin(); iter != m_boolListWeightedList.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_boolListWeightedListAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2411,7 +2411,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_vectorListSimple.begin(); iter != m_vectorListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_vectorListSimpleAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2435,7 +2435,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_filenameListSimple.begin(); iter != m_filenameListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_filenameListSimpleAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2463,7 +2463,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_templateListSimple.begin(); iter != m_templateListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_templateListSimpleAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2485,7 +2485,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_structListSimple.begin(); iter != m_structListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_structListSimpleAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -3487,9 +3487,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::_Foo::getCompilerIntegerParam(c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_item1; } @@ -3497,7 +3497,7 @@ CompilerIntegerParam * ServerUberObjectTemplate::_Foo::getCompilerIntegerParam(c } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerUberObjectTemplate::_Foo::getCompilerIntegerParam FloatParam * ServerUberObjectTemplate::_Foo::getFloatParam(const char *name, bool deepCheck, int index) @@ -3508,9 +3508,9 @@ FloatParam * ServerUberObjectTemplate::_Foo::getFloatParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_item2; } @@ -3518,7 +3518,7 @@ FloatParam * ServerUberObjectTemplate::_Foo::getFloatParam(const char *name, boo } else return TpfTemplate::getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerUberObjectTemplate::_Foo::getFloatParam BoolParam * ServerUberObjectTemplate::_Foo::getBoolParam(const char *name, bool deepCheck, int index) @@ -3534,9 +3534,9 @@ StringParam * ServerUberObjectTemplate::_Foo::getStringParam(const char *name, b { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_item3; } @@ -3544,7 +3544,7 @@ StringParam * ServerUberObjectTemplate::_Foo::getStringParam(const char *name, b } else return TpfTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerUberObjectTemplate::_Foo::getStringParam StringIdParam * ServerUberObjectTemplate::_Foo::getStringIdParam(const char *name, bool deepCheck, int index) diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerUniverseObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerUniverseObjectTemplate.cpp index 359ddce6..7f4176f1 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerUniverseObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerUniverseObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerUniverseObjectTemplate::getTemplateVersion(void) const */ Tag ServerUniverseObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerUniverseObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerUniverseObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerVehicleObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerVehicleObjectTemplate.cpp index 663fdb2a..e204aa23 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerVehicleObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerVehicleObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerVehicleObjectTemplate::getTemplateVersion(void) const */ Tag ServerVehicleObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerVehicleObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerVehicleObjectTemplate::getHighestTemplateVersion @@ -108,9 +108,9 @@ FloatParam * ServerVehicleObjectTemplate::getFloatParam(const char *name, bool d { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_currentFuel; } @@ -122,9 +122,9 @@ FloatParam * ServerVehicleObjectTemplate::getFloatParam(const char *name, bool d { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_maxFuel; } @@ -136,9 +136,9 @@ FloatParam * ServerVehicleObjectTemplate::getFloatParam(const char *name, bool d { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_consumpsion; } @@ -146,7 +146,7 @@ FloatParam * ServerVehicleObjectTemplate::getFloatParam(const char *name, bool d } else return ServerTangibleObjectTemplate::getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerVehicleObjectTemplate::getFloatParam BoolParam * ServerVehicleObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) @@ -162,9 +162,9 @@ StringParam * ServerVehicleObjectTemplate::getStringParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_fuelType; } @@ -172,7 +172,7 @@ StringParam * ServerVehicleObjectTemplate::getStringParam(const char *name, bool } else return ServerTangibleObjectTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerVehicleObjectTemplate::getStringParam StringIdParam * ServerVehicleObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -255,12 +255,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerWaypointObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerWaypointObjectTemplate.cpp index 0cd323ea..23c83cd5 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerWaypointObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerWaypointObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerWaypointObjectTemplate::getTemplateVersion(void) const */ Tag ServerWaypointObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerWaypointObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerWaypointObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerWeaponObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerWeaponObjectTemplate.cpp index 54aa2726..65775fd0 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerWeaponObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerWeaponObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerWeaponObjectTemplate::getTemplateVersion(void) const */ Tag ServerWeaponObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerWeaponObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerWeaponObjectTemplate::getHighestTemplateVersion @@ -103,9 +103,9 @@ CompilerIntegerParam * ServerWeaponObjectTemplate::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_weaponType; } @@ -117,9 +117,9 @@ CompilerIntegerParam * ServerWeaponObjectTemplate::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_attackType; } @@ -131,9 +131,9 @@ CompilerIntegerParam * ServerWeaponObjectTemplate::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_damageType; } @@ -145,9 +145,9 @@ CompilerIntegerParam * ServerWeaponObjectTemplate::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_elementalType; } @@ -159,9 +159,9 @@ CompilerIntegerParam * ServerWeaponObjectTemplate::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_elementalValue; } @@ -173,9 +173,9 @@ CompilerIntegerParam * ServerWeaponObjectTemplate::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_minDamageAmount; } @@ -187,9 +187,9 @@ CompilerIntegerParam * ServerWeaponObjectTemplate::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_maxDamageAmount; } @@ -201,9 +201,9 @@ CompilerIntegerParam * ServerWeaponObjectTemplate::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_attackCost; } @@ -215,9 +215,9 @@ CompilerIntegerParam * ServerWeaponObjectTemplate::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_accuracy; } @@ -225,7 +225,7 @@ CompilerIntegerParam * ServerWeaponObjectTemplate::getCompilerIntegerParam(const } else return ServerTangibleObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerWeaponObjectTemplate::getCompilerIntegerParam FloatParam * ServerWeaponObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -236,9 +236,9 @@ FloatParam * ServerWeaponObjectTemplate::getFloatParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_attackSpeed; } @@ -250,9 +250,9 @@ FloatParam * ServerWeaponObjectTemplate::getFloatParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_audibleRange; } @@ -264,9 +264,9 @@ FloatParam * ServerWeaponObjectTemplate::getFloatParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_minRange; } @@ -278,9 +278,9 @@ FloatParam * ServerWeaponObjectTemplate::getFloatParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_maxRange; } @@ -292,9 +292,9 @@ FloatParam * ServerWeaponObjectTemplate::getFloatParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_damageRadius; } @@ -306,9 +306,9 @@ FloatParam * ServerWeaponObjectTemplate::getFloatParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_woundChance; } @@ -316,7 +316,7 @@ FloatParam * ServerWeaponObjectTemplate::getFloatParam(const char *name, bool de } else return ServerTangibleObjectTemplate::getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerWeaponObjectTemplate::getFloatParam BoolParam * ServerWeaponObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) @@ -409,12 +409,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerXpManagerObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerXpManagerObjectTemplate.cpp index b5969702..0725fed2 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerXpManagerObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerXpManagerObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerXpManagerObjectTemplate::getTemplateVersion(void) const */ Tag ServerXpManagerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerXpManagerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerXpManagerObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedBattlefieldMarkerObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedBattlefieldMarkerObjectTemplate.cpp index 21c891e3..a5bd8fe4 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedBattlefieldMarkerObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedBattlefieldMarkerObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedBattlefieldMarkerObjectTemplate::getTemplateVersion(void) const */ Tag SharedBattlefieldMarkerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedBattlefieldMarkerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedBattlefieldMarkerObjectTemplate::getHighestTemplateVersion @@ -103,9 +103,9 @@ CompilerIntegerParam * SharedBattlefieldMarkerObjectTemplate::getCompilerInteger { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_numberOfPoles; } @@ -113,7 +113,7 @@ CompilerIntegerParam * SharedBattlefieldMarkerObjectTemplate::getCompilerInteger } else return SharedTangibleObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedBattlefieldMarkerObjectTemplate::getCompilerIntegerParam FloatParam * SharedBattlefieldMarkerObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -124,9 +124,9 @@ FloatParam * SharedBattlefieldMarkerObjectTemplate::getFloatParam(const char *na { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_radius; } @@ -134,7 +134,7 @@ FloatParam * SharedBattlefieldMarkerObjectTemplate::getFloatParam(const char *na } else return SharedTangibleObjectTemplate::getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedBattlefieldMarkerObjectTemplate::getFloatParam BoolParam * SharedBattlefieldMarkerObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) @@ -227,12 +227,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedBuildingObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedBuildingObjectTemplate.cpp index 3af16bfb..f4bba6f0 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedBuildingObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedBuildingObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedBuildingObjectTemplate::getTemplateVersion(void) const */ Tag SharedBuildingObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedBuildingObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedBuildingObjectTemplate::getHighestTemplateVersion @@ -118,9 +118,9 @@ StringParam * SharedBuildingObjectTemplate::getStringParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_terrainModificationFileName; } @@ -132,9 +132,9 @@ StringParam * SharedBuildingObjectTemplate::getStringParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_interiorLayoutFileName; } @@ -142,7 +142,7 @@ StringParam * SharedBuildingObjectTemplate::getStringParam(const char *name, boo } else return SharedTangibleObjectTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedBuildingObjectTemplate::getStringParam StringIdParam * SharedBuildingObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -225,12 +225,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedCellObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedCellObjectTemplate.cpp index 7e96a950..1a71a06d 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedCellObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedCellObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedCellObjectTemplate::getTemplateVersion(void) const */ Tag SharedCellObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedCellObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedCellObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedConstructionContractObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedConstructionContractObjectTemplate.cpp index 7426b7c1..5c4b79e2 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedConstructionContractObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedConstructionContractObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedConstructionContractObjectTemplate::getTemplateVersion(void) const */ Tag SharedConstructionContractObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedConstructionContractObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedConstructionContractObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedCreatureObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedCreatureObjectTemplate.cpp index 913472e0..e4034d22 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedCreatureObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedCreatureObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedCreatureObjectTemplate::getTemplateVersion(void) const */ Tag SharedCreatureObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedCreatureObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedCreatureObjectTemplate::getHighestTemplateVersion @@ -103,9 +103,9 @@ CompilerIntegerParam * SharedCreatureObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_gender; } @@ -117,9 +117,9 @@ CompilerIntegerParam * SharedCreatureObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_niche; } @@ -131,9 +131,9 @@ CompilerIntegerParam * SharedCreatureObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_species; } @@ -145,9 +145,9 @@ CompilerIntegerParam * SharedCreatureObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_race; } @@ -155,7 +155,7 @@ CompilerIntegerParam * SharedCreatureObjectTemplate::getCompilerIntegerParam(con } else return SharedTangibleObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedCreatureObjectTemplate::getCompilerIntegerParam FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -166,9 +166,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_acceleration[index]; } @@ -180,9 +180,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_speed[index]; } @@ -194,9 +194,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_turnRate[index]; } @@ -208,9 +208,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_slopeModAngle; } @@ -222,9 +222,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_slopeModPercent; } @@ -236,9 +236,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_waterModPercent; } @@ -250,9 +250,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_stepHeight; } @@ -264,9 +264,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_collisionHeight; } @@ -278,9 +278,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_collisionRadius; } @@ -292,9 +292,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_swimHeight; } @@ -306,9 +306,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_warpTolerance; } @@ -320,9 +320,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_collisionOffsetX; } @@ -334,9 +334,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_collisionOffsetZ; } @@ -348,9 +348,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_collisionLength; } @@ -362,9 +362,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_cameraHeight; } @@ -372,7 +372,7 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool } else return SharedTangibleObjectTemplate::getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedCreatureObjectTemplate::getFloatParam BoolParam * SharedCreatureObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) @@ -383,9 +383,9 @@ BoolParam * SharedCreatureObjectTemplate::getBoolParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_postureAlignToTerrain[index]; } @@ -393,7 +393,7 @@ BoolParam * SharedCreatureObjectTemplate::getBoolParam(const char *name, bool de } else return SharedTangibleObjectTemplate::getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedCreatureObjectTemplate::getBoolParam StringParam * SharedCreatureObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) @@ -404,9 +404,9 @@ StringParam * SharedCreatureObjectTemplate::getStringParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_animationMapFilename; } @@ -418,9 +418,9 @@ StringParam * SharedCreatureObjectTemplate::getStringParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_movementDatatable; } @@ -428,7 +428,7 @@ StringParam * SharedCreatureObjectTemplate::getStringParam(const char *name, boo } else return SharedTangibleObjectTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedCreatureObjectTemplate::getStringParam StringIdParam * SharedCreatureObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -528,12 +528,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedDraftSchematicObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedDraftSchematicObjectTemplate.cpp index 3f651ac8..9c18023d 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedDraftSchematicObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedDraftSchematicObjectTemplate.cpp @@ -47,7 +47,7 @@ SharedDraftSchematicObjectTemplate::~SharedDraftSchematicObjectTemplate() for (iter = m_slots.begin(); iter != m_slots.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_slots.clear(); } @@ -56,7 +56,7 @@ SharedDraftSchematicObjectTemplate::~SharedDraftSchematicObjectTemplate() for (iter = m_attributes.begin(); iter != m_attributes.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_attributes.clear(); } @@ -108,10 +108,10 @@ Tag SharedDraftSchematicObjectTemplate::getTemplateVersion(void) const */ Tag SharedDraftSchematicObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedDraftSchematicObjectTemplate::getHighestTemplateVersion @@ -140,9 +140,9 @@ StringParam * SharedDraftSchematicObjectTemplate::getStringParam(const char *nam { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_craftedSharedTemplate; } @@ -150,7 +150,7 @@ StringParam * SharedDraftSchematicObjectTemplate::getStringParam(const char *nam } else return SharedIntangibleObjectTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedDraftSchematicObjectTemplate::getStringParam StringIdParam * SharedDraftSchematicObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -196,7 +196,7 @@ StructParamOT * SharedDraftSchematicObjectTemplate::getStructParamOT(const char } else return SharedIntangibleObjectTemplate::getStructParamOT(name, deepCheck, index); - return NULL; + return nullptr; } //SharedDraftSchematicObjectTemplate::getStructParamOT TriggerVolumeParam * SharedDraftSchematicObjectTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index) @@ -294,12 +294,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -327,7 +327,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_slots.begin(); iter != m_slots.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_slots.clear(); m_slotsAppend = file.read_bool8(); @@ -346,7 +346,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_attributes.begin(); iter != m_attributes.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_attributes.clear(); m_attributesAppend = file.read_bool8(); @@ -512,9 +512,9 @@ StringParam * SharedDraftSchematicObjectTemplate::_IngredientSlot::getStringPara { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_hardpoint; } @@ -522,7 +522,7 @@ StringParam * SharedDraftSchematicObjectTemplate::_IngredientSlot::getStringPara } else return TpfTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedDraftSchematicObjectTemplate::_IngredientSlot::getStringParam StringIdParam * SharedDraftSchematicObjectTemplate::_IngredientSlot::getStringIdParam(const char *name, bool deepCheck, int index) @@ -533,9 +533,9 @@ StringIdParam * SharedDraftSchematicObjectTemplate::_IngredientSlot::getStringId { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_name; } @@ -543,7 +543,7 @@ StringIdParam * SharedDraftSchematicObjectTemplate::_IngredientSlot::getStringId } else return TpfTemplate::getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedDraftSchematicObjectTemplate::_IngredientSlot::getStringIdParam VectorParam * SharedDraftSchematicObjectTemplate::_IngredientSlot::getVectorParam(const char *name, bool deepCheck, int index) @@ -717,9 +717,9 @@ CompilerIntegerParam * SharedDraftSchematicObjectTemplate::_SchematicAttribute:: { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_value; } @@ -727,7 +727,7 @@ CompilerIntegerParam * SharedDraftSchematicObjectTemplate::_SchematicAttribute:: } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedDraftSchematicObjectTemplate::_SchematicAttribute::getCompilerIntegerParam FloatParam * SharedDraftSchematicObjectTemplate::_SchematicAttribute::getFloatParam(const char *name, bool deepCheck, int index) @@ -753,9 +753,9 @@ StringIdParam * SharedDraftSchematicObjectTemplate::_SchematicAttribute::getStri { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_name; } @@ -767,9 +767,9 @@ StringIdParam * SharedDraftSchematicObjectTemplate::_SchematicAttribute::getStri { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_experiment; } @@ -777,7 +777,7 @@ StringIdParam * SharedDraftSchematicObjectTemplate::_SchematicAttribute::getStri } else return TpfTemplate::getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedDraftSchematicObjectTemplate::_SchematicAttribute::getStringIdParam VectorParam * SharedDraftSchematicObjectTemplate::_SchematicAttribute::getVectorParam(const char *name, bool deepCheck, int index) diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedFactoryObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedFactoryObjectTemplate.cpp index e917394d..3088f935 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedFactoryObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedFactoryObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedFactoryObjectTemplate::getTemplateVersion(void) const */ Tag SharedFactoryObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedFactoryObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedFactoryObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedGroupObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedGroupObjectTemplate.cpp index a5bb8830..6eecfb9e 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedGroupObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedGroupObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedGroupObjectTemplate::getTemplateVersion(void) const */ Tag SharedGroupObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedGroupObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedGroupObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedGuildObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedGuildObjectTemplate.cpp index 26ba6d9a..be710a73 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedGuildObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedGuildObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedGuildObjectTemplate::getTemplateVersion(void) const */ Tag SharedGuildObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedGuildObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedGuildObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedInstallationObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedInstallationObjectTemplate.cpp index 70ae2f01..3b396c5a 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedInstallationObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedInstallationObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedInstallationObjectTemplate::getTemplateVersion(void) const */ Tag SharedInstallationObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedInstallationObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedInstallationObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedIntangibleObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedIntangibleObjectTemplate.cpp index 67245c19..077b284d 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedIntangibleObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedIntangibleObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedIntangibleObjectTemplate::getTemplateVersion(void) const */ Tag SharedIntangibleObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedIntangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedIntangibleObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedJediManagerObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedJediManagerObjectTemplate.cpp index 0cce8f75..66b0ddfa 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedJediManagerObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedJediManagerObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedJediManagerObjectTemplate::getTemplateVersion(void) const */ Tag SharedJediManagerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedJediManagerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedJediManagerObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedManufactureSchematicObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedManufactureSchematicObjectTemplate.cpp index 3b860316..e1fa62c8 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedManufactureSchematicObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedManufactureSchematicObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedManufactureSchematicObjectTemplate::getTemplateVersion(void) const */ Tag SharedManufactureSchematicObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedManufactureSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedManufactureSchematicObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedMissionObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedMissionObjectTemplate.cpp index f52ed728..23330fc7 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedMissionObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedMissionObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedMissionObjectTemplate::getTemplateVersion(void) const */ Tag SharedMissionObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedMissionObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedMissionObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedObjectTemplate.cpp index ea1fa149..250ddd5c 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedObjectTemplate::getTemplateVersion(void) const */ Tag SharedObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedObjectTemplate::getHighestTemplateVersion @@ -103,9 +103,9 @@ CompilerIntegerParam * SharedObjectTemplate::getCompilerIntegerParam(const char { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_containerType; } @@ -117,9 +117,9 @@ CompilerIntegerParam * SharedObjectTemplate::getCompilerIntegerParam(const char { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_containerVolumeLimit; } @@ -131,9 +131,9 @@ CompilerIntegerParam * SharedObjectTemplate::getCompilerIntegerParam(const char { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_gameObjectType; } @@ -145,9 +145,9 @@ CompilerIntegerParam * SharedObjectTemplate::getCompilerIntegerParam(const char { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_surfaceType; } @@ -155,7 +155,7 @@ CompilerIntegerParam * SharedObjectTemplate::getCompilerIntegerParam(const char } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedObjectTemplate::getCompilerIntegerParam FloatParam * SharedObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -166,9 +166,9 @@ FloatParam * SharedObjectTemplate::getFloatParam(const char *name, bool deepChec { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_scale; } @@ -180,9 +180,9 @@ FloatParam * SharedObjectTemplate::getFloatParam(const char *name, bool deepChec { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_scaleThresholdBeforeExtentTest; } @@ -194,9 +194,9 @@ FloatParam * SharedObjectTemplate::getFloatParam(const char *name, bool deepChec { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_clearFloraRadius; } @@ -208,9 +208,9 @@ FloatParam * SharedObjectTemplate::getFloatParam(const char *name, bool deepChec { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_noBuildRadius; } @@ -222,9 +222,9 @@ FloatParam * SharedObjectTemplate::getFloatParam(const char *name, bool deepChec { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_locationReservationRadius; } @@ -232,7 +232,7 @@ FloatParam * SharedObjectTemplate::getFloatParam(const char *name, bool deepChec } else return TpfTemplate::getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedObjectTemplate::getFloatParam BoolParam * SharedObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) @@ -243,9 +243,9 @@ BoolParam * SharedObjectTemplate::getBoolParam(const char *name, bool deepCheck, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_snapToTerrain; } @@ -257,9 +257,9 @@ BoolParam * SharedObjectTemplate::getBoolParam(const char *name, bool deepCheck, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_sendToClient; } @@ -271,9 +271,9 @@ BoolParam * SharedObjectTemplate::getBoolParam(const char *name, bool deepCheck, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_onlyVisibleInTools; } @@ -285,9 +285,9 @@ BoolParam * SharedObjectTemplate::getBoolParam(const char *name, bool deepCheck, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_forceNoCollision; } @@ -295,7 +295,7 @@ BoolParam * SharedObjectTemplate::getBoolParam(const char *name, bool deepCheck, } else return TpfTemplate::getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedObjectTemplate::getBoolParam StringParam * SharedObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) @@ -306,9 +306,9 @@ StringParam * SharedObjectTemplate::getStringParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_tintPalette; } @@ -320,9 +320,9 @@ StringParam * SharedObjectTemplate::getStringParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_slotDescriptorFilename; } @@ -334,9 +334,9 @@ StringParam * SharedObjectTemplate::getStringParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_arrangementDescriptorFilename; } @@ -348,9 +348,9 @@ StringParam * SharedObjectTemplate::getStringParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_appearanceFilename; } @@ -362,9 +362,9 @@ StringParam * SharedObjectTemplate::getStringParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_portalLayoutFilename; } @@ -376,9 +376,9 @@ StringParam * SharedObjectTemplate::getStringParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_clientDataFile; } @@ -386,7 +386,7 @@ StringParam * SharedObjectTemplate::getStringParam(const char *name, bool deepCh } else return TpfTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedObjectTemplate::getStringParam StringIdParam * SharedObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -397,9 +397,9 @@ StringIdParam * SharedObjectTemplate::getStringIdParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_objectName; } @@ -411,9 +411,9 @@ StringIdParam * SharedObjectTemplate::getStringIdParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_detailedDescription; } @@ -425,9 +425,9 @@ StringIdParam * SharedObjectTemplate::getStringIdParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_lookAtText; } @@ -435,7 +435,7 @@ StringIdParam * SharedObjectTemplate::getStringIdParam(const char *name, bool de } else return TpfTemplate::getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedObjectTemplate::getStringIdParam VectorParam * SharedObjectTemplate::getVectorParam(const char *name, bool deepCheck, int index) @@ -513,12 +513,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedPlayerObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedPlayerObjectTemplate.cpp index b926fbb4..5d99e4c9 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedPlayerObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedPlayerObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedPlayerObjectTemplate::getTemplateVersion(void) const */ Tag SharedPlayerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedPlayerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedPlayerObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedPlayerQuestObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedPlayerQuestObjectTemplate.cpp index b9ed644e..f3b04e88 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedPlayerQuestObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedPlayerQuestObjectTemplate.cpp @@ -87,10 +87,10 @@ Tag SharedPlayerQuestObjectTemplate::getTemplateVersion(void) const */ Tag SharedPlayerQuestObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedPlayerQuestObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedPlayerQuestObjectTemplate::getHighestTemplateVersion @@ -196,12 +196,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedResourceContainerObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedResourceContainerObjectTemplate.cpp index e77a29d6..3ea96d3d 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedResourceContainerObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedResourceContainerObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedResourceContainerObjectTemplate::getTemplateVersion(void) const */ Tag SharedResourceContainerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedResourceContainerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedResourceContainerObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedShipObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedShipObjectTemplate.cpp index 25f8f375..d7705d97 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedShipObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedShipObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedShipObjectTemplate::getTemplateVersion(void) const */ Tag SharedShipObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedShipObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedShipObjectTemplate::getHighestTemplateVersion @@ -113,9 +113,9 @@ BoolParam * SharedShipObjectTemplate::getBoolParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_hasWings; } @@ -127,9 +127,9 @@ BoolParam * SharedShipObjectTemplate::getBoolParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_playerControlled; } @@ -137,7 +137,7 @@ BoolParam * SharedShipObjectTemplate::getBoolParam(const char *name, bool deepCh } else return SharedTangibleObjectTemplate::getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedShipObjectTemplate::getBoolParam StringParam * SharedShipObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) @@ -148,9 +148,9 @@ StringParam * SharedShipObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_cockpitFilename; } @@ -162,9 +162,9 @@ StringParam * SharedShipObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_interiorLayoutFileName; } @@ -172,7 +172,7 @@ StringParam * SharedShipObjectTemplate::getStringParam(const char *name, bool de } else return SharedTangibleObjectTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedShipObjectTemplate::getStringParam StringIdParam * SharedShipObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -255,12 +255,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedStaticObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedStaticObjectTemplate.cpp index 630e8239..19de68be 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedStaticObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedStaticObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedStaticObjectTemplate::getTemplateVersion(void) const */ Tag SharedStaticObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedStaticObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedStaticObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedTangibleObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedTangibleObjectTemplate.cpp index 3157fb24..10a66071 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedTangibleObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedTangibleObjectTemplate.cpp @@ -55,7 +55,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() for (iter = m_paletteColorCustomizationVariables.begin(); iter != m_paletteColorCustomizationVariables.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_paletteColorCustomizationVariables.clear(); } @@ -64,7 +64,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() for (iter = m_rangedIntCustomizationVariables.begin(); iter != m_rangedIntCustomizationVariables.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_rangedIntCustomizationVariables.clear(); } @@ -73,7 +73,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() for (iter = m_constStringCustomizationVariables.begin(); iter != m_constStringCustomizationVariables.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_constStringCustomizationVariables.clear(); } @@ -82,7 +82,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() for (iter = m_socketDestinations.begin(); iter != m_socketDestinations.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_socketDestinations.clear(); } @@ -91,7 +91,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() for (iter = m_certificationsRequired.begin(); iter != m_certificationsRequired.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_certificationsRequired.clear(); } @@ -100,7 +100,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() for (iter = m_customizationVariableMapping.begin(); iter != m_customizationVariableMapping.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_customizationVariableMapping.clear(); } @@ -152,10 +152,10 @@ Tag SharedTangibleObjectTemplate::getTemplateVersion(void) const */ Tag SharedTangibleObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedTangibleObjectTemplate::getHighestTemplateVersion @@ -181,9 +181,9 @@ CompilerIntegerParam * SharedTangibleObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_clientVisabilityFlag; } @@ -191,7 +191,7 @@ CompilerIntegerParam * SharedTangibleObjectTemplate::getCompilerIntegerParam(con } else return SharedObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedTangibleObjectTemplate::getCompilerIntegerParam FloatParam * SharedTangibleObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -207,9 +207,9 @@ BoolParam * SharedTangibleObjectTemplate::getBoolParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_useStructureFootprintOutline; } @@ -221,9 +221,9 @@ BoolParam * SharedTangibleObjectTemplate::getBoolParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_targetable; } @@ -231,7 +231,7 @@ BoolParam * SharedTangibleObjectTemplate::getBoolParam(const char *name, bool de } else return SharedObjectTemplate::getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedTangibleObjectTemplate::getBoolParam StringParam * SharedTangibleObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) @@ -242,9 +242,9 @@ StringParam * SharedTangibleObjectTemplate::getStringParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_structureFootprintFileName; } @@ -264,7 +264,7 @@ StringParam * SharedTangibleObjectTemplate::getStringParam(const char *name, boo } else return SharedObjectTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedTangibleObjectTemplate::getStringParam StringIdParam * SharedTangibleObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -334,7 +334,7 @@ StructParamOT * SharedTangibleObjectTemplate::getStructParamOT(const char *name, } else return SharedObjectTemplate::getStructParamOT(name, deepCheck, index); - return NULL; + return nullptr; } //SharedTangibleObjectTemplate::getStructParamOT TriggerVolumeParam * SharedTangibleObjectTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index) @@ -488,12 +488,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -521,7 +521,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_paletteColorCustomizationVariables.begin(); iter != m_paletteColorCustomizationVariables.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_paletteColorCustomizationVariables.clear(); m_paletteColorCustomizationVariablesAppend = file.read_bool8(); @@ -540,7 +540,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_rangedIntCustomizationVariables.begin(); iter != m_rangedIntCustomizationVariables.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_rangedIntCustomizationVariables.clear(); m_rangedIntCustomizationVariablesAppend = file.read_bool8(); @@ -559,7 +559,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_constStringCustomizationVariables.begin(); iter != m_constStringCustomizationVariables.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_constStringCustomizationVariables.clear(); m_constStringCustomizationVariablesAppend = file.read_bool8(); @@ -578,7 +578,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_socketDestinations.begin(); iter != m_socketDestinations.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_socketDestinations.clear(); m_socketDestinationsAppend = file.read_bool8(); @@ -603,7 +603,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_certificationsRequired.begin(); iter != m_certificationsRequired.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_certificationsRequired.clear(); m_certificationsRequiredAppend = file.read_bool8(); @@ -622,7 +622,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_customizationVariableMapping.begin(); iter != m_customizationVariableMapping.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_customizationVariableMapping.clear(); m_customizationVariableMappingAppend = file.read_bool8(); @@ -866,9 +866,9 @@ StringParam * SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::g { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_variableName; } @@ -880,9 +880,9 @@ StringParam * SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::g { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_constValue; } @@ -890,7 +890,7 @@ StringParam * SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::g } else return TpfTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::getStringParam StringIdParam * SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::getStringIdParam(const char *name, bool deepCheck, int index) @@ -1084,9 +1084,9 @@ StringParam * SharedTangibleObjectTemplate::_CustomizationVariableMapping::getSt { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_sourceVariable; } @@ -1098,9 +1098,9 @@ StringParam * SharedTangibleObjectTemplate::_CustomizationVariableMapping::getSt { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_dependentVariable; } @@ -1108,7 +1108,7 @@ StringParam * SharedTangibleObjectTemplate::_CustomizationVariableMapping::getSt } else return TpfTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedTangibleObjectTemplate::_CustomizationVariableMapping::getStringParam StringIdParam * SharedTangibleObjectTemplate::_CustomizationVariableMapping::getStringIdParam(const char *name, bool deepCheck, int index) @@ -1287,9 +1287,9 @@ CompilerIntegerParam * SharedTangibleObjectTemplate::_PaletteColorCustomizationV { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_defaultPaletteIndex; } @@ -1297,7 +1297,7 @@ CompilerIntegerParam * SharedTangibleObjectTemplate::_PaletteColorCustomizationV } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getCompilerIntegerParam FloatParam * SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getFloatParam(const char *name, bool deepCheck, int index) @@ -1318,9 +1318,9 @@ StringParam * SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable:: { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_variableName; } @@ -1332,9 +1332,9 @@ StringParam * SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable:: { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_palettePathName; } @@ -1342,7 +1342,7 @@ StringParam * SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable:: } else return TpfTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getStringParam StringIdParam * SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getStringIdParam(const char *name, bool deepCheck, int index) @@ -1529,9 +1529,9 @@ CompilerIntegerParam * SharedTangibleObjectTemplate::_RangedIntCustomizationVari { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_minValueInclusive; } @@ -1543,9 +1543,9 @@ CompilerIntegerParam * SharedTangibleObjectTemplate::_RangedIntCustomizationVari { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_defaultValue; } @@ -1557,9 +1557,9 @@ CompilerIntegerParam * SharedTangibleObjectTemplate::_RangedIntCustomizationVari { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_maxValueExclusive; } @@ -1567,7 +1567,7 @@ CompilerIntegerParam * SharedTangibleObjectTemplate::_RangedIntCustomizationVari } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getCompilerIntegerParam FloatParam * SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getFloatParam(const char *name, bool deepCheck, int index) @@ -1588,9 +1588,9 @@ StringParam * SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::get { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_variableName; } @@ -1598,7 +1598,7 @@ StringParam * SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::get } else return TpfTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getStringParam StringIdParam * SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getStringIdParam(const char *name, bool deepCheck, int index) diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedTerrainSurfaceObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedTerrainSurfaceObjectTemplate.cpp index 2eb61bd9..aeaeff99 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedTerrainSurfaceObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedTerrainSurfaceObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedTerrainSurfaceObjectTemplate::getTemplateVersion(void) const */ Tag SharedTerrainSurfaceObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedTerrainSurfaceObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedTerrainSurfaceObjectTemplate::getHighestTemplateVersion @@ -108,9 +108,9 @@ FloatParam * SharedTerrainSurfaceObjectTemplate::getFloatParam(const char *name, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_cover; } @@ -118,7 +118,7 @@ FloatParam * SharedTerrainSurfaceObjectTemplate::getFloatParam(const char *name, } else return TpfTemplate::getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedTerrainSurfaceObjectTemplate::getFloatParam BoolParam * SharedTerrainSurfaceObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) @@ -134,9 +134,9 @@ StringParam * SharedTerrainSurfaceObjectTemplate::getStringParam(const char *nam { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_surfaceType; } @@ -144,7 +144,7 @@ StringParam * SharedTerrainSurfaceObjectTemplate::getStringParam(const char *nam } else return TpfTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedTerrainSurfaceObjectTemplate::getStringParam StringIdParam * SharedTerrainSurfaceObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -227,12 +227,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedTokenObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedTokenObjectTemplate.cpp index cf352144..03f9ec94 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedTokenObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedTokenObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedTokenObjectTemplate::getTemplateVersion(void) const */ Tag SharedTokenObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedTokenObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedTokenObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedUniverseObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedUniverseObjectTemplate.cpp index 62685a52..d429becf 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedUniverseObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedUniverseObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedUniverseObjectTemplate::getTemplateVersion(void) const */ Tag SharedUniverseObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedUniverseObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedUniverseObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedVehicleObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedVehicleObjectTemplate.cpp index ffa28bfb..b1f83b74 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedVehicleObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedVehicleObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedVehicleObjectTemplate::getTemplateVersion(void) const */ Tag SharedVehicleObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedVehicleObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedVehicleObjectTemplate::getHighestTemplateVersion @@ -108,9 +108,9 @@ FloatParam * SharedVehicleObjectTemplate::getFloatParam(const char *name, bool d { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_speed[index]; } @@ -122,9 +122,9 @@ FloatParam * SharedVehicleObjectTemplate::getFloatParam(const char *name, bool d { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_slopeAversion; } @@ -136,9 +136,9 @@ FloatParam * SharedVehicleObjectTemplate::getFloatParam(const char *name, bool d { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_hoverValue; } @@ -150,9 +150,9 @@ FloatParam * SharedVehicleObjectTemplate::getFloatParam(const char *name, bool d { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_turnRate; } @@ -164,9 +164,9 @@ FloatParam * SharedVehicleObjectTemplate::getFloatParam(const char *name, bool d { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_maxVelocity; } @@ -178,9 +178,9 @@ FloatParam * SharedVehicleObjectTemplate::getFloatParam(const char *name, bool d { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_acceleration; } @@ -192,9 +192,9 @@ FloatParam * SharedVehicleObjectTemplate::getFloatParam(const char *name, bool d { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_braking; } @@ -202,7 +202,7 @@ FloatParam * SharedVehicleObjectTemplate::getFloatParam(const char *name, bool d } else return SharedTangibleObjectTemplate::getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedVehicleObjectTemplate::getFloatParam BoolParam * SharedVehicleObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) @@ -300,12 +300,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedWaypointObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedWaypointObjectTemplate.cpp index b845d576..69ad3053 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedWaypointObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedWaypointObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedWaypointObjectTemplate::getTemplateVersion(void) const */ Tag SharedWaypointObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedWaypointObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedWaypointObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedWeaponObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedWeaponObjectTemplate.cpp index b6bf3e51..690d160e 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedWeaponObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedWeaponObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedWeaponObjectTemplate::getTemplateVersion(void) const */ Tag SharedWeaponObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedWeaponObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedWeaponObjectTemplate::getHighestTemplateVersion @@ -103,9 +103,9 @@ CompilerIntegerParam * SharedWeaponObjectTemplate::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_weaponEffectIndex; } @@ -117,9 +117,9 @@ CompilerIntegerParam * SharedWeaponObjectTemplate::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_attackType; } @@ -127,7 +127,7 @@ CompilerIntegerParam * SharedWeaponObjectTemplate::getCompilerIntegerParam(const } else return SharedTangibleObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedWeaponObjectTemplate::getCompilerIntegerParam FloatParam * SharedWeaponObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -148,9 +148,9 @@ StringParam * SharedWeaponObjectTemplate::getStringParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_weaponEffect; } @@ -158,7 +158,7 @@ StringParam * SharedWeaponObjectTemplate::getStringParam(const char *name, bool } else return SharedTangibleObjectTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedWeaponObjectTemplate::getStringParam StringIdParam * SharedWeaponObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -241,12 +241,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/File.cpp b/engine/shared/library/sharedTemplateDefinition/src/shared/core/File.cpp index d3b0322d..07755d95 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/File.cpp +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/File.cpp @@ -19,7 +19,7 @@ // File static variables Filename File::m_basePath; -File::FunctionPtr File::m_callBack = NULL; +File::FunctionPtr File::m_callBack = nullptr; //======================================================================== // File functions @@ -49,7 +49,7 @@ bool File::open(const char *filename, const char *mode) // @todo: find an equivalent function for Linux m_fp = fopen(m_filename, mode); #endif - if (m_fp != NULL) + if (m_fp != nullptr) { m_currentLine = 0; return true; @@ -57,7 +57,7 @@ bool File::open(const char *filename, const char *mode) else { const char * errstr = strerror(errno); - if (errstr != NULL) + if (errstr != nullptr) { m_filename.clear(); printError(errstr); @@ -75,7 +75,7 @@ bool File::open(const char *filename, const char *mode) */ bool File::exists(const char *filename) { - if (filename == NULL) + if (filename == nullptr) return false; #if defined(WIN32) @@ -110,7 +110,7 @@ int File::readRawLine(char *buffer, int bufferSize) NOT_NULL(buffer); ++m_currentLine; - if (fgets(buffer, bufferSize, m_fp) == NULL) + if (fgets(buffer, bufferSize, m_fp) == nullptr) { if (feof(m_fp)) return -1; @@ -149,7 +149,7 @@ int File::readLine(char *buffer, int bufferSize) for (;;) { ++m_currentLine; - if (fgets(buffer, bufferSize, m_fp) == NULL) + if (fgets(buffer, bufferSize, m_fp) == nullptr) { if (feof(m_fp)) return -1; diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/File.h b/engine/shared/library/sharedTemplateDefinition/src/shared/core/File.h index b8f655e6..c2292615 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/File.h +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/File.h @@ -54,13 +54,13 @@ private: inline File::File(void) : - m_fp(NULL), + m_fp(nullptr), m_currentLine(0) { } // File::File(void) inline File::File(const char *filename, const char *mode) : - m_fp(NULL), + m_fp(nullptr), m_currentLine(0) { open(filename, mode); @@ -83,15 +83,15 @@ inline const Filename & File::getFilename(void) const inline bool File::isOpened(void) const { - return (m_fp != NULL); + return (m_fp != nullptr); } // File::isOpened inline void File::close(void) { - if (m_fp != NULL) + if (m_fp != nullptr) { fclose(m_fp); - m_fp = NULL; + m_fp = nullptr; } } // File::close @@ -110,7 +110,7 @@ inline void File::printWarning(const char *buffer) const fprintf(stderr, "%s", error); - if (m_callBack != NULL) + if (m_callBack != nullptr) { m_callBack(error); } @@ -125,7 +125,7 @@ inline void File::printError(const char *buffer) const fprintf(stderr, "%s", error); - if (m_callBack != NULL) + if (m_callBack != nullptr) { m_callBack(error); } diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/Filename.cpp b/engine/shared/library/sharedTemplateDefinition/src/shared/core/Filename.cpp index 82d85bfa..1f329c77 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/Filename.cpp +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/Filename.cpp @@ -39,7 +39,7 @@ const char PATH_SEPARATOR = LINUX_PATH_SEPARATOR; */ void Filename::setPath(const char *path) { - if (path == NULL || *path == '\0') + if (path == nullptr || *path == '\0') m_path.clear(); else { @@ -69,7 +69,7 @@ void Filename::setPath(const char *path) */ void Filename::setName(const char *name) { - if (name == NULL || *name == '\0') + if (name == nullptr || *name == '\0') m_name.clear(); else { @@ -85,7 +85,7 @@ void Filename::setName(const char *name) const char *dot = strrchr(localname.c_str(), '.'); const char *firstSeparator = strchr(localname.c_str(), PATH_SEPARATOR); const char *lastSeparator = strrchr(localname.c_str(), PATH_SEPARATOR); - if (firstSeparator != NULL) + if (firstSeparator != nullptr) { // name has a path if (firstSeparator == localname) @@ -100,11 +100,11 @@ void Filename::setName(const char *name) localname.c_str() + 1); } } - if (dot != NULL && (lastSeparator == NULL || dot > lastSeparator)) + if (dot != nullptr && (lastSeparator == nullptr || dot > lastSeparator)) { // name has an extension setExtension(dot); - if (lastSeparator == NULL) + if (lastSeparator == nullptr) m_name = std::string(localname.c_str(), dot - localname.c_str()); else m_name = std::string(lastSeparator + 1, dot - (lastSeparator + 1)); @@ -112,7 +112,7 @@ void Filename::setName(const char *name) else { // name doesn't have an extension - if (lastSeparator == NULL) + if (lastSeparator == nullptr) m_name = localname; else m_name = std::string(lastSeparator + 1); @@ -129,7 +129,7 @@ void Filename::setName(const char *name) */ void Filename::setExtension(const char *extension) { - if (extension == NULL || *extension == '\0') + if (extension == nullptr || *extension == '\0') m_extension.clear(); else { @@ -253,7 +253,7 @@ static const std::string PATH_SEPARATOR_STRING(PATH_SEPARATOR_BUFF); */ void Filename::setDrive(const char *drive) { - if (drive != NULL && isalpha(*drive)) + if (drive != nullptr && isalpha(*drive)) m_drive = std::string(drive, 1) + ":"; else m_drive.clear(); @@ -273,7 +273,7 @@ std::string path; #if defined(WIN32) char *pathBuf; - DWORD bufsize = GetFullPathName(getFullFilename().c_str(), 0, NULL, NULL); + DWORD bufsize = GetFullPathName(getFullFilename().c_str(), 0, nullptr, nullptr); if (bufsize != 0) { pathBuf = new char[bufsize + 1]; @@ -285,7 +285,7 @@ std::string path; } #elif defined(linux) char pathBuf[PATH_MAX]; - if (getcwd(pathBuf, PATH_MAX) != NULL) + if (getcwd(pathBuf, PATH_MAX) != nullptr) { strcat(pathBuf, "/"); strcat(pathBuf, getFullFilename().c_str()); @@ -306,19 +306,19 @@ void Filename::verifyAndCreatePath(void) const #if defined(WIN32) if (WindowsUnicode) { - char *buffer = NULL; + char *buffer = nullptr; DWORD buflen; // get our current path - buflen = GetFullPathName(".", 0, buffer, NULL); + buflen = GetFullPathName(".", 0, buffer, nullptr); buffer = new char[buflen + 1]; - buflen = GetFullPathName(".", buflen + 1, buffer, NULL); + buflen = GetFullPathName(".", buflen + 1, buffer, nullptr); Unicode::String srcPath = Unicode::narrowToWide(buffer); delete[] buffer; // get the destination path std::string correctPath(getDrive() + getPath()); - buflen = GetFullPathName(correctPath.c_str(), 0, buffer, NULL); + buflen = GetFullPathName(correctPath.c_str(), 0, buffer, nullptr); buffer = new char[buflen + 1]; - buflen = GetFullPathName(correctPath.c_str(), buflen + 1, buffer, NULL); + buflen = GetFullPathName(correctPath.c_str(), buflen + 1, buffer, nullptr); Unicode::String destPath = Unicode::narrowToWide(buffer); delete[] buffer; @@ -335,7 +335,7 @@ void Filename::verifyAndCreatePath(void) const destPath += splitDestPath[i]; if (SetCurrentDirectoryW((LPCWSTR)destPath.c_str()) == 0) { - if (CreateDirectoryW((LPCWSTR)destPath.c_str(), NULL) == 0) + if (CreateDirectoryW((LPCWSTR)destPath.c_str(), nullptr) == 0) return; if (SetCurrentDirectoryW((LPCWSTR)destPath.c_str()) == 0) return; @@ -347,19 +347,19 @@ void Filename::verifyAndCreatePath(void) const } else { - char *buffer = NULL; + char *buffer = nullptr; DWORD buflen; // get our current path - buflen = GetFullPathName(".", 0, buffer, NULL); + buflen = GetFullPathName(".", 0, buffer, nullptr); buffer = new char[buflen + 1]; - buflen = GetFullPathName(".", buflen + 1, buffer, NULL); + buflen = GetFullPathName(".", buflen + 1, buffer, nullptr); std::string srcPath = buffer; delete[] buffer; // get the destination path std::string correctPath(getDrive() + getPath()); - buflen = GetFullPathName(correctPath.c_str(), 0, buffer, NULL); + buflen = GetFullPathName(correctPath.c_str(), 0, buffer, nullptr); buffer = new char[buflen + 1]; - buflen = GetFullPathName(correctPath.c_str(), buflen + 1, buffer, NULL); + buflen = GetFullPathName(correctPath.c_str(), buflen + 1, buffer, nullptr); std::string destPath = buffer; delete[] buffer; @@ -378,7 +378,7 @@ void Filename::verifyAndCreatePath(void) const destPath += splitDestPath[i]; if (SetCurrentDirectory(destPath.c_str()) == 0) { - if (CreateDirectory(destPath.c_str(), NULL) == 0) + if (CreateDirectory(destPath.c_str(), nullptr) == 0) return; if (SetCurrentDirectory(destPath.c_str()) == 0) return; diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/Filename.h b/engine/shared/library/sharedTemplateDefinition/src/shared/core/Filename.h index 62466a7a..a947e70d 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/Filename.h +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/Filename.h @@ -57,13 +57,13 @@ inline Filename::Filename(void) inline Filename::Filename(const char *drive, const char *path, const char *name, const char *extension) { - if (drive != NULL) + if (drive != nullptr) setDrive(drive); - if (path != NULL) + if (path != nullptr) setPath(path); - if (name != NULL) + if (name != nullptr) setName(name); - if (extension != NULL) + if (extension != nullptr) setExtension(extension); } // Filename::Filename @@ -115,7 +115,7 @@ inline void Filename::makeFullPath(void) //======================================================================== -const Filename NEXT_HIGHER_PATH(NULL, "..", NULL, NULL); +const Filename NEXT_HIGHER_PATH(nullptr, "..", nullptr, nullptr); #endif // _INCLUDED_Filename_H diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/ObjectTemplate.cpp b/engine/shared/library/sharedTemplateDefinition/src/shared/core/ObjectTemplate.cpp index 42def7d2..5492f6ec 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/ObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/ObjectTemplate.cpp @@ -16,8 +16,8 @@ //----------------------------------------------------------------- -template <> ObjectTemplateList::CreateDataResourceMap *ObjectTemplateList::ms_bindings = NULL; -template <> ObjectTemplateList::LoadedDataResourceMap *ObjectTemplateList::ms_loaded = NULL; +template <> ObjectTemplateList::CreateDataResourceMap *ObjectTemplateList::ms_bindings = nullptr; +template <> ObjectTemplateList::LoadedDataResourceMap *ObjectTemplateList::ms_loaded = nullptr; // ====================================================================== @@ -40,10 +40,10 @@ ObjectTemplate::ObjectTemplate(const std::string & filename) : ObjectTemplate::~ObjectTemplate(void) { - if (m_baseData != NULL) + if (m_baseData != nullptr) { m_baseData->releaseReference(); - m_baseData = NULL; + m_baseData = nullptr; } } @@ -63,7 +63,7 @@ void ObjectTemplate::load(Iff &iff) */ void ObjectTemplate::addReference(void) const { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->addReference(); DataResource::addReference(); @@ -76,7 +76,7 @@ void ObjectTemplate::addReference(void) const */ void ObjectTemplate::releaseReference(void) const { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); DataResource::releaseReference(); diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateData.cpp b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateData.cpp index a5974767..335347bc 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateData.cpp +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateData.cpp @@ -52,8 +52,8 @@ static const bool HasMinMax[] = // map enum ParamType to access function return value static const char * const PaddedDataMethodNames[] = { - NULL, - NULL, + nullptr, + nullptr, "int ", "float ", "bool ", @@ -62,25 +62,25 @@ static const char * const PaddedDataMethodNames[] = "const Vector & ", "void ", "const ObjectTemplate *", - NULL, - NULL, + nullptr, + nullptr, "const TriggerVolumeData &", "const std::string & " }; static const char * const UnpaddedDataMethodNames[] = { - NULL, - NULL, + nullptr, + nullptr, "int", "float", "bool", "const std::string &", "const StringId", "const Vector &", - NULL, + nullptr, "const ObjectTemplate *", - NULL, - NULL, + nullptr, + nullptr, "const TriggerVolumeData &", "const std::string &" }; @@ -88,8 +88,8 @@ static const char * const UnpaddedDataMethodNames[] = // map enum ParamType to struct storage type static const char * const PaddedDataStructNames[] = { - NULL, - NULL, + nullptr, + nullptr, "int ", "float ", "bool ", @@ -98,15 +98,15 @@ static const char * const PaddedDataStructNames[] = "Vector ", "DynamicVariableList ", "const ObjectTemplate *", - NULL, - NULL, + nullptr, + nullptr, "TriggerVolumeData ", "std::string " }; static const char * const UnpaddedDataStructNames[] = { - NULL, - NULL, + nullptr, + nullptr, "int", "float", "bool", @@ -115,8 +115,8 @@ static const char * const UnpaddedDataStructNames[] = "Vector", "DynamicVariableList", "const ObjectTemplate *", - NULL, - NULL, + nullptr, + nullptr, "TriggerVolumeData", "std::string" }; @@ -160,8 +160,8 @@ static const char * const CompilerDataVariableNames[] = static const char * const DefaultDataReturnValue[] = { - NULL, - NULL, + nullptr, + nullptr, "0", "0.0f", "false", @@ -169,7 +169,7 @@ static const char * const DefaultDataReturnValue[] = "DefaultStringId", "DefaultVector", "", - "NULL", + "nullptr", "(0)", "", "DefaultTriggerVolumeData", @@ -217,7 +217,7 @@ static const char * const EnumLocationNames[] = */ TemplateData::TemplateData(int version, const TemplateDefinitionFile &parent) : m_fileParent(&parent), - m_templateParent(NULL), + m_templateParent(nullptr), m_hasTemplateParam(false), m_hasDynamicVarParam(false), m_hasList(false), @@ -228,9 +228,9 @@ TemplateData::TemplateData(int version, const TemplateDefinitionFile &parent) : m_parseState(STATE_PARAM), m_parameters(), m_parameterMap(), - m_currentEnumList(NULL), + m_currentEnumList(nullptr), m_enumMap(), - m_currentStruct(NULL), + m_currentStruct(nullptr), m_structMap(), m_structList() { @@ -252,7 +252,7 @@ TemplateData::TemplateData(int version, const TemplateDefinitionFile &parent) : * @param name the structure's name */ TemplateData::TemplateData(const TemplateData *parent, const std::string &name) : - m_fileParent(NULL), + m_fileParent(nullptr), m_templateParent(parent), m_hasTemplateParam(false), m_hasDynamicVarParam(false), @@ -265,9 +265,9 @@ TemplateData::TemplateData(const TemplateData *parent, const std::string &name) m_parseState(STATE_PARAM), m_parameters(), m_parameterMap(), - m_currentEnumList(NULL), + m_currentEnumList(nullptr), m_enumMap(), - m_currentStruct(NULL), + m_currentStruct(nullptr), m_structMap(), m_structList() { @@ -284,15 +284,15 @@ TemplateData::~TemplateData() for (iter = m_structMap.begin(); iter != m_structMap.end(); ++iter) { delete (*iter).second; - (*iter).second = NULL; + (*iter).second = nullptr; } m_parameterMap.clear(); m_parameters.clear(); m_structMap.clear(); m_structList.clear(); - m_currentEnumList = NULL; - m_currentStruct = NULL; + m_currentEnumList = nullptr; + m_currentStruct = nullptr; } // TemplateData::~TemplateData @@ -306,9 +306,9 @@ TemplateData::~TemplateData() */ const std::string TemplateData::getName(void) const { - if (m_fileParent != NULL) + if (m_fileParent != nullptr) return m_fileParent->getTemplateName(); - if (m_templateParent != NULL) + if (m_templateParent != nullptr) return m_templateParent->getName() + "::_" + m_name; return ""; } @@ -320,9 +320,9 @@ const std::string TemplateData::getName(void) const */ const std::string TemplateData::getBaseName(void) const { - if (m_fileParent != NULL && !m_fileParent->getBaseName().empty()) + if (m_fileParent != nullptr && !m_fileParent->getBaseName().empty()) return m_fileParent->getBaseName(); -// if (m_templateParent != NULL) +// if (m_templateParent != nullptr) return m_baseName; // return ""; } @@ -334,9 +334,9 @@ const std::string TemplateData::getBaseName(void) const */ TemplateLocation TemplateData::getTemplateLocation(void) const { - if (m_fileParent != NULL) + if (m_fileParent != nullptr) return m_fileParent->getTemplateLocation(); - if (m_templateParent != NULL) + if (m_templateParent != nullptr) return m_templateParent->getTemplateLocation(); return LOC_NONE; } // TemplateData::getTemplateLocation @@ -359,8 +359,8 @@ const char * TemplateData::parseLine(const File &fp, const char *buffer, { ParamState paramState = STATE_LIST; - if (buffer == NULL || *buffer == '\0') - return NULL; + if (buffer == nullptr || *buffer == '\0') + return nullptr; const char *line = buffer; @@ -413,7 +413,7 @@ ParamState paramState = STATE_LIST; return CHAR_ERROR; } const EnumList * enumList = getEnumList(tokenbuf, true); - if (enumList != NULL) + if (enumList != nullptr) { fp.printError("enum already defined"); return CHAR_ERROR; @@ -421,7 +421,7 @@ ParamState paramState = STATE_LIST; m_currentEnumList = &(*m_enumMap.insert(std::make_pair( std::string(tokenbuf), EnumList())).first).second; m_parseState = STATE_ENUM; - if (line != NULL && *line != '\0') + if (line != nullptr && *line != '\0') return parseEnum(fp, line, tokenbuf); return line; } @@ -455,7 +455,7 @@ ParamState paramState = STATE_LIST; m_structMap.insert(std::make_pair(tokenbuf, m_currentStruct)); m_structList.push_back(m_currentStruct); m_parseState = STATE_STRUCT; - if (line != NULL && *line != '\0') + if (line != nullptr && *line != '\0') return parseStruct(fp, line, tokenbuf); return line; } @@ -463,7 +463,7 @@ ParamState paramState = STATE_LIST; return CHAR_ERROR; } // if we are a structure, the 1st item should be the structure id - else if (strcmp(tokenbuf, "id") == 0 && m_templateParent != NULL && + else if (strcmp(tokenbuf, "id") == 0 && m_templateParent != nullptr && m_structId.tag == NO_TAG) { line = getNextToken(line, tokenbuf); @@ -479,7 +479,7 @@ ParamState paramState = STATE_LIST; } // if we are a structure, the 1st item should be the structure id - if (m_templateParent != NULL && m_structId.tag == NO_TAG) + if (m_templateParent != nullptr && m_structId.tag == NO_TAG) { fp.printError("struct id not defined"); return CHAR_ERROR; @@ -508,7 +508,7 @@ ParamState paramState = STATE_LIST; parameter.list_type = LIST_ENUM_ARRAY; parameter.enum_list_name = &tokenbuf[8]; const EnumList * list = getEnumList(parameter.enum_list_name.c_str(), false); - if (list == NULL) + if (list == nullptr) { fp.printError("enum name not defined!"); return CHAR_ERROR; @@ -592,7 +592,7 @@ ParamState paramState = STATE_LIST; { parameter.type = TYPE_ENUM; parameter.extendedName = &tokenbuf[4]; - if (getEnumList(&tokenbuf[4], false) == NULL) + if (getEnumList(&tokenbuf[4], false) == nullptr) { std::string errbuf = "enum type " + parameter.extendedName + " not defined"; @@ -605,7 +605,7 @@ ParamState paramState = STATE_LIST; { parameter.type = TYPE_STRUCT; parameter.extendedName = &tokenbuf[6]; - if (getStruct(&tokenbuf[6]) == NULL) + if (getStruct(&tokenbuf[6]) == nullptr) { std::string errbuf = "struct " + parameter.extendedName + " not defined"; @@ -640,12 +640,12 @@ ParamState paramState = STATE_LIST; tempToken = getNextToken(tempToken, tempBuf); if (parameter.type == TYPE_INTEGER) { - parameter.min_int_limit = strtol(tempBuf, NULL, 10); + parameter.min_int_limit = strtol(tempBuf, nullptr, 10); } else { parameter.min_float_limit = static_cast( - strtod(tempBuf, NULL)); + strtod(tempBuf, nullptr)); } } if (*tempToken == '.' && *(tempToken + 1) == '.') @@ -682,7 +682,7 @@ ParamState paramState = STATE_LIST; } // anything left over in the line is the parameter description - if (line != NULL) + if (line != nullptr) parameter.description = line; m_parameters.push_back(parameter); @@ -714,12 +714,12 @@ int TemplateData::getEnumValue(const char * enumValue) const } } - if (m_templateParent != NULL) + if (m_templateParent != nullptr) return m_templateParent->getEnumValue(enumValue); - if (m_fileParent != NULL) + if (m_fileParent != nullptr) { const TemplateDefinitionFile * baseFile = m_fileParent->getBaseDefinitionFile(); - if (baseFile != NULL) + if (baseFile != nullptr) { return baseFile->getTemplateData(baseFile->getHighestVersion())-> getEnumValue(enumValue); @@ -742,7 +742,7 @@ int TemplateData::getEnumValue(const std::string & enumType, NOT_NULL(enumValue); const EnumList *elist = getEnumList(enumType.c_str(), false); - if (elist == NULL) + if (elist == nullptr) return INVALID_ENUM_RESULT; EnumList::const_iterator listIter; for (listIter = elist->begin(); listIter != elist->end(); ++listIter) @@ -760,7 +760,7 @@ int TemplateData::getEnumValue(const std::string & enumType, * @param name the enum list name * @param define flag that we are defining templates and should not look in base templates * - * @return the enum list definition, or NULL if not found + * @return the enum list definition, or nullptr if not found */ const TemplateData::EnumList * TemplateData::getEnumList(const std::string & name, bool define) const @@ -768,17 +768,17 @@ const TemplateData::EnumList * TemplateData::getEnumList(const std::string & nam EnumMap::const_iterator iter = m_enumMap.find(name); if (iter != m_enumMap.end()) return &(*iter).second; - if (m_templateParent != NULL) + if (m_templateParent != nullptr) return m_templateParent->getEnumList(name, define); - if (!define && m_fileParent != NULL && m_fileParent->getBaseDefinitionFile() != NULL) + if (!define && m_fileParent != nullptr && m_fileParent->getBaseDefinitionFile() != nullptr) { const TemplateData * baseData = m_fileParent->getBaseDefinitionFile()-> getTemplateData(m_fileParent->getBaseDefinitionFile()-> getHighestVersion()); - if (baseData != NULL) + if (baseData != nullptr) return baseData->getEnumList(name, define); } - return NULL; + return nullptr; } // TemplateData::getEnumList /** @@ -787,7 +787,7 @@ const TemplateData::EnumList * TemplateData::getEnumList(const std::string & nam * * @param name the enum list name * - * @return the struct definition, or NULL if not found + * @return the struct definition, or nullptr if not found */ const TemplateData * TemplateData::getStruct(const char *name) const { @@ -796,23 +796,23 @@ const TemplateData * TemplateData::getStruct(const char *name) const StructMap::const_iterator iter = m_structMap.find(name); if (iter != m_structMap.end()) return (*iter).second; - if (m_templateParent != NULL) + if (m_templateParent != nullptr) return m_templateParent->getStruct(name); - if (m_fileParent != NULL && m_fileParent->getBaseDefinitionFile() != NULL) + if (m_fileParent != nullptr && m_fileParent->getBaseDefinitionFile() != nullptr) { const TemplateData * baseData = m_fileParent->getBaseDefinitionFile()-> getTemplateData(m_fileParent->getBaseDefinitionFile()-> getHighestVersion()); - if (baseData != NULL) + if (baseData != nullptr) return baseData->getStruct(name); } - return NULL; + return nullptr; } // TemplateData::getStruct /** * Returns the tdf file for this TemplateData * - * @return the TemplateDefinitionFile, or NULL if not there + * @return the TemplateDefinitionFile, or nullptr if not there */ const TemplateDefinitionFile * TemplateData::getTdf() const @@ -823,7 +823,7 @@ const TemplateDefinitionFile * TemplateData::getTdf() const /** * Returns the tdf file for this TemplateData's first ancestor * - * @return the TemplateDefinitionFile, or NULL if not there + * @return the TemplateDefinitionFile, or nullptr if not there */ const TemplateDefinitionFile * TemplateData::getTdfParent() const @@ -834,19 +834,19 @@ const TemplateDefinitionFile * TemplateData::getTdfParent() const } else { - return NULL; + return nullptr; } } /** * Returns the tdf file that contains the parameter * - * @return the TemplateDefinitionFile, or NULL if not found + * @return the TemplateDefinitionFile, or nullptr if not found */ const TemplateDefinitionFile * TemplateData::getTdfForParameter(const char *parameterName) const { - if(m_fileParent != NULL) + if(m_fileParent != nullptr) { if(getParameter(parameterName)) { @@ -855,18 +855,18 @@ const TemplateDefinitionFile * TemplateData::getTdfForParameter(const char *para const TemplateDefinitionFile* ancestorTemplateDefinitionFile = m_fileParent->getBaseDefinitionFile(); - if(ancestorTemplateDefinitionFile != NULL) + if(ancestorTemplateDefinitionFile != nullptr) { const TemplateData *ancestorTemplateData = ancestorTemplateDefinitionFile->getTemplateData(ancestorTemplateDefinitionFile->getHighestVersion()); - if(ancestorTemplateData != NULL) + if(ancestorTemplateData != nullptr) { return ancestorTemplateData->getTdfForParameter(parameterName); } } } - return NULL; + return nullptr; } /** @@ -883,7 +883,7 @@ int TemplateData::parseIntValue(const File &fp, const char * line, const char ** char * intbuf) const { NOT_NULL(endLine); - if (line == NULL || *line == '\0' || intbuf == NULL) + if (line == nullptr || *line == '\0' || intbuf == nullptr) { fp.printError("bad value passed to TemplateData::parseIntValue"); *endLine = CHAR_ERROR; @@ -920,7 +920,7 @@ int TemplateData::parseIntValue(const File &fp, const char * line, const char ** *endLine = CHAR_ERROR; return 0; } - if (tempLine != NULL) + if (tempLine != nullptr) line = tempLine; else line += strlen(line); @@ -954,8 +954,8 @@ int TemplateData::parseIntValue(const File &fp, const char * line, const char ** strncpy(intbuf, startLine, line - startLine); intbuf[line - startLine] = '\0'; intbuf += strlen(intbuf); - if (line != NULL && *line == '\0') - *endLine = NULL; + if (line != nullptr && *line == '\0') + *endLine = nullptr; else *endLine = line; @@ -1010,7 +1010,7 @@ const char * TemplateData::parseEnum(const File &fp, const char *buffer, if (m_bracketCount == 1) { m_bracketCount = 0; - m_currentEnumList = NULL; + m_currentEnumList = nullptr; m_parseState = STATE_PARAM; return line; } @@ -1023,7 +1023,7 @@ const char * TemplateData::parseEnum(const File &fp, const char *buffer, EnumData enumData; enumData.name = tokenbuf; - if (line != NULL && *line == '=') + if (line != nullptr && *line == '=') { line = getNextToken(line, tokenbuf); @@ -1054,12 +1054,12 @@ const char * TemplateData::parseEnum(const File &fp, const char *buffer, enumData.value = m_currentEnumList->back().value + 1; } - if (line != NULL && *line == ',') + if (line != nullptr && *line == ',') line = getNextToken(line, tokenbuf); - if (line != NULL) + if (line != nullptr) { enumData.comment = line; - line = NULL; + line = nullptr; } m_currentEnumList->push_back(enumData); @@ -1103,7 +1103,7 @@ const char * TemplateData::parseStruct(const File &fp, const char *buffer, if (m_bracketCount == 1) { m_bracketCount = 0; - m_currentStruct = NULL; + m_currentStruct = nullptr; m_parseState = STATE_PARAM; return line; } @@ -1194,7 +1194,7 @@ char buffer[256]; else if (param.list_type == LIST_ENUM_ARRAY) { const EnumList * enumList = getEnumList(param.enum_list_name, false); - FATAL(enumList == NULL, ("Enum list %s missing", + FATAL(enumList == nullptr, ("Enum list %s missing", param.enum_list_name.c_str())); sprintf(buffer, "missing parameter %s[%s] from section " "@class %s", param.name.c_str(), enumList->at(i).name.c_str(), @@ -1280,10 +1280,10 @@ void TemplateData::setWriteForCompiler(bool flag) */ void TemplateData::writeRegisterTemplate(File &fp, const char * leadInChars) const { - if (m_fileParent != NULL) + if (m_fileParent != nullptr) fp.print("%s\n", TDF_INSTALL_BEGIN); - if (leadInChars != NULL) + if (leadInChars != nullptr) fp.print("%s", leadInChars); fp.print("%s::registerMe();\n", getName().c_str()); @@ -1296,7 +1296,7 @@ void TemplateData::writeRegisterTemplate(File &fp, const char * leadInChars) con subStruct->writeRegisterTemplate(fp, leadInChars); } - if (m_fileParent != NULL) + if (m_fileParent != nullptr) fp.print("%s\n", TDF_INSTALL_END); } // TemplateData::writeRegisterTemplate @@ -1338,7 +1338,7 @@ std::vector paramStrings; paramStrings.push_back(param.enum_list_name + " index"); break; } - if (m_templateParent != NULL) + if (m_templateParent != nullptr) paramStrings.push_back("bool versionOk"); if (param.list_type == LIST_NONE) { @@ -1420,7 +1420,7 @@ void TemplateData::getTemplateNames(std::set &names) const else if (param.type == TYPE_STRUCT) { const TemplateData * structData = getStruct(param.extendedName.c_str()); - if (structData != NULL) + if (structData != nullptr) structData->getTemplateNames(names); } } @@ -1439,7 +1439,7 @@ void TemplateData::writeHeaderParams(File &fp) const return; } - if (m_fileParent != NULL) + if (m_fileParent != nullptr) fp.print("%s\n", TDF_BEGIN); writeHeaderEnums(fp); @@ -1447,7 +1447,7 @@ void TemplateData::writeHeaderParams(File &fp) const writeHeaderMethods(fp); writeHeaderVariables(fp); - if (m_fileParent != NULL) + if (m_fileParent != nullptr) fp.print("%s\n", TDF_END); } // TemplateData::writeHeaderParams @@ -1461,7 +1461,7 @@ void TemplateData::writeCompilerHeaderParams(File &fp) const { DEBUG_FATAL(!m_writeForCompilerFlag, ("write for compiler not enabled")); - if (m_fileParent != NULL) + if (m_fileParent != nullptr) fp.print("%s\n", TDF_BEGIN); writeHeaderEnums(fp); @@ -1469,7 +1469,7 @@ void TemplateData::writeCompilerHeaderParams(File &fp) const writeCompilerHeaderMethods(fp); writeHeaderVariables(fp); - if (m_fileParent != NULL) + if (m_fileParent != nullptr) fp.print("%s\n", TDF_END); } // TemplateData::writeCompilerHeaderParams @@ -1883,7 +1883,7 @@ ParameterList::const_iterator iter; case LIST_NONE: case LIST_INT_ARRAY: case LIST_ENUM_ARRAY: - if (PaddedDataStructNames[param.type] != NULL) + if (PaddedDataStructNames[param.type] != nullptr) { fp.print("\t\t%s %s", PaddedDataStructNames[param.type], param.name.c_str()); @@ -1904,7 +1904,7 @@ ParameterList::const_iterator iter; break; case LIST_LIST: fp.print("\t\tstdvector<"); - if (UnpaddedDataStructNames[param.type] != NULL) + if (UnpaddedDataStructNames[param.type] != nullptr) fp.print("%s", UnpaddedDataStructNames[param.type]); else if (param.type == TYPE_ENUM) fp.print("enum %s", param.extendedName.c_str()); @@ -1953,7 +1953,7 @@ void TemplateData::writeSourceLoadedFlagInit(File &fp) const { ParameterList::const_iterator iter; - if (m_fileParent != NULL) + if (m_fileParent != nullptr) fp.print("%s\n", TDF_INIT_BEGIN); fp.print("\t: %s(filename)\n", getBaseName().c_str()); @@ -1968,13 +1968,13 @@ ParameterList::const_iterator iter; fp.print("m_%sLoaded(false)\n", param.name.c_str()); fp.print("\t,m_%sAppend(false)\n", param.name.c_str()); } - if (m_templateParent == NULL && !isWritingForCompiler()) + if (m_templateParent == nullptr && !isWritingForCompiler()) { fp.print("\t,"); fp.print("m_versionOk(true)\n"); } - if (m_fileParent != NULL) + if (m_fileParent != nullptr) fp.print("%s\n", TDF_INIT_END); } // TemplateData::writeSourceLoadedFlagInit @@ -1985,7 +1985,7 @@ ParameterList::const_iterator iter; */ void TemplateData::writeSourceStructStart(File &fp) const { - if (m_templateParent == NULL) + if (m_templateParent == nullptr) return; const std::string & templateNameString = getName(); @@ -2051,7 +2051,7 @@ void TemplateData::writeSourceStructStart(File &fp, const std::string &name) con { ParameterList::const_iterator iter; - if (m_templateParent == NULL || !m_hasTemplateParam) + if (m_templateParent == nullptr || !m_hasTemplateParam) return; std::string className = m_templateParent->getName() + "::" + name; @@ -2079,18 +2079,18 @@ ParameterList::const_iterator iter; switch (param.list_type) { case LIST_NONE: - fp.print("\t%s = NULL;\n", pname); + fp.print("\t%s = nullptr;\n", pname); break; case LIST_INT_ARRAY: fp.print("\tfor (int i = 0; i < %d; ++i)\n", param.list_size); fp.print("\t{\n"); - fp.print("\t\t%s[i] = NULL;\n", pname); + fp.print("\t\t%s[i] = nullptr;\n", pname); fp.print("\t}\n"); break; case LIST_ENUM_ARRAY: fp.print("\tfor (int i = 0; i < %d; ++i)\n", param.list_size); fp.print("\t{\n"); - fp.print("\t\t%s[static_cast<%s>(i)] = NULL;\n", pname, + fp.print("\t\t%s[static_cast<%s>(i)] = nullptr;\n", pname, param.enum_list_name.c_str()); fp.print("\t}\n"); break; @@ -2134,14 +2134,14 @@ ParameterList::const_iterator iter; switch (param.list_type) { case LIST_NONE: - fp.print("\tif (%s != NULL)\n", pname); + fp.print("\tif (%s != nullptr)\n", pname); fp.print("\t\tconst_cast(%s)->addReference();\n", pname); break; case LIST_INT_ARRAY: fp.print("\tfor (int i = 0; i < %d; ++i)\n", param.list_size); fp.print("\t{\n"); - fp.print("\t\tif (%s[i] != NULL)\n", pname); + fp.print("\t\tif (%s[i] != nullptr)\n", pname); fp.print("\t\t\tconst_cast(%s[i])->addReference" "();\n", pname); fp.print("\t}\n"); @@ -2149,7 +2149,7 @@ ParameterList::const_iterator iter; case LIST_ENUM_ARRAY: fp.print("\tfor (int i = 0; i < %d; ++i)\n", param.list_size); fp.print("\t{\n"); - fp.print("\t\tif (%s[static_cast<%s>(i)] != NULL)\n", pname, + fp.print("\t\tif (%s[static_cast<%s>(i)] != nullptr)\n", pname, param.enum_list_name.c_str()); fp.print("\t\t\tconst_cast(%s[static_cast<%s>" "(i)])->addReference();\n", pname, param.enum_list_name.c_str()); @@ -2182,10 +2182,10 @@ ParameterList::const_iterator iter; switch (param.list_type) { case LIST_NONE: - fp.print("\tif (%s != NULL)\n", pname); + fp.print("\tif (%s != nullptr)\n", pname); fp.print("\t{\n"); fp.print("\t\t%s->releaseReference();\n", pname); - fp.print("\t\t%s = NULL;\n", pname); + fp.print("\t\t%s = nullptr;\n", pname); fp.print("\t}\n"); break; case LIST_LIST: @@ -2198,23 +2198,23 @@ ParameterList::const_iterator iter; else fp.print("\tfor (int i = 0; i < %d; ++i)\n", param.list_size); fp.print("\t{\n"); - fp.print("\t\tif (%s[i] != NULL)\n", pname); + fp.print("\t\tif (%s[i] != nullptr)\n", pname); fp.print("\t\t{\n"); fp.print("\t\t\t%s[i]->releaseReference();\n", pname); - fp.print("\t\t\t%s[i] = NULL;\n", pname); + fp.print("\t\t\t%s[i] = nullptr;\n", pname); fp.print("\t\t}\n"); fp.print("\t}\n"); break; case LIST_ENUM_ARRAY: fp.print("\tfor (int i = 0; i < %d; ++i)\n", param.list_size); fp.print("\t{\n"); - fp.print("\t\tif (%s[static_cast<%s>(i)] != NULL)\n", pname, + fp.print("\t\tif (%s[static_cast<%s>(i)] != nullptr)\n", pname, param.enum_list_name.c_str()); fp.print("\t\t{\n"); fp.print("\t\t\t%s[static_cast<%s>(i)]->releaseReference();\n", pname, param.enum_list_name.c_str()); - fp.print("\t\t\t%s[static_cast<%s>(i)] = NULL;\n", pname, + fp.print("\t\t\t%s[static_cast<%s>(i)] = nullptr;\n", pname, param.enum_list_name.c_str()); fp.print("\t\t}\n"); fp.print("\t}\n"); @@ -2259,7 +2259,7 @@ int result; return 0; } - if (m_fileParent != NULL) + if (m_fileParent != nullptr) fp.print("%s\n", TDF_BEGIN); result = writeSourceGetData(fp); @@ -2282,7 +2282,7 @@ int result; return result; } - if (m_fileParent != NULL) + if (m_fileParent != nullptr) fp.print("%s\n", TDF_END); return 0; } // TemplateData::writeSourceMethods @@ -2297,7 +2297,7 @@ void TemplateData::writeCompilerSourceMethods(File &fp) const { DEBUG_FATAL(!m_writeForCompilerFlag, ("write for compiler not enabled")); - if (m_fileParent != NULL) + if (m_fileParent != nullptr) fp.print("%s\n", TDF_BEGIN); writeCompilerSourceAccessMethods(fp); @@ -2314,7 +2314,7 @@ void TemplateData::writeCompilerSourceMethods(File &fp) const subStruct->writeCompilerSourceMethods(fp); } - if (m_fileParent != NULL) + if (m_fileParent != nullptr) fp.print("%s\n", TDF_END); } // TemplateData::writeCompilerSourceMethods @@ -2355,7 +2355,7 @@ void TemplateData::writeSourceReturnBaseValue(File &fp, const Parameter ¶m, } else if (param.list_type != LIST_NONE) indexString = "index"; - if (m_templateParent != NULL) + if (m_templateParent != nullptr) { if (!indexString.empty()) indexString += ", "; @@ -2372,10 +2372,10 @@ void TemplateData::writeSourceReturnBaseValue(File &fp, const Parameter ¶m, fp.print("\tif (!m_%s[index].isLoaded())\n", param.name.c_str()); fp.print("\t{\n"); - if (DefaultDataReturnValue[param.type] != NULL) + if (DefaultDataReturnValue[param.type] != nullptr) { fp.print("\t\tif (ms_allowDefaultTemplateParams && " - "/*!%s &&*/ base == NULL)\n", m_templateParent == NULL ? "m_versionOk" : + "/*!%s &&*/ base == nullptr)\n", m_templateParent == nullptr ? "m_versionOk" : "versionOk"); fp.print("\t\t{\n"); fp.print("\t\t\tDEBUG_WARNING(true, (\"Returning default value for " @@ -2391,7 +2391,7 @@ void TemplateData::writeSourceReturnBaseValue(File &fp, const Parameter ¶m, fp.print("\t\t}\n"); fp.print("\t\telse\n"); fp.print("\t\t{\n"); - fp.print("\t\t\tDEBUG_FATAL(base == NULL, (\"Template parameter %s has " + fp.print("\t\t\tDEBUG_FATAL(base == nullptr, (\"Template parameter %s has " "not been defined in template %%s!\", DataResource::getName()));\n", param.name.c_str()); if (DefaultDataReturnValue[param.type][0] != '\0') @@ -2419,7 +2419,7 @@ void TemplateData::writeSourceReturnBaseValue(File &fp, const Parameter ¶m, // we need to get the base value instead of ours if (param.list_type == LIST_LIST) { - fp.print("\tif (m_%sAppend && base != NULL)\n", param.name.c_str()); + fp.print("\tif (m_%sAppend && base != nullptr)\n", param.name.c_str()); fp.print("\t{\n"); fp.print("\t\tint baseCount = base->get%sCount();\n", upperName.c_str()); @@ -2505,21 +2505,21 @@ int result; fp.print("{\n"); fp.print("\tif (!m_%sLoaded)\n", pname); fp.print("\t{\n"); - fp.print("\t\tif (m_baseData == NULL)\n"); + fp.print("\t\tif (m_baseData == nullptr)\n"); fp.print("\t\t\treturn 0;\n"); fp.print("\t\tconst %s * base = dynamic_cast" "(m_baseData);\n", templateName, templateName); - fp.print("\t\tDEBUG_FATAL(base == NULL, (\"base template wrong " + fp.print("\t\tDEBUG_FATAL(base == nullptr, (\"base template wrong " "type\"));\n"); fp.print("\t\treturn base->get%sCount();\n", upperName.c_str()); fp.print("\t}\n\n"); fp.print("\tsize_t count = m_%s.size();\n\n", pname); fp.print("\t// if we are extending our base template, add it's count\n"); - fp.print("\tif (m_%sAppend && m_baseData != NULL)\n", pname); + fp.print("\tif (m_%sAppend && m_baseData != nullptr)\n", pname); fp.print("\t{\n"); fp.print("\t\tconst %s * base = dynamic_cast(m_baseData);\n", templateName, templateName); - fp.print("\t\tif (base != NULL)\n"); + fp.print("\t\tif (base != nullptr)\n"); fp.print("\t\t\tcount += base->get%sCount();\n", upperName.c_str()); fp.print("\t}\n\n"); fp.print("\treturn count;\n"); @@ -2582,7 +2582,7 @@ void TemplateData::writeSourceTestData(File &fp) const } } - if (m_fileParent != NULL) + if (m_fileParent != nullptr) { // check the base class if (!getBaseName().empty() && getBaseName() != ROOT_TEMPLATE_NAME) @@ -2631,18 +2631,18 @@ void TemplateData::writeSourceGetGeneric(File &fp, const Parameter ¶m) const fp.print("#endif\n\n"); } - fp.print("\tconst %s * base = NULL;\n", templateName); - fp.print("\tif (m_baseData != NULL)\n"); + fp.print("\tconst %s * base = nullptr;\n", templateName); + fp.print("\tif (m_baseData != nullptr)\n"); fp.print("\t{\n"); fp.print("\t\tbase = dynamic_cast(m_baseData);\n", templateName); -// fp.print("\t\tDEBUG_FATAL(base == NULL, (\"base template wrong type\"));\n"); +// fp.print("\t\tDEBUG_FATAL(base == nullptr, (\"base template wrong type\"));\n"); if (param.list_type == LIST_NONE) { // get the test base value fp.print("#ifdef _DEBUG\n"); - fp.print("\t\tif (testData && base != NULL)\n"); + fp.print("\t\tif (testData && base != nullptr)\n"); fp.print("\t\t\ttestDataValue = base->get%s%s(true);\n", upperName.c_str(), MinMaxNames[i]); fp.print("#endif\n"); @@ -2651,7 +2651,7 @@ void TemplateData::writeSourceGetGeneric(File &fp, const Parameter ¶m) const fp.print("\t}\n\n"); const char *arrayIndex = ""; - std::string indexName = m_templateParent == NULL ? "" : "versionOk"; + std::string indexName = m_templateParent == nullptr ? "" : "versionOk"; const char *access = "."; if (param.list_type == LIST_NONE) { @@ -2689,9 +2689,9 @@ void TemplateData::writeSourceGetGeneric(File &fp, const Parameter ¶m) const fp.print("\tif (delta == '+' || delta == '-' || delta == '_' || delta == '=')\n"); fp.print("\t{\n"); fp.print("\t\t%s baseValue = 0;\n", UnpaddedDataMethodNames[param.type]); - fp.print("\t\tif (m_baseData != NULL)\n"); + fp.print("\t\tif (m_baseData != nullptr)\n"); fp.print("\t\t{\n"); - fp.print("\t\t\tif (base != NULL)\n"); + fp.print("\t\t\tif (base != nullptr)\n"); fp.print("\t\t\t\tbaseValue = base->get%s%s(%s);\n", upperName.c_str(), MinMaxNames[i], indexName.c_str()); fp.print("\t\t\telse if (ms_allowDefaultTemplateParams)\n"); @@ -2716,7 +2716,7 @@ void TemplateData::writeSourceGetGeneric(File &fp, const Parameter ¶m) const { // check the return value vs the base value, and warn if the same fp.print("#ifdef _DEBUG\n"); - fp.print("\tif (testData && base != NULL)\n"); + fp.print("\tif (testData && base != nullptr)\n"); fp.print("\t{\n"); // fp.print("\t\tif (testDataValue == value)\n"); // fp.print("\t\t\tDEBUG_WARNING(true, (\"Template %%s, parameter %s is " @@ -2758,12 +2758,12 @@ void TemplateData::writeSourceGetVector(File &fp, const Parameter ¶m) const fp.print(") const\n"); fp.print("{\n"); - fp.print("\tconst %s * base = NULL;\n", templateName); - fp.print("\tif (m_baseData != NULL)\n"); + fp.print("\tconst %s * base = nullptr;\n", templateName); + fp.print("\tif (m_baseData != nullptr)\n"); fp.print("\t{\n"); fp.print("\t\tbase = dynamic_cast(m_baseData);\n", templateName); -// fp.print("\t\tDEBUG_FATAL(base == NULL, (\"base template wrong type\"));\n"); +// fp.print("\t\tDEBUG_FATAL(base == nullptr, (\"base template wrong type\"));\n"); fp.print("\t}\n\n"); const char *arrayIndex = ""; @@ -2820,18 +2820,18 @@ void TemplateData::writeSourceGetDynamicVariable(File &fp, const Parameter ¶ fp.print(") const\n"); fp.print("{\n"); - fp.print("\tconst %s * base = NULL;\n", templateName); - fp.print("\tif (m_baseData != NULL)\n"); + fp.print("\tconst %s * base = nullptr;\n", templateName); + fp.print("\tif (m_baseData != nullptr)\n"); fp.print("\t{\n"); fp.print("\t\tbase = dynamic_cast(m_baseData);\n", templateName); -// fp.print("\t\tDEBUG_FATAL(base == NULL, (\"base template wrong type\"));\n"); +// fp.print("\t\tDEBUG_FATAL(base == nullptr, (\"base template wrong type\"));\n"); fp.print("\t}\n\n"); if (param.list_type == LIST_NONE) { writeSourceReturnBaseValue(fp, param, ""); - fp.print("\tif (m_%s.isExtendingBaseList() && base != NULL)\n", pname); + fp.print("\tif (m_%s.isExtendingBaseList() && base != nullptr)\n", pname); fp.print("\t\tbase->get%s(list);\n", upperName.c_str()); fp.print("\tm_%s.getDynamicVariableList(list);\n", pname); } @@ -2840,7 +2840,7 @@ void TemplateData::writeSourceGetDynamicVariable(File &fp, const Parameter ¶ fp.print("\tDEBUG_FATAL(index < 0 || index >= %d, (\"" "template param index out of range\"));\n", param.list_size); writeSourceReturnBaseValue(fp, param, ""); - fp.print("\tif (m_%s[index].isExtendingBaseList() && base != NULL)\n", pname); + fp.print("\tif (m_%s[index].isExtendingBaseList() && base != nullptr)\n", pname); fp.print("\t\tbase->get%s(list, index);\n", upperName.c_str()); fp.print("\tm_%s[index].getDynamicVariableList(list);\n", pname); } @@ -2872,19 +2872,19 @@ void TemplateData::writeSourceGetTemplate(File &fp, const Parameter ¶m) cons fp.print(") const\n"); fp.print("{\n"); - fp.print("\tconst %s * base = NULL;\n", templateName); - fp.print("\tif (m_baseData != NULL)\n"); + fp.print("\tconst %s * base = nullptr;\n", templateName); + fp.print("\tif (m_baseData != nullptr)\n"); fp.print("\t{\n"); fp.print("\t\tbase = dynamic_cast(m_baseData);\n", templateName); -// fp.print("\t\tDEBUG_FATAL(base == NULL, (\"base template wrong type\"));\n"); +// fp.print("\t\tDEBUG_FATAL(base == nullptr, (\"base template wrong type\"));\n"); fp.print("\t}\n\n"); if (param.list_type == LIST_NONE) { writeSourceReturnBaseValue(fp, param, ""); - fp.print("\tconst %s%s * returnValue = NULL;\n", + fp.print("\tconst %s%s * returnValue = nullptr;\n", EnumLocationTypes[getTemplateLocation()], filenameLowerToUpper(param.extendedName).c_str()); fp.print("\tconst std::string & templateName = m_%s.getValue();\n", pname); @@ -2894,7 +2894,7 @@ void TemplateData::writeSourceGetTemplate(File &fp, const Parameter ¶m) cons "ObjectTemplateList::fetch(templateName));\n", EnumLocationTypes[getTemplateLocation()], filenameLowerToUpper(param.extendedName).c_str()); - fp.print("\t\tif (returnValue == NULL)\n"); + fp.print("\t\tif (returnValue == nullptr)\n"); fp.print("\t\t\tWARNING_STRICT_FATAL(true, (\"Error loading template %%s\"," "templateName.c_str()));\n"); fp.print("\t}\n"); @@ -2918,7 +2918,7 @@ void TemplateData::writeSourceGetTemplate(File &fp, const Parameter ¶m) cons writeSourceReturnBaseValue(fp, param, ""); } - fp.print("\tconst %s%s * returnValue = NULL;\n", + fp.print("\tconst %s%s * returnValue = nullptr;\n", EnumLocationTypes[getTemplateLocation()], filenameLowerToUpper(param.extendedName).c_str()); fp.print("\tconst std::string & templateName = m_%s[index]%sgetValue();\n", @@ -2929,7 +2929,7 @@ void TemplateData::writeSourceGetTemplate(File &fp, const Parameter ¶m) cons "ObjectTemplateList::fetch(templateName));\n", EnumLocationTypes[getTemplateLocation()], filenameLowerToUpper(param.extendedName).c_str()); - fp.print("\t\tif (returnValue == NULL)\n"); + fp.print("\t\tif (returnValue == nullptr)\n"); fp.print("\t\t\tWARNING_STRICT_FATAL(true, (\"Error loading template %%s\"," "templateName.c_str()));\n"); fp.print("\t}\n"); @@ -2974,17 +2974,17 @@ void TemplateData::writeSourceGetEnum(File &fp, const Parameter ¶m) const fp.print("#endif\n\n"); } - fp.print("\tconst %s * base = NULL;\n", className); - fp.print("\tif (m_baseData != NULL)\n"); + fp.print("\tconst %s * base = nullptr;\n", className); + fp.print("\tif (m_baseData != nullptr)\n"); fp.print("\t{\n"); fp.print("\t\tbase = dynamic_cast(m_baseData);\n", className); -// fp.print("\t\tDEBUG_FATAL(base == NULL, (\"base template wrong type\"));\n"); +// fp.print("\t\tDEBUG_FATAL(base == nullptr, (\"base template wrong type\"));\n"); if (param.list_type == LIST_NONE) { // get the test base value fp.print("#ifdef _DEBUG\n"); - fp.print("\t\tif (testData && base != NULL)\n"); + fp.print("\t\tif (testData && base != nullptr)\n"); fp.print("\t\t\ttestDataValue = base->get%s(true);\n", upperName.c_str()); fp.print("#endif\n"); } @@ -2999,7 +2999,7 @@ void TemplateData::writeSourceGetEnum(File &fp, const Parameter ¶m) const // check the return value vs the base value, and warn if the same fp.print("#ifdef _DEBUG\n"); - fp.print("\tif (testData && base != NULL)\n"); + fp.print("\tif (testData && base != nullptr)\n"); fp.print("\t{\n"); // fp.print("\t\tif (testDataValue == value)\n"); // fp.print("\t\t\tDEBUG_WARNING(true, (\"Template %%s, parameter %s is " @@ -3061,11 +3061,11 @@ std::string upperName; fp.print(") const\n"); fp.print("{\n"); - fp.print("\tconst %s * base = NULL;\n", templateName); - fp.print("\tif (m_baseData != NULL)\n"); + fp.print("\tconst %s * base = nullptr;\n", templateName); + fp.print("\tif (m_baseData != nullptr)\n"); fp.print("\t{\n"); fp.print("\t\tbase = dynamic_cast(m_baseData);\n", templateName); -// fp.print("\t\tDEBUG_FATAL(base == NULL, (\"base template wrong type\"));\n"); +// fp.print("\t\tDEBUG_FATAL(base == nullptr, (\"base template wrong type\"));\n"); fp.print("\t}\n\n"); if (param.list_type == LIST_NONE) @@ -3100,7 +3100,7 @@ std::string upperName; fp.print("\tNOT_NULL(param);\n"); const TemplateData *structData = getStruct(param.extendedName.c_str()); - if (structData == NULL) + if (structData == nullptr) { fprintf(stderr, "unable to find structure %s\n", param.extendedName.c_str()); @@ -3108,7 +3108,7 @@ std::string upperName; } std::string versionString = "versionOk"; - if (m_templateParent == NULL) + if (m_templateParent == nullptr) versionString = "m_" + versionString; structData->writeSourceGetStructAssignments(fp, versionString, MinMaxNames[i]); @@ -3248,7 +3248,7 @@ void TemplateData::writeSourceReadIff(File &fp) const fp.print("char paramName[MAX_NAME_SIZE];\n"); fp.print("\n"); - if (m_fileParent != NULL) + if (m_fileParent != nullptr) { // check that we are in our form fp.print("\tif (file.getCurrentName() != %s_tag)\n", @@ -3277,14 +3277,14 @@ void TemplateData::writeSourceReadIff(File &fp) const // fp.print("\t\t%s * mybase = dynamic_cast<%s *>(base);\n", // templateName, templateName); - // fp.print("\t\tFATAL(mybase == NULL, (\"trying to derive a template from an incompatable template type\"));\n"); - fp.print("\t\tDEBUG_WARNING(base == NULL, (\"was unable to load base template %%s\", baseFilename.c_str()));\n"); - fp.print("\t\tif (m_baseData == base && base != NULL)\n"); + // fp.print("\t\tFATAL(mybase == nullptr, (\"trying to derive a template from an incompatable template type\"));\n"); + fp.print("\t\tDEBUG_WARNING(base == nullptr, (\"was unable to load base template %%s\", baseFilename.c_str()));\n"); + fp.print("\t\tif (m_baseData == base && base != nullptr)\n"); fp.print("\t\t\tbase->releaseReference();\n"); fp.print("\t\telse\n"); fp.print("\t\t{\n"); - fp.print("\t\t\tif (m_baseData != NULL)\n"); + fp.print("\t\t\tif (m_baseData != nullptr)\n"); fp.print("\t\t\t\tm_baseData->releaseReference();\n"); fp.print("\t\t\tm_baseData = base;\n"); @@ -3356,7 +3356,7 @@ void TemplateData::writeSourceReadIff(File &fp) const " ++iter)\n", param.name.c_str(), param.name.c_str()); fp.print("\t\t\t{\n"); fp.print("\t\t\t\tdelete *iter;\n"); - fp.print("\t\t\t\t*iter = NULL;\n"); + fp.print("\t\t\t\t*iter = nullptr;\n"); fp.print("\t\t\t}\n"); fp.print("\t\t\tm_%s.clear();\n", param.name.c_str()); fp.print("\t\t\tm_%sAppend = file.read_bool8();\n", param.name.c_str()); @@ -3408,7 +3408,7 @@ void TemplateData::writeSourceReadIff(File &fp) const fp.print("\n"); fp.print("\tfile.exitForm();\n"); - if (m_fileParent != NULL) + if (m_fileParent != nullptr) { // enter the next form if (!baseNameString.empty() && baseNameString != ROOT_TEMPLATE_NAME) @@ -3450,7 +3450,7 @@ void TemplateData::writeSourceWriteIff(File &fp) const fp.print("int count;\n\n"); // write form enter header stuff - if (m_fileParent != NULL) + if (m_fileParent != nullptr) { fp.print("\tfile.insertForm(%s_tag);\n", m_fileParent->getTemplateName().c_str()); @@ -3552,7 +3552,7 @@ void TemplateData::writeSourceWriteIff(File &fp) const fp.print("\n"); fp.print("\tfile.exitForm(true);\n"); - if (m_fileParent != NULL) + if (m_fileParent != nullptr) { // call base class write iff method if (!getBaseName().empty() && getBaseName() != ROOT_TEMPLATE_NAME) @@ -3576,7 +3576,7 @@ void TemplateData::writeSourceWriteIff(File &fp) const */ void TemplateData::writeSourceCleanup(File &fp) const { - if (m_fileParent != NULL) + if (m_fileParent != nullptr) fp.print("%s\n", TDF_CLEANUP_BEGIN); const char * const * variableNames = DataVariableNames; @@ -3613,7 +3613,7 @@ void TemplateData::writeSourceCleanup(File &fp) const " ++iter)\n", param.name.c_str(), param.name.c_str()); fp.print("\t\t{\n"); fp.print("\t\t\tdelete *iter;\n"); - fp.print("\t\t\t*iter = NULL;\n"); + fp.print("\t\t\t*iter = nullptr;\n"); fp.print("\t\t}\n"); fp.print("\t\tm_%s.clear();\n", param.name.c_str()); fp.print("\t}\n"); @@ -3624,7 +3624,7 @@ void TemplateData::writeSourceCleanup(File &fp) const } } - if (m_fileParent != NULL) + if (m_fileParent != nullptr) fp.print("%s\n", TDF_CLEANUP_END); } // TemplateData::writeSourceCleanup @@ -3719,9 +3719,9 @@ ParameterList::const_iterator iter; fp.print("\t\t{\n"); fp.print("\t\t\tif (deepCheck && !isParamLoaded(name, false, 0))\n"); fp.print("\t\t\t{\n"); - fp.print("\t\t\t\tif (getBaseTemplate() != NULL)\n"); + fp.print("\t\t\t\tif (getBaseTemplate() != nullptr)\n"); fp.print("\t\t\t\t\treturn getBaseTemplate()->get%s(name, deepCheck, index);\n", FUNC_NAMES[i]); - fp.print("\t\t\t\treturn NULL;\n"); + fp.print("\t\t\t\treturn nullptr;\n"); fp.print("\t\t\t}\n"); fp.print("\t\t\treturn &m_%s;\n", pname); fp.print("\t\t}\n"); @@ -3751,9 +3751,9 @@ ParameterList::const_iterator iter; fp.print("\t\t{\n"); fp.print("\t\t\tif (deepCheck && !isParamLoaded(name, false, index))\n"); fp.print("\t\t\t{\n"); - fp.print("\t\t\t\tif (getBaseTemplate() != NULL)\n"); + fp.print("\t\t\t\tif (getBaseTemplate() != nullptr)\n"); fp.print("\t\t\t\t\treturn getBaseTemplate()->get%s(name, deepCheck, index);\n", FUNC_NAMES[i]); - fp.print("\t\t\t\treturn NULL;\n"); + fp.print("\t\t\t\treturn nullptr;\n"); fp.print("\t\t\t}\n"); fp.print("\t\t\treturn &m_%s[index];\n", pname); fp.print("\t\t}\n"); @@ -3774,7 +3774,7 @@ ParameterList::const_iterator iter; fp.print("\treturn %s::get%s(name, deepCheck, index);\n", baseName, FUNC_NAMES[i]); } if (paramCount != 0) - fp.print("\treturn NULL;\n"); + fp.print("\treturn nullptr;\n"); fp.print("}\t//%s::get%s\n", templateName, FUNC_NAMES[i]); fp.print("\n"); } @@ -4227,7 +4227,7 @@ void TemplateData::writeParameterDefault(File &fp, const Parameter ¶m, int i case LIST_ENUM_ARRAY: { const EnumList * enumList = getEnumList(param.enum_list_name, false); - DEBUG_FATAL(enumList == NULL, ("unknown enum name %s", + DEBUG_FATAL(enumList == nullptr, ("unknown enum name %s", param.enum_list_name.c_str())); if (index >= 0 && index < param.list_size) @@ -4288,7 +4288,7 @@ void TemplateData::writeStructParameterDefault(File &fp, const Parameter ¶m, case LIST_ENUM_ARRAY: { const EnumList * enumList = getEnumList(param.enum_list_name, false); - DEBUG_FATAL(enumList == NULL, ("unknown enum name %s", + DEBUG_FATAL(enumList == nullptr, ("unknown enum name %s", param.enum_list_name.c_str())); EnumList::const_iterator listIter; @@ -4357,7 +4357,7 @@ void TemplateData::writeDefaultValue(File &fp, const Parameter ¶m) const case TYPE_ENUM: { const EnumList * enumList = getEnumList(param.extendedName, false); - DEBUG_FATAL(enumList == NULL, ("unknown enum name %s", + DEBUG_FATAL(enumList == nullptr, ("unknown enum name %s", param.extendedName.c_str())); fp.print("%s", enumList->at(0).name.c_str()); } @@ -4398,7 +4398,7 @@ const TemplateData::Parameter *TemplateData::getParameter( { NOT_NULL(name); - TemplateData::Parameter const *result = NULL; + TemplateData::Parameter const *result = nullptr; // Shallow check, just checks this immediate tdf @@ -4414,7 +4414,7 @@ const TemplateData::Parameter *TemplateData::getParameter( const TemplateDefinitionFile *TemplateDefinitionFile = getTdfForParameter(name); - if (TemplateDefinitionFile != NULL) + if (TemplateDefinitionFile != nullptr) { result = TemplateDefinitionFile->getTemplateData(TemplateDefinitionFile->getHighestVersion())->getParameter(name); } diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateData.h b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateData.h index cac38cd7..f7949388 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateData.h +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateData.h @@ -238,11 +238,11 @@ inline bool TemplateData::isWritingForCompiler(void) const inline const TemplateDefinitionFile * TemplateData::getFileParent(void) const { - if (m_fileParent != NULL) + if (m_fileParent != nullptr) return m_fileParent; - if (m_templateParent != NULL) + if (m_templateParent != nullptr) return m_templateParent->getFileParent(); - return NULL; + return nullptr; } // TemplateData::getFileParent diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateDataIterator.cpp b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateDataIterator.cpp index 11b8d2dd..5a5c1c48 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateDataIterator.cpp +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateDataIterator.cpp @@ -25,7 +25,7 @@ //----------------------------------------------------------------------------- TemplateDataIterator::TemplateDataIterator() -: m_templateDataToIterate(NULL), +: m_templateDataToIterate(nullptr), m_numItems(0), m_noMoreData(true) { @@ -34,7 +34,7 @@ TemplateDataIterator::TemplateDataIterator() //----------------------------------------------------------------------------- TemplateDataIterator::TemplateDataIterator(const TemplateData& templateData) -: m_templateDataToIterate(NULL), +: m_templateDataToIterate(nullptr), m_numItems(0), m_noMoreData(true) { @@ -45,7 +45,7 @@ TemplateDataIterator::TemplateDataIterator(const TemplateData& templateData) TemplateDataIterator::~TemplateDataIterator() { - m_templateDataToIterate = NULL; + m_templateDataToIterate = nullptr; } //----------------------------------------------------------------------------- @@ -62,7 +62,7 @@ TemplateDataIterator::setTo(const TemplateData &templateData) // .. end at the child TDF's. const ParameterList* parameterListToAdd; - while(m_templateDataToIterate != NULL) + while(m_templateDataToIterate != nullptr) { parameterListToAdd = &(m_templateDataToIterate->m_parameters); m_numItems += parameterListToAdd->size(); @@ -75,23 +75,23 @@ TemplateDataIterator::setTo(const TemplateData &templateData) } // Get the template data from the parent TDF - if(m_templateDataToIterate->m_fileParent != NULL) + if(m_templateDataToIterate->m_fileParent != nullptr) { const TemplateDefinitionFile* parentFile = m_templateDataToIterate->m_fileParent->getBaseDefinitionFile(); - if(parentFile != NULL) + if(parentFile != nullptr) { m_templateDataToIterate = parentFile->getTemplateData(parentFile->getHighestVersion()); } else { - m_templateDataToIterate = NULL; + m_templateDataToIterate = nullptr; } } else { - m_templateDataToIterate = NULL; + m_templateDataToIterate = nullptr; } } @@ -164,7 +164,7 @@ TemplateDataIterator::operator *() const { if(this->end()) { - return NULL; + return nullptr; } else { diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateDefinitionFile.cpp b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateDefinitionFile.cpp index f191b3fb..4025ab5f 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateDefinitionFile.cpp +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateDefinitionFile.cpp @@ -20,9 +20,9 @@ * Class constructor. */ TemplateDefinitionFile::TemplateDefinitionFile(void) : - m_baseDefinitionFile(NULL), + m_baseDefinitionFile(nullptr), m_writeForCompilerFlag(false), - m_filterCompiledRegex(NULL) + m_filterCompiledRegex(nullptr) { cleanup(); } // TemplateDefinitionFile::TemplateDefinitionFile @@ -51,24 +51,24 @@ void TemplateDefinitionFile::cleanup(void) m_compilerPath.clear(); m_fileComments.clear(); - if (m_baseDefinitionFile != NULL) + if (m_baseDefinitionFile != nullptr) { delete m_baseDefinitionFile; - m_baseDefinitionFile = NULL; + m_baseDefinitionFile = nullptr; } std::map::iterator iter; for (iter = m_templateMap.begin(); iter != m_templateMap.end(); ++iter) { delete (*iter).second; - (*iter).second = NULL; + (*iter).second = nullptr; } m_templateMap.clear(); - if (m_filterCompiledRegex != NULL) + if (m_filterCompiledRegex != nullptr) { RegexServices::freeMemory(m_filterCompiledRegex); - m_filterCompiledRegex = NULL; + m_filterCompiledRegex = nullptr; } } // TemplateDefinitionFile::cleanup @@ -104,7 +104,7 @@ static const std::string wildcard = "*"; if (!m_templateNameFilter.empty()) return m_templateNameFilter; - if (m_baseDefinitionFile != NULL) + if (m_baseDefinitionFile != nullptr) return m_baseDefinitionFile->getTemplateNameFilter(); return wildcard; @@ -121,7 +121,7 @@ bool TemplateDefinitionFile::isValidTemplateName(const Filename & name) const { if (m_templateNameFilter.empty()) { - if (m_baseDefinitionFile != NULL) + if (m_baseDefinitionFile != nullptr) return m_baseDefinitionFile->isValidTemplateName(name); else return true; @@ -131,7 +131,7 @@ bool TemplateDefinitionFile::isValidTemplateName(const Filename & name) const int const matchDataElementCount = maxCaptureCount * 3; int matchData[matchDataElementCount]; - int const matchCode = pcre_exec(m_filterCompiledRegex, NULL, name.getName().c_str(), name.getName().length(), 0, 0, matchData, matchDataElementCount); + int const matchCode = pcre_exec(m_filterCompiledRegex, nullptr, name.getName().c_str(), name.getName().length(), 0, 0, matchData, matchDataElementCount); bool const result = (matchCode >= 0); if (matchCode < -1) @@ -425,10 +425,10 @@ void TemplateDefinitionFile::writeClassSourceBegin(File &fp, const TemplateData fp.print(" */\n"); fp.print("Tag %s::getHighestTemplateVersion(void) const\n", name); fp.print("{\n"); - fp.print("\tif (m_baseData == NULL)\n"); + fp.print("\tif (m_baseData == nullptr)\n"); fp.print("\t\treturn m_templateVersion;\n"); fp.print("\tconst %s * base = dynamic_cast(m_baseData);\n", name, name); - fp.print("\tif (base == NULL)\n"); + fp.print("\tif (base == nullptr)\n"); fp.print("\t\treturn m_templateVersion;\n"); fp.print("\treturn std::max(m_templateVersion, base->getHighestTemplateVersion());\n"); fp.print("} // %s::getHighestTemplateVersion\n", name); @@ -449,7 +449,7 @@ static const int BUFFER_SIZE = 1024; int lineLen; char buffer[BUFFER_SIZE]; char token[BUFFER_SIZE]; -TemplateData *currentTemplate = NULL; +TemplateData *currentTemplate = nullptr; cleanup(); @@ -510,7 +510,7 @@ TemplateData *currentTemplate = NULL; currentTemplate = new TemplateData(version, *this); m_templateMap[version] = currentTemplate; } - else if (currentTemplate != NULL) + else if (currentTemplate != nullptr) { line = currentTemplate->parseLine(fp, buffer, token); if (line == CHAR_ERROR) @@ -540,7 +540,7 @@ TemplateData *currentTemplate = NULL; fp.printError("unable to open base template definition"); return -1; } - if (m_baseDefinitionFile == NULL) + if (m_baseDefinitionFile == nullptr) m_baseDefinitionFile = new TemplateDefinitionFile; else m_baseDefinitionFile->cleanup(); @@ -570,19 +570,19 @@ TemplateData *currentTemplate = NULL; m_templateNameFilter = token; //-- Attempt to compile the regex. - if (m_filterCompiledRegex != NULL) + if (m_filterCompiledRegex != nullptr) { // First free the existing compiled regex. RegexServices::freeMemory(m_filterCompiledRegex); - m_filterCompiledRegex = NULL; + m_filterCompiledRegex = nullptr; } //-- Compile the new regex. - char const *errorString = NULL; + char const *errorString = nullptr; int errorOffset = 0; - m_filterCompiledRegex = pcre_compile(m_templateNameFilter.c_str(), 0, &errorString, &errorOffset, NULL); - WARNING(m_filterCompiledRegex == NULL, ("TemplateDefinitionFile::parse(): pcre_compile() failed, error=[%s], errorOffset=[%d], regex text=[%s].", errorString, errorOffset, m_templateNameFilter.c_str())); + m_filterCompiledRegex = pcre_compile(m_templateNameFilter.c_str(), 0, &errorString, &errorOffset, nullptr); + WARNING(m_filterCompiledRegex == nullptr, ("TemplateDefinitionFile::parse(): pcre_compile() failed, error=[%s], errorOffset=[%d], regex text=[%s].", errorString, errorOffset, m_templateNameFilter.c_str())); } else if (strcmp(token, "clientpath") == 0 || strcmp(token, "serverpath") == 0 || diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateDefinitionFile.h b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateDefinitionFile.h index 82487e67..2ea426fc 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateDefinitionFile.h +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateDefinitionFile.h @@ -111,7 +111,7 @@ inline TemplateData *TemplateDefinitionFile::getTemplateData(int version) const { std::map::const_iterator iter = m_templateMap.find(version); if (iter == m_templateMap.end()) - return NULL; + return nullptr; return (*iter).second; } diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateGlobals.cpp b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateGlobals.cpp index 2b376aa0..b12dc5ef 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateGlobals.cpp +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateGlobals.cpp @@ -57,15 +57,15 @@ int strip(char *buffer) * the size of buffer * * @return the next non-whitespace character in the string after the token, or - * NULL if the end of line has been reached + * nullptr if the end of line has been reached */ const char *getNextWhitespaceToken(const char *buffer, char *token) { NOT_NULL(token); *token = '\0'; - if (buffer == NULL) - return NULL; + if (buffer == nullptr) + return nullptr; const char *from = buffer; char *to = token; @@ -74,7 +74,7 @@ const char *getNextWhitespaceToken(const char *buffer, char *token) while (isspace(*from) && *from != '\0') ++from; if (*from == '\0') - return NULL; + return nullptr; // copy the token while (!isspace(*from) && *from != '\0') @@ -85,7 +85,7 @@ const char *getNextWhitespaceToken(const char *buffer, char *token) while (isspace(*from) && *from != '\0') ++from; if (*from == '\0') - return NULL; + return nullptr; return from; } // getNextWhitespaceToken @@ -97,20 +97,20 @@ const char *getNextWhitespaceToken(const char *buffer, char *token) * the size of buffer * * @return the next token, defined by the 1st non-whitespace character in buffer: - * if it is '/' and the next character is '/', NULL + * if it is '/' and the next character is '/', nullptr * if it is a double-quote, the text until the next double quote (not including \") * if it is a symbol, the symbol * if it is a number, the next characters that make a valid integer or float * if it is a character, the text until the next whitespace or symbol, not including _ - * if it is NULL, NULL + * if it is nullptr, nullptr */ const char *getNextToken(const char *buffer, char *token) { NOT_NULL(token); *token = '\0'; - if (buffer == NULL) - return NULL; + if (buffer == nullptr) + return nullptr; const char *from = buffer; char *to = token; @@ -119,12 +119,12 @@ const char *getNextToken(const char *buffer, char *token) while (isspace(*from) && *from != '\0') ++from; if (*from == '\0') - return NULL; + return nullptr; if (*from == '/' && *(from+1) == '/') { // comment - return NULL; + return nullptr; } else if (isdigit(*from) || ((*from == '+' || *from == '-') && isdigit(*(from + 1))) @@ -173,7 +173,7 @@ const char *getNextToken(const char *buffer, char *token) while (isspace(*from) && *from != '\0') ++from; if (*from == '\0') - return NULL; + return nullptr; return from; } // getNextToken @@ -247,9 +247,9 @@ std::string filenameUpperToLower(const std::string & filename) std::string concatPaths(const char *path1, const char *path2) { // test for missing path - if (path1 == NULL || *path1 == '\0') + if (path1 == nullptr || *path1 == '\0') return path2; - if (path2 == NULL || *path2 == '\0') + if (path2 == nullptr || *path2 == '\0') return path1; #ifdef WIN32 @@ -286,7 +286,7 @@ std::string getNextHighestPath(const char *path) // find the two highest path separators const char *separator1 = strrchr(path, PATH_SEPARATOR); - if (separator1 == NULL) + if (separator1 == nullptr) { #ifdef WIN32 if (isalpha(*path) && *(path + 1) == ':') @@ -304,7 +304,7 @@ std::string getNextHighestPath(const char *path) return std::string(path, 3); #endif const char *separator2 = strrchr(separator1 - 1, PATH_SEPARATOR); - if (separator2 == NULL) + if (separator2 == nullptr) return std::string(path, separator1 - path); return std::string(path, separator2 - path); diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TpfFile.cpp b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TpfFile.cpp index 425bf716..23b456d5 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TpfFile.cpp +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TpfFile.cpp @@ -27,12 +27,12 @@ * Class constructor. */ TpfFile::TpfFile(void) : - m_template(NULL), + m_template(nullptr), m_baseTemplateName(), - m_currTemplateDef(NULL), - m_templateData(NULL), - m_highestTemplateData(NULL), - m_parameter(NULL), + m_currTemplateDef(nullptr), + m_templateData(nullptr), + m_highestTemplateData(nullptr), + m_parameter(nullptr), m_path(), m_iffPath(), m_templateLocation(LOC_NONE) @@ -53,14 +53,14 @@ TpfFile::~TpfFile() */ void TpfFile::cleanup(void) { - m_parameter = NULL; + m_parameter = nullptr; m_fp.close(); - if (m_template != NULL) + if (m_template != nullptr) { delete m_template; - m_template = NULL; + m_template = nullptr; } - m_currTemplateDef = NULL; + m_currTemplateDef = nullptr; IGNORE_RETURN(m_baseTemplateName.erase()); } // TpfFile::cleanup @@ -174,7 +174,7 @@ int TpfFile::loadTemplate(const Filename & filename) if (lineLen == -1) { // if we are a base template, check for missing parameters - if (m_highestTemplateData != NULL && m_template != NULL && + if (m_highestTemplateData != nullptr && m_template != nullptr && !m_highestTemplateData->verifyTemplate(m_template, m_fp)) { result = -1; @@ -190,7 +190,7 @@ int TpfFile::loadTemplate(const Filename & filename) // parse the 1st token: comment, @flag, or variable name const char *line = m_buffer; line = getNextToken(line, m_token); - if (*m_token == '\0' && line == NULL) + if (*m_token == '\0' && line == nullptr) { // empty line or comment continue; @@ -201,7 +201,7 @@ int TpfFile::loadTemplate(const Filename & filename) } else if (isalpha(*m_token)) { - if (m_template == NULL) + if (m_template == nullptr) { m_fp.printError("unable to parse parameters, no template class defined"); return -1; @@ -209,7 +209,7 @@ int TpfFile::loadTemplate(const Filename & filename) line = parseAssignment(line); if (line == CHAR_ERROR) result = -1; - else if (line != NULL) + else if (line != nullptr) { char buffer[1024]; if (getNextToken(line, buffer)) @@ -261,7 +261,7 @@ int TpfFile::makeIffFiles(const Filename & filename) if (result != 0) return result; - Filename iffname(NULL, m_iffPath.c_str(), filename.getName().c_str(), + Filename iffname(nullptr, m_iffPath.c_str(), filename.getName().c_str(), IFF_EXTENSION); Iff iffFile(1024, true, true); m_template->save(iffFile); @@ -291,20 +291,20 @@ int TpfFile::WriteIffFile(Iff & iffData, const Filename & fileName) { // there are problems with long path names in Windows that changing to // the directory seems to fix - char *buffer = NULL; + char *buffer = nullptr; DWORD buflen; // get our current path - buflen = GetFullPathName(".", 0, buffer, NULL); + buflen = GetFullPathName(".", 0, buffer, nullptr); buffer = new char[buflen + 1]; - buflen = GetFullPathName(".", buflen + 1, buffer, NULL); + buflen = GetFullPathName(".", buflen + 1, buffer, nullptr); Unicode::String srcPath = Unicode::narrowToWide(buffer); delete[] buffer; srcPath = L"\\\\?\\" + srcPath; // get the destination path std::string correctPath(fileName.getDrive() + fileName.getPath()); - buflen = GetFullPathName(correctPath.c_str(), 0, buffer, NULL); + buflen = GetFullPathName(correctPath.c_str(), 0, buffer, nullptr); buffer = new char[buflen + 1]; - buflen = GetFullPathName(correctPath.c_str(), buflen + 1, buffer, NULL); + buflen = GetFullPathName(correctPath.c_str(), buflen + 1, buffer, nullptr); Unicode::String destPath = Unicode::narrowToWide(buffer); delete[] buffer; destPath = L"\\\\?\\" + destPath; @@ -323,18 +323,18 @@ int TpfFile::WriteIffFile(Iff & iffData, const Filename & fileName) } else { - char *buffer = NULL; + char *buffer = nullptr; DWORD buflen; // get our current path - buflen = GetFullPathName(".", 0, buffer, NULL); + buflen = GetFullPathName(".", 0, buffer, nullptr); buffer = new char[buflen + 1]; - buflen = GetFullPathName(".", buflen + 1, buffer, NULL); + buflen = GetFullPathName(".", buflen + 1, buffer, nullptr); delete[] buffer; // get the destination path std::string correctPath(fileName.getDrive() + fileName.getPath()); - buflen = GetFullPathName(correctPath.c_str(), 0, buffer, NULL); + buflen = GetFullPathName(correctPath.c_str(), 0, buffer, nullptr); buffer = new char[buflen + 1]; - buflen = GetFullPathName(correctPath.c_str(), buflen + 1, buffer, NULL); + buflen = GetFullPathName(correctPath.c_str(), buflen + 1, buffer, nullptr); std::string destPath = buffer; delete[] buffer; // change to the destination path @@ -389,7 +389,7 @@ int result = 0; cleanup(); File temp_fp; - if (!temp_fp.open(tmpnam(NULL), "wt")) + if (!temp_fp.open(tmpnam(nullptr), "wt")) { fprintf(stderr, "error opening temp file for template replacement\n"); return -1; @@ -419,7 +419,7 @@ int result = 0; // parse the 1st token: comment, @flag, or variable name const char *line = m_buffer; line = getNextToken(line, m_token); - if (*m_token == '\0' && line == NULL) + if (*m_token == '\0' && line == nullptr) { // empty line or comment if (temp_fp.puts(m_buffer) < 0) @@ -432,7 +432,7 @@ int result = 0; { // @base or @class const char *templine = getNextToken(line, m_token); - if (templine == NULL) + if (templine == nullptr) { m_fp.printEolError(); return -1; @@ -452,7 +452,7 @@ int result = 0; else { // if we are a base template, check for missing parameters - if (m_highestTemplateData != NULL && m_template != NULL) + if (m_highestTemplateData != nullptr && m_template != nullptr) { m_highestTemplateData->updateTemplate(m_template, temp_fp); } @@ -462,7 +462,7 @@ int result = 0; else if (isalpha(*m_token)) { m_parameter = m_templateData->getParameter(m_token); - if (m_parameter == NULL) + if (m_parameter == nullptr) { } else @@ -494,14 +494,14 @@ int result = 0; int TpfFile::parseTemplateCommand(const char *line) { line = getNextToken(line, m_token); - if (line == NULL) + if (line == nullptr) { m_fp.printEolError(); return -1; } if (strcmp(m_token, "base") == 0) { - if (m_template != NULL && !m_template->getBaseTemplateName().empty()) + if (m_template != nullptr && !m_template->getBaseTemplateName().empty()) { m_fp.printError("base template already defined"); return -1; @@ -509,7 +509,7 @@ int TpfFile::parseTemplateCommand(const char *line) line = getNextWhitespaceToken(line, m_token); if (isalpha(*m_token)) { - if (m_template != NULL) + if (m_template != nullptr) { if (m_template->setBaseTemplateName(m_token) != 0) { @@ -536,7 +536,7 @@ int TpfFile::parseTemplateCommand(const char *line) { // if we are a base template, check for missing parameters // @todo: fix so we can verify non-base templates - if (m_highestTemplateData != NULL && m_template != NULL && + if (m_highestTemplateData != nullptr && m_template != nullptr && !m_highestTemplateData->verifyTemplate(m_template, m_fp)) { return -1; @@ -564,7 +564,7 @@ int TpfFile::parseTemplateCommand(const char *line) } int result = 0; - if(m_currTemplateDef == NULL) + if(m_currTemplateDef == nullptr) { result = m_templateDef.parse(fp); m_currTemplateDef = &m_templateDef; @@ -579,7 +579,7 @@ int TpfFile::parseTemplateCommand(const char *line) while(lookingForMatchingData) { - if(templateDataChild == NULL) // DHERMAN Check here for template definition names not matching + if(templateDataChild == nullptr) // DHERMAN Check here for template definition names not matching { char errbuf[256]; @@ -618,7 +618,7 @@ int TpfFile::parseTemplateCommand(const char *line) int version = static_cast(atol(m_token)); m_templateData = m_currTemplateDef->getTemplateData(version); - if (m_templateData == NULL) + if (m_templateData == nullptr) { char errbuf[256]; sprintf(errbuf, "can't find version %d in template definition %s", @@ -634,14 +634,14 @@ int TpfFile::parseTemplateCommand(const char *line) return -1; } - if (m_template == NULL) + if (m_template == nullptr) { // this is the highest class level, make a blank template // with it const TagInfo & templateId = m_currTemplateDef->getTemplateId(); m_template = dynamic_cast(TpfTemplate::createTemplate( templateId.tag)); - if (m_template == NULL) + if (m_template == nullptr) { m_fp.printError("Unable to create template class. May not be installed."); return -1; @@ -708,12 +708,12 @@ enum PARSE_ENUM_ASSIGNMENT, PARSE_ENUM_VALUE } parseState = PARSE_ENUM_TOKEN; -TemplateData::EnumList * enumList = NULL; // current list being defined -TemplateData::EnumData * enumData = NULL; // current item being defined +TemplateData::EnumList * enumList = nullptr; // current list being defined +TemplateData::EnumData * enumData = nullptr; // current item being defined int currentEnumValue = 0; File fp; - Filename headerFilename(NULL, NULL, headerName, NULL); + Filename headerFilename(nullptr, nullptr, headerName, nullptr); int i = 0; while (!fp.exists(headerFilename) && i < MAX_DIRECTORY_DEPTH) { @@ -744,7 +744,7 @@ int currentEnumValue = 0; } const char * line = m_buffer; - while (line != NULL) + while (line != nullptr) { const char * templine = getNextToken(line, m_token); switch (parseState) @@ -788,7 +788,7 @@ int currentEnumValue = 0; case PARSE_END_BRACKET : if (*m_token == '}') { - enumList = NULL; + enumList = nullptr; parseState = PARSE_ENUM_TOKEN; } else @@ -798,7 +798,7 @@ int currentEnumValue = 0; } break; case PARSE_ENUM_DEF: - if (isalpha(*m_token) && enumList != NULL) + if (isalpha(*m_token) && enumList != nullptr) { enumList->push_back(TemplateData::EnumData()); enumData = &enumList->back(); @@ -815,7 +815,7 @@ int currentEnumValue = 0; { enumData->value = currentEnumValue++; templine = line; - enumData = NULL; + enumData = nullptr; parseState = PARSE_END_BRACKET; } break; @@ -838,7 +838,7 @@ int currentEnumValue = 0; } currentEnumValue = (*iter).value; enumData->value = currentEnumValue++; - enumData = NULL; + enumData = nullptr; parseState = PARSE_END_BRACKET; } else @@ -895,7 +895,7 @@ const char * TpfFile::parseAssignment(const char *line) // get the parameter type info m_parameter = m_templateData->getParameter(m_token); - if (m_parameter == NULL) + if (m_parameter == nullptr) { std::string errmsg = "cannot find parameter "; errmsg += m_token; @@ -915,7 +915,7 @@ const char * TpfFile::parseAssignment(const char *line) m_fp.printError("non-array parameter being assigned as array"); return CHAR_ERROR; } - if (line == NULL) + if (line == nullptr) { // we need to read the next line to continue parsing line = goToNextLine(); @@ -943,7 +943,7 @@ const char * TpfFile::parseAssignment(const char *line) } // check for the ending ] line = getNextToken(line, m_token); - if (line == NULL) + if (line == nullptr) { m_fp.printEolError(); return CHAR_ERROR; @@ -954,13 +954,13 @@ const char * TpfFile::parseAssignment(const char *line) return CHAR_ERROR; } line = getNextToken(line, m_token); - if (line == NULL) + if (line == nullptr) { m_fp.printEolError(); return CHAR_ERROR; } } - else if (line == NULL) + else if (line == nullptr) { m_fp.printEolError(); return CHAR_ERROR; @@ -1038,7 +1038,7 @@ const char * TpfFile::parseAssignment(const char *line) * @param param template parameter * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or NULL if at eol, or -1 if + * @return character in line where parsing stopped, or nullptr if at eol, or -1 if * error */ const char * TpfFile::parseIntegerParameter(CompilerIntegerParam & param, const char *line) @@ -1064,7 +1064,7 @@ const char * TpfFile::parseIntegerParameter(CompilerIntegerParam & param, const if (line == CHAR_ERROR) return CHAR_ERROR; - if (line != NULL && *line == 'd') + if (line != nullptr && *line == 'd') { // rolling die int base = 0; @@ -1115,7 +1115,7 @@ const char * TpfFile::parseIntegerParameter(CompilerIntegerParam & param, const } param.setValue(num_dice, num_sides, base); } - else if (line != NULL && *line == '.' && *(line+1) == '.') + else if (line != nullptr && *line == '.' && *(line+1) == '.') { // range int min_value = value; @@ -1168,7 +1168,7 @@ const char * TpfFile::parseIntegerParameter(CompilerIntegerParam & param, const tempLine = m_token; char tempBuffer[64]; std::vector enumList; - while (tempLine != NULL) + while (tempLine != nullptr) { tempLine = getNextToken(tempLine, tempBuffer); if (isalpha(*tempBuffer)) @@ -1178,7 +1178,7 @@ const char * TpfFile::parseIntegerParameter(CompilerIntegerParam & param, const } } } - else if (*m_token == '.' && tempLine != NULL && *tempLine == '.') + else if (*m_token == '.' && tempLine != nullptr && *tempLine == '.') { // range with lower bound of INT_MIN line = tempLine + 1; @@ -1232,7 +1232,7 @@ const char * TpfFile::parseIntegerParameter(CompilerIntegerParam & param, const return CHAR_ERROR; } line = parseIntegerParameter(param, line); - if (line != NULL && *line == '%') + if (line != nullptr && *line == '%') { // % offset from base value line = getNextToken(line, m_token); @@ -1257,7 +1257,7 @@ const char * TpfFile::parseIntegerParameter(CompilerIntegerParam & param, const * @param param template parameter * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or NULL if at eol, or -1 if + * @return character in line where parsing stopped, or nullptr if at eol, or -1 if * error */ const char * TpfFile::parseFloatParameter(FloatParam & param, const char *line) @@ -1278,7 +1278,7 @@ const char * TpfFile::parseFloatParameter(FloatParam & param, const char *line) } else if (isfloat(m_token)) { - if (line != NULL && *line == '.' && *(line+1) == '.') + if (line != nullptr && *line == '.' && *(line+1) == '.') { // range float min_value = static_cast(atof(m_token)); @@ -1325,7 +1325,7 @@ const char * TpfFile::parseFloatParameter(FloatParam & param, const char *line) param.setValue(value); } } - else if (*m_token == '.' && line != NULL && *line == '.') + else if (*m_token == '.' && line != nullptr && *line == '.') { // range with lower bound of -FLT_MAX ++line; @@ -1378,7 +1378,7 @@ const char * TpfFile::parseFloatParameter(FloatParam & param, const char *line) return CHAR_ERROR; } line = parseFloatParameter(param, line); - if (line != NULL && *line == '%') + if (line != nullptr && *line == '%') { // % offset from base value line = getNextToken(line, m_token); @@ -1414,7 +1414,7 @@ const char * TpfFile::parseFloatParameter(FloatParam & param, const char *line) * @param param template parameter * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or NULL if at eol, or -1 if + * @return character in line where parsing stopped, or nullptr if at eol, or -1 if * error */ const char * TpfFile::parseBoolParameter(BoolParam & param, const char *line) @@ -1455,7 +1455,7 @@ const char * TpfFile::parseBoolParameter(BoolParam & param, const char *line) * @param param template parameter * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or NULL if at eol, or -1 if + * @return character in line where parsing stopped, or nullptr if at eol, or -1 if * error */ const char * TpfFile::parseStringParameter(StringParam & param, const char *line) @@ -1494,7 +1494,7 @@ const char * TpfFile::parseStringParameter(StringParam & param, const char *line * @param param template parameter * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or NULL if at eol, or -1 if + * @return character in line where parsing stopped, or nullptr if at eol, or -1 if * error */ const char * TpfFile::parseStringIdParameter(StringIdParam & param, const char *line) @@ -1530,7 +1530,7 @@ const char * TpfFile::parseStringIdParameter(StringIdParam & param, const char * * @param param template parameter * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or NULL if at eol, or -1 if + * @return character in line where parsing stopped, or nullptr if at eol, or -1 if * error */ const char * TpfFile::parseFilenameParameter(StringParam & param, const char *line) @@ -1586,7 +1586,7 @@ const char * TpfFile::parseFilenameParameter(StringParam & param, const char *li * @param param template parameter * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or NULL if at eol, or -1 if + * @return character in line where parsing stopped, or nullptr if at eol, or -1 if * error */ const char * TpfFile::parseVectorParameter(VectorParam & param, const char *line) @@ -1648,7 +1648,7 @@ const char * TpfFile::parseVectorParameter(VectorParam & param, const char *line * @param param template parameter * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or NULL if at eol, or -1 if + * @return character in line where parsing stopped, or nullptr if at eol, or -1 if * error */ const char * TpfFile::parseTemplateParameter(StringParam & param, const char *line) @@ -1662,7 +1662,7 @@ const char * TpfFile::parseTemplateParameter(StringParam & param, const char *li * @param param template parameter * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or NULL if at eol, or -1 if + * @return character in line where parsing stopped, or nullptr if at eol, or -1 if * error */ const char * TpfFile::parseEnumParameter(CompilerIntegerParam & param, const char *line) @@ -1707,7 +1707,7 @@ const char * TpfFile::parseEnumParameter(CompilerIntegerParam & param, const cha * @param param template parameter * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or NULL if at eol, or -1 if + * @return character in line where parsing stopped, or nullptr if at eol, or -1 if * error */ const char * TpfFile::parseDynamicVariableParameter(DynamicVariableParam & param, @@ -1731,7 +1731,7 @@ const char * TpfFile::parseDynamicVariableParameter(DynamicVariableParam & param if (*m_token == '+') { // extending an objevar list - if (m_template != NULL && m_template->getBaseTemplateName().empty()) + if (m_template != nullptr && m_template->getBaseTemplateName().empty()) { m_fp.printError("trying to extend an objvar list from a base template"); return CHAR_ERROR; @@ -1746,7 +1746,7 @@ const char * TpfFile::parseDynamicVariableParameter(DynamicVariableParam & param } else { - if (line == NULL) + if (line == nullptr) { // we need to read the next line to continue parsing line = goToNextLine(); @@ -1786,7 +1786,7 @@ const char * TpfFile::parseDynamicVariableParameter(DynamicVariableParam & param * @param param a DynamicVariableParamData containing an empty list * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or NULL if at eol, or -1 if + * @return character in line where parsing stopped, or nullptr if at eol, or -1 if * error */ const char * TpfFile::parseDynamicVariableParameterList( @@ -1797,7 +1797,7 @@ std::string name; NOT_NULL(line); if (data.m_type != DynamicVariableParamData::LIST || - data.m_data.lparam == NULL) + data.m_data.lparam == nullptr) { m_fp.printError("parse objvar list not given a list"); return CHAR_ERROR; @@ -1938,7 +1938,7 @@ std::string name; } else { - if (line == NULL) + if (line == nullptr) { // we need to read the next line to continue parsing line = goToNextLine(); @@ -1984,7 +1984,7 @@ std::string name; * @param param template parameter * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or NULL if at eol, or -1 if + * @return character in line where parsing stopped, or nullptr if at eol, or -1 if * error */ const char * TpfFile::parseStructParameter(StructParamOT & param, const char *line) @@ -2077,7 +2077,7 @@ const char * TpfFile::parseStructParameter(StructParamOT & param, const char *li * @param param template parameter * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or NULL if at eol, or -1 if + * @return character in line where parsing stopped, or nullptr if at eol, or -1 if * error */ const char * TpfFile::parseTriggerVolumeParameter(TriggerVolumeParam & param, @@ -2313,7 +2313,7 @@ Q * param; file.m_fp.printError("expected [ at start of list"); return CHAR_ERROR; } - if (line == NULL) + if (line == nullptr) { // we need to read the next line to continue parsing line = file.goToNextLine(); @@ -2339,7 +2339,7 @@ Q * param; // get the next parameters in the list param = (*getParamFunc)(*file.m_template, file.m_parameter->name, index); - if (param == NULL) + if (param == nullptr) { std::string errmsg = "cannot find parameter " + file.m_parameter->name; file.m_fp.printError(errmsg.c_str()); @@ -2385,7 +2385,7 @@ Q * param; arrayIndex = 0; param = (*getParamFunc)(*file.m_template, file.m_parameter->name, arrayIndex); - if (param == NULL) + if (param == nullptr) { // if the tpf version is less than the current version, print a // warning and ignore @@ -2396,7 +2396,7 @@ Q * param; " due to being removed from later version (need to update the " "template to the latest version)"; file.m_fp.printWarning(errmsg.c_str()); - return NULL; + return nullptr; } else { @@ -2434,7 +2434,7 @@ const char *parseWeightedList( for (;;) { VALUE value; - Q *valueParam = NULL; + Q *valueParam = nullptr; value.value = valueParam = new Q; list->push_back(value); VALUE *newValue = &list->back(); @@ -2505,7 +2505,7 @@ std::string TpfFile::getFileName() const const std::string & TpfFile::getBaseTemplateName() const { - if (m_template != NULL) + if (m_template != nullptr) return m_template->getBaseTemplateName(); return m_baseTemplateName; } diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TpfTemplate.cpp b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TpfTemplate.cpp index 3773bcfd..2a0d76c0 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TpfTemplate.cpp +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TpfTemplate.cpp @@ -21,9 +21,9 @@ */ TpfTemplate::TpfTemplate(const std::string & filename) : ObjectTemplate(filename), - m_parentFile(NULL), + m_parentFile(nullptr), m_baseTemplateName(), - m_baseTemplateFile(NULL) + m_baseTemplateFile(nullptr) { } // TpfTemplate::TpfTemplate @@ -32,12 +32,12 @@ TpfTemplate::TpfTemplate(const std::string & filename) : */ TpfTemplate::~TpfTemplate() { - m_parentFile = NULL; + m_parentFile = nullptr; m_baseTemplateName.clear(); - if (m_baseTemplateFile != NULL) + if (m_baseTemplateFile != nullptr) { delete m_baseTemplateFile; - m_baseTemplateFile = NULL; + m_baseTemplateFile = nullptr; } } // TpfTemplate::~TpfTemplate @@ -52,18 +52,18 @@ int TpfTemplate::setBaseTemplateName(const std::string & name) { m_baseTemplateName = name; - if (m_parentFile == NULL) + if (m_parentFile == nullptr) return -1; // load the base template - if (m_baseTemplateFile != NULL) + if (m_baseTemplateFile != nullptr) { delete m_baseTemplateFile; - m_baseTemplateFile = NULL; + m_baseTemplateFile = nullptr; } - Filename baseTemplateFileName(NULL, NULL, name.c_str(), TEMPLATE_EXTENSION); - Filename sourceTpfPath(NULL, m_parentFile->getTpfPath().c_str(), NULL, NULL); + Filename baseTemplateFileName(nullptr, nullptr, name.c_str(), TEMPLATE_EXTENSION); + Filename sourceTpfPath(nullptr, m_parentFile->getTpfPath().c_str(), nullptr, nullptr); Filename tempPath(baseTemplateFileName); tempPath.setPath(sourceTpfPath.getPath().c_str()); @@ -93,9 +93,9 @@ int TpfTemplate::setBaseTemplateName(const std::string & name) */ TpfTemplate * TpfTemplate::getBaseTemplate(void) const { - if (m_baseTemplateFile != NULL) + if (m_baseTemplateFile != nullptr) return m_baseTemplateFile->getTemplate(); - return NULL; + return nullptr; } // TpfTemplate::getBaseTemplate /** @@ -115,14 +115,14 @@ void TpfTemplate::save(Iff &file) * @param deepcheck flag to check base template if the parameter isn't loaded * @param index array index of the parameter * - * @return the parameter, or NULL if not found + * @return the parameter, or nullptr if not found */ CompilerIntegerParam *TpfTemplate::getCompilerIntegerParam(const char *name, bool deepCheck, int index) { UNREF(name); UNREF(deepCheck); UNREF(index); - return NULL; + return nullptr; } // TpfTemplate::getCompilerIntegerParam /** @@ -132,14 +132,14 @@ CompilerIntegerParam *TpfTemplate::getCompilerIntegerParam(const char *name, boo * @param deepcheck flag to check base template if the parameter isn't loaded * @param index array index of the parameter * - * @return the parameter, or NULL if not found + * @return the parameter, or nullptr if not found */ FloatParam *TpfTemplate::getFloatParam(const char *name, bool deepCheck, int index) { UNREF(name); UNREF(deepCheck); UNREF(index); - return NULL; + return nullptr; } // TpfTemplate::getFloatParam /** @@ -149,14 +149,14 @@ FloatParam *TpfTemplate::getFloatParam(const char *name, bool deepCheck, int ind * @param deepcheck flag to check base template if the parameter isn't loaded * @param index array index of the parameter * - * @return the parameter, or NULL if not found + * @return the parameter, or nullptr if not found */ BoolParam *TpfTemplate::getBoolParam(const char *name, bool deepCheck, int index) { UNREF(name); UNREF(deepCheck); UNREF(index); - return NULL; + return nullptr; } // TpfTemplate::getBoolParam /** @@ -166,14 +166,14 @@ BoolParam *TpfTemplate::getBoolParam(const char *name, bool deepCheck, int index * @param deepcheck flag to check base template if the parameter isn't loaded * @param index array index of the parameter * - * @return the parameter, or NULL if not found + * @return the parameter, or nullptr if not found */ StringParam *TpfTemplate::getStringParam(const char *name, bool deepCheck, int index) { UNREF(name); UNREF(deepCheck); UNREF(index); - return NULL; + return nullptr; } // TpfTemplate::getStringParam /** @@ -183,14 +183,14 @@ StringParam *TpfTemplate::getStringParam(const char *name, bool deepCheck, int i * @param deepcheck flag to check base template if the parameter isn't loaded * @param index array index of the parameter * - * @return the parameter, or NULL if not found + * @return the parameter, or nullptr if not found */ StringIdParam *TpfTemplate::getStringIdParam(const char *name, bool deepCheck, int index) { UNREF(name); UNREF(deepCheck); UNREF(index); - return NULL; + return nullptr; } // TpfTemplate::getStringIdParam /** @@ -200,14 +200,14 @@ StringIdParam *TpfTemplate::getStringIdParam(const char *name, bool deepCheck, i * @param deepcheck flag to check base template if the parameter isn't loaded * @param index array index of the parameter * - * @return the parameter, or NULL if not found + * @return the parameter, or nullptr if not found */ VectorParam *TpfTemplate::getVectorParam(const char *name, bool deepCheck, int index) { UNREF(name); UNREF(deepCheck); UNREF(index); - return NULL; + return nullptr; } // TpfTemplate::getVectorParam /** @@ -217,14 +217,14 @@ VectorParam *TpfTemplate::getVectorParam(const char *name, bool deepCheck, int i * @param deepcheck flag to check base template if the parameter isn't loaded * @param index array index of the parameter * - * @return the parameter, or NULL if not found + * @return the parameter, or nullptr if not found */ DynamicVariableParam *TpfTemplate::getDynamicVariableParam(const char *name, bool deepCheck, int index) { UNREF(name); UNREF(deepCheck); UNREF(index); - return NULL; + return nullptr; } // TpfTemplate::getDynamicVariableParam /** @@ -234,14 +234,14 @@ DynamicVariableParam *TpfTemplate::getDynamicVariableParam(const char *name, boo * @param deepcheck flag to check base template if the parameter isn't loaded * @param index array index of the parameter * - * @return the parameter, or NULL if not found + * @return the parameter, or nullptr if not found */ StructParamOT *TpfTemplate::getStructParamOT(const char *name, bool deepCheck, int index) { UNREF(name); UNREF(deepCheck); UNREF(index); - return NULL; + return nullptr; } // TpfTemplate::getStructParamOT /** @@ -251,14 +251,14 @@ StructParamOT *TpfTemplate::getStructParamOT(const char *name, bool deepCheck, i * @param deepcheck flag to check base template if the parameter isn't loaded * @param index array index of the parameter * - * @return the parameter, or NULL if not found + * @return the parameter, or nullptr if not found */ TriggerVolumeParam *TpfTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index) { UNREF(name); UNREF(deepCheck); UNREF(index); - return NULL; + return nullptr; } // TpfTemplate::getTriggerVolumeParam /** @@ -408,7 +408,7 @@ bool TpfTemplate::isParamLoadedLocal(const std::string &name, bool deepCheck) co { result = true; } - else if (deepCheck && getBaseTemplate() != NULL) + else if (deepCheck && getBaseTemplate() != nullptr) { result = getBaseTemplate()->isParamLoadedLocal(name); } @@ -433,7 +433,7 @@ bool TpfTemplate::isParamPureVirtualLocal(const std::string &name, bool deepChec { result = true; } - else if (deepCheck && (getBaseTemplate() != NULL)) + else if (deepCheck && (getBaseTemplate() != nullptr)) { result = getBaseTemplate()->isParamPureVirtualLocal(name); } diff --git a/engine/shared/library/sharedTerrain/src/shared/appearance/ProceduralTerrainAppearance.cpp b/engine/shared/library/sharedTerrain/src/shared/appearance/ProceduralTerrainAppearance.cpp index 3aca2005..3ffa961b 100755 --- a/engine/shared/library/sharedTerrain/src/shared/appearance/ProceduralTerrainAppearance.cpp +++ b/engine/shared/library/sharedTerrain/src/shared/appearance/ProceduralTerrainAppearance.cpp @@ -803,7 +803,7 @@ TerrainGeneratorWaterType ProceduralTerrainAppearance::getWaterType (const Vecto bool ProceduralTerrainAppearance::getWater (const int chunkX, const int chunkZ) const { - if (proceduralTerrainAppearanceTemplate->getBakedTerrain () != NULL) + if (proceduralTerrainAppearanceTemplate->getBakedTerrain () != nullptr) return proceduralTerrainAppearanceTemplate->getBakedTerrain ()->getWater (chunkX, chunkZ); return false; @@ -813,7 +813,7 @@ bool ProceduralTerrainAppearance::getWater (const int chunkX, const int chunkZ) bool ProceduralTerrainAppearance::getSlope (const int chunkX, const int chunkZ) const { - if (proceduralTerrainAppearanceTemplate->getBakedTerrain () != NULL) + if (proceduralTerrainAppearanceTemplate->getBakedTerrain () != nullptr) return proceduralTerrainAppearanceTemplate->getBakedTerrain ()->getSlope (chunkX, chunkZ); return false; @@ -823,7 +823,7 @@ bool ProceduralTerrainAppearance::getSlope (const int chunkX, const int chunkZ) bool ProceduralTerrainAppearance::getWater (const Rectangle2d& rectangle) const { - if (proceduralTerrainAppearanceTemplate->getBakedTerrain () != NULL) + if (proceduralTerrainAppearanceTemplate->getBakedTerrain () != nullptr) return proceduralTerrainAppearanceTemplate->getBakedTerrain ()->getWater (rectangle); return false; @@ -833,7 +833,7 @@ bool ProceduralTerrainAppearance::getWater (const Rectangle2d& rectangle) const bool ProceduralTerrainAppearance::getSlope (const Rectangle2d& rectangle) const { - if (proceduralTerrainAppearanceTemplate->getBakedTerrain () != NULL) + if (proceduralTerrainAppearanceTemplate->getBakedTerrain () != nullptr) return proceduralTerrainAppearanceTemplate->getBakedTerrain ()->getSlope (rectangle); return false; @@ -877,7 +877,7 @@ float ProceduralTerrainAppearance::alter (float elapsedTime) #ifdef _DEBUG const char* const appearanceTemplateName = object->getAppearance () && object->getAppearance ()->getAppearanceTemplate () ? object->getAppearance ()->getAppearanceTemplate ()->getCrcName ().getString () : 0; const Vector position = object->getPosition_w (); - DEBUG_REPORT_LOG (ms_logFloraCreation, ("flora delete: <%1.2f, %1.2f> [%s]\n", position.x, position.z, appearanceTemplateName ? appearanceTemplateName : "null")); + DEBUG_REPORT_LOG (ms_logFloraCreation, ("flora delete: <%1.2f, %1.2f> [%s]\n", position.x, position.z, appearanceTemplateName ? appearanceTemplateName : "nullptr")); #endif delete object; } @@ -1054,7 +1054,7 @@ bool ProceduralTerrainAppearance::isPassableForceChunkCreation(const Vector& pos #ifndef WIN32 if (!chunk) - LOG("PTA::isPFCC", ("(%g,%g,%g) chunk is NULL, %d/%d/%d/%d", position.x, position.y, position.z, getNumberOfChunks(), maximumNumberOfChunksAllowed, getNumberOfReferenceObjects(), maximumNumberOfChunksAlongSide)); + LOG("PTA::isPFCC", ("(%g,%g,%g) chunk is nullptr, %d/%d/%d/%d", position.x, position.y, position.z, getNumberOfChunks(), maximumNumberOfChunksAllowed, getNumberOfReferenceObjects(), maximumNumberOfChunksAlongSide)); #endif return isPassable; @@ -1183,7 +1183,7 @@ void ProceduralTerrainAppearance::_legacyCreateFlora(const Chunk* const chunk) object->yaw_o (yaw); Appearance * const appearance = AppearanceTemplateList::createAppearance (FileName (FileName::P_appearance, data.familyChildData->appearanceTemplateName)); - if (appearance != NULL) { + if (appearance != nullptr) { appearance->setKeepAlive (true); object->setAppearance (appearance); object->setScale (Vector::xyz111 * scale); @@ -1340,7 +1340,7 @@ void ProceduralTerrainAppearance::createFlora (const Chunk* const chunk) object->yaw_o (yaw); Appearance * const appearance = AppearanceTemplateList::createAppearance (FileName (FileName::P_appearance, data.familyChildData->appearanceTemplateName)); - if (appearance != NULL) { + if (appearance != nullptr) { appearance->setKeepAlive (true); object->setAppearance (appearance); object->setScale (Vector::xyz111 * scale); @@ -1403,7 +1403,7 @@ void ProceduralTerrainAppearance::destroyFlora (const Chunk* const chunk) { #ifdef _DEBUG const char* const appearanceTemplateName = object->getAppearance () && object->getAppearance ()->getAppearanceTemplate () ? object->getAppearance ()->getAppearanceTemplate ()->getCrcName ().getString () : 0; - DEBUG_REPORT_LOG (ms_logFloraCreation, ("flora cache: <%1.2f, %1.2f> [%s]\n", position.x, position.z, appearanceTemplateName ? appearanceTemplateName : "null")); + DEBUG_REPORT_LOG (ms_logFloraCreation, ("flora cache: <%1.2f, %1.2f> [%s]\n", position.x, position.z, appearanceTemplateName ? appearanceTemplateName : "nullptr")); #endif iter->second->removeFromWorld (); IGNORE_RETURN (m_cachedFloraMap->insert (std::make_pair (key, iter->second))); diff --git a/engine/shared/library/sharedTerrain/src/shared/appearance/SamplerProceduralTerrainAppearance.cpp b/engine/shared/library/sharedTerrain/src/shared/appearance/SamplerProceduralTerrainAppearance.cpp index 5cf95df7..dbe9e3fe 100755 --- a/engine/shared/library/sharedTerrain/src/shared/appearance/SamplerProceduralTerrainAppearance.cpp +++ b/engine/shared/library/sharedTerrain/src/shared/appearance/SamplerProceduralTerrainAppearance.cpp @@ -910,7 +910,7 @@ void SamplerProceduralTerrainAppearance::generateBetween(Vector const & start_o, } } - // add on all chunks to be generated to chunkList. if we encounter invalid chunks (null), don't include them + // add on all chunks to be generated to chunkList. if we encounter invalid chunks (nullptr), don't include them const Chunk* chunk; for (GenerateList::iterator iter = generateList.begin(); iter != generateList.end(); ++iter) { diff --git a/engine/shared/library/sharedTerrain/src/shared/appearance/ServerProceduralTerrainAppearance.cpp b/engine/shared/library/sharedTerrain/src/shared/appearance/ServerProceduralTerrainAppearance.cpp index 3045b129..938c4f2f 100755 --- a/engine/shared/library/sharedTerrain/src/shared/appearance/ServerProceduralTerrainAppearance.cpp +++ b/engine/shared/library/sharedTerrain/src/shared/appearance/ServerProceduralTerrainAppearance.cpp @@ -805,7 +805,7 @@ void ServerProceduralTerrainAppearance::generateBetween(Vector const & start_o, } } - // add on all chunks to be generated to chunkList. if we encounter invalid chunks (null), don't include them + // add on all chunks to be generated to chunkList. if we encounter invalid chunks (nullptr), don't include them const Chunk* chunk; for (GenerateList::iterator iter = generateList.begin(); iter != generateList.end(); ++iter) { diff --git a/engine/shared/library/sharedTerrain/src/shared/appearance/TerrainQuadTree.cpp b/engine/shared/library/sharedTerrain/src/shared/appearance/TerrainQuadTree.cpp index 275a6986..08cd30a7 100755 --- a/engine/shared/library/sharedTerrain/src/shared/appearance/TerrainQuadTree.cpp +++ b/engine/shared/library/sharedTerrain/src/shared/appearance/TerrainQuadTree.cpp @@ -534,9 +534,9 @@ void TerrainQuadTree::Node::pruneTree () /** * Find the leaf node which directly contains this chunk. * -* @param aChunk the chunk to be located. If non null, the parameters ax and az are ignored. -* @param ax the chunkspace coordinate of the chunk to be located. Only used if param aChunk is null -* @param az the chunkspace coordinate of the chunk to be located. Only used if param aChunk is null +* @param aChunk the chunk to be located. If non nullptr, the parameters ax and az are ignored. +* @param ax the chunkspace coordinate of the chunk to be located. Only used if param aChunk is nullptr +* @param az the chunkspace coordinate of the chunk to be located. Only used if param aChunk is nullptr */ TerrainQuadTree::Node * TerrainQuadTree::Node::findChunkNode (const ProceduralTerrainAppearance::Chunk * const chunk, int x, int z, int size) { @@ -754,9 +754,9 @@ TerrainQuadTree::Node * TerrainQuadTree::Node::findFirstRenderableNode (const in /** * hasChunk is a wrapper for findChunkNode * -* @param aChunk the chunk to be located. If non null, the parameters ax and az are ignored. -* @param ax the chunkspace coordinate of the chunk to be located. Only used if param aChunk is null -* @param az the chunkspace coordinate of the chunk to be located. Only used if param aChunk is null +* @param aChunk the chunk to be located. If non nullptr, the parameters ax and az are ignored. +* @param ax the chunkspace coordinate of the chunk to be located. Only used if param aChunk is nullptr +* @param az the chunkspace coordinate of the chunk to be located. Only used if param aChunk is nullptr * @param chunkSize the relative size of the chunk in chunkspace. */ bool TerrainQuadTree::Node::hasChunk (const ProceduralTerrainAppearance::Chunk * const chunk, const int x, const int z, const int size) diff --git a/engine/shared/library/sharedTerrain/src/shared/appearance/TerrainQuadTree.h b/engine/shared/library/sharedTerrain/src/shared/appearance/TerrainQuadTree.h index cb92dce0..a48d759e 100755 --- a/engine/shared/library/sharedTerrain/src/shared/appearance/TerrainQuadTree.h +++ b/engine/shared/library/sharedTerrain/src/shared/appearance/TerrainQuadTree.h @@ -320,7 +320,7 @@ public: /** * TerrainQuadTree::Iterator is a preorder iterator - * To use an iterator, loop while the current node is non-null. If the + * To use an iterator, loop while the current node is non-nullptr. If the * current node's subtree should be processed further, call descend () * on the iterator, otherwise call advance () to go to the next node. * Either advance () or descend () should be called every loop iteration, diff --git a/engine/shared/library/sharedTerrain/src/shared/core/WaterTypeManager.cpp b/engine/shared/library/sharedTerrain/src/shared/core/WaterTypeManager.cpp index 65b5b1d0..4ec613d1 100755 --- a/engine/shared/library/sharedTerrain/src/shared/core/WaterTypeManager.cpp +++ b/engine/shared/library/sharedTerrain/src/shared/core/WaterTypeManager.cpp @@ -19,8 +19,8 @@ // ====================================================================== bool WaterTypeManager::ms_installed = false; -WaterTypeManager::WaterTypeDataType * WaterTypeManager::ms_waterTypeData=NULL; -WaterTypeManager::CreatureWaterTypeDataType* WaterTypeManager::ms_creatureWaterTypeData=NULL; +WaterTypeManager::WaterTypeDataType * WaterTypeManager::ms_waterTypeData=nullptr; +WaterTypeManager::CreatureWaterTypeDataType* WaterTypeManager::ms_creatureWaterTypeData=nullptr; // ====================================================================== @@ -116,9 +116,9 @@ void WaterTypeManager::remove() } delete ms_waterTypeData; - ms_waterTypeData=NULL; + ms_waterTypeData=nullptr; delete ms_creatureWaterTypeData; - ms_creatureWaterTypeData=NULL; + ms_creatureWaterTypeData=nullptr; ms_installed = false; } diff --git a/engine/shared/library/sharedTerrain/src/shared/generator/BitmapGroup.cpp b/engine/shared/library/sharedTerrain/src/shared/generator/BitmapGroup.cpp index e9215147..9d26743f 100755 --- a/engine/shared/library/sharedTerrain/src/shared/generator/BitmapGroup.cpp +++ b/engine/shared/library/sharedTerrain/src/shared/generator/BitmapGroup.cpp @@ -159,7 +159,7 @@ void BitmapGroup::Family::loadBitmapByFilename() { if(!m_bitmapName) { - DEBUG_WARNING (true, ("BitmapGroup::Family::loadBitmapByFilename() - invalid image - m_bitmapName is NULL")); + DEBUG_WARNING (true, ("BitmapGroup::Family::loadBitmapByFilename() - invalid image - m_bitmapName is nullptr")); } else { diff --git a/engine/shared/library/sharedTerrain/src/shared/generator/ShaderGroup.cpp b/engine/shared/library/sharedTerrain/src/shared/generator/ShaderGroup.cpp index b511c3a4..cbb9562d 100755 --- a/engine/shared/library/sharedTerrain/src/shared/generator/ShaderGroup.cpp +++ b/engine/shared/library/sharedTerrain/src/shared/generator/ShaderGroup.cpp @@ -671,7 +671,7 @@ void ShaderGroup::load_0000 (Iff& iff) //-- add family Family* family = new Family (familyId); - family->setName ("null"); + family->setName ("nullptr"); PackedRgb color; color.r = 255; diff --git a/engine/shared/library/sharedTerrain/src/shared/object/TerrainObject.cpp b/engine/shared/library/sharedTerrain/src/shared/object/TerrainObject.cpp index f48a7b5d..5206146a 100755 --- a/engine/shared/library/sharedTerrain/src/shared/object/TerrainObject.cpp +++ b/engine/shared/library/sharedTerrain/src/shared/object/TerrainObject.cpp @@ -159,7 +159,7 @@ TerrainObject::~TerrainObject () TerrainObject::removeFromWorld (); DEBUG_FATAL (ms_instance != this, ("TerrainObject instance is not this object")); - ms_instance = NULL; + ms_instance = nullptr; } //------------------------------------------------------------------- diff --git a/engine/shared/library/sharedUtility/src/shared/CachedFileManager.cpp b/engine/shared/library/sharedUtility/src/shared/CachedFileManager.cpp index 30bf9486..398ef20e 100755 --- a/engine/shared/library/sharedUtility/src/shared/CachedFileManager.cpp +++ b/engine/shared/library/sharedUtility/src/shared/CachedFileManager.cpp @@ -69,7 +69,7 @@ namespace CachedFileManagerNamespace Tag const TAG_CACH = TAG (C,A,C,H); - char * ms_filenames = NULL; + char * ms_filenames = nullptr; size_t ms_filenamesLength = 0; size_t ms_filenamesCurrentPos = 0; unsigned long ms_totalTime; @@ -150,7 +150,7 @@ void CachedFileManager::install(bool const allowFileCaching) iff.enterForm (TAG_CACH); iff.enterChunk (TAG_0000); - //-- the entire chunk is filled with null terminated strings + //-- the entire chunk is filled with nullptr terminated strings ms_filenamesLength = iff.getChunkLengthLeft(); ms_filenames = iff.readRest_char(); @@ -168,7 +168,7 @@ void CachedFileManager::install(bool const allowFileCaching) void CachedFileManagerNamespace::remove () { delete[] ms_filenames; - ms_filenames = NULL; + ms_filenames = nullptr; ms_filenamesCurrentPos = 0; ms_filenamesLength = 0; @@ -255,7 +255,7 @@ void CachedFileManager::preloadSomeAssets () #endif delete[] ms_filenames; - ms_filenames = NULL; + ms_filenames = nullptr; ms_filenamesCurrentPos = 0; ms_filenamesLength = 0; } @@ -266,7 +266,7 @@ void CachedFileManager::preloadSomeAssets () bool CachedFileManager::donePreloading () { - return ms_filenames == NULL || (ms_filenamesCurrentPos >= ms_filenamesLength); + return ms_filenames == nullptr || (ms_filenamesCurrentPos >= ms_filenamesLength); } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedUtility/src/shared/CurrentUserOptionManager.cpp b/engine/shared/library/sharedUtility/src/shared/CurrentUserOptionManager.cpp index 626c7fcb..dfb11487 100755 --- a/engine/shared/library/sharedUtility/src/shared/CurrentUserOptionManager.cpp +++ b/engine/shared/library/sharedUtility/src/shared/CurrentUserOptionManager.cpp @@ -70,7 +70,7 @@ void CurrentUserOptionManager::load (char const * const userName) ms_optionManager->load (ms_userName.c_str ()); } else - DEBUG_WARNING (true, ("CurrentUserOptionManager::load: userName is null")); + DEBUG_WARNING (true, ("CurrentUserOptionManager::load: userName is nullptr")); } // ---------------------------------------------------------------------- @@ -82,7 +82,7 @@ void CurrentUserOptionManager::save () if (!ms_userName.empty ()) ms_optionManager->save (ms_userName.c_str ()); else - DEBUG_REPORT_LOG (s_verbose, ("CurrentUserOptionManager::save: userName is null\n")); + DEBUG_REPORT_LOG (s_verbose, ("CurrentUserOptionManager::save: userName is nullptr\n")); } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedUtility/src/shared/DataTable.cpp b/engine/shared/library/sharedUtility/src/shared/DataTable.cpp index 0d08193b..2a0974c7 100755 --- a/engine/shared/library/sharedUtility/src/shared/DataTable.cpp +++ b/engine/shared/library/sharedUtility/src/shared/DataTable.cpp @@ -50,7 +50,7 @@ DataTable::~DataTable() if (*k) { delete static_cast *>(*k); - *k = NULL; + *k = nullptr; } } break; @@ -59,7 +59,7 @@ DataTable::~DataTable() if (*k) { delete static_cast *>(*k); - *k = NULL; + *k = nullptr; } } @@ -69,7 +69,7 @@ DataTable::~DataTable() if (*k) { delete static_cast, std::multimap > *>(*k); - *k = NULL; + *k = nullptr; } } @@ -83,7 +83,7 @@ DataTable::~DataTable() case DataTableColumnType::DT_PackedObjVars: default: { - WARNING_STRICT_FATAL((*k) != NULL, ("Bad column Index %d. Unsupported datatype. This may leak memory.", count)); + WARNING_STRICT_FATAL((*k) != nullptr, ("Bad column Index %d. Unsupported datatype. This may leak memory.", count)); } break; } @@ -112,7 +112,7 @@ DataTable::~DataTable() } delete m_columnIndexMap; - m_columnIndexMap = NULL; + m_columnIndexMap = nullptr; } //---------------------------------------------------------------------------- @@ -464,12 +464,12 @@ void DataTable::load(Iff & iff) for (int i = 0; i < count; ++i) { //initialize the table index used for searching. - m_index.push_back(NULL); + m_index.push_back(nullptr); } buildColumnIndexMap(); - if (NULL != iff.getFileName()) + if (nullptr != iff.getFileName()) m_name = iff.getFileName(); else m_name.clear(); diff --git a/engine/shared/library/sharedUtility/src/shared/DataTableColumnType.cpp b/engine/shared/library/sharedUtility/src/shared/DataTableColumnType.cpp index e0ac3cf4..2f73061b 100755 --- a/engine/shared/library/sharedUtility/src/shared/DataTableColumnType.cpp +++ b/engine/shared/library/sharedUtility/src/shared/DataTableColumnType.cpp @@ -148,7 +148,7 @@ DataTableColumnType::DataTableColumnType(std::string const &desc) : std::string::size_type endPos = enumList.find(','); std::string label = enumList.substr(0, eqPos); std::string val = enumList.substr(eqPos+1, endPos-eqPos-1); - (*m_enumMap)[label] = static_cast(strtol(val.c_str(), NULL, 0)); + (*m_enumMap)[label] = static_cast(strtol(val.c_str(), nullptr, 0)); enumList.erase(0, endPos+1); } // assure the default is a member of the enumeration @@ -173,7 +173,7 @@ DataTableColumnType::DataTableColumnType(std::string const &desc) : std::string::size_type endPos = enumList.find(','); std::string label = enumList.substr(0, eqPos); std::string val = enumList.substr(eqPos+1, endPos-eqPos-1); - int bit = static_cast(strtol(val.c_str(), NULL, 0)); + int bit = static_cast(strtol(val.c_str(), nullptr, 0)); if((bit < 1) || (bit > 32)) { WARNING(true, ("Flags value [%s] is not a whole number from 1 to 32", label.c_str())); @@ -247,7 +247,7 @@ void DataTableColumnType::createDefaultCell() switch(m_basicType) { case DT_Int: - m_defaultCell = new DataTableCell(static_cast(strtol(value.c_str(), NULL, 0))); + m_defaultCell = new DataTableCell(static_cast(strtol(value.c_str(), nullptr, 0))); break; case DT_Float: m_defaultCell = new DataTableCell(static_cast(atof(value.c_str()))); diff --git a/engine/shared/library/sharedUtility/src/shared/DataTableManager.cpp b/engine/shared/library/sharedUtility/src/shared/DataTableManager.cpp index 671a5b9c..f6f633c5 100755 --- a/engine/shared/library/sharedUtility/src/shared/DataTableManager.cpp +++ b/engine/shared/library/sharedUtility/src/shared/DataTableManager.cpp @@ -129,7 +129,7 @@ DataTable * DataTableManager::getTable(const std::string& table, bool openIfNotF if (!dt) { DEBUG_WARNING(true, ("Could not find table [%s]", table.c_str())); - return NULL; + return nullptr; } else { @@ -140,7 +140,7 @@ DataTable * DataTableManager::getTable(const std::string& table, bool openIfNotF } else { - return NULL; + return nullptr; } } @@ -158,7 +158,7 @@ DataTable* DataTableManager::reload(const std::string & table) DataTable * const dataTable = open(table); - if (dataTable != NULL) + if (dataTable != nullptr) { std::multimap::const_iterator i = m_reloadCallbacks.lower_bound(table); for (; i != m_reloadCallbacks.end() && (*i).first == table; ++i) @@ -175,7 +175,7 @@ DataTable* DataTableManager::reloadIfOpen(const std::string & table) if(isOpen(table)) return reload(table); else - return NULL; + return nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedUtility/src/shared/DataTableWriter.cpp b/engine/shared/library/sharedUtility/src/shared/DataTableWriter.cpp index d3dc927c..795c8696 100755 --- a/engine/shared/library/sharedUtility/src/shared/DataTableWriter.cpp +++ b/engine/shared/library/sharedUtility/src/shared/DataTableWriter.cpp @@ -591,7 +591,7 @@ bool DataTableWriter::save(const char * outputFileName, bool optional) const { if (!outputFileName || outputFileName[0] != '\0') { - DEBUG_FATAL(true, ("OutputFileName is NULL or empty.")); + DEBUG_FATAL(true, ("OutputFileName is nullptr or empty.")); return false; } @@ -728,7 +728,7 @@ DataTableCell *DataTableWriter::_getNewCell(DataTableColumnType const &columnTyp switch (columnType.getBasicType()) { case DataTableColumnType::DT_Int: - return new DataTableCell(static_cast(strtol(value.c_str(), NULL, 0))); + return new DataTableCell(static_cast(strtol(value.c_str(), nullptr, 0))); break; case DataTableColumnType::DT_Float: return new DataTableCell(static_cast(atof(value.c_str()))); diff --git a/engine/shared/library/sharedUtility/src/shared/FileName.cpp b/engine/shared/library/sharedUtility/src/shared/FileName.cpp index 93b579cf..1e8936f4 100755 --- a/engine/shared/library/sharedUtility/src/shared/FileName.cpp +++ b/engine/shared/library/sharedUtility/src/shared/FileName.cpp @@ -52,14 +52,14 @@ FileName::FileName (FileName::Path path, const char* filename, const char* ext) // see if the filename already begins with the path const char *prePath = pathTable [path].path; - if (prePath != NULL && *prePath != '\0') + if (prePath != nullptr && *prePath != '\0') { if (strncmp(filename, prePath, strlen(prePath)) == 0) prePath = ""; } // see if the filename already ends in the extension - if (ext != NULL && *ext != '\0') + if (ext != nullptr && *ext != '\0') { int extLen = strlen(ext); int filenameLen = strlen(filename); diff --git a/engine/shared/library/sharedUtility/src/shared/RotaryCache.cpp b/engine/shared/library/sharedUtility/src/shared/RotaryCache.cpp index b406fe08..6292e0d3 100644 --- a/engine/shared/library/sharedUtility/src/shared/RotaryCache.cpp +++ b/engine/shared/library/sharedUtility/src/shared/RotaryCache.cpp @@ -42,7 +42,7 @@ void* RotaryCache::add(const CrcLowerString& keyString, void* valuePtr) { CacheListEntry listEntry; - void* returnVal = NULL; + void* returnVal = nullptr; listEntry.key = keyString; listEntry.value = valuePtr; @@ -93,7 +93,7 @@ RotaryCache::fetch(const CrcLowerString& keyString) return entryList.value; } - return NULL; + return nullptr; } void* @@ -103,7 +103,7 @@ RotaryCache::remove(const CrcLowerString& keyString) if(iterFind != mMap.end()) { - void* retVal = NULL; + void* retVal = nullptr; CacheMapEntry& entryFind = (*iterFind).second; RotaryList::iterator iterList = entryFind.iter; @@ -119,7 +119,7 @@ RotaryCache::remove(const CrcLowerString& keyString) return retVal; } - return NULL; + return nullptr; } @@ -143,7 +143,7 @@ RotaryCache::getNext() return retVal; } - return NULL; + return nullptr; } void diff --git a/engine/shared/library/sharedUtility/src/shared/SetupSharedUtility.cpp b/engine/shared/library/sharedUtility/src/shared/SetupSharedUtility.cpp index 3336890f..166f5548 100755 --- a/engine/shared/library/sharedUtility/src/shared/SetupSharedUtility.cpp +++ b/engine/shared/library/sharedUtility/src/shared/SetupSharedUtility.cpp @@ -109,7 +109,7 @@ void SetupSharedUtility::installFileManifestEntries () if (!fileName.empty()) FileManifest::addStoredManifestEntry(fileName.c_str(), sceneId.c_str(), fileSize); else - DEBUG_WARNING(true, ("SetupSharedUtility::installFileManifestEntries(): found an entry with a null filename: (row %i)\n", i)); + DEBUG_WARNING(true, ("SetupSharedUtility::installFileManifestEntries(): found an entry with a nullptr filename: (row %i)\n", i)); } } else diff --git a/engine/shared/library/sharedUtility/src/shared/TemplateParameter.cpp b/engine/shared/library/sharedUtility/src/shared/TemplateParameter.cpp index 751aa045..93af0652 100755 --- a/engine/shared/library/sharedUtility/src/shared/TemplateParameter.cpp +++ b/engine/shared/library/sharedUtility/src/shared/TemplateParameter.cpp @@ -951,7 +951,7 @@ DynamicVariableParamData::~DynamicVariableParamData() for (int i = 0; i < count; ++i) { DynamicVariableParamData *temp = m_data.lparam->at(i); - m_data.lparam->at(i) = NULL; + m_data.lparam->at(i) = nullptr; delete temp; } delete m_data.lparam; @@ -1134,15 +1134,15 @@ void DynamicVariableParam::cleanSingleParam(void) { case DynamicVariableParamData::INTEGER: delete m_dataSingle.m_data.iparam; - m_dataSingle.m_data.iparam = NULL; + m_dataSingle.m_data.iparam = nullptr; break; case DynamicVariableParamData::FLOAT: delete m_dataSingle.m_data.fparam; - m_dataSingle.m_data.fparam = NULL; + m_dataSingle.m_data.fparam = nullptr; break; case DynamicVariableParamData::STRING: delete m_dataSingle.m_data.sparam; - m_dataSingle.m_data.sparam = NULL; + m_dataSingle.m_data.sparam = nullptr; break; case DynamicVariableParamData::LIST: { @@ -1152,11 +1152,11 @@ void DynamicVariableParam::cleanSingleParam(void) ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } delete m_dataSingle.m_data.lparam; - m_dataSingle.m_data.lparam = NULL; + m_dataSingle.m_data.lparam = nullptr; break; case DynamicVariableParamData::UNKNOWN: default: diff --git a/engine/shared/library/sharedUtility/src/shared/TemplateParameter.h b/engine/shared/library/sharedUtility/src/shared/TemplateParameter.h index e3db2210..9c86d90b 100755 --- a/engine/shared/library/sharedUtility/src/shared/TemplateParameter.h +++ b/engine/shared/library/sharedUtility/src/shared/TemplateParameter.h @@ -210,19 +210,19 @@ inline void TemplateBase::cleanData(void) ++iter) { delete (*iter).value; - (*iter).value = NULL; + (*iter).value = nullptr; } delete m_data.weightedList; - m_data.weightedList = NULL; + m_data.weightedList = nullptr; } break; case RANGE: delete m_data.range; - m_data.range = NULL; + m_data.range = nullptr; break; case DIE_ROLL: delete m_data.dieRoll; - m_data.dieRoll = NULL; + m_data.dieRoll = nullptr; break; case NONE: default: @@ -288,7 +288,7 @@ inline const typename TemplateBase::Range * TemplateBase @@ -296,7 +296,7 @@ inline const typename TemplateBase::DieRoll * TemplateBase { if (m_dataType == DIE_ROLL) return m_data.dieRoll; - return NULL; + return nullptr; } template @@ -304,7 +304,7 @@ inline const typename TemplateBase::WeightedList * Templat { if (m_dataType == WEIGHTED_LIST) return m_data.weightedList; - return NULL; + return nullptr; } template @@ -541,7 +541,7 @@ inline const IntegerParam::DieRoll * IntegerParam::getDieRollStruct(void) const } else { - return NULL; + return nullptr; } } @@ -553,7 +553,7 @@ inline const IntegerParam::Range * IntegerParam::getRangeStruct(void) const } else { - return NULL; + return nullptr; } } @@ -637,7 +637,7 @@ inline const FloatParam::Range * FloatParam::getRangeStruct() const } else { - return NULL; + return nullptr; } } @@ -765,7 +765,7 @@ class TriggerVolumeData { friend class TriggerVolumeParam; public: - TriggerVolumeData(void) : m_name(NULL), m_radius(0.0f) {} + TriggerVolumeData(void) : m_name(nullptr), m_radius(0.0f) {} TriggerVolumeData(const std::string & name, float radius) : m_name(&name), m_radius(radius) {} const std::string & getName(void) const; @@ -962,7 +962,7 @@ inline TemplateBase *StructParam::createNewParam(void) template inline StructParam::StructParam(void) : TemplateBase() { - this->m_dataSingle = NULL; + this->m_dataSingle = nullptr; } // StructParam::StructParam /** @@ -974,7 +974,7 @@ inline StructParam::~StructParam() if (this->m_dataType == TemplateBase::SINGLE) { delete this->m_dataSingle; - this->m_dataSingle = NULL; + this->m_dataSingle = nullptr; this->m_dataType = TemplateBase::NONE; } } // StructParam::~StructParam @@ -986,7 +986,7 @@ template inline void StructParam::cleanSingleParam(void) { delete this->m_dataSingle; - this->m_dataSingle = NULL; + this->m_dataSingle = nullptr; } // StructParam::cleanSingleParam /** diff --git a/engine/shared/library/sharedUtility/src/shared/ValueDictionary.cpp b/engine/shared/library/sharedUtility/src/shared/ValueDictionary.cpp index cb90f847..5e12a64b 100755 --- a/engine/shared/library/sharedUtility/src/shared/ValueDictionary.cpp +++ b/engine/shared/library/sharedUtility/src/shared/ValueDictionary.cpp @@ -103,7 +103,7 @@ bool ValueDictionary::exists(std::string const & name) const ValueTypeBase * ValueDictionary::getCopy(std::string const & name) const { - ValueTypeBase * returnValue = NULL; + ValueTypeBase * returnValue = nullptr; DictionaryValueMap::const_iterator iter = m_valueMap.find(name); if (iter != m_valueMap.end()) diff --git a/engine/shared/library/sharedUtility/src/shared/ValueDictionaryArchive.cpp b/engine/shared/library/sharedUtility/src/shared/ValueDictionaryArchive.cpp index e6a638e0..f6ca8859 100755 --- a/engine/shared/library/sharedUtility/src/shared/ValueDictionaryArchive.cpp +++ b/engine/shared/library/sharedUtility/src/shared/ValueDictionaryArchive.cpp @@ -59,7 +59,7 @@ namespace Archive std::string name; std::string type; - ValueTypeBase * value = NULL; + ValueTypeBase * value = nullptr; ValueObjectUnpackHandlerMap::const_iterator iterFind; for (int i = 0; i < static_cast(count); ++i) { @@ -77,7 +77,7 @@ namespace Archive target.insert(name, *value); delete value; - value = NULL; + value = nullptr; } } diff --git a/engine/shared/library/sharedXml/src/shared/tree/XmlTreeDocument.cpp b/engine/shared/library/sharedXml/src/shared/tree/XmlTreeDocument.cpp index 2a6d91d0..997a9dee 100755 --- a/engine/shared/library/sharedXml/src/shared/tree/XmlTreeDocument.cpp +++ b/engine/shared/library/sharedXml/src/shared/tree/XmlTreeDocument.cpp @@ -92,7 +92,7 @@ XmlTreeDocument* XmlTreeDocument::createDocument(const char * rootNodeName) doc = xmlNewDoc(BAD_CAST "1.0"); DEBUG_FATAL( !doc, ("Attempted to make new xmlDoc but failed") ); - xmlNode * node = xmlNewNode( NULL, BAD_CAST rootNodeName ); + xmlNode * node = xmlNewNode( nullptr, BAD_CAST rootNodeName ); DEBUG_FATAL( !node, ("Attempted to make root node for new xml document, but failed")); xmlDocSetRootElement(doc, node); @@ -136,8 +136,8 @@ XmlTreeDocument::XmlTreeDocument(CrcString const &name, xmlDoc *xmlDocument) : m_referenceCount(0), m_track( true ) { - DEBUG_FATAL(m_xmlDocument == NULL, ("XmlTreeDocument(): tried to construct with a NULL xmlDocument.")); - WARNING(m_xmlDocument == NULL, ("XmlTreeDocument(): tried to construct with a NULL xmlDocument.")); + DEBUG_FATAL(m_xmlDocument == nullptr, ("XmlTreeDocument(): tried to construct with a nullptr xmlDocument.")); + WARNING(m_xmlDocument == nullptr, ("XmlTreeDocument(): tried to construct with a nullptr xmlDocument.")); } // ---------------------------------------------------------------------- @@ -148,14 +148,14 @@ m_xmlDocument(xmlDocument), m_referenceCount(0), m_track(false) // documents without names are temporary documents for creation of formatted xml { - DEBUG_FATAL(m_xmlDocument == NULL, ("XmlTreeDocument(): tried to construct with a NULL xmlDocument.")); + DEBUG_FATAL(m_xmlDocument == nullptr, ("XmlTreeDocument(): tried to construct with a nullptr xmlDocument.")); } // ---------------------------------------------------------------------- XmlTreeDocument::~XmlTreeDocument() { xmlFreeDoc(m_xmlDocument); - m_xmlDocument = NULL; + m_xmlDocument = nullptr; } // ====================================================================== diff --git a/engine/shared/library/sharedXml/src/shared/tree/XmlTreeDocumentList.cpp b/engine/shared/library/sharedXml/src/shared/tree/XmlTreeDocumentList.cpp index 6579b201..2299aaf5 100755 --- a/engine/shared/library/sharedXml/src/shared/tree/XmlTreeDocumentList.cpp +++ b/engine/shared/library/sharedXml/src/shared/tree/XmlTreeDocumentList.cpp @@ -61,7 +61,7 @@ void XmlTreeDocumentListNamespace::remove() NamedDocumentMap::iterator const endIt = s_documents.end(); for (NamedDocumentMap::iterator it = s_documents.begin(); it != endIt; ++it) { - DEBUG_REPORT_LOG(true, ("-- xml tree document name [%s], reference count [%d].\n", it->first ? it->first->getString() : "", it->second ? it->second->getReferenceCount() : -1)); + DEBUG_REPORT_LOG(true, ("-- xml tree document name [%s], reference count [%d].\n", it->first ? it->first->getString() : "", it->second ? it->second->getReferenceCount() : -1)); } } } @@ -95,7 +95,7 @@ XmlTreeDocument const *XmlTreeDocumentList::fetch(CrcString const &filename) //-- Handle existing entry. if (haveEntry) { - FATAL(!lowerBound->second, ("XmlTreeDocumentList::fetch() found an entry for filename [%s] but the mapped document was NULL.", filename.getString())); + FATAL(!lowerBound->second, ("XmlTreeDocumentList::fetch() found an entry for filename [%s] but the mapped document was nullptr.", filename.getString())); // Increment reference count and return. lowerBound->second->fetch(); @@ -121,7 +121,7 @@ XmlTreeDocument const *XmlTreeDocumentList::fetch(CrcString const &filename) #endif xmlDocPtr const xmlDocument = xmlParseMemory(reinterpret_cast(fileContents), fileSize); - FATAL(!xmlDocument, ("xmlParseMemory() returned NULL when parsing contents of file [%s].", cPathName)); + FATAL(!xmlDocument, ("xmlParseMemory() returned nullptr when parsing contents of file [%s].", cPathName)); #ifdef _DEBUG unsigned long const postDomBytesAllocated = MemoryManager::getCurrentNumberOfBytesAllocated(); @@ -148,7 +148,7 @@ XmlTreeDocument const *XmlTreeDocumentList::fetch(CrcString const &filename) void XmlTreeDocumentList::stopTracking(XmlTreeDocument const *document) { FATAL(!s_installed, ("XmlTreeDocumentList not installed.")); - FATAL(!document, ("XmlTreeDocumentList::stopTracking(): null document passed in.")); + FATAL(!document, ("XmlTreeDocumentList::stopTracking(): nullptr document passed in.")); //-- Find the map entry for the xml tree document. NamedDocumentMap::iterator const findIt = s_documents.find(&(document->getName())); diff --git a/engine/shared/library/sharedXml/src/shared/tree/XmlTreeNode.cpp b/engine/shared/library/sharedXml/src/shared/tree/XmlTreeNode.cpp index c91ff6f6..38692d89 100755 --- a/engine/shared/library/sharedXml/src/shared/tree/XmlTreeNode.cpp +++ b/engine/shared/library/sharedXml/src/shared/tree/XmlTreeNode.cpp @@ -42,7 +42,7 @@ XmlTreeNode::XmlTreeNode(const std::string &name, const std::string &content) : } xmlNode *textNode = xmlNewText(BAD_CAST contentCopy.c_str() ); - m_treeNode = xmlNewNode(NULL, BAD_CAST nameCopy.c_str()); + m_treeNode = xmlNewNode(nullptr, BAD_CAST nameCopy.c_str()); // verify new nodes DEBUG_FATAL(!textNode, ("Failed to create xml text node")); @@ -70,7 +70,7 @@ XmlTreeNode::XmlTreeNode(const std::string &name) : nameCopy = "garbage"; } - m_treeNode = xmlNewNode(NULL, BAD_CAST nameCopy.c_str()); + m_treeNode = xmlNewNode(nullptr, BAD_CAST nameCopy.c_str()); // verify new nodes DEBUG_FATAL(!m_treeNode, ("Failed to create new xml tree node")); @@ -80,7 +80,7 @@ XmlTreeNode::XmlTreeNode(const std::string &name) : XmlTreeNode XmlTreeNode::addChildNode(const char * name) { - DEBUG_FATAL( !m_treeNode, ("Attempted to add child to null xml node")); + DEBUG_FATAL( !m_treeNode, ("Attempted to add child to nullptr xml node")); XmlTreeNode node(name); if (m_treeNode) @@ -109,7 +109,7 @@ void XmlTreeNode::addChild( const XmlTreeNode& node ) bool XmlTreeNode::isNull() const { - return (m_treeNode == NULL); + return (m_treeNode == nullptr); } // ---------------------------------------------------------------------- @@ -140,7 +140,7 @@ void XmlTreeNode::assertIsElement(char const *const elementName) const char const *const nodeName = getName(); UNREF(elementName); UNREF(nodeName); - DEBUG_FATAL(!isElement(), ("expecting element named [%s], found non-element entity named [%s].", elementName ? elementName : "", nodeName)); + DEBUG_FATAL(!isElement(), ("expecting element named [%s], found non-element entity named [%s].", elementName ? elementName : "", nodeName)); DEBUG_FATAL(_stricmp(elementName, nodeName), ("expecting element named [%s], found element named [%s] instead.", nodeName)); } @@ -148,14 +148,14 @@ void XmlTreeNode::assertIsElement(char const *const elementName) const char const *XmlTreeNode::getName() const { - return (m_treeNode ? reinterpret_cast(m_treeNode->name) : ""); + return (m_treeNode ? reinterpret_cast(m_treeNode->name) : ""); } // ---------------------------------------------------------------------- XmlTreeNode XmlTreeNode::getNextSiblingElementNode() const { - xmlNode *siblingNode = m_treeNode ? m_treeNode->next : NULL; + xmlNode *siblingNode = m_treeNode ? m_treeNode->next : nullptr; while (siblingNode && (siblingNode->type != XML_ELEMENT_NODE)) siblingNode = siblingNode->next; @@ -166,16 +166,16 @@ XmlTreeNode XmlTreeNode::getNextSiblingElementNode() const XmlTreeNode XmlTreeNode::getFirstChildNode() const { - return XmlTreeNode(m_treeNode ? m_treeNode->children : NULL); + return XmlTreeNode(m_treeNode ? m_treeNode->children : nullptr); } // ---------------------------------------------------------------------- XmlTreeNode XmlTreeNode::getFirstChildElementNode() const { - //-- Check if we have a NULL node. + //-- Check if we have a nullptr node. if (!m_treeNode) - return XmlTreeNode(NULL); + return XmlTreeNode(nullptr); //-- Look for the first child node that is an element. xmlNode *childNode = m_treeNode->children; @@ -190,9 +190,9 @@ XmlTreeNode XmlTreeNode::getFirstChildElementNode() const XmlTreeNode XmlTreeNode::getFirstChildTextNode() const { - //-- Check if we have a NULL node. + //-- Check if we have a nullptr node. if (!m_treeNode) - return XmlTreeNode(NULL); + return XmlTreeNode(nullptr); //-- Look for the first child node that is a text node. xmlNode *childNode = m_treeNode->children; @@ -212,18 +212,18 @@ XmlTreeNode XmlTreeNode::getElementAttributeValueNode(char const *attributeName, //-- Validate parameters and preconditions. if (!isElement()) { - DEBUG_FATAL(!optional, ("getElementAttributeValueNode(): node [%s] is not an element.", m_treeNode ? reinterpret_cast(m_treeNode->name) : "")); - return XmlTreeNode(NULL); + DEBUG_FATAL(!optional, ("getElementAttributeValueNode(): node [%s] is not an element.", m_treeNode ? reinterpret_cast(m_treeNode->name) : "")); + return XmlTreeNode(nullptr); } if (!attributeName) { - DEBUG_FATAL(!optional, ("getElementAttributeValueNode(): attributeName is NULL.")); - return XmlTreeNode(NULL); + DEBUG_FATAL(!optional, ("getElementAttributeValueNode(): attributeName is nullptr.")); + return XmlTreeNode(nullptr); } //-- Check the attribute nodes for a match on the given name. Ignore case. - for (xmlAttr *attributeNode = m_treeNode ? m_treeNode->properties : NULL; attributeNode; attributeNode = attributeNode->next) + for (xmlAttr *attributeNode = m_treeNode ? m_treeNode->properties : nullptr; attributeNode; attributeNode = attributeNode->next) { if (!_stricmp(attributeName, reinterpret_cast(attributeNode->name))) { @@ -234,7 +234,7 @@ XmlTreeNode XmlTreeNode::getElementAttributeValueNode(char const *attributeName, //-- No attribute node matched the attribute name. DEBUG_FATAL(!optional, ("getElementAttributeValueNode(): failed to find attribute [%s] on element node [%s].", attributeName, getName())); - return XmlTreeNode(NULL); + return XmlTreeNode(nullptr); } // ---------------------------------------------------------------------- @@ -250,7 +250,7 @@ bool XmlTreeNode::getElementAttributeAsBool(char const *attributeName, bool &val char const *const contents = attributeValueNode.getTextValue(); if (!contents) { - DEBUG_FATAL(!contents, ("contents of attribute [%s] is NULL.", attributeName)); + DEBUG_FATAL(!contents, ("contents of attribute [%s] is nullptr.", attributeName)); return false; //lint !e527 // unreachable // reachable in release. } @@ -275,7 +275,7 @@ bool XmlTreeNode::getElementAttributeAsFloat(char const *attributeName, float &v char const *const contents = attributeValueNode.getTextValue(); if (!contents) { - DEBUG_FATAL(!contents, ("contents of attribute [%s] is NULL.", attributeName)); + DEBUG_FATAL(!contents, ("contents of attribute [%s] is nullptr.", attributeName)); return false; //lint !e527 // unreachable // reachable in release. } @@ -306,7 +306,7 @@ bool XmlTreeNode::getElementAttributeAsInt(char const *attributeName, int &value char const *const contents = attributeValueNode.getTextValue(); if (!contents) { - DEBUG_FATAL(!contents, ("contents of attribute [%s] is NULL.", attributeName)); + DEBUG_FATAL(!contents, ("contents of attribute [%s] is nullptr.", attributeName)); return false; //lint !e527 // unreachable // reachable in release. } @@ -366,12 +366,12 @@ char const *XmlTreeNode::getTextValue() const //-- Ensure we're a text node. if(!node.isText()) { - DEBUG_FATAL(true, ("node [%s] is not a text node", m_treeNode ? reinterpret_cast(m_treeNode->name) : "")); - return NULL; //lint !e527 // unreachable // reachable in release. + DEBUG_FATAL(true, ("node [%s] is not a text node", m_treeNode ? reinterpret_cast(m_treeNode->name) : "")); + return nullptr; //lint !e527 // unreachable // reachable in release. } //-- Return contents. - return node.m_treeNode ? reinterpret_cast(node.m_treeNode->content) : NULL; + return node.m_treeNode ? reinterpret_cast(node.m_treeNode->content) : nullptr; } // ---------------------------------------------------------------------- diff --git a/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.cpp b/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.cpp index 49aeee58..cbe80abf 100755 --- a/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.cpp +++ b/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.cpp @@ -51,7 +51,7 @@ MonitorObject::~MonitorObject() if( mConnection ) { - mConnection->SetHandler(NULL); + mConnection->SetHandler(nullptr); mConnection->Disconnect(); mConnection->Release(); } @@ -75,10 +75,10 @@ char hold[214]; UdpConnection::DisconnectReasonText( mConnection->GetOtherSideDisconnectReason())); } } - mConnection->SetHandler(NULL); + mConnection->SetHandler(nullptr); mConnection->Disconnect(); mConnection->Release(); - mConnection = NULL; + mConnection = nullptr; } } @@ -94,10 +94,10 @@ void MonitorObject::OnRoutePacket( UdpConnection * con, const unsigned char *da simpleMessage msg(data); - if( con == NULL ) + if( con == nullptr ) { if( mbprint) - fprintf(stderr,"MONITOR API: MonitorObject.OnRoutePacket, recived a NULL connection.?\n"); + fprintf(stderr,"MONITOR API: MonitorObject.OnRoutePacket, recived a nullptr connection.?\n"); return; } @@ -123,7 +123,7 @@ void MonitorObject::OnRoutePacket( UdpConnection * con, const unsigned char *da if( mHierarchySent == true ) { mMonitorData->processElementsRequest(con,mSequence,(char *)&data[6],dataLen,mlastUpdateTime ); - mlastUpdateTime = (long)time(NULL); + mlastUpdateTime = (long)time(nullptr); break; } @@ -261,7 +261,7 @@ MonitorManager::MonitorManager(const char *configFile, CMonitorData *_gamedata, { mManager = manager; mbprint = _bprint; - passString = NULL; + passString = nullptr; mMonitorData = _gamedata; mObjectCount = 0; @@ -291,7 +291,7 @@ void MonitorManager::OnConnectRequest(UdpConnection *con) { if( con ) { - con->SetHandler(NULL); + con->SetHandler(nullptr); con->Disconnect(); con->Release(); } @@ -313,7 +313,7 @@ void MonitorManager::GiveTime() // check if the monitor object is no longer connected for (int i = 0; i < mObjectCount; i++) { - if( mObject[i]->mConnection == NULL || + if( mObject[i]->mConnection == nullptr || mObject[i]->mConnection->GetStatus() == UdpConnection::cStatusDisconnected ) { MonitorObject *o = mObject[i]; @@ -345,7 +345,7 @@ int x; char buffer[1024]; FILE *fp = fopen(filename,"r"); - if (fp == NULL) + if (fp == nullptr) { fprintf(stderr,"Monitor API: could not open %s file\nTHIS FILE IS REQUIRED.\n", filename); return false; @@ -367,7 +367,7 @@ char buffer[1024]; x = 0; while(!feof(fp)) { - if (fgets( buffer, 1023, fp) != NULL) { + if (fgets( buffer, 1023, fp) != nullptr) { // get rid of '\n' and '\r' for comparisons strtok(buffer,"\r\n"); len = (int)strlen(buffer); @@ -403,17 +403,17 @@ CMonitorAPI::CMonitorAPI( const char *configFile, unsigned short Port, bool _bpr mbprint = _bprint; mPort = Port; - mAddress = NULL; + mAddress = nullptr; if( address ) { mAddress = (char *)malloc(strlen(address)+1); strcpy(mAddress,address); } - if( mang == NULL ) + if( mang == nullptr ) { UdpManager::Params params; - params.handler = NULL; + params.handler = nullptr; params.maxConnections = CONNECTION_MAX; params.outgoingBufferSize = 1000000; params.noDataTimeout = 130000; @@ -595,7 +595,7 @@ int err; unsigned long S = 4000000; unsigned char *p; - data = NULL; + data = nullptr; p = (unsigned char *)malloc(4000000); memset(p,0,4000000); err = uncompress(p,&S,(source+6),(long)getSize()); diff --git a/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.h b/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.h index d97079c7..975e2429 100755 --- a/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.h +++ b/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.h @@ -42,14 +42,14 @@ public: * * debug = turn on/off debugging. * - * address = (NOT USED) Leave as NULL + * address = (NOT USED) Leave as nullptr * - * UdpManager * mang = (NOT USED) Leave as NULL + * UdpManager * mang = (NOT USED) Leave as nullptr * - * // GenericNotifier *notifier = (NOT USED) Leave as NULL + * // GenericNotifier *notifier = (NOT USED) Leave as nullptr * */ - CMonitorAPI( const char *configFile, unsigned short port, bool debug = false , char * address = NULL, UdpManager * mang = NULL ); + CMonitorAPI( const char *configFile, unsigned short port, bool debug = false , char * address = nullptr, UdpManager * mang = nullptr ); ~CMonitorAPI(); @@ -112,7 +112,7 @@ public: * Max Limited * #define ELEMENT_MAX_START 2000 */ - int add( const char *label, int Key, int mode = MON_HISTORY, const char *Description = NULL ); + int add( const char *label, int Key, int mode = MON_HISTORY, const char *Description = nullptr ); /**************** Set the description of an element ** diff --git a/external/3rd/library/platform/projects/MonAPI2/MonitorData.cpp b/external/3rd/library/platform/projects/MonAPI2/MonitorData.cpp index 4b283bc6..044c1a17 100755 --- a/external/3rd/library/platform/projects/MonAPI2/MonitorData.cpp +++ b/external/3rd/library/platform/projects/MonAPI2/MonitorData.cpp @@ -58,7 +58,7 @@ CMonitorData::CMonitorData() { m_sequence = 1; - m_buffer = NULL; + m_buffer = nullptr; m_nbuffer = 0; m_count = 0; m_max = ELEMENT_MAX_START; @@ -103,7 +103,7 @@ void CMonitorData::resize_buffer(int new_size) { char *temp; - if( m_buffer != NULL ) + if( m_buffer != nullptr ) { temp = m_buffer; m_buffer = new char[ new_size]; @@ -331,7 +331,7 @@ char *p; if( get_bit(mark,x) == 0 ) { set_bit( mark, x ); - if( m_data[x].discription != NULL ) + if( m_data[x].discription != nullptr ) { sprintf(tmp,"%d,%s|",m_data[x].id, m_data[x].discription); size += (int)strlen(tmp); @@ -360,7 +360,7 @@ char *p; { flag = 2; set_bit(mark,x); - if( m_data[x].discription != NULL ) + if( m_data[x].discription != nullptr ) { sprintf(tmp,"%d,%s|",m_data[x].id, m_data[x].discription); size += (int)strlen(tmp); @@ -412,7 +412,7 @@ int x; //******* Discription ****** delete [] m_data[x].discription; - m_data[x].discription = NULL; + m_data[x].discription = nullptr; if( des ) { m_data[x].discription = new char [strlen(des)+1]; @@ -459,10 +459,10 @@ int x; { if( Id == m_data[x].id ) { - if( Description == NULL ) + if( Description == nullptr ) { delete [] m_data[x].discription; - m_data[x].discription = NULL; + m_data[x].discription = nullptr; mode = 0; return x; } @@ -510,7 +510,7 @@ int high, i, low; if ( high < m_count && Id==m_data[high].id ) { if (m_data[high].ChangedTime == 0 || m_data[high].value != value) { - m_data[high].ChangedTime = (long)time(NULL); + m_data[high].ChangedTime = (long)time(nullptr); m_data[high].value = value; } } @@ -560,7 +560,7 @@ int CMonitorData::parseList( char **list, char *data, char tok , int max ) int count; int cnt; - if( data == NULL ) + if( data == nullptr ) return 0; list[0] = data; diff --git a/external/3rd/library/platform/projects/MonAPI2/MonitorData.h b/external/3rd/library/platform/projects/MonAPI2/MonitorData.h index 1146d83e..56e3f0b9 100755 --- a/external/3rd/library/platform/projects/MonAPI2/MonitorData.h +++ b/external/3rd/library/platform/projects/MonAPI2/MonitorData.h @@ -35,7 +35,7 @@ Usage 'L' - long long int (8) 'i' - int (4) 's' - short int (2) - 'S' - C-style, null-terminated string (n + null) + 'S' - C-style, nullptr-terminated string (n + nullptr) 'Bn' - buffer, of size n. Used for non-terminated strings, or other binary data. */ @@ -115,7 +115,7 @@ private: //---------------------------------------------------------------- // stringMessage -// This message type is used for passing messages that can consist of a NULL terminated string +// This message type is used for passing messages that can consist of a nullptr terminated string class stringMessage : public monMessage { public: @@ -252,7 +252,7 @@ class CMonitorData { public: -// CMonitorData(GenericNotifier *notifier=NULL ); +// CMonitorData(GenericNotifier *notifier=nullptr ); CMonitorData(); virtual ~CMonitorData(); @@ -266,7 +266,7 @@ public: bool processDescriptionRequest(UdpConnection *con, short & sequence, char * userData, int dataLen,unsigned char *mark); int add(const char *label, int id, int ping, const char *des ); int setDescription( int Id, const char *Description , int & mode); - char *getDescription(int x){ if( m_ndata >= x ) return NULL; return m_data[x].discription;} + char *getDescription(int x){ if( m_ndata >= x ) return nullptr; return m_data[x].discription;} int pingValue(int p); void set(int Id, int value); void remove(int Id); diff --git a/external/3rd/library/platform/projects/Session/CommonAPI/CommonClient.cpp b/external/3rd/library/platform/projects/Session/CommonAPI/CommonClient.cpp index 4856d6e2..f61f6464 100755 --- a/external/3rd/library/platform/projects/Session/CommonAPI/CommonClient.cpp +++ b/external/3rd/library/platform/projects/Session/CommonAPI/CommonClient.cpp @@ -42,7 +42,7 @@ CConnectionHandler::~CConnectionHandler() { if (mConnection) { - mConnection->SetHandler(NULL); + mConnection->SetHandler(nullptr); mConnection->Disconnect(); mConnection->Release(); } @@ -79,7 +79,7 @@ void CConnectionHandler::OnTerminated(UdpConnection *) if (mConnection) { - mConnection->SetHandler(NULL); + mConnection->SetHandler(nullptr); mConnection->Release(); mConnection = 0; } diff --git a/external/3rd/library/platform/projects/Session/LoginAPI/ClientCore.cpp b/external/3rd/library/platform/projects/Session/LoginAPI/ClientCore.cpp index a9e2caf6..1cabca55 100755 --- a/external/3rd/library/platform/projects/Session/LoginAPI/ClientCore.cpp +++ b/external/3rd/library/platform/projects/Session/LoginAPI/ClientCore.cpp @@ -749,7 +749,7 @@ namespace LoginAPI else input.SetSessionID(sessionID); - // don't validate session type, there are clients that pass in NULL. + // don't validate session type, there are clients that pass in nullptr. input.SetSessionType(sessionType); //////////////////////////////////////// @@ -776,7 +776,7 @@ namespace LoginAPI else input.SetSessionID(sessionID); - // don't validate session type, there are clients that pass in NULL. + // don't validate session type, there are clients that pass in nullptr. input.SetSessionType(sessionType); //////////////////////////////////////// @@ -803,7 +803,7 @@ namespace LoginAPI else input.SetSessionID(sessionID); - // don't validate session type, there are clients that pass in NULL. + // don't validate session type, there are clients that pass in nullptr. input.SetSessionType(sessionType); //////////////////////////////////////// @@ -830,7 +830,7 @@ namespace LoginAPI else input.SetSessionID(sessionID); - // don't validate session type, there are clients that pass in NULL. + // don't validate session type, there are clients that pass in nullptr. input.SetSessionType(sessionType); //////////////////////////////////////// diff --git a/external/3rd/library/platform/utils/Base/Archive.cpp b/external/3rd/library/platform/utils/Base/Archive.cpp index 90f5f2f5..7d59c663 100755 --- a/external/3rd/library/platform/utils/Base/Archive.cpp +++ b/external/3rd/library/platform/utils/Base/Archive.cpp @@ -91,7 +91,7 @@ namespace Base ByteStream::ByteStream() : allocatedSize(0), beginReadIterator(), - data(NULL), + data(nullptr), size(0) { data = Data::getNewData(); @@ -187,7 +187,7 @@ namespace Base if(data->size < allocatedSize) { unsigned char * tmp = new unsigned char[newSize]; - if(data->buffer != NULL) + if(data->buffer != nullptr) memcpy(tmp, data->buffer, size); delete[] data->buffer; data->buffer = tmp; diff --git a/external/3rd/library/platform/utils/Base/AutoLog.cpp b/external/3rd/library/platform/utils/Base/AutoLog.cpp index 9b25380e..aa84b96f 100755 --- a/external/3rd/library/platform/utils/Base/AutoLog.cpp +++ b/external/3rd/library/platform/utils/Base/AutoLog.cpp @@ -35,7 +35,7 @@ bool CAutoLog::Open(const char * filename) //------------------------------------- { - if( NULL == filename) + if( nullptr == filename) return false; if (pFilename) @@ -49,13 +49,13 @@ bool CAutoLog::Open(const char * filename) // Sanitize slashes char *ptr; - while ((ptr = strchr(pFilename,WRONGSLASH)) != NULL) + while ((ptr = strchr(pFilename,WRONGSLASH)) != nullptr) *ptr = SLASHCHAR[0]; char strPath[1024]; strcpy(strPath,pFilename); ptr = strrchr(strPath, SLASHCHAR[0]); - if (ptr != NULL) + if (ptr != nullptr) { *ptr = 0; @@ -63,11 +63,11 @@ bool CAutoLog::Open(const char * filename) char curdir[128]; // remember current directory - if( _getcwd(curdir,sizeof(curdir)) == NULL ) + if( _getcwd(curdir,sizeof(curdir)) == nullptr ) { fprintf(stderr,"CAutoLog::Archive failed to get current directory!\n"); free(pFilename); - pFilename = NULL; + pFilename = nullptr; return false; // error, can't proceed } @@ -78,7 +78,7 @@ bool CAutoLog::Open(const char * filename) { fprintf(stderr,"CAutoLog::Archive failed to make directory: %s\n", strPath); free(pFilename); - pFilename = NULL; + pFilename = nullptr; return false; // error, can't proceed } } @@ -98,7 +98,7 @@ bool CAutoLog::Open(const char * filename) { fprintf(stderr,"CAutoLog::Archive failed to make directory: %s\n", strPath); free(pFilename); - pFilename = NULL; + pFilename = nullptr; return false; // error, can't proceed } } @@ -107,7 +107,7 @@ bool CAutoLog::Open(const char * filename) pFile = fopen(pFilename,"a+"); - if( pFile == NULL || pFile == (FILE *)-1) + if( pFile == nullptr || pFile == (FILE *)-1) { //fprintf(stderr,"CAutoLog::Open failed to open log file: %s\n",pFilename); Close(); @@ -127,14 +127,14 @@ bool CAutoLog::Open(const char * filename) void CAutoLog::Close(void) //------------------------------------- { - if( pFile != (FILE *)-1 && pFile != NULL) + if( pFile != (FILE *)-1 && pFile != nullptr) { fclose(pFile); } pFile = (FILE *)-1; free(pFilename); - pFilename = NULL; + pFilename = nullptr; } //------------------------------------- @@ -197,7 +197,7 @@ void CAutoLog::LogDebug(char * format, ...) void CAutoLog::Log(eLogLevel severity, char *fmt, ...) //------------------------------------- { - if (pFile == (FILE *)-1 || pFile == NULL) + if (pFile == (FILE *)-1 || pFile == nullptr) { //fprintf(stderr,"CAutoLog::Log called with no file open!\n"); return; @@ -253,7 +253,7 @@ void CAutoLog::Log(eLogLevel severity, char *fmt, ...) void CAutoLog::Archive(void) //------------------------------------- { - if( pFile == (FILE *)-1 || pFile == NULL) + if( pFile == (FILE *)-1 || pFile == nullptr) { //fprintf(stderr,"CAutoLog::Archive called with no file open!\n"); return; @@ -284,7 +284,7 @@ void CAutoLog::Archive(void) strcpy(strCurrent,pFilename); pCurrent = strrchr(strCurrent, SLASHCHAR[0]); - if (pCurrent != NULL) + if (pCurrent != nullptr) *pCurrent = 0; else sprintf(strCurrent,"."); @@ -293,7 +293,7 @@ void CAutoLog::Archive(void) #ifdef WIN32 // remember current directory - if( _getcwd(curdir,sizeof(curdir)) == NULL ) + if( _getcwd(curdir,sizeof(curdir)) == nullptr ) { fprintf(stderr,"CAutoLog::Archive failed to get current directory!\n"); return; // error, can't proceed @@ -327,7 +327,7 @@ void CAutoLog::Archive(void) #endif pCurrent = strrchr(pFilename, SLASHCHAR[0]); - if (pCurrent == NULL) + if (pCurrent == nullptr) pCurrent = pFilename; else pCurrent++; diff --git a/external/3rd/library/platform/utils/Base/AutoLog.h b/external/3rd/library/platform/utils/Base/AutoLog.h index 0a90a774..18871c7f 100755 --- a/external/3rd/library/platform/utils/Base/AutoLog.h +++ b/external/3rd/library/platform/utils/Base/AutoLog.h @@ -92,14 +92,14 @@ namespace Base //------------------------------------- inline CAutoLog::CAutoLog() { - pFilename = NULL; + pFilename = nullptr; pFile = (FILE *)-1; } //------------------------------------- inline CAutoLog::CAutoLog(const char * file) { - pFilename = NULL; + pFilename = nullptr; pFile = (FILE *)-1; Open(file); } diff --git a/external/3rd/library/platform/utils/Base/Config.cpp b/external/3rd/library/platform/utils/Base/Config.cpp index a305cb9c..6351686f 100755 --- a/external/3rd/library/platform/utils/Base/Config.cpp +++ b/external/3rd/library/platform/utils/Base/Config.cpp @@ -28,7 +28,7 @@ bool CConfig::LoadFile(char * file) // open file fp = fopen(file, "r"); - if (fp == NULL || fp == (FILE *)-1) + if (fp == nullptr || fp == (FILE *)-1) { //fprintf(stderr,"Failed to open config file %s!",file); delete fp; @@ -73,21 +73,21 @@ void CConfig::UnloadFile(void) //----------------------------------- { delete[] pConfig; - pConfig = NULL; + pConfig = nullptr; } //----------------------------------- /// finds a key of the config in memory // key argument is case-insensitive, but must be upper case in config file -// Returns true for success (passing NULL is a special case returned as success) +// Returns true for success (passing nullptr is a special case returned as success) bool CConfig::FindKey(char *key) //----------------------------------- { - if (pConfig == NULL) + if (pConfig == nullptr) return false; // special case...continue with existing key - if (key == NULL) + if (key == nullptr) return true; // form the search key @@ -98,12 +98,12 @@ bool CConfig::FindKey(char *key) // find the key heading pCursor = strstr(pConfig,strBuffer); - if (pCursor==NULL) + if (pCursor==nullptr) return false; // find the closing bracket of key heading pCursor = strchr(pCursor,']'); - if (pCursor==NULL) + if (pCursor==nullptr) return false; pCursor++; @@ -112,7 +112,7 @@ bool CConfig::FindKey(char *key) //----------------------------------- /// extract a number from the config string -// pass the key to find the first number in the list, else NULL to find the next number in the list +// pass the key to find the first number in the list, else nullptr to find the next number in the list // returns 0 if no number is found, else returns the number long CConfig::GetLong(char *key) //----------------------------------- @@ -135,20 +135,20 @@ long CConfig::GetLong(char *key) //----------------------------------- /// extract string (in double-quotes) from the list. -// pass the key to find the first string in the list, else NULL to find the next string in the list -// returns NULL if no string found, else returns a temporary copy of the string (without quotes) +// pass the key to find the first string in the list, else nullptr to find the next string in the list +// returns nullptr if no string found, else returns a temporary copy of the string (without quotes) char * CConfig::GetString(char *key) //----------------------------------- { if (!FindKey(key)) - return NULL; + return nullptr; // look for start of string or end of key while (*pCursor && *pCursor != '"' && *pCursor != '[') pCursor++; if (*(pCursor++) != '"') - return NULL; + return nullptr; // until closing quote int c = 0; @@ -162,7 +162,7 @@ char * CConfig::GetString(char *key) } } - return NULL; + return nullptr; } diff --git a/external/3rd/library/platform/utils/Base/Config.h b/external/3rd/library/platform/utils/Base/Config.h index 56ad96af..f577eef6 100755 --- a/external/3rd/library/platform/utils/Base/Config.h +++ b/external/3rd/library/platform/utils/Base/Config.h @@ -10,7 +10,7 @@ ; list of strings, with code example # config.FindKey("NUMBERS"); -# while (number = config.GetLong(NULL)) +# while (number = config.GetLong(nullptr)) # YourHandleNumber(number); [NUMBERS] 100 200, 300 ; formatting is very flexible as long as numbers are delimited by non-numbers @@ -23,7 +23,7 @@ ; list of strings, with code example # config.FindKey("HOSTS"); -# while (string = config.GetString(NULL)) +# while (string = config.GetString(nullptr)) # YourHandleString(string); [HOSTS] "206.19.151.173:5999" @@ -68,16 +68,16 @@ namespace Base // returns TRUE if key is found. bool FindKey(char *key); - // extract string from config. If key is NULL, extract next string in list, else extract first string. - // if key was not found, returns NULL - char * GetString(char *key = NULL); + // extract string from config. If key is nullptr, extract next string in list, else extract first string. + // if key was not found, returns nullptr + char * GetString(char *key = nullptr); - // extract number from config. If key is NULL, extract next number in list, else extract first number. + // extract number from config. If key is nullptr, extract next number in list, else extract first number. // if key was not found, returns 0 - long GetLong(char *key = NULL); // extract number from config. + long GetLong(char *key = nullptr); // extract number from config. // indicate if config file has been loaded - inline bool FileLoaded() { return pConfig == NULL ? false : true; } + inline bool FileLoaded() { return pConfig == nullptr ? false : true; } private: char * pConfig; // pointer to file memory @@ -87,14 +87,14 @@ namespace Base inline CConfig::CConfig() { - pConfig = NULL; - pCursor = NULL; + pConfig = nullptr; + pCursor = nullptr; } inline CConfig::CConfig(char * file) { - pConfig = NULL; - pCursor = NULL; + pConfig = nullptr; + pCursor = nullptr; LoadFile(file); } diff --git a/external/3rd/library/platform/utils/Base/Statistics.h b/external/3rd/library/platform/utils/Base/Statistics.h index 18e0579e..0856034b 100755 --- a/external/3rd/library/platform/utils/Base/Statistics.h +++ b/external/3rd/library/platform/utils/Base/Statistics.h @@ -34,9 +34,9 @@ namespace Base bool commit = false; if (!mLastSampleTime) - mLastSampleTime = time(NULL); + mLastSampleTime = time(nullptr); - if (!mSampleFrequency || mLastSampleTime + mSampleFrequency < (unsigned)time(NULL)) + if (!mSampleFrequency || mLastSampleTime + mSampleFrequency < (unsigned)time(nullptr)) { mSampleTotal++; mAggregateTotal += value; diff --git a/external/3rd/library/platform/utils/Base/TemplateObjectAllocator.h b/external/3rd/library/platform/utils/Base/TemplateObjectAllocator.h index 40227673..ed1a7937 100755 --- a/external/3rd/library/platform/utils/Base/TemplateObjectAllocator.h +++ b/external/3rd/library/platform/utils/Base/TemplateObjectAllocator.h @@ -93,7 +93,7 @@ namespace Base void Destroy(TYPE *object) { - if (object == NULL) + if (object == nullptr) return; #ifdef USE_ALLOCATOR_MUTEX @@ -142,7 +142,7 @@ namespace Base void FastDestroy(TYPE *object) { - if (object == NULL) + if (object == nullptr) return; object->~TYPE(); diff --git a/external/3rd/library/platform/utils/Base/linux/BlockAllocator.cpp b/external/3rd/library/platform/utils/Base/linux/BlockAllocator.cpp index 4cefb9e7..29d91074 100755 --- a/external/3rd/library/platform/utils/Base/linux/BlockAllocator.cpp +++ b/external/3rd/library/platform/utils/Base/linux/BlockAllocator.cpp @@ -12,7 +12,7 @@ namespace Base { for(unsigned i = 0; i < 31; i++) { - m_blocks[i] = NULL; + m_blocks[i] = nullptr; } } @@ -21,7 +21,7 @@ namespace Base // free all allocated memory blocks for(unsigned i = 0; i < 31; i++) { - while(m_blocks[i] != NULL) + while(m_blocks[i] != nullptr) { unsigned *tmp = m_blocks[i]; m_blocks[i] = (unsigned *)*m_blocks[i]; @@ -36,7 +36,7 @@ namespace Base void *BlockAllocator::getBlock(unsigned bytes) { unsigned accum = 16, bits = 16; - unsigned *handle = NULL; + unsigned *handle = nullptr; // Perform a binary search looking for the highest bit. @@ -96,7 +96,7 @@ namespace Base void BlockAllocator::returnBlock(unsigned *handle) { - // C++ allows for safe deletion of a NULL pointer + // C++ allows for safe deletion of a nullptr pointer if(handle) { // Update the allocator linked list, insert this entry at the head diff --git a/external/3rd/library/platform/utils/Base/linux/Event.cpp b/external/3rd/library/platform/utils/Base/linux/Event.cpp index a3cce3b1..72190595 100755 --- a/external/3rd/library/platform/utils/Base/linux/Event.cpp +++ b/external/3rd/library/platform/utils/Base/linux/Event.cpp @@ -26,8 +26,8 @@ namespace Base mCond(), mThreadCount(0) { - pthread_mutex_init(&mMutex, NULL); - pthread_cond_init(&mCond, NULL); + pthread_mutex_init(&mMutex, nullptr); + pthread_cond_init(&mCond, nullptr); } CEvent::~CEvent() @@ -74,7 +74,7 @@ namespace Base struct timeval now; struct timespec abs_timeout; - gettimeofday(&now, NULL); + gettimeofday(&now, nullptr); abs_timeout.tv_sec = now.tv_sec + timeout/1000; abs_timeout.tv_nsec = now.tv_usec * 1000 + (timeout%1000)*1000000; abs_timeout.tv_sec += abs_timeout.tv_nsec / 1000000000; diff --git a/external/3rd/library/platform/utils/Base/linux/Logger.cpp b/external/3rd/library/platform/utils/Base/linux/Logger.cpp index f305703d..1510e1c1 100755 --- a/external/3rd/library/platform/utils/Base/linux/Logger.cpp +++ b/external/3rd/library/platform/utils/Base/linux/Logger.cpp @@ -18,20 +18,20 @@ Logger::Logger(const char *prefix, int level, unsigned size, bool rollDate) : m_defaultLevel(level), m_defaultSize(size), m_dirPrefix(prefix), m_rollDate(rollDate) { char buf[1024]; - FILE *logDir = NULL; + FILE *logDir = nullptr; logDir = fopen(m_dirPrefix.c_str(), "r+"); if(errno == ENOENT) { cmkdir(m_dirPrefix.c_str(), 0755); } - else if(logDir != NULL) + else if(logDir != nullptr) { fclose(logDir); } tm now; - time_t t = time(NULL); + time_t t = time(nullptr); localtime_r(&t, &now); memcpy(&m_lastDateTime, &now, sizeof(tm)); @@ -48,7 +48,7 @@ Logger::Logger(const char *prefix, int level, unsigned size, bool rollDate) { cmkdir(buf, 0755); } - else if(logDir != NULL) + else if(logDir != nullptr) { fclose(logDir); } @@ -178,7 +178,7 @@ void Logger::logSimple(unsigned logenum, int level, const char *message) { return; } - time_t t = time(NULL); + time_t t = time(nullptr); LogInfo *info = (*iter).second; if(level >= info->level) { @@ -241,7 +241,7 @@ void Logger::log(unsigned logenum, int level, const char *message, ...) { return; } - time_t t = time(NULL); + time_t t = time(nullptr); LogInfo *info = (*iter).second; if(level >= info->level) { @@ -294,14 +294,14 @@ void Logger::log(unsigned logenum, int level, const char *message, ...) void Logger::rollDate(time_t t) { char buf[80]; - FILE *logDir = NULL; + FILE *logDir = nullptr; logDir = fopen(m_dirPrefix.c_str(), "r+"); if(errno == ENOENT) { cmkdir(m_dirPrefix.c_str(), 0755); } - else if(logDir != NULL) + else if(logDir != nullptr) { fclose(logDir); } @@ -316,7 +316,7 @@ void Logger::rollDate(time_t t) { cmkdir(buf, 0755); } - else if(logDir != NULL) + else if(logDir != nullptr) { fclose(logDir); } diff --git a/external/3rd/library/platform/utils/Base/linux/Thread.cpp b/external/3rd/library/platform/utils/Base/linux/Thread.cpp index 2bc4f26b..5cca2017 100755 --- a/external/3rd/library/platform/utils/Base/linux/Thread.cpp +++ b/external/3rd/library/platform/utils/Base/linux/Thread.cpp @@ -76,8 +76,8 @@ namespace Base CThreadPool::CMember::CMember(CThreadPool * parent) : mParent(parent), - mFunction(NULL), - mArgument(NULL), + mFunction(nullptr), + mArgument(nullptr), mSemaphore() { StartThread(); @@ -116,8 +116,8 @@ namespace Base if (mFunction) { mFunction(mArgument); - mArgument = NULL; - mFunction = NULL; + mArgument = nullptr; + mFunction = nullptr; } else if (mParent->OnDestory(this)) mThreadContinue = false; @@ -172,7 +172,7 @@ namespace Base } //////////////////////////////////////// - // (3) Delete the null member threads + // (3) Delete the nullptr member threads mMutex.Lock(); while (!mNullMember.empty()) { @@ -199,7 +199,7 @@ namespace Base } //////////////////////////////////////// - // (2) Delete any null member threads. + // (2) Delete any nullptr member threads. while (!mNullMember.empty()) { delete mNullMember.front(); diff --git a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistStressTest/test.cpp b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistStressTest/test.cpp index c9d48ca3..dae431dd 100755 --- a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistStressTest/test.cpp +++ b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistStressTest/test.cpp @@ -376,8 +376,8 @@ void createTicket() Plat_Unicode::String xml = narrowToWide("Stress Test XML here"); t.setDetails(details.c_str()); t.setLocation(location.c_str()); - track = api->requestCreateTicket(NULL, &t, NULL, t.uid); - //track = api->requestCreateTicket(NULL, &t, xml.c_str(), t.uid); + track = api->requestCreateTicket(nullptr, &t, nullptr, t.uid); + //track = api->requestCreateTicket(nullptr, &t, xml.c_str(), t.uid); submitted++; printf("creating ticket\n"); @@ -478,7 +478,7 @@ int main(int argc, char **argv) gamep = argv[4]; gameserver = argv[5]; - if (serverhost == NULL || strlen(serverhost) == 0) + if (serverhost == nullptr || strlen(serverhost) == 0) { std::cout << "Missing hostname!\n"; return 0; @@ -493,12 +493,12 @@ int main(int argc, char **argv) std::cout << "Missing or invalid number of functions to run!\n"; return 0; } - if (gamep == NULL || strlen(gamep) == 0) + if (gamep == nullptr || strlen(gamep) == 0) { std::cout << "Missing game name!\n"; return 0; } - if (gameserver == NULL || strlen(gameserver) == 0) + if (gameserver == nullptr || strlen(gameserver) == 0) { std::cout << "Missing game server name!\n"; return 0; @@ -517,7 +517,7 @@ while(1) unsigned loginWait(500); unsigned loginAttempts(0); //api = new apiTest(serverhost, serverport, 60, CSASSIST_APIFLAG_ASSUME_RECONNECT); //, 0, CSASSIST_APIFLAG_ASSUME_RECONNECT); - //api->connectCSAssist(NULL, game.c_str(), server.c_str()); + //api->connectCSAssist(nullptr, game.c_str(), server.c_str()); //while (!ready) // api->Update(); @@ -530,7 +530,7 @@ while(1) if (api) delete api; //api = new apiTest(serverhost, serverport, 60, CSASSIST_APIFLAG_ASSUME_RECONNECT); api = new apiTest(serverhost, serverport, 60, CSASSIST_APIFLAG_ASSUME_RECONNECT|CSASSIST_APIFLAG_NO_REDIRECT); - track = api->connectCSAssist(NULL, game.c_str(), server.c_str()); + track = api->connectCSAssist(nullptr, game.c_str(), server.c_str()); loginFailed = false; std::cout <<"Trying to connect..."<requestNewTicketActivity(NULL, testUID, 0); + track = api->requestNewTicketActivity(nullptr, testUID, 0); else - track = api->requestNewTicketActivity(NULL, testUID, character.c_str()); + track = api->requestNewTicketActivity(nullptr, testUID, character.c_str()); submitted++; break; case CSASSIST_CALL_REGISTERCHARACTER: uid = rand(); - track = api->requestRegisterCharacter(NULL, uid, 0, 0); + track = api->requestRegisterCharacter(nullptr, uid, 0, 0); register_list.push(uid); submitted++; break; case CSASSIST_CALL_GETISSUEHIERARCHY: lang = narrowToWide("en"); - track = api->requestGetIssueHierarchy(NULL, hierarchy.c_str(), lang.c_str()); + track = api->requestGetIssueHierarchy(nullptr, hierarchy.c_str(), lang.c_str()); submitted++; break; case CSASSIST_CALL_CREATETICKET: @@ -597,33 +597,33 @@ while(1) case CSASSIST_CALL_APPENDCOMMENT: comment = narrowToWide("Unicode comment by player."); tid = randomTicketID(); - track = api->requestAppendTicketComment(NULL, tid, testUID, character.c_str(), comment.c_str()); + track = api->requestAppendTicketComment(nullptr, tid, testUID, character.c_str(), comment.c_str()); submitted++; break; case CSASSIST_CALL_GETTICKETBYID: tid = randomTicketID(); - track = api->requestGetTicketByID(NULL, tid, 1); + track = api->requestGetTicketByID(nullptr, tid, 1); submitted++; break; case CSASSIST_CALL_GETTICKETCOMMENTS: tid = randomTicketID(); - track = api->requestGetTicketComments(NULL, tid, 0, (rand() % 100)+1, CSASSIST_OFFSET_START); + track = api->requestGetTicketComments(nullptr, tid, 0, (rand() % 100)+1, CSASSIST_OFFSET_START); submitted++; break; case CSASSIST_CALL_GETTICKET: - track = api->requestGetTicketByCharacter(NULL, testUID, character.c_str(), 0, (rand() % 100)+1, 1); + track = api->requestGetTicketByCharacter(nullptr, testUID, character.c_str(), 0, (rand() % 100)+1, 1); submitted++; break; case CSASSIST_CALL_MARKREAD: tid = randomTicketID(); - track = api->requestMarkTicketRead(NULL, tid); + track = api->requestMarkTicketRead(nullptr, tid); submitted++; break; case CSASSIST_CALL_CANCELTICKET: if (firstTicketID != 0) { comment = narrowToWide("Ticket closed by player"); - track = api->requestCancelTicket(NULL, firstTicketID, testUID, comment.c_str()); + track = api->requestCancelTicket(nullptr, firstTicketID, testUID, comment.c_str()); if (++firstTicketID > lastTicketID) { firstTicketID = 0; @@ -634,33 +634,33 @@ while(1) break; case CSASSIST_CALL_COMMENTCOUNT: tid = randomTicketID(); - track = api->requestGetTicketCommentsCount(NULL, tid); + track = api->requestGetTicketCommentsCount(nullptr, tid); submitted++; break; case CSASSIST_CALL_GETDOCUMENTLIST: // lang = narrowToWide("en"); -// track = api->requestGetDocumentList(NULL, hierarchy.c_str(), lang.c_str()); +// track = api->requestGetDocumentList(nullptr, hierarchy.c_str(), lang.c_str()); // submitted++; break; case CSASSIST_CALL_GETDOCUMENT: -// track = api->requestGetDocument(NULL, 1); +// track = api->requestGetDocument(nullptr, 1); // submitted++; break; case CSASSIST_CALL_GETTICKETXMLBLOCK: tid = randomTicketID(); - track = api->requestGetTicketXMLBlock(NULL, tid); + track = api->requestGetTicketXMLBlock(nullptr, tid); submitted++; break; case CSASSIST_CALL_GETKBARTICLE: /*id = narrowToWide("soe1401"); lang = narrowToWide("en"); - track = api->requestGetKBArticle(NULL, id.c_str(), lang.c_str()); + track = api->requestGetKBArticle(nullptr, id.c_str(), lang.c_str()); submitted++; */break; case CSASSIST_CALL_SEARCHKB: /*Plat_Unicode::String searchStr = narrowToWide("video drivers"); lang = narrowToWide("en"); - track = api->requestSearchKB(NULL, searchStr.c_str(), lang.c_str()); + track = api->requestSearchKB(nullptr, searchStr.c_str(), lang.c_str()); submitted++; */break; } @@ -692,7 +692,7 @@ while(1) { uid = register_list.front(); register_list.pop(); - api->requestUnRegisterCharacter(NULL, uid, 0); + api->requestUnRegisterCharacter(nullptr, uid, 0); submitted++; } cout<<"Waiting for unregisters..."<disconnectCSAssist(NULL); + api->disconnectCSAssist(nullptr); submitted++; while (submitted > received) @@ -718,7 +718,7 @@ while(1) cout<<"Going to delete API now."<::iterator iter = servers.begin(); iter != servers.end(); iter++) { @@ -147,7 +147,7 @@ CSAssistGameAPIcore::CSAssistGameAPIcore(CSAssistGameAPI *api, const char *serve memset(host, 0, size); sprintf(host, "%s", strtok(p, ":")); int res(1); - char *pc = strtok(NULL, ":"); + char *pc = strtok(nullptr, ":"); if (pc) { port = atoi(pc);res++; } //if (res == 2) { @@ -212,7 +212,7 @@ CSAssistGameAPIcore::~CSAssistGameAPIcore() m_connection->Disconnect(false); #endif m_connection->Release(); - m_connection = NULL; + m_connection = nullptr; } m_conManager->Release(); delete m_receiver; @@ -298,13 +298,13 @@ void CSAssistGameAPIcore::SubmitRequest(Request *req, Response *res) { if (req->getType() != CSASSIST_CALL_CONNECTLB) { - m_timeout.push(new timeout(res->getTrack(), time(NULL) + m_userTimeout)); - req->setTimeout(time(NULL) + m_userTimeout); + m_timeout.push(new timeout(res->getTrack(), time(nullptr) + m_userTimeout)); + req->setTimeout(time(nullptr) + m_userTimeout); } else { - m_timeout.push(new timeout(res->getTrack(), time(NULL) + CONNECTLB_TIMEOUT)); - req->setTimeout(time(NULL) + CONNECTLB_TIMEOUT); + m_timeout.push(new timeout(res->getTrack(), time(nullptr) + CONNECTLB_TIMEOUT)); + req->setTimeout(time(nullptr) + CONNECTLB_TIMEOUT); } m_outQueue.push(req); m_pending.insert(pair(res->getTrack(), res)); @@ -316,13 +316,13 @@ void CSAssistGameAPIcore::SubmitRequestInt(Request *req, Response *res) { if (req->getType() != CSASSIST_CALL_CONNECTLB) { - m_timeoutInt.push(new timeout(res->getTrack(), time(NULL) + m_userTimeout)); - req->setTimeout(time(NULL) + m_userTimeout); + m_timeoutInt.push(new timeout(res->getTrack(), time(nullptr) + m_userTimeout)); + req->setTimeout(time(nullptr) + m_userTimeout); } else { - m_timeoutInt.push(new timeout(res->getTrack(), time(NULL) + CONNECTLB_TIMEOUT)); - req->setTimeout(time(NULL) + CONNECTLB_TIMEOUT); + m_timeoutInt.push(new timeout(res->getTrack(), time(nullptr) + CONNECTLB_TIMEOUT)); + req->setTimeout(time(nullptr) + CONNECTLB_TIMEOUT); } m_outQueueInt.push(req); m_pendingInt.insert(pair(res->getTrack(), res)); @@ -390,14 +390,14 @@ void CSAssistGameAPIcore::CSAssistGameCallback(Response *response) if (!m_receiver->m_firstConnection) m_api->OnConnectCSAssist(track, result, userData); // normal application layer connect else - m_api->OnConnectCSAssist(0, result, NULL); // internal re-connect + m_api->OnConnectCSAssist(0, result, nullptr); // internal re-connect m_receiver->m_firstConnection = true; } else { if (m_receiver->m_firstConnection) - m_api->OnConnectRejectedCSAssist(0, result, NULL); + m_api->OnConnectRejectedCSAssist(0, result, nullptr); else m_api->OnConnectRejectedCSAssist(track, result, userData); @@ -413,7 +413,7 @@ void CSAssistGameAPIcore::CSAssistGameCallback(Response *response) m_connection->Disconnect(false); #endif m_connection->Release(); - m_connection = NULL; + m_connection = nullptr; } GetLBHost(); m_receiver->m_firstConnection = true; @@ -436,7 +436,7 @@ void CSAssistGameAPIcore::CSAssistGameCallback(Response *response) m_connection->Disconnect(false); #endif m_connection->Release(); - m_connection = NULL; + m_connection = nullptr; } m_api->OnDisconnectCSAssist(track, result, userData); } @@ -624,7 +624,7 @@ Response * CSAssistGameAPIcore::getPending(CSAssistGameAPITrack track) map::iterator iter; iter = m_pending.find(track); if (iter == m_pending.end()) - return NULL; + return nullptr; return (*iter).second; } @@ -635,7 +635,7 @@ Response * CSAssistGameAPIcore::getPendingInt(CSAssistGameAPITrack track) map::iterator iter; iter = m_pendingInt.find(track); if (iter == m_pendingInt.end()) - return NULL; + return nullptr; return (*iter).second; } @@ -681,22 +681,22 @@ void CSAssistGameAPIcore::Update() // ----- Process timeout queue, send timeout messages when appropriate ----- - while((m_timeout.size() > 0) && ((t = m_timeout.front())->time <= time(NULL))) + while((m_timeout.size() > 0) && ((t = m_timeout.front())->time <= time(nullptr))) { Response *Res = getPending(t->track); //fprintf(stderr, "processing timeouts: track(%u) response(%p)\n", t->track, Res); - if(Res != NULL) + if(Res != nullptr) { CSAssistGameCallback(Res); } m_timeout.pop(); delete t; } - while((m_timeoutInt.size() > 0) && ((t = m_timeoutInt.front())->time <= time(NULL))) + while((m_timeoutInt.size() > 0) && ((t = m_timeoutInt.front())->time <= time(nullptr))) { Response *Res = getPendingInt(t->track); //fprintf(stderr, "processing internal timeouts: track(%u) response(%p)\n", t->track, Res); - if(Res != NULL) + if(Res != nullptr) { CSAssistGameCallback(Res); } @@ -705,14 +705,14 @@ void CSAssistGameAPIcore::Update() } // ----- process timeouts for requests ----- - while ((m_outQueue.size() > 0) && (m_outQueue.front()->getTimeout() <= (unsigned)time(NULL))) + while ((m_outQueue.size() > 0) && (m_outQueue.front()->getTimeout() <= (unsigned)time(nullptr))) { Request *R = m_outQueue.front(); //fprintf(stderr, "processing request timeouts: track(%u) request(%u)\n", R->getTrack(), R->getType()); m_outQueue.pop(); delete R; } - while ((m_outQueueInt.size() > 0) && (m_outQueueInt.front()->getTimeout() <= (unsigned)time(NULL))) + while ((m_outQueueInt.size() > 0) && (m_outQueueInt.front()->getTimeout() <= (unsigned)time(nullptr))) { Request *R = m_outQueueInt.front(); //fprintf(stderr, "processing internal request timeouts: track(%u) request(%u)\n", R->getTrack(), R->getType()); @@ -724,18 +724,18 @@ void CSAssistGameAPIcore::Update() { // API does not have a connection, begin connection handshake process //fprintf(stderr, "Going to connect to %s:%d\n", m_ip.c_str(), m_port); - m_reconnectTimeout = time(NULL) + 5; + m_reconnectTimeout = time(nullptr) + 5; m_connection = m_conManager->EstablishConnection(m_ip.c_str(), m_port); // set connected host/port before changing with GetLBHost. m_connectedIP = m_ip.c_str(); m_connectedPort = m_port; - if (m_connection != NULL) + if (m_connection != nullptr) m_connection->SetHandler(m_receiver); else { - m_api->OnConnectRejectedCSAssist(0, CSASSIST_RESULT_FAIL, NULL); + m_api->OnConnectRejectedCSAssist(0, CSASSIST_RESULT_FAIL, nullptr); // Connection failed. Try getting a new host. GetLBHost(); } @@ -777,7 +777,7 @@ void CSAssistGameAPIcore::Update() else { //fprintf(stderr,"Update(1): timing out response(%p) for track(%u)\n", Res, t->track); - if(Res != NULL) + if(Res != nullptr) { CSAssistGameCallback(Res); } @@ -795,18 +795,18 @@ void CSAssistGameAPIcore::Update() //fprintf(stderr, "Update(2) enter\n"); #ifdef USE_UDP_LIBRARY if((m_connection->GetStatus() == UdpConnection::cStatusDisconnected) || - (m_connection->GetStatus() == UdpConnection::cStatusNegotiating && m_reconnectTimeout < time(NULL))) + (m_connection->GetStatus() == UdpConnection::cStatusNegotiating && m_reconnectTimeout < time(nullptr))) { m_connection->Disconnect(); #else if((m_connection->GetStatus() == TcpConnection::StatusDisconnected) || - (m_connection->GetStatus() == TcpConnection::StatusNegotiating && m_reconnectTimeout < time(NULL))) + (m_connection->GetStatus() == TcpConnection::StatusNegotiating && m_reconnectTimeout < time(nullptr))) { m_connection->Disconnect(false); #endif m_connection->Release(); - m_connection = NULL; + m_connection = nullptr; //fprintf(stderr, "Update(2): Disconnected!! m_connectState=%u\n", m_connectState); switch(m_connectState) @@ -835,7 +835,7 @@ void CSAssistGameAPIcore::Update() //if (t-> Response *Res = getPendingInt(t->track); //fprintf(stderr, "Update(2) timing out connect: track(%u) response(%p)\n", t->track, Res); - if(Res != NULL) + if(Res != nullptr) { Res->setResult(CSASSIST_RESULT_FAIL); CSAssistGameCallback(Res); @@ -964,7 +964,7 @@ void CSAssistGameAPIcore::Update() Response *CSAssistGameAPIcore::createServerResponse(short msgtype) //------------------------------------------------------------- { - Response *res = NULL; + Response *res = nullptr; switch (msgtype) { diff --git a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistgameapicore.h b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistgameapicore.h index 0f642423..d7dc8ac4 100755 --- a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistgameapicore.h +++ b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistgameapicore.h @@ -166,11 +166,11 @@ private: void GetLBHost(); void OnConnectLB(unsigned track, unsigned result, std::string serverName, unsigned serverPort, Request *, Response *); #ifdef USE_UDP_LIBRARY - inline bool actuallyConnected() { return (bool)((m_connection != NULL) && (m_connection->GetStatus() == UdpConnection::cStatusConnected)); } + inline bool actuallyConnected() { return (bool)((m_connection != nullptr) && (m_connection->GetStatus() == UdpConnection::cStatusConnected)); } UdpManager *m_conManager; UdpConnection *m_connection; #else - inline bool actuallyConnected() { return (bool)((m_connection != NULL) && (m_connection->GetStatus() == TcpConnection::StatusConnected)); } + inline bool actuallyConnected() { return (bool)((m_connection != nullptr) && (m_connection->GetStatus() == TcpConnection::StatusConnected)); } TcpManager *m_conManager; TcpConnection *m_connection; #endif diff --git a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistreceiver.cpp b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistreceiver.cpp index 5aa9430b..a1b03cf9 100755 --- a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistreceiver.cpp +++ b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistreceiver.cpp @@ -99,7 +99,7 @@ void CSAssistReceiver::OnTerminated(TcpConnection *con) break; case CONNECT_BACKEND_CONNECTED_AND_AUTHED: - m_api->m_api->OnDisconnectCSAssist(0, CSASSIST_RESULT_SERVER_DISCONNECT, NULL); + m_api->m_api->OnDisconnectCSAssist(0, CSASSIST_RESULT_SERVER_DISCONNECT, nullptr); case CONNECT_BACKEND_CONNECTED: m_api->GetLBHost(); case CONNECT_BACKEND_NEGOTIATING: m_api->m_connectState = CONNECT_BACKEND_DISCONNECTED; break; @@ -110,7 +110,7 @@ void CSAssistReceiver::OnTerminated(TcpConnection *con) else { if (m_api->m_connectState == CONNECT_BACKEND_CONNECTED_AND_AUTHED) - m_api->m_api->OnDisconnectCSAssist(0, CSASSIST_RESULT_SERVER_DISCONNECT, NULL); + m_api->m_api->OnDisconnectCSAssist(0, CSASSIST_RESULT_SERVER_DISCONNECT, nullptr); m_api->m_connectState = CONNECT_BACKEND_DISCONNECTED; m_api->GetLBHost(); } @@ -156,7 +156,7 @@ void CSAssistReceiver::OnRoutePacket(TcpConnection *con, const uchar *data, int { res = m_api->getPending(track); } - if(res != NULL) + if(res != nullptr) { res->init(type, track, result); res->decode(iter); diff --git a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssisttest/test.cpp b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssisttest/test.cpp index c172511e..efbc0db4 100755 --- a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssisttest/test.cpp +++ b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssisttest/test.cpp @@ -40,7 +40,7 @@ Plat_Unicode::String globalArticleID; //---------------------------------------------- CSAssistUnicodeChar *get_c_str(Plat_Unicode::String s) // This replaces c_str() by allocating a new buffer, erasing it, and then -// using the non-null terminated data() to copy the data into the buffer. +// using the non-nullptr terminated data() to copy the data into the buffer. //---------------------------------------------- { unsigned length = s.size() + 1; @@ -94,7 +94,7 @@ void DisplayTicket(const CSAssistGameAPITicket *t) std::cout << wideToNarrow(details) << "\n***\n"; } else - std::cout << "***Ticket IS NULL! ***\n"; + std::cout << "***Ticket IS nullptr! ***\n"; } //--------------------------------------------- @@ -110,7 +110,7 @@ void DisplayComment(const CSAssistGameAPITicketComment *t) std::cout << "\n " << wideToNarrow(comment) << "\n"; } else - std::cout << "***Comment IS NULL! ***\n"; + std::cout << "***Comment IS nullptr! ***\n"; } //--------------------------------------------- @@ -132,7 +132,7 @@ void DisplayDocumentHeader(const CSAssistGameAPIDocumentHeader *doc) std::cout << ", Modified: " << date2 << "\n"; } else - std::cout << "***Document Header IS NULL! ***\n"; + std::cout << "***Document Header IS nullptr! ***\n"; } //--------------------------------------------- @@ -148,7 +148,7 @@ void DisplaySearchResult(const CSAssistGameAPISearchResult *doc) std::cout << ", Title: " << wideToNarrow(title) << "\n"; } else - std::cout << "***Search Result IS NULL! ***\n"; + std::cout << "***Search Result IS nullptr! ***\n"; } @@ -360,7 +360,7 @@ void apiTest::OnRequestGameLocation(const CSAssistGameAPITrack sourceTrack, cons CSAssistUnicodeChar *rawLoc = get_c_str(loc); std::cout << "Request Game Location: Source Track(" << sourceTrack << "), uid(" << uid << "), character("; std::cout << wideToNarrow(charry) << "), CSR UID(" << CSRUID << ")\n"; - api->replyGameLocation(NULL, sourceTrack, uid, rawCharry, CSRUID, rawLoc); + api->replyGameLocation(nullptr, sourceTrack, uid, rawCharry, CSRUID, rawLoc); delete [] rawCharry; delete [] rawLoc; } diff --git a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/packdata.cpp b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/packdata.cpp index 4c267fd4..9a8ef45e 100755 --- a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/packdata.cpp +++ b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/packdata.cpp @@ -30,7 +30,7 @@ using namespace Plat_Unicode; //---------------------------------------------- CSAssistUnicodeChar *get_c_str(Plat_Unicode::String s) // This replaces c_str() by allocating a new buffer, erasing it, and then -// using the non-null terminated data() to copy the data into the buffer. +// using the non-nullptr terminated data() to copy the data into the buffer. //---------------------------------------------- { unsigned length = s.size() + 1; diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/Archive.cpp b/external/3rd/library/soePlatform/CSAssist/utils/Base/Archive.cpp index 1afab822..d55481a4 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/Archive.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/Archive.cpp @@ -94,7 +94,7 @@ namespace Base ByteStream::ByteStream() : allocatedSize(0), beginReadIterator(), - data(NULL), + data(nullptr), size(0), lastPutSize(0) { @@ -211,7 +211,7 @@ namespace Base if(data->size < allocatedSize) { unsigned char * tmp = new unsigned char[newSize]; - if(data->buffer != NULL) + if(data->buffer != nullptr) memcpy(tmp, data->buffer, size); delete[] data->buffer; data->buffer = tmp; diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/AutoLog.cpp b/external/3rd/library/soePlatform/CSAssist/utils/Base/AutoLog.cpp index 687381ed..4a8dc976 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/AutoLog.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/AutoLog.cpp @@ -35,7 +35,7 @@ bool CAutoLog::Open(const char * filename) //------------------------------------- { - if( NULL == filename) + if( nullptr == filename) return false; if (pFilename) @@ -45,13 +45,13 @@ bool CAutoLog::Open(const char * filename) // Sanitize slashes char *ptr; - while ((ptr = strchr(pFilename,WRONGSLASH)) != NULL) + while ((ptr = strchr(pFilename,WRONGSLASH)) != nullptr) *ptr = SLASHCHAR[0]; char strPath[1024]; strcpy(strPath,pFilename); ptr = strrchr(strPath, SLASHCHAR[0]); - if (ptr != NULL) + if (ptr != nullptr) { *ptr = 0; @@ -59,11 +59,11 @@ bool CAutoLog::Open(const char * filename) char curdir[128]; // remember current directory - if( getcwd(curdir,sizeof(curdir)) == NULL ) + if( getcwd(curdir,sizeof(curdir)) == nullptr ) { fprintf(stderr,"CAutoLog::Archive failed to get current directory!\n"); free(pFilename); - pFilename = NULL; + pFilename = nullptr; return false; // error, can't proceed } @@ -74,7 +74,7 @@ bool CAutoLog::Open(const char * filename) { fprintf(stderr,"CAutoLog::Archive failed to make directory: %s\n", strPath); free(pFilename); - pFilename = NULL; + pFilename = nullptr; return false; // error, can't proceed } } @@ -94,7 +94,7 @@ bool CAutoLog::Open(const char * filename) { fprintf(stderr,"CAutoLog::Archive failed to make directory: %s\n", strPath); free(pFilename); - pFilename = NULL; + pFilename = nullptr; return false; // error, can't proceed } } @@ -103,7 +103,7 @@ bool CAutoLog::Open(const char * filename) pFile = fopen(pFilename,"a+"); - if( pFile == NULL || pFile == (FILE *)-1) + if( pFile == nullptr || pFile == (FILE *)-1) { //fprintf(stderr,"CAutoLog::Open failed to open log file: %s\n",pFilename); Close(); @@ -123,7 +123,7 @@ bool CAutoLog::Open(const char * filename) void CAutoLog::Close(void) //------------------------------------- { - if( pFile != (FILE *)-1 && pFile != NULL) + if( pFile != (FILE *)-1 && pFile != nullptr) { fclose(pFile); } @@ -131,7 +131,7 @@ void CAutoLog::Close(void) free(pFilename); - pFilename = NULL; + pFilename = nullptr; } //------------------------------------- @@ -194,7 +194,7 @@ void CAutoLog::LogDebug(char * format, ...) void CAutoLog::Log(eLogLevel severity, char *fmt, ...) //------------------------------------- { - if (pFile == (FILE *)-1 || pFile == NULL) + if (pFile == (FILE *)-1 || pFile == nullptr) { //fprintf(stderr,"CAutoLog::Log called with no file open!\n"); return; @@ -250,7 +250,7 @@ void CAutoLog::Log(eLogLevel severity, char *fmt, ...) void CAutoLog::Archive(void) //------------------------------------- { - if( pFile == (FILE *)-1 || pFile == NULL) + if( pFile == (FILE *)-1 || pFile == nullptr) { //fprintf(stderr,"CAutoLog::Archive called with no file open!\n"); return; @@ -281,7 +281,7 @@ void CAutoLog::Archive(void) strcpy(strCurrent,pFilename); pCurrent = strrchr(strCurrent, SLASHCHAR[0]); - if (pCurrent != NULL) + if (pCurrent != nullptr) *pCurrent = 0; else sprintf(strCurrent,"."); @@ -290,7 +290,7 @@ void CAutoLog::Archive(void) #ifdef WIN32 // remember current directory - if( getcwd(curdir,sizeof(curdir)) == NULL ) + if( getcwd(curdir,sizeof(curdir)) == nullptr ) { fprintf(stderr,"CAutoLog::Archive failed to get current directory!\n"); return; // error, can't proceed @@ -324,7 +324,7 @@ void CAutoLog::Archive(void) #endif pCurrent = strrchr(pFilename, SLASHCHAR[0]); - if (pCurrent == NULL) + if (pCurrent == nullptr) pCurrent = pFilename; else pCurrent++; diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/AutoLog.h b/external/3rd/library/soePlatform/CSAssist/utils/Base/AutoLog.h index 0a90a774..18871c7f 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/AutoLog.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/AutoLog.h @@ -92,14 +92,14 @@ namespace Base //------------------------------------- inline CAutoLog::CAutoLog() { - pFilename = NULL; + pFilename = nullptr; pFile = (FILE *)-1; } //------------------------------------- inline CAutoLog::CAutoLog(const char * file) { - pFilename = NULL; + pFilename = nullptr; pFile = (FILE *)-1; Open(file); } diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/Config.cpp b/external/3rd/library/soePlatform/CSAssist/utils/Base/Config.cpp index a5b977fb..97abcd41 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/Config.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/Config.cpp @@ -28,7 +28,7 @@ bool CConfig::LoadFile(char * file) // open file fp = fopen(file, "r"); - if (fp == NULL || fp == (FILE *)-1) + if (fp == nullptr || fp == (FILE *)-1) { //fprintf(stderr,"Failed to open config file %s!",file); return false; @@ -72,21 +72,21 @@ void CConfig::UnloadFile(void) //----------------------------------- { delete[] pConfig; - pConfig = NULL; + pConfig = nullptr; } //----------------------------------- /// finds a key of the config in memory // key argument is case-insensitive, but must be upper case in config file -// Returns true for success (passing NULL is a special case returned as success) +// Returns true for success (passing nullptr is a special case returned as success) bool CConfig::FindKey(char *key) //----------------------------------- { - if (pConfig == NULL) + if (pConfig == nullptr) return false; // special case...continue with existing key - if (key == NULL) + if (key == nullptr) return true; // form the search key @@ -97,12 +97,12 @@ bool CConfig::FindKey(char *key) // find the key heading pCursor = strstr(pConfig,strBuffer); - if (pCursor==NULL) + if (pCursor==nullptr) return false; // find the closing bracket of key heading pCursor = strchr(pCursor,']'); - if (pCursor==NULL) + if (pCursor==nullptr) return false; pCursor++; @@ -111,7 +111,7 @@ bool CConfig::FindKey(char *key) //----------------------------------- /// extract a number from the config string -// pass the key to find the first number in the list, else NULL to find the next number in the list +// pass the key to find the first number in the list, else nullptr to find the next number in the list // returns 0 if no number is found, else returns the number long CConfig::GetLong(char *key) //----------------------------------- @@ -134,20 +134,20 @@ long CConfig::GetLong(char *key) //----------------------------------- /// extract string (in double-quotes) from the list. -// pass the key to find the first string in the list, else NULL to find the next string in the list -// returns NULL if no string found, else returns a temporary copy of the string (without quotes) +// pass the key to find the first string in the list, else nullptr to find the next string in the list +// returns nullptr if no string found, else returns a temporary copy of the string (without quotes) char * CConfig::GetString(char *key) //----------------------------------- { if (!FindKey(key)) - return NULL; + return nullptr; // look for start of string or end of key while (*pCursor && *pCursor != '"' && *pCursor != '[') pCursor++; if (*(pCursor++) != '"') - return NULL; + return nullptr; // until closing quote int c = 0; @@ -161,7 +161,7 @@ char * CConfig::GetString(char *key) } } - return NULL; + return nullptr; } diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/Config.h b/external/3rd/library/soePlatform/CSAssist/utils/Base/Config.h index 864506f3..6f6dc376 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/Config.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/Config.h @@ -10,7 +10,7 @@ ; list of strings, with code example # config.FindKey("NUMBERS"); -# while (number = config.GetLong(NULL)) +# while (number = config.GetLong(nullptr)) # YourHandleNumber(number); [NUMBERS] 100 200, 300 ; formatting is very flexible as long as numbers are delimited by non-numbers @@ -23,7 +23,7 @@ ; list of strings, with code example # config.FindKey("HOSTS"); -# while (string = config.GetString(NULL)) +# while (string = config.GetString(nullptr)) # YourHandleString(string); [HOSTS] "127.0.0.1:5999" @@ -68,16 +68,16 @@ namespace Base // returns TRUE if key is found. bool FindKey(char *key); - // extract string from config. If key is NULL, extract next string in list, else extract first string. - // if key was not found, returns NULL - char * GetString(char *key = NULL); + // extract string from config. If key is nullptr, extract next string in list, else extract first string. + // if key was not found, returns nullptr + char * GetString(char *key = nullptr); - // extract number from config. If key is NULL, extract next number in list, else extract first number. + // extract number from config. If key is nullptr, extract next number in list, else extract first number. // if key was not found, returns 0 - long GetLong(char *key = NULL); // extract number from config. + long GetLong(char *key = nullptr); // extract number from config. // indicate if config file has been loaded - inline bool FileLoaded() { return pConfig == NULL ? false : true; } + inline bool FileLoaded() { return pConfig == nullptr ? false : true; } private: char * pConfig; // pointer to file memory @@ -87,14 +87,14 @@ namespace Base inline CConfig::CConfig() { - pConfig = NULL; - pCursor = NULL; + pConfig = nullptr; + pCursor = nullptr; } inline CConfig::CConfig(char * file) { - pConfig = NULL; - pCursor = NULL; + pConfig = nullptr; + pCursor = nullptr; LoadFile(file); } diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/Logger.cpp b/external/3rd/library/soePlatform/CSAssist/utils/Base/Logger.cpp index 1ce102af..bf3dcc39 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/Logger.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/Logger.cpp @@ -98,7 +98,7 @@ Logger::Logger(const char *programName, void Logger::LoggerInit(const char *programName) { char buf[1024]; - FILE *logDir = NULL; + FILE *logDir = nullptr; if (0 != (m_logType & eUseLocalFile)) { @@ -107,13 +107,13 @@ void Logger::LoggerInit(const char *programName) { cmkdir(m_dirPrefix.c_str(), 0755); } - else if(logDir != NULL) + else if(logDir != nullptr) { fclose(logDir); } tm now; - time_t t = time(NULL); + time_t t = time(nullptr); LOGGER_GET_CURR_TIME(now, t); @@ -131,7 +131,7 @@ void Logger::LoggerInit(const char *programName) { cmkdir(buf, 0755); } - else if(logDir != NULL) + else if(logDir != nullptr) { fclose(logDir); } @@ -300,7 +300,7 @@ void Logger::logSimple(unsigned logenum, int level, const char *message) { return; } - time_t t = time(NULL); + time_t t = time(nullptr); LogInfo *info = (*iter).second; if(level >= info->level) { @@ -377,7 +377,7 @@ void Logger::logSimpleWithSys(unsigned logenum, unsigned priority, int level, co { return; } - time_t t = time(NULL); + time_t t = time(nullptr); LogInfo *info = (*iter).second; if(level >= info->level) @@ -447,7 +447,7 @@ void Logger::log(unsigned logenum, int level, const char *message, ...) // ensure that the buf does not contain any '%' characters. // prevent crash problem char *rv; - while((rv = strchr(buf, '%')) != NULL) + while((rv = strchr(buf, '%')) != nullptr) { *rv = ' '; // replace with space } @@ -478,7 +478,7 @@ void Logger::logWithSys(unsigned logenum, unsigned priority, int level, const ch { return; } - time_t t = time(NULL); + time_t t = time(nullptr); LogInfo *info = (*iter).second; if(level >= info->level) @@ -536,14 +536,14 @@ void Logger::logWithSys(unsigned logenum, unsigned priority, int level, const ch void Logger::rollDate(time_t t) { char buf[80]; - FILE *logDir = NULL; + FILE *logDir = nullptr; logDir = fopen(m_dirPrefix.c_str(), "r+"); if(errno == ENOENT) { cmkdir(m_dirPrefix.c_str(), 0755); } - else if(logDir != NULL) + else if(logDir != nullptr) { fclose(logDir); } @@ -559,7 +559,7 @@ void Logger::rollDate(time_t t) { cmkdir(buf, 0755); } - else if(logDir != NULL) + else if(logDir != nullptr) { fclose(logDir); } @@ -643,7 +643,7 @@ void Logger::rollLog(LogInfo *logInfo) { std::string newLogName; char timeStampBuffer[256]; - time_t t = time(NULL); + time_t t = time(nullptr); tm now; int r; int nTries = 10; diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/Statistics.h b/external/3rd/library/soePlatform/CSAssist/utils/Base/Statistics.h index 18e0579e..0856034b 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/Statistics.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/Statistics.h @@ -34,9 +34,9 @@ namespace Base bool commit = false; if (!mLastSampleTime) - mLastSampleTime = time(NULL); + mLastSampleTime = time(nullptr); - if (!mSampleFrequency || mLastSampleTime + mSampleFrequency < (unsigned)time(NULL)) + if (!mSampleFrequency || mLastSampleTime + mSampleFrequency < (unsigned)time(nullptr)) { mSampleTotal++; mAggregateTotal += value; diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/TemplateObjectAllocator.h b/external/3rd/library/soePlatform/CSAssist/utils/Base/TemplateObjectAllocator.h index 40227673..ed1a7937 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/TemplateObjectAllocator.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/TemplateObjectAllocator.h @@ -93,7 +93,7 @@ namespace Base void Destroy(TYPE *object) { - if (object == NULL) + if (object == nullptr) return; #ifdef USE_ALLOCATOR_MUTEX @@ -142,7 +142,7 @@ namespace Base void FastDestroy(TYPE *object) { - if (object == NULL) + if (object == nullptr) return; object->~TYPE(); diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/WideString.h b/external/3rd/library/soePlatform/CSAssist/utils/Base/WideString.h index 775f9713..28159b18 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/WideString.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/WideString.h @@ -94,12 +94,12 @@ namespace ucs2 } //////////////////////////////////////// - // target string is a null-terminated C string + // target string is a nullptr-terminated C string inline string::string(const char * copy) : mLength(0), mData(8,0) { - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!copy) { return; @@ -111,12 +111,12 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *copy++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; } //////////////////////////////////////// - // target string is a C string that may or may not include null characters + // target string is a C string that may or may not include nullptr characters inline string::string(const std::string & copy) : mLength(copy.length()), mData(8,0) @@ -126,17 +126,17 @@ namespace ucs2 // (2) perform transform to copy the narrow string to our // wide string std::transform(copy.begin(), copy.end(), mData.begin(), NarrowToWide); - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength] = 0; } //////////////////////////////////////// - // target string is a wide null-terminated C string + // target string is a wide nullptr-terminated C string inline string::string(const char_type * copy) : mLength(0), mData(8,0) { - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!copy) { return; @@ -148,7 +148,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *copy++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; } @@ -169,7 +169,7 @@ namespace ucs2 inline string & string::operator=(const char * rhs) { mLength = 0; - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!rhs) { mData[0] = 0; @@ -182,7 +182,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } @@ -195,7 +195,7 @@ namespace ucs2 // (2) perform transform to copy the narrow string to our // wide string std::transform(rhs.begin(), rhs.end(), mData.begin(), NarrowToWide); - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength] = 0; return *this; } @@ -203,7 +203,7 @@ namespace ucs2 inline string & string::operator=(const char_type * rhs) { mLength = 0; - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!rhs) { mData[0] = 0; @@ -216,7 +216,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } @@ -235,7 +235,7 @@ namespace ucs2 inline string & string::operator+=(const char * rhs) { - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!rhs) { return *this; @@ -247,7 +247,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } @@ -259,7 +259,7 @@ namespace ucs2 // (2) perform transform to copy the narrow string to our // wide string std::transform(rhs.begin(), rhs.end(), mData.begin()+mLength, NarrowToWide); - // (3) ensure null termination + // (3) ensure nullptr termination mLength += rhs.length(); mData[mLength] = 0; return *this; @@ -267,7 +267,7 @@ namespace ucs2 inline string & string::operator+=(const char_type * rhs) { - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!rhs) { return *this; @@ -279,7 +279,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } @@ -388,7 +388,7 @@ namespace ucs2 inline string & string::assign(const char_type * rhs) { mLength = 0; - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!rhs) { mData[0] = 0; @@ -401,7 +401,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } @@ -409,7 +409,7 @@ namespace ucs2 inline string & string::assign(const char_type * rhs, size_type count) { mLength = 0; - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!rhs) { mData[0] = 0; @@ -422,7 +422,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } @@ -463,7 +463,7 @@ namespace ucs2 inline string & string::assign(const char_type * first, const char_type * last) { mLength = 0; - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!first || !last) { mData[0] = 0; @@ -476,14 +476,14 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *first++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } inline string & string::append(const char_type * rhs) { - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!rhs) { return *this; @@ -495,14 +495,14 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } inline string & string::append(const char_type * rhs, size_type count) { - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!rhs) { return *this; @@ -514,7 +514,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } @@ -558,7 +558,7 @@ namespace ucs2 inline string & string::append(const char_type * first, const char_type * last) { - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!first || !last) { return *this; @@ -570,7 +570,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *first++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/BlockAllocator.cpp b/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/BlockAllocator.cpp index 4cefb9e7..29d91074 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/BlockAllocator.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/BlockAllocator.cpp @@ -12,7 +12,7 @@ namespace Base { for(unsigned i = 0; i < 31; i++) { - m_blocks[i] = NULL; + m_blocks[i] = nullptr; } } @@ -21,7 +21,7 @@ namespace Base // free all allocated memory blocks for(unsigned i = 0; i < 31; i++) { - while(m_blocks[i] != NULL) + while(m_blocks[i] != nullptr) { unsigned *tmp = m_blocks[i]; m_blocks[i] = (unsigned *)*m_blocks[i]; @@ -36,7 +36,7 @@ namespace Base void *BlockAllocator::getBlock(unsigned bytes) { unsigned accum = 16, bits = 16; - unsigned *handle = NULL; + unsigned *handle = nullptr; // Perform a binary search looking for the highest bit. @@ -96,7 +96,7 @@ namespace Base void BlockAllocator::returnBlock(unsigned *handle) { - // C++ allows for safe deletion of a NULL pointer + // C++ allows for safe deletion of a nullptr pointer if(handle) { // Update the allocator linked list, insert this entry at the head diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/Event.cpp b/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/Event.cpp index a3cce3b1..72190595 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/Event.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/Event.cpp @@ -26,8 +26,8 @@ namespace Base mCond(), mThreadCount(0) { - pthread_mutex_init(&mMutex, NULL); - pthread_cond_init(&mCond, NULL); + pthread_mutex_init(&mMutex, nullptr); + pthread_cond_init(&mCond, nullptr); } CEvent::~CEvent() @@ -74,7 +74,7 @@ namespace Base struct timeval now; struct timespec abs_timeout; - gettimeofday(&now, NULL); + gettimeofday(&now, nullptr); abs_timeout.tv_sec = now.tv_sec + timeout/1000; abs_timeout.tv_nsec = now.tv_usec * 1000 + (timeout%1000)*1000000; abs_timeout.tv_sec += abs_timeout.tv_nsec / 1000000000; diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/Thread.cpp b/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/Thread.cpp index 2bc4f26b..5cca2017 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/Thread.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/Thread.cpp @@ -76,8 +76,8 @@ namespace Base CThreadPool::CMember::CMember(CThreadPool * parent) : mParent(parent), - mFunction(NULL), - mArgument(NULL), + mFunction(nullptr), + mArgument(nullptr), mSemaphore() { StartThread(); @@ -116,8 +116,8 @@ namespace Base if (mFunction) { mFunction(mArgument); - mArgument = NULL; - mFunction = NULL; + mArgument = nullptr; + mFunction = nullptr; } else if (mParent->OnDestory(this)) mThreadContinue = false; @@ -172,7 +172,7 @@ namespace Base } //////////////////////////////////////// - // (3) Delete the null member threads + // (3) Delete the nullptr member threads mMutex.Lock(); while (!mNullMember.empty()) { @@ -199,7 +199,7 @@ namespace Base } //////////////////////////////////////// - // (2) Delete any null member threads. + // (2) Delete any nullptr member threads. while (!mNullMember.empty()) { delete mNullMember.front(); diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/serialize.h b/external/3rd/library/soePlatform/CSAssist/utils/Base/serialize.h index 650681b5..ed38802a 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/serialize.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/serialize.h @@ -501,8 +501,8 @@ namespace soe } else { - //find null terminator, if don't find it before maxLen, then err - const unsigned char *strEnd = NULL; + //find nullptr terminator, if don't find it before maxLen, then err + const unsigned char *strEnd = nullptr; unsigned strLen = 0; for (;strLenm_next; - tmp->m_next = NULL; + tmp->m_next = nullptr; m_numAvailBlocks--; return(tmp); } @@ -56,7 +56,7 @@ void TcpBlockAllocator::returnBlock(data_block *b) void TcpBlockAllocator::realloc() { - data_block *tmp = NULL, *cursor = NULL; + data_block *tmp = nullptr, *cursor = nullptr; tmp = new data_block; m_numAvailBlocks++; cursor = tmp; diff --git a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpConnection.cpp b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpConnection.cpp index 97ca7fd1..c74eaca4 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpConnection.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpConnection.cpp @@ -11,28 +11,28 @@ namespace NAMESPACE //used when want to open new connection with this socket TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, const IPAddress &destIP, short destPort, unsigned timeout) -: m_nextConnection(NULL), - m_prevConnection(NULL), +: m_nextConnection(nullptr), + m_prevConnection(nullptr), m_socket(INVALID_SOCKET), - m_nextKeepAliveConnection(NULL), - m_prevKeepAliveConnection(NULL), + m_nextKeepAliveConnection(nullptr), + m_prevKeepAliveConnection(nullptr), m_aliveListId(tcpManager->m_aliveList.m_listID), - m_nextRecvDataConnection(NULL), - m_prevRecvDataConnection(NULL), + m_nextRecvDataConnection(nullptr), + m_prevRecvDataConnection(nullptr), m_recvDataListId(tcpManager->m_dataList.m_listID), m_manager(tcpManager), m_status(StatusNegotiating), - m_handler(NULL), + m_handler(nullptr), m_destIP(destIP), m_destPort(destPort), m_refCount(0), m_sendAllocator(sendAlloc), - m_head(NULL), - m_tail(NULL), + m_head(nullptr), + m_tail(nullptr), m_bytesRead(0), m_bytesNeeded(0), m_params(params), - m_recvBuff(NULL), + m_recvBuff(nullptr), m_connectTimeout(timeout), m_connectTimer(), m_wasConRemovedFromMgr(false) @@ -94,28 +94,28 @@ TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAllo //used when server mode creates new connection object representing a connect request TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, SOCKET socket, const IPAddress &destIP, short destPort) -: m_nextConnection(NULL), - m_prevConnection(NULL), +: m_nextConnection(nullptr), + m_prevConnection(nullptr), m_socket(socket), - m_nextKeepAliveConnection(NULL), - m_prevKeepAliveConnection(NULL), + m_nextKeepAliveConnection(nullptr), + m_prevKeepAliveConnection(nullptr), m_aliveListId(tcpManager->m_aliveList.m_listID), - m_nextRecvDataConnection(NULL), - m_prevRecvDataConnection(NULL), + m_nextRecvDataConnection(nullptr), + m_prevRecvDataConnection(nullptr), m_recvDataListId(tcpManager->m_dataList.m_listID), m_manager(tcpManager), m_status(StatusConnected), - m_handler(NULL), + m_handler(nullptr), m_destIP(destIP), m_destPort(destPort), m_refCount(0), m_sendAllocator(sendAlloc), - m_head(NULL), - m_tail(NULL), + m_head(nullptr), + m_tail(nullptr), m_bytesRead(0), m_bytesNeeded(0), m_params(params), - m_recvBuff(NULL), + m_recvBuff(nullptr), m_connectTimeout(0), m_connectTimer(), m_wasConRemovedFromMgr(false) @@ -205,7 +205,7 @@ int TcpConnection::finishConnect() t.tv_sec = 0; t.tv_usec = 0; - int err = select(m_socket + 1, NULL, &wrSet, NULL, &t); + int err = select(m_socket + 1, nullptr, &wrSet, nullptr, &t); if (err == 0) { @@ -300,7 +300,7 @@ TcpConnection::~TcpConnection() { delete [] m_recvBuff; - while(m_head != NULL) + while(m_head != nullptr) { data_block *tmp = m_head; m_head = m_head->m_next; @@ -324,22 +324,22 @@ void TcpConnection::Send(const char *data, unsigned int dataLen) { m_aliveListId = m_manager->m_keepAliveList.m_listID; - if (m_prevKeepAliveConnection != NULL) + if (m_prevKeepAliveConnection != nullptr) m_prevKeepAliveConnection->m_nextKeepAliveConnection = m_nextKeepAliveConnection; - if (m_nextKeepAliveConnection != NULL) + if (m_nextKeepAliveConnection != nullptr) m_nextKeepAliveConnection->m_prevKeepAliveConnection = m_prevKeepAliveConnection; if (m_manager->m_keepAliveList.m_beginList == this) m_manager->m_keepAliveList.m_beginList = m_nextKeepAliveConnection; m_nextKeepAliveConnection = m_manager->m_aliveList.m_beginList; - m_prevKeepAliveConnection = NULL; - if (m_manager->m_aliveList.m_beginList != NULL) + m_prevKeepAliveConnection = nullptr; + if (m_manager->m_aliveList.m_beginList != nullptr) m_manager->m_aliveList.m_beginList->m_prevKeepAliveConnection = this; m_manager->m_aliveList.m_beginList = this; } - data_block *work = NULL; + data_block *work = nullptr; // this connection has no send buffer. Get a block if(!m_tail) @@ -464,16 +464,16 @@ int TcpConnection::processIncoming() { m_recvDataListId = m_manager->m_noDataList.m_listID; - if (m_prevRecvDataConnection != NULL) + if (m_prevRecvDataConnection != nullptr) m_prevRecvDataConnection->m_nextRecvDataConnection = m_nextRecvDataConnection; - if (m_nextRecvDataConnection != NULL) + if (m_nextRecvDataConnection != nullptr) m_nextRecvDataConnection->m_prevRecvDataConnection = m_prevRecvDataConnection; if (m_manager->m_noDataList.m_beginList == this) m_manager->m_noDataList.m_beginList = m_nextRecvDataConnection; m_nextRecvDataConnection = m_manager->m_dataList.m_beginList; - m_prevRecvDataConnection = NULL; - if (m_manager->m_dataList.m_beginList != NULL) + m_prevRecvDataConnection = nullptr; + if (m_manager->m_dataList.m_beginList != nullptr) m_manager->m_dataList.m_beginList->m_prevRecvDataConnection = this; m_manager->m_dataList.m_beginList = this; } @@ -619,7 +619,7 @@ int TcpConnection::processOutgoing() int sendError = 1; - // If m_head is not null, then this connection has something to send + // If m_head is not nullptr, then this connection has something to send if(m_head) diff --git a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpConnection.h b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpConnection.h index 07eb4f42..92d631d1 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpConnection.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpConnection.h @@ -50,7 +50,7 @@ public: * connection is disconnected, you simply need to derive your class * (multiply if necessary) from TcpConnectionHandler, then you can use * this method to set the object the TcpConnection will call as appropriate. - * default = NULL (no callbacks made) + * default = nullptr (no callbacks made) * * @param handler The object which will be called for notifications. */ diff --git a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpManager.cpp b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpManager.cpp index 29d51de0..86778910 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpManager.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpManager.cpp @@ -41,14 +41,14 @@ TcpManager::TcpParams::TcpParams(const TcpParams &cpy) } TcpManager::TcpManager(const TcpParams ¶ms) -: m_handler(NULL), - m_keepAliveList(NULL, 1), - m_aliveList(NULL, 2), - m_noDataList(NULL, 1), - m_dataList(NULL, 2), +: m_handler(nullptr), + m_keepAliveList(nullptr, 1), + m_aliveList(nullptr, 2), + m_noDataList(nullptr, 1), + m_dataList(nullptr, 2), m_params(params), m_refCount(1), - m_connectionList(NULL), + m_connectionList(nullptr), m_connectionListCount(0), m_socket(INVALID_SOCKET), m_boundAsServer(false), @@ -86,7 +86,7 @@ TcpManager::~TcpManager() close(m_socket); #endif } - while (m_connectionList != NULL) + while (m_connectionList != nullptr) { TcpConnection *con = m_connectionList; m_connectionList = m_connectionList->m_nextConnection; @@ -162,7 +162,7 @@ bool TcpManager::BindAsServer() { struct hostent * lphp; lphp = gethostbyname(m_params.bindAddress); - if (lphp != NULL) + if (lphp != nullptr) addr_loc.sin_addr.s_addr = ((struct in_addr *)(lphp->h_addr))->s_addr; } else @@ -187,7 +187,7 @@ bool TcpManager::BindAsServer() TcpConnection *TcpManager::acceptClient() { - TcpConnection *newConn = NULL; + TcpConnection *newConn = nullptr; if (m_boundAsServer && m_connectionListCount < m_params.maxConnections) { @@ -201,7 +201,7 @@ TcpConnection *TcpManager::acceptClient() { newConn = new TcpConnection(this, &m_allocator, m_params, sock, IPAddress(addr.sin_addr.s_addr), ntohs(addr.sin_port)); addNewConnection(newConn); - if (m_handler != NULL) + if (m_handler != nullptr) { m_handler->OnConnectRequest(newConn); } @@ -226,8 +226,8 @@ SOCKET TcpManager::getMaxFD() if (m_boundAsServer) maxfd = m_socket+1; - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) { next = con->m_nextConnection; if (con->GetStatus() != TcpConnection::StatusDisconnected && con->m_socket > maxfd) @@ -241,8 +241,8 @@ SOCKET TcpManager::getMaxFD() TcpConnection *TcpManager::getConnection(SOCKET fd) { - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) { next = con->m_nextConnection; if (con->m_socket == fd) @@ -251,7 +251,7 @@ TcpConnection *TcpManager::getConnection(SOCKET fd) } } //if get here ,couldn't find it - return NULL; + return nullptr; } bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendTimePerConnection, unsigned maxRecvTimePerConnection) @@ -273,8 +273,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT { // Send output from last heartbeat - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) { con->AddRef(); if (next) next->Release(); @@ -341,7 +341,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT tmpfds = m_permfds; timeout.tv_sec = 0; timeout.tv_usec = 0; - int cnt = select(maxfd, &tmpfds, NULL, NULL, &timeout); // blocks for timeout + int cnt = select(maxfd, &tmpfds, nullptr, nullptr, &timeout); // blocks for timeout if (cnt > 0) @@ -367,8 +367,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //process incoming client messages if (maxRecvTimePerConnection != 0) { - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) { con->AddRef(); if (next) next->Release(); @@ -433,8 +433,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT pollfds[0].events |= POLLIN; } - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next, idx++) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next, idx++) { next = con->m_nextConnection; pollfds[idx].fd = con->m_socket; @@ -474,7 +474,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT } //process regular msg(s) - if (con == NULL) + if (con == nullptr) { close(pollfds[idx].fd); continue; @@ -506,7 +506,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT }//if(pollfds[... else if (pollfds[idx].revents & POLLHUP) { - if (con == NULL) + if (con == nullptr) { close(pollfds[idx].fd); continue; @@ -524,21 +524,21 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //now process any keepalives, if time to do that if (m_params.keepAliveDelay > 0 && m_keepAliveTimer.isDone(m_params.keepAliveDelay)) { - TcpConnection *next = NULL; - for (TcpConnection *con = m_keepAliveList.m_beginList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_keepAliveList.m_beginList ; con != nullptr ; con = next) { con->AddRef(); if (next) next->Release(); next = con->m_nextKeepAliveConnection; if (next) next->AddRef(); - con->Send(NULL, 0); //note: this request will move the connection from the keepAliveList to the aliveList + con->Send(nullptr, 0); //note: this request will move the connection from the keepAliveList to the aliveList con->Release(); } //now move the complete alive list over to the keepalive list to reset those timers m_keepAliveList.m_beginList = m_aliveList.m_beginList; - m_aliveList.m_beginList = NULL; + m_aliveList.m_beginList = nullptr; //switch id's for those connections that were in the alive list last go - around int tmpID = m_aliveList.m_listID; @@ -552,8 +552,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //now process any noDataCons, if time to do that if (m_params.noDataTimeout > 0 && m_noDataTimer.isDone(m_params.noDataTimeout)) { - TcpConnection *next = NULL; - for (TcpConnection *con = m_noDataList.m_beginList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_noDataList.m_beginList ; con != nullptr ; con = next) { con->AddRef(); if (next) next->Release(); @@ -567,7 +567,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //now move the complete data list over to the nodata list to reset those timers m_noDataList.m_beginList = m_dataList.m_beginList; - m_dataList.m_beginList = NULL; + m_dataList.m_beginList = nullptr; //switch id's for those connections that were in the data list last go - around int tmpID = m_dataList.m_listID; @@ -589,11 +589,11 @@ TcpConnection *TcpManager::EstablishConnection(const char *serverAddress, unsign { //can't open outgoing connections when in server mode // use a different TcpManager to do that - return NULL; + return nullptr; } if (m_connectionListCount >= m_params.maxConnections) - return(NULL); + return(nullptr); // get server address unsigned long address = inet_addr(serverAddress); @@ -601,8 +601,8 @@ TcpConnection *TcpManager::EstablishConnection(const char *serverAddress, unsign { struct hostent * lphp; lphp = gethostbyname(serverAddress); - if (lphp == NULL) - return(NULL); + if (lphp == nullptr) + return(nullptr); address = ((struct in_addr *)(lphp->h_addr))->s_addr; } IPAddress destIP(address); @@ -622,22 +622,22 @@ void TcpManager::addNewConnection(TcpConnection *con) FD_SET(con->m_socket, &m_permfds); #endif con->m_nextConnection = m_connectionList; - con->m_prevConnection = NULL; - if (m_connectionList != NULL) + con->m_prevConnection = nullptr; + if (m_connectionList != nullptr) m_connectionList->m_prevConnection = con; m_connectionList = con; m_connectionListCount++; con->m_nextKeepAliveConnection = m_aliveList.m_beginList; - con->m_prevKeepAliveConnection = NULL; - if (m_aliveList.m_beginList != NULL) + con->m_prevKeepAliveConnection = nullptr; + if (m_aliveList.m_beginList != nullptr) m_aliveList.m_beginList->m_prevKeepAliveConnection = con; m_aliveList.m_beginList = con; con->m_aliveListId = m_keepAliveList.m_listID;//start it out thinking it's already in the alive list, since it is con->m_nextRecvDataConnection = m_dataList.m_beginList; - con->m_prevRecvDataConnection = NULL; - if (m_dataList.m_beginList != NULL) + con->m_prevRecvDataConnection = nullptr; + if (m_dataList.m_beginList != nullptr) m_dataList.m_beginList->m_prevRecvDataConnection = con; m_dataList.m_beginList = con; con->m_recvDataListId = m_noDataList.m_listID;//start it out thinking it's already in the data list, since it is @@ -655,40 +655,40 @@ void TcpManager::removeConnection(TcpConnection *con) FD_CLR(con->m_socket, &m_permfds); } #endif - if (con->m_prevConnection != NULL) + if (con->m_prevConnection != nullptr) con->m_prevConnection->m_nextConnection = con->m_nextConnection; - if (con->m_nextConnection != NULL) + if (con->m_nextConnection != nullptr) con->m_nextConnection->m_prevConnection = con->m_prevConnection; if (m_connectionList == con) m_connectionList = con->m_nextConnection; - con->m_nextConnection = NULL; - con->m_prevConnection = NULL; + con->m_nextConnection = nullptr; + con->m_prevConnection = nullptr; - if (con->m_prevKeepAliveConnection != NULL) + if (con->m_prevKeepAliveConnection != nullptr) con->m_prevKeepAliveConnection->m_nextKeepAliveConnection = con->m_nextKeepAliveConnection; - if (con->m_nextKeepAliveConnection != NULL) + if (con->m_nextKeepAliveConnection != nullptr) con->m_nextKeepAliveConnection->m_prevKeepAliveConnection = con->m_prevKeepAliveConnection; if (m_aliveList.m_beginList == con) m_aliveList.m_beginList = con->m_nextKeepAliveConnection; else if (m_keepAliveList.m_beginList == con) m_keepAliveList.m_beginList = con->m_nextKeepAliveConnection; - con->m_nextKeepAliveConnection = NULL; - con->m_prevKeepAliveConnection = NULL; + con->m_nextKeepAliveConnection = nullptr; + con->m_prevKeepAliveConnection = nullptr; - if (con->m_prevRecvDataConnection != NULL) + if (con->m_prevRecvDataConnection != nullptr) con->m_prevRecvDataConnection->m_nextRecvDataConnection = con->m_nextRecvDataConnection; - if (con->m_nextRecvDataConnection != NULL) + if (con->m_nextRecvDataConnection != nullptr) con->m_nextRecvDataConnection->m_prevRecvDataConnection = con->m_prevRecvDataConnection; if (m_dataList.m_beginList == con) m_dataList.m_beginList = con->m_nextRecvDataConnection; else if (m_noDataList.m_beginList == con) m_noDataList.m_beginList = con->m_nextRecvDataConnection; - con->m_nextRecvDataConnection = NULL; - con->m_prevRecvDataConnection = NULL; + con->m_nextRecvDataConnection = nullptr; + con->m_prevRecvDataConnection = nullptr; diff --git a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpManager.h b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpManager.h index 32132069..cdc01daa 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpManager.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpManager.h @@ -156,7 +156,7 @@ public: * simply need to derive your class (multiply if necessary) from TcpManagerHandler, then you can use * this method to set the object the TcpManager will call as appropriate. The TcpConnection object * also has a handler mechanism that replaces the other callback functions below, see TcpConnection::SetHandler - * default = NULL (no callbacks made) + * default = nullptr (no callbacks made) * * @param handler The object which will be called for manager related notifications. */ @@ -211,7 +211,7 @@ public: * the connect-complete callback to be called if the connection is succesfull. * * @return A pointer to a TcpConnection object. - * NULL if the manager object has exceeded its maximum number of connections + * nullptr if the manager object has exceeded its maximum number of connections * or if the serverAddress cannot be resolved to an IP address. */ TcpConnection *EstablishConnection(const char *serverAddress, unsigned short serverPort, unsigned timeout = 0); diff --git a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TestClient/TestClient.cpp b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TestClient/TestClient.cpp index 075062d5..35423e88 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TestClient/TestClient.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TestClient/TestClient.cpp @@ -42,7 +42,7 @@ void TestClient::process() { m_con->SetHandler(this); m_conState = CON_NEGOTIATE; - m_conTimeout = time(NULL) + 20;//m_reconnectTimeout; + m_conTimeout = time(nullptr) + 20;//m_reconnectTimeout; } break; case CON_NEGOTIATE: @@ -51,10 +51,10 @@ void TestClient::process() m_conState = CON_CONNECT; printf("callback here.... connected\n"); } - else if(time(NULL) > 20) + else if(time(nullptr) > 20) { m_con->Release(); - m_con = NULL; + m_con = nullptr; m_conState = CON_DISCONNECT; } break; @@ -63,7 +63,7 @@ void TestClient::process() default: m_conState = CON_DISCONNECT; m_con->Release(); - m_con = NULL; + m_con = nullptr; } m_manager->GiveTime(); } @@ -95,7 +95,7 @@ void TestClient::OnTerminated(TcpConnection *con) if (m_con) { m_con->Release(); - m_con = NULL; + m_con = nullptr; } m_conState = CON_DISCONNECT; } diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Unicode/UnicodeCharacterDataMap.h b/external/3rd/library/soePlatform/CSAssist/utils/Unicode/UnicodeCharacterDataMap.h index 741a6e80..493c5a2d 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Unicode/UnicodeCharacterDataMap.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/Unicode/UnicodeCharacterDataMap.h @@ -122,7 +122,7 @@ namespace Plat_Unicode /** * Find a CharData for the given code point. - * @return null if no CharData exists for this code point + * @return nullptr if no CharData exists for this code point */ inline const CharData * CharDataMap::findCharData (const unicode_char_t code) const diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Unicode/utf8.cpp b/external/3rd/library/soePlatform/CSAssist/utils/Unicode/utf8.cpp index 527f246d..e7df40e2 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Unicode/utf8.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/Unicode/utf8.cpp @@ -87,7 +87,7 @@ int UTF8_convertCharToUTF16( char * ptr , UTF16 * ret ) int UTF8_convertToUTF16( char * ptr , UTF16 * ret, int limit ) { int len = 0; - while (( *ptr != 0 ) && ( len < ( limit - 1 ) ))//we use limit -1 to leave room for the null terminator + while (( *ptr != 0 ) && ( len < ( limit - 1 ) ))//we use limit -1 to leave room for the nullptr terminator { int clen = UTF8_convertCharToUTF16( ptr, ret ); ptr += clen; diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/Base/Archive.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/Base/Archive.cpp index e3400df0..8ad45428 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/Base/Archive.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/Base/Archive.cpp @@ -91,7 +91,7 @@ namespace Base ByteStream::ByteStream() : allocatedSize(0), beginReadIterator(), - data(NULL), + data(nullptr), size(0), lastPutSize(0) { @@ -208,7 +208,7 @@ namespace Base if(data->size < allocatedSize) { unsigned char * tmp = new unsigned char[newSize]; - if(data->buffer != NULL) + if(data->buffer != nullptr) memcpy(tmp, data->buffer, size); delete[] data->buffer; data->buffer = tmp; diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericApiCore.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericApiCore.cpp index 2f68dd50..527f5b69 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericApiCore.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericApiCore.cpp @@ -117,7 +117,7 @@ unsigned GenericAPICore::submitRequest(GenericRequest *req, GenericResponse *res } req->setTrack(m_currTrack); res->setTrack(m_currTrack); - time_t timeout = time(NULL) + m_requestTimeout; + time_t timeout = time(nullptr) + m_requestTimeout; req->setTimeout(timeout); res->setTimeout(timeout); @@ -136,7 +136,7 @@ void GenericAPICore::process() if (!m_suspended) { // Process timeout on pending requests - while((m_outCount > 0) && ((req = m_outboundQueue.front().first)->getTimeout() <= time(NULL))) + while((m_outCount > 0) && ((req = m_outboundQueue.front().first)->getTimeout() <= time(nullptr))) { --m_outCount; res = m_outboundQueue.front().second; @@ -148,7 +148,7 @@ void GenericAPICore::process() } // Process timeout on pending responses - while((m_pendingCount > 0) && ((res = (*m_pending.begin()).second)->getTimeout() <= time(NULL))) + while((m_pendingCount > 0) && ((res = (*m_pending.begin()).second)->getTimeout() <= time(nullptr))) { --m_pendingCount; m_pending.erase(m_pending.begin()); @@ -161,7 +161,7 @@ void GenericAPICore::process() pair out_pair = m_outboundQueue.front(); req = out_pair.first; res = out_pair.second; - GenericConnection *con = NULL; + GenericConnection *con = nullptr; if (req->getMappedServerTrack() == 0) // request has no originating "owner" server { con = getNextActiveConnection(); // it does not matter which server we send this to @@ -178,7 +178,7 @@ void GenericAPICore::process() } } - if (con != NULL) + if (con != nullptr) { Base::ByteStream msg; req->pack(msg); @@ -213,7 +213,7 @@ GenericConnection *GenericAPICore::getNextActiveConnection() unsigned startIndex = m_nextConnectionIndex; unsigned maxIndex = m_serverConnections.size() - 1; - GenericConnection *con = NULL; + GenericConnection *con = nullptr; //loop until we find an active connection, or until we get back // to where we started @@ -233,7 +233,7 @@ GenericConnection *GenericAPICore::getNextActiveConnection() //went past end of vector, start back at 0 m_nextConnectionIndex = 0; } - }while (con == NULL && m_nextConnectionIndex != startIndex); + }while (con == nullptr && m_nextConnectionIndex != startIndex); return con; } @@ -259,7 +259,7 @@ ServerTrackObject *GenericAPICore::findServer(unsigned server_track) { std::map::iterator iter = m_serverTracks.find(server_track); if (iter == m_serverTracks.end()) - return NULL; + return nullptr; ServerTrackObject *stobj = (*iter).second; m_serverTracks.erase(server_track); return stobj; diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericConnection.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericConnection.cpp index ef652f08..2fd9ca45 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericConnection.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericConnection.cpp @@ -22,7 +22,7 @@ using namespace Base; GenericConnection::GenericConnection(const char *host, short port, GenericAPICore *apiCore, unsigned reconnectTimeout, unsigned noDataTimeoutSecs, unsigned noAckTimeoutSecs, unsigned incomingBufSizeInKB, unsigned outgoingBufSizeInKB, unsigned keepAlive, unsigned maxRecvMessageSizeInKB) : m_bConnected(CON_NONE), m_apiCore(apiCore), - m_con(NULL), + m_con(nullptr), m_host(host), m_port(port), m_lastTrack(123455), //random choice != 1 @@ -47,8 +47,8 @@ GenericConnection::~GenericConnection() { if(m_con) { - m_con->SetHandler(NULL); - m_con->Disconnect();//don't worry about onterminated being called, we've set it's handler to null, so it wont + m_con->SetHandler(nullptr); + m_con->Disconnect();//don't worry about onterminated being called, we've set it's handler to nullptr, so it wont m_con->Release(); } @@ -61,7 +61,7 @@ void GenericConnection::disconnect() { m_con->Disconnect(); //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); - m_con = NULL; + m_con = nullptr; } m_conState = CON_DISCONNECT; m_bConnected = CON_NONE; @@ -74,7 +74,7 @@ void GenericConnection::OnTerminated(TcpConnection *con) if(m_con) { m_con->Release(); - m_con = NULL; + m_con = nullptr; } m_conState = CON_DISCONNECT; m_bConnected = CON_NONE; @@ -90,7 +90,7 @@ void GenericConnection::OnRoutePacket(TcpConnection *con, const unsigned char *d get(iter, type); get(iter, track); - GenericResponse *res = NULL; + GenericResponse *res = nullptr; // the following if block is a temporary fix that prevents // a crash with a game team in which they occasionally find @@ -148,7 +148,7 @@ void GenericConnection::process() { m_con->SetHandler(this); m_conState = CON_NEGOTIATE; - m_conTimeout = time(NULL) + m_reconnectTimeout; + m_conTimeout = time(nullptr) + m_reconnectTimeout; } break; case CON_NEGOTIATE: @@ -169,12 +169,12 @@ void GenericConnection::process() put(msg, m_apiCore->getGameCode()); Send(msg); } - else if(time(NULL) > m_conTimeout) + else if(time(nullptr) > m_conTimeout) { // we did not connect m_con->Disconnect(); //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); - m_con = NULL; + m_con = nullptr; m_conState = CON_DISCONNECT; m_bConnected = CON_NONE; } @@ -190,7 +190,7 @@ void GenericConnection::process() { m_con->Disconnect(); //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); - m_con = NULL; + m_con = nullptr; } } m_manager->GiveTime(); diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/CTServiceAPI.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/CTServiceAPI.cpp index 57f9b409..4e6b0954 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/CTServiceAPI.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/CTServiceAPI.cpp @@ -23,7 +23,7 @@ CTServiceAPI::CTServiceAPI(const char *hostName, const char *game) std::vector hostArray; std::vector portArray; char hostConfig[4096]; - if (hostName == NULL) + if (hostName == nullptr) hostName = DEFAULT_HOST; if (!game) game = DEFAULT_GAMECODE; @@ -47,7 +47,7 @@ CTServiceAPI::CTServiceAPI(const char *hostName, const char *game) portArray.push_back(port); } } - while ((ptr = strtok(NULL, " ")) != NULL); + while ((ptr = strtok(nullptr, " ")) != nullptr); } if (hostArray.empty()) { diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/IPAddress.h b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/IPAddress.h index f6d5f886..03b59e8d 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/IPAddress.h +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/IPAddress.h @@ -32,7 +32,7 @@ public: * @brief Used to retreive the the dot-notation represenatatiion of this address. * * @param buffer A pointer to the buffer to place the ip address into. - * Must be at least 17 characters long, will be null terminated. + * Must be at least 17 characters long, will be nullptr terminated. * * @return A pointer to the buffer the address was placed into. */ diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpBlockAllocator.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpBlockAllocator.cpp index 6d476d78..b7da0f27 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpBlockAllocator.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpBlockAllocator.cpp @@ -6,7 +6,7 @@ namespace NAMESPACE #endif TcpBlockAllocator::TcpBlockAllocator(const unsigned initSize, const unsigned initCount) -: m_freeHead(NULL), m_blockCount(initCount), m_blockSize(initSize), m_numAvailBlocks(0) +: m_freeHead(nullptr), m_blockCount(initCount), m_blockSize(initSize), m_numAvailBlocks(0) { realloc(); } @@ -33,7 +33,7 @@ data_block *TcpBlockAllocator::getBlock() tmp = m_freeHead; m_freeHead = m_freeHead->m_next; - tmp->m_next = NULL; + tmp->m_next = nullptr; m_numAvailBlocks--; return(tmp); } @@ -56,7 +56,7 @@ void TcpBlockAllocator::returnBlock(data_block *b) void TcpBlockAllocator::realloc() { - data_block *tmp = NULL, *cursor = NULL; + data_block *tmp = nullptr, *cursor = nullptr; tmp = new data_block; m_numAvailBlocks++; cursor = tmp; diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpConnection.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpConnection.cpp index 0b3366a8..cd2c1f20 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpConnection.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpConnection.cpp @@ -11,28 +11,28 @@ namespace NAMESPACE //used when want to open new connection with this socket TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, const IPAddress &destIP, short destPort, unsigned timeout) -: m_nextConnection(NULL), - m_prevConnection(NULL), +: m_nextConnection(nullptr), + m_prevConnection(nullptr), m_socket(INVALID_SOCKET), - m_nextKeepAliveConnection(NULL), - m_prevKeepAliveConnection(NULL), + m_nextKeepAliveConnection(nullptr), + m_prevKeepAliveConnection(nullptr), m_aliveListId(tcpManager->m_aliveList.m_listID), - m_nextRecvDataConnection(NULL), - m_prevRecvDataConnection(NULL), + m_nextRecvDataConnection(nullptr), + m_prevRecvDataConnection(nullptr), m_recvDataListId(tcpManager->m_dataList.m_listID), m_manager(tcpManager), m_status(StatusNegotiating), - m_handler(NULL), + m_handler(nullptr), m_destIP(destIP), m_destPort(destPort), m_refCount(0), m_sendAllocator(sendAlloc), - m_head(NULL), - m_tail(NULL), + m_head(nullptr), + m_tail(nullptr), m_bytesRead(0), m_bytesNeeded(0), m_params(params), - m_recvBuff(NULL), + m_recvBuff(nullptr), m_connectTimeout(timeout), m_connectTimer(), m_wasConRemovedFromMgr(false) @@ -94,28 +94,28 @@ TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAllo //used when server mode creates new connection object representing a connect request TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, SOCKET socket, const IPAddress &destIP, short destPort) -: m_nextConnection(NULL), - m_prevConnection(NULL), +: m_nextConnection(nullptr), + m_prevConnection(nullptr), m_socket(socket), - m_nextKeepAliveConnection(NULL), - m_prevKeepAliveConnection(NULL), + m_nextKeepAliveConnection(nullptr), + m_prevKeepAliveConnection(nullptr), m_aliveListId(tcpManager->m_aliveList.m_listID), - m_nextRecvDataConnection(NULL), - m_prevRecvDataConnection(NULL), + m_nextRecvDataConnection(nullptr), + m_prevRecvDataConnection(nullptr), m_recvDataListId(tcpManager->m_dataList.m_listID), m_manager(tcpManager), m_status(StatusConnected), - m_handler(NULL), + m_handler(nullptr), m_destIP(destIP), m_destPort(destPort), m_refCount(0), m_sendAllocator(sendAlloc), - m_head(NULL), - m_tail(NULL), + m_head(nullptr), + m_tail(nullptr), m_bytesRead(0), m_bytesNeeded(0), m_params(params), - m_recvBuff(NULL), + m_recvBuff(nullptr), m_connectTimeout(0), m_connectTimer(), m_wasConRemovedFromMgr(false) @@ -205,7 +205,7 @@ int TcpConnection::finishConnect() t.tv_sec = 0; t.tv_usec = 0; - int err = select(m_socket + 1, NULL, &wrSet, NULL, &t); + int err = select(m_socket + 1, nullptr, &wrSet, nullptr, &t); if (err == 0) { @@ -300,7 +300,7 @@ TcpConnection::~TcpConnection() { delete [] m_recvBuff; - while(m_head != NULL) + while(m_head != nullptr) { data_block *tmp = m_head; m_head = m_head->m_next; @@ -324,22 +324,22 @@ void TcpConnection::Send(const char *data, unsigned int dataLen) { m_aliveListId = m_manager->m_keepAliveList.m_listID; - if (m_prevKeepAliveConnection != NULL) + if (m_prevKeepAliveConnection != nullptr) m_prevKeepAliveConnection->m_nextKeepAliveConnection = m_nextKeepAliveConnection; - if (m_nextKeepAliveConnection != NULL) + if (m_nextKeepAliveConnection != nullptr) m_nextKeepAliveConnection->m_prevKeepAliveConnection = m_prevKeepAliveConnection; if (m_manager->m_keepAliveList.m_beginList == this) m_manager->m_keepAliveList.m_beginList = m_nextKeepAliveConnection; m_nextKeepAliveConnection = m_manager->m_aliveList.m_beginList; - m_prevKeepAliveConnection = NULL; - if (m_manager->m_aliveList.m_beginList != NULL) + m_prevKeepAliveConnection = nullptr; + if (m_manager->m_aliveList.m_beginList != nullptr) m_manager->m_aliveList.m_beginList->m_prevKeepAliveConnection = this; m_manager->m_aliveList.m_beginList = this; } - data_block *work = NULL; + data_block *work = nullptr; // this connection has no send buffer. Get a block if(!m_tail) @@ -464,16 +464,16 @@ int TcpConnection::processIncoming() { m_recvDataListId = m_manager->m_noDataList.m_listID; - if (m_prevRecvDataConnection != NULL) + if (m_prevRecvDataConnection != nullptr) m_prevRecvDataConnection->m_nextRecvDataConnection = m_nextRecvDataConnection; - if (m_nextRecvDataConnection != NULL) + if (m_nextRecvDataConnection != nullptr) m_nextRecvDataConnection->m_prevRecvDataConnection = m_prevRecvDataConnection; if (m_manager->m_noDataList.m_beginList == this) m_manager->m_noDataList.m_beginList = m_nextRecvDataConnection; m_nextRecvDataConnection = m_manager->m_dataList.m_beginList; - m_prevRecvDataConnection = NULL; - if (m_manager->m_dataList.m_beginList != NULL) + m_prevRecvDataConnection = nullptr; + if (m_manager->m_dataList.m_beginList != nullptr) m_manager->m_dataList.m_beginList->m_prevRecvDataConnection = this; m_manager->m_dataList.m_beginList = this; } @@ -619,7 +619,7 @@ int TcpConnection::processOutgoing() int sendError = 1; - // If m_head is not null, then this connection has something to send + // If m_head is not nullptr, then this connection has something to send if(m_head) diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpConnection.h b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpConnection.h index 07eb4f42..92d631d1 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpConnection.h +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpConnection.h @@ -50,7 +50,7 @@ public: * connection is disconnected, you simply need to derive your class * (multiply if necessary) from TcpConnectionHandler, then you can use * this method to set the object the TcpConnection will call as appropriate. - * default = NULL (no callbacks made) + * default = nullptr (no callbacks made) * * @param handler The object which will be called for notifications. */ diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpManager.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpManager.cpp index fa4d61a4..2586fa64 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpManager.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpManager.cpp @@ -41,14 +41,14 @@ TcpManager::TcpParams::TcpParams(const TcpParams &cpy) } TcpManager::TcpManager(const TcpParams ¶ms) -: m_handler(NULL), - m_keepAliveList(NULL, 1), - m_aliveList(NULL, 2), - m_noDataList(NULL, 1), - m_dataList(NULL, 2), +: m_handler(nullptr), + m_keepAliveList(nullptr, 1), + m_aliveList(nullptr, 2), + m_noDataList(nullptr, 1), + m_dataList(nullptr, 2), m_params(params), m_refCount(1), - m_connectionList(NULL), + m_connectionList(nullptr), m_connectionListCount(0), m_socket(INVALID_SOCKET), m_boundAsServer(false), @@ -86,7 +86,7 @@ TcpManager::~TcpManager() close(m_socket); #endif } - while (m_connectionList != NULL) + while (m_connectionList != nullptr) { TcpConnection *con = m_connectionList; m_connectionList = m_connectionList->m_nextConnection; @@ -162,7 +162,7 @@ bool TcpManager::BindAsServer() { struct hostent * lphp; lphp = gethostbyname(m_params.bindAddress); - if (lphp != NULL) + if (lphp != nullptr) addr_loc.sin_addr.s_addr = ((struct in_addr *)(lphp->h_addr))->s_addr; } else @@ -187,7 +187,7 @@ bool TcpManager::BindAsServer() TcpConnection *TcpManager::acceptClient() { - TcpConnection *newConn = NULL; + TcpConnection *newConn = nullptr; if (m_boundAsServer && m_connectionListCount < m_params.maxConnections) { @@ -201,7 +201,7 @@ TcpConnection *TcpManager::acceptClient() { newConn = new TcpConnection(this, &m_allocator, m_params, sock, IPAddress(addr.sin_addr.s_addr), ntohs(addr.sin_port)); addNewConnection(newConn); - if (m_handler != NULL) + if (m_handler != nullptr) { m_handler->OnConnectRequest(newConn); } @@ -226,8 +226,8 @@ SOCKET TcpManager::getMaxFD() if (m_boundAsServer) maxfd = m_socket+1; - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) { next = con->m_nextConnection; if (con->GetStatus() != TcpConnection::StatusDisconnected && con->m_socket > maxfd) @@ -241,8 +241,8 @@ SOCKET TcpManager::getMaxFD() TcpConnection *TcpManager::getConnection(SOCKET fd) { - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) { next = con->m_nextConnection; if (con->m_socket == fd) @@ -251,7 +251,7 @@ TcpConnection *TcpManager::getConnection(SOCKET fd) } } //if get here ,couldn't find it - return NULL; + return nullptr; } bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendTimePerConnection, unsigned maxRecvTimePerConnection) @@ -273,8 +273,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT { // Send output from last heartbeat - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) { con->AddRef(); if (next) next->Release(); @@ -341,7 +341,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT tmpfds = m_permfds; timeout.tv_sec = 0; timeout.tv_usec = 0; - int cnt = select(maxfd, &tmpfds, NULL, NULL, &timeout); // blocks for timeout + int cnt = select(maxfd, &tmpfds, nullptr, nullptr, &timeout); // blocks for timeout if (cnt > 0) @@ -367,8 +367,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //process incoming client messages if (maxRecvTimePerConnection != 0) { - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) { con->AddRef(); if (next) next->Release(); @@ -433,8 +433,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT pollfds[0].events |= POLLIN; } - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next, idx++) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next, idx++) { next = con->m_nextConnection; pollfds[idx].fd = con->m_socket; @@ -474,7 +474,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT } //process regular msg(s) - if (con == NULL) + if (con == nullptr) { close(pollfds[idx].fd); continue; @@ -506,7 +506,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT }//if(pollfds[... else if (pollfds[idx].revents & POLLHUP) { - if (con == NULL) + if (con == nullptr) { close(pollfds[idx].fd); continue; @@ -524,21 +524,21 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //now process any keepalives, if time to do that if (m_params.keepAliveDelay > 0 && m_keepAliveTimer.isDone(m_params.keepAliveDelay)) { - TcpConnection *next = NULL; - for (TcpConnection *con = m_keepAliveList.m_beginList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_keepAliveList.m_beginList ; con != nullptr ; con = next) { con->AddRef(); if (next) next->Release(); next = con->m_nextKeepAliveConnection; if (next) next->AddRef(); - con->Send(NULL, 0); //note: this request will move the connection from the keepAliveList to the aliveList + con->Send(nullptr, 0); //note: this request will move the connection from the keepAliveList to the aliveList con->Release(); } //now move the complete alive list over to the keepalive list to reset those timers m_keepAliveList.m_beginList = m_aliveList.m_beginList; - m_aliveList.m_beginList = NULL; + m_aliveList.m_beginList = nullptr; //switch id's for those connections that were in the alive list last go - around int tmpID = m_aliveList.m_listID; @@ -552,8 +552,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //now process any noDataCons, if time to do that if (m_params.noDataTimeout > 0 && m_noDataTimer.isDone(m_params.noDataTimeout)) { - TcpConnection *next = NULL; - for (TcpConnection *con = m_noDataList.m_beginList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_noDataList.m_beginList ; con != nullptr ; con = next) { con->AddRef(); if (next) next->Release(); @@ -567,7 +567,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //now move the complete data list over to the nodata list to reset those timers m_noDataList.m_beginList = m_dataList.m_beginList; - m_dataList.m_beginList = NULL; + m_dataList.m_beginList = nullptr; //switch id's for those connections that were in the data list last go - around int tmpID = m_dataList.m_listID; @@ -589,11 +589,11 @@ TcpConnection *TcpManager::EstablishConnection(const char *serverAddress, unsign { //can't open outgoing connections when in server mode // use a different TcpManager to do that - return NULL; + return nullptr; } if (m_connectionListCount >= m_params.maxConnections) - return(NULL); + return(nullptr); // get server address unsigned long address = inet_addr(serverAddress); @@ -601,8 +601,8 @@ TcpConnection *TcpManager::EstablishConnection(const char *serverAddress, unsign { struct hostent * lphp; lphp = gethostbyname(serverAddress); - if (lphp == NULL) - return(NULL); + if (lphp == nullptr) + return(nullptr); address = ((struct in_addr *)(lphp->h_addr))->s_addr; } IPAddress destIP(address); @@ -622,22 +622,22 @@ void TcpManager::addNewConnection(TcpConnection *con) FD_SET(con->m_socket, &m_permfds); #endif con->m_nextConnection = m_connectionList; - con->m_prevConnection = NULL; - if (m_connectionList != NULL) + con->m_prevConnection = nullptr; + if (m_connectionList != nullptr) m_connectionList->m_prevConnection = con; m_connectionList = con; m_connectionListCount++; con->m_nextKeepAliveConnection = m_aliveList.m_beginList; - con->m_prevKeepAliveConnection = NULL; - if (m_aliveList.m_beginList != NULL) + con->m_prevKeepAliveConnection = nullptr; + if (m_aliveList.m_beginList != nullptr) m_aliveList.m_beginList->m_prevKeepAliveConnection = con; m_aliveList.m_beginList = con; con->m_aliveListId = m_keepAliveList.m_listID;//start it out thinking it's already in the alive list, since it is con->m_nextRecvDataConnection = m_dataList.m_beginList; - con->m_prevRecvDataConnection = NULL; - if (m_dataList.m_beginList != NULL) + con->m_prevRecvDataConnection = nullptr; + if (m_dataList.m_beginList != nullptr) m_dataList.m_beginList->m_prevRecvDataConnection = con; m_dataList.m_beginList = con; con->m_recvDataListId = m_noDataList.m_listID;//start it out thinking it's already in the data list, since it is @@ -655,40 +655,40 @@ void TcpManager::removeConnection(TcpConnection *con) FD_CLR(con->m_socket, &m_permfds); } #endif - if (con->m_prevConnection != NULL) + if (con->m_prevConnection != nullptr) con->m_prevConnection->m_nextConnection = con->m_nextConnection; - if (con->m_nextConnection != NULL) + if (con->m_nextConnection != nullptr) con->m_nextConnection->m_prevConnection = con->m_prevConnection; if (m_connectionList == con) m_connectionList = con->m_nextConnection; - con->m_nextConnection = NULL; - con->m_prevConnection = NULL; + con->m_nextConnection = nullptr; + con->m_prevConnection = nullptr; - if (con->m_prevKeepAliveConnection != NULL) + if (con->m_prevKeepAliveConnection != nullptr) con->m_prevKeepAliveConnection->m_nextKeepAliveConnection = con->m_nextKeepAliveConnection; - if (con->m_nextKeepAliveConnection != NULL) + if (con->m_nextKeepAliveConnection != nullptr) con->m_nextKeepAliveConnection->m_prevKeepAliveConnection = con->m_prevKeepAliveConnection; if (m_aliveList.m_beginList == con) m_aliveList.m_beginList = con->m_nextKeepAliveConnection; else if (m_keepAliveList.m_beginList == con) m_keepAliveList.m_beginList = con->m_nextKeepAliveConnection; - con->m_nextKeepAliveConnection = NULL; - con->m_prevKeepAliveConnection = NULL; + con->m_nextKeepAliveConnection = nullptr; + con->m_prevKeepAliveConnection = nullptr; - if (con->m_prevRecvDataConnection != NULL) + if (con->m_prevRecvDataConnection != nullptr) con->m_prevRecvDataConnection->m_nextRecvDataConnection = con->m_nextRecvDataConnection; - if (con->m_nextRecvDataConnection != NULL) + if (con->m_nextRecvDataConnection != nullptr) con->m_nextRecvDataConnection->m_prevRecvDataConnection = con->m_prevRecvDataConnection; if (m_dataList.m_beginList == con) m_dataList.m_beginList = con->m_nextRecvDataConnection; else if (m_noDataList.m_beginList == con) m_noDataList.m_beginList = con->m_nextRecvDataConnection; - con->m_nextRecvDataConnection = NULL; - con->m_prevRecvDataConnection = NULL; + con->m_nextRecvDataConnection = nullptr; + con->m_prevRecvDataConnection = nullptr; diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpManager.h b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpManager.h index 75eb6df4..c4e8b1cf 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpManager.h +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpManager.h @@ -156,7 +156,7 @@ public: * simply need to derive your class (multiply if necessary) from TcpManagerHandler, then you can use * this method to set the object the TcpManager will call as appropriate. The TcpConnection object * also has a handler mechanism that replaces the other callback functions below, see TcpConnection::SetHandler - * default = NULL (no callbacks made) + * default = nullptr (no callbacks made) * * @param handler The object which will be called for manager related notifications. */ @@ -211,7 +211,7 @@ public: * the connect-complete callback to be called if the connection is succesfull. * * @return A pointer to a TcpConnection object. - * NULL if the manager object has exceeded its maximum number of connections + * nullptr if the manager object has exceeded its maximum number of connections * or if the serverAddress cannot be resolved to an IP address. */ TcpConnection *EstablishConnection(const char *serverAddress, unsigned short serverPort, unsigned timeout = 0); diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/TestClient/Main.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/TestClient/Main.cpp index eb7a09ab..188be18e 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/TestClient/Main.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/TestClient/Main.cpp @@ -10,7 +10,7 @@ using namespace CTService; unsigned openRequests = 0; -CTServiceAPI *waitclient = NULL; +CTServiceAPI *waitclient = nullptr; std::map m_tests; std::string game_code; diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/Unicode/UnicodeCharacterDataMap.h b/external/3rd/library/soePlatform/CTServiceGameAPI/Unicode/UnicodeCharacterDataMap.h index 741a6e80..493c5a2d 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/Unicode/UnicodeCharacterDataMap.h +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/Unicode/UnicodeCharacterDataMap.h @@ -122,7 +122,7 @@ namespace Plat_Unicode /** * Find a CharData for the given code point. - * @return null if no CharData exists for this code point + * @return nullptr if no CharData exists for this code point */ inline const CharData * CharDataMap::findCharData (const unicode_char_t code) const diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/test/main.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/test/main.cpp index 4f91d382..e24b265e 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/test/main.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/test/main.cpp @@ -135,7 +135,7 @@ namespace CTService const char *game, const char *param) { - printf("onServerTest(%u, %s, %s)\n", server_track, game ? game : "(null)", param ? param : "(null)"); + printf("onServerTest(%u, %s, %s)\n", server_track, game ? game : "(nullptr)", param ? param : "(nullptr)"); replyTest(server_track, 999, 0); } diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/AvatarIteratorCore.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/AvatarIteratorCore.cpp index 3786718c..9548bc9f 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/AvatarIteratorCore.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/AvatarIteratorCore.cpp @@ -9,7 +9,7 @@ namespace ChatSystem // AVATAR ITERATOR CORE AvatarIteratorCore::AvatarIteratorCore() -: m_map(NULL) +: m_map(nullptr) { } @@ -33,7 +33,7 @@ AvatarIteratorCore &AvatarIteratorCore::operator=(const AvatarIteratorCore& rhs) ChatAvatar *AvatarIteratorCore::getCurAvatar() { - ChatAvatar *returnVal = NULL; + ChatAvatar *returnVal = nullptr; if (!outOfBounds()) { @@ -87,7 +87,7 @@ bool AvatarIteratorCore::outOfBounds() // MODERATOR ITERATOR CORE ModeratorIteratorCore::ModeratorIteratorCore() -: m_set(NULL) +: m_set(nullptr) { } @@ -111,7 +111,7 @@ ModeratorIteratorCore &ModeratorIteratorCore::operator=(const ModeratorIteratorC ChatAvatar *ModeratorIteratorCore::getCurAvatar() { - ChatAvatar *returnVal = NULL; + ChatAvatar *returnVal = nullptr; if (!outOfBounds()) { @@ -165,7 +165,7 @@ bool ModeratorIteratorCore::outOfBounds() // TEMPORARY MODERATOR ITERATOR CORE TemporaryModeratorIteratorCore::TemporaryModeratorIteratorCore() -: m_set(NULL) +: m_set(nullptr) { } @@ -189,7 +189,7 @@ TemporaryModeratorIteratorCore &TemporaryModeratorIteratorCore::operator=(const ChatAvatar *TemporaryModeratorIteratorCore::getCurAvatar() { - ChatAvatar *returnVal = NULL; + ChatAvatar *returnVal = nullptr; if (!outOfBounds()) { @@ -243,7 +243,7 @@ bool TemporaryModeratorIteratorCore::outOfBounds() // VOICE ITERATOR CORE VoiceIteratorCore::VoiceIteratorCore() -: m_set(NULL) +: m_set(nullptr) { } @@ -267,7 +267,7 @@ VoiceIteratorCore &VoiceIteratorCore::operator=(const VoiceIteratorCore& rhs) ChatAvatar *VoiceIteratorCore::getCurAvatar() { - ChatAvatar *returnVal = NULL; + ChatAvatar *returnVal = nullptr; if (!outOfBounds()) { @@ -321,7 +321,7 @@ bool VoiceIteratorCore::outOfBounds() // INVITE ITERATOR CORE InviteIteratorCore::InviteIteratorCore() -: m_set(NULL) +: m_set(nullptr) { } @@ -345,7 +345,7 @@ InviteIteratorCore &InviteIteratorCore::operator=(const InviteIteratorCore& rhs) ChatAvatar *InviteIteratorCore::getCurAvatar() { - ChatAvatar *returnVal = NULL; + ChatAvatar *returnVal = nullptr; if (!outOfBounds()) { @@ -399,7 +399,7 @@ bool InviteIteratorCore::outOfBounds() // BAN ITERATOR CORE BanIteratorCore::BanIteratorCore() -: m_set(NULL) +: m_set(nullptr) { } @@ -423,7 +423,7 @@ BanIteratorCore &BanIteratorCore::operator=(const BanIteratorCore& rhs) ChatAvatar *BanIteratorCore::getCurAvatar() { - ChatAvatar *returnVal = NULL; + ChatAvatar *returnVal = nullptr; if (!outOfBounds()) { diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/AvatarListItemCore.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/AvatarListItemCore.cpp index 15e9af48..6bbc82e9 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/AvatarListItemCore.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/AvatarListItemCore.cpp @@ -7,7 +7,7 @@ namespace ChatSystem using namespace Plat_Unicode; AvatarListItem::AvatarListItem() - : m_core(NULL) + : m_core(nullptr) { } @@ -16,7 +16,7 @@ namespace ChatSystem } AvatarListItemCore::AvatarListItemCore() - : m_interface(NULL) + : m_interface(nullptr) { } diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPI.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPI.cpp index 021afd5d..9b1e1cd0 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPI.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPI.cpp @@ -13,7 +13,7 @@ namespace ChatSystem { ChatAPI::ChatAPI(const char *registrar_host, short registrar_port, const char *server_host, short server_port) -: m_defaultRoomParams(NULL), +: m_defaultRoomParams(nullptr), m_defaultLoginPriority(0), m_defaultEntryType(false) { @@ -25,13 +25,13 @@ ChatAPI::ChatAPI(const char *registrar_host, short registrar_port, const char *s ChatAPI::~ChatAPI() { delete m_defaultRoomParams; - m_defaultRoomParams = NULL; + m_defaultRoomParams = nullptr; delete m_core; - m_core = NULL; + m_core = nullptr; } ChatAPI::ChatAPI(ChatAPICore *core) -: m_defaultRoomParams(NULL) +: m_defaultRoomParams(nullptr) { m_core = core; m_core->setAPI(this); @@ -721,7 +721,7 @@ void ChatAPI::setDefaultRoomParams(RoomParams *roomParams) { if (roomParams) { - if (m_defaultRoomParams == NULL) + if (m_defaultRoomParams == nullptr) { m_defaultRoomParams = new RoomParams; } @@ -732,7 +732,7 @@ void ChatAPI::setDefaultRoomParams(RoomParams *roomParams) else { delete m_defaultRoomParams; - m_defaultRoomParams = NULL; + m_defaultRoomParams = nullptr; } } void ChatAPI::setDefaultLoginLocation(const ChatUnicodeString &defaultLoginLocation) diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPI.h b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPI.h index 00533e05..0d255ca2 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPI.h +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPI.h @@ -105,7 +105,7 @@ namespace ChatSystem // will be connected to, as well as the hostname and port of the Registrar // ChatServer (which will automatically reroute the ChatAPI connection to // a hotspare ChatServer if the provided choice is unavailable). - // NULL pointers are NOT valid input. + // nullptr pointers are NOT valid input. ChatAPI(const char *registrar_host, short registrar_port, const char *server_host, short server_port); virtual ~ChatAPI(); @@ -209,7 +209,7 @@ namespace ChatSystem // getAvatar // Requests immediate return of a ChatAvatar object that this API // has cached due to a RequestLoginAvatar. Request does not go - // to ChatServer. Returns NULL if API does not have object locally. + // to ChatServer. Returns nullptr if API does not have object locally. ChatAvatar *getAvatar(const ChatUnicodeString &avatarName, const ChatUnicodeString &avatarAddress); ChatAvatar *getAvatar(unsigned avatarID); @@ -286,7 +286,7 @@ namespace ChatSystem // Requests immediate return of a ChatRoom object that this API // has cached due to a RequestGetRoom, RequestCreateRoom, or // RequestEnterRoom. Request does not go to ChatServer. Returns - // NULL if API does not have object locally. + // nullptr if API does not have object locally. ChatRoom *getRoom(const ChatUnicodeString &roomAddress); ChatRoom *getRoom(unsigned roomID); @@ -298,13 +298,13 @@ namespace ChatSystem // getDefaultRoomParams // Requests the ChatAPI's current default RoomParams object. Used for - // the EnterRoom call. If NULL, EnterRoom will not do passive room + // the EnterRoom call. If nullptr, EnterRoom will not do passive room // creation if the room to enter does not yet exist. Initial value - // is NULL (no RoomParams object defined). + // is nullptr (no RoomParams object defined). const RoomParams *getDefaultRoomParams(void); // setDefaultRoomParams - // Sets the ChatAPI's current default RoomParams object. Passing a NULL + // Sets the ChatAPI's current default RoomParams object. Passing a nullptr // pointer will cause the default params not to be used by EnterRoom. void setDefaultRoomParams(RoomParams *roomParams); diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPICore.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPICore.cpp index 5724a68f..99cfe621 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPICore.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPICore.cpp @@ -67,7 +67,7 @@ const char * const ChatAPICore::ms_errorStringsEnglish[] = "UID node already exists", "Wrong chat server for request", "Succeeded, but local data is invalid", - "Login with null name", + "Login with nullptr name", "No server assigned to this identity", // 45 "Another server already assumed this identity", "Remote server is down", @@ -82,9 +82,9 @@ const char * const ChatAPICore::ms_errorStringsEnglish[] = "Duplicate voice", "Chat avatar must first be logged out", "No work to do", - "Cannot perform rename to NULL avatar name", + "Cannot perform rename to nullptr avatar name", "Cannot perform station acct transfer to stationID = 0", // 60 - "Cannot perform avatar move to NULL avatar address", + "Cannot perform avatar move to nullptr avatar address", "Failed to obtain an ID for a new room or avatar", "Room is local to namespace/world; cannot enter from other worlds", "Room is local to game; cannot enter from other game namespaces", @@ -122,7 +122,7 @@ ChatAPICore::ChatAPICore(const char *registrar_host, short registrar_port, const m_registrarPort(registrar_port), m_defaultServerPort(server_port), m_assignedServerPort(server_port), - m_timeSinceLastDisconnect(time(NULL)), + m_timeSinceLastDisconnect(time(nullptr)), m_rcvdRegistrarResponse(false), m_shouldSendVersion(true) { @@ -132,7 +132,7 @@ ChatAPICore::ChatAPICore(const char *registrar_host, short registrar_port, const ChatAPICore::~ChatAPICore() { - m_api = NULL; + m_api = nullptr; std::map::iterator iter = m_avatarCoreCache.begin(); for (; iter != m_avatarCoreCache.end(); ++iter) @@ -209,7 +209,7 @@ void ChatAPICore::cacheAvatar(ChatAvatarCore *avatarCore) ChatAvatarCore *ChatAPICore::getAvatarCore(unsigned avatarID) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; std::map::iterator iter = m_avatarCoreCache.find(avatarID); if(iter != m_avatarCoreCache.end()) @@ -221,7 +221,7 @@ ChatAvatarCore *ChatAPICore::getAvatarCore(unsigned avatarID) ChatAvatar *ChatAPICore::getAvatar(unsigned avatarID) { - ChatAvatar *returnAvatar = NULL; + ChatAvatar *returnAvatar = nullptr; std::map::iterator iter = m_avatarCache.find(avatarID); if(iter != m_avatarCache.end()) @@ -233,7 +233,7 @@ ChatAvatar *ChatAPICore::getAvatar(unsigned avatarID) ChatAvatarCore *ChatAPICore::decacheAvatar(unsigned avatarID) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; std::map::iterator iterCore = m_avatarCoreCache.find(avatarID); if(iterCore != m_avatarCoreCache.end()) { @@ -267,7 +267,7 @@ void ChatAPICore::cacheRoom(ChatRoomCore *roomCore) ChatRoomCore *ChatAPICore::getRoomCore(unsigned roomID) { - ChatRoomCore *returnRoom = NULL; + ChatRoomCore *returnRoom = nullptr; std::map::iterator iter = m_roomCoreCache.find(roomID); if(iter != m_roomCoreCache.end()) { @@ -279,7 +279,7 @@ ChatRoomCore *ChatAPICore::getRoomCore(unsigned roomID) ChatRoom *ChatAPICore::getRoom(unsigned roomID) { - ChatRoom *returnRoom = NULL; + ChatRoom *returnRoom = nullptr; std::map::iterator iter = m_roomCache.find(roomID); if(iter != m_roomCache.end()) { @@ -291,7 +291,7 @@ ChatRoom *ChatAPICore::getRoom(unsigned roomID) ChatRoomCore *ChatAPICore::decacheRoom(unsigned roomID) { - ChatRoomCore *returnRoom = NULL; + ChatRoomCore *returnRoom = nullptr; std::map::iterator iterCore = m_roomCoreCache.find(roomID); if(iterCore != m_roomCoreCache.end()) @@ -315,7 +315,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_LOGINAVATAR: { ResLoginAvatar *R = static_cast(res); - ChatAvatar *avatar = NULL; + ChatAvatar *avatar = nullptr; if(R->getAvatar()) { @@ -338,7 +338,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_TEMPORARYAVATAR: { ResTemporaryAvatar* R = static_cast(res); - ChatAvatar* avatar = NULL; + ChatAvatar* avatar = nullptr; if ( R->getAvatar() ) { @@ -394,8 +394,8 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_GETAVATAR: { ResGetAvatar *R = static_cast(res); - ChatAvatar *cachedAvatar = NULL; - ChatAvatar *avatar = NULL; + ChatAvatar *cachedAvatar = nullptr; + ChatAvatar *avatar = nullptr; ChatAvatarCore *avatarCore = R->getAvatar(); if (R->getResult() == 0 && avatarCore) // if success @@ -403,7 +403,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) // attempt to return locally cached avatar, if available cachedAvatar = getAvatar(avatarCore->getAvatarID()); - if (cachedAvatar != NULL) + if (cachedAvatar != nullptr) { // update cached information with returned data cachedAvatar->setAttributes(avatarCore->getAttributes()); @@ -427,7 +427,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) m_api->OnGetAvatar(R->getTrack(), R->getResult(), avatar, R->getUser()); - if (cachedAvatar == NULL) + if (cachedAvatar == nullptr) { delete avatar; } @@ -438,8 +438,8 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_GETANYAVATAR: { ResGetAnyAvatar *R = static_cast(res); - ChatAvatar *cachedAvatar = NULL; - ChatAvatar *avatar = NULL; + ChatAvatar *cachedAvatar = nullptr; + ChatAvatar *avatar = nullptr; ChatAvatarCore *avatarCore = R->getAvatar(); if (R->getResult() == 0 && avatarCore) // if success @@ -447,7 +447,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) // attempt to return locally cached avatar, if available cachedAvatar = getAvatar(avatarCore->getAvatarID()); - if (cachedAvatar != NULL) + if (cachedAvatar != nullptr) { // update cached information with returned data cachedAvatar->setAttributes(avatarCore->getAttributes()); @@ -471,7 +471,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) m_api->OnGetAnyAvatar(R->getTrack(), R->getResult(), avatar, R->isLoggedIn(), R->getUser()); - if (cachedAvatar == NULL) + if (cachedAvatar == nullptr) { delete avatar; } @@ -490,8 +490,8 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_SETAVATARATTRIBUTES: { ResSetAvatarAttributes *R = static_cast(res); - ChatAvatar *cachedAvatar = NULL; - ChatAvatar *avatar = NULL; + ChatAvatar *cachedAvatar = nullptr; + ChatAvatar *avatar = nullptr; ChatAvatarCore *avatarCore = R->getAvatar(); if (R->getResult() == 0 && avatarCore) // if success @@ -502,14 +502,14 @@ void ChatAPICore::responseCallback(GenericResponse *res) // attempt to return locally cached avatar, if available cachedAvatar = getAvatar(avatar->getAvatarID()); - if (cachedAvatar != NULL) + if (cachedAvatar != nullptr) { cachedAvatar->setAttributes(avatar->getAttributes()); } } } - if (cachedAvatar != NULL) + if (cachedAvatar != nullptr) { cachedAvatar = avatar; m_api->OnSetAvatarAttributes(R->getTrack(), R->getResult(), cachedAvatar, R->getUser()); @@ -531,8 +531,8 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_SETSTATUSMESSAGE: { ResSetAvatarStatusMessage *R = static_cast(res); - ChatAvatar *cachedAvatar = NULL; - ChatAvatar *avatar = NULL; + ChatAvatar *cachedAvatar = nullptr; + ChatAvatar *avatar = nullptr; ChatAvatarCore *avatarCore = R->getAvatar(); if (R->getResult() == 0 && avatarCore) // if success @@ -543,14 +543,14 @@ void ChatAPICore::responseCallback(GenericResponse *res) // attempt to return locally cached avatar, if available cachedAvatar = getAvatar(avatar->getAvatarID()); - if (cachedAvatar != NULL) + if (cachedAvatar != nullptr) { cachedAvatar->setStatusMessage(avatar->getStatusMessage()); } } } - if (cachedAvatar != NULL) + if (cachedAvatar != nullptr) { cachedAvatar = avatar; m_api->OnSetAvatarStatusMessage(R->getTrack(), R->getResult(), cachedAvatar, R->getUser()); @@ -572,8 +572,8 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_SETAVATAREMAIL: { ResSetAvatarForwardingEmail*R = static_cast(res); - ChatAvatar *cachedAvatar = NULL; - ChatAvatar *avatar = NULL; + ChatAvatar *cachedAvatar = nullptr; + ChatAvatar *avatar = nullptr; ChatAvatarCore *avatarCore = R->getAvatar(); if (R->getResult() == 0 && avatarCore) // if success @@ -584,14 +584,14 @@ void ChatAPICore::responseCallback(GenericResponse *res) // attempt to return locally cached avatar, if available cachedAvatar = getAvatar(avatar->getAvatarID()); - if (cachedAvatar != NULL) + if (cachedAvatar != nullptr) { cachedAvatar->setForwardingEmail(avatar->getForwardingEmail()); } } } - if (cachedAvatar != NULL) + if (cachedAvatar != nullptr) { cachedAvatar = avatar; m_api->OnSetAvatarForwardingEmail(R->getTrack(), R->getResult(), cachedAvatar, R->getUser()); @@ -613,8 +613,8 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_SETAVATARINBOXLIMIT: { ResSetAvatarInboxLimit *R = static_cast(res); - ChatAvatar *cachedAvatar = NULL; - ChatAvatar *avatar = NULL; + ChatAvatar *cachedAvatar = nullptr; + ChatAvatar *avatar = nullptr; ChatAvatarCore *avatarCore = R->getAvatar(); if (R->getResult() == 0 && avatarCore) // if success @@ -625,14 +625,14 @@ void ChatAPICore::responseCallback(GenericResponse *res) // attempt to return locally cached avatar, if available cachedAvatar = getAvatar(avatar->getAvatarID()); - if (cachedAvatar != NULL) + if (cachedAvatar != nullptr) { cachedAvatar->setInboxLimit(avatar->getInboxLimit()); } } } - if (cachedAvatar != NULL) + if (cachedAvatar != nullptr) { cachedAvatar = avatar; m_api->OnSetAvatarInboxLimit(R->getTrack(), R->getResult(), cachedAvatar, R->getUser()); @@ -654,13 +654,13 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_GETROOM: { ResGetRoom *R = static_cast(res); - ChatRoom *room = NULL; + ChatRoom *room = nullptr; ChatRoomCore *roomCore = R->getRoom(); if (R->getResult() == 0 && roomCore) // if success { unsigned roomid = roomCore->getRoomID(); - if (getRoomCore(roomid) == NULL) + if (getRoomCore(roomid) == nullptr) { // we need to cache this room first cacheRoom(roomCore); @@ -708,8 +708,8 @@ void ChatAPICore::responseCallback(GenericResponse *res) { ResCreateRoom *R = static_cast(res); - ChatRoom *room = NULL; - ChatRoomCore* roomCore = NULL; + ChatRoom *room = nullptr; + ChatRoomCore* roomCore = nullptr; if (R->getResult() == 0) // if success { @@ -939,7 +939,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) else if (!room && !roomCore) { // we didn't have room cached, and we didn't get one to cache, - // thus we'll have trouble giving a callback with a NULL pointer. + // thus we'll have trouble giving a callback with a nullptr pointer. _chatdebug_("ChatAPI:BadData: RESPONSE_ENTERROOM: avatar=%p, room=%p , roomCore=%p\n", avatar, room, roomCore); } } @@ -1175,8 +1175,8 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_FINDAVATARBYUID: { ResFindAvatarByUID *R = static_cast(res); - ChatAvatar **avatarMatches = NULL; - ChatAvatarCore **avatarCoreMatches = NULL; + ChatAvatar **avatarMatches = nullptr; + ChatAvatarCore **avatarCoreMatches = nullptr; unsigned numAvatarsOnline = R->getNumAvatarsOnline(); @@ -1374,7 +1374,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) // duplicate login from this API, then effectively // our API must consider him logged out because he's now // no longer logged in to his AID controller. - m_api->OnLogoutAvatar(0, 0, avatar, NULL); + m_api->OnLogoutAvatar(0, 0, avatar, nullptr); } } @@ -1476,7 +1476,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_GETAVATARKEYWORDS: { ResGetAvatarKeywords *R = static_cast(res); - ChatAvatar *avatar = NULL; + ChatAvatar *avatar = nullptr; if(R->getResult() == CHATRESULT_SUCCESS) { @@ -1494,7 +1494,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_SETAVATARKEYWORDS: { ResSetAvatarKeywords *R = static_cast(res); - ChatAvatar *avatar = NULL; + ChatAvatar *avatar = nullptr; if(R->getResult() == CHATRESULT_SUCCESS) { avatar = getAvatar(R->getAvatarID()); @@ -1510,8 +1510,8 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_SEARCHAVATARKEYWORDS: { ResSearchAvatarKeywords *R = static_cast(res); - ChatAvatar **avatarMatches = NULL; - ChatAvatarCore **avatarCoreMatches = NULL; + ChatAvatar **avatarMatches = nullptr; + ChatAvatarCore **avatarCoreMatches = nullptr; if(R->getResult() == CHATRESULT_SUCCESS) { @@ -1530,7 +1530,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_CONFIRMFRIEND: { ResFriendConfirm *R = static_cast(res); - ChatAvatar *avatar = NULL; + ChatAvatar *avatar = nullptr; if(R->getResult() == CHATRESULT_SUCCESS) { avatar = getAvatar(R->getAvatarID()); @@ -1546,7 +1546,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_CONFIRMFRIEND_RECIPROCATE: { ResFriendConfirmReciprocate *R = static_cast(res); - ChatAvatar *avatar = NULL; + ChatAvatar *avatar = nullptr; if(R->getResult() == CHATRESULT_SUCCESS) { avatar = getAvatar(R->getAvatarID()); @@ -1616,7 +1616,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_ADDSNOOPAVATAR: { ResAddSnoopAvatar *R = static_cast(res); - ChatAvatar *avatar = NULL; + ChatAvatar *avatar = nullptr; if(R->getResult() == CHATRESULT_SUCCESS) { avatar = getAvatar(R->getSrcAvatarID()); @@ -1632,7 +1632,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_REMOVESNOOPAVATAR: { ResRemoveSnoopAvatar *R = static_cast(res); - ChatAvatar *avatar = NULL; + ChatAvatar *avatar = nullptr; if(R->getResult() == CHATRESULT_SUCCESS) { avatar = getAvatar(R->getSrcAvatarID()); @@ -1648,7 +1648,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_ADDSNOOPROOM: { ResAddSnoopRoom *R = static_cast(res); - ChatAvatar *avatar = NULL; + ChatAvatar *avatar = nullptr; if(R->getResult() == CHATRESULT_SUCCESS) { avatar = getAvatar(R->getSrcAvatarID()); @@ -1664,7 +1664,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_REMOVESNOOPROOM: { ResRemoveSnoopRoom *R = static_cast(res); - ChatAvatar *avatar = NULL; + ChatAvatar *avatar = nullptr; if(R->getResult() == CHATRESULT_SUCCESS) { avatar = getAvatar(R->getSrcAvatarID()); @@ -1680,7 +1680,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_GETSNOOPLIST: { ResGetSnoopList *R = static_cast(res); - ChatAvatar *avatar = NULL; + ChatAvatar *avatar = nullptr; if(R->getResult() == CHATRESULT_SUCCESS) { avatar = getAvatar(R->getSrcAvatarID()); @@ -1691,8 +1691,8 @@ void ChatAPICore::responseCallback(GenericResponse *res) _chatdebug_("ChatAPI:BadData: RESPONSE_REMOVESNOOPROOM: avatar=%p\n", avatar); } - AvatarSnoopPair **avatarList = NULL; - ChatUnicodeString **roomList = NULL; + AvatarSnoopPair **avatarList = nullptr; + ChatUnicodeString **roomList = nullptr; unsigned numAvatars = R->getAvatarSnoopListLength(); unsigned numRooms = R->getRoomSnoopListLength(); @@ -1763,7 +1763,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) ChatAvatar *destAvatar = getAvatar(M.getDestList()[i]); if (!destAvatar) { - _chatdebug_("ChatAPI:BadData: MESSAGE_ROOMMESSAGE: destAvatar[%i]=NULL\n", i); + _chatdebug_("ChatAPI:BadData: MESSAGE_ROOMMESSAGE: destAvatar[%i]=nullptr\n", i); continue; } m_api->OnReceiveRoomMessage(srcAvatar, destAvatar, destRoom, ChatUnicodeString(M.getMsg().data(), M.getMsg().size()), ChatUnicodeString(M.getOOB().data(), M.getOOB().size())); @@ -1797,7 +1797,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) ChatAvatar *destAvatar = getAvatar(M.getDestList()[i]); if (!destAvatar) { - _chatdebug_("ChatAPI:BadData: MESSAGE_BROADCASTMESSAGE: destAvatar[%i]=NULL\n", i); + _chatdebug_("ChatAPI:BadData: MESSAGE_BROADCASTMESSAGE: destAvatar[%i]=nullptr\n", i); continue; } m_api->OnReceiveBroadcastMessage(srcAvatar, ChatUnicodeString(M.getSrcAddress().data(), M.getSrcAddress().size()), destAvatar, ChatUnicodeString(M.getMsg().data(), M.getMsg().size()), ChatUnicodeString(M.getOOB().data(), M.getOOB().size())); @@ -1877,7 +1877,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) ChatRoomCore *destRoomCore = getRoomCore(M.getRoomID()); if (!destRoomCore) { - _chatdebug_("ChatAPI:destroomCore is null!"); + _chatdebug_("ChatAPI:destroomCore is nullptr!"); break; } @@ -1889,7 +1889,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) ChatAvatar *destAvatar = M.getDestAvatar()->getNewChatAvatar(); ChatAvatar *srcAvatar = M.getSrcAvatar()->getNewChatAvatar(); - ChatAvatarCore *kickedAvatar = destRoomCore ? destRoomCore->removeAvatar(destAvatar->getAvatarID()) : NULL; + ChatAvatarCore *kickedAvatar = destRoomCore ? destRoomCore->removeAvatar(destAvatar->getAvatarID()) : nullptr; ChatRoom *destRoom = getRoom(M.getRoomID()); if (!srcAvatar || !destAvatar || !kickedAvatar || !destRoom) @@ -2439,12 +2439,12 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) ChatAvatar *srcAvatar = M.getSrcAvatar()->getNewChatAvatar(); if (!srcAvatar) { - _chatdebug_("ChatAPI:BadData: MESSAGE_ENTERROOM: srcAvatar=NULL\n"); + _chatdebug_("ChatAPI:BadData: MESSAGE_ENTERROOM: srcAvatar=nullptr\n"); delete M.getSrcAvatar(); break; } - bool isLocalAvatar = (getAvatar(srcAvatar->getAvatarID()) != NULL); + bool isLocalAvatar = (getAvatar(srcAvatar->getAvatarID()) != nullptr); if(!destRoomCore->addAvatar(M.getSrcAvatar(),isLocalAvatar)) { delete M.getSrcAvatar(); @@ -2492,10 +2492,10 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) if (destRoomCore) { ChatRoom *destRoom = getRoom(M.getRoomID()); - ChatAvatar *srcAvatar = NULL; + ChatAvatar *srcAvatar = nullptr; if (!M.getSrcAvatar()) { - _chatdebug_("ChatAPI:BadData: MESSAGE_DESTROYROOM: M.getSrcAvatar=NULL\n"); + _chatdebug_("ChatAPI:BadData: MESSAGE_DESTROYROOM: M.getSrcAvatar=nullptr\n"); } else { @@ -2527,7 +2527,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) ChatRoomCore *destRoomCore = getRoomCore(M.getRoomID()); if (!destRoomCore) { - _chatdebug_("ChatAPI:BadData: MESSAGE_SETROOMPARAMS: destRoomCore=NULL\n"); + _chatdebug_("ChatAPI:BadData: MESSAGE_SETROOMPARAMS: destRoomCore=nullptr\n"); break; } @@ -2544,7 +2544,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) if (!M.getSrcAvatar()) { - _chatdebug_("ChatAPI:BadData: MESSAGE_SETROOMPARAMS: M.getSrcAvatar=NULL\n"); + _chatdebug_("ChatAPI:BadData: MESSAGE_SETROOMPARAMS: M.getSrcAvatar=nullptr\n"); break; } ChatAvatar *srcAvatar = M.getSrcAvatar()->getNewChatAvatar(); @@ -2686,7 +2686,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) { MAddAdmin M(iter); ChatRoomCore *destRoomCore = getRoomCore(M.getRoomID()); - if (destRoomCore && (destRoomCore->addAdministrator(M.getAvatar()) == NULL)) + if (destRoomCore && (destRoomCore->addAdministrator(M.getAvatar()) == nullptr)) { delete (M.getAvatar()); } @@ -2696,7 +2696,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) { MRemoveAdmin M(iter); ChatRoomCore *destRoomCore = getRoomCore(M.getRoomID()); - ChatAvatarCore *admin = NULL; + ChatAvatarCore *admin = nullptr; if (destRoomCore) admin = destRoomCore->removeAdministrator(M.getAvatarID()); delete admin; @@ -2707,7 +2707,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) MFriendConfirmRequest M(iter); if (!M.getSrcAvatar()) { - _chatdebug_("ChatAPI:BadData: MESSAGE_FRIENDCONFIRMREQUEST: M.getSrcAvatar=NULL\n"); + _chatdebug_("ChatAPI:BadData: MESSAGE_FRIENDCONFIRMREQUEST: M.getSrcAvatar=nullptr\n"); break; } ChatAvatar *srcAvatar = M.getSrcAvatar()->getNewChatAvatar(); @@ -2730,7 +2730,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) if (!M.getSrcAvatar()) { - _chatdebug_("ChatAPI:BadData: MESSAGE_FRIENDCONFIRMRESPONSE: M.getSrcAvatar=NULL\n"); + _chatdebug_("ChatAPI:BadData: MESSAGE_FRIENDCONFIRMRESPONSE: M.getSrcAvatar=nullptr\n"); break; } ChatAvatar *srcAvatar = M.getSrcAvatar()->getNewChatAvatar(); @@ -2752,7 +2752,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) MFriendConfirmReciprocateRequest M(iter); if (!M.getSrcAvatar()) { - _chatdebug_("ChatAPI:BadData: MESSAGE_FRIENDCONFIRMRECIPROCATE_REQUEST: M.getSrcAvatar=NULL\n"); + _chatdebug_("ChatAPI:BadData: MESSAGE_FRIENDCONFIRMRECIPROCATE_REQUEST: M.getSrcAvatar=nullptr\n"); break; } ChatAvatar *srcAvatar = M.getSrcAvatar()->getNewChatAvatar(); @@ -2775,7 +2775,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) if (!M.getSrcAvatar()) { - _chatdebug_("ChatAPI:BadData: MESSAGE_FRIENDCONFIRMRECIPROCATE_RESPONSE: M.getSrcAvatar=NULL\n"); + _chatdebug_("ChatAPI:BadData: MESSAGE_FRIENDCONFIRMRECIPROCATE_RESPONSE: M.getSrcAvatar=nullptr\n"); break; } ChatAvatar *srcAvatar = M.getSrcAvatar()->getNewChatAvatar(); @@ -2799,7 +2799,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) ChatRoomCore *destRoomCore = getRoomCore(M.getDestRoomID()); if (!destRoomCore) { - _chatdebug_("ChatAPI:BadData: MESSAGE_CHANGEROOMOWNER: destRoomCore=NULL\n"); + _chatdebug_("ChatAPI:BadData: MESSAGE_CHANGEROOMOWNER: destRoomCore=nullptr\n"); break; } @@ -2822,7 +2822,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) if (!M.getRequestorAvatar()) { - _chatdebug_("ChatAPI:BadData: MESSAGE_REQUESTROOMENTRY: M.getRequestorAvatar=NULL\n"); + _chatdebug_("ChatAPI:BadData: MESSAGE_REQUESTROOMENTRY: M.getRequestorAvatar=nullptr\n"); break; } ChatAvatar *srcAvatar = M.getRequestorAvatar()->getNewChatAvatar(); @@ -3025,7 +3025,7 @@ void ChatAPICore::processAPI() } // if we've been disconnected for at least a minute... else if (!m_connected && - time(NULL) - m_timeSinceLastDisconnect >= 60) + time(nullptr) - m_timeSinceLastDisconnect >= 60) { if (m_setToRegistrar) { @@ -3043,7 +3043,7 @@ void ChatAPICore::processAPI() m_setToRegistrar = true; } - m_timeSinceLastDisconnect = time(NULL); + m_timeSinceLastDisconnect = time(nullptr); } @@ -3072,7 +3072,7 @@ void ChatAPICore::OnConnect(const char *host, short port) res->setTrack(m_currTrack); m_currTrack++; - time_t timeout = time(NULL) + m_requestTimeout; + time_t timeout = time(nullptr) + m_requestTimeout; req->setTimeout(timeout); res->setTimeout(timeout); @@ -3103,7 +3103,7 @@ void ChatAPICore::OnConnect(const char *host, short port) res->setTrack(m_currTrack); m_currTrack++; - time_t timeout = time(NULL) + m_requestTimeout; + time_t timeout = time(nullptr) + m_requestTimeout; req->setTimeout(timeout); res->setTimeout(timeout); @@ -3147,7 +3147,7 @@ void ChatAPICore::OnDisconnect(const char *host, short port) // stop processing immediately suspendProcessing(); - m_timeSinceLastDisconnect = time(NULL); + m_timeSinceLastDisconnect = time(nullptr); // determine who we disconnected from and take appropriate action if (strcmp(host, m_registrarHost.c_str()) == 0 && @@ -3214,7 +3214,7 @@ void ChatAPICore::failoverReloginOneAvatar(ChatAvatarCore * avatarCore) res->setTrack(m_currTrack); m_currTrack++; - time_t timeout = time(NULL) + m_requestTimeout; + time_t timeout = time(nullptr) + m_requestTimeout; req->setTimeout(timeout); res->setTimeout(timeout); @@ -3241,7 +3241,7 @@ void ChatAPICore::failoverRecreateRooms() { // first build multimap of rooms keyed by their node level (ascending order is default). multimap levelMap; - ChatRoomCore *roomCore = NULL; + ChatRoomCore *roomCore = nullptr; for (roomIter = m_roomCoreCache.begin(); roomIter != m_roomCoreCache.end(); ++roomIter) { roomCore = (*roomIter).second; @@ -3268,7 +3268,7 @@ void ChatAPICore::failoverRecreateRooms() res->setTrack(m_currTrack); m_currTrack++; - time_t timeout = time(NULL) + m_requestTimeout; + time_t timeout = time(nullptr) + m_requestTimeout; req->setTimeout(timeout); res->setTimeout(timeout); @@ -3296,7 +3296,7 @@ void ChatAPICore::failoverRecreateRooms() ChatAvatar *ChatAPICore::getAvatar(const ChatUnicodeString &avatarName, const ChatUnicodeString &avatarAddress) { - ChatAvatar *returnVal = NULL; + ChatAvatar *returnVal = nullptr; map::iterator iter = m_avatarCache.begin(); @@ -3317,7 +3317,7 @@ ChatAvatar *ChatAPICore::getAvatar(const ChatUnicodeString &avatarName, const Ch ChatRoom *ChatAPICore::getRoom(const ChatUnicodeString &roomAddress) { - ChatRoom *returnVal = NULL; + ChatRoom *returnVal = nullptr; map::iterator iter = m_roomCache.begin(); diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatEnum.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatEnum.cpp index fba1bc17..f18fac5d 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatEnum.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatEnum.cpp @@ -43,7 +43,7 @@ ChatUnicodeString::ChatUnicodeString(const std::string& nSrc) ChatUnicodeString::ChatUnicodeString(const char *nStrSrc) { - if (nStrSrc==NULL) + if (nStrSrc==nullptr) { m_wideString = getEmptyString(); m_cString = wideToNarrow(m_wideString); diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatFriendStatusCore.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatFriendStatusCore.cpp index c6eea945..653f0cbd 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatFriendStatusCore.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatFriendStatusCore.cpp @@ -7,7 +7,7 @@ namespace ChatSystem using namespace Base; using namespace Plat_Unicode; ChatFriendStatusCore::ChatFriendStatusCore() -: m_interface(NULL), +: m_interface(nullptr), m_status(0) { } @@ -31,7 +31,7 @@ ChatFriendStatusCore::~ChatFriendStatusCore() } ChatFriendStatus::ChatFriendStatus() -: m_core(NULL) +: m_core(nullptr) { } diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatIgnoreStatusCore.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatIgnoreStatusCore.cpp index 06717992..a3fefe08 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatIgnoreStatusCore.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatIgnoreStatusCore.cpp @@ -7,7 +7,7 @@ namespace ChatSystem using namespace Plat_Unicode; ChatIgnoreStatus::ChatIgnoreStatus() - : m_core(NULL) + : m_core(nullptr) { } @@ -16,7 +16,7 @@ namespace ChatSystem } ChatIgnoreStatusCore::ChatIgnoreStatusCore() - : m_interface(NULL) + : m_interface(nullptr) { } diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatRoom.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatRoom.cpp index d022aafa..cdd0238a 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatRoom.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatRoom.cpp @@ -581,7 +581,7 @@ unsigned RoomSummary::getRoomMaxSize() const ChatRoom::ChatRoom() { - m_core = NULL; + m_core = nullptr; } ChatRoom::ChatRoom(ChatRoomCore *core) diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatRoomCore.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatRoomCore.cpp index 715a943a..d0c70f68 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatRoomCore.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatRoomCore.cpp @@ -189,7 +189,7 @@ ChatRoomCore::~ChatRoomCore() ChatAvatarCore *ChatRoomCore::getAvatarCore(unsigned avatarID) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; map::iterator iterCore = m_inroomAvatarsCore.find(avatarID); @@ -202,7 +202,7 @@ ChatAvatarCore *ChatRoomCore::getAvatarCore(unsigned avatarID) ChatAvatar *ChatRoomCore::getAvatar(unsigned avatarID) { - ChatAvatar *returnAvatar = NULL; + ChatAvatar *returnAvatar = nullptr; map::iterator iter = m_inroomAvatars.find(avatarID); @@ -215,7 +215,7 @@ ChatAvatar *ChatRoomCore::getAvatar(unsigned avatarID) ChatAvatarCore *ChatRoomCore::getModeratorCore(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; set::iterator iterCore = m_moderatorAvatarsCore.begin(); @@ -238,7 +238,7 @@ ChatAvatarCore *ChatRoomCore::getModeratorCore(const Plat_Unicode::String &name, ChatAvatar *ChatRoomCore::getModerator(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - ChatAvatar *returnAvatar = NULL; + ChatAvatar *returnAvatar = nullptr; set::iterator iter = m_moderatorAvatars.begin(); @@ -263,7 +263,7 @@ ChatAvatar *ChatRoomCore::getModerator(const Plat_Unicode::String &name, const P ChatAvatarCore *ChatRoomCore::getBannedCore(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; set::iterator iterCore = m_banAvatarsCore.begin(); @@ -286,7 +286,7 @@ ChatAvatarCore *ChatRoomCore::getBannedCore(const Plat_Unicode::String &name, co ChatAvatar *ChatRoomCore::getBanned(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - ChatAvatar *returnAvatar = NULL; + ChatAvatar *returnAvatar = nullptr; set::iterator iter = m_banAvatars.begin(); @@ -311,7 +311,7 @@ ChatAvatar *ChatRoomCore::getBanned(const Plat_Unicode::String &name, const Plat ChatAvatarCore *ChatRoomCore::getInvitedCore(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; set::iterator iterCore = m_inviteAvatarsCore.begin(); @@ -334,7 +334,7 @@ ChatAvatarCore *ChatRoomCore::getInvitedCore(const Plat_Unicode::String &name, c ChatAvatar *ChatRoomCore::getInvited(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - ChatAvatar *returnAvatar = NULL; + ChatAvatar *returnAvatar = nullptr; set::iterator iter = m_inviteAvatars.begin(); @@ -359,7 +359,7 @@ ChatAvatar *ChatRoomCore::getInvited(const Plat_Unicode::String &name, const Pla ChatAvatarCore *ChatRoomCore::addAvatar(ChatAvatarCore *newAvatar, bool local) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; if(newAvatar) { @@ -394,7 +394,7 @@ void ChatRoomCore::addLocalAvatar(unsigned avatarID) ChatAvatarCore *ChatRoomCore::removeAvatar(unsigned avatarID) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; map::iterator iterCore = m_inroomAvatarsCore.find(avatarID); @@ -422,7 +422,7 @@ ChatAvatarCore *ChatRoomCore::removeAvatar(unsigned avatarID) ChatAvatarCore *ChatRoomCore::addBan(ChatAvatarCore *newAvatar) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; if(newAvatar) { @@ -446,7 +446,7 @@ ChatAvatarCore *ChatRoomCore::addBan(ChatAvatarCore *newAvatar) ChatAvatarCore *ChatRoomCore::removeBan(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; set::iterator iterCore = m_banAvatarsCore.begin(); @@ -494,7 +494,7 @@ ChatAvatarCore *ChatRoomCore::removeBan(const Plat_Unicode::String &name, const ChatAvatarCore *ChatRoomCore::addAdministrator(ChatAvatarCore *newAvatar) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; if(newAvatar) { @@ -518,7 +518,7 @@ ChatAvatarCore *ChatRoomCore::addAdministrator(ChatAvatarCore *newAvatar) ChatAvatarCore *ChatRoomCore::removeAdministrator(unsigned avatarID) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; map::iterator iterCore = m_adminAvatarsCore.find(avatarID); @@ -541,7 +541,7 @@ ChatAvatarCore *ChatRoomCore::removeAdministrator(unsigned avatarID) ChatAvatarCore *ChatRoomCore::addModerator(ChatAvatarCore *newAvatar) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; if(newAvatar) { @@ -565,7 +565,7 @@ ChatAvatarCore *ChatRoomCore::addModerator(ChatAvatarCore *newAvatar) ChatAvatarCore *ChatRoomCore::removeModerator(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; set::iterator iterCore = m_moderatorAvatarsCore.begin(); @@ -613,7 +613,7 @@ ChatAvatarCore *ChatRoomCore::removeModerator(const Plat_Unicode::String &name, ChatAvatarCore *ChatRoomCore::addTempModerator(ChatAvatarCore *newAvatar) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; if(newAvatar) { @@ -637,7 +637,7 @@ ChatAvatarCore *ChatRoomCore::addTempModerator(ChatAvatarCore *newAvatar) ChatAvatarCore *ChatRoomCore::removeTempModerator(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; set::iterator iterCore = m_tempModeratorAvatarsCore.begin(); @@ -685,7 +685,7 @@ ChatAvatarCore *ChatRoomCore::removeTempModerator(const Plat_Unicode::String &na ChatAvatarCore *ChatRoomCore::addInvite(ChatAvatarCore* newAvatar) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; if(newAvatar) { @@ -709,7 +709,7 @@ ChatAvatarCore *ChatRoomCore::addInvite(ChatAvatarCore* newAvatar) ChatAvatarCore *ChatRoomCore::removeInvite(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; set::iterator iterCore = m_inviteAvatarsCore.begin(); @@ -757,7 +757,7 @@ ChatAvatarCore *ChatRoomCore::removeInvite(const Plat_Unicode::String &name, con ChatAvatarCore *ChatRoomCore::addVoice(ChatAvatarCore* newAvatar) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; if(newAvatar) { @@ -781,7 +781,7 @@ ChatAvatarCore *ChatRoomCore::addVoice(ChatAvatarCore* newAvatar) ChatAvatarCore *ChatRoomCore::removeVoice(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; set::iterator iterCore = m_voiceAvatarsCore.begin(); @@ -1053,7 +1053,7 @@ void ChatRoomCore::serializeWithLocalAvatarsOnly(Base::ByteStream &msg) for (avatarIter = m_inroomAvatarsCore.begin(); avatarIter != m_inroomAvatarsCore.end(); ++avatarIter) { // include only the avatars that are on this API - if ( this->getAvatar((*avatarIter).second->getAvatarID()) != NULL ) + if ( this->getAvatar((*avatarIter).second->getAvatarID()) != nullptr ) { avatarsToSend.insert((*avatarIter).second); } diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Message.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Message.cpp index d38defbc..93e7e8e5 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Message.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Message.cpp @@ -21,7 +21,7 @@ namespace ChatSystem MRoomMessage::MRoomMessage(ByteStream::ReadIterator &iter) : GenericMessage(MESSAGE_ROOMMESSAGE), - m_destList(NULL), + m_destList(nullptr), m_srcAvatar(iter), m_messageID(0) { @@ -45,13 +45,13 @@ namespace ChatSystem MRoomMessage::~MRoomMessage() { delete[] m_destList; - m_destList = NULL; + m_destList = nullptr; } MBroadcastMessage::MBroadcastMessage(ByteStream::ReadIterator &iter) : GenericMessage(MESSAGE_BROADCASTMESSAGE), m_srcAvatar(iter), - m_destList(NULL) + m_destList(nullptr) { ASSERT_VALID_STRING_LENGTH(get(iter, m_srcAddress)); get(iter, m_listLength); @@ -68,7 +68,7 @@ namespace ChatSystem MBroadcastMessage::~MBroadcastMessage() { delete[] m_destList; - m_destList = NULL; + m_destList = nullptr; } MFilterMessage::MFilterMessage(ByteStream::ReadIterator &iter) diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/PersistentMessage.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/PersistentMessage.cpp index ca4b509e..bb9cfb82 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/PersistentMessage.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/PersistentMessage.cpp @@ -8,7 +8,7 @@ using namespace Base; using namespace Plat_Unicode; PersistentHeader::PersistentHeader() -: m_core(NULL) +: m_core(nullptr) { } @@ -66,7 +66,7 @@ PersistentHeaderCore::PersistentHeaderCore() m_avatarID(0), m_sentTime(0), m_status(0), - m_interface(NULL) + m_interface(nullptr) { } diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Request.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Request.cpp index 01afbcf7..2f7600ac 100644 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Request.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Request.cpp @@ -127,7 +127,7 @@ void RGetAvatarKeywords::pack(ByteStream &msg) RSearchAvatarKeywords::RSearchAvatarKeywords(const ChatUnicodeString &nodeAddress, const ChatUnicodeString *keywordsList, unsigned keywordsLength) : GenericRequest(REQUEST_SEARCHAVATARKEYWORDS), m_keywordsLength(keywordsLength), - m_keywordsList(NULL) + m_keywordsList(nullptr) { m_nodeAddress.assign(nodeAddress.string_data); m_keywordsList = new String[keywordsLength]; @@ -898,7 +898,7 @@ m_srcAddress(srcAddress.string_data, srcAddress.string_length), m_destRoomAddress(destRoomAddress.string_data, destRoomAddress.string_length) { // we take in a const RoomParams, so make our own and guarantee - // null-terminated char buffers. + // nullptr-terminated char buffers. m_newRoomName.assign(params->getRoomName().string_data, params->getRoomName().string_length); m_newRoomTopic.assign(params->getRoomTopic().string_data, params->getRoomTopic().string_length); m_newRoomPassword.assign(params->getRoomPassword().string_data, params->getRoomPassword().string_length); diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Response.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Response.cpp index 25d587fc..44a2f0dd 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Response.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Response.cpp @@ -20,7 +20,7 @@ using namespace Plat_Unicode; ResLoginAvatar::ResLoginAvatar(void *user, int avatarLoginPriority) : GenericResponse(RESPONSE_LOGINAVATAR, CHATRESULT_TIMEOUT, user), - m_avatar(NULL), + m_avatar(nullptr), m_submittedPriority(avatarLoginPriority), m_requiredPriority(INT_MAX) { @@ -63,7 +63,7 @@ void ResLoginAvatar::unpack(ByteStream::ReadIterator &iter) ResTemporaryAvatar::ResTemporaryAvatar(void *user) : GenericResponse(RESPONSE_TEMPORARYAVATAR, CHATRESULT_TIMEOUT, user) -, m_avatar(NULL) +, m_avatar(nullptr) { } @@ -110,7 +110,7 @@ void ResDestroyAvatar::unpack(ByteStream::ReadIterator &iter) ResGetAvatar::ResGetAvatar(void *user) : GenericResponse(RESPONSE_GETAVATAR, CHATRESULT_TIMEOUT, user), - m_avatar(NULL) + m_avatar(nullptr) { } @@ -144,7 +144,7 @@ void ResGetAvatar::unpack(ByteStream::ReadIterator &iter) ResGetAnyAvatar::ResGetAnyAvatar(void* user) : GenericResponse( RESPONSE_GETANYAVATAR, CHATRESULT_TIMEOUT, user ) - , m_avatar( NULL ) + , m_avatar( nullptr ) { } @@ -181,8 +181,8 @@ void ResGetAnyAvatar::unpack(Base::ByteStream::ReadIterator& iter) ResAvatarList::ResAvatarList(void *user) : GenericResponse(RESPONSE_AVATARLIST, CHATRESULT_TIMEOUT, user) , m_listLength(0) -, m_avatarList(NULL) -, m_cores(NULL) +, m_avatarList(nullptr) +, m_cores(nullptr) { } @@ -214,7 +214,7 @@ void ResAvatarList::unpack(ByteStream::ReadIterator &iter) ResSetAvatarAttributes::ResSetAvatarAttributes(void *user) : GenericResponse(RESPONSE_SETAVATARATTRIBUTES, CHATRESULT_TIMEOUT, user), - m_avatar(NULL) + m_avatar(nullptr) { } @@ -248,7 +248,7 @@ void ResSetAvatarAttributes::unpack(ByteStream::ReadIterator &iter) ResSetAvatarStatusMessage::ResSetAvatarStatusMessage(void *user) : GenericResponse(RESPONSE_SETSTATUSMESSAGE, CHATRESULT_TIMEOUT, user), -m_avatar(NULL) +m_avatar(nullptr) { } @@ -285,7 +285,7 @@ void ResSetAvatarStatusMessage::unpack(ByteStream::ReadIterator &iter) ResSetAvatarForwardingEmail::ResSetAvatarForwardingEmail(void *user) : GenericResponse(RESPONSE_SETAVATAREMAIL, CHATRESULT_TIMEOUT, user), - m_avatar(NULL) + m_avatar(nullptr) { } @@ -312,7 +312,7 @@ void ResSetAvatarForwardingEmail::unpack(ByteStream::ReadIterator &iter) ResSetAvatarInboxLimit::ResSetAvatarInboxLimit(void *user) : GenericResponse(RESPONSE_SETAVATARINBOXLIMIT, CHATRESULT_TIMEOUT, user), - m_avatar(NULL) + m_avatar(nullptr) { } @@ -340,7 +340,7 @@ void ResSetAvatarInboxLimit::unpack(ByteStream::ReadIterator &iter) ResSearchAvatarKeywords::ResSearchAvatarKeywords(void *user) : GenericResponse(RESPONSE_SETAVATARKEYWORDS, CHATRESULT_TIMEOUT, user), m_numMatches(0), - m_avatarMatches(NULL) + m_avatarMatches(nullptr) { } @@ -388,8 +388,8 @@ void ResSetAvatarKeywords::unpack(ByteStream::ReadIterator &iter) ResGetAvatarKeywords::ResGetAvatarKeywords(void *user, unsigned avatarID) : GenericResponse(RESPONSE_GETAVATARKEYWORDS, CHATRESULT_TIMEOUT, user), m_avatarID(avatarID), - m_keywordList(NULL), - m_chatStrList(NULL) + m_keywordList(nullptr), + m_chatStrList(nullptr) { } @@ -420,7 +420,7 @@ void ResGetAvatarKeywords::unpack(ByteStream::ReadIterator &iter) ResGetRoom::ResGetRoom(void *user) : GenericResponse(RESPONSE_GETROOM, CHATRESULT_TIMEOUT, user), - m_room(NULL), + m_room(nullptr), m_numExtraRooms(0) { } @@ -448,7 +448,7 @@ void ResGetRoom::unpack(ByteStream::ReadIterator &iter) ResCreateRoom::ResCreateRoom(void *user, unsigned avatarID) : GenericResponse(RESPONSE_CREATEROOM, CHATRESULT_TIMEOUT, user), m_srcAvatarID(avatarID), - m_room(NULL), + m_room(nullptr), m_numExtraRooms(0) { } @@ -637,8 +637,8 @@ ResFriendStatus::ResFriendStatus(void *user, unsigned avatarID) : GenericResponse(RESPONSE_FRIENDSTATUS, CHATRESULT_TIMEOUT, user), m_avatarID(avatarID), m_listLength(0), - m_friendList(NULL), - m_cores(NULL) + m_friendList(nullptr), + m_cores(nullptr) { } @@ -704,8 +704,8 @@ ResIgnoreStatus::ResIgnoreStatus(void *user, unsigned avatarID) : GenericResponse(RESPONSE_IGNORESTATUS, CHATRESULT_TIMEOUT, user), m_avatarID(avatarID), m_listLength(0), - m_ignoreList(NULL), - m_cores(NULL) + m_ignoreList(nullptr), + m_cores(nullptr) { } @@ -740,7 +740,7 @@ ResEnterRoom::ResEnterRoom(void *user, unsigned avatarID, const ChatUnicodeStrin m_avatarID(avatarID), m_destAddress(destAddress.string_data, destAddress.string_length), m_gotRoomObj(false), - m_room(NULL), + m_room(nullptr), m_numExtraRooms(0) { } @@ -1012,7 +1012,7 @@ void ResChangeRoomOwner::unpack(ByteStream::ReadIterator &iter) ResGetRoomSummaries::ResGetRoomSummaries(void *user) : GenericResponse(RESPONSE_GETROOMSUMMARIES, CHATRESULT_TIMEOUT, user), m_numRooms(0), - m_roomSummaries(NULL) + m_roomSummaries(nullptr) { } @@ -1132,8 +1132,8 @@ ResGetPersistentMessage::ResGetPersistentMessage(void *user, unsigned srcAvatarI : GenericResponse(RESPONSE_GETPERSISTENTMESSAGE, CHATRESULT_TIMEOUT, user), m_srcAvatarID(srcAvatarID), m_messageID(messageID), - m_core(NULL), - m_header(NULL) + m_core(nullptr), + m_header(nullptr) { } @@ -1167,7 +1167,7 @@ void ResGetPersistentMessage::unpack(ByteStream::ReadIterator &iter) ResGetMultiplePersistentMessages::ResGetMultiplePersistentMessages(void *user, unsigned srcAvatarID) : GenericResponse(RESPONSE_GETMULTIPLEPERSISTENTMESSAGES, CHATRESULT_TIMEOUT, user), m_srcAvatarID(srcAvatarID), - m_messages(NULL) + m_messages(nullptr) { } @@ -1217,8 +1217,8 @@ ResGetPersistentHeaders::ResGetPersistentHeaders(void *user, unsigned srcAvatarI : GenericResponse(RESPONSE_GETPERSISTENTHEADERS, CHATRESULT_TIMEOUT, user), m_srcAvatarID(srcAvatarID), m_listLength(0), - m_headers(NULL), - m_cores(NULL) + m_headers(nullptr), + m_cores(nullptr) { } @@ -1263,8 +1263,8 @@ ResGetPartialPersistentHeaders::ResGetPartialPersistentHeaders(void *user, unsig : GenericResponse(RESPONSE_PARTIALPERSISTENTHEADERS, CHATRESULT_TIMEOUT, user), m_srcAvatarID(srcAvatarID), m_listLength(0), - m_headers(NULL), - m_cores(NULL) + m_headers(nullptr), + m_cores(nullptr) { } @@ -1396,7 +1396,7 @@ void ResUnregisterRoom::unpack(ByteStream::ReadIterator &iter) } ResFailoverReloginAvatar::ResFailoverReloginAvatar(unsigned avatarID) -: GenericResponse(RESPONSE_FAILOVER_RELOGINAVATAR, CHATRESULT_TIMEOUT, NULL), +: GenericResponse(RESPONSE_FAILOVER_RELOGINAVATAR, CHATRESULT_TIMEOUT, nullptr), m_avatarID(avatarID) { } @@ -1414,9 +1414,9 @@ void ResFailoverReloginAvatar::unpack(ByteStream::ReadIterator &iter) } ResFailoverRecreateRoom::ResFailoverRecreateRoom(unsigned roomID, bool forced) -: GenericResponse(RESPONSE_FAILOVER_RECREATEROOM, CHATRESULT_TIMEOUT, NULL), +: GenericResponse(RESPONSE_FAILOVER_RECREATEROOM, CHATRESULT_TIMEOUT, nullptr), m_roomID(roomID), - m_room(NULL), + m_room(nullptr), m_forced(forced) { } @@ -1478,7 +1478,7 @@ void ResGetFanClubHandle::unpack(ByteStream::ReadIterator &iter) ResFindAvatarByUID::ResFindAvatarByUID(void *user) : GenericResponse(RESPONSE_FINDAVATARBYUID, CHATRESULT_TIMEOUT, user), m_numAvatarsOnline(0), - m_avatars(NULL) + m_avatars(nullptr) { } @@ -1512,7 +1512,7 @@ void ResFindAvatarByUID::unpack(ByteStream::ReadIterator &iter) } ResRegistrarGetChatServer::ResRegistrarGetChatServer() -: GenericResponse(RESPONSE_REGISTRAR_GETCHATSERVER, CHATRESULT_TIMEOUT, NULL) +: GenericResponse(RESPONSE_REGISTRAR_GETCHATSERVER, CHATRESULT_TIMEOUT, nullptr) { } @@ -1527,7 +1527,7 @@ void ResRegistrarGetChatServer::unpack(ByteStream::ReadIterator &iter) } ResSendApiVersion::ResSendApiVersion() -: GenericResponse(RESPONSE_SETAPIVERSION, CHATRESULT_TIMEOUT, NULL) +: GenericResponse(RESPONSE_SETAPIVERSION, CHATRESULT_TIMEOUT, nullptr) { } @@ -1600,8 +1600,8 @@ void ResRemoveSnoopRoom::unpack(ByteStream::ReadIterator &iter) ResGetSnoopList::ResGetSnoopList(void *user, unsigned srcAvatarID) : GenericResponse(RESPONSE_GETSNOOPLIST, CHATRESULT_TIMEOUT, user), m_srcAvatarID(srcAvatarID), - m_avatarSnoops(NULL), - m_roomSnoops(NULL) + m_avatarSnoops(nullptr), + m_roomSnoops(nullptr) { } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/Archive.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Base/Archive.cpp index c7a1b9a8..2d6b1839 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/Archive.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/Archive.cpp @@ -107,7 +107,7 @@ namespace Base ByteStream::ByteStream() : allocatedSize(0), beginReadIterator(), - data(NULL), + data(nullptr), size(0), lastPutSize(0) { @@ -224,7 +224,7 @@ namespace Base if(data->size < allocatedSize) { unsigned char * tmp = new unsigned char[newSize]; - if(data->buffer != NULL) + if(data->buffer != nullptr) memcpy(tmp, data->buffer, size); delete[] data->buffer; data->buffer = tmp; diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/AutoLog.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Base/AutoLog.cpp index 660d838d..24292a4e 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/AutoLog.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/AutoLog.cpp @@ -35,7 +35,7 @@ bool CAutoLog::Open(const char * filename) //------------------------------------- { - if( NULL == filename) + if( nullptr == filename) return false; if (pFilename) @@ -45,13 +45,13 @@ bool CAutoLog::Open(const char * filename) // Sanitize slashes char *ptr; - while ((ptr = strchr(pFilename,WRONGSLASH)) != NULL) + while ((ptr = strchr(pFilename,WRONGSLASH)) != nullptr) *ptr = SLASHCHAR[0]; char strPath[1024]; strcpy(strPath,pFilename); ptr = strrchr(strPath, SLASHCHAR[0]); - if (ptr != NULL) + if (ptr != nullptr) { *ptr = 0; @@ -59,11 +59,11 @@ bool CAutoLog::Open(const char * filename) char curdir[128]; // remember current directory - if( getcwd(curdir,sizeof(curdir)) == NULL ) + if( getcwd(curdir,sizeof(curdir)) == nullptr ) { fprintf(stderr,"CAutoLog::Archive failed to get current directory!\n"); free(pFilename); - pFilename = NULL; + pFilename = nullptr; return false; // error, can't proceed } @@ -74,7 +74,7 @@ bool CAutoLog::Open(const char * filename) { fprintf(stderr,"CAutoLog::Archive failed to make directory: %s\n", strPath); free(pFilename); - pFilename = NULL; + pFilename = nullptr; return false; // error, can't proceed } } @@ -94,7 +94,7 @@ bool CAutoLog::Open(const char * filename) { fprintf(stderr,"CAutoLog::Archive failed to make directory: %s\n", strPath); free(pFilename); - pFilename = NULL; + pFilename = nullptr; return false; // error, can't proceed } } @@ -103,7 +103,7 @@ bool CAutoLog::Open(const char * filename) pFile = fopen(pFilename,"a+"); - if( pFile == NULL || pFile == (FILE *)-1) + if( pFile == nullptr || pFile == (FILE *)-1) { //fprintf(stderr,"CAutoLog::Open failed to open log file: %s\n",pFilename); Close(); @@ -123,7 +123,7 @@ bool CAutoLog::Open(const char * filename) void CAutoLog::Close(void) //------------------------------------- { - if( pFile != (FILE *)-1 && pFile != NULL) + if( pFile != (FILE *)-1 && pFile != nullptr) { fclose(pFile); } @@ -131,7 +131,7 @@ void CAutoLog::Close(void) free(pFilename); - pFilename = NULL; + pFilename = nullptr; } //------------------------------------- @@ -194,7 +194,7 @@ void CAutoLog::LogDebug(char * format, ...) void CAutoLog::Log(eLogLevel severity, char *fmt, ...) //------------------------------------- { - if (pFile == (FILE *)-1 || pFile == NULL) + if (pFile == (FILE *)-1 || pFile == nullptr) { //fprintf(stderr,"CAutoLog::Log called with no file open!\n"); return; @@ -250,7 +250,7 @@ void CAutoLog::Log(eLogLevel severity, char *fmt, ...) void CAutoLog::Archive(void) //------------------------------------- { - if( pFile == (FILE *)-1 || pFile == NULL) + if( pFile == (FILE *)-1 || pFile == nullptr) { //fprintf(stderr,"CAutoLog::Archive called with no file open!\n"); return; @@ -281,7 +281,7 @@ void CAutoLog::Archive(void) strcpy(strCurrent,pFilename); pCurrent = strrchr(strCurrent, SLASHCHAR[0]); - if (pCurrent != NULL) + if (pCurrent != nullptr) *pCurrent = 0; else sprintf(strCurrent,"."); @@ -290,7 +290,7 @@ void CAutoLog::Archive(void) #ifdef WIN32 // remember current directory - if( getcwd(curdir,sizeof(curdir)) == NULL ) + if( getcwd(curdir,sizeof(curdir)) == nullptr ) { fprintf(stderr,"CAutoLog::Archive failed to get current directory!\n"); return; // error, can't proceed @@ -324,7 +324,7 @@ void CAutoLog::Archive(void) #endif pCurrent = strrchr(pFilename, SLASHCHAR[0]); - if (pCurrent == NULL) + if (pCurrent == nullptr) pCurrent = pFilename; else pCurrent++; diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/AutoLog.h b/external/3rd/library/soePlatform/ChatAPI/utils/Base/AutoLog.h index 0a90a774..18871c7f 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/AutoLog.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/AutoLog.h @@ -92,14 +92,14 @@ namespace Base //------------------------------------- inline CAutoLog::CAutoLog() { - pFilename = NULL; + pFilename = nullptr; pFile = (FILE *)-1; } //------------------------------------- inline CAutoLog::CAutoLog(const char * file) { - pFilename = NULL; + pFilename = nullptr; pFile = (FILE *)-1; Open(file); } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/CmdLine.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Base/CmdLine.cpp index b9d5b3e3..dcaf025a 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/CmdLine.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/CmdLine.cpp @@ -135,7 +135,7 @@ int CCmdLine::SplitLine(int argc, char **argv) bool CCmdLine::IsSwitch(const char *pParam) { - if (pParam==NULL) + if (pParam==nullptr) return false; // switches must non-empty @@ -204,7 +204,7 @@ StringType CCmdLine::GetSafeArgument(const char *pSwitch, int iIdx, const char * { StringType sRet; - if (pDefault!=NULL) + if (pDefault!=nullptr) sRet = pDefault; try diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/Config.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Base/Config.cpp index c5dd63d8..eb6dc55e 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/Config.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/Config.cpp @@ -28,7 +28,7 @@ bool CConfig::LoadFile(char * file) // open file fp = fopen(file, "r"); - if (fp == NULL || fp == (FILE *)-1) + if (fp == nullptr || fp == (FILE *)-1) { //fprintf(stderr,"Failed to open config file %s!",file); return false; @@ -71,21 +71,21 @@ void CConfig::UnloadFile(void) //----------------------------------- { delete[] pConfig; - pConfig = NULL; + pConfig = nullptr; } //----------------------------------- /// finds a key of the config in memory // key argument is case-insensitive, but must be upper case in config file -// Returns true for success (passing NULL is a special case returned as success) +// Returns true for success (passing nullptr is a special case returned as success) bool CConfig::FindKey(char *key) //----------------------------------- { - if (pConfig == NULL) + if (pConfig == nullptr) return false; // special case...continue with existing key - if (key == NULL) + if (key == nullptr) return true; // form the search key @@ -96,12 +96,12 @@ bool CConfig::FindKey(char *key) // find the key heading pCursor = strstr(pConfig,strBuffer); - if (pCursor==NULL) + if (pCursor==nullptr) return false; // find the closing bracket of key heading pCursor = strchr(pCursor,']'); - if (pCursor==NULL) + if (pCursor==nullptr) return false; pCursor++; @@ -110,7 +110,7 @@ bool CConfig::FindKey(char *key) //----------------------------------- /// extract a number from the config string -// pass the key to find the first number in the list, else NULL to find the next number in the list +// pass the key to find the first number in the list, else nullptr to find the next number in the list // returns 0 if no number is found, else returns the number long CConfig::GetLong(char *key) //----------------------------------- @@ -133,20 +133,20 @@ long CConfig::GetLong(char *key) //----------------------------------- /// extract string (in double-quotes) from the list. -// pass the key to find the first string in the list, else NULL to find the next string in the list -// returns NULL if no string found, else returns a temporary copy of the string (without quotes) +// pass the key to find the first string in the list, else nullptr to find the next string in the list +// returns nullptr if no string found, else returns a temporary copy of the string (without quotes) char * CConfig::GetString(char *key) //----------------------------------- { if (!FindKey(key)) - return NULL; + return nullptr; // look for start of string or end of key while (*pCursor && *pCursor != '"' && *pCursor != '[') pCursor++; if (*(pCursor++) != '"') - return NULL; + return nullptr; // until closing quote int c = 0; @@ -160,7 +160,7 @@ char * CConfig::GetString(char *key) } } - return NULL; + return nullptr; } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/Config.h b/external/3rd/library/soePlatform/ChatAPI/utils/Base/Config.h index 864506f3..6f6dc376 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/Config.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/Config.h @@ -10,7 +10,7 @@ ; list of strings, with code example # config.FindKey("NUMBERS"); -# while (number = config.GetLong(NULL)) +# while (number = config.GetLong(nullptr)) # YourHandleNumber(number); [NUMBERS] 100 200, 300 ; formatting is very flexible as long as numbers are delimited by non-numbers @@ -23,7 +23,7 @@ ; list of strings, with code example # config.FindKey("HOSTS"); -# while (string = config.GetString(NULL)) +# while (string = config.GetString(nullptr)) # YourHandleString(string); [HOSTS] "127.0.0.1:5999" @@ -68,16 +68,16 @@ namespace Base // returns TRUE if key is found. bool FindKey(char *key); - // extract string from config. If key is NULL, extract next string in list, else extract first string. - // if key was not found, returns NULL - char * GetString(char *key = NULL); + // extract string from config. If key is nullptr, extract next string in list, else extract first string. + // if key was not found, returns nullptr + char * GetString(char *key = nullptr); - // extract number from config. If key is NULL, extract next number in list, else extract first number. + // extract number from config. If key is nullptr, extract next number in list, else extract first number. // if key was not found, returns 0 - long GetLong(char *key = NULL); // extract number from config. + long GetLong(char *key = nullptr); // extract number from config. // indicate if config file has been loaded - inline bool FileLoaded() { return pConfig == NULL ? false : true; } + inline bool FileLoaded() { return pConfig == nullptr ? false : true; } private: char * pConfig; // pointer to file memory @@ -87,14 +87,14 @@ namespace Base inline CConfig::CConfig() { - pConfig = NULL; - pCursor = NULL; + pConfig = nullptr; + pCursor = nullptr; } inline CConfig::CConfig(char * file) { - pConfig = NULL; - pCursor = NULL; + pConfig = nullptr; + pCursor = nullptr; LoadFile(file); } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/Logger.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Base/Logger.cpp index 8942bfdd..4cdc4532 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/Logger.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/Logger.cpp @@ -120,7 +120,7 @@ Logger::Logger(const char *programName, void Logger::LoggerInit(const char *programName) { char buf[1024]; - FILE *logDir = NULL; + FILE *logDir = nullptr; if (0 != (m_combinedLogType & eUseLocalFile)) { @@ -129,13 +129,13 @@ void Logger::LoggerInit(const char *programName) { cmkdir(m_dirPrefix.c_str(), 0755); } - else if(logDir != NULL) + else if(logDir != nullptr) { fclose(logDir); } tm now; - time_t t = time(NULL); + time_t t = time(nullptr); LOGGER_GET_CURR_TIME(now, t); @@ -153,7 +153,7 @@ void Logger::LoggerInit(const char *programName) { cmkdir(buf, 0755); } - else if(logDir != NULL) + else if(logDir != nullptr) { fclose(logDir); } @@ -279,7 +279,7 @@ void Logger::addLog(const char *id, unsigned logenum, int level, unsigned size) else { newLog->file = fopen(newLog->filename.c_str(), "a+"); - if(newLog->file == NULL) + if(newLog->file == nullptr) { printf("Open file %s failed\n", newLog->filename.c_str()); } @@ -313,7 +313,7 @@ void Logger::addLog(const char *id, unsigned logenum) else { newLog->file = fopen(newLog->filename.c_str(), "a+"); - if(newLog->file == NULL) + if(newLog->file == nullptr) { printf("Open file %s failed\n", newLog->filename.c_str()); } @@ -368,7 +368,7 @@ void Logger::logSimple(unsigned logenum, int level, const char *message) { return; } - time_t t = time(NULL); + time_t t = time(nullptr); LogInfo *info = (*iter).second; if(level >= info->level) { @@ -444,7 +444,7 @@ void Logger::logSimpleWithSys(unsigned logenum, unsigned priority, int level, co { return; } - time_t t = time(NULL); + time_t t = time(nullptr); LogInfo *info = (*iter).second; if(level >= info->level) @@ -514,7 +514,7 @@ void Logger::log(unsigned logenum, int level, const char *message, ...) // ensure that the buf does not contain any '%' characters. // prevent crash problem char *rv; - while((rv = strchr(buf, '%')) != NULL) + while((rv = strchr(buf, '%')) != nullptr) { *rv = ' '; // replace with space } @@ -546,7 +546,7 @@ void Logger::logWithSys(unsigned logenum, unsigned priority, int level, const ch { return; } - time_t t = time(NULL); + time_t t = time(nullptr); LogInfo *info = (*iter).second; if(level >= info->level) @@ -604,14 +604,14 @@ void Logger::logWithSys(unsigned logenum, unsigned priority, int level, const ch void Logger::rollDate(time_t t) { char buf[80]; - FILE *logDir = NULL; + FILE *logDir = nullptr; logDir = fopen(m_dirPrefix.c_str(), "r+"); if(errno == ENOENT) { cmkdir(m_dirPrefix.c_str(), 0755); } - else if(logDir != NULL) + else if(logDir != nullptr) { fclose(logDir); } @@ -627,7 +627,7 @@ void Logger::rollDate(time_t t) { cmkdir(buf, 0755); } - else if(logDir != NULL) + else if(logDir != nullptr) { fclose(logDir); } @@ -711,7 +711,7 @@ void Logger::rollLog(LogInfo *logInfo) { std::string newLogName; char timeStampBuffer[256]; - time_t t = time(NULL); + time_t t = time(nullptr); tm now; int r; int nTries = 10; diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/Statistics.h b/external/3rd/library/soePlatform/ChatAPI/utils/Base/Statistics.h index 18e0579e..0856034b 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/Statistics.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/Statistics.h @@ -34,9 +34,9 @@ namespace Base bool commit = false; if (!mLastSampleTime) - mLastSampleTime = time(NULL); + mLastSampleTime = time(nullptr); - if (!mSampleFrequency || mLastSampleTime + mSampleFrequency < (unsigned)time(NULL)) + if (!mSampleFrequency || mLastSampleTime + mSampleFrequency < (unsigned)time(nullptr)) { mSampleTotal++; mAggregateTotal += value; diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/TemplateObjectAllocator.h b/external/3rd/library/soePlatform/ChatAPI/utils/Base/TemplateObjectAllocator.h index 40227673..ed1a7937 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/TemplateObjectAllocator.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/TemplateObjectAllocator.h @@ -93,7 +93,7 @@ namespace Base void Destroy(TYPE *object) { - if (object == NULL) + if (object == nullptr) return; #ifdef USE_ALLOCATOR_MUTEX @@ -142,7 +142,7 @@ namespace Base void FastDestroy(TYPE *object) { - if (object == NULL) + if (object == nullptr) return; object->~TYPE(); diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/WideString.h b/external/3rd/library/soePlatform/ChatAPI/utils/Base/WideString.h index 775f9713..28159b18 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/WideString.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/WideString.h @@ -94,12 +94,12 @@ namespace ucs2 } //////////////////////////////////////// - // target string is a null-terminated C string + // target string is a nullptr-terminated C string inline string::string(const char * copy) : mLength(0), mData(8,0) { - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!copy) { return; @@ -111,12 +111,12 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *copy++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; } //////////////////////////////////////// - // target string is a C string that may or may not include null characters + // target string is a C string that may or may not include nullptr characters inline string::string(const std::string & copy) : mLength(copy.length()), mData(8,0) @@ -126,17 +126,17 @@ namespace ucs2 // (2) perform transform to copy the narrow string to our // wide string std::transform(copy.begin(), copy.end(), mData.begin(), NarrowToWide); - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength] = 0; } //////////////////////////////////////// - // target string is a wide null-terminated C string + // target string is a wide nullptr-terminated C string inline string::string(const char_type * copy) : mLength(0), mData(8,0) { - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!copy) { return; @@ -148,7 +148,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *copy++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; } @@ -169,7 +169,7 @@ namespace ucs2 inline string & string::operator=(const char * rhs) { mLength = 0; - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!rhs) { mData[0] = 0; @@ -182,7 +182,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } @@ -195,7 +195,7 @@ namespace ucs2 // (2) perform transform to copy the narrow string to our // wide string std::transform(rhs.begin(), rhs.end(), mData.begin(), NarrowToWide); - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength] = 0; return *this; } @@ -203,7 +203,7 @@ namespace ucs2 inline string & string::operator=(const char_type * rhs) { mLength = 0; - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!rhs) { mData[0] = 0; @@ -216,7 +216,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } @@ -235,7 +235,7 @@ namespace ucs2 inline string & string::operator+=(const char * rhs) { - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!rhs) { return *this; @@ -247,7 +247,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } @@ -259,7 +259,7 @@ namespace ucs2 // (2) perform transform to copy the narrow string to our // wide string std::transform(rhs.begin(), rhs.end(), mData.begin()+mLength, NarrowToWide); - // (3) ensure null termination + // (3) ensure nullptr termination mLength += rhs.length(); mData[mLength] = 0; return *this; @@ -267,7 +267,7 @@ namespace ucs2 inline string & string::operator+=(const char_type * rhs) { - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!rhs) { return *this; @@ -279,7 +279,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } @@ -388,7 +388,7 @@ namespace ucs2 inline string & string::assign(const char_type * rhs) { mLength = 0; - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!rhs) { mData[0] = 0; @@ -401,7 +401,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } @@ -409,7 +409,7 @@ namespace ucs2 inline string & string::assign(const char_type * rhs, size_type count) { mLength = 0; - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!rhs) { mData[0] = 0; @@ -422,7 +422,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } @@ -463,7 +463,7 @@ namespace ucs2 inline string & string::assign(const char_type * first, const char_type * last) { mLength = 0; - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!first || !last) { mData[0] = 0; @@ -476,14 +476,14 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *first++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } inline string & string::append(const char_type * rhs) { - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!rhs) { return *this; @@ -495,14 +495,14 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } inline string & string::append(const char_type * rhs, size_type count) { - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!rhs) { return *this; @@ -514,7 +514,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } @@ -558,7 +558,7 @@ namespace ucs2 inline string & string::append(const char_type * first, const char_type * last) { - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!first || !last) { return *this; @@ -570,7 +570,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *first++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/BlockAllocator.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/BlockAllocator.cpp index 4cefb9e7..29d91074 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/BlockAllocator.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/BlockAllocator.cpp @@ -12,7 +12,7 @@ namespace Base { for(unsigned i = 0; i < 31; i++) { - m_blocks[i] = NULL; + m_blocks[i] = nullptr; } } @@ -21,7 +21,7 @@ namespace Base // free all allocated memory blocks for(unsigned i = 0; i < 31; i++) { - while(m_blocks[i] != NULL) + while(m_blocks[i] != nullptr) { unsigned *tmp = m_blocks[i]; m_blocks[i] = (unsigned *)*m_blocks[i]; @@ -36,7 +36,7 @@ namespace Base void *BlockAllocator::getBlock(unsigned bytes) { unsigned accum = 16, bits = 16; - unsigned *handle = NULL; + unsigned *handle = nullptr; // Perform a binary search looking for the highest bit. @@ -96,7 +96,7 @@ namespace Base void BlockAllocator::returnBlock(unsigned *handle) { - // C++ allows for safe deletion of a NULL pointer + // C++ allows for safe deletion of a nullptr pointer if(handle) { // Update the allocator linked list, insert this entry at the head diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/Event.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/Event.cpp index a3cce3b1..72190595 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/Event.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/Event.cpp @@ -26,8 +26,8 @@ namespace Base mCond(), mThreadCount(0) { - pthread_mutex_init(&mMutex, NULL); - pthread_cond_init(&mCond, NULL); + pthread_mutex_init(&mMutex, nullptr); + pthread_cond_init(&mCond, nullptr); } CEvent::~CEvent() @@ -74,7 +74,7 @@ namespace Base struct timeval now; struct timespec abs_timeout; - gettimeofday(&now, NULL); + gettimeofday(&now, nullptr); abs_timeout.tv_sec = now.tv_sec + timeout/1000; abs_timeout.tv_nsec = now.tv_usec * 1000 + (timeout%1000)*1000000; abs_timeout.tv_sec += abs_timeout.tv_nsec / 1000000000; diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/Thread.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/Thread.cpp index a4b1e3a2..f5bc4629 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/Thread.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/Thread.cpp @@ -77,8 +77,8 @@ namespace Base CThreadPool::CMember::CMember(CThreadPool * parent) : mParent(parent), - mFunction(NULL), - mArgument(NULL), + mFunction(nullptr), + mArgument(nullptr), mSemaphore() { StartThread(); @@ -117,8 +117,8 @@ namespace Base if (mFunction) { mFunction(mArgument); - mArgument = NULL; - mFunction = NULL; + mArgument = nullptr; + mFunction = nullptr; } else if (mParent->OnDestory(this)) mThreadContinue = false; @@ -173,7 +173,7 @@ namespace Base } //////////////////////////////////////// - // (3) Delete the null member threads + // (3) Delete the nullptr member threads mMutex.Lock(); while (!mNullMember.empty()) { @@ -224,7 +224,7 @@ namespace Base } //////////////////////////////////////// - // (2) Delete any null member threads. + // (2) Delete any nullptr member threads. while (!mNullMember.empty()) { delete mNullMember.front(); diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/serialize.h b/external/3rd/library/soePlatform/ChatAPI/utils/Base/serialize.h index 650681b5..ed38802a 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/serialize.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/serialize.h @@ -501,8 +501,8 @@ namespace soe } else { - //find null terminator, if don't find it before maxLen, then err - const unsigned char *strEnd = NULL; + //find nullptr terminator, if don't find it before maxLen, then err + const unsigned char *strEnd = nullptr; unsigned strLen = 0; for (;strLensetTrack(m_currTrack); res->setTrack(m_currTrack); - time_t timeout = time(NULL) + m_requestTimeout; + time_t timeout = time(nullptr) + m_requestTimeout; req->setTimeout(timeout); res->setTimeout(timeout); @@ -125,7 +125,7 @@ unsigned GenericAPICore::submitRequest(GenericRequest *req, GenericResponse *res } req->setTrack(m_currTrack); res->setTrack(m_currTrack); - time_t timeout = time(NULL) + reqTimeout; + time_t timeout = time(nullptr) + reqTimeout; req->setTimeout(timeout); res->setTimeout(timeout); @@ -140,7 +140,7 @@ void GenericAPICore::process() GenericResponse *res; // Process timeout on pending requests - regardless of whether processing is suspended or not - while((m_outCount > 0) && ((req = m_outboundQueue.front().first)->getTimeout() <= time(NULL))) + while((m_outCount > 0) && ((req = m_outboundQueue.front().first)->getTimeout() <= time(nullptr))) { --m_outCount; res = m_outboundQueue.front().second; @@ -152,7 +152,7 @@ void GenericAPICore::process() } // Process timeout on pending responses - while((m_pendingCount > 0) && ((res = (*m_pending.begin()).second)->getTimeout() <= time(NULL))) + while((m_pendingCount > 0) && ((res = (*m_pending.begin()).second)->getTimeout() <= time(nullptr))) { --m_pendingCount; m_pending.erase(m_pending.begin()); @@ -165,7 +165,7 @@ void GenericAPICore::process() while(m_outCount > 0) { GenericConnection *con = getNextActiveConnection(); - if (con != NULL) + if (con != nullptr) { pair out_pair = m_outboundQueue.front(); @@ -184,7 +184,7 @@ void GenericAPICore::process() else { #ifdef USE_SERIALIZE_LIB - const unsigned char *msgBuf = NULL; + const unsigned char *msgBuf = nullptr; unsigned msgSize = 0; msgBuf = req->pack(msgSize); con->Send(msgBuf, msgSize); @@ -222,7 +222,7 @@ GenericConnection *GenericAPICore::getNextActiveConnection() unsigned startIndex = m_nextConnectionIndex; unsigned maxIndex = m_serverConnections.size() - 1; - GenericConnection *con = NULL; + GenericConnection *con = nullptr; //loop until we find an active connection, or until we get back // to where we started @@ -242,7 +242,7 @@ GenericConnection *GenericAPICore::getNextActiveConnection() //went past end of vector, start back at 0 m_nextConnectionIndex = 0; } - }while (con == NULL && m_nextConnectionIndex != startIndex); + }while (con == nullptr && m_nextConnectionIndex != startIndex); return con; } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericConnection.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericConnection.cpp index 3b677c70..3c878e0a 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericConnection.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericConnection.cpp @@ -28,7 +28,7 @@ unsigned GenericConnection::ms_crcBytes = 0; GenericConnection::GenericConnection(const char *host, short port, GenericAPICore *apiCore, unsigned reconnectTimeout, unsigned noDataTimeoutSecs, unsigned noAckTimeoutSecs, unsigned incomingBufSizeInKB, unsigned outgoingBufSizeInKB, unsigned keepAlive, unsigned maxRecvMessageSizeInKB, unsigned holdTime) : m_bConnected(false), m_apiCore(apiCore), - m_con(NULL), + m_con(nullptr), m_host(host), m_nextHost(host), m_port(port), @@ -72,8 +72,8 @@ GenericConnection::~GenericConnection() { if(m_con) { - m_con->SetHandler(NULL); - m_con->Disconnect();//don't worry about onterminated being called, we've set it's handler to null, so it wont + m_con->SetHandler(nullptr); + m_con->Disconnect();//don't worry about onterminated being called, we've set it's handler to nullptr, so it wont m_con->Release(); } @@ -96,7 +96,7 @@ void GenericConnection::disconnect() { m_con->Disconnect(); //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); - m_con = NULL; + m_con = nullptr; } m_conState = CON_DISCONNECT; m_bConnected = false; @@ -112,7 +112,7 @@ void GenericConnection::OnTerminated(UdpConnection *con) if(m_con) { m_con->Release(); - m_con = NULL; + m_con = nullptr; } m_conState = CON_DISCONNECT; m_bConnected = false; @@ -146,7 +146,7 @@ void GenericConnection::OnRoutePacket(UdpConnection *con, const unsigned char *d get(iter, type); get(iter, track); #endif - GenericResponse *res = NULL; + GenericResponse *res = nullptr; // the following if block is a temporary fix that prevents // a crash with a game team in which they occasionally find @@ -208,7 +208,7 @@ void GenericConnection::process(bool giveTime) { m_con->SetHandler(this); m_conState = CON_NEGOTIATE; - m_conTimeout = time(NULL) + m_reconnectTimeout; + m_conTimeout = time(nullptr) + m_reconnectTimeout; } break; case CON_NEGOTIATE: @@ -225,12 +225,12 @@ void GenericConnection::process(bool giveTime) m_apiCore->OnConnect(m_host.c_str(), m_port); m_bConnected = true; } - else if(time(NULL) > m_conTimeout) + else if(time(nullptr) > m_conTimeout) { // we did not connect m_con->Disconnect(); //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); - m_con = NULL; + m_con = nullptr; m_conState = CON_DISCONNECT; m_bConnected = false; } @@ -246,7 +246,7 @@ void GenericConnection::process(bool giveTime) { m_con->Disconnect(); //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); - m_con = NULL; + m_con = nullptr; } } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpConnection.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpConnection.cpp index c9952e9a..df2137bd 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpConnection.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpConnection.cpp @@ -96,7 +96,7 @@ void UdpConnection::Init(UdpManager *udpManager, UdpPlatformAddress destIp, int mLastClockSyncTime = 0; mDataHoldTime = 0; mGettingTime = false; - mHandler = NULL; + mHandler = nullptr; mOtherSideProtocolVersion = 0; mNoDataTimeout = mUdpManager->mParams.noDataTimeout; @@ -108,7 +108,7 @@ void UdpConnection::Init(UdpManager *udpManager, UdpPlatformAddress destIp, int mIcmpErrorRetryStartStamp = 0; // when the timer started for ICMP error retry delay (gets reset on a successful packet receive) mPortRemapRequestStartStamp = 0; - mEncryptXorBuffer = NULL; + mEncryptXorBuffer = nullptr; mEncryptExpansionBytes = 0; mOrderedCountOutgoing = 0; mOrderedCountOutgoing2 = 0; @@ -120,7 +120,7 @@ void UdpConnection::Init(UdpManager *udpManager, UdpPlatformAddress destIp, int mConnectAttemptTimeout = 0; mConnectionCreateTime = mUdpManager->CachedClock(); mSimulateOutgoingQueueBytes = 0; - mPassThroughData = NULL; + mPassThroughData = nullptr; mSilentDisconnect = false; mLastSendBin = 0; @@ -140,7 +140,7 @@ UdpConnection::~UdpConnection() { UdpGuard myGuard(&mGuard); - assert(mUdpManager == NULL); // this should not be possible, since the UdpManager holds a reference to us until we are disconnected and disassociated from the manager. If you are hitting this, then odds are the application is releasing the UdpConnection object more times than it should + assert(mUdpManager == nullptr); // this should not be possible, since the UdpManager holds a reference to us until we are disconnected and disassociated from the manager. If you are hitting this, then odds are the application is releasing the UdpConnection object more times than it should for (int i = 0; i < cReliableChannelCount; i++) delete mChannel[i]; @@ -189,7 +189,7 @@ void UdpConnection::InternalDisconnect(int flushTimeout, DisconnectReason reason if (mStatus == cStatusNegotiating) flushTimeout = 0; - if (mUdpManager != NULL) + if (mUdpManager != nullptr) { if (flushTimeout > 0) { @@ -219,7 +219,7 @@ void UdpConnection::InternalDisconnect(int flushTimeout, DisconnectReason reason } UdpManager *holdUdpManager = mUdpManager; - mUdpManager = NULL; + mUdpManager = nullptr; mStatus = cStatusDisconnected; // only hold a reference to the UdpManager if it is not currently being destructed. @@ -274,7 +274,7 @@ bool UdpConnection::Send(UdpChannel channel, const void *data, int dataLen) if (dataLen == 0) // zero length packets are ignored return(false); - assert(data != NULL); // can't send a null packet + assert(data != nullptr); // can't send a nullptr packet // zero-escape application packets that start with 0 if ((*(const udp_uchar *)data) == 0) @@ -290,7 +290,7 @@ bool UdpConnection::Send(UdpChannel channel, const LogicalPacket *packet) { UdpGuard myGuard(&mGuard); - assert(packet != NULL); // can't send a null packet + assert(packet != nullptr); // can't send a nullptr packet if (mStatus != cStatusConnected) // if we are no longer connected return(false); @@ -337,7 +337,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const udp_uchar *data, int { udp_uchar *bufPtr = tempBuffer; memcpy(bufPtr, data, dataLen); - if (data2 != NULL) + if (data2 != nullptr) memcpy(bufPtr + dataLen, data2, dataLen2); PhysicalSend(bufPtr, totalDataLen, true); return(true); @@ -350,9 +350,9 @@ bool UdpConnection::InternalSend(UdpChannel channel, const udp_uchar *data, int bufPtr[1] = cUdpPacketOrdered; UdpMisc::PutValue16(bufPtr + 2, (udp_ushort)(++mOrderedCountOutgoing & 0xffff)); memcpy(bufPtr + 4, data, dataLen); - if (data2 != NULL) + if (data2 != nullptr) memcpy(bufPtr + 4 + dataLen, data2, dataLen2); - BufferedSend(bufPtr, totalDataLen + 4, NULL, 0, true); + BufferedSend(bufPtr, totalDataLen + 4, nullptr, 0, true); return(true); break; } @@ -363,7 +363,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const udp_uchar *data, int bufPtr[1] = cUdpPacketOrdered2; UdpMisc::PutValue16(bufPtr + 2, (udp_ushort)(++mOrderedCountOutgoing2 & 0xffff)); memcpy(bufPtr + 4, data, dataLen); - if (data2 != NULL) + if (data2 != nullptr) memcpy(bufPtr + 4 + dataLen, data2, dataLen2); PhysicalSend(bufPtr, totalDataLen + 4, true); return(true); @@ -375,7 +375,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const udp_uchar *data, int case cUdpChannelReliable4: { int num = channel - cUdpChannelReliable1; - if (mChannel[num] == NULL) + if (mChannel[num] == nullptr) mChannel[num] = new UdpReliableChannel(num, this, &mUdpManager->mParams.reliable[num]); mChannel[num]->Send(data, dataLen, data2, dataLen2); return(true); @@ -410,9 +410,9 @@ void UdpConnection::GetStats(UdpConnectionStatistics *cs) { UdpGuard myGuard(&mGuard); - assert(cs != NULL); + assert(cs != nullptr); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; *cs = mConnectionStats; @@ -428,7 +428,7 @@ void UdpConnection::GetStats(UdpConnectionStatistics *cs) if (cs->syncTheirSent > 0) cs->percentReceivedSuccess = (float)cs->syncOurReceived / (float)cs->syncTheirSent; cs->reliableAveragePing = 0; - if (mChannel[0] != NULL) + if (mChannel[0] != nullptr) cs->reliableAveragePing = mChannel[0]->GetAveragePing(); } @@ -437,7 +437,7 @@ void UdpConnection::ProcessRawPacket(const UdpManager::PacketHistoryEntry *e) UdpRef ref(this); UdpGuard guard(&mGuard); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; if (e->mLen == 0) @@ -572,7 +572,7 @@ void UdpConnection::ProcessRawPacket(const UdpManager::PacketHistoryEntry *e) *decryptPtr++ = finalStart[1]; int len = (this->*(mDecryptFunction[j]))(decryptPtr, finalStart + 2, finalLen - 2); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; if (len == -1) @@ -627,7 +627,7 @@ void UdpConnection::ProcessCookedPacket(const udp_uchar *data, int dataLen) { udp_uchar buf[256]; udp_uchar *bufPtr; - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; if (data[0] == 0 && dataLen > 1) @@ -826,7 +826,7 @@ void UdpConnection::ProcessCookedPacket(const udp_uchar *data, int dataLen) // (while processing this packet) ended up touching the packet-data and corrupting the next // packet in the multi-sequence. CallbackCorruptPacket(data, dataLen, cUdpCorruptionReasonMultiPacket); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; } else @@ -943,7 +943,7 @@ void UdpConnection::ProcessCookedPacket(const udp_uchar *data, int dataLen) case cUdpPacketFragment4: { int num = (data[1] - cUdpPacketReliable1) % cReliableChannelCount; - if (mChannel[num] == NULL) + if (mChannel[num] == nullptr) mChannel[num] = new UdpReliableChannel(num, this, &mUdpManager->mParams.reliable[num]); mChannel[num]->ReliablePacket(data, dataLen); break; @@ -954,7 +954,7 @@ void UdpConnection::ProcessCookedPacket(const udp_uchar *data, int dataLen) case cUdpPacketAck4: { int num = data[1] - cUdpPacketAck1; - if (mChannel[num] != NULL) + if (mChannel[num] != nullptr) mChannel[num]->AckPacket(data, dataLen); break; } @@ -964,7 +964,7 @@ void UdpConnection::ProcessCookedPacket(const udp_uchar *data, int dataLen) case cUdpPacketAckAll4: { int num = data[1] - cUdpPacketAckAll1; - if (mChannel[num] != NULL) + if (mChannel[num] != nullptr) mChannel[num]->AckAllPacket(data, dataLen); break; } @@ -1015,7 +1015,7 @@ void UdpConnection::FlagPortUnreachable() void UdpConnection::GiveTime(bool fromManager) { UdpGuard myGuard(&mGuard); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; if (fromManager && GetRefCount() == 2) @@ -1115,11 +1115,11 @@ void UdpConnection::InternalGiveTime() int totalPendingBytes = 0; for (int i = 0; i < cReliableChannelCount; i++) { - if (mChannel[i] != NULL) + if (mChannel[i] != nullptr) { totalPendingBytes += mChannel[i]->TotalPendingBytes(); int myNext = mChannel[i]->GiveTime(); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; // giving the reliable channel time caused it to callback the application which may disconnect us nextSchedule = udpMin(nextSchedule, myNext); } @@ -1208,7 +1208,7 @@ void UdpConnection::InternalGiveTime() break; } - if (mUdpManager != NULL) + if (mUdpManager != nullptr) { // safety to prevent us for scheduling ourselves for a time period that has already passed, // as doing so could result in infinite looping in the priority queue processing. @@ -1227,7 +1227,7 @@ int UdpConnection::TotalPendingBytes() const int total = 0; for (int i = 0; i < cReliableChannelCount; i++) { - if (mChannel[i] != NULL) + if (mChannel[i] != nullptr) total += mChannel[i]->TotalPendingBytes(); } return(total); @@ -1293,7 +1293,7 @@ void UdpConnection::ExpireReceiveBin() void UdpConnection::PhysicalSend(const udp_uchar *data, int dataLen, bool appendAllowed) { - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; // if we attempt to do a physical send (ie. encrypt/compress/crc a packet) while we are not connected @@ -1322,7 +1322,7 @@ void UdpConnection::PhysicalSend(const udp_uchar *data, int dataLen, bool append // we know this internal packet will not be a connect or confirm packet since they are sent directly to RawSend to avoid getting encrypted *destPtr++ = finalStart[1]; int len = (this->*(mEncryptFunction[j]))(destPtr, finalStart + 2, finalLen - 2); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; // if this assert triggers, it means the encryption pass expanded the size of the encrypted @@ -1393,8 +1393,8 @@ void UdpConnection::PhysicalSend(const udp_uchar *data, int dataLen, bool append // can note where the ack was placed and replace it udp_uchar *UdpConnection::BufferedSend(const udp_uchar *data, int dataLen, const udp_uchar *data2, int dataLen2, bool appendAllowed) { - if (mUdpManager == NULL) - return(NULL); + if (mUdpManager == nullptr) + return(nullptr); int used = (int)(mMultiBufferPtr - mMultiBufferData); int actualMaxDataHoldSize = udpMin(mUdpManager->mParams.maxDataHoldSize, mConnectionConfig.maxRawPacketSize); @@ -1409,7 +1409,7 @@ udp_uchar *UdpConnection::BufferedSend(const udp_uchar *data, int dataLen, const FlushMultiBuffer(); // now send it (the multi-buffer is empty if you need to use it temporarily to concatenate two data chunks -- it is large enough to hold the largest raw packet) - if (data2 != NULL) + if (data2 != nullptr) { memcpy(mMultiBufferData, data, dataLen); memcpy(mMultiBufferData + dataLen, data2, dataLen2); @@ -1417,7 +1417,7 @@ udp_uchar *UdpConnection::BufferedSend(const udp_uchar *data, int dataLen, const } else PhysicalSend(data, dataLen, appendAllowed); - return(NULL); + return(nullptr); } // if this data will not fit into buffer @@ -1445,7 +1445,7 @@ udp_uchar *UdpConnection::BufferedSend(const udp_uchar *data, int dataLen, const udp_uchar *placementPtr = mMultiBufferPtr; memcpy(mMultiBufferPtr, data, dataLen); mMultiBufferPtr += dataLen; - if (data2 != NULL) + if (data2 != nullptr) { memcpy(mMultiBufferPtr, data2, dataLen2); mMultiBufferPtr += dataLen2; @@ -1454,7 +1454,7 @@ udp_uchar *UdpConnection::BufferedSend(const udp_uchar *data, int dataLen, const if ((mMultiBufferPtr - mMultiBufferData) >= actualMaxDataHoldSize) { FlushMultiBuffer(); - placementPtr = NULL; // it got flushed + placementPtr = nullptr; // it got flushed } return(placementPtr); } @@ -1474,7 +1474,7 @@ void UdpConnection::FlushMultiBuffer() // notify all the reliable channels to clear their buffered acks for (int i = 0; i < cReliableChannelCount; i++) { - if (mChannel[i] != NULL) + if (mChannel[i] != nullptr) { mChannel[i]->ClearBufferedAck(); } @@ -1684,7 +1684,7 @@ void UdpConnection::SetupEncryptModel() mEncryptExpansionBytes += 0; // set up encrypt buffer (random numbers generated based on seed) - if (mEncryptXorBuffer == NULL) + if (mEncryptXorBuffer == nullptr) { int len = ((mUdpManager->mParams.maxRawPacketSize + 1) / 4) * 4; mEncryptXorBuffer = new udp_uchar[len]; @@ -1718,7 +1718,7 @@ void UdpConnection::GetChannelStatus(UdpChannel channel, ChannelStatus *channelS case cUdpChannelReliable2: case cUdpChannelReliable3: case cUdpChannelReliable4: - if (mChannel[channel - cUdpChannelReliable1] != NULL) + if (mChannel[channel - cUdpChannelReliable1] != nullptr) { mChannel[channel - cUdpChannelReliable1]->GetChannelStatus(channelStatus); } @@ -1763,7 +1763,7 @@ char *UdpConnection::GetDestinationString(char *buf, int bufLen) const UdpGuard myGuard(&mGuard); if (bufLen < 22) - return(NULL); + return(nullptr); UdpPlatformAddress ip = GetDestinationIp(); int port = GetDestinationPort(); char hold[256]; @@ -1794,7 +1794,7 @@ void UdpConnection::OnRoutePacket(const udp_uchar *data, int dataLen) { UdpGuard myGuard(&mHandlerGuard); - if (mHandler != NULL) + if (mHandler != nullptr) { mHandler->OnRoutePacket(this, data, dataLen); } @@ -1814,7 +1814,7 @@ void UdpConnection::OnRoutePacket(const udp_uchar *data, int dataLen) void UdpConnection::OnConnectComplete() { UdpGuard myGuard(&mHandlerGuard); - if (mHandler != NULL) + if (mHandler != nullptr) { mHandler->OnConnectComplete(this); } @@ -1823,7 +1823,7 @@ void UdpConnection::OnConnectComplete() void UdpConnection::OnTerminated() { UdpGuard myGuard(&mHandlerGuard); - if (mHandler != NULL) + if (mHandler != nullptr) { mHandler->OnTerminated(this); } @@ -1832,7 +1832,7 @@ void UdpConnection::OnTerminated() void UdpConnection::OnCrcReject(const udp_uchar *data, int dataLen) { UdpGuard myGuard(&mHandlerGuard); - if (mHandler != NULL) + if (mHandler != nullptr) { mHandler->OnCrcReject(this, data, dataLen); } @@ -1841,7 +1841,7 @@ void UdpConnection::OnCrcReject(const udp_uchar *data, int dataLen) void UdpConnection::OnPacketCorrupt(const udp_uchar *data, int dataLen, UdpCorruptionReason reason) { UdpGuard myGuard(&mHandlerGuard); - if (mHandler != NULL) + if (mHandler != nullptr) { mHandler->OnPacketCorrupt(this, data, dataLen, reason); } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpConnection.h b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpConnection.h index 9d64e460..253e9139 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpConnection.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpConnection.h @@ -153,7 +153,7 @@ class UdpConnection : public UdpGuardedRefCount, public PriorityQueueMember, pub int ConnectionAge() const; // returns the UdpManager object that is managing this connection - // will return NULL if the connection has been disconnected for some reason (because disconnecting severes the link to UdpManager) + // will return nullptr if the connection has been disconnected for some reason (because disconnecting severes the link to UdpManager) UdpManager *GetUdpManager() const; // returns the 32-bit encryption-code that was negotiated as part of the connection-establishment process. @@ -234,9 +234,9 @@ class UdpConnection : public UdpGuardedRefCount, public PriorityQueueMember, pub friend class UdpManager; friend class UdpReliableChannel; - // note: if connectPacket is NULL, that means this connection object is being created to establish + // note: if connectPacket is nullptr, that means this connection object is being created to establish // a new connection to the specified ip/port (ie. the connection starts out in cStatusNegotiating mode) - // if connectPacket is non-NULL, that menas this connection object is being created to handle an + // if connectPacket is non-nullptr, that menas this connection object is being created to handle an // incoming connect request and it will start out in cStatusConnected mode. UdpConnection(UdpManager *udpManager, UdpPlatformAddress destIp, int destPort, int timeout); // starts connection-establishment protocol UdpConnection(UdpManager *udpManager, const UdpManager::PacketHistoryEntry *e); // starts already connected, replying to connection request @@ -281,7 +281,7 @@ class UdpConnection : public UdpGuardedRefCount, public PriorityQueueMember, pub void RawSend(const udp_uchar *data, int dataLen); // nothing happens to the data here, it is given to the udpmanager and sent out the port void PhysicalSend(const udp_uchar *data, int dataLen, bool appendAllowed); // sends a physical packet (encrypts and adds crc bytes) udp_uchar *BufferedSend(const udp_uchar *data, int dataLen, const udp_uchar *data2, int dataLen2, bool appendAllowed); // buffers logical packets waiting til we have more data (makes multi-packets) - bool InternalSend(UdpChannel channel, const udp_uchar *data, int dataLen, const udp_uchar *data2 = NULL, int dataLen2 = 0); + bool InternalSend(UdpChannel channel, const udp_uchar *data, int dataLen, const udp_uchar *data2 = nullptr, int dataLen2 = 0); void InternalGiveTime(); void InternalDisconnect(int flushTimeout, DisconnectReason reason); @@ -527,7 +527,7 @@ inline void UdpConnection::ScheduleTimeNow() // prevents us from reprioritizing to 0, only to shortly thereafter be reprioritized to where we actually belong. if (!mGettingTime) { - if (mUdpManager != NULL) + if (mUdpManager != nullptr) mUdpManager->SetPriority(this, 0); } } @@ -575,7 +575,7 @@ inline int UdpConnection::LastReceive(UdpClockStamp useStamp) const inline int UdpConnection::LastReceive() const { UdpGuard guard(&mGuard); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return(0); return(mUdpManager->CachedClockElapsed(mLastReceiveTime)); } @@ -583,7 +583,7 @@ inline int UdpConnection::LastReceive() const inline int UdpConnection::ConnectionAge() const { UdpGuard guard(&mGuard); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return(0); return(mUdpManager->CachedClockElapsed(mConnectionCreateTime)); } @@ -591,7 +591,7 @@ inline int UdpConnection::ConnectionAge() const inline int UdpConnection::LastSend() const { UdpGuard guard(&mGuard); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return(0); return(mUdpManager->CachedClockElapsed(mLastSendTime)); } @@ -599,7 +599,7 @@ inline int UdpConnection::LastSend() const inline udp_ushort UdpConnection::ServerSyncStampShort() const { UdpGuard guard(&mGuard); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return(0); return((udp_ushort)(mUdpManager->LocalSyncStampShort() + (mSyncTimeDelta & 0xffff))); } @@ -607,7 +607,7 @@ inline udp_ushort UdpConnection::ServerSyncStampShort() const inline udp_uint UdpConnection::ServerSyncStampLong() const { UdpGuard guard(&mGuard); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return(0); return(mUdpManager->LocalSyncStampLong() + mSyncTimeDelta); } @@ -649,7 +649,7 @@ inline UdpConnection::DisconnectReason UdpConnection::GetOtherSideDisconnectReas inline int UdpConnection::OutgoingBytesLastSecond() { UdpGuard guard(&mGuard); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return(0); ExpireSendBin(); @@ -659,7 +659,7 @@ inline int UdpConnection::OutgoingBytesLastSecond() inline int UdpConnection::IncomingBytesLastSecond() { UdpGuard guard(&mGuard); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return(0); ExpireReceiveBin(); diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpDriverLinux.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpDriverLinux.cpp index da7bcc5c..aa11f5cd 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpDriverLinux.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpDriverLinux.cpp @@ -101,7 +101,7 @@ bool UdpPlatformDriver::SocketOpen(int port, int incomingBufferSize, int outgoin addr_loc.sin_family = PF_INET; addr_loc.sin_port = htons((unsigned short)port); addr_loc.sin_addr.s_addr = htonl(INADDR_ANY); - if (bindIpAddress != NULL && bindIpAddress[0] != 0) + if (bindIpAddress != nullptr && bindIpAddress[0] != 0) { unsigned long address = inet_addr(bindIpAddress); if (address != INADDR_NONE) @@ -201,7 +201,7 @@ bool UdpPlatformDriver::GetHostByName(UdpPlatformAddress *ipAddress, const char { struct hostent *lphp; lphp = gethostbyname(hostName); - if (lphp == NULL) + if (lphp == nullptr) { address = 0; } @@ -223,7 +223,7 @@ bool UdpPlatformDriver::GetSelfAddress(UdpPlatformAddress *ipAddress, bool prefe if (gethostname(hostname, sizeof(hostname)) == 0) { struct hostent *entry = gethostbyname(hostname); - if (entry != NULL) + if (entry != nullptr) { for (int i = 0; entry->h_addr_list[i] != 0; i++) { @@ -273,7 +273,7 @@ UdpClockStamp UdpPlatformDriver::Clock() UdpGuard guard(&mData->clockGuard); struct timeval tv; - gettimeofday(&tv, NULL); + gettimeofday(&tv, nullptr); UdpClockStamp cs = static_cast(tv.tv_sec) * 1000 + static_cast(tv.tv_usec / 1000); cs += mData->currentCorrection; if (cs < mData->lastStamp) @@ -319,7 +319,7 @@ int IcmpReceive(SOCKET socket, unsigned *address, int *port) return(-1); struct cmsghdr *cmsg; - for(cmsg = CMSG_FIRSTHDR(&msgh); cmsg != NULL; cmsg = CMSG_NXTHDR(&msgh, cmsg)) + for(cmsg = CMSG_FIRSTHDR(&msgh); cmsg != nullptr; cmsg = CMSG_NXTHDR(&msgh, cmsg)) { if(cmsg->cmsg_level == SOL_IP && cmsg->cmsg_type == IP_RECVERR) { @@ -378,7 +378,7 @@ void *GoThread(void *param) thread->mThreadData->running = false; thread->mThreadData->handle = 0; thread->Release(); - return(NULL); + return(nullptr); } UdpPlatformThreadObject::~UdpPlatformThreadObject() @@ -435,7 +435,7 @@ char *UdpPlatformAddress::GetAddress(char *buffer, int bufferLen) const *buffer = 0; return(buffer); } - assert(buffer != NULL); + assert(buffer != nullptr); sprintf(buffer, "%d.%d.%d.%d", mData[0], mData[1], mData[2], mData[3]); return(buffer); } @@ -444,7 +444,7 @@ void UdpPlatformAddress::SetAddress(const char *address) { for (int i = 0; i < 4; i++) { - mData[i] = (unsigned char)strtol(address, NULL, 10); + mData[i] = (unsigned char)strtol(address, nullptr, 10); while (*address >= '0' && *address <= '9') address++; if (*address != 0) diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpDriverWindows.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpDriverWindows.cpp index 04c0c4d0..4a2a80e7 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpDriverWindows.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpDriverWindows.cpp @@ -102,7 +102,7 @@ bool UdpPlatformDriver::SocketOpen(int port, int incomingBufferSize, int outgoin addr_loc.sin_family = PF_INET; addr_loc.sin_port = htons((unsigned short)port); addr_loc.sin_addr.s_addr = htonl(INADDR_ANY); - if (bindIpAddress != NULL && bindIpAddress[0] != 0) + if (bindIpAddress != nullptr && bindIpAddress[0] != 0) { unsigned long address = inet_addr(bindIpAddress); if (address != INADDR_NONE) @@ -205,7 +205,7 @@ bool UdpPlatformDriver::GetHostByName(UdpPlatformAddress *ipAddress, const char { struct hostent *lphp; lphp = gethostbyname(hostName); - if (lphp == NULL) + if (lphp == nullptr) { address = 0; } @@ -227,7 +227,7 @@ bool UdpPlatformDriver::GetSelfAddress(UdpPlatformAddress *ipAddress, bool prefe if (gethostname(hostname, sizeof(hostname)) == 0) { struct hostent *entry = gethostbyname(hostname); - if (entry != NULL) + if (entry != nullptr) { for (int i = 0; entry->h_addr_list[i] != 0; i++) { @@ -329,10 +329,10 @@ unsigned __stdcall GoThread(void *param) UdpPlatformThreadObject::~UdpPlatformThreadObject() { #ifndef UDPLIBRARY_SINGLE_THREAD - if (mThreadData->handle != NULL) + if (mThreadData->handle != nullptr) { CloseHandle(mThreadData->handle); - mThreadData->handle = NULL; + mThreadData->handle = nullptr; } #endif delete mThreadData; @@ -343,7 +343,7 @@ void UdpPlatformThreadObject::Start() AddRef(); #ifndef UDPLIBRARY_SINGLE_THREAD unsigned threadId; - mThreadData->handle = (HANDLE)_beginthreadex(NULL, 0, &GoThread, this, 0, &threadId); + mThreadData->handle = (HANDLE)_beginthreadex(nullptr, 0, &GoThread, this, 0, &threadId); #else GoThread(this); // run it inline in main thread (blocks til it's finished, so odds are it won't work, but they shouldn't be using it anyhow in this mode) #endif @@ -352,7 +352,7 @@ void UdpPlatformThreadObject::Start() UdpPlatformThreadObject::UdpPlatformThreadObject() { mThreadData = new UdpPlatformThreadData; - mThreadData->handle = NULL; + mThreadData->handle = nullptr; mThreadData->running = false; } @@ -389,7 +389,7 @@ char *UdpPlatformAddress::GetAddress(char *buffer, int bufferLen) const *buffer = 0; return(buffer); } - assert(buffer != NULL); + assert(buffer != nullptr); sprintf(buffer, "%d.%d.%d.%d", mData[0], mData[1], mData[2], mData[3]); return(buffer); } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpHashTable.h b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpHashTable.h index 10af003d..9f24044e 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpHashTable.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpHashTable.h @@ -38,11 +38,11 @@ template class HashTable bool Remove(T& obj, int hashValue); void Reset(); // removes all entries from the table - T *FindFirst(int hashValue) const; // returns NULL if not found - T *FindNext(T *prevResult) const; // returns NULL if not found + T *FindFirst(int hashValue) const; // returns nullptr if not found + T *FindNext(T *prevResult) const; // returns nullptr if not found - T *WalkFirst() const; // returns NULL if not found - T *WalkNext(T *prevResult) const; // returns NULL if not found + T *WalkFirst() const; // returns nullptr if not found + T *WalkNext(T *prevResult) const; // returns nullptr if not found void Resize(int hashSize); // the actual hash size will be rounded up to the next larger prime number (very slow, not recommended) void GetStatistics(HashTableStatistics *stats) const; @@ -64,7 +64,7 @@ template class HashTable template HashTable::HashTable(int hashSize) { - mTable = NULL; + mTable = nullptr; mTableSize = 0; mEntryCount = 0; mStatUsedSlots = 0; @@ -84,9 +84,9 @@ template void HashTable::Insert(T& obj, int hashValue) entry->hashValue = hashValue; int spot = ((unsigned)hashValue) % mTableSize; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) { - entry->nextEntry = NULL; + entry->nextEntry = nullptr; mTable[spot] = entry; mStatUsedSlots++; } @@ -103,14 +103,14 @@ template bool HashTable::Remove(T& obj, int hashValue) int spot = ((unsigned)hashValue) % mTableSize; HashEntry* next = mTable[spot]; HashEntry** prev = &mTable[spot]; - while (next != NULL) + while (next != nullptr) { if (next->obj == obj && next->hashValue == hashValue) { *prev = next->nextEntry; delete next; mEntryCount--; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) mStatUsedSlots--; return(true); break; @@ -127,17 +127,17 @@ template void HashTable::Reset() for (int spot = 0; spot < mTableSize; spot++) { HashEntry *curr = mTable[spot]; - if (curr != NULL) + if (curr != nullptr) { mStatUsedSlots--; - while (curr != NULL) + while (curr != nullptr) { HashEntry *next = curr->nextEntry; delete curr; mEntryCount--; curr = next; } - mTable[spot] = NULL; + mTable[spot] = nullptr; } } } @@ -145,13 +145,13 @@ template void HashTable::Reset() template T *HashTable::FindFirst(int hashValue) const { HashEntry *entry = mTable[((unsigned)hashValue) % mTableSize]; - while (entry != NULL) + while (entry != nullptr) { if (entry->hashValue == hashValue) return(&entry->obj); entry = entry->nextEntry; } - return(NULL); + return(nullptr); } template T *HashTable::FindNext(T *prevResult) const @@ -159,13 +159,13 @@ template T *HashTable::FindNext(T *prevResult) const HashEntry *entry = (HashEntry *)(((char *)prevResult) - offsetof(HashEntry, obj)); int hashValue = entry->hashValue; entry = entry->nextEntry; - while (entry != NULL) + while (entry != nullptr) { if (entry->hashValue == hashValue) return(&entry->obj); entry = entry->nextEntry; } - return(NULL); + return(nullptr); } template T *HashTable::WalkFirst() const @@ -173,10 +173,10 @@ template T *HashTable::WalkFirst() const for (int bucket = 0; bucket < mTableSize; bucket++) { HashEntry *entry = mTable[bucket]; - if (entry != NULL) + if (entry != nullptr) return(&entry->obj); } - return(NULL); + return(nullptr); } template T *HashTable::WalkNext(T *prevResult) const @@ -185,17 +185,17 @@ template T *HashTable::WalkNext(T *prevResult) const int bucket = ((unsigned)entry->hashValue) % mTableSize; entry = entry->nextEntry; - if (entry != NULL) + if (entry != nullptr) return(&entry->obj); bucket++; // go onto next bucket for (; bucket < mTableSize; bucket++) { HashEntry *entry = mTable[bucket]; - if (entry != NULL) + if (entry != nullptr) return(&entry->obj); } - return(NULL); + return(nullptr); } template void HashTable::Resize(int hashSize) @@ -215,16 +215,16 @@ template void HashTable::Resize(int hashSize) for (int i = 0; i < oldSize; i++) { HashEntry* next = oldTable[i]; - while (next != NULL) + while (next != nullptr) { HashEntry* hold = next; next = next->nextEntry; // insert hold into new table int spot = ((unsigned)hold->hashValue) % mTableSize; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) { - hold->nextEntry = NULL; + hold->nextEntry = nullptr; mTable[spot] = hold; mStatUsedSlots++; } @@ -284,11 +284,11 @@ template class ObjectHashTable bool Remove(T *obj); void Reset(); // removes all entries from the table - T *FindFirst(int hashValue) const; // returns NULL if not found - T *FindNext(T *prevResult) const; // returns NULL if not found + T *FindFirst(int hashValue) const; // returns nullptr if not found + T *FindNext(T *prevResult) const; // returns nullptr if not found - T *WalkFirst() const; // returns NULL if not found - T *WalkNext(T *prevResult) const; // returns NULL if not found + T *WalkFirst() const; // returns nullptr if not found + T *WalkNext(T *prevResult) const; // returns nullptr if not found void Resize(int hashSize); // the actual hash size will be rounded up to the next larger prime number (very slow, not recommended) void GetStatistics(HashTableStatistics *stats) const; @@ -303,7 +303,7 @@ template class ObjectHashTable template ObjectHashTable::ObjectHashTable(int hashSize) { - mTable = NULL; + mTable = nullptr; mTableSize = 0; mEntryCount = 0; mStatUsedSlots = 0; @@ -320,9 +320,9 @@ template void ObjectHashTable::Insert(T *obj, int static_cast(obj)->mHashValue = hashValue; int spot = ((unsigned)hashValue) % mTableSize; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) { - static_cast(obj)->mHashNextEntry = NULL; + static_cast(obj)->mHashNextEntry = nullptr; mTable[spot] = obj; mStatUsedSlots++; } @@ -339,14 +339,14 @@ template bool ObjectHashTable::Remove(T *obj) int spot = ((unsigned)static_cast(obj)->mHashValue) % mTableSize; T *cur = mTable[spot]; T **prev = &mTable[spot]; - while (cur != NULL) + while (cur != nullptr) { if (cur == obj) { *prev = static_cast(cur)->mHashNextEntry; - static_cast(cur)->mHashNextEntry = NULL; + static_cast(cur)->mHashNextEntry = nullptr; mEntryCount--; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) mStatUsedSlots--; return(true); break; @@ -368,13 +368,13 @@ template void ObjectHashTable::Reset() template T *ObjectHashTable::FindFirst(int hashValue) const { T *entry = mTable[((unsigned)hashValue) % mTableSize]; - while (entry != NULL) + while (entry != nullptr) { if (static_cast(entry)->mHashValue == hashValue) return(entry); entry = static_cast(entry)->mHashNextEntry; } - return(NULL); + return(nullptr); } template T *ObjectHashTable::FindNext(T *prevResult) const @@ -382,13 +382,13 @@ template T *ObjectHashTable::FindNext(T *prevResul T *entry = prevResult; int hashValue = static_cast(entry)->mHashValue; entry = static_cast(entry)->mHashNextEntry; - while (entry != NULL) + while (entry != nullptr) { if (static_cast(entry)->mHashValue == hashValue) return(entry); entry = static_cast(entry)->mHashNextEntry; } - return(NULL); + return(nullptr); } template T *ObjectHashTable::WalkFirst() const @@ -396,10 +396,10 @@ template T *ObjectHashTable::WalkFirst() const for (int bucket = 0; bucket < mTableSize; bucket++) { T *entry = mTable[bucket]; - if (entry != NULL) + if (entry != nullptr) return(entry); } - return(NULL); + return(nullptr); } template T *ObjectHashTable::WalkNext(T *prevResult) const @@ -408,17 +408,17 @@ template T *ObjectHashTable::WalkNext(T *prevResul int bucket = ((unsigned)static_cast(entry)->mHashValue) % mTableSize; entry = static_cast(entry)->mHashNextEntry; - if (entry != NULL) + if (entry != nullptr) return(entry); bucket++; // go onto next bucket for (; bucket < mTableSize; bucket++) { entry = mTable[bucket]; - if (entry != NULL) + if (entry != nullptr) return(entry); } - return(NULL); + return(nullptr); } template void ObjectHashTable::Resize(int hashSize) @@ -438,16 +438,16 @@ template void ObjectHashTable::Resize(int hashSize for (int i = 0; i < oldSize; i++) { T *cur = oldTable[i]; - while (cur != NULL) + while (cur != nullptr) { T *hold = cur; cur = static_cast(cur)->mHashNextEntry; // insert hold into new table int spot = ((unsigned)static_cast(hold)->mHashValue) % mTableSize; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) { - static_cast(hold)->mHashNextEntry = NULL; + static_cast(hold)->mHashNextEntry = nullptr; mTable[spot] = hold; mStatUsedSlots++; } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpLinkedList.h b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpLinkedList.h index 6fab2d03..ad2d7e63 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpLinkedList.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpLinkedList.h @@ -14,8 +14,8 @@ template class UdpLinkedList; template class UdpLinkedListMember { public: - UdpLinkedListMember() { mPrev = NULL; mNext = NULL; } - UdpLinkedListMember(const UdpLinkedListMember &) { mPrev = NULL; mNext = NULL; } + UdpLinkedListMember() { mPrev = nullptr; mNext = nullptr; } + UdpLinkedListMember(const UdpLinkedListMember &) { mPrev = nullptr; mNext = nullptr; } ~UdpLinkedListMember() {} #if defined(_MSC_VER) && (_MSC_VER < 1300) // MSVC 7.0 is the first version to support friend templates @@ -60,8 +60,8 @@ template class UdpLinkedList template UdpLinkedList::UdpLinkedList(UdpLinkedListMember T::*node) { - mHead = NULL; - mTail = NULL; + mHead = nullptr; + mTail = nullptr; mNode = node; mCount = 0; } @@ -98,7 +98,7 @@ template int UdpLinkedList::Count() const template T *UdpLinkedList::Position(int index) const { T *cur = mHead; - while (cur != NULL && index > 0) + while (cur != nullptr && index > 0) { cur = Next(cur); index--; @@ -109,43 +109,43 @@ template T *UdpLinkedList::Position(int index) const template T *UdpLinkedList::Remove(T *cur) { UdpLinkedListMember *node = &(cur->*mNode); - if (node->mPrev == NULL) + if (node->mPrev == nullptr) mHead = node->mNext; else ((node->mPrev)->*mNode).mNext = node->mNext; - if (node->mNext == NULL) + if (node->mNext == nullptr) mTail = node->mPrev; else ((node->mNext)->*mNode).mPrev = node->mPrev; - node->mNext = NULL; - node->mPrev = NULL; + node->mNext = nullptr; + node->mPrev = nullptr; mCount--; return(cur); } template T *UdpLinkedList::RemoveHead() { - if (mHead == NULL) - return(NULL); + if (mHead == nullptr) + return(nullptr); return(Remove(mHead)); } template T *UdpLinkedList::RemoveTail() { - if (mTail == NULL) - return(NULL); + if (mTail == nullptr) + return(nullptr); return(Remove(mTail)); } template T *UdpLinkedList::InsertHead(T *cur) { - assert((cur->*mNode).mPrev == NULL); - assert((cur->*mNode).mNext == NULL); + assert((cur->*mNode).mPrev == nullptr); + assert((cur->*mNode).mNext == nullptr); (cur->*mNode).mNext = mHead; - if (mHead != NULL) + if (mHead != nullptr) { (mHead->*mNode).mPrev = cur; mHead = cur; @@ -161,12 +161,12 @@ template T *UdpLinkedList::InsertHead(T *cur) template T *UdpLinkedList::InsertTail(T *cur) { - assert((cur->*mNode).mPrev == NULL); - assert((cur->*mNode).mNext == NULL); + assert((cur->*mNode).mPrev == nullptr); + assert((cur->*mNode).mNext == nullptr); (cur->*mNode).mPrev = mTail; - if (mTail != NULL) + if (mTail != nullptr) { (mTail->*mNode).mNext = cur; mTail = cur; @@ -182,17 +182,17 @@ template T *UdpLinkedList::InsertTail(T *cur) template T *UdpLinkedList::InsertAfter(T *cur, T *prev) { - assert((cur->*mNode).mPrev == NULL); - assert((cur->*mNode).mNext == NULL); + assert((cur->*mNode).mPrev == nullptr); + assert((cur->*mNode).mNext == nullptr); - if (prev == NULL) + if (prev == nullptr) return(InsertHead(cur)); (cur->*mNode).mPrev = prev; (cur->*mNode).mNext = (prev->*mNode).mNext; (prev->*mNode).mNext = cur; - if ((cur->*mNode).mNext != NULL) + if ((cur->*mNode).mNext != nullptr) (((cur->*mNode).mNext)->*mNode).mPrev = cur; else mTail = cur; @@ -204,7 +204,7 @@ template T *UdpLinkedList::InsertAfter(T *cur, T *prev) template void UdpLinkedList::DeleteAll() { T *cur = First(); - while (cur != NULL) + while (cur != nullptr) { T *next = Next(cur); Remove(cur); @@ -216,7 +216,7 @@ template void UdpLinkedList::DeleteAll() template void UdpLinkedList::ReleaseAll() { T *cur = First(); - while (cur != NULL) + while (cur != nullptr) { T *next = Next(cur); Remove(cur); diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpLogicalPacket.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpLogicalPacket.cpp index 5ecce2fb..76171367 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpLogicalPacket.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpLogicalPacket.cpp @@ -31,7 +31,7 @@ SimpleLogicalPacket::SimpleLogicalPacket(const void *data, int dataLen) { mDataLen = dataLen; mData = new udp_uchar[mDataLen]; - if (data != NULL) + if (data != nullptr) memcpy(mData, data, mDataLen); } @@ -66,7 +66,7 @@ void SimpleLogicalPacket::SetDataLen(int len) GroupLogicalPacket::GroupLogicalPacket() : LogicalPacket() { mDataLen = 0; - mData = NULL; + mData = nullptr; } GroupLogicalPacket::~GroupLogicalPacket() @@ -76,13 +76,13 @@ GroupLogicalPacket::~GroupLogicalPacket() void GroupLogicalPacket::AddPacket(const LogicalPacket *packet) { - assert(packet != NULL); + assert(packet != nullptr); AddPacketInternal(packet->GetDataPtr(), packet->GetDataLen(), packet->IsInternalPacket()); } void GroupLogicalPacket::AddPacket(const void *data, int dataLen) { - assert(data != NULL); + assert(data != nullptr); assert(dataLen >= 0); AddPacketInternal(data, dataLen, false); } @@ -152,10 +152,10 @@ PooledLogicalPacket::PooledLogicalPacket(UdpManager *manager, int len) PooledLogicalPacket::~PooledLogicalPacket() { - if (mUdpManager != NULL) + if (mUdpManager != nullptr) { mUdpManager->PoolDestroyed(this); - mUdpManager = NULL; + mUdpManager = nullptr; } delete[] mData; @@ -168,7 +168,7 @@ void PooledLogicalPacket::AddRef() const void PooledLogicalPacket::Release() const { - if (GetRefCount() == 1 && mUdpManager != NULL) + if (GetRefCount() == 1 && mUdpManager != nullptr) { // the PoolReturn function steals our reference (ie, we don't release, they don't addref), this is for thread safety reasons mUdpManager->PoolReturn(const_cast(this)); @@ -208,9 +208,9 @@ void PooledLogicalPacket::SetDataLen(int len) void PooledLogicalPacket::SetData(const void *data, int dataLen, const void *data2, int dataLen2) { mDataLen = dataLen + dataLen2; - if (data != NULL) + if (data != nullptr) memcpy(mData, data, dataLen); - if (data2 != NULL) + if (data2 != nullptr) memcpy(mData + dataLen, data2, dataLen2); } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpLogicalPacket.h b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpLogicalPacket.h index 6a5962c4..8e1525a8 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpLogicalPacket.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpLogicalPacket.h @@ -81,7 +81,7 @@ class SimpleLogicalPacket : public LogicalPacket // it was originally created to allow the internal code to handle reliable data that was sent // via the Send(char *, int) api call. public: - SimpleLogicalPacket(const void *data, int dataLen); // data can be NULL if you want to populate it after it is allocated (get the pointer and write to it) + SimpleLogicalPacket(const void *data, int dataLen); // data can be nullptr if you want to populate it after it is allocated (get the pointer and write to it) virtual void *GetDataPtr(); virtual const void *GetDataPtr() const; virtual int GetDataLen() const; @@ -152,7 +152,7 @@ template class StructLogicalPacket : public LogicalPacket // with virtual functions) via this method as they may contain hidden data-members (such as pointers // to vtables). public: - StructLogicalPacket(T *initData = NULL); + StructLogicalPacket(T *initData = nullptr); virtual void *GetDataPtr(); virtual const void *GetDataPtr() const; virtual int GetDataLen() const; @@ -226,7 +226,7 @@ class PooledLogicalPacket : public LogicalPacket protected: friend class UdpManager; void TrueRelease() const; - void SetData(const void *data, int dataLen, const void *data2 = NULL, int dataLen2 = 0); + void SetData(const void *data, int dataLen, const void *data2 = nullptr, int dataLen2 = 0); UdpManager *mUdpManager; UdpLinkedListMember mAvailableLink; // for available linked list in manager UdpLinkedListMember mCreatedLink; // for created linked list in manager @@ -240,7 +240,7 @@ class PooledLogicalPacket : public LogicalPacket template FixedLogicalPacket::FixedLogicalPacket(const void *data, int dataLen) { mDataLen = dataLen; - if (data != NULL) + if (data != nullptr) memcpy(mData, data, mDataLen); } @@ -270,7 +270,7 @@ template void FixedLogicalPacket::SetDataLen(int l ///////////////////////////////////////////////////////////////////////// template StructLogicalPacket::StructLogicalPacket(T *initData) { - if (initData != NULL) + if (initData != nullptr) mStruct = *initData; } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpManager.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpManager.cpp index 5a63f361..2129e06f 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpManager.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpManager.cpp @@ -111,10 +111,10 @@ UdpManager::UdpManager(const UdpParams *params) : mConnectionList(&UdpConnection mParams.maxDataHoldSize = udpMin(mParams.maxDataHoldSize, mParams.maxRawPacketSize); mParams.packetHistoryMax = udpMax(1, mParams.packetHistoryMax); mPacketHistoryPosition = 0; - mPassThroughData = NULL; - mBackgroundThread = NULL; + mPassThroughData = nullptr; + mBackgroundThread = nullptr; - if (mParams.udpDriver != NULL) + if (mParams.udpDriver != nullptr) { mDriver = mParams.udpDriver; } @@ -154,7 +154,7 @@ UdpManager::UdpManager(const UdpParams *params) : mConnectionList(&UdpConnection mSimulateOutgoingQueueBytes = 0; if (mParams.avoidPriorityQueue) - mPriorityQueue = NULL; + mPriorityQueue = nullptr; else mPriorityQueue = new PriorityQueue(mParams.maxConnections); @@ -181,7 +181,7 @@ UdpManager::~UdpManager() { // Since the background thread holds a reference to the UdpManager while it is running, this should // not be possible. The only way it could happen is if somebody released the manager who should not have. - assert(mBackgroundThread == NULL); + assert(mBackgroundThread == nullptr); // next thing we must do is tell all the connections to disconnect (which severs their link to this dying manager) // this has to be done first since they will call back into us and have themselves removed from our connection-list/priority-queue/etc @@ -191,7 +191,7 @@ UdpManager::~UdpManager() UdpGuard cg(&mConnectionGuard); UdpConnection *cur = mConnectionList.First(); - while (cur != NULL) + while (cur != nullptr) { cur->AddRef(); cur->InternalDisconnect(0, UdpConnection::cDisconnectReasonManagerDeleted); // this will cause it to remove us from the mConnectionList @@ -216,9 +216,9 @@ UdpManager::~UdpManager() UdpGuard guard(&mPoolGuard); PooledLogicalPacket *walk = mPoolCreatedList.RemoveHead(); - while (walk != NULL) + while (walk != nullptr) { - walk->mUdpManager = NULL; + walk->mUdpManager = nullptr; walk = mPoolCreatedList.RemoveHead(); } // next release the ones we have in our available pool @@ -232,11 +232,11 @@ UdpManager::~UdpManager() CloseSocket(); - if (mParams.udpDriver == NULL) + if (mParams.udpDriver == nullptr) { delete mDriver; // we were not given a driver to use, so we must own this driver we have, so destroy it } - mDriver = NULL; + mDriver = nullptr; delete mAddressHashTable; delete mConnectCodeHashTable; @@ -295,7 +295,7 @@ void UdpManager::ProcessDisconnectPending() UdpGuard guard(&mDisconnectPendingGuard); UdpConnection *entry = mDisconnectPendingList.First(); - while (entry != NULL) + while (entry != nullptr) { UdpConnection *next = mDisconnectPendingList.Next(entry); if (entry->GetStatus() == UdpConnection::cStatusDisconnected) @@ -309,12 +309,12 @@ void UdpManager::ProcessDisconnectPending() void UdpManager::RemoveConnection(UdpConnection *con) { - assert(con != NULL); // attemped to remove a NULL connection object + assert(con != nullptr); // attemped to remove a nullptr connection object // note: it's a bug to Remove a connection object that is already removed...should never be able to happen. UdpGuard cg(&mConnectionGuard); - if (mPriorityQueue != NULL) + if (mPriorityQueue != nullptr) { mPriorityQueue->Remove(con); } @@ -326,7 +326,7 @@ void UdpManager::RemoveConnection(UdpConnection *con) void UdpManager::AddConnection(UdpConnection *con) { - assert(con != NULL); // attemped to add a NULL connection object + assert(con != nullptr); // attemped to add a nullptr connection object UdpGuard cg(&mConnectionGuard); con->AddRef(); // UdpManager keeps a soft reference to the connection (ie. if it sees it is the only one holding a reference, it releases it) @@ -341,17 +341,17 @@ void UdpManager::FlushAllMultiBuffer() mConnectionGuard.Enter(); UdpConnection *cur = mConnectionList.First(); - if (cur != NULL) + if (cur != nullptr) cur->AddRef(); mConnectionGuard.Leave(); - while (cur != NULL) + while (cur != nullptr) { cur->FlushMultiBuffer(); mConnectionGuard.Enter(); UdpConnection *next = mConnectionList.Next(cur); - if (next != NULL) + if (next != nullptr) next->AddRef(); mConnectionGuard.Leave(); @@ -366,15 +366,15 @@ void UdpManager::DisconnectAll() mConnectionGuard.Enter(); UdpConnection *cur = mConnectionList.First(); - if (cur != NULL) + if (cur != nullptr) cur->AddRef(); mConnectionGuard.Leave(); - while (cur != NULL) + while (cur != nullptr) { mConnectionGuard.Enter(); UdpConnection *next = mConnectionList.Next(cur); - if (next != NULL) + if (next != nullptr) next->AddRef(); mConnectionGuard.Leave(); @@ -392,7 +392,7 @@ void UdpManager::DeliverEvents(int maxProcessingTime) for (;;) { CallbackEvent *ce = EventListPop(); - if (ce == NULL) + if (ce == nullptr) break; switch(ce->mEventType) @@ -426,13 +426,13 @@ void UdpManager::DeliverEvents(int maxProcessingTime) { { // guard block UdpGuard hguard(&mHandlerGuard); - if (mParams.handler != NULL) + if (mParams.handler != nullptr) { mParams.handler->OnConnectRequest(ce->mSource); } } - if (ce->mSource->GetHandler() == NULL) // if application did not set a handler, then the connection is considered refused + if (ce->mSource->GetHandler() == nullptr) // if application did not set a handler, then the connection is considered refused { ce->mSource->InternalDisconnect(0, UdpConnection::cDisconnectReasonConnectionRefused); } @@ -513,7 +513,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) PacketHistoryEntry *e = SimulationReceive(); #endif - if (e == NULL) + if (e == nullptr) { mLastEmptySocketBufferStamp = CachedClock(); break; @@ -545,7 +545,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) if (giveConnectionsTime) { - if (mPriorityQueue != NULL) + if (mPriorityQueue != nullptr) { // give time to everybody in the priority-queue that needs it UdpClockStamp curPriority = CachedClock(); @@ -570,10 +570,10 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) mConnectionGuard.Enter(); top = mPriorityQueue->TopRemove(curPriority); - if (top != NULL) + if (top != nullptr) top->AddRef(); // must always addref connections while inside the connection guard mConnectionGuard.Leave(); - if (top == NULL) + if (top == nullptr) break; top->GiveTime(true); @@ -593,17 +593,17 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) // give time to everybody mConnectionGuard.Enter(); UdpConnection *cur = mConnectionList.First(); - if (cur != NULL) + if (cur != nullptr) cur->AddRef(); mConnectionGuard.Leave(); - while (cur != NULL) + while (cur != nullptr) { cur->GiveTime(true); mConnectionGuard.Enter(); UdpConnection *next = mConnectionList.Next(cur); - if (next != NULL) + if (next != nullptr) next->AddRef(); mConnectionGuard.Leave(); @@ -621,13 +621,13 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) UdpClockStamp curStamp = CachedClock(); SimulateQueueEntry *entry = mSimulateOutgoingList.First(); - while (entry != NULL && curStamp >= mSimulateNextOutgoingTime) + while (entry != nullptr && curStamp >= mSimulateNextOutgoingTime) { mSimulateOutgoingList.Remove(entry); SimulateQueueEntry *next = mSimulateOutgoingList.First(); // simulate a delay before next packet is considered (ie. simple lag) - if (next != NULL) + if (next != nullptr) { int latencyDelay = (mSimulation.simulateOutgoingLatency - CachedClockElapsed(next->mQueueTime)); mSimulateNextOutgoingTime = curStamp + latencyDelay; @@ -644,7 +644,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) ActualSendHelper(entry->mData, entry->mDataLen, entry->mIp, entry->mPort); UdpConnection *con = AddressGetConnection(entry->mIp, entry->mPort); - if (con != NULL) + if (con != nullptr) { con->mSimulateOutgoingQueueBytes -= entry->mDataLen; con->Release(); @@ -664,12 +664,12 @@ UdpConnection *UdpManager::EstablishConnection(const char *serverAddress, int se { UdpGuard guard(&mGiveTimeGuard); // probably not needed, I don't see any reason we can't do this while GiveTime is happening in the background...the connection list is protected independently...still, better safe than sorry - assert(serverAddress != NULL); + assert(serverAddress != nullptr); char useServerAddress[512]; UdpLibrary::UdpMisc::Strncpy(useServerAddress, serverAddress, sizeof(useServerAddress)); char *portPtr = strchr(useServerAddress, ':'); - if (portPtr != NULL) + if (portPtr != nullptr) { *portPtr++ = 0; serverPort = atoi(portPtr); @@ -679,21 +679,21 @@ UdpConnection *UdpManager::EstablishConnection(const char *serverAddress, int se assert(serverPort != 0); // can't connect to no port if (mConnectionList.Count() >= mParams.maxConnections) - return(NULL); + return(nullptr); // get server address UdpPlatformAddress destIp; if (!mDriver->GetHostByName(&destIp, useServerAddress)) { - return(NULL); // could not resolve name + return(nullptr); // could not resolve name } // first, see if we already have a connection object managing this ip/port, if we do, then fail UdpConnection *con = AddressGetConnection(destIp, serverPort); - if (con != NULL) + if (con != nullptr) { con->Release(); - return(NULL); // already connected to this address/port + return(nullptr); // already connected to this address/port } return(new UdpConnection(this, destIp, serverPort, timeout)); } @@ -709,7 +709,7 @@ void UdpManager::GetStats(UdpManagerStatistics *stats) { UdpGuard sg(&mStatsGuard); - assert(stats != NULL); + assert(stats != nullptr); *stats = mManagerStats; stats->poolAvailable = mPoolAvailableList.Count(); stats->poolCreated = mPoolCreatedList.Count(); @@ -737,10 +737,10 @@ void UdpManager::DumpPacketHistory(const char *filename) const { UdpGuard guard(&mGiveTimeGuard); - assert(filename != NULL); + assert(filename != nullptr); assert(filename[0] != 0); FILE *file = fopen(filename, "wt"); - if (file != NULL) + if (file != nullptr) { // dump history of packets... for (int i = 0; i < mParams.packetHistoryMax; i++) @@ -789,7 +789,7 @@ UdpManager::PacketHistoryEntry *UdpManager::SimulationReceive() for (;;) { PacketHistoryEntry *entry = ActualReceive(); - if (entry == NULL) + if (entry == nullptr) break; SimulateQueueEntry *qe = new SimulateQueueEntry(entry->mBuffer, entry->mLen, entry->mIp, entry->mPort, curStamp); @@ -797,7 +797,7 @@ UdpManager::PacketHistoryEntry *UdpManager::SimulationReceive() } SimulateQueueEntry *winner = mSimulateIncomingList.First(); - if (winner != NULL && CachedClockElapsed(winner->mQueueTime) >= mSimulation.simulateIncomingLatency) + if (winner != nullptr && CachedClockElapsed(winner->mQueueTime) >= mSimulation.simulateIncomingLatency) { mSimulateIncomingList.Remove(winner); int pos = mPacketHistoryPosition; @@ -809,14 +809,14 @@ UdpManager::PacketHistoryEntry *UdpManager::SimulationReceive() delete winner; return(mPacketHistory[pos]); } - return(NULL); + return(nullptr); } UdpManager::PacketHistoryEntry *UdpManager::ActualReceive() { UdpClockStamp curStamp = CachedClock(); if (mSimulation.simulateIncomingByteRate > 0 && curStamp < mSimulateNextIncomingTime) - return(NULL); + return(nullptr); UdpPlatformAddress fromAddress; int fromPort = 0; @@ -855,7 +855,7 @@ UdpManager::PacketHistoryEntry *UdpManager::ActualReceive() } return(mPacketHistory[pos]); } - return(NULL); + return(nullptr); } void UdpManager::ActualSend(const udp_uchar *data, int dataLen, UdpPlatformAddress ip, int port) @@ -876,7 +876,7 @@ void UdpManager::ActualSend(const udp_uchar *data, int dataLen, UdpPlatformAddre return; // no room, packet gets lost UdpConnection *con = AddressGetConnection(ip, port); - if (con != NULL) + if (con != nullptr) { if (mSimulation.simulateDestinationOverloadLevel > 0 && con->mSimulateOutgoingQueueBytes + dataLen > mSimulation.simulateDestinationOverloadLevel) { @@ -928,7 +928,7 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) UdpConnection *con = AddressGetConnection(e->mIp, e->mPort); - if (con == NULL) + if (con == nullptr) { if (e->mLen == 0) // len = 0 = ICMP error { @@ -946,7 +946,7 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) if (mConnectionList.Count() >= mParams.maxConnections) return; // can't handle any more connections, so ignore this request entirely - if (mParams.handler != NULL) + if (mParams.handler != nullptr) { UdpConnection *newcon = new UdpConnection(this, e); CallbackConnectRequest(newcon); @@ -968,7 +968,7 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) int encryptCode = UdpMisc::GetValue32(ptr); UdpConnection *con = ConnectCodeGetConnection(connectCode); - if (con != NULL) + if (con != nullptr) { if (mParams.allowAddressRemapping || con->mIp == e->mIp) { @@ -1025,7 +1025,7 @@ UdpConnection *UdpManager::AddressGetConnection(UdpPlatformAddress ip, int port) UdpGuard guard(&mConnectionGuard); UdpConnection *found = mAddressHashTable->FindFirst(AddressHashValue(ip, port)); - while (found != NULL) + while (found != nullptr) { if (found->mIp == ip && found->mPort == port) { @@ -1034,7 +1034,7 @@ UdpConnection *UdpManager::AddressGetConnection(UdpPlatformAddress ip, int port) } found = mAddressHashTable->FindNext(found); } - return(NULL); + return(nullptr); } UdpConnection *UdpManager::ConnectCodeGetConnection(int connectCode) const @@ -1042,7 +1042,7 @@ UdpConnection *UdpManager::ConnectCodeGetConnection(int connectCode) const UdpGuard guard(&mConnectionGuard); UdpConnection *found = mConnectCodeHashTable->FindFirst(connectCode); - while (found != NULL) + while (found != nullptr) { if (found->mConnectCode == connectCode) { @@ -1051,7 +1051,7 @@ UdpConnection *UdpManager::ConnectCodeGetConnection(int connectCode) const } found = mConnectCodeHashTable->FindNext(found); } - return(NULL); + return(nullptr); } LogicalPacket *UdpManager::CreatePacket(const void *data, int dataLen, const void *data2, int dataLen2) @@ -1063,7 +1063,7 @@ LogicalPacket *UdpManager::CreatePacket(const void *data, int dataLen, const voi { UdpGuard guard(&mPoolGuard); PooledLogicalPacket *lp = mPoolAvailableList.RemoveHead(); - if (lp == NULL) + if (lp == nullptr) { // create a new pooled packet to fulfil request lp = new PooledLogicalPacket(this, mParams.pooledPacketSize); @@ -1091,7 +1091,7 @@ void UdpManager::PoolDestroyed(PooledLogicalPacket *packet) char *UdpManager::GetLocalString(char *buf, int bufLen) const { if (bufLen < 22) - return(NULL); + return(nullptr); UdpPlatformAddress ip = GetLocalIp(); int port = GetLocalPort(); char hold[256]; @@ -1103,7 +1103,7 @@ UdpManager::CallbackEvent *UdpManager::AvailableEventBorrow() { UdpGuard guard(&mAvailableEventGuard); CallbackEvent *ce = mAvailableEventList.RemoveHead(); - if (ce == NULL) + if (ce == nullptr) { ce = new CallbackEvent(); } @@ -1127,7 +1127,7 @@ void UdpManager::EventListAppend(CallbackEvent *ce) { UdpGuard guard(&mEventListGuard); mEventList.InsertTail(ce); - if (ce->mPayload != NULL) + if (ce->mPayload != nullptr) { mEventListBytes += ce->mPayload->GetDataLen(); } @@ -1137,7 +1137,7 @@ UdpManager::CallbackEvent *UdpManager::EventListPop() { UdpGuard guard(&mEventListGuard); CallbackEvent *event = mEventList.RemoveHead(); - if (event != NULL && event->mPayload != NULL) + if (event != nullptr && event->mPayload != nullptr) { mEventListBytes -= event->mPayload->GetDataLen(); } @@ -1148,7 +1148,7 @@ UdpManager::CallbackEvent *UdpManager::EventListPop() void UdpManager::ThreadStart() { UdpGuard guard(&mThreadGuard); - if (mBackgroundThread == NULL) + if (mBackgroundThread == nullptr) { mBackgroundThread = new UdpManagerThread(this, mParams.threadSleepTime); mBackgroundThread->Start(); @@ -1158,12 +1158,12 @@ void UdpManager::ThreadStart() void UdpManager::ThreadStop() { UdpGuard guard(&mThreadGuard); - if (mBackgroundThread != NULL) + if (mBackgroundThread != nullptr) { assert(mRefCount > 1); // caller must hold a reference, and thread must hold a reference, so this should be true. If it asserts, it means the caller is using a UdpManager that it does not hold a reference to. mBackgroundThread->Stop(true); mBackgroundThread->Release(); - mBackgroundThread = NULL; + mBackgroundThread = nullptr; } } @@ -1256,13 +1256,13 @@ void UdpManager::CallbackConnectRequest(UdpConnection *con) { { // guard block UdpGuard hguard(&mHandlerGuard); - if (mParams.handler != NULL) + if (mParams.handler != nullptr) { mParams.handler->OnConnectRequest(con); } } - if (con->GetHandler() == NULL) // if application did not set a handler, then the connection is considered refused + if (con->GetHandler() == nullptr) // if application did not set a handler, then the connection is considered refused { con->InternalDisconnect(0, UdpConnection::cDisconnectReasonConnectionRefused); } @@ -1276,8 +1276,8 @@ void UdpManager::CallbackConnectRequest(UdpConnection *con) UdpManager::CallbackEvent::CallbackEvent() { mEventType = cCallbackEventNone; - mSource = NULL; - mPayload = NULL; + mSource = nullptr; + mPayload = nullptr; mReason = cUdpCorruptionReasonNone; } @@ -1291,7 +1291,7 @@ void UdpManager::CallbackEvent::SetEventData(CallbackEventType eventType, UdpCon mEventType = eventType; mSource = con; mSource->AddRef(); - if (payload != NULL) + if (payload != nullptr) { mPayload = payload; mPayload->AddRef(); @@ -1300,16 +1300,16 @@ void UdpManager::CallbackEvent::SetEventData(CallbackEventType eventType, UdpCon void UdpManager::CallbackEvent::ClearEventData() { - if (mSource != NULL) + if (mSource != nullptr) { mSource->Release(); - mSource = NULL; + mSource = nullptr; } - if (mPayload != NULL) + if (mPayload != nullptr) { mPayload->Release(); - mPayload = NULL; + mPayload = nullptr; } } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpManager.h b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpManager.h index 3715a0b2..7c263031 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpManager.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpManager.h @@ -178,7 +178,7 @@ struct UdpParams // pointer equal to your object and the UdpManager will call it as appropriate. The UdpConnection object // also has a handler mechanism that replaces the other callback functions below, see UdpConnection::SetHandler // if a handler is specified, the callback function is ignored, even if specified. - // default = NULL (not used) + // default = nullptr (not used) UdpManagerHandler *handler; // this is the maximum number of connections that can be established by this manager, any incoming/outgoing connections @@ -496,7 +496,7 @@ struct UdpParams // the UdpPlatformDriver object itself and chain the calls on through, plus do whatever else it wants; // however, that is not required. The application maintains ownership of this object and the object must // not be destroyed by the application until the UdpManager using it is destroyed. - // default = NULL, meaning the UdpManager it will create it's own UdpPlatformDriver for use. + // default = nullptr, meaning the UdpManager it will create it's own UdpPlatformDriver for use. UdpDriver *udpDriver; @@ -642,7 +642,7 @@ class UdpManager : public UdpGuardedRefCount // will call EstablishConnection, then sit in a loop calling UdpManager::GiveTime and checking to see // if the status of the returned UdpConnection object is changed from cStatusNegotiating. This allows // the application to look for the ESC key or timeout an attempted connection. - // This function will return NULL if the manager object has exceeded its maximum number of connections + // This function will return nullptr if the manager object has exceeded its maximum number of connections // or if the serverAddress cannot be resolved to an IP address // as is noted in the declaration, it is the responsibility of the application establishing the connection to delete it // setting the timeout value (in milliseconds) to something greater than 0 will cause the UdpConnection object to change @@ -685,13 +685,13 @@ class UdpManager : public UdpGuardedRefCount // a terminated packet. void DisconnectAll(); - // creates a logical packet and populates it with data. data can be NULL, in which case it gives you logical packet + // creates a logical packet and populates it with data. data can be nullptr, in which case it gives you logical packet // of the size specified, but copies no data into it. If you are using pool management (see Params::poolPacketMax), // it will give you a packet out of the pool if possible, otherwise it will create a packet for you. When logical // are packets are needed internally for various things (like reliable channel sends that use the (void *, int) interface) // they are gotten from this function, so your application can likely take advantage of pooling, even if it never bothers // to explicitly call this function. - LogicalPacket *CreatePacket(const void *data, int dataLen, const void *data2 = NULL, int dataLen2 = 0); + LogicalPacket *CreatePacket(const void *data, int dataLen, const void *data2 = nullptr, int dataLen2 = 0); void GetSimulation(UdpSimulationParameters *simulationParameters) const; void SetSimulation(const UdpSimulationParameters *simulationParameters); @@ -796,7 +796,7 @@ class UdpManager : public UdpGuardedRefCount CallbackEvent(); ~CallbackEvent(); - void SetEventData(CallbackEventType eventType, UdpConnection *con, const LogicalPacket *payload = NULL); + void SetEventData(CallbackEventType eventType, UdpConnection *con, const LogicalPacket *payload = nullptr); void ClearEventData(); CallbackEventType mEventType; @@ -926,7 +926,7 @@ inline void UdpManager::SetPriority(UdpConnection *con, UdpClockStamp stamp) if (stamp < mMinimumScheduledStamp) stamp = mMinimumScheduledStamp; - if (mPriorityQueue != NULL) + if (mPriorityQueue != nullptr) { mPriorityQueue->Add(con, stamp); } @@ -1025,7 +1025,7 @@ inline int UdpManager::CachedClockElapsed(UdpClockStamp start) inline int UdpManager::EncryptUserSupplied(UdpConnection *con, udp_uchar *destData, const udp_uchar *sourceData, int sourceLen) { UdpGuard guard(&mHandlerGuard); - if (mParams.handler != NULL) + if (mParams.handler != nullptr) { return(mParams.handler->OnUserSuppliedEncrypt(con, destData, sourceData, sourceLen)); } @@ -1035,7 +1035,7 @@ inline int UdpManager::EncryptUserSupplied(UdpConnection *con, udp_uchar *destDa inline int UdpManager::EncryptUserSupplied2(UdpConnection *con, udp_uchar *destData, const udp_uchar *sourceData, int sourceLen) { UdpGuard guard(&mHandlerGuard); - if (mParams.handler != NULL) + if (mParams.handler != nullptr) { return(mParams.handler->OnUserSuppliedEncrypt2(con, destData, sourceData, sourceLen)); } @@ -1045,7 +1045,7 @@ inline int UdpManager::EncryptUserSupplied2(UdpConnection *con, udp_uchar *destD inline int UdpManager::DecryptUserSupplied(UdpConnection *con, udp_uchar *destData, const udp_uchar *sourceData, int sourceLen) { UdpGuard guard(&mHandlerGuard); - if (mParams.handler != NULL) + if (mParams.handler != nullptr) { return(mParams.handler->OnUserSuppliedDecrypt(con, destData, sourceData, sourceLen)); } @@ -1055,7 +1055,7 @@ inline int UdpManager::DecryptUserSupplied(UdpConnection *con, udp_uchar *destDa inline int UdpManager::DecryptUserSupplied2(UdpConnection *con, udp_uchar *destData, const udp_uchar *sourceData, int sourceLen) { UdpGuard guard(&mHandlerGuard); - if (mParams.handler != NULL) + if (mParams.handler != nullptr) { return(mParams.handler->OnUserSuppliedDecrypt2(con, destData, sourceData, sourceLen)); } @@ -1070,7 +1070,7 @@ inline int UdpManager::DecryptUserSupplied2(UdpConnection *con, udp_uchar *destD ///////////////////////////////////////////////////////////////////////////////////////////////////// inline UdpParams::UdpParams(ManagerRole role) { - handler = NULL; + handler = nullptr; outgoingBufferSize = 64 * 1024; incomingBufferSize = 64 * 1024; packetHistoryMax = 4; @@ -1103,7 +1103,7 @@ inline UdpParams::UdpParams(ManagerRole role) reliableOverflowBytes = 0; lingerDelay = 10; bindIpAddress[0] = 0; - udpDriver = NULL; + udpDriver = nullptr; callbackEventPoolMax = 5000; eventQueuing = false; threadSleepTime = 20; diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.cpp index b50daae0..651492fc 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.cpp @@ -113,19 +113,19 @@ void *UdpMisc::SmartResize(void *ptr, int bytes, int round) if (bytes == 0) { - if (ptr != NULL) + if (ptr != nullptr) { free((udp_uchar *)ptr - cAlignment); } - return(NULL); + return(nullptr); } udp_uchar *ptr2; - if (ptr == NULL) + if (ptr == nullptr) { ptr2 = (udp_uchar *)malloc(bytes + cAlignment); - if (ptr2 == NULL) - return(NULL); + if (ptr2 == nullptr) + return(nullptr); *(int *)ptr2 = bytes; return(ptr2 + cAlignment); } @@ -135,8 +135,8 @@ void *UdpMisc::SmartResize(void *ptr, int bytes, int round) return(ptr); ptr2 = (udp_uchar *)realloc((udp_uchar *)ptr - cAlignment, bytes + cAlignment); - if (ptr2 == NULL) - return(NULL); + if (ptr2 == nullptr) + return(nullptr); *(int *)ptr2 = bytes; return(ptr2 + cAlignment); @@ -199,30 +199,30 @@ LogicalPacket *UdpMisc::CreateQuickLogicalPacket(const void *data, int dataLen, switch(q) { case 0: - tlp = new FixedLogicalPacket(NULL, totalDataLen); + tlp = new FixedLogicalPacket(nullptr, totalDataLen); break; case 1: - tlp = new FixedLogicalPacket(NULL, totalDataLen); + tlp = new FixedLogicalPacket(nullptr, totalDataLen); break; case 2: case 3: - tlp = new FixedLogicalPacket(NULL, totalDataLen); + tlp = new FixedLogicalPacket(nullptr, totalDataLen); break; case 4: case 5: case 6: case 7: - tlp = new FixedLogicalPacket(NULL, totalDataLen); + tlp = new FixedLogicalPacket(nullptr, totalDataLen); break; default: - tlp = new SimpleLogicalPacket(NULL, totalDataLen); + tlp = new SimpleLogicalPacket(nullptr, totalDataLen); break; } udp_uchar *dest = (udp_uchar *)tlp->GetDataPtr(); - if (data != NULL) + if (data != nullptr) memcpy(dest, data, dataLen); - if (data2 != NULL) + if (data2 != nullptr) memcpy(dest + dataLen, data2, dataLen2); return(tlp); } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.h b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.h index 3961823f..f77380ca 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.h @@ -57,7 +57,7 @@ class UdpMisc // memory manager does a little bit of this, but if you know you have an allocation that is likely // to grow quite a bit, you can set the round'ing size up to a fairly large number and avoid // unnecessary reallocs at the cost of a little potentially wasted space - // initial allocations are done by passing in ptr==NULL, freeing is done by passing in bytes==0 + // initial allocations are done by passing in ptr==nullptr, freeing is done by passing in bytes==0 static void *SmartResize(void *ptr, int bytes, int round = 1); // the following two functions store values in the buffer as a variable length (B1, 0xffB2B1, 0xffffffB4B3B2B1) @@ -78,7 +78,7 @@ class UdpMisc static udp_uint GetValue24(const void *buffer); // gets a 24-bit value from the buffer in big-endian format static udp_ushort GetValue16(const void *buffer); // gets a 16-bit value from the buffer in big-endian format - static LogicalPacket *CreateQuickLogicalPacket(const void *data, int dataLen, const void *data2 = NULL, int dataLen2 = 0); + static LogicalPacket *CreateQuickLogicalPacket(const void *data, int dataLen, const void *data2 = nullptr, int dataLen2 = 0); // looks up the specified name and translates it to an IP address // this is a blocking call that can at times take a significant amount of time, but will generally be fast (less than 300ms) diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpPriority.h b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpPriority.h index c50dee62..e4f2df20 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpPriority.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpPriority.h @@ -43,12 +43,12 @@ template class PriorityQueue PriorityQueue(int queueSize); ~PriorityQueue(); - T* Top(); // returns NULL if queue is empty - T* TopRemove(); // returns NULL if queue is empty - T* TopRemove(P priority); // removes item from queue if it has a lower priority value, otherwise return NULL + T* Top(); // returns nullptr if queue is empty + T* TopRemove(); // returns nullptr if queue is empty + T* TopRemove(P priority); // removes item from queue if it has a lower priority value, otherwise return nullptr T* Add(T* entry, P priority); // reprioritizes if already in queue, returns entry always T* Remove(T* entry); // returns entry always (even if it was not in the queue) - P *GetPriority(T* entry); // returns NULL if entry is not in the queue + P *GetPriority(T* entry); // returns nullptr if entry is not in the queue int QueueUsed(); // returns how many entries are in the queue protected: struct QueueEntry @@ -94,14 +94,14 @@ template PriorityQueue::~PriorityQueue() template T* PriorityQueue::Top() { if (mQueueEnd == 0) - return(NULL); + return(nullptr); return(mQueue[0].entry); } template T* PriorityQueue::TopRemove() { if (mQueueEnd == 0) - return(NULL); + return(nullptr); T* top = mQueue[0].entry; Remove(top); return(top); @@ -111,14 +111,14 @@ template T* PriorityQueue::TopRemove(P priority) { if (mQueueEnd > 0 && mQueue[0].priority <= priority) return(Remove(mQueue[0].entry)); - return(NULL); + return(nullptr); } template P* PriorityQueue::GetPriority(T* entry) { if (entry->mPriorityQueuePosition >= 0) return(&mQueue[entry->mPriorityQueuePosition].priority); - return(NULL); + return(nullptr); } template T* PriorityQueue::Add(T* entry, P priority) @@ -127,7 +127,7 @@ template T* PriorityQueue::Add(T* entry, P priorit { // not in queue, so add it to the bottom if (mQueueEnd >= mQueueSize) - return(NULL); + return(nullptr); mQueue[mQueueEnd].entry = entry; mQueue[mQueueEnd].priority = priority; mQueue[mQueueEnd].entry->mPriorityQueuePosition = mQueueEnd; diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpReliableChannel.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpReliableChannel.cpp index d31de9b4..5b6250f5 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpReliableChannel.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpReliableChannel.cpp @@ -48,12 +48,12 @@ UdpReliableChannel::UdpReliableChannel(int channelNumber, UdpConnection *con, Ud mReliableOutgoingBytes = 0; mLogicalBytesQueued = 0; - mCoalescePacket = NULL; - mCoalesceStartPtr = NULL; - mCoalesceEndPtr = NULL; + mCoalescePacket = nullptr; + mCoalesceStartPtr = nullptr; + mCoalesceEndPtr = nullptr; mCoalesceCount = 0; - mBufferedAckPtr = NULL; + mBufferedAckPtr = nullptr; mStatDuplicatePacketsReceived = 0; mStatResentPacketsAccelerated = 0; @@ -69,7 +69,7 @@ UdpReliableChannel::UdpReliableChannel(int channelNumber, UdpConnection *con, Ud mBigDataLen = 0; mBigDataTargetLen = 0; - mBigDataPtr = NULL; + mBigDataPtr = nullptr; mFragmentNextPos = 0; mLastTimeStampAcknowledged = 0; mMaxxedOutCurrentWindow = false; @@ -81,14 +81,14 @@ UdpReliableChannel::UdpReliableChannel(int channelNumber, UdpConnection *con, Ud UdpReliableChannel::~UdpReliableChannel() { - if (mCoalescePacket != NULL) + if (mCoalescePacket != nullptr) { mCoalescePacket->Release(); - mCoalescePacket = NULL; + mCoalescePacket = nullptr; } const LogicalPacket *cur = mLogicalPacketList.RemoveHead(); - while (cur != NULL) + while (cur != nullptr) { cur->Release(); cur = mLogicalPacketList.RemoveHead(); @@ -103,7 +103,7 @@ UdpReliableChannel::~UdpReliableChannel() void UdpReliableChannel::Send(const udp_uchar *data, int dataLen, const udp_uchar *data2, int dataLen2) { - if (mLogicalPacketList.Count() == 0 && mCoalescePacket == NULL) + if (mLogicalPacketList.Count() == 0 && mCoalescePacket == nullptr) { // if we are adding something to a previously empty logical queue, then it is possible that // we may be able to send it, so mark ourselves to take time the next time it is offered @@ -126,7 +126,7 @@ void UdpReliableChannel::Send(const udp_uchar *data, int dataLen, const udp_ucha void UdpReliableChannel::FlushCoalesce() { - if (mCoalescePacket != NULL) + if (mCoalescePacket != nullptr) { if (mCoalesceCount == 1) { @@ -140,16 +140,16 @@ void UdpReliableChannel::FlushCoalesce() mCoalescePacket->SetDataLen((int)(mCoalesceEndPtr - mCoalesceStartPtr)); QueueLogicalPacket(mCoalescePacket); mCoalescePacket->Release(); - mCoalescePacket = NULL; + mCoalescePacket = nullptr; } } void UdpReliableChannel::SendCoalesce(const udp_uchar *data, int dataLen, const udp_uchar *data2, int dataLen2) { int totalLen = dataLen + dataLen2; - if (mCoalescePacket == NULL) + if (mCoalescePacket == nullptr) { - mCoalescePacket = mUdpConnection->mUdpManager->CreatePacket(NULL, mMaxDataBytes); + mCoalescePacket = mUdpConnection->mUdpManager->CreatePacket(nullptr, mMaxDataBytes); mCoalesceEndPtr = mCoalesceStartPtr = (udp_uchar *)mCoalescePacket->GetDataPtr(); *mCoalesceEndPtr++ = 0; *mCoalesceEndPtr++ = UdpConnection::cUdpPacketGroup; @@ -169,10 +169,10 @@ void UdpReliableChannel::SendCoalesce(const udp_uchar *data, int dataLen, const // append on end of coalesce mCoalesceCount++; mCoalesceEndPtr += UdpMisc::PutVariableValue(mCoalesceEndPtr, totalLen); - if (data != NULL) + if (data != nullptr) memcpy(mCoalesceEndPtr, data, dataLen); mCoalesceEndPtr += dataLen; - if (data2 != NULL) + if (data2 != nullptr) memcpy(mCoalesceEndPtr, data2, dataLen2); mCoalesceEndPtr += dataLen2; } @@ -287,7 +287,7 @@ int UdpReliableChannel::GiveTime() mMaxxedOutCurrentWindow = false; int outstandingNextSendTime = 10 * 60000; // if we have something to do - if (mReliableOutgoingPendingId < mReliableOutgoingId || mLogicalPacketList.Count() != 0 || mCoalescePacket != NULL) + if (mReliableOutgoingPendingId < mReliableOutgoingId || mLogicalPacketList.Count() != 0 || mCoalescePacket != nullptr) { // first, let's calculate how many bytes we figure is outstanding based on who is still waiting for an ack-packet UdpClockStamp oldestResendTime = udpMax(hotClock - optimalResendDelay, mLastTimeStampAcknowledged); // anything older than this, we need to resend @@ -317,7 +317,7 @@ int UdpReliableChannel::GiveTime() // if this packet has not been acked and it is NOT ready to be sent (was recently sent) then we consider it outstanding // note: packets needing re-sending probably got lost and are therefore not outstanding PhysicalPacket *entry = &mPhysicalPackets[i % mConfig.maxOutstandingPackets]; - if (entry->mDataPtr != NULL) // acked packets set the dataPtr to NULL + if (entry->mDataPtr != nullptr) // acked packets set the dataPtr to nullptr { // if this packet is ready to be sent (ie: needs time now, or some later packet has already been ack'ed) windowSpaceLeft -= entry->mDataLen; // window-space is effectively taken whether we have sent it yet or not @@ -524,7 +524,7 @@ int UdpReliableChannel::GiveTime() void UdpReliableChannel::GetChannelStatus(UdpConnection::ChannelStatus *channelStatus) const { int coalesceBytes = 0; - if (mCoalescePacket != NULL) + if (mCoalescePacket != nullptr) coalesceBytes = (int)(mCoalesceEndPtr - mCoalesceStartPtr); channelStatus->totalPendingBytes = mLogicalBytesQueued + mReliableOutgoingBytes + coalesceBytes; @@ -550,7 +550,7 @@ void UdpReliableChannel::GetChannelStatus(UdpConnection::ChannelStatus *channelS PhysicalPacket *entry = &mPhysicalPackets[mReliableOutgoingPendingId % mConfig.maxOutstandingPackets]; if (entry->mFirstTimeStamp != 0) // if has been sent (we know it hasn't been acknowledged or we couldn't possibly be pointing at it as pending) { - if (mUdpConnection->GetUdpManager() != NULL) + if (mUdpConnection->GetUdpManager() != nullptr) { channelStatus->oldestUnacknowledgedAge = mUdpConnection->GetUdpManager()->CachedClockElapsed(entry->mFirstTimeStamp); } @@ -588,7 +588,7 @@ void UdpReliableChannel::ReliablePacket(const udp_uchar *data, int dataLen) mReliableIncomingId++; // process other packets that have arrived - while (mReliableIncoming[mReliableIncomingId % mConfig.maxInstandingPackets].mPacket != NULL) + while (mReliableIncoming[mReliableIncomingId % mConfig.maxInstandingPackets].mPacket != nullptr) { int spot = (int)(mReliableIncomingId % mConfig.maxInstandingPackets); if (mReliableIncoming[spot].mMode != cReliablePacketModeDelivered) @@ -597,7 +597,7 @@ void UdpReliableChannel::ReliablePacket(const udp_uchar *data, int dataLen) } mReliableIncoming[spot].mPacket->Release(); - mReliableIncoming[spot].mPacket = NULL; + mReliableIncoming[spot].mPacket = nullptr; mReliableIncomingId++; } } @@ -605,7 +605,7 @@ void UdpReliableChannel::ReliablePacket(const udp_uchar *data, int dataLen) { // not the one we need next, but it is later than the one we need , so store it in our buffer until it's turn comes up int spot = (int)(reliableId % mConfig.maxInstandingPackets); - if (mReliableIncoming[spot].mPacket == NULL) // only make the copy of it if we don't already have it in our buffer (in cases where it was sent twice, there would be no harm in the copy again since it must be the same packet, it's just inefficient) + if (mReliableIncoming[spot].mPacket == nullptr) // only make the copy of it if we don't already have it in our buffer (in cases where it was sent twice, there would be no harm in the copy again since it must be the same packet, it's just inefficient) { mReliableIncoming[spot].mMode = mode; mReliableIncoming[spot].mPacket = mUdpConnection->mUdpManager->CreatePacket(data + UdpConnection::cUdpPacketReliableSize, dataLen - UdpConnection::cUdpPacketReliableSize); @@ -651,14 +651,14 @@ void UdpReliableChannel::ReliablePacket(const udp_uchar *data, int dataLen) bufPtr += UdpMisc::PutValue16(bufPtr, (udp_ushort)(reliableId & 0xffff)); } - if (mBufferedAckPtr != NULL && mConfig.ackDeduping && ackAll) + if (mBufferedAckPtr != nullptr && mConfig.ackDeduping && ackAll) { memcpy(mBufferedAckPtr, buf, bufPtr - buf); } else { - udp_uchar *ptr = mUdpConnection->BufferedSend(buf, (int)(bufPtr - buf), NULL, 0, true); // safe to append on our data, it is stack data - if (mBufferedAckPtr == NULL) + udp_uchar *ptr = mUdpConnection->BufferedSend(buf, (int)(bufPtr - buf), nullptr, 0, true); // safe to append on our data, it is stack data + if (mBufferedAckPtr == nullptr) { // the buffered-ack ptr should always point to the earliest ack in the buffer, such that // a replacement ack-all will be processed by the receiver before any selective acks that may @@ -676,7 +676,7 @@ void UdpReliableChannel::ProcessPacket(ReliablePacketMode mode, const udp_uchar if (mode == cReliablePacketModeReliable) { // we are not a fragment, nor was there a fragment in progress, so we are a simple reliable packet, just send it to the app - if (mBigDataPtr != NULL) + if (mBigDataPtr != nullptr) { mUdpConnection->CallbackCorruptPacket(data, dataLen, cUdpCorruptionReasonFragmentExpected); return; @@ -687,7 +687,7 @@ void UdpReliableChannel::ProcessPacket(ReliablePacketMode mode, const udp_uchar else if (mode == cReliablePacketModeFragment) { // append onto end of big packet (or create new big packet if not existing already) - if (mBigDataPtr == NULL) + if (mBigDataPtr == nullptr) { if (dataLen < 4) { @@ -729,7 +729,7 @@ void UdpReliableChannel::ProcessPacket(ReliablePacketMode mode, const udp_uchar delete[] mBigDataPtr; mBigDataLen = 0; mBigDataTargetLen = 0; - mBigDataPtr = NULL; + mBigDataPtr = nullptr; } } } @@ -767,7 +767,7 @@ void UdpReliableChannel::Ack(udp_int64 reliableId) int pos = (int)(reliableId % mConfig.maxOutstandingPackets); PhysicalPacket *entry = &mPhysicalPackets[pos]; - if (entry->mDataPtr != NULL) // if this packet has not been acknowledged yet (sometimes we get back two acks for the same packet) + if (entry->mDataPtr != nullptr) // if this packet has not been acknowledged yet (sometimes we get back two acks for the same packet) { mNextNeedTime = 0; // something got acked, so we actually need to take the time next time it is offered @@ -829,14 +829,14 @@ void UdpReliableChannel::Ack(udp_int64 reliableId) // this packet we have queued has been acknowledged, so delete it from queue mReliableOutgoingBytes -= entry->mDataLen; entry->mDataLen = 0; - entry->mDataPtr = NULL; + entry->mDataPtr = nullptr; entry->mParent->Release(); - entry->mParent = NULL; + entry->mParent = nullptr; // advance the pending ptr until it reaches outgoingId or an entry that has yet to acknowledged while (mReliableOutgoingPendingId < mReliableOutgoingId) { - if (mPhysicalPackets[mReliableOutgoingPendingId % mConfig.maxOutstandingPackets].mDataPtr != NULL) + if (mPhysicalPackets[mReliableOutgoingPendingId % mConfig.maxOutstandingPackets].mDataPtr != nullptr) break; mReliableOutgoingPendingId++; } @@ -855,25 +855,25 @@ void UdpReliableChannel::Ack(udp_int64 reliableId) UdpReliableChannel::IncomingQueueEntry::IncomingQueueEntry() { - mPacket = NULL; + mPacket = nullptr; mMode = UdpReliableChannel::cReliablePacketModeReliable; } UdpReliableChannel::IncomingQueueEntry::~IncomingQueueEntry() { - if (mPacket != NULL) + if (mPacket != nullptr) mPacket->Release(); } UdpReliableChannel::PhysicalPacket::PhysicalPacket() { - mParent = NULL; + mParent = nullptr; } UdpReliableChannel::PhysicalPacket::~PhysicalPacket() { - if (mParent != NULL) + if (mParent != nullptr) mParent->Release(); } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpReliableChannel.h b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpReliableChannel.h index fab02474..033585eb 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpReliableChannel.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpReliableChannel.h @@ -64,7 +64,7 @@ class UdpReliableChannel void ProcessPacket(ReliablePacketMode mode, const udp_uchar *data, int dataLen); bool PullDown(int windowSpaceLeft); void FlushCoalesce(); - void SendCoalesce(const udp_uchar *data, int dataLen, const udp_uchar *data2 = NULL, int dataLen2 = 0); + void SendCoalesce(const udp_uchar *data, int dataLen, const udp_uchar *data2 = nullptr, int dataLen2 = 0); void QueueLogicalPacket(LogicalPacket *packet); UdpReliableConfig mConfig; @@ -138,7 +138,7 @@ inline int UdpReliableChannel::TotalPendingBytes() const inline void UdpReliableChannel::ClearBufferedAck() { - mBufferedAckPtr = NULL; + mBufferedAckPtr = nullptr; } inline udp_int64 UdpReliableChannel::GetReliableOutgoingId(int reliableStamp) const diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/UnicodeCharacterDataMap.h b/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/UnicodeCharacterDataMap.h index 741a6e80..493c5a2d 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/UnicodeCharacterDataMap.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/UnicodeCharacterDataMap.h @@ -122,7 +122,7 @@ namespace Plat_Unicode /** * Find a CharData for the given code point. - * @return null if no CharData exists for this code point + * @return nullptr if no CharData exists for this code point */ inline const CharData * CharDataMap::findCharData (const unicode_char_t code) const diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/utf8.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/utf8.cpp index da8e34e8..57bd0a0d 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/utf8.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/utf8.cpp @@ -87,7 +87,7 @@ int UTF8_convertCharToUTF16( char * ptr , UTF16 * ret ) int UTF8_convertToUTF16( char * ptr , UTF16 * ret, int limit ) { int len = 0; - while (( *ptr != 0 ) && ( len < ( limit - 1 ) ))//we use limit -1 to leave room for the null terminator + while (( *ptr != 0 ) && ( len < ( limit - 1 ) ))//we use limit -1 to leave room for the nullptr terminator { int clen = UTF8_convertCharToUTF16( ptr, ret ); ptr += clen; diff --git a/external/3rd/library/soePlatform/VChatAPI/projects/VChat/VChatAPI/common.cpp b/external/3rd/library/soePlatform/VChatAPI/projects/VChat/VChatAPI/common.cpp index 6076f618..2c07d021 100755 --- a/external/3rd/library/soePlatform/VChatAPI/projects/VChat/VChatAPI/common.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/projects/VChat/VChatAPI/common.cpp @@ -171,37 +171,37 @@ namespace VChatSystem token = strtok((char*)tmpTokenee.c_str(), seps ); - if( token != NULL ) + if( token != nullptr ) { game = token; /* Get next token: */ - token = strtok( NULL, seps ); + token = strtok( nullptr, seps ); } - if( token != NULL ) + if( token != nullptr ) { server = token; /* Get next token: */ - token = strtok( NULL, seps ); + token = strtok( nullptr, seps ); } - if( token != NULL ) + if( token != nullptr ) { name = token; /* Get next token: */ - token = strtok( NULL, seps ); + token = strtok( nullptr, seps ); } - while ( token != NULL ) + while ( token != nullptr ) { name += "."; name += token; /* Get next token: */ - token = strtok( NULL, seps ); + token = strtok( nullptr, seps ); } } @@ -216,29 +216,29 @@ namespace VChatSystem std::string tmpTokenee = userName; token = strtok((char*)tmpTokenee.c_str(), seps ); - if( token != NULL ) + if( token != nullptr ) { server = token; /* Get next token: */ - token = strtok( NULL, seps ); + token = strtok( nullptr, seps ); } - if( token != NULL ) + if( token != nullptr ) { name = token; /* Get next token: */ - token = strtok( NULL, seps ); + token = strtok( nullptr, seps ); } - while ( token != NULL ) + while ( token != nullptr ) { name += "."; name += token; /* Get next token: */ - token = strtok( NULL, seps ); + token = strtok( nullptr, seps ); } } diff --git a/external/3rd/library/soePlatform/VChatAPI/projects/VChat/VChatUnitTest/VChatClient.cpp b/external/3rd/library/soePlatform/VChatAPI/projects/VChat/VChatUnitTest/VChatClient.cpp index 869bf94a..db94c3cd 100755 --- a/external/3rd/library/soePlatform/VChatAPI/projects/VChat/VChatUnitTest/VChatClient.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/projects/VChat/VChatUnitTest/VChatClient.cpp @@ -23,7 +23,7 @@ unsigned VChatClient::GetAccountEx(const std::string &avatarName, { Reset(); - VChatAPI::GetAccount(avatarName, game, world, userID, avatarID, NULL); + VChatAPI::GetAccount(avatarName, game, world, userID, avatarID, nullptr); while(!IsDone() && !HasFailed()) { @@ -69,7 +69,7 @@ unsigned VChatClient::DeactivateVoiceAccount(const std::string &avatarName, { Reset(); - VChatAPI::DeactivateVoiceAccount(avatarName, game, world, NULL); + VChatAPI::DeactivateVoiceAccount(avatarName, game, world, nullptr); while(!IsDone() && !HasFailed()) { @@ -99,7 +99,7 @@ unsigned VChatClient::GetChannelEx( const std::string &channelName, bool persistent) { Reset(); - VChatAPI::GetChannel(channelName, game, server, description, password, limit, persistent, NULL); + VChatAPI::GetChannel(channelName, game, server, description, password, limit, persistent, nullptr); while(!IsDone() && !HasFailed()) { @@ -146,7 +146,7 @@ unsigned VChatClient::GetProximityChannelEx(const std::string &channelName, unsigned distModel) { Reset(); - VChatAPI::GetProximityChannel(channelName, game, server, description, password, limit, persistent, maxRange, clamping, rollOff, maxGain, distModel, NULL); + VChatAPI::GetProximityChannel(channelName, game, server, description, password, limit, persistent, maxRange, clamping, rollOff, maxGain, distModel, nullptr); while(!IsDone() && !HasFailed()) { @@ -183,7 +183,7 @@ unsigned VChatClient::ChannelCommandEx( const std::string &srcUserName, unsigned banTimeout) { Reset(); - VChatAPI::ChannelCommand(srcUserName, destUserName, destChannelAddress, command, banTimeout, NULL); + VChatAPI::ChannelCommand(srcUserName, destUserName, destChannelAddress, command, banTimeout, nullptr); while(!IsDone() && !HasFailed()) { @@ -211,7 +211,7 @@ unsigned VChatClient::ChangePasswordEx(const std::string &channelName, const std::string &password) { Reset(); - VChatAPI::ChangePassword(channelName, game, server, password, NULL); + VChatAPI::ChangePassword(channelName, game, server, password, nullptr); while(!IsDone() && !HasFailed()) { @@ -236,7 +236,7 @@ void VChatClient::OnChangePassword( unsigned track, unsigned VChatClient::GetAllChannelsEx() { Reset(); - VChatAPI::GetAllChannels(NULL); + VChatAPI::GetAllChannels(nullptr); while(!IsDone() && !HasFailed()) { @@ -274,7 +274,7 @@ unsigned VChatClient::DeleteChannelEx(const std::string &channelName, const std::string &server) { Reset(); - VChatAPI::DeleteChannel(channelName, game, server, NULL); + VChatAPI::DeleteChannel(channelName, game, server, nullptr); while(!IsDone() && !HasFailed()) { @@ -301,7 +301,7 @@ unsigned VChatClient::SetBanStatusEx(unsigned userID, unsigned banStatus) { Reset(); - VChatAPI::SetBanStatus(userID, banStatus, NULL); + VChatAPI::SetBanStatus(userID, banStatus, nullptr); while(!IsDone() && !HasFailed()) { @@ -328,7 +328,7 @@ unsigned VChatClient::GetChannelInfoEx( const std::string &channelName, const std::string &server) { Reset(); - VChatAPI::GetChannelInfo(channelName, game, server, NULL); + VChatAPI::GetChannelInfo(channelName, game, server, nullptr); while(!IsDone() && !HasFailed()) { @@ -369,7 +369,7 @@ unsigned VChatClient::GetChannelV2Ex(const std::string &channelName, bool persistent) { Reset(); - VChatAPI::GetChannelV2(channelName, game, server, description, password, limit, persistent, NULL); + VChatAPI::GetChannelV2(channelName, game, server, description, password, limit, persistent, nullptr); while(!IsDone() && !HasFailed()) { @@ -419,7 +419,7 @@ unsigned VChatClient::AddCharacterChannelEx(const unsigned stationID, Reset(); VChatAPI::AddCharacterChannel(stationID, avatarID, characterName, worldName, gameCode, channelType, channelDescription, - password, channelAddress, locale, NULL); + password, channelAddress, locale, nullptr); while(!IsDone() && !HasFailed()) { @@ -449,7 +449,7 @@ unsigned VChatClient::RemoveCharacterChannelEx( const unsigned stationID, { Reset(); VChatAPI::RemoveCharacterChannel(stationID, avatarID, characterName, worldName, - gameCode, channelType, NULL); + gameCode, channelType, nullptr); while(!IsDone() && !HasFailed()) { @@ -477,7 +477,7 @@ unsigned VChatClient::GetCharacterChannelEx(const unsigned stationID, const std::string &gameCode) { Reset(); - VChatAPI::GetCharacterChannel(stationID, characterName, worldName, gameCode, NULL); + VChatAPI::GetCharacterChannel(stationID, characterName, worldName, gameCode, nullptr); while(!IsDone() && !HasFailed()) { diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/api.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/api.cpp index 3af047a2..9c9c8084 100644 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/api.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/api.cpp @@ -45,7 +45,7 @@ namespace API_NAMESPACE //////////////////////////////////////////////////////////////////////////////// CommonAPI::CommonAPI(const char * hostList, const char * failoverHostList, unsigned connectionLimit, unsigned maxMsgSize, unsigned bufferSize) - : mManager(NULL) + : mManager(nullptr) , mHostReconnectTimeout() , mIdleHosts() , mHostMap() @@ -247,7 +247,7 @@ namespace API_NAMESPACE connection->Send((const char*)buffer, size); #endif } - mLastRequestInputTime = time(NULL); + mLastRequestInputTime = time(nullptr); } #ifdef UDP_LIBRARY @@ -466,7 +466,7 @@ namespace API_NAMESPACE RequestMap_t::iterator reqIterator = mRequestMap.find(trackingNumber); bool found = false; - *pUserData = NULL; + *pUserData = nullptr; if (reqIterator != mRequestMap.end()) { TrackedRequest & request = reqIterator->second; @@ -594,7 +594,7 @@ namespace API_NAMESPACE CommonAPI::ApiConnectionInfo * CommonAPI::GetNextUsableConnection() { - ApiConnectionInfo * connectionInfo = NULL; + ApiConnectionInfo * connectionInfo = nullptr; if (!mUsableHosts[0].empty()) { @@ -617,7 +617,7 @@ namespace API_NAMESPACE CommonAPI::ApiConnectionInfo * CommonAPI::FindConnectionInfo(ApiConnection * connection) { // find the connection in the set - ApiConnectionInfo * pInfo = NULL; + ApiConnectionInfo * pInfo = nullptr; ConnectionMap_t::iterator iter; if ( ((iter = mActiveHosts[0].find(connection)) != mActiveHosts[0].end()) || ((iter = mActiveHosts[1].find(connection)) != mActiveHosts[1].end()) ) @@ -777,8 +777,8 @@ namespace API_NAMESPACE mspEnumerationToVersionStringMap = &enumerationToVersionStringMap; } - std::map *VersionMap::mspVersionStringToEnumerationMap = NULL; - std::map *VersionMap::mspEnumerationToVersionStringMap = NULL; + std::map *VersionMap::mspVersionStringToEnumerationMap = nullptr; + std::map *VersionMap::mspEnumerationToVersionStringMap = nullptr; //////////////////////////////////////////////////////////////////////////////// @@ -1009,7 +1009,7 @@ namespace API_NAMESPACE mspLabelToEntryMap = &labelToEntryMap; } - ConfigurationMap::LabelToEntryMap_t *ConfigurationMap::mspLabelToEntryMap = NULL; + ConfigurationMap::LabelToEntryMap_t *ConfigurationMap::mspLabelToEntryMap = nullptr; //////////////////////////////////////////////////////////////////////////////// diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/api.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/api.h index 37512cbd..9cd24094 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/api.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/api.h @@ -58,7 +58,7 @@ namespace API_NAMESPACE typedef std::set TrackingSet_t; struct ApiConnectionInfo { - ApiConnectionInfo(ApiConnection * Connection = NULL) : mConnection(Connection), mIsShuttingDown(false) { } + ApiConnectionInfo(ApiConnection * Connection = nullptr) : mConnection(Connection), mIsShuttingDown(false) { } ApiConnection * mConnection; TrackingSet_t mOutstandingRequests; diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/apiMessages.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/apiMessages.cpp index c38875ab..ae5cdc76 100644 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/apiMessages.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/apiMessages.cpp @@ -253,7 +253,7 @@ namespace API_NAMESPACE Base * Base::Create(unsigned MsgId, StorageVector_t *pStorageVector) { - Base * msg = NULL; + Base * msg = nullptr; if (ms_pClassMap) { std::map::iterator classIter = ms_pClassMap->find(MsgId); @@ -272,7 +272,7 @@ namespace API_NAMESPACE const char * Base::GetMessageName(unsigned msgId) { - const char * requestString = NULL; + const char * requestString = nullptr; if (ms_pClassMap) { std::map::iterator classIter = ms_pClassMap->find(msgId); @@ -287,7 +287,7 @@ namespace API_NAMESPACE const char * Base::GetMessageIDString(unsigned msgId) { - const char * idString = NULL; + const char * idString = nullptr; if (ms_pClassMap) { std::map::iterator classIter = ms_pClassMap->find(msgId); @@ -304,7 +304,7 @@ namespace API_NAMESPACE { static std::map classMap; - if (ms_pClassMap == NULL) { + if (ms_pClassMap == nullptr) { ms_pClassMap = &classMap; } @@ -326,24 +326,24 @@ namespace API_NAMESPACE } Base::DeepPointer::DeepPointer() : - m_ptr(NULL) + m_ptr(nullptr) { } Base::DeepPointer::DeepPointer(const Base & source) : - m_ptr(NULL) + m_ptr(nullptr) { m_ptr = source.Clone(m_storageVector); } Base::DeepPointer::DeepPointer(const Base * source) : - m_ptr(NULL) + m_ptr(nullptr) { m_ptr = source->Clone(m_storageVector); } Base::DeepPointer::DeepPointer(const DeepPointer & source) : - m_ptr(NULL) + m_ptr(nullptr) { if (source.m_ptr) { m_ptr = source->Clone(m_storageVector); } } @@ -364,7 +364,7 @@ namespace API_NAMESPACE { Base *oldPtr = m_ptr; - m_ptr = rhs ? rhs->Clone(m_storageVector) : NULL; + m_ptr = rhs ? rhs->Clone(m_storageVector) : nullptr; if (oldPtr) { oldPtr->~Base(); @@ -377,7 +377,7 @@ namespace API_NAMESPACE { Base *oldPtr = m_ptr; - m_ptr = rhs.m_ptr ? rhs->Clone(m_storageVector) : NULL; + m_ptr = rhs.m_ptr ? rhs->Clone(m_storageVector) : nullptr; if (oldPtr) { oldPtr->~Base(); @@ -396,7 +396,7 @@ namespace API_NAMESPACE return *m_ptr; } - std::map *Base::ms_pClassMap = NULL; + std::map *Base::ms_pClassMap = nullptr; #if defined(PRINTABLE_MESSAGES) || defined(TRACK_READ_WRITE_FAILURES) Basic::Basic() diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/apiMessages.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/apiMessages.h index ef733afb..12b00516 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/apiMessages.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/apiMessages.h @@ -60,7 +60,7 @@ namespace API_NAMESPACE protected: struct DECLSPEC MemberInfo { - MemberInfo(soe::AutoVariableBase *dataIn = NULL, unsigned sizeIn = 1, unsigned versionIn = 0, soe::EVersionEffect effectIn = soe::eNoEffect) + MemberInfo(soe::AutoVariableBase *dataIn = nullptr, unsigned sizeIn = 1, unsigned versionIn = 0, soe::EVersionEffect effectIn = soe::eNoEffect) : data(dataIn) , size(sizeIn) , version(versionIn) @@ -97,8 +97,8 @@ namespace API_NAMESPACE virtual Base * Clone() const; virtual Base * Clone(StorageVector_t &storageVector) const; virtual const char * MessageName() const { return "Base"; } - virtual const char * MessageIDString() const { return "NULL"; } - static Base * Create(unsigned MsgId, StorageVector_t *pStorageVector = NULL); + virtual const char * MessageIDString() const { return "nullptr"; } + static Base * Create(unsigned MsgId, StorageVector_t *pStorageVector = nullptr); static const char * GetMessageName(unsigned msgId); static const char * GetMessageIDString(unsigned msgId); diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/apiPinned.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/apiPinned.cpp index 5a1dd30d..2f72d6e0 100644 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/apiPinned.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/apiPinned.cpp @@ -291,7 +291,7 @@ namespace NAMESPACE if (!mActiveHosts[0].empty()) { // get connection that corresponds to hash index - ApiConnection * connection = NULL; + ApiConnection * connection = nullptr; unsigned hashIndex = hashValue % mActiveHosts[0].size(); unsigned curIndex = 0; for (ConnectionSet_t::iterator it = mActiveHosts[0].begin(); it != mActiveHosts[0].end(); it++, curIndex++) @@ -314,7 +314,7 @@ namespace NAMESPACE else if (!mActiveHosts[1].empty()) { // get connection that corresponds to hash index - ApiConnection * connection = NULL; + ApiConnection * connection = nullptr; unsigned hashIndex = hashValue % mActiveHosts[1].size(); unsigned curIndex = 0; for (ConnectionSet_t::iterator it = mActiveHosts[1].begin(); it != mActiveHosts[1].end(); it++, curIndex++) diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/cmdLine.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/cmdLine.cpp index 8c04219e..9d82c979 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/cmdLine.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/cmdLine.cpp @@ -132,7 +132,7 @@ int CmdLine::SplitLine(int argc, char **argv) bool CmdLine::IsSwitch(const char *pParam) { - if (pParam==NULL) + if (pParam==nullptr) return false; // switches must non-empty @@ -201,7 +201,7 @@ StringType CmdLine::GetSafeArgument(const char *pSwitch, int iIdx, const char *p { StringType sRet; - if (pDefault!=NULL) + if (pDefault!=nullptr) sRet = pDefault; try diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/date.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/date.cpp index 025883cd..0184793d 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/date.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/date.cpp @@ -42,7 +42,7 @@ namespace soe , mSecond(0) { struct tm timeStruct; - struct tm *gotTime = NULL; + struct tm *gotTime = nullptr; #ifdef WIN32 gotTime = gmtime(&src); #else diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/dateUtils.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/dateUtils.h index fecca883..be898b53 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/dateUtils.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/dateUtils.h @@ -144,7 +144,7 @@ namespace soe inline time_t localTimeToGmt(int dstOffsetMinutes = DST_OFFSET_MINUTES_USA) { - time_t localTime = time(NULL); + time_t localTime = time(nullptr); struct tm gt = *(gmtime(&localTime)); struct tm lt = *(localtime(&localTime)); bool isDst = (lt.tm_isdst? true:false); @@ -187,7 +187,7 @@ namespace soe dstOffsetSecs = dstOffsetMS/1000; return retval; } - inline int getGMT(time_t & theTime, const char *id = NULL) + inline int getGMT(time_t & theTime, const char *id = nullptr) { UDate date; UErrorCode ec; diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/genericRateLimitingMechanism.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/genericRateLimitingMechanism.h index 20b16fa1..66934bc1 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/genericRateLimitingMechanism.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/genericRateLimitingMechanism.h @@ -245,7 +245,7 @@ namespace soe template const LimitType * GenericRateLimitingMechanism::GetRateLimit(const FixedKeyType & fixedKey) const { - LimitType const * rateLimit = NULL; + LimitType const * rateLimit = nullptr; typename RateLimitByFixedKeyMap_t::const_iterator limIter = mRateLimits.find(fixedKey); if (limIter != mRateLimits.end()) { @@ -258,7 +258,7 @@ namespace soe template const LimitType * GenericRateLimitingMechanism::GetNextRateLimit(FixedKeyType & fixedKey) const { - LimitType const * rateLimit = NULL; + LimitType const * rateLimit = nullptr; typename RateLimitByFixedKeyMap_t::const_iterator limIter = mRateLimits.upper_bound(fixedKey); if (limIter != mRateLimits.end()) { @@ -272,7 +272,7 @@ namespace soe template const CounterType * GenericRateLimitingMechanism::GetRateCounter(const FixedKeyType & fixedKey, const ArbitraryKeyType & arbitraryKey) const { - const CounterType * counter = NULL; + const CounterType * counter = nullptr; typename RateCounterByKeyPairMap_t::const_iterator counterIter = mRateCounters.find(KeyPair(fixedKey, arbitraryKey)); if (counterIter != mRateCounters.end()) { counter = &(counterIter->second->mCounter); diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/hashtable.hpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/hashtable.hpp index 00f9cd75..4fc2ace9 100644 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/hashtable.hpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/hashtable.hpp @@ -174,11 +174,11 @@ template class HashTable bool Remove(T& obj, int hashValue); void Reset(); // removes all entries from the table - T *FindFirst(int hashValue) const; // returns NULL if not found - T *FindNext(T *prevResult) const; // returns NULL if not found + T *FindFirst(int hashValue) const; // returns nullptr if not found + T *FindNext(T *prevResult) const; // returns nullptr if not found - T *WalkFirst() const; // returns NULL if not found - T *WalkNext(T *prevResult) const; // returns NULL if not found + T *WalkFirst() const; // returns nullptr if not found + T *WalkNext(T *prevResult) const; // returns nullptr if not found void Resize(int hashSize); // the actual hash size will be rounded up to the next larger prime number (very slow, not recommended) void GetStatistics(HashTableStatistics *stats) const; @@ -200,7 +200,7 @@ template class HashTable template HashTable::HashTable(int hashSize) { - mTable = NULL; + mTable = nullptr; mTableSize = 0; mEntryCount = 0; mStatUsedSlots = 0; @@ -220,9 +220,9 @@ template void HashTable::Insert(T& obj, int hashValue) entry->hashValue = hashValue; int spot = ((unsigned)hashValue) % mTableSize; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) { - entry->nextEntry = NULL; + entry->nextEntry = nullptr; mTable[spot] = entry; mStatUsedSlots++; } @@ -239,14 +239,14 @@ template bool HashTable::Remove(T& obj, int hashValue) int spot = ((unsigned)hashValue) % mTableSize; HashEntry* next = mTable[spot]; HashEntry** prev = &mTable[spot]; - while (next != NULL) + while (next != nullptr) { if (next->obj == obj && next->hashValue == hashValue) { *prev = next->nextEntry; delete next; mEntryCount--; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) mStatUsedSlots--; return(true); break; @@ -263,17 +263,17 @@ template void HashTable::Reset() for (int spot = 0; spot < mTableSize; spot++) { HashEntry *curr = mTable[spot]; - if (curr != NULL) + if (curr != nullptr) { mStatUsedSlots--; - while (curr != NULL) + while (curr != nullptr) { HashEntry *next = curr->nextEntry; delete curr; mEntryCount--; curr = next; } - mTable[spot] = NULL; + mTable[spot] = nullptr; } } } @@ -281,13 +281,13 @@ template void HashTable::Reset() template T *HashTable::FindFirst(int hashValue) const { HashEntry *entry = mTable[((unsigned)hashValue) % mTableSize]; - while (entry != NULL) + while (entry != nullptr) { if (entry->hashValue == hashValue) return(&entry->obj); entry = entry->nextEntry; } - return(NULL); + return(nullptr); } template T *HashTable::FindNext(T *prevResult) const @@ -295,13 +295,13 @@ template T *HashTable::FindNext(T *prevResult) const HashEntry *entry = (HashEntry *)(((char *)prevResult) - offsetof(HashEntry, obj)); int hashValue = entry->hashValue; entry = entry->nextEntry; - while (entry != NULL) + while (entry != nullptr) { if (entry->hashValue == hashValue) return(&entry->obj); entry = entry->nextEntry; } - return(NULL); + return(nullptr); } template T *HashTable::WalkFirst() const @@ -309,10 +309,10 @@ template T *HashTable::WalkFirst() const for (int bucket = 0; bucket < mTableSize; bucket++) { HashEntry *entry = mTable[bucket]; - if (entry != NULL) + if (entry != nullptr) return(&entry->obj); } - return(NULL); + return(nullptr); } template T *HashTable::WalkNext(T *prevResult) const @@ -321,17 +321,17 @@ template T *HashTable::WalkNext(T *prevResult) const int bucket = ((unsigned)entry->hashValue) % mTableSize; entry = entry->nextEntry; - if (entry != NULL) + if (entry != nullptr) return(&entry->obj); bucket++; // go onto next bucket for (; bucket < mTableSize; bucket++) { HashEntry *entry = mTable[bucket]; - if (entry != NULL) + if (entry != nullptr) return(&entry->obj); } - return(NULL); + return(nullptr); } template void HashTable::Resize(int hashSize) @@ -351,16 +351,16 @@ template void HashTable::Resize(int hashSize) for (int i = 0; i < oldSize; i++) { HashEntry* next = oldTable[i]; - while (next != NULL) + while (next != nullptr) { HashEntry* hold = next; next = next->nextEntry; // insert hold into new table int spot = ((unsigned)hold->hashValue) % mTableSize; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) { - hold->nextEntry = NULL; + hold->nextEntry = nullptr; mTable[spot] = hold; mStatUsedSlots++; } @@ -414,11 +414,11 @@ template class ObjectHashTable bool Remove(T obj, int hashValue); void Reset(); // removes all entries from the table - T FindFirst(int hashValue) const; // returns NULL if not found - T FindNext(T prevResult) const; // returns NULL if not found + T FindFirst(int hashValue) const; // returns nullptr if not found + T FindNext(T prevResult) const; // returns nullptr if not found - T WalkFirst() const; // returns NULL if not found - T WalkNext(T prevResult) const; // returns NULL if not found + T WalkFirst() const; // returns nullptr if not found + T WalkNext(T prevResult) const; // returns nullptr if not found void Resize(int hashSize); // the actual hash size will be rounded up to the next larger prime number (very slow, not recommended) void GetStatistics(HashTableStatistics *stats) const; @@ -433,7 +433,7 @@ template class ObjectHashTable template ObjectHashTable::ObjectHashTable(int hashSize) { - mTable = NULL; + mTable = nullptr; mTableSize = 0; mEntryCount = 0; mStatUsedSlots = 0; @@ -451,9 +451,9 @@ template void ObjectHashTable::Insert(T obj, int hashValue) obj->mHashValue = hashValue; int spot = ((unsigned)hashValue) % mTableSize; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) { - obj->mHashNextEntry = NULL; + obj->mHashNextEntry = nullptr; mTable[spot] = obj; mStatUsedSlots++; } @@ -470,14 +470,14 @@ template bool ObjectHashTable::Remove(T obj, int hashValue) int spot = ((unsigned)hashValue) % mTableSize; T next = mTable[spot]; T *prev = &mTable[spot]; - while (next != NULL) + while (next != nullptr) { if (next == obj) { *prev = (T)next->mHashNextEntry; - next->mHashNextEntry = NULL; + next->mHashNextEntry = nullptr; mEntryCount--; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) mStatUsedSlots--; return(true); break; @@ -494,16 +494,16 @@ template void ObjectHashTable::Reset() for (int spot = 0; spot < mTableSize; spot++) { T curr = mTable[spot]; - if (curr != NULL) + if (curr != nullptr) { - while (curr != NULL) + while (curr != nullptr) { T next = (T)curr->mHashNextEntry; - curr->mHashNextEntry = NULL; + curr->mHashNextEntry = nullptr; mEntryCount--; curr = next; } - mTable[spot] = NULL; + mTable[spot] = nullptr; mStatUsedSlots--; } } @@ -512,13 +512,13 @@ template void ObjectHashTable::Reset() template T ObjectHashTable::FindFirst(int hashValue) const { T entry = mTable[((unsigned)hashValue) % mTableSize]; - while (entry != NULL) + while (entry != nullptr) { if (entry->mHashValue == hashValue) return(entry); entry = (T)entry->mHashNextEntry; } - return(NULL); + return(nullptr); } template T ObjectHashTable::FindNext(T prevResult) const @@ -526,13 +526,13 @@ template T ObjectHashTable::FindNext(T prevResult) const T entry = prevResult; int hashValue = entry->mHashValue; entry = (T)entry->mHashNextEntry; - while (entry != NULL) + while (entry != nullptr) { if (entry->mHashValue == hashValue) return(entry); entry = (T)entry->mHashNextEntry; } - return(NULL); + return(nullptr); } template T ObjectHashTable::WalkFirst() const @@ -540,10 +540,10 @@ template T ObjectHashTable::WalkFirst() const for (int bucket = 0; bucket < mTableSize; bucket++) { T entry = mTable[bucket]; - if (entry != NULL) + if (entry != nullptr) return(entry); } - return(NULL); + return(nullptr); } template T ObjectHashTable::WalkNext(T prevResult) const @@ -552,17 +552,17 @@ template T ObjectHashTable::WalkNext(T prevResult) const int bucket = ((unsigned)entry->mHashValue) % mTableSize; entry = (T)entry->mHashNextEntry; - if (entry != NULL) + if (entry != nullptr) return(entry); bucket++; // go onto next bucket for (; bucket < mTableSize; bucket++) { entry = mTable[bucket]; - if (entry != NULL) + if (entry != nullptr) return(entry); } - return(NULL); + return(nullptr); } template void ObjectHashTable::Resize(int hashSize) @@ -582,16 +582,16 @@ template void ObjectHashTable::Resize(int hashSize) for (int i = 0; i < oldSize; i++) { T next = oldTable[i]; - while (next != NULL) + while (next != nullptr) { T hold = next; next = (T)next->mHashNextEntry; // insert hold into new table int spot = ((unsigned)hold->mHashValue) % mTableSize; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) { - hold->mHashNextEntry = NULL; + hold->mHashNextEntry = nullptr; mTable[spot] = hold; mStatUsedSlots++; } diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/log.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/log.cpp index e14aee9a..72cac84a 100644 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/log.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/log.cpp @@ -115,7 +115,7 @@ Logger::Logger(const char *programName, void Logger::LoggerInit(const char *programName) { char buf[1024]; - FILE *logDir = NULL; + FILE *logDir = nullptr; if (0 != (m_logType & eUseLocalFile)) { @@ -124,13 +124,13 @@ void Logger::LoggerInit(const char *programName) { cmkdir(m_dirPrefix.c_str(), 0755); } - else if(logDir != NULL) + else if(logDir != nullptr) { fclose(logDir); } tm now; - time_t t = time(NULL); + time_t t = time(nullptr); LOGGER_GET_CURR_TIME(now, t); @@ -148,7 +148,7 @@ void Logger::LoggerInit(const char *programName) { cmkdir(buf, 0755); } - else if(logDir != NULL) + else if(logDir != nullptr) { fclose(logDir); } @@ -330,7 +330,7 @@ void Logger::logSimple(unsigned logenum, int level, const char *message) { return; } - time_t t = time(NULL); + time_t t = time(nullptr); LogInfo *info = (*iter).second; if(level >= info->level) { @@ -400,7 +400,7 @@ void Logger::logSimpleWithSys(unsigned logenum, unsigned priority, int level, co { return; } - time_t t = time(NULL); + time_t t = time(nullptr); LogInfo *info = (*iter).second; if(level >= info->level) @@ -482,7 +482,7 @@ void Logger::logWithSys(unsigned logenum, unsigned priority, int level, const ch { return; } - time_t t = time(NULL); + time_t t = time(nullptr); LogInfo *info = (*iter).second; if(level >= info->level) @@ -562,7 +562,7 @@ void Logger::vlogWithSys(unsigned logenum, unsigned priority, int level, const c { return; } - time_t t = time(NULL); + time_t t = time(nullptr); LogInfo *info = (*iter).second; if(level >= info->level) @@ -630,14 +630,14 @@ void Logger::vlog(unsigned logenum, int level, const char *message, va_list argp void Logger::rollDate(time_t t) { char buf[80]; - FILE *logDir = NULL; + FILE *logDir = nullptr; logDir = fopen(m_dirPrefix.c_str(), "r+"); if(errno == ENOENT) { cmkdir(m_dirPrefix.c_str(), 0755); } - else if(logDir != NULL) + else if(logDir != nullptr) { fclose(logDir); } @@ -653,7 +653,7 @@ void Logger::rollDate(time_t t) { cmkdir(buf, 0755); } - else if(logDir != NULL) + else if(logDir != nullptr) { fclose(logDir); } @@ -737,7 +737,7 @@ void Logger::rollLog(LogInfo *logInfo) { std::string newLogName; char timeStampBuffer[256]; - time_t t = time(NULL); + time_t t = time(nullptr); tm now; int r; int nTries = 10; diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorAPI.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorAPI.cpp index 214e33be..cb3a87d0 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorAPI.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorAPI.cpp @@ -48,7 +48,7 @@ MonitorObject::~MonitorObject() if( mConnection ) { - mConnection->SetHandler(NULL); + mConnection->SetHandler(nullptr); mConnection->Disconnect(); mConnection->Release(); } @@ -72,10 +72,10 @@ char hold[214]; UdpConnection::DisconnectReasonText( mConnection->GetOtherSideDisconnectReason())); } } - mConnection->SetHandler(NULL); + mConnection->SetHandler(nullptr); mConnection->Disconnect(); mConnection->Release(); - mConnection = NULL; + mConnection = nullptr; } } @@ -91,10 +91,10 @@ void MonitorObject::OnRoutePacket(UdpConnection * con, const uchar *data, int d simpleMessage msg(data); - if( con == NULL ) + if( con == nullptr ) { if( mbprint) - fprintf(stderr,"MONITOR API: MonitorObject.OnRoutePacket, recived a NULL connection.?\n"); + fprintf(stderr,"MONITOR API: MonitorObject.OnRoutePacket, recived a nullptr connection.?\n"); return; } @@ -120,7 +120,7 @@ void MonitorObject::OnRoutePacket(UdpConnection * con, const uchar *data, int d if( mHierarchySent == true ) { if( mMonitorData->processElementsRequest(con,mSequence,(char *)&data[6],dataLen,mlastUpdateTime )) - mlastUpdateTime = time(NULL); + mlastUpdateTime = time(nullptr); break; } // NOTE: if mHierarchy is not sent or changed, then send it. @@ -258,7 +258,7 @@ MonitorManager::MonitorManager(char *configFile, CMonitorData *_gamedata, UdpMan { mManager = manager; mbprint = _bprint; - passString = NULL; + passString = nullptr; mMonitorData = _gamedata; mObjectCount = 0; @@ -288,7 +288,7 @@ void MonitorManager::OnConnectRequest(UdpConnection *con) { if( con ) { - con->SetHandler(NULL); + con->SetHandler(nullptr); con->Disconnect(); con->Release(); } @@ -310,7 +310,7 @@ void MonitorManager::GiveTime() // check if the monitor object is no longer connected for (int i = 0; i < mObjectCount; i++) { - if( mObject[i]->mConnection == NULL || + if( mObject[i]->mConnection == nullptr || mObject[i]->mConnection->GetStatus() == UdpConnection::cStatusDisconnected ) { MonitorObject *o = mObject[i]; @@ -342,7 +342,7 @@ int x; char buffer[1024]; FILE *fp = fopen(filename,"r"); - if (fp == NULL) + if (fp == nullptr) { fprintf(stderr,"Monitor API: could not open %s file\nTHIS FILE IS REQUIRED.\n", filename); return false; @@ -364,7 +364,7 @@ char buffer[1024]; x = 0; while(!feof(fp)) { - if (fgets( buffer, 1023, fp) != NULL) { + if (fgets( buffer, 1023, fp) != nullptr) { // get rid of '\n' and '\r' for comparisons strtok(buffer,"\r\n"); @@ -402,17 +402,17 @@ CMonitorAPI::CMonitorAPI( char *configFile, unsigned short Port, bool _bprint , mbprint = _bprint; mPort = Port; - mAddress = NULL; + mAddress = nullptr; if( address ) { mAddress = (char *)malloc(strlen(address)+1); strcpy(mAddress,address); } - if( mang == NULL ) + if( mang == nullptr ) { UdpManager::Params params; - params.handler = NULL; + params.handler = nullptr; params.maxConnections = CONNECTION_MAX; params.outgoingBufferSize = 1000000; params.noDataTimeout = 130000; diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorAPI.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorAPI.h index fa60d698..60fa8509 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorAPI.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorAPI.h @@ -72,13 +72,13 @@ class CMonitorAPI { public: - CMonitorAPI( char *configFile, unsigned short Port, bool _bprint = false , char * address = NULL, UdpManager * mang = NULL ); + CMonitorAPI( char *configFile, unsigned short Port, bool _bprint = false , char * address = nullptr, UdpManager * mang = nullptr ); ~CMonitorAPI(); void Update(); - void add( const char *label, int id, int ping = MON_PING_5MIN, char *des = NULL ); + void add( const char *label, int id, int ping = MON_PING_5MIN, char *des = nullptr ); void setDescription( int Id, const char *Description ) ; diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorData.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorData.cpp index 38614bbf..0d3c66d5 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorData.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorData.cpp @@ -55,7 +55,7 @@ CMonitorData::CMonitorData() { m_sequence = 1; - m_buffer = NULL; + m_buffer = nullptr; m_nbuffer = 0; m_count = 0; m_max = ELEMENT_START_VALUE; @@ -85,7 +85,7 @@ void CMonitorData::resize_buffer(int new_size) { char *temp; - if( m_buffer != NULL ) + if( m_buffer != nullptr ) { temp = m_buffer; m_buffer = new char[ new_size]; @@ -252,7 +252,7 @@ char *p; { if( get_bit(mark,x) == 0 ) { - if( m_data[x].discription != NULL ) + if( m_data[x].discription != nullptr ) snprintf(tmp, sizeof(tmp), "%d,%s|", m_data[x].id, m_data[x].discription); else snprintf(tmp, sizeof(tmp), "%d, |", m_data[x].id); @@ -282,7 +282,7 @@ char *p; { flag = 2; - if( m_data[x].discription != NULL ) + if( m_data[x].discription != nullptr ) snprintf(tmp, sizeof(tmp), "%d,%s|", m_data[x].id, m_data[x].discription); else snprintf(tmp, sizeof(tmp), "%d, |", m_data[x].id); @@ -338,7 +338,7 @@ int x; //******* Discription ****** delete [] m_data[x].discription; - m_data[x].discription = NULL; + m_data[x].discription = nullptr; if( des ) { @@ -387,10 +387,10 @@ int x; for(x=0;x= x ) return NULL; return m_data[x].discription;} + char *getDescription(int x){ if( m_ndata >= x ) return nullptr; return m_data[x].discription;} int pingValue(int p); void set(int Id, int value); void remove(int Id); diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/priority.hpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/priority.hpp index 19f34ab3..516619db 100644 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/priority.hpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/priority.hpp @@ -37,12 +37,12 @@ template class PriorityQueue PriorityQueue(int queueSize); ~PriorityQueue(); - T* Top(); // returns NULL if queue is empty - T* TopRemove(); // returns NULL if queue is empty - T* TopRemove(P priority); // removes item from queue if it has a lower priority value, otherwise return NULL + T* Top(); // returns nullptr if queue is empty + T* TopRemove(); // returns nullptr if queue is empty + T* TopRemove(P priority); // removes item from queue if it has a lower priority value, otherwise return nullptr T* Add(T* entry, P priority); // reprioritizes if already in queue, returns entry always T* Remove(T* entry); // returns entry always (even if it was not in the queue) - P *GetPriority(T* entry); // returns NULL if entry is not in the queue + P *GetPriority(T* entry); // returns nullptr if entry is not in the queue int QueueUsed(); // returns how many entries are in the queue protected: struct QueueEntry @@ -88,14 +88,14 @@ template PriorityQueue::~PriorityQueue() template T* PriorityQueue::Top() { if (mQueueEnd == 0) - return(NULL); + return(nullptr); return(mQueue[0].entry); } template T* PriorityQueue::TopRemove() { if (mQueueEnd == 0) - return(NULL); + return(nullptr); T* top = mQueue[0].entry; Remove(top); return(top); @@ -105,14 +105,14 @@ template T* PriorityQueue::TopRemove(P priority) { if (mQueueEnd > 0 && mQueue[0].priority <= priority) return(Remove(mQueue[0].entry)); - return(NULL); + return(nullptr); } template P* PriorityQueue::GetPriority(T* entry) { if (entry->mPriorityQueuePosition >= 0) return(&mQueue[entry->mPriorityQueuePosition].priority); - return(NULL); + return(nullptr); } template T* PriorityQueue::Add(T* entry, P priority) @@ -121,7 +121,7 @@ template T* PriorityQueue::Add(T* entry, P priorit { // not in queue, so add it to the bottom if (mQueueEnd >= mQueueSize) - return(NULL); + return(nullptr); mQueue[mQueueEnd].entry = entry; mQueue[mQueueEnd].priority = priority; mQueue[mQueueEnd].entry->mPriorityQueuePosition = mQueueEnd; diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/stringutils.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/stringutils.cpp index be0a4376..07c4bcc2 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/stringutils.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/stringutils.cpp @@ -78,12 +78,12 @@ namespace soe if (pos == std::string::npos) { // tok not found take the whole thing - if (dest != NULL) { dest->assign(*base);} + if (dest != nullptr) { dest->assign(*base);} base->clear(); return; } - if (dest != NULL) {dest->assign(base->substr(0,pos));} + if (dest != nullptr) {dest->assign(base->substr(0,pos));} base->erase(0,pos + tok.length()); } diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/stringutils.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/stringutils.h index f994210c..f70facc5 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/stringutils.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/stringutils.h @@ -21,7 +21,7 @@ namespace soe void trim(std::string& str); void crack(std::string * dest, std::string * base, const std::string& tok); void inline crack(std::string& dest, std::string& base, const std::string& tok) {crack(&dest, &base, tok);} - void inline crack(std::string& base, const std::string& tok) {crack(NULL, &base, tok);} + void inline crack(std::string& base, const std::string& tok) {crack(nullptr, &base, tok);} class lowerCaseString { diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/substringSearchTree.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/substringSearchTree.h index 9acfcea7..ebe0729d 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/substringSearchTree.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/substringSearchTree.h @@ -156,15 +156,15 @@ private: class letterNode { public: - letterNode() : mpData(NULL), mpChildren(NULL), mNumChildren(0) { } - letterNode(const letter_t & letter) : mLetter(letter), mpData(NULL), mpChildren(NULL), mNumChildren(0) { } + letterNode() : mpData(nullptr), mpChildren(nullptr), mNumChildren(0) { } + letterNode(const letter_t & letter) : mLetter(letter), mpData(nullptr), mpChildren(nullptr), mNumChildren(0) { } ~letterNode(); - inline bool hasData() const { return (mpData != NULL); } + inline bool hasData() const { return (mpData != nullptr); } inline data_t & getData() { return *mpData; } inline const data_t & getData() const { return *mpData; } inline void setData(const data_t & data) { if (mpData) { *mpData = data; } else { mpData = new data_t(data); } } - inline void removeData() { delete mpData; mpData = NULL; } + inline void removeData() { delete mpData; mpData = nullptr; } letterNode * get(letter_t index) const; bool put(letter_t index, letterNode ** tree); @@ -182,7 +182,7 @@ private: inline letter_t & letter() { return mLetter; } inline const letter_t & letter() const { return mLetter; } - inline bool hasNoChildren() const { return (mpChildren == NULL) || (mNumChildren == 0); } + inline bool hasNoChildren() const { return (mpChildren == nullptr) || (mNumChildren == 0); } private: letter_t mLetter; @@ -272,9 +272,9 @@ bool stringTree::seek(iter_t & start, const iter_t & stop, typ position.mBranch.push_back(&mRoot); } - const letterNode * pnode = (start != stop) ? position.mBranch.back() : NULL; + const letterNode * pnode = (start != stop) ? position.mBranch.back() : nullptr; - for (; (start != stop) && ((pnode = pnode->get(*start)) != NULL); start++) + for (; (start != stop) && ((pnode = pnode->get(*start)) != nullptr); start++) { position.mBranch.push_back(pnode); if (pnode->hasData()) { @@ -298,9 +298,9 @@ bool stringTree::seek(iter_t & start, const iter_t & stop, typ position.mBranch.push_back(&mRoot); } - const letterNode * pnode = (start != stop) ? position.mBranch.back() : NULL; + const letterNode * pnode = (start != stop) ? position.mBranch.back() : nullptr; - for (; (start != stop) && ((pnode = pnode->get(*start)) != NULL); start++) + for (; (start != stop) && ((pnode = pnode->get(*start)) != nullptr); start++) { position.mBranch.push_back(pnode); if (pnode->hasData()) { @@ -441,7 +441,7 @@ stringTree::letterNode::~letterNode() template typename stringTree::letterNode * stringTree::letterNode::get(letter_t index) const { - letterNode * tree = NULL; + letterNode * tree = nullptr; letterNode * end = mpChildren + mNumChildren; letterNode * place = std::lower_bound(mpChildren, mpChildren + mNumChildren, index); @@ -495,10 +495,10 @@ bool stringTree::letterNode::take(letter_t index, bool dealloc mNumChildren--; if (!mNumChildren) { deallocate = true; } - letterNode * children = NULL; + letterNode * children = nullptr; if (deallocate) { - children = mNumChildren ? new letterNode[mNumChildren] : NULL; + children = mNumChildren ? new letterNode[mNumChildren] : nullptr; } else { children = mpChildren; } @@ -536,7 +536,7 @@ void stringTree::const_iterator::getKey(string_t & key) const template typename stringTree::letterNode * stringTree::letterNode::firstChild() const { - letterNode * child = NULL; + letterNode * child = nullptr; if (mpChildren) { child = mpChildren; @@ -548,7 +548,7 @@ typename stringTree::letterNode * stringTree template typename stringTree::letterNode * stringTree::letterNode::lastChild() const { - letterNode * child = NULL; + letterNode * child = nullptr; if (mpChildren) { child = mpChildren + mNumChildren - 1; @@ -560,7 +560,7 @@ typename stringTree::letterNode * stringTree template typename stringTree::letterNode * stringTree::letterNode::nextChild(const letterNode * child) const { - letterNode * next = NULL; + letterNode * next = nullptr; if (mpChildren) { size_t index = child - mpChildren; @@ -577,7 +577,7 @@ typename stringTree::letterNode * stringTree template typename stringTree::letterNode * stringTree::letterNode::previousChild(const letterNode * child) const { - letterNode * previous = NULL; + letterNode * previous = nullptr; if (mpChildren) { size_t index = child - mpChildren; @@ -623,13 +623,13 @@ template bool stringTree::const_iterator::advance() { bool wentForward = false; - const letterNode * terminal = NULL; - const letterNode * penultimate = NULL; - const letterNode * next = NULL; + const letterNode * terminal = nullptr; + const letterNode * penultimate = nullptr; + const letterNode * next = nullptr; if (mBranch.back()->hasNoChildren()) { // go forward - while ((mBranch.size() >= 2) && (next == NULL)) + while ((mBranch.size() >= 2) && (next == nullptr)) { penultimate = mBranch[mBranch.size() - 2]; terminal = mBranch[mBranch.size() - 1]; @@ -654,9 +654,9 @@ template bool stringTree::const_iterator::retreat() { bool wentBack = false; - const letterNode * terminal = NULL; - const letterNode * penultimate = NULL; - const letterNode * next = NULL; + const letterNode * terminal = nullptr; + const letterNode * penultimate = nullptr; + const letterNode * next = nullptr; if (mBranch.size() >= 2) { // go backwards @@ -670,7 +670,7 @@ bool stringTree::const_iterator::retreat() mBranch.pop_back(); } // go to leaf - for (; next != NULL; next = next->lastChild()) + for (; next != nullptr; next = next->lastChild()) { mBranch.push_back(next); if (next->hasData() && next->hasNoChildren()) { @@ -724,9 +724,9 @@ template void stringTree::setBegin() const { mBegin.mBranch.clear(); - const letterNode * leaf = NULL; + const letterNode * leaf = nullptr; - for (leaf = &mRoot; leaf != NULL; leaf = leaf->firstChild()) + for (leaf = &mRoot; leaf != nullptr; leaf = leaf->firstChild()) { mBegin.mBranch.push_back(leaf); if (leaf->hasData()) { @@ -782,7 +782,7 @@ template template const data_t * stringTree::finder::data() const { - const data_t * pData = NULL; + const data_t * pData = nullptr; if (mDictionaryIter != mDictionary.end()) { pData = &(*mDictionaryIter); diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/thread.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/thread.cpp index af797230..7115e242 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/thread.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/thread.cpp @@ -120,10 +120,10 @@ Event::Event(bool signaled) : mEvent() { #ifdef WIN32 - mEvent = CreateEvent(NULL, FALSE, signaled ? TRUE : FALSE, NULL); + mEvent = CreateEvent(nullptr, FALSE, signaled ? TRUE : FALSE, nullptr); #else - pthread_mutex_init(&mMutex, NULL); - pthread_cond_init(&mCond, NULL); + pthread_mutex_init(&mMutex, nullptr); + pthread_cond_init(&mCond, nullptr); #endif } @@ -162,7 +162,7 @@ bool Event::Wait(unsigned timeoutMilliseconds) { struct timeval now; struct timespec abs_timeout; - gettimeofday(&now, NULL); + gettimeofday(&now, nullptr); abs_timeout.tv_sec = now.tv_sec + timeoutMilliseconds/1000; abs_timeout.tv_nsec = now.tv_usec * 1000 + (timeoutMilliseconds%1000)*1000000; abs_timeout.tv_sec += abs_timeout.tv_nsec / 1000000000; @@ -198,10 +198,10 @@ EventLock::EventLock(bool locked) : mEvent() { #ifdef WIN32 - mEvent = CreateEvent(NULL, TRUE, locked ? FALSE : TRUE, NULL); + mEvent = CreateEvent(nullptr, TRUE, locked ? FALSE : TRUE, nullptr); #else - pthread_mutex_init(&mMutex, NULL); - pthread_cond_init(&mCond, NULL); + pthread_mutex_init(&mMutex, nullptr); + pthread_cond_init(&mCond, nullptr); #endif } @@ -243,7 +243,7 @@ bool EventLock::Wait(unsigned timeoutMilliseconds) { struct timeval now; struct timespec abs_timeout; - gettimeofday(&now, NULL); + gettimeofday(&now, nullptr); abs_timeout.tv_sec = now.tv_sec + timeoutMilliseconds/1000; abs_timeout.tv_nsec = now.tv_usec * 1000 + (timeoutMilliseconds%1000)*1000000; abs_timeout.tv_sec += abs_timeout.tv_nsec / 1000000000; diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/utf8.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/utf8.cpp index ce6b8f16..ba5cc0d7 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/utf8.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/utf8.cpp @@ -81,7 +81,7 @@ namespace soe size_t UTF8_convertToUTF16( char * ptr , UTF16 * ret, size_t limit ) { size_t len = 0; - while (( *ptr != 0 ) && ( len < ( limit - 1 ) ))//we use limit -1 to leave room for the null terminator + while (( *ptr != 0 ) && ( len < ( limit - 1 ) ))//we use limit -1 to leave room for the nullptr terminator { size_t clen = UTF8_convertCharToUTF16( ptr, ret ); ptr += clen; diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/IPAddress.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/IPAddress.h index f6d5f886..03b59e8d 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/IPAddress.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/IPAddress.h @@ -32,7 +32,7 @@ public: * @brief Used to retreive the the dot-notation represenatatiion of this address. * * @param buffer A pointer to the buffer to place the ip address into. - * Must be at least 17 characters long, will be null terminated. + * Must be at least 17 characters long, will be nullptr terminated. * * @return A pointer to the buffer the address was placed into. */ diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpBlockAllocator.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpBlockAllocator.cpp index 6d476d78..b7da0f27 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpBlockAllocator.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpBlockAllocator.cpp @@ -6,7 +6,7 @@ namespace NAMESPACE #endif TcpBlockAllocator::TcpBlockAllocator(const unsigned initSize, const unsigned initCount) -: m_freeHead(NULL), m_blockCount(initCount), m_blockSize(initSize), m_numAvailBlocks(0) +: m_freeHead(nullptr), m_blockCount(initCount), m_blockSize(initSize), m_numAvailBlocks(0) { realloc(); } @@ -33,7 +33,7 @@ data_block *TcpBlockAllocator::getBlock() tmp = m_freeHead; m_freeHead = m_freeHead->m_next; - tmp->m_next = NULL; + tmp->m_next = nullptr; m_numAvailBlocks--; return(tmp); } @@ -56,7 +56,7 @@ void TcpBlockAllocator::returnBlock(data_block *b) void TcpBlockAllocator::realloc() { - data_block *tmp = NULL, *cursor = NULL; + data_block *tmp = nullptr, *cursor = nullptr; tmp = new data_block; m_numAvailBlocks++; cursor = tmp; diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpConnection.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpConnection.cpp index 42329552..a41ad0df 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpConnection.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpConnection.cpp @@ -11,28 +11,28 @@ namespace NAMESPACE //used when want to open new connection with this socket TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, const IPAddress &destIP, unsigned short destPort, unsigned timeout) -: m_nextConnection(NULL), - m_prevConnection(NULL), +: m_nextConnection(nullptr), + m_prevConnection(nullptr), m_socket(INVALID_SOCKET), - m_nextKeepAliveConnection(NULL), - m_prevKeepAliveConnection(NULL), + m_nextKeepAliveConnection(nullptr), + m_prevKeepAliveConnection(nullptr), m_aliveListId(tcpManager->m_aliveList.m_listID), - m_nextRecvDataConnection(NULL), - m_prevRecvDataConnection(NULL), + m_nextRecvDataConnection(nullptr), + m_prevRecvDataConnection(nullptr), m_recvDataListId(tcpManager->m_dataList.m_listID), m_manager(tcpManager), m_status(StatusNegotiating), - m_handler(NULL), + m_handler(nullptr), m_destIP(destIP), m_destPort(destPort), m_refCount(0), m_sendAllocator(sendAlloc), - m_head(NULL), - m_tail(NULL), + m_head(nullptr), + m_tail(nullptr), m_bytesRead(0), m_bytesNeeded(0), m_params(params), - m_recvBuff(NULL), + m_recvBuff(nullptr), m_connectTimeout(timeout), m_connectTimer(), m_wasConRemovedFromMgr(false), @@ -94,28 +94,28 @@ TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAllo //used when server mode creates new connection object representing a connect request TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, SOCKET socket, const IPAddress &destIP, unsigned short destPort) -: m_nextConnection(NULL), - m_prevConnection(NULL), +: m_nextConnection(nullptr), + m_prevConnection(nullptr), m_socket(socket), - m_nextKeepAliveConnection(NULL), - m_prevKeepAliveConnection(NULL), + m_nextKeepAliveConnection(nullptr), + m_prevKeepAliveConnection(nullptr), m_aliveListId(tcpManager->m_aliveList.m_listID), - m_nextRecvDataConnection(NULL), - m_prevRecvDataConnection(NULL), + m_nextRecvDataConnection(nullptr), + m_prevRecvDataConnection(nullptr), m_recvDataListId(tcpManager->m_dataList.m_listID), m_manager(tcpManager), m_status(StatusConnected), - m_handler(NULL), + m_handler(nullptr), m_destIP(destIP), m_destPort(destPort), m_refCount(0), m_sendAllocator(sendAlloc), - m_head(NULL), - m_tail(NULL), + m_head(nullptr), + m_tail(nullptr), m_bytesRead(0), m_bytesNeeded(0), m_params(params), - m_recvBuff(NULL), + m_recvBuff(nullptr), m_connectTimeout(0), m_connectTimer(), m_wasConRemovedFromMgr(false) @@ -206,7 +206,7 @@ int TcpConnection::finishConnect() t.tv_sec = 0; t.tv_usec = 0; - int err = select(m_socket + 1, NULL, &wrSet, NULL, &t); + int err = select(m_socket + 1, nullptr, &wrSet, nullptr, &t); if (err == 0) { @@ -303,7 +303,7 @@ TcpConnection::~TcpConnection() { delete [] m_recvBuff; - while(m_head != NULL) + while(m_head != nullptr) { data_block *tmp = m_head; m_head = m_head->m_next; @@ -327,22 +327,22 @@ void TcpConnection::Send(const char *data, unsigned int dataLen) { m_aliveListId = m_manager->m_keepAliveList.m_listID; - if (m_prevKeepAliveConnection != NULL) + if (m_prevKeepAliveConnection != nullptr) m_prevKeepAliveConnection->m_nextKeepAliveConnection = m_nextKeepAliveConnection; - if (m_nextKeepAliveConnection != NULL) + if (m_nextKeepAliveConnection != nullptr) m_nextKeepAliveConnection->m_prevKeepAliveConnection = m_prevKeepAliveConnection; if (m_manager->m_keepAliveList.m_beginList == this) m_manager->m_keepAliveList.m_beginList = m_nextKeepAliveConnection; m_nextKeepAliveConnection = m_manager->m_aliveList.m_beginList; - m_prevKeepAliveConnection = NULL; - if (m_manager->m_aliveList.m_beginList != NULL) + m_prevKeepAliveConnection = nullptr; + if (m_manager->m_aliveList.m_beginList != nullptr) m_manager->m_aliveList.m_beginList->m_prevKeepAliveConnection = this; m_manager->m_aliveList.m_beginList = this; } - data_block *work = NULL; + data_block *work = nullptr; // this connection has no send buffer. Get a block if(!m_tail) @@ -471,16 +471,16 @@ int TcpConnection::processIncoming() { m_recvDataListId = m_manager->m_noDataList.m_listID; - if (m_prevRecvDataConnection != NULL) + if (m_prevRecvDataConnection != nullptr) m_prevRecvDataConnection->m_nextRecvDataConnection = m_nextRecvDataConnection; - if (m_nextRecvDataConnection != NULL) + if (m_nextRecvDataConnection != nullptr) m_nextRecvDataConnection->m_prevRecvDataConnection = m_prevRecvDataConnection; if (m_manager->m_noDataList.m_beginList == this) m_manager->m_noDataList.m_beginList = m_nextRecvDataConnection; m_nextRecvDataConnection = m_manager->m_dataList.m_beginList; - m_prevRecvDataConnection = NULL; - if (m_manager->m_dataList.m_beginList != NULL) + m_prevRecvDataConnection = nullptr; + if (m_manager->m_dataList.m_beginList != nullptr) m_manager->m_dataList.m_beginList->m_prevRecvDataConnection = this; m_manager->m_dataList.m_beginList = this; } @@ -626,7 +626,7 @@ int TcpConnection::processOutgoing() int sendError = 1; - // If m_head is not null, then this connection has something to send + // If m_head is not nullptr, then this connection has something to send if(m_head) diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpConnection.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpConnection.h index 36a41e9f..efe2d031 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpConnection.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpConnection.h @@ -50,7 +50,7 @@ public: * connection is disconnected, you simply need to derive your class * (multiply if necessary) from TcpConnectionHandler, then you can use * this method to set the object the TcpConnection will call as appropriate. - * default = NULL (no callbacks made) + * default = nullptr (no callbacks made) * * @param handler The object which will be called for notifications. */ diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpManager.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpManager.cpp index 53105f3d..6f31e9ae 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpManager.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpManager.cpp @@ -57,14 +57,14 @@ TcpManager::TcpParams::TcpParams(const TcpParams &cpy) } TcpManager::TcpManager(const TcpParams ¶ms) -: m_handler(NULL), - m_keepAliveList(NULL, 1), - m_aliveList(NULL, 2), - m_noDataList(NULL, 1), - m_dataList(NULL, 2), +: m_handler(nullptr), + m_keepAliveList(nullptr, 1), + m_aliveList(nullptr, 2), + m_noDataList(nullptr, 1), + m_dataList(nullptr, 2), m_params(params), m_refCount(1), - m_connectionList(NULL), + m_connectionList(nullptr), m_connectionListCount(0), m_socket(INVALID_SOCKET), m_boundAsServer(false), @@ -103,7 +103,7 @@ TcpManager::~TcpManager() close(m_socket); #endif } - while (m_connectionList != NULL) + while (m_connectionList != nullptr) { TcpConnection *con = m_connectionList; con->AddRef(); @@ -179,7 +179,7 @@ bool TcpManager::BindAsServer() { struct hostent * lphp; lphp = gethostbyname(m_params.bindAddress); - if (lphp != NULL) + if (lphp != nullptr) addr_loc.sin_addr.s_addr = ((struct in_addr *)(lphp->h_addr))->s_addr; } else @@ -204,7 +204,7 @@ bool TcpManager::BindAsServer() TcpConnection *TcpManager::acceptClient() { - TcpConnection *newConn = NULL; + TcpConnection *newConn = nullptr; if (m_boundAsServer && m_connectionListCount < m_params.maxConnections) { @@ -218,7 +218,7 @@ TcpConnection *TcpManager::acceptClient() { newConn = new TcpConnection(this, &m_allocator, m_params, sock, IPAddress(addr.sin_addr.s_addr), ntohs(addr.sin_port)); addNewConnection(newConn); - if (m_handler != NULL) + if (m_handler != nullptr) { m_handler->OnConnectRequest(newConn); } @@ -243,8 +243,8 @@ SOCKET TcpManager::getMaxFD() if (m_boundAsServer) maxfd = m_socket+1; - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) { next = con->m_nextConnection; if (con->GetStatus() != TcpConnection::StatusDisconnected && con->m_socket > maxfd) @@ -258,8 +258,8 @@ SOCKET TcpManager::getMaxFD() TcpConnection *TcpManager::getConnection(SOCKET fd) { - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) { next = con->m_nextConnection; if (con->m_socket == fd) @@ -268,7 +268,7 @@ TcpConnection *TcpManager::getConnection(SOCKET fd) } } //if get here ,couldn't find it - return NULL; + return nullptr; } bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendTimePerConnection, unsigned maxRecvTimePerConnection) @@ -290,8 +290,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT { // Send output from last heartbeat - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) { con->AddRef(); if (next) next->Release(); @@ -358,7 +358,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT tmpfds = m_permfds; timeout.tv_sec = 0; timeout.tv_usec = 0; - int cnt = select(maxfd, &tmpfds, NULL, NULL, &timeout); // blocks for timeout + int cnt = select(maxfd, &tmpfds, nullptr, nullptr, &timeout); // blocks for timeout if (cnt > 0) @@ -384,8 +384,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //process incoming client messages if (maxRecvTimePerConnection != 0) { - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) { con->AddRef(); if (next) next->Release(); @@ -450,8 +450,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT pollfds[0].events |= POLLIN; } - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next, idx++) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next, idx++) { next = con->m_nextConnection; pollfds[idx].fd = con->m_socket; @@ -491,7 +491,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT } //process regular msg(s) - if (con == NULL) + if (con == nullptr) { close(pollfds[idx].fd); continue; @@ -523,7 +523,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT }//if(pollfds[... else if (pollfds[idx].revents & POLLHUP) { - if (con == NULL) + if (con == nullptr) { close(pollfds[idx].fd); continue; @@ -541,21 +541,21 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //now process any keepalives, if time to do that if (m_params.keepAliveDelay > 0 && m_keepAliveTimer.isDone(m_params.keepAliveDelay)) { - TcpConnection *next = NULL; - for (TcpConnection *con = m_keepAliveList.m_beginList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_keepAliveList.m_beginList ; con != nullptr ; con = next) { con->AddRef(); if (next) next->Release(); next = con->m_nextKeepAliveConnection; if (next) next->AddRef(); - con->Send(NULL, 0); //note: this request will move the connection from the keepAliveList to the aliveList + con->Send(nullptr, 0); //note: this request will move the connection from the keepAliveList to the aliveList con->Release(); } //now move the complete alive list over to the keepalive list to reset those timers m_keepAliveList.m_beginList = m_aliveList.m_beginList; - m_aliveList.m_beginList = NULL; + m_aliveList.m_beginList = nullptr; //switch id's for those connections that were in the alive list last go - around int tmpID = m_aliveList.m_listID; @@ -569,8 +569,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //now process any noDataCons, if time to do that if (m_params.noDataTimeout > 0 && m_noDataTimer.isDone(m_params.noDataTimeout)) { - TcpConnection *next = NULL; - for (TcpConnection *con = m_noDataList.m_beginList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_noDataList.m_beginList ; con != nullptr ; con = next) { con->AddRef(); if (next) next->Release(); @@ -584,7 +584,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //now move the complete data list over to the nodata list to reset those timers m_noDataList.m_beginList = m_dataList.m_beginList; - m_dataList.m_beginList = NULL; + m_dataList.m_beginList = nullptr; //switch id's for those connections that were in the data list last go - around int tmpID = m_dataList.m_listID; @@ -606,17 +606,17 @@ TcpConnection *TcpManager::EstablishConnection(const char *serverAddress, unsign { //can't open outgoing connections when in server mode // use a different TcpManager to do that - return NULL; + return nullptr; } if (m_connectionListCount >= m_params.maxConnections) - return(NULL); + return(nullptr); // get server address unsigned long address = inet_addr(serverAddress); if (address == INADDR_NONE) { - if (m_dnsMap[serverAddress].timeout >= time(NULL)) + if (m_dnsMap[serverAddress].timeout >= time(nullptr)) { address = m_dnsMap[serverAddress].addr; } @@ -624,12 +624,12 @@ TcpConnection *TcpManager::EstablishConnection(const char *serverAddress, unsign { struct hostent * lphp; lphp = gethostbyname(serverAddress); - if (lphp == NULL) - return(NULL); + if (lphp == nullptr) + return(nullptr); address = ((struct in_addr *)(lphp->h_addr))->s_addr; m_dnsMap[serverAddress].addr = address; - m_dnsMap[serverAddress].timeout = time(NULL)+DNS_TIMEOUT; + m_dnsMap[serverAddress].timeout = time(nullptr)+DNS_TIMEOUT; } } IPAddress destIP(address); @@ -649,22 +649,22 @@ void TcpManager::addNewConnection(TcpConnection *con) FD_SET(con->m_socket, &m_permfds); #endif con->m_nextConnection = m_connectionList; - con->m_prevConnection = NULL; - if (m_connectionList != NULL) + con->m_prevConnection = nullptr; + if (m_connectionList != nullptr) m_connectionList->m_prevConnection = con; m_connectionList = con; m_connectionListCount++; con->m_nextKeepAliveConnection = m_aliveList.m_beginList; - con->m_prevKeepAliveConnection = NULL; - if (m_aliveList.m_beginList != NULL) + con->m_prevKeepAliveConnection = nullptr; + if (m_aliveList.m_beginList != nullptr) m_aliveList.m_beginList->m_prevKeepAliveConnection = con; m_aliveList.m_beginList = con; con->m_aliveListId = m_keepAliveList.m_listID;//start it out thinking it's already in the alive list, since it is con->m_nextRecvDataConnection = m_dataList.m_beginList; - con->m_prevRecvDataConnection = NULL; - if (m_dataList.m_beginList != NULL) + con->m_prevRecvDataConnection = nullptr; + if (m_dataList.m_beginList != nullptr) m_dataList.m_beginList->m_prevRecvDataConnection = con; m_dataList.m_beginList = con; con->m_recvDataListId = m_noDataList.m_listID;//start it out thinking it's already in the data list, since it is @@ -682,40 +682,40 @@ void TcpManager::removeConnection(TcpConnection *con) FD_CLR(con->m_socket, &m_permfds); } #endif - if (con->m_prevConnection != NULL) + if (con->m_prevConnection != nullptr) con->m_prevConnection->m_nextConnection = con->m_nextConnection; - if (con->m_nextConnection != NULL) + if (con->m_nextConnection != nullptr) con->m_nextConnection->m_prevConnection = con->m_prevConnection; if (m_connectionList == con) m_connectionList = con->m_nextConnection; - con->m_nextConnection = NULL; - con->m_prevConnection = NULL; + con->m_nextConnection = nullptr; + con->m_prevConnection = nullptr; - if (con->m_prevKeepAliveConnection != NULL) + if (con->m_prevKeepAliveConnection != nullptr) con->m_prevKeepAliveConnection->m_nextKeepAliveConnection = con->m_nextKeepAliveConnection; - if (con->m_nextKeepAliveConnection != NULL) + if (con->m_nextKeepAliveConnection != nullptr) con->m_nextKeepAliveConnection->m_prevKeepAliveConnection = con->m_prevKeepAliveConnection; if (m_aliveList.m_beginList == con) m_aliveList.m_beginList = con->m_nextKeepAliveConnection; else if (m_keepAliveList.m_beginList == con) m_keepAliveList.m_beginList = con->m_nextKeepAliveConnection; - con->m_nextKeepAliveConnection = NULL; - con->m_prevKeepAliveConnection = NULL; + con->m_nextKeepAliveConnection = nullptr; + con->m_prevKeepAliveConnection = nullptr; - if (con->m_prevRecvDataConnection != NULL) + if (con->m_prevRecvDataConnection != nullptr) con->m_prevRecvDataConnection->m_nextRecvDataConnection = con->m_nextRecvDataConnection; - if (con->m_nextRecvDataConnection != NULL) + if (con->m_nextRecvDataConnection != nullptr) con->m_nextRecvDataConnection->m_prevRecvDataConnection = con->m_prevRecvDataConnection; if (m_dataList.m_beginList == con) m_dataList.m_beginList = con->m_nextRecvDataConnection; else if (m_noDataList.m_beginList == con) m_noDataList.m_beginList = con->m_nextRecvDataConnection; - con->m_nextRecvDataConnection = NULL; - con->m_prevRecvDataConnection = NULL; + con->m_nextRecvDataConnection = nullptr; + con->m_prevRecvDataConnection = nullptr; diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpManager.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpManager.h index b2192dff..e9b9e176 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpManager.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpManager.h @@ -168,7 +168,7 @@ public: * simply need to derive your class (multiply if necessary) from TcpManagerHandler, then you can use * this method to set the object the TcpManager will call as appropriate. The TcpConnection object * also has a handler mechanism that replaces the other callback functions below, see TcpConnection::SetHandler - * default = NULL (no callbacks made) + * default = nullptr (no callbacks made) * * @param handler The object which will be called for manager related notifications. */ @@ -223,7 +223,7 @@ public: * the connect-complete callback to be called if the connection is succesfull. * * @return A pointer to a TcpConnection object. - * NULL if the manager object has exceeded its maximum number of connections + * nullptr if the manager object has exceeded its maximum number of connections * or if the serverAddress cannot be resolved to an IP address. */ TcpConnection *EstablishConnection(const char *serverAddress, unsigned short serverPort, unsigned timeout = 0); diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpLibrary.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpLibrary.cpp index f8221166..f86f5d7b 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpLibrary.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpLibrary.cpp @@ -150,7 +150,7 @@ UdpIpAddress::UdpIpAddress(unsigned int ip) char *UdpIpAddress::GetAddress(char *buffer) const { - assert(buffer != NULL); + assert(buffer != nullptr); struct sockaddr_in addr_serverUDP; addr_serverUDP.sin_addr.s_addr = mIp; @@ -163,7 +163,7 @@ char *UdpIpAddress::GetAddress(char *buffer) const ///////////////////////////////////////////////////////////////////////////////////////////////////// UdpManager::Params::Params() { - handler = NULL; + handler = nullptr; outgoingBufferSize = 64 * 1024; incomingBufferSize = 64 * 1024; packetHistoryMax = 100; @@ -265,7 +265,7 @@ UdpManager::UdpManager(const UdpManager::Params *params) mParams.maxDataHoldSize = udpMin(mParams.maxDataHoldSize, mParams.maxRawPacketSize); mParams.packetHistoryMax = udpMax(1, mParams.packetHistoryMax); mPacketHistoryPosition = 0; - mPassThroughData = NULL; + mPassThroughData = nullptr; typedef PacketHistoryEntry *PacketHistoryEntryPtr; mPacketHistory = new PacketHistoryEntryPtr[mParams.packetHistoryMax]; @@ -286,17 +286,17 @@ UdpManager::UdpManager(const UdpManager::Params *params) mUdpSocket = INVALID_SOCKET; mConnectionListCount = 0; - mConnectionList = NULL; + mConnectionList = nullptr; mPoolCreated = 0; mPoolAvailable = 0; - mPoolAvailableRoot = NULL; - mPoolCreatedRoot = NULL; + mPoolAvailableRoot = nullptr; + mPoolCreatedRoot = nullptr; mWrappedCreated = 0; mWrappedAvailable = 0; - mWrappedAvailableRoot = NULL; - mWrappedCreatedRoot = NULL; + mWrappedAvailableRoot = nullptr; + mWrappedCreatedRoot = nullptr; for (i = 0; i < mParams.pooledPacketInitial && i < mParams.pooledPacketMax; i++) { @@ -306,16 +306,16 @@ UdpManager::UdpManager(const UdpManager::Params *params) lp->Release(); } - mSimulateQueueStart = NULL; - mSimulateQueueEnd = NULL; + mSimulateQueueStart = nullptr; + mSimulateQueueEnd = nullptr; mSimulateNextOutgoingTime = 0; mSimulateNextIncomingTime = 0; mSimulateQueueBytes = 0; - mDisconnectPendingList = NULL; + mDisconnectPendingList = nullptr; if (mParams.avoidPriorityQueue) - mPriorityQueue = NULL; + mPriorityQueue = nullptr; else mPriorityQueue = new PriorityQueue(mParams.maxConnections); @@ -346,14 +346,14 @@ UdpManager::~UdpManager() // first we need to tell all the pooled packets we have created that they can no longer check themselves back into use // when they are released PooledLogicalPacket *walk = mPoolCreatedRoot; - while (walk != NULL) + while (walk != nullptr) { - walk->mUdpManager = NULL; + walk->mUdpManager = nullptr; walk = walk->mCreatedNext; } // next release the ones we have in our available pool walk = mPoolAvailableRoot; - while (walk != NULL) + while (walk != nullptr) { PooledLogicalPacket *hold = walk; walk = walk->mAvailableNext; @@ -366,14 +366,14 @@ UdpManager::~UdpManager() // next we need to tell all the warpped packets we have created that they can no longer check themselves back into use // when they are released WrappedLogicalPacket *walk = mWrappedCreatedRoot; - while (walk != NULL) + while (walk != nullptr) { - walk->mUdpManager = NULL; + walk->mUdpManager = nullptr; walk = walk->mCreatedNext; } // next release the ones we have in our available pool walk = mWrappedAvailableRoot; - while (walk != NULL) + while (walk != nullptr) { WrappedLogicalPacket *hold = walk; walk = walk->mAvailableNext; @@ -383,7 +383,7 @@ UdpManager::~UdpManager() // next thing we must do is tell all the connections to disconnect (which severs their link to this dying manager) // this has to be done first since they will call back into us and have themselves removed from our connection-list/priority-queue/etc - while (mConnectionList != NULL) + while (mConnectionList != nullptr) { mConnectionList->InternalDisconnect(0, UdpConnection::cDisconnectReasonManagerDeleted); // the above call ended up calling us back and removing them from our connection list, so now mConnectionList is pointing to the next entry @@ -391,7 +391,7 @@ UdpManager::~UdpManager() } // release any objects that were pending disconnection - while (mDisconnectPendingList != NULL) + while (mDisconnectPendingList != nullptr) { UdpConnection *next = mDisconnectPendingList->mDisconnectPendingNextConnection; mDisconnectPendingList->Release(); @@ -416,7 +416,7 @@ UdpManager::~UdpManager() } delete[] mPacketHistory; - while (mSimulateQueueStart != NULL) + while (mSimulateQueueStart != nullptr) { SimulateQueueEntry *entry = mSimulateQueueStart; mSimulateQueueStart = entry->mNext; @@ -529,12 +529,12 @@ void UdpManager::ProcessDisconnectPending() { UdpConnection *entry = mDisconnectPendingList; UdpConnection **prev = &mDisconnectPendingList; - while (entry != NULL) + while (entry != nullptr) { if (entry->GetStatus() == UdpConnection::cStatusDisconnected) { *prev = entry->mDisconnectPendingNextConnection; - entry->mDisconnectPendingNextConnection = NULL; + entry->mDisconnectPendingNextConnection = nullptr; entry->Release(); entry = *prev; } @@ -548,19 +548,19 @@ void UdpManager::ProcessDisconnectPending() void UdpManager::RemoveConnection(UdpConnection *con) { - assert(con != NULL); // attemped to remove a NULL connection object + assert(con != nullptr); // attemped to remove a nullptr connection object // note: it's a bug to Remove a connection object that is already removed...should never be able to happen. mConnectionListCount--; - if (con->mPrevConnection != NULL) + if (con->mPrevConnection != nullptr) con->mPrevConnection->mNextConnection = con->mNextConnection; - if (con->mNextConnection != NULL) + if (con->mNextConnection != nullptr) con->mNextConnection->mPrevConnection = con->mPrevConnection; if (mConnectionList == con) mConnectionList = con->mNextConnection; - con->mNextConnection = NULL; - con->mPrevConnection = NULL; - if (mPriorityQueue != NULL) + con->mNextConnection = nullptr; + con->mPrevConnection = nullptr; + if (mPriorityQueue != nullptr) mPriorityQueue->Remove(con); mAddressHashTable->Remove(con, AddressHashValue(con->mIp, con->mPort)); @@ -569,11 +569,11 @@ void UdpManager::RemoveConnection(UdpConnection *con) void UdpManager::AddConnection(UdpConnection *con) { - assert(con != NULL); // attemped to add a NULL connection object + assert(con != nullptr); // attemped to add a nullptr connection object con->mNextConnection = mConnectionList; - con->mPrevConnection = NULL; - if (mConnectionList != NULL) + con->mPrevConnection = nullptr; + if (mConnectionList != nullptr) mConnectionList->mPrevConnection = con; mConnectionList = con; mConnectionListCount++; @@ -586,7 +586,7 @@ void UdpManager::FlushAllMultiBuffer() { AddRef(); UdpConnection *cur = mConnectionList; - while (cur != NULL) + while (cur != nullptr) { cur->FlushMultiBuffer(); cur = cur->mNextConnection; @@ -609,7 +609,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) { PacketHistoryEntry *e = ActualReceive(); - if (e == NULL) + if (e == nullptr) { mLastEmptySocketBufferStamp = UdpMisc::Clock(); break; @@ -637,7 +637,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) if (giveConnectionsTime) { - if (mPriorityQueue != NULL) + if (mPriorityQueue != nullptr) { // give time to everybody in the priority-queue that needs it UdpMisc::ClockStamp curPriority = UdpMisc::Clock(); @@ -655,7 +655,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) for (;;) { UdpConnection *top = mPriorityQueue->TopRemove(curPriority); - if (top == NULL) + if (top == nullptr) break; top->AddRef(); top->GiveTime(); @@ -668,7 +668,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) { // give time to everybody UdpConnection *cur = mConnectionList; - while (cur != NULL) + while (cur != nullptr) { cur->GiveTime(); cur = cur->mNextConnection; @@ -678,7 +678,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) ProcessDisconnectPending(); } - if (mSimulateQueueStart != NULL && UdpMisc::Clock() >= mSimulateNextOutgoingTime) + if (mSimulateQueueStart != nullptr && UdpMisc::Clock() >= mSimulateNextOutgoingTime) { SimulateQueueEntry *entry = mSimulateQueueStart; mSimulateQueueStart = mSimulateQueueStart->mNext; @@ -686,7 +686,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) ActualSendHelper(entry->mData, entry->mDataLen, entry->mIp, entry->mPort); UdpConnection *con = AddressGetConnection(entry->mIp, entry->mPort); - if (con != NULL) + if (con != nullptr) con->mSimulateQueueBytes -= entry->mDataLen; mSimulateQueueBytes -= entry->mDataLen; delete entry; @@ -699,11 +699,11 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) UdpConnection *UdpManager::EstablishConnection(const char *serverAddress, int serverPort, int timeout) { assert(serverPort != 0); // can't connect to no port - assert(serverAddress != NULL); + assert(serverAddress != nullptr); assert(serverAddress[0] != 0); if (mConnectionListCount >= mParams.maxConnections) - return(NULL); + return(nullptr); // get server address unsigned long address = inet_addr(serverAddress); @@ -711,16 +711,16 @@ UdpConnection *UdpManager::EstablishConnection(const char *serverAddress, int se { struct hostent * lphp; lphp = gethostbyname(serverAddress); - if (lphp == NULL) - return(NULL); + if (lphp == nullptr) + return(nullptr); address = ((struct in_addr *)(lphp->h_addr))->s_addr; } UdpIpAddress destIp(address); // first, see if we already have a connection object managing this ip/port, if we do, then fail UdpConnection *con = AddressGetConnection(destIp, serverPort); - if (con != NULL) - return(NULL); + if (con != nullptr) + return(nullptr); return(new UdpConnection(this, destIp, serverPort, timeout)); } @@ -733,7 +733,7 @@ void UdpManager::KeepUntilDisconnected(UdpConnection *con) void UdpManager::GetStats(UdpManagerStatistics *stats) const { - assert(stats != NULL); + assert(stats != nullptr); *stats = mManagerStats; stats->poolAvailable = mPoolAvailable; stats->poolCreated = mPoolCreated; @@ -748,10 +748,10 @@ void UdpManager::ResetStats() void UdpManager::DumpPacketHistory(const char *filename) const { - assert(filename != NULL); + assert(filename != nullptr); assert(filename[0] != 0); FILE *file = fopen(filename, "wt"); - if (file != NULL) + if (file != nullptr) { // dump history of packets... for (int i = 0; i < mParams.packetHistoryMax; i++) @@ -797,7 +797,7 @@ int UdpManager::GetLocalPort() const UdpManager::PacketHistoryEntry *UdpManager::ActualReceive() { if (mParams.simulateIncomingByteRate > 0 && UdpMisc::Clock() < mSimulateNextIncomingTime) - return(NULL); + return(nullptr); struct sockaddr_in addr_from; socklen_t sf = sizeof(addr_from); @@ -807,7 +807,7 @@ UdpManager::PacketHistoryEntry *UdpManager::ActualReceive() if (res != SOCKET_ERROR) { if (mParams.simulateIncomingLossPercent > 0 && ((rand() % 100) < mParams.simulateIncomingLossPercent)) - return(NULL); // packet, what packet? + return(nullptr); // packet, what packet? if (mParams.simulateIncomingByteRate > 0) mSimulateNextIncomingTime = UdpMisc::Clock() + (res * 1000 / mParams.simulateIncomingByteRate); @@ -832,7 +832,7 @@ UdpManager::PacketHistoryEntry *UdpManager::ActualReceive() UdpIpAddress ip = UdpIpAddress(addr_from.sin_addr.s_addr); int port = (int)ntohs(addr_from.sin_port); UdpConnection *con = AddressGetConnection(ip, port); - if (con != NULL) + if (con != nullptr) { con->AddRef(); con->PortUnreachable(); @@ -852,7 +852,7 @@ UdpManager::PacketHistoryEntry *UdpManager::ActualReceive() } #endif } - return(NULL); + return(nullptr); } void UdpManager::ProcessIcmpErrors() @@ -880,7 +880,7 @@ void UdpManager::ProcessIcmpErrors() struct cmsghdr * cmsg; if(CMSG_FIRSTHDR(&msgh)) { - for(cmsg = CMSG_FIRSTHDR(&msgh); cmsg != NULL; cmsg = CMSG_NXTHDR(&msgh, cmsg)) + for(cmsg = CMSG_FIRSTHDR(&msgh); cmsg != nullptr; cmsg = CMSG_NXTHDR(&msgh, cmsg)) { if(cmsg->cmsg_level == SOL_IP && cmsg->cmsg_type == IP_RECVERR) { @@ -894,7 +894,7 @@ void UdpManager::ProcessIcmpErrors() UdpIpAddress ip = UdpIpAddress(msg_name.sin_addr.s_addr); int port = (int)htons(msg_name.sin_port); UdpConnection *con = AddressGetConnection(ip, port); - if (con != NULL) + if (con != nullptr) { con->AddRef(); con->PortUnreachable(); @@ -923,7 +923,7 @@ void UdpManager::ActualSend(const uchar *data, int dataLen, UdpIpAddress ip, int { // simulating outgoing byte-rate, so queue it up for sending later UdpConnection *con = AddressGetConnection(ip, port); - if (con != NULL) + if (con != nullptr) { if (mParams.simulateDestinationOverloadLevel > 0 && con->mSimulateQueueBytes + dataLen > mParams.simulateDestinationOverloadLevel) return; // no room, packet gets lost @@ -931,17 +931,17 @@ void UdpManager::ActualSend(const uchar *data, int dataLen, UdpIpAddress ip, int if (mParams.simulateOutgoingOverloadLevel > 0 && mSimulateQueueBytes + dataLen > mParams.simulateOutgoingOverloadLevel) return; // no room, packet gets lost - if (con != NULL) + if (con != nullptr) con->mSimulateQueueBytes += dataLen; mSimulateQueueBytes += dataLen; SimulateQueueEntry *entry = new SimulateQueueEntry(data, dataLen, ip, port); - if (mSimulateQueueStart != NULL) + if (mSimulateQueueStart != nullptr) mSimulateQueueEnd->mNext = entry; else mSimulateQueueStart = entry; mSimulateQueueEnd = entry; - mSimulateQueueEnd->mNext = NULL; + mSimulateQueueEnd->mNext = nullptr; return; } ActualSendHelper(data, dataLen, ip, port); @@ -964,7 +964,7 @@ void UdpManager::ActualSendHelper(const uchar *data, int dataLen, UdpIpAddress i // flag connection to terminate itself for port-unreachable error on next give time // we need to flag it instead of actually terminating it to prevent callbacks from occuring during application sends UdpConnection *con = AddressGetConnection(ip, port); - if (con != NULL) + if (con != nullptr) con->FlagPortUnreachable(); return; } @@ -1002,7 +1002,7 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) UdpConnection *con = AddressGetConnection(e->mIp, e->mPort); - if (con == NULL) + if (con == nullptr) { // packet coming from an unknown ip/port // if it is a connection request packet, then establish a new connection object to reply to it @@ -1012,7 +1012,7 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) if (mConnectionListCount >= mParams.maxConnections) return; // can't handle any more connections, so ignore this request entirely - if (mParams.handler != NULL) + if (mParams.handler != nullptr) { UdpConnection *newcon = new UdpConnection(this, e); mParams.handler->OnConnectRequest(newcon); @@ -1040,7 +1040,7 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) int encryptCode = UdpMisc::GetValue32(ptr); UdpConnection *con = ConnectCodeGetConnection(connectCode); - if (con != NULL) + if (con != nullptr) { if (mParams.allowAddressRemapping || con->mIp == e->mIp) { @@ -1090,25 +1090,25 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) UdpConnection *UdpManager::AddressGetConnection(UdpIpAddress ip, int port) const { UdpConnection *found = static_cast(mAddressHashTable->FindFirst(AddressHashValue(ip, port))); - while (found != NULL) + while (found != nullptr) { if (found->mIp == ip && found->mPort == port) return(found); found = static_cast(mAddressHashTable->FindNext(found)); } - return(NULL); + return(nullptr); } UdpConnection *UdpManager::ConnectCodeGetConnection(int connectCode) const { UdpConnection *found = static_cast(mConnectCodeHashTable->FindFirst(connectCode)); - while (found != NULL) + while (found != nullptr) { if (found->mConnectCode == connectCode) return(found); found = static_cast(mConnectCodeHashTable->FindNext(found)); } - return(NULL); + return(nullptr); } WrappedLogicalPacket *UdpManager::WrappedBorrow(const LogicalPacket *lp) @@ -1132,7 +1132,7 @@ WrappedLogicalPacket *UdpManager::WrappedBorrow(const LogicalPacket *lp) void UdpManager::WrappedCreated(WrappedLogicalPacket *wp) { wp->mCreatedNext = mWrappedCreatedRoot; - if (mWrappedCreatedRoot != NULL) + if (mWrappedCreatedRoot != nullptr) mWrappedCreatedRoot->mCreatedPrev = wp; mWrappedCreatedRoot = wp; mWrappedCreated++; @@ -1140,11 +1140,11 @@ void UdpManager::WrappedCreated(WrappedLogicalPacket *wp) void UdpManager::WrappedDestroyed(WrappedLogicalPacket *wp) { - if (wp->mCreatedNext != NULL) + if (wp->mCreatedNext != nullptr) { wp->mCreatedNext->mCreatedPrev = wp->mCreatedPrev; } - if (wp->mCreatedPrev != NULL) + if (wp->mCreatedPrev != nullptr) { wp->mCreatedPrev->mCreatedNext = wp->mCreatedNext; } @@ -1154,9 +1154,9 @@ void UdpManager::WrappedDestroyed(WrappedLogicalPacket *wp) mWrappedCreatedRoot = wp->mCreatedNext; } - wp->mCreatedPrev = NULL; - wp->mCreatedNext = NULL; - wp->mUdpManager = NULL; + wp->mCreatedPrev = nullptr; + wp->mCreatedNext = nullptr; + wp->mUdpManager = nullptr; mWrappedCreated--; } @@ -1191,7 +1191,7 @@ LogicalPacket *UdpManager::CreatePacket(const void *data, int dataLen, const voi void UdpManager::PoolCreated(PooledLogicalPacket *packet) { packet->mCreatedNext = mPoolCreatedRoot; - if (mPoolCreatedRoot != NULL) + if (mPoolCreatedRoot != nullptr) mPoolCreatedRoot->mCreatedPrev = packet; mPoolCreatedRoot = packet; mPoolCreated++; @@ -1199,11 +1199,11 @@ void UdpManager::PoolCreated(PooledLogicalPacket *packet) void UdpManager::PoolDestroyed(PooledLogicalPacket *packet) { - if (packet->mCreatedNext != NULL) + if (packet->mCreatedNext != nullptr) { packet->mCreatedNext->mCreatedPrev = packet->mCreatedPrev; } - if (packet->mCreatedPrev != NULL) + if (packet->mCreatedPrev != nullptr) { packet->mCreatedPrev->mCreatedNext = packet->mCreatedNext; } @@ -1213,9 +1213,9 @@ void UdpManager::PoolDestroyed(PooledLogicalPacket *packet) mPoolCreatedRoot = packet->mCreatedNext; } - packet->mCreatedPrev = NULL; - packet->mCreatedNext = NULL; - packet->mUdpManager = NULL; + packet->mCreatedPrev = nullptr; + packet->mCreatedNext = nullptr; + packet->mUdpManager = nullptr; mPoolCreated--; } @@ -1290,7 +1290,7 @@ void UdpConnection::Init(UdpManager *udpManager, UdpIpAddress destIp, int destPo mLastClockSyncTime = 0; mDataHoldTime = 0; mGettingTime = false; - mHandler = NULL; + mHandler = nullptr; mOtherSideProtocolVersion = 0; mNoDataTimeout = mUdpManager->mParams.noDataTimeout; @@ -1299,13 +1299,13 @@ void UdpConnection::Init(UdpManager *udpManager, UdpIpAddress destIp, int destPo mMultiBufferData = new uchar[mUdpManager->mParams.maxRawPacketSize]; mMultiBufferPtr = mMultiBufferData; - mDisconnectPendingNextConnection = NULL; - mNextConnection = NULL; - mPrevConnection = NULL; + mDisconnectPendingNextConnection = nullptr; + mNextConnection = nullptr; + mPrevConnection = nullptr; mIcmpErrorRetryStartStamp = 0; // when the timer started for ICMP error retry delay (gets reset on a successful packet receive) mPortRemapRequestStartStamp = 0; - mEncryptXorBuffer = NULL; + mEncryptXorBuffer = nullptr; mEncryptExpansionBytes = 0; mOrderedCountOutgoing = 0; mOrderedCountOutgoing2 = 0; @@ -1316,7 +1316,7 @@ void UdpConnection::Init(UdpManager *udpManager, UdpIpAddress destIp, int destPo mConnectionCreateTime = UdpMisc::Clock(); mSimulateQueueBytes = 0; - mPassThroughData = NULL; + mPassThroughData = nullptr; mSilentDisconnect = false; mLastSendBin = 0; @@ -1334,7 +1334,7 @@ void UdpConnection::Init(UdpManager *udpManager, UdpIpAddress destIp, int destPo UdpConnection::~UdpConnection() { - if (mUdpManager != NULL) + if (mUdpManager != nullptr) InternalDisconnect(0, cDisconnectReasonApplicationReleased); for (int i = 0; i < UdpManager::cReliableChannelCount; i++) @@ -1385,7 +1385,7 @@ void UdpConnection::InternalDisconnect(int flushTimeout, DisconnectReason reason if (mStatus == cStatusNegotiating) flushTimeout = 0; - if (mUdpManager != NULL) + if (mUdpManager != nullptr) { if (flushTimeout > 0) { @@ -1415,13 +1415,13 @@ void UdpConnection::InternalDisconnect(int flushTimeout, DisconnectReason reason } mUdpManager->RemoveConnection(this); - mUdpManager = NULL; + mUdpManager = nullptr; } mStatus = cStatusDisconnected; - if (startStatus != cStatusDisconnected && startUdpManager != NULL) + if (startStatus != cStatusDisconnected && startUdpManager != nullptr) { - if (mHandler != NULL) + if (mHandler != nullptr) mHandler->OnTerminated(this); } } @@ -1455,7 +1455,7 @@ bool UdpConnection::Send(UdpChannel channel, const void *data, int dataLen) if (dataLen == 0) // zero length packets are ignored return(false); - assert(data != NULL); // can't send a null packet + assert(data != nullptr); // can't send a nullptr packet mUdpManager->mManagerStats.applicationPacketsSent++; mConnectionStats.applicationPacketsSent++; @@ -1472,7 +1472,7 @@ bool UdpConnection::Send(UdpChannel channel, const void *data, int dataLen) bool UdpConnection::Send(UdpChannel channel, const LogicalPacket *packet) { - assert(packet != NULL); // can't send a null packet + assert(packet != nullptr); // can't send a nullptr packet assert(channel >= 0 && channel < cUdpChannelCount); assert(mStatus != cStatusNegotiating); // you are not allowed to start sending data on a connection that is still in the process of negotiating (only applicable client-side obviously since servers never have connections in this state) @@ -1518,7 +1518,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const uchar *data, int data { uchar *bufPtr = tempBuffer; memcpy(bufPtr, data, dataLen); - if (data2 != NULL) + if (data2 != nullptr) memcpy(bufPtr + dataLen, data2, dataLen2); PhysicalSend(bufPtr, totalDataLen, true); return(true); @@ -1531,9 +1531,9 @@ bool UdpConnection::InternalSend(UdpChannel channel, const uchar *data, int data bufPtr[1] = cUdpPacketOrdered2; UdpMisc::PutValue16(bufPtr + 2, (ushort)(++mOrderedCountOutgoing2 & 0xffff)); memcpy(bufPtr + 4, data, dataLen); - if (data2 != NULL) + if (data2 != nullptr) memcpy(bufPtr + 4 + dataLen, data2, dataLen2); - BufferedSend(bufPtr, totalDataLen + 4, NULL, 0, true); + BufferedSend(bufPtr, totalDataLen + 4, nullptr, 0, true); return(true); break; } @@ -1544,7 +1544,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const uchar *data, int data bufPtr[1] = cUdpPacketOrdered2; UdpMisc::PutValue16(bufPtr + 2, (ushort)(++mOrderedCountOutgoing2 & 0xffff)); memcpy(bufPtr + 4, data, dataLen); - if (data2 != NULL) + if (data2 != nullptr) memcpy(bufPtr + 4 + dataLen, data2, dataLen2); PhysicalSend(bufPtr, totalDataLen + 4, true); return(true); @@ -1556,7 +1556,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const uchar *data, int data case cUdpChannelReliable4: { int num = channel - cUdpChannelReliable1; - if (mChannel[num] == NULL) + if (mChannel[num] == nullptr) mChannel[num] = new UdpReliableChannel(num, this, &mUdpManager->mParams.reliable[num]); mChannel[num]->Send(data, dataLen, data2, dataLen2); return(true); @@ -1578,7 +1578,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const LogicalPacket *packet case cUdpChannelReliable4: { int num = channel - cUdpChannelReliable1; - if (mChannel[num] == NULL) + if (mChannel[num] == nullptr) mChannel[num] = new UdpReliableChannel(num, this, &mUdpManager->mParams.reliable[num]); mChannel[num]->Send(packet); return(true); @@ -1618,9 +1618,9 @@ void UdpConnection::PingStatReset() void UdpConnection::GetStats(UdpConnectionStatistics *cs) const { - assert(cs != NULL); + assert(cs != nullptr); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; *cs = mConnectionStats; @@ -1636,13 +1636,13 @@ void UdpConnection::GetStats(UdpConnectionStatistics *cs) const if (cs->syncTheirSent > 0) cs->percentReceivedSuccess = (float)cs->syncOurReceived / (float)cs->syncTheirSent; cs->reliableAveragePing = 0; - if (mChannel[0] != NULL) + if (mChannel[0] != nullptr) cs->reliableAveragePing = mChannel[0]->GetAveragePing(); } void UdpConnection::ProcessRawPacket(const UdpManager::PacketHistoryEntry *e) { - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; if (e->mBuffer[0] != 0 || e->mBuffer[1] != cUdpPacketUnreachableConnection) @@ -1744,7 +1744,7 @@ void UdpConnection::ProcessRawPacket(const UdpManager::PacketHistoryEntry *e) { mConnectionStats.crcRejectedPackets++; mUdpManager->mManagerStats.crcRejectedPackets++; - if (mHandler != NULL) + if (mHandler != nullptr) mHandler->OnCrcReject(this, e->mBuffer, e->mLen); return; } @@ -1771,7 +1771,7 @@ void UdpConnection::ProcessRawPacket(const UdpManager::PacketHistoryEntry *e) *decryptPtr++ = finalStart[1]; int len = (this->*(mDecryptFunction[j]))(decryptPtr, finalStart + 2, finalLen - 2); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; if (len == -1) @@ -1808,7 +1808,7 @@ void UdpConnection::CallbackRoutePacket(const uchar *data, int dataLen) mUdpManager->mManagerStats.applicationPacketsReceived++; mConnectionStats.applicationPacketsReceived++; - if (mHandler != NULL) + if (mHandler != nullptr) mHandler->OnRoutePacket(this, data, dataLen); } } @@ -1819,7 +1819,7 @@ void UdpConnection::CallbackCorruptPacket(const uchar *data, int dataLen, UdpCor { mConnectionStats.corruptPacketErrors++; mUdpManager->mManagerStats.corruptPacketErrors++; - if (mHandler != NULL) + if (mHandler != nullptr) mHandler->OnPacketCorrupt(this, data, dataLen, reason); } } @@ -1828,7 +1828,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) { uchar buf[256]; uchar *bufPtr; - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; if (data[0] == 0 && dataLen > 1) @@ -1912,7 +1912,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) mOtherSideProtocolVersion = otherSideProtocolVersion; SetupEncryptModel(); mStatus = cStatusConnected; - if (mHandler != NULL) + if (mHandler != nullptr) mHandler->OnConnectComplete(this); } break; @@ -2028,7 +2028,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) // (while processing this packet) ended up touching the packet-data and corrupting the next // packet in the multi-sequence. CallbackCorruptPacket(data, dataLen, cUdpCorruptionMultiPacket); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; } else @@ -2144,7 +2144,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) case cUdpPacketFragment4: { int num = (data[1] - cUdpPacketReliable1) % UdpManager::cReliableChannelCount; - if (mChannel[num] == NULL) + if (mChannel[num] == nullptr) mChannel[num] = new UdpReliableChannel(num, this, &mUdpManager->mParams.reliable[num]); mChannel[num]->ReliablePacket(data, dataLen); break; @@ -2155,7 +2155,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) case cUdpPacketAck4: { int num = data[1] - cUdpPacketAck1; - if (mChannel[num] != NULL) + if (mChannel[num] != nullptr) mChannel[num]->AckPacket(data, dataLen); break; } @@ -2165,7 +2165,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) case cUdpPacketAckAll4: { int num = data[1] - cUdpPacketAckAll1; - if (mChannel[num] != NULL) + if (mChannel[num] != nullptr) mChannel[num]->AckAllPacket(data, dataLen); break; } @@ -2205,7 +2205,7 @@ void UdpConnection::FlagPortUnreachable() void UdpConnection::GiveTime() { - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; UdpManager *myManager = mUdpManager; @@ -2298,11 +2298,11 @@ void UdpConnection::InternalGiveTime() int totalPendingBytes = 0; for (int i = 0; i < UdpManager::cReliableChannelCount; i++) { - if (mChannel[i] != NULL) + if (mChannel[i] != nullptr) { totalPendingBytes += mChannel[i]->TotalPendingBytes(); int myNext = mChannel[i]->GiveTime(); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; // giving the reliable channel time caused it to callback the application which may disconnect us nextSchedule = udpMin(nextSchedule, myNext); } @@ -2391,7 +2391,7 @@ void UdpConnection::InternalGiveTime() break; } - if (mUdpManager != NULL) + if (mUdpManager != nullptr) { // safety to prevent us for scheduling ourselves for a time period that has already passed, // as doing so could result in infinite looping in the priority queue processing. @@ -2408,7 +2408,7 @@ int UdpConnection::TotalPendingBytes() const int total = 0; for (int i = 0; i < UdpManager::cReliableChannelCount; i++) { - if (mChannel[i] != NULL) + if (mChannel[i] != nullptr) total += mChannel[i]->TotalPendingBytes(); } return(total); @@ -2474,7 +2474,7 @@ int UdpConnection::ExpireReceiveBin() void UdpConnection::PhysicalSend(const uchar *data, int dataLen, bool appendAllowed) { - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; // if we attempt to do a physical send (ie. encrypt/compress/crc a packet) while we are not connected @@ -2503,7 +2503,7 @@ void UdpConnection::PhysicalSend(const uchar *data, int dataLen, bool appendAllo // we know this internal packet will not be a connect or confirm packet since they are sent directly to RawSend to avoid getting encrypted *destPtr++ = finalStart[1]; int len = (this->*(mEncryptFunction[j]))(destPtr, finalStart + 2, finalLen - 2); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; // if this assert triggers, it means the encryption pass expanded the size of the encrypted @@ -2574,8 +2574,8 @@ void UdpConnection::PhysicalSend(const uchar *data, int dataLen, bool appendAllo // function can do its job uchar *UdpConnection::BufferedSend(const uchar *data, int dataLen, const uchar *data2, int dataLen2, bool appendAllowed) { - if (mUdpManager == NULL) - return(NULL); + if (mUdpManager == nullptr) + return(nullptr); int used = mMultiBufferPtr - mMultiBufferData; int actualMaxDataHoldSize = udpMin(mUdpManager->mParams.maxDataHoldSize, mConnectionConfig.maxRawPacketSize); @@ -2590,7 +2590,7 @@ uchar *UdpConnection::BufferedSend(const uchar *data, int dataLen, const uchar * FlushMultiBuffer(); // now send it (the multi-buffer is empty if you need to use it temporarily to concatenate two data chunks -- it is large enough to hold the largest raw packet) - if (data2 != NULL) + if (data2 != nullptr) { memcpy(mMultiBufferData, data, dataLen); memcpy(mMultiBufferData + dataLen, data2, dataLen2); @@ -2598,7 +2598,7 @@ uchar *UdpConnection::BufferedSend(const uchar *data, int dataLen, const uchar * } else PhysicalSend(data, dataLen, appendAllowed); - return(NULL); + return(nullptr); } // if this data will not fit into buffer @@ -2626,7 +2626,7 @@ uchar *UdpConnection::BufferedSend(const uchar *data, int dataLen, const uchar * uchar *placementPtr = mMultiBufferPtr; memcpy(mMultiBufferPtr, data, dataLen); mMultiBufferPtr += dataLen; - if (data2 != NULL) + if (data2 != nullptr) { memcpy(mMultiBufferPtr, data2, dataLen2); mMultiBufferPtr += dataLen2; @@ -2635,21 +2635,21 @@ uchar *UdpConnection::BufferedSend(const uchar *data, int dataLen, const uchar * if ((mMultiBufferPtr - mMultiBufferData) >= actualMaxDataHoldSize) { FlushMultiBuffer(); - placementPtr = NULL; // it got flushed + placementPtr = nullptr; // it got flushed } return(placementPtr); } uchar *UdpConnection::InternalAckSend(uchar *bufferedAckPtr, const uchar *ackPtr, int ackLen) { - if (bufferedAckPtr != NULL) + if (bufferedAckPtr != nullptr) { memcpy(bufferedAckPtr, ackPtr, ackLen); return(bufferedAckPtr); } - BufferedSend(ackPtr, ackLen, NULL, 0, false); - return(NULL); // FIX THIS + BufferedSend(ackPtr, ackLen, nullptr, 0, false); + return(nullptr); // FIX THIS } void UdpConnection::FlushMultiBuffer() @@ -2665,7 +2665,7 @@ void UdpConnection::FlushMultiBuffer() // notify all the reliable channels to clear their buffered acks for (int i = 0; i < UdpManager::cReliableChannelCount; i++) { - if (mChannel[i] != NULL) + if (mChannel[i] != nullptr) { mChannel[i]->ClearBufferedAck(); } @@ -2689,7 +2689,7 @@ int UdpConnection::DecryptNone(uchar *destData, const uchar *sourceData, int sou int UdpConnection::EncryptUserSupplied(uchar *destData, const uchar *sourceData, int sourceLen) { UdpManagerHandler *manHandler = mUdpManager->GetHandler(); - if (manHandler != NULL) + if (manHandler != nullptr) return(manHandler->OnUserSuppliedEncrypt(this, destData, sourceData, sourceLen)); assert(0); // if user-supplied encryption is specified, then you must have a manager handler installed to provide the routines return(0); @@ -2698,7 +2698,7 @@ int UdpConnection::EncryptUserSupplied(uchar *destData, const uchar *sourceData, int UdpConnection::DecryptUserSupplied(uchar *destData, const uchar *sourceData, int sourceLen) { UdpManagerHandler *manHandler = mUdpManager->GetHandler(); - if (manHandler != NULL) + if (manHandler != nullptr) return(manHandler->OnUserSuppliedDecrypt(this, destData, sourceData, sourceLen)); assert(0); // if user-supplied encryption is specified, then you must have a manager handler installed to provide the routines return(0); @@ -2707,7 +2707,7 @@ int UdpConnection::DecryptUserSupplied(uchar *destData, const uchar *sourceData, int UdpConnection::EncryptUserSupplied2(uchar *destData, const uchar *sourceData, int sourceLen) { UdpManagerHandler *manHandler = mUdpManager->GetHandler(); - if (manHandler != NULL) + if (manHandler != nullptr) return(manHandler->OnUserSuppliedEncrypt2(this, destData, sourceData, sourceLen)); assert(0); // if user-supplied encryption is specified, then you must have a manager handler installed to provide the routines return(0); @@ -2716,7 +2716,7 @@ int UdpConnection::EncryptUserSupplied2(uchar *destData, const uchar *sourceData int UdpConnection::DecryptUserSupplied2(uchar *destData, const uchar *sourceData, int sourceLen) { UdpManagerHandler *manHandler = mUdpManager->GetHandler(); - if (manHandler != NULL) + if (manHandler != nullptr) return(manHandler->OnUserSuppliedDecrypt2(this, destData, sourceData, sourceLen)); assert(0); // if user-supplied encryption is specified, then you must have a manager handler installed to provide the routines return(0); @@ -2866,7 +2866,7 @@ void UdpConnection::SetupEncryptModel() mEncryptExpansionBytes += 0; // set up encrypt buffer (random numbers generated based on seed) - if (mEncryptXorBuffer == NULL) + if (mEncryptXorBuffer == nullptr) { int len = ((mUdpManager->mParams.maxRawPacketSize + 1) / 4) * 4; mEncryptXorBuffer = new uchar[len]; @@ -2898,7 +2898,7 @@ void UdpConnection::GetChannelStatus(UdpChannel channel, ChannelStatus *channelS case cUdpChannelReliable2: case cUdpChannelReliable3: case cUdpChannelReliable4: - if (mChannel[channel - cUdpChannelReliable1] != NULL) + if (mChannel[channel - cUdpChannelReliable1] != nullptr) { mChannel[channel - cUdpChannelReliable1]->GetChannelStatus(channelStatus); } @@ -2975,12 +2975,12 @@ UdpReliableChannel::UdpReliableChannel(int channelNumber, UdpConnection *con, Ud mLogicalPacketsQueued = 0; mLogicalBytesQueued = 0; - mCoalescePacket = NULL; - mCoalesceStartPtr = NULL; - mCoalesceEndPtr = NULL; + mCoalescePacket = nullptr; + mCoalesceStartPtr = nullptr; + mCoalesceEndPtr = nullptr; mCoalesceCount = 0; - mBufferedAckPtr = NULL; + mBufferedAckPtr = nullptr; mStatDuplicatePacketsReceived = 0; mStatResentPacketsAccelerated = 0; @@ -2994,7 +2994,7 @@ UdpReliableChannel::UdpReliableChannel(int channelNumber, UdpConnection *con, Ud mBigDataLen = 0; mBigDataTargetLen = 0; - mBigDataPtr = NULL; + mBigDataPtr = nullptr; mFragmentNextPos = 0; mLastTimeStampAcknowledged = 0; mMaxxedOutCurrentWindow = false; @@ -3003,23 +3003,23 @@ UdpReliableChannel::UdpReliableChannel(int channelNumber, UdpConnection *con, Ud mPhysicalPackets = new PhysicalPacket[mConfig.maxOutstandingPackets]; mReliableIncoming = new IncomingQueueEntry[mConfig.maxInstandingPackets]; - mLogicalRoot = NULL; - mLogicalEnd = NULL; + mLogicalRoot = nullptr; + mLogicalEnd = nullptr; } UdpReliableChannel::~UdpReliableChannel() { - if (mCoalescePacket != NULL) + if (mCoalescePacket != nullptr) { mCoalescePacket->Release(); - mCoalescePacket = NULL; + mCoalescePacket = nullptr; } const LogicalPacket *cur = mLogicalRoot; - while (cur != NULL) + while (cur != nullptr) { const LogicalPacket *next = cur->mReliableQueueNext; - cur->mReliableQueueNext = NULL; // make sure and mark it available so others could possibly use it (if it is a shared logical packet) + cur->mReliableQueueNext = nullptr; // make sure and mark it available so others could possibly use it (if it is a shared logical packet) cur->Release(); if (cur == next) // pointing to self, so this is end of list break; @@ -3035,7 +3035,7 @@ UdpReliableChannel::~UdpReliableChannel() void UdpReliableChannel::Send(const uchar *data, int dataLen, const uchar *data2, int dataLen2) { - if (mLogicalPacketsQueued == 0 && mCoalescePacket == NULL) + if (mLogicalPacketsQueued == 0 && mCoalescePacket == nullptr) { // if we are adding something to a previously empty logical queue, then it is possible that // we may be able to send it, so mark ourselves to take time the next time it is offered @@ -3086,7 +3086,7 @@ void UdpReliableChannel::Send(const LogicalPacket *packet) void UdpReliableChannel::FlushCoalesce() { - if (mCoalescePacket != NULL) + if (mCoalescePacket != nullptr) { if (mCoalesceCount == 1) { @@ -3103,16 +3103,16 @@ void UdpReliableChannel::FlushCoalesce() } mCoalescePacket->Release(); - mCoalescePacket = NULL; + mCoalescePacket = nullptr; } } void UdpReliableChannel::SendCoalesce(const uchar *data, int dataLen, const uchar *data2, int dataLen2) { int totalLen = dataLen + dataLen2; - if (mCoalescePacket == NULL) + if (mCoalescePacket == nullptr) { - mCoalescePacket = mUdpConnection->mUdpManager->CreatePacket(NULL, mMaxDataBytes); + mCoalescePacket = mUdpConnection->mUdpManager->CreatePacket(nullptr, mMaxDataBytes); mCoalesceEndPtr = mCoalesceStartPtr = (uchar *)mCoalescePacket->GetDataPtr(); *mCoalesceEndPtr++ = 0; *mCoalesceEndPtr++ = UdpConnection::cUdpPacketGroup; @@ -3132,10 +3132,10 @@ void UdpReliableChannel::SendCoalesce(const uchar *data, int dataLen, const ucha // append on end of coalesce mCoalesceCount++; mCoalesceEndPtr += UdpMisc::PutVariableValue(mCoalesceEndPtr, totalLen); - if (data != NULL) + if (data != nullptr) memcpy(mCoalesceEndPtr, data, dataLen); mCoalesceEndPtr += dataLen; - if (data2 != NULL) + if (data2 != nullptr) memcpy(mCoalesceEndPtr, data2, dataLen2); mCoalesceEndPtr += dataLen2; } @@ -3145,7 +3145,7 @@ void UdpReliableChannel::QueueLogicalPacket(const LogicalPacket *packet) mLogicalPacketsQueued++; mLogicalBytesQueued += packet->GetDataLen(); - if (packet->mReliableQueueNext != NULL) + if (packet->mReliableQueueNext != nullptr) { packet = mUdpConnection->mUdpManager->WrappedBorrow(packet); } @@ -3155,13 +3155,13 @@ void UdpReliableChannel::QueueLogicalPacket(const LogicalPacket *packet) } packet->mReliableQueueNext = packet; // have it point to itself to signify that the mNext pointer is taken (ie. reserve it), yet still represents the end of the list - if (mLogicalEnd != NULL) + if (mLogicalEnd != nullptr) { mLogicalEnd->mReliableQueueNext = packet; } mLogicalEnd = packet; - if (mLogicalRoot == NULL) + if (mLogicalRoot == nullptr) { mLogicalRoot = packet; } @@ -3182,10 +3182,10 @@ bool UdpReliableChannel::PullDown(int windowSpaceLeft) int physicalCount = (int)(mReliableOutgoingId - mReliableOutgoingPendingId); while (windowSpaceLeft > 0 && physicalCount < mConfig.maxOutstandingPackets) { - if (mLogicalRoot == NULL) + if (mLogicalRoot == nullptr) { FlushCoalesce(); // this is guaranteed to stick - if (mLogicalRoot == NULL) + if (mLogicalRoot == nullptr) break; // nothing flushed, so we are done } @@ -3225,10 +3225,10 @@ bool UdpReliableChannel::PullDown(int windowSpaceLeft) mLogicalRoot = mLogicalRoot->mReliableQueueNext; if (mLogicalRoot == lp) // ie, we were pointing to ourself, meaning we were the end of the list { - mLogicalRoot = NULL; - mLogicalEnd = NULL; + mLogicalRoot = nullptr; + mLogicalEnd = nullptr; } - lp->mReliableQueueNext = NULL; // clear our next link since we are no longer using it (so somebody else can use it potentially) + lp->mReliableQueueNext = nullptr; // clear our next link since we are no longer using it (so somebody else can use it potentially) lp->Release(); // release from logical queue } else @@ -3279,7 +3279,7 @@ int UdpReliableChannel::GiveTime() mMaxxedOutCurrentWindow = false; int outstandingNextSendTime = 10 * 60000; // if we have something to do - if (mReliableOutgoingPendingId < mReliableOutgoingId || mLogicalRoot != NULL || mCoalescePacket != NULL) + if (mReliableOutgoingPendingId < mReliableOutgoingId || mLogicalRoot != nullptr || mCoalescePacket != nullptr) { // first, let's calculate how many bytes we figure is outstanding based on who is still waiting for an ack-packet UdpMisc::ClockStamp oldestResendTime = udpMax(hotClock - optimalResendDelay, mLastTimeStampAcknowledged); // anything older than this, we need to resend @@ -3304,7 +3304,7 @@ int UdpReliableChannel::GiveTime() // if this packet has not been acked and it is NOT ready to be sent (was recently sent) then we consider it outstanding // note: packets needing re-sending probably got lost and are therefore not outstanding PhysicalPacket *entry = &mPhysicalPackets[i % mConfig.maxOutstandingPackets]; - if (entry->mDataPtr != NULL) // acked packets set the dataPtr to NULL + if (entry->mDataPtr != nullptr) // acked packets set the dataPtr to nullptr { // if this packet is ready to be sent (ie: needs time now, or some later packet has already been ack'ed) windowSpaceLeft -= entry->mDataLen; // window-space is effectively taken whether we have sent it yet or not @@ -3464,7 +3464,7 @@ int UdpReliableChannel::GiveTime() void UdpReliableChannel::GetChannelStatus(UdpConnection::ChannelStatus *channelStatus) const { int coalesceBytes = 0; - if (mCoalescePacket != NULL) + if (mCoalescePacket != nullptr) coalesceBytes = mCoalesceEndPtr - mCoalesceStartPtr; channelStatus->totalPendingBytes = mLogicalBytesQueued + mReliableOutgoingBytes + coalesceBytes; @@ -3525,7 +3525,7 @@ void UdpReliableChannel::ReliablePacket(const uchar *data, int dataLen) mReliableIncomingId++; // process other packets that have arrived - while (mReliableIncoming[mReliableIncomingId % mConfig.maxInstandingPackets].mPacket != NULL) + while (mReliableIncoming[mReliableIncomingId % mConfig.maxInstandingPackets].mPacket != nullptr) { int spot = (int)(mReliableIncomingId % mConfig.maxInstandingPackets); if (mReliableIncoming[spot].mMode != cReliablePacketModeDelivered) @@ -3534,7 +3534,7 @@ void UdpReliableChannel::ReliablePacket(const uchar *data, int dataLen) } mReliableIncoming[spot].mPacket->Release(); - mReliableIncoming[spot].mPacket = NULL; + mReliableIncoming[spot].mPacket = nullptr; mReliableIncomingId++; } } @@ -3542,7 +3542,7 @@ void UdpReliableChannel::ReliablePacket(const uchar *data, int dataLen) { // not the one we need next, but it is later than the one we need , so store it in our buffer until it's turn comes up int spot = (int)(reliableId % mConfig.maxInstandingPackets); - if (mReliableIncoming[spot].mPacket == NULL) // only make the copy of it if we don't already have it in our buffer (in cases where it was sent twice, there would be no harm in the copy again since it must be the same packet, it's just inefficient) + if (mReliableIncoming[spot].mPacket == nullptr) // only make the copy of it if we don't already have it in our buffer (in cases where it was sent twice, there would be no harm in the copy again since it must be the same packet, it's just inefficient) { mReliableIncoming[spot].mMode = mode; mReliableIncoming[spot].mPacket = mUdpConnection->mUdpManager->CreatePacket(data + UdpConnection::cUdpPacketReliableSize, dataLen - UdpConnection::cUdpPacketReliableSize); @@ -3584,16 +3584,16 @@ void UdpReliableChannel::ReliablePacket(const uchar *data, int dataLen) // a simple ack for us only *bufPtr++ = (uchar)(UdpConnection::cUdpPacketAck1 + mChannelNumber); bufPtr += UdpMisc::PutValue16(bufPtr, (ushort)(reliableId & 0xffff)); - mBufferedAckPtr = NULL; // not allowed to replace an old one with a selective-ack + mBufferedAckPtr = nullptr; // not allowed to replace an old one with a selective-ack } - if (mBufferedAckPtr != NULL && mConfig.ackDeduping) + if (mBufferedAckPtr != nullptr && mConfig.ackDeduping) { memcpy(mBufferedAckPtr, buf, bufPtr - buf); } else { - mBufferedAckPtr = mUdpConnection->BufferedSend(buf, bufPtr - buf, NULL, 0, true); // safe to append on our data, it is stack data + mBufferedAckPtr = mUdpConnection->BufferedSend(buf, bufPtr - buf, nullptr, 0, true); // safe to append on our data, it is stack data } } @@ -3610,7 +3610,7 @@ void UdpReliableChannel::ProcessPacket(ReliablePacketMode mode, const uchar *dat else if (mode == cReliablePacketModeFragment) { // append onto end of big packet (or create new big packet if not existing already) - if (mBigDataPtr == NULL) + if (mBigDataPtr == nullptr) { mBigDataTargetLen = UdpMisc::GetValue32(data); // first fragment has a total-length int header on it. mBigDataPtr = new uchar[mBigDataTargetLen]; @@ -3633,7 +3633,7 @@ void UdpReliableChannel::ProcessPacket(ReliablePacketMode mode, const uchar *dat delete[] mBigDataPtr; mBigDataLen = 0; mBigDataTargetLen = 0; - mBigDataPtr = NULL; + mBigDataPtr = nullptr; } } } @@ -3663,7 +3663,7 @@ void UdpReliableChannel::Ack(udp_int64 reliableId) int pos = (int)(reliableId % mConfig.maxOutstandingPackets); PhysicalPacket *entry = &mPhysicalPackets[pos]; - if (entry->mDataPtr != NULL) // if this packet has not been acknowledged yet (sometimes we get back two acks for the same packet) + if (entry->mDataPtr != nullptr) // if this packet has not been acknowledged yet (sometimes we get back two acks for the same packet) { mNextNeedTime = 0; // something got acked, so we actually need to take the time next time it is offered @@ -3721,14 +3721,14 @@ void UdpReliableChannel::Ack(udp_int64 reliableId) // this packet we have queued has been acknowledged, so delete it from queue mReliableOutgoingBytes -= entry->mDataLen; entry->mDataLen = 0; - entry->mDataPtr = NULL; + entry->mDataPtr = nullptr; entry->mParent->Release(); - entry->mParent = NULL; + entry->mParent = nullptr; // advance the pending ptr until it reaches outgoingId or an entry that has yet to acknowledged while (mReliableOutgoingPendingId < mReliableOutgoingId) { - if (mPhysicalPackets[mReliableOutgoingPendingId % mConfig.maxOutstandingPackets].mDataPtr != NULL) + if (mPhysicalPackets[mReliableOutgoingPendingId % mConfig.maxOutstandingPackets].mDataPtr != nullptr) break; mReliableOutgoingPendingId++; } @@ -3750,25 +3750,25 @@ void UdpReliableChannel::Ack(udp_int64 reliableId) UdpReliableChannel::IncomingQueueEntry::IncomingQueueEntry() { - mPacket = NULL; + mPacket = nullptr; mMode = UdpReliableChannel::cReliablePacketModeReliable; } UdpReliableChannel::IncomingQueueEntry::~IncomingQueueEntry() { - if (mPacket != NULL) + if (mPacket != nullptr) mPacket->Release(); } UdpReliableChannel::PhysicalPacket::PhysicalPacket() { - mParent = NULL; + mParent = nullptr; } UdpReliableChannel::PhysicalPacket::~PhysicalPacket() { - if (mParent != NULL) + if (mParent != nullptr) mParent->Release(); } @@ -3780,7 +3780,7 @@ UdpReliableChannel::PhysicalPacket::~PhysicalPacket() LogicalPacket::LogicalPacket() { mRefCount = 1; - mReliableQueueNext = NULL; + mReliableQueueNext = nullptr; } LogicalPacket::~LogicalPacket() @@ -3815,7 +3815,7 @@ SimpleLogicalPacket::SimpleLogicalPacket(const void *data, int dataLen) { mDataLen = dataLen; mData = new uchar[mDataLen]; - if (data != NULL) + if (data != nullptr) memcpy(mData, data, mDataLen); } @@ -3850,7 +3850,7 @@ void SimpleLogicalPacket::SetDataLen(int len) GroupLogicalPacket::GroupLogicalPacket() : LogicalPacket() { mDataLen = 0; - mData = NULL; + mData = nullptr; } GroupLogicalPacket::~GroupLogicalPacket() @@ -3860,13 +3860,13 @@ GroupLogicalPacket::~GroupLogicalPacket() void GroupLogicalPacket::AddPacket(const LogicalPacket *packet) { - assert(packet != NULL); + assert(packet != nullptr); AddPacketInternal(packet->GetDataPtr(), packet->GetDataLen(), packet->IsInternalPacket()); } void GroupLogicalPacket::AddPacket(const void *data, int dataLen) { - assert(data != NULL); + assert(data != nullptr); assert(dataLen >= 0); AddPacketInternal(data, dataLen, false); } @@ -3932,16 +3932,16 @@ PooledLogicalPacket::PooledLogicalPacket(UdpManager *manager, int len) mDataLen = 0; mUdpManager = manager; - mAvailableNext = NULL; - mCreatedNext = NULL; - mCreatedPrev = NULL; + mAvailableNext = nullptr; + mCreatedNext = nullptr; + mCreatedPrev = nullptr; mUdpManager->PoolCreated(this); } PooledLogicalPacket::~PooledLogicalPacket() { - if (mUdpManager != NULL) + if (mUdpManager != nullptr) { mUdpManager->PoolDestroyed(this); } @@ -3956,7 +3956,7 @@ void PooledLogicalPacket::AddRef() const void PooledLogicalPacket::Release() const { - if (mRefCount == 1 && mUdpManager != NULL) + if (mRefCount == 1 && mUdpManager != nullptr) mUdpManager->PoolReturn(const_cast(this)); // if pool wants to keep us, it will inc our ref count, preventing our destruction // we cast off our const, as when we are added back to the pool, we can be modified LogicalPacket::Release(); @@ -3986,9 +3986,9 @@ void PooledLogicalPacket::SetDataLen(int len) void PooledLogicalPacket::SetData(const void *data, int dataLen, const void *data2, int dataLen2) { mDataLen = dataLen + dataLen2; - if (data != NULL) + if (data != nullptr) memcpy(mData, data, dataLen); - if (data2 != NULL) + if (data2 != nullptr) memcpy(mData + dataLen, data2, dataLen2); } @@ -3999,23 +3999,23 @@ void PooledLogicalPacket::SetData(const void *data, int dataLen, const void *dat /////////////////////////////////////////////////////////////////////////////////////////// WrappedLogicalPacket::WrappedLogicalPacket(UdpManager *udpManager) { - mPacket = NULL; + mPacket = nullptr; mUdpManager = udpManager; - mAvailableNext = NULL; - mCreatedNext = NULL; - mCreatedPrev = NULL; + mAvailableNext = nullptr; + mCreatedNext = nullptr; + mCreatedPrev = nullptr; mUdpManager->WrappedCreated(this); } WrappedLogicalPacket::~WrappedLogicalPacket() { - if (mUdpManager != NULL) + if (mUdpManager != nullptr) { mUdpManager->WrappedDestroyed(this); } - if (mPacket != NULL) + if (mPacket != nullptr) { mPacket->Release(); } @@ -4028,7 +4028,7 @@ void WrappedLogicalPacket::AddRef() const void WrappedLogicalPacket::Release() const { - if (mRefCount == 1 && mUdpManager != NULL) + if (mRefCount == 1 && mUdpManager != nullptr) mUdpManager->WrappedReturn(const_cast(this)); // if pool wants to keep us, it will inc our ref count, preventing our destruction // we cast off our const, as when we are added back to the pool, we can be modified LogicalPacket::Release(); @@ -4036,10 +4036,10 @@ void WrappedLogicalPacket::Release() const void WrappedLogicalPacket::SetLogicalPacket(const LogicalPacket *packet) { - if (mPacket != NULL) + if (mPacket != nullptr) mPacket->Release(); mPacket = packet; - if (mPacket != NULL) + if (mPacket != nullptr) mPacket->AddRef(); } @@ -4075,7 +4075,7 @@ UdpManager::SimulateQueueEntry::SimulateQueueEntry(const uchar *data, int dataLe memcpy(mData, data, dataLen); mIp = ip; mPort = port; - mNext = NULL; + mNext = nullptr; } UdpManager::SimulateQueueEntry::~SimulateQueueEntry() @@ -4110,7 +4110,7 @@ UdpMisc::ClockStamp UdpMisc::Clock() static ClockStamp sLastStamp = 0; static ClockStamp sCurrentCorrection = 0; struct timeval tv; - gettimeofday(&tv, NULL); + gettimeofday(&tv, nullptr); UdpMisc::ClockStamp cs = static_cast(tv.tv_sec) * 1000 + static_cast(tv.tv_usec / 1000); cs += sCurrentCorrection; if (cs < sLastStamp) @@ -4226,19 +4226,19 @@ void *UdpMisc::SmartResize(void *ptr, int bytes, int round) if (bytes == 0) { - if (ptr != NULL) + if (ptr != nullptr) { free((uchar *)ptr - cAlignment); } - return(NULL); + return(nullptr); } uchar *ptr2; - if (ptr == NULL) + if (ptr == nullptr) { ptr2 = (uchar *)malloc(bytes + cAlignment); - if (ptr2 == NULL) - return(NULL); + if (ptr2 == nullptr) + return(nullptr); *(int *)ptr2 = bytes; return(ptr2 + cAlignment); } @@ -4248,8 +4248,8 @@ void *UdpMisc::SmartResize(void *ptr, int bytes, int round) return(ptr); ptr2 = (uchar *)realloc((uchar *)ptr - cAlignment, bytes + cAlignment); - if (ptr2 == NULL) - return(NULL); + if (ptr2 == nullptr) + return(nullptr); *(int *)ptr2 = bytes; return(ptr2 + cAlignment); @@ -4312,30 +4312,30 @@ LogicalPacket *UdpMisc::CreateQuickLogicalPacket(const void *data, int dataLen, switch(q) { case 0: - tlp = new FixedLogicalPacket(NULL, totalDataLen); + tlp = new FixedLogicalPacket(nullptr, totalDataLen); break; case 1: - tlp = new FixedLogicalPacket(NULL, totalDataLen); + tlp = new FixedLogicalPacket(nullptr, totalDataLen); break; case 2: case 3: - tlp = new FixedLogicalPacket(NULL, totalDataLen); + tlp = new FixedLogicalPacket(nullptr, totalDataLen); break; case 4: case 5: case 6: case 7: - tlp = new FixedLogicalPacket(NULL, totalDataLen); + tlp = new FixedLogicalPacket(nullptr, totalDataLen); break; default: - tlp = new SimpleLogicalPacket(NULL, totalDataLen); + tlp = new SimpleLogicalPacket(nullptr, totalDataLen); break; } uchar *dest = (uchar *)tlp->GetDataPtr(); - if (data != NULL) + if (data != nullptr) memcpy(dest, data, dataLen); - if (data2 != NULL) + if (data2 != nullptr) memcpy(dest + dataLen, data2, dataLen2); return(tlp); } @@ -4349,7 +4349,7 @@ UdpIpAddress UdpMisc::GetHostByName(const char *hostName) { struct hostent * lphp; lphp = gethostbyname(hostName); - if (lphp == NULL) + if (lphp == nullptr) { address = 0; } diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpLibrary.hpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpLibrary.hpp index 27fc28d1..9db50e40 100644 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpLibrary.hpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpLibrary.hpp @@ -150,7 +150,7 @@ class UdpMisc // memory manager does a little bit of this, but if you know you have an allocation that is likely // to grow quite a bit, you can set the round'ing size up to a fairly large number and avoid // unnecessary reallocs at the cost of a little potentially wasted space - // initial allocations are done by passing in ptr==NULL, freeing is done by passing in bytes==0 + // initial allocations are done by passing in ptr==nullptr, freeing is done by passing in bytes==0 static void *SmartResize(void *ptr, int bytes, int round = 1); // the following two functions store values in the buffer as a variable length (B1, 0xffB2B1, 0xffffffB4B3B2B1) @@ -170,7 +170,7 @@ class UdpMisc static uint GetValue24(const void *buffer); // gets a 24-bit value from the buffer in big-endian format static ushort GetValue16(const void *buffer); // gets a 16-bit value from the buffer in big-endian format - static LogicalPacket *CreateQuickLogicalPacket(const void *data, int dataLen, const void *data2 = NULL, int dataLen2 = 0); + static LogicalPacket *CreateQuickLogicalPacket(const void *data, int dataLen, const void *data2 = nullptr, int dataLen2 = 0); // looks up the specified name and translates it to an IP address // this is a blocking call that can at times take a significant amount of time, but will generally be fast (less than 300ms) @@ -243,7 +243,7 @@ class LogicalPacket protected: friend class UdpReliableChannel; mutable const LogicalPacket *mReliableQueueNext; // owned/managed by the reliable channel object as an optimizations, do not touch - // NULL = unclaimed, point-to-self = claimed, but end of list + // nullptr = unclaimed, point-to-self = claimed, but end of list }; class SimpleLogicalPacket : public LogicalPacket @@ -252,7 +252,7 @@ class SimpleLogicalPacket : public LogicalPacket // it was originally created to allow the internal code to handle reliable data that was sent // via the Send(char *, int) api call. public: - SimpleLogicalPacket(const void *data, int dataLen); // data can be NULL if you want to populate it after it is allocated (get the pointer and write to it) + SimpleLogicalPacket(const void *data, int dataLen); // data can be nullptr if you want to populate it after it is allocated (get the pointer and write to it) virtual void *GetDataPtr(); virtual const void *GetDataPtr() const; virtual int GetDataLen() const; @@ -323,7 +323,7 @@ template class StructLogicalPacket : public LogicalPacket // with virtual functions) via this method as they may contain hidden data-members (such as pointers // to vtables). public: - StructLogicalPacket(T *initData = NULL); + StructLogicalPacket(T *initData = nullptr); virtual void *GetDataPtr(); virtual const void *GetDataPtr() const; virtual int GetDataLen() const; @@ -396,7 +396,7 @@ class PooledLogicalPacket : public LogicalPacket int mMaxDataLen; protected: friend class UdpManager; - void SetData(const void *data, int dataLen, const void *data2 = NULL, int dataLen2 = 0); + void SetData(const void *data, int dataLen, const void *data2 = nullptr, int dataLen2 = 0); UdpManager *mUdpManager; PooledLogicalPacket *mAvailableNext; PooledLogicalPacket *mCreatedNext; @@ -476,7 +476,7 @@ class UdpManager // pointer equal to your object and the UdpManager will call it as appropriate. The UdpConnection object // also has a handler mechanism that replaces the other callback functions below, see UdpConnection::SetHandler // if a handler is specified, the callback function is ignored, even if specified. - // default = NULL (not used) + // default = nullptr (not used) UdpManagerHandler *handler; // this is the maximum number of connections that can be established by this manager, any incoming/outgoing connections @@ -901,7 +901,7 @@ class UdpManager // will call EstablishConnection, then sit in a loop calling UdpManager::GiveTime and checking to see // if the status of the returned UdpConnection object is changed from cStatusNegotiating. This allows // the application to look for the ESC key or timeout an attempted connection. - // This function will return NULL if the manager object has exceeded its maximum number of connections + // This function will return nullptr if the manager object has exceeded its maximum number of connections // or if the serverAddress cannot be resolved to an IP address // as is noted in the declaration, it is the responsibility of the application establishing the connection to delete it // setting the timeout value (in milliseconds) to something greater than 0 will cause the UdpConnection object to change @@ -933,13 +933,13 @@ class UdpManager // manually forces all live connections to flush their multi buffers immediately void FlushAllMultiBuffer(); - // creates a logical packet and populates it with data. data can be NULL, in which case it gives you logical packet + // creates a logical packet and populates it with data. data can be nullptr, in which case it gives you logical packet // of the size specified, but copies no data into it. If you are using pool management (see Params::poolPacketMax), // it will give you a packet out of the pool if possible, otherwise it will create a packet for you. When logical // are packets are needed internally for various things (like reliable channel sends that use the (void *, int) interface) // they are gotten from this function, so your application can likely take advantage of pooling, even if it never bothers // to explicitly call this function. - LogicalPacket *CreatePacket(const void *data, int dataLen, const void *data2 = NULL, int dataLen2 = 0); + LogicalPacket *CreatePacket(const void *data, int dataLen, const void *data2 = nullptr, int dataLen2 = 0); protected: friend class PooledLogicalPacket; @@ -1165,7 +1165,7 @@ class UdpConnection : public PriorityQueueMember, public AddressHashTableMember, int ConnectionAge() const; // returns the UdpManager object that is managing this connection - // will return NULL if the connection has been disconnected for some reason (because disconnecting severes the link to UdpManager) + // will return nullptr if the connection has been disconnected for some reason (because disconnecting severes the link to UdpManager) UdpManager *GetUdpManager() const; // returns the 32-bit encryption-code that was negotiated as part of the connection-establishment process. @@ -1245,9 +1245,9 @@ class UdpConnection : public PriorityQueueMember, public AddressHashTableMember, friend class UdpManager; friend class UdpReliableChannel; - // note: if connectPacket is NULL, that means this connection object is being created to establish + // note: if connectPacket is nullptr, that means this connection object is being created to establish // a new connection to the specified ip/port (ie. the connection starts out in cStatusNegotiating mode) - // if connectPacket is non-NULL, that menas this connection object is being created to handle an + // if connectPacket is non-nullptr, that menas this connection object is being created to handle an // incoming connect request and it will start out in cStatusConnected mode. UdpConnection(UdpManager *udpManager, UdpIpAddress destIp, int destPort, int timeout); // starts connection-establishment protocol UdpConnection(UdpManager *udpManager, const UdpManager::PacketHistoryEntry *e); // starts already connected, replying to connection request @@ -1282,7 +1282,7 @@ class UdpConnection : public PriorityQueueMember, public AddressHashTableMember, void PhysicalSend(const uchar *data, int dataLen, bool appendAllowed); // sends a physical packet (encrypts and adds crc bytes) uchar *BufferedSend(const uchar *data, int dataLen, const uchar *data2, int dataLen2, bool appendAllowed); // buffers logical packets waiting til we have more data (makes multi-packets) bool InternalSend(UdpChannel channel, const LogicalPacket *packet); - bool InternalSend(UdpChannel channel, const uchar *data, int dataLen, const uchar *data2 = NULL, int dataLen2 = 0); + bool InternalSend(UdpChannel channel, const uchar *data, int dataLen, const uchar *data2 = nullptr, int dataLen2 = 0); uchar *InternalAckSend(uchar *bufferedAckPtr, const uchar *ackPtr, int ackLen); // used by reliable channel to send acks (special send that allows for deduping ack feature) @@ -1573,7 +1573,7 @@ class UdpReliableChannel void ProcessPacket(ReliablePacketMode mode, const uchar *data, int dataLen); bool PullDown(int windowSpaceLeft); void FlushCoalesce(); - void SendCoalesce(const uchar *data, int dataLen, const uchar *data2 = NULL, int dataLen2 = 0); + void SendCoalesce(const uchar *data, int dataLen, const uchar *data2 = nullptr, int dataLen2 = 0); void QueueLogicalPacket(const LogicalPacket *packet); UdpManager::ReliableConfig mConfig; @@ -1627,7 +1627,7 @@ class UdpReliableChannel template FixedLogicalPacket::FixedLogicalPacket(const void *data, int dataLen) { mDataLen = dataLen; - if (data != NULL) + if (data != nullptr) memcpy(mData, data, mDataLen); } @@ -1657,7 +1657,7 @@ template void FixedLogicalPacket::SetDataLen(int l ///////////////////////////////////////////////////////////////////////// template StructLogicalPacket::StructLogicalPacket(T *initData) { - if (initData != NULL) + if (initData != nullptr) mStruct = *initData; } @@ -1802,7 +1802,7 @@ inline void UdpManager::SetPriority(UdpConnection *con, UdpMisc::ClockStamp stam if (stamp < mMinimumScheduledStamp) stamp = mMinimumScheduledStamp; - if (mPriorityQueue != NULL) + if (mPriorityQueue != nullptr) mPriorityQueue->Add(con, stamp); } @@ -1829,7 +1829,7 @@ inline void UdpManager::PoolReturn(PooledLogicalPacket *packet) inline void UdpManager::WrappedReturn(WrappedLogicalPacket *wp) { - wp->SetLogicalPacket(NULL); + wp->SetLogicalPacket(nullptr); if (mWrappedAvailable < mParams.wrappedPoolMax) { @@ -1877,7 +1877,7 @@ inline void UdpConnection::ScheduleTimeNow() // prevents us from reprioritizing to 0, only to shortly thereafter be reprioritized to where we actually belong. if (!mGettingTime) { - if (mUdpManager != NULL) + if (mUdpManager != nullptr) mUdpManager->SetPriority(this, 0); } } @@ -2066,7 +2066,7 @@ inline int UdpReliableChannel::TotalPendingBytes() const inline void UdpReliableChannel::ClearBufferedAck() { - mBufferedAckPtr = NULL; + mBufferedAckPtr = nullptr; } inline udp_int64 UdpReliableChannel::GetReliableOutgoingId(int reliableStamp) const diff --git a/external/3rd/library/udplibrary/PointerDeque.hpp b/external/3rd/library/udplibrary/PointerDeque.hpp index 6124afd8..8cc2ccc2 100644 --- a/external/3rd/library/udplibrary/PointerDeque.hpp +++ b/external/3rd/library/udplibrary/PointerDeque.hpp @@ -2,7 +2,7 @@ #define POINTERDEQUE_HPP // This is a simple double ended queue template. Any pointer-type can be stored in this deque - // I pop/peek return NULL if the queue is empty. + // I pop/peek return nullptr if the queue is empty. template class PointerDeque { public: @@ -32,7 +32,7 @@ template class PointerDeque template PointerDeque::PointerDeque(int entriesPerPage) { mEntriesPerPage = entriesPerPage; - mEntries = NULL; + mEntries = nullptr; mOffsetLeft = 0; mEntriesMax = 0; mEntriesCount = 0; @@ -73,7 +73,7 @@ template void PointerDeque::PushLeft(T* obj) template T* PointerDeque::PopLeft() { if (mEntriesCount == 0) - return(NULL); + return(nullptr); T* hold = mEntries[mOffsetLeft]; mOffsetLeft = (mOffsetLeft + 1) % mEntriesMax; mEntriesCount--; @@ -91,7 +91,7 @@ template void PointerDeque::PushRight(T* obj) template T* PointerDeque::PopRight() { if (mEntriesCount == 0) - return(NULL); + return(nullptr); mEntriesCount--; return(mEntries[(mOffsetLeft + mEntriesCount) % mEntriesMax]); } @@ -99,21 +99,21 @@ template T* PointerDeque::PopRight() template T* PointerDeque::PeekLeft() { if (mEntriesCount == 0) - return(NULL); + return(nullptr); return(mEntries[mOffsetLeft]); } template T* PointerDeque::PeekRight() { if (mEntriesCount == 0) - return(NULL); + return(nullptr); return(mEntries[(mOffsetLeft + mEntriesCount - 1) % mEntriesMax]); } template T* PointerDeque::Peek(int index) { if (index >= mEntriesCount) - return(NULL); + return(nullptr); return(mEntries[(mOffsetLeft + index) % mEntriesMax]); } diff --git a/external/3rd/library/udplibrary/UdpLibrary.cpp b/external/3rd/library/udplibrary/UdpLibrary.cpp index a84e147d..c8436157 100755 --- a/external/3rd/library/udplibrary/UdpLibrary.cpp +++ b/external/3rd/library/udplibrary/UdpLibrary.cpp @@ -144,7 +144,7 @@ UdpIpAddress::UdpIpAddress(unsigned int ip) char *UdpIpAddress::GetAddress(char *buffer) const { - assert(buffer != NULL); + assert(buffer != nullptr); struct sockaddr_in addr_serverUDP; addr_serverUDP.sin_addr.s_addr = mIp; @@ -157,7 +157,7 @@ char *UdpIpAddress::GetAddress(char *buffer) const ///////////////////////////////////////////////////////////////////////////////////////////////////// UdpManager::Params::Params() { - handler = NULL; + handler = nullptr; outgoingBufferSize = 64 * 1024; incomingBufferSize = 64 * 1024; packetHistoryMax = 100; @@ -258,7 +258,7 @@ UdpManager::UdpManager(const UdpManager::Params *params) mParams.maxDataHoldSize = udpMin(mParams.maxDataHoldSize, mParams.maxRawPacketSize); mParams.packetHistoryMax = udpMax(1, mParams.packetHistoryMax); mPacketHistoryPosition = 0; - mPassThroughData = NULL; + mPassThroughData = nullptr; typedef PacketHistoryEntry *PacketHistoryEntryPtr; mPacketHistory = new PacketHistoryEntryPtr[mParams.packetHistoryMax]; @@ -279,17 +279,17 @@ UdpManager::UdpManager(const UdpManager::Params *params) mUdpSocket = INVALID_SOCKET; mConnectionListCount = 0; - mConnectionList = NULL; + mConnectionList = nullptr; mPoolCreated = 0; mPoolAvailable = 0; - mPoolAvailableRoot = NULL; - mPoolCreatedRoot = NULL; + mPoolAvailableRoot = nullptr; + mPoolCreatedRoot = nullptr; mWrappedCreated = 0; mWrappedAvailable = 0; - mWrappedAvailableRoot = NULL; - mWrappedCreatedRoot = NULL; + mWrappedAvailableRoot = nullptr; + mWrappedCreatedRoot = nullptr; for (i = 0; i < mParams.pooledPacketInitial && i < mParams.pooledPacketMax; i++) { @@ -299,16 +299,16 @@ UdpManager::UdpManager(const UdpManager::Params *params) lp->Release(); } - mSimulateQueueStart = NULL; - mSimulateQueueEnd = NULL; + mSimulateQueueStart = nullptr; + mSimulateQueueEnd = nullptr; mSimulateNextOutgoingTime = 0; mSimulateNextIncomingTime = 0; mSimulateQueueBytes = 0; - mDisconnectPendingList = NULL; + mDisconnectPendingList = nullptr; if (mParams.avoidPriorityQueue) - mPriorityQueue = NULL; + mPriorityQueue = nullptr; else mPriorityQueue = new PriorityQueue(mParams.maxConnections); @@ -339,14 +339,14 @@ UdpManager::~UdpManager() // first we need to tell all the pooled packets we have created that they can no longer check themselves back into use // when they are released PooledLogicalPacket *walk = mPoolCreatedRoot; - while (walk != NULL) + while (walk != nullptr) { - walk->mUdpManager = NULL; + walk->mUdpManager = nullptr; walk = walk->mCreatedNext; } // next release the ones we have in our available pool walk = mPoolAvailableRoot; - while (walk != NULL) + while (walk != nullptr) { PooledLogicalPacket *hold = walk; walk = walk->mAvailableNext; @@ -359,14 +359,14 @@ UdpManager::~UdpManager() // next we need to tell all the warpped packets we have created that they can no longer check themselves back into use // when they are released WrappedLogicalPacket *walk = mWrappedCreatedRoot; - while (walk != NULL) + while (walk != nullptr) { - walk->mUdpManager = NULL; + walk->mUdpManager = nullptr; walk = walk->mCreatedNext; } // next release the ones we have in our available pool walk = mWrappedAvailableRoot; - while (walk != NULL) + while (walk != nullptr) { WrappedLogicalPacket *hold = walk; walk = walk->mAvailableNext; @@ -376,7 +376,7 @@ UdpManager::~UdpManager() // next thing we must do is tell all the connections to disconnect (which severs their link to this dying manager) // this has to be done first since they will call back into us and have themselves removed from our connection-list/priority-queue/etc - while (mConnectionList != NULL) + while (mConnectionList != nullptr) { mConnectionList->InternalDisconnect(0, UdpConnection::cDisconnectReasonManagerDeleted); // the above call ended up calling us back and removing them from our connection list, so now mConnectionList is pointing to the next entry @@ -384,7 +384,7 @@ UdpManager::~UdpManager() } // release any objects that were pending disconnection - while (mDisconnectPendingList != NULL) + while (mDisconnectPendingList != nullptr) { UdpConnection *next = mDisconnectPendingList->mDisconnectPendingNextConnection; mDisconnectPendingList->Release(); @@ -404,7 +404,7 @@ UdpManager::~UdpManager() } delete[] mPacketHistory; - while (mSimulateQueueStart != NULL) + while (mSimulateQueueStart != nullptr) { SimulateQueueEntry *entry = mSimulateQueueStart; mSimulateQueueStart = entry->mNext; @@ -517,12 +517,12 @@ void UdpManager::ProcessDisconnectPending() { UdpConnection *entry = mDisconnectPendingList; UdpConnection **prev = &mDisconnectPendingList; - while (entry != NULL) + while (entry != nullptr) { if (entry->GetStatus() == UdpConnection::cStatusDisconnected) { *prev = entry->mDisconnectPendingNextConnection; - entry->mDisconnectPendingNextConnection = NULL; + entry->mDisconnectPendingNextConnection = nullptr; entry->Release(); entry = *prev; } @@ -536,19 +536,19 @@ void UdpManager::ProcessDisconnectPending() void UdpManager::RemoveConnection(UdpConnection *con) { - assert(con != NULL); // attemped to remove a NULL connection object + assert(con != nullptr); // attemped to remove a nullptr connection object // note: it's a bug to Remove a connection object that is already removed...should never be able to happen. mConnectionListCount--; - if (con->mPrevConnection != NULL) + if (con->mPrevConnection != nullptr) con->mPrevConnection->mNextConnection = con->mNextConnection; - if (con->mNextConnection != NULL) + if (con->mNextConnection != nullptr) con->mNextConnection->mPrevConnection = con->mPrevConnection; if (mConnectionList == con) mConnectionList = con->mNextConnection; - con->mNextConnection = NULL; - con->mPrevConnection = NULL; - if (mPriorityQueue != NULL) + con->mNextConnection = nullptr; + con->mPrevConnection = nullptr; + if (mPriorityQueue != nullptr) mPriorityQueue->Remove(con); mAddressHashTable->Remove(con, AddressHashValue(con->mIp, con->mPort)); @@ -557,11 +557,11 @@ void UdpManager::RemoveConnection(UdpConnection *con) void UdpManager::AddConnection(UdpConnection *con) { - assert(con != NULL); // attemped to add a NULL connection object + assert(con != nullptr); // attemped to add a nullptr connection object con->mNextConnection = mConnectionList; - con->mPrevConnection = NULL; - if (mConnectionList != NULL) + con->mPrevConnection = nullptr; + if (mConnectionList != nullptr) mConnectionList->mPrevConnection = con; mConnectionList = con; mConnectionListCount++; @@ -574,7 +574,7 @@ void UdpManager::FlushAllMultiBuffer() { AddRef(); UdpConnection *cur = mConnectionList; - while (cur != NULL) + while (cur != nullptr) { cur->FlushMultiBuffer(); cur = cur->mNextConnection; @@ -597,7 +597,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) { PacketHistoryEntry *e = ActualReceive(); - if (e == NULL) + if (e == nullptr) { mLastEmptySocketBufferStamp = UdpMisc::Clock(); break; @@ -625,7 +625,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) if (giveConnectionsTime) { - if (mPriorityQueue != NULL) + if (mPriorityQueue != nullptr) { // give time to everybody in the priority-queue that needs it UdpMisc::ClockStamp curPriority = UdpMisc::Clock(); @@ -643,7 +643,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) for (;;) { UdpConnection *top = mPriorityQueue->TopRemove(curPriority); - if (top == NULL) + if (top == nullptr) break; top->AddRef(); top->GiveTime(); @@ -656,7 +656,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) { // give time to everybody UdpConnection *cur = mConnectionList; - while (cur != NULL) + while (cur != nullptr) { cur->GiveTime(); cur = cur->mNextConnection; @@ -666,7 +666,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) ProcessDisconnectPending(); } - if (mSimulateQueueStart != NULL && UdpMisc::Clock() >= mSimulateNextOutgoingTime) + if (mSimulateQueueStart != nullptr && UdpMisc::Clock() >= mSimulateNextOutgoingTime) { SimulateQueueEntry *entry = mSimulateQueueStart; mSimulateQueueStart = mSimulateQueueStart->mNext; @@ -674,7 +674,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) ActualSendHelper(entry->mData, entry->mDataLen, entry->mIp, entry->mPort); UdpConnection *con = AddressGetConnection(entry->mIp, entry->mPort); - if (con != NULL) + if (con != nullptr) con->mSimulateQueueBytes -= entry->mDataLen; mSimulateQueueBytes -= entry->mDataLen; delete entry; @@ -687,11 +687,11 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) UdpConnection *UdpManager::EstablishConnection(const char *serverAddress, int serverPort, int timeout) { assert(serverPort != 0); // can't connect to no port - assert(serverAddress != NULL); + assert(serverAddress != nullptr); assert(serverAddress[0] != 0); if (mConnectionListCount >= mParams.maxConnections) - return(NULL); + return(nullptr); // get server address unsigned long address = inet_addr(serverAddress); @@ -699,16 +699,16 @@ UdpConnection *UdpManager::EstablishConnection(const char *serverAddress, int se { struct hostent * lphp; lphp = gethostbyname(serverAddress); - if (lphp == NULL) - return(NULL); + if (lphp == nullptr) + return(nullptr); address = ((struct in_addr *)(lphp->h_addr))->s_addr; } UdpIpAddress destIp(address); // first, see if we already have a connection object managing this ip/port, if we do, then fail UdpConnection *con = AddressGetConnection(destIp, serverPort); - if (con != NULL) - return(NULL); + if (con != nullptr) + return(nullptr); return(new UdpConnection(this, destIp, serverPort, timeout)); } @@ -721,7 +721,7 @@ void UdpManager::KeepUntilDisconnected(UdpConnection *con) void UdpManager::GetStats(UdpManagerStatistics *stats) const { - assert(stats != NULL); + assert(stats != nullptr); *stats = mManagerStats; stats->poolAvailable = mPoolAvailable; stats->poolCreated = mPoolCreated; @@ -736,10 +736,10 @@ void UdpManager::ResetStats() void UdpManager::DumpPacketHistory(const char *filename) const { - assert(filename != NULL); + assert(filename != nullptr); assert(filename[0] != 0); FILE *file = fopen(filename, "wt"); - if (file != NULL) + if (file != nullptr) { // dump history of packets... for (int i = 0; i < mParams.packetHistoryMax; i++) @@ -785,7 +785,7 @@ int UdpManager::GetLocalPort() const UdpManager::PacketHistoryEntry *UdpManager::ActualReceive() { if (mParams.simulateIncomingByteRate > 0 && UdpMisc::Clock() < mSimulateNextIncomingTime) - return(NULL); + return(nullptr); struct sockaddr_in addr_from; socklen_t sf = sizeof(addr_from); @@ -795,7 +795,7 @@ UdpManager::PacketHistoryEntry *UdpManager::ActualReceive() if (res != SOCKET_ERROR) { if (mParams.simulateIncomingLossPercent > 0 && ((rand() % 100) < mParams.simulateIncomingLossPercent)) - return(NULL); // packet, what packet? + return(nullptr); // packet, what packet? if (mParams.simulateIncomingByteRate > 0) mSimulateNextIncomingTime = UdpMisc::Clock() + (res * 1000 / mParams.simulateIncomingByteRate); @@ -820,7 +820,7 @@ UdpManager::PacketHistoryEntry *UdpManager::ActualReceive() UdpIpAddress ip = UdpIpAddress(addr_from.sin_addr.s_addr); int port = (int)ntohs(addr_from.sin_port); UdpConnection *con = AddressGetConnection(ip, port); - if (con != NULL) + if (con != nullptr) { con->AddRef(); con->PortUnreachable(); @@ -840,7 +840,7 @@ UdpManager::PacketHistoryEntry *UdpManager::ActualReceive() } #endif } - return(NULL); + return(nullptr); } void UdpManager::ProcessIcmpErrors() @@ -868,7 +868,7 @@ void UdpManager::ProcessIcmpErrors() struct cmsghdr * cmsg; if(CMSG_FIRSTHDR(&msgh)) { - for(cmsg = CMSG_FIRSTHDR(&msgh); cmsg != NULL; cmsg = CMSG_NXTHDR(&msgh, cmsg)) + for(cmsg = CMSG_FIRSTHDR(&msgh); cmsg != nullptr; cmsg = CMSG_NXTHDR(&msgh, cmsg)) { if(cmsg->cmsg_level == SOL_IP && cmsg->cmsg_type == IP_RECVERR) { @@ -882,7 +882,7 @@ void UdpManager::ProcessIcmpErrors() UdpIpAddress ip = UdpIpAddress(msg_name.sin_addr.s_addr); int port = (int)htons(msg_name.sin_port); UdpConnection *con = AddressGetConnection(ip, port); - if (con != NULL) + if (con != nullptr) { con->AddRef(); con->PortUnreachable(); @@ -911,7 +911,7 @@ void UdpManager::ActualSend(const uchar *data, int dataLen, UdpIpAddress ip, int { // simulating outgoing byte-rate, so queue it up for sending later UdpConnection *con = AddressGetConnection(ip, port); - if (con != NULL) + if (con != nullptr) { if (mParams.simulateDestinationOverloadLevel > 0 && con->mSimulateQueueBytes + dataLen > mParams.simulateDestinationOverloadLevel) return; // no room, packet gets lost @@ -919,17 +919,17 @@ void UdpManager::ActualSend(const uchar *data, int dataLen, UdpIpAddress ip, int if (mParams.simulateOutgoingOverloadLevel > 0 && mSimulateQueueBytes + dataLen > mParams.simulateOutgoingOverloadLevel) return; // no room, packet gets lost - if (con != NULL) + if (con != nullptr) con->mSimulateQueueBytes += dataLen; mSimulateQueueBytes += dataLen; SimulateQueueEntry *entry = new SimulateQueueEntry(data, dataLen, ip, port); - if (mSimulateQueueStart != NULL) + if (mSimulateQueueStart != nullptr) mSimulateQueueEnd->mNext = entry; else mSimulateQueueStart = entry; mSimulateQueueEnd = entry; - mSimulateQueueEnd->mNext = NULL; + mSimulateQueueEnd->mNext = nullptr; return; } ActualSendHelper(data, dataLen, ip, port); @@ -952,7 +952,7 @@ void UdpManager::ActualSendHelper(const uchar *data, int dataLen, UdpIpAddress i // flag connection to terminate itself for port-unreachable error on next give time // we need to flag it instead of actually terminating it to prevent callbacks from occuring during application sends UdpConnection *con = AddressGetConnection(ip, port); - if (con != NULL) + if (con != nullptr) con->FlagPortUnreachable(); return; } @@ -990,7 +990,7 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) UdpConnection *con = AddressGetConnection(e->mIp, e->mPort); - if (con == NULL) + if (con == nullptr) { // packet coming from an unknown ip/port // if it is a connection request packet, then establish a new connection object to reply to it @@ -1003,7 +1003,7 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) int protocolVersion = UdpMisc::GetValue32(e->mBuffer + 2); if (protocolVersion == cProtocolVersion) { - if (mParams.handler != NULL) + if (mParams.handler != nullptr) { UdpConnection *newcon = new UdpConnection(this, e); mParams.handler->OnConnectRequest(newcon); @@ -1032,7 +1032,7 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) int encryptCode = UdpMisc::GetValue32(ptr); UdpConnection *con = ConnectCodeGetConnection(connectCode); - if (con != NULL) + if (con != nullptr) { if (mParams.allowAddressRemapping || con->mIp == e->mIp) { @@ -1082,25 +1082,25 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) UdpConnection *UdpManager::AddressGetConnection(UdpIpAddress ip, int port) const { UdpConnection *found = static_cast(mAddressHashTable->FindFirst(AddressHashValue(ip, port))); - while (found != NULL) + while (found != nullptr) { if (found->mIp == ip && found->mPort == port) return(found); found = static_cast(mAddressHashTable->FindNext(found)); } - return(NULL); + return(nullptr); } UdpConnection *UdpManager::ConnectCodeGetConnection(int connectCode) const { UdpConnection *found = static_cast(mConnectCodeHashTable->FindFirst(connectCode)); - while (found != NULL) + while (found != nullptr) { if (found->mConnectCode == connectCode) return(found); found = static_cast(mConnectCodeHashTable->FindNext(found)); } - return(NULL); + return(nullptr); } WrappedLogicalPacket *UdpManager::WrappedBorrow(const LogicalPacket *lp) @@ -1124,7 +1124,7 @@ WrappedLogicalPacket *UdpManager::WrappedBorrow(const LogicalPacket *lp) void UdpManager::WrappedCreated(WrappedLogicalPacket *wp) { wp->mCreatedNext = mWrappedCreatedRoot; - if (mWrappedCreatedRoot != NULL) + if (mWrappedCreatedRoot != nullptr) mWrappedCreatedRoot->mCreatedPrev = wp; mWrappedCreatedRoot = wp; mWrappedCreated++; @@ -1132,11 +1132,11 @@ void UdpManager::WrappedCreated(WrappedLogicalPacket *wp) void UdpManager::WrappedDestroyed(WrappedLogicalPacket *wp) { - if (wp->mCreatedNext != NULL) + if (wp->mCreatedNext != nullptr) { wp->mCreatedNext->mCreatedPrev = wp->mCreatedPrev; } - if (wp->mCreatedPrev != NULL) + if (wp->mCreatedPrev != nullptr) { wp->mCreatedPrev->mCreatedNext = wp->mCreatedNext; } @@ -1146,9 +1146,9 @@ void UdpManager::WrappedDestroyed(WrappedLogicalPacket *wp) mWrappedCreatedRoot = wp->mCreatedNext; } - wp->mCreatedPrev = NULL; - wp->mCreatedNext = NULL; - wp->mUdpManager = NULL; + wp->mCreatedPrev = nullptr; + wp->mCreatedNext = nullptr; + wp->mUdpManager = nullptr; mWrappedCreated--; } @@ -1183,7 +1183,7 @@ LogicalPacket *UdpManager::CreatePacket(const void *data, int dataLen, const voi void UdpManager::PoolCreated(PooledLogicalPacket *packet) { packet->mCreatedNext = mPoolCreatedRoot; - if (mPoolCreatedRoot != NULL) + if (mPoolCreatedRoot != nullptr) mPoolCreatedRoot->mCreatedPrev = packet; mPoolCreatedRoot = packet; mPoolCreated++; @@ -1191,11 +1191,11 @@ void UdpManager::PoolCreated(PooledLogicalPacket *packet) void UdpManager::PoolDestroyed(PooledLogicalPacket *packet) { - if (packet->mCreatedNext != NULL) + if (packet->mCreatedNext != nullptr) { packet->mCreatedNext->mCreatedPrev = packet->mCreatedPrev; } - if (packet->mCreatedPrev != NULL) + if (packet->mCreatedPrev != nullptr) { packet->mCreatedPrev->mCreatedNext = packet->mCreatedNext; } @@ -1205,9 +1205,9 @@ void UdpManager::PoolDestroyed(PooledLogicalPacket *packet) mPoolCreatedRoot = packet->mCreatedNext; } - packet->mCreatedPrev = NULL; - packet->mCreatedNext = NULL; - packet->mUdpManager = NULL; + packet->mCreatedPrev = nullptr; + packet->mCreatedNext = nullptr; + packet->mUdpManager = nullptr; mPoolCreated--; } @@ -1282,7 +1282,7 @@ void UdpConnection::Init(UdpManager *udpManager, UdpIpAddress destIp, int destPo mLastClockSyncTime = 0; mDataHoldTime = 0; mGettingTime = false; - mHandler = NULL; + mHandler = nullptr; mNoDataTimeout = mUdpManager->mParams.noDataTimeout; mKeepAliveDelay = mUdpManager->mParams.keepAliveDelay; @@ -1290,13 +1290,13 @@ void UdpConnection::Init(UdpManager *udpManager, UdpIpAddress destIp, int destPo mMultiBufferData = new uchar[mUdpManager->mParams.maxRawPacketSize]; mMultiBufferPtr = mMultiBufferData; - mDisconnectPendingNextConnection = NULL; - mNextConnection = NULL; - mPrevConnection = NULL; + mDisconnectPendingNextConnection = nullptr; + mNextConnection = nullptr; + mPrevConnection = nullptr; mIcmpErrorRetryStartStamp = 0; // when the timer started for ICMP error retry delay (gets reset on a successful packet receive) mPortRemapRequestStartStamp = 0; - mEncryptXorBuffer = NULL; + mEncryptXorBuffer = nullptr; mEncryptExpansionBytes = 0; mOrderedCountOutgoing = 0; mOrderedCountOutgoing2 = 0; @@ -1307,7 +1307,7 @@ void UdpConnection::Init(UdpManager *udpManager, UdpIpAddress destIp, int destPo mConnectionCreateTime = UdpMisc::Clock(); mSimulateQueueBytes = 0; - mPassThroughData = NULL; + mPassThroughData = nullptr; mSilentDisconnect = false; mLastSendBin = 0; @@ -1325,7 +1325,7 @@ void UdpConnection::Init(UdpManager *udpManager, UdpIpAddress destIp, int destPo UdpConnection::~UdpConnection() { - if (mUdpManager != NULL) + if (mUdpManager != nullptr) InternalDisconnect(0, mDisconnectReason); for (int i = 0; i < UdpManager::cReliableChannelCount; i++) @@ -1372,7 +1372,7 @@ void UdpConnection::InternalDisconnect(int flushTimeout, DisconnectReason reason if (mStatus == cStatusNegotiating) flushTimeout = 0; - if (mUdpManager != NULL) + if (mUdpManager != nullptr) { if (flushTimeout > 0) { @@ -1402,13 +1402,13 @@ void UdpConnection::InternalDisconnect(int flushTimeout, DisconnectReason reason } mUdpManager->RemoveConnection(this); - mUdpManager = NULL; + mUdpManager = nullptr; } mStatus = cStatusDisconnected; - if (startStatus != cStatusDisconnected && startUdpManager != NULL) + if (startStatus != cStatusDisconnected && startUdpManager != nullptr) { - if (mHandler != NULL) + if (mHandler != nullptr) mHandler->OnTerminated(this); } } @@ -1442,7 +1442,7 @@ bool UdpConnection::Send(UdpChannel channel, const void *data, int dataLen) if (dataLen == 0) // zero length packets are ignored return(false); - assert(data != NULL); // can't send a null packet + assert(data != nullptr); // can't send a nullptr packet mUdpManager->mManagerStats.applicationPacketsSent++; mConnectionStats.applicationPacketsSent++; @@ -1459,7 +1459,7 @@ bool UdpConnection::Send(UdpChannel channel, const void *data, int dataLen) bool UdpConnection::Send(UdpChannel channel, const LogicalPacket *packet) { - assert(packet != NULL); // can't send a null packet + assert(packet != nullptr); // can't send a nullptr packet assert(channel >= 0 && channel < cUdpChannelCount); assert(mStatus != cStatusNegotiating); // you are not allowed to start sending data on a connection that is still in the process of negotiating (only applicable client-side obviously since servers never have connections in this state) @@ -1505,7 +1505,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const uchar *data, int data { uchar *bufPtr = tempBuffer; memcpy(bufPtr, data, dataLen); - if (data2 != NULL) + if (data2 != nullptr) memcpy(bufPtr + dataLen, data2, dataLen2); PhysicalSend(bufPtr, totalDataLen, true); return(true); @@ -1518,9 +1518,9 @@ bool UdpConnection::InternalSend(UdpChannel channel, const uchar *data, int data bufPtr[1] = cUdpPacketOrdered2; UdpMisc::PutValue16(bufPtr + 2, (ushort)(++mOrderedCountOutgoing2 & 0xffff)); memcpy(bufPtr + 4, data, dataLen); - if (data2 != NULL) + if (data2 != nullptr) memcpy(bufPtr + 4 + dataLen, data2, dataLen2); - BufferedSend(bufPtr, totalDataLen + 4, NULL, 0, true); + BufferedSend(bufPtr, totalDataLen + 4, nullptr, 0, true); return(true); break; } @@ -1531,7 +1531,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const uchar *data, int data bufPtr[1] = cUdpPacketOrdered2; UdpMisc::PutValue16(bufPtr + 2, (ushort)(++mOrderedCountOutgoing2 & 0xffff)); memcpy(bufPtr + 4, data, dataLen); - if (data2 != NULL) + if (data2 != nullptr) memcpy(bufPtr + 4 + dataLen, data2, dataLen2); PhysicalSend(bufPtr, totalDataLen + 4, true); return(true); @@ -1543,7 +1543,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const uchar *data, int data case cUdpChannelReliable4: { int num = channel - cUdpChannelReliable1; - if (mChannel[num] == NULL) + if (mChannel[num] == nullptr) mChannel[num] = new UdpReliableChannel(num, this, &mUdpManager->mParams.reliable[num]); mChannel[num]->Send(data, dataLen, data2, dataLen2); return(true); @@ -1565,7 +1565,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const LogicalPacket *packet case cUdpChannelReliable4: { int num = channel - cUdpChannelReliable1; - if (mChannel[num] == NULL) + if (mChannel[num] == nullptr) mChannel[num] = new UdpReliableChannel(num, this, &mUdpManager->mParams.reliable[num]); mChannel[num]->Send(packet); return(true); @@ -1605,9 +1605,9 @@ void UdpConnection::PingStatReset() void UdpConnection::GetStats(UdpConnectionStatistics *cs) const { - assert(cs != NULL); + assert(cs != nullptr); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; *cs = mConnectionStats; @@ -1623,13 +1623,13 @@ void UdpConnection::GetStats(UdpConnectionStatistics *cs) const if (cs->syncTheirSent > 0) cs->percentReceivedSuccess = (float)cs->syncOurReceived / (float)cs->syncTheirSent; cs->reliableAveragePing = 0; - if (mChannel[0] != NULL) + if (mChannel[0] != nullptr) cs->reliableAveragePing = mChannel[0]->GetAveragePing(); } void UdpConnection::ProcessRawPacket(const UdpManager::PacketHistoryEntry *e) { - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; if (e->mBuffer[0] != 0 || e->mBuffer[1] != cUdpPacketUnreachableConnection) @@ -1731,7 +1731,7 @@ void UdpConnection::ProcessRawPacket(const UdpManager::PacketHistoryEntry *e) { mConnectionStats.crcRejectedPackets++; mUdpManager->mManagerStats.crcRejectedPackets++; - if (mHandler != NULL) + if (mHandler != nullptr) mHandler->OnCrcReject(this, e->mBuffer, e->mLen); return; } @@ -1792,7 +1792,7 @@ void UdpConnection::CallbackRoutePacket(const uchar *data, int dataLen) mUdpManager->mManagerStats.applicationPacketsReceived++; mConnectionStats.applicationPacketsReceived++; - if (mHandler != NULL) + if (mHandler != nullptr) mHandler->OnRoutePacket(this, data, dataLen); } } @@ -1801,7 +1801,7 @@ void UdpConnection::CallbackCorruptPacket(const uchar *data, int dataLen, UdpCor { mConnectionStats.corruptPacketErrors++; mUdpManager->mManagerStats.corruptPacketErrors++; - if (mHandler != NULL) + if (mHandler != nullptr) mHandler->OnPacketCorrupt(this, data, dataLen, reason); } @@ -1809,7 +1809,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) { uchar buf[256]; uchar *bufPtr; - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; if (data[0] == 0 && dataLen > 1) @@ -1882,7 +1882,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) mConnectionConfig = config; SetupEncryptModel(); mStatus = cStatusConnected; - if (mHandler != NULL) + if (mHandler != nullptr) mHandler->OnConnectComplete(this); } break; @@ -2112,7 +2112,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) case cUdpPacketFragment4: { int num = (data[1] - cUdpPacketReliable1) % UdpManager::cReliableChannelCount; - if (mChannel[num] == NULL) + if (mChannel[num] == nullptr) mChannel[num] = new UdpReliableChannel(num, this, &mUdpManager->mParams.reliable[num]); mChannel[num]->ReliablePacket(data, dataLen); break; @@ -2123,7 +2123,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) case cUdpPacketAck4: { int num = data[1] - cUdpPacketAck1; - if (mChannel[num] != NULL) + if (mChannel[num] != nullptr) mChannel[num]->AckPacket(data, dataLen); break; } @@ -2133,7 +2133,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) case cUdpPacketAckAll4: { int num = data[1] - cUdpPacketAckAll1; - if (mChannel[num] != NULL) + if (mChannel[num] != nullptr) mChannel[num]->AckAllPacket(data, dataLen); break; } @@ -2173,7 +2173,7 @@ void UdpConnection::FlagPortUnreachable() void UdpConnection::GiveTime() { - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; UdpManager *myManager = mUdpManager; @@ -2266,11 +2266,11 @@ void UdpConnection::InternalGiveTime() int totalPendingBytes = 0; for (int i = 0; i < UdpManager::cReliableChannelCount; i++) { - if (mChannel[i] != NULL) + if (mChannel[i] != nullptr) { totalPendingBytes += mChannel[i]->TotalPendingBytes(); int myNext = mChannel[i]->GiveTime(); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; // giving the reliable channel time caused it to callback the application which may disconnect us nextSchedule = udpMin(nextSchedule, myNext); } @@ -2359,7 +2359,7 @@ void UdpConnection::InternalGiveTime() break; } - if (mUdpManager != NULL) + if (mUdpManager != nullptr) { // safety to prevent us for scheduling ourselves for a time period that has already passed, // as doing so could result in infinite looping in the priority queue processing. @@ -2376,7 +2376,7 @@ int UdpConnection::TotalPendingBytes() const int total = 0; for (int i = 0; i < UdpManager::cReliableChannelCount; i++) { - if (mChannel[i] != NULL) + if (mChannel[i] != nullptr) total += mChannel[i]->TotalPendingBytes(); } return(total); @@ -2442,7 +2442,7 @@ int UdpConnection::ExpireReceiveBin() void UdpConnection::PhysicalSend(const uchar *data, int dataLen, bool appendAllowed) { - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; // if we attempt to do a physical send (ie. encrypt/compress/crc a packet) while we are not connected @@ -2540,8 +2540,8 @@ void UdpConnection::PhysicalSend(const uchar *data, int dataLen, bool appendAllo // function can do its job uchar *UdpConnection::BufferedSend(const uchar *data, int dataLen, const uchar *data2, int dataLen2, bool appendAllowed) { - if (mUdpManager == NULL) - return(NULL); + if (mUdpManager == nullptr) + return(nullptr); int used = mMultiBufferPtr - mMultiBufferData; int actualMaxDataHoldSize = udpMin(mUdpManager->mParams.maxDataHoldSize, mConnectionConfig.maxRawPacketSize); @@ -2556,7 +2556,7 @@ uchar *UdpConnection::BufferedSend(const uchar *data, int dataLen, const uchar * FlushMultiBuffer(); // now send it (the multi-buffer is empty if you need to use it temporarily to concatenate two data chunks -- it is large enough to hold the largest raw packet) - if (data2 != NULL) + if (data2 != nullptr) { memcpy(mMultiBufferData, data, dataLen); memcpy(mMultiBufferData + dataLen, data2, dataLen2); @@ -2564,7 +2564,7 @@ uchar *UdpConnection::BufferedSend(const uchar *data, int dataLen, const uchar * } else PhysicalSend(data, dataLen, appendAllowed); - return(NULL); + return(nullptr); } // if this data will not fit into buffer @@ -2592,7 +2592,7 @@ uchar *UdpConnection::BufferedSend(const uchar *data, int dataLen, const uchar * uchar *placementPtr = mMultiBufferPtr; memcpy(mMultiBufferPtr, data, dataLen); mMultiBufferPtr += dataLen; - if (data2 != NULL) + if (data2 != nullptr) { memcpy(mMultiBufferPtr, data2, dataLen2); mMultiBufferPtr += dataLen2; @@ -2601,21 +2601,21 @@ uchar *UdpConnection::BufferedSend(const uchar *data, int dataLen, const uchar * if ((mMultiBufferPtr - mMultiBufferData) >= actualMaxDataHoldSize) { FlushMultiBuffer(); - placementPtr = NULL; // it got flushed + placementPtr = nullptr; // it got flushed } return(placementPtr); } uchar *UdpConnection::InternalAckSend(uchar *bufferedAckPtr, const uchar *ackPtr, int ackLen) { - if (bufferedAckPtr != NULL) + if (bufferedAckPtr != nullptr) { memcpy(bufferedAckPtr, ackPtr, ackLen); return(bufferedAckPtr); } - BufferedSend(ackPtr, ackLen, NULL, 0, false); - return(NULL); // FIX THIS + BufferedSend(ackPtr, ackLen, nullptr, 0, false); + return(nullptr); // FIX THIS } void UdpConnection::FlushMultiBuffer() @@ -2631,7 +2631,7 @@ void UdpConnection::FlushMultiBuffer() // notify all the reliable channels to clear their buffered acks for (int i = 0; i < UdpManager::cReliableChannelCount; i++) { - if (mChannel[i] != NULL) + if (mChannel[i] != nullptr) { mChannel[i]->ClearBufferedAck(); } @@ -2656,7 +2656,7 @@ int UdpConnection::DecryptNone(uchar *destData, const uchar *sourceData, int sou int UdpConnection::EncryptUserSupplied(uchar *destData, const uchar *sourceData, int sourceLen) { UdpManagerHandler *manHandler = mUdpManager->GetHandler(); - if (manHandler != NULL) + if (manHandler != nullptr) return(manHandler->OnUserSuppliedEncrypt(this, destData, sourceData, sourceLen)); assert(0); // if user-supplied encryption is specified, then you must have a manager handler installed to provide the routines return(0); @@ -2665,7 +2665,7 @@ int UdpConnection::EncryptUserSupplied(uchar *destData, const uchar *sourceData, int UdpConnection::DecryptUserSupplied(uchar *destData, const uchar *sourceData, int sourceLen) { UdpManagerHandler *manHandler = mUdpManager->GetHandler(); - if (manHandler != NULL) + if (manHandler != nullptr) return(manHandler->OnUserSuppliedDecrypt(this, destData, sourceData, sourceLen)); assert(0); // if user-supplied encryption is specified, then you must have a manager handler installed to provide the routines return(0); @@ -2674,7 +2674,7 @@ int UdpConnection::DecryptUserSupplied(uchar *destData, const uchar *sourceData, int UdpConnection::EncryptUserSupplied2(uchar *destData, const uchar *sourceData, int sourceLen) { UdpManagerHandler *manHandler = mUdpManager->GetHandler(); - if (manHandler != NULL) + if (manHandler != nullptr) return(manHandler->OnUserSuppliedEncrypt2(this, destData, sourceData, sourceLen)); assert(0); // if user-supplied encryption is specified, then you must have a manager handler installed to provide the routines return(0); @@ -2683,7 +2683,7 @@ int UdpConnection::EncryptUserSupplied2(uchar *destData, const uchar *sourceData int UdpConnection::DecryptUserSupplied2(uchar *destData, const uchar *sourceData, int sourceLen) { UdpManagerHandler *manHandler = mUdpManager->GetHandler(); - if (manHandler != NULL) + if (manHandler != nullptr) return(manHandler->OnUserSuppliedDecrypt2(this, destData, sourceData, sourceLen)); assert(0); // if user-supplied encryption is specified, then you must have a manager handler installed to provide the routines return(0); @@ -2833,7 +2833,7 @@ void UdpConnection::SetupEncryptModel() mEncryptExpansionBytes += 0; // set up encrypt buffer (random numbers generated based on seed) - if (mEncryptXorBuffer == NULL) + if (mEncryptXorBuffer == nullptr) { int len = ((mUdpManager->mParams.maxRawPacketSize + 1) / 4) * 4; mEncryptXorBuffer = new uchar[len]; @@ -2865,7 +2865,7 @@ void UdpConnection::GetChannelStatus(UdpChannel channel, ChannelStatus *channelS case cUdpChannelReliable2: case cUdpChannelReliable3: case cUdpChannelReliable4: - if (mChannel[channel - cUdpChannelReliable1] != NULL) + if (mChannel[channel - cUdpChannelReliable1] != nullptr) { mChannel[channel - cUdpChannelReliable1]->GetChannelStatus(channelStatus); } @@ -2941,12 +2941,12 @@ UdpReliableChannel::UdpReliableChannel(int channelNumber, UdpConnection *con, Ud mLogicalPacketsQueued = 0; mLogicalBytesQueued = 0; - mCoalescePacket = NULL; - mCoalesceStartPtr = NULL; - mCoalesceEndPtr = NULL; + mCoalescePacket = nullptr; + mCoalesceStartPtr = nullptr; + mCoalesceEndPtr = nullptr; mCoalesceCount = 0; - mBufferedAckPtr = NULL; + mBufferedAckPtr = nullptr; mStatDuplicatePacketsReceived = 0; mStatResentPacketsAccelerated = 0; @@ -2960,7 +2960,7 @@ UdpReliableChannel::UdpReliableChannel(int channelNumber, UdpConnection *con, Ud mBigDataLen = 0; mBigDataTargetLen = 0; - mBigDataPtr = NULL; + mBigDataPtr = nullptr; mFragmentNextPos = 0; mLastTimeStampAcknowledged = 0; mMaxxedOutCurrentWindow = false; @@ -2969,23 +2969,23 @@ UdpReliableChannel::UdpReliableChannel(int channelNumber, UdpConnection *con, Ud mPhysicalPackets = new PhysicalPacket[mConfig.maxOutstandingPackets]; mReliableIncoming = new IncomingQueueEntry[mConfig.maxInstandingPackets]; - mLogicalRoot = NULL; - mLogicalEnd = NULL; + mLogicalRoot = nullptr; + mLogicalEnd = nullptr; } UdpReliableChannel::~UdpReliableChannel() { - if (mCoalescePacket != NULL) + if (mCoalescePacket != nullptr) { mCoalescePacket->Release(); - mCoalescePacket = NULL; + mCoalescePacket = nullptr; } const LogicalPacket *cur = mLogicalRoot; - while (cur != NULL) + while (cur != nullptr) { const LogicalPacket *next = cur->mReliableQueueNext; - cur->mReliableQueueNext = NULL; // make sure and mark it available so others could possibly use it (if it is a shared logical packet) + cur->mReliableQueueNext = nullptr; // make sure and mark it available so others could possibly use it (if it is a shared logical packet) cur->Release(); if (cur == next) // pointing to self, so this is end of list break; @@ -3052,7 +3052,7 @@ void UdpReliableChannel::Send(const LogicalPacket *packet) void UdpReliableChannel::FlushCoalesce() { - if (mCoalescePacket != NULL) + if (mCoalescePacket != nullptr) { if (mCoalesceCount == 1) { @@ -3069,16 +3069,16 @@ void UdpReliableChannel::FlushCoalesce() } mCoalescePacket->Release(); - mCoalescePacket = NULL; + mCoalescePacket = nullptr; } } void UdpReliableChannel::SendCoalesce(const uchar *data, int dataLen, const uchar *data2, int dataLen2) { int totalLen = dataLen + dataLen2; - if (mCoalescePacket == NULL) + if (mCoalescePacket == nullptr) { - mCoalescePacket = mUdpConnection->mUdpManager->CreatePacket(NULL, mMaxDataBytes); + mCoalescePacket = mUdpConnection->mUdpManager->CreatePacket(nullptr, mMaxDataBytes); mCoalesceEndPtr = mCoalesceStartPtr = (uchar *)mCoalescePacket->GetDataPtr(); *mCoalesceEndPtr++ = 0; *mCoalesceEndPtr++ = UdpConnection::cUdpPacketGroup; @@ -3098,10 +3098,10 @@ void UdpReliableChannel::SendCoalesce(const uchar *data, int dataLen, const ucha // append on end of coalesce mCoalesceCount++; mCoalesceEndPtr += UdpMisc::PutVariableValue(mCoalesceEndPtr, totalLen); - if (data != NULL) + if (data != nullptr) memcpy(mCoalesceEndPtr, data, dataLen); mCoalesceEndPtr += dataLen; - if (data2 != NULL) + if (data2 != nullptr) memcpy(mCoalesceEndPtr, data2, dataLen2); mCoalesceEndPtr += dataLen2; } @@ -3111,7 +3111,7 @@ void UdpReliableChannel::QueueLogicalPacket(const LogicalPacket *packet) mLogicalPacketsQueued++; mLogicalBytesQueued += packet->GetDataLen(); - if (packet->mReliableQueueNext != NULL) + if (packet->mReliableQueueNext != nullptr) { packet = mUdpConnection->mUdpManager->WrappedBorrow(packet); } @@ -3121,13 +3121,13 @@ void UdpReliableChannel::QueueLogicalPacket(const LogicalPacket *packet) } packet->mReliableQueueNext = packet; // have it point to itself to signify that the mNext pointer is taken (ie. reserve it), yet still represents the end of the list - if (mLogicalEnd != NULL) + if (mLogicalEnd != nullptr) { mLogicalEnd->mReliableQueueNext = packet; } mLogicalEnd = packet; - if (mLogicalRoot == NULL) + if (mLogicalRoot == nullptr) { mLogicalRoot = packet; } @@ -3148,10 +3148,10 @@ bool UdpReliableChannel::PullDown(int windowSpaceLeft) int physicalCount = (int)(mReliableOutgoingId - mReliableOutgoingPendingId); while (windowSpaceLeft > 0 && physicalCount < mConfig.maxOutstandingPackets) { - if (mLogicalRoot == NULL) + if (mLogicalRoot == nullptr) { FlushCoalesce(); // this is guaranteed to stick - if (mLogicalRoot == NULL) + if (mLogicalRoot == nullptr) break; // nothing flushed, so we are done } @@ -3191,10 +3191,10 @@ bool UdpReliableChannel::PullDown(int windowSpaceLeft) mLogicalRoot = mLogicalRoot->mReliableQueueNext; if (mLogicalRoot == lp) // ie, we were pointing to ourself, meaning we were the end of the list { - mLogicalRoot = NULL; - mLogicalEnd = NULL; + mLogicalRoot = nullptr; + mLogicalEnd = nullptr; } - lp->mReliableQueueNext = NULL; // clear our next link since we are no longer using it (so somebody else can use it potentially) + lp->mReliableQueueNext = nullptr; // clear our next link since we are no longer using it (so somebody else can use it potentially) lp->Release(); // release from logical queue } else @@ -3249,9 +3249,9 @@ int UdpReliableChannel::GiveTime() // this next branch was replaced by JeffP in the latest UdpLibrary drop. Please integrate // that. If something catestrophic happens with reliable channels, uncomment this next line to // replace the existing branch - //if (mReliableOutgoingId < mReliableOutgoingPendingId || mLogicalRoot != NULL || mCoalescePacket != NULL) + //if (mReliableOutgoingId < mReliableOutgoingPendingId || mLogicalRoot != nullptr || mCoalescePacket != nullptr) - if (mReliableOutgoingPendingId < mReliableOutgoingId || mLogicalRoot != NULL || mCoalescePacket != NULL) + if (mReliableOutgoingPendingId < mReliableOutgoingId || mLogicalRoot != nullptr || mCoalescePacket != nullptr) { // first, let's calculate how many bytes we figure is outstanding based on who is still waiting for an ack-packet UdpMisc::ClockStamp oldestResendTime = udpMax(hotClock - optimalResendDelay, mLastTimeStampAcknowledged); // anything older than this, we need to resend @@ -3276,7 +3276,7 @@ int UdpReliableChannel::GiveTime() // if this packet has not been acked and it is NOT ready to be sent (was recently sent) then we consider it outstanding // note: packets needing re-sending probably got lost and are therefore not outstanding PhysicalPacket *entry = &mPhysicalPackets[i % mConfig.maxOutstandingPackets]; - if (entry->mDataPtr != NULL) // acked packets set the dataPtr to NULL + if (entry->mDataPtr != nullptr) // acked packets set the dataPtr to nullptr { // if this packet is ready to be sent (ie: needs time now, or some later packet has already been ack'ed) windowSpaceLeft -= entry->mDataLen; // window-space is effectively taken whether we have sent it yet or not @@ -3436,7 +3436,7 @@ int UdpReliableChannel::GiveTime() void UdpReliableChannel::GetChannelStatus(UdpConnection::ChannelStatus *channelStatus) const { int coalesceBytes = 0; - if (mCoalescePacket != NULL) + if (mCoalescePacket != nullptr) coalesceBytes = mCoalesceEndPtr - mCoalesceStartPtr; channelStatus->totalPendingBytes = mLogicalBytesQueued + mReliableOutgoingBytes + coalesceBytes; @@ -3497,7 +3497,7 @@ void UdpReliableChannel::ReliablePacket(const uchar *data, int dataLen) mReliableIncomingId++; // process other packets that have arrived - while (mReliableIncoming[mReliableIncomingId % mConfig.maxInstandingPackets].mPacket != NULL) + while (mReliableIncoming[mReliableIncomingId % mConfig.maxInstandingPackets].mPacket != nullptr) { int spot = (int)(mReliableIncomingId % mConfig.maxInstandingPackets); if (mReliableIncoming[spot].mMode != cReliablePacketModeDelivered) @@ -3506,7 +3506,7 @@ void UdpReliableChannel::ReliablePacket(const uchar *data, int dataLen) } mReliableIncoming[spot].mPacket->Release(); - mReliableIncoming[spot].mPacket = NULL; + mReliableIncoming[spot].mPacket = nullptr; mReliableIncomingId++; } } @@ -3514,7 +3514,7 @@ void UdpReliableChannel::ReliablePacket(const uchar *data, int dataLen) { // not the one we need next, but it is later than the one we need , so store it in our buffer until it's turn comes up int spot = (int)(reliableId % mConfig.maxInstandingPackets); - if (mReliableIncoming[spot].mPacket == NULL) // only make the copy of it if we don't already have it in our buffer (in cases where it was sent twice, there would be no harm in the copy again since it must be the same packet, it's just inefficient) + if (mReliableIncoming[spot].mPacket == nullptr) // only make the copy of it if we don't already have it in our buffer (in cases where it was sent twice, there would be no harm in the copy again since it must be the same packet, it's just inefficient) { mReliableIncoming[spot].mMode = mode; mReliableIncoming[spot].mPacket = mUdpConnection->mUdpManager->CreatePacket(data + UdpConnection::cUdpPacketReliableSize, dataLen - UdpConnection::cUdpPacketReliableSize); @@ -3556,16 +3556,16 @@ void UdpReliableChannel::ReliablePacket(const uchar *data, int dataLen) // a simple ack for us only *bufPtr++ = (uchar)(UdpConnection::cUdpPacketAck1 + mChannelNumber); bufPtr += UdpMisc::PutValue16(bufPtr, (ushort)(reliableId & 0xffff)); - mBufferedAckPtr = NULL; // not allowed to replace an old one with a selective-ack + mBufferedAckPtr = nullptr; // not allowed to replace an old one with a selective-ack } - if (mBufferedAckPtr != NULL && mConfig.ackDeduping) + if (mBufferedAckPtr != nullptr && mConfig.ackDeduping) { memcpy(mBufferedAckPtr, buf, bufPtr - buf); } else { - mBufferedAckPtr = mUdpConnection->BufferedSend(buf, bufPtr - buf, NULL, 0, true); // safe to append on our data, it is stack data + mBufferedAckPtr = mUdpConnection->BufferedSend(buf, bufPtr - buf, nullptr, 0, true); // safe to append on our data, it is stack data } } @@ -3582,7 +3582,7 @@ void UdpReliableChannel::ProcessPacket(ReliablePacketMode mode, const uchar *dat else if (mode == cReliablePacketModeFragment) { // append onto end of big packet (or create new big packet if not existing already) - if (mBigDataPtr == NULL) + if (mBigDataPtr == nullptr) { mBigDataTargetLen = UdpMisc::GetValue32(data); // first fragment has a total-length int header on it. mBigDataPtr = new uchar[mBigDataTargetLen]; @@ -3611,7 +3611,7 @@ void UdpReliableChannel::ProcessPacket(ReliablePacketMode mode, const uchar *dat delete[] mBigDataPtr; mBigDataLen = 0; mBigDataTargetLen = 0; - mBigDataPtr = NULL; + mBigDataPtr = nullptr; } } } @@ -3641,7 +3641,7 @@ void UdpReliableChannel::Ack(udp_int64 reliableId) int pos = (int)(reliableId % mConfig.maxOutstandingPackets); PhysicalPacket *entry = &mPhysicalPackets[pos]; - if (entry->mDataPtr != NULL) // if this packet has not been acknowledged yet (sometimes we get back two acks for the same packet) + if (entry->mDataPtr != nullptr) // if this packet has not been acknowledged yet (sometimes we get back two acks for the same packet) { mNextNeedTime = 0; // something got acked, so we actually need to take the time next time it is offered @@ -3699,14 +3699,14 @@ void UdpReliableChannel::Ack(udp_int64 reliableId) // this packet we have queued has been acknowledged, so delete it from queue mReliableOutgoingBytes -= entry->mDataLen; entry->mDataLen = 0; - entry->mDataPtr = NULL; + entry->mDataPtr = nullptr; entry->mParent->Release(); - entry->mParent = NULL; + entry->mParent = nullptr; // advance the pending ptr until it reaches outgoingId or an entry that has yet to acknowledged while (mReliableOutgoingPendingId < mReliableOutgoingId) { - if (mPhysicalPackets[mReliableOutgoingPendingId % mConfig.maxOutstandingPackets].mDataPtr != NULL) + if (mPhysicalPackets[mReliableOutgoingPendingId % mConfig.maxOutstandingPackets].mDataPtr != nullptr) break; mReliableOutgoingPendingId++; } @@ -3728,25 +3728,25 @@ void UdpReliableChannel::Ack(udp_int64 reliableId) UdpReliableChannel::IncomingQueueEntry::IncomingQueueEntry() { - mPacket = NULL; + mPacket = nullptr; mMode = UdpReliableChannel::cReliablePacketModeReliable; } UdpReliableChannel::IncomingQueueEntry::~IncomingQueueEntry() { - if (mPacket != NULL) + if (mPacket != nullptr) mPacket->Release(); } UdpReliableChannel::PhysicalPacket::PhysicalPacket() { - mParent = NULL; + mParent = nullptr; } UdpReliableChannel::PhysicalPacket::~PhysicalPacket() { - if (mParent != NULL) + if (mParent != nullptr) mParent->Release(); } @@ -3758,7 +3758,7 @@ UdpReliableChannel::PhysicalPacket::~PhysicalPacket() LogicalPacket::LogicalPacket() { mRefCount = 1; - mReliableQueueNext = NULL; + mReliableQueueNext = nullptr; } LogicalPacket::~LogicalPacket() @@ -3793,7 +3793,7 @@ SimpleLogicalPacket::SimpleLogicalPacket(const void *data, int dataLen) { mDataLen = dataLen; mData = new uchar[mDataLen]; - if (data != NULL) + if (data != nullptr) memcpy(mData, data, mDataLen); } @@ -3828,7 +3828,7 @@ void SimpleLogicalPacket::SetDataLen(int len) GroupLogicalPacket::GroupLogicalPacket() : LogicalPacket() { mDataLen = 0; - mData = NULL; + mData = nullptr; } GroupLogicalPacket::~GroupLogicalPacket() @@ -3838,13 +3838,13 @@ GroupLogicalPacket::~GroupLogicalPacket() void GroupLogicalPacket::AddPacket(const LogicalPacket *packet) { - assert(packet != NULL); + assert(packet != nullptr); AddPacketInternal(packet->GetDataPtr(), packet->GetDataLen(), packet->IsInternalPacket()); } void GroupLogicalPacket::AddPacket(const void *data, int dataLen) { - assert(data != NULL); + assert(data != nullptr); assert(dataLen >= 0); AddPacketInternal(data, dataLen, false); } @@ -3910,16 +3910,16 @@ PooledLogicalPacket::PooledLogicalPacket(UdpManager *manager, int len) mDataLen = 0; mUdpManager = manager; - mAvailableNext = NULL; - mCreatedNext = NULL; - mCreatedPrev = NULL; + mAvailableNext = nullptr; + mCreatedNext = nullptr; + mCreatedPrev = nullptr; mUdpManager->PoolCreated(this); } PooledLogicalPacket::~PooledLogicalPacket() { - if (mUdpManager != NULL) + if (mUdpManager != nullptr) { mUdpManager->PoolDestroyed(this); } @@ -3934,7 +3934,7 @@ void PooledLogicalPacket::AddRef() const void PooledLogicalPacket::Release() const { - if (mRefCount == 1 && mUdpManager != NULL) + if (mRefCount == 1 && mUdpManager != nullptr) mUdpManager->PoolReturn(const_cast(this)); // if pool wants to keep us, it will inc our ref count, preventing our destruction // we cast off our const, as when we are added back to the pool, we can be modified LogicalPacket::Release(); @@ -3964,9 +3964,9 @@ void PooledLogicalPacket::SetDataLen(int len) void PooledLogicalPacket::SetData(const void *data, int dataLen, const void *data2, int dataLen2) { mDataLen = dataLen + dataLen2; - if (data != NULL) + if (data != nullptr) memcpy(mData, data, dataLen); - if (data2 != NULL) + if (data2 != nullptr) memcpy(mData + dataLen, data2, dataLen2); } @@ -3977,23 +3977,23 @@ void PooledLogicalPacket::SetData(const void *data, int dataLen, const void *dat /////////////////////////////////////////////////////////////////////////////////////////// WrappedLogicalPacket::WrappedLogicalPacket(UdpManager *udpManager) { - mPacket = NULL; + mPacket = nullptr; mUdpManager = udpManager; - mAvailableNext = NULL; - mCreatedNext = NULL; - mCreatedPrev = NULL; + mAvailableNext = nullptr; + mCreatedNext = nullptr; + mCreatedPrev = nullptr; mUdpManager->WrappedCreated(this); } WrappedLogicalPacket::~WrappedLogicalPacket() { - if (mUdpManager != NULL) + if (mUdpManager != nullptr) { mUdpManager->WrappedDestroyed(this); } - if (mPacket != NULL) + if (mPacket != nullptr) { mPacket->Release(); } @@ -4006,7 +4006,7 @@ void WrappedLogicalPacket::AddRef() const void WrappedLogicalPacket::Release() const { - if (mRefCount == 1 && mUdpManager != NULL) + if (mRefCount == 1 && mUdpManager != nullptr) mUdpManager->WrappedReturn(const_cast(this)); // if pool wants to keep us, it will inc our ref count, preventing our destruction // we cast off our const, as when we are added back to the pool, we can be modified LogicalPacket::Release(); @@ -4014,10 +4014,10 @@ void WrappedLogicalPacket::Release() const void WrappedLogicalPacket::SetLogicalPacket(const LogicalPacket *packet) { - if (mPacket != NULL) + if (mPacket != nullptr) mPacket->Release(); mPacket = packet; - if (mPacket != NULL) + if (mPacket != nullptr) mPacket->AddRef(); } @@ -4053,7 +4053,7 @@ UdpManager::SimulateQueueEntry::SimulateQueueEntry(const uchar *data, int dataLe memcpy(mData, data, dataLen); mIp = ip; mPort = port; - mNext = NULL; + mNext = nullptr; } UdpManager::SimulateQueueEntry::~SimulateQueueEntry() @@ -4088,7 +4088,7 @@ UdpMisc::ClockStamp UdpMisc::Clock() static ClockStamp sLastStamp = 0; static ClockStamp sCurrentCorrection = 0; struct timeval tv; - gettimeofday(&tv, NULL); + gettimeofday(&tv, nullptr); UdpMisc::ClockStamp cs = static_cast(tv.tv_sec) * 1000 + static_cast(tv.tv_usec / 1000); cs += sCurrentCorrection; if (cs < sLastStamp) @@ -4204,19 +4204,19 @@ void *UdpMisc::SmartResize(void *ptr, int bytes, int round) if (bytes == 0) { - if (ptr != NULL) + if (ptr != nullptr) { free((uchar *)ptr - cAlignment); } - return(NULL); + return(nullptr); } uchar *ptr2; - if (ptr == NULL) + if (ptr == nullptr) { ptr2 = (uchar *)malloc(bytes + cAlignment); - if (ptr2 == NULL) - return(NULL); + if (ptr2 == nullptr) + return(nullptr); *(int *)ptr2 = bytes; return(ptr2 + cAlignment); } @@ -4226,8 +4226,8 @@ void *UdpMisc::SmartResize(void *ptr, int bytes, int round) return(ptr); ptr2 = (uchar *)realloc((uchar *)ptr - cAlignment, bytes + cAlignment); - if (ptr2 == NULL) - return(NULL); + if (ptr2 == nullptr) + return(nullptr); *(int *)ptr2 = bytes; return(ptr2 + cAlignment); @@ -4290,30 +4290,30 @@ LogicalPacket *UdpMisc::CreateQuickLogicalPacket(const void *data, int dataLen, switch(q) { case 0: - tlp = new FixedLogicalPacket(NULL, totalDataLen); + tlp = new FixedLogicalPacket(nullptr, totalDataLen); break; case 1: - tlp = new FixedLogicalPacket(NULL, totalDataLen); + tlp = new FixedLogicalPacket(nullptr, totalDataLen); break; case 2: case 3: - tlp = new FixedLogicalPacket(NULL, totalDataLen); + tlp = new FixedLogicalPacket(nullptr, totalDataLen); break; case 4: case 5: case 6: case 7: - tlp = new FixedLogicalPacket(NULL, totalDataLen); + tlp = new FixedLogicalPacket(nullptr, totalDataLen); break; default: - tlp = new SimpleLogicalPacket(NULL, totalDataLen); + tlp = new SimpleLogicalPacket(nullptr, totalDataLen); break; } uchar *dest = (uchar *)tlp->GetDataPtr(); - if (data != NULL) + if (data != nullptr) memcpy(dest, data, dataLen); - if (data2 != NULL) + if (data2 != nullptr) memcpy(dest + dataLen, data2, dataLen2); return(tlp); } @@ -4327,7 +4327,7 @@ UdpIpAddress UdpMisc::GetHostByName(const char *hostName) { struct hostent * lphp; lphp = gethostbyname(hostName); - if (lphp == NULL) + if (lphp == nullptr) { address = 0; } diff --git a/external/3rd/library/udplibrary/UdpLibrary.hpp b/external/3rd/library/udplibrary/UdpLibrary.hpp index 43a20328..39f05a43 100644 --- a/external/3rd/library/udplibrary/UdpLibrary.hpp +++ b/external/3rd/library/udplibrary/UdpLibrary.hpp @@ -148,7 +148,7 @@ class UdpMisc // memory manager does a little bit of this, but if you know you have an allocation that is likely // to grow quite a bit, you can set the round'ing size up to a fairly large number and avoid // unnecessary reallocs at the cost of a little potentially wasted space - // initial allocations are done by passing in ptr==NULL, freeing is done by passing in bytes==0 + // initial allocations are done by passing in ptr==nullptr, freeing is done by passing in bytes==0 static void *SmartResize(void *ptr, int bytes, int round = 1); // the following two functions store values in the buffer as a variable length (B1, 0xffB2B1, 0xffffffB4B3B2B1) @@ -168,7 +168,7 @@ class UdpMisc static uint GetValue24(const void *buffer); // gets a 24-bit value from the buffer in big-endian format static ushort GetValue16(const void *buffer); // gets a 16-bit value from the buffer in big-endian format - static LogicalPacket *CreateQuickLogicalPacket(const void *data, int dataLen, const void *data2 = NULL, int dataLen2 = 0); + static LogicalPacket *CreateQuickLogicalPacket(const void *data, int dataLen, const void *data2 = nullptr, int dataLen2 = 0); // looks up the specified name and translates it to an IP address // this is a blocking call that can at times take a significant amount of time, but will generally be fast (less than 300ms) @@ -241,7 +241,7 @@ class LogicalPacket protected: friend class UdpReliableChannel; mutable const LogicalPacket *mReliableQueueNext; // owned/managed by the reliable channel object as an optimizations, do not touch - // NULL = unclaimed, point-to-self = claimed, but end of list + // nullptr = unclaimed, point-to-self = claimed, but end of list }; class SimpleLogicalPacket : public LogicalPacket @@ -250,7 +250,7 @@ class SimpleLogicalPacket : public LogicalPacket // it was originally created to allow the internal code to handle reliable data that was sent // via the Send(char *, int) api call. public: - SimpleLogicalPacket(const void *data, int dataLen); // data can be NULL if you want to populate it after it is allocated (get the pointer and write to it) + SimpleLogicalPacket(const void *data, int dataLen); // data can be nullptr if you want to populate it after it is allocated (get the pointer and write to it) virtual void *GetDataPtr(); virtual const void *GetDataPtr() const; virtual int GetDataLen() const; @@ -321,7 +321,7 @@ template class StructLogicalPacket : public LogicalPacket // with virtual functions) via this method as they may contain hidden data-members (such as pointers // to vtables). public: - StructLogicalPacket(T *initData = NULL); + StructLogicalPacket(T *initData = nullptr); virtual void *GetDataPtr(); virtual const void *GetDataPtr() const; virtual int GetDataLen() const; @@ -394,7 +394,7 @@ class PooledLogicalPacket : public LogicalPacket int mMaxDataLen; protected: friend class UdpManager; - void SetData(const void *data, int dataLen, const void *data2 = NULL, int dataLen2 = 0); + void SetData(const void *data, int dataLen, const void *data2 = nullptr, int dataLen2 = 0); UdpManager *mUdpManager; PooledLogicalPacket *mAvailableNext; PooledLogicalPacket *mCreatedNext; @@ -474,7 +474,7 @@ class UdpManager // pointer equal to your object and the UdpManager will call it as appropriate. The UdpConnection object // also has a handler mechanism that replaces the other callback functions below, see UdpConnection::SetHandler // if a handler is specified, the callback function is ignored, even if specified. - // default = NULL (not used) + // default = nullptr (not used) UdpManagerHandler *handler; // this is the maximum number of connections that can be established by this manager, any incoming/outgoing connections @@ -883,7 +883,7 @@ class UdpManager // will call EstablishConnection, then sit in a loop calling UdpManager::GiveTime and checking to see // if the status of the returned UdpConnection object is changed from cStatusNegotiating. This allows // the application to look for the ESC key or timeout an attempted connection. - // This function will return NULL if the manager object has exceeded its maximum number of connections + // This function will return nullptr if the manager object has exceeded its maximum number of connections // or if the serverAddress cannot be resolved to an IP address // as is noted in the declaration, it is the responsibility of the application establishing the connection to delete it // setting the timeout value (in milliseconds) to something greater than 0 will cause the UdpConnection object to change @@ -915,13 +915,13 @@ class UdpManager // manually forces all live connections to flush their multi buffers immediately void FlushAllMultiBuffer(); - // creates a logical packet and populates it with data. data can be NULL, in which case it gives you logical packet + // creates a logical packet and populates it with data. data can be nullptr, in which case it gives you logical packet // of the size specified, but copies no data into it. If you are using pool management (see Params::poolPacketMax), // it will give you a packet out of the pool if possible, otherwise it will create a packet for you. When logical // are packets are needed internally for various things (like reliable channel sends that use the (void *, int) interface) // they are gotten from this function, so your application can likely take advantage of pooling, even if it never bothers // to explicitly call this function. - LogicalPacket *CreatePacket(const void *data, int dataLen, const void *data2 = NULL, int dataLen2 = 0); + LogicalPacket *CreatePacket(const void *data, int dataLen, const void *data2 = nullptr, int dataLen2 = 0); protected: friend class PooledLogicalPacket; @@ -1147,7 +1147,7 @@ class UdpConnection : public PriorityQueueMember, public AddressHashTableMember, int ConnectionAge() const; // returns the UdpManager object that is managing this connection - // will return NULL if the connection has been disconnected for some reason (because disconnecting severes the link to UdpManager) + // will return nullptr if the connection has been disconnected for some reason (because disconnecting severes the link to UdpManager) UdpManager *GetUdpManager() const; // returns the 32-bit encryption-code that was negotiated as part of the connection-establishment process. @@ -1227,9 +1227,9 @@ class UdpConnection : public PriorityQueueMember, public AddressHashTableMember, friend class UdpManager; friend class UdpReliableChannel; - // note: if connectPacket is NULL, that means this connection object is being created to establish + // note: if connectPacket is nullptr, that means this connection object is being created to establish // a new connection to the specified ip/port (ie. the connection starts out in cStatusNegotiating mode) - // if connectPacket is non-NULL, that menas this connection object is being created to handle an + // if connectPacket is non-nullptr, that menas this connection object is being created to handle an // incoming connect request and it will start out in cStatusConnected mode. UdpConnection(UdpManager *udpManager, UdpIpAddress destIp, int destPort, int timeout); // starts connection-establishment protocol UdpConnection(UdpManager *udpManager, const UdpManager::PacketHistoryEntry *e); // starts already connected, replying to connection request @@ -1264,7 +1264,7 @@ class UdpConnection : public PriorityQueueMember, public AddressHashTableMember, void PhysicalSend(const uchar *data, int dataLen, bool appendAllowed); // sends a physical packet (encrypts and adds crc bytes) uchar *BufferedSend(const uchar *data, int dataLen, const uchar *data2, int dataLen2, bool appendAllowed); // buffers logical packets waiting til we have more data (makes multi-packets) bool InternalSend(UdpChannel channel, const LogicalPacket *packet); - bool InternalSend(UdpChannel channel, const uchar *data, int dataLen, const uchar *data2 = NULL, int dataLen2 = 0); + bool InternalSend(UdpChannel channel, const uchar *data, int dataLen, const uchar *data2 = nullptr, int dataLen2 = 0); uchar *InternalAckSend(uchar *bufferedAckPtr, const uchar *ackPtr, int ackLen); // used by reliable channel to send acks (special send that allows for deduping ack feature) @@ -1555,7 +1555,7 @@ class UdpReliableChannel void ProcessPacket(ReliablePacketMode mode, const uchar *data, int dataLen); bool PullDown(int windowSpaceLeft); void FlushCoalesce(); - void SendCoalesce(const uchar *data, int dataLen, const uchar *data2 = NULL, int dataLen2 = 0); + void SendCoalesce(const uchar *data, int dataLen, const uchar *data2 = nullptr, int dataLen2 = 0); void QueueLogicalPacket(const LogicalPacket *packet); UdpManager::ReliableConfig mConfig; @@ -1609,7 +1609,7 @@ class UdpReliableChannel template FixedLogicalPacket::FixedLogicalPacket(const void *data, int dataLen) { mDataLen = dataLen; - if (data != NULL) + if (data != nullptr) memcpy(mData, data, mDataLen); } @@ -1639,7 +1639,7 @@ template void FixedLogicalPacket::SetDataLen(int l ///////////////////////////////////////////////////////////////////////// template StructLogicalPacket::StructLogicalPacket(T *initData) { - if (initData != NULL) + if (initData != nullptr) mStruct = *initData; } @@ -1784,7 +1784,7 @@ inline void UdpManager::SetPriority(UdpConnection *con, UdpMisc::ClockStamp stam if (stamp < mMinimumScheduledStamp) stamp = mMinimumScheduledStamp; - if (mPriorityQueue != NULL) + if (mPriorityQueue != nullptr) mPriorityQueue->Add(con, stamp); } @@ -1811,7 +1811,7 @@ inline void UdpManager::PoolReturn(PooledLogicalPacket *packet) inline void UdpManager::WrappedReturn(WrappedLogicalPacket *wp) { - wp->SetLogicalPacket(NULL); + wp->SetLogicalPacket(nullptr); if (mWrappedAvailable < mParams.wrappedPoolMax) { @@ -1859,7 +1859,7 @@ inline void UdpConnection::ScheduleTimeNow() // prevents us from reprioritizing to 0, only to shortly thereafter be reprioritized to where we actually belong. if (!mGettingTime) { - if (mUdpManager != NULL) + if (mUdpManager != nullptr) mUdpManager->SetPriority(this, 0); } } @@ -2048,7 +2048,7 @@ inline int UdpReliableChannel::TotalPendingBytes() const inline void UdpReliableChannel::ClearBufferedAck() { - mBufferedAckPtr = NULL; + mBufferedAckPtr = nullptr; } inline udp_int64 UdpReliableChannel::GetReliableOutgoingId(int reliableStamp) const diff --git a/external/3rd/library/udplibrary/hashtable.hpp b/external/3rd/library/udplibrary/hashtable.hpp index 8c7340bc..f37a40e1 100644 --- a/external/3rd/library/udplibrary/hashtable.hpp +++ b/external/3rd/library/udplibrary/hashtable.hpp @@ -175,11 +175,11 @@ template class HashTable bool Remove(T& obj, int hashValue); void Reset(); // removes all entries from the table - T *FindFirst(int hashValue) const; // returns NULL if not found - T *FindNext(T *prevResult) const; // returns NULL if not found + T *FindFirst(int hashValue) const; // returns nullptr if not found + T *FindNext(T *prevResult) const; // returns nullptr if not found - T *WalkFirst() const; // returns NULL if not found - T *WalkNext(T *prevResult) const; // returns NULL if not found + T *WalkFirst() const; // returns nullptr if not found + T *WalkNext(T *prevResult) const; // returns nullptr if not found void Resize(int hashSize); // the actual hash size will be rounded up to the next larger prime number (very slow, not recommended) void GetStatistics(HashTableStatistics *stats) const; @@ -201,7 +201,7 @@ template class HashTable template HashTable::HashTable(int hashSize) { - mTable = NULL; + mTable = nullptr; mTableSize = 0; mEntryCount = 0; mStatUsedSlots = 0; @@ -221,9 +221,9 @@ template void HashTable::Insert(T& obj, int hashValue) entry->hashValue = hashValue; int spot = ((unsigned)hashValue) % mTableSize; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) { - entry->nextEntry = NULL; + entry->nextEntry = nullptr; mTable[spot] = entry; mStatUsedSlots++; } @@ -240,14 +240,14 @@ template bool HashTable::Remove(T& obj, int hashValue) int spot = ((unsigned)hashValue) % mTableSize; HashEntry* next = mTable[spot]; HashEntry** prev = &mTable[spot]; - while (next != NULL) + while (next != nullptr) { if (next->obj == obj && next->hashValue == hashValue) { *prev = next->nextEntry; delete next; mEntryCount--; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) mStatUsedSlots--; return(true); break; @@ -264,17 +264,17 @@ template void HashTable::Reset() for (int spot = 0; spot < mTableSize; spot++) { HashEntry *curr = mTable[spot]; - if (curr != NULL) + if (curr != nullptr) { mStatUsedSlots--; - while (curr != NULL) + while (curr != nullptr) { HashEntry *next = curr->nextEntry; delete curr; mEntryCount--; curr = next; } - mTable[spot] = NULL; + mTable[spot] = nullptr; } } } @@ -282,13 +282,13 @@ template void HashTable::Reset() template T *HashTable::FindFirst(int hashValue) const { HashEntry *entry = mTable[((unsigned)hashValue) % mTableSize]; - while (entry != NULL) + while (entry != nullptr) { if (entry->hashValue == hashValue) return(&entry->obj); entry = entry->nextEntry; } - return(NULL); + return(nullptr); } template T *HashTable::FindNext(T *prevResult) const @@ -296,13 +296,13 @@ template T *HashTable::FindNext(T *prevResult) const HashEntry *entry = (HashEntry *)(((char *)prevResult) - offsetof(HashEntry, obj)); int hashValue = entry->hashValue; entry = entry->nextEntry; - while (entry != NULL) + while (entry != nullptr) { if (entry->hashValue == hashValue) return(&entry->obj); entry = entry->nextEntry; } - return(NULL); + return(nullptr); } template T *HashTable::WalkFirst() const @@ -310,10 +310,10 @@ template T *HashTable::WalkFirst() const for (int bucket = 0; bucket < mTableSize; bucket++) { HashEntry *entry = mTable[bucket]; - if (entry != NULL) + if (entry != nullptr) return(&entry->obj); } - return(NULL); + return(nullptr); } template T *HashTable::WalkNext(T *prevResult) const @@ -322,17 +322,17 @@ template T *HashTable::WalkNext(T *prevResult) const int bucket = ((unsigned)entry->hashValue) % mTableSize; entry = entry->nextEntry; - if (entry != NULL) + if (entry != nullptr) return(&entry->obj); bucket++; // go onto next bucket for (; bucket < mTableSize; bucket++) { HashEntry *entry = mTable[bucket]; - if (entry != NULL) + if (entry != nullptr) return(&entry->obj); } - return(NULL); + return(nullptr); } template void HashTable::Resize(int hashSize) @@ -352,16 +352,16 @@ template void HashTable::Resize(int hashSize) for (int i = 0; i < oldSize; i++) { HashEntry* next = oldTable[i]; - while (next != NULL) + while (next != nullptr) { HashEntry* hold = next; next = next->nextEntry; // insert hold into new table int spot = ((unsigned)hold->hashValue) % mTableSize; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) { - hold->nextEntry = NULL; + hold->nextEntry = nullptr; mTable[spot] = hold; mStatUsedSlots++; } @@ -415,11 +415,11 @@ template class ObjectHashTable bool Remove(T obj, int hashValue); void Reset(); // removes all entries from the table - T FindFirst(int hashValue) const; // returns NULL if not found - T FindNext(T prevResult) const; // returns NULL if not found + T FindFirst(int hashValue) const; // returns nullptr if not found + T FindNext(T prevResult) const; // returns nullptr if not found - T WalkFirst() const; // returns NULL if not found - T WalkNext(T prevResult) const; // returns NULL if not found + T WalkFirst() const; // returns nullptr if not found + T WalkNext(T prevResult) const; // returns nullptr if not found void Resize(int hashSize); // the actual hash size will be rounded up to the next larger prime number (very slow, not recommended) void GetStatistics(HashTableStatistics *stats) const; @@ -434,7 +434,7 @@ template class ObjectHashTable template ObjectHashTable::ObjectHashTable(int hashSize) { - mTable = NULL; + mTable = nullptr; mTableSize = 0; mEntryCount = 0; mStatUsedSlots = 0; @@ -452,9 +452,9 @@ template void ObjectHashTable::Insert(T obj, int hashValue) obj->mHashValue = hashValue; int spot = ((unsigned)hashValue) % mTableSize; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) { - obj->mHashNextEntry = NULL; + obj->mHashNextEntry = nullptr; mTable[spot] = obj; mStatUsedSlots++; } @@ -471,14 +471,14 @@ template bool ObjectHashTable::Remove(T obj, int hashValue) int spot = ((unsigned)hashValue) % mTableSize; T next = mTable[spot]; T *prev = &mTable[spot]; - while (next != NULL) + while (next != nullptr) { if (next == obj) { *prev = (T)next->mHashNextEntry; - next->mHashNextEntry = NULL; + next->mHashNextEntry = nullptr; mEntryCount--; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) mStatUsedSlots--; return(true); break; @@ -495,16 +495,16 @@ template void ObjectHashTable::Reset() for (int spot = 0; spot < mTableSize; spot++) { T curr = mTable[spot]; - if (curr != NULL) + if (curr != nullptr) { - while (curr != NULL) + while (curr != nullptr) { T next = (T)curr->mHashNextEntry; - curr->mHashNextEntry = NULL; + curr->mHashNextEntry = nullptr; mEntryCount--; curr = next; } - mTable[spot] = NULL; + mTable[spot] = nullptr; mStatUsedSlots--; } } @@ -513,13 +513,13 @@ template void ObjectHashTable::Reset() template T ObjectHashTable::FindFirst(int hashValue) const { T entry = mTable[((unsigned)hashValue) % mTableSize]; - while (entry != NULL) + while (entry != nullptr) { if (entry->mHashValue == hashValue) return(entry); entry = (T)entry->mHashNextEntry; } - return(NULL); + return(nullptr); } template T ObjectHashTable::FindNext(T prevResult) const @@ -527,13 +527,13 @@ template T ObjectHashTable::FindNext(T prevResult) const T entry = prevResult; int hashValue = entry->mHashValue; entry = (T)entry->mHashNextEntry; - while (entry != NULL) + while (entry != nullptr) { if (entry->mHashValue == hashValue) return(entry); entry = (T)entry->mHashNextEntry; } - return(NULL); + return(nullptr); } template T ObjectHashTable::WalkFirst() const @@ -541,10 +541,10 @@ template T ObjectHashTable::WalkFirst() const for (int bucket = 0; bucket < mTableSize; bucket++) { T entry = mTable[bucket]; - if (entry != NULL) + if (entry != nullptr) return(entry); } - return(NULL); + return(nullptr); } template T ObjectHashTable::WalkNext(T prevResult) const @@ -553,17 +553,17 @@ template T ObjectHashTable::WalkNext(T prevResult) const int bucket = ((unsigned)entry->mHashValue) % mTableSize; entry = (T)entry->mHashNextEntry; - if (entry != NULL) + if (entry != nullptr) return(entry); bucket++; // go onto next bucket for (; bucket < mTableSize; bucket++) { entry = mTable[bucket]; - if (entry != NULL) + if (entry != nullptr) return(entry); } - return(NULL); + return(nullptr); } template void ObjectHashTable::Resize(int hashSize) @@ -583,16 +583,16 @@ template void ObjectHashTable::Resize(int hashSize) for (int i = 0; i < oldSize; i++) { T next = oldTable[i]; - while (next != NULL) + while (next != nullptr) { T hold = next; next = (T)next->mHashNextEntry; // insert hold into new table int spot = ((unsigned)hold->mHashValue) % mTableSize; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) { - hold->mHashNextEntry = NULL; + hold->mHashNextEntry = nullptr; mTable[spot] = hold; mStatUsedSlots++; } diff --git a/external/3rd/library/udplibrary/priority.hpp b/external/3rd/library/udplibrary/priority.hpp index 19f34ab3..516619db 100644 --- a/external/3rd/library/udplibrary/priority.hpp +++ b/external/3rd/library/udplibrary/priority.hpp @@ -37,12 +37,12 @@ template class PriorityQueue PriorityQueue(int queueSize); ~PriorityQueue(); - T* Top(); // returns NULL if queue is empty - T* TopRemove(); // returns NULL if queue is empty - T* TopRemove(P priority); // removes item from queue if it has a lower priority value, otherwise return NULL + T* Top(); // returns nullptr if queue is empty + T* TopRemove(); // returns nullptr if queue is empty + T* TopRemove(P priority); // removes item from queue if it has a lower priority value, otherwise return nullptr T* Add(T* entry, P priority); // reprioritizes if already in queue, returns entry always T* Remove(T* entry); // returns entry always (even if it was not in the queue) - P *GetPriority(T* entry); // returns NULL if entry is not in the queue + P *GetPriority(T* entry); // returns nullptr if entry is not in the queue int QueueUsed(); // returns how many entries are in the queue protected: struct QueueEntry @@ -88,14 +88,14 @@ template PriorityQueue::~PriorityQueue() template T* PriorityQueue::Top() { if (mQueueEnd == 0) - return(NULL); + return(nullptr); return(mQueue[0].entry); } template T* PriorityQueue::TopRemove() { if (mQueueEnd == 0) - return(NULL); + return(nullptr); T* top = mQueue[0].entry; Remove(top); return(top); @@ -105,14 +105,14 @@ template T* PriorityQueue::TopRemove(P priority) { if (mQueueEnd > 0 && mQueue[0].priority <= priority) return(Remove(mQueue[0].entry)); - return(NULL); + return(nullptr); } template P* PriorityQueue::GetPriority(T* entry) { if (entry->mPriorityQueuePosition >= 0) return(&mQueue[entry->mPriorityQueuePosition].priority); - return(NULL); + return(nullptr); } template T* PriorityQueue::Add(T* entry, P priority) @@ -121,7 +121,7 @@ template T* PriorityQueue::Add(T* entry, P priorit { // not in queue, so add it to the bottom if (mQueueEnd >= mQueueSize) - return(NULL); + return(nullptr); mQueue[mQueueEnd].entry = entry; mQueue[mQueueEnd].priority = priority; mQueue[mQueueEnd].entry->mPriorityQueuePosition = mQueueEnd; diff --git a/external/3rd/library/udplibrary/udpclient.cpp b/external/3rd/library/udplibrary/udpclient.cpp index 9debac0e..9ed52d3e 100755 --- a/external/3rd/library/udplibrary/udpclient.cpp +++ b/external/3rd/library/udplibrary/udpclient.cpp @@ -106,7 +106,7 @@ int main(int argc, char **argv) printf("Connecting to: %s,%d.", connectIp, connectPort); UdpConnection *myConnection = myUdpManager->EstablishConnection(connectIp, connectPort); myConnection->SetHandler(&myConnectionHandler); - assert(myConnection != NULL); + assert(myConnection != nullptr); int count = 0; while (myConnection->GetStatus() == UdpConnection::cStatusNegotiating) { @@ -181,7 +181,7 @@ int main(int argc, char **argv) if (myConnection->TotalPendingBytes() == 0) { // send another packet - SimpleLogicalPacket *lp = new SimpleLogicalPacket(NULL, 30000000); + SimpleLogicalPacket *lp = new SimpleLogicalPacket(nullptr, 30000000); int dlen = lp->GetDataLen(); char *ptr = (char *)lp->GetDataPtr(); diff --git a/external/3rd/library/udplibrary/udpserver.cpp b/external/3rd/library/udplibrary/udpserver.cpp index c523a05b..c8641671 100755 --- a/external/3rd/library/udplibrary/udpserver.cpp +++ b/external/3rd/library/udplibrary/udpserver.cpp @@ -182,7 +182,7 @@ Player::~Player() { char hold[256]; printf("TERMINATE %s,%d \n", mConnection->GetDestinationIp().GetAddress(hold), mConnection->GetDestinationPort()); - mConnection->SetHandler(NULL); + mConnection->SetHandler(nullptr); mConnection->Disconnect(); mConnection->Release(); } diff --git a/external/ours/library/archive/src/shared/AutoDeltaVariableCallback.h b/external/ours/library/archive/src/shared/AutoDeltaVariableCallback.h index ef0cc7fa..34373722 100755 --- a/external/ours/library/archive/src/shared/AutoDeltaVariableCallback.h +++ b/external/ours/library/archive/src/shared/AutoDeltaVariableCallback.h @@ -186,7 +186,7 @@ inline void AutoDeltaVariableCallback::se ValueType const tmp = this->get(); AutoDeltaVariable::set(source); - if (sourceObject != NULL && tmp != source) + if (sourceObject != nullptr && tmp != source) callback.modified(*sourceObject, tmp, source, true); } diff --git a/external/ours/library/archive/src/shared/ByteStream.cpp b/external/ours/library/archive/src/shared/ByteStream.cpp index 2e19cb81..4965bc8c 100755 --- a/external/ours/library/archive/src/shared/ByteStream.cpp +++ b/external/ours/library/archive/src/shared/ByteStream.cpp @@ -20,7 +20,7 @@ namespace Archive { @brief ReadIterator ctor Initializes the read position to zero, and the ByteStream member value - is NULL + is nullptr */ ReadIterator::ReadIterator() : readPtr(0), diff --git a/external/ours/library/archive/src/shared/ByteStream.h b/external/ours/library/archive/src/shared/ByteStream.h index eda154d5..a94aeb36 100755 --- a/external/ours/library/archive/src/shared/ByteStream.h +++ b/external/ours/library/archive/src/shared/ByteStream.h @@ -261,7 +261,7 @@ inline void ReadIterator::get(void * target, const unsigned long int readSize) } else { - static const char * const desc = "Archive::ReadIterator::get - read operation on null stream object"; + static const char * const desc = "Archive::ReadIterator::get - read operation on nullptr stream object"; ReadException ex(desc); throw (ex); } diff --git a/external/ours/library/crypto/src/shared/original/cryptlib.h b/external/ours/library/crypto/src/shared/original/cryptlib.h index dbbc7fa7..fd258706 100755 --- a/external/ours/library/crypto/src/shared/original/cryptlib.h +++ b/external/ours/library/crypto/src/shared/original/cryptlib.h @@ -440,7 +440,7 @@ public: //@{ //! returns whether this object allows attachment virtual bool Attachable() {return false;} - //! returns the object immediately attached to this object or NULL for no attachment + //! returns the object immediately attached to this object or nullptr for no attachment virtual BufferedTransformation *AttachedTransformation() {return 0;} //! virtual const BufferedTransformation *AttachedTransformation() const diff --git a/external/ours/library/crypto/src/shared/original/filters.cpp b/external/ours/library/crypto/src/shared/original/filters.cpp index 7caaf21d..852a7b7f 100755 --- a/external/ours/library/crypto/src/shared/original/filters.cpp +++ b/external/ours/library/crypto/src/shared/original/filters.cpp @@ -55,7 +55,7 @@ const byte *FilterWithBufferedInput::BlockQueue::GetBlock() return ptr; } else - return NULL; + return nullptr; } const byte *FilterWithBufferedInput::BlockQueue::GetContigousBlocks(unsigned int &numberOfBlocks) @@ -175,7 +175,7 @@ void FilterWithBufferedInput::Put(const byte *inString, unsigned int length) void FilterWithBufferedInput::MessageEnd(int propagation) { if (!m_firstInputDone && m_firstSize==0) - FirstPut(NULL); + FirstPut(nullptr); SecByteBlock temp(m_queue.CurrentSize()); m_queue.GetAll(temp); @@ -200,7 +200,7 @@ void FilterWithBufferedInput::ForceNextPut() // ************************************************************* ProxyFilter::ProxyFilter(Filter *filter, unsigned int firstSize, unsigned int lastSize, BufferedTransformation *outQ) - : FilterWithBufferedInput(firstSize, 1, lastSize, outQ), m_filter(filter), m_proxy(NULL) + : FilterWithBufferedInput(firstSize, 1, lastSize, outQ), m_filter(filter), m_proxy(nullptr) { if (m_filter.get()) m_filter->Attach(m_proxy = new OutputProxy(*this, false)); @@ -229,7 +229,7 @@ void ProxyFilter::SetFilter(Filter *filter) m_filter->Attach(temp.release()); } else - m_proxy=NULL; + m_proxy=nullptr; } void ProxyFilter::NextPut(const byte *s, unsigned int len) diff --git a/external/ours/library/crypto/src/shared/original/filters.h b/external/ours/library/crypto/src/shared/original/filters.h index 6a2f0389..b80c518a 100755 --- a/external/ours/library/crypto/src/shared/original/filters.h +++ b/external/ours/library/crypto/src/shared/original/filters.h @@ -17,7 +17,7 @@ public: bool Attachable() {return true;} BufferedTransformation *AttachedTransformation() {return m_outQueue.get();} const BufferedTransformation *AttachedTransformation() const {return m_outQueue.get();} - void Detach(BufferedTransformation *newOut = NULL); + void Detach(BufferedTransformation *newOut = nullptr); protected: virtual void NotifyAttachmentChange() {} @@ -33,7 +33,7 @@ private: class TransparentFilter : public Filter { public: - TransparentFilter(BufferedTransformation *outQ=NULL) : Filter(outQ) {} + TransparentFilter(BufferedTransformation *outQ=nullptr) : Filter(outQ) {} void Put(byte inByte) {AttachedTransformation()->Put(inByte);} void Put(const byte *inString, unsigned int length) {AttachedTransformation()->Put(inString, length);} }; @@ -42,7 +42,7 @@ public: class OpaqueFilter : public Filter { public: - OpaqueFilter(BufferedTransformation *outQ=NULL) : Filter(outQ) {} + OpaqueFilter(BufferedTransformation *outQ=nullptr) : Filter(outQ) {} void Put(byte inByte) {} void Put(const byte *inString, unsigned int length) {} }; @@ -122,7 +122,7 @@ class StreamCipherFilter : public Filter { public: StreamCipherFilter(StreamCipher &c, - BufferedTransformation *outQueue = NULL) + BufferedTransformation *outQueue = nullptr) : cipher(c), Filter(outQueue) {} void Put(byte inByte) @@ -138,7 +138,7 @@ private: class HashFilter : public Filter { public: - HashFilter(HashModule &hm, BufferedTransformation *outQueue = NULL, bool putMessage=false) + HashFilter(HashModule &hm, BufferedTransformation *outQueue = nullptr, bool putMessage=false) : Filter(outQueue), m_hashModule(hm), m_putMessage(putMessage) {} void MessageEnd(int propagation=-1); @@ -163,7 +163,7 @@ public: }; enum Flags {HASH_AT_BEGIN=1, PUT_MESSAGE=2, PUT_HASH=4, PUT_RESULT=8, THROW_EXCEPTION=16}; - HashVerifier(HashModule &hm, BufferedTransformation *outQueue = NULL, word32 flags = HASH_AT_BEGIN | PUT_RESULT); + HashVerifier(HashModule &hm, BufferedTransformation *outQueue = nullptr, word32 flags = HASH_AT_BEGIN | PUT_RESULT); bool GetLastResult() const {return m_verified;} @@ -183,7 +183,7 @@ private: class SignerFilter : public Filter { public: - SignerFilter(RandomNumberGenerator &rng, const PK_Signer &signer, BufferedTransformation *outQueue = NULL) + SignerFilter(RandomNumberGenerator &rng, const PK_Signer &signer, BufferedTransformation *outQueue = nullptr) : m_rng(rng), m_signer(signer), m_messageAccumulator(signer.NewMessageAccumulator()), Filter(outQueue) {} void MessageEnd(int propagation); @@ -204,7 +204,7 @@ private: class VerifierFilter : public Filter { public: - VerifierFilter(const PK_Verifier &verifier, BufferedTransformation *outQueue = NULL) + VerifierFilter(const PK_Verifier &verifier, BufferedTransformation *outQueue = nullptr) : m_verifier(verifier), m_messageAccumulator(verifier.NewMessageAccumulator()) , m_signature(verifier.SignatureLength()), Filter(outQueue) {} @@ -244,11 +244,11 @@ extern BitBucket g_bitBucket; class Redirector : public Sink { public: - Redirector() : m_target(NULL), m_passSignal(true) {} + Redirector() : m_target(nullptr), m_passSignal(true) {} Redirector(BufferedTransformation &target, bool passSignal=true) : m_target(&target), m_passSignal(passSignal) {} void Redirect(BufferedTransformation &target) {m_target = ⌖} - void StopRedirect() {m_target = NULL;} + void StopRedirect() {m_target = nullptr;} bool GetPassSignal() const {return m_passSignal;} void SetPassSignal(bool passSignal) {m_passSignal = passSignal;} @@ -498,7 +498,7 @@ public: class GeneralSource : public Source { public: - GeneralSource(BufferedTransformation &store, bool pumpAll, BufferedTransformation *outQueue = NULL) + GeneralSource(BufferedTransformation &store, bool pumpAll, BufferedTransformation *outQueue = nullptr) : Source(outQueue), m_store(store) { if (pumpAll) PumpAll(); @@ -517,13 +517,13 @@ private: class StringSource : public Source { public: - StringSource(const char *string, bool pumpAll, BufferedTransformation *outQueue = NULL); - StringSource(const byte *string, unsigned int length, bool pumpAll, BufferedTransformation *outQueue = NULL); + StringSource(const char *string, bool pumpAll, BufferedTransformation *outQueue = nullptr); + StringSource(const byte *string, unsigned int length, bool pumpAll, BufferedTransformation *outQueue = nullptr); #ifdef __MWERKS__ // CW60 workaround - StringSource(const std::string &string, bool pumpAll, BufferedTransformation *outQueue = NULL) + StringSource(const std::string &string, bool pumpAll, BufferedTransformation *outQueue = nullptr) #else - template StringSource(const T &string, bool pumpAll, BufferedTransformation *outQueue = NULL) + template StringSource(const T &string, bool pumpAll, BufferedTransformation *outQueue = nullptr) #endif : Source(outQueue), m_store(string) { @@ -544,7 +544,7 @@ private: class RandomNumberSource : public Source { public: - RandomNumberSource(RandomNumberGenerator &rng, unsigned int length, bool pumpAll, BufferedTransformation *outQueue = NULL); + RandomNumberSource(RandomNumberGenerator &rng, unsigned int length, bool pumpAll, BufferedTransformation *outQueue = nullptr); unsigned long Pump(unsigned long pumpMax=ULONG_MAX) {return m_store.TransferTo(*AttachedTransformation(), pumpMax);} diff --git a/external/ours/library/crypto/src/shared/original/queue.cpp b/external/ours/library/crypto/src/shared/original/queue.cpp index b18c2b4a..2fb3250a 100755 --- a/external/ours/library/crypto/src/shared/original/queue.cpp +++ b/external/ours/library/crypto/src/shared/original/queue.cpp @@ -152,7 +152,7 @@ void ByteQueue::CopyFrom(const ByteQueue ©) m_tail = m_tail->next; } - m_tail->next = NULL; + m_tail->next = nullptr; Put(copy.m_lazyString, copy.m_lazyLength); } diff --git a/external/ours/library/crypto/src/shared/original/smartptr.h b/external/ours/library/crypto/src/shared/original/smartptr.h index 6a0595a1..f5c0b41b 100755 --- a/external/ours/library/crypto/src/shared/original/smartptr.h +++ b/external/ours/library/crypto/src/shared/original/smartptr.h @@ -9,7 +9,7 @@ NAMESPACE_BEGIN(CryptoPP) template class member_ptr { public: - explicit member_ptr(T *p = NULL) : m_p(p) {} + explicit member_ptr(T *p = nullptr) : m_p(p) {} ~member_ptr(); @@ -47,9 +47,9 @@ template class value_ptr : public member_ptr { public: value_ptr(const T &obj) : member_ptr(new T(obj)) {} - value_ptr(T *p = NULL) : member_ptr(p) {} + value_ptr(T *p = nullptr) : member_ptr(p) {} value_ptr(const value_ptr& rhs) - : member_ptr(rhs.m_p ? new T(*rhs.m_p) : NULL) {} + : member_ptr(rhs.m_p ? new T(*rhs.m_p) : nullptr) {} value_ptr& operator=(const value_ptr& rhs); bool operator==(const value_ptr& rhs) @@ -61,7 +61,7 @@ public: template value_ptr& value_ptr::operator=(const value_ptr& rhs) { T *old_p = this->m_p; - this->m_p = rhs.m_p ? new T(*rhs.m_p) : NULL; + this->m_p = rhs.m_p ? new T(*rhs.m_p) : nullptr; delete old_p; return *this; } @@ -72,9 +72,9 @@ template class clonable_ptr : public member_ptr { public: clonable_ptr(const T &obj) : member_ptr(obj.Clone()) {} - clonable_ptr(T *p = NULL) : member_ptr(p) {} + clonable_ptr(T *p = nullptr) : member_ptr(p) {} clonable_ptr(const clonable_ptr& rhs) - : member_ptr(rhs.m_p ? rhs.m_p->Clone() : NULL) {} + : member_ptr(rhs.m_p ? rhs.m_p->Clone() : nullptr) {} clonable_ptr& operator=(const clonable_ptr& rhs); }; @@ -82,7 +82,7 @@ public: template clonable_ptr& clonable_ptr::operator=(const clonable_ptr& rhs) { T *old_p = this->m_p; - this->m_p = rhs.m_p ? rhs.m_p->Clone() : NULL; + this->m_p = rhs.m_p ? rhs.m_p->Clone() : nullptr; delete old_p; return *this; } @@ -184,8 +184,8 @@ template class ConstructorTemp { protected: - ConstructorTemp(const ConstructorTemp ©) : m_temp(NULL) {} - ConstructorTemp(T *t = NULL) : m_temp(t) {} + ConstructorTemp(const ConstructorTemp ©) : m_temp(nullptr) {} + ConstructorTemp(T *t = nullptr) : m_temp(t) {} ConstructorTemp(const T &t) : m_temp(new T(t)) {} member_ptr m_temp; }; diff --git a/external/ours/library/crypto/src/shared/wrapper/TwofishCrypt.cpp b/external/ours/library/crypto/src/shared/wrapper/TwofishCrypt.cpp index 0a88c460..9a272ae3 100755 --- a/external/ours/library/crypto/src/shared/wrapper/TwofishCrypt.cpp +++ b/external/ours/library/crypto/src/shared/wrapper/TwofishCrypt.cpp @@ -84,7 +84,7 @@ void TwofishCrypt::process(const unsigned char * const inputBuffer, unsigned cha } assert( r == 0 ); // size must be a 16 byte block for Twofish to do it's job! } - assert(cipher != NULL); // can't process data without a twofish encryptor or decryptor! + assert(cipher != nullptr); // can't process data without a twofish encryptor or decryptor! } //----------------------------------------------------------------------- diff --git a/external/ours/library/fileInterface/src/shared/AbstractFile.cpp b/external/ours/library/fileInterface/src/shared/AbstractFile.cpp index dd575c36..ef76c7cf 100755 --- a/external/ours/library/fileInterface/src/shared/AbstractFile.cpp +++ b/external/ours/library/fileInterface/src/shared/AbstractFile.cpp @@ -15,7 +15,7 @@ namespace AbstractFileNamespace { - AbstractFile::AudioServeFunction s_audioServeFunction = NULL; + AbstractFile::AudioServeFunction s_audioServeFunction = nullptr; } using namespace AbstractFileNamespace; @@ -51,7 +51,7 @@ void AbstractFile::flush() byte *AbstractFile::readEntireFileAndClose() { - if (s_audioServeFunction != NULL) + if (s_audioServeFunction != nullptr) (*s_audioServeFunction)(); seek(SeekBegin, 0); @@ -84,7 +84,7 @@ int AbstractFile::getZlibCompressedLength() const void AbstractFile::getZlibCompressedDataAndClose(byte *& compressedBuffer, int & compressedBufferLength) { - compressedBuffer = NULL; + compressedBuffer = nullptr; compressedBufferLength = -1; } diff --git a/external/ours/library/fileInterface/src/shared/AbstractFile.h b/external/ours/library/fileInterface/src/shared/AbstractFile.h index 0f649d1e..62c4f804 100755 --- a/external/ours/library/fileInterface/src/shared/AbstractFile.h +++ b/external/ours/library/fileInterface/src/shared/AbstractFile.h @@ -110,7 +110,7 @@ public: * Read the entire file into a memory buffer. The client is responsible for deleting the buffer * using operator delete(). The file will be closed after the read completes. * - * @return null if an error occured + * @return nullptr if an error occured */ virtual unsigned char *readEntireFileAndClose(); diff --git a/external/ours/library/fileInterface/src/shared/StdioFile.cpp b/external/ours/library/fileInterface/src/shared/StdioFile.cpp index 1e7225ed..bb890dfa 100755 --- a/external/ours/library/fileInterface/src/shared/StdioFile.cpp +++ b/external/ours/library/fileInterface/src/shared/StdioFile.cpp @@ -35,7 +35,7 @@ void StdioFile::close() if(m_file) { fclose(m_file); - m_file = NULL; + m_file = nullptr; } } @@ -43,7 +43,7 @@ void StdioFile::close() bool StdioFile::isOpen() const { - return m_file != NULL; + return m_file != nullptr; } // ---------------------------------------------------------------------- @@ -71,7 +71,7 @@ int StdioFile::tell() const bool StdioFile::seek(SeekType seekType, int offset) { - assert(m_file != NULL); + assert(m_file != nullptr); m_justWrote = false; int result = 0; @@ -97,7 +97,7 @@ bool StdioFile::seek(SeekType seekType, int offset) int StdioFile::read(void* dest_buffer, int num_bytes) { - assert(m_file != NULL); + assert(m_file != nullptr); resyncStream(); return static_cast(fread(dest_buffer, 1, static_cast(num_bytes), m_file)); } @@ -106,7 +106,7 @@ int StdioFile::read(void* dest_buffer, int num_bytes) int StdioFile::write(int num_bytes, const void* source_buffer) { - assert(m_file != NULL); + assert(m_file != nullptr); m_justWrote = true; return static_cast(fwrite(source_buffer, 1, static_cast(num_bytes), m_file)); } @@ -115,7 +115,7 @@ int StdioFile::write(int num_bytes, const void* source_buffer) void StdioFile::flush() { - assert(m_file != NULL); + assert(m_file != nullptr); fflush(m_file); m_justWrote = false; } @@ -136,9 +136,9 @@ void StdioFile::resyncStream() AbstractFile* StdioFileFactory::createFile(const char *fileName, const char *openType) { if(!fileName || !openType) - return NULL; + return nullptr; else if (fileName[0] == '\0' || openType[0] == '\0') - return NULL; + return nullptr; else return new StdioFile(fileName, openType); } diff --git a/external/ours/library/localization/src/shared/LocalizationManager.cpp b/external/ours/library/localization/src/shared/LocalizationManager.cpp index 518bf42b..e7b106ca 100755 --- a/external/ours/library/localization/src/shared/LocalizationManager.cpp +++ b/external/ours/library/localization/src/shared/LocalizationManager.cpp @@ -77,8 +77,8 @@ using namespace LocalizationManagerNamespace; //---------------------------------------------------------------------- bool LocalizationManager::ms_installed = 0; -LocalizationManager::LocalizationManagerHashMap * LocalizationManager::ms_singletonHashMap = NULL; -Unicode::NarrowString * LocalizationManager::ms_firstLocaleLoaded = NULL; +LocalizationManager::LocalizationManagerHashMap * LocalizationManager::ms_singletonHashMap = nullptr; +Unicode::NarrowString * LocalizationManager::ms_firstLocaleLoaded = nullptr; //----------------------------------------------------------------- @@ -103,7 +103,7 @@ m_displayBadStringIds (displayBadStringIds) m_usingEnglishLocale = false; } - assert (m_fileFactory != NULL);//lint !e1924 // c-style cast. MSVC bug + assert (m_fileFactory != nullptr);//lint !e1924 // c-style cast. MSVC bug } //----------------------------------------------------------------- @@ -181,23 +181,23 @@ void LocalizationManager::install (AbstractFileFactory * fileFactory, Unicode::U void LocalizationManager::remove () { assert (ms_installed);//lint !e1924 // c-style cast. MSVC bug - assert (ms_singletonHashMap != NULL);//lint !e1924 // c-style cast. MSVC bug - assert (ms_firstLocaleLoaded != NULL); + assert (ms_singletonHashMap != nullptr);//lint !e1924 // c-style cast. MSVC bug + assert (ms_firstLocaleLoaded != nullptr); LocalizationManagerHashMap::iterator end = ms_singletonHashMap->end(); for (LocalizationManagerHashMap::iterator it = ms_singletonHashMap->begin(); it != end; ++it) { LocalizationManager * current = (*it).second; - (*it).second = NULL; + (*it).second = nullptr; delete current; } ms_singletonHashMap->clear(); delete ms_singletonHashMap; - ms_singletonHashMap = NULL; + ms_singletonHashMap = nullptr; delete ms_firstLocaleLoaded; - ms_firstLocaleLoaded = NULL; + ms_firstLocaleLoaded = nullptr; ms_installed = false; } @@ -277,7 +277,7 @@ LocalizedStringTable * LocalizationManager::fetchStringTable(const Unicode::Narr if(find_iter != stmap.end ()) { TimedStringTable & tst = (*find_iter).second; - //-- this can be null + //-- this can be nullptr table = tst.second; tst.first = time(0); } diff --git a/external/ours/library/localization/src/shared/LocalizedString.cpp b/external/ours/library/localization/src/shared/LocalizedString.cpp index 88817b83..de996f95 100755 --- a/external/ours/library/localization/src/shared/LocalizedString.cpp +++ b/external/ours/library/localization/src/shared/LocalizedString.cpp @@ -193,10 +193,10 @@ LocalizedString * LocalizedString::load_0000 (AbstractFile & fl) if (!fl.read (&buflen, sizeof (id_type))) return 0; - // buflen does not include null terminator + // buflen does not include nullptr terminator Unicode::unicode_char_t * buf = new Unicode::unicode_char_t [buflen+1]; - assert (buf != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (buf != nullptr); //lint !e1924 // c-style cast. MSVC bug buf [buflen] = 0; @@ -214,7 +214,7 @@ LocalizedString * LocalizedString::load_0000 (AbstractFile & fl) // TODO: Localized strings are stored little endian! loc_str = new LocalizedString(id, buf); - assert (loc_str != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (loc_str != nullptr); //lint !e1924 // c-style cast. MSVC bug loc_str->resetLineCounts (); @@ -247,10 +247,10 @@ LocalizedString * LocalizedString::load_0001 (AbstractFile & fl) if (!fl.read (&buflen, sizeof (id_type))) return 0; - // buflen does not include null terminator + // buflen does not include nullptr terminator Unicode::unicode_char_t * buf = new Unicode::unicode_char_t [buflen+1]; - assert (buf != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (buf != nullptr); //lint !e1924 // c-style cast. MSVC bug buf [buflen] = 0; @@ -268,7 +268,7 @@ LocalizedString * LocalizedString::load_0001 (AbstractFile & fl) // TODO: Localized strings are stored little endian! loc_str = new LocalizedString(id, crcSource, buf); - assert (loc_str != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (loc_str != nullptr); //lint !e1924 // c-style cast. MSVC bug loc_str->resetLineCounts (); diff --git a/external/ours/library/localization/src/shared/LocalizedStringTable.cpp b/external/ours/library/localization/src/shared/LocalizedStringTable.cpp index 10ab6c60..e0519d6e 100755 --- a/external/ours/library/localization/src/shared/LocalizedStringTable.cpp +++ b/external/ours/library/localization/src/shared/LocalizedStringTable.cpp @@ -187,10 +187,10 @@ bool LocalizedStringTable::load_0000 (AbstractFile & fl) if (!fl.read (&buflen, sizeof (LocalizedString::id_type))) return false; - // buflen does not include null terminator + // buflen does not include nullptr terminator char * buf = new char [buflen+1]; - assert (buf != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (buf != nullptr); //lint !e1924 // c-style cast. MSVC bug buf [buflen] = 0; @@ -276,10 +276,10 @@ bool LocalizedStringTable::load_0001(AbstractFile & fl) if (!fl.read (&buflen, sizeof (LocalizedString::id_type))) return false; - // buflen does not include null terminator + // buflen does not include nullptr terminator char * buf = new char [buflen+1]; - assert (buf != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (buf != nullptr); //lint !e1924 // c-style cast. MSVC bug buf [buflen] = 0; @@ -333,7 +333,7 @@ LocalizedStringTable *LocalizedStringTable::load (AbstractFileFactory & fileFact { case 0: table = new LocalizedStringTable (filename); - assert (table != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (table != nullptr); //lint !e1924 // c-style cast. MSVC bug if (table->load_0000 (*fl) == false) { @@ -344,7 +344,7 @@ LocalizedStringTable *LocalizedStringTable::load (AbstractFileFactory & fileFact case 1: table = new LocalizedStringTable (filename); - assert (table != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (table != nullptr); //lint !e1924 // c-style cast. MSVC bug if (table->load_0001 (*fl) == false) { diff --git a/external/ours/library/localization/src/shared/LocalizedStringTableReaderWriter.cpp b/external/ours/library/localization/src/shared/LocalizedStringTableReaderWriter.cpp index 19e95784..e7dfbf27 100755 --- a/external/ours/library/localization/src/shared/LocalizedStringTableReaderWriter.cpp +++ b/external/ours/library/localization/src/shared/LocalizedStringTableReaderWriter.cpp @@ -126,7 +126,7 @@ bool LocalizedStringTableRW::str_write(AbstractFile & fl, LocalizedString & locs // TODO: swab this buffer Unicode::unicode_char_t * buf = new Unicode::unicode_char_t [buflen+1]; - assert (buf != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (buf != nullptr); //lint !e1924 // c-style cast. MSVC bug buf [buflen] = 0; memcpy (buf, locstr.m_str.c_str (), sizeof (Unicode::unicode_char_t) * buflen); @@ -183,7 +183,7 @@ bool LocalizedStringTableRW::write(AbstractFile & fl) const char * buf = new char [buflen + 1]; - assert (buf != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (buf != nullptr); //lint !e1924 // c-style cast. MSVC bug buf [buflen] = 0; @@ -230,7 +230,7 @@ LocalizedStringTableRW *LocalizedStringTableRW::loadRW (AbstractFileFactory & fi { case 0: table = new LocalizedStringTableRW (filename); - assert (table != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (table != nullptr); //lint !e1924 // c-style cast. MSVC bug if (table->load_0000 (*fl) == false) { @@ -241,7 +241,7 @@ LocalizedStringTableRW *LocalizedStringTableRW::loadRW (AbstractFileFactory & fi case 1: table = new LocalizedStringTableRW (filename); - assert (table != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (table != nullptr); //lint !e1924 // c-style cast. MSVC bug if (table->load_0001 (*fl) == false) { @@ -336,7 +336,7 @@ LocalizedString * LocalizedStringTableRW::addString (const Unicode::String & st { LocalizedString * const locstr = (m_map [m_nextUniqueId] = new LocalizedString (m_nextUniqueId, int(time(0)), str)); - assert (locstr != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (locstr != nullptr); //lint !e1924 // c-style cast. MSVC bug char buf[64]; sprintf (buf, "%03ld_default", m_nextUniqueId); @@ -538,7 +538,7 @@ void LocalizedStringTableRW::prepareTable (const LocalizedStringTableRW & rhs) LocalizedString * locstr = new LocalizedString (rhs_locstr->m_id, 0, rhs_locstr->m_str); - assert (locstr != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (locstr != nullptr); //lint !e1924 // c-style cast. MSVC bug m_map.insert (Map_t::value_type (locstr->getId (), locstr )); } } diff --git a/external/ours/library/singleton/src/shared/Singleton2.h b/external/ours/library/singleton/src/shared/Singleton2.h index 130d0cd7..1b42905d 100755 --- a/external/ours/library/singleton/src/shared/Singleton2.h +++ b/external/ours/library/singleton/src/shared/Singleton2.h @@ -138,7 +138,7 @@ inline Singleton2::Singleton2() template inline Singleton2::~Singleton2() { - assert(instance != NULL); + assert(instance != nullptr); instance = 0; } @@ -165,7 +165,7 @@ inline Singleton2::~Singleton2() template inline ValueType & Singleton2::getInstance() { - assert(instance != NULL); + assert(instance != nullptr); return *instance; } diff --git a/external/ours/library/unicode/src/shared/UnicodeCharacterDataMap.cpp b/external/ours/library/unicode/src/shared/UnicodeCharacterDataMap.cpp index 3f67e74a..6206b680 100755 --- a/external/ours/library/unicode/src/shared/UnicodeCharacterDataMap.cpp +++ b/external/ours/library/unicode/src/shared/UnicodeCharacterDataMap.cpp @@ -218,7 +218,7 @@ CharDataMap::ErrorCode CharDataMap::generateMapFromBuffer (const Unicode::Blocks { CharData * data = new CharData; - assert (data != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (data != nullptr); //lint !e1924 // c-style cast. MSVC bug data->m_reverseCase = 0; @@ -244,7 +244,7 @@ CharDataMap::ErrorCode CharDataMap::generateMapFromBuffer (const Unicode::Blocks m_contiguousData = new CharData [validChars]; - assert (m_contiguousData != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (m_contiguousData != nullptr); //lint !e1924 // c-style cast. MSVC bug size_t dataIndex = 0; @@ -288,7 +288,7 @@ CharDataMap::ErrorCode CharDataMap::generateMap (const Unicode::Blocks::Mapping char * buffer = new char [fileLen + 1]; buffer [fileLen] = 0; - assert (buffer != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (buffer != nullptr); //lint !e1924 // c-style cast. MSVC bug if (fread (buffer, fileLen, 1, fl) != 1) { diff --git a/external/ours/library/unicode/src/shared/UnicodeCharacterDataMap.h b/external/ours/library/unicode/src/shared/UnicodeCharacterDataMap.h index ba84cac2..7659b543 100755 --- a/external/ours/library/unicode/src/shared/UnicodeCharacterDataMap.h +++ b/external/ours/library/unicode/src/shared/UnicodeCharacterDataMap.h @@ -117,7 +117,7 @@ namespace Unicode /** * Find a CharData for the given code point. - * @return null if no CharData exists for this code point + * @return nullptr if no CharData exists for this code point */ inline const CharData * CharDataMap::findCharData (const unicode_char_t code) const diff --git a/external/ours/library/unicode/src/shared/UnicodeUtils.cpp b/external/ours/library/unicode/src/shared/UnicodeUtils.cpp index 4417fc0c..7bf90e7d 100755 --- a/external/ours/library/unicode/src/shared/UnicodeUtils.cpp +++ b/external/ours/library/unicode/src/shared/UnicodeUtils.cpp @@ -103,7 +103,7 @@ namespace Unicode } else if (*from == 0x0000) { - // null character + // nullptr character str += static_cast(0x0000); } else if (*from >= 0x0800) diff --git a/external/ours/library/unicode/src/shared/UnicodeUtils.h b/external/ours/library/unicode/src/shared/UnicodeUtils.h index f2a722ae..348bb64f 100755 --- a/external/ours/library/unicode/src/shared/UnicodeUtils.h +++ b/external/ours/library/unicode/src/shared/UnicodeUtils.h @@ -79,8 +79,8 @@ namespace Unicode bool getNthToken (const Unicode::NarrowString & str, const size_t n, size_t & pos, size_t & endpos, Unicode::NarrowString & token, const char * sepChars = ascii_whitespace); size_t skipWhitespace (const Unicode::NarrowString & str, size_t pos, const char * white = ascii_whitespace); - bool tokenize (const Unicode::String & theStr, UnicodeStringVector & result, Unicode::String const * const delimiters = NULL, Unicode::String const * const separators = NULL); - bool tokenize (const Unicode::String & theStr, UnicodeStringVector & result, const size_t tokenPos, size_t & whichToken, size_t & token_start, size_t & token_end, Unicode::String const * const delimiters = NULL, Unicode::String const * const separators = NULL); + bool tokenize (const Unicode::String & theStr, UnicodeStringVector & result, Unicode::String const * const delimiters = nullptr, Unicode::String const * const separators = nullptr); + bool tokenize (const Unicode::String & theStr, UnicodeStringVector & result, const size_t tokenPos, size_t & whichToken, size_t & token_start, size_t & token_end, Unicode::String const * const delimiters = nullptr, Unicode::String const * const separators = nullptr); bool isUnicode (const Unicode::String & theStr); diff --git a/external/ours/library/unicode/src/shared/utf8.cpp b/external/ours/library/unicode/src/shared/utf8.cpp index 75901043..3a19d82a 100755 --- a/external/ours/library/unicode/src/shared/utf8.cpp +++ b/external/ours/library/unicode/src/shared/utf8.cpp @@ -96,7 +96,7 @@ int UTF8_convertCharToUTF16( char * ptr , UTF16 * ret ) int UTF8_convertToUTF16( char * ptr , UTF16 * ret, int limit ) { int len = 0; - while (( *ptr != 0 ) && ( len < ( limit - 1 ) ))//we use limit -1 to leave room for the null terminator + while (( *ptr != 0 ) && ( len < ( limit - 1 ) ))//we use limit -1 to leave room for the nullptr terminator { int clen = UTF8_convertCharToUTF16( ptr, ret ); if (clen == 0) diff --git a/game/server/application/SwgDatabaseServer/src/linux/main.cpp b/game/server/application/SwgDatabaseServer/src/linux/main.cpp index 9878eed1..71cc11b2 100755 --- a/game/server/application/SwgDatabaseServer/src/linux/main.cpp +++ b/game/server/application/SwgDatabaseServer/src/linux/main.cpp @@ -43,7 +43,7 @@ int main(int argc, char ** argv) SetupSharedFoundation::install (setupFoundationData); SetupSharedFile::install(false); - SetupSharedRandom::install(time(NULL)); + SetupSharedRandom::install(time(nullptr)); SetupSharedNetwork::SetupData networkSetupData; SetupSharedNetwork::getDefaultServerSetupData(networkSetupData); SetupSharedNetwork::install(networkSetupData); diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/AuctionLocationsBuffer.cpp b/game/server/application/SwgDatabaseServer/src/shared/buffers/AuctionLocationsBuffer.cpp index c0baa227..ec5603db 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/AuctionLocationsBuffer.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/buffers/AuctionLocationsBuffer.cpp @@ -30,7 +30,7 @@ AuctionLocationsBuffer::~AuctionLocationsBuffer(void) for (IndexType::iterator i=m_rows.begin(); i!=m_rows.end(); ++i) { delete i->second; - i->second=NULL; + i->second=nullptr; } } @@ -56,7 +56,7 @@ void AuctionLocationsBuffer::removeAuctionLocations(const NetworkId &locationId) if (i!=m_rows.end()) { delete i->second; - i->second=NULL; + i->second=nullptr; m_rows.erase(i); } } diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/BattlefieldParticipantBuffer.cpp b/game/server/application/SwgDatabaseServer/src/shared/buffers/BattlefieldParticipantBuffer.cpp index 7abc8164..41038e8a 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/BattlefieldParticipantBuffer.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/buffers/BattlefieldParticipantBuffer.cpp @@ -30,7 +30,7 @@ BattlefieldParticipantBuffer::~BattlefieldParticipantBuffer(void) for (IndexType::iterator i=m_rows.begin(); i!=m_rows.end(); ++i) { delete i->second; - i->second=NULL; + i->second=nullptr; } } @@ -156,7 +156,7 @@ void BattlefieldParticipantBuffer::removeObject(const NetworkId &object) IndexType::iterator next=i; ++next; delete i->second; - i->second=NULL; + i->second=nullptr; m_rows.erase(i); i=next; } diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/BountyHunterTargetBuffer.cpp b/game/server/application/SwgDatabaseServer/src/shared/buffers/BountyHunterTargetBuffer.cpp index 4098e2c3..16d361fe 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/BountyHunterTargetBuffer.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/buffers/BountyHunterTargetBuffer.cpp @@ -31,7 +31,7 @@ BountyHunterTargetBuffer::~BountyHunterTargetBuffer() for (DataType::iterator i=m_data.begin(); i!=m_data.end(); ++i) { delete i->second; - i->second=NULL; + i->second=nullptr; } } diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/CreatureObjectBuffer.cpp b/game/server/application/SwgDatabaseServer/src/shared/buffers/CreatureObjectBuffer.cpp index 10556590..92dcbbfd 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/CreatureObjectBuffer.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/buffers/CreatureObjectBuffer.cpp @@ -238,7 +238,7 @@ void CreatureObjectBuffer::getAttributesForObject(const NetworkId &objectId, std } if (value == -999) { - WARNING(true,("Object %s had null attribute %i, defaulting to 100",objectId.getValueString().c_str(), position)); + WARNING(true,("Object %s had nullptr attribute %i, defaulting to 100",objectId.getValueString().c_str(), position)); value = 100; } diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/ExperienceBuffer.cpp b/game/server/application/SwgDatabaseServer/src/shared/buffers/ExperienceBuffer.cpp index 5c361b16..ffd4068f 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/ExperienceBuffer.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/buffers/ExperienceBuffer.cpp @@ -31,7 +31,7 @@ ExperienceBuffer::~ExperienceBuffer(void) for (IndexType::iterator i=m_rows.begin(); i!=m_rows.end(); ++i) { delete i->second; - i->second=NULL; + i->second=nullptr; } } @@ -157,7 +157,7 @@ void ExperienceBuffer::removeObject(const NetworkId &object) IndexType::iterator next=i; ++next; delete i->second; - i->second=NULL; + i->second=nullptr; m_rows.erase(i); i=next; } diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/IndexedNetworkTableBuffer.h b/game/server/application/SwgDatabaseServer/src/shared/buffers/IndexedNetworkTableBuffer.h index 5180b92a..65ba2205 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/IndexedNetworkTableBuffer.h +++ b/game/server/application/SwgDatabaseServer/src/shared/buffers/IndexedNetworkTableBuffer.h @@ -103,7 +103,7 @@ IndexedNetworkTableBuffer::~IndexedNetworkTable { delete i->second; ++m_sRowsDeleted; - i->second=NULL; + i->second=nullptr; } } @@ -161,7 +161,7 @@ void IndexedNetworkTableBuffer::removeObject(co { delete i->second; ++m_sRowsDeleted; - i->second=NULL; + i->second=nullptr; m_rows.erase(i); } } diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/ManufactureSchematicAttributeBuffer.cpp b/game/server/application/SwgDatabaseServer/src/shared/buffers/ManufactureSchematicAttributeBuffer.cpp index 12c4e790..487169ef 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/ManufactureSchematicAttributeBuffer.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/buffers/ManufactureSchematicAttributeBuffer.cpp @@ -31,7 +31,7 @@ ManufactureSchematicAttributeBuffer::~ManufactureSchematicAttributeBuffer(void) for (IndexType::iterator i=m_rows.begin(); i!=m_rows.end(); ++i) { delete i->second; - i->second=NULL; + i->second=nullptr; } } @@ -174,7 +174,7 @@ void ManufactureSchematicAttributeBuffer::removeObject(const NetworkId &object) IndexType::iterator next=i; ++next; delete i->second; - i->second=NULL; + i->second=nullptr; m_rows.erase(i); i=next; } diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/MarketAuctionBidsBuffer.cpp b/game/server/application/SwgDatabaseServer/src/shared/buffers/MarketAuctionBidsBuffer.cpp index 3a024651..65d95c48 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/MarketAuctionBidsBuffer.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/buffers/MarketAuctionBidsBuffer.cpp @@ -31,7 +31,7 @@ MarketAuctionBidsBuffer::~MarketAuctionBidsBuffer(void) for (IndexType::iterator i=m_rows.begin(); i!=m_rows.end(); ++i) { delete i->second; - i->second=NULL; + i->second=nullptr; } } @@ -57,7 +57,7 @@ void MarketAuctionBidsBuffer::removeMarketAuctionBids(const NetworkId &itemId) if (i!=m_rows.end()) { delete i->second; - i->second=NULL; + i->second=nullptr; m_rows.erase(i); } } diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/MarketAuctionsBuffer.cpp b/game/server/application/SwgDatabaseServer/src/shared/buffers/MarketAuctionsBuffer.cpp index 8663d1ef..b8529107 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/MarketAuctionsBuffer.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/buffers/MarketAuctionsBuffer.cpp @@ -31,7 +31,7 @@ MarketAuctionsBufferCreate::~MarketAuctionsBufferCreate(void) for (IndexType::iterator i=m_rows.begin(); i!=m_rows.end(); ++i) { delete i->second; - i->second=NULL; + i->second=nullptr; } } @@ -217,7 +217,7 @@ MarketAuctionsBufferDelete::~MarketAuctionsBufferDelete(void) for (IndexType::iterator i=m_rows.begin(); i!=m_rows.end(); ++i) { delete i->second; - i->second=NULL; + i->second=nullptr; } } @@ -330,7 +330,7 @@ MarketAuctionsBufferUpdate::~MarketAuctionsBufferUpdate(void) for (IndexType::iterator i=m_rows.begin(); i!=m_rows.end(); ++i) { delete i->second; - i->second=NULL; + i->second=nullptr; } } diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/ObjectTableBuffer.cpp b/game/server/application/SwgDatabaseServer/src/shared/buffers/ObjectTableBuffer.cpp index 4491b654..b3d787d0 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/ObjectTableBuffer.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/buffers/ObjectTableBuffer.cpp @@ -265,11 +265,11 @@ bool ObjectTableBuffer::save(DB::Session *session) #if 0 // Enable this to debug load_with problems DEBUG_REPORT_LOG(true,("Save object %s ",i->second->object_id.getValue().getValueString().c_str())); if (i->second->contained_by.isNull()) - DEBUG_REPORT_LOG(true, ("contained_by NULL ")); + DEBUG_REPORT_LOG(true, ("contained_by nullptr ")); else DEBUG_REPORT_LOG(true, ("contained_by %s ",i->second->contained_by.getValue().getValueString().c_str())); if (i->second->load_with.isNull()) - DEBUG_REPORT_LOG(true,("load_with NULL\n")); + DEBUG_REPORT_LOG(true,("load_with nullptr\n")); else DEBUG_REPORT_LOG(true,("load_with %s\n",i->second->load_with.getValue().getValueString().c_str())); #endif @@ -671,7 +671,7 @@ void ObjectTableBuffer::getObjvarsForObject(const NetworkId &objectId, std::vect int ObjectTableBuffer::encodeObjVarFreeFlags(const NetworkId & objectId) const { const DBSchema::ObjectBufferRow *row=findConstRowByIndex(objectId); - WARNING_STRICT_FATAL(row==NULL,("Loading object %s, no ObjectRow in the buffer\n",objectId.getValueString().c_str())); + WARNING_STRICT_FATAL(row==nullptr,("Loading object %s, no ObjectRow in the buffer\n",objectId.getValueString().c_str())); if (!row) return 0; diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/ResourceTypeBuffer.cpp b/game/server/application/SwgDatabaseServer/src/shared/buffers/ResourceTypeBuffer.cpp index 0784be9b..fe6cca4f 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/ResourceTypeBuffer.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/buffers/ResourceTypeBuffer.cpp @@ -31,7 +31,7 @@ ResourceTypeBuffer::~ResourceTypeBuffer() for (DataType::iterator i=m_data.begin(); i!=m_data.end(); ++i) { delete i->second; - i->second=NULL; + i->second=nullptr; } } @@ -41,7 +41,7 @@ void ResourceTypeBuffer::handleAddResourceTypeMessage(AddResourceTypeMessage con { for (std::vector::const_iterator typeData = message.getData().begin(); typeData != message.getData().end(); ++typeData) { - DBSchema::ResourceTypeRow * row = NULL; + DBSchema::ResourceTypeRow * row = nullptr; DataType::iterator rowIter = m_data.find(typeData->m_networkId); if (rowIter == m_data.end()) { diff --git a/game/server/application/SwgDatabaseServer/src/shared/cleanup/TaskObjectTemplateListUpdater.cpp b/game/server/application/SwgDatabaseServer/src/shared/cleanup/TaskObjectTemplateListUpdater.cpp index 7b73fc9b..f4653cd9 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/cleanup/TaskObjectTemplateListUpdater.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/cleanup/TaskObjectTemplateListUpdater.cpp @@ -45,7 +45,7 @@ bool TaskObjectTemplateListUpdater::process(DB::Session *session) strcpy(s_sql,"commit"); else if ( i_retval == 2 ) // got ID & Name { - s_name[256]=0; // null term to make sure it fits + s_name[256]=0; // nullptr term to make sure it fits sprintf(s_sql,"insert into object_templates values (%d,'%s')",i_id,s_name); } else diff --git a/game/server/application/SwgDatabaseServer/src/shared/core/CMLoader.cpp b/game/server/application/SwgDatabaseServer/src/shared/core/CMLoader.cpp index 405d6a80..56ac35e8 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/core/CMLoader.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/core/CMLoader.cpp @@ -25,7 +25,7 @@ #include "TaskGetLocationList.h" #include "TaskGetBidList.h" -CMLoader *CMLoader::ms_instance = NULL; +CMLoader *CMLoader::ms_instance = nullptr; // ====================================================================== @@ -42,7 +42,7 @@ void CMLoader::remove() { NOT_NULL(ms_instance); delete ms_instance; - ms_instance = NULL; + ms_instance = nullptr; } // ---------------------------------------------------------------------- diff --git a/game/server/application/SwgDatabaseServer/src/shared/core/ObjvarNameManager.cpp b/game/server/application/SwgDatabaseServer/src/shared/core/ObjvarNameManager.cpp index d5955036..e442f568 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/core/ObjvarNameManager.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/core/ObjvarNameManager.cpp @@ -17,8 +17,8 @@ // ====================================================================== -ObjvarNameManager * ObjvarNameManager::ms_instance = NULL; -ObjvarNameManager * ObjvarNameManager::ms_goldInstance = NULL; +ObjvarNameManager * ObjvarNameManager::ms_instance = nullptr; +ObjvarNameManager * ObjvarNameManager::ms_goldInstance = nullptr; // ====================================================================== @@ -37,11 +37,11 @@ void ObjvarNameManager::remove() { NOT_NULL(ms_instance); delete ms_instance; - ms_instance = NULL; + ms_instance = nullptr; NOT_NULL(ms_goldInstance); delete ms_goldInstance; - ms_goldInstance = NULL; + ms_goldInstance = nullptr; } // ---------------------------------------------------------------------- @@ -64,9 +64,9 @@ ObjvarNameManager::~ObjvarNameManager() delete m_nameToIdMap; delete m_idToNameMap; delete m_newNames; - m_nameToIdMap=NULL; - m_idToNameMap=NULL; - m_newNames=NULL; + m_nameToIdMap=nullptr; + m_idToNameMap=nullptr; + m_newNames=nullptr; } // ---------------------------------------------------------------------- @@ -169,7 +169,7 @@ DB::TaskRequest *ObjvarNameManager::saveNewNames() return task; } else - return NULL; + return nullptr; } // ====================================================================== diff --git a/game/server/application/SwgDatabaseServer/src/shared/core/SwgLoader.cpp b/game/server/application/SwgDatabaseServer/src/shared/core/SwgLoader.cpp index 206cd1ee..99d689d9 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/core/SwgLoader.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/core/SwgLoader.cpp @@ -29,9 +29,9 @@ void SwgLoader::install() SwgLoader::SwgLoader() : Loader(), - m_pendingTaskVerifyCharacter(NULL), - m_loadingTaskVerifyCharacter(NULL), - m_verifyCharacterTaskQ(NULL) + m_pendingTaskVerifyCharacter(nullptr), + m_loadingTaskVerifyCharacter(nullptr), + m_verifyCharacterTaskQ(nullptr) { m_verifyCharacterTaskQ = new DB::TaskQueue(1,DatabaseProcess::getInstance().getDBServer(),4); } @@ -95,7 +95,7 @@ void SwgLoader::update(real updateTime) if (m_pendingTaskVerifyCharacter && !m_loadingTaskVerifyCharacter) { m_loadingTaskVerifyCharacter = m_pendingTaskVerifyCharacter; - m_pendingTaskVerifyCharacter = NULL; + m_pendingTaskVerifyCharacter = nullptr; m_verifyCharacterTaskQ->asyncRequest(m_loadingTaskVerifyCharacter); } @@ -109,7 +109,7 @@ void SwgLoader::verifyCharacterFinished (TaskVerifyCharacter *task) { UNREF(task); DEBUG_FATAL(task!=m_loadingTaskVerifyCharacter,("Programmer bug: wrong TaskVerifyCharacter finished.\n")); - m_loadingTaskVerifyCharacter = NULL; + m_loadingTaskVerifyCharacter = nullptr; } // ---------------------------------------------------------------------- diff --git a/game/server/application/SwgDatabaseServer/src/shared/core/SwgPersister.cpp b/game/server/application/SwgDatabaseServer/src/shared/core/SwgPersister.cpp index 216a6aec..a792d1b5 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/core/SwgPersister.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/core/SwgPersister.cpp @@ -110,7 +110,7 @@ void SwgPersister::moveToPlayer(const NetworkId &oid, const NetworkId &player, c void SwgPersister::getMoneyFromOfflineObject(uint32 replyServer, NetworkId const & sourceObject, int amount, NetworkId const & replyTo, std::string const & successCallback, std::string const & failCallback, stdvector::fwd const & packedDictionary) { - SwgSnapshot * snapshot=NULL; + SwgSnapshot * snapshot=nullptr; if (hasDataForObject(sourceObject)) snapshot=safe_cast(&getSnapshotForObject(sourceObject, 0)); diff --git a/game/server/application/SwgDatabaseServer/src/shared/core/SwgSnapshot.cpp b/game/server/application/SwgDatabaseServer/src/shared/core/SwgSnapshot.cpp index b5e7e461..ccb9ccad 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/core/SwgSnapshot.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/core/SwgSnapshot.cpp @@ -96,8 +96,8 @@ SwgSnapshot::SwgSnapshot(DB::ModeQuery::Mode mode, bool useGoldDatabase) : m_vehicleObjectBuffer(mode), m_waypointBuffer(mode), m_weaponObjectBuffer(mode), - m_immediateDeleteStep(NULL), - m_offlineMoneyCustomPersistStep(NULL) + m_immediateDeleteStep(nullptr), + m_offlineMoneyCustomPersistStep(nullptr) { m_bufferList.push_back(&m_battlefieldMarkerObjectBuffer); m_bufferList.push_back(&m_battlefieldParticipantBuffer); @@ -290,10 +290,10 @@ void SwgSnapshot::decodeScriptObject(NetworkId const & objectId, Archive::ReadIt Archive::get(data,packedScriptList); if (packedScriptList.length()==0) - packedScriptList=' '; // avoid confusing an empty list with NULL + packedScriptList=' '; // avoid confusing an empty list with nullptr DBSchema::ObjectBufferRow *row=m_objectTableBuffer.findRowByIndex(objectId); - if (row==NULL) + if (row==nullptr) row=m_objectTableBuffer.addEmptyRow(objectId); row->script_list=packedScriptList; diff --git a/game/server/application/SwgDatabaseServer/src/shared/queries/CommoditiesQuery.cpp b/game/server/application/SwgDatabaseServer/src/shared/queries/CommoditiesQuery.cpp index 9a245c47..f5ae1da4 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/queries/CommoditiesQuery.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/queries/CommoditiesQuery.cpp @@ -90,7 +90,7 @@ bool AuctionLocationsQuery::setupData(DB::Session *session) bool AuctionLocationsQuery::addData(const DB::Row *_data) { const AuctionLocationsRow *myData=dynamic_cast(_data); - FATAL(myData == NULL, ("Adding NULL data into AuctionLocations")); + FATAL(myData == nullptr, ("Adding nullptr data into AuctionLocations")); switch(mode) { case mode_UPDATE: @@ -413,7 +413,7 @@ bool MarketAuctionsQuery::addData(const DB::Row *_data) case mode_UPDATE: { const MarketAuctionsRowUpdate *myData=dynamic_cast(_data); - FATAL(myData == NULL, ("Adding NULL data into MarketAuctions for mode_UPDATE")); + FATAL(myData == nullptr, ("Adding nullptr data into MarketAuctions for mode_UPDATE")); if (!m_item_ids.push_back(myData->item_id.getValueASCII())) return false; if (!m_owner_ids.push_back(myData->owner_id.getValueASCII())) return false; @@ -424,7 +424,7 @@ bool MarketAuctionsQuery::addData(const DB::Row *_data) case mode_INSERT: { const MarketAuctionsRow *myData=dynamic_cast(_data); - FATAL(myData == NULL, ("Adding NULL data into MarketAuctions for mode_INSERT")); + FATAL(myData == nullptr, ("Adding nullptr data into MarketAuctions for mode_INSERT")); if (!m_item_ids.push_back(myData->item_id.getValueASCII())) return false; if (!m_owner_ids.push_back(myData->owner_id.getValueASCII())) return false; @@ -450,7 +450,7 @@ bool MarketAuctionsQuery::addData(const DB::Row *_data) case mode_DELETE: { const MarketAuctionsRowDelete *myData=dynamic_cast(_data); - FATAL(myData == NULL, ("Adding NULL data into MarketAuctions for mode_DELETE")); + FATAL(myData == nullptr, ("Adding nullptr data into MarketAuctions for mode_DELETE")); if (!m_item_ids.push_back(myData->item_id.getValueASCII())) return false; break; @@ -716,7 +716,7 @@ bool MarketAuctionBidsQuery::addData(const DB::Row *_data) { const MarketAuctionBidsRow *myData=dynamic_cast(_data); - FATAL(myData == NULL, ("Adding NULL data into MarketAuctionBids")); + FATAL(myData == nullptr, ("Adding nullptr data into MarketAuctionBids")); switch(mode) { diff --git a/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskSaveObjvarNames.cpp b/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskSaveObjvarNames.cpp index f30e0962..d809771f 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskSaveObjvarNames.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskSaveObjvarNames.cpp @@ -24,7 +24,7 @@ TaskSaveObjvarNames::TaskSaveObjvarNames(const NameList &names) : TaskSaveObjvarNames::~TaskSaveObjvarNames() { delete m_objvarNames; - m_objvarNames=NULL; + m_objvarNames=nullptr; } // ---------------------------------------------------------------------- diff --git a/game/server/application/SwgGameServer/src/shared/combat/CombatEngine.cpp b/game/server/application/SwgGameServer/src/shared/combat/CombatEngine.cpp index 50a12bbb..4f4269cd 100755 --- a/game/server/application/SwgGameServer/src/shared/combat/CombatEngine.cpp +++ b/game/server/application/SwgGameServer/src/shared/combat/CombatEngine.cpp @@ -102,7 +102,7 @@ void CombatEngine::aim(const Command &, const NetworkId & actor, const NetworkId CachedNetworkId attackerId(actor); TangibleObject * attacker = dynamic_cast(attackerId.getObject()); - if (attacker != NULL) + if (attacker != nullptr) { attacker->addAim(); } @@ -121,7 +121,7 @@ bool CombatEngine::addTargetAction(TangibleObject & attacker, { // @todo: support tangible attacks CreatureObject * const creatureAttacker = attacker.asCreatureObject (); - if (creatureAttacker == NULL) + if (creatureAttacker == nullptr) { WARNING_STRICT_FATAL(true, ("Tangible attackers not supported yet")); return false; @@ -146,7 +146,7 @@ bool CombatEngine::addAttackAction(TangibleObject & attacker, { // @todo: support tangible attacks CreatureObject * const creatureAttacker = attacker.asCreatureObject (); - if (creatureAttacker == NULL) + if (creatureAttacker == nullptr) { WARNING_STRICT_FATAL(true, ("Tangible attackers not supported yet")); return false; @@ -176,7 +176,7 @@ bool CombatEngine::addAimAction(TangibleObject & attacker) // @todo: support tangible attacks CreatureObject * const creatureAttacker = attacker.asCreatureObject (); - if (creatureAttacker == NULL) + if (creatureAttacker == nullptr) { WARNING_STRICT_FATAL(true, ("Tangible attackers not supported yet")); return false; @@ -203,7 +203,7 @@ bool CombatEngine::onSuccessfulAttack(const TangibleObject & attacker, TangibleObject & defender, const WeaponObject & weapon, int damageAmount, int hitLocation) { - const bool creatureDefender = defender.asCreatureObject() != NULL; + const bool creatureDefender = defender.asCreatureObject() != nullptr; const bool isVehicle = GameObjectTypes::isTypeOf (defender.getGameObjectType (), SharedObjectTemplate::GOT_vehicle); // if attacking an object, always hit location 0 @@ -262,9 +262,9 @@ bool CombatEngine::onSuccessfulAttack(const TangibleObject & attacker, } else { - TangibleController * const tangibleController = (defender.getController() != NULL) ? defender.getController()->asTangibleController() : NULL; + TangibleController * const tangibleController = (defender.getController() != nullptr) ? defender.getController()->asTangibleController() : nullptr; - if (tangibleController == NULL) + if (tangibleController == nullptr) { WARNING_STRICT_FATAL(true, ("CombatEngine::onSuccessfulAttack non-auth " "defender %s doesn't have a TangibleController!", @@ -311,7 +311,7 @@ bool CombatEngine::onSuccessfulAttack(const TangibleObject & attacker, TangibleObject & defender, int damageAmount, int hitLocation) { - const bool creatureDefender = defender.asCreatureObject() != NULL; + const bool creatureDefender = defender.asCreatureObject() != nullptr; const bool isVehicle = GameObjectTypes::isTypeOf (defender.getGameObjectType (), SharedObjectTemplate::GOT_vehicle); // if attacking an object, always hit location 0 @@ -359,9 +359,9 @@ bool CombatEngine::onSuccessfulAttack(const TangibleObject & attacker, } else { - TangibleController * const tangibleController = (defender.getController() != NULL) ? defender.getController()->asTangibleController() : NULL; + TangibleController * const tangibleController = (defender.getController() != nullptr) ? defender.getController()->asTangibleController() : nullptr; - if (tangibleController == NULL) + if (tangibleController == nullptr) { WARNING_STRICT_FATAL(true, ("CombatEngine::onSuccessfulAttack non-auth " "defender %s doesn't have a TangibleController!", @@ -411,7 +411,7 @@ bool CombatEngine::damage(TangibleObject & defender, const WeaponObject & weapon const bool isVehicle = GameObjectTypes::isTypeOf (defender.getGameObjectType (), SharedObjectTemplate::GOT_vehicle); // if attacking an object, always hit location 0 - if (critter == NULL || isVehicle) + if (critter == nullptr || isVehicle) hitLocation = 0; // get the damage profile for the hit location @@ -425,7 +425,7 @@ bool CombatEngine::damage(TangibleObject & defender, const WeaponObject & weapon // put a attribMod structure on the defender's damage list for each type of // damage received DamageList damageList; - if (critter != NULL && !isVehicle) + if (critter != nullptr && !isVehicle) { computeCreatureDamage(&hitLocationData, damageAmount, damageList); } @@ -456,7 +456,7 @@ bool CombatEngine::damage(TangibleObject & defender, const WeaponObject & weapon damageData.damage.insert(damageData.damage.end(), damageList.begin(), damageList.end()); damageData.wounded = isWounded; - if (critter != NULL || !defender.isDisabled()) + if (critter != nullptr || !defender.isDisabled()) { // update the object's hit points or attributes for the damage defender.applyDamage(damageData); @@ -485,7 +485,7 @@ void CombatEngine::damage(TangibleObject & defender, const bool isVehicle = GameObjectTypes::isTypeOf (defender.getGameObjectType (), SharedObjectTemplate::GOT_vehicle); // if attacking an object, always hit location 0 - if (critter == NULL || isVehicle) + if (critter == nullptr || isVehicle) hitLocation = 0; // get the damage profile for the hit location @@ -514,7 +514,7 @@ void CombatEngine::damage(TangibleObject & defender, damageData.hitLocationIndex = hitLocation; damageData.damage.insert(damageData.damage.end(), damageList.begin(), damageList.end()); - if (critter != NULL || !defender.isDisabled()) + if (critter != nullptr || !defender.isDisabled()) { // update the object's hit points or attributes for the damage defender.applyDamage(damageData); @@ -668,7 +668,7 @@ void CombatEngine::alter(TangibleObject & object) { NOT_NULL(object.getController()); - if ( (object.getCombatData() == NULL) + if ( (object.getCombatData() == nullptr) || object.getCombatData()->defenseData.damage.empty()) { return; @@ -682,7 +682,7 @@ void CombatEngine::alter(TangibleObject & object) // if the object is a creature, get it's attributes Attributes::Value currentAttribs[Attributes::NumberOfAttributes]; CreatureObject * const critter = object.asCreatureObject (); - if (critter != NULL) + if (critter != nullptr) { for (int i = 0; i < Attributes::NumberOfAttributes; ++i) currentAttribs[i] = critter->getAttribute(i); @@ -710,7 +710,7 @@ void CombatEngine::alter(TangibleObject & object) { TangibleController * const tangibleController = object.getController()->asTangibleController(); - if (tangibleController == NULL) + if (tangibleController == nullptr) { WARNING_STRICT_FATAL(true, ("CombatEngine::alter non-auth " "object %s doesn't have a TangibleController!", diff --git a/game/server/application/SwgGameServer/src/shared/controller/JediManagerController.cpp b/game/server/application/SwgGameServer/src/shared/controller/JediManagerController.cpp index 80099996..defcc868 100755 --- a/game/server/application/SwgGameServer/src/shared/controller/JediManagerController.cpp +++ b/game/server/application/SwgGameServer/src/shared/controller/JediManagerController.cpp @@ -40,7 +40,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_removeJedi: { const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if (msg != NULL) + if (msg != nullptr) { owner->removeJedi(msg->getValue()); } @@ -49,7 +49,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_addJedi: { const MessageQueueJediData * const msg = safe_cast(data); - if (msg != NULL) + if (msg != nullptr) { owner->addJedi(msg->getId(), msg->getName(), @@ -69,7 +69,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_updateJedi: { const MessageQueueJediData * const msg = safe_cast(data); - if (msg != NULL) + if (msg != nullptr) { owner->updateJedi(msg->getId(), msg->getVisibility(), @@ -83,7 +83,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_updateJediState: { const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); - if (msg != NULL) + if (msg != nullptr) { owner->updateJedi(msg->getValue().first, static_cast(msg->getValue().second) @@ -95,7 +95,7 @@ void JediManagerController::handleMessage (const int message, const float value, { /* const MessageQueueGenericValueType > > * const msg = safe_cast > > *>(data); - if (msg != NULL) + if (msg != nullptr) { owner->updateJedi(msg->getValue().first, msg->getValue().second @@ -107,7 +107,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_updateJediLocation: { const MessageQueueJediLocation * const msg = safe_cast(data); - if (msg != NULL) + if (msg != nullptr) { owner->updateJediLocation(msg->getId(), msg->getLocation(), @@ -119,7 +119,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_setJediOffline: { const MessageQueueJediLocation * const msg = safe_cast(data); - if (msg != NULL) + if (msg != nullptr) { owner->setJediOffline(msg->getId(), msg->getLocation(), @@ -131,7 +131,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_requestJediBounty: { const MessageQueueRequestJediBounty * const msg = safe_cast(data); - if (msg != NULL) + if (msg != nullptr) { owner->requestJediBounty(msg->getTargetId(), msg->getHunterId(), @@ -145,7 +145,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_removeJediBounty: { const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); - if (msg != NULL) + if (msg != nullptr) { owner->removeJediBounty(msg->getValue().first, msg->getValue().second); } @@ -154,7 +154,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_removeAllJediBounties: { const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if (msg != NULL) + if (msg != nullptr) { owner->removeAllJediBounties(msg->getValue()); } @@ -163,7 +163,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_updateJediSpentJediSkillPoints: { const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); - if (msg != NULL) + if (msg != nullptr) { owner->updateJediSpentJediSkillPoints(msg->getValue().first, msg->getValue().second); } @@ -172,7 +172,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_updateJediFaction: { const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); - if (msg != NULL) + if (msg != nullptr) { owner->updateJediFaction(msg->getValue().first, msg->getValue().second); } @@ -181,7 +181,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_updateJediScriptData: { const MessageQueueGenericValueType > > * const msg = safe_cast > > *>(data); - if (msg != NULL) + if (msg != nullptr) { owner->updateJediScriptData(msg->getValue().first, msg->getValue().second.first, msg->getValue().second.second); } @@ -190,7 +190,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_removeJediScriptData: { const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); - if (msg != NULL) + if (msg != nullptr) { owner->removeJediScriptData(msg->getValue().first, msg->getValue().second); } diff --git a/game/server/application/SwgGameServer/src/shared/controller/SwgPlayerCreatureController.cpp b/game/server/application/SwgGameServer/src/shared/controller/SwgPlayerCreatureController.cpp index dea874be..1e417386 100755 --- a/game/server/application/SwgGameServer/src/shared/controller/SwgPlayerCreatureController.cpp +++ b/game/server/application/SwgGameServer/src/shared/controller/SwgPlayerCreatureController.cpp @@ -40,7 +40,7 @@ void SwgPlayerCreatureController::handleMessage (const int message, const float case CM_setJediState: { const MessageQueueGenericValueType * const msg = dynamic_cast *>(data); - if (msg != NULL) + if (msg != nullptr) playerOwner->setJediState(static_cast(msg->getValue())); } break; diff --git a/game/server/application/SwgGameServer/src/shared/core/CSHandler.cpp b/game/server/application/SwgGameServer/src/shared/core/CSHandler.cpp index 5bb0356e..869755e9 100755 --- a/game/server/application/SwgGameServer/src/shared/core/CSHandler.cpp +++ b/game/server/application/SwgGameServer/src/shared/core/CSHandler.cpp @@ -767,7 +767,7 @@ CS_CMD( create_crafted_object ) if( !( target && target->isAuthoritative() ) ) return; ServerObject *inventory = target->getInventory(); - if( inventory == NULL ) + if( inventory == nullptr ) return; DEBUG_REPORT_LOG( true, ( "Trying to make %s\n", args[ 1 ].c_str())); GameScriptObject * script = target->getScriptObject(); @@ -1116,7 +1116,7 @@ CS_CMD( delete_object ) const NetworkId oid (args[0]); ServerObject *object = ServerObject::getServerObject( oid ); - if (object == NULL) + if (object == nullptr) { return; } @@ -1174,7 +1174,7 @@ CS_CMD( rename_player ) } if( player_id.isValid() ) { - // null id to pass to the playercreationmanager. + // nullptr id to pass to the playercreationmanager. NetworkId source( "0" ); DEBUG_REPORT_LOG( true, ( "Attempting to rename %s.", args[ 0 ].c_str() ) ); @@ -1213,7 +1213,7 @@ CS_CMD( set_bank_credits ) CreatureObject* creatureActor = CreatureObject::getCreatureObject(player_id); PlayerObject const * const player = PlayerCreatureController::getPlayerObject(creatureActor); - if( ( player != NULL ) && ( player->isAuthoritative() ) ) + if( ( player != nullptr ) && ( player->isAuthoritative() ) ) { amount -= creatureActor->getBankBalance(); DEBUG_REPORT_LOG( true, ( "Amount to modify by: %d (%d current balance)\n", amount, creatureActor->getBankBalance() ) ); @@ -1270,7 +1270,7 @@ CS_CMD( get_pc_info ) if(bindId != NetworkId::cms_invalid) { const ServerObject* const bindObject = ServerObject::getServerObject(bindId); - if (bindObject != NULL) + if (bindObject != nullptr) { bindLoc = bindObject->getPosition_w(); snprintf( stringbuffer, sizeof( stringbuffer ) -1, "%02f %02f %02f", bindLoc.x, bindLoc.y, bindLoc.z ); @@ -1380,11 +1380,11 @@ CS_CMD( get_pc_info ) // residence info PlayerObject const * const player = PlayerCreatureController::getPlayerObject(creatureActor); - if (player != NULL) + if (player != nullptr) { NetworkId houseNetworkId = creatureActor->getHouse(); const ServerObject* const resObject = ServerObject::getServerObject(houseNetworkId); - if (resObject != NULL) + if (resObject != nullptr) { resLoc = resObject->getPosition_w(); snprintf( stringbuffer, sizeof( stringbuffer ) - 1 , "%02f %02f %02f", resLoc.x, resLoc.y, resLoc.z ); diff --git a/game/server/application/SwgGameServer/src/shared/core/SwgGameServer.cpp b/game/server/application/SwgGameServer/src/shared/core/SwgGameServer.cpp index 1b310ffd..1bf01f55 100755 --- a/game/server/application/SwgGameServer/src/shared/core/SwgGameServer.cpp +++ b/game/server/application/SwgGameServer/src/shared/core/SwgGameServer.cpp @@ -55,7 +55,7 @@ SwgGameServer::~SwgGameServer() void SwgGameServer::install() { - DEBUG_FATAL (ms_instance != NULL, ("already installed")); + DEBUG_FATAL (ms_instance != nullptr, ("already installed")); ms_instance = new SwgGameServer; SwgServerUniverse::install(); @@ -110,7 +110,7 @@ void SwgGameServer::receiveMessage(const MessageDispatch::Emitter & source, cons JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager != NULL && jediManager->isAuthoritative()) + if (jediManager != nullptr && jediManager->isAuthoritative()) { jediManager->addJediBounties(*msg); delete msg; @@ -129,7 +129,7 @@ void SwgGameServer::receiveMessage(const MessageDispatch::Emitter & source, cons JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager != NULL) + if (jediManager != nullptr) { jediManager->characterBeingDeleted(msg.getValue()); } diff --git a/game/server/application/SwgGameServer/src/shared/core/SwgServerUniverse.cpp b/game/server/application/SwgGameServer/src/shared/core/SwgServerUniverse.cpp index 3d743c93..98bccf40 100755 --- a/game/server/application/SwgGameServer/src/shared/core/SwgServerUniverse.cpp +++ b/game/server/application/SwgGameServer/src/shared/core/SwgServerUniverse.cpp @@ -26,7 +26,7 @@ void SwgServerUniverse::install() SwgServerUniverse::SwgServerUniverse() : ServerUniverse (), - m_jediManager (NULL) + m_jediManager (nullptr) { } @@ -51,7 +51,7 @@ void SwgServerUniverse::updateAndValidateData() "only be called on the process that is authoritative for UniverseObjects.\n")); // create Jedi manager - if (m_jediManager == NULL) + if (m_jediManager == nullptr) { const ServerObjectTemplate * objTemplate = safe_cast(ObjectTemplateList::fetch(ConfigServerGame::getJediManagerTemplate())); m_jediManager = safe_cast(ServerWorld::createNewObject(*objTemplate, Transform::identity, 0, false)); diff --git a/game/server/application/SwgGameServer/src/shared/object/JediManagerObject.cpp b/game/server/application/SwgGameServer/src/shared/object/JediManagerObject.cpp index f4aa0944..89c24610 100755 --- a/game/server/application/SwgGameServer/src/shared/object/JediManagerObject.cpp +++ b/game/server/application/SwgGameServer/src/shared/object/JediManagerObject.cpp @@ -43,7 +43,7 @@ namespace JediManagerObjectNamespace // the bounty hunter target list loaded from the DB; we store it here // and wait until the JediManagerObject object is created, and then // read it into the JediManagerObject object - const BountyHunterTargetListMessage * s_queuedBountyHunterTargetListFromDB = NULL; + const BountyHunterTargetListMessage * s_queuedBountyHunterTargetListFromDB = nullptr; } using namespace JediManagerObjectNamespace; @@ -151,7 +151,7 @@ void JediManagerObject::onServerUniverseGainedAuthority() addJediBounties(*s_queuedBountyHunterTargetListFromDB); delete s_queuedBountyHunterTargetListFromDB; - s_queuedBountyHunterTargetListFromDB = NULL; + s_queuedBountyHunterTargetListFromDB = nullptr; } } @@ -450,7 +450,7 @@ void JediManagerObject::characterBeingDeleted(const NetworkId & id) ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); @@ -1252,7 +1252,7 @@ void JediManagerObject::requestJediBounty(const NetworkId & targetId, ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); if (success) diff --git a/game/server/application/SwgGameServer/src/shared/object/SwgCreatureObject.cpp b/game/server/application/SwgGameServer/src/shared/object/SwgCreatureObject.cpp index e1ab4b18..18cd7b6e 100755 --- a/game/server/application/SwgGameServer/src/shared/object/SwgCreatureObject.cpp +++ b/game/server/application/SwgGameServer/src/shared/object/SwgCreatureObject.cpp @@ -96,7 +96,7 @@ void SwgCreatureObject::onRemovingFromWorld() if (isAuthoritative() && isPlayerControlled() && (getBountyValue() > 0)) { JediManagerObject * const jediManager = static_cast(ServerUniverse::getInstance()).getJediManager(); - if (jediManager != NULL) + if (jediManager != nullptr) { jediManager->setJediOffline(getNetworkId(), getPosition_w(), getSceneId()); } @@ -116,7 +116,7 @@ void SwgCreatureObject::onPermanentlyDestroyed() if (isAuthoritative() && isPlayerControlled() && (getBountyValue() > 0)) { JediManagerObject * const jediManager = static_cast(ServerUniverse::getInstance()).getJediManager(); - if (jediManager != NULL) + if (jediManager != nullptr) { jediManager->removeJedi(getNetworkId()); } @@ -178,7 +178,7 @@ const int SwgCreatureObject::getSpentJediSkillPoints() const } else { - WARNING(true, ("Creature %s had a null in their skill list", getNetworkId().getValueString().c_str())); + WARNING(true, ("Creature %s had a nullptr in their skill list", getNetworkId().getValueString().c_str())); } } */ @@ -198,7 +198,7 @@ bool SwgCreatureObject::hasBounty(const CreatureObject & target) const { const SwgCreatureObject * swgTarget = dynamic_cast( &target); - if (swgTarget == NULL) + if (swgTarget == nullptr) return false; JediManagerObject * jediManager = static_cast( @@ -296,7 +296,7 @@ void SwgCreatureObject::onAddedToWorld() if (isAuthoritative() && isPlayerControlled() && (getBountyValue() > 0)) { JediManagerObject * jediManager = static_cast(ServerUniverse::getInstance()).getJediManager(); - if (jediManager != NULL) + if (jediManager != nullptr) { jediManager->updateJediLocation(getNetworkId(), getPosition_w(), getSceneId()); } @@ -330,7 +330,7 @@ void SwgCreatureObject::setPvpFaction(Pvp::FactionId factionId) if ((oldId != newId) && isAuthoritative() && isPlayerControlled() && (getBountyValue() > 0)) { JediManagerObject * jediManager = static_cast(ServerUniverse::getInstance()).getJediManager(); - if (jediManager != NULL) + if (jediManager != nullptr) { jediManager->updateJediFaction(getNetworkId(), newId); } diff --git a/game/server/application/SwgGameServer/src/shared/object/SwgPlayerObject.cpp b/game/server/application/SwgGameServer/src/shared/object/SwgPlayerObject.cpp index ef587054..c8c838ec 100755 --- a/game/server/application/SwgGameServer/src/shared/object/SwgPlayerObject.cpp +++ b/game/server/application/SwgGameServer/src/shared/object/SwgPlayerObject.cpp @@ -92,12 +92,12 @@ void SwgPlayerObject::virtualOnSetAuthority() PlayerObject::virtualOnSetAuthority(); const SwgCreatureObject * owner = safe_cast(getCreatureObject()); - if ((owner != NULL) && owner->isPlayerControlled() && (owner->getBountyValue() > 0)) + if ((owner != nullptr) && owner->isPlayerControlled() && (owner->getBountyValue() > 0)) { // tell the Jedi manager our position JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager != NULL) + if (jediManager != nullptr) { jediManager->updateJediLocation(owner->getNetworkId(), owner->getPosition_w(), owner->getSceneId()); @@ -192,7 +192,7 @@ void SwgPlayerObject::updateJediLocationTime(float time) // tell the Jedi manager our position JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager != NULL) + if (jediManager != nullptr) { const CreatureObject * owner = getCreatureObject(); if (owner->isInWorld()) @@ -324,7 +324,7 @@ void SwgPlayerObject::setJediBounties(const std::vector & bounties) // update the Jedi manager JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager != NULL) + if (jediManager != nullptr) { const CreatureObject * owner = getCreatureObject(); jediManager->updateJedi(owner->getNetworkId(), bounties); @@ -351,7 +351,7 @@ bool SwgPlayerObject::getJediBounties(std::vector & bounties) bounties.clear(); SwgCreatureObject * owner = safe_cast(getCreatureObject()); - if (owner != NULL) + if (owner != nullptr) { if (owner->getObjVars().getItem(OBJVAR_JEDI_BOUNTIES, bounties)) { diff --git a/game/server/application/SwgGameServer/src/shared/objectTemplate/ServerJediManagerObjectTemplate.cpp b/game/server/application/SwgGameServer/src/shared/objectTemplate/ServerJediManagerObjectTemplate.cpp index 90edb0a3..aaf9f5a9 100755 --- a/game/server/application/SwgGameServer/src/shared/objectTemplate/ServerJediManagerObjectTemplate.cpp +++ b/game/server/application/SwgGameServer/src/shared/objectTemplate/ServerJediManagerObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag ServerJediManagerObjectTemplate::getTemplateVersion(void) const */ Tag ServerJediManagerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerJediManagerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerJediManagerObjectTemplate::getHighestTemplateVersion @@ -150,12 +150,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/game/server/library/swgServerNetworkMessages/src/shared/core/SetupSwgServerNetworkMessages.cpp b/game/server/library/swgServerNetworkMessages/src/shared/core/SetupSwgServerNetworkMessages.cpp index d93e323f..864e2645 100755 --- a/game/server/library/swgServerNetworkMessages/src/shared/core/SetupSwgServerNetworkMessages.cpp +++ b/game/server/library/swgServerNetworkMessages/src/shared/core/SetupSwgServerNetworkMessages.cpp @@ -235,7 +235,7 @@ namespace SetupSwgServerNetworkMessagesNamespace } MessageQueue::Data* unpackNothing(Archive::ReadIterator &) { - return NULL; + return nullptr; } void packVectorNetworkIdVector(const MessageQueue::Data * data, Archive::ByteStream & target) diff --git a/game/shared/library/swgSharedNetworkMessages/src/shared/combat/MessageQueueCombatAction.cpp b/game/shared/library/swgSharedNetworkMessages/src/shared/combat/MessageQueueCombatAction.cpp index e0c98b96..44559bc5 100755 --- a/game/shared/library/swgSharedNetworkMessages/src/shared/combat/MessageQueueCombatAction.cpp +++ b/game/shared/library/swgSharedNetworkMessages/src/shared/combat/MessageQueueCombatAction.cpp @@ -297,7 +297,7 @@ void MessageQueueCombatAction::debugDump() const bool hasActionName; char actionName[256]; - if (s_actionNameLookupFunction != NULL) + if (s_actionNameLookupFunction != nullptr) { hasActionName = true; (*s_actionNameLookupFunction)(m_actionId, actionName, sizeof(actionName)); @@ -316,9 +316,9 @@ void MessageQueueCombatAction::debugDump() const // Print attacker info. DEBUG_REPORT_LOG(true, ("MQCA: attacker: id =[%s].\n", m_attacker.id.getValueString().c_str())); - DEBUG_REPORT_LOG(true, ("MQCA: attacker: template =[%s].\n", attackerObject ? attackerObject->getObjectTemplateName() : "")); + DEBUG_REPORT_LOG(true, ("MQCA: attacker: template =[%s].\n", attackerObject ? attackerObject->getObjectTemplateName() : "")); DEBUG_REPORT_LOG(true, ("MQCA: attacker: weapon =[%s].\n", m_attacker.weapon.getValueString().c_str())); - DEBUG_REPORT_LOG(true, ("MQCA: attacker: weapon template =[%s].\n", weaponObject ? weaponObject->getObjectTemplateName() : "")); + DEBUG_REPORT_LOG(true, ("MQCA: attacker: weapon template =[%s].\n", weaponObject ? weaponObject->getObjectTemplateName() : "")); DEBUG_REPORT_LOG(true, ("MQCA: attacker: end posture =[%s].\n", Postures::getPostureName(m_attacker.endPosture))); DEBUG_REPORT_LOG(true, ("MQCA: attacker: trailBits =[0x%02x].\n", m_attacker.trailBits)); DEBUG_REPORT_LOG(true, ("MQCA: attacker: client effect id=[%d].\n", m_attacker.clientEffectId)); @@ -341,7 +341,7 @@ void MessageQueueCombatAction::debugDump() const UNREF(defenderObject); DEBUG_REPORT_LOG(true, ("MQCA: defender #%d: id =[%s].\n", i + 1, data.id.getValueString().c_str())); - DEBUG_REPORT_LOG(true, ("MQCA: defender #%d: template =[%s].\n", i + 1, defenderObject ? defenderObject->getObjectTemplateName() : "")); + DEBUG_REPORT_LOG(true, ("MQCA: defender #%d: template =[%s].\n", i + 1, defenderObject ? defenderObject->getObjectTemplateName() : "")); DEBUG_REPORT_LOG(true, ("MQCA: defender #%d: end posture =[%s].\n", i + 1, Postures::getPostureName(data.endPosture))); DEBUG_REPORT_LOG(true, ("MQCA: defender #%d: defense =[%s].\n", i + 1, CombatEngineData::getCombatDefenseName(data.defense))); DEBUG_REPORT_LOG(true, ("MQCA: defender #%d: client effect id=[%d].\n", i + 1, data.clientEffectId)); diff --git a/game/shared/library/swgSharedNetworkMessages/src/shared/core/SetupSwgSharedNetworkMessages.cpp b/game/shared/library/swgSharedNetworkMessages/src/shared/core/SetupSwgSharedNetworkMessages.cpp index fb9785c0..399a513c 100755 --- a/game/shared/library/swgSharedNetworkMessages/src/shared/core/SetupSwgSharedNetworkMessages.cpp +++ b/game/shared/library/swgSharedNetworkMessages/src/shared/core/SetupSwgSharedNetworkMessages.cpp @@ -482,7 +482,7 @@ namespace SetupSwgSharedNetworkMessagesNamespace MessageQueue::Data* unpackNothing(Archive::ReadIterator &) { - return NULL; + return nullptr; } //---------------------------------------------------------------------- diff --git a/game/shared/library/swgSharedUtility/src/shared/CombatEngineData.h b/game/shared/library/swgSharedUtility/src/shared/CombatEngineData.h index 0a86c6ee..118e2167 100755 --- a/game/shared/library/swgSharedUtility/src/shared/CombatEngineData.h +++ b/game/shared/library/swgSharedUtility/src/shared/CombatEngineData.h @@ -139,7 +139,7 @@ namespace CombatEngineData std::vector damage;// list of attribute modifiers this damage // caused, pre armor effectiveness - CachedNetworkId attackerId; // who caused the damage (null for + CachedNetworkId attackerId; // who caused the damage (nullptr for // environmental effects, etc) NetworkId weaponId; // id of the weapon used DamageType damageType; @@ -175,10 +175,10 @@ namespace CombatEngineData inline ActionItem::~ActionItem(void) { - if (type == target && actionData.targetData.targets != NULL) + if (type == target && actionData.targetData.targets != nullptr) { delete[] actionData.targetData.targets; - actionData.targetData.targets = NULL; + actionData.targetData.targets = nullptr; } } // ActionItem::~ActionItem @@ -195,7 +195,7 @@ namespace CombatEngineData actionId(0), wounded(false), ignoreInvulnerable(false) -// combatActionMessage(NULL) +// combatActionMessage(nullptr) { } From 8e2160f33eb008430981188677b502bd23014001 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Thu, 11 Feb 2016 19:44:31 -0600 Subject: [PATCH 011/302] Revert "newer standards prefer nullptr over NULL - this is most of them but there are others too" This reverts commit 3e4cc36e7eef674ac9fcb44d7118cdbacf693076. --- .../Miff/src/linux/InputFileHandler.cpp | 2 +- .../Miff/src/linux/OutputFileHandler.cpp | 4 +- .../application/Miff/src/linux/miff.cpp | 12 +- .../src/shared/AuctionTransferClient.cpp | 2 +- .../ATGenericAPI/GenericApiCore.cpp | 16 +- .../ATGenericAPI/GenericConnection.cpp | 20 +- .../AuctionTransferAPI.cpp | 10 +- .../AuctionTransferGameAPI/Base/Archive.cpp | 4 +- .../shared/AuctionTransferGameAPI/Request.cpp | 6 +- .../TcpLibrary/IPAddress.h | 2 +- .../TcpLibrary/TcpBlockAllocator.cpp | 6 +- .../TcpLibrary/TcpConnection.cpp | 64 +- .../TcpLibrary/TcpConnection.h | 2 +- .../TcpLibrary/TcpManager.cpp | 106 +- .../TcpLibrary/TcpManager.h | 4 +- .../AuctionTransferGameAPI/zip/GZipHelper.h | 4 +- .../AuctionTransferGameAPI/zip/Zip/zlib.h | 38 +- .../AuctionTransferGameAPI/zip/Zip/zutil.h | 4 +- .../src/shared/CentralCSHandler.h | 2 +- .../src/shared/CentralServer.cpp | 64 +- .../CentralServer/src/shared/CentralServer.h | 2 +- .../src/shared/CentralServerMetricsData.cpp | 10 +- .../src/shared/CharacterCreationTracker.cpp | 8 +- .../src/shared/ConsoleCommandParserGame.cpp | 6 +- .../src/shared/ConsoleManager.cpp | 2 +- .../src/shared/PlanetManager.cpp | 2 +- .../application/ChatServer/src/linux/main.cpp | 2 +- .../src/shared/CentralServerConnection.cpp | 2 +- .../ChatServer/src/shared/ChatInterface.cpp | 144 +-- .../ChatServer/src/shared/ChatServer.cpp | 104 +- .../src/shared/ChatServerRoomOwner.cpp | 2 +- .../ChatServer/src/shared/VChatInterface.cpp | 12 +- .../CommoditiesServer/src/linux/main.cpp | 2 +- .../CommoditiesServer/src/shared/Auction.cpp | 54 +- .../src/shared/AuctionLocation.cpp | 6 +- .../src/shared/AuctionMarket.cpp | 30 +- .../src/shared/CommodityServer.cpp | 10 +- .../src/shared/CommodityServerMetricsData.cpp | 2 +- .../ConnectionServer/src/linux/main.cpp | 2 +- .../src/shared/ClientConnection.cpp | 32 +- .../src/shared/ConnectionServer.cpp | 24 +- .../src/shared/GameConnection.cpp | 4 +- .../src/shared/PseudoClientConnection.cpp | 4 +- .../src/shared/SessionApiClient.cpp | 18 +- .../CustomerServiceServer/src/linux/main.cpp | 2 +- .../src/shared/CentralServerConnection.cpp | 8 +- .../src/shared/ChatServerConnection.cpp | 4 +- .../shared/ConfigCustomerServiceServer.cpp | 12 +- .../src/shared/CustomerServiceInterface.cpp | 104 +- .../src/shared/CustomerServiceServer.cpp | 28 +- .../LogServer/src/shared/LoggingServerApi.cpp | 52 +- .../LoginServer/src/linux/main.cpp | 2 +- .../src/shared/CSToolConnection.cpp | 4 +- .../src/shared/CentralServerConnection.cpp | 4 +- .../src/shared/ClientConnection.cpp | 4 +- .../LoginServer/src/shared/ConsoleManager.cpp | 2 +- .../LoginServer/src/shared/LoginServer.cpp | 30 +- .../LoginServer/src/shared/LoginServer.h | 2 +- .../src/shared/SessionApiClient.cpp | 2 +- .../src/shared/TaskCreateCharacter.cpp | 2 +- .../src/shared/TaskGetCharactersForDelete.cpp | 2 +- .../MetricsServer/src/linux/main.cpp | 2 +- .../src/shared/MetricsGatheringConnection.cpp | 20 +- .../src/shared/MetricsServer.cpp | 4 +- .../PlanetServer/src/linux/main.cpp | 2 +- .../src/shared/ConsoleCommandParser.cpp | 2 +- .../src/shared/ConsoleManager.cpp | 2 +- .../src/shared/GameServerData.cpp | 6 +- .../src/shared/PlanetProxyObject.cpp | 8 +- .../PlanetServer/src/shared/PlanetServer.cpp | 32 +- .../PlanetServer/src/shared/PlanetServer.h | 2 +- .../src/shared/PreloadManager.cpp | 2 +- .../PlanetServer/src/shared/Scene.cpp | 10 +- .../src/linux/main.cpp | 2 +- .../TaskManager/src/linux/ConsoleInput.cpp | 2 +- .../TaskManager/src/linux/ProcessSpawner.cpp | 2 +- .../TaskManager/src/linux/main.cpp | 2 +- .../TaskManager/src/shared/GameConnection.cpp | 2 +- .../TaskManager/src/shared/Locator.cpp | 6 +- .../src/shared/ManagerConnection.cpp | 4 +- .../TaskManager/src/shared/TaskManager.cpp | 10 +- .../src/shared/CTSAPIClient.cpp | 16 +- .../src/shared/ConsoleManager.cpp | 2 +- .../src/shared/TransferServer.cpp | 34 +- .../src/shared/ConsoleManager.cpp | 2 +- .../serverDatabase/src/shared/DataLookup.cpp | 4 +- .../src/shared/DatabaseProcess.cpp | 4 +- .../ImmediateDeleteCustomPersistStep.cpp | 2 +- .../serverDatabase/src/shared/LazyDeleter.cpp | 16 +- .../serverDatabase/src/shared/Loader.cpp | 18 +- .../src/shared/MessageToManager.cpp | 10 +- .../serverDatabase/src/shared/Persister.cpp | 34 +- .../src/shared/TaskGetBiography.cpp | 6 +- .../src/shared/TaskSetBiography.cpp | 2 +- .../src/shared/ai/AggroListProperty.cpp | 16 +- .../src/shared/ai/AiCombatPulseQueue.cpp | 6 +- .../src/shared/ai/AiCreatureCombatProfile.cpp | 10 +- .../src/shared/ai/AiCreatureData.cpp | 12 +- .../src/shared/ai/AiCreatureWeaponActions.cpp | 8 +- .../src/shared/ai/AiMovementArchive.cpp | 6 +- .../src/shared/ai/AiMovementBase.cpp | 26 +- .../src/shared/ai/AiMovementLoiter.cpp | 18 +- .../src/shared/ai/AiMovementMove.cpp | 4 +- .../src/shared/ai/AiMovementPathFollow.cpp | 8 +- .../src/shared/ai/AiMovementPatrol.cpp | 30 +- .../src/shared/ai/AiMovementSwarm.cpp | 28 +- .../src/shared/ai/AiMovementTarget.cpp | 10 +- .../shared/ai/AiMovementWanderInterior.cpp | 16 +- .../src/shared/ai/AiMovementWaypoint.cpp | 4 +- .../src/shared/ai/AiTargetingSystem.cpp | 2 +- .../serverGame/src/shared/ai/Formation.cpp | 4 +- .../serverGame/src/shared/ai/HateList.cpp | 46 +- .../serverGame/src/shared/ai/HateList.h | 2 +- .../serverGame/src/shared/ai/Squad.cpp | 6 +- .../behavior/AiCreatureStateArchive.cpp | 6 +- .../src/shared/behavior/AiLocation.cpp | 44 +- .../behavior/AiShipAttackTargetList.cpp | 22 +- .../behavior/AiShipBehaviorAttackBomber.cpp | 6 +- .../AiShipBehaviorAttackCapitalShip.cpp | 2 +- .../behavior/AiShipBehaviorAttackFighter.cpp | 28 +- .../AiShipBehaviorAttackFighter_Maneuver.cpp | 16 +- .../shared/behavior/AiShipBehaviorDock.cpp | 30 +- .../shared/behavior/AiShipBehaviorFollow.cpp | 18 +- .../shared/behavior/AiShipBehaviorIdle.cpp | 2 +- .../shared/behavior/AiShipBehaviorTrack.cpp | 4 +- .../behavior/AiShipBehaviorWaypoint.cpp | 14 +- .../behavior/ShipTurretTargetingSystem.cpp | 4 +- .../shared/collision/CollisionCallbacks.cpp | 12 +- .../src/shared/command/CommandCppFuncs.cpp | 414 ++++---- .../src/shared/command/CommandQueue.cpp | 38 +- .../src/shared/command/CommandQueue.h | 2 +- .../commoditiesMarket/CommoditiesMarket.cpp | 46 +- .../CommoditiesServerConnection.cpp | 2 +- .../shared/console/ConsoleCommandParserAi.cpp | 78 +- .../console/ConsoleCommandParserCity.cpp | 2 +- .../ConsoleCommandParserCollection.cpp | 56 +- .../console/ConsoleCommandParserCraft.cpp | 4 +- .../ConsoleCommandParserCraftStation.cpp | 30 +- .../console/ConsoleCommandParserGuild.cpp | 10 +- .../ConsoleCommandParserManufacture.cpp | 56 +- .../console/ConsoleCommandParserMoney.cpp | 12 +- .../console/ConsoleCommandParserNpc.cpp | 8 +- .../console/ConsoleCommandParserObject.cpp | 288 ++--- .../console/ConsoleCommandParserObjvar.cpp | 16 +- .../console/ConsoleCommandParserPvp.cpp | 140 +-- .../console/ConsoleCommandParserResource.cpp | 18 +- .../console/ConsoleCommandParserScript.cpp | 12 +- .../console/ConsoleCommandParserServer.cpp | 154 +-- .../console/ConsoleCommandParserShip.cpp | 42 +- .../console/ConsoleCommandParserSkill.cpp | 32 +- .../console/ConsoleCommandParserSpaceAi.cpp | 46 +- .../console/ConsoleCommandParserVeteran.cpp | 6 +- .../src/shared/console/ConsoleManager.cpp | 10 +- .../src/shared/console/ConsoleManager.h | 6 +- .../controller/AiCreatureController.cpp | 204 ++-- .../shared/controller/AiShipController.cpp | 176 ++-- .../controller/AiShipControllerInterface.cpp | 18 +- .../shared/controller/CreatureController.cpp | 48 +- .../shared/controller/PlanetController.cpp | 6 +- .../controller/PlayerCreatureController.cpp | 84 +- .../controller/PlayerShipController.cpp | 18 +- .../shared/controller/ServerController.cpp | 24 +- .../src/shared/controller/ShipController.cpp | 66 +- .../shared/controller/TangibleController.cpp | 22 +- .../src/shared/core/AttribModNameManager.cpp | 20 +- .../src/shared/core/BiographyManager.cpp | 2 +- .../src/shared/core/CharacterMatchManager.cpp | 28 +- .../serverGame/src/shared/core/Client.cpp | 22 +- .../src/shared/core/ClusterWideDataClient.cpp | 2 +- .../src/shared/core/CombatTracker.cpp | 14 +- .../src/shared/core/CommunityManager.cpp | 22 +- .../src/shared/core/ConfigServerGame.cpp | 8 +- .../src/shared/core/ConfigServerGame.h | 2 +- .../src/shared/core/ContainerInterface.cpp | 52 +- .../src/shared/core/FormManagerServer.cpp | 16 +- .../serverGame/src/shared/core/GameServer.cpp | 94 +- .../serverGame/src/shared/core/GameServer.h | 8 +- .../src/shared/core/InstantDeleteList.cpp | 4 +- .../src/shared/core/LogoutTracker.cpp | 4 +- .../src/shared/core/MessageToQueue.cpp | 4 +- .../src/shared/core/NameManager.cpp | 24 +- .../src/shared/core/NewbieTutorial.cpp | 6 +- .../src/shared/core/NpcConversation.cpp | 14 +- .../src/shared/core/ObserveTracker.cpp | 4 +- .../core/PlayerCreationManagerServer.cpp | 4 +- .../src/shared/core/PositionUpdateTracker.cpp | 4 +- .../serverGame/src/shared/core/RegexList.cpp | 6 +- .../src/shared/core/ReportManager.cpp | 6 +- .../src/shared/core/SceneGlobalData.cpp | 2 +- .../shared/core/ServerBuffBuilderManager.cpp | 28 +- .../src/shared/core/ServerBuildoutManager.cpp | 24 +- .../core/ServerImageDesignerManager.cpp | 50 +- .../src/shared/core/ServerUIManager.cpp | 36 +- .../src/shared/core/ServerUIPage.cpp | 12 +- .../src/shared/core/ServerUniverse.cpp | 36 +- .../src/shared/core/ServerWorld.cpp | 84 +- .../src/shared/core/SetupServerGame.cpp | 4 +- .../src/shared/core/StaticLootItemManager.cpp | 8 +- .../src/shared/core/VeteranRewardManager.cpp | 40 +- .../src/shared/guild/GuildInterface.cpp | 20 +- .../shared/metrics/GameServerMetricsData.cpp | 2 +- .../serverGame/src/shared/network/Chat.cpp | 2 +- .../network/ConnectionServerConnection.cpp | 14 +- .../CustomerServiceServerConnection.cpp | 4 +- .../network/GameServerMessageArchive.cpp | 2 +- .../src/shared/object/BuildingObject.cpp | 16 +- .../src/shared/object/CellObject.cpp | 42 +- .../src/shared/object/CityObject.cpp | 20 +- .../src/shared/object/CreatureObject.cpp | 356 +++---- .../src/shared/object/CreatureObject.h | 6 +- .../shared/object/CreatureObject_Mounts.cpp | 42 +- .../shared/object/CreatureObject_Ships.cpp | 8 +- .../shared/object/DraftSchematicObject.cpp | 52 +- .../src/shared/object/FactoryObject.cpp | 146 +-- .../src/shared/object/GroupIdObserver.cpp | 4 +- .../src/shared/object/GroupObject.cpp | 2 +- .../src/shared/object/GuildObject.cpp | 42 +- .../object/HarvesterInstallationObject.cpp | 12 +- .../object/HarvesterInstallationObject.h | 2 +- .../src/shared/object/InstallationObject.cpp | 12 +- .../src/shared/object/IntangibleObject.cpp | 52 +- .../src/shared/object/LineOfSightCache.cpp | 8 +- .../object/ManufactureInstallationObject.cpp | 142 +-- .../object/ManufactureSchematicObject.cpp | 180 ++-- .../src/shared/object/MissionObject.cpp | 22 +- .../src/shared/object/ObjectFactory.cpp | 6 +- .../src/shared/object/ObjectTracker.cpp | 2 +- .../shared/object/PatrolPathNodeProperty.cpp | 2 +- .../src/shared/object/PlanetObject.cpp | 26 +- .../src/shared/object/PlayerObject.cpp | 324 +++--- .../src/shared/object/PlayerObject.h | 18 +- .../src/shared/object/PlayerQuestObject.cpp | 4 +- .../shared/object/ResourceContainerObject.cpp | 22 +- .../src/shared/object/ResourcePoolObject.cpp | 4 +- .../src/shared/object/ResourceTypeObject.cpp | 10 +- .../src/shared/object/ServerObject.cpp | 202 ++-- .../src/shared/object/ServerObject.h | 8 +- .../object/ServerObject_AuthTransfer.cpp | 4 +- .../object/ServerResourceClassObject.cpp | 2 +- .../src/shared/object/ShipObject.cpp | 64 +- .../shared/object/ShipObject_Components.cpp | 50 +- .../src/shared/object/StaticObject.cpp | 14 +- .../object/TangibleConditionObserver.cpp | 8 +- .../src/shared/object/TangibleObject.cpp | 256 ++--- .../src/shared/object/TangibleObject.h | 2 +- .../object/TangibleObject_Conversation.cpp | 34 +- .../src/shared/object/UniverseObject.cpp | 12 +- .../src/shared/object/WeaponObject.cpp | 14 +- .../objectTemplate/ServerArmorTemplate.cpp | 304 +++--- .../ServerBattlefieldMarkerObjectTemplate.cpp | 10 +- .../ServerBuildingObjectTemplate.cpp | 70 +- .../ServerCellObjectTemplate.cpp | 10 +- .../ServerCityObjectTemplate.cpp | 10 +- ...rverConstructionContractObjectTemplate.cpp | 10 +- .../ServerCreatureObjectTemplate.cpp | 558 +++++----- .../ServerDraftSchematicObjectTemplate.cpp | 428 ++++---- .../ServerFactoryObjectTemplate.cpp | 10 +- .../ServerGroupObjectTemplate.cpp | 10 +- .../ServerGuildObjectTemplate.cpp | 10 +- ...verHarvesterInstallationObjectTemplate.cpp | 166 +-- .../ServerInstallationObjectTemplate.cpp | 10 +- .../ServerIntangibleObjectTemplate.cpp | 304 +++--- ...rManufactureInstallationObjectTemplate.cpp | 10 +- ...rverManufactureSchematicObjectTemplate.cpp | 210 ++-- .../ServerMissionObjectTemplate.cpp | 10 +- .../objectTemplate/ServerObjectTemplate.cpp | 992 +++++++++--------- .../ServerPlanetObjectTemplate.cpp | 22 +- .../ServerPlayerObjectTemplate.cpp | 10 +- .../ServerPlayerQuestObjectTemplate.cpp | 10 +- .../ServerResourceContainerObjectTemplate.cpp | 58 +- .../ServerShipObjectTemplate.cpp | 22 +- .../ServerStaticObjectTemplate.cpp | 22 +- .../ServerTangibleObjectTemplate.cpp | 262 ++--- .../ServerUniverseObjectTemplate.cpp | 10 +- .../ServerVehicleObjectTemplate.cpp | 166 +-- .../ServerWeaponObjectTemplate.cpp | 586 +++++------ .../ServerXpManagerObjectTemplate.cpp | 12 +- .../library/serverGame/src/shared/pvp/Pvp.cpp | 6 +- .../src/shared/pvp/PvpRuleSetBase.cpp | 4 +- .../src/shared/pvp/PvpUpdateObserver.cpp | 8 +- .../serverGame/src/shared/region/Region.cpp | 6 +- .../src/shared/region/RegionMaster.cpp | 106 +- .../src/shared/resource/SurveySystem.cpp | 2 +- .../serverGame/src/shared/space/Missile.cpp | 4 +- .../src/shared/space/MissileManager.cpp | 14 +- .../src/shared/space/NebulaManagerServer.cpp | 8 +- .../src/shared/space/ProjectileManager.cpp | 12 +- .../shared/space/ServerAsteroidManager.cpp | 12 +- .../shared/space/ServerShipComponentData.cpp | 10 +- .../shared/space/ShipAiEnemySearchManager.cpp | 6 +- .../space/ShipComponentDataCargoHold.cpp | 2 +- .../shared/space/ShipComponentDataManager.cpp | 10 +- .../space/ShipInternalDamageOverTime.cpp | 10 +- .../ShipInternalDamageOverTimeManager.cpp | 14 +- .../src/shared/space/SpaceAttackSquad.cpp | 28 +- .../src/shared/space/SpaceDockingManager.cpp | 6 +- .../serverGame/src/shared/space/SpacePath.cpp | 8 +- .../src/shared/space/SpacePathManager.cpp | 6 +- .../src/shared/space/SpaceSquad.cpp | 50 +- .../src/shared/space/SpaceSquadManager.cpp | 4 +- .../shared/space/SpaceVisibilityManager.cpp | 12 +- .../InstallationSynchronizedUi.cpp | 4 +- .../src/shared/trading/ServerSecureTrade.cpp | 20 +- .../src/shared/TaskConnectionIdMessage.cpp | 2 +- .../AccountFeatureIdResponse.cpp | 2 +- .../AccountFeatureIdResponse.h | 2 +- .../AdjustAccountFeatureIdResponse.cpp | 2 +- .../AdjustAccountFeatureIdResponse.h | 6 +- .../SceneTransferMessages.cpp | 4 +- .../centralGameServer/SceneTransferMessages.h | 4 +- .../core/SetupServerNetworkMessages.cpp | 2 +- .../gameGameServer/AiCreatureStateMessage.cpp | 6 +- .../gameGameServer/AiMovementMessage.cpp | 4 +- .../GameServerMessageInterface.cpp | 6 +- .../gameGameServer/RenameCharacterMessage.cpp | 4 +- .../src/shared/CityPathGraph.cpp | 74 +- .../src/shared/CityPathGraphManager.cpp | 98 +- .../src/shared/CityPathNode.cpp | 28 +- .../src/shared/PathAutoGenerator.cpp | 14 +- .../src/shared/ServerPathBuilder.cpp | 150 +-- .../src/shared/ServerPathfindingMessaging.cpp | 50 +- .../shared/ServerPathfindingNotification.cpp | 8 +- .../src/shared/GameScriptObject.cpp | 116 +- .../serverScript/src/shared/JNIWrappers.cpp | 28 +- .../serverScript/src/shared/JavaLibrary.cpp | 902 ++++++++-------- .../src/shared/ScriptFunctionTable.cpp | 6 +- .../src/shared/ScriptListEntry.cpp | 8 +- .../serverScript/src/shared/ScriptListEntry.h | 2 +- .../src/shared/ScriptMethodsAi.cpp | 100 +- .../src/shared/ScriptMethodsAnimation.cpp | 14 +- .../src/shared/ScriptMethodsAttributes.cpp | 46 +- .../src/shared/ScriptMethodsAuction.cpp | 22 +- .../src/shared/ScriptMethodsBroadcasting.cpp | 6 +- .../src/shared/ScriptMethodsBuffBuilder.cpp | 6 +- .../src/shared/ScriptMethodsChat.cpp | 12 +- .../src/shared/ScriptMethodsCity.cpp | 2 +- .../src/shared/ScriptMethodsClientEffect.cpp | 90 +- .../shared/ScriptMethodsClusterWideData.cpp | 4 +- .../src/shared/ScriptMethodsCombat.cpp | 158 +-- .../src/shared/ScriptMethodsCommandQueue.cpp | 28 +- .../src/shared/ScriptMethodsConsole.cpp | 4 +- .../src/shared/ScriptMethodsContainers.cpp | 112 +- .../src/shared/ScriptMethodsCrafting.cpp | 230 ++-- .../src/shared/ScriptMethodsDebug.cpp | 12 +- .../shared/ScriptMethodsDynamicVariable.cpp | 110 +- .../src/shared/ScriptMethodsForm.cpp | 4 +- .../src/shared/ScriptMethodsHateList.cpp | 32 +- .../src/shared/ScriptMethodsHolocube.cpp | 4 +- .../src/shared/ScriptMethodsHyperspace.cpp | 36 +- .../src/shared/ScriptMethodsImageDesign.cpp | 10 +- .../src/shared/ScriptMethodsInstallation.cpp | 12 +- .../src/shared/ScriptMethodsInteriors.cpp | 56 +- .../src/shared/ScriptMethodsJedi.cpp | 96 +- .../src/shared/ScriptMethodsMap.cpp | 16 +- .../src/shared/ScriptMethodsMentalStates.cpp | 4 +- .../src/shared/ScriptMethodsMission.cpp | 104 +- .../src/shared/ScriptMethodsMoney.cpp | 18 +- .../src/shared/ScriptMethodsMount.cpp | 6 +- .../shared/ScriptMethodsNewbieTutorial.cpp | 2 +- .../src/shared/ScriptMethodsNotification.cpp | 6 +- .../src/shared/ScriptMethodsNpc.cpp | 30 +- .../src/shared/ScriptMethodsObjectCreate.cpp | 124 +-- .../src/shared/ScriptMethodsObjectInfo.cpp | 434 ++++---- .../src/shared/ScriptMethodsObjectMove.cpp | 64 +- .../src/shared/ScriptMethodsPermissions.cpp | 8 +- .../src/shared/ScriptMethodsPilot.cpp | 74 +- .../src/shared/ScriptMethodsPlayerAccount.cpp | 42 +- .../src/shared/ScriptMethodsPlayerQuest.cpp | 30 +- .../src/shared/ScriptMethodsPvp.cpp | 16 +- .../src/shared/ScriptMethodsQuest.cpp | 28 +- .../src/shared/ScriptMethodsRegion.cpp | 140 +-- .../src/shared/ScriptMethodsRegion3d.cpp | 2 +- .../src/shared/ScriptMethodsResource.cpp | 74 +- .../src/shared/ScriptMethodsScript.cpp | 26 +- .../src/shared/ScriptMethodsServerUI.cpp | 18 +- .../src/shared/ScriptMethodsShip.cpp | 102 +- .../src/shared/ScriptMethodsSkill.cpp | 92 +- .../src/shared/ScriptMethodsString.cpp | 6 +- .../src/shared/ScriptMethodsSystem.cpp | 10 +- .../src/shared/ScriptMethodsTerrain.cpp | 70 +- .../src/shared/ScriptMethodsVeteran.cpp | 38 +- .../src/shared/ScriptMethodsWaypoint.cpp | 2 +- .../src/shared/ScriptMethodsWorldInfo.cpp | 86 +- .../src/shared/ScriptParamArchive.cpp | 2 +- .../src/shared/ScriptParameters.cpp | 4 +- .../src/shared/ScriptParameters.h | 2 +- .../src/shared/AdminAccountManager.cpp | 4 +- .../src/shared/ChatLogManager.cpp | 2 +- .../src/shared/ClusterWideDataManagerList.cpp | 6 +- .../src/shared/FreeCtsDataTable.cpp | 32 +- .../src/shared/DataTableTool.cpp | 2 +- .../src/shared/TemplateCompiler.cpp | 30 +- .../core/TemplateDefinitionCompiler.cpp | 26 +- .../src/shared/core/BarrierObject.cpp | 6 +- .../src/shared/core/BoxTree.cpp | 50 +- .../sharedCollision/src/shared/core/BoxTree.h | 2 +- .../src/shared/core/CollisionBuckets.cpp | 2 +- .../src/shared/core/CollisionMesh.cpp | 12 +- .../src/shared/core/CollisionNotification.cpp | 2 +- .../src/shared/core/CollisionProperty.cpp | 92 +- .../src/shared/core/CollisionResolve.cpp | 24 +- .../src/shared/core/CollisionResolve.h | 10 +- .../src/shared/core/CollisionUtils.cpp | 52 +- .../src/shared/core/CollisionWorld.cpp | 110 +- .../src/shared/core/ConfigSharedCollision.cpp | 4 +- .../src/shared/core/Contact3d.h | 6 +- .../src/shared/core/ContactPoint.cpp | 6 +- .../src/shared/core/DoorObject.cpp | 26 +- .../sharedCollision/src/shared/core/Floor.cpp | 26 +- .../src/shared/core/FloorLocator.cpp | 24 +- .../src/shared/core/FloorManager.cpp | 8 +- .../src/shared/core/FloorMesh.cpp | 78 +- .../src/shared/core/Footprint.cpp | 42 +- .../core/FootprintForceReattachManager.cpp | 2 +- .../src/shared/core/MultiList.cpp | 72 +- .../src/shared/core/MultiList.h | 20 +- .../src/shared/core/NeighborObject.cpp | 2 +- .../src/shared/core/SimpleCollisionMesh.cpp | 4 +- .../src/shared/core/SpatialDatabase.cpp | 68 +- .../src/shared/extent/BoxExtent.cpp | 2 +- .../src/shared/extent/CollisionDetect.cpp | 38 +- .../src/shared/extent/CollisionDetect.h | 8 +- .../src/shared/extent/CompositeExtent.cpp | 6 +- .../src/shared/extent/CylinderExtent.cpp | 2 +- .../src/shared/extent/DetailExtent.cpp | 4 +- .../src/shared/extent/Extent.cpp | 2 +- .../src/shared/extent/ExtentList.cpp | 10 +- .../src/shared/extent/MeshExtent.cpp | 10 +- .../shared/extent/OrientedCylinderExtent.cpp | 2 +- .../src/shared/extent/SimpleExtent.cpp | 2 +- .../src/shared/BitStream.cpp | 44 +- .../sharedCompression/src/shared/Lz77.cpp | 10 +- .../src/shared/ZlibCompressor.cpp | 16 +- .../src/shared/core/Bindable.h | 10 +- .../src/shared/core/DbBindableBase.h | 2 +- .../src/shared/core/DbBindableBool.h | 2 +- .../src/shared/core/DbBindableString.h | 10 +- .../src/shared/core/DbBindableUnicode.h | 2 +- .../src/shared/core/DbBufferRow.h | 4 +- .../src/shared/core/DbServer.cpp | 8 +- .../shared/core/NullEncodedStandardString.h | 2 +- .../shared/core/NullEncodedUnicodeString.h | 2 +- .../src_oci/DbBindableVarray.cpp | 30 +- .../src_oci/OciQueryImplementation.cpp | 18 +- .../src_oci/OciServer.cpp | 2 +- .../src_oci/OciSession.cpp | 20 +- .../sharedDebug/src/linux/DebugMonitor.cpp | 2 +- .../src/linux/PerformanceTimer.cpp | 10 +- .../sharedDebug/src/shared/DataLint.cpp | 64 +- .../sharedDebug/src/shared/DebugFlags.cpp | 18 +- .../sharedDebug/src/shared/DebugKey.cpp | 2 +- .../sharedDebug/src/shared/InstallTimer.cpp | 2 +- .../sharedDebug/src/shared/PixCounter.cpp | 12 +- .../sharedDebug/src/shared/Profiler.cpp | 32 +- .../sharedDebug/src/shared/RemoteDebug.cpp | 16 +- .../sharedDebug/src/shared/RemoteDebug.h | 4 +- .../src/shared/RemoteDebug_inner.cpp | 26 +- .../src/shared/RemoteDebug_inner.h | 4 +- .../library/sharedDebug/src/shared/Report.cpp | 4 +- .../src/shared/AsynchronousLoader.cpp | 38 +- .../sharedFile/src/shared/FileManifest.cpp | 10 +- .../sharedFile/src/shared/FileNameUtils.cpp | 8 +- .../sharedFile/src/shared/FileStreamer.cpp | 10 +- .../src/shared/FileStreamerFile.cpp | 4 +- .../src/shared/FileStreamerThread.cpp | 38 +- .../library/sharedFile/src/shared/Iff.cpp | 34 +- .../library/sharedFile/src/shared/Iff.h | 4 +- .../src/shared/IndentedFileWriter.cpp | 14 +- .../sharedFile/src/shared/MemoryFile.cpp | 8 +- .../sharedFile/src/shared/TreeFile.cpp | 40 +- .../src/shared/TreeFile_SearchNode.cpp | 42 +- .../sharedFile/src/shared/ZlibFile.cpp | 8 +- .../library/sharedFoundation/src/linux/Os.cpp | 12 +- .../src/linux/PerThreadData.cpp | 8 +- .../src/linux/PerThreadData.h | 8 +- .../src/linux/PlatformGlue.cpp | 6 +- .../sharedFoundation/src/linux/PlatformGlue.h | 6 +- .../src/linux/SetupSharedFoundation.cpp | 12 +- .../sharedFoundation/src/linux/vsnprintf.cpp | 2 +- .../sharedFoundation/src/shared/BitArray.cpp | 4 +- .../sharedFoundation/src/shared/BitArray.h | 2 +- .../src/shared/CalendarTime.cpp | 18 +- .../src/shared/CommandLine.cpp | 78 +- .../sharedFoundation/src/shared/CommandLine.h | 2 +- .../src/shared/ConfigFile.cpp | 50 +- .../sharedFoundation/src/shared/ConfigFile.h | 2 +- .../src/shared/CrashReportInformation.cpp | 2 +- .../sharedFoundation/src/shared/Crc.cpp | 2 +- .../src/shared/CrcStringTable.cpp | 14 +- .../src/shared/DataResourceList.h | 30 +- .../sharedFoundation/src/shared/ExitChain.cpp | 12 +- .../sharedFoundation/src/shared/Fatal.cpp | 6 +- .../sharedFoundation/src/shared/Fatal.h | 8 +- .../src/shared/FormattedString.h | 4 +- .../sharedFoundation/src/shared/LabelHash.cpp | 4 +- .../src/shared/MemoryBlockManager.cpp | 16 +- .../src/shared/MessageQueue.cpp | 4 +- .../sharedFoundation/src/shared/Misc.h | 20 +- .../src/shared/PersistentCrcString.cpp | 38 +- .../library/sharedFoundation/src/shared/Tag.h | 4 +- .../sharedFoundation/src/shared/Watcher.cpp | 4 +- .../sharedFoundation/src/shared/Watcher.h | 14 +- .../dynamicVariable/DynamicVariable.cpp | 96 +- .../shared/dynamicVariable/DynamicVariable.h | 4 +- .../appearance/WearableAppearanceMap.cpp | 12 +- .../collision/CollisionCallbackManager.cpp | 10 +- .../src/shared/core/AiDebugString.cpp | 2 +- .../shared/core/AssetCustomizationManager.cpp | 26 +- .../src/shared/core/CitizenRankDataTable.cpp | 6 +- .../src/shared/core/CollectionsDataTable.cpp | 38 +- .../CommoditiesAdvancedSearchAttribute.cpp | 6 +- .../src/shared/core/CustomizationManager.cpp | 6 +- .../src/shared/core/FormManager.cpp | 32 +- .../src/shared/core/GameScheduler.cpp | 2 +- .../src/shared/core/GroundZoneManager.cpp | 6 +- .../src/shared/core/GuildRankDataTable.cpp | 8 +- .../src/shared/core/LfgCharacterData.cpp | 2 +- .../src/shared/core/LfgDataTable.cpp | 24 +- .../sharedGame/src/shared/core/LfgDataTable.h | 2 +- .../src/shared/core/PlayerCreationManager.cpp | 4 +- .../shared/core/SharedBuffBuilderManager.cpp | 2 +- .../shared/core/SharedBuildoutAreaManager.cpp | 16 +- .../core/SharedImageDesignerManager.cpp | 2 +- .../sharedGame/src/shared/core/Universe.cpp | 6 +- .../src/shared/core/WearableEntry.cpp | 2 +- .../mount/MountValidScaleRangeTable.cpp | 4 +- .../src/shared/mount/SharedSaddleManager.cpp | 2 +- .../src/shared/object/ResourceClassObject.cpp | 34 +- .../src/shared/object/ResourceClassObject.h | 2 +- .../sharedGame/src/shared/object/Waypoint.cpp | 2 +- .../SharedBattlefieldMarkerObjectTemplate.cpp | 106 +- .../SharedBuildingObjectTemplate.cpp | 34 +- .../SharedCellObjectTemplate.cpp | 10 +- ...aredConstructionContractObjectTemplate.cpp | 10 +- .../SharedCreatureObjectTemplate.cpp | 774 +++++++------- .../SharedDraftSchematicObjectTemplate.cpp | 202 ++-- .../SharedFactoryObjectTemplate.cpp | 10 +- .../SharedGroupObjectTemplate.cpp | 10 +- .../SharedGuildObjectTemplate.cpp | 10 +- .../SharedInstallationObjectTemplate.cpp | 10 +- .../SharedIntangibleObjectTemplate.cpp | 10 +- .../SharedJediManagerObjectTemplate.cpp | 10 +- ...aredManufactureSchematicObjectTemplate.cpp | 10 +- .../SharedMissionObjectTemplate.cpp | 10 +- .../objectTemplate/SharedObjectTemplate.cpp | 494 ++++----- .../SharedPlayerObjectTemplate.cpp | 10 +- .../SharedPlayerQuestObjectTemplate.cpp | 10 +- .../SharedResourceContainerObjectTemplate.cpp | 10 +- .../SharedShipObjectTemplate.cpp | 58 +- .../SharedStaticObjectTemplate.cpp | 10 +- .../SharedTangibleObjectTemplate.cpp | 546 +++++----- .../SharedTerrainSurfaceObjectTemplate.cpp | 70 +- .../SharedUniverseObjectTemplate.cpp | 10 +- .../SharedVehicleObjectTemplate.cpp | 334 +++--- .../SharedWaypointObjectTemplate.cpp | 10 +- .../SharedWeaponObjectTemplate.cpp | 82 +- .../sharedGame/src/shared/quest/Quest.cpp | 2 +- .../src/shared/quest/QuestManager.cpp | 8 +- .../space/AsteroidGenerationManager.cpp | 12 +- .../src/shared/space/NebulaManager.cpp | 16 +- .../src/shared/space/ShipChassis.cpp | 16 +- .../src/shared/space/ShipChassisSlot.cpp | 4 +- .../src/shared/space/ShipChassisWritable.cpp | 4 +- .../space/ShipComponentAttachmentManager.cpp | 14 +- .../src/shared/space/ShipComponentData.cpp | 2 +- .../shared/space/ShipComponentDescriptor.cpp | 26 +- .../space/ShipComponentDescriptorWritable.cpp | 2 +- .../space/ShipComponentWeaponManager.cpp | 4 +- .../sharedGame/src/shared/sui/SuiPageData.cpp | 10 +- .../sharedImage/src/shared/TargaFormat.cpp | 4 +- .../library/sharedIoWin/src/shared/IoWin.cpp | 6 +- .../sharedIoWin/src/shared/IoWinManager.cpp | 44 +- .../sharedIoWin/src/shared/IoWinManager.h | 2 +- .../sharedMath/src/shared/MxCifQuadTree.cpp | 42 +- .../src/shared/MxCifQuadTreeBounds.h | 4 +- .../library/sharedMath/src/shared/Plane.cpp | 22 +- .../sharedMath/src/shared/Quaternion.cpp | 2 +- .../sharedMath/src/shared/SphereTreeNode.h | 6 +- .../sharedMath/src/shared/Transform.cpp | 18 +- .../library/sharedMath/src/shared/Vector.cpp | 4 +- .../src/shared/debug/DebugShapeRenderer.cpp | 6 +- .../src/shared/MemoryManager.cpp | 42 +- .../src/shared/Emitter.cpp | 2 +- .../src/shared/Receiver.cpp | 2 +- .../sharedNetwork/src/linux/TcpClient.cpp | 4 +- .../sharedNetwork/src/shared/Service.cpp | 4 +- .../core/SetupSharedNetworkMessages.cpp | 2 +- .../src/shared/ObjectWatcherList.cpp | 12 +- .../src/shared/appearance/Appearance.cpp | 38 +- .../src/shared/appearance/Appearance.h | 2 +- .../shared/appearance/AppearanceTemplate.cpp | 16 +- .../appearance/AppearanceTemplateList.cpp | 16 +- .../container/ArrangementDescriptorList.cpp | 2 +- .../shared/container/ContainedByProperty.cpp | 2 +- .../src/shared/container/Container.cpp | 12 +- .../src/shared/container/SlotIdManager.cpp | 6 +- .../src/shared/container/SlottedContainer.cpp | 2 +- .../src/shared/container/VolumeContainer.cpp | 4 +- .../src/shared/container/VolumeContainer.h | 4 +- .../src/shared/controller/Controller.cpp | 14 +- .../src/shared/core/SetupSharedObject.cpp | 2 +- .../src/shared/core/SetupSharedObject.h | 2 +- .../customization/CustomizationData.cpp | 8 +- .../CustomizationData_LocalDirectory.cpp | 26 +- .../customization/CustomizationIdManager.cpp | 2 +- .../ObjectTemplateCustomizationDataWriter.cpp | 2 +- .../src/shared/lot/LotManager.cpp | 8 +- .../src/shared/object/AlterScheduler.cpp | 54 +- .../src/shared/object/CachedNetworkId.cpp | 12 +- .../sharedObject/src/shared/object/Object.cpp | 196 ++-- .../sharedObject/src/shared/object/Object.h | 18 +- .../src/shared/object/ObjectList.cpp | 10 +- .../src/shared/object/ObjectTemplate.cpp | 8 +- .../src/shared/object/ObjectTemplateList.cpp | 4 +- .../src/shared/object/ScheduleData.cpp | 12 +- .../src/shared/portal/CellProperty.cpp | 100 +- .../sharedObject/src/shared/portal/Portal.cpp | 20 +- .../src/shared/portal/PortalProperty.cpp | 14 +- .../shared/portal/PortalPropertyTemplate.cpp | 32 +- .../src/shared/portal/SphereGrid.h | 6 +- .../src/shared/property/LayerProperty.cpp | 6 +- .../sharedObject/src/shared/world/World.cpp | 4 +- .../src/shared/DynamicPathGraph.cpp | 36 +- .../src/shared/DynamicPathGraph.h | 2 +- .../src/shared/DynamicPathNode.cpp | 6 +- .../src/shared/PathGraph.cpp | 10 +- .../src/shared/PathGraphIterator.cpp | 10 +- .../sharedPathfinding/src/shared/PathNode.cpp | 4 +- .../src/shared/PathSearch.cpp | 42 +- .../src/shared/Pathfinding.cpp | 2 +- .../src/shared/SetupSharedPathfinding.cpp | 6 +- .../src/shared/SimplePathGraph.cpp | 26 +- .../src/shared/SharedRemoteDebugServer.cpp | 8 +- .../SharedRemoteDebugServerConnection.cpp | 4 +- .../src/shared/ExpertiseManager.cpp | 2 +- .../src/shared/LevelManager.cpp | 4 +- .../src/shared/SkillManager.cpp | 10 +- .../shared/template/ServerArmorTemplate.cpp | 48 +- .../ServerBattlefieldMarkerObjectTemplate.cpp | 10 +- .../template/ServerBuildingObjectTemplate.cpp | 22 +- .../template/ServerCellObjectTemplate.cpp | 10 +- .../template/ServerCityObjectTemplate.cpp | 10 +- ...rverConstructionContractObjectTemplate.cpp | 10 +- .../template/ServerCreatureObjectTemplate.cpp | 80 +- .../ServerDraftSchematicObjectTemplate.cpp | 94 +- .../template/ServerFactoryObjectTemplate.cpp | 10 +- .../template/ServerGroupObjectTemplate.cpp | 10 +- .../template/ServerGuildObjectTemplate.cpp | 10 +- ...verHarvesterInstallationObjectTemplate.cpp | 30 +- .../ServerInstallationObjectTemplate.cpp | 10 +- .../ServerIntangibleObjectTemplate.cpp | 70 +- .../ServerJediManagerObjectTemplate.cpp | 10 +- ...rManufactureInstallationObjectTemplate.cpp | 10 +- ...rverManufactureSchematicObjectTemplate.cpp | 48 +- .../template/ServerMissionObjectTemplate.cpp | 10 +- .../shared/template/ServerObjectTemplate.cpp | 160 +-- .../template/ServerPlanetObjectTemplate.cpp | 16 +- .../template/ServerPlayerObjectTemplate.cpp | 10 +- .../ServerPlayerQuestObjectTemplate.cpp | 10 +- .../ServerResourceClassObjectTemplate.cpp | 34 +- .../ServerResourceContainerObjectTemplate.cpp | 16 +- .../ServerResourcePoolObjectTemplate.cpp | 20 +- .../ServerResourceTypeObjectTemplate.cpp | 16 +- .../template/ServerShipObjectTemplate.cpp | 16 +- .../template/ServerStaticObjectTemplate.cpp | 16 +- .../template/ServerTangibleObjectTemplate.cpp | 50 +- .../template/ServerTokenObjectTemplate.cpp | 10 +- .../template/ServerUberObjectTemplate.cpp | 390 +++---- .../template/ServerUniverseObjectTemplate.cpp | 10 +- .../template/ServerVehicleObjectTemplate.cpp | 30 +- .../template/ServerWaypointObjectTemplate.cpp | 10 +- .../template/ServerWeaponObjectTemplate.cpp | 74 +- .../ServerXpManagerObjectTemplate.cpp | 10 +- .../SharedBattlefieldMarkerObjectTemplate.cpp | 22 +- .../template/SharedBuildingObjectTemplate.cpp | 20 +- .../template/SharedCellObjectTemplate.cpp | 10 +- ...aredConstructionContractObjectTemplate.cpp | 10 +- .../template/SharedCreatureObjectTemplate.cpp | 106 +- .../SharedDraftSchematicObjectTemplate.cpp | 54 +- .../template/SharedFactoryObjectTemplate.cpp | 10 +- .../template/SharedGroupObjectTemplate.cpp | 10 +- .../template/SharedGuildObjectTemplate.cpp | 10 +- .../SharedInstallationObjectTemplate.cpp | 10 +- .../SharedIntangibleObjectTemplate.cpp | 10 +- .../SharedJediManagerObjectTemplate.cpp | 10 +- ...aredManufactureSchematicObjectTemplate.cpp | 10 +- .../template/SharedMissionObjectTemplate.cpp | 10 +- .../shared/template/SharedObjectTemplate.cpp | 108 +- .../template/SharedPlayerObjectTemplate.cpp | 10 +- .../SharedPlayerQuestObjectTemplate.cpp | 10 +- .../SharedResourceContainerObjectTemplate.cpp | 10 +- .../template/SharedShipObjectTemplate.cpp | 30 +- .../template/SharedStaticObjectTemplate.cpp | 10 +- .../template/SharedTangibleObjectTemplate.cpp | 114 +- .../SharedTerrainSurfaceObjectTemplate.cpp | 22 +- .../template/SharedTokenObjectTemplate.cpp | 10 +- .../template/SharedUniverseObjectTemplate.cpp | 10 +- .../template/SharedVehicleObjectTemplate.cpp | 40 +- .../template/SharedWaypointObjectTemplate.cpp | 10 +- .../template/SharedWeaponObjectTemplate.cpp | 26 +- .../src/shared/core/File.cpp | 12 +- .../src/shared/core/File.h | 14 +- .../src/shared/core/Filename.cpp | 44 +- .../src/shared/core/Filename.h | 10 +- .../src/shared/core/ObjectTemplate.cpp | 12 +- .../src/shared/core/TemplateData.cpp | 356 +++---- .../src/shared/core/TemplateData.h | 6 +- .../src/shared/core/TemplateDataIterator.cpp | 18 +- .../shared/core/TemplateDefinitionFile.cpp | 40 +- .../src/shared/core/TemplateDefinitionFile.h | 2 +- .../src/shared/core/TemplateGlobals.cpp | 32 +- .../src/shared/core/TpfFile.cpp | 164 +-- .../src/shared/core/TpfTemplate.cpp | 64 +- .../ProceduralTerrainAppearance.cpp | 18 +- .../SamplerProceduralTerrainAppearance.cpp | 2 +- .../ServerProceduralTerrainAppearance.cpp | 2 +- .../src/shared/appearance/TerrainQuadTree.cpp | 12 +- .../src/shared/appearance/TerrainQuadTree.h | 2 +- .../src/shared/core/WaterTypeManager.cpp | 8 +- .../src/shared/generator/BitmapGroup.cpp | 2 +- .../src/shared/generator/ShaderGroup.cpp | 2 +- .../src/shared/object/TerrainObject.cpp | 2 +- .../src/shared/CachedFileManager.cpp | 10 +- .../src/shared/CurrentUserOptionManager.cpp | 4 +- .../sharedUtility/src/shared/DataTable.cpp | 14 +- .../src/shared/DataTableColumnType.cpp | 6 +- .../src/shared/DataTableManager.cpp | 8 +- .../src/shared/DataTableWriter.cpp | 4 +- .../sharedUtility/src/shared/FileName.cpp | 4 +- .../sharedUtility/src/shared/RotaryCache.cpp | 10 +- .../src/shared/SetupSharedUtility.cpp | 2 +- .../src/shared/TemplateParameter.cpp | 12 +- .../src/shared/TemplateParameter.h | 28 +- .../src/shared/ValueDictionary.cpp | 2 +- .../src/shared/ValueDictionaryArchive.cpp | 4 +- .../src/shared/tree/XmlTreeDocument.cpp | 10 +- .../src/shared/tree/XmlTreeDocumentList.cpp | 8 +- .../sharedXml/src/shared/tree/XmlTreeNode.cpp | 48 +- .../platform/projects/MonAPI2/MonitorAPI.cpp | 30 +- .../platform/projects/MonAPI2/MonitorAPI.h | 10 +- .../platform/projects/MonAPI2/MonitorData.cpp | 18 +- .../platform/projects/MonAPI2/MonitorData.h | 8 +- .../Session/CommonAPI/CommonClient.cpp | 4 +- .../projects/Session/LoginAPI/ClientCore.cpp | 8 +- .../library/platform/utils/Base/Archive.cpp | 4 +- .../library/platform/utils/Base/AutoLog.cpp | 30 +- .../3rd/library/platform/utils/Base/AutoLog.h | 4 +- .../library/platform/utils/Base/Config.cpp | 26 +- .../3rd/library/platform/utils/Base/Config.h | 24 +- .../library/platform/utils/Base/Statistics.h | 4 +- .../utils/Base/TemplateObjectAllocator.h | 4 +- .../utils/Base/linux/BlockAllocator.cpp | 8 +- .../platform/utils/Base/linux/Event.cpp | 6 +- .../platform/utils/Base/linux/Logger.cpp | 18 +- .../platform/utils/Base/linux/Thread.cpp | 12 +- .../CSAssistStressTest/test.cpp | 54 +- .../CSAssistgameapi/CSAssistgameapicore.cpp | 72 +- .../CSAssistgameapi/CSAssistgameapicore.h | 4 +- .../CSAssistgameapi/CSAssistreceiver.cpp | 6 +- .../CSAssistgameapi/CSAssisttest/test.cpp | 12 +- .../CSAssist/CSAssistgameapi/packdata.cpp | 2 +- .../CSAssist/utils/Base/Archive.cpp | 4 +- .../CSAssist/utils/Base/AutoLog.cpp | 30 +- .../soePlatform/CSAssist/utils/Base/AutoLog.h | 4 +- .../CSAssist/utils/Base/Config.cpp | 26 +- .../soePlatform/CSAssist/utils/Base/Config.h | 24 +- .../CSAssist/utils/Base/Logger.cpp | 24 +- .../CSAssist/utils/Base/Statistics.h | 4 +- .../utils/Base/TemplateObjectAllocator.h | 4 +- .../CSAssist/utils/Base/WideString.h | 60 +- .../utils/Base/linux/BlockAllocator.cpp | 8 +- .../CSAssist/utils/Base/linux/Event.cpp | 6 +- .../CSAssist/utils/Base/linux/Thread.cpp | 12 +- .../CSAssist/utils/Base/serialize.h | 6 +- .../CSAssist/utils/TcpLibrary/IPAddress.h | 2 +- .../utils/TcpLibrary/TcpBlockAllocator.cpp | 6 +- .../utils/TcpLibrary/TcpConnection.cpp | 64 +- .../CSAssist/utils/TcpLibrary/TcpConnection.h | 2 +- .../CSAssist/utils/TcpLibrary/TcpManager.cpp | 106 +- .../CSAssist/utils/TcpLibrary/TcpManager.h | 4 +- .../TcpLibrary/TestClient/TestClient.cpp | 10 +- .../utils/Unicode/UnicodeCharacterDataMap.h | 2 +- .../CSAssist/utils/Unicode/utf8.cpp | 2 +- .../CTServiceGameAPI/Base/Archive.cpp | 4 +- .../CTGenericAPI/GenericApiCore.cpp | 16 +- .../CTGenericAPI/GenericConnection.cpp | 20 +- .../CTServiceGameAPI/CTServiceAPI.cpp | 4 +- .../CTServiceGameAPI/TcpLibrary/IPAddress.h | 2 +- .../TcpLibrary/TcpBlockAllocator.cpp | 6 +- .../TcpLibrary/TcpConnection.cpp | 64 +- .../TcpLibrary/TcpConnection.h | 2 +- .../TcpLibrary/TcpManager.cpp | 106 +- .../CTServiceGameAPI/TcpLibrary/TcpManager.h | 4 +- .../CTServiceGameAPI/TestClient/Main.cpp | 2 +- .../Unicode/UnicodeCharacterDataMap.h | 2 +- .../CTServiceGameAPI/test/main.cpp | 2 +- .../projects/ChatAPI/AvatarIteratorCore.cpp | 24 +- .../projects/ChatAPI/AvatarListItemCore.cpp | 4 +- .../ChatAPI/projects/ChatAPI/ChatAPI.cpp | 12 +- .../ChatAPI/projects/ChatAPI/ChatAPI.h | 12 +- .../ChatAPI/projects/ChatAPI/ChatAPICore.cpp | 172 +-- .../ChatAPI/projects/ChatAPI/ChatEnum.cpp | 2 +- .../projects/ChatAPI/ChatFriendStatusCore.cpp | 4 +- .../projects/ChatAPI/ChatIgnoreStatusCore.cpp | 4 +- .../ChatAPI/projects/ChatAPI/ChatRoom.cpp | 2 +- .../ChatAPI/projects/ChatAPI/ChatRoomCore.cpp | 46 +- .../ChatAPI/projects/ChatAPI/Message.cpp | 8 +- .../projects/ChatAPI/PersistentMessage.cpp | 4 +- .../ChatAPI/projects/ChatAPI/Request.cpp | 4 +- .../ChatAPI/projects/ChatAPI/Response.cpp | 72 +- .../ChatAPI/utils/Base/Archive.cpp | 4 +- .../ChatAPI/utils/Base/AutoLog.cpp | 30 +- .../soePlatform/ChatAPI/utils/Base/AutoLog.h | 4 +- .../ChatAPI/utils/Base/CmdLine.cpp | 4 +- .../soePlatform/ChatAPI/utils/Base/Config.cpp | 26 +- .../soePlatform/ChatAPI/utils/Base/Config.h | 24 +- .../soePlatform/ChatAPI/utils/Base/Logger.cpp | 28 +- .../ChatAPI/utils/Base/Statistics.h | 4 +- .../utils/Base/TemplateObjectAllocator.h | 4 +- .../ChatAPI/utils/Base/WideString.h | 60 +- .../utils/Base/linux/BlockAllocator.cpp | 8 +- .../ChatAPI/utils/Base/linux/Event.cpp | 6 +- .../ChatAPI/utils/Base/linux/Thread.cpp | 12 +- .../ChatAPI/utils/Base/serialize.h | 6 +- .../utils/GenericAPI/GenericApiCore.cpp | 16 +- .../utils/GenericAPI/GenericConnection.cpp | 20 +- .../utils/UdpLibrary/UdpConnection.cpp | 90 +- .../ChatAPI/utils/UdpLibrary/UdpConnection.h | 24 +- .../utils/UdpLibrary/UdpDriverLinux.cpp | 16 +- .../utils/UdpLibrary/UdpDriverWindows.cpp | 16 +- .../ChatAPI/utils/UdpLibrary/UdpHashTable.h | 92 +- .../ChatAPI/utils/UdpLibrary/UdpLinkedList.h | 50 +- .../utils/UdpLibrary/UdpLogicalPacket.cpp | 18 +- .../utils/UdpLibrary/UdpLogicalPacket.h | 10 +- .../ChatAPI/utils/UdpLibrary/UdpManager.cpp | 144 +-- .../ChatAPI/utils/UdpLibrary/UdpManager.h | 26 +- .../ChatAPI/utils/UdpLibrary/UdpMisc.cpp | 28 +- .../ChatAPI/utils/UdpLibrary/UdpMisc.h | 4 +- .../ChatAPI/utils/UdpLibrary/UdpPriority.h | 18 +- .../utils/UdpLibrary/UdpReliableChannel.cpp | 72 +- .../utils/UdpLibrary/UdpReliableChannel.h | 4 +- .../utils/Unicode/UnicodeCharacterDataMap.h | 2 +- .../ChatAPI/utils/Unicode/utf8.cpp | 2 +- .../projects/VChat/VChatAPI/common.cpp | 28 +- .../VChat/VChatUnitTest/VChatClient.cpp | 28 +- .../VChatAPI/utils2.0/utils/Api/api.cpp | 16 +- .../VChatAPI/utils2.0/utils/Api/api.h | 2 +- .../utils2.0/utils/Api/apiMessages.cpp | 22 +- .../VChatAPI/utils2.0/utils/Api/apiMessages.h | 6 +- .../VChatAPI/utils2.0/utils/Api/apiPinned.cpp | 4 +- .../VChatAPI/utils2.0/utils/Base/cmdLine.cpp | 4 +- .../VChatAPI/utils2.0/utils/Base/date.cpp | 2 +- .../VChatAPI/utils2.0/utils/Base/dateUtils.h | 4 +- .../utils/Base/genericRateLimitingMechanism.h | 6 +- .../utils2.0/utils/Base/hashtable.hpp | 100 +- .../VChatAPI/utils2.0/utils/Base/log.cpp | 24 +- .../utils2.0/utils/Base/monitorAPI.cpp | 28 +- .../VChatAPI/utils2.0/utils/Base/monitorAPI.h | 4 +- .../utils2.0/utils/Base/monitorData.cpp | 18 +- .../utils2.0/utils/Base/monitorData.h | 6 +- .../VChatAPI/utils2.0/utils/Base/priority.hpp | 18 +- .../utils2.0/utils/Base/stringutils.cpp | 4 +- .../utils2.0/utils/Base/stringutils.h | 2 +- .../utils2.0/utils/Base/substringSearchTree.h | 54 +- .../VChatAPI/utils2.0/utils/Base/thread.cpp | 16 +- .../VChatAPI/utils2.0/utils/Base/utf8.cpp | 2 +- .../utils2.0/utils/TcpLibrary/IPAddress.h | 2 +- .../utils/TcpLibrary/TcpBlockAllocator.cpp | 6 +- .../utils/TcpLibrary/TcpConnection.cpp | 64 +- .../utils2.0/utils/TcpLibrary/TcpConnection.h | 2 +- .../utils2.0/utils/TcpLibrary/TcpManager.cpp | 110 +- .../utils2.0/utils/TcpLibrary/TcpManager.h | 4 +- .../utils2.0/utils/UdpLibrary/UdpLibrary.cpp | 434 ++++---- .../utils2.0/utils/UdpLibrary/UdpLibrary.hpp | 42 +- .../3rd/library/udplibrary/PointerDeque.hpp | 14 +- .../3rd/library/udplibrary/UdpLibrary.cpp | 428 ++++---- .../3rd/library/udplibrary/UdpLibrary.hpp | 42 +- external/3rd/library/udplibrary/hashtable.hpp | 100 +- external/3rd/library/udplibrary/priority.hpp | 18 +- external/3rd/library/udplibrary/udpclient.cpp | 4 +- external/3rd/library/udplibrary/udpserver.cpp | 2 +- .../src/shared/AutoDeltaVariableCallback.h | 2 +- .../library/archive/src/shared/ByteStream.cpp | 2 +- .../library/archive/src/shared/ByteStream.h | 2 +- .../crypto/src/shared/original/cryptlib.h | 2 +- .../crypto/src/shared/original/filters.cpp | 8 +- .../crypto/src/shared/original/filters.h | 32 +- .../crypto/src/shared/original/queue.cpp | 2 +- .../crypto/src/shared/original/smartptr.h | 18 +- .../src/shared/wrapper/TwofishCrypt.cpp | 2 +- .../fileInterface/src/shared/AbstractFile.cpp | 6 +- .../fileInterface/src/shared/AbstractFile.h | 2 +- .../fileInterface/src/shared/StdioFile.cpp | 16 +- .../src/shared/LocalizationManager.cpp | 18 +- .../src/shared/LocalizedString.cpp | 12 +- .../src/shared/LocalizedStringTable.cpp | 12 +- .../LocalizedStringTableReaderWriter.cpp | 12 +- .../library/singleton/src/shared/Singleton2.h | 4 +- .../src/shared/UnicodeCharacterDataMap.cpp | 6 +- .../src/shared/UnicodeCharacterDataMap.h | 2 +- .../unicode/src/shared/UnicodeUtils.cpp | 2 +- .../library/unicode/src/shared/UnicodeUtils.h | 4 +- .../ours/library/unicode/src/shared/utf8.cpp | 2 +- .../SwgDatabaseServer/src/linux/main.cpp | 2 +- .../shared/buffers/AuctionLocationsBuffer.cpp | 4 +- .../buffers/BattlefieldParticipantBuffer.cpp | 4 +- .../buffers/BountyHunterTargetBuffer.cpp | 2 +- .../shared/buffers/CreatureObjectBuffer.cpp | 2 +- .../src/shared/buffers/ExperienceBuffer.cpp | 4 +- .../buffers/IndexedNetworkTableBuffer.h | 4 +- .../ManufactureSchematicAttributeBuffer.cpp | 4 +- .../buffers/MarketAuctionBidsBuffer.cpp | 4 +- .../shared/buffers/MarketAuctionsBuffer.cpp | 6 +- .../src/shared/buffers/ObjectTableBuffer.cpp | 6 +- .../src/shared/buffers/ResourceTypeBuffer.cpp | 4 +- .../cleanup/TaskObjectTemplateListUpdater.cpp | 2 +- .../src/shared/core/CMLoader.cpp | 4 +- .../src/shared/core/ObjvarNameManager.cpp | 16 +- .../src/shared/core/SwgLoader.cpp | 10 +- .../src/shared/core/SwgPersister.cpp | 2 +- .../src/shared/core/SwgSnapshot.cpp | 8 +- .../src/shared/queries/CommoditiesQuery.cpp | 10 +- .../src/shared/tasks/TaskSaveObjvarNames.cpp | 2 +- .../src/shared/combat/CombatEngine.cpp | 36 +- .../controller/JediManagerController.cpp | 28 +- .../SwgPlayerCreatureController.cpp | 2 +- .../src/shared/core/CSHandler.cpp | 14 +- .../src/shared/core/SwgGameServer.cpp | 6 +- .../src/shared/core/SwgServerUniverse.cpp | 4 +- .../src/shared/object/JediManagerObject.cpp | 8 +- .../src/shared/object/SwgCreatureObject.cpp | 12 +- .../src/shared/object/SwgPlayerObject.cpp | 10 +- .../ServerJediManagerObjectTemplate.cpp | 10 +- .../core/SetupSwgServerNetworkMessages.cpp | 2 +- .../combat/MessageQueueCombatAction.cpp | 8 +- .../core/SetupSwgSharedNetworkMessages.cpp | 2 +- .../src/shared/CombatEngineData.h | 8 +- 937 files changed, 14983 insertions(+), 14983 deletions(-) diff --git a/engine/client/application/Miff/src/linux/InputFileHandler.cpp b/engine/client/application/Miff/src/linux/InputFileHandler.cpp index 0cb2d496..ead23d7c 100755 --- a/engine/client/application/Miff/src/linux/InputFileHandler.cpp +++ b/engine/client/application/Miff/src/linux/InputFileHandler.cpp @@ -124,7 +124,7 @@ int InputFileHandler::deleteFile( if (deleteHandleFlag && file) { delete file; - file = nullptr; + file = NULL; } return(unlink(filename)); } diff --git a/engine/client/application/Miff/src/linux/OutputFileHandler.cpp b/engine/client/application/Miff/src/linux/OutputFileHandler.cpp index 82fa61a9..1c8ffe96 100755 --- a/engine/client/application/Miff/src/linux/OutputFileHandler.cpp +++ b/engine/client/application/Miff/src/linux/OutputFileHandler.cpp @@ -20,7 +20,7 @@ OutputFileHandler::OutputFileHandler(const char *filename) { outputIFF = new Iff(MAXIFFDATASIZE); - outFilename = nullptr; + outFilename = NULL; setCurrentFilename(filename); } @@ -45,7 +45,7 @@ OutputFileHandler::~OutputFileHandler(void) delete [] outFilename; } - outputIFF = nullptr; + outputIFF = NULL; } diff --git a/engine/client/application/Miff/src/linux/miff.cpp b/engine/client/application/Miff/src/linux/miff.cpp index 5bf4af1b..cd395ab5 100755 --- a/engine/client/application/Miff/src/linux/miff.cpp +++ b/engine/client/application/Miff/src/linux/miff.cpp @@ -55,7 +55,7 @@ //================================================= static vars assignment == const int entryPointVersion = 1; // constantly check DataEntryPoint.h to see if this value has changed -OutputFileHandler *outfileHandler = nullptr; +OutputFileHandler *outfileHandler = NULL; const int bufferSize = 16 * 1024 * 1024; const int maxStringSize = 256; const char version[] = "1.3 September 18, 2000"; @@ -242,7 +242,7 @@ int main( int argc, // number of args in commandline // static void callbackFunction(void) { - outfileHandler = nullptr; + outfileHandler = NULL; #ifdef WIN32 @@ -392,13 +392,13 @@ static errorType evaluateArgs(void) // get default values from DOS char currentDir[maxStringSize]; - if (nullptr == getcwd(currentDir, maxStringSize)) // get current working directory + if (NULL == getcwd(currentDir, maxStringSize)) // get current working directory { retVal = ERR_UNKNOWNDIR; return(retVal); } drive[0] = currentDir[0]; // drive letter - drive[1] = 0; // and nullptr terminate it + drive[1] = 0; // and null terminate it strcpy(extension, "IFF"); // default to uppercase .IFF strcpy(directory, ¤tDir[2]); // get everything after the Drive: including the first backslash filename[0] = 0; @@ -619,7 +619,7 @@ static errorType loadInputToBuffer( // we've successfully read the file, now close it... delete inFileHandler; } - else // inFileName is nullptr + else // inFileName is NULL { retVal = ERR_FILENOTFOUND; } @@ -746,7 +746,7 @@ static void handleError(errorType error) // Revisions and History: // 1/07/99 [] - created // -extern "C" void MIFFMessage(char *message, // nullptr terminated string to be displayed +extern "C" void MIFFMessage(char *message, // null terminated string to be displayed int forceOutput) // if non-zero, it will print out even in quiet mode (for ERRORs) { if (forceOutput) diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferClient.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferClient.cpp index c7ddebeb..eb67f237 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferClient.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferClient.cpp @@ -35,7 +35,7 @@ void AuctionTransferClient::addCoinToAuction( const ExchangeListCreditsMessage& // 2bi. if user connected: send VeAuctionCoinReply (with result code) to user's ES // 2bii. if user not connected: send immediate abort back to auction service - const unsigned uTrack = getNewTransactionID( nullptr ); + const unsigned uTrack = getNewTransactionID( NULL ); AuctionAssetDetails &details = m_mPendingRequestDetails[ uTrack ]; details.u8Type = AuctionAssetDetails::TYPE_COIN; diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericApiCore.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericApiCore.cpp index 3735217d..6c412225 100644 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericApiCore.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericApiCore.cpp @@ -119,7 +119,7 @@ unsigned GenericAPICore::submitRequest(GenericRequest *req, GenericResponse *res } req->setTrack(m_currTrack); res->setTrack(m_currTrack); - time_t timeout = time(nullptr) + m_requestTimeout; + time_t timeout = time(NULL) + m_requestTimeout; req->setTimeout(timeout); res->setTimeout(timeout); @@ -138,7 +138,7 @@ void GenericAPICore::process() if (!m_suspended) { // Process timeout on pending requests - while((m_outCount > 0) && ((req = m_outboundQueue.front().first)->getTimeout() <= time(nullptr))) + while((m_outCount > 0) && ((req = m_outboundQueue.front().first)->getTimeout() <= time(NULL))) { --m_outCount; res = m_outboundQueue.front().second; @@ -150,7 +150,7 @@ void GenericAPICore::process() } // Process timeout on pending responses - while((m_pendingCount > 0) && ((res = (*m_pending.begin()).second)->getTimeout() <= time(nullptr))) + while((m_pendingCount > 0) && ((res = (*m_pending.begin()).second)->getTimeout() <= time(NULL))) { --m_pendingCount; m_pending.erase(m_pending.begin()); @@ -163,7 +163,7 @@ void GenericAPICore::process() pair out_pair = m_outboundQueue.front(); req = out_pair.first; res = out_pair.second; - GenericConnection *con = nullptr; + GenericConnection *con = NULL; if (req->getMappedServerTrack() == 0) // request has no originating "owner" server { con = getNextActiveConnection(); // it does not matter which server we send this to @@ -180,7 +180,7 @@ void GenericAPICore::process() } } - if (con != nullptr) + if (con != NULL) { Base::ByteStream msg; req->pack(msg); @@ -215,7 +215,7 @@ GenericConnection *GenericAPICore::getNextActiveConnection() unsigned startIndex = m_nextConnectionIndex; unsigned maxIndex = m_serverConnections.size() - 1; - GenericConnection *con = nullptr; + GenericConnection *con = NULL; //loop until we find an active connection, or until we get back // to where we started @@ -235,7 +235,7 @@ GenericConnection *GenericAPICore::getNextActiveConnection() //went past end of vector, start back at 0 m_nextConnectionIndex = 0; } - }while (con == nullptr && m_nextConnectionIndex != startIndex); + }while (con == NULL && m_nextConnectionIndex != startIndex); return con; } @@ -261,7 +261,7 @@ ServerTrackObject *GenericAPICore::findServer(unsigned server_track) { std::map::iterator iter = m_serverTracks.find(server_track); if (iter == m_serverTracks.end()) - return nullptr; + return NULL; ServerTrackObject *stobj = (*iter).second; m_serverTracks.erase(server_track); return stobj; diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericConnection.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericConnection.cpp index 8abb0dff..318f5c20 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericConnection.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericConnection.cpp @@ -25,7 +25,7 @@ using namespace Base; GenericConnection::GenericConnection(const char *host, short port, GenericAPICore *apiCore, unsigned reconnectTimeout, unsigned noDataTimeoutSecs, unsigned, unsigned incomingBufSizeInKB, unsigned outgoingBufSizeInKB, unsigned keepAlive, unsigned maxRecvMessageSizeInKB) : m_bConnected(CON_NONE), m_apiCore(apiCore), - m_con(nullptr), + m_con(NULL), m_host(host), m_port(port), m_lastTrack(123455), //random choice != 1 @@ -50,8 +50,8 @@ GenericConnection::~GenericConnection() { if(m_con) { - m_con->SetHandler(nullptr); - m_con->Disconnect();//don't worry about onterminated being called, we've set it's handler to nullptr, so it wont + m_con->SetHandler(NULL); + m_con->Disconnect();//don't worry about onterminated being called, we've set it's handler to null, so it wont m_con->Release(); } @@ -64,7 +64,7 @@ void GenericConnection::disconnect() { m_con->Disconnect(); //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); - m_con = nullptr; + m_con = NULL; } m_conState = CON_DISCONNECT; m_bConnected = CON_NONE; @@ -77,7 +77,7 @@ void GenericConnection::OnTerminated(TcpConnection *) if(m_con) { m_con->Release(); - m_con = nullptr; + m_con = NULL; } m_conState = CON_DISCONNECT; m_bConnected = CON_NONE; @@ -93,7 +93,7 @@ void GenericConnection::OnRoutePacket(TcpConnection *, const unsigned char *data get(iter, type); get(iter, track); - GenericResponse *res = nullptr; + GenericResponse *res = NULL; // the following if block is a temporary fix that prevents // a crash with a game team in which they occasionally find @@ -152,7 +152,7 @@ void GenericConnection::process() { m_con->SetHandler(this); m_conState = CON_NEGOTIATE; - m_conTimeout = time(nullptr) + m_reconnectTimeout; + m_conTimeout = time(NULL) + m_reconnectTimeout; } break; case CON_NEGOTIATE: @@ -178,12 +178,12 @@ void GenericConnection::process() put(msg, std::string(m_apiCore->m_gameIdentifiers[index])); Send(msg); } - else if(time(nullptr) > m_conTimeout) + else if(time(NULL) > m_conTimeout) { // we did not connect m_con->Disconnect(); //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); - m_con = nullptr; + m_con = NULL; m_conState = CON_DISCONNECT; m_bConnected = CON_NONE; } @@ -199,7 +199,7 @@ void GenericConnection::process() { m_con->Disconnect(); //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); - m_con = nullptr; + m_con = NULL; } } m_manager->GiveTime(); diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/AuctionTransferAPI.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/AuctionTransferAPI.cpp index 7e716a00..872eff5e 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/AuctionTransferAPI.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/AuctionTransferAPI.cpp @@ -25,9 +25,9 @@ AuctionTransferAPI::AuctionTransferAPI(const char *hostNames, const char *identi std::vector portArray; char hostConfig[4096]; char identifierConfig[4096]; - if (hostNames == nullptr) + if (hostNames == NULL) hostNames = DEFAULT_HOST; - if(identifiers == nullptr) + if(identifiers == NULL) identifiers = DEFAULT_IDENTIFIER; // parse the hosts and ports out : @@ -52,7 +52,7 @@ AuctionTransferAPI::AuctionTransferAPI(const char *hostNames, const char *identi portArray.push_back(port); } } - while ((ptr = strtok(nullptr, " ")) != nullptr); + while ((ptr = strtok(NULL, " ")) != NULL); } strncpy(identifierConfig, identifiers, 4096); identifierConfig[4095] = 0; @@ -67,7 +67,7 @@ AuctionTransferAPI::AuctionTransferAPI(const char *hostNames, const char *identi identifierArray.push_back(identifier); } } - while ((ptr = strtok(nullptr, ";")) != nullptr); + while ((ptr = strtok(NULL, ";")) != NULL); } if (hostArray.empty()) @@ -134,7 +134,7 @@ unsigned AuctionTransferAPI::sendCommitTransaction(long long transactionID, void unsigned AuctionTransferAPI::sendPrepareTransaction(const char *serverIdentifier, long long transactionID, unsigned stationID, unsigned characterID, long long assetID, const char *xmlAsset, void *user, bool compress) { RequestTypes requestEnum = GAME_REQUEST_SEND_PREPARE_TRANSACTION; - GenericRequest *req = nullptr; + GenericRequest *req = NULL; if( compress ) { requestEnum = GAME_REQUEST_SEND_PREPARE_TRANSACTION_COMPRESSED; diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/Archive.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/Archive.cpp index 8ad45428..e3400df0 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/Archive.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/Archive.cpp @@ -91,7 +91,7 @@ namespace Base ByteStream::ByteStream() : allocatedSize(0), beginReadIterator(), - data(nullptr), + data(NULL), size(0), lastPutSize(0) { @@ -208,7 +208,7 @@ namespace Base if(data->size < allocatedSize) { unsigned char * tmp = new unsigned char[newSize]; - if(data->buffer != nullptr) + if(data->buffer != NULL) memcpy(tmp, data->buffer, size); delete[] data->buffer; data->buffer = tmp; diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Request.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Request.cpp index ed2e0ad3..13291373 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Request.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Request.cpp @@ -7,7 +7,7 @@ void put(Base::ByteStream &msg, const Blob &source); ////////////////////////////////////////////////////////////////////////////////////// Blob::Blob(const unsigned char *data, unsigned len) - : m_data(nullptr), + : m_data(NULL), m_len(len) { if (m_len > 0) @@ -20,7 +20,7 @@ void put(Base::ByteStream &msg, const Blob &source); ////////////////////////////////////////////////////////////////////////////////////// Blob::Blob(const Blob &cpy) - : m_data(nullptr), + : m_data(NULL), m_len(cpy.m_len) { if (m_len > 0) @@ -45,7 +45,7 @@ void put(Base::ByteStream &msg, const Blob &source); if (m_data) { delete [] m_data; - m_data = nullptr; + m_data = NULL; } m_len = cpy.m_len; diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/IPAddress.h b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/IPAddress.h index 03b59e8d..f6d5f886 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/IPAddress.h +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/IPAddress.h @@ -32,7 +32,7 @@ public: * @brief Used to retreive the the dot-notation represenatatiion of this address. * * @param buffer A pointer to the buffer to place the ip address into. - * Must be at least 17 characters long, will be nullptr terminated. + * Must be at least 17 characters long, will be null terminated. * * @return A pointer to the buffer the address was placed into. */ diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpBlockAllocator.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpBlockAllocator.cpp index b7da0f27..6d476d78 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpBlockAllocator.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpBlockAllocator.cpp @@ -6,7 +6,7 @@ namespace NAMESPACE #endif TcpBlockAllocator::TcpBlockAllocator(const unsigned initSize, const unsigned initCount) -: m_freeHead(nullptr), m_blockCount(initCount), m_blockSize(initSize), m_numAvailBlocks(0) +: m_freeHead(NULL), m_blockCount(initCount), m_blockSize(initSize), m_numAvailBlocks(0) { realloc(); } @@ -33,7 +33,7 @@ data_block *TcpBlockAllocator::getBlock() tmp = m_freeHead; m_freeHead = m_freeHead->m_next; - tmp->m_next = nullptr; + tmp->m_next = NULL; m_numAvailBlocks--; return(tmp); } @@ -56,7 +56,7 @@ void TcpBlockAllocator::returnBlock(data_block *b) void TcpBlockAllocator::realloc() { - data_block *tmp = nullptr, *cursor = nullptr; + data_block *tmp = NULL, *cursor = NULL; tmp = new data_block; m_numAvailBlocks++; cursor = tmp; diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpConnection.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpConnection.cpp index 20fdad78..41f75157 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpConnection.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpConnection.cpp @@ -11,28 +11,28 @@ namespace NAMESPACE //used when want to open new connection with this socket TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, const IPAddress &destIP, short destPort, unsigned timeout) -: m_nextConnection(nullptr), - m_prevConnection(nullptr), +: m_nextConnection(NULL), + m_prevConnection(NULL), m_socket(INVALID_SOCKET), - m_nextKeepAliveConnection(nullptr), - m_prevKeepAliveConnection(nullptr), + m_nextKeepAliveConnection(NULL), + m_prevKeepAliveConnection(NULL), m_aliveListId(tcpManager->m_aliveList.m_listID), - m_nextRecvDataConnection(nullptr), - m_prevRecvDataConnection(nullptr), + m_nextRecvDataConnection(NULL), + m_prevRecvDataConnection(NULL), m_recvDataListId(tcpManager->m_dataList.m_listID), m_manager(tcpManager), m_status(StatusNegotiating), - m_handler(nullptr), + m_handler(NULL), m_destIP(destIP), m_destPort(destPort), m_refCount(0), m_sendAllocator(sendAlloc), - m_head(nullptr), - m_tail(nullptr), + m_head(NULL), + m_tail(NULL), m_bytesRead(0), m_bytesNeeded(0), m_params(params), - m_recvBuff(nullptr), + m_recvBuff(NULL), m_connectTimeout(timeout), m_connectTimer(), m_wasConRemovedFromMgr(false) @@ -94,28 +94,28 @@ TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAllo //used when server mode creates new connection object representing a connect request TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, SOCKET socket, const IPAddress &destIP, short destPort) -: m_nextConnection(nullptr), - m_prevConnection(nullptr), +: m_nextConnection(NULL), + m_prevConnection(NULL), m_socket(socket), - m_nextKeepAliveConnection(nullptr), - m_prevKeepAliveConnection(nullptr), + m_nextKeepAliveConnection(NULL), + m_prevKeepAliveConnection(NULL), m_aliveListId(tcpManager->m_aliveList.m_listID), - m_nextRecvDataConnection(nullptr), - m_prevRecvDataConnection(nullptr), + m_nextRecvDataConnection(NULL), + m_prevRecvDataConnection(NULL), m_recvDataListId(tcpManager->m_dataList.m_listID), m_manager(tcpManager), m_status(StatusConnected), - m_handler(nullptr), + m_handler(NULL), m_destIP(destIP), m_destPort(destPort), m_refCount(0), m_sendAllocator(sendAlloc), - m_head(nullptr), - m_tail(nullptr), + m_head(NULL), + m_tail(NULL), m_bytesRead(0), m_bytesNeeded(0), m_params(params), - m_recvBuff(nullptr), + m_recvBuff(NULL), m_connectTimeout(0), m_connectTimer(), m_wasConRemovedFromMgr(false) @@ -208,7 +208,7 @@ int TcpConnection::finishConnect() t.tv_sec = 0; t.tv_usec = 0; - int err = select(m_socket + 1, nullptr, &wrSet, nullptr, &t); + int err = select(m_socket + 1, NULL, &wrSet, NULL, &t); if (err == 0) { @@ -303,7 +303,7 @@ TcpConnection::~TcpConnection() { delete [] m_recvBuff; - while(m_head != nullptr) + while(m_head != NULL) { data_block *tmp = m_head; m_head = m_head->m_next; @@ -327,22 +327,22 @@ void TcpConnection::Send(const char *data, unsigned int dataLen) { m_aliveListId = m_manager->m_keepAliveList.m_listID; - if (m_prevKeepAliveConnection != nullptr) + if (m_prevKeepAliveConnection != NULL) m_prevKeepAliveConnection->m_nextKeepAliveConnection = m_nextKeepAliveConnection; - if (m_nextKeepAliveConnection != nullptr) + if (m_nextKeepAliveConnection != NULL) m_nextKeepAliveConnection->m_prevKeepAliveConnection = m_prevKeepAliveConnection; if (m_manager->m_keepAliveList.m_beginList == this) m_manager->m_keepAliveList.m_beginList = m_nextKeepAliveConnection; m_nextKeepAliveConnection = m_manager->m_aliveList.m_beginList; - m_prevKeepAliveConnection = nullptr; - if (m_manager->m_aliveList.m_beginList != nullptr) + m_prevKeepAliveConnection = NULL; + if (m_manager->m_aliveList.m_beginList != NULL) m_manager->m_aliveList.m_beginList->m_prevKeepAliveConnection = this; m_manager->m_aliveList.m_beginList = this; } - data_block *work = nullptr; + data_block *work = NULL; // this connection has no send buffer. Get a block if(!m_tail) @@ -467,16 +467,16 @@ int TcpConnection::processIncoming() { m_recvDataListId = m_manager->m_noDataList.m_listID; - if (m_prevRecvDataConnection != nullptr) + if (m_prevRecvDataConnection != NULL) m_prevRecvDataConnection->m_nextRecvDataConnection = m_nextRecvDataConnection; - if (m_nextRecvDataConnection != nullptr) + if (m_nextRecvDataConnection != NULL) m_nextRecvDataConnection->m_prevRecvDataConnection = m_prevRecvDataConnection; if (m_manager->m_noDataList.m_beginList == this) m_manager->m_noDataList.m_beginList = m_nextRecvDataConnection; m_nextRecvDataConnection = m_manager->m_dataList.m_beginList; - m_prevRecvDataConnection = nullptr; - if (m_manager->m_dataList.m_beginList != nullptr) + m_prevRecvDataConnection = NULL; + if (m_manager->m_dataList.m_beginList != NULL) m_manager->m_dataList.m_beginList->m_prevRecvDataConnection = this; m_manager->m_dataList.m_beginList = this; } @@ -622,7 +622,7 @@ int TcpConnection::processOutgoing() int sendError = 1; - // If m_head is not nullptr, then this connection has something to send + // If m_head is not null, then this connection has something to send if(m_head) diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpConnection.h b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpConnection.h index 92d631d1..07eb4f42 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpConnection.h +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpConnection.h @@ -50,7 +50,7 @@ public: * connection is disconnected, you simply need to derive your class * (multiply if necessary) from TcpConnectionHandler, then you can use * this method to set the object the TcpConnection will call as appropriate. - * default = nullptr (no callbacks made) + * default = NULL (no callbacks made) * * @param handler The object which will be called for notifications. */ diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpManager.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpManager.cpp index 7c00d9f6..a89065a6 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpManager.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpManager.cpp @@ -41,14 +41,14 @@ TcpManager::TcpParams::TcpParams(const TcpParams &cpy) } TcpManager::TcpManager(const TcpParams ¶ms) -: m_handler(nullptr), - m_keepAliveList(nullptr, 1), - m_aliveList(nullptr, 2), - m_noDataList(nullptr, 1), - m_dataList(nullptr, 2), +: m_handler(NULL), + m_keepAliveList(NULL, 1), + m_aliveList(NULL, 2), + m_noDataList(NULL, 1), + m_dataList(NULL, 2), m_params(params), m_refCount(1), - m_connectionList(nullptr), + m_connectionList(NULL), m_connectionListCount(0), m_socket(INVALID_SOCKET), m_boundAsServer(false), @@ -86,7 +86,7 @@ TcpManager::~TcpManager() close(m_socket); #endif } - while (m_connectionList != nullptr) + while (m_connectionList != NULL) { TcpConnection *con = m_connectionList; m_connectionList = m_connectionList->m_nextConnection; @@ -166,7 +166,7 @@ bool TcpManager::BindAsServer() { struct hostent * lphp; lphp = gethostbyname(m_params.bindAddress); - if (lphp != nullptr) + if (lphp != NULL) addr_loc.sin_addr.s_addr = ((struct in_addr *)(lphp->h_addr))->s_addr; } else @@ -191,7 +191,7 @@ bool TcpManager::BindAsServer() TcpConnection *TcpManager::acceptClient() { - TcpConnection *newConn = nullptr; + TcpConnection *newConn = NULL; if (m_boundAsServer && m_connectionListCount < m_params.maxConnections) { @@ -205,7 +205,7 @@ TcpConnection *TcpManager::acceptClient() { newConn = new TcpConnection(this, &m_allocator, m_params, sock, IPAddress(addr.sin_addr.s_addr), ntohs(addr.sin_port)); addNewConnection(newConn); - if (m_handler != nullptr) + if (m_handler != NULL) { m_handler->OnConnectRequest(newConn); } @@ -230,8 +230,8 @@ SOCKET TcpManager::getMaxFD() if (m_boundAsServer) maxfd = m_socket+1; - TcpConnection *next = nullptr; - for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) + TcpConnection *next = NULL; + for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) { next = con->m_nextConnection; if (con->GetStatus() != TcpConnection::StatusDisconnected && con->m_socket > maxfd) @@ -245,8 +245,8 @@ SOCKET TcpManager::getMaxFD() TcpConnection *TcpManager::getConnection(SOCKET fd) { - TcpConnection *next = nullptr; - for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) + TcpConnection *next = NULL; + for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) { next = con->m_nextConnection; if (con->m_socket == fd) @@ -255,7 +255,7 @@ TcpConnection *TcpManager::getConnection(SOCKET fd) } } //if get here ,couldn't find it - return nullptr; + return NULL; } bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendTimePerConnection, unsigned maxRecvTimePerConnection) @@ -277,8 +277,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT { // Send output from last heartbeat - TcpConnection *next = nullptr; - for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) + TcpConnection *next = NULL; + for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) { con->AddRef(); if (next) next->Release(); @@ -345,7 +345,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT tmpfds = m_permfds; timeout.tv_sec = 0; timeout.tv_usec = 0; - int cnt = select(maxfd, &tmpfds, nullptr, nullptr, &timeout); // blocks for timeout + int cnt = select(maxfd, &tmpfds, NULL, NULL, &timeout); // blocks for timeout if (cnt > 0) @@ -371,8 +371,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //process incoming client messages if (maxRecvTimePerConnection != 0) { - TcpConnection *next = nullptr; - for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) + TcpConnection *next = NULL; + for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) { con->AddRef(); if (next) next->Release(); @@ -437,8 +437,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT pollfds[0].events |= POLLIN; } - TcpConnection *next = nullptr; - for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next, idx++) + TcpConnection *next = NULL; + for (TcpConnection *con = m_connectionList ; con != NULL ; con = next, idx++) { next = con->m_nextConnection; pollfds[idx].fd = con->m_socket; @@ -478,7 +478,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT } //process regular msg(s) - if (con == nullptr) + if (con == NULL) { close(pollfds[idx].fd); continue; @@ -510,7 +510,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT }//if(pollfds[... else if (pollfds[idx].revents & POLLHUP) { - if (con == nullptr) + if (con == NULL) { close(pollfds[idx].fd); continue; @@ -528,21 +528,21 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //now process any keepalives, if time to do that if (m_params.keepAliveDelay > 0 && m_keepAliveTimer.isDone(m_params.keepAliveDelay)) { - TcpConnection *next = nullptr; - for (TcpConnection *con = m_keepAliveList.m_beginList ; con != nullptr ; con = next) + TcpConnection *next = NULL; + for (TcpConnection *con = m_keepAliveList.m_beginList ; con != NULL ; con = next) { con->AddRef(); if (next) next->Release(); next = con->m_nextKeepAliveConnection; if (next) next->AddRef(); - con->Send(nullptr, 0); //note: this request will move the connection from the keepAliveList to the aliveList + con->Send(NULL, 0); //note: this request will move the connection from the keepAliveList to the aliveList con->Release(); } //now move the complete alive list over to the keepalive list to reset those timers m_keepAliveList.m_beginList = m_aliveList.m_beginList; - m_aliveList.m_beginList = nullptr; + m_aliveList.m_beginList = NULL; //switch id's for those connections that were in the alive list last go - around int tmpID = m_aliveList.m_listID; @@ -556,8 +556,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //now process any noDataCons, if time to do that if (m_params.noDataTimeout > 0 && m_noDataTimer.isDone(m_params.noDataTimeout)) { - TcpConnection *next = nullptr; - for (TcpConnection *con = m_noDataList.m_beginList ; con != nullptr ; con = next) + TcpConnection *next = NULL; + for (TcpConnection *con = m_noDataList.m_beginList ; con != NULL ; con = next) { con->AddRef(); if (next) next->Release(); @@ -571,7 +571,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //now move the complete data list over to the nodata list to reset those timers m_noDataList.m_beginList = m_dataList.m_beginList; - m_dataList.m_beginList = nullptr; + m_dataList.m_beginList = NULL; //switch id's for those connections that were in the data list last go - around int tmpID = m_dataList.m_listID; @@ -593,11 +593,11 @@ TcpConnection *TcpManager::EstablishConnection(const char *serverAddress, unsign { //can't open outgoing connections when in server mode // use a different TcpManager to do that - return nullptr; + return NULL; } if (m_connectionListCount >= m_params.maxConnections) - return(nullptr); + return(NULL); // get server address unsigned long address = inet_addr(serverAddress); @@ -605,8 +605,8 @@ TcpConnection *TcpManager::EstablishConnection(const char *serverAddress, unsign { struct hostent * lphp; lphp = gethostbyname(serverAddress); - if (lphp == nullptr) - return(nullptr); + if (lphp == NULL) + return(NULL); address = ((struct in_addr *)(lphp->h_addr))->s_addr; } IPAddress destIP(address); @@ -631,22 +631,22 @@ void TcpManager::addNewConnection(TcpConnection *con) } #endif con->m_nextConnection = m_connectionList; - con->m_prevConnection = nullptr; - if (m_connectionList != nullptr) + con->m_prevConnection = NULL; + if (m_connectionList != NULL) m_connectionList->m_prevConnection = con; m_connectionList = con; m_connectionListCount++; con->m_nextKeepAliveConnection = m_aliveList.m_beginList; - con->m_prevKeepAliveConnection = nullptr; - if (m_aliveList.m_beginList != nullptr) + con->m_prevKeepAliveConnection = NULL; + if (m_aliveList.m_beginList != NULL) m_aliveList.m_beginList->m_prevKeepAliveConnection = con; m_aliveList.m_beginList = con; con->m_aliveListId = m_keepAliveList.m_listID;//start it out thinking it's already in the alive list, since it is con->m_nextRecvDataConnection = m_dataList.m_beginList; - con->m_prevRecvDataConnection = nullptr; - if (m_dataList.m_beginList != nullptr) + con->m_prevRecvDataConnection = NULL; + if (m_dataList.m_beginList != NULL) m_dataList.m_beginList->m_prevRecvDataConnection = con; m_dataList.m_beginList = con; con->m_recvDataListId = m_noDataList.m_listID;//start it out thinking it's already in the data list, since it is @@ -667,40 +667,40 @@ void TcpManager::removeConnection(TcpConnection *con) #pragma warning(pop) } #endif - if (con->m_prevConnection != nullptr) + if (con->m_prevConnection != NULL) con->m_prevConnection->m_nextConnection = con->m_nextConnection; - if (con->m_nextConnection != nullptr) + if (con->m_nextConnection != NULL) con->m_nextConnection->m_prevConnection = con->m_prevConnection; if (m_connectionList == con) m_connectionList = con->m_nextConnection; - con->m_nextConnection = nullptr; - con->m_prevConnection = nullptr; + con->m_nextConnection = NULL; + con->m_prevConnection = NULL; - if (con->m_prevKeepAliveConnection != nullptr) + if (con->m_prevKeepAliveConnection != NULL) con->m_prevKeepAliveConnection->m_nextKeepAliveConnection = con->m_nextKeepAliveConnection; - if (con->m_nextKeepAliveConnection != nullptr) + if (con->m_nextKeepAliveConnection != NULL) con->m_nextKeepAliveConnection->m_prevKeepAliveConnection = con->m_prevKeepAliveConnection; if (m_aliveList.m_beginList == con) m_aliveList.m_beginList = con->m_nextKeepAliveConnection; else if (m_keepAliveList.m_beginList == con) m_keepAliveList.m_beginList = con->m_nextKeepAliveConnection; - con->m_nextKeepAliveConnection = nullptr; - con->m_prevKeepAliveConnection = nullptr; + con->m_nextKeepAliveConnection = NULL; + con->m_prevKeepAliveConnection = NULL; - if (con->m_prevRecvDataConnection != nullptr) + if (con->m_prevRecvDataConnection != NULL) con->m_prevRecvDataConnection->m_nextRecvDataConnection = con->m_nextRecvDataConnection; - if (con->m_nextRecvDataConnection != nullptr) + if (con->m_nextRecvDataConnection != NULL) con->m_nextRecvDataConnection->m_prevRecvDataConnection = con->m_prevRecvDataConnection; if (m_dataList.m_beginList == con) m_dataList.m_beginList = con->m_nextRecvDataConnection; else if (m_noDataList.m_beginList == con) m_noDataList.m_beginList = con->m_nextRecvDataConnection; - con->m_nextRecvDataConnection = nullptr; - con->m_prevRecvDataConnection = nullptr; + con->m_nextRecvDataConnection = NULL; + con->m_prevRecvDataConnection = NULL; diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpManager.h b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpManager.h index c4e8b1cf..75eb6df4 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpManager.h +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpManager.h @@ -156,7 +156,7 @@ public: * simply need to derive your class (multiply if necessary) from TcpManagerHandler, then you can use * this method to set the object the TcpManager will call as appropriate. The TcpConnection object * also has a handler mechanism that replaces the other callback functions below, see TcpConnection::SetHandler - * default = nullptr (no callbacks made) + * default = NULL (no callbacks made) * * @param handler The object which will be called for manager related notifications. */ @@ -211,7 +211,7 @@ public: * the connect-complete callback to be called if the connection is succesfull. * * @return A pointer to a TcpConnection object. - * nullptr if the manager object has exceeded its maximum number of connections + * NULL if the manager object has exceeded its maximum number of connections * or if the serverAddress cannot be resolved to an IP address. */ TcpConnection *EstablishConnection(const char *serverAddress, unsigned short serverPort, unsigned timeout = 0); diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/GZipHelper.h b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/GZipHelper.h index dab0f9b3..a01bf682 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/GZipHelper.h +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/GZipHelper.h @@ -187,7 +187,7 @@ class CA2GZIPT int destroy() { int err = Z_OK; - if (m_zstream.state != nullptr) { + if (m_zstream.state != NULL) { err = deflateEnd(&(m_zstream)); } if (m_z_err < 0) err = m_z_err; @@ -459,7 +459,7 @@ class CGZIP2AT int destroy() { int err = Z_OK; - if (m_zstream.state != nullptr) { + if (m_zstream.state != NULL) { err = inflateEnd(&(m_zstream)); } if (m_z_err < 0) err = m_z_err; diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/zlib.h b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/zlib.h index fb425a3b..52cb529f 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/zlib.h +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/zlib.h @@ -74,7 +74,7 @@ typedef struct z_stream_s { uInt avail_out; /* remaining free space at next_out */ uLong total_out; /* total nb of bytes output so far */ - char *msg; /* last error message, nullptr if no error */ + char *msg; /* last error message, NULL if no error */ struct internal_state FAR *state; /* not visible by applications */ alloc_func zalloc; /* used to allocate the internal state */ @@ -193,7 +193,7 @@ ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); enough memory, Z_STREAM_ERROR if level is not a valid compression level, Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible with the version assumed by the caller (ZLIB_VERSION). - msg is set to nullptr if there is no error message. deflateInit does not + msg is set to null if there is no error message. deflateInit does not perform any compression: this will be done by deflate(). */ @@ -271,7 +271,7 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); processed or more output produced), Z_STREAM_END if all input has been consumed and all output has been produced (only when flush is set to Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example - if next_in or next_out was nullptr), Z_BUF_ERROR if no progress is possible + if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible (for example avail_in or avail_out was zero). */ @@ -304,7 +304,7 @@ ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_VERSION_ERROR if the zlib library version is incompatible with the - version assumed by the caller. msg is set to nullptr if there is no error + version assumed by the caller. msg is set to null if there is no error message. inflateInit does not perform any decompression apart from reading the zlib header if present: this will be done by inflate(). (So next_in and avail_in may be modified, but next_out and avail_out are unchanged.) @@ -372,7 +372,7 @@ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); preset dictionary is needed at this point, Z_DATA_ERROR if the input data was corrupted (input stream not conforming to the zlib format or incorrect adler32 checksum), Z_STREAM_ERROR if the stream structure was inconsistent - (for example if next_in or next_out was nullptr), Z_MEM_ERROR if there was not + (for example if next_in or next_out was NULL), Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if no progress is possible or if there was not enough room in the output buffer when Z_FINISH is used. In the Z_DATA_ERROR case, the application may then call inflateSync to look for a good @@ -437,7 +437,7 @@ ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid - method). msg is set to nullptr if there is no error message. deflateInit2 does + method). msg is set to null if there is no error message. deflateInit2 does not perform any compression: this will be done by deflate(). */ @@ -471,7 +471,7 @@ ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, actually used by the compressor.) deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a - parameter is invalid (such as nullptr dictionary) or the stream state is + parameter is invalid (such as NULL dictionary) or the stream state is inconsistent (for example if deflate has already been called for this stream or if the compression method is bsort). deflateSetDictionary does not perform any compression: this will be done by deflate(). @@ -491,7 +491,7 @@ ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if the source stream state was inconsistent - (such as zalloc being nullptr). msg is left unchanged in both source and + (such as zalloc being NULL). msg is left unchanged in both source and destination. */ @@ -503,7 +503,7 @@ ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); that may have been set by deflateInit2. deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being nullptr). + stream state was inconsistent (such as zalloc or state being NULL). */ ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, @@ -544,7 +544,7 @@ ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if a parameter is invalid (such as a negative - memLevel). msg is set to nullptr if there is no error message. inflateInit2 + memLevel). msg is set to null if there is no error message. inflateInit2 does not perform any decompression apart from reading the zlib header if present: this will be done by inflate(). (So next_in and avail_in may be modified, but next_out and avail_out are unchanged.) @@ -562,7 +562,7 @@ ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, dictionary (see deflateSetDictionary). inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a - parameter is invalid (such as nullptr dictionary) or the stream state is + parameter is invalid (such as NULL dictionary) or the stream state is inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the expected one (incorrect Adler32 value). inflateSetDictionary does not perform any decompression: this will be done by subsequent calls of @@ -591,7 +591,7 @@ ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); The stream will keep attributes that may have been set by inflateInit2. inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being nullptr). + stream state was inconsistent (such as zalloc or state being NULL). */ @@ -667,7 +667,7 @@ ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); gzopen can be used to read a file which is not in gzip format; in this case gzread will directly read from the file without decompression. - gzopen returns nullptr if the file could not be opened or if there was + gzopen returns NULL if the file could not be opened or if there was insufficient memory to allocate the (de)compression state; errno can be checked to distinguish the two cases (if errno is zero, the zlib error is Z_MEM_ERROR). */ @@ -681,7 +681,7 @@ ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); The next call of gzclose on the returned gzFile will also close the file descriptor fd, just like fclose(fdopen(fd), mode) closes the file descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode). - gzdopen returns nullptr if there was insufficient memory to allocate + gzdopen returns NULL if there was insufficient memory to allocate the (de)compression state. */ @@ -718,8 +718,8 @@ ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...)); ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); /* - Writes the given nullptr-terminated string to the compressed file, excluding - the terminating nullptr character. + Writes the given null-terminated string to the compressed file, excluding + the terminating null character. gzputs returns the number of characters written, or -1 in case of error. */ @@ -727,7 +727,7 @@ ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); /* Reads bytes from the compressed file until len-1 characters are read, or a newline character is read and transferred to buf, or an end-of-file - condition is encountered. The string is then terminated with a nullptr + condition is encountered. The string is then terminated with a null character. gzgets returns buf, or Z_NULL in case of error. */ @@ -822,7 +822,7 @@ ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); /* Update a running Adler-32 checksum with the bytes buf[0..len-1] and - return the updated checksum. If buf is nullptr, this function returns + return the updated checksum. If buf is NULL, this function returns the required initial value for the checksum. An Adler-32 checksum is almost as reliable as a CRC32 but can be computed much faster. Usage example: @@ -838,7 +838,7 @@ ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); /* Update a running crc with the bytes buf[0..len-1] and return the updated - crc. If buf is nullptr, this function returns the required initial value + crc. If buf is NULL, this function returns the required initial value for the crc. Pre- and post-conditioning (one's complement) is performed within this function so it shouldn't be done by the application. Usage example: diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/zutil.h b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/zutil.h index fecd535d..718ebc15 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/zutil.h +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/zutil.h @@ -116,7 +116,7 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ # include /* for fdopen */ # else # ifndef fdopen -# define fdopen(fd,mode) nullptr /* No fdopen() */ +# define fdopen(fd,mode) NULL /* No fdopen() */ # endif # endif #endif @@ -130,7 +130,7 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ #endif #if defined(_BEOS_) || defined(RISCOS) -# define fdopen(fd,mode) nullptr /* No fdopen() */ +# define fdopen(fd,mode) NULL /* No fdopen() */ #endif #if (defined(_MSC_VER) && (_MSC_VER > 600)) diff --git a/engine/server/application/CentralServer/src/shared/CentralCSHandler.h b/engine/server/application/CentralServer/src/shared/CentralCSHandler.h index b07690de..e2b5fd0b 100755 --- a/engine/server/application/CentralServer/src/shared/CentralCSHandler.h +++ b/engine/server/application/CentralServer/src/shared/CentralCSHandler.h @@ -69,7 +69,7 @@ protected: std::string name; EntryType type; - CentralCSHandlerFunc func; // will be nullptr unless it's of TYPE_CENTRAL. + CentralCSHandlerFunc func; // will be null unless it's of TYPE_CENTRAL. }; diff --git a/engine/server/application/CentralServer/src/shared/CentralServer.cpp b/engine/server/application/CentralServer/src/shared/CentralServer.cpp index 3c1578f9..35d9e51c 100755 --- a/engine/server/application/CentralServer/src/shared/CentralServer.cpp +++ b/engine/server/application/CentralServer/src/shared/CentralServer.cpp @@ -587,7 +587,7 @@ void CentralServer::getReadyGameServers(std::vector &theList) GameServerConnection * CentralServer::getRandomGameServer(void) { if (m_gameServerConnectionsList.empty()) - return nullptr; + return NULL; // m_gameServerConnectionsList ***DOES NOT*** contain the DB server so // we don't have to worry about checking for and excluding the DB server @@ -611,7 +611,7 @@ GameServerConnection * CentralServer::getRandomGameServer(void) indexNextGameServer = 0; } - return nullptr; + return NULL; } //----------------------------------------------------------------------- @@ -696,7 +696,7 @@ void CentralServer::launchStartingProcesses() const if (!m_taskManager || !m_taskManager->isConnected() || (m_clusterId == 0)) { if (!m_taskManager) - REPORT_LOG(true, ("CentralServer not launching starting processes because m_taskManager is nullptr\n")); + REPORT_LOG(true, ("CentralServer not launching starting processes because m_taskManager is NULL\n")); else if (!m_taskManager->isConnected()) REPORT_LOG(true, ("CentralServer not launching starting processes because m_taskManager->isConnected() is false\n")); @@ -820,7 +820,7 @@ void CentralServer::launchStartingPlanetServers() char const * const p = ConfigCentralServer::getStartPlanet(i); if (p) { - FATAL(!*p, ("CentralServer::launchStartingPlanetServers: ConfigCentralServer::getStartPlanet(%d) specified a non-nullptr but empty planet name", i)); + FATAL(!*p, ("CentralServer::launchStartingPlanetServers: ConfigCentralServer::getStartPlanet(%d) specified a non-null but empty planet name", i)); std::string planetName; std::string hostName; @@ -1495,7 +1495,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons { ConnectionServerConnection * c = (*ci); - if ( (c != nullptr) + if ( (c != NULL) && !c->getChatServiceAddress().empty() && (c->getChatServicePort() != 0)) { @@ -1537,13 +1537,13 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons { ChatServerConnection *connection = (*iterChatServerConnections); - if (connection != nullptr) + if (connection != NULL) { connection->send(address, true); } else { - REPORT_LOG(true, ("Trying to send the customer service server: chat server service address to a nullptr chat server\n")); + REPORT_LOG(true, ("Trying to send the customer service server: chat server service address to a NULL chat server\n")); } } } @@ -1556,7 +1556,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons { ConnectionServerConnection * c = (*ci); - if ( (c != nullptr) + if ( (c != NULL) && !c->getCustomerServiceAddress().empty() && (c->getCustomerServicePort() != 0)) { @@ -1631,7 +1631,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); const RequestGameServerForLoginMessage msg(ri); - time_t const timeNow = ::time(nullptr); + time_t const timeNow = ::time(NULL); PlayerSceneMapType::const_iterator i = m_playerSceneMap.find(msg.getCharacterId()); if ((i != m_playerSceneMap.end()) && (i->second.second > timeNow)) { @@ -1892,14 +1892,14 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons } else { - if(getInstance().m_transferServerConnection != nullptr) + if(getInstance().m_transferServerConnection != NULL) { getInstance().m_transferServerConnection->disconnect(); getInstance().m_transferServerConnection = 0; s_retryTransferServerConnection = false; } - if(getInstance().m_stationPlayersCollectorConnection != nullptr) + if(getInstance().m_stationPlayersCollectorConnection != NULL) { getInstance().m_stationPlayersCollectorConnection->disconnect(); getInstance().m_stationPlayersCollectorConnection = 0; @@ -1947,11 +1947,11 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons if (iterFind != s_pendingRenameCharacter.end()) { ++(iterFind->second.second); - iterFind->second.first = ::time(nullptr) + 3600; // 1 hour timeout + iterFind->second.first = ::time(NULL) + 3600; // 1 hour timeout } else { - s_pendingRenameCharacter.insert(std::make_pair(msg.getValue().second.first, std::make_pair((::time(nullptr) + 3600), 1))); // 1 hour timeout + s_pendingRenameCharacter.insert(std::make_pair(msg.getValue().second.first, std::make_pair((::time(NULL) + 3600), 1))); // 1 hour timeout } // tell the chat server to destroy any avatar with the new name, but only if the first name changed @@ -2099,11 +2099,11 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons { i->second.first = ssfp.getValue().second.first; if (ssfp.getValue().second.second) - i->second.second = ::time(nullptr) + static_cast(ConfigCentralServer::getCtsDenyLoginThresholdSeconds()); + i->second.second = ::time(NULL) + static_cast(ConfigCentralServer::getCtsDenyLoginThresholdSeconds()); } else { - m_playerSceneMap[ssfp.getValue().first]=std::make_pair(ssfp.getValue().second.first, (ssfp.getValue().second.second ? (::time(nullptr) + static_cast(ConfigCentralServer::getCtsDenyLoginThresholdSeconds())) : 0)); + m_playerSceneMap[ssfp.getValue().first]=std::make_pair(ssfp.getValue().second.first, (ssfp.getValue().second.second ? (::time(NULL) + static_cast(ConfigCentralServer::getCtsDenyLoginThresholdSeconds())) : 0)); } } } @@ -2250,7 +2250,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); GenericValueTypeMessage > const msg(ri); - m_timePopulationStatisticsRefresh = ::time(nullptr); + m_timePopulationStatisticsRefresh = ::time(NULL); m_populationStatistics = msg.getValue(); } else if (message.isType("GcwScoreStatRsp")) @@ -2258,7 +2258,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); GenericValueTypeMessage, std::pair >, std::map > > > > const msg(ri); - m_timeGcwScoreStatisticsRefresh = ::time(nullptr); + m_timeGcwScoreStatisticsRefresh = ::time(NULL); std::string const timeGcwScoreStatisticsRefreshStr = CalendarTime::convertEpochToTimeStringLocal(m_timeGcwScoreStatisticsRefresh); std::map const & gcwImperialScorePercentile = msg.getValue().first; @@ -2330,7 +2330,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); GenericValueTypeMessage >, std::map > > > const msg(ri); - m_timeLastLoginTimeStatisticsRefresh = ::time(nullptr); + m_timeLastLoginTimeStatisticsRefresh = ::time(NULL); m_lastLoginTimeStatistics = msg.getValue().first; m_createTimeStatistics = msg.getValue().second; } @@ -2606,7 +2606,7 @@ void CentralServer::removeGameServer(GameServerConnection const *gameServer) } else { - DEBUG_WARNING(true, ("A game server crashed but our process ID ptr is nullptr.")); + DEBUG_WARNING(true, ("A game server crashed but our process ID ptr is null.")); } } @@ -2828,7 +2828,7 @@ void CentralServer::update() if ( ConfigCentralServer::getAuctionEnabled() ) // allow auctions? { - if ( m_pAuctionTransferClient == nullptr ) + if ( m_pAuctionTransferClient == NULL ) { const char* hostName[1] = { ConfigCentralServer::getAuctionServer() }; const short port[1] = { (short)ConfigCentralServer::getAuctionPort() }; @@ -2975,7 +2975,7 @@ void CentralServer::sendToPlanetServer(const std::string &sceneId, const GameNet // ---------------------------------------------------------------------- -void CentralServer::sendToAllConnectionServers(const GameNetworkMessage & message, const bool reliable, Connection const * exclude /*= nullptr*/) +void CentralServer::sendToAllConnectionServers(const GameNetworkMessage & message, const bool reliable, Connection const * exclude /*= NULL*/) { // send to all connection servers for (ConnectionServerConnectionList::const_iterator i = m_connectionServerConnections.begin(); i != m_connectionServerConnections.end(); ++i) @@ -3005,7 +3005,7 @@ void CentralServer::sendToDBProcess(const GameNetworkMessage & message, const bo bool CentralServer::hasDBConnection() const { const GameServerConnection * g = getGameServer(getDbProcessServerProcessId()); - return (g != nullptr); + return (g != NULL); } //----------------------------------------------------------------------- @@ -3110,7 +3110,7 @@ void CentralServer::startPlanetServer(const std::string & host, const std::strin TaskSpawnProcess spawn(host.empty() ? std::string("any") : host, "PlanetServer", options, spawnDelay); CentralServer::getInstance().sendTaskMessage(spawn); - m_pendingPlanetServers[sceneId] = std::make_pair(std::make_pair(host, options), ::time(nullptr)); + m_pendingPlanetServers[sceneId] = std::make_pair(std::make_pair(host, options), ::time(NULL)); IGNORE_RETURN(m_planetsWaitingForPreload.insert(sceneId)); bool const preloadFinished = isPreloadFinished(); @@ -3119,14 +3119,14 @@ void CentralServer::startPlanetServer(const std::string & host, const std::strin else if (m_timeClusterWentIntoLoadingState <= 0) m_timeClusterWentIntoLoadingState = time(0); - if(getInstance().m_transferServerConnection != nullptr && !preloadFinished) + if(getInstance().m_transferServerConnection != NULL && !preloadFinished) { getInstance().m_transferServerConnection->disconnect(); getInstance().m_transferServerConnection = 0; s_retryTransferServerConnection = false; } - if(getInstance().m_stationPlayersCollectorConnection != nullptr && ! isPreloadFinished()) + if(getInstance().m_stationPlayersCollectorConnection != NULL && ! isPreloadFinished()) { getInstance().m_stationPlayersCollectorConnection->disconnect(); getInstance().m_stationPlayersCollectorConnection = 0; @@ -3263,7 +3263,7 @@ void CentralServer::handleGameServerForLoginMessage(const GameServerForLoginMess void CentralServer::handleExchangeListCreditsMessage(const ExchangeListCreditsMessage &msg) { LOG("Exchange", ("Central Server got exchange list credits %d.",msg.getCredits())); - if ( m_pAuctionTransferClient == nullptr ) + if ( m_pAuctionTransferClient == NULL ) { // send failure packet } @@ -3299,7 +3299,7 @@ ConnectionServerConnection * CentralServer::getAnyConnectionServer() ConnectionServerConnection * CentralServer::getConnectionServerForAccount(StationId suid) { - ConnectionServerConnection * result = nullptr; + ConnectionServerConnection * result = NULL; ConnectionServerSUIDMap::iterator i=m_accountConnectionMap.find(suid); if (i!=m_accountConnectionMap.end()) { @@ -3707,7 +3707,7 @@ void CentralServer::checkShutdownProcess() { // if it's been "awhile" since we requested to restart the PlanetServer, // then assume that something has gone wrong, and try the restart again - time_t const timeNow = ::time(nullptr); + time_t const timeNow = ::time(NULL); if ((iterPendingPlanetServer->second.second + static_cast(ConfigCentralServer::getMaxTimeToWaitForPlanetServerStartSeconds())) < timeNow) { @@ -3982,7 +3982,7 @@ int CentralServer::getSecondsClusterHasBeenInLoadingState() const const std::map & CentralServer::getPopulationStatistics(time_t & refreshTime) { // periodically request updated statistics from the game server - time_t const timeNow = ::time(nullptr); + time_t const timeNow = ::time(NULL); if (m_timePopulationStatisticsNextRefresh <= timeNow) { GameServerConnection * universeGameServerConnection = getGameServer(UniverseManager::getInstance().getUniverseProcess()); @@ -4004,7 +4004,7 @@ const std::map & CentralServer::getPopulationStatistics(time_t const std::map > > & CentralServer::getGcwScoreStatistics(time_t & refreshTime) { // periodically request updated statistics from the game server - time_t const timeNow = ::time(nullptr); + time_t const timeNow = ::time(NULL); if (m_timeGcwScoreStatisticsNextRefresh <= timeNow) { GameServerConnection * universeGameServerConnection = getGameServer(UniverseManager::getInstance().getUniverseProcess()); @@ -4026,7 +4026,7 @@ const std::map > std::pair > const *, std::map > const *> CentralServer::getLastLoginTimeStatistics(time_t & refreshTime) { // periodically request updated statistics from the game server - time_t const timeNow = ::time(nullptr); + time_t const timeNow = ::time(NULL); if (m_timeLastLoginTimeStatisticsNextRefresh <= timeNow) { GameServerConnection * universeGameServerConnection = getGameServer(UniverseManager::getInstance().getUniverseProcess()); @@ -4049,7 +4049,7 @@ std::pair > const *, std::map characterMatchStatisticsRequest("LfgStatReq", 0); diff --git a/engine/server/application/CentralServer/src/shared/CentralServer.h b/engine/server/application/CentralServer/src/shared/CentralServer.h index 262552b0..d628b2fa 100755 --- a/engine/server/application/CentralServer/src/shared/CentralServer.h +++ b/engine/server/application/CentralServer/src/shared/CentralServer.h @@ -121,7 +121,7 @@ public: void sendToAllGameServersExceptDBProcess(const GameNetworkMessage & message, const bool reliable); void sendToAllPlanetServers(const GameNetworkMessage & message, const bool reliable); void sendToPlanetServer(const std::string &sceneId, const GameNetworkMessage & message, const bool reliable); - void sendToAllConnectionServers(const GameNetworkMessage & message, const bool reliable, Connection const * exclude = nullptr); + void sendToAllConnectionServers(const GameNetworkMessage & message, const bool reliable, Connection const * exclude = NULL); void sendToConnectionServerForAccount(StationId account, const GameNetworkMessage & message, const bool reliable); void sendToDBProcess(const GameNetworkMessage & message, const bool reliable) const; void sendToLoginServer(uint32 loginServerId, const GameNetworkMessage &message); diff --git a/engine/server/application/CentralServer/src/shared/CentralServerMetricsData.cpp b/engine/server/application/CentralServer/src/shared/CentralServerMetricsData.cpp index b34c0174..19307914 100755 --- a/engine/server/application/CentralServer/src/shared/CentralServerMetricsData.cpp +++ b/engine/server/application/CentralServer/src/shared/CentralServerMetricsData.cpp @@ -148,7 +148,7 @@ void CentralServerMetricsData::updateData() // appear yellow to draw attention) for some amount of time // after detecting a system time mismatch issue #ifndef WIN32 - if ((lastTimeSystemTimeMismatchNotification + ConfigCentralServer::getSystemTimeMismatchAlertIntervalSeconds()) > ::time(nullptr)) + if ((lastTimeSystemTimeMismatchNotification + ConfigCentralServer::getSystemTimeMismatchAlertIntervalSeconds()) > ::time(NULL)) m_data[m_systemTimeMismatch].m_value = STATUS_LOADING; else m_data[m_systemTimeMismatch].m_value = 1; @@ -202,7 +202,7 @@ void CentralServerMetricsData::updateData() std::string label("population."); label += iter->first; - m_mapPopulationStatisticsIndex[iter->first] = addMetric(label.c_str(), 0, nullptr, false, false); + m_mapPopulationStatisticsIndex[iter->first] = addMetric(label.c_str(), 0, NULL, false, false); } } } @@ -235,7 +235,7 @@ void CentralServerMetricsData::updateData() } else { - gcwScoreStatisticsIndex = addMetric(iter->first.c_str(), 0, nullptr, false, false); + gcwScoreStatisticsIndex = addMetric(iter->first.c_str(), 0, NULL, false, false); IGNORE_RETURN(m_mapGcwScoreStatisticsIndex.insert(std::make_pair(iter->first, gcwScoreStatisticsIndex))); } @@ -263,7 +263,7 @@ void CentralServerMetricsData::updateData() std::string label("population."); label += secondIter.first; - m_mapLastLoginTimeStatisticsIndex[secondIter.first] = addMetric(label.c_str(), 0, nullptr, false, false); + m_mapLastLoginTimeStatisticsIndex[secondIter.first] = addMetric(label.c_str(), 0, NULL, false, false); } } } @@ -288,7 +288,7 @@ void CentralServerMetricsData::updateData() std::string label("population."); label += iter->second.first; - m_mapCreateTimeStatisticsIndex[iter->second.first] = addMetric(label.c_str(), 0, nullptr, false, false); + m_mapCreateTimeStatisticsIndex[iter->second.first] = addMetric(label.c_str(), 0, NULL, false, false); } } } diff --git a/engine/server/application/CentralServer/src/shared/CharacterCreationTracker.cpp b/engine/server/application/CentralServer/src/shared/CharacterCreationTracker.cpp index b56ee398..5cbdb5c9 100755 --- a/engine/server/application/CentralServer/src/shared/CharacterCreationTracker.cpp +++ b/engine/server/application/CentralServer/src/shared/CharacterCreationTracker.cpp @@ -26,13 +26,13 @@ // ====================================================================== -CharacterCreationTracker * CharacterCreationTracker::ms_instance = nullptr; +CharacterCreationTracker * CharacterCreationTracker::ms_instance = NULL; // ====================================================================== void CharacterCreationTracker::install() { - DEBUG_FATAL(ms_instance != nullptr,("Called install() twice.\n")); + DEBUG_FATAL(ms_instance != NULL,("Called install() twice.\n")); ms_instance = new CharacterCreationTracker; ExitChain::add(CharacterCreationTracker::remove,"CharacterCreationTracker::remove"); } @@ -354,8 +354,8 @@ void CharacterCreationTracker::setFastCreationLock(StationId account) CharacterCreationTracker::CreationRecord::CreationRecord() : m_stage(S_queuedForGameServer), - m_gameCreationRequest(nullptr), - m_loginCreationRequest(nullptr), + m_gameCreationRequest(NULL), + m_loginCreationRequest(NULL), m_creationTime(ServerClock::getInstance().getGameTimeSeconds()), m_gameServerId(0), m_loginServerId(0), diff --git a/engine/server/application/CentralServer/src/shared/ConsoleCommandParserGame.cpp b/engine/server/application/CentralServer/src/shared/ConsoleCommandParserGame.cpp index 5c5f351d..3231ecff 100755 --- a/engine/server/application/CentralServer/src/shared/ConsoleCommandParserGame.cpp +++ b/engine/server/application/CentralServer/src/shared/ConsoleCommandParserGame.cpp @@ -117,8 +117,8 @@ bool ConsoleCommandParserGame::performParsing(const NetworkId & track, const Str if( argv.size() > 4 ) { LOG("ServerConsole", ("Received command to shutdown the cluster.")); - uint32 timeToShutdown = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), nullptr, 10); - uint32 maxTime = strtoul(Unicode::wideToNarrow(argv[3]).c_str(), nullptr, 10); + uint32 timeToShutdown = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), NULL, 10); + uint32 maxTime = strtoul(Unicode::wideToNarrow(argv[3]).c_str(), NULL, 10); Unicode::String systemMessage = Unicode::narrowToWide(""); for(unsigned int i = 4; i < argv.size(); ++i) { @@ -141,7 +141,7 @@ bool ConsoleCommandParserGame::performParsing(const NetworkId & track, const Str { if(argv.size() > 1) { - unsigned int stationId = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), nullptr, 10); + unsigned int stationId = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), NULL, 10); if(stationId > 0) { GenericValueTypeMessage auth("AuthorizeDownload", stationId); diff --git a/engine/server/application/CentralServer/src/shared/ConsoleManager.cpp b/engine/server/application/CentralServer/src/shared/ConsoleManager.cpp index 6535d3db..d162fbb3 100755 --- a/engine/server/application/CentralServer/src/shared/ConsoleManager.cpp +++ b/engine/server/application/CentralServer/src/shared/ConsoleManager.cpp @@ -16,7 +16,7 @@ namespace ConsoleManagerNamespace { - ConsoleCommandParser * s_consoleCommandParserRoot = nullptr; + ConsoleCommandParser * s_consoleCommandParserRoot = NULL; } using namespace ConsoleManagerNamespace; diff --git a/engine/server/application/CentralServer/src/shared/PlanetManager.cpp b/engine/server/application/CentralServer/src/shared/PlanetManager.cpp index 33d47cbd..f9912dde 100755 --- a/engine/server/application/CentralServer/src/shared/PlanetManager.cpp +++ b/engine/server/application/CentralServer/src/shared/PlanetManager.cpp @@ -138,7 +138,7 @@ PlanetServerConnection *PlanetManager::getPlanetServerForScene(const std::string if (i!=instance().m_servers.end()) return (*i).second.m_connection; else - return nullptr; + return NULL; } // ---------------------------------------------------------------------- diff --git a/engine/server/application/ChatServer/src/linux/main.cpp b/engine/server/application/ChatServer/src/linux/main.cpp index 295c53f2..eecd0c24 100755 --- a/engine/server/application/ChatServer/src/linux/main.cpp +++ b/engine/server/application/ChatServer/src/linux/main.cpp @@ -29,7 +29,7 @@ int main(int argc, char ** argv) SetupSharedFile::install(false); SetupSharedNetworkMessages::install(); - SetupSharedRandom::install(static_cast(time(nullptr))); //lint !e1924 !e64 // nullptr is a C-Style cast? + SetupSharedRandom::install(static_cast(time(NULL))); //lint !e1924 !e64 // NULL is a C-Style cast? Os::setProgramName("ChatServer"); //setup the server diff --git a/engine/server/application/ChatServer/src/shared/CentralServerConnection.cpp b/engine/server/application/ChatServer/src/shared/CentralServerConnection.cpp index decda6cf..b9fa2835 100755 --- a/engine/server/application/ChatServer/src/shared/CentralServerConnection.cpp +++ b/engine/server/application/ChatServer/src/shared/CentralServerConnection.cpp @@ -98,7 +98,7 @@ void CentralServerConnection::onReceive(const Archive::ByteStream & message) std::string const newNameNormalized(newName, 0, newName.find(' ')); ChatAvatarId const newAvatar("SWG", ConfigChatServer::getClusterName(), newNameNormalized); - IGNORE_RETURN(ChatServer::getChatInterface()->RequestTransferAvatar(msg.getStationId(), oldAvatar.getName(), oldAvatar.getAPIAddress(), msg.getStationId(), newAvatar.getName(), newAvatar.getAPIAddress(), true, nullptr)); + IGNORE_RETURN(ChatServer::getChatInterface()->RequestTransferAvatar(msg.getStationId(), oldAvatar.getName(), oldAvatar.getAPIAddress(), msg.getStationId(), newAvatar.getName(), newAvatar.getAPIAddress(), true, NULL)); } } else if (m.isType("ChatDestroyAvatar")) diff --git a/engine/server/application/ChatServer/src/shared/ChatInterface.cpp b/engine/server/application/ChatServer/src/shared/ChatInterface.cpp index 75aeae1b..1ad72571 100755 --- a/engine/server/application/ChatServer/src/shared/ChatInterface.cpp +++ b/engine/server/application/ChatServer/src/shared/ChatInterface.cpp @@ -350,7 +350,7 @@ void ChatInterface::OnGetRoom(unsigned track, unsigned result, const ChatRoom *r if (room) makeRoomName(room, roomName); //printf("!!!!!!!!!!!!got room %s\n", roomName.c_str()); - if (strstr(roomName.c_str(), "group") == nullptr) + if (strstr(roomName.c_str(), "group") == NULL) { ChatServer::putSystemAvatarInRoom(roomName); } @@ -373,7 +373,7 @@ void ChatInterface::OnGetRoom(unsigned track, unsigned result, const ChatRoom *r } } - ChatServerRoomOwner *owner = nullptr; + ChatServerRoomOwner *owner = NULL; if (room) owner = getRoomOwner(room->getRoomID()); @@ -709,12 +709,12 @@ std::string makeCanonicalName(const std::string &characterName) { retVal = toUpper(tmp); } - tmp = strtok(nullptr, "."); + tmp = strtok(NULL, "."); if (tmp) { retVal += (dot + tmp); } - tmp = strtok(nullptr, "."); + tmp = strtok(NULL, "."); if (tmp) { retVal += (dot + tmp); @@ -796,7 +796,7 @@ void ChatInterface::DestroyAvatar(const std::string & characterName) // track how many times we have called RequestGetAnyAvatar() for this particular DestroyAvatar // operation, so that we can stop if we somehow get stuck in an infinite loop - unsigned const trackID = RequestGetAnyAvatar(ChatUnicodeString(avatar.getName()), ChatUnicodeString(avatar.getAPIAddress()), nullptr); + unsigned const trackID = RequestGetAnyAvatar(ChatUnicodeString(avatar.getName()), ChatUnicodeString(avatar.getAPIAddress()), NULL); trackingRequestGetAnyAvatarForDestroy[trackID] = std::make_pair(std::make_pair(ChatUnicodeString(avatar.getName()), ChatUnicodeString(avatar.getAPIAddress())), 1); } @@ -848,7 +848,7 @@ void ChatInterface::sendQueuedHeadersToClient() const unsigned long queuedHeadersSendTime = currentTime + static_cast(s_intervalToSendHeadersToClientSeconds); int numberHeadersSent = 0; - const ChatPersistentMessageToClient * header = nullptr; + const ChatPersistentMessageToClient * header = NULL; for (std::map > >::iterator iter = queuedHeaders.begin(); iter != queuedHeaders.end();) { @@ -900,7 +900,7 @@ void ChatInterface::clearQueuedHeadersForAvatar(const ChatAvatarId & avatarId) void ChatInterface::addQueuedHeaderForAvatar(const ChatAvatarId & avatarId, const ChatPersistentMessageToClient * header, unsigned long sendTime) { - if (header == nullptr) + if (header == NULL) return; std::pair > & queuedHeader = queuedHeaders[avatarId]; @@ -923,7 +923,7 @@ ChatServerAvatarOwner *ChatInterface::getAvatarOwner(const ChatAvatar *avatar) return (*f).second; } } - return nullptr; + return NULL; } //----------------------------------------------------------------------- @@ -944,7 +944,7 @@ void ChatInterface::OnAddModerator(unsigned track, unsigned result, const ChatAv sequence = pair->sequence; delete pair; - pair = nullptr; + pair = NULL; } ChatAvatarId srcId; @@ -1057,7 +1057,7 @@ void ChatInterface::OnRemoveModerator(unsigned track, unsigned result, const Cha sequence = pair->sequence; delete pair; - pair = nullptr; + pair = NULL; } ChatAvatarId srcId; @@ -1178,7 +1178,7 @@ void ChatInterface::OnAddFriend(unsigned track, unsigned result, const ChatAvata ChatAvatarId d; makeAvatarId(destName, destAddress, d); - ChatServerAvatarOwner * mo = nullptr; + ChatServerAvatarOwner * mo = NULL; if (srcAvatar) mo = getAvatarOwner(srcAvatar); @@ -1206,7 +1206,7 @@ void ChatInterface::OnRemoveFriend(unsigned track, unsigned result, const ChatAv ChatAvatarId d; makeAvatarId(destName, destAddress, d); - ChatServerAvatarOwner * mo = nullptr; + ChatServerAvatarOwner * mo = NULL; if (srcAvatar) mo = getAvatarOwner(srcAvatar); @@ -1245,7 +1245,7 @@ void ChatInterface::OnIgnoreStatus(unsigned track, unsigned result, const ChatAv } } - ChatServerAvatarOwner * mo = nullptr; + ChatServerAvatarOwner * mo = NULL; if (srcAvatar) mo = getAvatarOwner(srcAvatar); if(mo) @@ -1281,7 +1281,7 @@ void ChatInterface::OnFriendStatus(unsigned track, unsigned result, const ChatAv idList.push_back(id); } } - ChatServerAvatarOwner * mo = nullptr; + ChatServerAvatarOwner * mo = NULL; if (srcAvatar) mo = getAvatarOwner(srcAvatar); if(mo) @@ -1304,7 +1304,7 @@ void ChatInterface::OnReceiveFriendLogin(const ChatAvatar *srcAvatar, const Chat PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnReceiveFriendLogin"); UNREF(srcAddress); - ChatServerAvatarOwner * owner = nullptr; + ChatServerAvatarOwner * owner = NULL; if (destAvatar) owner = getAvatarOwner(destAvatar); if(owner) @@ -1332,7 +1332,7 @@ void ChatInterface::OnReceiveFriendLogout(const ChatAvatar *srcAvatar, const Cha PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnReceiveFriendLogout"); UNREF(srcAddress); - ChatServerAvatarOwner * owner = nullptr; + ChatServerAvatarOwner * owner = NULL; if (destAvatar) owner = getAvatarOwner(destAvatar); if(owner) @@ -1395,7 +1395,7 @@ void ChatInterface::OnRemoveIgnore(unsigned track, unsigned result, const ChatAv ChatAvatarId d; makeAvatarId(destName, destAddress, d); - ChatServerAvatarOwner * mo = nullptr; + ChatServerAvatarOwner * mo = NULL; if (srcAvatar) mo = getAvatarOwner(srcAvatar); if(mo) @@ -1435,7 +1435,7 @@ void ChatInterface::OnLoginAvatar(unsigned track, unsigned result, const ChatAva if ((result == CHATRESULT_SUCCESS) && newAvatar) { // destroy chat avatar - unsigned const trackID = RequestDestroyAvatar(newAvatar, nullptr); + unsigned const trackID = RequestDestroyAvatar(newAvatar, NULL); trackingRequestGetAnyAvatarForDestroy[trackID] = iterFind->second; } @@ -1504,7 +1504,7 @@ void ChatInterface::OnLoginAvatar(unsigned track, unsigned result, const ChatAva static Unicode::String wideFilter = Unicode::narrowToWide(""); static ChatUnicodeString swgNode(wideSWG.data(), wideSWG.size()); static ChatUnicodeString filter(wideFilter.data(), wideFilter.size()); - IGNORE_RETURN(RequestGetRoomSummaries(swgNode, filter, nullptr)); + IGNORE_RETURN(RequestGetRoomSummaries(swgNode, filter, NULL)); } } else @@ -1525,11 +1525,11 @@ void ChatInterface::OnLoginAvatar(unsigned track, unsigned result, const ChatAva if(ChatServer::isGod(f->second)) { - RequestSetAvatarAttributes(newAvatar, AVATARATTR_GM, nullptr); + RequestSetAvatarAttributes(newAvatar, AVATARATTR_GM, NULL); } else { - RequestSetAvatarAttributes(newAvatar, 0, nullptr); + RequestSetAvatarAttributes(newAvatar, 0, NULL); } ChatServer::chatConnectedAvatar((*f).second, *newAvatar); @@ -1549,7 +1549,7 @@ void ChatInterface::OnLoginAvatar(unsigned track, unsigned result, const ChatAva //ChatServer::getFriendsList(id); clearQueuedHeadersForAvatar(avId); - IGNORE_RETURN(RequestGetPersistentHeaders(newAvatar, nullptr)); + IGNORE_RETURN(RequestGetPersistentHeaders(newAvatar, NULL)); //REPORT_LOG(true, ("Connection to chat system for %s.%s.%s confirmed\n", avatar.GetGameCode().c_str(), avatar.GetGameServerName().c_str(), avatar.GetCharacterName().c_str())); }//lint !e429 Custodial pointer 'owner' has not been freed or returned // jrandall avatar owns it pendingAvatars.erase(f); @@ -1560,7 +1560,7 @@ void ChatInterface::OnLoginAvatar(unsigned track, unsigned result, const ChatAva // the time they connected to the connection server and the time // this message arrived from the chat backend. if (newAvatar) - IGNORE_RETURN(RequestLogoutAvatar(newAvatar, nullptr)); + IGNORE_RETURN(RequestLogoutAvatar(newAvatar, NULL)); } } ChatOnConnectAvatar const connect; @@ -1585,7 +1585,7 @@ void ChatInterface::OnCreateRoom(unsigned track,unsigned result, const ChatRoom static ChatUnicodeString swgNode(wideSWG.data(), wideSWG.size()); static ChatUnicodeString filter(wideFilter.data(), wideFilter.size()); //printf("!!!!Calling GetRoomSummaries from OnCreateRoom\n"); - //IGNORE_RETURN(RequestGetRoomSummaries(swgNode, filter, nullptr)); + //IGNORE_RETURN(RequestGetRoomSummaries(swgNode, filter, NULL)); ChatRoomData roomData; @@ -1598,7 +1598,7 @@ void ChatInterface::OnCreateRoom(unsigned track,unsigned result, const ChatRoom //Unicode::String wideRoomName(newRoom->getRoomName().string_data, newRoom->getRoomName().string_length); std::string roomName; makeRoomName(newRoom, roomName); - if (strstr(roomName.c_str(), "group") == nullptr) + if (strstr(roomName.c_str(), "group") == NULL) { ChatServer::putSystemAvatarInRoom(roomName); } @@ -1644,7 +1644,7 @@ void ChatInterface::OnGetRoomSummaries(unsigned track, unsigned result, unsigned std::unordered_map::const_iterator f = roomList.find(lowerRoomName); if(f == roomList.end()) { - RequestGetRoom(foundRooms[i].getRoomAddress(), nullptr); + RequestGetRoom(foundRooms[i].getRoomAddress(), NULL); //ChatServerRoomOwner * o = new ChatServerRoomOwner((*i)); //(*i)->SetRoomOwnerPtr(o); //IGNORE_RETURN(roomList.insert(std::make_pair(lowerRoomName, *o))); @@ -1664,7 +1664,7 @@ const ChatServerRoomOwner *ChatInterface::getRoomOwner(const std::string & roomN { return &((*f).second); } - return nullptr; + return NULL; } //----------------------------------------------------------------------- @@ -1680,7 +1680,7 @@ ChatServerRoomOwner *ChatInterface::getRoomOwner(unsigned roomId) } ++f; } - return nullptr; + return NULL; } //----------------------------------------------------------------------- @@ -1727,13 +1727,13 @@ void ChatInterface::OnDestroyRoom(unsigned track, unsigned result, void *user) static Unicode::String wideFilter = Unicode::narrowToWide(""); static ChatUnicodeString swgNode(wideSWG.data(), wideSWG.size()); static ChatUnicodeString filter(wideFilter.data(), wideFilter.size()); - //IGNORE_RETURN(RequestGetRoomSummaries(swgNode, filter, nullptr)); + //IGNORE_RETURN(RequestGetRoomSummaries(swgNode, filter, NULL)); ChatAvatarId destroyer; RoomOwnerSequencePair *pair = (RoomOwnerSequencePair *)user; - const ChatServerRoomOwner * owner = nullptr; + const ChatServerRoomOwner * owner = NULL; unsigned sequence = 0; if (pair) { @@ -1805,7 +1805,7 @@ void ChatInterface::OnDestroyAvatar(unsigned track, unsigned result, const ChatA // stop if it looks like we're in an infinite loop if (iterFind->second.second <= 25) { - unsigned const trackID = RequestGetAnyAvatar(iterFind->second.first.first, iterFind->second.first.second, nullptr); + unsigned const trackID = RequestGetAnyAvatar(iterFind->second.first.first, iterFind->second.first.second, NULL); trackingRequestGetAnyAvatarForDestroy[trackID] = std::make_pair(iterFind->second.first, (iterFind->second.second + 1)); } } @@ -1828,13 +1828,13 @@ void ChatInterface::OnGetAnyAvatar(unsigned track, unsigned result, const ChatAv // can only destroy the avatar if he is logged in if (loggedIn) { - unsigned const trackID = RequestDestroyAvatar(foundAvatar, nullptr); + unsigned const trackID = RequestDestroyAvatar(foundAvatar, NULL); trackingRequestGetAnyAvatarForDestroy[trackID] = iterFind->second; } // log in the chat avatar so we can destroy him else { - unsigned const trackID = RequestLoginAvatar(foundAvatar->getUserID(), foundAvatar->getName(), foundAvatar->getAddress(), nullptr); + unsigned const trackID = RequestLoginAvatar(foundAvatar->getUserID(), foundAvatar->getName(), foundAvatar->getAddress(), NULL); trackingRequestGetAnyAvatarForDestroy[trackID] = iterFind->second; } } @@ -1850,9 +1850,9 @@ void ChatInterface::OnReceiveForcedLogout(const ChatAvatar *oldAvatar) ChatServer::fileLog(false, "ChatInterface", "OnReceiveForcedLogout() oldAvatar(%s)", ChatServer::getFullChatAvatarName(oldAvatar).c_str()); PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnReceiveForcedLogout"); - if (oldAvatar == nullptr) + if (oldAvatar == NULL) { - DEBUG_WARNING(true, ("We received an OnReceiveForcedLogout with a success result code but nullptr data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnReceiveForcedLogout with a success result code but NULL data. This is an error that the API should never give.")); return; } ChatAvatarId id; @@ -1876,9 +1876,9 @@ void ChatInterface::OnEnterRoom(unsigned track, unsigned result, const ChatAvata PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnEnterRoom"); - if (result == CHATRESULT_SUCCESS && (srcAvatar == nullptr || destRoom == nullptr)) + if (result == CHATRESULT_SUCCESS && (srcAvatar == NULL || destRoom == NULL)) { - DEBUG_WARNING(true, ("We received an OnEnterRoom with a success result code but nullptr data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnEnterRoom with a success result code but NULL data. This is an error that the API should never give.")); return; } @@ -2097,9 +2097,9 @@ void ChatInterface::OnAddBan(unsigned track, unsigned result, const ChatAvatar * PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnAddBan"); - if (result == CHATRESULT_SUCCESS && (srcAvatar == nullptr || destRoom == nullptr)) + if (result == CHATRESULT_SUCCESS && (srcAvatar == NULL || destRoom == NULL)) { - DEBUG_WARNING(true, ("We received an OnAddBan with a success result code but nullptr data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnAddBan with a success result code but NULL data. This is an error that the API should never give.")); return; } @@ -2113,7 +2113,7 @@ void ChatInterface::OnAddBan(unsigned track, unsigned result, const ChatAvatar * sequence = pair->sequence; delete pair; - pair = nullptr; + pair = NULL; } ChatAvatarId srcId; @@ -2218,9 +2218,9 @@ void ChatInterface::OnRemoveBan(unsigned track, unsigned result, const ChatAvata PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnRemoveBan"); - if (result == CHATRESULT_SUCCESS && (srcAvatar == nullptr || destRoom == nullptr)) + if (result == CHATRESULT_SUCCESS && (srcAvatar == NULL || destRoom == NULL)) { - DEBUG_WARNING(true, ("We received an OnRemoveBan with a success result code but nullptr data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnRemoveBan with a success result code but NULL data. This is an error that the API should never give.")); return; } @@ -2234,7 +2234,7 @@ void ChatInterface::OnRemoveBan(unsigned track, unsigned result, const ChatAvata sequence = pair->sequence; delete pair; - pair = nullptr; + pair = NULL; } ChatAvatarId srcId; @@ -2337,9 +2337,9 @@ void ChatInterface::OnAddInvite(unsigned track, unsigned result, const ChatAvata PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnAddInvite"); - if (result == CHATRESULT_SUCCESS && (srcAvatar == nullptr || destRoom == nullptr)) + if (result == CHATRESULT_SUCCESS && (srcAvatar == NULL || destRoom == NULL)) { - DEBUG_WARNING(true, ("We received an OnAddInvite with a success result code but nullptr data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnAddInvite with a success result code but NULL data. This is an error that the API should never give.")); return; } @@ -2353,7 +2353,7 @@ void ChatInterface::OnAddInvite(unsigned track, unsigned result, const ChatAvata sequence = pair->sequence; delete pair; - pair = nullptr; + pair = NULL; } ChatAvatarId srcId; @@ -2378,7 +2378,7 @@ void ChatInterface::OnAddInvite(unsigned track, unsigned result, const ChatAvata { // Calling this on a room will cause the API to cache the room // and to receive room updates for the room. - RequestGetRoom(destRoom->getAddress(), nullptr); + RequestGetRoom(destRoom->getAddress(), NULL); // Send the room data for the room the avatar was invited to join // since the room may be private and may be unknown to the player @@ -2455,9 +2455,9 @@ void ChatInterface::OnRemoveInvite(unsigned track, unsigned result, const ChatAv PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnRemoveInvite"); - if (result == CHATRESULT_SUCCESS && (srcAvatar == nullptr || destRoom == nullptr)) + if (result == CHATRESULT_SUCCESS && (srcAvatar == NULL || destRoom == NULL)) { - DEBUG_WARNING(true, ("We received an OnRemoveInvite with a success result code but nullptr data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnRemoveInvite with a success result code but NULL data. This is an error that the API should never give.")); return; } @@ -2471,7 +2471,7 @@ void ChatInterface::OnRemoveInvite(unsigned track, unsigned result, const ChatAv sequence = pair->sequence; delete pair; - pair = nullptr; + pair = NULL; } std::string roomName; @@ -2555,9 +2555,9 @@ void ChatInterface::OnLeaveRoom(unsigned track, unsigned result, const ChatAvata PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnLeaveRoom"); - if (result == CHATRESULT_SUCCESS && (srcAvatar == nullptr || destRoom == nullptr)) + if (result == CHATRESULT_SUCCESS && (srcAvatar == NULL || destRoom == NULL)) { - DEBUG_WARNING(true, ("We received an OnLeaveRoom with a success result code but nullptr data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnLeaveRoom with a success result code but NULL data. This is an error that the API should never give.")); return; } @@ -2653,7 +2653,7 @@ void ChatInterface::OnKickAvatar(unsigned track, unsigned result, const ChatAvat sequence = pair->sequence; delete pair; - pair = nullptr; + pair = NULL; } std::string roomName; @@ -2755,9 +2755,9 @@ void ChatInterface::OnGetPersistentMessage(unsigned track, unsigned result, Chat ChatServer::fileLog(false, "ChatInterface", "OnGetPersistentMessage() track(%u) result(%u) destAvatar(%s)", track, result, ChatServer::getFullChatAvatarName(destAvatar).c_str()); PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnGetPersistentMessage"); - if (result == CHATRESULT_SUCCESS && (destAvatar == nullptr)) + if (result == CHATRESULT_SUCCESS && (destAvatar == NULL)) { - DEBUG_WARNING(true, ("We received an OnGetPersistentMessage with a success result code but nullptr data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnGetPersistentMessage with a success result code but NULL data. This is an error that the API should never give.")); return; } UNREF(user); @@ -2807,9 +2807,9 @@ void ChatInterface::OnGetPersistentHeaders(unsigned track, unsigned result, Chat ChatServer::fileLog(false, "ChatInterface", "OnGetPersistentHeaders() track(%u) result(%u) destAvatar(%s)", track, result, ChatServer::getFullChatAvatarName(destAvatar).c_str(), listLength); PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnGetPersistentHeaders"); - if (result == CHATRESULT_SUCCESS && (destAvatar == nullptr)) + if (result == CHATRESULT_SUCCESS && (destAvatar == NULL)) { - DEBUG_WARNING(true, ("We received an OnGetPersistentHeaders with a success result code but nullptr data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnGetPersistentHeaders with a success result code but NULL data. This is an error that the API should never give.")); return; } UNREF(track); @@ -2876,9 +2876,9 @@ void ChatInterface::OnReceivePersistentMessage(const ChatAvatar *destAvatar, con ChatServer::fileLog(false, "ChatInterface", "OnReceivePersistentMessage() destAvatar(%s)", ChatServer::getFullChatAvatarName(destAvatar).c_str()); PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnReceivePersistentMessage"); - if (destAvatar == nullptr) + if (destAvatar == NULL) { - DEBUG_WARNING(true, ("We received an OnREceivePersistentMessage with a success result code but nullptr data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnREceivePersistentMessage with a success result code but NULL data. This is an error that the API should never give.")); return; } if (!header) @@ -2910,9 +2910,9 @@ void ChatInterface::OnSendRoomMessage(unsigned track, unsigned result, const Cha ChatServer::fileLog(false, "ChatInterface", "OnSendRoomMessage() track(%u) result(%u) srcAvatar(%s) destRoom(%s)", track, result, ChatServer::getFullChatAvatarName(srcAvatar).c_str(), ChatServer::getChatRoomNameNarrow(destRoom).c_str()); PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnSendRoomMessage"); - if (result == CHATRESULT_SUCCESS && (srcAvatar == nullptr || destRoom == nullptr)) + if (result == CHATRESULT_SUCCESS && (srcAvatar == NULL || destRoom == NULL)) { - DEBUG_WARNING(true, ("We received an OnsendRoomMessage with a success result code but nullptr data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnsendRoomMessage with a success result code but NULL data. This is an error that the API should never give.")); return; } UNREF(srcAvatar); @@ -2931,7 +2931,7 @@ void ChatInterface::OnReceiveRoomMessage(const ChatAvatar *srcAvatar, const Chat PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnReceiveRoomMessage"); if(! srcAvatar || ! destAvatar || ! destRoom) { - DEBUG_WARNING(true, ("We received an OnREceiveRoomMessage with a success result code but nullptr data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnREceiveRoomMessage with a success result code but NULL data. This is an error that the API should never give.")); return; } @@ -2995,9 +2995,9 @@ void ChatInterface::OnSendInstantMessage(unsigned track, unsigned result, const PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnSendInstantMessage"); - if (result == CHATRESULT_SUCCESS && (srcAvatar == nullptr)) + if (result == CHATRESULT_SUCCESS && (srcAvatar == NULL)) { - DEBUG_WARNING(true, ("We received an OnSendInstantMessage with a success result code but nullptr data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnSendInstantMessage with a success result code but NULL data. This is an error that the API should never give.")); return; } UNREF(srcAvatar); @@ -3015,9 +3015,9 @@ void ChatInterface::OnReceiveInstantMessage(const ChatAvatar *srcAvatar, const C ChatServer::fileLog(false, "ChatInterface", "OnReceiveInstantMessage() srcAvatar(%s) destAvatar(%s)", ChatServer::getFullChatAvatarName(srcAvatar).c_str(), ChatServer::getFullChatAvatarName(destAvatar).c_str()); PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnReceiveInstantMessage"); - if ((srcAvatar == nullptr || destAvatar == nullptr)) + if ((srcAvatar == NULL || destAvatar == NULL)) { - DEBUG_WARNING(true, ("We received an OnReceiveInstantMessage with a success result code but nullptr data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnReceiveInstantMessage with a success result code but NULL data. This is an error that the API should never give.")); return; } ChatAvatarId fromId; @@ -3052,9 +3052,9 @@ void ChatInterface::OnSendPersistentMessage(unsigned track, unsigned result, con ChatServer::fileLog(false, "ChatInterface", "OnSendPersistentMessage() track(%u) result(%u) srcAvatar(%s)", track, result, ChatServer::getFullChatAvatarName(srcAvatar).c_str()); PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnSendPersistentMessage"); - if (result == CHATRESULT_SUCCESS && (srcAvatar == nullptr)) + if (result == CHATRESULT_SUCCESS && (srcAvatar == NULL)) { - DEBUG_WARNING(true, ("We received an OnSendPersistentMessage with a success result code but nullptr data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnSendPersistentMessage with a success result code but NULL data. This is an error that the API should never give.")); return; } unsigned sequence = (unsigned)user; @@ -3120,7 +3120,7 @@ void ChatInterface::OnUpdatePersistentMessages(unsigned track, unsigned result, ChatAvatarId targetChatAvatarId; - if (targetAvatar != nullptr) + if (targetAvatar != NULL) { makeAvatarId(*targetAvatar, targetChatAvatarId); } @@ -3130,17 +3130,17 @@ void ChatInterface::OnUpdatePersistentMessages(unsigned track, unsigned result, ChatAvatarId sourceChatAvatarId; NetworkId const *tmpNetworkId = reinterpret_cast(user); - if (tmpNetworkId != nullptr) + if (tmpNetworkId != NULL) { ChatAvatar const *sourceAvatar = ChatServer::getAvatarByNetworkId(*tmpNetworkId); - if (sourceAvatar != nullptr) + if (sourceAvatar != NULL) { makeAvatarId(*sourceAvatar, sourceChatAvatarId); } delete tmpNetworkId; - tmpNetworkId = nullptr; + tmpNetworkId = NULL; } ChatServer::fileLog(false, "ChatInterface", "OnUpdatePersistentMessage() track(%u) result(%u) sourceAvatar(%s) targetAvatar(%s)", track, result, sourceChatAvatarId.getFullName().c_str(), targetChatAvatarId.getFullName().c_str()); diff --git a/engine/server/application/ChatServer/src/shared/ChatServer.cpp b/engine/server/application/ChatServer/src/shared/ChatServer.cpp index c8e12a6d..76d47a9c 100755 --- a/engine/server/application/ChatServer/src/shared/ChatServer.cpp +++ b/engine/server/application/ChatServer/src/shared/ChatServer.cpp @@ -162,7 +162,7 @@ void ChatServerNamespace::cleanChatLog() //----------------------------------------------------------------------- -ChatServer *ChatServer::m_instance = nullptr; +ChatServer *ChatServer::m_instance = NULL; #include @@ -250,7 +250,7 @@ if ((t3 - t2) > (1000 * 5)) static Unicode::String wideFilter = Unicode::narrowToWide(""); static ChatUnicodeString swgNode(wideSWG.data(), wideSWG.size()); static ChatUnicodeString filter(wideFilter.data(), wideFilter.size()); - instance().chatInterface->RequestGetRoomSummaries(swgNode, filter, nullptr); + instance().chatInterface->RequestGetRoomSummaries(swgNode, filter, NULL); } ++i; @@ -286,7 +286,7 @@ gameService(0), planetService(), ownerSystem(0), systemAvatarId("SWG", ConfigChatServer::getClusterName(), "SYSTEM"), -customerServiceServerConnection(nullptr), +customerServiceServerConnection(NULL), m_gameServerConnectionRegistry(), m_voiceChatIdMap() { @@ -452,7 +452,7 @@ void ChatServer::setOwnerSystem(const ChatAvatar * o) Connection *connection = safe_cast(instance().centralServerConnection); - if (connection != nullptr) + if (connection != NULL) { connection->send(bs, true); } @@ -618,7 +618,7 @@ const ChatAvatar * ChatServer::getAvatarByNetworkId(const NetworkId & id) { if (id.getValue() == 0) { - return nullptr; + return NULL; } const ChatAvatar * result = 0; ChatAvatarList::const_iterator f = instance().chatAvatars.find(id); @@ -635,7 +635,7 @@ ChatServer::AvatarExtendedData * ChatServer::getAvatarExtendedDataByNetworkId(co { if (id.getValue() == 0) { - return nullptr; + return NULL; } ChatServer::AvatarExtendedData * result = 0; ChatAvatarList::iterator f = instance().chatAvatars.find(id); @@ -783,7 +783,7 @@ void ChatServer::addFriend(const NetworkId & id, const unsigned int sequence, co unsigned track = instance().chatInterface->RequestAddFriend(from, ChatUnicodeString(friendName.data(), friendName.length()), ChatUnicodeString(friendAddress.data(), friendAddress.length()), - false, nullptr); + false, NULL); instance().pendingRequests[track] = id; } else @@ -810,7 +810,7 @@ void ChatServer::removeFriend(const NetworkId & id, const unsigned int sequence, splitChatAvatarId(friendId, friendName, friendAddress); unsigned track = instance().chatInterface->RequestRemoveFriend(from, ChatUnicodeString(friendName.data(), friendName.length()), - ChatUnicodeString(friendAddress.data(), friendAddress.length()), nullptr); + ChatUnicodeString(friendAddress.data(), friendAddress.length()), NULL); instance().pendingRequests[track] = id; } else @@ -829,7 +829,7 @@ void ChatServer::getFriendsList(const ChatAvatarId &characterName) const ChatAvatar *avatar = getAvatarByNetworkId(id); if (avatar) { - unsigned track = instance().chatInterface->RequestFriendStatus(avatar, nullptr); + unsigned track = instance().chatInterface->RequestFriendStatus(avatar, NULL); instance().pendingRequests[track] = id; } else @@ -857,7 +857,7 @@ void ChatServer::addIgnore(const NetworkId & id, const unsigned int sequence, co unsigned track = instance().chatInterface->RequestAddIgnore(from, ChatUnicodeString(ignoreName.data(), ignoreName.length()), ChatUnicodeString(ignoreAddress.data(), ignoreAddress.length()), - nullptr); + NULL); instance().pendingRequests[track] = id; } else @@ -884,7 +884,7 @@ void ChatServer::removeIgnore(const NetworkId & id, const unsigned int sequence, splitChatAvatarId(ignoreId, ignoreName, ignoreAddress); unsigned track = instance().chatInterface->RequestRemoveIgnore(from, ChatUnicodeString(ignoreName.data(), ignoreName.length()), - ChatUnicodeString(ignoreAddress.data(), ignoreAddress.length()), nullptr); + ChatUnicodeString(ignoreAddress.data(), ignoreAddress.length()), NULL); instance().pendingRequests[track] = id; } else @@ -905,7 +905,7 @@ void ChatServer::getIgnoreList(const ChatAvatarId &characterName) if (avatar) { - unsigned track = instance().chatInterface->RequestIgnoreStatus(avatar, nullptr); + unsigned track = instance().chatInterface->RequestIgnoreStatus(avatar, NULL); instance().pendingRequests[track] = id; } else @@ -1160,7 +1160,7 @@ void ChatServer::createRoom(const NetworkId & id, const unsigned int sequence, c { roomAttr |= ROOMATTR_PRIVATE; } - if (isSystemOwner && (strstr(roomName.c_str(), "system") != nullptr)) + if (isSystemOwner && (strstr(roomName.c_str(), "system") != NULL)) { roomAttr |= ROOMATTR_PERSISTENT; } @@ -1193,7 +1193,7 @@ void ChatServer::deleteAllPersistentMessages(const NetworkId &sourceNetworkId, c ChatAvatar const *avatar = getAvatarByNetworkId(targetNetworkId); - if (avatar != nullptr) + if (avatar != NULL) { { NetworkId *tmpNetworkId = new NetworkId(sourceNetworkId); @@ -1225,7 +1225,7 @@ void ChatServer::deletePersistentMessage(const NetworkId &id, const unsigned int const ChatAvatar *avatar = getAvatarByNetworkId(id); if (avatar) { - instance().chatInterface->RequestUpdatePersistentMessage(avatar, messageId, PERSISTENT_DELETED, nullptr); + instance().chatInterface->RequestUpdatePersistentMessage(avatar, messageId, PERSISTENT_DELETED, NULL); } } @@ -1290,10 +1290,10 @@ void ChatServer::destroyRoom(const std::string & roomName) { ChatServer::fileLog(s_enableChatRoomLogs, "ChatServer", "destroyRoom() roomName(%s)", roomName.c_str()); - if ((strstr(roomName.c_str(), ConfigChatServer::getClusterName()) != nullptr) || + if ((strstr(roomName.c_str(), ConfigChatServer::getClusterName()) != NULL) || (strstr(roomName.c_str(), toLower(std::string(ConfigChatServer::getClusterName() ) ).c_str() ) )) { - if ((strstr(roomName.c_str(), "GroupChat") != nullptr) || (strstr(roomName.c_str(), "groupchat") != nullptr)) + if ((strstr(roomName.c_str(), "GroupChat") != NULL) || (strstr(roomName.c_str(), "groupchat") != NULL)) { size_t pos = roomName.rfind("."); if (pos != roomName.npos) @@ -1311,7 +1311,7 @@ void ChatServer::destroyRoom(const std::string & roomName) const ChatServerRoomOwner *owner = instance().chatInterface->getRoomOwner(roomName); if (!instance().ownerSystem) { - DEBUG_WARNING(true, ("Chat ownerSystem is nullptr")); + DEBUG_WARNING(true, ("Chat ownerSystem is NULL")); return; } if (owner) @@ -1331,7 +1331,7 @@ void ChatServer::disconnectAvatar(const ChatAvatar & avatar) if (&avatar == instance().ownerSystem) { - instance().ownerSystem = nullptr; + instance().ownerSystem = NULL; } ChatAvatarList::iterator i; for(i = instance().chatAvatars.begin(); i != instance().chatAvatars.end(); ++i) @@ -1423,7 +1423,7 @@ void ChatServer::enterRoom(const ChatAvatarId & id, const std::string & roomName const ChatAvatar *avatar = getAvatarByNetworkId(getNetworkIdByAvatarId(id)); if (room && avatar) { - instance().chatInterface->RequestEnterRoom(avatar, room->getAddress(), nullptr); + instance().chatInterface->RequestEnterRoom(avatar, room->getAddress(), NULL); } else { @@ -1450,7 +1450,7 @@ void ChatServer::putSystemAvatarInRoom(const std::string & roomName) const ChatServerRoomOwner *room = instance().chatInterface->getRoomOwner(roomName); if (room && instance().ownerSystem) { - instance().chatInterface->RequestEnterRoom(instance().ownerSystem, room->getAddress(), nullptr); + instance().chatInterface->RequestEnterRoom(instance().ownerSystem, room->getAddress(), NULL); } } @@ -1619,7 +1619,7 @@ void ChatServer::invite(const NetworkId & id, const ChatAvatarId & avatarId, con ChatServer::fileLog(s_enableChatRoomLogs, "ChatServer", "invite() id(%s) avatar(%s) roomName(%s)", id.getValueString().c_str(), avatarId.getFullName().c_str(), roomName.c_str()); // Try to get an invitor - ChatAvatar const * invitor = nullptr; + ChatAvatar const * invitor = NULL; if (id != NetworkId::cms_invalid) { invitor = getAvatarByNetworkId(id); @@ -1738,7 +1738,7 @@ void ChatServer::inviteGroupMembers(const NetworkId & id, const ChatAvatarId & a void ChatServer::removeSystemAvatarFromRoom(const ChatRoom *room) { - ChatServer::fileLog(s_enableChatRoomLogs, "ChatServer", "removeSystemAvatarFromRoom() room(%s)", (room != nullptr) ? toNarrowString(room->getRoomName()).c_str() : "nullptr"); + ChatServer::fileLog(s_enableChatRoomLogs, "ChatServer", "removeSystemAvatarFromRoom() room(%s)", (room != NULL) ? toNarrowString(room->getRoomName()).c_str() : "NULL"); if (!room || !instance().ownerSystem) { @@ -1754,7 +1754,7 @@ void ChatServer::removeSystemAvatarFromRoom(const ChatRoom *room) } } - instance().chatInterface->RequestLeaveRoom(instance().ownerSystem, room->getAddress(), nullptr); + instance().chatInterface->RequestLeaveRoom(instance().ownerSystem, room->getAddress(), NULL); } //----------------------------------------------------------------------- @@ -1991,7 +1991,7 @@ void ChatServer::sendInstantMessage(const ChatAvatarId & from, const ChatAvatarI const NetworkId &toNetworkId = getNetworkIdByAvatarId(to); const ChatAvatar * toAvatar = getAvatarByNetworkId(toNetworkId); - if (toAvatar != nullptr) + if (toAvatar != NULL) { ChatServer::fileLog(false, "ChatServer", "sendInstantMessage() resolved tell locally"); @@ -2022,7 +2022,7 @@ void ChatServer::sendInstantMessage(const ChatAvatarId & from, const ChatAvatarI IGNORE_RETURN(instance().chatInterface->RequestSendInstantMessage(fromAvatar, ChatUnicodeString(friendName.data(), friendName.size()), ChatUnicodeString(friendAddress.data(), friendAddress.size()), - ChatUnicodeString(message.data(), message.size()), ChatUnicodeString(outOfBand.data(), outOfBand.size()), nullptr)); + ChatUnicodeString(message.data(), message.size()), ChatUnicodeString(outOfBand.data(), outOfBand.size()), NULL)); } } } @@ -2054,7 +2054,7 @@ void ChatServer::sendInstantMessage(const NetworkId & fromId, const unsigned int { return; } - else if (::time(nullptr) < aed->unsquelchTime) // still in squelch period + else if (::time(NULL) < aed->unsquelchTime) // still in squelch period { return; } @@ -2076,14 +2076,14 @@ void ChatServer::sendInstantMessage(const NetworkId & fromId, const unsigned int Unicode::String wideFrom; Unicode::String wideTo; - if (from != nullptr) + if (from != NULL) { makeAvatarId(*from, fromAvatarId); wideFrom = (Unicode::narrowToWide(fromAvatarId.getFullName())); } ChatAvatarId toAvatarId; - if (toAvatar != nullptr) + if (toAvatar != NULL) { ChatServer::fileLog(false, "ChatServer", "sendInstantMessage() resolved tell locally"); @@ -2158,7 +2158,7 @@ void ChatServer::sendPersistentMessage(const ChatAvatarId & from, const ChatAvat ChatUnicodeString(subject.data(), subject.size()), ChatUnicodeString(message.data(), message.size()), ChatUnicodeString(oob.data(), oob.size()), - nullptr + NULL ); Unicode::String log; @@ -2187,7 +2187,7 @@ void ChatServer::sendPersistentMessage(const NetworkId & fromId, const unsigned // to.cluster.c_str(), to.name.c_str()); UNREF(sequenceId); ChatServer::AvatarExtendedData * aed = getAvatarExtendedDataByNetworkId(fromId); - const ChatAvatar * from = (aed ? &(aed->chatAvatar) : nullptr); + const ChatAvatar * from = (aed ? &(aed->chatAvatar) : NULL); if(from) { // see if player is squelched @@ -2197,7 +2197,7 @@ void ChatServer::sendPersistentMessage(const NetworkId & fromId, const unsigned { return; } - else if (::time(nullptr) < aed->unsquelchTime) // still in squelch period + else if (::time(NULL) < aed->unsquelchTime) // still in squelch period { return; } @@ -2225,7 +2225,7 @@ void ChatServer::sendPersistentMessage(const NetworkId & fromId, const unsigned ChatAvatarId fromAvatarId; - if (from != nullptr) + if (from != NULL) { makeAvatarId(*from, fromAvatarId); } @@ -2255,7 +2255,7 @@ void ChatServer::sendRoomMessage(const ChatAvatarId &id, const std::string & roo if (!instance().ownerSystem) { - DEBUG_WARNING(true, ("Chat ownerSystem is nullptr")); + DEBUG_WARNING(true, ("Chat ownerSystem is NULL")); return; } // get room id @@ -2265,7 +2265,7 @@ void ChatServer::sendRoomMessage(const ChatAvatarId &id, const std::string & roo { const ChatAvatar *sender = instance().ownerSystem; - IGNORE_RETURN(instance().chatInterface->RequestSendRoomMessage(sender, (*f).second.getAddress(), ChatUnicodeString(msg.data(), msg.size()), ChatUnicodeString(oob.data(), oob.size()), nullptr)); + IGNORE_RETURN(instance().chatInterface->RequestSendRoomMessage(sender, (*f).second.getAddress(), ChatUnicodeString(msg.data(), msg.size()), ChatUnicodeString(oob.data(), oob.size()), NULL)); } } } @@ -2280,7 +2280,7 @@ void ChatServer::sendRoomMessage(const NetworkId & id, const unsigned int sequen UNREF(sequence); ChatServer::AvatarExtendedData * aed = getAvatarExtendedDataByNetworkId(id); - const ChatAvatar * sender = (aed ? &(aed->chatAvatar) : nullptr); + const ChatAvatar * sender = (aed ? &(aed->chatAvatar) : NULL); const ChatServerRoomOwner *room = instance().chatInterface->getRoomOwner(roomId); if(sender && room) { @@ -2296,7 +2296,7 @@ void ChatServer::sendRoomMessage(const NetworkId & id, const unsigned int sequen aed->nonSpatialCharCount += msg.size(); // sync chat character count with game server - timeNow = ::time(nullptr); + timeNow = ::time(NULL); if ((timeNow > aed->chatSpamNextTimeToSyncWithGameServer) || (timeNow > aed->chatSpamTimeEndInterval)) { GenericValueTypeMessage, std::pair > > chatStatistics("ChatStatisticsCS", std::make_pair(std::make_pair(id, static_cast(aed->chatSpamTimeEndInterval)), std::make_pair(aed->spatialCharCount, aed->nonSpatialCharCount))); @@ -2322,7 +2322,7 @@ void ChatServer::sendRoomMessage(const NetworkId & id, const unsigned int sequen allowToSpeak = false; squelched = true; } - else if (::time(nullptr) < aed->unsquelchTime) // still in squelch period + else if (::time(NULL) < aed->unsquelchTime) // still in squelch period { allowToSpeak = false; squelched = true; @@ -2393,7 +2393,7 @@ void ChatServer::sendStandardRoomMessage(const ChatAvatarId &senderId, const std } if (sender) { - IGNORE_RETURN(instance().chatInterface->RequestSendRoomMessage(sender, (*f).second.getAddress(), ChatUnicodeString(msg.data(), msg.size()), ChatUnicodeString(oob.data(), oob.size()), nullptr)); + IGNORE_RETURN(instance().chatInterface->RequestSendRoomMessage(sender, (*f).second.getAddress(), ChatUnicodeString(msg.data(), msg.size()), ChatUnicodeString(oob.data(), oob.size()), NULL)); } } } @@ -2505,7 +2505,7 @@ std::string ChatServer::getFullChatAvatarName(ChatAvatar const *chatAvatar) { std::string result; - if (chatAvatar != nullptr) + if (chatAvatar != NULL) { result += toNarrowString(chatAvatar->getName()); result += '.'; @@ -2513,7 +2513,7 @@ std::string ChatServer::getFullChatAvatarName(ChatAvatar const *chatAvatar) } else { - result = "nullptr"; + result = "NULL"; } return result; @@ -2539,7 +2539,7 @@ std::string ChatServer::getConnectionAddress(Connection const *connection) { std::string result; - if (connection != nullptr) + if (connection != NULL) { char text[256]; snprintf(text, sizeof(text), "%s:%d", connection->getRemoteAddress().c_str(), connection->getRemotePort()); @@ -2547,7 +2547,7 @@ std::string ChatServer::getConnectionAddress(Connection const *connection) } else { - result = "nullptr"; + result = "NULL"; } return result; @@ -2566,13 +2566,13 @@ Unicode::String ChatServer::getChatRoomName(ChatRoom const *chatRoom) { Unicode::String result; - if (chatRoom != nullptr) + if (chatRoom != NULL) { result = toUnicodeString(chatRoom->getRoomName()); } else { - result = Unicode::narrowToWide("nullptr"); + result = Unicode::narrowToWide("NULL"); } return result; @@ -2582,12 +2582,12 @@ Unicode::String ChatServer::getChatRoomName(ChatRoom const *chatRoom) void ChatServer::clearCustomerServiceServerConnection() { - if (instance().customerServiceServerConnection != nullptr) + if (instance().customerServiceServerConnection != NULL) { instance().customerServiceServerConnection->disconnect(); } - instance().customerServiceServerConnection = nullptr; + instance().customerServiceServerConnection = NULL; } // ---------------------------------------------------------------------- @@ -2596,7 +2596,7 @@ void ChatServer::connectToCustomerServiceServer(const std::string &address, cons { //DEBUG_REPORT_LOG(true, ("***ChatServer::connectToCustomerServiceServer() address(%s) port(%d)\n", address.c_str(), port)); - if (instance().customerServiceServerConnection != nullptr) + if (instance().customerServiceServerConnection != NULL) { instance().customerServiceServerConnection->disconnect(); } @@ -2670,7 +2670,7 @@ bool ChatServer::isValidChatAvatarName(Unicode::String const &chatAvatarName) void ChatServer::logChatMessage(Unicode::String const &logPlayer, Unicode::String const &fromPlayer, Unicode::String const &toPlayer, Unicode::String const &text, Unicode::String const &channel) { - DEBUG_WARNING(toPlayer.empty(), ("toPlayer is nullptr")); + DEBUG_WARNING(toPlayer.empty(), ("toPlayer is NULL")); Unicode::String lowerLogPlayer(Unicode::toLower(logPlayer)); Unicode::String lowerFromPlayer(Unicode::toLower(fromPlayer)); @@ -2760,7 +2760,7 @@ void ChatServer::requestTransferAvatar(const TransferCharacterData & request) ChatAvatarId destinationAvatar("SWG", destination, request.getDestinationCharacterName()); - instance().chatInterface->RequestTransferAvatar(request.getSourceStationId(), makeChatUnicodeString(sourceAvatar.getName()), makeChatUnicodeString(sourceAvatar.getAPIAddress()), request.getDestinationStationId(), makeChatUnicodeString(destinationAvatar.getName()), makeChatUnicodeString(destinationAvatar.getAPIAddress()), true, nullptr); + instance().chatInterface->RequestTransferAvatar(request.getSourceStationId(), makeChatUnicodeString(sourceAvatar.getName()), makeChatUnicodeString(sourceAvatar.getAPIAddress()), request.getDestinationStationId(), makeChatUnicodeString(destinationAvatar.getName()), makeChatUnicodeString(destinationAvatar.getAPIAddress()), true, NULL); } } @@ -2845,7 +2845,7 @@ void ChatServer::handleChatStatisticsFromGameServer(NetworkId const & character, // non-spatial chat to report to the game server else if (aed->nonSpatialCharCount != nonSpatialNumCharacters) { - time_t const timeNow = ::time(nullptr); + time_t const timeNow = ::time(NULL); if (timeNow > aed->chatSpamNextTimeToSyncWithGameServer) { GenericValueTypeMessage, std::pair > > chatStatistics("ChatStatisticsCS", std::make_pair(std::make_pair(character, static_cast(aed->chatSpamTimeEndInterval)), std::make_pair(aed->spatialCharCount, aed->nonSpatialCharCount))); @@ -2904,7 +2904,7 @@ void ChatServer::sendToGameServerById(unsigned const connectionId, GameNetworkMe GameServerConnection *ChatServer::getGameServerConnectionFromId(unsigned int sequence) { - GameServerConnection * result = nullptr; + GameServerConnection * result = NULL; std::unordered_map::iterator f = m_gameServerConnectionRegistry.find(sequence); if(f != m_gameServerConnectionRegistry.end()) { diff --git a/engine/server/application/ChatServer/src/shared/ChatServerRoomOwner.cpp b/engine/server/application/ChatServer/src/shared/ChatServerRoomOwner.cpp index dc8cd1a3..091a78ac 100755 --- a/engine/server/application/ChatServer/src/shared/ChatServerRoomOwner.cpp +++ b/engine/server/application/ChatServer/src/shared/ChatServerRoomOwner.cpp @@ -86,7 +86,7 @@ const ChatRoom * ChatServerRoomOwner::getRoom() const if (chatInterface) return chatInterface->getRoom(roomID); - return nullptr; + return NULL; } //----------------------------------------------------------------------- diff --git a/engine/server/application/ChatServer/src/shared/VChatInterface.cpp b/engine/server/application/ChatServer/src/shared/VChatInterface.cpp index b98704bc..6e7e257c 100755 --- a/engine/server/application/ChatServer/src/shared/VChatInterface.cpp +++ b/engine/server/application/ChatServer/src/shared/VChatInterface.cpp @@ -435,7 +435,7 @@ void VChatInterface::OnConnectionOpened( const char * address ) ChatServer::fileLog(ms_voiceLoggingEnabled, ms_logLable, "OnConnectionOpened: %s", address); - uint32 track = VChatAPI::GetAccount(ms_systemAvatarName, ConfigChatServer::getGameCode(), ConfigChatServer::getClusterName(), 0, 0, nullptr); + uint32 track = VChatAPI::GetAccount(ms_systemAvatarName, ConfigChatServer::getGameCode(), ConfigChatServer::getClusterName(), 0, 0, NULL); ChatServer::fileLog(ms_voiceLoggingEnabled, ms_logLable, "Creating system avatar: %s track(%u)", getSystemLoginName().c_str(), track); } @@ -477,7 +477,7 @@ void VChatInterface::OnGetAccount(unsigned track, unsigned result, unsigned user { requestConnectPlayer(info->suid,info->avatarName,info->id, info->failedAttempts+1); delete info; - info = nullptr; + info = NULL; return; } } @@ -501,7 +501,7 @@ void VChatInterface::OnGetAccount(unsigned track, unsigned result, unsigned user } delete info; - info = nullptr; + info = NULL; } void VChatInterface::OnGetChannelV2(unsigned track, unsigned result, @@ -639,7 +639,7 @@ void VChatInterface::OnGetAllChannels(unsigned track, unsigned result, const VCh if(shouldRetry) { - GetAllChannels(nullptr); + GetAllChannels(NULL); } } @@ -832,7 +832,7 @@ void VChatInterface::checkForCharacterChannelAdd(std::string const & name, std:: data.m_channelPassword, data.m_channelURI, "en_US", - nullptr); + NULL); (*iter).second.push_back(playerOID); @@ -877,7 +877,7 @@ void VChatInterface::checkForCharacterChannelRemove(std::string const & name, st parseWorldName(std::string(avatar->getServer().c_str())), "SWG", "guild", - nullptr); + NULL); } iter = (*chanIter).second.erase(iter); diff --git a/engine/server/application/CommoditiesServer/src/linux/main.cpp b/engine/server/application/CommoditiesServer/src/linux/main.cpp index ce3735d1..b93208f5 100755 --- a/engine/server/application/CommoditiesServer/src/linux/main.cpp +++ b/engine/server/application/CommoditiesServer/src/linux/main.cpp @@ -61,7 +61,7 @@ int main(int argc, char ** argv) Unicode::UnicodeNarrowStringVector localeVector; localeVector.push_back(defaultLocale); - LocalizationManager::install (new TreeFile::TreeFileFactory, localeVector, debugStringIds, nullptr, displayBadStringIds); + LocalizationManager::install (new TreeFile::TreeFileFactory, localeVector, debugStringIds, NULL, displayBadStringIds); ExitChain::add(LocalizationManager::remove, "LocalizationManager::remove"); DataTableManager::install(); diff --git a/engine/server/application/CommoditiesServer/src/shared/Auction.cpp b/engine/server/application/CommoditiesServer/src/shared/Auction.cpp index 63f43523..0d1edd7f 100755 --- a/engine/server/application/CommoditiesServer/src/shared/Auction.cpp +++ b/engine/server/application/CommoditiesServer/src/shared/Auction.cpp @@ -208,7 +208,7 @@ namespace AuctionNamespace if (iterAttr != searchableAttributeString->end()) { applicableSearchCondition = true; - return (nullptr != strstr(iterAttr->second.c_str(), searchCondition.stringValue.c_str())); // lowercase is assumed (and required) + return (NULL != strstr(iterAttr->second.c_str(), searchCondition.stringValue.c_str())); // lowercase is assumed (and required) } } @@ -242,7 +242,7 @@ namespace AuctionNamespace if (iterAttr != searchableAttributeString->end()) { applicableSearchCondition = true; - return (nullptr == strstr(iterAttr->second.c_str(), searchCondition.stringValue.c_str())); // lowercase is assumed (and required) + return (NULL == strstr(iterAttr->second.c_str(), searchCondition.stringValue.c_str())); // lowercase is assumed (and required) } } @@ -293,10 +293,10 @@ m_userDescription(userDescription), m_oobLength(oobLength), m_oobData(oobData), m_attributes(), -m_searchableAttributeInt(nullptr), -m_searchableAttributeFloat(nullptr), -m_searchableAttributeString(nullptr), -m_highBid(nullptr), +m_searchableAttributeInt(NULL), +m_searchableAttributeFloat(NULL), +m_searchableAttributeString(NULL), +m_highBid(NULL), m_item(new AuctionItem(itemId, itemType, itemTemplateId, itemTimer, itemNameLength, itemName, creatorId, itemSize)), m_sold(false), m_active(true), @@ -395,10 +395,10 @@ m_userDescription(userDescription), m_oobLength(oobLength), m_oobData(oobData), m_attributes(), -m_searchableAttributeInt(nullptr), -m_searchableAttributeFloat(nullptr), -m_searchableAttributeString(nullptr), -m_highBid(nullptr), +m_searchableAttributeInt(NULL), +m_searchableAttributeFloat(NULL), +m_searchableAttributeString(NULL), +m_highBid(NULL), m_item(new AuctionItem(itemId, itemType, itemTemplateId, itemTimer, itemNameLength, itemName, creatorId, itemSize)), m_sold(isSold), m_active(isActive), @@ -488,7 +488,7 @@ void Auction::Initialization() #ifdef _DEBUG for (int i = 0; i < static_cast(AuctionQueryHeadersMessage::SCC_LAST); ++i) { - s_searchConditionComparisonFn[i] = nullptr; + s_searchConditionComparisonFn[i] = NULL; } #endif @@ -502,7 +502,7 @@ void Auction::Initialization() #ifdef _DEBUG for (int j = 0; j < static_cast(AuctionQueryHeadersMessage::SCC_LAST); ++j) { - DEBUG_FATAL((s_searchConditionComparisonFn[j] == nullptr), ("s_searchConditionComparisonFn array is nullptr at index (%d)", j)); + DEBUG_FATAL((s_searchConditionComparisonFn[j] == NULL), ("s_searchConditionComparisonFn array is NULL at index (%d)", j)); } #endif @@ -659,7 +659,7 @@ const AuctionBid *Auction::GetPreviousBid() const { if (m_bids.size() <= 1) { - return nullptr; + return NULL; } else { @@ -677,9 +677,9 @@ const AuctionBid *Auction::GetPreviousBid() const */ int Auction::GetActualBid(AuctionBid *bid) { - assert(bid != nullptr); + assert(bid != NULL); int bidNeeded = std::max(m_minBid, bid->GetBid()); - if (m_highBid != nullptr) + if (m_highBid != NULL) { bidNeeded = m_highBid->GetBid(); if (*bid > *m_highBid) @@ -765,7 +765,7 @@ AuctionResultCode Auction::AddBid( AuctionBid *auctionBid = new AuctionBid(bidderId, bid, maxProxyBid); int newBidForHighBidder = GetActualBid(auctionBid); - if (m_highBid != nullptr) + if (m_highBid != NULL) { if (*auctionBid <= *m_highBid) { @@ -810,7 +810,7 @@ const AuctionBid *Auction::GetPlayerBid(const NetworkId & playerId) const } ++iter; } - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -826,7 +826,7 @@ bool Auction::Update(int gameTime) //immediate sale DEBUG_REPORT_LOG(true, ("[Commodities Server Auction::Update] : Expiring immediate sale - Auction is active and sold.\n")); - if ((m_trackId != -1) && (CommodityServer::getInstance().getGameServer(m_trackId) != nullptr)) + if ((m_trackId != -1) && (CommodityServer::getInstance().getGameServer(m_trackId) != NULL)) { Expire(true, false, m_trackId); m_trackId = -1; @@ -840,14 +840,14 @@ bool Auction::Update(int gameTime) { DEBUG_REPORT_LOG(true, ("[Commodities Server Auction::Update] : Auction expiring based on timer.\n")); - if ((m_trackId != -1) && (CommodityServer::getInstance().getGameServer(m_trackId) != nullptr)) + if ((m_trackId != -1) && (CommodityServer::getInstance().getGameServer(m_trackId) != NULL)) { - Expire(m_highBid != nullptr, true, m_trackId); + Expire(m_highBid != NULL, true, m_trackId); m_trackId = -1; } else { - Expire(m_highBid != nullptr, true); + Expire(m_highBid != NULL, true); } } @@ -862,7 +862,7 @@ void Auction::Expire(bool sold, bool expiredBasedOnTimer, int track_id) m_auctionTimer = 0; m_active = false; - if (sold && m_highBid != nullptr) + if (sold && m_highBid != NULL) { m_sold = true; } @@ -934,7 +934,7 @@ void Auction::Expire(bool sold, bool expiredBasedOnTimer, int track_id) m_location.SetVendorFirstTimerExpiredAuctionDate(time(0)); } - DEBUG_REPORT_LOG(true, ("[Commodities Server Auction::Expire] : Sending OnAuctionExpired for non-sold auction and nullptr high bid obj .\n")); + DEBUG_REPORT_LOG(true, ("[Commodities Server Auction::Expire] : Sending OnAuctionExpired for non-sold auction and null high bid obj .\n")); AuctionMarket::getInstance().OnAuctionExpired( GetCreatorId(), m_sold, m_flags, NetworkId::cms_invalid, 0, m_item->GetItemId(), 0, @@ -1107,8 +1107,8 @@ void Auction::BuildSearchableAttributeList() std::map const & saAlias = CommoditiesAdvancedSearchAttribute::getSearchAttributeNameAliasesForGameObjectType(m_item->GetCategory()); // for factory crates, also include the attributes of the item inside the crate - std::map const * saItemInsideFactoryCrate = nullptr; - std::map const * saAliasItemInsideFactoryCrate = nullptr; + std::map const * saItemInsideFactoryCrate = NULL; + std::map const * saAliasItemInsideFactoryCrate = NULL; int gotItemInsideFactoryCrate = 0; if (m_item->GetCategory() == SharedObjectTemplate::GOT_misc_factory_crate) @@ -1134,10 +1134,10 @@ void Auction::BuildSearchableAttributeList() saAliasItemInsideFactoryCrate = &(CommoditiesAdvancedSearchAttribute::getSearchAttributeNameAliasesForGameObjectType(gotItemInsideFactoryCrate)); if (saItemInsideFactoryCrate->empty()) - saItemInsideFactoryCrate = nullptr; + saItemInsideFactoryCrate = NULL; if (saAliasItemInsideFactoryCrate->empty()) - saAliasItemInsideFactoryCrate = nullptr; + saAliasItemInsideFactoryCrate = NULL; } } diff --git a/engine/server/application/CommoditiesServer/src/shared/AuctionLocation.cpp b/engine/server/application/CommoditiesServer/src/shared/AuctionLocation.cpp index d692840d..df458ef0 100755 --- a/engine/server/application/CommoditiesServer/src/shared/AuctionLocation.cpp +++ b/engine/server/application/CommoditiesServer/src/shared/AuctionLocation.cpp @@ -137,7 +137,7 @@ AuctionLocation::~AuctionLocation() bool AuctionLocation::AddAuction(Auction *auction) { - assert(auction != nullptr); + assert(auction != NULL); if (IsVendorMarket() && (!auction->IsActive() || !IsOwner(auction->GetCreatorId()))) { @@ -189,7 +189,7 @@ void AuctionLocation::CancelVendorSale(Auction *auction) bool AuctionLocation::RemoveAuction(Auction *auction) { - assert(auction != nullptr); + assert(auction != NULL); return RemoveAuction(auction->GetItem().GetItemId()); } @@ -265,7 +265,7 @@ Auction *AuctionLocation::GetAuction(const NetworkId & itemId) return((*i).second); } } - return nullptr; + return NULL; } // ---------------------------------------------------------------------- diff --git a/engine/server/application/CommoditiesServer/src/shared/AuctionMarket.cpp b/engine/server/application/CommoditiesServer/src/shared/AuctionMarket.cpp index 328f189e..a07b0864 100644 --- a/engine/server/application/CommoditiesServer/src/shared/AuctionMarket.cpp +++ b/engine/server/application/CommoditiesServer/src/shared/AuctionMarket.cpp @@ -121,7 +121,7 @@ namespace AuctionMarketNamespace Auction const * const auction, int const type, int const entranceCharge, - AuctionBid const * const playerBid = nullptr + AuctionBid const * const playerBid = NULL ) { AuctionDataHeader *header = new AuctionDataHeader; @@ -301,7 +301,7 @@ namespace AuctionMarketNamespace std::map attributeValue; }; - GetItemAttributeDataRequest * getItemAttributeDataRequest = nullptr; + GetItemAttributeDataRequest * getItemAttributeDataRequest = NULL; void processItemAttributeData(std::map const & auctions); @@ -394,8 +394,8 @@ void AuctionMarketNamespace::processItemAttributeData(std::map const * skipAttribute = nullptr; - std::map const * skipAttributeAlias = nullptr; + std::map const * skipAttribute = NULL; + std::map const * skipAttributeAlias = NULL; if (getItemAttributeDataRequest->ignoreSearchableAttribute) { std::map const & sa = CommoditiesAdvancedSearchAttribute::getSearchAttributeForGameObjectType(iterAuction->second->GetItem().GetCategory()); @@ -590,7 +590,7 @@ void AuctionMarketNamespace::processItemAttributeData(std::mapGetLocation(); if (!location.IsOwner(auction->GetItem().GetOwnerId())) @@ -1979,7 +1979,7 @@ void AuctionMarket::AcceptHighBid(const AcceptHighBidMessage &message) DEBUG_REPORT_LOG(m_showAllDebugInfo, ("[Commodities Server AcceptHighBidMessage] : ResponseId : %d.\n", message.GetResponseId())); DEBUG_REPORT_LOG(m_showAllDebugInfo, ("[Commodities Server AcceptHighBidMessage] : TrackId : %d.\n", message.GetTrackId())); - Auction *auction = nullptr; + Auction *auction = NULL; AuctionResultCode result = ARC_Success; std::map::iterator iter = m_auctions.find( message.GetAuctionId()); @@ -1994,7 +1994,7 @@ void AuctionMarket::AcceptHighBid(const AcceptHighBidMessage &message) { result = ARC_NotItemOwner; } - else if (auction->GetHighBid() == nullptr) + else if (auction->GetHighBid() == NULL) { result = ARC_NoBids; } @@ -2525,19 +2525,19 @@ void AuctionMarket::QueryAuctionHeaders( int debugNumberLocationsMatched = 0; int debugNumberAuctionsTested = 0; - std::map *auctionsPtr = nullptr; + std::map *auctionsPtr = NULL; int entranceCharge = 0; - AuctionLocation *locationPtr = nullptr; - Auction *auctionPtr = nullptr; + AuctionLocation *locationPtr = NULL; + Auction *auctionPtr = NULL; std::map::const_iterator auctionIterator; - AuctionDataHeader *header = nullptr; + AuctionDataHeader *header = NULL; bool checkItemTemplate; while (locationIter != locationIterEnd) { ++debugNumberLocationsTested; checkItemTemplate = false; - auctionsPtr = nullptr; + auctionsPtr = NULL; entranceCharge = 0; locationPtr = (*locationIter).second; @@ -2606,7 +2606,7 @@ void AuctionMarket::QueryAuctionHeaders( auctionPtr = (*auctionIterator).second; const AuctionItem &item = auctionPtr->GetItem(); - header = nullptr; + header = NULL; // Check to see if the item template matches if (searchForResourceContainer && (itemTemplateId != 0)) @@ -4977,7 +4977,7 @@ void AuctionMarket::getAuctionLocationPriorityQueue(int requestingGameServerId, { std::string output; char buffer[2048]; - int const timeNow = static_cast(::time(nullptr)); + int const timeNow = static_cast(::time(NULL)); for (std::set >::const_iterator iterPQ = m_priorityQueueAuctionLocation.begin(); iterPQ != m_priorityQueueAuctionLocation.end(); ++iterPQ) { if (count <= 0) diff --git a/engine/server/application/CommoditiesServer/src/shared/CommodityServer.cpp b/engine/server/application/CommoditiesServer/src/shared/CommodityServer.cpp index 3c2019cd..1e2671be 100755 --- a/engine/server/application/CommoditiesServer/src/shared/CommodityServer.cpp +++ b/engine/server/application/CommoditiesServer/src/shared/CommodityServer.cpp @@ -191,7 +191,7 @@ void CommodityServer::run() s_commodityServerMetricsData = new CommodityServerMetricsData; MetricsManager::install(s_commodityServerMetricsData, false, "CommoditiesServer", "", 0); - time_t timePrevious = ::time(nullptr); + time_t timePrevious = ::time(NULL); time_t timeCurrent = timePrevious; while (true) @@ -202,7 +202,7 @@ void CommodityServer::run() break; NetworkHandler::update(); - timeCurrent = ::time(nullptr); + timeCurrent = ::time(NULL); MetricsManager::update(static_cast((timeCurrent - timePrevious) * 1000)); timePrevious = timeCurrent; @@ -229,18 +229,18 @@ void CommodityServer::run() // this is not a high priority thing, so wait until // the cluster has started and "stabilized" before // doing this; 3 hours should be adequate - time_t timeToRequestExcludedType = ::time(nullptr) + 10800; + time_t timeToRequestExcludedType = ::time(NULL) + 10800; // one time request from the game server (any game server) // to receive the resource tree hierarchy to support // searching for resource container - time_t timeToRequestResourceTree = ::time(nullptr); + time_t timeToRequestResourceTree = ::time(NULL); while(true) { NetworkHandler::update(); - timeCurrent = ::time(nullptr); + timeCurrent = ::time(NULL); MetricsManager::update(static_cast((timeCurrent - timePrevious) * 1000)); timePrevious = timeCurrent; diff --git a/engine/server/application/CommoditiesServer/src/shared/CommodityServerMetricsData.cpp b/engine/server/application/CommoditiesServer/src/shared/CommodityServerMetricsData.cpp index 90594e07..4b1ff37e 100755 --- a/engine/server/application/CommoditiesServer/src/shared/CommodityServerMetricsData.cpp +++ b/engine/server/application/CommoditiesServer/src/shared/CommodityServerMetricsData.cpp @@ -74,7 +74,7 @@ void CommodityServerMetricsData::updateData() buffer[sizeof(buffer)-1] = '\0'; } - m_mapAuctionsCountByGameObjectTypeIndex[iterGameObjectType->first] = addMetric(buffer, 0, nullptr, false, false); + m_mapAuctionsCountByGameObjectTypeIndex[iterGameObjectType->first] = addMetric(buffer, 0, NULL, false, false); } } } diff --git a/engine/server/application/ConnectionServer/src/linux/main.cpp b/engine/server/application/ConnectionServer/src/linux/main.cpp index 5984dd4c..24c76421 100755 --- a/engine/server/application/ConnectionServer/src/linux/main.cpp +++ b/engine/server/application/ConnectionServer/src/linux/main.cpp @@ -37,7 +37,7 @@ int main(int argc, char ** argv) SetupSharedFile::install(false); SetupSharedNetworkMessages::install(); - SetupSharedRandom::install(time(nullptr)); + SetupSharedRandom::install(time(NULL)); //setup the server NetworkHandler::install(); diff --git a/engine/server/application/ConnectionServer/src/shared/ClientConnection.cpp b/engine/server/application/ConnectionServer/src/shared/ClientConnection.cpp index 32b3811c..f7b3020b 100755 --- a/engine/server/application/ConnectionServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/ConnectionServer/src/shared/ClientConnection.cpp @@ -82,7 +82,7 @@ m_canCreateRegularCharacter(false), m_canCreateJediCharacter(false), m_hasRequestedCharacterCreate(false), m_hasCreatedCharacter(false), -m_pendingCharacterCreate(nullptr), +m_pendingCharacterCreate(NULL), m_canSkipTutorial(false), m_characterId(NetworkId::cms_invalid), m_characterName(), @@ -144,7 +144,7 @@ ClientConnection::~ClientConnection() { hasBeenKicked = m_client->hasBeenKicked(); delete m_client; - m_client = nullptr; + m_client = NULL; } // tell Session to stop recording play time for the character @@ -177,7 +177,7 @@ ClientConnection::~ClientConnection() m_pendingChatQueryRoomRequests.clear(); delete m_pendingCharacterCreate; - m_pendingCharacterCreate = nullptr; + m_pendingCharacterCreate = NULL; } @@ -202,7 +202,7 @@ std::string ClientConnection::getPlayTimeDuration() const int playTimeDuration = 0; if (m_startPlayTime > 0) - playTimeDuration = static_cast(::time(nullptr) - m_startPlayTime); + playTimeDuration = static_cast(::time(NULL) - m_startPlayTime); return CalendarTime::convertSecondsToHMS(static_cast(playTimeDuration)); } @@ -214,7 +214,7 @@ std::string ClientConnection::getActivePlayTimeDuration() const int activePlayTimeDuration = static_cast(m_activePlayTimeDuration); if (m_lastActiveTime > 0) - activePlayTimeDuration += static_cast(::time(nullptr) - m_lastActiveTime); + activePlayTimeDuration += static_cast(::time(NULL) - m_lastActiveTime); return CalendarTime::convertSecondsToHMS(static_cast(activePlayTimeDuration)); } @@ -226,7 +226,7 @@ std::string ClientConnection::getCurrentActivePlayTimeDuration() const int activePlayTimeDuration = 0; if (m_lastActiveTime > 0) - activePlayTimeDuration = static_cast(::time(nullptr) - m_lastActiveTime); + activePlayTimeDuration = static_cast(::time(NULL) - m_lastActiveTime); return CalendarTime::convertSecondsToHMS(static_cast(activePlayTimeDuration)); } @@ -400,7 +400,7 @@ void ClientConnection::handleClientIdMessage(const ClientIdMsg& msg) std::hash h; m_suid = h(m_accountName.c_str()); } - onValidateClient(m_suid, m_accountName, m_isSecure, nullptr, ConfigConnectionServer::getDefaultGameFeatures(), ConfigConnectionServer::getDefaultSubscriptionFeatures(), 0, 0, 0, 0, ConfigConnectionServer::getFakeBuddyPoints()); + onValidateClient(m_suid, m_accountName, m_isSecure, NULL, ConfigConnectionServer::getDefaultGameFeatures(), ConfigConnectionServer::getDefaultSubscriptionFeatures(), 0, 0, 0, 0, ConfigConnectionServer::getFakeBuddyPoints()); } } else @@ -452,7 +452,7 @@ void ClientConnection::onIdValidated(bool canLogin, bool canCreateRegularCharact } delete m_pendingCharacterCreate; - m_pendingCharacterCreate = nullptr; + m_pendingCharacterCreate = NULL; return; } @@ -683,7 +683,7 @@ void ClientConnection::onReceive(const Archive::ByteStream & message) } else { - ConnectionServer::dropClient(this, "m_client is nullptr while receiving a message!"); + ConnectionServer::dropClient(this, "m_client is null while receiving a message!"); disconnect(); } } @@ -796,7 +796,7 @@ void ClientConnection::onReceive(const Archive::ByteStream & message) } else { - ConnectionServer::dropClient(this, "m_client is nullptr while receiving a message!"); + ConnectionServer::dropClient(this, "m_client is null while receiving a message!"); disconnect(); } } @@ -839,7 +839,7 @@ void ClientConnection::onReceive(const Archive::ByteStream & message) } else { - ConnectionServer::dropClient(this, "m_client is nullptr while receiving a message!"); + ConnectionServer::dropClient(this, "m_client is null while receiving a message!"); disconnect(); } } @@ -865,7 +865,7 @@ void ClientConnection::onReceive(const Archive::ByteStream & message) //DEBUG_REPORT_LOG(true, ("CONSRV::CS - suid: %i\n", getSUID())); - if (customerServiceConnection != nullptr) + if (customerServiceConnection != NULL) { static std::vector v; v.clear(); @@ -935,7 +935,7 @@ void ClientConnection::onReceive(const Archive::ByteStream & message) } else { - ConnectionServer::dropClient(this, "m_client is nullptr while receiving a message!"); + ConnectionServer::dropClient(this, "m_client is null while receiving a message!"); disconnect(); } } @@ -951,7 +951,7 @@ void ClientConnection::onReceive(const Archive::ByteStream & message) if (m_lastActiveTime > 0) { // record the amount of active time - m_activePlayTimeDuration += static_cast(::time(nullptr) - m_lastActiveTime); + m_activePlayTimeDuration += static_cast(::time(NULL) - m_lastActiveTime); // tell Session to stop recording play time for the character if (ConnectionServer::getSessionApiClient() && ConfigConnectionServer::getSessionRecordPlayTime()) @@ -988,7 +988,7 @@ void ClientConnection::onReceive(const Archive::ByteStream & message) if (m_lastActiveTime == 0) { // record the time client went active - m_lastActiveTime = ::time(nullptr); + m_lastActiveTime = ::time(NULL); // tell Session to start recording play time for the character if (ConnectionServer::getSessionApiClient() && ConfigConnectionServer::getSessionRecordPlayTime()) @@ -1616,7 +1616,7 @@ void ClientConnection::onValidateClient (uint32 suid, const std::string & userna } // tell client the server-side game and subscription feature bits and which ConnectionServer we are and the current server Epoch time - GenericValueTypeMessage, std::pair > > const msgFeatureBits("AccountFeatureBits", std::make_pair(std::make_pair(gameFeatures, subscriptionFeatures), std::make_pair(ConfigConnectionServer::getConnectionServerNumber(), static_cast(::time(nullptr))))); + GenericValueTypeMessage, std::pair > > const msgFeatureBits("AccountFeatureBits", std::make_pair(std::make_pair(gameFeatures, subscriptionFeatures), std::make_pair(ConfigConnectionServer::getConnectionServerNumber(), static_cast(::time(NULL))))); send(msgFeatureBits, true); std::string const gameFeaturesDescription = ClientGameFeature::getDescription(gameFeatures); diff --git a/engine/server/application/ConnectionServer/src/shared/ConnectionServer.cpp b/engine/server/application/ConnectionServer/src/shared/ConnectionServer.cpp index 10d0c99f..b698ecb6 100755 --- a/engine/server/application/ConnectionServer/src/shared/ConnectionServer.cpp +++ b/engine/server/application/ConnectionServer/src/shared/ConnectionServer.cpp @@ -163,7 +163,7 @@ const CustomerServiceConnection * ConnectionServer::getCustomerServiceConnection { return (*(instance().customerServiceServers.begin())); } - return nullptr; + return NULL; } //----------------------------------------------------------------------- @@ -366,7 +366,7 @@ void ConnectionServer::addNewClient(ClientConnection* cconn, const NetworkId &oi //send the game server a message about this client. static const std::string loginTrace("TRACE_LOGIN"); LOG(loginTrace, ("NewClient(%d, %s, %s)", cconn->getSUID(), oid.getValueString().c_str(), cconn->getAccountName().c_str())); - NewClient m(oid, cconn->getAccountName(), cconn->getRemoteAddress(), cconn->getIsSecure(), false, cconn->getSUID(), nullptr, cconn->getGameFeatures(), cconn->getSubscriptionFeatures(), cconn->getEntitlementTotalTime(), cconn->getEntitlementEntitledTime(), cconn->getEntitlementTotalTimeSinceLastLogin(), cconn->getEntitlementEntitledTimeSinceLastLogin(), cconn->getBuddyPoints(), cconn->getConsumedRewardEvents(), cconn->getClaimedRewardItems(), cconn->isUsingAdminLogin(), cconn->getCanSkipTutorial(), sendToStarport ); + NewClient m(oid, cconn->getAccountName(), cconn->getRemoteAddress(), cconn->getIsSecure(), false, cconn->getSUID(), NULL, cconn->getGameFeatures(), cconn->getSubscriptionFeatures(), cconn->getEntitlementTotalTime(), cconn->getEntitlementEntitledTime(), cconn->getEntitlementTotalTimeSinceLastLogin(), cconn->getEntitlementEntitledTimeSinceLastLogin(), cconn->getBuddyPoints(), cconn->getConsumedRewardEvents(), cconn->getClaimedRewardItems(), cconn->isUsingAdminLogin(), cconn->getCanSkipTutorial(), sendToStarport ); gconn->send(m, true); //@todo move this to ClientConnection.cpp } @@ -375,7 +375,7 @@ void ConnectionServer::addNewClient(ClientConnection* cconn, const NetworkId &oi void ConnectionServer::dropClient(ClientConnection * conn, const std::string& description) { - DEBUG_FATAL(!conn, ("Cannot call dropClient with nullptr connection")); + DEBUG_FATAL(!conn, ("Cannot call dropClient with NULL connection")); if (!conn) //lint !e774 // boolean within 'if' always evaluates to False //suppresed because this is only relevant in DEBUG builds return; @@ -466,7 +466,7 @@ GameConnection* ConnectionServer::getGameConnection(const std::string &sceneName return (*i).second; } } - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -477,15 +477,15 @@ void ConnectionServer::handleConnectionServerIdMessage(const ConnectionServerId const Service * const servicePrivate = getClientServicePrivate(); const Service * const servicePublic = getClientServicePublic(); - FATAL(servicePrivate == nullptr && servicePublic == nullptr, ("No client service is active!")); + FATAL(servicePrivate == NULL && servicePublic == NULL, ("No client service is active!")); const Service * const g = getGameService(); - FATAL(g == nullptr, ("No game service is active!")); + FATAL(g == NULL, ("No game service is active!")); const Service * const c = getChatService(); const Service * const cs = getCustomerService(); const uint16 pingPort = getPingPort (); - if((servicePrivate != nullptr || servicePublic != nullptr) && g != nullptr) //lint !e774 // always evaluates to false // suppresed because the FATAL macro triggers this lint warning + if((servicePrivate != NULL || servicePublic != NULL) && g != NULL) //lint !e774 // always evaluates to false // suppresed because the FATAL macro triggers this lint warning { uint16 chatPort = 0; uint16 csPort = 0; @@ -739,7 +739,7 @@ void ConnectionServer::receiveMessage(const MessageDispatch::Emitter & source, c std::set::const_iterator i; for(i = clients.begin(); i != clients.end(); ++ i) { - (*i)->setChatConnection(nullptr); + (*i)->setChatConnection(NULL); } } } @@ -782,7 +782,7 @@ void ConnectionServer::receiveMessage(const MessageDispatch::Emitter & source, c std::set::const_iterator i; for(i = clients.begin(); i != clients.end(); ++ i) { - (*i)->setCustomerServiceConnection(nullptr); + (*i)->setCustomerServiceConnection(NULL); } } @@ -960,7 +960,7 @@ void ConnectionServer::remove() // explicitly delete all connections that were setup from setupConnections rather than letting // Connection::remove do it. There are connections that require a valid s_connectionServer which is deleted - // and set to nullptr. + // and set to NULL. s_connectionServer->unsetupConnections(); SetupSharedLog::remove(); @@ -1316,7 +1316,7 @@ GameConnection* ConnectionServer::getGameConnection(uint32 gameServerId) if (i != cs.gameServerMap.end()) return (*i).second; - return nullptr; + return NULL; } //----------------------------------------------------------------------- @@ -1327,7 +1327,7 @@ GameConnection* ConnectionServer::getAnyGameConnection() if (!cs.gameServerMap.empty()) return cs.gameServerMap.begin()->second; - return nullptr; + return NULL; } //----------------------------------------------------------------------- diff --git a/engine/server/application/ConnectionServer/src/shared/GameConnection.cpp b/engine/server/application/ConnectionServer/src/shared/GameConnection.cpp index ecfede1e..ddf0fe38 100755 --- a/engine/server/application/ConnectionServer/src/shared/GameConnection.cpp +++ b/engine/server/application/ConnectionServer/src/shared/GameConnection.cpp @@ -157,7 +157,7 @@ void GameConnection::onReceive(const Archive::ByteStream & message) ca.getStartYaw(), ca.getTemplateName(), ca.getTimeSeconds(), - static_cast(::time(nullptr)), + static_cast(::time(NULL)), ConfigConnectionServer::getDisableWorldSnapshot()); client->getClientConnection()->send(startScene, true); } @@ -166,7 +166,7 @@ void GameConnection::onReceive(const Archive::ByteStream & message) // record the time when play started for the character if (client->getClientConnection()->getStartPlayTime() == 0) { - client->getClientConnection()->setStartPlayTime(::time(nullptr)); + client->getClientConnection()->setStartPlayTime(::time(NULL)); } // update the play time info on the game server diff --git a/engine/server/application/ConnectionServer/src/shared/PseudoClientConnection.cpp b/engine/server/application/ConnectionServer/src/shared/PseudoClientConnection.cpp index 9caa85e9..49553a04 100755 --- a/engine/server/application/ConnectionServer/src/shared/PseudoClientConnection.cpp +++ b/engine/server/application/ConnectionServer/src/shared/PseudoClientConnection.cpp @@ -246,9 +246,9 @@ void PseudoClientConnection::receiveMessage(const Archive::ByteStream & message) characterId = m_transferCharacterData.getDestinationCharacterId(); } std::vector > static const emptyStringVector; - NewClient m(characterId, "TransferServer", NetworkHandler::getHostName(), true, false, stationId, nullptr, 0, 0, 0, 0, 0, 0, 0, emptyStringVector, emptyStringVector, m_transferCharacterData.getCSToolId() != 0, true); + NewClient m(characterId, "TransferServer", NetworkHandler::getHostName(), true, false, stationId, NULL, 0, 0, 0, 0, 0, 0, 0, emptyStringVector, emptyStringVector, m_transferCharacterData.getCSToolId() != 0, true); m_gameConnection->send(m, true); - LOG("CustomerService", ("CharacterTransfer: Sent NewClient(%s, \"TransferServer\", \"%s\", true, false, %d, nullptr, 0, 0)\n", characterId.getValueString().c_str(), NetworkHandler::getHostName().c_str(), stationId)); + LOG("CustomerService", ("CharacterTransfer: Sent NewClient(%s, \"TransferServer\", \"%s\", true, false, %d, NULL, 0, 0)\n", characterId.getValueString().c_str(), NetworkHandler::getHostName().c_str(), stationId)); } } else if(msg.isType("TransferLoginCharacterToSourceServer")) diff --git a/engine/server/application/ConnectionServer/src/shared/SessionApiClient.cpp b/engine/server/application/ConnectionServer/src/shared/SessionApiClient.cpp index 67598bb4..dba551e9 100755 --- a/engine/server/application/ConnectionServer/src/shared/SessionApiClient.cpp +++ b/engine/server/application/ConnectionServer/src/shared/SessionApiClient.cpp @@ -303,10 +303,10 @@ void SessionApiClient::OnGetFeatures(const apiTrackingNumber trackingNumber, if (i != ms_getFeaturesTrackingNumberMap.end()) { bool reuseMessage = false; - AccountFeatureIdRequest const * accountFeatureIdRequest = nullptr; - AdjustAccountFeatureIdRequest const * adjustAccountFeatureIdRequest = nullptr; - AdjustAccountFeatureIdResponse * adjustAccountFeatureIdResponse = nullptr; - ClaimRewardsMessage * claimRewardsMessage = nullptr; + AccountFeatureIdRequest const * accountFeatureIdRequest = NULL; + AdjustAccountFeatureIdRequest const * adjustAccountFeatureIdRequest = NULL; + AdjustAccountFeatureIdResponse * adjustAccountFeatureIdResponse = NULL; + ClaimRewardsMessage * claimRewardsMessage = NULL; if (i->second->isType("AccountFeatureIdRequest")) accountFeatureIdRequest = dynamic_cast(i->second); @@ -319,7 +319,7 @@ void SessionApiClient::OnGetFeatures(const apiTrackingNumber trackingNumber, if (result == RESULT_SUCCESS) { - ClientConnection * clientConnection = nullptr; + ClientConnection * clientConnection = NULL; if (accountFeatureIdRequest) clientConnection = ConnectionServer::getClientConnection(accountFeatureIdRequest->getTargetStationId()); else if (adjustAccountFeatureIdRequest) @@ -391,7 +391,7 @@ void SessionApiClient::OnGetFeatures(const apiTrackingNumber trackingNumber, else { // if account already has the feature, adjust it, otherwise add the feature - LoginAPI::Feature const * existingFeature = nullptr; + LoginAPI::Feature const * existingFeature = NULL; for (unsigned k = 0; k < featureCount; ++k) { @@ -444,7 +444,7 @@ void SessionApiClient::OnGetFeatures(const apiTrackingNumber trackingNumber, } else { - LoginAPI::Feature const * newlyAddedFeature = nullptr; + LoginAPI::Feature const * newlyAddedFeature = NULL; for (unsigned k = 0; k < featureCount; ++k) { @@ -506,7 +506,7 @@ void SessionApiClient::OnGetFeatures(const apiTrackingNumber trackingNumber, else { // see if account already has the required feature - LoginAPI::Feature const * existingFeature = nullptr; + LoginAPI::Feature const * existingFeature = NULL; for (unsigned k = 0; k < featureCount; ++k) { @@ -904,7 +904,7 @@ void SessionApiClient::validateClient (ClientConnection* client, const std::stri void SessionApiClient::startPlay(const ClientConnection& client) { - IGNORE_RETURN(SessionStartPlay(client.getSessionId().c_str(), ConfigConnectionServer::getClusterName(), client.getCharacterName().c_str(), nullptr)); + IGNORE_RETURN(SessionStartPlay(client.getSessionId().c_str(), ConfigConnectionServer::getClusterName(), client.getCharacterName().c_str(), NULL)); } //------------------------------------------------------------ diff --git a/engine/server/application/CustomerServiceServer/src/linux/main.cpp b/engine/server/application/CustomerServiceServer/src/linux/main.cpp index 35924a2c..7cdc4016 100755 --- a/engine/server/application/CustomerServiceServer/src/linux/main.cpp +++ b/engine/server/application/CustomerServiceServer/src/linux/main.cpp @@ -30,7 +30,7 @@ int main(int argc, char *argv[]) SetupSharedFile::install(false); SetupSharedNetworkMessages::install(); - SetupSharedRandom::install(static_cast(time(nullptr))); + SetupSharedRandom::install(static_cast(time(NULL))); Os::setProgramName("CustomerServiceServer"); ConfigCustomerServiceServer::install(); NetworkHandler::install(); diff --git a/engine/server/application/CustomerServiceServer/src/shared/CentralServerConnection.cpp b/engine/server/application/CustomerServiceServer/src/shared/CentralServerConnection.cpp index 8e74a876..68a2ded3 100755 --- a/engine/server/application/CustomerServiceServer/src/shared/CentralServerConnection.cpp +++ b/engine/server/application/CustomerServiceServer/src/shared/CentralServerConnection.cpp @@ -49,7 +49,7 @@ void CentralServerConnection::onConnectionOpened() Service *chatServerService = CustomerServiceServer::getInstance().getChatServerService(); - if (chatServerService != nullptr) + if (chatServerService != NULL) { const std::string address(chatServerService->getBindAddress()); const int port = chatServerService->getBindPort(); @@ -62,7 +62,7 @@ void CentralServerConnection::onConnectionOpened() } else { - LOG("CentralServerConnection", ("onConnectionOpened() ERROR: ChatServerService is nullptr")); + LOG("CentralServerConnection", ("onConnectionOpened() ERROR: ChatServerService is NULL")); } } @@ -71,7 +71,7 @@ void CentralServerConnection::onConnectionOpened() Service *gameServerService = CustomerServiceServer::getInstance().getGameServerService(); - if (gameServerService != nullptr) + if (gameServerService != NULL) { const std::string address(gameServerService->getBindAddress()); const int port = gameServerService->getBindPort(); @@ -84,7 +84,7 @@ void CentralServerConnection::onConnectionOpened() } else { - LOG("CentralServerConnection", ("onConnectionOpened() ERROR: GameServerService is nullptr")); + LOG("CentralServerConnection", ("onConnectionOpened() ERROR: GameServerService is NULL")); } } } diff --git a/engine/server/application/CustomerServiceServer/src/shared/ChatServerConnection.cpp b/engine/server/application/CustomerServiceServer/src/shared/ChatServerConnection.cpp index 30a167b1..239a4630 100755 --- a/engine/server/application/CustomerServiceServer/src/shared/ChatServerConnection.cpp +++ b/engine/server/application/CustomerServiceServer/src/shared/ChatServerConnection.cpp @@ -64,13 +64,13 @@ void ChatServerConnection::sendTo(GameNetworkMessage const &message) { LOG("ChatServerConnection", ("sendTo() message(%s)", message.getCmdName().c_str())); - if (s_connection != nullptr) + if (s_connection != NULL) { s_connection->send(message, true); } else { - LOG("ChatServerConnection", ("sendTo() Unable to send, nullptr ChatServerConnection")); + LOG("ChatServerConnection", ("sendTo() Unable to send, NULL ChatServerConnection")); } } diff --git a/engine/server/application/CustomerServiceServer/src/shared/ConfigCustomerServiceServer.cpp b/engine/server/application/CustomerServiceServer/src/shared/ConfigCustomerServiceServer.cpp index d0e93110..eff05cf2 100755 --- a/engine/server/application/CustomerServiceServer/src/shared/ConfigCustomerServiceServer.cpp +++ b/engine/server/application/CustomerServiceServer/src/shared/ConfigCustomerServiceServer.cpp @@ -12,19 +12,19 @@ namespace ConfigCustomerServiceServerNamespace { - const char * s_clusterName = nullptr; - const char * s_centralServerAddress = nullptr; + const char * s_clusterName = NULL; + const char * s_centralServerAddress = NULL; int s_centralServerPort = 0; - const char * s_gameCode = nullptr; - const char * s_csServerAddress = nullptr; + const char * s_gameCode = NULL; + const char * s_csServerAddress = NULL; int s_csServerPort = 0; int s_maxPacketsPerSecond = 50; int s_requestTimeoutSeconds = 300; int s_maxAllowedNumberOfTickets = 1; int s_gameServicePort = 0; int s_chatServicePort = 0; - const char* s_chatServiceBindInterface = nullptr; - const char* s_gameServiceBindInterface = nullptr; + const char* s_chatServiceBindInterface = NULL; + const char* s_gameServiceBindInterface = NULL; bool s_writeTicketToBugLog = false; }; diff --git a/engine/server/application/CustomerServiceServer/src/shared/CustomerServiceInterface.cpp b/engine/server/application/CustomerServiceServer/src/shared/CustomerServiceInterface.cpp index 333117be..e1e93c31 100755 --- a/engine/server/application/CustomerServiceServer/src/shared/CustomerServiceInterface.cpp +++ b/engine/server/application/CustomerServiceServer/src/shared/CustomerServiceInterface.cpp @@ -38,7 +38,7 @@ using namespace CSAssist; /////////////////////////////////////////////////////////////////////////////// CustomerServiceInterface::ClientInfo::ClientInfo() - : m_connection(nullptr) + : m_connection(NULL) , m_stationUserId(0) , m_ticketCount(-1) , m_pendingTicketCount(0) @@ -71,10 +71,10 @@ CustomerServiceInterface::~CustomerServiceInterface() delete m_japaneseCategoryList; delete m_clientConnectionMap; - m_clientConnectionMap = nullptr; + m_clientConnectionMap = NULL; delete m_suidToNetworkIdMap; - m_suidToNetworkIdMap = nullptr; + m_suidToNetworkIdMap = NULL; } //----------------------------------------------------------------------- @@ -97,8 +97,8 @@ void CustomerServiceInterface::OnConnectCSAssist( } m_connectionToBackEndEstablised = true; - m_englishCategoryTrack = requestGetIssueHierarchy(nullptr, Unicode::narrowToWide("Default").data(), Unicode::narrowToWide("en").data());; - m_japaneseCategoryTrack = requestGetIssueHierarchy(nullptr, Unicode::narrowToWide("Default").data(), Unicode::narrowToWide("ja").data());; + m_englishCategoryTrack = requestGetIssueHierarchy(NULL, Unicode::narrowToWide("Default").data(), Unicode::narrowToWide("en").data());; + m_japaneseCategoryTrack = requestGetIssueHierarchy(NULL, Unicode::narrowToWide("Default").data(), Unicode::narrowToWide("ja").data());; } } @@ -117,7 +117,7 @@ void CustomerServiceInterface::OnConnectRejectedCSAssist(const CSAssistGameAPITr void CustomerServiceInterface::parseIssueChild(CategoryList & categoryList, xmlNodePtr childPtr) { - static CustomerServiceCategory *currentCategory = nullptr; + static CustomerServiceCategory *currentCategory = NULL; xmlNodePtr child = childPtr->children; //start element @@ -142,19 +142,19 @@ void CustomerServiceInterface::parseIssueChild(CategoryList & categoryList, xmlN val = reinterpret_cast(xmlGetProp(childPtr, (const unsigned char *)"isBugType")); - bool const isBugType = (val != nullptr) && (strcmp(val, "true") == 0); + bool const isBugType = (val != NULL) && (strcmp(val, "true") == 0); // Check for service type val = reinterpret_cast(xmlGetProp(childPtr, (const unsigned char *)"isServiceType")); - bool const isServiceType = (val != nullptr) && (strcmp(val, "true") == 0); + bool const isServiceType = (val != NULL) && (strcmp(val, "true") == 0); // Check if valid val = reinterpret_cast(xmlGetProp(childPtr, (const unsigned char *)"invalid")); - bool const invalid = (val != nullptr) && (strcmp(val, "true") == 0); + bool const invalid = (val != NULL) && (strcmp(val, "true") == 0); if (!invalid) { @@ -187,9 +187,9 @@ void CustomerServiceInterface::parseIssueChild(CategoryList & categoryList, xmlN } } - while (child != nullptr) + while (child != NULL) { - if (child->name != nullptr) + if (child->name != NULL) { parseIssueChild(categoryList, child); } @@ -204,7 +204,7 @@ void CustomerServiceInterface::parseIssueChild(CategoryList & categoryList, xmlN if (currentCategory) { delete currentCategory; - currentCategory = nullptr; + currentCategory = NULL; } } @@ -215,13 +215,13 @@ void CustomerServiceInterface::parseIssueChild(CategoryList & categoryList, xmlN void CustomerServiceInterface::parseIssueHierarchy(CategoryList & categoryList, Unicode::String const & xmlData) { - xmlDocPtr xmlInfo = nullptr; + xmlDocPtr xmlInfo = NULL; Unicode::UTF8String xmlDataUtf8(Unicode::wideToUTF8(xmlData)); - if ((xmlInfo = xmlParseMemory(xmlDataUtf8.c_str(), xmlDataUtf8.length())) != nullptr) + if ((xmlInfo = xmlParseMemory(xmlDataUtf8.c_str(), xmlDataUtf8.length())) != NULL) { xmlNodePtr xmlCurrent = xmlDocGetRootElement(xmlInfo); - if (xmlCurrent != nullptr) + if (xmlCurrent != NULL) { parseIssueChild(categoryList, xmlCurrent); } @@ -247,7 +247,7 @@ void CustomerServiceInterface::OnGetIssueHierarchy( return; } - if (hierarchyBody != nullptr) + if (hierarchyBody != NULL) { if (track == m_englishCategoryTrack) { @@ -266,7 +266,7 @@ void CustomerServiceInterface::OnGetIssueHierarchy( } else { - LOG("CSServer", ("ERROR: nullptr hierarchy returned from platform...why did this happen?", track, modifyData, result, getErrorString(result))); + LOG("CSServer", ("ERROR: NULL hierarchy returned from platform...why did this happen?", track, modifyData, result, getErrorString(result))); } } @@ -282,9 +282,9 @@ void CustomerServiceInterface::OnCreateTicket( CreateTicketResponseMessage message(result, ticket); const NetworkId *tmpNetworkId = reinterpret_cast(userData); - LOG("CSServer", ("OnCreateTicket() track(%i) result(%i) (%s) networkId(%s) ticketId(%i)", track, result, getErrorString(result), (tmpNetworkId != nullptr) ? tmpNetworkId->getValueString().c_str() : "NA", ticket)); + LOG("CSServer", ("OnCreateTicket() track(%i) result(%i) (%s) networkId(%s) ticketId(%i)", track, result, getErrorString(result), (tmpNetworkId != NULL) ? tmpNetworkId->getValueString().c_str() : "NA", ticket)); - if (tmpNetworkId != nullptr) + if (tmpNetworkId != NULL) { if (result == CSASSIST_RESULT_SUCCESS) { @@ -296,7 +296,7 @@ void CustomerServiceInterface::OnCreateTicket( sendToClient(*tmpNetworkId, message); delete tmpNetworkId; - tmpNetworkId = nullptr; + tmpNetworkId = NULL; } } @@ -312,14 +312,14 @@ void CustomerServiceInterface::OnAppendTicketComment( AppendCommentResponseMessage message(result, ticket); const NetworkId *tmpNetworkId = reinterpret_cast(userData); - LOG("CSServer", ("OnAppendTicketComment() track(%i) result(%i) (%s) networkId(%s) ticketId(%i)", track, result, getErrorString(result), (tmpNetworkId != nullptr) ? tmpNetworkId->getValueString().c_str() : "NA", ticket)); + LOG("CSServer", ("OnAppendTicketComment() track(%i) result(%i) (%s) networkId(%s) ticketId(%i)", track, result, getErrorString(result), (tmpNetworkId != NULL) ? tmpNetworkId->getValueString().c_str() : "NA", ticket)); - if (tmpNetworkId != nullptr) + if (tmpNetworkId != NULL) { sendToClient(*tmpNetworkId, message); delete tmpNetworkId; - tmpNetworkId = nullptr; + tmpNetworkId = NULL; } } @@ -335,9 +335,9 @@ void CustomerServiceInterface::OnCancelTicket( CancelTicketResponseMessage message(result, ticket); const NetworkId *tmpNetworkId = reinterpret_cast(userData); - LOG("CSServer", ("OnCancelTicket() track(%i) result(%i) (%s) networkId(%s) ticketId(%i)", track, result, getErrorString(result), (tmpNetworkId != nullptr) ? tmpNetworkId->getValueString().c_str() : "NA", ticket)); + LOG("CSServer", ("OnCancelTicket() track(%i) result(%i) (%s) networkId(%s) ticketId(%i)", track, result, getErrorString(result), (tmpNetworkId != NULL) ? tmpNetworkId->getValueString().c_str() : "NA", ticket)); - if (tmpNetworkId != nullptr) + if (tmpNetworkId != NULL) { if (result == CSASSIST_RESULT_SUCCESS) { @@ -347,7 +347,7 @@ void CustomerServiceInterface::OnCancelTicket( sendToClient(*tmpNetworkId, message); delete tmpNetworkId; - tmpNetworkId = nullptr; + tmpNetworkId = NULL; } } @@ -378,9 +378,9 @@ void CustomerServiceInterface::OnGetTicketByCharacter( GetTicketsResponseMessage message(result, totalNumber, tickets); const NetworkId *tmpNetworkId = reinterpret_cast(userData); - LOG("CSServer", ("OnGetTicketByCharacter() track(%i) result(%i) (%s) networkId(%s) totalNumber(%i) numberReturned(%i)", track, result, getErrorString(result), (tmpNetworkId != nullptr) ? tmpNetworkId->getValueString().c_str() : "NA", totalNumber, numberReturned)); + LOG("CSServer", ("OnGetTicketByCharacter() track(%i) result(%i) (%s) networkId(%s) totalNumber(%i) numberReturned(%i)", track, result, getErrorString(result), (tmpNetworkId != NULL) ? tmpNetworkId->getValueString().c_str() : "NA", totalNumber, numberReturned)); - if (tmpNetworkId != nullptr) + if (tmpNetworkId != NULL) { // Save the number of tickets this player has @@ -396,7 +396,7 @@ void CustomerServiceInterface::OnGetTicketByCharacter( sendToClient(*tmpNetworkId, message); delete tmpNetworkId; - tmpNetworkId = nullptr; + tmpNetworkId = NULL; } } @@ -423,14 +423,14 @@ void CustomerServiceInterface::OnGetTicketComments( const NetworkId *tmpNetworkId = reinterpret_cast(userData); - LOG("CSServer", ("OnGetTicketComments() track(%i) result(%i) (%s) networkId(%s) numberRead(%i)", track, result, getErrorString(result), (tmpNetworkId != nullptr) ? tmpNetworkId->getValueString().c_str() : "NA", numberRead)); + LOG("CSServer", ("OnGetTicketComments() track(%i) result(%i) (%s) networkId(%s) numberRead(%i)", track, result, getErrorString(result), (tmpNetworkId != NULL) ? tmpNetworkId->getValueString().c_str() : "NA", numberRead)); - if (tmpNetworkId != nullptr) + if (tmpNetworkId != NULL) { sendToClient(*tmpNetworkId, message); delete tmpNetworkId; - tmpNetworkId = nullptr; + tmpNetworkId = NULL; } } @@ -455,14 +455,14 @@ void CustomerServiceInterface::OnSearchKB( SearchKnowledgeBaseResponseMessage message(result, searchResultsVector); const NetworkId *tmpNetworkId = reinterpret_cast(userData); - LOG("CSServer", ("OnSearchKB() track(%i) result(%i) (%s) networkId(%s) numberRead(%i)", track, result, getErrorString(result), (tmpNetworkId != nullptr) ? tmpNetworkId->getValueString().c_str() : "NA", numberRead)); + LOG("CSServer", ("OnSearchKB() track(%i) result(%i) (%s) networkId(%s) numberRead(%i)", track, result, getErrorString(result), (tmpNetworkId != NULL) ? tmpNetworkId->getValueString().c_str() : "NA", numberRead)); - if (tmpNetworkId != nullptr) + if (tmpNetworkId != NULL) { sendToClient(*tmpNetworkId, message); delete tmpNetworkId; - tmpNetworkId = nullptr; + tmpNetworkId = NULL; } } @@ -482,12 +482,12 @@ void CustomerServiceInterface::OnGetKBArticle( { GetArticleResponseMessage message(result, Unicode::String(articleBody)); const NetworkId *tmpNetworkId = reinterpret_cast(userData); - if (tmpNetworkId != nullptr) + if (tmpNetworkId != NULL) { sendToClient(*tmpNetworkId, message); delete tmpNetworkId; - tmpNetworkId = nullptr; + tmpNetworkId = NULL; } } } @@ -501,7 +501,7 @@ void CustomerServiceInterface::OnIssueHierarchyChanged( { LOG("CSServer", ("OnIssueHierarchyChanged()")); - requestGetIssueHierarchy(nullptr, version, language); + requestGetIssueHierarchy(NULL, version, language); } //----------------------------------------------------------------------- @@ -512,9 +512,9 @@ void CustomerServiceInterface::OnNewTicketActivity(const CSAssistGameAPITrack tr const NetworkId *tmpNetworkId = reinterpret_cast(userData); - LOG("CSServer", ("OnNewTicketActivity() track(%i) result(%i) (%s) networkId(%s) activity(%s) ticket count(%i)", track, result, getErrorString(result), (tmpNetworkId != nullptr) ? tmpNetworkId->getValueString().c_str() : "NA", NewActivityFlag ? "yes" : "no", HasTickets)); + LOG("CSServer", ("OnNewTicketActivity() track(%i) result(%i) (%s) networkId(%s) activity(%s) ticket count(%i)", track, result, getErrorString(result), (tmpNetworkId != NULL) ? tmpNetworkId->getValueString().c_str() : "NA", NewActivityFlag ? "yes" : "no", HasTickets)); - if (tmpNetworkId != nullptr) + if (tmpNetworkId != NULL) { // Save the number of tickets this player has @@ -530,7 +530,7 @@ void CustomerServiceInterface::OnNewTicketActivity(const CSAssistGameAPITrack tr sendToClient(*tmpNetworkId, message); delete tmpNetworkId; - tmpNetworkId = nullptr; + tmpNetworkId = NULL; } } @@ -540,12 +540,12 @@ void CustomerServiceInterface::OnMarkTicketRead(const CSAssistGameAPITrack track { const NetworkId *tmpNetworkId = reinterpret_cast(userData); - LOG("CSServer", ("OnMarkTicketRead() track(%i) result(%i) (%s) networkId(%s)", track, result, getErrorString(result), (tmpNetworkId != nullptr) ? tmpNetworkId->getValueString().c_str() : "NA")); + LOG("CSServer", ("OnMarkTicketRead() track(%i) result(%i) (%s) networkId(%s)", track, result, getErrorString(result), (tmpNetworkId != NULL) ? tmpNetworkId->getValueString().c_str() : "NA")); - if (tmpNetworkId != nullptr) + if (tmpNetworkId != NULL) { delete tmpNetworkId; - tmpNetworkId = nullptr; + tmpNetworkId = NULL; } } @@ -575,16 +575,16 @@ void CustomerServiceInterface::OnRegisterCharacter(const CSAssistGameAPITrack tr { const NetworkId *tmpNetworkId = reinterpret_cast(userData); - LOG("CSServer", ("OnRegisterCharacter() track(%i) result(%i) (%s) networkId(%s)", track, result, getErrorString(result), (tmpNetworkId != nullptr) ? tmpNetworkId->getValueString().c_str() : "NA")); + LOG("CSServer", ("OnRegisterCharacter() track(%i) result(%i) (%s) networkId(%s)", track, result, getErrorString(result), (tmpNetworkId != NULL) ? tmpNetworkId->getValueString().c_str() : "NA")); - if (tmpNetworkId != nullptr) + if (tmpNetworkId != NULL) { ConnectPlayerResponseMessage message(result); sendToClient(*tmpNetworkId, message); delete tmpNetworkId; - tmpNetworkId = nullptr; + tmpNetworkId = NULL; } } @@ -594,9 +594,9 @@ void CustomerServiceInterface::OnUnRegisterCharacter(const CSAssistGameAPITrack { const NetworkId *tmpNetworkId = reinterpret_cast(userData); - LOG("CSServer", ("OnUnRegisterCharacter() track(%i) result(%i) (%s) networkId(%s)", track, result, getErrorString(result), (tmpNetworkId != nullptr) ? tmpNetworkId->getValueString().c_str() : "NA")); + LOG("CSServer", ("OnUnRegisterCharacter() track(%i) result(%i) (%s) networkId(%s)", track, result, getErrorString(result), (tmpNetworkId != NULL) ? tmpNetworkId->getValueString().c_str() : "NA")); - if (tmpNetworkId != nullptr) + if (tmpNetworkId != NULL) { // If the player was successfully unregistered, remove the local cached reference @@ -606,7 +606,7 @@ void CustomerServiceInterface::OnUnRegisterCharacter(const CSAssistGameAPITrack } delete tmpNetworkId; - tmpNetworkId = nullptr; + tmpNetworkId = NULL; } } @@ -708,7 +708,7 @@ void CustomerServiceInterface::sendToClient(const NetworkId &player, const GameN } else { - LOG("CSServer", ("sendToClient() Connection is nullptr: networkId(%s) cmdName(%s)", player.getValueString().c_str(), message.getCmdName().c_str())); + LOG("CSServer", ("sendToClient() Connection is NULL: networkId(%s) cmdName(%s)", player.getValueString().c_str(), message.getCmdName().c_str())); } } else @@ -779,7 +779,7 @@ void CustomerServiceInterface::requestUnRegisterCharacter(const NetworkId &reque LOG("CSServer", ("requestUnRegisterCharacter() networkId(%s) suid(%i)", requester.getValueString().c_str(), suid)); NetworkId *tmpNetworkId = new NetworkId(requester); - CSAssistGameAPI::requestUnRegisterCharacter(reinterpret_cast(tmpNetworkId), suid, nullptr); + CSAssistGameAPI::requestUnRegisterCharacter(reinterpret_cast(tmpNetworkId), suid, NULL); } else { diff --git a/engine/server/application/CustomerServiceServer/src/shared/CustomerServiceServer.cpp b/engine/server/application/CustomerServiceServer/src/shared/CustomerServiceServer.cpp index fb4e7abe..7beaacc5 100755 --- a/engine/server/application/CustomerServiceServer/src/shared/CustomerServiceServer.cpp +++ b/engine/server/application/CustomerServiceServer/src/shared/CustomerServiceServer.cpp @@ -49,7 +49,7 @@ namespace CustomerServiceServerNamespace using namespace CustomerServiceServerNamespace; -CustomerServiceServer *CustomerServiceServer::m_instance = nullptr; +CustomerServiceServer *CustomerServiceServer::m_instance = NULL; /////////////////////////////////////////////////////////////////////////////// // @@ -83,12 +83,12 @@ CustomerServiceServer::PendingTicket::PendingTicket() CustomerServiceServer::CustomerServiceServer() : m_callback(new MessageDispatch::Callback), -m_centralServerConnection(nullptr), +m_centralServerConnection(NULL), m_connectionServerSet(new ConnectionServerSet), m_done(false), m_csInterface(ConfigCustomerServiceServer::getCustomerServiceServerAddress(), ConfigCustomerServiceServer::getCustomerServiceServerPort(), ConfigCustomerServiceServer::getRequestTimeoutSeconds()), -m_gameServerService(nullptr), -m_chatServerService(nullptr), +m_gameServerService(NULL), +m_chatServerService(NULL), m_nextSequenceId(0), m_pendingTicketList(new PendingTicketList) { @@ -113,7 +113,7 @@ m_pendingTicketList(new PendingTicketList) m_csInterface.setMaxPacketsPerSecond(ConfigCustomerServiceServer::getMaxPacketsPerSecond()); - m_csInterface.connectCSAssist(nullptr, + m_csInterface.connectCSAssist(NULL, Unicode::narrowToWide(ConfigCustomerServiceServer::getGameCode()).data(), Unicode::narrowToWide(ConfigCustomerServiceServer::getClusterName()).data()); @@ -148,19 +148,19 @@ CustomerServiceServer::~CustomerServiceServer() m_centralServerConnection->disconnect(); delete m_callback; - m_callback = nullptr; + m_callback = NULL; delete m_connectionServerSet; - m_connectionServerSet = nullptr; + m_connectionServerSet = NULL; delete m_gameServerService; - m_gameServerService = nullptr; + m_gameServerService = NULL; delete m_chatServerService; - m_chatServerService = nullptr; + m_chatServerService = NULL; delete m_pendingTicketList; - m_pendingTicketList = nullptr; + m_pendingTicketList = NULL; MetricsManager::remove(); delete s_customerServiceServerMetricsData; @@ -233,7 +233,7 @@ void CustomerServiceServer::update() CustomerServiceServer &CustomerServiceServer::getInstance() { - if (m_instance == nullptr) + if (m_instance == NULL) { m_instance = new CustomerServiceServer; } @@ -405,7 +405,7 @@ void CustomerServiceServer::getTickets( NetworkId *tmpNetworkId = new NetworkId(requester); m_csInterface.requestGetTicketByCharacter( - reinterpret_cast(tmpNetworkId), suid, nullptr, + reinterpret_cast(tmpNetworkId), suid, NULL, start, count, markAsRead); } @@ -475,7 +475,7 @@ void CustomerServiceServer::requestNewTicketActivity(const NetworkId &requester, NetworkId *tmpNetworkId = new NetworkId(requester); - m_csInterface.requestNewTicketActivity(reinterpret_cast(tmpNetworkId), suid, nullptr); + m_csInterface.requestNewTicketActivity(reinterpret_cast(tmpNetworkId), suid, NULL); } //----------------------------------------------------------------------- @@ -497,7 +497,7 @@ void CustomerServiceServer::requestRegisterCharacter(const NetworkId &requester, LOG("CSServer", ("CustomerServiceInterface::requestRegisterCharacter() - networkId(%s) suid(%i)", requester.getValueString().c_str(), suid)); NetworkId *tmpNetworkId = new NetworkId(requester); - m_csInterface.requestRegisterCharacter(reinterpret_cast(tmpNetworkId), suid, nullptr, 0); + m_csInterface.requestRegisterCharacter(reinterpret_cast(tmpNetworkId), suid, NULL, 0); } } diff --git a/engine/server/application/LogServer/src/shared/LoggingServerApi.cpp b/engine/server/application/LogServer/src/shared/LoggingServerApi.cpp index a6b9920f..89591848 100755 --- a/engine/server/application/LogServer/src/shared/LoggingServerApi.cpp +++ b/engine/server/application/LogServer/src/shared/LoggingServerApi.cpp @@ -23,16 +23,16 @@ LoggingServerApi::LoggingServerApi(LoggingServerHandler *handler, int queueSize) mLoginName[0] = 0; mPassword[0] = 0; mDefaultDirectory[0] = 0; - mConnection = nullptr; - mUdpManager = nullptr; - mTransaction = nullptr; - mSessionId = int(time(nullptr)); + mConnection = NULL; + mUdpManager = NULL; + mTransaction = NULL; + mSessionId = int(time(NULL)); mSessionSequence = 1; } LoggingServerApi::~LoggingServerApi() { - if (mTransaction != nullptr) + if (mTransaction != NULL) StopTransaction(); for (int i = 0; i < mQueueCount; i++) @@ -77,7 +77,7 @@ void LoggingServerApi::Connect(const char *address, int port, const char *loginN mUdpManager = new UdpManager(¶ms); mConnection = mUdpManager->EstablishConnection(address, port, 30000); - if (mConnection != nullptr) + if (mConnection != NULL) mConnection->SetHandler(this); mLoginSent = false; } @@ -89,17 +89,17 @@ void LoggingServerApi::Disconnect() mPassword[0] = 0; mDefaultDirectory[0] = 0; - if (mConnection != nullptr) + if (mConnection != NULL) { mConnection->Disconnect(); mConnection->Release(); - mConnection = nullptr; + mConnection = NULL; } - if (mUdpManager != nullptr) + if (mUdpManager != NULL) { mUdpManager->Release(); - mUdpManager = nullptr; + mUdpManager = NULL; } } @@ -119,7 +119,7 @@ void LoggingServerApi::Flush(int timeout) LoggingServerApi::Status LoggingServerApi::GetStatus() const { - if (mConnection != nullptr) + if (mConnection != NULL) { switch (mConnection->GetStatus()) { @@ -153,7 +153,7 @@ void LoggingServerApi::OnRoutePacket(UdpConnection *, const uchar *data, int) FlushQueue(); } - if (mHandler != nullptr) + if (mHandler != NULL) mHandler->LshOnLoginConfirm(mAuthenticated); break; } @@ -171,13 +171,13 @@ void LoggingServerApi::OnRoutePacket(UdpConnection *, const uchar *data, int) char *filename = ptr; ptr += strlen(ptr) + 1; char *message = ptr; - if (mHandler != nullptr) + if (mHandler != NULL) mHandler->LshOnMonitor(sessionId, sequenceNumber, name, filename, typeCode, message); break; } case cS2CPacketFileList: { - if (mHandler != nullptr) + if (mHandler != NULL) mHandler->LshOnFileList((char *)(data + 1)); break; } @@ -188,7 +188,7 @@ void LoggingServerApi::OnRoutePacket(UdpConnection *, const uchar *data, int) void LoggingServerApi::OnTerminated(UdpConnection *con) { - if(mHandler != nullptr) + if(mHandler != NULL) { mHandler->LshOnTerminated( con->GetDisconnectReason() ); } @@ -196,7 +196,7 @@ void LoggingServerApi::OnTerminated(UdpConnection *con) void LoggingServerApi::GiveTime() { - if (mConnection != nullptr && mConnection->GetStatus() == UdpConnection::cStatusConnected) + if (mConnection != NULL && mConnection->GetStatus() == UdpConnection::cStatusConnected) { if (!mLoginSent) { @@ -225,7 +225,7 @@ void LoggingServerApi::GiveTime() if (mQueue[spot].sentTime != 0 && UdpMisc::ClockElapsed(mQueue[spot].sentTime) > cSafetyQueueTime) { mQueue[spot].packet->Release(); - mQueue[spot].packet = nullptr; + mQueue[spot].packet = NULL; mQueuePosition++; mQueueCount--; } @@ -235,7 +235,7 @@ void LoggingServerApi::GiveTime() } } - if (mUdpManager != nullptr) + if (mUdpManager != NULL) { mUdpManager->GiveTime(); } @@ -243,17 +243,17 @@ void LoggingServerApi::GiveTime() void LoggingServerApi::StartTransaction() { - if (mTransaction == nullptr) + if (mTransaction == NULL) mTransaction = new GroupLogicalPacket(); } void LoggingServerApi::StopTransaction() { - if (mTransaction != nullptr) + if (mTransaction != NULL) { PacketSend(mTransaction); mTransaction->Release(); - mTransaction = nullptr; + mTransaction = NULL; } } @@ -264,7 +264,7 @@ void LoggingServerApi::PacketSend(LogicalPacket *lp) { int spot = mQueuePosition % mQueueSize; mQueue[spot].packet->Release(); - mQueue[spot].packet = nullptr; + mQueue[spot].packet = NULL; mQueuePosition++; mQueueCount--; } @@ -374,7 +374,7 @@ void LoggingServerApi::Log(const char *filename, int typeCode, const char *messa void LoggingServerApi::LogPacket(char *data, int len) { - if (mTransaction != nullptr) + if (mTransaction != NULL) { // add it to the transaction mTransaction->AddPacket(data, len); @@ -389,7 +389,7 @@ void LoggingServerApi::LogPacket(char *data, int len) LogicalPacket *LoggingServerApi::CreatePacket(char *data, int dataLen) { - if (mUdpManager != nullptr) + if (mUdpManager != NULL) { return(mUdpManager->CreatePacket(data, dataLen)); } @@ -440,7 +440,7 @@ void LoggingServerApi::GetStatistics(LoggingServerApiStatistics *stats) memset( stats, 0, sizeof( *stats) ); UdpConnectionStatistics udpConnectionStats; memset( &udpConnectionStats, 0, sizeof( udpConnectionStats ) ); - if( mConnection != nullptr ) + if( mConnection != NULL ) { mConnection->GetStats( &udpConnectionStats ); stats->applicationPacketsReceived = udpConnectionStats.applicationPacketsReceived; @@ -454,7 +454,7 @@ void LoggingServerApi::GetStatistics(LoggingServerApiStatistics *stats) } UdpManagerStatistics managerStats; - if( mUdpManager != nullptr ) + if( mUdpManager != NULL ) { mUdpManager->GetStats( &managerStats ); udp_int64 iterations = managerStats.iterations; diff --git a/engine/server/application/LoginServer/src/linux/main.cpp b/engine/server/application/LoginServer/src/linux/main.cpp index e08cb606..7b4d7c1b 100755 --- a/engine/server/application/LoginServer/src/linux/main.cpp +++ b/engine/server/application/LoginServer/src/linux/main.cpp @@ -35,7 +35,7 @@ int main(int argc, char ** argv) SetupSharedFile::install(false); SetupSharedNetworkMessages::install(); - SetupSharedRandom::install(static_cast(time(nullptr))); //lint !e1924 !e64 // nullptr is a C-Style cast? + SetupSharedRandom::install(static_cast(time(NULL))); //lint !e1924 !e64 // NULL is a C-Style cast? Os::setProgramName("LoginServer"); //setup the server diff --git a/engine/server/application/LoginServer/src/shared/CSToolConnection.cpp b/engine/server/application/LoginServer/src/shared/CSToolConnection.cpp index 7e10c623..3da0b98b 100755 --- a/engine/server/application/LoginServer/src/shared/CSToolConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/CSToolConnection.cpp @@ -51,7 +51,7 @@ void CSToolConnection::validateCSTool(uint32 toolId, apiResult result, const api p_connection->m_bSecure = true; } - // if we have a nullptr session type, then we aren't connected to the + // if we have a null session type, then we aren't connected to the // Session Server and are in debug mode. // // if we *do* have a good session, then check the admin table for access level. @@ -71,7 +71,7 @@ void CSToolConnection::validateCSTool(uint32 toolId, apiResult result, const api bool canLogin = isInternal; // we always have to be internal. if (sessionNull) { - // nullptr session means we can skip everything else. + // null session means we can skip everything else. canLogin = canLogin && true; accessLevel = 100; } diff --git a/engine/server/application/LoginServer/src/shared/CentralServerConnection.cpp b/engine/server/application/LoginServer/src/shared/CentralServerConnection.cpp index 2f096fce..6b803038 100755 --- a/engine/server/application/LoginServer/src/shared/CentralServerConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/CentralServerConnection.cpp @@ -282,13 +282,13 @@ void CentralServerConnection::onReceive(const Archive::ByteStream & message) else if(m.isType("GcwScoreStatRaw")) { GenericValueTypeMessage >, std::map > > > > const msg(ri); - LoginServer::getInstance().sendToAllClusters(msg, nullptr, 0, msg.getValue().first.c_str()); + LoginServer::getInstance().sendToAllClusters(msg, NULL, 0, msg.getValue().first.c_str()); } else if(m.isType("GcwScoreStatPct")) { GenericValueTypeMessage, std::map > > > const msg(ri); - LoginServer::getInstance().sendToAllClusters(msg, nullptr, 0, msg.getValue().first.c_str()); + LoginServer::getInstance().sendToAllClusters(msg, NULL, 0, msg.getValue().first.c_str()); } } diff --git a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp index 6fe81a51..087796db 100755 --- a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp @@ -100,7 +100,7 @@ void ClientConnection::onReceive(const Archive::ByteStream & message) // client has an idea of how much difference there is between // the client's Epoch time and the server Epoch time GenericValueTypeMessage const serverNowEpochTime( - "ServerNowEpochTime", static_cast(::time(nullptr))); + "ServerNowEpochTime", static_cast(::time(NULL))); send(serverNowEpochTime, true); LoginClientId id(ri); @@ -202,7 +202,7 @@ void ClientConnection::validateClient(const std::string & id, const std::string LOG("LoginClientConnection", ("validateClient() for stationId (%lu) at IP (%s), id (%s) key (%s), skipping validating session", m_stationId, getRemoteAddress().c_str(), id.c_str(), key.c_str())); - LoginServer::getInstance().onValidateClient(suid, id, this, true, nullptr, 0xFFFFFFFF, 0xFFFFFFFF); + LoginServer::getInstance().onValidateClient(suid, id, this, true, NULL, 0xFFFFFFFF, 0xFFFFFFFF); } } diff --git a/engine/server/application/LoginServer/src/shared/ConsoleManager.cpp b/engine/server/application/LoginServer/src/shared/ConsoleManager.cpp index 8721d5c6..ecaaa8fa 100755 --- a/engine/server/application/LoginServer/src/shared/ConsoleManager.cpp +++ b/engine/server/application/LoginServer/src/shared/ConsoleManager.cpp @@ -14,7 +14,7 @@ namespace ConsoleManagerNamespace { - ConsoleCommandParser * s_consoleCommandParserRoot = nullptr; + ConsoleCommandParser * s_consoleCommandParserRoot = NULL; } using namespace ConsoleManagerNamespace; diff --git a/engine/server/application/LoginServer/src/shared/LoginServer.cpp b/engine/server/application/LoginServer/src/shared/LoginServer.cpp index 759331b4..a38d3725 100755 --- a/engine/server/application/LoginServer/src/shared/LoginServer.cpp +++ b/engine/server/application/LoginServer/src/shared/LoginServer.cpp @@ -130,7 +130,7 @@ LoginServer::LoginServer() : Singleton(), MessageDispatch::Receiver(), done(false), -m_centralService(nullptr), +m_centralService(NULL), clientService(0), pingService(0), keyServer(0), @@ -391,7 +391,7 @@ void LoginServer::receiveMessage(const MessageDispatch::Emitter & source, const { CentralServerConnection * connection = const_cast(safe_cast(&source)); DEBUG_REPORT_LOG(true, ("Cluster connection %s opened\n", msg.getClusterName().c_str())); - ClusterListEntry *cle=nullptr; + ClusterListEntry *cle=NULL; if (ConfigLoginServer::getDevelopmentMode()) { // in this mode, we trust the name sent by the cluster and we dynamically add clusters we don't know about @@ -410,7 +410,7 @@ void LoginServer::receiveMessage(const MessageDispatch::Emitter & source, const { WARNING(true,("Server %i is named \"%s\" in the database. The server at the specified address (%s:%hu) reports its name as \"%s\". It will not be allowed in the service. Either the name in the database or the name in Central's config file should be corrected.\n",cle->m_clusterId, cle->m_clusterName.c_str(), connection->getRemoteAddress().c_str(), connection->getRemotePort(), msg.getClusterName().c_str())); disconnectCluster(*cle,true,false); - cle=nullptr; + cle=NULL; } } @@ -589,7 +589,7 @@ void LoginServer::receiveMessage(const MessageDispatch::Emitter & source, const // for testing purpose when not using session authentication, store // the account feature Ids locally in memory, which will get cleared // (obviously) when the LoginServer is restarted - std::map > * nonSessionTestingAccountFeatureIds = nullptr; + std::map > * nonSessionTestingAccountFeatureIds = NULL; if (msg.getGameCode() == PlatformGameCode::SWG) nonSessionTestingAccountFeatureIds = &s_nonSessionTestingAccountSwgFeatureIds; else if (msg.getGameCode() == PlatformGameCode::SWGTCG) @@ -648,7 +648,7 @@ void LoginServer::receiveMessage(const MessageDispatch::Emitter & source, const // for testing purpose when not using session authentication, store // the account feature Ids locally in memory, which will get cleared // (obviously) when the LoginServer is restarted - std::map > * nonSessionTestingAccountFeatureIds = nullptr; + std::map > * nonSessionTestingAccountFeatureIds = NULL; if (msg.getGameCode() == PlatformGameCode::SWG) nonSessionTestingAccountFeatureIds = &s_nonSessionTestingAccountSwgFeatureIds; else if (msg.getGameCode() == PlatformGameCode::SWGTCG) @@ -826,7 +826,7 @@ void LoginServer::receiveMessage(const MessageDispatch::Emitter & source, const const CentralServerConnection *conn = dynamic_cast(&source); if (conn) - DatabaseConnection::getInstance().renameCharacter(conn->getClusterId(), msg.getCharacterId(), msg.getNewName(), nullptr); + DatabaseConnection::getInstance().renameCharacter(conn->getClusterId(), msg.getCharacterId(), msg.getNewName(), NULL); else WARNING_STRICT_FATAL(true,("Got RenameCharacterMessage from something other than CentralServerConnection.\n")); } @@ -1461,11 +1461,11 @@ LoginServer::ClusterListEntry *LoginServer::findClusterByName(const std::string ClusterListType::iterator i; for (i=m_clusterList.begin(); i!=m_clusterList.end(); ++i) { - NOT_NULL(*i); // not legal to push nullptr pointers on the vector + NOT_NULL(*i); // not legal to push null pointers on the vector if ((*i)->m_clusterName == clusterName) return *i; } - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -1555,7 +1555,7 @@ void LoginServer::sendClusterStatus(ClientConnection &conn) const // 5) Cluster has told us its ready for players if (cle && cle->m_clusterId!=0 && cle->m_connected && !cle->m_connectionServers.empty() && (clientIsPrivate || !cle->m_secret)) { - DEBUG_FATAL(!cle->m_centralServerConnection,("Programmer bug: m_connected was true but m_centralServerConnection was nullptr\n")); + DEBUG_FATAL(!cle->m_centralServerConnection,("Programmer bug: m_connected was true but m_centralServerConnection was NULL\n")); LoginClusterStatus::ClusterData item; item.m_clusterId = cle->m_clusterId; item.m_timeZone = cle->m_timeZone; @@ -1840,12 +1840,12 @@ LoginServer::ClusterListEntry * LoginServer::findClusterById(uint32 clusterId) ClusterListType::const_iterator i; for (i=m_clusterList.begin(); i!=m_clusterList.end(); ++i) { - NOT_NULL(*i); // not legal to push nullptr pointers on the vector + NOT_NULL(*i); // not legal to push null pointers on the vector if ((*i)->m_clusterId == clusterId) return *i; } - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -1859,12 +1859,12 @@ LoginServer::ClusterListEntry * LoginServer::findClusterByConnection(const Centr ClusterListType::const_iterator i; for (i=m_clusterList.begin(); i!=m_clusterList.end(); ++i) { - NOT_NULL(*i); // not legal to push nullptr pointers on the vector + NOT_NULL(*i); // not legal to push null pointers on the vector if ((*i)->m_centralServerConnection == connection) return *i; } - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -1908,12 +1908,12 @@ void LoginServer::setDone(const bool isDone) // ---------------------------------------------------------------------- -void LoginServer::sendToAllClusters(GameNetworkMessage const & message, Connection const * excludeCentralConnection /*= nullptr*/, uint32 excludeClusterId /*= 0*/, char const * excludeClusterName /*= nullptr*/) +void LoginServer::sendToAllClusters(GameNetworkMessage const & message, Connection const * excludeCentralConnection /*= NULL*/, uint32 excludeClusterId /*= 0*/, char const * excludeClusterName /*= NULL*/) { ClusterListType::const_iterator i; for (i=m_clusterList.begin(); i!=m_clusterList.end(); ++i) { - if (NON_NULL(*i)->m_connected && (*i)->m_centralServerConnection && ((*i)->m_centralServerConnection != excludeCentralConnection) && ((*i)->m_clusterId != excludeClusterId) && ((excludeClusterName == nullptr) || _stricmp(excludeClusterName, (*i)->m_centralServerConnection->getClusterName().c_str()))) + if (NON_NULL(*i)->m_connected && (*i)->m_centralServerConnection && ((*i)->m_centralServerConnection != excludeCentralConnection) && ((*i)->m_clusterId != excludeClusterId) && ((excludeClusterName == NULL) || _stricmp(excludeClusterName, (*i)->m_centralServerConnection->getClusterName().c_str()))) (*i)->m_centralServerConnection->send(message,true); } } diff --git a/engine/server/application/LoginServer/src/shared/LoginServer.h b/engine/server/application/LoginServer/src/shared/LoginServer.h index f1d4de5b..a284068e 100755 --- a/engine/server/application/LoginServer/src/shared/LoginServer.h +++ b/engine/server/application/LoginServer/src/shared/LoginServer.h @@ -64,7 +64,7 @@ public: void validateAccount (const StationId& stationId, uint32 clusterId, uint32 subscriptionBits, bool canCreateRegular, bool canCreateJedi, bool canSkipTutorial, unsigned int track, std::vector > const & consumedRewardEvents, std::vector > const & claimedRewardItems); void validateAccountForTransfer(const TransferRequestMoveValidation & request, uint32 clusterId, uint32 sourceCharacterTemplateId, bool canCreateRegular, bool canCreateJedi); void sendToCluster (uint32 clusterId, const GameNetworkMessage &message); - void sendToAllClusters (GameNetworkMessage const & message, Connection const * excludeCentralConnection = nullptr, uint32 excludeClusterId = 0, char const * excludeClusterName = nullptr); + void sendToAllClusters (GameNetworkMessage const & message, Connection const * excludeCentralConnection = NULL, uint32 excludeClusterId = 0, char const * excludeClusterName = NULL); bool areAllClustersUp () const; void getClusterIds (stdvector::fwd result); void performAccountTransfer (const AvatarList &avatars, TransferAccountData * transferAccountData); diff --git a/engine/server/application/LoginServer/src/shared/SessionApiClient.cpp b/engine/server/application/LoginServer/src/shared/SessionApiClient.cpp index 73ff91ae..f130d691 100755 --- a/engine/server/application/LoginServer/src/shared/SessionApiClient.cpp +++ b/engine/server/application/LoginServer/src/shared/SessionApiClient.cpp @@ -435,7 +435,7 @@ void SessionApiClient::NotifySessionKick(const char ** sessionList, void SessionApiClient::checkStatusForPurge(StationId account) { - GetAccountSubscription(account, PlatformGameCode::SWG, nullptr); + GetAccountSubscription(account, PlatformGameCode::SWG, NULL); } //------------------------------------------------------------------------------------------ diff --git a/engine/server/application/LoginServer/src/shared/TaskCreateCharacter.cpp b/engine/server/application/LoginServer/src/shared/TaskCreateCharacter.cpp index 243f3c71..6e8ed6d4 100755 --- a/engine/server/application/LoginServer/src/shared/TaskCreateCharacter.cpp +++ b/engine/server/application/LoginServer/src/shared/TaskCreateCharacter.cpp @@ -58,7 +58,7 @@ void TaskCreateCharacter::onComplete() // let all other galaxies know that a new character has been created for the station account GenericValueTypeMessage const ncc("NewCharacterCreated", m_stationId); - LoginServer::getInstance().sendToAllClusters(ncc, nullptr, m_clusterId); + LoginServer::getInstance().sendToAllClusters(ncc, NULL, m_clusterId); } // ====================================================================== diff --git a/engine/server/application/LoginServer/src/shared/TaskGetCharactersForDelete.cpp b/engine/server/application/LoginServer/src/shared/TaskGetCharactersForDelete.cpp index 3cc49cef..5259daf4 100755 --- a/engine/server/application/LoginServer/src/shared/TaskGetCharactersForDelete.cpp +++ b/engine/server/application/LoginServer/src/shared/TaskGetCharactersForDelete.cpp @@ -14,7 +14,7 @@ // ====================================================================== TaskGetCharactersForDelete::TaskGetCharactersForDelete (StationId stationId, int clusterGroupId) : - TaskGetAvatarList(stationId, clusterGroupId, nullptr) + TaskGetAvatarList(stationId, clusterGroupId, NULL) { } diff --git a/engine/server/application/MetricsServer/src/linux/main.cpp b/engine/server/application/MetricsServer/src/linux/main.cpp index d4a429d8..2287e9de 100755 --- a/engine/server/application/MetricsServer/src/linux/main.cpp +++ b/engine/server/application/MetricsServer/src/linux/main.cpp @@ -40,7 +40,7 @@ int main(int argc, char ** argv) SetupSharedNetwork::getDefaultServerSetupData(networkSetupData); SetupSharedNetwork::install(networkSetupData); - SetupSharedRandom::install(static_cast(time(nullptr))); //lint !e1924 !e64 // nullptr is a C-Style cast? + SetupSharedRandom::install(static_cast(time(NULL))); //lint !e1924 !e64 // NULL is a C-Style cast? Os::setProgramName("MetricsServer"); //setup the server diff --git a/engine/server/application/MetricsServer/src/shared/MetricsGatheringConnection.cpp b/engine/server/application/MetricsServer/src/shared/MetricsGatheringConnection.cpp index dd398ff2..4cab5ae6 100755 --- a/engine/server/application/MetricsServer/src/shared/MetricsGatheringConnection.cpp +++ b/engine/server/application/MetricsServer/src/shared/MetricsGatheringConnection.cpp @@ -169,19 +169,19 @@ void MetricsGatheringConnection::update(const std::vector & data) //note: we know that the "isSecret", and "isLocked" nodes will come after the "population" node in the list // we are iterating over, so they will override the population setting - if (strstr((*dataIter).m_label.c_str(), "population") != nullptr) + if (strstr((*dataIter).m_label.c_str(), "population") != NULL) { // there are nodes under the population node, so don't interpret them as the population - if (strstr((*dataIter).m_label.c_str(), "population.") == nullptr) + if (strstr((*dataIter).m_label.c_str(), "population.") == NULL) mon->set(MetricsServer::getWorldCountChannel(), std::max((*dataIter).m_value, 0)); } - else if (strstr((*dataIter).m_label.c_str(), "isSecret") != nullptr - || strstr((*dataIter).m_label.c_str(), "isLocked") != nullptr) + else if (strstr((*dataIter).m_label.c_str(), "isSecret") != NULL + || strstr((*dataIter).m_label.c_str(), "isLocked") != NULL) { if ((*dataIter).m_value == 1) mon->set(MetricsServer::getWorldCountChannel(), STATUS_LOCKED); } - else if (strstr((*dataIter).m_label.c_str(), "isLoading") != nullptr) + else if (strstr((*dataIter).m_label.c_str(), "isLoading") != NULL) { // include in the root node description how // long the cluster has been loading @@ -226,19 +226,19 @@ void MetricsGatheringConnection::update(const std::vector & data) //note: we know that the "isSecret", and "isLocked" nodes will come after the "population" node in the list // we are iterating over, so they will override the population setting - if (strstr((*dataIter).m_label.c_str(), "population") != nullptr) + if (strstr((*dataIter).m_label.c_str(), "population") != NULL) { // there are nodes under the population node, so don't interpret them as the population - if (strstr((*dataIter).m_label.c_str(), "population.") == nullptr) + if (strstr((*dataIter).m_label.c_str(), "population.") == NULL) mon->set(MetricsServer::getWorldCountChannel(), std::max((*dataIter).m_value, 0)); } - else if (strstr((*dataIter).m_label.c_str(), "isSecret") != nullptr - || strstr((*dataIter).m_label.c_str(), "isLocked") != nullptr) + else if (strstr((*dataIter).m_label.c_str(), "isSecret") != NULL + || strstr((*dataIter).m_label.c_str(), "isLocked") != NULL) { if ((*dataIter).m_value == 1) mon->set(MetricsServer::getWorldCountChannel(), STATUS_LOCKED); } - else if (strstr((*dataIter).m_label.c_str(), "isLoading") != nullptr) + else if (strstr((*dataIter).m_label.c_str(), "isLoading") != NULL) { // include in the root node description how // long the cluster has been loading diff --git a/engine/server/application/MetricsServer/src/shared/MetricsServer.cpp b/engine/server/application/MetricsServer/src/shared/MetricsServer.cpp index aab52220..9754caca 100755 --- a/engine/server/application/MetricsServer/src/shared/MetricsServer.cpp +++ b/engine/server/application/MetricsServer/src/shared/MetricsServer.cpp @@ -29,8 +29,8 @@ std::string MetricsServer::m_worldCountChannelDescription; bool MetricsServer::m_done = false; Service* MetricsServer::m_metricsService; CMonitorAPI * MetricsServer::m_soeMonitor; -Service * MetricsServer::ms_service = nullptr; -TaskConnection * MetricsServer::ms_taskConnection = nullptr; +Service * MetricsServer::ms_service = NULL; +TaskConnection * MetricsServer::ms_taskConnection = NULL; //---------------------------------------------------------------- diff --git a/engine/server/application/PlanetServer/src/linux/main.cpp b/engine/server/application/PlanetServer/src/linux/main.cpp index 7d8b5908..d77747cf 100755 --- a/engine/server/application/PlanetServer/src/linux/main.cpp +++ b/engine/server/application/PlanetServer/src/linux/main.cpp @@ -46,7 +46,7 @@ int main(int argc, char ** argv) SetupSharedNetworkMessages::install(); - SetupSharedRandom::install(time(nullptr)); //lint !e732 loss of sign (of 0!) + SetupSharedRandom::install(time(NULL)); //lint !e732 loss of sign (of 0!) SetupSharedUtility::Data sharedUtilityData; SetupSharedUtility::setupGameData (sharedUtilityData); diff --git a/engine/server/application/PlanetServer/src/shared/ConsoleCommandParser.cpp b/engine/server/application/PlanetServer/src/shared/ConsoleCommandParser.cpp index 4a3fec7d..b5839b87 100755 --- a/engine/server/application/PlanetServer/src/shared/ConsoleCommandParser.cpp +++ b/engine/server/application/PlanetServer/src/shared/ConsoleCommandParser.cpp @@ -31,7 +31,7 @@ const CommandParser::CmdInfo cmds[] = //----------------------------------------------------------------------- ConsoleCommandParser::ConsoleCommandParser() : -CommandParser ("", 0, "...", "console commands", nullptr) +CommandParser ("", 0, "...", "console commands", NULL) { createDelegateCommands(cmds); } diff --git a/engine/server/application/PlanetServer/src/shared/ConsoleManager.cpp b/engine/server/application/PlanetServer/src/shared/ConsoleManager.cpp index 4a94be0c..2326cbf2 100755 --- a/engine/server/application/PlanetServer/src/shared/ConsoleManager.cpp +++ b/engine/server/application/PlanetServer/src/shared/ConsoleManager.cpp @@ -14,7 +14,7 @@ namespace ConsoleManagerNamespace { - ConsoleCommandParser * s_consoleCommandParserRoot = nullptr; + ConsoleCommandParser * s_consoleCommandParserRoot = NULL; } using namespace ConsoleManagerNamespace; diff --git a/engine/server/application/PlanetServer/src/shared/GameServerData.cpp b/engine/server/application/PlanetServer/src/shared/GameServerData.cpp index e7e91d59..58a57f31 100755 --- a/engine/server/application/PlanetServer/src/shared/GameServerData.cpp +++ b/engine/server/application/PlanetServer/src/shared/GameServerData.cpp @@ -27,7 +27,7 @@ GameServerData::GameServerData(GameServerConnection *connection) : // ---------------------------------------------------------------------- GameServerData::GameServerData(const GameServerData &rhs) : - m_connection(nullptr), // connection pointer is not copied when we copy GameServerDatas + m_connection(NULL), // connection pointer is not copied when we copy GameServerDatas m_objectCount(rhs.m_objectCount), m_interestObjectCount(rhs.m_interestObjectCount), m_interestCreatureObjectCount(rhs.m_interestCreatureObjectCount), @@ -38,7 +38,7 @@ GameServerData::GameServerData(const GameServerData &rhs) : // ---------------------------------------------------------------------- GameServerData::GameServerData() : - m_connection(nullptr), + m_connection(NULL), m_objectCount(0), m_interestObjectCount(0), m_interestCreatureObjectCount(0), @@ -53,7 +53,7 @@ GameServerData &GameServerData::operator=(const GameServerData &rhs) if (&rhs == this) return *this; - m_connection=nullptr; // connection pointer is not copied when we copy GameServerDatas + m_connection=NULL; // connection pointer is not copied when we copy GameServerDatas m_objectCount=rhs.m_objectCount; m_interestObjectCount=rhs.m_interestObjectCount; m_interestCreatureObjectCount=rhs.m_interestCreatureObjectCount; diff --git a/engine/server/application/PlanetServer/src/shared/PlanetProxyObject.cpp b/engine/server/application/PlanetServer/src/shared/PlanetProxyObject.cpp index b2d9cf79..0fff2eb7 100755 --- a/engine/server/application/PlanetServer/src/shared/PlanetProxyObject.cpp +++ b/engine/server/application/PlanetServer/src/shared/PlanetProxyObject.cpp @@ -41,9 +41,9 @@ PlanetProxyObject::PlanetProxyObject (const NetworkId &objectId) : m_authoritativeServer(0), m_lastReportedServer(0), m_interestRadius(0), - m_quadtreeNode(nullptr), + m_quadtreeNode(NULL), m_authTransferTimeMs(Clock::timeMs()), - m_contents(nullptr), + m_contents(NULL), m_level(0), m_hibernating(false), m_templateCrc(0), @@ -137,9 +137,9 @@ void PlanetProxyObject::update(int x, int y, int z, NetworkId containedBy, uint3 if (ConfigPlanetServer::getEnableContentsChecking() && (m_containedBy!=containedBy)) updateContentsTracking(containedBy); - bool const firstUpdate = (m_quadtreeNode == nullptr); + bool const firstUpdate = (m_quadtreeNode == NULL); - if (m_quadtreeNode!=nullptr) // if this is the first update for this object, m_quadtreeNode will be nullptr because it hasn't been placed anywhere yet + if (m_quadtreeNode!=NULL) // if this is the first update for this object, m_quadtreeNode will be NULL because it hasn't been placed anywhere yet { removeServerStatistics(); diff --git a/engine/server/application/PlanetServer/src/shared/PlanetServer.cpp b/engine/server/application/PlanetServer/src/shared/PlanetServer.cpp index a76929ce..d69a029c 100755 --- a/engine/server/application/PlanetServer/src/shared/PlanetServer.cpp +++ b/engine/server/application/PlanetServer/src/shared/PlanetServer.cpp @@ -102,12 +102,12 @@ using namespace PlanetServerNamespace; PlanetServer::PlanetServer() : Singleton(), MessageDispatch::Receiver(), - m_pendingCentralServerConnection(nullptr), - m_centralServerConnection(nullptr), - m_gameService(nullptr), - m_watcherService(nullptr), + m_pendingCentralServerConnection(NULL), + m_centralServerConnection(NULL), + m_gameService(NULL), + m_watcherService(NULL), m_gameServers(), - m_taskConnection(nullptr), + m_taskConnection(NULL), m_done(false), m_roundRobinGameServer(0), m_pendingServerStarts(new std::map()), @@ -117,7 +117,7 @@ PlanetServer::PlanetServer() : m_spaceMode(false), m_messagesWaitingForGameServer(), m_metricsData(0), - m_taskManagerConnection(nullptr), + m_taskManagerConnection(NULL), m_sceneTransferChunkLoads(new std::list), m_pendingCharacterSaves(new std::map), m_watchers(), @@ -433,7 +433,7 @@ void PlanetServer::receiveMessage(const MessageDispatch::Emitter & source, const GameServerConnection *gameServer=const_cast(dynamic_cast(&source)); std::set::iterator f = m_pendingGameServerDisconnects.find(gameServer); - WARNING_DEBUG_FATAL(gameServer==0,("Source was nullptr or source was not a GameServerConnection.")); + WARNING_DEBUG_FATAL(gameServer==0,("Source was NULL or source was not a GameServerConnection.")); DEBUG_REPORT_LOG(true, ("removing crashed gameserver\n")); uint32 id = gameServer->getProcessId(); GameServerMapType::iterator i=m_gameServers.find(id); @@ -688,7 +688,7 @@ void PlanetServer::receiveMessage(const MessageDispatch::Emitter & source, const UnloadedPlayerMessage msg(ri); GameServerConnection *gameServer=const_cast(dynamic_cast(&source)); - WARNING_DEBUG_FATAL(gameServer==0,("Source was nullptr or source was not a GameServerConnection.")); + WARNING_DEBUG_FATAL(gameServer==0,("Source was NULL or source was not a GameServerConnection.")); uint32 gameServerId = gameServer->getProcessId(); (*m_pendingCharacterSaves)[msg.getPlayerId()]=gameServerId; @@ -766,19 +766,19 @@ void PlanetServer::receiveMessage(const MessageDispatch::Emitter & source, const GameServerData * fromServer = PlanetServer::getGameServerData(msg.getFromProcess()); GameServerData * toServer = PlanetServer::getGameServerData(msg.getToProcess()); PlanetProxyObject * object = Scene::getInstance().findObjectByID(msg.getId()); - if (fromServer == nullptr || toServer == nullptr || object == nullptr) + if (fromServer == NULL || toServer == NULL || object == NULL) { - if (fromServer == nullptr) + if (fromServer == NULL) { WARNING(true, ("Message GameServerForceChangeAuthorityMessage: no " "from server %lu", msg.getFromProcess())); } - if (toServer == nullptr) + if (toServer == NULL) { WARNING(true, ("Message GameServerForceChangeAuthorityMessage: no " "to server %lu", msg.getToProcess())); } - if (object == nullptr) + if (object == NULL) { WARNING(true, ("Message GameServerForceChangeAuthorityMessage: no " "object for id %s", msg.getId().getValueString().c_str())); @@ -914,7 +914,7 @@ void PlanetServer::receiveMessage(const MessageDispatch::Emitter & source, const { // if it's been "awhile" since we requested to restart the GameServer, // then assume that something has gone wrong, and try the restart again - time_t const timeNow = ::time(nullptr); + time_t const timeNow = ::time(NULL); for (std::map >::iterator iter = m_startingGameServers->begin(); iter != m_startingGameServers->end(); ++iter) { @@ -1005,7 +1005,7 @@ GameServerConnection *PlanetServer::getGameServerConnection(uint32 serverId) if (i!=m_gameServers.end()) return (*i).second->getConnection(); else - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -1290,7 +1290,7 @@ void PlanetServer::startGameServer(const std::set & preloadServ TaskSpawnProcess spawn("any", "SwgGameServer", options, i->second); if (m_centralServerConnection) { - (*m_startingGameServers)[cookie] = std::make_pair(options, ::time(nullptr)); + (*m_startingGameServers)[cookie] = std::make_pair(options, ::time(NULL)); ++cookie; m_centralServerConnection->send(spawn,true); DEBUG_REPORT_LOG(true, ("Sent start gameserver request for scene %s\n", ConfigPlanetServer::getSceneID())); @@ -1321,7 +1321,7 @@ GameServerData *PlanetServer::getGameServerData(uint32 serverId) const if (i!=m_gameServers.end()) return i->second; else - return nullptr; + return NULL; } // ---------------------------------------------------------------------- diff --git a/engine/server/application/PlanetServer/src/shared/PlanetServer.h b/engine/server/application/PlanetServer/src/shared/PlanetServer.h index 7a75e4fc..cf457544 100755 --- a/engine/server/application/PlanetServer/src/shared/PlanetServer.h +++ b/engine/server/application/PlanetServer/src/shared/PlanetServer.h @@ -146,7 +146,7 @@ inline int PlanetServer::getNumberOfGameServers() const inline void PlanetServer::onCentralConnected(CentralServerConnection *connection) { - m_pendingCentralServerConnection=nullptr; + m_pendingCentralServerConnection=NULL; m_centralServerConnection=connection; } diff --git a/engine/server/application/PlanetServer/src/shared/PreloadManager.cpp b/engine/server/application/PlanetServer/src/shared/PreloadManager.cpp index 15811eeb..37371536 100755 --- a/engine/server/application/PlanetServer/src/shared/PreloadManager.cpp +++ b/engine/server/application/PlanetServer/src/shared/PreloadManager.cpp @@ -119,7 +119,7 @@ void PreloadManager::handlePreloadList() if (PlanetServer::getInstance().getEnablePreload()) { DataTable * data = DataTableManager::getTable(ConfigPlanetServer::getPreloadDataTableName(),true); - FATAL(data==nullptr,("Could not find data table %s, needed for preload",ConfigPlanetServer::getPreloadDataTableName())); + FATAL(data==NULL,("Could not find data table %s, needed for preload",ConfigPlanetServer::getPreloadDataTableName())); int numRows = data->getNumRows(); for (int row=0; row(&source); - WARNING_DEBUG_FATAL(gameServer==0,("Source was nullptr or source was not a GameServerConnection.")); + WARNING_DEBUG_FATAL(gameServer==0,("Source was NULL or source was not a GameServerConnection.")); if (message.isType("GameConnectionClosed")) { @@ -216,7 +216,7 @@ Node *Scene::findNodeByPosition(int x, int z) /** * Given coordinates, return a const pointer to the node that encloses - * those coordinates. Will not create new nodes, so it may return nullptr. + * those coordinates. Will not create new nodes, so it may return NULL. */ const Node *Scene::findNodeByPositionConst(int x, int z) const { @@ -245,7 +245,7 @@ Node *Scene::findNodeByRoundedPosition(int x, int z) /** * Given coordinates that are known to be a node boundary, return a const pointer - * to the node. Does not create new nodes, so may return nullptr. + * to the node. Does not create new nodes, so may return NULL. */ const Node *Scene::findNodeByRoundedPositionConst(int x, int z) const { @@ -254,7 +254,7 @@ const Node *Scene::findNodeByRoundedPositionConst(int x, int z) const if (i!=m_nodeMap.end()) return (*i).second; else - return nullptr; + return NULL; } // ---------------------------------------------------------------------- diff --git a/engine/server/application/StationPlayersCollector/src/linux/main.cpp b/engine/server/application/StationPlayersCollector/src/linux/main.cpp index d2abdabf..7112ccde 100755 --- a/engine/server/application/StationPlayersCollector/src/linux/main.cpp +++ b/engine/server/application/StationPlayersCollector/src/linux/main.cpp @@ -35,7 +35,7 @@ int main(int argc, char ** argv) SetupSharedFile::install(false); SetupSharedNetworkMessages::install(); - SetupSharedRandom::install(static_cast(time(nullptr))); //lint !e1924 !e64 // nullptr is a C-Style cast? + SetupSharedRandom::install(static_cast(time(NULL))); //lint !e1924 !e64 // NULL is a C-Style cast? Os::setProgramName("StationPlayersCollector"); diff --git a/engine/server/application/TaskManager/src/linux/ConsoleInput.cpp b/engine/server/application/TaskManager/src/linux/ConsoleInput.cpp index 756bd237..a0d4580c 100755 --- a/engine/server/application/TaskManager/src/linux/ConsoleInput.cpp +++ b/engine/server/application/TaskManager/src/linux/ConsoleInput.cpp @@ -22,7 +22,7 @@ struct SetBufferMode SetBufferMode::SetBufferMode() { - setvbuf(stdin, nullptr, _IONBF, 0); + setvbuf(stdin, NULL, _IONBF, 0); } //----------------------------------------------------------------------- diff --git a/engine/server/application/TaskManager/src/linux/ProcessSpawner.cpp b/engine/server/application/TaskManager/src/linux/ProcessSpawner.cpp index e63ffd6b..3996480b 100755 --- a/engine/server/application/TaskManager/src/linux/ProcessSpawner.cpp +++ b/engine/server/application/TaskManager/src/linux/ProcessSpawner.cpp @@ -92,7 +92,7 @@ void makeParameters(const std::vector & parameters, std::vector(time(nullptr))); //lint !e1924 !e64 // nullptr is a C-Style cast? + SetupSharedRandom::install(static_cast(time(NULL))); //lint !e1924 !e64 // NULL is a C-Style cast? Os::setProgramName("TaskManager"); //setup the server diff --git a/engine/server/application/TaskManager/src/shared/GameConnection.cpp b/engine/server/application/TaskManager/src/shared/GameConnection.cpp index baa6adfb..d297a6dd 100755 --- a/engine/server/application/TaskManager/src/shared/GameConnection.cpp +++ b/engine/server/application/TaskManager/src/shared/GameConnection.cpp @@ -89,7 +89,7 @@ void GameConnection::receive(const Archive::ByteStream & message) char filename[30]; snprintf(filename, sizeof(filename)-1, "/proc/%lu/cmdline", m_pid); - // format of the cmdline file is a nullptr separates every + // format of the cmdline file is a NULL separates every // parameter, so we'll have to replace the NULLs with spaces FILE *inFile = fopen(filename,"rb"); if (inFile) diff --git a/engine/server/application/TaskManager/src/shared/Locator.cpp b/engine/server/application/TaskManager/src/shared/Locator.cpp index 2dac97f8..994d2184 100755 --- a/engine/server/application/TaskManager/src/shared/Locator.cpp +++ b/engine/server/application/TaskManager/src/shared/Locator.cpp @@ -25,11 +25,11 @@ namespace LocatorNamespace float getConfigSetting(const char *section, const char *key, const float defaultValue) { const ConfigFile::Section * sec = ConfigFile::getSection(section); - if (sec == nullptr) + if (sec == NULL) return defaultValue; const ConfigFile::Key * ky = sec->findKey(key); - if (ky == nullptr) + if (ky == NULL) return defaultValue; return ky->getAsFloat(ky->getCount()-1, defaultValue); @@ -364,7 +364,7 @@ void Locator::opened(std::string const &label, ManagerConnection *newConnection) TaskManager::runSpawnRequestQueue(); } else - WARNING_STRICT_FATAL(true, ("Passed nullptr connection to Locator::opened")); + WARNING_STRICT_FATAL(true, ("Passed null connection to Locator::opened")); } // ---------------------------------------------------------------------- diff --git a/engine/server/application/TaskManager/src/shared/ManagerConnection.cpp b/engine/server/application/TaskManager/src/shared/ManagerConnection.cpp index 08807765..3720de92 100755 --- a/engine/server/application/TaskManager/src/shared/ManagerConnection.cpp +++ b/engine/server/application/TaskManager/src/shared/ManagerConnection.cpp @@ -98,7 +98,7 @@ void ManagerConnection::onReceive(const Archive::ByteStream & message) r = message.begin(); if (m.isType("SystemTimeCheck")) { - long const currentTime = static_cast(::time(nullptr)); + long const currentTime = static_cast(::time(NULL)); GenericValueTypeMessage > msg(r); if (TaskManager::getNodeLabel() == "node0") @@ -117,7 +117,7 @@ void ManagerConnection::onReceive(const Archive::ByteStream & message) else if (m.isType("TaskConnectionIdMessage")) { static long const clockDriftFatalTimePeriod = static_cast(TaskManager::getStartTime()) + ConfigTaskManager::getClockDriftFatalIntervalSeconds(); - long const currentTime = static_cast(::time(nullptr)); + long const currentTime = static_cast(::time(NULL)); TaskConnectionIdMessage t(r); WARNING_STRICT_FATAL(t.getServerType() != TaskConnectionIdMessage::TaskManager, ("ManagerConnection received wrong type identifier")); diff --git a/engine/server/application/TaskManager/src/shared/TaskManager.cpp b/engine/server/application/TaskManager/src/shared/TaskManager.cpp index 04550a81..192ab1a3 100755 --- a/engine/server/application/TaskManager/src/shared/TaskManager.cpp +++ b/engine/server/application/TaskManager/src/shared/TaskManager.cpp @@ -161,7 +161,7 @@ m_processEntries(), m_localServers(), m_remoteServers(), m_nodeLabel(), -m_startTime(::time(nullptr)), +m_startTime(::time(NULL)), m_nodeList(), m_nodeNumber(-1), m_nodeToConnectToList(), @@ -362,7 +362,7 @@ void TaskManager::processRcFile() void TaskManager::setupNodeList() { char buffer[64]; - const char* result = nullptr; + const char* result = NULL; int nodeIndex = 0; bool found = true; @@ -375,7 +375,7 @@ void TaskManager::setupNodeList() { found = false; sprintf(buffer, "node%d", nodeIndex); - result = ConfigFile::getKeyString("TaskManager", buffer, nullptr); + result = ConfigFile::getKeyString("TaskManager", buffer, NULL); if (result) { NodeEntry n(result, buffer, nodeIndex); @@ -967,8 +967,8 @@ void TaskManager::update() // of slave TaskManager that has disconnected but has not reconnected, // so that an alert can be made in SOEMon so ops can see it and restart // the disconnected TaskManager - static time_t timeSystemTimeCheck = ::time(nullptr) + ConfigTaskManager::getSystemTimeCheckIntervalSeconds(); - time_t const timeNow = ::time(nullptr); + static time_t timeSystemTimeCheck = ::time(NULL) + ConfigTaskManager::getSystemTimeCheckIntervalSeconds(); + time_t const timeNow = ::time(NULL); if (timeSystemTimeCheck <= timeNow) { if (getNodeLabel() != "node0") diff --git a/engine/server/application/TransferServer/src/shared/CTSAPIClient.cpp b/engine/server/application/TransferServer/src/shared/CTSAPIClient.cpp index ca5d0845..6d456516 100755 --- a/engine/server/application/TransferServer/src/shared/CTSAPIClient.cpp +++ b/engine/server/application/TransferServer/src/shared/CTSAPIClient.cpp @@ -147,7 +147,7 @@ void CTSAPIClient::onRequestMove(const unsigned server_track, const char *langua { LOG("CTSAPI", ("Received a transfer request for station ID %d, but a transfer for that id is already in progress", uid)); const unsigned int result = static_cast(CTService::CT_GAMERESULT_SOFTERROR); - IGNORE_RETURN(replyMove(server_track, result, nullptr, nullptr)); + IGNORE_RETURN(replyMove(server_track, result, NULL, NULL)); } } @@ -165,7 +165,7 @@ void CTSAPIClient::onRequestTransferAccount(const unsigned server_track, const u { LOG("CTSAPI", ("Received a transfer request for station ID %d, but a transfer for that id is already in progress", uid)); const unsigned int result = static_cast(CTService::CT_GAMERESULT_SOFTERROR); - IGNORE_RETURN(replyTransferAccount(server_track, result, nullptr, nullptr)); + IGNORE_RETURN(replyTransferAccount(server_track, result, NULL, NULL)); } } @@ -197,12 +197,12 @@ void CTSAPIClient::onRequestServerList(const unsigned server_track, const char * if(! servers.empty()) { const unsigned int result = static_cast(CTService::CT_RESULT_SUCCESS); - IGNORE_RETURN(replyServerList(server_track, result, servers.size(), &servers[0], nullptr)); + IGNORE_RETURN(replyServerList(server_track, result, servers.size(), &servers[0], NULL)); } else { const unsigned int result = static_cast(CTService::CT_RESULT_FAILURE); - IGNORE_RETURN(replyServerList(server_track, result, servers.size(), nullptr, nullptr)); + IGNORE_RETURN(replyServerList(server_track, result, servers.size(), NULL, NULL)); } } @@ -226,12 +226,12 @@ void CTSAPIClient::onRequestDestinationServerList(const unsigned server_track, c if(! servers.empty()) { const unsigned int result = static_cast(CTService::CT_RESULT_SUCCESS); - IGNORE_RETURN(replyDestinationServerList(server_track, result, servers.size(), &servers[0], nullptr)); + IGNORE_RETURN(replyDestinationServerList(server_track, result, servers.size(), &servers[0], NULL)); } else { const unsigned int result = static_cast(CTService::CT_RESULT_FAILURE); - IGNORE_RETURN(replyDestinationServerList(server_track, result, servers.size(), nullptr, nullptr)); + IGNORE_RETURN(replyDestinationServerList(server_track, result, servers.size(), NULL, NULL)); } } @@ -260,7 +260,7 @@ void CTSAPIClient::moveStart(unsigned int stationId, unsigned int track, const C std::map::iterator f = s_completedTransfers.find(track); if(f != s_completedTransfers.end()) { - IGNORE_RETURN(replyMove(track, f->second, nullptr, nullptr)); + IGNORE_RETURN(replyMove(track, f->second, NULL, NULL)); } else { @@ -284,7 +284,7 @@ void CTSAPIClient::lostCentralServerConnection(const CentralServerConnection * c { if(i->second.m_sourceCentralServerConnection == centralServerConnection || i->second.m_destinationCentralServerConnection == centralServerConnection) { - IGNORE_RETURN(replyMove(i->second.m_track, result, nullptr, nullptr)); + IGNORE_RETURN(replyMove(i->second.m_track, result, NULL, NULL)); s_activeTransfers.erase(i++); } else diff --git a/engine/server/application/TransferServer/src/shared/ConsoleManager.cpp b/engine/server/application/TransferServer/src/shared/ConsoleManager.cpp index 1a04dc38..c0208e0d 100755 --- a/engine/server/application/TransferServer/src/shared/ConsoleManager.cpp +++ b/engine/server/application/TransferServer/src/shared/ConsoleManager.cpp @@ -14,7 +14,7 @@ namespace ConsoleManagerNamespace { - ConsoleCommandParser * s_consoleCommandParserRoot = nullptr; + ConsoleCommandParser * s_consoleCommandParserRoot = NULL; } using namespace ConsoleManagerNamespace; diff --git a/engine/server/application/TransferServer/src/shared/TransferServer.cpp b/engine/server/application/TransferServer/src/shared/TransferServer.cpp index 6533fd3e..07334ab4 100755 --- a/engine/server/application/TransferServer/src/shared/TransferServer.cpp +++ b/engine/server/application/TransferServer/src/shared/TransferServer.cpp @@ -150,10 +150,10 @@ namespace TransferServerNamespace if(s_apiClient) { const std::string resultString = resultToString(resultCode); - LOG("CustomerService", ("CharacterTransfer: transactionId=%u replyMove(%u, %s, nullptr, nullptr)", reply.getTransactionId(), reply.getTrack(), resultString.c_str())); + LOG("CustomerService", ("CharacterTransfer: transactionId=%u replyMove(%u, %s, NULL, NULL)", reply.getTransactionId(), reply.getTrack(), resultString.c_str())); const unsigned int result = static_cast(resultCode); s_apiClient->moveComplete(reply.getSourceStationId(), reply.getTrack(), result); - IGNORE_RETURN(s_apiClient->replyMove(reply.getTrack(), result, Unicode::narrowToWide(resultString).c_str(), nullptr)); + IGNORE_RETURN(s_apiClient->replyMove(reply.getTrack(), result, Unicode::narrowToWide(resultString).c_str(), NULL)); } } @@ -282,7 +282,7 @@ void TransferServer::requestCharacterList(unsigned int track, unsigned int stati { const unsigned int result = static_cast(CTService::CT_RESULT_FAILURE); - IGNORE_RETURN(s_apiClient->replyCharacterList(track, result, 0, nullptr, nullptr)); + IGNORE_RETURN(s_apiClient->replyCharacterList(track, result, 0, NULL, NULL)); s_apiClient->moveComplete(stationId, track, result); } } @@ -410,7 +410,7 @@ void TransferServer::requestTransferAccount(unsigned int track, unsigned int sou if(s_apiClient) { const unsigned int result = static_cast(CTService::CT_GAMERESULT_HARDERROR); - IGNORE_RETURN(s_apiClient->replyValidateMove(track, result, nullptr, nullptr, nullptr)); + IGNORE_RETURN(s_apiClient->replyValidateMove(track, result, NULL, NULL, NULL)); s_apiClient->moveComplete(sourceStationId, track, result); } @@ -430,7 +430,7 @@ void TransferServer::requestTransferAccount(unsigned int track, unsigned int sou if(s_apiClient) { const unsigned int result = static_cast(CTService::CT_GAMERESULT_SERVER_IS_DOWN); - IGNORE_RETURN(s_apiClient->replyTransferAccount(track, result, nullptr, nullptr)); + IGNORE_RETURN(s_apiClient->replyTransferAccount(track, result, NULL, NULL)); s_apiClient->moveComplete(sourceStationId, track, result); } @@ -442,12 +442,12 @@ void TransferServer::requestTransferAccount(unsigned int track, unsigned int sou if(destinationStationId == 0 || sourceStationId == 0) { - LOG("CustomerService", ("CharacterTransfer: Account move request made with a nullptr destination station id: or source station id: %lu\n", sourceStationId)); + LOG("CustomerService", ("CharacterTransfer: Account move request made with a null destination station id: or source station id: %lu\n", sourceStationId)); if(s_apiClient) { const unsigned int result = static_cast(CTService::CT_GAMERESULT_HARDERROR); - IGNORE_RETURN(s_apiClient->replyTransferAccount(track, result, nullptr, nullptr)); + IGNORE_RETURN(s_apiClient->replyTransferAccount(track, result, NULL, NULL)); s_apiClient->moveComplete(sourceStationId, track, result); } @@ -488,7 +488,7 @@ void TransferServer::requestMoveValidation(unsigned int track, unsigned int sour if(s_apiClient) { const unsigned int result = static_cast(CTService::CT_GAMERESULT_HARDERROR); - IGNORE_RETURN(s_apiClient->replyValidateMove(track, result, nullptr, nullptr, nullptr)); + IGNORE_RETURN(s_apiClient->replyValidateMove(track, result, NULL, NULL, NULL)); s_apiClient->moveComplete(sourceStationId, track, result); } } @@ -516,7 +516,7 @@ void TransferServer::requestMoveValidation(unsigned int track, unsigned int sour if(s_apiClient) { const unsigned int result = static_cast(CTService::CT_GAMERESULT_SERVER_IS_DOWN); - IGNORE_RETURN(s_apiClient->replyValidateMove(track, result, nullptr, nullptr, nullptr)); + IGNORE_RETURN(s_apiClient->replyValidateMove(track, result, NULL, NULL, NULL)); s_apiClient->moveComplete(sourceStationId, track, result); } } @@ -651,8 +651,8 @@ void TransferServer::replyCharacterList(const TransferReplyCharacterList & reply result = static_cast(CTService::CT_RESULT_FAILURE); s_apiClient->moveComplete(reply.getStationId(), reply.getTrack(), result); } - LOG("CTSAPI", ("invoking CTServiceAPI::replyCharacterList(%d, %d, %d, characters, nullptr)", reply.getTrack(), result, chars.size())); - IGNORE_RETURN(s_apiClient->replyCharacterList(reply.getTrack(), result, reply.getAvatarList().size(), characters, nullptr)); + LOG("CTSAPI", ("invoking CTServiceAPI::replyCharacterList(%d, %d, %d, characters, NULL)", reply.getTrack(), result, chars.size())); + IGNORE_RETURN(s_apiClient->replyCharacterList(reply.getTrack(), result, reply.getAvatarList().size(), characters, NULL)); } // else use another interface if available } @@ -675,7 +675,7 @@ void TransferServer::replyValidateMove(const TransferCharacterData & reply) { LOG("CustomerService", ("CharacterTransfer: replyValidateMove passed name validation for %s", reply.toString().c_str())); } - IGNORE_RETURN(s_apiClient->replyValidateMove(reply.getTrack(), result, nullptr, nullptr, nullptr)); + IGNORE_RETURN(s_apiClient->replyValidateMove(reply.getTrack(), result, NULL, NULL, NULL)); s_apiClient->moveComplete(reply.getSourceStationId(), reply.getTrack(), result); } } @@ -736,7 +736,7 @@ void TransferServer::replyTransferAccountSuccess(const TransferAccountData & rep LOG("CustomerService", ("CharacterTransfer: Could not transfer chat avatars for character %s on cluster %s from %lu to %lu: central connection does not exist in transferserver", i->second.c_str(), i->first.c_str(), reply.getSourceStationId(), reply.getDestinationStationId())); const unsigned int result = static_cast(CTService::CT_GAMERESULT_HARDERROR); s_apiClient->moveComplete(reply.getSourceStationId(), reply.getTrack(), result); - IGNORE_RETURN(s_apiClient->replyTransferAccount(reply.getTrack(), result, nullptr, nullptr)); + IGNORE_RETURN(s_apiClient->replyTransferAccount(reply.getTrack(), result, NULL, NULL)); } } } @@ -748,7 +748,7 @@ void TransferServer::replyTransferAccountSuccess(const TransferAccountData & rep if(s_apiClient) { const unsigned int result = static_cast(CTService::CT_GAMERESULT_SUCCESS); - IGNORE_RETURN(s_apiClient->replyTransferAccount(reply.getTrack(), result, nullptr, nullptr)); + IGNORE_RETURN(s_apiClient->replyTransferAccount(reply.getTrack(), result, NULL, NULL)); s_apiClient->moveComplete(reply.getSourceStationId(), reply.getTrack(), result); } } @@ -808,7 +808,7 @@ void TransferServer::failedToTransferAccountNoCentralConnection(const TransferAc LOG("CustomerService", ("CharacterTransfer: Transfer failed: Could not connect to central server to update game database. Sending HARD ERROR to CTS API. %s", failed.toString().c_str())); const unsigned int result = static_cast(CTService::CT_GAMERESULT_HARDERROR); s_apiClient->moveComplete(failed.getSourceStationId(), failed.getTrack(), result); - IGNORE_RETURN(s_apiClient->replyTransferAccount(failed.getTrack(), result, nullptr, nullptr)); + IGNORE_RETURN(s_apiClient->replyTransferAccount(failed.getTrack(), result, NULL, NULL)); } } @@ -821,7 +821,7 @@ void TransferServer::failedToTransferAccountDestinationNotEmpty (const TransferA LOG("CustomerService", ("CharacterTransfer: Transfer failed: Destination stationId has avatars. Sending HARD ERROR to CTS API. %s", failed.toString().c_str())); const unsigned int result = static_cast(CTService::CT_GAMERESULT_HARDERROR); s_apiClient->moveComplete(failed.getSourceStationId(), failed.getTrack(), result); - IGNORE_RETURN(s_apiClient->replyTransferAccount(failed.getTrack(), result, nullptr, nullptr)); + IGNORE_RETURN(s_apiClient->replyTransferAccount(failed.getTrack(), result, NULL, NULL)); } } @@ -860,7 +860,7 @@ void TransferServer::failedToValidateTransfer(const TransferReplyMoveValidation { const unsigned int result = ((reply.getResult() == TransferReplyMoveValidation::TRMVR_cannot_create_regular_character) ? static_cast(CTService::CT_GAMERESULT_MAX_CHAR_ON_DEST_SERVER) : static_cast(CTService::CT_GAMERESULT_SERVER_IS_DOWN)); - IGNORE_RETURN(s_apiClient->replyValidateMove(reply.getTrack(), result, nullptr, nullptr, nullptr)); + IGNORE_RETURN(s_apiClient->replyValidateMove(reply.getTrack(), result, NULL, NULL, NULL)); s_apiClient->moveComplete(reply.getSourceStationId(), reply.getTrack(), result); // close pseudoclientconnections diff --git a/engine/server/library/serverDatabase/src/shared/ConsoleManager.cpp b/engine/server/library/serverDatabase/src/shared/ConsoleManager.cpp index 70f8342d..4e24a67e 100755 --- a/engine/server/library/serverDatabase/src/shared/ConsoleManager.cpp +++ b/engine/server/library/serverDatabase/src/shared/ConsoleManager.cpp @@ -14,7 +14,7 @@ namespace ConsoleManagerNamespace { - ConsoleCommandParser * s_consoleCommandParserRoot = nullptr; + ConsoleCommandParser * s_consoleCommandParserRoot = NULL; } using namespace ConsoleManagerNamespace; diff --git a/engine/server/library/serverDatabase/src/shared/DataLookup.cpp b/engine/server/library/serverDatabase/src/shared/DataLookup.cpp index 33fef53a..dd42952a 100755 --- a/engine/server/library/serverDatabase/src/shared/DataLookup.cpp +++ b/engine/server/library/serverDatabase/src/shared/DataLookup.cpp @@ -30,7 +30,7 @@ //----------------------------------------------------------------------- -DataLookup *DataLookup::ms_theInstance = nullptr; +DataLookup *DataLookup::ms_theInstance = NULL; //----------------------------------------------------------------------- @@ -524,7 +524,7 @@ void DataLookup::deleteReservationList(uint32 stationId) reservationList * rl = rlIter->second; if (!rl) { - WARNING_STRICT_FATAL(true, ("Reservation list for stationID %lu is nullptr", stationId)); + WARNING_STRICT_FATAL(true, ("Reservation list for stationID %lu is NULL", stationId)); return; } reservationList::iterator i; diff --git a/engine/server/library/serverDatabase/src/shared/DatabaseProcess.cpp b/engine/server/library/serverDatabase/src/shared/DatabaseProcess.cpp index fb5a56fe..1c0eca40 100755 --- a/engine/server/library/serverDatabase/src/shared/DatabaseProcess.cpp +++ b/engine/server/library/serverDatabase/src/shared/DatabaseProcess.cpp @@ -46,7 +46,7 @@ // ---------------------------------------------------------------------- -DatabaseProcess *DatabaseProcess::ms_theInstance = nullptr; +DatabaseProcess *DatabaseProcess::ms_theInstance = NULL; // ---------------------------------------------------------------------- @@ -627,7 +627,7 @@ void DatabaseProcess::sendToCommoditiesServer(GameNetworkMessage const &message, commoditiesConnection->send(message,reliable); } else - DEBUG_REPORT_LOG(true, ("commoditiesConnection is nullptr\n")); + DEBUG_REPORT_LOG(true, ("commoditiesConnection is NULL\n")); } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverDatabase/src/shared/ImmediateDeleteCustomPersistStep.cpp b/engine/server/library/serverDatabase/src/shared/ImmediateDeleteCustomPersistStep.cpp index c205c79d..e1c3d149 100755 --- a/engine/server/library/serverDatabase/src/shared/ImmediateDeleteCustomPersistStep.cpp +++ b/engine/server/library/serverDatabase/src/shared/ImmediateDeleteCustomPersistStep.cpp @@ -23,7 +23,7 @@ ImmediateDeleteCustomPersistStep::ImmediateDeleteCustomPersistStep() : ImmediateDeleteCustomPersistStep::~ImmediateDeleteCustomPersistStep() { delete m_objects; - m_objects = nullptr; + m_objects = NULL; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverDatabase/src/shared/LazyDeleter.cpp b/engine/server/library/serverDatabase/src/shared/LazyDeleter.cpp index ecdc4260..16baa713 100755 --- a/engine/server/library/serverDatabase/src/shared/LazyDeleter.cpp +++ b/engine/server/library/serverDatabase/src/shared/LazyDeleter.cpp @@ -27,7 +27,7 @@ // ====================================================================== -LazyDeleter * LazyDeleter::ms_instance=nullptr; +LazyDeleter * LazyDeleter::ms_instance=NULL; // ====================================================================== @@ -80,13 +80,13 @@ void LazyDeleter::remove() { NOT_NULL(ms_instance); delete ms_instance; - ms_instance = nullptr; + ms_instance = NULL; } // ---------------------------------------------------------------------- LazyDeleter::LazyDeleter() : - m_workerThread(nullptr), // Avoid starting the worker thread until the other member variables are initialized + m_workerThread(NULL), // Avoid starting the worker thread until the other member variables are initialized m_incomingObjects(new std::vector), m_objectsToDelete(new std::deque), m_objectListLock(new Mutex), @@ -113,11 +113,11 @@ LazyDeleter::~LazyDeleter() delete m_objectsToDelete; delete m_objectListLock; - m_workerThread = nullptr; - m_incomingObjects = nullptr; - m_objectsToDelete = nullptr; - m_objectListLock = nullptr; - m_session = nullptr; + m_workerThread = NULL; + m_incomingObjects = NULL; + m_objectsToDelete = NULL; + m_objectListLock = NULL; + m_session = NULL; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverDatabase/src/shared/Loader.cpp b/engine/server/library/serverDatabase/src/shared/Loader.cpp index 3f863d80..fb4b5a6c 100755 --- a/engine/server/library/serverDatabase/src/shared/Loader.cpp +++ b/engine/server/library/serverDatabase/src/shared/Loader.cpp @@ -55,7 +55,7 @@ // ====================================================================== -Loader *Loader::ms_instance = nullptr; +Loader *Loader::ms_instance = NULL; // ====================================================================== @@ -72,7 +72,7 @@ void Loader::remove() { NOT_NULL(ms_instance); delete ms_instance; - ms_instance = nullptr; + ms_instance = NULL; } // ---------------------------------------------------------------------- @@ -442,7 +442,7 @@ void Loader::receiveMessage(const MessageDispatch::Emitter & source, const Messa { Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); ValidateCharacterForLoginMessage msg(ri); - verifyCharacter(msg.getSuid(), msg.getCharacterId(), nullptr); + verifyCharacter(msg.getSuid(), msg.getCharacterId(), NULL); } else if(message.isType("TransferGetLoginLocationData")) { @@ -647,7 +647,7 @@ void Loader::checkVersionNumber(int expectedVersion, bool fatalOnMismatch) void Loader::requestChunk(uint32 processId,int nodeX, int nodeZ, const std::string &sceneId) { ObjectLocator * const regularLocator=new ChunkLocator(nodeX, nodeZ, sceneId, processId, true); - ObjectLocator * goldLocator=nullptr; + ObjectLocator * goldLocator=NULL; if (ConfigServerDatabase::getEnableGoldDatabase()) goldLocator = new ChunkLocator(nodeX, nodeZ, sceneId, processId, false); addLocatorsForServer(processId, regularLocator, goldLocator); @@ -671,7 +671,7 @@ void Loader::requestCharacter(const NetworkId &characterId, uint32 gameServerId) i=m_multipleLoginLock.find(characterId); if (i==m_multipleLoginLock.end()) { - addLocatorsForServer(gameServerId, new CharacterLocator(characterId), nullptr); + addLocatorsForServer(gameServerId, new CharacterLocator(characterId), NULL); DEBUG_REPORT_LOG(true,("Adding multipleLoginLock for %s\n",characterId.getValueString().c_str())); m_multipleLoginLock[characterId] = gameServerId; @@ -684,7 +684,7 @@ void Loader::requestCharacter(const NetworkId &characterId, uint32 gameServerId) } } else - addLocatorsForServer(gameServerId, new CharacterLocator(characterId), nullptr); + addLocatorsForServer(gameServerId, new CharacterLocator(characterId), NULL); } // ---------------------------------------------------------------------- @@ -692,7 +692,7 @@ void Loader::requestCharacter(const NetworkId &characterId, uint32 gameServerId) void Loader::loadContainedObject(const NetworkId &containerId, const NetworkId &objectId, uint32 gameServerId) { LOG("AuctionRetrieval", ("Loader::received loadContainedObject for loading object %s for retrieval", objectId.getValueString().c_str())); - addLocatorsForServer(gameServerId, new ContainedObjectLocator(containerId,objectId), nullptr); + addLocatorsForServer(gameServerId, new ContainedObjectLocator(containerId,objectId), NULL); } @@ -700,7 +700,7 @@ void Loader::loadContainedObject(const NetworkId &containerId, const NetworkId & void Loader::loadContents(const NetworkId &containerId, uint32 gameServerId) { - addLocatorsForServer(gameServerId, new ContentsLocator(containerId), nullptr); + addLocatorsForServer(gameServerId, new ContentsLocator(containerId), NULL); } // ---------------------------------------------------------------------- @@ -820,7 +820,7 @@ void Loader::removeLoadLock(const NetworkId &characterId) if (i->second!=0) { DEBUG_REPORT_LOG(true,("Now handling delayed login request for character %s\n",characterId.getValueString().c_str())); - addLocatorsForServer(i->second, new CharacterLocator(characterId), nullptr); + addLocatorsForServer(i->second, new CharacterLocator(characterId), NULL); } m_loadLock.erase(i); diff --git a/engine/server/library/serverDatabase/src/shared/MessageToManager.cpp b/engine/server/library/serverDatabase/src/shared/MessageToManager.cpp index d47dc773..6773ccca 100755 --- a/engine/server/library/serverDatabase/src/shared/MessageToManager.cpp +++ b/engine/server/library/serverDatabase/src/shared/MessageToManager.cpp @@ -16,7 +16,7 @@ // ====================================================================== -MessageToManager *MessageToManager::ms_instance=nullptr; +MessageToManager *MessageToManager::ms_instance=NULL; // ====================================================================== @@ -34,7 +34,7 @@ void MessageToManager::remove() { NOT_NULL(ms_instance); delete ms_instance; - ms_instance = nullptr; + ms_instance = NULL; } // ---------------------------------------------------------------------- @@ -51,7 +51,7 @@ MessageToManager::~MessageToManager() for (MessagesByObjectType::iterator i=m_messagesByObject.begin(); i!=m_messagesByObject.end(); ++i) { delete i->second; - i->second=nullptr; + i->second=NULL; } } @@ -71,7 +71,7 @@ void MessageToManager::handleMessageTo(const MessageToPayload &data) { DEBUG_WARNING(true,("Received message %s twice.",data.getMessageId().getValueString().c_str())); delete i->second; - i->second = nullptr; + i->second = NULL; } m_messagesByObject[theKey]=new MessageToPayload(data); @@ -127,7 +127,7 @@ void MessageToManager::removeMessage(const MessageToId &messageId) if (j!=m_messagesByObject.end()) { delete j->second; - j->second=nullptr; + j->second=NULL; m_messagesByObject.erase(j); } m_messageToObjectMap.erase(i); diff --git a/engine/server/library/serverDatabase/src/shared/Persister.cpp b/engine/server/library/serverDatabase/src/shared/Persister.cpp index bf178daa..89c299ff 100755 --- a/engine/server/library/serverDatabase/src/shared/Persister.cpp +++ b/engine/server/library/serverDatabase/src/shared/Persister.cpp @@ -70,7 +70,7 @@ // ====================================================================== -Persister *Persister::ms_instance=nullptr; +Persister *Persister::ms_instance=NULL; // ====================================================================== @@ -88,7 +88,7 @@ void Persister::remove() { NOT_NULL(ms_instance); delete ms_instance; - ms_instance = nullptr; + ms_instance = NULL; } //----------------------------------------------------------------------- @@ -108,9 +108,9 @@ Persister::Persister() : m_charactersToDeleteThisSaveCycle(new CharactersToDeleteType), m_charactersToDeleteNextSaveCycle(new CharactersToDeleteType), m_timeSinceLastSave(0), - m_messageSnapshot(nullptr), - m_commoditiesSnapshot(nullptr), - m_arbitraryGameDataSnapshot(nullptr), + m_messageSnapshot(NULL), + m_commoditiesSnapshot(NULL), + m_arbitraryGameDataSnapshot(NULL), m_saveStartTime(0), m_totalSaveTime(0), m_maxSaveTime(0), @@ -181,15 +181,15 @@ Persister::~Persister() m_currentSnapshots.clear(); m_newObjectSnapshots.clear(); m_objectSnapshotMap.clear(); - m_messageSnapshot = nullptr; - m_commoditiesSnapshot = nullptr; - m_arbitraryGameDataSnapshot = nullptr; + m_messageSnapshot = NULL; + m_commoditiesSnapshot = NULL; + m_arbitraryGameDataSnapshot = NULL; delete m_charactersToDeleteThisSaveCycle; - m_charactersToDeleteThisSaveCycle = nullptr; + m_charactersToDeleteThisSaveCycle = NULL; delete m_charactersToDeleteNextSaveCycle; - m_charactersToDeleteNextSaveCycle = nullptr; + m_charactersToDeleteNextSaveCycle = NULL; } // ---------------------------------------------------------------------- @@ -283,7 +283,7 @@ void Persister::onFrameBarrierReached() /** * Moves the current & new object snapshots onto the queue to be saved. * - * Does nothing if these snapshots are nullptr. + * Does nothing if these snapshots are null. */ void Persister::startSave(void) @@ -351,9 +351,9 @@ void Persister::startSave(void) m_currentSnapshots.clear(); m_newObjectSnapshots.clear(); m_objectSnapshotMap.clear(); - m_messageSnapshot = nullptr; - m_commoditiesSnapshot = nullptr; - m_arbitraryGameDataSnapshot = nullptr; + m_messageSnapshot = NULL; + m_commoditiesSnapshot = NULL; + m_arbitraryGameDataSnapshot = NULL; // prepare the list of characters to delete during the next save cycle if (m_charactersToDeleteNextSaveCycle && m_charactersToDeleteThisSaveCycle) @@ -515,7 +515,7 @@ void Persister::newObject(uint32 serverId, const NetworkId &objectId, int templa return; } - Snapshot *snap=nullptr; + Snapshot *snap=NULL; PendingCharactersType::iterator chardata=m_pendingCharacters.find(objectId); if (chardata!=m_pendingCharacters.end()) @@ -543,7 +543,7 @@ void Persister::newObject(uint32 serverId, const NetworkId &objectId, int templa else { // Add the object to the appropriate snapshot - snap=nullptr; + snap=NULL; { ObjectSnapshotMap::const_iterator j=m_objectSnapshotMap.find(container); if (j!=m_objectSnapshotMap.end() && j->second->getMode() == DB::ModeQuery::mode_INSERT) @@ -728,7 +728,7 @@ void Persister::receiveMessage(const MessageDispatch::Emitter & source, const Me Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); RenameCharacterMessageEx msg(ri); - renameCharacter(sourceGameServer, static_cast(msg.getRenameCharacterMessageSource()), msg.getStationId(), msg.getCharacterId(), msg.getNewName(), msg.getOldName(), msg.getLastNameChangeOnly(), msg.getRequestedBy(), nullptr); + renameCharacter(sourceGameServer, static_cast(msg.getRenameCharacterMessageSource()), msg.getStationId(), msg.getCharacterId(), msg.getNewName(), msg.getOldName(), msg.getLastNameChangeOnly(), msg.getRequestedBy(), NULL); } else if (message.isType("UnloadedPlayerMessage")) { diff --git a/engine/server/library/serverDatabase/src/shared/TaskGetBiography.cpp b/engine/server/library/serverDatabase/src/shared/TaskGetBiography.cpp index 96b976fb..9c6cb243 100755 --- a/engine/server/library/serverDatabase/src/shared/TaskGetBiography.cpp +++ b/engine/server/library/serverDatabase/src/shared/TaskGetBiography.cpp @@ -19,7 +19,7 @@ TaskGetBiography::TaskGetBiography(const NetworkId &owner, uint32 requestingProcess) : m_owner(owner), m_requestingProcess(requestingProcess), - m_bio(nullptr) + m_bio(NULL) { } @@ -28,7 +28,7 @@ TaskGetBiography::TaskGetBiography(const NetworkId &owner, uint32 requestingProc TaskGetBiography::~TaskGetBiography() { delete m_bio; - m_bio=nullptr; + m_bio=NULL; } // ---------------------------------------------------------------------- @@ -53,7 +53,7 @@ bool TaskGetBiography::process(DB::Session *session) void TaskGetBiography::onComplete() { - WARNING_STRICT_FATAL(!m_bio,("In TaskGetBiography::onComplete, but m_bio is nullptr\n")); + WARNING_STRICT_FATAL(!m_bio,("In TaskGetBiography::onComplete, but m_bio is NULL\n")); if (m_bio) { BiographyMessage msg(m_owner, *m_bio); diff --git a/engine/server/library/serverDatabase/src/shared/TaskSetBiography.cpp b/engine/server/library/serverDatabase/src/shared/TaskSetBiography.cpp index 501cfe48..d8a98958 100755 --- a/engine/server/library/serverDatabase/src/shared/TaskSetBiography.cpp +++ b/engine/server/library/serverDatabase/src/shared/TaskSetBiography.cpp @@ -24,7 +24,7 @@ TaskSetBiography::TaskSetBiography(const NetworkId &owner, const Unicode::String TaskSetBiography::~TaskSetBiography() { delete m_bio; - m_bio=nullptr; + m_bio=NULL; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/ai/AggroListProperty.cpp b/engine/server/library/serverGame/src/shared/ai/AggroListProperty.cpp index e06b0d40..0b0a552d 100755 --- a/engine/server/library/serverGame/src/shared/ai/AggroListProperty.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AggroListProperty.cpp @@ -106,7 +106,7 @@ bool AggroListPropertyNamespace::isIncapacitated(TangibleObject const & target) { CreatureObject const * const targetCreatureObject = target.asCreatureObject(); - return (targetCreatureObject != nullptr) ? targetCreatureObject->isIncapacitated() : false; + return (targetCreatureObject != NULL) ? targetCreatureObject->isIncapacitated() : false; } // ---------------------------------------------------------------------- @@ -114,7 +114,7 @@ bool AggroListPropertyNamespace::isDead(TangibleObject const & target) { CreatureObject const * const targetCreatureObject = target.asCreatureObject(); - return (targetCreatureObject != nullptr) ? targetCreatureObject->isDead() : false; + return (targetCreatureObject != NULL) ? targetCreatureObject->isDead() : false; } // ---------------------------------------------------------------------- @@ -122,7 +122,7 @@ bool AggroListPropertyNamespace::isInvulnerable(TangibleObject const & target) { CreatureObject const * const targetCreatureObject = target.asCreatureObject(); - return (targetCreatureObject != nullptr) ? targetCreatureObject->isInvulnerable() : false; + return (targetCreatureObject != NULL) ? targetCreatureObject->isInvulnerable() : false; } // ---------------------------------------------------------------------- @@ -138,7 +138,7 @@ bool AggroListPropertyNamespace::isFeigningDeath(TangibleObject const & target) { CreatureObject const * const targetCreatureObject = target.asCreatureObject(); - return (targetCreatureObject != nullptr) ? targetCreatureObject->getState(States::FeignDeath) : false; + return (targetCreatureObject != NULL) ? targetCreatureObject->getState(States::FeignDeath) : false; } // ---------------------------------------------------------------------- @@ -146,7 +146,7 @@ bool AggroListPropertyNamespace::isInPlayerBuilding(TangibleObject const & targe { ServerObject const * const topMostServerObject = ServerObject::asServerObject(ContainerInterface::getTopmostContainer(target)); - return (topMostServerObject != nullptr) ? (topMostServerObject->getGameObjectType() == SharedObjectTemplate::GOT_building_player) : false; + return (topMostServerObject != NULL) ? (topMostServerObject->getGameObjectType() == SharedObjectTemplate::GOT_building_player) : false; } // ---------------------------------------------------------------------- @@ -154,7 +154,7 @@ bool AggroListPropertyNamespace::isAggroImmune(TangibleObject const & target) { PlayerObject const * const playerObject = PlayerCreatureController::getPlayerObject(target.asCreatureObject()); - return (playerObject != nullptr) ? playerObject->isAggroImmune() : false; + return (playerObject != NULL) ? playerObject->isAggroImmune() : false; } // ====================================================================== @@ -212,7 +212,7 @@ void AggroListProperty::alter() // First, list things that invalidate this target in the aggro list // Second, list the things that promote the target to the hate list - if (target.getObject() == nullptr) + if (target.getObject() == NULL) { purgeList.push_back(iterTargetList); } @@ -315,7 +315,7 @@ TangibleObject & AggroListProperty::getTangibleOwner() AggroListProperty * AggroListProperty::getAggroListProperty(Object & object) { Property * const property = object.getProperty(getClassPropertyId()); - AggroListProperty * const aggroProperty = (property != nullptr) ? static_cast(property) : nullptr; + AggroListProperty * const aggroProperty = (property != NULL) ? static_cast(property) : NULL; return aggroProperty; } diff --git a/engine/server/library/serverGame/src/shared/ai/AiCombatPulseQueue.cpp b/engine/server/library/serverGame/src/shared/ai/AiCombatPulseQueue.cpp index 328d9540..c3e95004 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiCombatPulseQueue.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiCombatPulseQueue.cpp @@ -45,7 +45,7 @@ void AiCombatPulseQueue::remove() void AiCombatPulseQueue::schedule(TangibleObject * const object, int waitTimeMs, unsigned long currentFrameTimeMs) { - if (object == nullptr) + if (object == NULL) return; unsigned long desiredTime = Clock::getFrameStartTimeMs() + currentFrameTimeMs + waitTimeMs; @@ -97,7 +97,7 @@ void AiCombatPulseQueue::alter(real time) TangibleObject * const object = (j->second)->first; - if (object != nullptr && object->isInCombat()) + if (object != NULL && object->isInCombat()) { NetworkId const & id = object->getNetworkId(); @@ -107,7 +107,7 @@ void AiCombatPulseQueue::alter(real time) GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(object); - if (gameScriptObject != nullptr) + if (gameScriptObject != NULL) { ScriptParams scriptParams; IGNORE_RETURN(gameScriptObject->trigAllScripts(Scripting::TRIG_AI_COMBAT_FRAME, scriptParams)); diff --git a/engine/server/library/serverGame/src/shared/ai/AiCreatureCombatProfile.cpp b/engine/server/library/serverGame/src/shared/ai/AiCreatureCombatProfile.cpp index c27828d6..cf2cb505 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiCreatureCombatProfile.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiCreatureCombatProfile.cpp @@ -136,9 +136,9 @@ void AiCreatureCombatProfileNamespace::loadCombatProfileTable(DataTable const & for (int i = 0; i < serverObjectCount; ++i) { ServerObject * const serverObject = ServerWorld::getObject(i); - CreatureObject * const creatureObject = (serverObject != nullptr) ? serverObject->asCreatureObject() : nullptr; + CreatureObject * const creatureObject = (serverObject != NULL) ? serverObject->asCreatureObject() : NULL; - if ( (creatureObject != nullptr) + if ( (creatureObject != NULL) && !creatureObject->isPlayerControlled()) { creatureObject->makeDead(NetworkId::cms_invalid, NetworkId::cms_invalid); @@ -228,7 +228,7 @@ void AiCreatureCombatProfileNamespace::grantActions(CreatureObject & owner, AiCr // ---------------------------------------------------------------------- AiCreatureCombatProfile::AiCreatureCombatProfile() - : m_profileId(nullptr) + : m_profileId(NULL) , m_singleUseActionList() , m_delayRepeatActionList() , m_instantRepeatActionList() @@ -247,7 +247,7 @@ void AiCreatureCombatProfile::install() bool const openIfNotFound = true; DataTable * const dataTable = DataTableManager::getTable(s_combatProfileTable, openIfNotFound); - if (dataTable != nullptr) + if (dataTable != NULL) { #ifdef _DEBUG DataTableManager::addReloadCallback(s_combatProfileTable, &loadCombatProfileTable); @@ -267,7 +267,7 @@ void AiCreatureCombatProfile::install() // ---------------------------------------------------------------------- AiCreatureCombatProfile const * AiCreatureCombatProfile::getCombatProfile(CrcString const & profileName) { - AiCreatureCombatProfile const * result = nullptr; + AiCreatureCombatProfile const * result = NULL; CombatProfileMap::const_iterator iterCombatProfileMap = s_combatProfileMap.find(PersistentCrcString(profileName)); if (iterCombatProfileMap != s_combatProfileMap.end()) diff --git a/engine/server/library/serverGame/src/shared/ai/AiCreatureData.cpp b/engine/server/library/serverGame/src/shared/ai/AiCreatureData.cpp index 3d90a5f7..034f9980 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiCreatureData.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiCreatureData.cpp @@ -46,7 +46,7 @@ namespace AiCreatureDataNamespace CreatureDataMap s_creatureDataMap; WeaponDataMap s_weaponDataMap; - AiCreatureData const * s_defaultCreatureData = nullptr; + AiCreatureData const * s_defaultCreatureData = NULL; int s_creatureErrorCount = 0; int s_weaponErrorCount = 0; @@ -154,7 +154,7 @@ void AiCreatureDataNamespace::verifySecondaryWeapon(CrcString const & creatureNa void AiCreatureDataNamespace::verifyPrimarySpecials(CrcString const & creatureName, CrcString & primarySpecials) { if ( !primarySpecials.isEmpty() - && (AiCreatureCombatProfile::getCombatProfile(primarySpecials) == nullptr)) + && (AiCreatureCombatProfile::getCombatProfile(primarySpecials) == NULL)) { ++s_creatureErrorCount; WARNING(true, ("AiCreatureData::verifyPrimarySpecials() Creature(%s) has invalid primary_weapon_specials(%s)", creatureName.getString(), primarySpecials.getString())); @@ -165,7 +165,7 @@ void AiCreatureDataNamespace::verifyPrimarySpecials(CrcString const & creatureNa void AiCreatureDataNamespace::verifySecondarySpecials(CrcString const & creatureName, CrcString & secondarySpecials) { if ( !secondarySpecials.isEmpty() - && (AiCreatureCombatProfile::getCombatProfile(secondarySpecials) == nullptr)) + && (AiCreatureCombatProfile::getCombatProfile(secondarySpecials) == NULL)) { ++s_creatureErrorCount; WARNING(true, ("AiCreatureData::verifySecondarySpecials() Creature(%s) has invalid secondary_weapon_specials(%s)", creatureName.getString(), secondarySpecials.getString())); @@ -320,7 +320,7 @@ void AiCreatureDataNamespace::loadWeaponColumn(WeaponList & weaponList, std::str // ---------------------------------------------------------------------- AiCreatureData::AiCreatureData() - : m_name(nullptr) + : m_name(NULL) , m_movementSpeedPercent(1.0f) , m_primaryWeapon() , m_secondaryWeapon() @@ -348,7 +348,7 @@ void AiCreatureData::install() bool const openIfNotFound = true; DataTable * const dataTable = DataTableManager::getTable(s_weaponDataTable, openIfNotFound); - if (dataTable != nullptr) + if (dataTable != NULL) { DataTableManager::addReloadCallback(s_weaponDataTable, &loadWeaponData); loadWeaponData(*dataTable); @@ -366,7 +366,7 @@ void AiCreatureData::install() bool const openIfNotFound = true; DataTable * const dataTable = DataTableManager::getTable(s_creaureDataTable, openIfNotFound); - if (dataTable != nullptr) + if (dataTable != NULL) { DataTableManager::addReloadCallback(s_creaureDataTable, &loadCreatureData); loadCreatureData(*dataTable); diff --git a/engine/server/library/serverGame/src/shared/ai/AiCreatureWeaponActions.cpp b/engine/server/library/serverGame/src/shared/ai/AiCreatureWeaponActions.cpp index 4d5498f8..781bc2f1 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiCreatureWeaponActions.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiCreatureWeaponActions.cpp @@ -58,7 +58,7 @@ AiCreatureWeaponActions::AiCreatureWeaponActions() : m_singleUseActionList() , m_delayRepeatActionList() , m_instantRepeatActionList() - , m_combatProfile(nullptr) + , m_combatProfile(NULL) { } @@ -81,7 +81,7 @@ void AiCreatureWeaponActions::setCombatProfile(CreatureObject & owner, AiCreatur // ---------------------------------------------------------------------- void AiCreatureWeaponActions::reset() { - if (m_combatProfile != nullptr) + if (m_combatProfile != NULL) { resetActionTimers(m_singleUseActionList, m_combatProfile->m_singleUseActionList); resetActionTimers(m_delayRepeatActionList, m_combatProfile->m_delayRepeatActionList); @@ -92,9 +92,9 @@ void AiCreatureWeaponActions::reset() // ---------------------------------------------------------------------- PersistentCrcString const & AiCreatureWeaponActions::getCombatAction() { - // If the combat profile is nullptr, then the AI has no special actions assigned + // If the combat profile is NULL, then the AI has no special actions assigned - if (m_combatProfile != nullptr) + if (m_combatProfile != NULL) { time_t const osTime = Os::getRealSystemTime(); diff --git a/engine/server/library/serverGame/src/shared/ai/AiMovementArchive.cpp b/engine/server/library/serverGame/src/shared/ai/AiMovementArchive.cpp index e1508bf4..723b8c7e 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiMovementArchive.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiMovementArchive.cpp @@ -34,12 +34,12 @@ namespace Archive get(source, target.m_objectId); get(source, movementType); - AICreatureController * controller = nullptr; + AICreatureController * controller = NULL; Object * object = NetworkIdManager::getObjectById(target.getObjectId()); - if (object != nullptr) + if (object != NULL) controller = dynamic_cast(object->getController()); - if (controller == nullptr) + if (controller == NULL) { WARNING(true, ("AiMovementMessage Archive::get, got message to object %s that doesn't have an AICreatureController", target.getObjectId().getValueString().c_str())); target.m_movement = AiMovementBaseNullPtr; diff --git a/engine/server/library/serverGame/src/shared/ai/AiMovementBase.cpp b/engine/server/library/serverGame/src/shared/ai/AiMovementBase.cpp index 79f1e119..dde28a05 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiMovementBase.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiMovementBase.cpp @@ -30,9 +30,9 @@ AiMovementBase::AiMovementBase( AICreatureController * controller ) : m_controller( controller ), - m_stateFunction( nullptr ), + m_stateFunction( NULL ), m_stateName(), - m_pendingFunction( nullptr ), + m_pendingFunction( NULL ), m_pendingName() { } @@ -41,9 +41,9 @@ AiMovementBase::AiMovementBase( AICreatureController * controller ) AiMovementBase::AiMovementBase( AICreatureController * controller, Archive::ReadIterator & source ) : m_controller( controller ), - m_stateFunction( nullptr ), + m_stateFunction( NULL ), m_stateName(), - m_pendingFunction( nullptr ), + m_pendingFunction( NULL ), m_pendingName() { // !!! @@ -177,7 +177,7 @@ void AiMovementBase::applyStateChange ( void ) m_stateFunction = m_pendingFunction; m_stateName = m_pendingName; - m_pendingFunction = nullptr; + m_pendingFunction = NULL; m_pendingName.clear(); } } @@ -249,49 +249,49 @@ char const * AiMovementBase::getMovementString(AiMovementType const aiMovementTy // ---------------------------------------------------------------------- AiMovementSwarm * AiMovementBase::asAiMovementSwarm() { - return nullptr; + return NULL; } // ---------------------------------------------------------------------- AiMovementFace * AiMovementBase::asAiMovementFace() { - return nullptr; + return NULL; } // ---------------------------------------------------------------------- AiMovementFlee * AiMovementBase::asAiMovementFlee() { - return nullptr; + return NULL; } // ---------------------------------------------------------------------- AiMovementFollow * AiMovementBase::asAiMovementFollow() { - return nullptr; + return NULL; } // ---------------------------------------------------------------------- AiMovementLoiter * AiMovementBase::asAiMovementLoiter() { - return nullptr; + return NULL; } // ---------------------------------------------------------------------- AiMovementMove * AiMovementBase::asAiMovementMove() { - return nullptr; + return NULL; } // ---------------------------------------------------------------------- AiMovementPatrol * AiMovementBase::asAiMovementPatrol() { - return nullptr; + return NULL; } // ---------------------------------------------------------------------- AiMovementWander * AiMovementBase::asAiMovementWander() { - return nullptr; + return NULL; } // ====================================================================== diff --git a/engine/server/library/serverGame/src/shared/ai/AiMovementLoiter.cpp b/engine/server/library/serverGame/src/shared/ai/AiMovementLoiter.cpp index e8e0f5c4..8e4e5a2d 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiMovementLoiter.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiMovementLoiter.cpp @@ -67,9 +67,9 @@ Vector AiMovementLoiterNamespace::getRandomLoiterPosition_p(Vector const anchorP bool AiMovementLoiterNamespace::isPositionOnFloor(Floor const * const floor, Vector const & position_p, float const radius, Vector & floorPosition_p) { bool result = false; - FloorMesh const * const floorMesh = (floor != nullptr) ? floor->getFloorMesh() : nullptr; + FloorMesh const * const floorMesh = (floor != NULL) ? floor->getFloorMesh() : NULL; - if (floorMesh != nullptr) + if (floorMesh != NULL) { // See if the circle fits entirely on the floor { @@ -199,7 +199,7 @@ AiMovementLoiter::AiMovementLoiter( AICreatureController * controller, Archive:: AiMovementLoiter::~AiMovementLoiter() { delete m_cachedAiLocations; - m_cachedAiLocations = nullptr; + m_cachedAiLocations = NULL; } // ---------------------------------------------------------------------- @@ -420,7 +420,7 @@ bool AiMovementLoiter::generateWaypoint() Floor const * const ownerFloor = CollisionWorld::getFloorStandingOn(*creatureOwner); - if (ownerFloor != nullptr) + if (ownerFloor != NULL) { // The owner is standing on a floor @@ -476,7 +476,7 @@ bool AiMovementLoiter::generateWaypoint() TerrainObject const * const terrainObject = TerrainObject::getConstInstance(); - if ( (terrainObject != nullptr) + if ( (terrainObject != NULL) && terrainObject->isPassable(randomPosition_p)) { // Snap the random position to the terrain @@ -518,7 +518,7 @@ bool AiMovementLoiter::generateWaypoint() { BaseExtent const * const extent = collisionProperty->getExtent_l(); - if (extent != nullptr) + if (extent != NULL) { Vector const begin_o(object.rotateTranslate_w2o(m_anchor.getPosition_p())); Vector const end_o(object.rotateTranslate_w2o(randomPosition_p)); @@ -580,7 +580,7 @@ void AiMovementLoiter::addDebug(AiDebugString & aiDebugString) AiMovementWaypoint::addDebug(aiDebugString); FormattedString<512> fs; - aiDebugString.addText(fs.sprintf("LOITER %s\n%s\ndist[%.0f...%.0f]\ndelay[%.1f...%.1f]\n", (m_anchor.getObject() != nullptr) ? "TARGET" : "POSITION", m_stateName.c_str(), m_minDistance, m_maxDistance, m_minDelay, m_maxDelay), PackedRgb::solidCyan); + aiDebugString.addText(fs.sprintf("LOITER %s\n%s\ndist[%.0f...%.0f]\ndelay[%.1f...%.1f]\n", (m_anchor.getObject() != NULL) ? "TARGET" : "POSITION", m_stateName.c_str(), m_minDistance, m_maxDistance, m_minDelay, m_maxDelay), PackedRgb::solidCyan); //if (m_bubbleCheckResult == BCR_invalid) //{ @@ -599,7 +599,7 @@ void AiMovementLoiter::addDebug(AiDebugString & aiDebugString) { Object const * const anchorObject = m_anchor.getObject(); - if (anchorObject != nullptr) + if (anchorObject != NULL) { // We are anchored to a moving target @@ -659,7 +659,7 @@ bool AiMovementLoiter::isAnchorValid() const { TangibleObject const * const tangibleObject = TangibleObject::asTangibleObject(m_anchor.getObject()); - if (tangibleObject != nullptr) + if (tangibleObject != NULL) { if (tangibleObject->isInCombat()) { diff --git a/engine/server/library/serverGame/src/shared/ai/AiMovementMove.cpp b/engine/server/library/serverGame/src/shared/ai/AiMovementMove.cpp index 71b6b193..9641e7e3 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiMovementMove.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiMovementMove.cpp @@ -85,7 +85,7 @@ AiMovementMove::AiMovementMove( AICreatureController * controller, Archive::Read AiMovementMove::~AiMovementMove() { delete m_pathBuilder; - m_pathBuilder = nullptr; + m_pathBuilder = NULL; } // ---------------------------------------------------------------------- @@ -151,7 +151,7 @@ void AiMovementMove::refresh( void ) m_target = target; m_targetName = targetName; - if (m_controller != nullptr) + if (m_controller != NULL) m_start = AiLocation(m_controller->getCreatureCell(), m_controller->getCreaturePosition_p()); CHANGE_STATE( AiMovementMove::stateWaiting ); } diff --git a/engine/server/library/serverGame/src/shared/ai/AiMovementPathFollow.cpp b/engine/server/library/serverGame/src/shared/ai/AiMovementPathFollow.cpp index 34ab1e1f..2105c898 100644 --- a/engine/server/library/serverGame/src/shared/ai/AiMovementPathFollow.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiMovementPathFollow.cpp @@ -73,7 +73,7 @@ AiMovementPathFollow::AiMovementPathFollow( AICreatureController * controller, A : AiMovementWaypoint( controller, source ), m_path( new AiPath() ) { - if (m_path != nullptr) + if (m_path != NULL) Archive::get(source, *m_path); } @@ -84,7 +84,7 @@ AiMovementPathFollow::~AiMovementPathFollow() clearPath(); delete m_path; - m_path = nullptr; + m_path = NULL; } // ---------------------------------------------------------------------- @@ -92,7 +92,7 @@ AiMovementPathFollow::~AiMovementPathFollow() void AiMovementPathFollow::pack( Archive::ByteStream & target ) const { AiMovementWaypoint::pack(target); - if (m_path != nullptr) + if (m_path != NULL) Archive::put(target, *m_path); else Archive::put(target, static_cast(0)); @@ -288,7 +288,7 @@ AiPath const * AiMovementPathFollow::getPath ( void ) const void AiMovementPathFollow::swapPath ( AiPath * newPath ) { - if(newPath == nullptr) return; + if(newPath == NULL) return; AiPath::iterator it; diff --git a/engine/server/library/serverGame/src/shared/ai/AiMovementPatrol.cpp b/engine/server/library/serverGame/src/shared/ai/AiMovementPatrol.cpp index c4c73b88..4ea6a593 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiMovementPatrol.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiMovementPatrol.cpp @@ -60,7 +60,7 @@ AiMovementPatrol::AiMovementPatrol( AICreatureController * controller, std::vect m_patrolPointIndex(startPoint) { ServerObject * owner = safe_cast(controller->getOwner()); - if (owner != nullptr) + if (owner != NULL) { DEBUG_REPORT_LOG(ConfigServerGame::isAiLoggingEnabled(), ("AiMovementPatrol creating named path for %s\n", owner->getNetworkId().getValueString().c_str())); @@ -98,7 +98,7 @@ AiMovementPatrol::AiMovementPatrol( AICreatureController * controller, std::vect { const Unicode::String & pointName = *i; const CityPathNode * node = CityPathGraphManager::getNamedNodeFor(*owner, pointName); - if (node != nullptr) + if (node != NULL) { m_patrolPath.push_back(AiLocation(node->getSourceId())); } @@ -118,16 +118,16 @@ AiMovementPatrol::AiMovementPatrol( AICreatureController * controller, std::vect // try an find a node on the path that is a previous root node, or isn't // being used in any other path std::vector::iterator i; - const ServerObject * node = nullptr; - const ServerObject * root = nullptr; + const ServerObject * node = NULL; + const ServerObject * root = NULL; for (i = m_patrolPath.begin(); i != m_patrolPath.end(); ++i) { node = safe_cast(i->getObject()); - if (node != nullptr) + if (node != NULL) { if (node->isPatrolPathRoot()) { - if (root == nullptr || !root->isPatrolPathRoot()) + if (root == NULL || !root->isPatrolPathRoot()) { // if we already have a set up root node, use that root = node; @@ -135,18 +135,18 @@ AiMovementPatrol::AiMovementPatrol( AICreatureController * controller, std::vect else { // we've got two previous root nodes, we can't connect them - root = nullptr; + root = NULL; break; } } - else if (!node->isPatrolPathNode() && root == nullptr) + else if (!node->isPatrolPathNode() && root == NULL) { // found a free node root = node; } } } - if (root != nullptr) + if (root != NULL) { // set up the root node if (!root->isPatrolPathRoot()) @@ -156,7 +156,7 @@ AiMovementPatrol::AiMovementPatrol( AICreatureController * controller, std::vect for (i = m_patrolPath.begin(); i != m_patrolPath.end(); ++i) { node = safe_cast(i->getObject()); - if (node != nullptr && node != root) + if (node != NULL && node != root) const_cast(node)->setPatrolPathRoot(*root); } const_cast(root)->addPatrolPathingObject(*owner); @@ -167,7 +167,7 @@ AiMovementPatrol::AiMovementPatrol( AICreatureController * controller, std::vect for (i = m_patrolPath.begin(); i != m_patrolPath.end(); ++i) { node = safe_cast(i->getObject()); - if (node != nullptr) + if (node != NULL) nodes += node->getNetworkId().getValueString() + " "; } WARNING(true, ("AiMovementPatrol unable to find root node for path: %s", nodes.c_str())); @@ -266,15 +266,15 @@ void AiMovementPatrol::getDebugInfo ( std::string & outString ) const void AiMovementPatrol::endBehavior() { - if (!m_patrolPath.empty() && m_controller != nullptr) + if (!m_patrolPath.empty() && m_controller != NULL) { const ServerObject * owner = safe_cast(m_controller->getOwner()); - if (owner != nullptr) + if (owner != NULL) { for (std::vector::iterator i = m_patrolPath.begin(); i != m_patrolPath.end(); ++i) { const ServerObject * node = safe_cast(i->getObject()); - if (node != nullptr && node->isPatrolPathRoot()) + if (node != NULL && node->isPatrolPathRoot()) { const_cast(node)->removePatrolPathingObject(*owner); break; @@ -304,7 +304,7 @@ bool AiMovementPatrol::getHibernateOk() const if (!m_patrolPath.empty()) { const ServerObject * node = safe_cast(m_patrolPath.front().getObject()); - if (node != nullptr) + if (node != NULL) { return node->getPatrolPathObservers() == 0; } diff --git a/engine/server/library/serverGame/src/shared/ai/AiMovementSwarm.cpp b/engine/server/library/serverGame/src/shared/ai/AiMovementSwarm.cpp index f9593a06..52a3e701 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiMovementSwarm.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiMovementSwarm.cpp @@ -104,10 +104,10 @@ void AiMovementSwarm::alter ( float time ) } // update the offset from our target we want to go to - if (m_target.getObject() != nullptr) + if (m_target.getObject() != NULL) { const CreatureObject * owner = m_controller->getCreature(); - if (owner != nullptr) + if (owner != NULL) { offsetMap::const_iterator found = s_offsetMap.find(CachedNetworkId(*owner)); if (found != s_offsetMap.end()) @@ -179,7 +179,7 @@ AiStateResult AiMovementSwarm::triggerWaiting() { // note: don't use the m_target position function, because it includes the offset position const Object * target = m_target.getObject(); - if (target != nullptr) + if (target != NULL) m_controller->turnToward(target->getParentCell(), target->getPosition_p()); return AiMovementFollow::triggerWaiting(); } @@ -196,7 +196,7 @@ void AiMovementSwarm::init() const CreatureObject * creatureOwner = m_controller->getCreature(); const CreatureObject * creatureTarget = CreatureObject::asCreatureObject(m_target.getObject()); - if (creatureOwner != nullptr && creatureTarget != nullptr) + if (creatureOwner != NULL && creatureTarget != NULL) { CreatureWatcher watchedCreature(creatureOwner); targetMap::iterator found = s_swarmMap.find(CachedNetworkId(*creatureTarget)); @@ -226,7 +226,7 @@ void AiMovementSwarm::cleanup() // note: using static_cast instead of safe_cast because the owner may be in the process of being destructed const CreatureObject * owner = static_cast(m_controller->getOwner()); const CreatureObject * target = static_cast(m_target.getObject()); - if (owner != nullptr && target != nullptr) + if (owner != NULL && target != NULL) { targetMap::iterator found = s_swarmMap.find(CachedNetworkId(*target)); if (found != s_swarmMap.end()) @@ -258,7 +258,7 @@ void AiMovementSwarm::computeGoals() for (targetMap::iterator i = s_swarmMap.begin(); i != s_swarmMap.end();) { const CreatureObject * target = CreatureObject::asCreatureObject((*i).first.getObject()); - if (target != nullptr && !target->isDead()) + if (target != NULL && !target->isDead()) { computeGoals(*target, (*i).second); if ((*i).second.empty()) @@ -294,16 +294,16 @@ void AiMovementSwarm::computeGoals(const CreatureObject & target, std::vectorgetController()); - if (controller != nullptr) + if (controller != NULL) swarmMovement = dynamic_cast(controller->getCurrentMovement()); } - if (mover == nullptr || mover->isDead()) + if (mover == NULL || mover->isDead()) { // dump the mover from our list --count; @@ -314,7 +314,7 @@ void AiMovementSwarm::computeGoals(const CreatureObject & target, std::vectorisDead()) + if (blocker == NULL || blocker->isDead()) { continue; } @@ -361,7 +361,7 @@ void AiMovementSwarm::computeGoals(const CreatureObject & target, std::vectorasServerObject() != nullptr) + if (o != NULL && o->asServerObject() != NULL) { // if the target is a player, don't hibernate if (o->asServerObject()->isPlayerControlled()) hibernate = false; // hibernate if who we're following is hibernating - else if (o->asServerObject()->asCreatureObject() != nullptr) + else if (o->asServerObject()->asCreatureObject() != NULL) hibernate = (safe_cast(o->getController()))->getHibernate(); } else @@ -114,7 +114,7 @@ static const AiMovementTarget * preventRecurse = nullptr; // clean up recusion checkers if (preventRecurse == this) - preventRecurse = nullptr; + preventRecurse = NULL; --recursionCount; return hibernate; } diff --git a/engine/server/library/serverGame/src/shared/ai/AiMovementWanderInterior.cpp b/engine/server/library/serverGame/src/shared/ai/AiMovementWanderInterior.cpp index a5fe327d..24a4c66a 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiMovementWanderInterior.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiMovementWanderInterior.cpp @@ -82,23 +82,23 @@ bool AiMovementWanderInterior::updateWaypoint ( void ) { CreatureObject const * creature = m_controller->getCreature(); - if(creature == nullptr) return false; + if(creature == NULL) return false; CellProperty const * cell = creature->getParentCell(); - if(cell == nullptr) return false; + if(cell == NULL) return false; Floor const * floor = cell->getFloor(); - if(floor == nullptr) return false; + if(floor == NULL) return false; FloorMesh const * floorMesh = floor->getFloorMesh(); - if(floorMesh == nullptr) return false; + if(floorMesh == NULL) return false; PathGraph const * graph = safe_cast(floorMesh->getPathGraph()); - if(graph == nullptr) return false; + if(graph == NULL) return false; // ---------- @@ -107,11 +107,11 @@ bool AiMovementWanderInterior::updateWaypoint ( void ) if(closestIndex == -2) { const CellObject *cellObject = dynamic_cast(&cell->getOwner()); - const BuildingObject *building = (cellObject ? cellObject->getOwnerBuilding() : nullptr); + const BuildingObject *building = (cellObject ? cellObject->getOwnerBuilding() : NULL); Vector creaturePosition = creature->getPosition_w(); LOG("building-data-error",("Building id=%s has no path data but creature id=%s at (x=%.2f,y=%.2f,z=%.2f) requires it for wandering, stopping behavior.", - (building ? building->getNetworkId().getValueString().c_str() : ""), + (building ? building->getNetworkId().getValueString().c_str() : ""), creature->getNetworkId().getValueString().c_str(), creaturePosition.x, creaturePosition.y, @@ -132,7 +132,7 @@ bool AiMovementWanderInterior::updateWaypoint ( void ) { PathNode const * closestNode = graph->getNode(closestIndex); - if(closestNode != nullptr) + if(closestNode != NULL) { m_target = AiLocation(m_controller->getCreatureCell(),closestNode->getPosition_p()); diff --git a/engine/server/library/serverGame/src/shared/ai/AiMovementWaypoint.cpp b/engine/server/library/serverGame/src/shared/ai/AiMovementWaypoint.cpp index c92d3100..3b2b123e 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiMovementWaypoint.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiMovementWaypoint.cpp @@ -34,7 +34,7 @@ float computeMovementModifier (CreatureObject * const object) { if (!object) { - DEBUG_FATAL(true, ("object is nullptr.")); + DEBUG_FATAL(true, ("object is NULL.")); return 0.0f; } @@ -81,7 +81,7 @@ float computeMovementModifier (CreatureObject * const object) // if the creature has a slope effect property, see if it has a greater // (more negative) effect on the creature than the terrain const Property * property = object->getProperty(SlopeEffectProperty::getClassPropertyId()); - if (property != nullptr) + if (property != NULL) { // note we use the creature's base speed modifier, not the one modified by skills // (although for ai they're probably the same) diff --git a/engine/server/library/serverGame/src/shared/ai/AiTargetingSystem.cpp b/engine/server/library/serverGame/src/shared/ai/AiTargetingSystem.cpp index 050263d3..2afac7bc 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiTargetingSystem.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiTargetingSystem.cpp @@ -94,7 +94,7 @@ bool AiTargetingSystem::canAttackTarget(TangibleObject const * target) { bool result = false; - if (target != nullptr) + if (target != NULL) { if ( (m_owner.getDistanceBetweenCollisionSpheres_w(*target) <= ConfigServerGame::getMaxCombatRange()) && m_owner.checkLOSTo(*target)) diff --git a/engine/server/library/serverGame/src/shared/ai/Formation.cpp b/engine/server/library/serverGame/src/shared/ai/Formation.cpp index 415989a2..713d9b00 100755 --- a/engine/server/library/serverGame/src/shared/ai/Formation.cpp +++ b/engine/server/library/serverGame/src/shared/ai/Formation.cpp @@ -128,8 +128,8 @@ void Formation::build(Squad & squad) DEBUG_FATAL(squad.isEmpty(), ("Building a formation on an empty squad.")); Object const * const leaderObject = squad.getLeader().getObject(); - CollisionProperty const * const leaderCollisionProperty = (leaderObject != nullptr) ? leaderObject->getCollisionProperty() : nullptr; - float const leaderRadius = (leaderCollisionProperty != nullptr) ? (leaderCollisionProperty->getBoundingSphere_l().getRadius() * 2.0f) : 1.0f; + CollisionProperty const * const leaderCollisionProperty = (leaderObject != NULL) ? leaderObject->getCollisionProperty() : NULL; + float const leaderRadius = (leaderCollisionProperty != NULL) ? (leaderCollisionProperty->getBoundingSphere_l().getRadius() * 2.0f) : 1.0f; int slotIndex = 0; Squad::UnitMap const & unitSet = squad.getUnitMap(); diff --git a/engine/server/library/serverGame/src/shared/ai/HateList.cpp b/engine/server/library/serverGame/src/shared/ai/HateList.cpp index 496fb2b9..d57fc5cb 100755 --- a/engine/server/library/serverGame/src/shared/ai/HateList.cpp +++ b/engine/server/library/serverGame/src/shared/ai/HateList.cpp @@ -41,8 +41,8 @@ // ---------------------------------------------------------------------- HateList::HateList() - : m_owner(nullptr) - , m_playerObject(nullptr) + : m_owner(NULL) + , m_playerObject(NULL) , m_hateList() , m_target(CachedNetworkId::cms_cachedInvalid) , m_maxHate(0.0f) @@ -56,8 +56,8 @@ HateList::HateList() HateList::~HateList() { clear(); - m_owner = nullptr; - m_playerObject = nullptr; + m_owner = NULL; + m_playerObject = NULL; } // ---------------------------------------------------------------------- @@ -119,7 +119,7 @@ bool HateList::addHate(NetworkId const & target, float const hate) // If a target AI has a master, the target and the master needs to be added to the hate list (ie. pets should cause their master to gain hate) { CreatureObject const * const targetCreatureObject = CreatureObject::asCreatureObject(targetObject); - NetworkId const & masterId = (targetCreatureObject != nullptr) ? targetCreatureObject->getMasterId() : NetworkId::cms_invalid; + NetworkId const & masterId = (targetCreatureObject != NULL) ? targetCreatureObject->getMasterId() : NetworkId::cms_invalid; if (masterId != NetworkId::cms_invalid) { @@ -274,7 +274,7 @@ bool HateList::removeTarget(NetworkId const & target) { AggroListProperty * const aggroList = AggroListProperty::getAggroListProperty(*m_owner); - if (aggroList != nullptr) + if (aggroList != NULL) { aggroList->addTarget(target); } @@ -301,7 +301,7 @@ bool HateList::isValidTarget(Object * const target) bool valid = true; TangibleObject * const targetTangibleObject = TangibleObject::asTangibleObject(target); - if (targetTangibleObject == nullptr) + if (targetTangibleObject == NULL) { LOGC(AiLogManager::isLogging(m_owner->getNetworkId()), "debug_ai", ("HateList::isValidTarget() owner(%s:%s) TARGET IS NOT A TANGIBLEOBJECT", m_owner->getNetworkId().getValueString().c_str(), FileNameUtils::get(m_owner->getDebugName(), FileNameUtils::fileName).c_str())); valid = false; @@ -334,7 +334,7 @@ bool HateList::isValidTarget(Object * const target) { CreatureObject const * const targetCreatureObject = targetTangibleObject->asCreatureObject(); - if (targetCreatureObject != nullptr) + if (targetCreatureObject != NULL) { if (targetTangibleObject->isDisabled()) { @@ -355,7 +355,7 @@ bool HateList::isValidTarget(Object * const target) { AICreatureController const * const targetAiCreatureController = AICreatureController::asAiCreatureController(targetCreatureObject->getController()); - if ( (targetAiCreatureController != nullptr) + if ( (targetAiCreatureController != NULL) && targetAiCreatureController->isRetreating()) { LOGC(AiLogManager::isLogging(m_owner->getNetworkId()), "debug_ai", ("HateList::isValidTarget() owner(%s:%s) TARGET IS RETREATING", m_owner->getNetworkId().getValueString().c_str(), FileNameUtils::get(m_owner->getDebugName(), FileNameUtils::fileName).c_str())); @@ -370,7 +370,7 @@ bool HateList::isValidTarget(Object * const target) // themselves towards the player so that they and the player // enter combat correctly. { - if ( (m_owner->asCreatureObject() != nullptr) + if ( (m_owner->asCreatureObject() != NULL) && !Pvp::canAttack(*m_owner, *targetTangibleObject)) { LOGC(AiLogManager::isLogging(m_owner->getNetworkId()), "debug_ai", ("HateList::isValidTarget() owner(%s:%s) PVP CAN'T ATTACK", m_owner->getNetworkId().getValueString().c_str(), FileNameUtils::get(m_owner->getDebugName(), FileNameUtils::fileName).c_str())); @@ -393,7 +393,7 @@ CachedNetworkId const & HateList::getTarget() const if ( (m_target.get() == CachedNetworkId::cms_cachedInvalid) && !isEmpty()) { - WARNING(true, ("HateList::getTarget() owner(%s) m_hateList.size(%u) m_target is nullptr but the HateList is not empty.", m_owner->getDebugInformation().c_str(), m_hateList.size())); + WARNING(true, ("HateList::getTarget() owner(%s) m_hateList.size(%u) m_target is NULL but the HateList is not empty.", m_owner->getDebugInformation().c_str(), m_hateList.size())); } #endif // _DEBUG @@ -458,7 +458,7 @@ void HateList::findNewTarget() for (; iterHateList != m_hateList.end(); ++iterHateList) { - if (iterHateList->first.getObject() == nullptr) + if (iterHateList->first.getObject() == NULL) { // This target will be removed in the next alter call continue; @@ -510,11 +510,11 @@ void HateList::setTarget(CachedNetworkId const & target, float const hate) #ifdef _DEBUG // We should only have tangible objects in our target list - if (m_target.get().getObject() != nullptr) + if (m_target.get().getObject() != NULL) { TangibleObject const * const targetTangibleObject = TangibleObject::asTangibleObject(m_target.get().getObject()->asServerObject()); - if (targetTangibleObject == nullptr) + if (targetTangibleObject == NULL) { WARNING(true, ("HateList::setTarget() owner(%s) How did we get a target(%s) that is not a TangibleObject", m_owner->getDebugInformation().c_str(), m_target.get().getObject()->getDebugInformation().c_str())); } @@ -559,7 +559,7 @@ void HateList::triggerTargetChanged(NetworkId const & target) { GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(m_owner); - if (gameScriptObject != nullptr) + if (gameScriptObject != NULL) { LOGC(AiLogManager::isLogging(m_owner->getNetworkId()), "debug_ai", ("HateList::triggerTargetChanged() owner(%s:%s) target(%s)", m_owner->getNetworkId().getValueString().c_str(), FileNameUtils::get(m_owner->getDebugName(), FileNameUtils::fileName).c_str(), target.getValueString().c_str())); @@ -578,7 +578,7 @@ void HateList::triggerTargetAdded(NetworkId const & target) { GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(m_owner); - if (gameScriptObject != nullptr) + if (gameScriptObject != NULL) { LOGC(AiLogManager::isLogging(m_owner->getNetworkId()), "debug_ai", ("HateList::triggerTargetAdded() owner(%s:%s) target(%s)", m_owner->getNetworkId().getValueString().c_str(), FileNameUtils::get(m_owner->getDebugName(), FileNameUtils::fileName).c_str(), target.getValueString().c_str())); @@ -597,7 +597,7 @@ void HateList::triggerTargetRemoved(NetworkId const & target) { GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(m_owner); - if (gameScriptObject != nullptr) + if (gameScriptObject != NULL) { LOGC(AiLogManager::isLogging(m_owner->getNetworkId()), "debug_ai", ("HateList::triggerTargetRemoved() owner(%s:%s) target(%s)", m_owner->getNetworkId().getValueString().c_str(), FileNameUtils::get(m_owner->getDebugName(), FileNameUtils::fileName).c_str(), target.getValueString().c_str())); @@ -628,7 +628,7 @@ int HateList::getAutoExpireTargetDuration() const bool HateList::isOwnerValid() const { CreatureObject const * const ownerCreature = CreatureObject::asCreatureObject(m_owner); - bool const ownerIncapacitated = (ownerCreature != nullptr) ? ownerCreature->isIncapacitated() : false; + bool const ownerIncapacitated = (ownerCreature != NULL) ? ownerCreature->isIncapacitated() : false; if (ownerIncapacitated) { @@ -636,7 +636,7 @@ bool HateList::isOwnerValid() const return false; } - bool const ownerDead = (ownerCreature != nullptr) ? ownerCreature->isDead() : false; + bool const ownerDead = (ownerCreature != NULL) ? ownerCreature->isDead() : false; if (ownerDead) { @@ -644,7 +644,7 @@ bool HateList::isOwnerValid() const return false; } - bool const ownerDisabled = (ownerCreature != nullptr) ? ownerCreature->isDisabled() : false; + bool const ownerDisabled = (ownerCreature != NULL) ? ownerCreature->isDisabled() : false; if (ownerDisabled) { @@ -653,7 +653,7 @@ bool HateList::isOwnerValid() const } AICreatureController const * const ownerAiCreatureController = AICreatureController::asAiCreatureController(m_owner->getController()); - const bool ownerRetreating = (ownerAiCreatureController != nullptr) ? ownerAiCreatureController->isRetreating() : false; + const bool ownerRetreating = (ownerAiCreatureController != NULL) ? ownerAiCreatureController->isRetreating() : false; if (ownerRetreating) { @@ -752,11 +752,11 @@ void HateList::forceHateTarget(const NetworkId &target) #ifdef _DEBUG // We should only have tangible objects in our target list - if (m_target.get().getObject() != nullptr) + if (m_target.get().getObject() != NULL) { TangibleObject const * const targetTangibleObject = TangibleObject::asTangibleObject(m_target.get().getObject()->asServerObject()); - if (targetTangibleObject == nullptr) + if (targetTangibleObject == NULL) { WARNING(true, ("HateList::setTarget() owner(%s) How did we get a target(%s) that is not a TangibleObject", m_owner->getDebugInformation().c_str(), m_target.get().getObject()->getDebugInformation().c_str())); } diff --git a/engine/server/library/serverGame/src/shared/ai/HateList.h b/engine/server/library/serverGame/src/shared/ai/HateList.h index 38a3a685..c4f1b761 100755 --- a/engine/server/library/serverGame/src/shared/ai/HateList.h +++ b/engine/server/library/serverGame/src/shared/ai/HateList.h @@ -99,7 +99,7 @@ private: inline bool HateList::isOwnerPlayer() const { - return (m_playerObject != nullptr); + return (m_playerObject != NULL); } // ====================================================================== diff --git a/engine/server/library/serverGame/src/shared/ai/Squad.cpp b/engine/server/library/serverGame/src/shared/ai/Squad.cpp index b4a23b20..caced74f 100755 --- a/engine/server/library/serverGame/src/shared/ai/Squad.cpp +++ b/engine/server/library/serverGame/src/shared/ai/Squad.cpp @@ -380,7 +380,7 @@ void Squad::buildFormation() { NetworkId const & unit = iterUnitMap->first; PersistentCrcString const * unitName = iterUnitMap->second; - DEBUG_FATAL((unitName == nullptr), ("The unit should have a non-nullptr name.")); + DEBUG_FATAL((unitName == NULL), ("The unit should have a non-null name.")); if (unit == m_leader) { @@ -401,7 +401,7 @@ void Squad::buildFormation() #ifdef DEBUG Object * const unitObject = NetworkIdManager::getObjectById(unit); DEBUG_WARNING(true, ("className(%s) Unable to find the ship(%s) [%s] in the formation priority list.", - getClassName(), unitName->getString(), unitObject ? unitObject->getDebugInformation().c_str() : "nullptr")); + getClassName(), unitName->getString(), unitObject ? unitObject->getDebugInformation().c_str() : "NULL")); #endif } @@ -463,7 +463,7 @@ void Squad::calculateSquadPosition_w() Object * const object = NetworkIdManager::getObjectById(unit); - if (object != nullptr) + if (object != NULL) { m_squadPosition_w += object->getPosition_w(); } diff --git a/engine/server/library/serverGame/src/shared/behavior/AiCreatureStateArchive.cpp b/engine/server/library/serverGame/src/shared/behavior/AiCreatureStateArchive.cpp index b6c5690b..08bba97e 100755 --- a/engine/server/library/serverGame/src/shared/behavior/AiCreatureStateArchive.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/AiCreatureStateArchive.cpp @@ -28,15 +28,15 @@ namespace Archive #ifdef _DEBUG Object * const object = NetworkIdManager::getObjectById(target.m_networkId); - if (object == nullptr) + if (object == NULL) { WARNING(true, ("AiCreatureStateArchive::get() Unable to resolve networkId(%s) to an Object", target.m_networkId.getValueString().c_str())); return; } - AICreatureController * const controller = (object != nullptr) ? AICreatureController::asAiCreatureController(object->getController()) : nullptr; + AICreatureController * const controller = (object != NULL) ? AICreatureController::asAiCreatureController(object->getController()) : NULL; - if (controller == nullptr) + if (controller == NULL) { WARNING(true, ("AiCreatureStateArchive::get() Message to object(%s) that does not have an AICreatureController", object->getDebugInformation().c_str())); return; diff --git a/engine/server/library/serverGame/src/shared/behavior/AiLocation.cpp b/engine/server/library/serverGame/src/shared/behavior/AiLocation.cpp index d73f1f43..885657b9 100755 --- a/engine/server/library/serverGame/src/shared/behavior/AiLocation.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/AiLocation.cpp @@ -43,9 +43,9 @@ namespace AiLocationArchive AiLocation::AiLocation ( void ) : m_valid(false), m_attached(false), - m_object(nullptr), + m_object(NULL), m_objectId(), - m_cellObject(nullptr), + m_cellObject(NULL), m_position_p(Vector::zero), m_position_w(Vector::zero), m_radius(0.0f), @@ -60,9 +60,9 @@ AiLocation::AiLocation ( void ) AiLocation::AiLocation ( CellProperty const * cell, Vector const & position, float radius ) : m_valid(true), m_attached(false), - m_object(nullptr), + m_object(NULL), m_objectId(), - m_cellObject(cell ? &cell->getOwner() : nullptr), + m_cellObject(cell ? &cell->getOwner() : NULL), m_position_p(position), m_position_w(CollisionUtils::transformToWorld(cell,position)), m_radius(radius), @@ -78,9 +78,9 @@ AiLocation::AiLocation ( CellProperty const * cell, Vector const & position, flo AiLocation::AiLocation ( NetworkId const & cellId, Vector const & position, float radius ) : m_valid(true), m_attached(false), - m_object(nullptr), + m_object(NULL), m_objectId(), - m_cellObject(nullptr), + m_cellObject(NULL), m_position_p(position), m_position_w(position), m_radius(radius), @@ -110,9 +110,9 @@ AiLocation::AiLocation ( NetworkId const & cellId, Vector const & position, floa AiLocation::AiLocation ( Object const * object ) : m_valid(true), m_attached(true), - m_object(nullptr), + m_object(NULL), m_objectId(), - m_cellObject(nullptr), + m_cellObject(NULL), m_position_p(Vector::zero), m_position_w(Vector::zero), m_radius(0.0f), @@ -129,9 +129,9 @@ AiLocation::AiLocation ( Object const * object ) AiLocation::AiLocation ( NetworkId const & objectId ) : m_valid(true), m_attached(true), - m_object(nullptr), + m_object(NULL), m_objectId(), - m_cellObject(nullptr), + m_cellObject(NULL), m_position_p(Vector::zero), m_position_w(Vector::zero), m_radius(0.0f), @@ -148,9 +148,9 @@ AiLocation::AiLocation ( NetworkId const & objectId ) AiLocation::AiLocation ( Object const * object, Vector const & offset, bool relativeOffset ) : m_valid(true), m_attached(true), - m_object(nullptr), + m_object(NULL), m_objectId(), - m_cellObject(nullptr), + m_cellObject(NULL), m_position_p(Vector::zero), m_position_w(Vector::zero), m_radius(0.0f), @@ -167,9 +167,9 @@ AiLocation::AiLocation ( Object const * object, Vector const & offset, bool rela AiLocation::AiLocation ( NetworkId const & objectId, Vector const & offset, bool relativeOffset ) : m_valid(true), m_attached(true), - m_object(nullptr), + m_object(NULL), m_objectId(), - m_cellObject(nullptr), + m_cellObject(NULL), m_position_p(Vector::zero), m_position_w(Vector::zero), m_radius(0.0f), @@ -365,7 +365,7 @@ void AiLocation::setObject ( Object const * object ) { if(m_attached) { - if (object == nullptr) + if (object == NULL) { clear(); return; @@ -385,7 +385,7 @@ void AiLocation::setObject ( Object const * object ) void AiLocation::detach ( void ) { - m_object = nullptr; + m_object = NULL; m_objectId = NetworkId::cms_invalid; m_attached = false; } @@ -394,7 +394,7 @@ void AiLocation::detach ( void ) CellProperty const * AiLocation::getCell ( void ) const { - return m_cellObject ? m_cellObject->getCellProperty() : nullptr; + return m_cellObject ? m_cellObject->getCellProperty() : NULL; } // ---------- @@ -424,7 +424,7 @@ bool AiLocation::hasChanged ( void ) const Vector AiLocation::getPosition_p ( void ) const { - if(m_cellObject.getPointer() == nullptr) + if(m_cellObject.getPointer() == NULL) { WARNING(ConfigServerGame::getReportAiWarnings(),("AiLocation::getPosition_p - Locations's parent cell has disappeared\n")); @@ -572,8 +572,8 @@ void AiLocation::clear ( void ) m_valid = false; m_attached = false; - m_object = nullptr; - m_cellObject = nullptr; + m_object = NULL; + m_cellObject = NULL; m_position_p = Vector::zero; m_radius = 0.0f; m_offset_p = Vector::zero; @@ -585,7 +585,7 @@ void AiLocation::clear ( void ) bool AiLocation::isInWorldCell ( void ) const { - return isValid() && ( (getCell() == nullptr) || (getCell() == CellProperty::getWorldCellProperty()) ); + return isValid() && ( (getCell() == NULL) || (getCell() == CellProperty::getWorldCellProperty()) ); } @@ -599,7 +599,7 @@ bool AiLocation::validate ( void ) const TerrainObject * terrain = TerrainObject::getInstance(); - if(terrain == nullptr) return true; + if(terrain == NULL) return true; float w = terrain->getMapWidthInMeters() / 2.0f; diff --git a/engine/server/library/serverGame/src/shared/behavior/AiShipAttackTargetList.cpp b/engine/server/library/serverGame/src/shared/behavior/AiShipAttackTargetList.cpp index 9af5e0c8..08958488 100755 --- a/engine/server/library/serverGame/src/shared/behavior/AiShipAttackTargetList.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/AiShipAttackTargetList.cpp @@ -159,7 +159,7 @@ void AiShipAttackTargetList::add(ShipObject & unit, float const damage) AiShipController * const ownerAiShipController = AiShipController::asAiShipController(m_owner->getController()); - if (ownerAiShipController != nullptr) + if (ownerAiShipController != NULL) { if (!ownerAiShipController->isValidTarget(unit)) { @@ -204,7 +204,7 @@ void AiShipAttackTargetList::add(ShipObject & unit, float const damage) ShipController * const attackingUnitShipController = unit.getController()->asShipController(); - if (attackingUnitShipController != nullptr) + if (attackingUnitShipController != NULL) { attackingUnitShipController->addAiTargetingMe(m_owner->getNetworkId()); } @@ -217,7 +217,7 @@ void AiShipAttackTargetList::add(ShipObject & unit, float const damage) // ---------------------------------------------------------------------- bool AiShipAttackTargetList::remove(NetworkId const & unit, bool const inDestructorHack) { - DEBUG_FATAL((unit == NetworkId::cms_invalid), ("Removing a nullptr unit")); + DEBUG_FATAL((unit == NetworkId::cms_invalid), ("Removing a NULL unit")); bool result = false; @@ -238,11 +238,11 @@ bool AiShipAttackTargetList::remove(NetworkId const & unit, bool const inDestruc // Tell this unit that we are no longer targeting it - if (object != nullptr) + if (object != NULL) { ShipController * const shipController = object->getController()->asShipController(); - if (shipController != nullptr) + if (shipController != NULL) { shipController->removeAiTargetingMe(m_owner->getNetworkId()); } @@ -398,12 +398,12 @@ void AiShipAttackTargetList::findNewPrimaryTarget() // We should only have ship objects in our target list - if (m_primaryTarget.getObject() != nullptr) + if (m_primaryTarget.getObject() != NULL) { ServerObject * const targetServerObject = m_primaryTarget.getObject()->asServerObject(); - ShipObject * const targetShipObject = (targetServerObject != nullptr) ? targetServerObject->asShipObject() : nullptr; + ShipObject * const targetShipObject = (targetServerObject != NULL) ? targetServerObject->asShipObject() : NULL; - if (targetShipObject == nullptr) + if (targetShipObject == NULL) { DEBUG_WARNING(true, ("debug_ai: AiShipAttackTargetList::findNewPrimaryTarget() ERROR: How did we get a target that is not a ShipObject (%s)", m_primaryTarget.getObject()->getDebugInformation().c_str())); } @@ -444,7 +444,7 @@ void AiShipAttackTargetList::verify() AiShipController * const ownerAiShipController = AiShipController::asAiShipController(m_owner->getController()); - if (ownerAiShipController != nullptr) + if (ownerAiShipController != NULL) { if (ownerAiShipController->hasExclusiveAggros()) { @@ -457,9 +457,9 @@ void AiShipAttackTargetList::verify() for (; iterTargetList != m_targetList->end(); ++iterTargetList) { ShipObject * const unitShipObject = ShipObject::asShipObject(iterTargetList->first.getObject()); - CreatureObject const * const unitPilot = (unitShipObject != nullptr) ? unitShipObject->getPilot() : nullptr; + CreatureObject const * const unitPilot = (unitShipObject != NULL) ? unitShipObject->getPilot() : NULL; - if ( (unitPilot == nullptr) + if ( (unitPilot == NULL) || !ownerAiShipController->isExclusiveAggro(*unitPilot)) { s_purgeList.push_back(unitShipObject->getNetworkId()); diff --git a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackBomber.cpp b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackBomber.cpp index 58e90c58..239342d3 100755 --- a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackBomber.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackBomber.cpp @@ -56,7 +56,7 @@ AiShipBehaviorAttackBomber::AiShipBehaviorAttackBomber(AiShipController & aiShip m_evadeChangeDirectionTimer(0.5f), m_missilesFired(0) { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackBomber::AiShipBehaviorAttackBomber() unit(%s)", (aiShipController.getOwner() != nullptr) ? aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner")); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackBomber::AiShipBehaviorAttackBomber() unit(%s)", (aiShipController.getOwner() != NULL) ? aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner")); } // ---------------------------------------------------------------------- @@ -73,7 +73,7 @@ AiShipBehaviorAttackBomber::AiShipBehaviorAttackBomber(AiShipBehaviorAttack cons m_evadeChangeDirectionTimer(0.5f), m_missilesFired(0) { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackBomber::AiShipBehaviorAttackBomber(AiShipBehaviorAttack &) unit(%s)", (m_aiShipController.getOwner() != nullptr) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner")); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackBomber::AiShipBehaviorAttackBomber(AiShipBehaviorAttack &) unit(%s)", (m_aiShipController.getOwner() != NULL) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner")); } // ---------------------------------------------------------------------- @@ -293,7 +293,7 @@ ShipObject const * AiShipBehaviorAttackBomber::getTargetCapitalShip() const return targetShipObject; } - return nullptr; + return NULL; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackCapitalShip.cpp b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackCapitalShip.cpp index a1fe30da..d771b837 100755 --- a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackCapitalShip.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackCapitalShip.cpp @@ -19,7 +19,7 @@ AiShipBehaviorAttackCapitalShip::AiShipBehaviorAttackCapitalShip(AiShipController & aiShipController) : AiShipBehaviorAttack(aiShipController) { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackCapitalShip::AiShipBehaviorAttackCapitalShip() unit(%s)", (m_aiShipController.getOwner() != nullptr) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner")); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackCapitalShip::AiShipBehaviorAttackCapitalShip() unit(%s)", (m_aiShipController.getOwner() != NULL) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner")); } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackFighter.cpp b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackFighter.cpp index d43510a4..166eda11 100755 --- a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackFighter.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackFighter.cpp @@ -145,7 +145,7 @@ Vector const AiShipBehaviorAttackFighter::calculateEvadePositionWithinLeashDista AiShipBehaviorAttackFighter::AiShipBehaviorAttackFighter(AiShipController & aiShipController) : AiShipBehaviorAttack(aiShipController) - , m_currentManeuver(nullptr) + , m_currentManeuver(NULL) , m_timeDelta(0.0f) , m_projectileTimer() , m_missileLockOnTimer() @@ -165,7 +165,7 @@ AiShipBehaviorAttackFighter::AiShipBehaviorAttackFighter(AiShipController & aiSh , m_shotErrorPosition_l() , m_nextShotPosition_w() { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackFighter::AiShipBehaviorAttackFighter() unit(%s)", (aiShipController.getOwner() != nullptr) ? aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner")); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackFighter::AiShipBehaviorAttackFighter() unit(%s)", (aiShipController.getOwner() != NULL) ? aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner")); initializeTimers(); calculateEvadeHealthPercent(); calculateNextProjectileShotPerfect(); @@ -178,7 +178,7 @@ AiShipBehaviorAttackFighter::AiShipBehaviorAttackFighter(AiShipController & aiSh AiShipBehaviorAttackFighter::AiShipBehaviorAttackFighter(AiShipBehaviorAttack const & sourceBehavior) : AiShipBehaviorAttack(sourceBehavior) - , m_currentManeuver(nullptr) + , m_currentManeuver(NULL) , m_timeDelta(0.0f) , m_projectileTimer() , m_missileLockOnTimer() @@ -198,7 +198,7 @@ AiShipBehaviorAttackFighter::AiShipBehaviorAttackFighter(AiShipBehaviorAttack co , m_shotErrorPosition_l() , m_nextShotPosition_w() { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackFighter::AiShipBehaviorAttackFighter() unit(%s)", (getAiShipController().getOwner() != nullptr) ? getAiShipController().getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner")); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackFighter::AiShipBehaviorAttackFighter() unit(%s)", (getAiShipController().getOwner() != NULL) ? getAiShipController().getOwner()->getNetworkId().getValueString().c_str() : "NULL owner")); initializeTimers(); calculateEvadeHealthPercent(); calculateNextProjectileShotPerfect(); @@ -214,7 +214,7 @@ AiShipBehaviorAttackFighter::~AiShipBehaviorAttackFighter() delete m_targetInfo; delete m_currentManeuver; - m_currentManeuver = nullptr; + m_currentManeuver = NULL; } // ---------------------------------------------------------------------- @@ -265,7 +265,7 @@ void AiShipBehaviorAttackFighter::alterManeuver() } else { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackFighter::alterManeuver() owner(%s) Why does this ship in the attack state with a nullptr attack target?", getAiShipController().getOwner()->getNetworkId().getValueString().c_str())); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackFighter::alterManeuver() owner(%s) Why does this ship in the attack state with a NULL attack target?", getAiShipController().getOwner()->getNetworkId().getValueString().c_str())); } if (overallHealthPercent > m_lastEvadeHealthPercent) @@ -347,7 +347,7 @@ void AiShipBehaviorAttackFighter::alterWeapons() if (!targetShipObject) { - DEBUG_WARNING(true, ("debug_ai: unit(%s) ERROR: Why is the primary attack target nullptr?", getAiShipController().getShipOwner()->getDebugInformation().c_str())); + DEBUG_WARNING(true, ("debug_ai: unit(%s) ERROR: Why is the primary attack target NULL?", getAiShipController().getShipOwner()->getDebugInformation().c_str())); return; } @@ -584,7 +584,7 @@ void AiShipBehaviorAttackFighter::alterTargetInformation() ShipObject & ownerShipObject = *NON_NULL(getAiShipController().getShipOwner()); ShipObject const * const targetShipObject = getAiShipController().getPrimaryAttackTargetShipObject(); - if (targetShipObject != nullptr) + if (targetShipObject != NULL) { //-- Set pilot data here. AiShipPilotData const * pilotData = NON_NULL(getAiShipController().getPilotData()); @@ -600,7 +600,7 @@ void AiShipBehaviorAttackFighter::alterTargetInformation() CreatureObject const * const targetPilot = targetShipObject->getPilot(); - m_targetInfo->m_playerControlled = (targetPilot != nullptr) ? targetPilot->isPlayerControlled() : false; + m_targetInfo->m_playerControlled = (targetPilot != NULL) ? targetPilot->isPlayerControlled() : false; // Cached target info. bool const includeMissiles = true; @@ -707,7 +707,7 @@ void AiShipBehaviorAttackFighter::alterTargetInformation() } else { - DEBUG_WARNING(true, ("debug_ai: unit(%s) ERROR: The primary attack target is nullptr.", ownerShipObject.getDebugInformation().c_str())); + DEBUG_WARNING(true, ("debug_ai: unit(%s) ERROR: The primary attack target is NULL.", ownerShipObject.getDebugInformation().c_str())); } } @@ -956,7 +956,7 @@ void AiShipBehaviorAttackFighter::calculateNextShotPosition_w() if (!targetShipObject) { - DEBUG_WARNING(true, ("debug_ai: unit(%s) ERROR: Why is the primary attack target nullptr?", getAiShipController().getShipOwner()->getDebugInformation().c_str())); + DEBUG_WARNING(true, ("debug_ai: unit(%s) ERROR: Why is the primary attack target NULL?", getAiShipController().getShipOwner()->getDebugInformation().c_str())); return; } @@ -1014,7 +1014,7 @@ void AiShipBehaviorAttackFighter::addDebug(AiDebugString & aiDebugString) AiShipBehaviorAttackFighter::Maneuver::Path const * path = m_currentManeuver->getCurrentPath(); char pathSizeText[256]; - if (path != nullptr) + if (path != NULL) { snprintf(pathSizeText, sizeof(pathSizeText) - 1, "PATH(%d)", path->getLength()); } @@ -1027,7 +1027,7 @@ void AiShipBehaviorAttackFighter::addDebug(AiDebugString & aiDebugString) // Show the current maneuver { - char const * const text = FormattedString<512>().sprintf("attack[%s%s%s] %d %s\n", AiDebugString::getColorCode(PackedRgb::solidWhite).c_str(), (m_currentManeuver != nullptr) ? m_currentManeuver->getFighterManeuverString() : "nullptr", AiDebugString::getResetColorCode(), (m_currentManeuver != nullptr) ? m_currentManeuver->getSequenceId() : -1, pathSizeText); + char const * const text = FormattedString<512>().sprintf("attack[%s%s%s] %d %s\n", AiDebugString::getColorCode(PackedRgb::solidWhite).c_str(), (m_currentManeuver != NULL) ? m_currentManeuver->getFighterManeuverString() : "NULL", AiDebugString::getResetColorCode(), (m_currentManeuver != NULL) ? m_currentManeuver->getSequenceId() : -1, pathSizeText); aiDebugString.addText(text, PackedRgb::solidCyan); } @@ -1060,7 +1060,7 @@ void AiShipBehaviorAttackFighter::addDebug(AiDebugString & aiDebugString) // Show the maneuver path - if ( (path != nullptr) + if ( (path != NULL) && !path->isEmpty()) { AiDebugString::TransformList transformList; diff --git a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackFighter_Maneuver.cpp b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackFighter_Maneuver.cpp index c3b9d975..17fa39ea 100755 --- a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackFighter_Maneuver.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackFighter_Maneuver.cpp @@ -72,7 +72,7 @@ AiShipBehaviorAttackFighter::Maneuver::~Maneuver() delete m_pathList; - //m_currentPath = nullptr; + //m_currentPath = NULL; } // ---------------------------------------------------------------------- @@ -128,7 +128,7 @@ void AiShipBehaviorAttackFighter::Maneuver::addPath(Path * const path) AiShipBehaviorAttackFighter::Maneuver::Path * AiShipBehaviorAttackFighter::Maneuver::getCurrentPath() { - Path * currentPath = nullptr; + Path * currentPath = NULL; if (!m_pathList->empty() && m_currentPath != m_pathList->end()) { @@ -230,7 +230,7 @@ void AiShipBehaviorAttackFighter::Maneuver::alterThrottle(float const /*timeDelt AiShipBehaviorAttackFighter::Maneuver * AiShipBehaviorAttackFighter::Maneuver::createManeuver(FighterManeuver const manueverType, AiShipBehaviorAttackFighter & aiShipBehaviorAttack, AiAttackTargetInformation const & targetInfo) { - Maneuver * aiManeuver = nullptr; + Maneuver * aiManeuver = NULL; switch(manueverType) { @@ -298,7 +298,7 @@ public: ShipObject const * const primaryTargetShipObject = getAiShipController().getPrimaryAttackTargetShipObject(); - if (primaryTargetShipObject != nullptr) + if (primaryTargetShipObject != NULL) { float const ownerShipRadius = getAiShipController().getShipOwner()->getRadius(); float const ownerTurnRadius = getAiShipController().getLargestTurnRadius(); @@ -337,7 +337,7 @@ protected: ShipObject const * const primaryTargetShipObject = getAiShipController().getPrimaryAttackTargetShipObject(); - if (primaryTargetShipObject != nullptr) + if (primaryTargetShipObject != NULL) { bool const facingTarget = m_aiShipBehaviorAttack.isFacingTarget(); @@ -450,7 +450,7 @@ private: { ShipObject const * const primaryTargetShipObject = getAiShipController().getPrimaryAttackTargetShipObject(); - if (primaryTargetShipObject != nullptr) + if (primaryTargetShipObject != NULL) { AiShipPilotData const & pilotData = *NON_NULL(getAiShipController().getPilotData()); float const currentSpeed = getAiShipController().getShipOwner()->getCurrentSpeed(); @@ -665,11 +665,11 @@ private: { ShipObject const * const primaryTargetShipObject = getAiShipController().getPrimaryAttackTargetShipObject(); - if (primaryTargetShipObject!= nullptr) + if (primaryTargetShipObject!= NULL) { ShipController const * const targetShipController = primaryTargetShipObject->getController()->asShipController(); - if (targetShipController != nullptr) + if (targetShipController != NULL) { Transform transform; Vector velocity; diff --git a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorDock.cpp b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorDock.cpp index f023331c..e8c1aede 100755 --- a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorDock.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorDock.cpp @@ -66,7 +66,7 @@ AiShipBehaviorDock::AiShipBehaviorDock(ShipController & shipController, ShipObje , m_goalPosition_w() , m_wingsOpenedBeforeDock(m_shipController.getShipOwner()->hasWings() && m_shipController.getShipOwner()->wingsOpened()) { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipBehaviorDock: [1/6] unit(%s) dockTarget(%s) secondsAtDock(%.2f) landingHardPoint(%s)", (shipController.getOwner() != nullptr) ? shipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner", dockTarget.getNetworkId().getValueString().c_str(), secondsAtDock, m_hasLandingHardPoint ? "yes" : "no")); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipBehaviorDock: [1/6] unit(%s) dockTarget(%s) secondsAtDock(%.2f) landingHardPoint(%s)", (shipController.getOwner() != NULL) ? shipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner", dockTarget.getNetworkId().getValueString().c_str(), secondsAtDock, m_hasLandingHardPoint ? "yes" : "no")); if (m_shipController.isBeingDocked()) { @@ -119,7 +119,7 @@ AiShipBehaviorDock::AiShipBehaviorDock(ShipController & shipController, ShipObje ShipController * const dockTargetShipController = dockTarget.getController()->asShipController(); - if (dockTargetShipController != nullptr) + if (dockTargetShipController != NULL) { dockTargetShipController->addDockedBy(*shipController.getOwner()); } @@ -146,7 +146,7 @@ AiShipBehaviorDock::AiShipBehaviorDock(ShipController & shipController, ShipObje m_initialApproachHardPointCount = static_cast(m_approachHardPointList->size()); - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipBehaviorDock() unit(%s) dockTarget(%s) approachHardPointCount(%u) exitHardPointCount(%u)", (shipController.getOwner() != nullptr) ? shipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner", dockTarget.getNetworkId().getValueString().c_str(), m_approachHardPointList->size(), m_exitHardPointList->size())); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipBehaviorDock() unit(%s) dockTarget(%s) approachHardPointCount(%u) exitHardPointCount(%u)", (shipController.getOwner() != NULL) ? shipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner", dockTarget.getNetworkId().getValueString().c_str(), m_approachHardPointList->size(), m_exitHardPointList->size())); } // ---------------------------------------------------------------------- @@ -156,7 +156,7 @@ AiShipBehaviorDock::~AiShipBehaviorDock() // Open the wings - if ( (ownerShipObject != nullptr) + if ( (ownerShipObject != NULL) && m_wingsOpenedBeforeDock) { m_shipController.getShipOwner()->openWings(); @@ -168,7 +168,7 @@ AiShipBehaviorDock::~AiShipBehaviorDock() { CollisionCallbackManager::removeIgnoreIntersect(m_shipController.getOwner()->getNetworkId(), m_dockTarget); - if ( (ownerShipObject != nullptr) + if ( (ownerShipObject != NULL) && ownerShipObject->isPlayerShip()) { m_shipController.appendMessage(CM_removeIgnoreIntersect, 0.0f, new MessageQueueGenericValueType(m_dockTarget), GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_CLIENT); @@ -179,11 +179,11 @@ AiShipBehaviorDock::~AiShipBehaviorDock() Object * const dockTarget = m_dockTarget.getObject(); - if (dockTarget != nullptr) + if (dockTarget != NULL) { ShipController * const dockTargetShipController = dockTarget->getController()->asShipController(); - if (dockTargetShipController != nullptr) + if (dockTargetShipController != NULL) { dockTargetShipController->removeDockedBy(*m_shipController.getOwner()); } @@ -200,7 +200,7 @@ void AiShipBehaviorDock::alter(float deltaSeconds) bool abortDocking = false; - if (m_dockTarget.getObject() == nullptr) + if (m_dockTarget.getObject() == NULL) { // If we lose the dock target, fail the docking procedure. @@ -213,7 +213,7 @@ void AiShipBehaviorDock::alter(float deltaSeconds) AiShipController * const dockTargetAiShipController = AiShipController::asAiShipController(m_dockTarget.getObject()->getController()); - if ( (dockTargetAiShipController != nullptr) + if ( (dockTargetAiShipController != NULL) && dockTargetAiShipController->isAttacking()) { LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipBehaviorDock::alter() unit(%s) dockTarget(%s) DOCK TARGET IS ATTACKING...UNDOCKING", m_shipController.getOwner()->getDebugInformation().c_str(), m_dockTarget.getValueString().c_str())); @@ -478,7 +478,7 @@ void AiShipBehaviorDock::triggerDocked() GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(m_shipController.getOwner()); - if(gameScriptObject != nullptr) + if(gameScriptObject != NULL) { ScriptParams scriptParams; scriptParams.addParam(m_dockTarget); @@ -499,7 +499,7 @@ void AiShipBehaviorDock::triggerStartUnDock() GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(m_shipController.getOwner()); - if(gameScriptObject != nullptr) + if(gameScriptObject != NULL) { ScriptParams scriptParams; scriptParams.addParam(m_dockTarget); @@ -520,7 +520,7 @@ void AiShipBehaviorDock::triggerUnDockWithSuccess() GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(m_shipController.getOwner()); - if(gameScriptObject != nullptr) + if(gameScriptObject != NULL) { ScriptParams scriptParams; scriptParams.addParam(m_dockTarget); @@ -542,7 +542,7 @@ void AiShipBehaviorDock::triggerUnDockWithFailure() GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(m_shipController.getOwner()); - if(gameScriptObject != nullptr) + if(gameScriptObject != NULL) { ScriptParams scriptParams; scriptParams.addParam(m_dockTarget); @@ -622,7 +622,7 @@ float AiShipBehaviorDock::getMaxTractorBeamSpeed() const float const shipActualSpeedMaximum = m_shipController.getShipOwner()->getShipActualSpeedMaximum(); AiShipController * const aiShipController = m_shipController.asAiShipController(); - return (aiShipController != nullptr) ? (shipActualSpeedMaximum * aiShipController->getPilotData()->m_nonCombatMaxSpeedPercent) : shipActualSpeedMaximum; + return (aiShipController != NULL) ? (shipActualSpeedMaximum * aiShipController->getPilotData()->m_nonCombatMaxSpeedPercent) : shipActualSpeedMaximum; } // ---------------------------------------------------------------------- @@ -676,7 +676,7 @@ void AiShipBehaviorDock::addDebug(AiDebugString & aiDebugString) aiDebugString.addLineToPosition(m_goalPosition_w, PackedRgb::solidCyan); - if (m_dockTarget.getObject() != nullptr) + if (m_dockTarget.getObject() != NULL) { Transform transform; transform.multiply(m_dockTarget.getObject()->getTransform_o2w(), m_dockHardPoint); diff --git a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorFollow.cpp b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorFollow.cpp index e8ca1bd5..dedc3fda 100755 --- a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorFollow.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorFollow.cpp @@ -45,9 +45,9 @@ AiShipBehaviorFollow::AiShipBehaviorFollow(AiShipController & aiShipController, , m_followedUnit(followedUnit) , m_followedUnitLost(false) { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorFollow::AiShipBehaviorFollow() unit(%s) followedUnit(%s)", (m_aiShipController.getOwner() != nullptr) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner", followedUnit.getValueString().c_str())); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorFollow::AiShipBehaviorFollow() unit(%s) followedUnit(%s)", (m_aiShipController.getOwner() != NULL) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner", followedUnit.getValueString().c_str())); - DEBUG_WARNING((m_followedUnit.getObject() == nullptr), ("Trying to follow a nullptr object.")); + DEBUG_WARNING((m_followedUnit.getObject() == NULL), ("Trying to follow a NULL object.")); } // ---------------------------------------------------------------------- @@ -60,7 +60,7 @@ void AiShipBehaviorFollow::alter(float const deltaSeconds) Object * const followedUnitObject = m_followedUnit.getObject(); Vector goalPosition_w; - if (followedUnitObject != nullptr) + if (followedUnitObject != NULL) { goalPosition_w = Formation::getPosition_w(followedUnitObject->getTransform_o2w(), m_aiShipController.getFormationPosition_l()); @@ -69,9 +69,9 @@ void AiShipBehaviorFollow::alter(float const deltaSeconds) if (m_aiShipController.getOwner()->getPosition_w().magnitudeBetweenSquared(goalPosition_w) > sqr(m_aiShipController.getLargestTurnRadius() * slowDownRequestRadiusGain)) { ShipController * const shipController = followedUnitObject->getController()->asShipController(); - AiShipController * const aiShipController = (shipController != nullptr) ? shipController->asAiShipController() : nullptr; + AiShipController * const aiShipController = (shipController != NULL) ? shipController->asAiShipController() : NULL; - if (aiShipController != nullptr) + if (aiShipController != NULL) { aiShipController->requestSlowDown(); } @@ -90,7 +90,7 @@ void AiShipBehaviorFollow::alter(float const deltaSeconds) Object const * const object = m_aiShipController.getOwner(); - if (object != nullptr) + if (object != NULL) { goalPosition_w = object->getPosition_w(); } @@ -109,10 +109,10 @@ void AiShipBehaviorFollow::alter(float const deltaSeconds) void AiShipBehaviorFollow::triggerFollowedUnitLost() { Object * object = m_aiShipController.getOwner(); - ServerObject *serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - GameScriptObject * gameScriptObject = (serverObject != nullptr) ? serverObject->getScriptObject() : nullptr; + ServerObject *serverObject = (object != NULL) ? object->asServerObject() : NULL; + GameScriptObject * gameScriptObject = (serverObject != NULL) ? serverObject->getScriptObject() : NULL; - if(gameScriptObject != nullptr) + if(gameScriptObject != NULL) { ScriptParams scriptParams; scriptParams.addParam(m_followedUnit); diff --git a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorIdle.cpp b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorIdle.cpp index 1654e5c8..14d8253c 100755 --- a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorIdle.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorIdle.cpp @@ -25,7 +25,7 @@ AiShipBehaviorIdle::AiShipBehaviorIdle(AiShipController & aiShipController) : AiShipBehaviorBase(aiShipController) { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorIdle() unit(%s)", (m_aiShipController.getOwner() != nullptr) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner")); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorIdle() unit(%s)", (m_aiShipController.getOwner() != NULL) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner")); } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorTrack.cpp b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorTrack.cpp index c1aa8506..68a47863 100755 --- a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorTrack.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorTrack.cpp @@ -27,7 +27,7 @@ AiShipBehaviorTrack::AiShipBehaviorTrack(AiShipController & aiShipController, Ob : AiShipBehaviorBase(aiShipController) , m_target(&target) { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorTrack() unit(%s) target(%s)", (m_aiShipController.getOwner() != nullptr) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner", target.getNetworkId().getValueString().c_str())); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorTrack() unit(%s) target(%s)", (m_aiShipController.getOwner() != NULL) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner", target.getNetworkId().getValueString().c_str())); } // ---------------------------------------------------------------------- @@ -36,7 +36,7 @@ void AiShipBehaviorTrack::alter(float deltaSeconds) { PROFILER_AUTO_BLOCK_DEFINE("AiShipBehaviorTrack::alter"); - if (m_target != nullptr) + if (m_target != NULL) { IGNORE_RETURN(m_aiShipController.face(m_target->getPosition_w(), deltaSeconds)); } diff --git a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorWaypoint.cpp b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorWaypoint.cpp index 6302a8f9..f68335b9 100755 --- a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorWaypoint.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorWaypoint.cpp @@ -35,7 +35,7 @@ AiShipBehaviorWaypoint::AiShipBehaviorWaypoint(AiShipController & aiShipControll , m_cyclic(cyclic) , m_moveToCompleteTriggerSent(false) { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorWaypoint::AiShipBehaviorWaypoint() unit(%s) cyclic(%s)", (aiShipController.getOwner() != nullptr) ? aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner", cyclic ? "yes" : "no")); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorWaypoint::AiShipBehaviorWaypoint() unit(%s) cyclic(%s)", (aiShipController.getOwner() != NULL) ? aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner", cyclic ? "yes" : "no")); } // ---------------------------------------------------------------------- @@ -61,7 +61,7 @@ void AiShipBehaviorWaypoint::alter(float deltaSeconds) { SpacePath const * const path = m_aiShipController.getPath(); - if ( (path != nullptr) + if ( (path != NULL) && !m_cyclic && (m_aiShipController.getCurrentPathIndex() == (path->getTransformList().size() - 1))) { @@ -76,7 +76,7 @@ void AiShipBehaviorWaypoint::alter(float deltaSeconds) GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(m_aiShipController.getOwner()); - if(gameScriptObject != nullptr) + if(gameScriptObject != NULL) { ScriptParams scriptParams; IGNORE_RETURN(gameScriptObject->trigAllScripts(Scripting::TRIG_SPACE_UNIT_MOVE_TO_COMPLETE, scriptParams)); @@ -104,13 +104,13 @@ bool AiShipBehaviorWaypoint::getNextPosition_w(Vector & position_w) SpacePath * const path = m_aiShipController.getPath(); - if ( (path != nullptr) + if ( (path != NULL) && !path->isEmpty() && (m_aiShipController.getCurrentPathIndex() < path->getTransformList().size())) { ShipObject const * const shipObject = m_aiShipController.getShipOwner(); - if (shipObject != nullptr) + if (shipObject != NULL) { SpacePath::TransformList const & transformList = path->getTransformList(); Vector const & nextPosition = getGoalPosition_w(); @@ -166,7 +166,7 @@ Vector AiShipBehaviorWaypoint::getGoalPosition_w() const SpacePath * const path = m_aiShipController.getPath(); - if ( (path != nullptr) + if ( (path != NULL) && !path->isEmpty()) { SpacePath::TransformList const & transformList = path->getTransformList(); @@ -245,7 +245,7 @@ void AiShipBehaviorWaypoint::addDebug(AiDebugString & aiDebugString) { SpacePath const * const path = m_aiShipController.getPath(); - if (path != nullptr) + if (path != NULL) { aiDebugString.addLineToPosition(m_aiShipController.getMoveToGoalPosition_w(), PackedRgb::solidGreen); aiDebugString.addCircle(m_aiShipController.getMoveToGoalPosition_w(), m_aiShipController.getLargestTurnRadius(), PackedRgb::solidGreen); diff --git a/engine/server/library/serverGame/src/shared/behavior/ShipTurretTargetingSystem.cpp b/engine/server/library/serverGame/src/shared/behavior/ShipTurretTargetingSystem.cpp index cf1af6f8..23cbc81f 100755 --- a/engine/server/library/serverGame/src/shared/behavior/ShipTurretTargetingSystem.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/ShipTurretTargetingSystem.cpp @@ -124,7 +124,7 @@ void ShipTurretTargetingSystem::onTargetLost(NetworkId const & target) ShipObject * const shipObject = NON_NULL(NON_NULL(NON_NULL(m_shipController.getOwner())->asServerObject())->asShipObject()); if (!shipObject) // for release builds { - WARNING(true,("Programmer bug: got a nullptr ShipObject in ShipTurretTargetingSystem::onTargetLost(). May indicate that the ShipObject has already been partially deconstructed.")); + WARNING(true,("Programmer bug: got a NULL ShipObject in ShipTurretTargetingSystem::onTargetLost(). May indicate that the ShipObject has already been partially deconstructed.")); return; } @@ -168,7 +168,7 @@ bool ShipTurretTargetingSystem::buildTargetList() bool result = false; m_targetList->clear(); - if (ownerShipController != nullptr) + if (ownerShipController != NULL) { if (!ownerShipController->getAttackTargetList().isEmpty()) { diff --git a/engine/server/library/serverGame/src/shared/collision/CollisionCallbacks.cpp b/engine/server/library/serverGame/src/shared/collision/CollisionCallbacks.cpp index 9bce1404..99c4f3cb 100755 --- a/engine/server/library/serverGame/src/shared/collision/CollisionCallbacks.cpp +++ b/engine/server/library/serverGame/src/shared/collision/CollisionCallbacks.cpp @@ -86,7 +86,7 @@ void CollisionCallbacksNamespace::remove() int CollisionCallbacksNamespace::convertObjectToIndex(Object * const object) { - FATAL(!object, ("CollisionCallbacksNamespace::convertObjectToIndex: object == nullptr.")); + FATAL(!object, ("CollisionCallbacksNamespace::convertObjectToIndex: object == NULL.")); ServerObject const * serverObject = object->asServerObject(); if (serverObject) @@ -99,11 +99,11 @@ int CollisionCallbacksNamespace::convertObjectToIndex(Object * const object) bool CollisionCallbacksNamespace::onHitDoCollisionWith(Object * const object, Object * const wasHitByThisObject) { - DEBUG_WARNING(!object, ("CollisionCallbacksNamespace::onHitDoCollisionWith: Object == nullptr")); - DEBUG_WARNING(!wasHitByThisObject, ("CollisionCallbacksNamespace::onHitDoCollisionWith: wasHitByThisObject == nullptr")); + DEBUG_WARNING(!object, ("CollisionCallbacksNamespace::onHitDoCollisionWith: Object == NULL")); + DEBUG_WARNING(!wasHitByThisObject, ("CollisionCallbacksNamespace::onHitDoCollisionWith: wasHitByThisObject == NULL")); ShipObject * shipObject = safe_cast(object); - DEBUG_WARNING(!shipObject, ("CollisionCallbacksNamespace::onHitDoCollisionWith: shipObject == nullptr")); + DEBUG_WARNING(!shipObject, ("CollisionCallbacksNamespace::onHitDoCollisionWith: shipObject == NULL")); CollisionCallbackManager::Result result; if (CollisionCallbackManager::intersectAndReflect(object, wasHitByThisObject, result)) @@ -123,10 +123,10 @@ bool CollisionCallbacksNamespace::onHitDoCollisionWith(Object * const object, Ob bool CollisionCallbacksNamespace::onDoCollisionWithTerrain(Object * const object) { - DEBUG_FATAL (!object, ("CollisionCallbacksNamespace::onDoCollisionWithTerrain: Object == nullptr")); + DEBUG_FATAL (!object, ("CollisionCallbacksNamespace::onDoCollisionWithTerrain: Object == NULL")); ShipObject * shipObject = safe_cast(object); - DEBUG_FATAL (!shipObject, ("CollisionCallbacksNamespace::onDoCollisionWithTerrain: shipObject == nullptr")); + DEBUG_FATAL (!shipObject, ("CollisionCallbacksNamespace::onDoCollisionWithTerrain: shipObject == NULL")); CollisionCallbackManager::Result result; if (CollisionCallbackManager::intersectAndReflectWithTerrain(object, result)) diff --git a/engine/server/library/serverGame/src/shared/command/CommandCppFuncs.cpp b/engine/server/library/serverGame/src/shared/command/CommandCppFuncs.cpp index f39fcae2..ff3f058c 100755 --- a/engine/server/library/serverGame/src/shared/command/CommandCppFuncs.cpp +++ b/engine/server/library/serverGame/src/shared/command/CommandCppFuncs.cpp @@ -145,13 +145,13 @@ namespace CommandCppFuncsNamespace void internalSetBoosterOnOff(NetworkId const & actor, bool onOff) { ServerObject * const actorServerObj = safe_cast(NetworkIdManager::getObjectById(actor)); - CreatureObject * const actorCreature = actorServerObj != nullptr ? actorServerObj->asCreatureObject() : nullptr; + CreatureObject * const actorCreature = actorServerObj != NULL ? actorServerObj->asCreatureObject() : NULL; - if (actorCreature == nullptr) + if (actorCreature == NULL) return; ShipObject * const shipObject = actorCreature->getPilotedShip(); - if (shipObject == nullptr) + if (shipObject == NULL) return; if (!shipObject->isSlotInstalled(ShipChassisSlotType::SCST_booster)) @@ -212,22 +212,22 @@ namespace CommandCppFuncsNamespace CreatureObject * findAndResolveCreatureByNetworkId(NetworkId const & targetId) { - CreatureObject * targetCreatureObject = nullptr; + CreatureObject * targetCreatureObject = NULL; { // find the target. the target could be either a creature or ship ServerObject * const serverObject = ServerWorld::findObjectByNetworkId(targetId); - targetCreatureObject = (serverObject != nullptr) ? serverObject->asCreatureObject() : nullptr; + targetCreatureObject = (serverObject != NULL) ? serverObject->asCreatureObject() : NULL; - if (targetCreatureObject == nullptr) + if (targetCreatureObject == NULL) { - ShipObject * const shipObject = (serverObject != nullptr) ? serverObject->asShipObject() : nullptr; + ShipObject * const shipObject = (serverObject != NULL) ? serverObject->asShipObject() : NULL; - if (shipObject != nullptr) + if (shipObject != NULL) { targetCreatureObject = shipObject->getPilot(); - if (targetCreatureObject == nullptr) + if (targetCreatureObject == NULL) { // this means that it is a POB ship that doesn't have a pilot // in this case we find the owner @@ -237,7 +237,7 @@ namespace CommandCppFuncsNamespace std::vector::const_iterator ii = passengers.begin(); std::vector::const_iterator iiEnd = passengers.end(); - for (; ii != iiEnd && targetCreatureObject == nullptr; ++ii) + for (; ii != iiEnd && targetCreatureObject == NULL; ++ii) { if ((*ii)->getNetworkId() == shipObject->getOwnerId()) { @@ -290,7 +290,7 @@ namespace CommandCppFuncsNamespace Container::ContainerErrorCode errorCode = Container::CEC_Success; for (std::vector >::const_iterator i = oldItems.begin(); i != oldItems.end(); ++i) { - IGNORE_RETURN(ContainerInterface::transferItemToSlottedContainer(destination, *((*i).first), (*i).second, nullptr, errorCode)); + IGNORE_RETURN(ContainerInterface::transferItemToSlottedContainer(destination, *((*i).first), (*i).second, NULL, errorCode)); } } @@ -411,7 +411,7 @@ void CommandCppFuncsNamespace::triggerSpaceEjectPlayerFromShip(CreatureObject * { if (creatureObject == 0) { - WARNING(true, ("CommandCppFuncsNamespace::triggerSpaceEjectPlayerFromShip: nullptr CreatureObject.")); + WARNING(true, ("CommandCppFuncsNamespace::triggerSpaceEjectPlayerFromShip: NULL CreatureObject.")); return; } @@ -424,7 +424,7 @@ void CommandCppFuncsNamespace::triggerSpaceEjectPlayerFromShip(CreatureObject * } else { - WARNING(true, ("CommandCppFuncsNamespace::triggerSpaceEjectPlayerFromShip: nullptr ScriptObject.")); + WARNING(true, ("CommandCppFuncsNamespace::triggerSpaceEjectPlayerFromShip: NULL ScriptObject.")); } } @@ -432,7 +432,7 @@ void CommandCppFuncsNamespace::triggerSpaceEjectPlayerFromShip(CreatureObject * TravelPoint const * CommandCppFuncsNamespace::GroupHelpers::getNearestTravelPoint(std::string const & planetName, Vector const & location, std::vector const & cityBanList, uint32 faction, bool starPortAndShuttleportOnly) { - TravelPoint const * nearestTravelPoint = nullptr; + TravelPoint const * nearestTravelPoint = NULL; PlanetObject const * const planetObject = ServerUniverse::getInstance().getPlanetByName(planetName); if (planetObject) { @@ -537,7 +537,7 @@ static NetworkId nextOidParm(Unicode::String const &str, size_t &curpos) static float nextFloatParm(Unicode::String const &str, size_t &curpos) { - return static_cast(strtod(nextStringParm(str, curpos).c_str(), nullptr)); + return static_cast(strtod(nextStringParm(str, curpos).c_str(), NULL)); } @@ -821,7 +821,7 @@ static void commandFuncLocateStructure(Command const &, NetworkId const &actor, ownerId = actor; } - int const timeNow = static_cast(::time(nullptr)); + int const timeNow = static_cast(::time(NULL)); if (!isGod && actorObj->getObjVars().hasItem("timeNextLocateStructureCommandAllowed") && (actorObj->getObjVars().getType("timeNextLocateStructureCommandAllowed") == DynamicVariable::INT)) { int timeNextLocateStructureCommandAllowed = 0; @@ -889,7 +889,7 @@ static void commandFuncLocateVendor(Command const &, NetworkId const &actor, Net ownerId = actor; } - int const timeNow = static_cast(::time(nullptr)); + int const timeNow = static_cast(::time(NULL)); if (!isGod && actorObj->getObjVars().hasItem("timeNextLocateVendorCommandAllowed") && (actorObj->getObjVars().getType("timeNextLocateVendorCommandAllowed") == DynamicVariable::INT)) { int timeNextLocateVendorCommandAllowed = 0; @@ -956,7 +956,7 @@ static void commandFuncShowCtsHistory(Command const &, NetworkId const &actor, N if (target != actor) { targetObj = dynamic_cast(ServerWorld::findObjectByNetworkId(target)); - targetPlayerObj = (targetObj ? PlayerCreatureController::getPlayerObject(targetObj) : nullptr); + targetPlayerObj = (targetObj ? PlayerCreatureController::getPlayerObject(targetObj) : NULL); if (!targetPlayerObj) { ConsoleMgr::broadcastString(FormattedString<1024>().sprintf("%s is not a valid or nearby player character.", target.getValueString().c_str()), clientObj); @@ -980,7 +980,7 @@ static void commandFuncShowCtsHistory(Command const &, NetworkId const &actor, N if (i.getValue(ctsTransactionDetail)) { Unicode::UnicodeStringVector tokens; - if (Unicode::tokenize(ctsTransactionDetail, tokens, nullptr, nullptr) && (tokens.size() >= 4)) + if (Unicode::tokenize(ctsTransactionDetail, tokens, NULL, NULL) && (tokens.size() >= 4)) { Unicode::String characterName; for (size_t i = 3, j = tokens.size(); i < j; ++i) @@ -1196,7 +1196,7 @@ static void commandFuncAdminEditBank(Command const &cmd, NetworkId const &actor, CreatureObject * targetCreature = safe_cast(ServerWorld::findObjectByNetworkId(target)); if (!targetCreature || !actorCreature) { - DEBUG_REPORT_LOG(true, ("Received open command for nullptr player or target.\n")); + DEBUG_REPORT_LOG(true, ("Received open command for null player or target.\n")); return; } @@ -1241,14 +1241,14 @@ static void commandFuncAdminEditStats(Command const &, NetworkId const &actor, N CreatureObject* const creatureActor = dynamic_cast(NetworkIdManager::getObjectById (actor)); if (!creatureActor) { - WARNING (true, ("commandFuncAdminEditStats: nullptr actor")); + WARNING (true, ("commandFuncAdminEditStats: null actor")); return; } CreatureObject* const creatureTarget = dynamic_cast(NetworkIdManager::getObjectById (target)); if (!creatureTarget) { - WARNING (true, ("commandFuncAdminEditStats: nullptr target")); + WARNING (true, ("commandFuncAdminEditStats: null target")); return; } @@ -1265,14 +1265,14 @@ static void commandFuncAdminEditAppearance(Command const &, NetworkId const &act CreatureObject* const creatureActor = dynamic_cast(NetworkIdManager::getObjectById (actor)); if (!creatureActor) { - WARNING (true, ("commandFuncAdminEditAppearance: nullptr actor")); + WARNING (true, ("commandFuncAdminEditAppearance: null actor")); return; } CreatureObject* const creatureTarget = dynamic_cast(NetworkIdManager::getObjectById (target)); if (!creatureTarget) { - WARNING (true, ("commandFuncAdminEditAppearance: nullptr target")); + WARNING (true, ("commandFuncAdminEditAppearance: null target")); return; } @@ -1819,7 +1819,7 @@ static void commandFuncSpatialChatInternal(Command const &, NetworkId const &act else if (!squelched && (ConfigServerGame::getChatSpamNotifyPlayerWhenLimitedIntervalSeconds() > 0) && obj->getClient()) { // send message telling character he can no longer talk - const int timeNow = static_cast(::time(nullptr)); + const int timeNow = static_cast(::time(NULL)); const int chatSpamTimeEndInterval = playerObject->getChatSpamTimeEndInterval(); if ((chatSpamTimeEndInterval > timeNow) && (timeNow >= playerObject->getChatSpamNextTimeToNotifyPlayerWhenLimited())) { @@ -1837,7 +1837,7 @@ static void commandFuncSpatialChatInternal(Command const &, NetworkId const &act // ---------------------------------------------------------------------- /** -* Parameters: [nullptr terminator + oob] +* Parameters: [null terminator + oob] * All parameters are strings */ @@ -1957,7 +1957,7 @@ static void commandFuncSpatialChat(Command const &, NetworkId const &actor, Netw else if (!squelched && (ConfigServerGame::getChatSpamNotifyPlayerWhenLimitedIntervalSeconds() > 0) && obj->getClient()) { // send message telling character he can no longer talk - const int timeNow = static_cast(::time(nullptr)); + const int timeNow = static_cast(::time(NULL)); const int chatSpamTimeEndInterval = playerObject->getChatSpamTimeEndInterval(); if ((chatSpamTimeEndInterval > timeNow) && (timeNow >= playerObject->getChatSpamNextTimeToNotifyPlayerWhenLimited())) { @@ -1992,7 +1992,7 @@ static void commandFuncCombatSpam (Command const &, NetworkId const &actor, Netw ServerObject * const obj = safe_cast(actorId.getObject ()); if (!obj) { - WARNING (true, ("nullptr actor in commandFuncCombatSpam")); + WARNING (true, ("null actor in commandFuncCombatSpam")); return; } @@ -2213,10 +2213,10 @@ static void commandFuncSetWaypointName(Command const &, NetworkId const & actor, static void commandSetPosture(Command const &command, NetworkId const &actor, NetworkId const &, Unicode::String const &) { CachedNetworkId actorId(actor); - if (actorId.getObject() != nullptr) + if (actorId.getObject() != NULL) { CreatureController * const controller = dynamic_cast(actorId.getObject()->getController()); - if (controller != nullptr) + if (controller != NULL) { CreatureObject * const creature = safe_cast(actorId.getObject()); NOT_NULL (creature); @@ -2247,15 +2247,15 @@ static void commandSetPosture(Command const &command, NetworkId const &actor, Ne static void commandFuncJumpServer(Command const &command, NetworkId const &actor, NetworkId const &, Unicode::String const &) { CachedNetworkId actorId(actor); - if (actorId.getObject() != nullptr) + if (actorId.getObject() != NULL) { CreatureController * const controller = dynamic_cast(actorId.getObject()->getController()); - if (controller != nullptr) + if (controller != NULL) { controller->appendMessage( CM_jump, 0.0f, - nullptr, + NULL, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_ALL_CLIENT @@ -2621,7 +2621,7 @@ static void commandFuncEndDuel(Command const &, NetworkId const &actor, NetworkI params.addParam(targetObj->getNetworkId(), "target"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != nullptr) + if (dictionary.get() != NULL) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(actorFlagObj->getNetworkId(), @@ -2634,7 +2634,7 @@ static void commandFuncEndDuel(Command const &, NetworkId const &actor, NetworkI params.addParam(actorFlagObj->getNetworkId(), "target"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != nullptr) + if (dictionary.get() != NULL) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(targetObj->getNetworkId(), @@ -2867,7 +2867,7 @@ static void commandFuncFactoryCrateSplit(Command const &, NetworkId const &actor const int amount = nextIntParm(params,pos); const CachedNetworkId destContainerId (nextOidParm(params,pos)); ServerObject * destContainer = safe_cast(destContainerId.getObject()); - if (destContainer == nullptr || ContainerInterface::getVolumeContainer(*destContainer) == nullptr) + if (destContainer == NULL || ContainerInterface::getVolumeContainer(*destContainer) == NULL) { ContainerInterface::sendContainerMessageToClient(*player, Container::CEC_NotFound); return; @@ -2878,7 +2878,7 @@ static void commandFuncFactoryCrateSplit(Command const &, NetworkId const &actor { ContainerInterface::sendContainerMessageToClient(*player, error, sourceObj); } - else if (sourceObj->makeCopy(*destContainer, amount) == nullptr) + else if (sourceObj->makeCopy(*destContainer, amount) == NULL) { ContainerInterface::sendContainerMessageToClient(*player, Container::CEC_Full, destContainer); @@ -2952,7 +2952,7 @@ static void commandFuncTransferItem(Command const &, NetworkId const &actor, Net if (!playerSo || !item) { - DEBUG_REPORT_LOG(true, ("Received transfer item command for nullptr player or target.\n")); + DEBUG_REPORT_LOG(true, ("Received transfer item command for null player or target.\n")); return; } @@ -3185,7 +3185,7 @@ static void commandFuncTransferItem(Command const &, NetworkId const &actor, Net retval = false; } - else if (destination == player->getAppearanceInventory() && ContainerInterface::getContainer(*item) != nullptr) + else if (destination == player->getAppearanceInventory() && ContainerInterface::getContainer(*item) != NULL) { const Container * itemContainer = ContainerInterface::getContainer(*item); if(itemContainer && itemContainer->getNumberOfItems() == 0) @@ -3215,7 +3215,7 @@ static void commandFuncTransferItem(Command const &, NetworkId const &actor, Net const SlottedContainer * equipment = ContainerInterface::getSlottedContainer(*player); const SlottedContainmentProperty * itemContainmentProperty = ContainerInterface::getSlottedContainmentProperty(*item); - if (inventory != nullptr && equipment != nullptr && itemContainmentProperty != nullptr) + if (inventory != NULL && equipment != NULL && itemContainmentProperty != NULL) { std::vector > oldItems; retval = true; @@ -3225,7 +3225,7 @@ static void commandFuncTransferItem(Command const &, NetworkId const &actor, Net SlotId slot = itemContainmentProperty->getSlotId(arrangement, i); const Container::ContainedItem & currentWeaponId = equipment->getObjectInSlot(slot, errorCode); ServerObject * oldItem = safe_cast(currentWeaponId.getObject()); - if (oldItem != nullptr) + if (oldItem != NULL) { if (ContainerInterface::transferItemToVolumeContainer(*inventory, *oldItem, player, errorCode, true)) { @@ -3280,7 +3280,7 @@ static void commandFuncTransferItem(Command const &, NetworkId const &actor, Net SlotId slot = itemContainmentProperty->getSlotId(arrangement, i); const Container::ContainedItem & currentWeaponId = equipment->getObjectInSlot(slot, errorCode); ServerObject * oldItem = safe_cast(currentWeaponId.getObject()); - if (oldItem != nullptr) + if (oldItem != NULL) { if( std::find(objectsToSend.begin(), objectsToSend.end(), oldItem) == objectsToSend.end() ) objectsToSend.push_back(oldItem); @@ -3291,7 +3291,7 @@ static void commandFuncTransferItem(Command const &, NetworkId const &actor, Net for(; iter != objectsToSend.end(); ++iter) { // No idea how this could happen, but just incase. - if((*iter) == nullptr) + if((*iter) == NULL) continue; StringId const code("container_error_message", "container32_prose"); @@ -3411,7 +3411,7 @@ static void commandFuncOpenContainer(Command const & cmd, NetworkId const &actor CreatureObject * player = safe_cast(ServerWorld::findObjectByNetworkId(actor)); if (!container || !player) { - DEBUG_REPORT_LOG(true, ("Received open command for nullptr player or target.\n")); + DEBUG_REPORT_LOG(true, ("Received open command for null player or target.\n")); return; } //@todo check permissions @@ -3428,14 +3428,14 @@ static void commandFuncOpenContainer(Command const & cmd, NetworkId const &actor //-- if they are opening a crafting station, what they really want is the hopper //-- but only if the object is not a volume container if (container->getGameObjectType () == SharedObjectTemplate::GOT_misc_crafting_station - && (nullptr == ContainerInterface::getVolumeContainer (*container))) + && (NULL == ContainerInterface::getVolumeContainer (*container))) { static const SlotId inputHopperId(SlotIdManager::findSlotId(CrcLowerString("ingredient_hopper"))); ServerObject const * const station = container; - ServerObject * hopper = nullptr; + ServerObject * hopper = NULL; const SlottedContainer * stationContainer = ContainerInterface::getSlottedContainer (*station); - if (stationContainer != nullptr) + if (stationContainer != NULL) { Container::ContainerErrorCode tmp = Container::CEC_Success; Object* tmpHopperObj = (stationContainer->getObjectInSlot (inputHopperId, tmp)).getObject(); @@ -3526,7 +3526,7 @@ static void commandFuncCloseContainer(Command const &, NetworkId const &actor, N ServerObject * const player = ServerWorld::findObjectByNetworkId(actor); if (!container || !player) { - DEBUG_REPORT_LOG(true, ("Received close command for nullptr player or target.\n")); + DEBUG_REPORT_LOG(true, ("Received close command for null player or target.\n")); return; } @@ -3615,7 +3615,7 @@ static void commandFuncGiveItem(Command const &, NetworkId const &actor, Network ServerObject * const player = ServerWorld::findObjectByNetworkId(actor); if (!player || !item) { - DEBUG_REPORT_LOG(true, ("Received give item command for nullptr player or target.\n")); + DEBUG_REPORT_LOG(true, ("Received give item command for null player or target.\n")); return; } size_t curpos = 0; @@ -3669,10 +3669,10 @@ static void commandFuncGiveItem(Command const &, NetworkId const &actor, Network // check and see if this is a gem->socket operation, which is handled by our code TangibleObject * const socket = dynamic_cast(destination); - if (socket != nullptr) + if (socket != NULL) { TangibleObject * const gem = dynamic_cast(item); - if (gem != nullptr) + if (gem != NULL) { const int destGot = socket->getGameObjectType(); const SharedTangibleObjectTemplate * const gemTemplate = safe_cast(gem->getSharedTemplate()); @@ -3692,13 +3692,13 @@ static void commandFuncGiveItem(Command const &, NetworkId const &actor, Network } // if the socketed item is equipped, unequip it temporarily - CreatureObject * owner = nullptr; + CreatureObject * owner = NULL; Object * container = ContainerInterface::getContainedByObject(*socket); - if (container != nullptr && container->asServerObject()->asCreatureObject() != nullptr) + if (container != NULL && container->asServerObject()->asCreatureObject() != NULL) { owner = container->asServerObject()->asCreatureObject(); // fake unequipping the item - owner->onContainerLostItem(nullptr, *socket, nullptr); + owner->onContainerLostItem(NULL, *socket, NULL); } std::vector > skillModBonuses; @@ -3713,10 +3713,10 @@ static void commandFuncGiveItem(Command const &, NetworkId const &actor, Network // tell the player they can't use the gem Chat::sendSystemMessage(*player, SharedStringIds::gem_not_inserted, Unicode::emptyString); } - if (owner != nullptr) + if (owner != NULL) { // "re-equip" the item - owner->onContainerGainItem(*socket, nullptr, nullptr); + owner->onContainerGainItem(*socket, NULL, NULL); } return; } @@ -4138,7 +4138,7 @@ static void commandFuncGroupDisband(Command const &, NetworkId const &actor, Net { GroupMemberParam const & leader = *ii; - // create the new POB groups. notice nullptr is passed in for the + // create the new POB groups. notice NULL is passed in for the // groupToRemoveFrom because the original group has already had // all of the members removed @@ -4389,7 +4389,7 @@ static void commandFuncCreateGroupPickup(Command const &, NetworkId const &actor } // create the group pickup point - time_t const timeNow = ::time(nullptr); + time_t const timeNow = ::time(NULL); groupObj->setGroupPickupTimer(timeNow, timeNow + static_cast(ConfigServerGame::getGroupPickupPointTimeLimitSeconds())); groupObj->setGroupPickupLocation(currentScene, currentWorldLocation); @@ -4682,7 +4682,7 @@ static void commandFuncGroupPickRandomGroupMember(Command const &, NetworkId con if (!client) return; - int const timeNow = static_cast(::time(nullptr)); + int const timeNow = static_cast(::time(NULL)); if (!client->isGod() && targetObj->getObjVars().hasItem("timeNextGroupPickRandomGroupMemberCommandAllowed") && (targetObj->getObjVars().getType("timeNextGroupPickRandomGroupMemberCommandAllowed") == DynamicVariable::INT)) { int timeNextGroupPickRandomGroupMemberCommandAllowed = 0; @@ -4703,7 +4703,7 @@ static void commandFuncGroupPickRandomGroupMember(Command const &, NetworkId con if (!params.empty()) { Unicode::UnicodeStringVector tokens; - if (Unicode::tokenize(Unicode::toLower(params), tokens, nullptr, nullptr) && !tokens.empty()) + if (Unicode::tokenize(Unicode::toLower(params), tokens, NULL, NULL) && !tokens.empty()) { static Unicode::String const paramsPoint1 = Unicode::narrowToWide("-point"); static Unicode::String const paramsPoint2 = Unicode::narrowToWide("point"); @@ -4805,7 +4805,7 @@ static void commandFuncGroupTextChatRoomRejoin(Command const &, NetworkId const if (!client) return; - int const timeNow = static_cast(::time(nullptr)); + int const timeNow = static_cast(::time(NULL)); if (!client->isGod() && targetObj->getObjVars().hasItem("timeNextGroupTextChatRoomRejoinCommandAllowed") && (targetObj->getObjVars().getType("timeNextGroupTextChatRoomRejoinCommandAllowed") == DynamicVariable::INT)) { int timeNextGroupTextChatRoomRejoinCommandAllowed = 0; @@ -4868,7 +4868,7 @@ static void commandFuncGuildTextChatRoomRejoin(Command const &, NetworkId const if (!client) return; - int const timeNow = static_cast(::time(nullptr)); + int const timeNow = static_cast(::time(NULL)); if (!client->isGod() && targetObj->getObjVars().hasItem("timeNextGuildTextChatRoomRejoinCommandAllowed") && (targetObj->getObjVars().getType("timeNextGuildTextChatRoomRejoinCommandAllowed") == DynamicVariable::INT)) { int timeNextGuildTextChatRoomRejoinCommandAllowed = 0; @@ -4913,7 +4913,7 @@ static void commandFuncGuildPickRandomGuildMember(Command const &, NetworkId con if (!client) return; - int const timeNow = static_cast(::time(nullptr)); + int const timeNow = static_cast(::time(NULL)); if (!client->isGod() && targetObj->getObjVars().hasItem("timeNextGuildPickRandomGuildMemberCommandAllowed") && (targetObj->getObjVars().getType("timeNextGuildPickRandomGuildMemberCommandAllowed") == DynamicVariable::INT)) { int timeNextGuildPickRandomGuildMemberCommandAllowed = 0; @@ -4935,7 +4935,7 @@ static void commandFuncGuildPickRandomGuildMember(Command const &, NetworkId con if (!params.empty()) { Unicode::UnicodeStringVector tokens; - if (Unicode::tokenize(Unicode::toLower(params), tokens, nullptr, nullptr) && !tokens.empty()) + if (Unicode::tokenize(Unicode::toLower(params), tokens, NULL, NULL) && !tokens.empty()) { static Unicode::String const paramsOnline1 = Unicode::narrowToWide("-online"); static Unicode::String const paramsOnline2 = Unicode::narrowToWide("online"); @@ -5074,7 +5074,7 @@ static void commandFuncCityTextChatRoomRejoin(Command const &, NetworkId const & if (!client) return; - int const timeNow = static_cast(::time(nullptr)); + int const timeNow = static_cast(::time(NULL)); if (!client->isGod() && targetObj->getObjVars().hasItem("timeNextCityTextChatRoomRejoinCommandAllowed") && (targetObj->getObjVars().getType("timeNextCityTextChatRoomRejoinCommandAllowed") == DynamicVariable::INT)) { int timeNextCityTextChatRoomRejoinCommandAllowed = 0; @@ -5120,7 +5120,7 @@ static void commandFuncCityPickRandomCitizen(Command const &, NetworkId const &a if (!client) return; - int const timeNow = static_cast(::time(nullptr)); + int const timeNow = static_cast(::time(NULL)); if (!client->isGod() && targetObj->getObjVars().hasItem("timeNextCityPickRandomCitizenCommandAllowed") && (targetObj->getObjVars().getType("timeNextCityPickRandomCitizenCommandAllowed") == DynamicVariable::INT)) { int timeNextCityPickRandomCitizenCommandAllowed = 0; @@ -5142,7 +5142,7 @@ static void commandFuncCityPickRandomCitizen(Command const &, NetworkId const &a if (!params.empty()) { Unicode::UnicodeStringVector tokens; - if (Unicode::tokenize(Unicode::toLower(params), tokens, nullptr, nullptr) && !tokens.empty()) + if (Unicode::tokenize(Unicode::toLower(params), tokens, NULL, NULL) && !tokens.empty()) { static Unicode::String const paramsOnline1 = Unicode::narrowToWide("-online"); static Unicode::String const paramsOnline2 = Unicode::narrowToWide("online"); @@ -5272,7 +5272,7 @@ static void commandFuncPlaceStructure (const Command& /*command*/, const Network Object* const object = NetworkIdManager::getObjectById (actor); if (!object) { - DEBUG_WARNING (true, ("commandFuncPlaceStructure: PB nullptr actor\n")); + DEBUG_WARNING (true, ("commandFuncPlaceStructure: PB null actor\n")); return; } @@ -5478,9 +5478,9 @@ static void commandFuncPurchaseTicket (const Command& /*command*/, const Network static void commandFuncRequestResourceWeights(const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == nullptr) + if (creature == NULL) { - WARNING (true, ("commandFuncRequestResourceWeights: PB nullptr actor")); + WARNING (true, ("commandFuncRequestResourceWeights: PB null actor")); return; } @@ -5494,9 +5494,9 @@ static void commandFuncRequestResourceWeights(const Command& , const NetworkId& static void commandFuncRequestResourceWeightsBatch(const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) { CreatureObject* const creature = dynamic_cast(NetworkIdManager::getObjectById (actor)); - if (creature == nullptr) + if (creature == NULL) { - WARNING (true, ("commandFuncRequestResourceWeightsBatch: PB nullptr actor")); + WARNING (true, ("commandFuncRequestResourceWeightsBatch: PB null actor")); return; } @@ -5516,14 +5516,14 @@ static void commandFuncRequestResourceWeightsBatch(const Command& , const Networ static void commandFuncRequestDraftSlots (const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == nullptr) + if (creature == NULL) { - WARNING (true, ("commandFuncRequestDraftSlots: PB nullptr actor")); + WARNING (true, ("commandFuncRequestDraftSlots: PB null actor")); return; } PlayerObject * const player = PlayerCreatureController::getPlayerObject(creature); - if (player == nullptr) + if (player == NULL) { WARNING (true, ("commandFuncRequestDraftSlots: no player object for actor ""%s", actor.getValueString().c_str())); return; @@ -5533,7 +5533,7 @@ static void commandFuncRequestDraftSlots (const Command& , const NetworkId& acto sscanf(Unicode::wideToNarrow(params).c_str(), "%lu %lu", &serverCrc, &sharedCrc); MessageQueueDraftSlotsQueryResponse * const message = new MessageQueueDraftSlotsQueryResponse(std::make_pair(serverCrc, sharedCrc)); - if (!player->requestDraftSlots(serverCrc, nullptr, message)) + if (!player->requestDraftSlots(serverCrc, NULL, message)) { WARNING (true, ("commandFuncRequestDraftSlots failed to request draft slots for %u", serverCrc)); delete message; @@ -5545,14 +5545,14 @@ static void commandFuncRequestDraftSlots (const Command& , const NetworkId& acto static void commandFuncRequestDraftSlotsBatch (const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == nullptr) + if (creature == NULL) { - WARNING (true, ("commandFuncRequestDraftSlotsBatch: PB nullptr actor")); + WARNING (true, ("commandFuncRequestDraftSlotsBatch: PB null actor")); return; } PlayerObject * const player = PlayerCreatureController::getPlayerObject(creature); - if (player == nullptr) + if (player == NULL) { WARNING (true, ("commandFuncRequestDraftSlotsBatch: no player object for actor ""%s", actor.getValueString().c_str())); return; @@ -5575,7 +5575,7 @@ static void commandFuncRequestDraftSlotsBatch (const Command& , const NetworkId& while(uServerCrc != 0 && uSharedCrc != 0 && !done) { MessageQueueDraftSlotsQueryResponse * const message = new MessageQueueDraftSlotsQueryResponse(std::make_pair(uServerCrc, uSharedCrc)); - if (!player->requestDraftSlots(uServerCrc, nullptr, message)) + if (!player->requestDraftSlots(uServerCrc, NULL, message)) { WARNING (true, ("commandFuncRequestDraftSlotsBatch failed to request draft slots for %lu", uServerCrc)); delete message; @@ -5596,15 +5596,15 @@ static void commandFuncRequestDraftSlotsBatch (const Command& , const NetworkId& static void commandFuncRequestManfSchematicSlots (const Command& , const NetworkId& actor, const NetworkId& target, const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == nullptr) + if (creature == NULL) { - WARNING (true, ("commandFuncRequestDraftSlots: PB nullptr actor")); + WARNING (true, ("commandFuncRequestDraftSlots: PB null actor")); return; } const ManufactureSchematicObject * schematic = dynamic_cast< const ManufactureSchematicObject *>(NetworkIdManager::getObjectById(target)); - if (schematic != nullptr) + if (schematic != NULL) { schematic->requestSlots(*creature); } @@ -5615,14 +5615,14 @@ static void commandFuncRequestManfSchematicSlots (const Command& , const Network static void commandFuncRequestCraftingSession (const Command& , const NetworkId& actor, const NetworkId& target, const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == nullptr) + if (creature == NULL) { - WARNING (true, ("commandFuncRequestCraftingSession: PB nullptr actor")); + WARNING (true, ("commandFuncRequestCraftingSession: PB null actor")); return; } PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); - if (player == nullptr) + if (player == NULL) { WARNING (true, ("commandFuncRequestCraftingSession: no player object for actor " "%s", actor.getValueString().c_str())); @@ -5668,14 +5668,14 @@ static void commandFuncRequestCraftingSessionFail(Command const &, NetworkId con static void commandFuncSelectDraftSchematic (const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == nullptr) + if (creature == NULL) { - WARNING (true, ("commandFuncSelectDraftSchematic: PB nullptr actor")); + WARNING (true, ("commandFuncSelectDraftSchematic: PB null actor")); return; } PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); - if (player == nullptr) + if (player == NULL) { WARNING (true, ("commandFuncSelectDraftSchematic: no player object for actor " "%s", actor.getValueString().c_str())); @@ -5692,14 +5692,14 @@ static void commandFuncSelectDraftSchematic (const Command& , const NetworkId& a static void commandFuncNextCraftingStage(const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == nullptr) + if (creature == NULL) { - WARNING (true, ("commandFuncNextCraftingStage: PB nullptr actor")); + WARNING (true, ("commandFuncNextCraftingStage: PB null actor")); return; } PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); - if (player == nullptr) + if (player == NULL) { WARNING (true, ("commandFuncNextCraftingStage: no player object for actor " "%s", actor.getValueString().c_str())); @@ -5722,14 +5722,14 @@ static void commandFuncNextCraftingStage(const Command& , const NetworkId& actor static void commandFuncCreatePrototype(const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == nullptr) + if (creature == NULL) { - WARNING (true, ("commandFuncCreatePrototype: PB nullptr actor")); + WARNING (true, ("commandFuncCreatePrototype: PB null actor")); return; } PlayerObject * const player = PlayerCreatureController::getPlayerObject(creature); - if (player == nullptr) + if (player == NULL) { WARNING (true, ("commandFuncCreatePrototype: no player object for actor %s", actor.getValueString().c_str())); return; @@ -5756,14 +5756,14 @@ static void commandFuncCreatePrototype(const Command& , const NetworkId& actor, static void commandFuncCreateManfSchematic(const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == nullptr) + if (creature == NULL) { - WARNING (true, ("commandFuncCreateManfSchematic: PB nullptr actor")); + WARNING (true, ("commandFuncCreateManfSchematic: PB null actor")); return; } PlayerObject * const player = PlayerCreatureController::getPlayerObject(creature); - if (player == nullptr) + if (player == NULL) { WARNING (true, ("commandFuncCreateManfSchematic: no player object for actor %s", actor.getValueString().c_str())); return; @@ -5788,14 +5788,14 @@ static void commandFuncCreateManfSchematic(const Command& , const NetworkId& act static void commandFuncCancelCraftingSession(const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == nullptr) + if (creature == NULL) { - WARNING (true, ("commandFuncCancelCraftingSession: PB nullptr actor")); + WARNING (true, ("commandFuncCancelCraftingSession: PB null actor")); return; } PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); - if (player == nullptr) + if (player == NULL) { WARNING (true, ("commandFuncCancelCraftingSession: no player object for actor " "%s", actor.getValueString().c_str())); @@ -5810,14 +5810,14 @@ static void commandFuncCancelCraftingSession(const Command& , const NetworkId& a static void commandFuncStopCraftingSession(const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == nullptr) + if (creature == NULL) { - WARNING (true, ("commandFuncStopCraftingSession: PB nullptr actor")); + WARNING (true, ("commandFuncStopCraftingSession: PB null actor")); return; } PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); - if (player == nullptr) + if (player == NULL) { WARNING (true, ("commandFuncStopCraftingSession: no player object for actor " "%s", actor.getValueString().c_str())); @@ -5832,14 +5832,14 @@ static void commandFuncStopCraftingSession(const Command& , const NetworkId& act static void commandFuncRestartCraftingSession(const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == nullptr) + if (creature == NULL) { - WARNING (true, ("commandFuncRestartCraftingSession: PB nullptr actor")); + WARNING (true, ("commandFuncRestartCraftingSession: PB null actor")); return; } PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); - if (player == nullptr) + if (player == NULL) { WARNING (true, ("commandFuncRestartCraftingSession: no player object for actor " "%s", actor.getValueString().c_str())); @@ -5866,7 +5866,7 @@ static void commandFuncSetMatchMakingPersonalId(Command const &, NetworkId const PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(actor)); - if (playerObject != nullptr) + if (playerObject != NULL) { MatchMakingId matchMakingId; matchMakingId.unPackIntString(Unicode::wideToNarrow(params)); @@ -5885,7 +5885,7 @@ static void commandFuncSetMatchMakingCharacterId(Command const &, NetworkId cons PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(actor)); - if (playerObject != nullptr) + if (playerObject != NULL) { MatchMakingId matchMakingId; matchMakingId.unPackIntString(Unicode::wideToNarrow(params)); @@ -5902,7 +5902,7 @@ static void commandFuncAddFriend(Command const &, NetworkId const &actor, Networ { ServerObject * const serverObject = ServerObject::getServerObject(actor); - if (serverObject != nullptr) + if (serverObject != NULL) { size_t pos = 0; std::string name(nextStringParm(params, pos)); @@ -5924,7 +5924,7 @@ static void commandFuncRemoveFriend(Command const &, NetworkId const &actor, Net { ServerObject * const serverObject = ServerObject::getServerObject(actor); - if (serverObject != nullptr) + if (serverObject != NULL) { size_t pos = 0; std::string name(nextStringParm(params, pos)); @@ -5946,7 +5946,7 @@ static void commandFuncGetFriendList(Command const &, NetworkId const &actor, Ne { ServerObject * const serverObject = ServerObject::getServerObject(actor); - if (serverObject != nullptr) + if (serverObject != NULL) { std::string player(Chat::constructChatAvatarId(*serverObject).getFullName()); @@ -5962,7 +5962,7 @@ static void commandFuncAddIgnore(Command const &, NetworkId const &actor, Networ { ServerObject * const serverObject = ServerObject::getServerObject(actor); - if (serverObject != nullptr) + if (serverObject != NULL) { size_t pos = 0; std::string name(nextStringParm(params, pos)); @@ -5984,7 +5984,7 @@ static void commandFuncRemoveIgnore(Command const &, NetworkId const &actor, Net { ServerObject * const serverObject = ServerObject::getServerObject(actor); - if (serverObject != nullptr) + if (serverObject != NULL) { size_t pos = 0; std::string name(nextStringParm(params, pos)); @@ -6006,7 +6006,7 @@ static void commandFuncGetIgnoreList(Command const &, NetworkId const &actor, Ne { ServerObject * const serverObject = ServerObject::getServerObject(actor); - if (serverObject != nullptr) + if (serverObject != NULL) { std::string player(Chat::constructChatAvatarId(*serverObject).getFullName()); @@ -6022,7 +6022,7 @@ static void commandFuncRequestBiography(Command const &, NetworkId const &actor, { CreatureObject * const creatureObject = CreatureObject::getCreatureObject(actor); - if (creatureObject != nullptr) + if (creatureObject != NULL) { BiographyManager::requestBiography(target, creatureObject); } @@ -6069,9 +6069,9 @@ static void commandFuncSetBiography(Command const &, NetworkId const & actor, Ne static void commandFuncRequestCharacterSheetInfo(Command const &, NetworkId const &actor, NetworkId const &, Unicode::String const &) { const CreatureObject* const creatureActor = CreatureObject::getCreatureObject(actor); - if (creatureActor == nullptr) + if (creatureActor == NULL) { - WARNING (true, ("commandFuncRequestCharacterSheetInfo: nullptr actor")); + WARNING (true, ("commandFuncRequestCharacterSheetInfo: null actor")); return; } @@ -6090,7 +6090,7 @@ static void commandFuncRequestCharacterSheetInfo(Command const &, NetworkId cons if(bindId != NetworkId::cms_invalid) { const ServerObject* const bindObject = ServerObject::getServerObject(bindId); - if (bindObject != nullptr) + if (bindObject != NULL) { bindLoc = bindObject->getPosition_w(); bindPlanet = bindObject->getSceneId(); @@ -6142,7 +6142,7 @@ static void commandFuncRequestCharacterSheetInfo(Command const &, NetworkId cons houseNetworkId = cityHallOfMayorCity; const ServerObject* const resObject = ServerObject::getServerObject(houseNetworkId); - if (resObject != nullptr) + if (resObject != NULL) { resLoc = resObject->getPosition_w(); resPlanet = ServerWorld::getSceneId(); @@ -6201,13 +6201,13 @@ static void commandFuncRequestCharacterMatch(Command const &, NetworkId const &a static void commandFuncExtractObject(Command const &, NetworkId const &actor, NetworkId const & target, Unicode::String const ¶ms) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == nullptr) + if (creature == NULL) { - WARNING (true, ("commandFuncExtractObject: PB nullptr actor")); + WARNING (true, ("commandFuncExtractObject: PB null actor")); return; } - if (creature->getInventory() == nullptr) + if (creature->getInventory() == NULL) { WARNING (true, ("commandFuncExtractObject: actor %s has no inventory", actor.getValueString().c_str())); @@ -6215,9 +6215,9 @@ static void commandFuncExtractObject(Command const &, NetworkId const &actor, Ne } FactoryObject* const factory = dynamic_cast(NetworkIdManager::getObjectById (target)); - if (factory == nullptr) + if (factory == NULL) { - WARNING (true, ("commandFuncExtractObject: PB nullptr target")); + WARNING (true, ("commandFuncExtractObject: PB null target")); return; } @@ -6233,16 +6233,16 @@ static void commandFuncExtractObject(Command const &, NetworkId const &actor, Ne static void commandFuncRevokeSkill(Command const &, NetworkId const &actor, NetworkId const & target, Unicode::String const ¶ms) { CreatureObject * const creature = CreatureObject::getCreatureObject(actor); - if (creature == nullptr) + if (creature == NULL) { - WARNING (true, ("commandFuncRevokeSkill: PB nullptr actor")); + WARNING (true, ("commandFuncRevokeSkill: PB null actor")); return; } size_t pos = 0; std::string skillName = nextStringParm(params, pos); const SkillObject * skill = SkillManager::getInstance ().getSkill (skillName); - if (skill == nullptr) + if (skill == NULL) { WARNING (true, ("commandFuncRevokeSkill: can't revoke bad skill")); } @@ -6261,7 +6261,7 @@ static void commandFuncSetCurrentSkillTitle(Command const &, NetworkId const &ac CreatureObject * const creatureObject = CreatureObject::getCreatureObject(actor); PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(creatureObject); - if (playerObject != nullptr) + if (playerObject != NULL) { size_t pos = 0; std::string const &title = nextStringParm(params, pos); @@ -6378,7 +6378,7 @@ static void commandFuncSetCurrentSkillTitle(Command const &, NetworkId const &ac { SkillObject const *skillObject = (*iterSkillList); - if ( (skillObject != nullptr) + if ( (skillObject != NULL) && skillObject->isTitle() && (skillObject->getSkillName() == title)) { @@ -6402,16 +6402,16 @@ static void commandFuncSetCurrentSkillTitle(Command const &, NetworkId const &ac static void commandFuncRepair(Command const &, NetworkId const &actor, NetworkId const & target, Unicode::String const ¶ms) { CreatureObject* const creature = dynamic_cast(NetworkIdManager::getObjectById (actor)); - if (creature == nullptr) + if (creature == NULL) { - WARNING (true, ("commandFuncRepair: PB nullptr actor")); + WARNING (true, ("commandFuncRepair: PB null actor")); return; } TangibleObject* const object = dynamic_cast(NetworkIdManager::getObjectById (target)); - if (object == nullptr) + if (object == NULL) { - WARNING (true, ("commandFuncRepair: PB nullptr target")); + WARNING (true, ("commandFuncRepair: PB null target")); return; } } @@ -6424,7 +6424,7 @@ static void commandFuncToggleSearchableByCtsSourceGalaxy(Command const &, Networ PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(actor)); - if (playerObject != nullptr) + if (playerObject != NULL) { playerObject->toggleSearchableByCtsSourceGalaxy(); } @@ -6438,7 +6438,7 @@ static void commandFuncToggleDisplayLocationInSearchResults(Command const &, Net PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(actor)); - if (playerObject != nullptr) + if (playerObject != NULL) { playerObject->toggleDisplayLocationInSearchResults(); } @@ -6452,7 +6452,7 @@ static void commandFuncToggleAnonymous(Command const &, NetworkId const &actor, PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(actor)); - if (playerObject != nullptr) + if (playerObject != NULL) { playerObject->toggleAnonymous(); } @@ -6466,7 +6466,7 @@ static void commandFuncToggleHelper(Command const &, NetworkId const &actor, Net PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(actor)); - if (playerObject != nullptr) + if (playerObject != NULL) { playerObject->toggleHelper(); } @@ -6480,7 +6480,7 @@ static void commandFuncToggleRolePlay(Command const &, NetworkId const &actor, N PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(actor)); - if (playerObject != nullptr) + if (playerObject != NULL) { playerObject->toggleRolePlay(); } @@ -6493,7 +6493,7 @@ static void commandFuncToggleOutOfCharacter(Command const &, NetworkId const &ac { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(actor)); - if (playerObject != nullptr) + if (playerObject != NULL) { playerObject->toggleOutOfCharacter(); } @@ -6505,7 +6505,7 @@ static void commandFuncToggleLookingForWork(Command const &, NetworkId const &ac { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(actor)); - if (playerObject != nullptr) + if (playerObject != NULL) { playerObject->toggleLookingForWork(); } @@ -6520,7 +6520,7 @@ static void commandFuncToggleLookingForGroup(Command const &, NetworkId const &a PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(actor)); - if (playerObject != nullptr) + if (playerObject != NULL) { playerObject->toggleLookingForGroup(); } @@ -6534,7 +6534,7 @@ static void commandFuncToggleAwayFromKeyBoard(Command const &, NetworkId const & PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(actor)); - if (playerObject != nullptr) + if (playerObject != NULL) { playerObject->toggleAwayFromKeyBoard(); } @@ -6546,7 +6546,7 @@ static void commandFuncToggleDisplayingFactionRank(Command const &, NetworkId co { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(actor)); - if (playerObject != nullptr) + if (playerObject != NULL) { playerObject->toggleDisplayingFactionRank(); } @@ -6558,7 +6558,7 @@ static void commandFuncReport(Command const &, NetworkId const &actor, NetworkId { CreatureObject const * const reportingCreatureObject = CreatureObject::getCreatureObject(actor); - if (reportingCreatureObject != nullptr) + if (reportingCreatureObject != NULL) { if (ReportManager::isThrottled(actor)) { @@ -6635,16 +6635,16 @@ static void commandFuncReport(Command const &, NetworkId const &actor, NetworkId static void commandFuncNpcConversationStart(Command const &, NetworkId const &actor, NetworkId const & target, Unicode::String const ¶ms) { ServerObject * const actorObject = safe_cast(NetworkIdManager::getObjectById(actor)); - CreatureObject * const player = actorObject != nullptr ? actorObject->asCreatureObject() : nullptr; - if (player == nullptr) + CreatureObject * const player = actorObject != NULL ? actorObject->asCreatureObject() : NULL; + if (player == NULL) { DEBUG_WARNING(true, ("commandFuncNpcConversationStart: couldn't find actor")); return; } ServerObject * const npcObject = safe_cast(NetworkIdManager::getObjectById(target)); - TangibleObject * const npc = npcObject != nullptr ? npcObject->asTangibleObject() : nullptr; - if (npc == nullptr) + TangibleObject * const npc = npcObject != NULL ? npcObject->asTangibleObject() : NULL; + if (npc == NULL) { DEBUG_WARNING(true, ("commandFuncNpcConversationStart: Couldn't find npc to converse with")); return; @@ -6678,8 +6678,8 @@ static void commandFuncNpcConversationStart(Command const &, NetworkId const &ac static void commandFuncNpcConversationStop(Command const &, NetworkId const &actor, NetworkId const & target, Unicode::String const ¶ms) { ServerObject * const actorObject = safe_cast(NetworkIdManager::getObjectById(actor)); - TangibleObject * const player = actorObject != nullptr ? actorObject->asTangibleObject(): nullptr; - if (player == nullptr) + TangibleObject * const player = actorObject != NULL ? actorObject->asTangibleObject(): NULL; + if (player == NULL) { DEBUG_WARNING(true, ("commandFuncNpcConversationStop: couldn't find actor")); return; @@ -6693,7 +6693,7 @@ static void commandFuncNpcConversationSelect(Command const &, NetworkId const &a { Object * const actorObject = NetworkIdManager::getObjectById(actor); CreatureObject * const player = dynamic_cast(actorObject); - if (player == nullptr) + if (player == NULL) { DEBUG_WARNING(true, ("commandFuncNpcConversationStop: couldn't find actor")); return; @@ -6709,7 +6709,7 @@ static void commandFuncNpcConversationSelect(Command const &, NetworkId const &a static void commandFuncServerDestroyObject (Command const &, NetworkId const & actor, NetworkId const & target, Unicode::String const & params) { CreatureObject * const player = dynamic_cast (NetworkIdManager::getObjectById (actor)); - if (player == nullptr) + if (player == NULL) { DEBUG_WARNING (true, ("commandFuncServerDestroyObject: couldn't find actor")); return; @@ -6792,11 +6792,11 @@ static void commandFuncSetSpokenLanguage(Command const &, NetworkId const &actor Object * const object = NetworkIdManager::getObjectById(actor); CreatureObject * const creatureObject = dynamic_cast(object); - if (creatureObject != nullptr) + if (creatureObject != NULL) { PlayerObject *playerObject = PlayerCreatureController::getPlayerObject(creatureObject); - if (playerObject != nullptr) + if (playerObject != NULL) { size_t pos = 0; int const languageId = nextIntParm(params, pos); @@ -6831,14 +6831,14 @@ static void commandFuncUnstick(Command const &, NetworkId const &actor, NetworkI { Object * const object = NetworkIdManager::getObjectById(actor); CreatureObject * const creatureObject = dynamic_cast(object); - if (creatureObject != nullptr) + if (creatureObject != NULL) { if (!ShipObject::getContainingShipObject(creatureObject)) // no unsticking in ships { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(creatureObject); if (playerObject) { - Chat::sendSystemMessageSimple(*creatureObject, SharedStringIds::unstick_in_progress, nullptr); + Chat::sendSystemMessageSimple(*creatureObject, SharedStringIds::unstick_in_progress, NULL); if (!playerObject->getIsUnsticking()) { Vector position = creatureObject->getPosition_p(); @@ -7324,8 +7324,8 @@ static void commandFuncInstallShipComponents(Command const &, NetworkId const & //params for installShipComponent are " " Object const * const actorObj = NetworkIdManager::getObjectById(actor); - ServerObject const * const actorServerObj = actorObj ? actorObj->asServerObject() : nullptr; - CreatureObject const * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : nullptr; + ServerObject const * const actorServerObj = actorObj ? actorObj->asServerObject() : NULL; + CreatureObject const * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : NULL; if(!actorCreature) { return; @@ -7338,7 +7338,7 @@ static void commandFuncInstallShipComponents(Command const &, NetworkId const & if(!client->isGod()) { Object * const targetObj = NetworkIdManager::getObjectById(target); - ServerObject * const targetServerObj = targetObj ? targetObj->asServerObject() : nullptr; + ServerObject * const targetServerObj = targetObj ? targetObj->asServerObject() : NULL; if( !targetServerObj || ((targetServerObj->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space) && (targetServerObj->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space_npe)) ) return; @@ -7351,16 +7351,16 @@ static void commandFuncInstallShipComponents(Command const &, NetworkId const & size_t pos = 0; NetworkId const & shipId = nextOidParm(params, pos); Object * const shipObj = NetworkIdManager::getObjectById(shipId); - ServerObject * const shipServerObj = shipObj ? shipObj->asServerObject() : nullptr; - ShipObject * const ship = shipServerObj ? shipServerObj->asShipObject() : nullptr; + ServerObject * const shipServerObj = shipObj ? shipObj->asServerObject() : NULL; + ShipObject * const ship = shipServerObj ? shipServerObj->asShipObject() : NULL; if(!ship) return; ShipChassisSlotType::Type const slotType = static_cast(nextIntParm(params, pos)); NetworkId const & componentId = nextOidParm(params, pos); Object * const componentObj = NetworkIdManager::getObjectById(componentId); - ServerObject * const componentServerObj = componentObj ? componentObj->asServerObject() : nullptr; - TangibleObject * const component = componentServerObj ? componentServerObj->asTangibleObject() : nullptr; + ServerObject * const componentServerObj = componentObj ? componentObj->asServerObject() : NULL; + TangibleObject * const component = componentServerObj ? componentServerObj->asTangibleObject() : NULL; if(!component) { return; @@ -7409,8 +7409,8 @@ static void commandFuncUninstallShipComponents(Command const &, NetworkId const //params for uninstallShipComponent are " " Object * const actorObj = NetworkIdManager::getObjectById(actor); - ServerObject * const actorServerObj = actorObj ? actorObj->asServerObject() : nullptr; - CreatureObject * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : nullptr; + ServerObject * const actorServerObj = actorObj ? actorObj->asServerObject() : NULL; + CreatureObject * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : NULL; if(!actorCreature) return; ServerObject * const actorInv = actorCreature->getInventory(); @@ -7424,7 +7424,7 @@ static void commandFuncUninstallShipComponents(Command const &, NetworkId const if(!client->isGod()) { Object * const targetObj = NetworkIdManager::getObjectById(target); - ServerObject * const targetServerObj = targetObj ? targetObj->asServerObject() : nullptr; + ServerObject * const targetServerObj = targetObj ? targetObj->asServerObject() : NULL; if(!targetServerObj || ((targetServerObj->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space) && (targetServerObj->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space_npe)) ) @@ -7456,8 +7456,8 @@ static void commandFuncUninstallShipComponents(Command const &, NetworkId const size_t pos = 0; NetworkId const & shipId = nextOidParm(params, pos); Object * const shipObj = NetworkIdManager::getObjectById(shipId); - ServerObject * const shipServerObj = shipObj ? shipObj->asServerObject() : nullptr; - ShipObject * const ship = shipServerObj ? shipServerObj->asShipObject() : nullptr; + ServerObject * const shipServerObj = shipObj ? shipObj->asServerObject() : NULL; + ShipObject * const ship = shipServerObj ? shipServerObj->asShipObject() : NULL; if(!ship) return; @@ -7474,8 +7474,8 @@ static void commandFuncInsertItemIntoShipComponentSlot(Command const &, NetworkI //params for insertItemIntoShipComponentSlot are " " Object * const actorObj = NetworkIdManager::getObjectById(actor); - ServerObject * const actorServerObj = actorObj ? actorObj->asServerObject() : nullptr; - CreatureObject * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : nullptr; + ServerObject * const actorServerObj = actorObj ? actorObj->asServerObject() : NULL; + CreatureObject * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : NULL; if(!actorCreature) return; @@ -7486,7 +7486,7 @@ static void commandFuncInsertItemIntoShipComponentSlot(Command const &, NetworkI if(!client->isGod()) { Object * const targetObj = NetworkIdManager::getObjectById(target); - ServerObject * const targetServerObj = targetObj ? targetObj->asServerObject() : nullptr; + ServerObject * const targetServerObj = targetObj ? targetObj->asServerObject() : NULL; if(!targetServerObj || ((targetServerObj->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space) && (targetServerObj->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space_npe)) ) return; @@ -7499,8 +7499,8 @@ static void commandFuncInsertItemIntoShipComponentSlot(Command const &, NetworkI size_t pos = 0; NetworkId const & shipId = nextOidParm(params, pos); Object * const shipObj = NetworkIdManager::getObjectById(shipId); - ServerObject * const shipServerObj = shipObj ? shipObj->asServerObject() : nullptr; - ShipObject * const ship = shipServerObj ? shipServerObj->asShipObject() : nullptr; + ServerObject * const shipServerObj = shipObj ? shipObj->asServerObject() : NULL; + ShipObject * const ship = shipServerObj ? shipServerObj->asShipObject() : NULL; if(!ship) return; @@ -7527,8 +7527,8 @@ static void commandFuncAssociateDroidControlDeviceWithShip(Command const &, Netw //params for associateDroidControlDeviceWithShip are " " Object const * const actorObj = NetworkIdManager::getObjectById(actor); - ServerObject const * const actorServerObj = actorObj ? actorObj->asServerObject() : nullptr; - CreatureObject const * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : nullptr; + ServerObject const * const actorServerObj = actorObj ? actorObj->asServerObject() : NULL; + CreatureObject const * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : NULL; if (!actorCreature) return; @@ -7539,7 +7539,7 @@ static void commandFuncAssociateDroidControlDeviceWithShip(Command const &, Netw if(!client->isGod()) { Object * const targetObj = NetworkIdManager::getObjectById(target); - ServerObject * const targetServerObj = targetObj ? targetObj->asServerObject() : nullptr; + ServerObject * const targetServerObj = targetObj ? targetObj->asServerObject() : NULL; if(!targetServerObj || ((targetServerObj->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space) && (targetServerObj->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space_npe)) ) return; @@ -7552,8 +7552,8 @@ static void commandFuncAssociateDroidControlDeviceWithShip(Command const &, Netw size_t pos = 0; NetworkId const & shipId = nextOidParm(params, pos); Object * const shipObj = NetworkIdManager::getObjectById(shipId); - ServerObject * const shipServerObj = shipObj ? shipObj->asServerObject() : nullptr; - ShipObject * const ship = shipServerObj ? shipServerObj->asShipObject() : nullptr; + ServerObject * const shipServerObj = shipObj ? shipObj->asServerObject() : NULL; + ShipObject * const ship = shipServerObj ? shipServerObj->asShipObject() : NULL; if(!ship) return; @@ -7581,8 +7581,8 @@ static void commandFuncAssociateDroidControlDeviceWithShip(Command const &, Netw static void commandFuncServerAsteroidDataListen(Command const &, NetworkId const & actor, NetworkId const & , Unicode::String const & ) { Object const * const actorObj = NetworkIdManager::getObjectById(actor); - ServerObject const * const actorServerObj = actorObj ? actorObj->asServerObject() : nullptr; - CreatureObject const * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : nullptr; + ServerObject const * const actorServerObj = actorObj ? actorObj->asServerObject() : NULL; + CreatureObject const * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : NULL; if(!actorCreature) return; @@ -7594,8 +7594,8 @@ static void commandFuncServerAsteroidDataListen(Command const &, NetworkId const static void commandFuncServerAsteroidDataStopListening(Command const &, NetworkId const & actor, NetworkId const & , Unicode::String const & ) { Object const * const actorObj = NetworkIdManager::getObjectById(actor); - ServerObject const * const actorServerObj = actorObj ? actorObj->asServerObject() : nullptr; - CreatureObject const * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : nullptr; + ServerObject const * const actorServerObj = actorObj ? actorObj->asServerObject() : NULL; + CreatureObject const * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : NULL; if(!actorCreature) return; @@ -7621,8 +7621,8 @@ static void commandFuncBoosterOff(Command const &, NetworkId const & actor, Netw static void commandFuncSetFormation(Command const &, NetworkId const & actor, NetworkId const &, Unicode::String const & params) { Object * const o = NetworkIdManager::getObjectById(actor); - ServerObject * const so = o ? o->asServerObject() : nullptr; - CreatureObject * const actorCreature = so ? so->asCreatureObject() : nullptr; + ServerObject * const so = o ? o->asServerObject() : NULL; + CreatureObject * const actorCreature = so ? so->asCreatureObject() : NULL; if(actorCreature) { GroupObject * const group = actorCreature->getGroup(); @@ -7676,15 +7676,15 @@ static void commandFuncUnDock(Command const &, NetworkId const & actor, NetworkI { Object * const object = NetworkIdManager::getObjectById(actor); - if (object != nullptr) + if (object != NULL) { ShipObject * const shipObject = ShipObject::getContainingShipObject(object->asServerObject()); - if (shipObject != nullptr) + if (shipObject != NULL) { ShipController * const shipController = dynamic_cast(shipObject->getController()); - if (shipController != nullptr) + if (shipController != NULL) { shipController->unDock(); } @@ -7695,12 +7695,12 @@ static void commandFuncUnDock(Command const &, NetworkId const & actor, NetworkI } else { - WARNING(true, ("commandFuncUnDock() Undock requested on an object(%s) contained by a nullptr ShipObject.", object->getDebugInformation().c_str())); + WARNING(true, ("commandFuncUnDock() Undock requested on an object(%s) contained by a NULL ShipObject.", object->getDebugInformation().c_str())); } } else { - WARNING(true, ("commandFuncUnDock() Undock requested on a nullptr object(%s).", actor.getValueString().c_str())); + WARNING(true, ("commandFuncUnDock() Undock requested on a NULL object(%s).", actor.getValueString().c_str())); } } @@ -7709,7 +7709,7 @@ static void commandFuncUnDock(Command const &, NetworkId const & actor, NetworkI static void commandFuncLaunchIntoSpace(Command const &, NetworkId const & actor, NetworkId const & target, Unicode::String const & params) { ServerObject * const actorServerObj = safe_cast(NetworkIdManager::getObjectById(actor)); - CreatureObject * const actorCreature = actorServerObj != nullptr ? actorServerObj->asCreatureObject() : nullptr; + CreatureObject * const actorCreature = actorServerObj != NULL ? actorServerObj->asCreatureObject() : NULL; if(!actorCreature) { WARNING(true, ("No actorCreature in commandFuncLaunchIntoSpace")); @@ -7725,7 +7725,7 @@ static void commandFuncLaunchIntoSpace(Command const &, NetworkId const & actor, //target must be a space terminal Object const * const o = NetworkIdManager::getObjectById(target); - ServerObject const * const so = o ? o->asServerObject() : nullptr; + ServerObject const * const so = o ? o->asServerObject() : NULL; if(!so) { StringId invalidTargetId("player_utility", "target_not_server_object"); @@ -7759,7 +7759,7 @@ static void commandFuncLaunchIntoSpace(Command const &, NetworkId const & actor, return; } Object * const terminalO = NetworkIdManager::getObjectById(target); - ServerObject * const terminalSO = terminalO ? terminalO->asServerObject() : nullptr; + ServerObject * const terminalSO = terminalO ? terminalO->asServerObject() : NULL; if(terminalSO) { std::vector networkIds; @@ -7824,7 +7824,7 @@ static void commandFuncLaunchIntoSpace(Command const &, NetworkId const & actor, static void commandFuncAcceptQuest(Command const &, NetworkId const & actor, NetworkId const & target, Unicode::String const & params) { ServerObject * const actorServerObj = safe_cast(NetworkIdManager::getObjectById(actor)); - CreatureObject * const actorCreature = actorServerObj != nullptr ? actorServerObj->asCreatureObject() : nullptr; + CreatureObject * const actorCreature = actorServerObj != NULL ? actorServerObj->asCreatureObject() : NULL; if(!actorCreature) { WARNING(true, ("No actorCreature in commandFuncAcceptQuest")); @@ -7851,7 +7851,7 @@ static void commandFuncAcceptQuest(Command const &, NetworkId const & actor, Net static void commandFuncReceiveReward(Command const &, NetworkId const & actor, NetworkId const & target, Unicode::String const & params) { ServerObject * const actorServerObj = safe_cast(NetworkIdManager::getObjectById(actor)); - CreatureObject * const actorCreature = actorServerObj != nullptr ? actorServerObj->asCreatureObject() : nullptr; + CreatureObject * const actorCreature = actorServerObj != NULL ? actorServerObj->asCreatureObject() : NULL; if(!actorCreature) { WARNING(true, ("No actorCreature in commandFuncReceiveReward")); @@ -7895,7 +7895,7 @@ static void commandFuncAbandonQuest(Command const &, NetworkId const & actor, Ne if(QuestManager::isQuestAbandonable(questName)) { ServerObject * const actorServerObj = safe_cast(NetworkIdManager::getObjectById(actor)); - CreatureObject * const actorCreature = actorServerObj != nullptr ? actorServerObj->asCreatureObject() : nullptr; + CreatureObject * const actorCreature = actorServerObj != NULL ? actorServerObj->asCreatureObject() : NULL; if(actorCreature) { PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(actorCreature); @@ -7922,7 +7922,7 @@ static void commandFuncAbandonQuest(Command const &, NetworkId const & actor, Ne static void commandFuncExchangeListCredits(Command const &, NetworkId const &actor, NetworkId const &target, Unicode::String const ¶ms) { ServerObject * const actorServerObj = safe_cast(NetworkIdManager::getObjectById(actor)); - CreatureObject * const actorCreature = actorServerObj != nullptr ? actorServerObj->asCreatureObject() : nullptr; + CreatureObject * const actorCreature = actorServerObj != NULL ? actorServerObj->asCreatureObject() : NULL; if(!actorCreature) { WARNING(true, ("No actorCreature in commandFuncReceiveReward")); @@ -8680,7 +8680,7 @@ static void commandFuncOccupyUnlockedSlot(Command const &, NetworkId const &acto } // check to see if there is a cooldown is in effect for the command - int const timeNow = static_cast(::time(nullptr)); + int const timeNow = static_cast(::time(NULL)); if (!gmClient->isGod() && gm->getObjVars().hasItem("timeNextOccupyVacateUnlockedSlotCommandAllowed") && (gm->getObjVars().getType("timeNextOccupyVacateUnlockedSlotCommandAllowed") == DynamicVariable::INT)) { int timeNextOccupyVacateUnlockedSlotCommandAllowed = 0; @@ -8746,7 +8746,7 @@ static void commandFuncVacateUnlockedSlot(Command const &, NetworkId const &acto } // check to see if there is a cooldown is in effect for the command - int const timeNow = static_cast(::time(nullptr)); + int const timeNow = static_cast(::time(NULL)); if (!gmClient->isGod() && gm->getObjVars().hasItem("timeNextOccupyVacateUnlockedSlotCommandAllowed") && (gm->getObjVars().getType("timeNextOccupyVacateUnlockedSlotCommandAllowed") == DynamicVariable::INT)) { int timeNextOccupyVacateUnlockedSlotCommandAllowed = 0; @@ -8834,7 +8834,7 @@ static void commandFuncSwapUnlockedSlot(Command const &, NetworkId const &actor, } // check to see if there is a cooldown is in effect for the command - int const timeNow = static_cast(::time(nullptr)); + int const timeNow = static_cast(::time(NULL)); if (!gmClient->isGod() && gm->getObjVars().hasItem("timeNextOccupyVacateUnlockedSlotCommandAllowed") && (gm->getObjVars().getType("timeNextOccupyVacateUnlockedSlotCommandAllowed") == DynamicVariable::INT)) { int timeNextOccupyVacateUnlockedSlotCommandAllowed = 0; @@ -8902,7 +8902,7 @@ static void commandFuncPickupAllRoomItemsIntoInventory(Command const &, NetworkI return; // don't allow multiple /pickupAllRoomItemsIntoInventory and/or /dropAllInventoryItemsIntoRoom - int const timeNow = static_cast(::time(nullptr)); + int const timeNow = static_cast(::time(NULL)); int pickupDropAllItemsOperationTimeout = 0; if (targetObj->getObjVars().getItem("pickupDropAllItemsOperation.timeout", pickupDropAllItemsOperationTimeout) && (pickupDropAllItemsOperationTimeout > timeNow)) { @@ -9051,7 +9051,7 @@ static void commandFuncDropAllInventoryItemsIntoRoom(Command const &, NetworkId return; // don't allow multiple /pickupAllRoomItemsIntoInventory and/or /dropAllInventoryItemsIntoRoom - int const timeNow = static_cast(::time(nullptr)); + int const timeNow = static_cast(::time(NULL)); int pickupDropAllItemsOperationTimeout = 0; if (targetObj->getObjVars().getItem("pickupDropAllItemsOperation.timeout", pickupDropAllItemsOperationTimeout) && (pickupDropAllItemsOperationTimeout > timeNow)) { @@ -9255,7 +9255,7 @@ static void commandFuncRestoreDecorationLayout(Command const &, NetworkId const } // don't allow another restore on the pob while one is still in progress - int const timeNow = static_cast(::time(nullptr)); + int const timeNow = static_cast(::time(NULL)); int restoreDecorationOperationTimeout = 0; if (targetObj->getObjVars().getItem("restoreDecorationOperation.timeout", restoreDecorationOperationTimeout) && (restoreDecorationOperationTimeout > timeNow)) { @@ -9330,7 +9330,7 @@ static void commandFuncAreaPickRandomPlayer(Command const &, NetworkId const &ac if (!client) return; - int const timeNow = static_cast(::time(nullptr)); + int const timeNow = static_cast(::time(NULL)); if (!client->isGod() && targetObj->getObjVars().hasItem("timeNextAreaPickRandomPlayerCommandAllowed") && (targetObj->getObjVars().getType("timeNextAreaPickRandomPlayerCommandAllowed") == DynamicVariable::INT)) { int timeNextAreaPickRandomPlayerCommandAllowed = 0; @@ -9352,7 +9352,7 @@ static void commandFuncAreaPickRandomPlayer(Command const &, NetworkId const &ac if (!params.empty()) { Unicode::UnicodeStringVector tokens; - if (Unicode::tokenize(Unicode::toLower(params), tokens, nullptr, nullptr) && !tokens.empty()) + if (Unicode::tokenize(Unicode::toLower(params), tokens, NULL, NULL) && !tokens.empty()) { static Unicode::String const paramsPoint1 = Unicode::narrowToWide("-point"); static Unicode::String const paramsPoint2 = Unicode::narrowToWide("point"); @@ -9477,7 +9477,7 @@ static void commandFuncRoomPickRandomPlayer(Command const &, NetworkId const &ac if (!client) return; - int const timeNow = static_cast(::time(nullptr)); + int const timeNow = static_cast(::time(NULL)); if (!client->isGod() && targetObj->getObjVars().hasItem("timeNextRoomPickRandomPlayerCommandAllowed") && (targetObj->getObjVars().getType("timeNextRoomPickRandomPlayerCommandAllowed") == DynamicVariable::INT)) { int timeNextRoomPickRandomPlayerCommandAllowed = 0; @@ -9498,7 +9498,7 @@ static void commandFuncRoomPickRandomPlayer(Command const &, NetworkId const &ac if (!params.empty()) { Unicode::UnicodeStringVector tokens; - if (Unicode::tokenize(Unicode::toLower(params), tokens, nullptr, nullptr) && !tokens.empty()) + if (Unicode::tokenize(Unicode::toLower(params), tokens, NULL, NULL) && !tokens.empty()) { static Unicode::String const paramsPoint1 = Unicode::narrowToWide("-point"); static Unicode::String const paramsPoint2 = Unicode::narrowToWide("point"); diff --git a/engine/server/library/serverGame/src/shared/command/CommandQueue.cpp b/engine/server/library/serverGame/src/shared/command/CommandQueue.cpp index 913fa7e0..d581b8ae 100755 --- a/engine/server/library/serverGame/src/shared/command/CommandQueue.cpp +++ b/engine/server/library/serverGame/src/shared/command/CommandQueue.cpp @@ -309,11 +309,11 @@ void CommandQueue::executeCommandQueue() { CommandQueueEntry &entry = *(m_queue.begin()); - // try to recover from having a nullptr command + // try to recover from having a null command // maybe this should result in a fatal error? if ( entry.m_command == 0 ) { - WARNING( true, ( "executeCommandQueue: entry.m_command was nullptr! WTF?\n" ) ); + WARNING( true, ( "executeCommandQueue: entry.m_command was NULL! WTF?\n" ) ); m_queue.pop(); m_state = State_Waiting; m_nextEventTime = 0.f; @@ -387,7 +387,7 @@ void CommandQueue::executeCommandQueue() // switch state might have removed elements from the queue and invalidated entry // so we can't assume that we're still safe - if(!m_queue.empty() && (&(*(m_queue.begin())) == &entry) && m_queue.begin()->m_command != nullptr) + if(!m_queue.empty() && (&(*(m_queue.begin())) == &entry) && m_queue.begin()->m_command != NULL) { handleEntryRemoved(*(m_queue.begin()), true); m_queue.pop(); @@ -458,7 +458,7 @@ void CommandQueue::updateClient(TimerClass timerClass ) { CreatureObject * const creatureOwner = getServerOwner().asCreatureObject(); - if ( (creatureOwner == nullptr) + if ( (creatureOwner == NULL) || !creatureOwner->getClient()) { return; @@ -475,7 +475,7 @@ void CommandQueue::updateClient(TimerClass timerClass ) if ( entry.m_command == 0 ) // woah that's bad news! { - WARNING( true, ( "CommandQueue::updateClient(): command was nullptr!\n" ) ); + WARNING( true, ( "CommandQueue::updateClient(): command was NULL!\n" ) ); return; } @@ -539,7 +539,7 @@ void CommandQueue::notifyClient() { CreatureObject * const creatureOwner = getServerOwner().asCreatureObject(); - if ( (creatureOwner == nullptr) + if ( (creatureOwner == NULL) || !creatureOwner->getClient()) { return; @@ -555,7 +555,7 @@ void CommandQueue::notifyClient() if ( entry.m_command == 0 ) { - WARNING( true, ( "CommandQueue::notifyClient(): command was nullptr!\n" ) ); + WARNING( true, ( "CommandQueue::notifyClient(): command was NULL!\n" ) ); return; } @@ -612,7 +612,7 @@ bool CommandQueue::doWarmupTrigger(const CommandQueueEntry &entry ) CreatureObject * const creatureOwner = getServerOwner().asCreatureObject(); - if (creatureOwner != nullptr) + if (creatureOwner != NULL) { creatureOwner->doWarmupChecks( *entry.m_command, entry.m_targetId, entry.m_params, m_status, m_statusDetail ); @@ -620,7 +620,7 @@ bool CommandQueue::doWarmupTrigger(const CommandQueueEntry &entry ) if ( m_status == Command::CEC_Success ) { - FATAL( entry.m_command == 0, ( "entry had a nullptr command\n" ) ); + FATAL( entry.m_command == 0, ( "entry had a null command\n" ) ); std::vector timeValues; timeValues.push_back( entry.m_command->m_warmTime ); @@ -659,7 +659,7 @@ uint32 CommandQueue::getCurrentCommand() const if ( entry.m_command == 0 ) { - WARNING( true, ( "CommandQueue::getCurrentCommand(): command was nullptr!\n" ) ); + WARNING( true, ( "CommandQueue::getCurrentCommand(): command was NULL!\n" ) ); return 0; } @@ -680,7 +680,7 @@ void CommandQueue::switchState() if ( entry.m_command == 0 ) { - WARNING( true, ( "CommandQueue::switchState(): command was nullptr!\n" ) ); + WARNING( true, ( "CommandQueue::switchState(): command was NULL!\n" ) ); return; } @@ -726,7 +726,7 @@ void CommandQueue::switchState() bool const targetIsAuthoritative = target && target->isAuthoritative(); REPORT_LOG(true, ("CommandQueue::switchState():QUEUE_ENTRY_COMMAND: commandName=[%s] commandHash=[%lu] owner=[%s][%s][%s] target=[%s][%s][%s] sequenceId=[%lu] params=[%s] clearable=[%s] priority=[%d]\n", - entryCopy.m_command ? entryCopy.m_command->m_commandName.c_str() : "nullptr", + entryCopy.m_command ? entryCopy.m_command->m_commandName.c_str() : "NULL", entryCopy.m_command ? entryCopy.m_command->m_commandHash : 0, NameManager::getInstance().getPlayerName(getOwner().getNetworkId()).c_str(), getOwner().getNetworkId().getValueString().c_str(), @@ -746,7 +746,7 @@ void CommandQueue::switchState() for (; itEntry != m_queue.end(); ++itEntry) { - REPORT_LOG(true, ("CommandQueue::switchState():QUEUE_ENTRY_QUEUE: commandName=[%s]\n", itEntry->m_command ? itEntry->m_command->m_commandName.c_str() : "nullptr")); + REPORT_LOG(true, ("CommandQueue::switchState():QUEUE_ENTRY_QUEUE: commandName=[%s]\n", itEntry->m_command ? itEntry->m_command->m_commandName.c_str() : "NULL")); } } #endif @@ -838,7 +838,7 @@ void CommandQueue::switchState() bool const targetIsAuthoritative = target && target->isAuthoritative(); REPORT_LOG(true, ("CommandQueue::switchState():QUEUE_ENTRY_COMMAND: commandName=[%s] commandHash=[%lu] owner=[%s][%s][%s] target=[%s][%s][%s] sequenceId=[%lu] params=[%s] clearable=[%s] priority=[%d]\n", - entryCopy.m_command ? entryCopy.m_command->m_commandName.c_str() : "nullptr", + entryCopy.m_command ? entryCopy.m_command->m_commandName.c_str() : "NULL", entryCopy.m_command ? entryCopy.m_command->m_commandHash : 0, NameManager::getInstance().getPlayerName(getOwner().getNetworkId()).c_str(), getOwner().getNetworkId().getValueString().c_str(), @@ -858,7 +858,7 @@ void CommandQueue::switchState() for (; itEntry != m_queue.end(); ++itEntry) { - REPORT_LOG(true, ("CommandQueue::switchState():QUEUE_ENTRY_QUEUE: commandName=[%s]\n", itEntry->m_command ? itEntry->m_command->m_commandName.c_str() : "nullptr")); + REPORT_LOG(true, ("CommandQueue::switchState():QUEUE_ENTRY_QUEUE: commandName=[%s]\n", itEntry->m_command ? itEntry->m_command->m_commandName.c_str() : "NULL")); } } #endif @@ -1160,7 +1160,7 @@ void CommandQueue::notifyClientOfCommandRemoval(uint32 sequenceId, float waitTim CreatureObject * const creatureOwner = getServerOwner().asCreatureObject(); - if ( (creatureOwner != nullptr) + if ( (creatureOwner != NULL) && creatureOwner->getClient() && (sequenceId != 0)) { @@ -1359,7 +1359,7 @@ void CommandQueue::executeCommand(Command const &command, NetworkId const &targe CreatureObject * const creatureOwner = getServerOwner().asCreatureObject(); - if (creatureOwner != nullptr) + if (creatureOwner != NULL) { CreatureController * const creatureController = creatureOwner->getCreatureController(); if (creatureController && creatureController->getSecureTrade()) @@ -1399,7 +1399,7 @@ void CommandQueue::executeCommand(Command const &command, NetworkId const &targe TangibleObject * const tangibleOwner = getServerOwner().asTangibleObject(); - if (tangibleOwner != nullptr) + if (tangibleOwner != NULL) { // Really execute the command - swap targets if necessary, and call // forceExecuteCommand (which will handle messaging if not authoritative) @@ -1440,7 +1440,7 @@ CommandQueue * CommandQueue::getCommandQueue(Object & object) { Property * const property = object.getProperty(getClassPropertyId()); - return (property != nullptr) ? (static_cast(property)) : nullptr; + return (property != NULL) ? (static_cast(property)) : NULL; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/command/CommandQueue.h b/engine/server/library/serverGame/src/shared/command/CommandQueue.h index 03c861e0..bedf3717 100755 --- a/engine/server/library/serverGame/src/shared/command/CommandQueue.h +++ b/engine/server/library/serverGame/src/shared/command/CommandQueue.h @@ -218,7 +218,7 @@ public: void resetCooldowns(); // debug diagnostic - void spew(std::string * output = nullptr); + void spew(std::string * output = NULL); private: CommandQueue(CommandQueue const &); diff --git a/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesMarket.cpp b/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesMarket.cpp index 7529726f..d2d55dfd 100755 --- a/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesMarket.cpp +++ b/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesMarket.cpp @@ -201,7 +201,7 @@ namespace CommoditiesMarketNamespace Container::ContainerErrorCode tmp = Container::CEC_Success; ServerObject *bazaarContainer = auctionContainer.getBazaarContainer(); - if (!bazaarContainer || !ContainerInterface::canTransferTo(bazaarContainer, item, nullptr, tmp)) + if (!bazaarContainer || !ContainerInterface::canTransferTo(bazaarContainer, item, NULL, tmp)) { errorCode = ar_INVALID_ITEM_ID; } @@ -326,7 +326,7 @@ bool CommoditiesMarketNamespace::isVendorItemRestriction(ServerObject const & it return false; } - ItemRestriction const * itemRestriction = nullptr; + ItemRestriction const * itemRestriction = NULL; std::map::const_iterator const iterFind = itemRestrictionList.find(itemRestrictionFile); if (iterFind != itemRestrictionList.end()) @@ -1068,7 +1068,7 @@ void CommoditiesMarket::getCommoditiesServerConnection() if (ObjectIdManager::hasAvailableObjectId()) { s_market = new CommoditiesServerConnection(ConfigServerGame::getCommoditiesServerServiceBindInterface(), static_cast(ConfigServerGame::getCommoditiesServerServiceBindPort())); - s_timeMarketConnectionCreated = ::time(nullptr); + s_timeMarketConnectionCreated = ::time(NULL); } } @@ -1082,10 +1082,10 @@ int CommoditiesMarket::getCommoditiesServerConnectionAgeSeconds() if (s_timeMarketConnectionCreated <= 0) return 0; - if (s_market == nullptr) + if (s_market == NULL) return 0; - return static_cast(::time(nullptr) - s_timeMarketConnectionCreated); + return static_cast(::time(NULL) - s_timeMarketConnectionCreated); } // ---------------------------------------------------------------------- @@ -1295,7 +1295,7 @@ void CommoditiesMarket::onAddAuction(int sequence, int32 result, const NetworkId CreatureObject * const auctionCreator = dynamic_cast(NetworkIdManager::getObjectById(auctionOwnerId)); ServerObject * const item = dynamic_cast(NetworkIdManager::getObjectById(itemId)); - Client *client = nullptr; + Client *client = NULL; if (auctionCreator) client = auctionCreator->getClient(); @@ -1347,7 +1347,7 @@ void CommoditiesMarket::onAddAuction(int sequence, int32 result, const NetworkId if (container) { Container::ContainerErrorCode tmp = Container::CEC_Success; - bool result = ContainerInterface::transferItemToVolumeContainer(*container,*item, nullptr, tmp); + bool result = ContainerInterface::transferItemToVolumeContainer(*container,*item, NULL, tmp); if (!result) { LOG("CustomerService", ("Auction: Player %s transfer of item (%Ld) to auction container (%Ld) failed with code %d", @@ -2536,7 +2536,7 @@ void CommoditiesMarket::checkPendingLoads(const NetworkId &itemId) bool transferAllowed = true; Container::ContainerErrorCode error = Container::CEC_Success; - transferAllowed = ContainerInterface::canTransferTo(targetContainer, *item, nullptr, error); + transferAllowed = ContainerInterface::canTransferTo(targetContainer, *item, NULL, error); if (!transferAllowed) { @@ -2603,11 +2603,11 @@ void CommoditiesMarket::onGetItemReply(int32 result, int32 requestId, NetworkId LOG("AuctionRetrieval", ("CommoditiesMarket::received onGetItemReply for loading object %s for retrieval", itemId.getValueString().c_str())); AuctionResult auctionResult = ar_OK; CreatureObject *player = dynamic_cast(NetworkIdManager::getObjectById(itemOwnerId)); - Client *client = player ? player->getClient() : nullptr; + Client *client = player ? player->getClient() : NULL; bool transactionFailed = false; - ServerObject* vendor = nullptr; - ServerObject* item = nullptr; + ServerObject* vendor = NULL; + ServerObject* item = NULL; if (result == ARC_AuctionDoesNotExist) { @@ -2637,7 +2637,7 @@ void CommoditiesMarket::onGetItemReply(int32 result, int32 requestId, NetworkId vendor = safe_cast(ContainerInterface::getContainedByObject(*item)); if (vendor && vendor->getNetworkId() == location) { - bool retval = ContainerInterface::transferItemToVolumeContainer(*inventory, *item, nullptr, tmp, false); + bool retval = ContainerInterface::transferItemToVolumeContainer(*inventory, *item, NULL, tmp, false); if (retval) { @@ -2779,7 +2779,7 @@ void CommoditiesMarket::onIsVendorOwner(const NetworkId & requesterId, const Net ServerObject * const auctionContainer = safe_cast(NetworkIdManager::getObjectById(container)); NetworkId resultContainer = container; - const TangibleObject * resultContainerObject = auctionContainer ? auctionContainer->asTangibleObject() : nullptr; + const TangibleObject * resultContainerObject = auctionContainer ? auctionContainer->asTangibleObject() : NULL; if (auctionContainer) { marketName = getLocationString(*auctionContainer); @@ -2952,7 +2952,7 @@ void CommoditiesMarket::onGetItemDetailsReply(int32 result, int32 requestId, Net OutOfBandBase *base = *it; if (!base) { - WARNING(true, ("nullptr OOB Base for Auction Data")); + WARNING(true, ("NULL OOB Base for Auction Data")); return; } if (base->getTypeId() == OutOfBandPackager::OT_auctionToken) @@ -2979,7 +2979,7 @@ void CommoditiesMarket::onGetItemDetailsReply(int32 result, int32 requestId, Net base = *it; if (!base) { - WARNING(true, ("nullptr OOB Base for Auction Data")); + WARNING(true, ("NULL OOB Base for Auction Data")); return; } if (base->getTypeId() == OutOfBandPackager::OT_objectAttributes) @@ -3624,22 +3624,22 @@ void CommoditiesMarket::updateItemTypeMap(int itemTypeMapVersionNumber, int item // get the server template const ObjectTemplate * ot = ObjectTemplateList::fetch(static_cast(itemTemplateId)); - if (ot != nullptr) + if (ot != NULL) { objectName = StringId(std::string(ot->getName())); // get the shared template const ServerObjectTemplate * serverOt = ot->asServerObjectTemplate(); - if (serverOt != nullptr) + if (serverOt != NULL) { const std::string sharedTemplateName(serverOt->getSharedTemplate()); serverOt->releaseReference(); - serverOt = nullptr; + serverOt = NULL; ot = ObjectTemplateList::fetch(sharedTemplateName); - if (ot != nullptr) + if (ot != NULL) { const SharedObjectTemplate * sharedOt = ot->asSharedObjectTemplate(); - if (sharedOt != nullptr) + if (sharedOt != NULL) { gameObjectType = static_cast(sharedOt->getGameObjectType()); StringId const tempObjectName(objectName); @@ -3649,19 +3649,19 @@ void CommoditiesMarket::updateItemTypeMap(int itemTypeMapVersionNumber, int item objectName = tempObjectName; } sharedOt->releaseReference(); - sharedOt = nullptr; + sharedOt = NULL; } else { ot->releaseReference(); - ot = nullptr; + ot = NULL; } } } else { ot->releaseReference(); - ot = nullptr; + ot = NULL; } } else diff --git a/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesServerConnection.cpp b/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesServerConnection.cpp index ad3ff41c..1b7b95c9 100755 --- a/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesServerConnection.cpp +++ b/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesServerConnection.cpp @@ -576,7 +576,7 @@ void CommoditiesServerConnection::onReceive(const Archive::ByteStream & message) ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != nullptr) + if (dictionary.get() != NULL) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(response.getValue().first.first, diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserAi.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserAi.cpp index 994b695b..65298e93 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserAi.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserAi.cpp @@ -74,7 +74,7 @@ CreatureObject * const ConsoleCommandParserAiNamespace::getAiCreatureObject(Crea CreatureObject * const aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId); - if ( (aiCreatureObject == nullptr) + if ( (aiCreatureObject == NULL) || aiCreatureObject->isPlayerControlled()) { Chat::sendSystemMessage(user, Unicode::narrowToWide(FormattedString<1024>().sprintf("[FAILURE] Unable to resolve %s to an AI", aiNetworkId.getValueString().c_str())), Unicode::emptyString); @@ -113,7 +113,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { CreatureObject * const userCreatureObject = CreatureObject::getCreatureObject(userId); - if (userCreatureObject == nullptr) + if (userCreatureObject == NULL) { result += getErrorMessage(argv[0], ERR_FAIL); } @@ -121,7 +121,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { CreatureObject * const aiCreatureObject = getAiCreatureObject(*userCreatureObject, argv); - if (aiCreatureObject == nullptr) + if (aiCreatureObject == NULL) { result += getErrorMessage(argv[0], ERR_FAIL); } @@ -129,7 +129,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(aiCreatureObject->getController()); - if (aiCreatureController == nullptr) + if (aiCreatureController == NULL) { Chat::sendSystemMessage(*userCreatureObject, Unicode::narrowToWide(fs.sprintf("[FAILURE] Unable to resolve %s to an AI", aiCreatureObject->getNetworkId().getValueString().c_str())), Unicode::emptyString); result += getErrorMessage(argv[0], ERR_FAIL); @@ -148,7 +148,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { CreatureObject * const userCreatureObject = CreatureObject::getCreatureObject(userId); - if (userCreatureObject == nullptr) + if (userCreatureObject == NULL) { result += getErrorMessage(argv[0], ERR_FAIL); } @@ -167,7 +167,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri AICreatureController * const aiCreatureController = AICreatureController::getAiCreatureController(targetNetworkId); - if (aiCreatureController == nullptr) + if (aiCreatureController == NULL) { result = Unicode::narrowToWide(fs.sprintf("[FAILURE] Unable to resolve %s to an AI\n", targetNetworkId.getValueString().c_str())); result += getErrorMessage(argv[0], ERR_FAIL); @@ -190,7 +190,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { CellProperty const * const cellProperty = creatureOwner->getParentCell(); - if (cellProperty != nullptr) + if (cellProperty != NULL) { Vector const & position_p = creatureOwner->getPosition_p(); @@ -245,13 +245,13 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri TangibleObject const * const hateTargetTangibleObject = TangibleObject::asTangibleObject(hateTarget.getObject()); float const hate = iterHateList->second; std::string hateTargetName; - if (hateTargetTangibleObject != nullptr) + if (hateTargetTangibleObject != NULL) { hateTargetName = Unicode::wideToNarrow(hateTargetTangibleObject->getEncodedObjectName()).c_str(); } else { - hateTargetName = "nullptr"; + hateTargetName = "NULL"; } result += Unicode::narrowToWide(fs.sprintf("%s:%s(%.1f)\n", hateTargetName.c_str(), hateTarget.getValueString().c_str(), hate)); @@ -271,13 +271,13 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri CachedNetworkId const hateTarget(iter->first); TangibleObject const * const hateTargetTangibleObject = TangibleObject::asTangibleObject(hateTarget.getObject()); std::string hateTargetName; - if (hateTargetTangibleObject != nullptr) + if (hateTargetTangibleObject != NULL) { hateTargetName = Unicode::wideToNarrow(hateTargetTangibleObject->getEncodedObjectName()).c_str(); } else { - hateTargetName = "nullptr"; + hateTargetName = "NULL"; } result += Unicode::narrowToWide(fs.sprintf("%s:%s (%.2f, %lu, %lu)\n", hateTargetName.c_str(), hateTarget.getValueString().c_str(), iter->second.first, iter->second.second.first, iter->second.second.second)); @@ -295,7 +295,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { CreatureObject * const userCreatureObject = CreatureObject::getCreatureObject(userId); - if (userCreatureObject == nullptr) + if (userCreatureObject == NULL) { result += getErrorMessage(argv[0], ERR_FAIL); } @@ -313,7 +313,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri } TangibleObject const * const to = TangibleObject::asTangibleObject(NetworkIdManager::getObjectById(targetNetworkId)); - if (to == nullptr) + if (to == NULL) { result += Unicode::narrowToWide(fs.sprintf("Target %s not found or not TangibleObject\n", targetNetworkId.getValueString().c_str())); } @@ -342,13 +342,13 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri TangibleObject const * const hateTargetTangibleObject = TangibleObject::asTangibleObject(hateTarget.getObject()); float const hate = iterHateList->second; std::string hateTargetName; - if (hateTargetTangibleObject != nullptr) + if (hateTargetTangibleObject != NULL) { hateTargetName = Unicode::wideToNarrow(hateTargetTangibleObject->getEncodedObjectName()).c_str(); } else { - hateTargetName = "nullptr"; + hateTargetName = "NULL"; } result += Unicode::narrowToWide(fs.sprintf("%s:%s(%.1f)\n", hateTargetName.c_str(), hateTarget.getValueString().c_str(), hate)); @@ -368,13 +368,13 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri CachedNetworkId const hateTarget(iter->first); TangibleObject const * const hateTargetTangibleObject = TangibleObject::asTangibleObject(hateTarget.getObject()); std::string hateTargetName; - if (hateTargetTangibleObject != nullptr) + if (hateTargetTangibleObject != NULL) { hateTargetName = Unicode::wideToNarrow(hateTargetTangibleObject->getEncodedObjectName()).c_str(); } else { - hateTargetName = "nullptr"; + hateTargetName = "NULL"; } result += Unicode::narrowToWide(fs.sprintf("%s:%s (%.2f, %lu, %lu)\n", hateTargetName.c_str(), hateTarget.getValueString().c_str(), iter->second.first, iter->second.second.first, iter->second.second.second)); @@ -390,7 +390,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { CreatureObject * const userCreatureObject = CreatureObject::getCreatureObject(userId); - if (userCreatureObject == nullptr) + if (userCreatureObject == NULL) { result += getErrorMessage(argv[0], ERR_FAIL); } @@ -398,7 +398,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { CreatureObject * const aiCreatureObject = getAiCreatureObject(*userCreatureObject, argv); - if (aiCreatureObject == nullptr) + if (aiCreatureObject == NULL) { result += getErrorMessage(argv[0], ERR_FAIL); } @@ -416,7 +416,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { CreatureObject * const userCreatureObject = CreatureObject::getCreatureObject(userId); - if (userCreatureObject == nullptr) + if (userCreatureObject == NULL) { result += getErrorMessage(argv[0], ERR_FAIL); } @@ -424,7 +424,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { CreatureObject * const aiCreatureObject = getAiCreatureObject(*userCreatureObject, argv); - if (aiCreatureObject == nullptr) + if (aiCreatureObject == NULL) { result += getErrorMessage(argv[0], ERR_FAIL); } @@ -442,14 +442,14 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { CreatureObject * const userCreatureObject = CreatureObject::getCreatureObject(userId); - if (userCreatureObject == nullptr) + if (userCreatureObject == NULL) { result += getErrorMessage(argv[0], ERR_FAIL); } else { NetworkId aiNetworkId; - CreatureObject * aiCreatureObject = nullptr; + CreatureObject * aiCreatureObject = NULL; if (argv.size() > 2) { @@ -458,7 +458,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri aiNetworkId = NetworkId(Unicode::wideToNarrow(argv[1])); aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId); - if ( (aiCreatureObject != nullptr) + if ( (aiCreatureObject != NULL) && !aiCreatureObject->isPlayerControlled()) { aiCreatureObject->setBaseWalkSpeed(Unicode::toFloat(argv[2])); @@ -471,14 +471,14 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri aiNetworkId = userCreatureObject->getLookAtTarget(); aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId); - if ( (aiCreatureObject != nullptr) + if ( (aiCreatureObject != NULL) && !aiCreatureObject->isPlayerControlled()) { aiCreatureObject->setBaseWalkSpeed(Unicode::toFloat(argv[1])); } } - if ( (aiCreatureObject == nullptr) + if ( (aiCreatureObject == NULL) || aiCreatureObject->isPlayerControlled()) { Chat::sendSystemMessage(*userCreatureObject, Unicode::narrowToWide(fs.sprintf("[FAILURE] Unable to resolve %s to an AI", aiNetworkId.getValueString().c_str())), Unicode::emptyString); @@ -495,14 +495,14 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { CreatureObject * const userCreatureObject = CreatureObject::getCreatureObject(userId); - if (userCreatureObject == nullptr) + if (userCreatureObject == NULL) { result += getErrorMessage(argv[0], ERR_FAIL); } else { NetworkId aiNetworkId; - CreatureObject * aiCreatureObject = nullptr; + CreatureObject * aiCreatureObject = NULL; if (argv.size() > 2) { @@ -511,7 +511,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri aiNetworkId = NetworkId(Unicode::wideToNarrow(argv[1])); aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId); - if ( (aiCreatureObject != nullptr) + if ( (aiCreatureObject != NULL) && !aiCreatureObject->isPlayerControlled()) { aiCreatureObject->setBaseRunSpeed(Unicode::toFloat(argv[2])); @@ -524,14 +524,14 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri aiNetworkId = userCreatureObject->getLookAtTarget(); aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId); - if ( (aiCreatureObject != nullptr) + if ( (aiCreatureObject != NULL) && !aiCreatureObject->isPlayerControlled()) { aiCreatureObject->setBaseRunSpeed(Unicode::toFloat(argv[1])); } } - if ( (aiCreatureObject == nullptr) + if ( (aiCreatureObject == NULL) || aiCreatureObject->isPlayerControlled()) { Chat::sendSystemMessage(*userCreatureObject, Unicode::narrowToWide(fs.sprintf("[FAILURE] Unable to resolve %s to an AI", aiNetworkId.getValueString().c_str())), Unicode::emptyString); @@ -549,7 +549,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { CreatureObject * const userCreatureObject = CreatureObject::getCreatureObject(userId); - if (userCreatureObject != nullptr) + if (userCreatureObject != NULL) { NetworkId sparedAiNetworkId; @@ -573,9 +573,9 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri for (int i = 0; i < serverObjectCount; ++i) { ServerObject * const serverObject = ServerWorld::getObject(i); - CreatureObject * const creatureObject = (serverObject != nullptr) ? serverObject->asCreatureObject() : nullptr; + CreatureObject * const creatureObject = (serverObject != NULL) ? serverObject->asCreatureObject() : NULL; - if ( (creatureObject != nullptr) + if ( (creatureObject != NULL) && !creatureObject->isDead() && !creatureObject->isPlayerControlled() && (creatureObject->getNetworkId() != sparedAiNetworkId)) @@ -597,10 +597,10 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri else if (isAbbrev(argv[0], "debug")) { Object * const object = NetworkIdManager::getObjectById(userId); - ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; + ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; int temp; - if (serverObject != nullptr) + if (serverObject != NULL) { if ( serverObject->getObjVars().getItem("ai_debug_string", temp) && (temp > 0)) @@ -621,7 +621,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri Client * const client = serverObject->getClient(); - if (client != nullptr) + if (client != NULL) { AiDebugString aiDebugString; aiDebugString.enableClearClientFlag(); @@ -650,9 +650,9 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri else if (isAbbrev(argv[0], "debugText")) { Object * const object = NetworkIdManager::getObjectById(userId); - ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; + ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; - if (serverObject != nullptr) + if (serverObject != NULL) { AiDebugString::setTextEnabled(!AiDebugString::isTextEnabled()); diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCity.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCity.cpp index 5a89f47e..7b4af2ef 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCity.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCity.cpp @@ -415,7 +415,7 @@ bool ConsoleCommandParserCity::performParsing (const NetworkId & userId, const S } else { - time_t const rawtime = ::time(nullptr); + time_t const rawtime = ::time(NULL); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[3]).c_str()) - 1; diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCollection.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCollection.cpp index 7397c1e8..442bc622 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCollection.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCollection.cpp @@ -63,21 +63,21 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == nullptr) + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * c = o->asCreatureObject(); - if (c == nullptr) + if (c == NULL) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == nullptr) + if (p == NULL) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -172,21 +172,21 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == nullptr) + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * c = o->asCreatureObject(); - if (c == nullptr) + if (c == NULL) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == nullptr) + if (p == NULL) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -249,21 +249,21 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == nullptr) + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * c = o->asCreatureObject(); - if (c == nullptr) + if (c == NULL) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == nullptr) + if (p == NULL) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -326,21 +326,21 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == nullptr) + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * c = o->asCreatureObject(); - if (c == nullptr) + if (c == NULL) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == nullptr) + if (p == NULL) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -403,21 +403,21 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == nullptr) + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * c = o->asCreatureObject(); - if (c == nullptr) + if (c == NULL) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == nullptr) + if (p == NULL) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -466,21 +466,21 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == nullptr) + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * c = o->asCreatureObject(); - if (c == nullptr) + if (c == NULL) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == nullptr) + if (p == NULL) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -529,21 +529,21 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == nullptr) + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * c = o->asCreatureObject(); - if (c == nullptr) + if (c == NULL) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == nullptr) + if (p == NULL) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -592,21 +592,21 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == nullptr) + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * c = o->asCreatureObject(); - if (c == nullptr) + if (c == NULL) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == nullptr) + if (p == NULL) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -719,21 +719,21 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == nullptr) + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * c = o->asCreatureObject(); - if (c == nullptr) + if (c == NULL) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == nullptr) + if (p == NULL) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -776,7 +776,7 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c else if (isCommand (argv [0], "setServerFirstTime")) { - time_t const rawtime = ::time(nullptr); + time_t const rawtime = ::time(NULL); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[3]).c_str()) - 1; diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCraft.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCraft.cpp index 51b45c94..6a28b3eb 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCraft.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCraft.cpp @@ -151,7 +151,7 @@ bool ConsoleCommandParserCraft::performParsing (const NetworkId & userId, const else if (isAbbrev( argv [0], "enableSchematicFilter")) { - if (creatureObject->getClient() == nullptr || !creatureObject->getClient()->isGod()) + if (creatureObject->getClient() == NULL || !creatureObject->getClient()->isGod()) result += getErrorMessage (argv[0], ERR_FAIL); else { @@ -164,7 +164,7 @@ bool ConsoleCommandParserCraft::performParsing (const NetworkId & userId, const else if (isAbbrev( argv [0], "disableSchematicFilter")) { - if (creatureObject->getClient() == nullptr || !creatureObject->getClient()->isGod()) + if (creatureObject->getClient() == NULL || !creatureObject->getClient()->isGod()) result += getErrorMessage (argv[0], ERR_FAIL); else { diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCraftStation.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCraftStation.cpp index e3a443db..cc9bebd7 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCraftStation.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCraftStation.cpp @@ -53,19 +53,19 @@ bool ConsoleCommandParserCraftStation::performParsing (const NetworkId & userId, { /* // get the station TangibleObject * station = getStation(argv, result); - if (station == nullptr) + if (station == NULL) return true; // get the ingredient NetworkId ingredientId(Unicode::wideToNarrow (argv[2])); ServerObject * object = ServerWorld::findObjectByNetworkId(ingredientId); - if (object == nullptr) + if (object == NULL) { result += getErrorMessage (argv [0], ERR_INVALID_INGREDIENT); return true; } TangibleObject * ingredient = dynamic_cast(object); - if (ingredient == nullptr) + if (ingredient == NULL) { result += getErrorMessage (argv [0], ERR_INVALID_INGREDIENT); return true; @@ -82,19 +82,19 @@ bool ConsoleCommandParserCraftStation::performParsing (const NetworkId & userId, { /* // get the station TangibleObject * station = getStation(argv, result); - if (station == nullptr) + if (station == NULL) return true; // get the ingredient NetworkId ingredientId(Unicode::wideToNarrow (argv[2])); ServerObject * object = ServerWorld::findObjectByNetworkId(ingredientId); - if (object == nullptr) + if (object == NULL) { result += getErrorMessage (argv [0], ERR_INVALID_INGREDIENT); return true; } TangibleObject * ingredient = dynamic_cast(object); - if (ingredient == nullptr) + if (ingredient == NULL) { result += getErrorMessage (argv [0], ERR_INVALID_INGREDIENT); return true; @@ -112,13 +112,13 @@ bool ConsoleCommandParserCraftStation::performParsing (const NetworkId & userId, /* // get the station NetworkId id(Unicode::wideToNarrow (argv[1])); ServerObject * object = ServerWorld::findObjectByNetworkId(id); - if (object == nullptr) + if (object == NULL) { result += getErrorMessage (argv [0], ERR_INVALID_OBJECT); return true; } TangibleObject * station = dynamic_cast(object); - if (station == nullptr) + if (station == NULL) { result += getErrorMessage (argv [0], ERR_INVALID_OBJECT); return true; @@ -144,33 +144,33 @@ bool ConsoleCommandParserCraftStation::performParsing (const NetworkId & userId, /** * Finds the crafting station for a given id. * - * @return the station or nullptr on error + * @return the station or NULL on error */ TangibleObject * ConsoleCommandParserCraftStation::getStation(const StringVector_t & argv, String_t & result) { NetworkId id(Unicode::wideToNarrow (argv[1])); ServerObject * object = ServerWorld::findObjectByNetworkId(id); - if (object == nullptr) + if (object == NULL) { result += getErrorMessage (argv [0], ERR_INVALID_OBJECT); - return nullptr; + return NULL; } TangibleObject * station = dynamic_cast(object); - if (station == nullptr) + if (station == NULL) { result += getErrorMessage (argv [0], ERR_INVALID_OBJECT); - return nullptr; + return NULL; } // make sure the station is a atation and that it isn't in use if (!station->getObjVars().hasItem("crafting.station")) { result += getErrorMessage (argv [0], ERR_INVALID_STATION); - return nullptr; + return NULL; } if (station->getObjVars().hasItem("crafting.crafter")) { result += getErrorMessage (argv [0], ERR_STATION_IN_USE); - return nullptr; + return NULL; } return station; } // ConsoleCommandParserCraftStation::getStation diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserGuild.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserGuild.cpp index 3484d6c2..f2ca6349 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserGuild.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserGuild.cpp @@ -1218,17 +1218,17 @@ bool ConsoleCommandParserGuild::performParsing (const NetworkId & userId, const { // new guild leader is not a guild member, so make a guild member first, then make guild leader ServerObject const* o = dynamic_cast(ServerWorld::findObjectByNetworkId(leaderOid)); - CreatureObject const* c = (o ? o->asCreatureObject() : nullptr); - PlayerObject const* p = (c ? PlayerCreatureController::getPlayerObject(c) : nullptr); - if (o == nullptr) + CreatureObject const* c = (o ? o->asCreatureObject() : NULL); + PlayerObject const* p = (c ? PlayerCreatureController::getPlayerObject(c) : NULL); + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); } - else if (c == nullptr) + else if (c == NULL) { result += Unicode::narrowToWide("specified object is not a creature object\n"); } - else if (p == nullptr) + else if (p == NULL) { result += Unicode::narrowToWide("specified object is not a character object\n"); } diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserManufacture.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserManufacture.cpp index d8af83e3..1b405dd1 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserManufacture.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserManufacture.cpp @@ -64,7 +64,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, ManufactureInstallationObject * station = dynamic_cast(stationId.getObject()); ServerObject * ingredient = safe_cast(ingredientId.getObject()); - if (station == nullptr || ingredient == nullptr) + if (station == NULL || ingredient == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -77,7 +77,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, } ServerObject * hopper = station->getInputHopper(); - if (hopper == nullptr) + if (hopper == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -99,7 +99,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, ManufactureInstallationObject * station = dynamic_cast(stationId.getObject()); ServerObject * ingredient = safe_cast(ingredientId.getObject()); - if (station == nullptr || ingredient == nullptr) + if (station == NULL || ingredient == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -112,7 +112,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, } ServerObject * hopper = station->getInputHopper(); - if (hopper == nullptr) + if (hopper == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -124,7 +124,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, return true; } - if (playerObject->getInventory() == nullptr) + if (playerObject->getInventory() == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -144,7 +144,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, ManufactureInstallationObject * station = dynamic_cast(stationId.getObject()); - if (station == nullptr) + if (station == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -157,14 +157,14 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, } ServerObject * hopper = station->getInputHopper(); - if (hopper == nullptr) + if (hopper == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } VolumeContainer * container = ContainerInterface::getVolumeContainer(*hopper); - if (container == nullptr) + if (container == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -174,7 +174,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, while (iter != container->end()) { const Container::ContainedItem & itemId = *iter; - if (itemId.getObject() != nullptr) + if (itemId.getObject() != NULL) { const ServerObject * item = safe_cast(itemId.getObject()); result += Unicode::narrowToWide("("); @@ -182,7 +182,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, result += Unicode::narrowToWide(") - "); const ResourceContainerObject * crate = dynamic_cast< const ResourceContainerObject *>(item); - if (crate != nullptr) + if (crate != NULL) { char buffer[32]; _itoa(crate->getQuantity(), buffer, 10); @@ -226,7 +226,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, ManufactureInstallationObject * station = dynamic_cast(stationId.getObject()); ManufactureSchematicObject * schematic = dynamic_cast(schematicId.getObject()); - if (station == nullptr || schematic == nullptr) + if (station == NULL || schematic == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -239,7 +239,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, } // if (station->addSchematic(*schematic, playerObject)) - if (station->addSchematic(*schematic, nullptr)) + if (station->addSchematic(*schematic, NULL)) result += getErrorMessage(argv[0], ERR_SUCCESS); else result += getErrorMessage(argv[0], ERR_INVALID_CONTAINER_TRANSFER); @@ -253,7 +253,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, ManufactureInstallationObject * station = dynamic_cast(stationId.getObject()); - if (station == nullptr) + if (station == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -266,9 +266,9 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, } ManufactureSchematicObject * schematic = station->getSchematic(); - if (schematic != nullptr) + if (schematic != NULL) { - if (playerObject->getDatapad() == nullptr) + if (playerObject->getDatapad() == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -291,7 +291,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, ManufactureInstallationObject * station = dynamic_cast(stationId.getObject()); - if (station == nullptr) + if (station == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -304,7 +304,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, } ManufactureSchematicObject * schematic = station->getSchematic(); - if (schematic != nullptr) + if (schematic != NULL) { result += Unicode::narrowToWide("("); result += Unicode::narrowToWide(schematic->getNetworkId().getValueString()); @@ -325,7 +325,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, ManufactureInstallationObject * station = dynamic_cast(stationId.getObject()); - if (station == nullptr) + if (station == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); } @@ -344,7 +344,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, ManufactureInstallationObject * station = dynamic_cast(stationId.getObject()); - if (station == nullptr) + if (station == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); } @@ -360,7 +360,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, else if (isAbbrev( argv [0], "getObjects")) { ServerObject * myInventory = playerObject->getInventory(); - if (myInventory == nullptr) + if (myInventory == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -370,21 +370,21 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, ManufactureInstallationObject * station = dynamic_cast(stationId.getObject()); - if (station == nullptr) + if (station == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } ServerObject * hopper = station->getOutputHopper(); - if (hopper == nullptr) + if (hopper == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } VolumeContainer * container = ContainerInterface::getVolumeContainer(*hopper); - if (container == nullptr) + if (container == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -394,7 +394,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, while (iter != container->end()) { const Container::ContainedItem & itemId = *iter; - if (itemId.getObject() != nullptr) + if (itemId.getObject() != NULL) { ContainerInterface::transferItemToVolumeContainer (*myInventory, *safe_cast(itemId.getObject()), playerObject, tmp); } @@ -419,21 +419,21 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, ManufactureInstallationObject * station = dynamic_cast(stationId.getObject()); - if (station == nullptr) + if (station == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } ServerObject * hopper = station->getOutputHopper(); - if (hopper == nullptr) + if (hopper == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } VolumeContainer * container = ContainerInterface::getVolumeContainer(*hopper); - if (container == nullptr) + if (container == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -443,7 +443,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, while (iter != container->end()) { const Container::ContainedItem & itemId = *iter; - if (itemId.getObject() != nullptr) + if (itemId.getObject() != NULL) { const ServerObject * item = safe_cast(itemId.getObject()); result += Unicode::narrowToWide("("); diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserMoney.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserMoney.cpp index feff5d1e..33801387 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserMoney.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserMoney.cpp @@ -58,7 +58,7 @@ bool ConsoleCommandParserMoney::performParsing (const NetworkId & userId, const { NetworkId sourceId(Unicode::wideToNarrow (argv[1])); NetworkId targetId(Unicode::wideToNarrow (argv[2])); - int amount(strtoul(Unicode::wideToNarrow (argv[3]).c_str (), nullptr, 10)); + int amount(strtoul(Unicode::wideToNarrow (argv[3]).c_str (), NULL, 10)); ServerObject* source = dynamic_cast(NetworkIdManager::getObjectById(sourceId)); if (!source) @@ -75,7 +75,7 @@ bool ConsoleCommandParserMoney::performParsing (const NetworkId & userId, const { NetworkId sourceId(Unicode::wideToNarrow (argv[1])); NetworkId targetId(Unicode::wideToNarrow (argv[2])); - int amount(strtoul(Unicode::wideToNarrow (argv[3]).c_str (), nullptr, 10)); + int amount(strtoul(Unicode::wideToNarrow (argv[3]).c_str (), NULL, 10)); ServerObject* source = dynamic_cast(NetworkIdManager::getObjectById(sourceId)); if (!source) @@ -91,7 +91,7 @@ bool ConsoleCommandParserMoney::performParsing (const NetworkId & userId, const else if (isAbbrev( argv [0], "namedTransfer")) { NetworkId sourceId(Unicode::wideToNarrow (argv[1])); - int amount(strtol(Unicode::wideToNarrow (argv[3]).c_str (), nullptr, 10)); + int amount(strtol(Unicode::wideToNarrow (argv[3]).c_str (), NULL, 10)); ServerObject* source = dynamic_cast(NetworkIdManager::getObjectById(sourceId)); if (!source) @@ -117,7 +117,7 @@ bool ConsoleCommandParserMoney::performParsing (const NetworkId & userId, const else if (isAbbrev( argv [0], "withdraw")) { NetworkId sourceId(Unicode::wideToNarrow (argv[1])); - int amount(strtoul(Unicode::wideToNarrow (argv[2]).c_str (), nullptr, 10)); + int amount(strtoul(Unicode::wideToNarrow (argv[2]).c_str (), NULL, 10)); ServerObject* source = dynamic_cast(NetworkIdManager::getObjectById(sourceId)); if (!source) @@ -133,7 +133,7 @@ bool ConsoleCommandParserMoney::performParsing (const NetworkId & userId, const else if (isAbbrev( argv [0], "deposit")) { NetworkId sourceId(Unicode::wideToNarrow (argv[1])); - int amount(strtoul(Unicode::wideToNarrow (argv[2]).c_str (), nullptr, 10)); + int amount(strtoul(Unicode::wideToNarrow (argv[2]).c_str (), NULL, 10)); ServerObject* source = dynamic_cast(NetworkIdManager::getObjectById(sourceId)); if (!source) @@ -175,7 +175,7 @@ bool ConsoleCommandParserMoney::performParsing (const NetworkId & userId, const } else if (isAbbrev( argv [0], "setGalacticReserve")) { - int const newGalacticReserve(strtoul(Unicode::wideToNarrow (argv[2]).c_str (), nullptr, 10)); + int const newGalacticReserve(strtoul(Unicode::wideToNarrow (argv[2]).c_str (), NULL, 10)); if ((newGalacticReserve < 0) || (newGalacticReserve > ConfigServerGame::getMaxGalacticReserveDepositBillion())) { result += Unicode::narrowToWide(FormattedString<1024>().sprintf("specified galactic reserve balance (%d) must be in the (inclusive) range (0, %d)\n", newGalacticReserve, ConfigServerGame::getMaxGalacticReserveDepositBillion())); diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserNpc.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserNpc.cpp index 71f81106..929f6413 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserNpc.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserNpc.cpp @@ -52,19 +52,19 @@ bool ConsoleCommandParserNpc::performParsing (const NetworkId & userId, const St NetworkId const oid(Unicode::wideToNarrow(argv[1])); ServerObject * const object = ServerWorld::findObjectByNetworkId(oid); - if (object == nullptr) + if (object == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } TangibleObject * const npc = object->asTangibleObject(); - if (npc == nullptr) + if (npc == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - playerObject->startNpcConversation(*npc, nullptr, NpcConversationData::CS_Player, 0); + playerObject->startNpcConversation(*npc, NULL, NpcConversationData::CS_Player, 0); result += getErrorMessage (argv[0], ERR_SUCCESS); } @@ -82,7 +82,7 @@ bool ConsoleCommandParserNpc::performParsing (const NetworkId & userId, const St else if (isAbbrev( argv [0], "respond")) { TangibleObject * const playerObject = safe_cast(ServerWorld::findObjectByNetworkId(userId)); - int const response = strtol(Unicode::wideToNarrow(argv[1]).c_str (), nullptr, 10); + int const response = strtol(Unicode::wideToNarrow(argv[1]).c_str (), NULL, 10); playerObject->respondToNpc(response); result += getErrorMessage (argv[0], ERR_SUCCESS); } diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserObject.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserObject.cpp index a092fc3a..ed626f69 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserObject.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserObject.cpp @@ -119,23 +119,23 @@ namespace ConsoleCommandParserObjectNamespace { WARNING(true, ("ConsoleCommandParserObject invalid object template [%s]", templateName.c_str())); ot->releaseReference(); - return nullptr; + return NULL; } if (sot->getId() == ServerShipObjectTemplate::ServerShipObjectTemplate_tag) { SharedObjectTemplate const * const sharedTemplate = safe_cast(ObjectTemplateList::fetch(sot->getSharedTemplate())); - if (nullptr == sharedTemplate || + if (NULL == sharedTemplate || (sharedTemplate->getGameObjectType() != SharedObjectTemplate::GOT_ship_mining_asteroid_dynamic && sharedTemplate->getGameObjectType() != SharedObjectTemplate::GOT_ship_mining_asteroid_static)) { ot->releaseReference(); - return nullptr; + return NULL; } } return sot; } - return nullptr; + return NULL; } void checkBadBuildClusterObject(ServerObject *& o) @@ -523,7 +523,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject const * const obj = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (obj == nullptr) + if (obj == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -531,7 +531,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const Client const * const client = obj->getClient(); - if(client == nullptr) + if(client == NULL) { result += Unicode::narrowToWide("specified object is not a client object\n"); return true; @@ -561,7 +561,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const } const char *objectTemplateName = obj->getObjectTemplateName(); - result += Unicode::narrowToWide(FormattedString<512>().sprintf("object %s (%s) has %d total opened objects\n", obj->getNetworkId().getValueString().c_str(), (objectTemplateName ? objectTemplateName : "nullptr object template"), opened.size())); + result += Unicode::narrowToWide(FormattedString<512>().sprintf("object %s (%s) has %d total opened objects\n", obj->getNetworkId().getValueString().c_str(), (objectTemplateName ? objectTemplateName : "NULL object template"), opened.size())); if(!text.empty()) { @@ -615,7 +615,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const ServerObject * const object = dynamic_cast(NetworkIdManager::getObjectById(oid)); if (object) { - uint32 const pid = (strtoul(Unicode::wideToNarrow(argv[2]).c_str (), nullptr, 10)); + uint32 const pid = (strtoul(Unicode::wideToNarrow(argv[2]).c_str (), NULL, 10)); GenericValueTypeMessage > const msg( "RequestAuthTransfer", std::make_pair( @@ -646,9 +646,9 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const } real x,y,z; - x = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), nullptr)); - y = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr)); - z = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), nullptr)); + x = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), NULL)); + y = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL)); + z = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), NULL)); ServerObject *newObject = 0; ServerObjectTemplate const * const ot = getObjectTemplateForCreation(tmpString); @@ -706,9 +706,9 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const } real x,y,z; - x = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), nullptr)); - y = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr)); - z = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), nullptr)); + x = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), NULL)); + y = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL)); + z = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), NULL)); // check to see if we're in a region we shouldn't be building in if ( ConfigServerGame::getBlockBuildRegionPlacement() ) @@ -726,10 +726,10 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const } real quatW,quatX,quatY,quatZ; - quatW = static_cast(strtod(Unicode::wideToNarrow(argv[5]).c_str(), nullptr)); - quatX = static_cast(strtod(Unicode::wideToNarrow(argv[6]).c_str(), nullptr)); - quatY = static_cast(strtod(Unicode::wideToNarrow(argv[7]).c_str(), nullptr)); - quatZ = static_cast(strtod(Unicode::wideToNarrow(argv[8]).c_str(), nullptr)); + quatW = static_cast(strtod(Unicode::wideToNarrow(argv[5]).c_str(), NULL)); + quatX = static_cast(strtod(Unicode::wideToNarrow(argv[6]).c_str(), NULL)); + quatY = static_cast(strtod(Unicode::wideToNarrow(argv[7]).c_str(), NULL)); + quatZ = static_cast(strtod(Unicode::wideToNarrow(argv[8]).c_str(), NULL)); ServerObject * const cell = safe_cast(ContainerInterface::getContainingCellObject(*playerObject)); @@ -934,7 +934,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const NetworkId oid(Unicode::wideToNarrow(argv[2])); ServerObject* object = dynamic_cast(NetworkIdManager::getObjectById(oid)); - if (object == nullptr) + if (object == NULL) { //container does not exist result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); @@ -994,7 +994,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId cellId(Unicode::wideToNarrow(argv[2])); ServerObject* cell = dynamic_cast(NetworkIdManager::getObjectById(cellId)); - if (cell == nullptr && cellId != NetworkId::cms_invalid) + if (cell == NULL && cellId != NetworkId::cms_invalid) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1011,9 +1011,9 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const } real x,y,z; - x = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr)); - y = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), nullptr)); - z = static_cast(strtod(Unicode::wideToNarrow(argv[5]).c_str(), nullptr)); + x = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL)); + y = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), NULL)); + z = static_cast(strtod(Unicode::wideToNarrow(argv[5]).c_str(), NULL)); ServerObject *newObject = 0; ServerObjectTemplate const * const ot = getObjectTemplateForCreation(tmpString); @@ -1070,22 +1070,22 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const NetworkId cellId(Unicode::wideToNarrow(argv[2])); ServerObject * const cell = safe_cast(NetworkIdManager::getObjectById(cellId)); - if (cell == nullptr && cellId != NetworkId::cms_invalid) + if (cell == NULL && cellId != NetworkId::cms_invalid) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } real x,y,z; - x = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr)); - y = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), nullptr)); - z = static_cast(strtod(Unicode::wideToNarrow(argv[5]).c_str(), nullptr)); + x = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL)); + y = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), NULL)); + z = static_cast(strtod(Unicode::wideToNarrow(argv[5]).c_str(), NULL)); real quatW,quatX,quatY,quatZ; - quatW = static_cast(strtod(Unicode::wideToNarrow(argv[6]).c_str(), nullptr)); - quatX = static_cast(strtod(Unicode::wideToNarrow(argv[7]).c_str(), nullptr)); - quatY = static_cast(strtod(Unicode::wideToNarrow(argv[8]).c_str(), nullptr)); - quatZ = static_cast(strtod(Unicode::wideToNarrow(argv[9]).c_str(), nullptr)); + quatW = static_cast(strtod(Unicode::wideToNarrow(argv[6]).c_str(), NULL)); + quatX = static_cast(strtod(Unicode::wideToNarrow(argv[7]).c_str(), NULL)); + quatY = static_cast(strtod(Unicode::wideToNarrow(argv[8]).c_str(), NULL)); + quatZ = static_cast(strtod(Unicode::wideToNarrow(argv[9]).c_str(), NULL)); ServerObject *newObject = 0; ServerObjectTemplate const * const ot = getObjectTemplateForCreation(tmpString); @@ -1165,7 +1165,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject* object = dynamic_cast(NetworkIdManager::getObjectById(oid)); - if (object == nullptr) + if (object == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1200,7 +1200,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject* object = dynamic_cast(NetworkIdManager::getObjectById(oid)); - if (object == nullptr) + if (object == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1236,7 +1236,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const const NetworkId oid (Unicode::wideToNarrow(argv[1])); ServerObject* const object = safe_cast(NetworkIdManager::getObjectById(oid)); - if (object == nullptr) + if (object == NULL) result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); else if (object->getClient()) result += getErrorMessage(argv[0], ERR_INVALID_USER); @@ -1268,7 +1268,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const ServerObject* const object = safe_cast(NetworkIdManager::getObjectById(oid)); - if (object == nullptr) + if (object == NULL) result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); // ---------- @@ -1279,11 +1279,11 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { ServerObject * object = ServerWorld::getObject(i); - if(object == nullptr) continue; + if(object == NULL) continue; CreatureObject * creature = object->asCreatureObject(); - if(creature == nullptr) continue; + if(creature == NULL) continue; if(creature->getNetworkId() == oid) continue; @@ -1307,11 +1307,11 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { ServerObject * object = ServerWorld::getObject(i); - if(object == nullptr) continue; + if(object == NULL) continue; CreatureObject * creature = object->asCreatureObject(); - if(creature == nullptr) continue; + if(creature == NULL) continue; if(creature->getParentCell() != CellProperty::getWorldCellProperty()) continue; @@ -1331,9 +1331,9 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); Vector pos; - pos.x = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), nullptr)); - pos.y = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr)); - pos.z = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), nullptr)); + pos.x = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), NULL)); + pos.y = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL)); + pos.z = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), NULL)); // disallow certain object types from being "move" bool allowMove = true; @@ -1418,7 +1418,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject* o = ServerWorld::findObjectByNetworkId(oid); - if (o == nullptr) + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1433,9 +1433,9 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); real r,p,y; - r = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), nullptr)); - p = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr)); - y = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), nullptr)); + r = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), NULL)); + p = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL)); + y = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), NULL)); if (rotateObject(oid, r, p, y)) { result += getErrorMessage(argv[0], ERR_SUCCESS); @@ -1450,7 +1450,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject* o = ServerWorld::findObjectByNetworkId(oid); - if (o == nullptr) + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1479,7 +1479,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const // erase keys assigned to this player. s_playerCreatureNameMap.erase(userId); - if (dataTable != nullptr) + if (dataTable != NULL) { StringVector creatureStrings; { @@ -1548,7 +1548,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId const oid(Unicode::wideToNarrow(argv[1])); ServerObject* const o = ServerWorld::findObjectByNetworkId(oid); - if (o == nullptr) + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1580,7 +1580,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - o->deletePobPersistedContents(nullptr, DeleteReasons::God); + o->deletePobPersistedContents(NULL, DeleteReasons::God); result += getErrorMessage(argv[0], ERR_SUCCESS); } else if (isCommand( argv[0], "moveItemInHouseToMe")) @@ -1607,7 +1607,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); TangibleObject* vendor = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (vendor == nullptr) + if (vendor == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1621,7 +1621,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); TangibleObject* vendor = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (vendor == nullptr) + if (vendor == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1699,13 +1699,13 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); CreatureObject* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == nullptr) + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } real scale; - scale = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), nullptr)); + scale = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), NULL)); o->setMovementScale(scale); result += getErrorMessage(argv[0], ERR_SUCCESS); } @@ -1716,13 +1716,13 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); CreatureObject* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == nullptr) + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } real scale; - scale = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), nullptr)); + scale = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), NULL)); o->setScaleFactor(scale); result += getErrorMessage(argv[0], ERR_SUCCESS); } @@ -1765,7 +1765,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject* o = ServerWorld::findObjectByNetworkId(oid); - if (o == nullptr) + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1788,13 +1788,13 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { CachedNetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(oid.getObject()); - if (o == nullptr) + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } Container const * const container = ContainerInterface::getContainer(*o); - if (container == nullptr) + if (container == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1811,7 +1811,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = ServerWorld::findObjectByNetworkId(oid); - if (o == nullptr) + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1846,7 +1846,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = ServerWorld::findObjectByNetworkId(oid); - if (o == nullptr) + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1881,7 +1881,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = ServerWorld::findObjectByNetworkId(oid); - if (o == nullptr) + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1914,7 +1914,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); TangibleObject* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == nullptr) + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1940,7 +1940,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); const ServerObject* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == nullptr) + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1976,7 +1976,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const ServerMessageForwarding::end(); - if (ObjectTemplateList::reload(templateFile) == nullptr) + if (ObjectTemplateList::reload(templateFile) == NULL) { result += getErrorMessage(argv[0], ERR_TEMPLATE_NOT_LOADED); return true; @@ -1991,7 +1991,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); CreatureObject * creature = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (creature == nullptr || !creature->isIncapacitated()) + if (creature == NULL || !creature->isIncapacitated()) result += Unicode::narrowToWide("no"); else if (creature->isDead()) result += Unicode::narrowToWide("dead"); @@ -2011,11 +2011,11 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const LocationData d; d.name = argv[2]; Vector pos; - pos.x = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr)); - pos.y = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), nullptr)); - pos.z = static_cast(strtod(Unicode::wideToNarrow(argv[5]).c_str(), nullptr)); + pos.x = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL)); + pos.y = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), NULL)); + pos.z = static_cast(strtod(Unicode::wideToNarrow(argv[5]).c_str(), NULL)); d.location.setCenter(pos); - float radius = static_cast(strtod(Unicode::wideToNarrow(argv[6]).c_str(), nullptr)); + float radius = static_cast(strtod(Unicode::wideToNarrow(argv[6]).c_str(), NULL)); d.location.setRadius(radius); o->addLocationTarget(d); } @@ -2079,7 +2079,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const oid.getObject()); const CreatureObject * creature = dynamic_cast( tangible); - if (creature != nullptr) + if (creature != NULL) { char buffer[1024]; sprintf(buffer, "he:%d, co=%d, ac=%d, st=%d, mi=%d, wi=%d", @@ -2091,7 +2091,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const creature->getAttribute(Attributes::Willpower)); result += Unicode::narrowToWide(buffer); } - else if (tangible != nullptr) + else if (tangible != NULL) { char buffer[1024]; sprintf(buffer, "max hp = %d, damage taken = %d", @@ -2156,13 +2156,13 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const bool value = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), 0, 10) != 0; ServerObject * const o = dynamic_cast(ServerWorld::findObjectByNetworkId(actorId)); - CreatureObject * const c = (o ? o->asCreatureObject() : nullptr); - if (o == nullptr) + CreatureObject * const c = (o ? o->asCreatureObject() : NULL); + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - if (c == nullptr) + if (c == NULL) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; @@ -2261,7 +2261,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const const char *objectTemplateName = obj->getObjectTemplateName(); - result += Unicode::narrowToWide(FormattedString<512>().sprintf("object %s (%s) has %d total observers (%d observers on this game server)\n", obj->getNetworkId().getValueString().c_str(), (objectTemplateName ? objectTemplateName : "nullptr object template"), obj->getObserversCount(), observerList.size())); + result += Unicode::narrowToWide(FormattedString<512>().sprintf("object %s (%s) has %d total observers (%d observers on this game server)\n", obj->getNetworkId().getValueString().c_str(), (objectTemplateName ? objectTemplateName : "NULL object template"), obj->getObserversCount(), observerList.size())); if (!observers.empty()) { @@ -2560,7 +2560,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const else if(isCommand(argv[0], "setPathLinkDistance")) { - float dist = static_cast(strtod(Unicode::wideToNarrow(argv[1]).c_str(), nullptr)); + float dist = static_cast(strtod(Unicode::wideToNarrow(argv[1]).c_str(), NULL)); CityPathGraphManager::setLinkDistance(dist); @@ -2601,7 +2601,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { CachedNetworkId const oid(Unicode::wideToNarrow(argv[1])); TangibleObject * object = dynamic_cast(oid.getObject()); - if (object == nullptr) + if (object == NULL) result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); else { @@ -2619,7 +2619,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { CachedNetworkId const oid(Unicode::wideToNarrow(argv[1])); TangibleObject * object = dynamic_cast(oid.getObject()); - if (object == nullptr) + if (object == NULL) result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); else { @@ -2653,7 +2653,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const ServerObject * object = dynamic_cast(oid.getObject()); CreatureObject * creature = dynamic_cast(object); - if (object == nullptr) + if (object == NULL) result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); else { @@ -2694,7 +2694,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const NetworkId oid(Unicode::wideToNarrow(argv[1])); CreatureObject *creature = dynamic_cast(NetworkIdManager::getObjectById(oid)); - PlayerObject *player = nullptr; + PlayerObject *player = NULL; if (creature) player = PlayerCreatureController::getPlayerObject(creature); if (player) @@ -2739,7 +2739,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const NetworkId oid(Unicode::wideToNarrow(argv[1])); CreatureObject *creature = dynamic_cast(NetworkIdManager::getObjectById(oid)); - PlayerObject *player = nullptr; + PlayerObject *player = NULL; if (creature) player = PlayerCreatureController::getPlayerObject(creature); if (player) @@ -2864,7 +2864,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); const InstallationObject* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == nullptr) + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -2888,7 +2888,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const NetworkId oid(Unicode::wideToNarrow(argv[1])); InstallationObject* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == nullptr) + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -2904,7 +2904,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); const InstallationObject* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == nullptr) + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -2928,7 +2928,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const NetworkId oid(Unicode::wideToNarrow(argv[1])); InstallationObject* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == nullptr) + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -3056,7 +3056,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject *o = safe_cast(NetworkIdManager::getObjectById(oid)); - if (o != nullptr && o->asCreatureObject() != nullptr && o->isPlayerControlled()) + if (o != NULL && o->asCreatureObject() != NULL && o->isPlayerControlled()) { CreatureObject * creatureTarget = o->asCreatureObject(); @@ -3068,7 +3068,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const for (CreatureObject::SkillList::const_iterator i = skills.begin(); i != skills.end(); ++i) { const SkillObject * profession = (*i)->findProfessionForSkill(); - if (profession != nullptr) + if (profession != NULL) professionName = profession->getSkillName(); } } @@ -3317,7 +3317,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const NetworkId oid (Unicode::wideToNarrow(argv[1])); ServerObject* const object = safe_cast(NetworkIdManager::getObjectById(oid)); - if (object == nullptr) + if (object == NULL) result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); else if (!object->getClient()) result += getErrorMessage(argv[0], ERR_INVALID_USER); @@ -3346,7 +3346,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const NetworkId ownerId (Unicode::wideToNarrow(argv[2])); ServerObject * const object = safe_cast(NetworkIdManager::getObjectById(houseId)); - TangibleObject * const tangible = object ? object->asTangibleObject() : nullptr; + TangibleObject * const tangible = object ? object->asTangibleObject() : NULL; if (!tangible) result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); else @@ -3359,7 +3359,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { ServerObject * object = safe_cast(NetworkIdManager::getObjectById(playerObject->getLookAtTarget())); - if (nullptr == object) + if (NULL == object) object = playerObject; RegionMaster::RegionVector rv; @@ -3373,7 +3373,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const for (RegionMaster::RegionVector::const_iterator it = rv.begin(); it != rv.end(); ++it) { Region const * const r = *it; - if (nullptr != r) + if (NULL != r) { _itoa(r->getGeography(), buf, 10); result += Unicode::narrowToWide(buf); @@ -3390,7 +3390,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { ServerObject * const target = safe_cast(NetworkIdManager::getObjectById(playerObject->getLookAtTarget())); - if (nullptr == target) + if (NULL == target) { result += Unicode::narrowToWide("Invalid target"); return true; @@ -3434,7 +3434,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const ServerObject * object = safe_cast(NetworkIdManager::getObjectById(playerObject->getLookAtTarget())); - if (nullptr == object) + if (NULL == object) object = playerObject; Vector const & pos_w = object->getPosition_w(); @@ -3449,7 +3449,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { ServerObject * object = safe_cast(NetworkIdManager::getObjectById(playerObject->getLookAtTarget())); - if (nullptr == object) + if (NULL == object) object = playerObject; Vector const & pos_w = object->getPosition_w(); @@ -3463,7 +3463,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { ServerObject * object = safe_cast(NetworkIdManager::getObjectById(playerObject->getLookAtTarget())); - if (nullptr == object) + if (NULL == object) object = playerObject; Vector const & pos_w = object->getPosition_w(); @@ -3477,7 +3477,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); const ServerObject* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == nullptr) + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -3503,7 +3503,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); const ServerObject* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == nullptr) + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -3576,13 +3576,13 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject const* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - CreatureObject const* c = (o ? o->asCreatureObject() : nullptr); - if (o == nullptr) + CreatureObject const* c = (o ? o->asCreatureObject() : NULL); + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - else if (c == nullptr) + else if (c == NULL) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; @@ -3590,7 +3590,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const else { PlayerObject const* p = PlayerCreatureController::getPlayerObject(c); - if (p == nullptr) + if (p == NULL) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -3612,8 +3612,8 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - CreatureObject* c = (o ? o->asCreatureObject() : nullptr); - if (o == nullptr) + CreatureObject* c = (o ? o->asCreatureObject() : NULL); + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -3623,7 +3623,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const result += Unicode::narrowToWide("specified object is not authoritative on this game server\n"); return true; } - else if (c == nullptr) + else if (c == NULL) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; @@ -3631,7 +3631,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const else { PlayerObject* p = PlayerCreatureController::getPlayerObject(c); - if (p == nullptr) + if (p == NULL) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -3668,20 +3668,20 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - CreatureObject * c = (o ? o->asCreatureObject() : nullptr); - if (o == nullptr) + CreatureObject * c = (o ? o->asCreatureObject() : NULL); + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - else if (c == nullptr) + else if (c == NULL) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == nullptr) + if (p == NULL) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -3755,14 +3755,14 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject const* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == nullptr) + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } TangibleObject const* t = o->asTangibleObject(); - if (t == nullptr) + if (t == NULL) { result += Unicode::narrowToWide("specified object is not a tangible object\n"); return true; @@ -3797,14 +3797,14 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId sourceOid(Unicode::wideToNarrow(argv[1])); ServerObject * sourceSo = dynamic_cast(ServerWorld::findObjectByNetworkId(sourceOid)); - if (sourceSo == nullptr) + if (sourceSo == NULL) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is an invalid object\n", sourceOid.getValueString().c_str())); return true; } TangibleObject * sourceTo = sourceSo->asTangibleObject(); - if (sourceTo == nullptr) + if (sourceTo == NULL) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is not a tangible object\n", sourceOid.getValueString().c_str())); return true; @@ -3812,14 +3812,14 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const NetworkId targetOid(Unicode::wideToNarrow(argv[2])); ServerObject * targetSo = dynamic_cast(ServerWorld::findObjectByNetworkId(targetOid)); - if (targetSo == nullptr) + if (targetSo == NULL) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is an invalid object\n", targetOid.getValueString().c_str())); return true; } TangibleObject * targetTo = targetSo->asTangibleObject(); - if (targetTo == nullptr) + if (targetTo == NULL) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is not a tangible object\n", targetOid.getValueString().c_str())); return true; @@ -3839,14 +3839,14 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId sourceOid(Unicode::wideToNarrow(argv[1])); ServerObject * sourceSo = dynamic_cast(ServerWorld::findObjectByNetworkId(sourceOid)); - if (sourceSo == nullptr) + if (sourceSo == NULL) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is an invalid object\n", sourceOid.getValueString().c_str())); return true; } TangibleObject * sourceTo = sourceSo->asTangibleObject(); - if (sourceTo == nullptr) + if (sourceTo == NULL) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is not a tangible object\n", sourceOid.getValueString().c_str())); return true; @@ -3866,14 +3866,14 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId sourceOid(Unicode::wideToNarrow(argv[1])); ServerObject * sourceSo = dynamic_cast(ServerWorld::findObjectByNetworkId(sourceOid)); - if (sourceSo == nullptr) + if (sourceSo == NULL) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is an invalid object\n", sourceOid.getValueString().c_str())); return true; } TangibleObject * sourceTo = sourceSo->asTangibleObject(); - if (sourceTo == nullptr) + if (sourceTo == NULL) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is not a tangible object\n", sourceOid.getValueString().c_str())); return true; @@ -3891,14 +3891,14 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId sourceOid(Unicode::wideToNarrow(argv[1])); ServerObject const * sourceSo = dynamic_cast(ServerWorld::findObjectByNetworkId(sourceOid)); - if (sourceSo == nullptr) + if (sourceSo == NULL) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is an invalid object\n", sourceOid.getValueString().c_str())); return true; } CreatureObject const * sourceCo = sourceSo->asCreatureObject(); - if (sourceCo == nullptr) + if (sourceCo == NULL) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is not a creature object\n", sourceOid.getValueString().c_str())); return true; @@ -3915,14 +3915,14 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId sourceOid(Unicode::wideToNarrow(argv[1])); ServerObject * sourceSo = dynamic_cast(ServerWorld::findObjectByNetworkId(sourceOid)); - if (sourceSo == nullptr) + if (sourceSo == NULL) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is an invalid object\n", sourceOid.getValueString().c_str())); return true; } CreatureObject * sourceCo = sourceSo->asCreatureObject(); - if (sourceCo == nullptr) + if (sourceCo == NULL) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is not a creature object\n", sourceOid.getValueString().c_str())); return true; @@ -3931,7 +3931,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const result += Unicode::narrowToWide(FormattedString<512>().sprintf("dumping %s's command queue contents\n", sourceCo->getNetworkId().getValueString().c_str())); CommandQueue * queue = sourceCo->getCommandQueue(); - if (queue != nullptr) + if (queue != NULL) { std::string output; queue->spew(&output); @@ -3947,26 +3947,26 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - CreatureObject * c = (o ? o->asCreatureObject() : nullptr); - if (o == nullptr) + CreatureObject * c = (o ? o->asCreatureObject() : NULL); + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - else if (c == nullptr) + else if (c == NULL) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == nullptr) + if (p == NULL) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; } - time_t const timeNow = ::time(nullptr); + time_t const timeNow = ::time(NULL); time_t const timeStartInterval = ((p->getChatSpamTimeEndInterval() > 0) ? static_cast(p->getChatSpamTimeEndInterval() - (ConfigServerGame::getChatSpamLimiterIntervalMinutes() * 60)) : 0); if ((timeStartInterval <= 0) || (timeNow < timeStartInterval)) @@ -3986,28 +3986,28 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject const * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == nullptr) + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject const * c = o->asCreatureObject(); - if (c == nullptr) + if (c == NULL) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject const * p = PlayerCreatureController::getPlayerObject(c); - if (p == nullptr) + if (p == NULL) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; } Client * client = o->getClient(); - if (client == nullptr) + if (client == NULL) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("specified character object %s (%s) doesn't have a Client object (possible causes are may not be authoritative, or may not be connected)\n", o->getNetworkId().getValueString().c_str(), Unicode::wideToNarrow(o->getAssignedObjectName()).c_str())); return true; @@ -4042,28 +4042,28 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == nullptr) + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject const * c = o->asCreatureObject(); - if (c == nullptr) + if (c == NULL) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject const * p = PlayerCreatureController::getPlayerObject(c); - if (p == nullptr) + if (p == NULL) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; } Client * client = o->getClient(); - if (client == nullptr) + if (client == NULL) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("specified character object %s (%s) doesn't have a Client object (possible causes are may not be authoritative, or may not be connected)\n", o->getNetworkId().getValueString().c_str(), Unicode::wideToNarrow(o->getAssignedObjectName()).c_str())); return true; @@ -4083,28 +4083,28 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == nullptr) + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject const * c = o->asCreatureObject(); - if (c == nullptr) + if (c == NULL) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject const * p = PlayerCreatureController::getPlayerObject(c); - if (p == nullptr) + if (p == NULL) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; } Client * client = o->getClient(); - if (client == nullptr) + if (client == NULL) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("specified character object %s (%s) doesn't have a Client object (possible causes are may not be authoritative, or may not be connected)\n", o->getNetworkId().getValueString().c_str(), Unicode::wideToNarrow(o->getAssignedObjectName()).c_str())); return true; @@ -4180,12 +4180,12 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const } else { - result += Unicode::narrowToWide(FormattedString<1024>().sprintf("object (%s) getFootprint() returns nullptr.\n", oid.getValueString().c_str())); + result += Unicode::narrowToWide(FormattedString<1024>().sprintf("object (%s) getFootprint() returns NULL.\n", oid.getValueString().c_str())); } } else { - result += Unicode::narrowToWide(FormattedString<1024>().sprintf("object (%s) getCollisionProperty() returns nullptr.\n", oid.getValueString().c_str())); + result += Unicode::narrowToWide(FormattedString<1024>().sprintf("object (%s) getCollisionProperty() returns NULL.\n", oid.getValueString().c_str())); } } else diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserObjvar.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserObjvar.cpp index 77063e84..e4a928c5 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserObjvar.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserObjvar.cpp @@ -100,7 +100,7 @@ bool ConsoleCommandParserObjvar::performParsing (const NetworkId & userId, const { NetworkId oid (Unicode::wideToNarrow (argv[1])); ServerObject* object = ServerWorld::findObjectByNetworkId(oid); - if (object == nullptr) + if (object == NULL) { result += getErrorMessage (argv [0], ERR_INVALID_OBJECT); return true; @@ -224,7 +224,7 @@ bool ConsoleCommandParserObjvar::performParsing (const NetworkId & userId, const // This is now a no-op, but left in to avoid breaking the god client // NetworkId oid (Unicode::wideToNarrow (argv[1])); // ServerObject* object = ServerWorld::findObjectByNetworkId(oid); -// if (object == nullptr) +// if (object == NULL) // { // result += getErrorMessage (argv [0], ERR_INVALID_OBJECT); // return true; @@ -241,7 +241,7 @@ bool ConsoleCommandParserObjvar::performParsing (const NetworkId & userId, const { NetworkId oid (Unicode::wideToNarrow(argv[1])); ServerObject* object = ServerWorld::findObjectByNetworkId(oid); - if (object == nullptr) + if (object == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -317,7 +317,7 @@ bool ConsoleCommandParserObjvar::performParsing (const NetworkId & userId, const { ServerObject * const userServerObject = ServerWorld::findObjectByNetworkId(userId); - if (userServerObject != nullptr) + if (userServerObject != NULL) { NetworkId specifiedNetworkId; @@ -329,7 +329,7 @@ bool ConsoleCommandParserObjvar::performParsing (const NetworkId & userId, const { CreatureObject * const userCreatureObject = CreatureObject::asCreatureObject(userServerObject); - if (userCreatureObject != nullptr) + if (userCreatureObject != NULL) { specifiedNetworkId = userCreatureObject->getLookAtTarget(); } @@ -337,7 +337,7 @@ bool ConsoleCommandParserObjvar::performParsing (const NetworkId & userId, const ServerObject * const specifiedServerObject = ServerWorld::findObjectByNetworkId(specifiedNetworkId); - if (specifiedServerObject != nullptr) + if (specifiedServerObject != NULL) { DynamicVariableList const & objVarList = specifiedServerObject->getObjVars(); FormattedString<1024> fs; @@ -357,7 +357,7 @@ bool ConsoleCommandParserObjvar::performParsing (const NetworkId & userId, const { NetworkId oid = NetworkId(Unicode::wideToNarrow(argv[1])); ServerObject* object = ServerWorld::findObjectByNetworkId(oid); - if (object == nullptr) + if (object == NULL) { result += getErrorMessage (argv [0], ERR_INVALID_OBJECT); return true; @@ -376,7 +376,7 @@ bool ConsoleCommandParserObjvar::performParsing (const NetworkId & userId, const { NetworkId oid = NetworkId(Unicode::wideToNarrow(argv[1])); ServerObject* object = ServerWorld::findObjectByNetworkId(oid); - if (object == nullptr) + if (object == NULL) { result += getErrorMessage (argv [0], ERR_INVALID_OBJECT); return true; diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserPvp.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserPvp.cpp index a9f691b6..d212d0ca 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserPvp.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserPvp.cpp @@ -103,13 +103,13 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject const* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - CreatureObject const* c = (o ? o->asCreatureObject() : nullptr); - if (o == nullptr) + CreatureObject const* c = (o ? o->asCreatureObject() : NULL); + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - else if (c == nullptr) + else if (c == NULL) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; @@ -117,7 +117,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St else { PlayerObject const* p = PlayerCreatureController::getPlayerObject(c); - if (p == nullptr) + if (p == NULL) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -185,7 +185,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St result += Unicode::narrowToWide(FormattedString<512>().sprintf("lifetime PvP kills: %ld\n",p->getLifetimePvpKills())); result += Unicode::narrowToWide(FormattedString<512>().sprintf("next GCW rating calculation time: %ld",p->getNextGcwRatingCalcTime())); - int32 const now = static_cast(::time(nullptr)); + int32 const now = static_cast(::time(NULL)); if (p->getNextGcwRatingCalcTime() > 0) { if (p->getNextGcwRatingCalcTime() >= now) @@ -223,13 +223,13 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - CreatureObject * c = (o ? o->asCreatureObject() : nullptr); - if (o == nullptr) + CreatureObject * c = (o ? o->asCreatureObject() : NULL); + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - else if (c == nullptr) + else if (c == NULL) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; @@ -237,7 +237,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St else { PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == nullptr) + if (p == NULL) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -259,13 +259,13 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - CreatureObject * c = (o ? o->asCreatureObject() : nullptr); - if (o == nullptr) + CreatureObject * c = (o ? o->asCreatureObject() : NULL); + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - else if (c == nullptr) + else if (c == NULL) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; @@ -273,7 +273,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St else { PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == nullptr) + if (p == NULL) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -295,13 +295,13 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - CreatureObject * c = (o ? o->asCreatureObject() : nullptr); - if (o == nullptr) + CreatureObject * c = (o ? o->asCreatureObject() : NULL); + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - else if (c == nullptr) + else if (c == NULL) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; @@ -309,7 +309,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St else { PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == nullptr) + if (p == NULL) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -331,13 +331,13 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - CreatureObject * c = (o ? o->asCreatureObject() : nullptr); - if (o == nullptr) + CreatureObject * c = (o ? o->asCreatureObject() : NULL); + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - else if (c == nullptr) + else if (c == NULL) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; @@ -345,7 +345,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St else { PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == nullptr) + if (p == NULL) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -369,13 +369,13 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - CreatureObject * c = (o ? o->asCreatureObject() : nullptr); - if (o == nullptr) + CreatureObject * c = (o ? o->asCreatureObject() : NULL); + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - else if (c == nullptr) + else if (c == NULL) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; @@ -383,7 +383,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St else { PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == nullptr) + if (p == NULL) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -405,13 +405,13 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - CreatureObject * c = (o ? o->asCreatureObject() : nullptr); - if (o == nullptr) + CreatureObject * c = (o ? o->asCreatureObject() : NULL); + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - else if (c == nullptr) + else if (c == NULL) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; @@ -419,7 +419,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St else { PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == nullptr) + if (p == NULL) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -441,13 +441,13 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - CreatureObject * c = (o ? o->asCreatureObject() : nullptr); - if (o == nullptr) + CreatureObject * c = (o ? o->asCreatureObject() : NULL); + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - else if (c == nullptr) + else if (c == NULL) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; @@ -455,7 +455,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St else { PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == nullptr) + if (p == NULL) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -477,21 +477,21 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == nullptr) + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * c = o->asCreatureObject(); - if (c == nullptr) + if (c == NULL) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == nullptr) + if (p == NULL) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -585,7 +585,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == nullptr) + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -612,21 +612,21 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * const o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == nullptr) + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * const c = o->asCreatureObject(); - if (c == nullptr) + if (c == NULL) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * const p = PlayerCreatureController::getPlayerObject(c); - if (p == nullptr) + if (p == NULL) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -660,21 +660,21 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * const o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == nullptr) + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * const c = o->asCreatureObject(); - if (c == nullptr) + if (c == NULL) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * const p = PlayerCreatureController::getPlayerObject(c); - if (p == nullptr) + if (p == NULL) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -708,21 +708,21 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * const o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == nullptr) + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * const c = o->asCreatureObject(); - if (c == nullptr) + if (c == NULL) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * const p = PlayerCreatureController::getPlayerObject(c); - if (p == nullptr) + if (p == NULL) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -756,21 +756,21 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * const o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == nullptr) + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * const c = o->asCreatureObject(); - if (c == nullptr) + if (c == NULL) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * const p = PlayerCreatureController::getPlayerObject(c); - if (p == nullptr) + if (p == NULL) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -804,21 +804,21 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * const o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == nullptr) + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * const c = o->asCreatureObject(); - if (c == nullptr) + if (c == NULL) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * const p = PlayerCreatureController::getPlayerObject(c); - if (p == nullptr) + if (p == NULL) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -852,14 +852,14 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId const oid(Unicode::wideToNarrow(argv[1])); ServerObject const * const o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == nullptr) + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject const * const c = o->asCreatureObject(); - if (c == nullptr) + if (c == NULL) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; @@ -874,14 +874,14 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId const actorOid(Unicode::wideToNarrow(argv[1])); ServerObject const * const actorSo = dynamic_cast(ServerWorld::findObjectByNetworkId(actorOid)); - if (actorSo == nullptr) + if (actorSo == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } TangibleObject const * const actorTo = actorSo->asTangibleObject(); - if (actorTo == nullptr) + if (actorTo == NULL) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("(%s) is not a TangibleObject\n", actorOid.getValueString().c_str())); return true; @@ -889,14 +889,14 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St NetworkId const targetOid(Unicode::wideToNarrow(argv[2])); ServerObject const * const targetSo = dynamic_cast(ServerWorld::findObjectByNetworkId(targetOid)); - if (targetSo == nullptr) + if (targetSo == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } TangibleObject const * const targetTo = targetSo->asTangibleObject(); - if (targetTo == nullptr) + if (targetTo == NULL) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("(%s) is not a TangibleObject\n", targetOid.getValueString().c_str())); return true; @@ -924,14 +924,14 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId const actorOid(Unicode::wideToNarrow(argv[1])); ServerObject * const actorSo = dynamic_cast(ServerWorld::findObjectByNetworkId(actorOid)); - if (actorSo == nullptr) + if (actorSo == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } TangibleObject * const actorTo = actorSo->asTangibleObject(); - if (actorTo == nullptr) + if (actorTo == NULL) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("(%s) is not a TangibleObject\n", actorOid.getValueString().c_str())); return true; @@ -939,14 +939,14 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St NetworkId const targetOid(Unicode::wideToNarrow(argv[2])); ServerObject * const targetSo = dynamic_cast(ServerWorld::findObjectByNetworkId(targetOid)); - if (targetSo == nullptr) + if (targetSo == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } TangibleObject * const targetTo = targetSo->asTangibleObject(); - if (targetTo == nullptr) + if (targetTo == NULL) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("(%s) is not a TangibleObject\n", targetOid.getValueString().c_str())); return true; @@ -968,28 +968,28 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St NetworkId const oid(Unicode::wideToNarrow(argv[1])); ServerObject const * const o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == nullptr) + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject const * const c = o->asCreatureObject(); - if (c == nullptr) + if (c == NULL) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject const * const p = PlayerCreatureController::getPlayerObject(c); - if (p == nullptr) + if (p == NULL) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; } ShipObject const * const ship = ShipObject::getContainingShipObject(c); - if (ship == nullptr) + if (ship == NULL) { result += Unicode::narrowToWide("specified character object is not in a ship\n"); return true; @@ -1042,28 +1042,28 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St NetworkId const oid(Unicode::wideToNarrow(argv[1])); ServerObject const * const o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == nullptr) + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject const * const c = o->asCreatureObject(); - if (c == nullptr) + if (c == NULL) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject const * const p = PlayerCreatureController::getPlayerObject(c); - if (p == nullptr) + if (p == NULL) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; } ShipObject const * const ship = ShipObject::getContainingShipObject(c); - if (ship == nullptr) + if (ship == NULL) { result += Unicode::narrowToWide("specified character object is not in a ship\n"); return true; diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserResource.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserResource.cpp index cde60a8e..2d22864d 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserResource.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserResource.cpp @@ -73,7 +73,7 @@ bool ConsoleCommandParserResource::performParsing (const NetworkId & userId, con CachedNetworkId harvester(Unicode::wideToNarrow (argv[1])); ServerObject* harvesterObject = safe_cast(harvester.getObject()); - if (harvesterObject == nullptr) + if (harvesterObject == NULL) { result += getErrorMessage (argv [0], ERR_INVALID_OBJECT); return true; @@ -90,7 +90,7 @@ bool ConsoleCommandParserResource::performParsing (const NetworkId & userId, con CachedNetworkId harvester(Unicode::wideToNarrow (argv[1])); ServerObject* harvesterObject = safe_cast(harvester.getObject()); - if (harvesterObject == nullptr) + if (harvesterObject == NULL) { result += getErrorMessage (argv [0], ERR_INVALID_OBJECT); return true; @@ -123,7 +123,7 @@ bool ConsoleCommandParserResource::performParsing (const NetworkId & userId, con CachedNetworkId harvester(Unicode::wideToNarrow (argv[1])); ServerObject* harvesterObject = safe_cast(harvester.getObject()); - if (harvesterObject == nullptr) + if (harvesterObject == NULL) { result += getErrorMessage (argv [0], ERR_INVALID_OBJECT); return true; @@ -208,7 +208,7 @@ bool ConsoleCommandParserResource::performParsing (const NetworkId & userId, con ResourceContainerObject * const container = dynamic_cast(NetworkIdManager::getObjectById(contId)); std::string const & resourcePath = Unicode::wideToNarrow(argv[2]); ResourceTypeObject * const resType = ServerUniverse::getInstance().getResourceTypeByName(resourcePath); - int const amount = strtol(Unicode::wideToNarrow (argv[3]).c_str (), nullptr, 10); + int const amount = strtol(Unicode::wideToNarrow (argv[3]).c_str (), NULL, 10); NetworkId const source(Unicode::wideToNarrow (argv[4])); if (container && resType) @@ -228,7 +228,7 @@ bool ConsoleCommandParserResource::performParsing (const NetworkId & userId, con { NetworkId contId (Unicode::wideToNarrow (argv[1])); ResourceContainerObject* container=dynamic_cast(NetworkIdManager::getObjectById(contId)); - if (container != nullptr) + if (container != NULL) { NetworkId sourceId; if (argv.size() >= 3) @@ -251,7 +251,7 @@ bool ConsoleCommandParserResource::performParsing (const NetworkId & userId, con { NetworkId contId (Unicode::wideToNarrow (argv[1])); ResourceContainerObject* container=dynamic_cast(NetworkIdManager::getObjectById(contId)); - if (container != nullptr) + if (container != NULL) { if (container->debugRecycle()) result += getErrorMessage(argv[0], ERR_SUCCESS); @@ -267,7 +267,7 @@ bool ConsoleCommandParserResource::performParsing (const NetworkId & userId, con CachedNetworkId contId (Unicode::wideToNarrow (argv[1])); ResourceContainerObject* container=dynamic_cast(contId.getObject()); ResourceTypeObject *resType=ServerUniverse::getInstance().getResourceTypeByName(Unicode::wideToNarrow(argv[2])); - int amount=strtol(Unicode::wideToNarrow (argv[3]).c_str (), nullptr, 10); + int amount=strtol(Unicode::wideToNarrow (argv[3]).c_str (), NULL, 10); if (container && resType) { @@ -307,8 +307,8 @@ bool ConsoleCommandParserResource::performParsing (const NetworkId & userId, con { const std::string parentResourceClassName (Unicode::wideToNarrow(argv[1])); const std::string resourceTypeName (Unicode::wideToNarrow(argv[2])); - const int surveyRange = strtol(Unicode::wideToNarrow(argv[3]).c_str(),nullptr,10); - const int numPoints = strtol(Unicode::wideToNarrow(argv[4]).c_str(),nullptr,10); + const int surveyRange = strtol(Unicode::wideToNarrow(argv[3]).c_str(),NULL,10); + const int numPoints = strtol(Unicode::wideToNarrow(argv[4]).c_str(),NULL,10); const Object * player = NetworkIdManager::getObjectById(userId); if (player) diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserScript.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserScript.cpp index 99f1f236..a2703595 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserScript.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserScript.cpp @@ -62,7 +62,7 @@ bool ConsoleCommandParserScript::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow (argv[2])); ServerObject* object = ServerWorld::findObjectByNetworkId(oid); - if (object == nullptr) + if (object == NULL) { result += getErrorMessage (argv [0], ERR_INVALID_OBJECT); return true; @@ -81,7 +81,7 @@ bool ConsoleCommandParserScript::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[2])); ServerObject* object = ServerWorld::findObjectByNetworkId(oid); - if (object == nullptr) + if (object == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -100,7 +100,7 @@ bool ConsoleCommandParserScript::performParsing (const NetworkId & userId, const { ServerObject * const userServerObject = ServerWorld::findObjectByNetworkId(userId); - if (userServerObject != nullptr) + if (userServerObject != NULL) { NetworkId specifiedNetworkId; @@ -112,7 +112,7 @@ bool ConsoleCommandParserScript::performParsing (const NetworkId & userId, const { CreatureObject * const userCreatureObject = CreatureObject::asCreatureObject(userServerObject); - if (userCreatureObject != nullptr) + if (userCreatureObject != NULL) { specifiedNetworkId = userCreatureObject->getLookAtTarget(); } @@ -120,7 +120,7 @@ bool ConsoleCommandParserScript::performParsing (const NetworkId & userId, const ServerObject * const specifiedServerObject = ServerObject::getServerObject(specifiedNetworkId); - if (specifiedServerObject != nullptr) + if (specifiedServerObject != NULL) { ScriptList const & scripts = specifiedServerObject->getScriptObject()->getScripts(); FormattedString<1024> fs; @@ -226,7 +226,7 @@ bool ConsoleCommandParserScript::performParsing (const NetworkId & userId, const // get the object id NetworkId oid(Unicode::wideToNarrow(argv[oidIndex])); ServerObject* object = ServerWorld::findObjectByNetworkId(oid); - if (object == nullptr) + if (object == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserServer.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserServer.cpp index c81f8966..f789d127 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserServer.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserServer.cpp @@ -301,7 +301,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const return true; } - unsigned long val = strtoul(Unicode::wideToNarrow(argv[1]).c_str(), nullptr, 10); + unsigned long val = strtoul(Unicode::wideToNarrow(argv[1]).c_str(), NULL, 10); const bool isPublic = (val != 0); SetConnectionServerPublic const p(isPublic); @@ -354,8 +354,8 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const return true; } - unsigned long secsToWait = strtoul(Unicode::wideToNarrow(argv[1]).c_str(), nullptr, 10); - unsigned long maxSecs = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), nullptr, 10); + unsigned long secsToWait = strtoul(Unicode::wideToNarrow(argv[1]).c_str(), NULL, 10); + unsigned long maxSecs = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), NULL, 10); Unicode::String systemMessage; for( size_t i=3; i< argv.size(); ++i) { @@ -386,7 +386,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const return true; } - unsigned long val = strtoul(Unicode::wideToNarrow(argv[1]).c_str (), nullptr, 10); + unsigned long val = strtoul(Unicode::wideToNarrow(argv[1]).c_str (), NULL, 10); switch (val) { case 1: @@ -482,7 +482,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject* object = ServerWorld::findObjectByNetworkId(oid); - if (object == nullptr) + if (object == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -574,7 +574,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const } else if (isAbbrev (argv[0], "getSceneId")) { - if (user == nullptr) + if (user == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -596,7 +596,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const return true; } - unsigned long val = strtoul(Unicode::wideToNarrow(argv[1]).c_str (), nullptr, 10); + unsigned long val = strtoul(Unicode::wideToNarrow(argv[1]).c_str (), NULL, 10); if (user->getClient()->setGodMode(val != 0)) result += getErrorMessage (argv[0], ERR_SUCCESS); else @@ -637,7 +637,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const { std::string tableName; tableName = Unicode::wideToNarrow(argv[1]); - if (DataTableManager::reload(tableName) != nullptr) + if (DataTableManager::reload(tableName) != NULL) { ServerMessageForwarding::beginBroadcast(); @@ -694,7 +694,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const else { PlanetObject * planet = ServerUniverse::getInstance().getCurrentPlanet(); - if (planet == nullptr) + if (planet == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -708,7 +708,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const for (std::vector::const_iterator i = regions.begin(); i != regions.end(); ++i) { const RegionRectangle * ro = dynamic_cast(*i); - if (ro != nullptr) + if (ro != NULL) { float minX, minY, maxX, maxY; ro->getExtent(minX, minY, maxX, maxY); @@ -717,7 +717,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const client->send(mrgrr, true); } const RegionCircle* co = dynamic_cast(*i); - if (co != nullptr) + if (co != NULL) { float centerX, centerY, radius; co->getExtent(centerX, centerY, radius); @@ -743,7 +743,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const { uint32 processId = GameServer::getInstance().getProcessId(); if (argv.size() > 3) - processId = strtoul(Unicode::wideToNarrow(argv[3]).c_str(), nullptr, 10); + processId = strtoul(Unicode::wideToNarrow(argv[3]).c_str(), NULL, 10); std::string op = Unicode::wideToNarrow(argv[1]) + " " + Unicode::wideToNarrow(argv[2]); @@ -760,7 +760,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const { uint32 processId = GameServer::getInstance().getProcessId(); if (argv.size() > 2) - processId = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), nullptr, 10); + processId = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), NULL, 10); std::string op(Unicode::wideToNarrow(argv[1])); if (processId == GameServer::getInstance().getProcessId()) @@ -840,8 +840,8 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const } else if (isAbbrev(argv[0], "getRegionsAt")) { - float x = static_cast(strtod(Unicode::wideToNarrow(argv[1]).c_str(), nullptr)); - float z = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), nullptr)); + float x = static_cast(strtod(Unicode::wideToNarrow(argv[1]).c_str(), NULL)); + float z = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), NULL)); std::vector results; @@ -990,10 +990,10 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const //" ", "Save out an area for buildout datatables" std::string const &serverFilename = Unicode::wideToNarrow(argv[1]); std::string const &clientFilename = Unicode::wideToNarrow(argv[2]); - float x1 = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr)); - float z1 = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), nullptr)); - float x2 = static_cast(strtod(Unicode::wideToNarrow(argv[5]).c_str(), nullptr)); - float z2 = static_cast(strtod(Unicode::wideToNarrow(argv[6]).c_str(), nullptr)); + float x1 = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL)); + float z1 = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), NULL)); + float x2 = static_cast(strtod(Unicode::wideToNarrow(argv[5]).c_str(), NULL)); + float z2 = static_cast(strtod(Unicode::wideToNarrow(argv[6]).c_str(), NULL)); ServerBuildoutManager::saveArea(serverFilename, clientFilename, x1, z1, x2, z2); } else if (isAbbrev(argv[0], "clientSaveBuildoutArea")) @@ -1001,10 +1001,10 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const //" " std::string const &scene = Unicode::wideToNarrow(argv[1]); std::string const &areaName = Unicode::wideToNarrow(argv[2]); - float x1 = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr)); - float z1 = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), nullptr)); - float x2 = static_cast(strtod(Unicode::wideToNarrow(argv[5]).c_str(), nullptr)); - float z2 = static_cast(strtod(Unicode::wideToNarrow(argv[6]).c_str(), nullptr)); + float x1 = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL)); + float z1 = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), NULL)); + float x2 = static_cast(strtod(Unicode::wideToNarrow(argv[5]).c_str(), NULL)); + float z2 = static_cast(strtod(Unicode::wideToNarrow(argv[6]).c_str(), NULL)); if (scene == ConfigServerGame::getSceneID() && user->getClient()) ServerBuildoutManager::clientSaveArea(*user->getClient(), areaName, x1, z1, x2, z2); } @@ -1044,7 +1044,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const if (argv.size() == 2) { // specify server by process id - uint32 serverId = strtoul(Unicode::wideToNarrow(argv[1]).c_str(), nullptr, 10); + uint32 serverId = strtoul(Unicode::wideToNarrow(argv[1]).c_str(), NULL, 10); if (serverId != 0) { ExcommunicateGameServerMessage exmsg(serverId, 0, ""); @@ -1058,7 +1058,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const { // specify server by scene & preload role number std::string const &scene = Unicode::wideToNarrow(argv[1]); - uint32 preloadRole = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), nullptr, 10); + uint32 preloadRole = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), NULL, 10); GenericValueTypeMessage > msg("RestartServerByRoleMessage", std::make_pair(scene, preloadRole)); if (scene == ConfigServerGame::getSceneID()) @@ -1072,8 +1072,8 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const { // specify server by geographic location std::string const &scene = Unicode::wideToNarrow(argv[1]); - int x = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), nullptr)); - int z = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr)); + int x = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), NULL)); + int z = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL)); RestartServerMessage msg(scene, x, z); if (scene == ConfigServerGame::getSceneID()) @@ -1322,14 +1322,14 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const NetworkId oid2(Unicode::wideToNarrow(argv[2])); ServerObject const * const object1 = ServerWorld::findObjectByNetworkId(oid1); - if (object1 == nullptr) + if (object1 == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } ServerObject const * const object2 = ServerWorld::findObjectByNetworkId(oid2); - if (object2 == nullptr) + if (object2 == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1366,7 +1366,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const TerrainObject const * terrain = TerrainObject::getConstInstance(); if (!terrain) { - result += Unicode::narrowToWide("terrain object is nullptr\n"); + result += Unicode::narrowToWide("terrain object is NULL\n"); return true; } @@ -1443,7 +1443,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const TerrainObject const * terrain = TerrainObject::getConstInstance(); if (!terrain) { - result += Unicode::narrowToWide("terrain object is nullptr\n"); + result += Unicode::narrowToWide("terrain object is NULL\n"); return true; } @@ -1491,7 +1491,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const TerrainObject * terrain = TerrainObject::getInstance(); if (!terrain) { - result += Unicode::narrowToWide("terrain object is nullptr\n"); + result += Unicode::narrowToWide("terrain object is NULL\n"); return true; } @@ -1557,8 +1557,8 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const { result += Unicode::narrowToWide(iterFind->second.getDebugString()); - ServerObject const * const soGroupObject = (iterFind->second.groupId.isValid() ? safe_cast(NetworkIdManager::getObjectById(iterFind->second.groupId)) : nullptr); - GroupObject const * const groupObject = (soGroupObject ? soGroupObject->asGroupObject() : nullptr); + ServerObject const * const soGroupObject = (iterFind->second.groupId.isValid() ? safe_cast(NetworkIdManager::getObjectById(iterFind->second.groupId)) : NULL); + GroupObject const * const groupObject = (soGroupObject ? soGroupObject->asGroupObject() : NULL); if (groupObject) { unsigned int const secondsLeftOnGroupPickup = groupObject->getSecondsLeftOnGroupPickup(); @@ -1717,7 +1717,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const else if (isAbbrev(argv[0], "listCharacterLastLoginTimeBrief")) { int const days = atoi(Unicode::wideToNarrow(argv[1]).c_str()); - time_t const cutoff = std::max(static_cast(0), static_cast(::time(nullptr) - (60 * 60 * 24 * days))); + time_t const cutoff = std::max(static_cast(0), static_cast(::time(NULL) - (60 * 60 * 24 * days))); std::multimap, std::string> > resultList; NameManager::getInstance().getPlayerWithLastLoginTimeAfter(cutoff, resultList); @@ -1726,7 +1726,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "listCharacterLastLoginTimeAfterBrief")) { - time_t const rawtime = ::time(nullptr); + time_t const rawtime = ::time(NULL); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -1749,7 +1749,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "listCharacterLastLoginTimeBeforeBrief")) { - time_t const rawtime = ::time(nullptr); + time_t const rawtime = ::time(NULL); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -1772,7 +1772,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "listCharacterLastLoginTimeBetweenBrief")) { - time_t const rawtime = ::time(nullptr); + time_t const rawtime = ::time(NULL); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -1817,7 +1817,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const else if (isAbbrev(argv[0], "listCharacterLastLoginTimeDetailed")) { int const days = atoi(Unicode::wideToNarrow(argv[1]).c_str()); - time_t const cutoff = std::max(static_cast(0), static_cast(::time(nullptr) - (60 * 60 * 24 * days))); + time_t const cutoff = std::max(static_cast(0), static_cast(::time(NULL) - (60 * 60 * 24 * days))); std::multimap, std::string> > resultList; NameManager::getInstance().getPlayerWithLastLoginTimeAfter(cutoff, resultList); @@ -1829,7 +1829,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "listCharacterLastLoginTimeAfterDetailed")) { - time_t const rawtime = ::time(nullptr); + time_t const rawtime = ::time(NULL); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -1855,7 +1855,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "listCharacterLastLoginTimeBeforeDetailed")) { - time_t const rawtime = ::time(nullptr); + time_t const rawtime = ::time(NULL); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -1881,7 +1881,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "listCharacterLastLoginTimeBetweenDetailed")) { - time_t const rawtime = ::time(nullptr); + time_t const rawtime = ::time(NULL); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -1929,7 +1929,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const else if (isAbbrev(argv[0], "sendMailToCharacterLastLoginTime")) { int const days = atoi(Unicode::wideToNarrow(argv[1]).c_str()); - time_t const cutoff = std::max(static_cast(0), static_cast(::time(nullptr) - (60 * 60 * 24 * days))); + time_t const cutoff = std::max(static_cast(0), static_cast(::time(NULL) - (60 * 60 * 24 * days))); int const argc = argv.size(); Unicode::String mailBody; @@ -1952,7 +1952,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const static Unicode::String s_mailBody; static time_t s_confirmationTimeout = 0; - time_t const timeNow = ::time(nullptr); + time_t const timeNow = ::time(NULL); if ((s_days == days) && (s_confirmationTimeout > timeNow) && (s_fromName == Unicode::wideToNarrow(argv[2])) && (s_mailSubject == argv[3]) && (s_mailBody == mailBody)) { @@ -1991,7 +1991,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "sendMailToCharacterLastLoginTimeAfter")) { - time_t const rawtime = ::time(nullptr); + time_t const rawtime = ::time(NULL); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -2028,7 +2028,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const static Unicode::String s_mailBody; static time_t s_confirmationTimeout = 0; - time_t const timeNow = ::time(nullptr); + time_t const timeNow = ::time(NULL); if ((s_cutoff == cutoff) && (s_confirmationTimeout > timeNow) && (s_fromName == Unicode::wideToNarrow(argv[7])) && (s_mailSubject == argv[8]) && (s_mailBody == mailBody)) { @@ -2067,7 +2067,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "sendMailToCharacterLastLoginTimeBefore")) { - time_t const rawtime = ::time(nullptr); + time_t const rawtime = ::time(NULL); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -2104,7 +2104,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const static Unicode::String s_mailBody; static time_t s_confirmationTimeout = 0; - time_t const timeNow = ::time(nullptr); + time_t const timeNow = ::time(NULL); if ((s_cutoff == cutoff) && (s_confirmationTimeout > timeNow) && (s_fromName == Unicode::wideToNarrow(argv[7])) && (s_mailSubject == argv[8]) && (s_mailBody == mailBody)) { @@ -2143,7 +2143,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "sendMailToCharacterLastLoginTimeBetween")) { - time_t const rawtime = ::time(nullptr); + time_t const rawtime = ::time(NULL); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -2202,7 +2202,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const static Unicode::String s_mailBody; static time_t s_confirmationTimeout = 0; - time_t const timeNow = ::time(nullptr); + time_t const timeNow = ::time(NULL); if ((s_cutoffLower == cutoffLower) && (s_cutoffUpper == cutoffUpper) && (s_confirmationTimeout > timeNow) && (s_fromName == Unicode::wideToNarrow(argv[13])) && (s_mailSubject == argv[14]) && (s_mailBody == mailBody)) { @@ -2244,7 +2244,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const else if (isAbbrev(argv[0], "listCharacterCreateTimeBrief")) { int const days = atoi(Unicode::wideToNarrow(argv[1]).c_str()); - time_t const cutoff = std::max(static_cast(0), static_cast(::time(nullptr) - (60 * 60 * 24 * days))); + time_t const cutoff = std::max(static_cast(0), static_cast(::time(NULL) - (60 * 60 * 24 * days))); std::multimap, std::string> > resultList; NameManager::getInstance().getPlayerWithCreateTimeAfter(cutoff, resultList); @@ -2253,7 +2253,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "listCharacterCreateTimeAfterBrief")) { - time_t const rawtime = ::time(nullptr); + time_t const rawtime = ::time(NULL); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -2276,7 +2276,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "listCharacterCreateTimeBeforeBrief")) { - time_t const rawtime = ::time(nullptr); + time_t const rawtime = ::time(NULL); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -2299,7 +2299,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "listCharacterCreateTimeBetweenBrief")) { - time_t const rawtime = ::time(nullptr); + time_t const rawtime = ::time(NULL); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -2344,7 +2344,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const else if (isAbbrev(argv[0], "listCharacterCreateTimeDetailed")) { int const days = atoi(Unicode::wideToNarrow(argv[1]).c_str()); - time_t const cutoff = std::max(static_cast(0), static_cast(::time(nullptr) - (60 * 60 * 24 * days))); + time_t const cutoff = std::max(static_cast(0), static_cast(::time(NULL) - (60 * 60 * 24 * days))); std::multimap, std::string> > resultList; NameManager::getInstance().getPlayerWithCreateTimeAfter(cutoff, resultList); @@ -2356,7 +2356,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "listCharacterCreateTimeAfterDetailed")) { - time_t const rawtime = ::time(nullptr); + time_t const rawtime = ::time(NULL); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -2382,7 +2382,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "listCharacterCreateTimeBeforeDetailed")) { - time_t const rawtime = ::time(nullptr); + time_t const rawtime = ::time(NULL); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -2408,7 +2408,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "listCharacterCreateTimeBetweenDetailed")) { - time_t const rawtime = ::time(nullptr); + time_t const rawtime = ::time(NULL); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -2456,7 +2456,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const else if (isAbbrev(argv[0], "sendMailToCharacterCreateTime")) { int const days = atoi(Unicode::wideToNarrow(argv[1]).c_str()); - time_t const cutoff = std::max(static_cast(0), static_cast(::time(nullptr) - (60 * 60 * 24 * days))); + time_t const cutoff = std::max(static_cast(0), static_cast(::time(NULL) - (60 * 60 * 24 * days))); int const argc = argv.size(); Unicode::String mailBody; @@ -2479,7 +2479,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const static Unicode::String s_mailBody; static time_t s_confirmationTimeout = 0; - time_t const timeNow = ::time(nullptr); + time_t const timeNow = ::time(NULL); if ((s_days == days) && (s_confirmationTimeout > timeNow) && (s_fromName == Unicode::wideToNarrow(argv[2])) && (s_mailSubject == argv[3]) && (s_mailBody == mailBody)) { @@ -2518,7 +2518,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "sendMailToCharacterCreateTimeAfter")) { - time_t const rawtime = ::time(nullptr); + time_t const rawtime = ::time(NULL); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -2555,7 +2555,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const static Unicode::String s_mailBody; static time_t s_confirmationTimeout = 0; - time_t const timeNow = ::time(nullptr); + time_t const timeNow = ::time(NULL); if ((s_cutoff == cutoff) && (s_confirmationTimeout > timeNow) && (s_fromName == Unicode::wideToNarrow(argv[7])) && (s_mailSubject == argv[8]) && (s_mailBody == mailBody)) { @@ -2594,7 +2594,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "sendMailToCharacterCreateTimeBefore")) { - time_t const rawtime = ::time(nullptr); + time_t const rawtime = ::time(NULL); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -2631,7 +2631,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const static Unicode::String s_mailBody; static time_t s_confirmationTimeout = 0; - time_t const timeNow = ::time(nullptr); + time_t const timeNow = ::time(NULL); if ((s_cutoff == cutoff) && (s_confirmationTimeout > timeNow) && (s_fromName == Unicode::wideToNarrow(argv[7])) && (s_mailSubject == argv[8]) && (s_mailBody == mailBody)) { @@ -2670,7 +2670,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "sendMailToCharacterCreateTimeBetween")) { - time_t const rawtime = ::time(nullptr); + time_t const rawtime = ::time(NULL); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -2729,7 +2729,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const static Unicode::String s_mailBody; static time_t s_confirmationTimeout = 0; - time_t const timeNow = ::time(nullptr); + time_t const timeNow = ::time(NULL); if ((s_cutoffLower == cutoffLower) && (s_cutoffUpper == cutoffUpper) && (s_confirmationTimeout > timeNow) && (s_fromName == Unicode::wideToNarrow(argv[13])) && (s_mailSubject == argv[14]) && (s_mailBody == mailBody)) { @@ -2776,7 +2776,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const uint32 const targetStationId = static_cast(atoi(Unicode::wideToNarrow(argv[4]).c_str())); std::string const targetCluster = Unicode::wideToNarrow(argv[5]); - time_t const timeNow = ::time(nullptr); + time_t const timeNow = ::time(NULL); result += Unicode::narrowToWide(FormattedString<512>().sprintf(" currentTime: %ld, %s\n", timeNow, CalendarTime::convertEpochToTimeStringLocal(timeNow).c_str())); result += Unicode::narrowToWide(FormattedString<512>().sprintf("\n characterCreateTime: %ld\n", sourceCharacterCreateTime)); @@ -2837,7 +2837,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const { std::string const sourceCluster = Unicode::wideToNarrow(argv[1]); - time_t const timeNow = ::time(nullptr); + time_t const timeNow = ::time(NULL); result += Unicode::narrowToWide(FormattedString<512>().sprintf(" currentTime: %ld, %s\n", timeNow, CalendarTime::convertEpochToTimeStringLocal(timeNow).c_str())); result += Unicode::narrowToWide(FormattedString<512>().sprintf(" sourceCluster: %s\n", sourceCluster.c_str())); @@ -2893,7 +2893,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const { result += Unicode::narrowToWide(FormattedString<512>().sprintf(" free CTS info file: %s\n", FreeCtsDataTable::getFreeCtsFileName().c_str())); - time_t const timeNow = ::time(nullptr); + time_t const timeNow = ::time(NULL); result += Unicode::narrowToWide(FormattedString<512>().sprintf(" currentTime: %ld, %s\n", timeNow, CalendarTime::convertEpochToTimeStringLocal(timeNow).c_str())); } @@ -3125,7 +3125,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const else { result += Unicode::narrowToWide(FormattedString<1024>().sprintf("Requesting adjustment of imperial score for GCW score category (%s) by (%d). It can take up to 1 minute for the adjustment request to be completed.\n", category.c_str(), adjustment)); - ServerUniverse::getInstance().adjustGcwImperialScore("remote server adjustGcwImperialScore", nullptr, category, adjustment); + ServerUniverse::getInstance().adjustGcwImperialScore("remote server adjustGcwImperialScore", NULL, category, adjustment); } } else if (isAbbrev(argv[0], "adjustGcwRebelScore")) @@ -3148,7 +3148,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const else { result += Unicode::narrowToWide(FormattedString<1024>().sprintf("Requesting adjustment of rebel score for GCW score category (%s) by (%d). It can take up to 1 minute for the adjustment request to be completed.\n", category.c_str(), adjustment)); - ServerUniverse::getInstance().adjustGcwRebelScore("remote server adjustGcwRebelScore", nullptr, category, adjustment); + ServerUniverse::getInstance().adjustGcwRebelScore("remote server adjustGcwRebelScore", NULL, category, adjustment); } } else if (isAbbrev(argv[0], "decayGcwScore")) @@ -3202,20 +3202,20 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject const * const o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == nullptr) + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject const * const c = o->asCreatureObject(); - if (c == nullptr) + if (c == NULL) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } - if (PlayerCreatureController::getPlayerObject(c) == nullptr) + if (PlayerCreatureController::getPlayerObject(c) == NULL) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -3240,21 +3240,21 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject const * const o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == nullptr) + if (o == NULL) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject const * const c = o->asCreatureObject(); - if (c == nullptr) + if (c == NULL) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject const * const p = PlayerCreatureController::getPlayerObject(c); - if (p == nullptr) + if (p == NULL) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserShip.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserShip.cpp index 3fc8ad7d..38efa02a 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserShip.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserShip.cpp @@ -116,7 +116,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S slotNameToken.clear (); } - if (ship == nullptr) + if (ship == NULL) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); return true; @@ -126,7 +126,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S ShipChassis const * const shipChassis = ShipChassis::findShipChassisByCrc (chassisType); - if (shipChassis == nullptr) + if (shipChassis == NULL) { result += Unicode::narrowToWide ("No chassis"); return true; @@ -178,7 +178,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S if (ship->isSlotInstalled(chassisSlot)) shipComponentData = ship->createShipComponentData(chassisSlot); - if (shipComponentData == nullptr) + if (shipComponentData == NULL) { result += Unicode::narrowToWide (" Loaded NONE\n"); } @@ -223,7 +223,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S { TangibleObject * const component = findTangible (user->getLookAtTarget (), argv, 1); - if (component == nullptr) + if (component == NULL) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); return true; @@ -231,7 +231,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S ShipComponentData * const shipComponentData = ShipComponentDataManager::create (*component); - if (shipComponentData == nullptr) + if (shipComponentData == NULL) { result += Unicode::narrowToWide ("Not a ship component"); return true; @@ -252,13 +252,13 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S TangibleObject * const component = findTangible (NetworkId::cms_invalid, argv, 1); std::string const & slotName = Unicode::wideToNarrow (argv [2]); - if (ship == nullptr) + if (ship == NULL) { result += Unicode::narrowToWide ("no ship"); return true; } - if (component == nullptr) + if (component == NULL) { result += Unicode::narrowToWide ("no component"); return true; @@ -279,14 +279,14 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S } ShipChassis const * const shipChassis = ShipChassis::findShipChassisByCrc (ship->getChassisType ()); - if (shipChassis == nullptr) + if (shipChassis == NULL) { result += Unicode::narrowToWide ("Ship chassis invalid"); return true; } ShipChassisSlot const * const slot = shipChassis->getSlot (shipChassisSlotType); - if (slot == nullptr) + if (slot == NULL) { result += Unicode::narrowToWide ("Ship chassis does not support that slot"); return true; @@ -294,7 +294,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S ShipComponentData * const shipComponentData = ShipComponentDataManager::create (*component); - if (shipComponentData == nullptr) + if (shipComponentData == NULL) { result += Unicode::narrowToWide ("Not a ship component"); return true; @@ -325,7 +325,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S std::string const & componentName = Unicode::wideToNarrow (argv [1]); std::string const & slotName = Unicode::wideToNarrow (argv [2]); - if (ship == nullptr) + if (ship == NULL) { result += Unicode::narrowToWide ("no ship"); return true; @@ -334,7 +334,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S uint32 const componentCrc = Crc::normalizeAndCalculate (componentName.c_str ()); ShipComponentDescriptor const * const shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByCrc (componentCrc); - if (shipComponentDescriptor == nullptr) + if (shipComponentDescriptor == NULL) { result += Unicode::narrowToWide ("Invalid component name"); return true; @@ -364,13 +364,13 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S TangibleObject * const targetContainer = findTangible (user->getInventory ()->getNetworkId (), argv, 2); std::string const & slotName = Unicode::wideToNarrow (argv [1]); - if (ship == nullptr) + if (ship == NULL) { result += Unicode::narrowToWide ("no ship"); return true; } - if (targetContainer == nullptr) + if (targetContainer == NULL) { result += Unicode::narrowToWide ("no target container"); return true; @@ -405,7 +405,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S ShipObject * const ship = dynamic_cast(findTangible (user->getLookAtTarget (), argv, 2)); std::string const & slotName = Unicode::wideToNarrow (argv [1]); - if (ship == nullptr) + if (ship == NULL) { result += Unicode::narrowToWide ("no ship"); return true; @@ -436,14 +436,14 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S else if (isCommand (argv[0], CommandNames::pseudoDamageShip)) { ShipObject const * const victimShipObject = user->getPilotedShip(); - if (victimShipObject == nullptr) + if (victimShipObject == NULL) { result += Unicode::narrowToWide ("You are not piloting a ship."); return true; } ShipObject const * const attackerShipObject = dynamic_cast(findTangible (user->getLookAtTarget (), argv, 2)); - if (attackerShipObject == nullptr) + if (attackerShipObject == NULL) { result += Unicode::narrowToWide ("You don't have attacker ship targeted."); return true; @@ -486,12 +486,12 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S ShipObject const * const idotShip = idot.getShipObject(); - if (ship != nullptr && ship != idotShip) + if (ship != NULL && ship != idotShip) continue; uint32 const chassisType = idotShip->getChassisType(); ShipChassis const * const chassis = ShipChassis::findShipChassisByCrc(chassisType); - std::string const chassisTypeName = (chassis != nullptr) ? chassis->getName().getString() : ""; + std::string const chassisTypeName = (chassis != NULL) ? chassis->getName().getString() : ""; float hpCur = 0.0f; float hpMax = 0.0f; @@ -522,7 +522,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S { ShipObject * const ship = dynamic_cast(findTangible (user->getLookAtTarget (), argv, 4)); - if (ship == nullptr) + if (ship == NULL) { result += Unicode::narrowToWide ("no ship"); return true; @@ -546,7 +546,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S { ShipObject * const ship = dynamic_cast(findTangible (user->getLookAtTarget (), argv, 4)); - if (ship == nullptr) + if (ship == NULL) { result += Unicode::narrowToWide ("no ship"); return true; diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserSkill.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserSkill.cpp index 3b356f42..fc1a1a49 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserSkill.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserSkill.cpp @@ -99,7 +99,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 2); - if (creature == nullptr) + if (creature == NULL) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -107,7 +107,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { const std::string skillName = Unicode::wideToNarrow (argv[1]); const SkillObject * const skill = SkillManager::getInstance ().getSkill (skillName); - if (skill == nullptr) + if (skill == NULL) { result += Unicode::narrowToWide ("unknown skill"); } @@ -126,7 +126,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 3); - if (creature == nullptr) + if (creature == NULL) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -146,7 +146,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 2); - if (creature == nullptr) + if (creature == NULL) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -198,7 +198,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 1); - if (creature == nullptr) + if (creature == NULL) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -233,7 +233,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 1); - if (creature == nullptr) + if (creature == NULL) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -262,7 +262,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 1); - if (creature == nullptr) + if (creature == NULL) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -288,7 +288,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 2); - if (creature == nullptr) + if (creature == NULL) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -296,7 +296,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { std::string skillName = Unicode::wideToNarrow (argv[1]); const SkillObject * skill = SkillManager::getInstance ().getSkill (skillName); - if (skill == nullptr) + if (skill == NULL) { result += Unicode::narrowToWide ("unknown skill"); } @@ -317,7 +317,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 2); - if (creature == nullptr) + if (creature == NULL) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -336,7 +336,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 1); - if (creature == nullptr) + if (creature == NULL) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -367,7 +367,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 2); - if (creature == nullptr) + if (creature == NULL) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -384,7 +384,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 2); - if (creature == nullptr) + if (creature == NULL) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -401,7 +401,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 2); - if (creature == nullptr) + if (creature == NULL) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -418,7 +418,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 2); - if (creature == nullptr) + if (creature == NULL) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -435,7 +435,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 1); - if (creature == nullptr) + if (creature == NULL) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserSpaceAi.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserSpaceAi.cpp index 0964cdac..9972dcf5 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserSpaceAi.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserSpaceAi.cpp @@ -66,9 +66,9 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const AiShipController::setAttackingEnabled(true); Object * const object = NetworkIdManager::getObjectById(userId); - ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; + ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; - if (serverObject != nullptr) + if (serverObject != NULL) { Chat::sendSystemMessage(*serverObject, Unicode::narrowToWide("[WAR] AI will now attack."), Unicode::emptyString); } @@ -80,9 +80,9 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const AiShipController::setAttackingEnabled(false); Object * const object = NetworkIdManager::getObjectById(userId); - ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; + ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; - if (serverObject != nullptr) + if (serverObject != NULL) { Chat::sendSystemMessage(*serverObject, Unicode::narrowToWide("[PEACE] AI will no longer attack."), Unicode::emptyString); } @@ -92,20 +92,20 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const else if (isAbbrev(argv[0], "path")) { Object * const object = NetworkIdManager::getObjectById(userId); - ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; + ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; - if ( (serverObject != nullptr) + if ( (serverObject != NULL) && (argv.size () > 1)) { NetworkId networkId(Unicode::wideToNarrow(argv[1])); AiShipController * const aiShipController = AiShipController::getAiShipController(networkId); - if (aiShipController != nullptr) + if (aiShipController != NULL) { SpacePath * const spacePath = aiShipController->getPath(); - if (spacePath != nullptr) + if (spacePath != NULL) { SpacePath::TransformList const & transformList = spacePath->getTransformList(); SpacePath::TransformList::const_iterator iterTransformList = transformList.begin(); @@ -127,7 +127,7 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const } else { - Chat::sendSystemMessage(*serverObject, Unicode::narrowToWide("nullptr path"), Unicode::emptyString); + Chat::sendSystemMessage(*serverObject, Unicode::narrowToWide("NULL path"), Unicode::emptyString); } } else @@ -141,9 +141,9 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const else if (isAbbrev(argv[0], "reloaddata")) { Object * const object = NetworkIdManager::getObjectById(userId); - ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; + ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; - if (serverObject != nullptr) + if (serverObject != NULL) { AiShipPilotData::reload(); @@ -156,10 +156,10 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const else if (isAbbrev(argv[0], "clientDebug")) { Object * const object = NetworkIdManager::getObjectById(userId); - ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; + ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; int temp; - if (serverObject != nullptr) + if (serverObject != NULL) { if ( serverObject->getObjVars().getItem("ai_debug_string", temp) && (temp > 0)) @@ -180,7 +180,7 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const Client * const client = serverObject->getClient(); - if (client != nullptr) + if (client != NULL) { AiDebugString aiDebugString; aiDebugString.enableClearClientFlag(); @@ -209,9 +209,9 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const else if (isAbbrev(argv[0], "serverDebug")) { Object * const object = NetworkIdManager::getObjectById(userId); - ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; + ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; - if (serverObject != nullptr) + if (serverObject != NULL) { AiShipController::setClientDebugEnabled(!AiShipController::isClientDebugEnabled()); @@ -225,9 +225,9 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const else if (isAbbrev(argv[0], "clientDebugText")) { Object * const object = NetworkIdManager::getObjectById(userId); - ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; + ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; - if (serverObject != nullptr) + if (serverObject != NULL) { AiDebugString::setTextEnabled(!AiDebugString::isTextEnabled()); @@ -241,12 +241,12 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const else if (isAbbrev(argv[0], "maneuver")) { Object * const object = NetworkIdManager::getObjectById(userId); - ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - CreatureObject const * const creatureObject = serverObject ? serverObject->asCreatureObject() : nullptr; + ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + CreatureObject const * const creatureObject = serverObject ? serverObject->asCreatureObject() : NULL; if (serverObject) { - if ((creatureObject != nullptr) && (argv.size () > 1)) + if ((creatureObject != NULL) && (argv.size () > 1)) { AiShipController const * const lookAtAiShipController = AiShipController::getAiShipController(creatureObject->getLookAtTarget()); @@ -295,9 +295,9 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const else if (isAbbrev(argv[0], "fastAxis")) { Object * const object = NetworkIdManager::getObjectById(userId); - ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; + ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; - if (serverObject != nullptr) + if (serverObject != NULL) { Unicode::String systemMessage; diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserVeteran.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserVeteran.cpp index 3b91f7f0..0152e24d 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserVeteran.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserVeteran.cpp @@ -42,7 +42,7 @@ bool ConsoleCommandParserVeteran::performParsing (const NetworkId & userId, cons { NetworkId targetPlayer(Unicode::wideToNarrow (argv[1])); ServerObject const * const so = safe_cast(NetworkIdManager::getObjectById(targetPlayer)); - Client const * const client = so ? so->getClient() : nullptr; + Client const * const client = so ? so->getClient() : NULL; if (client) { std::string output; @@ -107,7 +107,7 @@ bool ConsoleCommandParserVeteran::performParsing (const NetworkId & userId, cons { NetworkId targetPlayer(Unicode::wideToNarrow(argv[1])); ServerObject const * const so = safe_cast(NetworkIdManager::getObjectById(targetPlayer)); - CreatureObject const * const playerCreature = so ? so->asCreatureObject() : nullptr; + CreatureObject const * const playerCreature = so ? so->asCreatureObject() : NULL; if (!playerCreature) result += getErrorMessage(argv[0],ERR_INVALID_OBJECT); else @@ -126,7 +126,7 @@ bool ConsoleCommandParserVeteran::performParsing (const NetworkId & userId, cons { std::string url(Unicode::wideToNarrow(argv[1])); ServerObject const * const so = safe_cast(NetworkIdManager::getObjectById(userId)); - Client const * const client = so ? so->getClient() : nullptr; + Client const * const client = so ? so->getClient() : NULL; if (client) { client->launchWebBrowser(url); diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleManager.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleManager.cpp index f31601df..46e4a6fd 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleManager.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleManager.cpp @@ -41,14 +41,14 @@ #include "sharedCommandParser/CommandParser.h" #include "sharedNetworkMessages/ConsoleChannelMessages.h" -CommandParser * ConsoleMgr::ms_parser = nullptr; +CommandParser * ConsoleMgr::ms_parser = NULL; //----------------------------------------------------------------------- void ConsoleMgr::install() { - if (ms_parser == nullptr) + if (ms_parser == NULL) { ms_parser = new ConsoleCommandParserDefault(); ms_parser->addSubCommand(new ConsoleCommandParserCombatEngine ()); @@ -80,10 +80,10 @@ void ConsoleMgr::install() void ConsoleMgr::remove() { - if (ms_parser != nullptr) + if (ms_parser != NULL) { delete ms_parser; - ms_parser = nullptr; + ms_parser = NULL; } } // ConsoleMgr::remove @@ -93,7 +93,7 @@ void ConsoleMgr::processString(const std::string & msg, Client *from, uint32 msg { DEBUG_REPORT_LOG_PRINT(true, ("Console Message Received: %s\n",(msg.c_str()))); - if (ms_parser == nullptr) + if (ms_parser == NULL) { DEBUG_WARNING(true, ("Console command parser has not been created!")); return; diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleManager.h b/engine/server/library/serverGame/src/shared/console/ConsoleManager.h index 8f71dbd6..f32ac0a3 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleManager.h +++ b/engine/server/library/serverGame/src/shared/console/ConsoleManager.h @@ -17,9 +17,9 @@ public: static void install(); static void remove(); - static void processString(const std::string & msg, Client *from = nullptr,uint32 msgId = 0); - static void broadcastString(const std::string & msg, Client *to = nullptr, uint32 msgId = 0); - static void broadcastString(const CommandParser::String_t & msg, Client *to = nullptr, uint32 msgId = 0); + static void processString(const std::string & msg, Client *from = NULL,uint32 msgId = 0); + static void broadcastString(const std::string & msg, Client *to = NULL, uint32 msgId = 0); + static void broadcastString(const CommandParser::String_t & msg, Client *to = NULL, uint32 msgId = 0); static void broadcastString(const std::string & msg, NetworkId to, uint32 msgId = 0); private: diff --git a/engine/server/library/serverGame/src/shared/controller/AiCreatureController.cpp b/engine/server/library/serverGame/src/shared/controller/AiCreatureController.cpp index 14425612..040d0a9c 100755 --- a/engine/server/library/serverGame/src/shared/controller/AiCreatureController.cpp +++ b/engine/server/library/serverGame/src/shared/controller/AiCreatureController.cpp @@ -83,7 +83,7 @@ namespace AiCreatureControllerNamespace bool s_installed = false; typedef std::set ObserverList; - PersistentCrcString * s_defaultCreatureName = nullptr; + PersistentCrcString * s_defaultCreatureName = NULL; void remove(); Location getLocation(ServerObject const & serverObject); @@ -97,7 +97,7 @@ void AiCreatureControllerNamespace::remove() DEBUG_FATAL(!s_installed, ("Not installed.")); delete s_defaultCreatureName; - s_defaultCreatureName = nullptr; + s_defaultCreatureName = NULL; s_installed = false; } @@ -106,9 +106,9 @@ void AiCreatureControllerNamespace::remove() Location AiCreatureControllerNamespace::getLocation(ServerObject const & serverObject) { CellProperty const * const cellProperty = serverObject.getParentCell(); - Object const * const cellObject = (cellProperty != nullptr) ? &cellProperty->getOwner() : nullptr; - Vector const & positionRelativeToCellOrWorld = (cellObject != nullptr) ? serverObject.getPosition_c() : serverObject.getPosition_w(); - NetworkId const & networkIdForCellOrWorld = (cellObject != nullptr) ? cellObject->getNetworkId() : NetworkId::cms_invalid; + Object const * const cellObject = (cellProperty != NULL) ? &cellProperty->getOwner() : NULL; + Vector const & positionRelativeToCellOrWorld = (cellObject != NULL) ? serverObject.getPosition_c() : serverObject.getPosition_w(); + NetworkId const & networkIdForCellOrWorld = (cellObject != NULL) ? cellObject->getNetworkId() : NetworkId::cms_invalid; return Location(positionRelativeToCellOrWorld, networkIdForCellOrWorld, Location::getCrcBySceneName(serverObject.getSceneId())); } @@ -164,10 +164,10 @@ AICreatureController::~AICreatureController() Object * const owner = getOwner(); - if (owner != nullptr && owner->isAuthoritative() && !getHibernate() && m_hibernationDelay.get() > 0 && m_hibernationTimer.get() > 0) + if (owner != NULL && owner->isAuthoritative() && !getHibernate() && m_hibernationDelay.get() > 0 && m_hibernationTimer.get() > 0) ObjectTracker::removeDelayedHibernatingAI(); - if ( (owner != nullptr) + if ( (owner != NULL) && AiLogManager::isLogging(owner->getNetworkId())) { AiLogManager::setLogging(owner->getNetworkId(), false); @@ -205,9 +205,9 @@ void AICreatureController::CreatureNameChangedCallback::modified(AICreatureContr void AICreatureController::handleMessage (int message, float value, const MessageQueue::Data* const data, uint32 flags) { CreatureObject * const owner = static_cast(getOwner()); - if (owner == nullptr) + if (owner == NULL) { - DEBUG_FATAL(true, ("Owner is nullptr in AiCreatureController::handleMessage\n")); + DEBUG_FATAL(true, ("Owner is NULL in AiCreatureController::handleMessage\n")); return; } @@ -219,7 +219,7 @@ void AICreatureController::handleMessage (int message, float value, const Messag AiMovementMessage const * const msg = safe_cast(data); - if (msg != nullptr) + if (msg != NULL) { if (owner->isAuthoritative()) { @@ -256,7 +256,7 @@ void AICreatureController::handleMessage (int message, float value, const Messag LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::handleMessage(CM_aiSetCreatureName) owner(%s)", getDebugInformation().c_str())); MessageQueueGenericValueType const * const msg = safe_cast const *>(data); - if (msg != nullptr) + if (msg != NULL) { setCreatureName(msg->getValue()); } @@ -267,7 +267,7 @@ void AICreatureController::handleMessage (int message, float value, const Messag LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::handleMessage(CM_aiSetHomeLocation) owner(%s)", getDebugInformation().c_str())); MessageQueueGenericValueType const * const msg = safe_cast const *>(data); - if (msg != nullptr) + if (msg != NULL) { setHomeLocation(msg->getValue()); } @@ -278,7 +278,7 @@ void AICreatureController::handleMessage (int message, float value, const Messag LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::handleMessage(CM_aiSetFrozen) owner(%s)", getDebugInformation().c_str())); MessageQueueGenericValueType const * const msg = safe_cast const *>(data); - if (msg != nullptr) + if (msg != NULL) { setFrozen(msg->getValue()); } @@ -289,7 +289,7 @@ void AICreatureController::handleMessage (int message, float value, const Messag LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::handleMessage(CM_aiSetRetreating) owner(%s)", getDebugInformation().c_str())); MessageQueueGenericValueType const * const msg = safe_cast const *>(data); - if (msg != nullptr) + if (msg != NULL) { setRetreating(msg->getValue()); } @@ -300,7 +300,7 @@ void AICreatureController::handleMessage (int message, float value, const Messag LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::handleMessage(CM_aiSetLogging) owner(%s)", getDebugInformation().c_str())); MessageQueueGenericValueType const * const msg = safe_cast const *>(data); - if (msg != nullptr) + if (msg != NULL) { setLogging(msg->getValue()); } @@ -333,7 +333,7 @@ void AICreatureController::handleMessage (int message, float value, const Messag case CM_setHibernationDelay: { MessageQueueGenericValueType const * const msg = safe_cast const *>(data); - if (msg != nullptr) + if (msg != NULL) setHibernationDelay(msg->getValue()); } break; @@ -469,7 +469,7 @@ float AICreatureController::realAlter(float time) CreatureObject * const creatureOwner = getCreature(); #ifdef _DEBUG - AiDebugString * aiDebugString = nullptr; + AiDebugString * aiDebugString = NULL; if (!creatureOwner->getObservers().empty()) { aiDebugString = new AiDebugString; @@ -508,7 +508,7 @@ float AICreatureController::realAlter(float time) if (!creatureOwner->isInWorld() || getHibernate()) { #ifdef _DEBUG - if (aiDebugString != nullptr) + if (aiDebugString != NULL) { sendDebugAiToClients(*aiDebugString); delete aiDebugString; @@ -522,8 +522,8 @@ float AICreatureController::realAlter(float time) // check floating { CollisionProperty const * const collision = creatureOwner->getCollisionProperty(); - Footprint const * const foot = (collision != nullptr) ? collision->getFootprint() : nullptr; - bool floating = (foot != nullptr) ? foot->isFloating() : false; + Footprint const * const foot = (collision != NULL) ? collision->getFootprint() : NULL; + bool floating = (foot != NULL) ? foot->isFloating() : false; if (floating) { @@ -547,7 +547,7 @@ float AICreatureController::realAlter(float time) // Update our inPathfindingRegion flag whenever the behavior changes CityPathGraph const * graph = CityPathGraphManager::getCityGraphFor(creatureOwner); - m_inPathfindingRegion = (graph != nullptr); + m_inPathfindingRegion = (graph != NULL); applyMovementChange(); } @@ -589,10 +589,10 @@ float AICreatureController::realAlter(float time) bool resetHateTimer = false; CachedNetworkId const & hateTarget = creatureOwner->getHateTarget(); CreatureObject * const hateTargetCreatureObject = CreatureObject::asCreatureObject(hateTarget.getObject()); - CreatureController const * const hateTargetCreatureController = (hateTargetCreatureObject != nullptr) ? CreatureController::asCreatureController(hateTargetCreatureObject->getController()) : nullptr; + CreatureController const * const hateTargetCreatureController = (hateTargetCreatureObject != NULL) ? CreatureController::asCreatureController(hateTargetCreatureObject->getController()) : NULL; - if ( (hateTargetCreatureObject != nullptr) - && (hateTargetCreatureController != nullptr)) + if ( (hateTargetCreatureObject != NULL) + && (hateTargetCreatureController != NULL)) { float const hateTargetMovementSpeedSquared = hateTargetCreatureController->getCurrentVelocity().magnitudeSquared(); float const hateTargetWalkSpeedSquared = sqr(hateTargetCreatureObject->getWalkSpeed()); @@ -605,7 +605,7 @@ float AICreatureController::realAlter(float time) { Object * const combatStartLocationCell = NetworkIdManager::getObjectById(m_combatStartLocation.get().getCell()); Vector const & combatStartPosition_c = m_combatStartLocation.get().getCoordinates(); - Vector const & combatStartPosition_w = (combatStartLocationCell != nullptr) ? combatStartLocationCell->rotateTranslate_o2w(combatStartPosition_c) : combatStartPosition_c; + Vector const & combatStartPosition_w = (combatStartLocationCell != NULL) ? combatStartLocationCell->rotateTranslate_o2w(combatStartPosition_c) : combatStartPosition_c; float const distanceToCombatStartLocationSquared = creatureOwner->getPosition_w().magnitudeBetweenSquared(combatStartPosition_w); float const aggroRadius = getAggroRadius(); @@ -621,7 +621,7 @@ float AICreatureController::realAlter(float time) hateTargetCreatureObject->resetHateTimer(); } } - else if (hateTarget.getObject() != nullptr) + else if (hateTarget.getObject() != NULL) { // AI don't need to lose interest in stationary AI @@ -662,7 +662,7 @@ float AICreatureController::realAlter(float time) } #ifdef _DEBUG - if (aiDebugString != nullptr) + if (aiDebugString != NULL) { m_movement->addDebug(*aiDebugString); } @@ -697,7 +697,7 @@ float AICreatureController::realAlter(float time) updateMovementType(); #ifdef _DEBUG - if (aiDebugString != nullptr) + if (aiDebugString != NULL) { sendDebugAiToClients(*aiDebugString); delete aiDebugString; @@ -711,7 +711,7 @@ float AICreatureController::realAlter(float time) //---------------------------------------------------------------------- void AICreatureController::changeMovement(AiMovementBasePtr newMovement) { - LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::changeMovement() movement(%s)", (newMovement != AiMovementBaseNullPtr) ? AiMovementBase::getMovementString(newMovement->getType()) : "nullptr")); + LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::changeMovement() movement(%s)", (newMovement != AiMovementBaseNullPtr) ? AiMovementBase::getMovementString(newMovement->getType()) : "NULL")); if (getOwner()->isAuthoritative()) { @@ -876,11 +876,11 @@ void AICreatureController::loiter(CellProperty const * homeCell, Vector const & { if (isRetreating()) { - WARNING(true, ("AICreatureController::loiter() owner(%s) cell(%s) home(%.0f, %.0f, %.0f) distance[%.2f...%.2f] delay[%.0f...%.0f] Trying to loiter while retreating, failing request.", getDebugInformation().c_str(), ((homeCell != nullptr) ? homeCell->getCellName() : "nullptr"), home_p.x, home_p.y, home_p.z, minDistance, maxDistance, minDelay, maxDelay)); + WARNING(true, ("AICreatureController::loiter() owner(%s) cell(%s) home(%.0f, %.0f, %.0f) distance[%.2f...%.2f] delay[%.0f...%.0f] Trying to loiter while retreating, failing request.", getDebugInformation().c_str(), ((homeCell != NULL) ? homeCell->getCellName() : "NULL"), home_p.x, home_p.y, home_p.z, minDistance, maxDistance, minDelay, maxDelay)); return; } - LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::loiter() owner(%s) cell(%s) home(%.0f, %.0f, %.0f) distance[%.2f...%.2f] delay[%.0f...%.0f]", getDebugInformation().c_str(), ((homeCell != nullptr) ? homeCell->getCellName() : "nullptr"), home_p.x, home_p.y, home_p.z, minDistance, maxDistance, minDelay, maxDelay)); + LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::loiter() owner(%s) cell(%s) home(%.0f, %.0f, %.0f) distance[%.2f...%.2f] delay[%.0f...%.0f]", getDebugInformation().c_str(), ((homeCell != NULL) ? homeCell->getCellName() : "NULL"), home_p.x, home_p.y, home_p.z, minDistance, maxDistance, minDelay, maxDelay)); AiMovementBasePtr movement(new AiMovementLoiter(this, homeCell, home_p, minDistance, maxDistance, minDelay, maxDelay)); @@ -910,7 +910,7 @@ void AICreatureController::moveTo(CellProperty const * cell, Vector const & targ { if (isRetreating()) { - WARNING(true, ("AICreatureController::moveTo() owner(%s) cell(%s) position(%.0f, %.0f, %.0f) radius(%.2f) Trying to moveTo while retreating, failing request.", getDebugInformation().c_str(), ((cell != nullptr) ? cell->getCellName() : "nullptr"), target_p.x, target_p.y, target_p.z, radius)); + WARNING(true, ("AICreatureController::moveTo() owner(%s) cell(%s) position(%.0f, %.0f, %.0f) radius(%.2f) Trying to moveTo while retreating, failing request.", getDebugInformation().c_str(), ((cell != NULL) ? cell->getCellName() : "NULL"), target_p.x, target_p.y, target_p.z, radius)); return; } @@ -918,9 +918,9 @@ void AICreatureController::moveTo(CellProperty const * cell, Vector const & targ if (getMovementType() == AMT_move) { - AiMovementMove * const aiMovementMove = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementMove() : nullptr; + AiMovementMove * const aiMovementMove = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementMove() : NULL; - if (aiMovementMove != nullptr) + if (aiMovementMove != NULL) { AiLocation const & target = aiMovementMove->getTarget(); @@ -935,7 +935,7 @@ void AICreatureController::moveTo(CellProperty const * cell, Vector const & targ if (!duplicateMovement) { - LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::moveTo() owner(%s) cell(%s) position(%.0f, %.0f, %.0f) radius(%.2f)", getDebugInformation().c_str(), ((cell != nullptr) ? cell->getCellName() : "nullptr"), target_p.x, target_p.y, target_p.z, radius)); + LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::moveTo() owner(%s) cell(%s) position(%.0f, %.0f, %.0f) radius(%.2f)", getDebugInformation().c_str(), ((cell != NULL) ? cell->getCellName() : "NULL"), target_p.x, target_p.y, target_p.z, radius)); AiMovementBasePtr movement(new AiMovementMove(this, cell, target_p, radius)); @@ -957,9 +957,9 @@ void AICreatureController::moveTo(Unicode::String const & targetName) if (getMovementType() == AMT_move) { - AiMovementMove * const aiMovementMove = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementMove() : nullptr; + AiMovementMove * const aiMovementMove = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementMove() : NULL; - if (aiMovementMove != nullptr) + if (aiMovementMove != NULL) { if (aiMovementMove->getTargetName() == targetName) { @@ -992,8 +992,8 @@ void AICreatureController::patrol( std::vector const & locations, bool if (getMovementType() == AMT_patrol) { - AiMovementPatrol * const aiMovementPatrol = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementPatrol() : nullptr; - if (aiMovementPatrol != nullptr) + AiMovementPatrol * const aiMovementPatrol = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementPatrol() : NULL; + if (aiMovementPatrol != NULL) { // if () // { @@ -1026,8 +1026,8 @@ void AICreatureController::patrol( std::vector const & location if (getMovementType() == AMT_patrol) { - AiMovementPatrol * const aiMovementPatrol = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementPatrol() : nullptr; - if (aiMovementPatrol != nullptr) + AiMovementPatrol * const aiMovementPatrol = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementPatrol() : NULL; + if (aiMovementPatrol != NULL) { // if () // { @@ -1071,7 +1071,7 @@ bool AICreatureController::faceTo(CellProperty const * targetCell, Vector const { if (isRetreating()) { - WARNING(true, ("AICreatureController::faceTo() owner(%s) cell(%s) position(%.0f, %.0f, %.0f) Trying to faceTo while retreating, failing faceTo request.", getDebugInformation().c_str(), ((targetCell != nullptr) ? targetCell->getCellName() : "nullptr"), target_p.x, target_p.y, target_p.z)); + WARNING(true, ("AICreatureController::faceTo() owner(%s) cell(%s) position(%.0f, %.0f, %.0f) Trying to faceTo while retreating, failing faceTo request.", getDebugInformation().c_str(), ((targetCell != NULL) ? targetCell->getCellName() : "NULL"), target_p.x, target_p.y, target_p.z)); return false; } @@ -1079,9 +1079,9 @@ bool AICreatureController::faceTo(CellProperty const * targetCell, Vector const if (getMovementType() == AMT_face) { - AiMovementFace * const aiMovementFace = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementFace() : nullptr; + AiMovementFace * const aiMovementFace = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementFace() : NULL; - if (aiMovementFace != nullptr) + if (aiMovementFace != NULL) { AiLocation const & target = aiMovementFace->getTarget(); @@ -1095,7 +1095,7 @@ bool AICreatureController::faceTo(CellProperty const * targetCell, Vector const if (!duplicateMovement) { - LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::faceTo() owner(%s) cell(%s) position(%.0f, %.0f, %.0f)", getDebugInformation().c_str(), ((targetCell != nullptr) ? targetCell->getCellName() : "nullptr"), target_p.x, target_p.y, target_p.z)); + LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::faceTo() owner(%s) cell(%s) position(%.0f, %.0f, %.0f)", getDebugInformation().c_str(), ((targetCell != NULL) ? targetCell->getCellName() : "NULL"), target_p.x, target_p.y, target_p.z)); AiMovementBasePtr behavior(new AiMovementFace(this, targetCell, target_p)); @@ -1126,9 +1126,9 @@ bool AICreatureController::faceTo( NetworkId const & targetId ) if (getMovementType() == AMT_face) { - AiMovementFace * const aiMovementFace = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementFace() : nullptr; + AiMovementFace * const aiMovementFace = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementFace() : NULL; - if (aiMovementFace != nullptr) + if (aiMovementFace != NULL) { AiLocation const & target = aiMovementFace->getTarget(); @@ -1171,9 +1171,9 @@ bool AICreatureController::follow( NetworkId const & targetId, float minDistance if (getMovementType() == AMT_follow) { - AiMovementFollow * const aiMovementFollow = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementFollow() : nullptr; + AiMovementFollow * const aiMovementFollow = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementFollow() : NULL; - if (aiMovementFollow != nullptr) + if (aiMovementFollow != NULL) { AiLocation const & target = aiMovementFollow->getTarget(); @@ -1219,9 +1219,9 @@ bool AICreatureController::follow( NetworkId const & targetId, Vector const & of if (getMovementType() == AMT_follow) { - AiMovementFollow * const aiMovementFollow = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementFollow() : nullptr; + AiMovementFollow * const aiMovementFollow = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementFollow() : NULL; - if (aiMovementFollow != nullptr) + if (aiMovementFollow != NULL) { AiLocation const & offsetTarget = aiMovementFollow->getOffsetTarget(); @@ -1403,9 +1403,9 @@ void AICreatureController::moveCreature( CellProperty const * newCell, Vector co CellProperty * currentCell = getOwner()->getParentCell(); - CellObject * newCellObject = nullptr; + CellObject * newCellObject = NULL; - if( (newCell != nullptr) && (newCell != CellProperty::getWorldCellProperty()) ) + if( (newCell != NULL) && (newCell != CellProperty::getWorldCellProperty()) ) { newCellObject = const_cast(safe_cast(&newCell->getOwner())); } @@ -1422,12 +1422,12 @@ void AICreatureController::moveCreature( CellProperty const * newCell, Vector co CellProperty const * destCell = getCreatureCell()->getDestinationCell(oldPosition+offset,newPosition+offset,dummy); - if((destCell != nullptr) && (destCell != newCell)) + if((destCell != NULL) && (destCell != newCell)) { newPosition = CollisionUtils::transformToCell(newCell,newPosition,destCell); newCell = destCell; - newCellObject = nullptr; + newCellObject = NULL; if(newCell != CellProperty::getWorldCellProperty()) { @@ -1820,15 +1820,15 @@ AICreatureController * AICreatureController::getAiCreatureController(NetworkId c { Object * const object = NetworkIdManager::getObjectById(networkId); - return (object != nullptr) ? AICreatureController::asAiCreatureController(object->getController()) : nullptr; + return (object != NULL) ? AICreatureController::asAiCreatureController(object->getController()) : NULL; } // ---------------------------------------------------------------------- AICreatureController * AICreatureController::asAiCreatureController(Controller * controller) { - CreatureController * const creatureController = (controller != nullptr) ? controller->asCreatureController() : nullptr; - AICreatureController * const aiCreatureController = (creatureController != nullptr) ? creatureController->asAiCreatureController() : nullptr; + CreatureController * const creatureController = (controller != NULL) ? controller->asCreatureController() : NULL; + AICreatureController * const aiCreatureController = (creatureController != NULL) ? creatureController->asAiCreatureController() : NULL; return aiCreatureController; } @@ -1837,8 +1837,8 @@ AICreatureController * AICreatureController::asAiCreatureController(Controller * AICreatureController const * AICreatureController::asAiCreatureController(Controller const * controller) { - CreatureController const * const creatureController = (controller != nullptr) ? controller->asCreatureController() : nullptr; - AICreatureController const * const aiCreatureController = (creatureController != nullptr) ? creatureController->asAiCreatureController() : nullptr; + CreatureController const * const creatureController = (controller != NULL) ? controller->asCreatureController() : NULL; + AICreatureController const * const aiCreatureController = (creatureController != NULL) ? creatureController->asAiCreatureController() : NULL; return aiCreatureController; } @@ -1880,7 +1880,7 @@ float AICreatureController::getRespectRadius(NetworkId const & target) const CreatureObject const * respectCreatureObject = CreatureObject::getCreatureObject(target); - if (respectCreatureObject != nullptr) + if (respectCreatureObject != NULL) { // If the target has a master, then use the master's level for the respect calculation @@ -1893,7 +1893,7 @@ float AICreatureController::getRespectRadius(NetworkId const & target) const // Respect is only towards players - if ( (respectCreatureObject != nullptr) + if ( (respectCreatureObject != NULL) && respectCreatureObject->isPlayerControlled()) { CreatureObject const * const creatureOwner = getCreature(); @@ -1906,7 +1906,7 @@ float AICreatureController::getRespectRadius(NetworkId const & target) const } else { - WARNING(true, ("AICreatureController::getRespectRadius() owner(%s) master(%s) The owner has a master who is not a player. Why does this happen?", getDebugInformation().c_str(), (respectCreatureObject != nullptr) ? respectCreatureObject->getDebugInformation().c_str() : masterId.getValueString().c_str())); + WARNING(true, ("AICreatureController::getRespectRadius() owner(%s) master(%s) The owner has a master who is not a player. Why does this happen?", getDebugInformation().c_str(), (respectCreatureObject != NULL) ? respectCreatureObject->getDebugInformation().c_str() : masterId.getValueString().c_str())); } } @@ -1942,7 +1942,7 @@ void AICreatureController::sendDebugAiToClients(AiDebugString & aiDebugString) // Display the name and level { - aiDebugString.addText(fs.sprintf("%d %s\n", creatureOwner->getLevel(), (getCreatureName().isEmpty() ? "nullptr" : getCreatureName().getString())), PackedRgb::solidWhite); + aiDebugString.addText(fs.sprintf("%d %s\n", creatureOwner->getLevel(), (getCreatureName().isEmpty() ? "NULL" : getCreatureName().getString())), PackedRgb::solidWhite); } // Display the look at target @@ -1990,7 +1990,7 @@ void AICreatureController::sendDebugAiToClients(AiDebugString & aiDebugString) { Floor const * const floor = CollisionWorld::getFloorStandingOn(*creatureOwner); - aiDebugString.addText(fs.sprintf("floor (%s)\n", (floor == nullptr) ? "none" : floor->getId().getValueString().c_str()), PackedRgb::solidWhite); + aiDebugString.addText(fs.sprintf("floor (%s)\n", (floor == NULL) ? "none" : floor->getId().getValueString().c_str()), PackedRgb::solidWhite); } // Display the AI movement speed @@ -2008,15 +2008,15 @@ void AICreatureController::sendDebugAiToClients(AiDebugString & aiDebugString) // Primary Weapon { ServerObject const * const primaryServerObject = ServerObject::getServerObject(getPrimaryWeapon()); - WeaponObject const * const primaryWeaponObject = (primaryServerObject != nullptr) ? primaryServerObject->asWeaponObject() : nullptr; + WeaponObject const * const primaryWeaponObject = (primaryServerObject != NULL) ? primaryServerObject->asWeaponObject() : NULL; - if (primaryWeaponObject != nullptr) + if (primaryWeaponObject != NULL) { aiDebugString.addText(fs.sprintf("%s pri(%s) [%.0f...%.0f] sp(%s)\n", (usingPrimaryWeapon() ? "->" : ""), FileNameUtils::get(primaryWeaponObject->getObjectTemplateName(), FileNameUtils::fileName).c_str(), primaryWeaponObject->getMinRange(), primaryWeaponObject->getMaxRange(), m_aiCreatureData->m_primarySpecials.isEmpty() ? "none" : m_aiCreatureData->m_primarySpecials.getString()), PackedRgb::solidWhite); } else { - aiDebugString.addText(fs.sprintf("pri(nullptr:ERROR)\n"), PackedRgb::solidWhite); + aiDebugString.addText(fs.sprintf("pri(NULL:ERROR)\n"), PackedRgb::solidWhite); } //if (usingPrimaryWeapon()) @@ -2040,9 +2040,9 @@ void AICreatureController::sendDebugAiToClients(AiDebugString & aiDebugString) // Secondary Weapon { ServerObject const * const secondaryServerObject = ServerObject::getServerObject(getSecondaryWeapon()); - WeaponObject const * const secondaryWeaponObject = (secondaryServerObject != nullptr) ? secondaryServerObject->asWeaponObject() : nullptr; + WeaponObject const * const secondaryWeaponObject = (secondaryServerObject != NULL) ? secondaryServerObject->asWeaponObject() : NULL; - if (secondaryWeaponObject != nullptr) + if (secondaryWeaponObject != NULL) { aiDebugString.addText(fs.sprintf("%s sec (%s) [%.0f...%.0f] sp(%s)\n", (usingSecondaryWeapon() ? "->" : ""), FileNameUtils::get(secondaryWeaponObject->getObjectTemplateName(), FileNameUtils::fileName).c_str(), secondaryWeaponObject->getMinRange(), secondaryWeaponObject->getMaxRange(), m_aiCreatureData->m_secondarySpecials.isEmpty() ? "none" : m_aiCreatureData->m_secondarySpecials.getString()), PackedRgb::solidWhite); } @@ -2113,13 +2113,13 @@ void AICreatureController::sendDebugAiToClients(AiDebugString & aiDebugString) TangibleObject const * const hateTargetTangibleObject = TangibleObject::asTangibleObject(hateTarget.getObject()); float const hate = iterHateList->second; std::string hateTargetName; - if (hateTargetTangibleObject != nullptr) + if (hateTargetTangibleObject != NULL) { hateTargetName = Unicode::wideToNarrow(hateTargetTangibleObject->getEncodedObjectName()).c_str(); } else { - hateTargetName = "nullptr"; + hateTargetName = "NULL"; } aiDebugString.addText(fs.sprintf("%s:%s(%.1f)\n", hateTargetName.c_str(), hateTarget.getValueString().c_str(), hate), (iterHateList == hateList.begin()) ? PackedRgb::solidGreen : PackedRgb::solidRed); @@ -2174,7 +2174,7 @@ void AICreatureController::sendDebugAiToClients(AiDebugString & aiDebugString) // Only send to the client if the objvar is set int temp = 0; - if ( (characterObject != nullptr) + if ( (characterObject != NULL) && characterObject->getObjVars().getItem("ai_debug_string", temp)) { if (temp > 0) @@ -2196,7 +2196,7 @@ void AICreatureController::setHomeLocation(Location const & location) { if (getOwner()->isAuthoritative()) { - LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::setHomeLocation() owner(%s) sceneId(%u:%s) cell(%s) coordinates(%.2f, %.2f, %.2f)", getDebugInformation().c_str(), location.getSceneIdCrc(), (location.getSceneId() != nullptr) ? location.getSceneId() : "nullptr", location.getCell().getValueString().c_str(), location.getCoordinates().x, location.getCoordinates().y, location.getCoordinates().z)); + LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::setHomeLocation() owner(%s) sceneId(%u:%s) cell(%s) coordinates(%.2f, %.2f, %.2f)", getDebugInformation().c_str(), location.getSceneIdCrc(), (location.getSceneId() != NULL) ? location.getSceneId() : "NULL", location.getCell().getValueString().c_str(), location.getCoordinates().x, location.getCoordinates().y, location.getCoordinates().z)); m_homeLocation = location; } @@ -2221,7 +2221,7 @@ void AICreatureController::markCombatStartLocation() { m_combatStartLocation = getLocation(*creatureOwner); - LOGC(AiLogManager::isLogging(creatureOwner->getNetworkId()), "debug_ai", ("AICreatureController::markCombatStartLocation() owner(%s) sceneId(%u:%s) cell(%s) coordinates(%.2f, %.2f, %.2f)", getDebugInformation().c_str(), m_combatStartLocation.get().getSceneIdCrc(), (m_combatStartLocation.get().getSceneId() != nullptr) ? m_combatStartLocation.get().getSceneId() : "nullptr", m_combatStartLocation.get().getCell().getValueString().c_str(), m_combatStartLocation.get().getCoordinates().x, m_combatStartLocation.get().getCoordinates().y, m_combatStartLocation.get().getCoordinates().z)); + LOGC(AiLogManager::isLogging(creatureOwner->getNetworkId()), "debug_ai", ("AICreatureController::markCombatStartLocation() owner(%s) sceneId(%u:%s) cell(%s) coordinates(%.2f, %.2f, %.2f)", getDebugInformation().c_str(), m_combatStartLocation.get().getSceneIdCrc(), (m_combatStartLocation.get().getSceneId() != NULL) ? m_combatStartLocation.get().getSceneId() : "NULL", m_combatStartLocation.get().getCell().getValueString().c_str(), m_combatStartLocation.get().getCoordinates().x, m_combatStartLocation.get().getCoordinates().y, m_combatStartLocation.get().getCoordinates().z)); m_primaryWeaponActions.reset(); m_secondaryWeaponActions.reset(); @@ -2279,14 +2279,14 @@ void AICreatureController::onCreatureNameChanged(std::string const & creatureNam AiCreatureCombatProfile const * const primaryWeaponCombatProfile = AiCreatureCombatProfile::getCombatProfile(m_aiCreatureData->m_primarySpecials); - if (primaryWeaponCombatProfile != nullptr) + if (primaryWeaponCombatProfile != NULL) { m_primaryWeaponActions.setCombatProfile(*creatureOwner, *primaryWeaponCombatProfile); } AiCreatureCombatProfile const * const secondaryWeaponCombatProfile = AiCreatureCombatProfile::getCombatProfile(m_aiCreatureData->m_secondarySpecials); - if (secondaryWeaponCombatProfile != nullptr) + if (secondaryWeaponCombatProfile != NULL) { m_secondaryWeaponActions.setCombatProfile(*creatureOwner, *secondaryWeaponCombatProfile); } @@ -2326,7 +2326,7 @@ void AICreatureController::destroyPrimaryWeapon() { WeaponObject * const primaryWeapon = WeaponObject::getWeaponObject(getPrimaryWeapon()); - if (primaryWeapon != nullptr) + if (primaryWeapon != NULL) { unEquipWeapons(); primaryWeapon->permanentlyDestroy(DeleteReasons::God); @@ -2361,7 +2361,7 @@ void AICreatureController::destroySecondaryWeapon() { WeaponObject * const secondaryWeapon = WeaponObject::getWeaponObject(getSecondaryWeapon()); - if (secondaryWeapon != nullptr) + if (secondaryWeapon != NULL) { unEquipWeapons(); secondaryWeapon->permanentlyDestroy(DeleteReasons::God); @@ -2372,7 +2372,7 @@ void AICreatureController::destroySecondaryWeapon() PersistentCrcString const & AICreatureController::getCreatureName() const { - if (m_aiCreatureData->m_name == nullptr) + if (m_aiCreatureData->m_name == NULL) { return *s_defaultCreatureName; } @@ -2401,7 +2401,7 @@ NetworkId AICreatureController::createWeapon(char const * const functionName, Cr CreatureObject * const creatureOwner = getCreature(); ServerObject * const inventory = creatureOwner->getInventory(); - if (inventory == nullptr) + if (inventory == NULL) { WARNING(true, ("AICreatureController::%s() Unable to find inventory for (%s) to place a weapon(%s)", functionName, getDebugInformation().c_str(), weaponName.getString())); } @@ -2440,7 +2440,7 @@ NetworkId AICreatureController::createWeapon(char const * const functionName, Cr bool const persisted = false; ServerObject * const newObject = ServerWorld::createNewObject(weaponCrcName.getCrc(), *inventory, persisted); - if (newObject != nullptr) + if (newObject != NULL) { result = newObject->getNetworkId(); } @@ -2464,7 +2464,7 @@ NetworkId AICreatureController::getUnarmedWeapon() CreatureObject * const creatureOwner = getCreature(); WeaponObject * const defaultWeapon = creatureOwner->getDefaultWeapon(); - if (defaultWeapon != nullptr) + if (defaultWeapon != NULL) { result = defaultWeapon->getNetworkId(); } @@ -2492,9 +2492,9 @@ void AICreatureController::equipPrimaryWeapon() if (!usingPrimaryWeapon()) { ServerObject * const primaryWeaponServerObject = ServerObject::getServerObject(getPrimaryWeapon()); - WeaponObject * const primaryWeaponObject = (primaryWeaponServerObject != nullptr) ? primaryWeaponServerObject->asWeaponObject() : nullptr; + WeaponObject * const primaryWeaponObject = (primaryWeaponServerObject != NULL) ? primaryWeaponServerObject->asWeaponObject() : NULL; - if (primaryWeaponObject != nullptr) + if (primaryWeaponObject != NULL) { unEquipWeapons(); @@ -2508,7 +2508,7 @@ void AICreatureController::equipPrimaryWeapon() { Container::ContainerErrorCode errorCode; - if (ContainerInterface::transferItemToGeneralContainer(*creatureOwner, *primaryWeaponServerObject, nullptr, errorCode)) + if (ContainerInterface::transferItemToGeneralContainer(*creatureOwner, *primaryWeaponServerObject, NULL, errorCode)) { LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::equipPrimaryWeapon() owner(%s) primaryWeapon(%s)\n", getDebugInformation().c_str(), primaryWeaponServerObject->getDebugInformation().c_str())); @@ -2516,7 +2516,7 @@ void AICreatureController::equipPrimaryWeapon() GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(creatureOwner); - if (gameScriptObject != nullptr) + if (gameScriptObject != NULL) { ScriptParams scriptParams; scriptParams.addParam(primaryWeaponObject->getNetworkId()); @@ -2557,9 +2557,9 @@ void AICreatureController::equipSecondaryWeapon() if (!usingSecondaryWeapon()) { ServerObject * const secondaryWeaponServerObject = ServerObject::getServerObject(getSecondaryWeapon()); - WeaponObject * const secondaryWeaponObject = (secondaryWeaponServerObject != nullptr) ? secondaryWeaponServerObject->asWeaponObject() : nullptr; + WeaponObject * const secondaryWeaponObject = (secondaryWeaponServerObject != NULL) ? secondaryWeaponServerObject->asWeaponObject() : NULL; - if (secondaryWeaponObject != nullptr) + if (secondaryWeaponObject != NULL) { unEquipWeapons(); @@ -2573,7 +2573,7 @@ void AICreatureController::equipSecondaryWeapon() { Container::ContainerErrorCode errorCode; - if (ContainerInterface::transferItemToGeneralContainer(*creatureOwner, *secondaryWeaponServerObject, nullptr, errorCode)) + if (ContainerInterface::transferItemToGeneralContainer(*creatureOwner, *secondaryWeaponServerObject, NULL, errorCode)) { LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::equipSecondaryWeapon() owner(%s) secondaryWeapon(%s) errorCode(%d)\n", getDebugInformation().c_str(), secondaryWeaponServerObject->getDebugInformation().c_str())); @@ -2581,7 +2581,7 @@ void AICreatureController::equipSecondaryWeapon() GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(creatureOwner); - if (gameScriptObject != nullptr) + if (gameScriptObject != NULL) { ScriptParams scriptParams; scriptParams.addParam(secondaryWeaponObject->getNetworkId()); @@ -2631,7 +2631,7 @@ void AICreatureController::unEquipWeapons() { ServerObject * const inventory = creatureOwner->getInventory(); - if (inventory != nullptr) + if (inventory != NULL) { Container::ContainerErrorCode error; @@ -2648,13 +2648,13 @@ void AICreatureController::unEquipWeapons() // Equip the default weapon { - if (defaultWeapon != nullptr) + if (defaultWeapon != NULL) { creatureOwner->setCurrentWeapon(*defaultWeapon); } else { - WARNING(true, ("AICreatureController::unEquipWeapons() owner(%s) nullptr default weapon", getDebugInformation().c_str())); + WARNING(true, ("AICreatureController::unEquipWeapons() owner(%s) NULL default weapon", getDebugInformation().c_str())); } } } @@ -2690,7 +2690,7 @@ bool AICreatureController::usingPrimaryWeapon() { WeaponObject const * const currentWeaponObject = getCreature()->getCurrentWeapon(); - if (currentWeaponObject != nullptr) + if (currentWeaponObject != NULL) { result = (getPrimaryWeapon() == currentWeaponObject->getNetworkId()); } @@ -2708,7 +2708,7 @@ bool AICreatureController::usingSecondaryWeapon() { WeaponObject const * const currentWeaponObject = getCreature()->getCurrentWeapon(); - if (currentWeaponObject != nullptr) + if (currentWeaponObject != NULL) { result = (getSecondaryWeapon() == currentWeaponObject->getNetworkId()); } @@ -2815,7 +2815,7 @@ void AICreatureController::setRetreating(bool const retreating) { CellObject const * const cellObject = CellObject::getCellObject(cellId); - if (cellObject != nullptr) + if (cellObject != NULL) { CellProperty const * const cellProperty = cellObject->getCellProperty(); @@ -2965,7 +2965,7 @@ time_t AICreatureController::getKnockDownRecoveryTime() const { AiCreatureCombatProfile const * const combatProfile = AiCreatureCombatProfile::getCombatProfile(m_aiCreatureData->m_primarySpecials); - return (combatProfile != nullptr) ? combatProfile->m_knockDownRecoveryTime : 0; + return (combatProfile != NULL) ? combatProfile->m_knockDownRecoveryTime : 0; } //----------------------------------------------------------------------- std::string const AICreatureController::getCombatActionsString() @@ -2979,7 +2979,7 @@ std::string const AICreatureController::getCombatActionsString() { WeaponObject const * const primaryWeaponObject = WeaponObject::getWeaponObject(getPrimaryWeapon()); - if (primaryWeaponObject != nullptr) + if (primaryWeaponObject != NULL) { result += fs.sprintf("PRIMARY WEAPON >>> %s range[%.0f...%.0f] %s\n", FileNameUtils::get(primaryWeaponObject->getObjectTemplateName(), FileNameUtils::fileName).c_str(), primaryWeaponObject->getMinRange(), primaryWeaponObject->getMaxRange(), usingPrimaryWeapon() ? "(active)" : ""); } @@ -2989,7 +2989,7 @@ std::string const AICreatureController::getCombatActionsString() } AiCreatureCombatProfile const * const primaryWeaponCombatProfile = AiCreatureCombatProfile::getCombatProfile(m_aiCreatureData->m_primarySpecials); - if (primaryWeaponCombatProfile != nullptr) + if (primaryWeaponCombatProfile != NULL) { result += primaryWeaponCombatProfile->toString(); } @@ -3003,7 +3003,7 @@ std::string const AICreatureController::getCombatActionsString() { WeaponObject const * const secondaryWeaponObject = WeaponObject::getWeaponObject(getSecondaryWeapon()); - if (secondaryWeaponObject != nullptr) + if (secondaryWeaponObject != NULL) { result += fs.sprintf("SECONDARY WEAPON >>> %s range[%.0f...%.0f] %s\n", FileNameUtils::get(secondaryWeaponObject->getObjectTemplateName(), FileNameUtils::fileName).c_str(), secondaryWeaponObject->getMinRange(), secondaryWeaponObject->getMaxRange(), usingSecondaryWeapon() ? "(active)" : ""); } @@ -3014,7 +3014,7 @@ std::string const AICreatureController::getCombatActionsString() AiCreatureCombatProfile const * const secondaryWeaponCombatProfile = AiCreatureCombatProfile::getCombatProfile(m_aiCreatureData->m_secondarySpecials); - if (secondaryWeaponCombatProfile != nullptr) + if (secondaryWeaponCombatProfile != NULL) { result += secondaryWeaponCombatProfile->toString(); } diff --git a/engine/server/library/serverGame/src/shared/controller/AiShipController.cpp b/engine/server/library/serverGame/src/shared/controller/AiShipController.cpp index 3fe9a88f..d2bf69f7 100755 --- a/engine/server/library/serverGame/src/shared/controller/AiShipController.cpp +++ b/engine/server/library/serverGame/src/shared/controller/AiShipController.cpp @@ -127,15 +127,15 @@ AiShipController * AiShipController::getAiShipController(NetworkId const & unit) { Object * const object = NetworkIdManager::getObjectById(unit); - return (object != nullptr) ? AiShipController::asAiShipController(object->getController()) : nullptr; + return (object != NULL) ? AiShipController::asAiShipController(object->getController()) : NULL; } // ---------------------------------------------------------------------- AiShipController * AiShipController::asAiShipController(Controller * const controller) { - ShipController * const shipController = (controller != nullptr) ? controller->asShipController() : nullptr; - AiShipController * const aiShipController = (shipController != nullptr) ? shipController->asAiShipController() : nullptr; + ShipController * const shipController = (controller != NULL) ? controller->asShipController() : NULL; + AiShipController * const aiShipController = (shipController != NULL) ? shipController->asAiShipController() : NULL; return aiShipController; } @@ -144,8 +144,8 @@ AiShipController * AiShipController::asAiShipController(Controller * const contr AiShipController const * AiShipController::asAiShipController(Controller const * const controller) { - ShipController const * const shipController = (controller != nullptr) ? controller->asShipController() : nullptr; - AiShipController const * const aiShipController = (shipController != nullptr) ? shipController->asAiShipController() : nullptr; + ShipController const * const shipController = (controller != NULL) ? controller->asShipController() : NULL; + AiShipController const * const aiShipController = (shipController != NULL) ? shipController->asAiShipController() : NULL; return aiShipController; } @@ -155,18 +155,18 @@ AiShipController const * AiShipController::asAiShipController(Controller const * AiShipController::AiShipController(ShipObject * const owner) : ShipController(owner), m_pilotData(&AiShipPilotData::getDefaultPilotData()), - m_pendingNonAttackBehavior(nullptr), - m_nonAttackBehavior(nullptr), - m_pendingAttackBehavior(nullptr), - m_attackBehavior(nullptr), + m_pendingNonAttackBehavior(NULL), + m_nonAttackBehavior(NULL), + m_pendingAttackBehavior(NULL), + m_attackBehavior(NULL), m_shipName(), m_shipClass(ShipAiReactionManager::SC_invalid), m_requestedSlowDown(false), - m_squad(nullptr), - m_attackSquad(nullptr), + m_squad(NULL), + m_attackSquad(NULL), m_formationPosition_l(), m_attackFormationPosition_l(), - m_path(nullptr), + m_path(NULL), m_currentPathIndex(0), m_aggroRadius(200.0f), m_countermeasureState(CS_none), @@ -190,22 +190,22 @@ AiShipController::~AiShipController() // Remove this unit from its squad - if (m_squad != nullptr) + if (m_squad != NULL) { // The owner of the squad is SpaceSquadManager getSquad().removeUnit(getOwner()->getNetworkId()); - m_squad = nullptr; + m_squad = NULL; } // Remove this unit from its attack squad - if (m_attackSquad != nullptr) + if (m_attackSquad != NULL) { // The owner of the attack squad is SpaceSquad m_attackSquad->removeUnit(getOwner()->getNetworkId()); - m_attackSquad = nullptr; + m_attackSquad = NULL; } else { @@ -215,17 +215,17 @@ AiShipController::~AiShipController() // Remove path here. SpacePathManager::release(m_path, getOwner()); - m_path = nullptr; - m_pilotData = nullptr; + m_path = NULL; + m_pilotData = NULL; delete m_nonAttackBehavior; - m_nonAttackBehavior = nullptr; + m_nonAttackBehavior = NULL; delete m_pendingNonAttackBehavior; - m_pendingNonAttackBehavior = nullptr; + m_pendingNonAttackBehavior = NULL; delete m_pendingAttackBehavior; - m_pendingAttackBehavior = nullptr; + m_pendingAttackBehavior = NULL; delete m_attackBehavior; - m_attackBehavior = nullptr; + m_attackBehavior = NULL; delete m_reactToMissileTimer; delete m_pilotManagerInfo; delete m_exclusiveAggroSet; @@ -234,7 +234,7 @@ AiShipController::~AiShipController() // ---------------------------------------------------------------------- void AiShipController::endBaselines() { - DEBUG_FATAL((m_squad != nullptr), ("m_squad should be nullptr")); + DEBUG_FATAL((m_squad != NULL), ("m_squad should be NULL")); m_squad = SpaceSquadManager::createSquad(); getSquad().addUnit(getOwner()->getNetworkId()); @@ -252,7 +252,7 @@ float AiShipController::realAlter(float const elapsedTime) #ifdef _DEBUG - AiDebugString * aiDebugString = nullptr; + AiDebugString * aiDebugString = NULL; if ( s_spaceAiClientDebugEnabled && !getShipOwner()->getObservers().empty()) { @@ -263,25 +263,25 @@ float AiShipController::realAlter(float const elapsedTime) // We have to have a pending behavior because while in a behavior a trigger can get called which can then kill that behavior, so we have to wait until the next frame to switch behaviors so they don't stomp each other from triggers. - if (m_pendingNonAttackBehavior != nullptr) + if (m_pendingNonAttackBehavior != NULL) { delete m_nonAttackBehavior; m_nonAttackBehavior = m_pendingNonAttackBehavior; - m_pendingNonAttackBehavior = nullptr; + m_pendingNonAttackBehavior = NULL; } - if (m_pendingDockingBehavior != nullptr) + if (m_pendingDockingBehavior != NULL) { delete m_dockingBehavior; m_dockingBehavior = m_pendingDockingBehavior; - m_pendingDockingBehavior = nullptr; + m_pendingDockingBehavior = NULL; } - if ( (m_dockingBehavior != nullptr) + if ( (m_dockingBehavior != NULL) && (m_dockingBehavior->isDockFinished())) { delete m_dockingBehavior; - m_dockingBehavior = nullptr; + m_dockingBehavior = NULL; } m_yawPosition = 0.f; @@ -292,7 +292,7 @@ float AiShipController::realAlter(float const elapsedTime) ShipObject * const shipOwner = NON_NULL(getShipOwner()); PROFILER_AUTO_BLOCK_DEFINE("behaviors"); - if (m_attackBehavior != nullptr) // This was added for ships that are contructed for AI but not fully contructed proper using the space_mobile.tab + if (m_attackBehavior != NULL) // This was added for ships that are contructed for AI but not fully contructed proper using the space_mobile.tab { if (isAttacking()) // Capital ships never go into attack mode as such, always follow their non-attacking behavior (although they may fire turrets as they go) { @@ -314,7 +314,7 @@ float AiShipController::realAlter(float const elapsedTime) shipOwner->openWings(); } - if (m_dockingBehavior != nullptr) + if (m_dockingBehavior != NULL) { m_dockingBehavior->unDock(); } @@ -325,7 +325,7 @@ float AiShipController::realAlter(float const elapsedTime) m_attackBehavior->alter(elapsedTime); #ifdef _DEBUG - if (aiDebugString != nullptr) + if (aiDebugString != NULL) { m_attackBehavior->addDebug(*aiDebugString); } @@ -337,9 +337,9 @@ float AiShipController::realAlter(float const elapsedTime) Object * const leaderObject = getAttackSquad().getLeader().getObject(); ShipController * const leaderShipController = leaderObject->getController()->asShipController(); - AiShipController * const leaderAiShipController = (leaderShipController != nullptr) ? leaderShipController->asAiShipController() : nullptr; + AiShipController * const leaderAiShipController = (leaderShipController != NULL) ? leaderShipController->asAiShipController() : NULL; - if (leaderAiShipController != nullptr) + if (leaderAiShipController != NULL) { Transform transform(leaderObject->getTransform_o2w()); transform.setPosition_p(leaderAiShipController->getMoveToGoalPosition_w()); @@ -361,7 +361,7 @@ float AiShipController::realAlter(float const elapsedTime) { delete m_attackBehavior; m_attackBehavior = m_pendingAttackBehavior; - m_pendingAttackBehavior = nullptr; + m_pendingAttackBehavior = NULL; } } else if (isBeingDocked()) @@ -370,18 +370,18 @@ float AiShipController::realAlter(float const elapsedTime) setThrottle(0.0f); } - else if (m_dockingBehavior != nullptr) + else if (m_dockingBehavior != NULL) { m_dockingBehavior->alter(elapsedTime); #ifdef _DEBUG - if (aiDebugString != nullptr) + if (aiDebugString != NULL) { m_dockingBehavior->addDebug(*aiDebugString); } #endif // _DEBUG } - else if (m_nonAttackBehavior != nullptr) + else if (m_nonAttackBehavior != NULL) { PROFILER_AUTO_BLOCK_DEFINE("non-attack behaviors"); @@ -413,7 +413,7 @@ float AiShipController::realAlter(float const elapsedTime) m_nonAttackBehavior->alter(elapsedTime); #ifdef _DEBUG - if (aiDebugString != nullptr) + if (aiDebugString != NULL) { m_nonAttackBehavior->addDebug(*aiDebugString); } @@ -425,7 +425,7 @@ float AiShipController::realAlter(float const elapsedTime) Object * const squadLeader = getSquad().getLeader().getObject(); - if (squadLeader != nullptr) + if (squadLeader != NULL) { Vector goalPosition_w(Formation::getPosition_w(squadLeader->getTransform_o2w(), getFormationPosition_l())); @@ -434,9 +434,9 @@ float AiShipController::realAlter(float const elapsedTime) if (getOwner()->getPosition_w().magnitudeBetweenSquared(goalPosition_w) > sqr(getLargestTurnRadius() * s_slowDownTurnRadiusGain)) { ShipController * const followedUnitShipController = squadLeader->getController()->asShipController(); - AiShipController * const followedUnitAiShipController = (followedUnitShipController != nullptr) ? followedUnitShipController->asAiShipController() : nullptr; + AiShipController * const followedUnitAiShipController = (followedUnitShipController != NULL) ? followedUnitShipController->asAiShipController() : NULL; - if (followedUnitAiShipController != nullptr) + if (followedUnitAiShipController != NULL) { followedUnitAiShipController->requestSlowDown(); } @@ -462,7 +462,7 @@ float AiShipController::realAlter(float const elapsedTime) } #ifdef _DEBUG - if (aiDebugString != nullptr) + if (aiDebugString != NULL) { m_nonAttackBehavior->addDebug(*aiDebugString); } @@ -476,7 +476,7 @@ float AiShipController::realAlter(float const elapsedTime) } else { - DEBUG_WARNING(true, ("debug_ai: There should never be a nullptr non-attacking behavior %s", getOwner()->getDebugInformation().c_str())); + DEBUG_WARNING(true, ("debug_ai: There should never be a NULL non-attacking behavior %s", getOwner()->getDebugInformation().c_str())); } } @@ -551,8 +551,8 @@ float AiShipController::realAlter(float const elapsedTime) } #ifdef _DEBUG - if ( (m_attackBehavior != nullptr) - && (aiDebugString != nullptr)) + if ( (m_attackBehavior != NULL) + && (aiDebugString != NULL)) { PROFILER_AUTO_BLOCK_DEFINE("sendDebugAiToClients"); sendDebugAiToClients(*aiDebugString); @@ -574,7 +574,7 @@ void AiShipController::moveTo(Vector const & position_w, float const throttle, f // If we are not following a unit, see if we need to slow down for someone - if ( (m_nonAttackBehavior != nullptr) + if ( (m_nonAttackBehavior != NULL) && (m_nonAttackBehavior->getBehaviorType() != ASBT_follow) && m_requestedSlowDown && !isAttacking()) @@ -645,16 +645,16 @@ bool AiShipController::addDamageTaken(NetworkId const & attackingUnit, float con { ShipObject const * const attackingShipObject = ShipObject::asShipObject(NetworkIdManager::getObjectById(attackingUnit)); - if (attackingShipObject != nullptr) + if (attackingShipObject != NULL) { CreatureObject const * const attackingPilotCreatureObject = attackingShipObject->getPilot(); - if ( (attackingPilotCreatureObject != nullptr) + if ( (attackingPilotCreatureObject != NULL) && attackingPilotCreatureObject->isPlayerControlled()) { GroupObject * const groupObject = attackingPilotCreatureObject->getGroup(); - if (groupObject != nullptr) + if (groupObject != NULL) { GroupObject::GroupMemberVector const & groupMembers = groupObject->getGroupMembers(); GroupObject::GroupMemberVector::const_iterator iterGroupMembers = groupMembers.begin(); @@ -665,11 +665,11 @@ bool AiShipController::addDamageTaken(NetworkId const & attackingUnit, float con NetworkId const & groupMemberPilotNetworkId = groupMember.first; CreatureObject const * const groupMemberPilotCreatureObject = CreatureObject::asCreatureObject(NetworkIdManager::getObjectById(groupMemberPilotNetworkId)); - if (groupMemberPilotCreatureObject != nullptr) + if (groupMemberPilotCreatureObject != NULL) { ShipObject const * const groupMemberShipObject = groupMemberPilotCreatureObject->getPilotedShip(); - if (groupMemberShipObject != nullptr) + if (groupMemberShipObject != NULL) { if (groupMemberShipObject != attackingShipObject) { @@ -749,24 +749,24 @@ void AiShipController::follow(NetworkId const & followedUnit, Vector const & dir LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipController::follow() owner(%s) followedUnit(%s) direction_o(%.1f, %.1f, %.1f) offset(%.1f)", getOwner()->getNetworkId().getValueString().c_str(), followedUnit.getValueString().c_str(), direction_l.x, direction_l.y, direction_l.z, distance)); SpacePathManager::release(m_path, getOwner()); - m_path = nullptr; + m_path = NULL; float appearanceRadius = 0.0f; Object const * const followedObject = NetworkIdManager::getObjectById(followedUnit); - if (followedObject != nullptr) + if (followedObject != NULL) { //-- This needs to be improved to cast a ray from this position back towards the ship and get the actual collision position CollisionProperty const * const ownerCollisionProperty = getOwner()->getCollisionProperty(); CollisionProperty const * const followedObjectCollisionProperty = followedObject->getCollisionProperty(); - if (ownerCollisionProperty != nullptr) + if (ownerCollisionProperty != NULL) { appearanceRadius += ownerCollisionProperty->getBoundingSphere_l().getRadius(); } - if (followedObjectCollisionProperty != nullptr) + if (followedObjectCollisionProperty != NULL) { appearanceRadius += followedObjectCollisionProperty ->getBoundingSphere_l().getRadius(); } @@ -786,7 +786,7 @@ int AiShipController::getBehaviorType() const { AiShipBehaviorType result = ASBT_idle; - if (m_nonAttackBehavior != nullptr) + if (m_nonAttackBehavior != NULL) { result = m_nonAttackBehavior->getBehaviorType(); } @@ -803,7 +803,7 @@ void AiShipController::idle() LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipController::idle() owner(%s)", getOwner()->getNetworkId().getValueString().c_str())); SpacePathManager::release(m_path, getOwner()); - m_path = nullptr; + m_path = NULL; delete m_pendingNonAttackBehavior; m_pendingNonAttackBehavior = new AiShipBehaviorIdle(*this);; @@ -818,7 +818,7 @@ void AiShipController::track(Object const & target) LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipController::track() owner(%s) target(%s)", getOwner()->getNetworkId().getValueString().c_str(), target.getNetworkId().getValueString().c_str())); SpacePathManager::release(m_path, getOwner()); - m_path = nullptr; + m_path = NULL; delete m_pendingNonAttackBehavior; m_pendingNonAttackBehavior = new AiShipBehaviorTrack(*this, target); @@ -871,7 +871,7 @@ void AiShipController::clearPatrolPath() { LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipController::clearPatrolPath() owner(%s)", getOwner()->getNetworkId().getValueString().c_str())); - if (m_path != nullptr) + if (m_path != NULL) { m_path->clear(); } @@ -896,15 +896,15 @@ void AiShipController::triggerBehaviorChanged(AiShipBehaviorType const newBehavi { // Only send the trigger if the new behavior is different from the old behavior - AiShipBehaviorType const oldBehavior = (m_nonAttackBehavior != nullptr) ? m_nonAttackBehavior->getBehaviorType() : ASBT_idle; + AiShipBehaviorType const oldBehavior = (m_nonAttackBehavior != NULL) ? m_nonAttackBehavior->getBehaviorType() : ASBT_idle; if (oldBehavior != newBehavior) { Object * const object = getOwner(); - ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - GameScriptObject * const gameScriptObject = (serverObject != nullptr) ? serverObject->getScriptObject() : nullptr; + ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + GameScriptObject * const gameScriptObject = (serverObject != NULL) ? serverObject->getScriptObject() : NULL; - if (gameScriptObject != nullptr) + if (gameScriptObject != NULL) { LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipController::triggerBehaviorChanged() unit(%s) old(%s) new(%s)", getOwner()->getNetworkId().getValueString().c_str(), AiShipBehaviorBase::getBehaviorString(oldBehavior), AiShipBehaviorBase::getBehaviorString(newBehavior))); @@ -925,10 +925,10 @@ void AiShipController::triggerBehaviorChanged(AiShipBehaviorType const newBehavi void AiShipController::triggerEnterCombat(NetworkId const & attackTarget) { Object * const object = getOwner(); - ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - GameScriptObject * const gameScriptObject = (serverObject != nullptr) ? serverObject->getScriptObject() : nullptr; + ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + GameScriptObject * const gameScriptObject = (serverObject != NULL) ? serverObject->getScriptObject() : NULL; - if (gameScriptObject != nullptr) + if (gameScriptObject != NULL) { LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipController::triggerEnterCombat() unit(%s) attackTarget(%s)", getOwner()->getNetworkId().getValueString().c_str(), attackTarget.getValueString().c_str())); @@ -968,7 +968,7 @@ void AiShipController::setPilotType(std::string const & pilotType) AiPilotManager::getPilotData(*m_pilotData, *m_pilotManagerInfo); // Make sure the ship name is set - if (shipObject != nullptr) + if (shipObject != NULL) { std::string shipName; @@ -986,7 +986,7 @@ void AiShipController::setPilotType(std::string const & pilotType) // Create the attack behavior based on the ship class delete m_attackBehavior; - m_attackBehavior = nullptr; + m_attackBehavior = NULL; m_shipClass = ShipAiReactionManager::getShipClass(m_shipName); @@ -1009,7 +1009,7 @@ void AiShipController::setPilotType(std::string const & pilotType) setAggroRadius(m_pilotData->m_aggroRadius); - FATAL((m_attackBehavior == nullptr), ("The attack behavior can not be nullptr.")); + FATAL((m_attackBehavior == NULL), ("The attack behavior can not be NULL.")); } // ---------------------------------------------------------------------- @@ -1029,8 +1029,8 @@ CachedNetworkId const & AiShipController::getPrimaryAttackTarget() const ShipObject const * AiShipController::getPrimaryAttackTargetShipObject() const { Object const * const targetObject = getPrimaryAttackTarget().getObject(); - ServerObject const * const targetServerObject = (targetObject != nullptr) ? targetObject->asServerObject() : nullptr; - ShipObject const * const targetShipObject = (targetServerObject != nullptr) ? targetServerObject->asShipObject() : nullptr; + ServerObject const * const targetServerObject = (targetObject != NULL) ? targetObject->asServerObject() : NULL; + ShipObject const * const targetShipObject = (targetServerObject != NULL) ? targetServerObject->asShipObject() : NULL; return targetShipObject; } @@ -1097,7 +1097,7 @@ void AiShipController::setSquad(SpaceSquad * const squad) { // Remove the unit from its previous squad - if ( (m_squad != nullptr) + if ( (m_squad != NULL) && !m_squad->isEmpty()) { m_squad->removeUnit(getOwner()->getNetworkId()); @@ -1170,7 +1170,7 @@ void AiShipController::setAttackSquad(SpaceAttackSquad * const attackSquad) { // Remove the unit from its pervious attack squad - if (m_attackSquad != nullptr) + if (m_attackSquad != NULL) { m_attackSquad->removeUnit(getOwner()->getNetworkId()); } @@ -1210,7 +1210,7 @@ float AiShipController::getShipRadius() const ShipObject const * const shipObject = getShipOwner(); CollisionProperty const * const shipCollision = shipObject->getCollisionProperty(); - if (shipCollision != nullptr) + if (shipCollision != NULL) { result = shipCollision->getBoundingSphere_l().getRadius(); } @@ -1288,9 +1288,9 @@ bool AiShipController::shouldCheckForEnemies() const void AiShipController::setCurrentPathIndex(unsigned int const index) { - //LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipController::setCurrentPathIndex() unit(%s) pathIndex(%u) pathSize(%u)", getOwner()->getNetworkId().getValueString().c_str(), index, (m_path != nullptr) ? m_path->getTransformList().size() : 0)); + //LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipController::setCurrentPathIndex() unit(%s) pathIndex(%u) pathSize(%u)", getOwner()->getNetworkId().getValueString().c_str(), index, (m_path != NULL) ? m_path->getTransformList().size() : 0)); - if ( (m_path != nullptr) + if ( (m_path != NULL) && !m_path->isEmpty()) { m_currentPathIndex = index; @@ -1298,7 +1298,7 @@ void AiShipController::setCurrentPathIndex(unsigned int const index) else { m_currentPathIndex = 0; - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled() && (m_currentPathIndex > 0), "debug_ai", ("AiShipController::setCurrentPathIndex() Setting a non-zero path index(%d) on a nullptr or empty path", index)); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled() && (m_currentPathIndex > 0), "debug_ai", ("AiShipController::setCurrentPathIndex() Setting a non-zero path index(%d) on a NULL or empty path", index)); } } @@ -1317,7 +1317,7 @@ float AiShipController::calculateThrottleToPosition_w(Vector const & position_w, Object const * const object = getOwner(); - if (object != nullptr) + if (object != NULL) { float const distanceToGoalSquared = object->getPosition_w().magnitudeBetweenSquared(position_w); @@ -1420,7 +1420,7 @@ void AiShipController::switchToBomberAttack() bool AiShipController::removeAttackTarget(NetworkId const & unit) { LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipController::removeAttackTarget() owner(%s) unit(%s)", getOwner()->getNetworkId().getValueString().c_str(), unit.getValueString().c_str())); - DEBUG_WARNING((unit == NetworkId::cms_invalid), ("debug_ai: owner(%s) ERROR: Trying to remove a nullptr unit(%s) from the attack target list.", getOwner()->getNetworkId().getValueString().c_str(), unit.getValueString().c_str())); + DEBUG_WARNING((unit == NetworkId::cms_invalid), ("debug_ai: owner(%s) ERROR: Trying to remove a NULL unit(%s) from the attack target list.", getOwner()->getNetworkId().getValueString().c_str(), unit.getValueString().c_str())); return ShipController::removeAttackTarget(unit); } @@ -1637,7 +1637,7 @@ void AiShipController::sendDebugAiToClients(AiDebugString & aiDebugString) bool const checkForEnemies = shouldCheckForEnemies(); float const leashRadius = m_attackBehavior->getLeashRadius(); - aiDebugString.addText(formattedString.sprintf("%s agg(%.0f) lsh(%.0f) %s\n", AiShipController::getAttackOrdersString(getAttackOrders()), m_aggroRadius, leashRadius, (m_attackBehavior == nullptr) ? " [NO ATTACK BEHAVIOR]" : (checkForEnemies ? " [LFE]" : ""))); + aiDebugString.addText(formattedString.sprintf("%s agg(%.0f) lsh(%.0f) %s\n", AiShipController::getAttackOrdersString(getAttackOrders()), m_aggroRadius, leashRadius, (m_attackBehavior == NULL) ? " [NO ATTACK BEHAVIOR]" : (checkForEnemies ? " [LFE]" : ""))); } } @@ -1687,7 +1687,7 @@ void AiShipController::sendDebugAiToClients(AiDebugString & aiDebugString) // Only send to the client if the objvar is set int temp = 0; - if ( (characterObject != nullptr) + if ( (characterObject != NULL) && characterObject->getObjVars().getItem("ai_debug_string", temp)) { if (temp > 0) @@ -1768,8 +1768,8 @@ void AiShipController::addExclusiveAggro(NetworkId const & unit) // Make sure this is a player Object * const unitObject = NetworkIdManager::getObjectById(unit); - ServerObject * const unitServerObject = (unitObject != nullptr) ? unitObject->asServerObject() : nullptr; - CreatureObject * const unitCreatureObject = (unitServerObject != nullptr) ? unitServerObject->asCreatureObject() : nullptr; + ServerObject * const unitServerObject = (unitObject != NULL) ? unitObject->asServerObject() : NULL; + CreatureObject * const unitCreatureObject = (unitServerObject != NULL) ? unitServerObject->asCreatureObject() : NULL; if ( !unitCreatureObject || !unitCreatureObject->isPlayerControlled()) @@ -1829,11 +1829,11 @@ bool AiShipController::isExclusiveAggro(CreatureObject const & pilot) const CreatureObject const * const aggroCreatureObject = CreatureObject::asCreatureObject(aggroCachedNetworkId.getObject()); - if (aggroCreatureObject != nullptr) + if (aggroCreatureObject != NULL) { GroupObject * const groupObject = aggroCreatureObject->getGroup(); - if (groupObject != nullptr) + if (groupObject != NULL) { GroupObject::GroupMemberVector const & groupMembers = groupObject->getGroupMembers(); GroupObject::GroupMemberVector::const_iterator iterGroupMembers = groupMembers.begin(); @@ -1871,7 +1871,7 @@ bool AiShipController::isValidTarget(ShipObject const & unit) const CreatureObject const * const pilotCreatureObject = unit.getPilot(); - if (pilotCreatureObject != nullptr) + if (pilotCreatureObject != NULL) { if (pilotCreatureObject->isPlayerControlled()) { diff --git a/engine/server/library/serverGame/src/shared/controller/AiShipControllerInterface.cpp b/engine/server/library/serverGame/src/shared/controller/AiShipControllerInterface.cpp index 21fef53d..3e4549aa 100755 --- a/engine/server/library/serverGame/src/shared/controller/AiShipControllerInterface.cpp +++ b/engine/server/library/serverGame/src/shared/controller/AiShipControllerInterface.cpp @@ -25,7 +25,7 @@ bool AiShipControllerInterface::addDamageTaken(NetworkId const & unit, NetworkId bool result = false; AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != nullptr) + if (aiShipController != NULL) { bool const verifyAttacker = false; @@ -45,7 +45,7 @@ bool AiShipControllerInterface::setAttackOrders(NetworkId const & unit, AiShipCo bool result = false; AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != nullptr) + if (aiShipController != NULL) { result = true; aiShipController->setAttackOrders(attackOrders); @@ -64,7 +64,7 @@ bool AiShipControllerInterface::idle(NetworkId const & unit) bool result = false; AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != nullptr) + if (aiShipController != NULL) { result = true; aiShipController->idle(); @@ -83,7 +83,7 @@ bool AiShipControllerInterface::track(NetworkId const & unit, Object const & tar bool result = false; AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != nullptr) + if (aiShipController != NULL) { result = true; aiShipController->track(target); @@ -102,7 +102,7 @@ bool AiShipControllerInterface::setLeashRadius(NetworkId const & unit, float con bool result = false; AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != nullptr) + if (aiShipController != NULL) { result = true; aiShipController->setLeashRadius(radius); @@ -121,7 +121,7 @@ bool AiShipControllerInterface::follow(NetworkId const & unit, NetworkId const & bool result = false; AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != nullptr) + if (aiShipController != NULL) { result = true; aiShipController->follow(followedUnit, direction_o, direction); @@ -140,7 +140,7 @@ bool AiShipControllerInterface::addPatrolPath(NetworkId const & unit, SpacePath bool result = false; AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != nullptr) + if (aiShipController != NULL) { result = true; aiShipController->addPatrolPath(path); @@ -159,7 +159,7 @@ bool AiShipControllerInterface::clearPatrolPath(NetworkId const & unit) bool result = false; AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != nullptr) + if (aiShipController != NULL) { result = true; aiShipController->clearPatrolPath(); @@ -178,7 +178,7 @@ bool AiShipControllerInterface::moveTo(NetworkId const & unit, SpacePath * const bool result = false; AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != nullptr) + if (aiShipController != NULL) { result = true; aiShipController->moveTo(path); diff --git a/engine/server/library/serverGame/src/shared/controller/CreatureController.cpp b/engine/server/library/serverGame/src/shared/controller/CreatureController.cpp index f25d0fb1..067da019 100755 --- a/engine/server/library/serverGame/src/shared/controller/CreatureController.cpp +++ b/engine/server/library/serverGame/src/shared/controller/CreatureController.cpp @@ -122,7 +122,7 @@ CreatureController::~CreatureController() void CreatureController::handleMessage (const int message, const float value, const MessageQueue::Data* const data, const uint32 flags) { CreatureObject * const owner = static_cast(getOwner()); - DEBUG_FATAL(!owner, ("Owner is nullptr in CreatureController::handleMessage\n")); + DEBUG_FATAL(!owner, ("Owner is NULL in CreatureController::handleMessage\n")); switch(message) { @@ -629,7 +629,7 @@ void CreatureController::handleMessage (const int message, const float value, co case CM_setIncapacitated: { const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); - if (msg != nullptr) + if (msg != NULL) owner->setIncapacitated(msg->getValue().first, msg->getValue().second); } break; @@ -853,7 +853,7 @@ void CreatureController::handleMessage (const int message, const float value, co if (owner && msg) owner->setAlternateAppearance(msg->getValue()); else - WARNING(true, ("CreatureController: received CM_setAppearanceFromObjectTemplate but owner or message was nullptr.")); + WARNING(true, ("CreatureController: received CM_setAppearanceFromObjectTemplate but owner or message was NULL.")); } break; @@ -873,9 +873,9 @@ void CreatureController::handleMessage (const int message, const float value, co if (msg) { ServerObject * defender = safe_cast(NetworkIdManager::getObjectById(msg->getDefender())); - if (defender != nullptr) + if (defender != NULL) { - if (defender->asCreatureObject() != nullptr) + if (defender->asCreatureObject() != NULL) { defender->asCreatureObject()->pushedMe(msg->getAttacker(), msg->getAttackerPos(), msg->getDefenderPos(), msg->getDistance()); } @@ -894,7 +894,7 @@ void CreatureController::handleMessage (const int message, const float value, co if (msg) { ServerObject * target = safe_cast(NetworkIdManager::getObjectById(msg->getTarget())); - if (target != nullptr && target->asTangibleObject() != nullptr) + if (target != NULL && target->asTangibleObject() != NULL) { if (owner->isAuthoritative()) owner->addSlowDownEffect(*(target->asTangibleObject()), msg->getConeLength(), msg->getConeAngle(), msg->getSlopeAngle(), msg->getExpireTime()); @@ -964,7 +964,7 @@ void CreatureController::handleMessage (const int message, const float value, co { MessageQueueCyberneticsChangeRequest const * const msg = safe_cast(data); NOT_NULL(msg); - if (msg != nullptr) + if (msg != NULL) { NetworkId const & playerId = msg->getTarget(); GameScriptObject * const scriptObject = owner->getScriptObject(); @@ -984,10 +984,10 @@ void CreatureController::handleMessage (const int message, const float value, co case CM_setCurrentQuest: { MessageQueueGenericValueType const * const msg = safe_cast const *>(data); - if (msg != nullptr) + if (msg != NULL) { PlayerObject * player = PlayerCreatureController::getPlayerObject(owner); - if (player != nullptr) + if (player != NULL) { player->setCurrentQuest(msg->getValue()); } @@ -1003,7 +1003,7 @@ void CreatureController::handleMessage (const int message, const float value, co case CM_setRegenRate: { MessageQueueGenericValueType > const * const msg = safe_cast > const *>(data); - if (msg != nullptr) + if (msg != NULL) { owner->setRegenRate(static_cast(msg->getValue().first), msg->getValue().second); } @@ -1516,7 +1516,7 @@ void CreatureController::conclude() // combatants must be adjusted to reflect the server's idea of the post-alter end posture. // This information was not known at the time the message was constructed. MessageQueueCombatAction * combatMessage = safe_cast(data); - if (combatMessage != nullptr) + if (combatMessage != NULL) { //-- Fix up end postures in messages. @@ -1527,7 +1527,7 @@ void CreatureController::conclude() combatMessage->getAttacker()); const CreatureObject * attacker = dynamic_cast( NetworkIdManager::getObjectById(attackerData.id)); - attackerData.endPosture = (attacker != nullptr) ? attacker->getPosture() : static_cast(0); + attackerData.endPosture = (attacker != NULL) ? attacker->getPosture() : static_cast(0); // set the defenders' posture const MessageQueueCombatAction::DefenderDataVector & defenderData = @@ -1539,7 +1539,7 @@ void CreatureController::conclude() const_cast(*iter); const CreatureObject * defender = dynamic_cast( NetworkIdManager::getObjectById(defenderData.id)); - defenderData.endPosture = (defender != nullptr) ? defender->getPosture() : static_cast(0); + defenderData.endPosture = (defender != NULL) ? defender->getPosture() : static_cast(0); } } } @@ -1667,7 +1667,7 @@ void CreatureController::handleSecureTradeMessage(const MessageQueueSecureTrade )); } } - else if (recipient->getClient() == nullptr) + else if (recipient->getClient() == NULL) { // GameServer::getInstance().sendToPlanetServer( // GenericValueTypeMessage >( @@ -1862,7 +1862,7 @@ void CreatureController::setAppearanceFromObjectTemplate(std::string const &serv CreatureObject * owner = dynamic_cast(getOwner()); if (!owner) { - WARNING(true, ("setAppearanceFromObjectTemplate(): owner is nullptr or not a CreatureObject.")); + WARNING(true, ("setAppearanceFromObjectTemplate(): owner is NULL or not a CreatureObject.")); return; } @@ -2007,7 +2007,7 @@ void CreatureController::calculateWaterState(bool& isSwimming, bool &isBurning, if (ownerCreature->getState(States::RidingMount)) { CreatureObject const *const mountCreature = ownerCreature->getMountedCreature(); - CreatureController const *const mountCreatureController = mountCreature ? safe_cast(mountCreature->getController()) : nullptr; + CreatureController const *const mountCreatureController = mountCreature ? safe_cast(mountCreature->getController()) : NULL; if (mountCreatureController) { // Note: we do the real computation for the mount here because the rider gets @@ -2135,28 +2135,28 @@ CreatureController const * CreatureController::asCreatureController() const PlayerCreatureController * CreatureController::asPlayerCreatureController() { - return nullptr; + return NULL; } //---------------------------------------------------------------------- PlayerCreatureController const * CreatureController::asPlayerCreatureController() const { - return nullptr; + return NULL; } //---------------------------------------------------------------------- AICreatureController * CreatureController::asAiCreatureController() { - return nullptr; + return NULL; } //---------------------------------------------------------------------- AICreatureController const * CreatureController::asAiCreatureController() const { - return nullptr; + return NULL; } //----------------------------------------------------------------------- @@ -2170,23 +2170,23 @@ CreatureController * CreatureController::getCreatureController(NetworkId const & CreatureController * CreatureController::getCreatureController(Object * object) { - Controller * controller = (object != nullptr) ? object->getController() : nullptr; + Controller * controller = (object != NULL) ? object->getController() : NULL; - return (controller != nullptr) ? controller->asCreatureController() : nullptr; + return (controller != NULL) ? controller->asCreatureController() : NULL; } // ---------------------------------------------------------------------- CreatureController * CreatureController::asCreatureController(Controller * controller) { - return (controller != nullptr) ? controller->asCreatureController() : nullptr; + return (controller != NULL) ? controller->asCreatureController() : NULL; } // ---------------------------------------------------------------------- CreatureController const * CreatureController::asCreatureController(Controller const * controller) { - return (controller != nullptr) ? controller->asCreatureController() : nullptr; + return (controller != NULL) ? controller->asCreatureController() : NULL; } // ====================================================================== diff --git a/engine/server/library/serverGame/src/shared/controller/PlanetController.cpp b/engine/server/library/serverGame/src/shared/controller/PlanetController.cpp index 465bb3d5..97a826ba 100755 --- a/engine/server/library/serverGame/src/shared/controller/PlanetController.cpp +++ b/engine/server/library/serverGame/src/shared/controller/PlanetController.cpp @@ -61,7 +61,7 @@ void PlanetController::handleMessage (const int message, const float value, cons case CM_setWeather: { const MessageQueueGenericValueType >* const message = safe_cast >*> (data); - if (message != nullptr) + if (message != NULL) { owner->setWeather( message->getValue().first, @@ -280,7 +280,7 @@ void PlanetController::handleMessage (const int message, const float value, cons const std::map & data = message->getValue(); for (std::map::const_iterator iter = data.begin(); iter != data.end(); ++iter) - owner->adjustGcwImperialScore("CM_adjustGcwImperialScore", nullptr, iter->first, iter->second); + owner->adjustGcwImperialScore("CM_adjustGcwImperialScore", NULL, iter->first, iter->second); } } break; @@ -293,7 +293,7 @@ void PlanetController::handleMessage (const int message, const float value, cons const std::map & data = message->getValue(); for (std::map::const_iterator iter = data.begin(); iter != data.end(); ++iter) - owner->adjustGcwRebelScore("CM_adjustGcwRebelScore", nullptr, iter->first, iter->second); + owner->adjustGcwRebelScore("CM_adjustGcwRebelScore", NULL, iter->first, iter->second); } } break; diff --git a/engine/server/library/serverGame/src/shared/controller/PlayerCreatureController.cpp b/engine/server/library/serverGame/src/shared/controller/PlayerCreatureController.cpp index 1097566c..df4260bc 100755 --- a/engine/server/library/serverGame/src/shared/controller/PlayerCreatureController.cpp +++ b/engine/server/library/serverGame/src/shared/controller/PlayerCreatureController.cpp @@ -164,7 +164,7 @@ namespace PlayerCreatureControllerNamespace if(!mount) { - LOG("mounts-bug", ("PlayerCreatureControllerNamespace::isCreaturePassenger(): server id=[%d],object id=[%s] creature has state RidingMount but getMountedCreature() returns nullptr.", static_cast(GameServer::getInstance().getProcessId()), creature.getNetworkId().getValueString().c_str())); + LOG("mounts-bug", ("PlayerCreatureControllerNamespace::isCreaturePassenger(): server id=[%d],object id=[%s] creature has state RidingMount but getMountedCreature() returns NULL.", static_cast(GameServer::getInstance().getProcessId()), creature.getNetworkId().getValueString().c_str())); return false; } @@ -172,7 +172,7 @@ namespace PlayerCreatureControllerNamespace if(!primaryRider) { - LOG("mounts-bug", ("PlayerCreatureControllerNamespace::isCreaturePassenger(): server id=[%d],object id=[%s] creature has state RidingMount but mount->getPrimaryMountingRider() returns nullptr.", static_cast(GameServer::getInstance().getProcessId()), creature.getNetworkId().getValueString().c_str())); + LOG("mounts-bug", ("PlayerCreatureControllerNamespace::isCreaturePassenger(): server id=[%d],object id=[%s] creature has state RidingMount but mount->getPrimaryMountingRider() returns NULL.", static_cast(GameServer::getInstance().getProcessId()), creature.getNetworkId().getValueString().c_str())); return false; } @@ -411,7 +411,7 @@ void PlayerCreatureController::logMoveFailed(char const *reason) "movement", ( "move fail - object %s stationId %u - %s", - creature ? creature->getNetworkId().getValueString().c_str() : "", + creature ? creature->getNetworkId().getValueString().c_str() : "", stationId, reason)); } @@ -425,7 +425,7 @@ bool PlayerCreatureController::isLocationValid(Vector const &position_w, CellObj return false; TerrainObject const *const terrainObject = TerrainObject::getConstInstance(); - if (nullptr != terrainObject && (nullptr == cell || cell->getCellProperty()->isWorldCell())) + if (NULL != terrainObject && (NULL == cell || cell->getCellProperty()->isWorldCell())) { if (!terrainObject->isPassableForceChunkCreation(position_w)) return false; @@ -445,7 +445,7 @@ bool PlayerCreatureController::isLocationValid(Vector const &position_w, CellObj Sphere testSphere(position_w + localSphere.getCenter(), localSphere.getRadius()); - if (CollisionWorld::query(testSphere, nullptr)) + if (CollisionWorld::query(testSphere, NULL)) return false; } return true; @@ -464,7 +464,7 @@ bool PlayerCreatureController::checkValidMove(MoveSnapshot const &m, float const CreatureObject * const creature = NON_NULL(getCreature()); // update the velocity in the serverController - if (creature != nullptr) + if (creature != NULL) { Vector moveDistance = m.getPosition_w() - creature->getPosition_w(); moveDistance.y = 0.0f; @@ -495,8 +495,8 @@ bool PlayerCreatureController::checkValidMove(MoveSnapshot const &m, float const if (!m.isValid()) return handleInvalidMove("invalid destination"); - if (creature == nullptr) - return handleInvalidMove("creature is nullptr"); + if (creature == NULL) + return handleInvalidMove("creature is null"); if (!m.isAllowed(*creature)) return handleInvalidMove("not allowed in dest cell"); @@ -513,7 +513,7 @@ bool PlayerCreatureController::checkValidMove(MoveSnapshot const &m, float const PortalProperty const *destPortalProperty = destCell ? ContainerInterface::getContainedByObject(*destCell)->getPortalProperty() : 0; if (sourcePortalProperty != destPortalProperty) { - // Moving between pobs. This is only valid if one of these is nullptr, since pobs only connect to the world + // Moving between pobs. This is only valid if one of these is null, since pobs only connect to the world if (sourcePortalProperty && destPortalProperty) return handleInvalidMove("tried to move from one pob to another without passing through the world cell"); if (sourcePortalProperty && !sourcePortalProperty->hasPassablePortalToParentCell()) @@ -548,7 +548,7 @@ bool PlayerCreatureController::checkValidMove(MoveSnapshot const &m, float const Client * const client = creature->getClient(); if (!client) - return handleInvalidMove("Creature's client is nullptr"); + return handleInvalidMove("Creature's client is NULL"); uint32 const currentServerSyncStamp = client->getServerSyncStampLong(); @@ -741,7 +741,7 @@ bool PlayerCreatureController::checkValidMove(MoveSnapshot const &m, float const } - m_lastSpeedCheckFailureTime = ::time(nullptr); + m_lastSpeedCheckFailureTime = ::time(NULL); ++m_speedCheckConsecutiveFailureCount; // if this is the first validation failure "in a while", let it pass, because it may be a false positive @@ -1153,11 +1153,11 @@ void PlayerCreatureController::handleMessage (const int message, const float val NetworkId const & designerId = inMsg->getDesignerId(); NetworkId const & recipientId = inMsg->getRecipientId(); Object const * const designerObj = NetworkIdManager::getObjectById(designerId); - ServerObject const * const designerServer = designerObj ? designerObj->asServerObject() : nullptr; - CreatureObject const * const designer = designerServer ? designerServer->asCreatureObject() : nullptr; + ServerObject const * const designerServer = designerObj ? designerObj->asServerObject() : NULL; + CreatureObject const * const designer = designerServer ? designerServer->asCreatureObject() : NULL; Object * const recipientObj = NetworkIdManager::getObjectById(recipientId); - ServerObject * const recipientServer = recipientObj ? recipientObj->asServerObject() : nullptr; - CreatureObject * const recipient = recipientServer ? recipientServer->asCreatureObject() : nullptr; + ServerObject * const recipientServer = recipientObj ? recipientObj->asServerObject() : NULL; + CreatureObject * const recipient = recipientServer ? recipientServer->asCreatureObject() : NULL; if(designer && recipient) { //designer-sent message, either data to sync to the recipient, or committed data to check and apply @@ -1167,7 +1167,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val { //designer hasn't accepted yet, send change to the client so they can see it before agreeing Object * const recipientObject = NetworkIdManager::getObjectById(inMsg->getRecipientId()); - Controller * const recipientController = recipientObject ? recipientObject->getController() : nullptr; + Controller * const recipientController = recipientObject ? recipientObject->getController() : NULL; if(recipientController) { ImageDesignChangeMessage * outMsg = new ImageDesignChangeMessage(); @@ -1182,7 +1182,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val { //check and apply this data once the recipient also accepts Object * const recipientObject = NetworkIdManager::getObjectById(inMsg->getRecipientId()); - Controller * const recipientController = recipientObject ? recipientObject->getController() : nullptr; + Controller * const recipientController = recipientObject ? recipientObject->getController() : NULL; if(recipientController) { ImageDesignChangeMessage * outMsg = new ImageDesignChangeMessage(); @@ -1201,7 +1201,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val //recipient hasn't accepted yet, send the data to the designer to update the recipient-sent amount of money //designer hasn't accepted yet, send change to the client so they can see it before agreeing Object * const designerObject = NetworkIdManager::getObjectById(inMsg->getDesignerId()); - Controller * const designerController = designerObject ? designerObject->getController() : nullptr; + Controller * const designerController = designerObject ? designerObject->getController() : NULL; if(designerController) { ImageDesignChangeMessage * outMsg = new ImageDesignChangeMessage(); @@ -1232,8 +1232,8 @@ void PlayerCreatureController::handleMessage (const int message, const float val std::string const recipientSpeciesGender = CustomizationManager::getServerSpeciesGender(*recipient); CustomizationData * const customizationData = recipient->fetchCustomizationData(); ServerObject * const hair = recipient->getHair(); - TangibleObject * const tangibleHair = hair ? hair->asTangibleObject() : nullptr; - CustomizationData * customizationDataHair = nullptr; + TangibleObject * const tangibleHair = hair ? hair->asTangibleObject() : NULL; + CustomizationData * customizationDataHair = NULL; if(tangibleHair) customizationDataHair = tangibleHair->fetchCustomizationData(); if(customizationData) @@ -1285,7 +1285,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val { //if the recipient canceled the session, tell the designer Object const * const designerObject = NetworkIdManager::getObjectById(session.designerId); - ServerObject const * const designer = designerObject ? designerObject->asServerObject() : nullptr; + ServerObject const * const designer = designerObject ? designerObject->asServerObject() : NULL; if(designer && (owner->getNetworkId() != session.designerId)) Chat::sendSystemMessage(*designer, SharedStringIds::imagedesigner_canceled_by_recip, Unicode::emptyString); @@ -1304,11 +1304,11 @@ void PlayerCreatureController::handleMessage (const int message, const float val NetworkId const & bufferId = inMsg->getBufferId(); NetworkId const & recipientId = inMsg->getRecipientId(); Object const * const bufferObj = NetworkIdManager::getObjectById(bufferId); - ServerObject const * const bufferServer = bufferObj ? bufferObj->asServerObject() : nullptr; - CreatureObject const * const buffer = bufferServer ? bufferServer->asCreatureObject() : nullptr; + ServerObject const * const bufferServer = bufferObj ? bufferObj->asServerObject() : NULL; + CreatureObject const * const buffer = bufferServer ? bufferServer->asCreatureObject() : NULL; Object * const recipientObj = NetworkIdManager::getObjectById(recipientId); - ServerObject * const recipientServer = recipientObj ? recipientObj->asServerObject() : nullptr; - CreatureObject * const recipient = recipientServer ? recipientServer->asCreatureObject() : nullptr; + ServerObject * const recipientServer = recipientObj ? recipientObj->asServerObject() : NULL; + CreatureObject * const recipient = recipientServer ? recipientServer->asCreatureObject() : NULL; if(buffer && recipient) { //buffer-sent message, either data to sync to the recipient, or committed data to check and apply @@ -1318,7 +1318,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val { //buffer hasn't accepted yet, send change to the client so they can see it before agreeing Object * const recipientObject = NetworkIdManager::getObjectById(inMsg->getRecipientId()); - Controller * const recipientController = recipientObject ? recipientObject->getController() : nullptr; + Controller * const recipientController = recipientObject ? recipientObject->getController() : NULL; if(recipientController) { BuffBuilderChangeMessage * outMsg = new BuffBuilderChangeMessage(); @@ -1333,7 +1333,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val { //check and apply this data once the recipient also accepts Object * const recipientObject = NetworkIdManager::getObjectById(inMsg->getRecipientId()); - Controller * const recipientController = recipientObject ? recipientObject->getController() : nullptr; + Controller * const recipientController = recipientObject ? recipientObject->getController() : NULL; if(recipientController) { BuffBuilderChangeMessage * outMsg = new BuffBuilderChangeMessage(); @@ -1351,7 +1351,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val //recipient hasn't accepted yet, send the data to the buffer to update the recipient-sent amount of money //buffer hasn't accepted yet, send change to the client so they can see it before agreeing Object * const bufferObject = NetworkIdManager::getObjectById(inMsg->getBufferId()); - Controller * const bufferController = bufferObject ? bufferObject->getController() : nullptr; + Controller * const bufferController = bufferObject ? bufferObject->getController() : NULL; if(bufferController) { BuffBuilderChangeMessage * outMsg = new BuffBuilderChangeMessage(); @@ -1425,7 +1425,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val { //if the recipient canceled the session, tell the designer Object const * const bufferObject = NetworkIdManager::getObjectById(session.bufferId); - ServerObject const * const buffer = bufferObject ? bufferObject->asServerObject() : nullptr; + ServerObject const * const buffer = bufferObject ? bufferObject->asServerObject() : NULL; if(buffer && (owner->getNetworkId() != session.bufferId)) { @@ -1447,7 +1447,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val if(msg) { Object const * const terminalO = NetworkIdManager::getObjectById(msg->getValue()); - ServerObject const * const terminal = terminalO ? terminalO->asServerObject() : nullptr; + ServerObject const * const terminal = terminalO ? terminalO->asServerObject() : NULL; if(terminal) { Client const * const client = owner->getClient(); @@ -1461,7 +1461,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val if(!client->isGod()) { Object const * const buildingO = ContainerInterface::getTopmostContainer(*terminal); - ServerObject const * const building = buildingO ? buildingO->asServerObject() : nullptr; + ServerObject const * const building = buildingO ? buildingO->asServerObject() : NULL; if(building) { DynamicVariableList const & buildingObjVars = building->getObjVars(); @@ -1478,13 +1478,13 @@ void PlayerCreatureController::handleMessage (const int message, const float val for(std::vector::const_iterator i = ships.begin(); i != ships.end(); ++i) { Object const * const shipO = NetworkIdManager::getObjectById(*i); - ServerObject const * const shipSO = shipO ? shipO->asServerObject() : nullptr; - ShipObject const * const ship = shipSO ? shipSO->asShipObject() : nullptr; + ServerObject const * const shipSO = shipO ? shipO->asServerObject() : NULL; + ShipObject const * const ship = shipSO ? shipSO->asShipObject() : NULL; if(ship) { ContainedByProperty const * const contained = ship->getContainedByProperty(); - Object const * const containerO = contained ? contained->getContainedBy() : nullptr; - ServerObject const * const container = containerO ? containerO->asServerObject() : nullptr; + Object const * const containerO = contained ? contained->getContainedBy() : NULL; + ServerObject const * const container = containerO ? containerO->asServerObject() : NULL; if(container) { DynamicVariableList const & shipControlDeviceObjVars = container->getObjVars(); @@ -1665,14 +1665,14 @@ void PlayerCreatureController::handleMessage (const int message, const float val { MessageQueueCyberneticsChangeRequest const * const msg = dynamic_cast(data); NOT_NULL(msg); - if (msg != nullptr) + if (msg != NULL) { CreatureObject * const owner = NON_NULL(getCreature()); if(owner) { NetworkId const & npcId = msg->getTarget(); Object * const o = NetworkIdManager::getObjectById(npcId); - ServerObject * const so = o ? o->asServerObject() : nullptr; + ServerObject * const so = o ? o->asServerObject() : NULL; if(so) { Controller * const npcController = so->getController(); @@ -1696,10 +1696,10 @@ void PlayerCreatureController::handleMessage (const int message, const float val case CM_spaceMiningSaleSellResource: { MessageQueueSpaceMiningSellResource const * const msg = dynamic_cast(data); - if (msg != nullptr) + if (msg != NULL) { ServerObject * const spaceStation = safe_cast(NetworkIdManager::getObjectById(msg->m_spaceStationId)); - if (nullptr == spaceStation) + if (NULL == spaceStation) { WARNING(true, ("PlayerCreatureController CM_spaceMiningSaleSellResource invalid station [%s]", msg->m_spaceStationId.getValueString().c_str())); } @@ -1784,7 +1784,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val DictionaryValueMap::const_iterator itr = valueMap.find(minigameResultTargetName); - if(itr != valueMap.end() && itr->second != nullptr) + if(itr != valueMap.end() && itr->second != NULL) { if(itr->second->getType() == ValueTypeObjId::ms_type) { @@ -1798,7 +1798,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != nullptr) + if (dictionary.get() != NULL) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(tableOid, @@ -1859,7 +1859,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val params.addParam(paramsDict, "taskDictionary"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != nullptr) + if (dictionary.get() != NULL) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(owner->getNetworkId(), diff --git a/engine/server/library/serverGame/src/shared/controller/PlayerShipController.cpp b/engine/server/library/serverGame/src/shared/controller/PlayerShipController.cpp index 921e3980..6350d91b 100755 --- a/engine/server/library/serverGame/src/shared/controller/PlayerShipController.cpp +++ b/engine/server/library/serverGame/src/shared/controller/PlayerShipController.cpp @@ -295,10 +295,10 @@ void PlayerShipController::handleMessage(int const message, float const value, M case CM_spaceMiningSaleSellResource: { MessageQueueSpaceMiningSellResource const * const msg = dynamic_cast(data); - if (msg != nullptr) + if (msg != NULL) { ServerObject * const spaceStation = safe_cast(NetworkIdManager::getObjectById(msg->m_spaceStationId)); - if (nullptr == spaceStation) + if (NULL == spaceStation) { WARNING(true, ("PlayerCreatureController CM_spaceMiningSaleSellResource invalid station [%s]", msg->m_spaceStationId.getValueString().c_str())); } @@ -376,16 +376,16 @@ float PlayerShipController::realAlter(float const elapsedTime) if (owner && owner->isInitialized()) { - if (m_pendingDockingBehavior != nullptr) + if (m_pendingDockingBehavior != NULL) { delete m_dockingBehavior; m_dockingBehavior = m_pendingDockingBehavior; - m_pendingDockingBehavior = nullptr; + m_pendingDockingBehavior = NULL; getShipOwner()->setCondition(static_cast(TangibleObject::C_docking)); Client * const client = owner->getClient(); - if (client != nullptr) + if (client != NULL) { ShipClientUpdateTracker::queueForUpdate(*client, *owner); } @@ -395,16 +395,16 @@ float PlayerShipController::realAlter(float const elapsedTime) } } - if ( (m_dockingBehavior != nullptr) + if ( (m_dockingBehavior != NULL) && m_dockingBehavior->isDockFinished()) { delete m_dockingBehavior; - m_dockingBehavior = nullptr; + m_dockingBehavior = NULL; getShipOwner()->clearCondition(static_cast(TangibleObject::C_docking)); } - if (m_dockingBehavior != nullptr) + if (m_dockingBehavior != NULL) { //-- The docking behavior will calculate new values for m_yaw/m_pitch/m_roll/m_throttle[Position] implicitly through calling ShipController members m_dockingBehavior->alter(elapsedTime); @@ -806,7 +806,7 @@ void PlayerShipController::setWeaponIndexPlayerControlled(int const weaponIndex, { DEBUG_FATAL((weaponIndex < 0), ("Invalid weaponIndex(%d)", weaponIndex)); - if (m_turretTargetingSystem != nullptr) + if (m_turretTargetingSystem != NULL) { safe_cast(m_turretTargetingSystem)->setWeaponIndexPlayerControlled(weaponIndex, playerControlled); } diff --git a/engine/server/library/serverGame/src/shared/controller/ServerController.cpp b/engine/server/library/serverGame/src/shared/controller/ServerController.cpp index 535341e6..bd5ffc3f 100755 --- a/engine/server/library/serverGame/src/shared/controller/ServerController.cpp +++ b/engine/server/library/serverGame/src/shared/controller/ServerController.cpp @@ -55,7 +55,7 @@ CellProperty const * getCell(Object const * obj) { - if(obj == nullptr) return nullptr; + if(obj == NULL) return NULL; return obj->getCellProperty(); } @@ -74,7 +74,7 @@ Vector movePointBetweenCells ( Object const * oldCellObject, Object const * new Transform toWorld = Transform::identity; Transform toCell = Transform::identity; - if(oldCellObject != nullptr) + if(oldCellObject != NULL) { CellProperty const * oldCell = getCell(oldCellObject); @@ -84,7 +84,7 @@ Vector movePointBetweenCells ( Object const * oldCellObject, Object const * new } } - if(newCellObject != nullptr) + if(newCellObject != NULL) { CellProperty const * newCell = getCell(newCellObject); @@ -115,7 +115,7 @@ Transform moveTransformBetweenCells ( Object const * oldCellObject, Object const Transform toWorld = Transform::identity; Transform toCell = Transform::identity; - if(oldCellObject != nullptr) + if(oldCellObject != NULL) { CellProperty const * oldCell = getCell(oldCellObject); @@ -125,7 +125,7 @@ Transform moveTransformBetweenCells ( Object const * oldCellObject, Object const } } - if(newCellObject != nullptr) + if(newCellObject != NULL) { CellProperty const * newCell = getCell(newCellObject); @@ -220,7 +220,7 @@ void ServerController::setAuthoritative(bool newAuthoritative) { if (!newAuthoritative && m_bHasGoal && m_goalCellObject) { - m_goalCellObject = nullptr; + m_goalCellObject = NULL; m_bHasGoal = false; m_bAtGoal = true; } @@ -420,7 +420,7 @@ bool changeCells(ServerObject &object, ServerObject *newCellObject) // ---------- - if (newCellObject == nullptr) + if (newCellObject == NULL) { // Object was in a cell and is moving to the world, transfer from cell container to world @@ -428,7 +428,7 @@ bool changeCells(ServerObject &object, ServerObject *newCellObject) Transform const &newTransform = oldCellObject->getTransform_o2w().rotateTranslate_l2p(objectTransform); Container::ContainerErrorCode tmp = Container::CEC_Success; - result = ContainerInterface::transferItemToWorld(object, newTransform, nullptr, tmp); + result = ContainerInterface::transferItemToWorld(object, newTransform, NULL, tmp); if (!result) { @@ -444,13 +444,13 @@ bool changeCells(ServerObject &object, ServerObject *newCellObject) CellProperty * const pCell = ContainerInterface::getCell(*newCellObject); - DEBUG_REPORT_LOG(pCell == nullptr, ("changeCells - Received transform with parent to a non-cell object. This should only happen from the DB\n")); + DEBUG_REPORT_LOG(pCell == NULL, ("changeCells - Received transform with parent to a non-cell object. This should only happen from the DB\n")); if (pCell) { Transform objectTransform = object.getTransform_o2p(); Container::ContainerErrorCode tmp = Container::CEC_Success; - result = ContainerInterface::transferItemToCell(*newCellObject, object, nullptr, tmp); + result = ContainerInterface::transferItemToCell(*newCellObject, object, NULL, tmp); if (!result) { @@ -537,7 +537,7 @@ void ServerController::handleNetUpdateTransform(const MessageQueueDataTransform& return; } - setGoal( message.getTransform(), nullptr ); + setGoal( message.getTransform(), NULL ); } //----------------------------------------------------------------------- @@ -566,7 +566,7 @@ void ServerController::handleNetUpdateTransformWithParent(const MessageQueueData #if 1 Transform start = Transform::identity; start.setPosition_p(ConfigServerGame::getStartingPosition()); - setGoal( start, nullptr ); + setGoal( start, NULL ); #endif return; } diff --git a/engine/server/library/serverGame/src/shared/controller/ShipController.cpp b/engine/server/library/serverGame/src/shared/controller/ShipController.cpp index 312131a9..3367476d 100755 --- a/engine/server/library/serverGame/src/shared/controller/ShipController.cpp +++ b/engine/server/library/serverGame/src/shared/controller/ShipController.cpp @@ -58,12 +58,12 @@ ShipController::ShipController(ShipObject * newOwner) : m_pitchPosition(0.0f), m_rollPosition(0.0f), m_throttlePosition(0.0f), - m_pendingDockingBehavior(nullptr), - m_dockingBehavior(nullptr), + m_pendingDockingBehavior(NULL), + m_dockingBehavior(NULL), m_attackTargetList(new AiShipAttackTargetList(newOwner)), m_attackTargetDecayTimer(new Timer(static_cast(s_maxTargetAge))), m_enemyCheckQueued(false), - m_turretTargetingSystem(nullptr), + m_turretTargetingSystem(NULL), m_dockedByList(new DockedByList), m_aiTargetingMeList(new CachedNetworkIdList) { @@ -77,7 +77,7 @@ ShipController::~ShipController() // The turret targeting system must be deleted before clearAiTargetingMeList(), because // otherwise it will try to acquire new targets as the list is being cleared delete m_turretTargetingSystem; - m_turretTargetingSystem = nullptr; + m_turretTargetingSystem = NULL; clearAiTargetingMeList(); @@ -85,9 +85,9 @@ ShipController::~ShipController() delete m_dockedByList; delete m_aiTargetingMeList; delete m_pendingDockingBehavior; - m_pendingDockingBehavior = nullptr; + m_pendingDockingBehavior = NULL; delete m_dockingBehavior; - m_dockingBehavior = nullptr; + m_dockingBehavior = NULL; delete m_attackTargetList; delete m_attackTargetDecayTimer; } @@ -226,7 +226,7 @@ void ShipController::handleMessage (const int message, const float value, const UNREF(flags); UNREF(value); ShipObject * const owner = getShipOwner(); - DEBUG_FATAL(!owner, ("Owner is nullptr in ShipController::handleMessage\n")); + DEBUG_FATAL(!owner, ("Owner is NULL in ShipController::handleMessage\n")); switch(message) { case CM_clientLookAtTarget: @@ -265,7 +265,7 @@ void ShipController::addTurretTargetingSystem(ShipTurretTargetingSystem * newSys void ShipController::removeTurretTargetingSystem() { delete m_turretTargetingSystem; - m_turretTargetingSystem = nullptr; + m_turretTargetingSystem = NULL; } // ---------------------------------------------------------------------- @@ -281,7 +281,7 @@ void ShipController::addDockedBy(Object const & unit) { IGNORE_RETURN(m_dockedByList->insert(CachedNetworkId(unit))); - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("ShipController::addDockedBy() owner(%s) dockedBy(%s) dockedByListSize(%u)", (getOwner() != nullptr) ? getOwner()->getNetworkId().getValueString().c_str() : "nullptr", unit.getNetworkId().getValueString().c_str(), m_dockedByList->size())); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("ShipController::addDockedBy() owner(%s) dockedBy(%s) dockedByListSize(%u)", (getOwner() != NULL) ? getOwner()->getNetworkId().getValueString().c_str() : "NULL", unit.getNetworkId().getValueString().c_str(), m_dockedByList->size())); } // ---------------------------------------------------------------------- @@ -294,7 +294,7 @@ void ShipController::removeDockedBy(Object const & unit) { m_dockedByList->erase(iterDockedByList); - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("ShipController::removeDockedBy() owner(%s) dockedBy(%s) dockedByListSize(%u)", (getOwner() != nullptr) ? getOwner()->getNetworkId().getValueString().c_str() : "nullptr", unit.getNetworkId().getValueString().c_str(), m_dockedByList->size())); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("ShipController::removeDockedBy() owner(%s) dockedBy(%s) dockedByListSize(%u)", (getOwner() != NULL) ? getOwner()->getNetworkId().getValueString().c_str() : "NULL", unit.getNetworkId().getValueString().c_str(), m_dockedByList->size())); } else { @@ -314,7 +314,7 @@ ShipController::DockedByList const & ShipController::getDockedByList() const void ShipController::addAiTargetingMe(NetworkId const & unit) { //LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("ShipController::addAiTargetingMe() owner(%s) unit(%s) m_aiTargetingMeList->size(%u+1)", getOwner()->getNetworkId().getValueString().c_str(), unit.getValueString().c_str(), m_aiTargetingMeList->size())); - DEBUG_FATAL((NetworkIdManager::getObjectById(unit) == nullptr), ("ShipController::addAiTargetingMe() owner(%s) unit(%s) ERROR: The Ai who is targeting you is not a valid networkId", getOwner()->getNetworkId().getValueString().c_str(), unit.getValueString().c_str())); + DEBUG_FATAL((NetworkIdManager::getObjectById(unit) == NULL), ("ShipController::addAiTargetingMe() owner(%s) unit(%s) ERROR: The Ai who is targeting you is not a valid networkId", getOwner()->getNetworkId().getValueString().c_str(), unit.getValueString().c_str())); // Make sure this is a valid networkId of an alive object @@ -346,11 +346,11 @@ void ShipController::removeAiTargetingMe(NetworkId const & unit) { ShipObject * const shipOwner = getShipOwner(); - if (shipOwner != nullptr) + if (shipOwner != NULL) { CreatureObject * const pilotOwner = CreatureObject::asCreatureObject(shipOwner->getPilot()); - if ( (pilotOwner != nullptr) + if ( (pilotOwner != NULL) && pilotOwner->isPlayerControlled()) { shipOwner->clearCondition(static_cast(TangibleObject::C_spaceCombatMusic)); @@ -442,7 +442,7 @@ bool ShipController::face(Vector const & goalPosition_w, float elapsedTime) bool useFastAxis = true; AiShipController const * const aiShipController = asAiShipController(); - if (aiShipController != nullptr) + if (aiShipController != NULL) { if ( (aiShipController->getShipClass() == ShipAiReactionManager::SC_capitalShip) || (aiShipController->getShipClass() == ShipAiReactionManager::SC_transport) @@ -620,7 +620,7 @@ float ShipController::getLargestTurnRadius() const ShipObject const * const shipObject = getShipOwner(); - if (shipObject != nullptr) + if (shipObject != NULL) { float const maxYawRate = shipObject->getShipActualYawRateMaximum(); float const maxPitchRate = shipObject->getShipActualPitchRateMaximum(); @@ -650,11 +650,11 @@ void ShipController::dock(ShipObject & dockTarget, float const secondsAtDock) void ShipController::unDock() { - if (m_pendingDockingBehavior != nullptr) + if (m_pendingDockingBehavior != NULL) { m_pendingDockingBehavior->unDock(); } - else if (m_dockingBehavior != nullptr) + else if (m_dockingBehavior != NULL) { m_dockingBehavior->unDock(); } @@ -664,14 +664,14 @@ void ShipController::unDock() bool ShipController::isDocking() const { - return (m_dockingBehavior != nullptr) || (m_pendingDockingBehavior != nullptr); + return (m_dockingBehavior != NULL) || (m_pendingDockingBehavior != NULL); } // ---------------------------------------------------------------------- bool ShipController::isDocked() const { - return ((m_dockingBehavior != nullptr) && m_dockingBehavior->isDocked()); + return ((m_dockingBehavior != NULL) && m_dockingBehavior->isDocked()); } // ---------------------------------------------------------------------- @@ -698,28 +698,28 @@ ShipController const * ShipController::asShipController() const PlayerShipController * ShipController::asPlayerShipController() { - return nullptr; + return NULL; } // ---------------------------------------------------------------------- PlayerShipController const * ShipController::asPlayerShipController() const { - return nullptr; + return NULL; } // ---------------------------------------------------------------------- AiShipController * ShipController::asAiShipController() { - return nullptr; + return NULL; } // ---------------------------------------------------------------------- AiShipController const * ShipController::asAiShipController() const { - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -736,7 +736,7 @@ bool ShipController::addDamageTaken(NetworkId const & attackingUnit, float const bool result = false; ShipObject * const attackingUnitShipObject = ShipObject::asShipObject(NetworkIdManager::getObjectById(attackingUnit)); - if ( (attackingUnitShipObject != nullptr) + if ( (attackingUnitShipObject != NULL) && !attackingUnitShipObject->isDamageAggroImmune()) { result = verifyAttacker ? Pvp::canAttack(*attackingUnitShipObject, *NON_NULL(getShipOwner())) : true; @@ -754,7 +754,7 @@ bool ShipController::addDamageTaken(NetworkId const & attackingUnit, float const bool ShipController::hasTurretTargetingSystem() const { - return (m_turretTargetingSystem != nullptr); + return (m_turretTargetingSystem != NULL); } // ---------------------------------------------------------------------- @@ -792,7 +792,7 @@ bool ShipController::removeAttackTarget(NetworkId const & unit) void ShipController::onAttackTargetChanged(NetworkId const & target) { - if (m_turretTargetingSystem != nullptr) + if (m_turretTargetingSystem != NULL) { m_turretTargetingSystem->onTargetChanged(target); } @@ -802,7 +802,7 @@ void ShipController::onAttackTargetChanged(NetworkId const & target) void ShipController::onAttackTargetLost(NetworkId const & target) { - if (m_turretTargetingSystem != nullptr) + if (m_turretTargetingSystem != NULL) { m_turretTargetingSystem->onTargetLost(target); } @@ -834,12 +834,12 @@ int ShipController::getNumberOfAiUnitsAttackingMe() const CachedNetworkId const & ai = (*iterAiTargetingMeList); Object const * const aiObject = ai.getObject(); - if (aiObject != nullptr) + if (aiObject != NULL) { ShipController const * const shipController = aiObject->getController()->asShipController(); - AiShipController const * const aiShipController = (shipController != nullptr) ? shipController->asAiShipController() : nullptr; + AiShipController const * const aiShipController = (shipController != NULL) ? shipController->asAiShipController() : NULL; - if (aiShipController != nullptr) + if (aiShipController != NULL) { if (aiShipController->getPrimaryAttackTarget() == getOwner()->getNetworkId()) { @@ -849,7 +849,7 @@ int ShipController::getNumberOfAiUnitsAttackingMe() const } else { - DEBUG_WARNING(true, ("ShipController::getNumberOfAiShipAttackingMe() ERROR: Why am I(%s) being targeted by a nullptr object(%s)?", getOwner()->getDebugInformation().c_str(), ai.getValueString().c_str())); + DEBUG_WARNING(true, ("ShipController::getNumberOfAiShipAttackingMe() ERROR: Why am I(%s) being targeted by a NULL object(%s)?", getOwner()->getDebugInformation().c_str(), ai.getValueString().c_str())); } } @@ -910,11 +910,11 @@ void ShipController::clearAiTargetingMeList() { CachedNetworkId const & id = (*iterPurgeList); - if (id.getObject() != nullptr) + if (id.getObject() != NULL) { ShipController * const shipController = id.getObject()->getController()->asShipController(); - if (shipController != nullptr) + if (shipController != NULL) { IGNORE_RETURN(shipController->removeAttackTarget(getOwner()->getNetworkId())); } diff --git a/engine/server/library/serverGame/src/shared/controller/TangibleController.cpp b/engine/server/library/serverGame/src/shared/controller/TangibleController.cpp index ee670607..d4e90806 100755 --- a/engine/server/library/serverGame/src/shared/controller/TangibleController.cpp +++ b/engine/server/library/serverGame/src/shared/controller/TangibleController.cpp @@ -222,7 +222,7 @@ void TangibleController::handleMessage (const int message, const float value, co case CM_addHate: { const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); - WARNING((msg == nullptr), ("TangibleController::handleMessage(CM_addHate) The message data should never be nullptr")); + WARNING((msg == NULL), ("TangibleController::handleMessage(CM_addHate) The message data should never be NULL")); if(msg) { @@ -233,7 +233,7 @@ void TangibleController::handleMessage (const int message, const float value, co case CM_setHate: { const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); - WARNING((msg == nullptr), ("TangibleController::handleMessage(CM_setHate) The message data should never be nullptr")); + WARNING((msg == NULL), ("TangibleController::handleMessage(CM_setHate) The message data should never be NULL")); if(msg) { @@ -244,7 +244,7 @@ void TangibleController::handleMessage (const int message, const float value, co case CM_removeHateTarget: { const MessageQueueGenericValueType * const msg = safe_cast *>(data); - WARNING((msg == nullptr), ("TangibleController::handleMessage(CM_removeHateTarget) The message data should never be nullptr")); + WARNING((msg == NULL), ("TangibleController::handleMessage(CM_removeHateTarget) The message data should never be NULL")); if(msg) { @@ -265,7 +265,7 @@ void TangibleController::handleMessage (const int message, const float value, co case CM_forceHateTarget: { const MessageQueueGenericValueType * const msg = safe_cast *>(data); - WARNING((msg == nullptr), ("TangibleController::handleMessage(CM_removeHateTarget) The message data should never be nullptr")); + WARNING((msg == NULL), ("TangibleController::handleMessage(CM_removeHateTarget) The message data should never be NULL")); if(msg) { @@ -276,9 +276,9 @@ void TangibleController::handleMessage (const int message, const float value, co case CM_autoExpireHateListTargetEnabled: { const MessageQueueGenericValueType * const msg = safe_cast *>(data); - WARNING((msg == nullptr), ("TangibleController::handleMessage(CM_setHateListExpireTargetEnabled) The message data should never be nullptr")); + WARNING((msg == NULL), ("TangibleController::handleMessage(CM_setHateListExpireTargetEnabled) The message data should never be NULL")); - if (msg != nullptr) + if (msg != NULL) { owner->setHateListAutoExpireTargetEnabled(msg->getValue()); } @@ -315,7 +315,7 @@ void TangibleController::handleMessage (const int message, const float value, co if(object) { ServerObject * transferer = safe_cast(NetworkIdManager::getObjectById(msg->getValue().second)); - // transferer is allowed to be nullptr + // transferer is allowed to be null owner->addObjectToOutputSlot(*object, transferer); } } @@ -576,7 +576,7 @@ void TangibleController::handleMessage (const int message, const float value, co case CM_addUserToAccessList: { MessageQueueGenericValueType > const *msg = safe_cast > const *>(data); - WARNING((msg == nullptr), ("TangibleController::handleMessage(CM_addUserToAccessList) The message data should never be nullptr")); + WARNING((msg == NULL), ("TangibleController::handleMessage(CM_addUserToAccessList) The message data should never be NULL")); if(msg) { @@ -590,7 +590,7 @@ void TangibleController::handleMessage (const int message, const float value, co case CM_removeUserFromAccessList: { MessageQueueGenericValueType > const *msg = safe_cast > const *>(data); - WARNING((msg == nullptr), ("TangibleController::handleMessage(CM_removeUserFromAccessList) The message data should never be nullptr")); + WARNING((msg == NULL), ("TangibleController::handleMessage(CM_removeUserFromAccessList) The message data should never be NULL")); if(msg) { @@ -722,14 +722,14 @@ TangibleController const * TangibleController::asTangibleController() const AiTurretController * TangibleController::asAiTurretController() { - return nullptr; + return NULL; } //---------------------------------------------------------------------- AiTurretController const * TangibleController::asAiTurretController() const { - return nullptr; + return NULL; } //======================================================================== diff --git a/engine/server/library/serverGame/src/shared/core/AttribModNameManager.cpp b/engine/server/library/serverGame/src/shared/core/AttribModNameManager.cpp index f2104fad..8cf03ed4 100755 --- a/engine/server/library/serverGame/src/shared/core/AttribModNameManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/AttribModNameManager.cpp @@ -24,7 +24,7 @@ namespace AttribModNameManagerNamespace std::set unknownCrcs; } -AttribModNameManager * AttribModNameManager::ms_attribModNameManager = nullptr; +AttribModNameManager * AttribModNameManager::ms_attribModNameManager = NULL; //======================================================================== @@ -65,8 +65,8 @@ AttribModNameManager::~AttribModNameManager() { delete m_names; delete m_crcMap; - m_names = nullptr; - m_crcMap = nullptr; + m_names = NULL; + m_crcMap = NULL; } // AttribModNameManager::~AttribModNameManager // ---------------------------------------------------------------------- @@ -76,7 +76,7 @@ AttribModNameManager::~AttribModNameManager() */ void AttribModNameManager::install() { - if (ms_attribModNameManager == nullptr) + if (ms_attribModNameManager == NULL) { ms_attribModNameManager = new AttribModNameManager; ExitChain::add(AttribModNameManager::remove, "AttribModNameManager::remove"); @@ -90,10 +90,10 @@ void AttribModNameManager::install() */ void AttribModNameManager::remove() { - if (ms_attribModNameManager != nullptr) + if (ms_attribModNameManager != NULL) { delete ms_attribModNameManager; - ms_attribModNameManager = nullptr; + ms_attribModNameManager = NULL; } } // AttribModNameManager::remove @@ -263,7 +263,7 @@ void AttribModNameManager::sendAllNamesToServer(std::vector const & serv * * @param crc the crc value to look up * - * @return the attrib mod name, or nullptr if there was no name for the crc + * @return the attrib mod name, or NULL if there was no name for the crc */ const char * AttribModNameManager::getAttribModName(uint32 crc) const { @@ -277,7 +277,7 @@ const char * AttribModNameManager::getAttribModName(uint32 crc) const ServerClock::getInstance().getServerFrame())); AttribModNameManagerNamespace::unknownCrcs.insert(crc); } - return nullptr; + return NULL; } // AttribModNameManager::getAttribModName // ---------------------------------------------------------------------- @@ -350,7 +350,7 @@ void AttribModNameManager::getAttribModNamesFromBase(uint32 base, std::vector & names) const { const char * baseName = getAttribModName(base); - if (baseName != nullptr) + if (baseName != NULL) getAttribModNamesFromBase(baseName, names); } // AttribModNameManager::getAttribModNamesFromBase @@ -366,7 +366,7 @@ void AttribModNameManager::getAttribModCrcsFromBase(uint32 base, std::vector & crcs) const { const char * baseName = getAttribModName(base); - if (baseName != nullptr) + if (baseName != NULL) getAttribModCrcsFromBase(baseName, crcs); } // AttribModNameManager::getAttribModCrcsFromBase diff --git a/engine/server/library/serverGame/src/shared/core/BiographyManager.cpp b/engine/server/library/serverGame/src/shared/core/BiographyManager.cpp index 6996f5fc..6febe92c 100755 --- a/engine/server/library/serverGame/src/shared/core/BiographyManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/BiographyManager.cpp @@ -133,7 +133,7 @@ void BiographyManager::deleteBiography(const NetworkId &owner) DEBUG_FATAL(!m_installed, ("BioManager not installed")); - BiographyMessage const msg(owner,nullptr); + BiographyMessage const msg(owner,NULL); GameServer::getInstance().sendToDatabaseServer(msg); // Save off the bio for viewing by other players diff --git a/engine/server/library/serverGame/src/shared/core/CharacterMatchManager.cpp b/engine/server/library/serverGame/src/shared/core/CharacterMatchManager.cpp index 89668966..ce305b38 100755 --- a/engine/server/library/serverGame/src/shared/core/CharacterMatchManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/CharacterMatchManager.cpp @@ -55,7 +55,7 @@ namespace CharacterMatchManagerNamespace // used when invoking LfgDataTable::LfgNode::internalAttributeMatchFunction struct LfgInternalAttributeMatchFunctionParams { - LfgInternalAttributeMatchFunctionParams() : param1(nullptr), param2(nullptr), param3(nullptr), param4(nullptr), param5(nullptr) {} + LfgInternalAttributeMatchFunctionParams() : param1(NULL), param2(NULL), param3(NULL), param4(NULL), param5(NULL) {} void const * param1; void const * param2; @@ -151,8 +151,8 @@ bool CharacterMatchManagerNamespace::isMatch(std::map(NetworkIdManager::getObjectById(networkId)); - Client * const requestClient = (requestServerObject ? requestServerObject->getClient() : nullptr); - CreatureObject * const requestCreatureObject = (requestServerObject ? requestServerObject->asCreatureObject() : nullptr); - PlayerObject * const requestPlayerObject = (requestCreatureObject ? PlayerCreatureController::getPlayerObject(requestCreatureObject) : nullptr); + Client * const requestClient = (requestServerObject ? requestServerObject->getClient() : NULL); + CreatureObject * const requestCreatureObject = (requestServerObject ? requestServerObject->asCreatureObject() : NULL); + PlayerObject * const requestPlayerObject = (requestCreatureObject ? PlayerCreatureController::getPlayerObject(requestCreatureObject) : NULL); if (requestCreatureObject && requestPlayerObject && requestClient) { @@ -210,10 +210,10 @@ void CharacterMatchManager::requestMatch(NetworkId const &networkId, MatchMaking } // if "friend" is one of the search criteria, this will contain the requester's friends list - PlayerObject::StringVector const * requestPlayerObjectSortedLowercaseFriendList = nullptr; + PlayerObject::StringVector const * requestPlayerObjectSortedLowercaseFriendList = NULL; // if "cts_source_galaxy" is one of the search criteria, this will contain the requester's CTS source galaxy list - std::set const * requestPlayerObjectCtsSourceGalaxy = nullptr; + std::set const * requestPlayerObjectCtsSourceGalaxy = NULL; // if "in_same_guild" is one of the search criteria, this will contain the requester's guild abbrev bool inSameGuildSearch = false; @@ -224,7 +224,7 @@ void CharacterMatchManager::requestMatch(NetworkId const &networkId, MatchMaking std::string requestPlayerObjectCitizenOfCity; // if "cts_source_galaxy" is one of the search criteria, this will contain the list of matching CTS source galaxy - std::vector * matchingCtsSourceGalaxy = nullptr; + std::vector * matchingCtsSourceGalaxy = NULL; // allows search of characters marked anonymous bool bypassAnonymous = false; @@ -271,7 +271,7 @@ void CharacterMatchManager::requestMatch(NetworkId const &networkId, MatchMaking // special handling for "friend" search attribute if (iterLeafNode->second->name == "friend") { - if (requestPlayerObjectSortedLowercaseFriendList == nullptr) + if (requestPlayerObjectSortedLowercaseFriendList == NULL) { requestPlayerObjectSortedLowercaseFriendList = &(requestPlayerObject->getSortedLowercaseFriendList()); } @@ -284,7 +284,7 @@ void CharacterMatchManager::requestMatch(NetworkId const &networkId, MatchMaking // special handling for "cts_source_galaxy" search attribute else if (iterLeafNode->second->name == "cts_source_galaxy") { - if (requestPlayerObjectCtsSourceGalaxy == nullptr) + if (requestPlayerObjectCtsSourceGalaxy == NULL) { std::map const & connectedCharacterLfgData = ServerUniverse::getConnectedCharacterLfgData(); std::map::const_iterator iterFindLfg = connectedCharacterLfgData.find(networkId); @@ -292,7 +292,7 @@ void CharacterMatchManager::requestMatch(NetworkId const &networkId, MatchMaking requestPlayerObjectCtsSourceGalaxy = &(iterFindLfg->second.ctsSourceGalaxy); } - if (matchingCtsSourceGalaxy == nullptr) + if (matchingCtsSourceGalaxy == NULL) matchingCtsSourceGalaxy = new std::vector; LfgInternalAttributeMatchFunctionParams params; @@ -421,7 +421,7 @@ void CharacterMatchManager::requestMatch(NetworkId const &networkId, MatchMaking } else { - ConsoleMgr::broadcastString("(nullptr) (All)", requestClient); + ConsoleMgr::broadcastString("(NULL) (All)", requestClient); } for (std::vector >::const_iterator iterSearchAttribute = iterAnyAllParentNode->second.begin(); iterSearchAttribute != iterAnyAllParentNode->second.end(); ++iterSearchAttribute) @@ -544,7 +544,7 @@ void CharacterMatchManager::requestMatch(NetworkId const &networkId, MatchMaking if (lfgCharacterData.groupId.isValid() && (mmcr.m_matchingCharacterGroup.count(lfgCharacterData.groupId) == 0)) { ServerObject const * const soGroupObject = safe_cast(NetworkIdManager::getObjectById(lfgCharacterData.groupId)); - GroupObject const * const groupObject = (soGroupObject ? soGroupObject->asGroupObject() : nullptr); + GroupObject const * const groupObject = (soGroupObject ? soGroupObject->asGroupObject() : NULL); if (groupObject) { std::vector & groupInfo = mmcr.m_matchingCharacterGroup[lfgCharacterData.groupId]; diff --git a/engine/server/library/serverGame/src/shared/core/Client.cpp b/engine/server/library/serverGame/src/shared/core/Client.cpp index cdef65db..ab4e4e97 100755 --- a/engine/server/library/serverGame/src/shared/core/Client.cpp +++ b/engine/server/library/serverGame/src/shared/core/Client.cpp @@ -263,8 +263,8 @@ Client::Client(ConnectionServerConnection & connection, const NetworkId & charac { // Don't ever put the character into a packed house ServerObject * const serverObject = containerObject->asServerObject(); - CellObject * const cellObject = (serverObject ? serverObject->asCellObject() : nullptr); - BuildingObject * const buildingObject = (cellObject ? cellObject->getOwnerBuilding() : nullptr); + CellObject * const cellObject = (serverObject ? serverObject->asCellObject() : NULL); + BuildingObject * const buildingObject = (cellObject ? cellObject->getOwnerBuilding() : NULL); if ((buildingObject) && (!buildingObject->isInWorld())) { @@ -713,8 +713,8 @@ void Client::receiveClientMessage(const GameNetworkMessage & message) SlottedContainer const * const slottedContainer = ContainerInterface::getSlottedContainer(*containedBy); ShipObject * const shipObject = ShipObject::getContainingShipObject(containedBy); - if ( (shipObject != nullptr) - && (slottedContainer != nullptr) + if ( (shipObject != NULL) + && (slottedContainer != NULL) && !shipObject->hasCondition(TangibleObject::C_docking)) { bool shotOk = false; @@ -958,7 +958,7 @@ void Client::receiveClientMessage(const GameNetworkMessage & message) const ObjectMenuSelectMessage m (ri); ServerObject * const target = safe_cast(NetworkIdManager::getObjectById (m.getNetworkId())); GameScriptObject * const scriptObject = target ? target->getScriptObject() : 0; - Object * const targetContainedBy = target ? ContainerInterface::getContainedByObject(*target) : nullptr; + Object * const targetContainedBy = target ? ContainerInterface::getContainedByObject(*target) : NULL; const int menuType = m.getSelectedItemId(); static int examineMenuType = RadialMenuManager::getMenuTypeByName("EXAMINE"); @@ -1080,7 +1080,7 @@ void Client::receiveClientMessage(const GameNetworkMessage & message) { // apply the controller message ServerController * controller = dynamic_cast(target->getController()); - if (controller != nullptr) + if (controller != NULL) { uint32 flags = o.getFlags(); flags &= ~GameControllerMessageFlags::SOURCE_REMOTE; @@ -1096,7 +1096,7 @@ void Client::receiveClientMessage(const GameNetworkMessage & message) if (target) { ServerController * controller = dynamic_cast(target->getController()); - if (controller != nullptr) + if (controller != NULL) { uint32 flags = o.getFlags(); flags &= ~GameControllerMessageFlags::SOURCE_REMOTE; @@ -1315,11 +1315,11 @@ void Client::receiveClientMessage(const GameNetworkMessage & message) { CreatureObject *creatureObject = dynamic_cast(getCharacterObject()); - if (creatureObject != nullptr) + if (creatureObject != NULL) { GameScriptObject *gameScriptObject = creatureObject->getScriptObject(); - if(gameScriptObject != nullptr) + if(gameScriptObject != NULL) { ScriptParams scriptParams; IGNORE_RETURN(gameScriptObject->trigAllScripts(Scripting::TRIG_STOMACH_UPDATE, scriptParams)); @@ -1964,7 +1964,7 @@ void Client::receiveClientMessage(const GameNetworkMessage & message) GenericValueTypeMessage > > const msgPlayTimeInfo(readIterator); PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(safe_cast(getCharacterObject())); - if (playerObject != nullptr) + if (playerObject != NULL) { playerObject->setSessionPlayTimeInfo(msgPlayTimeInfo.getValue().first, msgPlayTimeInfo.getValue().second.first, msgPlayTimeInfo.getValue().second.second); } @@ -2222,7 +2222,7 @@ void Client::addObserving(ServerObject* o) { IGNORE_RETURN(m_observing.insert(o)); TangibleObject *to = o->asTangibleObject(); - if (to && PvpUpdateObserver::satisfyPvpSyncCondition(to->isNonPvpObject(), to->hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (o->asCreatureObject() != nullptr), to->getPvpFaction())) + if (to && PvpUpdateObserver::satisfyPvpSyncCondition(to->isNonPvpObject(), to->hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (o->asCreatureObject() != NULL), to->getPvpFaction())) addObservingPvpSync(to); } } diff --git a/engine/server/library/serverGame/src/shared/core/ClusterWideDataClient.cpp b/engine/server/library/serverGame/src/shared/core/ClusterWideDataClient.cpp index ddf92605..a0c10d82 100755 --- a/engine/server/library/serverGame/src/shared/core/ClusterWideDataClient.cpp +++ b/engine/server/library/serverGame/src/shared/core/ClusterWideDataClient.cpp @@ -115,7 +115,7 @@ bool ClusterWideDataClient::handleMessage(const MessageDispatch::Emitter &, cons // locate the callback object ClusterWideDataClientNamespace::CallbackObjectIdList::iterator iter = ClusterWideDataClientNamespace::callbackObjectIdList.find(msg.getRequestId()); - ServerObject * object = nullptr; + ServerObject * object = NULL; if (iter != ClusterWideDataClientNamespace::callbackObjectIdList.end()) object = dynamic_cast(NetworkIdManager::getObjectById(iter->second)); diff --git a/engine/server/library/serverGame/src/shared/core/CombatTracker.cpp b/engine/server/library/serverGame/src/shared/core/CombatTracker.cpp index ed0b1ffd..3c0882b9 100755 --- a/engine/server/library/serverGame/src/shared/core/CombatTracker.cpp +++ b/engine/server/library/serverGame/src/shared/core/CombatTracker.cpp @@ -45,7 +45,7 @@ void CombatTracker::getInterestedViewers(TangibleObject const *defender, std::ve AICreatureController const * const defenderAiCreatureController = AICreatureController::asAiCreatureController(defender->getController()); bool const defenderIsInWorldCell = defender->isInWorldCell(); - if (defenderAiCreatureController != nullptr) + if (defenderAiCreatureController != NULL) { ServerWorld::findObjectsInRange(defender->getPosition_w(), defenderAiCreatureController->getAssistRadius(), unfilteredViewers); @@ -54,7 +54,7 @@ void CombatTracker::getInterestedViewers(TangibleObject const *defender, std::ve bool interested = true; ServerObject const * const serverObject = *i; - if ( (serverObject == nullptr) + if ( (serverObject == NULL) || (serverObject == defender) || serverObject->isPlayerControlled() || !serverObject->wantSawAttackTriggers()) @@ -65,7 +65,7 @@ void CombatTracker::getInterestedViewers(TangibleObject const *defender, std::ve { TangibleObject const * const tangibleObject = serverObject->asTangibleObject(); - if (tangibleObject != nullptr) + if (tangibleObject != NULL) { if ( tangibleObject->isInCombat() || tangibleObject->isDisabled() @@ -77,7 +77,7 @@ void CombatTracker::getInterestedViewers(TangibleObject const *defender, std::ve { CreatureObject const * const creatureObject = tangibleObject->asCreatureObject(); - if (creatureObject != nullptr) + if (creatureObject != NULL) { if ( creatureObject->isIncapacitated() || creatureObject->isDead()) @@ -88,7 +88,7 @@ void CombatTracker::getInterestedViewers(TangibleObject const *defender, std::ve { AICreatureController const * const aiCreatureController = AICreatureController::asAiCreatureController(creatureObject->getController()); - if (aiCreatureController != nullptr) + if (aiCreatureController != NULL) { if (aiCreatureController->isRetreating()) { @@ -138,7 +138,7 @@ void CombatTracker::update() { TangibleObject const * const attackerTangibleObject = TangibleObject::asTangibleObject(iterAttackers->getObject()); - if (attackerTangibleObject != nullptr) + if (attackerTangibleObject != NULL) { localAttackers.push_back(attackerTangibleObject->getNetworkId()); } @@ -158,7 +158,7 @@ void CombatTracker::update() ServerObject * const combatViewer = *iterCombatViewers; GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(combatViewer); - if (gameScriptObject != nullptr) + if (gameScriptObject != NULL) { ScriptParams scriptParams; scriptParams.addParam(defender->getNetworkId()); diff --git a/engine/server/library/serverGame/src/shared/core/CommunityManager.cpp b/engine/server/library/serverGame/src/shared/core/CommunityManager.cpp index cc7f46e5..dc479216 100755 --- a/engine/server/library/serverGame/src/shared/core/CommunityManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/CommunityManager.cpp @@ -42,14 +42,14 @@ using namespace CommunityManagerNameSpace; //----------------------------------------------------------------------------- PlayerObject *CommunityManagerNameSpace::getPlayerObject(NetworkId const &networkId) { - PlayerObject *result = nullptr; + PlayerObject *result = NULL; Object *object = NetworkIdManager::getObjectById(networkId); - if (object != nullptr) + if (object != NULL) { CreatureObject *creatureObject = dynamic_cast(object); - if (creatureObject != nullptr) + if (creatureObject != NULL) { result = PlayerCreatureController::getPlayerObject(creatureObject); } @@ -61,10 +61,10 @@ PlayerObject *CommunityManagerNameSpace::getPlayerObject(NetworkId const &networ //----------------------------------------------------------------------------- ServerObject *CommunityManagerNameSpace::getServerObject(NetworkId const &networkId) { - ServerObject *result = nullptr; + ServerObject *result = NULL; Object *object = NetworkIdManager::getObjectById(networkId); - if (object != nullptr) + if (object != NULL) { result = dynamic_cast(object); } @@ -77,11 +77,11 @@ void CommunityManagerNameSpace::sendProseChatMessage(NetworkId const &networkId, { Object *object = NetworkIdManager::getObjectById(networkId); - if (object != nullptr) + if (object != NULL) { ServerObject *serverObject = dynamic_cast(object); - if (serverObject != nullptr) + if (serverObject != NULL) { ProsePackage prosePackage; prosePackage.stringId = stringId; @@ -117,7 +117,7 @@ void CommunityManager::handleMessage(ChatOnChangeFriendStatus const &message) PlayerObject *playerObject = getPlayerObject(message.getCharacter()); - if (playerObject != nullptr) + if (playerObject != NULL) { if (message.getAdd()) { @@ -170,7 +170,7 @@ void CommunityManager::handleMessage(ChatOnGetFriendsList const &message) PlayerObject *playerObject = getPlayerObject(message.getCharacter()); - if (playerObject != nullptr) + if (playerObject != NULL) { typedef std::vector StringVector; StringVector friendList; @@ -231,7 +231,7 @@ void CommunityManager::handleMessage(ChatOnChangeIgnoreStatus const &message) PlayerObject *playerObject = getPlayerObject(message.getCharacter()); - if (playerObject != nullptr) + if (playerObject != NULL) { if (message.getIgnore()) { @@ -284,7 +284,7 @@ void CommunityManager::handleMessage(ChatOnGetIgnoreList const &message) PlayerObject *playerObject = getPlayerObject(message.getCharacter()); - if (playerObject != nullptr) + if (playerObject != NULL) { typedef std::vector StringVector; StringVector ignoreList; diff --git a/engine/server/library/serverGame/src/shared/core/ConfigServerGame.cpp b/engine/server/library/serverGame/src/shared/core/ConfigServerGame.cpp index 03a9061f..cc5f64d9 100755 --- a/engine/server/library/serverGame/src/shared/core/ConfigServerGame.cpp +++ b/engine/server/library/serverGame/src/shared/core/ConfigServerGame.cpp @@ -528,10 +528,10 @@ void ConfigServerGame::install(void) // GCW score decay time(s) data->gcwScoreDecayTime.clear(); int index = 0; - char const * dayOfWeek = nullptr; - char const * hour = nullptr; - char const * minute = nullptr; - char const * second = nullptr; + char const * dayOfWeek = NULL; + char const * hour = NULL; + char const * minute = NULL; + char const * second = NULL; do { dayOfWeek = ConfigFile::getKeyString("GameServer", "gcwScoreDecayTimeDayOfWeek", index, 0); diff --git a/engine/server/library/serverGame/src/shared/core/ConfigServerGame.h b/engine/server/library/serverGame/src/shared/core/ConfigServerGame.h index 0426f519..20465d94 100755 --- a/engine/server/library/serverGame/src/shared/core/ConfigServerGame.h +++ b/engine/server/library/serverGame/src/shared/core/ConfigServerGame.h @@ -87,7 +87,7 @@ class ConfigServerGame int scriptWatcherInterruptTime; // time in ms (after scriptWatcherWarnTime) before we abort a script int scriptStackErrorLimit; // depth of stack error we assume to be a legit error int scriptStackErrorLevel; // how we handle a stack error: 0=recover, 1=javacore, 2=fatal - bool disableObjvarNullCheck; // flag to disable the check for a nullptr object when get/setting objvars + bool disableObjvarNullCheck; // flag to disable the check for a null object when get/setting objvars // throttle to limit how universe data is sent from // the universe game server to the other game servers; diff --git a/engine/server/library/serverGame/src/shared/core/ContainerInterface.cpp b/engine/server/library/serverGame/src/shared/core/ContainerInterface.cpp index fdd5c6f2..2fa62423 100755 --- a/engine/server/library/serverGame/src/shared/core/ContainerInterface.cpp +++ b/engine/server/library/serverGame/src/shared/core/ContainerInterface.cpp @@ -68,7 +68,7 @@ namespace ContainerInterfaceNamespace if (creature->getBank() == lastContainer) { - //-- if player is passed in non-nullptr, the found creature must match it + //-- if player is passed in non-null, the found creature must match it if (player && player != creature) return false; @@ -340,8 +340,8 @@ namespace ContainerInterfaceNamespace { // This item is not contained by anything! // This means it is in the world! - // Return nullptr for the source container, but succeed. - sourceContainer = nullptr; + // Return null for the source container, but succeed. + sourceContainer = NULL; return true; } @@ -550,7 +550,7 @@ bool ContainerInterface::canTransferTo(ServerObject *destination, ServerObject & if (transfererCreatureObject->getObjVars().getItem("lotOverlimit.structure_id", lotOverlimitStructure) && lotOverlimitStructure.isValid()) { // determine the destination type - ServerObject const * topmostDestinationParent = nullptr; + ServerObject const * topmostDestinationParent = NULL; ServerObject const * destinationParent = destination; while (destinationParent) { @@ -734,8 +734,8 @@ bool ContainerInterface::transferItemToSlottedContainer(ServerObject &destinatio } } - ServerObject *sourceObject = nullptr; - Container *sourceContainer = nullptr; + ServerObject *sourceObject = NULL; + Container *sourceContainer = NULL; if (!sharedTransferBegin(item, sourceObject, sourceContainer, error)) return false; @@ -829,8 +829,8 @@ bool ContainerInterface::transferItemToVolumeContainer(ServerObject &destination { error = Container::CEC_Success; - ServerObject *sourceObject = nullptr; - Container *sourceContainer = nullptr; + ServerObject *sourceObject = NULL; + Container *sourceContainer = NULL; if (!sharedTransferBegin(item, sourceObject, sourceContainer, error)) return false; @@ -898,8 +898,8 @@ bool ContainerInterface::transferItemToCell(ServerObject &destination, ServerObj { error = Container::CEC_Success; - ServerObject *sourceObject = nullptr; - Container *sourceContainer = nullptr; + ServerObject *sourceObject = NULL; + Container *sourceContainer = NULL; //check source & item if (!sharedTransferBegin(item, sourceObject, sourceContainer, error)) @@ -980,13 +980,13 @@ bool ContainerInterface::transferItemToWorld(ServerObject &item, Transform const return false; } - if (!canTransferTo(nullptr, item, transferer, error)) + if (!canTransferTo(NULL, item, transferer, error)) { return false; } - ServerObject *sourceObject = nullptr; - Container *sourceContainer = nullptr; + ServerObject *sourceObject = NULL; + Container *sourceContainer = NULL; if (!sharedTransferBegin(item, sourceObject, sourceContainer, error)) { @@ -1009,8 +1009,8 @@ bool ContainerInterface::transferItemToWorld(ServerObject &item, Transform const item.setTransform_o2p(pos); - item.onContainerTransferComplete(sourceObject, nullptr); - handleTransferScripts(item, sourceObject, nullptr, transferer, error); + item.onContainerTransferComplete(sourceObject, NULL); + handleTransferScripts(item, sourceObject, NULL, transferer, error); return true; } @@ -1084,7 +1084,7 @@ Object *ContainerInterface::getContainedByObject(Object &obj) ContainedByProperty * const containedBy = getContainedByProperty(obj); if (containedBy) return containedBy->getContainedBy(); - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -1094,7 +1094,7 @@ Object const *ContainerInterface::getContainedByObject(Object const &obj) ContainedByProperty const * const containedBy = getContainedByProperty(obj); if (containedBy) return containedBy->getContainedBy(); - return nullptr; + return NULL; } // ----------------------------------------------------------------------- @@ -1180,7 +1180,7 @@ Object const *ContainerInterface::getTopmostContainer(Object const &obj) // ----------------------------------------------------------------------- // Returns the object if it is in the world, or the first parent of the object -// that is in the world. This returns nullptr, if the none of the parents of the object are in the world. +// that is in the world. This returns null, if the none of the parents of the object are in the world. Object *ContainerInterface::getFirstParentInWorld(Object &obj) { @@ -1193,20 +1193,20 @@ Object *ContainerInterface::getFirstParentInWorld(Object &obj) if (!containedBy) { WARNING_STRICT_FATAL(true, ("All objects should have a containedby property")); - return nullptr; + return NULL; } // Is my containedBy property empty? If so I am topmost but am not in the world Object *currentContainer = containedBy->getContainedBy(); if (!currentContainer) { - return nullptr; + return NULL; } - // Does my parent expose contents? If it does, then return nullptr since I have been removed from the world. + // Does my parent expose contents? If it does, then return NULL since I have been removed from the world. if (!getContainer(*currentContainer) || getContainer(*currentContainer)->isContentItemExposedWith(*currentContainer)) { - return nullptr; + return NULL; } // Is my parent in the world? If so, he is topmost @@ -1218,7 +1218,7 @@ Object *ContainerInterface::getFirstParentInWorld(Object &obj) if (!containedBy) { WARNING_STRICT_FATAL(true, ("All objects should have a containedby property")); - return (currentContainer->isInWorld()) ? currentContainer : nullptr; + return (currentContainer->isInWorld()) ? currentContainer : NULL; } // Iterate from here. @@ -1236,12 +1236,12 @@ Object *ContainerInterface::getFirstParentInWorld(Object &obj) if (!containedBy) { WARNING_STRICT_FATAL(true, ("All objects should have a containedby property")); - return nullptr; + return NULL; } nextContainer = containedBy->getContainedBy(); } - return currentContainer->isInWorld() ? currentContainer : nullptr; + return currentContainer->isInWorld() ? currentContainer : NULL; } // ----------------------------------------------------------------------- @@ -1388,7 +1388,7 @@ bool ContainerInterface::onObjectDestroy(ServerObject& item) // currently only c return false; } - handleTransferScripts(item, parentObject, nullptr, nullptr, error); + handleTransferScripts(item, parentObject, NULL, NULL, error); } } return true; diff --git a/engine/server/library/serverGame/src/shared/core/FormManagerServer.cpp b/engine/server/library/serverGame/src/shared/core/FormManagerServer.cpp index 7fc312fa..5a1c4b15 100755 --- a/engine/server/library/serverGame/src/shared/core/FormManagerServer.cpp +++ b/engine/server/library/serverGame/src/shared/core/FormManagerServer.cpp @@ -101,7 +101,7 @@ void FormManagerServer::handleCreateObjectData(NetworkId const & actor, std::str Transform tr; tr.setPosition_p(position); ServerObject * const newObject = ServerWorld::createNewObject(crc, tr, cell, false); - if (newObject == nullptr) + if (newObject == NULL) return; if (cellId == NetworkId::cms_invalid) @@ -114,7 +114,7 @@ void FormManagerServer::handleCreateObjectData(NetworkId const & actor, std::str { //tell script to create the object in it's own special manner (since the datatable requests that) Object * const obj = NetworkIdManager::getObjectById(actor); - ServerObject * const serverObj = obj ? obj->asServerObject() : nullptr; + ServerObject * const serverObj = obj ? obj->asServerObject() : NULL; if(serverObj) { std::vector keys; @@ -151,11 +151,11 @@ void FormManagerServer::handleEditObjectData(NetworkId const & actor, NetworkId return; Object * const actorObj = NetworkIdManager::getObjectById(actor); - ServerObject * const actorServerObj = actorObj ? actorObj->asServerObject() : nullptr; + ServerObject * const actorServerObj = actorObj ? actorObj->asServerObject() : NULL; if(actorServerObj) { Object * const objectToEditObj = NetworkIdManager::getObjectById(objectToEdit); - ServerObject * const objectToEditServerObj = objectToEditObj ? objectToEditObj->asServerObject() : nullptr; + ServerObject * const objectToEditServerObj = objectToEditObj ? objectToEditObj->asServerObject() : NULL; if(objectToEditServerObj) { //get matching form @@ -207,11 +207,11 @@ void FormManagerServer::handleEditObjectData(NetworkId const & actor, NetworkId void FormManagerServer::requestEditObjectDataForClient(NetworkId const & actor, NetworkId const & objectToEdit) { Object * const actorObj = NetworkIdManager::getObjectById(actor); - ServerObject * const actorServerObj = actorObj ? actorObj->asServerObject() : nullptr; + ServerObject * const actorServerObj = actorObj ? actorObj->asServerObject() : NULL; if(actorServerObj) { Object * const objectToEditObj = NetworkIdManager::getObjectById(objectToEdit); - ServerObject * const objectToEditServerObj = objectToEditObj ? objectToEditObj->asServerObject() : nullptr; + ServerObject * const objectToEditServerObj = objectToEditObj ? objectToEditObj->asServerObject() : NULL; if(objectToEditServerObj) { //get matching form @@ -277,8 +277,8 @@ void FormManagerServer::sendEditObjectDataToClient(NetworkId const & client, Net return; Object * const playerObject = NetworkIdManager::getObjectById(client); - ServerObject * const playerServer = playerObject ? playerObject->asServerObject() : nullptr; - CreatureObject * const playerCreature = playerServer ? playerServer->asCreatureObject() : nullptr; + ServerObject * const playerServer = playerObject ? playerObject->asServerObject() : NULL; + CreatureObject * const playerCreature = playerServer ? playerServer->asCreatureObject() : NULL; if(playerCreature) { diff --git a/engine/server/library/serverGame/src/shared/core/GameServer.cpp b/engine/server/library/serverGame/src/shared/core/GameServer.cpp index 30af19ef..865b1078 100755 --- a/engine/server/library/serverGame/src/shared/core/GameServer.cpp +++ b/engine/server/library/serverGame/src/shared/core/GameServer.cpp @@ -317,11 +317,11 @@ namespace GameServerNamespace bool getConfigSetting(const char *section, const char *key, int & value) { const ConfigFile::Section * sec = ConfigFile::getSection(section); - if (sec == nullptr) + if (sec == NULL) return false; const ConfigFile::Key * ky = sec->findKey(key); - if (ky == nullptr) + if (ky == NULL) return false; value = ky->getAsInt(ky->getCount()-1, value); @@ -753,7 +753,7 @@ Client * GameServer::getClient(const NetworkId& networkId) { return i->second; } - return nullptr; + return NULL; } //----------------------------------------------------------------------- @@ -837,7 +837,7 @@ void GameServer::loadTerrain () terrainObject->setDebugName("terrain"); Appearance * const appearance = AppearanceTemplateList::createAppearance(terrainFileName); - if (appearance != nullptr) { + if (appearance != NULL) { terrainObject->setAppearance(appearance); } else { DEBUG_WARNING(true, ("FIX ME: Appearance template for GameServer::loadTerrain missing for %s.", terrainFileName)); @@ -866,7 +866,7 @@ void GameServer::shutdown() m_centralService = 0; m_planetServerConnection = 0; - if (m_customerServiceServerConnection != nullptr) + if (m_customerServiceServerConnection != NULL) { m_customerServiceServerConnection->disconnect(); } @@ -909,7 +909,7 @@ void GameServer::receiveMessage(const MessageDispatch::Emitter & source, const M DEBUG_REPORT_LOG(true, ("GameServer: Creating customer service server connection @ (%s:%d)\n", address.getValue().first.c_str(), address.getValue().second)); - if (m_customerServiceServerConnection != nullptr) + if (m_customerServiceServerConnection != NULL) { m_customerServiceServerConnection->disconnect(); } @@ -949,7 +949,7 @@ void GameServer::receiveMessage(const MessageDispatch::Emitter & source, const M std::vector const & baselines = m.getData(); - ServerObject * lastObject = nullptr; + ServerObject * lastObject = NULL; for (std::vector::const_iterator i=baselines.begin(); i!=baselines.end(); ++i) { @@ -1286,7 +1286,7 @@ void GameServer::receiveMessage(const MessageDispatch::Emitter & source, const M if (topmostContainer != object) { - WARNING(true, ("Denying authority transfer for (%s) from game server (%lu) to game server (%lu) because it is contained by (%s)", object->getDebugInformation().c_str(), GameServer::getInstance().getProcessId(), t.getProcess(), (topmostContainer ? topmostContainer->getDebugInformation().c_str() : "nullptr"))); + WARNING(true, ("Denying authority transfer for (%s) from game server (%lu) to game server (%lu) because it is contained by (%s)", object->getDebugInformation().c_str(), GameServer::getInstance().getProcessId(), t.getProcess(), (topmostContainer ? topmostContainer->getDebugInformation().c_str() : "NULL"))); allowed = false; @@ -1425,11 +1425,11 @@ void GameServer::receiveMessage(const MessageDispatch::Emitter & source, const M bool appended = false; ServerObject * const target = safe_cast(NetworkIdManager::getObjectById(c.getNetworkId())); - if (target != nullptr) + if (target != NULL) { // valid target, get its controller ServerController * const controller = safe_cast(target->getController()); - if (controller != nullptr) + if (controller != NULL) { uint32 flags = c.getFlags(); if(flags & GameControllerMessageFlags::DEST_AUTH_SERVER) @@ -1473,7 +1473,7 @@ void GameServer::receiveMessage(const MessageDispatch::Emitter & source, const M ri = static_cast(message).getByteStream().begin(); EndBaselinesMessage const t(ri); ServerObject * const object = ServerWorld::findUninitializedObjectByNetworkId(t.getId()); - if (object != nullptr) + if (object != NULL) { DEBUG_REPORT_LOG(ConfigServerGame::getLogObjectLoading(), ("Received EndBaselinesMessage for %s\n", t.getId().getValueString().c_str())); ServerController * const controller = dynamic_cast(object->getController()); @@ -1778,7 +1778,7 @@ void GameServer::receiveMessage(const MessageDispatch::Emitter & source, const M } else { - LOG("mounts-bug", ("GS::SceneTransferMessage: server id=[%d],rider id=[%s] has RidingMount state but getMountedCreature() returns nullptr.", static_cast(getProcessId()), obj->getNetworkId().getValueString().c_str())); + LOG("mounts-bug", ("GS::SceneTransferMessage: server id=[%d],rider id=[%s] has RidingMount state but getMountedCreature() returns NULL.", static_cast(getProcessId()), obj->getNetworkId().getValueString().c_str())); objAsCreature->emergencyDismountForRider(); } } @@ -2297,7 +2297,7 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const if (creatureObj->isAuthoritative()) { AICreatureController const * const aiCreatureController = AICreatureController::asAiCreatureController(creatureObj->getController()); - if (aiCreatureController == nullptr) + if (aiCreatureController == NULL) { continue; } @@ -2359,7 +2359,7 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const #endif std::string time = FormattedString<1024>().sprintf("(%3d,%5dms) %30s.%-2lu (%3lu) on %35s:%-7d (%lu) ", ObjectTracker::getNumPlayers(), static_cast(Clock::frameTime()*1000), ServerWorld::getSceneId().c_str(), m_preloadAreaId, m_processId, hostName.c_str(), Os::getProcessId(), ServerClock::getInstance().getGameTimeSeconds()); - time += CalendarTime::convertEpochToTimeStringGMT(::time(nullptr)); + time += CalendarTime::convertEpochToTimeStringGMT(::time(NULL)); GenericValueTypeMessage > > rsctr( "ReportSystemClockTimeResponse", std::make_pair(msg.getValue().first, std::make_pair(time, msg.getValue().second))); @@ -2378,7 +2378,7 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const ri = static_cast(message).getByteStream().begin(); GenericValueTypeMessage > const msg(ri); - time_t const timeNow = ::time(nullptr); + time_t const timeNow = ::time(NULL); std::string time = FormattedString<1024>().sprintf("%30s.%-2lu (%3lu) (%lu) (%ld, ", ServerWorld::getSceneId().c_str(), m_preloadAreaId, m_processId, ServerClock::getInstance().getGameTimeSeconds(), timeNow); time += CalendarTime::convertEpochToTimeStringGMT(timeNow); time += ")"; @@ -2404,7 +2404,7 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const } else { - time += " (terrainObject is nullptr)"; + time += " (terrainObject is NULL)"; } GenericValueTypeMessage > > rptr( @@ -2596,7 +2596,7 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const bool removeCurrentCitizenDeleted; bool removeCurrentCitizenInactive; bool hasDeclaredResidence; - int const timeNow = static_cast(::time(nullptr)); + int const timeNow = static_cast(::time(NULL)); bool const citizenInactivePackupActive = (ConfigServerGame::getCityCitizenshipInactivePackupStartTimeEpoch() <= timeNow); std::map, CitizenInfo> const & allCitizens = CityInterface::getAllCitizensInfo(); for (std::map >::iterator iterCityId = s_clusterStartupResidenceStructureListByCity.begin(); iterCityId != s_clusterStartupResidenceStructureListByCity.end(); ++iterCityId) @@ -2614,7 +2614,7 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const if (currentCityMayor.isValid()) currentCityMayorCitizenInfo = CityInterface::getCitizenInfo(iterCityId->first, currentCityMayor); else - currentCityMayorCitizenInfo = nullptr; + currentCityMayorCitizenInfo = NULL; if (currentCityMayorCitizenInfo) currentCityMayorName = currentCityMayorCitizenInfo->m_citizenName; @@ -2958,7 +2958,7 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const ScriptDictionaryPtr dictionary; responseObject->getScriptObject()->makeScriptDictionary(params, dictionary); - if (dictionary.get() != nullptr) + if (dictionary.get() != NULL) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(responseObject->getNetworkId(), "foundObject", dictionary->getSerializedData(), 0, false); @@ -3140,11 +3140,11 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const CreatureObject * const creatureObject = CreatureObject::getCreatureObject(networkId); - if (creatureObject != nullptr) + if (creatureObject != NULL) { Controller * const controller = creatureObject->getController(); - if (controller != nullptr) + if (controller != NULL) { DEBUG_LOG("debug_ai", ("GameServer::receiveMessage() Received AiCreatureStateMessage for networkId(%s) movementType(%s)", networkId.getValueString().c_str(), AiMovementBase::getMovementString(movement.getMovementType()))); @@ -3211,7 +3211,7 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); PlayedTimeAccumMessage const ptam(ri); Object * obj = NetworkIdManager::getObjectById(ptam.getNetworkId()); - if (obj != nullptr && obj->asServerObject() != nullptr && obj->asServerObject()->asCreatureObject() != nullptr) + if (obj != NULL && obj->asServerObject() != NULL && obj->asServerObject()->asCreatureObject() != NULL) { CreatureObject * target = obj->asServerObject()->asCreatureObject(); PlayerObject *targetPlayer = target->asPlayerObject(); @@ -3260,13 +3260,13 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const // get the attacker Object * obj = NetworkIdManager::getObjectById(msg.getSource()); - if (obj != nullptr && obj->asServerObject() != nullptr && obj->asServerObject()->asCreatureObject() != nullptr) + if (obj != NULL && obj->asServerObject() != NULL && obj->asServerObject()->asCreatureObject() != NULL) { CreatureObject * attacker = obj->asServerObject()->asCreatureObject(); // get the target obj = NetworkIdManager::getObjectById(msg.getTarget()); - if (obj != nullptr && obj->asServerObject() != nullptr && obj->asServerObject()->asTangibleObject() != nullptr) + if (obj != NULL && obj->asServerObject() != NULL && obj->asServerObject()->asTangibleObject() != NULL) { TangibleObject * defender = obj->asServerObject()->asTangibleObject(); if (attacker->isAuthoritative()) @@ -3597,7 +3597,7 @@ bool GameServer::isPlanetEnabledForCluster(std::string const &sceneName) const void GameServerNamespace::broadCastHyperspaceOnWarp(ServerObject const * const owner) { - // warpingClient can be nullptr if the owner is AI + // warpingClient can be NULL if the owner is AI Client const * const warpingClient = owner->getClient(); typedef std::map > DistributionList; @@ -4098,13 +4098,13 @@ void GameServer::sendToConnectionServers(GameNetworkMessage const &message) void GameServer::sendToCustomerServiceServer(GameNetworkMessage const &message) { - if (m_customerServiceServerConnection != nullptr) + if (m_customerServiceServerConnection != NULL) { m_customerServiceServerConnection->send(message, true); } else { - REPORT_LOG(true, ("GameServer::sendToCustomerServiceServer() ERROR: Unable to send to nullptr customer service server connection\n")); + REPORT_LOG(true, ("GameServer::sendToCustomerServiceServer() ERROR: Unable to send to NULL customer service server connection\n")); } } @@ -4112,12 +4112,12 @@ void GameServer::sendToCustomerServiceServer(GameNetworkMessage const &message) void GameServer::clearCustomerServiceServerConnection() { - if (m_customerServiceServerConnection != nullptr) + if (m_customerServiceServerConnection != NULL) { m_customerServiceServerConnection->disconnect(); } - m_customerServiceServerConnection = nullptr; + m_customerServiceServerConnection = NULL; } // ---------------------------------------------------------------------- @@ -4600,7 +4600,7 @@ void GameServer::handleCharacterCreateNameVerification(const VerifyNameResponse { Container::ContainedItem itemId = container->getObjectInSlot(slot, tmp); Object* appearanceInventory = itemId.getObject(); - if(appearanceInventory == nullptr) + if(appearanceInventory == NULL) { WARNING(true, ("Player %s has lost their appearance inventory", newCharacterObject->getNetworkId().getValueString().c_str())); appearanceInventory = ServerWorld::createNewObject(s_appearanceTemplate, *newCharacterObject, slot, false); @@ -4663,7 +4663,7 @@ void GameServer::handleVerifyAndLockNameVerification(const VerifyNameResponse &v params.addParam(errorText.c_str(), "reason"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != nullptr) + if (dictionary.get() != NULL) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(vrn.getCharacterId(), "renameCharacterNameValidationFail", dictionary->getSerializedData(), 0, false); @@ -4943,7 +4943,7 @@ bool GameServer::addPendingLoadRequest(NetworkId const & id) if (s_pendingLoadRequests.find(id) != s_pendingLoadRequests.end()) return false; - s_pendingLoadRequests[id] = (unsigned int)::time(nullptr); + s_pendingLoadRequests[id] = (unsigned int)::time(NULL); return true; } @@ -5113,11 +5113,11 @@ void GameServerNamespace::loadRetroactiveCtsHistory() { int index = 0; - char const * pszCtsDataFromConfig = nullptr; + char const * pszCtsDataFromConfig = NULL; do { - pszCtsDataFromConfig = ConfigFile::getKeyString("GameServer", "retroactiveCtsHistory", index++, nullptr); - if (pszCtsDataFromConfig != nullptr) + pszCtsDataFromConfig = ConfigFile::getKeyString("GameServer", "retroactiveCtsHistory", index++, NULL); + if (pszCtsDataFromConfig != NULL) { ctsDataFromConfig.push_back(pszCtsDataFromConfig); } @@ -5196,7 +5196,7 @@ void GameServerNamespace::loadRetroactiveCtsHistory() else { ctsDataFromConfigTokens.clear(); - if ((Unicode::tokenize(Unicode::narrowToWide(*iterCtsDataFromConfig), ctsDataFromConfigTokens, &ctsDataFromConfigDelimiter, nullptr)) && (ctsDataFromConfigTokens.size() == 7)) + if ((Unicode::tokenize(Unicode::narrowToWide(*iterCtsDataFromConfig), ctsDataFromConfigTokens, &ctsDataFromConfigDelimiter, NULL)) && (ctsDataFromConfigTokens.size() == 7)) { // sanity check ctsDataFromConfigParsedData = FormattedString<2048>().sprintf("%s|%s|%s|%s|%s|%s|%s", Unicode::wideToNarrow(ctsDataFromConfigTokens[0]).c_str(), Unicode::wideToNarrow(ctsDataFromConfigTokens[1]).c_str(), Unicode::wideToNarrow(ctsDataFromConfigTokens[2]).c_str(), Unicode::wideToNarrow(ctsDataFromConfigTokens[3]).c_str(), Unicode::wideToNarrow(ctsDataFromConfigTokens[4]).c_str(), Unicode::wideToNarrow(ctsDataFromConfigTokens[5]).c_str(), Unicode::wideToNarrow(ctsDataFromConfigTokens[6]).c_str()); @@ -5225,7 +5225,7 @@ void GameServerNamespace::loadRetroactiveCtsHistory() FATAL(((sourceCharacterInfo.sourceCharacterBornDate > 0) && (sourceCharacterInfo.sourceCharacterBornDate < 907)), ("source character (%s, %s) has born date (%d) < 907", sourceCharacterInfo.sourceCluster.c_str(), sourceCharacterInfo.sourceCharacterId.getValueString().c_str(), sourceCharacterInfo.sourceCharacterBornDate)); FATAL((sourceCharacterInfo.sourceCharacterBornDate > currentBornDate), ("source character (%s, %s) has born date (%d) > current born date (%d)", sourceCharacterInfo.sourceCluster.c_str(), sourceCharacterInfo.sourceCharacterId.getValueString().c_str(), sourceCharacterInfo.sourceCharacterBornDate, currentBornDate)); - std::map > * clusterCtsHistory = nullptr; + std::map > * clusterCtsHistory = NULL; #ifdef _DEBUG IGNORE_RETURN(allCtsSourceCluster.insert(sourceCharacterInfo.sourceCluster)); clusterCtsHistory = &(s_retroactiveCtsHistoryList[targetCluster]); @@ -5381,11 +5381,11 @@ void GameServerNamespace::loadRetroactivePlayerCityCreationTime() { int index = 0; - char const * pszPlayerCityCreationTimeDataFromConfig = nullptr; + char const * pszPlayerCityCreationTimeDataFromConfig = NULL; do { - pszPlayerCityCreationTimeDataFromConfig = ConfigFile::getKeyString("GameServer", "retroactivePlayerCityCreationTime", index++, nullptr); - if (pszPlayerCityCreationTimeDataFromConfig != nullptr) + pszPlayerCityCreationTimeDataFromConfig = ConfigFile::getKeyString("GameServer", "retroactivePlayerCityCreationTime", index++, NULL); + if (pszPlayerCityCreationTimeDataFromConfig != NULL) { playerCityCreationTimeDataFromConfig.push_back(pszPlayerCityCreationTimeDataFromConfig); } @@ -5427,7 +5427,7 @@ void GameServerNamespace::loadRetroactivePlayerCityCreationTime() else { playerCityCreationTimeDataFromConfigTokens.clear(); - if ((Unicode::tokenize(Unicode::narrowToWide(*iterPlayerCityCreationTimeDataFromConfig), playerCityCreationTimeDataFromConfigTokens, &playerCityCreationTimeDataFromConfigDelimiter, nullptr)) && (playerCityCreationTimeDataFromConfigTokens.size() == 3)) + if ((Unicode::tokenize(Unicode::narrowToWide(*iterPlayerCityCreationTimeDataFromConfig), playerCityCreationTimeDataFromConfigTokens, &playerCityCreationTimeDataFromConfigDelimiter, NULL)) && (playerCityCreationTimeDataFromConfigTokens.size() == 3)) { // sanity check playerCityCreationTimeDataFromConfigParsedData = FormattedString<2048>().sprintf("%s|%s|%s", Unicode::wideToNarrow(playerCityCreationTimeDataFromConfigTokens[0]).c_str(), Unicode::wideToNarrow(playerCityCreationTimeDataFromConfigTokens[1]).c_str(), Unicode::wideToNarrow(playerCityCreationTimeDataFromConfigTokens[2]).c_str()); @@ -5449,7 +5449,7 @@ void GameServerNamespace::loadRetroactivePlayerCityCreationTime() ++iterPlayerCityCreationTimeDataFromConfig; } - std::map * clusterPlayerCityCreationTimeHistory = nullptr; + std::map * clusterPlayerCityCreationTimeHistory = NULL; #ifdef _DEBUG clusterPlayerCityCreationTimeHistory = &(s_retroactivePlayerCityCreationTime[cluster]); #else @@ -5475,7 +5475,7 @@ void GameServerNamespace::loadRetroactivePlayerCityCreationTime() bool GameServerNamespace::checkAndSetOutstandingRequestSceneTransfer(ServerObject & object) { - int const timeNow = static_cast(::time(nullptr)); + int const timeNow = static_cast(::time(NULL)); // don't send multiple RequestSceneTransfer message if (object.getObjVars().hasItem(OBJVAR_HAS_OUTSTANDING_REQUEST_SCENE_TRANSFER) && (object.getObjVars().getType(OBJVAR_HAS_OUTSTANDING_REQUEST_SCENE_TRANSFER) == DynamicVariable::INT)) @@ -5846,7 +5846,7 @@ void GameServerNamespace::handleAccountFeatureIdResponse(AccountFeatureIdRespons std::string GameServer::getRetroactiveCtsHistory(std::string const & clusterName, NetworkId const & characterId) { std::string result; - std::map > const * clusterCtsHistory = nullptr; + std::map > const * clusterCtsHistory = NULL; #ifdef _DEBUG std::map > >::const_iterator const iterFindCluster = s_retroactiveCtsHistoryList.find(clusterName); @@ -5901,7 +5901,7 @@ void GameServer::setRetroactiveCtsHistory(CreatureObject & player) if (!playerObject->isAuthoritative()) return; - std::map > const * clusterCtsHistory = nullptr; + std::map > const * clusterCtsHistory = NULL; #ifdef _DEBUG std::map > >::const_iterator const iterFindCluster = s_retroactiveCtsHistoryList.find(GameServer::getInstance().getClusterName()); @@ -5990,7 +5990,7 @@ std::vector > const *> const static std::vector > const *> returnValue; returnValue.clear(); - std::map > const * clusterCtsHistory = nullptr; + std::map > const * clusterCtsHistory = NULL; #ifdef _DEBUG std::map > >::const_iterator const iterFindCluster = s_retroactiveCtsHistoryList.find(GameServer::getInstance().getClusterName()); @@ -6028,7 +6028,7 @@ std::vector > const *> const time_t GameServer::getRetroactivePlayerCityCreationTime(std::string const & clusterName, int cityId) { - std::map const * clusterPlayerCityCreationTimeHistory = nullptr; + std::map const * clusterPlayerCityCreationTimeHistory = NULL; #ifdef _DEBUG std::map >::const_iterator const iterFindCluster = s_retroactivePlayerCityCreationTime.find(clusterName); diff --git a/engine/server/library/serverGame/src/shared/core/GameServer.h b/engine/server/library/serverGame/src/shared/core/GameServer.h index 2723090a..c3036761 100755 --- a/engine/server/library/serverGame/src/shared/core/GameServer.h +++ b/engine/server/library/serverGame/src/shared/core/GameServer.h @@ -92,10 +92,10 @@ public: uint32 getProcessId () const; uint32 getPreloadAreaId () const; virtual void receiveMessage (const MessageDispatch::Emitter & source, const MessageDispatch::MessageBase & message); - bool requestSceneWarp (const CachedNetworkId &objectId, const std::string &sceneName, const Vector &newPosition_w, const NetworkId &newContainer, const Vector &newPosition_p, const char * scriptCallback = nullptr, bool forceLoadScreen = false); - bool requestSceneWarp (const CachedNetworkId &objectId, const std::string &sceneName, const Vector &newPosition_w, const NetworkId &newBuilding, const std::string &newCellName, const Vector &newPosition_p, const char * scriptCallback = nullptr, bool forceLoadScreen = false); - bool requestSceneWarpDelayed (const CachedNetworkId &objectId, const std::string &sceneName, const Vector &newPosition_w, const NetworkId &newContainer, const Vector &newPosition_p, float delayTime, const char * scriptCallback = nullptr, bool forceLoadScreen = false); - bool requestSceneWarpDelayed (const CachedNetworkId &objectId, const std::string &sceneName, const Vector &newPosition_w, const NetworkId &newBuilding, const std::string &newCellName, const Vector &newPosition_p, float delayTime, const char * scriptCallback = nullptr, bool forceLoadScreen = false); + bool requestSceneWarp (const CachedNetworkId &objectId, const std::string &sceneName, const Vector &newPosition_w, const NetworkId &newContainer, const Vector &newPosition_p, const char * scriptCallback = NULL, bool forceLoadScreen = false); + bool requestSceneWarp (const CachedNetworkId &objectId, const std::string &sceneName, const Vector &newPosition_w, const NetworkId &newBuilding, const std::string &newCellName, const Vector &newPosition_p, const char * scriptCallback = NULL, bool forceLoadScreen = false); + bool requestSceneWarpDelayed (const CachedNetworkId &objectId, const std::string &sceneName, const Vector &newPosition_w, const NetworkId &newContainer, const Vector &newPosition_p, float delayTime, const char * scriptCallback = NULL, bool forceLoadScreen = false); + bool requestSceneWarpDelayed (const CachedNetworkId &objectId, const std::string &sceneName, const Vector &newPosition_w, const NetworkId &newBuilding, const std::string &newCellName, const Vector &newPosition_p, float delayTime, const char * scriptCallback = NULL, bool forceLoadScreen = false); static void run (); void sendToCentralServer (GameNetworkMessage const &message); diff --git a/engine/server/library/serverGame/src/shared/core/InstantDeleteList.cpp b/engine/server/library/serverGame/src/shared/core/InstantDeleteList.cpp index 4e645492..a96e6cfa 100755 --- a/engine/server/library/serverGame/src/shared/core/InstantDeleteList.cpp +++ b/engine/server/library/serverGame/src/shared/core/InstantDeleteList.cpp @@ -20,7 +20,7 @@ // ====================================================================== -InstantDeleteList::ListType *InstantDeleteList::ms_theList = nullptr; +InstantDeleteList::ListType *InstantDeleteList::ms_theList = NULL; // ====================================================================== @@ -47,7 +47,7 @@ void InstantDeleteList::install() void InstantDeleteList::remove() { delete ms_theList; - ms_theList = nullptr; + ms_theList = NULL; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/core/LogoutTracker.cpp b/engine/server/library/serverGame/src/shared/core/LogoutTracker.cpp index 5d49ac3a..77454c88 100755 --- a/engine/server/library/serverGame/src/shared/core/LogoutTracker.cpp +++ b/engine/server/library/serverGame/src/shared/core/LogoutTracker.cpp @@ -87,7 +87,7 @@ void LogoutTracker::add(NetworkId const &networkId) } // set the callback - getScheduler().setCallback(handleLogoutCallback, nullptr, ConfigServerGame::getUnsafeLogoutTimeMs()); + getScheduler().setCallback(handleLogoutCallback, NULL, ConfigServerGame::getUnsafeLogoutTimeMs()); } // ---------------------------------------------------------------------- @@ -223,7 +223,7 @@ ServerObject *LogoutTracker::findPendingCharacterSave(const NetworkId &character return obj; } else - return nullptr; + return NULL; } // ====================================================================== diff --git a/engine/server/library/serverGame/src/shared/core/MessageToQueue.cpp b/engine/server/library/serverGame/src/shared/core/MessageToQueue.cpp index 847b6ff6..005a6260 100755 --- a/engine/server/library/serverGame/src/shared/core/MessageToQueue.cpp +++ b/engine/server/library/serverGame/src/shared/core/MessageToQueue.cpp @@ -88,7 +88,7 @@ namespace MessageToQueueNamespace typedef std::set SchedulerItemsType; typedef std::vector FrameMessagesType; - MessageToQueue * ms_instance=nullptr; + MessageToQueue * ms_instance=NULL; LastKnownLocationsType ms_lastKnownLocations; ObjectLocatorsType ms_objectLocators; SchedulerItemsType ms_schedulerItems; @@ -134,7 +134,7 @@ void MessageToQueue::install() void MessageToQueue::remove() { delete ms_instance; - ms_instance = nullptr; + ms_instance = NULL; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/core/NameManager.cpp b/engine/server/library/serverGame/src/shared/core/NameManager.cpp index 65453d39..6366130f 100755 --- a/engine/server/library/serverGame/src/shared/core/NameManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/NameManager.cpp @@ -27,7 +27,7 @@ // ====================================================================== -NameManager *NameManager::ms_instance = nullptr; +NameManager *NameManager::ms_instance = NULL; // ====================================================================== @@ -45,14 +45,14 @@ void NameManager::remove() { NOT_NULL(ms_instance); delete ms_instance; - ms_instance = nullptr; + ms_instance = NULL; } // ---------------------------------------------------------------------- NameManager::NameManager() : m_nameGenerators (new NameGeneratorMapType), - m_reservedNames (nullptr), + m_reservedNames (NULL), m_nameToIdMap (new NameToIdMapType), m_idToCharacterDataMap(new IdToCharacterDataMapType) { @@ -72,20 +72,20 @@ NameManager::~NameManager() delete i->second; } delete m_nameGenerators; - m_nameGenerators = nullptr; + m_nameGenerators = NULL; delete m_reservedNames; - m_reservedNames = nullptr; + m_reservedNames = NULL; delete m_nameToIdMap; - m_nameToIdMap = nullptr; + m_nameToIdMap = NULL; delete m_idToCharacterDataMap; - m_idToCharacterDataMap = nullptr; + m_idToCharacterDataMap = NULL; } // ---------------------------------------------------------------------- const NameGenerator & NameManager::getNameGenerator(const std::string &directory, const std::string &nameTable) const { - NameGenerator *generator=nullptr; + NameGenerator *generator=NULL; NOT_NULL(m_nameGenerators); NameGeneratorMapType::const_iterator i=m_nameGenerators->find(NameTableIdentifier(directory,nameTable)); if (i==m_nameGenerators->end()) @@ -204,7 +204,7 @@ void NameManager::addPlayer(const NetworkId &id, uint32 stationId, const std::st { createTime = static_cast(getPlayerCreateTime(id)); if (createTime <= 0) - createTime = ::time(nullptr); + createTime = ::time(NULL); } characterData.createTime = createTime; @@ -212,7 +212,7 @@ void NameManager::addPlayer(const NetworkId &id, uint32 stationId, const std::st { lastLoginTime = static_cast(getPlayerLastLoginTime(id)); if (lastLoginTime <= 0) - lastLoginTime = ::time(nullptr); + lastLoginTime = ::time(NULL); } characterData.lastLoginTime = lastLoginTime; @@ -382,7 +382,7 @@ void NameManager::getPlayerWithLastLoginTimeAfterDistribution(std::map >::iterator iter = result.begin(); iter != result.end(); ++iter) iter->second.second = 0; - int const timeNow = static_cast(::time(nullptr)); + int const timeNow = static_cast(::time(NULL)); for (IdToCharacterDataMapType::const_iterator i = m_idToCharacterDataMap->begin(); i != m_idToCharacterDataMap->end(); ++i) { int const lastLoginTimeSecondsAgo = std::max(static_cast(0), static_cast(timeNow - static_cast(i->second.lastLoginTime))); @@ -439,7 +439,7 @@ void NameManager::getPlayerWithCreateTimeAfterDistribution(std::map >::iterator iter = result.begin(); iter != result.end(); ++iter) iter->second.second = 0; - int const timeNow = static_cast(::time(nullptr)); + int const timeNow = static_cast(::time(NULL)); for (IdToCharacterDataMapType::const_iterator i = m_idToCharacterDataMap->begin(); i != m_idToCharacterDataMap->end(); ++i) { int const createTimeSecondsAgo = std::max(static_cast(0), static_cast(timeNow - static_cast(i->second.createTime))); diff --git a/engine/server/library/serverGame/src/shared/core/NewbieTutorial.cpp b/engine/server/library/serverGame/src/shared/core/NewbieTutorial.cpp index 98fdebc8..4388ad2a 100755 --- a/engine/server/library/serverGame/src/shared/core/NewbieTutorial.cpp +++ b/engine/server/library/serverGame/src/shared/core/NewbieTutorial.cpp @@ -257,10 +257,10 @@ void NewbieTutorial::getNonFreeObjectsForDeletion(const Container* const contain { const CachedNetworkId & itemId = *i; ServerObject * item = safe_cast(itemId.getObject()); - if (item != nullptr) + if (item != NULL) { TangibleObject *itemTangible = item->asTangibleObject(); - if (itemTangible != nullptr) + if (itemTangible != NULL) { const char *templateName = itemTangible->getSharedTemplateName(); if (!FileManifest::contains(templateName)) @@ -273,7 +273,7 @@ void NewbieTutorial::getNonFreeObjectsForDeletion(const Container* const contain { // see if the item is a container and go through its contents const Container * const itemContainer = ContainerInterface::getContainer(*item); - if (itemContainer != nullptr) + if (itemContainer != NULL) getNonFreeObjectsForDeletion(itemContainer, objectsToDelete, character); } } diff --git a/engine/server/library/serverGame/src/shared/core/NpcConversation.cpp b/engine/server/library/serverGame/src/shared/core/NpcConversation.cpp index e3c56b3e..bc457bbd 100755 --- a/engine/server/library/serverGame/src/shared/core/NpcConversation.cpp +++ b/engine/server/library/serverGame/src/shared/core/NpcConversation.cpp @@ -81,7 +81,7 @@ NpcConversation::NpcConversation(TangibleObject & player, TangibleObject & npc, NpcConversation::~NpcConversation() { TangibleObject * const player = safe_cast(m_player.getObject()); - if (player != nullptr) + if (player != NULL) { MessageQueueStopNpcConversation * const message = new MessageQueueStopNpcConversation; @@ -110,13 +110,13 @@ void NpcConversation::sendMessage(const Response & npcMessage, const Unicode::St TangibleObject * const player = safe_cast(m_player.getObject()); TangibleObject * const npc = safe_cast(m_npc.getObject()); - if (player == nullptr) + if (player == NULL) { - if (npc != nullptr) + if (npc != NULL) npc->removeConversation(m_player); return; } - if (npc == nullptr) + if (npc == NULL) { player->endNpcConversation(); return; @@ -216,13 +216,13 @@ void NpcConversation::sendResponses() const int count = static_cast(m_responses->size()); - if (player == nullptr) + if (player == NULL) { - if (npc != nullptr) + if (npc != NULL) npc->removeConversation(m_player); return; } - if (npc == nullptr) + if (npc == NULL) { player->endNpcConversation(); return; diff --git a/engine/server/library/serverGame/src/shared/core/ObserveTracker.cpp b/engine/server/library/serverGame/src/shared/core/ObserveTracker.cpp index 95bc6594..78fe2d74 100755 --- a/engine/server/library/serverGame/src/shared/core/ObserveTracker.cpp +++ b/engine/server/library/serverGame/src/shared/core/ObserveTracker.cpp @@ -353,14 +353,14 @@ void ObserveTracker::onObjectContainerChanged(ServerObject &obj) bool isObservedWith = (newContainer->getContainerProperty() ? newContainer->getContainerProperty()->isContentItemObservedWith(obj) : false); CellProperty * newContainerCell = newContainer->getCellProperty(); ServerObject const * newContainerContainer = safe_cast(ContainerInterface::getContainedByObject(*newContainer)); - if (newContainerCell == nullptr || newContainerContainer != nullptr) + if (newContainerCell == NULL || newContainerContainer != NULL) { std::set const &newObservers = newContainer->getObservers(); for (std::set::const_iterator i = newObservers.begin(); i != newObservers.end(); ++i) { if (isObservedWith || (*i)->getOpenedContainers().count(newContainer) || - (newContainerCell != nullptr && shouldObserveCellContentsDueToClientContainmentChain(**i, *newContainerContainer))) + (newContainerCell != NULL && shouldObserveCellContentsDueToClientContainmentChain(**i, *newContainerContainer))) { IGNORE_RETURN(observe(**i, obj)); } diff --git a/engine/server/library/serverGame/src/shared/core/PlayerCreationManagerServer.cpp b/engine/server/library/serverGame/src/shared/core/PlayerCreationManagerServer.cpp index 62cc2fb3..9b2d5d2e 100755 --- a/engine/server/library/serverGame/src/shared/core/PlayerCreationManagerServer.cpp +++ b/engine/server/library/serverGame/src/shared/core/PlayerCreationManagerServer.cpp @@ -122,7 +122,7 @@ bool PlayerCreationManagerServer::setupPlayer(CreatureObject & obj, const std::s else { //Attach insurance variables here: - if (item->asTangibleObject() != nullptr) + if (item->asTangibleObject() != NULL) item->asTangibleObject()->setUninsurable(true); } } @@ -204,7 +204,7 @@ bool PlayerCreationManagerServer::setupPlayer(CreatureObject & obj, const std::s for (size_t i = 0; i < numSkills; ++i) { const SkillObject * skill = SkillManager::getInstance().getSkill(bounty_skills[i]); - if (skill != nullptr) + if (skill != NULL) obj.grantSkill(*skill); } } diff --git a/engine/server/library/serverGame/src/shared/core/PositionUpdateTracker.cpp b/engine/server/library/serverGame/src/shared/core/PositionUpdateTracker.cpp index a28ee96b..5d95b59b 100755 --- a/engine/server/library/serverGame/src/shared/core/PositionUpdateTracker.cpp +++ b/engine/server/library/serverGame/src/shared/core/PositionUpdateTracker.cpp @@ -122,7 +122,7 @@ bool PositionUpdateTracker::shouldSendPositionUpdate(ServerObject const &obj) return false; ServerObject const *containedByObj = safe_cast(ContainerInterface::getContainedByObject(obj)); - CreatureObject const *creatureContainer = (containedByObj ? containedByObj->asCreatureObject() : nullptr); + CreatureObject const *creatureContainer = (containedByObj ? containedByObj->asCreatureObject() : NULL); bool const objectIsRidingMount = (creatureContainer && creatureContainer->isMountable()); if (containedByObj && !isContainerConsideredPersisted(obj, *containedByObj) && !objectIsRidingMount) @@ -204,7 +204,7 @@ void PositionUpdateTracker::sendPositionUpdate(ServerObject &obj) else { ServerObject const * const container = safe_cast(ContainerInterface::getContainedByObject(obj)); - CreatureObject const * const creatureContainer = (container ? container->asCreatureObject() : nullptr); + CreatureObject const * const creatureContainer = (container ? container->asCreatureObject() : NULL); if (creatureContainer && creatureContainer->isMountable()) { // Riders of mounts persist at the location of the mount diff --git a/engine/server/library/serverGame/src/shared/core/RegexList.cpp b/engine/server/library/serverGame/src/shared/core/RegexList.cpp index 29c7ae32..5244818e 100755 --- a/engine/server/library/serverGame/src/shared/core/RegexList.cpp +++ b/engine/server/library/serverGame/src/shared/core/RegexList.cpp @@ -55,7 +55,7 @@ RegexList::Entry::Entry(char const *pattern, bool matchWords, char const *reason char const *errorString = 0; int errorOffset = 0; - m_pcre = pcre_compile(pattern, 0, &errorString, &errorOffset, nullptr); + m_pcre = pcre_compile(pattern, 0, &errorString, &errorOffset, NULL); WARNING(!m_pcre, ("failed to compile regex pattern [%s] into a pcre regex.", pattern)); } @@ -175,7 +175,7 @@ bool RegexList::doesStringMatch(const Unicode::String &name, std::string &ruleDe std::vector::iterator nameIter; for (nameIter = names.begin(); nameIter != names.end(); ++nameIter) { - int const returnCode = pcre_exec(compiledRegex, nullptr, nameIter->c_str(), nameIter->length(), 0, 0, captureData, dataElementCount); + int const returnCode = pcre_exec(compiledRegex, NULL, nameIter->c_str(), nameIter->length(), 0, 0, captureData, dataElementCount); if (returnCode >= 0) { ruleDescription = entry->getReason(); @@ -187,7 +187,7 @@ bool RegexList::doesStringMatch(const Unicode::String &name, std::string &ruleDe } else { - int const returnCode = pcre_exec(compiledRegex, nullptr, testName.c_str(), testName.length(), 0, 0, captureData, dataElementCount); + int const returnCode = pcre_exec(compiledRegex, NULL, testName.c_str(), testName.length(), 0, 0, captureData, dataElementCount); if (returnCode >= 0) { ruleDescription = entry->getReason(); diff --git a/engine/server/library/serverGame/src/shared/core/ReportManager.cpp b/engine/server/library/serverGame/src/shared/core/ReportManager.cpp index b73e89ff..4bac637e 100755 --- a/engine/server/library/serverGame/src/shared/core/ReportManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/ReportManager.cpp @@ -247,7 +247,7 @@ void ReportManager::handleMessage(ChatOnRequestLog const &chatOnRequestLog) CreatureObject * const reportingCreatureObject = CreatureObject::asCreatureObject(NetworkIdManager::getObjectById(reportData.m_reportingNetworkId)); PlayerObject * const reportingPlayerObject = PlayerCreatureController::getPlayerObject(reportingCreatureObject); - if (reportingPlayerObject != nullptr) + if (reportingPlayerObject != NULL) { // Make sure the chat log does not have any extra data in it @@ -297,7 +297,7 @@ void ReportManager::handleMessage(ChatOnRequestLog const &chatOnRequestLog) } if ( !foundHarassingPlayer - && (reportingCreatureObject != nullptr)) + && (reportingCreatureObject != NULL)) { // No harassing player match @@ -345,7 +345,7 @@ void ReportManager::handleMessage(ChatOnRequestLog const &chatOnRequestLog) target.str = reportData.m_harassingName; prosePackage.target = target; - if (reportingCreatureObject != nullptr) + if (reportingCreatureObject != NULL) { Chat::sendSystemMessage(*reportingCreatureObject, prosePackage); } diff --git a/engine/server/library/serverGame/src/shared/core/SceneGlobalData.cpp b/engine/server/library/serverGame/src/shared/core/SceneGlobalData.cpp index 5c25017b..5a7c12b8 100755 --- a/engine/server/library/serverGame/src/shared/core/SceneGlobalData.cpp +++ b/engine/server/library/serverGame/src/shared/core/SceneGlobalData.cpp @@ -113,7 +113,7 @@ SceneData * SceneGlobalDataNamespace::getSceneDataByName(std::string const & sce if (i!=ms_SceneDataItems.end()) return i->second; else - return nullptr; + return NULL; } // ====================================================================== diff --git a/engine/server/library/serverGame/src/shared/core/ServerBuffBuilderManager.cpp b/engine/server/library/serverGame/src/shared/core/ServerBuffBuilderManager.cpp index fcf18e02..829055b8 100755 --- a/engine/server/library/serverGame/src/shared/core/ServerBuffBuilderManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/ServerBuffBuilderManager.cpp @@ -58,7 +58,7 @@ void ServerBuffBuilderManager::remove() ms_installed = false; delete ms_callback; - ms_callback = nullptr; + ms_callback = NULL; } //----------------------------------------------------------------------------- @@ -73,12 +73,12 @@ bool ServerBuffBuilderManager::makeChanges(SharedBuffBuilderManager::Session con NetworkId const & recipientId = session.recipientId; Object * const recipientObj = NetworkIdManager::getObjectById(recipientId); - ServerObject * const recipientServerObj = recipientObj ? recipientObj->asServerObject() : nullptr; - CreatureObject * const recipient = recipientServerObj ? recipientServerObj->asCreatureObject() : nullptr; + ServerObject * const recipientServerObj = recipientObj ? recipientObj->asServerObject() : NULL; + CreatureObject * const recipient = recipientServerObj ? recipientServerObj->asCreatureObject() : NULL; NetworkId const & bufferId = session.bufferId; Object * const bufferObj = NetworkIdManager::getObjectById(bufferId); - ServerObject * const bufferServerObj = bufferObj ? bufferObj->asServerObject() : nullptr; - CreatureObject * const buffer = bufferServerObj ? bufferServerObj->asCreatureObject() : nullptr; + ServerObject * const bufferServerObj = bufferObj ? bufferObj->asServerObject() : NULL; + CreatureObject * const buffer = bufferServerObj ? bufferServerObj->asCreatureObject() : NULL; if(buffer && recipient) { sendSessionToScript(session, session.bufferId, static_cast(Scripting::TRIG_BUFF_BUILDER_COMPLETED)); @@ -93,11 +93,11 @@ void ServerBuffBuilderManager::sendSessionToScriptForValidation(SharedBuffBuilde NetworkId const & bufferId = session.bufferId; NetworkId const & recipientId = session.recipientId; Object const * const bufferObj = NetworkIdManager::getObjectById(bufferId); - ServerObject const * const bufferServer = bufferObj ? bufferObj->asServerObject() : nullptr; - CreatureObject const * const buffer = bufferServer ? bufferServer->asCreatureObject() : nullptr; + ServerObject const * const bufferServer = bufferObj ? bufferObj->asServerObject() : NULL; + CreatureObject const * const buffer = bufferServer ? bufferServer->asCreatureObject() : NULL; Object * const recipientObj = NetworkIdManager::getObjectById(recipientId); - ServerObject * const recipientServer = recipientObj ? recipientObj->asServerObject() : nullptr; - CreatureObject * const recipient = recipientServer ? recipientServer->asCreatureObject() : nullptr; + ServerObject * const recipientServer = recipientObj ? recipientObj->asServerObject() : NULL; + CreatureObject * const recipient = recipientServer ? recipientServer->asCreatureObject() : NULL; if(buffer && recipient) { sendSessionToScript(session, session.bufferId, static_cast(Scripting::TRIG_BUFF_BUILDER_VALIDATE)); @@ -109,7 +109,7 @@ void ServerBuffBuilderManager::sendSessionToScriptForValidation(SharedBuffBuilde void ServerBuffBuilderManager::sendSessionToScript(SharedBuffBuilderManager::Session const & session, NetworkId const & objectToTriggerId, int const trigger) { Object * const objectToTrigger = NetworkIdManager::getObjectById(objectToTriggerId); - ServerObject * const serverObjectToTrigger = objectToTrigger ? objectToTrigger->asServerObject() : nullptr; + ServerObject * const serverObjectToTrigger = objectToTrigger ? objectToTrigger->asServerObject() : NULL; if(serverObjectToTrigger) { GameScriptObject * const scriptObject = serverObjectToTrigger->getScriptObject(); @@ -144,7 +144,7 @@ void ServerBuffBuilderManager::cancelSession(NetworkId const & bufferId, Network { //send the cancel message to the buffer Object * const bufferObject = NetworkIdManager::getObjectById(bufferId); - Controller * const bufferController = bufferObject ? bufferObject->getController() : nullptr; + Controller * const bufferController = bufferObject ? bufferObject->getController() : NULL; if(bufferController) { BuffBuilderChangeMessage * outMsg = new BuffBuilderChangeMessage(); @@ -157,7 +157,7 @@ void ServerBuffBuilderManager::cancelSession(NetworkId const & bufferId, Network //send the cancel message to the recipient Object * const recipientObject = NetworkIdManager::getObjectById(recipientId); - Controller * const recipientController = recipientObject ? recipientObject->getController() : nullptr; + Controller * const recipientController = recipientObject ? recipientObject->getController() : NULL; if(recipientController && bufferController != recipientController) { BuffBuilderChangeMessage * outMsg = new BuffBuilderChangeMessage(); @@ -169,7 +169,7 @@ void ServerBuffBuilderManager::cancelSession(NetworkId const & bufferId, Network } //send cancel trigger to buffer player - ServerObject * const bufferServerObject = bufferObject ? bufferObject->asServerObject() : nullptr; + ServerObject * const bufferServerObject = bufferObject ? bufferObject->asServerObject() : NULL; if(bufferServerObject) { GameScriptObject * const scriptObject = bufferServerObject->getScriptObject(); @@ -181,7 +181,7 @@ void ServerBuffBuilderManager::cancelSession(NetworkId const & bufferId, Network } //send cancel trigger to recipient player - ServerObject * const recipientServerObject = recipientObject ? recipientObject->asServerObject() : nullptr; + ServerObject * const recipientServerObject = recipientObject ? recipientObject->asServerObject() : NULL; if(recipientServerObject && recipientServerObject != bufferServerObject) { GameScriptObject * const scriptObject = recipientServerObject->getScriptObject(); diff --git a/engine/server/library/serverGame/src/shared/core/ServerBuildoutManager.cpp b/engine/server/library/serverGame/src/shared/core/ServerBuildoutManager.cpp index e38943e1..f371ee83 100755 --- a/engine/server/library/serverGame/src/shared/core/ServerBuildoutManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/ServerBuildoutManager.cpp @@ -81,8 +81,8 @@ namespace ServerBuildoutManagerNamespace struct ServerEventAreaInfo { ServerEventAreaInfo(): - buildOut(nullptr), - loadedObject(nullptr) + buildOut(NULL), + loadedObject(NULL) { } @@ -892,7 +892,7 @@ void ServerBuildoutManagerNamespace::instantiateAreaNode(AreaInfo const &areaInf ServerEventMap::iterator searchIter = s_eventObjects.find(buildoutRow.m_eventRequired); if(searchIter != s_eventObjects.end()) { - ServerEventAreaInfo newEventObj(&buildoutRow, nullptr); + ServerEventAreaInfo newEventObj(&buildoutRow, NULL); (*searchIter).second.push_back(newEventObj); } else @@ -947,7 +947,7 @@ void ServerBuildoutManagerNamespace::instantiateAreaNode(AreaInfo const &areaInf newObject->setAuthority(); - if (newObject->asTangibleObject() != nullptr) + if (newObject->asTangibleObject() != NULL) newObject->asTangibleObject()->initializeVisibility(); // @@ -1033,7 +1033,7 @@ void ServerBuildoutManagerNamespace::instantiateAreaNode(AreaInfo const &areaInf { GameScriptObject * const gso = newObject->getScriptObject(); - if (nullptr != gso) + if (NULL != gso) { std::string const &scripts = buildoutRow.m_scripts; unsigned int pos = 0; @@ -1077,7 +1077,7 @@ void ServerBuildoutManagerNamespace::instantiateAreaNode(AreaInfo const &areaInf if ( controllerObjectId.isValid() ) { ServerObject * const controllerObject = safe_cast(NetworkIdManager::getObjectById(controllerObjectId)); - if (nullptr != controllerObject) + if (NULL != controllerObject) { GameScriptObject * const script = controllerObject->getScriptObject(); @@ -1092,7 +1092,7 @@ void ServerBuildoutManagerNamespace::instantiateAreaNode(AreaInfo const &areaInf { if (registerWithController) { - if (nullptr != script) + if (NULL != script) { ScriptParams p; p.addParam(obj->getNetworkId()); @@ -1279,7 +1279,7 @@ void ServerBuildoutManager::onEventStarted(std::string const & eventName) newObject->setAuthority(); - if (newObject->asTangibleObject() != nullptr) + if (newObject->asTangibleObject() != NULL) newObject->asTangibleObject()->initializeVisibility(); // @@ -1369,7 +1369,7 @@ void ServerBuildoutManager::onEventStarted(std::string const & eventName) { GameScriptObject * const gso = newObject->getScriptObject(); - if (nullptr != gso) + if (NULL != gso) { std::string const &scripts = buildoutRow.m_scripts; unsigned int pos = 0; @@ -1407,7 +1407,7 @@ void ServerBuildoutManager::onEventStarted(std::string const & eventName) if ( controllerObjectId.isValid() ) { ServerObject * const controllerObject = safe_cast(NetworkIdManager::getObjectById(controllerObjectId)); - if (nullptr != controllerObject) + if (NULL != controllerObject) { GameScriptObject * const script = controllerObject->getScriptObject(); @@ -1422,7 +1422,7 @@ void ServerBuildoutManager::onEventStarted(std::string const & eventName) { if (registerWithController) { - if (nullptr != script) + if (NULL != script) { ScriptParams p; p.addParam(obj->getNetworkId()); @@ -1483,7 +1483,7 @@ void ServerBuildoutManager::onEventStopped(std::string const & eventName) object->unload(); - (*objIter).loadedObject = nullptr; + (*objIter).loadedObject = NULL; } } } diff --git a/engine/server/library/serverGame/src/shared/core/ServerImageDesignerManager.cpp b/engine/server/library/serverGame/src/shared/core/ServerImageDesignerManager.cpp index 2fd9b849..fe976e69 100755 --- a/engine/server/library/serverGame/src/shared/core/ServerImageDesignerManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/ServerImageDesignerManager.cpp @@ -56,8 +56,8 @@ namespace ServerImageDesignerManagerNamespace { NetworkId const & nid = payload.first; Object * const o = NetworkIdManager::getObjectById(nid); - ServerObject * const so = o ? o->asServerObject() : nullptr; - CreatureObject * const creature = so ? so->asCreatureObject() : nullptr; + ServerObject * const so = o ? o->asServerObject() : NULL; + CreatureObject * const creature = so ? so->asCreatureObject() : NULL; if (creature) { ObjectTemplate const * const tmp = creature->getSharedTemplate(); @@ -157,7 +157,7 @@ void ServerImageDesignerManager::remove() ms_genderSpeciesToAllowBald.clear(); delete ms_callback; - ms_callback = nullptr; + ms_callback = NULL; } //----------------------------------------------------------------------------- @@ -172,12 +172,12 @@ bool ServerImageDesignerManager::makeChanges(SharedImageDesignerManager::Session NetworkId const & recipientId = session.recipientId; Object * const recipientObj = NetworkIdManager::getObjectById(recipientId); - ServerObject * const recipientServerObj = recipientObj ? recipientObj->asServerObject() : nullptr; - CreatureObject * const recipient = recipientServerObj ? recipientServerObj->asCreatureObject() : nullptr; + ServerObject * const recipientServerObj = recipientObj ? recipientObj->asServerObject() : NULL; + CreatureObject * const recipient = recipientServerObj ? recipientServerObj->asCreatureObject() : NULL; NetworkId const & designerId = session.designerId; Object * const designerObj = NetworkIdManager::getObjectById(designerId); - ServerObject * const designerServerObj = designerObj ? designerObj->asServerObject() : nullptr; - CreatureObject * const designer = designerServerObj ? designerServerObj->asCreatureObject() : nullptr; + ServerObject * const designerServerObj = designerObj ? designerObj->asServerObject() : NULL; + CreatureObject * const designer = designerServerObj ? designerServerObj->asCreatureObject() : NULL; if(designer && recipient) { @@ -332,8 +332,8 @@ bool ServerImageDesignerManager::makeChanges(SharedImageDesignerManager::Session SlotId const slot = SlotIdManager::findSlotId (ConstCharCrcLowerString (cms_hairSlotName)); Container::ContainerErrorCode tmp = Container::CEC_Success; Object * const originalHairObject = slotted->getObjectInSlot(slot, tmp).getObject(); - ServerObject * const originalHairServerObject = originalHairObject ? originalHairObject->asServerObject() : nullptr; - TangibleObject * const orignalHair = originalHairServerObject ? originalHairServerObject->asTangibleObject() : nullptr; + ServerObject * const originalHairServerObject = originalHairObject ? originalHairObject->asServerObject() : NULL; + TangibleObject * const orignalHair = originalHairServerObject ? originalHairServerObject->asTangibleObject() : NULL; std::string originalHairCustomizationData; if(orignalHair) { @@ -434,8 +434,8 @@ SharedImageDesignerManager::SkillMods ServerImageDesignerManager::getSkillModsFo } Object const * const o = NetworkIdManager::getObjectById(designerId); - ServerObject const * const so = o ? o->asServerObject() : nullptr; - CreatureObject const * const designer = so ? so->asCreatureObject() : nullptr; + ServerObject const * const so = o ? o->asServerObject() : NULL; + CreatureObject const * const designer = so ? so->asCreatureObject() : NULL; if(designer) { skillMods.bodySkillMod = designer->getModValue(SharedImageDesignerManager::cms_bodySkillModName); @@ -466,7 +466,7 @@ void ServerImageDesignerManager::updateGradualCustomizations(CreatureObject * ta //do this one immediately SlotId const slot = SlotIdManager::findSlotId (ConstCharCrcLowerString (cms_hairCustomizationName.c_str())); ServerObject * const hair = ServerWorld::createNewObject(i->second.templateName, *target, slot, true); - TangibleObject * const tangibleHair = hair ? hair->asTangibleObject() : nullptr; + TangibleObject * const tangibleHair = hair ? hair->asTangibleObject() : NULL; if(tangibleHair) { //first set hair color to colors from old hair (if any) @@ -503,11 +503,11 @@ void ServerImageDesignerManager::sendSessionToScriptForValidation(SharedImageDes NetworkId const & designerId = session.designerId; NetworkId const & recipientId = session.recipientId; Object const * const designerObj = NetworkIdManager::getObjectById(designerId); - ServerObject const * const designerServer = designerObj ? designerObj->asServerObject() : nullptr; - CreatureObject const * const designer = designerServer ? designerServer->asCreatureObject() : nullptr; + ServerObject const * const designerServer = designerObj ? designerObj->asServerObject() : NULL; + CreatureObject const * const designer = designerServer ? designerServer->asCreatureObject() : NULL; Object * const recipientObj = NetworkIdManager::getObjectById(recipientId); - ServerObject * const recipientServer = recipientObj ? recipientObj->asServerObject() : nullptr; - CreatureObject * const recipient = recipientServer ? recipientServer->asCreatureObject() : nullptr; + ServerObject * const recipientServer = recipientObj ? recipientObj->asServerObject() : NULL; + CreatureObject * const recipient = recipientServer ? recipientServer->asCreatureObject() : NULL; if(designer && recipient) { sendSessionToScript(session, session.designerId, static_cast(Scripting::TRIG_IMAGE_DESIGN_VALIDATE)); @@ -519,7 +519,7 @@ void ServerImageDesignerManager::sendSessionToScriptForValidation(SharedImageDes void ServerImageDesignerManager::sendSessionToScript(SharedImageDesignerManager::Session const & session, NetworkId const & objectToTriggerId, int const trigger) { Object * const objectToTrigger = NetworkIdManager::getObjectById(objectToTriggerId); - ServerObject * const serverObjectToTrigger = objectToTrigger ? objectToTrigger->asServerObject() : nullptr; + ServerObject * const serverObjectToTrigger = objectToTrigger ? objectToTrigger->asServerObject() : NULL; if(serverObjectToTrigger) { GameScriptObject * const scriptObject = serverObjectToTrigger->getScriptObject(); @@ -571,11 +571,11 @@ CustomizationData * ServerImageDesignerManager::fetchCustomizationDataForCustomi if(customization.isVarHairColor) { ServerObject * const hair = creature.getHair(); - TangibleObject * const tangibleHair = hair ? hair->asTangibleObject() : nullptr; + TangibleObject * const tangibleHair = hair ? hair->asTangibleObject() : NULL; if(tangibleHair) objectToQuery = tangibleHair; else - return nullptr; + return NULL; } return objectToQuery->fetchCustomizationData(); } @@ -586,7 +586,7 @@ void ServerImageDesignerManager::cancelSession(NetworkId const & designerId, Net { //send the cancel message to the designer Object * const designerObject = NetworkIdManager::getObjectById(designerId); - Controller * const designerController = designerObject ? designerObject->getController() : nullptr; + Controller * const designerController = designerObject ? designerObject->getController() : NULL; if(designerController) { ImageDesignChangeMessage * outMsg = new ImageDesignChangeMessage(); @@ -599,7 +599,7 @@ void ServerImageDesignerManager::cancelSession(NetworkId const & designerId, Net //send the cancel message to the recipient Object * const recipientObject = NetworkIdManager::getObjectById(recipientId); - Controller * const recipientController = recipientObject ? recipientObject->getController() : nullptr; + Controller * const recipientController = recipientObject ? recipientObject->getController() : NULL; if(recipientController && designerController != recipientController) { ImageDesignChangeMessage * outMsg = new ImageDesignChangeMessage(); @@ -611,7 +611,7 @@ void ServerImageDesignerManager::cancelSession(NetworkId const & designerId, Net } //send cancel trigger to designer player - ServerObject * const designerServerObject = designerObject ? designerObject->asServerObject() : nullptr; + ServerObject * const designerServerObject = designerObject ? designerObject->asServerObject() : NULL; if(designerServerObject) { GameScriptObject * const scriptObject = designerServerObject->getScriptObject(); @@ -623,7 +623,7 @@ void ServerImageDesignerManager::cancelSession(NetworkId const & designerId, Net } //send cancel trigger to recipient player - ServerObject * const recipientServerObject = recipientObject ? recipientObject->asServerObject() : nullptr; + ServerObject * const recipientServerObject = recipientObject ? recipientObject->asServerObject() : NULL; if(recipientServerObject && recipientServerObject != designerServerObject) { GameScriptObject * const scriptObject = recipientServerObject->getScriptObject(); @@ -644,8 +644,8 @@ void ServerImageDesignerManager::cancelSession(NetworkId const & designerId, Net std::map ServerImageDesignerManager::getHairCustomizations(SharedImageDesignerManager::Session const & session) { Object * const o = NetworkIdManager::getObjectById(session.recipientId); - ServerObject * const so = o ? o->asServerObject() : nullptr; - CreatureObject * const recipient = so ? so->asCreatureObject() : nullptr; + ServerObject * const so = o ? o->asServerObject() : NULL; + CreatureObject * const recipient = so ? so->asCreatureObject() : NULL; CustomizationManager::Customization customization; bool result = false; std::map hairCustomizations; diff --git a/engine/server/library/serverGame/src/shared/core/ServerUIManager.cpp b/engine/server/library/serverGame/src/shared/core/ServerUIManager.cpp index be9ccc62..f94b1eee 100755 --- a/engine/server/library/serverGame/src/shared/core/ServerUIManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/ServerUIManager.cpp @@ -105,7 +105,7 @@ int ServerUIManager::createPage(const std::string& pageName, const ServerObject& return pageId; ServerUIPage * const serverUIPage = ServerUIManager::getPage(pageId); - if (serverUIPage != nullptr) + if (serverUIPage != NULL) { serverUIPage->setCallback(callbackFunction); return pageId; @@ -153,7 +153,7 @@ ServerUIPage* ServerUIManager::getPage(int pageId) { std::map::const_iterator iterFind = m_pages.find(pageId); if (iterFind == m_pages.end()) - return nullptr; + return NULL; else return iterFind->second; } @@ -163,7 +163,7 @@ ServerUIPage* ServerUIManager::getPage(int pageId) bool ServerUIManager::showPage(int pageId) { ServerUIPage * const page = getPage(pageId); - if (page != nullptr) + if (page != NULL) return showPage(*page); WARNING(true, ("ServerUIManager::showPage(%d) invalid page", pageId)); @@ -175,14 +175,14 @@ bool ServerUIManager::showPage(int pageId) bool ServerUIManager::showPage(ServerUIPage & page) { Client * const client = page.getClient(); - if (client == nullptr) + if (client == NULL) { -// WARNING(true, ("ServerUIManager::showPage attempt to show page on nullptr client")); +// WARNING(true, ("ServerUIManager::showPage attempt to show page on null client")); return false; } ServerObject const * const characterObject = client->getCharacterObject(); - if (characterObject == nullptr) + if (characterObject == NULL) { WARNING(true, ("ServerUIManager::showPage attempt to show page to client with no character object")); return false; @@ -219,11 +219,11 @@ bool ServerUIManager::closePage(int pageId) { //send close_page message const ServerUIPage * const page = getPage(pageId); - if(page == nullptr) + if(page == NULL) return false; Client * const client = page->getClient(); - if(client == nullptr) + if(client == NULL) return false; SuiForceClosePage msg; @@ -239,7 +239,7 @@ bool ServerUIManager::removePage(int pageId) { //send close_page message const ServerUIPage * const page = getPage(pageId); - if(page == nullptr) + if(page == NULL) return false; NetworkId const & primaryControlledObject = page->getPrimaryControlledObject(); @@ -275,11 +275,11 @@ void ServerUIManager::receiveMessage(const MessageDispatch::MessageBase& message int const pageId = suiEventNotification.getPageId(); ServerUIPage const * const page = getPage(pageId); - if (page == nullptr) + if (page == NULL) return; Client * const client = page->getClient(); - if (client == nullptr) + if (client == NULL) { removePage(pageId); return; @@ -287,9 +287,9 @@ void ServerUIManager::receiveMessage(const MessageDispatch::MessageBase& message ServerObject * const characterObject = client->getCharacterObject(); - if (characterObject == nullptr) + if (characterObject == NULL) { - WARNING(true, ("ServerUIManager::recieveMessage got SuiEventNotification for nullptr character object")); + WARNING(true, ("ServerUIManager::recieveMessage got SuiEventNotification for null character object")); removePage(pageId); return; } @@ -300,15 +300,15 @@ void ServerUIManager::receiveMessage(const MessageDispatch::MessageBase& message ServerObject * const ownerObject = ServerWorld::findObjectByNetworkId(suiPageDataServer.getOwnerId()); - if (ownerObject == nullptr) + if (ownerObject == NULL) { - WARNING(true, ("ServerUIManager::recieveMessage got SuiEventNotification for nullptr owner object")); + WARNING(true, ("ServerUIManager::recieveMessage got SuiEventNotification for null owner object")); removePage(pageId); return; } GameScriptObject * const gso = ownerObject->getScriptObject(); - if (gso == nullptr) + if (gso == NULL) { WARNING(true, ("ServerUIManager::recieveMessage got SuiEventNotification for owner object with no scripts")); removePage(pageId); @@ -318,7 +318,7 @@ void ServerUIManager::receiveMessage(const MessageDispatch::MessageBase& message int const eventIndex = suiEventNotification.getSubscribedEventIndex(); SuiCommand const * const command = suiPageData.findSubscribeToEventCommandByIndex(eventIndex); - if (command == nullptr) + if (command == NULL) { WARNING(true, ("ServerUIManager::recieveMessage got SuiEventNotification invalid notification index [%d]", eventIndex)); return; @@ -385,7 +385,7 @@ void ServerUIManager::receiveMessage(const MessageDispatch::MessageBase& message ScriptDictionaryPtr sd; //it allocates sd, we have to clean it up later gso->makeScriptDictionary(sp, sd); - if(sd.get() == nullptr) + if(sd.get() == NULL) return; //call the script callback function diff --git a/engine/server/library/serverGame/src/shared/core/ServerUIPage.cpp b/engine/server/library/serverGame/src/shared/core/ServerUIPage.cpp index 1fc5e64a..289f1ada 100755 --- a/engine/server/library/serverGame/src/shared/core/ServerUIPage.cpp +++ b/engine/server/library/serverGame/src/shared/core/ServerUIPage.cpp @@ -36,7 +36,7 @@ m_pageDataServer(pageDataServer) ServerUIPage::~ServerUIPage() { delete m_pageDataServer; - m_pageDataServer = nullptr; + m_pageDataServer = NULL; } //----------------------------------------------------------------------- @@ -52,19 +52,19 @@ Client* ServerUIPage::getClient() const if(!object) { WARNING(true, ("ServerUIPage PrimaryControlledObject doesn't exist")); - return nullptr; + return NULL; } ServerObject *const serverObject = object->asServerObject(); if(!serverObject) { WARNING(true, ("ServerUIPage PrimaryControlledObject isn't a server object")); - return nullptr; + return NULL; } Client * const result = serverObject->getClient(); if(!result) { WARNING(true, ("ServerUIPage PrimaryControlledObject has no client yet")); - return nullptr; + return NULL; } return result; } @@ -74,9 +74,9 @@ Client* ServerUIPage::getClient() const ServerObject* ServerUIPage::getOwner() const { Object * const object = NetworkIdManager::getObjectById(getPageDataServer().getOwnerId()); - if (object != nullptr) + if (object != NULL) return object->asServerObject(); - return nullptr; + return NULL; } //----------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/core/ServerUniverse.cpp b/engine/server/library/serverGame/src/shared/core/ServerUniverse.cpp index 29f8e60e..9729c039 100755 --- a/engine/server/library/serverGame/src/shared/core/ServerUniverse.cpp +++ b/engine/server/library/serverGame/src/shared/core/ServerUniverse.cpp @@ -65,15 +65,15 @@ ServerUniverse::ServerUniverse() : m_universeProcess (0), m_nextCheckTimer (static_cast(ConfigServerGame::getUniverseCheckFrequencySeconds())), m_doImmediateCheck (false), - m_thisPlanet (nullptr), - m_tatooinePlanet (nullptr), + m_thisPlanet (NULL), + m_tatooinePlanet (NULL), m_planetNameMap (new PlanetNameMap), m_resourceTypeNameMap (new ResourceTypeNameMap), m_resourceTypeIdMap (new ResourceTypeIdMap), m_importedResourceTypeIdMap(new ResourceTypeIdMap), m_resourcesToSend (new ResourcesToSendType), - m_masterGuildObject (nullptr), - m_masterCityObject (nullptr), + m_masterGuildObject (NULL), + m_masterCityObject (NULL), m_theaterNameIdMap (new TheaterNameIdMap), m_theaterIdNameMap (new TheaterIdNameMap), m_populationList (new PopulationList), @@ -152,7 +152,7 @@ ResourceTypeObject *ServerUniverse::getResourceTypeByName(std::string const & na ResourceTypeObject * ServerUniverse::getResourceTypeById(NetworkId const & id) const { if (id==NetworkId::cms_invalid) - return nullptr; + return NULL; if (id.getValue() <= NetworkId::cms_maxNetworkIdWithoutClusterId) { @@ -160,7 +160,7 @@ ResourceTypeObject * ServerUniverse::getResourceTypeById(NetworkId const & id) c if (i!=m_resourceTypeIdMap->end()) return (*i).second; else - return nullptr; + return NULL; } else { @@ -168,7 +168,7 @@ ResourceTypeObject * ServerUniverse::getResourceTypeById(NetworkId const & id) c if (i!=m_importedResourceTypeIdMap->end()) return (*i).second; else - return nullptr; + return NULL; } } @@ -177,13 +177,13 @@ ResourceTypeObject * ServerUniverse::getResourceTypeById(NetworkId const & id) c ResourceTypeObject * ServerUniverse::getImportedResourceTypeById(NetworkId const & id) const { if (id==NetworkId::cms_invalid) - return nullptr; + return NULL; ResourceTypeIdMap::const_iterator i=m_importedResourceTypeIdMap->find(id); if (i!=m_importedResourceTypeIdMap->end()) return (*i).second; else - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -329,7 +329,7 @@ void ServerUniverse::createProxiesOnServer(std::vector const & remotePro LOG("UniverseLoading", ("Game Server %lu sent UniverseComplete to Game Servers %s.", GameServer::getInstance().getProcessId(), serverListAsString.c_str())); if (ConfigServerGame::getTimeoutToAckUniverseDataReceived() > 0) - m_timeUniverseDataSent = ::time(nullptr); + m_timeUniverseDataSent = ::time(NULL); } } else @@ -519,7 +519,7 @@ std::string ServerUniverse::generateRandomResourceName(const std::string &nameTa std::string newName(Unicode::wideToNarrow(NameManager::getInstance().generateRandomName("name_resource",nameTable))); // name generator always builds ASCII names, although it returns a Unicode string int failCount = 0; UNREF(failCount); // because of Windows release build - for(; getResourceTypeByName(newName) != nullptr; newName = Unicode::wideToNarrow(NameManager::getInstance().generateRandomName("name_resource",nameTable))) // generate names until we find an unused one + for(; getResourceTypeByName(newName) != NULL; newName = Unicode::wideToNarrow(NameManager::getInstance().generateRandomName("name_resource",nameTable))) // generate names until we find an unused one DEBUG_FATAL(++failCount > 100,("Failed to generate an unused resource name in 100 tries.\n")); return newName; @@ -725,7 +725,7 @@ void ServerUniverse::update(float frameTime) { if (!m_pendingUniverseLoadedAckList.empty()) { - time_t const nowTime = ::time(nullptr); + time_t const nowTime = ::time(NULL); int const secondsSinceUniverseDataSent = (int)(nowTime - m_timeUniverseDataSent); // don't wait forever for ack from another game server @@ -866,7 +866,7 @@ void ServerUniverse::handleAddResourceTypeMessage(AddResourceTypeMessage const & const NetworkId & ServerUniverse::findTheaterId(const std::string & name) { - if (m_theaterNameIdMap == nullptr) + if (m_theaterNameIdMap == NULL) return NetworkId::cms_invalid; TheaterNameIdMap::const_iterator result = m_theaterNameIdMap->find(name); @@ -882,7 +882,7 @@ const std::string & ServerUniverse::findTheaterName(const NetworkId & id) { static const std::string emptyString; - if (m_theaterIdNameMap == nullptr) + if (m_theaterIdNameMap == NULL) return emptyString; TheaterIdNameMap::const_iterator result = m_theaterIdNameMap->find(id); @@ -924,9 +924,9 @@ bool ServerUniverse::remoteSetTheater(const std::string & name, const NetworkId return false; } - if (m_theaterNameIdMap != nullptr) + if (m_theaterNameIdMap != NULL) m_theaterNameIdMap->insert(std::make_pair(name, id)); - if (m_theaterIdNameMap != nullptr) + if (m_theaterIdNameMap != NULL) m_theaterIdNameMap->insert(std::make_pair(id, name)); return true; } @@ -953,9 +953,9 @@ void ServerUniverse::remoteClearTheater(const std::string & name) { const NetworkId & id = findTheaterId(name); - if (m_theaterNameIdMap != nullptr) + if (m_theaterNameIdMap != NULL) m_theaterNameIdMap->erase(name); - if (m_theaterIdNameMap != nullptr) + if (m_theaterIdNameMap != NULL) m_theaterIdNameMap->erase(id); } diff --git a/engine/server/library/serverGame/src/shared/core/ServerWorld.cpp b/engine/server/library/serverGame/src/shared/core/ServerWorld.cpp index 3b76b5db..fefa1117 100755 --- a/engine/server/library/serverGame/src/shared/core/ServerWorld.cpp +++ b/engine/server/library/serverGame/src/shared/core/ServerWorld.cpp @@ -415,7 +415,7 @@ class AuthoritativeNonPlayerCreatureFilter: public SpatialSubdivisionFilterisAuthoritative() && object->asCreatureObject() != nullptr && !object->isPlayerControlled()); } + return (object->isAuthoritative() && object->asCreatureObject() != NULL && !object->isPlayerControlled()); } }; class TriggerVolumeFilter: public SpatialSubdivisionFilter @@ -905,26 +905,26 @@ ManufactureSchematicObject* ServerWorld::createNewManufacturingSchematic ( bool persisted) { CreatureObject * const creature = dynamic_cast(creator.getObject()); - if (creature == nullptr) - return nullptr; + if (creature == NULL) + return NULL; PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); - if (player == nullptr) - return nullptr; + if (player == NULL) + return NULL; const DraftSchematicObject * const draftSchematic = player->getCurrentDraftSchematic(); - if (draftSchematic == nullptr) - return nullptr; + if (draftSchematic == NULL) + return NULL; ManufactureSchematicObject * const manfSchematic = draftSchematic->createManufactureSchematic(creator); - if (manfSchematic == nullptr) - return nullptr; + if (manfSchematic == NULL) + return NULL; if (createNewObjectIntermediate(manfSchematic, container, slotId, - persisted) == nullptr) + persisted) == NULL) { delete manfSchematic; - return nullptr; + return NULL; } return manfSchematic; @@ -948,15 +948,15 @@ ManufactureSchematicObject* ServerWorld::createNewManufacturingSchematic ( { ManufactureSchematicObject * const manfSchematic = source.createManufactureSchematic(CachedNetworkId::cms_cachedInvalid); - if (manfSchematic == nullptr) - return nullptr; + if (manfSchematic == NULL) + return NULL; Transform transform; transform.setPosition_p(position); - if (createNewObjectIntermediate(manfSchematic, transform, 0, persisted) == nullptr) + if (createNewObjectIntermediate(manfSchematic, transform, 0, persisted) == NULL) { delete manfSchematic; - return nullptr; + return NULL; } return manfSchematic; @@ -980,11 +980,11 @@ ManufactureSchematicObject* ServerWorld::createNewManufacturingSchematic ( { ManufactureSchematicObject * const manfSchematic = source.createManufactureSchematic(CachedNetworkId::cms_cachedInvalid); - if (manfSchematic == nullptr) - return nullptr; + if (manfSchematic == NULL) + return NULL; - if (createNewObjectIntermediate(manfSchematic, container, persisted, false) == nullptr) - return nullptr; + if (createNewObjectIntermediate(manfSchematic, container, persisted, false) == NULL) + return NULL; return manfSchematic; } // ServerWorld::createNewManufacturingSchematic @@ -1008,11 +1008,11 @@ ServerObject* ServerWorld::createNewObjectIntermediate(ServerObject *newObject, if (newObject->getNetworkId() == NetworkId::cms_invalid) { WARNING_STRICT_FATAL(true, ("Tried to create an object with network id 0.")); - return nullptr; + return NULL; } NetworkController *objectController = dynamic_cast(newObject->getController()); - if (objectController == nullptr) + if (objectController == NULL) objectController = dynamic_cast(newObject->createDefaultController()); NOT_NULL(objectController); @@ -1022,7 +1022,7 @@ ServerObject* ServerWorld::createNewObjectIntermediate(ServerObject *newObject, if (!newObject->serverObjectInitializeFirstTimeObject(cell, transform)) { delete newObject; - return nullptr; + return NULL; } // prevent initial object data from being re-sent as deltas @@ -1057,11 +1057,11 @@ ServerObject* ServerWorld::createNewObjectIntermediate(ServerObject* newObject, if (newObject->getNetworkId() == NetworkId::cms_invalid) { WARNING_STRICT_FATAL(true, ("Tried to create an object with network id 0.")); - return nullptr; + return NULL; } NetworkController *objectController = dynamic_cast(newObject->getController()); - if (objectController == nullptr) + if (objectController == NULL) objectController = dynamic_cast(newObject->createDefaultController()); NOT_NULL(objectController); @@ -1073,10 +1073,10 @@ ServerObject* ServerWorld::createNewObjectIntermediate(ServerObject* newObject, // prevent initial object data from being re-sent as deltas newObject->clearDeltas(); Container::ContainerErrorCode tmp = Container::CEC_Success; - if (!ContainerInterface::transferItemToGeneralContainer(container, *newObject, nullptr, tmp, allowOverload)) + if (!ContainerInterface::transferItemToGeneralContainer(container, *newObject, NULL, tmp, allowOverload)) { IGNORE_RETURN(newObject->permanentlyDestroy(DeleteReasons::BadContainerTransfer)); - newObject = nullptr; + newObject = NULL; } else { @@ -1101,13 +1101,13 @@ ServerObject* ServerWorld::createNewObjectIntermediate(ServerObject* newObject, if (newObject->getNetworkId() == NetworkId::cms_invalid) { WARNING_STRICT_FATAL(true, ("Tried to create an object with network id 0.")); - return nullptr; + return NULL; } { PROFILER_AUTO_BLOCK_DEFINE("createNewObjectIntermedate,getController"); NetworkController *objectController = dynamic_cast(newObject->getController()); - if (objectController == nullptr) + if (objectController == NULL) objectController = dynamic_cast(newObject->createDefaultController()); NOT_NULL(objectController); } @@ -1130,11 +1130,11 @@ ServerObject* ServerWorld::createNewObjectIntermediate(ServerObject* newObject, { PROFILER_AUTO_BLOCK_DEFINE("transferItem"); Container::ContainerErrorCode tmp = Container::CEC_Success; - if (!ContainerInterface::transferItemToSlottedContainer(container, *newObject, slotId, nullptr, tmp)) + if (!ContainerInterface::transferItemToSlottedContainer(container, *newObject, slotId, NULL, tmp)) { PROFILER_AUTO_BLOCK_DEFINE("failedTransfer"); IGNORE_RETURN(newObject->permanentlyDestroy(DeleteReasons::BadContainerTransfer)); - newObject = nullptr; + newObject = NULL; } else { @@ -1189,7 +1189,7 @@ ServerObject* ServerWorld::createProxyObject(uint32 templateCrc, const NetworkId if(newObject) { ServerController *objectController = dynamic_cast(newObject->getController()); - if (objectController == nullptr) + if (objectController == NULL) objectController = dynamic_cast(newObject->createDefaultController()); NOT_NULL(objectController); @@ -1455,10 +1455,10 @@ static void _isObjectInConeLoopSetup(const Object & coneCenterObject, const Loca // NOTE: all calculations are made within the object space of coneCenterObject. //-- Compute cone axis vector. - const ServerObject * cell = nullptr; + const ServerObject * cell = NULL; if (coneDirection.getCell() != NetworkId::cms_invalid) cell = safe_cast(NetworkIdManager::getObjectById(coneDirection.getCell())); - if (cell == nullptr) + if (cell == NULL) coneAxisVector = coneCenterObject.rotateTranslate_w2o(coneDirection.getCoordinates()); else { @@ -1984,7 +1984,7 @@ CellProperty const * ServerWorld::findCellAtLocation(const Vector & location_w) */ ServerObject *ServerWorld::findClosestObjectInList(const Vector &location, const std::vector &candidates) { - if (candidates.empty()) return nullptr; + if (candidates.empty()) return NULL; typedef std::vector CandidatesType; @@ -2097,7 +2097,7 @@ void ServerWorld::install() data.installExtents = true; data.installCollisionWorld = true; - data.playEffect = nullptr; + data.playEffect = NULL; data.isPlayerHouse = &isPlayerHouseHook; data.serverSide = true; @@ -2187,7 +2187,7 @@ void ServerWorld::install() m_sceneId = new std::string(ConfigServerGame::getSceneID()); - Pvp::getScheduler().setCallback(Pvp::updateTimedFlags, nullptr, ConfigServerGame::getPvpUpdateTimeMs()); + Pvp::getScheduler().setCallback(Pvp::updateTimedFlags, NULL, ConfigServerGame::getPvpUpdateTimeMs()); NebulaManagerServer::loadScene(*m_sceneId); @@ -2420,7 +2420,7 @@ void ServerWorld::triggerMovingTriggers(ServerObject &movingObject, Vector const clcount++; } - if (object != nullptr) + if (object != NULL) t->moveTriggerVolume(*object, start, end); } DEBUG_REPORT_LOG(ms_logTriggerStats, (" Creature count: %d Client count: %d\n", crcount, clcount)); @@ -2559,8 +2559,8 @@ void ServerWorld::remove() gs_pendingConcludeVector.clear(); - CollisionWorld::setNearWarpWarningCallback(nullptr); - CollisionWorld::setFarWarpWarningCallback(nullptr); + CollisionWorld::setNearWarpWarningCallback(NULL); + CollisionWorld::setFarWarpWarningCallback(NULL); Pvp::remove(); @@ -2629,7 +2629,7 @@ void ServerWorld::removeObjectFromGame(const ServerObject& object) void ServerWorld::removeTangibleObject(ServerObject *object) { PROFILER_AUTO_BLOCK_DEFINE("ServerWorld::removeTangibleObject"); - DEBUG_WARNING(!object, ("removeTangibleObject() was called with a nullptr object parameter, this is probably not what the program intended to do")); + DEBUG_WARNING(!object, ("removeTangibleObject() was called with a NULL object parameter, this is probably not what the program intended to do")); if (!object) return; @@ -2643,7 +2643,7 @@ void ServerWorld::removeTangibleObject(ServerObject *object) // if the object is being destroyed, the trigger has already gone off // player creatures aren't destroyed before being removed, so it's safe to invoke // the trigger here - if (object->isAuthoritative() && (object->getScriptObject() != nullptr) && !object->isBeingDestroyed()) + if (object->isAuthoritative() && (object->getScriptObject() != NULL) && !object->isBeingDestroyed()) { ScriptParams params; IGNORE_RETURN(object->getScriptObject()->trigAllScripts(Scripting::TRIG_REMOVING_FROM_WORLD, params)); @@ -2897,7 +2897,7 @@ void ServerWorld::update(real time) for(concludeIter = gs_pendingConcludeVector.begin(); concludeIter != gs_pendingConcludeVector.end(); ++concludeIter) { ServerObject *o = (*concludeIter)->asServerObject(); - WARNING_STRICT_FATAL(!o, ("nullptr object in conclude list!")); + WARNING_STRICT_FATAL(!o, ("NULL object in conclude list!")); if (o) { if (o->isInitialized()) diff --git a/engine/server/library/serverGame/src/shared/core/SetupServerGame.cpp b/engine/server/library/serverGame/src/shared/core/SetupServerGame.cpp index 7a047ac5..a8dadf30 100755 --- a/engine/server/library/serverGame/src/shared/core/SetupServerGame.cpp +++ b/engine/server/library/serverGame/src/shared/core/SetupServerGame.cpp @@ -65,8 +65,8 @@ void SetupServerGame::install() PositionUpdateTracker::install(); LogoutTracker::install(); AuthTransferTracker::install(); - NonCriticalTaskQueue::install(static_cast(nullptr)); - SurveySystem::install(static_cast(nullptr)); + NonCriticalTaskQueue::install(static_cast(NULL)); + SurveySystem::install(static_cast(NULL)); CreatureObject::install(); NameManager::install(); MessageToQueue::install(); diff --git a/engine/server/library/serverGame/src/shared/core/StaticLootItemManager.cpp b/engine/server/library/serverGame/src/shared/core/StaticLootItemManager.cpp index 9da3852f..8202f8d1 100755 --- a/engine/server/library/serverGame/src/shared/core/StaticLootItemManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/StaticLootItemManager.cpp @@ -26,8 +26,8 @@ int const MAX_ATTRIBS = 2000; void StaticLootItemManager::sendDataToClient(NetworkId const & playerId, std::string const & staticItemName) { Object * const o = NetworkIdManager::getObjectById(playerId); - ServerObject * const so = o ? o->asServerObject() : nullptr; - CreatureObject * const co = so ? so->asCreatureObject() : nullptr; + ServerObject * const so = o ? o->asServerObject() : NULL; + CreatureObject * const co = so ? so->asCreatureObject() : NULL; if(co) { @@ -45,8 +45,8 @@ void StaticLootItemManager::sendDataToClient(NetworkId const & playerId, std::st void StaticLootItemManager::getAttributes(NetworkId const & playerId, std::string const & staticItemName, AttributeVector & data) { Object * const o = NetworkIdManager::getObjectById(playerId); - ServerObject * const so = o ? o->asServerObject() : nullptr; - CreatureObject * const co = so ? so->asCreatureObject() : nullptr; + ServerObject * const so = o ? o->asServerObject() : NULL; + CreatureObject * const co = so ? so->asCreatureObject() : NULL; if(co) { GameScriptObject * const gso = const_cast(co->getScriptObject()); diff --git a/engine/server/library/serverGame/src/shared/core/VeteranRewardManager.cpp b/engine/server/library/serverGame/src/shared/core/VeteranRewardManager.cpp index fcc97af2..c9bb11a0 100755 --- a/engine/server/library/serverGame/src/shared/core/VeteranRewardManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/VeteranRewardManager.cpp @@ -312,7 +312,7 @@ RewardEvent * VeteranRewardManagerNamespace::getRewardEventByName(std::string co if (i!=ms_rewardEvents.end()) return i->second; else - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -323,7 +323,7 @@ RewardItem * VeteranRewardManagerNamespace::getRewardItemByName(std::string cons if (i!=ms_rewardItems.end()) return i->second; else - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -389,7 +389,7 @@ void VeteranRewardManager::getTriggeredEventsIds(CreatureObject const & playerCr if (((*i)->getAccountFeatureId() > 0) && (*i)->getConsumeAccountFeatureId()) { std::vector rewardItems; - getAvailableRewardItemsForEvent(playerCreature, (*i)->getId(), rewardItems, nullptr); + getAvailableRewardItemsForEvent(playerCreature, (*i)->getId(), rewardItems, NULL); if (rewardItems.empty()) continue; @@ -512,7 +512,7 @@ bool VeteranRewardManager::claimRewards(CreatureObject const & playerCreature, s } std::vector possibleRewardItems; - getAvailableRewardItemsForEvent(playerCreature, rewardEventName, possibleRewardItems, nullptr); + getAvailableRewardItemsForEvent(playerCreature, rewardEventName, possibleRewardItems, NULL); if (possibleRewardItems.empty()) { if (debugMessage) @@ -589,7 +589,7 @@ void VeteranRewardManager::handleClaimRewardsReply(StationId stationId, NetworkI static std::vector const emptyMessageData; ServerObject * const so = safe_cast(NetworkIdManager::getObjectById(player)); - CreatureObject * const playerCreature = so ? so->asCreatureObject() : nullptr; + CreatureObject * const playerCreature = so ? so->asCreatureObject() : NULL; if (!playerCreature) return; // player has vanished -- reward claim will be handled by the recovery code at the next login if (!playerCreature->isAuthoritative()) @@ -628,7 +628,7 @@ void VeteranRewardManager::handleClaimRewardsReply(StationId stationId, NetworkI // Check that the requested item can be claimed with this event std::vector possibleRewardItems; - getAvailableRewardItemsForEvent(*playerCreature, rewardEvent, possibleRewardItems, nullptr); + getAvailableRewardItemsForEvent(*playerCreature, rewardEvent, possibleRewardItems, NULL); bool found = false; for (std::vector::const_iterator j=possibleRewardItems.begin(); j!=possibleRewardItems.end(); ++j) @@ -704,7 +704,7 @@ void VeteranRewardManager::handleClaimRewardsReply(StationId stationId, NetworkI params.addParam(item->getCanTradeIn(), "canTradeIn"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != nullptr) + if (dictionary.get() != NULL) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(player, "veteranItemGrantSucceeded",dictionary->getSerializedData(),0,false); @@ -808,11 +808,11 @@ time_t VeteranRewardManagerNamespace::yyyymmddToTime(int const yyyy, int const m FATAL(((mm < 1) || (mm > 12)),("Data bug: Reward event date (%d / %d / %d) - month %d specified for a reward event must be between 1 - 12.",mm,dd,yyyy,mm)); FATAL(((dd < 1) || (dd > 31)),("Data bug: Reward event date (%d / %d / %d) - day %d specified for a reward event must be between 1 - 31.",mm,dd,yyyy,dd)); - time_t const rawtime = ::time(nullptr); + time_t const rawtime = ::time(NULL); struct tm * const timeinfo = ::localtime(&rawtime); if (!timeinfo) { - FATAL(true,(":localtime() returns nullptr")); + FATAL(true,(":localtime() returns NULL")); return 0; } @@ -848,7 +848,7 @@ void VeteranRewardManager::getRewardChoicesTags(CreatureObject const & playerCre std::vector rewardItems; - getAvailableRewardItemsForEvent(playerCreature, eventName, rewardItems, nullptr); + getAvailableRewardItemsForEvent(playerCreature, eventName, rewardItems, NULL); for (std::vector::const_iterator i=rewardItems.begin(); i!=rewardItems.end(); ++i) { rewardTagsUnicode.push_back(Unicode::narrowToWide(*i)); @@ -866,7 +866,7 @@ StringId const * VeteranRewardManager::getEventAnnouncement(std::string const & { return &(event->getAnnouncement()); } - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -880,7 +880,7 @@ StringId const * VeteranRewardManager::getEventDescription(std::string const & e { return &(event->getDescription()); } - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -894,7 +894,7 @@ std::string const * VeteranRewardManager::getEventUrl(std::string const & eventN { return &(event->getUrl()); } - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -1147,7 +1147,7 @@ void VeteranRewardManager::tcgRedemption(CreatureObject const & playerCreature, // the redemption int const redemptionTimeout = 300; // 5 minutes; item.removeObjVarItem(ms_tcgRedemptionInProgressObjvar); - item.setObjVarItem(ms_tcgRedemptionInProgressObjvar, static_cast(::time(nullptr) + redemptionTimeout)); // 5 minutes + item.setObjVarItem(ms_tcgRedemptionInProgressObjvar, static_cast(::time(NULL) + redemptionTimeout)); // 5 minutes // send off request to adjust the account feature Id AdjustAccountFeatureIdRequest const msg(NetworkId::cms_invalid, GameServer::getInstance().getProcessId(), playerCreature.getNetworkId(), PlayerObject::getAccountDescription(&playerCreature), playerPlayer->getStationId(), item.getNetworkId(), ServerObject::getLogDescription(&item), PlatformGameCode::SWGTCG, static_cast(featureId), adjustment); @@ -1169,7 +1169,7 @@ bool VeteranRewardManager::checkForTcgRedemptionInProgress(ServerObject const & int redemptionTimeout; IGNORE_RETURN(item.getObjVars().getItem(ms_tcgRedemptionInProgressObjvar, redemptionTimeout)); - time_t const currentTime = ::time(nullptr); + time_t const currentTime = ::time(NULL); if (redemptionTimeout > currentTime) { // item should be in top level inventory; get the player object the item is in @@ -1308,7 +1308,7 @@ bool VeteranRewardManager::tradeInReward(CreatureObject const & playerCreature, if (itemClaimTime > 0) { time_t timeRedeem = itemClaimTime + static_cast(ConfigServerGame::getVeteranRewardTradeInWaitPeriodSeconds()); - time_t const timeNow = ::time(nullptr); + time_t const timeNow = ::time(NULL); // see if the item has its own trade-in wait period if (itemObjvar.hasItem("rewardTradeInWaitPeriod") && (itemObjvar.getType("rewardTradeInWaitPeriod") == DynamicVariable::INT)) @@ -1337,7 +1337,7 @@ bool VeteranRewardManager::tradeInReward(CreatureObject const & playerCreature, // the trade in int const redemptionTimeout = 300; // 5 minutes; item.removeObjVarItem(ms_tradeInInProgressObjvar); - item.setObjVarItem(ms_tradeInInProgressObjvar, static_cast(::time(nullptr) + redemptionTimeout)); // 5 minutes + item.setObjVarItem(ms_tradeInInProgressObjvar, static_cast(::time(NULL) + redemptionTimeout)); // 5 minutes // send off request to adjust the account feature Id AdjustAccountFeatureIdRequest const msg(NetworkId::cms_invalid, GameServer::getInstance().getProcessId(), playerCreature.getNetworkId(), PlayerObject::getAccountDescription(&playerCreature), playerPlayer->getStationId(), item.getNetworkId(), ServerObject::getLogDescription(&item), PlatformGameCode::SWG, static_cast(featureId), 1); @@ -1361,7 +1361,7 @@ bool VeteranRewardManager::checkForTradeInInProgress(ServerObject const & item) int redemptionTimeout; IGNORE_RETURN(item.getObjVars().getItem(ms_tradeInInProgressObjvar, redemptionTimeout)); - time_t const currentTime = ::time(nullptr); + time_t const currentTime = ::time(NULL); if (redemptionTimeout > currentTime) { // item should be in top level inventory; get the player object the item is in @@ -1742,7 +1742,7 @@ RewardEvent::RewardEvent(DataTable const & dataTable, int row) : m_id(dataTable.getStringValue("id",row)), m_specificItems(buildVectorFromString(dataTable.getStringValue("Items",row))), m_includeItemsFrom(buildVectorFromString(dataTable.getStringValue("Include Items From",row))), - m_allItems(nullptr), + m_allItems(NULL), m_category(dataTable.getIntValue("Category", row)), m_featureBitRewardExclusionMask(dataTable.getIntValue("Feature Bit Reward Exclusion Mask", row)), m_accountFlags(static_cast(dataTable.getIntValue("Account Flags",row))), @@ -1839,7 +1839,7 @@ bool RewardEvent::hasPlayerTriggered(CreatureObject const & playerCreature) cons if (m_startDate != 0 || m_endDate != 0) { - time_t currentTime = time(nullptr); + time_t currentTime = time(NULL); if ((m_startDate != 0 && currentTime < m_startDate) || (m_endDate != 0 && currentTime > m_endDate)) return false; diff --git a/engine/server/library/serverGame/src/shared/guild/GuildInterface.cpp b/engine/server/library/serverGame/src/shared/guild/GuildInterface.cpp index 7f8f07c8..f30669aa 100755 --- a/engine/server/library/serverGame/src/shared/guild/GuildInterface.cpp +++ b/engine/server/library/serverGame/src/shared/guild/GuildInterface.cpp @@ -43,11 +43,11 @@ namespace GuildInterfaceNamespace bool s_needEnemiesRebuild; // dictionary containing the table showing all active guild wars with at least 1 kill - ScriptParams * s_activeGuildWars = nullptr; + ScriptParams * s_activeGuildWars = NULL; bool s_activeGuildWarsNeedRebuild = true; // dictionary containing the table showing the 100 most recently ended guild wars with at least 1 kill - ScriptParams * s_inactiveGuildWars = nullptr; + ScriptParams * s_inactiveGuildWars = NULL; int s_inactiveGuildWarsMostRecentUpdateIndex = 0; typedef std::map PendingChannelAddList; //using a map to make it easier to prevent redundant entries @@ -99,7 +99,7 @@ namespace GuildInterfaceNamespace const char * makeCopyOfString(const char * rhs) { - char * lhs = nullptr; + char * lhs = NULL; if (rhs) { lhs = new char[strlen(rhs) + 1]; @@ -245,7 +245,7 @@ std::pair const *GuildInterface::hasDeclaredWarAgainst(int actorGui } } - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -662,7 +662,7 @@ ScriptParams const *GuildInterface::getMasterGuildWarTableDictionary() } delete s_activeGuildWars; - s_activeGuildWars = nullptr; + s_activeGuildWars = NULL; // build the table if (!guildMutuallyAtWarWithKillSummary.empty()) @@ -810,9 +810,9 @@ void GuildInterface::updateInactiveGuildWarTrackingInfo(GuildObject &masterGuild // guild with higher kill count appears first if (guildAKillCount > guildBKillCount) - IGNORE_RETURN(masterGuildObject.setObjVarItem(FormattedString<32>().sprintf("%s.%d", s_objvarInactiveGuildWarsPrefix.c_str(), nextIndex), FormattedString<512>().sprintf("%s~%s~%d~%s~%s~%d~%ld", giA->m_name.c_str(), giA->m_abbrev.c_str(), guildAKillCount, giB->m_name.c_str(), giB->m_abbrev.c_str(), guildBKillCount, ::time(nullptr)))); + IGNORE_RETURN(masterGuildObject.setObjVarItem(FormattedString<32>().sprintf("%s.%d", s_objvarInactiveGuildWarsPrefix.c_str(), nextIndex), FormattedString<512>().sprintf("%s~%s~%d~%s~%s~%d~%ld", giA->m_name.c_str(), giA->m_abbrev.c_str(), guildAKillCount, giB->m_name.c_str(), giB->m_abbrev.c_str(), guildBKillCount, ::time(NULL)))); else - IGNORE_RETURN(masterGuildObject.setObjVarItem(FormattedString<32>().sprintf("%s.%d", s_objvarInactiveGuildWarsPrefix.c_str(), nextIndex), FormattedString<512>().sprintf("%s~%s~%d~%s~%s~%d~%ld", giB->m_name.c_str(), giB->m_abbrev.c_str(), guildBKillCount, giA->m_name.c_str(), giA->m_abbrev.c_str(), guildAKillCount, ::time(nullptr)))); + IGNORE_RETURN(masterGuildObject.setObjVarItem(FormattedString<32>().sprintf("%s.%d", s_objvarInactiveGuildWarsPrefix.c_str(), nextIndex), FormattedString<512>().sprintf("%s~%s~%d~%s~%s~%d~%ld", giB->m_name.c_str(), giB->m_abbrev.c_str(), guildBKillCount, giA->m_name.c_str(), giA->m_abbrev.c_str(), guildAKillCount, ::time(NULL)))); IGNORE_RETURN(masterGuildObject.setObjVarItem(s_objvarInactiveGuildWarsMostRecentIndex, nextIndex)); } @@ -869,7 +869,7 @@ ScriptParams const *GuildInterface::getInactiveGuildWarTableDictionary() if (!objVars.getItem(FormattedString<32>().sprintf("%s.%d", s_objvarInactiveGuildWarsPrefix.c_str(), currentIndex), guildWarData)) break; - if (!Unicode::tokenize(guildWarData, tokens, &delimiters, nullptr) || (tokens.size() != 7)) + if (!Unicode::tokenize(guildWarData, tokens, &delimiters, NULL) || (tokens.size() != 7)) break; scriptParamsGuildAName->push_back(new Unicode::String(tokens[0])); @@ -891,7 +891,7 @@ ScriptParams const *GuildInterface::getInactiveGuildWarTableDictionary() } delete s_inactiveGuildWars; - s_inactiveGuildWars = nullptr; + s_inactiveGuildWars = NULL; if (!scriptParamsGuildAName->empty()) { @@ -1120,7 +1120,7 @@ void GuildInterface::updateGuildWarKillTracking(CreatureObject const &killer, Cr && hasDeclaredWarAgainst(killer.getGuildId(), victim.getGuildId()) && hasDeclaredWarAgainst(victim.getGuildId(), killer.getGuildId())) { - ServerUniverse::getInstance().getMasterGuildObject()->modifyGuildWarKillTracking(killer.getGuildId(), victim.getGuildId(), 1, static_cast(::time(nullptr))); + ServerUniverse::getInstance().getMasterGuildObject()->modifyGuildWarKillTracking(killer.getGuildId(), victim.getGuildId(), 1, static_cast(::time(NULL))); } } diff --git a/engine/server/library/serverGame/src/shared/metrics/GameServerMetricsData.cpp b/engine/server/library/serverGame/src/shared/metrics/GameServerMetricsData.cpp index 170181d6..96c0d19b 100755 --- a/engine/server/library/serverGame/src/shared/metrics/GameServerMetricsData.cpp +++ b/engine/server/library/serverGame/src/shared/metrics/GameServerMetricsData.cpp @@ -239,7 +239,7 @@ void GameServerMetricsData::updateData() "Max: %s requested load on %s which has been pending for %s. Limit = %d.", id.getValueString().c_str(), CalendarTime::convertEpochToTimeStringLocal(oldestPendingLoadRequestTime).c_str(), - CalendarTime::convertSecondsToMS((int)::time(nullptr) - oldestPendingLoadRequestTime).c_str(), + CalendarTime::convertSecondsToMS((int)::time(NULL) - oldestPendingLoadRequestTime).c_str(), GameServer::getPendingLoadRequestLimit() ); else diff --git a/engine/server/library/serverGame/src/shared/network/Chat.cpp b/engine/server/library/serverGame/src/shared/network/Chat.cpp index fede9920..209ee89d 100755 --- a/engine/server/library/serverGame/src/shared/network/Chat.cpp +++ b/engine/server/library/serverGame/src/shared/network/Chat.cpp @@ -64,7 +64,7 @@ using namespace ChatNamespace; //----------------------------------------------------------------------- -Chat *Chat::m_instance = nullptr; +Chat *Chat::m_instance = NULL; Chat::Chat () : diff --git a/engine/server/library/serverGame/src/shared/network/ConnectionServerConnection.cpp b/engine/server/library/serverGame/src/shared/network/ConnectionServerConnection.cpp index f47cfe43..b6af7d42 100755 --- a/engine/server/library/serverGame/src/shared/network/ConnectionServerConnection.cpp +++ b/engine/server/library/serverGame/src/shared/network/ConnectionServerConnection.cpp @@ -194,7 +194,7 @@ void ConnectionServerConnection::onReceive (const Archive::ByteStream & message) } } else - LOG("CustomerService", ("CharacterTransfer: character object was nullptr so unable to check if bank is loaded")); + LOG("CustomerService", ("CharacterTransfer: character object was NULL so unable to check if bank is loaded")); } @@ -224,10 +224,10 @@ void ConnectionServerConnection::onReceive (const Archive::ByteStream & message) } } else - LOG("CustomerService", ("CharacterTransfer: bank container object was nullptr for getBankContainer call")); + LOG("CustomerService", ("CharacterTransfer: bank container object was NULL for getBankContainer call")); } else - LOG("CustomerService", ("CharacterTransfer: character object was nullptr so unable to check if bank is loaded")); + LOG("CustomerService", ("CharacterTransfer: character object was NULL so unable to check if bank is loaded")); } else if (m.isType("RequestTransferData")) { @@ -237,7 +237,7 @@ void ConnectionServerConnection::onReceive (const Archive::ByteStream & message) CreatureObject * const character = dynamic_cast(NetworkIdManager::getObjectById(requestTransferData.getValue().getCharacterId())); PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(character); time_t characterCreateTime = -1; - FreeCtsDataTable::FreeCtsInfo const * freeCtsInfo = nullptr; + FreeCtsDataTable::FreeCtsInfo const * freeCtsInfo = NULL; bool freeCtsBypassTimeRestriction = false; if (character && playerObject) { @@ -292,7 +292,7 @@ void ConnectionServerConnection::onReceive (const Archive::ByteStream & message) for (CreatureObject::SkillList::const_iterator i = skills.begin(); i != skills.end(); ++i) { const SkillObject * profession = (*i)->findProfessionForSkill(); - if (profession != nullptr) + if (profession != NULL) professionName = profession->getSkillName(); } } @@ -414,7 +414,7 @@ void ConnectionServerConnection::onReceive (const Archive::ByteStream & message) unsigned int result = CHATRESULT_SUCCESS; ServerObject const * const o = ServerWorld::findObjectByNetworkId(cervreq.getValue().first.first); - CreatureObject const * const co = (o ? o->asCreatureObject() : nullptr); + CreatureObject const * const co = (o ? o->asCreatureObject() : NULL); if (co) { result = Chat::isAllowedToEnterRoom(*co, cervreq.getValue().first.second); @@ -440,7 +440,7 @@ void ConnectionServerConnection::onReceive (const Archive::ByteStream & message) bool success = false; ServerObject const * const o = ServerWorld::findObjectByNetworkId(cqrvreq.getValue().first.first); - CreatureObject const * const co = (o ? o->asCreatureObject() : nullptr); + CreatureObject const * const co = (o ? o->asCreatureObject() : NULL); if (co) { success = (CHATRESULT_SUCCESS == Chat::isAllowedToEnterRoom(*co, cqrvreq.getValue().first.second)); diff --git a/engine/server/library/serverGame/src/shared/network/CustomerServiceServerConnection.cpp b/engine/server/library/serverGame/src/shared/network/CustomerServiceServerConnection.cpp index cb1df8fd..456ec031 100755 --- a/engine/server/library/serverGame/src/shared/network/CustomerServiceServerConnection.cpp +++ b/engine/server/library/serverGame/src/shared/network/CustomerServiceServerConnection.cpp @@ -58,12 +58,12 @@ void CustomerServiceServerConnection::onReceive(const Archive::ByteStream & mess ChatRequestLog chatRequestLog(ri); Object * const reportingObject = NetworkIdManager::getObjectById(NetworkId(Unicode::wideToNarrow(chatRequestLog.getPlayer()))); - if ( (reportingObject != nullptr) + if ( (reportingObject != NULL) && reportingObject->isAuthoritative()) { PlayerObject const * const reportingPlayerObject = PlayerCreatureController::getPlayerObject(CreatureObject::asCreatureObject(reportingObject)); - if (reportingPlayerObject != nullptr) + if (reportingPlayerObject != NULL) { PlayerObject::ChatLog const &reportingPlayerChatLog = reportingPlayerObject->getChatLog(); PlayerObject::ChatLog::const_iterator iterReportingPlayerChatLog = reportingPlayerChatLog.begin(); diff --git a/engine/server/library/serverGame/src/shared/network/GameServerMessageArchive.cpp b/engine/server/library/serverGame/src/shared/network/GameServerMessageArchive.cpp index d66d70fb..bf76972f 100755 --- a/engine/server/library/serverGame/src/shared/network/GameServerMessageArchive.cpp +++ b/engine/server/library/serverGame/src/shared/network/GameServerMessageArchive.cpp @@ -31,7 +31,7 @@ GameServerMessageArchive::~GameServerMessageArchive() void GameServerMessageArchive::install() { - if (getInstance() == nullptr) + if (getInstance() == NULL) { setInstance(new GameServerMessageArchive); ExitChain::add(GameServerMessageArchive::remove, "GameServerMessageArchive::remove"); diff --git a/engine/server/library/serverGame/src/shared/object/BuildingObject.cpp b/engine/server/library/serverGame/src/shared/object/BuildingObject.cpp index cdc6289f..ed2eb7de 100755 --- a/engine/server/library/serverGame/src/shared/object/BuildingObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/BuildingObject.cpp @@ -140,7 +140,7 @@ using namespace BuildingObjectNamespace; // ====================================================================== -const SharedObjectTemplate * BuildingObject::m_defaultSharedTemplate = nullptr; +const SharedObjectTemplate * BuildingObject::m_defaultSharedTemplate = NULL; // ====================================================================== @@ -380,13 +380,13 @@ const SharedObjectTemplate * BuildingObject::getDefaultSharedTemplate(void) cons { static const ConstCharCrcLowerString templateName("object/building/base/shared_building_default.iff"); - if (m_defaultSharedTemplate == nullptr) + if (m_defaultSharedTemplate == NULL) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create " + WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create " "default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != nullptr) + if (m_defaultSharedTemplate != NULL) ExitChain::add (removeDefaultTemplate, "BuildingObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -399,10 +399,10 @@ static const ConstCharCrcLowerString templateName("object/building/base/shared_b */ void BuildingObject::removeDefaultTemplate(void) { - if (m_defaultSharedTemplate != nullptr) + if (m_defaultSharedTemplate != NULL) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = nullptr; + m_defaultSharedTemplate = NULL; } } // BuildingObject::removeDefaultTemplate @@ -432,7 +432,7 @@ void BuildingObject::expelObject(ServerObject &who) if (controller) { CellProperty *parentCell = getParentCell(); - ServerObject *destinationCellObject = nullptr; + ServerObject *destinationCellObject = NULL; if (!parentCell->isWorldCell()) destinationCellObject = safe_cast(&parentCell->getOwner()); @@ -902,7 +902,7 @@ void BuildingObject::changeTeleportDestination(Vector & position, float & yaw) c { DataTable * respawnTable = DataTableManager::getTable(CLONE_RESPAWN_TABLE, true); - if (respawnTable != nullptr) + if (respawnTable != NULL) { int row = respawnTable->searchColumnString(0, getTemplateName()); if (row >= 0) diff --git a/engine/server/library/serverGame/src/shared/object/CellObject.cpp b/engine/server/library/serverGame/src/shared/object/CellObject.cpp index e0211aa5..b2c6f994 100755 --- a/engine/server/library/serverGame/src/shared/object/CellObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/CellObject.cpp @@ -39,7 +39,7 @@ #include -const SharedObjectTemplate * CellObject::m_defaultSharedTemplate = nullptr; +const SharedObjectTemplate * CellObject::m_defaultSharedTemplate = NULL; // ====================================================================== @@ -99,13 +99,13 @@ const SharedObjectTemplate * CellObject::getDefaultSharedTemplate(void) const { static const ConstCharCrcLowerString templateName("object/cell/base/shared_cell_default.iff"); - if (m_defaultSharedTemplate == nullptr) + if (m_defaultSharedTemplate == NULL) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create " + WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create " "default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != nullptr) + if (m_defaultSharedTemplate != NULL) ExitChain::add (removeDefaultTemplate, "CellObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -118,10 +118,10 @@ static const ConstCharCrcLowerString templateName("object/cell/base/shared_cell_ */ void CellObject::removeDefaultTemplate(void) { - if (m_defaultSharedTemplate != nullptr) + if (m_defaultSharedTemplate != NULL) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = nullptr; + m_defaultSharedTemplate = NULL; } } // CellObject::removeDefaultTemplate @@ -161,7 +161,7 @@ void CellObject::endBaselines() } Object *container = ContainerInterface::getContainedByObject(*this); - PortalProperty *portalProperty = nullptr; + PortalProperty *portalProperty = NULL; if (container) { portalProperty = container->getPortalProperty(); @@ -531,31 +531,31 @@ bool CellObject::isAllowed(CreatureObject const &who) const bool CellObject::getClosestPathNodePos( const ServerObject & object, Vector & outPos ) const { - const PathNode * closestNode = nullptr; + const PathNode * closestNode = NULL; float closestDistance = 0; const Vector objectPos = object.getPosition_w(); const CellProperty * cell = ContainerInterface::getCell(*this); - if (cell != nullptr) + if (cell != NULL) { const Floor * floor = cell->getFloor(); - if (floor != nullptr) + if (floor != NULL) { const FloorMesh * mesh = floor->getFloorMesh(); - if (mesh != nullptr) + if (mesh != NULL) { const PathGraph * path = safe_cast(mesh->getPathGraph()); - if (path != nullptr) + if (path != NULL) { int nodeCount = path->getNodeCount(); for (int i = 0; i < nodeCount; ++i) { const PathNode * node = path->getNode(i); - if (node != nullptr) + if (node != NULL) { float distance = objectPos.magnitudeBetweenSquared( rotateTranslate_p2w(node->getPosition_p())); - if (closestNode == nullptr || distance < closestDistance) + if (closestNode == NULL || distance < closestDistance) { closestNode = node; closestDistance = distance; @@ -567,9 +567,9 @@ bool CellObject::getClosestPathNodePos( const ServerObject & object, Vector & ou } } - if (closestNode != nullptr) + if (closestNode != NULL) outPos = closestNode->getPosition_p(); - return closestNode != nullptr; + return closestNode != NULL; } // ---------------------------------------------------------------------- @@ -648,7 +648,7 @@ void CellObject::onContainerLostItem(ServerObject * destination, ServerObject& i obj->getScriptObject()->trigAllScripts(Scripting::TRIG_LOST_ITEM, params); BuildingObject * const b_obj = getOwnerBuilding(); - if (b_obj && item.isPlayerControlled() && destination == nullptr) + if (b_obj && item.isPlayerControlled() && destination == NULL) { b_obj->lostPlayer(item); } @@ -772,8 +772,8 @@ CellObject * CellObject::getCellObject(NetworkId const & networkId) CellObject * CellObject::asCellObject(Object * object) { - ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - CellObject * const cellObject = (serverObject != nullptr) ? serverObject->asCellObject() : nullptr; + ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + CellObject * const cellObject = (serverObject != NULL) ? serverObject->asCellObject() : NULL; return cellObject; } @@ -782,8 +782,8 @@ CellObject * CellObject::asCellObject(Object * object) CellObject const * CellObject::asCellObject(Object const * object) { - ServerObject const * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - CellObject const * const cellObject = (serverObject != nullptr) ? serverObject->asCellObject() : nullptr; + ServerObject const * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + CellObject const * const cellObject = (serverObject != NULL) ? serverObject->asCellObject() : NULL; return cellObject; } diff --git a/engine/server/library/serverGame/src/shared/object/CityObject.cpp b/engine/server/library/serverGame/src/shared/object/CityObject.cpp index da741dbf..f8fd1778 100755 --- a/engine/server/library/serverGame/src/shared/object/CityObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/CityObject.cpp @@ -130,9 +130,9 @@ void CityObject::setupUniverse() // build the city info from data read in from DB // disable notification while building the initial list - m_citizensInfo.setOnErase(nullptr, nullptr); - m_citizensInfo.setOnInsert(nullptr, nullptr); - m_citizensInfo.setOnSet(nullptr, nullptr); + m_citizensInfo.setOnErase(NULL, NULL); + m_citizensInfo.setOnInsert(NULL, NULL); + m_citizensInfo.setOnSet(NULL, NULL); // build cities std::map tempCities; @@ -462,7 +462,7 @@ int CityObject::createCity(std::string const &cityName, NetworkId const &cityHal incomeTax, propertyTax, salesTax, travelLoc, travelCost, travelInterplanetary, cloneLoc, cloneRespawn, cloneRespawnCell, cloneId); - ci.setCityCreationTime(static_cast(::time(nullptr))); + ci.setCityCreationTime(static_cast(::time(NULL))); m_citiesInfo.set(cityId, ci); std::string citySpec; @@ -1724,7 +1724,7 @@ CitizenInfo const * CityObject::getCitizenSpec(int cityId, NetworkId const &citi } result.clear(); - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -1739,7 +1739,7 @@ CityStructureInfo const * CityObject::getCityStructureSpec(int cityId, NetworkId } result.clear(); - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -1975,7 +1975,7 @@ CitizenInfo const *CityObject::getCitizenInfo(int cityId, NetworkId const &citiz if (iterFind != m_citizensInfo.end()) return &(iterFind->second); - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -2008,7 +2008,7 @@ CityStructureInfo const *CityObject::getCityStructureInfo(int cityId, NetworkId if (iterFind != m_structuresInfo.end()) return &(iterFind->second); - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -2071,7 +2071,7 @@ PgcRatingInfo const * CityObject::getPgcRating(NetworkId const &chroniclerId) co if (iterFind != m_pgcRatingInfo.end()) return &(iterFind->second); - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -2141,7 +2141,7 @@ void CityObject::adjustPgcRating(NetworkId const &chroniclerId, std::string cons m_pgcRatingChroniclerId.insert(std::make_pair(NameManager::normalizeName(updatedPgcRating.m_chroniclerName), chroniclerId)); } - updatedPgcRating.m_lastRatingTime = static_cast(::time(nullptr)); + updatedPgcRating.m_lastRatingTime = static_cast(::time(NULL)); std::string updatedPgcRatingSpec; CityStringParser::buildPgcRatingSpec(chroniclerId, updatedPgcRating, updatedPgcRatingSpec); diff --git a/engine/server/library/serverGame/src/shared/object/CreatureObject.cpp b/engine/server/library/serverGame/src/shared/object/CreatureObject.cpp index 73803c0a..336f2058 100755 --- a/engine/server/library/serverGame/src/shared/object/CreatureObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/CreatureObject.cpp @@ -189,7 +189,7 @@ //---------------------------------------------------------------------- // static CreatureObject vars -const SharedObjectTemplate * CreatureObject::m_defaultSharedTemplate = nullptr; +const SharedObjectTemplate * CreatureObject::m_defaultSharedTemplate = NULL; //---------------------------------------------------------------------- @@ -661,9 +661,9 @@ float MonitoredCreatureMovement::operator-(MonitoredCreatureMovement const &othe CreatureObject::CreatureObject(const ServerCreatureObjectTemplate* newTemplate) : TangibleObject(newTemplate), - m_commandQueue(nullptr), + m_commandQueue(NULL), m_isStatic(false), - m_shield(nullptr), + m_shield(NULL), m_regenerationTime(0), m_attributes(Attributes::NumberOfAttributes), m_maxAttributes(Attributes::NumberOfAttributes), @@ -942,7 +942,7 @@ CreatureObject::~CreatureObject() trade->cancelTrade(*this); } // AICreatureController * aiController = AICreatureController::asAiCreatureController(controller); -// if (aiController != nullptr) +// if (aiController != NULL) // { // aiController->stop(); // } @@ -1083,15 +1083,15 @@ const SharedObjectTemplate * CreatureObject::getDefaultSharedTemplate() const { static const ConstCharCrcLowerString templateName("object/creature/base/shared_creature_default.iff"); - if (m_defaultSharedTemplate == nullptr) + if (m_defaultSharedTemplate == NULL) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - DEBUG_WARNING(m_defaultSharedTemplate == nullptr, ("Cannot create " + DEBUG_WARNING(m_defaultSharedTemplate == NULL, ("Cannot create " "default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != nullptr) + if (m_defaultSharedTemplate != NULL) ExitChain::add (removeDefaultTemplate, "CreatureObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -1104,10 +1104,10 @@ static const ConstCharCrcLowerString templateName("object/creature/base/shared_c */ void CreatureObject::removeDefaultTemplate() { - if (m_defaultSharedTemplate != nullptr) + if (m_defaultSharedTemplate != NULL) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = nullptr; + m_defaultSharedTemplate = NULL; } } // CreatureObject::removeDefaultTemplate @@ -1192,7 +1192,7 @@ void CreatureObject::runSpawnQueue() ScriptParams params; ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != nullptr) + if (dictionary.get() != NULL) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(id, "spawn_Trigger", dictionary->getSerializedData(), 0, false); @@ -1263,7 +1263,7 @@ bool CreatureObject::assignMission(MissionObject * missionObject) } Container::ContainerErrorCode tmp = Container::CEC_Success; - result = ContainerInterface::transferItemToGeneralContainer(*datapad, *missionObject, nullptr, tmp); + result = ContainerInterface::transferItemToGeneralContainer(*datapad, *missionObject, NULL, tmp); if(result) { missionObject->setMissionHolderId(getNetworkId()); @@ -1725,7 +1725,7 @@ void CreatureObject::forwardServerObjectSpecificBaselines() const TangibleObject::forwardServerObjectSpecificBaselines(); Property const * const property = getProperty(SlowDownProperty::getClassPropertyId()); - if (property != nullptr) + if (property != NULL) { SlowDownProperty const * const slowdownProperty = safe_cast(property); @@ -1736,7 +1736,7 @@ void CreatureObject::forwardServerObjectSpecificBaselines() const // if we are an ai creature, have our controller send our current ai state AICreatureController const * const aiCreatureController = AICreatureController::asAiCreatureController(getController()); - if (aiCreatureController != nullptr) + if (aiCreatureController != NULL) { aiCreatureController->forwardServerObjectSpecificBaselines(); } @@ -1749,7 +1749,7 @@ void CreatureObject::sendObjectSpecificBaselinesToClient(Client const &client) c TangibleObject::sendObjectSpecificBaselinesToClient(client); Property const * const property = getProperty(SlowDownProperty::getClassPropertyId()); - if (property != nullptr) + if (property != NULL) { SlowDownProperty const * const slowdownProperty = safe_cast(property); @@ -1778,7 +1778,7 @@ void CreatureObject::initializeFirstTimeObject() // set the current weapon WeaponObject * weapon = getReadiedWeapon(); - if (weapon != nullptr) + if (weapon != NULL) setCurrentWeapon(*weapon); #ifdef _DEBUG @@ -1835,7 +1835,7 @@ void CreatureObject::onLoadedFromDatabase() { Container::ContainedItem itemId = container->getObjectInSlot(slot, tmp); Object* appearanceInventory = itemId.getObject(); - if(appearanceInventory == nullptr) + if(appearanceInventory == NULL) { WARNING(true, ("Player %s has lost their appearance inventory", getNetworkId().getValueString().c_str())); appearanceInventory = ServerWorld::createNewObject(s_appearanceTemplate, *this, slot, false); @@ -1941,7 +1941,7 @@ void CreatureObject::onLoadedFromDatabase() if (i.getValue(ctsTransactionDetail)) { Unicode::UnicodeStringVector tokens; - if (Unicode::tokenize(ctsTransactionDetail, tokens, nullptr, nullptr) && (tokens.size() >= 4)) + if (Unicode::tokenize(ctsTransactionDetail, tokens, NULL, NULL) && (tokens.size() >= 4)) { int const transferTime = atoi(Unicode::wideToNarrow(tokens[0]).c_str()); if ((earliestTransferTime == -1) || (transferTime < earliestTransferTime)) @@ -1978,7 +1978,7 @@ void CreatureObject::onLoadedFromDatabase() } // set "born on " collection slot and clear all the other "born on " collection slots; - // this still needs to be run even if collectionSlot is nullptr in order to forcefully clear all of the + // this still needs to be run even if collectionSlot is NULL in order to forcefully clear all of the // other "born on " collection slots, since we are reusing deleted/no longer used collection // slot bits, and those bits may be left in a set state at the time they were deleted/no longer used std::vector const & slots = CollectionsDataTable::getSlotsInCollection("born_on_collection"); @@ -2064,7 +2064,7 @@ void CreatureObject::onLoadedFromDatabase() std::vector > skillModBonuses; std::vector > attribBonuses; Container const * const equipment = ContainerInterface::getContainer(*this); - if (equipment != nullptr) + if (equipment != NULL) { for (ContainerConstIterator i(equipment->begin()); i != equipment->end(); ++i) { @@ -2072,7 +2072,7 @@ void CreatureObject::onLoadedFromDatabase() if (so) { TangibleObject const * const equippedItem = so->asTangibleObject(); - if (equippedItem != nullptr) + if (equippedItem != NULL) { equippedItem->getSkillModBonuses(skillModBonuses); int bonusCount = skillModBonuses.size(); @@ -2110,7 +2110,7 @@ void CreatureObject::onLoadedFromDatabase() setDefaultAlterTime(defaultAlterTime); CreatureController * controller = getCreatureController(); - if (controller != nullptr) + if (controller != NULL) controller->updateHibernate(); } } @@ -2379,7 +2379,7 @@ void CreatureObject::endBaselines() void CreatureObject::checkAndRestoreRequiredSlots() { SlottedContainer * const container = ContainerInterface::getSlottedContainer(*this); - if (container == nullptr) + if (container == NULL) { WARNING_STRICT_FATAL(true, ("This creature is not slotted!")); return; @@ -2422,7 +2422,7 @@ void CreatureObject::checkAndRestoreRequiredSlots() { Container::ContainedItem itemId = container->getObjectInSlot(slot, tmp); Object* inventory = itemId.getObject(); - if (inventory == nullptr) + if (inventory == NULL) { WARNING(true, ("Player %s has lost their inventory", getNetworkId().getValueString().c_str())); inventory = ServerWorld::createNewObject(s_inventoryTemplate, *this, slot, false); @@ -2438,7 +2438,7 @@ void CreatureObject::checkAndRestoreRequiredSlots() { Container::ContainedItem itemId = container->getObjectInSlot(slot, tmp); Object* datapad = itemId.getObject(); - if (datapad == nullptr) + if (datapad == NULL) { WARNING(true, ("Player %s has lost their datapad", getNetworkId().getValueString().c_str())); datapad = ServerWorld::createNewObject(s_datapadTemplate, *this, slot, false); @@ -2454,7 +2454,7 @@ void CreatureObject::checkAndRestoreRequiredSlots() { Container::ContainedItem itemId = container->getObjectInSlot(slot, tmp); ServerObject* missionBag = safe_cast(itemId.getObject()); - if (missionBag == nullptr) + if (missionBag == NULL) { WARNING(true, ("Player %s has lost their mission bag", getNetworkId().getValueString().c_str())); missionBag = ServerWorld::createNewObject(s_missionBagTemplate, *this, slot, false); @@ -2472,7 +2472,7 @@ void CreatureObject::checkAndRestoreRequiredSlots() { Container::ContainedItem itemId = container->getObjectInSlot(slot, tmp); ServerObject* bank = safe_cast(itemId.getObject()); - if (bank == nullptr) + if (bank == NULL) { WARNING(true, ("Player %s has lost their bank", getNetworkId().getValueString().c_str())); bank = ServerWorld::createNewObject(s_bankTemplate, *this, slot, false); @@ -2502,7 +2502,7 @@ void CreatureObject::onRemovingFromWorld() { // if we are crafting, end the crafting session PlayerObject * const player = PlayerCreatureController::getPlayerObject(this); - if (player != nullptr && player->isCrafting()) + if (player != NULL && player->isCrafting()) player->stopCrafting(false); // exit all notify regions @@ -2541,7 +2541,7 @@ void CreatureObject::addToWorld() Object::addToWorld(); updateTriggerVolumes(); - if (getScriptObject() != nullptr) + if (getScriptObject() != NULL) getScriptObject()->setOwnerIsLoaded(); ContainedByProperty * const containedByProperty = getContainedByProperty(); @@ -2607,7 +2607,7 @@ void CreatureObject::setupSkillData() clearCommands(); PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if (playerObject != nullptr) + if (playerObject != NULL) { playerObject->clearSchematics(); } @@ -2679,7 +2679,7 @@ void CreatureObject::setupSkillData() DynamicVariableList::NestedList::const_iterator i(schematics.begin()); for (; i != schematics.end(); ++i) { - grantSchematic(strtoul(i.getName().c_str(), nullptr, 10), true); + grantSchematic(strtoul(i.getName().c_str(), NULL, 10), true); } } @@ -2711,7 +2711,7 @@ Controller* CreatureObject::createDefaultController () AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(controller); - if (aiCreatureController != nullptr) + if (aiCreatureController != NULL) { aiCreatureController->addServerNpAutoDeltaVariables(m_serverPackage_np); } @@ -2758,7 +2758,7 @@ void CreatureObject::setAuthServerProcessId(uint32 processId) if (oldProcess != getAuthServerProcessId()) { // we can't trade if we are on different servers, so cancel it - if (getCreatureController()->getSecureTrade() != nullptr) + if (getCreatureController()->getSecureTrade() != NULL) { getCreatureController()->getSecureTrade()->cancelTrade(*this); } @@ -2786,7 +2786,7 @@ float CreatureObject::alter(float time) // If the player is trading, cancel the trade. // We need to force the issue to catch edge cases. ServerSecureTrade * const secureTradeObject = getCreatureController()->getSecureTrade(); - if (secureTradeObject != nullptr) + if (secureTradeObject != NULL) { secureTradeObject->cancelTrade(*this); } @@ -2854,7 +2854,7 @@ float CreatureObject::alter(float time) if (playerObject->getIsUnsticking() && getPositionChanged()) { - Chat::sendSystemMessageSimple(*this, SharedStringIds::unstick_request_cancelled, nullptr); + Chat::sendSystemMessageSimple(*this, SharedStringIds::unstick_request_cancelled, NULL); playerObject->setIsUnsticking(false); } } @@ -2862,13 +2862,13 @@ float CreatureObject::alter(float time) if (!ServerWorld::isSpaceScene()) { // if we're in a conversation, end it if we move too far from the npc - if (m_npcConversation != nullptr) + if (m_npcConversation != NULL) { PROFILER_AUTO_BLOCK_DEFINE("CreatureObject::alter::npcConvCheck"); bool endConversation = false; // check the distance to the npc ServerObject const * const npc = safe_cast(m_npcConversation->getNPC().getObject()); - if (npc != nullptr) + if (npc != NULL) { float distance = findPosition_w().magnitudeBetween(npc->findPosition_w()); distance -= getRadius(); @@ -2894,7 +2894,7 @@ float CreatureObject::alter(float time) // see if we are performing a slow down effect Property * property = getProperty(SlowDownProperty::getClassPropertyId()); - if (property != nullptr) + if (property != NULL) { // has it expired? SlowDownProperty * slowdown = safe_cast(property); @@ -2909,7 +2909,7 @@ float CreatureObject::alter(float time) // area, and and tell them they are moving on our effect "hill" during their next alter // (player creatures are handled on the player's client) Object * target = slowdown->getTarget().getObject(); - if (target != nullptr) + if (target != NULL) { std::vector found; ServerWorld::findAuthoritativeNonPlayerCreaturesInCone(*this, *target, slowdown->getConeLength(), slowdown->getConeAngle(), found); @@ -2974,14 +2974,14 @@ bool CreatureObject::canDestroy() const // turn off our default weapon so it won't prevent us from getting // destroyed WeaponObject * defaultWeapon = getDefaultWeapon(); - if (defaultWeapon != nullptr) + if (defaultWeapon != NULL) defaultWeapon->setAsDefaultWeapon(false); bool result = TangibleObject::canDestroy(); if (!result) { // we're not being destroyed, turn our default weapon back on - if (defaultWeapon != nullptr) + if (defaultWeapon != NULL) defaultWeapon->setAsDefaultWeapon(true); } @@ -3007,22 +3007,22 @@ void CreatureObject::initializeDefaultWeapon() FATAL(!isAuthoritative(), ("CreatureObject::initializeDefaultWeapon: obj %s, while nonauth", getDebugInformation().c_str())); ServerCreatureObjectTemplate const * const myTemplate = safe_cast(getObjectTemplate()); - if (myTemplate != nullptr) + if (myTemplate != NULL) { ServerWeaponObjectTemplate const *weaponTemplate = myTemplate->getDefaultWeapon(); - if (weaponTemplate == nullptr) + if (weaponTemplate == NULL) { WARNING(true, ("Creature template %s has no valid default weapon!", getTemplateName())); // try to use the fallback weapon weaponTemplate = dynamic_cast(ObjectTemplateList::fetch(ConfigServerGame::getFallbackDefaultWeapon())); - FATAL(weaponTemplate == nullptr, ("CreatureObject::initializeFirstTimeObject fallback weapon template %s is bad!", ConfigServerGame::getFallbackDefaultWeapon())); + FATAL(weaponTemplate == NULL, ("CreatureObject::initializeFirstTimeObject fallback weapon template %s is bad!", ConfigServerGame::getFallbackDefaultWeapon())); } WeaponObject * const weapon = safe_cast(ServerWorld::createNewObject(*weaponTemplate, *this, s_defaultWeaponSlotId, false)); - if (weapon != nullptr) + if (weapon != NULL) { weapon->setAsDefaultWeapon(true); } @@ -3044,7 +3044,7 @@ bool CreatureObject::swapDefaultWeapons(WeaponObject &newDefaultWeapon, ServerOb FATAL(!newDefaultWeapon.isAuthoritative(), ("CreatureObject::swapDefaultWeapons: obj %s, weapon %s, weaponContainer %s, while newDefaultWeapon nonauth", getDebugInformation().c_str(), newDefaultWeapon.getDebugInformation().c_str(), weaponContainer.getDebugInformation().c_str())); FATAL(!weaponContainer.isAuthoritative(), ("CreatureObject::swapDefaultWeapons: obj %s, weapon %s, weaponContainer %s, while weaponContainer nonauth", getDebugInformation().c_str(), newDefaultWeapon.getDebugInformation().c_str(), weaponContainer.getDebugInformation().c_str())); - // There is a window here where the default weapon can be nullptr, so we + // There is a window here where the default weapon can be null, so we // set a flag that it's ok until we've finished the transfer. FATAL(s_allowNullDefaultWeapon, ("CreatureObject::swapDefaultWeapons has been recursively called!")); @@ -3080,12 +3080,12 @@ bool CreatureObject::swapDefaultWeapons(WeaponObject &newDefaultWeapon, ServerOb WeaponObject *CreatureObject::getDefaultWeapon() const { SlottedContainer const * const container = ContainerInterface::getSlottedContainer(*this); - if (container == nullptr) + if (container == NULL) { - return nullptr; + return NULL; } - WeaponObject * defaultWeapon = nullptr; + WeaponObject * defaultWeapon = NULL; Container::ContainerErrorCode error; Container::ContainedItem itemId = container->getObjectInSlot(s_defaultWeaponSlotId, error); if (error == Container::CEC_Success) @@ -3097,7 +3097,7 @@ WeaponObject *CreatureObject::getDefaultWeapon() const if (so) defaultWeapon = so->asWeaponObject(); } - FATAL(!s_allowNullDefaultWeapon && defaultWeapon == nullptr, ("CreatureObject::getDefaultWeapon, weapon is nullptr! Object in default slot is %s", itemId.getValueString().c_str())); + FATAL(!s_allowNullDefaultWeapon && defaultWeapon == NULL, ("CreatureObject::getDefaultWeapon, weapon is NULL! Object in default slot is %s", itemId.getValueString().c_str())); } return defaultWeapon; } @@ -3376,7 +3376,7 @@ void CreatureObject::updateSlopeMovement(const std::string & modName) recomputeSlopeModPercent(); // if I'm modifiying the group slope mod and I'm a group leader, // update my group's speed - else if (modName == GROUP_SLOPE_MOD && getGroup() != nullptr && + else if (modName == GROUP_SLOPE_MOD && getGroup() != NULL && getGroup()->getGroupLeaderId() == getNetworkId()) { const GroupObject::GroupMemberVector & members = getGroup()->getGroupMembers(); @@ -3385,7 +3385,7 @@ void CreatureObject::updateSlopeMovement(const std::string & modName) { CreatureObject * member = safe_cast( NetworkIdManager::getObjectById((*iter).first)); - if (member != nullptr) + if (member != NULL) member->recomputeSlopeModPercent(); } } @@ -3581,7 +3581,7 @@ int CreatureObject::getExperiencePoints(const std::string & experienceType) cons if (isPlayerControlled()) { const PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if (playerObject != nullptr) + if (playerObject != NULL) return playerObject->getExperiencePoints(experienceType); } return 0; @@ -3595,7 +3595,7 @@ const std::map & CreatureObject::getExperiencePoints() const if(isPlayerControlled()) { const PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if(playerObject != nullptr) + if(playerObject != NULL) { return playerObject->getExperiencePoints(); } @@ -3617,7 +3617,7 @@ const int CreatureObject::grantExperiencePoints(const std::string & experienceTy if (isPlayerControlled()) { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if (playerObject != nullptr) + if (playerObject != NULL) { int const amountGranted = playerObject->grantExperiencePoints(experienceType, amount); @@ -3770,7 +3770,7 @@ void CreatureObject::revokeSkill(const SkillObject & oldSkill, bool silent) PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if ((playerObject != nullptr) && + if ((playerObject != NULL) && (oldSkill.getSkillName() == playerObject->getTitle())) { StringId message("shared", "skill_title_removed"); @@ -3809,7 +3809,7 @@ const bool CreatureObject::grantSchematicGroup(const std::string & groupNameWith if (isPlayerControlled()) { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if (playerObject != nullptr) + if (playerObject != NULL) return playerObject->grantSchematicGroup(groupNameWithModifier, fromSkill); } return false; @@ -3829,7 +3829,7 @@ const bool CreatureObject::grantSchematic(uint32 schematicCrc, bool fromSkill) if (isPlayerControlled()) { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if (playerObject != nullptr) + if (playerObject != NULL) return playerObject->grantSchematic(schematicCrc, fromSkill); } return false; @@ -3849,7 +3849,7 @@ const bool CreatureObject::revokeSchematic(uint32 schematicCrc, bool fromSkill) if (isPlayerControlled()) { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if (playerObject != nullptr) + if (playerObject != NULL) return playerObject->revokeSchematic(schematicCrc, fromSkill); } return false; @@ -3869,7 +3869,7 @@ const bool CreatureObject::hasSchematic(uint32 schematicCrc) if (isPlayerControlled()) { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if (playerObject != nullptr) + if (playerObject != NULL) return playerObject->hasSchematic(schematicCrc); } return false; @@ -3909,7 +3909,7 @@ void CreatureObject::setInCombat(bool inCombat) PlayerObject * const player = PlayerCreatureController::getPlayerObject(this); - if (player != nullptr && player->isCrafting()) + if (player != NULL && player->isCrafting()) { player->stopCrafting(false); } @@ -4274,10 +4274,10 @@ static const int internalTagBufLen = strlen(internalTagBuf); mod.value, m_attributes[mod.attrib] + mod.value); DEBUG_REPORT_LOG (true, ("%s", debugBuffer)); - if (attacker != nullptr) + if (attacker != NULL) { Client *client = attacker->getClient(); - if (client != nullptr) + if (client != NULL) ConsoleMgr::broadcastString(debugBuffer, client); } } @@ -4359,8 +4359,8 @@ static const int internalTagBufLen = strlen(internalTagBuf); else { const char * modName = AttribModNameManager::getInstance().getAttribModName(mod.tag); - if (modName == nullptr) - modName = ""; + if (modName == NULL) + modName = ""; WARNING(true, ("Creature %s received a mod %s with invalid " "attack(%.2f) or duration(%.2f)", getNetworkId().getValueString().c_str(), modName, mod.attack, @@ -4438,7 +4438,7 @@ void CreatureObject::removeAttributeModifier (const std::string & modName) if (AttribMod::isSkillMod(m.mod)) { const char * skillModName = AttribModNameManager::getInstance().getAttribModName(m.mod.skill); - if (skillModName != nullptr) + if (skillModName != NULL) addModValue(skillModName, -m.maxVal, true); else { @@ -4569,7 +4569,7 @@ void CreatureObject::removeAllAttributeAndSkillmodMods () if (AttribMod::isSkillMod(m.mod)) { const char * skillModName = AttribModNameManager::getInstance().getAttribModName(m.mod.skill); - if (skillModName != nullptr) + if (skillModName != NULL) addModValue(skillModName, -m.maxVal, true); } // if the mod is visible, we need to tell the player it's being @@ -4582,7 +4582,7 @@ void CreatureObject::removeAllAttributeAndSkillmodMods () if (m.mod.flags & AttribMod::AMF_triggerOnDone) { const char * modName = AttribModNameManager::getInstance().getAttribModName(m.mod.tag); - if (modName != nullptr) + if (modName != NULL) { ScriptParams params; params.addParam(modName); @@ -4624,7 +4624,7 @@ void CreatureObject::removeAllAttributeAndSkillmodMods () * * @param modName the mod to look for * - * @return the mod, or nullptr if there is no mod with that name attached to us + * @return the mod, or NULL if there is no mod with that name attached to us */ const AttribMod::AttribMod * CreatureObject::getAttributeModifier( const std::string & modName) const @@ -4642,7 +4642,7 @@ const AttribMod::AttribMod * CreatureObject::getAttributeModifier( if (found != m_attributeModList.end()) return &((*found).second.mod); } - return nullptr; + return NULL; } // CreatureObject::getAttributeModifier //----------------------------------------------------------------------- @@ -4666,7 +4666,7 @@ const std::map & CreatureObject::getAttributeModifiers() co */ void CreatureObject::sendTimedModData(uint32 id, float time, bool updateCache/* = true*/) { - if (isPlayerControlled() && getController() != nullptr && id != 0) + if (isPlayerControlled() && getController() != NULL && id != 0) { MessageQueueGenericValueType > * const msg = new MessageQueueGenericValueType >( @@ -4707,7 +4707,7 @@ void CreatureObject::sendTimedModData(uint32 id, float time, bool updateCache/* */ void CreatureObject::sendCancelTimedMod(uint32 id) { - if (isPlayerControlled() && getController() != nullptr && id != 0) + if (isPlayerControlled() && getController() != NULL && id != 0) { MessageQueueGenericValueType * const msg = new MessageQueueGenericValueType(id); @@ -4764,7 +4764,7 @@ void CreatureObject::applyDamage(const CombatEngineData::DamageData &damageData) // if the attacker is a player and we are not, and we are incapped/dead, // don't allow additional damage - if (attacker != nullptr && attacker->isPlayerControlled() && !isPlayerControlled() && + if (attacker != NULL && attacker->isPlayerControlled() && !isPlayerControlled() && (isIncapacitated() || isDead())) { return; @@ -5018,7 +5018,7 @@ void CreatureObject::decayAttributes(float time) if (AttribMod::isSkillMod(m.mod)) { const char * skillModName = AttribModNameManager::getInstance().getAttribModName(m.mod.skill); - if (skillModName != nullptr) + if (skillModName != NULL) { addModValue(skillModName, -m.maxVal, true); @@ -5051,7 +5051,7 @@ void CreatureObject::decayAttributes(float time) { // tell scripts the mod has ended const char * modName = AttribModNameManager::getInstance().getAttribModName(m.mod.tag); - if (modName != nullptr) + if (modName != NULL) { ScriptParams params; params.addParam(modName); @@ -5112,7 +5112,7 @@ void CreatureObject::decayAttributes(float time) // add the skillmod mod as if it were from a skill, // which makes it temporary const char * skillModName = AttribModNameManager::getInstance().getAttribModName(m.mod.skill); - if (skillModName != nullptr) + if (skillModName != NULL) addModValue(skillModName, delta, true); else { @@ -6014,7 +6014,7 @@ static const std::map,int> npcSchematics; if (isPlayerControlled()) { PlayerObject const * const playerObject = PlayerCreatureController::getPlayerObject(this); - if (playerObject != nullptr) + if (playerObject != NULL) return playerObject->getDraftSchematics(); } return npcSchematics; @@ -6032,11 +6032,11 @@ static const std::map,int> npcSchematics; bool CreatureObject::isIngredientInInventory(const Object & ingredient) const { const ServerObject * inventory = getInventory(); - if (inventory == nullptr) + if (inventory == NULL) return false; const Object * container = ContainerInterface::getContainedByObject(ingredient); - while (container != nullptr) + while (container != NULL) { if (inventory->getNetworkId() == container->getNetworkId() || getNetworkId() == container->getNetworkId()) @@ -6057,7 +6057,7 @@ bool CreatureObject::isIngredientInInventory(const Object & ingredient) const */ void CreatureObject::disableSchematicFiltering() { - if (getClient() == nullptr || !getClient()->isGod()) + if (getClient() == NULL || !getClient()->isGod()) return; setObjVarItem(OBJVAR_DISABLE_SCHEMATIC_FILTER, 1); @@ -6071,7 +6071,7 @@ void CreatureObject::disableSchematicFiltering() */ void CreatureObject::enableSchematicFiltering() { - if (getClient() == nullptr || !getClient()->isGod()) + if (getClient() == NULL || !getClient()->isGod()) return; removeObjVarItem(OBJVAR_DISABLE_SCHEMATIC_FILTER); @@ -6087,7 +6087,7 @@ void CreatureObject::enableSchematicFiltering() */ bool CreatureObject::isSchematicFilteringEnabled() { - if (getClient() == nullptr || !getClient()->isGod()) + if (getClient() == NULL || !getClient()->isGod()) return true; return (!getObjVars().hasItem(OBJVAR_DISABLE_SCHEMATIC_FILTER)); @@ -6103,17 +6103,17 @@ bool CreatureObject::isSchematicFilteringEnabled() void CreatureObject::getManufactureSchematics(std::vector & schematics) { const ServerObject * datapad = getDatapad(); - if (datapad == nullptr) + if (datapad == NULL) return; const VolumeContainer * container = ContainerInterface::getVolumeContainer(*datapad); - if (container == nullptr) + if (container == NULL) return; for (ContainerConstIterator iter = container->begin(); iter != container->end(); ++iter) { const ManufactureSchematicObject * schematic = dynamic_cast((*iter).getObject()); - if (schematic != nullptr) + if (schematic != NULL) schematics.push_back(schematic); } } // CreatureObject::getManufactureSchematics(unfiltered) @@ -6130,17 +6130,17 @@ void CreatureObject::getManufactureSchematics(std::vector & schematics, uint32 craftingTypes) { const ServerObject * datapad = getDatapad(); - if (datapad == nullptr) + if (datapad == NULL) return; const VolumeContainer * container = ContainerInterface::getVolumeContainer(*datapad); - if (container == nullptr) + if (container == NULL) return; for (ContainerConstIterator iter = container->begin(); iter != container->end(); ++iter) { const ManufactureSchematicObject * schematic = dynamic_cast((*iter).getObject()); - if (schematic != nullptr && ((schematic->getCategory() & craftingTypes) != 0)) + if (schematic != NULL && ((schematic->getCategory() & craftingTypes) != 0)) schematics.push_back(schematic); } } // CreatureObject::getManufactureSchematics(filtered) @@ -6278,7 +6278,7 @@ void CreatureObject::setIncapacitated(bool flag, const NetworkId & attackerId) // if we are crafting, end the crafting session PlayerObject * const player = PlayerCreatureController::getPlayerObject(this); - if (player != nullptr && player->isCrafting()) + if (player != NULL && player->isCrafting()) player->stopCrafting(false); if (isInNpcConversation()) @@ -6299,7 +6299,7 @@ void CreatureObject::setIncapacitated(bool flag, const NetworkId & attackerId) // invoke incapacitation script on who incapacitated us ServerObject * attacker = safe_cast( NetworkIdManager::getObjectById(attackerId)); - if (attacker != nullptr) + if (attacker != NULL) { params.clear(); params.addParam(getNetworkId()); @@ -6308,7 +6308,7 @@ void CreatureObject::setIncapacitated(bool flag, const NetworkId & attackerId) TangibleObject * const tangibleAttacker = attacker->asTangibleObject(); - if (tangibleAttacker != nullptr) + if (tangibleAttacker != NULL) { tangibleAttacker->verifyHateList(); } @@ -6335,7 +6335,7 @@ void CreatureObject::setIncapacitated(bool flag, const NetworkId & attackerId) setPosture(Postures::Upright); } // if we are a player, send us our new posture - if ((getController() != nullptr) && !isInCombat()) + if ((getController() != NULL) && !isInCombat()) { getController()->appendMessage( CM_setPosture, @@ -6466,7 +6466,7 @@ void CreatureObject::updateMovementInfo() rider->requestMovementInfoUpdate(); else { - LOG("mounts-bug", ("CreatureObject::updateMovementInfo(): server id=[%d],mount id=[%s],has MountedCreature state but getMountingRider() returns nullptr.", static_cast(GameServer::getInstance().getProcessId()), getNetworkId().getValueString().c_str())); + LOG("mounts-bug", ("CreatureObject::updateMovementInfo(): server id=[%d],mount id=[%s],has MountedCreature state but getMountingRider() returns null.", static_cast(GameServer::getInstance().getProcessId()), getNetworkId().getValueString().c_str())); detachAllRiders(); } } @@ -6538,7 +6538,7 @@ void CreatureObject::setPosture(Postures::Enumerator newPosture, bool isClientIm // guaranteed to be the authoritative object, this is an invalid thing to do. requestMovementInfoUpdate(); - if (getScriptObject() != nullptr) + if (getScriptObject() != NULL) { ScriptParams params; params.addParam(oldPosture); @@ -6950,13 +6950,13 @@ bool CreatureObject::onContainerAboutToTransfer(ServerObject * destination, Serv int CreatureObject::onContainerAboutToGainItem(ServerObject& item, ServerObject* transferer) { TangibleObject const * const object = item.asTangibleObject(); - if (object != nullptr) + if (object != NULL) { // See if this item is equippable const char *sharedTemplateName = item.getSharedTemplateName(); if (!isAppearanceEquippable(sharedTemplateName)) { - if (getClient() != nullptr) + if (getClient() != NULL) { StringId message("shared", "item_not_equippable"); Unicode::String outOfBand; @@ -6984,7 +6984,7 @@ int CreatureObject::onContainerAboutToGainItem(ServerObject& item, ServerObject* void CreatureObject::onContainerLostItem(ServerObject *destination, ServerObject &item, ServerObject *transferer) { TangibleObject const * const tangibleObject = item.asTangibleObject(); - if (tangibleObject == nullptr) + if (tangibleObject == NULL) return; // check if the object applies skill mod bonuses when equipped @@ -7026,12 +7026,12 @@ void CreatureObject::onContainerLostItem(ServerObject *destination, ServerObject // if the item is a weapon, make our current weapon our default weapon WeaponObject const * const weaponObject = tangibleObject->asWeaponObject(); - if (weaponObject != nullptr && getDefaultWeapon() != nullptr) + if (weaponObject != NULL && getDefaultWeapon() != NULL) setCurrentWeapon(*getDefaultWeapon()); // check if the object is our shield if (tangibleObject == m_shield) - m_shield = nullptr; + m_shield = NULL; //Update wearbles data SlottedContainmentProperty* scp = ContainerInterface::getSlottedContainmentProperty(item); @@ -7060,7 +7060,7 @@ void CreatureObject::onContainerLostItem(ServerObject *destination, ServerObject void CreatureObject::onContainerGainItem(ServerObject& item, ServerObject* source, ServerObject* transferer) { TangibleObject * const tangibleObject = item.asTangibleObject(); - if (tangibleObject == nullptr) + if (tangibleObject == NULL) return; // check if the object applies skill mod bonuses when equipped @@ -7100,7 +7100,7 @@ void CreatureObject::onContainerGainItem(ServerObject& item, ServerObject* sourc // if the item is a weapon, make it our current weapon WeaponObject * const weaponObject = tangibleObject->asWeaponObject(); - if (weaponObject != nullptr) + if (weaponObject != NULL) setCurrentWeapon(*weaponObject); //Update wearables data @@ -7141,7 +7141,7 @@ void CreatureObject::onContainerGainItem(ServerObject& item, ServerObject* sourc ConstCharCrcString clientSharedTemplateNameCrcString = ObjectTemplateList::lookUp(tangibleObject->getClientSharedTemplateName()); if (clientSharedTemplateNameCrcString.isEmpty()) WARNING(true, ("Could not find crc for %s. Wearable will not be streamed to client", tangibleObject->getClientSharedTemplateName())); - else if (tangibleObject->asWeaponObject() != nullptr) + else if (tangibleObject->asWeaponObject() != NULL) { addPackedWearable(tangibleObject->getAppearanceData(), scp->getCurrentArrangement(), tangibleObject->getNetworkId(), clientSharedTemplateNameCrcString.getCrc(), tangibleObject->createSharedBaselinesMessage(), tangibleObject->createSharedNpBaselinesMessage()); @@ -7591,7 +7591,7 @@ void CreatureObject::onClientReady(Client *c) { time_t timeUnsquelch = static_cast(player->getSecondsUntilUnsquelched()); if (timeUnsquelch > 0) - timeUnsquelch += ::time(nullptr); + timeUnsquelch += ::time(NULL); GenericValueTypeMessage, int>, std::pair > > chatStatistics("ChatStatisticsGS", std::make_pair(std::make_pair(std::make_pair(getNetworkId(), static_cast(timeUnsquelch)), player->getChatSpamTimeEndInterval()), std::make_pair(player->getChatSpamSpatialNumCharacters(), player->getChatSpamNonSpatialNumCharacters()))); Chat::sendToChatServer(chatStatistics); @@ -7926,7 +7926,7 @@ bool CreatureObject::makeDead(const NetworkId & killer, const NetworkId & corpse // if we are crafting, end the crafting session PlayerObject * const player = PlayerCreatureController::getPlayerObject(this); - if (player != nullptr && player->isCrafting()) + if (player != NULL && player->isCrafting()) player->stopCrafting(false); // if we are in a conversation, end it @@ -7991,7 +7991,7 @@ bool CreatureObject::makeDead(const NetworkId & killer, const NetworkId & corpse if (AttribMod::isSkillMod(m.mod)) { const char * skillModName = AttribModNameManager::getInstance().getAttribModName(m.mod.skill); - if (skillModName != nullptr) + if (skillModName != NULL) addModValue(skillModName, -m.maxVal, true); } // if the mod is visible, we need to tell the player it's being @@ -8004,7 +8004,7 @@ bool CreatureObject::makeDead(const NetworkId & killer, const NetworkId & corpse if (m.mod.flags & AttribMod::AMF_triggerOnDone) { const char * modName = AttribModNameManager::getInstance().getAttribModName(m.mod.tag); - if (modName != nullptr) + if (modName != NULL) { ScriptParams params; params.addParam(modName); @@ -8149,7 +8149,7 @@ Object const * CreatureObject::getStandingOn() const } else { - return nullptr; + return NULL; } } @@ -8302,7 +8302,7 @@ bool CreatureObject::setSlopeModPercent(float percent) // get my skill mod int movementMod = getEnhancedModValue(SLOPE_MOD); - if (getGroup() != nullptr) + if (getGroup() != NULL) { // get my group leader skill mod const NetworkId & leaderId = getGroup()->getGroupLeaderId(); @@ -8310,7 +8310,7 @@ bool CreatureObject::setSlopeModPercent(float percent) { const CreatureObject * leader = safe_cast( NetworkIdManager::getObjectById(leaderId)); - if (leader != nullptr) + if (leader != NULL) { movementMod += leader->getEnhancedModValue(GROUP_SLOPE_MOD); } @@ -8519,7 +8519,7 @@ void CreatureObject::onBiographyRetrieved(const NetworkId &owner, const Unicode: CreatureController *creatureController = getCreatureController(); - if (creatureController != nullptr) + if (creatureController != NULL) { typedef std::pair Payload; @@ -8535,7 +8535,7 @@ void CreatureObject::onCharacterMatchRetrieved(MatchMakingCharacterResult const { CreatureController *creatureController = getCreatureController(); - if (creatureController != nullptr) + if (creatureController != NULL) { MessageQueueGenericValueType * const msg = new MessageQueueGenericValueType(results); @@ -8939,7 +8939,7 @@ bool CreatureObject::isAppearanceEquippable(const char *appearanceTemplateName) // Make sure this object has a valid appearance - if (appearanceTemplateName == nullptr) + if (appearanceTemplateName == NULL) { result = false; } @@ -9063,7 +9063,7 @@ void CreatureObject::updatePlanetServerInternal(const bool forceUpdate) const AICreatureController const * const aiCreatureController = dynamic_cast(getCreatureController()); Object const * const topmostContainer = ContainerInterface::getTopmostContainer(*this); - FATAL(!topmostContainer, ("Object %s was contained by something, but getTopmostContainer() returned nullptr", getNetworkId().getValueString().c_str())); + FATAL(!topmostContainer, ("Object %s was contained by something, but getTopmostContainer() returned NULL", getNetworkId().getValueString().c_str())); Vector const &position = topmostContainer->getPosition_p(); UpdateObjectOnPlanetMessage const msg( getNetworkId(), @@ -9265,7 +9265,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) // set objvar to indicate there's a pending rename request for this character, // and the time of the rename request, to enforce the 90 days wait between rename if (!getClient() || !getClient()->isGod()) - setObjVarItem("renameCharacterRequest.requestTime", static_cast(::time(nullptr))); + setObjVarItem("renameCharacterRequest.requestTime", static_cast(::time(NULL))); std::string const newName(message.getDataAsString()); if (getObjVars().hasItem("renameCharacterRequest.requestTime") && !newName.empty()) @@ -9306,7 +9306,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) if (!getObjVars().hasItem(OBJVAR_ADD_JEDI_ACK)) { PlayerObject * const player = PlayerCreatureController::getPlayerObject(this); - if (player != nullptr) + if (player != NULL) { player->addJediToAccount(); MessageToQueue::getInstance().sendMessageToC(getNetworkId(), @@ -9461,7 +9461,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) MessageToQueue::cancelRecurringMessageTo(getNetworkId(), "C++WaitForPatrolPreload"); AICreatureController * const aiCreatureController = safe_cast(getController()); - if (aiCreatureController != nullptr) + if (aiCreatureController != NULL) { const std::string data = message.getDataAsString(); std::string::size_type locationStart = 0; @@ -9797,7 +9797,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) Unicode::String const delimiters(Unicode::narrowToWide("|")); Unicode::UnicodeStringVector tokens; - if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, nullptr)) && (tokens.size() == 2)) + if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, NULL)) && (tokens.size() == 2)) { existingWarden = NetworkId(Unicode::wideToNarrow(tokens[0])); @@ -9874,7 +9874,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) Unicode::String const delimiters(Unicode::narrowToWide("|")); Unicode::UnicodeStringVector tokens; - if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, nullptr)) && (tokens.size() == 2)) + if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, NULL)) && (tokens.size() == 2)) { existingWarden = NetworkId(Unicode::wideToNarrow(tokens[0])); @@ -9970,12 +9970,12 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) bool success = false; NetworkId actor, actorShip, group; std::string actorName; - GroupObject const * groupObject = nullptr; + GroupObject const * groupObject = NULL; StringId responseSid; Unicode::String const delimiters(Unicode::narrowToWide("|")); Unicode::UnicodeStringVector tokens; - if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, nullptr)) && (tokens.size() == 4)) + if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, NULL)) && (tokens.size() == 4)) { success = true; actor = NetworkId(Unicode::wideToNarrow(tokens[0])); @@ -9983,8 +9983,8 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) group = NetworkId(Unicode::wideToNarrow(tokens[2])); actorName = Unicode::wideToNarrow(tokens[3]); - ServerObject const * so = (group.isValid() ? safe_cast(NetworkIdManager::getObjectById(group)) : nullptr); - groupObject = (so ? so->asGroupObject() : nullptr); + ServerObject const * so = (group.isValid() ? safe_cast(NetworkIdManager::getObjectById(group)) : NULL); + groupObject = (so ? so->asGroupObject() : NULL); } if (success) @@ -10011,7 +10011,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) if (success) { GameScriptObject* const gso = getScriptObject(); - if (gso != nullptr && gso->hasScript("ai.beast")) + if (gso != NULL && gso->hasScript("ai.beast")) { responseSid = GroupStringId::SID_GROUP_BEASTS_CANT_JOIN; success = false; @@ -10092,7 +10092,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) } else if (message.getMethod() == "C++InviteToGroupRspTargetNotFound") { - Chat::sendSystemMessageSimple(*this, GroupStringId::SID_GROUP_INVITE_NO_TARGET_SELF, nullptr); + Chat::sendSystemMessageSimple(*this, GroupStringId::SID_GROUP_INVITE_NO_TARGET_SELF, NULL); } else if (message.getMethod() == "C++GroupOperationGenericRsp") { @@ -10101,7 +10101,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) std::string const result(message.getPackedDataVector().begin(), message.getPackedDataVector().end()); Unicode::String const delimiters(Unicode::narrowToWide("|")); Unicode::UnicodeStringVector tokens; - if ((Unicode::tokenize(Unicode::narrowToWide(result), tokens, &delimiters, nullptr)) && (tokens.size() == 3)) + if ((Unicode::tokenize(Unicode::narrowToWide(result), tokens, &delimiters, NULL)) && (tokens.size() == 3)) { std::string const response(Unicode::wideToNarrow(tokens[0])); std::string const responseParmType(Unicode::wideToNarrow(tokens[1])); @@ -10138,7 +10138,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) Unicode::String const delimiters(Unicode::narrowToWide("|")); Unicode::UnicodeStringVector tokens; - if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, nullptr)) && (tokens.size() == 2)) + if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, NULL)) && (tokens.size() == 2)) { success = true; actor = NetworkId(Unicode::wideToNarrow(tokens[0])); @@ -10194,7 +10194,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) } else if (message.getMethod() == "C++UninviteFromGroupRspTargetNotFound") { - Chat::sendSystemMessageSimple(*this, GroupStringId::SID_GROUP_UNINVITE_NO_TARGET_SELF, nullptr); + Chat::sendSystemMessageSimple(*this, GroupStringId::SID_GROUP_UNINVITE_NO_TARGET_SELF, NULL); } else if (message.getMethod() == "C++GroupJoinInviterInfoReq") { @@ -10250,7 +10250,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) Unicode::String const delimiters(Unicode::narrowToWide("|")); Unicode::UnicodeStringVector tokens; - if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, nullptr)) && (tokens.size() == 10)) + if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, NULL)) && (tokens.size() == 10)) { success = true; existingGroupId = NetworkId(Unicode::wideToNarrow(tokens[0])); @@ -10265,17 +10265,17 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) inviterInCombat = (atoi(Unicode::wideToNarrow(tokens[9]).c_str()) != 0); } - GroupObject * existingGroup = nullptr; + GroupObject * existingGroup = NULL; if (success) { if (existingGroupId.isValid()) { ServerObject * so = safe_cast(NetworkIdManager::getObjectById(existingGroupId)); - existingGroup = (so ? so->asGroupObject() : nullptr); + existingGroup = (so ? so->asGroupObject() : NULL); if (!existingGroup) { success = false; - Chat::sendSystemMessageSimple(*this, GroupStringId::SID_GROUP_EXISTING_GROUP_NOT_FOUND, nullptr); + Chat::sendSystemMessageSimple(*this, GroupStringId::SID_GROUP_EXISTING_GROUP_NOT_FOUND, NULL); } } } @@ -10318,7 +10318,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) if (existingGroup && !GroupHelpers::roomInGroup(existingGroup, targets.size())) { success = false; - Chat::sendSystemMessageSimple(*this, GroupStringId::SID_GROUP_JOIN_FULL, nullptr); + Chat::sendSystemMessageSimple(*this, GroupStringId::SID_GROUP_JOIN_FULL, NULL); } } @@ -10390,7 +10390,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) } else if (message.getMethod() == "C++GroupJoinInviterInfoReqInviterNotFound") { - Chat::sendSystemMessageSimple(*this, GroupStringId::SID_GROUP_MUST_BE_INVITED, nullptr); + Chat::sendSystemMessageSimple(*this, GroupStringId::SID_GROUP_MUST_BE_INVITED, NULL); } else if (message.getMethod() == "C++LeaveGroupReq") { @@ -10417,7 +10417,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) Unicode::String const delimiters(Unicode::narrowToWide("|")); Unicode::UnicodeStringVector tokens; - if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, nullptr)) && (tokens.size() == 5)) + if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, NULL)) && (tokens.size() == 5)) { // tell group member that the group pickup point has been created if (getClient()) @@ -10767,7 +10767,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) params.addParam(msg.getDestinationGalaxy().c_str(), "destinationGalaxy"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != nullptr) + if (dictionary.get() != NULL) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(getNetworkId(), "handleFreeCtsValidateFailCannotCreateCharacter", dictionary->getSerializedData(), 0, false); @@ -10781,7 +10781,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) params.addParam(msg.getDestinationGalaxy().c_str(), "destinationGalaxy"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != nullptr) + if (dictionary.get() != NULL) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(getNetworkId(), "handleFreeCtsValidateFailDestGalaxyUnavailable", dictionary->getSerializedData(), 0, false); @@ -10801,7 +10801,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) params.addParam(msg.getDestinationGalaxy().c_str(), "destinationGalaxy"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != nullptr) + if (dictionary.get() != NULL) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(getNetworkId(), "handleCtsValidateFailCannotCreateCharacter", dictionary->getSerializedData(), 0, false); @@ -10815,7 +10815,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) params.addParam(msg.getDestinationGalaxy().c_str(), "destinationGalaxy"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != nullptr) + if (dictionary.get() != NULL) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(getNetworkId(), "handleCtsValidateFailDestGalaxyUnavailable", dictionary->getSerializedData(), 0, false); @@ -10854,7 +10854,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) params.addParam(msg.getValue().first.c_str(), "reason"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != nullptr) + if (dictionary.get() != NULL) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(getNetworkId(), "handleFreeCtsValidateFailNameValidation", dictionary->getSerializedData(), 0, false); @@ -10868,7 +10868,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) params.addParam(msg.getValue().first.c_str(), "reason"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != nullptr) + if (dictionary.get() != NULL) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(getNetworkId(), "handleCtsValidateFailNameValidation", dictionary->getSerializedData(), 0, false); @@ -10882,7 +10882,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) params.addParam(msg.getValue().second.getDestinationCharacterName().c_str(), "destinationCharacterName"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != nullptr) + if (dictionary.get() != NULL) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(getNetworkId(), "handleFreeCtsValidateSuccess", dictionary->getSerializedData(), 0, false); @@ -10895,7 +10895,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) params.addParam(msg.getValue().second.getDestinationCharacterName().c_str(), "destinationCharacterName"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != nullptr) + if (dictionary.get() != NULL) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(getNetworkId(), "handleCtsValidateSuccess", dictionary->getSerializedData(), 0, false); @@ -10906,7 +10906,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) else if (message.getMethod() == "C++PickupAllRoomItemsIntoInventory") { // use while(true) loop to use break to discontinue processing and go to the end of loop to run cleanup code - PlayerObject * playerObject = nullptr; + PlayerObject * playerObject = NULL; while (true) { playerObject = PlayerCreatureController::getPlayerObject(this); @@ -11148,7 +11148,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) else if (message.getMethod() == "C++DropAllInventoryItemsIntoRoom") { // use while(true) loop to use break to discontinue processing and go to the end of loop to run cleanup code - PlayerObject * playerObject = nullptr; + PlayerObject * playerObject = NULL; while (true) { playerObject = PlayerCreatureController::getPlayerObject(this); @@ -11355,7 +11355,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) else if (message.getMethod() == "C++RestoreDecorationLayout") { // use while(true) loop to use break to discontinue processing and go to the end of loop to run cleanup code - PlayerObject * playerObject = nullptr; + PlayerObject * playerObject = NULL; while (true) { playerObject = PlayerCreatureController::getPlayerObject(this); @@ -11681,7 +11681,7 @@ void CreatureObject::virtualOnReleaseAuthority() if(controller) { - if (getProperty(SlopeEffectProperty::getClassPropertyId()) != nullptr) + if (getProperty(SlopeEffectProperty::getClassPropertyId()) != NULL) removeProperty(SlopeEffectProperty::getClassPropertyId()); controller->setAuthority(false); } @@ -11693,7 +11693,7 @@ void CreatureObject::virtualOnLogout() { TangibleObject::virtualOnLogout(); PlayerObject * const player = PlayerCreatureController::getPlayerObject(this); - if (player != nullptr) + if (player != NULL) player->virtualOnLogout(); } @@ -11789,7 +11789,7 @@ void CreatureObject::packWearables() ConstCharCrcString clientSharedTemplateNameCrcString = ObjectTemplateList::lookUp(tang->getClientSharedTemplateName()); if (clientSharedTemplateNameCrcString.isEmpty()) WARNING(true, ("Could not find crc for [%s]. Wearable will not be streamed to client", tang->getClientSharedTemplateName())); - else if (so->asWeaponObject() != nullptr) + else if (so->asWeaponObject() != NULL) { addPackedWearable(tang->getAppearanceData(), scp->getCurrentArrangement(), tang->getNetworkId(), clientSharedTemplateNameCrcString.getCrc(), tang->createSharedBaselinesMessage(), tang->createSharedNpBaselinesMessage()); @@ -12048,7 +12048,7 @@ int CreatureObject::loadPackedHouses() ++hcdIter) { Object * const houseId = (*hcdIter).getObject(); - BuildingObject * const house = (houseId ? houseId->asServerObject()->asBuildingObject() : nullptr); + BuildingObject * const house = (houseId ? houseId->asServerObject()->asBuildingObject() : NULL); if (house && !house->getContentsLoaded()) { LOG("CustomerService", ("CharacterTransfer: starting packed house load (%s) for CTS character %s", house->getNetworkId().getValueString().c_str(), PlayerObject::getAccountDescription(this).c_str())); @@ -12612,7 +12612,7 @@ void CreatureObject::unequipAllItems() Container::ContainerErrorCode errorCode = Container::CEC_Success; Container::ContainedItem inventoryContainedItem = equipmentContainer->getObjectInSlot(s_inventorySlotId, errorCode); Object *const inventoryObjectBase = inventoryContainedItem.getObject(); - ServerObject *const inventoryObject = inventoryObjectBase ? inventoryObjectBase->asServerObject() : nullptr; + ServerObject *const inventoryObject = inventoryObjectBase ? inventoryObjectBase->asServerObject() : NULL; if (!inventoryObject || (errorCode != Container::CEC_Success)) { WARNING(true, @@ -12629,7 +12629,7 @@ void CreatureObject::unequipAllItems() if (!inventoryContainer) { WARNING(true, - ("unequipAllItems() called on object id=[%s], template=[%s] on server id=[%d]: inventory object is nullptr.", + ("unequipAllItems() called on object id=[%s], template=[%s] on server id=[%d]: inventory object is NULL.", getNetworkId().getValueString().c_str(), getObjectTemplateName(), static_cast(GameServer::getInstance().getProcessId()) @@ -12648,11 +12648,11 @@ void CreatureObject::unequipAllItems() // Get the equipment item. Container::ContainedItem containedItem = *it; Object *const objectBase = containedItem.getObject(); - ServerObject *const object = objectBase ? objectBase->asServerObject() : nullptr; + ServerObject *const object = objectBase ? objectBase->asServerObject() : NULL; if (!object) { WARNING(true, - ("nullptr object in equipment container for object id=[%s]: equipment item id=[%s].", + ("null object in equipment container for object id=[%s]: equipment item id=[%s].", getNetworkId().getValueString().c_str(), containedItem.getValueString().c_str() )); @@ -12686,7 +12686,7 @@ void CreatureObject::unequipAllItems() if (!object) continue; - ContainerInterface::transferItemToVolumeContainer(*inventoryObject, *object, nullptr, errorCode); + ContainerInterface::transferItemToVolumeContainer(*inventoryObject, *object, NULL, errorCode); WARNING(errorCode != Container::CEC_Success, ("unequipAllItems(): CreatureObject id=[%s] failed to transfer item id=[%s], template=[%s] from equipment to inventory container, container error code [%d].", getNetworkId().getValueString().c_str(), @@ -13322,18 +13322,18 @@ CreatureObject * CreatureObject::getCreatureObject(NetworkId const & networkId) CreatureObject const * CreatureObject::asCreatureObject(Object const * object) { - ServerObject const * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; + ServerObject const * const serverObject = (object != NULL) ? object->asServerObject() : NULL; - return (serverObject != nullptr) ? serverObject->asCreatureObject() : nullptr; + return (serverObject != NULL) ? serverObject->asCreatureObject() : NULL; } // ---------------------------------------------------------------------- CreatureObject * CreatureObject::asCreatureObject(Object * object) { - ServerObject * serverObject = (object != nullptr) ? object->asServerObject() : nullptr; + ServerObject * serverObject = (object != NULL) ? object->asServerObject() : NULL; - return (serverObject != nullptr) ? serverObject->asCreatureObject() : nullptr; + return (serverObject != NULL) ? serverObject->asCreatureObject() : NULL; } // ---------------------------------------------------------------------- @@ -13474,7 +13474,7 @@ void CreatureObject::pushedMe(const NetworkId & attackerId, UNREF(defenderPos); Vector offset(getPosition_w()); - if (attacker != nullptr) + if (attacker != NULL) offset -= attacker->getPosition_w(); else offset -= attackerPos; @@ -13489,14 +13489,14 @@ void CreatureObject::pushedMe(const NetworkId & attackerId, move_p(rotate_w2p(offset)); AICreatureController *controller = dynamic_cast(getController()); - if (controller != nullptr) + if (controller != NULL) { // we only need to do this for npcs, because we'll use the update from a player's client for players // we need to do this for npcs to prevent the ai from moving them back to their previous position const Vector newPos(getPosition_p()); float closestPortalT = 0.0f; const CellProperty * destinationCell = getParentCell()->getDestinationCell(oldPos, newPos, closestPortalT); - if (destinationCell == nullptr || destinationCell == getParentCell()) + if (destinationCell == NULL || destinationCell == getParentCell()) { // no cell change controller->warpTo(getParentCell(), newPos); @@ -13576,7 +13576,7 @@ bool CreatureObject::addSlowDownEffectProxy(const TangibleObject & defender, flo { // if we already are doing a slowdown, don't do another Property * property = getProperty(SlowDownProperty::getClassPropertyId()); - if (property != nullptr) + if (property != NULL) return false; property = new SlowDownProperty(*this, CachedNetworkId(defender), coneLength, coneAngle, slopeAngle, expireTime); @@ -13598,11 +13598,11 @@ void CreatureObject::removeSlowDownEffect() // tell all my proxies (client and server) to remove the effect Controller * const controller = getController(); if (controller) - controller->appendMessage(CM_removeSlowDownEffectProxy, 0, nullptr, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_ALL_CLIENT | GameControllerMessageFlags::DEST_PROXY_SERVER); + controller->appendMessage(CM_removeSlowDownEffectProxy, 0, NULL, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_ALL_CLIENT | GameControllerMessageFlags::DEST_PROXY_SERVER); } else { - sendControllerMessageToAuthServer(CM_removeSlowDownEffect, nullptr); + sendControllerMessageToAuthServer(CM_removeSlowDownEffect, NULL); } } @@ -13613,7 +13613,7 @@ void CreatureObject::removeSlowDownEffect() */ void CreatureObject::removeSlowDownEffectProxy() { - if (getProperty(SlowDownProperty::getClassPropertyId()) != nullptr) + if (getProperty(SlowDownProperty::getClassPropertyId()) != NULL) removeProperty(SlowDownProperty::getClassPropertyId()); } @@ -13631,7 +13631,7 @@ void CreatureObject::addTerrainSlopeEffect(const Vector & normal) if (isAuthoritative() && !isPlayerControlled()) { Property * property = getProperty(SlopeEffectProperty::getClassPropertyId()); - if (property == nullptr) + if (property == NULL) { property = new SlopeEffectProperty(*this); addProperty(*property, true); @@ -13994,7 +13994,7 @@ void CreatureObject::setLevel(int level) else { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if (playerObject == nullptr) + if (playerObject == NULL) { // this is an ai, so just set the level m_level = (int16) level; @@ -14014,7 +14014,7 @@ void CreatureObject::setLevel(int level) void CreatureObject::recalculateLevel() { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if (playerObject != nullptr) + if (playerObject != NULL) { if (!isAuthoritative()) { @@ -14044,7 +14044,7 @@ void CreatureObject::recalculateLevel() void CreatureObject::setLevelData(int16 level, int levelXp, int health) { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if (playerObject != nullptr) + if (playerObject != NULL) { m_totalLevelXp = levelXp; @@ -14278,7 +14278,7 @@ bool CreatureObject::doesLocomotionInvalidateCommand(Command const &cmd) const CommandQueue * CreatureObject::getCommandQueue() const { - if (m_commandQueue == nullptr) + if (m_commandQueue == NULL) { m_commandQueue = CommandQueue::getCommandQueue(*const_cast(this)); } @@ -14667,7 +14667,7 @@ void CreatureObject::incrementKillMeter(int amount) if (isPlayerControlled()) { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if (playerObject != nullptr) + if (playerObject != NULL) { playerObject->incrementKillMeter(amount); } @@ -14812,7 +14812,7 @@ void CreatureObject::getLfgCharacterData(LfgCharacterData & lfgCharacterData) co Vector const creaturePosition = findPosition_w(); Region const * const region = RegionMaster::getSmallestVisibleRegionAtPoint(planetObject->getName(), creaturePosition.x, creaturePosition.z); - if (region != nullptr) + if (region != NULL) lfgCharacterData.locationRegion = Unicode::wideToNarrow(region->getName()); // handle factional presence @@ -14853,7 +14853,7 @@ void CreatureObject::getLfgCharacterData(LfgCharacterData & lfgCharacterData) co { // is factional presence allowed while mounted? if (ConfigServerGame::getGcwFactionalPresenceMountedPct() <= 0) - playerOrMount = nullptr; + playerOrMount = NULL; } else { @@ -14863,7 +14863,7 @@ void CreatureObject::getLfgCharacterData(LfgCharacterData & lfgCharacterData) co if (playerOrMount) { CollisionProperty const * const collisionProperty = playerOrMount->getCollisionProperty(); - Footprint const * const footprint = (collisionProperty ? collisionProperty->getFootprint() : nullptr); + Footprint const * const footprint = (collisionProperty ? collisionProperty->getFootprint() : NULL); bool isOnSolidFloor = (footprint && footprint->isOnSolidFloor()); if (isOnSolidFloor) { @@ -14939,7 +14939,7 @@ void CreatureObject::getLfgCharacterData(LfgCharacterData & lfgCharacterData) co if (i.getValue(ctsTransactionDetail)) { Unicode::UnicodeStringVector tokens; - if (Unicode::tokenize(ctsTransactionDetail, tokens, nullptr, nullptr) && (tokens.size() >= 4)) + if (Unicode::tokenize(ctsTransactionDetail, tokens, NULL, NULL) && (tokens.size() >= 4)) { IGNORE_RETURN(lfgCharacterData.ctsSourceGalaxy.insert(Unicode::wideToNarrow(tokens[1]))); } @@ -15094,7 +15094,7 @@ void CreatureObjectNamespace::restoreItemDecorationLayout(CreatureObject & decor // item is not currently in the target room, need to move it bool needToMoveItem = false; bool needToRotateItem = false; - Transform const * itemCurrentTransform = nullptr; + Transform const * itemCurrentTransform = NULL; if (itemContainingCell->getNetworkId() != cellSo->getNetworkId()) { needToMoveItem = true; @@ -15344,7 +15344,7 @@ void CreatureObject::addPackedAppearanceWearable(std::string const &appearanceDa } } //-- Add the new entry. - m_wearableAppearanceData.push_back(WearableEntry(appearanceData, arrangementIndex, networkId, sharedTemplateCrcValue, nullptr, nullptr)); + m_wearableAppearanceData.push_back(WearableEntry(appearanceData, arrangementIndex, networkId, sharedTemplateCrcValue, NULL, NULL)); } // ---------------------------------------------------------------------- @@ -15511,7 +15511,7 @@ void CreatureObject::saveDecorationLayout(ServerObject const & pobSourceObject, } snprintf(buffer1, sizeof(buffer1)-1, "savedDecoration%d.saveTime", saveSlotNumber); - playerObj->setObjVarItem(buffer1, static_cast(::time(nullptr))); + playerObj->setObjVarItem(buffer1, static_cast(::time(NULL))); snprintf(buffer1, sizeof(buffer1)-1, "savedDecoration%d.pobName", saveSlotNumber); playerObj->setObjVarItem(buffer1, containingPOB->getObjectNameStringId().localize()); @@ -15607,7 +15607,7 @@ void CreatureObject::restoreDecorationLayout(ServerObject const & pobTargetObjec } // don't allow another restore on the pob while one is still in progress - int const timeNow = static_cast(::time(nullptr)); + int const timeNow = static_cast(::time(NULL)); int restoreDecorationOperationTimeout = 0; if (getObjVars().getItem("restoreDecorationOperation.timeout", restoreDecorationOperationTimeout) && (restoreDecorationOperationTimeout > timeNow)) { diff --git a/engine/server/library/serverGame/src/shared/object/CreatureObject.h b/engine/server/library/serverGame/src/shared/object/CreatureObject.h index a1fab43b..f2fb0607 100755 --- a/engine/server/library/serverGame/src/shared/object/CreatureObject.h +++ b/engine/server/library/serverGame/src/shared/object/CreatureObject.h @@ -194,7 +194,7 @@ public: virtual void onClientReady (Client *c); virtual void onClientAboutToLoad(); virtual void onLoadingScreenComplete(); - virtual bool canManipulateObject(ServerObject const &target, bool movingObject, bool doPermissionCheckOnItem, bool doPermissionCheckOnParent, float maxDistance, Container::ContainerErrorCode&, bool skipNoTradeCheck = false, bool * allowedByGodMode = nullptr) const; + virtual bool canManipulateObject(ServerObject const &target, bool movingObject, bool doPermissionCheckOnItem, bool doPermissionCheckOnParent, float maxDistance, Container::ContainerErrorCode&, bool skipNoTradeCheck = false, bool * allowedByGodMode = NULL) const; virtual void onRemovingFromWorld(); void addMembersToPackages(); @@ -330,7 +330,7 @@ public: void addAttributeModifier(const std::string & name, Attributes::Enumerator attrib, int value, float duration, float attackRate, float decayRate, int flags); void addSkillmodModifier(const std::string & name, const std::string & skill, int value, float duration, int flags); - int addAttributeModifier(const AttribMod::AttribMod & mod, ServerObject * attacker = nullptr); + int addAttributeModifier(const AttribMod::AttribMod & mod, ServerObject * attacker = NULL); bool hasAttribModifier(const std::string & modName) const; void removeAttributeModifier(const std::string & modName); void removeAttributeModifiers(Attributes::Enumerator attribute); @@ -747,7 +747,7 @@ private: void testIncapacitation(const NetworkId & attackerId); void initializeNewPlayer (); - void addPackedWearable(std::string const &appearanceData, int arrangementIndex, NetworkId const &networkId, uint32 sharedTemplateCrcValue, const BaselinesMessage * weaponSharedBaselines = nullptr, const BaselinesMessage * weaponSharedNpBaselines = nullptr); + void addPackedWearable(std::string const &appearanceData, int arrangementIndex, NetworkId const &networkId, uint32 sharedTemplateCrcValue, const BaselinesMessage * weaponSharedBaselines = NULL, const BaselinesMessage * weaponSharedNpBaselines = NULL); void addPackedAppearanceWearable(std::string const &appearanceData, int arrangementIndex, NetworkId const &networkId, uint32 sharedTemplateCrcValue); void packWearables(); void computeTotalAttributes (); diff --git a/engine/server/library/serverGame/src/shared/object/CreatureObject_Mounts.cpp b/engine/server/library/serverGame/src/shared/object/CreatureObject_Mounts.cpp index a0367619..1b164c1e 100755 --- a/engine/server/library/serverGame/src/shared/object/CreatureObject_Mounts.cpp +++ b/engine/server/library/serverGame/src/shared/object/CreatureObject_Mounts.cpp @@ -77,18 +77,18 @@ CreatureObject * CreatureObjectNamespace::realGetMountingRider(CreatureObject co { //-- Ensure mounts are enabled. if (!ConfigServerGame::getMountsEnabled()) - return nullptr; + return NULL; //-- Get the rider element from the slotted container. SlottedContainer const * const slottedContainer = ContainerInterface::getSlottedContainer(*mount); if (!slottedContainer) - return nullptr; + return NULL; //-- Check for a rider. Container::ContainerErrorCode errorCode = Container::CEC_Success; CachedNetworkId riderId = slottedContainer->getObjectInSlot(slot, errorCode); if (errorCode != Container::CEC_Success) - return nullptr; + return NULL; Object * const riderObject = riderId.getObject(); @@ -236,7 +236,7 @@ bool CreatureObjectNamespace::realDetachRider(CreatureObject * const mount, Slot { // Transfer rider to world. // @todo: -TRF- transfer to mount's cell if we allow mounts inside cells. - IGNORE_RETURN(ContainerInterface::transferItemToWorld(*rider, mount->getTransform_o2w(), nullptr, errorCode)); + IGNORE_RETURN(ContainerInterface::transferItemToWorld(*rider, mount->getTransform_o2w(), NULL, errorCode)); if (errorCode == Container::CEC_Success) { detachedRider = true; @@ -318,7 +318,7 @@ void CreatureObject::transferRiderPositionToMount() CreatureObject *const mountObject = getMountedCreature(); if (!mountObject) { - LOG("mounts-bug", ("CreatureObject::transferRiderPositionToMount(): server id=[%d],object id=[%s] has state RidingMount but getMountedCreature() returns nullptr.", static_cast(GameServer::getInstance().getProcessId()), getNetworkId().getValueString().c_str())); + LOG("mounts-bug", ("CreatureObject::transferRiderPositionToMount(): server id=[%d],object id=[%s] has state RidingMount but getMountedCreature() returns NULL.", static_cast(GameServer::getInstance().getProcessId()), getNetworkId().getValueString().c_str())); emergencyDismountForRider(); return; } @@ -397,7 +397,7 @@ void CreatureObject::alterAuthoritativeForMounts() } } else - LOG(cs_mountErrorChannelName, ("unexpected: rider object id=[%s],template=[%s] is reporting state States::RidingMount turned on but getMountedCreature() returned nullptr.", getNetworkId().getValueString().c_str(), getObjectTemplateName())); + LOG(cs_mountErrorChannelName, ("unexpected: rider object id=[%s],template=[%s] is reporting state States::RidingMount turned on but getMountedCreature() returned NULL.", getNetworkId().getValueString().c_str(), getObjectTemplateName())); } else if (getState(States::MountedCreature)) { @@ -484,7 +484,7 @@ void CreatureObject::alterAnyForMounts() if (isAuthoritative() && !getState(States::MountedCreature)) { WARNING(true, - ("mounts sanity check failure: game server id=[%d], mount id=[%s,%s], rider id=[%s,%s]: authoritative mount does not have MountedCreature state set but getMountingRider returned a non-nullptr value.", + ("mounts sanity check failure: game server id=[%d], mount id=[%s,%s], rider id=[%s,%s]: authoritative mount does not have MountedCreature state set but getMountingRider returned a non-NULL value.", static_cast(GameServer::getInstance().getProcessId()), getNetworkId().getValueString().c_str(), isAuthoritative() ? "authoritative" : "proxy", @@ -511,7 +511,7 @@ void CreatureObject::alterAnyForMounts() // Ensure we don't have the mounted creature state set (only do check on authoritative mount). WARNING(isAuthoritative() && getState(States::MountedCreature), - ("mounts sanity check failure: game server id=[%d], mount id=[%s,%s]: authoritative mount does have MountedCreature state set but getMountingRider() returned a nullptr value.", + ("mounts sanity check failure: game server id=[%d], mount id=[%s,%s]: authoritative mount does have MountedCreature state set but getMountingRider() returned a NULL value.", static_cast(GameServer::getInstance().getProcessId()), getNetworkId().getValueString().c_str(), isAuthoritative() ? "authoritative" : "proxy" @@ -550,7 +550,7 @@ void CreatureObject::alterAnyForMounts() if (isAuthoritative() && !getState(States::RidingMount)) { WARNING(true, - ("mounts sanity check failure: game server id=[%d], rider id=[%s,%s], mount id=[%s,%s]: authoritative rider does not have RidingMount state set but getMountedCreature() returned a non-nullptr value.", + ("mounts sanity check failure: game server id=[%d], rider id=[%s,%s], mount id=[%s,%s]: authoritative rider does not have RidingMount state set but getMountedCreature() returned a non-NULL value.", static_cast(GameServer::getInstance().getProcessId()), getNetworkId().getValueString().c_str(), isAuthoritative() ? "authoritative" : "proxy", @@ -576,7 +576,7 @@ void CreatureObject::alterAnyForMounts() { // Ensure we don't have the RidingMount state set (only do check on authoritative rider). WARNING(isAuthoritative() && getState(States::RidingMount), - ("mounts sanity check failure: game server id=[%d], rider id=[%s,%s]: authoritative rider does have RidingMount state set but getMountedCreature() returned a nullptr value.", + ("mounts sanity check failure: game server id=[%d], rider id=[%s,%s]: authoritative rider does have RidingMount state set but getMountedCreature() returned a NULL value.", static_cast(GameServer::getInstance().getProcessId()), getNetworkId().getValueString().c_str(), isAuthoritative() ? "authoritative" : "proxy" @@ -599,13 +599,13 @@ bool CreatureObject::onContainerAboutToTransferForMounts(ServerObject const * de // (i.e. the container creature has not yet been set.) We must clear the RidingMount // state on a rider prior to intentionally dismounting the rider (see and use detachRider() // on the mount object. - bool const canChangeContainerNow = (getMountedCreature() == nullptr); + bool const canChangeContainerNow = (getMountedCreature() == NULL); if (!canChangeContainerNow) { LOG("mounts-bug", ("CO::onContainerAboutToTransferForMounts():server id=[%d],rider id=[%s] erroneously tried to transfer the player into object id=[%s].", static_cast(GameServer::getInstance().getProcessId()), getNetworkId().getValueString().c_str(), - (destination == nullptr) ? "" : destination->getNetworkId().getValueString().c_str())); + (destination == NULL) ? "" : destination->getNetworkId().getValueString().c_str())); } return canChangeContainerNow; } @@ -839,7 +839,7 @@ bool CreatureObject::detachAllRiders() if (!isAuthoritative()) { // add a plural message - sendControllerMessageToAuthServer(CM_detachAllRidersForMount, nullptr); + sendControllerMessageToAuthServer(CM_detachAllRidersForMount, NULL); return true; } @@ -988,9 +988,9 @@ bool CreatureObject::mountCreature(CreatureObject &mountObject) for (int i = 0; i < maxSlots; ++i) { - if (ContainerInterface::canTransferToSlot(mountObject, *this, s_riderSlotId[i], nullptr, errorCode)) + if (ContainerInterface::canTransferToSlot(mountObject, *this, s_riderSlotId[i], NULL, errorCode)) { - transferSuccess = ContainerInterface::transferItemToSlottedContainer(mountObject, *this, s_riderSlotId[i], nullptr, errorCode); + transferSuccess = ContainerInterface::transferItemToSlottedContainer(mountObject, *this, s_riderSlotId[i], NULL, errorCode); if ((transferSuccess) && (errorCode == Container::CEC_Success)) { @@ -1051,20 +1051,20 @@ CreatureObject *CreatureObject::getMountedCreature() { //-- Ensure mounts are enabled. if (!ConfigServerGame::getMountsEnabled()) - return nullptr; + return NULL; //-- Check this creature's container object. ServerObject *const container = safe_cast(ContainerInterface::getContainedByObject(*this)); if (!container) - return nullptr; + return NULL; //-- Check if the container is a creature. CreatureObject *const creatureContainer = container->asCreatureObject(); if (!creatureContainer) - return nullptr; + return NULL; //-- Ignore non-mountable creature objects. - CreatureObject *const mount = creatureContainer->isMountable() ? creatureContainer : nullptr; + CreatureObject *const mount = creatureContainer->isMountable() ? creatureContainer : NULL; return mount; } @@ -1096,7 +1096,7 @@ void CreatureObject::emergencyDismountForRider() //-- Pass request along to authoritative server if we're not it. if (!isAuthoritative()) { - sendControllerMessageToAuthServer(CM_emergencyDismountForRider, nullptr); + sendControllerMessageToAuthServer(CM_emergencyDismountForRider, NULL); return; } @@ -1116,7 +1116,7 @@ void CreatureObject::emergencyDismountForRider() //-- Transfer the rider to the world cell. Container::ContainerErrorCode errorCode = Container::CEC_Success; - bool const transferSucceeded = ContainerInterface::transferItemToWorld (*this, this->getTransform_o2w(), nullptr, errorCode); + bool const transferSucceeded = ContainerInterface::transferItemToWorld (*this, this->getTransform_o2w(), NULL, errorCode); WARNING(!transferSucceeded || (errorCode != Container::CEC_Success), ("Transfer to world failed, return value=[%s], error code=[%d].", transferSucceeded ? "true" : "false", static_cast(errorCode))); } diff --git a/engine/server/library/serverGame/src/shared/object/CreatureObject_Ships.cpp b/engine/server/library/serverGame/src/shared/object/CreatureObject_Ships.cpp index a72020be..3f9de076 100755 --- a/engine/server/library/serverGame/src/shared/object/CreatureObject_Ships.cpp +++ b/engine/server/library/serverGame/src/shared/object/CreatureObject_Ships.cpp @@ -71,7 +71,7 @@ bool CreatureObject::pilotShip(ServerObject &pilotSlotObject) SlotId const pilotSlotId = pilotSlotObject.asShipObject() ? ShipSlotIdManager::getShipPilotSlotId() : ShipSlotIdManager::getPobShipPilotSlotId(); Container::ContainerErrorCode errorCode = Container::CEC_Success; - bool const transferSuccess = ContainerInterface::transferItemToSlottedContainer(pilotSlotObject, *this, pilotSlotId, nullptr, errorCode); + bool const transferSuccess = ContainerInterface::transferItemToSlottedContainer(pilotSlotObject, *this, pilotSlotId, NULL, errorCode); DEBUG_FATAL(transferSuccess && (errorCode != Container::CEC_Success), ("pilotShip(): transferItemToSlottedContainer() returned success but container error code returned error %d.", static_cast(errorCode))); if (transferSuccess) @@ -199,7 +199,7 @@ void CreatureObject::getAllShipsInDatapad(std::vector & result) const for(ContainerConstIterator iter = datapadContainer->begin(); iter != datapadContainer->end(); ++iter) { Object const * const itemO = (*iter).getObject(); - ServerObject const * const itemSO = itemO ? itemO->asServerObject() : nullptr; + ServerObject const * const itemSO = itemO ? itemO->asServerObject() : NULL; if(itemSO && (itemSO->getGameObjectType() == SharedObjectTemplate::GOT_data_ship_control_device)) { Container const * const itemContainer = ContainerInterface::getContainer(*itemSO); @@ -211,8 +211,8 @@ void CreatureObject::getAllShipsInDatapad(std::vector & result) const for(ContainerConstIterator iter2 = itemContainer->begin(); iter2 != itemContainer->end(); ++iter2) { Object const * const o = (*iter2).getObject(); - ServerObject const * const so = o ? o->asServerObject() : nullptr; - ShipObject const * const ship = so ? so->asShipObject() : nullptr; + ServerObject const * const so = o ? o->asServerObject() : NULL; + ShipObject const * const ship = so ? so->asShipObject() : NULL; if(ship) { result.push_back(ship->getNetworkId()); diff --git a/engine/server/library/serverGame/src/shared/object/DraftSchematicObject.cpp b/engine/server/library/serverGame/src/shared/object/DraftSchematicObject.cpp index b0ec57ba..37ea045c 100755 --- a/engine/server/library/serverGame/src/shared/object/DraftSchematicObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/DraftSchematicObject.cpp @@ -36,8 +36,8 @@ static const std::string REQUEST_RESOURCE_WEIGHTS_SCRIPT_METHOD("OnRequestResour // ====================================================================== // static members -DraftSchematicObject::SchematicMap * DraftSchematicObject::m_schematics = nullptr; -const SharedObjectTemplate * DraftSchematicObject::m_defaultSharedTemplate = nullptr; +DraftSchematicObject::SchematicMap * DraftSchematicObject::m_schematics = NULL; +const SharedObjectTemplate * DraftSchematicObject::m_defaultSharedTemplate = NULL; // ====================================================================== @@ -105,13 +105,13 @@ const SharedObjectTemplate * DraftSchematicObject::getDefaultSharedTemplate(void { static const ConstCharCrcLowerString templateName("object/draft_schematic/base/shared_draft_schematic_default.iff"); - if (m_defaultSharedTemplate == nullptr) + if (m_defaultSharedTemplate == NULL) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create " + WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create " "default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != nullptr) + if (m_defaultSharedTemplate != NULL) ExitChain::add (removeDefaultTemplate, "DraftSchematicObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -124,10 +124,10 @@ static const ConstCharCrcLowerString templateName("object/draft_schematic/base/s */ void DraftSchematicObject::removeDefaultTemplate(void) { - if (m_defaultSharedTemplate != nullptr) + if (m_defaultSharedTemplate != NULL) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = nullptr; + m_defaultSharedTemplate = NULL; } } // DraftSchematicObject::removeDefaultTemplate @@ -141,21 +141,21 @@ void DraftSchematicObject::removeDefaultTemplate(void) */ void DraftSchematicObject::requestResourceWeights(ServerObject & requester, uint32 draftSchematicCrc) { - if (requester.getClient() == nullptr) + if (requester.getClient() == NULL) { WARNING (true, ("DraftSchematicObject::requestResourceWeights invalid client for [%s]", requester.getNetworkId ().getValueString ().c_str ())); return; } const DraftSchematicObject * const schematic = getSchematic(draftSchematicCrc); - if (schematic == nullptr) + if (schematic == NULL) { WARNING (true, ("DraftSchematicObject::requestResourceWeights invalid schematic [%lu] for [%s]", draftSchematicCrc, requester.getNetworkId ().getValueString ().c_str ())); return; } const ServerDraftSchematicObjectTemplate * const schematicTemplate = safe_cast(schematic->getObjectTemplate()); - if (schematicTemplate == nullptr) + if (schematicTemplate == NULL) { WARNING (true, ("DraftSchematicObject::requestResourceWeights invalid schematic template [%lu] for [%s]", draftSchematicCrc, requester.getNetworkId ().getValueString ().c_str ())); return; @@ -167,7 +167,7 @@ void DraftSchematicObject::requestResourceWeights(ServerObject & requester, uint desiredAttribs.push_back((*i).first.getText().c_str()); } - std::vector attributes(MAX_ATTRIBUTES * 2, static_cast(nullptr)); + std::vector attributes(MAX_ATTRIBUTES * 2, static_cast(NULL)); std::vector slots(MAX_ATTRIBUTES * 2, 0); std::vector counts(MAX_ATTRIBUTES * 2, 0); std::vector weights(MAX_ATTRIBUTES * 2 * Crafting::RA_numResourceAttributes * 2, 0); @@ -198,7 +198,7 @@ void DraftSchematicObject::requestResourceWeights(ServerObject & requester, uint for (std::vector::const_iterator i(newAttributes.begin()); i != newAttributes.end(); ++i, ++attribCount) { - if (*i == nullptr) + if (*i == NULL) break; } } @@ -257,8 +257,8 @@ ManufactureSchematicObject * DraftSchematicObject::createManufactureSchematic( { Object * object = ServerManufactureSchematicObjectTemplate::createObject( "object/manufacture_schematic/generic_schematic.iff", *this); - if (object == nullptr) - return nullptr; + if (object == NULL) + return NULL; ManufactureSchematicObject * schematic = safe_cast(object); schematic->init(*this, creator); schematic->setNetworkId(ObjectIdManager::getInstance().getNewObjectId()); @@ -478,8 +478,8 @@ const DraftSchematicObject * DraftSchematicObject::getSchematic( const DraftSchematicObject * DraftSchematicObject::getSchematic(uint32 crc) { NOT_NULL(m_schematics); - if (m_schematics == nullptr || crc == 0) - return nullptr; + if (m_schematics == NULL || crc == 0) + return NULL; // see if the schematic is already loaded SchematicMap::iterator result = m_schematics->find(crc); @@ -491,30 +491,30 @@ const DraftSchematicObject * DraftSchematicObject::getSchematic(uint32 crc) if (name.isEmpty()) { WARNING(true, ("Unable to find template name for crc %u", crc)); - return nullptr; + return NULL; } // create a new schematic if (!TreeFile::exists(name.getString())) { WARNING(true, ("Draft schematic template %s file not found", name.getString())); - return nullptr; + return NULL; } const ObjectTemplate * objTemplate = ObjectTemplateList::fetch(name); - if (objTemplate == nullptr) + if (objTemplate == NULL) { WARNING(true, ("Can't create object template %s", name.getString())); - return nullptr; + return NULL; } const ServerDraftSchematicObjectTemplate * schematicTemplate = dynamic_cast(objTemplate); - if (schematicTemplate == nullptr) + if (schematicTemplate == NULL) { WARNING(true, ("Template %s is not a draft schematic", name.getString())); objTemplate->releaseReference(); - return nullptr; + return NULL; } const DraftSchematicObject * schematic = new DraftSchematicObject(schematicTemplate); @@ -531,7 +531,7 @@ const DraftSchematicObject * DraftSchematicObject::getSchematic(uint32 crc) */ void DraftSchematicObject::install() { - if (m_schematics == nullptr) + if (m_schematics == NULL) m_schematics = new SchematicMap(); } // DraftSchematicObject::install @@ -542,16 +542,16 @@ void DraftSchematicObject::install() */ void DraftSchematicObject::remove() { - if (m_schematics != nullptr) + if (m_schematics != NULL) { SchematicMap::iterator iter; for (iter = m_schematics->begin(); iter != m_schematics->end(); ++iter) { delete (*iter).second; - (*iter).second = nullptr; + (*iter).second = NULL; } delete m_schematics; - m_schematics = nullptr; + m_schematics = NULL; } } // DraftSchematicObject::remove diff --git a/engine/server/library/serverGame/src/shared/object/FactoryObject.cpp b/engine/server/library/serverGame/src/shared/object/FactoryObject.cpp index 66481dad..77e6780b 100755 --- a/engine/server/library/serverGame/src/shared/object/FactoryObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/FactoryObject.cpp @@ -58,7 +58,7 @@ static const StringId STRING_ID_CANT_SPLIT("system_msg", "cant_split_crate"); //---------------------------------------------------------------------- -const SharedObjectTemplate * FactoryObject::m_defaultSharedTemplate = nullptr; +const SharedObjectTemplate * FactoryObject::m_defaultSharedTemplate = NULL; //----------------------------------------------------------------------- @@ -176,7 +176,7 @@ void FactoryObject::onLoadedFromDatabase() if (getLoadContents() && getCount() > 0) { // verify that we have a contained object - if (getContainedObject() == nullptr) + if (getContainedObject() == NULL) { WARNING_STRICT_FATAL(true, ("Factory object %s has a count of %d, " "but no contained object! We are setting the count to 0.", @@ -197,11 +197,11 @@ const SharedObjectTemplate * FactoryObject::getDefaultSharedTemplate() const { static const ConstCharCrcLowerString templateName("object/factory/base/shared_factory_default.iff"); - if (m_defaultSharedTemplate == nullptr) + if (m_defaultSharedTemplate == NULL) { m_defaultSharedTemplate = safe_cast(ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != nullptr) + WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create default shared object template %s", templateName.getString())); + if (m_defaultSharedTemplate != NULL) ExitChain::add (removeDefaultTemplate, "FactoryObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -214,10 +214,10 @@ const SharedObjectTemplate * FactoryObject::getDefaultSharedTemplate() const */ void FactoryObject::removeDefaultTemplate() { - if (m_defaultSharedTemplate != nullptr) + if (m_defaultSharedTemplate != NULL) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = nullptr; + m_defaultSharedTemplate = NULL; } } // FactoryObject::removeDefaultTemplate @@ -288,10 +288,10 @@ bool FactoryObject::isFactoryOk() const char errBuffer[BUFSIZE]; const DraftSchematicObject * draft = DraftSchematicObject::getSchematic( getDraftSchematic()); - if (draft != nullptr) + if (draft != NULL) { // make sure we have an object instance defined - if (getCount() > 0 && getContainedObject() == nullptr) + if (getCount() > 0 && getContainedObject() == NULL) { sprintf(errBuffer, "not having a contained object instance"); factoryOk = false; @@ -307,16 +307,16 @@ bool FactoryObject::isFactoryOk() const { // send out logs/emails m_badFactoryLogged = true; - const ServerObject * owner = nullptr; + const ServerObject * owner = NULL; const Object * object = NetworkIdManager::getObjectById(getOwnerId()); - if (object != nullptr) + if (object != NULL) owner = object->asServerObject(); // log that the schematic can't be used LOG("CustomerService", ("Crafting: factory crate object %s " "owned by %s is unuseable due to %s", getNetworkId().getValueString().c_str(), PlayerObject::getAccountDescription(owner).c_str(), errBuffer)); - if (owner != nullptr) + if (owner != NULL) { // send mail to the owner telling them their schematic can't be used const static StringId message("system_msg", "crate_unuseable"); @@ -351,7 +351,7 @@ bool FactoryObject::canDestroy() const OutOfBandPackager::pack(pp, -1, oob); } const Object * const owner = NetworkIdManager::getObjectById(getOwnerId()); - if (owner != nullptr) + if (owner != NULL) { Chat::sendSystemMessage(*(owner->asServerObject()), Unicode::emptyString, oob); } @@ -367,14 +367,14 @@ bool FactoryObject::canDestroy() const void FactoryObject::onContainerTransfer(ServerObject * destination, ServerObject* transferer) { - if (inCraftingSession() && destination != nullptr && + if (inCraftingSession() && destination != NULL && destination->getNetworkId() != m_craftingSchematic.get()) { if (!isFactoryOk()) return; Object * schematic = m_craftingSchematic.get().getObject(); - if (schematic == nullptr) + if (schematic == NULL) { WARNING(true, ("FactoryObject::onContainerTransfer: could not get the schematic for factory %s", getNetworkId().getValueString().c_str())); return; @@ -387,13 +387,13 @@ void FactoryObject::onContainerTransfer(ServerObject * destination, // our components to reference if (m_craftingCount.get() != 0) { - FactoryObject * newFactory = nullptr; + FactoryObject * newFactory = NULL; if (getCount() > 1) { // make a new factory in the manf schematic newFactory = makeCopy(*(m_craftingSchematic.get().getObject()-> asServerObject()), 1); - if (newFactory != nullptr) + if (newFactory != NULL) { // NOTE: potential dupe here, but the player shouldn't be able to // remove the new factory without decreasing the component count @@ -403,26 +403,26 @@ void FactoryObject::onContainerTransfer(ServerObject * destination, // swap the contained item instances so that any current references // will point to a local object TangibleObject * myObject = const_cast(getContainedObject()); - if (myObject == nullptr) + if (myObject == NULL) { - WARNING(true, ("FactoryObject::onContainerTransfer: getContainedObject for %s returned nullptr", getNetworkId().getValueString().c_str())); + WARNING(true, ("FactoryObject::onContainerTransfer: getContainedObject for %s returned NULL", getNetworkId().getValueString().c_str())); return; } TangibleObject * newObject = const_cast(newFactory->getContainedObject()); - if (newObject == nullptr) + if (newObject == NULL) { - WARNING(true, ("FactoryObject::onContainerTransfer: getContainedObject for %s returned nullptr", newFactory->getNetworkId().getValueString().c_str())); + WARNING(true, ("FactoryObject::onContainerTransfer: getContainedObject for %s returned NULL", newFactory->getNetworkId().getValueString().c_str())); newFactory->permanentlyDestroy(DeleteReasons::SetupFailed); return; } Container::ContainerErrorCode error; - if (!ContainerInterface::transferItemToVolumeContainer (*newFactory, *myObject, nullptr, error)) + if (!ContainerInterface::transferItemToVolumeContainer (*newFactory, *myObject, NULL, error)) { WARNING(true, ("FactoryObject::onContainerTransfer: could not transfer factory %s to container %s", newFactory->getNetworkId().getValueString().c_str(), myObject->getNetworkId().getValueString().c_str())); newFactory->permanentlyDestroy(DeleteReasons::SetupFailed); return; } - if (!ContainerInterface::transferItemToVolumeContainer (*this, *newObject, nullptr, error)) + if (!ContainerInterface::transferItemToVolumeContainer (*this, *newObject, NULL, error)) { WARNING(true, ("FactoryObject::onContainerTransfer: could not transfer factory %s to container %s", getNetworkId().getValueString().c_str(), newObject->getNetworkId().getValueString().c_str())); return; @@ -434,7 +434,7 @@ void FactoryObject::onContainerTransfer(ServerObject * destination, // make a new factory with one item, but don't destroy ourself newFactory = makeCopy(*(m_craftingSchematic.get().getObject()-> asServerObject()), 1, false); - if (newFactory == nullptr) + if (newFactory == NULL) { WARNING(true, ("FactoryObject::onContainerTransfer: could not make a copy of factory %s", getNetworkId().getValueString().c_str())); return; @@ -448,9 +448,9 @@ void FactoryObject::onContainerTransfer(ServerObject * destination, // update the crafting status of ourself and the new factory ManufactureSchematicObject * schematic = safe_cast( m_craftingSchematic.get().getObject()); - if (schematic != nullptr) + if (schematic != NULL) { - if (newFactory != nullptr) + if (newFactory != NULL) { // set up the new factory to have the same crafting info // that we do @@ -525,7 +525,7 @@ bool FactoryObject::inCraftingSession() const return false; // make sure the crafting schematic id is a valid object - if (m_craftingSchematic.get().getObject() == nullptr) + if (m_craftingSchematic.get().getObject() == NULL) { WARNING_STRICT_FATAL(true, ("FactoryObject %s has a schematic id of %s " "that isn't a valid object!!!", getNetworkId().getValueString().c_str(), @@ -598,7 +598,7 @@ bool FactoryObject::addObject() if (getCount() == 0) { TangibleObject * object = manufactureObject(); - if (object != nullptr) + if (object != NULL) { setObjectName(object->getObjectName()); setComplexity(object->getComplexity()); @@ -615,7 +615,7 @@ bool FactoryObject::addObject() } const ServerObject * parent = safe_cast(ContainerInterface::getFirstParentInWorld(*this)); - if (parent != nullptr) + if (parent != NULL) LOG("CustomerService", ("Crafting:incrementing count of crate %s (owner %s) to %d", getNetworkId().getValueString().c_str(), PlayerObject::getAccountDescription(parent->getOwnerId()).c_str(), getCount())); else LOG("CustomerService", ("Crafting:incrementing count of crate %s to %d", getNetworkId().getValueString().c_str(), getCount())); @@ -645,7 +645,7 @@ bool FactoryObject::removeObject(ServerObject & destination) if (!isFactoryOk()) return false; - if (getCount() > 0 && ContainerInterface::getVolumeContainer(destination) != nullptr) + if (getCount() > 0 && ContainerInterface::getVolumeContainer(destination) != NULL) { if (!getLoadContents()) { @@ -665,7 +665,7 @@ bool FactoryObject::removeObject(ServerObject & destination) else { // new style factory - TangibleObject * object = nullptr; + TangibleObject * object = NULL; if (getCount() > 1) { object = manufactureObject(); @@ -686,7 +686,7 @@ bool FactoryObject::removeObject(ServerObject & destination) } const CachedNetworkId & id = *(container->begin()); Object * obj = id.getObject(); - if (obj != nullptr && obj->asServerObject()->asTangibleObject() != nullptr) + if (obj != NULL && obj->asServerObject()->asTangibleObject() != NULL) { object = obj->asServerObject()->asTangibleObject(); } @@ -706,15 +706,15 @@ bool FactoryObject::removeObject(ServerObject & destination) object = manufactureObject(); } } - if (object != nullptr) + if (object != NULL) { Container::ContainerErrorCode error; - if (ContainerInterface::transferItemToVolumeContainer(destination, *object, nullptr, error)) + if (ContainerInterface::transferItemToVolumeContainer(destination, *object, NULL, error)) { incrementCount(-1); const ServerObject * parent = safe_cast(ContainerInterface::getFirstParentInWorld(destination)); - if (parent != nullptr) + if (parent != NULL) LOG("CustomerService", ("Crafting:removed object %s from crate %s to container %s of player %s. Crate count = %d", object->getNetworkId().getValueString().c_str(), getNetworkId().getValueString().c_str(), destination.getNetworkId().getValueString().c_str(), PlayerObject::getAccountDescription(parent->getNetworkId()).c_str(), getCount())); else LOG("CustomerService", ("Crafting:removed object %s from crate %s to container %s. Crate count = %d", object->getNetworkId().getValueString().c_str(), getNetworkId().getValueString().c_str(), destination.getNetworkId().getValueString().c_str(), getCount())); @@ -828,14 +828,14 @@ void FactoryObject::onContainedObjectLoaded(const NetworkId &oid) // check if the object is on our pending list ServerObject * destination = removeIdFromPendingList(oid); - if (destination != nullptr) + if (destination != NULL) { TangibleObject * item = safe_cast(NetworkIdManager::getObjectById( oid)); - if (item != nullptr) + if (item != NULL) { Container::ContainerErrorCode error = Container::CEC_Success; - if (ContainerInterface::transferItemToVolumeContainer(*destination, *item, nullptr, error)) + if (ContainerInterface::transferItemToVolumeContainer(*destination, *item, NULL, error)) { // if that was the last item of ours, delete ourself if (getCount() == 0 && getPendingListCount() == 0) @@ -849,7 +849,7 @@ void FactoryObject::onContainedObjectLoaded(const NetworkId &oid) item->unload(); // tell the owner something went wrong Object * owner = NetworkIdManager::getObjectById(getOwnerId()); - if (owner != nullptr) + if (owner != NULL) { ContainerInterface::sendContainerMessageToClient(*safe_cast(owner), error); } @@ -873,35 +873,35 @@ void FactoryObject::onContainedObjectLoaded(const NetworkId &oid) * functionality of ManufactureSchematicObject::manufactureObject; if that * function changes, this one should too. * - * @return the new object, or nullptr on error + * @return the new object, or NULL on error */ TangibleObject * FactoryObject::manufactureObject() { if (!isFactoryOk()) - return nullptr; + return NULL; const DraftSchematicObject * draftSchematic = DraftSchematicObject::getSchematic(getDraftSchematic()); - if (draftSchematic == nullptr) + if (draftSchematic == NULL) { - return nullptr; + return NULL; } - if (draftSchematic->getCraftedObjectTemplate() == nullptr) + if (draftSchematic->getCraftedObjectTemplate() == NULL) { DEBUG_WARNING(true, ("Draft schematic %s does not have a craftable object template!\n", draftSchematic->getTemplateName())); - return nullptr; + return NULL; } // create the item TangibleObject * const object = dynamic_cast( ServerWorld::createNewObject(*draftSchematic->getCraftedObjectTemplate(), *this, false)); - if (object == nullptr) + if (object == NULL) { DEBUG_WARNING(true, ("Player %s failed to create object for template " "%s.\n", getOwnerId().getValueString().c_str(), draftSchematic->getCraftedObjectTemplate()->getName())); - return nullptr; + return NULL; } if (!getAssignedObjectName().empty()) @@ -928,7 +928,7 @@ TangibleObject * FactoryObject::manufactureObject() // set the creator xp type from the schematic template const ServerObjectTemplate * schematicTemplate = safe_cast(draftSchematic->getObjectTemplate()); - if (schematicTemplate != nullptr && schematicTemplate->getXpPointsCount() > 0) + if (schematicTemplate != NULL && schematicTemplate->getXpPointsCount() > 0) { ServerObjectTemplate::Xp xpData; schematicTemplate->getXpPoints(xpData, 0); @@ -948,7 +948,7 @@ TangibleObject * FactoryObject::manufactureObject() if (result == SCRIPT_OVERRIDE) { object->permanentlyDestroy(DeleteReasons::Script); - return nullptr; + return NULL; } return object; @@ -968,10 +968,10 @@ const char * FactoryObject::getContainedTemplateName() const const VolumeContainer * container = ContainerInterface::getVolumeContainer(*this); const CachedNetworkId & id = *(container->begin()); const Object * obj = id.getObject(); - if (obj != nullptr && obj->asServerObject() != nullptr) + if (obj != NULL && obj->asServerObject() != NULL) return obj->asServerObject()->getTemplateName(); } - return nullptr; + return NULL; } // FactoryObject::getContainedTemplateName // ---------------------------------------------------------------------- @@ -997,10 +997,10 @@ static std::string sharedTemplateName; const VolumeContainer * container = ContainerInterface::getVolumeContainer(*this); const CachedNetworkId & id = *(container->begin()); const Object * obj = id.getObject(); - if (obj != nullptr && obj->asServerObject() != nullptr) + if (obj != NULL && obj->asServerObject() != NULL) return obj->asServerObject()->getSharedTemplateName(); } - return nullptr; + return NULL; } // FactoryObject::getContainedSharedTemplateName // ---------------------------------------------------------------------- @@ -1017,10 +1017,10 @@ const ObjectTemplate * FactoryObject::getContainedObjectTemplate() const const VolumeContainer * container = ContainerInterface::getVolumeContainer(*this); const CachedNetworkId & id = *(container->begin()); const Object * obj = id.getObject(); - if (obj != nullptr && obj->asServerObject() != nullptr) + if (obj != NULL && obj->asServerObject() != NULL) return obj->asServerObject()->getObjectTemplate(); } - return nullptr; + return NULL; } // FactoryObject::getContainedObjectTemplate // ---------------------------------------------------------------------- @@ -1037,12 +1037,12 @@ const TangibleObject * FactoryObject::getContainedObject() const const VolumeContainer * container = ContainerInterface::getVolumeContainer(*this); const CachedNetworkId & id = *(container->begin()); const Object * obj = id.getObject(); - if (obj != nullptr && obj->asServerObject() != nullptr) + if (obj != NULL && obj->asServerObject() != NULL) { return obj->asServerObject()->asTangibleObject(); } } - return nullptr; + return NULL; } // FactoryObject::getContainedObject // ---------------------------------------------------------------------- @@ -1109,7 +1109,7 @@ ServerObject * FactoryObject::removeIdFromPendingList(const NetworkId & id) NetworkId objectId; if (!pendingList.getItem(idString,objectId)) - return nullptr; + return NULL; ServerObject * const object = safe_cast(NetworkIdManager::getObjectById(objectId)); removeObjVarItem(pendingList.getContextName() + idString); @@ -1415,7 +1415,7 @@ FactoryObject * FactoryObject::makeCopy(ServerObject & destination, int count, bool destroySource) { if (!isFactoryOk()) - return nullptr; + return NULL; // don't allow making a copy if we are an old crate if (!getLoadContents()) @@ -1428,52 +1428,52 @@ FactoryObject * FactoryObject::makeCopy(ServerObject & destination, int count, OutOfBandPackager::pack(pp, -1, oob); } const Object * const owner = NetworkIdManager::getObjectById(getOwnerId()); - if (owner != nullptr) + if (owner != NULL) { Chat::sendSystemMessage(*(owner->asServerObject()), Unicode::emptyString, oob); } - return nullptr; + return NULL; } if (count <= 0) { WARNING_STRICT_FATAL(true, ("FactoryObject::makeCopy %s passed invalid " "count %d", getNetworkId().getValueString().c_str(), count)); - return nullptr; + return NULL; } if (count > getCount()) { WARNING_STRICT_FATAL(true, ("FactoryObject::makeCopy %s given count %d " "that is > than our count %d", getNetworkId().getValueString().c_str(), count, getCount())); - return nullptr; + return NULL; } VolumeContainer *destVolumeContainer = ContainerInterface::getVolumeContainer(destination); - if (destVolumeContainer == nullptr) + if (destVolumeContainer == NULL) { WARNING_STRICT_FATAL(true, ("FactoryObject::makeCopy %s passed " "destination %s that is not a volume container", getNetworkId().getValueString().c_str(), destination.getNetworkId().getValueString().c_str())); - return nullptr; + return NULL; } // create the new factory - if (safe_cast(getObjectTemplate()) == nullptr) + if (safe_cast(getObjectTemplate()) == NULL) { WARNING_STRICT_FATAL(true, ("FactoryObject::makeCopy: %s has no object template!", getNetworkId().getValueString().c_str())); - return nullptr; + return NULL; } FactoryObject * newFactory = safe_cast(ServerWorld::createNewObject( *safe_cast(getObjectTemplate()), destination, false)); - if (newFactory == nullptr) + if (newFactory == NULL) { WARNING_STRICT_FATAL(true, ("FactoryObject::makeCopy %s could not create " "the new factory", getNetworkId().getValueString().c_str())); - return nullptr; + return NULL; } // copy our objvars and scripts to the new factory @@ -1523,11 +1523,11 @@ FactoryObject * FactoryObject::makeCopy(ServerObject & destination, int count, // move our contained object to the new factory, and delete ourself if // we aren't already being deleted const TangibleObject * object = FactoryObject::getContainedObject(); - if (object != nullptr) + if (object != NULL) { Container::ContainerErrorCode error; ContainerInterface::transferItemToVolumeContainer(*newFactory, - *const_cast(object), nullptr, error); + *const_cast(object), NULL, error); newFactory->setCount(count); setCount(0); if (destroySource && !isBeingDestroyed()) @@ -1545,7 +1545,7 @@ FactoryObject * FactoryObject::makeCopy(ServerObject & destination, int count, else { newFactory->permanentlyDestroy(DeleteReasons::SetupFailed); - newFactory = nullptr; + newFactory = NULL; } } return newFactory; @@ -1575,7 +1575,7 @@ void FactoryObject::getAttributes(AttributeVector & data) const { // new-style crate const ServerObject * const storedObject = getContainedObject(); - if (storedObject != nullptr) + if (storedObject != NULL) { data.reserve (data.size () + 2); diff --git a/engine/server/library/serverGame/src/shared/object/GroupIdObserver.cpp b/engine/server/library/serverGame/src/shared/object/GroupIdObserver.cpp index 60b827ca..50373712 100755 --- a/engine/server/library/serverGame/src/shared/object/GroupIdObserver.cpp +++ b/engine/server/library/serverGame/src/shared/object/GroupIdObserver.cpp @@ -31,11 +31,11 @@ GroupIdObserver::~GroupIdObserver() if (m_group && m_creature->getGroup() != m_group) m_group->removeGroupMember(m_creature->getNetworkId()); - if (m_creature->getGroup() != nullptr) + if (m_creature->getGroup() != NULL) { PlayerObject *playerObject = PlayerCreatureController::getPlayerObject(m_creature); - if ((playerObject != nullptr) && + if ((playerObject != NULL) && playerObject->isLookingForGroup()) { playerObject->setLookingForGroup(false); diff --git a/engine/server/library/serverGame/src/shared/object/GroupObject.cpp b/engine/server/library/serverGame/src/shared/object/GroupObject.cpp index 4c8d69e4..76390349 100755 --- a/engine/server/library/serverGame/src/shared/object/GroupObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/GroupObject.cpp @@ -1412,7 +1412,7 @@ unsigned int GroupObject::getSecondsLeftOnGroupPickup() const std::pair const & groupPickupTimer = m_groupPickupTimer.get(); if ((groupPickupTimer.first > 0) && (groupPickupTimer.second > 0)) { - time_t const timeNow = ::time(nullptr); + time_t const timeNow = ::time(NULL); if (groupPickupTimer.second > timeNow) return (groupPickupTimer.second - (int)timeNow); } diff --git a/engine/server/library/serverGame/src/shared/object/GuildObject.cpp b/engine/server/library/serverGame/src/shared/object/GuildObject.cpp index 0ee903a1..f0215358 100755 --- a/engine/server/library/serverGame/src/shared/object/GuildObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/GuildObject.cpp @@ -140,9 +140,9 @@ void GuildObject::setupUniverse() // build the guild and guild member info from data read in from DB // disable notification while building the initial list - m_membersInfo.setOnErase(nullptr, nullptr); - m_membersInfo.setOnInsert(nullptr, nullptr); - m_membersInfo.setOnSet(nullptr, nullptr); + m_membersInfo.setOnErase(NULL, NULL); + m_membersInfo.setOnInsert(NULL, NULL); + m_membersInfo.setOnSet(NULL, NULL); // build names { @@ -238,7 +238,7 @@ void GuildObject::setupUniverse() // update guild info members count GuildInfo & gi = guildInfoMembersCount[guildId]; GuildMemberInfo const * const existingGmi = getGuildMemberInfo(guildId, memberId); - updateGuildInfoMembersCount(gi, (existingGmi ? ((existingGmi->m_permissions == -1) ? &allAdministrativePermissions : &(existingGmi->m_permissions)) : nullptr), ((permissions == -1) ? &allAdministrativePermissions : &permissions)); + updateGuildInfoMembersCount(gi, (existingGmi ? ((existingGmi->m_permissions == -1) ? &allAdministrativePermissions : &(existingGmi->m_permissions)) : NULL), ((permissions == -1) ? &allAdministrativePermissions : &permissions)); if (existingGmi) { @@ -391,7 +391,7 @@ GuildInfo const * GuildObject::getGuildInfo(int guildId) const if (iterFind != m_guildsInfo.end()) return &(iterFind->second); - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -402,7 +402,7 @@ GuildMemberInfo const * GuildObject::getGuildMemberInfo(int guildId, NetworkId c if (iterFind != m_membersInfo.end()) return &(iterFind->second); - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -738,7 +738,7 @@ void GuildObject::removeGuildMember(int guildId, NetworkId const &memberId) m_members.erase(memberSpec); GuildInfo updatedGi(gi); - updateGuildInfoMembersCount(updatedGi, &(gmi->m_permissions), nullptr); + updateGuildInfoMembersCount(updatedGi, &(gmi->m_permissions), NULL); m_guildsInfo.set(guildId, updatedGi); std::map::const_iterator iterFind = m_fullMembers.find(memberId); @@ -771,7 +771,7 @@ void GuildObject::addGuildCreatorMember(int guildId, NetworkId const &memberId, if (realMemberName.empty() && existingGmi) realMemberName = existingGmi->m_name; - ServerObject const *so = nullptr; + ServerObject const *so = NULL; if (realMemberName.empty()) { so = ServerWorld::findObjectByNetworkId(memberId); @@ -848,7 +848,7 @@ void GuildObject::addGuildCreatorMember(int guildId, NetworkId const &memberId, m_members.insert(memberSpec); GuildInfo updatedGi(gi); - updateGuildInfoMembersCount(updatedGi, (existingGmi ? &(existingGmi->m_permissions) : nullptr), &permissions); + updateGuildInfoMembersCount(updatedGi, (existingGmi ? &(existingGmi->m_permissions) : NULL), &permissions); m_guildsInfo.set(guildId, updatedGi); if (existingGmi) @@ -883,7 +883,7 @@ void GuildObject::addGuildSponsorMember(int guildId, NetworkId const &memberId, if (realMemberName.empty() && existingGmi) realMemberName = existingGmi->m_name; - ServerObject const *so = nullptr; + ServerObject const *so = NULL; if (realMemberName.empty()) { so = ServerWorld::findObjectByNetworkId(memberId); @@ -958,7 +958,7 @@ void GuildObject::addGuildSponsorMember(int guildId, NetworkId const &memberId, m_members.insert(memberSpec); GuildInfo updatedGi(gi); - updateGuildInfoMembersCount(updatedGi, (existingGmi ? &(existingGmi->m_permissions) : nullptr), &permissions); + updateGuildInfoMembersCount(updatedGi, (existingGmi ? &(existingGmi->m_permissions) : NULL), &permissions); m_guildsInfo.set(guildId, updatedGi); if (existingGmi) @@ -1465,7 +1465,7 @@ void GuildObject::modifyGuildWarKillTracking(int killerGuildId, int victimGuildI } if (updateTime <= 0) - updateTime = static_cast(::time(nullptr)); + updateTime = static_cast(::time(NULL)); // queue up adjustments and periodically update the data std::pair, std::pair >::iterator, bool> result = m_guildWarKillTrackingAdjustment.insert(std::make_pair(std::make_pair(killerGuildId, victimGuildId), std::make_pair(adjustment, updateTime))); @@ -1635,7 +1635,7 @@ void GuildObject::setGuildFaction(int guildId, uint32 guildFaction) if (factionChange) { - int const timeLeftGuildFaction = static_cast(::time(nullptr)); + int const timeLeftGuildFaction = static_cast(::time(NULL)); std::string oldNameSpec, newNameSpec; GuildStringParser::buildNameSpec(guildId, gi->m_name, gi->m_guildElectionPreviousEndTime, gi->m_guildElectionNextEndTime, gi->m_guildFaction, gi->m_timeLeftGuildFaction, gi->m_guildGcwDefenderRegion, gi->m_timeJoinedGuildGcwDefenderRegion, gi->m_timeLeftGuildGcwDefenderRegion, oldNameSpec); @@ -1723,7 +1723,7 @@ void GuildObject::setGuildGcwDefenderRegion(int guildId, std::string const &guil if ((gi->m_guildGcwDefenderRegion == guildGcwDefenderRegion) && (gi->m_timeJoinedGuildGcwDefenderRegion > 0)) timeJoinedGuildGcwDefenderRegion = gi->m_timeJoinedGuildGcwDefenderRegion; else - timeJoinedGuildGcwDefenderRegion = static_cast(::time(nullptr)); + timeJoinedGuildGcwDefenderRegion = static_cast(::time(NULL)); } } else if (gi->m_guildGcwDefenderRegion != guildGcwDefenderRegion) @@ -1732,13 +1732,13 @@ void GuildObject::setGuildGcwDefenderRegion(int guildId, std::string const &guil if (!guildGcwDefenderRegion.empty()) { - timeJoinedGuildGcwDefenderRegion = static_cast(::time(nullptr)); + timeJoinedGuildGcwDefenderRegion = static_cast(::time(NULL)); } else { // stop defending timeJoinedGuildGcwDefenderRegion = gi->m_timeJoinedGuildGcwDefenderRegion; - timeLeftGuildGcwDefenderRegion = static_cast(::time(nullptr)); + timeLeftGuildGcwDefenderRegion = static_cast(::time(NULL)); } } @@ -2052,7 +2052,7 @@ void GuildObject::depersistGcwImperialScorePercentile() // GCW category { - int const timeNow = static_cast(::time(nullptr)); + int const timeNow = static_cast(::time(NULL)); int gcwImperialScorePercentile; std::map const & allGcwScoreCategory = Pvp::getAllGcwScoreCategory(); for (std::map::const_iterator iter = allGcwScoreCategory.begin(); iter != allGcwScoreCategory.end(); ++iter) @@ -2154,7 +2154,7 @@ void GuildObject::updateGcwImperialScorePercentile(std::set const & if (m_gcwImperialScorePercentileThisGalaxy.empty()) depersistGcwImperialScorePercentile(); - int const timeNow = static_cast(::time(nullptr)); + int const timeNow = static_cast(::time(NULL)); GameScriptObject * const gameScriptObject = tatooine->getScriptObject(); int currentScorePercentile, newScorePercentile, newGroupCategoryScoreRaw, scoreCategoryGroupTotalPoints, deltaGroupCategoryScoreRaw; std::map, int>::const_iterator iterGroupCategoryScoreRaw; @@ -2515,8 +2515,8 @@ void GuildObjectNamespace::replaceSetIfNeeded(char const *label, Archive::AutoDe } // ---------------------------------------------------------------------- -// nullptr oldPermissions means wasn't an existing guild member -// nullptr newPermissions means will not be a guild member +// NULL oldPermissions means wasn't an existing guild member +// NULL newPermissions means will not be a guild member void GuildObjectNamespace::updateGuildInfoMembersCount(GuildInfo & gi, int const * const oldPermissions, int const * const newPermissions) { bool existingMember = false; @@ -2596,7 +2596,7 @@ void GuildObjectNamespace::updateGcwPercentileHistory(Archive::AutoDeltaMap(::time(nullptr))), score); + history.set(std::make_pair(scoreName, static_cast(::time(NULL))), score); int newCount = 1; Archive::AutoDeltaMap::const_iterator const iterHistoryCount = historyCount.find(scoreName); diff --git a/engine/server/library/serverGame/src/shared/object/HarvesterInstallationObject.cpp b/engine/server/library/serverGame/src/shared/object/HarvesterInstallationObject.cpp index 92f77f36..c8c7ad75 100755 --- a/engine/server/library/serverGame/src/shared/object/HarvesterInstallationObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/HarvesterInstallationObject.cpp @@ -67,7 +67,7 @@ HarvesterInstallationObject::HarvesterInstallationObject(const ServerHarvesterIn m_maxHopperAmount(newTemplate->getMaxHopperSize()), m_hopperResource(NetworkId::cms_invalid), m_hopperAmount(0.0f), - m_survey(nullptr), + m_survey(NULL), m_surveyTime(0) { //Installation objects have real time updated UI @@ -79,7 +79,7 @@ HarvesterInstallationObject::HarvesterInstallationObject(const ServerHarvesterIn HarvesterInstallationObject::~HarvesterInstallationObject() { delete m_survey; - m_survey = nullptr; + m_survey = NULL; // m_synchronizedUi deleted by superclass } @@ -397,7 +397,7 @@ std::vector const & HarvesterInstallationObject::get if (!m_survey || ServerClock::getInstance().getGameTimeSeconds() - m_surveyTime > (60*60)) { delete m_survey; - m_survey = nullptr; + m_survey = NULL; takeSurvey(); } @@ -728,7 +728,7 @@ void HarvesterInstallationObject::handleCMessageTo (const MessageToPayload &mess ResourceClassObject *HarvesterInstallationObject::getMasterClass() const { - ResourceClassObject *obj = nullptr; + ResourceClassObject *obj = NULL; const ServerHarvesterInstallationObjectTemplate *harvesterTemplate = dynamic_cast(getObjectTemplate()); if (harvesterTemplate) obj=ServerUniverse::getInstance().getResourceClassByName(harvesterTemplate->getMasterClassName()); @@ -855,7 +855,7 @@ NetworkId const &HarvesterInstallationObject::getSelectedResourceTypeId() const ResourcePoolObject const * HarvesterInstallationObject::getSelectedResourcePool() const { if (getSelectedResourceTypeId() == NetworkId::cms_invalid) - return nullptr; + return NULL; ResourceTypeObject const * const typeObject = ServerUniverse::getInstance().getResourceTypeById(getSelectedResourceTypeId()); if (typeObject) @@ -863,7 +863,7 @@ ResourcePoolObject const * HarvesterInstallationObject::getSelectedResourcePool( return typeObject->getPoolForCurrentPlanet(); } else - return nullptr; + return NULL; } // ====================================================================== diff --git a/engine/server/library/serverGame/src/shared/object/HarvesterInstallationObject.h b/engine/server/library/serverGame/src/shared/object/HarvesterInstallationObject.h index 1ea65df3..7616aba5 100755 --- a/engine/server/library/serverGame/src/shared/object/HarvesterInstallationObject.h +++ b/engine/server/library/serverGame/src/shared/object/HarvesterInstallationObject.h @@ -52,7 +52,7 @@ public: typedef std::pair HopperContentElement; typedef stdvector::fwd HopperContentsVector; - float getHopperContents(HopperContentsVector * data=nullptr) const; + float getHopperContents(HopperContentsVector * data=NULL) const; void getResourceData(ResourceDataVector & data); std::vector const & getSurveyTypes(); int getMaxExtractionRate() const; diff --git a/engine/server/library/serverGame/src/shared/object/InstallationObject.cpp b/engine/server/library/serverGame/src/shared/object/InstallationObject.cpp index 97ddeef9..2f5b622b 100755 --- a/engine/server/library/serverGame/src/shared/object/InstallationObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/InstallationObject.cpp @@ -45,7 +45,7 @@ static const std::string OBJVAR_ACCUMULATED_TIME("_installation.acclTime"); -const SharedObjectTemplate * InstallationObject::m_defaultSharedTemplate = nullptr; +const SharedObjectTemplate * InstallationObject::m_defaultSharedTemplate = NULL; namespace InstallationObjectNamespace { @@ -93,13 +93,13 @@ const SharedObjectTemplate * InstallationObject::getDefaultSharedTemplate(void) { static const ConstCharCrcLowerString templateName("object/installation/base/shared_installation_default.iff"); - if (m_defaultSharedTemplate == nullptr) + if (m_defaultSharedTemplate == NULL) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create " + WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create " "default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != nullptr) + if (m_defaultSharedTemplate != NULL) ExitChain::add (removeDefaultTemplate, "InstallationObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -112,10 +112,10 @@ static const ConstCharCrcLowerString templateName("object/installation/base/shar */ void InstallationObject::removeDefaultTemplate(void) { - if (m_defaultSharedTemplate != nullptr) + if (m_defaultSharedTemplate != NULL) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = nullptr; + m_defaultSharedTemplate = NULL; } } // InstallationObject::removeDefaultTemplate diff --git a/engine/server/library/serverGame/src/shared/object/IntangibleObject.cpp b/engine/server/library/serverGame/src/shared/object/IntangibleObject.cpp index 5d32403f..6d7b57c4 100755 --- a/engine/server/library/serverGame/src/shared/object/IntangibleObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/IntangibleObject.cpp @@ -43,7 +43,7 @@ // ====================================================================== -const SharedObjectTemplate * IntangibleObject::m_defaultSharedTemplate = nullptr; +const SharedObjectTemplate * IntangibleObject::m_defaultSharedTemplate = NULL; uint32 IntangibleObject::ms_lastFrame = 0; uint32 IntangibleObject::ms_theaterTime = 0; @@ -82,7 +82,7 @@ IntangibleObject::IntangibleObject(const ServerIntangibleObjectTemplate* newTemp #endif { - WARNING_STRICT_FATAL(!getSharedTemplate(), ("Shared template for %s is nullptr", getTemplateName())); + WARNING_STRICT_FATAL(!getSharedTemplate(), ("Shared template for %s is NULL", getTemplateName())); addMembersToPackages(); ObjectTracker::addIntangible(); } @@ -105,13 +105,13 @@ const SharedObjectTemplate * IntangibleObject::getDefaultSharedTemplate(void) co { static const ConstCharCrcLowerString templateName("object/intangible/base/shared_intangible_default.iff"); - if (m_defaultSharedTemplate == nullptr) + if (m_defaultSharedTemplate == NULL) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create " + WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create " "default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != nullptr) + if (m_defaultSharedTemplate != NULL) ExitChain::add (removeDefaultTemplate, "IntangibleObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -124,10 +124,10 @@ static const ConstCharCrcLowerString templateName("object/intangible/base/shared */ void IntangibleObject::removeDefaultTemplate(void) { - if (m_defaultSharedTemplate != nullptr) + if (m_defaultSharedTemplate != NULL) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = nullptr; + m_defaultSharedTemplate = NULL; } } // IntangibleObject::removeDefaultTemplate @@ -161,7 +161,7 @@ void IntangibleObject::onLoadedFromDatabase() if (flatten != 0) { TerrainGenerator::Layer * layer = TerrainModificationHelper::importLayer(THEATER_FLATTEN_LAYER.c_str()); - if (layer != nullptr) + if (layer != NULL) { setLayer(layer); } @@ -192,7 +192,7 @@ void IntangibleObject::onLoadedFromDatabase() void IntangibleObject::sendObjectSpecificBaselinesToClient(Client const &client) const { ServerObject::sendObjectSpecificBaselinesToClient(client); - if (getLayer() != nullptr) + if (getLayer() != NULL) { client.send(GenericValueTypeMessage >( "IsFlattenedTheaterMessage", std::make_pair(getNetworkId(), true)), true); @@ -235,9 +235,9 @@ size_t i; Transform tr; tr.setPosition_p(myPos+m_positions[i]); ServerObject * newObject = ServerWorld::createNewObject(m_crcs[i], tr, 0, false); - if (newObject != nullptr) + if (newObject != NULL) { - if (newObject->asTangibleObject() != nullptr) + if (newObject->asTangibleObject() != NULL) newObject->asTangibleObject()->setVisible(false); newObject->addToWorld(); m_objects.push_back(CachedNetworkId(*newObject)); @@ -300,7 +300,7 @@ size_t i; for (i = 0; i < count; ++i) { ServerObject * object = safe_cast(m_objects[i].getObject()); - if (object != nullptr && object->asTangibleObject() != nullptr) + if (object != NULL && object->asTangibleObject() != NULL) { const ServerObjectTemplate * objTemplate = safe_cast(object->getObjectTemplate()); for (size_t j = 0; j < objTemplate->getVisibleFlagsCount(); ++j) @@ -360,7 +360,7 @@ bool IntangibleObject::isVisibleOnClient (const Client & client) const { if (isTheater()) { - return getLayer() != nullptr; + return getLayer() != NULL; } return true; } @@ -388,7 +388,7 @@ void IntangibleObject::onPermanentlyDestroyed() for (size_t i = 0; i < count; ++i) { ServerObject * object = safe_cast(m_objects[i].getObject()); - if (object != nullptr) + if (object != NULL) object->permanentlyDestroy(DeleteReasons::Consumed); } if (!m_theaterName.get().empty()) @@ -439,7 +439,7 @@ bool IntangibleObject::persist() splitCount = 0; } ServerObject * o = safe_cast((*i).getObject()); - if (o != nullptr) + if (o != NULL) { o->persist(); splitObjects.back().push_back(*i); @@ -452,7 +452,7 @@ bool IntangibleObject::persist() if (m_player.get() != CachedNetworkId::cms_cachedInvalid) setObjVarItem(OBJVAR_THEATER_PLAYER, m_player.get()); setObjVarItem(OBJVAR_THEATER_NAME, m_theaterName.get()); - if (getLayer() != nullptr) + if (getLayer() != NULL) setObjVarItem(OBJVAR_THEATER_FLATTEN, 1); char buffer[32]; @@ -551,7 +551,7 @@ int IntangibleObject::getObjectsCreatedPerFrame() int IntangibleObject::getNumObjects(const std::string & datatable) { DataTable * dt = DataTableManager::getTable(datatable, true); - if (dt == nullptr) + if (dt == NULL) { WARNING(true, ("IntangibleObject::getNumObjects could not open " "datatable %s", datatable.c_str())); @@ -586,7 +586,7 @@ int IntangibleObject::getNumObjects(const std::string & datatable) float IntangibleObject::getRadius(const std::string & datatable) { DataTable * dt = DataTableManager::getTable(datatable, true); - if (dt == nullptr) + if (dt == NULL) { WARNING(true, ("IntangibleObject::getRadius could not open " "datatable %s", datatable.c_str())); @@ -648,18 +648,18 @@ IntangibleObject * IntangibleObject::spawnTheater(const std::string & datatable, const Vector & position, const std::string & script, TheaterLocationType locationType) { DataTable * dt = DataTableManager::getTable(datatable, true); - if (dt == nullptr) + if (dt == NULL) { WARNING(true, ("IntangibleObject::spawnTheater could not open " "datatable %s", datatable.c_str())); - return nullptr; + return NULL; } int rows = dt->getNumRows(); if (rows <= 0) { WARNING(true, ("IntangibleObject::spawnTheater datatable %s has no " "rows", datatable.c_str())); - return nullptr; + return NULL; } int templateColumn = dt->findColumnNumber("template"); @@ -684,7 +684,7 @@ IntangibleObject * IntangibleObject::spawnTheater(const std::string & datatable, { WARNING(true, ("IntangibleObject::spawnTheater datatable %s has no " "objects", datatable.c_str())); - return nullptr; + return NULL; } skipFirstRow = true; objectCrcs.erase(objectCrcs.begin()); @@ -737,11 +737,11 @@ IntangibleObject * IntangibleObject::spawnTheater(const std::string & datatable, float centerX = minx + dx / 2.0f + position.x; float centerZ = minz + dz / 2.0f + position.z; - TerrainGenerator::Layer * layer = nullptr; + TerrainGenerator::Layer * layer = NULL; if (locationType == TLT_flatten) { layer = TerrainModificationHelper::importLayer(THEATER_FLATTEN_LAYER.c_str()); - if (layer == nullptr) + if (layer == NULL) { WARNING (true, ("Layer %s not found for theater %s, using getGoodLocation " "instead", THEATER_FLATTEN_LAYER.c_str(), datatable.c_str())); @@ -770,7 +770,7 @@ IntangibleObject * IntangibleObject::spawnTheater(const std::string & datatable, iter != regions.end(); ++iter) { const Region * region = *iter; - if (region != nullptr) + if (region != NULL) { if (region->getPvp() == RegionNamespace::RP_pvpBattlefield || region->getPvp() == RegionNamespace::RP_pveBattlefield || @@ -796,7 +796,7 @@ IntangibleObject * IntangibleObject::spawnTheater(const std::string & datatable, IntangibleObject * theater = safe_cast(ServerWorld::createNewObject(THEATER_TEMPLATE, tr, 0, false)); NOT_NULL(theater); - if (layer != nullptr) + if (layer != NULL) { theater->setLayer(layer); } diff --git a/engine/server/library/serverGame/src/shared/object/LineOfSightCache.cpp b/engine/server/library/serverGame/src/shared/object/LineOfSightCache.cpp index 3d3c72ff..a7de4055 100755 --- a/engine/server/library/serverGame/src/shared/object/LineOfSightCache.cpp +++ b/engine/server/library/serverGame/src/shared/object/LineOfSightCache.cpp @@ -308,14 +308,14 @@ bool LineOfSightCache::checkLOS(Object const &a, Location const &b) Clock::getFrameStartTimeMs() + ConfigServerGame::getLineOfSightCacheDurationMs())); CellProperty const * const sourceCell = source->getParentCell(); - CellProperty const * targetCell = nullptr; + CellProperty const * targetCell = NULL; if (b.getCell() != NetworkId::cms_invalid) { Object const * cellObject = NetworkIdManager::getObjectById(b.getCell()); - if (cellObject != nullptr) + if (cellObject != NULL) targetCell = ContainerInterface::getCell(*cellObject); } - if (targetCell == nullptr) + if (targetCell == NULL) targetCell = CellProperty::getWorldCellProperty(); // if source and target are in the same cell in a player structure, skip LOS check; @@ -418,7 +418,7 @@ bool LineOfSightCache::checkLOS(Object const &a, Location const &b) qirResult = CollisionWorld::queryInteraction( targetCell, b.getCoordinates(), sourceCell, sourceTop, - nullptr, + NULL, (!ConfigSharedCollision::getIgnoreTerrainLos() && !ConfigSharedCollision::getGenerateTerrainLos()), false, ConfigSharedCollision::getTerrainLOSMinDistance(), diff --git a/engine/server/library/serverGame/src/shared/object/ManufactureInstallationObject.cpp b/engine/server/library/serverGame/src/shared/object/ManufactureInstallationObject.cpp index 50fec4c8..c199bd84 100755 --- a/engine/server/library/serverGame/src/shared/object/ManufactureInstallationObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/ManufactureInstallationObject.cpp @@ -99,11 +99,11 @@ namespace ManufactureInstallationObjectNamespace bool isOutputHopperFull(ManufactureInstallationObject const & mio) { ServerObject const * const outputHopper = mio.getOutputHopper(); - if (outputHopper == nullptr) + if (outputHopper == NULL) return false; VolumeContainer const * const hopperContainer = ContainerInterface::getVolumeContainer(*outputHopper); - if (hopperContainer == nullptr) + if (hopperContainer == NULL) return false; return (hopperContainer->getCurrentVolume() >= hopperContainer->getTotalVolume()); @@ -170,7 +170,7 @@ void ManufactureInstallationObject::endBaselines() // if we are active, make sure we have the right data if (isAuthoritative() && isActive()) { - if (getSchematic() == nullptr) + if (getSchematic() == NULL) { WARNING(true, ("Manufacture installation %s is set to active but has not schematic available!", getNetworkId().getValueString().c_str())); @@ -302,17 +302,17 @@ void ManufactureInstallationObject::setOwnerId(const NetworkId &id) InstallationObject::setOwnerId(id); const Object * const object = NetworkIdManager::getObjectById(id); - if (object != nullptr) + if (object != NULL) { const ServerObject * const owner = safe_cast(object); setObjVarItem(OBJVAR_OWNER_NAME, Unicode::wideToNarrow(owner->getObjectName())); // we need to store the owner's Station id for logging purposes const CreatureObject * const creatureOwner = owner->asCreatureObject(); - if (creatureOwner != nullptr) + if (creatureOwner != NULL) { const PlayerObject * const player = PlayerCreatureController::getPlayerObject(creatureOwner); - if (player != nullptr) + if (player != NULL) { setObjVarItem(OBJVAR_OWNER_STATION_ID, static_cast(player->getStationId())); } @@ -331,10 +331,10 @@ ServerObject * ManufactureInstallationObject::getInputHopper() const { SlottedContainer const * const container = ContainerInterface::getSlottedContainer(*this); - if (container == nullptr) + if (container == NULL) { DEBUG_WARNING(true, ("Manufacture installation %s does not have a container!", getDebugInformation().c_str())); - return nullptr; + return NULL; } Container::ContainerErrorCode tmp = Container::CEC_Success; @@ -342,7 +342,7 @@ ServerObject * ManufactureInstallationObject::getInputHopper() const if (hopperId == NetworkId::cms_invalid) { DEBUG_WARNING(true, ("Manufacture installation %s does not have an input hopper!", getDebugInformation().c_str())); - return nullptr; + return NULL; } return safe_cast(hopperId.getObject()); @@ -359,10 +359,10 @@ ServerObject * ManufactureInstallationObject::getOutputHopper() const { SlottedContainer const * const container = ContainerInterface::getSlottedContainer(*this); - if (container == nullptr) + if (container == NULL) { DEBUG_WARNING(true, ("Manufacture installation %s does not have a container!", getDebugInformation().c_str())); - return nullptr; + return NULL; } Container::ContainerErrorCode tmp = Container::CEC_Success; @@ -370,7 +370,7 @@ ServerObject * ManufactureInstallationObject::getOutputHopper() const if (hopperId == NetworkId::cms_invalid) { DEBUG_WARNING(true, ("Manufacture installation %s does not have an output hopper!", getDebugInformation().c_str())); - return nullptr; + return NULL; } return safe_cast(hopperId.getObject()); @@ -399,7 +399,7 @@ bool ManufactureInstallationObject::addSchematic(ManufactureSchematicObject & sc SlottedContainer const * const container = ContainerInterface::getSlottedContainer(*this); - if (container == nullptr) + if (container == NULL) { DEBUG_WARNING(true, ("Manufacture installation %s does not have a container!", getDebugInformation().c_str())); return false; @@ -433,7 +433,7 @@ bool ManufactureInstallationObject::onContainerAboutToLoseItem(ServerObject * de { bool isSchematic = false; const ManufactureSchematicObject * const schematic = getSchematic(); - if (schematic != nullptr && schematic->getNetworkId() == item.getNetworkId()) + if (schematic != NULL && schematic->getNetworkId() == item.getNetworkId()) { isSchematic = true; if (isActive()) @@ -465,10 +465,10 @@ ManufactureSchematicObject * ManufactureInstallationObject::getSchematic() const // get our manufacturing schematic SlottedContainer const * const container = ContainerInterface::getSlottedContainer(*this); - if (container == nullptr) + if (container == NULL) { DEBUG_WARNING(true, ("Manufacture installation %s does not have a container!", getDebugInformation().c_str())); - return nullptr; + return NULL; } Container::ContainerErrorCode tmp = Container::CEC_Success; @@ -486,7 +486,7 @@ ManufactureSchematicObject * ManufactureInstallationObject::getSchematic() const float ManufactureInstallationObject::getTimePerObject() const { ManufactureSchematicObject * const schematic = getSchematic(); - if (schematic == nullptr) + if (schematic == NULL) return 0; #ifdef _DEBUG @@ -516,7 +516,7 @@ float ManufactureInstallationObject::getTimePerObject() const getObjVars().getItem(OBJVAR_OWNER_SKILL,ownerSkill); int skill = 0; - if (owner != nullptr) + if (owner != NULL) { skill = owner->getEnhancedModValue(FACTORY_SKILL_MOD); @@ -551,7 +551,7 @@ void ManufactureInstallationObject::activate(const NetworkId &actorId) { if (isAuthoritative() && !isActive()) { - if (getSchematic() == nullptr) + if (getSchematic() == NULL) { WARNING(true, ("Manufacture installation %s tried to activate with " "no schematic available!", getNetworkId().getValueString().c_str())); @@ -588,7 +588,7 @@ void ManufactureInstallationObject::activate(const NetworkId &actorId) OutOfBandPackager::pack(pp, -1, oob); } const Object * const owner = NetworkIdManager::getObjectById(getOwnerId()); - if (owner != nullptr) + if (owner != NULL) { Chat::sendSystemMessage(getOwnerName(), Unicode::emptyString, oob); } @@ -615,7 +615,7 @@ void ManufactureInstallationObject::deactivate() OutOfBandPackager::pack(pp, -1, oob); } const Object * const owner = NetworkIdManager::getObjectById(getOwnerId()); - if (owner != nullptr) + if (owner != NULL) { Chat::sendSystemMessage(getOwnerName(), Unicode::emptyString, oob); } @@ -645,13 +645,13 @@ void ManufactureInstallationObject::harvest() maxItemCount = schematic->getCount(); } - if (schematic == nullptr || maxItemCount <= 0) + if (schematic == NULL || maxItemCount <= 0) { setTickCount(0); // to avoid recursion deactivate(); - if (schematic == nullptr) + if (schematic == NULL) { - WARNING(true, ("ManufactureInstallationObject::harvest called on object %s with a nullptr schematic", + WARNING(true, ("ManufactureInstallationObject::harvest called on object %s with a NULL schematic", getNetworkId().getValueString().c_str())); Chat::sendPersistentMessage(*this, getOwnerName(), StringIds::manf_error, StringIds::manf_error_1, Unicode::emptyString); @@ -694,7 +694,7 @@ void ManufactureInstallationObject::harvest() OutOfBandPackager::pack(pp, -1, oob); } const Object * owner = NetworkIdManager::getObjectById(getOwnerId()); - if (owner != nullptr) + if (owner != NULL) { Chat::sendSystemMessage(getOwnerName(), Unicode::emptyString, oob); } @@ -748,7 +748,7 @@ bool ManufactureInstallationObject::createObject(bool testOnly) int i; ManufactureSchematicObject * schematic = getSchematic(); - if (schematic == nullptr) + if (schematic == NULL) { WARNING(true, ("ManufactureInstallationObject::createObject can't find schematic for station %s", getNetworkId().getValueString().c_str())); @@ -771,7 +771,7 @@ bool ManufactureInstallationObject::createObject(bool testOnly) } ServerObject * inputHopper = getInputHopper(); - if (inputHopper == nullptr) + if (inputHopper == NULL) { WARNING_STRICT_FATAL(true, ("ManufactureInstallationObject::createObject can't find input hopper for station %s", getNetworkId().getValueString().c_str())); @@ -782,7 +782,7 @@ bool ManufactureInstallationObject::createObject(bool testOnly) } ServerObject * outputHopper = getOutputHopper(); - if (outputHopper == nullptr) + if (outputHopper == NULL) { WARNING_STRICT_FATAL(true, ("ManufactureInstallationObject::createObject can't find output hopper for station %s", getNetworkId().getValueString().c_str())); @@ -803,7 +803,7 @@ bool ManufactureInstallationObject::createObject(bool testOnly) { // is there a current crate in the output hopper put we can stuff objects into FactoryObject * crate = getCurrentCrate(*schematic); - if (crate == nullptr) + if (crate == NULL) { // is there room in the output hopper for a new crate outputHopperFull = isOutputHopperFull(*this); @@ -819,7 +819,7 @@ bool ManufactureInstallationObject::createObject(bool testOnly) OutOfBandPackager::pack(pp, -1, oob); } const Object * const owner = NetworkIdManager::getObjectById(getOwnerId()); - if (owner != nullptr) + if (owner != NULL) { Chat::sendSystemMessage(getOwnerName(), Unicode::emptyString, oob); } @@ -894,7 +894,7 @@ bool ManufactureInstallationObject::createObject(bool testOnly) // the ingredient needs to be made with the same template const ObjectTemplate * componentTemplate = ObjectTemplateList::fetch( componentInfo->templateName); - if (componentTemplate != nullptr) + if (componentTemplate != NULL) { for (j = 0; j < ingredientCount; ++j) { @@ -945,7 +945,7 @@ bool ManufactureInstallationObject::createObject(bool testOnly) ProsePackage pp; ProsePackageManagerServer::createSimpleProsePackageParticipant (*this, pp.target); - if (resource != nullptr) + if (resource != NULL) { pp.stringId = StringIds::manf_no_named_resource; pp.other.str = Unicode::narrowToWide(resource->getResourceName()); @@ -957,7 +957,7 @@ bool ManufactureInstallationObject::createObject(bool testOnly) } const Object * const owner = NetworkIdManager::getObjectById(getOwnerId()); - if (owner != nullptr) + if (owner != NULL) Chat::sendSystemMessage(getOwnerName(), Unicode::emptyString, oob); Chat::sendPersistentMessage(*this, getOwnerName(), StringIds::no_ingredients, Unicode::emptyString, oob); @@ -1000,7 +1000,7 @@ bool ManufactureInstallationObject::createObject(bool testOnly) { TangibleObject * object = safe_cast(schematic-> manufactureObject(getOwnerId(), *this, newObjectSlotId, false)); - if (object == nullptr) + if (object == NULL) { WARNING_STRICT_FATAL(true, ("ManufactureInstallationObject::createObject, Unable to create object for station %s", getNetworkId().getValueString().c_str())); @@ -1009,7 +1009,7 @@ bool ManufactureInstallationObject::createObject(bool testOnly) return false; } - if (!ContainerInterface::transferItemToVolumeContainer(*outputHopper, *object, nullptr, tmp)) + if (!ContainerInterface::transferItemToVolumeContainer(*outputHopper, *object, NULL, tmp)) { object->permanentlyDestroy(DeleteReasons::BadContainerTransfer); WARNING_STRICT_FATAL(true, ("ManufactureInstallationObject::createObject, Unable to transfer new object for station %s, error code = %d", @@ -1024,12 +1024,12 @@ bool ManufactureInstallationObject::createObject(bool testOnly) { // put the object in a box of objects FactoryObject * crate = getCurrentCrate(*schematic); - if (crate == nullptr) + if (crate == NULL) { // make a new crate to put the object in crate = makeNewCrate(*schematic); } - if (crate == nullptr) + if (crate == NULL) { WARNING_STRICT_FATAL(true, ("ManufactureInstallationObject::createObject, Unable to create factory crate for station %s", getNetworkId().getValueString().c_str())); @@ -1082,7 +1082,7 @@ void ManufactureInstallationObject::restoreIngredients(IngredientVector const &i if (count != 0) { FactoryObject * crate = dynamic_cast(itemId.getObject()); - if (crate != nullptr) + if (crate != NULL) crate->incrementCount(count); } } @@ -1109,7 +1109,7 @@ void ManufactureInstallationObject::destroyIngredients(IngredientVector const &i else { FactoryObject * crate = dynamic_cast(itemId.getObject()); - if (crate != nullptr) + if (crate != NULL) { LOG("CustomerService", ("Crafting:destroying %d ingredients from crate %s in manf station %s owned by %s", count, itemId.getValueString().c_str(), getNetworkId().getValueString().c_str(), PlayerObject::getAccountDescription(getOwnerId()).c_str())); if (crate->getCount() == 0) @@ -1149,7 +1149,7 @@ bool ManufactureInstallationObject::transferCraftedIngredientToSchematic( // crafted id as the component wanted VolumeContainer * container = ContainerInterface::getVolumeContainer(inputHopper); - if (container == nullptr) + if (container == NULL) return false; // stuff to keep track of crates that don't have enough ingredients @@ -1160,11 +1160,11 @@ bool ManufactureInstallationObject::transferCraftedIngredientToSchematic( { const Container::ContainedItem & itemId = *iter; TangibleObject * object = safe_cast(itemId.getObject()); - if (object != nullptr && object->getCraftedId() == craftedId) + if (object != NULL && object->getCraftedId() == craftedId) { // see if the object is a factory or not FactoryObject * crate = dynamic_cast(object); - if (crate != nullptr) + if (crate != NULL) { // see if the crate has enough objects or not int crateCount = crate->getCount(); @@ -1247,18 +1247,18 @@ const NetworkId & ManufactureInstallationObject::transferTemplateIngredientToSch VolumeContainer * container = ContainerInterface::getVolumeContainer( inputHopper); - if (container == nullptr) + if (container == NULL) return NetworkId::cms_invalid; for (ContainerIterator iter = container->begin(); iter != container->end(); ++iter) { const Container::ContainedItem & itemId = *iter; TangibleObject * object = safe_cast(itemId.getObject()); - if (object != nullptr) + if (object != NULL) { // see if the object is a factory or not FactoryObject * crate = dynamic_cast(object); - if (crate != nullptr && crate->getCount() > 0) + if (crate != NULL && crate->getCount() > 0) { if (crate->getContainedObjectTemplate() == &componentTemplate) { @@ -1300,7 +1300,7 @@ const NetworkId & ManufactureInstallationObject::transferResourceTypeToSchematic const NetworkId & resourceTypeId, int resourceCount) { VolumeContainer * const container = ContainerInterface::getVolumeContainer(inputHopper); - if (container == nullptr) + if (container == NULL) return NetworkId::cms_invalid; // keep a map of the sources that are providing the resources @@ -1317,7 +1317,7 @@ const NetworkId & ManufactureInstallationObject::transferResourceTypeToSchematic const Container::ContainedItem & itemId = *iter; ResourceContainerObject * object = dynamic_cast( itemId.getObject()); - if (object != nullptr && object->getResourceTypeId() == resourceTypeId) + if (object != NULL && object->getResourceTypeId() == resourceTypeId) { // see if this crate fills our requirements if (object->getQuantity() >= resourceCount) @@ -1346,7 +1346,7 @@ const NetworkId & ManufactureInstallationObject::transferResourceTypeToSchematic if (!smallCrate->removeResource(resourceTypeId, smallCrate->getQuantity(), &sources)) return NetworkId::cms_invalid; // small crate has been deleted by the resource system - *crateIter = nullptr; + *crateIter = NULL; ++crateIter; } else @@ -1390,41 +1390,41 @@ const NetworkId & ManufactureInstallationObject::transferResourceTypeToSchematic * * @param contents an object we want to put in the crate * - * @return the crate, or nullptr if we have no crate + * @return the crate, or NULL if we have no crate */ FactoryObject * ManufactureInstallationObject::getCurrentCrate(const ManufactureSchematicObject & source) { - FactoryObject * crate = nullptr; + FactoryObject * crate = NULL; ServerObject * outputHopper = getOutputHopper(); - if (outputHopper == nullptr) - return nullptr; + if (outputHopper == NULL) + return NULL; - if (m_currentCrate.getObject() != nullptr) + if (m_currentCrate.getObject() != NULL) { crate = safe_cast(m_currentCrate.getObject()); // make sure the crate is still in our hopper and is not full - if (crate != nullptr && ContainerInterface::getContainedByObject(*crate) == outputHopper && + if (crate != NULL && ContainerInterface::getContainedByObject(*crate) == outputHopper && crate->getCraftedId() == source.getOriginalId()) { if (crate->getCount() < source.getItemsPerContainer()) return crate; else - return nullptr; + return NULL; } } // see if there is another non-full crate in the output hopper we could use const VolumeContainer * hopperContainer = ContainerInterface::getVolumeContainer( *outputHopper); - if (hopperContainer != nullptr) + if (hopperContainer != NULL) { for (ContainerConstIterator iter = hopperContainer->begin(); iter != hopperContainer->end(); ++iter) { crate = dynamic_cast((*iter).getObject()); - if (crate != nullptr && crate->getCraftedId() == source.getOriginalId() && crate->getCount() < source.getItemsPerContainer()) + if (crate != NULL && crate->getCraftedId() == source.getOriginalId() && crate->getCount() < source.getItemsPerContainer()) { // change our current crate to the one we found m_currentCrate = CachedNetworkId(*crate); @@ -1433,7 +1433,7 @@ FactoryObject * ManufactureInstallationObject::getCurrentCrate(const Manufacture } } - return nullptr; + return NULL; } // ManufactureInstallationObject::getCurrentCrate // ---------------------------------------------------------------------- @@ -1449,21 +1449,21 @@ FactoryObject * ManufactureInstallationObject::getCurrentCrate(const Manufacture FactoryObject * ManufactureInstallationObject::makeNewCrate(const ManufactureSchematicObject & source) { ServerObject * outputHopper = getOutputHopper(); - if (outputHopper == nullptr) - return nullptr; + if (outputHopper == NULL) + return NULL; // get the correct factory object template from the draft schematic const ManufactureSchematicObject * manfSchematic = getSchematic(); - if (manfSchematic == nullptr) - return nullptr; + if (manfSchematic == NULL) + return NULL; const DraftSchematicObject * draftSchematic = DraftSchematicObject::getSchematic( manfSchematic->getDraftSchematic()); - if (draftSchematic == nullptr) - return nullptr; + if (draftSchematic == NULL) + return NULL; - ServerObject * object = nullptr; + ServerObject * object = NULL; const ServerFactoryObjectTemplate * crateTemplate = draftSchematic->getCrateObjectTemplate(); - if (crateTemplate != nullptr) + if (crateTemplate != NULL) { object = ServerWorld::createNewObject(*crateTemplate, *outputHopper, false); } @@ -1472,11 +1472,11 @@ FactoryObject * ManufactureInstallationObject::makeNewCrate(const ManufactureSch object = ServerWorld::createNewObject(DEFAULT_FACTORY_OBJECT_TEMPLATE, *outputHopper, false); } - if (object == nullptr) - return nullptr; + if (object == NULL) + return NULL; FactoryObject * crate = dynamic_cast(object); - if (crate == nullptr) + if (crate == NULL) object->permanentlyDestroy(DeleteReasons::SetupFailed); else { @@ -1526,7 +1526,7 @@ bool ManufactureInstallationObject::TaskManufactureObject::run() { ManufactureInstallationObject * manfInst = safe_cast (m_manfInstallation.getObject()); - if (manfInst == nullptr || !manfInst->isActive()) + if (manfInst == NULL || !manfInst->isActive()) return true; if (!manfInst->createObject()) @@ -1545,7 +1545,7 @@ void ManufactureInstallationObject::getAttributes(AttributeVector & data) const InstallationObject::getAttributes(data); ManufactureSchematicObject * schematic = getSchematic(); - if (schematic != nullptr) + if (schematic != NULL) { char valueBuffer[32]; const size_t valueBuffer_size = sizeof (valueBuffer); diff --git a/engine/server/library/serverGame/src/shared/object/ManufactureSchematicObject.cpp b/engine/server/library/serverGame/src/shared/object/ManufactureSchematicObject.cpp index e4646395..00b51fc1 100755 --- a/engine/server/library/serverGame/src/shared/object/ManufactureSchematicObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/ManufactureSchematicObject.cpp @@ -96,7 +96,7 @@ using namespace ManufactureSchematicObjectNamespace; //---------------------------------------------------------------------- -const SharedObjectTemplate * ManufactureSchematicObject::m_defaultSharedTemplate = nullptr; +const SharedObjectTemplate * ManufactureSchematicObject::m_defaultSharedTemplate = NULL; //======================================================================== @@ -170,11 +170,11 @@ const SharedObjectTemplate * ManufactureSchematicObject::getDefaultSharedTemplat { static const ConstCharCrcLowerString templateName("object/manufacture_schematic/base/shared_manufacture_schematic_default.iff"); - if (m_defaultSharedTemplate == nullptr) + if (m_defaultSharedTemplate == NULL) { m_defaultSharedTemplate = safe_cast(ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != nullptr) + WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create default shared object template %s", templateName.getString())); + if (m_defaultSharedTemplate != NULL) ExitChain::add (removeDefaultTemplate, "ManufactureSchematicObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -187,10 +187,10 @@ const SharedObjectTemplate * ManufactureSchematicObject::getDefaultSharedTemplat */ void ManufactureSchematicObject::removeDefaultTemplate() { - if (m_defaultSharedTemplate != nullptr) + if (m_defaultSharedTemplate != NULL) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = nullptr; + m_defaultSharedTemplate = NULL; } } // ManufactureSchematicObject::removeDefaultTemplate @@ -209,7 +209,7 @@ void ManufactureSchematicObject::init(const DraftSchematicObject & schematic, co m_draftSchematicSharedTemplate = schematic.getSharedTemplate()->getCrcName().getCrc(); m_creatorId = creator; - if (creator.getObject() != nullptr) + if (creator.getObject() != NULL) { m_creatorName = safe_cast(creator.getObject())-> getObjectName(); @@ -481,7 +481,7 @@ ServerIntangibleObjectTemplate::CraftingType ManufactureSchematicObject::getCate { schematicOk = false; } - else if (draft != nullptr) + else if (draft != NULL) { // test the ingredients Crafting::IngredientSlot sourceSlot; @@ -520,11 +520,11 @@ ServerIntangibleObjectTemplate::CraftingType ManufactureSchematicObject::getCate return draft->getCategory(); // this schematic can't be used, inform the player - const CreatureObject * owner = nullptr; + const CreatureObject * owner = NULL; const Object * object = ContainerInterface::getContainedByObject(*this); - while (owner == nullptr && object != nullptr && object->asServerObject() != nullptr) + while (owner == NULL && object != NULL && object->asServerObject() != NULL) { - if (object->asServerObject()->asCreatureObject() != nullptr) + if (object->asServerObject()->asCreatureObject() != NULL) owner = object->asServerObject()->asCreatureObject(); else object = ContainerInterface::getContainedByObject(*object); @@ -534,7 +534,7 @@ ServerIntangibleObjectTemplate::CraftingType ManufactureSchematicObject::getCate LOG("CustomerService", ("Crafting:Manufacturing schematic %s " "owned by %s is unuseable due to %s", getNetworkId().getValueString().c_str(), PlayerObject::getAccountDescription(owner).c_str(), errBuffer)); - if (owner != nullptr) + if (owner != NULL) { // send mail to the owner telling them their schematic can't be used const static StringId message("system_msg", "manf_schematic_unuseable"); @@ -562,7 +562,7 @@ bool ManufactureSchematicObject::mustDestroyIngredients() const const DraftSchematicObject * draft = DraftSchematicObject::getSchematic( m_draftSchematic.get()); NOT_NULL(draft); - if (draft != nullptr) + if (draft != NULL) return draft->mustDestroyIngredients(); return false; } // ManufactureSchematicObject::mustDestroyIngredients @@ -701,12 +701,12 @@ bool ManufactureSchematicObject::getSlot(int index, Crafting::IngredientSlot & d // get the xp type based on the resource container int xpType = 0; const ResourceTypeObject * const resourceType = ServerUniverse::getInstance().getResourceTypeById(ingredientId); - if (resourceType != nullptr) + if (resourceType != NULL) { std::string crateTemplateName; resourceType->getCrateTemplate(crateTemplateName); const ServerObjectTemplate * crateTemplate = safe_cast(ObjectTemplateList::fetch(crateTemplateName)); - if (crateTemplate != nullptr && crateTemplate->getXpPointsCount() > 0) + if (crateTemplate != NULL && crateTemplate->getXpPointsCount() > 0) { ServerObjectTemplate::Xp xpData; crateTemplate->getXpPoints(xpData, 0); @@ -1024,10 +1024,10 @@ void ManufactureSchematicObject::addSlotComponent(const StringId & name, // Check if the object being added is a factory const TangibleObject * componentPtr = &component; const FactoryObject * factory = dynamic_cast(&component); - if (factory != nullptr) + if (factory != NULL) { componentPtr = factory->getContainedObject(); - if (componentPtr == nullptr) + if (componentPtr == NULL) { WARNING(true, ("ManufactureSchematicObject::addSlotComponent passed " "FactoryObject %s with no contained object", @@ -1112,11 +1112,11 @@ TangibleObject * ManufactureSchematicObject::getComponent( const Crafting::ComponentIngredient & info) const { const VolumeContainer * volumeContainer = ContainerInterface::getVolumeContainer(*this); - if (volumeContainer == nullptr) + if (volumeContainer == NULL) { DEBUG_WARNING(true, ("Manf schematic %s does not have a volume container!", getNetworkId().getValueString().c_str())); - return nullptr; + return NULL; } // check if the component is in a FactoryObject; if it is, return the factory, @@ -1124,10 +1124,10 @@ TangibleObject * ManufactureSchematicObject::getComponent( if (info.ingredient != NetworkId::cms_invalid) { ServerObject * object = ServerWorld::findObjectByNetworkId(info.ingredient); - if (object != nullptr) + if (object != NULL) { Object * container = ContainerInterface::getContainedByObject(*object); - if (container != nullptr && dynamic_cast(container) != nullptr) + if (container != NULL && dynamic_cast(container) != NULL) return safe_cast(container); } } @@ -1137,7 +1137,7 @@ TangibleObject * ManufactureSchematicObject::getComponent( { const Container::ContainedItem & item = *iter; TangibleObject * object = safe_cast(item.getObject()); - if (object != nullptr) + if (object != NULL) { if (info.ingredient != NetworkId::cms_invalid) { @@ -1154,7 +1154,7 @@ TangibleObject * ManufactureSchematicObject::getComponent( } } } - return nullptr; + return NULL; } // ManufactureSchematicObject::getComponent //----------------------------------------------------------------------- @@ -1295,7 +1295,7 @@ void ManufactureSchematicObject::clearSlotSources() m_factories.begin(); iter != m_factories.end(); ++iter) { FactoryObject * factory = safe_cast((*iter).getObject()); - if (factory != nullptr) + if (factory != NULL) { factory->endCraftingSession(); } @@ -1305,23 +1305,23 @@ void ManufactureSchematicObject::clearSlotSources() // get rid of all our held ingredients VolumeContainer * volumeContainer = ContainerInterface::getVolumeContainer(*this); - if (volumeContainer != nullptr && volumeContainer->getNumberOfItems() > 0) + if (volumeContainer != NULL && volumeContainer->getNumberOfItems() > 0) { // for a stacked ingredient, if there are still more than one items in the stack, // "consume" 1 item from the stack, and return it to the player's inventory std::set itemsToReturnToInventory; - ServerObject* inventory = nullptr; + ServerObject* inventory = NULL; for (ContainerIterator iter = volumeContainer->begin(); iter != volumeContainer->end(); ++iter) { - if ((*iter).getObject() != nullptr) + if ((*iter).getObject() != NULL) { bool destroyItem = true; TangibleObject* to = safe_cast((*iter).getObject())->asTangibleObject(); - if (to && (to->getCount() > 1) && (dynamic_cast(to) == nullptr)) + if (to && (to->getCount() > 1) && (dynamic_cast(to) == NULL)) { - if (inventory == nullptr) + if (inventory == NULL) { ServerObject * o = safe_cast(ContainerInterface::getContainedByObject(*to)); while (o) @@ -1357,7 +1357,7 @@ void ManufactureSchematicObject::clearSlotSources() Container::ContainerErrorCode errCode; for (std::set::const_iterator iter = itemsToReturnToInventory.begin(); iter != itemsToReturnToInventory.end(); ++iter) { - if (!ContainerInterface::transferItemToVolumeContainer(*inventory, **iter, nullptr, errCode)) + if (!ContainerInterface::transferItemToVolumeContainer(*inventory, **iter, NULL, errCode)) { (*iter)->permanentlyDestroy(DeleteReasons::Replaced); } @@ -1741,11 +1741,11 @@ bool ManufactureSchematicObject::getCustomization(const std::string & name, const DynamicVariableList * objvars = getObjVars(); NOT_NULL(objvars); const DynamicVariableList * customs = safe_cast(objvars->getItemByName("cust")); - if (customs == nullptr) + if (customs == NULL) return false; const DynamicVariableList * custom = safe_cast(customs->getItemByName(name)); - if (custom == nullptr) + if (custom == NULL) return false; data.name = name; @@ -1771,7 +1771,7 @@ bool ManufactureSchematicObject::getCustomization(int index, const DynamicVariableList * objvars = getObjVars(); NOT_NULL(objvars); const DynamicVariableList * customs = safe_cast(objvars->getItemByName("cust")); - if (customs == nullptr) + if (customs == NULL) return false; int count = customs->getCount(); @@ -1799,7 +1799,7 @@ int ManufactureSchematicObject::getCustomizationsCount() const const DynamicVariableList * objvars = getObjVars(); NOT_NULL(objvars); const DynamicVariableList * customs = safe_cast(objvars->getItemByName("cust")); - if (customs == nullptr) + if (customs == NULL) return 0; return customs->getCount(); @@ -1838,7 +1838,7 @@ bool ManufactureSchematicObject::setCustomization(int index, int value, ServerObject & prototype) { ManufactureSchematicSynchronizedUi * sync = safe_cast(getSynchronizedUi ()); - if (sync == nullptr) + if (sync == NULL) return false; const std::string & customName = sync->getCustomizationName(index); @@ -1863,7 +1863,7 @@ bool ManufactureSchematicObject::setCustomization(const std::string & name, int value, ServerObject & prototype) { ManufactureSchematicSynchronizedUi * sync = safe_cast(getSynchronizedUi ()); - if (sync == nullptr) + if (sync == NULL) return false; // make sure the value is within range @@ -1878,10 +1878,10 @@ bool ManufactureSchematicObject::setCustomization(const std::string & name, // save the customization string CustomizationDataProperty * const cdProperty = safe_cast(prototype.getProperty(CustomizationDataProperty::getClassPropertyId())); - if (cdProperty != nullptr) + if (cdProperty != NULL) { CustomizationData *const customizationData = cdProperty->fetchCustomizationData(); - if (customizationData != nullptr) + if (customizationData != NULL) { m_appearanceData = customizationData->writeLocalDataToString(); setObjVarItem("customization_data", m_appearanceData.get()); @@ -1993,7 +1993,7 @@ void ManufactureSchematicObject::removeCraftingFactory(const FactoryObject & fac bool ManufactureSchematicObject::addIngredient(ServerObject & component) { Container::ContainerErrorCode tmp = Container::CEC_Success; - return ContainerInterface::transferItemToVolumeContainer(*this, component, nullptr, tmp); + return ContainerInterface::transferItemToVolumeContainer(*this, component, NULL, tmp); } // ManufactureSchematicObject::addIngredient //----------------------------------------------------------------------- @@ -2037,7 +2037,7 @@ bool ManufactureSchematicObject::removeIngredient(ServerObject & component, { // if the component is a factory, treat is differently FactoryObject * factory = dynamic_cast(&component); - if (factory != nullptr) + if (factory != NULL) { // if the factory is contained by us, move it to the destination, // making sure that its count is 1; if it is not contained by us, @@ -2050,7 +2050,7 @@ bool ManufactureSchematicObject::removeIngredient(ServerObject & component, factory->removeCraftingReferences(factory->getCount() - 1); Container::ContainerErrorCode errCode; return ContainerInterface::transferItemToVolumeContainer(destination, - *factory, nullptr, errCode); + *factory, NULL, errCode); } else { @@ -2064,17 +2064,17 @@ bool ManufactureSchematicObject::removeIngredient(ServerObject & component, { // make sure the component is in our container Object * container = ContainerInterface::getContainedByObject(component); - if (container == nullptr || container->getNetworkId() != getNetworkId()) + if (container == NULL || container->getNetworkId() != getNetworkId()) { FactoryObject * factory = dynamic_cast(container); - if (factory != nullptr) + if (factory != NULL) return removeIngredient(*factory, destination); return false; } Container::ContainerErrorCode errCode; return ContainerInterface::transferItemToVolumeContainer(destination, component, - nullptr, errCode); + NULL, errCode); } } // ManufactureSchematicObject::removeIngredient @@ -2169,7 +2169,7 @@ void ManufactureSchematicObject::destroyAllIngredients() m_factories.begin(); iter != m_factories.end(); ++iter) { FactoryObject * factory = safe_cast((*iter).getObject()); - if (factory != nullptr) + if (factory != NULL) { factory->endCraftingSession(); } @@ -2179,24 +2179,24 @@ void ManufactureSchematicObject::destroyAllIngredients() // empty our volume container VolumeContainer * const container = ContainerInterface::getVolumeContainer(*this); - if (container != nullptr) + if (container != NULL) { // for a stacked ingredient, if there are still more than one items in the stack, // "consume" 1 item from the stack, and return it to the player's inventory std::set itemsToReturnToInventory; - ServerObject* inventory = nullptr; + ServerObject* inventory = NULL; ContainerIterator iter; for (iter = container->begin(); iter != container->end(); ++iter) { CachedNetworkId & itemId = *iter; - if (itemId.getObject() != nullptr) + if (itemId.getObject() != NULL) { bool destroyItem = true; TangibleObject* to = safe_cast(itemId.getObject())->asTangibleObject(); - if (to && (to->getCount() > 1) && (dynamic_cast(to) == nullptr)) + if (to && (to->getCount() > 1) && (dynamic_cast(to) == NULL)) { - if (inventory == nullptr) + if (inventory == NULL) { ServerObject * o = safe_cast(ContainerInterface::getContainedByObject(*to)); while (o) @@ -2235,7 +2235,7 @@ void ManufactureSchematicObject::destroyAllIngredients() Container::ContainerErrorCode errCode; for (std::set::const_iterator iter = itemsToReturnToInventory.begin(); iter != itemsToReturnToInventory.end(); ++iter) { - if (!ContainerInterface::transferItemToVolumeContainer(*inventory, **iter, nullptr, errCode)) + if (!ContainerInterface::transferItemToVolumeContainer(*inventory, **iter, NULL, errCode)) { (*iter)->permanentlyDestroy(DeleteReasons::Consumed); } @@ -2281,29 +2281,29 @@ void ManufactureSchematicObject::destroyAllIngredients() ServerObject * ManufactureSchematicObject::manufactureObject(const NetworkId & creatorId, ServerObject & container, const SlotId & containerSlotId, bool prototype) { if (getCount() <= 0) - return nullptr; + return NULL; const DraftSchematicObject * draftSchematic = DraftSchematicObject::getSchematic(m_draftSchematic.get()); - if (draftSchematic == nullptr) + if (draftSchematic == NULL) { - return nullptr; + return NULL; } - if (draftSchematic->getCraftedObjectTemplate() == nullptr) + if (draftSchematic->getCraftedObjectTemplate() == NULL) { DEBUG_WARNING(true, ("Draft schematic %s does not have a craftable object template!\n", draftSchematic->getTemplateName())); - return nullptr; + return NULL; } // create the item TangibleObject * const object = dynamic_cast(ServerWorld::createNewObject(*draftSchematic->getCraftedObjectTemplate(), container, containerSlotId, false)); - if (object == nullptr) + if (object == NULL) { DEBUG_WARNING(true, ("Player %s failed to create object for template " "%s.\n", creatorId.getValueString().c_str(), draftSchematic->getCraftedObjectTemplate()->getName())); - return nullptr; + return NULL; } if (!getAssignedObjectName().empty()) @@ -2327,7 +2327,7 @@ ServerObject * ManufactureSchematicObject::manufactureObject(const NetworkId & c // set the creator xp type from the schematic template const ServerObjectTemplate * schematicTemplate = safe_cast(draftSchematic->getObjectTemplate()); - if (schematicTemplate != nullptr && schematicTemplate->getXpPointsCount() > 0) + if (schematicTemplate != NULL && schematicTemplate->getXpPointsCount() > 0) { ServerObjectTemplate::Xp xpData; schematicTemplate->getXpPoints(xpData, 0); @@ -2339,7 +2339,7 @@ ServerObject * ManufactureSchematicObject::manufactureObject(const NetworkId & c if (!setObjectComponents(object, true)) { object->permanentlyDestroy(DeleteReasons::BadContainerTransfer); - return nullptr; + return NULL; } // allow the schematic scripts to modify the object @@ -2356,7 +2356,7 @@ ServerObject * ManufactureSchematicObject::manufactureObject(const NetworkId & c if (result == SCRIPT_OVERRIDE) { object->permanentlyDestroy(DeleteReasons::Script); - return nullptr; + return NULL; } incrementCount(-1); @@ -2392,15 +2392,15 @@ ServerObject * ManufactureSchematicObject::manufactureObject(const Vector & posi { const DraftSchematicObject * draftSchematic = DraftSchematicObject::getSchematic( m_draftSchematic.get()); - if (draftSchematic == nullptr) + if (draftSchematic == NULL) { - return nullptr; + return NULL; } - if (draftSchematic->getCraftedObjectTemplate() == nullptr) + if (draftSchematic->getCraftedObjectTemplate() == NULL) { DEBUG_WARNING(true, ("Draft schematic %s does not have a craftable " "object template!\n", draftSchematic->getTemplateName())); - return nullptr; + return NULL; } Transform tr; @@ -2409,11 +2409,11 @@ ServerObject * ManufactureSchematicObject::manufactureObject(const Vector & posi TangibleObject * object = dynamic_cast(ServerWorld::createNewObject( *draftSchematic->getCraftedObjectTemplate(), tr, 0, false)); - if (object == nullptr) + if (object == NULL) { DEBUG_WARNING(true, ("Failed to create object for template " "%s.\n", draftSchematic->getCraftedObjectTemplate()->getName())); - return nullptr; + return NULL; } if (!getAssignedObjectName().empty()) @@ -2468,7 +2468,7 @@ bool ManufactureSchematicObject::setObjectComponents(TangibleObject * object, bo // check the objects in the schematic volume container to make sure they match VolumeContainer * volumeContainer = ContainerInterface::getVolumeContainer(*this); - if (volumeContainer == nullptr) + if (volumeContainer == NULL) { DEBUG_WARNING(true, ("Manf schematic %s does not have a volume container!", getNetworkId().getValueString().c_str())); @@ -2478,7 +2478,7 @@ bool ManufactureSchematicObject::setObjectComponents(TangibleObject * object, bo // for a stacked ingredient, if there are still more than one items in the stack, // "consume" 1 item from the stack, and return it to the player's inventory std::set itemsToReturnToInventory; - ServerObject* inventory = nullptr; + ServerObject* inventory = NULL; DynamicVariableList::NestedList slots(getObjVars(),OBJVAR_SLOTS); @@ -2533,11 +2533,11 @@ bool ManufactureSchematicObject::setObjectComponents(TangibleObject * object, bo { Container::ContainedItem & item = *iter; TangibleObject * const testComponent = dynamic_cast(item.getObject()); - if (testComponent == nullptr) + if (testComponent == NULL) continue; if (itemsToReturnToInventory.count(testComponent) > 0) continue; - FactoryObject * crate = nullptr; + FactoryObject * crate = NULL; bool found = false; bool foundCrate = false; if (component->ingredient != NetworkId::cms_invalid) @@ -2548,7 +2548,7 @@ bool ManufactureSchematicObject::setObjectComponents(TangibleObject * object, bo // see if the test component is a crate crate = dynamic_cast(testComponent); - if (crate != nullptr && crate->getCount() == ingredientCount) + if (crate != NULL && crate->getCount() == ingredientCount) { foundCrate = true; } @@ -2598,7 +2598,7 @@ bool ManufactureSchematicObject::setObjectComponents(TangibleObject * object, bo if (!componentTableName.empty()) { DataTable * componentTable = DataTableManager::getTable(componentTableName, true); - if (componentTable != nullptr) + if (componentTable != NULL) { uint32 value = INVALID_CRC; if (draftSlot.appearance == "component") @@ -2645,9 +2645,9 @@ bool ManufactureSchematicObject::setObjectComponents(TangibleObject * object, bo } bool destroyItem = true; - if ((testComponent->getCount() > 1) && (dynamic_cast(testComponent) == nullptr)) + if ((testComponent->getCount() > 1) && (dynamic_cast(testComponent) == NULL)) { - if (inventory == nullptr) + if (inventory == NULL) { ServerObject * o = safe_cast(ContainerInterface::getContainedByObject(*testComponent)); while (o) @@ -2701,7 +2701,7 @@ bool ManufactureSchematicObject::setObjectComponents(TangibleObject * object, bo Container::ContainerErrorCode errCode; for (std::set::const_iterator iter = itemsToReturnToInventory.begin(); iter != itemsToReturnToInventory.end(); ++iter) { - if (!ContainerInterface::transferItemToVolumeContainer(*inventory, **iter, nullptr, errCode)) + if (!ContainerInterface::transferItemToVolumeContainer(*inventory, **iter, NULL, errCode)) { (*iter)->permanentlyDestroy(DeleteReasons::Consumed); } @@ -2723,15 +2723,15 @@ bool ManufactureSchematicObject::setObjectComponents(TangibleObject * object, bo for (iter = volumeContainer->begin(); iter != volumeContainer->end(); ++iter) { - if ((*iter).getObject() != nullptr) + if ((*iter).getObject() != NULL) { ServerObject * temp = safe_cast((*iter).getObject()); bool destroyItem = true; TangibleObject* to = temp->asTangibleObject(); - if (to && (to->getCount() > 1) && (dynamic_cast(to) == nullptr)) + if (to && (to->getCount() > 1) && (dynamic_cast(to) == NULL)) { - if (inventory == nullptr) + if (inventory == NULL) { ServerObject * o = safe_cast(ContainerInterface::getContainedByObject(*to)); while (o) @@ -2787,7 +2787,7 @@ bool ManufactureSchematicObject::setObjectComponents(TangibleObject * object, bo Container::ContainerErrorCode errCode; for (std::set::const_iterator iter = itemsToReturnToInventory.begin(); iter != itemsToReturnToInventory.end(); ++iter) { - if (!ContainerInterface::transferItemToVolumeContainer(*inventory, **iter, nullptr, errCode)) + if (!ContainerInterface::transferItemToVolumeContainer(*inventory, **iter, NULL, errCode)) { (*iter)->permanentlyDestroy(DeleteReasons::Replaced); } @@ -2847,7 +2847,7 @@ void ManufactureSchematicObject::requestSlots(ServerObject & player) const case Crafting::IT_schematicGeneric: { const TangibleObject * const ingredient = dynamic_cast(NetworkIdManager::getObjectById(ingredientId)); - if (ingredient != nullptr) + if (ingredient != NULL) { optionInfo.ingredient = ingredient->getEncodedObjectName(); // since names can be duplicated, concatinate the id of @@ -2870,7 +2870,7 @@ void ManufactureSchematicObject::requestSlots(ServerObject & player) const case Crafting::IT_resourceClass: { ResourceTypeObject const * const ingredient = ServerUniverse::getInstance().getResourceTypeById(ingredientId); - if (ingredient != nullptr) + if (ingredient != NULL) optionInfo.ingredient = Unicode::narrowToWide(ingredient->getResourceName()); else optionInfo.ingredient = Unicode::narrowToWide("unknown"); @@ -2942,7 +2942,7 @@ void ManufactureSchematicObject::getIngredientInfo (IngredientInfoVector & iiv) // the manf schematic to the name if (component->ingredient != NetworkId::cms_invalid) { - //-- nullptr-separate the string if needed + //-- null-separate the string if needed if (!ingredientName.empty () && ingredientName [0] == '@') ingredientName.push_back ('\0'); @@ -2990,7 +2990,7 @@ void ManufactureSchematicObject::getIngredientInfo (IngredientInfoVector & iiv) case Crafting::IT_resourceClass: { ResourceTypeObject const * const ingredient = ServerUniverse::getInstance().getResourceTypeById(ingredientId); - if (ingredient != nullptr) + if (ingredient != NULL) ingredientName = Unicode::narrowToWide(ingredient->getResourceName ()); } break; @@ -3125,7 +3125,7 @@ const std::map & ManufactureSchematicObject::getAttributes() co int ManufactureSchematicObject::getVolume() const { const DraftSchematicObject * const schematic = DraftSchematicObject::getSchematic(getDraftSchematic()); - if (schematic != nullptr) + if (schematic != NULL) return schematic->getObjectTemplate()->asServerObjectTemplate()->getVolume(); return IntangibleObject::getVolume(); } // ManufactureSchematicObject::getVolume @@ -3212,7 +3212,7 @@ void ManufactureSchematicObject::recalculateData() else { const DraftSchematicObject * const missingSchematic = DraftSchematicObject::getSchematic(MISSING_SCHEMATIC_SUBSTITUTE); - if (missingSchematic != nullptr) + if (missingSchematic != NULL) m_draftSchematicSharedTemplate = missingSchematic->getSharedTemplate()->getCrcName().getCrc(); else WARNING_STRICT_FATAL(true, ("Cannot find draft schematic %s! This must always exist!", MISSING_SCHEMATIC_SUBSTITUTE.c_str())); @@ -3262,7 +3262,7 @@ void ManufactureSchematicObject::getByteStreamFromAutoVariable(const std::string if (name == "msoCtsPackUnpack") { // creator Id/Name - CreatureObject const * containingPlayer = nullptr; + CreatureObject const * containingPlayer = NULL; ServerObject const * parent = safe_cast(ContainerInterface::getContainedByObject(*this)); while (parent) @@ -3271,7 +3271,7 @@ void ManufactureSchematicObject::getByteStreamFromAutoVariable(const std::string if (containingPlayer && PlayerCreatureController::getPlayerObject(containingPlayer)) break; - containingPlayer = nullptr; + containingPlayer = NULL; parent = safe_cast(ContainerInterface::getContainedByObject(*parent)); } @@ -3329,7 +3329,7 @@ void ManufactureSchematicObject::setAutoVariableFromByteStream(const std::string Archive::AutoDeltaVariable creatorIsOwner; creatorIsOwner.unpackDelta(ri); - CreatureObject const * containingPlayer = nullptr; + CreatureObject const * containingPlayer = NULL; if (creatorIsOwner.get()) { @@ -3340,7 +3340,7 @@ void ManufactureSchematicObject::setAutoVariableFromByteStream(const std::string if (containingPlayer && PlayerCreatureController::getPlayerObject(containingPlayer)) break; - containingPlayer = nullptr; + containingPlayer = NULL; parent = safe_cast(ContainerInterface::getContainedByObject(*parent)); } } diff --git a/engine/server/library/serverGame/src/shared/object/MissionObject.cpp b/engine/server/library/serverGame/src/shared/object/MissionObject.cpp index fb7504f0..9aa5873a 100755 --- a/engine/server/library/serverGame/src/shared/object/MissionObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/MissionObject.cpp @@ -32,7 +32,7 @@ //----------------------------------------------------------------------- -const SharedObjectTemplate * MissionObject::m_defaultSharedTemplate = nullptr; +const SharedObjectTemplate * MissionObject::m_defaultSharedTemplate = NULL; const char * const s_missionObjectTemplateName = "object/mission/base_mission_object.iff"; //----------------------------------------------------------------------- @@ -125,13 +125,13 @@ const SharedObjectTemplate * MissionObject::getDefaultSharedTemplate(void) const { static const ConstCharCrcLowerString templateName("object/mission/base/shared_mission_default.iff"); - if (m_defaultSharedTemplate == nullptr) + if (m_defaultSharedTemplate == NULL) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create " + WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create " "default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != nullptr) + if (m_defaultSharedTemplate != NULL) ExitChain::add (removeDefaultTemplate, "MissionObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -144,10 +144,10 @@ static const ConstCharCrcLowerString templateName("object/mission/base/shared_mi */ void MissionObject::removeDefaultTemplate(void) { - if (m_defaultSharedTemplate != nullptr) + if (m_defaultSharedTemplate != NULL) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = nullptr; + m_defaultSharedTemplate = NULL; } } // MissionObject::removeDefaultTemplate @@ -158,7 +158,7 @@ void MissionObject::abortMission() ScriptParams params; ScriptDictionaryPtr dictionary; getScriptObject()->makeScriptDictionary(params, dictionary); - if (dictionary.get() != nullptr) + if (dictionary.get() != NULL) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(getNetworkId(), @@ -710,7 +710,7 @@ void MissionObject::getByteStreamFromAutoVariable(const std::string & name, Arch Archive::put(target, m_waypoint.get().getWaypointDataBase()); // mission location target - CreatureObject const * containingPlayer = nullptr; + CreatureObject const * containingPlayer = NULL; ServerObject const * parent = safe_cast(ContainerInterface::getContainedByObject(*this)); while (parent) { @@ -718,7 +718,7 @@ void MissionObject::getByteStreamFromAutoVariable(const std::string & name, Arch if (containingPlayer && PlayerCreatureController::getPlayerObject(containingPlayer)) break; - containingPlayer = nullptr; + containingPlayer = NULL; parent = safe_cast(ContainerInterface::getContainedByObject(*parent)); } @@ -785,7 +785,7 @@ void MissionObject::setAutoVariableFromByteStream(const std::string & name, cons m_title.unpackDelta(ri); // mission holder id - CreatureObject * containingPlayer = nullptr; + CreatureObject * containingPlayer = NULL; ServerObject * parent = safe_cast(ContainerInterface::getContainedByObject(*this)); while (parent) { @@ -793,7 +793,7 @@ void MissionObject::setAutoVariableFromByteStream(const std::string & name, cons if (containingPlayer && PlayerCreatureController::getPlayerObject(containingPlayer)) break; - containingPlayer = nullptr; + containingPlayer = NULL; parent = safe_cast(ContainerInterface::getContainedByObject(*parent)); } diff --git a/engine/server/library/serverGame/src/shared/object/ObjectFactory.cpp b/engine/server/library/serverGame/src/shared/object/ObjectFactory.cpp index e23c7d1d..bcba1d72 100755 --- a/engine/server/library/serverGame/src/shared/object/ObjectFactory.cpp +++ b/engine/server/library/serverGame/src/shared/object/ObjectFactory.cpp @@ -53,14 +53,14 @@ ServerObject * ServerWorld::createObjectFromTemplate(uint32 templateCrc, const N WARNING(!objectTemplate, ("Missing Template! Can't create object from " "template crc %lu(%s), file not found", templateCrc, ObjectTemplateList::lookUp(templateCrc).getString())); - Object *object = nullptr; + Object *object = NULL; if (objectTemplate) { ServerObjectTemplate const * serverObjectTemplate = objectTemplate->asServerObjectTemplate(); - if ( (serverObjectTemplate == nullptr) - || ((serverObjectTemplate != nullptr) && (ObjectTemplateList::lookUp(serverObjectTemplate->getSharedTemplate().c_str()).getCrc() != 0))) + if ( (serverObjectTemplate == NULL) + || ((serverObjectTemplate != NULL) && (ObjectTemplateList::lookUp(serverObjectTemplate->getSharedTemplate().c_str()).getCrc() != 0))) { PROFILER_AUTO_BLOCK_DEFINE("ObjectTemplate::createObject"); object = objectTemplate->createObject(); diff --git a/engine/server/library/serverGame/src/shared/object/ObjectTracker.cpp b/engine/server/library/serverGame/src/shared/object/ObjectTracker.cpp index 23b38bfe..888b5d77 100755 --- a/engine/server/library/serverGame/src/shared/object/ObjectTracker.cpp +++ b/engine/server/library/serverGame/src/shared/object/ObjectTracker.cpp @@ -81,7 +81,7 @@ int ObjectTracker::getNumPlayers() void ObjectTracker::getNumPlayersByFaction(int & imperial, int & rebel, int & neutral) { - time_t const now = ::time(nullptr); + time_t const now = ::time(NULL); if ((now - m_lastTimeCalculateFactionalPlayersCount) > 60) { m_numPlayersImperial = 0; diff --git a/engine/server/library/serverGame/src/shared/object/PatrolPathNodeProperty.cpp b/engine/server/library/serverGame/src/shared/object/PatrolPathNodeProperty.cpp index 4731fcd7..c17b6ca6 100755 --- a/engine/server/library/serverGame/src/shared/object/PatrolPathNodeProperty.cpp +++ b/engine/server/library/serverGame/src/shared/object/PatrolPathNodeProperty.cpp @@ -36,7 +36,7 @@ m_roots(new std::set) PatrolPathNodeProperty::~PatrolPathNodeProperty() { delete m_roots; - m_roots = nullptr; + m_roots = NULL; } //------------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/object/PlanetObject.cpp b/engine/server/library/serverGame/src/shared/object/PlanetObject.cpp index 0ecbb8d6..f6a57df4 100755 --- a/engine/server/library/serverGame/src/shared/object/PlanetObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/PlanetObject.cpp @@ -126,7 +126,7 @@ namespace PlanetObjectNamespace const char * makeCopyOfString(const char * rhs) { - char * lhs = nullptr; + char * lhs = NULL; if (rhs) { lhs = new char[strlen(rhs) + 1]; @@ -144,7 +144,7 @@ namespace PlanetObjectNamespace int getNextGcwScoreDecayTime(int base); // dictionary containing the table showing factional presence activity - ScriptParams * s_factionalPresenceSuiTable = nullptr; + ScriptParams * s_factionalPresenceSuiTable = NULL; bool s_factionalPresenceSuiTableNeedRebuild = true; void decrementConnectedCharacterLfgDataFactionalPresenceCount(Archive::AutoDeltaMap, PlanetObject> & connectedCharacterLfgDataFactionalPresence, const LfgCharacterData & lfgCharacterData); @@ -914,7 +914,7 @@ void PlanetObject::onLoadedFromDatabase() // "server first" information and manually create the CollectionServerFirstObserver // object, so that there will only be 1 call to the CollectionServerFirstObserver // object when it goes out of scope at the end of the function - m_collectionServerFirst.setSourceObject(nullptr); + m_collectionServerFirst.setSourceObject(NULL); CollectionServerFirstObserver observer(this, Archive::ADOO_set); const DynamicVariableList & objvars = getObjVars(); @@ -1004,7 +1004,7 @@ void PlanetObject::setCollectionServerFirst(const CollectionsDataTable::Collecti if (objvars.hasItem(objvar) && (DynamicVariable::STRING_ARRAY == objvars.getType(objvar))) return; - const time_t timeNow = ::time(nullptr); + const time_t timeNow = ::time(NULL); char buffer[64]; snprintf(buffer, sizeof(buffer)-1, "%ld", timeNow); buffer[sizeof(buffer)-1] = '\0'; @@ -1131,7 +1131,7 @@ void PlanetObject::handleCMessageTo(MessageToPayload const &message) std::string const params(message.getPackedDataVector().begin(), message.getPackedDataVector().end()); Unicode::String const delimiters(Unicode::narrowToWide("|")); Unicode::UnicodeStringVector tokens; - if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, nullptr)) && (tokens.size() == 2)) + if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, NULL)) && (tokens.size() == 2)) { CollectionsDataTable::CollectionInfoCollection const * const collectionInfo = CollectionsDataTable::getCollectionByName(Unicode::wideToNarrow(tokens[0])); if (collectionInfo && collectionInfo->trackServerFirst && (collectionInfo->serverFirstClaimTime > 0)) @@ -1193,7 +1193,7 @@ void PlanetObject::handleCMessageTo(MessageToPayload const &message) else if (message.getMethod() == "C++DoGcwDecay") { // start decay handling loop - int const now = static_cast(::time(nullptr)); + int const now = static_cast(::time(NULL)); int timeNextGcwScoreDecay; if (!getObjVars().getItem("gcwScore.nextDecayTime", timeNextGcwScoreDecay) || (timeNextGcwScoreDecay <= 0)) { @@ -1397,7 +1397,7 @@ void PlanetObject::endBaselines() } // start decay handling loop - int const now = static_cast(::time(nullptr)); + int const now = static_cast(::time(NULL)); int timeNextGcwScoreDecay; if (!getObjVars().getItem("gcwScore.nextDecayTime", timeNextGcwScoreDecay) || (timeNextGcwScoreDecay <= 0)) { @@ -1481,7 +1481,7 @@ ScriptParams const *PlanetObject::getConnectedCharacterLfgDataFactionalPresenceT if (s_factionalPresenceSuiTableNeedRebuild) { delete s_factionalPresenceSuiTable; - s_factionalPresenceSuiTable = nullptr; + s_factionalPresenceSuiTable = NULL; PlanetObject const * const tatooine = ServerUniverse::getInstance().getTatooinePlanet(); if (tatooine) @@ -2156,8 +2156,8 @@ void PlanetObject::updateGcwTrackingData() // send our GCW score to the other clusters and process GCW scores we received from other clusters if (isAuthoritative() && (ConfigServerGame::getBroadcastGcwScoreToOtherGalaxies() || ConfigServerGame::getReceiveGcwScoreFromOtherGalaxies())) { - static time_t timeNextBroadcast = ::time(nullptr) + ConfigServerGame::getBroadcastGcwScoreToOtherGalaxiesIntervalSeconds(); - time_t const timeNow = ::time(nullptr); + static time_t timeNextBroadcast = ::time(NULL) + ConfigServerGame::getBroadcastGcwScoreToOtherGalaxiesIntervalSeconds(); + time_t const timeNow = ::time(NULL); if (timeNextBroadcast < timeNow) { if (ConfigServerGame::getBroadcastGcwScoreToOtherGalaxies()) @@ -2342,7 +2342,7 @@ void PlanetObject::adjustGcwImperialScore(std::string const & source, CreatureOb PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(sourceObject); if (playerObject) { - int const timeNow = static_cast(::time(nullptr)); + int const timeNow = static_cast(::time(NULL)); IGNORE_RETURN(playerObject->setObjVarItem(std::string("gcwContributionTracking.") + gcwCategory, timeNow)); IGNORE_RETURN(playerObject->setObjVarItem(std::string("gcwContributionTrackingLastUpdated"), timeNow)); @@ -2387,7 +2387,7 @@ void PlanetObject::adjustGcwRebelScore(std::string const & source, CreatureObjec PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(sourceObject); if (playerObject) { - int const timeNow = static_cast(::time(nullptr)); + int const timeNow = static_cast(::time(NULL)); IGNORE_RETURN(playerObject->setObjVarItem(std::string("gcwContributionTracking.") + gcwCategory, timeNow)); IGNORE_RETURN(playerObject->setObjVarItem(std::string("gcwContributionTrackingLastUpdated"), timeNow)); @@ -2441,7 +2441,7 @@ int PlanetObjectNamespace::getNextGcwScoreDecayTime(int base) } if (nextTime < 0) - nextTime = static_cast(::time(nullptr)) + (60 * 60 * 24 * 7); + nextTime = static_cast(::time(NULL)) + (60 * 60 * 24 * 7); return nextTime; } diff --git a/engine/server/library/serverGame/src/shared/object/PlayerObject.cpp b/engine/server/library/serverGame/src/shared/object/PlayerObject.cpp index 5a481653..1e574c40 100755 --- a/engine/server/library/serverGame/src/shared/object/PlayerObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/PlayerObject.cpp @@ -95,7 +95,7 @@ #include #include -const SharedObjectTemplate * PlayerObject::m_defaultSharedTemplate = nullptr; +const SharedObjectTemplate * PlayerObject::m_defaultSharedTemplate = NULL; bool PlayerObject::m_allowEmptySlot = false; @@ -317,7 +317,7 @@ PlayerObject::PlayerObject(const ServerPlayerObjectTemplate* newTemplate) : m_craftingStation(), m_craftingComponentBioLink(), m_useableDraftSchematics(), - m_draftSchematic(nullptr), + m_draftSchematic(NULL), m_matchMakingPersonalProfileId(), m_matchMakingCharacterProfileId(), m_friendList(), @@ -451,13 +451,13 @@ const SharedObjectTemplate * PlayerObject::getDefaultSharedTemplate() const { static const ConstCharCrcLowerString templateName("object/player/base/shared_player_default.iff"); - if (m_defaultSharedTemplate == nullptr) + if (m_defaultSharedTemplate == NULL) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create " + WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create " "default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != nullptr) + if (m_defaultSharedTemplate != NULL) ExitChain::add (removeDefaultTemplate, "PlayerObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -470,10 +470,10 @@ static const ConstCharCrcLowerString templateName("object/player/base/shared_pla */ void PlayerObject::removeDefaultTemplate() { - if (m_defaultSharedTemplate != nullptr) + if (m_defaultSharedTemplate != NULL) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = nullptr; + m_defaultSharedTemplate = NULL; } } // PlayerObject::removeDefaultTemplate @@ -514,7 +514,7 @@ int PlayerObject::getCurrentBornDate() time_t baseTime = mktime(&baseTimeData); // get the current time and compute the birth date - time_t currentTime = time(nullptr); + time_t currentTime = time(NULL); time_t delta = (currentTime - baseTime) / (60 * 60 * 24); delta += ((currentTime - baseTime) % (60 * 60 * 24) != 0 ? 1 : 0); return int(delta); @@ -631,14 +631,14 @@ void PlayerObject::virtualOnSetAuthority() if (isCrafting()) { const TangibleObject * tool = safe_cast(getCraftingTool().getObject()); - if (tool != nullptr) + if (tool != NULL) { const ManufactureSchematicObject * manfSchematic = tool->getCraftingManufactureSchematic(); - if (manfSchematic != nullptr) + if (manfSchematic != NULL) { m_draftSchematic = DraftSchematicObject::getSchematic( manfSchematic->getDraftSchematic()); - if (m_draftSchematic.getPointer() == nullptr) + if (m_draftSchematic.getPointer() == NULL) { WARNING(true, ("PlayerObject::virtualOnSetAuthority object " "%s is flagged as crafting, but has bad manf schematic %lu", @@ -749,7 +749,7 @@ int PlayerObject::getExperienceLimit(const std::string & experienceType) const if((*iter)) { const SkillObject::ExperiencePair * xpInfo = (*iter)->getPrerequisiteExperience(); - if (xpInfo != nullptr && experienceType == xpInfo->first && xpInfo->second.second > 0) + if (xpInfo != NULL && experienceType == xpInfo->first && xpInfo->second.second > 0) { if (limit == static_cast(-1) || limit < static_cast(xpInfo->second.second)) @@ -797,9 +797,9 @@ int PlayerObject::grantExperiencePoints(const std::string & experienceType, int // adjust the xp based on what faction is doing best // NOTE: HACK HACK HACK! const PlanetObject * tatooine = ServerUniverse::getInstance().getTatooinePlanet(); - if (tatooine == nullptr) + if (tatooine == NULL) tatooine = ServerUniverse::getInstance().getPlanetByName("Tatooine"); - if (tatooine == nullptr) + if (tatooine == NULL) { WARNING(true, ("Can't find planet tatooine from ServerUniverse")); } @@ -932,7 +932,7 @@ bool PlayerObject::grantSchematic(uint32 schematicCrc, bool fromSkill) const DraftSchematicObject * schematic = DraftSchematicObject::getSchematic( schematicCrc); - if (schematic != nullptr) + if (schematic != NULL) { // add the schematic to the player's draft schematic list Archive::AutoDeltaMap, int>::const_iterator found = m_draftSchematics.find(schematic->getCombinedCrc()); @@ -982,7 +982,7 @@ bool PlayerObject::revokeSchematic(uint32 schematicCrc, bool fromSkill) stopCrafting(false); const DraftSchematicObject * schematic = DraftSchematicObject::getSchematic(schematicCrc); - if (schematic != nullptr) + if (schematic != NULL) { // remove the schematic from the player's draft schematic list Archive::AutoDeltaMap, int>::const_iterator found = m_draftSchematics.find(schematic->getCombinedCrc()); @@ -1028,7 +1028,7 @@ bool PlayerObject::revokeSchematic(uint32 schematicCrc, bool fromSkill) bool PlayerObject::hasSchematic(uint32 schematicCrc) { const DraftSchematicObject * schematic = DraftSchematicObject::getSchematic(schematicCrc); - if (schematic != nullptr) + if (schematic != NULL) { std::map,int>::const_iterator found = m_draftSchematics.find(schematic->getCombinedCrc()); if (found != m_draftSchematics.end()) @@ -1065,7 +1065,7 @@ void PlayerObject::setCraftingTool(const TangibleObject & tool) */ void PlayerObject::setCraftingStation(const TangibleObject * station) { - if (station != nullptr) + if (station != NULL) { // verify the crafting station is valid if (station->getObjVars().hasItem(OBJVAR_CRAFTING_STATION)) @@ -1075,7 +1075,7 @@ void PlayerObject::setCraftingStation(const TangibleObject * station) // if we are private, make sure we have an ingredient hopper int privateStation = 0; station->getObjVars().getItem(OBJVAR_PRIVATE_STATION, privateStation); - if (privateStation == 1 && getCraftingLevel() == 3 && station->getIngredientHopper() == nullptr) + if (privateStation == 1 && getCraftingLevel() == 3 && station->getIngredientHopper() == NULL) { CreatureObject * const owner = getCreatureObject(); NOT_NULL(owner); @@ -1105,7 +1105,7 @@ void PlayerObject::setCraftingStation(const TangibleObject * station) bool PlayerObject::requestCraftingSession(const NetworkId & toolId) { CreatureObject * const owner = getCreatureObject(); - if (owner == nullptr) + if (owner == NULL) return false; const std::string myId = getNetworkId().getValueString(); @@ -1133,7 +1133,7 @@ bool PlayerObject::requestCraftingSession(const NetworkId & toolId) } TangibleObject * const tool = dynamic_cast(CachedNetworkId(toolId).getObject()); - if (tool == nullptr) + if (tool == NULL) { DEBUG_WARNING(true, ("Player %s requesting crafting session with invalid " "object %s", myIdString, toolIdString)); @@ -1155,7 +1155,7 @@ bool PlayerObject::requestCraftingSession(const NetworkId & toolId) { CachedNetworkId const & objId = (*iter); TangibleObject * const obj = safe_cast(objId.getObject()); - if ((obj != nullptr) && obj->isCraftingTool() && (toolType & obj->getCraftingType())) + if ((obj != NULL) && obj->isCraftingTool() && (toolType & obj->getCraftingType())) { return requestCraftingSession(objId) ; } @@ -1182,7 +1182,7 @@ bool PlayerObject::requestCraftingSession(const NetworkId & toolId) void PlayerObject::sendUseableDraftSchematics(std::vector & schematicNames) { CreatureObject * const owner = getCreatureObject(); - if (owner == nullptr) + if (owner == NULL) return; // keep around the names since we are just going to get an index back from @@ -1198,7 +1198,7 @@ void PlayerObject::sendUseableDraftSchematics(std::vector & schematicNam if (*iter != 0) { const DraftSchematicObject * const schematic = DraftSchematicObject::getSchematic(*iter); - if (schematic != nullptr) + if (schematic != NULL) { message->addSchematic(schematic->getCombinedCrc(), static_cast(schematic->getCategory())); @@ -1248,37 +1248,37 @@ void PlayerObject::sendUseableDraftSchematics(std::vector & schematicNam */ bool PlayerObject::requestDraftSlots(uint32 draftSchematicCrc, MessageQueueDraftSlots * message, MessageQueueDraftSlotsQueryResponse * queryMessage) { - ManufactureSchematicObject * manfSchematic = nullptr; + ManufactureSchematicObject * manfSchematic = NULL; MessageQueueDraftSlots::Slot slotInfo; MessageQueueDraftSlots::Option optionInfo; - if ((message == nullptr && queryMessage == nullptr) || - (message != nullptr && queryMessage != nullptr)) + if ((message == NULL && queryMessage == NULL) || + (message != NULL && queryMessage != NULL)) { return false; } CreatureObject * const owner = getCreatureObject(); - if (owner == nullptr) + if (owner == NULL) return false; const ConstCharCrcString & schematicName = ObjectTemplateList::lookUp(draftSchematicCrc); UNREF(schematicName); const DraftSchematicObject * const draftSchematic = DraftSchematicObject::getSchematic(draftSchematicCrc); - if (draftSchematic == nullptr) + if (draftSchematic == NULL) { DEBUG_WARNING(true, ("Player %s requested invalid draft schematic %s", owner->getNetworkId().getValueString().c_str(), schematicName.getString())); return false; } - if (message != nullptr) + if (message != NULL) { m_draftSchematic = draftSchematic; TangibleObject * const tool = safe_cast(getCraftingTool().getObject()); NOT_NULL(tool); - if (tool == nullptr) + if (tool == NULL) return false; tool->clearCraftingManufactureSchematic(); @@ -1287,7 +1287,7 @@ bool PlayerObject::requestDraftSlots(uint32 draftSchematicCrc, MessageQueueDraft // make a temporary manufacturing schematic based on the draft scematic manfSchematic = ServerWorld::createNewManufacturingSchematic(CachedNetworkId( *owner), *tool, tool->getCraftingManufactureSchematicSlotId(), false); - if (manfSchematic == nullptr) + if (manfSchematic == NULL) { DEBUG_WARNING(true, ("Error creating manufacturing schematic!")); return false; @@ -1305,7 +1305,7 @@ bool PlayerObject::requestDraftSlots(uint32 draftSchematicCrc, MessageQueueDraft // being made ServerObject * prototype = manfSchematic->manufactureObject(owner->getNetworkId(), *tool, tool->getCraftingPrototypeSlotId(), true); - if (prototype == nullptr) + if (prototype == NULL) { DEBUG_WARNING(true, ("Error creating temp prototype!")); return false; @@ -1322,7 +1322,7 @@ bool PlayerObject::requestDraftSlots(uint32 draftSchematicCrc, MessageQueueDraft getAccountDescription().c_str())); } - if (queryMessage != nullptr) + if (queryMessage != NULL) { queryMessage->setComplexity(static_cast(draftSchematic->getComplexity())); queryMessage->setVolume(draftSchematic->getVolume()); @@ -1343,7 +1343,7 @@ bool PlayerObject::requestDraftSlots(uint32 draftSchematicCrc, MessageQueueDraft if (!slot.optional || slot.optionalSkillCommand.empty() || owner->hasCommand(slot.optionalSkillCommand)) { - if (manfSchematic != nullptr) + if (manfSchematic != NULL) { // create the slot IGNORE_RETURN(manfSchematic->getSlot(slot.name, manfSlot)); @@ -1370,13 +1370,13 @@ bool PlayerObject::requestDraftSlots(uint32 draftSchematicCrc, MessageQueueDraft { // get the default object name from the shared template const ObjectTemplate *const ingredientTemplate = ObjectTemplateList::fetch(simple.ingredient); - if (ingredientTemplate == nullptr) + if (ingredientTemplate == NULL) { DEBUG_WARNING(true, ("draft schematic component ingredient %s not found!", simple.ingredient.c_str())); continue; } const SharedObjectTemplate * const sharedTemplate = safe_cast(ObjectTemplateList::fetch((safe_cast(ingredientTemplate))->getSharedTemplate())); - if (sharedTemplate == nullptr) + if (sharedTemplate == NULL) { DEBUG_WARNING(true, ("draft schematic component ingredient %s shared template not found!", simple.ingredient.c_str())); continue; @@ -1391,19 +1391,19 @@ bool PlayerObject::requestDraftSlots(uint32 draftSchematicCrc, MessageQueueDraft { // get the default object name from the shared template of the crafted object const ObjectTemplate * const ingredientTemplate = ObjectTemplateList::fetch(simple.ingredient); - if (ingredientTemplate == nullptr) + if (ingredientTemplate == NULL) { DEBUG_WARNING(true, ("draft schematic schematic ingredient %s not found!", simple.ingredient.c_str())); continue; } const ServerObjectTemplate * const craftedTemplate = safe_cast(ingredientTemplate)->getCraftedObjectTemplate(); - if (craftedTemplate == nullptr) + if (craftedTemplate == NULL) { DEBUG_WARNING(true, ("draft schematic schematic ingredient %s not found!", simple.ingredient.c_str())); continue; } const SharedObjectTemplate * const sharedTemplate = safe_cast(ObjectTemplateList::fetch((safe_cast(craftedTemplate))->getSharedTemplate())); - if (sharedTemplate == nullptr) + if (sharedTemplate == NULL) { DEBUG_WARNING(true, ("draft schematic component ingredient %s shared template not found!", simple.ingredient.c_str())); continue; @@ -1434,7 +1434,7 @@ bool PlayerObject::requestDraftSlots(uint32 draftSchematicCrc, MessageQueueDraft } // for (int j = 0; j < optionsCount; ++j) if (componentSlot) slotInfo.hardpoint = slot.appearance; - if (message != nullptr) + if (message != NULL) message->addSlot(slotInfo); else queryMessage->addSlot(slotInfo); @@ -1443,7 +1443,7 @@ bool PlayerObject::requestDraftSlots(uint32 draftSchematicCrc, MessageQueueDraft } // for (int i = 0; i < slotCount; ++i) // send the slot info to the player - if (message != nullptr) + if (message != NULL) { (safe_cast(owner->getController()))->appendMessage( static_cast(CM_draftSlotsMessage), 0.0f, message, @@ -1475,7 +1475,7 @@ bool PlayerObject::requestDraftSlots(uint32 draftSchematicCrc, MessageQueueDraft void PlayerObject::selectDraftSchematic(int index) { CreatureObject * const owner = getCreatureObject(); - if (owner == nullptr) + if (owner == NULL) return; const std::string myId = getNetworkId().getValueString(); @@ -1510,7 +1510,7 @@ void PlayerObject::selectDraftSchematic(int index) MessageQueueDraftSlots * message = new MessageQueueDraftSlots( getCraftingTool(), NetworkId::cms_invalid); - if (requestDraftSlots(m_useableDraftSchematics[static_cast(index)], message, nullptr)) + if (requestDraftSlots(m_useableDraftSchematics[static_cast(index)], message, NULL)) { m_craftingStage = static_cast(Crafting::CS_assembly); m_craftingComponentBioLink = NetworkId::cms_invalid; @@ -1540,11 +1540,11 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde UNREF(myIdString); // needed for release mode CreatureObject * const owner = getCreatureObject(); - if (owner == nullptr) + if (owner == NULL) return Crafting::CE_noOwner; // check the draft schematic - if (m_draftSchematic.getPointer() == nullptr) + if (m_draftSchematic.getPointer() == NULL) { WARNING(true, ("Player %s trying to fill slot with no draft schematic!", myIdString)); return Crafting::CE_noDraftSchematic; @@ -1572,9 +1572,9 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde } TangibleObject * const tool = safe_cast(getCraftingTool().getObject()); - if (tool == nullptr) + if (tool == NULL) { - WARNING(true, ("Player %s trying to fill slot with crafting tool %s, but tool is nullptr!", myIdString, getCraftingTool().getValueString().c_str())); + WARNING(true, ("Player %s trying to fill slot with crafting tool %s, but tool is NULL!", myIdString, getCraftingTool().getValueString().c_str())); return Crafting::CE_noCraftingTool; } @@ -1583,7 +1583,7 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde // check the manufacturing schematic ManufactureSchematicObject * const manfSchematic = tool->getCraftingManufactureSchematic(); - if (manfSchematic == nullptr) + if (manfSchematic == NULL) { WARNING(true, ("Player %s trying to fill slot with no manufacturing schematic!", myIdString)); return Crafting::CE_noManfSchematic; @@ -1614,7 +1614,7 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde // get the draft schematic option, convert the passed-in option index to the // unfiltered index int i, j; - const ServerIntangibleObjectTemplate::Ingredient * slotOption = nullptr; + const ServerIntangibleObjectTemplate::Ingredient * slotOption = NULL; const int optionsCount = static_cast(draftSlot.options.size()); for (i = 0, j = 0; i < optionsCount; ++i) { @@ -1637,9 +1637,9 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde } slotOptionIndex = i; - if (slotOption == nullptr || slotOption->ingredients.size() != 1) + if (slotOption == NULL || slotOption->ingredients.size() != 1) { - WARNING(true, ("slotOption is nullptr or ingredient %d for draft schematic %s, slot %s, has ingredient count != 1", + WARNING(true, ("slotOption is NULL or ingredient %d for draft schematic %s, slot %s, has ingredient count != 1", slotOptionIndex, m_draftSchematic->getTemplateName(), draftSlot.name.getText().c_str())); return Crafting::CE_invalidIngredientSize; } @@ -1671,7 +1671,7 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde int numIngredientsToAdd = neededIngredientCount - currentIngredientCount; TangibleObject * const ingredient = dynamic_cast(NetworkIdManager::getObjectById(ingredientId)); - if (ingredient == nullptr) + if (ingredient == NULL) { WARNING(true, ("No object for ingredient id %s", ingredientId.getValueString().c_str())); return Crafting::CE_invalidIngredient; @@ -1698,7 +1698,7 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde if (!owner->isIngredientInInventory(*ingredient)) { // if we are crafting level 3, also check the crafting station's hopper - if (getCraftingLevel() != 3 || (station != nullptr && + if (getCraftingLevel() != 3 || (station != NULL && !station->isIngredientInHopper(ingredientId))) { DEBUG_WARNING(true, ("Player %s chose invalid ingredient %s", myIdString, ingredientId.getValueString().c_str())); @@ -1709,7 +1709,7 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde // see if the ingredient is a resource or component ResourceContainerObject * const crate = dynamic_cast(ingredient); - if (crate != nullptr) + if (crate != NULL) { // get the resource type name and class name ResourceTypeObject const * const resource = crate->getResourceType(); @@ -1731,7 +1731,7 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde else if (slotOption->ingredientType == ServerIntangibleObjectTemplate::IT_resourceClass) { ResourceClassObject const * resourceClass = &(resource->getParentClass()); - while (resourceClass != nullptr) + while (resourceClass != NULL) { const std::string className (resourceClass->getResourceClassName()); if (className == slotIngredient.ingredient) @@ -1805,11 +1805,11 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde FactoryObject * factory = dynamic_cast(ingredient); // if this is an old-style factory, we can't use it directly in crafting - if (factory != nullptr && !factory->getLoadContents()) - factory = nullptr; + if (factory != NULL && !factory->getLoadContents()) + factory = NULL; // make sure the component isn't damaged - if (factory == nullptr && ingredient->getDamageTaken() != 0 && + if (factory == NULL && ingredient->getDamageTaken() != 0 && !ingredient->getObjVars().hasItem(OBJVAR_CRAFTING_COMPONENT_CAN_BE_DAMAGED)) { DEBUG_WARNING(true, ("Tried to use damaged component %s for draft schematic %s, slot %s, option %d", @@ -1853,27 +1853,27 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde // check the ingredient template name for every template in it's // heirarchy - const ObjectTemplate * testTemplate = nullptr; + const ObjectTemplate * testTemplate = NULL; if (slotOption->ingredientType == ServerIntangibleObjectTemplate::IT_template || slotOption->ingredientType == ServerIntangibleObjectTemplate::IT_templateGeneric) { - if (factory == nullptr) + if (factory == NULL) testTemplate = ingredient->getObjectTemplate(); else testTemplate = factory->getContainedObjectTemplate(); } else { - const DraftSchematicObject * itemSchematic = nullptr; - if (factory == nullptr) + const DraftSchematicObject * itemSchematic = NULL; + if (factory == NULL) itemSchematic = DraftSchematicObject::getSchematic(ingredient->getSourceDraftSchematic()); else itemSchematic = DraftSchematicObject::getSchematic(factory->getDraftSchematic()); - if (itemSchematic != nullptr) + if (itemSchematic != NULL) testTemplate = itemSchematic->getObjectTemplate(); } - while (testTemplate != nullptr) + while (testTemplate != NULL) { const std::string ingredientName(testTemplate->getName()); if (ingredientName == requiredIngredientName) @@ -1896,7 +1896,7 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde // this is a configureable setting const Crafting::ComponentIngredient * testComponent = dynamic_cast< const Crafting::ComponentIngredient *>(manfSlot.ingredients.front().get()); - if (testComponent != nullptr) + if (testComponent != NULL) { if (ConfigServerGame::getCraftingComponentStrict() && (slotOption->ingredientType != ServerIntangibleObjectTemplate::IT_templateGeneric && @@ -1909,15 +1909,15 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde else { // component from same template - if (factory == nullptr) + if (factory == NULL) { - if (ingredient->getObjectTemplateName() != nullptr && + if (ingredient->getObjectTemplateName() != NULL && ingredient->getObjectTemplateName() == testComponent->templateName) { slotOk = true; } } - else if (factory->getContainedTemplateName() != nullptr && + else if (factory->getContainedTemplateName() != NULL && factory->getContainedTemplateName() == testComponent->templateName) { slotOk = true; @@ -1927,7 +1927,7 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde } if (slotOk) { - if (factory == nullptr || factory->getCount() <= numIngredientsToAdd) + if (factory == NULL || factory->getCount() <= numIngredientsToAdd) { // adding normal component or a complete factory object if (manfSchematic->addIngredient(*ingredient)) @@ -1938,7 +1938,7 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde manfSchematic->setSlotOption(manfSlot.name, slotOptionIndex); manfSchematic->modifySlotComplexity(manfSlot.name, slotOption->complexity); } - if (factory == nullptr) + if (factory == NULL) { manfSchematic->addSlotComponent(manfSlot.name, *ingredient, slotOption->ingredientType); @@ -2014,7 +2014,7 @@ Crafting::CraftingError PlayerObject::emptySlot(int slotIndex, const NetworkId & UNREF(myIdString); // needed for release mode CreatureObject * const owner = getCreatureObject(); - if (owner == nullptr) + if (owner == NULL) return Crafting::CE_noOwner; if (getCraftingStage() != Crafting::CS_assembly && !m_allowEmptySlot) @@ -2024,7 +2024,7 @@ Crafting::CraftingError PlayerObject::emptySlot(int slotIndex, const NetworkId & } // check the draft schematic - if (m_draftSchematic.getPointer() == nullptr) + if (m_draftSchematic.getPointer() == NULL) { WARNING(true, ("Player %s trying to empty slot with no draft schematic!", myIdString)); return Crafting::CE_noDraftSchematic; @@ -2037,15 +2037,15 @@ Crafting::CraftingError PlayerObject::emptySlot(int slotIndex, const NetworkId & return Crafting::CE_noCraftingTool; } TangibleObject * const tool = safe_cast(getCraftingTool().getObject()); - if (tool == nullptr) + if (tool == NULL) { - WARNING(true, ("Player %s trying to empty slot with crafting tool %s, but tool is nullptr!", myIdString, getCraftingTool().getValueString().c_str())); + WARNING(true, ("Player %s trying to empty slot with crafting tool %s, but tool is NULL!", myIdString, getCraftingTool().getValueString().c_str())); return Crafting::CE_noCraftingTool; } // get the crafting station (if any) TangibleObject * station = dynamic_cast(getCraftingStation().getObject()); - if (station != nullptr && getCraftingLevel() == 3 && station->getIngredientHopper() == nullptr) + if (station != NULL && getCraftingLevel() == 3 && station->getIngredientHopper() == NULL) { WARNING_STRICT_FATAL(true, ("Player %s trying to empty crafting slot near " "a crafting station %s that has no ingredient hopper!", @@ -2055,7 +2055,7 @@ Crafting::CraftingError PlayerObject::emptySlot(int slotIndex, const NetworkId & } ServerObject * const inventory = owner->getInventory(); - if (inventory == nullptr) + if (inventory == NULL) { WARNING (true, ("Player %s has no inventory.", myIdString)); return Crafting::CE_noInventory; @@ -2077,7 +2077,7 @@ Crafting::CraftingError PlayerObject::emptySlot(int slotIndex, const NetworkId & // if we are crafting level 3, also check the crafting station's hopper if (!containerIsWorn && - (getCraftingLevel() != 3 || (station != nullptr && + (getCraftingLevel() != 3 || (station != NULL && !isNestedInContainer (targetContainerId, station->getIngredientHopper()->getNetworkId())))) { WARNING (true, ("Player %s attempted to empty slot into invalid container [%s].", myIdString, targetContainerId.getValueString().c_str())); @@ -2087,7 +2087,7 @@ Crafting::CraftingError PlayerObject::emptySlot(int slotIndex, const NetworkId & targetContainer = safe_cast(NetworkIdManager::getObjectById (targetContainerId)); - if (targetContainer == nullptr) + if (targetContainer == NULL) { WARNING (true, ("Player %s attempted to empty slot into non-existant container [%s].", myIdString, targetContainerId.getValueString ().c_str ())); return Crafting::CE_badTargetContainer; @@ -2102,7 +2102,7 @@ Crafting::CraftingError PlayerObject::emptySlot(int slotIndex, const NetworkId & // check the manufacturing schematic ManufactureSchematicObject * const manfSchematic = tool->getCraftingManufactureSchematic(); - if (manfSchematic == nullptr) + if (manfSchematic == NULL) { WARNING(true, ("Player %s trying to empty slot with no manufacturing schematic!", myIdString)); return Crafting::CE_noManfSchematic; @@ -2154,7 +2154,7 @@ Crafting::CraftingError PlayerObject::emptySlot(int slotIndex, const NetworkId & const Crafting::ComponentIngredient * const componentInfo = dynamic_cast((*iter).get()); NOT_NULL(componentInfo); TangibleObject * const component = manfSchematic->getComponent(*componentInfo); - if (component != nullptr) + if (component != NULL) { // move the component from the schematic to the player if (!manfSchematic->removeIngredient(*component, *targetContainer)) @@ -2180,7 +2180,7 @@ Crafting::CraftingError PlayerObject::emptySlot(int slotIndex, const NetworkId & { // ingredient is a resource VolumeContainer * const targetVolumeContainer = ContainerInterface::getVolumeContainer(*targetContainer); - if (targetVolumeContainer == nullptr) + if (targetVolumeContainer == NULL) { DEBUG_WARNING(true, ("PlayerObject::emptySlot: targetContainer %s does not have a volume container", targetContainer->getNetworkId().getValueString().c_str())); @@ -2203,7 +2203,7 @@ Crafting::CraftingError PlayerObject::emptySlot(int slotIndex, const NetworkId & { ResourceContainerObject * crate = dynamic_cast< ResourceContainerObject *>(NetworkIdManager::getObjectById((*iter2))); - if (crate != nullptr && crate->getResourceTypeId() == resourceId) + if (crate != NULL && crate->getResourceTypeId() == resourceId) { int emptySpace = crate->getMaxQuantity() - crate->getQuantity(); if (emptySpace > 0) @@ -2236,7 +2236,7 @@ Crafting::CraftingError PlayerObject::emptySlot(int slotIndex, const NetworkId & { ServerObject * crateObject = ServerWorld::createNewObject( crateTemplateName, *targetContainer, true); - if (crateObject == nullptr) + if (crateObject == NULL) { // @todo: inform the player DEBUG_WARNING(true, ("PlayerObject::emptySlot tried to " @@ -2322,14 +2322,14 @@ int PlayerObject::startCraftingExperiment () int i; CreatureObject * const owner = getCreatureObject(); - if (owner == nullptr) + if (owner == NULL) return -Crafting::CE_noOwner; std::string myId = getNetworkId().getValueString(); const char * myIdString = myId.c_str(); UNREF(myIdString); // needed for release mode - if (m_draftSchematic.getPointer() == nullptr) + if (m_draftSchematic.getPointer() == NULL) { DEBUG_WARNING(true, ("Player %s tried to start crafting experimentation with invalid schematic.", myIdString)); return -Crafting::CE_noDraftSchematic; @@ -2350,13 +2350,13 @@ int PlayerObject::startCraftingExperiment () if (!tool) { - DEBUG_WARNING(true, ("Player %s tried to start crafting experimentation with nullptr crafting tool [%s].", myIdString, getCraftingTool().getValueString().c_str())); + DEBUG_WARNING(true, ("Player %s tried to start crafting experimentation with null crafting tool [%s].", myIdString, getCraftingTool().getValueString().c_str())); return -Crafting::CE_noCraftingTool; } // check the manufacturing schematic ManufactureSchematicObject * const manfSchematic = tool->getCraftingManufactureSchematic(); - if (manfSchematic == nullptr) + if (manfSchematic == NULL) { DEBUG_WARNING(true, ("Player %s tried to start crafting experimentation with invalid manufacture schematic.", myIdString)); return -Crafting::CE_noManfSchematic; @@ -2425,7 +2425,7 @@ int PlayerObject::startCraftingExperiment () } ServerObject * prototype = tool->getCraftingPrototype(); - if (prototype == nullptr) + if (prototype == NULL) { DEBUG_WARNING(true, ("PlayerObject::startCraftingExperiment crafting " "tool %s has no prototype object!", @@ -2530,7 +2530,7 @@ int PlayerObject::startCraftingExperiment () Crafting::CraftingResult PlayerObject::experiment(const std::vector & experiments, int totalPoints, int corelevel) { CreatureObject * const owner = getCreatureObject(); - if (owner == nullptr) + if (owner == NULL) return Crafting::CR_internalFailure; std::string myId = getNetworkId().getValueString(); @@ -2554,7 +2554,7 @@ Crafting::CraftingResult PlayerObject::experiment(const std::vectorgetCraftingManufactureSchematic(); - if (manfSchematic == nullptr) + if (manfSchematic == NULL) { DEBUG_WARNING(true, ("Player %s tried to experiment with invalid " "manufacture schematic.", myIdString)); @@ -2577,7 +2577,7 @@ Crafting::CraftingResult PlayerObject::experiment(const std::vectorgetCraftingPrototype(); - if (prototype == nullptr) + if (prototype == NULL) { DEBUG_WARNING(true, ("Player %s tried to experiment with invalid test " "prototype.", myIdString)); @@ -2680,7 +2680,7 @@ bool PlayerObject::customize(int property, int value) const return false; } - if (m_draftSchematic.getPointer() == nullptr || getCraftingTool() == NetworkId::cms_invalid) + if (m_draftSchematic.getPointer() == NULL || getCraftingTool() == NetworkId::cms_invalid) { DEBUG_WARNING(true, ("Player %s tried to customize with invalid " "schematic or crafting tool.", myIdString)); @@ -2732,7 +2732,7 @@ int PlayerObject::setCustomizationData(const Unicode::String & name, return Crafting::CE_notCustomizeStage; } - if (m_draftSchematic.getPointer() == nullptr) + if (m_draftSchematic.getPointer() == NULL) { DEBUG_WARNING(true, ("Player %s tried to customize with invalid schematic.", myIdString)); return Crafting::CE_noDraftSchematic; @@ -2804,7 +2804,7 @@ int PlayerObject::setCustomizationData(const Unicode::String & name, bool PlayerObject::createPrototype(bool keepPrototype) { CreatureObject * const owner = getCreatureObject(); - if (owner == nullptr) + if (owner == NULL) return false; std::string myId = getNetworkId().getValueString(); @@ -2821,7 +2821,7 @@ bool PlayerObject::createPrototype(bool keepPrototype) return false; } - if (m_draftSchematic.getPointer() == nullptr || getCraftingTool() == NetworkId::cms_invalid) + if (m_draftSchematic.getPointer() == NULL || getCraftingTool() == NetworkId::cms_invalid) { DEBUG_WARNING(true, ("Player %s tried to create prototype with invalid " "schematic or crafting tool.", myIdString)); @@ -2842,7 +2842,7 @@ bool PlayerObject::createPrototype(bool keepPrototype) } ManufactureSchematicObject * const manfSchematic = tool->getCraftingManufactureSchematic(); - if (manfSchematic == nullptr) + if (manfSchematic == NULL) { WARNING_STRICT_FATAL(true, ("No manf schematic in crafting tool %s", tool->getNetworkId().getValueString().c_str())); @@ -2961,7 +2961,7 @@ bool PlayerObject::createPrototype(bool keepPrototype) params.addParam(prototype->getNetworkId(), "prototype"); ScriptDictionaryPtr dictionary; getScriptObject()->makeScriptDictionary(params, dictionary); - if (dictionary.get() != nullptr) + if (dictionary.get() != NULL) { dictionary->serialize(); @@ -2969,7 +2969,7 @@ bool PlayerObject::createPrototype(bool keepPrototype) { Client * client = owner->getClient(); - if (client != nullptr && client->isGod()) + if (client != NULL && client->isGod()) { Chat::sendSystemMessage(*owner, Unicode::narrowToWide("Crafting time changed due to god mode and crafting_qa objvar."), Unicode::emptyString); prototypeTime = 1; @@ -3022,7 +3022,7 @@ bool PlayerObject::createManufacturingSchematic() return false; CreatureObject * const owner = getCreatureObject(); - if (owner == nullptr) + if (owner == NULL) return false; // @todo: need to filter the name @@ -3034,7 +3034,7 @@ bool PlayerObject::createManufacturingSchematic() return false; } - if (m_draftSchematic.getPointer() == nullptr || getCraftingTool() == NetworkId::cms_invalid) + if (m_draftSchematic.getPointer() == NULL || getCraftingTool() == NetworkId::cms_invalid) { WARNING(true, ("Player %s tried to create manf schematic with invalid schematic or crafting tool.", getNetworkId().getValueString().c_str ())); return false; @@ -3048,19 +3048,19 @@ bool PlayerObject::createManufacturingSchematic() } TangibleObject * const tool = safe_cast(getCraftingTool().getObject()); - if (tool == nullptr) + if (tool == NULL) { WARNING_STRICT_FATAL(true, ("Could not find crafting tool during create manf schematic phase.")); return false; } ManufactureSchematicObject * const manfSchematic = tool->removeCraftingManufactureSchematic(); - if (manfSchematic == nullptr) + if (manfSchematic == NULL) { WARNING_STRICT_FATAL(true, ("Could not find manf schematic during create manf schematic phase.")); return false; } TangibleObject * const prototype = safe_cast(tool->getCraftingPrototype()); - if (prototype == nullptr) + if (prototype == NULL) { WARNING_STRICT_FATAL(true, ("Could not find prototype during create manf schematic phase.")); return false; @@ -3141,14 +3141,14 @@ bool PlayerObject::createManufacturingSchematic() manfSchematic->persist(); ServerObject * const datapad = owner->getDatapad (); - if (datapad == nullptr) + if (datapad == NULL) { DEBUG_WARNING(true, ("Can't find datapad for player %s", getAccountDescription().c_str())); return false; } Container::ContainerErrorCode tmp = Container::CEC_Success; - if (!ContainerInterface::transferItemToVolumeContainer(*datapad, *manfSchematic, nullptr, tmp)) + if (!ContainerInterface::transferItemToVolumeContainer(*datapad, *manfSchematic, NULL, tmp)) { return false; } @@ -3173,7 +3173,7 @@ bool PlayerObject::createManufacturingSchematic() bool PlayerObject::restartCrafting () { CreatureObject * const owner = getCreatureObject(); - if (owner == nullptr) + if (owner == NULL) return false; std::string myId = getNetworkId().getValueString(); @@ -3195,7 +3195,7 @@ bool PlayerObject::restartCrafting () } // verify the tool - if (m_draftSchematic.getPointer() == nullptr || getCraftingTool() == NetworkId::cms_invalid) + if (m_draftSchematic.getPointer() == NULL || getCraftingTool() == NetworkId::cms_invalid) { DEBUG_WARNING(true, ("Player %s tried to start crafting experimentation " "with invalid schematic or crafting tool.", myIdString)); @@ -3208,7 +3208,7 @@ bool PlayerObject::restartCrafting () // reset the manf schematic ManufactureSchematicObject * manfSchematic = tool->getCraftingManufactureSchematic(); - if (manfSchematic == nullptr) + if (manfSchematic == NULL) { DEBUG_WARNING(true, ("Player %s has no manufacturing schematic!", myIdString)); return false; @@ -3262,21 +3262,21 @@ void PlayerObject::stopCrafting (bool normalExit) { CreatureObject * const owner = getCreatureObject(); - if (getCraftingTool().getObject() != nullptr) + if (getCraftingTool().getObject() != NULL) { TangibleObject * tool = dynamic_cast(getCraftingTool().getObject()); - if (tool != nullptr) + if (tool != NULL) { IGNORE_RETURN(tool->stopCraftingSession()); } // tell scripts that the session has ended ScriptParams params; - if (owner != nullptr) + if (owner != NULL) params.addParam(owner->getNetworkId()); else params.addParam(getNetworkId()); - if (getCurrentDraftSchematic() != nullptr) + if (getCurrentDraftSchematic() != NULL) params.addParam(getCurrentDraftSchematic()->getTemplateName()); else params.addParam(""); @@ -3292,7 +3292,7 @@ void PlayerObject::stopCrafting (bool normalExit) m_craftingComponentBioLink = NetworkId::cms_invalid; // tell the player crafting has ended - if (owner != nullptr && owner->getController() != nullptr) + if (owner != NULL && owner->getController() != NULL) { (safe_cast(owner->getController()))->appendMessage( static_cast(CM_craftingSessionEnded), 0.0f, @@ -3348,7 +3348,7 @@ void PlayerObject::requestFriendList() const { CreatureObject const *owner = safe_cast(ContainerInterface::getContainedByObject(*this)); - if (owner != nullptr) + if (owner != NULL) { ChatAvatarId chatAvatarId(Chat::constructChatAvatarId(*owner)); @@ -3410,7 +3410,7 @@ void PlayerObject::requestIgnoreList() const { CreatureObject const *owner = safe_cast(ContainerInterface::getContainedByObject(*this)); - if (owner != nullptr) + if (owner != NULL) { ChatAvatarId chatAvatarId(Chat::constructChatAvatarId(*owner)); @@ -3767,7 +3767,7 @@ void PlayerObject::setTitle(std::string const &title) m_skillTitle = title; } } - else if (title.empty() || (title == "citizenship") || (SkillManager::getInstance().getSkill(title) != nullptr) || (CollectionsDataTable::isASlotTitle(title) != nullptr) || (CollectionsDataTable::isACollectionTitle(title) != nullptr) || (CollectionsDataTable::isAPageTitle(title) != nullptr) || (GuildRankDataTable::isARankTitle(title) != nullptr) || (CitizenRankDataTable::isARankTitle(title) != nullptr)) + else if (title.empty() || (title == "citizenship") || (SkillManager::getInstance().getSkill(title) != NULL) || (CollectionsDataTable::isASlotTitle(title) != NULL) || (CollectionsDataTable::isACollectionTitle(title) != NULL) || (CollectionsDataTable::isAPageTitle(title) != NULL) || (GuildRankDataTable::isARankTitle(title) != NULL) || (CitizenRankDataTable::isARankTitle(title) != NULL)) { if (title != m_skillTitle.get()) m_skillTitle = title; @@ -4075,7 +4075,7 @@ void PlayerObject::handleCMessageTo(const MessageToPayload &message) } { - BiographyManager::requestBiography(owner->getNetworkId(), nullptr); + BiographyManager::requestBiography(owner->getNetworkId(), NULL); } bool needsTitleCheck = false; @@ -4139,7 +4139,7 @@ void PlayerObject::handleCMessageTo(const MessageToPayload &message) // also check to see if the citizen rank has changed, and if so, update the citizen rank information { std::vector const & cityIds = CityInterface::getCitizenOfCityId(owner->getNetworkId()); - CitizenInfo const * const citizenInfo = (!cityIds.empty() ? CityInterface::getCitizenInfo(cityIds.front(), owner->getNetworkId()) : nullptr); + CitizenInfo const * const citizenInfo = (!cityIds.empty() ? CityInterface::getCitizenInfo(cityIds.front(), owner->getNetworkId()) : NULL); if (!citizenInfo) { // not a citizen, so make sure the citizen rank is empty @@ -4265,12 +4265,12 @@ void PlayerObject::endBaselines() const CreatureObject * owner = safe_cast(ContainerInterface::getContainedByObject(*this)); - if (owner != nullptr) + if (owner != NULL) { SharedCreatureObjectTemplate::Species const species = owner->getSpecies(); setSpokenLanguage(GameLanguageManager::getStartingLanguage(species)); -// if (owner->isAuthoritative() && ServerUniverse::getInstance().getXpManager() != nullptr) +// if (owner->isAuthoritative() && ServerUniverse::getInstance().getXpManager() != NULL) // { // // get any xp we earned while offline // ServerUniverse::getInstance().getXpManager()->requestXp(*this); @@ -4326,7 +4326,7 @@ void PlayerObject::endBaselines() } else { - m_chatSpamTimeEndInterval = static_cast(::time(nullptr)) + (ConfigServerGame::getChatSpamLimiterIntervalMinutes() * 60); + m_chatSpamTimeEndInterval = static_cast(::time(NULL)) + (ConfigServerGame::getChatSpamLimiterIntervalMinutes() * 60); m_chatSpamSpatialNumCharacters = 0; m_chatSpamNonSpatialNumCharacters = 0; m_chatSpamNextTimeToSyncWithChatServer = 0; @@ -4362,7 +4362,7 @@ void PlayerObject::endBaselines() { m_squelchedById = tempNetworkId; m_squelchedByName = tempString; - m_squelchExpireTime = static_cast(::time(nullptr)) + (temp - gameTimeNow); + m_squelchExpireTime = static_cast(::time(NULL)) + (temp - gameTimeNow); } } } @@ -4373,7 +4373,7 @@ void PlayerObject::endBaselines() DynamicVariableList::NestedList const gcwContribution(getObjVars(), "gcwContributionTracking"); if (!gcwContribution.empty()) { - int const timeExpired = static_cast(::time(nullptr)) - (60 * 60 * 24 * 30); // 30 days + int const timeExpired = static_cast(::time(NULL)) - (60 * 60 * 24 * 30); // 30 days std::list gcwContributionToRemove; int timeLastContributed; for (DynamicVariableList::NestedList::const_iterator i = gcwContribution.begin(); i != gcwContribution.end(); ++i) @@ -4724,12 +4724,12 @@ std::string PlayerObject::getAccountDescription() const { const ServerObject * owner = safe_cast( ContainerInterface::getContainedByObject(*this)); - if (owner == nullptr) + if (owner == NULL) return "UNKNOWN"; bool isGod = false; bool isSecure = false; - Client * client = nullptr; + Client * client = NULL; if (owner && owner->getClient()) { client = owner->getClient(); @@ -4768,7 +4768,7 @@ std::string PlayerObject::getAccountDescription() const void PlayerObject::logChat(int const logIndex) { - if (m_chatLog != nullptr) + if (m_chatLog != NULL) { time_t const logTime = Os::getRealSystemTime(); @@ -5276,10 +5276,10 @@ void PlayerObject::checkTheater(const Vector & pos, const std::string & scene, IntangibleObject * theater = IntangibleObject::spawnTheater(m_theaterDatatable.get(), m_theaterPosition.get(), m_theaterScript.get(), static_cast(m_theaterLocationType.get())); - if (theater != nullptr) + if (theater != NULL) { const CreatureObject * owner = getCreatureObject(); - if (owner != nullptr) + if (owner != NULL) theater->setPlayer(*owner); theater->setTheaterCreator(m_theaterCreator.get()); if (!theater->setTheaterName(m_theaterName.get())) @@ -5287,10 +5287,10 @@ void PlayerObject::checkTheater(const Vector & pos, const std::string & scene, WARNING(true, ("PlayerObject::checkTheater could not create " "theater with name %s", m_theaterName.get().c_str())); theater->permanentlyDestroy(DeleteReasons::SetupFailed); - theater = nullptr; + theater = NULL; } } - if (theater == nullptr) + if (theater == NULL) { CreatureObject * creatureObject = getCreatureObject(); if (creatureObject) @@ -5357,7 +5357,7 @@ bool PlayerObject::setTheater(const std::string & datatable, const Vector & posi return false; } - if (ServerUniverse::getInstance().getPlanetByName(scene) == nullptr) + if (ServerUniverse::getInstance().getPlanetByName(scene) == NULL) { WARNING(true, ("PlayerObject::setTheater called with invalid scene %s", scene.c_str())); @@ -6342,7 +6342,7 @@ unsigned long PlayerObject::getSessionPlayTimeDuration() const time_t const sessionStartPlayTime = static_cast(m_sessionStartPlayTime.get()); if (sessionStartPlayTime > 0) { - time_t const now = ::time(nullptr); + time_t const now = ::time(NULL); if (now > sessionStartPlayTime) return static_cast(now - sessionStartPlayTime); } @@ -6359,7 +6359,7 @@ unsigned long PlayerObject::getSessionActivePlayTimeDuration() const time_t const sessionLastActiveTime = static_cast(m_sessionLastActiveTime.get()); if (sessionLastActiveTime > 0) { - time_t const now = ::time(nullptr); + time_t const now = ::time(NULL); if (now > sessionLastActiveTime) activePlayTimeDuration += static_cast(now - sessionLastActiveTime); } @@ -6393,7 +6393,7 @@ void PlayerObject::setSessionPlayTimeInfo(int32 sessionStartPlayTime, int32 sess ServerUniverse::setConnectedCharacterLfgData(owner->getNetworkId(), lfgCharacterData); - BiographyManager::requestBiography(owner->getNetworkId(), nullptr); + BiographyManager::requestBiography(owner->getNetworkId(), NULL); // check/set "account age" title checkAndSetAccountAgeTitle(*this); @@ -7040,7 +7040,7 @@ void PlayerObject::modifyNextGcwRatingCalcTime(int const weekCount) return; static int32 const max = std::numeric_limits::max(); - int32 const now = static_cast(::time(nullptr)); + int32 const now = static_cast(::time(NULL)); // m_nextGcwRatingCalcTime should always be >= 0 int32 const currentValue = std::max(static_cast(0), m_nextGcwRatingCalcTime.get()); @@ -7176,7 +7176,7 @@ void PlayerObject::setNextGcwRatingCalcTime(bool const alwaysSendMessageToForRec return; bool needToSendMessageTo = alwaysSendMessageToForRecalc; - int32 const now = static_cast(::time(nullptr)); + int32 const now = static_cast(::time(NULL)); // if the player needs a rating recalculation, // make sure that m_nextGcwRatingCalcTime is set so that the @@ -7232,7 +7232,7 @@ void PlayerObject::handleRecalculateGcwRating() return; // is it time to recalculate? - int32 const now = static_cast(::time(nullptr)); + int32 const now = static_cast(::time(NULL)); if ((m_nextGcwRatingCalcTime.get() > 0) && (m_nextGcwRatingCalcTime.get() <= now)) { // is recalculation required? @@ -7367,7 +7367,7 @@ void PlayerObject::sendRecalculateGcwRatingMessageTo(int delay) // send new messageTo int const adjustedDelay = std::max(5, delay); MessageToQueue::getInstance().sendMessageToC(getNetworkId(), "C++RecalculateGcwRating", "", adjustedDelay, false); - m_gcwRatingActualCalcTime = static_cast(::time(nullptr) + adjustedDelay); + m_gcwRatingActualCalcTime = static_cast(::time(NULL) + adjustedDelay); } // ---------------------------------------------------------------------- @@ -7728,7 +7728,7 @@ bool PlayerObject::getCollectionSlotValue(CollectionsDataTable::CollectionInfoSl // ---------------------------------------------------------------------- -bool PlayerObject::hasCompletedCollectionSlotPrereq(std::string const & slotName, std::vector * collectionInfo /*= nullptr*/) const +bool PlayerObject::hasCompletedCollectionSlotPrereq(std::string const & slotName, std::vector * collectionInfo /*= NULL*/) const { CollectionsDataTable::CollectionInfoSlot const * slotInfo = CollectionsDataTable::getSlotByName(slotName); if (!slotInfo) @@ -7742,7 +7742,7 @@ bool PlayerObject::hasCompletedCollectionSlotPrereq(std::string const & slotName // ---------------------------------------------------------------------- -bool PlayerObject::hasCompletedCollectionSlotPrereq(CollectionsDataTable::CollectionInfoSlot const & slotInfo, std::vector * collectionInfo /*= nullptr*/) const +bool PlayerObject::hasCompletedCollectionSlotPrereq(CollectionsDataTable::CollectionInfoSlot const & slotInfo, std::vector * collectionInfo /*= NULL*/) const { if (collectionInfo) collectionInfo->clear(); @@ -7862,7 +7862,7 @@ bool PlayerObject::hasCompletedCollectionBook(std::string const & bookName) cons // ---------------------------------------------------------------------- -int PlayerObject::getCompletedCollectionSlotCountInCollection(std::string const & collectionName, stdvector::fwd * collectionInfo /*= nullptr*/) const +int PlayerObject::getCompletedCollectionSlotCountInCollection(std::string const & collectionName, stdvector::fwd * collectionInfo /*= NULL*/) const { if (collectionInfo) collectionInfo->clear(); @@ -7885,7 +7885,7 @@ int PlayerObject::getCompletedCollectionSlotCountInCollection(std::string const // ---------------------------------------------------------------------- -int PlayerObject::getCompletedCollectionSlotCountInPage(std::string const & pageName, std::vector * collectionInfo /*= nullptr*/) const +int PlayerObject::getCompletedCollectionSlotCountInPage(std::string const & pageName, std::vector * collectionInfo /*= NULL*/) const { if (collectionInfo) collectionInfo->clear(); @@ -7908,7 +7908,7 @@ int PlayerObject::getCompletedCollectionSlotCountInPage(std::string const & page // ---------------------------------------------------------------------- -int PlayerObject::getCompletedCollectionCountInPage(std::string const & pageName, std::vector * collectionInfo /*= nullptr*/) const +int PlayerObject::getCompletedCollectionCountInPage(std::string const & pageName, std::vector * collectionInfo /*= NULL*/) const { if (collectionInfo) collectionInfo->clear(); @@ -7931,7 +7931,7 @@ int PlayerObject::getCompletedCollectionCountInPage(std::string const & pageName // ---------------------------------------------------------------------- -int PlayerObject::getCompletedCollectionSlotCountInBook(std::string const & bookName, std::vector * collectionInfo /*= nullptr*/) const +int PlayerObject::getCompletedCollectionSlotCountInBook(std::string const & bookName, std::vector * collectionInfo /*= NULL*/) const { if (collectionInfo) collectionInfo->clear(); @@ -7954,7 +7954,7 @@ int PlayerObject::getCompletedCollectionSlotCountInBook(std::string const & book // ---------------------------------------------------------------------- -int PlayerObject::getCompletedCollectionCountInBook(std::string const & bookName, std::vector * collectionInfo /*= nullptr*/) const +int PlayerObject::getCompletedCollectionCountInBook(std::string const & bookName, std::vector * collectionInfo /*= NULL*/) const { if (collectionInfo) collectionInfo->clear(); @@ -7977,7 +7977,7 @@ int PlayerObject::getCompletedCollectionCountInBook(std::string const & bookName // ---------------------------------------------------------------------- -int PlayerObject::getCompletedCollectionPageCountInBook(std::string const & bookName, std::vector * collectionInfo /*= nullptr*/) const +int PlayerObject::getCompletedCollectionPageCountInBook(std::string const & bookName, std::vector * collectionInfo /*= NULL*/) const { if (collectionInfo) collectionInfo->clear(); @@ -8000,7 +8000,7 @@ int PlayerObject::getCompletedCollectionPageCountInBook(std::string const & book // ---------------------------------------------------------------------- -int PlayerObject::getCompletedCollectionBookCount(std::vector * collectionInfo /*= nullptr*/) const +int PlayerObject::getCompletedCollectionBookCount(std::vector * collectionInfo /*= NULL*/) const { if (collectionInfo) collectionInfo->clear(); @@ -8103,7 +8103,7 @@ void PlayerObject::updateChatSpamSpatialNumCharacters(NetworkId const & characte if (!isAuthoritative()) return; - int const timeNow = static_cast(::time(nullptr)); + int const timeNow = static_cast(::time(NULL)); bool syncChatServer = false; // new interval, reset @@ -8125,7 +8125,7 @@ void PlayerObject::updateChatSpamSpatialNumCharacters(NetworkId const & characte { time_t timeUnsquelch = static_cast(getSecondsUntilUnsquelched()); if (timeUnsquelch > 0) - timeUnsquelch += ::time(nullptr); + timeUnsquelch += ::time(NULL); GenericValueTypeMessage, int>, std::pair > > chatStatistics("ChatStatisticsGS", std::make_pair(std::make_pair(std::make_pair(character, static_cast(timeUnsquelch)), m_chatSpamTimeEndInterval.get()), std::make_pair(m_chatSpamSpatialNumCharacters.get(), m_chatSpamNonSpatialNumCharacters.get()))); Chat::sendToChatServer(chatStatistics); @@ -8140,7 +8140,7 @@ void PlayerObject::handleChatStatisticsFromChatServer(NetworkId const & characte if (!isAuthoritative()) return; - int const timeNow = static_cast(::time(nullptr)); + int const timeNow = static_cast(::time(NULL)); bool syncChatServer = false; // new interval, reset @@ -8168,7 +8168,7 @@ void PlayerObject::handleChatStatisticsFromChatServer(NetworkId const & characte { time_t timeUnsquelch = static_cast(getSecondsUntilUnsquelched()); if (timeUnsquelch > 0) - timeUnsquelch += ::time(nullptr); + timeUnsquelch += ::time(NULL); GenericValueTypeMessage, int>, std::pair > > chatStatistics("ChatStatisticsGS", std::make_pair(std::make_pair(std::make_pair(character, static_cast(timeUnsquelch)), m_chatSpamTimeEndInterval.get()), std::make_pair(m_chatSpamSpatialNumCharacters.get(), m_chatSpamNonSpatialNumCharacters.get()))); Chat::sendToChatServer(chatStatistics); @@ -8274,7 +8274,7 @@ void PlayerObject::updateGcwDefenderRegionInfo() cityGcwDefenderRegion = gcwDefenderRegion; int const timeJoinedGcwDefenderRegion = cityInfo.getTimeJoinedGcwDefenderRegion(); - timeQualifyForBonus = static_cast(::time(nullptr)) - (ConfigServerGame::getGcwDaysRequiredForGcwRegionDefenderBonus() * 86400); + timeQualifyForBonus = static_cast(::time(NULL)) - (ConfigServerGame::getGcwDaysRequiredForGcwRegionDefenderBonus() * 86400); if (!PvpData::isNeutralFactionId(cityFaction) && (cityFaction == owner->getPvpFaction()) && (timeJoinedGcwDefenderRegion < timeQualifyForBonus)) { cityGcwDefenderRegionHasBonus = true; @@ -8316,7 +8316,7 @@ void PlayerObject::updateGcwDefenderRegionInfo() int const timeJoinedGcwDefenderRegion = GuildInterface::getTimeJoinedGuildCurrentGcwDefenderRegion(*gi); if (timeQualifyForBonus < 0) - timeQualifyForBonus = static_cast(::time(nullptr)) - (ConfigServerGame::getGcwDaysRequiredForGcwRegionDefenderBonus() * 86400); + timeQualifyForBonus = static_cast(::time(NULL)) - (ConfigServerGame::getGcwDaysRequiredForGcwRegionDefenderBonus() * 86400); if (!PvpData::isNeutralFactionId(guildFaction) && (guildFaction == owner->getPvpFaction()) && (timeJoinedGcwDefenderRegion < timeQualifyForBonus)) { @@ -8417,7 +8417,7 @@ void PlayerObject::squelch(NetworkId const & squelchedById, std::string const & } else { - m_squelchExpireTime = static_cast(::time(nullptr)) + squelchDurationSeconds; + m_squelchExpireTime = static_cast(::time(NULL)) + squelchDurationSeconds; // persist squelch info setObjVarItem(OBJVAR_SQUELCH_EXPIRE, static_cast(ServerClock::getInstance().getGameTimeSeconds()) + squelchDurationSeconds); @@ -8466,7 +8466,7 @@ void PlayerObject::unsquelch() { CreatureObject * const owner = getCreatureObject(); if (owner) - owner->sendControllerMessageToAuthServer(CM_unsquelch, nullptr); + owner->sendControllerMessageToAuthServer(CM_unsquelch, NULL); } } @@ -8482,7 +8482,7 @@ int PlayerObject::getSecondsUntilUnsquelched() if (m_squelchExpireTime.get() < 0) // squelched indefinitely return -1; - int32 const timeNow = static_cast(::time(nullptr)); + int32 const timeNow = static_cast(::time(NULL)); if (timeNow < m_squelchExpireTime.get()) // still in squelch period return (m_squelchExpireTime.get() - timeNow); @@ -8570,7 +8570,7 @@ void PlayerObject::setAccountNumLotsOverLimitSpam() { m_accountNumLotsOverLimitSpam = m_accountNumLots.get() - owner->getMaxNumberOfLots(); - int const timeNow = static_cast(::time(nullptr)); + int const timeNow = static_cast(::time(NULL)); int violationTime = 0; if (!owner->getObjVars().getItem("lotOverlimit.violation_time", violationTime)) { @@ -9010,7 +9010,7 @@ void PlayerObjectNamespace::grantGcwFactionalPresenceScore(std::string const & g // // for space, give bonus if the player's citizenship city is on the // corresponding ground planet and is the same faction as the player - CityInfo const * ci = nullptr; + CityInfo const * ci = NULL; if (!ServerWorld::isSpaceScene()) { Vector const creaturePosition = co.findPosition_w(); @@ -9132,7 +9132,7 @@ void PlayerObjectNamespace::grantGcwFactionalPresenceScore(std::string const & g playerCitySpaceZone = std::string("space_") + playerCityPlanet; if (playerCitySpaceZone != ServerWorld::getSceneId()) - ci = nullptr; + ci = NULL; } } @@ -9155,7 +9155,7 @@ void PlayerObjectNamespace::grantGcwFactionalPresenceScore(std::string const & g bonus += (cityRank * ConfigServerGame::getGcwFactionalPresenceAlignedCityRankBonusPct()); if (ci->getCreationTime() > 0) - bonus += std::max(0, (static_cast(::time(nullptr)) - std::max(1041408000, ci->getCreationTime())) / 31536000 * ConfigServerGame::getGcwFactionalPresenceAlignedCityAgeBonusPct()); + bonus += std::max(0, (static_cast(::time(NULL)) - std::max(1041408000, ci->getCreationTime())) / 31536000 * ConfigServerGame::getGcwFactionalPresenceAlignedCityAgeBonusPct()); } } diff --git a/engine/server/library/serverGame/src/shared/object/PlayerObject.h b/engine/server/library/serverGame/src/shared/object/PlayerObject.h index da5386d8..2298e6bd 100755 --- a/engine/server/library/serverGame/src/shared/object/PlayerObject.h +++ b/engine/server/library/serverGame/src/shared/object/PlayerObject.h @@ -361,8 +361,8 @@ public: bool getCollectionSlotValue(std::string const & slotName, unsigned long & value) const; bool getCollectionSlotValue(CollectionsDataTable::CollectionInfoSlot const & slotInfo, unsigned long & value) const; - bool hasCompletedCollectionSlotPrereq(std::string const & slotName, stdvector::fwd * collectionInfo = nullptr) const; - bool hasCompletedCollectionSlotPrereq(CollectionsDataTable::CollectionInfoSlot const & slotInfo, stdvector::fwd * collectionInfo = nullptr) const; + bool hasCompletedCollectionSlotPrereq(std::string const & slotName, stdvector::fwd * collectionInfo = NULL) const; + bool hasCompletedCollectionSlotPrereq(CollectionsDataTable::CollectionInfoSlot const & slotInfo, stdvector::fwd * collectionInfo = NULL) const; bool hasCompletedCollectionSlot(std::string const & slotName) const; bool hasCompletedCollectionSlot(CollectionsDataTable::CollectionInfoSlot const & slotInfo) const; @@ -374,15 +374,15 @@ public: bool hasCompletedCollectionBook(std::string const & bookName) const; - int getCompletedCollectionSlotCountInCollection(std::string const & collectionName, stdvector::fwd * collectionInfo = nullptr) const; + int getCompletedCollectionSlotCountInCollection(std::string const & collectionName, stdvector::fwd * collectionInfo = NULL) const; - int getCompletedCollectionSlotCountInPage(std::string const & pageName, stdvector::fwd * collectionInfo = nullptr) const; - int getCompletedCollectionCountInPage(std::string const & pageName, stdvector::fwd * collectionInfo = nullptr) const; + int getCompletedCollectionSlotCountInPage(std::string const & pageName, stdvector::fwd * collectionInfo = NULL) const; + int getCompletedCollectionCountInPage(std::string const & pageName, stdvector::fwd * collectionInfo = NULL) const; - int getCompletedCollectionSlotCountInBook(std::string const & bookName, stdvector::fwd * collectionInfo = nullptr) const; - int getCompletedCollectionCountInBook(std::string const & bookName, stdvector::fwd * collectionInfo = nullptr) const; - int getCompletedCollectionPageCountInBook(std::string const & bookName, stdvector::fwd * collectionInfo = nullptr) const; - int getCompletedCollectionBookCount(stdvector::fwd * collectionInfo = nullptr) const; + int getCompletedCollectionSlotCountInBook(std::string const & bookName, stdvector::fwd * collectionInfo = NULL) const; + int getCompletedCollectionCountInBook(std::string const & bookName, stdvector::fwd * collectionInfo = NULL) const; + int getCompletedCollectionPageCountInBook(std::string const & bookName, stdvector::fwd * collectionInfo = NULL) const; + int getCompletedCollectionBookCount(stdvector::fwd * collectionInfo = NULL) const; void migrateLegacyBadgesToCollection(stdvector::fwd const & badges); diff --git a/engine/server/library/serverGame/src/shared/object/PlayerQuestObject.cpp b/engine/server/library/serverGame/src/shared/object/PlayerQuestObject.cpp index dca33824..54e63df9 100755 --- a/engine/server/library/serverGame/src/shared/object/PlayerQuestObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/PlayerQuestObject.cpp @@ -27,7 +27,7 @@ //----------------------------------------------------------------------- -const SharedObjectTemplate * PlayerQuestObject::m_defaultSharedTemplate = nullptr; +const SharedObjectTemplate * PlayerQuestObject::m_defaultSharedTemplate = NULL; namespace PlayerQuestObjectNamespace { @@ -156,7 +156,7 @@ void PlayerQuestObject::removeDefaultTemplate() if(m_defaultSharedTemplate) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = nullptr; + m_defaultSharedTemplate = NULL; } } diff --git a/engine/server/library/serverGame/src/shared/object/ResourceContainerObject.cpp b/engine/server/library/serverGame/src/shared/object/ResourceContainerObject.cpp index 398adf07..9b47248b 100755 --- a/engine/server/library/serverGame/src/shared/object/ResourceContainerObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/ResourceContainerObject.cpp @@ -27,7 +27,7 @@ // ====================================================================== -const SharedObjectTemplate * ResourceContainerObject::m_defaultSharedTemplate = nullptr; +const SharedObjectTemplate * ResourceContainerObject::m_defaultSharedTemplate = NULL; namespace ResourceContainerObjectNamespace { @@ -66,11 +66,11 @@ const SharedObjectTemplate * ResourceContainerObject::getDefaultSharedTemplate(v { static const ConstCharCrcLowerString templateName("object/resource_container/base/shared_resource_container_default.iff"); - if (m_defaultSharedTemplate == nullptr) + if (m_defaultSharedTemplate == NULL) { m_defaultSharedTemplate = safe_cast(ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != nullptr) + WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create default shared object template %s", templateName.getString())); + if (m_defaultSharedTemplate != NULL) ExitChain::add (removeDefaultTemplate, "ResourceContainerObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -83,10 +83,10 @@ const SharedObjectTemplate * ResourceContainerObject::getDefaultSharedTemplate(v */ void ResourceContainerObject::removeDefaultTemplate(void) { - if (m_defaultSharedTemplate != nullptr) + if (m_defaultSharedTemplate != NULL) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = nullptr; + m_defaultSharedTemplate = NULL; } } // ResourceContainerObject::removeDefaultTemplate @@ -398,7 +398,7 @@ bool ResourceContainerObject::transferTo(ResourceContainerObject &destination, i * @param destContainer The container into which the new ResourceContainer should be placed, or cms_Invalid if no container * @param arrangementId -1 If destContainer is not slotted, otherwise the ID of the arrangement to use * @param newLocation The coordinates at which to place the new ResourceContainer. (Ignored if it is going into a non-positional container.) - * @param actor The player making the split, or nullptr + * @param actor The player making the split, or NULL */ bool ResourceContainerObject::splitContainer(int amount, const CachedNetworkId &destContainer, int arrangementId, const Vector &newLocation, ServerObject *actor) @@ -407,7 +407,7 @@ bool ResourceContainerObject::splitContainer(int amount, const CachedNetworkId & bool result = false; - ResourceContainerObject *newCrate = nullptr; + ResourceContainerObject *newCrate = NULL; if (destContainer == CachedNetworkId::cms_cachedInvalid) { @@ -420,7 +420,7 @@ bool ResourceContainerObject::splitContainer(int amount, const CachedNetworkId & { // create in volume container ServerObject * destObject = safe_cast(destContainer.getObject()); - if (destObject == nullptr) + if (destObject == NULL) return false; newCrate = dynamic_cast(ServerWorld::createNewObject(getObjectTemplateName(), *destObject, isPersisted())); } @@ -428,10 +428,10 @@ bool ResourceContainerObject::splitContainer(int amount, const CachedNetworkId & { // create in slotted container ServerObject * destObject = safe_cast(destContainer.getObject()); - if (destObject == nullptr) + if (destObject == NULL) return false; const SlottedContainmentProperty* containmentProperty = ContainerInterface::getSlottedContainmentProperty(*destObject); - if (containmentProperty == nullptr) + if (containmentProperty == NULL) return false; const SlottedContainmentProperty::SlotArrangement & slots = containmentProperty->getSlotArrangement(arrangementId); if (slots.empty()) diff --git a/engine/server/library/serverGame/src/shared/object/ResourcePoolObject.cpp b/engine/server/library/serverGame/src/shared/object/ResourcePoolObject.cpp index 82e2a710..c5efc41b 100755 --- a/engine/server/library/serverGame/src/shared/object/ResourcePoolObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/ResourcePoolObject.cpp @@ -30,7 +30,7 @@ ResourcePoolObject::ResourcePoolObject(ResourceTypeObject const & resourceType, m_fractalData(resourceType.getFractalData()), m_fractalSeed(fractalSeed), m_depletedTimestamp(resourceType.getDepletedTimestamp()), - m_efficiencyMap(nullptr) + m_efficiencyMap(NULL) { } @@ -39,7 +39,7 @@ ResourcePoolObject::ResourcePoolObject(ResourceTypeObject const & resourceType, ResourcePoolObject::~ResourcePoolObject() { delete m_efficiencyMap; - m_efficiencyMap=nullptr; + m_efficiencyMap=NULL; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/object/ResourceTypeObject.cpp b/engine/server/library/serverGame/src/shared/object/ResourceTypeObject.cpp index d0b9123a..536c4e4f 100755 --- a/engine/server/library/serverGame/src/shared/object/ResourceTypeObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/ResourceTypeObject.cpp @@ -146,7 +146,7 @@ void ResourceTypeObject::setName(const std::string &newName) ResourcePoolObject *ResourceTypeObject::getPoolForPlanet(PlanetObject const &planetObject) const { if (isRecycled()) - return nullptr; + return NULL; std::map::const_iterator i=m_pools.find(planetObject.getNetworkId()); if (i==m_pools.end()) @@ -167,7 +167,7 @@ ResourcePoolObject *ResourceTypeObject::getPoolForPlanet(PlanetObject const &pla m_pools[planetObject.getNetworkId()]=obj; return obj; } - return nullptr; // no pool for this planet + return NULL; // no pool for this planet } } else @@ -377,7 +377,7 @@ ResourceTypeObject const * ResourceTypeObject::getRecycledVersion() const return result; } else - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -437,7 +437,7 @@ NetworkId ResourceTypeObject::addImportedResourceType(std::string const & resour static Unicode::String const attributeDelimiters(Unicode::narrowToWide(" ")); Unicode::UnicodeStringVector tokens; static size_t const resourceAttributeIndex = 5; - if ((Unicode::tokenize(Unicode::narrowToWide(resourceData), tokens, &delimiters, nullptr)) && (tokens.size() > resourceAttributeIndex)) + if ((Unicode::tokenize(Unicode::narrowToWide(resourceData), tokens, &delimiters, NULL)) && (tokens.size() > resourceAttributeIndex)) { AddResourceTypeMessageNamespace::ResourceTypeData rtd; rtd.m_depletedTimestamp = 1; @@ -453,7 +453,7 @@ NetworkId ResourceTypeObject::addImportedResourceType(std::string const & resour for (size_t i = resourceAttributeIndex; i < tokens.size(); ++i) { attributeTokens.clear(); - if ((Unicode::tokenize(tokens[i], attributeTokens, &attributeDelimiters, nullptr)) && (attributeTokens.size() == 2)) + if ((Unicode::tokenize(tokens[i], attributeTokens, &attributeDelimiters, NULL)) && (attributeTokens.size() == 2)) { rtd.m_attributes.push_back(std::make_pair(Unicode::wideToNarrow(attributeTokens[0]), ::atoi(Unicode::wideToNarrow(attributeTokens[1]).c_str()))); } diff --git a/engine/server/library/serverGame/src/shared/object/ServerObject.cpp b/engine/server/library/serverGame/src/shared/object/ServerObject.cpp index e96fc5b1..d2598408 100755 --- a/engine/server/library/serverGame/src/shared/object/ServerObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/ServerObject.cpp @@ -507,7 +507,7 @@ using namespace ServerObjectNamespace; // ====================================================================== -const SharedObjectTemplate * ServerObject::m_defaultSharedTemplate = nullptr; +const SharedObjectTemplate * ServerObject::m_defaultSharedTemplate = NULL; float ServerObject::ms_buildingUpdateRadiusMultiplier = 0; // ====================================================================== @@ -691,7 +691,7 @@ void ServerObject::ObserversCountCallback::modified(ServerObject &target, int ol ServerObject::ServerObject(const ServerObjectTemplate* newTemplate, const ObjectNotification ¬ification, bool const hyperspaceOnCreate) : Object (newTemplate, NetworkId::cms_invalid), m_oldPosition (), -m_sharedTemplate (nullptr), +m_sharedTemplate (NULL), m_client (0), m_observers (), m_localFlags (0), @@ -732,7 +732,7 @@ m_serverPackage (), m_serverPackage_np (), m_sharedPackage (), m_sharedPackage_np (), -m_networkUpdateFar (nullptr), +m_networkUpdateFar (NULL), m_triggerVolumes (), m_attributesAttained (), m_attributesInterested (), @@ -765,13 +765,13 @@ m_loadCTSPackedHouses(false) const std::string & sharedTemplateName = newTemplate->getSharedTemplate(); m_sharedTemplate = dynamic_cast(ObjectTemplateList::fetch(sharedTemplateName)); - if (m_sharedTemplate == nullptr) + if (m_sharedTemplate == NULL) { WARNING_STRICT_FATAL(!sharedTemplateName.empty(), ("Template %s has an invalid shared template %s. We will use the default shared template for now.", newTemplate->getName(), sharedTemplateName.c_str())); } - if (getSharedTemplate() != nullptr) + if (getSharedTemplate() != NULL) { m_nameStringId = getSharedTemplate()->getObjectName(); m_descriptionStringId = getSharedTemplate()->getDetailedDescription(); @@ -779,7 +779,7 @@ m_loadCTSPackedHouses(false) m_scriptObject->setOwner(this); - ContainedByProperty *containedBy = new ContainedByProperty(*this, nullptr); + ContainedByProperty *containedBy = new ContainedByProperty(*this, NULL); addProperty(*containedBy); //-- create the SlottedContainment property @@ -787,7 +787,7 @@ m_loadCTSPackedHouses(false) addProperty(*slottedProperty); //-- get ArrangementDescriptor if specified - if (getSharedTemplate() != nullptr) + if (getSharedTemplate() != NULL) { const ArrangementDescriptor *const arrangementDescriptor = getSharedTemplate()->getArrangementDescriptor(); if (arrangementDescriptor) @@ -801,7 +801,7 @@ m_loadCTSPackedHouses(false) } //set up containers on this object if it has any - if (getSharedTemplate() != nullptr) + if (getSharedTemplate() != NULL) { SharedObjectTemplate::ContainerType const containerType = getSharedTemplate()->getContainerType(); @@ -883,7 +883,7 @@ m_loadCTSPackedHouses(false) // add the portal property if one is requested - if (getSharedTemplate() != nullptr) + if (getSharedTemplate() != NULL) { const std::string &portalLayoutFileName = getSharedTemplate()->getPortalLayoutFilename(); if (!portalLayoutFileName.empty()) @@ -952,10 +952,10 @@ ServerObject::~ServerObject() destroyTriggerVolumes(); } - if (m_sharedTemplate != nullptr) + if (m_sharedTemplate != NULL) { m_sharedTemplate->releaseReference(); - m_sharedTemplate = nullptr; + m_sharedTemplate = NULL; } if (getClient()) @@ -982,7 +982,7 @@ ServerObject::~ServerObject() PROFILER_AUTO_BLOCK_DEFINE("ServerObject::~ServerObject delete script object"); delete m_scriptObject; } - m_scriptObject = nullptr; + m_scriptObject = NULL; gs_objectCount--; @@ -1038,14 +1038,14 @@ ServerObject * ServerObject::getServerObject(NetworkId const & networkId) ServerObject * ServerObject::asServerObject(Object * const object) { - return (object != nullptr) ? object->asServerObject() : nullptr; + return (object != NULL) ? object->asServerObject() : NULL; } //----------------------------------------------------------------------- ServerObject const * ServerObject::asServerObject(Object const * const object) { - return (object != nullptr) ? object->asServerObject() : nullptr; + return (object != NULL) ? object->asServerObject() : NULL; } //----------------------------------------------------------------------- @@ -1255,12 +1255,12 @@ const SharedObjectTemplate * ServerObject::getDefaultSharedTemplate(void) const { static const ConstCharCrcLowerString templateName("object/object/base/shared_object_default.iff"); - if (m_defaultSharedTemplate == nullptr) + if (m_defaultSharedTemplate == NULL) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != nullptr) + WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create default shared object template %s", templateName.getString())); + if (m_defaultSharedTemplate != NULL) ExitChain::add (removeDefaultTemplate, "ServerObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -1280,10 +1280,10 @@ const unsigned long ServerObject::getObjectCount() */ void ServerObject::removeDefaultTemplate(void) { - if (m_defaultSharedTemplate != nullptr) + if (m_defaultSharedTemplate != NULL) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = nullptr; + m_defaultSharedTemplate = NULL; } } // ServerObject::removeDefaultTemplate @@ -1570,7 +1570,7 @@ bool ServerObject::isInBazaarOrVendor() const { bool inBazaarOrVendor = false; const ServerObject *parent = safe_cast(ContainerInterface::getFirstParentInWorld(*this)); - const ServerObject *grandParent = nullptr; + const ServerObject *grandParent = NULL; if( parent ) { grandParent = safe_cast(ContainerInterface::getFirstParentInWorld(*parent)); @@ -1821,7 +1821,7 @@ void ServerObject::addTriggerVolume(TriggerVolume * t) { if (!t) { - WARNING_STRICT_FATAL(true, ("Cannot add nullptr volume")); + WARNING_STRICT_FATAL(true, ("Cannot add null volume")); return; } m_triggerVolumes.insert(std::make_pair(t->getName(), t)); @@ -1917,7 +1917,7 @@ void ServerObject::serverObjectEndBaselines(bool fromDatabase) onLoadedFromDatabase(); updateWorldSphere(); - if (getScriptObject() != nullptr) + if (getScriptObject() != NULL) { endBaselinesInitializeScript(*this, true); // If the object was created authoritative, trigger if needed @@ -2059,7 +2059,7 @@ void ServerObject::endBaselines() // and that buildout id got changed to some other object, like a rock if (isPlayerControlled() && isAuthoritative() && (immediateContainer->getNetworkId().getValue() < static_cast(0))) { - if (immediateContainer->asCellObject() != nullptr || ContainerInterface::getCell(*immediateContainer) != nullptr) + if (immediateContainer->asCellObject() != NULL || ContainerInterface::getCell(*immediateContainer) != NULL) ObserveTracker::onObjectContainerChanged(*this); else { @@ -2149,7 +2149,7 @@ bool ServerObject::handlePlayerInInteriorSetup(ContainedByProperty *containedBy) containedBy->setContainedBy(NetworkId::cms_invalid); fixOk = portal->fixupObject(*this, saveTransform); - containerHandleUpdateProxies(nullptr, safe_cast(ContainerInterface::getContainedByObject(*this))); + containerHandleUpdateProxies(NULL, safe_cast(ContainerInterface::getContainedByObject(*this))); if (building) building->gainedPlayer(*this); @@ -2306,8 +2306,8 @@ const int ServerObject::getCacheVersion() const const char * ServerObject::getSharedTemplateName() const { - if (getSharedTemplate() == nullptr) - return nullptr; + if (getSharedTemplate() == NULL) + return NULL; return getSharedTemplate()->ObjectTemplate::getName(); } @@ -2535,7 +2535,7 @@ bool ServerObject::serverObjectInitializeFirstTimeObject(ServerObject *cell, Tra if (cell) { Container::ContainerErrorCode tmp = Container::CEC_Success; - if (!ContainerInterface::transferItemToCell(*cell, *this, transform, nullptr, tmp)) + if (!ContainerInterface::transferItemToCell(*cell, *this, transform, NULL, tmp)) { WARNING(true, ("ServerWorld::createNewObjectIntermediate tried to create a new object in a cell, but it failed.")); return false; @@ -2587,7 +2587,7 @@ void ServerObject::initializeFirstTimeObject() //Don't move this declaration of contents out of the loop or you will leak a ref. ServerObjectTemplate::Contents contents; newTemplate->getContents(contents, i); - if (contents.content == nullptr) + if (contents.content == NULL) { DEBUG_WARNING(true, ("No template for contents item %d", i)); continue; @@ -2600,7 +2600,7 @@ void ServerObject::initializeFirstTimeObject() { //We'll persist the contents automatically if the parent object is persisted. ServerObject * newObject = ServerWorld::createNewObject(*(safe_cast(contents.content)), *this,slotId, false); - if (newObject == nullptr) + if (newObject == NULL) { DEBUG_WARNING(true, ("Can't create object from template %s",contents.content->getName())); } @@ -2615,7 +2615,7 @@ void ServerObject::initializeFirstTimeObject() // get the object (which we assume is a volume container) in the // desired slot SlottedContainer * const container = ContainerInterface::getSlottedContainer(*this); - if (container != nullptr) + if (container != NULL) { Container::ContainerErrorCode tmp = Container::CEC_Success; CachedNetworkId equippedObjectId = container->getObjectInSlot(SlotIdManager::findSlotId(CrcLowerString(contents.slotName.c_str())), tmp); @@ -2623,12 +2623,12 @@ void ServerObject::initializeFirstTimeObject() { // put the contents in the volume container ServerObject * equippedObject = safe_cast(equippedObjectId.getObject()); - if (equippedObject != nullptr) + if (equippedObject != NULL) { //We'll persist the contents automatically if the parent object is persisted. ServerObject * newObject = ServerWorld::createNewObject(*(safe_cast(contents.content)), *equippedObject,false); - if (newObject == nullptr) + if (newObject == NULL) { DEBUG_WARNING(true, ("Can't create object from template %s", contents.content->getName())); } @@ -2714,7 +2714,7 @@ void ServerObject::addToWorld() Object::addToWorld(); updateTriggerVolumes(); - if (getScriptObject() != nullptr) + if (getScriptObject() != NULL) getScriptObject()->setOwnerIsLoaded(); onAddedToWorld(); @@ -3012,8 +3012,8 @@ void ServerObject::onContainerTransferComplete(ServerObject *oldContainer, Serve void ServerObject::containerDepersistContents(ServerObject * oldParent, ServerObject * newParent) { - Container * const oldContainer = oldParent ? ContainerInterface::getContainer(*oldParent) : nullptr; - Container * const newContainer = newParent ? ContainerInterface::getContainer(*newParent) : nullptr; + Container * const oldContainer = oldParent ? ContainerInterface::getContainer(*oldParent) : NULL; + Container * const newContainer = newParent ? ContainerInterface::getContainer(*newParent) : NULL; if (oldContainer) oldContainer->internalItemRemoved(*this); @@ -3410,7 +3410,7 @@ void ServerObject::sendToClientsInUpdateRange(const GameNetworkMessage & message ServerObject * const obj = c->getCharacterObject(); - if (obj != nullptr) + if (obj != NULL) { if ( (ConfigServerGame::getSkipUnreliableTransformsForOtherCells() && obj->getAttachedTo() != getAttachedTo()) || (obj->getPosition_w().magnitudeBetweenSquared(getPosition_w()) > minDistanceSquared) @@ -3447,7 +3447,7 @@ void ServerObject::sendToSpecifiedClients(const GameNetworkMessage & message, bo for (std::vector::const_iterator i = clients.begin(); i != clients.end(); ++i) { ServerObject * o = safe_cast(NetworkIdManager::getObjectById(*i)); - if (o != nullptr && o->getClient() != nullptr) + if (o != NULL && o->getClient() != NULL) o->getClient()->send(message, reliable); } } @@ -3685,8 +3685,8 @@ void ServerObject::setParentCell(CellProperty * newCell) CellProperty * oldCell = getParentCell(); - if(oldCell == nullptr) oldCell = CellProperty::getWorldCellProperty(); - if(newCell == nullptr) newCell = CellProperty::getWorldCellProperty(); + if(oldCell == NULL) oldCell = CellProperty::getWorldCellProperty(); + if(newCell == NULL) newCell = CellProperty::getWorldCellProperty(); // ---------- @@ -3707,7 +3707,7 @@ void ServerObject::setParentCell(CellProperty * newCell) newTransform.multiply(oldCellTransform,oldTransform); Container::ContainerErrorCode tmp = Container::CEC_Success; - result = ContainerInterface::transferItemToWorld(*this, newTransform, nullptr, tmp); + result = ContainerInterface::transferItemToWorld(*this, newTransform, NULL, tmp); DEBUG_REPORT_LOG(!result, ("Object %s (id=%s) transfer to world was denied via ContainerInterface::transferItemToWorld()\n", getObjectTemplateName(), getNetworkId().getValueString().c_str())); } @@ -3720,7 +3720,7 @@ void ServerObject::setParentCell(CellProperty * newCell) ServerObject * newCellServerObject = safe_cast(newCellObject); Container::ContainerErrorCode tmp = Container::CEC_Success; - result = ContainerInterface::transferItemToCell(*newCellServerObject, *this, nullptr, tmp); + result = ContainerInterface::transferItemToCell(*newCellServerObject, *this, NULL, tmp); DEBUG_REPORT_LOG(!result, ("Object %s (id=%s) transfer to cell (id=%s) was denied via ContainerInterface::transferItemToCell()\n", getObjectTemplateName(), getNetworkId().getValueString().c_str(), newCellObject->getNetworkId().getValueString().c_str())); } @@ -4024,11 +4024,11 @@ void ServerObject::hearText(ServerObject const &source, MessageQueueSpatialChat CreatureObject * const creatureObject = asCreatureObject(); - if (creatureObject != nullptr) + if (creatureObject != NULL) { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(creatureObject); - if (playerObject != nullptr) + if (playerObject != NULL) { ChatAvatarId playerChatAvatarId(Chat::constructChatAvatarId(source)); Unicode::String playerName(Unicode::narrowToWide(playerChatAvatarId.getFullName())); @@ -4104,7 +4104,7 @@ void ServerObject::performSocial (const MessageQueueSocial & socialMsg) // allow scripts to prevent the player from performing the emote ScriptParams params; - if (getScriptObject() != nullptr) + if (getScriptObject() != NULL) { params.addParam(unicodeSocialTypeName); if (getScriptObject()->trigAllScripts(Scripting::TRIG_PERFORM_EMOTE, params) != SCRIPT_CONTINUE) @@ -4159,7 +4159,7 @@ void ServerObject::performCombatSpam (const MessageQueueCombatSpam & spamMsg, bo target->seeCombatSpam (spamMsg); } } else { - WARNING_STRICT_FATAL (!sendToSelf && !sendToBystanders, ("nullptr target_obj in commandFuncCombatSpam, when sendToTarget was set true")); + WARNING_STRICT_FATAL (!sendToSelf && !sendToBystanders, ("null target_obj in commandFuncCombatSpam, when sendToTarget was set true")); } } @@ -4217,10 +4217,10 @@ void ServerObject::teleportObject(Vector const &position_w, NetworkId const &tar { PortalProperty *portalProp = targetContainerObject->getPortalProperty(); targetContainerObject = 0; // clear in case we have a building that doesn't have the cell - if (portalProp != nullptr) + if (portalProp != NULL) { CellProperty *cellProp = portalProp->getCell(targetCellName.c_str()); - if (cellProp != nullptr) + if (cellProp != NULL) targetContainerObject = safe_cast(&(cellProp->getOwner())); } if (!targetContainerObject) @@ -4312,7 +4312,7 @@ void ServerObject::teleportObject(Vector const &position_w, NetworkId const &tar // Moves the object. If the new area is on a different server, the PlanetServer will change our authority. // What we really want to check here is whether we want to use the ServerController's teleport - // if a player has logged out, but we still have them loaded in game, their client will be nullptr, + // if a player has logged out, but we still have them loaded in game, their client will be null, // but we still want to use the ServerController's teleport method // so, we check against the player creature controller and player ship controller as well ServerController * controller = safe_cast(getController()); @@ -4383,7 +4383,7 @@ void ServerObject::updatePlanetServerInternal(bool) const /** * Attempts to create a synchronized ui object. If the synchronized ui object * does not exist, its creation is attempted via createSynchronizedUi. The default implementation -* of createSynchronizedUi returns nullptr, and renders this method a no-op. +* of createSynchronizedUi returns null, and renders this method a no-op. */ void ServerObject::addSynchronizedUi(const std::vector & clients) { @@ -4396,9 +4396,9 @@ void ServerObject::addSynchronizedUi(const std::vector & clients) { ServerObject * client = safe_cast( NetworkIdManager::getObjectById(*i)); - if (client != nullptr) + if (client != NULL) { - if (client->getClient() != nullptr) + if (client->getClient() != NULL) m_synchronizedUi->addClientObject (*client); else { @@ -4420,7 +4420,7 @@ void ServerObject::addSynchronizedUi(const std::vector & clients) /** * Attempts to add a client to the synchronized ui object. If the synchronized ui object * does not exist, its creation is attempted via createSynchronizedUi. The default implementation -* of createSynchronizedUi returns nullptr, and renders this method a no-op. +* of createSynchronizedUi returns null, and renders this method a no-op. * */ void ServerObject::addSynchronizedUiClient(ServerObject & client) @@ -4466,7 +4466,7 @@ void ServerObject::removeSynchronizedUiClient(const NetworkId & clientId) /** * Subclasses implement this if they have an appropriate synchronized ui object. -* Base class implementation returns nullptr. +* Base class implementation returns null. */ ServerSynchronizedUi * ServerObject::createSynchronizedUi () { @@ -4483,13 +4483,13 @@ ServerSynchronizedUi * ServerObject::createSynchronizedUi () */ void ServerObject::addPendingSynchronizedUi(const ServerObject & uiObject) { - if (getClient() != nullptr) + if (getClient() != NULL) { WARNING(true, ("ServerObject::addPendingSynchronizedUi called on object %s that already has a client", getNetworkId().getValueString().c_str())); return; } - if (m_pendingSyncUi == nullptr) + if (m_pendingSyncUi == NULL) m_pendingSyncUi = new std::vector; m_pendingSyncUi->push_back(uiObject.getNetworkId()); } @@ -5057,7 +5057,7 @@ std::string ServerObject::debugGetMessageToList() const { unsigned long const now = ServerClock::getInstance().getGameTimeSeconds(); std::string result; - time_t const timeNow = ::time(nullptr); + time_t const timeNow = ::time(NULL); for (Archive::AutoDeltaMap, MessageToId>, MessageToPayload>::const_iterator i=m_messageTos.begin(); i!=m_messageTos.end(); ++i) { char temp[256]; @@ -5126,7 +5126,7 @@ unsigned long ServerObject::processQueuedMessageTos(unsigned long effectiveMessa // if the message is going to be recurring, create a // new messageTo to reschedule the recurring message - MessageToPayload * copyOfRecurringMessage = nullptr; + MessageToPayload * copyOfRecurringMessage = NULL; if (message->second.getRecurringTime() > 0) { copyOfRecurringMessage = new MessageToPayload( @@ -5331,7 +5331,7 @@ void ServerObject::handleCMessageTo(const MessageToPayload &message) { //handle unstick static MessageDispatch::Emitter e; - Chat::sendSystemMessageSimple(*this, SharedStringIds::unstick_request_complete, nullptr); + Chat::sendSystemMessageSimple(*this, SharedStringIds::unstick_request_complete, NULL); RequestUnstick r; r.setClientId(getNetworkId()); e.emitMessage(r); @@ -5587,7 +5587,7 @@ bool ServerObject::handleTeleportFixup(bool force) } else if (destContainer != NetworkId::cms_invalid && !force) { - LOG("TeleportFixup", ("Failing teleport fixup because object %s is in a nullptr dest container and force was passed in\n", getNetworkId().getValueString().c_str())); + LOG("TeleportFixup", ("Failing teleport fixup because object %s is in a null dest container and force was passed in\n", getNetworkId().getValueString().c_str())); return false; // going to a container and it wasn't loaded, defer } } @@ -5626,15 +5626,15 @@ void ServerObject::customize(const std::string & customName, int value) if(isAuthoritative()) { CustomizationDataProperty *const cdProperty = safe_cast(getProperty(CustomizationDataProperty::getClassPropertyId())); - if (cdProperty != nullptr) + if (cdProperty != NULL) { CustomizationData *const customizationData = cdProperty->fetchCustomizationData(); - if (customizationData != nullptr) + if (customizationData != NULL) { RangedIntCustomizationVariable * variable = dynamic_cast< RangedIntCustomizationVariable*>(customizationData->findVariable( customName)); - if (variable != nullptr) + if (variable != NULL) variable->setValue(value); else { @@ -5646,7 +5646,7 @@ void ServerObject::customize(const std::string & customName, int value) else { // this shouldn't happen - DEBUG_WARNING(true, ("CustomizationDataProperty returned nullptr CustomizationData on fetch.")); + DEBUG_WARNING(true, ("CustomizationDataProperty returned NULL CustomizationData on fetch.")); } } else @@ -5725,7 +5725,7 @@ bool ServerObject::permanentlyDestroy(DeleteReasons::Enumerator reason) const bool houseDestroyedByScript = (reason == DeleteReasons::Script && buildingObject && buildingObject->isPlayerPlaced()); // tell scripts we want to destroy the object - if (getScriptObject() != nullptr && !m_calledTriggerDestroy) + if (getScriptObject() != NULL && !m_calledTriggerDestroy) { m_calledTriggerDestroy = true; ScriptParams params; @@ -5739,7 +5739,7 @@ bool ServerObject::permanentlyDestroy(DeleteReasons::Enumerator reason) } } - if (isAuthoritative() && (getScriptObject() != nullptr) && !m_calledTriggerRemovingFromWorld) + if (isAuthoritative() && (getScriptObject() != NULL) && !m_calledTriggerRemovingFromWorld) { ScriptParams params; m_calledTriggerRemovingFromWorld = true; @@ -6517,8 +6517,8 @@ void ServerObject::onAllContentsLoaded() if (isAuthoritative()) { - ServerObject *player = nullptr; - if ((player = getServerObject(playerId)) != nullptr) + ServerObject *player = NULL; + if ((player = getServerObject(playerId)) != NULL) { //Tell scripts we are loaded ScriptParams params; @@ -6588,7 +6588,7 @@ void ServerObject::handleDisconnect(bool immediate) { // client has disconnected, log pertinent information about the play session CreatureObject * const creatureObject = asCreatureObject(); - PlayerObject * playerObject = nullptr; + PlayerObject * playerObject = NULL; if (creatureObject) { playerObject = PlayerCreatureController::getPlayerObject(creatureObject); @@ -6927,13 +6927,13 @@ ServerObject * ServerObject::combineResourceContainers(ServerObject &item) { ResourceContainerObject *resourceContainerObject = safe_cast(&item); - if (resourceContainerObject != nullptr) + if (resourceContainerObject != NULL) { // If this is a container, see if it contains another resource container of the same type Container *container = ContainerInterface::getContainer(*this); - if (container != nullptr) + if (container != NULL) { ContainerIterator iterContainer = container->begin(); @@ -6945,12 +6945,12 @@ ServerObject * ServerObject::combineResourceContainers(ServerObject &item) // the item is a resource container if ((containedObject != &item) && - (containedObject != nullptr) && + (containedObject != NULL) && (containedObject->getObjectType() == ServerResourceContainerObjectTemplate::ServerResourceContainerObjectTemplate_tag)) { ResourceContainerObject *containedResourceContainerObject = safe_cast(containedObject); - if ((containedResourceContainerObject != nullptr) && + if ((containedResourceContainerObject != NULL) && (resourceContainerObject->getResourceType() == containedResourceContainerObject->getResourceType())) { // This is a container of similar type, if it is not full, save it to the list @@ -7064,7 +7064,7 @@ bool ServerObject::isContainedBy(const ServerObject & container, bool includeCon // our container is the desired container return true; } - else if (test != nullptr && test != this && includeContents) + else if (test != NULL && test != this && includeContents) { // our container isn't the desired container, see if it is contained return safe_cast(test)->isContainedBy(container, true); @@ -7564,7 +7564,7 @@ void ServerObject::sendDirtyObjectMenuNotification() Controller * const controller = getController(); if (controller) - controller->appendMessage(CM_objectMenuDirty, 0, nullptr, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_ALL_CLIENT); + controller->appendMessage(CM_objectMenuDirty, 0, NULL, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_ALL_CLIENT); } // ---------------------------------------------------------------------- @@ -7577,7 +7577,7 @@ void ServerObject::sendDirtyAttributesNotification() Controller * const controller = getController(); if (controller) - controller->appendMessage(CM_attributesDirty, 0, nullptr, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_ALL_CLIENT); + controller->appendMessage(CM_attributesDirty, 0, NULL, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_ALL_CLIENT); } //------------------------------------------------------------------------------------------ @@ -7615,15 +7615,15 @@ void ServerObject::triggerMadeAuthoritative() void ServerObject::setLayer(TerrainGenerator::Layer* layer) { - LayerProperty * layerProperty = nullptr; + LayerProperty * layerProperty = NULL; Property * property = getProperty(LayerProperty::getClassPropertyId()); - if (property != nullptr) + if (property != NULL) layerProperty = safe_cast(property); else layerProperty = new LayerProperty(*this); layerProperty->setLayer(layer); - if (property == nullptr) + if (property == NULL) { addProperty(*layerProperty, true); ObjectTracker::addRunTimeRule(); @@ -7636,12 +7636,12 @@ void ServerObject::setLayer(TerrainGenerator::Layer* layer) TerrainGenerator::Layer* ServerObject::getLayer() const { const Property * property = getProperty(LayerProperty::getClassPropertyId()); - if (property != nullptr) + if (property != NULL) { const LayerProperty * layerProperty = safe_cast(property); return layerProperty->getLayer(); } - return nullptr; + return NULL; } //------------------------------------------------------------------------------------------ @@ -7853,7 +7853,7 @@ void ServerObject::setPatrolPathRoot(const ServerObject & root) // make sure we aren't already a root node Property * p = getProperty(PatrolPathRootProperty::getClassPropertyId()); - if (p != nullptr) + if (p != NULL) { if (root.getNetworkId() != getNetworkId()) { @@ -7873,7 +7873,7 @@ void ServerObject::setPatrolPathRoot(const ServerObject & root) { // add the root node to our node list p = getProperty(PatrolPathNodeProperty::getClassPropertyId()); - if (p == nullptr) + if (p == NULL) { p = new PatrolPathNodeProperty(*this); addProperty(*p, true); @@ -7893,15 +7893,15 @@ void ServerObject::setPatrolPathRoot(const ServerObject & root) // we need to add any players in range to our path observer count TriggerVolume * triggerVolume = getNetworkTriggerVolume(); - if (triggerVolume != nullptr) + if (triggerVolume != NULL) { TriggerVolume::ContentsSet const & contents = triggerVolume->getContents(); for (TriggerVolume::ContentsSet::const_iterator i = contents.begin(); i != contents.end(); ++i) { - if (*i != nullptr) + if (*i != NULL) { Client * client = (*i)->getClient(); - if (client != nullptr) + if (client != NULL) { if (!ObserveTracker::isObserving(*client, *this)) ObserveTracker::onClientEnteredNetworkTriggerVolume(*client, *triggerVolume); @@ -7922,14 +7922,14 @@ void ServerObject::setPatrolPathRoot(const ServerObject & root) /** * Returns the root node for a patrol path node. * - * @return the root node, or nullptr if this isn't a patrol path node + * @return the root node, or NULL if this isn't a patrol path node */ const std::set & ServerObject::getPatrolPathRoots() const { static const std::set noRoots; const Property * p = getProperty(PatrolPathNodeProperty::getClassPropertyId()); - if (p != nullptr) + if (p != NULL) { return safe_cast(p)->getRoots(); } @@ -7957,7 +7957,7 @@ void ServerObject::addPatrolPathingObject(const ServerObject & ai) } Property * p = getProperty(PatrolPathRootProperty::getClassPropertyId()); - if (p != nullptr) + if (p != NULL) { safe_cast(p)->addPatrollingObject(ai); DEBUG_REPORT_LOG(true, ("[patrolpath] add patrol ai %s to root %s\n", @@ -7974,7 +7974,7 @@ void ServerObject::addPatrolPathingObject(const ServerObject & ai) if (roots.size() == 1) { ServerObject * root = safe_cast(roots.begin()->getObject()); - if (root != nullptr) + if (root != NULL) root->addPatrolPathingObject(ai); } else @@ -8004,7 +8004,7 @@ void ServerObject::removePatrolPathingObject(const ServerObject & ai) } Property * p = getProperty(PatrolPathRootProperty::getClassPropertyId()); - if (p != nullptr) + if (p != NULL) { safe_cast(p)->removePatrollingObject(ai); DEBUG_REPORT_LOG(true, ("[patrolpath] remove patrol ai %s from root %s\n", @@ -8019,7 +8019,7 @@ void ServerObject::removePatrolPathingObject(const ServerObject & ai) if (roots.size() == 1) { ServerObject * root = safe_cast(roots.begin()->getObject()); - if (root != nullptr) + if (root != NULL) root->removePatrolPathingObject(ai); } else @@ -8049,7 +8049,7 @@ void ServerObject::addPatrolPathObserver() // if we are a root node, increment our observer count Property * p = getProperty(PatrolPathRootProperty::getClassPropertyId()); - if (p != nullptr) + if (p != NULL) { PatrolPathRootProperty * pprp = safe_cast(p); pprp->incrementObserverCount(); @@ -8061,10 +8061,10 @@ void ServerObject::addPatrolPathObserver() const std::set > & ai = pprp->getPatrollingObjects(); for (std::set >::const_iterator i = ai.begin(); i != ai.end(); ++i) { - if (*i != nullptr) + if (*i != NULL) { const ServerObject * ai = *i; - if (ai->getController()->asCreatureController() != nullptr) + if (ai->getController()->asCreatureController() != NULL) { const CreatureController * controller = ai->getController()->asCreatureController(); if (controller->getHibernate()) @@ -8086,7 +8086,7 @@ void ServerObject::addPatrolPathObserver() for (std::set::const_iterator i = roots.begin(); i != roots.end(); ++i) { ServerObject * root = safe_cast(i->getObject()); - if (root != nullptr) + if (root != NULL) { root->addPatrolPathObserver(); } @@ -8112,7 +8112,7 @@ void ServerObject::removePatrolPathObserver() // if we are a root node, decrement our observer count Property * p = getProperty(PatrolPathRootProperty::getClassPropertyId()); - if (p != nullptr) + if (p != NULL) { PatrolPathRootProperty * pprp = safe_cast(p); pprp->decrementObserverCount(); @@ -8131,7 +8131,7 @@ void ServerObject::removePatrolPathObserver() for (std::set::const_iterator i = roots.begin(); i != roots.end(); ++i) { ServerObject * root = safe_cast(i->getObject()); - if (root != nullptr) + if (root != NULL) { root->removePatrolPathObserver(); } @@ -8152,7 +8152,7 @@ int ServerObject::getPatrolPathObservers() const int observers = 0; const Property * p = getProperty(PatrolPathRootProperty::getClassPropertyId()); - if (p != nullptr) + if (p != NULL) { observers = safe_cast(p)->getObserverCount(); } @@ -8162,7 +8162,7 @@ int ServerObject::getPatrolPathObservers() const for (std::set::const_iterator i = roots.begin(); i != roots.end(); ++i) { const ServerObject * root = safe_cast(i->getObject()); - if (root != nullptr && root->isPatrolPathRoot()) + if (root != NULL && root->isPatrolPathRoot()) { observers += root->getPatrolPathObservers(); } @@ -8175,14 +8175,14 @@ int ServerObject::getPatrolPathObservers() const bool ServerObject::isPatrolPathNode() const { - return (getProperty(PatrolPathNodeProperty::getClassPropertyId()) != nullptr) || isPatrolPathRoot(); + return (getProperty(PatrolPathNodeProperty::getClassPropertyId()) != NULL) || isPatrolPathRoot(); } // ---------------------------------------------------------------------- bool ServerObject::isPatrolPathRoot() const { - return getProperty(PatrolPathRootProperty::getClassPropertyId()) != nullptr; + return getProperty(PatrolPathRootProperty::getClassPropertyId()) != NULL; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/object/ServerObject.h b/engine/server/library/serverGame/src/shared/object/ServerObject.h index 5cdaed82..32192ce3 100755 --- a/engine/server/library/serverGame/src/shared/object/ServerObject.h +++ b/engine/server/library/serverGame/src/shared/object/ServerObject.h @@ -317,7 +317,7 @@ public: // Can this object manipulate other objects. CreatureObject overrides. Base class returns false. // generally an object is allowed to manipulate another object if it is container or "nearby". public: - virtual bool canManipulateObject(ServerObject const &target, bool movingObject, bool checkPermission, bool checkPermissionOnParent, float maxDistance, Container::ContainerErrorCode&, bool skipNoTradeCheck = false, bool * allowedByGodMode = nullptr) const; + virtual bool canManipulateObject(ServerObject const &target, bool movingObject, bool checkPermission, bool checkPermissionOnParent, float maxDistance, Container::ContainerErrorCode&, bool skipNoTradeCheck = false, bool * allowedByGodMode = NULL) const; //----------------------------------------------------------------------- // container support @@ -738,7 +738,7 @@ private: static float ms_buildingUpdateRadiusMultiplier; static void setBuildingUpdateRadiusMultiplier(float m); - /** If this object is being controlled by a client, this pointer will be set. nullptr otherwise + /** If this object is being controlled by a client, this pointer will be set. NULL otherwise */ Client * m_client; std::set m_observers; @@ -871,7 +871,7 @@ inline Client * ServerObject::getClient(void) const inline const SharedObjectTemplate * ServerObject::getSharedTemplate() const { - if (m_sharedTemplate != nullptr) + if (m_sharedTemplate != NULL) return m_sharedTemplate; return getDefaultSharedTemplate(); } @@ -936,7 +936,7 @@ inline ServerObject::TriggerVolumeMap & ServerObject::getTriggerVolumeMap() inline const std::set * ServerObject::getTriggerVolumeEntered() const { - return nullptr; + return NULL; } //----------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/object/ServerObject_AuthTransfer.cpp b/engine/server/library/serverGame/src/shared/object/ServerObject_AuthTransfer.cpp index b7075ece..65655198 100755 --- a/engine/server/library/serverGame/src/shared/object/ServerObject_AuthTransfer.cpp +++ b/engine/server/library/serverGame/src/shared/object/ServerObject_AuthTransfer.cpp @@ -162,7 +162,7 @@ void ServerObject::transferAuthoritySceneChange(uint32 pid) client->getIpAddress(), client->isSecure(), client->getStationId(), - nullptr, + NULL, client->getGameFeatures(), client->getSubscriptionFeatures(), client->getAccountFeatureIds(), @@ -265,7 +265,7 @@ void ServerObject::transferAuthorityNoSceneChange(uint32 pid, bool skipLoadScree client->getIpAddress(), client->isSecure(), client->getStationId(), - (observeListIds.empty() ? nullptr : &observeListIds), + (observeListIds.empty() ? NULL : &observeListIds), client->getGameFeatures(), client->getSubscriptionFeatures(), client->getAccountFeatureIds(), diff --git a/engine/server/library/serverGame/src/shared/object/ServerResourceClassObject.cpp b/engine/server/library/serverGame/src/shared/object/ServerResourceClassObject.cpp index 49c6bd09..5bb2df2f 100755 --- a/engine/server/library/serverGame/src/shared/object/ServerResourceClassObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/ServerResourceClassObject.cpp @@ -577,7 +577,7 @@ ResourceTypeObject const * ServerResourceClassObject::getAResourceType() const if (!m_types.empty()) return m_types.front(); else - return nullptr; + return NULL; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/object/ShipObject.cpp b/engine/server/library/serverGame/src/shared/object/ShipObject.cpp index 2408018b..badd8030 100755 --- a/engine/server/library/serverGame/src/shared/object/ShipObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/ShipObject.cpp @@ -110,9 +110,9 @@ namespace ShipObjectNamespace typedef std::map ShipTypeShipDataMap; ShipTypeShipDataMap ms_shipTypeShipDataMap; - ShipData const * ms_defaultShipData = nullptr; + ShipData const * ms_defaultShipData = NULL; - ShipComponentDataEngine * ms_defaultEngine = nullptr; + ShipComponentDataEngine * ms_defaultEngine = NULL; unsigned int s_lastShipId = 0; unsigned int const s_maxShipId = 4096; @@ -180,7 +180,7 @@ void ShipObject::install() DataTableManager::addReloadCallback(cs_shipTypeFileName, loadShipTypeDataTable); ShipComponentDescriptor const * const genericEngineDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByName(ConstCharCrcString("eng_generic")); - FATAL(genericEngineDescriptor == nullptr, ("ShipObject genericEngineDescriptor [eng_generic] not found")); + FATAL(genericEngineDescriptor == NULL, ("ShipObject genericEngineDescriptor [eng_generic] not found")); ms_defaultEngine = new ShipComponentDataEngine(*genericEngineDescriptor); // mark shipId 0 as used @@ -243,10 +243,10 @@ ShipObject * ShipObject::getContainingShipObject(ServerObject * serverObject) void ShipObjectNamespace::remove() { - ms_defaultShipData = nullptr; + ms_defaultShipData = NULL; delete ms_defaultEngine; - ms_defaultEngine = nullptr; + ms_defaultEngine = NULL; //-- Delete the ship type to ship data map std::for_each(ms_shipTypeShipDataMap.begin(), ms_shipTypeShipDataMap.end(), PointerDeleterPairSecond()); @@ -270,7 +270,7 @@ ShipObject::ShipObject(ServerShipObjectTemplate const *newTemplate) : m_currentRoll(0.f), m_currentChassisHitPoints(0.f), m_maximumChassisHitPoints(0.f), - m_weaponRefireTimers(nullptr), + m_weaponRefireTimers(NULL), m_numberOfHits(0), m_chassisType (0), m_chassisComponentMassMaximum(0.0f), @@ -406,19 +406,19 @@ ShipObject::~ShipObject() nullWatchers(); delete m_boosterAvailableTimer; - m_boosterAvailableTimer = nullptr; + m_boosterAvailableTimer = NULL; if (getLocalFlag(LocalObjectFlags::ShipObject_ShipIdAssigned)) freeShipId(m_shipId.get()); delete m_fireShotQueue; - m_fireShotQueue = nullptr; + m_fireShotQueue = NULL; delete[] m_weaponRefireTimers; - m_weaponRefireTimers = nullptr; + m_weaponRefireTimers = NULL; delete m_nebulas; - m_nebulas = nullptr; + m_nebulas = NULL; delete m_autoAggroImmuneTimer; delete m_turretWeaponIndices; @@ -465,7 +465,7 @@ void ShipObject::endBaselines() NetworkId const & resourceTypeId = (*it).first; ResourceTypeObject const * const resourceTypeObject = ServerUniverse::getInstance().getResourceTypeById(resourceTypeId); - if (nullptr == ServerUniverse::getInstance().getResourceTypeById(resourceTypeId)) + if (NULL == ServerUniverse::getInstance().getResourceTypeById(resourceTypeId)) { WARNING(true, ("ShipObject::endBaselines invalid resource type [%s]", resourceTypeId.getValueString().c_str())); continue; @@ -946,7 +946,7 @@ Controller *ShipObject::createDefaultController() /** * Get the ship's pilot, if any. * - * @return the pilot if there is one, otherwise nullptr + * @return the pilot if there is one, otherwise NULL */ CreatureObject *ShipObject::getPilot() { @@ -1180,7 +1180,7 @@ void ShipObject::internalHandleFireShot(Client const *gunnerClient, int const we { if (!gunnerCreature) { - WARNING(true, ("ShipObject::internalHandleFireShot cannot fire missile with a nullptr gunner")); + WARNING(true, ("ShipObject::internalHandleFireShot cannot fire missile with a null gunner")); return; } @@ -1284,14 +1284,14 @@ void ShipObject::fireShotTurretServer(int const weaponIndex, NetworkId const & t Object const * const targetObject = NetworkIdManager::getObjectById(targetId); - if (targetObject == nullptr) + if (targetObject == NULL) { WARNING(true, ("ERROR: The targetId(%s) could not be resolved to an Object. A turret shot will NOT be fired.", targetId.getValueString().c_str())); return; } ServerObject const * const targetServerObject = targetObject->asServerObject(); - ShipObject const * const targetShipObject = (targetServerObject != nullptr) ? targetServerObject->asShipObject() : nullptr; + ShipObject const * const targetShipObject = (targetServerObject != NULL) ? targetServerObject->asShipObject() : NULL; if ( !targetShipObject && goodShot) @@ -1299,7 +1299,7 @@ void ShipObject::fireShotTurretServer(int const weaponIndex, NetworkId const & t WARNING(true, ("ERROR: The targetId(%s) could not be resolved to a ShipObject. Perfect shot requested, but there is no way to lead with a perfect shot.", targetId.getValueString().c_str())); } - if ( (targetShipObject != nullptr) + if ( (targetShipObject != NULL) && goodShot) { // If its a good shot, lead perfectly @@ -1335,8 +1335,8 @@ void ShipObject::fireShotTurretServer(int const weaponIndex, NetworkId const & t ShipController const * const ownerShipController = getController()->asShipController(); DEBUG_WARNING(!ownerShipController, ("ERROR: Controller could not be resolved to a ShipController(%s)", getDebugInformation().c_str())); - float const missHalfAngle = (ownerShipController != nullptr) ? (ownerShipController->getTurretMissAngle() / 2.0f) : 0.0f; - float const targetRadius = (targetServerObject != nullptr) ? targetServerObject->getRadius() : 0.0f; + float const missHalfAngle = (ownerShipController != NULL) ? (ownerShipController->getTurretMissAngle() / 2.0f) : 0.0f; + float const targetRadius = (targetServerObject != NULL) ? targetServerObject->getRadius() : 0.0f; Transform transform; transform.roll_l(Random::randomReal() * PI_TIMES_2); @@ -1442,13 +1442,13 @@ void ShipObject::constructFromTemplate() //-- setup ship chassis ShipChassis const * shipChassis = ShipChassis::findShipChassisByName (TemporaryCrcString (shipType.c_str (), true)); - if (shipChassis == nullptr) + if (shipChassis == NULL) { WARNING (true, ("ShipObject::constructFromTemplate failed to find a valid ship chassis for [%s], trying generic", shipType.c_str ())); shipChassis = ShipChassis::findShipChassisByName (TemporaryCrcString ("generic", true)); } - if (shipChassis != nullptr) + if (shipChassis != NULL) m_chassisType = shipChassis->getCrc (); else { @@ -1456,7 +1456,7 @@ void ShipObject::constructFromTemplate() } //set initial slot targetability from the chassis setttings. Code or script can change these at runtime - if(shipChassis != nullptr) + if(shipChassis != NULL) { for (int slot = 0; slot < static_cast(ShipChassisSlotType::SCST_num_types); ++slot) { @@ -1473,7 +1473,7 @@ void ShipObject::constructFromTemplate() { ShipComponentData * const shipComponentData = shipData->m_components[i]; - if (shipComponentData != nullptr) + if (shipComponentData != NULL) { if (!installComponentFromData(i, *shipComponentData)) { std::string chassis = shipChassis->getName().getString(); @@ -1732,7 +1732,7 @@ ShipComponentDataEngine const & ShipObject::getShipDataEngine() const ShipComponentDataEngine const * const engine = safe_cast(shipData->m_components[static_cast(ShipChassisSlotType::SCST_engine)]); - if (engine == nullptr) + if (engine == NULL) return *ms_defaultEngine; return *engine; @@ -1761,9 +1761,9 @@ void ShipObject::handleGunnerChange(ServerObject const &player) } ShipController * const shipController = getController()->asShipController(); - PlayerShipController * const playerShipController = (shipController != nullptr) ? shipController->asPlayerShipController() : nullptr; + PlayerShipController * const playerShipController = (shipController != NULL) ? shipController->asPlayerShipController() : NULL; - if (playerShipController != nullptr) + if (playerShipController != NULL) { playerShipController->updateGunnerWeaponIndex(player.getNetworkId(), gunnerWeaponIndex); } @@ -2152,7 +2152,7 @@ void ShipObjectNamespace::loadShipTypeDataTable(DataTable const &dataTable) //-- find components for (int i = 0; i < static_cast(ShipChassisSlotType::SCST_num_types); ++i) { - shipData->m_components [i] = nullptr; + shipData->m_components [i] = NULL; std::string const & slotName = ShipChassisSlotType::getNameFromType (static_cast(i)); if (!dataTable.doesColumnExist (slotName)) continue; @@ -2164,14 +2164,14 @@ void ShipObjectNamespace::loadShipTypeDataTable(DataTable const &dataTable) uint32 const componentCrc = Crc::normalizeAndCalculate (componentName.c_str ()); ShipComponentDescriptor const * const shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByCrc (componentCrc); - if (shipComponentDescriptor == nullptr) + if (shipComponentDescriptor == NULL) WARNING (true, ("ShipObject ship type [%s] specified invalid [%s] component [%s]", name.c_str (), slotName.c_str (), componentName.c_str ())); else shipData->m_components[i] = ShipComponentDataManager::create(*shipComponentDescriptor); ShipComponentData * const shipComponentData = shipData->m_components[i]; - if (shipComponentData == nullptr) + if (shipComponentData == NULL) continue; //-- get common data @@ -2532,18 +2532,18 @@ void ShipObjectNamespace::freeShipId(uint16 shipId) ShipObject const * ShipObject::asShipObject(Object const * object) { - ServerObject const * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; + ServerObject const * const serverObject = (object != NULL) ? object->asServerObject() : NULL; - return (serverObject != nullptr) ? serverObject->asShipObject() : nullptr; + return (serverObject != NULL) ? serverObject->asShipObject() : NULL; } // ---------------------------------------------------------------------- ShipObject * ShipObject::asShipObject(Object * object) { - ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; + ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; - return (serverObject != nullptr) ? serverObject->asShipObject() : nullptr; + return (serverObject != NULL) ? serverObject->asShipObject() : NULL; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/object/ShipObject_Components.cpp b/engine/server/library/serverGame/src/shared/object/ShipObject_Components.cpp index 667c9ae7..e6f4cb22 100755 --- a/engine/server/library/serverGame/src/shared/object/ShipObject_Components.cpp +++ b/engine/server/library/serverGame/src/shared/object/ShipObject_Components.cpp @@ -1638,7 +1638,7 @@ bool ShipObject::canInstallComponent (int chassisSlot, TangibleObject const ShipChassisSlot const * const slot = shipChassis->getSlot (static_cast(effectiveCompatibilitySlot)); - if (slot != nullptr) + if (slot != NULL) { if (slot->canAcceptComponent (shipComponentData->getDescriptor ())) { @@ -1721,7 +1721,7 @@ bool ShipObject::installComponent (NetworkId const & installerId, int chassisS void ShipObject::purgeComponent (int chassisSlot) { - IGNORE_RETURN (internalUninstallComponent (NetworkId::cms_invalid, chassisSlot, nullptr)); + IGNORE_RETURN (internalUninstallComponent (NetworkId::cms_invalid, chassisSlot, NULL)); } //---------------------------------------------------------------------- @@ -1731,16 +1731,16 @@ TangibleObject * ShipObject::internalUninstallComponent (NetworkId const if (!isSlotInstalled (chassisSlot)) { WARNING (true, ("ShipObject::internalUninstallComponent failed... no component installed in slot")); - return nullptr; + return NULL; } ShipComponentData * const shipComponentData = createShipComponentData (chassisSlot); - if (shipComponentData == nullptr) + if (shipComponentData == NULL) { - WARNING (true, ("ShipObject::internalUninstallComponent failed nullptr data")); + WARNING (true, ("ShipObject::internalUninstallComponent failed null data")); delete shipComponentData; - return nullptr; + return NULL; } if(getScriptObject()) @@ -1751,7 +1751,7 @@ TangibleObject * ShipObject::internalUninstallComponent (NetworkId const p.addParam (containerTarget ? containerTarget->getNetworkId () : NetworkId::cms_invalid); if (getScriptObject()->trigAllScripts(Scripting::TRIG_SHIP_COMPONENT_UNINSTALLING, p) == SCRIPT_OVERRIDE) - return nullptr; + return NULL; } TangibleObject * tangible = 0; @@ -1765,7 +1765,7 @@ TangibleObject * ShipObject::internalUninstallComponent (NetworkId const { VolumeContainer * volContainer = ContainerInterface::getVolumeContainer(*containerTarget); - if (volContainer == nullptr) + if (volContainer == NULL) return 0; int oldCapacity = volContainer->debugDoNotUseSetCapacity(-1); @@ -1780,21 +1780,21 @@ TangibleObject * ShipObject::internalUninstallComponent (NetworkId const obj = safe_cast(ServerWorld::createNewObject (objectTemplateCrc, *containerTarget, true)); } - if (obj == nullptr) + if (obj == NULL) { WARNING (true, ("ShipObject::internalUninstallComponent failed for slot [%d] because ServerWorld could not create an object for [%d], or container is full", chassisSlot, objectTemplateCrc)); delete shipComponentData; - return nullptr; + return NULL; } tangible = obj->asTangibleObject (); - if (tangible == nullptr) + if (tangible == NULL) { WARNING (true, ("ShipObject::internalUninstallComponent failed for slot [%d] because object template [%d] is not tangible", chassisSlot, objectTemplateCrc)); delete shipComponentData; IGNORE_RETURN (obj->permanentlyDestroy (DeleteReasons::SetupFailed)); - return nullptr; + return NULL; } shipComponentData->writeDataToComponent (*tangible); @@ -1897,7 +1897,7 @@ TangibleObject * ShipObject::uninstallComponent (NetworkId const & uninstallerId bool ShipObject::installComponentFromData(int chassisSlot, ShipComponentData const & shipComponentData) { ShipChassis const * const shipChassis = ShipChassis::findShipChassisByCrc (getChassisType ()); - if (shipChassis == nullptr) + if (shipChassis == NULL) { DEBUG_WARNING (true, ("Ship [%s] chassis [%d] is invalid for installing component [%s]", getNetworkId().getValueString().c_str(), @@ -1922,7 +1922,7 @@ bool ShipObject::installComponentFromData(int chassisSlot, ShipComponentData con effectiveCompatibilitySlot = ShipChassisSlotType::SCST_weapon_first+((chassisSlot-ShipChassisSlotType::SCST_weapon_first)&7); ShipChassisSlot const * const slot = shipChassis->getSlot (static_cast(effectiveCompatibilitySlot)); - if (slot == nullptr) + if (slot == NULL) { DEBUG_WARNING (true, ("Ship [%s] chassis [%s] does not support slot [%s] for installing component [%s]", getNetworkId().getValueString().c_str(), @@ -1957,7 +1957,7 @@ bool ShipObject::installComponentFromData(int chassisSlot, ShipComponentData con bool ShipObject::pseudoInstallComponent(int chassisSlot, uint32 componentCrc) { ShipComponentDescriptor const * const shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByCrc (componentCrc); - if (shipComponentDescriptor == nullptr) + if (shipComponentDescriptor == NULL) { WARNING (true, ("Invalid component name")); return false; @@ -1965,7 +1965,7 @@ bool ShipObject::pseudoInstallComponent(int chassisSlot, uint32 componentCrc) ShipComponentData * const shipComponentData = ShipComponentDataManager::create (*shipComponentDescriptor); - if (shipComponentData == nullptr) + if (shipComponentData == NULL) { WARNING(true, ("ShipObject::pseudoInstallComponent invalid descriptor")); return false; @@ -1982,27 +1982,27 @@ bool ShipObject::pseudoInstallComponent(int chassisSlot, uint32 componentCrc) ShipComponentData * ShipObject::createShipComponentData (int chassisSlot) const { - ShipComponentDescriptor const * shipComponentDescriptor = nullptr; + ShipComponentDescriptor const * shipComponentDescriptor = NULL; uint32 const componentCrc = getComponentCrc (chassisSlot); if (componentCrc) { shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByCrc (componentCrc); - if (shipComponentDescriptor == nullptr) + if (shipComponentDescriptor == NULL) { WARNING (true, ("ShipObject::createShipComponentData failed for slot [%d] because component crc [%d] could not map to a component descriptor", chassisSlot, componentCrc)); - return nullptr; + return NULL; } } else - return nullptr; + return NULL; ShipComponentData * const shipComponentData = ShipComponentDataManager::create (*shipComponentDescriptor); - if (shipComponentData == nullptr) + if (shipComponentData == NULL) { WARNING (true, ("ShipObject::createShipComponentData failed for slot [%d] ship Component data could not be constructed", chassisSlot)); delete(shipComponentData); - return nullptr; + return NULL; } if (!shipComponentData->readDataFromShip (chassisSlot, *this)) @@ -2334,7 +2334,7 @@ float ShipObject::computeShipActualSpeedMaximum () const if (hasWings() && hasCondition(TangibleObject::C_wingsOpened)) { ShipChassis const * const shipChassis = ShipChassis::findShipChassisByCrc(getChassisType()); - if (nullptr != shipChassis) + if (NULL != shipChassis) { float const wingOpenSpeedFactor = shipChassis->getWingOpenSpeedFactor(); rate *= wingOpenSpeedFactor; @@ -2673,7 +2673,7 @@ void ShipObject::handlePowerPulse (float timeElapsedSecs) if (boosterEnergyCurrent <= 0.0f) { IGNORE_RETURN(setComponentActive(ShipChassisSlotType::SCST_booster, false)); - if (pilot != nullptr) + if (pilot != NULL) Chat::sendSystemMessage(*pilot, SharedStringIds::booster_energy_depleted, Unicode::emptyString); restartBoosterTimer(); @@ -3368,7 +3368,7 @@ void ShipObject::setCargoHoldContent(NetworkId const & resourceTypeId, int amoun else { ResourceTypeObject const * const resourceTypeObject = ServerUniverse::getInstance().getResourceTypeById(resourceTypeId); - if (nullptr == ServerUniverse::getInstance().getResourceTypeById(resourceTypeId)) + if (NULL == ServerUniverse::getInstance().getResourceTypeById(resourceTypeId)) { WARNING(true, ("ShipObject::setCargoHoldContent invalid resource type [%s]", resourceTypeId.getValueString().c_str())); return; diff --git a/engine/server/library/serverGame/src/shared/object/StaticObject.cpp b/engine/server/library/serverGame/src/shared/object/StaticObject.cpp index 35366239..8a9dfc3f 100755 --- a/engine/server/library/serverGame/src/shared/object/StaticObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/StaticObject.cpp @@ -21,7 +21,7 @@ #include "sharedObject/AppearanceTemplateList.h" #include "sharedObject/ObjectTemplateList.h" -const SharedObjectTemplate * StaticObject::m_defaultSharedTemplate = nullptr; +const SharedObjectTemplate * StaticObject::m_defaultSharedTemplate = NULL; //----------------------------------------------------------------------- @@ -39,7 +39,7 @@ StaticObject::StaticObject(const ServerStaticObjectTemplate* newTemplate) : { Appearance * newAppearance = AppearanceTemplateList::createAppearance(appearanceString.c_str()); - if(newAppearance != nullptr) + if(newAppearance != NULL) { setAppearance(newAppearance); } else { @@ -82,13 +82,13 @@ const SharedObjectTemplate * StaticObject::getDefaultSharedTemplate(void) const { static const ConstCharCrcLowerString templateName("object/static/base/shared_static_default.iff"); - if (m_defaultSharedTemplate == nullptr) + if (m_defaultSharedTemplate == NULL) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create " + WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create " "default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != nullptr) + if (m_defaultSharedTemplate != NULL) ExitChain::add (removeDefaultTemplate, "StaticObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -101,10 +101,10 @@ static const ConstCharCrcLowerString templateName("object/static/base/shared_sta */ void StaticObject::removeDefaultTemplate(void) { - if (m_defaultSharedTemplate != nullptr) + if (m_defaultSharedTemplate != NULL) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = nullptr; + m_defaultSharedTemplate = NULL; } } // StaticObject::removeDefaultTemplate diff --git a/engine/server/library/serverGame/src/shared/object/TangibleConditionObserver.cpp b/engine/server/library/serverGame/src/shared/object/TangibleConditionObserver.cpp index b9f4cad8..ab9526b4 100755 --- a/engine/server/library/serverGame/src/shared/object/TangibleConditionObserver.cpp +++ b/engine/server/library/serverGame/src/shared/object/TangibleConditionObserver.cpp @@ -27,10 +27,10 @@ TangibleConditionObserver::TangibleConditionObserver(TangibleObject const *who, TangibleConditionObserver::~TangibleConditionObserver() { - if (m_tangibleObject != nullptr) + if (m_tangibleObject != NULL) { const CreatureObject * creature = m_tangibleObject->asCreatureObject(); - if (creature != nullptr) + if (creature != NULL) { int currentCondition = creature->getCondition(); if ((m_oldCondition & TangibleObject::C_hibernating) != 0 && (currentCondition & TangibleObject::C_hibernating) == 0) @@ -50,8 +50,8 @@ TangibleConditionObserver::~TangibleConditionObserver() if ((wasInvulnerable != isInvulnerable) && !m_tangibleObject->getObservers().empty()) { // did the object's "pvp sync" status change because of the invulnerability change? - bool const wasPvpSync = PvpUpdateObserver::satisfyPvpSyncCondition(m_tangibleObject->isNonPvpObject(), wasInvulnerable, (m_tangibleObject->asCreatureObject() != nullptr), m_tangibleObject->getPvpFaction()); - bool const isPvpSync = PvpUpdateObserver::satisfyPvpSyncCondition(m_tangibleObject->isNonPvpObject(), isInvulnerable, (m_tangibleObject->asCreatureObject() != nullptr), m_tangibleObject->getPvpFaction()); + bool const wasPvpSync = PvpUpdateObserver::satisfyPvpSyncCondition(m_tangibleObject->isNonPvpObject(), wasInvulnerable, (m_tangibleObject->asCreatureObject() != NULL), m_tangibleObject->getPvpFaction()); + bool const isPvpSync = PvpUpdateObserver::satisfyPvpSyncCondition(m_tangibleObject->isNonPvpObject(), isInvulnerable, (m_tangibleObject->asCreatureObject() != NULL), m_tangibleObject->getPvpFaction()); if (wasPvpSync != isPvpSync) { diff --git a/engine/server/library/serverGame/src/shared/object/TangibleObject.cpp b/engine/server/library/serverGame/src/shared/object/TangibleObject.cpp index 3602f9a6..196f9ce9 100755 --- a/engine/server/library/serverGame/src/shared/object/TangibleObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/TangibleObject.cpp @@ -354,13 +354,13 @@ static const std::string NOMOVE_SCRIPT = "item.special.nomove"; static const std::string OBJVAR_DECLINE_DUEL = "decline_duel"; -const SharedObjectTemplate * TangibleObject::m_defaultSharedTemplate = nullptr; +const SharedObjectTemplate * TangibleObject::m_defaultSharedTemplate = NULL; //----------------------------------------------------------------------- TangibleObject::TangibleObject(const ServerTangibleObjectTemplate* newTemplate) : ServerObject(newTemplate), - m_combatData(nullptr), + m_combatData(NULL), m_pvpType(), m_pvpMercenaryType(PvpType_Neutral), m_pvpFutureType(-1), @@ -392,7 +392,7 @@ TangibleObject::TangibleObject(const ServerTangibleObjectTemplate* newTemplate) m_accessList(), m_guildAccessList(), m_effectsMap(), - m_npcConversation(nullptr), + m_npcConversation(NULL), m_conversations() { WARNING_STRICT_FATAL(!getSharedTemplate(), ("Tried to create a TANGIBLE %s object without a shared template!\n", newTemplate->DataResource::getName())); @@ -469,7 +469,7 @@ TangibleObject::TangibleObject(const ServerTangibleObjectTemplate* newTemplate) { Appearance * newAppearance = AppearanceTemplateList::createAppearance(appearanceString.c_str()); - if(newAppearance != nullptr) + if(newAppearance != NULL) { setAppearance(newAppearance); } else { @@ -522,11 +522,11 @@ TangibleObject::~TangibleObject() //-- This must be the first line in the destructor to invalidate any watchers watching this object nullWatchers(); - if (getSynchronizedUi() != nullptr) + if (getSynchronizedUi() != NULL) { CraftingToolSyncUi * sync = dynamic_cast( getSynchronizedUi()); - if (sync != nullptr) + if (sync != NULL) { if (isAuthoritative() && isCraftingTool()) { @@ -561,7 +561,7 @@ TangibleObject::~TangibleObject() CombatTracker::removeDefender(this); - if (m_combatData != nullptr) + if (m_combatData != NULL) { if (isAuthoritative()) { @@ -598,16 +598,16 @@ TangibleObject::~TangibleObject() } delete m_combatData; - m_combatData = nullptr; + m_combatData = NULL; if (!isPlayerControlled()) ObjectTracker::removeCombatAI(); } - if (m_npcConversation != nullptr) + if (m_npcConversation != NULL) { delete m_npcConversation; - m_npcConversation = nullptr; + m_npcConversation = NULL; } ObjectTracker::removeTangible(); @@ -625,7 +625,7 @@ void TangibleObject::initializeFirstTimeObject() // set up armor from the template const ServerTangibleObjectTemplate * newTemplate = safe_cast< const ServerTangibleObjectTemplate *>(getObjectTemplate()); - if (newTemplate != nullptr) + if (newTemplate != NULL) { setInvulnerable(newTemplate->getInvulnerable()); @@ -634,7 +634,7 @@ void TangibleObject::initializeFirstTimeObject() initializeVisibility(); const ServerArmorTemplate * armorTemplate = newTemplate->getArmor(); - if (armorTemplate != nullptr) + if (armorTemplate != NULL) { int const rating = static_cast(armorTemplate->getRating()); if ( rating < static_cast(ServerArmorTemplate::AR_armorNone) @@ -729,7 +729,7 @@ void TangibleObject::endBaselines() // check for existence of objvar to enable/disable m_logCommandEnqueue CommandQueue * const queue = getCommandQueue(); - if (queue != nullptr) + if (queue != NULL) { queue->setLogCommandEnqueue(getObjVars().hasItem("debuggingLogCommandEnqueue")); } @@ -781,7 +781,7 @@ void TangibleObject::onLoadedFromDatabase() params.addParam(prototypeId, "prototype"); ScriptDictionaryPtr dictionary; getScriptObject()->makeScriptDictionary(params, dictionary); - if (dictionary.get() != nullptr) + if (dictionary.get() != NULL) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(getNetworkId(), @@ -973,16 +973,16 @@ TangibleObject * TangibleObject::getTangibleObject(NetworkId const & networkId) TangibleObject * TangibleObject::asTangibleObject(Object * object) { - ServerObject * serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - return (serverObject != nullptr) ? serverObject->asTangibleObject() : nullptr; + ServerObject * serverObject = (object != NULL) ? object->asServerObject() : NULL; + return (serverObject != NULL) ? serverObject->asTangibleObject() : NULL; } //----------------------------------------------------------------------- TangibleObject const * TangibleObject::asTangibleObject(Object const * object) { - ServerObject const * serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - return (serverObject != nullptr) ? serverObject->asTangibleObject() : nullptr; + ServerObject const * serverObject = (object != NULL) ? object->asServerObject() : NULL; + return (serverObject != NULL) ? serverObject->asTangibleObject() : NULL; } //----------------------------------------------------------------------- @@ -1010,13 +1010,13 @@ const SharedObjectTemplate * TangibleObject::getDefaultSharedTemplate(void) cons { static const ConstCharCrcLowerString templateName("object/tangible/base/shared_tangible_default.iff"); - if (m_defaultSharedTemplate == nullptr) + if (m_defaultSharedTemplate == NULL) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create " + WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create " "default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != nullptr) + if (m_defaultSharedTemplate != NULL) ExitChain::add (removeDefaultTemplate, "TangibleObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -1029,10 +1029,10 @@ static const ConstCharCrcLowerString templateName("object/tangible/base/shared_t */ void TangibleObject::removeDefaultTemplate(void) { - if (m_defaultSharedTemplate != nullptr) + if (m_defaultSharedTemplate != NULL) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = nullptr; + m_defaultSharedTemplate = NULL; } } // TangibleObject::removeDefaultTemplate @@ -1184,7 +1184,7 @@ void TangibleObject::appearanceDataModified(const std::string& value) void TangibleObject::getEquippedItems(uint32 combatBone, std::vector &items) const { SlottedContainer const * const container = ContainerInterface::getSlottedContainer(*this); - if (container == nullptr) + if (container == NULL) return; std::vector itemIds; @@ -1194,10 +1194,10 @@ void TangibleObject::getEquippedItems(uint32 combatBone, std::vector(object); - if (item != nullptr) + if (item != NULL) items.push_back(item); } } @@ -1219,7 +1219,7 @@ TangibleObject * TangibleObject::getRandomEquippedItem(uint32 combatBone) const if (items.empty()) { - return nullptr; + return NULL; } int index = Random::random(0, items.size() - 1); @@ -1401,17 +1401,17 @@ void TangibleObject::conclude() PROFILER_AUTO_BLOCK_DEFINE("TangibleObject::conclude"); // if we are a crafting tool, conclude our prototype and manf schematic - if (getSynchronizedUi() != nullptr) + if (getSynchronizedUi() != NULL) { const CraftingToolSyncUi * sync = dynamic_cast( getSynchronizedUi()); - if (sync != nullptr) + if (sync != NULL) { Object * object = sync->getPrototype().getObject(); - if (object != nullptr) + if (object != NULL) object->conclude(); object = sync->getManfSchematic().getObject(); - if (object != nullptr) + if (object != NULL) object->conclude(); } } @@ -1683,12 +1683,12 @@ void TangibleObject::setPvpMercenaryFaction(Pvp::FactionId factionId, Pvp::PvpTy { if (PvpData::isImperialFactionId(m_pvpMercenaryFaction.get())) { - IGNORE_RETURN(setObjVarItem("factionalHelper.timeStopHelpingImperial", static_cast(::time(nullptr)))); + IGNORE_RETURN(setObjVarItem("factionalHelper.timeStopHelpingImperial", static_cast(::time(NULL)))); removeObjVarItem("factionalHelper.timeStopHelpingRebel"); } else if (PvpData::isRebelFactionId(m_pvpMercenaryFaction.get())) { - IGNORE_RETURN(setObjVarItem("factionalHelper.timeStopHelpingRebel", static_cast(::time(nullptr)))); + IGNORE_RETURN(setObjVarItem("factionalHelper.timeStopHelpingRebel", static_cast(::time(NULL)))); removeObjVarItem("factionalHelper.timeStopHelpingImperial"); } } @@ -1821,11 +1821,11 @@ void TangibleObject::onPermanentlyDestroyed() if (isCraftingTool()) { ServerObject * owner = ServerWorld::findObjectByNetworkId(getOwnerId()); - if (owner != nullptr && owner->asCreatureObject() != nullptr) + if (owner != NULL && owner->asCreatureObject() != NULL) { PlayerObject * player = PlayerCreatureController::getPlayerObject( owner->asCreatureObject()); - if (player != nullptr && player->isCrafting() && player->getCraftingTool() == getNetworkId()) + if (player != NULL && player->isCrafting() && player->getCraftingTool() == getNetworkId()) player->stopCrafting(false); } } @@ -1942,11 +1942,11 @@ bool TangibleObject::onContainerAboutToTransfer(ServerObject * destination, Serv } } } - if (destination != nullptr && getObjVars().hasItem(OBJVAR_BIO_LINK_ID)) + if (destination != NULL && getObjVars().hasItem(OBJVAR_BIO_LINK_ID)) { // if this item is bio-linked and a player is trying to equip it, make // sure the link id matches the player's id - if (destination->asCreatureObject() != nullptr) + if (destination->asCreatureObject() != NULL) { // allow holograms to have biolinked items transferred to them int hologramVal = 0; @@ -2058,7 +2058,7 @@ Footprint *TangibleObject::getFootprint() if (property) return property->getFootprint(); else - return nullptr; + return NULL; } //----------------------------------------------------------------------- @@ -2069,7 +2069,7 @@ Footprint const *TangibleObject::getFootprint() const if (property) return property->getFootprint(); else - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -2151,9 +2151,9 @@ int TangibleObject::alterHitPoints(int delta, bool ignoreInvulnerable, #ifdef _DEBUG char debugBuffer[1024]; const char * craftedString = ""; - Client *client = nullptr; + Client *client = NULL; ServerObject * sourceObject = safe_cast(NetworkIdManager::getObjectById(source)); - if (source != NetworkId::cms_invalid && sourceObject != nullptr) + if (source != NetworkId::cms_invalid && sourceObject != NULL) client = sourceObject->getClient(); #endif @@ -2171,7 +2171,7 @@ int TangibleObject::alterHitPoints(int delta, bool ignoreInvulnerable, "from %d to %d\n", craftedString, getNetworkId().getValueString().c_str(), totalHitPoints, m_damageTaken.get(), totalDamageTaken); DEBUG_REPORT_LOG (true, ("%s", debugBuffer)); - if (source != NetworkId::cms_invalid && client != nullptr) + if (source != NetworkId::cms_invalid && client != NULL) ConsoleMgr::broadcastString(debugBuffer, client); } #endif @@ -2200,7 +2200,7 @@ int TangibleObject::alterHitPoints(int delta, bool ignoreInvulnerable, snprintf(debugBuffer, sizeof(debugBuffer), "%s object %s has been " "disabled\n", craftedString, getNetworkId().getValueString().c_str()); DEBUG_REPORT_LOG (true, ("%s", debugBuffer)); - if (source != NetworkId::cms_invalid && client != nullptr) + if (source != NetworkId::cms_invalid && client != NULL) ConsoleMgr::broadcastString(debugBuffer, client); } #endif @@ -2283,7 +2283,7 @@ void TangibleObject::updatePlanetServerInternal(const bool forceUpdate) const if ((forceUpdate || getPositionChanged()) && (!ContainerInterface::getContainedByObject(*this) || getInterestRadius() > 0)) { Object const * const topmostContainer = ContainerInterface::getTopmostContainer(*this); - FATAL(!topmostContainer, ("Object %s was contained by something, but getTopmostContainer() returned nullptr\n",getNetworkId().getValueString().c_str())); + FATAL(!topmostContainer, ("Object %s was contained by something, but getTopmostContainer() returned NULL\n",getNetworkId().getValueString().c_str())); Vector const &position = topmostContainer->getPosition_p(); UpdateObjectOnPlanetMessage const msg( @@ -2313,7 +2313,7 @@ void TangibleObject::updatePlanetServerInternal(const bool forceUpdate) const */ void TangibleObject::clearDamageList(void) { - if (m_combatData != nullptr) + if (m_combatData != NULL) { m_combatData->defenseData.damage.clear(); } @@ -2442,7 +2442,7 @@ void TangibleObject::clearHateList() } else { - sendControllerMessageToAuthServer(CM_clearHateList, nullptr); + sendControllerMessageToAuthServer(CM_clearHateList, NULL); } } @@ -2476,7 +2476,7 @@ bool TangibleObject::isHatedBy(Object * const object) bool result = false; TangibleObject * const hatedByTangibleObject = TangibleObject::asTangibleObject(object); - if (hatedByTangibleObject != nullptr) + if (hatedByTangibleObject != NULL) { HateList::UnSortedList const & hateList = hatedByTangibleObject->getUnSortedHateList(); @@ -2534,7 +2534,7 @@ void TangibleObject::resetHateTimer() } else { - sendControllerMessageToAuthServer(CM_resetHateTimer, nullptr); + sendControllerMessageToAuthServer(CM_resetHateTimer, NULL); } } @@ -2625,11 +2625,11 @@ void TangibleObject::setCraftedId(const NetworkId & id) IGNORE_RETURN(setObjVarItem(OBJVAR_CRAFTING_SCHEMATIC, id)); setCondition(C_crafted); const Object * object = NetworkIdManager::getObjectById(id); - if (object != nullptr) + if (object != NULL) { const ManufactureSchematicObject * schematic = dynamic_cast< const ManufactureSchematicObject *>(object); - if (schematic != nullptr) + if (schematic != NULL) m_sourceDraftSchematic = schematic->getDraftSchematic(); } } @@ -2869,7 +2869,7 @@ bool TangibleObject::startCraftingSession(CreatureObject & crafter) UNREF(myIdString); // needed for release mode PlayerObject * crafterPlayer = PlayerCreatureController::getPlayerObject(&crafter); - if (crafterPlayer == nullptr) + if (crafterPlayer == NULL) return false; // make sure we are a crafting tool @@ -2909,7 +2909,7 @@ bool TangibleObject::startCraftingSession(CreatureObject & crafter) // make sure the output slot is empty SlottedContainer const * const slotContainer = ContainerInterface::getSlottedContainer(*this); - if (slotContainer == nullptr) + if (slotContainer == NULL) { DEBUG_WARNING(true, ("Crafting tool %s does not have a container!", myIdString)); return false; @@ -2938,7 +2938,7 @@ bool TangibleObject::startCraftingSession(CreatureObject & crafter) for (iter = schematics.begin(); iter != schematics.end(); ++iter) { const DraftSchematicObject * schematic = DraftSchematicObject::getSchematic((*iter).first.first); - if (schematic != nullptr && ((myType & ServerObjectTemplate::CT_genericItem) != 0 || + if (schematic != NULL && ((myType & ServerObjectTemplate::CT_genericItem) != 0 || ((schematic->getCategory() & myType) != 0))) { // make sure the player has all the skill commands needed for the @@ -3068,11 +3068,11 @@ bool TangibleObject::stopCraftingSession(void) bool TangibleObject::isIngredientInHopper(const NetworkId & ingredientId) const { ServerObject const * const hopper = getIngredientHopper(); - if (hopper == nullptr) + if (hopper == NULL) return false; Object const * const ingredient = CachedNetworkId(ingredientId).getObject(); - if (ingredient == nullptr) + if (ingredient == NULL) return false; return ContainerInterface::isNestedWithin(*ingredient, getNetworkId()); @@ -3098,15 +3098,15 @@ static const SlotId hopperSlotId(SlotIdManager::findSlotId(INGREDIENT_HOPPER_SLO { DEBUG_WARNING(true, ("Tried to get input hopper for non-crafting station " "object %s", myIdString)); - return nullptr; + return NULL; } // get the ingredient hopper SlottedContainer const * const container = ContainerInterface::getSlottedContainer(*this); - if (container == nullptr) + if (container == NULL) { DEBUG_WARNING(true, ("Crafting tool %s does not have a container!", myIdString)); - return nullptr; + return NULL; } Container::ContainerErrorCode tmp = Container::CEC_Success; Container::ContainedItem hopperId = container->getObjectInSlot(hopperSlotId, tmp); @@ -3114,14 +3114,14 @@ static const SlotId hopperSlotId(SlotIdManager::findSlotId(INGREDIENT_HOPPER_SLO { DEBUG_WARNING(true, ("Crafting tool %s does not have a ingredient " "hopper!", myIdString)); - return nullptr; + return NULL; } ServerObject * hopper = safe_cast(hopperId.getObject()); - if (hopper == nullptr) + if (hopper == NULL) { DEBUG_WARNING(true, ("Can't find object for ingredient hopper id %s", hopperId.getValueString().c_str())); - return nullptr; + return NULL; } return hopper; @@ -3150,16 +3150,16 @@ static const SlotId outputSlotId(SlotIdManager::findSlotId(MANF_OUTPUT_SLOT_NAME // get output slot SlottedContainer const * const slotContainer = ContainerInterface::getSlottedContainer(*this); - if (slotContainer == nullptr) + if (slotContainer == NULL) { DEBUG_WARNING(true, ("Crafting tool %s does not have a container!", myIdString)); return false; } // make sure the transferer is in the final stage of crafting - if (transferer == nullptr) + if (transferer == NULL) { - DEBUG_WARNING(true, ("addObjectToOutputSlot, nullptr transferer")); + DEBUG_WARNING(true, ("addObjectToOutputSlot, NULL transferer")); return false; } NetworkId crafterVarId(NetworkId::cms_invalid); @@ -3178,14 +3178,14 @@ static const SlotId outputSlotId(SlotIdManager::findSlotId(MANF_OUTPUT_SLOT_NAME return false; } CreatureObject const * const creatureTransferer = transferer->asCreatureObject(); - if (creatureTransferer == nullptr) + if (creatureTransferer == NULL) { DEBUG_WARNING(true, ("addObjectToOutputSlot, transferer %s is not a " "creature", transferer->getNetworkId().getValueString().c_str())); return false; } PlayerObject const * const creaturePlayer = PlayerCreatureController::getPlayerObject(creatureTransferer); - if (creaturePlayer == nullptr) + if (creaturePlayer == NULL) return false; if (creaturePlayer->getCraftingStage() != Crafting::CS_finish) @@ -3197,11 +3197,11 @@ static const SlotId outputSlotId(SlotIdManager::findSlotId(MANF_OUTPUT_SLOT_NAME } // if the object is our prototype, clear the prototype - if (getSynchronizedUi() != nullptr) + if (getSynchronizedUi() != NULL) { CraftingToolSyncUi * sync = dynamic_cast( getSynchronizedUi()); - if (sync != nullptr) + if (sync != NULL) { if (sync->getPrototype() == object.getNetworkId()) { @@ -3212,7 +3212,7 @@ static const SlotId outputSlotId(SlotIdManager::findSlotId(MANF_OUTPUT_SLOT_NAME // put the object in the slot Container::ContainerErrorCode tmp = Container::CEC_Success; - if (!ContainerInterface::transferItemToSlottedContainer(*this, object, outputSlotId, nullptr, tmp)) + if (!ContainerInterface::transferItemToSlottedContainer(*this, object, outputSlotId, NULL, tmp)) { DEBUG_WARNING(true, ("Failed to transfer object %s to crafting " "tool %s", object.getNetworkId().getValueString().c_str(), @@ -3250,7 +3250,7 @@ ManufactureSchematicObject * TangibleObject::getCraftingManufactureSchematic(voi { DEBUG_WARNING(true, ("Tried to get non-crafting tool " "object %s", myIdString)); - return nullptr; + return NULL; } SlottedContainer const * const container = ContainerInterface::getSlottedContainer(*this); @@ -3264,7 +3264,7 @@ ManufactureSchematicObject * TangibleObject::getCraftingManufactureSchematic(voi else { DEBUG_WARNING(true, ("ManufactureSchematicObject doesn't have a slotted container.")); - return nullptr; + return NULL; } } // TangibleObject::getCraftingManufactureSchematic @@ -3282,17 +3282,17 @@ ManufactureSchematicObject * TangibleObject::removeCraftingManufactureSchematic( UNREF(myIdString); // needed for release mode // make sure we are a crafting tool - if (!isCraftingTool() || getSynchronizedUi() == nullptr) + if (!isCraftingTool() || getSynchronizedUi() == NULL) { DEBUG_WARNING(true, ("Tried to get non-crafting tool " "object %s", myIdString)); - return nullptr; + return NULL; } CraftingToolSyncUi * sync = dynamic_cast( getSynchronizedUi()); - if (sync == nullptr) - return nullptr; + if (sync == NULL) + return NULL; ManufactureSchematicObject * schematic = safe_cast( sync->getManfSchematic().getObject()); @@ -3320,7 +3320,7 @@ void TangibleObject::setCraftingManufactureSchematic(ManufactureSchematicObject UNREF(myIdString); // needed for release mode // make sure we are a crafting tool - if (!isCraftingTool() || getSynchronizedUi() == nullptr) + if (!isCraftingTool() || getSynchronizedUi() == NULL) { DEBUG_WARNING(true, ("Tried to get non-crafting tool " "object %s", myIdString)); @@ -3329,7 +3329,7 @@ void TangibleObject::setCraftingManufactureSchematic(ManufactureSchematicObject CraftingToolSyncUi * sync = dynamic_cast( getSynchronizedUi()); - if (sync == nullptr) + if (sync == NULL) return; // see if there is already a schematic object set @@ -3339,7 +3339,7 @@ void TangibleObject::setCraftingManufactureSchematic(ManufactureSchematicObject // remove the old schematic ServerObject * object = safe_cast(schematicId.getObject()); - if (object == nullptr) + if (object == NULL) { if (schematicId != NetworkId::cms_invalid) { @@ -3358,13 +3358,13 @@ void TangibleObject::setCraftingManufactureSchematic(ManufactureSchematicObject // the schematic isn't in the world or in a container, so we need to // tell the client about it int stationBonus = 0; - ServerObject * crafter = nullptr; + ServerObject * crafter = NULL; NetworkId crafterId; if (getObjVars().getItem(OBJVAR_CRAFTING_CRAFTER,crafterId)) { crafter = safe_cast(NetworkIdManager::getObjectById(crafterId)); } - if (crafter != nullptr) + if (crafter != NULL) { sync->setManfSchematic(CachedNetworkId(schematic), CachedNetworkId(*crafter), true); @@ -3373,7 +3373,7 @@ void TangibleObject::setCraftingManufactureSchematic(ManufactureSchematicObject // it has const PlayerObject * player = PlayerCreatureController::getPlayerObject( crafter->asCreatureObject()); - if (player != nullptr && player->getCraftingStation().getObject() != nullptr) + if (player != NULL && player->getCraftingStation().getObject() != NULL) { player->getCraftingStation().getObject()->asServerObject()-> getObjVars().getItem(OBJVAR_CRAFTING_STATIONMOD, stationBonus); @@ -3436,11 +3436,11 @@ void TangibleObject::clearCraftingManufactureSchematic(void) } // get our ui - CraftingToolSyncUi * sync = nullptr; - if (getSynchronizedUi() != nullptr) + CraftingToolSyncUi * sync = NULL; + if (getSynchronizedUi() != NULL) sync = dynamic_cast(getSynchronizedUi()); - if (schematicId == CachedNetworkId::cms_cachedInvalid && sync == nullptr) + if (schematicId == CachedNetworkId::cms_cachedInvalid && sync == NULL) { // no schematic return; @@ -3448,7 +3448,7 @@ void TangibleObject::clearCraftingManufactureSchematic(void) if (schematicId == CachedNetworkId::cms_invalid) schematicId = sync->getManfSchematic(); - else if (sync != nullptr && sync->getManfSchematic() != CachedNetworkId::cms_invalid && + else if (sync != NULL && sync->getManfSchematic() != CachedNetworkId::cms_invalid && schematicId != sync->getManfSchematic()) { WARNING(true, ("TangibleObject::clearCraftingManufactureSchematic " @@ -3456,7 +3456,7 @@ void TangibleObject::clearCraftingManufactureSchematic(void) "in its ui!!!", getNetworkId().getValueString().c_str(), schematicId.getValueString().c_str(), sync->getManfSchematic().getValueString().c_str())); - if (schematicId.getObject() != nullptr) + if (schematicId.getObject() != NULL) { schematicId.getObject()->asServerObject()->permanentlyDestroy( DeleteReasons::Consumed); @@ -3472,9 +3472,9 @@ void TangibleObject::clearCraftingManufactureSchematic(void) } // get the schematic - ManufactureSchematicObject * manfSchematic = nullptr; + ManufactureSchematicObject * manfSchematic = NULL; ServerObject * object = safe_cast(schematicId.getObject()); - if (object == nullptr && schematicId != CachedNetworkId::cms_invalid) + if (object == NULL && schematicId != CachedNetworkId::cms_invalid) { WARNING_STRICT_FATAL(true, ("Can't find object for manufactring schematic " "id %s", schematicId.getValueString().c_str())); @@ -3482,7 +3482,7 @@ void TangibleObject::clearCraftingManufactureSchematic(void) else manfSchematic = safe_cast(object); - if (manfSchematic != nullptr) + if (manfSchematic != NULL) { NetworkId crafterId; if (getObjVars().getItem(OBJVAR_CRAFTING_CRAFTER,crafterId)) @@ -3492,7 +3492,7 @@ void TangibleObject::clearCraftingManufactureSchematic(void) // in the tool CreatureObject * const crafter = dynamic_cast(NetworkIdManager::getObjectById(crafterId)); PlayerObject * const crafterPlayer = PlayerCreatureController::getPlayerObject(crafter); - if (!manfSchematic->mustDestroyIngredients() || (crafterPlayer != nullptr && + if (!manfSchematic->mustDestroyIngredients() || (crafterPlayer != NULL && crafterPlayer->getCraftingStage() == Crafting::CS_assembly)) { crafterPlayer->setAllowEmptySlot(true); @@ -3526,9 +3526,9 @@ void TangibleObject::clearCraftingManufactureSchematic(void) } } - if (sync != nullptr) + if (sync != NULL) sync->setManfSchematic(CachedNetworkId::cms_cachedInvalid, CachedNetworkId::cms_cachedInvalid, true); - if (object != nullptr) + if (object != NULL) { object->permanentlyDestroy(DeleteReasons::Consumed); } @@ -3554,17 +3554,17 @@ ServerObject * TangibleObject::getCraftingPrototype(void) const UNREF(myIdString); // needed for release mode // make sure we are a crafting tool - if (!isCraftingTool() || getSynchronizedUi() == nullptr) + if (!isCraftingTool() || getSynchronizedUi() == NULL) { DEBUG_WARNING(true, ("Tried to get non-crafting tool " "object %s", myIdString)); - return nullptr; + return NULL; } const CraftingToolSyncUi * sync = dynamic_cast( getSynchronizedUi()); - if (sync == nullptr) - return nullptr; + if (sync == NULL) + return NULL; return safe_cast(sync->getPrototype().getObject()); } // TangibleObject::getCraftingPrototype @@ -3586,7 +3586,7 @@ void TangibleObject::setCraftingPrototype(ServerObject & prototype) UNREF(myIdString); // needed for release mode // make sure we are a crafting tool - if (!isCraftingTool() || getSynchronizedUi() == nullptr) + if (!isCraftingTool() || getSynchronizedUi() == NULL) { DEBUG_WARNING(true, ("Tried to get non-crafting tool " "object %s", myIdString)); @@ -3595,7 +3595,7 @@ void TangibleObject::setCraftingPrototype(ServerObject & prototype) CraftingToolSyncUi * sync = dynamic_cast( getSynchronizedUi()); - if (sync == nullptr) + if (sync == NULL) return; // see if there is already a prototype object set @@ -3605,7 +3605,7 @@ void TangibleObject::setCraftingPrototype(ServerObject & prototype) // remove the old prototype ServerObject * object = safe_cast(prototypeId.getObject()); - if (object == nullptr) + if (object == NULL) { if (prototypeId != NetworkId::cms_invalid) { @@ -3624,7 +3624,7 @@ void TangibleObject::setCraftingPrototype(ServerObject & prototype) // about it Container::ContainerErrorCode tmp = Container::CEC_Success; if (!ContainerInterface::transferItemToSlottedContainer(*this, prototype, - getCraftingPrototypeSlotId(), nullptr, tmp)) + getCraftingPrototypeSlotId(), NULL, tmp)) { // see if there is something in the slot, and delete it if there is bool failed = true; @@ -3634,13 +3634,13 @@ void TangibleObject::setCraftingPrototype(ServerObject & prototype) getCraftingPrototypeSlotId(), tmp); if (oldItem != prototype.getNetworkId()) { - if (oldItem.getObject() != nullptr) + if (oldItem.getObject() != NULL) { safe_cast(oldItem.getObject())->permanentlyDestroy( DeleteReasons::Consumed); // try the transfer again if (ContainerInterface::transferItemToSlottedContainer(*this, - prototype, getCraftingPrototypeSlotId(), nullptr, tmp)) + prototype, getCraftingPrototypeSlotId(), NULL, tmp)) { failed = false; } @@ -3678,7 +3678,7 @@ void TangibleObject::clearCraftingPrototype(void) UNREF(myIdString); // needed for release mode // make sure we are a crafting tool - if (!isCraftingTool() || getSynchronizedUi() == nullptr) + if (!isCraftingTool() || getSynchronizedUi() == NULL) { DEBUG_WARNING(true, ("Tried to get non-crafting tool " "object %s", myIdString)); @@ -3687,12 +3687,12 @@ void TangibleObject::clearCraftingPrototype(void) CraftingToolSyncUi * sync = dynamic_cast( getSynchronizedUi()); - if (sync == nullptr) + if (sync == NULL) return; const CachedNetworkId & prototypeId = sync->getPrototype(); ServerObject * object = safe_cast(prototypeId.getObject()); - if (object != nullptr) + if (object != NULL) { object->permanentlyDestroy(DeleteReasons::Consumed); } @@ -3704,7 +3704,7 @@ void TangibleObject::clearCraftingPrototype(void) Container::ContainerErrorCode error; const Container::ContainedItem & contents = container->getObjectInSlot( getCraftingPrototypeSlotId(), error); - if (contents.getObject() != nullptr) + if (contents.getObject() != NULL) { safe_cast(contents.getObject())->permanentlyDestroy( DeleteReasons::Consumed); @@ -3856,7 +3856,7 @@ void TangibleObject::forceExecuteCommand(Command const &command, NetworkId const { CommandQueue * const queue = getCommandQueue(); - if (queue != nullptr) + if (queue != NULL) { queue->cancelCurrentCommand(); } @@ -3948,7 +3948,7 @@ void TangibleObject::initializeVisibility() { const ServerTangibleObjectTemplate * myTemplate = safe_cast< const ServerTangibleObjectTemplate *>(getObjectTemplate()); - if (myTemplate != nullptr) + if (myTemplate != NULL) { bool visible = false; for (size_t i = 0; i < myTemplate->getVisibleFlagsCount(); ++i) @@ -3999,7 +3999,7 @@ void TangibleObject::visibilityDataModified() { // show the object const TriggerVolume * triggerVolume = getTriggerVolume(NetworkTriggerVolumeNamespace::NetworkTriggerVolumeName); - if (triggerVolume != nullptr) + if (triggerVolume != NULL) { std::vector observers; ServerWorld::findPlayerCreaturesInRange(getPosition_w(), triggerVolume->getRadius(), observers); @@ -4017,7 +4017,7 @@ void TangibleObject::visibilityDataModified() if (isVisible() && isHidden() && !m_passiveRevealPlayerCharacter.empty()) { const TriggerVolume * triggerVolume = getTriggerVolume(NetworkTriggerVolumeNamespace::NetworkTriggerVolumeName); - if (triggerVolume != nullptr) + if (triggerVolume != NULL) { std::vector possibleObservers; ServerWorld::findPlayerCreaturesInRange(getPosition_w(), triggerVolume->getRadius(), possibleObservers); @@ -4077,10 +4077,10 @@ bool TangibleObject::isVisibleOnClient(Client const &client) const // if the client's character is grouped with the the owner, then he can see it. const CreatureObject * owner = safe_cast(ownerId.getObject()); - if (owner != nullptr) + if (owner != NULL) { const GroupObject * group = owner->getGroup(); - if (group != nullptr) + if (group != NULL) { if (group->isGroupMember(characterObject->getNetworkId())) return true; @@ -4129,7 +4129,7 @@ static int datatable_max_encumbrance_col = -1; encumbrances.clear(); DataTable * dt = DataTableManager::getTable(DATATABLE_ARMOR, true); - if (dt == nullptr) + if (dt == NULL) return false; else if (datatable_type_col == -1) { @@ -4690,7 +4690,7 @@ void TangibleObject::getAttributesForCraftingTool (AttributeVector & data) const // see if there is an object in the output hopper bool hasPrototype = false; SlottedContainer const * const slotContainer = ContainerInterface::getSlottedContainer(*this); - if (slotContainer != nullptr) + if (slotContainer != NULL) { Container::ContainerErrorCode tmp = Container::CEC_Success; if (slotContainer->getObjectInSlot(outputSlotId, tmp) != Container::ContainedItem::cms_invalid) @@ -5121,7 +5121,7 @@ void TangibleObject::handleCMessageTo(const MessageToPayload &message) std::string const & sceneId = ServerWorld::getSceneId(); Vector const &position = findPosition_w(); Region const * const region = RegionMaster::getSmallestVisibleRegionAtPoint(sceneId, position.x, position.z); - if (region != nullptr) + if (region != NULL) regionName = Unicode::wideToNarrow(region->getName()); int const cityId = CityInterface::getCityAtLocation(sceneId, static_cast(position.x), static_cast(position.z), 0); @@ -5248,7 +5248,7 @@ void TangibleObject::setInvulnerable(bool invulnerable) GameScriptObject * const gameScriptObject = getScriptObject(); - if (gameScriptObject != nullptr) + if (gameScriptObject != NULL) { ScriptParams scriptParams; scriptParams.addParam(hasCondition(ServerTangibleObjectTemplate::C_invulnerable)); @@ -5451,8 +5451,8 @@ void TangibleObject::setPvpable(bool pvpable) if ((oldPvpable != pvpable) && !getObservers().empty()) { // did the object's "pvp sync" status change because of the Pvpable change? - bool const wasPvpSync = PvpUpdateObserver::satisfyPvpSyncCondition(!oldPvpable, hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (asCreatureObject() != nullptr), getPvpFaction()); - bool const isPvpSync = PvpUpdateObserver::satisfyPvpSyncCondition(!pvpable, hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (asCreatureObject() != nullptr), getPvpFaction()); + bool const wasPvpSync = PvpUpdateObserver::satisfyPvpSyncCondition(!oldPvpable, hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (asCreatureObject() != NULL), getPvpFaction()); + bool const isPvpSync = PvpUpdateObserver::satisfyPvpSyncCondition(!pvpable, hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (asCreatureObject() != NULL), getPvpFaction()); if (wasPvpSync != isPvpSync) { @@ -5557,8 +5557,8 @@ void TangibleObject::AppearanceDataCallback::modified(TangibleObject &target, co target.appearanceDataModified(value); Object * const objectContainer = ContainerInterface::getContainedByObject(target); - ServerObject * const serverContainer = objectContainer ? objectContainer->asServerObject() : nullptr; - TangibleObject * const tangibleContainer = serverContainer ? serverContainer->asTangibleObject() : nullptr; + ServerObject * const serverContainer = objectContainer ? objectContainer->asServerObject() : NULL; + TangibleObject * const tangibleContainer = serverContainer ? serverContainer->asTangibleObject() : NULL; if(tangibleContainer) tangibleContainer->onContainedItemAppearanceDataModified(target, oldValue, value); } @@ -5802,7 +5802,7 @@ void TangibleObject::commandQueueEnqueue(Command const &command, NetworkId const else { CommandQueue * const queue = getCommandQueue(); - if (queue != nullptr) + if (queue != NULL) { queue->enqueue(command, targetId, params, sequenceId, clearable, priority); } @@ -5820,7 +5820,7 @@ void TangibleObject::commandQueueRemove(uint32 const sequenceId) else { CommandQueue * const queue = getCommandQueue(); - if (queue != nullptr) + if (queue != NULL) { queue->remove(sequenceId); } @@ -5840,7 +5840,7 @@ void TangibleObject::commandQueueClear() bool TangibleObject::commandQueueHasCommandFromGroup(uint32 groupHash) const { CommandQueue * const queue = getCommandQueue(); - if (queue != nullptr) + if (queue != NULL) { return queue->hasCommandFromGroup(groupHash); } @@ -5852,7 +5852,7 @@ bool TangibleObject::commandQueueHasCommandFromGroup(uint32 groupHash) const void TangibleObject::commandQueueClearCommandsFromGroup(uint32 groupHash, bool force) { CommandQueue * const queue = getCommandQueue(); - if (queue != nullptr) + if (queue != NULL) { queue->clearCommandsFromGroup(groupHash, force); } @@ -5895,12 +5895,12 @@ void TangibleObject::CombatStateChangedCallback::modified(TangibleObject & targe AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(target.getController()); - if (aiCreatureController != nullptr) + if (aiCreatureController != NULL) { aiCreatureController->markCombatStartLocation(); } - if (target.getScriptObject() != nullptr) + if (target.getScriptObject() != NULL) { ScriptParams params; IGNORE_RETURN(target.getScriptObject()->trigAllScripts(Scripting::TRIG_ENTERED_COMBAT, params)); @@ -5926,7 +5926,7 @@ void TangibleObject::CombatStateChangedCallback::modified(TangibleObject & targe target.commandQueueClearCommandsFromGroup(COMMAND_GROUP_COMBAT.getCrc()); - if (target.getScriptObject() != nullptr) + if (target.getScriptObject() != NULL) { ScriptParams params; IGNORE_RETURN(target.getScriptObject()->trigAllScripts(Scripting::TRIG_EXITED_COMBAT, params)); @@ -5985,7 +5985,7 @@ int TangibleObject::getPassiveRevealRange(NetworkId const & target) const void TangibleObject::addPassiveReveal(TangibleObject const & target, int range) { - addPassiveReveal(target.getNetworkId(), range, (nullptr != PlayerCreatureController::getPlayerObject(target.asCreatureObject()))); + addPassiveReveal(target.getNetworkId(), range, (NULL != PlayerCreatureController::getPlayerObject(target.asCreatureObject()))); } //---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/object/TangibleObject.h b/engine/server/library/serverGame/src/shared/object/TangibleObject.h index f4b80817..c05f93bf 100755 --- a/engine/server/library/serverGame/src/shared/object/TangibleObject.h +++ b/engine/server/library/serverGame/src/shared/object/TangibleObject.h @@ -777,7 +777,7 @@ inline uint32 TangibleObject::getSourceDraftSchematic() const inline void TangibleObject::createCombatData() { - if (m_combatData == nullptr) + if (m_combatData == NULL) { m_combatData = new CombatEngineData::CombatData; } diff --git a/engine/server/library/serverGame/src/shared/object/TangibleObject_Conversation.cpp b/engine/server/library/serverGame/src/shared/object/TangibleObject_Conversation.cpp index fbf7881e..7f7aafe5 100755 --- a/engine/server/library/serverGame/src/shared/object/TangibleObject_Conversation.cpp +++ b/engine/server/library/serverGame/src/shared/object/TangibleObject_Conversation.cpp @@ -47,7 +47,7 @@ bool TangibleObject::startNpcConversation(TangibleObject & npc, const std::strin return false; // test if already in a conversation - if (m_npcConversation != nullptr) + if (m_npcConversation != NULL) return false; if (starter == NpcConversationData::CS_Player) @@ -120,7 +120,7 @@ void TangibleObject::endNpcConversation() { if (isAuthoritative()) { - if (m_npcConversation != nullptr) + if (m_npcConversation != NULL) { // I am a player, end my conversation @@ -128,7 +128,7 @@ void TangibleObject::endNpcConversation() if (isPlayerControlled()) { TangibleObject * const npc = safe_cast(m_npcConversation->getNPC().getObject()); - if (npc != nullptr) + if (npc != NULL) { // trigger OnEndNpcConversation ScriptParams params; @@ -157,13 +157,13 @@ void TangibleObject::endNpcConversation() } else { - WARNING(true,("TangibleObject::endNpcConversation: creature %s has a non-nullptr m_npcConversation pointer %p but is not a player-controlled object!", + WARNING(true,("TangibleObject::endNpcConversation: creature %s has a non-null m_npcConversation pointer %p but is not a player-controlled object!", getNetworkId().getValueString().c_str(), m_npcConversation)); m_conversations.clear(); } delete m_npcConversation; - m_npcConversation = nullptr; + m_npcConversation = NULL; } else { @@ -182,14 +182,14 @@ void TangibleObject::endNpcConversation() { NetworkId const & networkId = *it; TangibleObject * const player = dynamic_cast(NetworkIdManager::getObjectById(networkId)); - if (player != nullptr) + if (player != NULL) player->endNpcConversation(); } } } else { - WARNING(true,("TangibleObject::endNpcConversation: creature %s has a nullptr m_npcConversation pointer but is a player-controlled object!", + WARNING(true,("TangibleObject::endNpcConversation: creature %s has a null m_npcConversation pointer but is a player-controlled object!", getNetworkId().getValueString().c_str())); m_conversations.clear(); } @@ -217,7 +217,7 @@ void TangibleObject::endNpcConversation() */ void TangibleObject::clearNpcConversation() { - if (m_npcConversation != nullptr) + if (m_npcConversation != NULL) { m_npcConversation->clearResponses(); } @@ -234,7 +234,7 @@ void TangibleObject::sendNpcConversationMessage(const StringId & stringId, const { if (isAuthoritative()) { - if (m_npcConversation != nullptr) + if (m_npcConversation != NULL) { NpcConversation::Response response; response.stringId = stringId; @@ -262,7 +262,7 @@ bool TangibleObject::addNpcConversationResponse(const StringId & stringId, const { if (isAuthoritative()) { - if (m_npcConversation != nullptr) + if (m_npcConversation != NULL) { NpcConversation::Response response; response.stringId = stringId; @@ -293,7 +293,7 @@ bool TangibleObject::removeNpcConversationResponse(const StringId & stringId, co bool result = false; if (isAuthoritative()) { - if (m_npcConversation != nullptr) + if (m_npcConversation != NULL) { NpcConversation::Response response; response.stringId = stringId; @@ -319,7 +319,7 @@ void TangibleObject::sendNpcConversationResponses() { if (isAuthoritative()) { - if (m_npcConversation != nullptr) + if (m_npcConversation != NULL) { m_npcConversation->sendResponses(); } @@ -327,7 +327,7 @@ void TangibleObject::sendNpcConversationResponses() else { Controller * const controller = NON_NULL(getController()); - controller->appendMessage(CM_sendNpcConversationResponses, 0.0f, nullptr, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_SERVER); + controller->appendMessage(CM_sendNpcConversationResponses, 0.0f, NULL, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_SERVER); } } @@ -342,10 +342,10 @@ void TangibleObject::respondToNpc(int responseIndex) { if (isAuthoritative()) { - if (m_npcConversation != nullptr) + if (m_npcConversation != NULL) { TangibleObject * const npc = safe_cast(m_npcConversation->getNPC().getObject()); - if (npc == nullptr) + if (npc == NULL) { endNpcConversation(); return; @@ -363,7 +363,7 @@ void TangibleObject::respondToNpc(int responseIndex) { Controller * const controller = getController(); if (controller) - controller->appendMessage(CM_npcConversationSelect, static_cast(responseIndex), nullptr, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_SERVER); + controller->appendMessage(CM_npcConversationSelect, static_cast(responseIndex), NULL, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_SERVER); } } @@ -374,7 +374,7 @@ void TangibleObject::handlePlayerResponseToNpcConversation(const std::string & c if (isAuthoritative()) { TangibleObject * const playerObject = safe_cast(NetworkIdManager::getObjectById(player)); - if (playerObject != nullptr) + if (playerObject != NULL) { // trigger OnNpcConversationResponse ScriptParams params; diff --git a/engine/server/library/serverGame/src/shared/object/UniverseObject.cpp b/engine/server/library/serverGame/src/shared/object/UniverseObject.cpp index 6e6b8d6c..6b283f5e 100755 --- a/engine/server/library/serverGame/src/shared/object/UniverseObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/UniverseObject.cpp @@ -20,7 +20,7 @@ // objvars for dynamic regions const static std::string OBJVAR_DYNAMIC_REGION("dynamic_region"); -const SharedObjectTemplate * UniverseObject::m_defaultSharedTemplate = nullptr; +const SharedObjectTemplate * UniverseObject::m_defaultSharedTemplate = NULL; // ====================================================================== @@ -56,13 +56,13 @@ const SharedObjectTemplate * UniverseObject::getDefaultSharedTemplate(void) cons { static const ConstCharCrcLowerString templateName("object/universe/base/shared_universe_default.iff"); - if (m_defaultSharedTemplate == nullptr) + if (m_defaultSharedTemplate == NULL) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create " + WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create " "default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != nullptr) + if (m_defaultSharedTemplate != NULL) ExitChain::add (removeDefaultTemplate, "UniverseObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -75,10 +75,10 @@ static const ConstCharCrcLowerString templateName("object/universe/base/shared_u */ void UniverseObject::removeDefaultTemplate(void) { - if (m_defaultSharedTemplate != nullptr) + if (m_defaultSharedTemplate != NULL) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = nullptr; + m_defaultSharedTemplate = NULL; } } // UniverseObject::removeDefaultTemplate diff --git a/engine/server/library/serverGame/src/shared/object/WeaponObject.cpp b/engine/server/library/serverGame/src/shared/object/WeaponObject.cpp index b19b7cfb..320d0c0b 100755 --- a/engine/server/library/serverGame/src/shared/object/WeaponObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/WeaponObject.cpp @@ -25,7 +25,7 @@ //---------------------------------------------------------------------- -const SharedObjectTemplate * WeaponObject::m_defaultSharedTemplate = nullptr; +const SharedObjectTemplate * WeaponObject::m_defaultSharedTemplate = NULL; static const std::string OBJVAR_CERTIFICATION = "weapon.strCertUsed"; @@ -68,13 +68,13 @@ const SharedObjectTemplate * WeaponObject::getDefaultSharedTemplate(void) const { static const ConstCharCrcLowerString templateName("object/weapon/base/shared_weapon_default.iff"); - if (m_defaultSharedTemplate == nullptr) + if (m_defaultSharedTemplate == NULL) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create " + WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create " "default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != nullptr) + if (m_defaultSharedTemplate != NULL) ExitChain::add (removeDefaultTemplate, "WeaponObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -87,10 +87,10 @@ static const ConstCharCrcLowerString templateName("object/weapon/base/shared_wea */ void WeaponObject::removeDefaultTemplate(void) { - if (m_defaultSharedTemplate != nullptr) + if (m_defaultSharedTemplate != NULL) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = nullptr; + m_defaultSharedTemplate = NULL; } } // WeaponObject::removeDefaultTemplate @@ -323,7 +323,7 @@ WeaponObject * WeaponObject::getWeaponObject(NetworkId const & networkId) { ServerObject * serverObject = ServerObject::getServerObject(networkId); - return (serverObject != nullptr) ? serverObject->asWeaponObject() : nullptr; + return (serverObject != NULL) ? serverObject->asWeaponObject() : NULL; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerArmorTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerArmorTemplate.cpp index 2e429325..a387b645 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerArmorTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerArmorTemplate.cpp @@ -53,7 +53,7 @@ ServerArmorTemplate::~ServerArmorTemplate() for (iter = m_specialProtection.begin(); iter != m_specialProtection.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_specialProtection.clear(); } @@ -105,10 +105,10 @@ Tag ServerArmorTemplate::getTemplateVersion(void) const */ Tag ServerArmorTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerArmorTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerArmorTemplate::getHighestTemplateVersion @@ -122,33 +122,33 @@ ServerArmorTemplate::ArmorRating testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getRating(true); #endif } if (!m_rating.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter rating in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == nullptr, ("Template parameter rating has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter rating has not been defined in template %s!", DataResource::getName())); return base->getRating(); } } ArmorRating value = static_cast(m_rating.getValue()); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -164,26 +164,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerArmorTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerArmorTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getIntegrity(true); #endif } if (!m_integrity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter integrity in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter integrity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter integrity has not been defined in template %s!", DataResource::getName())); return base->getIntegrity(); } } @@ -193,9 +193,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getIntegrity(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -212,7 +212,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -228,26 +228,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerArmorTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerArmorTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getIntegrityMin(true); #endif } if (!m_integrity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter integrity in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter integrity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter integrity has not been defined in template %s!", DataResource::getName())); return base->getIntegrityMin(); } } @@ -257,9 +257,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getIntegrityMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -276,7 +276,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -292,26 +292,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerArmorTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerArmorTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getIntegrityMax(true); #endif } if (!m_integrity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter integrity in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter integrity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter integrity has not been defined in template %s!", DataResource::getName())); return base->getIntegrityMax(); } } @@ -321,9 +321,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getIntegrityMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -340,7 +340,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -356,26 +356,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerArmorTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerArmorTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getEffectiveness(true); #endif } if (!m_effectiveness.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter effectiveness in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter effectiveness has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter effectiveness has not been defined in template %s!", DataResource::getName())); return base->getEffectiveness(); } } @@ -385,9 +385,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getEffectiveness(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -404,7 +404,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -420,26 +420,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerArmorTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerArmorTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getEffectivenessMin(true); #endif } if (!m_effectiveness.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter effectiveness in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter effectiveness has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter effectiveness has not been defined in template %s!", DataResource::getName())); return base->getEffectivenessMin(); } } @@ -449,9 +449,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getEffectivenessMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -468,7 +468,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -484,26 +484,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerArmorTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerArmorTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getEffectivenessMax(true); #endif } if (!m_effectiveness.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter effectiveness in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter effectiveness has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter effectiveness has not been defined in template %s!", DataResource::getName())); return base->getEffectivenessMax(); } } @@ -513,9 +513,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getEffectivenessMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -532,7 +532,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -542,28 +542,28 @@ UNREF(testData); void ServerArmorTemplate::getSpecialProtection(SpecialProtection &data, int index) const { - const ServerArmorTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerArmorTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_specialProtectionLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter specialProtection in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter specialProtection has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter specialProtection has not been defined in template %s!", DataResource::getName())); base->getSpecialProtection(data, index); return; } } - if (m_specialProtectionAppend && base != nullptr) + if (m_specialProtectionAppend && base != NULL) { int baseCount = base->getSpecialProtectionCount(); if (index < baseCount) @@ -585,28 +585,28 @@ void ServerArmorTemplate::getSpecialProtection(SpecialProtection &data, int inde void ServerArmorTemplate::getSpecialProtectionMin(SpecialProtection &data, int index) const { - const ServerArmorTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerArmorTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_specialProtectionLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter specialProtection in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter specialProtection has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter specialProtection has not been defined in template %s!", DataResource::getName())); base->getSpecialProtectionMin(data, index); return; } } - if (m_specialProtectionAppend && base != nullptr) + if (m_specialProtectionAppend && base != NULL) { int baseCount = base->getSpecialProtectionCount(); if (index < baseCount) @@ -628,28 +628,28 @@ void ServerArmorTemplate::getSpecialProtectionMin(SpecialProtection &data, int i void ServerArmorTemplate::getSpecialProtectionMax(SpecialProtection &data, int index) const { - const ServerArmorTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerArmorTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_specialProtectionLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter specialProtection in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter specialProtection has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter specialProtection has not been defined in template %s!", DataResource::getName())); base->getSpecialProtectionMax(data, index); return; } } - if (m_specialProtectionAppend && base != nullptr) + if (m_specialProtectionAppend && base != NULL) { int baseCount = base->getSpecialProtectionCount(); if (index < baseCount) @@ -673,20 +673,20 @@ size_t ServerArmorTemplate::getSpecialProtectionCount(void) const { if (!m_specialProtectionLoaded) { - if (m_baseData == nullptr) + if (m_baseData == NULL) return 0; const ServerArmorTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == nullptr, ("base template wrong type")); + DEBUG_FATAL(base == NULL, ("base template wrong type")); return base->getSpecialProtectionCount(); } size_t count = m_specialProtection.size(); // if we are extending our base template, add it's count - if (m_specialProtectionAppend && m_baseData != nullptr) + if (m_specialProtectionAppend && m_baseData != NULL) { const ServerArmorTemplate * base = dynamic_cast(m_baseData); - if (base != nullptr) + if (base != NULL) count += base->getSpecialProtectionCount(); } @@ -701,26 +701,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerArmorTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerArmorTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getVulnerability(true); #endif } if (!m_vulnerability.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter vulnerability in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter vulnerability has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter vulnerability has not been defined in template %s!", DataResource::getName())); return base->getVulnerability(); } } @@ -730,9 +730,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getVulnerability(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -749,7 +749,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -765,26 +765,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerArmorTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerArmorTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getVulnerabilityMin(true); #endif } if (!m_vulnerability.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter vulnerability in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter vulnerability has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter vulnerability has not been defined in template %s!", DataResource::getName())); return base->getVulnerabilityMin(); } } @@ -794,9 +794,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getVulnerabilityMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -813,7 +813,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -829,26 +829,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerArmorTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerArmorTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getVulnerabilityMax(true); #endif } if (!m_vulnerability.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter vulnerability in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter vulnerability has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter vulnerability has not been defined in template %s!", DataResource::getName())); return base->getVulnerabilityMax(); } } @@ -858,9 +858,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getVulnerabilityMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -877,7 +877,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -887,8 +887,8 @@ UNREF(testData); int ServerArmorTemplate::getEncumbrance(int index) const { - const ServerArmorTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerArmorTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } @@ -896,14 +896,14 @@ int ServerArmorTemplate::getEncumbrance(int index) const DEBUG_FATAL(index < 0 || index >= 3, ("template param index out of range")); if (!m_encumbrance[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter encumbrance in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter encumbrance has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter encumbrance has not been defined in template %s!", DataResource::getName())); return base->getEncumbrance(index); } } @@ -913,9 +913,9 @@ int ServerArmorTemplate::getEncumbrance(int index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getEncumbrance(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -936,8 +936,8 @@ int ServerArmorTemplate::getEncumbrance(int index) const int ServerArmorTemplate::getEncumbranceMin(int index) const { - const ServerArmorTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerArmorTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } @@ -945,14 +945,14 @@ int ServerArmorTemplate::getEncumbranceMin(int index) const DEBUG_FATAL(index < 0 || index >= 3, ("template param index out of range")); if (!m_encumbrance[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter encumbrance in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter encumbrance has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter encumbrance has not been defined in template %s!", DataResource::getName())); return base->getEncumbranceMin(index); } } @@ -962,9 +962,9 @@ int ServerArmorTemplate::getEncumbranceMin(int index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getEncumbranceMin(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -985,8 +985,8 @@ int ServerArmorTemplate::getEncumbranceMin(int index) const int ServerArmorTemplate::getEncumbranceMax(int index) const { - const ServerArmorTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerArmorTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } @@ -994,14 +994,14 @@ int ServerArmorTemplate::getEncumbranceMax(int index) const DEBUG_FATAL(index < 0 || index >= 3, ("template param index out of range")); if (!m_encumbrance[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter encumbrance in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter encumbrance has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter encumbrance has not been defined in template %s!", DataResource::getName())); return base->getEncumbranceMax(index); } } @@ -1011,9 +1011,9 @@ int ServerArmorTemplate::getEncumbranceMax(int index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getEncumbranceMax(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1074,12 +1074,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } @@ -1114,7 +1114,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_specialProtection.begin(); iter != m_specialProtection.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_specialProtection.clear(); m_specialProtectionAppend = file.read_bool8(); @@ -1205,33 +1205,33 @@ ServerArmorTemplate::DamageType testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getType(true); #endif } if (!m_type.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter type in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == nullptr, ("Template parameter type has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter type has not been defined in template %s!", DataResource::getName())); return base->getType(versionOk); } } DamageType value = static_cast(m_type.getValue()); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1247,26 +1247,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerArmorTemplate::_SpecialProtection * base = nullptr; - if (m_baseData != nullptr) + const ServerArmorTemplate::_SpecialProtection * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getEffectiveness(true); #endif } if (!m_effectiveness.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter effectiveness in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter effectiveness has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter effectiveness has not been defined in template %s!", DataResource::getName())); return base->getEffectiveness(versionOk); } } @@ -1276,9 +1276,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getEffectiveness(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1295,7 +1295,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1311,26 +1311,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerArmorTemplate::_SpecialProtection * base = nullptr; - if (m_baseData != nullptr) + const ServerArmorTemplate::_SpecialProtection * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getEffectivenessMin(true); #endif } if (!m_effectiveness.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter effectiveness in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter effectiveness has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter effectiveness has not been defined in template %s!", DataResource::getName())); return base->getEffectivenessMin(versionOk); } } @@ -1340,9 +1340,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getEffectivenessMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1359,7 +1359,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1375,26 +1375,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerArmorTemplate::_SpecialProtection * base = nullptr; - if (m_baseData != nullptr) + const ServerArmorTemplate::_SpecialProtection * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getEffectivenessMax(true); #endif } if (!m_effectiveness.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter effectiveness in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter effectiveness has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter effectiveness has not been defined in template %s!", DataResource::getName())); return base->getEffectivenessMax(versionOk); } } @@ -1404,9 +1404,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getEffectivenessMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1423,7 +1423,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerBattlefieldMarkerObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerBattlefieldMarkerObjectTemplate.cpp index 0a63ff2d..98360e9b 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerBattlefieldMarkerObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerBattlefieldMarkerObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag ServerBattlefieldMarkerObjectTemplate::getTemplateVersion(void) const */ Tag ServerBattlefieldMarkerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerBattlefieldMarkerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerBattlefieldMarkerObjectTemplate::getHighestTemplateVersion @@ -150,12 +150,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerBuildingObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerBuildingObjectTemplate.cpp index 57d3ab90..57086652 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerBuildingObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerBuildingObjectTemplate.cpp @@ -93,10 +93,10 @@ Tag ServerBuildingObjectTemplate::getTemplateVersion(void) const */ Tag ServerBuildingObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerBuildingObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerBuildingObjectTemplate::getHighestTemplateVersion @@ -120,26 +120,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerBuildingObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerBuildingObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMaintenanceCost(true); #endif } if (!m_maintenanceCost.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter maintenanceCost in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter maintenanceCost has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter maintenanceCost has not been defined in template %s!", DataResource::getName())); return base->getMaintenanceCost(); } } @@ -149,9 +149,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMaintenanceCost(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -168,7 +168,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -184,26 +184,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerBuildingObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerBuildingObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMaintenanceCostMin(true); #endif } if (!m_maintenanceCost.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter maintenanceCost in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter maintenanceCost has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter maintenanceCost has not been defined in template %s!", DataResource::getName())); return base->getMaintenanceCostMin(); } } @@ -213,9 +213,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMaintenanceCostMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -232,7 +232,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -248,26 +248,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerBuildingObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerBuildingObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMaintenanceCostMax(true); #endif } if (!m_maintenanceCost.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter maintenanceCost in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter maintenanceCost has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter maintenanceCost has not been defined in template %s!", DataResource::getName())); return base->getMaintenanceCostMax(); } } @@ -277,9 +277,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMaintenanceCostMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -296,7 +296,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -312,33 +312,33 @@ bool testDataValue = false; UNREF(testData); #endif - const ServerBuildingObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerBuildingObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getIsPublic(true); #endif } if (!m_isPublic.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter isPublic in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter isPublic has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter isPublic has not been defined in template %s!", DataResource::getName())); return base->getIsPublic(); } } bool value = m_isPublic.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -386,12 +386,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerCellObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerCellObjectTemplate.cpp index 0c39dc7c..5a35a6f9 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerCellObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerCellObjectTemplate.cpp @@ -99,10 +99,10 @@ Tag ServerCellObjectTemplate::getTemplateVersion(void) const */ Tag ServerCellObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerCellObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerCellObjectTemplate::getHighestTemplateVersion @@ -155,12 +155,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerCityObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerCityObjectTemplate.cpp index 0f328d56..0b59a960 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerCityObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerCityObjectTemplate.cpp @@ -95,10 +95,10 @@ Tag ServerCityObjectTemplate::getTemplateVersion(void) const */ Tag ServerCityObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerCityObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerCityObjectTemplate::getHighestTemplateVersion @@ -151,12 +151,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerConstructionContractObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerConstructionContractObjectTemplate.cpp index ba882146..6daeee45 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerConstructionContractObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerConstructionContractObjectTemplate.cpp @@ -84,10 +84,10 @@ Tag ServerConstructionContractObjectTemplate::getTemplateVersion(void) const */ Tag ServerConstructionContractObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerConstructionContractObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerConstructionContractObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerCreatureObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerCreatureObjectTemplate.cpp index f1be807d..babf8d0a 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerCreatureObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerCreatureObjectTemplate.cpp @@ -56,7 +56,7 @@ ServerCreatureObjectTemplate::~ServerCreatureObjectTemplate() for (iter = m_attribMods.begin(); iter != m_attribMods.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_attribMods.clear(); } @@ -108,10 +108,10 @@ Tag ServerCreatureObjectTemplate::getTemplateVersion(void) const */ Tag ServerCreatureObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerCreatureObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerCreatureObjectTemplate::getHighestTemplateVersion @@ -129,32 +129,32 @@ Object * ServerCreatureObjectTemplate::createObject(void) const //@BEGIN TFD const ServerWeaponObjectTemplate * ServerCreatureObjectTemplate::getDefaultWeapon() const { - const ServerCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_defaultWeapon.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter defaultWeapon in template %s", DataResource::getName())); - return nullptr; + return NULL; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter defaultWeapon has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter defaultWeapon has not been defined in template %s!", DataResource::getName())); return base->getDefaultWeapon(); } } - const ServerWeaponObjectTemplate * returnValue = nullptr; + const ServerWeaponObjectTemplate * returnValue = NULL; const std::string & templateName = m_defaultWeapon.getValue(); if (!templateName.empty()) { returnValue = dynamic_cast(ObjectTemplateList::fetch(templateName)); - if (returnValue == nullptr) + if (returnValue == NULL) WARNING_STRICT_FATAL(true, ("Error loading template %s",templateName.c_str())); } return returnValue; @@ -162,8 +162,8 @@ const ServerWeaponObjectTemplate * ServerCreatureObjectTemplate::getDefaultWeapo int ServerCreatureObjectTemplate::getAttributes(Attributes index) const { - const ServerCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } @@ -171,14 +171,14 @@ int ServerCreatureObjectTemplate::getAttributes(Attributes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 6, ("template param static_cast(index) getAttributes(index); } } @@ -188,9 +188,9 @@ int ServerCreatureObjectTemplate::getAttributes(Attributes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getAttributes(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -211,8 +211,8 @@ int ServerCreatureObjectTemplate::getAttributes(Attributes index) const int ServerCreatureObjectTemplate::getAttributesMin(Attributes index) const { - const ServerCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } @@ -220,14 +220,14 @@ int ServerCreatureObjectTemplate::getAttributesMin(Attributes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 6, ("template param static_cast(index) getAttributesMin(index); } } @@ -237,9 +237,9 @@ int ServerCreatureObjectTemplate::getAttributesMin(Attributes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getAttributesMin(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -260,8 +260,8 @@ int ServerCreatureObjectTemplate::getAttributesMin(Attributes index) const int ServerCreatureObjectTemplate::getAttributesMax(Attributes index) const { - const ServerCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } @@ -269,14 +269,14 @@ int ServerCreatureObjectTemplate::getAttributesMax(Attributes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 6, ("template param static_cast(index) getAttributesMax(index); } } @@ -286,9 +286,9 @@ int ServerCreatureObjectTemplate::getAttributesMax(Attributes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getAttributesMax(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -309,8 +309,8 @@ int ServerCreatureObjectTemplate::getAttributesMax(Attributes index) const int ServerCreatureObjectTemplate::getMinAttributes(Attributes index) const { - const ServerCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } @@ -318,14 +318,14 @@ int ServerCreatureObjectTemplate::getMinAttributes(Attributes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 6, ("template param static_cast(index) getMinAttributes(index); } } @@ -335,9 +335,9 @@ int ServerCreatureObjectTemplate::getMinAttributes(Attributes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMinAttributes(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -358,8 +358,8 @@ int ServerCreatureObjectTemplate::getMinAttributes(Attributes index) const int ServerCreatureObjectTemplate::getMinAttributesMin(Attributes index) const { - const ServerCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } @@ -367,14 +367,14 @@ int ServerCreatureObjectTemplate::getMinAttributesMin(Attributes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 6, ("template param static_cast(index) getMinAttributesMin(index); } } @@ -384,9 +384,9 @@ int ServerCreatureObjectTemplate::getMinAttributesMin(Attributes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMinAttributesMin(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -407,8 +407,8 @@ int ServerCreatureObjectTemplate::getMinAttributesMin(Attributes index) const int ServerCreatureObjectTemplate::getMinAttributesMax(Attributes index) const { - const ServerCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } @@ -416,14 +416,14 @@ int ServerCreatureObjectTemplate::getMinAttributesMax(Attributes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 6, ("template param static_cast(index) getMinAttributesMax(index); } } @@ -433,9 +433,9 @@ int ServerCreatureObjectTemplate::getMinAttributesMax(Attributes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMinAttributesMax(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -456,8 +456,8 @@ int ServerCreatureObjectTemplate::getMinAttributesMax(Attributes index) const int ServerCreatureObjectTemplate::getMaxAttributes(Attributes index) const { - const ServerCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } @@ -465,14 +465,14 @@ int ServerCreatureObjectTemplate::getMaxAttributes(Attributes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 6, ("template param static_cast(index) getMaxAttributes(index); } } @@ -482,9 +482,9 @@ int ServerCreatureObjectTemplate::getMaxAttributes(Attributes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMaxAttributes(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -505,8 +505,8 @@ int ServerCreatureObjectTemplate::getMaxAttributes(Attributes index) const int ServerCreatureObjectTemplate::getMaxAttributesMin(Attributes index) const { - const ServerCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } @@ -514,14 +514,14 @@ int ServerCreatureObjectTemplate::getMaxAttributesMin(Attributes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 6, ("template param static_cast(index) getMaxAttributesMin(index); } } @@ -531,9 +531,9 @@ int ServerCreatureObjectTemplate::getMaxAttributesMin(Attributes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMaxAttributesMin(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -554,8 +554,8 @@ int ServerCreatureObjectTemplate::getMaxAttributesMin(Attributes index) const int ServerCreatureObjectTemplate::getMaxAttributesMax(Attributes index) const { - const ServerCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } @@ -563,14 +563,14 @@ int ServerCreatureObjectTemplate::getMaxAttributesMax(Attributes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 6, ("template param static_cast(index) getMaxAttributesMax(index); } } @@ -580,9 +580,9 @@ int ServerCreatureObjectTemplate::getMaxAttributesMax(Attributes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMaxAttributesMax(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -609,26 +609,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMinDrainModifier(true); #endif } if (!m_minDrainModifier.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter minDrainModifier in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter minDrainModifier has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter minDrainModifier has not been defined in template %s!", DataResource::getName())); return base->getMinDrainModifier(); } } @@ -638,9 +638,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMinDrainModifier(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -657,7 +657,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -673,26 +673,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMinDrainModifierMin(true); #endif } if (!m_minDrainModifier.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter minDrainModifier in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter minDrainModifier has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter minDrainModifier has not been defined in template %s!", DataResource::getName())); return base->getMinDrainModifierMin(); } } @@ -702,9 +702,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMinDrainModifierMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -721,7 +721,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -737,26 +737,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMinDrainModifierMax(true); #endif } if (!m_minDrainModifier.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter minDrainModifier in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter minDrainModifier has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter minDrainModifier has not been defined in template %s!", DataResource::getName())); return base->getMinDrainModifierMax(); } } @@ -766,9 +766,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMinDrainModifierMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -785,7 +785,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -801,26 +801,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMaxDrainModifier(true); #endif } if (!m_maxDrainModifier.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxDrainModifier in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter maxDrainModifier has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter maxDrainModifier has not been defined in template %s!", DataResource::getName())); return base->getMaxDrainModifier(); } } @@ -830,9 +830,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMaxDrainModifier(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -849,7 +849,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -865,26 +865,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMaxDrainModifierMin(true); #endif } if (!m_maxDrainModifier.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxDrainModifier in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter maxDrainModifier has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter maxDrainModifier has not been defined in template %s!", DataResource::getName())); return base->getMaxDrainModifierMin(); } } @@ -894,9 +894,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMaxDrainModifierMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -913,7 +913,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -929,26 +929,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMaxDrainModifierMax(true); #endif } if (!m_maxDrainModifier.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxDrainModifier in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter maxDrainModifier has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter maxDrainModifier has not been defined in template %s!", DataResource::getName())); return base->getMaxDrainModifierMax(); } } @@ -958,9 +958,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMaxDrainModifierMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -977,7 +977,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -993,26 +993,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMinFaucetModifier(true); #endif } if (!m_minFaucetModifier.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter minFaucetModifier in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter minFaucetModifier has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter minFaucetModifier has not been defined in template %s!", DataResource::getName())); return base->getMinFaucetModifier(); } } @@ -1022,9 +1022,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMinFaucetModifier(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1041,7 +1041,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1057,26 +1057,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMinFaucetModifierMin(true); #endif } if (!m_minFaucetModifier.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter minFaucetModifier in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter minFaucetModifier has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter minFaucetModifier has not been defined in template %s!", DataResource::getName())); return base->getMinFaucetModifierMin(); } } @@ -1086,9 +1086,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMinFaucetModifierMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1105,7 +1105,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1121,26 +1121,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMinFaucetModifierMax(true); #endif } if (!m_minFaucetModifier.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter minFaucetModifier in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter minFaucetModifier has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter minFaucetModifier has not been defined in template %s!", DataResource::getName())); return base->getMinFaucetModifierMax(); } } @@ -1150,9 +1150,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMinFaucetModifierMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1169,7 +1169,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1185,26 +1185,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMaxFaucetModifier(true); #endif } if (!m_maxFaucetModifier.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxFaucetModifier in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter maxFaucetModifier has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter maxFaucetModifier has not been defined in template %s!", DataResource::getName())); return base->getMaxFaucetModifier(); } } @@ -1214,9 +1214,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMaxFaucetModifier(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1233,7 +1233,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1249,26 +1249,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMaxFaucetModifierMin(true); #endif } if (!m_maxFaucetModifier.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxFaucetModifier in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter maxFaucetModifier has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter maxFaucetModifier has not been defined in template %s!", DataResource::getName())); return base->getMaxFaucetModifierMin(); } } @@ -1278,9 +1278,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMaxFaucetModifierMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1297,7 +1297,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1313,26 +1313,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMaxFaucetModifierMax(true); #endif } if (!m_maxFaucetModifier.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxFaucetModifier in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter maxFaucetModifier has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter maxFaucetModifier has not been defined in template %s!", DataResource::getName())); return base->getMaxFaucetModifierMax(); } } @@ -1342,9 +1342,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMaxFaucetModifierMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1361,7 +1361,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1371,28 +1371,28 @@ UNREF(testData); void ServerCreatureObjectTemplate::getAttribMods(AttribMod &data, int index) const { - const ServerCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_attribModsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter attribMods in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter attribMods has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter attribMods has not been defined in template %s!", DataResource::getName())); base->getAttribMods(data, index); return; } } - if (m_attribModsAppend && base != nullptr) + if (m_attribModsAppend && base != NULL) { int baseCount = base->getAttribModsCount(); if (static_cast(index) < baseCount) @@ -1417,28 +1417,28 @@ void ServerCreatureObjectTemplate::getAttribMods(AttribMod &data, int index) con void ServerCreatureObjectTemplate::getAttribModsMin(AttribMod &data, int index) const { - const ServerCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_attribModsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter attribMods in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter attribMods has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter attribMods has not been defined in template %s!", DataResource::getName())); base->getAttribModsMin(data, index); return; } } - if (m_attribModsAppend && base != nullptr) + if (m_attribModsAppend && base != NULL) { int baseCount = base->getAttribModsCount(); if (static_cast(index) < baseCount) @@ -1463,28 +1463,28 @@ void ServerCreatureObjectTemplate::getAttribModsMin(AttribMod &data, int index) void ServerCreatureObjectTemplate::getAttribModsMax(AttribMod &data, int index) const { - const ServerCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_attribModsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter attribMods in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter attribMods has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter attribMods has not been defined in template %s!", DataResource::getName())); base->getAttribModsMax(data, index); return; } } - if (m_attribModsAppend && base != nullptr) + if (m_attribModsAppend && base != NULL) { int baseCount = base->getAttribModsCount(); if (static_cast(index) < baseCount) @@ -1511,20 +1511,20 @@ size_t ServerCreatureObjectTemplate::getAttribModsCount(void) const { if (!m_attribModsLoaded) { - if (m_baseData == nullptr) + if (m_baseData == NULL) return 0; const ServerCreatureObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == nullptr, ("base template wrong type")); + DEBUG_FATAL(base == NULL, ("base template wrong type")); return base->getAttribModsCount(); } size_t count = m_attribMods.size(); // if we are extending our base template, add it's count - if (m_attribModsAppend && m_baseData != nullptr) + if (m_attribModsAppend && m_baseData != NULL) { const ServerCreatureObjectTemplate * base = dynamic_cast(m_baseData); - if (base != nullptr) + if (base != NULL) count += base->getAttribModsCount(); } @@ -1539,26 +1539,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getShockWounds(true); #endif } if (!m_shockWounds.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter shockWounds in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter shockWounds has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter shockWounds has not been defined in template %s!", DataResource::getName())); return base->getShockWounds(); } } @@ -1568,9 +1568,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getShockWounds(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1587,7 +1587,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1603,26 +1603,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getShockWoundsMin(true); #endif } if (!m_shockWounds.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter shockWounds in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter shockWounds has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter shockWounds has not been defined in template %s!", DataResource::getName())); return base->getShockWoundsMin(); } } @@ -1632,9 +1632,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getShockWoundsMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1651,7 +1651,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1667,26 +1667,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getShockWoundsMax(true); #endif } if (!m_shockWounds.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter shockWounds in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter shockWounds has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter shockWounds has not been defined in template %s!", DataResource::getName())); return base->getShockWoundsMax(); } } @@ -1696,9 +1696,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getShockWoundsMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1715,7 +1715,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1731,33 +1731,33 @@ bool testDataValue = false; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getCanCreateAvatar(true); #endif } if (!m_canCreateAvatar.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter canCreateAvatar in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter canCreateAvatar has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter canCreateAvatar has not been defined in template %s!", DataResource::getName())); return base->getCanCreateAvatar(); } } bool value = m_canCreateAvatar.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1773,33 +1773,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getNameGeneratorType(true); #endif } if (!m_nameGeneratorType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter nameGeneratorType in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter nameGeneratorType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter nameGeneratorType has not been defined in template %s!", DataResource::getName())); return base->getNameGeneratorType(); } } const std::string & value = m_nameGeneratorType.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1815,26 +1815,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getApproachTriggerRange(true); #endif } if (!m_approachTriggerRange.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter approachTriggerRange in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter approachTriggerRange has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter approachTriggerRange has not been defined in template %s!", DataResource::getName())); return base->getApproachTriggerRange(); } } @@ -1844,9 +1844,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getApproachTriggerRange(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1863,7 +1863,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1879,26 +1879,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getApproachTriggerRangeMin(true); #endif } if (!m_approachTriggerRange.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter approachTriggerRange in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter approachTriggerRange has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter approachTriggerRange has not been defined in template %s!", DataResource::getName())); return base->getApproachTriggerRangeMin(); } } @@ -1908,9 +1908,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getApproachTriggerRangeMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1927,7 +1927,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1943,26 +1943,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getApproachTriggerRangeMax(true); #endif } if (!m_approachTriggerRange.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter approachTriggerRange in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter approachTriggerRange has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter approachTriggerRange has not been defined in template %s!", DataResource::getName())); return base->getApproachTriggerRangeMax(); } } @@ -1972,9 +1972,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getApproachTriggerRangeMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1991,7 +1991,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2001,8 +2001,8 @@ UNREF(testData); float ServerCreatureObjectTemplate::getMaxMentalStates(MentalStates index) const { - const ServerCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } @@ -2010,14 +2010,14 @@ float ServerCreatureObjectTemplate::getMaxMentalStates(MentalStates index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 4, ("template param static_cast(index) getMaxMentalStates(index); } } @@ -2027,9 +2027,9 @@ float ServerCreatureObjectTemplate::getMaxMentalStates(MentalStates index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMaxMentalStates(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2050,8 +2050,8 @@ float ServerCreatureObjectTemplate::getMaxMentalStates(MentalStates index) const float ServerCreatureObjectTemplate::getMaxMentalStatesMin(MentalStates index) const { - const ServerCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } @@ -2059,14 +2059,14 @@ float ServerCreatureObjectTemplate::getMaxMentalStatesMin(MentalStates index) co DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 4, ("template param static_cast(index) getMaxMentalStatesMin(index); } } @@ -2076,9 +2076,9 @@ float ServerCreatureObjectTemplate::getMaxMentalStatesMin(MentalStates index) co if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMaxMentalStatesMin(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2099,8 +2099,8 @@ float ServerCreatureObjectTemplate::getMaxMentalStatesMin(MentalStates index) co float ServerCreatureObjectTemplate::getMaxMentalStatesMax(MentalStates index) const { - const ServerCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } @@ -2108,14 +2108,14 @@ float ServerCreatureObjectTemplate::getMaxMentalStatesMax(MentalStates index) co DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 4, ("template param static_cast(index) getMaxMentalStatesMax(index); } } @@ -2125,9 +2125,9 @@ float ServerCreatureObjectTemplate::getMaxMentalStatesMax(MentalStates index) co if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMaxMentalStatesMax(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2148,8 +2148,8 @@ float ServerCreatureObjectTemplate::getMaxMentalStatesMax(MentalStates index) co float ServerCreatureObjectTemplate::getMentalStatesDecay(MentalStates index) const { - const ServerCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } @@ -2157,14 +2157,14 @@ float ServerCreatureObjectTemplate::getMentalStatesDecay(MentalStates index) con DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 4, ("template param static_cast(index) getMentalStatesDecay(index); } } @@ -2174,9 +2174,9 @@ float ServerCreatureObjectTemplate::getMentalStatesDecay(MentalStates index) con if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMentalStatesDecay(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2197,8 +2197,8 @@ float ServerCreatureObjectTemplate::getMentalStatesDecay(MentalStates index) con float ServerCreatureObjectTemplate::getMentalStatesDecayMin(MentalStates index) const { - const ServerCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } @@ -2206,14 +2206,14 @@ float ServerCreatureObjectTemplate::getMentalStatesDecayMin(MentalStates index) DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 4, ("template param static_cast(index) getMentalStatesDecayMin(index); } } @@ -2223,9 +2223,9 @@ float ServerCreatureObjectTemplate::getMentalStatesDecayMin(MentalStates index) if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMentalStatesDecayMin(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2246,8 +2246,8 @@ float ServerCreatureObjectTemplate::getMentalStatesDecayMin(MentalStates index) float ServerCreatureObjectTemplate::getMentalStatesDecayMax(MentalStates index) const { - const ServerCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } @@ -2255,14 +2255,14 @@ float ServerCreatureObjectTemplate::getMentalStatesDecayMax(MentalStates index) DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 4, ("template param static_cast(index) getMentalStatesDecayMax(index); } } @@ -2272,9 +2272,9 @@ float ServerCreatureObjectTemplate::getMentalStatesDecayMax(MentalStates index) if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMentalStatesDecayMax(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2344,12 +2344,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } @@ -2430,7 +2430,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_attribMods.begin(); iter != m_attribMods.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_attribMods.clear(); m_attribModsAppend = file.read_bool8(); diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerDraftSchematicObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerDraftSchematicObjectTemplate.cpp index 5cfd4169..6ed8a518 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerDraftSchematicObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerDraftSchematicObjectTemplate.cpp @@ -58,7 +58,7 @@ ServerDraftSchematicObjectTemplate::~ServerDraftSchematicObjectTemplate() for (iter = m_slots.begin(); iter != m_slots.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_slots.clear(); } @@ -67,7 +67,7 @@ ServerDraftSchematicObjectTemplate::~ServerDraftSchematicObjectTemplate() for (iter = m_skillCommands.begin(); iter != m_skillCommands.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_skillCommands.clear(); } @@ -76,7 +76,7 @@ ServerDraftSchematicObjectTemplate::~ServerDraftSchematicObjectTemplate() for (iter = m_manufactureScripts.begin(); iter != m_manufactureScripts.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_manufactureScripts.clear(); } @@ -128,10 +128,10 @@ Tag ServerDraftSchematicObjectTemplate::getTemplateVersion(void) const */ Tag ServerDraftSchematicObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerDraftSchematicObjectTemplate::getHighestTemplateVersion @@ -152,7 +152,7 @@ Object * ServerDraftSchematicObjectTemplate::createObject(void) const WARNING(true, ("Trying to create a draft schematic %s outside the draft " "schematic factory!\n", getName())); - return nullptr; + return NULL; } // ServerDraftSchematicObjectTemplate::createObject /** @@ -188,33 +188,33 @@ ServerDraftSchematicObjectTemplate::CraftingType testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getCategory(true); #endif } if (!m_category.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter category in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == nullptr, ("Template parameter category has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter category has not been defined in template %s!", DataResource::getName())); return base->getCategory(); } } CraftingType value = static_cast(m_category.getValue()); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -224,86 +224,86 @@ UNREF(testData); const ServerObjectTemplate * ServerDraftSchematicObjectTemplate::getCraftedObjectTemplate() const { - const ServerDraftSchematicObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerDraftSchematicObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_craftedObjectTemplate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter craftedObjectTemplate in template %s", DataResource::getName())); - return nullptr; + return NULL; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter craftedObjectTemplate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter craftedObjectTemplate has not been defined in template %s!", DataResource::getName())); return base->getCraftedObjectTemplate(); } } const std::string & templateName = m_craftedObjectTemplate.getValue(); const ServerObjectTemplate * returnValue = dynamic_cast(ObjectTemplateList::fetch(templateName)); - if (returnValue == nullptr) + if (returnValue == NULL) WARNING_STRICT_FATAL(true, ("Error loading template %s",templateName.c_str())); return returnValue; } // ServerDraftSchematicObjectTemplate::getCraftedObjectTemplate const ServerFactoryObjectTemplate * ServerDraftSchematicObjectTemplate::getCrateObjectTemplate() const { - const ServerDraftSchematicObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerDraftSchematicObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_crateObjectTemplate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter crateObjectTemplate in template %s", DataResource::getName())); - return nullptr; + return NULL; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter crateObjectTemplate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter crateObjectTemplate has not been defined in template %s!", DataResource::getName())); return base->getCrateObjectTemplate(); } } const std::string & templateName = m_crateObjectTemplate.getValue(); const ServerFactoryObjectTemplate * returnValue = dynamic_cast(ObjectTemplateList::fetch(templateName)); - if (returnValue == nullptr) + if (returnValue == NULL) WARNING_STRICT_FATAL(true, ("Error loading template %s",templateName.c_str())); return returnValue; } // ServerDraftSchematicObjectTemplate::getCrateObjectTemplate void ServerDraftSchematicObjectTemplate::getSlots(IngredientSlot &data, int index) const { - const ServerDraftSchematicObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerDraftSchematicObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_slotsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter slots in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter slots has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter slots has not been defined in template %s!", DataResource::getName())); base->getSlots(data, index); return; } } - if (m_slotsAppend && base != nullptr) + if (m_slotsAppend && base != NULL) { int baseCount = base->getSlotsCount(); if (index < baseCount) @@ -335,28 +335,28 @@ void ServerDraftSchematicObjectTemplate::getSlots(IngredientSlot &data, int inde void ServerDraftSchematicObjectTemplate::getSlotsMin(IngredientSlot &data, int index) const { - const ServerDraftSchematicObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerDraftSchematicObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_slotsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter slots in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter slots has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter slots has not been defined in template %s!", DataResource::getName())); base->getSlotsMin(data, index); return; } } - if (m_slotsAppend && base != nullptr) + if (m_slotsAppend && base != NULL) { int baseCount = base->getSlotsCount(); if (index < baseCount) @@ -388,28 +388,28 @@ void ServerDraftSchematicObjectTemplate::getSlotsMin(IngredientSlot &data, int i void ServerDraftSchematicObjectTemplate::getSlotsMax(IngredientSlot &data, int index) const { - const ServerDraftSchematicObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerDraftSchematicObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_slotsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter slots in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter slots has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter slots has not been defined in template %s!", DataResource::getName())); base->getSlotsMax(data, index); return; } } - if (m_slotsAppend && base != nullptr) + if (m_slotsAppend && base != NULL) { int baseCount = base->getSlotsCount(); if (index < baseCount) @@ -443,20 +443,20 @@ size_t ServerDraftSchematicObjectTemplate::getSlotsCount(void) const { if (!m_slotsLoaded) { - if (m_baseData == nullptr) + if (m_baseData == NULL) return 0; const ServerDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == nullptr, ("base template wrong type")); + DEBUG_FATAL(base == NULL, ("base template wrong type")); return base->getSlotsCount(); } size_t count = m_slots.size(); // if we are extending our base template, add it's count - if (m_slotsAppend && m_baseData != nullptr) + if (m_slotsAppend && m_baseData != NULL) { const ServerDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base != nullptr) + if (base != NULL) count += base->getSlotsCount(); } @@ -465,27 +465,27 @@ size_t ServerDraftSchematicObjectTemplate::getSlotsCount(void) const const std::string & ServerDraftSchematicObjectTemplate::getSkillCommands(int index) const { - const ServerDraftSchematicObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerDraftSchematicObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_skillCommandsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter skillCommands in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter skillCommands has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter skillCommands has not been defined in template %s!", DataResource::getName())); return base->getSkillCommands(index); } } - if (m_skillCommandsAppend && base != nullptr) + if (m_skillCommandsAppend && base != NULL) { int baseCount = base->getSkillCommandsCount(); if (index < baseCount) @@ -502,20 +502,20 @@ size_t ServerDraftSchematicObjectTemplate::getSkillCommandsCount(void) const { if (!m_skillCommandsLoaded) { - if (m_baseData == nullptr) + if (m_baseData == NULL) return 0; const ServerDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == nullptr, ("base template wrong type")); + DEBUG_FATAL(base == NULL, ("base template wrong type")); return base->getSkillCommandsCount(); } size_t count = m_skillCommands.size(); // if we are extending our base template, add it's count - if (m_skillCommandsAppend && m_baseData != nullptr) + if (m_skillCommandsAppend && m_baseData != NULL) { const ServerDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base != nullptr) + if (base != NULL) count += base->getSkillCommandsCount(); } @@ -530,33 +530,33 @@ bool testDataValue = false; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerDraftSchematicObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getDestroyIngredients(true); #endif } if (!m_destroyIngredients.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter destroyIngredients in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter destroyIngredients has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter destroyIngredients has not been defined in template %s!", DataResource::getName())); return base->getDestroyIngredients(); } } bool value = m_destroyIngredients.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -566,27 +566,27 @@ UNREF(testData); const std::string & ServerDraftSchematicObjectTemplate::getManufactureScripts(int index) const { - const ServerDraftSchematicObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerDraftSchematicObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_manufactureScriptsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter manufactureScripts in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter manufactureScripts has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter manufactureScripts has not been defined in template %s!", DataResource::getName())); return base->getManufactureScripts(index); } } - if (m_manufactureScriptsAppend && base != nullptr) + if (m_manufactureScriptsAppend && base != NULL) { int baseCount = base->getManufactureScriptsCount(); if (index < baseCount) @@ -603,20 +603,20 @@ size_t ServerDraftSchematicObjectTemplate::getManufactureScriptsCount(void) cons { if (!m_manufactureScriptsLoaded) { - if (m_baseData == nullptr) + if (m_baseData == NULL) return 0; const ServerDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == nullptr, ("base template wrong type")); + DEBUG_FATAL(base == NULL, ("base template wrong type")); return base->getManufactureScriptsCount(); } size_t count = m_manufactureScripts.size(); // if we are extending our base template, add it's count - if (m_manufactureScriptsAppend && m_baseData != nullptr) + if (m_manufactureScriptsAppend && m_baseData != NULL) { const ServerDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base != nullptr) + if (base != NULL) count += base->getManufactureScriptsCount(); } @@ -631,26 +631,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerDraftSchematicObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getItemsPerContainer(true); #endif } if (!m_itemsPerContainer.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter itemsPerContainer in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter itemsPerContainer has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter itemsPerContainer has not been defined in template %s!", DataResource::getName())); return base->getItemsPerContainer(); } } @@ -660,9 +660,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getItemsPerContainer(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -679,7 +679,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -695,26 +695,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerDraftSchematicObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getItemsPerContainerMin(true); #endif } if (!m_itemsPerContainer.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter itemsPerContainer in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter itemsPerContainer has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter itemsPerContainer has not been defined in template %s!", DataResource::getName())); return base->getItemsPerContainerMin(); } } @@ -724,9 +724,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getItemsPerContainerMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -743,7 +743,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -759,26 +759,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerDraftSchematicObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getItemsPerContainerMax(true); #endif } if (!m_itemsPerContainer.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter itemsPerContainer in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter itemsPerContainer has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter itemsPerContainer has not been defined in template %s!", DataResource::getName())); return base->getItemsPerContainerMax(); } } @@ -788,9 +788,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getItemsPerContainerMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -807,7 +807,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -823,26 +823,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerDraftSchematicObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getManufactureTime(true); #endif } if (!m_manufactureTime.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter manufactureTime in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter manufactureTime has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter manufactureTime has not been defined in template %s!", DataResource::getName())); return base->getManufactureTime(); } } @@ -852,9 +852,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getManufactureTime(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -871,7 +871,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -887,26 +887,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerDraftSchematicObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getManufactureTimeMin(true); #endif } if (!m_manufactureTime.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter manufactureTime in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter manufactureTime has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter manufactureTime has not been defined in template %s!", DataResource::getName())); return base->getManufactureTimeMin(); } } @@ -916,9 +916,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getManufactureTimeMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -935,7 +935,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -951,26 +951,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerDraftSchematicObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getManufactureTimeMax(true); #endif } if (!m_manufactureTime.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter manufactureTime in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter manufactureTime has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter manufactureTime has not been defined in template %s!", DataResource::getName())); return base->getManufactureTimeMax(); } } @@ -980,9 +980,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getManufactureTimeMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -999,7 +999,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1015,26 +1015,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerDraftSchematicObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getPrototypeTime(true); #endif } if (!m_prototypeTime.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter prototypeTime in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter prototypeTime has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter prototypeTime has not been defined in template %s!", DataResource::getName())); return base->getPrototypeTime(); } } @@ -1044,9 +1044,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getPrototypeTime(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1063,7 +1063,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1079,26 +1079,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerDraftSchematicObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getPrototypeTimeMin(true); #endif } if (!m_prototypeTime.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter prototypeTime in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter prototypeTime has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter prototypeTime has not been defined in template %s!", DataResource::getName())); return base->getPrototypeTimeMin(); } } @@ -1108,9 +1108,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getPrototypeTimeMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1127,7 +1127,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1143,26 +1143,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerDraftSchematicObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getPrototypeTimeMax(true); #endif } if (!m_prototypeTime.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter prototypeTime in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter prototypeTime has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter prototypeTime has not been defined in template %s!", DataResource::getName())); return base->getPrototypeTimeMax(); } } @@ -1172,9 +1172,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getPrototypeTimeMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1191,7 +1191,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1244,12 +1244,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } @@ -1284,7 +1284,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_slots.begin(); iter != m_slots.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_slots.clear(); m_slotsAppend = file.read_bool8(); @@ -1303,7 +1303,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_skillCommands.begin(); iter != m_skillCommands.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_skillCommands.clear(); m_skillCommandsAppend = file.read_bool8(); @@ -1324,7 +1324,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_manufactureScripts.begin(); iter != m_manufactureScripts.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_manufactureScripts.clear(); m_manufactureScriptsAppend = file.read_bool8(); @@ -1376,7 +1376,7 @@ ServerDraftSchematicObjectTemplate::_IngredientSlot::~_IngredientSlot() for (iter = m_options.begin(); iter != m_options.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_options.clear(); } @@ -1418,33 +1418,33 @@ bool testDataValue = false; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; - if (m_baseData != nullptr) + const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getOptional(true); #endif } if (!m_optional.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter optional in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter optional has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter optional has not been defined in template %s!", DataResource::getName())); return base->getOptional(versionOk); } } bool value = m_optional.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1460,33 +1460,33 @@ StringId testDataValue = DefaultStringId; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; - if (m_baseData != nullptr) + const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getName(true); #endif } if (!m_name.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter name in template %s", DataResource::getName())); return DefaultStringId; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter name has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter name has not been defined in template %s!", DataResource::getName())); return base->getName(versionOk); } } const StringId value = m_name.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1496,28 +1496,28 @@ UNREF(testData); void ServerDraftSchematicObjectTemplate::_IngredientSlot::getOptions(Ingredient &data, int index, bool versionOk) const { - const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; - if (m_baseData != nullptr) + const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_optionsLoaded) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter options in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter options has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter options has not been defined in template %s!", DataResource::getName())); base->getOptions(data, index, versionOk); return; } } - if (m_optionsAppend && base != nullptr) + if (m_optionsAppend && base != NULL) { int baseCount = base->getOptionsCount(); if (index < baseCount) @@ -1547,28 +1547,28 @@ void ServerDraftSchematicObjectTemplate::_IngredientSlot::getOptions(Ingredient void ServerDraftSchematicObjectTemplate::_IngredientSlot::getOptionsMin(Ingredient &data, int index, bool versionOk) const { - const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; - if (m_baseData != nullptr) + const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_optionsLoaded) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter options in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter options has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter options has not been defined in template %s!", DataResource::getName())); base->getOptionsMin(data, index, versionOk); return; } } - if (m_optionsAppend && base != nullptr) + if (m_optionsAppend && base != NULL) { int baseCount = base->getOptionsCount(); if (index < baseCount) @@ -1598,28 +1598,28 @@ void ServerDraftSchematicObjectTemplate::_IngredientSlot::getOptionsMin(Ingredie void ServerDraftSchematicObjectTemplate::_IngredientSlot::getOptionsMax(Ingredient &data, int index, bool versionOk) const { - const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; - if (m_baseData != nullptr) + const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_optionsLoaded) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter options in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter options has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter options has not been defined in template %s!", DataResource::getName())); base->getOptionsMax(data, index, versionOk); return; } } - if (m_optionsAppend && base != nullptr) + if (m_optionsAppend && base != NULL) { int baseCount = base->getOptionsCount(); if (index < baseCount) @@ -1651,20 +1651,20 @@ size_t ServerDraftSchematicObjectTemplate::_IngredientSlot::getOptionsCount(void { if (!m_optionsLoaded) { - if (m_baseData == nullptr) + if (m_baseData == NULL) return 0; const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == nullptr, ("base template wrong type")); + DEBUG_FATAL(base == NULL, ("base template wrong type")); return base->getOptionsCount(); } size_t count = m_options.size(); // if we are extending our base template, add it's count - if (m_optionsAppend && m_baseData != nullptr) + if (m_optionsAppend && m_baseData != NULL) { const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = dynamic_cast(m_baseData); - if (base != nullptr) + if (base != NULL) count += base->getOptionsCount(); } @@ -1679,33 +1679,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; - if (m_baseData != nullptr) + const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getOptionalSkillCommand(true); #endif } if (!m_optionalSkillCommand.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter optionalSkillCommand in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter optionalSkillCommand has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter optionalSkillCommand has not been defined in template %s!", DataResource::getName())); return base->getOptionalSkillCommand(versionOk); } } const std::string & value = m_optionalSkillCommand.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1721,26 +1721,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; - if (m_baseData != nullptr) + const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getComplexity(true); #endif } if (!m_complexity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter complexity in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); return base->getComplexity(versionOk); } } @@ -1750,9 +1750,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getComplexity(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1769,7 +1769,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1785,26 +1785,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; - if (m_baseData != nullptr) + const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getComplexityMin(true); #endif } if (!m_complexity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter complexity in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); return base->getComplexityMin(versionOk); } } @@ -1814,9 +1814,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getComplexityMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1833,7 +1833,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1849,26 +1849,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; - if (m_baseData != nullptr) + const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getComplexityMax(true); #endif } if (!m_complexity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter complexity in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); return base->getComplexityMax(versionOk); } } @@ -1878,9 +1878,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getComplexityMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1897,7 +1897,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1913,33 +1913,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; - if (m_baseData != nullptr) + const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getAppearance(true); #endif } if (!m_appearance.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter appearance in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter appearance has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter appearance has not been defined in template %s!", DataResource::getName())); return base->getAppearance(versionOk); } } const std::string & value = m_appearance.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1992,7 +1992,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_options.begin(); iter != m_options.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_options.clear(); m_optionsAppend = file.read_bool8(); diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerFactoryObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerFactoryObjectTemplate.cpp index 21075a19..413f930b 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerFactoryObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerFactoryObjectTemplate.cpp @@ -93,10 +93,10 @@ Tag ServerFactoryObjectTemplate::getTemplateVersion(void) const */ Tag ServerFactoryObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerFactoryObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerFactoryObjectTemplate::getHighestTemplateVersion @@ -149,12 +149,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerGroupObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerGroupObjectTemplate.cpp index d026ef4f..9f63f2db 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerGroupObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerGroupObjectTemplate.cpp @@ -95,10 +95,10 @@ Tag ServerGroupObjectTemplate::getTemplateVersion(void) const */ Tag ServerGroupObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerGroupObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerGroupObjectTemplate::getHighestTemplateVersion @@ -151,12 +151,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerGuildObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerGuildObjectTemplate.cpp index d7a9bcef..00d26b3f 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerGuildObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerGuildObjectTemplate.cpp @@ -95,10 +95,10 @@ Tag ServerGuildObjectTemplate::getTemplateVersion(void) const */ Tag ServerGuildObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerGuildObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerGuildObjectTemplate::getHighestTemplateVersion @@ -151,12 +151,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerHarvesterInstallationObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerHarvesterInstallationObjectTemplate.cpp index 16bf4a31..a226afb3 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerHarvesterInstallationObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerHarvesterInstallationObjectTemplate.cpp @@ -93,10 +93,10 @@ Tag ServerHarvesterInstallationObjectTemplate::getTemplateVersion(void) const */ Tag ServerHarvesterInstallationObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerHarvesterInstallationObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerHarvesterInstallationObjectTemplate::getHighestTemplateVersion @@ -120,26 +120,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerHarvesterInstallationObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerHarvesterInstallationObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMaxExtractionRate(true); #endif } if (!m_maxExtractionRate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxExtractionRate in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter maxExtractionRate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter maxExtractionRate has not been defined in template %s!", DataResource::getName())); return base->getMaxExtractionRate(); } } @@ -149,9 +149,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMaxExtractionRate(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -168,7 +168,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -184,26 +184,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerHarvesterInstallationObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerHarvesterInstallationObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMaxExtractionRateMin(true); #endif } if (!m_maxExtractionRate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxExtractionRate in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter maxExtractionRate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter maxExtractionRate has not been defined in template %s!", DataResource::getName())); return base->getMaxExtractionRateMin(); } } @@ -213,9 +213,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMaxExtractionRateMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -232,7 +232,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -248,26 +248,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerHarvesterInstallationObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerHarvesterInstallationObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMaxExtractionRateMax(true); #endif } if (!m_maxExtractionRate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxExtractionRate in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter maxExtractionRate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter maxExtractionRate has not been defined in template %s!", DataResource::getName())); return base->getMaxExtractionRateMax(); } } @@ -277,9 +277,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMaxExtractionRateMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -296,7 +296,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -312,26 +312,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerHarvesterInstallationObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerHarvesterInstallationObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getCurrentExtractionRate(true); #endif } if (!m_currentExtractionRate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter currentExtractionRate in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter currentExtractionRate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter currentExtractionRate has not been defined in template %s!", DataResource::getName())); return base->getCurrentExtractionRate(); } } @@ -341,9 +341,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getCurrentExtractionRate(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -360,7 +360,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -376,26 +376,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerHarvesterInstallationObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerHarvesterInstallationObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getCurrentExtractionRateMin(true); #endif } if (!m_currentExtractionRate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter currentExtractionRate in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter currentExtractionRate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter currentExtractionRate has not been defined in template %s!", DataResource::getName())); return base->getCurrentExtractionRateMin(); } } @@ -405,9 +405,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getCurrentExtractionRateMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -424,7 +424,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -440,26 +440,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerHarvesterInstallationObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerHarvesterInstallationObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getCurrentExtractionRateMax(true); #endif } if (!m_currentExtractionRate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter currentExtractionRate in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter currentExtractionRate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter currentExtractionRate has not been defined in template %s!", DataResource::getName())); return base->getCurrentExtractionRateMax(); } } @@ -469,9 +469,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getCurrentExtractionRateMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -488,7 +488,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -504,26 +504,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerHarvesterInstallationObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerHarvesterInstallationObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMaxHopperSize(true); #endif } if (!m_maxHopperSize.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxHopperSize in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter maxHopperSize has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter maxHopperSize has not been defined in template %s!", DataResource::getName())); return base->getMaxHopperSize(); } } @@ -533,9 +533,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMaxHopperSize(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -552,7 +552,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -568,26 +568,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerHarvesterInstallationObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerHarvesterInstallationObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMaxHopperSizeMin(true); #endif } if (!m_maxHopperSize.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxHopperSize in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter maxHopperSize has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter maxHopperSize has not been defined in template %s!", DataResource::getName())); return base->getMaxHopperSizeMin(); } } @@ -597,9 +597,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMaxHopperSizeMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -616,7 +616,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -632,26 +632,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerHarvesterInstallationObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerHarvesterInstallationObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMaxHopperSizeMax(true); #endif } if (!m_maxHopperSize.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxHopperSize in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter maxHopperSize has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter maxHopperSize has not been defined in template %s!", DataResource::getName())); return base->getMaxHopperSizeMax(); } } @@ -661,9 +661,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMaxHopperSizeMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -680,7 +680,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -696,33 +696,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerHarvesterInstallationObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerHarvesterInstallationObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMasterClassName(true); #endif } if (!m_masterClassName.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter masterClassName in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter masterClassName has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter masterClassName has not been defined in template %s!", DataResource::getName())); return base->getMasterClassName(); } } const std::string & value = m_masterClassName.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -774,12 +774,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerInstallationObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerInstallationObjectTemplate.cpp index 8bb94ce5..ad1661bb 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerInstallationObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerInstallationObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag ServerInstallationObjectTemplate::getTemplateVersion(void) const */ Tag ServerInstallationObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerInstallationObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerInstallationObjectTemplate::getHighestTemplateVersion @@ -150,12 +150,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerIntangibleObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerIntangibleObjectTemplate.cpp index 18cce6b3..992bf06d 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerIntangibleObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerIntangibleObjectTemplate.cpp @@ -93,10 +93,10 @@ Tag ServerIntangibleObjectTemplate::getTemplateVersion(void) const */ Tag ServerIntangibleObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerIntangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerIntangibleObjectTemplate::getHighestTemplateVersion @@ -120,26 +120,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerIntangibleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerIntangibleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getCount(true); #endif } if (!m_count.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter count in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter count has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter count has not been defined in template %s!", DataResource::getName())); return base->getCount(); } } @@ -149,9 +149,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getCount(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -168,7 +168,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -184,26 +184,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerIntangibleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerIntangibleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getCountMin(true); #endif } if (!m_count.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter count in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter count has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter count has not been defined in template %s!", DataResource::getName())); return base->getCountMin(); } } @@ -213,9 +213,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getCountMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -232,7 +232,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -248,26 +248,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerIntangibleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerIntangibleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getCountMax(true); #endif } if (!m_count.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter count in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter count has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter count has not been defined in template %s!", DataResource::getName())); return base->getCountMax(); } } @@ -277,9 +277,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getCountMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -296,7 +296,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -343,12 +343,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } @@ -406,7 +406,7 @@ ServerIntangibleObjectTemplate::_Ingredient::~_Ingredient() for (iter = m_ingredients.begin(); iter != m_ingredients.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_ingredients.clear(); } @@ -448,33 +448,33 @@ ServerIntangibleObjectTemplate::IngredientType testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getIngredientType(true); #endif } if (!m_ingredientType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredientType in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == nullptr, ("Template parameter ingredientType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter ingredientType has not been defined in template %s!", DataResource::getName())); return base->getIngredientType(versionOk); } } IngredientType value = static_cast(m_ingredientType.getValue()); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -484,28 +484,28 @@ UNREF(testData); void ServerIntangibleObjectTemplate::_Ingredient::getIngredients(SimpleIngredient &data, int index, bool versionOk) const { - const ServerIntangibleObjectTemplate::_Ingredient * base = nullptr; - if (m_baseData != nullptr) + const ServerIntangibleObjectTemplate::_Ingredient * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_ingredientsLoaded) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredients in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter ingredients has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter ingredients has not been defined in template %s!", DataResource::getName())); base->getIngredients(data, index, versionOk); return; } } - if (m_ingredientsAppend && base != nullptr) + if (m_ingredientsAppend && base != NULL) { int baseCount = base->getIngredientsCount(); if (index < baseCount) @@ -528,28 +528,28 @@ void ServerIntangibleObjectTemplate::_Ingredient::getIngredients(SimpleIngredien void ServerIntangibleObjectTemplate::_Ingredient::getIngredientsMin(SimpleIngredient &data, int index, bool versionOk) const { - const ServerIntangibleObjectTemplate::_Ingredient * base = nullptr; - if (m_baseData != nullptr) + const ServerIntangibleObjectTemplate::_Ingredient * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_ingredientsLoaded) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredients in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter ingredients has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter ingredients has not been defined in template %s!", DataResource::getName())); base->getIngredientsMin(data, index, versionOk); return; } } - if (m_ingredientsAppend && base != nullptr) + if (m_ingredientsAppend && base != NULL) { int baseCount = base->getIngredientsCount(); if (index < baseCount) @@ -572,28 +572,28 @@ void ServerIntangibleObjectTemplate::_Ingredient::getIngredientsMin(SimpleIngred void ServerIntangibleObjectTemplate::_Ingredient::getIngredientsMax(SimpleIngredient &data, int index, bool versionOk) const { - const ServerIntangibleObjectTemplate::_Ingredient * base = nullptr; - if (m_baseData != nullptr) + const ServerIntangibleObjectTemplate::_Ingredient * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_ingredientsLoaded) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredients in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter ingredients has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter ingredients has not been defined in template %s!", DataResource::getName())); base->getIngredientsMax(data, index, versionOk); return; } } - if (m_ingredientsAppend && base != nullptr) + if (m_ingredientsAppend && base != NULL) { int baseCount = base->getIngredientsCount(); if (index < baseCount) @@ -618,20 +618,20 @@ size_t ServerIntangibleObjectTemplate::_Ingredient::getIngredientsCount(void) co { if (!m_ingredientsLoaded) { - if (m_baseData == nullptr) + if (m_baseData == NULL) return 0; const ServerIntangibleObjectTemplate::_Ingredient * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == nullptr, ("base template wrong type")); + DEBUG_FATAL(base == NULL, ("base template wrong type")); return base->getIngredientsCount(); } size_t count = m_ingredients.size(); // if we are extending our base template, add it's count - if (m_ingredientsAppend && m_baseData != nullptr) + if (m_ingredientsAppend && m_baseData != NULL) { const ServerIntangibleObjectTemplate::_Ingredient * base = dynamic_cast(m_baseData); - if (base != nullptr) + if (base != NULL) count += base->getIngredientsCount(); } @@ -646,26 +646,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_Ingredient * base = nullptr; - if (m_baseData != nullptr) + const ServerIntangibleObjectTemplate::_Ingredient * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getComplexity(true); #endif } if (!m_complexity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter complexity in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); return base->getComplexity(versionOk); } } @@ -675,9 +675,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getComplexity(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -694,7 +694,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -710,26 +710,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_Ingredient * base = nullptr; - if (m_baseData != nullptr) + const ServerIntangibleObjectTemplate::_Ingredient * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getComplexityMin(true); #endif } if (!m_complexity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter complexity in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); return base->getComplexityMin(versionOk); } } @@ -739,9 +739,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getComplexityMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -758,7 +758,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -774,26 +774,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_Ingredient * base = nullptr; - if (m_baseData != nullptr) + const ServerIntangibleObjectTemplate::_Ingredient * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getComplexityMax(true); #endif } if (!m_complexity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter complexity in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); return base->getComplexityMax(versionOk); } } @@ -803,9 +803,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getComplexityMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -822,7 +822,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -838,33 +838,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_Ingredient * base = nullptr; - if (m_baseData != nullptr) + const ServerIntangibleObjectTemplate::_Ingredient * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getSkillCommand(true); #endif } if (!m_skillCommand.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter skillCommand in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter skillCommand has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter skillCommand has not been defined in template %s!", DataResource::getName())); return base->getSkillCommand(versionOk); } } const std::string & value = m_skillCommand.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -913,7 +913,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_ingredients.begin(); iter != m_ingredients.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_ingredients.clear(); m_ingredientsAppend = file.read_bool8(); @@ -992,33 +992,33 @@ StringId testDataValue = DefaultStringId; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_SchematicAttribute * base = nullptr; - if (m_baseData != nullptr) + const ServerIntangibleObjectTemplate::_SchematicAttribute * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getName(true); #endif } if (!m_name.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter name in template %s", DataResource::getName())); return DefaultStringId; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter name has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter name has not been defined in template %s!", DataResource::getName())); return base->getName(versionOk); } } const StringId value = m_name.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1034,26 +1034,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_SchematicAttribute * base = nullptr; - if (m_baseData != nullptr) + const ServerIntangibleObjectTemplate::_SchematicAttribute * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getValue(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValue(versionOk); } } @@ -1063,9 +1063,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getValue(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1082,7 +1082,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1098,26 +1098,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_SchematicAttribute * base = nullptr; - if (m_baseData != nullptr) + const ServerIntangibleObjectTemplate::_SchematicAttribute * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getValueMin(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValueMin(versionOk); } } @@ -1127,9 +1127,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getValueMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1146,7 +1146,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1162,26 +1162,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_SchematicAttribute * base = nullptr; - if (m_baseData != nullptr) + const ServerIntangibleObjectTemplate::_SchematicAttribute * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getValueMax(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValueMax(versionOk); } } @@ -1191,9 +1191,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getValueMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1210,7 +1210,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1316,33 +1316,33 @@ StringId testDataValue = DefaultStringId; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_SimpleIngredient * base = nullptr; - if (m_baseData != nullptr) + const ServerIntangibleObjectTemplate::_SimpleIngredient * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getName(true); #endif } if (!m_name.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter name in template %s", DataResource::getName())); return DefaultStringId; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter name has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter name has not been defined in template %s!", DataResource::getName())); return base->getName(versionOk); } } const StringId value = m_name.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1358,33 +1358,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_SimpleIngredient * base = nullptr; - if (m_baseData != nullptr) + const ServerIntangibleObjectTemplate::_SimpleIngredient * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getIngredient(true); #endif } if (!m_ingredient.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredient in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter ingredient has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter ingredient has not been defined in template %s!", DataResource::getName())); return base->getIngredient(versionOk); } } const std::string & value = m_ingredient.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1400,26 +1400,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_SimpleIngredient * base = nullptr; - if (m_baseData != nullptr) + const ServerIntangibleObjectTemplate::_SimpleIngredient * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getCount(true); #endif } if (!m_count.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter count in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter count has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter count has not been defined in template %s!", DataResource::getName())); return base->getCount(versionOk); } } @@ -1429,9 +1429,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getCount(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1448,7 +1448,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1464,26 +1464,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_SimpleIngredient * base = nullptr; - if (m_baseData != nullptr) + const ServerIntangibleObjectTemplate::_SimpleIngredient * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getCountMin(true); #endif } if (!m_count.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter count in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter count has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter count has not been defined in template %s!", DataResource::getName())); return base->getCountMin(versionOk); } } @@ -1493,9 +1493,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getCountMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1512,7 +1512,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1528,26 +1528,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_SimpleIngredient * base = nullptr; - if (m_baseData != nullptr) + const ServerIntangibleObjectTemplate::_SimpleIngredient * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getCountMax(true); #endif } if (!m_count.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter count in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter count has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter count has not been defined in template %s!", DataResource::getName())); return base->getCountMax(versionOk); } } @@ -1557,9 +1557,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getCountMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1576,7 +1576,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureInstallationObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureInstallationObjectTemplate.cpp index 57b4db42..373a81f7 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureInstallationObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureInstallationObjectTemplate.cpp @@ -93,10 +93,10 @@ Tag ServerManufactureInstallationObjectTemplate::getTemplateVersion(void) const */ Tag ServerManufactureInstallationObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerManufactureInstallationObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerManufactureInstallationObjectTemplate::getHighestTemplateVersion @@ -149,12 +149,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureSchematicObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureSchematicObjectTemplate.cpp index 3aee1103..0f00a74b 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureSchematicObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureSchematicObjectTemplate.cpp @@ -54,7 +54,7 @@ ServerManufactureSchematicObjectTemplate::~ServerManufactureSchematicObjectTempl for (iter = m_ingredients.begin(); iter != m_ingredients.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_ingredients.clear(); } @@ -63,7 +63,7 @@ ServerManufactureSchematicObjectTemplate::~ServerManufactureSchematicObjectTempl for (iter = m_attributes.begin(); iter != m_attributes.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_attributes.clear(); } @@ -115,17 +115,17 @@ Tag ServerManufactureSchematicObjectTemplate::getTemplateVersion(void) const */ Tag ServerManufactureSchematicObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerManufactureSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerManufactureSchematicObjectTemplate::getHighestTemplateVersion /** * Called when the game tries to create a manf schematic via the default method. - * Manf must be created via a draft schematic, so we always return nullptr; + * Manf must be created via a draft schematic, so we always return NULL; * * @return the object */ @@ -146,17 +146,17 @@ Object * ServerManufactureSchematicObjectTemplate::createObject(const char *cons const ObjectTemplate *const objectTemplate = ObjectTemplateList::fetch(fileName); if (objectTemplate) { - Object * object = nullptr; + Object * object = NULL; const ServerManufactureSchematicObjectTemplate * const manfTemplate = dynamic_cast( objectTemplate); - if (manfTemplate != nullptr) + if (manfTemplate != NULL) object = manfTemplate->createObject(schematic); objectTemplate->releaseReference (); return object; } - return nullptr; + return NULL; } // ServerManufactureSchematicObjectTemplate::createObject /** @@ -178,33 +178,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerManufactureSchematicObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerManufactureSchematicObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getDraftSchematic(true); #endif } if (!m_draftSchematic.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter draftSchematic in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter draftSchematic has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter draftSchematic has not been defined in template %s!", DataResource::getName())); return base->getDraftSchematic(); } } const std::string & value = m_draftSchematic.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -220,33 +220,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerManufactureSchematicObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerManufactureSchematicObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getCreator(true); #endif } if (!m_creator.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter creator in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter creator has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter creator has not been defined in template %s!", DataResource::getName())); return base->getCreator(); } } const std::string & value = m_creator.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -256,28 +256,28 @@ UNREF(testData); void ServerManufactureSchematicObjectTemplate::getIngredients(IngredientSlot &data, int index) const { - const ServerManufactureSchematicObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerManufactureSchematicObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_ingredientsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredients in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter ingredients has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter ingredients has not been defined in template %s!", DataResource::getName())); base->getIngredients(data, index); return; } } - if (m_ingredientsAppend && base != nullptr) + if (m_ingredientsAppend && base != NULL) { int baseCount = base->getIngredientsCount(); if (index < baseCount) @@ -299,28 +299,28 @@ void ServerManufactureSchematicObjectTemplate::getIngredients(IngredientSlot &da void ServerManufactureSchematicObjectTemplate::getIngredientsMin(IngredientSlot &data, int index) const { - const ServerManufactureSchematicObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerManufactureSchematicObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_ingredientsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredients in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter ingredients has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter ingredients has not been defined in template %s!", DataResource::getName())); base->getIngredientsMin(data, index); return; } } - if (m_ingredientsAppend && base != nullptr) + if (m_ingredientsAppend && base != NULL) { int baseCount = base->getIngredientsCount(); if (index < baseCount) @@ -342,28 +342,28 @@ void ServerManufactureSchematicObjectTemplate::getIngredientsMin(IngredientSlot void ServerManufactureSchematicObjectTemplate::getIngredientsMax(IngredientSlot &data, int index) const { - const ServerManufactureSchematicObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerManufactureSchematicObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_ingredientsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredients in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter ingredients has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter ingredients has not been defined in template %s!", DataResource::getName())); base->getIngredientsMax(data, index); return; } } - if (m_ingredientsAppend && base != nullptr) + if (m_ingredientsAppend && base != NULL) { int baseCount = base->getIngredientsCount(); if (index < baseCount) @@ -387,20 +387,20 @@ size_t ServerManufactureSchematicObjectTemplate::getIngredientsCount(void) const { if (!m_ingredientsLoaded) { - if (m_baseData == nullptr) + if (m_baseData == NULL) return 0; const ServerManufactureSchematicObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == nullptr, ("base template wrong type")); + DEBUG_FATAL(base == NULL, ("base template wrong type")); return base->getIngredientsCount(); } size_t count = m_ingredients.size(); // if we are extending our base template, add it's count - if (m_ingredientsAppend && m_baseData != nullptr) + if (m_ingredientsAppend && m_baseData != NULL) { const ServerManufactureSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base != nullptr) + if (base != NULL) count += base->getIngredientsCount(); } @@ -415,26 +415,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerManufactureSchematicObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerManufactureSchematicObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getItemCount(true); #endif } if (!m_itemCount.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter itemCount in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter itemCount has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter itemCount has not been defined in template %s!", DataResource::getName())); return base->getItemCount(); } } @@ -444,9 +444,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getItemCount(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -463,7 +463,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -479,26 +479,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerManufactureSchematicObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerManufactureSchematicObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getItemCountMin(true); #endif } if (!m_itemCount.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter itemCount in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter itemCount has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter itemCount has not been defined in template %s!", DataResource::getName())); return base->getItemCountMin(); } } @@ -508,9 +508,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getItemCountMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -527,7 +527,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -543,26 +543,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerManufactureSchematicObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerManufactureSchematicObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getItemCountMax(true); #endif } if (!m_itemCount.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter itemCount in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter itemCount has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter itemCount has not been defined in template %s!", DataResource::getName())); return base->getItemCountMax(); } } @@ -572,9 +572,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getItemCountMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -591,7 +591,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -601,28 +601,28 @@ UNREF(testData); void ServerManufactureSchematicObjectTemplate::getAttributes(SchematicAttribute &data, int index) const { - const ServerManufactureSchematicObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerManufactureSchematicObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_attributesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter attributes in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter attributes has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter attributes has not been defined in template %s!", DataResource::getName())); base->getAttributes(data, index); return; } } - if (m_attributesAppend && base != nullptr) + if (m_attributesAppend && base != NULL) { int baseCount = base->getAttributesCount(); if (index < baseCount) @@ -644,28 +644,28 @@ void ServerManufactureSchematicObjectTemplate::getAttributes(SchematicAttribute void ServerManufactureSchematicObjectTemplate::getAttributesMin(SchematicAttribute &data, int index) const { - const ServerManufactureSchematicObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerManufactureSchematicObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_attributesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter attributes in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter attributes has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter attributes has not been defined in template %s!", DataResource::getName())); base->getAttributesMin(data, index); return; } } - if (m_attributesAppend && base != nullptr) + if (m_attributesAppend && base != NULL) { int baseCount = base->getAttributesCount(); if (index < baseCount) @@ -687,28 +687,28 @@ void ServerManufactureSchematicObjectTemplate::getAttributesMin(SchematicAttribu void ServerManufactureSchematicObjectTemplate::getAttributesMax(SchematicAttribute &data, int index) const { - const ServerManufactureSchematicObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerManufactureSchematicObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_attributesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter attributes in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter attributes has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter attributes has not been defined in template %s!", DataResource::getName())); base->getAttributesMax(data, index); return; } } - if (m_attributesAppend && base != nullptr) + if (m_attributesAppend && base != NULL) { int baseCount = base->getAttributesCount(); if (index < baseCount) @@ -732,20 +732,20 @@ size_t ServerManufactureSchematicObjectTemplate::getAttributesCount(void) const { if (!m_attributesLoaded) { - if (m_baseData == nullptr) + if (m_baseData == NULL) return 0; const ServerManufactureSchematicObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == nullptr, ("base template wrong type")); + DEBUG_FATAL(base == NULL, ("base template wrong type")); return base->getAttributesCount(); } size_t count = m_attributes.size(); // if we are extending our base template, add it's count - if (m_attributesAppend && m_baseData != nullptr) + if (m_attributesAppend && m_baseData != NULL) { const ServerManufactureSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base != nullptr) + if (base != NULL) count += base->getAttributesCount(); } @@ -793,12 +793,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } @@ -831,7 +831,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_ingredients.begin(); iter != m_ingredients.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_ingredients.clear(); m_ingredientsAppend = file.read_bool8(); @@ -852,7 +852,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_attributes.begin(); iter != m_attributes.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_attributes.clear(); m_attributesAppend = file.read_bool8(); @@ -929,33 +929,33 @@ StringId testDataValue = DefaultStringId; UNREF(testData); #endif - const ServerManufactureSchematicObjectTemplate::_IngredientSlot * base = nullptr; - if (m_baseData != nullptr) + const ServerManufactureSchematicObjectTemplate::_IngredientSlot * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getName(true); #endif } if (!m_name.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter name in template %s", DataResource::getName())); return DefaultStringId; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter name has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter name has not been defined in template %s!", DataResource::getName())); return base->getName(versionOk); } } const StringId value = m_name.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -965,22 +965,22 @@ UNREF(testData); void ServerManufactureSchematicObjectTemplate::_IngredientSlot::getIngredient(Ingredient &data, bool versionOk) const { - const ServerManufactureSchematicObjectTemplate::_IngredientSlot * base = nullptr; - if (m_baseData != nullptr) + const ServerManufactureSchematicObjectTemplate::_IngredientSlot * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_ingredient.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredient in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter ingredient has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter ingredient has not been defined in template %s!", DataResource::getName())); base->getIngredient(data, versionOk); return; } @@ -1004,22 +1004,22 @@ void ServerManufactureSchematicObjectTemplate::_IngredientSlot::getIngredient(In void ServerManufactureSchematicObjectTemplate::_IngredientSlot::getIngredientMin(Ingredient &data, bool versionOk) const { - const ServerManufactureSchematicObjectTemplate::_IngredientSlot * base = nullptr; - if (m_baseData != nullptr) + const ServerManufactureSchematicObjectTemplate::_IngredientSlot * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_ingredient.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredient in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter ingredient has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter ingredient has not been defined in template %s!", DataResource::getName())); base->getIngredientMin(data, versionOk); return; } @@ -1043,22 +1043,22 @@ void ServerManufactureSchematicObjectTemplate::_IngredientSlot::getIngredientMin void ServerManufactureSchematicObjectTemplate::_IngredientSlot::getIngredientMax(Ingredient &data, bool versionOk) const { - const ServerManufactureSchematicObjectTemplate::_IngredientSlot * base = nullptr; - if (m_baseData != nullptr) + const ServerManufactureSchematicObjectTemplate::_IngredientSlot * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_ingredient.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredient in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter ingredient has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter ingredient has not been defined in template %s!", DataResource::getName())); base->getIngredientMax(data, versionOk); return; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerMissionObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerMissionObjectTemplate.cpp index 9417be44..66ee2754 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerMissionObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerMissionObjectTemplate.cpp @@ -93,10 +93,10 @@ Tag ServerMissionObjectTemplate::getTemplateVersion(void) const */ Tag ServerMissionObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerMissionObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerMissionObjectTemplate::getHighestTemplateVersion @@ -149,12 +149,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerObjectTemplate.cpp index 5e11c2e7..78810b18 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerObjectTemplate.cpp @@ -32,7 +32,7 @@ const TriggerVolumeData DefaultTriggerVolumeData; bool ServerObjectTemplate::ms_allowDefaultTemplateParams = true; typedef std::unordered_map > XP_MAP; -static XP_MAP * XpMap = nullptr; +static XP_MAP * XpMap = NULL; /** @@ -74,7 +74,7 @@ ServerObjectTemplate::~ServerObjectTemplate() for (iter = m_scripts.begin(); iter != m_scripts.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_scripts.clear(); } @@ -83,7 +83,7 @@ ServerObjectTemplate::~ServerObjectTemplate() for (iter = m_visibleFlags.begin(); iter != m_visibleFlags.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_visibleFlags.clear(); } @@ -92,7 +92,7 @@ ServerObjectTemplate::~ServerObjectTemplate() for (iter = m_deleteFlags.begin(); iter != m_deleteFlags.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_deleteFlags.clear(); } @@ -101,7 +101,7 @@ ServerObjectTemplate::~ServerObjectTemplate() for (iter = m_moveFlags.begin(); iter != m_moveFlags.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_moveFlags.clear(); } @@ -110,7 +110,7 @@ ServerObjectTemplate::~ServerObjectTemplate() for (iter = m_contents.begin(); iter != m_contents.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_contents.clear(); } @@ -119,7 +119,7 @@ ServerObjectTemplate::~ServerObjectTemplate() for (iter = m_xpPoints.begin(); iter != m_xpPoints.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_xpPoints.clear(); } @@ -133,7 +133,7 @@ void ServerObjectTemplate::registerMe(void) { ObjectTemplateList::registerTemplate(ServerObjectTemplate_tag, create); - if (XpMap == nullptr) + if (XpMap == NULL) { XpMap = new XP_MAP(); ExitChain::add(exit, "ServerObjectTemplate"); @@ -208,10 +208,10 @@ void ServerObjectTemplate::registerMe(void) */ void ServerObjectTemplate::exit() { - if (XpMap != nullptr) + if (XpMap != NULL) { delete XpMap; - XpMap = nullptr; + XpMap = NULL; } } // ServerObjectTemplate::exit @@ -252,10 +252,10 @@ Tag ServerObjectTemplate::getTemplateVersion(void) const */ Tag ServerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerObjectTemplate::getHighestTemplateVersion @@ -287,7 +287,7 @@ const std::string & ServerObjectTemplate::getXpString(XpTypes type) { static const std::string emptyString; - if (XpMap != nullptr) + if (XpMap != NULL) { XP_MAP::const_iterator result = XpMap->find(type); if (result != XpMap->end()) @@ -371,33 +371,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getSharedTemplate(true); #endif } if (!m_sharedTemplate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter sharedTemplate in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter sharedTemplate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter sharedTemplate has not been defined in template %s!", DataResource::getName())); return base->getSharedTemplate(); } } const std::string & value = m_sharedTemplate.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -407,27 +407,27 @@ UNREF(testData); const std::string & ServerObjectTemplate::getScripts(int index) const { - const ServerObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_scriptsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter scripts in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter scripts has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter scripts has not been defined in template %s!", DataResource::getName())); return base->getScripts(index); } } - if (m_scriptsAppend && base != nullptr) + if (m_scriptsAppend && base != NULL) { int baseCount = base->getScriptsCount(); if (index < baseCount) @@ -444,20 +444,20 @@ size_t ServerObjectTemplate::getScriptsCount(void) const { if (!m_scriptsLoaded) { - if (m_baseData == nullptr) + if (m_baseData == NULL) return 0; const ServerObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == nullptr, ("base template wrong type")); + DEBUG_FATAL(base == NULL, ("base template wrong type")); return base->getScriptsCount(); } size_t count = m_scripts.size(); // if we are extending our base template, add it's count - if (m_scriptsAppend && m_baseData != nullptr) + if (m_scriptsAppend && m_baseData != NULL) { const ServerObjectTemplate * base = dynamic_cast(m_baseData); - if (base != nullptr) + if (base != NULL) count += base->getScriptsCount(); } @@ -466,28 +466,28 @@ size_t ServerObjectTemplate::getScriptsCount(void) const void ServerObjectTemplate::getObjvars(DynamicVariableList &list) const { - const ServerObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_objvars.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter objvars in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter objvars has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter objvars has not been defined in template %s!", DataResource::getName())); base->getObjvars(list); return; } } - if (m_objvars.isExtendingBaseList() && base != nullptr) + if (m_objvars.isExtendingBaseList() && base != NULL) base->getObjvars(list); m_objvars.getDynamicVariableList(list); } // ServerObjectTemplate::getObjvars @@ -500,26 +500,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getVolume(true); #endif } if (!m_volume.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter volume in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter volume has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter volume has not been defined in template %s!", DataResource::getName())); return base->getVolume(); } } @@ -529,9 +529,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getVolume(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -548,7 +548,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -564,26 +564,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getVolumeMin(true); #endif } if (!m_volume.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter volume in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter volume has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter volume has not been defined in template %s!", DataResource::getName())); return base->getVolumeMin(); } } @@ -593,9 +593,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getVolumeMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -612,7 +612,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -628,26 +628,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getVolumeMax(true); #endif } if (!m_volume.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter volume in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter volume has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter volume has not been defined in template %s!", DataResource::getName())); return base->getVolumeMax(); } } @@ -657,9 +657,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getVolumeMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -676,7 +676,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -686,27 +686,27 @@ UNREF(testData); ServerObjectTemplate::VisibleFlags ServerObjectTemplate::getVisibleFlags(int index) const { - const ServerObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_visibleFlagsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter visibleFlags in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == nullptr, ("Template parameter visibleFlags has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter visibleFlags has not been defined in template %s!", DataResource::getName())); return base->getVisibleFlags(index); } } - if (m_visibleFlagsAppend && base != nullptr) + if (m_visibleFlagsAppend && base != NULL) { int baseCount = base->getVisibleFlagsCount(); if (index < baseCount) @@ -722,20 +722,20 @@ size_t ServerObjectTemplate::getVisibleFlagsCount(void) const { if (!m_visibleFlagsLoaded) { - if (m_baseData == nullptr) + if (m_baseData == NULL) return 0; const ServerObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == nullptr, ("base template wrong type")); + DEBUG_FATAL(base == NULL, ("base template wrong type")); return base->getVisibleFlagsCount(); } size_t count = m_visibleFlags.size(); // if we are extending our base template, add it's count - if (m_visibleFlagsAppend && m_baseData != nullptr) + if (m_visibleFlagsAppend && m_baseData != NULL) { const ServerObjectTemplate * base = dynamic_cast(m_baseData); - if (base != nullptr) + if (base != NULL) count += base->getVisibleFlagsCount(); } @@ -744,27 +744,27 @@ size_t ServerObjectTemplate::getVisibleFlagsCount(void) const ServerObjectTemplate::DeleteFlags ServerObjectTemplate::getDeleteFlags(int index) const { - const ServerObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_deleteFlagsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter deleteFlags in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == nullptr, ("Template parameter deleteFlags has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter deleteFlags has not been defined in template %s!", DataResource::getName())); return base->getDeleteFlags(index); } } - if (m_deleteFlagsAppend && base != nullptr) + if (m_deleteFlagsAppend && base != NULL) { int baseCount = base->getDeleteFlagsCount(); if (index < baseCount) @@ -780,20 +780,20 @@ size_t ServerObjectTemplate::getDeleteFlagsCount(void) const { if (!m_deleteFlagsLoaded) { - if (m_baseData == nullptr) + if (m_baseData == NULL) return 0; const ServerObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == nullptr, ("base template wrong type")); + DEBUG_FATAL(base == NULL, ("base template wrong type")); return base->getDeleteFlagsCount(); } size_t count = m_deleteFlags.size(); // if we are extending our base template, add it's count - if (m_deleteFlagsAppend && m_baseData != nullptr) + if (m_deleteFlagsAppend && m_baseData != NULL) { const ServerObjectTemplate * base = dynamic_cast(m_baseData); - if (base != nullptr) + if (base != NULL) count += base->getDeleteFlagsCount(); } @@ -802,27 +802,27 @@ size_t ServerObjectTemplate::getDeleteFlagsCount(void) const ServerObjectTemplate::MoveFlags ServerObjectTemplate::getMoveFlags(int index) const { - const ServerObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_moveFlagsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter moveFlags in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == nullptr, ("Template parameter moveFlags has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter moveFlags has not been defined in template %s!", DataResource::getName())); return base->getMoveFlags(index); } } - if (m_moveFlagsAppend && base != nullptr) + if (m_moveFlagsAppend && base != NULL) { int baseCount = base->getMoveFlagsCount(); if (index < baseCount) @@ -838,20 +838,20 @@ size_t ServerObjectTemplate::getMoveFlagsCount(void) const { if (!m_moveFlagsLoaded) { - if (m_baseData == nullptr) + if (m_baseData == NULL) return 0; const ServerObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == nullptr, ("base template wrong type")); + DEBUG_FATAL(base == NULL, ("base template wrong type")); return base->getMoveFlagsCount(); } size_t count = m_moveFlags.size(); // if we are extending our base template, add it's count - if (m_moveFlagsAppend && m_baseData != nullptr) + if (m_moveFlagsAppend && m_baseData != NULL) { const ServerObjectTemplate * base = dynamic_cast(m_baseData); - if (base != nullptr) + if (base != NULL) count += base->getMoveFlagsCount(); } @@ -866,33 +866,33 @@ bool testDataValue = false; UNREF(testData); #endif - const ServerObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getInvulnerable(true); #endif } if (!m_invulnerable.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter invulnerable in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter invulnerable has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter invulnerable has not been defined in template %s!", DataResource::getName())); return base->getInvulnerable(); } } bool value = m_invulnerable.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -908,26 +908,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getComplexity(true); #endif } if (!m_complexity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter complexity in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); return base->getComplexity(); } } @@ -937,9 +937,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getComplexity(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -956,7 +956,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -972,26 +972,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getComplexityMin(true); #endif } if (!m_complexity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter complexity in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); return base->getComplexityMin(); } } @@ -1001,9 +1001,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getComplexityMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1020,7 +1020,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1036,26 +1036,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getComplexityMax(true); #endif } if (!m_complexity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter complexity in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); return base->getComplexityMax(); } } @@ -1065,9 +1065,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getComplexityMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1084,7 +1084,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1100,26 +1100,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getTintIndex(true); #endif } if (!m_tintIndex.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter tintIndex in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter tintIndex has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter tintIndex has not been defined in template %s!", DataResource::getName())); return base->getTintIndex(); } } @@ -1129,9 +1129,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getTintIndex(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1148,7 +1148,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1164,26 +1164,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getTintIndexMin(true); #endif } if (!m_tintIndex.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter tintIndex in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter tintIndex has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter tintIndex has not been defined in template %s!", DataResource::getName())); return base->getTintIndexMin(); } } @@ -1193,9 +1193,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getTintIndexMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1212,7 +1212,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1228,26 +1228,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getTintIndexMax(true); #endif } if (!m_tintIndex.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter tintIndex in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter tintIndex has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter tintIndex has not been defined in template %s!", DataResource::getName())); return base->getTintIndexMax(); } } @@ -1257,9 +1257,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getTintIndexMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1276,7 +1276,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1286,8 +1286,8 @@ UNREF(testData); float ServerObjectTemplate::getUpdateRanges(UpdateRanges index) const { - const ServerObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } @@ -1295,14 +1295,14 @@ float ServerObjectTemplate::getUpdateRanges(UpdateRanges index) const DEBUG_FATAL(index < 0 || index >= 3, ("template param index out of range")); if (!m_updateRanges[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter updateRanges in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter updateRanges has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter updateRanges has not been defined in template %s!", DataResource::getName())); return base->getUpdateRanges(index); } } @@ -1312,9 +1312,9 @@ float ServerObjectTemplate::getUpdateRanges(UpdateRanges index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getUpdateRanges(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1335,8 +1335,8 @@ float ServerObjectTemplate::getUpdateRanges(UpdateRanges index) const float ServerObjectTemplate::getUpdateRangesMin(UpdateRanges index) const { - const ServerObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } @@ -1344,14 +1344,14 @@ float ServerObjectTemplate::getUpdateRangesMin(UpdateRanges index) const DEBUG_FATAL(index < 0 || index >= 3, ("template param index out of range")); if (!m_updateRanges[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter updateRanges in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter updateRanges has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter updateRanges has not been defined in template %s!", DataResource::getName())); return base->getUpdateRangesMin(index); } } @@ -1361,9 +1361,9 @@ float ServerObjectTemplate::getUpdateRangesMin(UpdateRanges index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getUpdateRangesMin(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1384,8 +1384,8 @@ float ServerObjectTemplate::getUpdateRangesMin(UpdateRanges index) const float ServerObjectTemplate::getUpdateRangesMax(UpdateRanges index) const { - const ServerObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } @@ -1393,14 +1393,14 @@ float ServerObjectTemplate::getUpdateRangesMax(UpdateRanges index) const DEBUG_FATAL(index < 0 || index >= 3, ("template param index out of range")); if (!m_updateRanges[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter updateRanges in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter updateRanges has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter updateRanges has not been defined in template %s!", DataResource::getName())); return base->getUpdateRangesMax(index); } } @@ -1410,9 +1410,9 @@ float ServerObjectTemplate::getUpdateRangesMax(UpdateRanges index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getUpdateRangesMax(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1433,28 +1433,28 @@ float ServerObjectTemplate::getUpdateRangesMax(UpdateRanges index) const void ServerObjectTemplate::getContents(Contents &data, int index) const { - const ServerObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_contentsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter contents in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter contents has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter contents has not been defined in template %s!", DataResource::getName())); base->getContents(data, index); return; } } - if (m_contentsAppend && base != nullptr) + if (m_contentsAppend && base != NULL) { int baseCount = base->getContentsCount(); if (index < baseCount) @@ -1477,28 +1477,28 @@ void ServerObjectTemplate::getContents(Contents &data, int index) const void ServerObjectTemplate::getContentsMin(Contents &data, int index) const { - const ServerObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_contentsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter contents in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter contents has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter contents has not been defined in template %s!", DataResource::getName())); base->getContentsMin(data, index); return; } } - if (m_contentsAppend && base != nullptr) + if (m_contentsAppend && base != NULL) { int baseCount = base->getContentsCount(); if (index < baseCount) @@ -1521,28 +1521,28 @@ void ServerObjectTemplate::getContentsMin(Contents &data, int index) const void ServerObjectTemplate::getContentsMax(Contents &data, int index) const { - const ServerObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_contentsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter contents in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter contents has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter contents has not been defined in template %s!", DataResource::getName())); base->getContentsMax(data, index); return; } } - if (m_contentsAppend && base != nullptr) + if (m_contentsAppend && base != NULL) { int baseCount = base->getContentsCount(); if (index < baseCount) @@ -1567,20 +1567,20 @@ size_t ServerObjectTemplate::getContentsCount(void) const { if (!m_contentsLoaded) { - if (m_baseData == nullptr) + if (m_baseData == NULL) return 0; const ServerObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == nullptr, ("base template wrong type")); + DEBUG_FATAL(base == NULL, ("base template wrong type")); return base->getContentsCount(); } size_t count = m_contents.size(); // if we are extending our base template, add it's count - if (m_contentsAppend && m_baseData != nullptr) + if (m_contentsAppend && m_baseData != NULL) { const ServerObjectTemplate * base = dynamic_cast(m_baseData); - if (base != nullptr) + if (base != NULL) count += base->getContentsCount(); } @@ -1589,28 +1589,28 @@ size_t ServerObjectTemplate::getContentsCount(void) const void ServerObjectTemplate::getXpPoints(Xp &data, int index) const { - const ServerObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_xpPointsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter xpPoints in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter xpPoints has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter xpPoints has not been defined in template %s!", DataResource::getName())); base->getXpPoints(data, index); return; } } - if (m_xpPointsAppend && base != nullptr) + if (m_xpPointsAppend && base != NULL) { int baseCount = base->getXpPointsCount(); if (index < baseCount) @@ -1633,28 +1633,28 @@ void ServerObjectTemplate::getXpPoints(Xp &data, int index) const void ServerObjectTemplate::getXpPointsMin(Xp &data, int index) const { - const ServerObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_xpPointsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter xpPoints in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter xpPoints has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter xpPoints has not been defined in template %s!", DataResource::getName())); base->getXpPointsMin(data, index); return; } } - if (m_xpPointsAppend && base != nullptr) + if (m_xpPointsAppend && base != NULL) { int baseCount = base->getXpPointsCount(); if (index < baseCount) @@ -1677,28 +1677,28 @@ void ServerObjectTemplate::getXpPointsMin(Xp &data, int index) const void ServerObjectTemplate::getXpPointsMax(Xp &data, int index) const { - const ServerObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_xpPointsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter xpPoints in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter xpPoints has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter xpPoints has not been defined in template %s!", DataResource::getName())); base->getXpPointsMax(data, index); return; } } - if (m_xpPointsAppend && base != nullptr) + if (m_xpPointsAppend && base != NULL) { int baseCount = base->getXpPointsCount(); if (index < baseCount) @@ -1723,20 +1723,20 @@ size_t ServerObjectTemplate::getXpPointsCount(void) const { if (!m_xpPointsLoaded) { - if (m_baseData == nullptr) + if (m_baseData == NULL) return 0; const ServerObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == nullptr, ("base template wrong type")); + DEBUG_FATAL(base == NULL, ("base template wrong type")); return base->getXpPointsCount(); } size_t count = m_xpPoints.size(); // if we are extending our base template, add it's count - if (m_xpPointsAppend && m_baseData != nullptr) + if (m_xpPointsAppend && m_baseData != NULL) { const ServerObjectTemplate * base = dynamic_cast(m_baseData); - if (base != nullptr) + if (base != NULL) count += base->getXpPointsCount(); } @@ -1751,33 +1751,33 @@ bool testDataValue = false; UNREF(testData); #endif - const ServerObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getPersistByDefault(true); #endif } if (!m_persistByDefault.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter persistByDefault in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter persistByDefault has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter persistByDefault has not been defined in template %s!", DataResource::getName())); return base->getPersistByDefault(); } } bool value = m_persistByDefault.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1793,33 +1793,33 @@ bool testDataValue = false; UNREF(testData); #endif - const ServerObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getPersistContents(true); #endif } if (!m_persistContents.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter persistContents in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter persistContents has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter persistContents has not been defined in template %s!", DataResource::getName())); return base->getPersistContents(); } } bool value = m_persistContents.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1872,12 +1872,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } @@ -1908,7 +1908,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_scripts.begin(); iter != m_scripts.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_scripts.clear(); m_scriptsAppend = file.read_bool8(); @@ -1931,7 +1931,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_visibleFlags.begin(); iter != m_visibleFlags.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_visibleFlags.clear(); m_visibleFlagsAppend = file.read_bool8(); @@ -1950,7 +1950,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_deleteFlags.begin(); iter != m_deleteFlags.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_deleteFlags.clear(); m_deleteFlagsAppend = file.read_bool8(); @@ -1969,7 +1969,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_moveFlags.begin(); iter != m_moveFlags.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_moveFlags.clear(); m_moveFlagsAppend = file.read_bool8(); @@ -2008,7 +2008,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_contents.begin(); iter != m_contents.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_contents.clear(); m_contentsAppend = file.read_bool8(); @@ -2027,7 +2027,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_xpPoints.begin(); iter != m_xpPoints.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_xpPoints.clear(); m_xpPointsAppend = file.read_bool8(); @@ -2106,33 +2106,33 @@ ServerObjectTemplate::Attributes testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getTarget(true); #endif } if (!m_target.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter target in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == nullptr, ("Template parameter target has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter target has not been defined in template %s!", DataResource::getName())); return base->getTarget(versionOk); } } Attributes value = static_cast(m_target.getValue()); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2148,26 +2148,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate::_AttribMod * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate::_AttribMod * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getValue(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValue(versionOk); } } @@ -2177,9 +2177,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getValue(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2196,7 +2196,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2212,26 +2212,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate::_AttribMod * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate::_AttribMod * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getValueMin(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValueMin(versionOk); } } @@ -2241,9 +2241,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getValueMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2260,7 +2260,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2276,26 +2276,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate::_AttribMod * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate::_AttribMod * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getValueMax(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValueMax(versionOk); } } @@ -2305,9 +2305,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getValueMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2324,7 +2324,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2340,26 +2340,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_AttribMod * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate::_AttribMod * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getTime(true); #endif } if (!m_time.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter time in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter time has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter time has not been defined in template %s!", DataResource::getName())); return base->getTime(versionOk); } } @@ -2369,9 +2369,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getTime(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2388,7 +2388,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2404,26 +2404,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_AttribMod * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate::_AttribMod * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getTimeMin(true); #endif } if (!m_time.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter time in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter time has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter time has not been defined in template %s!", DataResource::getName())); return base->getTimeMin(versionOk); } } @@ -2433,9 +2433,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getTimeMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2452,7 +2452,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2468,26 +2468,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_AttribMod * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate::_AttribMod * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getTimeMax(true); #endif } if (!m_time.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter time in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter time has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter time has not been defined in template %s!", DataResource::getName())); return base->getTimeMax(versionOk); } } @@ -2497,9 +2497,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getTimeMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2516,7 +2516,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2532,26 +2532,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_AttribMod * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate::_AttribMod * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getTimeAtValue(true); #endif } if (!m_timeAtValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter timeAtValue in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter timeAtValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter timeAtValue has not been defined in template %s!", DataResource::getName())); return base->getTimeAtValue(versionOk); } } @@ -2561,9 +2561,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getTimeAtValue(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2580,7 +2580,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2596,26 +2596,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_AttribMod * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate::_AttribMod * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getTimeAtValueMin(true); #endif } if (!m_timeAtValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter timeAtValue in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter timeAtValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter timeAtValue has not been defined in template %s!", DataResource::getName())); return base->getTimeAtValueMin(versionOk); } } @@ -2625,9 +2625,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getTimeAtValueMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2644,7 +2644,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2660,26 +2660,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_AttribMod * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate::_AttribMod * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getTimeAtValueMax(true); #endif } if (!m_timeAtValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter timeAtValue in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter timeAtValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter timeAtValue has not been defined in template %s!", DataResource::getName())); return base->getTimeAtValueMax(versionOk); } } @@ -2689,9 +2689,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getTimeAtValueMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2708,7 +2708,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2724,26 +2724,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_AttribMod * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate::_AttribMod * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getDecay(true); #endif } if (!m_decay.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter decay in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter decay has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter decay has not been defined in template %s!", DataResource::getName())); return base->getDecay(versionOk); } } @@ -2753,9 +2753,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getDecay(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2772,7 +2772,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2788,26 +2788,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_AttribMod * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate::_AttribMod * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getDecayMin(true); #endif } if (!m_decay.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter decay in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter decay has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter decay has not been defined in template %s!", DataResource::getName())); return base->getDecayMin(versionOk); } } @@ -2817,9 +2817,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getDecayMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2836,7 +2836,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2852,26 +2852,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_AttribMod * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate::_AttribMod * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getDecayMax(true); #endif } if (!m_decay.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter decay in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter decay has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter decay has not been defined in template %s!", DataResource::getName())); return base->getDecayMax(versionOk); } } @@ -2881,9 +2881,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getDecayMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2900,7 +2900,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2972,7 +2972,7 @@ char paramName[MAX_NAME_SIZE]; */ ServerObjectTemplate::Contents::Contents(void) { - content = nullptr; + content = NULL; } // ServerObjectTemplate::Contents::Contents() /** @@ -2983,7 +2983,7 @@ ServerObjectTemplate::Contents::Contents(const ServerObjectTemplate::Contents & equipObject(source.equipObject), content(source.content) { - if (content != nullptr) + if (content != NULL) const_cast(content)->addReference(); } // ServerObjectTemplate::Contents::Contents(const ServerObjectTemplate::Contents &) @@ -2992,10 +2992,10 @@ ServerObjectTemplate::Contents::Contents(const ServerObjectTemplate::Contents & */ ServerObjectTemplate::Contents::~Contents() { - if (content != nullptr) + if (content != NULL) { content->releaseReference(); - content = nullptr; + content = NULL; } } // ServerObjectTemplate::Contents::~Contents @@ -3065,33 +3065,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerObjectTemplate::_Contents * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate::_Contents * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getSlotName(true); #endif } if (!m_slotName.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter slotName in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter slotName has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter slotName has not been defined in template %s!", DataResource::getName())); return base->getSlotName(versionOk); } } const std::string & value = m_slotName.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -3107,33 +3107,33 @@ bool testDataValue = false; UNREF(testData); #endif - const ServerObjectTemplate::_Contents * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate::_Contents * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getEquipObject(true); #endif } if (!m_equipObject.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter equipObject in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter equipObject has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter equipObject has not been defined in template %s!", DataResource::getName())); return base->getEquipObject(versionOk); } } bool value = m_equipObject.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -3143,32 +3143,32 @@ UNREF(testData); const ServerObjectTemplate * ServerObjectTemplate::_Contents::getContent(bool versionOk) const { - const ServerObjectTemplate::_Contents * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate::_Contents * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_content.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter content in template %s", DataResource::getName())); - return nullptr; + return NULL; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter content has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter content has not been defined in template %s!", DataResource::getName())); return base->getContent(versionOk); } } - const ServerObjectTemplate * returnValue = nullptr; + const ServerObjectTemplate * returnValue = NULL; const std::string & templateName = m_content.getValue(); if (!templateName.empty()) { returnValue = dynamic_cast(ObjectTemplateList::fetch(templateName)); - if (returnValue == nullptr) + if (returnValue == NULL) WARNING_STRICT_FATAL(true, ("Error loading template %s",templateName.c_str())); } return returnValue; @@ -3273,33 +3273,33 @@ ServerObjectTemplate::MentalStates testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getTarget(true); #endif } if (!m_target.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter target in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == nullptr, ("Template parameter target has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter target has not been defined in template %s!", DataResource::getName())); return base->getTarget(versionOk); } } MentalStates value = static_cast(m_target.getValue()); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -3315,26 +3315,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_MentalStateMod * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate::_MentalStateMod * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getValue(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValue(versionOk); } } @@ -3344,9 +3344,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getValue(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3363,7 +3363,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -3379,26 +3379,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_MentalStateMod * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate::_MentalStateMod * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getValueMin(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValueMin(versionOk); } } @@ -3408,9 +3408,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getValueMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3427,7 +3427,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -3443,26 +3443,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_MentalStateMod * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate::_MentalStateMod * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getValueMax(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValueMax(versionOk); } } @@ -3472,9 +3472,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getValueMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3491,7 +3491,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -3507,26 +3507,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_MentalStateMod * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate::_MentalStateMod * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getTime(true); #endif } if (!m_time.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter time in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter time has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter time has not been defined in template %s!", DataResource::getName())); return base->getTime(versionOk); } } @@ -3536,9 +3536,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getTime(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3555,7 +3555,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -3571,26 +3571,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_MentalStateMod * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate::_MentalStateMod * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getTimeMin(true); #endif } if (!m_time.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter time in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter time has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter time has not been defined in template %s!", DataResource::getName())); return base->getTimeMin(versionOk); } } @@ -3600,9 +3600,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getTimeMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3619,7 +3619,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -3635,26 +3635,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_MentalStateMod * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate::_MentalStateMod * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getTimeMax(true); #endif } if (!m_time.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter time in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter time has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter time has not been defined in template %s!", DataResource::getName())); return base->getTimeMax(versionOk); } } @@ -3664,9 +3664,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getTimeMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3683,7 +3683,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -3699,26 +3699,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_MentalStateMod * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate::_MentalStateMod * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getTimeAtValue(true); #endif } if (!m_timeAtValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter timeAtValue in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter timeAtValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter timeAtValue has not been defined in template %s!", DataResource::getName())); return base->getTimeAtValue(versionOk); } } @@ -3728,9 +3728,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getTimeAtValue(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3747,7 +3747,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -3763,26 +3763,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_MentalStateMod * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate::_MentalStateMod * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getTimeAtValueMin(true); #endif } if (!m_timeAtValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter timeAtValue in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter timeAtValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter timeAtValue has not been defined in template %s!", DataResource::getName())); return base->getTimeAtValueMin(versionOk); } } @@ -3792,9 +3792,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getTimeAtValueMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3811,7 +3811,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -3827,26 +3827,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_MentalStateMod * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate::_MentalStateMod * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getTimeAtValueMax(true); #endif } if (!m_timeAtValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter timeAtValue in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter timeAtValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter timeAtValue has not been defined in template %s!", DataResource::getName())); return base->getTimeAtValueMax(versionOk); } } @@ -3856,9 +3856,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getTimeAtValueMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3875,7 +3875,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -3891,26 +3891,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_MentalStateMod * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate::_MentalStateMod * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getDecay(true); #endif } if (!m_decay.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter decay in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter decay has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter decay has not been defined in template %s!", DataResource::getName())); return base->getDecay(versionOk); } } @@ -3920,9 +3920,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getDecay(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3939,7 +3939,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -3955,26 +3955,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_MentalStateMod * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate::_MentalStateMod * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getDecayMin(true); #endif } if (!m_decay.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter decay in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter decay has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter decay has not been defined in template %s!", DataResource::getName())); return base->getDecayMin(versionOk); } } @@ -3984,9 +3984,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getDecayMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -4003,7 +4003,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -4019,26 +4019,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_MentalStateMod * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate::_MentalStateMod * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getDecayMax(true); #endif } if (!m_decay.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter decay in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter decay has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter decay has not been defined in template %s!", DataResource::getName())); return base->getDecayMax(versionOk); } } @@ -4048,9 +4048,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getDecayMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -4067,7 +4067,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -4185,33 +4185,33 @@ ServerObjectTemplate::XpTypes testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getType(true); #endif } if (!m_type.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter type in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == nullptr, ("Template parameter type has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter type has not been defined in template %s!", DataResource::getName())); return base->getType(versionOk); } } XpTypes value = static_cast(m_type.getValue()); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -4227,26 +4227,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate::_Xp * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate::_Xp * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getLevel(true); #endif } if (!m_level.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter level in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter level has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter level has not been defined in template %s!", DataResource::getName())); return base->getLevel(versionOk); } } @@ -4256,9 +4256,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getLevel(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -4275,7 +4275,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -4291,26 +4291,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate::_Xp * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate::_Xp * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getLevelMin(true); #endif } if (!m_level.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter level in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter level has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter level has not been defined in template %s!", DataResource::getName())); return base->getLevelMin(versionOk); } } @@ -4320,9 +4320,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getLevelMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -4339,7 +4339,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -4355,26 +4355,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate::_Xp * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate::_Xp * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getLevelMax(true); #endif } if (!m_level.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter level in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter level has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter level has not been defined in template %s!", DataResource::getName())); return base->getLevelMax(versionOk); } } @@ -4384,9 +4384,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getLevelMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -4403,7 +4403,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -4419,26 +4419,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate::_Xp * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate::_Xp * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getValue(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValue(versionOk); } } @@ -4448,9 +4448,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getValue(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -4467,7 +4467,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -4483,26 +4483,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate::_Xp * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate::_Xp * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getValueMin(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValueMin(versionOk); } } @@ -4512,9 +4512,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getValueMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -4531,7 +4531,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -4547,26 +4547,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate::_Xp * base = nullptr; - if (m_baseData != nullptr) + const ServerObjectTemplate::_Xp * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getValueMax(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValueMax(versionOk); } } @@ -4576,9 +4576,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getValueMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -4595,7 +4595,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlanetObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlanetObjectTemplate.cpp index 3c4e1053..985007c1 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlanetObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlanetObjectTemplate.cpp @@ -93,10 +93,10 @@ Tag ServerPlanetObjectTemplate::getTemplateVersion(void) const */ Tag ServerPlanetObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerPlanetObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerPlanetObjectTemplate::getHighestTemplateVersion @@ -120,33 +120,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerPlanetObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerPlanetObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getPlanetName(true); #endif } if (!m_planetName.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter planetName in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter planetName has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter planetName has not been defined in template %s!", DataResource::getName())); return base->getPlanetName(); } } const std::string & value = m_planetName.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -192,12 +192,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerObjectTemplate.cpp index effe5904..9051a1f9 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerObjectTemplate.cpp @@ -95,10 +95,10 @@ Tag ServerPlayerObjectTemplate::getTemplateVersion(void) const */ Tag ServerPlayerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerPlayerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerPlayerObjectTemplate::getHighestTemplateVersion @@ -151,12 +151,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerQuestObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerQuestObjectTemplate.cpp index 5949f691..ea316d04 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerQuestObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerQuestObjectTemplate.cpp @@ -95,10 +95,10 @@ Tag ServerPlayerQuestObjectTemplate::getTemplateVersion(void) const */ Tag ServerPlayerQuestObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerPlayerQuestObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerPlayerQuestObjectTemplate::getHighestTemplateVersion @@ -152,12 +152,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerResourceContainerObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerResourceContainerObjectTemplate.cpp index a5512489..bdd03637 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerResourceContainerObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerResourceContainerObjectTemplate.cpp @@ -93,10 +93,10 @@ Tag ServerResourceContainerObjectTemplate::getTemplateVersion(void) const */ Tag ServerResourceContainerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerResourceContainerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerResourceContainerObjectTemplate::getHighestTemplateVersion @@ -120,26 +120,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerResourceContainerObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerResourceContainerObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMaxResources(true); #endif } if (!m_maxResources.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxResources in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter maxResources has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter maxResources has not been defined in template %s!", DataResource::getName())); return base->getMaxResources(); } } @@ -149,9 +149,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMaxResources(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -168,7 +168,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -184,26 +184,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerResourceContainerObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerResourceContainerObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMaxResourcesMin(true); #endif } if (!m_maxResources.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxResources in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter maxResources has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter maxResources has not been defined in template %s!", DataResource::getName())); return base->getMaxResourcesMin(); } } @@ -213,9 +213,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMaxResourcesMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -232,7 +232,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -248,26 +248,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerResourceContainerObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerResourceContainerObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMaxResourcesMax(true); #endif } if (!m_maxResources.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxResources in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter maxResources has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter maxResources has not been defined in template %s!", DataResource::getName())); return base->getMaxResourcesMax(); } } @@ -277,9 +277,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMaxResourcesMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -296,7 +296,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -343,12 +343,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerShipObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerShipObjectTemplate.cpp index a2d12972..1acde7a0 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerShipObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerShipObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag ServerShipObjectTemplate::getTemplateVersion(void) const */ Tag ServerShipObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerShipObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerShipObjectTemplate::getHighestTemplateVersion @@ -121,33 +121,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerShipObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerShipObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getShipType(true); #endif } if (!m_shipType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter shipType in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter shipType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter shipType has not been defined in template %s!", DataResource::getName())); return base->getShipType(); } } const std::string & value = m_shipType.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -193,12 +193,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerStaticObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerStaticObjectTemplate.cpp index f2e49fba..767901e7 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerStaticObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerStaticObjectTemplate.cpp @@ -93,10 +93,10 @@ Tag ServerStaticObjectTemplate::getTemplateVersion(void) const */ Tag ServerStaticObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerStaticObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerStaticObjectTemplate::getHighestTemplateVersion @@ -120,33 +120,33 @@ bool testDataValue = false; UNREF(testData); #endif - const ServerStaticObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerStaticObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getClientOnlyBuildout(true); #endif } if (!m_clientOnlyBuildout.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter clientOnlyBuildout in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter clientOnlyBuildout has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter clientOnlyBuildout has not been defined in template %s!", DataResource::getName())); return base->getClientOnlyBuildout(); } } bool value = m_clientOnlyBuildout.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -192,12 +192,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerTangibleObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerTangibleObjectTemplate.cpp index 3bdb728d..39d5e817 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerTangibleObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerTangibleObjectTemplate.cpp @@ -53,7 +53,7 @@ ServerTangibleObjectTemplate::~ServerTangibleObjectTemplate() for (iter = m_triggerVolumes.begin(); iter != m_triggerVolumes.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_triggerVolumes.clear(); } @@ -105,10 +105,10 @@ Tag ServerTangibleObjectTemplate::getTemplateVersion(void) const */ Tag ServerTangibleObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerTangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerTangibleObjectTemplate::getHighestTemplateVersion @@ -126,27 +126,27 @@ Object * ServerTangibleObjectTemplate::createObject(void) const //@BEGIN TFD const TriggerVolumeData ServerTangibleObjectTemplate::getTriggerVolumes(int index) const { - const ServerTangibleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerTangibleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_triggerVolumesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter triggerVolumes in template %s", DataResource::getName())); return DefaultTriggerVolumeData; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter triggerVolumes has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter triggerVolumes has not been defined in template %s!", DataResource::getName())); return base->getTriggerVolumes(index); } } - if (m_triggerVolumesAppend && base != nullptr) + if (m_triggerVolumesAppend && base != NULL) { int baseCount = base->getTriggerVolumesCount(); if (index < baseCount) @@ -164,20 +164,20 @@ size_t ServerTangibleObjectTemplate::getTriggerVolumesCount(void) const { if (!m_triggerVolumesLoaded) { - if (m_baseData == nullptr) + if (m_baseData == NULL) return 0; const ServerTangibleObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == nullptr, ("base template wrong type")); + DEBUG_FATAL(base == NULL, ("base template wrong type")); return base->getTriggerVolumesCount(); } size_t count = m_triggerVolumes.size(); // if we are extending our base template, add it's count - if (m_triggerVolumesAppend && m_baseData != nullptr) + if (m_triggerVolumesAppend && m_baseData != NULL) { const ServerTangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base != nullptr) + if (base != NULL) count += base->getTriggerVolumesCount(); } @@ -192,33 +192,33 @@ ServerTangibleObjectTemplate::CombatSkeleton testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getCombatSkeleton(true); #endif } if (!m_combatSkeleton.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter combatSkeleton in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == nullptr, ("Template parameter combatSkeleton has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter combatSkeleton has not been defined in template %s!", DataResource::getName())); return base->getCombatSkeleton(); } } CombatSkeleton value = static_cast(m_combatSkeleton.getValue()); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -234,26 +234,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerTangibleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMaxHitPoints(true); #endif } if (!m_maxHitPoints.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxHitPoints in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter maxHitPoints has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter maxHitPoints has not been defined in template %s!", DataResource::getName())); return base->getMaxHitPoints(); } } @@ -263,9 +263,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMaxHitPoints(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -282,7 +282,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -298,26 +298,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerTangibleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMaxHitPointsMin(true); #endif } if (!m_maxHitPoints.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxHitPoints in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter maxHitPoints has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter maxHitPoints has not been defined in template %s!", DataResource::getName())); return base->getMaxHitPointsMin(); } } @@ -327,9 +327,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMaxHitPointsMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -346,7 +346,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -362,26 +362,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerTangibleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMaxHitPointsMax(true); #endif } if (!m_maxHitPoints.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxHitPoints in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter maxHitPoints has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter maxHitPoints has not been defined in template %s!", DataResource::getName())); return base->getMaxHitPointsMax(); } } @@ -391,9 +391,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMaxHitPointsMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -410,7 +410,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -420,32 +420,32 @@ UNREF(testData); const ServerArmorTemplate * ServerTangibleObjectTemplate::getArmor() const { - const ServerTangibleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerTangibleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_armor.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter armor in template %s", DataResource::getName())); - return nullptr; + return NULL; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter armor has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter armor has not been defined in template %s!", DataResource::getName())); return base->getArmor(); } } - const ServerArmorTemplate * returnValue = nullptr; + const ServerArmorTemplate * returnValue = NULL; const std::string & templateName = m_armor.getValue(); if (!templateName.empty()) { returnValue = dynamic_cast(ObjectTemplateList::fetch(templateName)); - if (returnValue == nullptr) + if (returnValue == NULL) WARNING_STRICT_FATAL(true, ("Error loading template %s",templateName.c_str())); } return returnValue; @@ -459,26 +459,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerTangibleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getInterestRadius(true); #endif } if (!m_interestRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter interestRadius in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter interestRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter interestRadius has not been defined in template %s!", DataResource::getName())); return base->getInterestRadius(); } } @@ -488,9 +488,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getInterestRadius(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -507,7 +507,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -523,26 +523,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerTangibleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getInterestRadiusMin(true); #endif } if (!m_interestRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter interestRadius in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter interestRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter interestRadius has not been defined in template %s!", DataResource::getName())); return base->getInterestRadiusMin(); } } @@ -552,9 +552,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getInterestRadiusMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -571,7 +571,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -587,26 +587,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerTangibleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getInterestRadiusMax(true); #endif } if (!m_interestRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter interestRadius in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter interestRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter interestRadius has not been defined in template %s!", DataResource::getName())); return base->getInterestRadiusMax(); } } @@ -616,9 +616,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getInterestRadiusMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -635,7 +635,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -651,26 +651,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerTangibleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getCount(true); #endif } if (!m_count.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter count in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter count has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter count has not been defined in template %s!", DataResource::getName())); return base->getCount(); } } @@ -680,9 +680,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getCount(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -699,7 +699,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -715,26 +715,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerTangibleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getCountMin(true); #endif } if (!m_count.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter count in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter count has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter count has not been defined in template %s!", DataResource::getName())); return base->getCountMin(); } } @@ -744,9 +744,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getCountMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -763,7 +763,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -779,26 +779,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerTangibleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getCountMax(true); #endif } if (!m_count.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter count in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter count has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter count has not been defined in template %s!", DataResource::getName())); return base->getCountMax(); } } @@ -808,9 +808,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getCountMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -827,7 +827,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -843,26 +843,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerTangibleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getCondition(true); #endif } if (!m_condition.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter condition in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter condition has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter condition has not been defined in template %s!", DataResource::getName())); return base->getCondition(); } } @@ -872,9 +872,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getCondition(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -891,7 +891,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -907,26 +907,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerTangibleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getConditionMin(true); #endif } if (!m_condition.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter condition in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter condition has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter condition has not been defined in template %s!", DataResource::getName())); return base->getConditionMin(); } } @@ -936,9 +936,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getConditionMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -955,7 +955,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -971,26 +971,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerTangibleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getConditionMax(true); #endif } if (!m_condition.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter condition in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter condition has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter condition has not been defined in template %s!", DataResource::getName())); return base->getConditionMax(); } } @@ -1000,9 +1000,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getConditionMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1019,7 +1019,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1035,33 +1035,33 @@ bool testDataValue = false; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerTangibleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getWantSawAttackTriggers(true); #endif } if (!m_wantSawAttackTriggers.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter wantSawAttackTriggers in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter wantSawAttackTriggers has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter wantSawAttackTriggers has not been defined in template %s!", DataResource::getName())); return base->getWantSawAttackTriggers(); } } bool value = m_wantSawAttackTriggers.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1116,12 +1116,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } @@ -1150,7 +1150,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_triggerVolumes.begin(); iter != m_triggerVolumes.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_triggerVolumes.clear(); m_triggerVolumesAppend = file.read_bool8(); diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerUniverseObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerUniverseObjectTemplate.cpp index 9bba2b4b..03a16459 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerUniverseObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerUniverseObjectTemplate.cpp @@ -93,10 +93,10 @@ Tag ServerUniverseObjectTemplate::getTemplateVersion(void) const */ Tag ServerUniverseObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerUniverseObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerUniverseObjectTemplate::getHighestTemplateVersion @@ -149,12 +149,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerVehicleObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerVehicleObjectTemplate.cpp index 838e7107..501b241a 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerVehicleObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerVehicleObjectTemplate.cpp @@ -93,10 +93,10 @@ Tag ServerVehicleObjectTemplate::getTemplateVersion(void) const */ Tag ServerVehicleObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerVehicleObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerVehicleObjectTemplate::getHighestTemplateVersion @@ -120,33 +120,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerVehicleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerVehicleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getFuelType(true); #endif } if (!m_fuelType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter fuelType in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter fuelType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter fuelType has not been defined in template %s!", DataResource::getName())); return base->getFuelType(); } } const std::string & value = m_fuelType.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -162,26 +162,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerVehicleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerVehicleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getCurrentFuel(true); #endif } if (!m_currentFuel.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter currentFuel in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter currentFuel has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter currentFuel has not been defined in template %s!", DataResource::getName())); return base->getCurrentFuel(); } } @@ -191,9 +191,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getCurrentFuel(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -210,7 +210,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -226,26 +226,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerVehicleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerVehicleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getCurrentFuelMin(true); #endif } if (!m_currentFuel.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter currentFuel in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter currentFuel has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter currentFuel has not been defined in template %s!", DataResource::getName())); return base->getCurrentFuelMin(); } } @@ -255,9 +255,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getCurrentFuelMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -274,7 +274,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -290,26 +290,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerVehicleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerVehicleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getCurrentFuelMax(true); #endif } if (!m_currentFuel.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter currentFuel in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter currentFuel has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter currentFuel has not been defined in template %s!", DataResource::getName())); return base->getCurrentFuelMax(); } } @@ -319,9 +319,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getCurrentFuelMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -338,7 +338,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -354,26 +354,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerVehicleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerVehicleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMaxFuel(true); #endif } if (!m_maxFuel.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxFuel in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter maxFuel has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter maxFuel has not been defined in template %s!", DataResource::getName())); return base->getMaxFuel(); } } @@ -383,9 +383,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMaxFuel(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -402,7 +402,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -418,26 +418,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerVehicleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerVehicleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMaxFuelMin(true); #endif } if (!m_maxFuel.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxFuel in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter maxFuel has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter maxFuel has not been defined in template %s!", DataResource::getName())); return base->getMaxFuelMin(); } } @@ -447,9 +447,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMaxFuelMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -466,7 +466,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -482,26 +482,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerVehicleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerVehicleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMaxFuelMax(true); #endif } if (!m_maxFuel.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxFuel in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter maxFuel has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter maxFuel has not been defined in template %s!", DataResource::getName())); return base->getMaxFuelMax(); } } @@ -511,9 +511,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMaxFuelMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -530,7 +530,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -546,26 +546,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerVehicleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerVehicleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getConsumpsion(true); #endif } if (!m_consumpsion.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter consumpsion in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter consumpsion has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter consumpsion has not been defined in template %s!", DataResource::getName())); return base->getConsumpsion(); } } @@ -575,9 +575,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getConsumpsion(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -594,7 +594,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -610,26 +610,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerVehicleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerVehicleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getConsumpsionMin(true); #endif } if (!m_consumpsion.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter consumpsion in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter consumpsion has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter consumpsion has not been defined in template %s!", DataResource::getName())); return base->getConsumpsionMin(); } } @@ -639,9 +639,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getConsumpsionMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -658,7 +658,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -674,26 +674,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerVehicleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerVehicleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getConsumpsionMax(true); #endif } if (!m_consumpsion.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter consumpsion in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter consumpsion has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter consumpsion has not been defined in template %s!", DataResource::getName())); return base->getConsumpsionMax(); } } @@ -703,9 +703,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getConsumpsionMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -722,7 +722,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -774,12 +774,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerWeaponObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerWeaponObjectTemplate.cpp index bf2ee2cb..8d4bbfa0 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerWeaponObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerWeaponObjectTemplate.cpp @@ -93,10 +93,10 @@ Tag ServerWeaponObjectTemplate::getTemplateVersion(void) const */ Tag ServerWeaponObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerWeaponObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerWeaponObjectTemplate::getHighestTemplateVersion @@ -120,33 +120,33 @@ ServerWeaponObjectTemplate::WeaponType testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getWeaponType(true); #endif } if (!m_weaponType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter weaponType in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == nullptr, ("Template parameter weaponType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter weaponType has not been defined in template %s!", DataResource::getName())); return base->getWeaponType(); } } WeaponType value = static_cast(m_weaponType.getValue()); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -162,33 +162,33 @@ ServerWeaponObjectTemplate::AttackType testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getAttackType(true); #endif } if (!m_attackType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter attackType in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == nullptr, ("Template parameter attackType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter attackType has not been defined in template %s!", DataResource::getName())); return base->getAttackType(); } } AttackType value = static_cast(m_attackType.getValue()); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -204,33 +204,33 @@ ServerWeaponObjectTemplate::DamageType testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getDamageType(true); #endif } if (!m_damageType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter damageType in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == nullptr, ("Template parameter damageType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter damageType has not been defined in template %s!", DataResource::getName())); return base->getDamageType(); } } DamageType value = static_cast(m_damageType.getValue()); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -246,33 +246,33 @@ ServerWeaponObjectTemplate::DamageType testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getElementalType(true); #endif } if (!m_elementalType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter elementalType in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == nullptr, ("Template parameter elementalType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter elementalType has not been defined in template %s!", DataResource::getName())); return base->getElementalType(); } } DamageType value = static_cast(m_elementalType.getValue()); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -288,26 +288,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerWeaponObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getElementalValue(true); #endif } if (!m_elementalValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter elementalValue in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter elementalValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter elementalValue has not been defined in template %s!", DataResource::getName())); return base->getElementalValue(); } } @@ -317,9 +317,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getElementalValue(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -336,7 +336,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -352,26 +352,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerWeaponObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getElementalValueMin(true); #endif } if (!m_elementalValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter elementalValue in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter elementalValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter elementalValue has not been defined in template %s!", DataResource::getName())); return base->getElementalValueMin(); } } @@ -381,9 +381,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getElementalValueMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -400,7 +400,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -416,26 +416,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerWeaponObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getElementalValueMax(true); #endif } if (!m_elementalValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter elementalValue in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter elementalValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter elementalValue has not been defined in template %s!", DataResource::getName())); return base->getElementalValueMax(); } } @@ -445,9 +445,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getElementalValueMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -464,7 +464,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -480,26 +480,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerWeaponObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMinDamageAmount(true); #endif } if (!m_minDamageAmount.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter minDamageAmount in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter minDamageAmount has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter minDamageAmount has not been defined in template %s!", DataResource::getName())); return base->getMinDamageAmount(); } } @@ -509,9 +509,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMinDamageAmount(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -528,7 +528,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -544,26 +544,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerWeaponObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMinDamageAmountMin(true); #endif } if (!m_minDamageAmount.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter minDamageAmount in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter minDamageAmount has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter minDamageAmount has not been defined in template %s!", DataResource::getName())); return base->getMinDamageAmountMin(); } } @@ -573,9 +573,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMinDamageAmountMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -592,7 +592,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -608,26 +608,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerWeaponObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMinDamageAmountMax(true); #endif } if (!m_minDamageAmount.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter minDamageAmount in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter minDamageAmount has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter minDamageAmount has not been defined in template %s!", DataResource::getName())); return base->getMinDamageAmountMax(); } } @@ -637,9 +637,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMinDamageAmountMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -656,7 +656,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -672,26 +672,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerWeaponObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMaxDamageAmount(true); #endif } if (!m_maxDamageAmount.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxDamageAmount in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter maxDamageAmount has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter maxDamageAmount has not been defined in template %s!", DataResource::getName())); return base->getMaxDamageAmount(); } } @@ -701,9 +701,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMaxDamageAmount(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -720,7 +720,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -736,26 +736,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerWeaponObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMaxDamageAmountMin(true); #endif } if (!m_maxDamageAmount.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxDamageAmount in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter maxDamageAmount has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter maxDamageAmount has not been defined in template %s!", DataResource::getName())); return base->getMaxDamageAmountMin(); } } @@ -765,9 +765,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMaxDamageAmountMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -784,7 +784,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -800,26 +800,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerWeaponObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMaxDamageAmountMax(true); #endif } if (!m_maxDamageAmount.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxDamageAmount in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter maxDamageAmount has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter maxDamageAmount has not been defined in template %s!", DataResource::getName())); return base->getMaxDamageAmountMax(); } } @@ -829,9 +829,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMaxDamageAmountMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -848,7 +848,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -864,26 +864,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerWeaponObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getAttackSpeed(true); #endif } if (!m_attackSpeed.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter attackSpeed in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter attackSpeed has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter attackSpeed has not been defined in template %s!", DataResource::getName())); return base->getAttackSpeed(); } } @@ -893,9 +893,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getAttackSpeed(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -912,7 +912,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -928,26 +928,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerWeaponObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getAttackSpeedMin(true); #endif } if (!m_attackSpeed.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter attackSpeed in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter attackSpeed has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter attackSpeed has not been defined in template %s!", DataResource::getName())); return base->getAttackSpeedMin(); } } @@ -957,9 +957,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getAttackSpeedMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -976,7 +976,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -992,26 +992,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerWeaponObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getAttackSpeedMax(true); #endif } if (!m_attackSpeed.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter attackSpeed in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter attackSpeed has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter attackSpeed has not been defined in template %s!", DataResource::getName())); return base->getAttackSpeedMax(); } } @@ -1021,9 +1021,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getAttackSpeedMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1040,7 +1040,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1056,26 +1056,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerWeaponObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getAudibleRange(true); #endif } if (!m_audibleRange.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter audibleRange in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter audibleRange has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter audibleRange has not been defined in template %s!", DataResource::getName())); return base->getAudibleRange(); } } @@ -1085,9 +1085,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getAudibleRange(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1104,7 +1104,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1120,26 +1120,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerWeaponObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getAudibleRangeMin(true); #endif } if (!m_audibleRange.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter audibleRange in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter audibleRange has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter audibleRange has not been defined in template %s!", DataResource::getName())); return base->getAudibleRangeMin(); } } @@ -1149,9 +1149,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getAudibleRangeMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1168,7 +1168,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1184,26 +1184,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerWeaponObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getAudibleRangeMax(true); #endif } if (!m_audibleRange.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter audibleRange in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter audibleRange has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter audibleRange has not been defined in template %s!", DataResource::getName())); return base->getAudibleRangeMax(); } } @@ -1213,9 +1213,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getAudibleRangeMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1232,7 +1232,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1248,26 +1248,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerWeaponObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMinRange(true); #endif } if (!m_minRange.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter minRange in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter minRange has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter minRange has not been defined in template %s!", DataResource::getName())); return base->getMinRange(); } } @@ -1277,9 +1277,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMinRange(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1296,7 +1296,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1312,26 +1312,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerWeaponObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMinRangeMin(true); #endif } if (!m_minRange.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter minRange in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter minRange has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter minRange has not been defined in template %s!", DataResource::getName())); return base->getMinRangeMin(); } } @@ -1341,9 +1341,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMinRangeMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1360,7 +1360,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1376,26 +1376,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerWeaponObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMinRangeMax(true); #endif } if (!m_minRange.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter minRange in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter minRange has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter minRange has not been defined in template %s!", DataResource::getName())); return base->getMinRangeMax(); } } @@ -1405,9 +1405,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMinRangeMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1424,7 +1424,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1440,26 +1440,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerWeaponObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMaxRange(true); #endif } if (!m_maxRange.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxRange in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter maxRange has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter maxRange has not been defined in template %s!", DataResource::getName())); return base->getMaxRange(); } } @@ -1469,9 +1469,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMaxRange(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1488,7 +1488,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1504,26 +1504,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerWeaponObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMaxRangeMin(true); #endif } if (!m_maxRange.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxRange in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter maxRange has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter maxRange has not been defined in template %s!", DataResource::getName())); return base->getMaxRangeMin(); } } @@ -1533,9 +1533,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMaxRangeMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1552,7 +1552,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1568,26 +1568,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerWeaponObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMaxRangeMax(true); #endif } if (!m_maxRange.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxRange in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter maxRange has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter maxRange has not been defined in template %s!", DataResource::getName())); return base->getMaxRangeMax(); } } @@ -1597,9 +1597,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMaxRangeMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1616,7 +1616,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1632,26 +1632,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerWeaponObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getDamageRadius(true); #endif } if (!m_damageRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter damageRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter damageRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter damageRadius has not been defined in template %s!", DataResource::getName())); return base->getDamageRadius(); } } @@ -1661,9 +1661,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getDamageRadius(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1680,7 +1680,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1696,26 +1696,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerWeaponObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getDamageRadiusMin(true); #endif } if (!m_damageRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter damageRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter damageRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter damageRadius has not been defined in template %s!", DataResource::getName())); return base->getDamageRadiusMin(); } } @@ -1725,9 +1725,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getDamageRadiusMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1744,7 +1744,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1760,26 +1760,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerWeaponObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getDamageRadiusMax(true); #endif } if (!m_damageRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter damageRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter damageRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter damageRadius has not been defined in template %s!", DataResource::getName())); return base->getDamageRadiusMax(); } } @@ -1789,9 +1789,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getDamageRadiusMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1808,7 +1808,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1824,26 +1824,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerWeaponObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getWoundChance(true); #endif } if (!m_woundChance.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter woundChance in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter woundChance has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter woundChance has not been defined in template %s!", DataResource::getName())); return base->getWoundChance(); } } @@ -1853,9 +1853,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getWoundChance(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1872,7 +1872,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1888,26 +1888,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerWeaponObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getWoundChanceMin(true); #endif } if (!m_woundChance.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter woundChance in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter woundChance has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter woundChance has not been defined in template %s!", DataResource::getName())); return base->getWoundChanceMin(); } } @@ -1917,9 +1917,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getWoundChanceMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1936,7 +1936,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1952,26 +1952,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerWeaponObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getWoundChanceMax(true); #endif } if (!m_woundChance.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter woundChance in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter woundChance has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter woundChance has not been defined in template %s!", DataResource::getName())); return base->getWoundChanceMax(); } } @@ -1981,9 +1981,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getWoundChanceMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2000,7 +2000,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2016,26 +2016,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerWeaponObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getAttackCost(true); #endif } if (!m_attackCost.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter attackCost in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter attackCost has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter attackCost has not been defined in template %s!", DataResource::getName())); return base->getAttackCost(); } } @@ -2045,9 +2045,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getAttackCost(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2064,7 +2064,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2080,26 +2080,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerWeaponObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getAttackCostMin(true); #endif } if (!m_attackCost.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter attackCost in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter attackCost has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter attackCost has not been defined in template %s!", DataResource::getName())); return base->getAttackCostMin(); } } @@ -2109,9 +2109,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getAttackCostMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2128,7 +2128,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2144,26 +2144,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerWeaponObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getAttackCostMax(true); #endif } if (!m_attackCost.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter attackCost in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter attackCost has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter attackCost has not been defined in template %s!", DataResource::getName())); return base->getAttackCostMax(); } } @@ -2173,9 +2173,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getAttackCostMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2192,7 +2192,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2208,26 +2208,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerWeaponObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getAccuracy(true); #endif } if (!m_accuracy.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter accuracy in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter accuracy has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter accuracy has not been defined in template %s!", DataResource::getName())); return base->getAccuracy(); } } @@ -2237,9 +2237,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getAccuracy(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2256,7 +2256,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2272,26 +2272,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerWeaponObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getAccuracyMin(true); #endif } if (!m_accuracy.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter accuracy in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter accuracy has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter accuracy has not been defined in template %s!", DataResource::getName())); return base->getAccuracyMin(); } } @@ -2301,9 +2301,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getAccuracyMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2320,7 +2320,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2336,26 +2336,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const ServerWeaponObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getAccuracyMax(true); #endif } if (!m_accuracy.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter accuracy in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter accuracy has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter accuracy has not been defined in template %s!", DataResource::getName())); return base->getAccuracyMax(); } } @@ -2365,9 +2365,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getAccuracyMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2384,7 +2384,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2455,12 +2455,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerXpManagerObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerXpManagerObjectTemplate.cpp index 0fc6ff30..4ee70d19 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerXpManagerObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerXpManagerObjectTemplate.cpp @@ -95,10 +95,10 @@ Tag ServerXpManagerObjectTemplate::getTemplateVersion(void) const */ Tag ServerXpManagerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerXpManagerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerXpManagerObjectTemplate::getHighestTemplateVersion @@ -111,7 +111,7 @@ Tag ServerXpManagerObjectTemplate::getHighestTemplateVersion(void) const Object * ServerXpManagerObjectTemplate::createObject(void) const { // return new XpManagerObject(this); - return nullptr; + return NULL; } // ServerXpManagerObjectTemplate::createObject //@BEGIN TFD @@ -152,12 +152,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/pvp/Pvp.cpp b/engine/server/library/serverGame/src/shared/pvp/Pvp.cpp index d6e291ae..4de849cd 100755 --- a/engine/server/library/serverGame/src/shared/pvp/Pvp.cpp +++ b/engine/server/library/serverGame/src/shared/pvp/Pvp.cpp @@ -613,7 +613,7 @@ void Pvp::updateTimedFlags(const void *context) unsigned long const updateTimeMs = static_cast(ConfigServerGame::getPvpUpdateTimeMs()); PvpInternal::updateTimedFlags(updateTimeMs); - getScheduler().setCallback(Pvp::updateTimedFlags, nullptr, updateTimeMs); + getScheduler().setCallback(Pvp::updateTimedFlags, NULL, updateTimeMs); } // ---------------------------------------------------------------------- @@ -754,7 +754,7 @@ Pvp::GcwScoreCategory const * Pvp::getGcwScoreCategory(std::string const & score if (iterFind != s_gcwScoreCategory.end()) return iterFind->second; - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -765,7 +765,7 @@ Pvp::GcwScoreCategory const * Pvp::getGcwScoreDefaultCategoryForPlanet(std::stri if (iterFind != s_gcwScoreDefaultCategoryForPlanet.end()) return iterFind->second; - return nullptr; + return NULL; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/pvp/PvpRuleSetBase.cpp b/engine/server/library/serverGame/src/shared/pvp/PvpRuleSetBase.cpp index d0c4212f..440b0ed7 100755 --- a/engine/server/library/serverGame/src/shared/pvp/PvpRuleSetBase.cpp +++ b/engine/server/library/serverGame/src/shared/pvp/PvpRuleSetBase.cpp @@ -27,8 +27,8 @@ namespace PvpRuleSetBaseNamespace // if object is authoritative, then apply repercussions immediately; // otherwise, forward repercussions over to the authoritative server - PvpUpdateObserver * o = nullptr; - MessageQueuePvpCommand * messageQueuePvpCommand = nullptr; + PvpUpdateObserver * o = NULL; + MessageQueuePvpCommand * messageQueuePvpCommand = NULL; if (actor.isAuthoritative()) o = new PvpUpdateObserver(&actor, Archive::ADOO_generic); diff --git a/engine/server/library/serverGame/src/shared/pvp/PvpUpdateObserver.cpp b/engine/server/library/serverGame/src/shared/pvp/PvpUpdateObserver.cpp index d333bbb0..70f55095 100755 --- a/engine/server/library/serverGame/src/shared/pvp/PvpUpdateObserver.cpp +++ b/engine/server/library/serverGame/src/shared/pvp/PvpUpdateObserver.cpp @@ -81,7 +81,7 @@ PvpUpdateObserver::PvpUpdateObserver(TangibleObject const *who, Archive::AutoDel m_pvpFaction = who->getPvpFaction(); // get client visible status for everyone observing this object (including itself) - if ((s_objectsProcessedThisFrame.count(who->getNetworkId()) == 0) && satisfyPvpSyncCondition(who->isNonPvpObject(), who->hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (who->asCreatureObject() != nullptr), who->getPvpFaction())) + if ((s_objectsProcessedThisFrame.count(who->getNetworkId()) == 0) && satisfyPvpSyncCondition(who->isNonPvpObject(), who->hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (who->asCreatureObject() != NULL), who->getPvpFaction())) { std::set const &clients = who->getObservers(); for (std::set::const_iterator i = clients.begin(); i != clients.end(); ++i) @@ -146,8 +146,8 @@ PvpUpdateObserver::~PvpUpdateObserver() PvpData::isRebelFactionId(m_obj->getPvpFaction())) { // did the object's "pvp sync" status change because of the faction change? - bool const wasPvpSync = PvpUpdateObserver::satisfyPvpSyncCondition(m_obj->isNonPvpObject(), m_obj->hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (m_obj->asCreatureObject() != nullptr), m_pvpFaction); - bool const isPvpSync = PvpUpdateObserver::satisfyPvpSyncCondition(m_obj->isNonPvpObject(), m_obj->hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (m_obj->asCreatureObject() != nullptr), m_obj->getPvpFaction()); + bool const wasPvpSync = PvpUpdateObserver::satisfyPvpSyncCondition(m_obj->isNonPvpObject(), m_obj->hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (m_obj->asCreatureObject() != NULL), m_pvpFaction); + bool const isPvpSync = PvpUpdateObserver::satisfyPvpSyncCondition(m_obj->isNonPvpObject(), m_obj->hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (m_obj->asCreatureObject() != NULL), m_obj->getPvpFaction()); if (wasPvpSync != isPvpSync) { @@ -173,7 +173,7 @@ PvpUpdateObserver::~PvpUpdateObserver() void PvpUpdateObserver::updatePvpStatusCache(Client const *client, TangibleObject const &who, uint32 flags, uint32 factionId) { - if (!client || !who.getNetworkId().isValid() || !PvpUpdateObserver::satisfyPvpSyncCondition(who.isNonPvpObject(), who.hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (who.asCreatureObject() != nullptr), who.getPvpFaction())) + if (!client || !who.getNetworkId().isValid() || !PvpUpdateObserver::satisfyPvpSyncCondition(who.isNonPvpObject(), who.hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (who.asCreatureObject() != NULL), who.getPvpFaction())) return; s_pvpUpdateObserverCache[client][who.getNetworkId()] = std::make_pair(flags, factionId); diff --git a/engine/server/library/serverGame/src/shared/region/Region.cpp b/engine/server/library/serverGame/src/shared/region/Region.cpp index c24a3500..fc74229a 100755 --- a/engine/server/library/serverGame/src/shared/region/Region.cpp +++ b/engine/server/library/serverGame/src/shared/region/Region.cpp @@ -22,7 +22,7 @@ static std::map s_nameCrcRegionMap; * Class constructor for a static region. */ Region::Region() : - m_bounds(nullptr), + m_bounds(NULL), m_dynamicRegionId(), m_name(), m_nameCrc(0), @@ -49,7 +49,7 @@ Region::Region() : * @param dynamicRegionId the id of the dynamic region object */ Region::Region(const CachedNetworkId & dynamicRegionId) : - m_bounds(nullptr), + m_bounds(NULL), m_dynamicRegionId(dynamicRegionId), m_name(), m_nameCrc(0), @@ -83,7 +83,7 @@ Region::~Region() } delete const_cast(m_bounds); - m_bounds = nullptr; + m_bounds = NULL; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/region/RegionMaster.cpp b/engine/server/library/serverGame/src/shared/region/RegionMaster.cpp index d8f734a6..6cbb7710 100755 --- a/engine/server/library/serverGame/src/shared/region/RegionMaster.cpp +++ b/engine/server/library/serverGame/src/shared/region/RegionMaster.cpp @@ -82,7 +82,7 @@ struct RegionMaster::RegionData MxCifQuadTree * tree; RegionsMappedByName nameMap; - RegionData() : tree(nullptr), nameMap() {} + RegionData() : tree(NULL), nameMap() {} }; namespace RegionMasterNamspace @@ -133,7 +133,7 @@ void RegionMaster::exit() i1 != ms_planetRegions.end(); ++i1) { delete (*i1).second.tree; - (*i1).second.tree = nullptr; + (*i1).second.tree = NULL; } ms_planetRegions.clear(); } @@ -143,7 +143,7 @@ void RegionMaster::exit() i2 != ms_staticRegions.end(); ++i2) { delete const_cast(*i2); - *i2 = nullptr; + *i2 = NULL; } ms_staticRegions.clear(); } @@ -153,7 +153,7 @@ void RegionMaster::exit() i2 != ms_dynamicRegions.end(); ++i2) { delete const_cast(*i2); - *i2 = nullptr; + *i2 = NULL; } ms_dynamicRegions.clear(); } @@ -178,7 +178,7 @@ void RegionMaster::readRegionDataTables() const char * regionFilesName = ConfigServerGame::getRegionFilesName(); DataTable * const regionFilesTable = DataTableManager::getTable(regionFilesName, true); - if (regionFilesTable == nullptr) + if (regionFilesTable == NULL) { WARNING(true, ("RegionMaster::readRegionDataTables could not open file %s, static regions will not be read!", regionFilesName)); return; @@ -197,14 +197,14 @@ void RegionMaster::readRegionDataTables() float regionMaxY = regionFilesTable->getFloatValue (5, i); DataTable * const regionTable = DataTableManager::getTable(regionFileName, true); - if (regionTable == nullptr) + if (regionTable == NULL) { WARNING(true, ("RegionMaster::readRegionDataTables could not open region file %s.", regionFileName.c_str())); continue; } RegionData & regionData = ms_planetRegions[planetName]; - if (regionData.tree == nullptr) + if (regionData.tree == NULL) { regionData.tree = new MxCifQuadTree(regionMinX, regionMinY, regionMaxX, regionMaxY, ConfigServerGame::getRegionTreeDepth()); } @@ -246,7 +246,7 @@ void RegionMaster::readRegionDataTables() } // create a rectangular or circular region and add it to the region tree - Region * region = nullptr; + Region * region = NULL; switch (geometry) { case RG_rectagle: @@ -284,7 +284,7 @@ void RegionMaster::readRegionDataTables() continue; } // set the rest of the region's data - if (region != nullptr) + if (region != NULL) { region->setName(name); region->setPlanet(planetName); @@ -400,7 +400,7 @@ void RegionMaster::createNewDynamicRegion(float minX, float minZ, * @param visible visible flag * @param notify notify flag * - * @return the new region, or nullptr on error + * @return the new region, or NULL on error */ void RegionMaster::createNewDynamicRegion(float centerX, float centerZ, float radius, const Unicode::String & name, const std::string & planet, int pvp, @@ -512,7 +512,7 @@ const Region * RegionMaster::addDynamicRegion(const UniverseObject & source) if (!ms_installed) { WARNING(true, ("RegionMaster::addDynamicRegion, not installed")); - return nullptr; + return NULL; } DynamicVariableList::NestedList regionObjvars(source.getObjVars(),OBJVAR_DYNAMIC_REGION); @@ -521,124 +521,124 @@ const Region * RegionMaster::addDynamicRegion(const UniverseObject & source) if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_PLANET,planet)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no planet data", source.getNetworkId().getValueString().c_str())); - return nullptr; + return NULL; } Unicode::String name; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_NAME,name)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no name data", source.getNetworkId().getValueString().c_str())); - return nullptr; + return NULL; } if (name.empty()) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has empty " "name data", source.getNetworkId().getValueString().c_str())); - return nullptr; + return NULL; } int geometry = 0; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_GEOMETRY,geometry)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "geometry data", source.getNetworkId().getValueString().c_str())); - return nullptr; + return NULL; } float minX; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_MINX,minX)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "minX data", source.getNetworkId().getValueString().c_str())); - return nullptr; + return NULL; } float minY; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_MINY,minY)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "minY data", source.getNetworkId().getValueString().c_str())); - return nullptr; + return NULL; } float maxX; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_MAXX,maxX)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "maxX data", source.getNetworkId().getValueString().c_str())); - return nullptr; + return NULL; } float maxY; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_MAXY,maxY)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "maxY data", source.getNetworkId().getValueString().c_str())); - return nullptr; + return NULL; } int pvp=0; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_PVP,pvp)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "pvp data", source.getNetworkId().getValueString().c_str())); - return nullptr; + return NULL; } int geography=0; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_GEOGRAPHY,geography)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "geography data", source.getNetworkId().getValueString().c_str())); - return nullptr; + return NULL; } int minDifficulty = 0; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_MIN_DIFFICULTY, minDifficulty)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "min difficulty data", source.getNetworkId().getValueString().c_str())); - return nullptr; + return NULL; } int maxDifficulty = 0; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_MAX_DIFFICULTY, maxDifficulty)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "max difficulty data", source.getNetworkId().getValueString().c_str())); - return nullptr; + return NULL; } int spawn = 0; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_SPAWN,spawn)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "spawn data", source.getNetworkId().getValueString().c_str())); - return nullptr; + return NULL; } int mission = 0; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_MISSION,mission)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "mission data", source.getNetworkId().getValueString().c_str())); - return nullptr; + return NULL; } int buildable = 0; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_BUILDABLE,buildable)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "buildable data", source.getNetworkId().getValueString().c_str())); - return nullptr; + return NULL; } int municipal = 0; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_MUNICIPAL,municipal)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "municipal data", source.getNetworkId().getValueString().c_str())); - return nullptr; + return NULL; } int visible = 0; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_VISIBLE,visible)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "visible data", source.getNetworkId().getValueString().c_str())); - return nullptr; + return NULL; } int notify = 0; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_NOTIFY,notify)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "notify data", source.getNetworkId().getValueString().c_str())); - return nullptr; + return NULL; } // find the appropriate region data for the planet @@ -650,14 +650,14 @@ const Region * RegionMaster::addDynamicRegion(const UniverseObject & source) WARNING(true, ("RegionMaster::addDynamicRegion object %s gave unknown " "planet %s for its region", source.getNetworkId().getValueString().c_str(), Unicode::wideToNarrow(planet).c_str())); - return nullptr; + return NULL; } RegionData & regionData = (*result).second; - if (regionData.tree == nullptr) + if (regionData.tree == NULL) { WARNING_STRICT_FATAL(true, ("RegionMaster::addDynamicRegion planet %s " "has no tree defined!", Unicode::wideToNarrow(planet).c_str())); - return nullptr; + return NULL; } // make sure the region name is unique @@ -666,11 +666,11 @@ const Region * RegionMaster::addDynamicRegion(const UniverseObject & source) WARNING(true, ("RegionMaster::addDynamicRegion object %s is trying " "to add duplicate region %s", source.getNetworkId().getValueString().c_str(), Unicode::wideToNarrow(name).c_str())); - return nullptr; + return NULL; } // create a rectangular or circular region and add it to the region tree - Region * region = nullptr; + Region * region = NULL; switch (geometry) { case RG_rectagle: @@ -706,14 +706,14 @@ const Region * RegionMaster::addDynamicRegion(const UniverseObject & source) DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has unknown " "geometry type", source.getNetworkId().getValueString().c_str(), geometry)); - return nullptr; + return NULL; } - if (region == nullptr) + if (region == NULL) { WARNING(true, ("RegionMaster::readRegionDataTables could " "not add region defined by object %s to region tree", source.getNetworkId().getValueString().c_str())); - return nullptr; + return NULL; } // set the rest of the region's data @@ -803,7 +803,7 @@ void RegionMaster::removeDynamicRegion(const UniverseObject & source) return; } RegionData & regionData = (*dataResult).second; - if (regionData.tree == nullptr) + if (regionData.tree == NULL) { WARNING_STRICT_FATAL(true, ("RegionMaster::addDynamicRegion planet %s " "has no tree defined!", Unicode::wideToNarrow(planet).c_str())); @@ -888,7 +888,7 @@ const Region * RegionMaster::getDynamicRegionFromObject(const UniverseObject & s if (!ms_installed) { WARNING(true, ("RegionMaster::getDynamicRegionFromObject, not installed")); - return nullptr; + return NULL; } DynamicVariableList::NestedList regionObjVars(source.getObjVars(),OBJVAR_DYNAMIC_REGION); @@ -898,14 +898,14 @@ const Region * RegionMaster::getDynamicRegionFromObject(const UniverseObject & s { DEBUG_WARNING(true, ("RegionMaster::getDynamicRegionFromObject object %s has no " "planet data", source.getNetworkId().getValueString().c_str())); - return nullptr; + return NULL; } Unicode::String name; if (!regionObjVars.getItem(OBJVAR_DYNAMIC_REGION_NAME,name)) { DEBUG_WARNING(true, ("RegionMaster::getDynamicRegionFromObject object %s has no " "name data", source.getNetworkId().getValueString().c_str())); - return nullptr; + return NULL; } return getRegionByName(Unicode::wideToNarrow(planet), name); @@ -921,17 +921,17 @@ Region * RegionMaster::getRegionByName(const std::string & planetName, const Uni if (!ms_installed) { WARNING(true, ("RegionMaster::getRegionByName, not installed")); - return nullptr; + return NULL; } const RegionData & regionData = ms_planetRegions[planetName]; - if (regionData.tree != nullptr) + if (regionData.tree != NULL) { RegionsMappedByName::const_iterator result = regionData.nameMap.find(regionName); if (result != regionData.nameMap.end()) return (*result).second; } - return nullptr; + return NULL; } // RegionMaster::getRegionByName //---------------------------------------------------------------------- @@ -944,18 +944,18 @@ const Region * RegionMaster::getSmallestRegionAtPoint(const std::string & planet if (!ms_installed) { WARNING(true, ("RegionMaster::getSmallestRegionAtPoint, not installed")); - return nullptr; + return NULL; } std::vector regions; getRegionsAtPoint(planet, x, z, regions); float area = 0; - const Region * region = nullptr; + const Region * region = NULL; for (std::vector::const_iterator iter = regions.begin(); iter != regions.end(); ++iter) { - if (region == nullptr) + if (region == NULL) { region = *iter; area = region->getArea(); @@ -983,19 +983,19 @@ const Region * RegionMaster::getSmallestVisibleRegionAtPoint(const std::string & if (!ms_installed) { WARNING(true, ("RegionMaster::getSmallestRegionAtPoint, not installed")); - return nullptr; + return NULL; } std::vector regions; getRegionsAtPoint(planet, x, z, regions); float area = 0; - const Region * region = nullptr; + const Region * region = NULL; for (std::vector::const_iterator iter = regions.begin(); iter != regions.end(); ++iter) { if ((*iter)->isVisible()) { - if (region == nullptr) + if (region == NULL) { region = *iter; area = region->getArea(); @@ -1036,7 +1036,7 @@ void RegionMaster::getRegionsAtPoint(const std::string & planet, float x, float } const RegionData & regionData = ms_planetRegions[planet]; - if (regionData.tree != nullptr) + if (regionData.tree != NULL) { std::vector objects; regionData.tree->getObjectsAt(x, z, objects); @@ -1065,7 +1065,7 @@ void RegionMaster::getRegionsForPlanet(const std::string & planetName, } const RegionData & regionData = ms_planetRegions[planetName]; - if (regionData.tree != nullptr) + if (regionData.tree != NULL) { std::vector objects; regionData.tree->getAllObjects(objects); @@ -1222,7 +1222,7 @@ bool RegionMaster::setDynamicSpawnRegionObjectData(UniverseObject & object, int municipal, int geography, int minDifficulty, int maxDifficulty, int spawnable, int mission, bool visible, bool notify, std::string spawntable, int duration) { - time_t const birthEpoch = ::time(nullptr); + time_t const birthEpoch = ::time(NULL); time_t const endEpoch = birthEpoch + (duration * 60); // Duration is in minutes. object.setObjVarItem(OBJVAR_DYNAMIC_REGION + "." + OBJVAR_DYNAMIC_REGION_NAME, name); diff --git a/engine/server/library/serverGame/src/shared/resource/SurveySystem.cpp b/engine/server/library/serverGame/src/shared/resource/SurveySystem.cpp index 93c8f549..cac26554 100755 --- a/engine/server/library/serverGame/src/shared/resource/SurveySystem.cpp +++ b/engine/server/library/serverGame/src/shared/resource/SurveySystem.cpp @@ -132,7 +132,7 @@ bool SurveySystem::TaskSurvey::run() Client const * client = GameServer::getInstance().getClient(m_playerId); ResourceTypeObject const * typeObj = ServerUniverse::getInstance().getResourceTypeByName(*m_resourceTypeName); ResourceClassObject const * parentClass = ServerUniverse::getInstance().getResourceClassByName(*m_parentResourceClassName); - ResourcePoolObject const * pool = typeObj ? typeObj->getPoolForCurrentPlanet() : nullptr; + ResourcePoolObject const * pool = typeObj ? typeObj->getPoolForCurrentPlanet() : NULL; int distBetweenPoints = m_surveyRange / (m_numPoints - 1); // -1 is so that we get points at both ends int radius = m_surveyRange / 2; diff --git a/engine/server/library/serverGame/src/shared/space/Missile.cpp b/engine/server/library/serverGame/src/shared/space/Missile.cpp index 67582022..bd4400a5 100755 --- a/engine/server/library/serverGame/src/shared/space/Missile.cpp +++ b/engine/server/library/serverGame/src/shared/space/Missile.cpp @@ -304,7 +304,7 @@ ServerObject * Missile::getSourceServerObject() const if (sourceObject) return sourceObject->asServerObject(); else - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -315,7 +315,7 @@ ServerObject * Missile::getTargetServerObject() const if (targetObject) return targetObject->asServerObject(); else - return nullptr; + return NULL; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/space/MissileManager.cpp b/engine/server/library/serverGame/src/shared/space/MissileManager.cpp index 512696ff..ab30ae81 100755 --- a/engine/server/library/serverGame/src/shared/space/MissileManager.cpp +++ b/engine/server/library/serverGame/src/shared/space/MissileManager.cpp @@ -21,7 +21,7 @@ // ====================================================================== -MissileManager * MissileManager::ms_instance = nullptr; +MissileManager * MissileManager::ms_instance = NULL; // ====================================================================== @@ -37,7 +37,7 @@ void MissileManager::install() void MissileManager::remove() { delete ms_instance; - ms_instance = nullptr; + ms_instance = NULL; } // ---------------------------------------------------------------------- @@ -217,7 +217,7 @@ Missile * MissileManager::getMissile(int missileId) if (i!=m_missiles.end()) return i->second; else - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -228,7 +228,7 @@ const Missile * MissileManager::getConstMissile(int missileId) const if (i!=m_missiles.end()) return i->second; else - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -241,13 +241,13 @@ int MissileManager::getNearestUnlockedMissileForTarget(const NetworkId &target) { const std::pair range=m_missilesForTarget.equal_range(target); - const Missile *targetedMissile=nullptr; + const Missile *targetedMissile=NULL; for (MissilesForTargetType::const_iterator i=range.first; i!=range.second; ++i) { const Missile * const missile=getConstMissile(i->second); DEBUG_FATAL(!missile,("Programmer bug: Missile %i was in m_missilesForTarget, but was not in m_missiles",i->second)); if (missile && missile->getState() == Missile::MS_Launched && - (!targetedMissile || (missile->getImpactTime() < targetedMissile->getImpactTime()))) //lint !e774: missile is non-nullptr in debug mode + (!targetedMissile || (missile->getImpactTime() < targetedMissile->getImpactTime()))) //lint !e774: missile is non-null in debug mode targetedMissile = missile; } @@ -315,7 +315,7 @@ const MissileManager::MissileTypeDataRecord * MissileManager::getMissileTypeData if (i!=m_missileTypeData.end()) return &(i->second); else - return nullptr; + return NULL; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/space/NebulaManagerServer.cpp b/engine/server/library/serverGame/src/shared/space/NebulaManagerServer.cpp index 910cbcc3..432d57f6 100755 --- a/engine/server/library/serverGame/src/shared/space/NebulaManagerServer.cpp +++ b/engine/server/library/serverGame/src/shared/space/NebulaManagerServer.cpp @@ -89,7 +89,7 @@ void NebulaManagerServer::update(float elapsedTime) void NebulaManagerServer::enqueueLightning(NebulaLightningData const & nebulaLightningData) { Nebula const * const nebula = NebulaManager::getNebulaById(nebulaLightningData.nebulaId); - if (nebula == nullptr) + if (nebula == NULL) { WARNING(true, ("NebulaManagerServer::enqueueLightning invalid nebula [%d]", nebulaLightningData.nebulaId)); return; @@ -164,7 +164,7 @@ void NebulaManagerServer::handleEnqueuedLightningEvents() NebulaLightningData const & nebulaLightningData = (*it); Nebula const * const nebula = NebulaManager::getNebulaById(nebulaLightningData.nebulaId); - if (nebula == nullptr) + if (nebula == NULL) { it = s_lightningDataVector.erase(it); continue; @@ -203,7 +203,7 @@ void NebulaManagerServer::handleEnqueuedLightningEvents() ServerObject const * const serverHitObject = hitObject->asServerObject(); ShipObject const * const shipHitObject = serverHitObject->asShipObject(); - if (shipHitObject != nullptr) + if (shipHitObject != NULL) { NetworkIdTimeMap::const_iterator const oit = s_objectsRecentlyHitByLightning.find(CachedNetworkId(*hitObject)); if (oit == s_objectsRecentlyHitByLightning.end() || (*oit).second < clockTimeMs) @@ -304,7 +304,7 @@ void NebulaManagerServer::generateLightningEvents(float elapsedTime) void NebulaManagerServer::handleEnvironmentalDamage(ServerObject & victim, int nebulaId) { Nebula const * const nebula = NebulaManager::getNebulaById(nebulaId); - if (nebula == nullptr) + if (nebula == NULL) return; float const environmentalDamageFrequency = nebula->getEnvironmentalDamageFrequency(); diff --git a/engine/server/library/serverGame/src/shared/space/ProjectileManager.cpp b/engine/server/library/serverGame/src/shared/space/ProjectileManager.cpp index 2354ae60..61ff31b3 100755 --- a/engine/server/library/serverGame/src/shared/space/ProjectileManager.cpp +++ b/engine/server/library/serverGame/src/shared/space/ProjectileManager.cpp @@ -85,7 +85,7 @@ namespace ProjectileManagerNamespace //---------------------------------------------------------------------- Projectile() : - m_owner(nullptr), + m_owner(NULL), m_weaponIndex(0), m_projectileIndex(0), m_targetedComponent(0), @@ -155,7 +155,7 @@ namespace ProjectileManagerNamespace ColliderList collidedWith; CollisionWorld::getDatabase()->queryFor(static_cast(SpatialDatabase::Q_Physicals), CellProperty::getWorldCellProperty(), true, projectileCapsule_w, collidedWith); - Object * closestObject = nullptr; + Object * closestObject = NULL; float smallestTime = 0.0f; Vector collisionPosition_o; @@ -166,14 +166,14 @@ namespace ProjectileManagerNamespace { // find which object it collided with first, and when BaseExtent const * const extent_l = (*i)->getExtent_l(); - if (extent_l == nullptr) - WARNING(true, ("ProjectileManager collided with object with nullptr extent. [%s], appearance=[%s]", collider.getDebugName(), collider.getAppearanceTemplateName())); + if (extent_l == NULL) + WARNING(true, ("ProjectileManager collided with object with null extent. [%s], appearance=[%s]", collider.getDebugName(), collider.getAppearanceTemplateName())); else { Vector const start_o = collider.rotateTranslate_w2o(projectilePosition_w); Vector const end_o = collider.rotateTranslate_w2o(projectilePosition_w + projectilePath); float time; - if (extent_l->intersect(start_o, end_o, nullptr, &time)) + if (extent_l->intersect(start_o, end_o, NULL, &time)) { if (!closestObject || time < smallestTime) { @@ -415,7 +415,7 @@ void ProjectileManager::update(float timePassed) // static ShipObject * const shipObject = projectile.getOwner(); - if (nullptr == shipObject) + if (NULL == shipObject) { WARNING(true, ("ProjectileManager beam weapon [%d] for ship id [%s], ship object no longer exists.", weaponIndex, shipId.getValueString().c_str())); } diff --git a/engine/server/library/serverGame/src/shared/space/ServerAsteroidManager.cpp b/engine/server/library/serverGame/src/shared/space/ServerAsteroidManager.cpp index 09fb57d0..1a0cfa50 100755 --- a/engine/server/library/serverGame/src/shared/space/ServerAsteroidManager.cpp +++ b/engine/server/library/serverGame/src/shared/space/ServerAsteroidManager.cpp @@ -116,10 +116,10 @@ ServerAsteroidManager::FieldHandle ServerAsteroidManager::generateField(Asteroid return BAD_HANDLE; } - ServerObject * newAsteroid = nullptr; + ServerObject * newAsteroid = NULL; //TODO disable server-rotation for now, it apparently spams the client horribly -// RotationDynamics * rotationDynamics = nullptr; +// RotationDynamics * rotationDynamics = NULL; for(std::vector::iterator i = asteroidDatas.begin(); i != asteroidDatas.end(); ++i) { @@ -274,7 +274,7 @@ void ServerAsteroidManager::getServerAsteroidData(std::vector & /*OUT*/ for(std::vector::iterator i = ms_asteroids.begin(); i != ms_asteroids.end(); ++i) { Object const * const o = NetworkIdManager::getObjectById(*i); - ServerObject const * const so = o ? o->asServerObject() : nullptr; + ServerObject const * const so = o ? o->asServerObject() : NULL; if(so) { spheres.push_back(so->getSphereExtent()); @@ -297,9 +297,9 @@ void ServerAsteroidManager::sendServerAsteroidDataToPlayer(NetworkId const & pla MessageQueueGenericValueType > * const msg = new MessageQueueGenericValueType >(spheres); Object * const o = NetworkIdManager::getObjectById(player); - ServerObject * const so = o ? o->asServerObject() : nullptr; - CreatureObject * const co = so ? so->asCreatureObject() : nullptr; - Client const * const client = co ? co->getClient() : nullptr; + ServerObject * const so = o ? o->asServerObject() : NULL; + CreatureObject * const co = so ? so->asCreatureObject() : NULL; + Client const * const client = co ? co->getClient() : NULL; if(client && co && co->isAuthoritative()) { co->getController()->appendMessage(static_cast(CM_serverAsteroidDebugData), 0.0f, msg, diff --git a/engine/server/library/serverGame/src/shared/space/ServerShipComponentData.cpp b/engine/server/library/serverGame/src/shared/space/ServerShipComponentData.cpp index 0fc6e7a6..b0817411 100755 --- a/engine/server/library/serverGame/src/shared/space/ServerShipComponentData.cpp +++ b/engine/server/library/serverGame/src/shared/space/ServerShipComponentData.cpp @@ -89,7 +89,7 @@ void ServerShipComponentData::writeDataToShip (int const chassisSlot, Ship bool ServerShipComponentData::readDataFromComponent (TangibleObject const & component) { - if (component.getObjectTemplate () == nullptr) + if (component.getObjectTemplate () == NULL) { WARNING (true, ("ShipComponentData [%s] has no object template", component.getNetworkId ().getValueString ().c_str ())); return false; @@ -137,13 +137,13 @@ bool ServerShipComponentData::readDataFromComponent (TangibleObject const & comp void ServerShipComponentData::writeDataToComponent (TangibleObject & component) const { - if (m_descriptor == nullptr) + if (m_descriptor == NULL) { - WARNING (true, ("ShipComponentData::writeDataToComponent [%s] nullptr descriptor", component.getNetworkId ().getValueString ().c_str ())); + WARNING (true, ("ShipComponentData::writeDataToComponent [%s] null descriptor", component.getNetworkId ().getValueString ().c_str ())); return; } - if (component.getObjectTemplate () == nullptr) + if (component.getObjectTemplate () == NULL) { WARNING (true, ("ShipComponentData::writeDataToComponent [%s] has no object template", component.getNetworkId ().getValueString ().c_str ())); return; @@ -180,7 +180,7 @@ void ServerShipComponentData::writeDataToComponent (TangibleObject & component) void ServerShipComponentData::printDebugString (Unicode::String & result, Unicode::String const & padding) const { - if (m_descriptor == nullptr) + if (m_descriptor == NULL) return; char buf [2048]; diff --git a/engine/server/library/serverGame/src/shared/space/ShipAiEnemySearchManager.cpp b/engine/server/library/serverGame/src/shared/space/ShipAiEnemySearchManager.cpp index 81586895..aca06580 100755 --- a/engine/server/library/serverGame/src/shared/space/ShipAiEnemySearchManager.cpp +++ b/engine/server/library/serverGame/src/shared/space/ShipAiEnemySearchManager.cpp @@ -60,8 +60,8 @@ void ShipAiEnemySearchManagerNamespace::checkForEnemies(ShipObject &ship) if (shipController) { - AiShipController * const aiShipController = (shipController != nullptr) ? shipController->asAiShipController() : nullptr; - float const aggroRadiusSquared = sqr((aiShipController != nullptr) ? aiShipController->getAggroRadius() : 512.0f); // 512.0f is the distance at which turrets on player ships start getting targets + AiShipController * const aiShipController = (shipController != NULL) ? shipController->asAiShipController() : NULL; + float const aggroRadiusSquared = sqr((aiShipController != NULL) ? aiShipController->getAggroRadius() : 512.0f); // 512.0f is the distance at which turrets on player ships start getting targets Vector const shipPosition_w = ship.getPosition_w(); static std::vector s_visibilityList; @@ -117,7 +117,7 @@ void ShipAiEnemySearchManagerNamespace::checkForEnemies(ShipObject &ship) ShipObject * const enemy = s_enemyList[randomIndex]; ShipController * const enemyShipController = enemy->getController()->asShipController(); - if (enemyShipController != nullptr) + if (enemyShipController != NULL) { // Limit the number of ships that can attack a single enemy diff --git a/engine/server/library/serverGame/src/shared/space/ShipComponentDataCargoHold.cpp b/engine/server/library/serverGame/src/shared/space/ShipComponentDataCargoHold.cpp index bf76572c..ba495697 100755 --- a/engine/server/library/serverGame/src/shared/space/ShipComponentDataCargoHold.cpp +++ b/engine/server/library/serverGame/src/shared/space/ShipComponentDataCargoHold.cpp @@ -165,7 +165,7 @@ void ShipComponentDataCargoHold::printDebugString (Unicode::String & result int const amount = (*it).second; ResourceTypeObject const * const resourceType = ServerUniverse::getInstance().getResourceTypeById(id); - std::string const resourceName = resourceType ? resourceType->getResourceName() : "nullptr RESOURCE"; + std::string const resourceName = resourceType ? resourceType->getResourceName() : "NULL RESOURCE"; snprintf(buf, buf_size, "%s %15s (%s): %3d\n", nPad.c_str (), id.getValueString().c_str(), resourceName.c_str(), amount); result += Unicode::narrowToWide(buf); diff --git a/engine/server/library/serverGame/src/shared/space/ShipComponentDataManager.cpp b/engine/server/library/serverGame/src/shared/space/ShipComponentDataManager.cpp index 74e9e4f6..60053125 100755 --- a/engine/server/library/serverGame/src/shared/space/ShipComponentDataManager.cpp +++ b/engine/server/library/serverGame/src/shared/space/ShipComponentDataManager.cpp @@ -42,16 +42,16 @@ ShipComponentData * ShipComponentDataManager::create (TangibleObject const & com ShipComponentDescriptor const * const shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByObjectTemplate (component.getObjectTemplate ()->getCrcName ().getCrc ()); - if (shipComponentDescriptor == nullptr) + if (shipComponentDescriptor == NULL) { WARNING (true, ("ShipComponentDataManager [%s] [%s] is not a component", component.getNetworkId ().getValueString ().c_str (), component.getObjectTemplateName())); - return nullptr; + return NULL; } ShipComponentData * const shipComponent = create (*shipComponentDescriptor); if (!shipComponent) - return nullptr; + return NULL; shipComponent->readDataFromComponent (component); return shipComponent; @@ -61,7 +61,7 @@ ShipComponentData * ShipComponentDataManager::create (TangibleObject const & com ShipComponentData * ShipComponentDataManager::create (ShipComponentDescriptor const & shipComponentDescriptor) { - ShipComponentData * shipComponent = nullptr; + ShipComponentData * shipComponent = NULL; switch (shipComponentDescriptor.getComponentType ()) { @@ -106,7 +106,7 @@ ShipComponentData * ShipComponentDataManager::create (ShipComponentDescriptor co break; default: WARNING (true, ("ShipComponentDataManager::create descriptor has type [%d] invalid", shipComponentDescriptor.getComponentType ())); - return nullptr; + return NULL; } return shipComponent; diff --git a/engine/server/library/serverGame/src/shared/space/ShipInternalDamageOverTime.cpp b/engine/server/library/serverGame/src/shared/space/ShipInternalDamageOverTime.cpp index 98f76860..9411fb1b 100755 --- a/engine/server/library/serverGame/src/shared/space/ShipInternalDamageOverTime.cpp +++ b/engine/server/library/serverGame/src/shared/space/ShipInternalDamageOverTime.cpp @@ -41,14 +41,14 @@ void ShipInternalDamageOverTime::setDamageThreshold(float damageThreshold) ShipObject * const ShipInternalDamageOverTime::getShipObject() const { Object * const object = m_shipId.getObject(); - if (object != nullptr && object->isAuthoritative()) + if (object != NULL && object->isAuthoritative()) { ServerObject * const serverObject = object->asServerObject(); - if (serverObject != nullptr) + if (serverObject != NULL) return serverObject->asShipObject(); } - return nullptr; + return NULL; } //---------------------------------------------------------------------- @@ -56,7 +56,7 @@ ShipObject * const ShipInternalDamageOverTime::getShipObject() const bool ShipInternalDamageOverTime::checkValidity(float & hpCurrent, float & hpMaximum) const { ShipObject * const ship = getShipObject(); - if (ship == nullptr) + if (ship == NULL) return false; if (m_chassisSlot < 0 || m_chassisSlot > ShipChassisSlotType::SCST_num_types) @@ -91,7 +91,7 @@ bool ShipInternalDamageOverTime::checkValidity(float & hpCurrent, float & hpMaxi bool ShipInternalDamageOverTime::applyDamage(float elapsedTime, float & damageApplied) const { ShipObject * const ship = getShipObject(); - if (ship == nullptr) + if (ship == NULL) return false; float hpCurrent = 0.0f; diff --git a/engine/server/library/serverGame/src/shared/space/ShipInternalDamageOverTimeManager.cpp b/engine/server/library/serverGame/src/shared/space/ShipInternalDamageOverTimeManager.cpp index 475b2504..3cc0f54f 100755 --- a/engine/server/library/serverGame/src/shared/space/ShipInternalDamageOverTimeManager.cpp +++ b/engine/server/library/serverGame/src/shared/space/ShipInternalDamageOverTimeManager.cpp @@ -39,7 +39,7 @@ namespace ShipInternalDamageOverTimeManagerNamespace { GameScriptObject * const gameScriptObject = ship.getScriptObject(); - if (gameScriptObject != nullptr) + if (gameScriptObject != NULL) { ScriptParams p; p.addParam(idot.getChassisSlot()); @@ -56,7 +56,7 @@ namespace ShipInternalDamageOverTimeManagerNamespace { GameScriptObject * const gameScriptObject = ship.getScriptObject(); - if (gameScriptObject != nullptr) + if (gameScriptObject != NULL) { ScriptParams p; p.addParam(idot.getChassisSlot()); @@ -128,7 +128,7 @@ void ShipInternalDamageOverTimeManager::update(float elapsedTime) ShipObject * const shipObject = idot.getShipObject(); - if (nullptr != shipObject) + if (NULL != shipObject) notifyIdotDamage(*shipObject, idot, damageApplied); } } @@ -150,7 +150,7 @@ void ShipInternalDamageOverTimeManager::update(float elapsedTime) ShipInternalDamageOverTime const & expiredIdot = *it; ShipObject * const shipObject = expiredIdot.getShipObject(); - if (shipObject != nullptr) + if (shipObject != NULL) notifyIdotRemoval(*shipObject, expiredIdot); } } @@ -219,7 +219,7 @@ bool ShipInternalDamageOverTimeManager::removeEntry(ShipObject const & ship, int IGNORE_RETURN(s_idotVector.erase(lowerBound)); ShipObject * const shipObject = lowerBoundIdot.getShipObject(); - if (shipObject != nullptr) + if (shipObject != NULL) notifyIdotRemoval(*shipObject, lowerBoundIdot); return true; @@ -235,13 +235,13 @@ ShipInternalDamageOverTime const * const ShipInternalDamageOverTimeManager::find //-- there is no lower bound, the idot is not in the vector if (lowerBound == s_idotVector.end()) - return nullptr; + return NULL; ShipInternalDamageOverTime & lowerBoundIdot = *lowerBound; //-- the lower bound sorts greater than the new idot, therefore this is a new insertion if (idot < lowerBoundIdot) - return nullptr; + return NULL; return &lowerBoundIdot; } diff --git a/engine/server/library/serverGame/src/shared/space/SpaceAttackSquad.cpp b/engine/server/library/serverGame/src/shared/space/SpaceAttackSquad.cpp index d344d963..de7693e5 100755 --- a/engine/server/library/serverGame/src/shared/space/SpaceAttackSquad.cpp +++ b/engine/server/library/serverGame/src/shared/space/SpaceAttackSquad.cpp @@ -68,7 +68,7 @@ void SpaceAttackSquad::onAddUnit(NetworkId const & unit) { AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != nullptr) + if (aiShipController != NULL) { aiShipController->setAttackSquad(this); } @@ -96,7 +96,7 @@ void SpaceAttackSquad::onNewLeader(NetworkId const & /*oldLeader*/) { AiShipController * const newLeaderAiShipController = AiShipController::getAiShipController(getLeader()); - if (newLeaderAiShipController != nullptr) + if (newLeaderAiShipController != NULL) { m_leaderOffsetPosition_l = -newLeaderAiShipController->getFormationPosition_l(); } @@ -116,7 +116,7 @@ void SpaceAttackSquad::onSetUnitFormationPosition_l(NetworkId const & unit, Vect { AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != nullptr) + if (aiShipController != NULL) { aiShipController->setAttackFormationPosition_l(position_l); } @@ -154,7 +154,7 @@ CachedNetworkId const & SpaceAttackSquad::getPrimaryAttackTarget() const { Object * const leaderObject = getLeader().getObject(); - if (leaderObject != nullptr) + if (leaderObject != NULL) { AiShipController * const leaderAiShipController = AiShipController::asAiShipController(leaderObject->getController()); @@ -163,7 +163,7 @@ CachedNetworkId const & SpaceAttackSquad::getPrimaryAttackTarget() const #ifdef _DEBUG FormattedString<1024> fs; - char const * const text = fs.sprintf("SpaceAttackSquad::getPrimaryAttackTarget() ERROR: Why is the attack squad leader(%s) object nullptr?", getLeader().getValueString().c_str()); + char const * const text = fs.sprintf("SpaceAttackSquad::getPrimaryAttackTarget() ERROR: Why is the attack squad leader(%s) object NULL?", getLeader().getValueString().c_str()); DEBUG_WARNING(true, (text)); LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", (text)); #endif // _DEBUG @@ -176,7 +176,7 @@ bool SpaceAttackSquad::isAttacking() const { Object * const leaderObject = getLeader().getObject(); - if (leaderObject != nullptr) + if (leaderObject != NULL) { AiShipController * const leaderAiShipController = AiShipController::asAiShipController(leaderObject->getController()); @@ -185,7 +185,7 @@ bool SpaceAttackSquad::isAttacking() const #ifdef _DEBUG FormattedString<1024> fs; - char const * const text = fs.sprintf("SpaceAttackSquad::isAttacking() ERROR: Why is the attack squad leader(%s) object nullptr?", getLeader().getValueString().c_str()); + char const * const text = fs.sprintf("SpaceAttackSquad::isAttacking() ERROR: Why is the attack squad leader(%s) object NULL?", getLeader().getValueString().c_str()); DEBUG_WARNING(true, (text)); LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", (text)); #endif // _DEBUG @@ -231,7 +231,7 @@ int SpaceAttackSquad::getMaxNumberOfUnits() const NetworkId const & unit = unitMap.begin()->first; AiShipController * const unitAiShipController = AiShipController::getAiShipController(unit); - if (unitAiShipController != nullptr) + if (unitAiShipController != NULL) { if (unitAiShipController->getAttackOrders() == AiShipController::AO_holdFire) { @@ -282,10 +282,10 @@ void SpaceAttackSquad::calculateAttackRanges() { CachedNetworkId const & unit = iterUnitMap->first; Object * const unitObject = unit.getObject(); - ServerObject * const unitServerObject = (unitObject != nullptr) ? unitObject->asServerObject() : nullptr; - ShipObject * const unitShipObject = (unitServerObject != nullptr) ? unitServerObject->asShipObject() : nullptr; + ServerObject * const unitServerObject = (unitObject != NULL) ? unitObject->asServerObject() : NULL; + ShipObject * const unitShipObject = (unitServerObject != NULL) ? unitServerObject->asShipObject() : NULL; - if (unitShipObject != nullptr) + if (unitShipObject != NULL) { m_projectileAttackRange = std::min(m_projectileAttackRange, unitShipObject->getApproximateAttackRange()); @@ -328,10 +328,10 @@ void SpaceAttackSquad::assignNewLeader() { CachedNetworkId const & unit = iterUnitMap->first; Object * const unitObject = unit.getObject(); - ServerObject * const unitServerObject = (unitObject != nullptr) ? unitObject->asServerObject() : nullptr; - ShipObject * const unitShipObject = (unitServerObject != nullptr) ? unitServerObject->asShipObject() : nullptr; + ServerObject * const unitServerObject = (unitObject != NULL) ? unitObject->asServerObject() : NULL; + ShipObject * const unitShipObject = (unitServerObject != NULL) ? unitServerObject->asShipObject() : NULL; - if (unitShipObject != nullptr) + if (unitShipObject != NULL) { if (unitShipObject->isComponentFunctional(ShipChassisSlotType::SCST_engine)) { diff --git a/engine/server/library/serverGame/src/shared/space/SpaceDockingManager.cpp b/engine/server/library/serverGame/src/shared/space/SpaceDockingManager.cpp index 4e4a9821..c836be74 100755 --- a/engine/server/library/serverGame/src/shared/space/SpaceDockingManager.cpp +++ b/engine/server/library/serverGame/src/shared/space/SpaceDockingManager.cpp @@ -78,7 +78,7 @@ namespace SpaceDockingManagerNamespace explicit DockableShip(Object const & object) : m_dockPadList() { - if (object.getAppearance() != nullptr) + if (object.getAppearance() != NULL) { // What dock pads do we have, and what are their radii @@ -176,7 +176,7 @@ float SpaceDockingManagerNamespace::getCollisionRadius(Object const & object) CollisionProperty const * const collisionProperty = object.getCollisionProperty(); float radius = 0.0f; - if (collisionProperty != nullptr) + if (collisionProperty != NULL) { radius = collisionProperty->getBoundingSphere_l().getRadius(); } @@ -257,7 +257,7 @@ bool SpaceDockingManagerNamespace::getHardPoints(Object const & object, char con hardPointList.clear(); - if (object.getAppearance() != nullptr) + if (object.getAppearance() != NULL) { int hardPointIndex = 1; bool done = false; diff --git a/engine/server/library/serverGame/src/shared/space/SpacePath.cpp b/engine/server/library/serverGame/src/shared/space/SpacePath.cpp index 9834532b..6c50cee8 100755 --- a/engine/server/library/serverGame/src/shared/space/SpacePath.cpp +++ b/engine/server/library/serverGame/src/shared/space/SpacePath.cpp @@ -96,7 +96,7 @@ bool SpacePath::isEmpty() const // ---------------------------------------------------------------------- void SpacePath::addReference(void const * const object, float const objectSize) { - DEBUG_FATAL(object == nullptr, ("Passing a nullptr object into path 0x%p.", this)); + DEBUG_FATAL(object == NULL, ("Passing a NULL object into path 0x%p.", this)); ++m_referenceCount; @@ -112,7 +112,7 @@ void SpacePath::addReference(void const * const object, float const objectSize) // ---------------------------------------------------------------------- void SpacePath::releaseReference(void const * const object) { - DEBUG_FATAL(object == nullptr, ("Passing a nullptr object into path 0x%p.", this)); + DEBUG_FATAL(object == NULL, ("Passing a NULL object into path 0x%p.", this)); if (--m_referenceCount < 0) { @@ -178,7 +178,7 @@ bool SpacePath::refine(int & pathRefinementsAvailable) Vector avoidancePosition_w; - bool const pathAdjusted = SpaceAvoidanceManager::getAvoidancePosition(currentTransform, collisionRadius, sweepVector, nextPosition_w, avoidancePosition_w, nullptr); + bool const pathAdjusted = SpaceAvoidanceManager::getAvoidancePosition(currentTransform, collisionRadius, sweepVector, nextPosition_w, avoidancePosition_w, NULL); if (pathAdjusted) { newTransform.setPosition_p(avoidancePosition_w); @@ -278,7 +278,7 @@ void SpacePath::requestPathResize() // ---------------------------------------------------------------------- bool SpacePath::updateCollisionRadius(void const * const object, float const objectSize) { - DEBUG_FATAL(object == nullptr, ("Passing a nullptr object into path(0x%p) updateCollisionRadius.", this)); + DEBUG_FATAL(object == NULL, ("Passing a NULL object into path(0x%p) updateCollisionRadius.", this)); bool requiresPathUpdate = false; diff --git a/engine/server/library/serverGame/src/shared/space/SpacePathManager.cpp b/engine/server/library/serverGame/src/shared/space/SpacePathManager.cpp index 2d9d088c..79256ad5 100755 --- a/engine/server/library/serverGame/src/shared/space/SpacePathManager.cpp +++ b/engine/server/library/serverGame/src/shared/space/SpacePathManager.cpp @@ -59,9 +59,9 @@ void SpacePathManager::remove() // ---------------------------------------------------------------------- SpacePath * SpacePathManager::fetch(SpacePath * const path, void const * const object, float const objectRadius) { - SpacePath * result = nullptr; + SpacePath * result = NULL; - if (path == nullptr) + if (path == NULL) { // This is a new path, add it to the list @@ -105,7 +105,7 @@ SpacePath * SpacePathManager::fetch(SpacePath * const path, void const * const o // ---------------------------------------------------------------------- void SpacePathManager::release(SpacePath * const path, void const * const object) { - if (path == nullptr) + if (path == NULL) { return; } diff --git a/engine/server/library/serverGame/src/shared/space/SpaceSquad.cpp b/engine/server/library/serverGame/src/shared/space/SpaceSquad.cpp index 9b998274..332188c6 100755 --- a/engine/server/library/serverGame/src/shared/space/SpaceSquad.cpp +++ b/engine/server/library/serverGame/src/shared/space/SpaceSquad.cpp @@ -95,7 +95,7 @@ void SpaceSquad::remove() // ---------------------------------------------------------------------- SpaceSquad::SpaceSquad() : Squad() - , m_guardTarget(nullptr) + , m_guardTarget(NULL) , m_guardedByList(new SpaceSquadList) , m_attackSquadList(new AttackSquadList) , m_guarding(false) @@ -109,10 +109,10 @@ SpaceSquad::~SpaceSquad() { // The the squad that I am guarding that I am no longer guarding it - if (m_guardTarget != nullptr) + if (m_guardTarget != NULL) { removeGuardTarget(); - m_guardTarget = nullptr; + m_guardTarget = NULL; } // Tell all the squads guarding me that I am not longer guardable @@ -156,7 +156,7 @@ SpacePath * SpaceSquad::getPath() const AiShipController * const aiShipController = AiShipController::getAiShipController(getLeader()); - return nullptr != aiShipController ? aiShipController->getPath() : nullptr; + return NULL != aiShipController ? aiShipController->getPath() : NULL; } // ---------------------------------------------------------------------- @@ -194,7 +194,7 @@ void SpaceSquad::track(Object const & target) const // ---------------------------------------------------------------------- void SpaceSquad::moveTo(SpacePath * const path) const { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("SpaceSquad::moveTo() squadId(%d) path(0x%p) pathSize(%u)", getId(), path, (path != nullptr) ? path->getTransformList().size() : 0)); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("SpaceSquad::moveTo() squadId(%d) path(0x%p) pathSize(%u)", getId(), path, (path != NULL) ? path->getTransformList().size() : 0)); UnitMap const & unitMap = getUnitMap(); UnitMap::const_iterator iterUnitMap = unitMap.begin(); @@ -210,7 +210,7 @@ void SpaceSquad::moveTo(SpacePath * const path) const // ---------------------------------------------------------------------- void SpaceSquad::addPatrolPath(SpacePath * const path) const { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("SpaceSquad::addPatrolPath() squadId(%d) squadSize(%u) path(0x%p) pathSize(%u)", getId(), getUnitMap().size(), path, (path != nullptr) ? path->getTransformList().size() : 0)); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("SpaceSquad::addPatrolPath() squadId(%d) squadSize(%u) path(0x%p) pathSize(%u)", getId(), getUnitMap().size(), path, (path != NULL) ? path->getTransformList().size() : 0)); UnitMap const & unitMap = getUnitMap(); UnitMap::const_iterator iterUnitMap = unitMap.begin(); @@ -293,7 +293,7 @@ bool SpaceSquad::setGuardTarget(int const squadId) #endif // _DEBUG } - return (m_guardTarget != nullptr); + return (m_guardTarget != NULL); } // ---------------------------------------------------------------------- @@ -305,14 +305,14 @@ SpaceSquad * SpaceSquad::getGuardTarget() // ---------------------------------------------------------------------- void SpaceSquad::removeGuardTarget() { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("SpaceSquad::removeGuardTarget() squadId(%d) guardedBySquad(%d)", getId(), (m_guardTarget != nullptr) ? m_guardTarget->getId() : 0)); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("SpaceSquad::removeGuardTarget() squadId(%d) guardedBySquad(%d)", getId(), (m_guardTarget != NULL) ? m_guardTarget->getId() : 0)); //-- Tell the guard target it's no longer being guarded - if (m_guardTarget != nullptr) + if (m_guardTarget != NULL) { m_guardTarget->removeGuardedBy(*this); - m_guardTarget = nullptr; + m_guardTarget = NULL; } } @@ -360,7 +360,7 @@ void SpaceSquad::onAddUnit(NetworkId const & unit) { AiShipController * unitAiShipController = AiShipController::getAiShipController(unit); - if (unitAiShipController != nullptr) + if (unitAiShipController != NULL) { unitAiShipController->setSquad(this); @@ -391,12 +391,12 @@ void SpaceSquad::onNewLeader(NetworkId const & oldLeader) { AiShipController * const newLeaderAiShipController = AiShipController::getAiShipController(getLeader()); - if (newLeaderAiShipController != nullptr) + if (newLeaderAiShipController != NULL) { AiShipController * const oldLeaderAiShipController = AiShipController::getAiShipController(oldLeader); - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled() && (oldLeaderAiShipController == nullptr) && (getUnitCount() > 1), "space_debug_ai", ("Squad::onNewLeader() ERROR: The old leader(%s) could not resolve to an AiShipController.", oldLeader.getValueString().c_str())); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled() && (oldLeaderAiShipController == NULL) && (getUnitCount() > 1), "space_debug_ai", ("Squad::onNewLeader() ERROR: The old leader(%s) could not resolve to an AiShipController.", oldLeader.getValueString().c_str())); - if (oldLeaderAiShipController != nullptr) + if (oldLeaderAiShipController != NULL) { newLeaderAiShipController->setCurrentPathIndex(oldLeaderAiShipController->getCurrentPathIndex()); } @@ -420,7 +420,7 @@ void SpaceSquad::onSetUnitFormationPosition_l(NetworkId const & unit, Vector con { AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != nullptr) + if (aiShipController != NULL) { aiShipController->setFormationPosition_l(position_l); } @@ -457,13 +457,13 @@ void SpaceSquad::alter(float const deltaSeconds) AiShipController const * const leaderAiShipController = AiShipController::getAiShipController(getLeader()); - if (leaderAiShipController != nullptr) + if (leaderAiShipController != NULL) { if (isGuarding()) { SpaceSquad * const guardTarget = getGuardTarget(); - if (guardTarget != nullptr) + if (guardTarget != NULL) { m_leashAnchorPosition_w = guardTarget->getSquadPosition_w(); } @@ -499,7 +499,7 @@ void SpaceSquad::assignNewLeader() CachedNetworkId const & unit = iterUnitMap->first; AiShipController const * const unitAiShipController = AiShipController::getAiShipController(unit); - if (unitAiShipController != nullptr) + if (unitAiShipController != NULL) { if ( unitAiShipController->getShipOwner()->isComponentFunctional(ShipChassisSlotType::SCST_engine) && !unitAiShipController->isAttacking() @@ -550,7 +550,7 @@ bool SpaceSquad::isGuarding() const && !m_guardTarget) { FormattedString<1024> fs; - char const * const text = fs.sprintf("SpaceSquad::isGuarding() squadId(%d) ERROR: Why are we guarding a nullptr guard target?", getId()); + char const * const text = fs.sprintf("SpaceSquad::isGuarding() squadId(%d) ERROR: Why are we guarding a NULL guard target?", getId()); DEBUG_WARNING(true, (text)); LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", (text)); } @@ -572,7 +572,7 @@ bool SpaceSquad::isAttackTargetListEmpty() const NetworkId const & unit = iterUnitMap->first; AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if ( (aiShipController != nullptr) + if ( (aiShipController != NULL) && !aiShipController->getAttackTargetList().isEmpty()) { result = false; @@ -623,10 +623,10 @@ Vector SpaceSquad::getAvoidanceVector(ShipObject const & unit) const } Object * const squadUnitObject = squadUnit.getObject(); - ServerObject * const squadUnitServerObject = (squadUnitObject != nullptr) ? squadUnitObject->asServerObject() : nullptr; - ShipObject * const squadUnitShipObject = (squadUnitServerObject != nullptr) ? squadUnitServerObject->asShipObject() : nullptr; + ServerObject * const squadUnitServerObject = (squadUnitObject != NULL) ? squadUnitObject->asServerObject() : NULL; + ShipObject * const squadUnitShipObject = (squadUnitServerObject != NULL) ? squadUnitServerObject->asShipObject() : NULL; - if (squadUnitShipObject != nullptr) + if (squadUnitShipObject != NULL) { Vector const & unitPosition_w = unit.getPosition_w(); Vector const & squadUnitPosition_w = squadUnitShipObject->getPosition_w(); @@ -760,7 +760,7 @@ float SpaceSquad::getLargestShipRadius() const { CachedNetworkId const & unit = iterUnitMap->first; Object const * const unitObject = unit.getObject(); - ServerObject const * const unitServerObject = unitObject ? unitObject->asServerObject() : nullptr; + ServerObject const * const unitServerObject = unitObject ? unitObject->asServerObject() : NULL; if (unitServerObject) { @@ -787,7 +787,7 @@ void SpaceSquad::refreshPathInfo() const { CachedNetworkId const & unit = iterUnitMap->first; Object const * const unitObject = unit.getObject(); - ServerObject const * const unitServerObject = unitObject ? unitObject->asServerObject() : nullptr; + ServerObject const * const unitServerObject = unitObject ? unitObject->asServerObject() : NULL; if (unitObject && unitServerObject) { IGNORE_RETURN(path->updateCollisionRadius(unitObject, unitServerObject->getRadius())); diff --git a/engine/server/library/serverGame/src/shared/space/SpaceSquadManager.cpp b/engine/server/library/serverGame/src/shared/space/SpaceSquadManager.cpp index f2dc3552..3a93d451 100755 --- a/engine/server/library/serverGame/src/shared/space/SpaceSquadManager.cpp +++ b/engine/server/library/serverGame/src/shared/space/SpaceSquadManager.cpp @@ -194,7 +194,7 @@ bool SpaceSquadManager::setSquadId(NetworkId const & unit, int const newSquadId) bool result = false; AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != nullptr) + if (aiShipController != NULL) { result = true; @@ -239,7 +239,7 @@ bool SpaceSquadManager::setSquadId(NetworkId const & unit, int const newSquadId) // ---------------------------------------------------------------------- SpaceSquad * SpaceSquadManager::getSquad(int const squadId) { - SpaceSquad * result = nullptr; + SpaceSquad * result = NULL; SquadList::const_iterator iterSpaceSquadList = s_squadList.find(squadId); if (iterSpaceSquadList != s_squadList.end()) diff --git a/engine/server/library/serverGame/src/shared/space/SpaceVisibilityManager.cpp b/engine/server/library/serverGame/src/shared/space/SpaceVisibilityManager.cpp index 70f5bbef..9113d33f 100755 --- a/engine/server/library/serverGame/src/shared/space/SpaceVisibilityManager.cpp +++ b/engine/server/library/serverGame/src/shared/space/SpaceVisibilityManager.cpp @@ -141,7 +141,7 @@ void SpaceVisibilityManager::addClient(Client & client, ServerObject & observing DEBUG_REPORT_LOG(ConfigServerGame::getDebugSpaceVisibilityManager(),("SpaceVisibilityManager::addClient(Client & client, %s);\n",observingObject.getNetworkId().getValueString().c_str())); TrackedObjectsType::iterator i=ms_trackedObjects.find(observingObject.getNetworkId()); - TrackedObject *to=nullptr; + TrackedObject *to=NULL; if (i!=ms_trackedObjects.end()) { to=i->second; @@ -244,7 +244,7 @@ void SpaceVisibilityManager::removeObject(ServerObject & object) if (!vis) //lint !e774 //always false (in debug build only) return; delete vis; - vis=nullptr; + vis=NULL; object.removeNotification(VisibleObjectNotification::getInstance(),true); } @@ -534,7 +534,7 @@ TrackedObject::TrackedObject(const ServerObject &object, int updateRadius) : m_object(object), m_updateRadius(updateRadius), m_currentLocation(NodeId(object.getPosition_w())), - m_clients(nullptr) + m_clients(NULL) { ms_trackedObjects[object.getNetworkId()]=this; addToNodesInRange(*this, m_currentLocation, updateRadius); @@ -554,7 +554,7 @@ TrackedObject::~TrackedObject() } delete m_clients; - m_clients=nullptr; + m_clients=NULL; } removeFromNodesInRange(*this, m_currentLocation, m_updateRadius); @@ -572,7 +572,7 @@ const CachedNetworkId & TrackedObject::getNetworkId() const bool TrackedObject::hasClients() const { - return (m_clients != nullptr); + return (m_clients != NULL); } // ---------------------------------------------------------------------- @@ -594,7 +594,7 @@ void TrackedObject::removeClient(Client &client) if (m_clients->empty()) { delete m_clients; - m_clients=nullptr; + m_clients=NULL; getNode(m_currentLocation).removeObservingObject(*this); } diff --git a/engine/server/library/serverGame/src/shared/synchronizedUi/InstallationSynchronizedUi.cpp b/engine/server/library/serverGame/src/shared/synchronizedUi/InstallationSynchronizedUi.cpp index b074a95d..ca2e7048 100755 --- a/engine/server/library/serverGame/src/shared/synchronizedUi/InstallationSynchronizedUi.cpp +++ b/engine/server/library/serverGame/src/shared/synchronizedUi/InstallationSynchronizedUi.cpp @@ -87,7 +87,7 @@ namespace InstallationSynchronizedUiNamespace InstallationResourceData makeInstallationResourceData (const NetworkId & id, const Vector & position) { ResourceTypeObject const * const rto = ServerUniverse::getInstance().getResourceTypeById(id); - ResourcePoolObject const * const pool = rto ? rto->getPoolForCurrentPlanet() : nullptr; + ResourcePoolObject const * const pool = rto ? rto->getPoolForCurrentPlanet() : NULL; if (rto && pool) { std::string const & resourceTypeParent = rto->getParentClass().getResourceClassName(); @@ -219,7 +219,7 @@ void InstallationSynchronizedUi::resetResourcePools () HarvesterInstallationObject * const harvester = dynamic_cast(getOwner ()); NOT_NULL (harvester); - if (harvester) //lint !e774 // harvester is not nullptr in debug + if (harvester) //lint !e774 // harvester is not NULL in debug { std::vector const & pools = harvester->getSurveyTypes(); for (std::vector::const_iterator i=pools.begin(); i!=pools.end(); ++i) diff --git a/engine/server/library/serverGame/src/shared/trading/ServerSecureTrade.cpp b/engine/server/library/serverGame/src/shared/trading/ServerSecureTrade.cpp index c486c67f..a0b2f63b 100755 --- a/engine/server/library/serverGame/src/shared/trading/ServerSecureTrade.cpp +++ b/engine/server/library/serverGame/src/shared/trading/ServerSecureTrade.cpp @@ -385,7 +385,7 @@ void ServerSecureTrade::completeTrade() } if (dynamic_cast(item)) { - if (!ContainerInterface::canTransferTo(recipientInventory, *item, nullptr, errorCode)) + if (!ContainerInterface::canTransferTo(recipientInventory, *item, NULL, errorCode)) { ContainerInterface::sendContainerMessageToClient(*m_initiator, errorCode); ContainerInterface::sendContainerMessageToClient(*m_recipient, errorCode); @@ -397,7 +397,7 @@ void ServerSecureTrade::completeTrade() } else { - if (!ContainerInterface::canTransferTo(recipientDatapad, *item, nullptr, errorCode)) + if (!ContainerInterface::canTransferTo(recipientDatapad, *item, NULL, errorCode)) { ContainerInterface::sendContainerMessageToClient(*m_initiator, errorCode); ContainerInterface::sendContainerMessageToClient(*m_recipient, errorCode); @@ -423,7 +423,7 @@ void ServerSecureTrade::completeTrade() } if (dynamic_cast(item)) { - if (!ContainerInterface::canTransferTo(initiatorInventory, *item, nullptr, errorCode)) + if (!ContainerInterface::canTransferTo(initiatorInventory, *item, NULL, errorCode)) { ContainerInterface::sendContainerMessageToClient(*m_initiator, errorCode); ContainerInterface::sendContainerMessageToClient(*m_recipient, errorCode); @@ -434,7 +434,7 @@ void ServerSecureTrade::completeTrade() } else { - if (!ContainerInterface::canTransferTo(initiatorDatapad, *item, nullptr, errorCode)) + if (!ContainerInterface::canTransferTo(initiatorDatapad, *item, NULL, errorCode)) { ContainerInterface::sendContainerMessageToClient(*m_initiator, errorCode); ContainerInterface::sendContainerMessageToClient(*m_recipient, errorCode); @@ -516,7 +516,7 @@ void ServerSecureTrade::completeTrade() NOT_NULL(item); if (dynamic_cast(item)) { - if (!ContainerInterface::transferItemToVolumeContainer(*recipientInventory, *item, nullptr, errorCode)) + if (!ContainerInterface::transferItemToVolumeContainer(*recipientInventory, *item, NULL, errorCode)) { DEBUG_FATAL(true, ("Secure trade transfer failure in initiator transfer!!\n")); LOG("CustomerService", ("Trade:%s FAILED TO receive %s from %s", PlayerObject::getAccountDescription(m_recipient->getNetworkId()).c_str(), ServerObject::getLogDescription(item).c_str(), PlayerObject::getAccountDescription(m_initiator->getNetworkId()).c_str())); @@ -529,7 +529,7 @@ void ServerSecureTrade::completeTrade() } else { - if (!ContainerInterface::transferItemToVolumeContainer(*recipientDatapad, *item, nullptr, errorCode)) + if (!ContainerInterface::transferItemToVolumeContainer(*recipientDatapad, *item, NULL, errorCode)) { DEBUG_FATAL(true, ("Secure trade transfer failure in initiator transfer!!\n")); LOG("CustomerService", ("Trade:%s FAILED TO receive %s from %s", PlayerObject::getAccountDescription(m_recipient->getNetworkId()).c_str(), ServerObject::getLogDescription(item).c_str(), PlayerObject::getAccountDescription(m_initiator->getNetworkId()).c_str())); @@ -550,7 +550,7 @@ void ServerSecureTrade::completeTrade() NOT_NULL(item); if (dynamic_cast(item)) { - if (!ContainerInterface::transferItemToVolumeContainer(*initiatorInventory, *item, nullptr, errorCode)) + if (!ContainerInterface::transferItemToVolumeContainer(*initiatorInventory, *item, NULL, errorCode)) { DEBUG_FATAL(true, ("Secure trade transfer failure in recipient transfer!!\n")); LOG("CustomerService", ("Trade:%s FAILED TO receive %s from %s", PlayerObject::getAccountDescription(m_initiator->getNetworkId()).c_str(), ServerObject::getLogDescription(item).c_str(), PlayerObject::getAccountDescription(m_recipient->getNetworkId()).c_str())); @@ -564,7 +564,7 @@ void ServerSecureTrade::completeTrade() } else { - if (!ContainerInterface::transferItemToVolumeContainer(*initiatorDatapad, *item, nullptr, errorCode)) + if (!ContainerInterface::transferItemToVolumeContainer(*initiatorDatapad, *item, NULL, errorCode)) { DEBUG_FATAL(true, ("Secure trade transfer failure in recipient transfer!!\n")); LOG("CustomerService", ("Trade:%s FAILED TO receive %s from %s", PlayerObject::getAccountDescription(m_initiator->getNetworkId()).c_str(), ServerObject::getLogDescription(item).c_str(), PlayerObject::getAccountDescription(m_recipient->getNetworkId()).c_str())); @@ -602,12 +602,12 @@ void ServerSecureTrade::logTradeitemContents(const CreatureObject & to, const ServerObject & item, const CreatureObject & from) const { const Container * container = ContainerInterface::getContainer(item); - if (container != nullptr) + if (container != NULL) { for (ContainerConstIterator i = container->begin(); i != container->end(); ++i) { const Object * o = (*i).getObject(); - if (o != nullptr) + if (o != NULL) { const ServerObject * content = safe_cast(o); LOG("CustomerService", ("Trade:%s received %s contained in %s from %s", diff --git a/engine/server/library/serverNetworkMessages/src/shared/TaskConnectionIdMessage.cpp b/engine/server/library/serverNetworkMessages/src/shared/TaskConnectionIdMessage.cpp index 2f314ed8..525fc1b6 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/TaskConnectionIdMessage.cpp +++ b/engine/server/library/serverNetworkMessages/src/shared/TaskConnectionIdMessage.cpp @@ -14,7 +14,7 @@ GameNetworkMessage("TaskConnectionIdMessage"), serverType(static_cast(id)), commandLine(pCommandLine), clusterName(pClusterName), -currentEpochTime(static_cast(::time(nullptr))) +currentEpochTime(static_cast(::time(NULL))) { addVariable(serverType); addVariable(commandLine); diff --git a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AccountFeatureIdResponse.cpp b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AccountFeatureIdResponse.cpp index f51e9f06..b7417e7b 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AccountFeatureIdResponse.cpp +++ b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AccountFeatureIdResponse.cpp @@ -10,7 +10,7 @@ // ====================================================================== -AccountFeatureIdResponse::AccountFeatureIdResponse(NetworkId const & requester, uint32 gameServer, NetworkId const & target, StationId targetStationId, uint32 gameCode, AccountFeatureIdRequest::RequestReason requestReason, unsigned int resultCode, bool resultCameFromSession, std::map const & featureIds, std::map const & sessionFeatureIdsData, const char * sessionResultString /*= nullptr*/, const char * sessionResultText /*= nullptr*/) : +AccountFeatureIdResponse::AccountFeatureIdResponse(NetworkId const & requester, uint32 gameServer, NetworkId const & target, StationId targetStationId, uint32 gameCode, AccountFeatureIdRequest::RequestReason requestReason, unsigned int resultCode, bool resultCameFromSession, std::map const & featureIds, std::map const & sessionFeatureIdsData, const char * sessionResultString /*= NULL*/, const char * sessionResultText /*= NULL*/) : GameNetworkMessage("AccountFeatureIdResponse"), m_requester(requester), m_gameServer(gameServer), diff --git a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AccountFeatureIdResponse.h b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AccountFeatureIdResponse.h index 356d75e6..3bf69cd3 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AccountFeatureIdResponse.h +++ b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AccountFeatureIdResponse.h @@ -19,7 +19,7 @@ class AccountFeatureIdResponse : public GameNetworkMessage { public: - AccountFeatureIdResponse (NetworkId const & requester, uint32 gameServer, NetworkId const & target, StationId targetStationId, uint32 gameCode, AccountFeatureIdRequest::RequestReason requestReason, unsigned int resultCode, bool resultCameFromSession, std::map const & featureIds, std::map const & sessionFeatureIdsData, const char * sessionResultString = nullptr, const char * sessionResultText = nullptr); + AccountFeatureIdResponse (NetworkId const & requester, uint32 gameServer, NetworkId const & target, StationId targetStationId, uint32 gameCode, AccountFeatureIdRequest::RequestReason requestReason, unsigned int resultCode, bool resultCameFromSession, std::map const & featureIds, std::map const & sessionFeatureIdsData, const char * sessionResultString = NULL, const char * sessionResultText = NULL); AccountFeatureIdResponse (Archive::ReadIterator & source); virtual ~AccountFeatureIdResponse (); diff --git a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AdjustAccountFeatureIdResponse.cpp b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AdjustAccountFeatureIdResponse.cpp index 5a118fce..55ec5da9 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AdjustAccountFeatureIdResponse.cpp +++ b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AdjustAccountFeatureIdResponse.cpp @@ -10,7 +10,7 @@ // ====================================================================== -AdjustAccountFeatureIdResponse::AdjustAccountFeatureIdResponse(NetworkId const & requestingPlayer, uint32 gameServer, NetworkId const & targetPlayer, std::string const & targetPlayerDescription, StationId targetStationId, NetworkId const & targetItem, std::string const & targetItemDescription, uint32 gameCode, uint32 featureId, int oldValue, int newValue, unsigned int resultCode, bool resultCameFromSession, const char * sessionResultString /*= nullptr*/, const char * sessionResultText /*= nullptr*/) : +AdjustAccountFeatureIdResponse::AdjustAccountFeatureIdResponse(NetworkId const & requestingPlayer, uint32 gameServer, NetworkId const & targetPlayer, std::string const & targetPlayerDescription, StationId targetStationId, NetworkId const & targetItem, std::string const & targetItemDescription, uint32 gameCode, uint32 featureId, int oldValue, int newValue, unsigned int resultCode, bool resultCameFromSession, const char * sessionResultString /*= NULL*/, const char * sessionResultText /*= NULL*/) : GameNetworkMessage("AdjustAccountFeatureIdResponse"), m_requestingPlayer(requestingPlayer), m_gameServer(gameServer), diff --git a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AdjustAccountFeatureIdResponse.h b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AdjustAccountFeatureIdResponse.h index cecf0530..940937ac 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AdjustAccountFeatureIdResponse.h +++ b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AdjustAccountFeatureIdResponse.h @@ -18,7 +18,7 @@ class AdjustAccountFeatureIdResponse : public GameNetworkMessage { public: - AdjustAccountFeatureIdResponse (NetworkId const & requestingPlayer, uint32 gameServer, NetworkId const & targetPlayer, std::string const & targetPlayerDescription, StationId targetStationId, NetworkId const & targetItem, std::string const & targetItemDescription, uint32 gameCode, uint32 featureId, int oldValue, int newValue, unsigned int resultCode, bool resultCameFromSession, const char * sessionResultString = nullptr, const char * sessionResultText = nullptr); + AdjustAccountFeatureIdResponse (NetworkId const & requestingPlayer, uint32 gameServer, NetworkId const & targetPlayer, std::string const & targetPlayerDescription, StationId targetStationId, NetworkId const & targetItem, std::string const & targetItemDescription, uint32 gameCode, uint32 featureId, int oldValue, int newValue, unsigned int resultCode, bool resultCameFromSession, const char * sessionResultString = NULL, const char * sessionResultText = NULL); AdjustAccountFeatureIdResponse (Archive::ReadIterator & source); virtual ~AdjustAccountFeatureIdResponse (); @@ -37,7 +37,7 @@ public: bool getResultCameFromSession() const; std::string const & getSessionResultString() const; std::string const & getSessionResultText() const; - void setSessionResultCode(unsigned int resultCode, const char * sessionResultString = nullptr, const char * sessionResultText = nullptr); + void setSessionResultCode(unsigned int resultCode, const char * sessionResultString = NULL, const char * sessionResultText = NULL); private: Archive::AutoVariable m_requestingPlayer; @@ -169,7 +169,7 @@ inline std::string const & AdjustAccountFeatureIdResponse::getSessionResultText( // ---------------------------------------------------------------------- -inline void AdjustAccountFeatureIdResponse::setSessionResultCode(unsigned int resultCode, const char * sessionResultString /*= nullptr*/, const char * sessionResultText /*= nullptr*/) +inline void AdjustAccountFeatureIdResponse::setSessionResultCode(unsigned int resultCode, const char * sessionResultString /*= NULL*/, const char * sessionResultText /*= NULL*/) { m_resultCode.set(resultCode); diff --git a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/SceneTransferMessages.cpp b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/SceneTransferMessages.cpp index 34c3de3f..92b86d2c 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/SceneTransferMessages.cpp +++ b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/SceneTransferMessages.cpp @@ -19,7 +19,7 @@ RequestSceneTransfer::RequestSceneTransfer(const NetworkId &oid, const std::stri m_containerName(), m_scriptCallback() { - if (scriptCallback != nullptr) + if (scriptCallback != NULL) m_scriptCallback.set(scriptCallback); addVariable(m_oid); @@ -45,7 +45,7 @@ RequestSceneTransfer::RequestSceneTransfer(const NetworkId &oid, const std::stri m_containerName(containerName), m_scriptCallback() { - if (scriptCallback != nullptr) + if (scriptCallback != NULL) m_scriptCallback.set(scriptCallback); addVariable(m_oid); diff --git a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/SceneTransferMessages.h b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/SceneTransferMessages.h index 0fc2e843..e7780d16 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/SceneTransferMessages.h +++ b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/SceneTransferMessages.h @@ -21,8 +21,8 @@ class RequestSceneTransfer : public GameNetworkMessage { public: - RequestSceneTransfer(const NetworkId &oid, const std::string & sceneName, uint32 sourceGameServer, const Vector &position_p, const Vector &position_w, const NetworkId &containerId, const char * scriptCallback = nullptr); - RequestSceneTransfer(const NetworkId &oid, const std::string & sceneName, uint32 sourceGameServer, const Vector &position_p, const Vector &position_w, const NetworkId &buildingId, const std::string &containerName, const char * scriptCallback = nullptr); + RequestSceneTransfer(const NetworkId &oid, const std::string & sceneName, uint32 sourceGameServer, const Vector &position_p, const Vector &position_w, const NetworkId &containerId, const char * scriptCallback = NULL); + RequestSceneTransfer(const NetworkId &oid, const std::string & sceneName, uint32 sourceGameServer, const Vector &position_p, const Vector &position_w, const NetworkId &buildingId, const std::string &containerName, const char * scriptCallback = NULL); RequestSceneTransfer(Archive::ReadIterator & source); ~RequestSceneTransfer(); diff --git a/engine/server/library/serverNetworkMessages/src/shared/core/SetupServerNetworkMessages.cpp b/engine/server/library/serverNetworkMessages/src/shared/core/SetupServerNetworkMessages.cpp index 007706a8..d976dd62 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/core/SetupServerNetworkMessages.cpp +++ b/engine/server/library/serverNetworkMessages/src/shared/core/SetupServerNetworkMessages.cpp @@ -254,7 +254,7 @@ namespace SetupServerNetworkMessagesNamespace } MessageQueue::Data* unpackNothing(Archive::ReadIterator &) { - return nullptr; + return NULL; } void packVectorNetworkIdVector(const MessageQueue::Data * data, Archive::ByteStream & target) diff --git a/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/AiCreatureStateMessage.cpp b/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/AiCreatureStateMessage.cpp index 74213208..95dc3fd7 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/AiCreatureStateMessage.cpp +++ b/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/AiCreatureStateMessage.cpp @@ -37,9 +37,9 @@ void AiCreatureStateMessage::pack(MessageQueue::Data const * const data, Archive { AiCreatureStateMessage const * const msg = safe_cast(data); - if (msg != nullptr) + if (msg != NULL) { - if (GameServerMessageInterface::getInstance() != nullptr) + if (GameServerMessageInterface::getInstance() != NULL) { GameServerMessageInterface::getInstance()->pack(target, *msg); } @@ -52,7 +52,7 @@ MessageQueue::Data * AiCreatureStateMessage::unpack(Archive::ReadIterator & sour { AiCreatureStateMessage * msg = new AiCreatureStateMessage(); - if (GameServerMessageInterface::getInstance() != nullptr) + if (GameServerMessageInterface::getInstance() != NULL) { GameServerMessageInterface::getInstance()->unpack(source, *msg); } diff --git a/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/AiMovementMessage.cpp b/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/AiMovementMessage.cpp index c87b7c66..fde8e298 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/AiMovementMessage.cpp +++ b/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/AiMovementMessage.cpp @@ -61,7 +61,7 @@ void AiMovementMessage::pack(const MessageQueue::Data* const data, Archive::Byte const AiMovementMessage * const msg = safe_cast (data); if (msg) { - if (GameServerMessageInterface::getInstance() != nullptr) + if (GameServerMessageInterface::getInstance() != NULL) GameServerMessageInterface::getInstance()->pack(target, *msg); } } @@ -72,7 +72,7 @@ MessageQueue::Data* AiMovementMessage::unpack(Archive::ReadIterator & source) { AiMovementMessage * msg = new AiMovementMessage(); - if (GameServerMessageInterface::getInstance() != nullptr) + if (GameServerMessageInterface::getInstance() != NULL) GameServerMessageInterface::getInstance()->unpack(source, *msg); return msg; diff --git a/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/GameServerMessageInterface.cpp b/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/GameServerMessageInterface.cpp index e898606f..5872a21e 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/GameServerMessageInterface.cpp +++ b/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/GameServerMessageInterface.cpp @@ -13,7 +13,7 @@ //----------------------------------------------------------------------- -GameServerMessageInterface * GameServerMessageInterface::ms_instance = nullptr; +GameServerMessageInterface * GameServerMessageInterface::ms_instance = NULL; //======================================================================= @@ -27,14 +27,14 @@ GameServerMessageInterface::GameServerMessageInterface() GameServerMessageInterface::~GameServerMessageInterface() { if (ms_instance == this) - ms_instance = nullptr; + ms_instance = NULL; } //----------------------------------------------------------------------- void GameServerMessageInterface::setInstance(GameServerMessageInterface * instance) { - if (ms_instance == nullptr) + if (ms_instance == NULL) ms_instance = instance; else if (ms_instance != instance) { diff --git a/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/RenameCharacterMessage.cpp b/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/RenameCharacterMessage.cpp index 8aa0309a..bd4cae1a 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/RenameCharacterMessage.cpp +++ b/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/RenameCharacterMessage.cpp @@ -64,11 +64,11 @@ RenameCharacterMessageEx::RenameCharacterMessageEx(RenameCharacterMessageSource static Unicode::String const delimiters(Unicode::narrowToWide(" ")); Unicode::UnicodeStringVector newNameTokens; - if (!Unicode::tokenize(newName, newNameTokens, &delimiters, nullptr)) + if (!Unicode::tokenize(newName, newNameTokens, &delimiters, NULL)) newNameTokens.clear(); Unicode::UnicodeStringVector oldNameTokens; - if (!Unicode::tokenize(oldName, oldNameTokens, &delimiters, nullptr)) + if (!Unicode::tokenize(oldName, oldNameTokens, &delimiters, NULL)) oldNameTokens.clear(); m_lastNameChangeOnly.set(((newNameTokens.size() >= 1) && (oldNameTokens.size() >= 1) && Unicode::caseInsensitiveCompare(newNameTokens[0], oldNameTokens[0]))); diff --git a/engine/server/library/serverPathfinding/src/shared/CityPathGraph.cpp b/engine/server/library/serverPathfinding/src/shared/CityPathGraph.cpp index 8ec08af5..2f14d0ac 100755 --- a/engine/server/library/serverPathfinding/src/shared/CityPathGraph.cpp +++ b/engine/server/library/serverPathfinding/src/shared/CityPathGraph.cpp @@ -72,13 +72,13 @@ CityPathGraph::CityPathGraph ( int cityToken ) CityPathGraph::~CityPathGraph() { delete m_namedNodes; - m_namedNodes = nullptr; + m_namedNodes = NULL; delete m_nodeTree; - m_nodeTree = nullptr; + m_nodeTree = NULL; delete m_dirtyBoxes; - m_dirtyBoxes = nullptr; + m_dirtyBoxes = NULL; } // ---------------------------------------------------------------------- @@ -92,7 +92,7 @@ int CityPathGraph::addNode ( DynamicPathNode * newNode ) int index = DynamicPathGraph::addNode(newNode); SpatialHandle * handle = m_nodeTree->addObject( cityNode ); - if (handle != nullptr) + if (handle != NULL) { if (cityNode->getName() != Unicode::emptyString) { @@ -134,7 +134,7 @@ void CityPathGraph::removeNode ( int nodeIndex ) SpatialHandle * handle = cityNode->getSpatialHandle(); - if (m_namedNodes != nullptr) + if (m_namedNodes != NULL) { std::map >::iterator found = m_namedNodes->find(cityNode->getName()); if (found != m_namedNodes->end()) @@ -146,7 +146,7 @@ void CityPathGraph::removeNode ( int nodeIndex ) } m_nodeTree->removeObject( handle ); - cityNode->setSpatialHandle(nullptr); + cityNode->setSpatialHandle(NULL); DynamicPathGraph::removeNode(nodeIndex); } @@ -160,7 +160,7 @@ void CityPathGraph::destroyNode ( int nodeIndex ) { CityPathNode * cityNode = _getNode(nodeIndex); - if(cityNode == nullptr) return; + if(cityNode == NULL) return; // ---------- // Remember which nodes were adjacent to the node we're removing @@ -185,7 +185,7 @@ void CityPathGraph::destroyNode ( int nodeIndex ) m_nodeTree->removeObject( handle ); - cityNode->setSpatialHandle(nullptr); + cityNode->setSpatialHandle(NULL); // ---------- // Remove the node @@ -217,7 +217,7 @@ void CityPathGraph::moveNode ( int nodeIndex, Vector const & newPosition ) { CityPathNode * cityNode = _getNode(nodeIndex); - if(cityNode == nullptr) return; + if(cityNode == NULL) return; // ---------- // Remember which nodes were adjacent to the node we're removing @@ -272,7 +272,7 @@ void CityPathGraph::relinkNode ( int nodeIndex ) { CityPathNode * nodeA = _getNode(nodeIndex); - if(nodeA == nullptr) return; + if(nodeA == NULL) return; // ---------- @@ -293,16 +293,16 @@ void CityPathGraph::relinkNode ( int nodeIndex ) { CityPathNode * nodeB = _getNode(i); - if(nodeB == nullptr) continue; + if(nodeB == NULL) continue; if(nodeA == nodeB) continue; PathNodeType typeB = nodeB->getType(); if(typeB != PNT_CityBuildingEntrance) continue; - if(nodeA->getCreatorObject() == nullptr) continue; + if(nodeA->getCreatorObject() == NULL) continue; - if(nodeB->getCreatorObject() == nullptr) continue; + if(nodeB->getCreatorObject() == NULL) continue; if(nodeA->getCreatorObject() != nodeB->getCreatorObject()) continue; @@ -330,16 +330,16 @@ void CityPathGraph::relinkNode ( int nodeIndex ) { CityPathNode * nodeB = _getNode(i); - if(nodeB == nullptr) continue; + if(nodeB == NULL) continue; if(nodeA == nodeB) continue; PathNodeType typeB = nodeB->getType(); if(typeB != PNT_CityBuilding) continue; - if(nodeA->getCreatorObject() == nullptr) continue; + if(nodeA->getCreatorObject() == NULL) continue; - if(nodeB->getCreatorObject() == nullptr) continue; + if(nodeB->getCreatorObject() == NULL) continue; if(nodeA->getCreatorObject() != nodeB->getCreatorObject()) continue; @@ -367,7 +367,7 @@ void CityPathGraph::relinkNode ( int nodeIndex ) { CityPathNode * nodeB = static_cast(results[i]); - if(nodeB == nullptr) continue; + if(nodeB == NULL) continue; if(nodeA == nodeB) continue; PathNodeType typeB = nodeB->getType(); @@ -420,7 +420,7 @@ void CityPathGraph::relinkNode ( int nodeIndex ) { CityPathNode * neighborNode = _getNode(neighborList[i]); - if(neighborNode != nullptr) + if(neighborNode != NULL) { neighborNode->markRedundantEdges(); neighborNode->removeMarkedEdges(); @@ -467,11 +467,11 @@ CityPathNode * CityPathGraph::findNodeForObject ( ServerObject const & object ) { CityPathNode * node = _getNode(i); - if(node == nullptr) continue; + if(node == NULL) continue; ServerObject const * source = node->getSourceObject(); - if(source == nullptr) continue; + if(source == NULL) continue; if(source == &object) { @@ -479,7 +479,7 @@ CityPathNode * CityPathGraph::findNodeForObject ( ServerObject const & object ) } } - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -492,11 +492,11 @@ CityPathNode const * CityPathGraph::findNodeForObject ( ServerObject const & obj { CityPathNode const * node = _getNode(i); - if(node == nullptr) continue; + if(node == NULL) continue; ServerObject const * source = node->getSourceObject(); - if(source == nullptr) continue; + if(source == NULL) continue; if(source == &object) { @@ -504,15 +504,15 @@ CityPathNode const * CityPathGraph::findNodeForObject ( ServerObject const & obj } } - return nullptr; + return NULL; } // ---------------------------------------------------------------------- CityPathNode * CityPathGraph::findNearestNodeForName( Unicode::String const & nodeName, Vector const & pos ) { - if (m_namedNodes == nullptr) - return nullptr; + if (m_namedNodes == NULL) + return NULL; std::map >::iterator found = m_namedNodes->find(nodeName); if (found != m_namedNodes->end() && !found->second.empty()) @@ -521,12 +521,12 @@ CityPathNode * CityPathGraph::findNearestNodeForName( Unicode::String const & no if (nodes.size() == 1) return *(nodes.begin()); - CityPathNode * node = nullptr; + CityPathNode * node = NULL; float distance = FLT_MAX; for (std::set::iterator i = nodes.begin(); i != nodes.end(); ++i) { float testDistance = pos.magnitudeBetweenSquared((*i)->getPosition_w()); - if (node == nullptr || testDistance < distance) + if (node == NULL || testDistance < distance) { distance = testDistance; node = *i; @@ -535,15 +535,15 @@ CityPathNode * CityPathGraph::findNearestNodeForName( Unicode::String const & no return node; } - return nullptr; + return NULL; } // ---------------------------------------------------------------------- CityPathNode const * CityPathGraph::findNearestNodeForName( Unicode::String const & nodeName, Vector const & pos ) const { - if (m_namedNodes == nullptr) - return nullptr; + if (m_namedNodes == NULL) + return NULL; std::map >::const_iterator found = m_namedNodes->find(nodeName); if (found != m_namedNodes->end() && !found->second.empty()) @@ -552,12 +552,12 @@ CityPathNode const * CityPathGraph::findNearestNodeForName( Unicode::String cons if (nodes.size() == 1) return *(nodes.begin()); - CityPathNode const * node = nullptr; + CityPathNode const * node = NULL; float distance = FLT_MAX; for (std::set::const_iterator i = nodes.begin(); i != nodes.end(); ++i) { float testDistance = pos.magnitudeBetweenSquared((*i)->getPosition_w()); - if (node == nullptr || testDistance < distance) + if (node == NULL || testDistance < distance) { distance = testDistance; node = *i; @@ -566,14 +566,14 @@ CityPathNode const * CityPathGraph::findNearestNodeForName( Unicode::String cons return node; } - return nullptr; + return NULL; } // ---------------------------------------------------------------------- int CityPathGraph::findNearestNode ( Vector const & position ) const { - PathNode * temp = nullptr; + PathNode * temp = NULL; float dummy1 = REAL_MAX; float dummy2 = REAL_MAX; @@ -713,7 +713,7 @@ int CityPathGraph::getNeighborCode ( int whichNode ) const { CityPathNode const * node = _getNode(whichNode); - if(node == nullptr) return 0; + if(node == NULL) return 0; int edgeCount = node->getEdgeCount(); @@ -725,7 +725,7 @@ int CityPathGraph::getNeighborCode ( int whichNode ) const CityPathNode const * neighbor = _getNode(neighborId); - if(neighbor == nullptr) continue; + if(neighbor == NULL) continue; int neighborInt = reinterpret_cast(neighbor); diff --git a/engine/server/library/serverPathfinding/src/shared/CityPathGraphManager.cpp b/engine/server/library/serverPathfinding/src/shared/CityPathGraphManager.cpp index 9194452e..3e511c3c 100755 --- a/engine/server/library/serverPathfinding/src/shared/CityPathGraphManager.cpp +++ b/engine/server/library/serverPathfinding/src/shared/CityPathGraphManager.cpp @@ -58,7 +58,7 @@ struct RegionCacheEntry { RegionCacheEntry ( void ) - : m_shape(), m_graph(nullptr) + : m_shape(), m_graph(NULL) { } @@ -143,7 +143,7 @@ void CityPathGraphManager::update ( float time ) CityPathGraph * graph = g_regionCache[g_scrubberGraphIndex].m_graph; - if(graph == nullptr) return; + if(graph == NULL) return; if(g_scrubberNodeIndex >= graph->getNodeCount()) { @@ -156,7 +156,7 @@ void CityPathGraphManager::update ( float time ) g_scrubberNodeIndex++; - if(node == nullptr) return; + if(node == NULL) return; if(!node->sanityCheck(false)) { @@ -233,14 +233,14 @@ Region const * getCityRegionFor( Vector const & position ) return results[0]; } - return nullptr; + return NULL; } // ---------------------------------------------------------------------- int getCityTokenFor ( Region const * region ) { - if(region == nullptr) return -1; + if(region == NULL) return -1; Unicode::String const & name = region->getName(); @@ -294,7 +294,7 @@ bool checkRegionCache ( Vector const & position, CityPathGraph * & outGraph ) bool addToRegionCache ( MultiShape const & shape, CityPathGraph * graph ) { - if(graph == nullptr) return false; + if(graph == NULL) return false; RegionCacheEntry entry(shape,graph); @@ -325,12 +325,12 @@ bool addToRegionCache ( AxialBox const & box, CityPathGraph * graph ) bool addToRegionCache ( Region const * region, CityPathGraph * graph ) { - if(region == nullptr) return false; - if(graph == nullptr) return false; + if(region == NULL) return false; + if(graph == NULL) return false; MxCifQuadTreeBounds const * bounds = ®ion->getBounds(); - if(bounds == nullptr) return false; + if(bounds == NULL) return false; MxCifQuadTreeCircleBounds const * circleBounds = dynamic_cast(bounds); @@ -390,7 +390,7 @@ CityPathGraph * createCityGraphFor ( Region const * region ) { int token = getCityTokenFor(region); - if(token == -1) return nullptr; + if(token == -1) return NULL; CityPathGraph * graph = new CityPathGraph(token); @@ -401,7 +401,7 @@ CityPathGraph * createCityGraphFor ( Region const * region ) CityPathGraph * createCityGraphFor ( ServerObject const * creator, MultiShape const & shape ) { - if(creator == nullptr) return nullptr; + if(creator == NULL) return NULL; CityPathGraph * newGraph = new CityPathGraph(-1); @@ -416,7 +416,7 @@ CityPathGraph * createCityGraphFor ( ServerObject const * creator, MultiShape co CityPathGraph * _getCityGraphFor ( Vector const & position ) { - CityPathGraph * graph = nullptr; + CityPathGraph * graph = NULL; if(checkRegionCache(position,graph)) { @@ -436,9 +436,9 @@ CityPathGraph * _getCityGraphFor ( Vector const & position ) CityPathGraph * _getCityGraphFor ( ServerObject const * object ) { - if(object == nullptr) + if(object == NULL) { - return nullptr; + return NULL; } else { @@ -450,8 +450,8 @@ CityPathGraph * _getCityGraphFor ( ServerObject const * object ) CityPathNode * _getCityNodeFor ( ServerObject const * object, CityPathGraph * graph ) { - if(object == nullptr) return nullptr; - if(graph == nullptr) return nullptr; + if(object == NULL) return NULL; + if(graph == NULL) return NULL; return graph->findNodeForObject(*object); } @@ -462,7 +462,7 @@ CityPathNode * _getCityNodeFor ( ServerObject const * object ) { CityPathGraph * graph = _getCityGraphFor(object); - if(graph == nullptr) return nullptr; + if(graph == NULL) return NULL; return _getCityNodeFor(object,graph); } @@ -471,19 +471,19 @@ CityPathNode * _getCityNodeFor ( ServerObject const * object ) PathGraph const * _getExteriorGraph ( ServerObject const * object ) { - if(object == nullptr) return nullptr; + if(object == NULL) return NULL; CollisionProperty const * collision = object->getCollisionProperty(); - if(collision == nullptr) return nullptr; + if(collision == NULL) return NULL; Floor const * floor = collision->getFloor(); - if(floor == nullptr) return nullptr; + if(floor == NULL) return NULL; FloorMesh const * floorMesh = floor->getFloorMesh(); - if(floorMesh == nullptr) return nullptr; + if(floorMesh == NULL) return NULL; PathGraph const * pathGraph = safe_cast(floorMesh->getPathGraph()); @@ -507,8 +507,8 @@ CityPathGraph const * CityPathGraphManager::getCityGraphFor ( Vector const & pos CityPathNode const * CityPathGraphManager::getNamedNodeFor( ServerObject const & object, Unicode::String const & nodeName ) { CityPathGraph const * cityGraph = getCityGraphFor(&object); - if (cityGraph == nullptr) - return nullptr; + if (cityGraph == NULL) + return NULL; return cityGraph->findNearestNodeForName(nodeName, object.getPosition_w()); } @@ -517,7 +517,7 @@ CityPathNode const * CityPathGraphManager::getNamedNodeFor( ServerObject const & bool CityPathGraphManager::getClosestPathNodePos ( ServerObject const * object, Vector & outPos ) { - if(object == nullptr) return false; + if(object == NULL) return false; if(object->getParentCell() == CellProperty::getWorldCellProperty()) { @@ -548,11 +548,11 @@ bool CityPathGraphManager::getClosestPathNodePos ( ServerObject const * object, void CityPathGraphManager::addWaypoint ( ServerObject * sourceObject ) { - if(sourceObject == nullptr) return; + if(sourceObject == NULL) return; CityPathGraph * graph = _getCityGraphFor(sourceObject); - if(graph == nullptr) + if(graph == NULL) { return; } @@ -561,7 +561,7 @@ void CityPathGraphManager::addWaypoint ( ServerObject * sourceObject ) DynamicVariableList const & objvars = sourceObject->getObjVars(); - CityPathNode * newNode = nullptr; + CityPathNode * newNode = NULL; Vector sourcePos_w = sourceObject->getPosition_w(); @@ -626,11 +626,11 @@ void CityPathGraphManager::removeWaypoint ( ServerObject * sourceObject ) { CityPathGraph * graph = _getCityGraphFor(sourceObject); - if(graph == nullptr) return; + if(graph == NULL) return; CityPathNode * unloadingNode = _getCityNodeFor(sourceObject,graph); - if(unloadingNode == nullptr) return; + if(unloadingNode == NULL) return; // ---------- @@ -679,15 +679,15 @@ void CityPathGraphManager::moveWaypoint ( ServerObject * sourceObject, Vector co { UNREF(oldPosition); - if(sourceObject == nullptr) return; + if(sourceObject == NULL) return; CityPathGraph * graph = _getCityGraphFor(sourceObject); - if(graph == nullptr) return; + if(graph == NULL) return; CityPathNode * node = _getCityNodeFor(sourceObject,graph); - if(node == nullptr) return; + if(node == NULL) return; // ---------- @@ -719,11 +719,11 @@ void CityPathGraphManager::moveWaypoint ( ServerObject * sourceObject, Vector co void CityPathGraphManager::addBuilding ( BuildingObject * building ) { - if(building == nullptr) return; + if(building == NULL) return; CityPathGraph * graph = _getCityGraphFor(building); - if(graph == nullptr) + if(graph == NULL) { return; } @@ -752,11 +752,11 @@ void CityPathGraphManager::addBuilding ( BuildingObject * building ) { ServerObject * serverObject = ServerWorld::findObjectByNetworkId(ids[i]); - if(serverObject == nullptr) continue; + if(serverObject == NULL) continue; CityPathNode * node = _getCityNodeFor(serverObject,graph); - if(node == nullptr) continue; + if(node == NULL) continue; node->setCreator(building->getNetworkId()); } @@ -783,11 +783,11 @@ void CityPathGraphManager::destroyBuilding ( BuildingObject * building ) void CityPathGraphManager::moveBuilding ( BuildingObject * building, Vector const & oldPosition ) { - if(building == nullptr) return; + if(building == NULL) return; CityPathGraph * graph = _getCityGraphFor(building); - if(graph == nullptr) return; + if(graph == NULL) return; UNREF(oldPosition); @@ -800,11 +800,11 @@ void CityPathGraphManager::moveBuilding ( BuildingObject * building, Vector cons { ServerObject * serverObject = ServerWorld::findObjectByNetworkId(ids[i]); - if(serverObject == nullptr) continue; + if(serverObject == NULL) continue; CityPathNode * node = _getCityNodeFor(serverObject,graph); - if(node == nullptr) continue; + if(node == NULL) continue; Vector relativePos_o = node->getRelativePosition_o(); @@ -851,7 +851,7 @@ bool CityPathGraphManager::destroyPathGraph ( ServerObject const * creator ) bool CityPathGraphManager::createPathNodes ( ServerObject * building ) { - if(building == nullptr) return false; + if(building == NULL) return false; // Destroy any old path nodes for the building @@ -862,7 +862,7 @@ bool CityPathGraphManager::createPathNodes ( ServerObject * building ) PathGraph const * pathGraph = _getExteriorGraph(building); - if(pathGraph == nullptr) return false; + if(pathGraph == NULL) return false; // ---------- // Go through all the nodes in the building's graph and create city @@ -878,7 +878,7 @@ bool CityPathGraphManager::createPathNodes ( ServerObject * building ) { PathNode const * node = pathGraph->getNode(i); - if(node == nullptr) continue; + if(node == NULL) continue; // ---------- @@ -975,11 +975,11 @@ void CityPathGraphManager::destroyWaypoint ( ServerObject * object ) { CityPathGraph * graph = _getCityGraphFor(object); - if(graph == nullptr) return; + if(graph == NULL) return; CityPathNode * deadNode = _getCityNodeFor(object,graph); - if(deadNode == nullptr) return; + if(deadNode == NULL) return; // ---------- @@ -1025,11 +1025,11 @@ void CityPathGraphManager::destroyWaypoint ( ServerObject * object ) bool CityPathGraphManager::destroyPathNodes ( ServerObject * object ) { - if(object == nullptr) return false; + if(object == NULL) return false; BuildingObject * building = dynamic_cast(object); - if(building == nullptr) return false; + if(building == NULL) return false; NetworkIdList ids; if (!building->getObjVars().getItem(OBJVAR_PATHFINDING_BUILDING_WAYPOINTS,ids)) return false; @@ -1044,7 +1044,7 @@ bool CityPathGraphManager::destroyPathNodes ( ServerObject * object ) ServerObject * serverObject = ServerWorld::findObjectByNetworkId(id); - if(serverObject == nullptr) continue; + if(serverObject == NULL) continue; serverObject->permanentlyDestroy(DeleteReasons::Replaced); } @@ -1156,7 +1156,7 @@ void CityPathGraphManager::setLinkDistance ( float dist ) void CityPathGraphManager::relinkGraph ( CityPathGraph const * constGraph ) { - if(constGraph == nullptr) return; + if(constGraph == NULL) return; CityPathGraph * graph = const_cast(constGraph); diff --git a/engine/server/library/serverPathfinding/src/shared/CityPathNode.cpp b/engine/server/library/serverPathfinding/src/shared/CityPathNode.cpp index 11000b37..8e4df130 100755 --- a/engine/server/library/serverPathfinding/src/shared/CityPathNode.cpp +++ b/engine/server/library/serverPathfinding/src/shared/CityPathNode.cpp @@ -46,7 +46,7 @@ CityPathNode::CityPathNode ( Vector const & position_w, NetworkId const & source m_source(sourceId), m_creator(), m_relativePosition_o(Vector::zero), - m_spatialHandle(nullptr), + m_spatialHandle(NULL), m_debugId( gs_debugIdCounter++ ) { snapToTerrain(); @@ -59,7 +59,7 @@ CityPathNode::CityPathNode ( Vector const & position_w, NetworkId const & source m_source(sourceId), m_creator(creatorId), m_relativePosition_o(Vector::zero), - m_spatialHandle(nullptr), + m_spatialHandle(NULL), m_debugId( gs_debugIdCounter++ ) { updateRelativePosition(); @@ -158,7 +158,7 @@ void CityPathNode::loadInfoFromObjvars ( void ) { ServerObject const * sourceObject = getSourceObject(); - if(sourceObject == nullptr) return; + if(sourceObject == NULL) return; const DynamicVariableList & objvars = sourceObject->getObjVars(); @@ -188,7 +188,7 @@ void CityPathNode::loadEdgesFromObjvars ( void ) { ServerObject const * sourceObject = getSourceObject(); - if(sourceObject == nullptr) return; + if(sourceObject == NULL) return; DynamicVariableList const & objvars = sourceObject->getObjVars(); @@ -203,11 +203,11 @@ void CityPathNode::loadEdgesFromObjvars ( void ) { ServerObject * serverObject = ServerWorld::findObjectByNetworkId( idList[i] ); - if(serverObject == nullptr) continue; + if(serverObject == NULL) continue; CityPathNode * otherNode = _getGraph()->findNodeForObject(*serverObject); - if(otherNode == nullptr) continue; + if(otherNode == NULL) continue; addEdge(otherNode->getIndex()); otherNode->addEdge(getIndex()); @@ -233,7 +233,7 @@ void CityPathNode::saveInfoToObjvars ( void ) { ServerObject * sourceObject = getSourceObject(); - if(sourceObject == nullptr) return; + if(sourceObject == NULL) return; // ---------- @@ -294,7 +294,7 @@ void CityPathNode::saveEdgesToObjvars ( void ) CityPathNode * neighborNode = _getGraph()->_getNode(neighborIndex); - if(neighborNode == nullptr) continue; + if(neighborNode == NULL) continue; NetworkId const & neighborSourceId = neighborNode->getSourceId(); @@ -327,7 +327,7 @@ void CityPathNode::saveNeighbors ( void ) CityPathNode * neighborNode = _getGraph()->_getNode(neighborIndex); - if(neighborNode == nullptr) continue; + if(neighborNode == NULL) continue; neighborNode->saveToObjvars(); } @@ -420,7 +420,7 @@ bool CityPathNode::sanityCheck ( bool doWarnings ) const CityPathNode const * neighborNode = _getGraph()->_getNode(neighborIndex); - if(neighborNode == nullptr) + if(neighborNode == NULL) { DEBUG_WARNING(doWarnings,("CityPathNode::sanityCheck - Node has an edge to a non-existent node\n")); insaneCount++; @@ -458,7 +458,7 @@ bool CityPathNode::sanityCheck ( bool doWarnings ) const CityPathNode const * nodeA = this; CityPathNode const * nodeB = _getGraph()->_getNode(getNeighbor(i)); - if(nodeB == nullptr) continue; + if(nodeB == NULL) continue; if(nodeB->getType() == PNT_CityBuilding) continue; @@ -493,7 +493,7 @@ void CityPathNode::reload ( void ) { ServerObject const * sourceObject = getSourceObject(); - if(sourceObject == nullptr) return; + if(sourceObject == NULL) return; // ---------- @@ -521,7 +521,7 @@ bool CityPathNode::hasEdgeTo ( NetworkId const & neighborId ) const CityPathNode const * neighborNode = _getGraph()->_getNode(neighborIndex); - if(neighborNode == nullptr) continue; + if(neighborNode == NULL) continue; if(neighborNode->getSourceId() == neighborId) return true; } @@ -535,7 +535,7 @@ void CityPathNode::snapToTerrain ( void ) { CellProperty const * cell = getCell(); - if((cell == nullptr) || (cell == CellProperty::getWorldCellProperty())) + if((cell == NULL) || (cell == CellProperty::getWorldCellProperty())) { Vector pos_w = getPosition_w(); diff --git a/engine/server/library/serverPathfinding/src/shared/PathAutoGenerator.cpp b/engine/server/library/serverPathfinding/src/shared/PathAutoGenerator.cpp index 328a52aa..d5f6cd8e 100755 --- a/engine/server/library/serverPathfinding/src/shared/PathAutoGenerator.cpp +++ b/engine/server/library/serverPathfinding/src/shared/PathAutoGenerator.cpp @@ -48,14 +48,14 @@ Region const * PathAutoGenerator::findPathRegion(Vector const & pos_w) for (RegionMaster::RegionVector::const_iterator it = rv.begin(); it != rv.end(); ++it) { Region const * const r = *it; - if (nullptr != r) + if (NULL != r) { if (r->getGeography() == RegionNamespace::RG_pathfind) return r; } } - return nullptr; + return NULL; } //---------------------------------------------------------------------- @@ -63,7 +63,7 @@ Region const * PathAutoGenerator::findPathRegion(Vector const & pos_w) void PathAutoGenerator::pathAutoGenerate(Vector const & pos_w, float nodeDistance, float obstacleDistance, Unicode::String & result) { Region const * region = findPathRegion(pos_w); - if (nullptr == region) + if (NULL == region) { result += Unicode::narrowToWide("No pathfinding region at position"); return; @@ -144,7 +144,7 @@ void PathAutoGenerator::pathAutoGenerate(Vector const & pos_w, float nodeDistanc ++obstacleNearbySkipped; #if USE_OBSTACLE_TEMPLATE - if (nullptr != PathAutoGeneratorNamespace::s_pathObstacleTemplate) + if (NULL != PathAutoGeneratorNamespace::s_pathObstacleTemplate) { Transform transform_w; transform_w.setPosition_p(testPos_w); @@ -164,7 +164,7 @@ void PathAutoGenerator::pathAutoGenerate(Vector const & pos_w, float nodeDistanc transform_w.setPosition_p(testPos_w); ServerObject * newObject = ServerWorld::createNewObject(s_pathWaypointTemplate, transform_w, 0, false); - if (nullptr != newObject) + if (NULL != newObject) { newObject->addToWorld(); newObject->persist(); @@ -189,7 +189,7 @@ void PathAutoGenerator::pathAutoGenerate(Vector const & pos_w, float nodeDistanc void PathAutoGenerator::pathAutoCleanup(Vector const & pos_w, Unicode::String & result) { Region const * region = findPathRegion(pos_w); - if (nullptr == region) + if (NULL == region) { result += Unicode::narrowToWide("No pathfinding region at position"); return; @@ -236,7 +236,7 @@ void PathAutoGenerator::pathAutoCleanup(Vector const & pos_w, Unicode::String & } #if USE_OBSTACLE_TEMPLATE - if (nullptr != s_pathObstacleTemplate && !strcmp(so->getTemplateName(), s_pathObstacleTemplate)) + if (NULL != s_pathObstacleTemplate && !strcmp(so->getTemplateName(), s_pathObstacleTemplate)) { so->permanentlyDestroy(DeleteReasons::Script); ++obstacleDestroyCount; diff --git a/engine/server/library/serverPathfinding/src/shared/ServerPathBuilder.cpp b/engine/server/library/serverPathfinding/src/shared/ServerPathBuilder.cpp index 109ba9c4..4ffdd288 100755 --- a/engine/server/library/serverPathfinding/src/shared/ServerPathBuilder.cpp +++ b/engine/server/library/serverPathfinding/src/shared/ServerPathBuilder.cpp @@ -41,7 +41,7 @@ const float gs_maxCanMoveDistance2 = (64.0f * 64.0f); int findClosestReachablePathNode_slow( CreatureObject const * creature, PathGraph const * graph ) { - if(graph == nullptr) return -1; + if(graph == NULL) return -1; Vector creaturePos = creature->getPosition_p(); @@ -53,7 +53,7 @@ int findClosestReachablePathNode_slow( CreatureObject const * creature, PathGrap int resultCount = results.size(); - PathNode const * reachableNode = nullptr; + PathNode const * reachableNode = NULL; float reachableDist2 = gs_maxCanMoveDistance2; for(int i = 0; i < resultCount; i++) @@ -81,7 +81,7 @@ int findClosestReachablePathNode_slow( CreatureObject const * creature, PathGrap int findClosestReachablePathNode( CreatureObject const * creature, PathGraph const * graph ) { - if(graph == nullptr) return -1; + if(graph == NULL) return -1; Vector creaturePos = creature->getPosition_p(); @@ -98,7 +98,7 @@ int findClosestReachablePathNode( CreatureObject const * creature, PathGraph con PathNode const * node = graph->getNode(closestIndex); - if(node == nullptr) return -2; + if(node == NULL) return -2; Vector nodePos = node->getPosition_p(); float dist2 = nodePos.magnitudeBetweenSquared(creaturePos); @@ -135,7 +135,7 @@ int findClosestReachablePathNode_slow ( CellProperty const * cell, Vector const int resultCount = results.size(); - PathNode const * reachableNode = nullptr; + PathNode const * reachableNode = NULL; float reachableDist2 = gs_maxCanMoveDistance2; for(int i = 0; i < resultCount; i++) @@ -173,7 +173,7 @@ int findClosestReachablePathNode ( CellProperty const * cell, Vector const & goa PathNode const * node = graph->getNode(closestIndex); - if(node == nullptr) return -2; + if(node == NULL) return -2; Vector nodePos = node->getPosition_p(); float dist2 = nodePos.magnitudeBetweenSquared(goal); @@ -199,7 +199,7 @@ PathGraph const * getGraph ( CellProperty const * cell ) if(cell) return safe_cast(cell->getPathGraph()); else - return nullptr; + return NULL; } PathGraph const * getGraph ( PortalProperty const * building ) @@ -207,7 +207,7 @@ PathGraph const * getGraph ( PortalProperty const * building ) if(building) return safe_cast(building->getPortalPropertyTemplate().getBuildingPathGraph()); else - return nullptr; + return NULL; } // ---------- @@ -237,19 +237,19 @@ PortalProperty const * getBuilding ( BuildingObject const * buildingObject ) if(buildingObject) return buildingObject->getPortalProperty(); else - return nullptr; + return NULL; } PortalProperty const * getBuilding ( CreatureObject const * creature ) { - if(creature == nullptr) return nullptr; + if(creature == NULL) return NULL; CellProperty const * cell = creature->getParentCell(); if(cell) return cell->getPortalProperty(); else - return nullptr; + return NULL; } PortalProperty const * getBuilding ( AiLocation const & loc ) @@ -259,7 +259,7 @@ PortalProperty const * getBuilding ( AiLocation const & loc ) if(cell) return cell->getPortalProperty(); else - return nullptr; + return NULL; } // ---------- @@ -388,26 +388,26 @@ int getIndexFor ( CellProperty const * cell, PathGraph const * graph, AiLocation // ---------------------------------------------------------------------- ServerPathBuilder::ServerPathBuilder() -: m_creatureCell(nullptr), - m_creatureCellGraph(nullptr), +: m_creatureCell(NULL), + m_creatureCellGraph(NULL), m_creatureCellKey(-1), m_creatureCellNodeIndex(-1), m_creatureCellPart(-1), - m_creatureBuilding(nullptr), - m_creatureBuildingGraph(nullptr), + m_creatureBuilding(NULL), + m_creatureBuildingGraph(NULL), m_creatureBuildingKey(-1), m_creatureBuildingNodeIndex(-1), m_creaturePosition(), - m_goalCell(nullptr), - m_goalCellGraph(nullptr), + m_goalCell(NULL), + m_goalCellGraph(NULL), m_goalCellKey(-1), m_goalCellNodeIndex(-1), m_goalCellPart(-1), - m_goalBuilding(nullptr), - m_goalBuildingGraph(nullptr), + m_goalBuilding(NULL), + m_goalBuildingGraph(NULL), m_goalBuildingKey(-1), m_goalBuildingNodeIndex(-1), - m_goalCityGraph(nullptr), + m_goalCityGraph(NULL), m_goalCityNodeIndex(-1), m_path(new AiPath()), m_async(false), @@ -427,16 +427,16 @@ ServerPathBuilder::~ServerPathBuilder() ServerPathBuildManager::unqueue(this); delete m_path; - m_path = nullptr; + m_path = NULL; delete m_cellSearch; - m_cellSearch = nullptr; + m_cellSearch = NULL; delete m_buildingSearch; - m_buildingSearch = nullptr; + m_buildingSearch = NULL; delete m_citySearch; - m_citySearch = nullptr; + m_citySearch = NULL; } @@ -462,7 +462,7 @@ bool ServerPathBuilder::buildPathInternal( CellProperty const * cell, PathGraph PathNode const * node = graph->getNode(nodeIndex); - if(node == nullptr) return false; + if(node == NULL) return false; addPathNode( cell, node ); } @@ -484,9 +484,9 @@ bool ServerPathBuilder::buildPathInternal ( PortalProperty const * building, Pat // ---------- - PathNode const * nodeA = nullptr; - PathNode const * nodeB = nullptr; - PathNode const * nodeC = nullptr; + PathNode const * nodeA = NULL; + PathNode const * nodeB = NULL; + PathNode const * nodeC = NULL; int pathLength = path.size(); @@ -496,7 +496,7 @@ bool ServerPathBuilder::buildPathInternal ( PortalProperty const * building, Pat { PathNode const * nextNode = graph->getNode(path[i]); - if(nextNode == nullptr) continue; + if(nextNode == NULL) continue; nodeA = nodeB; nodeB = nodeC; @@ -506,10 +506,10 @@ bool ServerPathBuilder::buildPathInternal ( PortalProperty const * building, Pat { nodeA = nodeB; nodeB = nodeC; - nodeC = nullptr; + nodeC = NULL; } - if( nodeB == nullptr ) continue; + if( nodeB == NULL ) continue; // ---------- @@ -519,11 +519,11 @@ bool ServerPathBuilder::buildPathInternal ( PortalProperty const * building, Pat CellProperty const * subobject = building->getCell(cellIndex); - if(subobject == nullptr) return false; + if(subobject == NULL) return false; PathGraph const * subgraph = getGraph(subobject); - if(subgraph == nullptr) return false; + if(subgraph == NULL) return false; // ---------- @@ -576,9 +576,9 @@ bool ServerPathBuilder::buildPathInternal ( CityPathGraph const * graph, int ind bool ServerPathBuilder::expandPath ( CityPathGraph const * graph, IndexList const & path ) { - PathNode const * nodeA = nullptr; - PathNode const * nodeB = nullptr; - PathNode const * nodeC = nullptr; + PathNode const * nodeA = NULL; + PathNode const * nodeB = NULL; + PathNode const * nodeC = NULL; int pathLength = path.size(); @@ -588,7 +588,7 @@ bool ServerPathBuilder::expandPath ( CityPathGraph const * graph, IndexList cons { PathNode const * nextNode = graph->getNode(path[i]); - if(nextNode == nullptr) continue; + if(nextNode == NULL) continue; nodeA = nodeB; nodeB = nodeC; @@ -598,10 +598,10 @@ bool ServerPathBuilder::expandPath ( CityPathGraph const * graph, IndexList cons { nodeA = nodeB; nodeB = nodeC; - nodeC = nullptr; + nodeC = NULL; } - if( nodeB == nullptr ) continue; + if( nodeB == NULL ) continue; // ---------- @@ -609,19 +609,19 @@ bool ServerPathBuilder::expandPath ( CityPathGraph const * graph, IndexList cons { CityPathNode const * cityNode = safe_cast(nodeB); - if(cityNode == nullptr) return false; + if(cityNode == NULL) return false; BuildingObject const * buildingObject = safe_cast(cityNode->getCreatorObject()); - if(buildingObject == nullptr) return false; + if(buildingObject == NULL) return false; PortalProperty const * subobject = getBuilding(buildingObject); - if(subobject == nullptr) return false; + if(subobject == NULL) return false; PathGraph const * subgraph = getGraph(subobject); - if(subgraph == nullptr) return false; + if(subgraph == NULL) return false; // ---------- @@ -652,7 +652,7 @@ bool ServerPathBuilder::buildPath_World ( void ) { Vector exitPoint(m_creature ? m_creature->getPosition_w() : m_creaturePosition); - if((m_creatureCityGraph != nullptr) && (m_creatureCityNodeIndex >= 0)) + if((m_creatureCityGraph != NULL) && (m_creatureCityNodeIndex >= 0)) { int indexA = m_creatureCityNodeIndex; int indexB = m_creatureCityGraph->findNearestNode(m_goal.getPosition_w()); @@ -670,7 +670,7 @@ bool ServerPathBuilder::buildPath_World ( void ) } } - if((m_goalCityGraph != nullptr) && (m_goalCityNodeIndex >= 0)) + if((m_goalCityGraph != NULL) && (m_goalCityNodeIndex >= 0)) { int indexA = m_goalCityGraph->findNearestNode(exitPoint); int indexB = m_goalCityNodeIndex; @@ -701,8 +701,8 @@ bool ServerPathBuilder::buildPath_ToGoal ( void ) m_creatureCell = m_creature->getParentCell(); m_goalCell = m_goal.getCell(); - if(m_creatureCell == nullptr) m_creatureCell = worldCell; - if(m_goalCell == nullptr) m_goalCell = worldCell; + if(m_creatureCell == NULL) m_creatureCell = worldCell; + if(m_goalCell == NULL) m_goalCell = worldCell; { Vector goalPos_p = m_goal.getPosition_p(m_creatureCell); @@ -724,23 +724,23 @@ bool ServerPathBuilder::buildPath_ToGoal ( void ) // we can skip some work with looking up their cell and building // info. - m_creatureCellGraph = nullptr; + m_creatureCellGraph = NULL; m_creatureCellKey = -1; m_creatureCellNodeIndex = -1; m_creatureCellPart = -1; - m_goalCellGraph = nullptr; + m_goalCellGraph = NULL; m_goalCellKey = -1; m_goalCellNodeIndex = -1; m_goalCellPart = -1; - m_creatureBuilding = nullptr; - m_creatureBuildingGraph = nullptr; + m_creatureBuilding = NULL; + m_creatureBuildingGraph = NULL; m_creatureBuildingKey = -1; m_creatureBuildingNodeIndex = -1; - m_goalBuilding = nullptr; - m_goalBuildingGraph = nullptr; + m_goalBuilding = NULL; + m_goalBuildingGraph = NULL; m_goalBuildingKey = -1; m_goalBuildingNodeIndex = -1; } @@ -776,7 +776,7 @@ bool ServerPathBuilder::buildPath_ToGoal ( void ) // If they're in the same cell, start the search in the cell - if((m_creatureCell == m_goalCell) && (m_creatureCell != nullptr) && (m_creatureCell != CellProperty::getWorldCellProperty()) && (m_creatureCellPart == m_goalCellPart)) + if((m_creatureCell == m_goalCell) && (m_creatureCell != NULL) && (m_creatureCell != CellProperty::getWorldCellProperty()) && (m_creatureCellPart == m_goalCellPart)) { return buildPathInternal(m_creatureCell,m_creatureCellGraph,m_creatureCellNodeIndex,m_goalCellNodeIndex); } @@ -795,7 +795,7 @@ bool ServerPathBuilder::buildPath_ToGoal ( void ) // If they're in the same building, start the search in the building - if((m_creatureBuilding == m_goalBuilding) && (m_creatureBuilding != nullptr)) + if((m_creatureBuilding == m_goalBuilding) && (m_creatureBuilding != NULL)) { return buildPathInternal(m_creatureBuilding,m_creatureBuildingGraph,m_creatureBuildingNodeIndex,m_goalBuildingNodeIndex); } @@ -810,7 +810,7 @@ bool ServerPathBuilder::buildPath_ToGoal ( void ) m_goalCityGraph = CityPathGraphManager::getCityGraphFor(m_goal.getPosition_w()); m_goalCityNodeIndex = getIndexFor(m_goalCityGraph,m_goalBuilding,m_goal); - if((m_creatureCityGraph == m_goalCityGraph) && (m_creatureCityGraph != nullptr)) + if((m_creatureCityGraph == m_goalCityGraph) && (m_creatureCityGraph != NULL)) { // hack - If a creature in a city region tries to path search but it's not near a path node, // make its path search succeed @@ -875,7 +875,7 @@ bool ServerPathBuilder::buildPath_Named ( void ) // ---------- - if(m_creatureCityGraph != nullptr) + if(m_creatureCityGraph != NULL) { IndexList goalList; @@ -885,7 +885,7 @@ bool ServerPathBuilder::buildPath_Named ( void ) { CityPathNode const * node = m_creatureCityGraph->_getNode(i); - if(node == nullptr) continue; + if(node == NULL) continue; if(node->getName() == m_goalName) { @@ -954,7 +954,7 @@ void ServerPathBuilder::update ( void ) bool ServerPathBuilder::setupBuildPath ( CreatureObject const * creature, AiLocation const & goal ) { - if(creature == nullptr) return false; + if(creature == NULL) return false; if(!goal.isValid()) return false; m_creature = creature; @@ -971,7 +971,7 @@ bool ServerPathBuilder::setupBuildPath ( CreatureObject const * creature, AiLoca bool ServerPathBuilder::setupBuildPath ( CreatureObject const * creature, Unicode::String const & goalName ) { - if(creature == nullptr) return false; + if(creature == NULL) return false; if(goalName.empty()) return false; m_creature = creature; @@ -1058,23 +1058,23 @@ bool ServerPathBuilder::buildWorldPath(AiLocation const &startLocation, AiLocati // we can skip some work with looking up their cell and building // info. - m_creatureCellGraph = nullptr; + m_creatureCellGraph = NULL; m_creatureCellKey = -1; m_creatureCellNodeIndex = -1; m_creatureCellPart = -1; - m_goalCellGraph = nullptr; + m_goalCellGraph = NULL; m_goalCellKey = -1; m_goalCellNodeIndex = -1; m_goalCellPart = -1; - m_creatureBuilding = nullptr; - m_creatureBuildingGraph = nullptr; + m_creatureBuilding = NULL; + m_creatureBuildingGraph = NULL; m_creatureBuildingKey = -1; m_creatureBuildingNodeIndex = -1; - m_goalBuilding = nullptr; - m_goalBuildingGraph = nullptr; + m_goalBuilding = NULL; + m_goalBuildingGraph = NULL; m_goalBuildingKey = -1; m_goalBuildingNodeIndex = -1; @@ -1134,8 +1134,8 @@ bool ServerPathBuilder::buildWorldPath(AiLocation const &startLocation, AiLocati void ServerPathBuilder::addPathNode ( CellProperty const * cell, PathNode const * node ) { - if(node == nullptr) return; - if(cell == nullptr) cell = CellProperty::getWorldCellProperty(); + if(node == NULL) return; + if(cell == NULL) cell = CellProperty::getWorldCellProperty(); AiLocation loc(cell,node->getPosition_p()); @@ -1173,7 +1173,7 @@ void ServerPathBuilder::addPathNode ( CellProperty const * cell, PathNode const bool ServerPathBuilder::buildPathImmediate(AiLocation const & creature, AiLocation const & goal) { - m_creature = nullptr; + m_creature = NULL; m_goal = goal; m_buildDone = false; m_buildFailed = false; @@ -1190,9 +1190,9 @@ bool ServerPathBuilder::buildPathImmediate(AiLocation const & creature, AiLocati // ---------- CellProperty const * worldCell = CellProperty::getWorldCellProperty(); - if(m_creatureCell == nullptr) + if(m_creatureCell == NULL) m_creatureCell = worldCell; - if(m_goalCell == nullptr) + if(m_goalCell == NULL) m_goalCell = worldCell; @@ -1236,14 +1236,14 @@ bool ServerPathBuilder::buildPathImmediate(AiLocation const & creature, AiLocati m_goalBuildingNodeIndex = getIndexFor(m_goalBuilding, m_goalBuildingGraph, m_goal, m_goalCellPart); // If they're in the same building, start the search in the building - if((m_creatureBuilding == m_goalBuilding) && (m_creatureBuilding != nullptr)) + if((m_creatureBuilding == m_goalBuilding) && (m_creatureBuilding != NULL)) { if (buildPathInternal(m_creatureBuilding, m_creatureBuildingGraph, m_creatureBuildingNodeIndex, m_goalBuildingNodeIndex)) return true; } // If they're in the same cell, start the search in the cell - if((m_creatureCell == m_goalCell) && (m_creatureCell != nullptr) && (m_creatureCell != CellProperty::getWorldCellProperty()) && (m_creatureCellPart == m_goalCellPart)) + if((m_creatureCell == m_goalCell) && (m_creatureCell != NULL) && (m_creatureCell != CellProperty::getWorldCellProperty()) && (m_creatureCellPart == m_goalCellPart)) { if (buildPathInternal(m_creatureCell, m_creatureCellGraph, m_creatureCellNodeIndex, m_goalCellNodeIndex)) return true; @@ -1257,7 +1257,7 @@ bool ServerPathBuilder::buildPathImmediate(AiLocation const & creature, AiLocati m_goalCityGraph = CityPathGraphManager::getCityGraphFor(m_goal.getPosition_w()); m_goalCityNodeIndex = getIndexFor(m_goalCityGraph,m_goalBuilding,m_goal); - if((m_creatureCityGraph == m_goalCityGraph) && (m_creatureCityGraph != nullptr)) + if((m_creatureCityGraph == m_goalCityGraph) && (m_creatureCityGraph != NULL)) { // hack - If a creature in a city region tries to path search but it's not near a path node, // make its path search succeed diff --git a/engine/server/library/serverPathfinding/src/shared/ServerPathfindingMessaging.cpp b/engine/server/library/serverPathfinding/src/shared/ServerPathfindingMessaging.cpp index e71513d5..068f9d3a 100755 --- a/engine/server/library/serverPathfinding/src/shared/ServerPathfindingMessaging.cpp +++ b/engine/server/library/serverPathfinding/src/shared/ServerPathfindingMessaging.cpp @@ -31,7 +31,7 @@ #include #include -ServerPathfindingMessaging * g_messaging = nullptr; +ServerPathfindingMessaging * g_messaging = NULL; // ====================================================================== @@ -51,7 +51,7 @@ void ServerPathfindingMessaging::remove ( void ) g_messaging->disconnectFromMessage(RequestUnstick::MESSAGE_TYPE); delete g_messaging; - g_messaging = nullptr; + g_messaging = NULL; } ServerPathfindingMessaging & ServerPathfindingMessaging::getInstance ( void ) @@ -75,10 +75,10 @@ ServerPathfindingMessaging::~ServerPathfindingMessaging() } delete m_clientList; - m_clientList = nullptr; + m_clientList = NULL; delete m_callback; - m_callback = nullptr; + m_callback = NULL; } // ---------- @@ -178,7 +178,7 @@ void ServerPathfindingMessaging::receiveMessage(const MessageDispatch::Emitter & { Transform newTransform = Transform::identity; newTransform.setPosition_p(unstickPoint); - controller->teleport(newTransform, nullptr); + controller->teleport(newTransform, NULL); } return; @@ -188,7 +188,7 @@ void ServerPathfindingMessaging::receiveMessage(const MessageDispatch::Emitter & Vector unstickPoint; CellObject * cell = ContainerInterface::getContainingCellObject(*s); - if (cell != nullptr && s->asCreatureObject() != nullptr) + if (cell != NULL && s->asCreatureObject() != NULL) { // try finding a waypoint in the cell first if (!cell->getClosestPathNodePos(*s, unstickPoint)) @@ -266,7 +266,7 @@ void ServerPathfindingMessaging::ignoreObjectPath(Client * client, const Network void ServerPathfindingMessaging::watchPathMap(Client * client) { - if(client == nullptr) return; + if(client == NULL) return; // Add the client to our client list @@ -290,7 +290,7 @@ void ServerPathfindingMessaging::watchPathMap(Client * client) void ServerPathfindingMessaging::ignorePathMap(Client * client) { - if(client == nullptr) return; + if(client == NULL) return; m_clientList->erase(client); @@ -319,7 +319,7 @@ void ServerPathfindingMessaging::onClientDestroy(ClientDestroy & d) void ServerPathfindingMessaging::sendGraphInfo ( CityPathGraph const * graph ) { - if(graph == nullptr) return; + if(graph == NULL) return; for(ClientList::iterator it = m_clientList->begin(); it != m_clientList->end(); ++it) { @@ -331,8 +331,8 @@ void ServerPathfindingMessaging::sendGraphInfo ( CityPathGraph const * graph ) void ServerPathfindingMessaging::sendGraphInfo ( CityPathGraph const * graph, Client * client ) { - if(client == nullptr) return; - if(graph == nullptr) return; + if(client == NULL) return; + if(graph == NULL) return; int nodeCount = graph->getNodeCount(); @@ -348,7 +348,7 @@ void ServerPathfindingMessaging::sendGraphInfo ( CityPathGraph const * graph, Cl void ServerPathfindingMessaging::sendEraseGraph ( CityPathGraph const * graph ) { - if(graph == nullptr) return; + if(graph == NULL) return; for(ClientList::iterator it = m_clientList->begin(); it != m_clientList->end(); ++it) { @@ -360,8 +360,8 @@ void ServerPathfindingMessaging::sendEraseGraph ( CityPathGraph const * graph ) void ServerPathfindingMessaging::sendEraseGraph ( CityPathGraph const * graph, Client * client ) { - if(client == nullptr) return; - if(graph == nullptr) return; + if(client == NULL) return; + if(graph == NULL) return; int nodeCount = graph->getNodeCount(); @@ -377,7 +377,7 @@ void ServerPathfindingMessaging::sendEraseGraph ( CityPathGraph const * graph, C void ServerPathfindingMessaging::sendNodeInfo ( CityPathNode const * node ) { - if(node == nullptr) return; + if(node == NULL) return; for(ClientList::iterator it = m_clientList->begin(); it != m_clientList->end(); ++it) { @@ -389,8 +389,8 @@ void ServerPathfindingMessaging::sendNodeInfo ( CityPathNode const * node ) void ServerPathfindingMessaging::sendNodeInfo ( CityPathNode const * node, Client * client ) { - if(node == nullptr) return; - if(client == nullptr) return; + if(node == NULL) return; + if(client == NULL) return; AINodeInfo m; @@ -428,7 +428,7 @@ void ServerPathfindingMessaging::sendNodeInfo ( CityPathNode const * node, Clien void ServerPathfindingMessaging::sendNeighborInfo ( CityPathNode const * node ) { - if(node == nullptr) return; + if(node == NULL) return; for(ClientList::iterator it = m_clientList->begin(); it != m_clientList->end(); ++it) { @@ -440,8 +440,8 @@ void ServerPathfindingMessaging::sendNeighborInfo ( CityPathNode const * node ) void ServerPathfindingMessaging::sendNeighborInfo ( CityPathNode const * node, Client * client ) { - if(node == nullptr) return; - if(client == nullptr) return; + if(node == NULL) return; + if(client == NULL) return; int edgeCount = node->getEdgeCount(); @@ -459,7 +459,7 @@ void ServerPathfindingMessaging::sendNeighborInfo ( CityPathNode const * node, C void ServerPathfindingMessaging::sendEraseNode ( CityPathNode const * node ) { - if(node == nullptr) return; + if(node == NULL) return; for(ClientList::iterator it = m_clientList->begin(); it != m_clientList->end(); ++it) { @@ -471,8 +471,8 @@ void ServerPathfindingMessaging::sendEraseNode ( CityPathNode const * node ) void ServerPathfindingMessaging::sendEraseNode ( CityPathNode const * node, Client * client ) { - if(node == nullptr) return; - if(client == nullptr) return; + if(node == NULL) return; + if(client == NULL) return; AINodeInfo m; @@ -497,7 +497,7 @@ void ServerPathfindingMessaging::sendWaypointInfo ( AiLocation const & loc ) void ServerPathfindingMessaging::sendWaypointInfo ( AiLocation const & loc, Client * client ) { - if(client == nullptr) return; + if(client == NULL) return; AINodeInfo m; @@ -531,7 +531,7 @@ void ServerPathfindingMessaging::sendEraseWaypoint ( AiLocation const & loc ) void ServerPathfindingMessaging::sendEraseWaypoint ( AiLocation const & loc, Client * client ) { - if(client == nullptr) return; + if(client == NULL) return; AINodeInfo m; diff --git a/engine/server/library/serverPathfinding/src/shared/ServerPathfindingNotification.cpp b/engine/server/library/serverPathfinding/src/shared/ServerPathfindingNotification.cpp index 25f8a676..d524776c 100755 --- a/engine/server/library/serverPathfinding/src/shared/ServerPathfindingNotification.cpp +++ b/engine/server/library/serverPathfinding/src/shared/ServerPathfindingNotification.cpp @@ -44,7 +44,7 @@ void ServerPathfindingNotification::addToWorld ( Object & object ) const { CityPathGraphManager::addBuilding( building ); } - else if(object.asServerObject() != nullptr && object.asServerObject()->isWaypoint()) + else if(object.asServerObject() != NULL && object.asServerObject()->isWaypoint()) { CityPathGraphManager::addWaypoint( object.asServerObject() ); } @@ -61,7 +61,7 @@ void ServerPathfindingNotification::removeFromWorld ( Object & object ) const { CityPathGraphManager::removeBuilding( building ); } - else if(object.asServerObject() != nullptr && object.asServerObject()->isWaypoint()) + else if(object.asServerObject() != NULL && object.asServerObject()->isWaypoint()) { CityPathGraphManager::removeWaypoint( object.asServerObject() ); } @@ -79,7 +79,7 @@ bool ServerPathfindingNotification::positionChanged ( Object & object, bool /*du { CityPathGraphManager::moveBuilding( building, oldPosition ); } - else if(object.asServerObject() != nullptr && object.asServerObject()->isWaypoint()) + else if(object.asServerObject() != NULL && object.asServerObject()->isWaypoint()) { CityPathGraphManager::moveWaypoint( object.asServerObject(), oldPosition ); } @@ -95,7 +95,7 @@ bool ServerPathfindingNotification::positionAndRotationChanged ( Object & object { CityPathGraphManager::moveBuilding( building, oldPosition ); } - else if(object.asServerObject() != nullptr && object.asServerObject()->isWaypoint()) + else if(object.asServerObject() != NULL && object.asServerObject()->isWaypoint()) { CityPathGraphManager::moveWaypoint( object.asServerObject(), oldPosition ); } diff --git a/engine/server/library/serverScript/src/shared/GameScriptObject.cpp b/engine/server/library/serverScript/src/shared/GameScriptObject.cpp index 3e8e9396..c93ebbf4 100755 --- a/engine/server/library/serverScript/src/shared/GameScriptObject.cpp +++ b/engine/server/library/serverScript/src/shared/GameScriptObject.cpp @@ -40,7 +40,7 @@ // class GameScriptObject static members //======================================================================== -GameScriptObject::ScriptDataMap * GameScriptObject::ms_scriptDataMap = nullptr; +GameScriptObject::ScriptDataMap * GameScriptObject::ms_scriptDataMap = NULL; bool GameScriptObject::m_pauseScripting = false; @@ -52,7 +52,7 @@ bool GameScriptObject::m_pauseScripting = false; * Class constructor. */ GameScriptObject::GameScriptObject(void) : - m_owner(nullptr), + m_owner(NULL), m_scriptList(), m_scriptListInitialized(false), m_scriptListValid(false), @@ -69,11 +69,11 @@ GameScriptObject::~GameScriptObject() { { PROFILER_AUTO_BLOCK_DEFINE("GameScriptObject::~GameScriptObject removeJavaId\n"); - if (JavaLibrary::instance() != nullptr /*&& m_javaId != nullptr*/) + if (JavaLibrary::instance() != NULL /*&& m_javaId != NULL*/) { NOT_NULL(m_owner); JavaLibrary::removeJavaId(m_owner->getNetworkId()); -// m_javaId = nullptr; +// m_javaId = NULL; } } @@ -82,7 +82,7 @@ GameScriptObject::~GameScriptObject() removeAll(); } m_scriptList.clear(); - m_owner = nullptr; + m_owner = NULL; } // GameScriptObject::~GameScriptObject /** @@ -92,7 +92,7 @@ GameScriptObject::~GameScriptObject() */ bool GameScriptObject::installScriptEngine(void) { - if (JavaLibrary::instance() != nullptr) + if (JavaLibrary::instance() != NULL) { DEBUG_WARNING(true, ("Trying to install script engine more than once")); return true; @@ -101,7 +101,7 @@ bool GameScriptObject::installScriptEngine(void) ms_scriptDataMap = new GameScriptObject::ScriptDataMap; Scripting::InitScriptFuncHashMap(); JavaLibrary::install(); - if (JavaLibrary::instance() == nullptr) + if (JavaLibrary::instance() == NULL) return false; enableNewJediTracking(ConfigServerGame::getEnableNewJedi()); return true; @@ -114,7 +114,7 @@ void GameScriptObject::removeScriptEngine(void) { JavaLibrary::remove(); delete ms_scriptDataMap; - ms_scriptDataMap = nullptr; + ms_scriptDataMap = NULL; Scripting::RemoveScriptFuncHashMap(); } // GameScriptObject::removeScriptEngine @@ -145,10 +145,10 @@ void GameScriptObject::alter(real time) */ void GameScriptObject::setOwnerIsAuthoritative(bool authoritative, uint32 pid) { - if (JavaLibrary::instance() == nullptr) + if (JavaLibrary::instance() == NULL) return; - if (m_owner != nullptr && m_owner->getNetworkId() != NetworkId::cms_invalid) + if (m_owner != NULL && m_owner->getNetworkId() != NetworkId::cms_invalid) { JavaLibrary::instance()->setObjIdAuthoritative(m_owner->getNetworkId(), authoritative, pid); @@ -171,9 +171,9 @@ void GameScriptObject::setOwnerIsAuthoritative(bool authoritative, uint32 pid) */ void GameScriptObject::setOwnerIsLoaded(void) { - if (JavaLibrary::instance() == nullptr) + if (JavaLibrary::instance() == NULL) return; - if (m_owner != nullptr && m_owner->getNetworkId() != NetworkId::cms_invalid) + if (m_owner != NULL && m_owner->getNetworkId() != NetworkId::cms_invalid) { JavaLibrary::instance()->setObjIdLoaded(m_owner->getNetworkId()); } @@ -189,9 +189,9 @@ void GameScriptObject::setOwnerIsLoaded(void) */ void GameScriptObject::setOwnerIsInitialized(void) { - if (JavaLibrary::instance() == nullptr) + if (JavaLibrary::instance() == NULL) return; - if (m_owner != nullptr && m_owner->getNetworkId() != NetworkId::cms_invalid) + if (m_owner != NULL && m_owner->getNetworkId() != NetworkId::cms_invalid) { JavaLibrary::instance()->setObjIdInitialized(m_owner->getNetworkId()); if (m_owner->isAuthoritative()) @@ -211,10 +211,10 @@ void GameScriptObject::setOwnerIsInitialized(void) */ void GameScriptObject::setOwnerDestroyed(void) { - if (JavaLibrary::instance() == nullptr) + if (JavaLibrary::instance() == NULL) return; - if (m_owner != nullptr && m_owner->getNetworkId() != NetworkId::cms_invalid && m_owner->isAuthoritative()) + if (m_owner != NULL && m_owner->getNetworkId() != NetworkId::cms_invalid && m_owner->isAuthoritative()) JavaLibrary::flagDestroyed(m_owner->getNetworkId()); } //lint !e1762 Do not make const @@ -283,7 +283,7 @@ int GameScriptObject::attachScript(const std::string& scriptName, bool runTrigge } else { - if (ms_scriptDataMap == nullptr || JavaLibrary::instance() == nullptr) + if (ms_scriptDataMap == NULL || JavaLibrary::instance() == NULL) return SCRIPT_CONTINUE; if (ms_scriptDataMap->find(scriptName) == ms_scriptDataMap->end()) @@ -379,7 +379,7 @@ int GameScriptObject::detachScript(const std::string& scriptName) else { - if (JavaLibrary::instance() == nullptr) + if (JavaLibrary::instance() == NULL) return SCRIPT_CONTINUE; // Make sure to call the detach trigger on this one script if one exists. @@ -420,12 +420,12 @@ void GameScriptObject::initScriptInstances() { m_scriptListInitialized = true; - if (JavaLibrary::instance() == nullptr) + if (JavaLibrary::instance() == NULL) return; if (!m_owner) { - WARNING_STRICT_FATAL(true, ("Use of nullptr m_owner in ::initScriptInstances()")); + WARNING_STRICT_FATAL(true, ("Use of null m_owner in ::initScriptInstances()")); return; } @@ -454,7 +454,7 @@ void GameScriptObject::initScriptInstances() */ void GameScriptObject::removeAll(void) { - if (JavaLibrary::instance() == nullptr) + if (JavaLibrary::instance() == NULL) return; // removeAll() cannot be overriden by scripts @@ -483,12 +483,12 @@ int GameScriptObject::trigAllScripts(Scripting::TrigId trigId, ScriptParams &par { NOT_NULL(m_owner); - if (JavaLibrary::instance() == nullptr) + if (JavaLibrary::instance() == NULL) return SCRIPT_CONTINUE; -// if (m_javaId == nullptr && m_owner != nullptr && m_owner->getNetworkId().getValue() != 0) +// if (m_javaId == NULL && m_owner != NULL && m_owner->getNetworkId().getValue() != 0) // { -// if (JavaLibrary::instance() != nullptr) +// if (JavaLibrary::instance() != NULL) // m_javaId = JavaLibrary::getObjId(m_owner->getNetworkId()); // } @@ -497,7 +497,7 @@ int GameScriptObject::trigAllScripts(Scripting::TrigId trigId, ScriptParams &par //Authoritative check temporarily removed because some triggers aren't being called //because the setAuth message hasn't come in yet from Central on load. - if (m_owner == nullptr) //@todo FIX THIS HACK || !m_owner->isAuthoritative()) + if (m_owner == NULL) //@todo FIX THIS HACK || !m_owner->isAuthoritative()) return SCRIPT_CONTINUE; if(!m_owner->isAuthoritative()) @@ -506,7 +506,7 @@ int GameScriptObject::trigAllScripts(Scripting::TrigId trigId, ScriptParams &par Archive::put(paramArchive, params); MessageQueueScriptTrigger * data = new MessageQueueScriptTrigger(static_cast(trigId), paramArchive); ServerController * controller = dynamic_cast(m_owner->getController()); - if(controller != nullptr) + if(controller != NULL) { controller->appendMessage( CM_scriptTrigger, @@ -557,13 +557,13 @@ int GameScriptObject::trigAllScripts(Scripting::TrigId trigId, ScriptParams &par */ int GameScriptObject::trigOneScript(const std::string& scriptName, Scripting::TrigId trigId, ScriptParams ¶ms) const { - if (JavaLibrary::instance() == nullptr) + if (JavaLibrary::instance() == NULL) return SCRIPT_CONTINUE; if (m_pauseScripting) return SCRIPT_CONTINUE; - if (m_owner == nullptr /*|| !m_owner->isAuthoritative()*/) + if (m_owner == NULL /*|| !m_owner->isAuthoritative()*/) return SCRIPT_OVERRIDE; if (!m_owner->isAuthoritative() && (trigId != Scripting::TRIG_ATTACH && @@ -607,7 +607,7 @@ int GameScriptObject::trigOneScript(const std::string& scriptName, Scripting::Tr int GameScriptObject::trigScriptFromConsole(const Scripting::TrigId trigId, const std::string &scriptName, const StringVector_t &args) const { - if (JavaLibrary::instance() == nullptr) + if (JavaLibrary::instance() == NULL) { LOG("ScriptInvestigation", ("Returning script continue from console trigger request because there is no JavaLibrary instance\n")); return SCRIPT_CONTINUE; @@ -619,9 +619,9 @@ int GameScriptObject::trigScriptFromConsole(const Scripting::TrigId trigId, return SCRIPT_CONTINUE; } - if (m_owner == nullptr ) + if (m_owner == NULL ) { - LOG("ScriptInvestigation", ("Returning script override from console trigger request becuase m_owner is nullptr\n")); + LOG("ScriptInvestigation", ("Returning script override from console trigger request becuase m_owner is null\n")); return SCRIPT_OVERRIDE; } @@ -660,14 +660,14 @@ int GameScriptObject::trigScriptFromConsole(const Scripting::TrigId trigId, bool GameScriptObject::handleMessage(const std::string &messageName, const ScriptDictionaryPtr & data) { - if (JavaLibrary::instance() == nullptr) + if (JavaLibrary::instance() == NULL) { WARNING_STRICT_FATAL(true, ("(messageToFailure) GameScriptObject::handleMessage got message " "when Java not running")); return true; } - if (getOwner() == nullptr) + if (getOwner() == NULL) { WARNING_STRICT_FATAL(true, ("(messageToFailure) GameScriptObject::handleMessage got message " "with no owner")); @@ -703,7 +703,7 @@ bool GameScriptObject::handleMessage(const std::string &messageName, const std:: { ScriptDictionaryPtr dictionary; - if (JavaLibrary::instance() == nullptr) + if (JavaLibrary::instance() == NULL) return true; if (m_pauseScripting) @@ -733,7 +733,7 @@ bool GameScriptObject::handleMessage(const std::string &messageName, const std:: */ int GameScriptObject::callScriptCommandHandler(std::string const &funcName, ScriptParams ¶ms) const { - if (JavaLibrary::instance() == nullptr) + if (JavaLibrary::instance() == NULL) return SCRIPT_CONTINUE; if (m_pauseScripting) @@ -757,7 +757,7 @@ int GameScriptObject::callScriptCommandHandler(std::string const &funcName, Scri */ int GameScriptObject::callScriptBuffHandler(std::string const &funcName, ScriptParams ¶ms) const { - if (JavaLibrary::instance() == nullptr) + if (JavaLibrary::instance() == NULL) return SCRIPT_CONTINUE; if (m_pauseScripting) @@ -825,7 +825,7 @@ void GameScriptObject::enumerateScripts(std::vector &scriptNames) c */ void GameScriptObject::makeScriptDictionary(const ScriptParams & params, ScriptDictionaryPtr & dictionary) { - if (JavaLibrary::instance() != nullptr) + if (JavaLibrary::instance() != NULL) { JavaDictionaryPtr jdp; JavaLibrary::instance()->convert(params, jdp); @@ -840,7 +840,7 @@ void GameScriptObject::makeScriptDictionary(const ScriptParams & params, ScriptD */ bool GameScriptObject::isScriptingEnabled(void) { - if (JavaLibrary::instance() != nullptr) + if (JavaLibrary::instance() != NULL) return true; return false; } // GameScriptObject::isScriptingEnabled @@ -854,7 +854,7 @@ bool GameScriptObject::isScriptingEnabled(void) */ bool GameScriptObject::reloadScript(const std::string& scriptName) { - if (JavaLibrary::instance() == nullptr) + if (JavaLibrary::instance() == NULL) return false; @@ -904,7 +904,7 @@ bool GameScriptObject::reloadScript(const std::string& scriptName) */ void GameScriptObject::enableLogging(bool enable) { - if (JavaLibrary::instance() != nullptr) + if (JavaLibrary::instance() != NULL) JavaLibrary::instance()->enableLogging(enable); } // GameScriptObject::enableLogging @@ -917,7 +917,7 @@ void GameScriptObject::enableLogging(bool enable) */ void GameScriptObject::enableNewJediTracking(bool enableTracking) { - if (JavaLibrary::instance() != nullptr) + if (JavaLibrary::instance() != NULL) JavaLibrary::instance()->enableNewJediTracking(enableTracking); } // GameScriptObject::enableNewJediTracking @@ -946,7 +946,7 @@ Scheduler & GameScriptObject::getScriptScheduler() void GameScriptObject::onStopWatching(ServerObject & subject) { - if (JavaLibrary::instance() == nullptr) + if (JavaLibrary::instance() == NULL) return; if (m_owner) @@ -959,7 +959,7 @@ void GameScriptObject::onStopWatching(ServerObject & subject) void GameScriptObject::onWatching(ServerObject & subject) { - if (JavaLibrary::instance() == nullptr) + if (JavaLibrary::instance() == NULL) return; if (m_owner) @@ -972,7 +972,7 @@ void GameScriptObject::onWatching(ServerObject & subject) void GameScriptObject::runOneScript(const std::string & scriptName, const std::string & methodName, const std::string & argTypes, ScriptParams & args) { - if (JavaLibrary::instance() != nullptr) + if (JavaLibrary::instance() != NULL) IGNORE_RETURN( JavaLibrary::instance()->runScript(NetworkId(), scriptName, methodName, argTypes, args) ); } @@ -994,7 +994,7 @@ std::string GameScriptObject::callScriptConsoleHandler(const std::string & scrip { static const std::string errorReturnString; - if (JavaLibrary::instance() != nullptr) + if (JavaLibrary::instance() != NULL) { return JavaLibrary::instance()->callScriptConsoleHandler(scriptName, methodName, argTypes, args); } @@ -1019,7 +1019,7 @@ void GameScriptObject::callSpaceClearOvert(const NetworkId &ship) std::string GameScriptObject::callDumpTargetInfo( NetworkId &id ) { - if( JavaLibrary::instance() != nullptr ) + if( JavaLibrary::instance() != NULL ) { return JavaLibrary::instance()->getObjectDumpInfo( id ); } @@ -1030,7 +1030,7 @@ std::string GameScriptObject::callDumpTargetInfo( NetworkId &id ) void GameScriptObject::setScriptVar(const std::string & name, int value) { - if (JavaLibrary::instance() == nullptr || m_owner == nullptr) + if (JavaLibrary::instance() == NULL || m_owner == NULL) return; JavaLibrary::setScriptVar(*m_owner, name, value); @@ -1040,7 +1040,7 @@ void GameScriptObject::setScriptVar(const std::string & name, int value) void GameScriptObject::setScriptVar(const std::string & name, float value) { - if (JavaLibrary::instance() == nullptr || m_owner == nullptr) + if (JavaLibrary::instance() == NULL || m_owner == NULL) return; JavaLibrary::setScriptVar(*m_owner, name, value); @@ -1050,7 +1050,7 @@ void GameScriptObject::setScriptVar(const std::string & name, float value) void GameScriptObject::setScriptVar(const std::string & name, const std::string & value) { - if (JavaLibrary::instance() == nullptr || m_owner == nullptr) + if (JavaLibrary::instance() == NULL || m_owner == NULL) return; JavaLibrary::setScriptVar(*m_owner, name, value); @@ -1060,7 +1060,7 @@ void GameScriptObject::setScriptVar(const std::string & name, const std::string void GameScriptObject::packAllScriptVarDeltas() { - if (JavaLibrary::instance() == nullptr) + if (JavaLibrary::instance() == NULL) return; JavaLibrary::packAllDeltaScriptVars(); @@ -1070,7 +1070,7 @@ void GameScriptObject::packAllScriptVarDeltas() void GameScriptObject::clearScriptVars() { - if (JavaLibrary::instance() == nullptr || m_owner == nullptr) + if (JavaLibrary::instance() == NULL || m_owner == NULL) return; JavaLibrary::clearScriptVars(*m_owner); @@ -1080,7 +1080,7 @@ void GameScriptObject::clearScriptVars() void GameScriptObject::packScriptVars(std::vector & target) const { - if (JavaLibrary::instance() == nullptr || m_owner == nullptr) + if (JavaLibrary::instance() == NULL || m_owner == NULL) return; JavaLibrary::packScriptVars(*m_owner, target); @@ -1090,7 +1090,7 @@ void GameScriptObject::packScriptVars(std::vector & target) const void GameScriptObject::unpackScriptVars(const std::vector & source) const { - if (JavaLibrary::instance() == nullptr || m_owner == nullptr) + if (JavaLibrary::instance() == NULL || m_owner == NULL) return; JavaLibrary::unpackScriptVars(*m_owner, source); @@ -1100,7 +1100,7 @@ void GameScriptObject::unpackScriptVars(const std::vector & source) const void GameScriptObject::unpackDeltaScriptVars(const std::vector & data) const { - if (JavaLibrary::instance() == nullptr || m_owner == nullptr) + if (JavaLibrary::instance() == NULL || m_owner == NULL) return; DEBUG_REPORT_LOG(! m_owner, ("A game script object received a request to unpack script var synchronization data, but it has no owner object!!! All GameScriptObjects MUST have owners!\n")); @@ -1238,18 +1238,18 @@ namespace Archive GameScriptObject * GameScriptObject::asGameScriptObject(Object * const object) { - ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; + ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; - return (serverObject != nullptr) ? serverObject->getScriptObject() : nullptr; + return (serverObject != NULL) ? serverObject->getScriptObject() : NULL; } // ---------------------------------------------------------------------- GameScriptObject const * GameScriptObject::asGameScriptObject(Object const * const object) { - ServerObject const * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; + ServerObject const * const serverObject = (object != NULL) ? object->asServerObject() : NULL; - return (serverObject != nullptr) ? serverObject->getScriptObject() : nullptr; + return (serverObject != NULL) ? serverObject->getScriptObject() : NULL; } // ====================================================================== diff --git a/engine/server/library/serverScript/src/shared/JNIWrappers.cpp b/engine/server/library/serverScript/src/shared/JNIWrappers.cpp index d958183a..d4746415 100755 --- a/engine/server/library/serverScript/src/shared/JNIWrappers.cpp +++ b/engine/server/library/serverScript/src/shared/JNIWrappers.cpp @@ -90,7 +90,7 @@ LocalRefPtr createNewObject(jclass clazz, jmethodID constructorID, ...) JavaStringPtr createNewString(const char * bytes) { - if (bytes != nullptr) + if (bytes != NULL) { JavaStringPtr result(new JavaString(JavaLibrary::getEnv()->NewStringUTF(bytes))); if (result->getValue() != 0) @@ -103,7 +103,7 @@ JavaStringPtr createNewString(const char * bytes) JavaStringPtr createNewString(const jchar * unicodeChars, jsize len) { - if (unicodeChars != nullptr && len >= 0) + if (unicodeChars != NULL && len >= 0) { JavaStringPtr result(new JavaString(JavaLibrary::getEnv()->NewString(unicodeChars, len))); if (result->getValue() != 0) @@ -902,7 +902,7 @@ LocalRef::LocalRef(jobject src) : LocalRef::~LocalRef() { - if (m_ref != 0 && JavaLibrary::getEnv() != nullptr) + if (m_ref != 0 && JavaLibrary::getEnv() != NULL) JavaLibrary::getEnv()->DeleteLocalRef(m_ref); m_ref = 0; } @@ -917,7 +917,7 @@ LocalArrayRef::LocalArrayRef(jarray src) : LocalArrayRef::~LocalArrayRef() { - if (m_ref != 0 && JavaLibrary::getEnv() != nullptr) + if (m_ref != 0 && JavaLibrary::getEnv() != NULL) JavaLibrary::getEnv()->DeleteLocalRef(m_ref); m_ref = 0; } @@ -932,7 +932,7 @@ LocalObjectArrayRef::LocalObjectArrayRef(jobjectArray src) : LocalObjectArrayRef::~LocalObjectArrayRef() { - if (m_ref != 0 && JavaLibrary::getEnv() != nullptr) + if (m_ref != 0 && JavaLibrary::getEnv() != NULL) JavaLibrary::getEnv()->DeleteLocalRef(m_ref); m_ref = 0; } @@ -1002,13 +1002,13 @@ LocalLongArrayRef::~LocalLongArrayRef() GlobalRef::GlobalRef(const LocalRefParam & src) : LocalRefParam(static_cast(0)) { - if (src.getValue() != 0 && JavaLibrary::getEnv() != nullptr) + if (src.getValue() != 0 && JavaLibrary::getEnv() != NULL) m_ref = JavaLibrary::getEnv()->NewGlobalRef(src.getValue()); } GlobalRef::~GlobalRef() { - if (m_ref != 0 && JavaLibrary::getEnv() != nullptr) + if (m_ref != 0 && JavaLibrary::getEnv() != NULL) JavaLibrary::getEnv()->DeleteGlobalRef(m_ref); m_ref = 0; } @@ -1019,13 +1019,13 @@ GlobalRef::~GlobalRef() GlobalArrayRef::GlobalArrayRef(const LocalObjectArrayRefParam & src) : LocalObjectArrayRefParam(static_cast(0)) { - if (src.getValue() != 0 && JavaLibrary::getEnv() != nullptr) + if (src.getValue() != 0 && JavaLibrary::getEnv() != NULL) m_ref = JavaLibrary::getEnv()->NewGlobalRef(src.getValue()); } GlobalArrayRef::~GlobalArrayRef() { - if (m_ref != 0 && JavaLibrary::getEnv() != nullptr) + if (m_ref != 0 && JavaLibrary::getEnv() != NULL) JavaLibrary::getEnv()->DeleteGlobalRef(m_ref); m_ref = 0; } @@ -1048,10 +1048,10 @@ JavaStringParam::~JavaStringParam() int JavaStringParam::fillBuffer(char * buffer, int size) const { - if (m_ref != 0 && buffer != nullptr && JavaLibrary::getEnv() != nullptr) + if (m_ref != 0 && buffer != NULL && JavaLibrary::getEnv() != NULL) { // Get the number of storage bytes required to convert this Java string into a UTF-8 string. - // Include the terminating nullptr byte in the required buffer size. + // Include the terminating null byte in the required buffer size. int requiredBufferSize = JavaLibrary::getEnv()->GetStringUTFLength(static_cast(m_ref)) + 1; if (requiredBufferSize <= size) { @@ -1059,7 +1059,7 @@ int JavaStringParam::fillBuffer(char * buffer, int size) const JavaLibrary::getEnv()->GetStringUTFRegion(static_cast(m_ref), 0, stringLength, buffer); - // Null terminate the string. requiredBufferSize already includes the byte count for the nullptr terminator. + // Null terminate the string. requiredBufferSize already includes the byte count for the null terminator. buffer[requiredBufferSize - 1] = '\0'; return requiredBufferSize; @@ -1077,7 +1077,7 @@ JavaString::JavaString(jstring src) : } JavaString::JavaString(const char * src) : - JavaStringParam(JavaLibrary::getEnv()->NewStringUTF(src != nullptr ? src : "")) + JavaStringParam(JavaLibrary::getEnv()->NewStringUTF(src != NULL ? src : "")) { } @@ -1093,7 +1093,7 @@ JavaString::JavaString(const Unicode::String & src) : JavaString::~JavaString() { - if (m_ref != 0 && JavaLibrary::getEnv() != nullptr) + if (m_ref != 0 && JavaLibrary::getEnv() != NULL) JavaLibrary::getEnv()->DeleteLocalRef(m_ref); m_ref = 0; } diff --git a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp index 0cbc73ac..39dfced2 100755 --- a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp +++ b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp @@ -70,7 +70,7 @@ using namespace JNIWrappersNamespace; #define GET_METHOD(var, clazz, name, sig) var = ms_env->GetMethodID(clazz, name, sig); if (ms_env->ExceptionCheck()) { ms_env->ExceptionDescribe(); WARNING(true, ("Unable to find Java method "#name" for class "#clazz)); return false; } #define GET_STATIC_METHOD(var, clazz, name, sig) var = ms_env->GetStaticMethodID(clazz, name, sig); if (ms_env->ExceptionCheck()) { ms_env->ExceptionDescribe(); WARNING(true, ("Unable to find Java static method "#name" for class "#clazz)); return false; } -#define FREE_CLASS(var) if (ms_env != nullptr && var != nullptr) { ms_env->DeleteGlobalRef(var); var = nullptr; } +#define FREE_CLASS(var) if (ms_env != NULL && var != NULL) { ms_env->DeleteGlobalRef(var); var = NULL; } //======================================================================== // local constants @@ -377,203 +377,203 @@ namespace ScriptMethodsWorldInfoNamespace // class JavaLibrary static members //======================================================================== -JavaLibrary* JavaLibrary::ms_instance = nullptr; +JavaLibrary* JavaLibrary::ms_instance = NULL; int JavaLibrary::ms_javaVmType = JV_none; -//void* JavaLibrary::ms_libHandle = nullptr; -JavaVM* JavaLibrary::ms_jvm = nullptr; -JNIEnv* JavaLibrary::ms_env = nullptr; -Thread * JavaLibrary::m_initializerThread = nullptr; +//void* JavaLibrary::ms_libHandle = NULL; +JavaVM* JavaLibrary::ms_jvm = NULL; +JNIEnv* JavaLibrary::ms_env = NULL; +Thread * JavaLibrary::m_initializerThread = NULL; int JavaLibrary::ms_envCount = 0; int JavaLibrary::ms_currentRecursionCount = 0; bool JavaLibrary::ms_resetJava = false; -jclass JavaLibrary::ms_clsScriptEntry = nullptr; -jobject JavaLibrary::ms_scriptEntry = nullptr; -jmethodID JavaLibrary::ms_midScriptEntryGetOwnerContext = nullptr; -jmethodID JavaLibrary::ms_midScriptEntryEnableLogging = nullptr; -jmethodID JavaLibrary::ms_midScriptEntryEnableNewJediTracking = nullptr; -jmethodID JavaLibrary::ms_midScriptEntryGetFreeMem = nullptr; -jclass JavaLibrary::ms_clsObject = nullptr; -jclass JavaLibrary::ms_clsClass = nullptr; -jmethodID JavaLibrary::ms_midClassGetName = nullptr; -jmethodID JavaLibrary::ms_midClassGetMethods = nullptr; -jclass JavaLibrary::ms_clsMethod = nullptr; -jmethodID JavaLibrary::ms_midMethodGetName = nullptr; -jclass JavaLibrary::ms_clsBoolean = nullptr; -jclass JavaLibrary::ms_clsBooleanArray = nullptr; -jmethodID JavaLibrary::ms_midBoolean = nullptr; -jmethodID JavaLibrary::ms_midBooleanBooleanValue = nullptr; -jclass JavaLibrary::ms_clsInteger = nullptr; -jclass JavaLibrary::ms_clsIntegerArray = nullptr; -jmethodID JavaLibrary::ms_midInteger = nullptr; -jmethodID JavaLibrary::ms_midIntegerIntValue = nullptr; -jclass JavaLibrary::ms_clsModifiableInt = nullptr; -jmethodID JavaLibrary::ms_midModifiableInt = nullptr; -jfieldID JavaLibrary::ms_fidModifiableIntData = nullptr; -jclass JavaLibrary::ms_clsFloat = nullptr; -jclass JavaLibrary::ms_clsFloatArray = nullptr; -jmethodID JavaLibrary::ms_midFloat = nullptr; -jmethodID JavaLibrary::ms_midFloatFloatValue = nullptr; -jclass JavaLibrary::ms_clsModifiableFloat = nullptr; -jmethodID JavaLibrary::ms_midModifiableFloat = nullptr; -jfieldID JavaLibrary::ms_fidModifiableFloatData = nullptr; -jclass JavaLibrary::ms_clsString = nullptr; -jclass JavaLibrary::ms_clsStringArray = nullptr; -jclass JavaLibrary::ms_clsMap = nullptr; -jmethodID JavaLibrary::ms_midMapPut = nullptr; -jmethodID JavaLibrary::ms_midMapGet = nullptr; -jclass JavaLibrary::ms_clsHashtable = nullptr; -jmethodID JavaLibrary::ms_midHashtable = nullptr; -jclass JavaLibrary::ms_clsThrowable = nullptr; -jclass JavaLibrary::ms_clsError = nullptr; -jclass JavaLibrary::ms_clsStackOverflowError = nullptr; -jmethodID JavaLibrary::ms_midThrowableGetMessage = nullptr; -jclass JavaLibrary::ms_clsThread = nullptr; -jmethodID JavaLibrary::ms_midThreadDumpStack = nullptr; -jclass JavaLibrary::ms_clsInternalScriptError = nullptr; -jclass JavaLibrary::ms_clsInternalScriptSeriousError = nullptr; -jfieldID JavaLibrary::ms_fidInternalScriptSeriousErrorError = nullptr; -jclass JavaLibrary::ms_clsDictionary = nullptr; -jmethodID JavaLibrary::ms_midDictionary = nullptr; -jmethodID JavaLibrary::ms_midDictionaryPack = nullptr; -jmethodID JavaLibrary::ms_midDictionaryUnpack = nullptr; -jmethodID JavaLibrary::ms_midDictionaryKeys = nullptr; -jmethodID JavaLibrary::ms_midDictionaryValues = nullptr; -jmethodID JavaLibrary::ms_midDictionaryPut = nullptr; -jmethodID JavaLibrary::ms_midDictionaryPutInt = nullptr; -jmethodID JavaLibrary::ms_midDictionaryPutFloat = nullptr; -jmethodID JavaLibrary::ms_midDictionaryPutBool = nullptr; -jmethodID JavaLibrary::ms_midDictionaryGet = nullptr; -jclass JavaLibrary::ms_clsCollection = nullptr; -jmethodID JavaLibrary::ms_midCollectionToArray = nullptr; -jclass JavaLibrary::ms_clsEnumeration = nullptr; -jmethodID JavaLibrary::ms_midEnumerationHasMoreElements = nullptr; -jmethodID JavaLibrary::ms_midEnumerationNextElement = nullptr; -jclass JavaLibrary::ms_clsBaseClassRangeInfo = nullptr; -jfieldID JavaLibrary::ms_fidBaseClassRangeInfoMinRange = nullptr; -jfieldID JavaLibrary::ms_fidBaseClassRangeInfoMaxRange = nullptr; -jclass JavaLibrary::ms_clsBaseClassAttackerResults = nullptr; -jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsId = nullptr; -jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsWeapon = nullptr; -jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsPosture = nullptr; -jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsTrailBits = nullptr; -jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsClientEffectId = nullptr; -jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsActionName = nullptr; -jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsUseLocation = nullptr; -jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsTargetLocation = nullptr; -jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsTargetCell = nullptr; -jclass JavaLibrary::ms_clsBaseClassDefenderResults = nullptr; -jfieldID JavaLibrary::ms_fidBaseClassDefenderResultsId = nullptr; -jfieldID JavaLibrary::ms_fidBaseClassDefenderResultsPosture = nullptr; -jfieldID JavaLibrary::ms_fidBaseClassDefenderResultsResult = nullptr; -jfieldID JavaLibrary::ms_fidBaseClassDefenderResultsClientEffectId = nullptr; -jfieldID JavaLibrary::ms_fidBaseClassDefenderResultsHitLocation = nullptr; -jfieldID JavaLibrary::ms_fidBaseClassDefenderDamageAmount = nullptr; -jclass JavaLibrary::ms_clsDynamicVariable = nullptr; -jfieldID JavaLibrary::ms_fidDynamicVariableName = nullptr; -jfieldID JavaLibrary::ms_fidDynamicVariableData = nullptr; -jmethodID JavaLibrary::ms_midDynamicVariableInt = nullptr; -jmethodID JavaLibrary::ms_midDynamicVariableIntArray = nullptr; -jmethodID JavaLibrary::ms_midDynamicVariableFloat = nullptr; -jmethodID JavaLibrary::ms_midDynamicVariableFloatArray = nullptr; -jmethodID JavaLibrary::ms_midDynamicVariableString = nullptr; -jmethodID JavaLibrary::ms_midDynamicVariableStringArray = nullptr; -jmethodID JavaLibrary::ms_midDynamicVariableObjId = nullptr; -jmethodID JavaLibrary::ms_midDynamicVariableObjIdArray = nullptr; -jmethodID JavaLibrary::ms_midDynamicVariableLocation = nullptr; -jmethodID JavaLibrary::ms_midDynamicVariableLocationArray = nullptr; -jclass JavaLibrary::ms_clsDynamicVariableList = nullptr; -jmethodID JavaLibrary::ms_midDynamicVariableList = nullptr; -jmethodID JavaLibrary::ms_midDynamicVariableListSet = nullptr; -jmethodID JavaLibrary::ms_midDynamicVariableListSetInt = nullptr; -jmethodID JavaLibrary::ms_midDynamicVariableListSetIntArray = nullptr; -jmethodID JavaLibrary::ms_midDynamicVariableListSetFloat = nullptr; -jmethodID JavaLibrary::ms_midDynamicVariableListSetFloatArray = nullptr; -jmethodID JavaLibrary::ms_midDynamicVariableListSetString = nullptr; -jmethodID JavaLibrary::ms_midDynamicVariableListSetStringArray = nullptr; -jmethodID JavaLibrary::ms_midDynamicVariableListSetObjId = nullptr; -jmethodID JavaLibrary::ms_midDynamicVariableListSetObjIdArray = nullptr; -jmethodID JavaLibrary::ms_midDynamicVariableListSetLocation = nullptr; -jmethodID JavaLibrary::ms_midDynamicVariableListSetLocationArray = nullptr; -jmethodID JavaLibrary::ms_midDynamicVariableListSetStringId = nullptr; -jmethodID JavaLibrary::ms_midDynamicVariableListSetStringIdArray = nullptr; -jmethodID JavaLibrary::ms_midDynamicVariableListSetTransform = nullptr; -jmethodID JavaLibrary::ms_midDynamicVariableListSetTransformArray = nullptr; -jmethodID JavaLibrary::ms_midDynamicVariableListSetVector = nullptr; -jmethodID JavaLibrary::ms_midDynamicVariableListSetVectorArray = nullptr; -jclass JavaLibrary::ms_clsObjId = nullptr; -jclass JavaLibrary::ms_clsObjIdArray = nullptr; -jmethodID JavaLibrary::ms_midObjIdGetValue = nullptr; -jmethodID JavaLibrary::ms_midObjIdGetObjId = nullptr; -jmethodID JavaLibrary::ms_midObjIdClearObjId = nullptr; -jmethodID JavaLibrary::ms_midObjIdFlagDestroyed = nullptr; -jmethodID JavaLibrary::ms_midObjIdSetAuthoritative = nullptr; -jmethodID JavaLibrary::ms_midObjIdSetLoaded = nullptr; -jmethodID JavaLibrary::ms_midObjIdSetInitialized = nullptr; -jmethodID JavaLibrary::ms_midObjIdSetLoggedIn = nullptr; -jmethodID JavaLibrary::ms_midObjIdPackAllDeltaScriptVars = nullptr; -jmethodID JavaLibrary::ms_midObjIdSetScriptVarInt = nullptr; -jmethodID JavaLibrary::ms_midObjIdSetScriptVarFloat = nullptr; -jmethodID JavaLibrary::ms_midObjIdSetScriptVarString = nullptr; -jmethodID JavaLibrary::ms_midObjIdClearScriptVars = nullptr; -jmethodID JavaLibrary::ms_midObjIdPackScriptVars = nullptr; -jmethodID JavaLibrary::ms_midObjIdUnpackDeltaScriptVars = nullptr; -jmethodID JavaLibrary::ms_midObjIdUnpackScriptVars = nullptr; -jmethodID JavaLibrary::ms_midObjIdAttachScript = nullptr; -jmethodID JavaLibrary::ms_midObjIdAttachScripts = nullptr; -jmethodID JavaLibrary::ms_midObjIdDetachScript = nullptr; -jmethodID JavaLibrary::ms_midObjIdDetachAllScripts = nullptr; -jclass JavaLibrary::ms_clsStringId = nullptr; -jmethodID JavaLibrary::ms_midStringId = nullptr; -jclass JavaLibrary::ms_clsStringIdArray = nullptr; -jfieldID JavaLibrary::ms_fidStringIdTable = nullptr; -jfieldID JavaLibrary::ms_fidStringIdAsciiId = nullptr; -jfieldID JavaLibrary::ms_fidStringIdIndexId = nullptr; -jclass JavaLibrary::ms_clsModifiableStringId = nullptr; -jclass JavaLibrary::ms_clsAttribute = nullptr; -jmethodID JavaLibrary::ms_midAttribute = nullptr; -jfieldID JavaLibrary::ms_fidAttributeType = nullptr; -jfieldID JavaLibrary::ms_fidAttributeValue = nullptr; -jclass JavaLibrary::ms_clsAttribMod = nullptr; -jmethodID JavaLibrary::ms_midAttribMod = nullptr; -jfieldID JavaLibrary::ms_fidAttribModName = nullptr; -jfieldID JavaLibrary::ms_fidAttribModSkill = nullptr; -jfieldID JavaLibrary::ms_fidAttribModType = nullptr; -jfieldID JavaLibrary::ms_fidAttribModValue = nullptr; -jfieldID JavaLibrary::ms_fidAttribModTime = nullptr; -jfieldID JavaLibrary::ms_fidAttribModAttack = nullptr; -jfieldID JavaLibrary::ms_fidAttribModDecay = nullptr; -jfieldID JavaLibrary::ms_fidAttribModFlags = nullptr; -jclass JavaLibrary::ms_clsMentalState = nullptr; -jmethodID JavaLibrary::ms_midMentalState = nullptr; -jfieldID JavaLibrary::ms_fidMentalStateType = nullptr; -jfieldID JavaLibrary::ms_fidMentalStateValue = nullptr; -jclass JavaLibrary::ms_clsMentalStateMod = nullptr; -jmethodID JavaLibrary::ms_midMentalStateMod = nullptr; -jfieldID JavaLibrary::ms_fidMentalStateModType = nullptr; -jfieldID JavaLibrary::ms_fidMentalStateModValue = nullptr; -jfieldID JavaLibrary::ms_fidMentalStateModTime = nullptr; -jfieldID JavaLibrary::ms_fidMentalStateModAttack = nullptr; -jfieldID JavaLibrary::ms_fidMentalStateModDecay = nullptr; -jclass JavaLibrary::ms_clsLocation = nullptr; -jclass JavaLibrary::ms_clsLocationArray = nullptr; -jfieldID JavaLibrary::ms_fidLocationX = nullptr; -jfieldID JavaLibrary::ms_fidLocationY = nullptr; -jfieldID JavaLibrary::ms_fidLocationZ = nullptr; -jfieldID JavaLibrary::ms_fidLocationArea = nullptr; -jfieldID JavaLibrary::ms_fidLocationCell = nullptr; -jmethodID JavaLibrary::ms_midRunOne = nullptr; -jmethodID JavaLibrary::ms_midRunAll = nullptr; -jmethodID JavaLibrary::ms_midCallMessages = nullptr; -jmethodID JavaLibrary::ms_midRunConsoleHandler = nullptr; -jmethodID JavaLibrary::ms_midUnload = nullptr; -jmethodID JavaLibrary::ms_midGetClass = nullptr; -jmethodID JavaLibrary::ms_midGetScriptFunctions = nullptr; -jclass JavaLibrary::ms_clsMenuInfo = nullptr; -jmethodID JavaLibrary::ms_midMenuInfo = nullptr; -jmethodID JavaLibrary::ms_midMenuInfoSetMenuItemsInternal = nullptr; -jmethodID JavaLibrary::ms_midMenuInfoGetMenuItemsInternal = nullptr; -jclass JavaLibrary::ms_clsMenuInfoData = nullptr; -jmethodID JavaLibrary::ms_midMenuInfoData = nullptr; +jclass JavaLibrary::ms_clsScriptEntry = NULL; +jobject JavaLibrary::ms_scriptEntry = NULL; +jmethodID JavaLibrary::ms_midScriptEntryGetOwnerContext = NULL; +jmethodID JavaLibrary::ms_midScriptEntryEnableLogging = NULL; +jmethodID JavaLibrary::ms_midScriptEntryEnableNewJediTracking = NULL; +jmethodID JavaLibrary::ms_midScriptEntryGetFreeMem = NULL; +jclass JavaLibrary::ms_clsObject = NULL; +jclass JavaLibrary::ms_clsClass = NULL; +jmethodID JavaLibrary::ms_midClassGetName = NULL; +jmethodID JavaLibrary::ms_midClassGetMethods = NULL; +jclass JavaLibrary::ms_clsMethod = NULL; +jmethodID JavaLibrary::ms_midMethodGetName = NULL; +jclass JavaLibrary::ms_clsBoolean = NULL; +jclass JavaLibrary::ms_clsBooleanArray = NULL; +jmethodID JavaLibrary::ms_midBoolean = NULL; +jmethodID JavaLibrary::ms_midBooleanBooleanValue = NULL; +jclass JavaLibrary::ms_clsInteger = NULL; +jclass JavaLibrary::ms_clsIntegerArray = NULL; +jmethodID JavaLibrary::ms_midInteger = NULL; +jmethodID JavaLibrary::ms_midIntegerIntValue = NULL; +jclass JavaLibrary::ms_clsModifiableInt = NULL; +jmethodID JavaLibrary::ms_midModifiableInt = NULL; +jfieldID JavaLibrary::ms_fidModifiableIntData = NULL; +jclass JavaLibrary::ms_clsFloat = NULL; +jclass JavaLibrary::ms_clsFloatArray = NULL; +jmethodID JavaLibrary::ms_midFloat = NULL; +jmethodID JavaLibrary::ms_midFloatFloatValue = NULL; +jclass JavaLibrary::ms_clsModifiableFloat = NULL; +jmethodID JavaLibrary::ms_midModifiableFloat = NULL; +jfieldID JavaLibrary::ms_fidModifiableFloatData = NULL; +jclass JavaLibrary::ms_clsString = NULL; +jclass JavaLibrary::ms_clsStringArray = NULL; +jclass JavaLibrary::ms_clsMap = NULL; +jmethodID JavaLibrary::ms_midMapPut = NULL; +jmethodID JavaLibrary::ms_midMapGet = NULL; +jclass JavaLibrary::ms_clsHashtable = NULL; +jmethodID JavaLibrary::ms_midHashtable = NULL; +jclass JavaLibrary::ms_clsThrowable = NULL; +jclass JavaLibrary::ms_clsError = NULL; +jclass JavaLibrary::ms_clsStackOverflowError = NULL; +jmethodID JavaLibrary::ms_midThrowableGetMessage = NULL; +jclass JavaLibrary::ms_clsThread = NULL; +jmethodID JavaLibrary::ms_midThreadDumpStack = NULL; +jclass JavaLibrary::ms_clsInternalScriptError = NULL; +jclass JavaLibrary::ms_clsInternalScriptSeriousError = NULL; +jfieldID JavaLibrary::ms_fidInternalScriptSeriousErrorError = NULL; +jclass JavaLibrary::ms_clsDictionary = NULL; +jmethodID JavaLibrary::ms_midDictionary = NULL; +jmethodID JavaLibrary::ms_midDictionaryPack = NULL; +jmethodID JavaLibrary::ms_midDictionaryUnpack = NULL; +jmethodID JavaLibrary::ms_midDictionaryKeys = NULL; +jmethodID JavaLibrary::ms_midDictionaryValues = NULL; +jmethodID JavaLibrary::ms_midDictionaryPut = NULL; +jmethodID JavaLibrary::ms_midDictionaryPutInt = NULL; +jmethodID JavaLibrary::ms_midDictionaryPutFloat = NULL; +jmethodID JavaLibrary::ms_midDictionaryPutBool = NULL; +jmethodID JavaLibrary::ms_midDictionaryGet = NULL; +jclass JavaLibrary::ms_clsCollection = NULL; +jmethodID JavaLibrary::ms_midCollectionToArray = NULL; +jclass JavaLibrary::ms_clsEnumeration = NULL; +jmethodID JavaLibrary::ms_midEnumerationHasMoreElements = NULL; +jmethodID JavaLibrary::ms_midEnumerationNextElement = NULL; +jclass JavaLibrary::ms_clsBaseClassRangeInfo = NULL; +jfieldID JavaLibrary::ms_fidBaseClassRangeInfoMinRange = NULL; +jfieldID JavaLibrary::ms_fidBaseClassRangeInfoMaxRange = NULL; +jclass JavaLibrary::ms_clsBaseClassAttackerResults = NULL; +jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsId = NULL; +jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsWeapon = NULL; +jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsPosture = NULL; +jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsTrailBits = NULL; +jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsClientEffectId = NULL; +jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsActionName = NULL; +jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsUseLocation = NULL; +jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsTargetLocation = NULL; +jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsTargetCell = NULL; +jclass JavaLibrary::ms_clsBaseClassDefenderResults = NULL; +jfieldID JavaLibrary::ms_fidBaseClassDefenderResultsId = NULL; +jfieldID JavaLibrary::ms_fidBaseClassDefenderResultsPosture = NULL; +jfieldID JavaLibrary::ms_fidBaseClassDefenderResultsResult = NULL; +jfieldID JavaLibrary::ms_fidBaseClassDefenderResultsClientEffectId = NULL; +jfieldID JavaLibrary::ms_fidBaseClassDefenderResultsHitLocation = NULL; +jfieldID JavaLibrary::ms_fidBaseClassDefenderDamageAmount = NULL; +jclass JavaLibrary::ms_clsDynamicVariable = NULL; +jfieldID JavaLibrary::ms_fidDynamicVariableName = NULL; +jfieldID JavaLibrary::ms_fidDynamicVariableData = NULL; +jmethodID JavaLibrary::ms_midDynamicVariableInt = NULL; +jmethodID JavaLibrary::ms_midDynamicVariableIntArray = NULL; +jmethodID JavaLibrary::ms_midDynamicVariableFloat = NULL; +jmethodID JavaLibrary::ms_midDynamicVariableFloatArray = NULL; +jmethodID JavaLibrary::ms_midDynamicVariableString = NULL; +jmethodID JavaLibrary::ms_midDynamicVariableStringArray = NULL; +jmethodID JavaLibrary::ms_midDynamicVariableObjId = NULL; +jmethodID JavaLibrary::ms_midDynamicVariableObjIdArray = NULL; +jmethodID JavaLibrary::ms_midDynamicVariableLocation = NULL; +jmethodID JavaLibrary::ms_midDynamicVariableLocationArray = NULL; +jclass JavaLibrary::ms_clsDynamicVariableList = NULL; +jmethodID JavaLibrary::ms_midDynamicVariableList = NULL; +jmethodID JavaLibrary::ms_midDynamicVariableListSet = NULL; +jmethodID JavaLibrary::ms_midDynamicVariableListSetInt = NULL; +jmethodID JavaLibrary::ms_midDynamicVariableListSetIntArray = NULL; +jmethodID JavaLibrary::ms_midDynamicVariableListSetFloat = NULL; +jmethodID JavaLibrary::ms_midDynamicVariableListSetFloatArray = NULL; +jmethodID JavaLibrary::ms_midDynamicVariableListSetString = NULL; +jmethodID JavaLibrary::ms_midDynamicVariableListSetStringArray = NULL; +jmethodID JavaLibrary::ms_midDynamicVariableListSetObjId = NULL; +jmethodID JavaLibrary::ms_midDynamicVariableListSetObjIdArray = NULL; +jmethodID JavaLibrary::ms_midDynamicVariableListSetLocation = NULL; +jmethodID JavaLibrary::ms_midDynamicVariableListSetLocationArray = NULL; +jmethodID JavaLibrary::ms_midDynamicVariableListSetStringId = NULL; +jmethodID JavaLibrary::ms_midDynamicVariableListSetStringIdArray = NULL; +jmethodID JavaLibrary::ms_midDynamicVariableListSetTransform = NULL; +jmethodID JavaLibrary::ms_midDynamicVariableListSetTransformArray = NULL; +jmethodID JavaLibrary::ms_midDynamicVariableListSetVector = NULL; +jmethodID JavaLibrary::ms_midDynamicVariableListSetVectorArray = NULL; +jclass JavaLibrary::ms_clsObjId = NULL; +jclass JavaLibrary::ms_clsObjIdArray = NULL; +jmethodID JavaLibrary::ms_midObjIdGetValue = NULL; +jmethodID JavaLibrary::ms_midObjIdGetObjId = NULL; +jmethodID JavaLibrary::ms_midObjIdClearObjId = NULL; +jmethodID JavaLibrary::ms_midObjIdFlagDestroyed = NULL; +jmethodID JavaLibrary::ms_midObjIdSetAuthoritative = NULL; +jmethodID JavaLibrary::ms_midObjIdSetLoaded = NULL; +jmethodID JavaLibrary::ms_midObjIdSetInitialized = NULL; +jmethodID JavaLibrary::ms_midObjIdSetLoggedIn = NULL; +jmethodID JavaLibrary::ms_midObjIdPackAllDeltaScriptVars = NULL; +jmethodID JavaLibrary::ms_midObjIdSetScriptVarInt = NULL; +jmethodID JavaLibrary::ms_midObjIdSetScriptVarFloat = NULL; +jmethodID JavaLibrary::ms_midObjIdSetScriptVarString = NULL; +jmethodID JavaLibrary::ms_midObjIdClearScriptVars = NULL; +jmethodID JavaLibrary::ms_midObjIdPackScriptVars = NULL; +jmethodID JavaLibrary::ms_midObjIdUnpackDeltaScriptVars = NULL; +jmethodID JavaLibrary::ms_midObjIdUnpackScriptVars = NULL; +jmethodID JavaLibrary::ms_midObjIdAttachScript = NULL; +jmethodID JavaLibrary::ms_midObjIdAttachScripts = NULL; +jmethodID JavaLibrary::ms_midObjIdDetachScript = NULL; +jmethodID JavaLibrary::ms_midObjIdDetachAllScripts = NULL; +jclass JavaLibrary::ms_clsStringId = NULL; +jmethodID JavaLibrary::ms_midStringId = NULL; +jclass JavaLibrary::ms_clsStringIdArray = NULL; +jfieldID JavaLibrary::ms_fidStringIdTable = NULL; +jfieldID JavaLibrary::ms_fidStringIdAsciiId = NULL; +jfieldID JavaLibrary::ms_fidStringIdIndexId = NULL; +jclass JavaLibrary::ms_clsModifiableStringId = NULL; +jclass JavaLibrary::ms_clsAttribute = NULL; +jmethodID JavaLibrary::ms_midAttribute = NULL; +jfieldID JavaLibrary::ms_fidAttributeType = NULL; +jfieldID JavaLibrary::ms_fidAttributeValue = NULL; +jclass JavaLibrary::ms_clsAttribMod = NULL; +jmethodID JavaLibrary::ms_midAttribMod = NULL; +jfieldID JavaLibrary::ms_fidAttribModName = NULL; +jfieldID JavaLibrary::ms_fidAttribModSkill = NULL; +jfieldID JavaLibrary::ms_fidAttribModType = NULL; +jfieldID JavaLibrary::ms_fidAttribModValue = NULL; +jfieldID JavaLibrary::ms_fidAttribModTime = NULL; +jfieldID JavaLibrary::ms_fidAttribModAttack = NULL; +jfieldID JavaLibrary::ms_fidAttribModDecay = NULL; +jfieldID JavaLibrary::ms_fidAttribModFlags = NULL; +jclass JavaLibrary::ms_clsMentalState = NULL; +jmethodID JavaLibrary::ms_midMentalState = NULL; +jfieldID JavaLibrary::ms_fidMentalStateType = NULL; +jfieldID JavaLibrary::ms_fidMentalStateValue = NULL; +jclass JavaLibrary::ms_clsMentalStateMod = NULL; +jmethodID JavaLibrary::ms_midMentalStateMod = NULL; +jfieldID JavaLibrary::ms_fidMentalStateModType = NULL; +jfieldID JavaLibrary::ms_fidMentalStateModValue = NULL; +jfieldID JavaLibrary::ms_fidMentalStateModTime = NULL; +jfieldID JavaLibrary::ms_fidMentalStateModAttack = NULL; +jfieldID JavaLibrary::ms_fidMentalStateModDecay = NULL; +jclass JavaLibrary::ms_clsLocation = NULL; +jclass JavaLibrary::ms_clsLocationArray = NULL; +jfieldID JavaLibrary::ms_fidLocationX = NULL; +jfieldID JavaLibrary::ms_fidLocationY = NULL; +jfieldID JavaLibrary::ms_fidLocationZ = NULL; +jfieldID JavaLibrary::ms_fidLocationArea = NULL; +jfieldID JavaLibrary::ms_fidLocationCell = NULL; +jmethodID JavaLibrary::ms_midRunOne = NULL; +jmethodID JavaLibrary::ms_midRunAll = NULL; +jmethodID JavaLibrary::ms_midCallMessages = NULL; +jmethodID JavaLibrary::ms_midRunConsoleHandler = NULL; +jmethodID JavaLibrary::ms_midUnload = NULL; +jmethodID JavaLibrary::ms_midGetClass = NULL; +jmethodID JavaLibrary::ms_midGetScriptFunctions = NULL; +jclass JavaLibrary::ms_clsMenuInfo = NULL; +jmethodID JavaLibrary::ms_midMenuInfo = NULL; +jmethodID JavaLibrary::ms_midMenuInfoSetMenuItemsInternal = NULL; +jmethodID JavaLibrary::ms_midMenuInfoGetMenuItemsInternal = NULL; +jclass JavaLibrary::ms_clsMenuInfoData = NULL; +jmethodID JavaLibrary::ms_midMenuInfoData = NULL; jfieldID JavaLibrary::ms_fidMenuInfoDataId; jfieldID JavaLibrary::ms_fidMenuInfoDataParent; jfieldID JavaLibrary::ms_fidMenuInfoDataType; @@ -588,82 +588,82 @@ jclass JavaLibrary::ms_clsPalcolorCustomVar; jmethodID JavaLibrary::ms_midPalcolorCustomVar; jclass JavaLibrary::ms_clsColor; jmethodID JavaLibrary::ms_midColor; -jclass JavaLibrary::ms_clsDraftSchematic = nullptr; -jfieldID JavaLibrary::ms_fidDraftSchematicCategory = nullptr; -jfieldID JavaLibrary::ms_fidDraftSchematicComplexity = nullptr; -jfieldID JavaLibrary::ms_fidDraftSchematicSlots = nullptr; -jfieldID JavaLibrary::ms_fidDraftSchematicAttribs = nullptr; -jfieldID JavaLibrary::ms_fidDraftSchematicExperimentalAttribs = nullptr; -jfieldID JavaLibrary::ms_fidDraftSchematicCustomizations = nullptr; -jfieldID JavaLibrary::ms_fidDraftSchematicAttribMap = nullptr; -jfieldID JavaLibrary::ms_fidDraftSchematicObjectTemplateCreated = nullptr; -jfieldID JavaLibrary::ms_fidDraftSchematicScripts = nullptr; -jclass JavaLibrary::ms_clsDraftSchematicSlot = nullptr; -jfieldID JavaLibrary::ms_fidDraftSchematicSlotName = nullptr; -jfieldID JavaLibrary::ms_fidDraftSchematicSlotOption = nullptr; -jfieldID JavaLibrary::ms_fidDraftSchematicSlotIngredientType = nullptr; -jfieldID JavaLibrary::ms_fidDraftSchematicSlotIngredientName = nullptr; -jfieldID JavaLibrary::ms_fidDraftSchematicSlotIngredients = nullptr; -jfieldID JavaLibrary::ms_fidDraftSchematicSlotComplexity = nullptr; -jfieldID JavaLibrary::ms_fidDraftSchematicSlotAmountRequired = nullptr; -jfieldID JavaLibrary::ms_fidDraftSchematicSlotAppearance = nullptr; -jclass JavaLibrary::ms_clsDraftSchematicAttrib = nullptr; -jfieldID JavaLibrary::ms_fidDraftSchematicAttribName = nullptr; -jfieldID JavaLibrary::ms_fidDraftSchematicAttribMinValue = nullptr; -jfieldID JavaLibrary::ms_fidDraftSchematicAttribMaxValue = nullptr; -jfieldID JavaLibrary::ms_fidDraftSchematicAttribResourceMaxValue = nullptr; -jfieldID JavaLibrary::ms_fidDraftSchematicAttribCurrentValue = nullptr; -jclass JavaLibrary::ms_clsDraftSchematicSimpleIngredient = nullptr; -jfieldID JavaLibrary::ms_fidDraftSchematicSimpleIngredientIngredient = nullptr; -jfieldID JavaLibrary::ms_fidDraftSchematicSimpleIngredientCount = nullptr; -jfieldID JavaLibrary::ms_fidDraftSchematicSimpleIngredientSource = nullptr; -jfieldID JavaLibrary::ms_fidDraftSchematicSimpleIngredientXpType = nullptr; -jfieldID JavaLibrary::ms_fidDraftSchematicSimpleIngredientXpAmount = nullptr; -jclass JavaLibrary::ms_clsDraftSchematicCustom = nullptr; -jfieldID JavaLibrary::ms_fidDraftSchematicCustomName = nullptr; -jfieldID JavaLibrary::ms_fidDraftSchematicCustomValue = nullptr; -jfieldID JavaLibrary::ms_fidDraftSchematicCustomMinValue = nullptr; -jfieldID JavaLibrary::ms_fidDraftSchematicCustomMaxValue = nullptr; -//jfieldID JavaLibrary::ms_fidDraftSchematicCustomLocked = nullptr; -jclass JavaLibrary::ms_clsMapLocation = nullptr; -jmethodID JavaLibrary::ms_midMapLocation = nullptr; -jclass JavaLibrary::ms_clsRegion = nullptr; -jmethodID JavaLibrary::ms_midRegion = nullptr; -jfieldID JavaLibrary::ms_fidRegionName = nullptr; -jfieldID JavaLibrary::ms_fidRegionPlanet = nullptr; -jclass JavaLibrary::ms_clsCombatEngine = nullptr; -jclass JavaLibrary::ms_clsCombatEngineCombatantData = nullptr; -jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataPos = nullptr; -jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataWorldPos = nullptr; -jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataRadius = nullptr; -jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataIsCreature = nullptr; -jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataPosture = nullptr; -jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataLocomotion = nullptr; -jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataScriptMod = nullptr; -jclass JavaLibrary::ms_clsCombatEngineAttackerData = nullptr; -jfieldID JavaLibrary::ms_fidCombatEngineAttackerDataWeaponSkill = nullptr; -jfieldID JavaLibrary::ms_fidCombatEngineAttackerDataAims = nullptr; -jclass JavaLibrary::ms_clsCombatEngineDefenderData = nullptr; -jfieldID JavaLibrary::ms_fidCombatEngineDefenderDataCombatSkeleton = nullptr; -jfieldID JavaLibrary::ms_fidCombatEngineDefenderDataCover = nullptr; -jfieldID JavaLibrary::ms_fidCombatEngineDefenderDataHitLocationChances = nullptr; -jclass JavaLibrary::ms_clsCombatEngineWeaponData = nullptr; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataId = nullptr; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataMinDamage = nullptr; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataMaxDamage = nullptr; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataWeaponType = nullptr; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataAttackType = nullptr; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataDamageType = nullptr; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataElementalType = nullptr; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataElementalValue = nullptr; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataAttackSpeed = nullptr; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataWoundChance = nullptr; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataAccuracy = nullptr; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataMinRange = nullptr; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataMaxRange = nullptr; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataDamageRadius = nullptr; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataAttackCost = nullptr; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataIsDisabled = nullptr; +jclass JavaLibrary::ms_clsDraftSchematic = NULL; +jfieldID JavaLibrary::ms_fidDraftSchematicCategory = NULL; +jfieldID JavaLibrary::ms_fidDraftSchematicComplexity = NULL; +jfieldID JavaLibrary::ms_fidDraftSchematicSlots = NULL; +jfieldID JavaLibrary::ms_fidDraftSchematicAttribs = NULL; +jfieldID JavaLibrary::ms_fidDraftSchematicExperimentalAttribs = NULL; +jfieldID JavaLibrary::ms_fidDraftSchematicCustomizations = NULL; +jfieldID JavaLibrary::ms_fidDraftSchematicAttribMap = NULL; +jfieldID JavaLibrary::ms_fidDraftSchematicObjectTemplateCreated = NULL; +jfieldID JavaLibrary::ms_fidDraftSchematicScripts = NULL; +jclass JavaLibrary::ms_clsDraftSchematicSlot = NULL; +jfieldID JavaLibrary::ms_fidDraftSchematicSlotName = NULL; +jfieldID JavaLibrary::ms_fidDraftSchematicSlotOption = NULL; +jfieldID JavaLibrary::ms_fidDraftSchematicSlotIngredientType = NULL; +jfieldID JavaLibrary::ms_fidDraftSchematicSlotIngredientName = NULL; +jfieldID JavaLibrary::ms_fidDraftSchematicSlotIngredients = NULL; +jfieldID JavaLibrary::ms_fidDraftSchematicSlotComplexity = NULL; +jfieldID JavaLibrary::ms_fidDraftSchematicSlotAmountRequired = NULL; +jfieldID JavaLibrary::ms_fidDraftSchematicSlotAppearance = NULL; +jclass JavaLibrary::ms_clsDraftSchematicAttrib = NULL; +jfieldID JavaLibrary::ms_fidDraftSchematicAttribName = NULL; +jfieldID JavaLibrary::ms_fidDraftSchematicAttribMinValue = NULL; +jfieldID JavaLibrary::ms_fidDraftSchematicAttribMaxValue = NULL; +jfieldID JavaLibrary::ms_fidDraftSchematicAttribResourceMaxValue = NULL; +jfieldID JavaLibrary::ms_fidDraftSchematicAttribCurrentValue = NULL; +jclass JavaLibrary::ms_clsDraftSchematicSimpleIngredient = NULL; +jfieldID JavaLibrary::ms_fidDraftSchematicSimpleIngredientIngredient = NULL; +jfieldID JavaLibrary::ms_fidDraftSchematicSimpleIngredientCount = NULL; +jfieldID JavaLibrary::ms_fidDraftSchematicSimpleIngredientSource = NULL; +jfieldID JavaLibrary::ms_fidDraftSchematicSimpleIngredientXpType = NULL; +jfieldID JavaLibrary::ms_fidDraftSchematicSimpleIngredientXpAmount = NULL; +jclass JavaLibrary::ms_clsDraftSchematicCustom = NULL; +jfieldID JavaLibrary::ms_fidDraftSchematicCustomName = NULL; +jfieldID JavaLibrary::ms_fidDraftSchematicCustomValue = NULL; +jfieldID JavaLibrary::ms_fidDraftSchematicCustomMinValue = NULL; +jfieldID JavaLibrary::ms_fidDraftSchematicCustomMaxValue = NULL; +//jfieldID JavaLibrary::ms_fidDraftSchematicCustomLocked = NULL; +jclass JavaLibrary::ms_clsMapLocation = NULL; +jmethodID JavaLibrary::ms_midMapLocation = NULL; +jclass JavaLibrary::ms_clsRegion = NULL; +jmethodID JavaLibrary::ms_midRegion = NULL; +jfieldID JavaLibrary::ms_fidRegionName = NULL; +jfieldID JavaLibrary::ms_fidRegionPlanet = NULL; +jclass JavaLibrary::ms_clsCombatEngine = NULL; +jclass JavaLibrary::ms_clsCombatEngineCombatantData = NULL; +jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataPos = NULL; +jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataWorldPos = NULL; +jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataRadius = NULL; +jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataIsCreature = NULL; +jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataPosture = NULL; +jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataLocomotion = NULL; +jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataScriptMod = NULL; +jclass JavaLibrary::ms_clsCombatEngineAttackerData = NULL; +jfieldID JavaLibrary::ms_fidCombatEngineAttackerDataWeaponSkill = NULL; +jfieldID JavaLibrary::ms_fidCombatEngineAttackerDataAims = NULL; +jclass JavaLibrary::ms_clsCombatEngineDefenderData = NULL; +jfieldID JavaLibrary::ms_fidCombatEngineDefenderDataCombatSkeleton = NULL; +jfieldID JavaLibrary::ms_fidCombatEngineDefenderDataCover = NULL; +jfieldID JavaLibrary::ms_fidCombatEngineDefenderDataHitLocationChances = NULL; +jclass JavaLibrary::ms_clsCombatEngineWeaponData = NULL; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataId = NULL; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataMinDamage = NULL; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataMaxDamage = NULL; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataWeaponType = NULL; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataAttackType = NULL; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataDamageType = NULL; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataElementalType = NULL; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataElementalValue = NULL; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataAttackSpeed = NULL; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataWoundChance = NULL; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataAccuracy = NULL; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataMinRange = NULL; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataMaxRange = NULL; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataDamageRadius = NULL; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataAttackCost = NULL; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataIsDisabled = NULL; jclass JavaLibrary::ms_clsCombatEngineHitResult; jfieldID JavaLibrary::ms_fidCombatEngineHitResultSuccess; jfieldID JavaLibrary::ms_fidCombatEngineHitResultCritical; @@ -693,40 +693,40 @@ jfieldID JavaLibrary::ms_fidCombatEngineHitResultCritDamage; jfieldID JavaLibrary::ms_fidCombatEngineHitResultBlockedDamage; jfieldID JavaLibrary::ms_fidCombatEngineHitResultBlockingArmor; jfieldID JavaLibrary::ms_fidCombatEngineHitResultBleedingChance; -jclass JavaLibrary::ms_clsTransform = nullptr; -jclass JavaLibrary::ms_clsTransformArray = nullptr; -jmethodID JavaLibrary::ms_midTransform = nullptr; -jfieldID JavaLibrary::ms_fidTransformMatrix = nullptr; -jclass JavaLibrary::ms_clsVector = nullptr; -jclass JavaLibrary::ms_clsVectorArray = nullptr; -jfieldID JavaLibrary::ms_fidVectorX = nullptr; -jfieldID JavaLibrary::ms_fidVectorY = nullptr; -jfieldID JavaLibrary::ms_fidVectorZ = nullptr; -jclass JavaLibrary::ms_clsResourceDensity = nullptr; -jfieldID JavaLibrary::ms_fidResourceDensityResourceType = nullptr; -jfieldID JavaLibrary::ms_fidResourceDensityDensity = nullptr; -jclass JavaLibrary::ms_clsResourceAttribute = nullptr; -jfieldID JavaLibrary::ms_fidResourceAttributeName = nullptr; -jfieldID JavaLibrary::ms_fidResourceAttributeValue = nullptr; -jclass JavaLibrary::ms_clsLibrarySpaceTransition = nullptr; -jmethodID JavaLibrary::ms_midLibrarySpaceTransitionSetPlayerOvert = nullptr; -jmethodID JavaLibrary::ms_midLibrarySpaceTransitionClearOvertStatus = nullptr; +jclass JavaLibrary::ms_clsTransform = NULL; +jclass JavaLibrary::ms_clsTransformArray = NULL; +jmethodID JavaLibrary::ms_midTransform = NULL; +jfieldID JavaLibrary::ms_fidTransformMatrix = NULL; +jclass JavaLibrary::ms_clsVector = NULL; +jclass JavaLibrary::ms_clsVectorArray = NULL; +jfieldID JavaLibrary::ms_fidVectorX = NULL; +jfieldID JavaLibrary::ms_fidVectorY = NULL; +jfieldID JavaLibrary::ms_fidVectorZ = NULL; +jclass JavaLibrary::ms_clsResourceDensity = NULL; +jfieldID JavaLibrary::ms_fidResourceDensityResourceType = NULL; +jfieldID JavaLibrary::ms_fidResourceDensityDensity = NULL; +jclass JavaLibrary::ms_clsResourceAttribute = NULL; +jfieldID JavaLibrary::ms_fidResourceAttributeName = NULL; +jfieldID JavaLibrary::ms_fidResourceAttributeValue = NULL; +jclass JavaLibrary::ms_clsLibrarySpaceTransition = NULL; +jmethodID JavaLibrary::ms_midLibrarySpaceTransitionSetPlayerOvert = NULL; +jmethodID JavaLibrary::ms_midLibrarySpaceTransitionClearOvertStatus = NULL; ////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// // CS handlers -jclass JavaLibrary::ms_clsLibraryDump = nullptr; -jmethodID JavaLibrary::ms_midLibraryDumpDumpTargetInfo = nullptr; +jclass JavaLibrary::ms_clsLibraryDump = NULL; +jmethodID JavaLibrary::ms_midLibraryDumpDumpTargetInfo = NULL; -jclass JavaLibrary::ms_clsLibraryGMLib = nullptr; -jmethodID JavaLibrary::ms_midLibraryGMLibFreeze = nullptr; -jmethodID JavaLibrary::ms_midLibraryGMLibUnfreeze = nullptr; +jclass JavaLibrary::ms_clsLibraryGMLib = NULL; +jmethodID JavaLibrary::ms_midLibraryGMLibFreeze = NULL; +jmethodID JavaLibrary::ms_midLibraryGMLibUnfreeze = NULL; ////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// int JavaLibrary::ms_loaded = 0; -Semaphore * JavaLibrary::ms_shutdownJava = nullptr; +Semaphore * JavaLibrary::ms_shutdownJava = NULL; int JavaLibrary::GlobalInstances::ms_stringIdIndex = 0; int JavaLibrary::GlobalInstances::ms_attribModIndex = 0; @@ -765,7 +765,7 @@ void JavaLibrary::throwScriptException(char const * const format, ...) void JavaLibrary::throwScriptException(char const * const format, va_list va) { - DEBUG_FATAL(!ms_env, ("JavaLibrary::throwScriptException: ms_env is nullptr")); + DEBUG_FATAL(!ms_env, ("JavaLibrary::throwScriptException: ms_env is NULL")); if (ms_env) { char buffer[1024]; @@ -805,28 +805,28 @@ void JavaLibrary::fatalHandler(int signum) // it turns out that in some java crashes we don't even have 2 return // addresses, so check 0 and 1 just to make sure bool result2 = false; - void *crashAddress2a = nullptr; - void *crashAddress2b = nullptr; - void *crashAddress2c = nullptr; - void *frameAddressA = nullptr; - void *frameAddressB = nullptr; + void *crashAddress2a = NULL; + void *crashAddress2b = NULL; + void *crashAddress2c = NULL; + void *frameAddressA = NULL; + void *frameAddressB = NULL; uint32 frameAddressHigh = (reinterpret_cast(frameAddress) >> 16); crashAddress2a = __builtin_return_address(0); - if (crashAddress2a != nullptr) + if (crashAddress2a != NULL) { frameAddressA = __builtin_frame_address(1); - if (frameAddressA != nullptr && + if (frameAddressA != NULL && (reinterpret_cast(frameAddressA) >> 16 == frameAddressHigh)) { crashAddress2b = __builtin_return_address(1); - if (crashAddress2b != nullptr) + if (crashAddress2b != NULL) { frameAddressB = __builtin_frame_address(2); - if (frameAddressB != nullptr && + if (frameAddressB != NULL && (reinterpret_cast(frameAddressB) >> 16 == frameAddressHigh)) { crashAddress2c = __builtin_return_address(2); - if (crashAddress2c != nullptr) + if (crashAddress2c != NULL) { result2 = DebugHelp::lookupAddress(reinterpret_cast( crashAddress2c), lib2, file2, BUFLEN, line2); @@ -837,7 +837,7 @@ void JavaLibrary::fatalHandler(int signum) } bool javaCrash = true; - if ((result1 || result2) && strstr(lib1, "libjvm.so") == nullptr && strstr(lib2, "libjvm.so") == nullptr) + if ((result1 || result2) && strstr(lib1, "libjvm.so") == NULL && strstr(lib2, "libjvm.so") == NULL) { if (result1 && result2) { @@ -860,7 +860,7 @@ void JavaLibrary::fatalHandler(int signum) if (javaCrash) { fprintf(stderr, "I think I crashed in Java, calling the Java segfault hanlder.\n"); - IGNORE_RETURN(sigaction(SIGSEGV, &JavaSa, nullptr)); + IGNORE_RETURN(sigaction(SIGSEGV, &JavaSa, NULL)); IGNORE_RETURN(pthread_kill(pthread_self(), SIGSEGV)); } else @@ -868,11 +868,11 @@ void JavaLibrary::fatalHandler(int signum) // destroy Java threads // this pthread method is not in later versions of glibc as the kernel should handle the kill //pthread_kill_other_threads_np(); - ms_instance = nullptr; - ms_env = nullptr; - ms_jvm = nullptr; + ms_instance = NULL; + ms_env = NULL; + ms_jvm = NULL; // restore original signal handler and rethrow signal - IGNORE_RETURN(sigaction(SIGSEGV, &OrgSa, nullptr)); + IGNORE_RETURN(sigaction(SIGSEGV, &OrgSa, NULL)); IGNORE_RETURN(pthread_kill(pthread_self(), SIGSEGV)); } } @@ -888,7 +888,7 @@ JavaLibrary::JavaLibrary(void) { int i; - if (ms_instance != nullptr || ms_loaded != 0) + if (ms_instance != NULL || ms_loaded != 0) return; ms_shutdownJava = new Semaphore(); @@ -938,7 +938,7 @@ JavaLibrary::~JavaLibrary() { disconnectFromJava(); - if (ms_shutdownJava != nullptr) + if (ms_shutdownJava != NULL) { // tell the initialize thread to shut down if (ms_loaded > 0) @@ -948,10 +948,10 @@ JavaLibrary::~JavaLibrary() Os::sleep(100); } delete ms_shutdownJava; - ms_shutdownJava = nullptr; + ms_shutdownJava = NULL; } - ms_instance = nullptr; + ms_instance = NULL; } // JavaLibrary::~JavaLibrary //---------------------------------------------------------------------- @@ -961,12 +961,12 @@ JavaLibrary::~JavaLibrary() */ void JavaLibrary::install(void) { - if (ms_instance == nullptr) + if (ms_instance == NULL) { JavaLibrary *lib = new JavaLibrary; if (lib != ms_instance) { - if (ms_instance == nullptr) + if (ms_instance == NULL) { delete lib; if (ms_javaVmType != JV_none) @@ -985,10 +985,10 @@ void JavaLibrary::install(void) */ void JavaLibrary::remove(void) { - if (ms_instance != nullptr) + if (ms_instance != NULL) { JavaLibrary * temp = ms_instance; - ms_instance = nullptr; + ms_instance = NULL; delete temp; s_profileSections.clear(); } @@ -1010,7 +1010,7 @@ void JavaLibrary::initializeJavaThread() } const char *javaVMName = ConfigServerGame::getJavaVMName(); - if (javaVMName == nullptr || ( + if (javaVMName == NULL || ( strcmp(javaVMName, "none") != 0 && strcmp(javaVMName, "ibm") != 0 && strcmp(javaVMName, "sun") != 0 && @@ -1038,21 +1038,21 @@ void JavaLibrary::initializeJavaThread() #ifdef linux // get the default signal handler - IGNORE_RETURN(sigaction(SIGSEGV, nullptr, &OrgSa)); + IGNORE_RETURN(sigaction(SIGSEGV, NULL, &OrgSa)); if (ms_javaVmType == JV_ibm) { // check PATH to make sure that it has /usr/bin/java const char * env = getenv("PATH"); - const char * bin = nullptr; + const char * bin = NULL; int envlen = 0; - if (env != nullptr) + if (env != NULL) { bin = strstr(env, "/usr/java/bin"); envlen = strlen(env); } - if (bin == nullptr) + if (bin == NULL) { WARNING(true, ("/usr/java/bin not found in PATH which is needed for IBM Java VM. Adding it now")); char * tmpbuffer = new char[envlen + 128]; @@ -1065,18 +1065,18 @@ void JavaLibrary::initializeJavaThread() // check LD_LIBRARY_PATH for /usr/java/jre/bin and /usr/java/jre/bin/classic env = getenv("LD_LIBRARY_PATH"); - bin = nullptr; + bin = NULL; envlen = 0; - const char * classic = nullptr; - if (env != nullptr) + const char * classic = NULL; + if (env != NULL) { bin = strstr(env, "/usr/java/jre/bin"); classic = strstr(env, "/usr/java/jre/bin/classic"); - if (bin == classic && bin != nullptr) + if (bin == classic && bin != NULL) bin = strstr(classic + 1, "/usr/java/jre/bin"); envlen = strlen(env); } - if (bin == nullptr || classic == nullptr) + if (bin == NULL || classic == NULL) { WARNING(true, ("/usr/java/jre/bin or /usr/java/jre/bin/classic not found " "in LD_LIBRARY_PATH, needed for IBM Java VM. Adding them both now.")); @@ -1093,12 +1093,12 @@ void JavaLibrary::initializeJavaThread() #endif // linux // dynamically load the jni dll and JNI_CreateJavaVM - void * libHandle = nullptr; + void * libHandle = NULL; JNI_CREATEJAVAVMPROC JNI_CreateJavaVMProc; #if defined(WIN32) std::string dllPath = ConfigServerGame::getJavaLibPath(); HINSTANCE hVm = LoadLibrary(dllPath.c_str()); - if (hVm == nullptr) + if (hVm == NULL) { FATAL(true, ("jvm open fail error: could not open %s", dllPath.c_str())); ms_loaded = -1; @@ -1108,10 +1108,10 @@ void JavaLibrary::initializeJavaThread() JNI_CreateJavaVMProc = (JNI_CREATEJAVAVMPROC)GetProcAddress(hVm, "JNI_CreateJavaVM"); //lint !e1924 C-style cast #else - void *libVM = nullptr; + void *libVM = NULL; std::string dllPath = ConfigServerGame::getJavaLibPath(); libVM = dlopen(dllPath.c_str(), RTLD_LAZY); - if (libVM == nullptr) + if (libVM == NULL) { FATAL(true, ("jvm open fail! error: %s", dlerror())); ms_loaded = -1; @@ -1121,7 +1121,7 @@ void JavaLibrary::initializeJavaThread() JNI_CreateJavaVMProc = (JNI_CREATEJAVAVMPROC)dlsym(libVM, "JNI_CreateJavaVM"); #endif - if (JNI_CreateJavaVMProc == nullptr) + if (JNI_CreateJavaVMProc == NULL) { FATAL(true, ("Error getting JNI_CreateJavaVM from jvm shared library")); ms_loaded = -1; @@ -1137,9 +1137,9 @@ void JavaLibrary::initializeJavaThread() classPath += ConfigServerGame::getScriptPath(); JavaVMInitArgs vm_args; - JavaVMOption tempOption = {nullptr, nullptr}; + JavaVMOption tempOption = {NULL, NULL}; std::vector options; - char *jdwpBuffer = nullptr; + char *jdwpBuffer = NULL; UNREF(jdwpBuffer); @@ -1206,7 +1206,7 @@ void JavaLibrary::initializeJavaThread() } #ifdef REMOTE_DEBUG_ON - char *jdwpBuffer = nullptr; + char *jdwpBuffer = NULL; if (ConfigServerGame::getUseRemoteDebugJava()) { if (ms_javaVmType == JV_ibm) @@ -1305,14 +1305,14 @@ void JavaLibrary::initializeJavaThread() vm_args.ignoreUnrecognized = JNI_TRUE; // create the JVM - JNIEnv * env = nullptr; + JNIEnv * env = NULL; jint result = (*JNI_CreateJavaVMProc)(&ms_jvm, reinterpret_cast(&env), &vm_args); #ifdef REMOTE_DEBUG_ON - if (jdwpBuffer != nullptr) + if (jdwpBuffer != NULL) { delete[] jdwpBuffer; - jdwpBuffer = nullptr; + jdwpBuffer = NULL; } #endif @@ -1329,7 +1329,7 @@ void JavaLibrary::initializeJavaThread() // clean up IGNORE_RETURN(ms_jvm->DestroyJavaVM()); - ms_jvm = nullptr; + ms_jvm = NULL; #if defined(_WIN32) @@ -1356,7 +1356,7 @@ bool JavaLibrary::connectToJava() return false; // attach our thread to the VM - jint result = ms_jvm->AttachCurrentThread(reinterpret_cast(&ms_env), nullptr); + jint result = ms_jvm->AttachCurrentThread(reinterpret_cast(&ms_env), NULL); if (result != 0) { FATAL(true, ("Failed to attach to the Java VM! Error code returned = %d", result)); @@ -1927,7 +1927,7 @@ bool JavaLibrary::connectToJava() for (i = 0; i < MAX_STRING_ID_PARAMS; ++i) { - localInstance = createNewObject(ms_clsStringId, ms_midStringId, nullptr, -1); + localInstance = createNewObject(ms_clsStringId, ms_midStringId, NULL, -1); if (ms_env->ExceptionCheck()) { ms_env->ExceptionDescribe(); @@ -1945,7 +1945,7 @@ bool JavaLibrary::connectToJava() for (i = 0; i < MAX_MODIFIABLE_STRING_ID_PARAMS; ++i) { localInstance = createNewObject(ms_clsModifiableStringId, constructor, - nullptr, -1); + NULL, -1); if (ms_env->ExceptionCheck()) { ms_env->ExceptionDescribe(); @@ -2100,7 +2100,7 @@ bool JavaLibrary::registerNatives(const JNINativeMethod natives[], int count) { if (!natives[i].signature) { - DEBUG_REPORT_LOG(true, ("RegisterNatives failed: %s - nullptr signature\n", natives[i].name)); + DEBUG_REPORT_LOG(true, ("RegisterNatives failed: %s - NULL signature\n", natives[i].name)); result = 1; continue; } @@ -2208,11 +2208,11 @@ int i; FREE_CLASS(ms_clsLibraryDump); FREE_CLASS(ms_clsLibraryGMLib); - if (ms_scriptEntry != nullptr) + if (ms_scriptEntry != NULL) { if (ms_env) ms_env->DeleteGlobalRef(ms_scriptEntry); - ms_scriptEntry = nullptr; + ms_scriptEntry = NULL; } for (i = 0; i < MAX_RECURSION_COUNT; ++i) @@ -2235,7 +2235,7 @@ int i; GlobalInstances::ms_menuInfo = GlobalRef::cms_nullPtr; IGNORE_RETURN(ms_jvm->DetachCurrentThread()); - ms_env = nullptr; + ms_env = NULL; } // JavaLibrary::disconnectFromJava //---------------------------------------------------------------------- @@ -2272,7 +2272,7 @@ void JavaLibrary::resetJavaConnection() */ bool JavaLibrary::queryScriptFunctions(const std::string & scriptName) { - if (ms_instance == nullptr) + if (ms_instance == NULL) return false; JavaString scriptClassName(("script." + scriptName).c_str()); @@ -2326,7 +2326,7 @@ bool JavaLibrary::queryScriptFunctions(const std::string & scriptName) */ jlong JavaLibrary::getFreeJavaMemory() { - if (ms_instance == nullptr || ms_env == nullptr) + if (ms_instance == NULL || ms_env == NULL) return 0; return ms_env->CallStaticLongMethod(ms_clsScriptEntry, ms_midScriptEntryGetFreeMem); @@ -2347,7 +2347,7 @@ void JavaLibrary::printJavaStack() */ void JavaLibrary::enableLogging(bool enable) const { - if (ms_instance == nullptr || ms_env == nullptr) + if (ms_instance == NULL || ms_env == NULL) return; ms_env->CallStaticVoidMethod(ms_clsScriptEntry, @@ -2361,7 +2361,7 @@ void JavaLibrary::enableLogging(bool enable) const */ void JavaLibrary::enableNewJediTracking(bool enableTracking) { - if (ms_instance == nullptr || ms_env == nullptr) + if (ms_instance == NULL || ms_env == NULL) return; ms_env->CallStaticVoidMethod(ms_clsScriptEntry, @@ -2401,7 +2401,7 @@ LocalRefPtr JavaLibrary::getObjId(const NetworkId::NetworkIdType & id) */ LocalRefPtr JavaLibrary::getObjId(const NetworkId & id) { - if (ms_env != nullptr && ms_instance != nullptr) + if (ms_env != NULL && ms_instance != NULL) return callStaticObjectMethod(ms_clsObjId, ms_midObjIdGetObjId, id.getValue()); return LocalRef::cms_nullPtr; } // JavaLibrary::getObjId(const CachedNetworkId &) @@ -2490,7 +2490,7 @@ LocalRefPtr JavaLibrary::getVector(Vector const & vector) */ void JavaLibrary::removeJavaId(const NetworkId & id) { - if (ms_env == nullptr || ms_clsObjId == nullptr || ms_midObjIdClearObjId == nullptr) + if (ms_env == NULL || ms_clsObjId == NULL || ms_midObjIdClearObjId == NULL) { return; } @@ -2508,7 +2508,7 @@ void JavaLibrary::removeJavaId(const NetworkId & id) */ void JavaLibrary::flagDestroyed(const NetworkId & id) { - if (ms_env == nullptr || ms_clsObjId == nullptr || ms_midObjIdFlagDestroyed == nullptr) + if (ms_env == NULL || ms_clsObjId == NULL || ms_midObjIdFlagDestroyed == NULL) { return; } @@ -2527,7 +2527,7 @@ void JavaLibrary::flagDestroyed(const NetworkId & id) */ void JavaLibrary::setObjIdAuthoritative(const NetworkId & object, bool authoritative, uint32 pid) { - if (ms_env == nullptr || ms_midObjIdSetAuthoritative == nullptr) + if (ms_env == NULL || ms_midObjIdSetAuthoritative == NULL) { return; } @@ -2550,7 +2550,7 @@ void JavaLibrary::setObjIdAuthoritative(const NetworkId & object, bool authorita */ void JavaLibrary::setObjIdLoaded(const NetworkId &object) { - if (ms_env == nullptr || ms_midObjIdSetLoaded == nullptr) + if (ms_env == NULL || ms_midObjIdSetLoaded == NULL) { return; } @@ -2572,7 +2572,7 @@ void JavaLibrary::setObjIdLoaded(const NetworkId &object) */ void JavaLibrary::setObjIdInitialized(const NetworkId &object) { - if (ms_env == nullptr || ms_midObjIdSetInitialized == nullptr) + if (ms_env == NULL || ms_midObjIdSetInitialized == NULL) { return; } @@ -2594,7 +2594,7 @@ void JavaLibrary::setObjIdInitialized(const NetworkId &object) */ void JavaLibrary::setObjIdLoggedIn(const NetworkId & object, bool loggedIn) { - if (ms_env == nullptr || ms_midObjIdSetLoggedIn == nullptr) + if (ms_env == NULL || ms_midObjIdSetLoggedIn == NULL) { return; } @@ -2617,7 +2617,7 @@ void JavaLibrary::setObjIdLoggedIn(const NetworkId & object, bool loggedIn) void JavaLibrary::attachScriptToObjId(const NetworkId &object, const std::string & script) { - if (ms_env != nullptr) + if (ms_env != NULL) { LocalRefPtr obj_id = getObjId(object); if (obj_id == LocalRef::cms_nullPtr) @@ -2638,7 +2638,7 @@ void JavaLibrary::attachScriptToObjId(const NetworkId &object, void JavaLibrary::attachScriptsToObjId(const NetworkId &object, const ScriptList & scripts) { - if (scripts.size() == 0 || ms_env == nullptr) + if (scripts.size() == 0 || ms_env == NULL) return; LocalRefPtr obj_id = getObjId(object); @@ -2684,7 +2684,7 @@ void JavaLibrary::attachScriptsToObjId(const NetworkId &object, void JavaLibrary::detachScriptFromObjId(const NetworkId &object, const std::string & script) { - if (ms_env != nullptr) + if (ms_env != NULL) { LocalRefPtr obj_id = getObjId(object); if (obj_id == LocalRef::cms_nullPtr) @@ -2703,7 +2703,7 @@ void JavaLibrary::detachScriptFromObjId(const NetworkId &object, */ void JavaLibrary::detachAllScriptsFromObjId(const NetworkId &object) { - if (ms_env != nullptr) + if (ms_env != NULL) { LocalRefPtr obj_id = getObjId(object); if (obj_id == LocalRef::cms_nullPtr) @@ -2766,7 +2766,7 @@ jint JavaLibrary::handleScriptEntryCleanup(jint result) if (ConfigServerGame::getTrapScriptCrashes()) { // the script threw an error or exception, restore our segfault handler - IGNORE_RETURN(sigaction(SIGSEGV, &OurSa, nullptr)); + IGNORE_RETURN(sigaction(SIGSEGV, &OurSa, NULL)); } #endif } @@ -2786,20 +2786,20 @@ jint JavaLibrary::handleScriptEntryCleanup(jint result) jint JavaLibrary::callScriptEntry(const JavaStringParam & script, const JavaStringParam & method, jobjectArray params) { - if (ms_env == nullptr || ms_clsScriptEntry == nullptr || ms_midRunOne == nullptr) + if (ms_env == NULL || ms_clsScriptEntry == NULL || ms_midRunOne == NULL) { - LOG("ScriptInvestigation", ("callScriptEntry failed because something was nullptr")); + LOG("ScriptInvestigation", ("callScriptEntry failed because something was null")); if (!ms_env) { - LOG("ScriptInvestigation", ("callScriptEntry failed because ms_env was nullptr")); + LOG("ScriptInvestigation", ("callScriptEntry failed because ms_env was null")); } if (!ms_clsScriptEntry) { - LOG("ScriptInvestigation", ("callScriptEntry failed because scriptEntry was nullptr")); + LOG("ScriptInvestigation", ("callScriptEntry failed because scriptEntry was null")); } if (!ms_midRunOne) { - LOG("ScriptInvestigation", ("callScriptEntry failed because runOne was nullptr")); + LOG("ScriptInvestigation", ("callScriptEntry failed because runOne was null")); } return SCRIPT_OVERRIDE; @@ -2837,20 +2837,20 @@ jint JavaLibrary::callScriptEntry(const JavaStringParam & script, */ jint JavaLibrary::callScriptEntry(const JavaStringParam & method, jobjectArray params) { - if (ms_env == nullptr || ms_clsScriptEntry == nullptr || ms_midRunAll == nullptr) + if (ms_env == NULL || ms_clsScriptEntry == NULL || ms_midRunAll == NULL) { - LOG("ScriptInvestigation", ("callScriptEntry2 failed because something was nullptr")); + LOG("ScriptInvestigation", ("callScriptEntry2 failed because something was null")); if (!ms_env) { - LOG("ScriptInvestigation", ("callScriptEntry2 failed because ms_env was nullptr")); + LOG("ScriptInvestigation", ("callScriptEntry2 failed because ms_env was null")); } if (!ms_clsScriptEntry) { - LOG("ScriptInvestigation", ("callScriptEntry2 failed because scriptEntry was nullptr")); + LOG("ScriptInvestigation", ("callScriptEntry2 failed because scriptEntry was null")); } if (!ms_midRunOne) { - LOG("ScriptInvestigation", ("callScriptEntry2 failed because runOne was nullptr")); + LOG("ScriptInvestigation", ("callScriptEntry2 failed because runOne was null")); } return SCRIPT_OVERRIDE; } @@ -2886,20 +2886,20 @@ jint JavaLibrary::callScriptEntry(const JavaStringParam & method, jobjectArray p */ jstring JavaLibrary::callScriptConsoleHandlerEntry(const JavaStringParam & script, const JavaStringParam & method, jobjectArray params) { - if (ms_env == nullptr || ms_clsScriptEntry == nullptr || ms_midRunConsoleHandler == nullptr) + if (ms_env == NULL || ms_clsScriptEntry == NULL || ms_midRunConsoleHandler == NULL) { - LOG("ScriptInvestigation", ("callScriptConsoleHandlerEntry failed because something was nullptr")); + LOG("ScriptInvestigation", ("callScriptConsoleHandlerEntry failed because something was null")); if (!ms_env) { - LOG("ScriptInvestigation", ("callScriptConsoleHandlerEntry failed because ms_env was nullptr")); + LOG("ScriptInvestigation", ("callScriptConsoleHandlerEntry failed because ms_env was null")); } if (!ms_clsScriptEntry) { - LOG("ScriptInvestigation", ("callScriptConsoleHandlerEntry failed because scriptEntry was nullptr")); + LOG("ScriptInvestigation", ("callScriptConsoleHandlerEntry failed because scriptEntry was null")); } if (!ms_midRunConsoleHandler) { - LOG("ScriptInvestigation", ("callScriptConsoleHandlerEntry failed because runConsoleHandler was nullptr")); + LOG("ScriptInvestigation", ("callScriptConsoleHandlerEntry failed because runConsoleHandler was null")); } return 0; @@ -2938,7 +2938,7 @@ void JavaLibrary::convert(const ScriptParams & params, JavaDictionaryPtr & dicti { dictionary.reset(); - if (ms_env == nullptr) + if (ms_env == NULL) return; // create the dictionary @@ -3132,7 +3132,7 @@ void JavaLibrary::convert(const ScriptParams & params, JavaDictionaryPtr & dicti for (int j = 0; j < count; ++j) { const std::vector * inner = objIds[j]; - if (inner != nullptr) + if (inner != NULL) { LocalObjectArrayRefPtr innerArray = createNewObjectArray(inner->size(), ms_clsObjId); if (innerArray != LocalObjectArrayRef::cms_nullPtr) @@ -3235,7 +3235,7 @@ void JavaLibrary::convert(const ScriptParams & params, JavaDictionaryPtr & dicti */ LocalObjectArrayRefPtr JavaLibrary::convert(const NetworkId & self, const std::string& argList, const ScriptParams &args) { - if (ms_env == nullptr) + if (ms_env == NULL) return LocalObjectArrayRef::cms_nullPtr; // convert the params to jobjects @@ -3272,7 +3272,7 @@ LocalObjectArrayRefPtr JavaLibrary::convert(const NetworkId & self, const std::s */ LocalObjectArrayRefPtr JavaLibrary::convert(const std::string& argList, const ScriptParams &args) { - if (ms_env == nullptr) + if (ms_env == NULL) return LocalObjectArrayRef::cms_nullPtr; // convert the params to jobjects @@ -3301,7 +3301,7 @@ LocalObjectArrayRefPtr JavaLibrary::convert(const std::string& argList, const Sc */ bool JavaLibrary::convert(LocalObjectArrayRefPtr & javaParams, int startIndex, const std::string& argList, const ScriptParams &args) { - if (ms_env == nullptr) + if (ms_env == NULL) return 0; GlobalInstances globals; @@ -3536,7 +3536,7 @@ bool JavaLibrary::convert(LocalObjectArrayRefPtr & javaParams, int startIndex, c for (i = 0, iter = strings.begin(); iter != strings.end(); ++i, ++iter) { - if (*iter != nullptr) + if (*iter != NULL) { JavaString newString(**iter); setObjectArrayElement(*localInstance, i, newString); @@ -3767,7 +3767,7 @@ bool JavaLibrary::convert(LocalObjectArrayRefPtr & javaParams, int startIndex, c ++paramCount; } } - // fill in the rest of ms_attribModList with nullptr + // fill in the rest of ms_attribModList with null for (; paramCount < MAX_ATTRIB_MOD_PARAMS; ++paramCount) { setObjectArrayElement(*ms_attribModList[ms_currentRecursionCount], static_cast(paramCount), *LocalRefParam::cms_nullPtr); @@ -3846,7 +3846,7 @@ bool JavaLibrary::convert(LocalObjectArrayRefPtr & javaParams, int startIndex, c ++paramCount; } } - // fill in the rest of ms_mentalStateModList with nullptr + // fill in the rest of ms_mentalStateModList with null for (; paramCount < MAX_MENTAL_STATE_MOD_PARAMS; ++paramCount) { setObjectArrayElement( @@ -3932,7 +3932,7 @@ bool JavaLibrary::convert(LocalObjectArrayRefPtr & javaParams, int startIndex, c static_cast(argType))); //lint !e571 suspicious cast return 0; } - if (arg.get() == nullptr || arg == LocalRef::cms_nullPtr) + if (arg.get() == NULL || arg == LocalRef::cms_nullPtr) { DEBUG_REPORT_LOG(true, ("bad parameter, %c%s%d%s\n", argType, modifiable ? "*" : "", @@ -3967,7 +3967,7 @@ bool JavaLibrary::convert(LocalObjectArrayRefPtr & javaParams, int startIndex, c void JavaLibrary::alterScriptParams(jobjectArray jparams, const std::string& argList, ScriptParams &args) { - if (ms_env == nullptr) + if (ms_env == NULL) return; PROFILER_AUTO_BLOCK_CHECK_DEFINE("JavaLibrary::alterScriptParams"); @@ -4003,7 +4003,7 @@ void JavaLibrary::alterScriptParams(jobjectArray jparams, const std::string& arg { int count = getArrayLength(*arg); std::vector * values = new std::vector(count, 0); - jint * jvalues = static_cast(ms_env->GetPrimitiveArrayCritical(static_cast(arg->getValue()), nullptr)); + jint * jvalues = static_cast(ms_env->GetPrimitiveArrayCritical(static_cast(arg->getValue()), NULL)); for (int j = 0; j < count; ++j) { values->at(j) = static_cast(jvalues[j]); @@ -4035,7 +4035,7 @@ void JavaLibrary::alterScriptParams(jobjectArray jparams, const std::string& arg { int count = getArrayLength(*arg); std::vector * values = new std::vector(count, 0); - jbyte * jvalues = static_cast(ms_env->GetPrimitiveArrayCritical(static_cast(arg->getValue()), nullptr)); + jbyte * jvalues = static_cast(ms_env->GetPrimitiveArrayCritical(static_cast(arg->getValue()), NULL)); for (int j = 0; j < count; ++j) { values->at(j) = static_cast(jvalues[j]); @@ -4121,7 +4121,7 @@ void JavaLibrary::alterScriptParams(jobjectArray jparams, const std::string& arg std::string localString; convert(*table, localString); value->setTable(localString); - // get the string id text, if it is not nullptr/empty, use it + // get the string id text, if it is not NULL/empty, use it localString.clear(); JavaStringPtr text = getStringField(*arg, ms_fidStringIdAsciiId); if (text != JavaString::cms_nullPtr) @@ -4197,18 +4197,18 @@ int JavaLibrary::runScripts(const NetworkId & caller, "JavaLibrary::runScripts enter, self = %s, method = %s\n", caller.getValueString().c_str(), method.c_str())); - if (ms_env == nullptr || ms_clsObject == nullptr) + if (ms_env == NULL || ms_clsObject == NULL) { DEBUG_REPORT_LOG(ConfigServerGame::getJavaConsoleDebugMessages(), ( "JavaLibrary::runScripts exit, self = %s, method = %s\n", caller.getValueString().c_str(), method.c_str())); if (!ms_env) { - LOG("ScriptInvestigation", ("runSCripts failed because env was nullptr")); + LOG("ScriptInvestigation", ("runSCripts failed because env was null")); } else { - LOG("ScriptInvestigation", ("runSCripts failed because clsObject was nullptr")); + LOG("ScriptInvestigation", ("runSCripts failed because clsObject was null")); } return SCRIPT_OVERRIDE; } @@ -4335,19 +4335,19 @@ int JavaLibrary::runScript(const NetworkId & caller, const std::string& script, "JavaLibrary::runScript %s enter, self = %s, method = %s\n", script.c_str(), caller.getValueString().c_str(), method.c_str())); - if (ms_env == nullptr || ms_midRunOne == nullptr || ms_clsObject == nullptr) + if (ms_env == NULL || ms_midRunOne == NULL || ms_clsObject == NULL) { if (!ms_env) { - LOG("ScriptInvestigation", ("runSCripts2 failed because env was nullptr")); + LOG("ScriptInvestigation", ("runSCripts2 failed because env was null")); } else if (!ms_midRunOne) { - LOG("ScriptInvestigation", ("runSCripts2 failed because midRunOne was nullptr")); + LOG("ScriptInvestigation", ("runSCripts2 failed because midRunOne was null")); } else { - LOG("ScriptInvestigation", ("runSCripts2 failed because clsObject was nullptr")); + LOG("ScriptInvestigation", ("runSCripts2 failed because clsObject was null")); } return SCRIPT_OVERRIDE; @@ -4455,19 +4455,19 @@ int JavaLibrary::runScript(const NetworkId & caller, const std::string& script, DEBUG_REPORT_LOG(true, ("JavaLibrary::runScript %s enter, method = %s\n", script.c_str(), method.c_str())); - if (ms_env == nullptr || ms_midRunOne == nullptr || ms_clsObject == nullptr) + if (ms_env == NULL || ms_midRunOne == NULL || ms_clsObject == NULL) { if (!ms_env) { - LOG("ScriptInvestigation", ("runSCripts3 failed because env was nullptr")); + LOG("ScriptInvestigation", ("runSCripts3 failed because env was null")); } else if (!ms_midRunOne) { - LOG("ScriptInvestigation", ("runSCripts3 failed because midRunOne was nullptr")); + LOG("ScriptInvestigation", ("runSCripts3 failed because midRunOne was null")); } else { - LOG("ScriptInvestigation", ("runSCripts3 failed because clsObject was nullptr")); + LOG("ScriptInvestigation", ("runSCripts3 failed because clsObject was null")); } return SCRIPT_OVERRIDE; } @@ -4582,19 +4582,19 @@ int JavaLibrary::runScript(const NetworkId & caller, const std::string& script, DEBUG_REPORT_LOG(true, ("JavaLibrary::runScript %s enter, method = %s\n", script.c_str(), method.c_str())); - if (ms_env == nullptr || ms_midRunOne == nullptr || ms_clsObject == nullptr) + if (ms_env == NULL || ms_midRunOne == NULL || ms_clsObject == NULL) { if (!ms_env) { - LOG("ScriptInvestigation", ("runSCripts4 failed because env was nullptr")); + LOG("ScriptInvestigation", ("runSCripts4 failed because env was null")); } else if (!ms_midRunOne) { - LOG("ScriptInvestigation", ("runSCripts4 failed because midRunOne was nullptr")); + LOG("ScriptInvestigation", ("runSCripts4 failed because midRunOne was null")); } else { - LOG("ScriptInvestigation", ("runSCripts4 failed because clsObject was nullptr")); + LOG("ScriptInvestigation", ("runSCripts4 failed because clsObject was null")); } return SCRIPT_OVERRIDE; @@ -4775,19 +4775,19 @@ static const std::string errorReturnString; "JavaLibrary::runScript %s enter, method = %s\n", script.c_str(), method.c_str())); - if (ms_env == nullptr || ms_midRunConsoleHandler == nullptr || ms_clsObject == nullptr) + if (ms_env == NULL || ms_midRunConsoleHandler == NULL || ms_clsObject == NULL) { if (!ms_env) { - LOG("ScriptInvestigation", ("runSCripts2 failed because env was nullptr")); + LOG("ScriptInvestigation", ("runSCripts2 failed because env was null")); } else if (!ms_midRunConsoleHandler) { - LOG("ScriptInvestigation", ("runSCripts2 failed because midRunConsoleHandler was nullptr")); + LOG("ScriptInvestigation", ("runSCripts2 failed because midRunConsoleHandler was null")); } else { - LOG("ScriptInvestigation", ("runSCripts2 failed because clsObject was nullptr")); + LOG("ScriptInvestigation", ("runSCripts2 failed because clsObject was null")); } return errorReturnString; @@ -4877,7 +4877,7 @@ static const std::string errorReturnString; */ bool JavaLibrary::reloadScript(const std::string& scriptName) { - if (ms_env == nullptr || ms_clsScriptEntry == nullptr || ms_midUnload == nullptr) + if (ms_env == NULL || ms_clsScriptEntry == NULL || ms_midUnload == NULL) return false; // convert the script name to jstring @@ -4919,22 +4919,22 @@ int JavaLibrary::callMessages(const NetworkId & caller, const std::string & meth int result = SCRIPT_CONTINUE; - if (ms_env == nullptr || ms_midRunOne == nullptr || ms_clsObject == nullptr) + if (ms_env == NULL || ms_midRunOne == NULL || ms_clsObject == NULL) { DEBUG_REPORT_LOG(ConfigServerGame::getJavaConsoleDebugMessages(), ( "JavaLibrary::callMessages exit, self = %s, method = %s\n", caller.getValueString().c_str(), method.c_str())); if (!ms_env) { - LOG("ScriptInvestigation", ("callMessages failed because env was nullptr")); + LOG("ScriptInvestigation", ("callMessages failed because env was null")); } else if (!ms_midRunOne) { - LOG("ScriptInvestigation", ("callMessages failed because midRunOne was nullptr")); + LOG("ScriptInvestigation", ("callMessages failed because midRunOne was null")); } else { - LOG("ScriptInvestigation", ("callMessages failed because clsObject was nullptr")); + LOG("ScriptInvestigation", ("callMessages failed because clsObject was null")); } return SCRIPT_OVERRIDE; @@ -4951,7 +4951,7 @@ int JavaLibrary::callMessages(const NetworkId & caller, const std::string & meth const JavaDictionary * dictionary = safe_cast(data.get()); jobject jdictionary = 0; - if (dictionary != nullptr) + if (dictionary != NULL) jdictionary = dictionary->getValue(); // convert the method string to jstrings @@ -5013,22 +5013,22 @@ int JavaLibrary::callMessage(const NetworkId & caller, const std::string & scrip "JavaLibrary::callMessage %s enter, self = %s, method = %s\n", script.c_str(), caller.getValueString().c_str(), method.c_str())); - if (ms_env == nullptr || ms_midRunOne == nullptr || ms_clsObject == nullptr) + if (ms_env == NULL || ms_midRunOne == NULL || ms_clsObject == NULL) { DEBUG_REPORT_LOG(ConfigServerGame::getJavaConsoleDebugMessages(), ( "JavaLibrary::callMessage %s exit, self = %s, method = %s\n", script.c_str(), caller.getValueString().c_str(), method.c_str())); if (!ms_env) { - LOG("ScriptInvestigation", ("callMessage failed because env was nullptr")); + LOG("ScriptInvestigation", ("callMessage failed because env was null")); } else if (!ms_midRunOne) { - LOG("ScriptInvestigation", ("callMessage failed because midRunOne was nullptr")); + LOG("ScriptInvestigation", ("callMessage failed because midRunOne was null")); } else { - LOG("ScriptInvestigation", ("callMessage failed because clsObject was nullptr")); + LOG("ScriptInvestigation", ("callMessage failed because clsObject was null")); } return SCRIPT_OVERRIDE; @@ -5044,7 +5044,7 @@ int JavaLibrary::callMessage(const NetworkId & caller, const std::string & scrip } const JavaDictionary * dictionary = dynamic_cast(&data); - if (dictionary == nullptr) + if (dictionary == NULL) { DEBUG_REPORT_LOG(ConfigServerGame::getJavaConsoleDebugMessages(), ( "JavaLibrary::callMessage %s exit, self = %s, method = %s\n", @@ -5218,7 +5218,7 @@ void JavaLibrary::packDictionary(const ScriptDictionary & dictionary, bool JavaLibrary::unpackDictionary(const std::vector & packedData, ScriptDictionaryPtr & dictionary) { - if (ms_env == nullptr) + if (ms_env == NULL) return false; dictionary = JavaDictionary::cms_nullPtr; @@ -5259,7 +5259,7 @@ bool JavaLibrary::unpackDictionary(const std::vector & packedData, } } */ - if (data != nullptr && *data != '\0') + if (data != NULL && *data != '\0') { LocalByteArrayRefPtr jdata = createNewByteArray(dataLen); if (jdata != LocalByteArrayRef::cms_nullPtr) @@ -5335,7 +5335,7 @@ const bool JavaLibrary::convert(const JavaStringParam & source, Unicode::String const bool JavaLibrary::convert(const JavaDictionary & source, std::vector & target) { bool result = false; - if (ms_env != nullptr) + if (ms_env != NULL) { if (source.getValue() != 0) { @@ -5463,7 +5463,7 @@ const bool convert(const std::vector & source, LocalObj result = true; for (int i = 0; i < count; ++i) { - if (source[i] != nullptr) + if (source[i] != NULL) { JavaString targetElement(*source[i]); setObjectArrayElement(*target, i, targetElement); @@ -6160,7 +6160,7 @@ const bool convert(const LocalRefParam & source, const Region * & target) const bool convert(const jobject & source, const Region * &target) { JNIEnv * env = JavaLibrary::getEnv(); - if (env == nullptr || source == nullptr) + if (env == NULL || source == NULL) return false; if (!env->IsInstanceOf(source, JavaLibrary::ms_clsRegion)) return false; @@ -6384,7 +6384,7 @@ const bool convert(const LocalRefParam & sourceVector, Vector & target) const bool convert(const AttribMod::AttribMod & source, LocalRefPtr & target) { JNIEnv * env = JavaLibrary::getEnv(); - if (env == nullptr) + if (env == NULL) return false; target = allocObject(JavaLibrary::ms_clsAttribMod); @@ -6418,7 +6418,7 @@ const bool convert(const AttribMod::AttribMod & source, LocalRefPtr & target) const bool convert(const jobject & source, AttribMod::AttribMod & target) { JNIEnv * env = JavaLibrary::getEnv(); - if (env == nullptr) + if (env == NULL) return false; if (source == 0 || env->IsInstanceOf(source, JavaLibrary::ms_clsAttribMod) == JNI_FALSE) @@ -6477,7 +6477,7 @@ const bool convert(const LocalRefParam & source, AttribMod::AttribMod & target) const bool convert(const std::vector & source, LocalObjectArrayRefPtr & target) { JNIEnv * env = JavaLibrary::getEnv(); - if (env == nullptr) + if (env == NULL) return false; int count = source.size(); @@ -6504,7 +6504,7 @@ const bool convert(const std::vector & source, LocalObject const bool convert(const jobjectArray & source, std::vector & target) { JNIEnv * env = JavaLibrary::getEnv(); - if (env == nullptr) + if (env == NULL) return false; if (source == 0) @@ -6529,7 +6529,7 @@ const bool convert(const jobjectArray & source, std::vector & target) { JNIEnv * env = JavaLibrary::getEnv(); - if (env == nullptr) + if (env == NULL) return false; if (source == 0) @@ -6545,7 +6545,7 @@ const bool convert(const jbyteArray & source, std::vector & target) const bool convert(const LocalByteArrayRef & source, std::vector & target) { JNIEnv * env = JavaLibrary::getEnv(); - if (env == nullptr) + if (env == NULL) return false; if (source.getValue() == 0) @@ -6561,7 +6561,7 @@ const bool convert(const LocalByteArrayRef & source, std::vector & target) const bool convert(const std::vector & source, LocalByteArrayRefPtr & target) { JNIEnv * env = JavaLibrary::getEnv(); - if (env == nullptr) + if (env == NULL) return false; int count = source.size(); @@ -6593,10 +6593,10 @@ CreatureObject *JavaLibrary::getCreatureThrow(JNIEnv *env, jlong objId, char con if (!objId) { - IGNORE_RETURN(snprintf(buffer, sizeof(buffer) - 1, "%s: nullptr object id from script.", errorDescription)); + IGNORE_RETURN(snprintf(buffer, sizeof(buffer) - 1, "%s: null object id from script.", errorDescription)); buffer[sizeof(buffer) - 1] = '\0'; throwInternalScriptError(buffer); - return nullptr; + return NULL; } else { @@ -6606,7 +6606,7 @@ CreatureObject *JavaLibrary::getCreatureThrow(JNIEnv *env, jlong objId, char con IGNORE_RETURN(snprintf(buffer, sizeof(buffer) - 1, "%s: invalid or non-convertable network id [%s].", errorDescription, networkId.getValueString().c_str())); buffer[sizeof(buffer) - 1] = '\0'; throwInternalScriptError(buffer); - return nullptr; + return NULL; } else { @@ -6616,19 +6616,19 @@ CreatureObject *JavaLibrary::getCreatureThrow(JNIEnv *env, jlong objId, char con if (!throwIfNotOnServer) { // The specified object is not on this server. It might not even be a real object. - // Since the caller does not want this to throw, simply return nullptr. - return nullptr; + // Since the caller does not want this to throw, simply return NULL. + return NULL; } IGNORE_RETURN(snprintf(buffer, sizeof(buffer) - 1, "%s: object for network id [%s] not on this server.", errorDescription, networkId.getValueString().c_str())); buffer[sizeof(buffer) - 1] = '\0'; throwInternalScriptError(buffer); - return nullptr; + return NULL; } else { ServerObject *const serverObject = object->asServerObject(); - CreatureObject *const creatureObject = serverObject ? serverObject->asCreatureObject() : nullptr; + CreatureObject *const creatureObject = serverObject ? serverObject->asCreatureObject() : NULL; if (creatureObject) return creatureObject; @@ -6637,7 +6637,7 @@ CreatureObject *JavaLibrary::getCreatureThrow(JNIEnv *env, jlong objId, char con IGNORE_RETURN(snprintf(buffer, sizeof(buffer) - 1, "%s: object id=[%s], template=[%s] is not a CreatureObject.", errorDescription, networkId.getValueString().c_str(), object->getObjectTemplateName())); buffer[sizeof(buffer) - 1] = '\0'; throwInternalScriptError(buffer); - return nullptr; + return NULL; } } } @@ -6654,10 +6654,10 @@ ShipObject *JavaLibrary::getShipThrow(JNIEnv *env, jlong objId, char const *erro if (objId == 0) { - IGNORE_RETURN(snprintf(buffer, sizeof(buffer) - 1, "%s: nullptr object id from script.", errorDescription)); + IGNORE_RETURN(snprintf(buffer, sizeof(buffer) - 1, "%s: null object id from script.", errorDescription)); buffer[sizeof(buffer) - 1] = '\0'; throwInternalScriptError(buffer); - return nullptr; + return NULL; } else { @@ -6667,7 +6667,7 @@ ShipObject *JavaLibrary::getShipThrow(JNIEnv *env, jlong objId, char const *erro IGNORE_RETURN(snprintf(buffer, sizeof(buffer) - 1, "%s: invalid or non-convertable network id [%s].", errorDescription, networkId.getValueString().c_str())); buffer[sizeof(buffer) - 1] = '\0'; throwInternalScriptError(buffer); - return nullptr; + return NULL; } else { @@ -6677,19 +6677,19 @@ ShipObject *JavaLibrary::getShipThrow(JNIEnv *env, jlong objId, char const *erro if (!throwIfNotOnServer) { // The specified object is not on this server. It might not even be a real object. - // Since the caller does not want this to throw, simply return nullptr. - return nullptr; + // Since the caller does not want this to throw, simply return NULL. + return NULL; } IGNORE_RETURN(snprintf(buffer, sizeof(buffer) - 1, "%s: object for network id [%s] not on this server.", errorDescription, networkId.getValueString().c_str())); buffer[sizeof(buffer) - 1] = '\0'; throwInternalScriptError(buffer); - return nullptr; + return NULL; } else { ServerObject *const serverObject = object->asServerObject(); - ShipObject *const shipObject = serverObject ? serverObject->asShipObject() : nullptr; + ShipObject *const shipObject = serverObject ? serverObject->asShipObject() : NULL; if (shipObject) return shipObject; @@ -6698,7 +6698,7 @@ ShipObject *JavaLibrary::getShipThrow(JNIEnv *env, jlong objId, char const *erro IGNORE_RETURN(snprintf(buffer, sizeof(buffer) - 1, "%s: object id=[%s], template=[%s] is not a ShipObject.", errorDescription, networkId.getValueString().c_str(), object->getObjectTemplateName())); buffer[sizeof(buffer) - 1] = '\0'; throwInternalScriptError(buffer); - return nullptr; + return NULL; } } } @@ -6714,7 +6714,7 @@ ShipObject *JavaLibrary::getShipThrow(JNIEnv *env, jlong objId, char const *erro */ void JavaLibrary::throwInternalScriptError(const char * message) { - if (ms_env != nullptr && message != nullptr) + if (ms_env != NULL && message != NULL) { ms_env->ThrowNew(ms_clsInternalScriptError, message); } diff --git a/engine/server/library/serverScript/src/shared/ScriptFunctionTable.cpp b/engine/server/library/serverScript/src/shared/ScriptFunctionTable.cpp index e9f4e88c..976743ee 100755 --- a/engine/server/library/serverScript/src/shared/ScriptFunctionTable.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptFunctionTable.cpp @@ -434,7 +434,7 @@ static const Scripting::ScriptFuncTable ScriptFuncList[] = //-- finish it up - {Scripting::TRIG_LAST_TRIGGER, nullptr, nullptr} + {Scripting::TRIG_LAST_TRIGGER, NULL, NULL} }; const int NUM_SCRIPT_FUNCTIONS = sizeof(ScriptFuncList) / sizeof(ScriptFuncList[0]) - 1; @@ -444,7 +444,7 @@ const int NUM_SCRIPT_FUNCTIONS = sizeof(ScriptFuncList) / sizeof(ScriptFuncList[ // globals //======================================================================== -Scripting::_ScriptFuncHashMap *Scripting::ScriptFuncHashMap = nullptr; +Scripting::_ScriptFuncHashMap *Scripting::ScriptFuncHashMap = NULL; //======================================================================== @@ -468,6 +468,6 @@ void Scripting::InitScriptFuncHashMap(void) void Scripting::RemoveScriptFuncHashMap(void) { delete Scripting::ScriptFuncHashMap; - Scripting::ScriptFuncHashMap = nullptr; + Scripting::ScriptFuncHashMap = NULL; } diff --git a/engine/server/library/serverScript/src/shared/ScriptListEntry.cpp b/engine/server/library/serverScript/src/shared/ScriptListEntry.cpp index 8725947c..1f55096a 100755 --- a/engine/server/library/serverScript/src/shared/ScriptListEntry.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptListEntry.cpp @@ -16,9 +16,9 @@ std::string const &ScriptListEntry::getScriptName() const { static const std::string emptyString; - if (m_data != nullptr) + if (m_data != NULL) return m_data->first; - WARNING_STRICT_FATAL(true, ("ScriptListEntry::getScriptName called with m_data = nullptr")); + WARNING_STRICT_FATAL(true, ("ScriptListEntry::getScriptName called with m_data = NULL")); return emptyString; } @@ -28,9 +28,9 @@ ScriptData &ScriptListEntry::getScriptData() const { static ScriptData emptyData; - if (m_data != nullptr) + if (m_data != NULL) return m_data->second; - WARNING_STRICT_FATAL(true, ("ScriptListEntry::getScriptData called with m_data = nullptr")); + WARNING_STRICT_FATAL(true, ("ScriptListEntry::getScriptData called with m_data = NULL")); return emptyData; } diff --git a/engine/server/library/serverScript/src/shared/ScriptListEntry.h b/engine/server/library/serverScript/src/shared/ScriptListEntry.h index 37349274..1d5e8f66 100755 --- a/engine/server/library/serverScript/src/shared/ScriptListEntry.h +++ b/engine/server/library/serverScript/src/shared/ScriptListEntry.h @@ -53,7 +53,7 @@ inline bool ScriptListEntry::operator==(ScriptListEntry const &rhs) const inline bool ScriptListEntry::isValid() const { - return m_data != nullptr; + return m_data != NULL; } // ====================================================================== diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsAi.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsAi.cpp index 1d12a09a..eab60dd9 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsAi.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsAi.cpp @@ -126,18 +126,18 @@ AICreatureController * const ScriptMethodsAiNamespace::getAiCreatureController(j NetworkId const aiNetworkId(ai); CreatureObject * const aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId); - if (aiCreatureObject == nullptr) + if (aiCreatureObject == NULL) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("Unable to resolve the ai(%s) to a CreatureObject.", aiNetworkId.getValueString().c_str())); - return nullptr; + return NULL; } AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(aiCreatureObject->getController()); - if (aiCreatureController == nullptr) + if (aiCreatureController == NULL) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("Unable to get the ai's(%s) AiCreatureController.", aiCreatureObject->getDebugInformation().c_str())); - return nullptr; + return NULL; } return aiCreatureController; @@ -155,14 +155,14 @@ jint JNICALL ScriptMethodsAiNamespace::aiGetMovementState(JNIEnv * /*env*/, jobj NetworkId const aiNetworkId(ai); CreatureObject * const aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId); - if (aiCreatureObject == nullptr) + if (aiCreatureObject == NULL) { return AMT_invalid; } AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(aiCreatureObject->getController()); - if (aiCreatureController == nullptr) + if (aiCreatureController == NULL) { return AMT_invalid; } @@ -187,14 +187,14 @@ jboolean JNICALL ScriptMethodsAiNamespace::aiLoggingEnabled(JNIEnv * /*env*/, jo NetworkId const aiNetworkId(ai); CreatureObject * const aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId); - if (aiCreatureObject == nullptr) + if (aiCreatureObject == NULL) { return JNI_FALSE; } AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(aiCreatureObject->getController()); - if (aiCreatureController == nullptr) + if (aiCreatureController == NULL) { return JNI_FALSE; } @@ -212,7 +212,7 @@ jboolean JNICALL ScriptMethodsAiNamespace::aiIsFrozen(JNIEnv * /*env*/, jobject { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == nullptr) + if (aiCreatureController == NULL) { return JNI_FALSE; } @@ -226,14 +226,14 @@ jboolean JNICALL ScriptMethodsAiNamespace::aiIsAggressive(JNIEnv * /*env*/, jobj NetworkId const aiNetworkId(ai); CreatureObject * const aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId); - if (aiCreatureObject == nullptr) + if (aiCreatureObject == NULL) { return JNI_FALSE; } AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(aiCreatureObject->getController()); - if (aiCreatureController == nullptr) + if (aiCreatureController == NULL) { return JNI_FALSE; } @@ -247,14 +247,14 @@ jboolean JNICALL ScriptMethodsAiNamespace::aiIsAssist(JNIEnv * /*env*/, jobject NetworkId const aiNetworkId(ai); CreatureObject * const aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId); - if (aiCreatureObject == nullptr) + if (aiCreatureObject == NULL) { return JNI_FALSE; } AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(aiCreatureObject->getController()); - if (aiCreatureController == nullptr) + if (aiCreatureController == NULL) { return JNI_FALSE; } @@ -267,7 +267,7 @@ jboolean JNICALL ScriptMethodsAiNamespace::aiIsStalker(JNIEnv * /*env*/, jobject { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == nullptr) + if (aiCreatureController == NULL) { return JNI_FALSE; } @@ -282,14 +282,14 @@ jboolean JNICALL ScriptMethodsAiNamespace::aiIsKiller(JNIEnv * /*env*/, jobject NetworkId const aiNetworkId(ai); CreatureObject * const aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId); - if (aiCreatureObject == nullptr) + if (aiCreatureObject == NULL) { return JNI_FALSE; } AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(aiCreatureObject->getController()); - if (aiCreatureController == nullptr) + if (aiCreatureController == NULL) { return JNI_FALSE; } @@ -302,7 +302,7 @@ void JNICALL ScriptMethodsAiNamespace::aiTether(JNIEnv * /*env*/, jobject /*self { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == nullptr) + if (aiCreatureController == NULL) { return; } @@ -316,14 +316,14 @@ jboolean JNICALL ScriptMethodsAiNamespace::aiIsTethered(JNIEnv * /*env*/, jobjec NetworkId const aiNetworkId(ai); CreatureObject * const aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId); - if (aiCreatureObject == nullptr) + if (aiCreatureObject == NULL) { return JNI_FALSE; } AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(aiCreatureObject->getController()); - if (aiCreatureController == nullptr) + if (aiCreatureController == NULL) { return JNI_FALSE; } @@ -336,7 +336,7 @@ void JNICALL ScriptMethodsAiNamespace::aiSetHomeLocation(JNIEnv * /*env*/, jobje { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == nullptr) + if (aiCreatureController == NULL) { return; } @@ -356,7 +356,7 @@ jobject JNICALL ScriptMethodsAiNamespace::aiGetHomeLocation(JNIEnv * /*env*/, jo { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == nullptr) + if (aiCreatureController == NULL) { return JavaLibrary::getVector(Vector::zero)->getReturnValue(); } @@ -373,7 +373,7 @@ jobject JNICALL ScriptMethodsAiNamespace::aiGetLeashAnchorLocation(JNIEnv * /*en { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == nullptr) + if (aiCreatureController == NULL) { return JavaLibrary::getVector(Vector::zero)->getReturnValue(); } @@ -396,7 +396,7 @@ jfloat JNICALL ScriptMethodsAiNamespace::aiGetRespectRadius(JNIEnv * /*env*/, jo { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == nullptr) + if (aiCreatureController == NULL) { return 0.0f; } @@ -411,7 +411,7 @@ jfloat JNICALL ScriptMethodsAiNamespace::aiGetAggroRadius(JNIEnv * /*env*/, jobj { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == nullptr) + if (aiCreatureController == NULL) { return 0.0f; } @@ -424,7 +424,7 @@ void JNICALL ScriptMethodsAiNamespace::aiEquipPrimaryWeapon(JNIEnv * /*env*/, jo { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == nullptr) + if (aiCreatureController == NULL) { return; } @@ -437,7 +437,7 @@ void JNICALL ScriptMethodsAiNamespace::aiEquipSecondaryWeapon(JNIEnv * /*env*/, { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == nullptr) + if (aiCreatureController == NULL) { return; } @@ -450,7 +450,7 @@ void JNICALL ScriptMethodsAiNamespace::aiUnEquipWeapons(JNIEnv * /*env*/, jobjec { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == nullptr) + if (aiCreatureController == NULL) { return; } @@ -463,7 +463,7 @@ jboolean JNICALL ScriptMethodsAiNamespace::aiHasPrimaryWeapon(JNIEnv * /*env*/, { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == nullptr) + if (aiCreatureController == NULL) { return JNI_FALSE; } @@ -476,7 +476,7 @@ jboolean JNICALL ScriptMethodsAiNamespace::aiHasSecondaryWeapon(JNIEnv * /*env*/ { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == nullptr) + if (aiCreatureController == NULL) { return JNI_FALSE; } @@ -489,7 +489,7 @@ jboolean JNICALL ScriptMethodsAiNamespace::aiUsingPrimaryWeapon(JNIEnv * /*env*/ { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == nullptr) + if (aiCreatureController == NULL) { return JNI_FALSE; } @@ -502,7 +502,7 @@ jboolean JNICALL ScriptMethodsAiNamespace::aiUsingSecondaryWeapon(JNIEnv * /*env { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == nullptr) + if (aiCreatureController == NULL) { return JNI_FALSE; } @@ -515,7 +515,7 @@ jlong JNICALL ScriptMethodsAiNamespace::aiGetPrimaryWeapon(JNIEnv * /*env*/, job { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == nullptr) + if (aiCreatureController == NULL) { return 0; } @@ -528,7 +528,7 @@ jlong JNICALL ScriptMethodsAiNamespace::aiGetSecondaryWeapon(JNIEnv * /*env*/, j { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == nullptr) + if (aiCreatureController == NULL) { return 0; } @@ -541,7 +541,7 @@ jfloat JNICALL ScriptMethodsAiNamespace::aiGetMovementSpeedPercent(JNIEnv * /*en { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == nullptr) + if (aiCreatureController == NULL) { return 0.0f; } @@ -554,7 +554,7 @@ void JNICALL ScriptMethodsAiNamespace::loiterLocation(JNIEnv * /*env*/, jobject { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == nullptr) + if (aiCreatureController == NULL) { return; } @@ -585,7 +585,7 @@ void JNICALL ScriptMethodsAiNamespace::loiterLocation(JNIEnv * /*env*/, jobject CellObject const * const cellObject = CellObject::getCellObject(cellId); - if (cellObject != nullptr) + if (cellObject != NULL) { CellProperty const * const cellProperty = cellObject->getCellProperty(); @@ -608,7 +608,7 @@ void JNICALL ScriptMethodsAiNamespace::loiterTarget(JNIEnv * /*env*/, jobject /* { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == nullptr) + if (aiCreatureController == NULL) { return; } @@ -623,7 +623,7 @@ void JNICALL ScriptMethodsAiNamespace::loiterTarget(JNIEnv * /*env*/, jobject /* NetworkId const targetNetworkId(static_cast(target)); Object * const targetObject = NetworkIdManager::getObjectById(targetNetworkId); - if (targetObject == nullptr) + if (targetObject == NULL) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsAi::loiterTarget() ai(%s) Unable to resolve the target(%s) to a Object", aiCreatureController->getCreature()->getDebugInformation().c_str(), targetNetworkId.getValueString().c_str())); return; @@ -643,7 +643,7 @@ void JNICALL ScriptMethodsAiNamespace::pathToLocation(JNIEnv * /*env*/, jobject { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == nullptr) + if (aiCreatureController == NULL) { return; } @@ -664,7 +664,7 @@ void JNICALL ScriptMethodsAiNamespace::pathToLocation(JNIEnv * /*env*/, jobject { CellObject const * const cellObject = CellObject::getCellObject(cellId); - if (cellObject != nullptr) + if (cellObject != NULL) { CellProperty const * const cellProperty = cellObject->getCellProperty(); @@ -697,7 +697,7 @@ void JNICALL ScriptMethodsAiNamespace::pathToName(JNIEnv * /*env*/, jobject /*se { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == nullptr) + if (aiCreatureController == NULL) { return; } @@ -731,7 +731,7 @@ void JNICALL ScriptMethodsAiNamespace::pathToName(JNIEnv * /*env*/, jobject /*se void JNICALL ScriptMethodsAiNamespace::patrolToLocation(JNIEnv *, jobject, jlong ai, jobjectArray targets, jboolean random, jboolean flip, jboolean repeat, jint startPoint) { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == nullptr) + if (aiCreatureController == NULL) return; std::vector locations; @@ -755,7 +755,7 @@ void JNICALL ScriptMethodsAiNamespace::patrolToLocation(JNIEnv *, jobject, jlong void JNICALL ScriptMethodsAiNamespace::patrolToName(JNIEnv *, jobject, jlong ai, jobjectArray targetNames, jboolean random, jboolean flip, jboolean repeat, jint startPoint) { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == nullptr) + if (aiCreatureController == NULL) return; std::vector locations; @@ -768,11 +768,11 @@ void JNICALL ScriptMethodsAiNamespace::patrolToName(JNIEnv *, jobject, jlong ai, for (int i = 0; i < count; ++i) { const Unicode::String * location = locations[i]; - if (location != nullptr) + if (location != NULL) { realLocations.push_back(*location); delete location; - locations[i] = nullptr; + locations[i] = NULL; } } aiCreatureController->patrol(realLocations, random, flip, repeat, startPoint); @@ -783,16 +783,16 @@ jstring JNICALL ScriptMethodsAiNamespace::aiGetCombatAction(JNIEnv * /*env*/, jo { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == nullptr) + if (aiCreatureController == NULL) { - return nullptr; + return NULL; } PersistentCrcString const & result = aiCreatureController->getCombatAction(); if (result.isEmpty()) { - return nullptr; + return NULL; } JavaString javaString(result.getString()); @@ -805,7 +805,7 @@ jint JNICALL ScriptMethodsAiNamespace::aiGetKnockDownRecoveryTime(JNIEnv * /*env { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == nullptr) + if (aiCreatureController == NULL) { return 0; } @@ -819,7 +819,7 @@ jboolean JNICALL ScriptMethodsAiNamespace::setHibernationDelay(JNIEnv *env, jobj { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(creature); - if (aiCreatureController == nullptr) + if (aiCreatureController == NULL) return JNI_FALSE; aiCreatureController->setHibernationDelay(delay); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsAnimation.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsAnimation.cpp index 9c2ec894..d41f22ca 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsAnimation.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsAnimation.cpp @@ -97,7 +97,7 @@ void JNICALL ScriptMethodsAnimationNamespace::setAnimationMood (JNIEnv *env, job JavaStringParam localMoodName(moodName); - ServerObject * targetObject = nullptr; + ServerObject * targetObject = NULL; if (!JavaLibrary::getObject(target, targetObject)) return; @@ -114,7 +114,7 @@ void JNICALL ScriptMethodsAnimationNamespace::setAnimationMood (JNIEnv *env, job jstring JNICALL ScriptMethodsAnimationNamespace::getAnimationMood (JNIEnv *env, jobject self, jlong target) { - ServerObject * targetObject = nullptr; + ServerObject * targetObject = NULL; if (!JavaLibrary::getObject(target, targetObject)) return 0; @@ -143,7 +143,7 @@ jboolean JNICALL ScriptMethodsAnimationNamespace::sitOnObject (JNIEnv *env, jobj CreatureObject *sitterObject = 0; if (!JavaLibrary::getObject (sitterId, sitterObject) || !sitterObject) { - DEBUG_WARNING (true, ("sitOnObject(): Sitter object is nullptr.")); + DEBUG_WARNING (true, ("sitOnObject(): Sitter object is NULL.")); return JNI_FALSE; } @@ -175,11 +175,11 @@ void JNICALL ScriptMethodsAnimationNamespace::setObjectAppearance(JNIEnv *env, j UNREF(env); UNREF(self); - CreatureObject* creature = nullptr; + CreatureObject* creature = NULL; if(!JavaLibrary::getObject(target, creature) || !creature) { - DEBUG_WARNING(true, ("SetObjectAppearance() : Creature object was nullptr.\n")); + DEBUG_WARNING(true, ("SetObjectAppearance() : Creature object was NULL.\n")); return; } @@ -209,11 +209,11 @@ void JNICALL ScriptMethodsAnimationNamespace::revertObjectAppearance(JNIEnv *env UNREF(env); UNREF(self); - CreatureObject* creature = nullptr; + CreatureObject* creature = NULL; if(!JavaLibrary::getObject(target, creature) || !creature) { - DEBUG_WARNING(true, ("RevertObjectAppearance() : Creature object was nullptr.\n")); + DEBUG_WARNING(true, ("RevertObjectAppearance() : Creature object was NULL.\n")); return; } diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsAttributes.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsAttributes.cpp index 42c47200..266b10f8 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsAttributes.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsAttributes.cpp @@ -549,12 +549,12 @@ jboolean JNICALL ScriptMethodsAttributesNamespace::hasAttribModifier(JNIEnv *env if (!JavaLibrary::convert(jmodName, name)) return JNI_FALSE; - const CreatureObject * creature = nullptr; + const CreatureObject * creature = NULL; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; const AttribMod::AttribMod * mod = creature->getAttributeModifier(name); - if (mod != nullptr && AttribMod::isAttribMod(*mod)) + if (mod != NULL && AttribMod::isAttribMod(*mod)) return JNI_TRUE; return JNI_FALSE; @@ -582,12 +582,12 @@ jboolean JNICALL ScriptMethodsAttributesNamespace::hasSkillModModifier(JNIEnv *e if (!JavaLibrary::convert(jmodName, name)) return JNI_FALSE; - const CreatureObject * creature = nullptr; + const CreatureObject * creature = NULL; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; const AttribMod::AttribMod * mod = creature->getAttributeModifier(name); - if (mod != nullptr && AttribMod::isSkillMod(*mod)) + if (mod != NULL && AttribMod::isSkillMod(*mod)) return JNI_TRUE; return JNI_FALSE; @@ -601,7 +601,7 @@ jboolean JNICALL ScriptMethodsAttributesNamespace::hasSkillModModifier(JNIEnv *e * @param target id of creature to access * @param attrib attribute we are interested in * - * @return the attribute modifiers for the creature, or nullptr if it has none + * @return the attribute modifiers for the creature, or null if it has none */ jobjectArray JNICALL ScriptMethodsAttributesNamespace::getAttribModifiers(JNIEnv *env, jobject self, jlong target, jint attrib) { @@ -642,7 +642,7 @@ jobjectArray JNICALL ScriptMethodsAttributesNamespace::getAttribModifiers(JNIEnv * @param self class calling this function * @param target id of creature to access * - * @return the attribute modifiers for the creature, or nullptr if it has none + * @return the attribute modifiers for the creature, or null if it has none */ jobjectArray JNICALL ScriptMethodsAttributesNamespace::getAllAttribModifiers(JNIEnv *env, jobject self, jlong target) { @@ -692,7 +692,7 @@ jboolean JNICALL ScriptMethodsAttributesNamespace::removeAttribModifier(JNIEnv * if (!JavaLibrary::convert(jmodName, name)) return JNI_FALSE; - CreatureObject * creature = nullptr; + CreatureObject * creature = NULL; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -1084,12 +1084,12 @@ jint JNICALL ScriptMethodsAttributesNamespace::getHitpoints(JNIEnv *env, jobject { UNREF(self); - const TangibleObject * object = nullptr; + const TangibleObject * object = NULL; if (!JavaLibrary::getObject(target, object)) return ATTRIB_ERROR; // make sure the object isn't a creature or is a vehicle - if (object->asCreatureObject () != nullptr && + if (object->asCreatureObject () != NULL && !GameObjectTypes::isTypeOf (object->getGameObjectType (), SharedObjectTemplate::GOT_vehicle)) return ATTRIB_ERROR; @@ -1111,12 +1111,12 @@ jint JNICALL ScriptMethodsAttributesNamespace::getMaxHitpoints(JNIEnv *env, jobj { UNREF(self); - const TangibleObject * object = nullptr; + const TangibleObject * object = NULL; if (!JavaLibrary::getObject(target, object)) return ATTRIB_ERROR; // make sure the object isn't a creature or is a vehicle - if (object->asCreatureObject () != nullptr && + if (object->asCreatureObject () != NULL && !GameObjectTypes::isTypeOf (object->getGameObjectType (), SharedObjectTemplate::GOT_vehicle)) return ATTRIB_ERROR; @@ -1136,13 +1136,13 @@ jint JNICALL ScriptMethodsAttributesNamespace::getTotalHitpoints(JNIEnv *env, jo { UNREF(self); - const TangibleObject * object = nullptr; + const TangibleObject * object = NULL; if (!JavaLibrary::getObject(target, object)) return ATTRIB_ERROR; // make sure the object isn't a creature // make sure the object isn't a creature or is a vehicle - if (object->asCreatureObject () != nullptr && + if (object->asCreatureObject () != NULL && !GameObjectTypes::isTypeOf (object->getGameObjectType (), SharedObjectTemplate::GOT_vehicle)) return ATTRIB_ERROR; @@ -1164,12 +1164,12 @@ jboolean JNICALL ScriptMethodsAttributesNamespace::setHitpoints(JNIEnv *env, job { UNREF(self); - TangibleObject * object = nullptr; + TangibleObject * object = NULL; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; // make sure the object isn't a creature or is a vehicle - if (object->asCreatureObject () != nullptr && + if (object->asCreatureObject () != NULL && !GameObjectTypes::isTypeOf (object->getGameObjectType (), SharedObjectTemplate::GOT_vehicle)) return JNI_FALSE; @@ -1209,12 +1209,12 @@ jboolean JNICALL ScriptMethodsAttributesNamespace::setMaxHitpoints(JNIEnv *env, { UNREF(self); - TangibleObject * object = nullptr; + TangibleObject * object = NULL; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; // make sure the object isn't a creature or is a vehicle - if (object->asCreatureObject () != nullptr && + if (object->asCreatureObject () != NULL && !GameObjectTypes::isTypeOf (object->getGameObjectType (), SharedObjectTemplate::GOT_vehicle)) return JNI_FALSE; @@ -1237,12 +1237,12 @@ jboolean JNICALL ScriptMethodsAttributesNamespace::setInvulnerableHitpoints(JNIE { UNREF(self); - TangibleObject * object = nullptr; + TangibleObject * object = NULL; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; // make sure the object isn't a creature or is a vehicle - if (object->asCreatureObject () != nullptr && + if (object->asCreatureObject () != NULL && !GameObjectTypes::isTypeOf (object->getGameObjectType (), SharedObjectTemplate::GOT_vehicle)) return JNI_FALSE; @@ -1280,7 +1280,7 @@ jboolean JNICALL ScriptMethodsAttributesNamespace::setInvulnerableHitpoints(JNIE */ jint JNICALL ScriptMethodsAttributesNamespace::getShockWound(JNIEnv *env, jobject self, jlong target) { - const CreatureObject * creature = nullptr; + const CreatureObject * creature = NULL; if (!JavaLibrary::getObject(target, creature)) return ATTRIB_ERROR; @@ -1299,7 +1299,7 @@ jint JNICALL ScriptMethodsAttributesNamespace::getShockWound(JNIEnv *env, jobjec */ jboolean JNICALL ScriptMethodsAttributesNamespace::setShockWound(JNIEnv *env, jobject self, jlong target, jint wound) { - CreatureObject * creature = nullptr; + CreatureObject * creature = NULL; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -1319,7 +1319,7 @@ jboolean JNICALL ScriptMethodsAttributesNamespace::setShockWound(JNIEnv *env, jo */ jboolean JNICALL ScriptMethodsAttributesNamespace::addShockWound(JNIEnv *env, jobject self, jlong target, jint wound) { - CreatureObject * creature = nullptr; + CreatureObject * creature = NULL; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -1339,7 +1339,7 @@ jboolean JNICALL ScriptMethodsAttributesNamespace::addShockWound(JNIEnv *env, jo */ jboolean JNICALL ScriptMethodsAttributesNamespace::healShockWound(JNIEnv *env, jobject self, jlong target, jint value) { - CreatureObject * creature = nullptr; + CreatureObject * creature = NULL; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsAuction.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsAuction.cpp index e288480b..0a76643b 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsAuction.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsAuction.cpp @@ -110,8 +110,8 @@ void JNICALL ScriptMethodsAuctionNamespace::createVendorMarket(JNIEnv *env, jobj void JNICALL ScriptMethodsAuctionNamespace::auctionCreatePermanent(JNIEnv *env, jobject script, jstring jownerName, jlong jitem, jlong jauctionContainer, jint jprice, jstring juserDescription) { - TangibleObject *itemObject = nullptr; - ServerObject *containerObj = nullptr; + TangibleObject *itemObject = NULL; + ServerObject *containerObj = NULL; if (!JavaLibrary::getObject(jitem, itemObject)) { @@ -194,7 +194,7 @@ void JNICALL ScriptMethodsAuctionNamespace::setSalesTax(JNIEnv *env, jobject scr void JNICALL ScriptMethodsAuctionNamespace::requestVendorItemCount(JNIEnv *env, jobject script, jlong vendor) { - ServerObject* vendorObject = nullptr; + ServerObject* vendorObject = NULL; if( !JavaLibrary::getObject(vendor, vendorObject) ) { WARNING(true, ("[designer bug] requestVendorItemLimit() vendor is invalid.")); @@ -206,7 +206,7 @@ void JNICALL ScriptMethodsAuctionNamespace::requestVendorItemCount(JNIEnv *env, void JNICALL ScriptMethodsAuctionNamespace::requestPlayerVendorCount(JNIEnv *env, jobject script, jlong player) { - ServerObject* playerObject = nullptr; + ServerObject* playerObject = NULL; if( !JavaLibrary::getObject(player, playerObject) ) { WARNING(true, ("[designer bug] requestPlayerVendorCount() player is invalid.")); @@ -218,7 +218,7 @@ void JNICALL ScriptMethodsAuctionNamespace::requestPlayerVendorCount(JNIEnv *env void JNICALL ScriptMethodsAuctionNamespace::updateVendorSearchOption(JNIEnv *env, jobject script, jlong vendor, jboolean enable) { - ServerObject* vendorObject = nullptr; + ServerObject* vendorObject = NULL; bool enabled; if( !JavaLibrary::getObject(vendor, vendorObject) ) { @@ -235,7 +235,7 @@ void JNICALL ScriptMethodsAuctionNamespace::updateVendorSearchOption(JNIEnv *env void JNICALL ScriptMethodsAuctionNamespace::setEntranceCharge(JNIEnv *env, jobject script, jlong vendor, jint entranceCharge) { - ServerObject* vendorObject = nullptr; + ServerObject* vendorObject = NULL; if( !JavaLibrary::getObject(vendor, vendorObject) ) { WARNING(true, ("[designer bug] setEntranceCharge() vendor is invalid.")); @@ -247,7 +247,7 @@ void JNICALL ScriptMethodsAuctionNamespace::setEntranceCharge(JNIEnv *env, jobje void JNICALL ScriptMethodsAuctionNamespace::removeAllAuctions(JNIEnv *env, jobject script, jlong jvendor) { - ServerObject* vendorObject = nullptr; + ServerObject* vendorObject = NULL; if( !JavaLibrary::getObject(jvendor, vendorObject) ) { WARNING(true, ("[designer bug] removeAllAuctions() vendor is invalid.")); @@ -259,21 +259,21 @@ void JNICALL ScriptMethodsAuctionNamespace::removeAllAuctions(JNIEnv *env, jobje void JNICALL ScriptMethodsAuctionNamespace::reinitializeVendor(JNIEnv *env, jobject script, jlong vendor, jlong player) { - ServerObject* vendorObject = nullptr; + ServerObject* vendorObject = NULL; if( !JavaLibrary::getObject(vendor, vendorObject) ) { WARNING(true, ("[designer bug] reinitializeVendor() vendor is invalid.")); return; } ServerObject* auctionContainer = vendorObject->getBazaarContainer(); - if ( auctionContainer == nullptr ) + if ( auctionContainer == NULL ) { WARNING(true, ("[designer bug] reinitializeVendor() vendor doesn't have an auction container.")); return; } - ServerObject* playerObject = nullptr; + ServerObject* playerObject = NULL; if ( !JavaLibrary::getObject(player, playerObject) ) { WARNING(true, ("[designer bug] reinitializeVendor() player is invalid.")); @@ -292,7 +292,7 @@ void JNICALL ScriptMethodsAuctionNamespace::reinitializeVendor(JNIEnv *env, jobj void JNICALL ScriptMethodsAuctionNamespace::updateVendorStatus(JNIEnv *env, jobject script, jlong vendor, jint status) { - ServerObject const * vendorObject = nullptr; + ServerObject const * vendorObject = NULL; if (!JavaLibrary::getObject(vendor, vendorObject)) { diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsBroadcasting.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsBroadcasting.cpp index 2ee028b5..aaea9f3c 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsBroadcasting.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsBroadcasting.cpp @@ -63,7 +63,7 @@ void JNICALL ScriptMethodsBroadcastingNamespace::listenToMessage(JNIEnv *env, jo CachedNetworkId emitterId(emitter); ServerObject* listenerObject = dynamic_cast(listenerId.getObject()); - if (listenerObject == nullptr) + if (listenerObject == NULL) return; std::string messageHandlerNameString; @@ -88,7 +88,7 @@ void JNICALL ScriptMethodsBroadcastingNamespace::stopListeningToMessage(JNIEnv * CachedNetworkId emitterId(emitter); ServerObject* listenerObject = dynamic_cast(listenerId.getObject()); - if (listenerObject == nullptr) + if (listenerObject == NULL) return; std::string messageHandlerNameString; @@ -112,7 +112,7 @@ jlongArray JNICALL ScriptMethodsBroadcastingNamespace::getMessageListeners(JNIEn CachedNetworkId emitterId(emitter); ServerObject* emitterObject = dynamic_cast(emitterId.getObject()); - if (emitterObject == nullptr) + if (emitterObject == NULL) return 0; std::string messageHandlerNameString; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsBuffBuilder.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsBuffBuilder.cpp index 24289140..9eaabd1f 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsBuffBuilder.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsBuffBuilder.cpp @@ -162,8 +162,8 @@ jboolean JNICALL ScriptMethodsBuffBuilderNamespace::buffBuilderValidated(JNIEnv WARNING(true, ("index keys and values arrays are of diffent sizes")); return JNI_FALSE; } - jint * const buffComponentsValuesArray = env->GetIntArrayElements(jbuffComponentValues, nullptr); - if (buffComponentsValuesArray == nullptr) + jint * const buffComponentsValuesArray = env->GetIntArrayElements(jbuffComponentValues, NULL); + if (buffComponentsValuesArray == NULL) { return JNI_FALSE; } @@ -194,7 +194,7 @@ jboolean JNICALL ScriptMethodsBuffBuilderNamespace::buffBuilderValidated(JNIEnv { //send the final change message to the buffer to indicate acceptance - Controller * const bufferController = bufferObj ? bufferObj->getController() : nullptr; + Controller * const bufferController = bufferObj ? bufferObj->getController() : NULL; if(bufferController) { BuffBuilderChangeMessage * outMsg = new BuffBuilderChangeMessage(); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsChat.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsChat.cpp index 39fbf062..8e36a847 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsChat.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsChat.cpp @@ -218,7 +218,7 @@ jstring JNICALL ScriptMethodsChatNamespace::chatPackOutOfBandWaypointData(JNIEnv Unicode::String n; //name StringId nid; //nameId - //-- target may be nullptr, we'll just start a new string + //-- target may be null, we'll just start a new string if (target) { const JavaStringParam jtarget(target); @@ -229,7 +229,7 @@ jstring JNICALL ScriptMethodsChatNamespace::chatPackOutOfBandWaypointData(JNIEnv } } - //-- if planet is nullptr, just use the current sceneId + //-- if planet is null, just use the current sceneId if (planet) { const JavaStringParam jplanet(planet); @@ -304,7 +304,7 @@ jstring JNICALL ScriptMethodsChatNamespace::chatPackOutOfBandWaypoint(JNIEnv * e if (!source) { - DEBUG_WARNING (true, ("ScriptMethodsChat JavaLibrary::chatPackOutOfBandWaypoint failed nullptr source")); + DEBUG_WARNING (true, ("ScriptMethodsChat JavaLibrary::chatPackOutOfBandWaypoint failed null source")); return 0; } @@ -340,7 +340,7 @@ jstring JNICALL ScriptMethodsChatNamespace::packOutOfBandProsePackage(JNIEnv * e if (!stringId) { - DEBUG_WARNING (true, ("JavaLibrary::packOutOfBandProsePackage attempt to pack prose package with nullptr stringId")); + DEBUG_WARNING (true, ("JavaLibrary::packOutOfBandProsePackage attempt to pack prose package with null stringId")); return 0; } @@ -644,10 +644,10 @@ void JNICALL ScriptMethodsChatNamespace::chatSendSystemMessageObjId(JNIEnv * env if(!JavaLibrary::getObject(_to, player)) { - DEBUG_WARNING (true, ("ScriptMethodsChat JavaLibrary::chatSendSystemMessageObjId failed bad source object (not nullptr)")); + DEBUG_WARNING (true, ("ScriptMethodsChat JavaLibrary::chatSendSystemMessageObjId failed bad source object (not null)")); if (ConfigServerScript::allowDebugConsoleMessages()) { - fprintf(stderr, "WARNING: JavaLibrary::chatSendSystemMessageObjId: failed bad source object (not nullptr)\n"); + fprintf(stderr, "WARNING: JavaLibrary::chatSendSystemMessageObjId: failed bad source object (not null)\n"); JavaLibrary::printJavaStack(); } return; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsCity.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsCity.cpp index db7499c7..6843dc85 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsCity.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsCity.cpp @@ -920,7 +920,7 @@ void JNICALL ScriptMethodsCityNamespace::cityRemoveStructure(JNIEnv *env, jobjec jboolean JNICALL ScriptMethodsCityNamespace::cityIsInactivePackupActive(JNIEnv *env, jobject self) { - return (ConfigServerGame::getCityCitizenshipInactivePackupStartTimeEpoch() <= static_cast(::time(nullptr))); + return (ConfigServerGame::getCityCitizenshipInactivePackupStartTimeEpoch() <= static_cast(::time(NULL))); } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsClientEffect.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsClientEffect.cpp index b3af259f..28cb48e9 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsClientEffect.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsClientEffect.cpp @@ -91,7 +91,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEventObj(JNIEnv * { JavaStringParam localEventType(eventType); - ServerObject* so = nullptr; + ServerObject* so = NULL; if(!JavaLibrary::getObject(client, so)) return JNI_FALSE; Client* c = so->getClient(); @@ -100,7 +100,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEventObj(JNIEnv * if (!objectToPlayEventOn) return JNI_FALSE; - ServerObject* target = nullptr; + ServerObject* target = NULL; if(!JavaLibrary::getObject(objectToPlayEventOn, target)) return JNI_FALSE; if(!target) @@ -114,7 +114,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEventObj(JNIEnv * //get the hardpoint std::string hp; - if (nullptr != jHardpoint) + if (NULL != jHardpoint) { JavaStringParam localHardpoint(jHardpoint); JavaLibrary::convert(localHardpoint, hp); @@ -122,7 +122,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEventObj(JNIEnv * //get the transform Transform transform; - if (nullptr != jTransform) + if (NULL != jTransform) { ScriptConversion::convert(jTransform, transform); } @@ -158,7 +158,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEventObjLimited(J if (!objectToPlayEventOn) return JNI_FALSE; - ServerObject* target = nullptr; + ServerObject* target = NULL; if(!JavaLibrary::getObject(objectToPlayEventOn, target)) return JNI_FALSE; if(!target) @@ -172,7 +172,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEventObjLimited(J //get the hardpoint std::string hp; - if (nullptr != jHardpoint) + if (NULL != jHardpoint) { JavaStringParam localHardpoint(jHardpoint); JavaLibrary::convert(localHardpoint, hp); @@ -180,7 +180,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEventObjLimited(J //get the transform Transform transform; - if (nullptr != jTransform) + if (NULL != jTransform) { ScriptConversion::convert(jTransform, transform); } @@ -210,7 +210,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEventLoc(JNIEnv * JavaStringParam localEventSourceType(eventSourceType); JavaStringParam localEventDestType(eventDestType); - ServerObject* so = nullptr; + ServerObject* so = NULL; if(!JavaLibrary::getObject(client, so)) return JNI_FALSE; Client* c = so->getClient(); @@ -281,7 +281,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEffectObj(JNIEnv { JavaStringParam localEffectName(effectName); - ServerObject* so = nullptr; + ServerObject* so = NULL; if(!JavaLibrary::getObject(objectToPlayEffectOn, so)) return JNI_FALSE; /* TPERRY - This isn't used @@ -293,7 +293,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEffectObj(JNIEnv if (!objectToPlayEffectOn) return JNI_FALSE; - ServerObject* target = nullptr; + ServerObject* target = NULL; if(!JavaLibrary::getObject(objectToPlayEffectOn, target)) return JNI_FALSE; if(!target) @@ -307,7 +307,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEffectObj(JNIEnv //get the hardpoint std::string hp; - if (nullptr != jHardpoint) + if (NULL != jHardpoint) { JavaStringParam localHardpoint(jHardpoint); JavaLibrary::convert(localHardpoint, hp); @@ -315,14 +315,14 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEffectObj(JNIEnv //get the transform Transform transform; - if (nullptr != jTransform) + if (NULL != jTransform) { ScriptConversion::convert(jTransform, transform); } //get the optional labelName std::string strLabelName; - if (nullptr != labelName) + if (NULL != labelName) { JavaStringParam localLabel(labelName); JavaLibrary::convert(localLabel, strLabelName); @@ -360,7 +360,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEffectObjLimited( if (!objectToPlayEffectOn) return JNI_FALSE; - ServerObject* target = nullptr; + ServerObject* target = NULL; if(!JavaLibrary::getObject(objectToPlayEffectOn, target)) return JNI_FALSE; if(!target) @@ -374,7 +374,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEffectObjLimited( //get the hardpoint std::string hp; - if (nullptr != jHardpoint) + if (NULL != jHardpoint) { JavaStringParam localHardpoint(jHardpoint); JavaLibrary::convert(localHardpoint, hp); @@ -382,14 +382,14 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEffectObjLimited( //get the transform Transform transform; - if (nullptr != jTransform) + if (NULL != jTransform) { ScriptConversion::convert(jTransform, transform); } //get the optional labelName std::string strLabelName; - if (nullptr != labelName) + if (NULL != labelName) { JavaStringParam localLabel(labelName); JavaLibrary::convert(localLabel, strLabelName); @@ -419,7 +419,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEffectLoc(JNIEnv { JavaStringParam localEffectName(effectName); - ServerObject* so = nullptr; + ServerObject* so = NULL; if(!JavaLibrary::getObject(client, so)) return JNI_FALSE; @@ -444,7 +444,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEffectLoc(JNIEnv //get the optional labelName std::string strLabelName; - if (nullptr != labelName) + if (NULL != labelName) { JavaStringParam localLabel(labelName); JavaLibrary::convert(localLabel, strLabelName); @@ -482,7 +482,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEffectLocLimited( //get the optional labelName std::string strLabelName; - if (nullptr != labelName) + if (NULL != labelName) { JavaStringParam localLabel(labelName); JavaLibrary::convert(localLabel, strLabelName); @@ -501,7 +501,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playUiEffect(JNIEnv * /*env { JavaStringParam localUiEffectString(uiEffectString); - ServerObject* so = nullptr; + ServerObject* so = NULL; if(!JavaLibrary::getObject(client, so)) { NetworkId const networkId(client); @@ -531,7 +531,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::stopClientEffectObjByLabel( { JavaStringParam localLabel(labelName); - ServerObject* so = nullptr; + ServerObject* so = NULL; if(!JavaLibrary::getObject(objectEffectIsOn, so)) return JNI_FALSE; @@ -545,7 +545,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::stopClientEffectObjByLabel( if (!objectEffectIsOn) return JNI_FALSE; - ServerObject* target = nullptr; + ServerObject* target = NULL; if(!JavaLibrary::getObject(objectEffectIsOn, target)) return JNI_FALSE; if(!target) @@ -578,7 +578,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::stopClientEffectObjByLabelL if (!objectEffectIsOn) return JNI_FALSE; - ServerObject* target = nullptr; + ServerObject* target = NULL; if(!JavaLibrary::getObject(objectEffectIsOn, target)) return JNI_FALSE; if(!target) @@ -604,7 +604,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::play2dNonLoopingMusic(JNIEn { JavaStringParam localMusicName(musicName); - ServerObject* so = nullptr; + ServerObject* so = NULL; if (!JavaLibrary::getObject(client, so)) return JNI_FALSE; Client* c = so->getClient(); @@ -628,7 +628,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::play2dNonLoopingSound(JNIEn { JavaStringParam localMusicName(musicName); - ServerObject* so = nullptr; + ServerObject* so = NULL; if (!JavaLibrary::getObject(client, so)) return JNI_FALSE; Client* c = so->getClient(); @@ -652,7 +652,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playMusicWithParms(JNIEnv * { JavaStringParam localMusicName(musicName); - ServerObject* so = nullptr; + ServerObject* so = NULL; if (!JavaLibrary::getObject(client, so)) return JNI_FALSE; Client* c = so->getClient(); @@ -676,7 +676,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::createClientProjectile(JNIE { JavaStringParam localWeaponObjectTemplateName(weaponObjectTemplateName); - ServerObject* so = nullptr; + ServerObject* so = NULL; if (!JavaLibrary::getObject(client, so)) return JNI_FALSE; @@ -718,7 +718,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::createClientProjectileObjec { JavaStringParam localWeaponObjectTemplateName(weaponObjectTemplateName); - ServerObject* so = nullptr; + ServerObject* so = NULL; if (!JavaLibrary::getObject(client, so)) return JNI_FALSE; @@ -734,14 +734,14 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::createClientProjectileObjec return JNI_FALSE; // Get our source object - ServerObject* sourceObject = nullptr; + ServerObject* sourceObject = NULL; if (!JavaLibrary::getObject(source, sourceObject)) return JNI_FALSE; NetworkId sourceId = sourceObject->getNetworkId(); // The target of our effect - ServerObject* targetObject = nullptr; + ServerObject* targetObject = NULL; if (!JavaLibrary::getObject(target, targetObject)) return JNI_FALSE; @@ -759,8 +759,8 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::createClientProjectileObjec // Source's Cell ID CellProperty const * const cellProperty = sourceObject->getParentCell(); - Object const * const cellObject = (cellProperty != nullptr) ? &cellProperty->getOwner() : nullptr; - NetworkId const & networkIdForCellOrWorld = (cellObject != nullptr) ? cellObject->getNetworkId() : NetworkId::cms_invalid; + Object const * const cellObject = (cellProperty != NULL) ? &cellProperty->getOwner() : NULL; + NetworkId const & networkIdForCellOrWorld = (cellObject != NULL) ? cellObject->getNetworkId() : NetworkId::cms_invalid; CreateClientProjectileObjectToObjectMessage const ccpmoto(weaponObjectTemplateNameString, sourceId, sourceHardpointString, networkIdForCellOrWorld, targetId, targetHardpointString, speed, expiration, trail, PackedArgb(static_cast(a), static_cast(r), static_cast(g), static_cast(b)).getArgb()); @@ -776,7 +776,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::createClientProjectileObje { JavaStringParam localWeaponObjectTemplateName(weaponObjectTemplateName); - ServerObject* so = nullptr; + ServerObject* so = NULL; if (!JavaLibrary::getObject(client, so)) return JNI_FALSE; @@ -792,7 +792,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::createClientProjectileObje return JNI_FALSE; // Get our source object - ServerObject* sourceObject = nullptr; + ServerObject* sourceObject = NULL; if (!JavaLibrary::getObject(source, sourceObject)) return JNI_FALSE; @@ -812,8 +812,8 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::createClientProjectileObje // Source's Cell ID CellProperty const * const cellProperty = sourceObject->getParentCell(); - Object const * const cellObject = (cellProperty != nullptr) ? &cellProperty->getOwner() : nullptr; - NetworkId const & networkIdForCellOrWorld = (cellObject != nullptr) ? cellObject->getNetworkId() : NetworkId::cms_invalid; + Object const * const cellObject = (cellProperty != NULL) ? &cellProperty->getOwner() : NULL; + NetworkId const & networkIdForCellOrWorld = (cellObject != NULL) ? cellObject->getNetworkId() : NetworkId::cms_invalid; CreateClientProjectileObjectToLocationMessage const ccpmotl(weaponObjectTemplateNameString, sourceId, sourceHardpointString, networkIdForCellOrWorld, targetLocationVec, speed, expiration, trail, PackedArgb(static_cast(a), static_cast(r), static_cast(g), static_cast(b)).getArgb()); @@ -829,7 +829,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::createClientProjectileLocat { JavaStringParam localWeaponObjectTemplateName(weaponObjectTemplateName); - ServerObject* so = nullptr; + ServerObject* so = NULL; if (!JavaLibrary::getObject(client, so)) return JNI_FALSE; @@ -845,7 +845,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::createClientProjectileLocat return JNI_FALSE; // Get our target object - ServerObject* targetObject = nullptr; + ServerObject* targetObject = NULL; if (!JavaLibrary::getObject(target, targetObject)) return JNI_FALSE; @@ -865,8 +865,8 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::createClientProjectileLocat // Target's Cell ID CellProperty const * const cellProperty = targetObject->getParentCell(); - Object const * const cellObject = (cellProperty != nullptr) ? &cellProperty->getOwner() : nullptr; - NetworkId const & networkIdForCellOrWorld = (cellObject != nullptr) ? cellObject->getNetworkId() : NetworkId::cms_invalid; + Object const * const cellObject = (cellProperty != NULL) ? &cellProperty->getOwner() : NULL; + NetworkId const & networkIdForCellOrWorld = (cellObject != NULL) ? cellObject->getNetworkId() : NetworkId::cms_invalid; CreateClientProjectileLocationToObjectMessage const ccpmlto(weaponObjectTemplateNameString, sourceLocationVec, networkIdForCellOrWorld, targetId, targetHardpointString, speed, expiration, trail, PackedArgb(static_cast(a), static_cast(r), static_cast(g), static_cast(b)).getArgb()); @@ -878,7 +878,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::createClientProjectileLocat void JNICALL ScriptMethodsClientEffectNamespace::addObjectEffect(JNIEnv * env, jobject self, jlong obj, jstring filename, jstring hardpoint, jobject offset, jfloat scale, jstring label) { - ServerObject* so = nullptr; + ServerObject* so = NULL; if (!JavaLibrary::getObject(obj, so)) return; @@ -909,7 +909,7 @@ void JNICALL ScriptMethodsClientEffectNamespace::addObjectEffect(JNIEnv * env, j } void JNICALL ScriptMethodsClientEffectNamespace::removeObjectEffect(JNIEnv * env, jobject self, jlong obj, jstring label) { - ServerObject* so = nullptr; + ServerObject* so = NULL; if (!JavaLibrary::getObject(obj, so)) return; @@ -929,7 +929,7 @@ void JNICALL ScriptMethodsClientEffectNamespace::removeObjectEffect(JNIEnv * env void JNICALL ScriptMethodsClientEffectNamespace::removeAllObjectEffects(JNIEnv * env, jobject self, jlong obj) { - ServerObject* so = nullptr; + ServerObject* so = NULL; if (!JavaLibrary::getObject(obj, so)) return; @@ -942,7 +942,7 @@ void JNICALL ScriptMethodsClientEffectNamespace::removeAllObjectEffects(JNIEnv * jboolean JNICALL ScriptMethodsClientEffectNamespace::hasObjectEffect(JNIEnv * env, jobject self, jlong obj, jstring label) { - ServerObject* so = nullptr; + ServerObject* so = NULL; if (!JavaLibrary::getObject(obj, so)) return JNI_FALSE; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsClusterWideData.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsClusterWideData.cpp index a93b72ae..19df09ef 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsClusterWideData.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsClusterWideData.cpp @@ -69,7 +69,7 @@ const JNINativeMethod NATIVES[] = { */ LocalRefPtr JavaLibrary::convert(const ValueDictionary & source) { - if (ms_env == nullptr) + if (ms_env == NULL) return LocalRef::cms_nullPtr; // create the dictionary @@ -150,7 +150,7 @@ void JavaLibrary::convert(const jobject & source, ValueDictionary & target) target.clear(); JNIEnv * env = getEnv(); - if (env == nullptr) + if (env == NULL) return; if (!env->IsInstanceOf(source, ms_clsDictionary)) diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsCombat.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsCombat.cpp index fdb842bc..a12763bb 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsCombat.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsCombat.cpp @@ -211,12 +211,12 @@ const JNINativeMethod NATIVES[] = { void JavaLibrary::setupWeaponCombatData(JNIEnv *env, const WeaponObject * weapon, jobject weaponData) { - if (env == nullptr || weaponData == nullptr) + if (env == NULL || weaponData == NULL) return; - if (weapon == nullptr) + if (weapon == NULL) { - env->SetObjectField(weaponData, ms_fidCombatEngineWeaponDataId, nullptr); + env->SetObjectField(weaponData, ms_fidCombatEngineWeaponDataId, NULL); return; } @@ -252,7 +252,7 @@ jint JNICALL ScriptMethodsCombatNamespace::getCombatDuration(JNIEnv * /*env*/, j NetworkId const networkId(object); TangibleObject const * const tangibleObject = TangibleObject::getTangibleObject(networkId); - if (tangibleObject == nullptr) + if (tangibleObject == NULL) { return 0; } @@ -267,7 +267,7 @@ jint JNICALL ScriptMethodsCombatNamespace::getCombatDuration(JNIEnv * /*env*/, j * @param self class calling this function * @param target id of the creature * - * @return the object id of the weapon, or nullptr on error + * @return the object id of the weapon, or NULL on error */ jlong JNICALL ScriptMethodsCombatNamespace::getCurrentWeapon(JNIEnv *env, jobject self, jlong target) { @@ -278,7 +278,7 @@ jlong JNICALL ScriptMethodsCombatNamespace::getCurrentWeapon(JNIEnv *env, jobjec return 0; const WeaponObject * weapon = creature->getCurrentWeapon(); - if (weapon == nullptr) + if (weapon == NULL) return 0; return (weapon->getNetworkId()).getValue(); @@ -313,7 +313,7 @@ jboolean JNICALL ScriptMethodsCombatNamespace::setCurrentWeapon(JNIEnv *env, job * @param self class calling this function * @param target id of the creature * - * @return the object id of the weapon, or nullptr on error + * @return the object id of the weapon, or NULL on error */ jlong JNICALL ScriptMethodsCombatNamespace::getHeldWeapon(JNIEnv *env, jobject self, jlong target) { @@ -324,7 +324,7 @@ jlong JNICALL ScriptMethodsCombatNamespace::getHeldWeapon(JNIEnv *env, jobject s return 0; const WeaponObject * weapon = creature->getReadiedWeapon(); - if (weapon == nullptr) + if (weapon == NULL) return 0; return (weapon->getNetworkId()).getValue(); @@ -337,7 +337,7 @@ jlong JNICALL ScriptMethodsCombatNamespace::getHeldWeapon(JNIEnv *env, jobject s * @param self class calling this function * @param target id of the creature * - * @return the object id of the default weapon, or nullptr on error + * @return the object id of the default weapon, or NULL on error */ jlong JNICALL ScriptMethodsCombatNamespace::getDefaultWeapon(JNIEnv *env, jobject self, jlong target) { @@ -348,7 +348,7 @@ UNREF(self); return 0; const WeaponObject * weapon = creature->getDefaultWeapon(); - if (weapon == nullptr) + if (weapon == NULL) return 0; return (weapon->getNetworkId()).getValue(); @@ -422,7 +422,7 @@ jboolean JNICALL ScriptMethodsCombatNamespace::isDefaultWeapon(JNIEnv *env, jobj return JNI_FALSE; const CreatureObject * owner = dynamic_cast(ContainerInterface::getContainedByObject(*weapon)); - if (owner == nullptr || owner->getDefaultWeapon() != weapon) + if (owner == NULL || owner->getDefaultWeapon() != weapon) return JNI_FALSE; return JNI_TRUE; @@ -441,7 +441,7 @@ jfloat JNICALL ScriptMethodsCombatNamespace::getMinRange(JNIEnv *env, jobject se { UNREF(self); - const WeaponObject *weapon = nullptr; + const WeaponObject *weapon = NULL; if (!JavaLibrary::getObject(weaponId, weapon)) return -1.0f; @@ -462,7 +462,7 @@ jfloat JNICALL ScriptMethodsCombatNamespace::getMaxRange(JNIEnv *env, jobject se { UNREF(self); - const WeaponObject *weapon = nullptr; + const WeaponObject *weapon = NULL; if (!JavaLibrary::getObject(weaponId, weapon)) return -1.0f; @@ -483,7 +483,7 @@ jfloat JNICALL ScriptMethodsCombatNamespace::getAverageDamage(JNIEnv *env, jobje { UNREF(self); - const WeaponObject *weapon = nullptr; + const WeaponObject *weapon = NULL; if (!JavaLibrary::getObject(weaponId, weapon)) return 0; @@ -506,7 +506,7 @@ jint JNICALL ScriptMethodsCombatNamespace::getWeaponType(JNIEnv *env, jobject se { UNREF(self); - const WeaponObject *weapon = nullptr; + const WeaponObject *weapon = NULL; if (!JavaLibrary::getObject(weaponId, weapon)) return -1; @@ -527,7 +527,7 @@ jint JNICALL ScriptMethodsCombatNamespace::getWeaponAttackType(JNIEnv *env, jobj { UNREF(self); - const WeaponObject *weapon = nullptr; + const WeaponObject *weapon = NULL; if (!JavaLibrary::getObject(weaponId, weapon)) return -1; @@ -546,7 +546,7 @@ jint JNICALL ScriptMethodsCombatNamespace::getWeaponDamageType(JNIEnv *env, jobj { UNREF(self); - const WeaponObject *weapon = nullptr; + const WeaponObject *weapon = NULL; if (!JavaLibrary::getObject(weaponId, weapon)) return -1; @@ -590,7 +590,7 @@ jint JNICALL ScriptMethodsCombatNamespace::getWeaponMinDamage(JNIEnv *env, jobje { UNREF(self); - const WeaponObject *weapon = nullptr; + const WeaponObject *weapon = NULL; if (!JavaLibrary::getObject(weaponId, weapon)) return -1; @@ -636,7 +636,7 @@ jint JNICALL ScriptMethodsCombatNamespace::getWeaponMaxDamage(JNIEnv *env, jobje { UNREF(self); - const WeaponObject *weapon = nullptr; + const WeaponObject *weapon = NULL; if (!JavaLibrary::getObject(weaponId, weapon)) return -1; @@ -682,7 +682,7 @@ jfloat JNICALL ScriptMethodsCombatNamespace::getWeaponAttackSpeed(JNIEnv *env, j { UNREF(self); - const WeaponObject *weapon = nullptr; + const WeaponObject *weapon = NULL; if (!JavaLibrary::getObject(weaponId, weapon)) return -1.0f; @@ -728,7 +728,7 @@ jfloat JNICALL ScriptMethodsCombatNamespace::getWeaponWoundChance(JNIEnv *env, j { UNREF(self); - const WeaponObject *weapon = nullptr; + const WeaponObject *weapon = NULL; if (!JavaLibrary::getObject(weaponId, weapon)) return -1.0f; @@ -743,13 +743,13 @@ jfloat JNICALL ScriptMethodsCombatNamespace::getWeaponWoundChance(JNIEnv *env, j * @param self class calling this function * @param weaponId the id of the weapon * - * @return the range info, or nullptr on error + * @return the range info, or null on error */ jobject JNICALL ScriptMethodsCombatNamespace::getWeaponRangeInfo(JNIEnv *env, jobject self, jlong weaponId) { UNREF(self); - const WeaponObject *weapon = nullptr; + const WeaponObject *weapon = NULL; if (!JavaLibrary::getObject(weaponId, weapon)) return 0; @@ -827,7 +827,7 @@ jfloat JNICALL ScriptMethodsCombatNamespace::getWeaponDamageRadius(JNIEnv *env, { UNREF(self); - const WeaponObject *weapon = nullptr; + const WeaponObject *weapon = NULL; if (!JavaLibrary::getObject(weaponId, weapon)) return -1.0f; @@ -865,7 +865,7 @@ jboolean JNICALL ScriptMethodsCombatNamespace::setWeaponDamageRadius(JNIEnv *env */ jfloat JNICALL ScriptMethodsCombatNamespace::getAudibleRange(JNIEnv *env, jobject self, jlong weaponId) { - const WeaponObject *weapon = nullptr; + const WeaponObject *weapon = NULL; if (!JavaLibrary::getObject(weaponId, weapon)) return -1; @@ -887,7 +887,7 @@ jint JNICALL ScriptMethodsCombatNamespace::getWeaponAttackCost(JNIEnv *env, jobj { UNREF(self); - const WeaponObject *weapon = nullptr; + const WeaponObject *weapon = NULL; if (!JavaLibrary::getObject(weaponId, weapon)) return 0; @@ -932,7 +932,7 @@ jint JNICALL ScriptMethodsCombatNamespace::getWeaponAccuracy(JNIEnv *env, jobjec { UNREF(self); - const WeaponObject *weapon = nullptr; + const WeaponObject *weapon = NULL; if (!JavaLibrary::getObject(weaponId, weapon)) return 0; @@ -977,7 +977,7 @@ jint JNICALL ScriptMethodsCombatNamespace::getWeaponElementalType(JNIEnv *env, j { UNREF(self); - const WeaponObject *weapon = nullptr; + const WeaponObject *weapon = NULL; if (!JavaLibrary::getObject(weaponId, weapon)) return 0; @@ -1022,7 +1022,7 @@ jint JNICALL ScriptMethodsCombatNamespace::getWeaponElementalValue(JNIEnv *env, { UNREF(self); - const WeaponObject *weapon = nullptr; + const WeaponObject *weapon = NULL; if (!JavaLibrary::getObject(weaponId, weapon)) return 0; @@ -1218,7 +1218,7 @@ void _startCombat(char const * const functionName, jlong attacker, jlong defende NetworkId const attackerId(attacker); TangibleObject * const attackerTangibleObject = TangibleObject::getTangibleObject(attackerId); - if (attackerTangibleObject == nullptr) + if (attackerTangibleObject == NULL) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsCombat::%s() Unable to resolve the attacker(%s) to a TangibleObject.", functionName, attackerId.getValueString().c_str())); return; @@ -1227,7 +1227,7 @@ void _startCombat(char const * const functionName, jlong attacker, jlong defende NetworkId const defenderId(defender); TangibleObject * const defenderTangibleObject = TangibleObject::getTangibleObject(defenderId); - if (defenderTangibleObject == nullptr) + if (defenderTangibleObject == NULL) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsCombat::%s() attacker(%s) Unable to resolve the defender(%s) to a TangibleObject.", functionName, attackerId.getValueString().c_str(), defenderId.getValueString().c_str())); return; @@ -1302,7 +1302,7 @@ void JNICALL ScriptMethodsCombatNamespace::stopCombat(JNIEnv * /*env*/, jobject NetworkId const objectId(object); TangibleObject * const tangibleObject = TangibleObject::getTangibleObject(objectId); - if (tangibleObject == nullptr) + if (tangibleObject == NULL) { return; } @@ -1334,9 +1334,9 @@ int i; int attackerCount = 0; int defenderCount = 0; - if (attackers != nullptr) + if (attackers != NULL) attackerCount = env->GetArrayLength(attackers); - if (defenders != nullptr) + if (defenders != NULL) defenderCount = env->GetArrayLength(defenders); // get the attacker and weapon data @@ -1348,22 +1348,22 @@ int i; LocalRefPtr weaponData = getObjectArrayElement(LocalObjectArrayRefParam(weaponsData), i); if (!attackerId) { - WARNING(true, ("JavaLibrary::getCombatData got nullptr attacker id")); + WARNING(true, ("JavaLibrary::getCombatData got null attacker id")); return JNI_FALSE; } if (attackerData == LocalRef::cms_nullPtr) { - WARNING(true, ("JavaLibrary::getCombatData got nullptr attacker data")); + WARNING(true, ("JavaLibrary::getCombatData got null attacker data")); return JNI_FALSE; } if (weaponData == LocalRef::cms_nullPtr) { - WARNING(true, ("JavaLibrary::getCombatData got nullptr weapon data")); + WARNING(true, ("JavaLibrary::getCombatData got null weapon data")); return JNI_FALSE; } // set up the attacker data - const TangibleObject * attacker = nullptr; + const TangibleObject * attacker = NULL; if (!JavaLibrary::getObject(attackerId, attacker)) { WARNING(true, ("JavaLibrary::getCombatData cannot get attacker object")); @@ -1377,7 +1377,7 @@ int i; ScriptConversion::convert(attacker->getPosition_p(), attacker->getSceneId(), attackerCell ? attackerCell->getNetworkId() : NetworkId::cms_invalid, location); - if (location.get() == nullptr || location == LocalRef::cms_nullPtr) + if (location.get() == NULL || location == LocalRef::cms_nullPtr) { WARNING(true, ("JavaLibrary::getCombatData cannot convert local position " "of attacker %s to Java", attacker->getNetworkId().getValueString().c_str())); @@ -1390,7 +1390,7 @@ int i; ScriptConversion::convert(attacker->getPosition_w(), attacker->getSceneId(), CellProperty::getWorldCellProperty()->getOwner().getNetworkId(), worldLocation); - if (worldLocation.get() == nullptr || worldLocation == LocalRef::cms_nullPtr) + if (worldLocation.get() == NULL || worldLocation == LocalRef::cms_nullPtr) { WARNING(true, ("JavaLibrary::getCombatData cannot convert world position " "of attacker %s to Java", attacker->getNetworkId().getValueString().c_str())); @@ -1398,14 +1398,14 @@ int i; } } - const WeaponObject * weapon = nullptr; + const WeaponObject * weapon = NULL; bool isCreature = false; int posture = 0; int locomotion = 0; int weaponSkill = 0; int aims = 0; const CreatureObject * creature = dynamic_cast(attacker); - if (creature != nullptr) + if (creature != NULL) { isCreature = true; posture = creature->getPosture(); @@ -1419,7 +1419,7 @@ int i; CombatEngineData::CombatData const * combatData = attacker->getCombatData(); - if (combatData != nullptr) + if (combatData != NULL) { aims = combatData->attackData.aims; } @@ -1446,17 +1446,17 @@ int i; LocalRefPtr defenderData = getObjectArrayElement(LocalObjectArrayRefParam(defendersData), i); if (!defenderId) { - WARNING(true, ("JavaLibrary::getCombatData got nullptr defender id")); + WARNING(true, ("JavaLibrary::getCombatData got null defender id")); return JNI_FALSE; } if (defenderData == LocalRef::cms_nullPtr) { - WARNING(true, ("JavaLibrary::getCombatData got nullptr defender data")); + WARNING(true, ("JavaLibrary::getCombatData got null defender data")); return JNI_FALSE; } // set up the defender data - const TangibleObject * defender = nullptr; + const TangibleObject * defender = NULL; if (!JavaLibrary::getObject(defenderId, defender)) { WARNING(true, ("JavaLibrary::getCombatData cannot get defender object")); @@ -1470,7 +1470,7 @@ int i; ScriptConversion::convert(defender->getPosition_p(), defender->getSceneId(), defenderCell ? defenderCell->getNetworkId() : NetworkId::cms_invalid, location); - if (location.get() == nullptr || location == LocalRef::cms_nullPtr) + if (location.get() == NULL || location == LocalRef::cms_nullPtr) { WARNING(true, ("JavaLibrary::getCombatData cannot convert local position " "of defender %s to Java", defender->getNetworkId().getValueString().c_str())); @@ -1483,7 +1483,7 @@ int i; ScriptConversion::convert(defender->getPosition_w(), defender->getSceneId(), CellProperty::getWorldCellProperty()->getOwner().getNetworkId(), worldLocation); - if (worldLocation.get() == nullptr || worldLocation == LocalRef::cms_nullPtr) + if (worldLocation.get() == NULL || worldLocation == LocalRef::cms_nullPtr) { WARNING(true, ("JavaLibrary::getCombatData cannot convert world position " "of defender %s to Java", defender->getNetworkId().getValueString().c_str())); @@ -1497,7 +1497,7 @@ int i; int combatSkeleton = defender->getCombatSkeleton(); int cover = 0; const CreatureObject * creature = dynamic_cast(defender); - if (creature != nullptr) + if (creature != NULL) { isCreature = true; posture = creature->getPosture(); @@ -1557,7 +1557,7 @@ jboolean JNICALL ScriptMethodsCombatNamespace::getWeaponData(JNIEnv *env, jobjec if (weapon == 0 || weaponData == 0) return JNI_FALSE; - const WeaponObject * localWeapon = nullptr; + const WeaponObject * localWeapon = NULL; if (!JavaLibrary::getObject(weapon, localWeapon)) return JNI_FALSE; @@ -1587,15 +1587,15 @@ jboolean JNICALL ScriptMethodsCombatNamespace::doDamage(JNIEnv *env, jobject sel if (damage <= 0) return JNI_TRUE; - TangibleObject * attacker = nullptr; + TangibleObject * attacker = NULL; if (!JavaLibrary::getObject(attackerId, attacker)) return JNI_FALSE; - TangibleObject * defender = nullptr; + TangibleObject * defender = NULL; if (!JavaLibrary::getObject(defenderId, defender)) return JNI_FALSE; - WeaponObject * weapon = nullptr; + WeaponObject * weapon = NULL; if (!JavaLibrary::getObject(weaponId, weapon)) return JNI_FALSE; @@ -1627,11 +1627,11 @@ jboolean JNICALL ScriptMethodsCombatNamespace::doDamageNoWeapon(JNIEnv *env, job if (damage <= 0) return JNI_TRUE; - TangibleObject * attacker = nullptr; + TangibleObject * attacker = NULL; if (!JavaLibrary::getObject(attackerId, attacker)) return JNI_FALSE; - TangibleObject * defender = nullptr; + TangibleObject * defender = NULL; if (!JavaLibrary::getObject(defenderId, defender)) return JNI_FALSE; @@ -1699,7 +1699,7 @@ jboolean JNICALL ScriptMethodsCombatNamespace::doCombatResults(JNIEnv *env, jobj { message->setAttacker(attacker, weapon); CreatureObject * creature = dynamic_cast(attacker.getObject()); - if (creature != nullptr) + if (creature != NULL) { Postures::Enumerator posture = static_cast( env->GetIntField(attackerResult, JavaLibrary::getFidBaseClassAttackerResultsPosture())); @@ -1816,7 +1816,7 @@ jboolean JNICALL ScriptMethodsCombatNamespace::doCombatResults(JNIEnv *env, jobj // send the message Controller *const controller = attacker.getObject()->getController(); - if (controller != nullptr) + if (controller != NULL) { float f_hold_ms = ConfigServerGame::getCombatDamageDelaySeconds() * 1000.0f; if ( f_hold_ms < 1.0 ) // 0 hold time (allowing for rounding error) @@ -1834,7 +1834,7 @@ jboolean JNICALL ScriptMethodsCombatNamespace::doCombatResults(JNIEnv *env, jobj { MessageQueueCombatAction *held = (MessageQueueCombatAction*)controller->peekHeldMessage( CM_combatAction ); bool b_merge = true; - if ( held == nullptr ) + if ( held == NULL ) b_merge = false; else if ( held->getComparisonChecksum() != message->getComparisonChecksum() ) b_merge = false; @@ -1900,24 +1900,24 @@ jboolean JNICALL ScriptMethodsCombatNamespace::callDefenderCombatAction(JNIEnv * { // use the attacker's current weapon CreatureObject * creatureAttacker = dynamic_cast(attackerId.getObject()); - if (creatureAttacker != nullptr) + if (creatureAttacker != NULL) { const WeaponObject * weaponObject = creatureAttacker->getCurrentWeapon(); - if (weaponObject != nullptr) + if (weaponObject != NULL) weaponId = weaponObject->getNetworkId(); } else { const WeaponObject * weaponAttacker = dynamic_cast( attackerId.getObject()); - if (weaponAttacker != nullptr) + if (weaponAttacker != NULL) weaponId = weaponAttacker->getNetworkId(); } } // call the trigger for each defender - jint * resultsArray = env->GetIntArrayElements(results, nullptr); - if (resultsArray == nullptr) + jint * resultsArray = env->GetIntArrayElements(results, NULL); + if (resultsArray == NULL) return JNI_FALSE; for (jsize i = 0; i < defenderCount; ++i) @@ -1927,11 +1927,11 @@ jboolean JNICALL ScriptMethodsCombatNamespace::callDefenderCombatAction(JNIEnv * if (defender) { CachedNetworkId defenderId(defender); - if (defenderId.getObject() != nullptr) + if (defenderId.getObject() != NULL) { ServerObject * defenderObject = safe_cast( defenderId.getObject()); - if (defenderObject->getScriptObject() != nullptr) + if (defenderObject->getScriptObject() != NULL) { ScriptParams params; params.addParam(attackerId); @@ -1961,7 +1961,7 @@ jboolean JNICALL ScriptMethodsCombatNamespace::callDefenderCombatAction(JNIEnv * */ void JNICALL ScriptMethodsCombatNamespace::setWantSawAttackTriggers(JNIEnv *env, jobject self, jlong obj, jboolean enable) { - TangibleObject * tangible = nullptr; + TangibleObject * tangible = NULL; if (!JavaLibrary::getObject(obj, tangible)) { @@ -2021,7 +2021,7 @@ jboolean JNICALL ScriptMethodsCombatNamespace::addSlowDownEffect(JNIEnv *env, jo return JNI_FALSE; } - CreatureObject * attackerObject = nullptr; + CreatureObject * attackerObject = NULL; if (!JavaLibrary::getObject(attacker, attackerObject)) { WARNING(true, ("[script bug] JavaLibrary::addSlowDownEffect called " @@ -2029,7 +2029,7 @@ jboolean JNICALL ScriptMethodsCombatNamespace::addSlowDownEffect(JNIEnv *env, jo return JNI_FALSE; } - const TangibleObject * defenderObject = nullptr; + const TangibleObject * defenderObject = NULL; if (!JavaLibrary::getObject(defender, defenderObject)) { WARNING(true, ("[script bug] JavaLibrary::addSlowDownEffect called " @@ -2057,7 +2057,7 @@ jboolean JNICALL ScriptMethodsCombatNamespace::addSlowDownEffect(JNIEnv *env, jo */ jboolean JNICALL ScriptMethodsCombatNamespace::removeSlowDownEffect(JNIEnv *env, jobject self, jlong attacker) { - CreatureObject * attackerObject = nullptr; + CreatureObject * attackerObject = NULL; if (!JavaLibrary::getObject(attacker, attackerObject)) { WARNING(true, ("[script bug] JavaLibrary::removeSlowDownEffect called " @@ -2090,14 +2090,14 @@ void JNICALL ScriptMethodsCombatNamespace::sendCombatSpam(JNIEnv *env, jobject s { NetworkId attackerId(attacker); ServerObject * attackerObj = safe_cast(NetworkIdManager::getObjectById(attackerId)); - if (attackerObj == nullptr) + if (attackerObj == NULL) { WARNING(true, ("WARNING: JavaLibrary::sendCombatSpam could not find attacker for id %s", attackerId.getValueString().c_str())); return; } NetworkId defenderId(defender); - Object const * const defenderObj = (defenderId.isValid() ? NetworkIdManager::getObjectById(defenderId) : nullptr); + Object const * const defenderObj = (defenderId.isValid() ? NetworkIdManager::getObjectById(defenderId) : NULL); NetworkId weaponId(weapon); StringId attackNameSid; @@ -2189,14 +2189,14 @@ void JNICALL ScriptMethodsCombatNamespace::sendCombatSpamWeaponString(JNIEnv *en { NetworkId attackerId(attacker); ServerObject * attackerObj = safe_cast(NetworkIdManager::getObjectById(attackerId)); - if (attackerObj == nullptr) + if (attackerObj == NULL) { WARNING(true, ("WARNING: JavaLibrary::sendCombatSpam could not find attacker for id %s", attackerId.getValueString().c_str())); return; } NetworkId defenderId(defender); - Object const * const defenderObj = (defenderId.isValid() ? NetworkIdManager::getObjectById(defenderId) : nullptr); + Object const * const defenderObj = (defenderId.isValid() ? NetworkIdManager::getObjectById(defenderId) : NULL); StringId weaponNameSid; if (!ScriptConversion::convert(weaponName, weaponNameSid)) @@ -2287,12 +2287,12 @@ void JNICALL ScriptMethodsCombatNamespace::sendCombatSpamWeaponString(JNIEnv *en */ void JNICALL ScriptMethodsCombatNamespace::sendCombatSpamMessage(JNIEnv *env, jobject self, jlong attacker, jlong defender, jobject message, jboolean sendToAttacker, jboolean sendToDefender, jboolean sendToBystanders, jint spamType) { - ServerObject * attackerObj = nullptr; + ServerObject * attackerObj = NULL; if (!JavaLibrary::getObject(attacker, attackerObj)) return; NetworkId defenderId(defender); - Object const * const defenderObj = (defenderId.isValid() ? NetworkIdManager::getObjectById(defenderId) : nullptr); + Object const * const defenderObj = (defenderId.isValid() ? NetworkIdManager::getObjectById(defenderId) : NULL); StringId messageSid; if (!ScriptConversion::convert(message, messageSid)) @@ -2322,12 +2322,12 @@ void JNICALL ScriptMethodsCombatNamespace::sendCombatSpamMessage(JNIEnv *env, jo */ void JNICALL ScriptMethodsCombatNamespace::sendCombatSpamMessageCGP(JNIEnv *env, jobject self, jlong attacker, jlong defender, jobject message, jboolean sendToAttacker, jboolean sendToDefender, jboolean sendToBystanders, jboolean critical, jboolean glancing, jboolean proc, jint spamType) { - ServerObject * attackerObj = nullptr; + ServerObject * attackerObj = NULL; if (!JavaLibrary::getObject(attacker, attackerObj)) return; NetworkId defenderId(defender); - Object const * const defenderObj = (defenderId.isValid() ? NetworkIdManager::getObjectById(defenderId) : nullptr); + Object const * const defenderObj = (defenderId.isValid() ? NetworkIdManager::getObjectById(defenderId) : NULL); StringId messageSid; if (!ScriptConversion::convert(message, messageSid)) @@ -2353,12 +2353,12 @@ void JNICALL ScriptMethodsCombatNamespace::sendCombatSpamMessageCGP(JNIEnv *env, */ void JNICALL ScriptMethodsCombatNamespace::sendCombatSpamMessageOob(JNIEnv *env, jobject self, jlong attacker, jlong defender, jstring oob, jboolean sendToAttacker, jboolean sendToDefender, jboolean sendToBystanders, jint spamType) { - ServerObject * attackerObj = nullptr; + ServerObject * attackerObj = NULL; if (!JavaLibrary::getObject(attacker, attackerObj)) return; NetworkId defenderId(defender); - Object const * const defenderObj = (defenderId.isValid() ? NetworkIdManager::getObjectById(defenderId) : nullptr); + Object const * const defenderObj = (defenderId.isValid() ? NetworkIdManager::getObjectById(defenderId) : NULL); Unicode::String oobString; if (!JavaLibrary::convert(JavaStringParam(oob), oobString)) diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsCommandQueue.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsCommandQueue.cpp index c95a74cb..2e400a0b 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsCommandQueue.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsCommandQueue.cpp @@ -97,7 +97,7 @@ jboolean JNICALL ScriptMethodsCommandQueueNamespace::queueCommand(JNIEnv *env, j NetworkId actorId(actor); TangibleObject * const actorTangibleObject = TangibleObject::getTangibleObject(actorId); - if (actorTangibleObject == nullptr) + if (actorTangibleObject == NULL) { WARNING(true, ("JavaLibrary::queueCommand() Unable to resolve actor(%s) to a TangibleObject", actorId.getValueString().c_str())); return JNI_FALSE; @@ -142,7 +142,7 @@ jboolean JNICALL ScriptMethodsCommandQueueNamespace::queueClear(JNIEnv *env, job NetworkId actorId(actor); TangibleObject * const actorTangibleObject = TangibleObject::getTangibleObject(actorId); - if (actorTangibleObject == nullptr) + if (actorTangibleObject == NULL) { WARNING(true, ("JavaLibrary::queueClear() Unable to resolve actor(%s) to a TangibleObject", actorId.getValueString().c_str())); return JNI_FALSE; @@ -170,7 +170,7 @@ jboolean JNICALL ScriptMethodsCommandQueueNamespace::queueHasCommandFromGroup(JN NetworkId actorId(actor); TangibleObject * const actorTangibleObject = TangibleObject::getTangibleObject(actorId); - if (actorTangibleObject == nullptr) + if (actorTangibleObject == NULL) { WARNING(true, ("JavaLibrary::queueHasCommandFromGroup() Unable to resolve actor(%s) to a TangibleObject", actorId.getValueString().c_str())); return JNI_FALSE; @@ -196,7 +196,7 @@ jboolean JNICALL ScriptMethodsCommandQueueNamespace::queueClearCommandsFromGroup NetworkId actorId(actor); TangibleObject * const actorTangibleObject = TangibleObject::getTangibleObject(actorId); - if (actorTangibleObject == nullptr) + if (actorTangibleObject == NULL) { WARNING(true, ("JavaLibrary::queueClearCommandsFromGroup() Unable to resolve actor(%s) to a TangibleObject", actorId.getValueString().c_str())); return JNI_FALSE; @@ -239,14 +239,14 @@ jboolean JNICALL ScriptMethodsCommandQueueNamespace::setCommandTimerValue( JNIEn NetworkId actorId(actor); TangibleObject * const actorTangibleObject = TangibleObject::getTangibleObject(actorId); - if (actorTangibleObject == nullptr) + if (actorTangibleObject == NULL) { WARNING(true, ("JavaLibrary::setCommandTimerValue() Unable to resolve actor(%s) to a TangibleObject", actorId.getValueString().c_str())); return JNI_FALSE; } CommandQueue * const queue = actorTangibleObject->getCommandQueue(); - if (queue == nullptr) + if (queue == NULL) { WARNING(true, ("JavaLibrary::setCommandTimerValue() object(%s) does not have a CommandQueue", actorTangibleObject->getDebugInformation().c_str())); return JNI_FALSE; @@ -267,7 +267,7 @@ jint JNICALL ScriptMethodsCommandQueueNamespace::getCurrentCommand( JNIEnv *env, NetworkId actorId(actor); TangibleObject * const actorTangibleObject = TangibleObject::getTangibleObject(actorId); - if (actorTangibleObject == nullptr) + if (actorTangibleObject == NULL) { WARNING(true, ("JavaLibrary::getCurrentCommand() Unable to resolve actor(%s) to a TangibleObject", actorId.getValueString().c_str())); return 0; @@ -275,7 +275,7 @@ jint JNICALL ScriptMethodsCommandQueueNamespace::getCurrentCommand( JNIEnv *env, CommandQueue const * const queue = actorTangibleObject->getCommandQueue(); - if (queue == nullptr) + if (queue == NULL) { WARNING(true, ("JavaLibrary::getCurrentCommand() object(%s) does not have a CommandQueue", actorTangibleObject->getDebugInformation().c_str())); return 0; @@ -298,7 +298,7 @@ jfloat JNICALL ScriptMethodsCommandQueueNamespace::getCooldownTimeLeft( JNIEnv * NetworkId actorId(actor); TangibleObject * const actorTangibleObject = TangibleObject::getTangibleObject(actorId); - if (actorTangibleObject == nullptr) + if (actorTangibleObject == NULL) { WARNING(true, ("JavaLibrary::getCooldownTimeLeft() Unable to resolve actor(%s) to a TangibleObject", actorId.getValueString().c_str())); return 0.0f; @@ -306,7 +306,7 @@ jfloat JNICALL ScriptMethodsCommandQueueNamespace::getCooldownTimeLeft( JNIEnv * CommandQueue const * const queue = actorTangibleObject->getCommandQueue(); - if (queue == nullptr) + if (queue == NULL) { WARNING(true, ("JavaLibrary::getCooldownTimeLeft() object(%s) does not have a CommandQueue", actorTangibleObject->getDebugInformation().c_str())); return 0.0f; @@ -329,7 +329,7 @@ jfloat JNICALL ScriptMethodsCommandQueueNamespace::getCooldownTimeLeftString( JN NetworkId actorId(actor); TangibleObject * const actorTangibleObject = TangibleObject::getTangibleObject(actorId); - if (actorTangibleObject == nullptr) + if (actorTangibleObject == NULL) { WARNING(true, ("JavaLibrary::getCooldownTimeLeftString() Unable to resolve actor(%s) to a TangibleObject", actorId.getValueString().c_str())); return 0.0f; @@ -347,13 +347,13 @@ jfloat JNICALL ScriptMethodsCommandQueueNamespace::getCooldownTimeLeftString( JN CommandQueue const * const queue = actorTangibleObject->getCommandQueue(); float value = 0.0f; - if (queue == nullptr) + if (queue == NULL) { WARNING(true, ("JavaLibrary::getCooldownTimeLeftString() object(%s) does not have a CommandQueue", actorTangibleObject->getDebugInformation().c_str())); return 0.0f; } - if (queue != nullptr) + if (queue != NULL) { value = queue->getCooldownTimeLeft( out ); } @@ -369,7 +369,7 @@ void JNICALL ScriptMethodsCommandQueueNamespace::sendCooldownGroupTimingOnly(JNI NetworkId actorId(actor); CreatureObject * const actorCreatureObject = CreatureObject::getCreatureObject(actorId); - if (actorCreatureObject == nullptr) + if (actorCreatureObject == NULL) { WARNING(true, ("JavaLibrary::sendCooldownGroupTimingOnly() Unable to resolve actor(%s) to a CreatureObject", actorId.getValueString().c_str())); return; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsConsole.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsConsole.cpp index 0355fb72..9392677f 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsConsole.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsConsole.cpp @@ -52,10 +52,10 @@ void JNICALL ScriptMethodsConsoleNamespace::consoleSendMessageObjId(JNIEnv * env const ServerObject* player = 0; if(!JavaLibrary::getObject(_to, player)) { - DEBUG_WARNING (true, ("ScriptMethodsConsole JavaLibrary::consoleSendMessageObjId failed bad source object (not nullptr)")); + DEBUG_WARNING (true, ("ScriptMethodsConsole JavaLibrary::consoleSendMessageObjId failed bad source object (not null)")); if (ConfigServerScript::allowDebugConsoleMessages()) { - fprintf(stderr, "WARNING: ScriptMethodsConsole JavaLibrary::consoleSendMessageObjId: failed bad source object (not nullptr)\n"); + fprintf(stderr, "WARNING: ScriptMethodsConsole JavaLibrary::consoleSendMessageObjId: failed bad source object (not null)\n"); JavaLibrary::printJavaStack(); } return; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsContainers.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsContainers.cpp index acb9aba9..12a63612 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsContainers.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsContainers.cpp @@ -136,7 +136,7 @@ const JNINativeMethod NATIVES[] = { jint JNICALL ScriptMethodsContainersNamespace::getContainerType(JNIEnv *env, jobject self, jlong container) { //@todo use enum - ServerObject * containerOwner = nullptr; + ServerObject * containerOwner = NULL; if (!JavaLibrary::getObject(container, containerOwner)) return 0; @@ -151,7 +151,7 @@ jint JNICALL ScriptMethodsContainersNamespace::getContainerType(JNIEnv *env, job jlongArray JNICALL ScriptMethodsContainersNamespace::getContents(JNIEnv *env, jobject self, jlong containerObj) { - ServerObject * containerOwner = nullptr; + ServerObject * containerOwner = NULL; if (!JavaLibrary::getObject(containerObj, containerOwner)) return 0; @@ -190,7 +190,7 @@ jlongArray JNICALL ScriptMethodsContainersNamespace::getContents(JNIEnv *env, jo jlong JNICALL ScriptMethodsContainersNamespace::getContainedBy(JNIEnv *env, jobject self, jlong item) { - ServerObject * itemObj = nullptr; + ServerObject * itemObj = NULL; if (!JavaLibrary::getObject(item, itemObj)) return 0; @@ -211,7 +211,7 @@ jboolean JNICALL ScriptMethodsContainersNamespace::contains(JNIEnv *env, jobject if (container_id.getValue() == 0) return JNI_FALSE; - ServerObject * itemObj = nullptr; + ServerObject * itemObj = NULL; if (!JavaLibrary::getObject(item, itemObj)) return JNI_FALSE; @@ -226,11 +226,11 @@ jboolean JNICALL ScriptMethodsContainersNamespace::contains(JNIEnv *env, jobject jint JNICALL ScriptMethodsContainersNamespace::canPutIn(JNIEnv *env, jobject self, jlong target, jlong jcontainer) { const int unknownError = static_cast(Container::CEC_Unknown); - ServerObject * containerOwner = nullptr; + ServerObject * containerOwner = NULL; if (!JavaLibrary::getObject(jcontainer, containerOwner)) return unknownError; - ServerObject * item = nullptr; + ServerObject * item = NULL; if (!JavaLibrary::getObject(target, item)) return unknownError; @@ -248,11 +248,11 @@ jint JNICALL ScriptMethodsContainersNamespace::canPutIn(JNIEnv *env, jobject sel jint JNICALL ScriptMethodsContainersNamespace::canPutInSlot(JNIEnv *env, jobject self, jlong target, jlong jcontainer, jstring slot) { const int unknownError = static_cast(Container::CEC_Unknown); - ServerObject * containerOwner = nullptr; + ServerObject * containerOwner = NULL; if (!JavaLibrary::getObject(jcontainer, containerOwner)) return unknownError; - ServerObject * item = nullptr; + ServerObject * item = NULL; if (!JavaLibrary::getObject(target, item)) return unknownError; @@ -268,7 +268,7 @@ jint JNICALL ScriptMethodsContainersNamespace::canPutInSlot(JNIEnv *env, jobject if (slotId == SlotId::invalid) return static_cast(Container::CEC_NoSlot); - IGNORE_RETURN(ContainerInterface::canTransferToSlot(*containerOwner, *item, slotId, nullptr, tmp)); + IGNORE_RETURN(ContainerInterface::canTransferToSlot(*containerOwner, *item, slotId, NULL, tmp)); return static_cast(tmp); } @@ -279,7 +279,7 @@ jlong JNICALL ScriptMethodsContainersNamespace::getObjectInSlot(JNIEnv *env, job { JavaStringParam localSlot(slot); - ServerObject * containerOwner = nullptr; + ServerObject * containerOwner = NULL; if (!JavaLibrary::getObject(container, containerOwner)) return 0; @@ -301,7 +301,7 @@ jlong JNICALL ScriptMethodsContainersNamespace::getObjectInSlot(JNIEnv *env, job jlong JNICALL ScriptMethodsContainersNamespace::getFirstParentInWorld(JNIEnv *env, jobject self, jlong item) { - ServerObject * itemObj = nullptr; + ServerObject * itemObj = NULL; if (!JavaLibrary::getObject(item, itemObj)) return 0; @@ -316,7 +316,7 @@ jlong JNICALL ScriptMethodsContainersNamespace::getFirstParentInWorld(JNIEnv *en jlong JNICALL ScriptMethodsContainersNamespace::getTopMostContainer(JNIEnv *env, jobject self, jlong item) { - ServerObject * itemObj = nullptr; + ServerObject * itemObj = NULL; if (!JavaLibrary::getObject(item, itemObj)) return 0; @@ -331,7 +331,7 @@ jlong JNICALL ScriptMethodsContainersNamespace::getTopMostContainer(JNIEnv *env, jint JNICALL ScriptMethodsContainersNamespace::getNumItemsIn(JNIEnv *env, jobject self, jlong container) { - ServerObject * containerOwner = nullptr; + ServerObject * containerOwner = NULL; if (!JavaLibrary::getObject(container, containerOwner)) return 0; @@ -347,7 +347,7 @@ jint JNICALL ScriptMethodsContainersNamespace::getNumItemsIn(JNIEnv *env, jobjec void JNICALL ScriptMethodsContainersNamespace::destroyContents(JNIEnv *env, jobject self, jlong container) { #if 0 //@todo implement - ServerObject * containerOwner = nullptr; + ServerObject * containerOwner = NULL; if (!JavaLibrary::getObject(container, containerOwner)) return; @@ -359,11 +359,11 @@ void JNICALL ScriptMethodsContainersNamespace::destroyContents(JNIEnv *env, jobj jint JNICALL ScriptMethodsContainersNamespace::moveContents(JNIEnv *env, jobject self, jlong containerA, jlong containerB) { - ServerObject * containerOwner = nullptr; + ServerObject * containerOwner = NULL; if (!JavaLibrary::getObject(containerA, containerOwner)) return 0; - ServerObject * targetContainer = nullptr; + ServerObject * targetContainer = NULL; if (!JavaLibrary::getObject(containerB, targetContainer)) return 0; @@ -377,7 +377,7 @@ jint JNICALL ScriptMethodsContainersNamespace::moveContents(JNIEnv *env, jobject for (; iter != container->end(); ++iter) { ServerObject* item = safe_cast((*iter).getObject()); - if (item && ContainerInterface::transferItemToGeneralContainer(*targetContainer, *item, nullptr, tmp)) + if (item && ContainerInterface::transferItemToGeneralContainer(*targetContainer, *item, NULL, tmp)) { ++count; } @@ -389,20 +389,20 @@ jint JNICALL ScriptMethodsContainersNamespace::moveContents(JNIEnv *env, jobject jint JNICALL ScriptMethodsContainersNamespace::moveObjects(JNIEnv *env, jobject self, jlongArray targets, jlong container) { - ServerObject * containerOwner = nullptr; + ServerObject * containerOwner = NULL; if (!JavaLibrary::getObject(container, containerOwner)) return 0; int count = 0; for (int i = 0; i < env->GetArrayLength(targets); ++i) { - ServerObject * itemObj = nullptr; + ServerObject * itemObj = NULL; jlong jlongTmp; env->GetLongArrayRegion(targets, i, 1, &jlongTmp); if (JavaLibrary::getObject(jlongTmp, itemObj)) { Container::ContainerErrorCode tmp = Container::CEC_Success; - if (ContainerInterface::transferItemToGeneralContainer(*containerOwner, *itemObj, nullptr, tmp)) + if (ContainerInterface::transferItemToGeneralContainer(*containerOwner, *itemObj, NULL, tmp)) { ++count; } @@ -417,15 +417,15 @@ jint JNICALL ScriptMethodsContainersNamespace::moveObjects(JNIEnv *env, jobject jboolean JNICALL ScriptMethodsContainersNamespace::putIn(JNIEnv *env, jobject self, jlong item, jlong container) { - ServerObject * containerOwner = nullptr; + ServerObject * containerOwner = NULL; if (!JavaLibrary::getObject(container, containerOwner)) return JNI_FALSE; - ServerObject * itemObj = nullptr; + ServerObject * itemObj = NULL; if (!JavaLibrary::getObject(item, itemObj)) return JNI_FALSE; Container::ContainerErrorCode tmp = Container::CEC_Success; - return ContainerInterface::transferItemToGeneralContainer(*containerOwner, *itemObj, nullptr, tmp); + return ContainerInterface::transferItemToGeneralContainer(*containerOwner, *itemObj, NULL, tmp); } @@ -434,11 +434,11 @@ jboolean JNICALL ScriptMethodsContainersNamespace::putIn(JNIEnv *env, jobject se jboolean JNICALL ScriptMethodsContainersNamespace::putInPosition(JNIEnv *env, jobject self, jlong item, jlong container, jobject pos) { - ServerObject * containerOwner = nullptr; + ServerObject * containerOwner = NULL; if (!JavaLibrary::getObject(container, containerOwner)) return JNI_FALSE; - ServerObject * itemObj = nullptr; + ServerObject * itemObj = NULL; if (!JavaLibrary::getObject(item, itemObj)) return JNI_FALSE; @@ -451,7 +451,7 @@ jboolean JNICALL ScriptMethodsContainersNamespace::putInPosition(JNIEnv *env, jo tr.setPosition_p(newPos); Container::ContainerErrorCode tmp = Container::CEC_Success; - return ContainerInterface::transferItemToCell(*containerOwner, *itemObj, tr, nullptr, tmp); + return ContainerInterface::transferItemToCell(*containerOwner, *itemObj, tr, NULL, tmp); } //-------------------------------------------------------------------------------------- @@ -459,20 +459,20 @@ jboolean JNICALL ScriptMethodsContainersNamespace::putInPosition(JNIEnv *env, jo jboolean JNICALL ScriptMethodsContainersNamespace::putInAndSendError(JNIEnv *env, jobject self, jlong item, jlong container, jlong player) { - ServerObject * containerOwner = nullptr; + ServerObject * containerOwner = NULL; if (!JavaLibrary::getObject(container, containerOwner)) return JNI_FALSE; - ServerObject * itemObj = nullptr; + ServerObject * itemObj = NULL; if (!JavaLibrary::getObject(item, itemObj)) return JNI_FALSE; Container::ContainerErrorCode tmp = Container::CEC_Success; - bool retval = ContainerInterface::transferItemToGeneralContainer(*containerOwner, *itemObj, nullptr, tmp); + bool retval = ContainerInterface::transferItemToGeneralContainer(*containerOwner, *itemObj, NULL, tmp); if (!retval) { - ServerObject * playerObj = nullptr; + ServerObject * playerObj = NULL; if (!JavaLibrary::getObject(player, playerObj)) return JNI_FALSE; ContainerInterface::sendContainerMessageToClient(*playerObj, tmp); @@ -483,11 +483,11 @@ jboolean JNICALL ScriptMethodsContainersNamespace::putInAndSendError(JNIEnv *env //-------------------------------------------------------------------------------------- jboolean JNICALL ScriptMethodsContainersNamespace::putInOverloaded(JNIEnv *env, jobject self, jlong item, jlong container) { - ServerObject * containerOwner = nullptr; + ServerObject * containerOwner = NULL; if (!JavaLibrary::getObject(container, containerOwner)) return JNI_FALSE; - ServerObject * itemObj = nullptr; + ServerObject * itemObj = NULL; if (!JavaLibrary::getObject(item, itemObj)) return JNI_FALSE; @@ -500,7 +500,7 @@ jboolean JNICALL ScriptMethodsContainersNamespace::putInOverloaded(JNIEnv *env, } else { - retval = ContainerInterface::transferItemToVolumeContainer(*containerOwner, *itemObj, nullptr, tmp, true); + retval = ContainerInterface::transferItemToVolumeContainer(*containerOwner, *itemObj, NULL, tmp, true); } return retval; @@ -509,11 +509,11 @@ jboolean JNICALL ScriptMethodsContainersNamespace::putInOverloaded(JNIEnv *env, //-------------------------------------------------------------------------------------- jboolean JNICALL ScriptMethodsContainersNamespace::equip(JNIEnv *env, jobject self, jlong item, jlong container) { - ServerObject * containerOwner = nullptr; + ServerObject * containerOwner = NULL; if (!JavaLibrary::getObject(container, containerOwner)) return JNI_FALSE; - ServerObject * itemObj = nullptr; + ServerObject * itemObj = NULL; if (!JavaLibrary::getObject(item, itemObj)) return JNI_FALSE; @@ -521,7 +521,7 @@ jboolean JNICALL ScriptMethodsContainersNamespace::equip(JNIEnv *env, jobject se if (!test) return JNI_FALSE; Container::ContainerErrorCode tmp = Container::CEC_Success; - return ContainerInterface::transferItemToGeneralContainer(*containerOwner, *itemObj, nullptr, tmp); + return ContainerInterface::transferItemToGeneralContainer(*containerOwner, *itemObj, NULL, tmp); } @@ -532,11 +532,11 @@ jboolean JNICALL ScriptMethodsContainersNamespace::equipIn(JNIEnv *env, jobject JavaStringParam localSlot(slot); //@todo better error checking for invalid slot name. Do it above too. - ServerObject * containerOwner = nullptr; + ServerObject * containerOwner = NULL; if (!JavaLibrary::getObject(container, containerOwner)) return JNI_FALSE; - ServerObject * itemObj = nullptr; + ServerObject * itemObj = NULL; if (!JavaLibrary::getObject(item, itemObj)) return JNI_FALSE; @@ -554,7 +554,7 @@ jboolean JNICALL ScriptMethodsContainersNamespace::equipIn(JNIEnv *env, jobject Container::ContainerErrorCode tmp = Container::CEC_Success; int arrangement = slotted ? slotted->getBestArrangementForSlot(slotName) : -1; - return ContainerInterface::transferItemToSlottedContainer(*containerOwner, *itemObj, arrangement, nullptr, tmp); + return ContainerInterface::transferItemToSlottedContainer(*containerOwner, *itemObj, arrangement, NULL, tmp); } @@ -565,14 +565,14 @@ jboolean JNICALL ScriptMethodsContainersNamespace::equipOverride(JNIEnv *env, j //This function will equip and object into the first valid arrangement, deleting objects if necessary. //Before it deletes things, it looks for a valid unoccupied arrangement. - ServerObject * containerOwner = nullptr; + ServerObject * containerOwner = NULL; if (!JavaLibrary::getObject(container, containerOwner)) { DEBUG_WARNING(true, ("JNI: EquipOverride param container could not be found")); return JNI_FALSE; } - ServerObject * itemObj = nullptr; + ServerObject * itemObj = NULL; if (!JavaLibrary::getObject(item, itemObj)) { DEBUG_WARNING(true, ("JNI: EquipOverride param item could not be found")); @@ -592,7 +592,7 @@ jboolean JNICALL ScriptMethodsContainersNamespace::equipOverride(JNIEnv *env, j if (slotContainer->getFirstUnoccupiedArrangement(*itemObj, arrangement, tmp)) { //Found one - return ContainerInterface::transferItemToSlottedContainer(*containerOwner, *itemObj, arrangement, nullptr, tmp); + return ContainerInterface::transferItemToSlottedContainer(*containerOwner, *itemObj, arrangement, NULL, tmp); } //Couldn't find an unoccupied arrangement, so it's time to delete objects to make room for this one @@ -634,14 +634,14 @@ jboolean JNICALL ScriptMethodsContainersNamespace::equipOverride(JNIEnv *env, j } } - return ContainerInterface::transferItemToSlottedContainer(*containerOwner, *itemObj, arrangement, nullptr, tmp); + return ContainerInterface::transferItemToSlottedContainer(*containerOwner, *itemObj, arrangement, NULL, tmp); } //-------------------------------------------------------------------------------------- jint JNICALL ScriptMethodsContainersNamespace::getFilledVolume(JNIEnv *env, jobject self, jlong container) { - ServerObject * containerOwner = nullptr; + ServerObject * containerOwner = NULL; if (!JavaLibrary::getObject(container, containerOwner)) return 0; @@ -656,7 +656,7 @@ jint JNICALL ScriptMethodsContainersNamespace::getFilledVolume(JNIEnv *env, jobj jint JNICALL ScriptMethodsContainersNamespace::getTotalVolume(JNIEnv *env, jobject self, jlong container) { - ServerObject * containerOwner = nullptr; + ServerObject * containerOwner = NULL; if (!JavaLibrary::getObject(container, containerOwner)) return 0; @@ -672,7 +672,7 @@ jint JNICALL ScriptMethodsContainersNamespace::getTotalVolume(JNIEnv *env, jobje jint JNICALL ScriptMethodsContainersNamespace::getVolumeFree(JNIEnv *env, jobject self, jlong container) { - ServerObject * containerOwner = nullptr; + ServerObject * containerOwner = NULL; if (!JavaLibrary::getObject(container, containerOwner)) return 0; @@ -691,7 +691,7 @@ void JNICALL ScriptMethodsContainersNamespace::sendContainerErrorToClient(JNIEnv if (errorCode == 0) return; - ServerObject * playerObject = nullptr; + ServerObject * playerObject = NULL; if (!JavaLibrary::getObject(player, playerObject)) { DEBUG_WARNING(true, ("Player object not found in sendContainerErrorToClient")); @@ -767,7 +767,7 @@ void JNICALL ScriptMethodsContainersNamespace::moveToOfflinePlayerDatapadAndUnlo jboolean JNICALL ScriptMethodsContainersNamespace::isInSecureTrade(JNIEnv *env, jobject self, jlong item) { - ServerObject * itemObj = nullptr; + ServerObject * itemObj = NULL; if (!JavaLibrary::getObject(item, itemObj)) return JNI_FALSE; @@ -807,7 +807,7 @@ void JNICALL ScriptMethodsContainersNamespace::fixLoadWith(JNIEnv *env, jobject jboolean JNICALL ScriptMethodsContainersNamespace::addUserToAccessList(JNIEnv *env, jobject self, jlong object, jlong user) { - ServerObject * itemObj = nullptr; + ServerObject * itemObj = NULL; if (!JavaLibrary::getObject(object, itemObj)) return JNI_FALSE; @@ -829,7 +829,7 @@ jboolean JNICALL ScriptMethodsContainersNamespace::addUserToAccessList(JNIEnv *e jboolean JNICALL ScriptMethodsContainersNamespace::removeUserFromAccessList(JNIEnv * env, jobject self, jlong object, jlong user) { - ServerObject * itemObj = nullptr; + ServerObject * itemObj = NULL; if (!JavaLibrary::getObject(object, itemObj)) return JNI_FALSE; @@ -851,7 +851,7 @@ jboolean JNICALL ScriptMethodsContainersNamespace::removeUserFromAccessList(JNIE jboolean JNICALL ScriptMethodsContainersNamespace::clearUserAccessList(JNIEnv * env, jobject self, jlong object) { - ServerObject * itemObj = nullptr; + ServerObject * itemObj = NULL; if (!JavaLibrary::getObject(object, itemObj)) return JNI_FALSE; @@ -871,7 +871,7 @@ jboolean JNICALL ScriptMethodsContainersNamespace::clearUserAccessList(JNIEnv * jboolean JNICALL ScriptMethodsContainersNamespace::addGuildToAccessList(JNIEnv *env, jobject self, jlong object, jint guild) { - ServerObject * itemObj = nullptr; + ServerObject * itemObj = NULL; if (!JavaLibrary::getObject(object, itemObj)) return JNI_FALSE; @@ -891,7 +891,7 @@ jboolean JNICALL ScriptMethodsContainersNamespace::addGuildToAccessList(JNIEnv * jboolean JNICALL ScriptMethodsContainersNamespace::removeGuildFromAccessList(JNIEnv * env, jobject self, jlong object, jint guild) { - ServerObject * itemObj = nullptr; + ServerObject * itemObj = NULL; if (!JavaLibrary::getObject(object, itemObj)) return JNI_FALSE; @@ -911,7 +911,7 @@ jboolean JNICALL ScriptMethodsContainersNamespace::removeGuildFromAccessList(JNI jboolean JNICALL ScriptMethodsContainersNamespace::clearGuildAccessList(JNIEnv * env, jobject self, jlong object) { - ServerObject * itemObj = nullptr; + ServerObject * itemObj = NULL; if (!JavaLibrary::getObject(object, itemObj)) return JNI_FALSE; @@ -931,7 +931,7 @@ jboolean JNICALL ScriptMethodsContainersNamespace::clearGuildAccessList(JNIEnv * jlongArray JNICALL ScriptMethodsContainersNamespace::getUserAccessList(JNIEnv * env, jobject self, jlong object) { - ServerObject * itemObj = nullptr; + ServerObject * itemObj = NULL; if (!JavaLibrary::getObject(object, itemObj)) return JNI_FALSE; @@ -970,7 +970,7 @@ jlongArray JNICALL ScriptMethodsContainersNamespace::getUserAccessList(JNIEnv * jintArray JNICALL ScriptMethodsContainersNamespace::getGuildAccessList(JNIEnv * env, jobject self, jlong object) { - ServerObject * itemObj = nullptr; + ServerObject * itemObj = NULL; if (!JavaLibrary::getObject(object, itemObj)) return JNI_FALSE; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsCrafting.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsCrafting.cpp index 735a0d23..b5d325eb 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsCrafting.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsCrafting.cpp @@ -232,7 +232,7 @@ void ScriptMethodsCraftingNamespace::collectRangedIntVariableCallback(const std: * @param draftSchematic draft schematic the attribute belongs to * @param attribIndex index of the attribute * - * @return the attribute instance, or nullptr on error + * @return the attribute instance, or NULL on error */ LocalRefPtr JavaLibrary::createObjectAttribute(const ManufactureObjectInterface & manfSchematic, const DraftSchematicObject & draftSchematic, int attribIndex) @@ -291,7 +291,7 @@ LocalRefPtr JavaLibrary::createObjectAttribute(const ManufactureObjectInterface * @param manfSchematic manufacture schematic the attribute belongs to * @param attribName name of the attribute * - * @return the attribute instance, or nullptr on error + * @return the attribute instance, or NULL on error */ LocalRefPtr JavaLibrary::createExperimentAttribute(const ManufactureObjectInterface & manfSchematic, const StringId & attribName) @@ -341,7 +341,7 @@ int i; const DraftSchematicObject * draft = DraftSchematicObject::getSchematic( source.getDraftSchematic()); - if (draft == nullptr) + if (draft == NULL) return LocalRef::cms_nullPtr; LocalRefPtr target = allocObject(ms_clsDraftSchematic); @@ -501,7 +501,7 @@ int i; // set the customization info from the shared object template const ServerObjectTemplate * objectTemplate = draft->getCraftedObjectTemplate(); - if (objectTemplate == nullptr) + if (objectTemplate == NULL) { return LocalRef::cms_nullPtr; } @@ -509,7 +509,7 @@ int i; ObjectTemplateList::fetch(objectTemplate->getSharedTemplate())); const SharedTangibleObjectTemplate * sharedTangibleTemplate = dynamic_cast< const SharedTangibleObjectTemplate *>(sharedTemplate); - if (sharedTangibleTemplate != nullptr) + if (sharedTangibleTemplate != NULL) { // New method using the AssetCustomizationManager mechanism. @@ -818,9 +818,9 @@ int i; // set the created item template crc value const ServerObjectTemplate * craftedTemplate = source.getCraftedObjectTemplate(); - if (craftedTemplate == nullptr) + if (craftedTemplate == NULL) { - WARNING(true, ("JavaLibrary::convert DraftSchematicObject got nullptr crafted " + WARNING(true, ("JavaLibrary::convert DraftSchematicObject got null crafted " "template for draft schematic %s", source.getObjectTemplateName())); return 0; } @@ -830,7 +830,7 @@ int i; const ServerDraftSchematicObjectTemplate * const sourceSchematicTemplate = safe_cast(source.getObjectTemplate()); NOT_NULL(sourceSchematicTemplate); - if (sourceSchematicTemplate == nullptr) + if (sourceSchematicTemplate == NULL) { // emergency case for release mode return 0; @@ -873,11 +873,11 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::startCraftingSession(JNIEnv *en UNREF(env); UNREF(self); - CreatureObject* playerObj = nullptr; + CreatureObject* playerObj = NULL; if (!JavaLibrary::getObject(player, playerObj)) return JNI_FALSE; - TangibleObject* stationObj = nullptr; + TangibleObject* stationObj = NULL; if (!JavaLibrary::getObject(station, stationObj)) return JNI_FALSE; @@ -894,7 +894,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::startCraftingSession(JNIEnv *en * @param self class calling this function * @param crafter the player that was crafting * @param tool the crafting tool that was being used - * @param prototype the prototype that was created (may be nullptr) + * @param prototype the prototype that was created (may be null) * * @return true on success, false on fail */ @@ -908,11 +908,11 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::endCraftingSession(JNIEnv *env, if (prototype == 0) return JNI_TRUE; - CreatureObject * crafterObj = nullptr; + CreatureObject * crafterObj = NULL; if (!JavaLibrary::getObject(crafter, crafterObj)) return JNI_FALSE; - TangibleObject * prototypeObj = nullptr; + TangibleObject * prototypeObj = NULL; if (!JavaLibrary::getObject(prototype, prototypeObj)) return JNI_FALSE; @@ -937,11 +937,11 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setCraftingLevelAndStation(JNIE { UNREF(self); - CreatureObject* creatureObject = nullptr; + CreatureObject* creatureObject = NULL; if (!JavaLibrary::getObject(player, creatureObject)) return JNI_FALSE; PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(creatureObject); - if (playerObject == nullptr) + if (playerObject == NULL) return JNI_FALSE; if (craftingLevel >= 0 && craftingLevel <= Crafting::MAX_CRAFTING_LEVEL) @@ -949,12 +949,12 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setCraftingLevelAndStation(JNIE if (station != 0) { - const TangibleObject * stationObject = nullptr; + const TangibleObject * stationObject = NULL; const NetworkId stationId(station); if (stationId != NetworkId::cms_invalid) { stationObject = dynamic_cast(ServerWorld::findObjectByNetworkId(stationId)); - if (stationObject == nullptr) + if (stationObject == NULL) return JNI_FALSE; } playerObject->setCraftingStation(stationObject); @@ -976,11 +976,11 @@ jint JNICALL ScriptMethodsCraftingNamespace::getCraftingLevel(JNIEnv *env, jobje { UNREF(self); - const CreatureObject* creatureObject = nullptr; + const CreatureObject* creatureObject = NULL; if (!JavaLibrary::getObject(player, creatureObject)) return -1; const PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(creatureObject); - if (playerObject == nullptr) + if (playerObject == NULL) return -1; return playerObject->getCraftingLevel(); @@ -999,11 +999,11 @@ jlong JNICALL ScriptMethodsCraftingNamespace::getCraftingStation(JNIEnv *env, jo { UNREF(self); - const CreatureObject* creatureObject = nullptr; + const CreatureObject* creatureObject = NULL; if (!JavaLibrary::getObject(player, creatureObject)) return 0; const PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(creatureObject); - if (playerObject == nullptr) + if (playerObject == NULL) return 0; return (playerObject->getCraftingStation()).getValue(); @@ -1023,11 +1023,11 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::sendUseableDraftSchematics(JNIE { UNREF(self); - CreatureObject* creatureObject = nullptr; + CreatureObject* creatureObject = NULL; if (!JavaLibrary::getObject(player, creatureObject)) return JNI_FALSE; PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(creatureObject); - if (playerObject == nullptr) + if (playerObject == NULL) { DEBUG_WARNING(true, ("JavaLibrary::sendUseableDraftSchematics non-player " "object %s\n", creatureObject->getNetworkId().getValueString().c_str())); @@ -1038,8 +1038,8 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::sendUseableDraftSchematics(JNIE if (count == 0) return JNI_FALSE; - jint * schematicsArray = env->GetIntArrayElements(schematics, nullptr); - if (schematicsArray != nullptr) + jint * schematicsArray = env->GetIntArrayElements(schematics, NULL); + if (schematicsArray != NULL) { std::vector schematicCrcs(schematicsArray, &schematicsArray[count]); playerObject->sendUseableDraftSchematics(schematicCrcs); @@ -1072,7 +1072,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSchematicAttribute(JNIEnv *e if (manufacturingSchematic == 0 || attribute == 0) return JNI_FALSE; - ManufactureObjectInterface * schematic = nullptr; + ManufactureObjectInterface * schematic = NULL; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return JNI_FALSE; @@ -1120,7 +1120,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSchematicAttributes(JNIEnv * if (manufacturingSchematic == 0 || attributes == 0) return JNI_FALSE; - ManufactureObjectInterface * schematic = nullptr; + ManufactureObjectInterface * schematic = NULL; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return JNI_FALSE; @@ -1169,7 +1169,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSchematicAttributes(JNIEnv * * @param name name of the attribute to get * @param experiment flag that these are experimental attributes * - * @return the attribute, or nullptr on error + * @return the attribute, or null on error */ jobject JNICALL ScriptMethodsCraftingNamespace::getSchematicAttribute(JNIEnv *env, jobject self, jlong manufacturingSchematic, jobject name, jboolean experiment) { @@ -1178,13 +1178,13 @@ jobject JNICALL ScriptMethodsCraftingNamespace::getSchematicAttribute(JNIEnv *en if (manufacturingSchematic == 0 || name == 0) return 0; - ManufactureObjectInterface * schematic = nullptr; + ManufactureObjectInterface * schematic = NULL; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return 0; const DraftSchematicObject * draft = DraftSchematicObject::getSchematic( schematic->getDraftSchematic()); - if (draft == nullptr) + if (draft == NULL) return 0; StringId nameId; @@ -1210,7 +1210,7 @@ jobject JNICALL ScriptMethodsCraftingNamespace::getSchematicAttribute(JNIEnv *en * @param names names of the attributes to get * @param experiment flag that these are experimental attributes * - * @return the attributes, or nullptr on error + * @return the attributes, or null on error */ jobjectArray JNICALL ScriptMethodsCraftingNamespace::getSchematicAttributes(JNIEnv *env, jobject self, jlong manufacturingSchematic, jobjectArray names, jboolean experiment) { @@ -1219,13 +1219,13 @@ jobjectArray JNICALL ScriptMethodsCraftingNamespace::getSchematicAttributes(JNIE if (manufacturingSchematic == 0) return 0; - ManufactureObjectInterface * schematic = nullptr; + ManufactureObjectInterface * schematic = NULL; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return 0; const DraftSchematicObject * draft = DraftSchematicObject::getSchematic( schematic->getDraftSchematic()); - if (draft == nullptr) + if (draft == NULL) return 0; int numAttribs = env->GetArrayLength(names); @@ -1276,7 +1276,7 @@ jobjectArray JNICALL ScriptMethodsCraftingNamespace::getSchematicAttributes(JNIE * @param manufacturingSchematic the schematic * @param experiment flag that these are experimental attributes * - * @return the attributes, or nullptr on error + * @return the attributes, or null on error */ jobjectArray JNICALL ScriptMethodsCraftingNamespace::getAllSchematicAttributes(JNIEnv *env, jobject self, jlong manufacturingSchematic, jboolean experiment) { @@ -1286,13 +1286,13 @@ jobjectArray JNICALL ScriptMethodsCraftingNamespace::getAllSchematicAttributes(J if (manufacturingSchematic == 0) return 0; - ManufactureObjectInterface * schematic = nullptr; + ManufactureObjectInterface * schematic = NULL; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return 0; const DraftSchematicObject * draft = DraftSchematicObject::getSchematic( schematic->getDraftSchematic()); - if (draft == nullptr) + if (draft == NULL) return 0; // set the attributes @@ -1337,7 +1337,7 @@ jobjectArray JNICALL ScriptMethodsCraftingNamespace::getAllSchematicAttributes(J * @param manufacturingSchematic the schematic to get the data from * @param attributeNames the experimental attributes we're interested about * - * @return the draft_schematic object, or nullptr on error + * @return the draft_schematic object, or null on error */ jobject JNICALL ScriptMethodsCraftingNamespace::getSchematicForExperimentalAttributes(JNIEnv *env, jobject self, jlong manufacturingSchematic, jobjectArray attributeNames) { @@ -1348,13 +1348,13 @@ int i; if (manufacturingSchematic == 0 || attributeNames == 0) return 0; - const ManufactureObjectInterface * manfSchematic = nullptr; + const ManufactureObjectInterface * manfSchematic = NULL; if (!JavaLibrary::getObject(manufacturingSchematic, manfSchematic)) return 0; const DraftSchematicObject * draftSchematic = DraftSchematicObject::getSchematic( manfSchematic->getDraftSchematic()); - if (draftSchematic == nullptr) + if (draftSchematic == NULL) return 0; // create a draft_schematic object to return @@ -1481,7 +1481,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSchematicExperimentMod(JNIEn { UNREF(self); - ManufactureSchematicObject * schematic = nullptr; + ManufactureSchematicObject * schematic = NULL; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return JNI_FALSE; @@ -1510,7 +1510,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSchematicAppearances(JNIEnv if (manufacturingSchematic == 0 || appearances == 0) return JNI_FALSE; - ManufactureSchematicObject * schematic = nullptr; + ManufactureSchematicObject * schematic = NULL; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return JNI_FALSE; @@ -1550,7 +1550,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSchematicCustomizations(JNIE if (manufacturingSchematic == 0 || customizations == 0) return JNI_FALSE; - ManufactureSchematicObject * schematic = nullptr; + ManufactureSchematicObject * schematic = NULL; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return JNI_FALSE; @@ -1596,7 +1596,7 @@ jint JNICALL ScriptMethodsCraftingNamespace::getSchematicItemCount(JNIEnv *env, if (manufacturingSchematic == 0) return -1; - const ManufactureSchematicObject * schematic = nullptr; + const ManufactureSchematicObject * schematic = NULL; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return -1; @@ -1622,7 +1622,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSchematicItemCount(JNIEnv *e if (manufacturingSchematic == 0) return JNI_FALSE; - ManufactureSchematicObject * schematic = nullptr; + ManufactureSchematicObject * schematic = NULL; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return JNI_FALSE; @@ -1649,7 +1649,7 @@ jint JNICALL ScriptMethodsCraftingNamespace::getSchematicItemsPerContainer(JNIEn if (manufacturingSchematic == 0) return -1; - const ManufactureSchematicObject * schematic = nullptr; + const ManufactureSchematicObject * schematic = NULL; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return -1; @@ -1676,7 +1676,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSchematicItemsPerContainer(J if (manufacturingSchematic == 0) return JNI_FALSE; - ManufactureSchematicObject * schematic = nullptr; + ManufactureSchematicObject * schematic = NULL; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return JNI_FALSE; @@ -1703,7 +1703,7 @@ jfloat JNICALL ScriptMethodsCraftingNamespace::getSchematicManufactureTime(JNIEn if (manufacturingSchematic == 0) return -1.0f; - const ManufactureSchematicObject * schematic = nullptr; + const ManufactureSchematicObject * schematic = NULL; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return -1.0f; @@ -1730,7 +1730,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSchematicManufactureTime(JNI if (manufacturingSchematic == 0) return JNI_FALSE; - ManufactureSchematicObject * schematic = nullptr; + ManufactureSchematicObject * schematic = NULL; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return JNI_FALSE; @@ -1754,7 +1754,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setCreatorXp(JNIEnv *env, jobje { UNREF(self); - TangibleObject * target = nullptr; + TangibleObject * target = NULL; if (!JavaLibrary::getObject(object, target)) return JNI_FALSE; @@ -1778,7 +1778,7 @@ void JNICALL ScriptMethodsCraftingNamespace::getIngredientsForManufactureStation if (station == 0 || ingredients == 0) return; - const ManufactureInstallationObject * manfStation = nullptr; + const ManufactureInstallationObject * manfStation = NULL; if (!JavaLibrary::getObject(station, manfStation)) return; @@ -1786,7 +1786,7 @@ void JNICALL ScriptMethodsCraftingNamespace::getIngredientsForManufactureStation return; const ManufactureSchematicObject * const schematic = manfStation->getSchematic(); - if (schematic == nullptr) + if (schematic == NULL) return; static ManufactureSchematicObject::IngredientInfoVector iiv; @@ -1841,7 +1841,7 @@ void JNICALL ScriptMethodsCraftingNamespace::getIngredientsForManufactureStation * @param self class calling this function * @param station the station id * - * @return the hopper id, or nullptr on error + * @return the hopper id, or null on error */ jlong JNICALL ScriptMethodsCraftingNamespace::getManufactureStationInputHopper(JNIEnv *env, jobject self, jlong station) { @@ -1850,12 +1850,12 @@ jlong JNICALL ScriptMethodsCraftingNamespace::getManufactureStationInputHopper(J if (station == 0) return 0; - const ManufactureInstallationObject * manfStation = nullptr; + const ManufactureInstallationObject * manfStation = NULL; if (!JavaLibrary::getObject(station, manfStation)) return 0; ServerObject * hopper = manfStation->getInputHopper(); - if (hopper == nullptr) + if (hopper == NULL) return 0; return (hopper->getNetworkId()).getValue(); @@ -1870,7 +1870,7 @@ jlong JNICALL ScriptMethodsCraftingNamespace::getManufactureStationInputHopper(J * @param self class calling this function * @param station the station id * - * @return the hopper id, or nullptr on error + * @return the hopper id, or null on error */ jlong JNICALL ScriptMethodsCraftingNamespace::getManufactureStationOutputHopper(JNIEnv *env, jobject self, jlong station) { @@ -1879,12 +1879,12 @@ jlong JNICALL ScriptMethodsCraftingNamespace::getManufactureStationOutputHopper( if (station == 0) return 0; - const ManufactureInstallationObject * manfStation = nullptr; + const ManufactureInstallationObject * manfStation = NULL; if (!JavaLibrary::getObject(station, manfStation)) return 0; ServerObject * hopper = manfStation->getOutputHopper(); - if (hopper == nullptr) + if (hopper == NULL) return 0; return (hopper->getNetworkId()).getValue(); @@ -1899,7 +1899,7 @@ jlong JNICALL ScriptMethodsCraftingNamespace::getManufactureStationOutputHopper( * @param self class calling this function * @param station the station id * - * @return a string of the form "*" , or nullptr if the station has no schematic + * @return a string of the form "*" , or null if the station has no schematic */ jstring JNICALL ScriptMethodsCraftingNamespace::getManufactureStationSchematic(JNIEnv *env, jobject self, jlong station) { @@ -1907,12 +1907,12 @@ jstring JNICALL ScriptMethodsCraftingNamespace::getManufactureStationSchematic(J UNREF(self); - const ManufactureInstallationObject * manfStation = nullptr; + const ManufactureInstallationObject * manfStation = NULL; if (!JavaLibrary::getObject(station, manfStation)) return 0; const ManufactureSchematicObject * manfSchematic = manfStation->getSchematic(); - if (manfSchematic == nullptr) + if (manfSchematic == NULL) return 0; return JavaString( @@ -1943,11 +1943,11 @@ void JNICALL ScriptMethodsCraftingNamespace::getValidManufactureSchematicsForSta if (player == 0 || station == 0 || schematics == 0) return; - CreatureObject * playerCreature = nullptr; + CreatureObject * playerCreature = NULL; if (!JavaLibrary::getObject(player, playerCreature)) return; - const ManufactureInstallationObject * manfStation = nullptr; + const ManufactureInstallationObject * manfStation = NULL; if (!JavaLibrary::getObject(station, manfStation)) return; @@ -1997,11 +1997,11 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::hasValidManufactureSchematicsFo if (player == 0 || station == 0) return JNI_FALSE; - CreatureObject * playerCreature = nullptr; + CreatureObject * playerCreature = NULL; if (!JavaLibrary::getObject(player, playerCreature)) return JNI_FALSE; - const ManufactureInstallationObject * manfStation = nullptr; + const ManufactureInstallationObject * manfStation = NULL; if (!JavaLibrary::getObject(station, manfStation)) return JNI_FALSE; @@ -2030,24 +2030,24 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::transferManufactureSchematicToP { UNREF(self); - const ManufactureInstallationObject * manfStation = nullptr; + const ManufactureInstallationObject * manfStation = NULL; if (!JavaLibrary::getObject(station, manfStation)) return JNI_FALSE; ManufactureSchematicObject * schematic = manfStation->getSchematic(); - if (schematic == nullptr) + if (schematic == NULL) return JNI_TRUE; - CreatureObject * playerCreature = nullptr; + CreatureObject * playerCreature = NULL; if (!JavaLibrary::getObject(player, playerCreature)) return JNI_FALSE; ServerObject * datapad = playerCreature->getDatapad(); - if (datapad == nullptr) + if (datapad == NULL) return JNI_FALSE; Container::ContainerErrorCode tmp = Container::CEC_Success; - if (ContainerInterface::transferItemToVolumeContainer(*datapad, *schematic, nullptr, tmp)) + if (ContainerInterface::transferItemToVolumeContainer(*datapad, *schematic, NULL, tmp)) return JNI_TRUE; return JNI_FALSE; } // JavaLibrary::transferManufactureSchematicToPlayer @@ -2068,15 +2068,15 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::transferManufactureSchematicToS { UNREF(self); - ManufactureSchematicObject * manfSchematic = nullptr; + ManufactureSchematicObject * manfSchematic = NULL; if (!JavaLibrary::getObject(schematic, manfSchematic)) return JNI_FALSE; - ManufactureInstallationObject * manfStation = nullptr; + ManufactureInstallationObject * manfStation = NULL; if (!JavaLibrary::getObject(station, manfStation)) return JNI_FALSE; - if (manfStation->addSchematic(*manfSchematic, nullptr)) + if (manfStation->addSchematic(*manfSchematic, NULL)) return JNI_TRUE; return JNI_FALSE; } // JavaLibrary::transferManufactureSchematicToStation @@ -2099,11 +2099,11 @@ void JNICALL ScriptMethodsCraftingNamespace::getRepairableObjectsForTool(JNIEnv if (player == 0 || tool == 0 || objects == 0) return; - CreatureObject * playerCreature = nullptr; + CreatureObject * playerCreature = NULL; if (!JavaLibrary::getObject(player, playerCreature)) return; - const TangibleObject * toolObject = nullptr; + const TangibleObject * toolObject = NULL; if (!JavaLibrary::getObject(tool, toolObject)) return; if (!toolObject->isRepairTool()) @@ -2123,11 +2123,11 @@ void JNICALL ScriptMethodsCraftingNamespace::getRepairableObjectsForTool(JNIEnv // objects const ServerObject * inventory = playerCreature->getInventory(); - if (inventory == nullptr) + if (inventory == NULL) return; const VolumeContainer * inventoryContainer = ContainerInterface::getVolumeContainer(*inventory); - if (inventoryContainer == nullptr) + if (inventoryContainer == NULL) return; std::vector objList; @@ -2136,7 +2136,7 @@ void JNICALL ScriptMethodsCraftingNamespace::getRepairableObjectsForTool(JNIEnv { const CachedNetworkId & objId = (*iter); const TangibleObject * obj = safe_cast(objId.getObject()); - if (obj != nullptr && !obj->isCraftingTool() && !obj->isRepairTool() && + if (obj != NULL && !obj->isCraftingTool() && !obj->isRepairTool() && obj->getDamageTaken() > 0) { if ((genericTool && (toolType & obj->getGameObjectType()) != 0) || @@ -2172,22 +2172,22 @@ void JNICALL ScriptMethodsCraftingNamespace::getRepairableObjectsForTool(JNIEnv * @param self class calling this function * @param target the object * - * @return an array with the bonus for each attribute, or nullptr on error + * @return an array with the bonus for each attribute, or null on error */ jintArray JNICALL ScriptMethodsCraftingNamespace::getAttributeBonuses(JNIEnv *env, jobject self, jlong target) { UNREF(self); - const ServerObject * object = nullptr; + const ServerObject * object = NULL; if (!JavaLibrary::getObject(target, object)) return 0; std::vector > bonuses; - if (object->asTangibleObject() != nullptr) + if (object->asTangibleObject() != NULL) { object->asTangibleObject()->getAttribBonuses(bonuses); } - else if (object->asManufactureSchematicObject() != nullptr) + else if (object->asManufactureSchematicObject() != NULL) { object->asManufactureSchematicObject()->getAttribBonuses(bonuses); } @@ -2235,16 +2235,16 @@ jint JNICALL ScriptMethodsCraftingNamespace::getAttributeBonus(JNIEnv *env, jobj if (attribute < 0 || attribute >= Attributes::NumberOfAttributes) return 0; - const ServerObject * object = nullptr; + const ServerObject * object = NULL; if (!JavaLibrary::getObject(target, object)) return 0; jint bonus = 0; - if (object->asTangibleObject() != nullptr) + if (object->asTangibleObject() != NULL) { bonus = object->asTangibleObject()->getAttribBonus(attribute); } - else if (object->asManufactureSchematicObject() != nullptr) + else if (object->asManufactureSchematicObject() != NULL) { bonus = object->asManufactureSchematicObject()->getAttribBonus(attribute); } @@ -2271,15 +2271,15 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setAttributeBonus(JNIEnv *env, if (attribute < 0 || attribute >= Attributes::NumberOfAttributes) return JNI_FALSE; - ServerObject * object = nullptr; + ServerObject * object = NULL; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; - if (object->asTangibleObject() != nullptr) + if (object->asTangibleObject() != NULL) { object->asTangibleObject()->setAttribBonus(attribute, bonus); } - else if (object->asManufactureSchematicObject() != nullptr) + else if (object->asManufactureSchematicObject() != NULL) { object->asManufactureSchematicObject()->setAttribBonus(attribute, bonus); } @@ -2307,7 +2307,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setAttributeBonuses(JNIEnv *env if (bonuses == 0) return JNI_FALSE; - ServerObject * object = nullptr; + ServerObject * object = NULL; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -2322,13 +2322,13 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setAttributeBonuses(JNIEnv *env jint buffer[Attributes::NumberOfAttributes]; env->GetIntArrayRegion(bonuses, 0, count, buffer); - if (object->asTangibleObject() != nullptr) + if (object->asTangibleObject() != NULL) { TangibleObject * tangibleObject = object->asTangibleObject(); for (jsize i = 0; i < count; ++i) tangibleObject->setAttribBonus(i, buffer[i]); } - else if (object->asManufactureSchematicObject() != nullptr) + else if (object->asManufactureSchematicObject() != NULL) { ManufactureSchematicObject * manufactureSchematicObject = object->asManufactureSchematicObject(); for (jsize i = 0; i < count; ++i) @@ -2349,13 +2349,13 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setAttributeBonuses(JNIEnv *env * @param self class calling this function * @param target the object * - * @return a dictionary of skill mod names -> mod values, or nullptr on error + * @return a dictionary of skill mod names -> mod values, or null on error */ jobject JNICALL ScriptMethodsCraftingNamespace::getSkillModBonuses(JNIEnv *env, jobject self, jlong target) { UNREF(self); - const TangibleObject * object = nullptr; + const TangibleObject * object = NULL; if (!JavaLibrary::getObject(target, object)) return 0; @@ -2393,7 +2393,7 @@ jint JNICALL ScriptMethodsCraftingNamespace::getSkillModBonus(JNIEnv *env, jobje JavaStringParam jskillMod(skillMod); - const TangibleObject * object = nullptr; + const TangibleObject * object = NULL; if (!JavaLibrary::getObject(target, object)) return 0; @@ -2423,7 +2423,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSkillModBonus(JNIEnv *env, j JavaStringParam jskillMod(skillMod); - TangibleObject * object = nullptr; + TangibleObject * object = NULL; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -2452,7 +2452,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSkillModBonuses(JNIEnv *env, { UNREF(self); - TangibleObject * object = nullptr; + TangibleObject * object = NULL; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -2469,7 +2469,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSkillModBonuses(JNIEnv *env, } std::string skillName; - const jint * bonusArray = env->GetIntArrayElements(bonus, nullptr); + const jint * bonusArray = env->GetIntArrayElements(bonus, NULL); for (int i = 0; i < skillModCount; ++i) { JavaStringParam jskillName(static_cast(env->GetObjectArrayElement(skillMod, i))); @@ -2505,7 +2505,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setCategorizedSkillModBonus(JNI JavaStringParam jcategory(category); JavaStringParam jskillMod(skillMod); - TangibleObject * object = nullptr; + TangibleObject * object = NULL; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -2540,7 +2540,7 @@ void JNICALL ScriptMethodsCraftingNamespace::removeCategorizedSkillModBonuses(JN JavaStringParam jcategory(category); - TangibleObject * object = nullptr; + TangibleObject * object = NULL; if (!JavaLibrary::getObject(target, object)) return; @@ -2566,7 +2566,7 @@ jint JNICALL ScriptMethodsCraftingNamespace::getSkillModSockets(JNIEnv *env, job { UNREF(self); - const TangibleObject * object = nullptr; + const TangibleObject * object = NULL; if (!JavaLibrary::getObject(target, object)) return 0; @@ -2589,7 +2589,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSkillModSockets(JNIEnv *env, { UNREF(self); - TangibleObject * object = nullptr; + TangibleObject * object = NULL; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -2610,7 +2610,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSkillModSockets(JNIEnv *env, * @param qualityPercent % stat adjustment * @param container the container to create the item in * - * @return the item, or nullptr on error + * @return the item, or null on error */ jlong JNICALL ScriptMethodsCraftingNamespace::makeCraftedItem(JNIEnv *env, jobject self, jstring draftSchematic, jfloat qualityPercent, jlong container) { @@ -2618,7 +2618,7 @@ jlong JNICALL ScriptMethodsCraftingNamespace::makeCraftedItem(JNIEnv *env, jobje if (draftSchematic == 0 || container == 0) { - WARNING(true, ("[script bug] nullptr schematic or container passed to " + WARNING(true, ("[script bug] null schematic or container passed to " "makeCraftedItem")); return 0; } @@ -2634,21 +2634,21 @@ jlong JNICALL ScriptMethodsCraftingNamespace::makeCraftedItem(JNIEnv *env, jobje const DraftSchematicObject * schematic = DraftSchematicObject::getSchematic( draftSchematicName); - if (schematic == nullptr) + if (schematic == NULL) { WARNING(true, ("[script bug] bad schematic name %s passed to " "makeCraftedItem", draftSchematicName.c_str())); return 0; } - ServerObject * target = nullptr; + ServerObject * target = NULL; if (!JavaLibrary::getObject(container, target)) { WARNING(true, ("[script bug] bad container id passed to makeCraftedItem")); return 0; } Object * targetParent = ContainerInterface::getFirstParentInWorld(*target); - if (targetParent == nullptr) + if (targetParent == NULL) { WARNING(true, ("JavaLibrary::makeCraftedItem can't find parent in world " "for container %s", target->getNetworkId().getValueString().c_str())); @@ -2660,14 +2660,14 @@ jlong JNICALL ScriptMethodsCraftingNamespace::makeCraftedItem(JNIEnv *env, jobje // create a manf schematic and prototype ManufactureSchematicObject * manfSchematic = ServerWorld::createNewManufacturingSchematic( *schematic, createPos, false); - if (manfSchematic == nullptr) + if (manfSchematic == NULL) { WARNING(true, ("JavaLibrary::makeCraftedItem: error creating manf " "schematic!")); return 0; } ServerObject * prototype = manfSchematic->manufactureObject(createPos); - if (prototype == nullptr) + if (prototype == NULL) { WARNING(true, ("JavaLibrary::makeCraftedItem: error creating " "prototype!")); @@ -2690,7 +2690,7 @@ jlong JNICALL ScriptMethodsCraftingNamespace::makeCraftedItem(JNIEnv *env, jobje manfSchematic->permanentlyDestroy(DeleteReasons::Consumed); Container::ContainerErrorCode error; if (!ContainerInterface::transferItemToVolumeContainer (*target, *prototype, - nullptr, error, true)) + NULL, error, true)) { WARNING(true, ("JavaLibrary::makeCraftedItem: error can't store prototype " "in container, error = %d", error)); @@ -2711,14 +2711,14 @@ jlong JNICALL ScriptMethodsCraftingNamespace::makeCraftedItem(JNIEnv *env, jobje * @param self class calling this function * @param manufacturingSchematic the schematic to get the data from * - * @return the draft_schematic object, or nullptr on error + * @return the draft_schematic object, or null on error */ jobject JNICALL ScriptMethodsCraftingNamespace::getSchematicData(JNIEnv *env, jobject self, jlong manufacturingSchematic) { if (manufacturingSchematic == 0) return 0; - const ManufactureSchematicObject * schematicObject = nullptr; + const ManufactureSchematicObject * schematicObject = NULL; if (!JavaLibrary::getObject(manufacturingSchematic, schematicObject)) return 0; @@ -2735,7 +2735,7 @@ jobject JNICALL ScriptMethodsCraftingNamespace::getSchematicData(JNIEnv *env, jo * @param self class calling this function * @param draftSchematic the schematic to get the data from * - * @return the draft_schematic object, or nullptr on error + * @return the draft_schematic object, or null on error */ jobject JNICALL ScriptMethodsCraftingNamespace::getDraftSchematicData(JNIEnv *env, jobject self, jstring draftSchematic) @@ -2749,7 +2749,7 @@ jobject JNICALL ScriptMethodsCraftingNamespace::getDraftSchematicData(JNIEnv *en return 0; const DraftSchematicObject * schematicObject = DraftSchematicObject::getSchematic(schematicName); - if (schematicObject == nullptr) + if (schematicObject == NULL) return 0; return JavaLibrary::convert(*schematicObject); @@ -2765,7 +2765,7 @@ jobject JNICALL ScriptMethodsCraftingNamespace::getDraftSchematicData(JNIEnv *en * @param self class calling this function * @param draftSchematicCrc the schematic to get the data from * - * @return the draft_schematic object, or nullptr on error + * @return the draft_schematic object, or null on error */ jobject JNICALL ScriptMethodsCraftingNamespace::getDraftSchematicDataCrc(JNIEnv *env, jobject self, jint draftSchematicCrc) @@ -2774,7 +2774,7 @@ jobject JNICALL ScriptMethodsCraftingNamespace::getDraftSchematicDataCrc(JNIEnv return 0; const DraftSchematicObject * schematicObject = DraftSchematicObject::getSchematic(draftSchematicCrc); - if (schematicObject == nullptr) + if (schematicObject == NULL) return 0; return JavaLibrary::convert(*schematicObject); @@ -2794,7 +2794,7 @@ jobject JNICALL ScriptMethodsCraftingNamespace::getDraftSchematicDataCrc(JNIEnv */ void JNICALL ScriptMethodsCraftingNamespace::recomputeCrateAttributes(JNIEnv *env, jobject self, jlong crate) { - FactoryObject * factory = nullptr; + FactoryObject * factory = NULL; if (!JavaLibrary::getObject(crate, factory)) return; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsDebug.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsDebug.cpp index 6769ff57..9946fc28 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsDebug.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsDebug.cpp @@ -188,7 +188,7 @@ void JNICALL ScriptMethodsDebugNamespace::debugServerConsoleMsg(JNIEnv *env, job ServerObject * object = 0; JavaLibrary::getObject(objId, object); - if (object == nullptr) + if (object == NULL) { DEBUG_REPORT_LOG(true, ("debugServerConsoleMsg from : %s\n", msgString.c_str())); @@ -212,8 +212,8 @@ void JNICALL ScriptMethodsDebugNamespace::debugServerConsoleMsg(JNIEnv *env, job * @param channel the channel to log to * @param msg the message to log * @param logger id of the object where the log is coming from - * @param player1 the 1st player for the message (may be nullptr) - * @param player2 the 2nd player for the message (may be nullptr) + * @param player1 the 1st player for the message (may be null) + * @param player2 the 2nd player for the message (may be null) * @param alwaysLog flag to ignore the disableScriptLogs flag and always log this message */ void JNICALL ScriptMethodsDebugNamespace::log(JNIEnv *env, jobject self, jstring channel, jstring msg, jlong logger, jlong player1, jlong player2, jboolean alwaysLog) @@ -222,7 +222,7 @@ void JNICALL ScriptMethodsDebugNamespace::log(JNIEnv *env, jobject self, jstring if (channel == 0 || msg == 0) { - JavaLibrary::throwInternalScriptError("[designer bug] JavaLibrary::log called with nullptr channel or message"); + JavaLibrary::throwInternalScriptError("[designer bug] JavaLibrary::log called with null channel or message"); return; } @@ -248,7 +248,7 @@ void JNICALL ScriptMethodsDebugNamespace::log(JNIEnv *env, jobject self, jstring if (player1 != 0) { - const ServerObject * playerObject = nullptr; + const ServerObject * playerObject = NULL; if (JavaLibrary::getObject(player1, playerObject)) { std::string::size_type p = msgStr.find("%TU"); @@ -264,7 +264,7 @@ void JNICALL ScriptMethodsDebugNamespace::log(JNIEnv *env, jobject self, jstring if (player2 != 0) { - const ServerObject * playerObject = nullptr; + const ServerObject * playerObject = NULL; if (JavaLibrary::getObject(player2, playerObject)) { std::string::size_type p = msgStr.find("%TT"); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsDynamicVariable.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsDynamicVariable.cpp index effd5bed..dbf13ac0 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsDynamicVariable.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsDynamicVariable.cpp @@ -39,7 +39,7 @@ namespace NonAuthObjvarNamespace if (!ConfigServerGame::getTrackNonAuthoritativeObjvarSets()) return; - if (name == nullptr || *name == '\0') + if (name == NULL || *name == '\0') return; if (obj.isAuthoritative()) return; @@ -504,13 +504,13 @@ LocalRefPtr ScriptMethodsDynamicVariableNamespace::convertDynamicVariableListToO * @param buffer a buffer to be filled in with the converted C name * @param bufferSize the length of buffer * - * @return the ServerObject * for the obj_id, or nullptr on error + * @return the ServerObject * for the obj_id, or null on error */ ServerObject * ScriptMethodsDynamicVariableNamespace::getObjectAndName(JNIEnv *env, jlong objId, jstring name, char * buffer, size_t bufferSize) { NOT_NULL(buffer); - ServerObject * object = nullptr; + ServerObject * object = NULL; JavaStringParam localName(name); if (localName.fillBuffer(buffer, bufferSize) > 1) { @@ -523,7 +523,7 @@ ServerObject * ScriptMethodsDynamicVariableNamespace::getObjectAndName(JNIEnv *e { fprintf(stderr, "WARNING: Could not get objvar name\n"); } - if (object == nullptr && !ConfigServerGame::getDisableObjvarNullCheck()) + if (object == NULL && !ConfigServerGame::getDisableObjvarNullCheck()) JavaLibrary::printJavaStack(); return object; @@ -540,15 +540,15 @@ ServerObject * ScriptMethodsDynamicVariableNamespace::getObjectAndName(JNIEnv *e * @param buffer a buffer to be filled in with the converted C name * @param bufferSize the length of buffer * - * @return the DynamicVariableList * for the obj_id, or nullptr on error + * @return the DynamicVariableList * for the obj_id, or null on error */ const DynamicVariableList * ScriptMethodsDynamicVariableNamespace::getObjvarsAndName(JNIEnv *env, jlong objId, jstring name, char * buffer, size_t bufferSize) { NOT_NULL(buffer); - const DynamicVariableList * objvars = nullptr; + const DynamicVariableList * objvars = NULL; const ServerObject * object = getObjectAndName(env, objId, name, buffer, bufferSize); - if (object != nullptr) + if (object != NULL) { testIsSafeToReadObjvar(*object, buffer); objvars = &object->getObjVars(); @@ -582,7 +582,7 @@ jobject JNICALL ScriptMethodsDynamicVariableNamespace::getDynamicVariable(JNIEnv char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvars = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvars == nullptr) + if (objvars == NULL) return 0; const std::string objvarName(buffer); @@ -751,7 +751,7 @@ jint JNICALL ScriptMethodsDynamicVariableNamespace::getIntDynamicVariable(JNIEnv char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == nullptr) + if (objvarList == NULL) return 0; int localValue=0; @@ -781,7 +781,7 @@ jintArray JNICALL ScriptMethodsDynamicVariableNamespace::getIntArrayDynamicVaria char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == nullptr) + if (objvarList == NULL) return 0; std::vector value; @@ -816,7 +816,7 @@ jfloat JNICALL ScriptMethodsDynamicVariableNamespace::getFloatDynamicVariable(JN char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == nullptr) + if (objvarList == NULL) return 0; float localValue = 0; @@ -846,7 +846,7 @@ jfloatArray JNICALL ScriptMethodsDynamicVariableNamespace::getFloatArrayDynamicV char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == nullptr) + if (objvarList == NULL) return 0; std::vector value; @@ -878,7 +878,7 @@ jstring JNICALL ScriptMethodsDynamicVariableNamespace::getStringDynamicVariable( char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == nullptr) + if (objvarList == NULL) return 0; Unicode::String value; @@ -908,7 +908,7 @@ jobjectArray JNICALL ScriptMethodsDynamicVariableNamespace::getStringArrayDynami char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == nullptr) + if (objvarList == NULL) return 0; std::vector value; @@ -944,7 +944,7 @@ jlong JNICALL ScriptMethodsDynamicVariableNamespace::getObjIdDynamicVariable(JNI char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == nullptr) + if (objvarList == NULL) return 0; NetworkId localValue; @@ -972,7 +972,7 @@ jlongArray JNICALL ScriptMethodsDynamicVariableNamespace::getObjIdArrayDynamicVa char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList *objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == nullptr) + if (objvarList == NULL) return 0; std::vector value; @@ -1013,7 +1013,7 @@ jobject JNICALL ScriptMethodsDynamicVariableNamespace::getLocationDynamicVariabl char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == nullptr) + if (objvarList == NULL) return 0; DynamicVariableLocationData value; @@ -1046,7 +1046,7 @@ jobjectArray JNICALL ScriptMethodsDynamicVariableNamespace::getLocationArrayDyna char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == nullptr) + if (objvarList == NULL) return 0; std::vector value; @@ -1092,7 +1092,7 @@ jobject JNICALL ScriptMethodsDynamicVariableNamespace::getStringIdDynamicVariabl char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == nullptr) + if (objvarList == NULL) return 0; StringId value; @@ -1125,7 +1125,7 @@ jobjectArray JNICALL ScriptMethodsDynamicVariableNamespace::getStringIdArrayDyna char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == nullptr) + if (objvarList == NULL) return 0; std::vector value; @@ -1168,7 +1168,7 @@ jobject JNICALL ScriptMethodsDynamicVariableNamespace::getTransformDynamicVariab char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == nullptr) + if (objvarList == NULL) return 0; Transform value; @@ -1201,7 +1201,7 @@ jobjectArray JNICALL ScriptMethodsDynamicVariableNamespace::getTransformArrayDyn char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == nullptr) + if (objvarList == NULL) return 0; std::vector value; @@ -1244,7 +1244,7 @@ jobject JNICALL ScriptMethodsDynamicVariableNamespace::getVectorDynamicVariable( char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == nullptr) + if (objvarList == NULL) return 0; Vector value; @@ -1277,7 +1277,7 @@ jobjectArray JNICALL ScriptMethodsDynamicVariableNamespace::getVectorArrayDynami char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == nullptr) + if (objvarList == NULL) return 0; std::vector value; @@ -1320,7 +1320,7 @@ jobject JNICALL ScriptMethodsDynamicVariableNamespace::getDynamicVariableList(JN JavaStringParam localName(name); - const ServerObject* object = nullptr; + const ServerObject* object = NULL; if (!JavaLibrary::getObject(objId, object)) return 0; @@ -1342,7 +1342,7 @@ jobject JNICALL ScriptMethodsDynamicVariableNamespace::getDynamicVariableList(JN } } - if (result.get() == nullptr) + if (result.get() == NULL) return 0; return result->getReturnValue(); } // JavaLibrary::getDynamicVariableList @@ -1364,7 +1364,7 @@ void JNICALL ScriptMethodsDynamicVariableNamespace::removeDynamicVariable(JNIEnv char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == nullptr) + if (object == NULL) return; object->removeObjVarItem(buffer); @@ -1384,7 +1384,7 @@ void JNICALL ScriptMethodsDynamicVariableNamespace::removeAllDynamicVariables(JN if (objId == 0) return; - ServerObject* object = nullptr; + ServerObject* object = NULL; if (!JavaLibrary::getObject(objId, object)) return; @@ -1410,7 +1410,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::hasDynamicVariable(JNIEn char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == nullptr) + if (object == NULL) return 0; const DynamicVariableList &objvarList = object->getObjVars(); @@ -1441,11 +1441,11 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setDynamicVariable(JNIEn char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == nullptr) + if (object == NULL) return JNI_FALSE; const DynamicVariableList *objvarList = &(object->getObjVars()); - if (objvarList == nullptr) + if (objvarList == NULL) return JNI_FALSE; // determine what type the data is @@ -1454,9 +1454,9 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setDynamicVariable(JNIEn { // name is the name of an objvar list we will add data to DynamicVariable *objvar = objvarList->getItemByName(localName); - if (objvar == nullptr) + if (objvar == NULL) objvar = objvarList->addNestedList(localName); - if (objvar != nullptr && objvar->getType() == DynamicVariable::LIST) + if (objvar != NULL && objvar->getType() == DynamicVariable::LIST) return updateDynamicVariableList(env, *dynamic_cast(objvar), data); return JNI_FALSE; } @@ -1474,7 +1474,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setDynamicVariable(JNIEn } else if (env->IsInstanceOf(data, ms_clsString) == JNI_TRUE) { - if (objvarList->setItem(localName, Unicode::String(env->GetStringChars(static_cast(data), nullptr)))) + if (objvarList->setItem(localName, Unicode::String(env->GetStringChars(static_cast(data), NULL)))) #error must release characters return JNI_TRUE; return JNI_FALSE; @@ -1503,7 +1503,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setIntDynamicVariable(JN char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == nullptr) + if (object == NULL) return JNI_FALSE; addSetObjvar(*object, buffer); @@ -1531,7 +1531,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setIntArrayDynamicVariab char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == nullptr) + if (object == NULL) return JNI_FALSE; size_t size = env->GetArrayLength(value); @@ -1574,7 +1574,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setFloatDynamicVariable( char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == nullptr) + if (object == NULL) return JNI_FALSE; addSetObjvar(*object, buffer); @@ -1602,7 +1602,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setFloatArrayDynamicVari char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == nullptr) + if (object == NULL) return JNI_FALSE; size_t size = env->GetArrayLength(value); @@ -1645,7 +1645,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setStringDynamicVariable if (name == 0) { - DEBUG_WARNING(true, ("nullptr name passed from script to JavaLibrary::setStringDynamicValue")); + DEBUG_WARNING(true, ("NULL name passed from script to JavaLibrary::setStringDynamicValue")); return JNI_FALSE; } @@ -1653,17 +1653,17 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setStringDynamicVariable char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == nullptr) + if (object == NULL) return JNI_FALSE; if (value == 0) { - DEBUG_WARNING(true, ("nullptr string passed from script to JavaLibrary::setStringDynamicValue (%s)",buffer)); + DEBUG_WARNING(true, ("NULL string passed from script to JavaLibrary::setStringDynamicValue (%s)",buffer)); return JNI_FALSE; } const DynamicVariableList *objvarList = &(object->getObjVars()); - if (objvarList == nullptr) + if (objvarList == NULL) return JNI_FALSE; Unicode::String valueString; @@ -1698,7 +1698,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setStringArrayDynamicVar char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == nullptr) + if (object == NULL) return JNI_FALSE; std::vector valueArray; @@ -1754,7 +1754,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setObjIdDynamicVariable( char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == nullptr) + if (object == NULL) return JNI_FALSE; NetworkId oidValue(static_cast @@ -1785,7 +1785,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setObjIdArrayDynamicVari char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == nullptr) + if (object == NULL) return JNI_FALSE; std::vector valueArray; @@ -1838,7 +1838,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setLocationDynamicVariab char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == nullptr) + if (object == NULL) return JNI_FALSE; DynamicVariableLocationData locValue; @@ -1878,7 +1878,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setLocationArrayDynamicV char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == nullptr) + if (object == NULL) return JNI_FALSE; std::vector valueArray; @@ -1942,7 +1942,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setStringIdDynamicVariab char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == nullptr) + if (object == NULL) return JNI_FALSE; StringId locValue; @@ -1977,7 +1977,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setStringIdArrayDynamicV char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == nullptr) + if (object == NULL) return JNI_FALSE; std::vector valueArray; @@ -2033,7 +2033,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setTransformDynamicVaria char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == nullptr) + if (object == NULL) return JNI_FALSE; Transform locValue; @@ -2068,7 +2068,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setTransformArrayDynamic char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == nullptr) + if (object == NULL) return JNI_FALSE; std::vector valueArray; @@ -2120,7 +2120,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setVectorDynamicVariable char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == nullptr) + if (object == NULL) return JNI_FALSE; Vector locValue; @@ -2155,7 +2155,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setVectorArrayDynamicVar char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == nullptr) + if (object == NULL) return JNI_FALSE; std::vector valueArray; @@ -2227,10 +2227,10 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::copyDynamicVariable(JNIE return JNI_TRUE; ServerObject* fromObject = dynamic_cast(from.getObject()); - if (fromObject == nullptr) + if (fromObject == NULL) return JNI_FALSE; ServerObject* toObject = dynamic_cast(to.getObject()); - if (toObject == nullptr) + if (toObject == NULL) return JNI_FALSE; char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsForm.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsForm.cpp index 3247b76e..3ca7c226 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsForm.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsForm.cpp @@ -48,7 +48,7 @@ const JNINativeMethod NATIVES[] = { jboolean JNICALL ScriptMethodsFormNamespace::editFormData(JNIEnv * env, jobject self, jlong player, jlong jObjectToEdit, jobjectArray jKeys, jobjectArray jValues) { UNREF(self); - ServerObject * playerServerObject = nullptr; + ServerObject * playerServerObject = NULL; if (!JavaLibrary::getObject(player, playerServerObject) || !playerServerObject) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("[script bug] can't get player in editFormData")); @@ -62,7 +62,7 @@ jboolean JNICALL ScriptMethodsFormNamespace::editFormData(JNIEnv * env, jobject return JNI_FALSE; } - ServerObject * objectToEditServerObject = nullptr; + ServerObject * objectToEditServerObject = NULL; if (!JavaLibrary::getObject(jObjectToEdit, objectToEditServerObject) || !objectToEditServerObject) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("[script bug] objectToEdit is not a ServerObject in editFormData")); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsHateList.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsHateList.cpp index 758d57e9..324d719e 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsHateList.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsHateList.cpp @@ -90,7 +90,7 @@ void JNICALL ScriptMethodsHateListNamespace::setAggroImmuneDuration(JNIEnv * /*e NetworkId const playerNetworkId(player); PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(playerNetworkId)); - if (playerObject == nullptr) + if (playerObject == NULL) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsHateList::setAggroImmuneDuration() player(%s) Unable to resolve the object to a PlayerObject.", playerNetworkId.getValueString().c_str())); return; @@ -105,7 +105,7 @@ jboolean JNICALL ScriptMethodsHateListNamespace::isAggroImmune(JNIEnv * /*env*/, NetworkId const playerNetworkId(player); PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(playerNetworkId)); - if (playerObject == nullptr) + if (playerObject == NULL) { return JNI_FALSE; } @@ -120,7 +120,7 @@ void JNICALL ScriptMethodsHateListNamespace::addHate(JNIEnv * /*env*/, jobject / NetworkId const hateTargetNetworkId(hateTarget); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == nullptr) + if (objectTangibleObject == NULL) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsHateList::addHate() object(%s) hateTarget(%s) hate(%.2f) Unable to resolve the object to a TangibleObject.", networkId.getValueString().c_str(), hateTargetNetworkId.getValueString().c_str(), hate)); return; @@ -148,7 +148,7 @@ void JNICALL ScriptMethodsHateListNamespace::addHateDot(JNIEnv * /*env*/, jobjec NetworkId const hateTargetNetworkId(hateTarget); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == nullptr) + if (objectTangibleObject == NULL) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsHateList::addHateDot() object(%s) hateTarget(%s) hate(%.2f) seconds(%d) Unable to resolve the object to a TangibleObject.", networkId.getValueString().c_str(), hateTargetNetworkId.getValueString().c_str(), hate, seconds)); return; @@ -178,7 +178,7 @@ void JNICALL ScriptMethodsHateListNamespace::setHate(JNIEnv * /*env*/, jobject / NetworkId const hateTargetNetworkId(hateTarget); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == nullptr) + if (objectTangibleObject == NULL) { WARNING(true, ("ScriptMethodsHateList::setHate() object(%s) hateTarget(%s) hate(%.2f) Unable to resolve the object to a TangibleObject.", networkId.getValueString().c_str(), hateTargetNetworkId.getValueString().c_str(), hate)); return; @@ -208,7 +208,7 @@ void JNICALL ScriptMethodsHateListNamespace::removeHateTarget(JNIEnv * /*env*/, NetworkId const hateTargetNetworkId(hateTarget); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == nullptr) + if (objectTangibleObject == NULL) { WARNING(true, ("ScriptMethodsHateList::removeHateTarget() object(%s) hateTarget(%s) Unable to resolve the object to a TangibleObject.", networkId.getValueString().c_str(), hateTargetNetworkId.getValueString().c_str())); return; @@ -238,7 +238,7 @@ jfloat JNICALL ScriptMethodsHateListNamespace::getHate(JNIEnv * /*env*/, jobject NetworkId const hateTargetNetworkId(hateTarget); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == nullptr) + if (objectTangibleObject == NULL) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsHateList::getHate() object(%s) hateTarget(%s) Unable to resolve the object to a TangibleObject.", networkId.getValueString().c_str(), hateTargetNetworkId.getValueString().c_str())); return 0.0f; @@ -264,7 +264,7 @@ jfloat JNICALL ScriptMethodsHateListNamespace::getMaxHate(JNIEnv * /*env*/, jobj NetworkId const networkId(object); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == nullptr) + if (objectTangibleObject == NULL) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsHateList::getMaxHate() object(%s) Unable to resolve the object to a TangibleObject.", networkId.getValueString().c_str())); return 0.0f; @@ -281,7 +281,7 @@ void JNICALL ScriptMethodsHateListNamespace::clearHateList(JNIEnv * /*env*/, job NetworkId const networkId(object); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == nullptr) + if (objectTangibleObject == NULL) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsHateList::clearHateList() Unable to resolve the object(%s) to a TangibleObject.", networkId.getValueString().c_str())); return; @@ -298,7 +298,7 @@ jlong JNICALL ScriptMethodsHateListNamespace::getHateTarget(JNIEnv * /*env*/, jo NetworkId const networkId(object); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == nullptr) + if (objectTangibleObject == NULL) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsHateList::getHateTarget() Unable to resolve the object(%s) to a TangibleObject.", networkId.getValueString().c_str())); return 0; @@ -317,7 +317,7 @@ jlongArray JNICALL ScriptMethodsHateListNamespace::getHateList(JNIEnv * /*env*/, LOGC(AiLogManager::isLogging(networkId), "debug_ai", ("ScriptMethodsHateList::getHateList() object(%s)", networkId.getValueString().c_str())); - if (objectTangibleObject == nullptr) + if (objectTangibleObject == NULL) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsHateList::getHateList() Unable to resolve the object(%s) to a TangibleObject.", networkId.getValueString().c_str())); return 0; @@ -348,7 +348,7 @@ jboolean JNICALL ScriptMethodsHateListNamespace::isOnHateList(JNIEnv * /*env*/, NetworkId const targetNetworkId(target); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == nullptr) + if (objectTangibleObject == NULL) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsHateList::isOnHateList() object(%s) target(%s) Unable to resolve the object to a TangibleObject.", networkId.getValueString().c_str(), targetNetworkId.getValueString().c_str())); return JNI_FALSE; @@ -369,7 +369,7 @@ void JNICALL ScriptMethodsHateListNamespace::resetHateTimer(JNIEnv * /*env*/, jo NetworkId const networkId(object); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == nullptr) + if (objectTangibleObject == NULL) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsHateList::resetHateTimer() object(%s) Unable to resolve the object to a TangibleObject.", networkId.getValueString().c_str())); return; @@ -385,7 +385,7 @@ void JNICALL ScriptMethodsHateListNamespace::setAILeashTime(JNIEnv * /*env*/, jo NetworkId const networkId(object); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == nullptr) + if (objectTangibleObject == NULL) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsHateList::setAILeashTime() object(%s) time(%.2f) Unable to resolve the object to a TangibleObject.", networkId.getValueString().c_str(), time)); return; @@ -408,7 +408,7 @@ jfloat JNICALL ScriptMethodsHateListNamespace::getAILeashTime(JNIEnv * /*env*/, NetworkId const networkId(object); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == nullptr) + if (objectTangibleObject == NULL) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsHateList::setAILeashTime() object(%s) time(%.2f) Unable to resolve the object to a TangibleObject.", networkId.getValueString().c_str(), time)); return 0.0; @@ -434,7 +434,7 @@ void JNICALL ScriptMethodsHateListNamespace::forceHateTarget(JNIEnv * env, jobje NetworkId const hateTargetNetworkId(target); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == nullptr) + if (objectTangibleObject == NULL) { WARNING(true, ("ScriptMethodsHateList::forceHateTarget() object(%s) hateTarget(%s) Unable to resolve the object to a TangibleObject.", networkId.getValueString().c_str(), hateTargetNetworkId.getValueString().c_str())); return; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsHolocube.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsHolocube.cpp index 31a83e7c..51088b13 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsHolocube.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsHolocube.cpp @@ -47,7 +47,7 @@ jboolean JNICALL ScriptMethodsHolocubeNamespace::openHolocronToPage(JNIEnv *env, { JavaStringParam localPage(jpage); - ServerObject* so = nullptr; + ServerObject* so = NULL; if(!JavaLibrary::getObject(client, so)) { WARNING (true, ("[Script bug] Could not get ServerObject for value passed in for paramter:client in JavaLibrary::openHolocronToPage")); @@ -76,7 +76,7 @@ jboolean JNICALL ScriptMethodsHolocubeNamespace::openHolocronToPage(JNIEnv *env, jboolean JNICALL ScriptMethodsHolocubeNamespace::closeHolocron(JNIEnv *env, jobject self, jlong client) { - ServerObject* so = nullptr; + ServerObject* so = NULL; if(!JavaLibrary::getObject(client, so)) { WARNING (true, ("[Script bug] Could not get ServerObject for value passed in for paramter:client in JavaLibrary::closeHolocron")); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsHyperspace.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsHyperspace.cpp index 784a2717..665f9460 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsHyperspace.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsHyperspace.cpp @@ -131,10 +131,10 @@ void JNICALL ScriptMethodsHyperspaceNamespace::hyperspacePlayerToLocation(JNIEnv // Make sure the ship is not docking - Controller const * const controller = (shipObject != nullptr) ? shipObject->getController() : nullptr; - ShipController const * const shipController = (controller != nullptr) ? controller->asShipController() : nullptr; + Controller const * const controller = (shipObject != NULL) ? shipObject->getController() : NULL; + ShipController const * const shipController = (controller != NULL) ? controller->asShipController() : NULL; - if ( (shipController != nullptr) + if ( (shipController != NULL) && shipController->isDocking()) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("hyperspacePlayerToLocation - Hyperspacing is not allowed on ships that are currently docking: %s", shipObject->getDebugInformation().c_str())); @@ -211,10 +211,10 @@ void JNICALL ScriptMethodsHyperspaceNamespace::hyperspacePlayerToLocationCellNam // Make sure the ship is not docking - Controller const * const controller = (shipObject != nullptr) ? shipObject->getController() : nullptr; - ShipController const * const shipController = (controller != nullptr) ? controller->asShipController() : nullptr; + Controller const * const controller = (shipObject != NULL) ? shipObject->getController() : NULL; + ShipController const * const shipController = (controller != NULL) ? controller->asShipController() : NULL; - if ( (shipController != nullptr) + if ( (shipController != NULL) && shipController->isDocking()) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("hyperspacePlayerToLocation - Hyperspacing is not allowed on ships that are currently docking: %s", shipObject->getDebugInformation().c_str())); @@ -272,7 +272,7 @@ void JNICALL ScriptMethodsHyperspaceNamespace::hyperspacePlayerToHyperspacePoint return; } - CreatureObject * const playerCreature = playerObject ? playerObject->asCreatureObject() : nullptr; + CreatureObject * const playerCreature = playerObject ? playerObject->asCreatureObject() : NULL; if(!playerCreature) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("hyperspacePlayerToHyperspacePoint - player is not a creature")); @@ -309,10 +309,10 @@ void JNICALL ScriptMethodsHyperspaceNamespace::hyperspacePlayerToHyperspacePoint // Make sure the ship is not docking - Controller const * const controller = (shipObject != nullptr) ? shipObject->getController() : nullptr; - ShipController const * const shipController = (controller != nullptr) ? controller->asShipController() : nullptr; + Controller const * const controller = (shipObject != NULL) ? shipObject->getController() : NULL; + ShipController const * const shipController = (controller != NULL) ? controller->asShipController() : NULL; - if ( (shipController != nullptr) + if ( (shipController != NULL) && shipController->isDocking()) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("hyperspacePlayerToHyperspacePoint - Hyperspacing is not allowed on ships that are currently docking: %s", shipObject->getDebugInformation().c_str())); @@ -395,7 +395,7 @@ void JNICALL ScriptMethodsHyperspaceNamespace::hyperspacePrepareShipOnClient(JNI return; } - CreatureObject * const playerCreature = playerObject ? playerObject->asCreatureObject() : nullptr; + CreatureObject * const playerCreature = playerObject ? playerObject->asCreatureObject() : NULL; if(playerCreature == 0) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("hyperspacePlayerToHyperspacePoint - player is not a creature")); @@ -425,8 +425,8 @@ void JNICALL ScriptMethodsHyperspaceNamespace::hyperspacePrepareShipOnClient(JNI if (HyperspaceManager::getHyperspacePoint(hyperspacePoint, location)) { - Controller const * const controller = (shipObject != nullptr) ? shipObject->getController() : nullptr; - ShipController const * const shipController = (controller != nullptr) ? controller->asShipController() : nullptr; + Controller const * const controller = (shipObject != NULL) ? shipObject->getController() : NULL; + ShipController const * const shipController = (controller != NULL) ? controller->asShipController() : NULL; if (shipController != 0) { @@ -467,7 +467,7 @@ void JNICALL ScriptMethodsHyperspaceNamespace::hyperspaceRestoreShipOnClientFrom return; } - CreatureObject * const playerCreature = playerObject ? playerObject->asCreatureObject() : nullptr; + CreatureObject * const playerCreature = playerObject ? playerObject->asCreatureObject() : NULL; if(playerCreature == 0) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("hyperspacePlayerToHyperspacePoint - player is not a creature")); @@ -482,8 +482,8 @@ void JNICALL ScriptMethodsHyperspaceNamespace::hyperspaceRestoreShipOnClientFrom return; } - Controller const * const controller = (shipObject != nullptr) ? shipObject->getController() : nullptr; - ShipController const * const shipController = (controller != nullptr) ? controller->asShipController() : nullptr; + Controller const * const controller = (shipObject != NULL) ? shipObject->getController() : NULL; + ShipController const * const shipController = (controller != NULL) ? controller->asShipController() : NULL; if (shipController != 0) { @@ -514,7 +514,7 @@ jstring JNICALL ScriptMethodsHyperspaceNamespace::getSceneForHyperspacePoint(JNI if (!JavaLibrary::convert(localHyperspacePoint, hyperspacePoint)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("getSceneForHyperspacePoint - could not get hyperspace point name")); - return nullptr; + return NULL; } if(HyperspaceManager::isValidHyperspacePoint(hyperspacePoint)) @@ -528,7 +528,7 @@ jstring JNICALL ScriptMethodsHyperspaceNamespace::getSceneForHyperspacePoint(JNI return str.getReturnValue(); } } - return nullptr; + return NULL; } //------------------------------------------------------------------------------------------------ diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsImageDesign.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsImageDesign.cpp index 4866318b..b85f1516 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsImageDesign.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsImageDesign.cpp @@ -70,7 +70,7 @@ void JNICALL ScriptMethodsImageDesignNamespace::imagedesignStart(JNIEnv *env, jo return; } - //the terminal can be nullptr (that means no ID terminal is being used, which is fine) + //the terminal can be NULL (that means no ID terminal is being used, which is fine) ServerObject * terminalObj = 0; JavaLibrary::getObject(jterminalId, terminalObj); @@ -185,8 +185,8 @@ jboolean JNICALL ScriptMethodsImageDesignNamespace::imagedesignValidated(JNIEnv WARNING(true, ("morph keys and values arrays are of diffent sizes")); return JNI_FALSE; } - jfloat * const morphChangesValuesArray = env->GetFloatArrayElements(jmorphChangesValues, nullptr); - if (morphChangesValuesArray == nullptr) + jfloat * const morphChangesValuesArray = env->GetFloatArrayElements(jmorphChangesValues, NULL); + if (morphChangesValuesArray == NULL) { return JNI_FALSE; } @@ -211,8 +211,8 @@ jboolean JNICALL ScriptMethodsImageDesignNamespace::imagedesignValidated(JNIEnv WARNING(true, ("index keys and values arrays are of diffent sizes")); return JNI_FALSE; } - jint * const indexChangesValuesArray = env->GetIntArrayElements(jindexChangesValues, nullptr); - if (indexChangesValuesArray == nullptr) + jint * const indexChangesValuesArray = env->GetIntArrayElements(jindexChangesValues, NULL); + if (indexChangesValuesArray == NULL) { return JNI_FALSE; } diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsInstallation.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsInstallation.cpp index 5c159849..b96b27d2 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsInstallation.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsInstallation.cpp @@ -224,7 +224,7 @@ void JNICALL ScriptMethodsInstallationNamespace::displayStructurePermissionData( UNREF(self); //get the player id from player - CreatureObject* creatureObject = nullptr; + CreatureObject* creatureObject = NULL; if (!JavaLibrary::getObject(player, creatureObject)) return; @@ -290,7 +290,7 @@ jfloat JNICALL ScriptMethodsInstallationNamespace::getPowerValue(JNIEnv *env, jo UNREF(self); //get the player id from player - const InstallationObject * installation = nullptr; + const InstallationObject * installation = NULL; if (!JavaLibrary::getObject(target, installation)) return 0; @@ -314,7 +314,7 @@ jboolean JNICALL ScriptMethodsInstallationNamespace::setPowerValue(JNIEnv *env, UNREF(self); //get the player id from player - InstallationObject * installation = nullptr; + InstallationObject * installation = NULL; if (!JavaLibrary::getObject(target, installation)) return JNI_FALSE; @@ -340,7 +340,7 @@ jboolean JNICALL ScriptMethodsInstallationNamespace::incrementPowerValue(JNIEnv UNREF(self); //get the player id from player - InstallationObject * installation = nullptr; + InstallationObject * installation = NULL; if (!JavaLibrary::getObject(target, installation)) return JNI_FALSE; @@ -365,7 +365,7 @@ jfloat JNICALL ScriptMethodsInstallationNamespace::getPowerRate(JNIEnv *env, job UNREF(self); //get the player id from player - const InstallationObject * installation = nullptr; + const InstallationObject * installation = NULL; if (!JavaLibrary::getObject(target, installation)) return 0; @@ -389,7 +389,7 @@ jboolean JNICALL ScriptMethodsInstallationNamespace::setPowerRate(JNIEnv *env, j UNREF(self); //get the player id from player - InstallationObject * installation = nullptr; + InstallationObject * installation = NULL; if (!JavaLibrary::getObject(target, installation)) return JNI_FALSE; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsInteriors.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsInteriors.cpp index da0c833b..fb6c3557 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsInteriors.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsInteriors.cpp @@ -137,7 +137,7 @@ jlong JNICALL ScriptMethodsInteriorsNamespace::createObjectInCell(JNIEnv *env, j return 0; std::string templateName; - ServerObject* sourceObject = nullptr; + ServerObject* sourceObject = NULL; if (!JavaLibrary::getObject(source, sourceObject)) return 0; templateName = sourceObject->getTemplateName(); @@ -149,7 +149,7 @@ jlong JNICALL ScriptMethodsInteriorsNamespace::_createObjectInCellInternal(JNIEn { JavaStringParam localCellName(cellName); - ServerObject * portallizedObject = nullptr; + ServerObject * portallizedObject = NULL; if (!JavaLibrary::getObject(building, portallizedObject)) return 0; @@ -183,7 +183,7 @@ jlong JNICALL ScriptMethodsInteriorsNamespace::_createObjectInCellInternal(JNIEn Transform tr; tr.setPosition_p(newPos); ServerObject *newObject = ServerWorld::createNewObject(templateName, tr, cellObject, false); - if (newObject == nullptr) + if (newObject == NULL) return 0; //@todo do we need to snap to floor or something? @@ -226,7 +226,7 @@ jlong JNICALL ScriptMethodsInteriorsNamespace::createObjectInCellAnywhere(JNIEnv return 0; std::string templateName; - ServerObject* sourceObject = nullptr; + ServerObject* sourceObject = NULL; if (!JavaLibrary::getObject(source, sourceObject)) return 0; templateName = sourceObject->getTemplateName(); @@ -261,7 +261,7 @@ jlong JNICALL ScriptMethodsInteriorsNamespace::_createObjectInCellAnywhereIntern //@todo need to find a way to get a good location in a cell. For now just use the coordinates of the cell? JavaStringParam localCellName(cellName); - ServerObject *portallizedObject = nullptr; + ServerObject *portallizedObject = NULL; if (!JavaLibrary::getObject(building, portallizedObject)) return 0; @@ -289,7 +289,7 @@ jlong JNICALL ScriptMethodsInteriorsNamespace::_createObjectInCellAnywhereIntern Transform tr; tr.setPosition_p(createPosition); ServerObject *newObject = ServerWorld::createNewObject(templateName, tr, cellObject, false); - if (newObject == nullptr) + if (newObject == NULL) return 0; // create an networkId to return @@ -306,7 +306,7 @@ jlong JNICALL ScriptMethodsInteriorsNamespace::_createObjectInCellAnywhereIntern jobjectArray JNICALL ScriptMethodsInteriorsNamespace::getCellNames(JNIEnv *env, jobject self, jlong target) { - ServerObject const *portallizedObject = nullptr; + ServerObject const *portallizedObject = NULL; if (!JavaLibrary::getObject(target, portallizedObject)) return 0; @@ -329,7 +329,7 @@ jobjectArray JNICALL ScriptMethodsInteriorsNamespace::getCellNames(JNIEnv *env, jstring JNICALL ScriptMethodsInteriorsNamespace::getCellName(JNIEnv *env, jobject self, jlong target) { - CellObject const *cellObject = nullptr; + CellObject const *cellObject = NULL; if (!JavaLibrary::getObject(target, cellObject)) return 0; @@ -342,7 +342,7 @@ jstring JNICALL ScriptMethodsInteriorsNamespace::getCellName(JNIEnv *env, jobjec } ServerObject const * const portallizedObject = safe_cast(ContainerInterface::getContainedByObject(*cellObject)); - if (portallizedObject == nullptr) + if (portallizedObject == NULL) return 0; PortalProperty const * const cellProp = portallizedObject->getPortalProperty(); @@ -370,7 +370,7 @@ jstring JNICALL ScriptMethodsInteriorsNamespace::getCellName(JNIEnv *env, jobjec jlongArray JNICALL ScriptMethodsInteriorsNamespace::getCellIds(JNIEnv *env, jobject self, jlong target) { - ServerObject const *portallizedObject = nullptr; + ServerObject const *portallizedObject = NULL; if (!JavaLibrary::getObject(target, portallizedObject)) return 0; @@ -387,11 +387,11 @@ jlongArray JNICALL ScriptMethodsInteriorsNamespace::getCellIds(JNIEnv *env, jobj cellIds.reserve(count); for (int i = 0; i < count; ++i) { - ServerObject const * cellObject = nullptr; + ServerObject const * cellObject = NULL; CellProperty const * const cellProp = portalProp->getCell(nameList[i]); - if (cellProp != nullptr) + if (cellProp != NULL) cellObject = cellProp->getOwner().asServerObject(); - if (cellObject != nullptr) + if (cellObject != NULL) { cellIds.push_back(cellObject->getNetworkId()); } @@ -412,7 +412,7 @@ jboolean JNICALL ScriptMethodsInteriorsNamespace::hasCell(JNIEnv *env, jobject s { JavaStringParam localCellName(cellName); - ServerObject const * serverObject = nullptr; + ServerObject const * serverObject = NULL; if (!JavaLibrary::getObject(portallizedObject, serverObject)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("JavaLibrary::hasCell passed invalid object")); @@ -448,7 +448,7 @@ jlong JNICALL ScriptMethodsInteriorsNamespace::getCellId(JNIEnv *env, jobject se { JavaStringParam localCellName(cellName); - ServerObject const * serverObject = nullptr; + ServerObject const * serverObject = NULL; if (!JavaLibrary::getObject(portallizedObject, serverObject)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("[script bug] JavaLibrary::getCellId passed invalid object")); @@ -571,7 +571,7 @@ jobject JNICALL ScriptMethodsInteriorsNamespace::getBuildingEjectLocation(JNIEnv if (building == 0) { - DEBUG_WARNING(true, ("[designer bug] getBuildingEjectLocation was passed a nullptr building objid")); + DEBUG_WARNING(true, ("[designer bug] getBuildingEjectLocation was passed a NULL building objid")); return 0; } @@ -598,7 +598,7 @@ jobject JNICALL ScriptMethodsInteriorsNamespace::getBuildingEjectLocation(JNIEnv CellProperty const *worldCell = CellProperty::getWorldCellProperty(); if (!worldCell) { - DEBUG_WARNING(true, ("getBuildingEjectLocation get a nullptr worldCell back from CellProperty::getWorldCellProperty()")); + DEBUG_WARNING(true, ("getBuildingEjectLocation get a NULL worldCell back from CellProperty::getWorldCellProperty()")); return 0; } @@ -666,7 +666,7 @@ jlong JNICALL ScriptMethodsInteriorsNamespace::moveHouseItemToPlayer(JNIEnv * /* { if (building == 0) { - DEBUG_WARNING(true, ("[designer bug] moveHouseItemToPlayer was passed a nullptr building objid")); + DEBUG_WARNING(true, ("[designer bug] moveHouseItemToPlayer was passed a NULL building objid")); return 0; } @@ -693,7 +693,7 @@ jlong JNICALL ScriptMethodsInteriorsNamespace::moveHouseItemToPlayer2(JNIEnv * / { if (building == 0) { - DEBUG_WARNING(true, ("[designer bug] moveHouseItemToPlayer2 was passed a nullptr building objid")); + DEBUG_WARNING(true, ("[designer bug] moveHouseItemToPlayer2 was passed a NULL building objid")); return 0; } @@ -721,7 +721,7 @@ void JNICALL ScriptMethodsInteriorsNamespace::deleteAllHouseItems(JNIEnv * /*env { if (building == 0) { - DEBUG_WARNING(true, ("[designer bug] deleteAllHouseItems was passed a nullptr building objid")); + DEBUG_WARNING(true, ("[designer bug] deleteAllHouseItems was passed a NULL building objid")); return ; } @@ -747,11 +747,11 @@ jboolean JNICALL ScriptMethodsInteriorsNamespace::areAllContentsLoaded(JNIEnv * { if (building == 0) { - DEBUG_WARNING(true, ("[designer bug] areAllContentsLoaded was passed a nullptr building objid")); + DEBUG_WARNING(true, ("[designer bug] areAllContentsLoaded was passed a NULL building objid")); return JNI_FALSE; } - const BuildingObject * buildingObject = nullptr; + const BuildingObject * buildingObject = NULL; if (!JavaLibrary::getObject(building, buildingObject)) { DEBUG_WARNING(true, ("[designer bug] areAllContentsLoaded was passed a non-ServerObject objid")); @@ -767,11 +767,11 @@ void JNICALL ScriptMethodsInteriorsNamespace::loadBuildingContents(JNIEnv * /*en { if (building == 0) { - DEBUG_WARNING(true, ("[designer bug] loadBuildingContents was passed a nullptr building objid")); + DEBUG_WARNING(true, ("[designer bug] loadBuildingContents was passed a NULL building objid")); return; } - BuildingObject * buildingObject = nullptr; + BuildingObject * buildingObject = NULL; if (!JavaLibrary::getObject(building, buildingObject)) { DEBUG_WARNING(true, ("[designer bug] loadBuildingContents was passed a non-ServerObject objid")); @@ -815,9 +815,9 @@ jboolean JNICALL ScriptMethodsInteriorsNamespace::isAtPendingLoadRequestLimit(JN jstring JNICALL ScriptMethodsInteriorsNamespace::getCellLabel(JNIEnv * env, jobject self, jlong target) { - CellObject const *cellObject = nullptr; + CellObject const *cellObject = NULL; if (!JavaLibrary::getObject(target, cellObject)) - return nullptr; + return NULL; JavaString cellLabel(cellObject->getCellLabel()); return cellLabel.getReturnValue(); @@ -833,7 +833,7 @@ jboolean JNICALL ScriptMethodsInteriorsNamespace::setCellLabel(JNIEnv * env, job if (!JavaLibrary::convert(localCellLabel, cellLabelString)) return JNI_FALSE; - CellObject * cellObject = nullptr; + CellObject * cellObject = NULL; if (!JavaLibrary::getObject(target, cellObject)) return JNI_FALSE; @@ -846,7 +846,7 @@ jboolean JNICALL ScriptMethodsInteriorsNamespace::setCellLabel(JNIEnv * env, job jboolean JNICALL ScriptMethodsInteriorsNamespace::setCellLabelOffset(JNIEnv * env, jobject self, jlong target, jfloat x, jfloat y, jfloat z) { - CellObject * cellObject = nullptr; + CellObject * cellObject = NULL; if (!JavaLibrary::getObject(target, cellObject)) return JNI_FALSE; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsJedi.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsJedi.cpp index 188193c7..1afeec06 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsJedi.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsJedi.cpp @@ -120,7 +120,7 @@ jint JNICALL ScriptMethodsJediNamespace::getMaxForcePower(JNIEnv *env, jobject s { UNREF(self); - const CreatureObject * creature = nullptr; + const CreatureObject * creature = NULL; if (!JavaLibrary::getObject(target, creature)) return 0; @@ -128,7 +128,7 @@ jint JNICALL ScriptMethodsJediNamespace::getMaxForcePower(JNIEnv *env, jobject s return 0; PlayerObject const * const playerObject = PlayerCreatureController::getPlayerObject(creature); - if (playerObject == nullptr) + if (playerObject == NULL) return 0; return playerObject->getMaxForcePower(); @@ -148,7 +148,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::setMaxForcePower(JNIEnv *env, jobje { UNREF(self); - CreatureObject * creature = nullptr; + CreatureObject * creature = NULL; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -159,7 +159,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::setMaxForcePower(JNIEnv *env, jobje } PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(creature); - if (playerObject == nullptr) + if (playerObject == NULL) return JNI_FALSE; playerObject->setMaxForcePower(value); @@ -180,7 +180,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::alterMaxForcePower(JNIEnv *env, job { UNREF(self); - CreatureObject * creature = nullptr; + CreatureObject * creature = NULL; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -191,7 +191,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::alterMaxForcePower(JNIEnv *env, job } PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(creature); - if (playerObject == nullptr) + if (playerObject == NULL) return JNI_FALSE; playerObject->setMaxForcePower(playerObject->getMaxForcePower() + delta); @@ -211,7 +211,7 @@ jint JNICALL ScriptMethodsJediNamespace::getForcePower(JNIEnv *env, jobject self { UNREF(self); - const CreatureObject * creature = nullptr; + const CreatureObject * creature = NULL; if (!JavaLibrary::getObject(target, creature)) return 0; @@ -219,7 +219,7 @@ jint JNICALL ScriptMethodsJediNamespace::getForcePower(JNIEnv *env, jobject self return 0; PlayerObject const * const playerObject = PlayerCreatureController::getPlayerObject(creature); - if (playerObject == nullptr) + if (playerObject == NULL) return 0; return playerObject->getForcePower(); @@ -239,7 +239,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::setForcePower(JNIEnv *env, jobject { UNREF(self); - CreatureObject * creature = nullptr; + CreatureObject * creature = NULL; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -250,7 +250,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::setForcePower(JNIEnv *env, jobject } PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(creature); - if (playerObject == nullptr) + if (playerObject == NULL) return JNI_FALSE; playerObject->setForcePower(value); @@ -271,7 +271,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::alterForcePower(JNIEnv *env, jobjec { UNREF(self); - CreatureObject * creature = nullptr; + CreatureObject * creature = NULL; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -282,7 +282,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::alterForcePower(JNIEnv *env, jobjec } PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(creature); - if (playerObject == nullptr) + if (playerObject == NULL) return JNI_FALSE; playerObject->setForcePower(playerObject->getForcePower() + delta); @@ -302,7 +302,7 @@ jfloat JNICALL ScriptMethodsJediNamespace::getForcePowerRegenRate(JNIEnv *env, j { UNREF(self); - const CreatureObject * creature = nullptr; + const CreatureObject * creature = NULL; if (!JavaLibrary::getObject(target, creature)) return 0; @@ -310,7 +310,7 @@ jfloat JNICALL ScriptMethodsJediNamespace::getForcePowerRegenRate(JNIEnv *env, j return 0; PlayerObject const * const playerObject = PlayerCreatureController::getPlayerObject(creature); - if (playerObject == nullptr) + if (playerObject == NULL) return 0; return playerObject->getForcePowerRegenRate(); @@ -330,7 +330,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::setForcePowerRegenRate(JNIEnv *env, { UNREF(self); - CreatureObject * creature = nullptr; + CreatureObject * creature = NULL; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -341,7 +341,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::setForcePowerRegenRate(JNIEnv *env, } PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(creature); - if (playerObject == nullptr) + if (playerObject == NULL) return JNI_FALSE; playerObject->setForcePowerRegenRate(rate); @@ -359,7 +359,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::setForcePowerRegenRate(JNIEnv *env, */ jint JNICALL ScriptMethodsJediNamespace::getJediState(JNIEnv *env, jobject self, jlong jedi) { - const CreatureObject * object = nullptr; + const CreatureObject * object = NULL; if (!JavaLibrary::getObject(jedi, object)) { WARNING(true, ("JavaLibrary::getJediState did not find creature for id passed in")); @@ -367,7 +367,7 @@ jint JNICALL ScriptMethodsJediNamespace::getJediState(JNIEnv *env, jobject self, } const SwgPlayerObject * player = safe_cast(PlayerCreatureController::getPlayerObject(object)); - if (player == nullptr) + if (player == NULL) { WARNING(true, ("JavaLibrary::getJediState did not find player for creature " "%s", object->getNetworkId().getValueString().c_str())); @@ -389,12 +389,12 @@ jint JNICALL ScriptMethodsJediNamespace::getJediState(JNIEnv *env, jobject self, */ jboolean JNICALL ScriptMethodsJediNamespace::setJediState(JNIEnv *env, jobject self, jlong jedi, jint state) { - CreatureObject * object = nullptr; + CreatureObject * object = NULL; if (!JavaLibrary::getObject(jedi, object)) return JNI_FALSE; SwgPlayerObject * const player = safe_cast(PlayerCreatureController::getPlayerObject(object)); - if (player == nullptr) + if (player == NULL) return JNI_FALSE; if (state == JS_none || @@ -424,7 +424,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::setJediState(JNIEnv *env, jobject s */ jboolean JNICALL ScriptMethodsJediNamespace::hasJediSlot(JNIEnv * env, jobject self, jlong target) { - const ServerObject * player = nullptr; + const ServerObject * player = NULL; if (!JavaLibrary::getObject(target, player)) return JNI_FALSE; @@ -444,12 +444,12 @@ jboolean JNICALL ScriptMethodsJediNamespace::hasJediSlot(JNIEnv * env, jobject s */ jboolean JNICALL ScriptMethodsJediNamespace::addJediSlot(JNIEnv * env, jobject self, jlong target) { - const CreatureObject * object = nullptr; + const CreatureObject * object = NULL; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; PlayerObject const * const player = PlayerCreatureController::getPlayerObject(object); - if (player == nullptr) + if (player == NULL) return JNI_FALSE; player->addJediToAccount(); @@ -475,12 +475,12 @@ jboolean JNICALL ScriptMethodsJediNamespace::isJedi(JNIEnv * env, jobject self, { UNREF(self); - const CreatureObject * creature = nullptr; + const CreatureObject * creature = NULL; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; const PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); - if (player == nullptr) + if (player == NULL) return JNI_FALSE; const SwgPlayerObject * jedi = safe_cast(player); @@ -502,12 +502,12 @@ jint JNICALL ScriptMethodsJediNamespace::getJediVisibility(JNIEnv * env, jobject { UNREF(self); - const CreatureObject * creature = nullptr; + const CreatureObject * creature = NULL; if (!JavaLibrary::getObject(target, creature)) return -1; const PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); - if (player == nullptr) + if (player == NULL) return JNI_FALSE; const SwgPlayerObject * jedi = safe_cast(player); @@ -531,12 +531,12 @@ jboolean JNICALL ScriptMethodsJediNamespace::setJediVisibility(JNIEnv * env, job { UNREF(self); - CreatureObject * creature = nullptr; + CreatureObject * creature = NULL; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); - if (player == nullptr) + if (player == NULL) return JNI_FALSE; SwgPlayerObject * jedi = safe_cast(player); @@ -561,12 +561,12 @@ jboolean JNICALL ScriptMethodsJediNamespace::changeJediVisibility(JNIEnv * env, { UNREF(self); - CreatureObject * creature = nullptr; + CreatureObject * creature = NULL; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); - if (player == nullptr) + if (player == NULL) return JNI_FALSE; SwgPlayerObject * jedi = safe_cast(player); @@ -591,19 +591,19 @@ jboolean JNICALL ScriptMethodsJediNamespace::setJediBountyValue(JNIEnv * env, jo { UNREF(self); - CreatureObject * creature = nullptr; + CreatureObject * creature = NULL; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; SwgCreatureObject const * jediCreature = safe_cast(creature); PlayerObject const * player = PlayerCreatureController::getPlayerObject(creature); - if (player == nullptr) + if (player == NULL) return JNI_FALSE; SwgPlayerObject const * jediPlayer = safe_cast(player); JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager == nullptr) + if (jediManager == NULL) return JNI_FALSE; jediManager->addJedi(creature->getNetworkId(), creature->getObjectName(), @@ -631,7 +631,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::setJediBountyValue(JNIEnv * env, jo * @param bounties limit for number of bounties on the Jedi statistic * @param state what state(s) the Jedi should have * - * @return a dictionary with the Jedi data on success, nullptr on error + * @return a dictionary with the Jedi data on success, null on error */ jobject JNICALL ScriptMethodsJediNamespace::requestJedi(JNIEnv * env, jobject self, jint visibility, jint bountyValue, jint minLevel, jint maxLevel, jint hoursAlive, jint bounties, jint state) @@ -640,7 +640,7 @@ jobject JNICALL ScriptMethodsJediNamespace::requestJedi(JNIEnv * env, jobject se JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager == nullptr) + if (jediManager == NULL) return 0; ScriptParams params; @@ -658,7 +658,7 @@ jobject JNICALL ScriptMethodsJediNamespace::requestJedi(JNIEnv * env, jobject se * @param self class calling this function * @param target the id of the Jedi * - * @return a dictionary with the Jedi data on success, nullptr on error + * @return a dictionary with the Jedi data on success, null on error */ jobject JNICALL ScriptMethodsJediNamespace::requestOneJedi(JNIEnv * env, jobject self, jlong target) { @@ -666,7 +666,7 @@ jobject JNICALL ScriptMethodsJediNamespace::requestOneJedi(JNIEnv * env, jobject JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager == nullptr) + if (jediManager == NULL) return 0; const NetworkId id(target); @@ -704,7 +704,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::requestJediBounty(JNIEnv * env, job JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager == nullptr) + if (jediManager == NULL) return JNI_FALSE; const NetworkId targetId(target); @@ -751,7 +751,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::removeJediBounty(JNIEnv * env, jobj JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager == nullptr) + if (jediManager == NULL) return JNI_FALSE; const NetworkId targetId(target); @@ -781,7 +781,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::removeAllJediBounties(JNIEnv * env, JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager == nullptr) + if (jediManager == NULL) return JNI_FALSE; const NetworkId targetId(target); @@ -799,7 +799,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::removeAllJediBounties(JNIEnv * env, * @param self class calling this function * @param target the Jedi * - * @return an array of hunter ids, or nullptr on error + * @return an array of hunter ids, or null on error */ jlongArray JNICALL ScriptMethodsJediNamespace::getJediBounties(JNIEnv * env, jobject self, jlong target) { @@ -807,7 +807,7 @@ jlongArray JNICALL ScriptMethodsJediNamespace::getJediBounties(JNIEnv * env, job JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager == nullptr) + if (jediManager == NULL) return 0; const NetworkId targetId(target); @@ -837,7 +837,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::isBeingHuntedByBountyHunter(JNIEnv JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager == nullptr) + if (jediManager == NULL) return JNI_FALSE; const NetworkId targetId(target); @@ -861,7 +861,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::isBeingHuntedByBountyHunter(JNIEnv * @param self class calling this function * @param hunter the bounty hunter * - * @return an array of jedi ids, or nullptr on error + * @return an array of jedi ids, or null on error */ jlongArray JNICALL ScriptMethodsJediNamespace::getBountyHunterBounties(JNIEnv * env, jobject self, jlong hunter) { @@ -869,7 +869,7 @@ jlongArray JNICALL ScriptMethodsJediNamespace::getBountyHunterBounties(JNIEnv * JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager == nullptr) + if (jediManager == NULL) return 0; const NetworkId hunterId(hunter); @@ -899,7 +899,7 @@ void JNICALL ScriptMethodsJediNamespace::updateJediScriptData(JNIEnv * env, jobj { JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager == nullptr) + if (jediManager == NULL) return; const NetworkId targetId(target); @@ -926,7 +926,7 @@ void JNICALL ScriptMethodsJediNamespace::removeJediScriptData(JNIEnv * env, jobj { JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager == nullptr) + if (jediManager == NULL) return; const NetworkId targetId(target); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsMap.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsMap.cpp index 9d7f4dc1..9bcaa8d8 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsMap.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsMap.cpp @@ -253,7 +253,7 @@ jobjectArray JNICALL ScriptMethodsMapNamespace::getPlanetaryMapLocations( if(!JavaLibrary::convert(localCategory, categoryName)) { DEBUG_WARNING(true, ("[script bug] invalid category passed to getPlanetaryMapLocations")); - return nullptr; + return NULL; } } @@ -264,7 +264,7 @@ jobjectArray JNICALL ScriptMethodsMapNamespace::getPlanetaryMapLocations( if(!JavaLibrary::convert(localSubCategory, subCategoryName)) { DEBUG_WARNING(true, ("[script bug] invalid SubCategory passed to getPlanetaryMapLocations")); - return nullptr; + return NULL; } } @@ -282,12 +282,12 @@ jobjectArray JNICALL ScriptMethodsMapNamespace::getPlanetaryMapLocations( jlong jLocationId = mapLocation.getLocationId().getValue(); if (!jLocationId) - return nullptr; + return NULL; JavaString jNameString(mapLocation.getLocationName()); if (jNameString.getValue() == 0) - return nullptr; + return NULL; LocalRefPtr jMapLocation = createNewObject(JavaLibrary::getClsMapLocation(), JavaLibrary::getMidMapLocation(), @@ -299,7 +299,7 @@ jobjectArray JNICALL ScriptMethodsMapNamespace::getPlanetaryMapLocations( static_cast (mapLocation.getFlags())); if (jMapLocation == LocalRef::cms_nullPtr) - return nullptr; + return NULL; setObjectArrayElement(*jlocs, index, *jMapLocation); } @@ -318,7 +318,7 @@ jobjectArray JNICALL ScriptMethodsMapNamespace::getPlanetaryMapCategories (JNI if(!JavaLibrary::convert(localCategory, categoryName)) { DEBUG_WARNING(true, ("[script bug] invalid category passed to getPlanetaryMapCategories")); - return nullptr; + return NULL; } } @@ -350,14 +350,14 @@ jobject JNICALL ScriptMethodsMapNamespace::getPlanetaryMapLocation (JNI if (id == NetworkId::cms_invalid) { DEBUG_WARNING(true, ("[script bug] invalid locationId passed to getPlanetaryMapCategories")); - return nullptr; + return NULL; } int mlt = 0; const MapLocation * const mapLocation = PlanetMapManagerServer::getLocation (id, mlt); if (!mapLocation) - return nullptr; + return NULL; const JavaString jLocName (mapLocation->m_locationName); const JavaString jLocCategoryName (PlanetMapManager::findCategoryName (mapLocation->m_category)); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsMentalStates.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsMentalStates.cpp index fc11623f..c4dd20c1 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsMentalStates.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsMentalStates.cpp @@ -310,7 +310,7 @@ jboolean JNICALL ScriptMethodsMentalStatesNamespace::addMentalStateModifier(JNIE * @param mob id of creature to access * @param mentalState mental state we are interested in * - * @return the mental state modifiers for the creature, or nullptr if it has none + * @return the mental state modifiers for the creature, or null if it has none */ jobjectArray JNICALL ScriptMethodsMentalStatesNamespace::getMentalStateModifiers(JNIEnv *env, jobject self, jlong mob, jint mentalState) { @@ -697,7 +697,7 @@ jboolean JNICALL ScriptMethodsMentalStatesNamespace::addMentalStateModifierTowar * @param mob id of creature to access * @param mentalState mental state we are interested in * - * @return the mental state modifiers for the creature, or nullptr if it has none + * @return the mental state modifiers for the creature, or null if it has none */ jobjectArray JNICALL ScriptMethodsMentalStatesNamespace::getMentalStateModifiersToward(JNIEnv *env, jobject self, jlong mob, jlong target, jint mentalState) { diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsMission.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsMission.cpp index 13e82707..815bb35a 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsMission.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsMission.cpp @@ -170,17 +170,17 @@ void JNICALL ScriptMethodsMissionNamespace::abortMission(JNIEnv * env, jobject s } else { - DEBUG_WARNING(true, ("[designer bug] abortMission() missionObject is nullptr")); + DEBUG_WARNING(true, ("[designer bug] abortMission() missionObject is NULL")); } } else { - DEBUG_WARNING(true, ("[programmer bug] abortMission() self is nullptr")); + DEBUG_WARNING(true, ("[programmer bug] abortMission() self is NULL")); } } else { - DEBUG_WARNING(true, ("[programmer bug] abortMission() JNIEnv is nullptr")); + DEBUG_WARNING(true, ("[programmer bug] abortMission() JNIEnv is NULL")); } } @@ -283,17 +283,17 @@ jstring JNICALL ScriptMethodsMissionNamespace::getMissionCreator(JNIEnv * env, j } else { - DEBUG_WARNING(true, ("[designer bug] getMissionCreator() missionObject (parameter 1) is nullptr")); + DEBUG_WARNING(true, ("[designer bug] getMissionCreator() missionObject (parameter 1) is NULL")); } } else { - DEBUG_WARNING(true, ("[programmer bug] getMissionCreator() self is nullptr")); + DEBUG_WARNING(true, ("[programmer bug] getMissionCreator() self is NULL")); } } else { - DEBUG_WARNING(true, ("[programmer bug] getMissionCreator() JNIEnv is nullptr")); + DEBUG_WARNING(true, ("[programmer bug] getMissionCreator() JNIEnv is NULL")); } return result; } @@ -304,13 +304,13 @@ jobject JNICALL ScriptMethodsMissionNamespace::getMissionDescription(JNIEnv * en { if(! env) { - DEBUG_WARNING(true, ("[programmer bug] getMissionDescription() JNIEnv is nullptr")); + DEBUG_WARNING(true, ("[programmer bug] getMissionDescription() JNIEnv is NULL")); return 0; } if(! missionObject) { - DEBUG_WARNING(true, ("[designer bug] getMissionDescription() missionObject (parameter 1) is nullptr")); + DEBUG_WARNING(true, ("[designer bug] getMissionDescription() missionObject (parameter 1) is NULL")); return 0; } @@ -352,17 +352,17 @@ jint JNICALL ScriptMethodsMissionNamespace::getMissionDifficulty(JNIEnv * env, j } else { - DEBUG_WARNING(true, ("[designer bug] getMissionDifficulty() missionObject (parameter 1) is nullptr")); + DEBUG_WARNING(true, ("[designer bug] getMissionDifficulty() missionObject (parameter 1) is NULL")); } } else { - DEBUG_WARNING(true, ("[programmer bug] getMissionDifficulty() self is nullptr")); + DEBUG_WARNING(true, ("[programmer bug] getMissionDifficulty() self is NULL")); } } else { - DEBUG_WARNING(true, ("[programmer bug] getMissionDifficulty() JNIEnv is nullptr")); + DEBUG_WARNING(true, ("[programmer bug] getMissionDifficulty() JNIEnv is NULL")); } return result; } @@ -390,7 +390,7 @@ jobject JNICALL ScriptMethodsMissionNamespace::getMissionEndLocation(JNIEnv * en } else { - DEBUG_WARNING(true, ("[designer bug] getMissionEndLocation() missionObject (parameter1) is nullptr")); + DEBUG_WARNING(true, ("[designer bug] getMissionEndLocation() missionObject (parameter1) is NULL")); } return 0; } @@ -418,17 +418,17 @@ jint JNICALL ScriptMethodsMissionNamespace::getMissionReward(JNIEnv * env, jobje } else { - DEBUG_WARNING(true, ("[designer bug] getMissionReward() missionObject (parameter 1) is nullptr")); + DEBUG_WARNING(true, ("[designer bug] getMissionReward() missionObject (parameter 1) is NULL")); } } else { - DEBUG_WARNING(true, ("[programmer bug] getMissionReward() self is nullptr")); + DEBUG_WARNING(true, ("[programmer bug] getMissionReward() self is NULL")); } } else { - DEBUG_WARNING(true, ("[programmer bug] getMissionReward() JNIEnv is nullptr")); + DEBUG_WARNING(true, ("[programmer bug] getMissionReward() JNIEnv is NULL")); } return result; } @@ -454,7 +454,7 @@ jobject JNICALL ScriptMethodsMissionNamespace::getMissionStartLocation(JNIEnv * } else { - DEBUG_WARNING(true, ("[designer bug] getMissionStartLocation() missionObject (parameter 1) is nullptr")); + DEBUG_WARNING(true, ("[designer bug] getMissionStartLocation() missionObject (parameter 1) is NULL")); } return 0; } @@ -483,7 +483,7 @@ jstring JNICALL ScriptMethodsMissionNamespace::getMissionTargetName(JNIEnv * env } else { - DEBUG_WARNING(true, ("[designer bug] getMissionTargetName() missionObject (parameter 1) is nullptr")); + DEBUG_WARNING(true, ("[designer bug] getMissionTargetName() missionObject (parameter 1) is NULL")); } return 0; } @@ -494,7 +494,7 @@ jobject JNICALL ScriptMethodsMissionNamespace::getMissionTitle(JNIEnv * env, job { if(! missionObject) { - DEBUG_WARNING(true, ("[designer bug] getMissionTitle() missionObject (parameter 1) is nullptr")); + DEBUG_WARNING(true, ("[designer bug] getMissionTitle() missionObject (parameter 1) is NULL")); return 0; } @@ -537,7 +537,7 @@ jstring JNICALL ScriptMethodsMissionNamespace::getMissionType(JNIEnv * env, jobj } else { - DEBUG_WARNING(true, ("[designer bug] getMissionType() missionObject (parameter 1) is nullptr")); + DEBUG_WARNING(true, ("[designer bug] getMissionType() missionObject (parameter 1) is NULL")); } return 0; } @@ -556,7 +556,7 @@ jlong JNICALL ScriptMethodsMissionNamespace::getMissionHolder(JNIEnv * env, jobj MissionObject * mo = 0; if(JavaLibrary::getObject(missionObject, mo)) { - if (mo != nullptr && mo->getMissionHolderId() != NetworkId::cms_invalid) + if (mo != NULL && mo->getMissionHolderId() != NetworkId::cms_invalid) { result = (mo->getMissionHolderId()).getValue(); } @@ -572,17 +572,17 @@ jlong JNICALL ScriptMethodsMissionNamespace::getMissionHolder(JNIEnv * env, jobj } else { - DEBUG_WARNING(true, ("[designer bug] getMissionHolder() missionObject (parameter 1) is nullptr")); + DEBUG_WARNING(true, ("[designer bug] getMissionHolder() missionObject (parameter 1) is NULL")); } } else { - DEBUG_WARNING(true, ("[programmer bug] getMissionHolder() self is nullptr")); + DEBUG_WARNING(true, ("[programmer bug] getMissionHolder() self is NULL")); } } else { - DEBUG_WARNING(true, ("[programmer bug] getMissionHolder() JNIEnv is nullptr")); + DEBUG_WARNING(true, ("[programmer bug] getMissionHolder() JNIEnv is NULL")); } return result; } @@ -609,7 +609,7 @@ jstring JNICALL ScriptMethodsMissionNamespace::getMissionRootScriptName(JNIEnv * } else { - DEBUG_WARNING(true, ("[designer bug] getMissionRootScriptName() missionObject (parameter 1) is nullptr")); + DEBUG_WARNING(true, ("[designer bug] getMissionRootScriptName() missionObject (parameter 1) is NULL")); } return 0; } @@ -641,22 +641,22 @@ void JNICALL ScriptMethodsMissionNamespace::setMissionCreator(JNIEnv *env, jobje } else { - DEBUG_WARNING(true, ("[designer bug] setMissionCreator() creator (parameter 2) is nullptr")); + DEBUG_WARNING(true, ("[designer bug] setMissionCreator() creator (parameter 2) is NULL")); } } else { - DEBUG_WARNING(true, ("[designer bug] setMissionCreator() missionObject (parameter 1) is nullptr")); + DEBUG_WARNING(true, ("[designer bug] setMissionCreator() missionObject (parameter 1) is NULL")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionCreator() self is nullptr")); + DEBUG_WARNING(true, ("[programmer bug] setMissionCreator() self is NULL")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionCreator() JNIEnv is nullptr")); + DEBUG_WARNING(true, ("[programmer bug] setMissionCreator() JNIEnv is NULL")); } } @@ -686,7 +686,7 @@ void JNICALL ScriptMethodsMissionNamespace::setMissionDescription(JNIEnv * env, } else { - DEBUG_WARNING(true, ("[designer bug] setMissionDescription() missionObject (parameter 1) is nullptr")); + DEBUG_WARNING(true, ("[designer bug] setMissionDescription() missionObject (parameter 1) is NULL")); } } @@ -708,7 +708,7 @@ void JNICALL ScriptMethodsMissionNamespace::setMissionDifficulty(JNIEnv * env, j } else { - DEBUG_WARNING(true, ("[designer bug] setMissionDifficulty() missionObject (parameter 1) is nullptr")); + DEBUG_WARNING(true, ("[designer bug] setMissionDifficulty() missionObject (parameter 1) is NULL")); } } @@ -764,17 +764,17 @@ void JNICALL ScriptMethodsMissionNamespace::setMissionReward(JNIEnv * env, jobje } else { - DEBUG_WARNING(true, ("[designer bug] setMissionProfessionRank() missionObject (parameter 1) is nullptr")); + DEBUG_WARNING(true, ("[designer bug] setMissionProfessionRank() missionObject (parameter 1) is NULL")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionProfessionRank() self is nullptr")); + DEBUG_WARNING(true, ("[programmer bug] setMissionProfessionRank() self is NULL")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionProfessionRank() JNIEnv is nullptr")); + DEBUG_WARNING(true, ("[programmer bug] setMissionProfessionRank() JNIEnv is NULL")); } } @@ -806,7 +806,7 @@ void JNICALL ScriptMethodsMissionNamespace::setMissionStartLocation(JNIEnv * env } else { - DEBUG_WARNING(true, ("[designer bug] setMissionStartLocation() location (parameter 2) is nullptr")); + DEBUG_WARNING(true, ("[designer bug] setMissionStartLocation() location (parameter 2) is NULL")); } } else @@ -816,17 +816,17 @@ void JNICALL ScriptMethodsMissionNamespace::setMissionStartLocation(JNIEnv * env } else { - DEBUG_WARNING(true, ("[designer bug] setMissionStartLocation() missionObject (parameter 1) is nullptr")); + DEBUG_WARNING(true, ("[designer bug] setMissionStartLocation() missionObject (parameter 1) is NULL")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionStartLocation() self is nullptr")); + DEBUG_WARNING(true, ("[programmer bug] setMissionStartLocation() self is NULL")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionStartLocation() JNIEnv is nullptr")); + DEBUG_WARNING(true, ("[programmer bug] setMissionStartLocation() JNIEnv is NULL")); } } @@ -856,17 +856,17 @@ void JNICALL ScriptMethodsMissionNamespace::setMissionTargetAppearance(JNIEnv * } else { - DEBUG_WARNING(true, ("[designer bug] setMissionTarget() missionObject (parameter 1) is nullptr")); + DEBUG_WARNING(true, ("[designer bug] setMissionTarget() missionObject (parameter 1) is NULL")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionTarget() self is nullptr")); + DEBUG_WARNING(true, ("[programmer bug] setMissionTarget() self is NULL")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionTarget() JNIEnv is nullptr")); + DEBUG_WARNING(true, ("[programmer bug] setMissionTarget() JNIEnv is NULL")); } } @@ -896,17 +896,17 @@ void JNICALL ScriptMethodsMissionNamespace::setMissionTargetName(JNIEnv * env, j } else { - DEBUG_WARNING(true, ("[designer bug] setMissionTarget() missionObject (parameter 1) is nullptr")); + DEBUG_WARNING(true, ("[designer bug] setMissionTarget() missionObject (parameter 1) is NULL")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionTarget() self is nullptr")); + DEBUG_WARNING(true, ("[programmer bug] setMissionTarget() self is NULL")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionTarget() JNIEnv is nullptr")); + DEBUG_WARNING(true, ("[programmer bug] setMissionTarget() JNIEnv is NULL")); } } @@ -936,7 +936,7 @@ void JNICALL ScriptMethodsMissionNamespace::setMissionTitle(JNIEnv * env, jobjec } else { - DEBUG_WARNING(true, ("[designer bug] setMissionTitle() missionObject (parameter 1) is nullptr")); + DEBUG_WARNING(true, ("[designer bug] setMissionTitle() missionObject (parameter 1) is NULL")); } } @@ -969,22 +969,22 @@ void JNICALL ScriptMethodsMissionNamespace::setMissionType(JNIEnv *env, jobject } else { - DEBUG_WARNING(true, ("[designer bug] setMissionType() typeName (parameter 2) is nullptr")); + DEBUG_WARNING(true, ("[designer bug] setMissionType() typeName (parameter 2) is NULL")); } } else { - DEBUG_WARNING(true, ("[designer bug] setMissionType() missionObject (parameter 1) is nullptr")); + DEBUG_WARNING(true, ("[designer bug] setMissionType() missionObject (parameter 1) is NULL")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionType() self is nullptr")); + DEBUG_WARNING(true, ("[programmer bug] setMissionType() self is NULL")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionType() JNIEnv is nullptr")); + DEBUG_WARNING(true, ("[programmer bug] setMissionType() JNIEnv is NULL")); } } @@ -1022,22 +1022,22 @@ void JNICALL ScriptMethodsMissionNamespace::setMissionRootScriptName(JNIEnv *env } else { - DEBUG_WARNING(true, ("[designer bug] setMissionRootScriptName() rootScriptName (parameter 2) is nullptr")); + DEBUG_WARNING(true, ("[designer bug] setMissionRootScriptName() rootScriptName (parameter 2) is NULL")); } } else { - DEBUG_WARNING(true, ("[designer bug] setMissionRootScriptName() missionObject (parameter 1) is nullptr")); + DEBUG_WARNING(true, ("[designer bug] setMissionRootScriptName() missionObject (parameter 1) is NULL")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionRootScriptName() self is nullptr")); + DEBUG_WARNING(true, ("[programmer bug] setMissionRootScriptName() self is NULL")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionRootScriptName() JNIEnv is nullptr")); + DEBUG_WARNING(true, ("[programmer bug] setMissionRootScriptName() JNIEnv is NULL")); } } diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsMoney.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsMoney.cpp index d0afcd98..542b801e 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsMoney.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsMoney.cpp @@ -110,7 +110,7 @@ jboolean JNICALL ScriptMethodsMoneyNamespace::transferCashTo(JNIEnv *env, jobjec return JNI_FALSE; ServerObject *sourceObj = ServerWorld::findObjectByNetworkId(sourceObjId); - if (sourceObj == nullptr || targetObjId == NetworkId::cms_invalid || ownerOID == NetworkId::cms_invalid) + if (sourceObj == NULL || targetObjId == NetworkId::cms_invalid || ownerOID == NetworkId::cms_invalid) return JNI_FALSE; // Do money transfer (will be forwarded if object is not authoritative) @@ -157,7 +157,7 @@ jboolean JNICALL ScriptMethodsMoneyNamespace::transferBankCreditsTo(JNIEnv *env, return JNI_FALSE; ServerObject *sourceObj = ServerWorld::findObjectByNetworkId(sourceObjId); - if (sourceObj == nullptr || targetObjId == NetworkId::cms_invalid || ownerOID == NetworkId::cms_invalid) + if (sourceObj == NULL || targetObjId == NetworkId::cms_invalid || ownerOID == NetworkId::cms_invalid) return JNI_FALSE; // Do money transfer (will be forwarded if object is not authoritative) @@ -203,7 +203,7 @@ jboolean JNICALL ScriptMethodsMoneyNamespace::withdrawCashFromBank (JNIEnv *env, return JNI_FALSE; ServerObject *sourceObj = ServerWorld::findObjectByNetworkId(sourceObjId); - if (sourceObj == nullptr || ownerOID == NetworkId::cms_invalid) + if (sourceObj == NULL || ownerOID == NetworkId::cms_invalid) return JNI_FALSE; // Do money transfer (will be forwarded if object is not authoritative) @@ -243,7 +243,7 @@ jboolean JNICALL ScriptMethodsMoneyNamespace::depositCashToBank(JNIEnv *env, job if (failCallbackFunction != 0 && !JavaLibrary::convert(JavaStringParam(failCallbackFunction), failCallback)) return JNI_FALSE; - ServerObject *sourceObj = nullptr; + ServerObject *sourceObj = NULL; if (!JavaLibrary::getObject(source, sourceObj)) return JNI_FALSE; @@ -260,7 +260,7 @@ jboolean JNICALL ScriptMethodsMoneyNamespace::depositCashToBank(JNIEnv *env, job void JNICALL ScriptMethodsMoneyNamespace::depositToGalacticReserve(JNIEnv *env, jobject self, jlong player) { - CreatureObject * objPlayer = nullptr; + CreatureObject * objPlayer = NULL; if (!JavaLibrary::getObject(player, objPlayer) || !objPlayer) return; @@ -275,7 +275,7 @@ void JNICALL ScriptMethodsMoneyNamespace::depositToGalacticReserve(JNIEnv *env, void JNICALL ScriptMethodsMoneyNamespace::withdrawFromGalacticReserve(JNIEnv *env, jobject self, jlong player) { - CreatureObject * objPlayer = nullptr; + CreatureObject * objPlayer = NULL; if (!JavaLibrary::getObject(player, objPlayer) || !objPlayer) return; @@ -290,7 +290,7 @@ void JNICALL ScriptMethodsMoneyNamespace::withdrawFromGalacticReserve(JNIEnv *en jboolean JNICALL ScriptMethodsMoneyNamespace::canAccessGalacticReserve(JNIEnv *env, jobject self, jlong player) { - CreatureObject * objPlayer = nullptr; + CreatureObject * objPlayer = NULL; if (!JavaLibrary::getObject(player, objPlayer) || !objPlayer) return JNI_FALSE; @@ -376,7 +376,7 @@ jboolean JNICALL ScriptMethodsMoneyNamespace::transferBankCreditsToNamedAccount( return JNI_FALSE; ServerObject *sourceObj = ServerWorld::findObjectByNetworkId(sourceObjId); - if (sourceObj == nullptr || targetString.size() == 0 || ownerOID == NetworkId::cms_invalid) + if (sourceObj == NULL || targetString.size() == 0 || ownerOID == NetworkId::cms_invalid) return JNI_FALSE; // Do money transfer (will be forwarded if object is not authoritative) @@ -426,7 +426,7 @@ jboolean JNICALL ScriptMethodsMoneyNamespace::transferBankCreditsFromNamedAccoun return JNI_FALSE; ServerObject *targetObj = ServerWorld::findObjectByNetworkId(targetObjId); - if (targetObj == nullptr || sourceString.size() == 0 || ownerOID == NetworkId::cms_invalid) + if (targetObj == NULL || sourceString.size() == 0 || ownerOID == NetworkId::cms_invalid) return JNI_FALSE; // Do money transfer (will be forwarded if object is not authoritative) diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsMount.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsMount.cpp index 2779be7b..4f0e9c9f 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsMount.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsMount.cpp @@ -235,7 +235,7 @@ void JNICALL ScriptMethodsMountNamespace::dismountCreature(JNIEnv *env, jobject CreatureObject *const mountObject = riderObject->getMountedCreature(); if (!mountObject) { - LOG(LOCAL_LOG_CHANNEL, ("JavaLibrary::dismountCreature(): server id=[%d],rider id=[%s] has RidingMount state but CreatureObject::getMountedCreature() returns nullptr, skipping dismount.", GameServer::getInstance().getProcessId(), riderObject->getNetworkId().getValueString().c_str())); + LOG(LOCAL_LOG_CHANNEL, ("JavaLibrary::dismountCreature(): server id=[%d],rider id=[%s] has RidingMount state but CreatureObject::getMountedCreature() returns NULL, skipping dismount.", GameServer::getInstance().getProcessId(), riderObject->getNetworkId().getValueString().c_str())); return; } @@ -393,7 +393,7 @@ void JNICALL JNICALL ScriptMethodsMountNamespace::makeContainerStateInconsistent //-- Get the ServerObject from the object id. if (!containedObjectId) { - LOG("script-bug", ("makeContainerStateInconsistentTestOnly(): containedObjectId is nullptr")); + LOG("script-bug", ("makeContainerStateInconsistentTestOnly(): containedObjectId is NULL")); return; } @@ -428,7 +428,7 @@ void JNICALL JNICALL ScriptMethodsMountNamespace::makeContainerStateInconsistent Container* container = ContainerInterface::getContainer(*containerObject); if (!container) { - LOG("script-bug", ("makeContainerStateInconsistentTestOnly(): containerObject [%s] returned a nullptr container", containerObject->getNetworkId().getValueString().c_str())); + LOG("script-bug", ("makeContainerStateInconsistentTestOnly(): containerObject [%s] returned a NULL container", containerObject->getNetworkId().getValueString().c_str())); return; } diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsNewbieTutorial.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsNewbieTutorial.cpp index 037b7ff5..b94f7349 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsNewbieTutorial.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsNewbieTutorial.cpp @@ -439,7 +439,7 @@ jobject JNICALL ScriptMethodsNewbieTutorialNamespace::getStartingLocationInf if (!jName) { - WARNING (true, ("getStartingLocationInfo nullptr name")); + WARNING (true, ("getStartingLocationInfo null name")); return JNI_FALSE; } diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsNotification.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsNotification.cpp index 06d6b672..8c8cff43 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsNotification.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsNotification.cpp @@ -52,7 +52,7 @@ const JNINativeMethod NATIVES[] = { jint JNICALL ScriptMethodsNotificationNamespace::addNotification(JNIEnv *env, jobject self, jlong player, jstring contents, jboolean useNotificationIcon, jint iconStyle, jfloat timeout, jint channel, jstring sound) { - CreatureObject const * playerObject = nullptr; + CreatureObject const * playerObject = NULL; if (!JavaLibrary::getObject(player, playerObject)) return 0; @@ -79,7 +79,7 @@ jint JNICALL ScriptMethodsNotificationNamespace::addNotification(JNIEnv *env, jo void JNICALL ScriptMethodsNotificationNamespace::cancelNotification(JNIEnv *env, jobject self, jlong player, jint notification) { - CreatureObject const * playerObject = nullptr; + CreatureObject const * playerObject = NULL; if (!JavaLibrary::getObject(player, playerObject)) return; ClientNotificationBoxMessage cnbm(notification, playerObject->getNetworkId(), Unicode::emptyString, FALSE, 0, 0.0f, ClientNotificationBoxMessage::NC_SPECIAL_CANCEL, std::string("")); @@ -94,7 +94,7 @@ void JNICALL ScriptMethodsNotificationNamespace::cancelNotification(JNIEnv *env, void JNICALL ScriptMethodsNotificationNamespace::cancelAllNotifications(JNIEnv *env, jobject self, jlong player) { - CreatureObject const * playerObject = nullptr; + CreatureObject const * playerObject = NULL; if (!JavaLibrary::getObject(player, playerObject)) return; ClientNotificationBoxMessage cnbm(0, playerObject->getNetworkId(), Unicode::emptyString, FALSE, 0, 0.0f, ClientNotificationBoxMessage::NC_SPECIAL_CANCEL_ALL, std::string("")); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsNpc.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsNpc.cpp index f9c5e4ed..a617593b 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsNpc.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsNpc.cpp @@ -190,14 +190,14 @@ jboolean JNICALL ScriptMethodsNpcNamespace::_npcStartConversation(JNIEnv *env, j if (!JavaLibrary::convert (localConvoName, convoNameStr)) return JNI_FALSE; - TangibleObject * playerObject = nullptr; + TangibleObject * playerObject = NULL; if (!JavaLibrary::getObject(player, playerObject)) return JNI_FALSE; if (playerObject->isInNpcConversation()) return JNI_FALSE; - TangibleObject * npcObject = nullptr; + TangibleObject * npcObject = NULL; if (!JavaLibrary::getObject(npc, npcObject)) return JNI_FALSE; @@ -234,7 +234,7 @@ jboolean JNICALL ScriptMethodsNpcNamespace::_npcStartConversation(JNIEnv *env, j jboolean JNICALL ScriptMethodsNpcNamespace::npcStartConversation(JNIEnv *env, jobject self, jlong player, jlong npc, jstring convoName, jobject greeting, jstring greetingOob, jobjectArray responses) { - TangibleObject * speakerObject = nullptr; + TangibleObject * speakerObject = NULL; if (!JavaLibrary::getObject(npc, speakerObject) || !speakerObject) return JNI_FALSE; @@ -243,7 +243,7 @@ jboolean JNICALL ScriptMethodsNpcNamespace::npcStartConversation(JNIEnv *env, jo uint32 crc = Crc::crcNull; ObjectTemplate const * const ot = ObjectTemplateList::fetch(conversationAppearanceOverride); - ServerObjectTemplate const * const sot = ot ? ot->asServerObjectTemplate() : nullptr; + ServerObjectTemplate const * const sot = ot ? ot->asServerObjectTemplate() : NULL; if(sot) { std::string const & sharedTemplateName = sot->getSharedTemplate(); @@ -263,7 +263,7 @@ jboolean JNICALL ScriptMethodsNpcNamespace::npcStartConversationAppearanceOverri return JNI_FALSE; ObjectTemplate const * const ot = ObjectTemplateList::fetch(appearanceOverrideSharedTemplateNameStr); - ServerObjectTemplate const * const sot = ot ? ot->asServerObjectTemplate() : nullptr; + ServerObjectTemplate const * const sot = ot ? ot->asServerObjectTemplate() : NULL; if(!sot) { return JNI_FALSE; @@ -290,7 +290,7 @@ jboolean JNICALL ScriptMethodsNpcNamespace::npcEndConversation(JNIEnv *env, jobj { UNREF(self); - TangibleObject * playerObject = nullptr; + TangibleObject * playerObject = NULL; if (!JavaLibrary::getObject(player, playerObject)) return JNI_FALSE; @@ -318,7 +318,7 @@ jboolean JNICALL ScriptMethodsNpcNamespace::npcSpeak(JNIEnv *env, jobject self, { UNREF(self); - TangibleObject * playerObject = nullptr; + TangibleObject * playerObject = NULL; if (!JavaLibrary::getObject(player, playerObject)) return JNI_FALSE; @@ -367,7 +367,7 @@ jboolean JNICALL ScriptMethodsNpcNamespace::npcSetConversationResponses(JNIEnv * { UNREF(self); - TangibleObject * playerObject = nullptr; + TangibleObject * playerObject = NULL; if (!JavaLibrary::getObject(player, playerObject)) return JNI_FALSE; @@ -396,7 +396,7 @@ jboolean JNICALL ScriptMethodsNpcNamespace::npcAddConversationResponse(JNIEnv *e { UNREF(self); - TangibleObject * playerObject = nullptr; + TangibleObject * playerObject = NULL; if (!JavaLibrary::getObject(player, playerObject)) return JNI_FALSE; @@ -455,7 +455,7 @@ jboolean JNICALL ScriptMethodsNpcNamespace::npcRemoveConversationResponse(JNIEnv { UNREF(self); - TangibleObject * playerObject = nullptr; + TangibleObject * playerObject = NULL; if (!JavaLibrary::getObject(player, playerObject)) return JNI_FALSE; @@ -488,7 +488,7 @@ jboolean JNICALL ScriptMethodsNpcNamespace::isInNpcConversation(JNIEnv *env, job { UNREF(self); - TangibleObject * tangibleObject = nullptr; + TangibleObject * tangibleObject = NULL; if (!JavaLibrary::getObject(creature, tangibleObject)) return JNI_FALSE; @@ -506,13 +506,13 @@ jboolean JNICALL ScriptMethodsNpcNamespace::isInNpcConversation(JNIEnv *env, job * @param self class calling this function * @param creature creature being asked about * - * @return an array of obj_ids the creature is in conversation with, or nullptr on error + * @return an array of obj_ids the creature is in conversation with, or null on error */ jlongArray JNICALL ScriptMethodsNpcNamespace::getNpcConversants(JNIEnv *env, jobject self, jlong creature) { UNREF(self); - TangibleObject * tangibleObject = nullptr; + TangibleObject * tangibleObject = NULL; if (!JavaLibrary::getObject(creature, tangibleObject)) return 0; @@ -621,7 +621,7 @@ jboolean JNICALL ScriptMethodsNpcNamespace::isNameReservedIgnoreRules(JNIEnv *en jboolean JNICALL ScriptMethodsNpcNamespace::npcEndConversationWithMessage(JNIEnv * /*env*/, jobject /*self*/, jlong player, jobject response, jstring responseOob) { - TangibleObject * playerObject = nullptr; + TangibleObject * playerObject = NULL; if(!JavaLibrary::getObject(player, playerObject)) return JNI_FALSE; @@ -658,7 +658,7 @@ jboolean JNICALL ScriptMethodsNpcNamespace::npcEndConversationWithMessage(JNIEnv jboolean JNICALL ScriptMethodsNpcNamespace::setNpcDifficulty(JNIEnv *env, jobject self, jlong npc, jlong difficulty) { - TangibleObject * npcObject = nullptr; + TangibleObject * npcObject = NULL; if (!JavaLibrary::getObject(npc, npcObject)) return JNI_FALSE; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsObjectCreate.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsObjectCreate.cpp index 2f967f59..37ab2bac 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsObjectCreate.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsObjectCreate.cpp @@ -257,11 +257,11 @@ jlong ScriptMethodsObjectCreateNamespace::createTheater(const std::vector float centerX = minx + dx / 2.0f + center.x; float centerZ = minz + dz / 2.0f + center.z; - TerrainGenerator::Layer * layer = nullptr; + TerrainGenerator::Layer * layer = NULL; if (locationType == IntangibleObject::TLT_flatten) { layer = TerrainModificationHelper::importLayer(THEATER_FLATTEN_LAYER.c_str()); - if (layer == nullptr) + if (layer == NULL) { WARNING (true, ("Layer %s not found for theater, using getGoodLocation " "instead", THEATER_FLATTEN_LAYER.c_str())); @@ -292,7 +292,7 @@ jlong ScriptMethodsObjectCreateNamespace::createTheater(const std::vector IntangibleObject * theater = safe_cast(ServerWorld::createNewObject(THEATER_TEMPLATE, tr, 0, false)); NOT_NULL(theater); theater->setTheater(); - if (layer != nullptr) + if (layer != NULL) { theater->setLayer(layer); } @@ -328,7 +328,7 @@ jlong ScriptMethodsObjectCreateNamespace::createTheater(const std::vector * @param source the template id or the object id to create the object with * @param location where to put the object * - * @return the new object, or nullptr on error + * @return the new object, or null on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInWorld(JNIEnv *env, jobject self, jlong source, jobject location) { @@ -340,7 +340,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInWorld(JNIEnv // determine what source is and create the object std::string localName; - ServerObject* object = nullptr; + ServerObject* object = NULL; if (!JavaLibrary::getObject(source, object)) return 0; localName = object->getTemplateName(); @@ -366,7 +366,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInWorld(JNIEnv * @param source the template id or the object id to create the object with * @param location where to put the object * - * @return the new object, or nullptr on error + * @return the new object, or null on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInWorldString(JNIEnv *env, jobject self, jobject source, jobject location) { @@ -445,7 +445,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectAt(JNIEnv *env, * @param container the object we want to put our new object into * @param slot the container slot we want to put the object in * - * @return the new object, or nullptr on error + * @return the new object, or null on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInContainer(JNIEnv *env, jobject self, jlong source, jlong container, jstring slot) { @@ -457,7 +457,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInContainer(JNI // determine what source is and create the object std::string templateName; - const ServerObject* object = nullptr; + const ServerObject* object = NULL; if (!JavaLibrary::getObject(source, object)) return 0; templateName = object->getTemplateName(); @@ -536,7 +536,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInContainerOver // determine what source is and create the object std::string templateName; - const ServerObject* object = nullptr; + const ServerObject* object = NULL; if (!JavaLibrary::getObject(source, object)) return 0; templateName = object->getTemplateName(); @@ -598,7 +598,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInContainerOver * @param sourceName the template name used to create the object * @param target the creature to create the object in * - * @return the obj_id of the created object, or nullptr on error + * @return the obj_id of the created object, or null on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInInventoryOverloaded(JNIEnv *env, jobject self, jstring sourceName, jlong target) { @@ -624,7 +624,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInInventoryOver * @param sourceCrc the template crc to create the object with * @param location where to put the object * - * @return the new object, or nullptr on error + * @return the new object, or null on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectCrc(JNIEnv *env, jobject self, int sourceCrc, jobject location) { @@ -656,7 +656,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectCrc(JNIEnv *env Transform tr; tr.setPosition_p(newPos); ServerObject *newObject = ServerWorld::createNewObject(sourceCrc, tr, cell, false); - if (newObject != nullptr) + if (newObject != NULL) { // get the networkId to return NetworkId netId = newObject->getNetworkId(); @@ -693,7 +693,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectCrc(JNIEnv *env * @param container the object we want to put our new object into * @param slot the container slot we want to put the object in * - * @return the new object, or nullptr on error + * @return the new object, or null on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInContainerCrc(JNIEnv *env, jobject self, int sourceCrc, jlong container, jstring slot) { @@ -707,10 +707,10 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInContainerCrc( return 0; // make sure the container exists - ServerObject * containerOwner = nullptr; + ServerObject * containerOwner = NULL; if (!JavaLibrary::getObject(container, containerOwner)) return 0; - if (ContainerInterface::getContainer(*containerOwner) == nullptr) + if (ContainerInterface::getContainer(*containerOwner) == NULL) return 0; //Create the object @@ -773,10 +773,10 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInContainerOver return 0; // make sure the container exists - ServerObject * containerOwner = nullptr; + ServerObject * containerOwner = NULL; if (!JavaLibrary::getObject(container, containerOwner)) return 0; - if (ContainerInterface::getVolumeContainer(*containerOwner) == nullptr) + if (ContainerInterface::getVolumeContainer(*containerOwner) == NULL) { DEBUG_WARNING(true, ("createObjectin an overloaded container only works on volume containers")); return 0; @@ -811,7 +811,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInContainerOver * @param sourceCrc the template crc used to create the object * @param target the creature to create the object in * - * @return the obj_id of the created object, or nullptr on error + * @return the obj_id of the created object, or null on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInInventoryOverloadedCrc( JNIEnv *env, jobject self, int sourceCrc, jlong target) @@ -819,16 +819,16 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInInventoryOver if (sourceCrc == 0 || target == 0) return 0; - CreatureObject * targetObject = nullptr; + CreatureObject * targetObject = NULL; if (!JavaLibrary::getObject(target, targetObject)) return 0; ServerObject * inventory = targetObject->getInventory(); - if (inventory == nullptr) + if (inventory == NULL) return 0; VolumeContainer * volContainer = ContainerInterface::getVolumeContainer(*inventory); - if (volContainer == nullptr) + if (volContainer == NULL) return 0; int oldCapacity = volContainer->debugDoNotUseSetCapacity(-1); @@ -838,7 +838,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInInventoryOver volContainer->debugDoNotUseSetCapacity(oldCapacity); volContainer->recalculateVolume(); - if (newObject == nullptr) + if (newObject == NULL) return 0; return (newObject->getNetworkId()).getValue(); @@ -852,7 +852,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInInventoryOver * @param self class calling this function * @param sourceCrc the template crc of the new object to create * @param target an object whose location and container/cell will be used to create the object. - * @return the obj_id of the created object, or nullptr on error + * @return the obj_id of the created object, or null on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectAtCrc(JNIEnv *env, jobject self, int sourceCrc, jlong target) { @@ -863,7 +863,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectAtCrc(JNIEnv *e if (target == 0) return 0; - ServerObject *sourceObject = nullptr; + ServerObject *sourceObject = NULL; if (!JavaLibrary::getObject(target, sourceObject)) return 0; @@ -878,7 +878,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectAtCrc(JNIEnv *e Transform tr; tr.setPosition_p(sourceObject->getPosition_p()); ServerObject *newObject = ServerWorld::createNewObject(sourceCrc, tr, cell, false); - if (newObject == nullptr) + if (newObject == NULL) { fprintf(stderr, "WARNING: Could not create object from crc %d\n", sourceCrc); JavaLibrary::printJavaStack(); @@ -911,7 +911,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectAtCrc(JNIEnv *e * @param source the template id or the object id to create the object with * @param location where to put the object * - * @return the new object, or nullptr on error + * @return the new object, or null on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectSimulator(JNIEnv *env, jobject self, jstring source, jobject location) { @@ -963,7 +963,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectSimulator(JNIEn Transform tr; tr.setPosition_p(newPos); ServerObject *newObject = ServerWorld::createNewObject(sourceCrc, tr, cell, false); - if (newObject != nullptr) + if (newObject != NULL) { // add on the player object CreatureObject * creature = dynamic_cast(newObject); @@ -1007,7 +1007,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectSimulator(JNIEn */ jboolean JNICALL ScriptMethodsObjectCreateNamespace::destroyObjectSimulator(JNIEnv *env, jobject self, jlong target) { - CreatureObject *playerObject = nullptr; + CreatureObject *playerObject = NULL; // get the object if (!JavaLibrary::getObject(target, playerObject)) { @@ -1046,7 +1046,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::destroyObject(JNIEnv *env, if (targetId == NetworkId::cms_invalid) return JNI_FALSE; - ServerObject* object = nullptr; + ServerObject* object = NULL; bool retval = JavaLibrary::getObject(target, object); if (!retval || !object) // || object->isPersisted()) will be done in permanently destroy @@ -1060,7 +1060,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::destroyObject(JNIEnv *env, { // check if the object is in a FactoryObject crate Object * container = ContainerInterface::getContainedByObject(*object); - if (container != nullptr && dynamic_cast(container) != nullptr) + if (container != NULL && dynamic_cast(container) != NULL) { // destroy an object in the factory; if it is the last object, // the factory will destroy itself @@ -1093,7 +1093,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::destroyObjectHyperspace(JNI if (targetId == NetworkId::cms_invalid) return JNI_FALSE; - ServerObject * object = nullptr; + ServerObject * object = NULL; bool retval = JavaLibrary::getObject(target, object); if(retval && object) { @@ -1120,7 +1120,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::persistObject(JNIEnv *env, UNREF(self); NOT_NULL(env); - ServerObject* object = nullptr; + ServerObject* object = NULL; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; if (object->persist()) { @@ -1144,7 +1144,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::isObjectPersisted(JNIEnv *e UNREF(self); NOT_NULL(env); - ServerObject* object = nullptr; + ServerObject* object = NULL; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -1320,7 +1320,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectTransformCrcInt * @param name the name of the theater * @param locationType how to create the theater * - * @return the id of the master theater object, or nullptr on error (bad datatable name or position) + * @return the id of the master theater object, or null on error (bad datatable name or position) */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createTheaterDatatableOnly(JNIEnv *env, jobject self, jstring datatable, jlong caller, jstring name, jint locationType) { @@ -1347,7 +1347,7 @@ int i; // read the object data from the datatable DataTable * dt = DataTableManager::getTable(datatableName, true); - if (dt == nullptr) + if (dt == NULL) { WARNING(true, ("JavaLibrary::createTheaterDatatable could not open " "datatable %s", datatableName.c_str())); @@ -1429,7 +1429,7 @@ int i; * @param name the name of the theater * @param locationType how to create the theater * - * @return the id of the master theater object, or nullptr on error (bad datatable name or position) + * @return the id of the master theater object, or null on error (bad datatable name or position) */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createTheaterDatatable(JNIEnv *env, jobject self, jstring datatable, jobject basePosition, jstring script, jlong caller, jstring name, jint locationType) { @@ -1466,7 +1466,7 @@ int i; // read the object data from the datatable DataTable * dt = DataTableManager::getTable(datatableName, true); - if (dt == nullptr) + if (dt == NULL) { WARNING(true, ("JavaLibrary::createTheaterDatatable could not open " "datatable %s", datatableName.c_str())); @@ -1567,7 +1567,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::createRemoteTheaterDatatabl // read the object data from the datatable DataTable * dt = DataTableManager::getTable(datatableName, true); - if (dt == nullptr) + if (dt == NULL) { WARNING(true, ("JavaLibrary::createRemoteTheaterDatatable could not open " "datatable %s", datatableName.c_str())); @@ -1613,7 +1613,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::createRemoteTheaterDatatabl params.addParam(locationType, "locationType"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() == nullptr) + if (dictionary.get() == NULL) { WARNING(true, ("JavaLibrary::createRemoteTheaterDatatable could not " "create dictionary for theater datatable %s", datatableName.c_str())); @@ -1624,7 +1624,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::createRemoteTheaterDatatabl Transform tr; tr.setPosition_p(location); ServerObject * spawner = ServerWorld::createNewObject("object/tangible/spawning/remote_theater_spawner.iff", tr, 0, false); - if (spawner == nullptr) + if (spawner == NULL) { WARNING(true, ("JavaLibrary::createRemoteTheaterDatatable unable to " "create remote theater spawner for datatable %s", datatableName.c_str())); @@ -1704,7 +1704,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::createRemoteTheaterDatatabl // read the object data from the datatable DataTable * dt = DataTableManager::getTable(datatableName, true); - if (dt == nullptr) + if (dt == NULL) { WARNING(true, ("JavaLibrary::createRemoteTheaterDatatable could not open " "datatable %s", datatableName.c_str())); @@ -1734,7 +1734,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::createRemoteTheaterDatatabl params.addParam(locationType, "locationType"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() == nullptr) + if (dictionary.get() == NULL) { WARNING(true, ("JavaLibrary::createRemoteTheaterDatatable could not " "create dictionary for theater datatable %s", datatableName.c_str())); @@ -1747,7 +1747,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::createRemoteTheaterDatatabl Transform tr; tr.setPosition_p(theaterCenter); ServerObject * spawner = ServerWorld::createNewObject("object/tangible/spawning/remote_theater_spawner.iff", tr, 0, false); - if (spawner == nullptr) + if (spawner == NULL) { WARNING(true, ("JavaLibrary::createRemoteTheaterDatatable unable to " "create remote theater spawner for datatable %s", datatableName.c_str())); @@ -1778,7 +1778,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::createRemoteTheaterDatatabl * theater objects have been created * @param caller who's creating the theater * - * @return the id of the master theater object, or nullptr on error + * @return the id of the master theater object, or null on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createTheaterCrc(JNIEnv *env, jobject self, jintArray crcs, jobjectArray positions, jobject basePosition, jstring script, jlong caller) { @@ -1843,7 +1843,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createTheaterCrc(JNIEnv *env, * theater objects have been created * @param caller who's creating the theater * - * @return the id of the master theater object, or nullptr on error + * @return the id of the master theater object, or null on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createTheaterString(JNIEnv *env, jobject self, jobjectArray templates, jobjectArray positions, jobject basePosition, jstring script, jlong caller) { @@ -1922,13 +1922,13 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::assignTheaterToPlayer(JNIEn JavaStringParam jdatatable(datatable); - CreatureObject * playerCreature = nullptr; + CreatureObject * playerCreature = NULL; if (!JavaLibrary::getObject(playerId, playerCreature)) return JNI_FALSE; PlayerObject * const player = PlayerCreatureController::getPlayerObject( playerCreature); - if (player == nullptr) + if (player == NULL) return JNI_FALSE; if (player->hasTheater()) @@ -1962,7 +1962,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::assignTheaterToPlayer(JNIEn // read the object data from the datatable DataTable * dt = DataTableManager::getTable(datatableName, true); - if (dt == nullptr) + if (dt == NULL) { WARNING(true, ("JavaLibrary::assignTheaterToPlayer could not open " "datatable %s", datatableName.c_str())); @@ -2026,13 +2026,13 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::assignTheaterToPlayerLocati JavaStringParam jdatatable(datatable); JavaStringParam jscript(script); - CreatureObject * playerCreature = nullptr; + CreatureObject * playerCreature = NULL; if (!JavaLibrary::getObject(playerId, playerCreature)) return JNI_FALSE; PlayerObject * const player = PlayerCreatureController::getPlayerObject( playerCreature); - if (player == nullptr) + if (player == NULL) return JNI_FALSE; std::string datatableName; @@ -2094,13 +2094,13 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::unassignTheaterFromPlayer(J if (playerId == 0) return JNI_FALSE; - CreatureObject * playerCreature = nullptr; + CreatureObject * playerCreature = NULL; if (!JavaLibrary::getObject(playerId, playerCreature)) return JNI_FALSE; PlayerObject * const player = PlayerCreatureController::getPlayerObject( playerCreature); - if (player == nullptr) + if (player == NULL) return JNI_FALSE; player->clearTheater(); @@ -2123,13 +2123,13 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::hasTheaterAssigned(JNIEnv * if (playerId == 0) return JNI_FALSE; - const CreatureObject * playerCreature = nullptr; + const CreatureObject * playerCreature = NULL; if (!JavaLibrary::getObject(playerId, playerCreature)) return JNI_FALSE; const PlayerObject * player = PlayerCreatureController::getPlayerObject( playerCreature); - if (player == nullptr) + if (player == NULL) return JNI_FALSE; return player->hasTheater(); @@ -2142,7 +2142,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::hasTheaterAssigned(JNIEnv * * * @param theater the theater id * - * @return the theater's name, or nullptr if it doesn't have one + * @return the theater's name, or null if it doesn't have one */ jstring JNICALL ScriptMethodsObjectCreateNamespace::getTheaterName(JNIEnv *env, jobject self, jlong theater) { @@ -2167,7 +2167,7 @@ jstring JNICALL ScriptMethodsObjectCreateNamespace::getTheaterName(JNIEnv *env, * * @param name the theater name to look for * - * @return the theater's id, or nullptr if the theater doesn't exist + * @return the theater's id, or null if the theater doesn't exist */ jlong JNICALL ScriptMethodsObjectCreateNamespace::findTheater(JNIEnv *env, jobject self, jstring name) { @@ -2196,7 +2196,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::findTheater(JNIEnv *env, jobje * @param draftSchematic the draft schematic template to create the manufacturing schematic from * @param container the container to put the manufacturing schematic in * - * @return the id of the manufacturing schematic, or nullptr on error + * @return the id of the manufacturing schematic, or null on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createSchematicString(JNIEnv *env, jobject self, jstring draftSchematic, jlong container) { @@ -2222,25 +2222,25 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createSchematicString(JNIEnv * * @param draftSchematicCrc the draft schematic template crc value to create the manufacturing schematic from * @param container the container to put the manufacturing schematic in * - * @return the id of the manufacturing schematic, or nullptr on error + * @return the id of the manufacturing schematic, or null on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createSchematicCrc(JNIEnv *env, jobject self, jint draftSchematicCrc, jlong container) { if (draftSchematicCrc == 0 || container == 0) return 0; - ServerObject * containerObject = nullptr; + ServerObject * containerObject = NULL; if (!JavaLibrary::getObject(container, containerObject)) return 0; const DraftSchematicObject * const draftSchematic = DraftSchematicObject::getSchematic( draftSchematicCrc); - if (draftSchematic == nullptr) + if (draftSchematic == NULL) return 0; ManufactureSchematicObject * manfSchematic = ServerWorld::createNewManufacturingSchematic( *draftSchematic, *containerObject, false); - if (manfSchematic == nullptr) + if (manfSchematic == NULL) return 0; return (manfSchematic->getNetworkId()).getValue(); @@ -2260,7 +2260,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createSchematicCrc(JNIEnv *env jboolean JNICALL ScriptMethodsObjectCreateNamespace::updateNetworkTriggerVolume(JNIEnv *env, jobject self, jlong target, jfloat radius) { - ServerObject * object = nullptr; + ServerObject * object = NULL; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsObjectInfo.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsObjectInfo.cpp index b285e0be..c50ab576 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsObjectInfo.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsObjectInfo.cpp @@ -561,15 +561,15 @@ void ScriptMethodsObjectInfoNamespace::getGoodItemsFromContainer(const Container { const ServerObject * owner = safe_cast( ContainerInterface::getFirstParentInWorld(container.getOwner())); - const ServerObject * ownerInventory = nullptr; - const ServerObject * ownerDatapad = nullptr; - const ServerObject * ownerAppearanceInventory = nullptr; - const ServerObject * ownerHangar = nullptr; + const ServerObject * ownerInventory = NULL; + const ServerObject * ownerDatapad = NULL; + const ServerObject * ownerAppearanceInventory = NULL; + const ServerObject * ownerHangar = NULL; - if (owner != nullptr) + if (owner != NULL) { const CreatureObject * creature = owner->asCreatureObject(); - if (creature != nullptr) + if (creature != NULL) { ownerInventory = creature->getInventory(); ownerDatapad = creature->getDatapad(); @@ -583,7 +583,7 @@ void ScriptMethodsObjectInfoNamespace::getGoodItemsFromContainer(const Container const CachedNetworkId & itemId = *i; const ServerObject * item = safe_cast( itemId.getObject()); - if (item != nullptr && item->asTangibleObject() != nullptr && + if (item != NULL && item->asTangibleObject() != NULL && item->asTangibleObject()->isVisible()) { // @@ -591,14 +591,14 @@ void ScriptMethodsObjectInfoNamespace::getGoodItemsFromContainer(const Container // // no player inventory - if (ownerInventory != nullptr && ownerInventory->getNetworkId() == + if (ownerInventory != NULL && ownerInventory->getNetworkId() == item->getNetworkId()) { continue; } // no player datapad - if (ownerDatapad != nullptr && ownerDatapad->getNetworkId() == + if (ownerDatapad != NULL && ownerDatapad->getNetworkId() == item->getNetworkId()) { continue; @@ -613,14 +613,14 @@ void ScriptMethodsObjectInfoNamespace::getGoodItemsFromContainer(const Container continue; // no creatures (pets/droids) - if (item->asCreatureObject() != nullptr) + if (item->asCreatureObject() != NULL) continue; // no hair const ServerObjectTemplate * itemTemplate = safe_cast< const ServerObjectTemplate *>(item->getObjectTemplate()); NOT_NULL(itemTemplate); - if (strstr(itemTemplate->getName(), "tangible/hair") != nullptr) + if (strstr(itemTemplate->getName(), "tangible/hair") != NULL) continue; // no Trandoshan feet @@ -631,7 +631,7 @@ void ScriptMethodsObjectInfoNamespace::getGoodItemsFromContainer(const Container // see if the item is a container and go through its contents const Container * itemContainer = ContainerInterface::getContainer(*item); - if (itemContainer != nullptr) + if (itemContainer != NULL) getGoodItemsFromContainer(*itemContainer, goodItems); } } @@ -644,7 +644,7 @@ void ScriptMethodsObjectInfoNamespace::getGoodItemsFromContainer(const Container * @param self class calling this function * @param jtemplateCrcs the template crcs * - * @return the names, or nullptr on error + * @return the names, or null on error */ jobjectArray ScriptMethodsObjectInfoNamespace::getNamesFromCrcs(JNIEnv *env, const std::vector & templateCrcs) @@ -661,7 +661,7 @@ jobjectArray ScriptMethodsObjectInfoNamespace::getNamesFromCrcs(JNIEnv *env, // get the server template const ObjectTemplate * ot = ObjectTemplateList::fetch(templateCrcs[i]); - if (ot == nullptr) + if (ot == NULL) { WARNING(true, ("JavaLibrary::getNamesFromTemplateCrcs: Could not " "find object template for crc %d", templateCrcs[i])); @@ -670,13 +670,13 @@ jobjectArray ScriptMethodsObjectInfoNamespace::getNamesFromCrcs(JNIEnv *env, // get the shared template const ServerObjectTemplate * serverOt = ot->asServerObjectTemplate(); - if (serverOt != nullptr) + if (serverOt != NULL) { const std::string sharedTemplateName(serverOt->getSharedTemplate()); serverOt->releaseReference(); - serverOt = nullptr; + serverOt = NULL; ot = ObjectTemplateList::fetch(sharedTemplateName); - if (ot == nullptr) + if (ot == NULL) { WARNING(true, ("JavaLibrary::getNamesFromTemplateCrcs: Could not " "find shared object template %s", sharedTemplateName.c_str())); @@ -685,18 +685,18 @@ jobjectArray ScriptMethodsObjectInfoNamespace::getNamesFromCrcs(JNIEnv *env, } const SharedObjectTemplate * sharedOt = ot->asSharedObjectTemplate(); - if (sharedOt == nullptr) + if (sharedOt == NULL) { WARNING(true, ("JavaLibrary::getNamesFromTemplateCrcs: template %s " "is not a shared template", ot->getName())); ot->releaseReference(); continue; } - ot = nullptr; + ot = NULL; const StringId objectName(sharedOt->getObjectName()); sharedOt->releaseReference(); - sharedOt = nullptr; + sharedOt = NULL; LocalRefPtr jobjectName; if (ScriptConversion::convert(objectName, jobjectName)) @@ -734,7 +734,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setNameFromString(JNIEnv *env JavaStringParam localName(name); - ServerObject* object = nullptr; + ServerObject* object = NULL; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -813,7 +813,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::setDescriptionStringId(JNIEnv * e * @param self class calling this function * @param target id of object whose name to get * -* @return the description, or nullptr on error +* @return the description, or null on error */ jobject JNICALL ScriptMethodsObjectInfoNamespace::getDescriptionStringId(JNIEnv * env, jobject self, jlong target) { @@ -837,13 +837,13 @@ jobject JNICALL ScriptMethodsObjectInfoNamespace::getDescriptionStringId(JNIEnv * @param self class calling this function * @param target id of object whose name to get * - * @return the name, or nullptr on error + * @return the name, or null on error */ jstring JNICALL ScriptMethodsObjectInfoNamespace::getName(JNIEnv *env, jobject self, jlong target) { UNREF(self); - ServerObject* object = nullptr; + ServerObject* object = NULL; if (!JavaLibrary::getObject(target, object)) return 0; @@ -859,7 +859,7 @@ jstring JNICALL ScriptMethodsObjectInfoNamespace::getName(JNIEnv *env, jobject s * @param self class calling this function * @param player id of the player to get * - * @return the name, or nullptr on error + * @return the name, or null on error */ jstring JNICALL ScriptMethodsObjectInfoNamespace::getPlayerName(JNIEnv *env, jobject self, jlong target) { @@ -894,13 +894,13 @@ jstring JNICALL ScriptMethodsObjectInfoNamespace::getPlayerFullName(JNIEnv *env, * @param self class calling this function * @param target id of object whose name to get * - * @return the name, or nullptr on error + * @return the name, or null on error */ jstring JNICALL ScriptMethodsObjectInfoNamespace::getAssignedName(JNIEnv *env, jobject self, jlong target) { UNREF(self); - ServerObject* object = nullptr; + ServerObject* object = NULL; if (!JavaLibrary::getObject(target, object)) return 0; @@ -915,7 +915,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::setCreatureName(JNIEnv * /*env*/, NetworkId const networkId(creature); CreatureObject * const creatureObject = CreatureObject::getCreatureObject(networkId); - if (creatureObject == nullptr) + if (creatureObject == NULL) { WARNING(true, ("ERROR: ScriptMethodsObjectInfo::setCreatureName() Unable to resolve the object(%s) to a CreatureObject.", networkId.getValueString().c_str())); return; @@ -923,7 +923,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::setCreatureName(JNIEnv * /*env*/, AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(creatureObject->getController()); - if (aiCreatureController == nullptr) + if (aiCreatureController == NULL) { WARNING(true, ("ERROR: ScriptMethodsObjectInfo::setCreatureName() Unable to resolve the object's(%s) controller to an AiCreatureController.", creatureObject->getDebugInformation().c_str())); return; @@ -941,14 +941,14 @@ jstring JNICALL ScriptMethodsObjectInfoNamespace::getCreatureName(JNIEnv * /*env NetworkId const networkId(creature); CreatureObject * const creatureObject = CreatureObject::getCreatureObject(networkId); - if (creatureObject == nullptr) + if (creatureObject == NULL) { return 0; } AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(creatureObject->getController()); - if (aiCreatureController == nullptr) + if (aiCreatureController == NULL) { return 0; } @@ -972,13 +972,13 @@ jstring JNICALL ScriptMethodsObjectInfoNamespace::getCreatureName(JNIEnv * /*env * @param self class calling this function * @param target id of object whose name to get * - * @return the name, or nullptr on error + * @return the name, or null on error */ jobject JNICALL ScriptMethodsObjectInfoNamespace::getNameStringId(JNIEnv *env, jobject self, jlong target) { UNREF(self); - ServerObject* object = nullptr; + ServerObject* object = NULL; if (!JavaLibrary::getObject(target, object)) return 0; @@ -997,7 +997,7 @@ jobject JNICALL ScriptMethodsObjectInfoNamespace::getNameStringId(JNIEnv *env, j * @param self class calling this function * @param jtemplateName the template name * - * @return the name, or nullptr if the template doesn't exist + * @return the name, or null if the template doesn't exist */ jobject JNICALL ScriptMethodsObjectInfoNamespace::getNameFromTemplate(JNIEnv *env, jobject self, jstring jtemplateName) @@ -1020,41 +1020,41 @@ jobject JNICALL ScriptMethodsObjectInfoNamespace::getNameFromTemplate(JNIEnv *en * @param self class calling this function * @param templateCrc the template crc * - * @return the name, or nullptr if the template doesn't exist + * @return the name, or null if the template doesn't exist */ jobject JNICALL ScriptMethodsObjectInfoNamespace::getNameFromTemplateCrc(JNIEnv *env, jobject self, jint templateCrc) { const ObjectTemplate * ot = ObjectTemplateList::fetch(templateCrc); - if (ot == nullptr) + if (ot == NULL) return 0; // the name is stored in the shared template, so if this is a server template, // get the shared one from it - const SharedObjectTemplate * sharedOt = nullptr; + const SharedObjectTemplate * sharedOt = NULL; const ServerObjectTemplate * serverOt = dynamic_cast( ot); - if (serverOt != nullptr) + if (serverOt != NULL) { const std::string sharedTemplateName(serverOt->getSharedTemplate()); serverOt->releaseReference(); - serverOt = nullptr; + serverOt = NULL; ot = ObjectTemplateList::fetch(sharedTemplateName); - if (ot == nullptr) + if (ot == NULL) return 0; } sharedOt = dynamic_cast(ot); - if (sharedOt == nullptr) + if (sharedOt == NULL) { ot->releaseReference(); return 0; } - ot = nullptr; + ot = NULL; const StringId objectName(sharedOt->getObjectName()); sharedOt->releaseReference(); - sharedOt = nullptr; + sharedOt = NULL; LocalRefPtr jobjectName; if (!ScriptConversion::convert(objectName, jobjectName)) @@ -1069,7 +1069,7 @@ jobject JNICALL ScriptMethodsObjectInfoNamespace::getNameFromTemplateCrc(JNIEnv * @param self class calling this function * @param jtemplateNames the template names * - * @return the names, or nullptr on error + * @return the names, or null on error */ jobjectArray JNICALL ScriptMethodsObjectInfoNamespace::getNamesFromTemplates(JNIEnv *env, jobject self, jobjectArray jtemplateNames) @@ -1102,7 +1102,7 @@ jobjectArray JNICALL ScriptMethodsObjectInfoNamespace::getNamesFromTemplates(JNI * @param self class calling this function * @param jtemplateCrcs the template crcs * - * @return the names, or nullptr on error + * @return the names, or null on error */ jobjectArray JNICALL ScriptMethodsObjectInfoNamespace::getNamesFromTemplateCrcs(JNIEnv *env, jobject self, jintArray jtemplateCrcs) @@ -1140,7 +1140,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::internalIsAuthoritative(JNIEn { UNREF(self); - const ServerObject * object = nullptr; + const ServerObject * object = NULL; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -1173,7 +1173,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::hasProxyOrAuthObject(JNIEnv * UNREF(self); - const ServerObject * object = nullptr; + const ServerObject * object = NULL; // if I'm not authoritative, then I must have an authoritative object on another game server // if I'm authoritative, then see if I'm proxied on any other game server @@ -1447,12 +1447,12 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isAwayFromKeyBoard(JNIEnv *en { UNREF(self); - CreatureObject * playerCreature = nullptr; + CreatureObject * playerCreature = NULL; if (!JavaLibrary::getObject(player, playerCreature)) return JNI_FALSE; PlayerObject * const playerObj = PlayerCreatureController::getPlayerObject(playerCreature); - if (playerObj != nullptr && playerObj->isAwayFromKeyBoard()) + if (playerObj != NULL && playerObj->isAwayFromKeyBoard()) { return JNI_TRUE; } @@ -1473,7 +1473,7 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getObjType(JNIEnv *env, jobject s { UNREF(self); - const Object *object = nullptr; + const Object *object = NULL; if (!JavaLibrary::getObject(target, object)) return -1; @@ -1487,13 +1487,13 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getObjType(JNIEnv *env, jobject s * @param self class calling this function * @param target object we want to check * - * @return the template type, or nullptr on error + * @return the template type, or null on error */ jstring JNICALL ScriptMethodsObjectInfoNamespace::getTemplateId(JNIEnv *env, jobject self, jlong target) { UNREF(self); - const Object *object = nullptr; + const Object *object = NULL; if (!JavaLibrary::getObject(target, object)) return 0; @@ -1507,12 +1507,12 @@ jstring JNICALL ScriptMethodsObjectInfoNamespace::getTemplateId(JNIEnv *env, job * @param self class calling this function * @param target object we want to check * - * @return the template type, or nullptr on error + * @return the template type, or null on error */ jstring JNICALL ScriptMethodsObjectInfoNamespace::getSharedObjectTemplateName(JNIEnv * /*env*/, jobject /*self*/, jlong target) { - Object const * object = nullptr; + Object const * object = NULL; if (!JavaLibrary::getObject(target, object)) return 0; @@ -2039,7 +2039,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isDisabled(JNIEnv *env, jobje return JNI_FALSE; // make sure the object isn't a creature or is a vehicle - if (object->asCreatureObject () != nullptr && + if (object->asCreatureObject () != NULL && !GameObjectTypes::isTypeOf (object->getGameObjectType (), SharedObjectTemplate::GOT_vehicle)) return JNI_FALSE; @@ -2093,7 +2093,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isCrafted(JNIEnv *env, jobjec return JNI_FALSE; // make sure the object isn't a creature - if (dynamic_cast(object) != nullptr) + if (dynamic_cast(object) != NULL) return JNI_FALSE; if (object->isCrafted()) @@ -2110,7 +2110,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isCrafted(JNIEnv *env, jobjec * @param self class calling this function * @param target object we want to know about * - * @return the crafter id, or nullptr on error or if the item was not crafted + * @return the crafter id, or null on error or if the item was not crafted */ jlong JNICALL ScriptMethodsObjectInfoNamespace::getCrafter(JNIEnv *env, jobject self, jlong target) { @@ -2168,7 +2168,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setCrafter(JNIEnv *env, jobje */ jfloat JNICALL ScriptMethodsObjectInfoNamespace::getScale(JNIEnv *env, jobject self, jlong target) { - const CreatureObject * creature = nullptr; + const CreatureObject * creature = NULL; if (!JavaLibrary::getObject(target, creature)) return -1.0f; @@ -2190,7 +2190,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setScale(JNIEnv *env, jobject if (scale <= 0) return JNI_FALSE; - CreatureObject * creature = nullptr; + CreatureObject * creature = NULL; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -2375,11 +2375,11 @@ jfloat JNICALL ScriptMethodsObjectInfoNamespace::getLocationDistance(JNIEnv *env // translate local coordinates to world coordinates Object * cell1 = NetworkIdManager::getObjectById(targetCell1); - if (cell1 == nullptr) + if (cell1 == NULL) return -1; const Vector & worldLoc1 = cell1->rotateTranslate_o2w(targetLoc1); Object * cell2 = NetworkIdManager::getObjectById(targetCell2); - if (cell2 == nullptr) + if (cell2 == NULL) return -1; const Vector & worldLoc2 = cell2->rotateTranslate_o2w(targetLoc2); @@ -2433,13 +2433,13 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isLocationInConicalFrustum(JN // translate local coordinates to world coordinates if they are in cells Object * testCell = NetworkIdManager::getObjectById(testCellId); - Vector testWorldLoc = (testCell != nullptr) ? testCell->rotateTranslate_o2w(testLoc) : testLoc; + Vector testWorldLoc = (testCell != NULL) ? testCell->rotateTranslate_o2w(testLoc) : testLoc; Object * startCell = NetworkIdManager::getObjectById(startCellId); - Vector startWorldLoc = (startCell != nullptr) ? startCell->rotateTranslate_o2w(startLoc) : startLoc; + Vector startWorldLoc = (startCell != NULL) ? startCell->rotateTranslate_o2w(startLoc) : startLoc; Object * endCell = NetworkIdManager::getObjectById(endCellId); - Vector endWorldLoc = (endCell != nullptr) ? endCell->rotateTranslate_o2w(endLoc) : endLoc; + Vector endWorldLoc = (endCell != NULL) ? endCell->rotateTranslate_o2w(endLoc) : endLoc; if(use2d) { @@ -2504,13 +2504,13 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isLocationInCone(JNIEnv *env, // translate local coordinates to world coordinates if they are in cells Object * testCell = NetworkIdManager::getObjectById(testCellId); - Vector const& testWorldLoc = (testCell != nullptr) ? testCell->rotateTranslate_o2w(testLoc) : testLoc; + Vector const& testWorldLoc = (testCell != NULL) ? testCell->rotateTranslate_o2w(testLoc) : testLoc; Object * startCell = NetworkIdManager::getObjectById(startCellId); - Vector const & startWorldLoc = (startCell != nullptr) ? startCell->rotateTranslate_o2w(startLoc) : startLoc; + Vector const & startWorldLoc = (startCell != NULL) ? startCell->rotateTranslate_o2w(startLoc) : startLoc; Object * endCell = NetworkIdManager::getObjectById(endCellId); - Vector const & endWorldLoc = (endCell != nullptr) ? endCell->rotateTranslate_o2w(endLoc) : endLoc; + Vector const & endWorldLoc = (endCell != NULL) ? endCell->rotateTranslate_o2w(endLoc) : endLoc; Vector testPointConeSpace = testWorldLoc - startWorldLoc; if(use2d) @@ -2606,7 +2606,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isInWorldCell(JNIEnv *env, jo UNREF(self); NOT_NULL(env); - ServerObject* object = nullptr; + ServerObject* object = NULL; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -2704,7 +2704,7 @@ namespace //-- validate arguments if (!customizationVariable || !context) { - DEBUG_FATAL(true, ("programmer error: callback made with nullptr arguments.\n")); + DEBUG_FATAL(true, ("programmer error: callback made with NULL arguments.\n")); return; } @@ -2736,7 +2736,7 @@ namespace * Java custom_var. * * @return the Java-accessible custom_var instance, the script-side counterpart to - * the given C++-side CustomizationVariable. Will return nullptr if + * the given C++-side CustomizationVariable. Will return NULL if * a Java exception or other error occurs. */ LocalRefPtr ScriptMethodsObjectInfoNamespace::createCustomVar(const jlong &objId, const std::string &variablePathName, CustomizationVariable &variable) @@ -2779,7 +2779,7 @@ LocalRefPtr ScriptMethodsObjectInfoNamespace::createCustomVar(const jlong &objId * Java custom_var. * * @return the Java-accessible ranged_int_custom_var instance, the script-side counterpart to - * the given C++-side CustomizationVariable. Will return nullptr if + * the given C++-side CustomizationVariable. Will return NULL if * a Java exception or other error occurs. */ LocalRefPtr ScriptMethodsObjectInfoNamespace::createRangedIntCustomVar(const jlong &objId, const std::string &variablePathName, RangedIntCustomizationVariable &rangedIntVariable) @@ -2818,7 +2818,7 @@ LocalRefPtr ScriptMethodsObjectInfoNamespace::createRangedIntCustomVar(const jlo * Java custom_var. * * @return the Java-accessible palcolor_custom_var instance, the script-side counterpart to - * the given C++-side CustomizationVariable. Will return nullptr if + * the given C++-side CustomizationVariable. Will return NULL if * a Java exception or other error occurs. */ LocalRefPtr ScriptMethodsObjectInfoNamespace::createPalcolorCustomVar(const jlong &objId, const std::string &variablePathName, PaletteColorCustomizationVariable &variable) @@ -2854,10 +2854,10 @@ LocalRefPtr ScriptMethodsObjectInfoNamespace::createColor(int r, int g, int b, i * Fetch the CustomizationData instance associated with the Object * specified by the given obj_id. * - * This function may return nullptr if the specified object doesn't have + * This function may return NULL if the specified object doesn't have * customization data or if some other error occurs. * - * The caller must call CustomizationData::release() on the non-nullptr return + * The caller must call CustomizationData::release() on the non-NULL return * value when the reference no longer is needed. Failure to do so will cause * a memory leak. * @@ -2865,21 +2865,21 @@ LocalRefPtr ScriptMethodsObjectInfoNamespace::createColor(int r, int g, int b, i * CustomizationData instance should be retrieved. * * @return the CustomizationData instance associated with the specified - * Object. May return nullptr if the Object doesn't have customization + * Object. May return NULL if the Object doesn't have customization * data or if an error occurs. */ CustomizationData *ScriptMethodsObjectInfoNamespace::fetchCustomizationDataFromObjId(jlong objId) { PROFILER_AUTO_BLOCK_DEFINE("JNI::fetchCustomizationDataFromObjId"); if (!objId) - return nullptr; + return NULL; //-- Get the target TangibleObject. TangibleObject *object = 0; if (!JavaLibrary::getObject(objId, object)) { // this Object doesn't exist or isn't derived from TangibleObject - return nullptr; + return NULL; } //-- Fetch the CustomizationData. @@ -2887,15 +2887,15 @@ CustomizationData *ScriptMethodsObjectInfoNamespace::fetchCustomizationDataFromO if (!cdProperty) { // this Object doesn't expose any customization data - return nullptr; + return NULL; } CustomizationData *const customizationData = cdProperty->fetchCustomizationData(); if (!customizationData) { // this shouldn't happen - DEBUG_WARNING(true, ("CustomizationDataProperty returned nullptr CustomizationData on fetch().\n")); - return nullptr; + DEBUG_WARNING(true, ("CustomizationDataProperty returned NULL CustomizationData on fetch().\n")); + return NULL; } //-- return the CustomizationData instance. @@ -2910,7 +2910,7 @@ jobjectArray JNICALL ScriptMethodsObjectInfoNamespace::getAllCustomVars(JNIEnv * //-- get the CustomizationData instance for the target object. CustomizationData *const customizationData = fetchCustomizationDataFromObjId(target); if (!customizationData) - return nullptr; + return NULL; //-- collect all local CustomizationVariable instances. // NOTE: if we allow multithreaded access to this code from script, we cannot use this static @@ -2961,7 +2961,7 @@ jobjectArray JNICALL ScriptMethodsObjectInfoNamespace::getAllCustomVars(JNIEnv * customizationData->release(); //-- return result - if (customVarArray.get() != nullptr) + if (customVarArray.get() != NULL) return customVarArray->getReturnValue(); return 0; } @@ -2975,7 +2975,7 @@ jobject JNICALL ScriptMethodsObjectInfoNamespace::getCustomVarByName(JNIEnv * /* //-- get the CustomizationData instance for the target object. CustomizationData *const customizationData = fetchCustomizationDataFromObjId(target); if (!customizationData) - return nullptr; + return NULL; //-- get the CustomizationVariable for the specified variable name std::string nativeVarPathName; @@ -2983,7 +2983,7 @@ jobject JNICALL ScriptMethodsObjectInfoNamespace::getCustomVarByName(JNIEnv * /* CustomizationVariable *const variable = customizationData->findVariable(nativeVarPathName); if (!variable) - return nullptr; + return NULL; //-- create a Java custom_var based on this CustomizationVariable LocalRefPtr newCustomVar = createCustomVar(target, nativeVarPathName, *variable); @@ -3089,7 +3089,7 @@ jobject JNICALL ScriptMethodsObjectInfoNamespace::getPalcolorCustomVarSelectedCo customizationData->release(); if (error) - return nullptr; + return NULL; //-- return value return createColor(color.getR(), color.getG(), color.getB(), color.getA())->getReturnValue(); @@ -3196,7 +3196,7 @@ jobjectArray JNICALL ScriptMethodsObjectInfoNamespace::getPalcolorCustomVarColor customizationData->release(); //-- return result - if (colorArray.get() != nullptr) + if (colorArray.get() != NULL) return colorArray->getReturnValue(); return 0; } @@ -3205,7 +3205,7 @@ jobjectArray JNICALL ScriptMethodsObjectInfoNamespace::getPalcolorCustomVarColor jobjectArray JNICALL ScriptMethodsObjectInfoNamespace::getCtsDestinationClusters(JNIEnv * /*env*/, jobject /*self*/) { - static std::set * s_ctsDestinationClusters = nullptr; + static std::set * s_ctsDestinationClusters = NULL; if (!s_ctsDestinationClusters) { s_ctsDestinationClusters = new std::set; @@ -3449,15 +3449,15 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::kill(JNIEnv *env, jobject sel * @param env Java environment * @param self class calling this function * @param player the player - * @param killer who killed the player (may be nullptr) + * @param killer who killed the player (may be null) * - * @return the corpse id of the player, or nullptr on error + * @return the corpse id of the player, or null on error */ jobject JNICALL ScriptMethodsObjectInfoNamespace::killPlayer(JNIEnv *env, jobject self, jobject player, jobject killer) { static const std::string corpseTemplateName("object/tangible/container/corpse/player_corpse.iff"); - CreatureObject * playerObject = nullptr; + CreatureObject * playerObject = NULL; if (!JavaLibrary::getObject(player, playerObject)) return 0; @@ -3474,7 +3474,7 @@ jobject JNICALL ScriptMethodsObjectInfoNamespace::killPlayer(JNIEnv *env, jobjec Transform tr; tr.setPosition_p(playerObject->getPosition_p()); ServerObject * corpse = ServerWorld::createNewObject(corpseTemplateName, tr, cell, true); - if (corpse == nullptr) + if (corpse == NULL) return 0; if (playerObject->makeDead(killerId, corpse->getNetworkId())) @@ -3557,7 +3557,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setInvulnerable(JNIEnv *env, { UNREF(self); - TangibleObject * object = nullptr; + TangibleObject * object = NULL; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -3580,7 +3580,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isInvulnerable(JNIEnv *env, j { UNREF(self); - TangibleObject * object = nullptr; + TangibleObject * object = NULL; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -3602,7 +3602,7 @@ jfloat JNICALL ScriptMethodsObjectInfoNamespace::getComplexity(JNIEnv *env, jobj { UNREF(self); - const ServerObject * object = nullptr; + const ServerObject * object = NULL; if (!JavaLibrary::getObject(target, object)) return -1; @@ -3625,7 +3625,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setComplexity(JNIEnv *env, jo { UNREF(self); - ServerObject * object = nullptr; + ServerObject * object = NULL; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -3639,7 +3639,7 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getGameObjectType(JNIEnv *env, jo { UNREF (self); - ServerObject * object = nullptr; + ServerObject * object = NULL; if (!JavaLibrary::getObject(obj, object)) return JNI_FALSE; @@ -3662,13 +3662,13 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getGameObjectTypeFromTemplate(JNI jint JNICALL ScriptMethodsObjectInfoNamespace::getGameObjectTypeFromTemplateCrc(JNIEnv *env, jobject self, jint templateCrc) { const ObjectTemplate * objectTemplate = ObjectTemplateList::fetch(templateCrc); - if (objectTemplate == nullptr) + if (objectTemplate == NULL) return 0; const std::string & sharedTemplateName = safe_cast(objectTemplate)->getSharedTemplate(); const ObjectTemplate * sharedTemplate = ObjectTemplateList::fetch(sharedTemplateName); objectTemplate->releaseReference(); - if (sharedTemplate == nullptr) + if (sharedTemplate == NULL) return 0; jint got = safe_cast(sharedTemplate)->getGameObjectType(); @@ -3710,11 +3710,11 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isGod(JNIEnv *env, jobject se { UNREF (self); - const ServerObject * object = nullptr; + const ServerObject * object = NULL; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; - if (object->getClient() == nullptr) + if (object->getClient() == NULL) return JNI_FALSE; return object->getClient()->isGod(); @@ -3735,11 +3735,11 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getGodLevel(JNIEnv *env, jobject { UNREF (self); - const ServerObject * object = nullptr; + const ServerObject * object = NULL; if (!JavaLibrary::getObject(target, object)) return 0; - if (object->getClient() == nullptr) + if (object->getClient() == NULL) return 0; if (object->getClient()->isGod()) @@ -3763,13 +3763,13 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getCount(JNIEnv *env, jobject sel // both Tangible and Intangible have counters, so we have to test for both // cases - const TangibleObject * tangibleObject = nullptr; + const TangibleObject * tangibleObject = NULL; if (JavaLibrary::getObject(target, tangibleObject)) { return tangibleObject->getCount(); } - const IntangibleObject * intangibleObject = nullptr; + const IntangibleObject * intangibleObject = NULL; if (JavaLibrary::getObject(target, intangibleObject)) { return intangibleObject->getCount(); @@ -3795,14 +3795,14 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setCount(JNIEnv *env, jobject // both Tangible and Intangible have counters, so we have to test for both // cases - TangibleObject * tangibleObject = nullptr; + TangibleObject * tangibleObject = NULL; if (JavaLibrary::getObject(target, tangibleObject)) { tangibleObject->setCount(value); return JNI_TRUE; } - IntangibleObject * intangibleObject = nullptr; + IntangibleObject * intangibleObject = NULL; if (JavaLibrary::getObject(target, intangibleObject)) { intangibleObject->setCount(value); @@ -3829,14 +3829,14 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::incrementCount(JNIEnv *env, j // both Tangible and Intangible have counters, so we have to test for both // cases - TangibleObject * tangibleObject = nullptr; + TangibleObject * tangibleObject = NULL; if (JavaLibrary::getObject(target, tangibleObject)) { tangibleObject->incrementCount(delta); return JNI_TRUE; } - IntangibleObject * intangibleObject = nullptr; + IntangibleObject * intangibleObject = NULL; if (JavaLibrary::getObject(target, intangibleObject)) { intangibleObject->incrementCount(delta); @@ -3859,7 +3859,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::incrementCount(JNIEnv *env, j */ jint JNICALL ScriptMethodsObjectInfoNamespace::getCondition(JNIEnv *env, jobject self, jlong target) { - const TangibleObject * object = nullptr; + const TangibleObject * object = NULL; if (!JavaLibrary::getObject(target, object)) return 0; @@ -3880,7 +3880,7 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getCondition(JNIEnv *env, jobject */ jboolean JNICALL ScriptMethodsObjectInfoNamespace::hasCondition(JNIEnv *env, jobject self, jlong target, jint condition) { - const TangibleObject * object = nullptr; + const TangibleObject * object = NULL; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -3901,7 +3901,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::hasCondition(JNIEnv *env, job */ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setCondition(JNIEnv *env, jobject self, jlong target, jint condition) { - TangibleObject * object = nullptr; + TangibleObject * object = NULL; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -3923,7 +3923,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setCondition(JNIEnv *env, job */ jboolean JNICALL ScriptMethodsObjectInfoNamespace::clearCondition(JNIEnv *env, jobject self, jlong target, jint condition) { - TangibleObject * object = nullptr; + TangibleObject * object = NULL; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -4748,7 +4748,7 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getGroupLevel(JNIEnv *, jobject, { if (!target) { - DEBUG_WARNING (true, ("JavaLibrary::getGroupLevel nullptr target ")); + DEBUG_WARNING (true, ("JavaLibrary::getGroupLevel null target ")); return 0; } @@ -4864,18 +4864,18 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::getVisibleOnMapAndRadar(JNIEn * @param self class calling this function * @param target the object * - * @return the appearance name, or nullptr on error + * @return the appearance name, or null on error */ jstring JNICALL ScriptMethodsObjectInfoNamespace::getAppearance(JNIEnv * env, jobject self, jlong target) { UNREF(self); - const ServerObject * object = nullptr; + const ServerObject * object = NULL; if (!JavaLibrary::getObject(target, object)) return 0; const SharedObjectTemplate * sharedTemplate = object->getSharedTemplate(); - if (sharedTemplate == nullptr) + if (sharedTemplate == NULL) return 0; JavaString appearance(sharedTemplate->getAppearanceFilename()); @@ -4897,7 +4897,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isInsured(JNIEnv * env, jobje { UNREF(self); - const TangibleObject * object = nullptr; + const TangibleObject * object = NULL; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -4919,7 +4919,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isAutoInsured(JNIEnv * env, j { UNREF(self); - const TangibleObject * object = nullptr; + const TangibleObject * object = NULL; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -4941,7 +4941,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isUninsurable(JNIEnv * env, j { UNREF(self); - const TangibleObject * object = nullptr; + const TangibleObject * object = NULL; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -4959,13 +4959,13 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isUninsurable(JNIEnv * env, j * @param self class calling this function * @param player the player to get objects from * - * @return an array of objects, or nullptr on error + * @return an array of objects, or null on error */ jlongArray JNICALL ScriptMethodsObjectInfoNamespace::getInventoryAndEquipment(JNIEnv * env, jobject self, jlong player) { UNREF(self); - const CreatureObject * playerCreature = nullptr; + const CreatureObject * playerCreature = NULL; if (!JavaLibrary::getObject(player, playerCreature)) return 0; @@ -4973,11 +4973,11 @@ jlongArray JNICALL ScriptMethodsObjectInfoNamespace::getInventoryAndEquipment(JN // go through the player's inventory const ServerObject * inventoryObject = playerCreature->getInventory(); - if (inventoryObject != nullptr) + if (inventoryObject != NULL) { const VolumeContainer * inventoryContainer = ContainerInterface::getVolumeContainer(*inventoryObject); - if (inventoryContainer != nullptr) + if (inventoryContainer != NULL) { getGoodItemsFromContainer(*inventoryContainer, objectIds); } @@ -4998,7 +4998,7 @@ jlongArray JNICALL ScriptMethodsObjectInfoNamespace::getInventoryAndEquipment(JN // go through the player's equipment SlottedContainer const * const equipmentContainer = ContainerInterface::getSlottedContainer(*playerCreature); - if (equipmentContainer != nullptr) + if (equipmentContainer != NULL) getGoodItemsFromContainer(*equipmentContainer, objectIds); else { @@ -5022,12 +5022,12 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setCheaterLevel(JNIEnv * env, { UNREF(self); - CreatureObject * playerCreature = nullptr; + CreatureObject * playerCreature = NULL; if (!JavaLibrary::getObject(player, playerCreature)) return JNI_FALSE; PlayerObject * const playerObj = PlayerCreatureController::getPlayerObject(playerCreature); - if (playerObj != nullptr && playerObj->isAuthoritative()) + if (playerObj != NULL && playerObj->isAuthoritative()) { playerObj->setCheaterLevel(static_cast(level)); return JNI_TRUE; @@ -5042,12 +5042,12 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getCheaterLevel(JNIEnv * env, job { UNREF(self); - const CreatureObject * playerCreature = nullptr; + const CreatureObject * playerCreature = NULL; if (!JavaLibrary::getObject(player, playerCreature)) return 0; PlayerObject const * const playerObj = PlayerCreatureController::getPlayerObject(playerCreature); - if (playerObj != nullptr) + if (playerObj != NULL) { return static_cast(playerObj->getCheaterLevel()); } @@ -5071,7 +5071,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setHouseId(JNIEnv * env, jobj { UNREF(self); - CreatureObject * playerCreature = nullptr; + CreatureObject * playerCreature = NULL; if (!JavaLibrary::getObject(player, playerCreature)) return JNI_FALSE; @@ -5090,13 +5090,13 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setHouseId(JNIEnv * env, jobj * @param self class calling this function * @param player the player * - * @return the house id, or nullptr on error + * @return the house id, or null on error */ jlong JNICALL ScriptMethodsObjectInfoNamespace::getHouseId(JNIEnv * env, jobject self, jlong player) { UNREF(self); - const CreatureObject * playerCreature = nullptr; + const CreatureObject * playerCreature = NULL; if (!JavaLibrary::getObject(player, playerCreature)) return 0; @@ -5113,16 +5113,16 @@ jlong JNICALL ScriptMethodsObjectInfoNamespace::getHouseId(JNIEnv * env, jobject * @param self class calling this function * @param object the manf schematic or factory id * - * @return the draft schematic name, or nullptr on error + * @return the draft schematic name, or null on error */ jstring JNICALL ScriptMethodsObjectInfoNamespace::getDraftSchematic(JNIEnv * env, jobject self, jlong object) { UNREF(self); - const ManufactureObjectInterface * craftable = nullptr; + const ManufactureObjectInterface * craftable = NULL; - const FactoryObject * factoryObject = nullptr; - const ManufactureSchematicObject * manfSchematicObject = nullptr; + const FactoryObject * factoryObject = NULL; + const ManufactureSchematicObject * manfSchematicObject = NULL; if (JavaLibrary::getObject(object, manfSchematicObject)) { craftable = manfSchematicObject; @@ -5136,7 +5136,7 @@ jstring JNICALL ScriptMethodsObjectInfoNamespace::getDraftSchematic(JNIEnv * env const ConstCharCrcString draftSchematic(ObjectTemplateList::lookUp( craftable->getDraftSchematic())); - if (draftSchematic.getString() == nullptr) + if (draftSchematic.getString() == NULL) return 0; return JavaString(draftSchematic.getString()).getReturnValue(); @@ -5152,16 +5152,16 @@ jstring JNICALL ScriptMethodsObjectInfoNamespace::getDraftSchematic(JNIEnv * env * @param self class calling this function * @param object the manf schematic or factory id * - * @return the draft schematic name crc, or nullptr on error + * @return the draft schematic name crc, or null on error */ jint JNICALL ScriptMethodsObjectInfoNamespace::getDraftSchematicCrc(JNIEnv * env, jobject self, jlong object) { UNREF(self); - const ManufactureObjectInterface * craftable = nullptr; + const ManufactureObjectInterface * craftable = NULL; - const FactoryObject * factoryObject = nullptr; - const ManufactureSchematicObject * manfSchematicObject = nullptr; + const FactoryObject * factoryObject = NULL; + const ManufactureSchematicObject * manfSchematicObject = NULL; if (JavaLibrary::getObject(object, manfSchematicObject)) { craftable = manfSchematicObject; @@ -5175,7 +5175,7 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getDraftSchematicCrc(JNIEnv * env const ConstCharCrcString draftSchematic(ObjectTemplateList::lookUp( craftable->getDraftSchematic())); - if (draftSchematic.getString() == nullptr) + if (draftSchematic.getString() == NULL) return 0; return draftSchematic.getCrc(); @@ -5196,7 +5196,7 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getSourceDraftSchematic(JNIEnv * { UNREF(self); - const TangibleObject * object = nullptr; + const TangibleObject * object = NULL; if (!JavaLibrary::getObject(target, object)) return 0; @@ -5219,13 +5219,13 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getPlayerBirthDate(JNIEnv * env, { UNREF(self); - const CreatureObject * playerCreature = nullptr; + const CreatureObject * playerCreature = NULL; if (!JavaLibrary::getObject(playerId, playerCreature)) return -1; const PlayerObject * player = PlayerCreatureController::getPlayerObject( playerCreature); - if (player == nullptr) + if (player == NULL) return -1; return player->getBornDate(); @@ -5263,13 +5263,13 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getPlayerPlayedTime(JNIEnv * env, { UNREF(self); - const CreatureObject * playerCreature = nullptr; + const CreatureObject * playerCreature = NULL; if (!JavaLibrary::getObject(playerId, playerCreature)) return -1; const PlayerObject * player = PlayerCreatureController::getPlayerObject( playerCreature); - if (player == nullptr) + if (player == NULL) return -1; return player->getPlayedTime(); @@ -5306,7 +5306,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::setBuildingCityId(JNIEnv *env, jo * @param self class calling this function * @param jschematicName the schematic name * - * @return the object name, or nullptr if the schematic doesn't exist + * @return the object name, or null if the schematic doesn't exist */ jobject JNICALL ScriptMethodsObjectInfoNamespace::getProductNameFromSchematic(JNIEnv *env, jobject self, jstring jschematicName) @@ -5319,30 +5319,30 @@ jobject JNICALL ScriptMethodsObjectInfoNamespace::getProductNameFromSchematic(JN const DraftSchematicObject * schematic = DraftSchematicObject::getSchematic( schematicName); - if (schematic == nullptr) + if (schematic == NULL) return 0; const ServerObjectTemplate * serverOt = schematic->getCraftedObjectTemplate(); - if (serverOt == nullptr) + if (serverOt == NULL) return 0; const std::string sharedTemplateName(serverOt->getSharedTemplate()); const ObjectTemplate * ot = ObjectTemplateList::fetch(sharedTemplateName); - if (ot == nullptr) + if (ot == NULL) return 0; const SharedObjectTemplate * sharedOt = dynamic_cast( ot); - if (sharedOt == nullptr) + if (sharedOt == NULL) { ot->releaseReference(); return 0; } - ot = nullptr; + ot = NULL; const StringId objectName(sharedOt->getObjectName()); sharedOt->releaseReference(); - sharedOt = nullptr; + sharedOt = NULL; LocalRefPtr jobjectName; if (!ScriptConversion::convert(objectName, jobjectName)) @@ -5360,37 +5360,37 @@ jobject JNICALL ScriptMethodsObjectInfoNamespace::getProductNameFromSchematic(JN * @param self class calling this function * @param schematicCrc the schematic name crc * - * @return the object name, or nullptr if the schematic doesn't exist + * @return the object name, or null if the schematic doesn't exist */ jobject JNICALL ScriptMethodsObjectInfoNamespace::getProductNameFromSchematicCrc(JNIEnv *env, jobject self, jint schematicCrc) { const DraftSchematicObject * schematic = DraftSchematicObject::getSchematic( schematicCrc); - if (schematic == nullptr) + if (schematic == NULL) return 0; const ServerObjectTemplate * serverOt = schematic->getCraftedObjectTemplate(); - if (serverOt == nullptr) + if (serverOt == NULL) return 0; const std::string sharedTemplateName(serverOt->getSharedTemplate()); const ObjectTemplate * ot = ObjectTemplateList::fetch(sharedTemplateName); - if (ot == nullptr) + if (ot == NULL) return 0; const SharedObjectTemplate * sharedOt = dynamic_cast( ot); - if (sharedOt == nullptr) + if (sharedOt == NULL) { ot->releaseReference(); return 0; } - ot = nullptr; + ot = NULL; const StringId objectName(sharedOt->getObjectName()); sharedOt->releaseReference(); - sharedOt = nullptr; + sharedOt = NULL; LocalRefPtr jobjectName; if (!ScriptConversion::convert(objectName, jobjectName)) @@ -5407,7 +5407,7 @@ jobject JNICALL ScriptMethodsObjectInfoNamespace::getProductNameFromSchematicCrc * @param self class calling this function * @param draftSchematic the draft schematic's template * - * @return the template for the item the schematic creates, or nullptr on error + * @return the template for the item the schematic creates, or null on error */ jstring JNICALL ScriptMethodsObjectInfoNamespace::getTemplateCreatedFromSchematic(JNIEnv *env, jobject self, jstring draftSchematic) @@ -5433,7 +5433,7 @@ jstring JNICALL ScriptMethodsObjectInfoNamespace::getTemplateCreatedFromSchemati * @param self class calling this function * @param draftSchematicCrc the draft schematic's template crc * - * @return the template for the item the schematic creates, or nullptr on error + * @return the template for the item the schematic creates, or null on error */ jstring JNICALL ScriptMethodsObjectInfoNamespace::getTemplateCreatedFromSchematicCrc(JNIEnv *env, jobject self, jint draftSchematicCrc) @@ -5445,11 +5445,11 @@ jstring JNICALL ScriptMethodsObjectInfoNamespace::getTemplateCreatedFromSchemati const DraftSchematicObject * schematic = DraftSchematicObject::getSchematic( draftSchematicCrc); - if (schematic == nullptr) + if (schematic == NULL) return 0; const ServerObjectTemplate * serverOt = schematic->getCraftedObjectTemplate(); - if (serverOt == nullptr) + if (serverOt == NULL) return 0; JavaString templateName(serverOt->getName()); @@ -5503,11 +5503,11 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getTemplateCrcCreatedFromSchemati const DraftSchematicObject * schematic = DraftSchematicObject::getSchematic( draftSchematicCrc); - if (schematic == nullptr) + if (schematic == NULL) return 0; const ServerObjectTemplate * serverOt = schematic->getCraftedObjectTemplate(); - if (serverOt == nullptr) + if (serverOt == NULL) return 0; return Crc::calculate(serverOt->getName()); @@ -5717,7 +5717,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::requestPreloadCompleteTrigger(JNI void JNICALL ScriptMethodsObjectInfoNamespace::activateQuest(JNIEnv * env, jobject self, jlong target, jint questId) { - CreatureObject * playerCreature = nullptr; + CreatureObject * playerCreature = NULL; if (JavaLibrary::getObject(target, playerCreature)) { PlayerObject * player = PlayerCreatureController::getPlayerObject(playerCreature); @@ -5733,7 +5733,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::activateQuest(JNIEnv * env, jobje void JNICALL ScriptMethodsObjectInfoNamespace::deactivateQuest(JNIEnv * env, jobject self, jlong target, jint questId) { - CreatureObject * playerCreature = nullptr; + CreatureObject * playerCreature = NULL; if (JavaLibrary::getObject(target, playerCreature)) { PlayerObject * player = PlayerCreatureController::getPlayerObject(playerCreature); @@ -5749,7 +5749,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::deactivateQuest(JNIEnv * env, job void JNICALL ScriptMethodsObjectInfoNamespace::completeQuest(JNIEnv * env, jobject self, jlong target, jint questId) { - CreatureObject * playerCreature = nullptr; + CreatureObject * playerCreature = NULL; if (JavaLibrary::getObject(target, playerCreature)) { PlayerObject * player = PlayerCreatureController::getPlayerObject(playerCreature); @@ -5766,7 +5766,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::completeQuest(JNIEnv * env, jobje jboolean JNICALL ScriptMethodsObjectInfoNamespace::isQuestComplete(JNIEnv * env, jobject self, jlong target, jint questId) { jboolean result = false; - const CreatureObject * playerCreature = nullptr; + const CreatureObject * playerCreature = NULL; if (JavaLibrary::getObject(target, playerCreature)) { const PlayerObject * player = PlayerCreatureController::getPlayerObject(playerCreature); @@ -5783,7 +5783,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isQuestComplete(JNIEnv * env, jboolean JNICALL ScriptMethodsObjectInfoNamespace::isQuestActive(JNIEnv * env, jobject self, jlong target, jint questId) { jboolean result = false; - const CreatureObject * playerCreature = nullptr; + const CreatureObject * playerCreature = NULL; if (JavaLibrary::getObject(target, playerCreature)) { const PlayerObject * player = PlayerCreatureController::getPlayerObject(playerCreature); @@ -5801,7 +5801,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::clearCompletedQuest(JNIEnv * env, { if(questId >= 0) { - CreatureObject * playerCreature = nullptr; + CreatureObject * playerCreature = NULL; if (JavaLibrary::getObject(target, playerCreature)) { PlayerObject * player = PlayerCreatureController::getPlayerObject(playerCreature); @@ -5817,7 +5817,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::clearCompletedQuest(JNIEnv * env, jboolean JNICALL ScriptMethodsObjectInfoNamespace::canTrade(JNIEnv *env, jobject self, jlong target) { - const ServerObject * object = nullptr; + const ServerObject * object = NULL; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -5828,7 +5828,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::canTrade(JNIEnv *env, jobject jboolean JNICALL ScriptMethodsObjectInfoNamespace::isNoTradeShared(JNIEnv *env, jobject self, jlong target) { - const ServerObject * object = nullptr; + const ServerObject * object = NULL; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -5845,16 +5845,16 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isNoTradeShared(JNIEnv *env, * @param self class calling this function * @param player the player to check * - * @return the theater id, or nullptr on error + * @return the theater id, or null on error */ jlong JNICALL ScriptMethodsObjectInfoNamespace::getLastSpawnedTheater(JNIEnv *env, jobject self, jlong player) { - const CreatureObject * creature = nullptr; + const CreatureObject * creature = NULL; if (!JavaLibrary::getObject(player, creature)) return 0; const PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(creature); - if (playerObject == nullptr) + if (playerObject == NULL) return 0; return (playerObject->getTheater()).getValue(); @@ -5930,7 +5930,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::setAutoVariableFromByteStream(JNI */ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setBioLink(JNIEnv *env, jobject self, jlong target, jlong link) { - TangibleObject * object = nullptr; + TangibleObject * object = NULL; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -5955,7 +5955,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setBioLink(JNIEnv *env, jobje */ jboolean JNICALL ScriptMethodsObjectInfoNamespace::clearBioLink(JNIEnv *env, jobject self, jlong target) { - TangibleObject * object = nullptr; + TangibleObject * object = NULL; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -5972,11 +5972,11 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::clearBioLink(JNIEnv *env, job * @param self class calling this function * @param target the item to get the link from * - * @return the bio-link id, nullptr if the item isn't linked + * @return the bio-link id, null if the item isn't linked */ jlong JNICALL ScriptMethodsObjectInfoNamespace::getBioLink(JNIEnv *env, jobject self, jlong target) { - const TangibleObject * object = nullptr; + const TangibleObject * object = NULL; if (!JavaLibrary::getObject(target, object)) return 0; @@ -5990,7 +5990,7 @@ jlong JNICALL ScriptMethodsObjectInfoNamespace::getBioLink(JNIEnv *env, jobject float JNICALL ScriptMethodsObjectInfoNamespace::getObjectCollisionRadius(JNIEnv * env, jobject self, jlong jobject_obj) { - const Object * object = nullptr; + const Object * object = NULL; if (!JavaLibrary::getObject(jobject_obj, object)) return 0.0f; @@ -6008,11 +6008,11 @@ float JNICALL ScriptMethodsObjectInfoNamespace::getObjectCollisionRadius(JNIEnv * @param self class calling this function * @param target id of the object * - * @return the name, or nullptr on error + * @return the name, or null on error */ jstring JNICALL ScriptMethodsObjectInfoNamespace::getStaticItemName(JNIEnv * /*env*/, jobject /*self*/, jlong target) { - const ServerObject * o = nullptr; + const ServerObject * o = NULL; if (!JavaLibrary::getObject(target, o)) return 0; @@ -6026,7 +6026,7 @@ jstring JNICALL ScriptMethodsObjectInfoNamespace::getStaticItemName(JNIEnv * /*e jint JNICALL ScriptMethodsObjectInfoNamespace::getStaticItemVersion(JNIEnv *env, jobject /*self*/, jlong target) { - const ServerObject * o = nullptr; + const ServerObject * o = NULL; if (!JavaLibrary::getObject(target, o)) return 0; @@ -6040,7 +6040,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::setStaticItemName(JNIEnv * /*env* NetworkId const networkId(target); ServerObject * const o = ServerObject::getServerObject(networkId); - if (o == nullptr) + if (o == NULL) { WARNING(true, ("ERROR: ScriptMethodsObjectInfo::setStaticItemName() Unable to resolve the object(%s).", networkId.getValueString().c_str())); return; @@ -6058,7 +6058,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::setStaticItemVersion(JNIEnv * /*e NetworkId const networkId(target); ServerObject * const o = ServerObject::getServerObject(networkId); - if (o == nullptr) + if (o == NULL) { WARNING(true, ("ERROR: ScriptMethodsObjectInfo::setStaticItemVersion() Unable to resolve the object(%s).", networkId.getValueString().c_str())); return; @@ -6071,7 +6071,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::setStaticItemVersion(JNIEnv * /*e jint JNICALL ScriptMethodsObjectInfoNamespace::getConversionId(JNIEnv * /*env*/, jobject /*self*/, jlong target) { - const ServerObject * o = nullptr; + const ServerObject * o = NULL; if (!JavaLibrary::getObject(target, o)) return 0; @@ -6085,7 +6085,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::setConversionId(JNIEnv * /*env*/, NetworkId const networkId(target); ServerObject * const o = ServerObject::getServerObject(networkId); - if (o == nullptr) + if (o == NULL) { WARNING(true, ("ERROR: ScriptMethodsObjectInfo::setConversionId() Unable to resolve the object(%s).", networkId.getValueString().c_str())); return; @@ -6098,7 +6098,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::setConversionId(JNIEnv * /*env*/, void JNICALL ScriptMethodsObjectInfoNamespace::openCustomizationWindow(JNIEnv *env, jobject self, jlong player, jlong object, jstring customVarName1, jint minVar1, jint maxVar1, jstring customVarName2, jint minVar2, jint maxVar2, jstring customVarName3, jint minVar3, jint maxVar3, jstring customVarName4, jint minVar4, jint maxVar4) { - CreatureObject * playerObject = nullptr; + CreatureObject * playerObject = NULL; if (!JavaLibrary::getObject(player, playerObject)) return; std::string customVarName1String; @@ -6142,7 +6142,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::openCustomizationWindow(JNIEnv *e NetworkId const objectId(object); - if (playerObject->isPlayerControlled() && playerObject->getController() != nullptr) + if (playerObject->isPlayerControlled() && playerObject->getController() != NULL) { playerObject->getController()->appendMessage( static_cast(CM_openCustomizationWindow), @@ -6253,7 +6253,7 @@ jfloat JNICALL ScriptMethodsObjectInfoNamespace::getDefaultScaleFromSharedObject jboolean JNICALL ScriptMethodsObjectInfoNamespace::setOverrideMapColor(JNIEnv * env, jobject self, jlong object, jint r, jint g, jint b) { - TangibleObject * tangible = nullptr; + TangibleObject * tangible = NULL; if (!JavaLibrary::getObject(object, tangible)) return JNI_FALSE; @@ -6269,7 +6269,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setOverrideMapColor(JNIEnv * jboolean JNICALL ScriptMethodsObjectInfoNamespace::clearOverrideMapColor(JNIEnv * env, jobject self, jlong object) { - TangibleObject * tangible = nullptr; + TangibleObject * tangible = NULL; if (!JavaLibrary::getObject(object, tangible)) return JNI_FALSE; @@ -6285,14 +6285,14 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::clearOverrideMapColor(JNIEnv jobject JNICALL ScriptMethodsObjectInfoNamespace::getOverrideMapColor(JNIEnv * env, jobject self, jlong object) { - TangibleObject * tangible = nullptr; + TangibleObject * tangible = NULL; if (!JavaLibrary::getObject(object, tangible)) - return nullptr; + return NULL; uint8 r, g, b; if(!tangible->getOverrideMapColor(r,g,b)) { - return nullptr; + return NULL; } return createColor(r, g, b, 255)->getReturnValue(); @@ -6302,7 +6302,7 @@ jobject JNICALL ScriptMethodsObjectInfoNamespace::getOverrideMapColor(JNIEnv * e jboolean JNICALL ScriptMethodsObjectInfoNamespace::setForceShowHam(JNIEnv * env, jobject self, jlong object, jboolean show) { - CreatureObject * creature = nullptr; + CreatureObject * creature = NULL; if (!JavaLibrary::getObject(object, creature)) return JNI_FALSE; @@ -6317,8 +6317,8 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setForceShowHam(JNIEnv * env, jboolean JNICALL ScriptMethodsObjectInfoNamespace::isContainedByPlayerAppearanceInventory(JNIEnv *env, jobject self, jlong player, jlong item) { UNREF(self); - ServerObject *itemObj = nullptr; - CreatureObject *playerObj = nullptr; + ServerObject *itemObj = NULL; + CreatureObject *playerObj = NULL; if(!JavaLibrary::getObject(item, itemObj)) { @@ -6348,7 +6348,7 @@ jlongArray JNICALL ScriptMethodsObjectInfoNamespace::getAllItemsFromAppearanceIn { UNREF(self); - const CreatureObject * playerCreature = nullptr; + const CreatureObject * playerCreature = NULL; if (!JavaLibrary::getObject(player, playerCreature)) return 0; @@ -6356,11 +6356,11 @@ jlongArray JNICALL ScriptMethodsObjectInfoNamespace::getAllItemsFromAppearanceIn // go through the player's appearance inventory const ServerObject * appearanceInventoryObject = playerCreature->getAppearanceInventory(); - if (appearanceInventoryObject != nullptr) + if (appearanceInventoryObject != NULL) { const SlottedContainer * appearanceInvContainer = ContainerInterface::getSlottedContainer(*appearanceInventoryObject); - if (appearanceInvContainer != nullptr) + if (appearanceInvContainer != NULL) { getGoodItemsFromContainer(*appearanceInvContainer, objectIds); } @@ -6395,7 +6395,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isAPlayerAppearanceInventoryC { UNREF(self); - const ServerObject * containerObj = nullptr; + const ServerObject * containerObj = NULL; if (!JavaLibrary::getObject(container, containerObj)) return JNI_FALSE; @@ -6412,7 +6412,7 @@ jlongArray JNICALL ScriptMethodsObjectInfoNamespace::getAllWornItems(JNIEnv *env { UNREF(self); - const CreatureObject * playerCreature = nullptr; + const CreatureObject * playerCreature = NULL; if (!JavaLibrary::getObject(player, playerCreature)) return 0; @@ -6428,7 +6428,7 @@ jlongArray JNICALL ScriptMethodsObjectInfoNamespace::getAllWornItems(JNIEnv *env DEBUG_WARNING(true, ("JavaLibrary: getAllWornItems - Tried to get all the worn items(INCLUDING appearance items) from player [%s], but this player has no appearance inventory container.", playerCreature->getNetworkId().getValueString().c_str())); - return nullptr; + return NULL; } for (ContainerConstIterator i(appearanceInventory->begin()); i != appearanceInventory->end(); ++i) @@ -6436,7 +6436,7 @@ jlongArray JNICALL ScriptMethodsObjectInfoNamespace::getAllWornItems(JNIEnv *env const CachedNetworkId & itemId = *i; const ServerObject * item = safe_cast( itemId.getObject()); - if (item != nullptr && item->asTangibleObject() != nullptr && + if (item != NULL && item->asTangibleObject() != NULL && item->asTangibleObject()->isVisible()) { @@ -6459,7 +6459,7 @@ jlongArray JNICALL ScriptMethodsObjectInfoNamespace::getAllWornItems(JNIEnv *env DEBUG_WARNING(true, ("JavaLibrary: getAllWornItems - Tried to get all the worn items from player [%s], but this player has no creature slot container.", playerCreature->getNetworkId().getValueString().c_str())); - return nullptr; + return NULL; } for (ContainerConstIterator i(inventory->begin()); i != inventory->end(); ++i) @@ -6467,7 +6467,7 @@ jlongArray JNICALL ScriptMethodsObjectInfoNamespace::getAllWornItems(JNIEnv *env const CachedNetworkId & itemId = *i; const ServerObject * item = safe_cast( itemId.getObject()); - if (item != nullptr && item->asTangibleObject() != nullptr && + if (item != NULL && item->asTangibleObject() != NULL && item->asTangibleObject()->isVisible()) { const SlottedContainmentProperty * slottedContainment = ContainerInterface::getSlottedContainmentProperty(*item); // Get the slot property of our item. @@ -6507,7 +6507,7 @@ jlongArray JNICALL ScriptMethodsObjectInfoNamespace::getAllWornItems(JNIEnv *env return returnedIds->getReturnValue(); } - return nullptr; + return NULL; } @@ -6518,7 +6518,7 @@ jlong JNICALL ScriptMethodsObjectInfoNamespace::getAppearanceInventory(JNIEnv *e UNREF(env); UNREF(self); - const CreatureObject * playerCreature = nullptr; + const CreatureObject * playerCreature = NULL; if (!JavaLibrary::getObject(player, playerCreature)) return 0; @@ -6536,11 +6536,11 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setDecoyOrigin(JNIEnv *env, j UNREF(env); UNREF(self); - CreatureObject * decoyCreature = nullptr; + CreatureObject * decoyCreature = NULL; if (!JavaLibrary::getObject(creature, decoyCreature)) return JNI_FALSE; - const CreatureObject * originCreature = nullptr; + const CreatureObject * originCreature = NULL; if (!JavaLibrary::getObject(origin, originCreature)) return JNI_FALSE; @@ -6561,7 +6561,7 @@ jlong JNICALL ScriptMethodsObjectInfoNamespace::getDecoyOrigin(JNIEnv *env, jobj UNREF(env); UNREF(self); - CreatureObject * decoyCreature = nullptr; + CreatureObject * decoyCreature = NULL; if (!JavaLibrary::getObject(creature, decoyCreature)) return JNI_FALSE; @@ -6578,7 +6578,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::openRatingWindow(JNIEnv * env UNREF(env); UNREF(self); - CreatureObject * playerCreature = nullptr; + CreatureObject * playerCreature = NULL; if (!JavaLibrary::getObject(player, playerCreature)) { DEBUG_WARNING(true, ("OpenRatingWindow: Failed to get valid creature object with OID %d", player)); @@ -6603,7 +6603,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::openRatingWindow(JNIEnv * env return JNI_FALSE; } - if (playerCreature->isPlayerControlled() && playerCreature->getController() != nullptr) + if (playerCreature->isPlayerControlled() && playerCreature->getController() != NULL) { playerCreature->getController()->appendMessage( static_cast(CM_openRatingWindow), @@ -6626,13 +6626,13 @@ void JNICALL ScriptMethodsObjectInfoNamespace::openExamineWindow(JNIEnv * env, j UNREF(env); UNREF(self); - CreatureObject const * playerCreature = nullptr; + CreatureObject const * playerCreature = NULL; if (!JavaLibrary::getObject(player, playerCreature) || !playerCreature || !playerCreature->getClient()) { return; } - ServerObject const * itemObject = nullptr; + ServerObject const * itemObject = NULL; if (!JavaLibrary::getObject(item, itemObject) || !itemObject) { return; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsObjectMove.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsObjectMove.cpp index 2ba2beda..d345c4f0 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsObjectMove.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsObjectMove.cpp @@ -215,7 +215,7 @@ const JNINativeMethod NATIVES[] = { */ bool ScriptMethodsObjectMoveNamespace::testInvalidObjectMove(const ServerObject * object) { - if (object->getCacheVersion() > 0 || object->getCellProperty() != nullptr) + if (object->getCacheVersion() > 0 || object->getCellProperty() != NULL) { char buffer[1024]; sprintf(buffer, "A script is trying to move object %s, which is a cached " @@ -323,7 +323,7 @@ jboolean JNICALL ScriptMethodsObjectMoveNamespace::setLocationFromObj(JNIEnv *en * @param self class calling this function * @param objectId object to get * - * @return the object's location, or nullptr on error + * @return the object's location, or null on error */ jobject JNICALL ScriptMethodsObjectMoveNamespace::getLocation(JNIEnv *env, jobject self, jlong objectId) { @@ -337,13 +337,13 @@ jobject JNICALL ScriptMethodsObjectMoveNamespace::getLocation(JNIEnv *env, jobje // (e.g. for mounts, the immediate Container is the mount). NOT_NULL(object); CellProperty const *const cellProperty = object->getParentCell(); - Object const *const cell = (cellProperty != nullptr) ? &(cellProperty->getOwner()) : nullptr; + Object const *const cell = (cellProperty != NULL) ? &(cellProperty->getOwner()) : NULL; // Remember, just because we're not in a cell doesn't mean we're not contained by something else, // particularly in the case of a rider mounted where the mount is in the world cell. - Vector const positionRelativeToCellOrWorld = (cell != nullptr) ? object->getPosition_c() : + Vector const positionRelativeToCellOrWorld = (cell != NULL) ? object->getPosition_c() : object->getPosition_w(); - NetworkId const &networkIdForCellOrWorld = (cell != nullptr) ? cell->getNetworkId() : + NetworkId const &networkIdForCellOrWorld = (cell != NULL) ? cell->getNetworkId() : NetworkId::cms_invalid; LocalRefPtr location; @@ -362,7 +362,7 @@ jobject JNICALL ScriptMethodsObjectMoveNamespace::getLocation(JNIEnv *env, jobje * @param self class calling this function * @param objectId object to get * - * @return the object's world location, or nullptr on error + * @return the object's world location, or null on error */ jobject JNICALL ScriptMethodsObjectMoveNamespace::getWorldLocation(JNIEnv *env, jobject self, jlong objectId) { @@ -387,7 +387,7 @@ jobject JNICALL ScriptMethodsObjectMoveNamespace::getWorldLocation(JNIEnv *env, * @param self class calling this function * @param objectId object to get * - * @return the object's location, or nullptr on error + * @return the object's location, or null on error */ jobject JNICALL ScriptMethodsObjectMoveNamespace::getHeading(JNIEnv *env, jobject self, jlong objectId) { @@ -553,7 +553,7 @@ jboolean JNICALL ScriptMethodsObjectMoveNamespace::faceToBehavior(JNIEnv *env, j jfloat JNICALL ScriptMethodsObjectMoveNamespace::getYaw(JNIEnv *env, jobject self, jlong target) { - const ServerObject * object = nullptr; + const ServerObject * object = NULL; if (!JavaLibrary::getObject(target, object)) return -1.0f; @@ -565,7 +565,7 @@ jfloat JNICALL ScriptMethodsObjectMoveNamespace::getYaw(JNIEnv *env, jobject sel jboolean JNICALL ScriptMethodsObjectMoveNamespace::setYaw(JNIEnv *env, jobject self, jlong target, jfloat yaw) { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::setYaw"); - ServerObject * object = nullptr; + ServerObject * object = NULL; { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::setYaw::getObject"); if (!JavaLibrary::getObject(target, object)) @@ -608,7 +608,7 @@ jboolean JNICALL ScriptMethodsObjectMoveNamespace::setYaw(JNIEnv *env, jobject s void JNICALL ScriptMethodsObjectMoveNamespace::modifyYaw(JNIEnv *env, jobject self, jlong target, jfloat degrees) { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::modifyYaw"); - ServerObject * object = nullptr; + ServerObject * object = NULL; { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::modifyYaw::getObject"); if (!JavaLibrary::getObject(target, object)) @@ -650,7 +650,7 @@ void JNICALL ScriptMethodsObjectMoveNamespace::modifyYaw(JNIEnv *env, jobject se void JNICALL ScriptMethodsObjectMoveNamespace::modifyPitch(JNIEnv *env, jobject self, jlong target, jfloat degrees) { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::modifyPitch"); - ServerObject * object = nullptr; + ServerObject * object = NULL; { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::modifyPitch::getObject"); if (!JavaLibrary::getObject(target, object)) @@ -692,7 +692,7 @@ void JNICALL ScriptMethodsObjectMoveNamespace::modifyPitch(JNIEnv *env, jobject void JNICALL ScriptMethodsObjectMoveNamespace::modifyRoll(JNIEnv *env, jobject self, jlong target, jfloat degrees) { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::modifyRoll"); - ServerObject * object = nullptr; + ServerObject * object = NULL; { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::modifyRoll::getObject"); if (!JavaLibrary::getObject(target, object)) @@ -734,7 +734,7 @@ void JNICALL ScriptMethodsObjectMoveNamespace::modifyRoll(JNIEnv *env, jobject s jfloatArray JNICALL ScriptMethodsObjectMoveNamespace::getQuaternion(JNIEnv *env, jobject self, jlong target) { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::getQuaternion"); - ServerObject * object = nullptr; + ServerObject * object = NULL; { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::getQuaternion::getObject"); if (!JavaLibrary::getObject(target, object)) @@ -771,7 +771,7 @@ jfloatArray JNICALL ScriptMethodsObjectMoveNamespace::getQuaternion(JNIEnv *env, void JNICALL ScriptMethodsObjectMoveNamespace::setQuaternion(JNIEnv *env, jobject self, jlong target, jfloat qw, jfloat qx, jfloat qy, jfloat qz) { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::setQuaternion"); - ServerObject * object = nullptr; + ServerObject * object = NULL; { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::setQuaternion::getObject"); if (!JavaLibrary::getObject(target, object)) @@ -804,7 +804,7 @@ void JNICALL ScriptMethodsObjectMoveNamespace::setQuaternion(JNIEnv *env, jobjec jint JNICALL ScriptMethodsObjectMoveNamespace::getFurnitureRotationDegree(JNIEnv *env, jobject self, jlong player) { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::getFurnitureRotationDegree"); - ServerObject * object = nullptr; + ServerObject * object = NULL; { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::getFurnitureRotationDegree::getObject"); if (!JavaLibrary::getObject(player, object)) @@ -823,11 +823,11 @@ jint JNICALL ScriptMethodsObjectMoveNamespace::getFurnitureRotationDegree(JNIEnv void JNICALL ScriptMethodsObjectMoveNamespace::saveDecorationLayout(JNIEnv *env, jobject self, jlong player, jlong pob, jint saveSlotNumber, jstring description) { - CreatureObject * playerObject = nullptr; + CreatureObject * playerObject = NULL; if (!JavaLibrary::getObject(player, playerObject) || !playerObject) return; - ServerObject const * pobObject = nullptr; + ServerObject const * pobObject = NULL; if (!JavaLibrary::getObject(pob, pobObject) || !pobObject) return; @@ -843,11 +843,11 @@ void JNICALL ScriptMethodsObjectMoveNamespace::saveDecorationLayout(JNIEnv *env, void JNICALL ScriptMethodsObjectMoveNamespace::restoreDecorationLayout(JNIEnv *env, jobject self, jlong player, jlong pob, jint saveSlotNumber) { - CreatureObject * playerObject = nullptr; + CreatureObject * playerObject = NULL; if (!JavaLibrary::getObject(player, playerObject) || !playerObject) return; - ServerObject const * pobObject = nullptr; + ServerObject const * pobObject = NULL; if (!JavaLibrary::getObject(pob, pobObject) || !pobObject) return; @@ -1402,11 +1402,11 @@ jobject JNICALL ScriptMethodsObjectMoveNamespace::getConnectedPlayerLocation(JNI std::map const & connectedCharacterLfgData = ServerUniverse::getConnectedCharacterLfgData(); std::map::const_iterator const iterFind = connectedCharacterLfgData.find(NetworkId(static_cast(player))); if (iterFind == connectedCharacterLfgData.end()) - return nullptr; + return NULL; LocalRefPtr dictionary = createNewObject(JavaLibrary::getClsDictionary(), JavaLibrary::getMidDictionary()); if (dictionary == LocalRef::cms_nullPtr) - return nullptr; + return NULL; callObjectMethod(*dictionary, JavaLibrary::getMidDictionaryPut(), JavaString("planet").getValue(), JavaString(iterFind->second.locationPlanet).getValue()); @@ -1457,7 +1457,7 @@ jfloat JNICALL ScriptMethodsObjectMoveNamespace::getMovementSpeed(JNIEnv * /*env NetworkId const networkId(object); CreatureController * const creatureController = CreatureController::getCreatureController(networkId); - return (creatureController != nullptr) ? creatureController->getCurrentVelocity().magnitude() : 0.0f; + return (creatureController != NULL) ? creatureController->getCurrentVelocity().magnitude() : 0.0f; } // ---------------------------------------------------------------------- @@ -1467,7 +1467,7 @@ jfloat JNICALL ScriptMethodsObjectMoveNamespace::getWalkSpeed(JNIEnv * /*env*/, NetworkId const networkId(object); CreatureObject * const creatureObject = CreatureObject::getCreatureObject(networkId); - return (creatureObject != nullptr) ? creatureObject->getWalkSpeed() : 0.0f; + return (creatureObject != NULL) ? creatureObject->getWalkSpeed() : 0.0f; } // ---------------------------------------------------------------------- @@ -1477,7 +1477,7 @@ jfloat JNICALL ScriptMethodsObjectMoveNamespace::getRunSpeed(JNIEnv * /*env*/, j NetworkId const networkId(object); CreatureObject * const creatureObject = CreatureObject::getCreatureObject(networkId); - return (creatureObject != nullptr) ? creatureObject->getRunSpeed() : 0.0f; + return (creatureObject != NULL) ? creatureObject->getRunSpeed() : 0.0f; } // ---------------------------------------------------------------------- @@ -1487,7 +1487,7 @@ void JNICALL ScriptMethodsObjectMoveNamespace::setBaseWalkSpeed(JNIEnv * /*env*/ NetworkId const networkId(object); CreatureObject * const creatureObject = CreatureObject::getCreatureObject(networkId); - if (creatureObject == nullptr) + if (creatureObject == NULL) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsObjectMove::setBaseWalkSpeed() Unable to resolve the object(%s) to a CreatureObject.", networkId.getValueString().c_str())); return; @@ -1505,7 +1505,7 @@ jfloat JNICALL ScriptMethodsObjectMoveNamespace::getBaseWalkSpeed(JNIEnv * /*env NetworkId const networkId(object); CreatureObject * const creatureObject = CreatureObject::getCreatureObject(networkId); - return (creatureObject != nullptr) ? creatureObject->getBaseWalkSpeed() : 0.0f; + return (creatureObject != NULL) ? creatureObject->getBaseWalkSpeed() : 0.0f; } // ---------------------------------------------------------------------- @@ -1515,7 +1515,7 @@ void JNICALL ScriptMethodsObjectMoveNamespace::setBaseRunSpeed(JNIEnv * /*env*/, NetworkId const networkId(object); CreatureObject * const creatureObject = CreatureObject::getCreatureObject(networkId); - if (creatureObject == nullptr) + if (creatureObject == NULL) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsObjectMove::setBaseRunSpeed() Unable to resolve the object(%s) to a CreatureObject.", networkId.getValueString().c_str())); return; @@ -1533,7 +1533,7 @@ jfloat JNICALL ScriptMethodsObjectMoveNamespace::getBaseRunSpeed(JNIEnv * /*env* NetworkId const networkId(object); CreatureObject * const creatureObject = CreatureObject::getCreatureObject(networkId); - return (creatureObject != nullptr) ? creatureObject->getBaseRunSpeed() : 0.0f; + return (creatureObject != NULL) ? creatureObject->getBaseRunSpeed() : 0.0f; } // ---------------------------------------------------------------------- @@ -1543,7 +1543,7 @@ void JNICALL ScriptMethodsObjectMoveNamespace::setMovementWalk(JNIEnv * /*env*/, NetworkId const networkId(object); CreatureObject * const creatureObject = CreatureObject::getCreatureObject(networkId); - if (creatureObject == nullptr) + if (creatureObject == NULL) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsObjectMove::setMovementWalk() Unable to resolve the object(%s) to a CreatureObject.", networkId.getValueString().c_str())); return; @@ -1551,7 +1551,7 @@ void JNICALL ScriptMethodsObjectMoveNamespace::setMovementWalk(JNIEnv * /*env*/, AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(creatureObject->getController()); - if (aiCreatureController == nullptr) + if (aiCreatureController == NULL) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsObjectMove::setMovementWalk() Unable to resolve the object's(%s) controller to an AiCreatureController.", creatureObject->getDebugInformation().c_str())); return; @@ -1569,7 +1569,7 @@ void JNICALL ScriptMethodsObjectMoveNamespace::setMovementRun(JNIEnv * /*env*/, NetworkId const networkId(object); CreatureObject * const creatureObject = CreatureObject::getCreatureObject(networkId); - if (creatureObject == nullptr) + if (creatureObject == NULL) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsObjectMove::setMovementRun() Unable to resolve the object(%s) to a CreatureObject.", networkId.getValueString().c_str())); return; @@ -1577,7 +1577,7 @@ void JNICALL ScriptMethodsObjectMoveNamespace::setMovementRun(JNIEnv * /*env*/, AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(creatureObject->getController()); - if (aiCreatureController == nullptr) + if (aiCreatureController == NULL) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsObjectMove::setMovementRun() Unable to resolve the object's(%s) controller to an AiCreatureController.", creatureObject->getDebugInformation().c_str())); return; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsPermissions.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsPermissions.cpp index 82bf242b..732a9f6d 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsPermissions.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsPermissions.cpp @@ -85,7 +85,7 @@ jobjectArray JNICALL ScriptMethodsPermissionsNamespace::permissionsGetBanned(JNI { ServerObject *serverObj = 0; if (!JavaLibrary::getObject(target, serverObj)) - return nullptr; + return NULL; LocalObjectArrayRefPtr strArray; BuildingObject *buildingObj = dynamic_cast(serverObj); @@ -96,7 +96,7 @@ jobjectArray JNICALL ScriptMethodsPermissionsNamespace::permissionsGetBanned(JNI if (cellObj) if (ScriptConversion::convert(cellObj->getBanned(), strArray)) return strArray->getReturnValue(); - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -114,7 +114,7 @@ jobjectArray JNICALL ScriptMethodsPermissionsNamespace::permissionsGetAllowed(JN { ServerObject *serverObj = 0; if (!JavaLibrary::getObject(target, serverObj)) - return nullptr; + return NULL; LocalObjectArrayRefPtr strArray; BuildingObject *buildingObj = dynamic_cast(serverObj); @@ -125,7 +125,7 @@ jobjectArray JNICALL ScriptMethodsPermissionsNamespace::permissionsGetAllowed(JN if (cellObj) if (ScriptConversion::convert(cellObj->getAllowed(), strArray)) return strArray->getReturnValue(); - return nullptr; + return NULL; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsPilot.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsPilot.cpp index 96bf045b..5d216dc2 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsPilot.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsPilot.cpp @@ -177,7 +177,7 @@ jint JNICALL ScriptMethodsPilotNamespace::spaceUnitGetBehavior(JNIEnv * env, job if (!shipObject) return JNI_FALSE; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitGetBehavior() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -200,7 +200,7 @@ jlong JNICALL ScriptMethodsPilotNamespace::spaceUnitGetPrimaryAttackTarget(JNIEn if (!shipObject) return JNI_FALSE; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitGetPrimaryAttackTarget() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -223,7 +223,7 @@ jlongArray JNICALL ScriptMethodsPilotNamespace::spaceUnitGetAttackTargetList(JNI if (!shipObject) return JNI_FALSE; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitGetAttackTargetList() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -311,7 +311,7 @@ jboolean JNICALL ScriptMethodsPilotNamespace::spaceUnitIsAttacking(JNIEnv * env, if (!shipObject) return JNI_FALSE; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitIsAttacking() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -334,7 +334,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitIdle(JNIEnv * env, jobject /* if (!shipObject) return; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitIdle() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -357,14 +357,14 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitTrack(JNIEnv * env, jobject / if (!shipObject) return; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitTrack() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); return; } - Object * target = nullptr; + Object * target = NULL; if (!JavaLibrary::getObject(jobject_target, target)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitTrack() The target did not resolve to an Object")); @@ -387,7 +387,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitMoveTo(JNIEnv * env, jobject if (!shipObject) return; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitMoveTo() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -410,7 +410,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitMoveTo(JNIEnv * env, jobject return; } - SpacePath * const path = SpacePathManager::fetch(nullptr, aiShipController->getOwner(), aiShipController->getShipRadius()); + SpacePath * const path = SpacePathManager::fetch(NULL, aiShipController->getOwner(), aiShipController->getShipRadius()); AiShipController::TransformList::const_iterator iterTransformList = convertedPath.begin(); for (; iterTransformList != convertedPath.end(); ++iterTransformList) @@ -435,7 +435,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitAddPatrolPath(JNIEnv * env, j if (!shipObject) return; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitAddPatrolPath() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -483,7 +483,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitClearPatrolPath(JNIEnv * env, if (!shipObject) return; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitClearPatrolPath() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -506,14 +506,14 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitFollow(JNIEnv * env, jobject if (!shipObject) return; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitFollow() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); return; } - Object * followedUnit = nullptr; + Object * followedUnit = NULL; if (!JavaLibrary::getObject(jobject_followedUnit, followedUnit)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitFollow() followedUnit did not resolve to an Object")); @@ -592,10 +592,10 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitAddDamageTaken(JNIEnv * env, } ShipController * const shipController = shipObject->getController()->asShipController(); - AiShipController * const aiShipController = (shipController != nullptr) ? shipController->asAiShipController() : nullptr; + AiShipController * const aiShipController = (shipController != NULL) ? shipController->asAiShipController() : NULL; bool const verifyAttacker = true; - if (aiShipController != nullptr) + if (aiShipController != NULL) { // This adds damage to an AI unit @@ -607,7 +607,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitAddDamageTaken(JNIEnv * env, LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("ScriptMethodsPilot::spaceUnitAddDamageTaken() targetUnit(%s) is not attackable", targetShipObject->getNetworkId().getValueString().c_str())); } } - else if (shipController != nullptr) + else if (shipController != NULL) { // This adds damage to a player unit @@ -635,7 +635,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitSetAttackOrders(JNIEnv * env, if (!shipObject) return; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitSetAttackOrder() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -665,7 +665,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitSetPilotType(JNIEnv * env, jo if (!shipObject) return; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitSetPilotType() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -697,13 +697,13 @@ jstring JNICALL ScriptMethodsPilotNamespace::spaceUnitGetPilotType(JNIEnv * env, LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("ScriptMethodsPilot::spaceUnitGetPilotType()")); if (!verifyShipsEnabled()) - return nullptr; + return NULL; ShipObject * const shipObject = JavaLibrary::getShipThrow(env, jobject_unit, "ScriptMethodsPilot::spaceUnitGetPilotType() unit did not resolve to a ShipObject"); if (!shipObject) - return nullptr; + return NULL; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitGetPilotType() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -726,7 +726,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitRemoveAttackTarget(JNIEnv * e if (!shipObject) return; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitRemoveAttackTarget() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -765,7 +765,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitSetLeashDistance(JNIEnv * env if (!shipObject) return; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitSetLeashDistance() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -805,7 +805,7 @@ jint JNICALL ScriptMethodsPilotNamespace::spaceUnitGetSquadId(JNIEnv * env, jobj if (!shipObject) return JNI_FALSE; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitGetSquadId() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -849,7 +849,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceSquadMoveTo(JNIEnv * /*env*/, job } float const largestShipRadius = squad->getLargestShipRadius(); - SpacePath * const path = SpacePathManager::fetch(nullptr, squad, largestShipRadius); + SpacePath * const path = SpacePathManager::fetch(NULL, squad, largestShipRadius); AiShipController::TransformList::const_iterator iterTransformList = convertedPath.begin(); for (; iterTransformList != convertedPath.end(); ++iterTransformList) @@ -936,7 +936,7 @@ jint JNICALL ScriptMethodsPilotNamespace::spaceSquadRemoveUnit(JNIEnv * env, job if (!shipObject) return JNI_FALSE; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceSquadRemoveUnit() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -1148,7 +1148,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceSquadTrack(JNIEnv * /*env*/, jobj return; } - Object * target = nullptr; + Object * target = NULL; if (!JavaLibrary::getObject(jobject_target, target)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceSquadTrack() The target did not resolve to an Object")); @@ -1171,7 +1171,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceSquadSetLeader(JNIEnv * env, jobj if (!leaderShipObject) return; - AiShipController * const aiShipController = (leaderShipObject->getController()->asShipController() != nullptr) ? leaderShipObject->getController()->asShipController()->asAiShipController() : nullptr; + AiShipController * const aiShipController = (leaderShipObject->getController()->asShipController() != NULL) ? leaderShipObject->getController()->asShipController()->asAiShipController() : NULL; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceSquadSetLeader() called on unit(%s) without AiShipController", leaderShipObject->getNetworkId().getValueString().c_str())); @@ -1251,7 +1251,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceSquadFollow(JNIEnv * /*env*/, job return; } - Object * followedUnit = nullptr; + Object * followedUnit = NULL; if (!JavaLibrary::getObject(jobject_followedUnit, followedUnit)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceSquadFollow() followedUnit did not resolve to an Object")); @@ -1418,7 +1418,7 @@ jint JNICALL ScriptMethodsPilotNamespace::spaceSquadGetGuardTarget(JNIEnv * /*en return JNI_FALSE; } - if (squad->getGuardTarget() == nullptr) + if (squad->getGuardTarget() == NULL) { return 0; } @@ -1463,7 +1463,7 @@ void JNICALL ScriptMethodsPilotNamespace::setShipAggroDistance(JNIEnv * env, job if (!shipObject) return; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::setShipAggroDistance(): unit(%s) does not have an AiShipController",shipObject->getNetworkId().getValueString().c_str())); @@ -1557,14 +1557,14 @@ jobject JNICALL ScriptMethodsPilotNamespace::spaceUnitGetDockTransform(JNIEnv * if (!verifyShipsEnabled()) return 0; - Object * dockTarget = nullptr; + Object * dockTarget = NULL; if (!JavaLibrary::getObject(jobject_dockTarget, dockTarget)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitGetDockTransform() dockTarget did not resolve to an Object")); return 0; } - Object * dockingUnit = nullptr; + Object * dockingUnit = NULL; if (!JavaLibrary::getObject(jobject_dockingUnit, dockingUnit)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitGetDockTransform() dockingUnit did not resolve to an Object")); @@ -1600,14 +1600,14 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitAddExclusiveAggro(JNIEnv * en return; } - AiShipController * const unitAiShipController = (unitShipObject->getController()->asShipController() != nullptr) ? unitShipObject->getController()->asShipController()->asAiShipController() : nullptr; + AiShipController * const unitAiShipController = (unitShipObject->getController()->asShipController() != NULL) ? unitShipObject->getController()->asShipController()->asAiShipController() : NULL; if (!unitAiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitAddExclusiveAggro() called on unit(%s) without AiShipController", unitShipObject->getDebugInformation().c_str())); return; } - Object * pilotObject = nullptr; + Object * pilotObject = NULL; if (!JavaLibrary::getObject(jobject_pilot, pilotObject)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitAddExclusiveAggro() pilot did not resolve to an Object")); @@ -1642,14 +1642,14 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitRemoveExclusiveAggro(JNIEnv * return; } - AiShipController * const unitAiShipController = (unitShipObject->getController()->asShipController() != nullptr) ? unitShipObject->getController()->asShipController()->asAiShipController() : nullptr; + AiShipController * const unitAiShipController = (unitShipObject->getController()->asShipController() != NULL) ? unitShipObject->getController()->asShipController()->asAiShipController() : NULL; if (!unitAiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitRemoveExclusiveAggro() called on unit(%s) without AiShipController", unitShipObject->getDebugInformation().c_str())); return; } - Object * pilotObject = nullptr; + Object * pilotObject = NULL; if (!JavaLibrary::getObject(jobject_pilot, pilotObject)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitRemoveExclusiveAggro() pilot did not resolve to an Object")); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsPlayerAccount.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsPlayerAccount.cpp index 0234a47c..00aa9c9d 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsPlayerAccount.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsPlayerAccount.cpp @@ -127,7 +127,7 @@ jlong JNICALL ScriptMethodsPlayerAccountNamespace::getPlayerObject(JNIEnv *env, jlong objId = 0; - ServerObject * creatureServerObject = nullptr; + ServerObject * creatureServerObject = NULL; if (JavaLibrary::getObject(creature,creatureServerObject)) { SlotId slot = SlotIdManager::findSlotId(ConstCharCrcLowerString("ghost")); @@ -258,11 +258,11 @@ jobject JNICALL ScriptMethodsPlayerAccountNamespace::getAccountTimeData(JNIEnv * const PlayerObject * player = PlayerCreatureController::getPlayerObject( creature); - if (player == nullptr) + if (player == NULL) return 0; const Client * client = creature->getClient(); - if (client == nullptr) + if (client == NULL) return 0; // get the values that came from Platform @@ -463,7 +463,7 @@ jboolean JNICALL ScriptMethodsPlayerAccountNamespace::isAccountQualifiedForHouse * @returns a dictionary that contains the following data in paralled arrays * with the oldest CTS transaction first and the newest CTS transaction last * -* @returns nullptr if the character doesn't have any CTS history +* @returns null if the character doesn't have any CTS history * * string[] character_name full name of the source character * string[] cluster_name name of the source cluster @@ -471,7 +471,7 @@ jboolean JNICALL ScriptMethodsPlayerAccountNamespace::isAccountQualifiedForHouse */ jobject JNICALL ScriptMethodsPlayerAccountNamespace::getCharacterCtsHistory(JNIEnv * env, jobject self, jlong player) { - CreatureObject const * playerObject = nullptr; + CreatureObject const * playerObject = NULL; if (!JavaLibrary::getObject(player, playerObject)) { DEBUG_WARNING(true, ("JavaLibrary::getCharacterCtsHistory: bad player object")); @@ -491,7 +491,7 @@ jobject JNICALL ScriptMethodsPlayerAccountNamespace::getCharacterCtsHistory(JNIE if (i.getValue(ctsTransactionDetail)) { Unicode::UnicodeStringVector tokens; - if (Unicode::tokenize(ctsTransactionDetail, tokens, nullptr, nullptr) && (tokens.size() >= 4)) + if (Unicode::tokenize(ctsTransactionDetail, tokens, NULL, NULL) && (tokens.size() >= 4)) { Unicode::String * characterName = new Unicode::String(); for (size_t i = 3, j = tokens.size(); i < j; ++i) @@ -538,13 +538,13 @@ jobject JNICALL ScriptMethodsPlayerAccountNamespace::getCharacterCtsHistory(JNIE * for the particular CTS source character that this character at one time transferred from * with the oldest CTS transaction first and the newest CTS transaction last * -* @returns nullptr if the character doesn't have any retroactive CTS objvars history +* @returns null if the character doesn't have any retroactive CTS objvars history */ jobjectArray JNICALL ScriptMethodsPlayerAccountNamespace::getCharacterRetroactiveCtsObjvars(JNIEnv * env, jobject self, jlong player) { std::vector > const *> const & characterRetroactiveCtsObjvars = GameServer::getRetroactiveCtsHistoryObjvars(NetworkId(static_cast(player))); if (characterRetroactiveCtsObjvars.empty()) - return nullptr; + return NULL; LocalObjectArrayRefPtr results = createNewObjectArray(characterRetroactiveCtsObjvars.size(), JavaLibrary::getClsDictionary()); for (size_t i = 0, size = characterRetroactiveCtsObjvars.size(); i < size; ++i) @@ -603,7 +603,7 @@ jobjectArray JNICALL ScriptMethodsPlayerAccountNamespace::qualifyForFreeCts(JNIE // see if we can/should bypass the free CTS time restriction if (!freeCtsInfo && ConfigServerGame::getAllowIgnoreFreeCtsTimeRestriction()) { - CreatureObject const * playerObject = nullptr; + CreatureObject const * playerObject = NULL; if (JavaLibrary::getObject(player, playerObject) && playerObject && playerObject->getClient() && playerObject->getClient()->isGod()) { freeCtsInfo = FreeCtsDataTable::getFreeCtsInfoForCharacter(characterCreateTime, GameServer::getInstance().getClusterName(), true); @@ -615,7 +615,7 @@ jobjectArray JNICALL ScriptMethodsPlayerAccountNamespace::qualifyForFreeCts(JNIE } if (!freeCtsInfo || freeCtsInfo->targetCluster.empty()) - return nullptr; + return NULL; LocalObjectArrayRefPtr valueArray = createNewObjectArray(freeCtsInfo->targetCluster.size(), JavaLibrary::getClsString()); @@ -634,7 +634,7 @@ jobjectArray JNICALL ScriptMethodsPlayerAccountNamespace::qualifyForFreeCts(JNIE */ void JNICALL ScriptMethodsPlayerAccountNamespace::validateFreeCts(JNIEnv * /*env*/, jobject /*self*/, jlong player, jstring destinationGalaxy, jstring destinationCharacterName) { - CreatureObject const * creatureObject = nullptr; + CreatureObject const * creatureObject = NULL; if (!JavaLibrary::getObject(player, creatureObject) || !creatureObject) { DEBUG_WARNING(true, ("JavaLibrary::validateFreeCts: bad CreatureObject")); @@ -674,7 +674,7 @@ void JNICALL ScriptMethodsPlayerAccountNamespace::validateFreeCts(JNIEnv * /*env */ void JNICALL ScriptMethodsPlayerAccountNamespace::performFreeCts(JNIEnv * /*env*/, jobject /*self*/, jlong player, jstring destinationGalaxy, jstring destinationCharacterName) { - CreatureObject const * creatureObject = nullptr; + CreatureObject const * creatureObject = NULL; if (!JavaLibrary::getObject(player, creatureObject) || !creatureObject) { DEBUG_WARNING(true, ("JavaLibrary::performFreeCts: bad CreatureObject")); @@ -713,7 +713,7 @@ void JNICALL ScriptMethodsPlayerAccountNamespace::performFreeCts(JNIEnv * /*env* */ void JNICALL ScriptMethodsPlayerAccountNamespace::validateCts(JNIEnv * /*env*/, jobject /*self*/, jlong player, jstring destinationGalaxy, jstring destinationCharacterName) { - CreatureObject const * creatureObject = nullptr; + CreatureObject const * creatureObject = NULL; if (!JavaLibrary::getObject(player, creatureObject) || !creatureObject) { DEBUG_WARNING(true, ("JavaLibrary::validateCts: bad CreatureObject")); @@ -753,7 +753,7 @@ void JNICALL ScriptMethodsPlayerAccountNamespace::validateCts(JNIEnv * /*env*/, */ void JNICALL ScriptMethodsPlayerAccountNamespace::performCts(JNIEnv * /*env*/, jobject /*self*/, jlong player, jstring destinationGalaxy, jstring destinationCharacterName) { - CreatureObject const * creatureObject = nullptr; + CreatureObject const * creatureObject = NULL; if (!JavaLibrary::getObject(player, creatureObject) || !creatureObject) { DEBUG_WARNING(true, ("JavaLibrary::performCts: bad CreatureObject")); @@ -792,7 +792,7 @@ void JNICALL ScriptMethodsPlayerAccountNamespace::performCts(JNIEnv * /*env*/, j */ void JNICALL ScriptMethodsPlayerAccountNamespace::validateRenameCharacter(JNIEnv *env, jobject self, jlong player, jstring newName) { - CreatureObject const * creatureObject = nullptr; + CreatureObject const * creatureObject = NULL; if (!JavaLibrary::getObject(player, creatureObject) || !creatureObject) { DEBUG_WARNING(true, ("JavaLibrary::validateRenameCharacter: bad CreatureObject")); @@ -819,7 +819,7 @@ void JNICALL ScriptMethodsPlayerAccountNamespace::validateRenameCharacter(JNIEnv bool lastNameChangeOnly = false; static Unicode::String const delimiters(Unicode::narrowToWide(" ")); Unicode::UnicodeStringVector newNameTokens; - if (!Unicode::tokenize(newNameString, newNameTokens, &delimiters, nullptr)) + if (!Unicode::tokenize(newNameString, newNameTokens, &delimiters, NULL)) newNameTokens.clear(); size_t const newNameTokensCount = newNameTokens.size(); @@ -846,7 +846,7 @@ void JNICALL ScriptMethodsPlayerAccountNamespace::validateRenameCharacter(JNIEnv { Unicode::String const uniqueRandomName = NameManager::getInstance().generateUniqueRandomName(ConfigServerGame::getCharacterNameGeneratorDirectory(), creatureTemplate->getNameGeneratorType()); Unicode::UnicodeStringVector uniqueRandomNameTokens; - if (!Unicode::tokenize(uniqueRandomName, uniqueRandomNameTokens, &delimiters, nullptr)) + if (!Unicode::tokenize(uniqueRandomName, uniqueRandomNameTokens, &delimiters, NULL)) uniqueRandomNameTokens.clear(); newNameString = ((uniqueRandomNameTokens.size() >= 1) ? uniqueRandomNameTokens[0] : delimiters) + delimiters + newNameTokens[1]; @@ -861,7 +861,7 @@ void JNICALL ScriptMethodsPlayerAccountNamespace::validateRenameCharacter(JNIEnv params.addParam("@ui:name_declined_racially_inappropriate", "reason"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != nullptr) + if (dictionary.get() != NULL) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(creatureObject->getNetworkId(), "renameCharacterNameValidationFail", dictionary->getSerializedData(), 0, false); @@ -879,7 +879,7 @@ void JNICALL ScriptMethodsPlayerAccountNamespace::validateRenameCharacter(JNIEnv params.addParam(errorText.c_str(), "reason"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != nullptr) + if (dictionary.get() != NULL) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(creatureObject->getNetworkId(), "renameCharacterNameValidationFail", dictionary->getSerializedData(), 0, false); @@ -906,7 +906,7 @@ void JNICALL ScriptMethodsPlayerAccountNamespace::validateRenameCharacter(JNIEnv */ void JNICALL ScriptMethodsPlayerAccountNamespace::renameCharacterReleaseNameReservation(JNIEnv *env, jobject self, jlong player) { - CreatureObject const * creatureObject = nullptr; + CreatureObject const * creatureObject = NULL; if (!JavaLibrary::getObject(player, creatureObject) || !creatureObject) { DEBUG_WARNING(true, ("JavaLibrary::renameCharacterReleaseNameReservation: bad CreatureObject")); @@ -929,7 +929,7 @@ void JNICALL ScriptMethodsPlayerAccountNamespace::renameCharacterReleaseNameRese */ void JNICALL ScriptMethodsPlayerAccountNamespace::renameCharacter(JNIEnv *env, jobject self, jlong player, jstring newName) { - CreatureObject const * creatureObject = nullptr; + CreatureObject const * creatureObject = NULL; if (!JavaLibrary::getObject(player, creatureObject) || !creatureObject) { DEBUG_WARNING(true, ("JavaLibrary::renameCharacter: bad CreatureObject")); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsPlayerQuest.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsPlayerQuest.cpp index e72745fe..2e523419 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsPlayerQuest.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsPlayerQuest.cpp @@ -159,7 +159,7 @@ jboolean ScriptMethodsPlayerQuestNamespace::addPlayerQuestTask(JNIEnv * env, job std::string sceneId; if (!ScriptConversion::convertWorld(waypointLocation, waypointVec, sceneId)) { - // nullptr or Invalid Location passed in. That's fine, just means no waypoint. + // NULL or Invalid Location passed in. That's fine, just means no waypoint. if(questObject) { std::string titleString; @@ -456,7 +456,7 @@ jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestWaypoint(JNIEnv * env, if(!JavaLibrary::getObject(quest, questObject)) { WARNING(true, ("getPlayerQuestWaypoint: Could not get valid Player Quest Object from OID: %d", quest)); - return nullptr; + return NULL; } if(questObject) @@ -465,7 +465,7 @@ jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestWaypoint(JNIEnv * env, return jString.getReturnValue(); } - return nullptr; + return NULL; } @@ -520,7 +520,7 @@ jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestTitle(JNIEnv * env, job if(!JavaLibrary::getObject(quest, questObject)) { WARNING(true, ("getPlayerQuestTitle: Could not get valid Player Quest Object from OID: %d", quest)); - return nullptr; + return NULL; } if(questObject) @@ -529,7 +529,7 @@ jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestTitle(JNIEnv * env, job return returnVal.getReturnValue(); } - return nullptr; + return NULL; } jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestDescription(JNIEnv * env, jobject self, jlong quest) @@ -541,7 +541,7 @@ jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestDescription(JNIEnv * en if(!JavaLibrary::getObject(quest, questObject)) { WARNING(true, ("getPlayerQuestDescription: Could not get valid Player Quest Object from OID: %d", quest)); - return nullptr; + return NULL; } if(questObject) @@ -550,7 +550,7 @@ jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestDescription(JNIEnv * en return returnVal.getReturnValue(); } - return nullptr; + return NULL; } jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestTaskTitle(JNIEnv * env, jobject self, jlong quest, jint index) @@ -562,7 +562,7 @@ jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestTaskTitle(JNIEnv * env, if(!JavaLibrary::getObject(quest, questObject)) { WARNING(true, ("getPlayerQuestTaskTitle: Could not get valid Player Quest Object from OID: %d", quest)); - return nullptr; + return NULL; } if(questObject) @@ -571,7 +571,7 @@ jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestTaskTitle(JNIEnv * env, return returnVal.getReturnValue(); } - return nullptr; + return NULL; } jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestTaskDescription(JNIEnv * env, jobject self, jlong quest, jint index) @@ -583,7 +583,7 @@ jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestTaskDescription(JNIEnv if(!JavaLibrary::getObject(quest, questObject)) { WARNING(true, ("getPlayerQuestTaskDescription: Could not get valid Player Quest Object from OID: %d", quest)); - return nullptr; + return NULL; } if(questObject) @@ -592,7 +592,7 @@ jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestTaskDescription(JNIEnv return returnVal.getReturnValue(); } - return nullptr; + return NULL; } void ScriptMethodsPlayerQuestNamespace::setPlayerQuestRecipe(JNIEnv * env, jobject self, jlong quest, jboolean recipe) @@ -768,21 +768,21 @@ void ScriptMethodsPlayerQuestNamespace::openPlayerQuestRecipe(JNIEnv * env, jobj UNREF(env); UNREF(self); - CreatureObject * playerCreature = nullptr; + CreatureObject * playerCreature = NULL; if (!JavaLibrary::getObject(player, playerCreature)) { DEBUG_WARNING(true, ("openPlayerQuestRecipe: Failed to get valid creature object with OID %d", player)); return; } - ServerObject * recipeObj = nullptr; + ServerObject * recipeObj = NULL; if (!JavaLibrary::getObject(recipe, recipeObj)) { DEBUG_WARNING(true, ("openPlayerQuestRecipe: Failed to get valid recipe object with OID %d", player)); return; } - if (playerCreature->isPlayerControlled() && playerCreature->getController() != nullptr) + if (playerCreature->isPlayerControlled() && playerCreature->getController() != NULL) { playerCreature->getController()->appendMessage( static_cast(CM_openRecipe), @@ -801,7 +801,7 @@ void ScriptMethodsPlayerQuestNamespace::resetAllPlayerQuestData(JNIEnv * env, jo UNREF(env); UNREF(self); - PlayerQuestObject * playerQuest = nullptr; + PlayerQuestObject * playerQuest = NULL; if (!JavaLibrary::getObject(quest, playerQuest)) { DEBUG_WARNING(true, ("resetAllPlayerQuestData: Failed to get valid recipe object with OID %d", quest)); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsPvp.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsPvp.cpp index 75b7f1ec..b27444e7 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsPvp.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsPvp.cpp @@ -43,7 +43,7 @@ namespace ScriptMethodsPvpNamespace const char * makeCopyOfString(const char * rhs) { - char * lhs = nullptr; + char * lhs = NULL; if (rhs) { lhs = new char[strlen(rhs) + 1]; @@ -668,7 +668,7 @@ jobjectArray JNICALL ScriptMethodsPvpNamespace::pvpGetEnemyFlags(JNIEnv *env, jo if (ScriptConversion::convert(enemyStrings, strArray)) return strArray->getReturnValue(); } - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -749,7 +749,7 @@ jboolean JNICALL ScriptMethodsPvpNamespace::pvpHasBattlefieldEnemyFlag(JNIEnv *e * @param actor The actor for the enemy check * @param from The center of the range * @param range The distance to query. - * @return nullptr if there is an error, or an array of enemy objects which are in range. + * @return null if there is an error, or an array of enemy objects which are in range. */ jlongArray JNICALL ScriptMethodsPvpNamespace::pvpGetEnemiesInRange(JNIEnv *env, jobject self, jlong actor, jlong location, jfloat range) { @@ -799,7 +799,7 @@ jlongArray JNICALL ScriptMethodsPvpNamespace::pvpGetEnemiesInRange(JNIEnv *env, * @param angle The cone angle, in degrees, that the cone sweeps out. The * total cone angle is twice this angle; therefore, this angle * represents the angle swept out to each side of the cone axis. - * @return nullptr if there is an error, or an array of enemy objects which are in range. + * @return null if there is an error, or an array of enemy objects which are in range. */ jlongArray JNICALL ScriptMethodsPvpNamespace::pvpGetEnemiesInCone(JNIEnv *env, jobject self, jlong actor, jlong coneCenterObjectId, jlong coneDirectionObjectId, jfloat range, jfloat angle) { @@ -853,7 +853,7 @@ jlongArray JNICALL ScriptMethodsPvpNamespace::pvpGetEnemiesInCone(JNIEnv *env, j * @param angle The cone angle, in degrees, that the cone sweeps out. The * total cone angle is twice this angle; therefore, this angle * represents the angle swept out to each side of the cone axis. - * @return nullptr if there is an error, or an array of enemy objects which are in range. + * @return null if there is an error, or an array of enemy objects which are in range. */ jlongArray JNICALL ScriptMethodsPvpNamespace::pvpGetEnemiesInConeLocation(JNIEnv *env, jobject self, jlong actor, jlong coneCenterObjectId, jobject coneDirectionLocation, jfloat range, jfloat angle) { @@ -900,7 +900,7 @@ jlongArray JNICALL ScriptMethodsPvpNamespace::pvpGetEnemiesInConeLocation(JNIEnv * @param actor The actor for the canAttack check * @param from The center of the range * @param range The distance to query. - * @return nullptr if there is an error, or an array of attackable objects which are in range. + * @return null if there is an error, or an array of attackable objects which are in range. */ jlongArray JNICALL ScriptMethodsPvpNamespace::pvpGetTargetsInRange(JNIEnv *env, jobject self, jlong actor, jlong location, jfloat range) { @@ -951,7 +951,7 @@ jlongArray JNICALL ScriptMethodsPvpNamespace::pvpGetTargetsInRange(JNIEnv *env, * @param angle The cone angle, in degrees, that the cone sweeps out. The * total cone angle is twice this angle; therefore, this angle * represents the angle swept out to each side of the cone axis. - * @return nullptr if there is an error, or an array of attackable objects which are in range. + * @return null if there is an error, or an array of attackable objects which are in range. */ jlongArray JNICALL ScriptMethodsPvpNamespace::pvpGetTargetsInCone(JNIEnv *env, jobject self, jlong actor, jlong coneCenterObjectId, jlong coneDirectionObjectId, jfloat range, jfloat angle) { @@ -1005,7 +1005,7 @@ jlongArray JNICALL ScriptMethodsPvpNamespace::pvpGetTargetsInCone(JNIEnv *env, j * @param angle The cone angle, in degrees, that the cone sweeps out. The * total cone angle is twice this angle; therefore, this angle * represents the angle swept out to each side of the cone axis. - * @return nullptr if there is an error, or an array of attackable objects which are in range. + * @return null if there is an error, or an array of attackable objects which are in range. */ jlongArray JNICALL ScriptMethodsPvpNamespace::pvpGetTargetsInConeLocation(JNIEnv *env, jobject self, jlong actor, jlong coneCenterObjectId, jobject coneDirectionLocation, jfloat range, jfloat angle) { diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsQuest.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsQuest.cpp index ea237c93..43d65ff7 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsQuest.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsQuest.cpp @@ -35,7 +35,7 @@ namespace ScriptMethodsQuestNamespace { PlayerObject * getPlayerForCharacter(jlong playerCreatureId) { - CreatureObject * playerCreature = nullptr; + CreatureObject * playerCreature = NULL; if (JavaLibrary::getObject(playerCreatureId, playerCreature)) { return PlayerCreatureController::getPlayerObject(playerCreature); @@ -44,7 +44,7 @@ namespace ScriptMethodsQuestNamespace { NetworkId id(playerCreatureId); JAVA_THROW_SCRIPT_EXCEPTION(true, ("Requested player %s, who could not be found.", id.getValueString().c_str())); - return nullptr; + return NULL; } } @@ -397,8 +397,8 @@ void JNICALL ScriptMethodsQuestNamespace::questSetQuestTaskCounter(JNIEnv *env, } PlayerObject * const playerObject = getPlayerForCharacter(playerId); - CreatureObject * const creatureObject = playerObject ? playerObject->getCreatureObject() : nullptr; - Controller * const controller = creatureObject ? creatureObject->getController() : nullptr; + CreatureObject * const creatureObject = playerObject ? playerObject->getCreatureObject() : NULL; + Controller * const controller = creatureObject ? creatureObject->getController() : NULL; if(!controller) return; @@ -427,8 +427,8 @@ void JNICALL ScriptMethodsQuestNamespace::questSetQuestTaskLocation(JNIEnv *env, } PlayerObject * const playerObject = getPlayerForCharacter(playerId); - CreatureObject * const creatureObject = playerObject ? playerObject->getCreatureObject() : nullptr; - Controller * const controller = creatureObject ? creatureObject->getController() : nullptr; + CreatureObject * const creatureObject = playerObject ? playerObject->getCreatureObject() : NULL; + Controller * const controller = creatureObject ? creatureObject->getController() : NULL; if(!controller) return; @@ -456,8 +456,8 @@ void JNICALL ScriptMethodsQuestNamespace::questSetQuestTaskTimer(JNIEnv *env, jo } PlayerObject * const playerObject = getPlayerForCharacter(playerId); - CreatureObject * const creatureObject = playerObject ? playerObject->getCreatureObject() : nullptr; - Controller * const controller = creatureObject ? creatureObject->getController() : nullptr; + CreatureObject * const creatureObject = playerObject ? playerObject->getCreatureObject() : NULL; + Controller * const controller = creatureObject ? creatureObject->getController() : NULL; if(!controller) return; @@ -487,7 +487,7 @@ void JNICALL ScriptMethodsQuestNamespace::requestActivateQuest(JNIEnv * env, job return; } - CreatureObject * playerCreature = nullptr; + CreatureObject * playerCreature = NULL; if (JavaLibrary::getObject(playerId, playerCreature) && playerCreature) { Quest const * const q = QuestManager::getQuest(questCrc); @@ -557,7 +557,7 @@ void JNICALL ScriptMethodsQuestNamespace::requestCompleteQuest(JNIEnv * env, job return; } - CreatureObject * playerCreature = nullptr; + CreatureObject * playerCreature = NULL; if (JavaLibrary::getObject(playerId, playerCreature) && playerCreature) { Quest const * const q = QuestManager::getQuest(questCrc); @@ -576,14 +576,14 @@ void JNICALL ScriptMethodsQuestNamespace::showCyberneticsPage(JNIEnv *env, jobje { MessageQueueCyberneticsOpen::OpenType const type = static_cast(openType); - CreatureObject * npc = nullptr; + CreatureObject * npc = NULL; if (!JavaLibrary::getObject(npcId, npc)) return; if(!npc) return; - CreatureObject * playerCreature = nullptr; + CreatureObject * playerCreature = NULL; if (JavaLibrary::getObject(playerId, playerCreature)) { Controller * const playerController = playerCreature->getController(); @@ -659,7 +659,7 @@ void JNICALL ScriptMethodsQuestNamespace::sendStaticItemDataToPlayer(JNIEnv *env } //send to player - CreatureObject * playerCreature = nullptr; + CreatureObject * playerCreature = NULL; if (JavaLibrary::getObject(playerId, playerCreature)) { Controller * const playerController = playerCreature->getController(); @@ -683,7 +683,7 @@ void JNICALL ScriptMethodsQuestNamespace::showLootBox(JNIEnv *env, jobject self, return; //send to player - CreatureObject * playerCreature = nullptr; + CreatureObject * playerCreature = NULL; if (JavaLibrary::getObject(playerId, playerCreature)) { Controller * const playerController = playerCreature->getController(); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsRegion.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsRegion.cpp index d028ee48..9a393578 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsRegion.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsRegion.cpp @@ -115,7 +115,7 @@ LocalObjectArrayRefPtr ScriptMethodsRegionNamespace::_getRegionsAtPoint(jobject std::vector result; RegionMaster::getRegionsAtPoint(sceneId, locationVec.x, locationVec.z, result); - //-- return nullptr instead of a zero-length array + //-- return null instead of a zero-length array if (result.empty ()) return LocalObjectArrayRef::cms_nullPtr; @@ -127,7 +127,7 @@ LocalObjectArrayRefPtr ScriptMethodsRegionNamespace::_getRegionsAtPoint(jobject { LocalRefPtr javaRegion; const Region * r = *it; - if (r != nullptr) + if (r != NULL) { if (!ScriptConversion::convert(*r, javaRegion)) return LocalObjectArrayRef::cms_nullPtr; @@ -195,7 +195,7 @@ void JNICALL ScriptMethodsRegionNamespace::createCircleRegion(JNIEnv *env, jobje UNREF(self); // validate scripter's input - if (center == nullptr || radius <= 0 || name == 0) + if (center == NULL || radius <= 0 || name == 0) return; JavaStringParam jname(name); @@ -239,7 +239,7 @@ jobject JNICALL ScriptMethodsRegionNamespace::getRegion(JNIEnv *env, jobject sel return 0; const Region * r = RegionMaster::getRegionByName(planetName, regionName); - if (r == nullptr) + if (r == NULL) return 0; LocalRefPtr jr; @@ -255,7 +255,7 @@ jobject JNICALL ScriptMethodsRegionNamespace::getRegion(JNIEnv *env, jobject sel jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsAtPoint(JNIEnv *env, jobject self, jobject location) { LocalObjectArrayRefPtr regions = _getRegionsAtPoint(location); - if (regions.get() == nullptr) + if (regions.get() == NULL) return 0; return regions->getReturnValue(); } @@ -279,9 +279,9 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegions(JNIEnv *env, jobje std::vector result; RegionMaster::getRegionsForPlanet(sceneId, result); - //-- return nullptr instead of a zero-length array + //-- return null instead of a zero-length array if (result.empty ()) - return nullptr; + return NULL; //put them into the jobjectarray LocalObjectArrayRefPtr regions = createNewObjectArray(result.size(), JavaLibrary::getClsRegion()); @@ -291,11 +291,11 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegions(JNIEnv *env, jobje { LocalRefPtr javaRegion; const Region * r = *i; - if (r != nullptr) + if (r != NULL) { if (!ScriptConversion::convert(*r, javaRegion)) { - return nullptr; + return NULL; } } setObjectArrayElement(*regions, index, *javaRegion); @@ -329,7 +329,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithPvP(JNIEnv *env goodRegions.push_back(*i); } - //-- return nullptr instead of a zero-length array + //-- return null instead of a zero-length array if (goodRegions.empty()) return 0; @@ -342,7 +342,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithPvP(JNIEnv *env LocalRefPtr javaRegion; if (!ScriptConversion::convert(**it, javaRegion)) { - return nullptr; + return NULL; } setObjectArrayElement(*result, index, *javaRegion); } @@ -375,7 +375,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithBuildable(JNIEn goodRegions.push_back(*i); } - //-- return nullptr instead of a zero-length array + //-- return null instead of a zero-length array if (goodRegions.empty()) return 0; @@ -388,7 +388,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithBuildable(JNIEn LocalRefPtr javaRegion; if (!ScriptConversion::convert(**it, javaRegion)) { - return nullptr; + return NULL; } setObjectArrayElement(*result, index, *javaRegion); } @@ -421,7 +421,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithMunicipal(JNIEn goodRegions.push_back(*i); } - //-- return nullptr instead of a zero-length array + //-- return null instead of a zero-length array if (goodRegions.empty()) return 0; @@ -434,7 +434,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithMunicipal(JNIEn LocalRefPtr javaRegion; if (!ScriptConversion::convert(**it, javaRegion)) { - return nullptr; + return NULL; } setObjectArrayElement(*result, index, *javaRegion); } @@ -467,7 +467,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithGeographical(JN goodRegions.push_back(*i); } - //-- return nullptr instead of a zero-length array + //-- return null instead of a zero-length array if (goodRegions.empty()) return 0; @@ -480,7 +480,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithGeographical(JN LocalRefPtr javaRegion; if (!ScriptConversion::convert(**it, javaRegion)) { - return nullptr; + return NULL; } setObjectArrayElement(*result, index, *javaRegion); } @@ -513,7 +513,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithDifficulty(JNIE goodRegions.push_back(*i); } - //-- return nullptr instead of a zero-length array + //-- return null instead of a zero-length array if (goodRegions.empty()) return 0; @@ -526,7 +526,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithDifficulty(JNIE LocalRefPtr javaRegion; if (!ScriptConversion::convert(**it, javaRegion)) { - return nullptr; + return NULL; } setObjectArrayElement(*result, index, *javaRegion); } @@ -559,7 +559,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithSpawnable(JNIEn goodRegions.push_back(*i); } - //-- return nullptr instead of a zero-length array + //-- return null instead of a zero-length array if (goodRegions.empty()) return 0; @@ -572,7 +572,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithSpawnable(JNIEn LocalRefPtr javaRegion; if (!ScriptConversion::convert(**it, javaRegion)) { - return nullptr; + return NULL; } setObjectArrayElement(*result, index, *javaRegion); } @@ -605,7 +605,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithMission(JNIEnv goodRegions.push_back(*i); } - //-- return nullptr instead of a zero-length array + //-- return null instead of a zero-length array if (goodRegions.empty()) return 0; @@ -618,7 +618,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithMission(JNIEnv LocalRefPtr javaRegion; if (!ScriptConversion::convert(**it, javaRegion)) { - return nullptr; + return NULL; } setObjectArrayElement(*result, index, *javaRegion); } @@ -657,7 +657,7 @@ jboolean JNICALL ScriptMethodsRegionNamespace::deleteRegion(JNIEnv *env, jobject return JNI_FALSE; UniverseObject * regionObject = dynamic_cast(r->getDynamicRegionId().getObject()); - if (regionObject == nullptr) + if (regionObject == NULL) return JNI_FALSE; regionObject->permanentlyDestroy(DeleteReasons::Script); return JNI_TRUE; @@ -711,7 +711,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionExtent(JNIEnv *env, //----------------------------------------------------------------------- /** Find a random point in the given region - * @return a script.location inside the region, or a nullptr reference if any problems occur + * @return a script.location inside the region, or a null reference if any problems occur */ jobject JNICALL ScriptMethodsRegionNamespace::findPointInRegion(JNIEnv *env, jobject self, jobject region) { @@ -732,7 +732,7 @@ jobject JNICALL ScriptMethodsRegionNamespace::findPointInRegion(JNIEnv *env, job Vector loc3d(x, 0, z); LocalRefPtr location; if (!ScriptConversion::convert(loc3d, r->getPlanet(), NetworkId::cms_invalid, location)) - return nullptr; + return NULL; return location->getReturnValue(); } @@ -744,7 +744,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithPvPAtPoint(JNIE { //get all the regions at the given point LocalObjectArrayRefPtr regionsAtPoint = _getRegionsAtPoint(location); - if (regionsAtPoint.get() == nullptr || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) + if (regionsAtPoint.get() == NULL || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) return 0; //parse out the ones with the right property @@ -760,9 +760,9 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithPvPAtPoint(JNIE result.push_back(r); } - //-- return nullptr instead of a zero-length array + //-- return null instead of a zero-length array if (result.empty ()) - return nullptr; + return NULL; //put them into the jobjectarray LocalObjectArrayRefPtr regions = createNewObjectArray(result.size(), JavaLibrary::getClsRegion()); @@ -772,10 +772,10 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithPvPAtPoint(JNIE { LocalRefPtr javaRegion; const Region * r = *it; - if (r != nullptr) + if (r != NULL) { if (!ScriptConversion::convert(*r, javaRegion)) - return nullptr; + return NULL; } setObjectArrayElement(*regions, index, *javaRegion); } @@ -790,7 +790,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithBuildableAtPoin { //get all the regions at the given point LocalObjectArrayRefPtr regionsAtPoint = _getRegionsAtPoint(location); - if (regionsAtPoint.get() == nullptr || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) + if (regionsAtPoint.get() == NULL || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) return 0; //parse out the ones with the right property @@ -806,9 +806,9 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithBuildableAtPoin result.push_back(r); } - //-- return nullptr instead of a zero-length array + //-- return null instead of a zero-length array if (result.empty ()) - return nullptr; + return NULL; //put them into the jobjectarray LocalObjectArrayRefPtr regions = createNewObjectArray(result.size(), JavaLibrary::getClsRegion()); @@ -818,10 +818,10 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithBuildableAtPoin { LocalRefPtr javaRegion; const Region * r = *it; - if (r != nullptr) + if (r != NULL) { if(!ScriptConversion::convert(*r, javaRegion)) - return nullptr; + return NULL; } setObjectArrayElement(*regions, index, *javaRegion); } @@ -837,7 +837,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithMunicipalAtPoin PROFILER_AUTO_BLOCK_DEFINE("JNI::getRegionsWithMunicipalAtPoint"); //get all the regions at the given point LocalObjectArrayRefPtr regionsAtPoint = _getRegionsAtPoint(location); - if (regionsAtPoint.get() == nullptr || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) + if (regionsAtPoint.get() == NULL || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) return 0; //parse out the ones with the right property @@ -853,9 +853,9 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithMunicipalAtPoin result.push_back(r); } - //-- return nullptr instead of a zero-length array + //-- return null instead of a zero-length array if (result.empty ()) - return nullptr; + return NULL; //put them into the jobjectarray LocalObjectArrayRefPtr regions = createNewObjectArray(result.size(), JavaLibrary::getClsRegion()); @@ -865,10 +865,10 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithMunicipalAtPoin { LocalRefPtr javaRegion; const Region * r = *it; - if (r != nullptr) + if (r != NULL) { if(!ScriptConversion::convert(*r, javaRegion)) - return nullptr; + return NULL; } setObjectArrayElement(*regions, index, *javaRegion); } @@ -884,7 +884,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithGeographicalAtP PROFILER_AUTO_BLOCK_DEFINE("JNI::getRegionsWithGeographicalAtPoint"); //get all the regions at the given point LocalObjectArrayRefPtr regionsAtPoint = _getRegionsAtPoint(location); - if (regionsAtPoint.get() == nullptr || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) + if (regionsAtPoint.get() == NULL || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) return 0; //parse out the ones with the right property @@ -900,9 +900,9 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithGeographicalAtP result.push_back(r); } - //-- return nullptr instead of a zero-length array + //-- return null instead of a zero-length array if (result.empty ()) - return nullptr; + return NULL; //put them into the jobjectarray LocalObjectArrayRefPtr regions = createNewObjectArray(result.size(), JavaLibrary::getClsRegion()); @@ -912,10 +912,10 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithGeographicalAtP { LocalRefPtr javaRegion; const Region * r = *it; - if (r != nullptr) + if (r != NULL) { if(!ScriptConversion::convert(*r, javaRegion)) - return nullptr; + return NULL; } setObjectArrayElement(*regions, index, *javaRegion); } @@ -930,7 +930,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithDifficultyAtPoi { //get all the regions at the given point LocalObjectArrayRefPtr regionsAtPoint = _getRegionsAtPoint(location); - if (regionsAtPoint.get() == nullptr || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) + if (regionsAtPoint.get() == NULL || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) return 0; //parse out the ones with the right property @@ -946,9 +946,9 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithDifficultyAtPoi result.push_back(r); } - //-- return nullptr instead of a zero-length array + //-- return null instead of a zero-length array if (result.empty ()) - return nullptr; + return NULL; //put them into the jobjectarray LocalObjectArrayRefPtr regions = createNewObjectArray(result.size(), JavaLibrary::getClsRegion()); @@ -958,10 +958,10 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithDifficultyAtPoi { LocalRefPtr javaRegion; const Region * r = *it; - if (r != nullptr) + if (r != NULL) { if(!ScriptConversion::convert(*r, javaRegion)) - return nullptr; + return NULL; } setObjectArrayElement(*regions, index, *javaRegion); } @@ -976,7 +976,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithSpawnableAtPoin { //get all the regions at the given point LocalObjectArrayRefPtr regionsAtPoint = _getRegionsAtPoint(location); - if (regionsAtPoint.get() == nullptr || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) + if (regionsAtPoint.get() == NULL || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) return 0; //parse out the ones with the right property @@ -992,9 +992,9 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithSpawnableAtPoin result.push_back(r); } - //-- return nullptr instead of a zero-length array + //-- return null instead of a zero-length array if (result.empty ()) - return nullptr; + return NULL; //put them into the jobjectarray LocalObjectArrayRefPtr regions = createNewObjectArray(result.size(), JavaLibrary::getClsRegion()); @@ -1004,10 +1004,10 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithSpawnableAtPoin { LocalRefPtr javaRegion; const Region * r = *it; - if (r != nullptr) + if (r != NULL) { if(!ScriptConversion::convert(*r, javaRegion)) - return nullptr; + return NULL; } setObjectArrayElement(*regions, index, *javaRegion); } @@ -1022,7 +1022,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithMissionAtPoint( { //get all the regions at the given point LocalObjectArrayRefPtr regionsAtPoint = _getRegionsAtPoint(location); - if (regionsAtPoint.get() == nullptr || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) + if (regionsAtPoint.get() == NULL || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) return 0; //parse out the ones with the right property @@ -1038,9 +1038,9 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithMissionAtPoint( result.push_back(r); } - //-- return nullptr instead of a zero-length array + //-- return null instead of a zero-length array if (result.empty ()) - return nullptr; + return NULL; //put them into the jobjectarray LocalObjectArrayRefPtr regions = createNewObjectArray(result.size(), JavaLibrary::getClsRegion()); @@ -1050,10 +1050,10 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithMissionAtPoint( { LocalRefPtr javaRegion; const Region * r = *it; - if (r != nullptr) + if (r != NULL) { if(!ScriptConversion::convert(*r, javaRegion)) - return nullptr; + return NULL; } setObjectArrayElement(*regions, index, *javaRegion); } @@ -1072,16 +1072,16 @@ jobject JNICALL ScriptMethodsRegionNamespace::getSmallestRegionAtPoint(JNIEnv *e Vector locationVec; std::string sceneId; if(!ScriptConversion::convertWorld(location, locationVec, sceneId)) - return nullptr; + return NULL; const Region * r = RegionMaster::getSmallestRegionAtPoint(sceneId, locationVec.x, locationVec.z); - if (r == nullptr) - return nullptr; + if (r == NULL) + return NULL; LocalRefPtr region; if (!ScriptConversion::convert(*r, region)) - return nullptr; + return NULL; return region->getReturnValue(); } @@ -1095,16 +1095,16 @@ jobject JNICALL ScriptMethodsRegionNamespace::getSmallestVisibleRegionAtPoint(JN Vector locationVec; std::string sceneId; if(!ScriptConversion::convertWorld(location, locationVec, sceneId)) - return nullptr; + return NULL; const Region * r = RegionMaster::getSmallestVisibleRegionAtPoint(sceneId, locationVec.x, locationVec.z); - if (r == nullptr) - return nullptr; + if (r == NULL) + return NULL; LocalRefPtr region; if (!ScriptConversion::convert(*r, region)) - return nullptr; + return NULL; return region->getReturnValue(); } @@ -1140,7 +1140,7 @@ jlong JNICALL ScriptMethodsRegionNamespace::createCircleRegionWithSpawn(JNIEnv * UNREF(self); // validate scripter's input - if (center == nullptr || radius <= 0 || name == 0) + if (center == NULL || radius <= 0 || name == 0) return 0; JavaStringParam jname(name); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsRegion3d.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsRegion3d.cpp index 6e209336..37c9f942 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsRegion3d.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsRegion3d.cpp @@ -87,7 +87,7 @@ struct Region3dPtrVolumeComparator ScriptParams *ScriptMethodsRegion3dNamespace::convertRegionDictionaryToScriptParams(jobject regionDictionary) { - // If we're passed a nullptr dictionary, we just don't have any extra data but + // If we're passed a null dictionary, we just don't have any extra data but // we still want to return a ScriptParams to fill in the standard values. if (!regionDictionary) return new ScriptParams; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsResource.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsResource.cpp index 04404908..e908612c 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsResource.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsResource.cpp @@ -459,7 +459,7 @@ jstring JNICALL ScriptMethodsResourceNamespace::getResourceContainerForType(JNIE { ResourceTypeObject const * const typeObj = ServerUniverse::getInstance().getResourceTypeById(NetworkId(resourceType)); if (!typeObj) - return nullptr; + return NULL; std::string templateName; typeObj->getCrateTemplate(templateName); @@ -473,7 +473,7 @@ jstring JNICALL ScriptMethodsResourceNamespace::getResourceName(JNIEnv * /*env*/ { if (resourceType == 0) { - WARNING(true, ("JavaLibrary::getResourceName passed nullptr resource type")); + WARNING(true, ("JavaLibrary::getResourceName passed null resource type")); return 0; } @@ -494,7 +494,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::getResourceNames(JNIEnv *en { if (resourceTypes == 0) { - WARNING(true, ("JavaLibrary::getResourceNames passed nullptr resource types")); + WARNING(true, ("JavaLibrary::getResourceNames passed null resource types")); return 0; } @@ -517,7 +517,7 @@ jstring JNICALL ScriptMethodsResourceNamespace::getResourceClassName(JNIEnv *env { if (resourceClass == 0) { - WARNING(true, ("JavaLibrary::getResourceClassName passed nullptr resource class")); + WARNING(true, ("JavaLibrary::getResourceClassName passed null resource class")); return 0; } @@ -531,7 +531,7 @@ jstring JNICALL ScriptMethodsResourceNamespace::getResourceClassName(JNIEnv *env const ServerResourceClassObject * resClass = safe_cast( ServerUniverse::getInstance().getResourceClassByName(resourceClassName)); - if (resClass == nullptr) + if (resClass == NULL) { WARNING(true, ("JavaLibrary::getResourceClassName cannot find resource class for %s", resourceClassName.c_str())); return 0; @@ -547,7 +547,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::getResourceClassNames(JNIEn { if (resourceClasses == 0) { - WARNING(true, ("JavaLibrary::getResourceClassNames passed nullptr resource classes")); + WARNING(true, ("JavaLibrary::getResourceClassNames passed null resource classes")); return 0; } @@ -569,7 +569,7 @@ jlongArray JNICALL ScriptMethodsResourceNamespace::getResourceTypes(JNIEnv * env { if (resourceClass == 0) { - WARNING(true, ("JavaLibrary::getResourceTypes passed nullptr resource class")); + WARNING(true, ("JavaLibrary::getResourceTypes passed null resource class")); return 0; } @@ -583,7 +583,7 @@ jlongArray JNICALL ScriptMethodsResourceNamespace::getResourceTypes(JNIEnv * env const ServerResourceClassObject * resClass = safe_cast( ServerUniverse::getInstance().getResourceClassByName(resourceClassName)); - if (resClass == nullptr) + if (resClass == NULL) { WARNING(true, ("JavaLibrary::getResourceTypes cannot find resource class for %s", resourceClassName.c_str())); return 0; @@ -604,7 +604,7 @@ jlongArray JNICALL ScriptMethodsResourceNamespace::getResourceTypes(JNIEnv * env jlong jlongTmp; for (size_t i = 0; i < count; ++i) { - if (types[i] != nullptr) + if (types[i] != NULL) { jlongTmp = (types[i]->getNetworkId()).getValue(); setLongArrayRegion(*jtypes, i, 1, &jlongTmp); @@ -619,7 +619,7 @@ jstring JNICALL ScriptMethodsResourceNamespace::getResourceClass(JNIEnv * /*env* { if (resourceType == 0) { - WARNING(true, ("JavaLibrary::getResourceClass passed nullptr resource type")); + WARNING(true, ("JavaLibrary::getResourceClass passed null resource type")); return 0; } @@ -642,7 +642,7 @@ jstring JNICALL ScriptMethodsResourceNamespace::getResourceParentClass(JNIEnv * { if (resourceClass == 0) { - WARNING(true, ("JavaLibrary::getResourceParentClass passed nullptr resource class")); + WARNING(true, ("JavaLibrary::getResourceParentClass passed null resource class")); return 0; } @@ -655,14 +655,14 @@ jstring JNICALL ScriptMethodsResourceNamespace::getResourceParentClass(JNIEnv * } const ResourceClassObject * resClass = ServerUniverse::getInstance().getResourceClassByName(resourceClassName); - if (resClass == nullptr) + if (resClass == NULL) { WARNING(true, ("JavaLibrary::getResourceParentClass cannot find resource class for %s", resourceClassName.c_str())); return 0; } const ResourceClassObject * parentClass = resClass->getParent(); - if (parentClass == nullptr) + if (parentClass == NULL) return 0; JavaString parentClassName(parentClass->getResourceClassName()); @@ -675,7 +675,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::getResourceChildClasses(JNI { if (resourceClass == 0) { - WARNING(true, ("JavaLibrary::getResourceChildClasses passed nullptr resource class")); + WARNING(true, ("JavaLibrary::getResourceChildClasses passed null resource class")); return 0; } @@ -688,7 +688,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::getResourceChildClasses(JNI } const ResourceClassObject * resClass = ServerUniverse::getInstance().getResourceClassByName(resourceClassName); - if (resClass == nullptr) + if (resClass == NULL) { WARNING(true, ("JavaLibrary::getResourceChildClasses cannot find resource class for %s", resourceClassName.c_str())); return 0; @@ -701,7 +701,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::getResourceChildClasses(JNI LocalObjectArrayRefPtr childrenArray = createNewObjectArray(static_cast(count), JavaLibrary::getClsString()); for (size_t i = 0; i < count; ++i) { - if (children[i] != nullptr) + if (children[i] != NULL) { JavaString name(children[i]->getResourceClassName()); setObjectArrayElement(*childrenArray, static_cast(i), name); @@ -716,7 +716,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::getImmediateResourceChildCl { if (resourceClass == 0) { - WARNING(true, ("JavaLibrary::getImmediateResourceChildClasses passed nullptr resource class")); + WARNING(true, ("JavaLibrary::getImmediateResourceChildClasses passed null resource class")); return 0; } @@ -729,7 +729,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::getImmediateResourceChildCl } const ResourceClassObject * resClass = ServerUniverse::getInstance().getResourceClassByName(resourceClassName); - if (resClass == nullptr) + if (resClass == NULL) { WARNING(true, ("JavaLibrary::getImmediateResourceChildClasses cannot find resource class for %s", resourceClassName.c_str())); return 0; @@ -742,7 +742,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::getImmediateResourceChildCl LocalObjectArrayRefPtr childrenArray = createNewObjectArray(count, JavaLibrary::getClsString()); for (int i = 0; i < count; ++i) { - if (children[i] != nullptr) + if (children[i] != NULL) { JavaString name(children[i]->getResourceClassName()); setObjectArrayElement(*childrenArray, i, name); @@ -757,7 +757,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::getLeafResourceChildClasses { if (resourceClass == 0) { - WARNING(true, ("JavaLibrary::getLeafResourceChildClasses passed nullptr resource class")); + WARNING(true, ("JavaLibrary::getLeafResourceChildClasses passed null resource class")); return 0; } @@ -770,7 +770,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::getLeafResourceChildClasses } const ResourceClassObject * resClass = ServerUniverse::getInstance().getResourceClassByName(resourceClassName); - if (resClass == nullptr) + if (resClass == NULL) { WARNING(true, ("JavaLibrary::getLeafResourceChildClasses cannot find resource class for %s", resourceClassName.c_str())); return 0; @@ -783,7 +783,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::getLeafResourceChildClasses LocalObjectArrayRefPtr childrenArray = createNewObjectArray(count, JavaLibrary::getClsString()); for (int i = 0; i < count; ++i) { - if (children[i] != nullptr) + if (children[i] != NULL) { JavaString name(children[i]->getResourceClassName()); setObjectArrayElement(*childrenArray, i, name); @@ -798,7 +798,7 @@ jboolean JNICALL ScriptMethodsResourceNamespace::hasResourceType(JNIEnv *env, jo { if (resourceClass == 0) { - WARNING(true, ("JavaLibrary::hasResourceType passed nullptr resource class")); + WARNING(true, ("JavaLibrary::hasResourceType passed null resource class")); return JNI_FALSE; } @@ -811,7 +811,7 @@ jboolean JNICALL ScriptMethodsResourceNamespace::hasResourceType(JNIEnv *env, jo } ServerResourceClassObject const * const resClass = safe_cast(ServerUniverse::getInstance().getResourceClassByName(resourceClassName)); - if (resClass == nullptr) + if (resClass == NULL) { WARNING(true, ("JavaLibrary::hasResourceType cannot find resource class for %s", resourceClassName.c_str())); return JNI_FALSE; @@ -826,13 +826,13 @@ jlong JNICALL ScriptMethodsResourceNamespace::createResourceCrate(JNIEnv * /*env { if (resourceType == 0) { - WARNING(true, ("JavaLibrary::createResourceCrate passed nullptr resource type")); + WARNING(true, ("JavaLibrary::createResourceCrate passed null resource type")); return 0; } if (destination == 0) { - WARNING(true, ("JavaLibrary::createResourceCrate passed nullptr destination")); + WARNING(true, ("JavaLibrary::createResourceCrate passed null destination")); return 0; } @@ -849,7 +849,7 @@ jlong JNICALL ScriptMethodsResourceNamespace::createResourceCrate(JNIEnv * /*env return 0; } - ServerObject * container = nullptr; + ServerObject * container = NULL; if (!JavaLibrary::getObject(destination, container)) { WARNING(true, ("JavaLibrary::createResourceCrate cannot find destination object")); @@ -860,14 +860,14 @@ jlong JNICALL ScriptMethodsResourceNamespace::createResourceCrate(JNIEnv * /*env rt->getCrateTemplate(crateTemplateName); ServerObject * object = ServerWorld::createNewObject(crateTemplateName, *container, true); - if (object == nullptr) + if (object == NULL) { WARNING(true, ("JavaLibrary::createResourceCrate cannot create crate from template %s", crateTemplateName.c_str())); return 0; } ResourceContainerObject * crate = dynamic_cast(object); - if (crate == nullptr) + if (crate == NULL) { IGNORE_RETURN(object->permanentlyDestroy(DeleteReasons::SetupFailed)); WARNING(true, ("JavaLibrary::createResourceCrate crate %s is not a resource container", crateTemplateName.c_str())); @@ -888,13 +888,13 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::requestResourceList(JNIEnv { if (loc == 0) { - WARNING(true, ("JavaLibrary::requestResourceList passed nullptr location")); + WARNING(true, ("JavaLibrary::requestResourceList passed null location")); return 0; } if (resourceClass == 0) { - WARNING(true, ("JavaLibrary::requestResourceList passed nullptr resource class")); + WARNING(true, ("JavaLibrary::requestResourceList passed null resource class")); return 0; } @@ -921,7 +921,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::requestResourceList(JNIEnv const Vector & locationPos = location.getCoordinates(); const PlanetObject * planet = ServerUniverse::getInstance().getPlanetByName(location.getSceneId()); - if (planet == nullptr) + if (planet == NULL) { WARNING(true, ("JavaLibrary::requestResourceList cannot find planet %s", location.getSceneId())); return 0; @@ -929,7 +929,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::requestResourceList(JNIEnv // get the resource class and all its children ServerResourceClassObject const * const resClass = safe_cast(ServerUniverse::getInstance().getResourceClassByName(resourceClassName)); - if (resClass == nullptr) + if (resClass == NULL) { WARNING(true, ("JavaLibrary::requestResourceList cannot find resource class %s", resourceClassName.c_str())); return 0; @@ -951,7 +951,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::requestResourceList(JNIEnv if (!(*i)->isDepleted()) { ResourcePoolObject const * const pool = (*i)->getPoolForPlanet(*planet); - if (pool != nullptr) + if (pool != NULL) { float density = pool->getEfficiencyAtLocation(locationPos.x, locationPos.z); if (density >= minDensity && density <= maxDensity) @@ -1049,7 +1049,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::getScaledResourceAttributes return 0; } ServerResourceClassObject const * const resClass = safe_cast(ServerUniverse::getInstance().getResourceClassByName(resourceClassName)); - if (resClass == nullptr) + if (resClass == NULL) { WARNING(true, ("JavaLibrary::getScaledResourceAttributes cannot find resource class %s", resourceClassName.c_str())); return 0; @@ -1152,7 +1152,7 @@ jint JNICALL ScriptMethodsResourceNamespace::getResourceAttribute(JNIEnv * /*env if (resourceType == 0) { - WARNING(true, ("JavaLibrary::getResourceAttribute passed nullptr resource type")); + WARNING(true, ("JavaLibrary::getResourceAttribute passed null resource type")); return -1; } @@ -1171,7 +1171,7 @@ jint JNICALL ScriptMethodsResourceNamespace::getResourceAttribute(JNIEnv * /*env jlong JNICALL ScriptMethodsResourceNamespace::getRecycledVersionOfResourceType(JNIEnv * /*env*/, jobject /*self*/, jlong resourceType) { ResourceTypeObject const * const resourceTypeObject = ServerUniverse::getInstance().getResourceTypeById(NetworkId(resourceType)); - ResourceTypeObject const * const recycledTypeObject = resourceTypeObject ? resourceTypeObject->getRecycledVersion() : nullptr; + ResourceTypeObject const * const recycledTypeObject = resourceTypeObject ? resourceTypeObject->getRecycledVersion() : NULL; if (recycledTypeObject) return (recycledTypeObject->getNetworkId()).getValue(); else diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsScript.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsScript.cpp index a7e06d57..7d600707 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsScript.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsScript.cpp @@ -121,7 +121,7 @@ jint JNICALL ScriptMethodsScriptNamespace::attachScript(JNIEnv *env, jobject sel return SCRIPT_OVERRIDE; GameScriptObject* scripts = object->getScriptObject(); - if (scripts == nullptr) + if (scripts == NULL) return SCRIPT_OVERRIDE; char buffer[MAX_SCRIPT_NAME_LEN]; @@ -162,7 +162,7 @@ jboolean JNICALL ScriptMethodsScriptNamespace::detachScript(JNIEnv *env, jobject return JNI_FALSE; GameScriptObject* scripts = object->getScriptObject(); - if (scripts == nullptr) + if (scripts == NULL) return JNI_FALSE; char buffer[MAX_SCRIPT_NAME_LEN]; @@ -192,7 +192,7 @@ jboolean JNICALL ScriptMethodsScriptNamespace::detachAllScripts(JNIEnv *env, job return JNI_FALSE; GameScriptObject* scriptObject = object->getScriptObject(); - if (scriptObject == nullptr) + if (scriptObject == NULL) return JNI_FALSE; std::vector scriptNames; @@ -230,7 +230,7 @@ jboolean JNICALL ScriptMethodsScriptNamespace::hasScript(JNIEnv *env, jobject se return JNI_FALSE; GameScriptObject* scripts = object->getScriptObject(); - if (scripts == nullptr) + if (scripts == NULL) return JNI_FALSE; char buffer[MAX_SCRIPT_NAME_LEN]; @@ -325,7 +325,7 @@ jboolean JNICALL ScriptMethodsScriptNamespace::localMessageTo(JNIEnv *env, jobje else { GameScriptObject* scripts = object->getScriptObject(); - if (scripts == nullptr) + if (scripts == NULL) return JNI_FALSE; ScriptDictionaryPtr dictionary(new JavaDictionary(params)); @@ -400,7 +400,7 @@ jboolean JNICALL ScriptMethodsScriptNamespace::remoteMessageTo(JNIEnv *env, jobj * "messageTo" for players on the current planet * * If you want everyone on the planet to receive the message, -* specify nullptr for loc and -1.0f for radius; otherwise, specify +* specify null for loc and -1.0f for radius; otherwise, specify * a loc and a radius and only players on the planet within the * specified area will receive the message */ @@ -447,7 +447,7 @@ jint JNICALL ScriptMethodsScriptNamespace::remoteMessageToCalendarTimeDayOfWeek( return -1; // calculate the absolute time when the messageTo should go off - time_t const timeNow = ::time(nullptr); + time_t const timeNow = ::time(NULL); time_t const timeTarget = CalendarTime::getNextGMTTimeOcurrence(timeNow, dayOfWeek, hour, minute, second); if ((timeTarget <= 0) || (timeTarget <= timeNow)) @@ -487,7 +487,7 @@ jint JNICALL ScriptMethodsScriptNamespace::remoteMessageToCalendarTimeDayOfMonth return -1; // calculate the absolute time when the messageTo should go off - time_t const timeNow = ::time(nullptr); + time_t const timeNow = ::time(NULL); time_t const timeTarget = CalendarTime::getNextGMTTimeOcurrence(timeNow, month, dayOfMonth, hour, minute, second); if ((timeTarget <= 0) || (timeTarget <= timeNow)) @@ -562,7 +562,7 @@ void JNICALL ScriptMethodsScriptNamespace::cancelRecurringMessageTo(JNIEnv *env, // returns -1 if object doesn't have the messageTo jint JNICALL ScriptMethodsScriptNamespace::timeUntilMessageTo(JNIEnv *env, jobject self, jlong object, jstring methodName) { - ServerObject const * so = nullptr; + ServerObject const * so = NULL; if (!JavaLibrary::getObject(object, so)) return -1; @@ -606,7 +606,7 @@ jint JNICALL ScriptMethodsScriptNamespace::getCalendarTimeSeconds(JNIEnv * env, if(env == 0) return 0; - return ::time(nullptr); + return ::time(NULL); } //----------------------------------------------------------------------- @@ -616,7 +616,7 @@ jint JNICALL ScriptMethodsScriptNamespace::getCalendarTimeSeconds2(JNIEnv * env, if(env == 0) return -1; - time_t const rawtime = ::time(nullptr); + time_t const rawtime = ::time(NULL); struct tm * timeinfo = ::localtime(&rawtime); if (!timeinfo) return -1; @@ -678,7 +678,7 @@ jint JNICALL ScriptMethodsScriptNamespace::secondsUntilCalendarTimeDayOfWeek(JNI UNREF(self); // calculate the time between now and the specified time - time_t const timeNow = ::time(nullptr); + time_t const timeNow = ::time(NULL); time_t const timeTarget = CalendarTime::getNextGMTTimeOcurrence(timeNow, dayOfWeek, hour, minute, second); if ((timeTarget <= 0) || (timeTarget <= timeNow)) @@ -694,7 +694,7 @@ jint JNICALL ScriptMethodsScriptNamespace::secondsUntilCalendarTimeDayOfMonth(JN UNREF(self); // calculate the time between now and the specified time - time_t const timeNow = ::time(nullptr); + time_t const timeNow = ::time(NULL); time_t const timeTarget = CalendarTime::getNextGMTTimeOcurrence(timeNow, month, dayOfMonth, hour, minute, second); if ((timeTarget <= 0) || (timeTarget <= timeNow)) diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsServerUI.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsServerUI.cpp index c925aae3..db36bd13 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsServerUI.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsServerUI.cpp @@ -83,14 +83,14 @@ jint JNICALL ScriptMethodsServerUINamespace::createSuiPage(JNIEnv *env, jobject JavaStringParam localPageName(pageName); jint failureCode = -1; - ServerObject* owner = nullptr; + ServerObject* owner = NULL; if(!JavaLibrary::getObject(ownerobject, owner)) { WARNING(true, ("SUI: couldn't get owner ServerObject*, can't create a page")); return failureCode; } - ServerObject* so = nullptr; + ServerObject* so = NULL; if(!JavaLibrary::getObject(client, so)) return failureCode; @@ -296,7 +296,7 @@ jboolean JNICALL ScriptMethodsServerUINamespace::subscribeToSuiEvent(JNIEnv } std::string ewn; - if (eventWidgetName != nullptr) + if (eventWidgetName != NULL) { JavaStringParam localEventWidgetName(eventWidgetName); JavaLibrary::convert(localEventWidgetName, ewn); @@ -323,7 +323,7 @@ jboolean JNICALL ScriptMethodsServerUINamespace::subscribeToSuiPropertyForEv } std::string ewn; - if (eventWidgetName != nullptr) + if (eventWidgetName != NULL) { JavaStringParam localEventWidgetName(eventWidgetName); JavaLibrary::convert(localEventWidgetName, ewn); @@ -411,7 +411,7 @@ jboolean JNICALL ScriptMethodsServerUINamespace::setSuiAssociatedLocation(JN return JNI_FALSE; } - ServerObject* associatedObject = nullptr; + ServerObject* associatedObject = NULL; if(!JavaLibrary::getObject(j_associatedObjectId, associatedObject)) { DEBUG_WARNING(true, ("could not find object for associatedObjectid")); @@ -441,12 +441,12 @@ jboolean JNICALL ScriptMethodsServerUINamespace::setSuiMaxRangeToObject(JNIE jboolean JNICALL ScriptMethodsServerUINamespace::clientMinigameOpen(JNIEnv *env, jobject self, jlong player, jobject data) { - ServerObject* playerServerObject = nullptr; + ServerObject* playerServerObject = NULL; if(!JavaLibrary::getObject(player, playerServerObject)) return JNI_FALSE; CreatureObject * creatureObject = playerServerObject->asCreatureObject(); - if(creatureObject != nullptr) + if(creatureObject != NULL) { ValueDictionary gameData; JavaLibrary::convert(data, gameData); @@ -462,12 +462,12 @@ jboolean JNICALL ScriptMethodsServerUINamespace::clientMinigameOpen(JNIEnv *env, jboolean JNICALL ScriptMethodsServerUINamespace::clientMinigameClose(JNIEnv *env, jobject self, jlong player, jobject data) { - ServerObject* playerServerObject = nullptr; + ServerObject* playerServerObject = NULL; if(!JavaLibrary::getObject(player, playerServerObject)) return JNI_FALSE; CreatureObject * creatureObject = playerServerObject->asCreatureObject(); - if(creatureObject != nullptr) + if(creatureObject != NULL) { ValueDictionary gameData; JavaLibrary::convert(data, gameData); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsShip.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsShip.cpp index 4db4502b..8c40cd6c 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsShip.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsShip.cpp @@ -83,13 +83,13 @@ namespace ScriptMethodsShipNamespace { //-- Make sure ships are enabled if (!verifyShipsEnabled()) - return nullptr; + return NULL; char buf[256]; snprintf(buf, sizeof(buf), "JavaLibrary::%s: ship obj_id did not resolve to a ShipObject", functionName); ShipObject * const shipObject = JavaLibrary::getShipThrow(env, jobject_shipId, buf, throwIfNotOnServer); if (!shipObject) - return nullptr; + return NULL; if (chassisSlot != ShipChassisSlotType::SCST_num_types && !shipObject->isSlotInstalled(chassisSlot)) JAVA_THROW_SCRIPT_EXCEPTION(true, ("JavaLibrary::%s chassisSlot [%d] not installed", functionName, chassisSlot)); @@ -1115,17 +1115,17 @@ jstring JNICALL ScriptMethodsShipNamespace::getShipChassisType(JNIEnv * env, job { //-- Make sure ships are enabled if (!verifyShipsEnabled()) - return nullptr; + return NULL; ShipObject const * const shipObject = JavaLibrary::getShipThrow(env, jobject_shipId, "getShipChassisType(): shipId obj_id did not resolve to a ShipObject", false); if (!shipObject) - return nullptr; + return NULL; ShipChassis const * const shipChassis = ShipChassis::findShipChassisByCrc (shipObject->getChassisType()); if (shipChassis) return JavaString(shipChassis->getName ().getString ()).getReturnValue(); - return nullptr; + return NULL; } //---------------------------------------------------------------------- @@ -1339,7 +1339,7 @@ jstring JNICALL ScriptMethodsShipNamespace::getShipComponentName(JNIEnv * env, j { ShipObject const * const shipObject = JavaLibrary::getShipThrow(env, jobject_shipId, "getShipComponentName() invalid ship", false); if (!shipObject) - return nullptr; + return NULL; Unicode::String const & name = shipObject->getComponentName(chassisSlot); if (!name.empty()) @@ -1918,9 +1918,9 @@ void JNICALL ScriptMethodsShipNamespace::setShipComponentName(JNIEnv * env, jobj if (!shipObject) return; - if (componentName == nullptr) + if (componentName == NULL) { - JAVA_THROW_SCRIPT_EXCEPTION(true, ("JavaLibrary::setShipComponentName (): nullptr name")); + JAVA_THROW_SCRIPT_EXCEPTION(true, ("JavaLibrary::setShipComponentName (): null name")); return; } @@ -2442,7 +2442,7 @@ jboolean JNICALL ScriptMethodsShipNamespace::shipCanInstallComponent(JNIEnv * en return false; TangibleObject * tangibleComponent = 0; - if (JavaLibrary::getObject (component, tangibleComponent) && tangibleComponent != nullptr) + if (JavaLibrary::getObject (component, tangibleComponent) && tangibleComponent != NULL) return shipObject->canInstallComponent(chassisSlot, *tangibleComponent); else { @@ -2481,7 +2481,7 @@ jboolean JNICALL ScriptMethodsShipNamespace::shipInstallComponent(JNIEnv * env, NetworkId installerId(jobject_installerId); TangibleObject * tangibleComponent = 0; - if (JavaLibrary::getObject (component, tangibleComponent) && tangibleComponent != nullptr) + if (JavaLibrary::getObject (component, tangibleComponent) && tangibleComponent != NULL) return shipObject->installComponent(installerId, chassisSlot, *tangibleComponent); else { @@ -2546,11 +2546,11 @@ jintArray JNICALL ScriptMethodsShipNamespace::getShipChassisSlots(JNIEnv * env, { //-- Make sure ships are enabled if (!verifyShipsEnabled()) - return nullptr; + return NULL; ShipObject const * const shipObject = JavaLibrary::getShipThrow(env, jobject_shipId, "getShipChassisSlots(): shipId obj_id did not resolve to a ShipObject", false); if (!shipObject) - return nullptr; + return NULL; ShipChassis const * const shipChassis = ShipChassis::findShipChassisByCrc (shipObject->getChassisType()); if (shipChassis) @@ -2571,7 +2571,7 @@ jintArray JNICALL ScriptMethodsShipNamespace::getShipChassisSlots(JNIEnv * env, } } - return nullptr; + return NULL; } //---------------------------------------------------------------------- @@ -2585,7 +2585,7 @@ jint JNICALL ScriptMethodsShipNamespace::getShipComponentDescriptorType(JNIEnv * TangibleObject * tangibleComponent = 0; if (JavaLibrary::getObject (jobject_component, tangibleComponent)) { - if (tangibleComponent != nullptr && tangibleComponent->getObjectTemplate () != nullptr) + if (tangibleComponent != NULL && tangibleComponent->getObjectTemplate () != NULL) { ShipComponentDescriptor const * const shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByObjectTemplate (tangibleComponent->getObjectTemplate ()->getCrcName ().getCrc ()); @@ -2623,7 +2623,7 @@ jstring JNICALL ScriptMethodsShipNamespace::getShipComponentDescriptorTypeNam { //-- Make sure ships are enabled if (!verifyShipsEnabled()) - return nullptr; + return NULL; std::string const & typeName = ShipComponentType::getNameFromType(static_cast(componentType)); @@ -2641,7 +2641,7 @@ jint JNICALL ScriptMethodsShipNamespace::getShipComponentDescriptorCrc(JNI TangibleObject * tangibleComponent = 0; if (JavaLibrary::getObject (jobject_component, tangibleComponent)) { - if (tangibleComponent != nullptr && tangibleComponent->getObjectTemplate () != nullptr) + if (tangibleComponent != NULL && tangibleComponent->getObjectTemplate () != NULL) { ShipComponentDescriptor const * const shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByObjectTemplate (tangibleComponent->getObjectTemplate ()->getCrcName ().getCrc ()); @@ -2659,11 +2659,11 @@ jstring JNICALL ScriptMethodsShipNamespace::getShipComponentDescriptorCrcName { //-- Make sure ships are enabled if (!verifyShipsEnabled()) - return nullptr; + return NULL; ShipComponentDescriptor const * const shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByCrc(static_cast(componentCrc)); - if (shipComponentDescriptor == nullptr) - return nullptr; + if (shipComponentDescriptor == NULL) + return NULL; return JavaString(shipComponentDescriptor->getName().getString()).getReturnValue(); } @@ -2674,11 +2674,11 @@ jstring JNICALL ScriptMethodsShipNamespace::getShipComponentDescriptorCompati { //-- Make sure ships are enabled if (!verifyShipsEnabled()) - return nullptr; + return NULL; ShipComponentDescriptor const * const shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByCrc(static_cast(componentCrc)); - if (shipComponentDescriptor == nullptr) - return nullptr; + if (shipComponentDescriptor == NULL) + return NULL; return JavaString(shipComponentDescriptor->getCompatibility().getString()).getReturnValue(); } @@ -2776,15 +2776,15 @@ void JNICALL ScriptMethodsShipNamespace::notifyShipDamage(JNIEnv * env, jobject if (victimShipObject->isPlayerShip()) { //-- Get the attacker object. It can be any tangible object. - TangibleObject const * attackerTangibleObject = nullptr; + TangibleObject const * attackerTangibleObject = NULL; if (jobject_attacker) IGNORE_RETURN(JavaLibrary::getObject(jobject_attacker, attackerTangibleObject)); Controller * const victimShipController = victimShipObject->getController(); if (victimShipController) { - ShipDamageMessage shipDamage(attackerTangibleObject != nullptr ? attackerTangibleObject->getNetworkId() : NetworkId::cms_invalid, - attackerTangibleObject != nullptr ? attackerTangibleObject->getPosition_w() : victimShipObject->getPosition_w(), + ShipDamageMessage shipDamage(attackerTangibleObject != NULL ? attackerTangibleObject->getNetworkId() : NetworkId::cms_invalid, + attackerTangibleObject != NULL ? attackerTangibleObject->getPosition_w() : victimShipObject->getPosition_w(), totalDamage ); //lint -esym(429, damageMessage) @@ -3008,7 +3008,7 @@ jlong JNICALL ScriptMethodsShipNamespace::getDroidControlDeviceForShip(JNIEnv * NetworkId const & droidControlDeviceId = shipObject->getInstalledDroidControlDevice(); Object const * const droidControlDevice = NetworkIdManager::getObjectById(droidControlDeviceId); - ServerObject const * const serverDroidControlDevice = droidControlDevice ? droidControlDevice->asServerObject() : nullptr; + ServerObject const * const serverDroidControlDevice = droidControlDevice ? droidControlDevice->asServerObject() : NULL; if(!serverDroidControlDevice) return 0; else @@ -3050,7 +3050,7 @@ void JNICALL ScriptMethodsShipNamespace::commPlayers(JNIEnv *env, jobject /*self uint32 appearanceOverloadSharedTemplateCrc = 0; ObjectTemplate const * const ot = ObjectTemplateList::fetch(Unicode::wideToNarrow(appearanceOverloadServerTemplateWide)); - ServerObjectTemplate const * const sot = ot ? ot->asServerObjectTemplate() : nullptr; + ServerObjectTemplate const * const sot = ot ? ot->asServerObjectTemplate() : NULL; if(sot) { std::string const & sharedTemplateName = sot->getSharedTemplate(); @@ -3197,7 +3197,7 @@ jlong JNICALL ScriptMethodsShipNamespace::launchShipFromHangar(JNIEnv *env, jobj Transform const & finalCreateTransform = launchingShip->getTransform_o2p().rotateTranslate_l2p(finalHangarDelta_o); ServerObject * const newShip = ServerWorld::createNewObject(crcName.getCrc(), finalCreateTransform, cell, false); - if (newShip == nullptr) + if (newShip == NULL) return 0; // create an objId to return @@ -3223,7 +3223,7 @@ void JNICALL ScriptMethodsShipNamespace::handleShipDestruction(JNIEnv * en //convert ship ShipObject * const ship = JavaLibrary::getShipThrow(env, jship, "handleShipDestruction(): shipId obj_id did not resolve to a ShipObject", false); - if (ship == nullptr) + if (ship == NULL) return; DestroyShipMessage const msg(ship->getNetworkId(), severity); @@ -3401,7 +3401,7 @@ jfloat JNICALL ScriptMethodsShipNamespace::getShipInternalDamageOverTimeDamageRa return 0.0f; static ShipInternalDamageOverTime const * const idot = ShipInternalDamageOverTimeManager::findEntry(*ship, chassisSlot); - if (idot == nullptr) + if (idot == NULL) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("JavaLibrary::getShipInternalDamageOverTimeDamageThreshold idot for [%s] slot [%d] not found", ship->getNetworkId().getValueString().c_str(), chassisSlot)); return 0.0f; @@ -3419,7 +3419,7 @@ jfloat JNICALL ScriptMethodsShipNamespace::getShipInternalDamageOverTimeDamageTh return 0.0f; static ShipInternalDamageOverTime const * const idot = ShipInternalDamageOverTimeManager::findEntry(*ship, chassisSlot); - if (idot == nullptr) + if (idot == NULL) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("JavaLibrary::getShipInternalDamageOverTimeDamageThreshold idot for [%s] slot [%d] not found", ship->getNetworkId().getValueString().c_str(), chassisSlot)); return 0.0f; @@ -3437,11 +3437,11 @@ jboolean JNICALL ScriptMethodsShipNamespace::hasShipInternalDamageOverTime(JNIEn //convert ship ShipObject * const ship = JavaLibrary::getShipThrow(env, jship, "hasShipInternalDamageOverTime(): shipId obj_id did not resolve to a ShipObject", false); - if (ship == nullptr) + if (ship == NULL) return false; static ShipInternalDamageOverTime const * const idot = ShipInternalDamageOverTimeManager::findEntry(*ship, chassisSlot); - return idot != nullptr; + return idot != NULL; } // ---------------------------------------------------------------------- @@ -3576,7 +3576,7 @@ jboolean JNICALL ScriptMethodsShipNamespace::shipIsInNebula(JNIEnv *env, jobject std::string nebulaName; - if (nullptr != j_nebulaName) + if (NULL != j_nebulaName) { JavaStringParam const jsp(j_nebulaName); if (!JavaLibrary::convert(jsp, nebulaName)) @@ -3593,7 +3593,7 @@ jboolean JNICALL ScriptMethodsShipNamespace::shipIsInNebula(JNIEnv *env, jobject { int const id = *it; Nebula const * const nebula = NebulaManager::getNebulaById(id); - if (nullptr != nebula) + if (NULL != nebula) { if (nebula->getName() == nebulaName) return JNI_TRUE; @@ -3637,7 +3637,7 @@ jboolean JNICALL ScriptMethodsShipNamespace::setShipWingName(JNIEnv * /*env*/, j jstring JNICALL ScriptMethodsShipNamespace::getShipWingName(JNIEnv * /*env*/, jobject /*self*/, jlong target) { - ServerObject const * object = nullptr; + ServerObject const * object = NULL; if (!JavaLibrary::getObject(target, object)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("JavaLibrary::getShipWingName (): could not convert the target")); @@ -3686,7 +3686,7 @@ jboolean JNICALL ScriptMethodsShipNamespace::setShipTypeName(JNIEnv * /*env*/, j jstring JNICALL ScriptMethodsShipNamespace::getShipTypeName(JNIEnv * /*env*/, jobject /*self*/, jlong target) { - ServerObject const * object = nullptr; + ServerObject const * object = NULL; if (!JavaLibrary::getObject(target, object)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("JavaLibrary::getShipTypeName (): could not convert the target")); @@ -3735,7 +3735,7 @@ jboolean JNICALL ScriptMethodsShipNamespace::setShipDifficulty(JNIEnv * /*env*/, jstring JNICALL ScriptMethodsShipNamespace::getShipDifficulty(JNIEnv * /*env*/, jobject /*self*/, jlong target) { - ServerObject const * object = nullptr; + ServerObject const * object = NULL; if (!JavaLibrary::getObject(target, object)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("JavaLibrary::getShipDifficulty (): could not convert the target")); @@ -3783,7 +3783,7 @@ jboolean JNICALL ScriptMethodsShipNamespace::setShipFaction(JNIEnv * /*env*/, jo jstring JNICALL ScriptMethodsShipNamespace::getShipFaction(JNIEnv * /*env*/, jobject /*self*/, jlong target) { - ServerObject const * object = nullptr; + ServerObject const * object = NULL; if (!JavaLibrary::getObject(target, object)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("JavaLibrary::getShipFaction (): could not convert the target")); @@ -3871,7 +3871,7 @@ jboolean JNICALL ScriptMethodsShipNamespace::isMissionCriticalObject(JNIEnv * en if (!ship) { - JAVA_THROW_SCRIPT_EXCEPTION(true, ("isMissionCriticalObject(): playerId ship is nullptr")); + JAVA_THROW_SCRIPT_EXCEPTION(true, ("isMissionCriticalObject(): playerId ship is null")); return JNI_FALSE; } @@ -3973,7 +3973,7 @@ void JNICALL ScriptMethodsShipNamespace::setDynamicMiningAsteroidVelocity(JNIEnv } MiningAsteroidController * const miningAsteroidController = dynamic_cast(shipObject->getController()); - if (nullptr == miningAsteroidController) + if (NULL == miningAsteroidController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("setDynamicMiningAsteroidVelocity(): called on a ship which is not a dynamic mining asteroid")); return; @@ -3988,12 +3988,12 @@ jobject JNICALL ScriptMethodsShipNamespace::getDynamicMiningAsteroidVelocity(JNI { ShipObject * const shipObject = JavaLibrary::getShipThrow(env, jobject_asteroidId, "getDynamicMiningAsteroidVelocity(): shipId did not resolve to a ShipObject", false); if (!shipObject) - return nullptr; + return NULL; MiningAsteroidController * const miningAsteroidController = dynamic_cast(shipObject->getController()); - if (nullptr == miningAsteroidController) + if (NULL == miningAsteroidController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("setDynamicMiningAsteroidVelocity(): called on a ship which is not a dynamic mining asteroid")); - return nullptr; + return NULL; } Vector const & velocity_w = miningAsteroidController->getVelocity_w(); @@ -4073,7 +4073,7 @@ jlongArray JNICALL ScriptMethodsShipNamespace::getShipCargoHoldContentsResourceT { ShipObject const * const shipObject = getShipThrowTestSlot(env, jobject_shipId, "getShipCargoHoldContents()", false, static_cast(ShipChassisSlotType::SCST_cargo_hold)); if (!shipObject) - return nullptr; + return NULL; ShipObject::NetworkIdIntMap const & contents = shipObject->getCargoHoldContents(); @@ -4090,7 +4090,7 @@ jlongArray JNICALL ScriptMethodsShipNamespace::getShipCargoHoldContentsResourceT return jids->getReturnValue(); } - return nullptr; + return NULL; } //---------------------------------------------------------------------- @@ -4099,7 +4099,7 @@ jintArray JNICALL ScriptMethodsShipNamespace::getShipCargoHoldContentsAmounts(JN { ShipObject const * const shipObject = getShipThrowTestSlot(env, jobject_shipId, "getShipCargoHoldContents()", false, static_cast(ShipChassisSlotType::SCST_cargo_hold)); if (!shipObject) - return nullptr; + return NULL; ShipObject::NetworkIdIntMap const & contents = shipObject->getCargoHoldContents(); @@ -4115,7 +4115,7 @@ jintArray JNICALL ScriptMethodsShipNamespace::getShipCargoHoldContentsAmounts(JN return jamounts->getReturnValue(); } - return nullptr; + return NULL; } //---------------------------------------------------------------------- @@ -4125,9 +4125,9 @@ void JNICALL ScriptMethodsShipNamespace::openSpaceMiningUi(JNIEnv * env, jobject NetworkId const & playerId = NetworkId(jobject_player); NetworkId const & spaceStationId = NetworkId(jobject_spaceStation); - if (jstring_spaceStationName == nullptr) + if (jstring_spaceStationName == NULL) { - JAVA_THROW_SCRIPT_EXCEPTION(true, ("JavaLibrary::setShipComponentName (): nullptr name")); + JAVA_THROW_SCRIPT_EXCEPTION(true, ("JavaLibrary::setShipComponentName (): null name")); return; } @@ -4140,7 +4140,7 @@ void JNICALL ScriptMethodsShipNamespace::openSpaceMiningUi(JNIEnv * env, jobject } Object * const player = NetworkIdManager::getObjectById(playerId); - Controller * const controller = player ? player->getController(): nullptr; + Controller * const controller = player ? player->getController(): NULL; if (!controller) { diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsSkill.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsSkill.cpp index 07533c45..ae184f4b 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsSkill.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsSkill.cpp @@ -276,7 +276,7 @@ jobjectArray JNICALL ScriptMethodsSkillNamespace::getSkillCommandsProvided(JNIEn const SkillObject * skill = getSkill(localSkillName); if(! skill) - return nullptr; + return NULL; LocalObjectArrayRefPtr strArray; if(! ScriptConversion::convert(skill->getCommandsProvided(), strArray)) @@ -293,7 +293,7 @@ jobject JNICALL ScriptMethodsSkillNamespace::getSkillPrerequisiteExperience(JNIE const SkillObject * skill = getSkill(localSkillName); if(! skill) - return nullptr; + return NULL; JavaDictionaryPtr dict; if (!JavaLibrary::convert(skill->getPrerequisiteExperienceVector(), dict)) @@ -334,7 +334,7 @@ jobjectArray JNICALL ScriptMethodsSkillNamespace::getSkillPrerequisiteSkills(JNI const SkillObject * skill = getSkill(localSkillName); if(! skill) - return nullptr; + return NULL; std::vector skillNames; std::vector::const_iterator i; @@ -358,7 +358,7 @@ jobject JNICALL ScriptMethodsSkillNamespace::getSkillPrerequisiteSpecies(JNIEnv const SkillObject * skill = getSkill(localSkillName); if(! skill) - return nullptr; + return NULL; JavaDictionaryPtr dict; if (!JavaLibrary::convert(skill->getPrerequisiteSpecies(), dict)) @@ -374,14 +374,14 @@ jstring JNICALL ScriptMethodsSkillNamespace::getSkillProfession(JNIEnv *env, job const SkillObject * const skill = getSkill(localSkillName); if(!skill) - return nullptr; + return NULL; const SkillObject * const prof = skill->findProfessionForSkill (); if(prof) { JavaString str(prof->getSkillName().c_str()); return str.getReturnValue(); } - return nullptr; + return NULL; } //----------------------------------------------------------------------- @@ -423,7 +423,7 @@ jobject JNICALL ScriptMethodsSkillNamespace::getSkillStatisticModifiers(JNIEnv * const SkillObject * skill = getSkill(localSkillName); if(! skill) - return nullptr; + return NULL; JavaDictionaryPtr dict; if (!JavaLibrary::convert(skill->getStatisticModifiers(), dict)) @@ -450,7 +450,7 @@ jint JNICALL ScriptMethodsSkillNamespace::getCreatureSkillStatisticModifier(JNIE JavaStringParam jskillStatName(skillStatName); - const CreatureObject * object = nullptr; + const CreatureObject * object = NULL; if (!JavaLibrary::getObject(creature, object)) return 0; @@ -472,7 +472,7 @@ jint JNICALL ScriptMethodsSkillNamespace::getCreatureSkillStatisticModifier(JNIE * @param creature the creature whose stat mod we want * @param skillStatNames array of names of the skill stat mods we want * - * @return the skill stat mod values, or nullptr on error + * @return the skill stat mod values, or null on error */ jintArray JNICALL ScriptMethodsSkillNamespace::getCreatureSkillStatisticModifiers(JNIEnv *env, jobject self, jlong creature, jobjectArray skillStatNames) { @@ -481,7 +481,7 @@ jintArray JNICALL ScriptMethodsSkillNamespace::getCreatureSkillStatisticModifier if (skillStatNames == 0) return 0; - const CreatureObject * object = nullptr; + const CreatureObject * object = NULL; if (!JavaLibrary::getObject(creature, object)) return 0; @@ -555,7 +555,7 @@ jint JNICALL ScriptMethodsSkillNamespace::internalGetCreatureEnhancedSkillStatis JavaStringParam jskillStatName(skillStatName); - const CreatureObject * object = nullptr; + const CreatureObject * object = NULL; if (!JavaLibrary::getObject(creature, object)) return 0; @@ -577,7 +577,7 @@ jint JNICALL ScriptMethodsSkillNamespace::internalGetCreatureEnhancedSkillStatis * @param creature the creature whose stat mod we want * @param skillStatNames array of names of the skill stat mods we want * - * @return the skill stat mod values, or nullptr on error + * @return the skill stat mod values, or null on error */ jintArray JNICALL ScriptMethodsSkillNamespace::internalGetCreatureEnhancedSkillStatisticModifiers(JNIEnv *env, jobject self, jlong creature, jobjectArray skillStatNames, jboolean useBonusCap) { @@ -586,7 +586,7 @@ jintArray JNICALL ScriptMethodsSkillNamespace::internalGetCreatureEnhancedSkillS if (skillStatNames == 0) return 0; - const CreatureObject * object = nullptr; + const CreatureObject * object = NULL; if (!JavaLibrary::getObject(creature, object)) return 0; @@ -621,7 +621,7 @@ jstring JNICALL ScriptMethodsSkillNamespace::getSkillTitleGranted(JNIEnv *env, j const SkillObject * const skill = getSkill(localSkillName); if(! skill) - return nullptr; + return NULL; if (skill->isTitle ()) return JavaString(skill->getSkillName ().c_str()).getReturnValue(); @@ -665,7 +665,7 @@ jint JNICALL ScriptMethodsSkillNamespace::grantExperiencePointsByString(JNIEnv * if(name.empty()) { // throw java exception - JavaLibrary::throwInternalScriptError("JavaLibrary::grantExperiencePoints() was passed an EMPTY or nullptr experience name. This is probably not what the script intends to do, and the database cannot save unnamed XP. Change your script to ensure that it is calling grantExperiencePoints with the intended parameters."); + JavaLibrary::throwInternalScriptError("JavaLibrary::grantExperiencePoints() was passed an EMPTY or NULL experience name. This is probably not what the script intends to do, and the database cannot save unnamed XP. Change your script to ensure that it is calling grantExperiencePoints with the intended parameters."); } else { @@ -675,7 +675,7 @@ jint JNICALL ScriptMethodsSkillNamespace::grantExperiencePointsByString(JNIEnv * WARNING(true, ("JavaLibrary::grantExperiencePointsByString called " "with target id = 0")); } - else if (targetId.getObject() == nullptr) + else if (targetId.getObject() == NULL) { if (NameManager::getInstance().getPlayerName(targetId).empty()) { @@ -683,7 +683,7 @@ jint JNICALL ScriptMethodsSkillNamespace::grantExperiencePointsByString(JNIEnv * "with target id = %s, who is not in the player name map", targetId.getValueString().c_str())); } -// else if (ServerUniverse::getInstance().getXpManager() != nullptr) +// else if (ServerUniverse::getInstance().getXpManager() != NULL) // { // ServerUniverse::getInstance().getXpManager()->grantXp(targetId, // name, amount); @@ -701,7 +701,7 @@ jint JNICALL ScriptMethodsSkillNamespace::grantExperiencePointsByString(JNIEnv * else { CreatureObject * creature = dynamic_cast(targetId.getObject()); - if (creature != nullptr) + if (creature != NULL) { result = creature->grantExperiencePoints(name, static_cast(amount)); } @@ -741,7 +741,7 @@ jint JNICALL ScriptMethodsSkillNamespace::grantExperiencePointsByInt(JNIEnv *env jint result = INT_MIN; CachedNetworkId targetId(target); - if (targetId.getObject() == nullptr) + if (targetId.getObject() == NULL) { if (targetId == CachedNetworkId::cms_cachedInvalid) { @@ -754,7 +754,7 @@ jint JNICALL ScriptMethodsSkillNamespace::grantExperiencePointsByInt(JNIEnv *env "with target id = %s, who is not in the player name map", targetId.getValueString().c_str())); } -// else if (ServerUniverse::getInstance().getXpManager() != nullptr) +// else if (ServerUniverse::getInstance().getXpManager() != NULL) // { // ServerUniverse::getInstance().getXpManager()->grantXp(targetId, // experienceTypeString, amount); @@ -772,7 +772,7 @@ jint JNICALL ScriptMethodsSkillNamespace::grantExperiencePointsByInt(JNIEnv *env else { CreatureObject * creature = dynamic_cast(targetId.getObject()); - if (creature != nullptr) + if (creature != NULL) { result = creature->grantExperiencePoints(experienceTypeString, static_cast(amount)); } @@ -977,7 +977,7 @@ jboolean JNICALL ScriptMethodsSkillNamespace::grantSchematicGroup(JNIEnv *env, j JavaStringParam groupNameParam(groupName); - CreatureObject * creature = nullptr; + CreatureObject * creature = NULL; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -1010,7 +1010,7 @@ jboolean JNICALL ScriptMethodsSkillNamespace::revokeSchematicGroup(JNIEnv *env, JavaStringParam groupNameParam(groupName); - CreatureObject * creature = nullptr; + CreatureObject * creature = NULL; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -1067,7 +1067,7 @@ jboolean JNICALL ScriptMethodsSkillNamespace::grantSchematicCrc(JNIEnv *env, job { UNREF(self); - CreatureObject * creature = nullptr; + CreatureObject * creature = NULL; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -1120,7 +1120,7 @@ jboolean JNICALL ScriptMethodsSkillNamespace::revokeSchematicCrc(JNIEnv *env, jo { UNREF(self); - CreatureObject * creature = nullptr; + CreatureObject * creature = NULL; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -1173,7 +1173,7 @@ jboolean JNICALL ScriptMethodsSkillNamespace::hasSchematicCrc(JNIEnv *env, jobje { UNREF(self); - CreatureObject * creature = nullptr; + CreatureObject * creature = NULL; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -1191,11 +1191,11 @@ jboolean JNICALL ScriptMethodsSkillNamespace::hasSchematicCrc(JNIEnv *env, jobje * @param self class calling this function * @param player the player * - * @return the skill mod names the player has, or nullptr on error + * @return the skill mod names the player has, or null on error */ jobjectArray JNICALL ScriptMethodsSkillNamespace::getSkillStatModListingForPlayer(JNIEnv *env, jobject self, jlong player) { - const CreatureObject * creature = nullptr; + const CreatureObject * creature = NULL; if (!JavaLibrary::getObject(player, creature)) return 0; @@ -1221,11 +1221,11 @@ jobjectArray JNICALL ScriptMethodsSkillNamespace::getSkillStatModListingForPlaye * @param self class calling this function * @param player the player * - * @return the commands the player has, or nullptr on error + * @return the commands the player has, or null on error */ jobjectArray JNICALL ScriptMethodsSkillNamespace::getCommandListingForPlayer(JNIEnv *env, jobject self, jlong player) { - const CreatureObject * creature = nullptr; + const CreatureObject * creature = NULL; if (!JavaLibrary::getObject(player, creature)) return 0; @@ -1261,7 +1261,7 @@ jintArray JNICALL ScriptMethodsSkillNamespace::getSkillSchematicsGranted(JNIEnv return 0; const SkillObject * skill = SkillManager::getInstance().getSkill(name); - if (skill == nullptr) + if (skill == NULL) return 0; // get all the granted schematics from the skill groups for the skill @@ -1304,11 +1304,11 @@ jintArray JNICALL ScriptMethodsSkillNamespace::getSkillSchematicsGranted(JNIEnv * @param self class calling this function * @param player the player * - * @return the schematics' crc, or nullptr on error + * @return the schematics' crc, or null on error */ jintArray JNICALL ScriptMethodsSkillNamespace::getSchematicListingForPlayer(JNIEnv *env, jobject self, jlong player) { - const CreatureObject * creature = nullptr; + const CreatureObject * creature = NULL; if (!JavaLibrary::getObject(player, creature)) return 0; @@ -1335,7 +1335,7 @@ jintArray JNICALL ScriptMethodsSkillNamespace::getSchematicListingForPlayer(JNIE jboolean JNICALL ScriptMethodsSkillNamespace::hasCertificationsForItem(JNIEnv *env, jobject self, jlong player, jlong item) { - const CreatureObject * creatureObject = nullptr; + const CreatureObject * creatureObject = NULL; if (!JavaLibrary::getObject(player, creatureObject) || !creatureObject) return JNI_FALSE; @@ -1349,7 +1349,7 @@ jboolean JNICALL ScriptMethodsSkillNamespace::hasCertificationsForItem(JNIEnv *e } } - const TangibleObject * itemObject = nullptr; + const TangibleObject * itemObject = NULL; if (!JavaLibrary::getObject(item, itemObject) || !itemObject) return JNI_FALSE; @@ -1360,11 +1360,11 @@ jboolean JNICALL ScriptMethodsSkillNamespace::hasCertificationsForItem(JNIEnv *e jobjectArray JNICALL ScriptMethodsSkillNamespace::getRequiredCertifications(JNIEnv *env, jobject self, jlong item) { - const TangibleObject * itemAsTangible = nullptr; + const TangibleObject * itemAsTangible = NULL; if (!JavaLibrary::getObject(item, itemAsTangible) || !itemAsTangible) { JAVA_THROW_SCRIPT_EXCEPTION(true,("getRequiredCertifications called with an object that does not exist")); - return nullptr; + return NULL; } std::vector certs; @@ -1372,7 +1372,7 @@ jobjectArray JNICALL ScriptMethodsSkillNamespace::getRequiredCertifications(JNIE LocalObjectArrayRefPtr results; if (!ScriptConversion::convert(certs, results)) - return nullptr; + return NULL; return results->getReturnValue(); } @@ -1381,7 +1381,7 @@ jobjectArray JNICALL ScriptMethodsSkillNamespace::getRequiredCertifications(JNIE jstring JNICALL ScriptMethodsSkillNamespace::getSkillTemplate(JNIEnv *env, jobject self, jlong player) { - CreatureObject const * creature = nullptr; + CreatureObject const * creature = NULL; if (JavaLibrary::getObject(player, creature)) { @@ -1393,14 +1393,14 @@ jstring JNICALL ScriptMethodsSkillNamespace::getSkillTemplate(JNIEnv *env, jobje } } - return nullptr; + return NULL; } // ---------------------------------------------------------------------- void JNICALL ScriptMethodsSkillNamespace::setSkillTemplate(JNIEnv *env, jobject self, jlong player, jstring skillTemplateName) { - CreatureObject * creature = nullptr; + CreatureObject * creature = NULL; if (JavaLibrary::getObject(player, creature)) { @@ -1422,7 +1422,7 @@ void JNICALL ScriptMethodsSkillNamespace::setSkillTemplate(JNIEnv *env, jobject jstring JNICALL ScriptMethodsSkillNamespace::getWorkingSkill(JNIEnv *env, jobject self, jlong player) { - CreatureObject const * creature = nullptr; + CreatureObject const * creature = NULL; if (JavaLibrary::getObject(player, creature)) { @@ -1435,14 +1435,14 @@ jstring JNICALL ScriptMethodsSkillNamespace::getWorkingSkill(JNIEnv *env, jobjec } } - return nullptr; + return NULL; } // ---------------------------------------------------------------------- void JNICALL ScriptMethodsSkillNamespace::setWorkingSkill(JNIEnv *env, jobject self, jlong player, jstring workingSkillName) { - CreatureObject * creature = nullptr; + CreatureObject * creature = NULL; if (JavaLibrary::getObject(player, creature)) { @@ -1464,7 +1464,7 @@ void JNICALL ScriptMethodsSkillNamespace::setWorkingSkill(JNIEnv *env, jobject s void JNICALL ScriptMethodsSkillNamespace::recomputeCommandSeries(JNIEnv *env, jobject self, jlong player) { - CreatureObject * creature = nullptr; + CreatureObject * creature = NULL; if (JavaLibrary::getObject(player, creature)) { @@ -1476,7 +1476,7 @@ void JNICALL ScriptMethodsSkillNamespace::recomputeCommandSeries(JNIEnv *env, jo void JNICALL ScriptMethodsSkillNamespace::resetExpertises(JNIEnv *env, jobject self, jlong player) { - CreatureObject * creature = nullptr; + CreatureObject * creature = NULL; if (JavaLibrary::getObject(player, creature)) { diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsString.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsString.cpp index cb7135e7..344f0207 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsString.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsString.cpp @@ -56,7 +56,7 @@ const JNINativeMethod NATIVES[] = { * @param self class calling this function * @param id the stringId to find * - * @return the string, or nullptr on error + * @return the string, or null on error */ jstring JNICALL ScriptMethodsStringNamespace::getString(JNIEnv *env, jobject self, jobject id) { @@ -64,7 +64,7 @@ jstring JNICALL ScriptMethodsStringNamespace::getString(JNIEnv *env, jobject sel if (id == 0) { - WARNING(true, ("JavaLibrary::log getString is nullptr.")); + WARNING(true, ("JavaLibrary::log getString is NULL.")); return 0; } @@ -116,7 +116,7 @@ jstring JNICALL ScriptMethodsStringNamespace::getString(JNIEnv *env, jobject sel * @param self class calling this function * @param ids array of stringIds to find * - * @return an array of strings, or nullptr on error + * @return an array of strings, or null on error */ jobjectArray JNICALL ScriptMethodsStringNamespace::getStrings(JNIEnv *env, jobject self, jobjectArray ids) { diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsSystem.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsSystem.cpp index 7dda71ba..90861085 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsSystem.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsSystem.cpp @@ -61,7 +61,7 @@ jboolean JNICALL ScriptMethodsSystemNamespace::sendConsoleCommand(JNIEnv * env, { JavaStringParam localCommand(command); - ServerObject* object = nullptr; + ServerObject* object = NULL; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -86,7 +86,7 @@ jboolean JNICALL ScriptMethodsSystemNamespace::sendConsoleCommand(JNIEnv * env, * @param section the config file section * @param key the config file key * - * @return the key value, or nullptr if the key doesn't exist + * @return the key value, or null if the key doesn't exist */ jstring JNICALL ScriptMethodsSystemNamespace::getConfigSetting(JNIEnv * env, jobject self, jstring section, jstring key) @@ -108,12 +108,12 @@ jstring JNICALL ScriptMethodsSystemNamespace::getConfigSetting(JNIEnv * env, job return 0; const ConfigFile::Section * sec = ConfigFile::getSection(sectionName.c_str()); - if (sec == nullptr) + if (sec == NULL) return 0; const ConfigFile::Key * ky = sec->findKey(keyName.c_str()); - if (ky == nullptr) - return nullptr; + if (ky == NULL) + return NULL; JavaString jvalue(ky->getAsString(ky->getCount()-1, "")); return jvalue.getReturnValue(); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsTerrain.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsTerrain.cpp index fabb32f6..c56803c1 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsTerrain.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsTerrain.cpp @@ -165,16 +165,16 @@ jobject JNICALL ScriptMethodsTerrainNamespace::getGoodLocation(JNIEnv * /*env*/, PROFILER_AUTO_BLOCK_DEFINE("JNI::getGoodLocation"); //validate scripter's input - if (searchRectLowerLeftLocation == nullptr) + if (searchRectLowerLeftLocation == NULL) { - DEBUG_WARNING (true, ("getGoodLocation (): DB lower left is nullptr")); - return nullptr; + DEBUG_WARNING (true, ("getGoodLocation (): DB lower left is NULL")); + return NULL; } - if (searchRectUpperRightLocation == nullptr) + if (searchRectUpperRightLocation == NULL) { - DEBUG_WARNING (true, ("getGoodLocation (): DB upper right is nullptr")); - return nullptr; + DEBUG_WARNING (true, ("getGoodLocation (): DB upper right is NULL")); + return NULL; } //pull the data from the java Location objects. sceneid and cell are not checked or used, but sent back in the good location, if one exists @@ -184,14 +184,14 @@ jobject JNICALL ScriptMethodsTerrainNamespace::getGoodLocation(JNIEnv * /*env*/, if (!ScriptConversion::convertWorld(searchRectLowerLeftLocation, srLLLocationVec, sceneId)) { DEBUG_WARNING (true, ("getGoodLocation (): DB could not convert lower left coordinates")); - return nullptr; + return NULL; } Vector srURLocationVec; if (!ScriptConversion::convertWorld(searchRectUpperRightLocation, srURLocationVec, sceneId)) { DEBUG_WARNING (true, ("getGoodLocation (): DB could not convert upper right coordinates")); - return nullptr; + return NULL; } // get the good location from ServerWorld @@ -199,7 +199,7 @@ jobject JNICALL ScriptMethodsTerrainNamespace::getGoodLocation(JNIEnv * /*env*/, if (successLoc3d.x == 0 && successLoc3d.y == 0 && successLoc3d.z == 0) { // no good location available - return nullptr; + return NULL; } //convert it back into scripter lingo (a "location"), using the default scene and cell ids @@ -207,7 +207,7 @@ jobject JNICALL ScriptMethodsTerrainNamespace::getGoodLocation(JNIEnv * /*env*/, if (!ScriptConversion::convert(successLoc3d, sceneId, NetworkId(), goodLocation)) { DEBUG_WARNING (true, ("getGoodLocation (): PB could not convert result back to a location")); - return nullptr; + return NULL; } return goodLocation->getReturnValue(); @@ -218,16 +218,16 @@ jobject JNICALL ScriptMethodsTerrainNamespace::getGoodLocationAvoidCollidables(J PROFILER_AUTO_BLOCK_DEFINE("JNI::getGoodLocationAvoidCollidables"); //validate scripter's input - if (searchRectLowerLeftLocation == nullptr) + if (searchRectLowerLeftLocation == NULL) { - DEBUG_WARNING (true, ("getGoodLocationAvoidCollidables (): DB lower left is nullptr")); - return nullptr; + DEBUG_WARNING (true, ("getGoodLocationAvoidCollidables (): DB lower left is NULL")); + return NULL; } - if (searchRectUpperRightLocation == nullptr) + if (searchRectUpperRightLocation == NULL) { - DEBUG_WARNING (true, ("getGoodLocationAvoidCollidables (): DB upper right is nullptr")); - return nullptr; + DEBUG_WARNING (true, ("getGoodLocationAvoidCollidables (): DB upper right is NULL")); + return NULL; } //pull the data from the java Location objects. sceneid and cell are not checked or used, but sent back in the good location, if one exists @@ -237,14 +237,14 @@ jobject JNICALL ScriptMethodsTerrainNamespace::getGoodLocationAvoidCollidables(J if (!ScriptConversion::convertWorld(searchRectLowerLeftLocation, srLLLocationVec, sceneId)) { DEBUG_WARNING (true, ("getGoodLocationAvoidCollidables (): DB could not convert lower left coordinates")); - return nullptr; + return NULL; } Vector srURLocationVec; if (!ScriptConversion::convertWorld(searchRectUpperRightLocation, srURLocationVec, sceneId)) { DEBUG_WARNING (true, ("getGoodLocationAvoidCollidables (): DB could not convert upper right coordinates")); - return nullptr; + return NULL; } // get the good location from ServerWorld @@ -252,7 +252,7 @@ jobject JNICALL ScriptMethodsTerrainNamespace::getGoodLocationAvoidCollidables(J if (successLoc3d.x == 0 && successLoc3d.y == 0 && successLoc3d.z == 0) { // no good location available - return nullptr; + return NULL; } //convert it back into scripter lingo (a "location"), using the default scene and cell ids @@ -260,7 +260,7 @@ jobject JNICALL ScriptMethodsTerrainNamespace::getGoodLocationAvoidCollidables(J if (!ScriptConversion::convert(successLoc3d, sceneId, NetworkId(), goodLocation)) { DEBUG_WARNING (true, ("getGoodLocationAvoidCollidables (): PB could not convert result back to a location")); - return nullptr; + return NULL; } return goodLocation->getReturnValue(); @@ -587,7 +587,7 @@ jboolean JNICALL ScriptMethodsTerrainNamespace::setWeatherData (JNIEnv* env, job UNREF(self); PlanetObject * planet = ServerUniverse::getInstance().getCurrentPlanet(); - if (planet != nullptr) + if (planet != NULL) { planet->setWeather(index, windVelocityX, 0.f, windVelocityZ); return JNI_TRUE; @@ -603,9 +603,9 @@ jboolean JNICALL ScriptMethodsTerrainNamespace::setWeatherData (JNIEnv* env, job jboolean JNICALL ScriptMethodsTerrainNamespace::isBelowWater (JNIEnv* /*env*/, jobject /*self*/, jobject location) { - if (location == nullptr) + if (location == NULL) { - DEBUG_WARNING(true, ("[designer bug] isBelowWater script hook was passed a nullptr location reference")); + DEBUG_WARNING(true, ("[designer bug] isBelowWater script hook was passed a NULL location reference")); return JNI_FALSE; } @@ -621,7 +621,7 @@ jboolean JNICALL ScriptMethodsTerrainNamespace::isBelowWater (JNIEnv* /*env*/, j const CellProperty* worldCell = CellProperty::getWorldCellProperty(); if(!worldCell) { - DEBUG_WARNING(true, ("isBelowWater got a nullptr worldCell back from CellProperty::getWorldCellProperty()")); + DEBUG_WARNING(true, ("isBelowWater got a NULL worldCell back from CellProperty::getWorldCellProperty()")); return JNI_FALSE; } const NetworkId& worldCellId = worldCell->getOwner().getNetworkId(); @@ -758,9 +758,9 @@ jfloat JNICALL ScriptMethodsTerrainNamespace::getWaterTableHeight (JNIEnv* /*env { float zero = 0.0f; - if (location == nullptr) + if (location == NULL) { - DEBUG_WARNING(true, ("[designer bug] getWaterTableHeight script hook was passed a nullptr location reference")); + DEBUG_WARNING(true, ("[designer bug] getWaterTableHeight script hook was passed a NULL location reference")); return zero; } @@ -776,7 +776,7 @@ jfloat JNICALL ScriptMethodsTerrainNamespace::getWaterTableHeight (JNIEnv* /*env const CellProperty* worldCell = CellProperty::getWorldCellProperty(); if(!worldCell) { - DEBUG_WARNING(true, ("getWaterTableHeight got a nullptr worldCell back from CellProperty::getWorldCellProperty()")); + DEBUG_WARNING(true, ("getWaterTableHeight got a NULL worldCell back from CellProperty::getWorldCellProperty()")); return zero; } const NetworkId& worldCellId = worldCell->getOwner().getNetworkId(); @@ -862,7 +862,7 @@ jboolean JNICALL ScriptMethodsTerrainNamespace::requestLocation (JNIEnv * /*env* jboolean JNICALL ScriptMethodsTerrainNamespace::isOnAFloor (JNIEnv * env, jobject self, jlong scriptObject) { //-- make sure we have a valid object - ServerObject * theObject = nullptr; + ServerObject * theObject = NULL; if (!JavaLibrary::getObject (scriptObject, theObject)) { DEBUG_WARNING (true, ("isOnAFloor (): could not find scriptObject")); @@ -876,7 +876,7 @@ jboolean JNICALL ScriptMethodsTerrainNamespace::isOnAFloor (JNIEnv * env, jobjec return JNI_FALSE; } - if(objectCollisionProp->getStandingOn() != nullptr) + if(objectCollisionProp->getStandingOn() != NULL) return JNI_TRUE; else return JNI_FALSE; @@ -890,7 +890,7 @@ jboolean JNICALL ScriptMethodsTerrainNamespace::isRelativePointOnSameFloorAsObje return JNI_FALSE; //-- make sure we have a valid object - ServerObject * theObject = nullptr; + ServerObject * theObject = NULL; if (!JavaLibrary::getObject (scriptObject, theObject)) { DEBUG_WARNING (true, ("isRelativePointOnSameFloorAsObject (): could not find scriptObject")); @@ -938,7 +938,7 @@ jfloat JNICALL ScriptMethodsTerrainNamespace::getFloorHeightAtRelativePointOnS return JNI_FALSE; //-- make sure we have a valid object - ServerObject * theObject = nullptr; + ServerObject * theObject = NULL; if (!JavaLibrary::getObject (scriptObject, theObject)) { DEBUG_WARNING (true, ("getFloorHeightAtRelativePointOnSameFloorAsObject (): could not find scriptObject")); @@ -1106,7 +1106,7 @@ jboolean JNICALL ScriptMethodsTerrainNamespace::createClientPathAdvanced(JNIEnv */ jboolean JNICALL ScriptMethodsTerrainNamespace::setCreatureCoverDefault(JNIEnv *env, jobject self, jlong target) { - CreatureObject * creature = nullptr; + CreatureObject * creature = NULL; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -1137,7 +1137,7 @@ jboolean JNICALL ScriptMethodsTerrainNamespace::setCreatureCover(JNIEnv *env, jo { UNREF(self); - CreatureObject * creature = nullptr; + CreatureObject * creature = NULL; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -1149,7 +1149,7 @@ jboolean JNICALL ScriptMethodsTerrainNamespace::setCreatureCover(JNIEnv *env, jo void JNICALL ScriptMethodsTerrainNamespace::setCreatureCoverVisibility(JNIEnv * env, jobject self, jlong target, jboolean isVisible) { - CreatureObject * creature = nullptr; + CreatureObject * creature = NULL; if(!JavaLibrary::getObject(target, creature)) return; @@ -1160,7 +1160,7 @@ void JNICALL ScriptMethodsTerrainNamespace::setCreatureCoverVisibility(JNIEnv * jboolean JNICALL ScriptMethodsTerrainNamespace::getCreatureCoverVisibility(JNIEnv * env, jobject self, jlong target) { - CreatureObject * creature = nullptr; + CreatureObject * creature = NULL; if(!JavaLibrary::getObject(target, creature)) return JNI_FALSE; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsVeteran.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsVeteran.cpp index ed5f2322..d751acee 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsVeteran.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsVeteran.cpp @@ -81,7 +81,7 @@ const JNINativeMethod NATIVES[] = { jobjectArray JNICALL ScriptMethodsVeteranNamespace::veteranGetTriggeredEvents(JNIEnv * /*env*/, jobject /*self*/, jlong player) { ServerObject const * const so = safe_cast(NetworkIdManager::getObjectById(NetworkId(player))); - CreatureObject const * const playerCreature = so ? so->asCreatureObject() : nullptr; + CreatureObject const * const playerCreature = so ? so->asCreatureObject() : NULL; if (playerCreature) { @@ -89,7 +89,7 @@ jobjectArray JNICALL ScriptMethodsVeteranNamespace::veteranGetTriggeredEvents(JN VeteranRewardManager::getTriggeredEventsIds(*playerCreature, eventsIds); if (eventsIds.empty()) - return nullptr; + return NULL; int i = 0; LocalObjectArrayRefPtr valueArray = createNewObjectArray(eventsIds.size(), JavaLibrary::getClsString()); @@ -102,7 +102,7 @@ jobjectArray JNICALL ScriptMethodsVeteranNamespace::veteranGetTriggeredEvents(JN return valueArray->getReturnValue(); } - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -110,7 +110,7 @@ jobjectArray JNICALL ScriptMethodsVeteranNamespace::veteranGetTriggeredEvents(JN jboolean JNICALL ScriptMethodsVeteranNamespace::veteranAccountFeatureIdRequest(JNIEnv * /*env*/, jobject /*self*/, jlong player) { ServerObject * const so = safe_cast(NetworkIdManager::getObjectById(NetworkId(player))); - CreatureObject * const playerCreature = so ? so->asCreatureObject() : nullptr; + CreatureObject * const playerCreature = so ? so->asCreatureObject() : NULL; if (playerCreature) { @@ -131,7 +131,7 @@ jboolean JNICALL ScriptMethodsVeteranNamespace::veteranAccountFeatureIdRequest(J jobjectArray JNICALL ScriptMethodsVeteranNamespace::veteranGetRewardChoicesDescriptions(JNIEnv * /*env*/, jobject /*self*/, jlong player, jstring event) { ServerObject const * const so = safe_cast(NetworkIdManager::getObjectById(NetworkId(player))); - CreatureObject const * const playerCreature = so ? so->asCreatureObject() : nullptr; + CreatureObject const * const playerCreature = so ? so->asCreatureObject() : NULL; if (playerCreature) { @@ -152,7 +152,7 @@ jobjectArray JNICALL ScriptMethodsVeteranNamespace::veteranGetRewardChoicesDescr } } - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -160,7 +160,7 @@ jobjectArray JNICALL ScriptMethodsVeteranNamespace::veteranGetRewardChoicesDescr jobjectArray JNICALL ScriptMethodsVeteranNamespace::veteranGetRewardChoicesTags(JNIEnv * /*env*/, jobject /*self*/, jlong player, jstring event) { ServerObject const * const so = safe_cast(NetworkIdManager::getObjectById(NetworkId(player))); - CreatureObject const * const playerCreature = so ? so->asCreatureObject() : nullptr; + CreatureObject const * const playerCreature = so ? so->asCreatureObject() : NULL; if (playerCreature) { @@ -181,7 +181,7 @@ jobjectArray JNICALL ScriptMethodsVeteranNamespace::veteranGetRewardChoicesTags( } } - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -189,7 +189,7 @@ jobjectArray JNICALL ScriptMethodsVeteranNamespace::veteranGetRewardChoicesTags( jboolean JNICALL ScriptMethodsVeteranNamespace::veteranClaimReward(JNIEnv * /*env*/, jobject /*self*/, jlong player, jstring event, jstring rewardTag) { ServerObject const * const so = safe_cast(NetworkIdManager::getObjectById(NetworkId(player))); - CreatureObject const * const playerCreature = so ? so->asCreatureObject() : nullptr; + CreatureObject const * const playerCreature = so ? so->asCreatureObject() : NULL; if (playerCreature) { @@ -227,7 +227,7 @@ jstring JNICALL ScriptMethodsVeteranNamespace::veteranGetEventAnnouncement(JNIEn return eventAnnouncement.getReturnValue(); } } - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -245,7 +245,7 @@ jstring JNICALL ScriptMethodsVeteranNamespace::veteranGetEventDescription(JNIEnv return eventDescription.getReturnValue(); } } - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -263,7 +263,7 @@ jstring JNICALL ScriptMethodsVeteranNamespace::veteranGetEventUrl(JNIEnv * /*env return temp2.getReturnValue(); } } - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -313,7 +313,7 @@ jboolean JNICALL ScriptMethodsVeteranNamespace::veteranIsItemAccountUniqueFeatur void JNICALL ScriptMethodsVeteranNamespace::veteranWriteAccountDataToObjvars(JNIEnv * /*env*/, jobject /*self*/, jlong player) { ServerObject * const so = safe_cast(NetworkIdManager::getObjectById(NetworkId(player))); - CreatureObject * const playerCreature = so ? so->asCreatureObject() : nullptr; + CreatureObject * const playerCreature = so ? so->asCreatureObject() : NULL; if (playerCreature) VeteranRewardManager::writeAccountDataToObjvars(*playerCreature); @@ -323,11 +323,11 @@ void JNICALL ScriptMethodsVeteranNamespace::veteranWriteAccountDataToObjvars(JNI jboolean JNICALL ScriptMethodsVeteranNamespace::veteranCanTradeInReward(JNIEnv *env, jobject self, jlong player, jlong item) { - CreatureObject const * playerCreature = nullptr; + CreatureObject const * playerCreature = NULL; if (!JavaLibrary::getObject(player, playerCreature) || !playerCreature) return JNI_FALSE; - ServerObject * itemObject = nullptr; + ServerObject * itemObject = NULL; if (!JavaLibrary::getObject(item, itemObject) || !itemObject) return JNI_FALSE; @@ -339,11 +339,11 @@ jboolean JNICALL ScriptMethodsVeteranNamespace::veteranCanTradeInReward(JNIEnv * void JNICALL ScriptMethodsVeteranNamespace::veteranTradeInReward(JNIEnv *env, jobject self, jlong player, jlong item) { - CreatureObject const * playerCreature = nullptr; + CreatureObject const * playerCreature = NULL; if (!JavaLibrary::getObject(player, playerCreature) || !playerCreature) return; - ServerObject * itemObject = nullptr; + ServerObject * itemObject = NULL; if (!JavaLibrary::getObject(item, itemObject) || !itemObject) return; @@ -355,11 +355,11 @@ void JNICALL ScriptMethodsVeteranNamespace::veteranTradeInReward(JNIEnv *env, jo void JNICALL ScriptMethodsVeteranNamespace::adjustSwgTcgAccountFeatureId(JNIEnv *env, jobject self, jlong player, jlong item, jint featureId, jint adjustment) { - CreatureObject const * playerCreature = nullptr; + CreatureObject const * playerCreature = NULL; if (!JavaLibrary::getObject(player, playerCreature) || !playerCreature) return; - ServerObject * itemObject = nullptr; + ServerObject * itemObject = NULL; if (!JavaLibrary::getObject(item, itemObject) || !itemObject) return; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsWaypoint.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsWaypoint.cpp index 18241735..e9b3c546 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsWaypoint.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsWaypoint.cpp @@ -306,7 +306,7 @@ jobject JNICALL ScriptMethodsWaypointNamespace::getWaypointRegion(JNIEnv * env, if(w.isValid()) { const Region * region = RegionMaster::getSmallestVisibleRegionAtPoint(w.getLocation().getSceneId(), w.getLocation().getCoordinates().x, w.getLocation().getCoordinates().z); - if (region != nullptr) + if (region != NULL) { LocalRefPtr result; if (ScriptConversion::convert(*region, result)) diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsWorldInfo.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsWorldInfo.cpp index ca3d5b8d..3cc7c024 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsWorldInfo.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsWorldInfo.cpp @@ -182,7 +182,7 @@ const JNINativeMethod NATIVES[] = { * @param location location that is the center of the search area * @param range radius of search area * - * @return array of obj_ids of the objects in range, or nullptr on error + * @return array of obj_ids of the objects in range, or null on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getObjectsInRangeLocation(JNIEnv *env, jobject self, jobject location, jfloat range) { @@ -212,7 +212,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getObjectsInRangeLocation(JN * @param location object that is the center of the search area * @param range radius of search area * - * @return array of obj_ids of the objects in range, or nullptr on error + * @return array of obj_ids of the objects in range, or null on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getObjectsInRangeObject(JNIEnv *env, jobject self, jlong object, jfloat range) { @@ -242,7 +242,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getObjectsInRangeObject(JNIE * @param location location that is the center of the search area * @param range radius of search area * - * @return array of obj_ids of the objects in range, or nullptr on error + * @return array of obj_ids of the objects in range, or null on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesInRangeLocation(JNIEnv *env, jobject self, jobject location, jfloat range) { @@ -271,7 +271,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesInRangeLocation( * @param location object that is the center of the search area * @param range radius of search area * - * @return array of obj_ids of the objects in range, or nullptr on error + * @return array of obj_ids of the objects in range, or null on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesInRangeObject(JNIEnv *env, jobject self, jlong object, jfloat range) { @@ -302,7 +302,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesInRangeObject(JN * @param type * @param mask * - * @return array of obj_ids of the objects in range, or nullptr on error + * @return array of obj_ids of the objects in range, or null on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfNicheInRangeLocation(JNIEnv *env, jobject self, jobject location, jfloat range, jint type, jint mask) { @@ -333,7 +333,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfNicheInRangeLo * @param type * @param mask * - * @return array of obj_ids of the objects in range, or nullptr on error + * @return array of obj_ids of the objects in range, or null on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfNicheInRangeObject(JNIEnv *env, jobject self, jlong object, jfloat range, jint type, jint mask) { @@ -363,7 +363,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfNicheInRangeOb * @param range radius of search area * @param species * - * @return array of obj_ids of the objects in range, or nullptr on error + * @return array of obj_ids of the objects in range, or null on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfSpeciesInRangeLocation(JNIEnv *env, jobject self, jobject location, jfloat range, jint species) { @@ -393,7 +393,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfSpeciesInRange * @param range radius of search area * @param species * - * @return array of obj_ids of the objects in range, or nullptr on error + * @return array of obj_ids of the objects in range, or null on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfSpeciesInRangeObject(JNIEnv *env, jobject self, jlong object, jfloat range, jint species) { @@ -424,7 +424,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfSpeciesInRange * @param species * @param race * - * @return array of obj_ids of the objects in range, or nullptr on error + * @return array of obj_ids of the objects in range, or null on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfRaceInRangeLocation(JNIEnv *env, jobject self, jobject location, jfloat range, jint species, jint race) { @@ -455,7 +455,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfRaceInRangeLoc * @param species * @param race * - * @return array of obj_ids of the objects in range, or nullptr on error + * @return array of obj_ids of the objects in range, or null on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfRaceInRangeObject(JNIEnv *env, jobject self, jlong object, jfloat range, jint species, jint race) { @@ -484,7 +484,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfRaceInRangeObj * @param location location that is the center of the search area * @param range radius of search area * - * @return array of obj_ids of the objects in range, or nullptr on error + * @return array of obj_ids of the objects in range, or null on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getNonCreaturesInRangeLocation(JNIEnv *env, jobject self, jobject location, jfloat range) { @@ -513,7 +513,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getNonCreaturesInRangeLocati * @param location object that is the center of the search area * @param range radius of search area * - * @return array of obj_ids of the objects in range, or nullptr on error + * @return array of obj_ids of the objects in range, or null on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getNonCreaturesInRangeObject(JNIEnv *env, jobject self, jlong object, jfloat range) { @@ -542,7 +542,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getNonCreaturesInRangeObject * @param location location that is the center of the search area * @param range radius of search area * - * @return array of obj_ids of the objects in range, or nullptr on error + * @return array of obj_ids of the objects in range, or null on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getNPCsInRangeLocation(JNIEnv *env, jobject self, jobject location, jfloat range) { @@ -571,7 +571,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getNPCsInRangeLocation(JNIEn * @param location object that is the center of the search area * @param range radius of search area * - * @return array of obj_ids of the objects in range, or nullptr on error + * @return array of obj_ids of the objects in range, or null on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getNPCsInRangeObject(JNIEnv *env, jobject self, jlong object, jfloat range) { @@ -600,7 +600,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getNPCsInRangeObject(JNIEnv * @param location location that is the center of the search area * @param range radius of search area * - * @return array of obj_ids of the objects in range, or nullptr on error + * @return array of obj_ids of the objects in range, or null on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getPlayerCreaturesInRangeLocation(JNIEnv *env, jobject self, jobject location, jfloat range) { @@ -629,7 +629,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getPlayerCreaturesInRangeLoc * @param location object that is the center of the search area * @param range radius of search area * - * @return array of obj_ids of the objects in range, or nullptr on error + * @return array of obj_ids of the objects in range, or null on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getPlayerCreaturesInRangeObject(JNIEnv *env, jobject self, jlong object, jfloat range) { @@ -658,7 +658,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getPlayerCreaturesInRangeObj * @param env Java environment * @param self class calling this function * - * @return array of obj_ids of the objects in range, or nullptr on error + * @return array of obj_ids of the objects in range, or null on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getObjectsInCone(JNIEnv *env, jobject self, jlong coneCenterObjectId, jlong coneDirectionObjectId, jfloat range, jfloat angle) { @@ -698,7 +698,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getObjectsInCone(JNIEnv *env * @param env Java environment * @param self class calling this function * - * @return array of obj_ids of the objects in range, or nullptr on error + * @return array of obj_ids of the objects in range, or null on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getObjectsInConeLocation(JNIEnv *env, jobject self, jlong coneCenterObjectId, jobject coneDirectionLocation, jfloat range, jfloat angle) { @@ -738,7 +738,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getObjectsInConeLocation(JNI * @param env Java environment * @param self class calling this function * - * @return array of obj_ids of the objects in range, or nullptr on error + * @return array of obj_ids of the objects in range, or null on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesInCone(JNIEnv *env, jobject self, jlong coneCenterObjectId, jlong coneDirectionObjectId, jfloat range, jfloat angle) { @@ -779,7 +779,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesInCone(JNIEnv *e * @param env Java environment * @param self class calling this function * - * @return array of obj_ids of the objects in range, or nullptr on error + * @return array of obj_ids of the objects in range, or null on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesInConeLocation(JNIEnv *env, jobject self, jlong coneCenterObjectId, jobject coneDirectionLocation, jfloat range, jfloat angle) { @@ -820,7 +820,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesInConeLocation(J * @param env Java environment * @param self class calling this function * - * @return array of obj_ids of the objects in range, or nullptr on error + * @return array of obj_ids of the objects in range, or null on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfNicheInCone(JNIEnv *env, jobject self, jlong coneCenterObjectId, jlong coneDirectionObjectId, jfloat range, jfloat angle, jint niche, jint mask) { @@ -860,7 +860,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfNicheInCone(JN * @param env Java environment * @param self class calling this function * - * @return array of obj_ids of the objects in range, or nullptr on error + * @return array of obj_ids of the objects in range, or null on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfSpeciesInCone(JNIEnv *env, jobject self, jlong coneCenterObjectId, jlong coneDirectionObjectId, jfloat range, jfloat angle, jint species) { @@ -900,7 +900,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfSpeciesInCone( * @param env Java environment * @param self class calling this function * - * @return array of obj_ids of the objects in range, or nullptr on error + * @return array of obj_ids of the objects in range, or null on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfRaceInCone(JNIEnv *env, jobject self, jlong coneCenterObjectId, jlong coneDirectionObjectId, jfloat range, jfloat angle, jint species, jint race) { @@ -940,7 +940,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfRaceInCone(JNI * @param env Java environment * @param self class calling this function * - * @return array of obj_ids of the objects in range, or nullptr on error + * @return array of obj_ids of the objects in range, or null on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getNonCreaturesInCone(JNIEnv *env, jobject self, jlong coneCenterObjectId, jlong coneDirectionObjectId, jfloat range, jfloat angle) { @@ -980,7 +980,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getNonCreaturesInCone(JNIEnv * @param env Java environment * @param self class calling this function * - * @return array of obj_ids of the objects in range, or nullptr on error + * @return array of obj_ids of the objects in range, or null on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getNPCsInCone(JNIEnv *env, jobject self, jlong coneCenterObjectId, jlong coneDirectionObjectId, jfloat range, jfloat angle) { @@ -1020,7 +1020,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getNPCsInCone(JNIEnv *env, j * @param env Java environment * @param self class calling this function * - * @return array of obj_ids of the objects in range, or nullptr on error + * @return array of obj_ids of the objects in range, or null on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getPlayerCreaturesInCone(JNIEnv *env, jobject self, jlong coneCenterObjectId, jlong coneDirectionObjectId, jfloat range, jfloat angle) { @@ -1169,7 +1169,7 @@ jlong JNICALL ScriptMethodsWorldInfoNamespace::getClosestMobile(JNIEnv *env, job return 0; ServerObject * npc = ServerWorld::findClosestNPC(target, radius); - if (npc == nullptr) + if (npc == NULL) return 0; return (npc->getNetworkId()).getValue(); } @@ -1184,7 +1184,7 @@ jlong JNICALL ScriptMethodsWorldInfoNamespace::getClosestPlayer(JNIEnv *env, job return 0; ServerObject * player = ServerWorld::findClosestPlayer(target, radius); - if (player == nullptr) + if (player == NULL) return 0; return (player->getNetworkId()).getValue(); } @@ -1209,7 +1209,7 @@ jlong JNICALL ScriptMethodsWorldInfoNamespace::getFirstObjectWithScript(JNIEnv * for (ResultsType::iterator i=results.begin(); i!=results.end(); ++i) { - if (*i != nullptr && (*i)->getScriptObject()->hasScript(scriptName)) + if (*i != NULL && (*i)->getScriptObject()->hasScript(scriptName)) return ((*i)->getNetworkId()).getValue(); } @@ -1237,7 +1237,7 @@ jlong JNICALL ScriptMethodsWorldInfoNamespace::getFirstObjectWithObjVar(JNIEnv * for (ResultsType::iterator i=results.begin(); i!=results.end(); ++i) { - if (*i != nullptr && (*i)->getObjVars().hasItem(objvarName)) + if (*i != NULL && (*i)->getObjVars().hasItem(objvarName)) return ((*i)->getNetworkId()).getValue(); } @@ -1265,7 +1265,7 @@ jlong JNICALL ScriptMethodsWorldInfoNamespace::getFirstObjectWithTemplate(JNIEnv for (ResultsType::iterator i=results.begin(); i!=results.end(); ++i) { - if (*i != nullptr && templateStr == (*i)->getTemplateName()) + if (*i != NULL && templateStr == (*i)->getTemplateName()) return ((*i)->getNetworkId()).getValue(); } @@ -1434,7 +1434,7 @@ jstring JNICALL ScriptMethodsWorldInfoNamespace::getNameForPlanetObject(JNIEnv * } } - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -1499,7 +1499,7 @@ jobject JNICALL ScriptMethodsWorldInfoNamespace::getValidLocation(JNIEnv *env, j // Determine if it's a valid point, and if not search for another one. - bool isValid = !CollisionWorld::query( Sphere(corralPoint,objectRadius),nullptr); + bool isValid = !CollisionWorld::query( Sphere(corralPoint,objectRadius),NULL); // ---------- @@ -1517,14 +1517,14 @@ jobject JNICALL ScriptMethodsWorldInfoNamespace::getValidLocation(JNIEnv *env, j // We failed to find a valid location - return nullptr; + return NULL; } // ---------------------------------------------------------------------- jboolean JNICALL ScriptMethodsWorldInfoNamespace::getCollidesWithObject(JNIEnv * env, jobject self, jobject jlocation, jfloat jradius) { - if (jlocation == nullptr) + if (jlocation == NULL) return JNI_FALSE; float const radius = jradius; @@ -1532,7 +1532,7 @@ jboolean JNICALL ScriptMethodsWorldInfoNamespace::getCollidesWithObject(JNIEnv * if (!ScriptConversion::convertWorld(jlocation, location)) return JNI_FALSE; - bool const result = CollisionWorld::query(Sphere(location, radius), nullptr); + bool const result = CollisionWorld::query(Sphere(location, radius), NULL); if(result) return JNI_TRUE; @@ -1556,7 +1556,7 @@ jboolean JNICALL ScriptMethodsWorldInfoNamespace::canSee(JNIEnv *env, jobject se { UNREF(self); - const ServerObject * sourceObject = nullptr; + const ServerObject * sourceObject = NULL; if (!JavaLibrary::getObject(source, sourceObject)) { NetworkId id(source); @@ -1572,7 +1572,7 @@ jboolean JNICALL ScriptMethodsWorldInfoNamespace::canSee(JNIEnv *env, jobject se return JNI_TRUE; } - const ServerObject * targetObject = nullptr; + const ServerObject * targetObject = NULL; if (!JavaLibrary::getObject(target, targetObject)) { NetworkId id(target); @@ -1608,7 +1608,7 @@ jboolean JNICALL ScriptMethodsWorldInfoNamespace::canSeeLocation(JNIEnv *env, jo { UNREF(self); - const ServerObject * sourceObject = nullptr; + const ServerObject * sourceObject = NULL; if (!JavaLibrary::getObject(source, sourceObject)) { NetworkId id(source); @@ -1640,11 +1640,11 @@ jboolean JNICALL ScriptMethodsWorldInfoNamespace::canManipulate(JNIEnv *env, job { UNREF(self); - const CreatureObject * sourceObject = nullptr; + const CreatureObject * sourceObject = NULL; if (!JavaLibrary::getObject(player, sourceObject)) return JNI_FALSE; - const ServerObject * targetObject = nullptr; + const ServerObject * targetObject = NULL; if (!JavaLibrary::getObject(target, targetObject)) return JNI_FALSE; @@ -1663,7 +1663,7 @@ jboolean JNICALL ScriptMethodsWorldInfoNamespace::canManipulate(JNIEnv *env, job * @param performer performer we are looking for listeners of * @param range radius of search area * - * @return array of obj_ids of the objects in range, or nullptr on error + * @return array of obj_ids of the objects in range, or null on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getPerformanceListenersInRange(JNIEnv *env, jobject self, jlong performer, jfloat range) { @@ -1697,7 +1697,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getPerformanceListenersInRan * @param performer performer we are looking for watchers of * @param range radius of search area * - * @return array of obj_ids of the objects in range, or nullptr on error + * @return array of obj_ids of the objects in range, or null on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getPerformanceWatchersInRange(JNIEnv *env, jobject self, jlong performer, jfloat range) { diff --git a/engine/server/library/serverScript/src/shared/ScriptParamArchive.cpp b/engine/server/library/serverScript/src/shared/ScriptParamArchive.cpp index 46799842..967939fb 100755 --- a/engine/server/library/serverScript/src/shared/ScriptParamArchive.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptParamArchive.cpp @@ -56,7 +56,7 @@ void put(ByteStream & target, const std::vector *> { const std::vector * inner = source[i]; signed int innerLength = 0; - if (inner != nullptr) + if (inner != NULL) innerLength = inner->size(); put(target, innerLength); for (int j = 0; j < innerLength; ++j) diff --git a/engine/server/library/serverScript/src/shared/ScriptParameters.cpp b/engine/server/library/serverScript/src/shared/ScriptParameters.cpp index 3ea2df78..78c5fde4 100755 --- a/engine/server/library/serverScript/src/shared/ScriptParameters.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptParameters.cpp @@ -207,7 +207,7 @@ void ScriptParams::addParam(bool param, const std::string & paramName, bool owne * This call occurs because of a conversion of a datatype passing through this function from std::string to Unicode::String. * Basically, most times it is called with std::string the c_str() function is called. Since this is still valid when the * type is changed to Unicode::String and the const Unicode::unicode_char_t * is successfully auto-converted to const char * - * you wind up having a nullptr string when it get explicitly converted to const char * on the other side. So, this should never + * you wind up having a NULL string when it get explicitly converted to const char * on the other side. So, this should never * be called except in error. * void ScriptParams::addParam(const Unicode::unicode_char_t * param, const std::string & paramName, bool owned) @@ -659,7 +659,7 @@ bool ScriptParams::changeParam(int index, const StringId & param, bool owned) if (p.m_type != Param::STRING_ID) return false; - if (p.m_param.sidParam == nullptr) + if (p.m_param.sidParam == NULL) return false; if (p.m_owned) diff --git a/engine/server/library/serverScript/src/shared/ScriptParameters.h b/engine/server/library/serverScript/src/shared/ScriptParameters.h index ab7468f2..98aa0870 100755 --- a/engine/server/library/serverScript/src/shared/ScriptParameters.h +++ b/engine/server/library/serverScript/src/shared/ScriptParameters.h @@ -311,7 +311,7 @@ inline const stdvector::fwd & ScriptParams::getLocationArrayPara inline const NetworkId & ScriptParams::getObjIdParam(int index) const { - if (m_params[index].m_param.oidParam != nullptr) + if (m_params[index].m_param.oidParam != NULL) return *m_params[index].m_param.oidParam; return NetworkId::cms_invalid; } // ScriptParams::getObjIdParam diff --git a/engine/server/library/serverUtility/src/shared/AdminAccountManager.cpp b/engine/server/library/serverUtility/src/shared/AdminAccountManager.cpp index e4075721..85656cb2 100755 --- a/engine/server/library/serverUtility/src/shared/AdminAccountManager.cpp +++ b/engine/server/library/serverUtility/src/shared/AdminAccountManager.cpp @@ -16,7 +16,7 @@ DataTable * AdminAccountManager::ms_adminTable = 0; bool AdminAccountManager::ms_installed = false; -std::string *AdminAccountManager::ms_dataTableName = nullptr; +std::string *AdminAccountManager::ms_dataTableName = NULL; //----------------------------------------------------------------------- @@ -42,7 +42,7 @@ void AdminAccountManager::remove() DataTableManager::close(*ms_dataTableName); ms_installed = false; delete ms_dataTableName; - ms_dataTableName = nullptr; + ms_dataTableName = NULL; } //----------------------------------------------------------------------- diff --git a/engine/server/library/serverUtility/src/shared/ChatLogManager.cpp b/engine/server/library/serverUtility/src/shared/ChatLogManager.cpp index e5283c05..5f3cd77c 100755 --- a/engine/server/library/serverUtility/src/shared/ChatLogManager.cpp +++ b/engine/server/library/serverUtility/src/shared/ChatLogManager.cpp @@ -135,7 +135,7 @@ void ChatLogManagerNamespace::addChatLogEntry(Unicode::String const &fromPlayer, } else { - Unicode::String const *finalMessage = nullptr; + Unicode::String const *finalMessage = NULL; // Add the new string to the master message list, or if it already exists, just increase the reference count diff --git a/engine/server/library/serverUtility/src/shared/ClusterWideDataManagerList.cpp b/engine/server/library/serverUtility/src/shared/ClusterWideDataManagerList.cpp index cfda04ff..659f1c61 100755 --- a/engine/server/library/serverUtility/src/shared/ClusterWideDataManagerList.cpp +++ b/engine/server/library/serverUtility/src/shared/ClusterWideDataManagerList.cpp @@ -36,7 +36,7 @@ namespace ClusterWideDataManagerListNamespace struct QueuedRequestInfo { - QueuedRequestInfo() : processId(0), requestTime(0.0), request(nullptr), server(nullptr) {}; + QueuedRequestInfo() : processId(0), requestTime(0.0), request(NULL), server(NULL) {}; unsigned long processId; float requestTime; @@ -272,7 +272,7 @@ void ClusterWideDataManagerList::onGameServerDisconnect(unsigned long const proc ClusterWideDataManagerListNamespace::ServerLockListConstRange range = ClusterWideDataManagerListNamespace::s_serverLockList.equal_range(processId); - ClusterWideDataManager * manager = nullptr; + ClusterWideDataManager * manager = NULL; for (ClusterWideDataManagerListNamespace::ServerLockList::const_iterator iter2 = range.first; iter2 != range.second; ++iter2) { manager = ClusterWideDataManagerListNamespace::getClusterWideDataManager((iter2->second).managerName, false); @@ -327,7 +327,7 @@ ClusterWideDataManager * ClusterWideDataManagerListNamespace::getClusterWideData return manager; } - return nullptr; + return NULL; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverUtility/src/shared/FreeCtsDataTable.cpp b/engine/server/library/serverUtility/src/shared/FreeCtsDataTable.cpp index 9f802549..3be9fe88 100755 --- a/engine/server/library/serverUtility/src/shared/FreeCtsDataTable.cpp +++ b/engine/server/library/serverUtility/src/shared/FreeCtsDataTable.cpp @@ -205,7 +205,7 @@ void FreeCtsDataTableNamespace::loadData() tokensSourceClusterList.clear(); tokensTargetClusterList.clear(); - if (Unicode::tokenize(Unicode::narrowToWide(sourceClusterList), tokensSourceClusterList, &clusterListDelimiters, nullptr) && (tokensSourceClusterList.size() > 0) && Unicode::tokenize(Unicode::narrowToWide(targetClusterList), tokensTargetClusterList, &clusterListDelimiters, nullptr) && (tokensTargetClusterList.size() > 0)) + if (Unicode::tokenize(Unicode::narrowToWide(sourceClusterList), tokensSourceClusterList, &clusterListDelimiters, NULL) && (tokensSourceClusterList.size() > 0) && Unicode::tokenize(Unicode::narrowToWide(targetClusterList), tokensTargetClusterList, &clusterListDelimiters, NULL) && (tokensTargetClusterList.size() > 0)) { for (tokensIter = tokensTargetClusterList.begin(); tokensIter != tokensTargetClusterList.end(); ++tokensIter) freeCtsInfo.targetCluster[Unicode::wideToNarrow(Unicode::toLower(*tokensIter))] = Unicode::wideToNarrow(*tokensIter); @@ -258,9 +258,9 @@ void FreeCtsDataTableNamespace::loadData() time_t FreeCtsDataTableNamespace::convertToEpoch(int const year, int const month, int const day, int const hour, int const minute, int const second) { - time_t const timeNow = ::time(nullptr); + time_t const timeNow = ::time(NULL); struct tm * timeinfo = ::localtime(&timeNow); - FATAL(!timeinfo, ("::localtime() returns nullptr")); + FATAL(!timeinfo, ("::localtime() returns NULL")); // greater than zero if Daylight Saving Time is in effect, // zero if Daylight Saving Time is not in effect, @@ -288,7 +288,7 @@ time_t FreeCtsDataTableNamespace::convertToEpoch(int const year, int const month // "opposite" standard/daylight period than the current time, // and it should be OK timeinfo = ::localtime(&convertedTime); - FATAL(!timeinfo, ("::localtime() returns nullptr")); + FATAL(!timeinfo, ("::localtime() returns NULL")); if ((timeinfo->tm_year != (year - 1900)) || (timeinfo->tm_mon != (month - 1)) || @@ -342,9 +342,9 @@ FreeCtsDataTable::FreeCtsInfo const * FreeCtsDataTable::isFreeCtsSourceCluster(s loadData(); if (s_freeCtsList.empty()) - return nullptr; + return NULL; - time_t const timeNow = ::time(nullptr); + time_t const timeNow = ::time(NULL); std::pair::const_iterator, std::multimap::const_iterator> range = s_freeCtsList.equal_range(Unicode::toLower(sourceCluster)); for (std::multimap::const_iterator iter = range.first; iter != range.second; ++iter) { @@ -355,7 +355,7 @@ FreeCtsDataTable::FreeCtsInfo const * FreeCtsDataTable::isFreeCtsSourceCluster(s return &(iter->second); } - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -366,15 +366,15 @@ FreeCtsDataTable::FreeCtsInfo const * FreeCtsDataTable::wouldCharacterTransferBe loadData(); if (s_freeCtsList.empty()) - return nullptr; + return NULL; if ((sourceCharacterCreateTime <= 0) && !ignoreTimeRestriction) - return nullptr; + return NULL; if (sourceStationId != targetStationId) - return nullptr; + return NULL; - time_t const timeNow = ::time(nullptr); + time_t const timeNow = ::time(NULL); std::string const lowerTargetCluster(Unicode::toLower(targetCluster)); std::pair::const_iterator, std::multimap::const_iterator> range = s_freeCtsList.equal_range(Unicode::toLower(sourceCluster)); @@ -396,7 +396,7 @@ FreeCtsDataTable::FreeCtsInfo const * FreeCtsDataTable::wouldCharacterTransferBe } } - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -407,12 +407,12 @@ FreeCtsDataTable::FreeCtsInfo const * FreeCtsDataTable::getFreeCtsInfoForCharact loadData(); if (s_freeCtsList.empty()) - return nullptr; + return NULL; if ((sourceCharacterCreateTime <= 0) && !ignoreTimeRestriction) - return nullptr; + return NULL; - time_t const timeNow = ::time(nullptr); + time_t const timeNow = ::time(NULL); std::pair::const_iterator, std::multimap::const_iterator> range = s_freeCtsList.equal_range(Unicode::toLower(sourceCluster)); for (std::multimap::const_iterator iter = range.first; iter != range.second; ++iter) { @@ -429,5 +429,5 @@ FreeCtsDataTable::FreeCtsInfo const * FreeCtsDataTable::getFreeCtsInfoForCharact return &(iter->second); } - return nullptr; + return NULL; } diff --git a/engine/shared/application/DataTableTool/src/shared/DataTableTool.cpp b/engine/shared/application/DataTableTool/src/shared/DataTableTool.cpp index c3dcaf32..29d396da 100755 --- a/engine/shared/application/DataTableTool/src/shared/DataTableTool.cpp +++ b/engine/shared/application/DataTableTool/src/shared/DataTableTool.cpp @@ -245,7 +245,7 @@ void DataTableTool::createOutputDirectoryForFile(const std::string & fileName) std::string directoryName(fileName, 0, slashPos); #if defined(PLATFORM_WIN32) - int result = CreateDirectory(directoryName.c_str(), nullptr); + int result = CreateDirectory(directoryName.c_str(), NULL); #elif defined(PLATFORM_LINUX) // make sure slashes are forward { diff --git a/engine/shared/application/TemplateCompiler/src/shared/TemplateCompiler.cpp b/engine/shared/application/TemplateCompiler/src/shared/TemplateCompiler.cpp index 2a3658bb..8611bb0b 100755 --- a/engine/shared/application/TemplateCompiler/src/shared/TemplateCompiler.cpp +++ b/engine/shared/application/TemplateCompiler/src/shared/TemplateCompiler.cpp @@ -46,7 +46,7 @@ static const int SUBMIT_NO_FILE_ERR = 17; // need to add file before submitting // virtual ~MyPerforceUser() {} // virtual void HandleError( Error *err ) // { -// if (err != nullptr && err->Test()) +// if (err != NULL && err->Test()) // { // m_errorOccurred = true; // m_lastError = err->GetGeneric(); @@ -154,7 +154,7 @@ int generateTemplate(File &definitionFp, File &templateFp) // we now need to move down the template definition heiarchy and write the // parameters of the base class - Filename basename(nullptr, definitionFp.getFilename().getPath().c_str(), + Filename basename(NULL, definitionFp.getFilename().getPath().c_str(), TemplateDefinitionFile.getBaseFilename().c_str(), TEMPLATE_DEFINITION_EXTENSION); if (basename.getName().size() == 0) return 0; @@ -185,8 +185,8 @@ int generateTemplate(File &definitionFp, File &templateFp) int generateTemplate(const char *definitionFile, const char *templateFile) { // check filename extensions - Filename defFile(nullptr, nullptr, definitionFile, TEMPLATE_DEFINITION_EXTENSION); - Filename temFile(nullptr, nullptr, templateFile, TEMPLATE_EXTENSION); + Filename defFile(NULL, NULL, definitionFile, TEMPLATE_DEFINITION_EXTENSION); + Filename temFile(NULL, NULL, templateFile, TEMPLATE_EXTENSION); File definitionFp; int i = 0; @@ -231,8 +231,8 @@ int generateTemplate(const char *definitionFile, const char *templateFile) int deriveTemplate(const char *baseFile, const char *templateFile) { // check filename extensions - Filename basFile(nullptr, nullptr, baseFile, TEMPLATE_EXTENSION); - Filename temFile(nullptr, nullptr, templateFile, TEMPLATE_EXTENSION); + Filename basFile(NULL, NULL, baseFile, TEMPLATE_EXTENSION); + Filename temFile(NULL, NULL, templateFile, TEMPLATE_EXTENSION); File basFp; if (!basFp.open(basFile, "rt")) @@ -263,7 +263,7 @@ int compileTemplate(const char *filename) { TpfFile templateFile; - Filename templateFileName(nullptr, nullptr, filename, TEMPLATE_EXTENSION); + Filename templateFileName(NULL, NULL, filename, TEMPLATE_EXTENSION); return templateFile.makeIffFiles(templateFileName); } // compileTemplate @@ -279,7 +279,7 @@ int verifyTemplate(const char *filename) TpfFile templateFile; printf("Verifying %s: ", filename); - Filename templateFileName(nullptr, nullptr, filename, TEMPLATE_EXTENSION); + Filename templateFileName(NULL, NULL, filename, TEMPLATE_EXTENSION); int result = templateFile.loadTemplate(templateFileName); if (result == 0) printf("file ok"); @@ -299,7 +299,7 @@ int updateTemplate(const char *filename) { TpfFile templateFile; - Filename templateFileName(nullptr, nullptr, filename, TEMPLATE_EXTENSION); + Filename templateFileName(NULL, NULL, filename, TEMPLATE_EXTENSION); return templateFile.updateTemplate(templateFileName); } // updateTemplate */ @@ -317,7 +317,7 @@ TpfFile templateFile; //Error e; // // // check filename extensions -// Filename templateFileName(nullptr, nullptr, filename, TEMPLATE_EXTENSION); +// Filename templateFileName(NULL, NULL, filename, TEMPLATE_EXTENSION); // Filename iffFileName = templateFileName; // iffFileName.setExtension(IFF_EXTENSION); // @@ -345,7 +345,7 @@ TpfFile templateFile; // IGNORE_RETURN(templateFile.loadTemplate(templateFileName)); // // // check out the client template iff file -// Filename iffName(nullptr, templateFile.getIffPath().c_str(), iffFileName, IFF_EXTENSION); +// Filename iffName(NULL, templateFile.getIffPath().c_str(), iffFileName, IFF_EXTENSION); // commands[1] = iffName; // client.SetArgv( 1, const_cast(&commands[1]) ); // client.Run( commands[0], &ui ); @@ -370,7 +370,7 @@ TpfFile templateFile; //Error e; // // // check filename extensions -// Filename templateFileName(nullptr, nullptr, filename, TEMPLATE_EXTENSION); +// Filename templateFileName(NULL, NULL, filename, TEMPLATE_EXTENSION); // Filename iffFileName = templateFileName; // iffFileName.setExtension(IFF_EXTENSION); // @@ -424,7 +424,7 @@ TpfFile templateFile; // return -1; // // // add the client iff file -// Filename iffName(nullptr, templateFile.getIffPath().c_str(), iffFileName, nullptr); +// Filename iffName(NULL, templateFile.getIffPath().c_str(), iffFileName, NULL); // commands[1] = iffName; // client.SetArgv( 1, const_cast(&commands[1]) ); // client.Run( commands[0], &ui ); @@ -591,7 +591,7 @@ int main(int argc, char *argv[ ]) SetupSharedFoundation::Data data(SetupSharedFoundation::Data::D_console); #ifdef WIN32 char buffer[1024]; - GetModuleFileName(GetModuleHandle(nullptr), buffer, 1024); + GetModuleFileName(GetModuleHandle(NULL), buffer, 1024); Filename configName; configName.setName(buffer); configName.setName("templateCompiler.cfg"); @@ -607,7 +607,7 @@ int main(int argc, char *argv[ ]) // setup the random number generator // @todo need a better seed - SetupSharedRandom::install(static_cast(time(nullptr))); + SetupSharedRandom::install(static_cast(time(NULL))); // install templates SetupSharedTemplate::install(); diff --git a/engine/shared/application/TemplateDefinitionCompiler/src/shared/core/TemplateDefinitionCompiler.cpp b/engine/shared/application/TemplateDefinitionCompiler/src/shared/core/TemplateDefinitionCompiler.cpp index a9af01dd..f95e5c6c 100755 --- a/engine/shared/application/TemplateDefinitionCompiler/src/shared/core/TemplateDefinitionCompiler.cpp +++ b/engine/shared/application/TemplateDefinitionCompiler/src/shared/core/TemplateDefinitionCompiler.cpp @@ -30,7 +30,7 @@ //============================================================================== // file variables -const TemplateData *currentTemplateData = nullptr; +const TemplateData *currentTemplateData = NULL; //============================================================================== @@ -118,7 +118,7 @@ File fp; return; File temp_fp; - if (!temp_fp.open(tmpnam(nullptr), "wt")) + if (!temp_fp.open(tmpnam(NULL), "wt")) { fprintf(stderr, "error opening temp file for template header " "replacement [%s]\n", temp_fp.getFilename().getFullFilename().c_str()); @@ -244,7 +244,7 @@ int result; } File temp_fp; - if (!temp_fp.open(tmpnam(nullptr), "wt")) + if (!temp_fp.open(tmpnam(NULL), "wt")) { fprintf(stderr, "error opening temp file for template source " "replacement [%s]\n", temp_fp.getFilename().getFullFilename().c_str()); @@ -337,8 +337,8 @@ int result; // std::string oldTemplateName = tdfFile.getTemplateName(); // std::string oldBaseName = tdfFile.getBaseName(); - Filename fullName(nullptr, path.getPath().c_str(), tdfFile.getTemplateName().c_str(), - nullptr); + Filename fullName(NULL, path.getPath().c_str(), tdfFile.getTemplateName().c_str(), + NULL); writeTemplateHeader(tdfFile, fullName); result = writeTemplateSource(tdfFile, fullName); @@ -397,7 +397,7 @@ TemplateDefinitionFile tdfFile; //Error e; // // // check filename extensions -// Filename templateFileName(nullptr, nullptr, filename, TEMPLATE_DEFINITION_EXTENSION); +// Filename templateFileName(NULL, NULL, filename, TEMPLATE_DEFINITION_EXTENSION); // // // Connect to Perforce server // client.Init( &e ); @@ -433,7 +433,7 @@ TemplateDefinitionFile tdfFile; // if (tdfFile.getPath().getFullFilename().size() != 0) // { // // check out the source files -// Filename sourceName(nullptr, tdfFile.getPath().getPath().c_str(), +// Filename sourceName(NULL, tdfFile.getPath().getPath().c_str(), // tdfFile.getTemplateName().c_str(), "cpp"); // commands[1] = sourceName; // client.SetArgv( 1, const_cast(&commands[1]) ); @@ -453,7 +453,7 @@ TemplateDefinitionFile tdfFile; // std::string compilerFilename; // compilerFilename = EnumLocationTypes[tdfFile.getTemplateLocation()] + // filenameLowerToUpper(templateFileName.getName()); -// Filename compilerName(nullptr, tdfFile.getCompilerPath().getPath().c_str(), +// Filename compilerName(NULL, tdfFile.getCompilerPath().getPath().c_str(), // tdfFile.getTemplateName().c_str(), "cpp"); // commands[1] = compilerName; // client.SetArgv( 1, const_cast(&commands[1]) ); @@ -485,7 +485,7 @@ TemplateDefinitionFile tdfFile; //Error e; // // // check filename extensions -// Filename templateFileName(nullptr, nullptr, filename, TEMPLATE_DEFINITION_EXTENSION); +// Filename templateFileName(NULL, NULL, filename, TEMPLATE_DEFINITION_EXTENSION); // // // find the client and server paths // File fp(templateFileName, "rt"); @@ -546,7 +546,7 @@ TemplateDefinitionFile tdfFile; // if (tdfFile.getPath().getFullFilename().size() != 0) // { // // check in the source files -// Filename sourceName(nullptr, tdfFile.getPath().getPath().c_str(), +// Filename sourceName(NULL, tdfFile.getPath().getPath().c_str(), // tdfFile.getTemplateName().c_str(), "cpp"); // commands[1] = sourceName; // client.SetArgv( 1, const_cast(&commands[1]) ); @@ -563,7 +563,7 @@ TemplateDefinitionFile tdfFile; // if (tdfFile.getCompilerPath().getFullFilename().size() != 0) // { // // check in the compiler source files -// Filename compilerName(nullptr, tdfFile.getCompilerPath().getPath().c_str(), +// Filename compilerName(NULL, tdfFile.getCompilerPath().getPath().c_str(), // tdfFile.getTemplateName().c_str(), "cpp"); // commands[1] = compilerName; // client.SetArgv( 1, const_cast(&commands[1]) ); @@ -669,7 +669,7 @@ int main(int argc, char *argv[ ]) SetupSharedFoundation::Data data(SetupSharedFoundation::Data::D_console); #ifdef WIN32 char buffer[1024]; - GetModuleFileName(GetModuleHandle(nullptr), buffer, 1024); + GetModuleFileName(GetModuleHandle(NULL), buffer, 1024); Filename configName; configName.setName(buffer); configName.setName("templateCompiler.cfg"); @@ -685,7 +685,7 @@ int main(int argc, char *argv[ ]) // setup the random number generator // @todo need a better seed - SetupSharedRandom::install(static_cast(time(nullptr))); + SetupSharedRandom::install(static_cast(time(NULL))); int result = processArgs(argc, argv); diff --git a/engine/shared/library/sharedCollision/src/shared/core/BarrierObject.cpp b/engine/shared/library/sharedCollision/src/shared/core/BarrierObject.cpp index 1c853c1b..204984ad 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/BarrierObject.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/BarrierObject.cpp @@ -38,14 +38,14 @@ public: virtual bool canCollideWith ( CollisionProperty const * otherCollision ) const { - if(otherCollision == nullptr) + if(otherCollision == NULL) { return false; } BarrierObject const * barrier = safe_cast(&getOwner()); - if(barrier == nullptr) + if(barrier == NULL) { return false; } @@ -180,7 +180,7 @@ void BarrierObject::createAppearance ( void ) Appearance * appearance = CellProperty::createPortalBarrier(verts,gs_barrierColor); - if(appearance != nullptr) + if(appearance != NULL) { setAppearance( appearance ); diff --git a/engine/shared/library/sharedCollision/src/shared/core/BoxTree.cpp b/engine/shared/library/sharedCollision/src/shared/core/BoxTree.cpp index 7e2c011b..1f046513 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/BoxTree.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/BoxTree.cpp @@ -156,8 +156,8 @@ BoxTreeNode::BoxTreeNode() : m_box(), m_index(-1), m_userId(-1), - m_childA(nullptr), - m_childB(nullptr) + m_childA(NULL), + m_childB(NULL) { } @@ -165,8 +165,8 @@ BoxTreeNode::BoxTreeNode ( AxialBox const & box, int userId ) : m_box(box), m_index(-1), m_userId(userId), - m_childA(nullptr), - m_childB(nullptr) + m_childA(NULL), + m_childB(NULL) { } @@ -195,10 +195,10 @@ void BoxTreeNode::drawDebugShapes ( DebugShapeRenderer * renderer, VectorArgb co #ifdef _DEBUG - if(m_childA == nullptr) return; - if(m_childB == nullptr) return; + if(m_childA == NULL) return; + if(m_childB == NULL) return; - if(renderer == nullptr) return; + if(renderer == NULL) return; VectorArgb newColor( color.a, color.r * 0.9f, color.g * 0.9f, color.b * 0.9f ); @@ -227,7 +227,7 @@ int BoxTreeNode::getNodeCount ( void ) const float BoxTreeNode::calcWeight ( void ) const { - if((m_childA == nullptr) && (m_childB == nullptr)) return 1.0f; + if((m_childA == NULL) && (m_childB == NULL)) return 1.0f; float accum = 0.0f; @@ -241,9 +241,9 @@ float BoxTreeNode::calcWeight ( void ) const float BoxTreeNode::calcBalance ( void ) const { - if((m_childA == nullptr) && (m_childB == nullptr)) return 1.0f; + if((m_childA == NULL) && (m_childB == NULL)) return 1.0f; - if((m_childA != nullptr) && (m_childB != nullptr)) + if((m_childA != NULL) && (m_childB != NULL)) { return m_childA->calcWeight() / m_childB->calcWeight(); } @@ -288,8 +288,8 @@ void BoxTreeNode::packInto ( BoxTreeNode * node, BoxTreeNode * base ) const node->m_box = m_box; node->m_index = m_index; - node->m_childA = m_childA ? (base + m_childA->m_index) : nullptr; - node->m_childB = m_childB ? (base + m_childB->m_index) : nullptr; + node->m_childA = m_childA ? (base + m_childA->m_index) : NULL; + node->m_childB = m_childB ? (base + m_childB->m_index) : NULL; node->m_userId = m_userId; } @@ -302,10 +302,10 @@ void BoxTreeNode::deleteChildren ( void ) if(m_childB) m_childB->deleteChildren(); delete m_childA; - m_childA = nullptr; + m_childA = NULL; delete m_childB; - m_childB = nullptr; + m_childB = NULL; } // ---------------------------------------------------------------------- @@ -341,8 +341,8 @@ void BoxTreeNode::read ( Iff & iff, BoxTreeNode * base ) int indexA = iff.read_int32(); int indexB = iff.read_int32(); - m_childA = ( indexA != -1 ? base + indexA : nullptr ); - m_childB = ( indexB != -1 ? base + indexB : nullptr ); + m_childA = ( indexA != -1 ? base + indexA : NULL ); + m_childB = ( indexB != -1 ? base + indexB : NULL ); } // ---------------------------------------------------------------------- @@ -361,7 +361,7 @@ bool BoxTreeNode::findClosest ( Vector const & V, float maxDistance, float & out // ---------- // Leaf node case - this leaf node is closer - if((m_childA == nullptr) && (m_childB == nullptr)) + if((m_childA == NULL) && (m_childB == NULL)) { outDistance = dist; outIndex = m_userId; @@ -417,8 +417,8 @@ void BoxTree::install() // ---------------------------------------------------------------------- BoxTree::BoxTree() -: m_flatNodes(nullptr), - m_root(nullptr), +: m_flatNodes(NULL), + m_root(NULL), m_testCounter(0) { } @@ -443,7 +443,7 @@ void BoxTree::build ( BoxVec const & boxes ) // ---------- - BoxTreeNodePVec nodes(boxes.size(),nullptr); + BoxTreeNodePVec nodes(boxes.size(),NULL); int boxcount = boxes.size(); @@ -488,7 +488,7 @@ void BoxTree::drawDebugShapes ( DebugShapeRenderer * renderer ) const #ifdef _DEBUG - if(renderer == nullptr) return; + if(renderer == NULL) return; if(m_root) m_root->drawDebugShapes( renderer, VectorArgb::solidWhite, 0 ); @@ -546,7 +546,7 @@ static inline void templateTestOverlapRecurse( BoxTreeNode const * node, TestSha template< class TestShape > static inline bool templateTestOverlap( BoxTree const & tree, TestShape const & testShape, IdVec & outIds ) { - if(tree.getRoot() == nullptr) return false; + if(tree.getRoot() == NULL) return false; int oldSize = outIds.size(); @@ -580,7 +580,7 @@ static inline void templateTestOverlapRecurse2( BoxTreeNode const * node, TestSh template< class TestShape > static inline bool templateTestOverlap2( BoxTree const & tree, TestShape const & testShape, IdVec & outIds ) { - if(tree.getRoot() == nullptr) return false; + if(tree.getRoot() == NULL) return false; int oldSize = outIds.size(); @@ -701,11 +701,11 @@ void BoxTree::clear ( void ) m_root->deleteChildren(); delete m_root; - m_root = nullptr; + m_root = NULL; } delete m_flatNodes; - m_flatNodes = nullptr; + m_flatNodes = NULL; } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedCollision/src/shared/core/BoxTree.h b/engine/shared/library/sharedCollision/src/shared/core/BoxTree.h index d32e2fea..9a2d6545 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/BoxTree.h +++ b/engine/shared/library/sharedCollision/src/shared/core/BoxTree.h @@ -108,7 +108,7 @@ inline int BoxTree::getTestCounter ( void ) const inline bool BoxTree::isFlat ( void ) const { - return m_flatNodes != nullptr; + return m_flatNodes != NULL; } // ====================================================================== diff --git a/engine/shared/library/sharedCollision/src/shared/core/CollisionBuckets.cpp b/engine/shared/library/sharedCollision/src/shared/core/CollisionBuckets.cpp index c3c6c5c0..af528e5f 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/CollisionBuckets.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/CollisionBuckets.cpp @@ -162,7 +162,7 @@ void CollisionBuckets::build(Vector const & minimumBounds, Vector const & maximu (*m_nodeMatrix)[xx].resize(m_bucketsAlongY); for (unsigned int yy = 0; yy < m_bucketsAlongY; ++yy) { - // note that nodes are initialized to nullptr + // note that nodes are initialized to NULL (*m_nodeMatrix)[xx][yy].resize(m_bucketsAlongZ, 0); } } diff --git a/engine/shared/library/sharedCollision/src/shared/core/CollisionMesh.cpp b/engine/shared/library/sharedCollision/src/shared/core/CollisionMesh.cpp index cca52f64..80a0e930 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/CollisionMesh.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/CollisionMesh.cpp @@ -106,8 +106,8 @@ CollisionMesh::CollisionMesh() : CollisionSurface(), m_id(0), m_version(1), - m_boxTree(nullptr), - m_extent(nullptr), + m_boxTree(NULL), + m_extent(NULL), m_boundsDirty(true) { m_extent = new SimpleExtent( MultiShape(AxialBox()) ); @@ -116,10 +116,10 @@ CollisionMesh::CollisionMesh() CollisionMesh::~CollisionMesh() { delete m_boxTree; - m_boxTree = nullptr; + m_boxTree = NULL; delete m_extent; - m_extent = nullptr; + m_extent = NULL; } // ---------------------------------------------------------------------- @@ -154,7 +154,7 @@ BaseExtent const * CollisionMesh::getExtent_p ( void ) const void CollisionMesh::clear ( void ) { delete m_boxTree; - m_boxTree = nullptr; + m_boxTree = NULL; } // ---------------------------------------------------------------------- @@ -1010,7 +1010,7 @@ void CollisionMesh::transform( CollisionMesh const * sourceMesh, Transform const bool CollisionMesh::hasBoxTree ( void ) const { - return m_boxTree != nullptr; + return m_boxTree != NULL; } // ---------- diff --git a/engine/shared/library/sharedCollision/src/shared/core/CollisionNotification.cpp b/engine/shared/library/sharedCollision/src/shared/core/CollisionNotification.cpp index 2c5d349d..6fba343e 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/CollisionNotification.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/CollisionNotification.cpp @@ -75,7 +75,7 @@ void CollisionNotification::purgeQueue ( void ) Object * object = entry.m_object; - if(object == nullptr) continue; + if(object == NULL) continue; if(entry.m_added) { diff --git a/engine/shared/library/sharedCollision/src/shared/core/CollisionProperty.cpp b/engine/shared/library/sharedCollision/src/shared/core/CollisionProperty.cpp index b8cc9332..5e22c064 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/CollisionProperty.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/CollisionProperty.cpp @@ -44,7 +44,7 @@ namespace CollisionPropertyNamespace { - CollisionProperty * ms_activeListHead = nullptr; + CollisionProperty * ms_activeListHead = NULL; }; using namespace CollisionPropertyNamespace; @@ -64,8 +64,8 @@ void CollisionProperty::detachList ( void ) ms_activeListHead = m_next; } - m_prev = nullptr; - m_next = nullptr; + m_prev = NULL; + m_next = NULL; } // ---------- @@ -76,7 +76,7 @@ void CollisionProperty::attachList ( CollisionProperty * & head ) if(head) head->m_prev = this; - m_prev = nullptr; + m_prev = NULL; m_next = head; head = this; @@ -129,7 +129,7 @@ CollisionProperty * CollisionProperty::getActiveHead ( void ) Transform getTransform_o2c( Object const * object ) { - if(object == nullptr) return Transform::identity; + if(object == NULL) return Transform::identity; // If this object is a cell, its o2c transform is the identity transform @@ -164,23 +164,23 @@ CollisionProperty::CollisionProperty( Object & owner ) : Property( CollisionProperty::getClassPropertyId(), owner ), m_lastTransform_w(Transform::identity), m_lastTransform_p(Transform::identity), - m_lastCellObject(nullptr), + m_lastCellObject(NULL), m_stepHeight(0.0f), m_defaultRadius(0.0f), m_offsetX(0.0f), m_offsetZ(0.0f), m_extentsDirty(true), - m_extent_l(nullptr), - m_extent_p(nullptr), + m_extent_l(NULL), + m_extent_p(NULL), m_sphere_l(), m_sphere_w(), m_scale(owner.getScale().x), - m_spatialSubdivisionHandle(nullptr), - m_floor(nullptr), - m_footprint(nullptr), + m_spatialSubdivisionHandle(NULL), + m_floor(NULL), + m_footprint(NULL), m_idleCounter(3), - m_next(nullptr), - m_prev(nullptr), + m_next(NULL), + m_prev(NULL), m_flags(F_collidable), m_spatialDatabaseStorageType(SpatialDatabase::Q_None) { @@ -200,7 +200,7 @@ CollisionProperty::CollisionProperty( Object & owner ) { char const * const found = strstr(templateName,"lair"); - if(found != nullptr) + if(found != NULL) { setCollidable(false); } @@ -214,23 +214,23 @@ CollisionProperty::CollisionProperty( Object & owner, SharedObjectTemplate const : Property( CollisionProperty::getClassPropertyId(), owner ), m_lastTransform_w(Transform::identity), m_lastTransform_p(Transform::identity), - m_lastCellObject(nullptr), + m_lastCellObject(NULL), m_stepHeight(0.0f), m_defaultRadius(0.0f), m_offsetX(0.0f), m_offsetZ(0.0f), m_extentsDirty(true), - m_extent_l(nullptr), - m_extent_p(nullptr), + m_extent_l(NULL), + m_extent_p(NULL), m_sphere_l(), m_sphere_w(), m_scale(owner.getScale().x), - m_spatialSubdivisionHandle(nullptr), - m_floor(nullptr), - m_footprint(nullptr), + m_spatialSubdivisionHandle(NULL), + m_floor(NULL), + m_footprint(NULL), m_idleCounter(3), - m_next(nullptr), - m_prev(nullptr), + m_next(NULL), + m_prev(NULL), m_flags(F_collidable), m_spatialDatabaseStorageType(SpatialDatabase::Q_None) { @@ -248,7 +248,7 @@ CollisionProperty::CollisionProperty( Object & owner, SharedObjectTemplate const { char const * const found = strstr(templateName,"lair"); - if(found != nullptr) + if(found != NULL) { setCollidable(false); } @@ -373,7 +373,7 @@ CollisionProperty::~CollisionProperty() static_cast::NodeHandle *>(m_spatialSubdivisionHandle)->removeObject(); - m_spatialSubdivisionHandle = nullptr; + m_spatialSubdivisionHandle = NULL; } FATAL(CollisionWorld::isUpdating(),("CollisionProperty::~CollisionProperty - Trying to destroy a collision property while the collision world is updating. This is baaaad\n")); @@ -382,16 +382,16 @@ CollisionProperty::~CollisionProperty() detachList(); delete m_extent_l; - m_extent_l = nullptr; + m_extent_l = NULL; delete m_extent_p; - m_extent_p = nullptr; + m_extent_p = NULL; delete m_floor; - m_floor = nullptr; + m_floor = NULL; delete m_footprint; - m_footprint = nullptr; + m_footprint = NULL; } @@ -405,7 +405,7 @@ void CollisionProperty::attachSourceExtent ( BaseExtent * newSourceExtent ) cons m_extent_l = newSourceExtent; delete m_extent_p; - m_extent_p = nullptr; + m_extent_p = NULL; m_extentsDirty = true; } @@ -437,12 +437,12 @@ void CollisionProperty::initFloor ( void ) if (isMobile()) return; - if(m_floor != nullptr) + if(m_floor != NULL) return; // ---------- - char const *floorName = nullptr; + char const *floorName = NULL; Appearance * appearance = getOwner().getAppearance(); if(appearance) @@ -487,7 +487,7 @@ void CollisionProperty::addToCollisionWorld ( void ) if (getOwner().getNetworkId() < NetworkId::cms_invalid) { delete m_footprint; - m_footprint = nullptr; + m_footprint = NULL; } if (m_footprint) @@ -534,7 +534,7 @@ Transform CollisionProperty::getTransform_o2c ( void ) const BaseExtent * convertToSimpleExtent ( BaseExtent const * sourceExtent ) { - if(!sourceExtent) return nullptr; + if(!sourceExtent) return NULL; switch(sourceExtent->getType()) { @@ -549,7 +549,7 @@ BaseExtent * convertToSimpleExtent ( BaseExtent const * sourceExtent ) { Extent const * extent = safe_cast(sourceExtent); - if(!extent) return nullptr; + if(!extent) return NULL; return new SimpleExtent( MultiShape( extent->getShape() ) ); } @@ -558,7 +558,7 @@ BaseExtent * convertToSimpleExtent ( BaseExtent const * sourceExtent ) { CylinderExtent const * extent = safe_cast(sourceExtent); - if(!extent) return nullptr; + if(!extent) return NULL; return new SimpleExtent( MultiShape( extent->getShape() ) ); } @@ -567,7 +567,7 @@ BaseExtent * convertToSimpleExtent ( BaseExtent const * sourceExtent ) { BoxExtent const * extent = safe_cast(sourceExtent); - if(!extent) return nullptr; + if(!extent) return NULL; return new SimpleExtent( MultiShape( extent->getShape() ) ); } @@ -576,7 +576,7 @@ BaseExtent * convertToSimpleExtent ( BaseExtent const * sourceExtent ) { MeshExtent const * extent = safe_cast(sourceExtent); - if(!extent) return nullptr; + if(!extent) return NULL; return extent->clone(); } @@ -585,7 +585,7 @@ BaseExtent * convertToSimpleExtent ( BaseExtent const * sourceExtent ) { DetailExtent const * extent = safe_cast(sourceExtent); - if(!extent) return nullptr; + if(!extent) return NULL; DetailExtent * newExtent = new DetailExtent(); @@ -603,7 +603,7 @@ BaseExtent * convertToSimpleExtent ( BaseExtent const * sourceExtent ) { ComponentExtent const * extent = safe_cast(sourceExtent); - if(!extent) return nullptr; + if(!extent) return NULL; ComponentExtent * newExtent = new ComponentExtent(); @@ -623,7 +623,7 @@ BaseExtent * convertToSimpleExtent ( BaseExtent const * sourceExtent ) case ET_Null: case ET_ExtentTypeCount: default: - return nullptr; + return NULL; } } @@ -653,10 +653,10 @@ void CollisionProperty::updateExtents ( void ) const if(m_scale != newScale) { delete m_extent_l; - m_extent_l = nullptr; + m_extent_l = NULL; delete m_extent_p; - m_extent_p = nullptr; + m_extent_p = NULL; m_scale = newScale; } @@ -960,7 +960,7 @@ void CollisionProperty::drawDebugShapes ( DebugShapeRenderer * renderer ) const #ifdef _DEBUG - if(renderer == nullptr) return; + if(renderer == NULL) return; if(ConfigSharedCollision::getDrawExtents()) { @@ -1274,9 +1274,9 @@ void CollisionProperty::setLastPos ( CellProperty * cell, Transform const & tran { NAN_CHECK(transform_p); - if(cell == nullptr) + if(cell == NULL) { - m_lastCellObject = nullptr; + m_lastCellObject = NULL; m_lastTransform_p = transform_p; m_lastTransform_w = transform_p; } @@ -1298,7 +1298,7 @@ Object const * CollisionProperty::getStandingOn ( void ) const } else { - return nullptr; + return NULL; } } diff --git a/engine/shared/library/sharedCollision/src/shared/core/CollisionResolve.cpp b/engine/shared/library/sharedCollision/src/shared/core/CollisionResolve.cpp index 759a5f30..0638c13c 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/CollisionResolve.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/CollisionResolve.cpp @@ -87,7 +87,7 @@ namespace CollisionResolveNamespace FloorContactList ms_floorContactList; - Floor const * ms_ignoreFloor = nullptr; + Floor const * ms_ignoreFloor = NULL; int ms_ignoreTriId = -1; int ms_ignoreEdge = -1; Vector ms_ignoreNormal = Vector::zero; @@ -312,7 +312,7 @@ ResolutionResult CollisionResolve::resolveCollisions(CollisionProperty * collide if(result == RR_Resolved) { - colliderA->hitBy(nullptr); + colliderA->hitBy(NULL); colliderA->setExtentsDirty(true); Vector resetPos = moveSeg.getBegin(moveSeg.m_cellB); @@ -339,7 +339,7 @@ ResolutionResult CollisionResolve::resolveCollisions ( CellProperty const * cell const int iterationCount = 8; - ms_ignoreFloor = nullptr; + ms_ignoreFloor = NULL; ms_ignoreTriId = -1; ms_ignoreEdge = -1; ms_ignoreTime = REAL_MAX; @@ -484,12 +484,12 @@ ResolutionResult CollisionResolve::resolveCollisions ( CellProperty const * cell // ---------- // Remove the hit obstacle from the extent list - if(obstacleList->at(minIndex).m_extent != nullptr) + if(obstacleList->at(minIndex).m_extent != NULL) { obstacleList->at(minIndex) = obstacleList->back(); obstacleList->resize(obstacleList->size()-1); - ms_ignoreFloor = nullptr; + ms_ignoreFloor = NULL; ms_ignoreTriId = -1; ms_ignoreEdge = -1; ms_ignoreTime = REAL_MAX; @@ -561,13 +561,13 @@ void CollisionResolve::explodeExtent ( CellProperty const * cell, BaseExtent con void CollisionResolve::explodeFootprint ( Footprint * foot, ObstacleList & obstacleList, FloorContactList & floorContacts ) { - if(foot == nullptr) return; + if(foot == NULL) return; for(ContactIterator it(foot->getFloorList()); it; ++it) { FloorContactShape * contact = (*it); - if(contact == nullptr) + if(contact == NULL) continue; obstacleList.push_back( ObstacleInfo(contact->m_contact.getCell(),contact) ); @@ -594,7 +594,7 @@ void CollisionResolve::explodeCollider(CollisionProperty * colliderA, ColliderLi { CollisionProperty const * const colliderB = *ii; - if(colliderB == nullptr) continue; + if(colliderB == NULL) continue; BaseExtent const * const extentB = colliderB->getExtent_p(); @@ -613,7 +613,7 @@ void CollisionResolve::explodeCollider(CollisionProperty * colliderA, ColliderLi { FloorContactShape * const contact = (*it); - if(contact == nullptr) continue; + if(contact == NULL) continue; ms_floorContactList.push_back(contact); } @@ -713,7 +713,7 @@ Contact CollisionResolve::findContactWithFloor ( FloorContactShape * floorContac Floor const * floor = loc.getFloor(); - if(floor == nullptr) return Contact::noContact; + if(floor == NULL) return Contact::noContact; CellProperty const * floorCell = loc.getCell(); @@ -740,7 +740,7 @@ Contact CollisionResolve::findContactWithFloor ( FloorContactShape * floorContac return Contact::noContact; } - if((ms_ignoreFloor == nullptr) || (floor != ms_ignoreFloor)) + if((ms_ignoreFloor == NULL) || (floor != ms_ignoreFloor)) { walkResult = floor->canMove(loc,delta,-1,-1,result); } @@ -776,7 +776,7 @@ Contact CollisionResolve::findContactWithFloor ( FloorContactShape * floorContac tempContact.m_surfaceId2 = result.getHitEdgeId(); tempContact.m_cell = floorCell; - tempContact.m_extent = nullptr; + tempContact.m_extent = NULL; tempContact.m_surface = result.getFloor(); } } diff --git a/engine/shared/library/sharedCollision/src/shared/core/CollisionResolve.h b/engine/shared/library/sharedCollision/src/shared/core/CollisionResolve.h index 77bf73b0..7e4b9e44 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/CollisionResolve.h +++ b/engine/shared/library/sharedCollision/src/shared/core/CollisionResolve.h @@ -27,22 +27,22 @@ class Floor; struct ObstacleInfo { ObstacleInfo() - : m_cell(nullptr), - m_extent(nullptr), - m_floorContact(nullptr) + : m_cell(NULL), + m_extent(NULL), + m_floorContact(NULL) { } ObstacleInfo ( CellProperty const * cell, SimpleExtent const * extent ) : m_cell(cell), m_extent(extent), - m_floorContact(nullptr) + m_floorContact(NULL) { } ObstacleInfo ( CellProperty const * cell, FloorContactShape * contact ) : m_cell(cell), - m_extent(nullptr), + m_extent(NULL), m_floorContact(contact) { } diff --git a/engine/shared/library/sharedCollision/src/shared/core/CollisionUtils.cpp b/engine/shared/library/sharedCollision/src/shared/core/CollisionUtils.cpp index 5d8192b5..4c994abf 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/CollisionUtils.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/CollisionUtils.cpp @@ -881,7 +881,7 @@ void MergePolyPoly ( VertexList & polyA, VertexList & polyB, VertexList & outPol void BuildConvexHull ( Vector const * sortedVerts, int vertCount, VertexList & outPoly ) { - if(sortedVerts == nullptr) return; + if(sortedVerts == NULL) return; if(vertCount <= 0) return; if(vertCount == 1) { outPoly.push_back(sortedVerts[0]); return; } @@ -1104,7 +1104,7 @@ RangeLoop CalcAvoidanceThetas ( Sphere const & S, BaseExtent const * extent ); RangeLoop CalcAvoidanceThetas ( Sphere const & S, SimpleExtent const * extent ) { - if(extent == nullptr) return RangeLoop::empty; + if(extent == NULL) return RangeLoop::empty; return CalcAvoidanceThetas(S,extent->getShape()); } @@ -1113,7 +1113,7 @@ RangeLoop CalcAvoidanceThetas ( Sphere const & S, SimpleExtent const * extent ) RangeLoop CalcAvoidanceThetas ( Sphere const & S, ComponentExtent const * extent ) { - if(extent == nullptr) return RangeLoop::empty; + if(extent == NULL) return RangeLoop::empty; RangeLoop range = RangeLoop::empty; @@ -1123,7 +1123,7 @@ RangeLoop CalcAvoidanceThetas ( Sphere const & S, ComponentExtent const * extent { BaseExtent const * child = extent->getExtent(i); - if(child == nullptr) continue; + if(child == NULL) continue; RangeLoop temp = CalcAvoidanceThetas(S,child); @@ -1137,13 +1137,13 @@ RangeLoop CalcAvoidanceThetas ( Sphere const & S, ComponentExtent const * extent RangeLoop CalcAvoidanceThetas ( Sphere const & S, DetailExtent const * extent ) { - if(extent == nullptr) return RangeLoop::empty; + if(extent == NULL) return RangeLoop::empty; int count = extent->getExtentCount(); BaseExtent const * child = extent->getExtent(count - 1); - if(child == nullptr) return RangeLoop::empty; + if(child == NULL) return RangeLoop::empty; return CalcAvoidanceThetas(S,child); } @@ -1152,7 +1152,7 @@ RangeLoop CalcAvoidanceThetas ( Sphere const & S, DetailExtent const * extent ) RangeLoop CalcAvoidanceThetas ( Sphere const & S, BaseExtent const * extent ) { - if(extent == nullptr) return RangeLoop::empty; + if(extent == NULL) return RangeLoop::empty; ExtentType type = extent->getType(); @@ -1176,7 +1176,7 @@ RangeLoop CalcAvoidanceThetas ( Sphere const & S, ExtentVec const & extents ) { BaseExtent const * child = extents[i]; - if(child == nullptr) continue; + if(child == NULL) continue; RangeLoop temp = CalcAvoidanceThetas(S,child); @@ -1367,7 +1367,7 @@ void explodeObstacle ( Sphere const & sphere, Vector const & delta, SimpleExtent void explodeObstacle ( Sphere const & sphere, Vector const & delta, DetailExtent const * extent, ExtentVec & outList ) { - if(extent == nullptr) return; + if(extent == NULL) return; int count = extent->getExtentCount(); @@ -1376,7 +1376,7 @@ void explodeObstacle ( Sphere const & sphere, Vector const & delta, DetailExtent void explodeObstacle ( Sphere const & sphere, Vector const & delta, ComponentExtent const * extent, ExtentVec & outList ) { - if(extent == nullptr) return; + if(extent == NULL) return; int count = extent->getExtentCount(); @@ -1388,7 +1388,7 @@ void explodeObstacle ( Sphere const & sphere, Vector const & delta, ComponentExt void explodeObstacle ( Sphere const & sphere, Vector const & delta, BaseExtent const * extent, ExtentVec & outList ) { - if(extent == nullptr) return; + if(extent == NULL) return; ExtentType type = extent->getType(); @@ -1411,7 +1411,7 @@ void explodeObstacle ( Sphere const & sphere, Vector const & delta, ExtentVec co bool CalcAvoidancePoint ( Sphere const & sphere, Transform const & sphereTransform_p2w, Vector const & delta, CollisionProperty const * obstacle, Vector & out ) { - if(obstacle == nullptr) return false; + if(obstacle == NULL) return false; static ExtentVec tempExtents; @@ -1455,12 +1455,12 @@ bool CalcAvoidancePoint ( Sphere const & sphere, Transform const & sphereTransfo bool CalcAvoidancePoint ( CollisionProperty const * mob, Vector const & delta, CollisionProperty const * obstacle, Vector & out ) { - if(mob == nullptr) return false; - if(obstacle == nullptr) return false; + if(mob == NULL) return false; + if(obstacle == NULL) return false; BaseExtent const * mobExtent = mob->getExtent_p(); - if(mobExtent == nullptr) return false; + if(mobExtent == NULL) return false; Sphere mobSphere = mobExtent->getBoundingSphere(); @@ -1471,8 +1471,8 @@ bool CalcAvoidancePoint ( CollisionProperty const * mob, Vector const & delta, C bool CalcAvoidancePoint ( Object const * mob, Vector const & delta, Object const * obstacle, Vector & out ) { - if(mob == nullptr) return false; - if(obstacle == nullptr) return false; + if(mob == NULL) return false; + if(obstacle == NULL) return false; CollisionProperty const * mobCollision = mob->getCollisionProperty(); CollisionProperty const * obstacleCollision = obstacle->getCollisionProperty(); @@ -1601,8 +1601,8 @@ Vector transformToCell ( CellProperty const * cellA, Vector const & point_A, Cel { CellProperty const * worldCell = CellProperty::getWorldCellProperty(); - if(cellA == nullptr) cellA = worldCell; - if(cellB == nullptr) cellB = worldCell; + if(cellA == NULL) cellA = worldCell; + if(cellB == NULL) cellB = worldCell; if(cellA == cellB) return point_A; @@ -1627,8 +1627,8 @@ Vector rotateToCell ( CellProperty const * cellA, Vector const & point_A, CellPr { CellProperty const * worldCell = CellProperty::getWorldCellProperty(); - if(cellA == nullptr) cellA = worldCell; - if(cellB == nullptr) cellB = worldCell; + if(cellA == NULL) cellA = worldCell; + if(cellB == NULL) cellB = worldCell; if(cellA == cellB) return point_A; @@ -1655,8 +1655,8 @@ Transform transformToCell ( CellProperty const * cellA, Transform const & transf { CellProperty const * worldCell = CellProperty::getWorldCellProperty(); - if(cellA == nullptr) cellA = worldCell; - if(cellB == nullptr) cellB = worldCell; + if(cellA == NULL) cellA = worldCell; + if(cellB == NULL) cellB = worldCell; if(cellA == cellB) return transform_A; @@ -1743,8 +1743,8 @@ MultiShape transformToCell ( CellProperty const * cellA, MultiShape const & shap bool testPortalVis ( CellProperty const * cellA, Vector const & pointA, CellProperty const * cellB, Vector const & pointB ) { - if(cellA == nullptr) return false; - if(cellB == nullptr) return false; + if(cellA == NULL) return false; + if(cellB == NULL) return false; float hitTime = 0.0f; @@ -1753,7 +1753,7 @@ bool testPortalVis ( CellProperty const * cellA, Vector const & pointA, CellProp if(cellA == cellB) { - return cellA->getDestinationCell(pointA,pointB,hitTime) == nullptr; + return cellA->getDestinationCell(pointA,pointB,hitTime) == NULL; } // ---------- diff --git a/engine/shared/library/sharedCollision/src/shared/core/CollisionWorld.cpp b/engine/shared/library/sharedCollision/src/shared/core/CollisionWorld.cpp index 61b199f9..29d98133 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/CollisionWorld.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/CollisionWorld.cpp @@ -71,7 +71,7 @@ namespace CollisionWorldNamespace // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SpatialDatabase * ms_database = nullptr; + SpatialDatabase * ms_database = NULL; bool ms_updating = false; bool ms_serverSide = false; @@ -94,7 +94,7 @@ namespace CollisionWorldNamespace bool testPassableTerrain(Vector const & startPos, Vector const & delta, float & collisionTime) { TerrainObject const *const terrainObject = TerrainObject::getConstInstance(); - if (nullptr != terrainObject) + if (NULL != terrainObject) { float totalDistance = delta.magnitude(); float distanceTraversed = 0.0f; @@ -134,7 +134,7 @@ namespace CollisionWorldNamespace return; TerrainObject const *const terrainObject = TerrainObject::getConstInstance(); - if (nullptr != terrainObject && terrainObject->hasPassableAffectors()) + if (NULL != terrainObject && terrainObject->hasPassableAffectors()) { // pointA_w is *not* the previous world position, but actually the world @@ -289,7 +289,7 @@ bool CollisionWorldNamespace::testFloorCollision(FloorLocator const &startFloorL if (!floor) { // For some reason this solid floor does not have an attached floor. No collision. - WARNING(true, ("testFloorCollision(): attempted to test floor with a starting floor locator that had a nullptr floor, unexpected. Check calling code's assumptions.")); + WARNING(true, ("testFloorCollision(): attempted to test floor with a starting floor locator that had a NULL floor, unexpected. Check calling code's assumptions.")); return true; } @@ -319,7 +319,7 @@ bool CollisionWorldNamespace::testFloorCollision(FloorLocator const &startFloorL // if statement above. WARNING(true, ("testFloorCollision(): floor collision occurred while checking for floor collisions for floor of object id [%s] but collision floor location has no associated floor. Calling this a non-collision. PathWalkResult was [%d].", - floor->getOwner() ? floor->getOwner()->getNetworkId().getValueString().c_str() : "", + floor->getOwner() ? floor->getOwner()->getNetworkId().getValueString().c_str() : "", static_cast(pathWalkResult) )); return false; @@ -328,8 +328,8 @@ bool CollisionWorldNamespace::testFloorCollision(FloorLocator const &startFloorL collisionObject = destinationFloor->getOwner(); if (!collisionObject) { - // We had a collision on a floor, but the floor had a nullptr owner. Consider this a non-collision. - WARNING(true, ("testFloorCollision(): floor collision occurred, destination collision floor location had a floor but floor reported a nullptr owner. Calling this a non-collision.")); + // We had a collision on a floor, but the floor had a NULL owner. Consider this a non-collision. + WARNING(true, ("testFloorCollision(): floor collision occurred, destination collision floor location had a floor but floor reported a NULL owner. Calling this a non-collision.")); return false; } @@ -447,11 +447,11 @@ void CollisionWorld::remove ( void ) CollisionResolve::remove(); FloorMesh::remove(); - s_nearWarpWarningCallback = nullptr; - s_farWarpWarningCallback = nullptr; + s_nearWarpWarningCallback = NULL; + s_farWarpWarningCallback = NULL; delete ms_database; - ms_database = nullptr; + ms_database = NULL; } // ---------------------------------------------------------------------- @@ -595,7 +595,7 @@ bool CollisionWorld::spatialSweepAndResolve(CollisionProperty * collider) void CollisionWorld::update(CollisionProperty * collider, float time) { - FATAL(!collider, ("CollisionWorld::update(): collider is nullptr.")); + FATAL(!collider, ("CollisionWorld::update(): collider is NULL.")); PROFILER_AUTO_BLOCK_DEFINE("CollisionWorld::update"); @@ -603,9 +603,9 @@ void CollisionWorld::update(CollisionProperty * collider, float time) Footprint * foot = collider->getFootprint(); - if(foot == nullptr) + if(foot == NULL) { - PROFILER_AUTO_BLOCK_DEFINE("CollisionWorld::update: foot == nullptr"); + PROFILER_AUTO_BLOCK_DEFINE("CollisionWorld::update: foot == NULL"); IGNORE_RETURN (CollisionWorld::spatialSweepAndResolve(collider)); collider->storePosition(); @@ -1076,11 +1076,11 @@ void CollisionWorld::setFarWarpWarningCallback(WarpWarningCallback callback) void CollisionWorld::addObject ( Object * object ) { - if(object == nullptr) return; + if(object == NULL) return; CollisionProperty * collision = object->getCollisionProperty(); - if((collision == nullptr) || collision->getDisableCollisionWorldAddRemove()) return; + if((collision == NULL) || collision->getDisableCollisionWorldAddRemove()) return; if(collision->isInCollisionWorld()) return; @@ -1125,7 +1125,7 @@ void CollisionWorld::addObject ( Object * object ) { char const * name = object->getObjectTemplateName(); - if(name == nullptr) + if(name == NULL) { Appearance const * appearance = object->getAppearance(); @@ -1162,11 +1162,11 @@ void CollisionWorld::addObject ( Object * object ) void CollisionWorld::removeObject ( Object * object ) { - if(object == nullptr) return; + if(object == NULL) return; CollisionProperty * collision = object->getCollisionProperty(); - if((collision == nullptr) || collision->getDisableCollisionWorldAddRemove()) return; + if((collision == NULL) || collision->getDisableCollisionWorldAddRemove()) return; if(!collision->isInCollisionWorld()) return; @@ -1218,11 +1218,11 @@ void CollisionWorld::removeObject ( Object * object ) void CollisionWorld::moveObject (Object * object) { - if(object == nullptr) return; + if(object == NULL) return; CollisionProperty * collision = object->getCollisionProperty(); - if(collision == nullptr) return; + if(collision == NULL) return; if(!collision->isInCollisionWorld()) return; @@ -1248,11 +1248,11 @@ void CollisionWorld::moveObject (Object * object) void CollisionWorld::cellChanged ( Object * object ) { - if(object == nullptr) return; + if(object == NULL) return; CollisionProperty * collision = object->getCollisionProperty(); - if(collision == nullptr) return; + if(collision == NULL) return; if(!collision->isInCollisionWorld()) return; @@ -1266,11 +1266,11 @@ void CollisionWorld::cellChanged ( Object * object ) void CollisionWorld::appearanceChanged ( Object * object ) { - if(object == nullptr) return; + if(object == NULL) return; CollisionProperty * collision = object->getCollisionProperty(); - if(collision == nullptr) return; + if(collision == NULL) return; if(!collision->isInCollisionWorld()) return; @@ -1333,12 +1333,12 @@ SpatialDatabase * CollisionWorld::getDatabase ( void ) void CollisionWorld::objectWarped ( Object * object ) { - if(object == nullptr) return; + if(object == NULL) return; CollisionProperty * collision = object->getCollisionProperty(); // object does not have a CollisionProperty - if(collision == nullptr) return; + if(collision == NULL) return; // object is not in CollisionWorld if (!collision->isInCollisionWorld()) return; @@ -1458,7 +1458,7 @@ QueryInteractionResult CollisionWorld::queryInteraction ( CellProperty const * c if(hitTime < hitPortalTime) { outHitTime = hitTime; - outHitObject = nullptr; + outHitObject = NULL; return QIR_HitTerrain; } @@ -1472,12 +1472,12 @@ QueryInteractionResult CollisionWorld::queryInteraction ( CellProperty const * c // If we did not hit a portal, the query ends in this cell. // If this cell is not the goal cell, then the query fails. - if(nextCell == nullptr) + if(nextCell == NULL) { if(cellA != cellB) { outHitTime = 1.0f; - outHitObject = nullptr; + outHitObject = NULL; return QIR_MissedTarget; } @@ -1702,7 +1702,7 @@ CanMoveResult CollisionWorld::canMove ( CellProperty const * startCell, FloorLocator dummy; - return canMove( nullptr, startCell, startLoc, goalPos, checkY, checkFlora, checkFauna, dummy ); + return canMove( NULL, startCell, startLoc, goalPos, checkY, checkFlora, checkFauna, dummy ); } // ---------- @@ -1714,7 +1714,7 @@ CanMoveResult CollisionWorld::canMove ( Object const * object, bool checkFlora, bool checkFauna ) { - if(object == nullptr) + if(object == NULL) { return CMR_Error; } @@ -1766,7 +1766,7 @@ CanMoveResult CollisionWorld::canMove ( Object const * object, bool checkFauna, FloorLocator & endLoc ) { - if(startCell == nullptr) + if(startCell == NULL) { startCell = CellProperty::getWorldCellProperty(); } @@ -1858,7 +1858,7 @@ CanMoveResult CollisionWorld::canMove ( Object const * object, } // ---------- -// A nullptr goal cell means we don't care what cell we end up in as long as we make it to the goal +// A NULL goal cell means we don't care what cell we end up in as long as we make it to the goal CanMoveResult CollisionWorld::canMove ( Object const * object, CellProperty const * startCell, @@ -1871,12 +1871,12 @@ CanMoveResult CollisionWorld::canMove ( Object const * object, { // ---------- - if(startCell == nullptr) + if(startCell == NULL) { startCell = CellProperty::getWorldCellProperty(); } - if(goalCell == nullptr) + if(goalCell == NULL) { FloorLocator dummy; @@ -2233,17 +2233,17 @@ bool CollisionWorld::findFirstObstacle ( Object const * creature, float creature Vector delta = testPos - startPos; - if(creature == nullptr) return false; + if(creature == NULL) return false; CollisionProperty const * collision = creature->getCollisionProperty(); - if(collision == nullptr) return false; + if(collision == NULL) return false; BaseExtent const * baseExtent = collision->getExtent_p(); SimpleExtent const * simpleExtent = dynamic_cast(baseExtent); - if(simpleExtent == nullptr) return false; + if(simpleExtent == NULL) return false; MultiShape const & shape = simpleExtent->getShape(); @@ -2253,7 +2253,7 @@ bool CollisionWorld::findFirstObstacle ( Object const * creature, float creature // Test collision extents DetectResult minResult; - Object const * minObject = nullptr; + Object const * minObject = NULL; typedef std::vector ObjectVector; static ObjectVector statics; @@ -2262,7 +2262,7 @@ bool CollisionWorld::findFirstObstacle ( Object const * creature, float creature statics.clear(); creatures.clear(); - if(ms_database->queryObjects(creature->getParentCell(), shape, delta, (testStatics ? &statics : nullptr), (testCreatures ? &creatures : nullptr))) + if(ms_database->queryObjects(creature->getParentCell(), shape, delta, (testStatics ? &statics : NULL), (testCreatures ? &creatures : NULL))) { ObjectVector::size_type const nStatics = statics.size(); ObjectVector::size_type i; @@ -2271,7 +2271,7 @@ bool CollisionWorld::findFirstObstacle ( Object const * creature, float creature { Object const * obstacle = statics[i]; - if(obstacle == nullptr) continue; + if(obstacle == NULL) continue; if(obstacle == creature) continue; @@ -2292,7 +2292,7 @@ bool CollisionWorld::findFirstObstacle ( Object const * creature, float creature { Object const * obstacle = creatures[i]; - if(obstacle == nullptr) continue; + if(obstacle == NULL) continue; if(obstacle == creature) continue; @@ -2310,10 +2310,10 @@ bool CollisionWorld::findFirstObstacle ( Object const * creature, float creature //-- Check for floor collisions. Footprint const *const footprint = collision->getFootprint(); - FloorLocator const *const floorLocator = (footprint ? footprint->getAnyContact() : nullptr); + FloorLocator const *const floorLocator = (footprint ? footprint->getAnyContact() : NULL); if (floorLocator) { - Object const *floorCollisionObject = nullptr; + Object const *floorCollisionObject = NULL; Vector collisionLocation_w; // Do the floor check. @@ -2372,7 +2372,7 @@ bool CollisionWorld::findFirstObstacle ( Sphere const & sphere, Vector const & g // Test collision extents DetectResult minResult; - Object const * minObject = nullptr; + Object const * minObject = NULL; static std::vector statics; static std::vector creatures; @@ -2380,7 +2380,7 @@ bool CollisionWorld::findFirstObstacle ( Sphere const & sphere, Vector const & g statics.clear(); creatures.clear(); - if(ms_database->queryObjects(CellProperty::getWorldCellProperty(), shape, delta, (testStatics ? &statics : nullptr), (testCreatures ? &creatures : nullptr))) + if(ms_database->queryObjects(CellProperty::getWorldCellProperty(), shape, delta, (testStatics ? &statics : NULL), (testCreatures ? &creatures : NULL))) { size_t const nStatics = statics.size(); size_t i; @@ -2389,7 +2389,7 @@ bool CollisionWorld::findFirstObstacle ( Sphere const & sphere, Vector const & g { Object const * obstacle = statics[i]; - if(obstacle == nullptr) continue; + if(obstacle == NULL) continue; DetectResult result = CollisionDetect::testSphereObject(sphere,delta,obstacle); @@ -2406,7 +2406,7 @@ bool CollisionWorld::findFirstObstacle ( Sphere const & sphere, Vector const & g { Object const * obstacle = creatures[i]; - if(obstacle == nullptr) continue; + if(obstacle == NULL) continue; if(Distance2d::Distance2(obstacle->getPosition_w(),goalPos) < 0.000001) continue; @@ -2437,7 +2437,7 @@ bool CollisionWorld::findFirstObstacle ( Sphere const & sphere, Vector const & g bool CollisionWorld::calcBubble ( CellProperty const * cell, Vector const & point_p, float maxDistance, float & outRadius ) { - return calcBubble(cell,point_p,nullptr,maxDistance,outRadius); + return calcBubble(cell,point_p,NULL,maxDistance,outRadius); } bool CollisionWorld::calcBubble ( CellProperty const * cell, Vector const & point_p, Object const * ignoreObject, float maxDistance, float & outRadius ) @@ -2698,16 +2698,16 @@ void CollisionWorld::handleSceneChange(std::string const & sceneId) Floor const * CollisionWorld::getFloorStandingOn(Object const & object) { CollisionProperty const * const objectCollisionProperty = object.getCollisionProperty(); - Footprint const * const objectFootprint = (objectCollisionProperty != nullptr) ? objectCollisionProperty->getFootprint() : nullptr; + Footprint const * const objectFootprint = (objectCollisionProperty != NULL) ? objectCollisionProperty->getFootprint() : NULL; - if (objectFootprint == nullptr) + if (objectFootprint == NULL) { - return nullptr; + return NULL; } MultiListHandle const & floorList = objectFootprint->getFloorList(); float const objectHeight = object.getPosition_w().y; - Floor const * resultFloor = nullptr; + Floor const * resultFloor = NULL; float resultDistanceBelowObject = 0.0f; float dropTestHeight = std::numeric_limits::min(); @@ -2750,7 +2750,7 @@ Floor const * CollisionWorld::getFloorStandingOn(Object const & object) { TerrainObject const * const terrainObject = TerrainObject::getConstInstance(); - if (terrainObject != nullptr) + if (terrainObject != NULL) { CellProperty const * const parentCell = object.getParentCell(); @@ -2775,7 +2775,7 @@ Floor const * CollisionWorld::getFloorStandingOn(Object const & object) { if (dropTestHeight < terrainHeight) { - resultFloor = nullptr; + resultFloor = NULL; } } } diff --git a/engine/shared/library/sharedCollision/src/shared/core/ConfigSharedCollision.cpp b/engine/shared/library/sharedCollision/src/shared/core/ConfigSharedCollision.cpp index b9811896..0b3d4164 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/ConfigSharedCollision.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/ConfigSharedCollision.cpp @@ -68,8 +68,8 @@ float ms_terrainLOSMaxDistance = 64.0f; float ms_losUprightScale = 1.5f; float ms_losProneScale = 1.0f; -PlayEffectHook ms_playEffectHook = nullptr; -IsPlayerHouseHook ms_isPlayerHouseHook = nullptr; +PlayEffectHook ms_playEffectHook = NULL; +IsPlayerHouseHook ms_isPlayerHouseHook = NULL; int ms_spatialSweepAndResolveDefaultMask = static_cast(SpatialDatabase::Q_Static); diff --git a/engine/shared/library/sharedCollision/src/shared/core/Contact3d.h b/engine/shared/library/sharedCollision/src/shared/core/Contact3d.h index 551822e2..2d4d7236 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/Contact3d.h +++ b/engine/shared/library/sharedCollision/src/shared/core/Contact3d.h @@ -52,9 +52,9 @@ public: m_normal(newNormal), m_surfaceId1(-1), m_surfaceId2(-1), - m_cell(nullptr), - m_extent(nullptr), - m_surface(nullptr) + m_cell(NULL), + m_extent(NULL), + m_surface(NULL) { } diff --git a/engine/shared/library/sharedCollision/src/shared/core/ContactPoint.cpp b/engine/shared/library/sharedCollision/src/shared/core/ContactPoint.cpp index be31ca04..304a14b7 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/ContactPoint.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/ContactPoint.cpp @@ -18,7 +18,7 @@ // ---------------------------------------------------------------------- ContactPoint::ContactPoint() -: m_pSurface( nullptr ), +: m_pSurface( NULL ), m_position( Vector::zero ), m_offset( 0.0f ), m_hitId( -1 ) @@ -45,7 +45,7 @@ ContactPoint::ContactPoint ( ContactPoint const & locCopy ) bool ContactPoint::isAttached ( void ) const { - return (m_hitId != -1) && (m_pSurface != nullptr); + return (m_hitId != -1) && (m_pSurface != NULL); } // ---------------------------------------------------------------------- @@ -115,7 +115,7 @@ void ContactPoint::read_0000 ( Iff & iff ) { m_position = iff.read_floatVector(); m_offset = iff.read_float(); - m_pSurface = nullptr; + m_pSurface = NULL; m_hitId = iff.read_int32(); NAN_CHECK(m_position); diff --git a/engine/shared/library/sharedCollision/src/shared/core/DoorObject.cpp b/engine/shared/library/sharedCollision/src/shared/core/DoorObject.cpp index 68b421e8..a14c9980 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/DoorObject.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/DoorObject.cpp @@ -99,11 +99,11 @@ DoorObject::DoorObject ( DoorInfo const & info, Portal * portal ) m_doorHelper2 ( info ), m_delta ( info.m_delta ), m_portal ( portal ), - m_neighbor ( nullptr ), + m_neighbor ( NULL ), m_spring ( info.m_spring ), m_smoothness ( info.m_smoothness ), m_draw ( true ), - m_barrier ( nullptr ), + m_barrier ( NULL ), m_oldDoorPos ( Vector::maxXYZ ), m_wasOpen(false), m_isForceField( false ), @@ -119,7 +119,7 @@ DoorObject::DoorObject ( DoorInfo const & info, Portal * portal ) setDebugName("Door object"); for (int i = 0; i < MAX_DRAWN_DOORS; ++i) - m_drawnDoor[i] = nullptr; + m_drawnDoor[i] = NULL; createAppearance(info); createTrigger(info); @@ -131,7 +131,7 @@ DoorObject::DoorObject ( DoorInfo const & info, Portal * portal ) DoorObject::~DoorObject() { m_hitByObjects.clear(); - m_portal = nullptr; + m_portal = NULL; } // ---------------------------------------------------------------------- @@ -181,7 +181,7 @@ DoorObject const * DoorObject::getNeighbor ( void ) const int DoorObject::getNumberOfDrawnDoors ( void ) { for (int i = 0; i < MAX_DRAWN_DOORS; ++i) - if (m_drawnDoor[i] == nullptr) + if (m_drawnDoor[i] == NULL) return i; return MAX_DRAWN_DOORS; @@ -210,7 +210,7 @@ void DoorObject::createAppearance ( DoorInfo const & info ) { Appearance * const appearance = AppearanceTemplateList::createAppearance(info.m_frameAppearance); - if (appearance != nullptr) { + if (appearance != NULL) { setAppearance(appearance); } else { DEBUG_WARNING(true, ("FIX ME: Appearance template for DoorObject::createAppearance missing, first stanza.")); @@ -233,7 +233,7 @@ void DoorObject::createAppearance ( DoorInfo const & info ) Collision3d::MovePolyOnto(verts,Vector::zero); Appearance * appearance = CellProperty::createForceField(verts,gs_forceFieldColor); - if(appearance != nullptr) + if(appearance != NULL) { m_drawnDoor[0]->setAppearance( appearance ); Extent * appearanceExtent = new Extent( Containment3d::EncloseSphere(verts) ); @@ -249,7 +249,7 @@ void DoorObject::createAppearance ( DoorInfo const & info ) { Appearance * const appearance = AppearanceTemplateList::createAppearance(info.m_doorAppearance); - if (appearance != nullptr) { + if (appearance != NULL) { m_drawnDoor[0]->setAppearance(appearance); } else { DEBUG_WARNING(true, ("FIX ME: Appearance template for DoorObject::createAppearance missing, third stanza.")); @@ -263,7 +263,7 @@ void DoorObject::createAppearance ( DoorInfo const & info ) Appearance * const appearance = AppearanceTemplateList::createAppearance(info.m_doorAppearance2); - if (appearance != nullptr) { + if (appearance != NULL) { m_drawnDoor[1]->setAppearance(appearance); } else { DEBUG_WARNING(true, ("FIX ME: Appearance template for DoorObject::createAppearance missing, fourth stanza.")); @@ -476,7 +476,7 @@ float DoorObject::tween ( float t ) const void DoorObject::hitBy( CollisionProperty const * collision ) { - if(collision == nullptr) return; + if(collision == NULL) return; CellProperty const * doorCell = getParentCell(); CellProperty const * doorNeighborCell = m_neighbor ? m_neighbor->getParentCell() : doorCell; @@ -533,7 +533,7 @@ void DoorObject::setNeighbor ( DoorObject * newNeighbor ) if (newNeighbor) m_barrier->setNeighbor( newNeighbor->m_barrier ); else - m_barrier->setNeighbor( nullptr ); + m_barrier->setNeighbor( NULL ); } } @@ -587,7 +587,7 @@ void DoorObject::trackHitByObject(Object const &hitByObject) if (static_cast(m_hitByObjects.size()) >= cs_maxHitByObjectsToTrack) return; - // NOTE: This can't be a set because the key's value can change when a watcher's value changes from non-nullptr to nullptr. + // NOTE: This can't be a set because the key's value can change when a watcher's value changes from non-NULL to NULL. // Check if the object already exists in the list. if (std::find(m_hitByObjects.begin(), m_hitByObjects.end(), ConstWatcher(&hitByObject)) != m_hitByObjects.end()) return; @@ -607,7 +607,7 @@ void DoorObject::maintainHitByObjectVector() // Remove any objects that no longer exist or no longer are within the trigger radius. for (WatcherObjectVector::iterator it = m_hitByObjects.begin(); it != m_hitByObjects.end(); ) { - if (it->getPointer() == nullptr) + if (it->getPointer() == NULL) { // This hit-by object has been deleted so clear it out of the tracking list. it = m_hitByObjects.erase(it); diff --git a/engine/shared/library/sharedCollision/src/shared/core/Floor.cpp b/engine/shared/library/sharedCollision/src/shared/core/Floor.cpp index 8d23bff3..4d08d7df 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/Floor.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/Floor.cpp @@ -49,8 +49,8 @@ Floor::Floor( FloorMesh const * pMesh, Object const * owner, Appearance const * m_mesh(pMesh), m_footList(this,1), m_databaseList(this,1), - m_spatialSubdivisionHandle(nullptr), - m_extent(nullptr), + m_spatialSubdivisionHandle(NULL), + m_extent(NULL), m_extentDirty(true), m_sphere_l(), m_sphere_w() @@ -104,15 +104,15 @@ Floor::~Floor() } const_cast(m_mesh)->releaseReference(); - m_mesh = nullptr; + m_mesh = NULL; - m_owner = nullptr; - m_appearance = nullptr; + m_owner = NULL; + m_appearance = NULL; - m_spatialSubdivisionHandle = nullptr; + m_spatialSubdivisionHandle = NULL; delete m_extent; - m_extent = nullptr; + m_extent = NULL; } // ---------------------------------------------------------------------- @@ -255,7 +255,7 @@ bool Floor::segTestBounds ( Vector const & begin, Vector const & end ) const Object const * Floor::getOwner ( void ) const { - if(m_owner != nullptr) + if(m_owner != NULL) { return m_owner; } @@ -265,7 +265,7 @@ Object const * Floor::getOwner ( void ) const } else { - return nullptr; + return NULL; } } @@ -273,7 +273,7 @@ Object const * Floor::getOwner ( void ) const Appearance const * Floor::getAppearance ( void ) const { - if(m_appearance != nullptr) + if(m_appearance != NULL) { return m_appearance; } @@ -283,7 +283,7 @@ Appearance const * Floor::getAppearance ( void ) const } else { - return nullptr; + return NULL; } } @@ -301,7 +301,7 @@ CellProperty const * Floor::getCell ( void ) const } else { - return nullptr; + return NULL; } } @@ -657,7 +657,7 @@ NetworkId const & Floor::getId() const { CellProperty const * const cellProperty = getCell(); - return (cellProperty != nullptr) ? cellProperty->getOwner().getNetworkId() : NetworkId::cms_invalid; + return (cellProperty != NULL) ? cellProperty->getOwner().getNetworkId() : NetworkId::cms_invalid; } // ====================================================================== diff --git a/engine/shared/library/sharedCollision/src/shared/core/FloorLocator.cpp b/engine/shared/library/sharedCollision/src/shared/core/FloorLocator.cpp index 5b728aee..f595384a 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/FloorLocator.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/FloorLocator.cpp @@ -34,7 +34,7 @@ FloorTri gs_dummyFloorTri; FloorLocator::FloorLocator() : ContactPoint(), m_valid(false), - m_floor(nullptr), + m_floor(NULL), m_radius(0.0f), m_time(0.0f), m_edgeId(-1), @@ -47,7 +47,7 @@ FloorLocator::FloorLocator() // ---------- FloorLocator::FloorLocator( Floor const * floor, Vector const & localPoint, int triId, float dist, float radius ) -: ContactPoint((floor ? floor->getFloorMesh() : nullptr),localPoint,triId,dist), +: ContactPoint((floor ? floor->getFloorMesh() : NULL),localPoint,triId,dist), m_valid(true), m_floor(floor), m_radius(radius), @@ -64,7 +64,7 @@ FloorLocator::FloorLocator( Floor const * floor, Vector const & localPoint, int FloorLocator::FloorLocator( CollisionSurface const * mesh, Vector const & point, int triId, float dist, float radius ) : ContactPoint(mesh,point,triId,dist), m_valid(true), - m_floor(nullptr), + m_floor(NULL), m_radius(radius), m_time(0.0f), m_edgeId(-1), @@ -78,7 +78,7 @@ FloorLocator::FloorLocator( CollisionSurface const * mesh, Vector const & point, // ---------- FloorLocator::FloorLocator( Floor const * floor, Vector const & localPoint ) -: ContactPoint((floor ? floor->getFloorMesh() : nullptr),localPoint,-1,0.0f), +: ContactPoint((floor ? floor->getFloorMesh() : NULL),localPoint,-1,0.0f), m_valid(true), m_floor(floor), m_radius(0.0f), @@ -95,7 +95,7 @@ FloorLocator::FloorLocator( Floor const * floor, Vector const & localPoint ) FloorLocator::FloorLocator( CollisionSurface const * mesh, Vector const & point ) : ContactPoint(mesh,point,-1,0.0f), m_valid(true), - m_floor(nullptr), + m_floor(NULL), m_radius(0.0f), m_time(0.0f), m_edgeId(-1), @@ -109,9 +109,9 @@ FloorLocator::FloorLocator( CollisionSurface const * mesh, Vector const & point // ---------- FloorLocator::FloorLocator( Vector const & point, float radius ) -: ContactPoint(nullptr,point,-1,0.0f), +: ContactPoint(NULL,point,-1,0.0f), m_valid(true), - m_floor(nullptr), + m_floor(NULL), m_radius(radius), m_time(0.0f), m_edgeId(-1), @@ -226,7 +226,7 @@ void FloorLocator::setFloor ( Floor const * newFloor ) } else { - if(getFloorMesh() == nullptr) + if(getFloorMesh() == NULL) { Vector oldPos = getPosition_p(); @@ -239,7 +239,7 @@ void FloorLocator::setFloor ( Floor const * newFloor ) } else { - m_floor = nullptr; + m_floor = NULL; } } @@ -289,7 +289,7 @@ CellProperty const * FloorLocator::getCell ( void ) const { if(getFloorMesh()) { - return nullptr; + return NULL; } else { @@ -312,7 +312,7 @@ CellProperty * FloorLocator::getCell ( void ) { if(getFloorMesh()) { - return nullptr; + return NULL; } else { @@ -417,7 +417,7 @@ void FloorLocator::write ( Iff & iff ) const void FloorLocator::detach ( void ) { - setFloor(nullptr); + setFloor(NULL); setId(-1); } diff --git a/engine/shared/library/sharedCollision/src/shared/core/FloorManager.cpp b/engine/shared/library/sharedCollision/src/shared/core/FloorManager.cpp index 1ea799b9..677849e7 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/FloorManager.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/FloorManager.cpp @@ -19,9 +19,9 @@ namespace FloorManagerNamespace { -ObjectFactory ms_pathGraphFactory = nullptr; -ObjectWriter ms_pathGraphWriter = nullptr; -ObjectRenderer ms_pathGraphRenderer = nullptr; +ObjectFactory ms_pathGraphFactory = NULL; +ObjectWriter ms_pathGraphWriter = NULL; +ObjectRenderer ms_pathGraphRenderer = NULL; }; @@ -72,7 +72,7 @@ Floor * FloorManager::createFloor ( const char * floorMeshFilename, Object const if(!pMesh) { WARNING(true, ("Could not find floor mesh %s", floorMeshFilename)); - return nullptr; + return NULL; } // ---------- diff --git a/engine/shared/library/sharedCollision/src/shared/core/FloorMesh.cpp b/engine/shared/library/sharedCollision/src/shared/core/FloorMesh.cpp index ae508f4a..370f13b7 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/FloorMesh.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/FloorMesh.cpp @@ -78,8 +78,8 @@ const Tag TAG_BTRE = TAG(B,T,R,E); const Tag TAG_BEDG = TAG(B,E,D,G); const Tag TAG_PGRF = TAG(P,G,R,F); -template <> FloorMeshList::CreateDataResourceMap *FloorMeshList::ms_bindings = nullptr; -template <> FloorMeshList::LoadedDataResourceMap *FloorMeshList::ms_loaded = nullptr; +template <> FloorMeshList::CreateDataResourceMap *FloorMeshList::ms_bindings = NULL; +template <> FloorMeshList::LoadedDataResourceMap *FloorMeshList::ms_loaded = NULL; // ---------------------------------------------------------------------- @@ -92,20 +92,20 @@ FloorMesh::FloorMesh(const std::string & filename) m_uncrossableEdges( new FloorEdgeIdVec() ), m_wallBaseEdges( new FloorEdgeIdVec() ), m_wallTopEdges( new FloorEdgeIdVec() ), - m_pathGraph(nullptr), - m_appearance(nullptr), + m_pathGraph(NULL), + m_appearance(NULL), m_triMarkCounter(1000), // just some random number m_objectFloor(false) { #ifdef _DEBUG - m_crossableLines = nullptr; - m_uncrossableLines = nullptr; - m_interiorLines = nullptr; - m_portalLines = nullptr; - m_rampLines = nullptr; - m_fallthroughTriLines = nullptr; - m_solidTriLines = nullptr; + m_crossableLines = NULL; + m_uncrossableLines = NULL; + m_interiorLines = NULL; + m_portalLines = NULL; + m_rampLines = NULL; + m_fallthroughTriLines = NULL; + m_solidTriLines = NULL; #endif } @@ -121,8 +121,8 @@ FloorMesh::FloorMesh( VectorVector const & vertices, IntVector const & indices ) m_uncrossableEdges( new FloorEdgeIdVec() ), m_wallBaseEdges( new FloorEdgeIdVec() ), m_wallTopEdges( new FloorEdgeIdVec() ), - m_pathGraph(nullptr), - m_appearance(nullptr), + m_pathGraph(NULL), + m_appearance(NULL), m_triMarkCounter(1000), m_objectFloor(false) { @@ -130,13 +130,13 @@ FloorMesh::FloorMesh( VectorVector const & vertices, IntVector const & indices ) #ifdef _DEBUG - m_crossableLines = nullptr; - m_uncrossableLines = nullptr; - m_interiorLines = nullptr; - m_portalLines = nullptr; - m_rampLines = nullptr; - m_fallthroughTriLines = nullptr; - m_solidTriLines = nullptr; + m_crossableLines = NULL; + m_uncrossableLines = NULL; + m_interiorLines = NULL; + m_portalLines = NULL; + m_rampLines = NULL; + m_fallthroughTriLines = NULL; + m_solidTriLines = NULL; #endif } @@ -146,50 +146,50 @@ FloorMesh::FloorMesh( VectorVector const & vertices, IntVector const & indices ) FloorMesh::~FloorMesh() { delete m_vertices; - m_vertices = nullptr; + m_vertices = NULL; delete m_floorTris; - m_floorTris = nullptr; + m_floorTris = NULL; delete m_crossableEdges; - m_crossableEdges = nullptr; + m_crossableEdges = NULL; delete m_uncrossableEdges; - m_crossableEdges = nullptr; + m_crossableEdges = NULL; delete m_wallBaseEdges; - m_wallBaseEdges = nullptr; + m_wallBaseEdges = NULL; delete m_wallTopEdges; - m_wallTopEdges = nullptr; + m_wallTopEdges = NULL; delete m_pathGraph; - m_pathGraph = nullptr; + m_pathGraph = NULL; - m_appearance = nullptr; + m_appearance = NULL; #ifdef _DEBUG delete m_crossableLines; - m_crossableLines = nullptr; + m_crossableLines = NULL; delete m_uncrossableLines; - m_uncrossableLines = nullptr; + m_uncrossableLines = NULL; delete m_interiorLines; - m_interiorLines = nullptr; + m_interiorLines = NULL; delete m_portalLines; - m_portalLines = nullptr; + m_portalLines = NULL; delete m_rampLines; - m_rampLines = nullptr; + m_rampLines = NULL; delete m_fallthroughTriLines; - m_fallthroughTriLines = nullptr; + m_fallthroughTriLines = NULL; delete m_solidTriLines; - m_solidTriLines = nullptr; + m_solidTriLines = NULL; #endif } @@ -833,7 +833,7 @@ void FloorMesh::write ( Iff & iff ) // ---------- - if(m_boxTree != nullptr) + if(m_boxTree != NULL) { m_boxTree->write(iff); } @@ -1772,7 +1772,7 @@ bool FloorMesh::canEnterEdge ( FloorLocator const & enterLoc ) const { if(enterLoc.getEdgeId() == -1) return false; if(enterLoc.getTriId() == -1) return false; - if(enterLoc.getFloorMesh() == nullptr) return false; + if(enterLoc.getFloorMesh() == NULL) return false; // Can't enter the tri if it's facing down @@ -1837,7 +1837,7 @@ bool FloorMesh::canExitEdge ( FloorLocator const & exitLoc, Vector const & delta { if(exitLoc.getTriId() == -1) return false; if(exitLoc.getEdgeId() == -1) return false; - if(exitLoc.getFloorMesh() == nullptr) return false; + if(exitLoc.getFloorMesh() == NULL) return false; FloorEdgeType edgeType = exitLoc.getFloorTri().getEdgeType(exitLoc.getEdgeId()); @@ -3808,7 +3808,7 @@ void FloorMesh::drawDebugShapes ( DebugShapeRenderer * renderer, bool drawExtent #ifdef _DEBUG - if(renderer == nullptr) return; + if(renderer == NULL) return; if(ConfigSharedCollision::getDrawFloors()) { diff --git a/engine/shared/library/sharedCollision/src/shared/core/Footprint.cpp b/engine/shared/library/sharedCollision/src/shared/core/Footprint.cpp index 58471e36..00bec3b3 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/Footprint.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/Footprint.cpp @@ -92,7 +92,7 @@ static bool epsilonEqual( float value, float target, float epsilon ) Footprint::Footprint ( Vector const & position, float radius, CollisionProperty * parent, const float swimHeight ) : BaseClass(), m_parent(parent), - m_cellObject(nullptr), + m_cellObject(NULL), m_position_p(Vector::zero), m_position_w(Vector::zero), m_radius(radius), @@ -112,9 +112,9 @@ Footprint::Footprint ( Vector const & position, float radius, CollisionProperty #ifdef _DEBUG , m_backupPosition_p(position), - m_backupCell(nullptr), + m_backupCell(NULL), m_backupObjectPosition_p(position), - m_backupObjectCell(nullptr), + m_backupObjectCell(NULL), m_lineHitTime( -1.0f ), m_lineOrigin( Vector(0.0f,1.5f,0.0f) ), m_lineDelta( Vector(0.0f,0.0f,10.0f) ), @@ -137,8 +137,8 @@ Footprint::~Footprint() { detach(); - m_parent = nullptr; - m_cellObject = nullptr; + m_parent = NULL; + m_cellObject = NULL; } // ====================================================================== @@ -334,7 +334,7 @@ Object * Footprint::getOwner ( void ) void Footprint::addContact ( FloorLocator const & loc ) { - if(loc.getFloor() == nullptr) + if(loc.getFloor() == NULL) { FLOOR_LOG("Footprint::addContact - loc isn't attached to a floor\n"); } @@ -445,7 +445,7 @@ void Footprint::setSwimHeight ( float swimHeight ) Vector const & Footprint::getPosition_p ( void ) const { - if(m_cellObject.getPointer() == nullptr) + if(m_cellObject.getPointer() == NULL) { WARNING(true,("Footprint::getPosition_p - Footprint's parent cell has disappeared")); @@ -525,7 +525,7 @@ void Footprint::setPosition ( CellProperty * pNewCell, Vector const & pos ) { NAN_CHECK(pos); - if(pNewCell == nullptr) pNewCell = CellProperty::getWorldCellProperty(); + if(pNewCell == NULL) pNewCell = CellProperty::getWorldCellProperty(); m_cellObject = &(pNewCell->getOwner()); m_position_p = pos; @@ -808,13 +808,13 @@ void Footprint::runDebugTests ( void ) IGNORE_RETURN(CollisionWorld::calcBubble(getCell(),getPosition_p(),20.0f,m_bubbleSize)); */ - Object const * hitObject = nullptr; + Object const * hitObject = NULL; QueryInteractionResult result = CollisionWorld::queryInteraction(objCell, objPos + m_lineOrigin, objCell, objPos + m_lineOrigin + delta, - nullptr, + NULL, !ConfigSharedCollision::getIgnoreTerrainLos(), ConfigSharedCollision::getGenerateTerrainLos(), ConfigSharedCollision::getTerrainLOSMinDistance(), @@ -843,14 +843,14 @@ FloorLocator const * Footprint::getAnyContact ( void ) const if(contact->m_contact.isAttached()) return &contact->m_contact; } - return nullptr; + return NULL; } // ---------- FloorLocator const * Footprint::getSolidContact ( void ) const { - FloorLocator const * temp = nullptr; + FloorLocator const * temp = NULL; float maxHeight = -REAL_MAX; @@ -883,11 +883,11 @@ Object const * Footprint::getStandingOn ( void ) const { FloorLocator const * contact = getSolidContact(); - if(contact == nullptr) return nullptr; + if(contact == NULL) return NULL; Floor const * floor = contact->getFloor(); - if(floor == nullptr) return nullptr; + if(floor == NULL) return NULL; return floor->getOwner(); } @@ -921,9 +921,9 @@ bool Footprint::snapToCellFloor ( void ) bool Footprint::isAttachedTo ( Floor const * floor ) const { - if(floor == nullptr) return false; + if(floor == NULL) return false; - return getFloorList().find( floor->getFootList() ) != nullptr; + return getFloorList().find( floor->getFootList() ) != NULL; } // ---------------------------------------------------------------------- @@ -1114,7 +1114,7 @@ void Footprint::updateOffsets ( void ) bool Footprint::attachTo ( Floor const * floor, bool fromObject ) { - if(floor == nullptr) return false; + if(floor == NULL) return false; if(isAttachedTo(floor)) return false; @@ -1240,7 +1240,7 @@ int Footprint::elevatorMove ( int nFloors, Transform & outTransform ) // ---------- // Find the contact that's on the cell's floor - FloorContactShape const * cellContact = nullptr; + FloorContactShape const * cellContact = NULL; for(ConstContactIterator it(getFloorList()); it; ++it) { @@ -1261,7 +1261,7 @@ int Footprint::elevatorMove ( int nFloors, Transform & outTransform ) } } - if(cellContact == nullptr) + if(cellContact == NULL) { return 0; } @@ -1328,7 +1328,7 @@ void Footprint::drawDebugShapes ( DebugShapeRenderer * renderer ) const #ifdef _DEBUG - if(renderer == nullptr) return; + if(renderer == NULL) return; if(ConfigSharedCollision::getDrawFootprints()) { @@ -1525,7 +1525,7 @@ void Footprint::alignToGroundNoFloat ( void ) if (owner) DEBUG_WARNING(true, ("Footprint::alignToGroundNoFloat(): called on object id=[%s],template=[%s] when no ground could be found.", owner->getNetworkId().getValueString().c_str(), owner->getObjectTemplateName())); else - DEBUG_WARNING(true, ("Footprint::alignToGroundNoFloat(): called on object id=[],template=[] when no ground could be found.")); + DEBUG_WARNING(true, ("Footprint::alignToGroundNoFloat(): called on object id=[],template=[] when no ground could be found.")); } #endif } diff --git a/engine/shared/library/sharedCollision/src/shared/core/FootprintForceReattachManager.cpp b/engine/shared/library/sharedCollision/src/shared/core/FootprintForceReattachManager.cpp index 680ff016..d0671160 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/FootprintForceReattachManager.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/FootprintForceReattachManager.cpp @@ -31,7 +31,7 @@ namespace FootprintForceReattachManagerNamespace DataTable const * const dt = DataTableManager::getTable(ms_datatableName, true); - if (nullptr == dt) + if (NULL == dt) WARNING(true, ("FootprintForceReattachManager unable to find [%s]", ms_datatableName)); else { diff --git a/engine/shared/library/sharedCollision/src/shared/core/MultiList.cpp b/engine/shared/library/sharedCollision/src/shared/core/MultiList.cpp index af288bad..3917cd4d 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/MultiList.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/MultiList.cpp @@ -14,8 +14,8 @@ MultiListHandle::MultiListHandle( BaseClass * object, int color ) : m_color(color), m_object(object), - m_head(nullptr), - m_tail(nullptr) + m_head(NULL), + m_tail(NULL) { } @@ -23,9 +23,9 @@ MultiListHandle::~MultiListHandle() { IGNORE_RETURN( detach() ); - m_object = nullptr; - m_head = nullptr; - m_tail = nullptr; + m_object = NULL; + m_head = NULL; + m_tail = NULL; } // ---------------------------------------------------------------------- @@ -55,7 +55,7 @@ MultiListNode * MultiListHandle::detachHead ( void ) } else { - return nullptr; + return NULL; } } @@ -72,7 +72,7 @@ MultiListHandle * MultiListHandle::detach ( void ) bool MultiListHandle::isConnected ( void ) const { - return m_head != nullptr; + return m_head != NULL; } // ---------- @@ -97,7 +97,7 @@ void MultiListHandle::erase ( MultiListNode * node ) bool MultiListHandle::isEmpty ( void ) const { - return m_head == nullptr; + return m_head == NULL; } // ---------- @@ -109,8 +109,8 @@ void MultiListHandle::insert( MultiListNode * node, MultiListNode * prev, MultiL DEBUG_FATAL( next == node, ("MultiListHandle::insert - Next and node are the same ")); DEBUG_FATAL( (prev || next) && (prev == next), ("MultiListHandle::insert - Prev and Next are the same")); - // verify that the node to insert is not nullptr - DEBUG_FATAL( node == nullptr, ("MultiListHandle::insert - Cannot insert nullptr node")); + // verify that the node to insert is not null + DEBUG_FATAL( node == NULL, ("MultiListHandle::insert - Cannot insert null node")); // verify that the nodes we're inserting between are adjacent DEBUG_FATAL( prev && (prev->m_next[m_color] != next), ("MultiListHandle::insert - Prev and Next are not adjacent")); @@ -155,7 +155,7 @@ void MultiListHandle::connectTo( MultiListHandle & handle, BaseClass * data ) void MultiListHandle::insert( MultiListNode * node ) { - insert( node, nullptr, m_head ); + insert( node, NULL, m_head ); } // ---------- @@ -175,9 +175,9 @@ MultiListNode * MultiListHandle::detach ( MultiListNode * node ) // ---------- - node->m_next[m_color] = nullptr; - node->m_prev[m_color] = nullptr; - node->m_list[m_color] = nullptr; + node->m_next[m_color] = NULL; + node->m_prev[m_color] = NULL; + node->m_list[m_color] = NULL; } return node; @@ -221,7 +221,7 @@ MultiListNode * MultiListHandle::find ( MultiListHandle & testHandle ) cursor = cursor->m_next[m_color]; } - return nullptr; + return NULL; } //lint !e1764 // testHandle could be made const ref MultiListNode const * MultiListHandle::find ( MultiListHandle const & testHandle ) const @@ -240,7 +240,7 @@ MultiListNode const * MultiListHandle::find ( MultiListHandle const & testHandle cursor = cursor->m_next[m_color]; } - return nullptr; + return NULL; } // ---------- @@ -288,13 +288,13 @@ void MultiListHandle::destroyNodes ( void ) // ====================================================================== MultiListNode::MultiListNode() -: m_data(nullptr) +: m_data(NULL) { for(int i = 0; i < nColors; i++) { - m_next[i] = nullptr; - m_prev[i] = nullptr; - m_list[i] = nullptr; + m_next[i] = NULL; + m_prev[i] = NULL; + m_list[i] = NULL; } } @@ -303,7 +303,7 @@ MultiListNode::~MultiListNode() IGNORE_RETURN( detach() ); BaseClass * data = m_data; - m_data = nullptr; + m_data = NULL; delete data; } @@ -346,7 +346,7 @@ BaseClass * MultiListNode::getObject ( int color ) if(m_list[color]) return m_list[color]->getObject(); else - return nullptr; + return NULL; } //lint !e1762 // function could be const @@ -355,7 +355,7 @@ BaseClass const * MultiListNode::getObject ( int color ) const if(m_list[color]) return m_list[color]->getObject(); else - return nullptr; + return NULL; } // ---------- @@ -375,7 +375,7 @@ void MultiListNode::setData( BaseClass * data ) if(m_data == data) return; BaseClass * deadData = m_data; - m_data = nullptr; + m_data = NULL; delete deadData; m_data = data; } @@ -403,7 +403,7 @@ void MultiListNode::swapNext ( int color ) /* MultiList::MultiList() -: m_free(0,nullptr) +: m_free(0,NULL) { } @@ -411,7 +411,7 @@ MultiList::MultiList() bool MultiList::connect ( MultiListHandle * red, MultiListHandle * blue ) { - return connect(red,blue,nullptr); + return connect(red,blue,NULL); } // ---------- @@ -436,7 +436,7 @@ bool MultiList::connect ( MultiListHandle & red, MultiListHandle & blue, BaseCla bool MultiList::connected( MultiListHandle & red, MultiListHandle & blue ) { - return red.find(blue) != nullptr; + return red.find(blue) != NULL; } // ---------- @@ -450,7 +450,7 @@ bool MultiList::disconnect( MultiListHandle & red, MultiListHandle & blue ) MultiListNode * MultiList::getFreeNode ( void ) { - if(m_free.m_head == nullptr) + if(m_free.m_head == NULL) { return new MultiListNode(); } @@ -502,8 +502,8 @@ void MultiList::insert( MultiListHandle * node, MultiListHandle * prev, MultiLis DEBUG_FATAL( next == node, ("MultiList::insert - Next and Node are the same")); DEBUG_FATAL( prev == next, ("MultiList::insert - Prev and Next are the same")); - // verify that the node to insert is not nullptr - DEBUG_FATAL( node == nullptr, ("MultiList::insert - Cannot insert a nullptr node")); + // verify that the node to insert is not null + DEBUG_FATAL( node == NULL, ("MultiList::insert - Cannot insert a null node")); // verify that the two nodes are adjacent DEBUG_FATAL( prev && (prev->m_next != next), ("MultiList::insert - Prev and Next are not adjacent")); @@ -539,7 +539,7 @@ void MultiList::insert( MultiListHandle * node, MultiListHandle * prev, MultiLis MultiListHandle * MultiList::detach( MultiListHandle * node ) { - DEBUG_FATAL( node == nullptr, ("MultiList::detach - Cannot detach nullptr node")); + DEBUG_FATAL( node == NULL, ("MultiList::detach - Cannot detach null node")); DEBUG_FATAL( node->m_list != this, ("MultiList::detach - Node is not part of this list")); // ---------- @@ -555,9 +555,9 @@ MultiListHandle * MultiList::detach( MultiListHandle * node ) if(m_head[color] == node) m_head[color] = node->m_next; if(m_tail[color] == node) m_tail[color] = node->m_prev; - node->m_prev = nullptr; - node->m_next = nullptr; - node->m_list = nullptr; + node->m_prev = NULL; + node->m_next = NULL; + node->m_list = NULL; return node; } @@ -566,13 +566,13 @@ MultiListHandle * MultiList::detach( MultiListHandle * node ) void MultiList::insert( MultiListHandle * node ) { - DEBUG_FATAL(node == nullptr, ("MultiList::insert - Cannot insert nullptr node")); + DEBUG_FATAL(node == NULL, ("MultiList::insert - Cannot insert NULL node")); // ---------- int color = node->m_color; - insert(node,nullptr,m_head[color]); + insert(node,NULL,m_head[color]); } */ diff --git a/engine/shared/library/sharedCollision/src/shared/core/MultiList.h b/engine/shared/library/sharedCollision/src/shared/core/MultiList.h index 09d7a4ec..48c5e92d 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/MultiList.h +++ b/engine/shared/library/sharedCollision/src/shared/core/MultiList.h @@ -168,12 +168,12 @@ public: if(m_node) return safe_cast(m_node->getObject(m_valueColor)); else - return nullptr; + return NULL; } operator bool ( void ) const { - return m_node != nullptr; + return m_node != NULL; } void operator ++ ( void ) @@ -212,12 +212,12 @@ public: if(m_node) return safe_cast(m_node->getObject(m_valueColor)); else - return nullptr; + return NULL; } operator bool ( void ) const { - return m_node != nullptr; + return m_node != NULL; } void operator ++ ( void ) @@ -246,7 +246,7 @@ public: MultiListConstDataIterator( void ) { - m_node = nullptr; + m_node = NULL; m_color = -1; } @@ -281,12 +281,12 @@ public: if(m_node) return safe_cast(m_node->getData()); else - return nullptr; + return NULL; } operator bool ( void ) const { - return m_node != nullptr; + return m_node != NULL; } void operator ++ ( void ) @@ -310,7 +310,7 @@ public: MultiListDataIterator( void ) { - m_node = nullptr; + m_node = NULL; m_color = -1; } @@ -345,12 +345,12 @@ public: if(m_node) return safe_cast(m_node->getData()); else - return nullptr; + return NULL; } operator bool ( void ) const { - return m_node != nullptr; + return m_node != NULL; } void operator ++ ( void ) diff --git a/engine/shared/library/sharedCollision/src/shared/core/NeighborObject.cpp b/engine/shared/library/sharedCollision/src/shared/core/NeighborObject.cpp index 006db662..a5a0f37d 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/NeighborObject.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/NeighborObject.cpp @@ -12,7 +12,7 @@ // ---------------------------------------------------------------------- NeighborObject::NeighborObject() -: m_neighbor(nullptr) +: m_neighbor(NULL) { } diff --git a/engine/shared/library/sharedCollision/src/shared/core/SimpleCollisionMesh.cpp b/engine/shared/library/sharedCollision/src/shared/core/SimpleCollisionMesh.cpp index 439f6c95..3fa962f9 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/SimpleCollisionMesh.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/SimpleCollisionMesh.cpp @@ -48,7 +48,7 @@ SimpleCollisionMesh::SimpleCollisionMesh( IndexedTriangleList * tris ) SimpleCollisionMesh::~SimpleCollisionMesh() { delete m_tris; - m_tris = nullptr; + m_tris = NULL; delete m_bucket; } @@ -178,7 +178,7 @@ void SimpleCollisionMesh::drawDebugShapes ( DebugShapeRenderer * renderer ) cons UNREF(renderer); #ifdef _DEBUG - if(renderer == nullptr) return; + if(renderer == NULL) return; if (s_renderCollisionBuckets) { diff --git a/engine/shared/library/sharedCollision/src/shared/core/SpatialDatabase.cpp b/engine/shared/library/sharedCollision/src/shared/core/SpatialDatabase.cpp index f2d68e94..05abd3be 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/SpatialDatabase.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/SpatialDatabase.cpp @@ -115,7 +115,7 @@ public: * This functionality is used on the client to prevent a door from visually opening for * a mounted creature or a rider. The actual stop logic for movement is on the server. * - * @param callback If nullptr, no check is made. If non-nullptr, the callback is called + * @param callback If NULL, no check is made. If non-NULL, the callback is called * any time a mobile is detected to have collided with a DoorObject. * The return value of the callback dictates whether the hit() and hitBy() * logic is called on the mobile and door. If the return value of callback @@ -152,29 +152,29 @@ SpatialDatabase::SpatialDatabase() SpatialDatabase::~SpatialDatabase ( void ) { delete m_staticTree; - m_staticTree = nullptr; + m_staticTree = NULL; delete m_dynamicTree; - m_dynamicTree = nullptr; + m_dynamicTree = NULL; delete m_doorTree; - m_doorTree = nullptr; + m_doorTree = NULL; delete m_barrierTree; - m_barrierTree = nullptr; + m_barrierTree = NULL; delete m_floorTree; - m_floorTree = nullptr; + m_floorTree = NULL; delete m_ignoreStack; - m_ignoreStack = nullptr; + m_ignoreStack = NULL; } // ---------------------------------------------------------------------- bool SpatialDatabase::canCollideWithStatics ( CollisionProperty * collision ) const { - if(collision == nullptr) return false; + if(collision == NULL) return false; // On the client, remote creatures and players don't collide with statics @@ -207,10 +207,10 @@ bool SpatialDatabase::canCollideWithStatics ( CollisionProperty * collision ) co bool SpatialDatabase::canCollideWithStatic ( Object const * mobObject, Object * staticObject ) const { - // Objects can't collide with nullptr + // Objects can't collide with NULL - if(mobObject == nullptr) return false; - if(staticObject == nullptr) return false; + if(mobObject == NULL) return false; + if(staticObject == NULL) return false; // Objects can't collide with themselves @@ -223,7 +223,7 @@ bool SpatialDatabase::canCollideWithStatic ( Object const * mobObject, Object * bool SpatialDatabase::canCollideWithCreatures ( CollisionProperty const * collision ) const { - if(collision == nullptr) return false; + if(collision == NULL) return false; if(collision->isPlayerControlled() && collision->isServerSide()) { @@ -253,9 +253,9 @@ bool SpatialDatabase::canCollideWithCreature ( Object * player, Object * creatur bool SpatialDatabase::canWalkOnFloor ( CollisionProperty * collision ) const { - if(collision == nullptr) return false; + if(collision == NULL) return false; - if(collision->getFootprint() == nullptr) return false; + if(collision->getFootprint() == NULL) return false; return true; } @@ -470,12 +470,12 @@ void SpatialDatabase::updateCreatureCollision(CollisionProperty * playerCollisio bool SpatialDatabase::addObject(Query const query, Object * const object) { - if(object == nullptr) + if(object == NULL) return false; CollisionProperty * collision = object->getCollisionProperty(); - if(collision == nullptr) + if(collision == NULL) return false; if(collision->getSpatialSubdivisionHandle()) @@ -511,15 +511,15 @@ bool SpatialDatabase::addObject(Query const query, Object * const object) bool SpatialDatabase::removeObject(Query const query, Object * const object) { - if(object == nullptr) + if(object == NULL) return false; CollisionProperty * collision = object->getCollisionProperty(); - if(collision == nullptr) + if(collision == NULL) return false; - if(collision->getSpatialSubdivisionHandle() == nullptr) + if(collision->getSpatialSubdivisionHandle() == NULL) return false; switch (query) @@ -548,7 +548,7 @@ bool SpatialDatabase::removeObject(Query const query, Object * const object) break; } - collision->setSpatialSubdivisionHandle(nullptr); + collision->setSpatialSubdivisionHandle(NULL); return true; } @@ -645,7 +645,7 @@ bool SpatialDatabase::checkIgnoreObject ( Object const * object ) const bool SpatialDatabase::addFloor ( Floor * floor ) { - if(floor == nullptr) return false; + if(floor == NULL) return false; if(floor->getSpatialSubdivisionHandle()) return false; @@ -660,15 +660,15 @@ bool SpatialDatabase::addFloor ( Floor * floor ) bool SpatialDatabase::removeFloor ( Floor * floor ) { - if(floor == nullptr) return false; + if(floor == NULL) return false; - if(floor->getSpatialSubdivisionHandle() == nullptr) return false; + if(floor->getSpatialSubdivisionHandle() == NULL) return false; // ---------- m_floorTree->removeObject( floor->getSpatialSubdivisionHandle() ); - floor->setSpatialSubdivisionHandle(nullptr); + floor->setSpatialSubdivisionHandle(NULL); return true; } @@ -684,11 +684,11 @@ int SpatialDatabase::getFloorCount ( void ) const bool SpatialDatabase::moveObject ( CollisionProperty * collision ) { - if(collision == nullptr) return false; + if(collision == NULL) return false; SpatialSubdivisionHandle * handle = collision->getSpatialSubdivisionHandle(); - if(handle == nullptr) return false; + if(handle == NULL) return false; // ---------- @@ -729,7 +729,7 @@ bool SpatialDatabase::queryStatics ( AxialBox const & box, ObjectVec * outList ) bool SpatialDatabase::queryStatics ( MultiShape const & shape, ObjectVec * outList ) const { - return queryStatics( nullptr, shape, outList ); + return queryStatics( NULL, shape, outList ); } // ---------- @@ -779,21 +779,21 @@ bool SpatialDatabase::queryStatics ( Line3d const & line, ObjectVec * outList ) bool SpatialDatabase::queryStatics ( CellProperty const * cell, MultiShape const & shape, ObjectVec * outList ) const { - return queryObjects(cell,shape,outList,nullptr); + return queryObjects(cell,shape,outList,NULL); } // ---------------------------------------------------------------------- bool SpatialDatabase::queryDynamics ( Sphere const & sphere, ObjectVec * outList ) const { - return queryObjects( nullptr, MultiShape(sphere), nullptr, outList ); + return queryObjects( NULL, MultiShape(sphere), NULL, outList ); } // ---------- bool SpatialDatabase::queryDynamics ( MultiShape const & shape, ObjectVec * outList ) const { - return queryObjects( nullptr, shape, nullptr, outList ); + return queryObjects( NULL, shape, NULL, outList ); } // ---------------------------------------------------------------------- @@ -982,7 +982,7 @@ bool SpatialDatabase::queryCloseStatics ( Vector const & point_w, float maxDista float minClose; float maxClose; - CollisionProperty * dummy = nullptr; + CollisionProperty * dummy = NULL; if(m_staticTree->findClosest(point_w,maxDistance,dummy,minClose,maxClose)) { @@ -1001,7 +1001,7 @@ bool SpatialDatabase::queryCloseFloors ( Vector const & point_w, float maxDistan float minClose; float maxClose; - Floor * dummy = nullptr; + Floor * dummy = NULL; if(m_floorTree->findClosest(point_w,maxDistance,dummy,minClose,maxClose)) { @@ -1163,7 +1163,7 @@ bool SpatialDatabase::queryMaterial ( CellProperty const * cell, // TODO: why are we skipping out on the tests when the extent is a MeshExtent??? MeshExtent const * mesh = dynamic_cast(extent); - if(mesh != nullptr) continue; + if(mesh != NULL) continue; Range hitRange = extent->rangedIntersect(seg_p); @@ -1244,7 +1244,7 @@ bool SpatialDatabase::queryMaterial ( CellProperty const * cellA, CollisionProperty * collisionB = results[i]; NOT_NULL(collisionB); - if (collisionB == nullptr) + if (collisionB == NULL) continue; // ---------- diff --git a/engine/shared/library/sharedCollision/src/shared/extent/BoxExtent.cpp b/engine/shared/library/sharedCollision/src/shared/extent/BoxExtent.cpp index 96ce5e4c..3adb1a61 100755 --- a/engine/shared/library/sharedCollision/src/shared/extent/BoxExtent.cpp +++ b/engine/shared/library/sharedCollision/src/shared/extent/BoxExtent.cpp @@ -394,7 +394,7 @@ void BoxExtent::drawDebugShapes ( DebugShapeRenderer * renderer ) const #ifdef _DEBUG - if(renderer == nullptr) return; + if(renderer == NULL) return; renderer->setColor( VectorArgb::solidBlue ); renderer->drawBox(m_box); diff --git a/engine/shared/library/sharedCollision/src/shared/extent/CollisionDetect.cpp b/engine/shared/library/sharedCollision/src/shared/extent/CollisionDetect.cpp index 6f1dce72..1602025b 100755 --- a/engine/shared/library/sharedCollision/src/shared/extent/CollisionDetect.cpp +++ b/engine/shared/library/sharedCollision/src/shared/extent/CollisionDetect.cpp @@ -49,11 +49,11 @@ int CollisionDetect::getTestCounter ( void ) BaseExtent const * getCollisionExtent_p ( Object const * obj ) { - if(obj == nullptr) return nullptr; + if(obj == NULL) return NULL; CollisionProperty const * collision = obj->getCollisionProperty(); - if(!collision) return nullptr; + if(!collision) return NULL; return collision->getExtent_p(); } @@ -62,8 +62,8 @@ BaseExtent const * getCollisionExtent_p ( Object const * obj ) DetectResult CollisionDetect::testObjects ( Object const * objA, Object const * objB ) { - if(objA == nullptr) return false; - if(objB == nullptr) return false; + if(objA == NULL) return false; + if(objB == NULL) return false; // ---------- @@ -85,8 +85,8 @@ DetectResult CollisionDetect::testObjects ( Object const * objA, Object const * DetectResult CollisionDetect::testObjects ( Object const * objA, Vector const & velocity, Object const * objB ) { - if(objA == nullptr) return false; - if(objB == nullptr) return false; + if(objA == NULL) return false; + if(objB == NULL) return false; // ---------- @@ -108,8 +108,8 @@ DetectResult CollisionDetect::testObjects ( Object const * objA, Vector const & DetectResult CollisionDetect::testObjectsAsCylinders ( Object const * objA, Object const * objB ) { - if(objA == nullptr) return false; - if(objB == nullptr) return false; + if(objA == NULL) return false; + if(objB == NULL) return false; // ---------- @@ -133,7 +133,7 @@ DetectResult CollisionDetect::testObjectsAsCylinders ( Object const * objA, Obje DetectResult CollisionDetect::testObjectExtent ( Object const * objA, BaseExtent const * extentB ) { - if(objA == nullptr) return false; + if(objA == NULL) return false; CollisionProperty const * collA = objA->getCollisionProperty(); @@ -158,7 +158,7 @@ DetectResult CollisionDetect::testSphereExtent ( Sphere const & sphereA, BaseExt // don't return a DetectResult that contains a pointer to a temporary - result.extentA = nullptr; + result.extentA = NULL; return result; } @@ -175,7 +175,7 @@ DetectResult CollisionDetect::testSphereExtent ( Sphere const & sphereA, Vector // don't return a DetectResult that contains a pointer to a temporary - result.extentA = nullptr; + result.extentA = NULL; return result; } @@ -184,7 +184,7 @@ DetectResult CollisionDetect::testSphereExtent ( Sphere const & sphereA, Vector DetectResult CollisionDetect::testSphereObject ( Sphere const & sphereA, Object const * objB ) { - if(objB == nullptr) return false; + if(objB == NULL) return false; CollisionProperty const * collB = objB->getCollisionProperty(); @@ -201,7 +201,7 @@ DetectResult CollisionDetect::testSphereObject ( Sphere const & sphereA, Object DetectResult CollisionDetect::testSphereObject ( Sphere const & sphereA, Vector const & velocity, Object const * objB ) { - if(objB == nullptr) return false; + if(objB == NULL) return false; CollisionProperty const * collB = objB->getCollisionProperty(); @@ -332,8 +332,8 @@ DetectResult CollisionDetect::testCapsuleObjectAgainstAllTypes(Capsule const & c DetectResult CollisionDetect::testExtents ( BaseExtent const * extentA, BaseExtent const * extentB ) { - if(extentA == nullptr) return false; - if(extentB == nullptr) return false; + if(extentA == NULL) return false; + if(extentB == NULL) return false; ExtentType typeA = extentA->getType(); ExtentType typeB = extentB->getType(); @@ -352,8 +352,8 @@ DetectResult CollisionDetect::testExtents ( BaseExtent const * extentA, BaseExte DetectResult CollisionDetect::testExtents ( BaseExtent const * extentA, Vector const & velocity, BaseExtent const * extentB ) { - if(extentA == nullptr) return false; - if(extentB == nullptr) return false; + if(extentA == NULL) return false; + if(extentB == NULL) return false; ExtentType typeA = extentA->getType(); ExtentType typeB = extentB->getType(); @@ -372,8 +372,8 @@ DetectResult CollisionDetect::testExtents ( BaseExtent const * extentA, Vector c DetectResult CollisionDetect::testExtentsAsCylinders ( BaseExtent const * extentA, BaseExtent const * extentB ) { - if(extentA == nullptr) return false; - if(extentB == nullptr) return false; + if(extentA == NULL) return false; + if(extentB == NULL) return false; SimpleExtent const * simpleExtentA = safe_cast(extentA); SimpleExtent const * simpleExtentB = safe_cast(extentB); diff --git a/engine/shared/library/sharedCollision/src/shared/extent/CollisionDetect.h b/engine/shared/library/sharedCollision/src/shared/extent/CollisionDetect.h index 0974a602..8bc78848 100755 --- a/engine/shared/library/sharedCollision/src/shared/extent/CollisionDetect.h +++ b/engine/shared/library/sharedCollision/src/shared/extent/CollisionDetect.h @@ -25,16 +25,16 @@ public: DetectResult() : collided(false), collisionTime(Range::empty), - extentA(nullptr), - extentB(nullptr) + extentA(NULL), + extentB(NULL) { } DetectResult ( bool result ) : collided(result), collisionTime( result ? Range::inf : Range::empty ), - extentA(nullptr), - extentB(nullptr) + extentA(NULL), + extentB(NULL) { } diff --git a/engine/shared/library/sharedCollision/src/shared/extent/CompositeExtent.cpp b/engine/shared/library/sharedCollision/src/shared/extent/CompositeExtent.cpp index e005e711..d7a6d91a 100755 --- a/engine/shared/library/sharedCollision/src/shared/extent/CompositeExtent.cpp +++ b/engine/shared/library/sharedCollision/src/shared/extent/CompositeExtent.cpp @@ -31,11 +31,11 @@ CompositeExtent::~CompositeExtent() { delete m_extents->at(i); - m_extents->at(i) = nullptr; + m_extents->at(i) = NULL; } delete m_extents; - m_extents = nullptr; + m_extents = NULL; } @@ -116,7 +116,7 @@ void CompositeExtent::drawDebugShapes ( DebugShapeRenderer * renderer ) const #ifdef _DEBUG - if(renderer == nullptr) return; + if(renderer == NULL) return; for(int i = 0; i < getExtentCount(); i++) { diff --git a/engine/shared/library/sharedCollision/src/shared/extent/CylinderExtent.cpp b/engine/shared/library/sharedCollision/src/shared/extent/CylinderExtent.cpp index 26cf80c5..04d069c9 100755 --- a/engine/shared/library/sharedCollision/src/shared/extent/CylinderExtent.cpp +++ b/engine/shared/library/sharedCollision/src/shared/extent/CylinderExtent.cpp @@ -146,7 +146,7 @@ void CylinderExtent::drawDebugShapes ( DebugShapeRenderer * renderer ) const #ifdef _DEBUG - if(renderer == nullptr) return; + if(renderer == NULL) return; renderer->setColor( VectorArgb::solidGreen ); renderer->drawCylinder(m_cylinder); diff --git a/engine/shared/library/sharedCollision/src/shared/extent/DetailExtent.cpp b/engine/shared/library/sharedCollision/src/shared/extent/DetailExtent.cpp index 1648d2c2..8ceea23a 100755 --- a/engine/shared/library/sharedCollision/src/shared/extent/DetailExtent.cpp +++ b/engine/shared/library/sharedCollision/src/shared/extent/DetailExtent.cpp @@ -232,11 +232,11 @@ void DetailExtent::updateBounds ( void ) int countExtents ( BaseExtent const * extent ) { - if(extent == nullptr) return 0; + if(extent == NULL) return 0; CompositeExtent const * composite = dynamic_cast(extent); - if(composite == nullptr) return 1; + if(composite == NULL) return 1; int accum = 0; diff --git a/engine/shared/library/sharedCollision/src/shared/extent/Extent.cpp b/engine/shared/library/sharedCollision/src/shared/extent/Extent.cpp index 248e54f1..24768bf9 100755 --- a/engine/shared/library/sharedCollision/src/shared/extent/Extent.cpp +++ b/engine/shared/library/sharedCollision/src/shared/extent/Extent.cpp @@ -369,7 +369,7 @@ void Extent::drawDebugShapes ( DebugShapeRenderer * renderer ) const #ifdef _DEBUG - if(renderer == nullptr) return; + if(renderer == NULL) return; renderer->setColor( VectorArgb::solidYellow ); renderer->drawSphere(m_sphere); diff --git a/engine/shared/library/sharedCollision/src/shared/extent/ExtentList.cpp b/engine/shared/library/sharedCollision/src/shared/extent/ExtentList.cpp index 954aac1a..e77715a1 100755 --- a/engine/shared/library/sharedCollision/src/shared/extent/ExtentList.cpp +++ b/engine/shared/library/sharedCollision/src/shared/extent/ExtentList.cpp @@ -44,7 +44,7 @@ Extent * ExtentList::nullFactory ( Iff & iff ) IGNORE_RETURN( iff.goForward() ); - return nullptr; + return NULL; } // ====================================================================== @@ -110,7 +110,7 @@ void ExtentList::remove(void) void ExtentList::assignBinding(Tag tag, CreateFunction createFunction) { - DEBUG_FATAL(!createFunction, ("createFunction may not be nullptr")); + DEBUG_FATAL(!createFunction, ("createFunction may not be NULL")); (*ms_bindImpl.m_map) [tag] = createFunction; } @@ -133,7 +133,7 @@ void ExtentList::removeBinding(Tag tag) /** * Fetch an Extent. * - * This routine may be passed nullptr. + * This routine may be passed NULL. * * This routine will increase the reference count of the specified extent. * @@ -165,7 +165,7 @@ Extent * ExtentList::create(Iff & iff) // handle no extents if (iff.atEndOfForm()) - return nullptr; + return NULL; const Tag tag = iff.getCurrentName(); @@ -201,7 +201,7 @@ const Extent *ExtentList::fetch(Iff & iff) /** * Release an Extent. * - * This routine may be passed nullptr. + * This routine may be passed NULL. * * This routine will decrement the reference count of the Extent. When * the reference count becomes 0, the Extent will be deleted. diff --git a/engine/shared/library/sharedCollision/src/shared/extent/MeshExtent.cpp b/engine/shared/library/sharedCollision/src/shared/extent/MeshExtent.cpp index c32e7857..2384b251 100755 --- a/engine/shared/library/sharedCollision/src/shared/extent/MeshExtent.cpp +++ b/engine/shared/library/sharedCollision/src/shared/extent/MeshExtent.cpp @@ -62,15 +62,15 @@ SimpleCollisionMesh * MeshExtent::createMesh( IndexedTriangleList * tris ) MeshExtent::MeshExtent() : Extent(ET_Mesh), - m_mesh(nullptr), + m_mesh(NULL), m_box() { - m_mesh = createMesh(nullptr); + m_mesh = createMesh(NULL); } MeshExtent::MeshExtent( IndexedTriangleList * tris ) : Extent(ET_Mesh), - m_mesh(nullptr), + m_mesh(NULL), m_box() { m_mesh = createMesh(tris); @@ -86,7 +86,7 @@ MeshExtent::MeshExtent( SimpleCollisionMesh * mesh ) MeshExtent::~MeshExtent() { delete m_mesh; - m_mesh = nullptr; + m_mesh = NULL; } // ---------------------------------------------------------------------- @@ -168,7 +168,7 @@ void MeshExtent::drawDebugShapes ( DebugShapeRenderer * renderer ) const #ifdef _DEBUG - if(renderer == nullptr) return; + if(renderer == NULL) return; renderer->setColor( VectorArgb::solidWhite ); m_mesh->drawDebugShapes(renderer); diff --git a/engine/shared/library/sharedCollision/src/shared/extent/OrientedCylinderExtent.cpp b/engine/shared/library/sharedCollision/src/shared/extent/OrientedCylinderExtent.cpp index 113784a6..234db209 100755 --- a/engine/shared/library/sharedCollision/src/shared/extent/OrientedCylinderExtent.cpp +++ b/engine/shared/library/sharedCollision/src/shared/extent/OrientedCylinderExtent.cpp @@ -106,7 +106,7 @@ void OrientedCylinderExtent::drawDebugShapes ( DebugShapeRenderer * renderer ) c #ifdef _DEBUG - if(renderer == nullptr) return; + if(renderer == NULL) return; renderer->setColor( VectorArgb::solidGreen ); renderer->draw(m_cylinder); diff --git a/engine/shared/library/sharedCollision/src/shared/extent/SimpleExtent.cpp b/engine/shared/library/sharedCollision/src/shared/extent/SimpleExtent.cpp index bc8a27e6..5e744c37 100755 --- a/engine/shared/library/sharedCollision/src/shared/extent/SimpleExtent.cpp +++ b/engine/shared/library/sharedCollision/src/shared/extent/SimpleExtent.cpp @@ -146,7 +146,7 @@ void SimpleExtent::drawDebugShapes ( DebugShapeRenderer * renderer ) const #ifdef _DEBUG - if(renderer == nullptr) return; + if(renderer == NULL) return; switch( getShape().getShapeType() ) { diff --git a/engine/shared/library/sharedCompression/src/shared/BitStream.cpp b/engine/shared/library/sharedCompression/src/shared/BitStream.cpp index 54d2a244..7cc5876c 100755 --- a/engine/shared/library/sharedCompression/src/shared/BitStream.cpp +++ b/engine/shared/library/sharedCompression/src/shared/BitStream.cpp @@ -48,8 +48,8 @@ BitBuffer::BitBuffer(void *buffer, int size, bool inputStream) current(base), bufSize(size) { - DEBUG_FATAL(!buffer, ("buffer nullptr")); - DEBUG_FATAL(!current, ("buffer nullptr")); + DEBUG_FATAL(!buffer, ("buffer null")); + DEBUG_FATAL(!current, ("buffer null")); } // ---------------------------------------------------------------------- @@ -59,8 +59,8 @@ BitBuffer::BitBuffer(void *buffer, int size, bool inputStream) BitBuffer::~BitBuffer(void) { - base = nullptr; - current = nullptr; + base = NULL; + current = NULL; } // ---------------------------------------------------------------------- @@ -181,17 +181,17 @@ BitFile::BitFile(const char *fileName, bool inputStream) { if (isInput) { - hFile = CreateFile(fileName, GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); + hFile = CreateFile(fileName, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); } else { // try to truncate it first - hFile = CreateFile(fileName, GENERIC_READ | GENERIC_WRITE, 0, nullptr, TRUNCATE_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); + hFile = CreateFile(fileName, GENERIC_READ | GENERIC_WRITE, 0, NULL, TRUNCATE_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile == INVALID_HANDLE_VALUE) { //if that fails, create it - hFile = CreateFile(fileName, GENERIC_READ | GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); + hFile = CreateFile(fileName, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); } } @@ -215,7 +215,7 @@ BitFile::~BitFile(void) } } - hFile = nullptr; + hFile = NULL; delete [] name; } @@ -224,7 +224,7 @@ BitFile::~BitFile(void) int BitFile::getOffset(void) const { - return static_cast(SetFilePointer(hFile, 0, nullptr, FILE_CURRENT)); + return static_cast(SetFilePointer(hFile, 0, NULL, FILE_CURRENT)); } // ---------------------------------------------------------------------- @@ -254,7 +254,7 @@ void BitFile::outputBits(uint32 code, uint32 count) if (!mask) { uint32 bytesWritten; - if (!WriteFile(hFile, &rack, sizeof(rack), &bytesWritten, nullptr)) + if (!WriteFile(hFile, &rack, sizeof(rack), &bytesWritten, NULL)) { DEBUG_FATAL(true,("BitFile::outputBits error %d.", GetLastError())); } @@ -280,7 +280,7 @@ void BitFile::outputRack(void) if (mask != INITIAL_MASK_VALUE) { - if (!WriteFile(hFile, &rack, sizeof(rack), &bytesWritten, nullptr)) + if (!WriteFile(hFile, &rack, sizeof(rack), &bytesWritten, NULL)) { DEBUG_FATAL(true,("BitFile::outputRack writing error %d.", GetLastError())); } @@ -312,7 +312,7 @@ uint32 BitFile::inputBits(uint32 count) { uint32 bytesRead; - const BOOL result = ReadFile(hFile, &rack, sizeof(rack), &bytesRead, nullptr); + const BOOL result = ReadFile(hFile, &rack, sizeof(rack), &bytesRead, NULL); UNREF(result); DEBUG_FATAL(result && !bytesRead,("BitFile::inputBits hit EOF")); @@ -383,8 +383,8 @@ ByteBuffer::ByteBuffer(void *buffer, int size, bool inputStream) ByteBuffer::~ByteBuffer(void) { - base = nullptr; - current = nullptr; + base = NULL; + current = NULL; } // ---------------------------------------------------------------------- @@ -422,7 +422,7 @@ void ByteBuffer::output(byte b) bool ByteBuffer::input(byte *b) { - DEBUG_FATAL(!b, ("nullptr pointer")); + DEBUG_FATAL(!b, ("null pointer")); DEBUG_FATAL(!isInput,("ByteBuffer::input called on output stream")); if ((current - base) >= bufSize) @@ -446,15 +446,15 @@ ByteFile::ByteFile(const char *fileName, bool inputStream) { if (isInput) { - hFile = CreateFile(fileName, GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); + hFile = CreateFile(fileName, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); } else { - hFile = CreateFile(fileName, GENERIC_READ | GENERIC_WRITE, 0, nullptr, TRUNCATE_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); + hFile = CreateFile(fileName, GENERIC_READ | GENERIC_WRITE, 0, NULL, TRUNCATE_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile == INVALID_HANDLE_VALUE) { - hFile = CreateFile(fileName, GENERIC_READ | GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); + hFile = CreateFile(fileName, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); } } @@ -473,7 +473,7 @@ ByteFile::~ByteFile(void) if (hFile != INVALID_HANDLE_VALUE && !CloseHandle(hFile)) DEBUG_FATAL(true,("ByteFile::~ByteFile - Unable to close HANDLE for file %s - Error %d", name, GetLastError())); - hFile = nullptr; + hFile = NULL; delete [] name; } @@ -482,7 +482,7 @@ ByteFile::~ByteFile(void) int ByteFile::getOffset(void) const { - return static_cast(SetFilePointer(hFile, 0, nullptr, FILE_CURRENT)); + return static_cast(SetFilePointer(hFile, 0, NULL, FILE_CURRENT)); } // ---------------------------------------------------------------------- @@ -497,7 +497,7 @@ void ByteFile::output(byte b) byte out = b; uint32 bytesWritten; - if (!WriteFile(hFile, &out, sizeof(byte), &bytesWritten, nullptr)) + if (!WriteFile(hFile, &out, sizeof(byte), &bytesWritten, NULL)) { DEBUG_FATAL(true,("ByteFile::output error %d.", GetLastError())); } @@ -518,7 +518,7 @@ bool ByteFile::input(byte *b) DEBUG_FATAL(!isInput,("ByteFile::input called on output stream.")); uint32 bytesRead; - BOOL result = ReadFile(hFile, b, sizeof(byte), &bytesRead, nullptr); + BOOL result = ReadFile(hFile, b, sizeof(byte), &bytesRead, NULL); // check for EOS return (result && !bytesRead); diff --git a/engine/shared/library/sharedCompression/src/shared/Lz77.cpp b/engine/shared/library/sharedCompression/src/shared/Lz77.cpp index 1f630cb8..cb18232f 100755 --- a/engine/shared/library/sharedCompression/src/shared/Lz77.cpp +++ b/engine/shared/library/sharedCompression/src/shared/Lz77.cpp @@ -47,7 +47,7 @@ Lz77::Lz77(uint32 _indexBitCount, uint32 _lengthBitCount) lookAheadSize(rawLookAheadSize + breakEven), treeRoot(windowSize), window(new byte[windowSize]), - tree(nullptr) + tree(NULL) { } @@ -232,10 +232,10 @@ uint32 Lz77::findNextNode(uint32 node) * Delete a string from the tree. * * This routine performs the classic binary tree deletion algorithm. - * If the node to be deleted has a nullptr link in either direction, we - * just pull the non-nullptr link up one to replace the existing link. + * If the node to be deleted has a null link in either direction, we + * just pull the non-null link up one to replace the existing link. * If both links exist, we instead delete the next link in order, which - * is guaranteed to have a nullptr link, then replace the node to be deleted + * is guaranteed to have a null link, then replace the node to be deleted * with the next link. */ @@ -286,7 +286,7 @@ uint32 Lz77::addString(uint32 newNode, uint32 *matchPosition) uint32 *child; int delta = 0; - DEBUG_FATAL(!matchPosition, ("matchPosition is nullptr")); + DEBUG_FATAL(!matchPosition, ("matchPosition is NULL")); if (newNode == endOfStream) return 0; diff --git a/engine/shared/library/sharedCompression/src/shared/ZlibCompressor.cpp b/engine/shared/library/sharedCompression/src/shared/ZlibCompressor.cpp index 7f3aed3d..aedbda00 100755 --- a/engine/shared/library/sharedCompression/src/shared/ZlibCompressor.cpp +++ b/engine/shared/library/sharedCompression/src/shared/ZlibCompressor.cpp @@ -121,8 +121,8 @@ void ZlibCompressorNamespace::remove() DEBUG_FATAL(static_cast(ms_memoryPool.size()) != ms_poolElementCount, ("ZLibCompressor memory pool entries not all released")); operator delete(ms_memoryBottom); - ms_memoryBottom = nullptr; - ms_memoryTop = nullptr; + ms_memoryBottom = NULL; + ms_memoryTop = NULL; ms_memoryPool.clear(); ms_mutex.leave(); @@ -155,12 +155,12 @@ int ZlibCompressor::compress(const void *inputBuffer, int inputSize, void *outpu z.avail_out = outputSize; z.total_out = 0; - z.msg = nullptr; - z.state = nullptr; + z.msg = NULL; + z.state = NULL; z.zalloc = allocateWrapper; z.zfree = freeWrapper; - z.opaque = nullptr; + z.opaque = NULL; z.data_type = Z_BINARY; z.adler = 0; @@ -196,12 +196,12 @@ int ZlibCompressor::expand(const void *inputBuffer, int inputSize, void *outputB z.avail_out = outputSize; z.total_out = 0; - z.msg = nullptr; - z.state = nullptr; + z.msg = NULL; + z.state = NULL; z.zalloc = allocateWrapper; z.zfree = freeWrapper; - z.opaque = nullptr; + z.opaque = NULL; z.data_type = Z_BINARY; z.adler = 0; diff --git a/engine/shared/library/sharedDatabaseInterface/src/shared/core/Bindable.h b/engine/shared/library/sharedDatabaseInterface/src/shared/core/Bindable.h index 03c2d7dc..22617057 100755 --- a/engine/shared/library/sharedDatabaseInterface/src/shared/core/Bindable.h +++ b/engine/shared/library/sharedDatabaseInterface/src/shared/core/Bindable.h @@ -1,13 +1,13 @@ /* Bindable.h * * Defines classes based on built-in simple types that know how to bind themselves to - * database queries and support nullptr values. + * database queries and support null values. * * Each class supports the following functions: - * bool isNull -- test whether the value is nullptr - * void setToNull -- set the value to nullptr - * getValue -- return the value (make sure you test for nullptr before calling this. The results - * are undefined if the Bindable is nullptr.) + * bool isNull -- test whether the value is null + * void setToNull -- set the value to null + * getValue -- return the value (make sure you test for null before calling this. The results + * are undefined if the Bindable is null.) * setValue -- set the value * * ODBC version diff --git a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableBase.h b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableBase.h index 2aa7e5b8..51008166 100755 --- a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableBase.h +++ b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableBase.h @@ -31,7 +31,7 @@ namespace DB { explicit Bindable(int _indicator); /** - * The size of the data, or -1 for nullptr. + * The size of the data, or -1 for NULL. */ int indicator; }; diff --git a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableBool.h b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableBool.h index 044371fe..36929d60 100755 --- a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableBool.h +++ b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableBool.h @@ -18,7 +18,7 @@ namespace DB { /** Represents a bool in C++, bound to a CHAR(1) column. The column can have the values 'Y' or 'N'. - * TODO: use a boolean type in the database, if we can find one that allows nullptr's and is fairly + * TODO: use a boolean type in the database, if we can find one that allows NULL's and is fairly * portable. (May not exist -- according to the docs, Oracle does not have a boolean datatype.) */ class BindableBool : public Bindable diff --git a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableString.h b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableString.h index 2548990e..103b2ada 100755 --- a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableString.h +++ b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableString.h @@ -133,11 +133,11 @@ namespace DB std::string getValueASCII() const; /** Allocate a new string and copy the buffer to it. The caller takes responsibility - for delete[]ing it later. (If the string is nullptr, this returns a nullptr pointer.) + for delete[]ing it later. (If the string is NULL, this returns a null pointer.) */ char *makeCopyOfValue() const; -/** Set the value of the bindable string from another (nullptr-terminated) string +/** Set the value of the bindable string from another (null-terminated) string If the source buffer is too big, it FATAL's. Another alternative would be to have it truncate the string. Right now, it's better to FATAL to avoid hard-to-find bugs @@ -168,7 +168,7 @@ namespace DB private: - char m_value[S+1]; // column of size S, plus one byte for a trailing nullptr + char m_value[S+1]; // column of size S, plus one byte for a trailing null }; // ====================================================================== @@ -206,7 +206,7 @@ namespace DB { if (isNull()) { - return strncpy(buffer,"\0",1); // in the database, a zero-length string and a nullptr aren't really + return strncpy(buffer,"\0",1); // in the database, a zero-length string and a NULL aren't really // the same thing, but this is the closest we can do here. } return strncpy(buffer,m_value,(bufsize>(S+1))?(S+1):bufsize); @@ -259,7 +259,7 @@ namespace DB } FATAL((i==S+1) && (m_value[S]!='\0'),("Attempt to save string \"%s\" to the database. It is too long for the column.",buffer)); indicator=i; // set indicator to actual length of string -// m_value[S]='\0'; // guarantee nullptr terminator -- uncomment if you remove the above FATAL +// m_value[S]='\0'; // guarantee null terminator -- uncomment if you remove the above FATAL } template diff --git a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableUnicode.h b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableUnicode.h index 544ead4c..9c85e6d4 100755 --- a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableUnicode.h +++ b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableUnicode.h @@ -143,7 +143,7 @@ namespace DB private: - char m_value[S+1]; // column of size S, plus one byte for a trailing nullptr + char m_value[S+1]; // column of size S, plus one byte for a trailing null }; // ====================================================================== diff --git a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBufferRow.h b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBufferRow.h index 550f2896..0d1b70d0 100755 --- a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBufferRow.h +++ b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBufferRow.h @@ -33,9 +33,9 @@ namespace DB * Combines the values in this row with the values in newRow. * * For each column: - * If the column is nullptr in newRow, do nothing. (Leave the value + * If the column is null in newRow, do nothing. (Leave the value * in this row unchanged.) - * If the column is not nullptr in newRow, replace the value in this + * If the column is not null in newRow, replace the value in this * row with the value in newRow. */ virtual void combine(const DB::Row &newRow) =0; diff --git a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbServer.cpp b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbServer.cpp index 83015b31..13f7460e 100755 --- a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbServer.cpp +++ b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbServer.cpp @@ -29,7 +29,7 @@ using namespace DB; Mutex Server::ms_profileMutex; bool Server::ms_enableProfiling = false; bool Server::ms_enableVerboseMode = false; -DB::Profiler *Server::ms_profiler = nullptr; +DB::Profiler *Server::ms_profiler = NULL; int Server::ms_reconnectTime=0; int Server::ms_maxErrorCountBeforeDisconnect=5; int Server::ms_maxErrorCountBeforeBailout=10; @@ -51,7 +51,7 @@ Server::SesListElem::SesListElem (Session *_ses, SesListElem *_next) : ses (_ses // ---------------------------------------------------------------------- Server::Server(const char *_dsn, const char *_uid, const char *_pwd, bool useMemoryManager) : - sessionList (nullptr), + sessionList (NULL), sessionListLock(), m_useMemoryManager(useMemoryManager) { @@ -194,7 +194,7 @@ Session *Server::popSession() else { sessionListLock.leave(); - return nullptr; + return NULL; } } @@ -294,7 +294,7 @@ void Server::endProfiling() { ms_profileMutex.enter(); delete ms_profiler; - ms_profiler = nullptr; + ms_profiler = NULL; ms_enableProfiling = false; ms_profileMutex.leave(); } diff --git a/engine/shared/library/sharedDatabaseInterface/src/shared/core/NullEncodedStandardString.h b/engine/shared/library/sharedDatabaseInterface/src/shared/core/NullEncodedStandardString.h index 57a4395e..ff154c7c 100755 --- a/engine/shared/library/sharedDatabaseInterface/src/shared/core/NullEncodedStandardString.h +++ b/engine/shared/library/sharedDatabaseInterface/src/shared/core/NullEncodedStandardString.h @@ -15,7 +15,7 @@ // ====================================================================== /** - * A unicode-string-compatible class that encodes a nullptr value as a single space + * A unicode-string-compatible class that encodes a null value as a single space */ class NullEncodedStandardString { diff --git a/engine/shared/library/sharedDatabaseInterface/src/shared/core/NullEncodedUnicodeString.h b/engine/shared/library/sharedDatabaseInterface/src/shared/core/NullEncodedUnicodeString.h index 45a2c521..b28de588 100755 --- a/engine/shared/library/sharedDatabaseInterface/src/shared/core/NullEncodedUnicodeString.h +++ b/engine/shared/library/sharedDatabaseInterface/src/shared/core/NullEncodedUnicodeString.h @@ -15,7 +15,7 @@ // ====================================================================== /** - * A unicode-string-compatible class that encodes a nullptr value as a single space + * A unicode-string-compatible class that encodes a null value as a single space */ class NullEncodedUnicodeString { diff --git a/engine/shared/library/sharedDatabaseInterface/src_oci/DbBindableVarray.cpp b/engine/shared/library/sharedDatabaseInterface/src_oci/DbBindableVarray.cpp index b0cec73d..7fff3387 100755 --- a/engine/shared/library/sharedDatabaseInterface/src_oci/DbBindableVarray.cpp +++ b/engine/shared/library/sharedDatabaseInterface/src_oci/DbBindableVarray.cpp @@ -22,9 +22,9 @@ using namespace DB; BindableVarray::BindableVarray() : m_initialized(false), - m_tdo (nullptr), - m_data (nullptr), - m_session (nullptr) + m_tdo (NULL), + m_data (NULL), + m_session (NULL) { } @@ -52,7 +52,7 @@ bool BindableVarray::create(DB::Session *session, const std::string &name, const schema.length(), reinterpret_cast(const_cast(name.c_str())), name.length(), - nullptr, + NULL, 0, OCI_DURATION_SESSION, OCI_TYPEGET_HEADER, @@ -64,7 +64,7 @@ bool BindableVarray::create(DB::Session *session, const std::string &name, const localSession->errhp, localSession->svchp, OCI_TYPECODE_VARRAY, - m_tdo, nullptr, + m_tdo, NULL, OCI_DURATION_DEFAULT, true, reinterpret_cast(&m_data))))) @@ -86,9 +86,9 @@ void BindableVarray::free() OCIObjectFree (localSession->envhp, localSession->errhp, m_data, 0))); m_initialized = false; - m_tdo=nullptr; - m_data=nullptr; - m_session=nullptr; + m_tdo=NULL; + m_data=NULL; + m_session=NULL; } // ---------------------------------------------------------------------- @@ -354,7 +354,7 @@ std::string BindableVarrayNumber::outputValue() const if (exists) { if (*indicator == OCI_IND_NULL) - result += "nullptr"; + result += "NULL"; else { double value; @@ -400,7 +400,7 @@ bool BindableVarrayString::push_back(const Unicode::String &value) bool BindableVarrayString::push_back(const std::string &value) { - OCIString *buffer = nullptr; + OCIString *buffer = NULL; OCIInd buffer_indicator (OCI_IND_NOTNULL); OCISession *localSession = safe_cast(m_session); @@ -437,7 +437,7 @@ bool BindableVarrayString::push_back(bool bvalue) else value = "N"; - OCIString *buffer = nullptr; + OCIString *buffer = NULL; OCIInd buffer_indicator (OCI_IND_NOTNULL); OCISession *localSession = safe_cast(m_session); @@ -469,7 +469,7 @@ bool BindableVarrayString::push_back(bool IsNULL, const Unicode::String &value) bool BindableVarrayString::push_back(bool IsNULL, const std::string &value) { - OCIString *buffer = nullptr; + OCIString *buffer = NULL; OCIInd buffer_indicator; if ( IsNULL ) { @@ -515,7 +515,7 @@ bool BindableVarrayString::push_back(bool IsNULL, bool bvalue) else value = "N"; - OCIString *buffer = nullptr; + OCIString *buffer = NULL; OCIInd buffer_indicator; if ( IsNULL ) { @@ -568,14 +568,14 @@ std::string BindableVarrayString::outputValue() const if (exists) { if (*indicator == OCI_IND_NULL) - result += "nullptr"; + result += "NULL"; else { OraText * text = OCIStringPtr(localSession->envhp, *element); if (text) result += '"' + std::string(reinterpret_cast(text)) + '"'; else - result += "nullptr"; + result += "NULL"; } } else diff --git a/engine/shared/library/sharedDatabaseInterface/src_oci/OciQueryImplementation.cpp b/engine/shared/library/sharedDatabaseInterface/src_oci/OciQueryImplementation.cpp index b4486dc8..ab311290 100755 --- a/engine/shared/library/sharedDatabaseInterface/src_oci/OciQueryImplementation.cpp +++ b/engine/shared/library/sharedDatabaseInterface/src_oci/OciQueryImplementation.cpp @@ -49,13 +49,13 @@ bool DB::OCIQueryImpl::setup(Session *session) { // setSession(session); - DEBUG_FATAL(m_session!=0,("m_session was not nullptr")); - DEBUG_FATAL(m_server!=0,("m_server was not nullptr")); + DEBUG_FATAL(m_session!=0,("m_session was not NULL")); + DEBUG_FATAL(m_server!=0,("m_server was not NULL")); DEBUG_FATAL(m_stmthp!=0,("m_stmthp was not 0")); DEBUG_FATAL(m_cursorhp!=0,("m_cursorhp was not 0")); m_session=dynamic_cast(session); - FATAL((m_session==0),("Must pass a non-nullptr OCISession to setup().")); + FATAL((m_session==0),("Must pass a non-NULL OCISession to setup().")); m_server=m_session->m_server; NOT_NULL(m_server); @@ -180,7 +180,7 @@ bool DB::OCIQueryImpl::exec() m_session->setOkToFetch(); m_session->setLastQueryStatement(m_sql); sword status=OCIStmtExecute(m_session->svchp, m_stmthp, m_session->errhp, 1, 0, - nullptr, nullptr, OCI_DEFAULT); + NULL, NULL, OCI_DEFAULT); if (status == OCI_NO_DATA) { @@ -393,8 +393,8 @@ DB::OCIQueryImpl::BindRec::BindRec(size_t numElements) : length(0), stringAdjust(false), m_numElements(numElements), - m_indicatorArray(nullptr), - m_lengthArray(nullptr) + m_indicatorArray(NULL), + m_lengthArray(NULL) { // This is ugly, but it avoids having to create two different kinds of bindrecs that inherit from an abstract base class if (m_numElements > 1) @@ -714,11 +714,11 @@ bool DB::OCIQueryImpl::bindParameter(BindableVarray &buffer) &(br->bindp), m_session->errhp, nextParameter++, - nullptr, + NULL, 0, SQLT_NTY, - nullptr, - nullptr, + NULL, + NULL, 0, 0, 0, diff --git a/engine/shared/library/sharedDatabaseInterface/src_oci/OciServer.cpp b/engine/shared/library/sharedDatabaseInterface/src_oci/OciServer.cpp index 7c40e0ae..ead0cb9c 100755 --- a/engine/shared/library/sharedDatabaseInterface/src_oci/OciServer.cpp +++ b/engine/shared/library/sharedDatabaseInterface/src_oci/OciServer.cpp @@ -63,7 +63,7 @@ bool DB::OCIServer::checkerr(OCISession const & session, int status) text errbuf[512]; sb4 errcode = 0; - OCIErrorGet((dvoid *)(session.errhp), (ub4) 1, (text *) nullptr, &errcode, + OCIErrorGet((dvoid *)(session.errhp), (ub4) 1, (text *) NULL, &errcode, errbuf, (ub4) sizeof(errbuf), OCI_HTYPE_ERROR); WARNING(true,("Database error: %.*s",512,errbuf)); diff --git a/engine/shared/library/sharedDatabaseInterface/src_oci/OciSession.cpp b/engine/shared/library/sharedDatabaseInterface/src_oci/OciSession.cpp index e7e7bc66..124998bc 100755 --- a/engine/shared/library/sharedDatabaseInterface/src_oci/OciSession.cpp +++ b/engine/shared/library/sharedDatabaseInterface/src_oci/OciSession.cpp @@ -56,11 +56,11 @@ static void freeHook(dvoid *, dvoid *memptr) DB::OCISession::OCISession(DB::OCIServer *server) : m_server(server), - envhp(nullptr), - errhp(nullptr), - srvhp(nullptr), - sesp(nullptr), - svchp(nullptr), + envhp(NULL), + errhp(NULL), + srvhp(NULL), + sesp(NULL), + svchp(NULL), autoCommitMode(true), m_resetTime(server->getReconnectTime()==0 ? 0 : time(0) + server->getReconnectTime()), m_okToFetch(true) @@ -235,11 +235,11 @@ bool DB::OCISession::disconnect() success = false; } - svchp = nullptr; - sesp = nullptr; - srvhp = nullptr; - errhp = nullptr; - envhp = nullptr; + svchp = NULL; + sesp = NULL; + srvhp = NULL; + errhp = NULL; + envhp = NULL; connectLock.leave(); return success; diff --git a/engine/shared/library/sharedDebug/src/linux/DebugMonitor.cpp b/engine/shared/library/sharedDebug/src/linux/DebugMonitor.cpp index 95dfef41..3dff8883 100755 --- a/engine/shared/library/sharedDebug/src/linux/DebugMonitor.cpp +++ b/engine/shared/library/sharedDebug/src/linux/DebugMonitor.cpp @@ -160,7 +160,7 @@ void DebugMonitor::install(void) // handle input from the output terminal, particularly to // handle profiler modifications when the output window // is active. - s_outputScreen = newterm(nullptr, s_ttyOutputFile, stdin); + s_outputScreen = newterm(NULL, s_ttyOutputFile, stdin); if (!s_outputScreen) { DEBUG_WARNING(true, ("DebugMonitor: newterm() failed [%s].", strerror(errno))); diff --git a/engine/shared/library/sharedDebug/src/linux/PerformanceTimer.cpp b/engine/shared/library/sharedDebug/src/linux/PerformanceTimer.cpp index f7bd1037..68c36d8c 100755 --- a/engine/shared/library/sharedDebug/src/linux/PerformanceTimer.cpp +++ b/engine/shared/library/sharedDebug/src/linux/PerformanceTimer.cpp @@ -39,7 +39,7 @@ PerformanceTimer::~PerformanceTimer() void PerformanceTimer::start() { - int const result = gettimeofday(&startTime, nullptr); + int const result = gettimeofday(&startTime, NULL); FATAL(result != 0,("PerformanceTimer::start failed")); } @@ -55,7 +55,7 @@ void PerformanceTimer::resume() usec += 1000000; } - int const result = gettimeofday(&startTime, nullptr); + int const result = gettimeofday(&startTime, NULL); FATAL(result != 0,("PerformanceTimer::resume failed")); startTime.tv_sec -= sec; @@ -71,7 +71,7 @@ void PerformanceTimer::resume() void PerformanceTimer::stop() { - int result = gettimeofday(&stopTime, nullptr); + int result = gettimeofday(&stopTime, NULL); FATAL(result != 0,("PerformanceTimer::start failed")); } @@ -95,7 +95,7 @@ float PerformanceTimer::getSplitTime() const { timeval currentTime; - int const result = gettimeofday(¤tTime, nullptr); + int const result = gettimeofday(¤tTime, NULL); FATAL(result != 0,("PerformanceTimer::getSplitTime failed")); long sec = currentTime.tv_sec - startTime.tv_sec; @@ -117,7 +117,7 @@ void PerformanceTimer::logElapsedTime(const char* string) const #ifdef _DEBUG static char buffer [1000]; - sprintf(buffer, "%s : %1.5f seconds\n", string ? string : "nullptr", getElapsedTime()); + sprintf(buffer, "%s : %1.5f seconds\n", string ? string : "null", getElapsedTime()); DEBUG_REPORT_LOG_PRINT(true, ("%s", buffer)); #endif } diff --git a/engine/shared/library/sharedDebug/src/shared/DataLint.cpp b/engine/shared/library/sharedDebug/src/shared/DataLint.cpp index 8f96856d..5190728f 100755 --- a/engine/shared/library/sharedDebug/src/shared/DataLint.cpp +++ b/engine/shared/library/sharedDebug/src/shared/DataLint.cpp @@ -35,9 +35,9 @@ namespace DataLintNamespace bool ms_installed = false; DataLint::AssetType m_currentAssetType = DataLint::AT_invalid; bool m_enabled = false; - WarningList * m_warningList = nullptr; - StringList * m_assetStack = nullptr; - DataLint::StringPairList * m_assetList = nullptr; + WarningList * m_warningList = NULL; + StringList * m_assetStack = NULL; + DataLint::StringPairList * m_assetList = NULL; std::string m_dataLintCategorizedAssetsFile("DataLint_CategorizedAssets.txt"); std::string m_dataLintUnSupportedAssetsFile("DataLint_UnSupportedAssets.txt"); Mode m_mode = M_client; @@ -123,17 +123,17 @@ void DataLint::report() // Client only - FILE *assetErrorFileAppearance = nullptr; - FILE *assetErrorFileArrangementDescriptor = nullptr; - FILE *assetErrorFileLocalizedStringTable = nullptr; - FILE *assetErrorFilePortalProperty = nullptr; - FILE *assetErrorFileShaderTemplate = nullptr; - FILE *assetErrorFileSkyBox = nullptr; - FILE *assetErrorFileSlotDescriptor = nullptr; - FILE *assetErrorFileSoundTemplate = nullptr; - FILE *assetErrorFileTerrain = nullptr; - FILE *assetErrorFileTexture = nullptr; - FILE *assetErrorFileTextureRenderer = nullptr; + FILE *assetErrorFileAppearance = NULL; + FILE *assetErrorFileArrangementDescriptor = NULL; + FILE *assetErrorFileLocalizedStringTable = NULL; + FILE *assetErrorFilePortalProperty = NULL; + FILE *assetErrorFileShaderTemplate = NULL; + FILE *assetErrorFileSkyBox = NULL; + FILE *assetErrorFileSlotDescriptor = NULL; + FILE *assetErrorFileSoundTemplate = NULL; + FILE *assetErrorFileTerrain = NULL; + FILE *assetErrorFileTexture = NULL; + FILE *assetErrorFileTextureRenderer = NULL; if (m_mode == M_client) { @@ -450,7 +450,7 @@ std::string DataLintNamespace::formatErrorMessage(WarningPair &warningPair, int char *assetError = strstr(text, " : "); - if (assetError != nullptr) + if (assetError != NULL) { ++assetError; ++assetError; @@ -567,12 +567,12 @@ void DataLint::clearAssetStack() //----------------------------------------------------------------------------- void DataLint::addFilePath(char const *filePath) { - if (filePath == nullptr || (strlen(filePath) <= 0)) + if (filePath == NULL || (strlen(filePath) <= 0)) { return; } - if (m_assetList != nullptr) + if (m_assetList != NULL) { char text[4096]; sprintf(text, "%s", filePath); @@ -592,7 +592,7 @@ void DataLint::addFilePath(char const *filePath) //----------------------------------------------------------------------------- void DataLint::removeFilePath(char const *filePath) { - if (m_assetList != nullptr) + if (m_assetList != NULL) { StringPairList::iterator stringPairListIter = m_assetList->begin(); @@ -611,8 +611,8 @@ void DataLint::removeFilePath(char const *filePath) //----------------------------------------------------------------------------- bool DataLintNamespace::isAnAppearanceAsset(char const *text) { - bool const appearanceAsset = (strstr(text, "appearance/") != nullptr); - bool const portalPropertyAsset = (strstr(text, ".pob") != nullptr); + bool const appearanceAsset = (strstr(text, "appearance/") != NULL); + bool const portalPropertyAsset = (strstr(text, ".pob") != NULL); return (appearanceAsset && !portalPropertyAsset); } @@ -620,7 +620,7 @@ bool DataLintNamespace::isAnAppearanceAsset(char const *text) //----------------------------------------------------------------------------- bool DataLintNamespace::isAnArrangementDescriptorAsset(char const *text) { - bool const arrangementDescriptorAsset = (strstr(text, "slot/arrangement/") != nullptr); + bool const arrangementDescriptorAsset = (strstr(text, "slot/arrangement/") != NULL); return arrangementDescriptorAsset; } @@ -628,7 +628,7 @@ bool DataLintNamespace::isAnArrangementDescriptorAsset(char const *text) //----------------------------------------------------------------------------- bool DataLintNamespace::isALocalizedStringAsset(char const *text) { - bool const localizedStringAsset = (strstr(text, ".stf") != nullptr); + bool const localizedStringAsset = (strstr(text, ".stf") != NULL); return localizedStringAsset; } @@ -638,8 +638,8 @@ bool DataLintNamespace::isAnObjectTemplateAsset(char const *text) { bool result = false; UNREF(text); - bool const isInTheObjectDirectory = (strstr(text, "object/") != nullptr); - bool const isInTheAbstractDirectory = (strstr(text, "abstract/") != nullptr); + bool const isInTheObjectDirectory = (strstr(text, "object/") != NULL); + bool const isInTheAbstractDirectory = (strstr(text, "abstract/") != NULL); if (isInTheObjectDirectory || isInTheAbstractDirectory) { @@ -655,7 +655,7 @@ bool DataLintNamespace::isAnObjectTemplateAsset(char const *text) //----------------------------------------------------------------------------- bool DataLintNamespace::isAPortalProprtyAsset(char const *text) { - bool const portalPropertyAsset = (strstr(text, ".pob") != nullptr); + bool const portalPropertyAsset = (strstr(text, ".pob") != NULL); return portalPropertyAsset; } @@ -663,7 +663,7 @@ bool DataLintNamespace::isAPortalProprtyAsset(char const *text) //----------------------------------------------------------------------------- bool DataLintNamespace::isAShaderTemplateAsset(char const *text) { - bool const shaderTemplateAsset = (strstr(text, "shader/") != nullptr); + bool const shaderTemplateAsset = (strstr(text, "shader/") != NULL); return shaderTemplateAsset; } @@ -671,7 +671,7 @@ bool DataLintNamespace::isAShaderTemplateAsset(char const *text) //----------------------------------------------------------------------------- bool DataLintNamespace::isASkyBoxAsset(char const *text) { - bool const skyBoxAsset = (strstr(text, "skybox/") != nullptr); + bool const skyBoxAsset = (strstr(text, "skybox/") != NULL); return skyBoxAsset; } @@ -679,7 +679,7 @@ bool DataLintNamespace::isASkyBoxAsset(char const *text) //----------------------------------------------------------------------------- bool DataLintNamespace::isASlotDescriptorAsset(char const *text) { - bool const slotDescriptorAsset = (strstr(text, "slot/descriptor/") != nullptr); + bool const slotDescriptorAsset = (strstr(text, "slot/descriptor/") != NULL); return slotDescriptorAsset; } @@ -687,7 +687,7 @@ bool DataLintNamespace::isASlotDescriptorAsset(char const *text) //----------------------------------------------------------------------------- bool DataLintNamespace::isASoundAsset(char const *text) { - bool const soundAsset = (strstr(text, "sound/") != nullptr); + bool const soundAsset = (strstr(text, "sound/") != NULL); return soundAsset; } @@ -701,7 +701,7 @@ bool DataLintNamespace::isATerrainAsset(char const *text) //----------------------------------------------------------------------------- bool DataLintNamespace::isATextureAsset(char const *text) { - bool const textureAsset = (strstr(text, ".dds") != nullptr); + bool const textureAsset = (strstr(text, ".dds") != NULL); return textureAsset; } @@ -709,7 +709,7 @@ bool DataLintNamespace::isATextureAsset(char const *text) //----------------------------------------------------------------------------- bool DataLintNamespace::isATextureRendererTemplateAsset(char const *text) { - bool const textureRendererAsset = (strstr(text, ".trt") != nullptr); + bool const textureRendererAsset = (strstr(text, ".trt") != NULL); return textureRendererAsset; } @@ -749,7 +749,7 @@ bool DataLintNamespace::isAnUnSupportedAsset(char const *text) //----------------------------------------------------------------------------- DataLint::StringPairList DataLintNamespace::getList(int const reserveCount, AssetFunction assetTypeFunction) { - DEBUG_FATAL(!m_assetList, ("DataLint::getList() - m_assetList is nullptr")); + DEBUG_FATAL(!m_assetList, ("DataLint::getList() - m_assetList is NULL")); // Create the list of terrains diff --git a/engine/shared/library/sharedDebug/src/shared/DebugFlags.cpp b/engine/shared/library/sharedDebug/src/shared/DebugFlags.cpp index c82795d4..c676ddeb 100755 --- a/engine/shared/library/sharedDebug/src/shared/DebugFlags.cpp +++ b/engine/shared/library/sharedDebug/src/shared/DebugFlags.cpp @@ -25,8 +25,8 @@ std::vector DebugFlags::ms_flagsSortedByReportPriority; void DebugFlags::config(bool &variable, const char *configSection, const char *configName) { - DEBUG_FATAL(strchr(configSection, ' ') != nullptr, ("no spaces are allowed in debug flag section names: %s", configSection)); - DEBUG_FATAL(strchr(configName, ' ') != nullptr, ("no spaces are allowed in debug flag names: %s", configName)); + DEBUG_FATAL(strchr(configSection, ' ') != NULL, ("no spaces are allowed in debug flag section names: %s", configSection)); + DEBUG_FATAL(strchr(configName, ' ') != NULL, ("no spaces are allowed in debug flag names: %s", configName)); if (configSection && configName && ConfigFile::isInstalled()) { @@ -102,9 +102,9 @@ void DebugFlags::registerFlag(bool &variable, const char *section, const char *n f.section = section; f.name = name; f.reportPriority = 0; - f.reportRoutine1 = nullptr; - f.reportRoutine2 = nullptr; - f.context = nullptr; + f.reportRoutine1 = NULL; + f.reportRoutine2 = NULL; + f.context = NULL; #ifdef _DEBUG f.m_callStack.sample(); #endif @@ -127,8 +127,8 @@ void DebugFlags::registerFlag(bool &variable, const char *section, const char *n f.name = name; f.reportPriority = reportPriority; f.reportRoutine1 = reportRoutine; - f.reportRoutine2 = nullptr; - f.context = nullptr; + f.reportRoutine2 = NULL; + f.context = NULL; #ifdef _DEBUG f.m_callStack.sample(); #endif @@ -150,7 +150,7 @@ void DebugFlags::registerFlag(bool &variable, const char *section, const char *n f.section = section; f.name = name; f.reportPriority = reportPriority; - f.reportRoutine1 = nullptr; + f.reportRoutine1 = NULL; f.reportRoutine2 = reportRoutine; f.context = context; #ifdef _DEBUG @@ -230,7 +230,7 @@ DebugFlags::Flag const * DebugFlags::getFlag(char const * const section, char co return &f; } - return nullptr; + return NULL; } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedDebug/src/shared/DebugKey.cpp b/engine/shared/library/sharedDebug/src/shared/DebugKey.cpp index 3fd2a330..1fb1eefe 100755 --- a/engine/shared/library/sharedDebug/src/shared/DebugKey.cpp +++ b/engine/shared/library/sharedDebug/src/shared/DebugKey.cpp @@ -108,7 +108,7 @@ bool DebugKey::isDown(int i) bool DebugKey::isActive() { #if PRODUCTION == 0 - return ms_currentFlag != nullptr; + return ms_currentFlag != NULL; #else return false; #endif diff --git a/engine/shared/library/sharedDebug/src/shared/InstallTimer.cpp b/engine/shared/library/sharedDebug/src/shared/InstallTimer.cpp index 80e21bc9..5fe48326 100755 --- a/engine/shared/library/sharedDebug/src/shared/InstallTimer.cpp +++ b/engine/shared/library/sharedDebug/src/shared/InstallTimer.cpp @@ -64,7 +64,7 @@ void InstallTimer::manualExit() unsigned long const endingNumberOfBytesAllocated = MemoryManager::getCurrentNumberOfBytesAllocated(); --ms_indent; REPORT_LOG_PRINT(ms_enabled, ("InstallTimer:%*c%6.4f %d %s\n", ms_indent * 2, ' ', m_performanceTimer.getElapsedTime(), static_cast(endingNumberOfBytesAllocated - m_startingNumberOfBytesAllocated), m_description)); - m_description = nullptr; + m_description = NULL; } } diff --git a/engine/shared/library/sharedDebug/src/shared/PixCounter.cpp b/engine/shared/library/sharedDebug/src/shared/PixCounter.cpp index b0a63e6d..dcb14966 100755 --- a/engine/shared/library/sharedDebug/src/shared/PixCounter.cpp +++ b/engine/shared/library/sharedDebug/src/shared/PixCounter.cpp @@ -83,13 +83,13 @@ void PixCounterNamespace::remove() { #ifdef _WIN32 FreeLibrary(ms_pixDll); - ms_pixDll = nullptr; + ms_pixDll = NULL; #endif - ms_setCounterFloat = nullptr; - ms_setCounterInt = nullptr; - ms_setCounterInt64 = nullptr; - ms_setCounterString = nullptr; + ms_setCounterFloat = NULL; + ms_setCounterInt = NULL; + ms_setCounterInt64 = NULL; + ms_setCounterString = NULL; // Make sure the counter memory gets freed at this point Counters().swap(ms_counters); @@ -379,7 +379,7 @@ PixCounter::String::String() : Counter(), m_enabled(false), m_lastFrameValue(), - m_lastFrameValuePointer(nullptr), + m_lastFrameValuePointer(NULL), m_currentValue() { } diff --git a/engine/shared/library/sharedDebug/src/shared/Profiler.cpp b/engine/shared/library/sharedDebug/src/shared/Profiler.cpp index 59e92811..eb484451 100755 --- a/engine/shared/library/sharedDebug/src/shared/Profiler.cpp +++ b/engine/shared/library/sharedDebug/src/shared/Profiler.cpp @@ -238,7 +238,7 @@ void Profiler::install() ms_profilerEntriesCurrent = &ms_profilerEntries1; ms_profilerEntriesLast = &ms_profilerEntries2; - ms_rootVisibleExpandableEntry = new VisibleExpandableEntry(nullptr); + ms_rootVisibleExpandableEntry = new VisibleExpandableEntry(NULL); ms_rootVisibleExpandableEntry->setExpanded(true); ms_selectedVisibleExpandableEntry = ms_rootVisibleExpandableEntry; } @@ -248,13 +248,13 @@ void Profiler::install() void Profiler::remove() { delete ms_rootVisibleExpandableEntry; - ms_rootVisibleExpandableEntry = nullptr; - ms_beforeSelectedVisibleExpandableEntry = nullptr; - ms_selectedVisibleExpandableEntry = nullptr; - ms_afterSelectedVisibleExpandableEntry = nullptr; - ms_previousVisibleExpandableEntry = nullptr; - ms_profilerEntriesCurrent = nullptr; - ms_profilerEntriesLast = nullptr; + ms_rootVisibleExpandableEntry = NULL; + ms_beforeSelectedVisibleExpandableEntry = NULL; + ms_selectedVisibleExpandableEntry = NULL; + ms_afterSelectedVisibleExpandableEntry = NULL; + ms_previousVisibleExpandableEntry = NULL; + ms_profilerEntriesCurrent = NULL; + ms_profilerEntriesLast = NULL; } // ---------------------------------------------------------------------- @@ -374,11 +374,11 @@ bool ProfilerNamespace::formatEntry(int indent, ProfilerTimer::Type totalTime, i void ProfilerNamespace::processEntry(char const *rootName, int indent, ProfilerEntry const & entry, VisibleExpandableEntry * visibleExpandableEntry) { if (rootName == entry.name) - rootName = nullptr; + rootName = NULL; if (!rootName) { - if (!formatEntry(indent, entry.totalTime, entry.totalCalls, visibleExpandableEntry != nullptr, visibleExpandableEntry && visibleExpandableEntry->isExpanded(), visibleExpandableEntry == ms_selectedVisibleExpandableEntry, entry.name)) + if (!formatEntry(indent, entry.totalTime, entry.totalCalls, visibleExpandableEntry != NULL, visibleExpandableEntry && visibleExpandableEntry->isExpanded(), visibleExpandableEntry == ms_selectedVisibleExpandableEntry, entry.name)) return; } @@ -410,7 +410,7 @@ void ProfilerNamespace::processEntry(char const *rootName, int indent, ProfilerE if (child.children.empty()) { - processEntry(rootName, indent, child, nullptr); + processEntry(rootName, indent, child, NULL); } else { @@ -483,9 +483,9 @@ void ProfilerNamespace::generateReport() ms_rootVisibleExpandableEntry->markAllChildrenInvisible(); ms_rootVisibleExpandableEntry->findOrAddExpandableChild(rootEntry.name); - ms_previousVisibleExpandableEntry = nullptr; - ms_beforeSelectedVisibleExpandableEntry = nullptr; - ms_afterSelectedVisibleExpandableEntry = nullptr; + ms_previousVisibleExpandableEntry = NULL; + ms_beforeSelectedVisibleExpandableEntry = NULL; + ms_afterSelectedVisibleExpandableEntry = NULL; processEntry(ms_rootProfilerName, 0, rootEntry, ms_rootVisibleExpandableEntry); if (ms_rootVisibleExpandableEntry->pruneInvisibleChildren()) @@ -494,7 +494,7 @@ void ProfilerNamespace::generateReport() if (ms_setRoot) { if (ms_rootProfilerName) - ms_rootProfilerName = nullptr; + ms_rootProfilerName = NULL; else ms_rootProfilerName = ms_selectedVisibleExpandableEntry->getName(); ms_setRoot = false; @@ -720,7 +720,7 @@ void ProfilerNamespace::enterWithTime(char const *name, ProfilerTimer::Type time // search for another call to this block from the parent int entryIndex = -1; - ProfilerEntry *entry = nullptr; + ProfilerEntry *entry = NULL; if (!ms_profilerEntryStack.empty()) { ProfilerEntry &parent = (*ms_profilerEntriesCurrent)[ms_profilerEntryStack.back()]; diff --git a/engine/shared/library/sharedDebug/src/shared/RemoteDebug.cpp b/engine/shared/library/sharedDebug/src/shared/RemoteDebug.cpp index e6b40c19..c9e832b9 100755 --- a/engine/shared/library/sharedDebug/src/shared/RemoteDebug.cpp +++ b/engine/shared/library/sharedDebug/src/shared/RemoteDebug.cpp @@ -92,10 +92,10 @@ void RemoteDebug::remove(void) return; } - ms_removeFunction = nullptr; - ms_openFunction = nullptr; - ms_closeFunction = nullptr; - ms_sendFunction = nullptr; + ms_removeFunction = NULL; + ms_openFunction = NULL; + ms_closeFunction = NULL; + ms_sendFunction = NULL; //empty out session-level data for (StreamMap::iterator it = ms_streams->begin(); it != ms_streams->end(); ++it) @@ -147,7 +147,7 @@ uint32 RemoteDebug::registerStream(const std::string& streamName) DEBUG_FATAL(!ms_installed, ("remoteDebug not installed")); uint32 streamNum = 0; - Channel *parent = nullptr; + Channel *parent = NULL; std::string base; std::string rest = streamName; //look for subchannels with a double backslash @@ -203,7 +203,7 @@ uint32 RemoteDebug::registerStaticView(const std::string& channelName) { DEBUG_FATAL(!ms_installed, ("remoteDebug not installed")); uint32 staticViewNum = 0; - Channel *parent = nullptr; + Channel *parent = NULL; std::string base; std::string rest = channelName; //look for subchannels with a double backslash @@ -356,7 +356,7 @@ uint32 RemoteDebug::registerVariable(const char* variableName, void *memLoc, VAR std::string variable = variableName; uint32 variableNum = 0; - Channel *parent = nullptr; + Channel *parent = NULL; std::string base; std::string rest = variable; //look for subchannels with a double backslash @@ -375,7 +375,7 @@ uint32 RemoteDebug::registerVariable(const char* variableName, void *memLoc, VAR //only add the variable if we don't have it yet if (variableNumber == -1) { - registerVariable(newBase.c_str(), nullptr, BOOL, sendToClients); + registerVariable(newBase.c_str(), NULL, BOOL, sendToClients); } //look for any other subChannel uint32 oldRestIndex = restIndex; diff --git a/engine/shared/library/sharedDebug/src/shared/RemoteDebug.h b/engine/shared/library/sharedDebug/src/shared/RemoteDebug.h index f2b7070c..8f24d6af 100755 --- a/engine/shared/library/sharedDebug/src/shared/RemoteDebug.h +++ b/engine/shared/library/sharedDebug/src/shared/RemoteDebug.h @@ -62,7 +62,7 @@ public: { INT, //32 bit signed int FLOAT, //32 bit signed float - CSTRING, //nullptr terminated char[] + CSTRING, //null terminated char[] BOOL //0 or 1 (could use an int, but useful for tools) }; @@ -92,7 +92,7 @@ public: static void install(RemoveFunction, OpenFunction, CloseFunction, SendFunction, IsReadyFunction); ///open a session - static void open(const char *server = nullptr, uint16 port = 0); + static void open(const char *server = NULL, uint16 port = 0); ///packs the data into a packet, and sends it using the client-defined SendFunction static void send(MESSAGE_TYPE type, const char* name = ""); diff --git a/engine/shared/library/sharedDebug/src/shared/RemoteDebug_inner.cpp b/engine/shared/library/sharedDebug/src/shared/RemoteDebug_inner.cpp index e945d875..da1f9878 100755 --- a/engine/shared/library/sharedDebug/src/shared/RemoteDebug_inner.cpp +++ b/engine/shared/library/sharedDebug/src/shared/RemoteDebug_inner.cpp @@ -30,7 +30,7 @@ uint32 RemoteDebugServer::ms_inputTarget; // ====================================================================== RemoteDebug::Channel::Channel(const std::string& name, Channel *parent) -: m_name(nullptr), +: m_name(NULL), m_parent(parent) { m_name = new std::string(name); @@ -41,16 +41,16 @@ RemoteDebug::Channel::Channel(const std::string& name, Channel *parent) RemoteDebug::Channel::~Channel() { - m_parent = nullptr; + m_parent = NULL; if(m_name) { delete m_name; - m_name = nullptr; + m_name = NULL; } if (m_children) { delete m_children; - m_children = nullptr; + m_children = NULL; } } @@ -72,7 +72,7 @@ const std::string& RemoteDebug::Channel::name() RemoteDebug::Variable::Variable(const std::string& name, void *memLoc, VARIABLE_TYPES type) : m_memLoc(memLoc), - m_name(nullptr), + m_name(NULL), m_type(type) { m_name = new std::string(name); @@ -111,7 +111,7 @@ RemoteDebug::Variable::~Variable() if(m_name) { delete m_name; - m_name = nullptr; + m_name = NULL; } } @@ -307,7 +307,7 @@ void RemoteDebugClient::receive(const unsigned char * const message, const uint3 if (channelNumber < ms_nextVariable) return; //do not send value back to server (hence the "false") - registerVariable(ms_buffer, nullptr, BOOL, false); + registerVariable(ms_buffer, NULL, BOOL, false); if (ms_newVariableFunction) ms_newVariableFunction(channelNumber, const_cast(ms_buffer)); break; @@ -477,7 +477,7 @@ void RemoteDebugServer::receive(const unsigned char * const message, const uint3 memcpy(ms_buffer, charMessage + sizeOfMessageType + sizeOfChannelNumber + sizeOfSizeofPayload, sizeOfPayload); } - Variable* v = nullptr; + Variable* v = NULL; switch(type) { case STREAM: @@ -524,27 +524,27 @@ void RemoteDebugServer::receive(const unsigned char * const message, const uint3 break; case STATIC_UP: - if ((*ms_upFunctionMap)[ms_inputTarget] != nullptr) + if ((*ms_upFunctionMap)[ms_inputTarget] != NULL) (*ms_upFunctionMap)[ms_inputTarget](); //lint !e10, !e522 ("expecting a function" and "expected void assignment) break; case STATIC_DOWN: - if ((*ms_downFunctionMap)[ms_inputTarget] != nullptr) + if ((*ms_downFunctionMap)[ms_inputTarget] != NULL) (*ms_downFunctionMap)[ms_inputTarget](); //lint !e10, !e522 ("expecting a function" and "expected void assignment) break; case STATIC_LEFT: - if ((*ms_leftFunctionMap)[ms_inputTarget] != nullptr) + if ((*ms_leftFunctionMap)[ms_inputTarget] != NULL) (*ms_leftFunctionMap)[ms_inputTarget](); //lint !e10, !e522 ("expecting a function" and "expected void assignment) break; case STATIC_RIGHT: - if ((*ms_rightFunctionMap)[ms_inputTarget] != nullptr) + if ((*ms_rightFunctionMap)[ms_inputTarget] != NULL) (*ms_rightFunctionMap)[ms_inputTarget](); //lint !e10, !e522 ("expecting a function" and "expected void assignment) break; case STATIC_ENTER: - if ((*ms_enterFunctionMap)[ms_inputTarget] != nullptr) + if ((*ms_enterFunctionMap)[ms_inputTarget] != NULL) (*ms_enterFunctionMap)[ms_inputTarget](); //lint !e10, !e522 ("expecting a function" and "expected void assignment) break; diff --git a/engine/shared/library/sharedDebug/src/shared/RemoteDebug_inner.h b/engine/shared/library/sharedDebug/src/shared/RemoteDebug_inner.h index 8daccef3..d3dd088a 100755 --- a/engine/shared/library/sharedDebug/src/shared/RemoteDebug_inner.h +++ b/engine/shared/library/sharedDebug/src/shared/RemoteDebug_inner.h @@ -29,13 +29,13 @@ class RemoteDebug::Channel NodeList* m_children; ///the fully qualified name of the channel std::string* m_name; - ///its parent (which is nullptr for top-level nodes + ///its parent (which is NULL for top-level nodes Channel *m_parent; }; /** This class stores data about a variable channel, both on the server (where the variable actually * resides), and the client (which just displays it). The client simply creates Variable's with - * nullptr'd out memLoc's, since it doesn't have direct access to the memory. + * NULL'd out memLoc's, since it doesn't have direct access to the memory. */ class RemoteDebug::Variable { diff --git a/engine/shared/library/sharedDebug/src/shared/Report.cpp b/engine/shared/library/sharedDebug/src/shared/Report.cpp index 5f7f8082..69de29bd 100755 --- a/engine/shared/library/sharedDebug/src/shared/Report.cpp +++ b/engine/shared/library/sharedDebug/src/shared/Report.cpp @@ -175,7 +175,7 @@ void Report::puts(const char *buffer) // if (flags & RF_fatal) // title = "Fatal Report"; - // MessageBox(nullptr, buffer, title, MB_OK | MB_ICONEXCLAMATION); + // MessageBox(NULL, buffer, title, MB_OK | MB_ICONEXCLAMATION); //} } @@ -198,7 +198,7 @@ void Report::vprintf(const char *format, va_list va) { char buffer[8 * 1024]; - // make sure the buffer is always nullptr terminated + // make sure the buffer is always NULL terminated buffer[sizeof(buffer)-1] = '\0'; // format the string diff --git a/engine/shared/library/sharedFile/src/shared/AsynchronousLoader.cpp b/engine/shared/library/sharedFile/src/shared/AsynchronousLoader.cpp index b810a0b8..be918f39 100755 --- a/engine/shared/library/sharedFile/src/shared/AsynchronousLoader.cpp +++ b/engine/shared/library/sharedFile/src/shared/AsynchronousLoader.cpp @@ -169,9 +169,9 @@ void AsynchronousLoader::install(const char *fileName) const int numberOfExtensions = iff.getChunkLengthTotal(sizeof(int32)); ms_extensionFunctionsList.reserve(numberOfExtensions); ExtensionFunctions extensionFunctions; - extensionFunctions.extension = nullptr; - extensionFunctions.fetchFunction = nullptr; - extensionFunctions.releaseFunction = nullptr; + extensionFunctions.extension = NULL; + extensionFunctions.fetchFunction = NULL; + extensionFunctions.releaseFunction = NULL; for (int i = 0; i < numberOfExtensions; ++i) { extensionFunctions.extension = ms_fileData + iff.read_int32(); @@ -235,10 +235,10 @@ void AsynchronousLoaderNamespace::remove() { DEBUG_FATAL(!ms_installed, ("not installed")); Request *request = reinterpret_cast(ms_requestMemoryBlockManager->allocate()); - request->fileRecordList = nullptr; - request->callback = nullptr; - request->data = nullptr; - request->cachedFiles = nullptr; + request->fileRecordList = NULL; + request->callback = NULL; + request->data = NULL; + request->cachedFiles = NULL; submitRequest(request); @@ -270,7 +270,7 @@ void AsynchronousLoaderNamespace::remove() ms_cachedFilesPool.clear(); delete ms_requestMemoryBlockManager; - ms_requestMemoryBlockManager = nullptr; + ms_requestMemoryBlockManager = NULL; } // ---------------------------------------------------------------------- @@ -369,7 +369,7 @@ void AsynchronousLoader::add(const char *fileName, Callback callback, void *data request->fileRecordList = i->second; request->callback = callback; request->data = data; - request->cachedFiles = nullptr; + request->cachedFiles = NULL; submitRequest(request); } else @@ -390,8 +390,8 @@ void AsynchronousLoader::remove(Callback callback, void *data) for (Requests::iterator i = ms_pendingRequests.begin(); i != iEnd; ++i) if ((*i)->callback == callback && (*i)->data == data) { - (*i)->callback = nullptr; - (*i)->data = nullptr; + (*i)->callback = NULL; + (*i)->data = NULL; } } @@ -400,8 +400,8 @@ void AsynchronousLoader::remove(Callback callback, void *data) for (Requests::iterator i = ms_completedRequests.begin(); i != iEnd; ++i) if ((*i)->callback == callback && (*i)->data == data) { - (*i)->callback = nullptr; - (*i)->data = nullptr; + (*i)->callback = NULL; + (*i)->data = NULL; } } @@ -466,8 +466,8 @@ void AsynchronousLoaderNamespace::threadRoutine() CachedFile cachedFile; cachedFile.fileRecord = fileRecord; - cachedFile.file = nullptr; - cachedFile.resource = nullptr; + cachedFile.file = NULL; + cachedFile.resource = NULL; // check if the resource is already loaded if (!fileRecord->alreadyCached) @@ -622,7 +622,7 @@ void AsynchronousLoader::processCallbacks() else bytes += cachedFile.file->length(); TreeFile::addCachedFile(cachedFile.fileRecord->fileName, cachedFile.file); - cachedFile.file = nullptr; + cachedFile.file = NULL; } } } @@ -653,13 +653,13 @@ void AsynchronousLoader::processCallbacks() else bytes += cachedFile.file->length(); delete cachedFile.file; - cachedFile.file = nullptr; + cachedFile.file = NULL; } if (cachedFile.resource) { ms_extensionFunctionsList[cachedFile.fileRecord->extensionFunctionsIndex].releaseFunction(cachedFile.resource); - cachedFile.resource = nullptr; + cachedFile.resource = NULL; } } request->cachedFiles->clear(); @@ -667,7 +667,7 @@ void AsynchronousLoader::processCallbacks() ms_mutex.enter(); ms_cachedFilesPool.push_back(request->cachedFiles); - request->cachedFiles = nullptr; + request->cachedFiles = NULL; ms_mutex.leave(); } diff --git a/engine/shared/library/sharedFile/src/shared/FileManifest.cpp b/engine/shared/library/sharedFile/src/shared/FileManifest.cpp index c5552775..ecf1becf 100755 --- a/engine/shared/library/sharedFile/src/shared/FileManifest.cpp +++ b/engine/shared/library/sharedFile/src/shared/FileManifest.cpp @@ -73,8 +73,8 @@ void FileManifest::install() s_accessThreshold = ConfigFile::getKeyInt("SharedFile", "fileManifestAccessThreshold", -1, s_accessThreshold); // if we are developing, and want to update the manifest, read in the tab file as well - const char * manifestFile = ConfigFile::getKeyString("SharedFile", "updateFileManifest", 0, nullptr); - if (manifestFile != nullptr) + const char * manifestFile = ConfigFile::getKeyString("SharedFile", "updateFileManifest", 0, NULL); + if (manifestFile != NULL) { s_updateManifest = true; @@ -183,8 +183,8 @@ void FileManifest::remove() #if PRODUCTION == 0 // dump out the new manifest if requested - const char * manifestFile = ConfigFile::getKeyString("SharedFile", "updateFileManifest", 0, nullptr); - if (manifestFile != nullptr) + const char * manifestFile = ConfigFile::getKeyString("SharedFile", "updateFileManifest", 0, NULL); + if (manifestFile != NULL) { StdioFile outputFile(manifestFile,"w"); DEBUG_FATAL(!outputFile.isOpen(), ("FileManifest::remove(): Could not open %s for writing.", manifestFile)); @@ -201,7 +201,7 @@ void FileManifest::remove() { if (!i->second) { - DEBUG_WARNING(true, ("FileManifest::remove(): Found a nullptr pointer in the fileManifest map!\n")); + DEBUG_WARNING(true, ("FileManifest::remove(): Found a null pointer in the fileManifest map!\n")); continue; } diff --git a/engine/shared/library/sharedFile/src/shared/FileNameUtils.cpp b/engine/shared/library/sharedFile/src/shared/FileNameUtils.cpp index 58912176..01ac3c98 100755 --- a/engine/shared/library/sharedFile/src/shared/FileNameUtils.cpp +++ b/engine/shared/library/sharedFile/src/shared/FileNameUtils.cpp @@ -59,9 +59,9 @@ bool FileNameUtils::isReadable(std::string const &path) { FILE *fp = fopen(path.c_str(), "r"); - result = (fp != nullptr); + result = (fp != NULL); - if (fp != nullptr) + if (fp != NULL) { fclose(fp); } @@ -79,9 +79,9 @@ bool FileNameUtils::isWritable(std::string const &path) { FILE *fp = fopen(path.c_str(), "w"); - result = (fp != nullptr); + result = (fp != NULL); - if (fp != nullptr) + if (fp != NULL) { fclose(fp); } diff --git a/engine/shared/library/sharedFile/src/shared/FileStreamer.cpp b/engine/shared/library/sharedFile/src/shared/FileStreamer.cpp index ff5eec8d..6c47b26c 100755 --- a/engine/shared/library/sharedFile/src/shared/FileStreamer.cpp +++ b/engine/shared/library/sharedFile/src/shared/FileStreamer.cpp @@ -109,11 +109,11 @@ int FileStreamer::getFileSize(const char *fileName) FileStreamer::File *FileStreamer::open(const char *fileName, bool randomAccess) { DEBUG_FATAL(!ms_installed, ("not installed")); - DEBUG_FATAL(!fileName, ("file name nullptr")); + DEBUG_FATAL(!fileName, ("file name null")); OsFile *osFile = OsFile::open(fileName, randomAccess); if (!osFile) - return nullptr; + return NULL; #if PRODUCTION // Stop checking the fileName if one of these returns true @@ -150,7 +150,7 @@ void FileStreamer::File::install(bool useThread) void FileStreamer::File::remove() { delete ms_memoryBlockManager; - ms_memoryBlockManager = nullptr; + ms_memoryBlockManager = NULL; } // ---------------------------------------------------------------------- @@ -192,7 +192,7 @@ FileStreamer::File::~File() bool FileStreamer::File::isOpen() const { - return m_osFile != nullptr; + return m_osFile != NULL; } // ---------------------------------------------------------------------- @@ -249,7 +249,7 @@ void FileStreamer::File::close() if (isOpen()) { delete m_osFile; - m_osFile = nullptr; + m_osFile = NULL; } } diff --git a/engine/shared/library/sharedFile/src/shared/FileStreamerFile.cpp b/engine/shared/library/sharedFile/src/shared/FileStreamerFile.cpp index e579ab9e..d6a798d5 100755 --- a/engine/shared/library/sharedFile/src/shared/FileStreamerFile.cpp +++ b/engine/shared/library/sharedFile/src/shared/FileStreamerFile.cpp @@ -93,7 +93,7 @@ FileStreamerFile::~FileStreamerFile() bool FileStreamerFile::isOpen() const { - return m_file != nullptr; + return m_file != NULL; } // ---------------------------------------------------------------------- @@ -174,7 +174,7 @@ void FileStreamerFile::close() { if (m_owner) delete m_file; - m_file = nullptr; + m_file = NULL; } // ====================================================================== diff --git a/engine/shared/library/sharedFile/src/shared/FileStreamerThread.cpp b/engine/shared/library/sharedFile/src/shared/FileStreamerThread.cpp index a0789e5b..1d3c0b8c 100755 --- a/engine/shared/library/sharedFile/src/shared/FileStreamerThread.cpp +++ b/engine/shared/library/sharedFile/src/shared/FileStreamerThread.cpp @@ -294,34 +294,34 @@ void FileStreamerThread::threadRoutine() //get the request to service ms_queueCriticalSection.enter(); - request = nullptr; + request = NULL; //if there is an AudioVideo request, service it first (interrupting any current data request) if (ms_firstAudioVideoRequest) { request = ms_firstAudioVideoRequest; ms_firstAudioVideoRequest = ms_firstAudioVideoRequest->next; - if (ms_firstAudioVideoRequest == nullptr) - ms_lastAudioVideoRequest = nullptr; - request->next = nullptr; + if (ms_firstAudioVideoRequest == NULL) + ms_lastAudioVideoRequest = NULL; + request->next = NULL; } else if (ms_firstDataRequest) { request = ms_firstDataRequest; ms_firstDataRequest = ms_firstDataRequest->next; - if (ms_firstDataRequest == nullptr) - ms_lastDataRequest = nullptr; - request->next = nullptr; + if (ms_firstDataRequest == NULL) + ms_lastDataRequest = NULL; + request->next = NULL; } else if (ms_firstLowRequest) { request = ms_firstLowRequest; ms_firstLowRequest = ms_firstLowRequest->next; - if (ms_firstLowRequest == nullptr) - ms_lastLowRequest = nullptr; - request->next = nullptr; + if (ms_firstLowRequest == NULL) + ms_lastLowRequest = NULL; + request->next = NULL; } else { @@ -369,7 +369,7 @@ void FileStreamerThread::Request::install() void FileStreamerThread::Request::remove() { delete ms_memoryBlockManager; - ms_memoryBlockManager = nullptr; + ms_memoryBlockManager = NULL; } // ---------------------------------------------------------------------- @@ -395,15 +395,15 @@ void FileStreamerThread::Request::operator delete(void *pointer) // ---------------------------------------------------------------------- FileStreamerThread::Request::Request() -: next(nullptr), +: next(NULL), type(Request::Unknown), - osFile(nullptr), + osFile(NULL), buffer(0), bytesToBeRead(0), bytesRead(0), - gate(nullptr), + gate(NULL), priority(AbstractFile::PriorityData), - returnValue(nullptr) + returnValue(NULL) { } @@ -412,10 +412,10 @@ FileStreamerThread::Request::Request() FileStreamerThread::Request::~Request() { #ifdef _DEBUG - next = nullptr; - buffer = nullptr; - gate = nullptr; - returnValue = nullptr; + next = NULL; + buffer = NULL; + gate = NULL; + returnValue = NULL; #endif } diff --git a/engine/shared/library/sharedFile/src/shared/Iff.cpp b/engine/shared/library/sharedFile/src/shared/Iff.cpp index 48eaeed1..212ef576 100755 --- a/engine/shared/library/sharedFile/src/shared/Iff.cpp +++ b/engine/shared/library/sharedFile/src/shared/Iff.cpp @@ -146,11 +146,11 @@ bool Iff::isValid(char const * fileName) int const fileLength = file->length(); byte *data = file->readEntireFileAndClose(); delete file; - file = nullptr; + file = NULL; bool const result = IffNamespace::isValid(data, fileLength); delete [] data; - data = nullptr; + data = NULL; return result; } @@ -167,12 +167,12 @@ bool Iff::isValid(char const * fileName) // Iff::open() Iff::Iff(void) -: fileName(nullptr), +: fileName(NULL), maxStackDepth(DEFAULT_STACK_DEPTH), stackDepth(0), stack(new Stack[DEFAULT_STACK_DEPTH]), length(0), - data(nullptr), + data(NULL), inChunk(false), growable(false), nonlinear(false), @@ -207,7 +207,7 @@ Iff::Iff(void) */ Iff::Iff(int newDataSize, const byte *newData, bool iffOwnsData) : - fileName(nullptr), + fileName(NULL), maxStackDepth(DEFAULT_STACK_DEPTH), stackDepth(0), stack(new Stack[DEFAULT_STACK_DEPTH]), @@ -242,12 +242,12 @@ Iff::Iff(int newDataSize, const byte *newData, bool iffOwnsData) : */ Iff::Iff(const char *newFileName, bool optional) -: fileName(nullptr), +: fileName(NULL), maxStackDepth(DEFAULT_STACK_DEPTH), stackDepth(0), stack(new Stack[DEFAULT_STACK_DEPTH]), length(0), - data(nullptr), + data(NULL), inChunk(false), growable(false), nonlinear(false), @@ -270,7 +270,7 @@ Iff::Iff(const char *newFileName, bool optional) */ Iff::Iff(int initialSize, bool isGrowable, bool clearDataBuffer) -: fileName(nullptr), +: fileName(NULL), maxStackDepth(DEFAULT_STACK_DEPTH), stackDepth(0), stack(new Stack[DEFAULT_STACK_DEPTH]), @@ -384,7 +384,7 @@ void Iff::open(AbstractFile & file, char const * const newFileName) DEBUG_FATAL(data, ("causing memory leak")); data = file.readEntireFileAndClose(); - FATAL(ConfigSharedFile::getValidateIff() && !IffNamespace::isValid(data, length), ("File corruption detected! Iff::isValid failed for %s (size=%d, crc=%08X). Please try a \"Full Scan\" from the LaunchPad.", newFileName ? newFileName : "nullptr", length, Crc::calculate(data, length))); + FATAL(ConfigSharedFile::getValidateIff() && !IffNamespace::isValid(data, length), ("File corruption detected! Iff::isValid failed for %s (size=%d, crc=%08X). Please try a \"Full Scan\" from the LaunchPad.", newFileName ? newFileName : "null", length, Crc::calculate(data, length))); // setup the stack data to know about the data stack[0].start = 0; @@ -406,11 +406,11 @@ void Iff::open(AbstractFile & file, char const * const newFileName) void Iff::close(void) { delete [] fileName; - fileName = nullptr; + fileName = NULL; if (ownsData) delete [] data; - data = nullptr; //lint !e672 // possible memory leak in assignment to Iff::data // no, we only delete when we own it + data = NULL; //lint !e672 // possible memory leak in assignment to Iff::data // no, we only delete when we own it stackDepth = 0; } @@ -886,7 +886,7 @@ void Iff::insertChunkFloatQuaternion(const Quaternion &quaternion) * Insert a string into the current chunk at the current location. * * This routine will call insertChunkData(const void *, int length) - * with the string using its string length (plus one for the nullptr + * with the string using its string length (plus one for the null * terminator). */ @@ -1555,10 +1555,10 @@ void Iff::read_string(char *string, int maxLength) *string = *source; } - // step over the nullptr terminator on the input + // step over the null terminator on the input ++s.used; - // nullptr terminate the output string + // null terminate the output string DEBUG_FATAL(maxLength <= 0, ("destination string too short")); *string = '\0'; } @@ -1594,7 +1594,7 @@ char *Iff::read_string(void) for ( ; sourceLength < maxLength && source[sourceLength]; ++sourceLength) ; - // verify that we found the nullptr terminator + // verify that we found the null terminator DEBUG_FATAL(sourceLength >= maxLength, ("hit end of chunk before string terminator")); // create and copy the string @@ -1634,10 +1634,10 @@ void Iff::read_string(std::string &string) for ( ; sourceLength < maxLength && source[sourceLength]; ++sourceLength) ; - // verify that we found the nullptr terminator + // verify that we found the null terminator DEBUG_FATAL(sourceLength >= maxLength, ("hit end of chunk before string terminator")); - // account for the nullptr terminator + // account for the null terminator ++sourceLength; s.used += sourceLength; diff --git a/engine/shared/library/sharedFile/src/shared/Iff.h b/engine/shared/library/sharedFile/src/shared/Iff.h index 1fe0660a..71e07c44 100755 --- a/engine/shared/library/sharedFile/src/shared/Iff.h +++ b/engine/shared/library/sharedFile/src/shared/Iff.h @@ -250,7 +250,7 @@ public: Unicode::String read_unicodeString(); #if 0 - real *read_float (int count, real *array=nullptr); + real *read_float (int count, real *array=NULL); #endif }; @@ -294,7 +294,7 @@ inline int Iff::getRawDataSize(void) const * to store raw iff data via a mechanism other than Iff::write(). * * @return A read-only pointer to the data buffer containing the raw Iff data - * managed by this Iff object. It may be nullptr if no data is currently + * managed by this Iff object. It may be NULL if no data is currently * managed by the Iff. * @see Iff::getRawDataSize(), Iff::write() */ diff --git a/engine/shared/library/sharedFile/src/shared/IndentedFileWriter.cpp b/engine/shared/library/sharedFile/src/shared/IndentedFileWriter.cpp index 013c7204..2c5eb7f2 100755 --- a/engine/shared/library/sharedFile/src/shared/IndentedFileWriter.cpp +++ b/engine/shared/library/sharedFile/src/shared/IndentedFileWriter.cpp @@ -23,7 +23,7 @@ IndentedFileWriter *IndentedFileWriter::createWriter(char const *filename) { // Kill the new writer since we weren't able to open the file for writing. delete newWriter; - return nullptr; + return NULL; } } @@ -36,7 +36,7 @@ IndentedFileWriter::~IndentedFileWriter() if (m_file) { fclose(m_file); - m_file = nullptr; + m_file = NULL; } } @@ -63,8 +63,8 @@ void IndentedFileWriter::unindent() void IndentedFileWriter::writeLine(char const *line) const { - FATAL(!m_file, ("writeLine(): m_file is nullptr, programmer error.")); - FATAL(!line, ("writeLine(): line argument is nullptr.")); + FATAL(!m_file, ("writeLine(): m_file is NULL, programmer error.")); + FATAL(!line, ("writeLine(): line argument is NULL.")); //-- Write one tab for each indentation level. for (int i = 0; i < m_indentCount; ++i) @@ -92,7 +92,7 @@ void IndentedFileWriter::writeLineFormat(char const *format, ...) const int const formatCount = vsnprintf(buffer, sizeof(buffer), format, varArgList); UNREF(formatCount); - //-- Ensure it's nullptr terminated. + //-- Ensure it's null terminated. buffer[sizeof(buffer) - 1] = '\0'; //-- Do the real print. @@ -108,7 +108,7 @@ void IndentedFileWriter::writeLineFormat(char const *format, ...) const IndentedFileWriter::IndentedFileWriter() : m_indentCount(0), - m_file(nullptr) + m_file(NULL) { } @@ -123,7 +123,7 @@ bool IndentedFileWriter::createFile(char const *filename) } m_file = fopen(filename, "w"); - return (m_file != nullptr); + return (m_file != NULL); } // ====================================================================== diff --git a/engine/shared/library/sharedFile/src/shared/MemoryFile.cpp b/engine/shared/library/sharedFile/src/shared/MemoryFile.cpp index d09b3c99..4c023f8c 100755 --- a/engine/shared/library/sharedFile/src/shared/MemoryFile.cpp +++ b/engine/shared/library/sharedFile/src/shared/MemoryFile.cpp @@ -70,7 +70,7 @@ MemoryFile::MemoryFile(byte *buffer, int length) MemoryFile::MemoryFile(AbstractFile *file) : AbstractFile(PriorityData), - m_buffer(nullptr), + m_buffer(NULL), m_length(file->length()), m_offset(0) { @@ -88,7 +88,7 @@ MemoryFile::~MemoryFile() bool MemoryFile::isOpen() const { - return m_buffer != nullptr; + return m_buffer != NULL; } // ---------------------------------------------------------------------- @@ -162,7 +162,7 @@ int MemoryFile::write(int, const void *) void MemoryFile::close() { delete [] m_buffer; - m_buffer = nullptr; + m_buffer = NULL; } // ---------------------------------------------------------------------- @@ -170,7 +170,7 @@ void MemoryFile::close() byte *MemoryFile::readEntireFileAndClose() { byte *result = m_buffer; - m_buffer = nullptr; + m_buffer = NULL; return result; } diff --git a/engine/shared/library/sharedFile/src/shared/TreeFile.cpp b/engine/shared/library/sharedFile/src/shared/TreeFile.cpp index 6c53bff5..09acf384 100755 --- a/engine/shared/library/sharedFile/src/shared/TreeFile.cpp +++ b/engine/shared/library/sharedFile/src/shared/TreeFile.cpp @@ -123,7 +123,7 @@ void TreeFile::install(uint32 skuBits) sprintf(buffer, "searchPath%s%d", skuText, priority); char const * result; - for (int index = 0; (result = ConfigFile::getKeyString("SharedFile", buffer, index, nullptr)) != nullptr; ++index) + for (int index = 0; (result = ConfigFile::getKeyString("SharedFile", buffer, index, NULL)) != NULL; ++index) TreeFile::addSearchPath(result, priority); } @@ -133,7 +133,7 @@ void TreeFile::install(uint32 skuBits) sprintf(buffer, "searchTree%s%d", skuText, priority); char const * result; - for (int index = 0; (result = ConfigFile::getKeyString("SharedFile", buffer, index, nullptr)) != nullptr; ++index) + for (int index = 0; (result = ConfigFile::getKeyString("SharedFile", buffer, index, NULL)) != NULL; ++index) TreeFile::addSearchTree(result, priority); } @@ -143,7 +143,7 @@ void TreeFile::install(uint32 skuBits) sprintf(buffer, "searchTOC%s%d", skuText, priority); char const * result; - for (int index = 0; (result = ConfigFile::getKeyString("SharedFile", buffer, index, nullptr)) != nullptr; ++index) + for (int index = 0; (result = ConfigFile::getKeyString("SharedFile", buffer, index, NULL)) != NULL; ++index) TreeFile::addSearchTOC(result, priority); } } @@ -430,7 +430,7 @@ void TreeFile::removeAllSearches(void) * Find the node (if any) the requested file is in. * * @return Pointer to the highest priority node containing the file. If the - * file is not found, nullptr is returned. If checking for filename collisions is + * file is not found, NULL is returned. If checking for filename collisions is * set on, then this function DEBUG_FATALS if multiple files match */ @@ -440,14 +440,14 @@ TreeFile::SearchNode *TreeFile::find(const char *fileName) if (!fileName) { - DEBUG_WARNING(true, ("TreeFile::find() Cannot find a nullptr filename")); - return nullptr; + DEBUG_WARNING(true, ("TreeFile::find() Cannot find a null filename")); + return NULL; } if (fileName[0] == '\0') { DEBUG_WARNING(true, ("TreeFile::find() Cannot find an empty filename")); - return nullptr; + return NULL; } // search the list of nodes looking to see if the specified file exists @@ -457,7 +457,7 @@ TreeFile::SearchNode *TreeFile::find(const char *fileName) if ((*i)->exists(fileName, deleted)) return *i; - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -479,7 +479,7 @@ bool TreeFile::exists(const char *fileName) FileManifest::addNewManifestEntry(fixedFileName, 0); #endif - return (find(fixedFileName) != nullptr); + return (find(fixedFileName) != NULL); } // ---------------------------------------------------------------------- @@ -621,7 +621,7 @@ void TreeFile::fixUpFileName(const char *fileName, char *outName) * Find the node (if any) the requested file is in. * * @return Pointer to the highest priority node containing the file. If the - * file is not found, nullptr is returned. + * file is not found, NULL is returned. */ bool TreeFile::getPathName(const char *fileName, char *pathName, int pathNameLength) @@ -655,12 +655,12 @@ bool TreeFile::getPathName(const char *fileName, char *pathName, int pathNameLen * * @param fileName File name to open * @param allowFail True to return false on failure, otherwise Fatal - * @return pointer to a newly allocated AbstractFile-derived class (caller must delete), nullptr if failure. + * @return pointer to a newly allocated AbstractFile-derived class (caller must delete), NULL if failure. */ AbstractFile* TreeFile::open(const char *fileName, AbstractFile::PriorityType priority, bool allowFail) { - AbstractFile *file = nullptr; + AbstractFile *file = NULL; char fixedFileName[Os::MAX_PATH_LENGTH]; fixUpFileName(fixedFileName, fileName, true); @@ -678,7 +678,7 @@ AbstractFile* TreeFile::open(const char *fileName, AbstractFile::PriorityType pr if (cachedIterator != cachedFilesMap.end()) { file = cachedIterator->second; - cachedIterator->second = nullptr; + cachedIterator->second = NULL; } ms_criticalSection.leave(); @@ -747,7 +747,7 @@ AbstractFile* TreeFile::open(const char *fileName, AbstractFile::PriorityType pr FileManifest::addNewManifestEntry(fixedFileName, 0); #endif - return nullptr; + return NULL; } const int length = file->length(); @@ -787,7 +787,7 @@ const char *TreeFile::getSearchPath(int index) for (SearchNodes::iterator i = ms_searchNodes.begin(); i != iEnd; ++i) { const SearchPath *searchPath = dynamic_cast(*i); - if (searchPath != nullptr) + if (searchPath != NULL) { if (count == index) return searchPath->getPathName(); @@ -795,14 +795,14 @@ const char *TreeFile::getSearchPath(int index) } } - return nullptr; + return NULL; } //----------------------------------------------------------------- /** * This function will return the shortest trailing path of its input that * can be loaded by the TreeFile. If no files can be loaded, this routine - * will return nullptr. + * will return NULL. */ const char *TreeFile::getShortestExistingPath(const char *path) @@ -810,9 +810,9 @@ const char *TreeFile::getShortestExistingPath(const char *path) NOT_NULL(path); if (!*path) - return nullptr; + return NULL; - const char *result = nullptr; + const char *result = NULL; do { // check if this one exists @@ -866,7 +866,7 @@ bool TreeFile::stripTreeFileSearchPathFromFile(const char *inputPath, char *outp { // make sure it's a relative search path const SearchPath *searchPath = dynamic_cast(*i); - if (searchPath != nullptr) + if (searchPath != NULL) { // check to see if the the search path is a prefix for the requested path const char *path = searchPath->getPathName(); diff --git a/engine/shared/library/sharedFile/src/shared/TreeFile_SearchNode.cpp b/engine/shared/library/sharedFile/src/shared/TreeFile_SearchNode.cpp index 11c7d2e3..9c63e47d 100755 --- a/engine/shared/library/sharedFile/src/shared/TreeFile_SearchNode.cpp +++ b/engine/shared/library/sharedFile/src/shared/TreeFile_SearchNode.cpp @@ -53,7 +53,7 @@ TreeFile::SearchNode::~SearchNode(void) TreeFile::SearchPath::SearchPath(int priority, const char *path) : SearchNode(priority), - m_pathName(nullptr), + m_pathName(NULL), m_pathNameLength(0) { NOT_NULL(path); @@ -145,7 +145,7 @@ AbstractFile *TreeFile::SearchPath::open(const char *fileName, AbstractFile::Pri makeAbsolutePath(fileName, buffer); FileStreamer::File *file = FileStreamer::open(buffer); if (!file) - return nullptr; + return NULL; return new FileStreamerFile(priority, *file); } @@ -209,7 +209,7 @@ AbstractFile *TreeFile::SearchAbsolute::open(const char *fileName, AbstractFile: FileStreamer::File *file = FileStreamer::open(fileName); if (!file) - return nullptr; + return NULL; return new FileStreamerFile(priority, *file); } @@ -248,12 +248,12 @@ bool TreeFile::SearchTree::validate(const char *fileName) TreeFile::SearchTree::SearchTree(int priority, const char *fileName) : SearchNode(priority), - m_treeFileName(nullptr), - m_treeFile(nullptr), + m_treeFileName(NULL), + m_treeFile(NULL), m_version(0), m_numberOfFiles(0), - m_fileNames(nullptr), - m_tableOfContents(nullptr) + m_fileNames(NULL), + m_tableOfContents(NULL) { NOT_NULL(fileName); @@ -435,7 +435,7 @@ void TreeFile::SearchTree::debugPrint(void) bool TreeFile::SearchTree::exists(const char *fileName, bool &deleted) const { NOT_NULL(fileName); - return localExists(fileName, nullptr, deleted); + return localExists(fileName, NULL, deleted); } // ---------------------------------------------------------------------- @@ -497,7 +497,7 @@ AbstractFile *TreeFile::SearchTree::open(const char *fileName, AbstractFile::Pri return new ZlibFile(entry.length, compressedBuffer, entry.compressedLength, true); } - return nullptr; + return NULL; } // ====================================================================== @@ -535,14 +535,14 @@ bool TreeFile::SearchTOC::validate(const char *fileName) TreeFile::SearchTOC::SearchTOC(int priority, const char *fileName) : SearchNode(priority), - m_TOCFileName(nullptr), - m_TOCFile(nullptr), - m_treeFiles(nullptr), + m_TOCFileName(NULL), + m_TOCFile(NULL), + m_treeFiles(NULL), m_numberOfFiles(0), - m_treeFileNames(nullptr), - m_treeFileNamePointers(nullptr), - m_tableOfContents(nullptr), - m_fileNames(nullptr) + m_treeFileNames(NULL), + m_treeFileNamePointers(NULL), + m_tableOfContents(NULL), + m_fileNames(NULL) { NOT_NULL(fileName); @@ -587,7 +587,7 @@ TreeFile::SearchTOC::SearchTOC(int priority, const char *fileName) // add on all paths in config file const char * result; - for (int index = 0; (result = ConfigFile::getKeyString("SharedFile", "TOCTreePath", index, nullptr)) != nullptr; ++index) + for (int index = 0; (result = ConfigFile::getKeyString("SharedFile", "TOCTreePath", index, NULL)) != NULL; ++index) treePaths.push_back(result); // read in the tree file names and open the files @@ -598,7 +598,7 @@ TreeFile::SearchTOC::SearchTOC(int priority, const char *fileName) for (int treeFileNameIndex = 0, treeFileNameReadPosition = 0; treeFileNameIndex < static_cast(header.numberOfTreeFiles); treeFileNameIndex++) { m_treeFileNamePointers[treeFileNameIndex] = (m_treeFileNames + treeFileNameReadPosition); - m_treeFiles[treeFileNameIndex] = nullptr; + m_treeFiles[treeFileNameIndex] = NULL; // try to open the tree file in each of the relative paths for (std::vector::const_iterator pathIter = treePaths.begin(); pathIter != treePaths.end(); ++pathIter) @@ -656,7 +656,7 @@ TreeFile::SearchTOC::SearchTOC(int priority, const char *fileName) { currentFileNameLength = m_tableOfContents[i].fileNameOffset; m_tableOfContents[i].fileNameOffset = currentFileNameOffset; - // + 1 for the nullptr termination + // + 1 for the null termination currentFileNameOffset += (currentFileNameLength + 1); } } @@ -792,7 +792,7 @@ bool TreeFile::SearchTOC::exists(const char *fileName, bool &deleted) const { NOT_NULL(fileName); deleted = false; - return localExists(fileName, nullptr); + return localExists(fileName, NULL); } // ---------------------------------------------------------------------- @@ -862,7 +862,7 @@ AbstractFile *TreeFile::SearchTOC::open(const char *fileName, AbstractFile::Prio return new ZlibFile(entry.length, compressedBuffer, entry.compressedLength, true); } - return nullptr; + return NULL; } // ====================================================================== diff --git a/engine/shared/library/sharedFile/src/shared/ZlibFile.cpp b/engine/shared/library/sharedFile/src/shared/ZlibFile.cpp index 9a498a87..7c3778c7 100755 --- a/engine/shared/library/sharedFile/src/shared/ZlibFile.cpp +++ b/engine/shared/library/sharedFile/src/shared/ZlibFile.cpp @@ -66,7 +66,7 @@ ZlibFile::ZlibFile(int uncompressedLength, byte *compressedBuffer, int compresse m_compressedBuffer(compressedBuffer), m_compressedBufferLength(compressedBufferLength), m_ownsCompressedBuffer(ownsCompressedBuffer), - m_decompressedMemoryFile(nullptr) + m_decompressedMemoryFile(NULL) { } @@ -137,10 +137,10 @@ void ZlibFile::close() { if (m_ownsCompressedBuffer) delete [] m_compressedBuffer; - m_compressedBuffer = nullptr; + m_compressedBuffer = NULL; delete m_decompressedMemoryFile; - m_decompressedMemoryFile = nullptr; + m_decompressedMemoryFile = NULL; } // ---------------------------------------------------------------------- @@ -197,7 +197,7 @@ void ZlibFile::getZlibCompressedDataAndClose(byte *& compressedBuffer, int & com if (m_ownsCompressedBuffer) { compressedBuffer = m_compressedBuffer; - m_compressedBuffer = nullptr; + m_compressedBuffer = NULL; compressedBufferLength = m_compressedBufferLength; } else diff --git a/engine/shared/library/sharedFoundation/src/linux/Os.cpp b/engine/shared/library/sharedFoundation/src/linux/Os.cpp index b1e26987..2ddccf74 100755 --- a/engine/shared/library/sharedFoundation/src/linux/Os.cpp +++ b/engine/shared/library/sharedFoundation/src/linux/Os.cpp @@ -97,7 +97,7 @@ void Os::installCommon(void) mainThreadId = pthread_self(); // get the name of the executable -//Can't find UNIX call for this: DWORD result = GetModuleFileName(nullptr, programName, sizeof(programName)); +//Can't find UNIX call for this: DWORD result = GetModuleFileName(NULL, programName, sizeof(programName)); strcpy(programName, "TempName"); DWORD result = 1; @@ -119,7 +119,7 @@ void Os::installCommon(void) char buffer[512]; while (!feof(f)) { - if (fgets(buffer, 512, f) != nullptr) { + if (fgets(buffer, 512, f) != NULL) { if (strncmp(buffer, "processor\t: ", 12)==0) { processorCount = atoi(buffer+12)+1; @@ -165,13 +165,13 @@ void Os::abort(void) if (!isMainThread()) { threadDied = true; - pthread_exit(nullptr); + pthread_exit(NULL); } if (!shouldReturnFromAbort) { // let the C runtime deal with the abnormal termination - int * dummy = nullptr; + int * dummy = NULL; int forceCrash = *dummy; UNREF(forceCrash); for (;;) @@ -256,14 +256,14 @@ bool Os::writeFile(const char *fileName, const void *data, int length) // Le DWORD written; // open the file for writing - handle = CreateFile(fileName, GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); + handle = CreateFile(fileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); // check if it was opened if (handle == INVALID_HANDLE_VALUE) return false; // attempt to write the data - result = WriteFile(handle, data, static_cast(length), &written, nullptr); + result = WriteFile(handle, data, static_cast(length), &written, NULL); // make sure the data was written okay if (!result || written != static_cast(length)) diff --git a/engine/shared/library/sharedFoundation/src/linux/PerThreadData.cpp b/engine/shared/library/sharedFoundation/src/linux/PerThreadData.cpp index 18bee813..3d7f8584 100755 --- a/engine/shared/library/sharedFoundation/src/linux/PerThreadData.cpp +++ b/engine/shared/library/sharedFoundation/src/linux/PerThreadData.cpp @@ -81,7 +81,7 @@ PerThreadData::Data *PerThreadData::getData(bool allowReturnNull) if (!slotCreated) { DEBUG_FATAL(true && !allowReturnNull, ("not installed")); - return nullptr; + return NULL; } Data * const data = reinterpret_cast(pthread_getspecific(slot)); @@ -97,7 +97,7 @@ PerThreadData::Data *PerThreadData::getData(bool allowReturnNull) * * If the client is calling this function on a thread that existed before the engine was * installed, the client should set isNewThread to false. Setting isNewThread to false - * prevents the function from validating that the thread's TLS is nullptr. For threads existing + * prevents the function from validating that the thread's TLS is NULL. For threads existing * before the engine is installed, the TLS data for the thread is undefined. * * @param isNewThread [IN] true if the thread was created after the engine was installed, false otherwise @@ -147,10 +147,10 @@ void PerThreadData::threadRemove(void) //close the event used for file streaming reads delete data->readGate; - data->readGate = nullptr; + data->readGate = NULL; // wipe the data in the thread slot - const BOOL result2 = pthread_setspecific(slot, nullptr); + const BOOL result2 = pthread_setspecific(slot, NULL); UNREF(result2); DEBUG_FATAL(result2, ("TlsSetValue failed")); //NB: unlike Windows, returns 0 on success. diff --git a/engine/shared/library/sharedFoundation/src/linux/PerThreadData.h b/engine/shared/library/sharedFoundation/src/linux/PerThreadData.h index 86adef53..df4fd5f6 100755 --- a/engine/shared/library/sharedFoundation/src/linux/PerThreadData.h +++ b/engine/shared/library/sharedFoundation/src/linux/PerThreadData.h @@ -93,7 +93,7 @@ public: * threads existing at the time of slot creation. Thus, if you build a * plugin that only initializes the engine the first time it is * used, and other threads already exist in the app, those threads - * will contain bogus non-nullptr data in the TLS slot. If the plugin really + * will contain bogus non-null data in the TLS slot. If the plugin really * wants to do lazy initialization of the engine, it will need * to handle calling PerThreadData::threadInstall() for all existing threads * (except the thread that initialized the engine, which already @@ -102,7 +102,7 @@ public: inline bool PerThreadData::isThreadInstalled(void) { - return (getData(true) != nullptr); + return (getData(true) != NULL); } // ---------------------------------------------------------------------- @@ -168,7 +168,7 @@ inline void PerThreadData::setExitChainFataling(bool newValue) * Get the first entry for the exit chain. * * This routine is not intended for general use; it should only be used by the ExitChain class. - * This routine may return nullptr. + * This routine may return NULL. * * @return Pointer to the first entry on the exit chain * @see ExitChain::isFataling() @@ -184,7 +184,7 @@ inline ExitChain::Entry *PerThreadData::getExitChainFirstEntry(void) * Set the exit chain fataling flag value. * * This routine is not intended for general use; it should only be used by the ExitChain class. - * The parameter to this routine may be nullptr. + * The parameter to this routine may be NULL. * * @param newValue New value for the exit chain first entry */ diff --git a/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.cpp b/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.cpp index 822a4ee5..21668a79 100755 --- a/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.cpp +++ b/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.cpp @@ -33,7 +33,7 @@ char* _itoa(int value, char* stringOut, int radix) bool QueryPerformanceCounter(__int64* time) { struct timeval tv; - gettimeofday(&tv, nullptr); + gettimeofday(&tv, NULL); *time = static_cast(tv.tv_sec); *time = (*time * 1000000) + static_cast(tv.tv_usec); @@ -107,7 +107,7 @@ FILE* CreateFile(const char* fileName, DWORD access, DWORD shareMode, void* unsu FILE* retval = 0; DEBUG_FATAL(flagsAndAttributes != FILE_ATTRIBUTE_NORMAL, ("Unsupported File mode call to CreateFile()")); - DEBUG_FATAL(unsupB != nullptr, ("Unsupported File mode call to CreateFile()")); + DEBUG_FATAL(unsupB != NULL, ("Unsupported File mode call to CreateFile()")); //DEBUG_FATAL(shareMode != 0, ("Unsupported File mode call to CreateFile()")); DEBUG_FATAL(unsupA != 0, ("Unsupported File mode call to CreateFile()")); @@ -118,7 +118,7 @@ FILE* CreateFile(const char* fileName, DWORD access, DWORD shareMode, void* unsu if (retval) { fclose(retval); - retval = nullptr; + retval = NULL; } else { diff --git a/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.h b/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.h index 0cab423f..5e92921c 100755 --- a/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.h +++ b/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.h @@ -46,7 +46,7 @@ void OutputDebugString(const char* stringOut); typedef FILE* HANDLE; -#define INVALID_HANDLE_VALUE nullptr //Have to use a #define because this may be a FILE* +#define INVALID_HANDLE_VALUE NULL //Have to use a #define because this may be a FILE* const int GENERIC_READ = 1 << 0; @@ -66,8 +66,8 @@ const int FILE_END = SEEK_END; const int FILE_SHARE_READ = 1; -BOOL WriteFile(FILE* hFile, const void* lpBuffer, DWORD numBytesToWrite, DWORD* numBytesWritten, void* unsup=nullptr); -BOOL ReadFile(FILE* hFile, void* lpBuffer, DWORD numBytesToWrite, DWORD* numBytesRead, void* unsup=nullptr); +BOOL WriteFile(FILE* hFile, const void* lpBuffer, DWORD numBytesToWrite, DWORD* numBytesWritten, void* unsup=NULL); +BOOL ReadFile(FILE* hFile, void* lpBuffer, DWORD numBytesToWrite, DWORD* numBytesRead, void* unsup=NULL); DWORD SetFilePointer(FILE* hFile, long lDistanceToMove, long* lpDistanceToMoveHigh, DWORD dwMoveMethod); FILE* CreateFile(const char* fileName, DWORD access, DWORD shareMode, void* unsupA, DWORD creationDisposition, DWORD flagsAndAttributes, FILE* unsup2); BOOL CloseHandle(FILE* hFile); diff --git a/engine/shared/library/sharedFoundation/src/linux/SetupSharedFoundation.cpp b/engine/shared/library/sharedFoundation/src/linux/SetupSharedFoundation.cpp index e54017fc..07dec783 100755 --- a/engine/shared/library/sharedFoundation/src/linux/SetupSharedFoundation.cpp +++ b/engine/shared/library/sharedFoundation/src/linux/SetupSharedFoundation.cpp @@ -150,11 +150,11 @@ SetupSharedFoundation::Data::Data(Defaults defaults) case D_game: runInBackground = true; - lpCmdLine = nullptr; + lpCmdLine = NULL; argc = 0; - argv = nullptr; + argv = NULL; - configFile = nullptr; + configFile = NULL; frameRateLimit = CONST_REAL(0); break; @@ -162,11 +162,11 @@ SetupSharedFoundation::Data::Data(Defaults defaults) case D_console: runInBackground = true; - lpCmdLine = nullptr; + lpCmdLine = NULL; argc = 0; - argv = nullptr; + argv = NULL; - configFile = nullptr; + configFile = NULL; frameRateLimit = CONST_REAL(0); break; diff --git a/engine/shared/library/sharedFoundation/src/linux/vsnprintf.cpp b/engine/shared/library/sharedFoundation/src/linux/vsnprintf.cpp index 069dcb48..6b4c5647 100755 --- a/engine/shared/library/sharedFoundation/src/linux/vsnprintf.cpp +++ b/engine/shared/library/sharedFoundation/src/linux/vsnprintf.cpp @@ -21,7 +21,7 @@ // // Remarks: // -// If the buffer would overflow, the nullptr terminating character is not written and -1 +// If the buffer would overflow, the null terminating character is not written and -1 // will be returned. #ifdef _MSC_VER diff --git a/engine/shared/library/sharedFoundation/src/shared/BitArray.cpp b/engine/shared/library/sharedFoundation/src/shared/BitArray.cpp index 502b31a7..f094d140 100755 --- a/engine/shared/library/sharedFoundation/src/shared/BitArray.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/BitArray.cpp @@ -35,7 +35,7 @@ m_numInUseBits(0) { if (numBits > (m_numAllocatedBytes << 3)) { - m_arrayData = nullptr; + m_arrayData = NULL; m_numAllocatedBytes = 0; reserve(numBits); m_numInUseBytes = 0; @@ -294,7 +294,7 @@ void BitArray::reserve(int const numBits) { signed char * tmp = new signed char[static_cast(m_numInUseBytes)]; memset(&(tmp[oldNumInUseBytes]), 0, static_cast(m_numInUseBytes - oldNumInUseBytes)); - if ((oldNumInUseBytes > 0) && (m_arrayData != nullptr)) + if ((oldNumInUseBytes > 0) && (m_arrayData != NULL)) memcpy(tmp, m_arrayData, static_cast(oldNumInUseBytes)); //lint !e671 !e670 logically, you can't enter this code block unless oldNumInUseBytes is smaller. m_numAllocatedBytes = m_numInUseBytes; diff --git a/engine/shared/library/sharedFoundation/src/shared/BitArray.h b/engine/shared/library/sharedFoundation/src/shared/BitArray.h index 082fa6b4..70b04b41 100755 --- a/engine/shared/library/sharedFoundation/src/shared/BitArray.h +++ b/engine/shared/library/sharedFoundation/src/shared/BitArray.h @@ -58,7 +58,7 @@ public: // for DB persistence purpose, returns the BitArray as a // std::string where each 4 bits are printed as a hex nibble; - // and the converse that takes the nullptr-terminated string + // and the converse that takes the null-terminated string // and converts it back into the BitArray void getAsDbTextString(std::string &result, int maxNibbleCount = 32767) const; void setFromDbTextString(const char * text); diff --git a/engine/shared/library/sharedFoundation/src/shared/CalendarTime.cpp b/engine/shared/library/sharedFoundation/src/shared/CalendarTime.cpp index c73395af..64595534 100755 --- a/engine/shared/library/sharedFoundation/src/shared/CalendarTime.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/CalendarTime.cpp @@ -17,11 +17,11 @@ std::string CalendarTime::convertEpochToTimeStringGMT(time_t epoch) std::string result; struct tm * timeinfo = ::gmtime(&epoch); - if (timeinfo == nullptr) + if (timeinfo == NULL) return result; char * asciiTime = ::asctime(timeinfo); - if (asciiTime == nullptr) + if (asciiTime == NULL) return result; static char resultBuffer[512]; @@ -48,7 +48,7 @@ std::string CalendarTime::convertEpochToTimeStringGMT_YYYYMMDDHHMMSS(time_t epoc std::string result; struct tm * timeinfo = ::gmtime(&epoch); - if (timeinfo == nullptr) + if (timeinfo == NULL) return result; static char resultBuffer[512]; @@ -64,11 +64,11 @@ std::string CalendarTime::convertEpochToTimeStringLocal(time_t epoch) std::string result; struct tm * timeinfo = ::localtime(&epoch); - if (timeinfo == nullptr) + if (timeinfo == NULL) return result; char * asciiTime = ::asctime(timeinfo); - if (asciiTime == nullptr) + if (asciiTime == NULL) return result; static char resultBuffer[512]; @@ -105,7 +105,7 @@ std::string CalendarTime::convertEpochToTimeStringLocal_YYYYMMDDHHMMSS(time_t ep std::string result; struct tm * timeinfo = ::localtime(&epoch); - if (timeinfo == nullptr) + if (timeinfo == NULL) return result; static char resultBuffer[512]; @@ -218,7 +218,7 @@ time_t CalendarTime::getNextGMTTimeOcurrence(time_t const startTime, int const d // the year, month, day, day of week, hour, minute, second // in GMT time struct tm * timeinfo = ::gmtime(&startTime); - if (timeinfo == nullptr) + if (timeinfo == NULL) return -1; // get number of days until the specified day of week to search for @@ -333,7 +333,7 @@ time_t CalendarTime::getNextGMTTimeOcurrence(time_t const startTime, int const m // the year, month, day, day of week, hour, minute, second // in GMT time struct tm * timeinfo = ::gmtime(&startTime); - if (timeinfo == nullptr) + if (timeinfo == NULL) return -1; // calculate the Epoch GMT time for the specified start time @@ -358,7 +358,7 @@ time_t CalendarTime::getNextGMTTimeOcurrence(time_t const startTime, int const m startTimeAtSpecifiedHourMinuteSecond += (60 * 60 * 24); timeinfo = ::gmtime(&startTimeAtSpecifiedHourMinuteSecond); - if (timeinfo == nullptr) + if (timeinfo == NULL) return -1; if (++sentinel > maxIterations) diff --git a/engine/shared/library/sharedFoundation/src/shared/CommandLine.cpp b/engine/shared/library/sharedFoundation/src/shared/CommandLine.cpp index 5209d788..1198c252 100755 --- a/engine/shared/library/sharedFoundation/src/shared/CommandLine.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/CommandLine.cpp @@ -63,7 +63,7 @@ bool CommandLine::Option::isOptionNext( int optionSpecCount ) { - DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg")); + DEBUG_FATAL(!optionSpec, ("null optionSpec arg")); if (!optionSpecCount) return false; else @@ -77,8 +77,8 @@ CommandLine::Option *CommandLine::Option::createOption( int *optionCount ) { - DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg")); - DEBUG_FATAL(!optionCount, ("nullptr optionCount arg")); + DEBUG_FATAL(!optionSpec, ("null optionSpec arg")); + DEBUG_FATAL(!optionCount, ("null optionCount arg")); DEBUG_FATAL(!isOptionNext(*optionSpec, *optionCount), ("attempted to create option with non-option data")); const char newShortName = (*optionSpec)->char1; @@ -129,7 +129,7 @@ CommandLine::MatchCode CommandLine::Option::match(void) // matching this short or long name. If the arg specs don't match, we've // got an argument matching error. - DEBUG_FATAL(!optionTable, ("internal error: nullptr option table")); + DEBUG_FATAL(!optionTable, ("internal error: null option table")); OptionTable::Record *record = 0; @@ -145,7 +145,7 @@ CommandLine::MatchCode CommandLine::Option::match(void) DEBUG_FATAL(!record, ("failed to find option info record for option --%s", longName)); } else - DEBUG_FATAL(true, ("corrupted option? both short and long name are nullptr")); + DEBUG_FATAL(true, ("corrupted option? both short and long name are null")); // attempt to match against this option against commandline-specified options @@ -200,7 +200,7 @@ bool CommandLine::Collection::isCollectionNext( int optionSpecCount ) { - DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg")); + DEBUG_FATAL(!optionSpec, ("null optionSpec arg")); if (!optionSpecCount) return false; else @@ -214,8 +214,8 @@ CommandLine::Collection *CommandLine::Collection::createCollection( int *optionSpecCount ) { - DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg")); - DEBUG_FATAL(!optionSpecCount, ("nullptr optionSpecCount arg")); + DEBUG_FATAL(!optionSpec, ("null optionSpec arg")); + DEBUG_FATAL(!optionSpecCount, ("null optionSpecCount arg")); DEBUG_FATAL(!isCollectionNext(*optionSpec, *optionSpecCount), ("tried to create collection from non-collection optionSpec")); if ((*optionSpec)->optionType == OST_BeginList) @@ -289,7 +289,7 @@ bool CommandLine::List::Node::isNode( int optionCount ) { - DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg")); + DEBUG_FATAL(!optionSpec, ("null optionSpec arg")); if (!optionCount) return false; else @@ -303,8 +303,8 @@ CommandLine::List::Node *CommandLine::List::Node::createNode( int *optionCount ) { - DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg")); - DEBUG_FATAL(!optionCount, ("nullptr optionCount arg")); + DEBUG_FATAL(!optionSpec, ("null optionSpec arg")); + DEBUG_FATAL(!optionCount, ("null optionCount arg")); DEBUG_FATAL(!isNode(*optionSpec, *optionCount), ("attempted to create list node with non-list-node data")); Option *newOption = 0; @@ -350,7 +350,7 @@ CommandLine::List::List( listType(newListType), minimumNodeCount(0) { - DEBUG_FATAL(!newFirstNode, ("nullptr newFirstNode arg")); + DEBUG_FATAL(!newFirstNode, ("null newFirstNode arg")); DEBUG_FATAL(newListType != OPLT_Normal, ("constructor only good for OPLT_Normal lists, caller passed %d", newListType)); } @@ -366,7 +366,7 @@ CommandLine::List::List( listType(newListType), minimumNodeCount(newMinimumNodeCount) { - DEBUG_FATAL(!newFirstNode, ("nullptr newFirstNode arg")); + DEBUG_FATAL(!newFirstNode, ("null newFirstNode arg")); DEBUG_FATAL(newListType != OPLT_MinimumMatch, ("constructor only good for OPLT_MinimumMatch lists, caller passed %d", newListType)); } @@ -391,7 +391,7 @@ bool CommandLine::List::isListNext( int optionCount ) { - DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg")); + DEBUG_FATAL(!optionSpec, ("null optionSpec arg")); if (!optionCount) return false; else @@ -405,8 +405,8 @@ CommandLine::List *CommandLine::List::createList( int *optionCount ) { - DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg")); - DEBUG_FATAL(!optionCount, ("nullptr optionCount arg")); + DEBUG_FATAL(!optionSpec, ("null optionSpec arg")); + DEBUG_FATAL(!optionCount, ("null optionCount arg")); DEBUG_FATAL(!isListNext(*optionSpec, *optionCount), ("tried to create list from non-list optionSpec")); Node *newFirstNode = 0; @@ -582,7 +582,7 @@ bool CommandLine::Switch::Node::isNode( const OptionSpec *optionSpec, int optionCount) { - DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg")); + DEBUG_FATAL(!optionSpec, ("null optionSpec arg")); if (!optionCount) return false; else @@ -596,8 +596,8 @@ CommandLine::Switch::Node *CommandLine::Switch::Node::createNode( int *optionCount ) { - DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg")); - DEBUG_FATAL(!optionCount, ("nullptr optionCount arg")); + DEBUG_FATAL(!optionSpec, ("null optionSpec arg")); + DEBUG_FATAL(!optionCount, ("null optionCount arg")); DEBUG_FATAL(!isNode(*optionSpec, *optionCount), ("attempted to create list node with non-list-node data")); Option *newOption = 0; @@ -664,7 +664,7 @@ bool CommandLine::Switch::isSwitchNext( int optionCount ) { - DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg")); + DEBUG_FATAL(!optionSpec, ("null optionSpec arg")); if (!optionCount) return false; else @@ -678,8 +678,8 @@ CommandLine::Switch *CommandLine::Switch::createSwitch( int *optionCount ) { - DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg")); - DEBUG_FATAL(!optionCount, ("nullptr optionCount arg")); + DEBUG_FATAL(!optionSpec, ("null optionSpec arg")); + DEBUG_FATAL(!optionCount, ("null optionCount arg")); DEBUG_FATAL(!isSwitchNext(*optionSpec, *optionCount), ("tried to create switch from non-switch option spec")); const bool newOneNodeIsRequired = ((*optionSpec)->int1 != 0); @@ -886,7 +886,7 @@ CommandLine::OptionTable::Record *CommandLine::OptionTable::findOptionRecord( char shortName ) const { - DEBUG_FATAL(!shortName, ("nullptr shortName arg")); + DEBUG_FATAL(!shortName, ("null shortName arg")); // walk the list for (Record *record = firstRecord; record; record = record->getNext()) @@ -960,7 +960,7 @@ CommandLine::Lexer::Lexer( ) : nextCharacter(newBuffer) { - DEBUG_FATAL(!newBuffer, ("nullptr newBuffer arg")); + DEBUG_FATAL(!newBuffer, ("null newBuffer arg")); } // ---------------------------------------------------------------------- @@ -994,10 +994,10 @@ CommandLine::Lexer::~Lexer(void) bool CommandLine::Lexer::gobbleString(bool isRequired, char *stringBuffer, int stringSize) { - DEBUG_FATAL(!stringBuffer, ("nullptr stringStart arg")); + DEBUG_FATAL(!stringBuffer, ("null stringStart arg")); DEBUG_FATAL(!stringSize, ("stringSize is zero")); - DEBUG_FATAL(!nextCharacter, ("nullptr nextChar")); + DEBUG_FATAL(!nextCharacter, ("null nextChar")); int stringLength = 0; @@ -1069,7 +1069,7 @@ bool CommandLine::Lexer::gobbleString(bool isRequired, char *stringBuffer, int s if (isRequired && (stringLength == 0)) return false; - // nullptr-terminate the string + // null-terminate the string *stringBuffer = 0; return true; } @@ -1078,8 +1078,8 @@ bool CommandLine::Lexer::gobbleString(bool isRequired, char *stringBuffer, int s bool CommandLine::Lexer::getNextToken(Token *token) { - DEBUG_FATAL(!token, ("nullptr token arg")); - DEBUG_FATAL(!nextCharacter, ("nullptr nextCharacter")); + DEBUG_FATAL(!token, ("null token arg")); + DEBUG_FATAL(!nextCharacter, ("null nextCharacter")); // clear out the token memset(token, 0, sizeof(*token)); @@ -1204,7 +1204,7 @@ void CommandLine::remove(void) void CommandLine::buildOptionTree(const OptionSpec *specList, int specCount) { - DEBUG_FATAL(!specList, ("nullptr specList arg")); + DEBUG_FATAL(!specList, ("null specList arg")); if (!specCount) { @@ -1247,7 +1247,7 @@ CommandLine::MatchCode CommandLine::parseCommandLineBuffer(void) case Lexer::TT_ShortOption: // we've found a short option, make sure specified short option exists { - DEBUG_FATAL(!optionTable, ("internal error: nullptr optionTable")); + DEBUG_FATAL(!optionTable, ("internal error: null optionTable")); OptionTable::Record *record = optionTable->findOptionRecord(token.getShortName()); if (!record) { @@ -1279,7 +1279,7 @@ CommandLine::MatchCode CommandLine::parseCommandLineBuffer(void) case Lexer::TT_LongOption: // we've found a long option, make sure specified long option exists { - DEBUG_FATAL(!optionTable, ("internal error: nullptr optionTable")); + DEBUG_FATAL(!optionTable, ("internal error: null optionTable")); OptionTable::Record *record = optionTable->findOptionRecord(token.getLongName()); if (!record) { @@ -1322,7 +1322,7 @@ CommandLine::MatchCode CommandLine::parseCommandLineBuffer(void) case Lexer::TT_Argument: { - DEBUG_FATAL(!optionTable, ("internal error: nullptr optionTable")); + DEBUG_FATAL(!optionTable, ("internal error: null optionTable")); OptionTable::Record *record = optionTable->findOptionRecord(OP_SNAME_UNTAGGED); if (!record) { @@ -1382,7 +1382,7 @@ CommandLine::MatchCode CommandLine::parseCommandLineBuffer(void) void CommandLine::absorbString(const char *newString) { DEBUG_FATAL(!installed, ("CommandLine not installed")); - DEBUG_FATAL(!newString, ("nullptr newString arg")); + DEBUG_FATAL(!newString, ("null newString arg")); const int stringLength = static_cast(strlen(newString)); int requiredBufferSpace; @@ -1398,7 +1398,7 @@ void CommandLine::absorbString(const char *newString) buffer[bufferSize++] = ' '; } - // copy contents of buffer, including nullptr + // copy contents of buffer, including null memcpy(buffer + bufferSize, newString, stringLength + 1); bufferSize += stringLength; @@ -1437,7 +1437,7 @@ void CommandLine::absorbString(const char *newString) void CommandLine::absorbStrings(const char **stringArray, int stringCount) { DEBUG_FATAL(!installed, ("CommandLine not installed")); - DEBUG_FATAL(!stringArray, ("nullptr string array")); + DEBUG_FATAL(!stringArray, ("null string array")); for (int i = 0; i < stringCount; ++i) absorbString(stringArray[i]); @@ -1452,7 +1452,7 @@ void CommandLine::absorbStrings(const char **stringArray, int stringCount) * (i.e. "-- ") will be considered part of the post command line string. * * @return A read-only pointer to the portion of the command line not meant - * for CommandLine parsing. May be nullptr if the entire command line + * for CommandLine parsing. May be NULL if the entire command line * was meant for CommandLine or if no command line was specified. */ @@ -1704,7 +1704,7 @@ int CommandLine::getOccurrenceCount(const char *longName) * @param shortName [IN] short name of the option * @param occurrenceIndex [IN] zero-based occurrence number * @return The read-only argument string associated with the specified option occurrence. - * May be nullptr if no argument was associated with the specified option. + * May be NULL if no argument was associated with the specified option. */ const char *CommandLine::getOptionString(char shortName, int occurrenceIndex) @@ -1730,7 +1730,7 @@ const char *CommandLine::getOptionString(char shortName, int occurrenceIndex) * @param longName [IN] long name of the option * @param occurrenceIndex [IN] zero-based occurrence number * @return The read-only argument string associated with the specified option occurrence. - * May be nullptr if no argument was associated with the specified option. + * May be NULL if no argument was associated with the specified option. */ const char *CommandLine::getOptionString(const char *longName, int occurrenceIndex) diff --git a/engine/shared/library/sharedFoundation/src/shared/CommandLine.h b/engine/shared/library/sharedFoundation/src/shared/CommandLine.h index d4eab6a0..358b2e40 100755 --- a/engine/shared/library/sharedFoundation/src/shared/CommandLine.h +++ b/engine/shared/library/sharedFoundation/src/shared/CommandLine.h @@ -755,7 +755,7 @@ inline const char *CommandLine::Lexer::getNextCharacter(void) inline void CommandLine::Lexer::gobbleWhitespace(void) { - DEBUG_FATAL(!nextCharacter, ("nullptr nextCharacter")); + DEBUG_FATAL(!nextCharacter, ("null nextCharacter")); while (isspace(*nextCharacter)) ++nextCharacter; } diff --git a/engine/shared/library/sharedFoundation/src/shared/ConfigFile.cpp b/engine/shared/library/sharedFoundation/src/shared/ConfigFile.cpp index 07c04692..341f83e3 100755 --- a/engine/shared/library/sharedFoundation/src/shared/ConfigFile.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/ConfigFile.cpp @@ -30,7 +30,7 @@ static char tagBuffer[6]; #define CONFIG_FILE_TEMPLATE_CREATE_INT(section, key, def) DEBUG_REPORT_LOG(true, ("cfg: [%s] %s=%d\n", section, key, def)) #define CONFIG_FILE_TEMPLATE_CREATE_BOOL(section, key, def) DEBUG_REPORT_LOG(true, ("cfg: [%s] %s=%s\n", section, key, def ? "true" : "false")) #define CONFIG_FILE_TEMPLATE_CREATE_FLOAT(section, key, def) DEBUG_REPORT_LOG(true, ("cfg: [%s] %s=%3.1f\n", section, key, def)) -#define CONFIG_FILE_TEMPLATE_CREATE_STRING(section, key, def) DEBUG_REPORT_LOG(true, ("cfg: [%s] %s=%s\n", section, key, def ? def : "nullptr")) +#define CONFIG_FILE_TEMPLATE_CREATE_STRING(section, key, def) DEBUG_REPORT_LOG(true, ("cfg: [%s] %s=%s\n", section, key, def ? def : "NULL")) #define CONFIG_FILE_TEMPLATE_CREATE_TAG(section, key, def) ConvertTagToString(def, tagBuffer), DEBUG_REPORT_LOG(true, ("cfg: [%s] %s=%d\n", section, key, tagBuffer)) #else @@ -43,8 +43,8 @@ static char tagBuffer[6]; #endif -#define NO_SPACE_SECTION(a) DEBUG_FATAL(strchr(a, ' ') != nullptr, ("No spaces are allowed in config file section names: %s", a)) -#define NO_SPACE_KEY(a) DEBUG_FATAL(strchr(a, ' ') != nullptr, ("No spaces are allowed in config file key names: %s", a)) +#define NO_SPACE_SECTION(a) DEBUG_FATAL(strchr(a, ' ') != NULL, ("No spaces are allowed in config file section names: %s", a)) +#define NO_SPACE_KEY(a) DEBUG_FATAL(strchr(a, ' ') != NULL, ("No spaces are allowed in config file key names: %s", a)) // ====================================================================== @@ -81,7 +81,7 @@ void ConfigFile::install(void) #endif ms_sections = new ConfigFile::SectionMap; - ms_currentSection = nullptr; + ms_currentSection = NULL; ExitChain::add(ConfigFile::remove, "ConfigFile::remove"); ms_installed = true; } @@ -110,7 +110,7 @@ void ConfigFile::remove(void) for (std::map::iterator it = ms_sections->begin(); it != ms_sections->end(); ++it) delete it->second; delete ms_sections; - ms_sections = nullptr; + ms_sections = NULL; ms_installed = false; } @@ -142,7 +142,7 @@ bool ConfigFile::loadFromCommandLine(const char *buffer) while (isspace(*buffer)) { ++buffer; - // advancing buffer, check for nullptr (trailing white space on command line) + // advancing buffer, check for null (trailing white space on command line) if(! *buffer) break; } @@ -196,7 +196,7 @@ bool ConfigFile::loadFromCommandLine(const char *buffer) //allocate a new section and set it as the current one Section *newSection = createSection(sectionName); //note that newSection is memory owned by the created Section object - //while sectionName is memory allocated to create a nullptr terminated string + //while sectionName is memory allocated to create a null terminated string ms_currentSection = newSection; } delete[] sectionName; @@ -292,7 +292,7 @@ bool ConfigFile::loadFromBuffer(char const * const buffer, int const length) processLine(currentLine); delete[] currentLine; bufferPosition += lineLength+1; - //trim ending whitespace. Remember that this string is not guaranteed to be nullptr terminated. + //trim ending whitespace. Remember that this string is not guaranteed to be NULL terminated. while (*bufferPosition && (bufferPosition < buffer + length) && isspace(static_cast(*bufferPosition))) ++bufferPosition; } @@ -311,26 +311,26 @@ bool ConfigFile::loadFile(const char *file) { DEBUG_FATAL(!ms_installed, ("ConfigFile not installed")); NOT_NULL(file); - ms_currentSection = nullptr; - HANDLE handle = CreateFile(file, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); + ms_currentSection = NULL; + HANDLE handle = CreateFile(file, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (handle != INVALID_HANDLE_VALUE) { // get the length of the config file - const DWORD length = GetFileSize(handle, nullptr); + const DWORD length = GetFileSize(handle, NULL); if (length != 0xffffffff) { // create a buffer to load the config file into char * const buffer = new char[length+2]; - // make sure the buffer is nullptr terminated + // make sure the buffer is null terminated buffer[length] = '\n'; buffer[length+1] = '\0'; // read the config file in DWORD readResult; - const BOOL result = ReadFile(handle, buffer, length, &readResult, nullptr); + const BOOL result = ReadFile(handle, buffer, length, &readResult, NULL); // make sure we read all the correct stuff if (result && readResult == length) @@ -360,7 +360,7 @@ void ConfigFile::processLine(const char *line) { DEBUG_FATAL(!ms_installed, ("ConfigFile not installed")); // validate argument - DEBUG_FATAL(!line, ("ConfigFile::processLine nullptr")); + DEBUG_FATAL(!line, ("ConfigFile::processLine NULL")); // check for a full line comment if (*line == '#' || *line == ';') @@ -418,7 +418,7 @@ void ConfigFile::processLine(const char *line) //allocate a new section and set it as the current one Section *newSection = createSection(sectionName); //note that newSection is memory owned by the created Section object - //while sectionName is memory allocated to create a nullptr terminated string + //while sectionName is memory allocated to create a null terminated string ms_currentSection = newSection; } delete[] sectionName; @@ -468,7 +468,7 @@ void ConfigFile::processKeys(const char *line) while (*endValue) { //build the value - char *value = nullptr; + char *value = NULL; while(isspace(*beginValue)) ++beginValue; if (*beginValue != '"') @@ -542,7 +542,7 @@ void ConfigFile::processKeys(const char *line) /** Get a Section pointer from a string * * @param section the name of the section - * @return the pointer if valid, otherwise nullptr + * @return the pointer if valid, otherwise NULL */ ConfigFile::Section *ConfigFile::getSection(const char *section) { @@ -550,7 +550,7 @@ ConfigFile::Section *ConfigFile::getSection(const char *section) if (it != ms_sections->end()) return it->second; - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -581,7 +581,7 @@ void ConfigFile::removeSection(const char *name) if (iter != ms_sections->end()) { delete iter->second; - iter->second = nullptr; + iter->second = NULL; ms_sections->erase(iter); } } @@ -991,7 +991,7 @@ Tag ConfigFile::getKeyTag(const char *section, const char *key, Tag defaultValue ConfigFile::Element::Element(void) : - m_entry(nullptr) + m_entry(NULL) {} // ---------------------------------------------------------------------- @@ -1105,8 +1105,8 @@ Tag ConfigFile::Element::getAsTag(void) const ConfigFile::Key::Key(const char *name, const char *value, bool lazyAdd) : - m_elements(nullptr), - m_name(nullptr), + m_elements(NULL), + m_name(NULL), m_lazyAdd(lazyAdd) { m_name = new char[strlen(name)+1]; @@ -1248,8 +1248,8 @@ void ConfigFile::Key::dump(const char *keyName) const ConfigFile::Section::Section(const char *name) : - m_keys(nullptr), - m_name(nullptr) + m_keys(NULL), + m_name(NULL) { m_name = new char[strlen(name)+1]; strcpy(m_name, name); @@ -1284,7 +1284,7 @@ ConfigFile::Key *ConfigFile::Section::findKey(const char *key) const if (it != m_keys->end()) return it->second; - return nullptr; + return NULL; } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedFoundation/src/shared/ConfigFile.h b/engine/shared/library/sharedFoundation/src/shared/ConfigFile.h index 09a78599..a4c034ed 100755 --- a/engine/shared/library/sharedFoundation/src/shared/ConfigFile.h +++ b/engine/shared/library/sharedFoundation/src/shared/ConfigFile.h @@ -99,7 +99,7 @@ public: int getKeyInt (const char *key, int index, int defaultValue = 0) const; bool getKeyBool (const char *key, int index, bool defaultValue = false) const; float getKeyFloat (const char *key, int index, float defaultValue = 0.f) const; - const char *getKeyString(const char *key, int index, const char *defaultValue = nullptr) const; + const char *getKeyString(const char *key, int index, const char *defaultValue = NULL) const; Tag getKeyTag (const char *key, int index, Tag defaultValue = 0) const; int getKeyCount(const char *key) const; void addKey(const char *keyName, const char *value, bool lazyAdd = false); diff --git a/engine/shared/library/sharedFoundation/src/shared/CrashReportInformation.cpp b/engine/shared/library/sharedFoundation/src/shared/CrashReportInformation.cpp index 983fd7ff..920f1ffa 100755 --- a/engine/shared/library/sharedFoundation/src/shared/CrashReportInformation.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/CrashReportInformation.cpp @@ -87,7 +87,7 @@ char const * CrashReportInformation::getEntry(int index) if (index < static_cast(ms_dynamicText.size())) return ms_dynamicText[index]; - return nullptr; + return NULL; } // ====================================================================== diff --git a/engine/shared/library/sharedFoundation/src/shared/Crc.cpp b/engine/shared/library/sharedFoundation/src/shared/Crc.cpp index 28ef3514..4fddb3b8 100755 --- a/engine/shared/library/sharedFoundation/src/shared/Crc.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/Crc.cpp @@ -99,7 +99,7 @@ uint32 Crc::calculateWithToLower(const char *string) uint32 Crc::calculate(const void *data, int length, uint32 initCrc) { - DEBUG_FATAL(!data, ("nullptr data arg")); + DEBUG_FATAL(!data, ("null data arg")); uint32 crc; const byte *d = reinterpret_cast(data); diff --git a/engine/shared/library/sharedFoundation/src/shared/CrcStringTable.cpp b/engine/shared/library/sharedFoundation/src/shared/CrcStringTable.cpp index 9e8ca2b6..206f0dea 100755 --- a/engine/shared/library/sharedFoundation/src/shared/CrcStringTable.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/CrcStringTable.cpp @@ -31,9 +31,9 @@ using namespace CrcStringTableNamespace; CrcStringTable::CrcStringTable() : m_numberOfEntries(0), - m_crcTable(nullptr), - m_stringsOffsetTable(nullptr), - m_strings(nullptr) + m_crcTable(NULL), + m_stringsOffsetTable(NULL), + m_strings(NULL) { } @@ -42,9 +42,9 @@ CrcStringTable::CrcStringTable() CrcStringTable::CrcStringTable(char const * fileName) : m_numberOfEntries(0), - m_crcTable(nullptr), - m_stringsOffsetTable(nullptr), - m_strings(nullptr) + m_crcTable(NULL), + m_stringsOffsetTable(NULL), + m_strings(NULL) { load(fileName); } @@ -69,7 +69,7 @@ void CrcStringTable::load(char const * fileName) if(fileName) DEBUG_WARNING(true, ("Could not load CrcStringTable %s", fileName)); else - DEBUG_WARNING(true, ("Could not load CrcStringTable, nullptr file given")); + DEBUG_WARNING(true, ("Could not load CrcStringTable, NULL file given")); return; } diff --git a/engine/shared/library/sharedFoundation/src/shared/DataResourceList.h b/engine/shared/library/sharedFoundation/src/shared/DataResourceList.h index a86629e5..c5574f7f 100755 --- a/engine/shared/library/sharedFoundation/src/shared/DataResourceList.h +++ b/engine/shared/library/sharedFoundation/src/shared/DataResourceList.h @@ -82,7 +82,7 @@ private: template inline void DataResourceList::install() { - if (ms_bindings == nullptr) + if (ms_bindings == NULL) { ms_bindings = new CreateDataResourceMap(); ms_loaded = new LoadedDataResourceMap(); @@ -100,7 +100,7 @@ inline void DataResourceList::install() template inline void DataResourceList::remove(void) { - if (ms_loaded != nullptr) + if (ms_loaded != NULL) { #ifdef _DEBUG if (!ms_loaded->empty()) @@ -122,13 +122,13 @@ inline void DataResourceList::remove(void) #endif // _DEBUG delete ms_loaded; - ms_loaded = nullptr; + ms_loaded = NULL; } - if (ms_bindings != nullptr) + if (ms_bindings != NULL) { delete ms_bindings; - ms_bindings = nullptr; + ms_bindings = NULL; } } // DataResourceList::remove @@ -144,7 +144,7 @@ template inline void DataResourceList::registerTemplate(Tag id, CreateDataResourceFunc createFunc) { - if (ms_bindings == nullptr) + if (ms_bindings == NULL) install(); #ifdef _DEBUG @@ -237,7 +237,7 @@ inline T * DataResourceList::fetch(Tag id) typename CreateDataResourceMap::iterator iter = ms_bindings->find(id); if (iter == ms_bindings->end()) - return nullptr; + return NULL; return (*(*iter).second)(""); } // DataResourceList::fetch(Tag) @@ -268,11 +268,11 @@ inline const T * DataResourceList::fetch(Iff &source) char buffer[5]; ConvertTagToString(id, buffer); DEBUG_WARNING(true, ("DataResourceList::fetch Iff: trying to fetch resource for unknown tag %s!", buffer)); - return nullptr; + return NULL; } T *newDataResource = (*(*createIter).second)(source.getFileName()); - if (newDataResource != nullptr) + if (newDataResource != NULL) { // initialize the data resource newDataResource->loadFromIff(source); @@ -310,11 +310,11 @@ inline const T * DataResourceList::fetch(const CrcString &filename) // load the template Iff iff; if (!iff.open(filename.getString(), true)) - return nullptr; + return NULL; // put the template in the loaded list const T * const newDataResource = fetch(iff); - if (newDataResource != nullptr) + if (newDataResource != NULL) { newDataResource->addReference(); ms_loaded->insert(std::make_pair(&newDataResource->getCrcName (), newDataResource)); @@ -337,13 +337,13 @@ inline void DataResourceList::release(const T & dataResource) { NOT_NULL(ms_loaded); - if (ms_loaded != nullptr && dataResource.getReferenceCount() == 0) + if (ms_loaded != NULL && dataResource.getReferenceCount() == 0) { typename LoadedDataResourceMap::iterator iter = ms_loaded->find(&dataResource.getCrcName()); if (iter != ms_loaded->end()) { const T * const temp = (*iter).second; - (*iter).second = nullptr; + (*iter).second = NULL; ms_loaded->erase(iter); delete temp; } @@ -369,11 +369,11 @@ inline T * DataResourceList::reload(Iff &source) if (iter == ms_loaded->end()) { DEBUG_WARNING(true, ("DataResourceList::reload: trying to reload unloaded resource %s!", source.getFileName())); - return nullptr; + return NULL; } T * const dataResource = const_cast((*iter).second); - if (dataResource != nullptr) + if (dataResource != NULL) { // initialize the data resource dataResource->loadFromIff(source); diff --git a/engine/shared/library/sharedFoundation/src/shared/ExitChain.cpp b/engine/shared/library/sharedFoundation/src/shared/ExitChain.cpp index af70c5a0..3b1fb1bf 100755 --- a/engine/shared/library/sharedFoundation/src/shared/ExitChain.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/ExitChain.cpp @@ -115,7 +115,7 @@ void ExitChain::add(Function function, const char *debugName, int priority, bool #endif // linked list traversal with a back pointer - for (back = nullptr, front = PerThreadData::getExitChainFirstEntry(); front && front->priority > priority; back = front, front = front->next) + for (back = NULL, front = PerThreadData::getExitChainFirstEntry(); front && front->priority > priority; back = front, front = front->next) ; // hook it into the linked list @@ -133,7 +133,7 @@ void ExitChain::add(Function function, const char *debugName, int priority, bool * The ExitChain will automatically remove a function from the ExitChain when it calls the function, so an * exit function should not attempt to remove itself from the ExitChain. * - * Calling this routine with a nullptr pointer will cause this routine to call Fatal in debug compilations. + * Calling this routine with a NULL pointer will cause this routine to call Fatal in debug compilations. * * Calling this routine with a function that is not on the ExitChain will cause this routine to call * Fatal in debug compilations. @@ -145,14 +145,14 @@ void ExitChain::remove(Function function) { Entry *back, *front; - if (function == nullptr) + if (function == NULL) { - DEBUG_FATAL(true, ("ExitChain::remove nullptr function")); + DEBUG_FATAL(true, ("ExitChain::remove NULL function")); return; //lint !e527 // Warning -- Unreachable } // linked list traversal with a back pointer - for (back = nullptr, front = PerThreadData::getExitChainFirstEntry(); front && front->function != function; back = front, front = front->next) + for (back = NULL, front = PerThreadData::getExitChainFirstEntry(); front && front->function != function; back = front, front = front->next) ; // make sure it was found @@ -191,7 +191,7 @@ void ExitChain::run(void) PerThreadData::setExitChainRunning(true); - while ((entry = PerThreadData::getExitChainFirstEntry()) != nullptr) + while ((entry = PerThreadData::getExitChainFirstEntry()) != NULL) { // remove the first entry off the ExitChain PerThreadData::setExitChainFirstEntry(entry->next); diff --git a/engine/shared/library/sharedFoundation/src/shared/Fatal.cpp b/engine/shared/library/sharedFoundation/src/shared/Fatal.cpp index 37a3884f..5d2c7327 100755 --- a/engine/shared/library/sharedFoundation/src/shared/Fatal.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/Fatal.cpp @@ -33,7 +33,7 @@ namespace FatalNamespace int ms_numberOfWarnings = 0; bool ms_strict = false; - WarningCallback s_warningCallback = nullptr; + WarningCallback s_warningCallback = NULL; #if PRODUCTION == 0 PixCounter::ResetInteger ms_numberOfWarningsThisFrame; @@ -70,7 +70,7 @@ static void formatMessage(char *buffer, int bufferLength, int stackDepth, const else DebugHelp::getCallStack(callStack, callStackOffset + stackDepth); - // make sure the buffer is always nullptr terminated + // make sure the buffer is always null terminated buffer[--bufferLength] = '\0'; // look up the caller's file and line @@ -191,7 +191,7 @@ static void InternalWarning(const char *format, int extraFlags, va_list va, int char buffer[4 * 1024]; - if (nullptr != s_warningCallback) + if (NULL != s_warningCallback) { strcpy(buffer, "WARNING: "); vsnprintf(buffer + 9, sizeof(buffer) - 9, format, va); diff --git a/engine/shared/library/sharedFoundation/src/shared/Fatal.h b/engine/shared/library/sharedFoundation/src/shared/Fatal.h index 14215b90..f33eb5ac 100755 --- a/engine/shared/library/sharedFoundation/src/shared/Fatal.h +++ b/engine/shared/library/sharedFoundation/src/shared/Fatal.h @@ -68,15 +68,15 @@ void SetWarningCallback(WarningCallback); template inline T *NonNull(T *pointer, const char *name) { - WARNING(!pointer, ("%s pointer is nullptr", name)); + WARNING(!pointer, ("%s pointer is null", name)); return pointer; } #define NON_NULL(a) NonNull(a, #a) - #define NOT_NULL(a) FATAL(!a, ("%s pointer is nullptr", #a)) + #define NOT_NULL(a) FATAL(!a, ("%s pointer is null", #a)) - // FATAL if the specified pointer is not nullptr (i.e. assert that the pointer is nullptr, the opposite of NOT_NULL). - #define IS_NULL(a) FATAL(a, ("%s pointer is not nullptr, unexpected.", #a)) + // FATAL if the specified pointer is not NULL (i.e. assert that the pointer is null, the opposite of NOT_NULL). + #define IS_NULL(a) FATAL(a, ("%s pointer is not null, unexpected.", #a)) #else diff --git a/engine/shared/library/sharedFoundation/src/shared/FormattedString.h b/engine/shared/library/sharedFoundation/src/shared/FormattedString.h index d778be27..b4e1f6de 100755 --- a/engine/shared/library/sharedFoundation/src/shared/FormattedString.h +++ b/engine/shared/library/sharedFoundation/src/shared/FormattedString.h @@ -42,7 +42,7 @@ inline FormattedString::FormattedString() template inline char const * FormattedString::sprintf(char const * const format, ...) { - char const * result = nullptr; + char const * result = NULL; va_list va; va_start(va, format); @@ -64,7 +64,7 @@ inline char const * FormattedString::vsprintf(char const * const for int const charactersWritten = vsnprintf(m_text, lastIndex, format, va); // vsnprintf returns the number of characters written, not including - // the terminating nullptr character, or a negative value if an output error occurs. + // the terminating null character, or a negative value if an output error occurs. // If the number of characters to write exceeds count, then count characters are // written and -1 is returned. diff --git a/engine/shared/library/sharedFoundation/src/shared/LabelHash.cpp b/engine/shared/library/sharedFoundation/src/shared/LabelHash.cpp index 2f28a3ca..26848b94 100755 --- a/engine/shared/library/sharedFoundation/src/shared/LabelHash.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/LabelHash.cpp @@ -109,7 +109,7 @@ const char * LabelHash::findLabel( char const * const domain, uint32 hashValue ) { // Domain not found - return nullptr; + return NULL; } // ---------- @@ -127,6 +127,6 @@ const char * LabelHash::findLabel( char const * const domain, uint32 hashValue ) // ---------- // String not found - return nullptr; + return NULL; } diff --git a/engine/shared/library/sharedFoundation/src/shared/MemoryBlockManager.cpp b/engine/shared/library/sharedFoundation/src/shared/MemoryBlockManager.cpp index c8067046..c5c86efd 100755 --- a/engine/shared/library/sharedFoundation/src/shared/MemoryBlockManager.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/MemoryBlockManager.cpp @@ -138,8 +138,8 @@ using namespace MemoryBlockManagerNamespace; MemoryBlockManager::Allocator::Allocator(const int elementSize) : m_referenceCount(0), - m_firstBlock(nullptr), - m_firstFreeElement(nullptr), + m_firstBlock(NULL), + m_firstFreeElement(NULL), m_elementSize(elementSize), m_elementsPerBlock(64), m_currentNumberOfBlocks(0), @@ -157,8 +157,8 @@ MemoryBlockManager::Allocator::Allocator(const int elementSize) MemoryBlockManager::Allocator::Allocator(int elementSize, int elementsPerBlock, int minimumBlocks, int maximumNumberOfBlocks) : m_referenceCount(0), - m_firstBlock(nullptr), - m_firstFreeElement(nullptr), + m_firstBlock(NULL), + m_firstFreeElement(NULL), m_elementSize(elementSize), m_elementsPerBlock(elementsPerBlock), m_currentNumberOfBlocks(0), @@ -188,8 +188,8 @@ MemoryBlockManager::Allocator::~Allocator() delete block; } - m_firstBlock = nullptr; - m_firstFreeElement = nullptr; + m_firstBlock = NULL; + m_firstFreeElement = NULL; } // ---------------------------------------------------------------------- @@ -427,7 +427,7 @@ MemoryBlockManager::MemoryBlockManager(char const * name, bool shared, int eleme : m_name(name), m_shared(shared), m_currentNumberOfElements(0), - m_allocator(nullptr) + m_allocator(NULL) { //-- Handle config option where we force all MemoryBlockManagers to be non-shared. if (shared && ms_forceAllNonShared) @@ -598,7 +598,7 @@ void *MemoryBlockManager::allocate(bool returnNullOnFailure) { ms_globalCriticalSection.leave(); DEBUG_FATAL(!returnNullOnFailure, ("MBM %s is full %d", m_name, m_currentNumberOfElements)); - return nullptr; + return NULL; } ++m_currentNumberOfElements; diff --git a/engine/shared/library/sharedFoundation/src/shared/MessageQueue.cpp b/engine/shared/library/sharedFoundation/src/shared/MessageQueue.cpp index 4b77315c..5af0285d 100755 --- a/engine/shared/library/sharedFoundation/src/shared/MessageQueue.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/MessageQueue.cpp @@ -105,7 +105,7 @@ void MessageQueue::clearDataFromMessageList(MessageList &messageList, bool destr { DEBUG_WARNING(!destructor, ("clearing message data from beginFrame")); delete message.m_data; - message.m_data = nullptr; + message.m_data = NULL; } } } @@ -199,7 +199,7 @@ void MessageQueue::clearMessage(const int index) VALIDATE_RANGE_INCLUSIVE_EXCLUSIVE(0, index, getNumberOfMessages()); Message& message = (*m_messageQueueRead)[static_cast(index)]; - DEBUG_WARNING(message.m_data, ("MessageQueue::clearMessage - clearing message with non-nullptr data")); + DEBUG_WARNING(message.m_data, ("MessageQueue::clearMessage - clearing message with non-null data")); message.m_message = 0; } diff --git a/engine/shared/library/sharedFoundation/src/shared/Misc.h b/engine/shared/library/sharedFoundation/src/shared/Misc.h index 1c29b6ed..326d3341 100755 --- a/engine/shared/library/sharedFoundation/src/shared/Misc.h +++ b/engine/shared/library/sharedFoundation/src/shared/Misc.h @@ -135,7 +135,7 @@ templateinline void Zero(T &t) * the source string into the new memory, and then returns a pointer to * the new memory. * - * This routine will return nullptr if called with nullptr. + * This routine will return NULL if called with NULL. * * @param source The string to copy * @return A pointer to a copy of the source argument @@ -144,7 +144,7 @@ templateinline void Zero(T &t) inline char *DuplicateString(const char *source) { if (!source) - return nullptr; + return NULL; const uint length = strlen(source)+1; char *result = NON_NULL (new char[length]); @@ -160,7 +160,7 @@ inline char *DuplicateString(const char *source) * the source string into the new memory, and then returns a pointer to * the new memory. * - * This routine will return nullptr if called with nullptr. + * This routine will return NULL if called with NULL. * * @param source The string to copy * @return A pointer to a copy of the source argument @@ -169,7 +169,7 @@ inline char *DuplicateString(const char *source) inline char *DuplicateStringWithToLower(const char *source) { if (!source) - return nullptr; + return NULL; const uint length = strlen(source)+1; char *result = NON_NULL (new char[length]); @@ -193,7 +193,7 @@ inline char *DuplicateStringWithToLower(const char *source) inline void imemset(void *data, int value, int length) { - DEBUG_FATAL(!data, ("nullptr data arg")); + DEBUG_FATAL(!data, ("null data arg")); memset(data, value, static_cast(length)); } @@ -210,8 +210,8 @@ inline void imemset(void *data, int value, int length) inline void imemcpy(void *destination, const void *source, int length) { - DEBUG_FATAL(!destination, ("nullptr destination arg")); - DEBUG_FATAL(!source, ("nullptr source arg")); + DEBUG_FATAL(!destination, ("null destination arg")); + DEBUG_FATAL(!source, ("null source arg")); memcpy(destination, source, static_cast(length)); } @@ -228,8 +228,8 @@ inline void imemcpy(void *destination, const void *source, int length) inline void *memmove(void *destination, const void *source, int length) { - DEBUG_FATAL(!destination, ("nullptr destination arg")); - DEBUG_FATAL(!source, ("nullptr source arg")); + DEBUG_FATAL(!destination, ("null destination arg")); + DEBUG_FATAL(!source, ("null source arg")); return memmove(destination, source, static_cast(length)); } @@ -243,7 +243,7 @@ inline void *memmove(void *destination, const void *source, int length) inline int istrlen(const char *string) { - DEBUG_FATAL(!string, ("nullptr string arg")); + DEBUG_FATAL(!string, ("null string arg")); return static_cast(strlen(string)); } diff --git a/engine/shared/library/sharedFoundation/src/shared/PersistentCrcString.cpp b/engine/shared/library/sharedFoundation/src/shared/PersistentCrcString.cpp index dae8108f..7de5a7d3 100755 --- a/engine/shared/library/sharedFoundation/src/shared/PersistentCrcString.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/PersistentCrcString.cpp @@ -50,23 +50,23 @@ void PersistentCrcString::install() void PersistentCrcStringNamespace::remove() { delete ms_memoryBlockManager8; - ms_memoryBlockManager8 = nullptr; + ms_memoryBlockManager8 = NULL; delete ms_memoryBlockManager16; - ms_memoryBlockManager16 = nullptr; + ms_memoryBlockManager16 = NULL; delete ms_memoryBlockManager32; - ms_memoryBlockManager32 = nullptr; + ms_memoryBlockManager32 = NULL; delete ms_memoryBlockManager48; - ms_memoryBlockManager48 = nullptr; + ms_memoryBlockManager48 = NULL; delete ms_memoryBlockManager64; - ms_memoryBlockManager64 = nullptr; + ms_memoryBlockManager64 = NULL; } // ====================================================================== PersistentCrcString::PersistentCrcString() : CrcString(), - m_memoryBlockManager(nullptr), - m_buffer(nullptr) + m_memoryBlockManager(NULL), + m_buffer(NULL) { DEBUG_FATAL(!ms_memoryBlockManager8, ("Constructing a PersistentCrcString before the class is installed")); } @@ -75,8 +75,8 @@ PersistentCrcString::PersistentCrcString() PersistentCrcString::PersistentCrcString(CrcString const &rhs) : CrcString(), - m_memoryBlockManager(nullptr), - m_buffer(nullptr) + m_memoryBlockManager(NULL), + m_buffer(NULL) { DEBUG_FATAL(!ms_memoryBlockManager8, ("Constructing a PersistentCrcString before the class is installed")); @@ -88,8 +88,8 @@ PersistentCrcString::PersistentCrcString(CrcString const &rhs) PersistentCrcString::PersistentCrcString(PersistentCrcString const &rhs) : CrcString(), //lint !e1738 // non copy constructor used to initialize base class // this appears to be intentional. - m_memoryBlockManager(nullptr), - m_buffer(nullptr) + m_memoryBlockManager(NULL), + m_buffer(NULL) { DEBUG_FATAL(!ms_memoryBlockManager8, ("Constructing a PersistentCrcString before the class is installed")); @@ -101,8 +101,8 @@ PersistentCrcString::PersistentCrcString(PersistentCrcString const &rhs) PersistentCrcString::PersistentCrcString(char const * string, bool applyNormalize) : CrcString(), - m_memoryBlockManager(nullptr), - m_buffer(nullptr) + m_memoryBlockManager(NULL), + m_buffer(NULL) { DEBUG_FATAL(!ms_memoryBlockManager8, ("Constructing a PersistentCrcString before the class is installed")); @@ -114,8 +114,8 @@ PersistentCrcString::PersistentCrcString(char const * string, bool applyNormaliz PersistentCrcString::PersistentCrcString(char const * string, uint32 crc) : CrcString(), - m_memoryBlockManager(nullptr), - m_buffer(nullptr) + m_memoryBlockManager(NULL), + m_buffer(NULL) { DEBUG_FATAL(!ms_memoryBlockManager8, ("Constructing a PersistentCrcString before the class is installed")); @@ -169,18 +169,18 @@ void PersistentCrcString::internalFree() { if (m_memoryBlockManager == ms_fakeConstCharMemoryBlockManager) { - m_memoryBlockManager = nullptr; + m_memoryBlockManager = NULL; } else { m_memoryBlockManager->free(m_buffer); - m_memoryBlockManager = nullptr; + m_memoryBlockManager = NULL; } } else delete [] m_buffer; - m_buffer = nullptr; + m_buffer = NULL; } } @@ -201,7 +201,7 @@ void PersistentCrcString::internalSet(char const * string, bool applyNormalize) const int stringLength = istrlen(string) + 1; DEBUG_FATAL(stringLength > Os::MAX_PATH_LENGTH, ("string too long for a filename")); - m_memoryBlockManager = nullptr; + m_memoryBlockManager = NULL; if (stringLength <= 8) m_memoryBlockManager = ms_memoryBlockManager8; else diff --git a/engine/shared/library/sharedFoundation/src/shared/Tag.h b/engine/shared/library/sharedFoundation/src/shared/Tag.h index 261b474e..82a4f393 100755 --- a/engine/shared/library/sharedFoundation/src/shared/Tag.h +++ b/engine/shared/library/sharedFoundation/src/shared/Tag.h @@ -158,7 +158,7 @@ inline Tag ConvertIntToTag(int value) * array with the name of the specified tag. If a character of the tag * is not printable, it will be replaced with a question mark. * - * A nullptr-character will be appended to the output buffer. + * A null-character will be appended to the output buffer. * * This routine assumes the specified character buffer is at least 5 characters * in length. @@ -171,7 +171,7 @@ inline void ConvertTagToString(Tag tag, char *buffer) { int i, j, ch; - DEBUG_FATAL(!buffer, ("buffer is nullptr")); + DEBUG_FATAL(!buffer, ("buffer is null")); for (i = 0, j = 24; i < 4; ++i, j -= 8) { diff --git a/engine/shared/library/sharedFoundation/src/shared/Watcher.cpp b/engine/shared/library/sharedFoundation/src/shared/Watcher.cpp index c56201a6..3ca86728 100755 --- a/engine/shared/library/sharedFoundation/src/shared/Watcher.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/Watcher.cpp @@ -82,7 +82,7 @@ void WatchedByList::install() /** * Destroy a WatchedByList. * - * All watchers currently watching the owner of this object will be reset to nullptr. + * All watchers currently watching the owner of this object will be reset to NULL. */ WatchedByList::~WatchedByList() @@ -92,7 +92,7 @@ WatchedByList::~WatchedByList() if (m_list) { deleteList(m_list); - m_list = nullptr; + m_list = NULL; } } diff --git a/engine/shared/library/sharedFoundation/src/shared/Watcher.h b/engine/shared/library/sharedFoundation/src/shared/Watcher.h index 921b91d5..ca637a79 100755 --- a/engine/shared/library/sharedFoundation/src/shared/Watcher.h +++ b/engine/shared/library/sharedFoundation/src/shared/Watcher.h @@ -8,7 +8,7 @@ // @todo How do I get this into doxygen? It's information that really spans multiple classes // // The Watcher system allows pointers to objects to be automatically -// reset to nullptr when the object watching them is destoyed. +// reset to NULL when the object watching them is destoyed. // // For something to be watchable, it must provide a routine of the form: // @@ -66,7 +66,7 @@ class Watcher : public BaseWatcher { public: - explicit Watcher(T *data=nullptr); + explicit Watcher(T *data=NULL); Watcher(const Watcher &newValue); ~Watcher(); //lint !e1509 // Warning -- base class destructor for class is not virtual @@ -96,7 +96,7 @@ class ConstWatcher : public BaseWatcher { public: - explicit ConstWatcher(const T *data=nullptr); + explicit ConstWatcher(const T *data=NULL); ConstWatcher(const ConstWatcher &newValue); ~ConstWatcher(); //lint !e1509 // Warning -- base class destructor for class is not virtual @@ -177,7 +177,7 @@ inline BaseWatcher::BaseWatcher(void *data) inline void BaseWatcher::reset() { - m_data = nullptr; + m_data = NULL; } // ---------------------------------------------------------------------- @@ -190,7 +190,7 @@ inline void BaseWatcher::reset() inline BaseWatcher::~BaseWatcher() { - m_data = nullptr; + m_data = NULL; } // ---------------------------------------------------------------------- @@ -593,11 +593,11 @@ inline const T *ConstWatcher::operator ->() const /** * Construct a WatchedByList. * - * This list of watchers remains nullptr until someone first watches the object. + * This list of watchers remains NULL until someone first watches the object. */ inline WatchedByList::WatchedByList() -: m_list(nullptr) +: m_list(NULL) { } diff --git a/engine/shared/library/sharedFoundation/src/shared/dynamicVariable/DynamicVariable.cpp b/engine/shared/library/sharedFoundation/src/shared/dynamicVariable/DynamicVariable.cpp index ada9369f..f11c603e 100755 --- a/engine/shared/library/sharedFoundation/src/shared/dynamicVariable/DynamicVariable.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/dynamicVariable/DynamicVariable.cpp @@ -106,8 +106,8 @@ m_value(), m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = nullptr; - m_cachedValue[1] = nullptr; + m_cachedValue[0] = NULL; + m_cachedValue[1] = NULL; } // ---------------------------------------------------------------------- @@ -131,8 +131,8 @@ DynamicVariable::DynamicVariable(const DynamicVariable &rhs) : m_position(rhs.m_position), m_cachedValueDirty(true) { - m_cachedValue[0] = nullptr; - m_cachedValue[1] = nullptr; + m_cachedValue[0] = NULL; + m_cachedValue[1] = NULL; } // ---------------------------------------------------------------------- @@ -158,8 +158,8 @@ DynamicVariable& DynamicVariable::operator=(const DynamicVariable &rhs) (*f)(m_cachedValue[0]); } - m_cachedValue[0] = nullptr; - m_cachedValue[1] = nullptr; + m_cachedValue[0] = NULL; + m_cachedValue[1] = NULL; } } @@ -201,8 +201,8 @@ void DynamicVariable::load(int position, int typeId, const Unicode::String &pack (*f)(m_cachedValue[0]); } - m_cachedValue[0] = nullptr; - m_cachedValue[1] = nullptr; + m_cachedValue[0] = NULL; + m_cachedValue[1] = NULL; } } @@ -235,8 +235,8 @@ DynamicVariable::DynamicVariable(int value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = nullptr; - m_cachedValue[1] = nullptr; + m_cachedValue[0] = NULL; + m_cachedValue[1] = NULL; pack(value, m_value); } @@ -249,8 +249,8 @@ DynamicVariable::DynamicVariable(const std::vector & value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = nullptr; - m_cachedValue[1] = nullptr; + m_cachedValue[0] = NULL; + m_cachedValue[1] = NULL; pack(value, m_value); } @@ -263,8 +263,8 @@ DynamicVariable::DynamicVariable(float value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = nullptr; - m_cachedValue[1] = nullptr; + m_cachedValue[0] = NULL; + m_cachedValue[1] = NULL; pack(value, m_value); } @@ -277,8 +277,8 @@ DynamicVariable::DynamicVariable(const std::vector & value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = nullptr; - m_cachedValue[1] = nullptr; + m_cachedValue[0] = NULL; + m_cachedValue[1] = NULL; pack(value, m_value); } @@ -291,8 +291,8 @@ DynamicVariable::DynamicVariable(const Unicode::String &value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = nullptr; - m_cachedValue[1] = nullptr; + m_cachedValue[0] = NULL; + m_cachedValue[1] = NULL; } // ---------------------------------------------------------------------- @@ -303,8 +303,8 @@ DynamicVariable::DynamicVariable(const std::string &value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = nullptr; - m_cachedValue[1] = nullptr; + m_cachedValue[0] = NULL; + m_cachedValue[1] = NULL; } // ---------------------------------------------------------------------- @@ -315,8 +315,8 @@ DynamicVariable::DynamicVariable(const std::vector & value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = nullptr; - m_cachedValue[1] = nullptr; + m_cachedValue[0] = NULL; + m_cachedValue[1] = NULL; pack(value, m_value); } @@ -329,8 +329,8 @@ DynamicVariable::DynamicVariable(const NetworkId & value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = nullptr; - m_cachedValue[1] = nullptr; + m_cachedValue[0] = NULL; + m_cachedValue[1] = NULL; } // ---------------------------------------------------------------------- @@ -341,8 +341,8 @@ DynamicVariable::DynamicVariable(const std::vector & value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = nullptr; - m_cachedValue[1] = nullptr; + m_cachedValue[0] = NULL; + m_cachedValue[1] = NULL; pack(value, m_value); } @@ -355,8 +355,8 @@ DynamicVariable::DynamicVariable(const DynamicVariableLocationData & value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = nullptr; - m_cachedValue[1] = nullptr; + m_cachedValue[0] = NULL; + m_cachedValue[1] = NULL; pack(value, m_value); } @@ -369,8 +369,8 @@ DynamicVariable::DynamicVariable(const std::vector m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = nullptr; - m_cachedValue[1] = nullptr; + m_cachedValue[0] = NULL; + m_cachedValue[1] = NULL; pack(value, m_value); } @@ -383,8 +383,8 @@ DynamicVariable::DynamicVariable(const StringId &value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = nullptr; - m_cachedValue[1] = nullptr; + m_cachedValue[0] = NULL; + m_cachedValue[1] = NULL; } // ---------------------------------------------------------------------- @@ -395,8 +395,8 @@ DynamicVariable::DynamicVariable(const std::vector &value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = nullptr; - m_cachedValue[1] = nullptr; + m_cachedValue[0] = NULL; + m_cachedValue[1] = NULL; pack(value, m_value); } @@ -409,8 +409,8 @@ DynamicVariable::DynamicVariable(const Transform &value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = nullptr; - m_cachedValue[1] = nullptr; + m_cachedValue[0] = NULL; + m_cachedValue[1] = NULL; pack(value, m_value); } @@ -423,8 +423,8 @@ DynamicVariable::DynamicVariable(const std::vector &value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = nullptr; - m_cachedValue[1] = nullptr; + m_cachedValue[0] = NULL; + m_cachedValue[1] = NULL; pack(value, m_value); } @@ -437,8 +437,8 @@ DynamicVariable::DynamicVariable(const Vector &value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = nullptr; - m_cachedValue[1] = nullptr; + m_cachedValue[0] = NULL; + m_cachedValue[1] = NULL; pack(value, m_value); } @@ -451,8 +451,8 @@ DynamicVariable::DynamicVariable(const std::vector &value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = nullptr; - m_cachedValue[1] = nullptr; + m_cachedValue[0] = NULL; + m_cachedValue[1] = NULL; pack(value, m_value); } @@ -786,7 +786,7 @@ bool DynamicVariable::get(DynamicVariableLocationData & value) const char tempCell[BUFSIZE]; std::string data(Unicode::wideToNarrow(m_value)); const char * bufptrStart = data.c_str(); - char * bufptrEnd = nullptr; + char * bufptrEnd = NULL; cachedValue.pos.x = static_cast(strtod(bufptrStart, &bufptrEnd)); bufptrStart = bufptrEnd; while (*bufptrStart != '\0' && isspace(*bufptrStart)) @@ -811,7 +811,7 @@ bool DynamicVariable::get(DynamicVariableLocationData & value) const while (*bufptrStart != '\0' && isspace(*bufptrStart)) ++bufptrStart; bufptrEnd = const_cast(strchr(bufptrStart, ' ')); - if (bufptrEnd == nullptr || bufptrEnd - bufptrStart >= BUFSIZE) + if (bufptrEnd == NULL || bufptrEnd - bufptrStart >= BUFSIZE) { WARNING_STRICT_FATAL(true, ("DynamicVariable::get location buffer overflow in scene")); return false; @@ -875,7 +875,7 @@ bool DynamicVariable::get(std::vector & value) cons char tempCell[BUFSIZE]; const char * bufptrStart = buffer; - char * bufptrEnd = nullptr; + char * bufptrEnd = NULL; temp.pos.x = static_cast(strtod(bufptrStart, &bufptrEnd)); bufptrStart = bufptrEnd; while (*bufptrStart != '\0' && isspace(*bufptrStart)) @@ -900,7 +900,7 @@ bool DynamicVariable::get(std::vector & value) cons while (*bufptrStart != '\0' && isspace(*bufptrStart)) ++bufptrStart; bufptrEnd = const_cast(strchr(bufptrStart, ' ')); - if (bufptrEnd == nullptr || bufptrEnd - bufptrStart >= BUFSIZE) + if (bufptrEnd == NULL || bufptrEnd - bufptrStart >= BUFSIZE) { WARNING_STRICT_FATAL(true, ("DynamicVariable::get location array buffer overflow in scene")); return false; @@ -1430,8 +1430,8 @@ namespace Archive (*f)(target.m_cachedValue[0]); } - target.m_cachedValue[0] = nullptr; - target.m_cachedValue[1] = nullptr; + target.m_cachedValue[0] = NULL; + target.m_cachedValue[1] = NULL; } } diff --git a/engine/shared/library/sharedFoundation/src/shared/dynamicVariable/DynamicVariable.h b/engine/shared/library/sharedFoundation/src/shared/dynamicVariable/DynamicVariable.h index c69588ba..004de6fc 100755 --- a/engine/shared/library/sharedFoundation/src/shared/dynamicVariable/DynamicVariable.h +++ b/engine/shared/library/sharedFoundation/src/shared/dynamicVariable/DynamicVariable.h @@ -150,8 +150,8 @@ private: // caching the value so we don't constantly convert them from the string representation // // if the value can fit in m_cachedValue, we directly store it there - // int uses m_cachedValue[0], m_cachedValue[1] = nullptr - // float uses m_cachedValue[0], m_cachedValue[1] = nullptr + // int uses m_cachedValue[0], m_cachedValue[1] = NULL + // float uses m_cachedValue[0], m_cachedValue[1] = NULL // NetworkId uses both m_cachedValue[0] and m_cachedValue[1] // // if not, we allocate storage for the value and store the pointer to it diff --git a/engine/shared/library/sharedGame/src/shared/appearance/WearableAppearanceMap.cpp b/engine/shared/library/sharedGame/src/shared/appearance/WearableAppearanceMap.cpp index 5b7e478f..63d98b04 100755 --- a/engine/shared/library/sharedGame/src/shared/appearance/WearableAppearanceMap.cpp +++ b/engine/shared/library/sharedGame/src/shared/appearance/WearableAppearanceMap.cpp @@ -155,9 +155,9 @@ WearableAppearanceMapNamespace::PersistentMapEntry::PersistentMapEntry(char cons MapEntry(), m_sourceWearableAppearanceName(sourceWearableAppearanceName, true), m_wearerAppearanceName(wearerAppearanceName, true), - m_mappedWearableAppearanceName(nullptr) + m_mappedWearableAppearanceName(NULL) { - if (mappedWearableAppearanceName != nullptr) + if (mappedWearableAppearanceName != NULL) m_mappedWearableAppearanceName = new PersistentCrcString(mappedWearableAppearanceName, true); } @@ -218,7 +218,7 @@ CrcString const &WearableAppearanceMapNamespace::TemporaryMapEntry::getWearerApp CrcString const *WearableAppearanceMapNamespace::TemporaryMapEntry::getMappedWearableAppearanceName() const { - return nullptr; + return NULL; } // ====================================================================== @@ -297,7 +297,7 @@ void WearableAppearanceMapNamespace::loadTableData(char const *filename) std::string const &mappedWearableAppearanceName = table->getStringValue(mappedWearableAppearanceNameColumnNumber, rowIndex); //-- Create map entry, add to vector. - s_mapEntries.push_back(new PersistentMapEntry(sourceWearableAppearanceName.c_str(), wearerAppearanceName.c_str(), (mappedWearableAppearanceName == cs_forbiddenWearableCellContents) ? nullptr : mappedWearableAppearanceName.c_str())); + s_mapEntries.push_back(new PersistentMapEntry(sourceWearableAppearanceName.c_str(), wearerAppearanceName.c_str(), (mappedWearableAppearanceName == cs_forbiddenWearableCellContents) ? NULL : mappedWearableAppearanceName.c_str())); } DataTableManager::close(filename); @@ -388,7 +388,7 @@ WearableAppearanceMap::MapResult WearableAppearanceMap::getMapResultForWearableA if (findResult.first == findResult.second) { // We have no mapping for this entry. That implies the source wearable appearance name can be used as is. - return MapResult(false, false, nullptr); + return MapResult(false, false, NULL); } else { @@ -398,7 +398,7 @@ WearableAppearanceMap::MapResult WearableAppearanceMap::getMapResultForWearableA // We have a mapping. Return it. CrcString const *const mappedWearableAppearanceName = mapEntry->getMappedWearableAppearanceName(); - return MapResult(true, mappedWearableAppearanceName == nullptr, mappedWearableAppearanceName); + return MapResult(true, mappedWearableAppearanceName == NULL, mappedWearableAppearanceName); } } diff --git a/engine/shared/library/sharedGame/src/shared/collision/CollisionCallbackManager.cpp b/engine/shared/library/sharedGame/src/shared/collision/CollisionCallbackManager.cpp index 89f58b9a..fc8d7b13 100755 --- a/engine/shared/library/sharedGame/src/shared/collision/CollisionCallbackManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/collision/CollisionCallbackManager.cpp @@ -279,8 +279,8 @@ bool CollisionCallbackManager::intersectAndReflectWithTerrain(Object * const obj void CollisionCallbackManagerNamespace::noCollisionDetectionThisFrame(Object * const object) { - FATAL(!ms_convertObjectToIndex, ("CollisionCallbackManagerNamespace::noCollisionDetectionThisFrame: ms_convertObjectToIndex == nullptr.")); - FATAL(!object, ("CollisionCallbackManagerNamespace::noCollisionDetectionThisFrame: object == nullptr.")); + FATAL(!ms_convertObjectToIndex, ("CollisionCallbackManagerNamespace::noCollisionDetectionThisFrame: ms_convertObjectToIndex == NULL.")); + FATAL(!object, ("CollisionCallbackManagerNamespace::noCollisionDetectionThisFrame: object == NULL.")); int const index = ms_convertObjectToIndex(object); @@ -298,9 +298,9 @@ void CollisionCallbackManagerNamespace::noCollisionDetectionThisFrame(Object * c bool CollisionCallbackManagerNamespace::collisionDetectionOnHit(Object * const object, Object * const wasHitByThisObject) { - FATAL(!ms_convertObjectToIndex, ("CollisionCallbackManagerNamespace::collisionDetectionOnHit: ms_convertObjectToIndex == nullptr.")); - FATAL(!object, ("CollisionCallbackManagerNamespace::collisionDetectionOnHit: object == nullptr.")); - FATAL(!wasHitByThisObject, ("CollisionCallbackManagerNamespace::collisionDetectionOnHit: wasHitByThisObject == nullptr.")); + FATAL(!ms_convertObjectToIndex, ("CollisionCallbackManagerNamespace::collisionDetectionOnHit: ms_convertObjectToIndex == NULL.")); + FATAL(!object, ("CollisionCallbackManagerNamespace::collisionDetectionOnHit: object == NULL.")); + FATAL(!wasHitByThisObject, ("CollisionCallbackManagerNamespace::collisionDetectionOnHit: wasHitByThisObject == NULL.")); CollisionCallbackManager::OnHitByObjectFunction function = 0; diff --git a/engine/shared/library/sharedGame/src/shared/core/AiDebugString.cpp b/engine/shared/library/sharedGame/src/shared/core/AiDebugString.cpp index af8d3ef1..544cf1af 100755 --- a/engine/shared/library/sharedGame/src/shared/core/AiDebugString.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/AiDebugString.cpp @@ -69,7 +69,7 @@ AiDebugString::AiDebugString(std::string const & text) Unicode::String const delimiters(Unicode::narrowToWide("`")); Unicode::UnicodeStringVector result; - if (Unicode::tokenize(Unicode::narrowToWide(text), result, &delimiters, nullptr)) + if (Unicode::tokenize(Unicode::narrowToWide(text), result, &delimiters, NULL)) { Unicode::UnicodeStringVector::const_iterator iterStringVector = result.begin(); diff --git a/engine/shared/library/sharedGame/src/shared/core/AssetCustomizationManager.cpp b/engine/shared/library/sharedGame/src/shared/core/AssetCustomizationManager.cpp index 88432113..34acdca1 100755 --- a/engine/shared/library/sharedGame/src/shared/core/AssetCustomizationManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/AssetCustomizationManager.cpp @@ -192,31 +192,31 @@ void AssetCustomizationManagerNamespace::remove() s_installed = false; delete [] s_nameDataBlock; - s_nameDataBlock = nullptr; + s_nameDataBlock = NULL; s_nameDataBlockSize = 0; delete [] s_paletteIdNameOffsetMap; - s_paletteIdNameOffsetMap = nullptr; + s_paletteIdNameOffsetMap = NULL; s_maxValidPaletteId = 0; delete [] s_variableIdNameOffsetMap; - s_variableIdNameOffsetMap = nullptr; + s_variableIdNameOffsetMap = NULL; s_maxValidVariableId = 0; delete [] s_defaultValueMap; - s_defaultValueMap = nullptr; + s_defaultValueMap = NULL; s_maxValidDefaultId = 0; delete [] s_intRangeMap; - s_intRangeMap = nullptr; + s_intRangeMap = NULL; s_maxValidIntRangeId = 0; delete [] s_rangeTypeMap; - s_rangeTypeMap = nullptr; + s_rangeTypeMap = NULL; s_maxValidRangeId = 0; delete [] s_variableUsageMap; - s_variableUsageMap = nullptr; + s_variableUsageMap = NULL; s_maxValidVariableUsageId = 0; delete [] s_variableUsageList; @@ -224,19 +224,19 @@ void AssetCustomizationManagerNamespace::remove() s_variableUsageListEntryCount = 0; delete [] s_usageIndex; - s_usageIndex = nullptr; + s_usageIndex = NULL; s_usageIndexEntryCount = 0; delete [] s_linkList; - s_linkList = nullptr; + s_linkList = NULL; s_linkListEntryCount = 0; delete [] s_linkIndex; - s_linkIndex = nullptr; + s_linkIndex = NULL; s_linkIndexEntryCount = 0; delete [] s_crcLookupTable; - s_crcLookupTable = nullptr; + s_crcLookupTable = NULL; s_crcLookupEntryCount = 0; } @@ -488,7 +488,7 @@ int AssetCustomizationManagerNamespace::lookupAssetId(CrcString const &assetName uint32 const key = assetName.getCrc(); CrcLookupEntry const *entry = static_cast(bsearch(&key, s_crcLookupTable, static_cast(s_crcLookupEntryCount), sizeof(CrcLookupEntry), compare_uint32)); - return (entry != nullptr) ? entry->assetId : 0; + return (entry != NULL) ? entry->assetId : 0; } // ---------------------------------------------------------------------- @@ -584,7 +584,7 @@ void AssetCustomizationManagerNamespace::addVariablesForAssetAndLinks(int assetI getRangeTypeInfoFromRangeId(variableUsage->rangeId, isPalette, idForRealType); //-- Create variable based on type. - CustomizationVariable *variable = nullptr; + CustomizationVariable *variable = NULL; if (isPalette) { //-- Get palette. diff --git a/engine/shared/library/sharedGame/src/shared/core/CitizenRankDataTable.cpp b/engine/shared/library/sharedGame/src/shared/core/CitizenRankDataTable.cpp index a5f37664..2edf349d 100755 --- a/engine/shared/library/sharedGame/src/shared/core/CitizenRankDataTable.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/CitizenRankDataTable.cpp @@ -63,7 +63,7 @@ void CitizenRankDataTable::install() FATAL((columnRankSlotId < 0), ("column \"rankSlotId\" not found in %s", cs_citizenRankDataTableName)); FATAL((columnTitle < 0), ("column \"title\" not found in %s", cs_citizenRankDataTableName)); - CitizenRankDataTable::CitizenRank const * currentRank = nullptr; + CitizenRankDataTable::CitizenRank const * currentRank = NULL; int const numRows = table->getNumRows(); std::string rankName, alternateTitle; @@ -199,7 +199,7 @@ CitizenRankDataTable::CitizenRank const * CitizenRankDataTable::getRank(std::str if (iterFind != s_allCitizenRanksByName.end()) return iterFind->second; - return nullptr; + return NULL; } //---------------------------------------------------------------------- @@ -210,7 +210,7 @@ CitizenRankDataTable::CitizenRank const * CitizenRankDataTable::isARankTitle(std if (iterFind != s_allCitizenRanksByTitle.end()) return iterFind->second; - return nullptr; + return NULL; } // ====================================================================== diff --git a/engine/shared/library/sharedGame/src/shared/core/CollectionsDataTable.cpp b/engine/shared/library/sharedGame/src/shared/core/CollectionsDataTable.cpp index f7402fdb..74cc78cc 100755 --- a/engine/shared/library/sharedGame/src/shared/core/CollectionsDataTable.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/CollectionsDataTable.cpp @@ -34,7 +34,7 @@ namespace CollectionsDataTableNamespace // for quick lookup of a slot by begin slot id, we use a vector because // slot id are guaranteed to start at 0 and be contiguous; for counter-type // slot, only the begin slot id index points to the slot; the other slot - // id indices point to nullptr + // id indices point to NULL std::vector s_allSlotsById; // all title(able) slots @@ -232,10 +232,10 @@ void CollectionsDataTable::install() FATAL((columnNoReward < 0), ("column \"noReward\" not found in %s", cs_collectionsDataTableName)); FATAL((columnTrackServerFirst < 0), ("column \"trackServerFirst\" not found in %s", cs_collectionsDataTableName)); - CollectionsDataTable::CollectionInfoBook const * currentBook = nullptr; - CollectionsDataTable::CollectionInfoPage const * currentPage = nullptr; - CollectionsDataTable::CollectionInfoCollection const * currentCollection = nullptr; - CollectionsDataTable::CollectionInfoSlot const * currentSlot = nullptr; + CollectionsDataTable::CollectionInfoBook const * currentBook = NULL; + CollectionsDataTable::CollectionInfoPage const * currentPage = NULL; + CollectionsDataTable::CollectionInfoCollection const * currentCollection = NULL; + CollectionsDataTable::CollectionInfoSlot const * currentSlot = NULL; int const numRows = table->getNumRows(); std::string bookName, pageName, collectionName, slotName, category, prereq, alternateTitle, icon, music; @@ -350,8 +350,8 @@ void CollectionsDataTable::install() FATAL(title, ("%s: book %s cannot be \"titleable\")", cs_collectionsDataTableName, bookName.c_str())); FATAL(!titles.empty(), ("%s: book %s cannot have any alternate titles (books are not \"titleable\")", cs_collectionsDataTableName, bookName.c_str())); currentBook = new CollectionInfoBook(bookName, icon, showIfNotYetEarned, hidden); - currentPage = nullptr; - currentCollection = nullptr; + currentPage = NULL; + currentCollection = NULL; s_allBooks.push_back(currentBook); s_allBooksByName[bookName] = currentBook; } @@ -376,7 +376,7 @@ void CollectionsDataTable::install() // start new page FATAL((!titles.empty() && !title), ("%s: page %s cannot have any alternate titles unless it is defined as \"titleable\")", cs_collectionsDataTableName, pageName.c_str())); currentPage = new CollectionInfoPage(pageName, icon, showIfNotYetEarned, hidden, titles, *currentBook); - currentCollection = nullptr; + currentCollection = NULL; s_pagesInBook[currentBook->name].push_back(currentPage); s_allPagesByName[pageName] = currentPage; @@ -549,7 +549,7 @@ void CollectionsDataTable::install() IGNORE_RETURN(s_slotCategoriesByCollection[currentCollection->name].insert(*iterCategories)); } - currentSlot = nullptr; + currentSlot = NULL; categories.clear(); prereqs.clear(); } @@ -575,7 +575,7 @@ void CollectionsDataTable::install() } // save off all slots ordered by slot ids - s_allSlotsById.resize(allSlotsById.size(), nullptr); + s_allSlotsById.resize(allSlotsById.size(), NULL); beginSlotId = -1; for (std::map::const_iterator iterSlotId = allSlotsById.begin(); iterSlotId != allSlotsById.end(); ++iterSlotId) { @@ -612,7 +612,7 @@ void CollectionsDataTable::install() } else { - s_allSlotsById[iterSlotId->first] = nullptr; + s_allSlotsById[iterSlotId->first] = NULL; } } @@ -733,7 +733,7 @@ CollectionsDataTable::CollectionInfoSlot const * CollectionsDataTable::getSlotBy if (iterFind != s_allSlotsByName.end()) return iterFind->second; - return nullptr; + return NULL; } //---------------------------------------------------------------------- @@ -743,7 +743,7 @@ CollectionsDataTable::CollectionInfoSlot const * CollectionsDataTable::getSlotBy CollectionsDataTable::CollectionInfoSlot const * CollectionsDataTable::getSlotByBeginSlotId(int slotId) { if ((slotId < 0) || (slotId >= static_cast(s_allSlotsById.size()))) - return nullptr; + return NULL; return s_allSlotsById[slotId]; } @@ -763,7 +763,7 @@ CollectionsDataTable::CollectionInfoSlot const * CollectionsDataTable::isASlotTi if (iterFind != s_allSlotTitles.end()) return iterFind->second; - return nullptr; + return NULL; } //---------------------------------------------------------------------- @@ -796,7 +796,7 @@ CollectionsDataTable::CollectionInfoCollection const * CollectionsDataTable::isA if (iterFind != s_allCollectionTitles.end()) return iterFind->second; - return nullptr; + return NULL; } //---------------------------------------------------------------------- @@ -818,7 +818,7 @@ CollectionsDataTable::CollectionInfoCollection const * CollectionsDataTable::get if (iterFind != s_allCollectionsByName.end()) return iterFind->second; - return nullptr; + return NULL; } //---------------------------------------------------------------------- @@ -866,7 +866,7 @@ CollectionsDataTable::CollectionInfoPage const * CollectionsDataTable::isAPageTi if (iterFind != s_allPageTitles.end()) return iterFind->second; - return nullptr; + return NULL; } //---------------------------------------------------------------------- @@ -879,7 +879,7 @@ CollectionsDataTable::CollectionInfoPage const * CollectionsDataTable::getPageBy if (iterFind != s_allPagesByName.end()) return iterFind->second; - return nullptr; + return NULL; } //---------------------------------------------------------------------- @@ -946,7 +946,7 @@ CollectionsDataTable::CollectionInfoBook const * CollectionsDataTable::getBookBy if (iterFind != s_allBooksByName.end()) return iterFind->second; - return nullptr; + return NULL; } //---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedGame/src/shared/core/CommoditiesAdvancedSearchAttribute.cpp b/engine/shared/library/sharedGame/src/shared/core/CommoditiesAdvancedSearchAttribute.cpp index 8c896b4f..585dbd1d 100755 --- a/engine/shared/library/sharedGame/src/shared/core/CommoditiesAdvancedSearchAttribute.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/CommoditiesAdvancedSearchAttribute.cpp @@ -125,7 +125,7 @@ void CommoditiesAdvancedSearchAttribute::install() { // handle search attribute name alias tokens.clear(); - if (Unicode::tokenize(Unicode::narrowToWide(searchAttributeName), tokens, nullptr, nullptr) && (tokens.size() > 1)) + if (Unicode::tokenize(Unicode::narrowToWide(searchAttributeName), tokens, NULL, NULL) && (tokens.size() > 1)) { // the first value is the search attribute name to display searchAttributeName = Unicode::wideToNarrow(tokens[0]); @@ -177,7 +177,7 @@ void CommoditiesAdvancedSearchAttribute::install() { // for enum, parse out the aliases (if any) for the enum value tokens.clear(); - if (Unicode::tokenize(Unicode::narrowToWide(defaultSearchValue), tokens, nullptr, nullptr) && !tokens.empty()) + if (Unicode::tokenize(Unicode::narrowToWide(defaultSearchValue), tokens, NULL, NULL) && !tokens.empty()) { #ifdef _WIN32 #ifdef _DEBUG @@ -340,7 +340,7 @@ CommoditiesAdvancedSearchAttribute::SearchAttribute const * CommoditiesAdvancedS return iterFindAttribute->second; } - return nullptr; + return NULL; } //---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedGame/src/shared/core/CustomizationManager.cpp b/engine/shared/library/sharedGame/src/shared/core/CustomizationManager.cpp index 77dc02eb..051bb14e 100755 --- a/engine/shared/library/sharedGame/src/shared/core/CustomizationManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/CustomizationManager.cpp @@ -441,7 +441,7 @@ CustomizationVariable * CustomizationManager::findVariable (CustomizationData & if(!ms_installed) { DEBUG_FATAL(true, ("CustomizationManager not installed")); - return nullptr; //lint !e527 unreachable (reachable in release) + return NULL; //lint !e527 unreachable (reachable in release) } PathType type = PT_none; @@ -455,7 +455,7 @@ CustomizationVariable * CustomizationManager::findVariable (CustomizationData & if(!ms_installed) { DEBUG_FATAL(true, ("CustomizationManager not installed")); - return nullptr; //lint !e527 unreachable (reachable in release) + return NULL; //lint !e527 unreachable (reachable in release) } type = PT_none; @@ -467,7 +467,7 @@ CustomizationVariable * CustomizationManager::findVariable (CustomizationData & { //if we have the ranged customization variable is a dependent variable, ignore it (there will be another that controls it) if(rangedCV->getIsDependentVariable()) - cv = nullptr; + cv = NULL; } if (!cv) diff --git a/engine/shared/library/sharedGame/src/shared/core/FormManager.cpp b/engine/shared/library/sharedGame/src/shared/core/FormManager.cpp index 789c118a..7074ff4c 100755 --- a/engine/shared/library/sharedGame/src/shared/core/FormManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/FormManager.cpp @@ -81,10 +81,10 @@ FormManager::Field::Field(Form const * const parent) FormManager::Field::~Field() { delete m_choices; - m_choices = nullptr; + m_choices = NULL; delete m_otherValidationRules; - m_otherValidationRules = nullptr; - m_parentForm = nullptr; + m_otherValidationRules = NULL; + m_parentForm = NULL; } //---------------------------------------------------------------------- @@ -453,12 +453,12 @@ FormManager::Form::~Form() { //this vector does NOT own the pointers delete m_orderedFieldList; - m_orderedFieldList = nullptr; + m_orderedFieldList = NULL; //this list owns the pointers, so release it std::for_each(m_fields->begin(), m_fields->end(), PointerDeleterPairSecond()); delete m_fields; - m_fields = nullptr; + m_fields = NULL; } //---------------------------------------------------------------------- @@ -477,7 +477,7 @@ FormManager::Field const * FormManager::Form::getField(std::string const & field if(i != m_fields->end()) return i->second; else - return nullptr; + return NULL; } //---------------------------------------------------------------------- @@ -531,13 +531,13 @@ void FormManager::remove () clearData(); delete ms_forms; - ms_forms = nullptr; + ms_forms = NULL; delete ms_serverObjectTemplateToForms; - ms_serverObjectTemplateToForms = nullptr; + ms_serverObjectTemplateToForms = NULL; delete ms_sharedObjectTemplateToForms; - ms_sharedObjectTemplateToForms = nullptr; + ms_sharedObjectTemplateToForms = NULL; delete ms_automaticallyCreateObjectForServerObjectTemplate; - ms_automaticallyCreateObjectForServerObjectTemplate = nullptr; + ms_automaticallyCreateObjectForServerObjectTemplate = NULL; s_tablesLoaded = false; s_installed = false; @@ -764,13 +764,13 @@ FormManager::Form const * FormManager::getFormByName(std::string const & formNam { DEBUG_FATAL (!s_installed, ("not installed")); if(!s_installed) - return nullptr; + return NULL; std::map::iterator i = ms_forms->find(formName); if(i != ms_forms->end()) return i->second; else - return nullptr; + return NULL; } //---------------------------------------------------------------------- @@ -779,13 +779,13 @@ FormManager::Form const * FormManager::getFormForServerObjectTemplate(std::strin { DEBUG_FATAL (!s_installed, ("not installed")); if(!s_installed) - return nullptr; + return NULL; std::map::iterator i = ms_serverObjectTemplateToForms->find(serverTemplateName); if(i != ms_serverObjectTemplateToForms->end()) return i->second; else - return nullptr; + return NULL; } //---------------------------------------------------------------------- @@ -794,13 +794,13 @@ FormManager::Form const * FormManager::getFormForSharedObjectTemplate(std::strin { DEBUG_FATAL (!s_installed, ("not installed")); if(!s_installed) - return nullptr; + return NULL; std::map::iterator i = ms_sharedObjectTemplateToForms->find(sharedTemplateName); if(i != ms_sharedObjectTemplateToForms->end()) return i->second; else - return nullptr; + return NULL; } //---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedGame/src/shared/core/GameScheduler.cpp b/engine/shared/library/sharedGame/src/shared/core/GameScheduler.cpp index 9ec51701..e0b848ba 100755 --- a/engine/shared/library/sharedGame/src/shared/core/GameScheduler.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/GameScheduler.cpp @@ -74,7 +74,7 @@ void GameScheduler::remove() DEBUG_FATAL(!s_installed, ("GameScheduler not installed.")); delete s_scheduler; - s_scheduler = nullptr; + s_scheduler = NULL; s_installed = false; } diff --git a/engine/shared/library/sharedGame/src/shared/core/GroundZoneManager.cpp b/engine/shared/library/sharedGame/src/shared/core/GroundZoneManager.cpp index ddf2992d..bc38d3e0 100755 --- a/engine/shared/library/sharedGame/src/shared/core/GroundZoneManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/GroundZoneManager.cpp @@ -103,12 +103,12 @@ BuildoutArea const * GroundZoneManager::getZoneName(std::string const & sceneNam if(!SharedBuildoutAreaManager::isBuildoutScene(sceneName)) { - return nullptr; + return NULL; } else { BuildoutArea const * const ba = SharedBuildoutAreaManager::findBuildoutAreaAtPosition(sceneName, location_w.x, location_w.z, true); - if (nullptr != ba) + if (NULL != ba) { if (!ba->compositeName.empty()) zoneName = ba->compositeName; @@ -126,7 +126,7 @@ Vector GroundZoneManager::transformWorldLocationToZoneLocation(std::string const Vector pos_w = location_w; std::string zoneName; BuildoutArea const * const ba = GroundZoneManager::getZoneName(sceneName, location_w, zoneName); - if (nullptr != ba) + if (NULL != ba) { pos_w = ba->getRelativePosition(location_w, true); } diff --git a/engine/shared/library/sharedGame/src/shared/core/GuildRankDataTable.cpp b/engine/shared/library/sharedGame/src/shared/core/GuildRankDataTable.cpp index b5f2c62a..2bd66b99 100755 --- a/engine/shared/library/sharedGame/src/shared/core/GuildRankDataTable.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/GuildRankDataTable.cpp @@ -65,7 +65,7 @@ void GuildRankDataTable::install() FATAL((columnRankSlotId < 0), ("column \"rankSlotId\" not found in %s", cs_guildRankDataTableName)); FATAL((columnTitle < 0), ("column \"title\" not found in %s", cs_guildRankDataTableName)); - GuildRankDataTable::GuildRank const * currentRank = nullptr; + GuildRankDataTable::GuildRank const * currentRank = NULL; int const numRows = table->getNumRows(); std::string rankName, alternateTitle; @@ -207,7 +207,7 @@ GuildRankDataTable::GuildRank const * GuildRankDataTable::getRank(std::string co if (iterFind != s_allGuildRanksByName.end()) return iterFind->second; - return nullptr; + return NULL; } //---------------------------------------------------------------------- @@ -218,7 +218,7 @@ GuildRankDataTable::GuildRank const * GuildRankDataTable::getRankForDisplayRankN if (iterFind != s_allGuildRanksByDisplayName.end()) return iterFind->second; - return nullptr; + return NULL; } //---------------------------------------------------------------------- @@ -229,7 +229,7 @@ GuildRankDataTable::GuildRank const * GuildRankDataTable::isARankTitle(std::stri if (iterFind != s_allGuildRanksByTitle.end()) return iterFind->second; - return nullptr; + return NULL; } // ====================================================================== diff --git a/engine/shared/library/sharedGame/src/shared/core/LfgCharacterData.cpp b/engine/shared/library/sharedGame/src/shared/core/LfgCharacterData.cpp index 3f26cadd..31a0e655 100755 --- a/engine/shared/library/sharedGame/src/shared/core/LfgCharacterData.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/LfgCharacterData.cpp @@ -1127,7 +1127,7 @@ std::map const & LfgCharacterData::calculateStatistics(std::ma } } - int32 const timeNow = static_cast(::time(nullptr)); + int32 const timeNow = static_cast(::time(NULL)); for (std::map::const_iterator iterLfgData = connectedCharacterLfgData.begin(); iterLfgData != connectedCharacterLfgData.end(); ++iterLfgData) { // searchable/anonymous diff --git a/engine/shared/library/sharedGame/src/shared/core/LfgDataTable.cpp b/engine/shared/library/sharedGame/src/shared/core/LfgDataTable.cpp index f7cfb688..6acce604 100755 --- a/engine/shared/library/sharedGame/src/shared/core/LfgDataTable.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/LfgDataTable.cpp @@ -379,10 +379,10 @@ void LfgDataTable::install() unsigned long maxValueForNumBits; std::map names; std::map allSlotsById; - LfgNode * lfgNode = nullptr; - LfgNode * currentTier1Node = nullptr; - LfgNode * currentTier2Node = nullptr; - LfgNode * currentTier3Node = nullptr; + LfgNode * lfgNode = NULL; + LfgNode * currentTier1Node = NULL; + LfgNode * currentTier2Node = NULL; + LfgNode * currentTier3Node = NULL; for (int i = 0; i < numRows; ++i) { @@ -472,15 +472,15 @@ void LfgDataTable::install() FATAL(((minValue > 0) && (maxValueBeginSlotId < 0)), ("%s, row %d: minValueBeginSlotId/minValueEndSlotId/maxValueBeginSlotId/maxValueEndSlotId must be specified if minValue/maxValue is specified", cs_lfgDataTableName, (i+3))); // create a new node - lfgNode = nullptr; + lfgNode = NULL; if (!tier1.empty()) { - lfgNode = new LfgNode(tier1, internalAttribute, minValueBeginSlotId, minValueEndSlotId, maxValueBeginSlotId, maxValueEndSlotId, minValue, maxValue, defaultMatchCondition, nullptr); + lfgNode = new LfgNode(tier1, internalAttribute, minValueBeginSlotId, minValueEndSlotId, maxValueBeginSlotId, maxValueEndSlotId, minValue, maxValue, defaultMatchCondition, NULL); s_topLevelNodes.push_back(lfgNode); currentTier1Node = lfgNode; - currentTier2Node = nullptr; - currentTier3Node = nullptr; + currentTier2Node = NULL; + currentTier3Node = NULL; } else if (!tier2.empty()) { @@ -490,7 +490,7 @@ void LfgDataTable::install() currentTier1Node->children.push_back(lfgNode); currentTier2Node = lfgNode; - currentTier3Node = nullptr; + currentTier3Node = NULL; } else if (!tier3.empty()) { @@ -580,7 +580,7 @@ void LfgDataTable::install() // find out the leaf node's ancestor, if any, that has the Any/All option LfgNode const * parentNode = node.parent; - bool const hasParent = (parentNode != nullptr); + bool const hasParent = (parentNode != NULL); int countParentWithNonNaDefaultMatchCondition = 0; std::string stringParentWithNonNaDefaultMatchCondition; while (parentNode) @@ -670,7 +670,7 @@ LfgDataTable::LfgNode const * LfgDataTable::getLfgNodeByName(std::string const & { std::map::const_iterator iterNode = s_allNodesByName.find(lfgNodeName); if (iterNode == s_allNodesByName.end()) - return nullptr; + return NULL; return iterNode->second; } @@ -681,7 +681,7 @@ LfgDataTable::LfgNode const * LfgDataTable::getLfgLeafNodeByName(std::string con { std::map::const_iterator iterNode = s_allLeafNodesByName.find(lfgNodeName); if (iterNode == s_allLeafNodesByName.end()) - return nullptr; + return NULL; return iterNode->second; } diff --git a/engine/shared/library/sharedGame/src/shared/core/LfgDataTable.h b/engine/shared/library/sharedGame/src/shared/core/LfgDataTable.h index 5ffc3e70..e95f1e85 100755 --- a/engine/shared/library/sharedGame/src/shared/core/LfgDataTable.h +++ b/engine/shared/library/sharedGame/src/shared/core/LfgDataTable.h @@ -47,7 +47,7 @@ public: { public: LfgNode(std::string const & pName, bool pInternalAttribute, int pMinValueBeginSlotId, int pMinValueEndSlotId, int pMaxValueBeginSlotId, int pMaxValueEndSlotId, int pMinValue, int pMaxValue, DefaultMatchConditionType pDefaultMatchCondition, LfgNode const * pParent) : - name(pName), internalAttribute(pInternalAttribute), minValueBeginSlotId(pMinValueBeginSlotId), minValueEndSlotId(pMinValueEndSlotId), maxValueBeginSlotId(pMaxValueBeginSlotId), maxValueEndSlotId(pMaxValueEndSlotId), minValue(pMinValue), maxValue(pMaxValue), defaultMatchCondition(pDefaultMatchCondition), actualMatchCondition(DMCT_NA), parent(pParent), anyAllGroupingParent(nullptr), children(), hasAnyInternalAttributeLeafNodeDescendants(false), hasAnyExternalAttributeLeafNodeDescendants(false), internalAttributeMatchFunction(nullptr) {}; + name(pName), internalAttribute(pInternalAttribute), minValueBeginSlotId(pMinValueBeginSlotId), minValueEndSlotId(pMinValueEndSlotId), maxValueBeginSlotId(pMaxValueBeginSlotId), maxValueEndSlotId(pMaxValueEndSlotId), minValue(pMinValue), maxValue(pMaxValue), defaultMatchCondition(pDefaultMatchCondition), actualMatchCondition(DMCT_NA), parent(pParent), anyAllGroupingParent(NULL), children(), hasAnyInternalAttributeLeafNodeDescendants(false), hasAnyExternalAttributeLeafNodeDescendants(false), internalAttributeMatchFunction(NULL) {}; std::string const name; bool const internalAttribute; diff --git a/engine/shared/library/sharedGame/src/shared/core/PlayerCreationManager.cpp b/engine/shared/library/sharedGame/src/shared/core/PlayerCreationManager.cpp index d089cc2c..24efe09a 100755 --- a/engine/shared/library/sharedGame/src/shared/core/PlayerCreationManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/PlayerCreationManager.cpp @@ -530,9 +530,9 @@ void PlayerCreationManager::buildRacialMinsMaxes() const DataTable * dt = DataTableManager::getTable( "datatables/creation/attribute_limits.iff", true); - WARNING_STRICT_FATAL(dt == nullptr, ("Unable to read the " + WARNING_STRICT_FATAL(dt == NULL, ("Unable to read the " "attribute_limits datatable")); - if (dt == nullptr) + if (dt == NULL) return; int numAttribs = dt->getNumColumns() - 1; diff --git a/engine/shared/library/sharedGame/src/shared/core/SharedBuffBuilderManager.cpp b/engine/shared/library/sharedGame/src/shared/core/SharedBuffBuilderManager.cpp index a9edcafd..40e7ffb8 100755 --- a/engine/shared/library/sharedGame/src/shared/core/SharedBuffBuilderManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/SharedBuffBuilderManager.cpp @@ -29,7 +29,7 @@ namespace SharedBuffBuilderManagerNamespace const std::string ms_reactiveSecondChanceComponentName = "reactive_second_chance"; } -SharedBuffBuilderManager::BuffBuilderDataType * SharedBuffBuilderManager::ms_buffBuilderData=nullptr; +SharedBuffBuilderManager::BuffBuilderDataType * SharedBuffBuilderManager::ms_buffBuilderData=NULL; using namespace SharedBuffBuilderManagerNamespace; // ====================================================================== diff --git a/engine/shared/library/sharedGame/src/shared/core/SharedBuildoutAreaManager.cpp b/engine/shared/library/sharedGame/src/shared/core/SharedBuildoutAreaManager.cpp index 5786d3e6..cec5ff33 100755 --- a/engine/shared/library/sharedGame/src/shared/core/SharedBuildoutAreaManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/SharedBuildoutAreaManager.cpp @@ -321,7 +321,7 @@ std::string SharedBuildoutAreaManager::getBuildoutNameForPosition(std::string co { BuildoutArea const * const ba = findBuildoutAreaAtPosition(sceneName, location_w.x, location_w.z, ignoreInternal, ignoreNonActiveEvents); - if (nullptr != ba) + if (NULL != ba) return sceneName + cms_sceneAndAreaDelimeter + ba->areaName; return sceneName; @@ -537,7 +537,7 @@ SharedBuildoutAreaManager::BuildoutAreaVector const * SharedBuildoutAreaManager: { return &it->second; } - return nullptr; + return NULL; } //---------------------------------------------------------------------- @@ -546,8 +546,8 @@ BuildoutArea const * SharedBuildoutAreaManager::findBuildoutAreaAtPosition(std:: { BuildoutAreaVector const * const bav = findBuildoutAreasForScene(sceneId); - if (nullptr == bav) - return nullptr; + if (NULL == bav) + return NULL; for (BuildoutAreaVector::const_iterator it = bav->begin(); it != bav->end(); ++it) { @@ -567,7 +567,7 @@ BuildoutArea const * SharedBuildoutAreaManager::findBuildoutAreaAtPosition(std:: } } - return nullptr; + return NULL; } //---------------------------------------------------------------------- @@ -579,11 +579,11 @@ BuildoutArea const * SharedBuildoutAreaManager::findBuildoutAreaAtPosition(float if (ignoreInternal && buildoutArea.internalBuildoutArea) { - return nullptr; + return NULL; } if(ignoreNonActiveEvents && !buildoutArea.requiredEventName.empty()) - return nullptr; + return NULL; if (buildoutArea.isLocationInside(x, z)) { @@ -591,7 +591,7 @@ BuildoutArea const * SharedBuildoutAreaManager::findBuildoutAreaAtPosition(float } } - return nullptr; + return NULL; } //---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedGame/src/shared/core/SharedImageDesignerManager.cpp b/engine/shared/library/sharedGame/src/shared/core/SharedImageDesignerManager.cpp index c0ee57fa..62e46247 100755 --- a/engine/shared/library/sharedGame/src/shared/core/SharedImageDesignerManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/SharedImageDesignerManager.cpp @@ -358,7 +358,7 @@ bool SharedImageDesignerManager::isSessionValid(SharedImageDesignerManager::Sess if(customizationDataHair) customizationDataForThisCustomization = customizationDataHair; else - customizationDataForThisCustomization = nullptr; + customizationDataForThisCustomization = NULL; } if(customizationDataForThisCustomization) diff --git a/engine/shared/library/sharedGame/src/shared/core/Universe.cpp b/engine/shared/library/sharedGame/src/shared/core/Universe.cpp index 60eeba1e..5d5186d4 100755 --- a/engine/shared/library/sharedGame/src/shared/core/Universe.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/Universe.cpp @@ -17,14 +17,14 @@ // ====================================================================== -Universe * Universe::ms_theInstance = nullptr; +Universe * Universe::ms_theInstance = NULL; bool Universe::ms_installed = false; //=================================================================== void Universe::installDerived(Universe *derivedInstance) { - DEBUG_FATAL(ms_installed || ms_theInstance!=nullptr,("Installed Universe twice.\n")); + DEBUG_FATAL(ms_installed || ms_theInstance!=NULL,("Installed Universe twice.\n")); ms_theInstance = derivedInstance; ms_installed = true; @@ -43,7 +43,7 @@ void Universe::remove() Universe::Universe() : m_resourceClassNameMap (new ResourceClassNameMap), m_resourceClassNameCrcMap (new ResourceClassNameCrcMap), - m_resourceTreeRoot (nullptr) + m_resourceTreeRoot (NULL) { ResourceClassObject::install(); // sets up some static strings used by the import process } diff --git a/engine/shared/library/sharedGame/src/shared/core/WearableEntry.cpp b/engine/shared/library/sharedGame/src/shared/core/WearableEntry.cpp index f0c9912a..767c20f4 100755 --- a/engine/shared/library/sharedGame/src/shared/core/WearableEntry.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/WearableEntry.cpp @@ -103,7 +103,7 @@ namespace Archive put(target, source.m_networkId); put(target, source.m_objectTemplate); - bool isWeapon = (source.m_weaponSharedBaselines.get() != nullptr); + bool isWeapon = (source.m_weaponSharedBaselines.get() != NULL); put(target, isWeapon); if (isWeapon) { diff --git a/engine/shared/library/sharedGame/src/shared/mount/MountValidScaleRangeTable.cpp b/engine/shared/library/sharedGame/src/shared/mount/MountValidScaleRangeTable.cpp index 4a4139a9..775c8119 100755 --- a/engine/shared/library/sharedGame/src/shared/mount/MountValidScaleRangeTable.cpp +++ b/engine/shared/library/sharedGame/src/shared/mount/MountValidScaleRangeTable.cpp @@ -248,7 +248,7 @@ void MountValidScaleRangeTableNamespace::loadTableData(char const *filename) TemporaryCrcString const mountableCreatureAppearanceNameCrc(mountableCreatureAppearanceName.c_str(), true); //-- Find or create new MountableCreature instance for this creature name. - MountableCreature *mountableCreature = nullptr; + MountableCreature *mountableCreature = NULL; MountableCreatureTable::iterator lowerBoundIt = s_mountableCreatureTable.lower_bound((const CrcString*)&mountableCreatureAppearanceNameCrc); bool const mountableCreatureEntryExists = ((lowerBoundIt != s_mountableCreatureTable.end()) && !s_mountableCreatureTable.key_comp()(static_cast(&mountableCreatureAppearanceNameCrc), lowerBoundIt->first)); @@ -289,7 +289,7 @@ MountValidScaleRangeTableNamespace::MountableCreature const *MountValidScaleRang else { DEBUG_WARNING(true, ("'datatables/mount/valid_scale_range.iff' missing entry for creature appearance name '%s'", creatureAppearanceName.getString())); - return nullptr; + return NULL; } } diff --git a/engine/shared/library/sharedGame/src/shared/mount/SharedSaddleManager.cpp b/engine/shared/library/sharedGame/src/shared/mount/SharedSaddleManager.cpp index 083ed7c5..5c2de639 100755 --- a/engine/shared/library/sharedGame/src/shared/mount/SharedSaddleManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/mount/SharedSaddleManager.cpp @@ -433,7 +433,7 @@ int SharedSaddleManagerNamespace::TemporaryRiderPoseMapEntry::getRiderSeatIndex( CrcString const *SharedSaddleManagerNamespace::TemporaryRiderPoseMapEntry::getRiderPoseName() const { - return nullptr; + return NULL; } // ====================================================================== diff --git a/engine/shared/library/sharedGame/src/shared/object/ResourceClassObject.cpp b/engine/shared/library/sharedGame/src/shared/object/ResourceClassObject.cpp index 46293784..71d3696c 100755 --- a/engine/shared/library/sharedGame/src/shared/object/ResourceClassObject.cpp +++ b/engine/shared/library/sharedGame/src/shared/object/ResourceClassObject.cpp @@ -39,8 +39,8 @@ using namespace ResourceClassObjectNamespace; ResourceClassObject::ResourceClassObject() : m_resourceClassName(), - m_parentClass(nullptr), - m_friendlyName(nullptr), + m_parentClass(NULL), + m_friendlyName(NULL), m_minTypes(0), m_maxTypes(0), m_minPools(0), @@ -49,7 +49,7 @@ ResourceClassObject::ResourceClassObject() : m_nameTable(), m_recycled(false), m_permanent(false), - m_recycledVersion(nullptr), + m_recycledVersion(NULL), m_resourceAttributeRanges(new ResourceAttributeRangesType()), m_children(new ClassList) { @@ -60,18 +60,18 @@ ResourceClassObject::ResourceClassObject() : ResourceClassObject::~ResourceClassObject() { delete m_children; - m_children = nullptr; + m_children = NULL; delete m_resourceAttributeRanges; - m_resourceAttributeRanges = nullptr; + m_resourceAttributeRanges = NULL; - m_parentClass = nullptr; - m_recycledVersion = nullptr; + m_parentClass = NULL; + m_recycledVersion = NULL; - if (m_friendlyName != nullptr) + if (m_friendlyName != NULL) { delete m_friendlyName; - m_friendlyName = nullptr; + m_friendlyName = NULL; } } @@ -254,7 +254,7 @@ ResourceClassObject::ResourceAttributeRangesType const & ResourceClassObject::ge { static const ResourceAttributeRangesType emptyRanges; - if (m_resourceAttributeRanges != nullptr) + if (m_resourceAttributeRanges != NULL) return *m_resourceAttributeRanges; return emptyRanges; } @@ -304,7 +304,7 @@ void ResourceClassObject::loadTreeFromIff() int numRows = resourceDataTable->getNumRows(); ResourceClassObject * parents[8]; for (int i=0; i<8; ++i) - parents[i]=nullptr; + parents[i]=NULL; static const std::string colName_resourceClassName = "ENUM"; static const std::string colName_maxTypes = "Maximum # types"; @@ -334,7 +334,7 @@ void ResourceClassObject::loadTreeFromIff() if (possibleName.size()!=0) { if (wheresTheName==0) - newClass->m_parentClass = nullptr; + newClass->m_parentClass = NULL; else { newClass->m_parentClass = parents[wheresTheName-1]; @@ -438,12 +438,12 @@ bool ResourceClassObject::isLeaf() const void ResourceClassObject::getChildren(std::vector & children, bool recurse) const { - if (m_children == nullptr) + if (m_children == NULL) return; for (ClassList::const_iterator i = m_children->begin(); i != m_children->end(); ++i) { - if (*i != nullptr) + if (*i != NULL) { children.push_back(*i); if (recurse) @@ -456,12 +456,12 @@ void ResourceClassObject::getChildren(std::vector & void ResourceClassObject::getLeafChildren(std::vector & children) const { - if (m_children == nullptr) + if (m_children == NULL) return; for (ClassList::const_iterator i = m_children->begin(); i != m_children->end(); ++i) { - if (*i != nullptr) + if (*i != NULL) { if ((*i)->isLeaf()) children.push_back(*i); @@ -493,7 +493,7 @@ ResourceClassObject const * ResourceClassObject::getRecycledVersion() const return m_recycledVersion; else if (m_parentClass) return m_parentClass->getRecycledVersion(); - else return nullptr; + else return NULL; } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedGame/src/shared/object/ResourceClassObject.h b/engine/shared/library/sharedGame/src/shared/object/ResourceClassObject.h index 1361de6e..16de81e8 100755 --- a/engine/shared/library/sharedGame/src/shared/object/ResourceClassObject.h +++ b/engine/shared/library/sharedGame/src/shared/object/ResourceClassObject.h @@ -118,7 +118,7 @@ inline const StringId & ResourceClassObject::getFriendlyName () const inline bool ResourceClassObject::isRoot() const { - return (m_parentClass == nullptr); + return (m_parentClass == NULL); } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedGame/src/shared/object/Waypoint.cpp b/engine/shared/library/sharedGame/src/shared/object/Waypoint.cpp index 74f3f8ba..08cc4479 100755 --- a/engine/shared/library/sharedGame/src/shared/object/Waypoint.cpp +++ b/engine/shared/library/sharedGame/src/shared/object/Waypoint.cpp @@ -160,7 +160,7 @@ WaypointDataBase::WaypointDataBase() : void WaypointDataBase::setName(Unicode::String const &name) { //This magical number (250) is chosen because the waypoint datatable has VARCHAR2(512) in this column, - //and we're assuming 2 bytes per char (which is not quite true actually) plus an extra one for nullptr plus + //and we're assuming 2 bytes per char (which is not quite true actually) plus an extra one for null plus //a few extra for good measure and because nobody needs 251-character waypoint names. if (name.length() > 250) { diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBattlefieldMarkerObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBattlefieldMarkerObjectTemplate.cpp index a83d8b7f..9e973c36 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBattlefieldMarkerObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBattlefieldMarkerObjectTemplate.cpp @@ -95,10 +95,10 @@ Tag SharedBattlefieldMarkerObjectTemplate::getTemplateVersion(void) const */ Tag SharedBattlefieldMarkerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedBattlefieldMarkerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedBattlefieldMarkerObjectTemplate::getHighestTemplateVersion @@ -112,26 +112,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedBattlefieldMarkerObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedBattlefieldMarkerObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getNumberOfPoles(true); #endif } if (!m_numberOfPoles.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter numberOfPoles in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter numberOfPoles has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter numberOfPoles has not been defined in template %s!", DataResource::getName())); return base->getNumberOfPoles(); } } @@ -141,9 +141,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getNumberOfPoles(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -160,7 +160,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -176,26 +176,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedBattlefieldMarkerObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedBattlefieldMarkerObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getNumberOfPolesMin(true); #endif } if (!m_numberOfPoles.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter numberOfPoles in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter numberOfPoles has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter numberOfPoles has not been defined in template %s!", DataResource::getName())); return base->getNumberOfPolesMin(); } } @@ -205,9 +205,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getNumberOfPolesMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -224,7 +224,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -240,26 +240,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedBattlefieldMarkerObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedBattlefieldMarkerObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getNumberOfPolesMax(true); #endif } if (!m_numberOfPoles.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter numberOfPoles in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter numberOfPoles has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter numberOfPoles has not been defined in template %s!", DataResource::getName())); return base->getNumberOfPolesMax(); } } @@ -269,9 +269,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getNumberOfPolesMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -288,7 +288,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -304,26 +304,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedBattlefieldMarkerObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedBattlefieldMarkerObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getRadius(true); #endif } if (!m_radius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter radius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter radius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter radius has not been defined in template %s!", DataResource::getName())); return base->getRadius(); } } @@ -333,9 +333,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getRadius(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -352,7 +352,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -368,26 +368,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedBattlefieldMarkerObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedBattlefieldMarkerObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getRadiusMin(true); #endif } if (!m_radius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter radius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter radius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter radius has not been defined in template %s!", DataResource::getName())); return base->getRadiusMin(); } } @@ -397,9 +397,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getRadiusMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -416,7 +416,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -432,26 +432,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedBattlefieldMarkerObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedBattlefieldMarkerObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getRadiusMax(true); #endif } if (!m_radius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter radius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter radius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter radius has not been defined in template %s!", DataResource::getName())); return base->getRadiusMax(); } } @@ -461,9 +461,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getRadiusMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -480,7 +480,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -529,12 +529,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBuildingObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBuildingObjectTemplate.cpp index 89b64952..793143b0 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBuildingObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBuildingObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedBuildingObjectTemplate::getTemplateVersion(void) const */ Tag SharedBuildingObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedBuildingObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedBuildingObjectTemplate::getHighestTemplateVersion @@ -111,33 +111,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedBuildingObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedBuildingObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getTerrainModificationFileName(true); #endif } if (!m_terrainModificationFileName.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter terrainModificationFileName in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter terrainModificationFileName has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter terrainModificationFileName has not been defined in template %s!", DataResource::getName())); return base->getTerrainModificationFileName(); } } const std::string & value = m_terrainModificationFileName.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -153,33 +153,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedBuildingObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedBuildingObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getInteriorLayoutFileName(true); #endif } if (!m_interiorLayoutFileName.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter interiorLayoutFileName in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter interiorLayoutFileName has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter interiorLayoutFileName has not been defined in template %s!", DataResource::getName())); return base->getInteriorLayoutFileName(); } } const std::string & value = m_interiorLayoutFileName.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -226,12 +226,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCellObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCellObjectTemplate.cpp index 0c319760..1cdcca72 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCellObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCellObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedCellObjectTemplate::getTemplateVersion(void) const */ Tag SharedCellObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedCellObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedCellObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedConstructionContractObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedConstructionContractObjectTemplate.cpp index ab455e20..ba6ece47 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedConstructionContractObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedConstructionContractObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedConstructionContractObjectTemplate::getTemplateVersion(void) const */ Tag SharedConstructionContractObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedConstructionContractObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedConstructionContractObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCreatureObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCreatureObjectTemplate.cpp index 6c5c3db1..5254f31c 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCreatureObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCreatureObjectTemplate.cpp @@ -104,10 +104,10 @@ Tag SharedCreatureObjectTemplate::getTemplateVersion(void) const */ Tag SharedCreatureObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedCreatureObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedCreatureObjectTemplate::getHighestTemplateVersion @@ -175,33 +175,33 @@ SharedCreatureObjectTemplate::Gender testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getGender(true); #endif } if (!m_gender.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter gender in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == nullptr, ("Template parameter gender has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter gender has not been defined in template %s!", DataResource::getName())); return base->getGender(); } } Gender value = static_cast(m_gender.getValue()); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -217,33 +217,33 @@ SharedCreatureObjectTemplate::Niche testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getNiche(true); #endif } if (!m_niche.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter niche in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == nullptr, ("Template parameter niche has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter niche has not been defined in template %s!", DataResource::getName())); return base->getNiche(); } } Niche value = static_cast(m_niche.getValue()); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -259,33 +259,33 @@ SharedCreatureObjectTemplate::Species testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getSpecies(true); #endif } if (!m_species.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter species in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == nullptr, ("Template parameter species has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter species has not been defined in template %s!", DataResource::getName())); return base->getSpecies(); } } Species value = static_cast(m_species.getValue()); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -301,33 +301,33 @@ SharedCreatureObjectTemplate::Race testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getRace(true); #endif } if (!m_race.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter race in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == nullptr, ("Template parameter race has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter race has not been defined in template %s!", DataResource::getName())); return base->getRace(); } } Race value = static_cast(m_race.getValue()); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -337,8 +337,8 @@ UNREF(testData); float SharedCreatureObjectTemplate::getAcceleration(MovementTypes index) const { - const SharedCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } @@ -346,14 +346,14 @@ float SharedCreatureObjectTemplate::getAcceleration(MovementTypes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 2, ("template param index out of range")); if (!m_acceleration[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter acceleration in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter acceleration has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter acceleration has not been defined in template %s!", DataResource::getName())); return base->getAcceleration(index); } } @@ -363,9 +363,9 @@ float SharedCreatureObjectTemplate::getAcceleration(MovementTypes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getAcceleration(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -386,8 +386,8 @@ float SharedCreatureObjectTemplate::getAcceleration(MovementTypes index) const float SharedCreatureObjectTemplate::getAccelerationMin(MovementTypes index) const { - const SharedCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } @@ -395,14 +395,14 @@ float SharedCreatureObjectTemplate::getAccelerationMin(MovementTypes index) cons DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 2, ("template param index out of range")); if (!m_acceleration[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter acceleration in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter acceleration has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter acceleration has not been defined in template %s!", DataResource::getName())); return base->getAccelerationMin(index); } } @@ -412,9 +412,9 @@ float SharedCreatureObjectTemplate::getAccelerationMin(MovementTypes index) cons if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getAccelerationMin(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -435,8 +435,8 @@ float SharedCreatureObjectTemplate::getAccelerationMin(MovementTypes index) cons float SharedCreatureObjectTemplate::getAccelerationMax(MovementTypes index) const { - const SharedCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } @@ -444,14 +444,14 @@ float SharedCreatureObjectTemplate::getAccelerationMax(MovementTypes index) cons DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 2, ("template param index out of range")); if (!m_acceleration[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter acceleration in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter acceleration has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter acceleration has not been defined in template %s!", DataResource::getName())); return base->getAccelerationMax(index); } } @@ -461,9 +461,9 @@ float SharedCreatureObjectTemplate::getAccelerationMax(MovementTypes index) cons if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getAccelerationMax(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -484,8 +484,8 @@ float SharedCreatureObjectTemplate::getAccelerationMax(MovementTypes index) cons float SharedCreatureObjectTemplate::getSpeed(MovementTypes index) const { - const SharedCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } @@ -493,14 +493,14 @@ float SharedCreatureObjectTemplate::getSpeed(MovementTypes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 2, ("template param index out of range")); if (!m_speed[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter speed in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter speed has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter speed has not been defined in template %s!", DataResource::getName())); return base->getSpeed(index); } } @@ -510,9 +510,9 @@ float SharedCreatureObjectTemplate::getSpeed(MovementTypes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getSpeed(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -533,8 +533,8 @@ float SharedCreatureObjectTemplate::getSpeed(MovementTypes index) const float SharedCreatureObjectTemplate::getSpeedMin(MovementTypes index) const { - const SharedCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } @@ -542,14 +542,14 @@ float SharedCreatureObjectTemplate::getSpeedMin(MovementTypes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 2, ("template param index out of range")); if (!m_speed[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter speed in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter speed has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter speed has not been defined in template %s!", DataResource::getName())); return base->getSpeedMin(index); } } @@ -559,9 +559,9 @@ float SharedCreatureObjectTemplate::getSpeedMin(MovementTypes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getSpeedMin(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -582,8 +582,8 @@ float SharedCreatureObjectTemplate::getSpeedMin(MovementTypes index) const float SharedCreatureObjectTemplate::getSpeedMax(MovementTypes index) const { - const SharedCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } @@ -591,14 +591,14 @@ float SharedCreatureObjectTemplate::getSpeedMax(MovementTypes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 2, ("template param index out of range")); if (!m_speed[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter speed in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter speed has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter speed has not been defined in template %s!", DataResource::getName())); return base->getSpeedMax(index); } } @@ -608,9 +608,9 @@ float SharedCreatureObjectTemplate::getSpeedMax(MovementTypes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getSpeedMax(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -631,8 +631,8 @@ float SharedCreatureObjectTemplate::getSpeedMax(MovementTypes index) const float SharedCreatureObjectTemplate::getTurnRate(MovementTypes index) const { - const SharedCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } @@ -640,14 +640,14 @@ float SharedCreatureObjectTemplate::getTurnRate(MovementTypes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 2, ("template param index out of range")); if (!m_turnRate[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter turnRate in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter turnRate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter turnRate has not been defined in template %s!", DataResource::getName())); return base->getTurnRate(index); } } @@ -657,9 +657,9 @@ float SharedCreatureObjectTemplate::getTurnRate(MovementTypes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getTurnRate(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -680,8 +680,8 @@ float SharedCreatureObjectTemplate::getTurnRate(MovementTypes index) const float SharedCreatureObjectTemplate::getTurnRateMin(MovementTypes index) const { - const SharedCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } @@ -689,14 +689,14 @@ float SharedCreatureObjectTemplate::getTurnRateMin(MovementTypes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 2, ("template param index out of range")); if (!m_turnRate[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter turnRate in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter turnRate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter turnRate has not been defined in template %s!", DataResource::getName())); return base->getTurnRateMin(index); } } @@ -706,9 +706,9 @@ float SharedCreatureObjectTemplate::getTurnRateMin(MovementTypes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getTurnRateMin(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -729,8 +729,8 @@ float SharedCreatureObjectTemplate::getTurnRateMin(MovementTypes index) const float SharedCreatureObjectTemplate::getTurnRateMax(MovementTypes index) const { - const SharedCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } @@ -738,14 +738,14 @@ float SharedCreatureObjectTemplate::getTurnRateMax(MovementTypes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 2, ("template param index out of range")); if (!m_turnRate[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter turnRate in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter turnRate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter turnRate has not been defined in template %s!", DataResource::getName())); return base->getTurnRateMax(index); } } @@ -755,9 +755,9 @@ float SharedCreatureObjectTemplate::getTurnRateMax(MovementTypes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getTurnRateMax(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -784,33 +784,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getAnimationMapFilename(true); #endif } if (!m_animationMapFilename.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter animationMapFilename in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter animationMapFilename has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter animationMapFilename has not been defined in template %s!", DataResource::getName())); return base->getAnimationMapFilename(); } } const std::string & value = m_animationMapFilename.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -826,26 +826,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getSlopeModAngle(true); #endif } if (!m_slopeModAngle.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter slopeModAngle in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter slopeModAngle has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter slopeModAngle has not been defined in template %s!", DataResource::getName())); return base->getSlopeModAngle(); } } @@ -855,9 +855,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getSlopeModAngle(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -874,7 +874,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -890,26 +890,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getSlopeModAngleMin(true); #endif } if (!m_slopeModAngle.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter slopeModAngle in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter slopeModAngle has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter slopeModAngle has not been defined in template %s!", DataResource::getName())); return base->getSlopeModAngleMin(); } } @@ -919,9 +919,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getSlopeModAngleMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -938,7 +938,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -954,26 +954,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getSlopeModAngleMax(true); #endif } if (!m_slopeModAngle.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter slopeModAngle in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter slopeModAngle has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter slopeModAngle has not been defined in template %s!", DataResource::getName())); return base->getSlopeModAngleMax(); } } @@ -983,9 +983,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getSlopeModAngleMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1002,7 +1002,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1018,26 +1018,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getSlopeModPercent(true); #endif } if (!m_slopeModPercent.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter slopeModPercent in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter slopeModPercent has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter slopeModPercent has not been defined in template %s!", DataResource::getName())); return base->getSlopeModPercent(); } } @@ -1047,9 +1047,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getSlopeModPercent(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1066,7 +1066,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1082,26 +1082,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getSlopeModPercentMin(true); #endif } if (!m_slopeModPercent.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter slopeModPercent in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter slopeModPercent has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter slopeModPercent has not been defined in template %s!", DataResource::getName())); return base->getSlopeModPercentMin(); } } @@ -1111,9 +1111,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getSlopeModPercentMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1130,7 +1130,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1146,26 +1146,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getSlopeModPercentMax(true); #endif } if (!m_slopeModPercent.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter slopeModPercent in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter slopeModPercent has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter slopeModPercent has not been defined in template %s!", DataResource::getName())); return base->getSlopeModPercentMax(); } } @@ -1175,9 +1175,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getSlopeModPercentMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1194,7 +1194,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1210,26 +1210,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getWaterModPercent(true); #endif } if (!m_waterModPercent.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter waterModPercent in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter waterModPercent has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter waterModPercent has not been defined in template %s!", DataResource::getName())); return base->getWaterModPercent(); } } @@ -1239,9 +1239,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getWaterModPercent(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1258,7 +1258,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1274,26 +1274,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getWaterModPercentMin(true); #endif } if (!m_waterModPercent.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter waterModPercent in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter waterModPercent has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter waterModPercent has not been defined in template %s!", DataResource::getName())); return base->getWaterModPercentMin(); } } @@ -1303,9 +1303,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getWaterModPercentMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1322,7 +1322,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1338,26 +1338,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getWaterModPercentMax(true); #endif } if (!m_waterModPercent.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter waterModPercent in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter waterModPercent has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter waterModPercent has not been defined in template %s!", DataResource::getName())); return base->getWaterModPercentMax(); } } @@ -1367,9 +1367,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getWaterModPercentMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1386,7 +1386,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1402,26 +1402,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getStepHeight(true); #endif } if (!m_stepHeight.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter stepHeight in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter stepHeight has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter stepHeight has not been defined in template %s!", DataResource::getName())); return base->getStepHeight(); } } @@ -1431,9 +1431,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getStepHeight(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1450,7 +1450,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1466,26 +1466,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getStepHeightMin(true); #endif } if (!m_stepHeight.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter stepHeight in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter stepHeight has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter stepHeight has not been defined in template %s!", DataResource::getName())); return base->getStepHeightMin(); } } @@ -1495,9 +1495,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getStepHeightMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1514,7 +1514,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1530,26 +1530,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getStepHeightMax(true); #endif } if (!m_stepHeight.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter stepHeight in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter stepHeight has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter stepHeight has not been defined in template %s!", DataResource::getName())); return base->getStepHeightMax(); } } @@ -1559,9 +1559,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getStepHeightMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1578,7 +1578,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1594,26 +1594,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getCollisionHeight(true); #endif } if (!m_collisionHeight.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionHeight in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter collisionHeight has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter collisionHeight has not been defined in template %s!", DataResource::getName())); return base->getCollisionHeight(); } } @@ -1623,9 +1623,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getCollisionHeight(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1642,7 +1642,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1658,26 +1658,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getCollisionHeightMin(true); #endif } if (!m_collisionHeight.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionHeight in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter collisionHeight has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter collisionHeight has not been defined in template %s!", DataResource::getName())); return base->getCollisionHeightMin(); } } @@ -1687,9 +1687,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getCollisionHeightMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1706,7 +1706,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1722,26 +1722,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getCollisionHeightMax(true); #endif } if (!m_collisionHeight.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionHeight in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter collisionHeight has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter collisionHeight has not been defined in template %s!", DataResource::getName())); return base->getCollisionHeightMax(); } } @@ -1751,9 +1751,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getCollisionHeightMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1770,7 +1770,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1786,26 +1786,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getCollisionRadius(true); #endif } if (!m_collisionRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter collisionRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter collisionRadius has not been defined in template %s!", DataResource::getName())); return base->getCollisionRadius(); } } @@ -1815,9 +1815,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getCollisionRadius(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1834,7 +1834,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1850,26 +1850,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getCollisionRadiusMin(true); #endif } if (!m_collisionRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter collisionRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter collisionRadius has not been defined in template %s!", DataResource::getName())); return base->getCollisionRadiusMin(); } } @@ -1879,9 +1879,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getCollisionRadiusMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1898,7 +1898,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1914,26 +1914,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getCollisionRadiusMax(true); #endif } if (!m_collisionRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter collisionRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter collisionRadius has not been defined in template %s!", DataResource::getName())); return base->getCollisionRadiusMax(); } } @@ -1943,9 +1943,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getCollisionRadiusMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1962,7 +1962,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1978,33 +1978,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMovementDatatable(true); #endif } if (!m_movementDatatable.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter movementDatatable in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter movementDatatable has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter movementDatatable has not been defined in template %s!", DataResource::getName())); return base->getMovementDatatable(); } } const std::string & value = m_movementDatatable.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2014,8 +2014,8 @@ UNREF(testData); bool SharedCreatureObjectTemplate::getPostureAlignToTerrain(Postures index) const { - const SharedCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } @@ -2023,14 +2023,14 @@ bool SharedCreatureObjectTemplate::getPostureAlignToTerrain(Postures index) cons DEBUG_FATAL(index < 0 || index >= 15, ("template param index out of range")); if (!m_postureAlignToTerrain[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter postureAlignToTerrain in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter postureAlignToTerrain has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter postureAlignToTerrain has not been defined in template %s!", DataResource::getName())); return base->getPostureAlignToTerrain(index); } } @@ -2047,26 +2047,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getSwimHeight(true); #endif } if (!m_swimHeight.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter swimHeight in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter swimHeight has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter swimHeight has not been defined in template %s!", DataResource::getName())); return base->getSwimHeight(); } } @@ -2076,9 +2076,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getSwimHeight(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2095,7 +2095,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2111,26 +2111,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getSwimHeightMin(true); #endif } if (!m_swimHeight.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter swimHeight in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter swimHeight has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter swimHeight has not been defined in template %s!", DataResource::getName())); return base->getSwimHeightMin(); } } @@ -2140,9 +2140,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getSwimHeightMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2159,7 +2159,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2175,26 +2175,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getSwimHeightMax(true); #endif } if (!m_swimHeight.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter swimHeight in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter swimHeight has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter swimHeight has not been defined in template %s!", DataResource::getName())); return base->getSwimHeightMax(); } } @@ -2204,9 +2204,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getSwimHeightMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2223,7 +2223,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2239,26 +2239,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getWarpTolerance(true); #endif } if (!m_warpTolerance.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter warpTolerance in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter warpTolerance has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter warpTolerance has not been defined in template %s!", DataResource::getName())); return base->getWarpTolerance(); } } @@ -2268,9 +2268,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getWarpTolerance(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2287,7 +2287,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2303,26 +2303,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getWarpToleranceMin(true); #endif } if (!m_warpTolerance.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter warpTolerance in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter warpTolerance has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter warpTolerance has not been defined in template %s!", DataResource::getName())); return base->getWarpToleranceMin(); } } @@ -2332,9 +2332,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getWarpToleranceMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2351,7 +2351,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2367,26 +2367,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getWarpToleranceMax(true); #endif } if (!m_warpTolerance.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter warpTolerance in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter warpTolerance has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter warpTolerance has not been defined in template %s!", DataResource::getName())); return base->getWarpToleranceMax(); } } @@ -2396,9 +2396,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getWarpToleranceMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2415,7 +2415,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2431,26 +2431,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getCollisionOffsetX(true); #endif } if (!m_collisionOffsetX.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionOffsetX in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter collisionOffsetX has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter collisionOffsetX has not been defined in template %s!", DataResource::getName())); return base->getCollisionOffsetX(); } } @@ -2460,9 +2460,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getCollisionOffsetX(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2479,7 +2479,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2495,26 +2495,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getCollisionOffsetXMin(true); #endif } if (!m_collisionOffsetX.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionOffsetX in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter collisionOffsetX has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter collisionOffsetX has not been defined in template %s!", DataResource::getName())); return base->getCollisionOffsetXMin(); } } @@ -2524,9 +2524,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getCollisionOffsetXMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2543,7 +2543,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2559,26 +2559,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getCollisionOffsetXMax(true); #endif } if (!m_collisionOffsetX.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionOffsetX in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter collisionOffsetX has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter collisionOffsetX has not been defined in template %s!", DataResource::getName())); return base->getCollisionOffsetXMax(); } } @@ -2588,9 +2588,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getCollisionOffsetXMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2607,7 +2607,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2623,26 +2623,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getCollisionOffsetZ(true); #endif } if (!m_collisionOffsetZ.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionOffsetZ in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter collisionOffsetZ has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter collisionOffsetZ has not been defined in template %s!", DataResource::getName())); return base->getCollisionOffsetZ(); } } @@ -2652,9 +2652,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getCollisionOffsetZ(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2671,7 +2671,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2687,26 +2687,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getCollisionOffsetZMin(true); #endif } if (!m_collisionOffsetZ.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionOffsetZ in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter collisionOffsetZ has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter collisionOffsetZ has not been defined in template %s!", DataResource::getName())); return base->getCollisionOffsetZMin(); } } @@ -2716,9 +2716,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getCollisionOffsetZMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2735,7 +2735,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2751,26 +2751,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getCollisionOffsetZMax(true); #endif } if (!m_collisionOffsetZ.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionOffsetZ in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter collisionOffsetZ has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter collisionOffsetZ has not been defined in template %s!", DataResource::getName())); return base->getCollisionOffsetZMax(); } } @@ -2780,9 +2780,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getCollisionOffsetZMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2799,7 +2799,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2815,26 +2815,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getCollisionLength(true); #endif } if (!m_collisionLength.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionLength in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter collisionLength has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter collisionLength has not been defined in template %s!", DataResource::getName())); return base->getCollisionLength(); } } @@ -2844,9 +2844,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getCollisionLength(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2863,7 +2863,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2879,26 +2879,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getCollisionLengthMin(true); #endif } if (!m_collisionLength.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionLength in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter collisionLength has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter collisionLength has not been defined in template %s!", DataResource::getName())); return base->getCollisionLengthMin(); } } @@ -2908,9 +2908,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getCollisionLengthMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2927,7 +2927,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2943,26 +2943,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getCollisionLengthMax(true); #endif } if (!m_collisionLength.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionLength in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter collisionLength has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter collisionLength has not been defined in template %s!", DataResource::getName())); return base->getCollisionLengthMax(); } } @@ -2972,9 +2972,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getCollisionLengthMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2991,7 +2991,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -3007,26 +3007,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getCameraHeight(true); #endif } if (!m_cameraHeight.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter cameraHeight in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter cameraHeight has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter cameraHeight has not been defined in template %s!", DataResource::getName())); return base->getCameraHeight(); } } @@ -3036,9 +3036,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getCameraHeight(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3055,7 +3055,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -3071,26 +3071,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getCameraHeightMin(true); #endif } if (!m_cameraHeight.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter cameraHeight in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter cameraHeight has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter cameraHeight has not been defined in template %s!", DataResource::getName())); return base->getCameraHeightMin(); } } @@ -3100,9 +3100,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getCameraHeightMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3119,7 +3119,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -3135,26 +3135,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedCreatureObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getCameraHeightMax(true); #endif } if (!m_cameraHeight.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter cameraHeight in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter cameraHeight has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter cameraHeight has not been defined in template %s!", DataResource::getName())); return base->getCameraHeightMax(); } } @@ -3164,9 +3164,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getCameraHeightMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3183,7 +3183,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -3258,12 +3258,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedDraftSchematicObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedDraftSchematicObjectTemplate.cpp index 961cebca..fe3956f4 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedDraftSchematicObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedDraftSchematicObjectTemplate.cpp @@ -55,7 +55,7 @@ SharedDraftSchematicObjectTemplate::~SharedDraftSchematicObjectTemplate() for (iter = m_slots.begin(); iter != m_slots.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_slots.clear(); } @@ -64,7 +64,7 @@ SharedDraftSchematicObjectTemplate::~SharedDraftSchematicObjectTemplate() for (iter = m_attributes.begin(); iter != m_attributes.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_attributes.clear(); } @@ -116,10 +116,10 @@ Tag SharedDraftSchematicObjectTemplate::getTemplateVersion(void) const */ Tag SharedDraftSchematicObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedDraftSchematicObjectTemplate::getHighestTemplateVersion @@ -127,28 +127,28 @@ Tag SharedDraftSchematicObjectTemplate::getHighestTemplateVersion(void) const //@BEGIN TFD void SharedDraftSchematicObjectTemplate::getSlots(IngredientSlot &data, int index) const { - const SharedDraftSchematicObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedDraftSchematicObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_slotsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter slots in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter slots has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter slots has not been defined in template %s!", DataResource::getName())); base->getSlots(data, index); return; } } - if (m_slotsAppend && base != nullptr) + if (m_slotsAppend && base != NULL) { int baseCount = base->getSlotsCount(); if (index < baseCount) @@ -170,28 +170,28 @@ void SharedDraftSchematicObjectTemplate::getSlots(IngredientSlot &data, int inde void SharedDraftSchematicObjectTemplate::getSlotsMin(IngredientSlot &data, int index) const { - const SharedDraftSchematicObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedDraftSchematicObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_slotsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter slots in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter slots has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter slots has not been defined in template %s!", DataResource::getName())); base->getSlotsMin(data, index); return; } } - if (m_slotsAppend && base != nullptr) + if (m_slotsAppend && base != NULL) { int baseCount = base->getSlotsCount(); if (index < baseCount) @@ -213,28 +213,28 @@ void SharedDraftSchematicObjectTemplate::getSlotsMin(IngredientSlot &data, int i void SharedDraftSchematicObjectTemplate::getSlotsMax(IngredientSlot &data, int index) const { - const SharedDraftSchematicObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedDraftSchematicObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_slotsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter slots in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter slots has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter slots has not been defined in template %s!", DataResource::getName())); base->getSlotsMax(data, index); return; } } - if (m_slotsAppend && base != nullptr) + if (m_slotsAppend && base != NULL) { int baseCount = base->getSlotsCount(); if (index < baseCount) @@ -258,20 +258,20 @@ size_t SharedDraftSchematicObjectTemplate::getSlotsCount(void) const { if (!m_slotsLoaded) { - if (m_baseData == nullptr) + if (m_baseData == NULL) return 0; const SharedDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == nullptr, ("base template wrong type")); + DEBUG_FATAL(base == NULL, ("base template wrong type")); return base->getSlotsCount(); } size_t count = m_slots.size(); // if we are extending our base template, add it's count - if (m_slotsAppend && m_baseData != nullptr) + if (m_slotsAppend && m_baseData != NULL) { const SharedDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base != nullptr) + if (base != NULL) count += base->getSlotsCount(); } @@ -280,28 +280,28 @@ size_t SharedDraftSchematicObjectTemplate::getSlotsCount(void) const void SharedDraftSchematicObjectTemplate::getAttributes(SchematicAttribute &data, int index) const { - const SharedDraftSchematicObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedDraftSchematicObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_attributesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter attributes in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter attributes has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter attributes has not been defined in template %s!", DataResource::getName())); base->getAttributes(data, index); return; } } - if (m_attributesAppend && base != nullptr) + if (m_attributesAppend && base != NULL) { int baseCount = base->getAttributesCount(); if (index < baseCount) @@ -324,28 +324,28 @@ void SharedDraftSchematicObjectTemplate::getAttributes(SchematicAttribute &data, void SharedDraftSchematicObjectTemplate::getAttributesMin(SchematicAttribute &data, int index) const { - const SharedDraftSchematicObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedDraftSchematicObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_attributesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter attributes in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter attributes has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter attributes has not been defined in template %s!", DataResource::getName())); base->getAttributesMin(data, index); return; } } - if (m_attributesAppend && base != nullptr) + if (m_attributesAppend && base != NULL) { int baseCount = base->getAttributesCount(); if (index < baseCount) @@ -368,28 +368,28 @@ void SharedDraftSchematicObjectTemplate::getAttributesMin(SchematicAttribute &da void SharedDraftSchematicObjectTemplate::getAttributesMax(SchematicAttribute &data, int index) const { - const SharedDraftSchematicObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedDraftSchematicObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_attributesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter attributes in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter attributes has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter attributes has not been defined in template %s!", DataResource::getName())); base->getAttributesMax(data, index); return; } } - if (m_attributesAppend && base != nullptr) + if (m_attributesAppend && base != NULL) { int baseCount = base->getAttributesCount(); if (index < baseCount) @@ -414,20 +414,20 @@ size_t SharedDraftSchematicObjectTemplate::getAttributesCount(void) const { if (!m_attributesLoaded) { - if (m_baseData == nullptr) + if (m_baseData == NULL) return 0; const SharedDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == nullptr, ("base template wrong type")); + DEBUG_FATAL(base == NULL, ("base template wrong type")); return base->getAttributesCount(); } size_t count = m_attributes.size(); // if we are extending our base template, add it's count - if (m_attributesAppend && m_baseData != nullptr) + if (m_attributesAppend && m_baseData != NULL) { const SharedDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base != nullptr) + if (base != NULL) count += base->getAttributesCount(); } @@ -442,33 +442,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedDraftSchematicObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedDraftSchematicObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getCraftedSharedTemplate(true); #endif } if (!m_craftedSharedTemplate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter craftedSharedTemplate in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter craftedSharedTemplate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter craftedSharedTemplate has not been defined in template %s!", DataResource::getName())); return base->getCraftedSharedTemplate(); } } const std::string & value = m_craftedSharedTemplate.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -514,12 +514,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } @@ -548,7 +548,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_slots.begin(); iter != m_slots.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_slots.clear(); m_slotsAppend = file.read_bool8(); @@ -567,7 +567,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_attributes.begin(); iter != m_attributes.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_attributes.clear(); m_attributesAppend = file.read_bool8(); @@ -646,33 +646,33 @@ StringId testDataValue = DefaultStringId; UNREF(testData); #endif - const SharedDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; - if (m_baseData != nullptr) + const SharedDraftSchematicObjectTemplate::_IngredientSlot * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getName(true); #endif } if (!m_name.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter name in template %s", DataResource::getName())); return DefaultStringId; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter name has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter name has not been defined in template %s!", DataResource::getName())); return base->getName(versionOk); } } const StringId value = m_name.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -688,33 +688,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; - if (m_baseData != nullptr) + const SharedDraftSchematicObjectTemplate::_IngredientSlot * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getHardpoint(true); #endif } if (!m_hardpoint.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter hardpoint in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter hardpoint has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter hardpoint has not been defined in template %s!", DataResource::getName())); return base->getHardpoint(versionOk); } } const std::string & value = m_hardpoint.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -819,33 +819,33 @@ StringId testDataValue = DefaultStringId; UNREF(testData); #endif - const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = nullptr; - if (m_baseData != nullptr) + const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getName(true); #endif } if (!m_name.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter name in template %s", DataResource::getName())); return DefaultStringId; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter name has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter name has not been defined in template %s!", DataResource::getName())); return base->getName(versionOk); } } const StringId value = m_name.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -861,33 +861,33 @@ StringId testDataValue = DefaultStringId; UNREF(testData); #endif - const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = nullptr; - if (m_baseData != nullptr) + const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getExperiment(true); #endif } if (!m_experiment.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter experiment in template %s", DataResource::getName())); return DefaultStringId; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter experiment has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter experiment has not been defined in template %s!", DataResource::getName())); return base->getExperiment(versionOk); } } const StringId value = m_experiment.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -903,26 +903,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = nullptr; - if (m_baseData != nullptr) + const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getValue(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValue(versionOk); } } @@ -932,9 +932,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getValue(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -951,7 +951,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -967,26 +967,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = nullptr; - if (m_baseData != nullptr) + const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getValueMin(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValueMin(versionOk); } } @@ -996,9 +996,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getValueMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1015,7 +1015,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1031,26 +1031,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = nullptr; - if (m_baseData != nullptr) + const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getValueMax(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValueMax(versionOk); } } @@ -1060,9 +1060,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getValueMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1079,7 +1079,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedFactoryObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedFactoryObjectTemplate.cpp index 4a7e73fa..5a07a293 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedFactoryObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedFactoryObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedFactoryObjectTemplate::getTemplateVersion(void) const */ Tag SharedFactoryObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedFactoryObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedFactoryObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGroupObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGroupObjectTemplate.cpp index d3c1d6d0..1c30083d 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGroupObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGroupObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedGroupObjectTemplate::getTemplateVersion(void) const */ Tag SharedGroupObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedGroupObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedGroupObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGuildObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGuildObjectTemplate.cpp index e57241db..4243b93c 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGuildObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGuildObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedGuildObjectTemplate::getTemplateVersion(void) const */ Tag SharedGuildObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedGuildObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedGuildObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedInstallationObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedInstallationObjectTemplate.cpp index 5e66bbf1..08158117 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedInstallationObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedInstallationObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedInstallationObjectTemplate::getTemplateVersion(void) const */ Tag SharedInstallationObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedInstallationObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedInstallationObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedIntangibleObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedIntangibleObjectTemplate.cpp index 4934dd40..0e9edb7c 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedIntangibleObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedIntangibleObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedIntangibleObjectTemplate::getTemplateVersion(void) const */ Tag SharedIntangibleObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedIntangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedIntangibleObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedJediManagerObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedJediManagerObjectTemplate.cpp index 3c8ad274..c4840885 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedJediManagerObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedJediManagerObjectTemplate.cpp @@ -95,10 +95,10 @@ Tag SharedJediManagerObjectTemplate::getTemplateVersion(void) const */ Tag SharedJediManagerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedJediManagerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedJediManagerObjectTemplate::getHighestTemplateVersion @@ -141,12 +141,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedManufactureSchematicObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedManufactureSchematicObjectTemplate.cpp index de9c8b4d..8b5e0965 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedManufactureSchematicObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedManufactureSchematicObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedManufactureSchematicObjectTemplate::getTemplateVersion(void) const */ Tag SharedManufactureSchematicObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedManufactureSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedManufactureSchematicObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedMissionObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedMissionObjectTemplate.cpp index 10eaba74..b2745f8e 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedMissionObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedMissionObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedMissionObjectTemplate::getTemplateVersion(void) const */ Tag SharedMissionObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedMissionObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedMissionObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedObjectTemplate.cpp index dc0fe57a..034adea5 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedObjectTemplate.cpp @@ -109,8 +109,8 @@ SharedObjectTemplate::SharedObjectTemplate(const std::string & filename) : ObjectTemplate(filename) ,m_versionOk(true) //@END TFD INIT - , m_slotDescriptor(nullptr) - , m_arrangementDescriptor(nullptr) + , m_slotDescriptor(NULL) + , m_arrangementDescriptor(NULL) , m_clientData (0) , m_preloadManager (0) { @@ -232,10 +232,10 @@ Tag SharedObjectTemplate::getTemplateVersion(void) const */ Tag SharedObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedObjectTemplate::getHighestTemplateVersion @@ -274,33 +274,33 @@ StringId testDataValue = DefaultStringId; UNREF(testData); #endif - const SharedObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getObjectName(true); #endif } if (!m_objectName.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter objectName in template %s", DataResource::getName())); return DefaultStringId; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter objectName has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter objectName has not been defined in template %s!", DataResource::getName())); return base->getObjectName(); } } const StringId value = m_objectName.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -316,33 +316,33 @@ StringId testDataValue = DefaultStringId; UNREF(testData); #endif - const SharedObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getDetailedDescription(true); #endif } if (!m_detailedDescription.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter detailedDescription in template %s", DataResource::getName())); return DefaultStringId; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter detailedDescription has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter detailedDescription has not been defined in template %s!", DataResource::getName())); return base->getDetailedDescription(); } } const StringId value = m_detailedDescription.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -358,33 +358,33 @@ StringId testDataValue = DefaultStringId; UNREF(testData); #endif - const SharedObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getLookAtText(true); #endif } if (!m_lookAtText.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter lookAtText in template %s", DataResource::getName())); return DefaultStringId; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter lookAtText has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter lookAtText has not been defined in template %s!", DataResource::getName())); return base->getLookAtText(); } } const StringId value = m_lookAtText.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -400,33 +400,33 @@ bool testDataValue = false; UNREF(testData); #endif - const SharedObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getSnapToTerrain(true); #endif } if (!m_snapToTerrain.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter snapToTerrain in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter snapToTerrain has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter snapToTerrain has not been defined in template %s!", DataResource::getName())); return base->getSnapToTerrain(); } } bool value = m_snapToTerrain.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -442,33 +442,33 @@ SharedObjectTemplate::ContainerType testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getContainerType(true); #endif } if (!m_containerType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter containerType in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == nullptr, ("Template parameter containerType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter containerType has not been defined in template %s!", DataResource::getName())); return base->getContainerType(); } } ContainerType value = static_cast(m_containerType.getValue()); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -484,26 +484,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getContainerVolumeLimit(true); #endif } if (!m_containerVolumeLimit.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter containerVolumeLimit in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter containerVolumeLimit has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter containerVolumeLimit has not been defined in template %s!", DataResource::getName())); return base->getContainerVolumeLimit(); } } @@ -513,9 +513,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getContainerVolumeLimit(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -532,7 +532,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -548,26 +548,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getContainerVolumeLimitMin(true); #endif } if (!m_containerVolumeLimit.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter containerVolumeLimit in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter containerVolumeLimit has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter containerVolumeLimit has not been defined in template %s!", DataResource::getName())); return base->getContainerVolumeLimitMin(); } } @@ -577,9 +577,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getContainerVolumeLimitMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -596,7 +596,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -612,26 +612,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getContainerVolumeLimitMax(true); #endif } if (!m_containerVolumeLimit.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter containerVolumeLimit in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter containerVolumeLimit has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter containerVolumeLimit has not been defined in template %s!", DataResource::getName())); return base->getContainerVolumeLimitMax(); } } @@ -641,9 +641,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getContainerVolumeLimitMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -660,7 +660,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -676,33 +676,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getTintPalette(true); #endif } if (!m_tintPalette.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter tintPalette in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter tintPalette has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter tintPalette has not been defined in template %s!", DataResource::getName())); return base->getTintPalette(); } } const std::string & value = m_tintPalette.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -718,33 +718,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getSlotDescriptorFilename(true); #endif } if (!m_slotDescriptorFilename.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter slotDescriptorFilename in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter slotDescriptorFilename has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter slotDescriptorFilename has not been defined in template %s!", DataResource::getName())); return base->getSlotDescriptorFilename(); } } const std::string & value = m_slotDescriptorFilename.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -760,33 +760,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getArrangementDescriptorFilename(true); #endif } if (!m_arrangementDescriptorFilename.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter arrangementDescriptorFilename in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter arrangementDescriptorFilename has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter arrangementDescriptorFilename has not been defined in template %s!", DataResource::getName())); return base->getArrangementDescriptorFilename(); } } const std::string & value = m_arrangementDescriptorFilename.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -802,33 +802,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getAppearanceFilename(true); #endif } if (!m_appearanceFilename.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter appearanceFilename in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter appearanceFilename has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter appearanceFilename has not been defined in template %s!", DataResource::getName())); return base->getAppearanceFilename(); } } const std::string & value = m_appearanceFilename.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -844,33 +844,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getPortalLayoutFilename(true); #endif } if (!m_portalLayoutFilename.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter portalLayoutFilename in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter portalLayoutFilename has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter portalLayoutFilename has not been defined in template %s!", DataResource::getName())); return base->getPortalLayoutFilename(); } } const std::string & value = m_portalLayoutFilename.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -886,33 +886,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getClientDataFile(true); #endif } if (!m_clientDataFile.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter clientDataFile in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter clientDataFile has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter clientDataFile has not been defined in template %s!", DataResource::getName())); return base->getClientDataFile(); } } const std::string & value = m_clientDataFile.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -928,26 +928,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getScale(true); #endif } if (!m_scale.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter scale in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter scale has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter scale has not been defined in template %s!", DataResource::getName())); return base->getScale(); } } @@ -957,9 +957,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getScale(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -976,7 +976,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -992,26 +992,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getScaleMin(true); #endif } if (!m_scale.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter scale in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter scale has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter scale has not been defined in template %s!", DataResource::getName())); return base->getScaleMin(); } } @@ -1021,9 +1021,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getScaleMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1040,7 +1040,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1056,26 +1056,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getScaleMax(true); #endif } if (!m_scale.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter scale in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter scale has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter scale has not been defined in template %s!", DataResource::getName())); return base->getScaleMax(); } } @@ -1085,9 +1085,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getScaleMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1104,7 +1104,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1120,33 +1120,33 @@ SharedObjectTemplate::GameObjectType testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getGameObjectType(true); #endif } if (!m_gameObjectType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter gameObjectType in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == nullptr, ("Template parameter gameObjectType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter gameObjectType has not been defined in template %s!", DataResource::getName())); return base->getGameObjectType(); } } GameObjectType value = static_cast(m_gameObjectType.getValue()); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1162,33 +1162,33 @@ bool testDataValue = false; UNREF(testData); #endif - const SharedObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getSendToClient(true); #endif } if (!m_sendToClient.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter sendToClient in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter sendToClient has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter sendToClient has not been defined in template %s!", DataResource::getName())); return base->getSendToClient(); } } bool value = m_sendToClient.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1204,26 +1204,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getScaleThresholdBeforeExtentTest(true); #endif } if (!m_scaleThresholdBeforeExtentTest.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter scaleThresholdBeforeExtentTest in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter scaleThresholdBeforeExtentTest has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter scaleThresholdBeforeExtentTest has not been defined in template %s!", DataResource::getName())); return base->getScaleThresholdBeforeExtentTest(); } } @@ -1233,9 +1233,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getScaleThresholdBeforeExtentTest(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1252,7 +1252,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1268,26 +1268,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getScaleThresholdBeforeExtentTestMin(true); #endif } if (!m_scaleThresholdBeforeExtentTest.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter scaleThresholdBeforeExtentTest in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter scaleThresholdBeforeExtentTest has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter scaleThresholdBeforeExtentTest has not been defined in template %s!", DataResource::getName())); return base->getScaleThresholdBeforeExtentTestMin(); } } @@ -1297,9 +1297,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getScaleThresholdBeforeExtentTestMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1316,7 +1316,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1332,26 +1332,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getScaleThresholdBeforeExtentTestMax(true); #endif } if (!m_scaleThresholdBeforeExtentTest.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter scaleThresholdBeforeExtentTest in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter scaleThresholdBeforeExtentTest has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter scaleThresholdBeforeExtentTest has not been defined in template %s!", DataResource::getName())); return base->getScaleThresholdBeforeExtentTestMax(); } } @@ -1361,9 +1361,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getScaleThresholdBeforeExtentTestMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1380,7 +1380,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1396,26 +1396,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getClearFloraRadius(true); #endif } if (!m_clearFloraRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter clearFloraRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter clearFloraRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter clearFloraRadius has not been defined in template %s!", DataResource::getName())); return base->getClearFloraRadius(); } } @@ -1425,9 +1425,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getClearFloraRadius(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1444,7 +1444,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1460,26 +1460,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getClearFloraRadiusMin(true); #endif } if (!m_clearFloraRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter clearFloraRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter clearFloraRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter clearFloraRadius has not been defined in template %s!", DataResource::getName())); return base->getClearFloraRadiusMin(); } } @@ -1489,9 +1489,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getClearFloraRadiusMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1508,7 +1508,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1524,26 +1524,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getClearFloraRadiusMax(true); #endif } if (!m_clearFloraRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter clearFloraRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter clearFloraRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter clearFloraRadius has not been defined in template %s!", DataResource::getName())); return base->getClearFloraRadiusMax(); } } @@ -1553,9 +1553,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getClearFloraRadiusMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1572,7 +1572,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1588,33 +1588,33 @@ SharedObjectTemplate::SurfaceType testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getSurfaceType(true); #endif } if (!m_surfaceType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter surfaceType in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == nullptr, ("Template parameter surfaceType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter surfaceType has not been defined in template %s!", DataResource::getName())); return base->getSurfaceType(); } } SurfaceType value = static_cast(m_surfaceType.getValue()); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1630,26 +1630,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getNoBuildRadius(true); #endif } if (!m_noBuildRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter noBuildRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter noBuildRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter noBuildRadius has not been defined in template %s!", DataResource::getName())); return base->getNoBuildRadius(); } } @@ -1659,9 +1659,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getNoBuildRadius(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1678,7 +1678,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1694,26 +1694,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getNoBuildRadiusMin(true); #endif } if (!m_noBuildRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter noBuildRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter noBuildRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter noBuildRadius has not been defined in template %s!", DataResource::getName())); return base->getNoBuildRadiusMin(); } } @@ -1723,9 +1723,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getNoBuildRadiusMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1742,7 +1742,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1758,26 +1758,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getNoBuildRadiusMax(true); #endif } if (!m_noBuildRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter noBuildRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter noBuildRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter noBuildRadius has not been defined in template %s!", DataResource::getName())); return base->getNoBuildRadiusMax(); } } @@ -1787,9 +1787,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getNoBuildRadiusMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1806,7 +1806,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1822,33 +1822,33 @@ bool testDataValue = false; UNREF(testData); #endif - const SharedObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getOnlyVisibleInTools(true); #endif } if (!m_onlyVisibleInTools.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter onlyVisibleInTools in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter onlyVisibleInTools has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter onlyVisibleInTools has not been defined in template %s!", DataResource::getName())); return base->getOnlyVisibleInTools(); } } bool value = m_onlyVisibleInTools.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1864,26 +1864,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getLocationReservationRadius(true); #endif } if (!m_locationReservationRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter locationReservationRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter locationReservationRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter locationReservationRadius has not been defined in template %s!", DataResource::getName())); return base->getLocationReservationRadius(); } } @@ -1893,9 +1893,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getLocationReservationRadius(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1912,7 +1912,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1928,26 +1928,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getLocationReservationRadiusMin(true); #endif } if (!m_locationReservationRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter locationReservationRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter locationReservationRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter locationReservationRadius has not been defined in template %s!", DataResource::getName())); return base->getLocationReservationRadiusMin(); } } @@ -1957,9 +1957,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getLocationReservationRadiusMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1976,7 +1976,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1992,26 +1992,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getLocationReservationRadiusMax(true); #endif } if (!m_locationReservationRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter locationReservationRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter locationReservationRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter locationReservationRadius has not been defined in template %s!", DataResource::getName())); return base->getLocationReservationRadiusMax(); } } @@ -2021,9 +2021,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getLocationReservationRadiusMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2040,7 +2040,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2056,33 +2056,33 @@ bool testDataValue = false; UNREF(testData); #endif - const SharedObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getForceNoCollision(true); #endif } if (!m_forceNoCollision.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter forceNoCollision in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter forceNoCollision has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter forceNoCollision has not been defined in template %s!", DataResource::getName())); return base->getForceNoCollision(); } } bool value = m_forceNoCollision.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2153,12 +2153,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerObjectTemplate.cpp index 7d020a59..03213f9f 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerObjectTemplate.cpp @@ -95,10 +95,10 @@ Tag SharedPlayerObjectTemplate::getTemplateVersion(void) const */ Tag SharedPlayerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedPlayerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedPlayerObjectTemplate::getHighestTemplateVersion @@ -141,12 +141,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerQuestObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerQuestObjectTemplate.cpp index 26380963..c475f753 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerQuestObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerQuestObjectTemplate.cpp @@ -95,10 +95,10 @@ Tag SharedPlayerQuestObjectTemplate::getTemplateVersion(void) const */ Tag SharedPlayerQuestObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedPlayerQuestObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedPlayerQuestObjectTemplate::getHighestTemplateVersion @@ -141,12 +141,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedResourceContainerObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedResourceContainerObjectTemplate.cpp index dbb0635d..9eb6e580 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedResourceContainerObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedResourceContainerObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedResourceContainerObjectTemplate::getTemplateVersion(void) const */ Tag SharedResourceContainerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedResourceContainerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedResourceContainerObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedShipObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedShipObjectTemplate.cpp index e374302c..8dce0c07 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedShipObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedShipObjectTemplate.cpp @@ -101,10 +101,10 @@ Tag SharedShipObjectTemplate::getTemplateVersion(void) const */ Tag SharedShipObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedShipObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedShipObjectTemplate::getHighestTemplateVersion @@ -155,33 +155,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedShipObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedShipObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getCockpitFilename(true); #endif } if (!m_cockpitFilename.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter cockpitFilename in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter cockpitFilename has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter cockpitFilename has not been defined in template %s!", DataResource::getName())); return base->getCockpitFilename(); } } const std::string & value = m_cockpitFilename.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -197,33 +197,33 @@ bool testDataValue = false; UNREF(testData); #endif - const SharedShipObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedShipObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getHasWings(true); #endif } if (!m_hasWings.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter hasWings in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter hasWings has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter hasWings has not been defined in template %s!", DataResource::getName())); return base->getHasWings(); } } bool value = m_hasWings.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -239,33 +239,33 @@ bool testDataValue = false; UNREF(testData); #endif - const SharedShipObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedShipObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getPlayerControlled(true); #endif } if (!m_playerControlled.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter playerControlled in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter playerControlled has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter playerControlled has not been defined in template %s!", DataResource::getName())); return base->getPlayerControlled(); } } bool value = m_playerControlled.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -281,33 +281,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedShipObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedShipObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getInteriorLayoutFileName(true); #endif } if (!m_interiorLayoutFileName.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter interiorLayoutFileName in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter interiorLayoutFileName has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter interiorLayoutFileName has not been defined in template %s!", DataResource::getName())); return base->getInteriorLayoutFileName(); } } const std::string & value = m_interiorLayoutFileName.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -356,12 +356,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedStaticObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedStaticObjectTemplate.cpp index 3de71cf2..597d379a 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedStaticObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedStaticObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedStaticObjectTemplate::getTemplateVersion(void) const */ Tag SharedStaticObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedStaticObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedStaticObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTangibleObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTangibleObjectTemplate.cpp index 95742f60..57f841e2 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTangibleObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTangibleObjectTemplate.cpp @@ -73,7 +73,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() for (iter = m_paletteColorCustomizationVariables.begin(); iter != m_paletteColorCustomizationVariables.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_paletteColorCustomizationVariables.clear(); } @@ -82,7 +82,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() for (iter = m_rangedIntCustomizationVariables.begin(); iter != m_rangedIntCustomizationVariables.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_rangedIntCustomizationVariables.clear(); } @@ -91,7 +91,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() for (iter = m_constStringCustomizationVariables.begin(); iter != m_constStringCustomizationVariables.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_constStringCustomizationVariables.clear(); } @@ -100,7 +100,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() for (iter = m_socketDestinations.begin(); iter != m_socketDestinations.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_socketDestinations.clear(); } @@ -109,7 +109,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() for (iter = m_certificationsRequired.begin(); iter != m_certificationsRequired.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_certificationsRequired.clear(); } @@ -118,7 +118,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() for (iter = m_customizationVariableMapping.begin(); iter != m_customizationVariableMapping.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_customizationVariableMapping.clear(); } @@ -176,10 +176,10 @@ Tag SharedTangibleObjectTemplate::getTemplateVersion(void) const */ Tag SharedTangibleObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedTangibleObjectTemplate::getHighestTemplateVersion @@ -355,28 +355,28 @@ void SharedTangibleObjectTemplate::createCustomizationDataPropertyAsNeeded(Objec //@BEGIN TFD void SharedTangibleObjectTemplate::getPaletteColorCustomizationVariables(PaletteColorCustomizationVariable &data, int index) const { - const SharedTangibleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedTangibleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_paletteColorCustomizationVariablesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter paletteColorCustomizationVariables in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter paletteColorCustomizationVariables has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter paletteColorCustomizationVariables has not been defined in template %s!", DataResource::getName())); base->getPaletteColorCustomizationVariables(data, index); return; } } - if (m_paletteColorCustomizationVariablesAppend && base != nullptr) + if (m_paletteColorCustomizationVariablesAppend && base != NULL) { int baseCount = base->getPaletteColorCustomizationVariablesCount(); if (index < baseCount) @@ -399,28 +399,28 @@ void SharedTangibleObjectTemplate::getPaletteColorCustomizationVariables(Palette void SharedTangibleObjectTemplate::getPaletteColorCustomizationVariablesMin(PaletteColorCustomizationVariable &data, int index) const { - const SharedTangibleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedTangibleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_paletteColorCustomizationVariablesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter paletteColorCustomizationVariables in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter paletteColorCustomizationVariables has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter paletteColorCustomizationVariables has not been defined in template %s!", DataResource::getName())); base->getPaletteColorCustomizationVariablesMin(data, index); return; } } - if (m_paletteColorCustomizationVariablesAppend && base != nullptr) + if (m_paletteColorCustomizationVariablesAppend && base != NULL) { int baseCount = base->getPaletteColorCustomizationVariablesCount(); if (index < baseCount) @@ -443,28 +443,28 @@ void SharedTangibleObjectTemplate::getPaletteColorCustomizationVariablesMin(Pale void SharedTangibleObjectTemplate::getPaletteColorCustomizationVariablesMax(PaletteColorCustomizationVariable &data, int index) const { - const SharedTangibleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedTangibleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_paletteColorCustomizationVariablesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter paletteColorCustomizationVariables in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter paletteColorCustomizationVariables has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter paletteColorCustomizationVariables has not been defined in template %s!", DataResource::getName())); base->getPaletteColorCustomizationVariablesMax(data, index); return; } } - if (m_paletteColorCustomizationVariablesAppend && base != nullptr) + if (m_paletteColorCustomizationVariablesAppend && base != NULL) { int baseCount = base->getPaletteColorCustomizationVariablesCount(); if (index < baseCount) @@ -489,20 +489,20 @@ size_t SharedTangibleObjectTemplate::getPaletteColorCustomizationVariablesCount( { if (!m_paletteColorCustomizationVariablesLoaded) { - if (m_baseData == nullptr) + if (m_baseData == NULL) return 0; const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == nullptr, ("base template wrong type")); + DEBUG_FATAL(base == NULL, ("base template wrong type")); return base->getPaletteColorCustomizationVariablesCount(); } size_t count = m_paletteColorCustomizationVariables.size(); // if we are extending our base template, add it's count - if (m_paletteColorCustomizationVariablesAppend && m_baseData != nullptr) + if (m_paletteColorCustomizationVariablesAppend && m_baseData != NULL) { const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base != nullptr) + if (base != NULL) count += base->getPaletteColorCustomizationVariablesCount(); } @@ -511,28 +511,28 @@ size_t SharedTangibleObjectTemplate::getPaletteColorCustomizationVariablesCount( void SharedTangibleObjectTemplate::getRangedIntCustomizationVariables(RangedIntCustomizationVariable &data, int index) const { - const SharedTangibleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedTangibleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_rangedIntCustomizationVariablesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter rangedIntCustomizationVariables in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter rangedIntCustomizationVariables has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter rangedIntCustomizationVariables has not been defined in template %s!", DataResource::getName())); base->getRangedIntCustomizationVariables(data, index); return; } } - if (m_rangedIntCustomizationVariablesAppend && base != nullptr) + if (m_rangedIntCustomizationVariablesAppend && base != NULL) { int baseCount = base->getRangedIntCustomizationVariablesCount(); if (index < baseCount) @@ -556,28 +556,28 @@ void SharedTangibleObjectTemplate::getRangedIntCustomizationVariables(RangedIntC void SharedTangibleObjectTemplate::getRangedIntCustomizationVariablesMin(RangedIntCustomizationVariable &data, int index) const { - const SharedTangibleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedTangibleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_rangedIntCustomizationVariablesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter rangedIntCustomizationVariables in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter rangedIntCustomizationVariables has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter rangedIntCustomizationVariables has not been defined in template %s!", DataResource::getName())); base->getRangedIntCustomizationVariablesMin(data, index); return; } } - if (m_rangedIntCustomizationVariablesAppend && base != nullptr) + if (m_rangedIntCustomizationVariablesAppend && base != NULL) { int baseCount = base->getRangedIntCustomizationVariablesCount(); if (index < baseCount) @@ -601,28 +601,28 @@ void SharedTangibleObjectTemplate::getRangedIntCustomizationVariablesMin(RangedI void SharedTangibleObjectTemplate::getRangedIntCustomizationVariablesMax(RangedIntCustomizationVariable &data, int index) const { - const SharedTangibleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedTangibleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_rangedIntCustomizationVariablesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter rangedIntCustomizationVariables in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter rangedIntCustomizationVariables has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter rangedIntCustomizationVariables has not been defined in template %s!", DataResource::getName())); base->getRangedIntCustomizationVariablesMax(data, index); return; } } - if (m_rangedIntCustomizationVariablesAppend && base != nullptr) + if (m_rangedIntCustomizationVariablesAppend && base != NULL) { int baseCount = base->getRangedIntCustomizationVariablesCount(); if (index < baseCount) @@ -648,20 +648,20 @@ size_t SharedTangibleObjectTemplate::getRangedIntCustomizationVariablesCount(voi { if (!m_rangedIntCustomizationVariablesLoaded) { - if (m_baseData == nullptr) + if (m_baseData == NULL) return 0; const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == nullptr, ("base template wrong type")); + DEBUG_FATAL(base == NULL, ("base template wrong type")); return base->getRangedIntCustomizationVariablesCount(); } size_t count = m_rangedIntCustomizationVariables.size(); // if we are extending our base template, add it's count - if (m_rangedIntCustomizationVariablesAppend && m_baseData != nullptr) + if (m_rangedIntCustomizationVariablesAppend && m_baseData != NULL) { const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base != nullptr) + if (base != NULL) count += base->getRangedIntCustomizationVariablesCount(); } @@ -670,28 +670,28 @@ size_t SharedTangibleObjectTemplate::getRangedIntCustomizationVariablesCount(voi void SharedTangibleObjectTemplate::getConstStringCustomizationVariables(ConstStringCustomizationVariable &data, int index) const { - const SharedTangibleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedTangibleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_constStringCustomizationVariablesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter constStringCustomizationVariables in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter constStringCustomizationVariables has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter constStringCustomizationVariables has not been defined in template %s!", DataResource::getName())); base->getConstStringCustomizationVariables(data, index); return; } } - if (m_constStringCustomizationVariablesAppend && base != nullptr) + if (m_constStringCustomizationVariablesAppend && base != NULL) { int baseCount = base->getConstStringCustomizationVariablesCount(); if (index < baseCount) @@ -713,28 +713,28 @@ void SharedTangibleObjectTemplate::getConstStringCustomizationVariables(ConstStr void SharedTangibleObjectTemplate::getConstStringCustomizationVariablesMin(ConstStringCustomizationVariable &data, int index) const { - const SharedTangibleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedTangibleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_constStringCustomizationVariablesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter constStringCustomizationVariables in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter constStringCustomizationVariables has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter constStringCustomizationVariables has not been defined in template %s!", DataResource::getName())); base->getConstStringCustomizationVariablesMin(data, index); return; } } - if (m_constStringCustomizationVariablesAppend && base != nullptr) + if (m_constStringCustomizationVariablesAppend && base != NULL) { int baseCount = base->getConstStringCustomizationVariablesCount(); if (index < baseCount) @@ -756,28 +756,28 @@ void SharedTangibleObjectTemplate::getConstStringCustomizationVariablesMin(Const void SharedTangibleObjectTemplate::getConstStringCustomizationVariablesMax(ConstStringCustomizationVariable &data, int index) const { - const SharedTangibleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedTangibleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_constStringCustomizationVariablesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter constStringCustomizationVariables in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter constStringCustomizationVariables has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter constStringCustomizationVariables has not been defined in template %s!", DataResource::getName())); base->getConstStringCustomizationVariablesMax(data, index); return; } } - if (m_constStringCustomizationVariablesAppend && base != nullptr) + if (m_constStringCustomizationVariablesAppend && base != NULL) { int baseCount = base->getConstStringCustomizationVariablesCount(); if (index < baseCount) @@ -801,20 +801,20 @@ size_t SharedTangibleObjectTemplate::getConstStringCustomizationVariablesCount(v { if (!m_constStringCustomizationVariablesLoaded) { - if (m_baseData == nullptr) + if (m_baseData == NULL) return 0; const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == nullptr, ("base template wrong type")); + DEBUG_FATAL(base == NULL, ("base template wrong type")); return base->getConstStringCustomizationVariablesCount(); } size_t count = m_constStringCustomizationVariables.size(); // if we are extending our base template, add it's count - if (m_constStringCustomizationVariablesAppend && m_baseData != nullptr) + if (m_constStringCustomizationVariablesAppend && m_baseData != NULL) { const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base != nullptr) + if (base != NULL) count += base->getConstStringCustomizationVariablesCount(); } @@ -823,27 +823,27 @@ size_t SharedTangibleObjectTemplate::getConstStringCustomizationVariablesCount(v SharedTangibleObjectTemplate::GameObjectType SharedTangibleObjectTemplate::getSocketDestinations(int index) const { - const SharedTangibleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedTangibleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_socketDestinationsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter socketDestinations in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == nullptr, ("Template parameter socketDestinations has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter socketDestinations has not been defined in template %s!", DataResource::getName())); return base->getSocketDestinations(index); } } - if (m_socketDestinationsAppend && base != nullptr) + if (m_socketDestinationsAppend && base != NULL) { int baseCount = base->getSocketDestinationsCount(); if (index < baseCount) @@ -859,20 +859,20 @@ size_t SharedTangibleObjectTemplate::getSocketDestinationsCount(void) const { if (!m_socketDestinationsLoaded) { - if (m_baseData == nullptr) + if (m_baseData == NULL) return 0; const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == nullptr, ("base template wrong type")); + DEBUG_FATAL(base == NULL, ("base template wrong type")); return base->getSocketDestinationsCount(); } size_t count = m_socketDestinations.size(); // if we are extending our base template, add it's count - if (m_socketDestinationsAppend && m_baseData != nullptr) + if (m_socketDestinationsAppend && m_baseData != NULL) { const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base != nullptr) + if (base != NULL) count += base->getSocketDestinationsCount(); } @@ -887,33 +887,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedTangibleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedTangibleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getStructureFootprintFileName(true); #endif } if (!m_structureFootprintFileName.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter structureFootprintFileName in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter structureFootprintFileName has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter structureFootprintFileName has not been defined in template %s!", DataResource::getName())); return base->getStructureFootprintFileName(); } } const std::string & value = m_structureFootprintFileName.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -929,33 +929,33 @@ bool testDataValue = false; UNREF(testData); #endif - const SharedTangibleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedTangibleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getUseStructureFootprintOutline(true); #endif } if (!m_useStructureFootprintOutline.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter useStructureFootprintOutline in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter useStructureFootprintOutline has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter useStructureFootprintOutline has not been defined in template %s!", DataResource::getName())); return base->getUseStructureFootprintOutline(); } } bool value = m_useStructureFootprintOutline.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -971,33 +971,33 @@ bool testDataValue = false; UNREF(testData); #endif - const SharedTangibleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedTangibleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getTargetable(true); #endif } if (!m_targetable.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter targetable in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter targetable has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter targetable has not been defined in template %s!", DataResource::getName())); return base->getTargetable(); } } bool value = m_targetable.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1007,27 +1007,27 @@ UNREF(testData); const std::string & SharedTangibleObjectTemplate::getCertificationsRequired(int index) const { - const SharedTangibleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedTangibleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_certificationsRequiredLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter certificationsRequired in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter certificationsRequired has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter certificationsRequired has not been defined in template %s!", DataResource::getName())); return base->getCertificationsRequired(index); } } - if (m_certificationsRequiredAppend && base != nullptr) + if (m_certificationsRequiredAppend && base != NULL) { int baseCount = base->getCertificationsRequiredCount(); if (index < baseCount) @@ -1044,20 +1044,20 @@ size_t SharedTangibleObjectTemplate::getCertificationsRequiredCount(void) const { if (!m_certificationsRequiredLoaded) { - if (m_baseData == nullptr) + if (m_baseData == NULL) return 0; const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == nullptr, ("base template wrong type")); + DEBUG_FATAL(base == NULL, ("base template wrong type")); return base->getCertificationsRequiredCount(); } size_t count = m_certificationsRequired.size(); // if we are extending our base template, add it's count - if (m_certificationsRequiredAppend && m_baseData != nullptr) + if (m_certificationsRequiredAppend && m_baseData != NULL) { const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base != nullptr) + if (base != NULL) count += base->getCertificationsRequiredCount(); } @@ -1066,28 +1066,28 @@ size_t SharedTangibleObjectTemplate::getCertificationsRequiredCount(void) const void SharedTangibleObjectTemplate::getCustomizationVariableMapping(CustomizationVariableMapping &data, int index) const { - const SharedTangibleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedTangibleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_customizationVariableMappingLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter customizationVariableMapping in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter customizationVariableMapping has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter customizationVariableMapping has not been defined in template %s!", DataResource::getName())); base->getCustomizationVariableMapping(data, index); return; } } - if (m_customizationVariableMappingAppend && base != nullptr) + if (m_customizationVariableMappingAppend && base != NULL) { int baseCount = base->getCustomizationVariableMappingCount(); if (index < baseCount) @@ -1109,28 +1109,28 @@ void SharedTangibleObjectTemplate::getCustomizationVariableMapping(Customization void SharedTangibleObjectTemplate::getCustomizationVariableMappingMin(CustomizationVariableMapping &data, int index) const { - const SharedTangibleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedTangibleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_customizationVariableMappingLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter customizationVariableMapping in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter customizationVariableMapping has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter customizationVariableMapping has not been defined in template %s!", DataResource::getName())); base->getCustomizationVariableMappingMin(data, index); return; } } - if (m_customizationVariableMappingAppend && base != nullptr) + if (m_customizationVariableMappingAppend && base != NULL) { int baseCount = base->getCustomizationVariableMappingCount(); if (index < baseCount) @@ -1152,28 +1152,28 @@ void SharedTangibleObjectTemplate::getCustomizationVariableMappingMin(Customizat void SharedTangibleObjectTemplate::getCustomizationVariableMappingMax(CustomizationVariableMapping &data, int index) const { - const SharedTangibleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedTangibleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } if (!m_customizationVariableMappingLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter customizationVariableMapping in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter customizationVariableMapping has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter customizationVariableMapping has not been defined in template %s!", DataResource::getName())); base->getCustomizationVariableMappingMax(data, index); return; } } - if (m_customizationVariableMappingAppend && base != nullptr) + if (m_customizationVariableMappingAppend && base != NULL) { int baseCount = base->getCustomizationVariableMappingCount(); if (index < baseCount) @@ -1197,20 +1197,20 @@ size_t SharedTangibleObjectTemplate::getCustomizationVariableMappingCount(void) { if (!m_customizationVariableMappingLoaded) { - if (m_baseData == nullptr) + if (m_baseData == NULL) return 0; const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == nullptr, ("base template wrong type")); + DEBUG_FATAL(base == NULL, ("base template wrong type")); return base->getCustomizationVariableMappingCount(); } size_t count = m_customizationVariableMapping.size(); // if we are extending our base template, add it's count - if (m_customizationVariableMappingAppend && m_baseData != nullptr) + if (m_customizationVariableMappingAppend && m_baseData != NULL) { const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base != nullptr) + if (base != NULL) count += base->getCustomizationVariableMappingCount(); } @@ -1225,33 +1225,33 @@ SharedTangibleObjectTemplate::ClientVisabilityFlags testDataValue = static_cast< UNREF(testData); #endif - const SharedTangibleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedTangibleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getClientVisabilityFlag(true); #endif } if (!m_clientVisabilityFlag.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter clientVisabilityFlag in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == nullptr, ("Template parameter clientVisabilityFlag has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter clientVisabilityFlag has not been defined in template %s!", DataResource::getName())); return base->getClientVisabilityFlag(); } } ClientVisabilityFlags value = static_cast(m_clientVisabilityFlag.getValue()); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1300,12 +1300,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } @@ -1334,7 +1334,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_paletteColorCustomizationVariables.begin(); iter != m_paletteColorCustomizationVariables.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_paletteColorCustomizationVariables.clear(); m_paletteColorCustomizationVariablesAppend = file.read_bool8(); @@ -1353,7 +1353,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_rangedIntCustomizationVariables.begin(); iter != m_rangedIntCustomizationVariables.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_rangedIntCustomizationVariables.clear(); m_rangedIntCustomizationVariablesAppend = file.read_bool8(); @@ -1372,7 +1372,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_constStringCustomizationVariables.begin(); iter != m_constStringCustomizationVariables.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_constStringCustomizationVariables.clear(); m_constStringCustomizationVariablesAppend = file.read_bool8(); @@ -1391,7 +1391,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_socketDestinations.begin(); iter != m_socketDestinations.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_socketDestinations.clear(); m_socketDestinationsAppend = file.read_bool8(); @@ -1416,7 +1416,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_certificationsRequired.begin(); iter != m_certificationsRequired.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_certificationsRequired.clear(); m_certificationsRequiredAppend = file.read_bool8(); @@ -1435,7 +1435,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_customizationVariableMapping.begin(); iter != m_customizationVariableMapping.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_customizationVariableMapping.clear(); m_customizationVariableMappingAppend = file.read_bool8(); @@ -1514,33 +1514,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_ConstStringCustomizationVariable * base = nullptr; - if (m_baseData != nullptr) + const SharedTangibleObjectTemplate::_ConstStringCustomizationVariable * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getVariableName(true); #endif } if (!m_variableName.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter variableName in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter variableName has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter variableName has not been defined in template %s!", DataResource::getName())); return base->getVariableName(versionOk); } } const std::string & value = m_variableName.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1556,33 +1556,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_ConstStringCustomizationVariable * base = nullptr; - if (m_baseData != nullptr) + const SharedTangibleObjectTemplate::_ConstStringCustomizationVariable * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getConstValue(true); #endif } if (!m_constValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter constValue in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter constValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter constValue has not been defined in template %s!", DataResource::getName())); return base->getConstValue(versionOk); } } const std::string & value = m_constValue.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1687,33 +1687,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_CustomizationVariableMapping * base = nullptr; - if (m_baseData != nullptr) + const SharedTangibleObjectTemplate::_CustomizationVariableMapping * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getSourceVariable(true); #endif } if (!m_sourceVariable.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter sourceVariable in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter sourceVariable has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter sourceVariable has not been defined in template %s!", DataResource::getName())); return base->getSourceVariable(versionOk); } } const std::string & value = m_sourceVariable.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1729,33 +1729,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_CustomizationVariableMapping * base = nullptr; - if (m_baseData != nullptr) + const SharedTangibleObjectTemplate::_CustomizationVariableMapping * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getDependentVariable(true); #endif } if (!m_dependentVariable.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter dependentVariable in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter dependentVariable has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter dependentVariable has not been defined in template %s!", DataResource::getName())); return base->getDependentVariable(versionOk); } } const std::string & value = m_dependentVariable.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1860,33 +1860,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = nullptr; - if (m_baseData != nullptr) + const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getVariableName(true); #endif } if (!m_variableName.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter variableName in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter variableName has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter variableName has not been defined in template %s!", DataResource::getName())); return base->getVariableName(versionOk); } } const std::string & value = m_variableName.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1902,33 +1902,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = nullptr; - if (m_baseData != nullptr) + const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getPalettePathName(true); #endif } if (!m_palettePathName.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter palettePathName in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter palettePathName has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter palettePathName has not been defined in template %s!", DataResource::getName())); return base->getPalettePathName(versionOk); } } const std::string & value = m_palettePathName.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1944,26 +1944,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = nullptr; - if (m_baseData != nullptr) + const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getDefaultPaletteIndex(true); #endif } if (!m_defaultPaletteIndex.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter defaultPaletteIndex in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter defaultPaletteIndex has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter defaultPaletteIndex has not been defined in template %s!", DataResource::getName())); return base->getDefaultPaletteIndex(versionOk); } } @@ -1973,9 +1973,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getDefaultPaletteIndex(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1992,7 +1992,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2008,26 +2008,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = nullptr; - if (m_baseData != nullptr) + const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getDefaultPaletteIndexMin(true); #endif } if (!m_defaultPaletteIndex.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter defaultPaletteIndex in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter defaultPaletteIndex has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter defaultPaletteIndex has not been defined in template %s!", DataResource::getName())); return base->getDefaultPaletteIndexMin(versionOk); } } @@ -2037,9 +2037,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getDefaultPaletteIndexMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2056,7 +2056,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2072,26 +2072,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = nullptr; - if (m_baseData != nullptr) + const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getDefaultPaletteIndexMax(true); #endif } if (!m_defaultPaletteIndex.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter defaultPaletteIndex in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter defaultPaletteIndex has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter defaultPaletteIndex has not been defined in template %s!", DataResource::getName())); return base->getDefaultPaletteIndexMax(versionOk); } } @@ -2101,9 +2101,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getDefaultPaletteIndexMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2120,7 +2120,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2229,33 +2229,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; - if (m_baseData != nullptr) + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getVariableName(true); #endif } if (!m_variableName.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter variableName in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter variableName has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter variableName has not been defined in template %s!", DataResource::getName())); return base->getVariableName(versionOk); } } const std::string & value = m_variableName.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2271,26 +2271,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; - if (m_baseData != nullptr) + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMinValueInclusive(true); #endif } if (!m_minValueInclusive.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter minValueInclusive in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter minValueInclusive has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter minValueInclusive has not been defined in template %s!", DataResource::getName())); return base->getMinValueInclusive(versionOk); } } @@ -2300,9 +2300,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMinValueInclusive(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2319,7 +2319,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2335,26 +2335,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; - if (m_baseData != nullptr) + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMinValueInclusiveMin(true); #endif } if (!m_minValueInclusive.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter minValueInclusive in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter minValueInclusive has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter minValueInclusive has not been defined in template %s!", DataResource::getName())); return base->getMinValueInclusiveMin(versionOk); } } @@ -2364,9 +2364,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMinValueInclusiveMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2383,7 +2383,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2399,26 +2399,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; - if (m_baseData != nullptr) + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMinValueInclusiveMax(true); #endif } if (!m_minValueInclusive.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter minValueInclusive in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter minValueInclusive has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter minValueInclusive has not been defined in template %s!", DataResource::getName())); return base->getMinValueInclusiveMax(versionOk); } } @@ -2428,9 +2428,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMinValueInclusiveMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2447,7 +2447,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2463,26 +2463,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; - if (m_baseData != nullptr) + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getDefaultValue(true); #endif } if (!m_defaultValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter defaultValue in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter defaultValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter defaultValue has not been defined in template %s!", DataResource::getName())); return base->getDefaultValue(versionOk); } } @@ -2492,9 +2492,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getDefaultValue(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2511,7 +2511,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2527,26 +2527,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; - if (m_baseData != nullptr) + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getDefaultValueMin(true); #endif } if (!m_defaultValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter defaultValue in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter defaultValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter defaultValue has not been defined in template %s!", DataResource::getName())); return base->getDefaultValueMin(versionOk); } } @@ -2556,9 +2556,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getDefaultValueMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2575,7 +2575,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2591,26 +2591,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; - if (m_baseData != nullptr) + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getDefaultValueMax(true); #endif } if (!m_defaultValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter defaultValue in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter defaultValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter defaultValue has not been defined in template %s!", DataResource::getName())); return base->getDefaultValueMax(versionOk); } } @@ -2620,9 +2620,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getDefaultValueMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2639,7 +2639,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2655,26 +2655,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; - if (m_baseData != nullptr) + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMaxValueExclusive(true); #endif } if (!m_maxValueExclusive.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxValueExclusive in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter maxValueExclusive has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter maxValueExclusive has not been defined in template %s!", DataResource::getName())); return base->getMaxValueExclusive(versionOk); } } @@ -2684,9 +2684,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMaxValueExclusive(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2703,7 +2703,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2719,26 +2719,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; - if (m_baseData != nullptr) + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMaxValueExclusiveMin(true); #endif } if (!m_maxValueExclusive.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxValueExclusive in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter maxValueExclusive has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter maxValueExclusive has not been defined in template %s!", DataResource::getName())); return base->getMaxValueExclusiveMin(versionOk); } } @@ -2748,9 +2748,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMaxValueExclusiveMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2767,7 +2767,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -2783,26 +2783,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; - if (m_baseData != nullptr) + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMaxValueExclusiveMax(true); #endif } if (!m_maxValueExclusive.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxValueExclusive in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter maxValueExclusive has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter maxValueExclusive has not been defined in template %s!", DataResource::getName())); return base->getMaxValueExclusiveMax(versionOk); } } @@ -2812,9 +2812,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMaxValueExclusiveMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2831,7 +2831,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTerrainSurfaceObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTerrainSurfaceObjectTemplate.cpp index b518a9f7..cd2c216b 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTerrainSurfaceObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTerrainSurfaceObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedTerrainSurfaceObjectTemplate::getTemplateVersion(void) const */ Tag SharedTerrainSurfaceObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedTerrainSurfaceObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedTerrainSurfaceObjectTemplate::getHighestTemplateVersion @@ -111,26 +111,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedTerrainSurfaceObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedTerrainSurfaceObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getCover(true); #endif } if (!m_cover.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter cover in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter cover has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter cover has not been defined in template %s!", DataResource::getName())); return base->getCover(); } } @@ -140,9 +140,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getCover(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -159,7 +159,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { if (testDataValue == value) DEBUG_WARNING(true, ("Template %s, parameter cover is returning same value as base template.", DataResource::getName())); @@ -177,26 +177,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedTerrainSurfaceObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedTerrainSurfaceObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getCoverMin(true); #endif } if (!m_cover.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter cover in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter cover has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter cover has not been defined in template %s!", DataResource::getName())); return base->getCoverMin(); } } @@ -206,9 +206,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getCoverMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -225,7 +225,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { if (testDataValue == value) DEBUG_WARNING(true, ("Template %s, parameter cover is returning same value as base template.", DataResource::getName())); @@ -243,26 +243,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedTerrainSurfaceObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedTerrainSurfaceObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getCoverMax(true); #endif } if (!m_cover.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter cover in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter cover has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter cover has not been defined in template %s!", DataResource::getName())); return base->getCoverMax(); } } @@ -272,9 +272,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getCoverMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -291,7 +291,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { if (testDataValue == value) DEBUG_WARNING(true, ("Template %s, parameter cover is returning same value as base template.", DataResource::getName())); @@ -309,33 +309,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedTerrainSurfaceObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedTerrainSurfaceObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getSurfaceType(true); #endif } if (!m_surfaceType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter surfaceType in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter surfaceType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter surfaceType has not been defined in template %s!", DataResource::getName())); return base->getSurfaceType(); } } const std::string & value = m_surfaceType.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { if (testDataValue == value) DEBUG_WARNING(true, ("Template %s, parameter surfaceType is returning same value as base template.", DataResource::getName())); @@ -383,12 +383,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedUniverseObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedUniverseObjectTemplate.cpp index c6e9b692..adf09d85 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedUniverseObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedUniverseObjectTemplate.cpp @@ -95,10 +95,10 @@ Tag SharedUniverseObjectTemplate::getTemplateVersion(void) const */ Tag SharedUniverseObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedUniverseObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedUniverseObjectTemplate::getHighestTemplateVersion @@ -141,12 +141,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedVehicleObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedVehicleObjectTemplate.cpp index 7467cf59..ccc2cb77 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedVehicleObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedVehicleObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedVehicleObjectTemplate::getTemplateVersion(void) const */ Tag SharedVehicleObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedVehicleObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedVehicleObjectTemplate::getHighestTemplateVersion @@ -105,8 +105,8 @@ Tag SharedVehicleObjectTemplate::getHighestTemplateVersion(void) const //@BEGIN TFD float SharedVehicleObjectTemplate::getSpeed(MovementTypes index) const { - const SharedVehicleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedVehicleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } @@ -114,14 +114,14 @@ float SharedVehicleObjectTemplate::getSpeed(MovementTypes index) const DEBUG_FATAL(index < 0 || index >= 5, ("template param index out of range")); if (!m_speed[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter speed in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter speed has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter speed has not been defined in template %s!", DataResource::getName())); return base->getSpeed(index); } } @@ -131,9 +131,9 @@ float SharedVehicleObjectTemplate::getSpeed(MovementTypes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getSpeed(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -154,8 +154,8 @@ float SharedVehicleObjectTemplate::getSpeed(MovementTypes index) const float SharedVehicleObjectTemplate::getSpeedMin(MovementTypes index) const { - const SharedVehicleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedVehicleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } @@ -163,14 +163,14 @@ float SharedVehicleObjectTemplate::getSpeedMin(MovementTypes index) const DEBUG_FATAL(index < 0 || index >= 5, ("template param index out of range")); if (!m_speed[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter speed in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter speed has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter speed has not been defined in template %s!", DataResource::getName())); return base->getSpeedMin(index); } } @@ -180,9 +180,9 @@ float SharedVehicleObjectTemplate::getSpeedMin(MovementTypes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getSpeedMin(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -203,8 +203,8 @@ float SharedVehicleObjectTemplate::getSpeedMin(MovementTypes index) const float SharedVehicleObjectTemplate::getSpeedMax(MovementTypes index) const { - const SharedVehicleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedVehicleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); } @@ -212,14 +212,14 @@ float SharedVehicleObjectTemplate::getSpeedMax(MovementTypes index) const DEBUG_FATAL(index < 0 || index >= 5, ("template param index out of range")); if (!m_speed[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter speed in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter speed has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter speed has not been defined in template %s!", DataResource::getName())); return base->getSpeedMax(index); } } @@ -229,9 +229,9 @@ float SharedVehicleObjectTemplate::getSpeedMax(MovementTypes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getSpeedMax(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -258,26 +258,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedVehicleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getSlopeAversion(true); #endif } if (!m_slopeAversion.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter slopeAversion in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter slopeAversion has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter slopeAversion has not been defined in template %s!", DataResource::getName())); return base->getSlopeAversion(); } } @@ -287,9 +287,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getSlopeAversion(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -306,7 +306,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -322,26 +322,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedVehicleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getSlopeAversionMin(true); #endif } if (!m_slopeAversion.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter slopeAversion in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter slopeAversion has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter slopeAversion has not been defined in template %s!", DataResource::getName())); return base->getSlopeAversionMin(); } } @@ -351,9 +351,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getSlopeAversionMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -370,7 +370,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -386,26 +386,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedVehicleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getSlopeAversionMax(true); #endif } if (!m_slopeAversion.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter slopeAversion in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter slopeAversion has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter slopeAversion has not been defined in template %s!", DataResource::getName())); return base->getSlopeAversionMax(); } } @@ -415,9 +415,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getSlopeAversionMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -434,7 +434,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -450,26 +450,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedVehicleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getHoverValue(true); #endif } if (!m_hoverValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter hoverValue in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter hoverValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter hoverValue has not been defined in template %s!", DataResource::getName())); return base->getHoverValue(); } } @@ -479,9 +479,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getHoverValue(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -498,7 +498,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -514,26 +514,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedVehicleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getHoverValueMin(true); #endif } if (!m_hoverValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter hoverValue in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter hoverValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter hoverValue has not been defined in template %s!", DataResource::getName())); return base->getHoverValueMin(); } } @@ -543,9 +543,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getHoverValueMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -562,7 +562,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -578,26 +578,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedVehicleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getHoverValueMax(true); #endif } if (!m_hoverValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter hoverValue in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter hoverValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter hoverValue has not been defined in template %s!", DataResource::getName())); return base->getHoverValueMax(); } } @@ -607,9 +607,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getHoverValueMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -626,7 +626,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -642,26 +642,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedVehicleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getTurnRate(true); #endif } if (!m_turnRate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter turnRate in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter turnRate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter turnRate has not been defined in template %s!", DataResource::getName())); return base->getTurnRate(); } } @@ -671,9 +671,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getTurnRate(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -690,7 +690,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -706,26 +706,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedVehicleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getTurnRateMin(true); #endif } if (!m_turnRate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter turnRate in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter turnRate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter turnRate has not been defined in template %s!", DataResource::getName())); return base->getTurnRateMin(); } } @@ -735,9 +735,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getTurnRateMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -754,7 +754,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -770,26 +770,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedVehicleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getTurnRateMax(true); #endif } if (!m_turnRate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter turnRate in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter turnRate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter turnRate has not been defined in template %s!", DataResource::getName())); return base->getTurnRateMax(); } } @@ -799,9 +799,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getTurnRateMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -818,7 +818,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -834,26 +834,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedVehicleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMaxVelocity(true); #endif } if (!m_maxVelocity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxVelocity in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter maxVelocity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter maxVelocity has not been defined in template %s!", DataResource::getName())); return base->getMaxVelocity(); } } @@ -863,9 +863,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMaxVelocity(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -882,7 +882,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -898,26 +898,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedVehicleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMaxVelocityMin(true); #endif } if (!m_maxVelocity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxVelocity in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter maxVelocity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter maxVelocity has not been defined in template %s!", DataResource::getName())); return base->getMaxVelocityMin(); } } @@ -927,9 +927,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMaxVelocityMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -946,7 +946,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -962,26 +962,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedVehicleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getMaxVelocityMax(true); #endif } if (!m_maxVelocity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxVelocity in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter maxVelocity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter maxVelocity has not been defined in template %s!", DataResource::getName())); return base->getMaxVelocityMax(); } } @@ -991,9 +991,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getMaxVelocityMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1010,7 +1010,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1026,26 +1026,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedVehicleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getAcceleration(true); #endif } if (!m_acceleration.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter acceleration in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter acceleration has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter acceleration has not been defined in template %s!", DataResource::getName())); return base->getAcceleration(); } } @@ -1055,9 +1055,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getAcceleration(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1074,7 +1074,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1090,26 +1090,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedVehicleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getAccelerationMin(true); #endif } if (!m_acceleration.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter acceleration in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter acceleration has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter acceleration has not been defined in template %s!", DataResource::getName())); return base->getAccelerationMin(); } } @@ -1119,9 +1119,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getAccelerationMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1138,7 +1138,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1154,26 +1154,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedVehicleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getAccelerationMax(true); #endif } if (!m_acceleration.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter acceleration in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter acceleration has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter acceleration has not been defined in template %s!", DataResource::getName())); return base->getAccelerationMax(); } } @@ -1183,9 +1183,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getAccelerationMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1202,7 +1202,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1218,26 +1218,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedVehicleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getBraking(true); #endif } if (!m_braking.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter braking in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter braking has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter braking has not been defined in template %s!", DataResource::getName())); return base->getBraking(); } } @@ -1247,9 +1247,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getBraking(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1266,7 +1266,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1282,26 +1282,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedVehicleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getBrakingMin(true); #endif } if (!m_braking.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter braking in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter braking has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter braking has not been defined in template %s!", DataResource::getName())); return base->getBrakingMin(); } } @@ -1311,9 +1311,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getBrakingMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1330,7 +1330,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1346,26 +1346,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedVehicleObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getBrakingMax(true); #endif } if (!m_braking.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter braking in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter braking has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter braking has not been defined in template %s!", DataResource::getName())); return base->getBrakingMax(); } } @@ -1375,9 +1375,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getBrakingMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1394,7 +1394,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -1451,12 +1451,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWaypointObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWaypointObjectTemplate.cpp index 2d82cd46..71ef4b39 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWaypointObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWaypointObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedWaypointObjectTemplate::getTemplateVersion(void) const */ Tag SharedWaypointObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedWaypointObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedWaypointObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWeaponObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWeaponObjectTemplate.cpp index 193d4ac7..7c9fa977 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWeaponObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWeaponObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedWeaponObjectTemplate::getTemplateVersion(void) const */ Tag SharedWeaponObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedWeaponObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedWeaponObjectTemplate::getHighestTemplateVersion @@ -111,33 +111,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedWeaponObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedWeaponObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getWeaponEffect(true); #endif } if (!m_weaponEffect.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter weaponEffect in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter weaponEffect has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter weaponEffect has not been defined in template %s!", DataResource::getName())); return base->getWeaponEffect(); } } const std::string & value = m_weaponEffect.getValue(); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -153,26 +153,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedWeaponObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedWeaponObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getWeaponEffectIndex(true); #endif } if (!m_weaponEffectIndex.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter weaponEffectIndex in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter weaponEffectIndex has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter weaponEffectIndex has not been defined in template %s!", DataResource::getName())); return base->getWeaponEffectIndex(); } } @@ -182,9 +182,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getWeaponEffectIndex(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -201,7 +201,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -217,26 +217,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedWeaponObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedWeaponObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getWeaponEffectIndexMin(true); #endif } if (!m_weaponEffectIndex.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter weaponEffectIndex in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter weaponEffectIndex has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter weaponEffectIndex has not been defined in template %s!", DataResource::getName())); return base->getWeaponEffectIndexMin(); } } @@ -246,9 +246,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getWeaponEffectIndexMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -265,7 +265,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -281,26 +281,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedWeaponObjectTemplate * base = nullptr; - if (m_baseData != nullptr) + const SharedWeaponObjectTemplate * base = NULL; + if (m_baseData != NULL) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getWeaponEffectIndexMax(true); #endif } if (!m_weaponEffectIndex.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter weaponEffectIndex in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == nullptr, ("Template parameter weaponEffectIndex has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter weaponEffectIndex has not been defined in template %s!", DataResource::getName())); return base->getWeaponEffectIndexMax(); } } @@ -310,9 +310,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != nullptr) + if (m_baseData != NULL) { - if (base != nullptr) + if (base != NULL) baseValue = base->getWeaponEffectIndexMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -329,7 +329,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -345,33 +345,33 @@ SharedWeaponObjectTemplate::AttackType testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) testDataValue = base->getAttackType(true); #endif } if (!m_attackType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) { DEBUG_WARNING(true, ("Returning default value for missing parameter attackType in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == nullptr, ("Template parameter attackType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == NULL, ("Template parameter attackType has not been defined in template %s!", DataResource::getName())); return base->getAttackType(); } } AttackType value = static_cast(m_attackType.getValue()); #ifdef _DEBUG - if (testData && base != nullptr) + if (testData && base != NULL) { } #endif @@ -420,12 +420,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/quest/Quest.cpp b/engine/shared/library/sharedGame/src/shared/quest/Quest.cpp index 14d2fcab..7cfaccef 100755 --- a/engine/shared/library/sharedGame/src/shared/quest/Quest.cpp +++ b/engine/shared/library/sharedGame/src/shared/quest/Quest.cpp @@ -358,7 +358,7 @@ int Quest::getNumberOfTasks() const QuestTask const * Quest::getTask(int const taskId) const { if (taskId < 0 || taskId >= getNumberOfTasks()) - return nullptr; + return NULL; return (*m_tasks)[static_cast(taskId)]; } diff --git a/engine/shared/library/sharedGame/src/shared/quest/QuestManager.cpp b/engine/shared/library/sharedGame/src/shared/quest/QuestManager.cpp index 3ba36a15..ef210b43 100755 --- a/engine/shared/library/sharedGame/src/shared/quest/QuestManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/quest/QuestManager.cpp @@ -192,7 +192,7 @@ void QuestManager::remove() Quest const * QuestManager::getQuest(CrcString const & fileName) { Quest const * const quest = getQuest(fileName.getCrc()); - DEBUG_WARNING(quest == nullptr, ("QuestManager::getQuest(%s): FAILED - testquest not found", fileName.getString())); + DEBUG_WARNING(quest == NULL, ("QuestManager::getQuest(%s): FAILED - testquest not found", fileName.getString())); return quest; } @@ -200,7 +200,7 @@ Quest const * QuestManager::getQuest(CrcString const & fileName) Quest const * QuestManager::getQuest(uint32 const questCrc) { - Quest * quest = nullptr; + Quest * quest = NULL; //-- Look for the quest in the quest map QuestMap::iterator const iter = s_quests.find(questCrc); @@ -223,7 +223,7 @@ Quest const * QuestManager::getQuest(uint32 const questCrc) } } - DEBUG_WARNING(quest == nullptr, ("QuestManager::getQuest: FAILED - testquest not found")); + DEBUG_WARNING(quest == NULL, ("QuestManager::getQuest: FAILED - testquest not found")); return quest; } @@ -234,7 +234,7 @@ Quest const * QuestManager::getQuest(std::string const & questName) { TemporaryCrcString const fileName(questName.c_str(), true); Quest const * const quest = getQuest(fileName); - DEBUG_WARNING(quest == nullptr, ("QuestManager::getQuest(%s): FAILED - testquest not found", questName.c_str())); + DEBUG_WARNING(quest == NULL, ("QuestManager::getQuest(%s): FAILED - testquest not found", questName.c_str())); return quest; } diff --git a/engine/shared/library/sharedGame/src/shared/space/AsteroidGenerationManager.cpp b/engine/shared/library/sharedGame/src/shared/space/AsteroidGenerationManager.cpp index 2fabba5e..26b912b2 100755 --- a/engine/shared/library/sharedGame/src/shared/space/AsteroidGenerationManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/space/AsteroidGenerationManager.cpp @@ -79,7 +79,7 @@ void AsteroidGenerationManager::install() DEBUG_FATAL(s_installed, ("AsteroidGenerationManager already installed")); s_installed = true; - ms_getRadiusFunction = nullptr; + ms_getRadiusFunction = NULL; ExitChain::add(AsteroidGenerationManager::remove, "AsteroidGenerationManager::remove"); } @@ -88,7 +88,7 @@ void AsteroidGenerationManager::install() void AsteroidGenerationManager::remove() { - ms_getRadiusFunction = nullptr; + ms_getRadiusFunction = NULL; clearStaticFieldData(); clearInstantiatedData(); @@ -381,7 +381,7 @@ bool AsteroidGenerationManager::generateField(AsteroidFieldData const & fieldDat s_randomGenerator.setSeed(fieldData.seed); - WaveForm3D * splineWaveform = nullptr; + WaveForm3D * splineWaveform = NULL; if (fieldData.fieldType == AsteroidFieldData::FT_spline) { splineWaveform = new WaveForm3D; @@ -403,7 +403,7 @@ bool AsteroidGenerationManager::generateField(AsteroidFieldData const & fieldDat { bool valid = false; std::vector collisionResult; - Sphere * s = nullptr; + Sphere * s = NULL; while(!valid) { //create asteroid locations until we find one that doesn't penetrate any existing objects @@ -444,11 +444,11 @@ bool AsteroidGenerationManager::generateField(AsteroidFieldData const & fieldDat { DEBUG_REPORT_LOG_PRINT(ConfigSharedGame::getSpamAsteroidGenerationData(), ("Asteroid creation collision at [%f, %f, %f], radius [%f], trying again...\n", newAsteroid.position.x, newAsteroid.position.y, newAsteroid.position.z, s->getRadius())); delete s; - s = nullptr; + s = NULL; } } - NOT_NULL(s); //lint !e644 // s could be uninitialized (not true -- initialized to nullptr above, should be set to a value during the while loop) + NOT_NULL(s); //lint !e644 // s could be uninitialized (not true -- initialized to NULL above, should be set to a value during the while loop) SpatialSubdivisionHandle* handle = ms_collisionSphereTree.addObject(s); if(handle) diff --git a/engine/shared/library/sharedGame/src/shared/space/NebulaManager.cpp b/engine/shared/library/sharedGame/src/shared/space/NebulaManager.cpp index e48dc276..803c5a76 100755 --- a/engine/shared/library/sharedGame/src/shared/space/NebulaManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/space/NebulaManager.cpp @@ -52,7 +52,7 @@ namespace NebulaManagerNamespace }; typedef SphereTree NebulaSphereTree; - NebulaSphereTree * s_collisionSphereTree = nullptr; + NebulaSphereTree * s_collisionSphereTree = NULL; enum DatatableColumns { @@ -110,7 +110,7 @@ namespace NebulaManagerNamespace //---------------------------------------------------------------------- - NebulaManager::ImplementationClearFunction s_clearFunction = nullptr; + NebulaManager::ImplementationClearFunction s_clearFunction = NULL; } using namespace NebulaManagerNamespace; @@ -158,10 +158,10 @@ void NebulaManager::clear() s_nebulaMap.clear(); - if (s_collisionSphereTree != nullptr) + if (s_collisionSphereTree != NULL) { delete s_collisionSphereTree; - s_collisionSphereTree = nullptr; + s_collisionSphereTree = NULL; } //-- Remove nebulas for the current scene from the scene map @@ -178,7 +178,7 @@ void NebulaManager::clear() s_currentSceneId.clear(); - if (s_clearFunction != nullptr) + if (s_clearFunction != NULL) s_clearFunction(); } @@ -319,11 +319,11 @@ void NebulaManager::getNebulasInSphere(Vector const & pos, float const radius, N Nebula const * NebulaManager::getClosestNebula(Vector const & pos, float const maxDistance, float & outMinDistance, float & outMaxDistance) { - Nebula const * nebula = nullptr; + Nebula const * nebula = NULL; if (NON_NULL(s_collisionSphereTree)->findClosest(pos, maxDistance, nebula, outMinDistance, outMaxDistance)) return nebula; - return nullptr; + return NULL; } //---------------------------------------------------------------------- @@ -334,7 +334,7 @@ Nebula const * NebulaManager::getNebulaById(int const id) if (it != s_nebulaMap.end()) return (*it).second; - return nullptr; + return NULL; } //---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedGame/src/shared/space/ShipChassis.cpp b/engine/shared/library/sharedGame/src/shared/space/ShipChassis.cpp index 6d014f13..ab3b0672 100755 --- a/engine/shared/library/sharedGame/src/shared/space/ShipChassis.cpp +++ b/engine/shared/library/sharedGame/src/shared/space/ShipChassis.cpp @@ -211,7 +211,7 @@ bool ShipChassis::save(std::string const & filename) ShipChassisSlot const * const chassisSlot = shipChassis->getSlot(static_cast(chassisSlotType)); - if (nullptr == chassisSlot) + if (NULL == chassisSlot) { tabStr += "\t\t"; continue; @@ -249,7 +249,7 @@ bool ShipChassis::save(std::string const & filename) StdioFileFactory sff; AbstractFile * const af = sff.createFile(filename.c_str(), "wb"); - if (nullptr != af && af->isOpen()) + if (NULL != af && af->isOpen()) { int const bytesWritten = af->write(static_cast(tabStr.size()), tabStr.c_str()); retval = (bytesWritten == static_cast(tabStr.size())); @@ -317,7 +317,7 @@ ShipChassis const * ShipChassis::findShipChassisByName (CrcString const & if (it != s_nameChassisMap->end ()) return (*it).second; - return nullptr; + return NULL; } //---------------------------------------------------------------------- @@ -330,7 +330,7 @@ ShipChassis const * ShipChassis::findShipChassisByCrc (uint32 chassis if (it != s_crcChassisMap.end ()) return (*it).second; - return nullptr; + return NULL; } //---------------------------------------------------------------------- @@ -365,7 +365,7 @@ void ShipChassis::setSlotTargetable(int const chassisSlotType, bool targetable) { if (targetable) { - if (nullptr == getSlot(static_cast(chassisSlotType))) + if (NULL == getSlot(static_cast(chassisSlotType))) { WARNING(true, ("ShipChassis cannot set non existant slot [%d] targetable", chassisSlotType)); return; @@ -398,7 +398,7 @@ ShipChassisSlot * ShipChassis::getSlot(ShipChassisSlotType::Type shipChassisSlot return &slot; } - return nullptr; + return NULL; } //---------------------------------------------------------------------- @@ -582,7 +582,7 @@ void ShipChassis::setUseWritableChassis(bool onlyUseThisForTools) bool ShipChassis::addChassis(bool doSort) { - if (doSort && nullptr != findShipChassisByCrc(getCrc())) + if (doSort && NULL != findShipChassisByCrc(getCrc())) { WARNING(true, ("ShipChassis attempt to add multiple [%s] chassis", getName().getString())); return false; @@ -628,7 +628,7 @@ bool ShipChassis::removeChassis() bool ShipChassis::setName(CrcString const & name) { ShipChassis const * const dupeNameShipChassis = findShipChassisByName(name); - if (nullptr != dupeNameShipChassis) + if (NULL != dupeNameShipChassis) { WARNING(true, ("ShipChassis attempt to set name [%s] already exists", name.getString())); return false; diff --git a/engine/shared/library/sharedGame/src/shared/space/ShipChassisSlot.cpp b/engine/shared/library/sharedGame/src/shared/space/ShipChassisSlot.cpp index 0830d52c..dec4fd3e 100755 --- a/engine/shared/library/sharedGame/src/shared/space/ShipChassisSlot.cpp +++ b/engine/shared/library/sharedGame/src/shared/space/ShipChassisSlot.cpp @@ -78,7 +78,7 @@ ShipChassisSlot::~ShipChassisSlot () std::for_each(m_compatibilities->begin(), m_compatibilities->end(), PointerDeleter()); m_compatibilities->clear(); delete m_compatibilities; - m_compatibilities = nullptr; + m_compatibilities = NULL; } //---------------------------------------------------------------------- @@ -145,7 +145,7 @@ bool ShipChassisSlot::canAcceptComponentType (int shipComponentType) const bool ShipChassisSlot::canAcceptCompatibility (CrcString const & compatibility) const { - //-- nullptr compatibility components are universally accepted + //-- null compatibility components are universally accepted if (compatibility.isEmpty ()) return true; diff --git a/engine/shared/library/sharedGame/src/shared/space/ShipChassisWritable.cpp b/engine/shared/library/sharedGame/src/shared/space/ShipChassisWritable.cpp index b4f2c22a..cfc58a90 100755 --- a/engine/shared/library/sharedGame/src/shared/space/ShipChassisWritable.cpp +++ b/engine/shared/library/sharedGame/src/shared/space/ShipChassisWritable.cpp @@ -51,7 +51,7 @@ bool ShipChassisWritable::setName(CrcString const & name) { if (ShipChassis::setName(name)) { - if (nullptr != findShipChassisByCrc(name.getCrc())) + if (NULL != findShipChassisByCrc(name.getCrc())) Transceivers::chassisListChanged.emitMessage(true); return true; } @@ -72,7 +72,7 @@ void ShipChassisWritable::setSlotTargetable(int chassisSlotType, bool targetable { ShipChassisSlot * const chassisSlot = getSlot(static_cast(chassisSlotType)); - if (nullptr == chassisSlot) + if (NULL == chassisSlot) { WARNING(true, ("ShipChassisWritable::setSlotTargetable() invalid slot")); } diff --git a/engine/shared/library/sharedGame/src/shared/space/ShipComponentAttachmentManager.cpp b/engine/shared/library/sharedGame/src/shared/space/ShipComponentAttachmentManager.cpp index 3a8dbd52..14897909 100755 --- a/engine/shared/library/sharedGame/src/shared/space/ShipComponentAttachmentManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/space/ShipComponentAttachmentManager.cpp @@ -164,7 +164,7 @@ void ShipComponentAttachmentManager::load() ShipComponentDescriptor const * const shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByName (TemporaryCrcString (componentName.c_str (), true)); - if (shipComponentDescriptor == nullptr) + if (shipComponentDescriptor == NULL) { WARNING (true, ("ShipComponentAttachmentManager chassis [%s] specified invalid component [%s] at row [%d] in file [%s]", name.getString (), componentName.c_str (), row, chassis_filename.c_str())); continue; @@ -266,7 +266,7 @@ bool ShipComponentAttachmentManager::save(std::string const & dsrcPath, std::str bool ShipComponentAttachmentManager::saveChassisInfo(std::string const & chassisName, std::string const & filenameTab, std::string const & filenameIff) { ShipChassis const * const chassis = ShipChassis::findShipChassisByName(ConstCharCrcString(chassisName.c_str())); - if (nullptr == chassis) + if (NULL == chassis) return false; uint32 const chassisCrc = chassis->getCrc(); @@ -283,7 +283,7 @@ bool ShipComponentAttachmentManager::saveChassisInfo(std::string const & chassis std::string const & componentName = *it; ShipComponentDescriptor const * const shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByName(ConstCharCrcString(componentName.c_str())); - if (nullptr == shipComponentDescriptor) + if (NULL == shipComponentDescriptor) return false; uint32 const componentCrc = shipComponentDescriptor->getCrc(); @@ -333,7 +333,7 @@ bool ShipComponentAttachmentManager::saveChassisInfo(std::string const & chassis std::string const & componentName = *it; ShipComponentDescriptor const * const shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByName(ConstCharCrcString(componentName.c_str())); - if (nullptr == shipComponentDescriptor) + if (NULL == shipComponentDescriptor) return false; uint32 const componentCrc = shipComponentDescriptor->getCrc(); @@ -427,7 +427,7 @@ bool ShipComponentAttachmentManager::saveChassisInfo(std::string const & chassis StdioFileFactory sff; AbstractFile * const af = sff.createFile(filenameTab.c_str(), "wb"); - if (nullptr != af && af->isOpen()) + if (NULL != af && af->isOpen()) { int const bytesWritten = af->write(static_cast(tabStr.size()), tabStr.c_str()); retval = (bytesWritten == static_cast(tabStr.size())); @@ -484,7 +484,7 @@ bool ShipComponentAttachmentManager::getAttachmentsForShip(uint32 chassisCrc, ui TemplateHardpointPairVector const & thpv = (*it).second; if (thpv.empty()) { - thpVectors[i] = nullptr; + thpVectors[i] = NULL; } else { @@ -493,7 +493,7 @@ bool ShipComponentAttachmentManager::getAttachmentsForShip(uint32 chassisCrc, ui } } else - thpVectors[i] = nullptr; + thpVectors[i] = NULL; } return found; diff --git a/engine/shared/library/sharedGame/src/shared/space/ShipComponentData.cpp b/engine/shared/library/sharedGame/src/shared/space/ShipComponentData.cpp index ae4882b5..78a26512 100755 --- a/engine/shared/library/sharedGame/src/shared/space/ShipComponentData.cpp +++ b/engine/shared/library/sharedGame/src/shared/space/ShipComponentData.cpp @@ -53,7 +53,7 @@ ShipComponentData::~ShipComponentData () void ShipComponentData::printDebugString (Unicode::String & result, Unicode::String const & padding) const { - if (m_descriptor == nullptr) + if (m_descriptor == NULL) return; char buf [2048]; diff --git a/engine/shared/library/sharedGame/src/shared/space/ShipComponentDescriptor.cpp b/engine/shared/library/sharedGame/src/shared/space/ShipComponentDescriptor.cpp index b9e021b4..5c3560f0 100755 --- a/engine/shared/library/sharedGame/src/shared/space/ShipComponentDescriptor.cpp +++ b/engine/shared/library/sharedGame/src/shared/space/ShipComponentDescriptor.cpp @@ -115,7 +115,7 @@ void ShipComponentDescriptor::load() DEBUG_WARNING(!sharedTemplateName.empty() && sharedCrcString.isEmpty(), ("Data error: in ship_components.tab - Component [%s] Shared template [%s] not found for row [%d]", name.c_str(), sharedTemplateName.c_str(), row)); #endif - ShipComponentDescriptor * componentDescriptor = nullptr; + ShipComponentDescriptor * componentDescriptor = NULL; if (s_useWritableComponentDescriptor) componentDescriptor = new ShipComponentDescriptorWritable (TemporaryCrcString (name.c_str (), true), type, TemporaryCrcString (compatibility.c_str (), true), serverObjectTemplateName, sharedTemplateName); @@ -174,7 +174,7 @@ bool ShipComponentDescriptor::save(std::string const & filename) StdioFileFactory sff; AbstractFile * const af = sff.createFile(filename.c_str(), "wb"); - if (nullptr != af && af->isOpen()) + if (NULL != af && af->isOpen()) { int const bytesWritten = af->write(static_cast(tabStr.size()), tabStr.c_str()); retval = (bytesWritten == static_cast(tabStr.size())); @@ -285,7 +285,7 @@ ShipComponentDescriptor const * ShipComponentDescriptor::findShipComponentDescri if (it != s_crcComponentMap.end ()) return (*it).second; - return nullptr; + return NULL; } //---------------------------------------------------------------------- @@ -297,7 +297,7 @@ ShipComponentDescriptor const * ShipComponentDescriptor::findShipComponentDescri if (it != s_nameComponentMap->end ()) return (*it).second; - return nullptr; + return NULL; } //---------------------------------------------------------------------- @@ -309,7 +309,7 @@ ShipComponentDescriptor const * ShipComponentDescriptor::findShipComponentDescri if (it != s_objectTemplateCrcComponentMap.end ()) return (*it).second; - return nullptr; + return NULL; } //---------------------------------------------------------------------- @@ -321,7 +321,7 @@ ShipComponentDescriptor const * ShipComponentDescriptor::findShipComponentDescri if (it != s_sharedObjectTemplateCrcComponentMap.end ()) return (*it).second; - return nullptr; + return NULL; } //---------------------------------------------------------------------- @@ -348,7 +348,7 @@ ShipComponentDescriptor::StringVector ShipComponentDescriptor::getComponentDescr bool ShipComponentDescriptor::setName(std::string const & name) { ShipComponentDescriptor const * const dupeNameShipComponentDescriptor = findShipComponentDescriptorByName(ConstCharCrcString(name.c_str())); - if (nullptr != dupeNameShipComponentDescriptor) + if (NULL != dupeNameShipComponentDescriptor) { WARNING(true, ("ShipComponentDescriptor attempt to set name [%s] already exists", name.c_str())); return false; @@ -379,14 +379,14 @@ bool ShipComponentDescriptor::setName(std::string const & name) bool ShipComponentDescriptor::setObjectTemplateCrcs(uint32 crc, uint32 sharedCrc) { ShipComponentDescriptor const * const dupeTemplateShipComponentDescriptor = findShipComponentDescriptorByObjectTemplate(crc); - if (nullptr != dupeTemplateShipComponentDescriptor && this != dupeTemplateShipComponentDescriptor) + if (NULL != dupeTemplateShipComponentDescriptor && this != dupeTemplateShipComponentDescriptor) { WARNING(true, ("ShipComponentDescriptor attempt to set ot crc [%s] already exists", dupeTemplateShipComponentDescriptor->getName().getString())); return false; } ShipComponentDescriptor const * const dupeSharedTemplateShipComponentDescriptor = findShipComponentDescriptorBySharedObjectTemplate(crc); - if (nullptr != dupeSharedTemplateShipComponentDescriptor && this != dupeSharedTemplateShipComponentDescriptor) + if (NULL != dupeSharedTemplateShipComponentDescriptor && this != dupeSharedTemplateShipComponentDescriptor) { WARNING(true, ("ShipComponentDescriptor attempt to set shared ot crc [%s] already exists", dupeSharedTemplateShipComponentDescriptor->getName().getString())); return false; @@ -432,7 +432,7 @@ bool ShipComponentDescriptor::addShipComponentDescriptor(bool checkValidity, boo { { ShipComponentDescriptor const * const shipComponentDescriptor = findShipComponentDescriptorByName(m_name); - if (nullptr != shipComponentDescriptor) + if (NULL != shipComponentDescriptor) { WARNING(true, ("ShipComponentDescriptor::addShipComponentDescriptor name [%s] is already in map", m_name.getString())); return false; @@ -441,7 +441,7 @@ bool ShipComponentDescriptor::addShipComponentDescriptor(bool checkValidity, boo { ShipComponentDescriptor const * const shipComponentDescriptor = findShipComponentDescriptorByCrc(getCrc()); - if (nullptr != shipComponentDescriptor) + if (NULL != shipComponentDescriptor) { WARNING(true, ("ShipComponentDescriptor::addShipComponentDescriptor [%s] crc [0x%x] is already in map via [%s]", m_name.getString(), static_cast(getCrc()), shipComponentDescriptor->getName().getString())); return false; @@ -453,7 +453,7 @@ bool ShipComponentDescriptor::addShipComponentDescriptor(bool checkValidity, boo if (0 != objectTemplateCrc) { ShipComponentDescriptor const * const shipComponentDescriptor = findShipComponentDescriptorByObjectTemplate(objectTemplateCrc); - if (nullptr != shipComponentDescriptor) + if (NULL != shipComponentDescriptor) { WARNING(true, ("ShipComponentDescriptor::addShipComponentDescriptor [%s] server template [%s] [0x%x] is already in map via [%s]", m_name.getString(), getObjectTemplateName().c_str(), static_cast(getObjectTemplateCrc()), shipComponentDescriptor->getName().getString())); if (strict) @@ -467,7 +467,7 @@ bool ShipComponentDescriptor::addShipComponentDescriptor(bool checkValidity, boo if (0 != sharedObjectTemplateCrc) { ShipComponentDescriptor const * const shipComponentDescriptor = findShipComponentDescriptorBySharedObjectTemplate(sharedObjectTemplateCrc); - if (nullptr != shipComponentDescriptor) + if (NULL != shipComponentDescriptor) { WARNING(true, ("ShipComponentDescriptor::addShipComponentDescriptor [%s] shared template [%s] [0x%x] is already in map via [%s]", m_name.getString(), getSharedTemplateName().c_str(), static_cast(getSharedObjectTemplateCrc()), shipComponentDescriptor->getName().getString())); if (strict) diff --git a/engine/shared/library/sharedGame/src/shared/space/ShipComponentDescriptorWritable.cpp b/engine/shared/library/sharedGame/src/shared/space/ShipComponentDescriptorWritable.cpp index aa3e25a3..8e3cf0fb 100755 --- a/engine/shared/library/sharedGame/src/shared/space/ShipComponentDescriptorWritable.cpp +++ b/engine/shared/library/sharedGame/src/shared/space/ShipComponentDescriptorWritable.cpp @@ -85,7 +85,7 @@ bool ShipComponentDescriptorWritable::setName(std::string const & name) { if (ShipComponentDescriptor::setName(name)) { - if (nullptr != ShipComponentDescriptor::findShipComponentDescriptorByCrc(Crc::normalizeAndCalculate(name.c_str()))) + if (NULL != ShipComponentDescriptor::findShipComponentDescriptorByCrc(Crc::normalizeAndCalculate(name.c_str()))) { notifyChanged(); Transceivers::componentListChanged.emitMessage(true); diff --git a/engine/shared/library/sharedGame/src/shared/space/ShipComponentWeaponManager.cpp b/engine/shared/library/sharedGame/src/shared/space/ShipComponentWeaponManager.cpp index f929434c..4e6559c7 100755 --- a/engine/shared/library/sharedGame/src/shared/space/ShipComponentWeaponManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/space/ShipComponentWeaponManager.cpp @@ -76,7 +76,7 @@ void ShipComponentWeaponManager::install() DataTable * const dt = DataTableManager::getTable(filename, true); - if (dt == nullptr) + if (dt == NULL) { WARNING(true, ("ShipComponentWeaponManager no such datatable [%s]", filename.c_str())); return; @@ -90,7 +90,7 @@ void ShipComponentWeaponManager::install() ShipComponentDescriptor const * const shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByName(TemporaryCrcString(componentName.c_str(), true)); - if (shipComponentDescriptor == nullptr) + if (shipComponentDescriptor == NULL) { WARNING(true, ("getComponentType datatable specified invalid component [%s]", componentName.c_str())); continue; diff --git a/engine/shared/library/sharedGame/src/shared/sui/SuiPageData.cpp b/engine/shared/library/sharedGame/src/shared/sui/SuiPageData.cpp index 92c8403c..c0941d98 100755 --- a/engine/shared/library/sharedGame/src/shared/sui/SuiPageData.cpp +++ b/engine/shared/library/sharedGame/src/shared/sui/SuiPageData.cpp @@ -93,7 +93,7 @@ bool SuiPageData::addCommand(SuiCommand const & command) SuiCommand const * const oldCommand = findSubscribeToEventCommand(eventType, targetWidget); - if (oldCommand != nullptr) + if (oldCommand != NULL) { WARNING(true, ("SuiPageData::addCommand attempt to add duplicate SCT_subscribeToEvent command. Type=[%d], target=[%s]", eventType, targetWidget.c_str())); return false; @@ -130,7 +130,7 @@ void SuiPageData::subscribeToPropertyForEvent(int eventType, std::string const & { SuiCommand * const command = findSubscribeToEventCommand(eventType, eventWidgetName); - if (command == nullptr) + if (command == NULL) { SuiCommand newCommand(SuiCommand::SCT_subscribeToEvent, eventWidgetName); newCommand.initSubscribeToEvent(eventType, std::string()); @@ -148,7 +148,7 @@ bool SuiPageData::subscribeToEvent(int eventType, std::string const & eventWidge { SuiCommand * const command = findSubscribeToEventCommand(eventType, eventWidgetName); - if (command == nullptr) + if (command == NULL) { SuiCommand newCommand(SuiCommand::SCT_subscribeToEvent, eventWidgetName); newCommand.initSubscribeToEvent(eventType, callback); @@ -182,7 +182,7 @@ SuiCommand * SuiPageData::findSubscribeToEventCommand(int const eventType, std:: } } - return nullptr; + return NULL; } //---------------------------------------------------------------------- @@ -203,7 +203,7 @@ SuiCommand * SuiPageData::findSubscribeToEventCommandByIndex(int const index) } } - return nullptr; + return NULL; } //---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedImage/src/shared/TargaFormat.cpp b/engine/shared/library/sharedImage/src/shared/TargaFormat.cpp index e8f6f545..3957c9ab 100755 --- a/engine/shared/library/sharedImage/src/shared/TargaFormat.cpp +++ b/engine/shared/library/sharedImage/src/shared/TargaFormat.cpp @@ -224,7 +224,7 @@ bool TargaFormat::loadImage(const char *filename, Image **image) const if (!image) { - REPORT_LOG(true, ("TargaFormat::loadImage(): nullptr image pointer\n")); + REPORT_LOG(true, ("TargaFormat::loadImage(): null image pointer\n")); return false; } *image = 0; @@ -257,7 +257,7 @@ bool TargaFormat::loadImageReformat(const char *filename, Image **image, Image:: if (!image) { - REPORT_LOG(true, ("TargaFormat::loadImage(): nullptr image pointer\n")); + REPORT_LOG(true, ("TargaFormat::loadImage(): null image pointer\n")); return false; } *image = 0; diff --git a/engine/shared/library/sharedIoWin/src/shared/IoWin.cpp b/engine/shared/library/sharedIoWin/src/shared/IoWin.cpp index 3cb565b1..2d4eff3e 100755 --- a/engine/shared/library/sharedIoWin/src/shared/IoWin.cpp +++ b/engine/shared/library/sharedIoWin/src/shared/IoWin.cpp @@ -22,7 +22,7 @@ IoWin::IoWin( const char *debugName // Name used for debugging purposes ) : ioDebugName(DuplicateString(debugName)), - ioNext(nullptr) + ioNext(NULL) { } @@ -37,9 +37,9 @@ IoWin::IoWin( IoWin::~IoWin(void) { delete [] ioDebugName; - ioDebugName = nullptr; + ioDebugName = NULL; - ioNext = nullptr; + ioNext = NULL; } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedIoWin/src/shared/IoWinManager.cpp b/engine/shared/library/sharedIoWin/src/shared/IoWinManager.cpp index 11da17d5..5fc8ea5e 100755 --- a/engine/shared/library/sharedIoWin/src/shared/IoWinManager.cpp +++ b/engine/shared/library/sharedIoWin/src/shared/IoWinManager.cpp @@ -35,7 +35,7 @@ namespace IoWinManagerNamespace // Inactivity timer. float const s_defaultInactivityTimeSeconds = 15.0f * 60.0f; - IoWinManager::InactivityCallback s_inactivityCallback = nullptr; + IoWinManager::InactivityCallback s_inactivityCallback = NULL; Timer s_inactivityTimer(s_defaultInactivityTimeSeconds); bool s_isInactive = true; @@ -76,7 +76,7 @@ void IoWinManagerNamespace::triggerInactive(bool inactive) { if (!boolEqual(s_isInactive, inactive)) { - if (s_inactivityCallback != nullptr) + if (s_inactivityCallback != NULL) { (*s_inactivityCallback)(inactive); } @@ -105,7 +105,7 @@ IoEvent *IoWinManager::firstEvent; IoEvent *IoWinManager::lastEvent; MemoryBlockManager *IoWinManager::eventBlockManager; -IoWinManager::IMEFunctionPointer IoWinManager::imeFunction = nullptr; +IoWinManager::IMEFunctionPointer IoWinManager::imeFunction = NULL; // ====================================================================== // Install the IoWinManager @@ -122,8 +122,8 @@ IoWinManager::IMEFunctionPointer IoWinManager::imeFunction = nullptr; void IoWinManager::install() { DEBUG_FATAL(installed, ("double install")); - top = nullptr; - captured = nullptr; + top = NULL; + captured = NULL; ExitChain::add(IoWinManager::remove, "IoWinManager::remove"); eventBlockManager = new MemoryBlockManager("IoWinManager eventBlockManager", true, sizeof(IoEvent), 0, 0, 0); installed = true; @@ -162,9 +162,9 @@ void IoWinManager::remove(void) IoResult result; IoEvent *event; - Os::setQueueCharacterHookFunction(nullptr); - Os::setSetSystemMouseCursorPositionHookFunction(nullptr); - Os::setQueueKeyDownHookFunction(nullptr); + Os::setQueueCharacterHookFunction(NULL); + Os::setSetSystemMouseCursorPositionHookFunction(NULL); + Os::setQueueKeyDownHookFunction(NULL); DEBUG_FATAL(!installed, ("not installed")); installed = false; @@ -191,7 +191,7 @@ void IoWinManager::remove(void) delete eventBlockManager; // Remove the inactivity timer. - registerInactivityCallback(nullptr, 0.0f); + registerInactivityCallback(NULL, 0.0f); } // ---------------------------------------------------------------------- @@ -229,10 +229,10 @@ void IoWinManager::debugReport() void IoWinManager::processEvents(float elapsedTime) { - IoWin * w = nullptr; - IoWin * next = nullptr; - IoEvent * queue = nullptr; - IoEvent * event = nullptr; + IoWin * w = NULL; + IoWin * next = NULL; + IoEvent * queue = NULL; + IoEvent * event = NULL; IoResult result; @@ -244,8 +244,8 @@ void IoWinManager::processEvents(float elapsedTime) queue->next = firstEvent; // the event list is now empty - firstEvent = nullptr; - lastEvent = nullptr; + firstEvent = NULL; + lastEvent = NULL; // Update the activity timer. if (!s_isInactive) @@ -267,7 +267,7 @@ void IoWinManager::processEvents(float elapsedTime) queue = queue->next; // keep people from peeking ahead in the event queue - event->next = nullptr; + event->next = NULL; // Check to see if the event resets @@ -310,7 +310,7 @@ void IoWinManager::processEvents(float elapsedTime) if (debugReportEvents) { - const char *name = nullptr; + const char *name = NULL; switch (event->type) { @@ -434,7 +434,7 @@ void IoWinManager::open(IoWin *window) // validate the arguments if (!window) { - DEBUG_FATAL(true, ("nullptr window")); + DEBUG_FATAL(true, ("null window")); return; //lint !e527 // Warning -- Unreachable } @@ -511,13 +511,13 @@ void IoWinManager::close(IoWin *window, bool allowDelete) // validate the arguments if (!window) { - DEBUG_FATAL(true, ("nullptr window")); + DEBUG_FATAL(true, ("null window")); return; //lint !e527 // Warning -- Unreachable } // linked list traversal with a back pointer IoWin *back, *front; - for (back = nullptr, front = top; front && front != window; back = front, front = front->ioNext) + for (back = NULL, front = top; front && front != window; back = front, front = front->ioNext) ; // verify the window was found @@ -528,7 +528,7 @@ void IoWinManager::close(IoWin *window, bool allowDelete) } // -qq- lint hack - DEBUG_FATAL(!window, ("nullptr window")); + DEBUG_FATAL(!window, ("null window")); // remove it from the singly linked list if (back) @@ -566,7 +566,7 @@ IoEvent *IoWinManager::newEvent(IoEventType eventType, int arg1, int arg2, real IoEvent * const event = reinterpret_cast(eventBlockManager->allocate()); // fill out the event data - event->next = nullptr; + event->next = NULL; event->type = eventType; event->arg1 = arg1; event->arg2 = arg2; diff --git a/engine/shared/library/sharedIoWin/src/shared/IoWinManager.h b/engine/shared/library/sharedIoWin/src/shared/IoWinManager.h index 6965393d..d0b90b2b 100755 --- a/engine/shared/library/sharedIoWin/src/shared/IoWinManager.h +++ b/engine/shared/library/sharedIoWin/src/shared/IoWinManager.h @@ -131,7 +131,7 @@ public: inline bool IoWinManager::haveWindow(void) { - return (top != nullptr); + return (top != NULL); } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedMath/src/shared/MxCifQuadTree.cpp b/engine/shared/library/sharedMath/src/shared/MxCifQuadTree.cpp index 92241997..0b77b2ec 100755 --- a/engine/shared/library/sharedMath/src/shared/MxCifQuadTree.cpp +++ b/engine/shared/library/sharedMath/src/shared/MxCifQuadTree.cpp @@ -32,10 +32,10 @@ MxCifQuadTree::MxCifQuadTree(float minX, float minY, float maxX, float maxY, int m_centerX((m_maxX - m_minX) / 2.0f + m_minX), m_centerY((m_maxY - m_minY) / 2.0f + m_minY), m_maxDepth(maxDepth), - m_urTree(nullptr), - m_ulTree(nullptr), - m_llTree(nullptr), - m_lrTree(nullptr), + m_urTree(NULL), + m_ulTree(NULL), + m_llTree(NULL), + m_lrTree(NULL), m_xAxisTree(minX, maxX, maxDepth), m_yAxisTree(minY, maxY, maxDepth) { @@ -49,13 +49,13 @@ MxCifQuadTree::MxCifQuadTree(float minX, float minY, float maxX, float maxY, int MxCifQuadTree::~MxCifQuadTree() { delete m_urTree; - m_urTree = nullptr; + m_urTree = NULL; delete m_ulTree; - m_ulTree = nullptr; + m_ulTree = NULL; delete m_llTree; - m_llTree = nullptr; + m_llTree = NULL; delete m_lrTree; - m_lrTree = nullptr; + m_lrTree = NULL; } // MxCifQuadTree::~MxCifQuadTree //------------------------------------------------------------------------------ @@ -99,7 +99,7 @@ bool MxCifQuadTree::addObject(const MxCifQuadTreeBounds & object) // try putting the object in a child node if (m_maxDepth > 1) { - if (m_urTree == nullptr) + if (m_urTree == NULL) { if (!split()) return false; @@ -158,7 +158,7 @@ bool MxCifQuadTree::removeObject(const MxCifQuadTreeBounds & object) { if (m_maxDepth > 1) { - if (m_urTree != nullptr) + if (m_urTree != NULL) { // check if the object is in a sub-node if (m_urTree->removeObject(object) || @@ -212,7 +212,7 @@ void MxCifQuadTree::getObjectsAt(float x, float y, y >= m_minY) { // if we have sub-trees, pass the point to the tree that contains it - if (m_urTree != nullptr) + if (m_urTree != NULL) { if (x >= m_centerX && y >= m_centerY) m_urTree->getObjectsAt(x, y, objects); @@ -239,7 +239,7 @@ void MxCifQuadTree::getObjectsAt(float x, float y, void MxCifQuadTree::getAllObjects(std::vector & objects) const { // if we have sub-trees, pass the point to the tree that contains it - if (m_urTree != nullptr) + if (m_urTree != NULL) { m_urTree->getAllObjects(objects); m_ulTree->getAllObjects(objects); @@ -265,8 +265,8 @@ MxCifQuadTree::MxCifBinTree::MxCifBinTree(float min, float max, int maxDepth) : m_max(max), m_center((max - min) / 2.0f + min), m_maxDepth(maxDepth), - m_left(nullptr), - m_right(nullptr), + m_left(NULL), + m_right(NULL), m_objects() { } // MxCifBinTree::MxCifBinTree @@ -277,9 +277,9 @@ MxCifQuadTree::MxCifBinTree::MxCifBinTree(float min, float max, int maxDepth) : MxCifQuadTree::MxCifBinTree::~MxCifBinTree() { delete m_left; - m_left = nullptr; + m_left = NULL; delete m_right; - m_right = nullptr; + m_right = NULL; m_objects.clear(); } // MxCifBinTree::~MxCifBinTree @@ -315,7 +315,7 @@ bool MxCifQuadTree::MxCifBinTree::addObject(const MxCifQuadTreeBounds & object) // try putting the object in a child node if (m_maxDepth > 1) { - if (m_left == nullptr) + if (m_left == NULL) { if (!split()) return false; @@ -348,7 +348,7 @@ bool MxCifQuadTree::MxCifBinTree::removeObject(const MxCifQuadTreeBounds & objec { if (m_maxDepth > 1) { - if (m_left != nullptr) + if (m_left != NULL) { // check if the object is in a sub-node if (m_left->removeObject(object) || @@ -379,7 +379,7 @@ void MxCifQuadTree::MxCifBinTree::getAllObjects( std::vector & objects) const { // if we have sub-trees, pass the point to the tree that contains it - if (m_left != nullptr) + if (m_left != NULL) { m_right->getAllObjects(objects); m_left->getAllObjects(objects); @@ -435,7 +435,7 @@ void MxCifQuadTree::MxCifXBinTree::getObjectsAt(float x, float y, x >= m_min) { // if we have sub-trees, pass the point to the tree that contains it - if (m_left != nullptr) + if (m_left != NULL) { if (x >= m_center) m_right->getObjectsAt(x, y, objects); @@ -498,7 +498,7 @@ void MxCifQuadTree::MxCifYBinTree::getObjectsAt(float x, float y, y >= m_min) { // if we have sub-trees, pass the point to the tree that contains it - if (m_left != nullptr) + if (m_left != NULL) { if (y >= m_center) m_right->getObjectsAt(x, y, objects); diff --git a/engine/shared/library/sharedMath/src/shared/MxCifQuadTreeBounds.h b/engine/shared/library/sharedMath/src/shared/MxCifQuadTreeBounds.h index 3362c65a..27006c07 100755 --- a/engine/shared/library/sharedMath/src/shared/MxCifQuadTreeBounds.h +++ b/engine/shared/library/sharedMath/src/shared/MxCifQuadTreeBounds.h @@ -19,7 +19,7 @@ class MxCifQuadTreeBounds { public: - MxCifQuadTreeBounds(float minX, float minY, float maxX, float maxY, void * data = nullptr); + MxCifQuadTreeBounds(float minX, float minY, float maxX, float maxY, void * data = NULL); virtual ~MxCifQuadTreeBounds(){}; const float getMinX(void) const; @@ -87,7 +87,7 @@ inline void * MxCifQuadTreeBounds::getData(void) const class MxCifQuadTreeCircleBounds : public MxCifQuadTreeBounds { public: - MxCifQuadTreeCircleBounds(float centerX, float centerY, float radius, void * data = nullptr); + MxCifQuadTreeCircleBounds(float centerX, float centerY, float radius, void * data = NULL); float getCenterX() const; float getCenterY() const; diff --git a/engine/shared/library/sharedMath/src/shared/Plane.cpp b/engine/shared/library/sharedMath/src/shared/Plane.cpp index 716055b6..de9e491f 100755 --- a/engine/shared/library/sharedMath/src/shared/Plane.cpp +++ b/engine/shared/library/sharedMath/src/shared/Plane.cpp @@ -63,7 +63,7 @@ void Plane::set(const Vector &point0, const Vector &point1, const Vector &point2 * Find the intersection between a line segment and the plane. * * If the line segment does intersect the plane, and the intersection - * pointer is non-nullptr, then intersection will be set to the point on + * pointer is non-NULL, then intersection will be set to the point on * the line segment that crosses the plane. * * @param point0 [IN] Start of the line segment @@ -85,7 +85,7 @@ bool Plane::findIntersection(const Vector &point0, const Vector &point1) const * Find the intersection between a line segment and the plane. * * If the line segment does intersect the plane, and the intersection - * pointer is non-nullptr, then intersection will be set to the point on + * pointer is non-NULL, then intersection will be set to the point on * the line segment that crosses the plane. * * @param point0 [IN] Start of the line segment @@ -120,7 +120,7 @@ bool Plane::findIntersection(const Vector &point0, const Vector &point1, Vector * Find the intersection between a line segment and the plane. * * If the line segment does intersect the plane, and the intersection - * pointer is non-nullptr, then intersection will be set to the point on + * pointer is non-NULL, then intersection will be set to the point on * the line segment that crosses the plane. * * @param point0 [IN] Start of the line segment @@ -159,7 +159,7 @@ bool Plane::findIntersection(const Vector &point0, const Vector &point1, Vector * Find the intersection between a line segment and the plane. * * If the line segment does intersect the plane, and the intersection - * pointer is non-nullptr, then intersection will be set to the point on + * pointer is non-NULL, then intersection will be set to the point on * the line segment that crosses the plane. * * @param point0 [IN] Start of the line segment @@ -198,7 +198,7 @@ bool Plane::findIntersection(const Vector &point0, const Vector &point1, float & * back side of the plane. * * If the line segment does intersect the plane, and the intersection - * pointer is non-nullptr, then intersection will be set to the point on + * pointer is non-NULL, then intersection will be set to the point on * the line segment that crosses the plane. * * @param point0 [IN] Start of the line segment @@ -224,12 +224,12 @@ bool Plane::findDirectedIntersection(const Vector &point0, const Vector &point1) * back side of the plane. * * If the line segment does intersect the plane, and the intersection - * pointer is non-nullptr, then intersection will be set to the point on + * pointer is non-NULL, then intersection will be set to the point on * the line segment that crosses the plane. * * @param point0 [IN] Start of the line segment * @param point1 [IN] End of the line segment - * @param intersection [OUT] Intersection of the point and the plane (may be nullptr) + * @param intersection [OUT] Intersection of the point and the plane (may be NULL) * @param t [OUT] parameterized t from 0..1 * @return True if the line segment intersects the plane from front-to-rear, otherwise false. */ @@ -265,12 +265,12 @@ bool Plane::findDirectedIntersection(const Vector &point0, const Vector &point1, * back side of the plane. * * If the line segment does intersect the plane, and the intersection - * pointer is non-nullptr, then intersection will be set to the point on + * pointer is non-NULL, then intersection will be set to the point on * the line segment that crosses the plane. * * @param point0 [IN] Start of the line segment * @param point1 [IN] End of the line segment - * @param intersection [OUT] Intersection of the point and the plane (may be nullptr) + * @param intersection [OUT] Intersection of the point and the plane (may be NULL) * @param t [OUT] parameterized t from 0..1 * @return True if the line segment intersects the plane from front-to-rear, otherwise false. */ @@ -308,12 +308,12 @@ bool Plane::findDirectedIntersection(const Vector &point0, const Vector &point1, * back side of the plane. * * If the line segment does intersect the plane, and the intersection - * pointer is non-nullptr, then intersection will be set to the point on + * pointer is non-NULL, then intersection will be set to the point on * the line segment that crosses the plane. * * @param point0 [IN] Start of the line segment * @param point1 [IN] End of the line segment - * @param intersection [OUT] Intersection of the point and the plane (may be nullptr) + * @param intersection [OUT] Intersection of the point and the plane (may be NULL) * @param t [OUT] parameterized t from 0..1 * @return True if the line segment intersects the plane from front-to-rear, otherwise false. */ diff --git a/engine/shared/library/sharedMath/src/shared/Quaternion.cpp b/engine/shared/library/sharedMath/src/shared/Quaternion.cpp index 15b349a5..38ce35b6 100755 --- a/engine/shared/library/sharedMath/src/shared/Quaternion.cpp +++ b/engine/shared/library/sharedMath/src/shared/Quaternion.cpp @@ -138,7 +138,7 @@ void Quaternion::getTransform(Transform *transform) const void Quaternion::getTransformPreserveTranslation(Transform *transform) const { - DEBUG_FATAL(!transform, ("nullptr transform arg")); + DEBUG_FATAL(!transform, ("null transform arg")); if ((w + s_quatEqualityEpsilon) < 1.f) { diff --git a/engine/shared/library/sharedMath/src/shared/SphereTreeNode.h b/engine/shared/library/sharedMath/src/shared/SphereTreeNode.h index 3d630b82..706f846d 100755 --- a/engine/shared/library/sharedMath/src/shared/SphereTreeNode.h +++ b/engine/shared/library/sharedMath/src/shared/SphereTreeNode.h @@ -71,7 +71,7 @@ VectorPointerPool::~VectorPointerPool() } delete v; - v = nullptr; + v = NULL; } } @@ -209,7 +209,7 @@ public: node->move(this); else { - WARNING_STRICT_FATAL(true, ("SphereTree::move was invoked for an object, but the real sphere tree node it refers to is nullptr.")); + WARNING_STRICT_FATAL(true, ("SphereTree::move was invoked for an object, but the real sphere tree node it refers to is null.")); } }; @@ -292,7 +292,7 @@ inline SpatialSubdivisionHandle * SphereTreeNode::ad if(!isValidSphere(sphere)) { WARNING_STRICT_FATAL(true, ("SphereTreeNode::addObject - sphere for the object being added is invalid")); - return nullptr; + return NULL; } SphereTreeNode * candidateNode = 0; diff --git a/engine/shared/library/sharedMath/src/shared/Transform.cpp b/engine/shared/library/sharedMath/src/shared/Transform.cpp index ef35b3d0..9cc8c181 100755 --- a/engine/shared/library/sharedMath/src/shared/Transform.cpp +++ b/engine/shared/library/sharedMath/src/shared/Transform.cpp @@ -493,7 +493,7 @@ void Transform::reorthonormalize(void) /** * Send this transform to the DebugPrint system. * - * The header parameter may be nullptr. + * The header parameter may be NULL. * * @param header Header for the transform */ @@ -524,8 +524,8 @@ void Transform::debugPrint(const char *header) const void Transform::rotate_l2p(const Vector *source, Vector *result, int count) const { - DEBUG_FATAL(!source, ("source array is nullptr")); - DEBUG_FATAL(!result, ("result array is nullptr")); + DEBUG_FATAL(!source, ("source array is NULL")); + DEBUG_FATAL(!result, ("result array is NULL")); DEBUG_FATAL(source == result, ("source and result array can not be the same")); NOT_NULL(source); @@ -559,8 +559,8 @@ void Transform::rotate_l2p(const Vector *source, Vector *result, int count) cons void Transform::rotateTranslate_l2p(const Vector *source, Vector *result, int count) const { - DEBUG_FATAL(!source, ("source array is nullptr")); - DEBUG_FATAL(!result, ("result array is nullptr")); + DEBUG_FATAL(!source, ("source array is NULL")); + DEBUG_FATAL(!result, ("result array is NULL")); NOT_NULL(source); NOT_NULL(result); @@ -594,8 +594,8 @@ void Transform::rotateTranslate_l2p(const Vector *source, Vector *result, int co void Transform::rotate_p2l(const Vector *source, Vector *result, int count) const { - DEBUG_FATAL(!source, ("source array is nullptr")); - DEBUG_FATAL(!result, ("result array is nullptr")); + DEBUG_FATAL(!source, ("source array is NULL")); + DEBUG_FATAL(!result, ("result array is NULL")); NOT_NULL(source); NOT_NULL(result); @@ -629,8 +629,8 @@ void Transform::rotate_p2l(const Vector *source, Vector *result, int count) cons void Transform::rotateTranslate_p2l(const Vector *source, Vector *result, int count) const { - DEBUG_FATAL(!source, ("source array is nullptr")); - DEBUG_FATAL(!result, ("result array is nullptr")); + DEBUG_FATAL(!source, ("source array is NULL")); + DEBUG_FATAL(!result, ("result array is NULL")); NOT_NULL(source); NOT_NULL(result); diff --git a/engine/shared/library/sharedMath/src/shared/Vector.cpp b/engine/shared/library/sharedMath/src/shared/Vector.cpp index a694ccdd..8f3ee55d 100755 --- a/engine/shared/library/sharedMath/src/shared/Vector.cpp +++ b/engine/shared/library/sharedMath/src/shared/Vector.cpp @@ -115,7 +115,7 @@ bool Vector::isNormalized(void) const const Vector Vector::findClosestPointOnLine(const Vector &line0, const Vector &line1, real *t) const { - DEBUG_FATAL(!t, ("t arg is nullptr")); + DEBUG_FATAL(!t, ("t arg is null")); NOT_NULL(t); @@ -189,7 +189,7 @@ real Vector::distanceToLineSegment(const Vector &line0, const Vector &line1) con /** * Send this vector to the DebugPrint system. * - * The header parameter may be nullptr. + * The header parameter may be NULL. * * @param header Header for the vector */ diff --git a/engine/shared/library/sharedMath/src/shared/debug/DebugShapeRenderer.cpp b/engine/shared/library/sharedMath/src/shared/debug/DebugShapeRenderer.cpp index 4b0dc1ac..3e4c8d34 100755 --- a/engine/shared/library/sharedMath/src/shared/debug/DebugShapeRenderer.cpp +++ b/engine/shared/library/sharedMath/src/shared/debug/DebugShapeRenderer.cpp @@ -10,7 +10,7 @@ #include "sharedMath/Transform.h" -static DebugShapeRenderer::DebugShapeRendererFactory * gs_factory = nullptr; +static DebugShapeRenderer::DebugShapeRendererFactory * gs_factory = NULL; // ---------------------------------------------------------------------- @@ -145,8 +145,8 @@ void DebugShapeRenderer::setFactory ( DebugShapeRenderer::DebugShapeRendererFact DebugShapeRenderer * DebugShapeRenderer::create ( Object const * object ) { - if(gs_factory == nullptr) - return nullptr; + if(gs_factory == NULL) + return NULL; return gs_factory(object); } diff --git a/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp b/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp index a188f56f..9c9ab336 100755 --- a/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp +++ b/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp @@ -327,7 +327,7 @@ using namespace MemoryManagerNamespace; SystemAllocation::SystemAllocation(int size) : m_size(size), - m_next(nullptr), + m_next(NULL), m_pad1(0), m_pad2(0) { @@ -343,7 +343,7 @@ SystemAllocation::SystemAllocation(int size) Block * lastMemoryBlock = getLastMemoryBlock(); // set up the prefix sentinel block - firstMemoryBlock->setPrevious(nullptr); + firstMemoryBlock->setPrevious(NULL); firstMemoryBlock->setNext(firstFreeBlock); firstMemoryBlock->setFree(false); @@ -353,7 +353,7 @@ SystemAllocation::SystemAllocation(int size) // set up the suffix sentinel block lastMemoryBlock->setPrevious(firstFreeBlock); - lastMemoryBlock->setNext(nullptr); + lastMemoryBlock->setNext(NULL); lastMemoryBlock->setFree(false); // put the first block on the free list @@ -748,7 +748,7 @@ void MemoryManagerNamespace::allocateSystemMemory(int megabytes) ms_systemMemoryAllocatedMegabytes += megabytes; // insert the memory into the sorted linked list of system allocations - SystemAllocation * back = nullptr; + SystemAllocation * back = NULL; SystemAllocation * front = ms_firstSystemAllocation; for ( ; front && front->getFirstMemoryBlock() < systemAllocation->getFirstMemoryBlock(); back = front, front = front->getNext()) {} @@ -967,7 +967,7 @@ void MemoryManagerNamespace::addToFreeList(Block * block) FreeBlock * freeBlock = static_cast(block); int const freeBlockSize = freeBlock->getSize(); - FreeBlock * parent = nullptr; + FreeBlock * parent = NULL; FreeBlock * * next = &ms_firstFreeBlock; FreeBlock * same = 0; @@ -991,7 +991,7 @@ void MemoryManagerNamespace::addToFreeList(Block * block) { freeBlock->m_smallerFreeBlock = same->m_smallerFreeBlock; - same->m_smallerFreeBlock = nullptr; + same->m_smallerFreeBlock = NULL; if (freeBlock->m_smallerFreeBlock) freeBlock->m_smallerFreeBlock->m_parentFreeBlock = freeBlock; @@ -999,7 +999,7 @@ void MemoryManagerNamespace::addToFreeList(Block * block) same->m_parentFreeBlock = freeBlock; freeBlock->m_largerFreeBlock = same->m_largerFreeBlock; - same->m_largerFreeBlock = nullptr; + same->m_largerFreeBlock = NULL; if (freeBlock->m_largerFreeBlock) freeBlock->m_largerFreeBlock->m_parentFreeBlock = freeBlock; @@ -1009,9 +1009,9 @@ void MemoryManagerNamespace::addToFreeList(Block * block) else { *next = freeBlock; - freeBlock->m_smallerFreeBlock = nullptr; - freeBlock->m_sameFreeBlock = nullptr; - freeBlock->m_largerFreeBlock = nullptr; + freeBlock->m_smallerFreeBlock = NULL; + freeBlock->m_sameFreeBlock = NULL; + freeBlock->m_largerFreeBlock = NULL; freeBlock->m_parentFreeBlock = parent; } @@ -1042,7 +1042,7 @@ void MemoryManagerNamespace::removeFromFreeList(FreeBlock * block) NOT_NULL(block); // find the pointer that points to block - FreeBlock * * parentPointer = nullptr; + FreeBlock * * parentPointer = NULL; FreeBlock * parent = block->m_parentFreeBlock; if (parent) { @@ -1088,7 +1088,7 @@ void MemoryManagerNamespace::removeFromFreeList(FreeBlock * block) { // this is the worst case. this free block has smaller and larger children, but not any same sized children // we're going to take the smallest block off the larger list and use that to replace the current node - FreeBlock * back = nullptr; + FreeBlock * back = NULL; FreeBlock * replacement = block->m_largerFreeBlock; while (replacement->m_smallerFreeBlock) { @@ -1133,16 +1133,16 @@ void MemoryManagerNamespace::removeFromFreeList(FreeBlock * block) else { // this block has no children - *parentPointer = nullptr; + *parentPointer = NULL; } } } // remove all the pointers the block may have had - block->m_smallerFreeBlock = nullptr; - block->m_sameFreeBlock = nullptr; - block->m_largerFreeBlock = nullptr; - block->m_parentFreeBlock = nullptr; + block->m_smallerFreeBlock = NULL; + block->m_sameFreeBlock = NULL; + block->m_largerFreeBlock = NULL; + block->m_parentFreeBlock = NULL; --ms_freeBlocks; } @@ -1151,7 +1151,7 @@ void MemoryManagerNamespace::removeFromFreeList(FreeBlock * block) FreeBlock *MemoryManagerNamespace::searchFreeList(int blockSize) { - FreeBlock * result = nullptr; + FreeBlock * result = NULL; FreeBlock * current = ms_firstFreeBlock; while (current) { @@ -1239,7 +1239,7 @@ void * MemoryManager::allocate(size_t size, uint32 owner, bool array, bool leakT // get the size of the allocation int allocSize = (cms_allocatedBlockSize + cms_guardBandSize + (size ? static_cast(size) : 1) + cms_guardBandSize + 15) & ~15; - FreeBlock * bestFreeBlock = nullptr; + FreeBlock * bestFreeBlock = NULL; for (int tries = 0; !bestFreeBlock && tries < 2; ++tries) { bestFreeBlock = searchFreeList(allocSize); @@ -1396,7 +1396,7 @@ void *MemoryManager::reallocate(void *userPointer, size_t newSize) { MemoryManager::free(userPointer, array); -// DEBUG_REPORT_LOG(ms_logEachAlloc, ("MemoryManager::reallocate() new_requested_size=%d, org ptr=%p, new ptr=nullptr\n", newSize, userPointer)); +// DEBUG_REPORT_LOG(ms_logEachAlloc, ("MemoryManager::reallocate() new_requested_size=%d, org ptr=%p, new ptr=NULL\n", newSize, userPointer)); return 0; } @@ -1440,7 +1440,7 @@ void *MemoryManager::reallocate(void *userPointer, size_t newSize) * Users should not call this routine directly. It should only be called * by operator delete. * - * This routine should not be called with the nullptr pointer. + * This routine should not be called with the NULL pointer. * * @param userPointer Pointer to the memory * @param array True if the array form of operator new was used, false if the scalar form was used diff --git a/engine/shared/library/sharedMessageDispatch/src/shared/Emitter.cpp b/engine/shared/library/sharedMessageDispatch/src/shared/Emitter.cpp index b8c97860..8d161e58 100755 --- a/engine/shared/library/sharedMessageDispatch/src/shared/Emitter.cpp +++ b/engine/shared/library/sharedMessageDispatch/src/shared/Emitter.cpp @@ -31,7 +31,7 @@ struct Emitter::ReceiverList Emitter::Emitter() : receiverList(new ReceiverList) { - assert (receiverList != nullptr); + assert (receiverList != NULL); } //--------------------------------------------------------------------- diff --git a/engine/shared/library/sharedMessageDispatch/src/shared/Receiver.cpp b/engine/shared/library/sharedMessageDispatch/src/shared/Receiver.cpp index bc8fc3b3..ff929dc2 100755 --- a/engine/shared/library/sharedMessageDispatch/src/shared/Receiver.cpp +++ b/engine/shared/library/sharedMessageDispatch/src/shared/Receiver.cpp @@ -33,7 +33,7 @@ Receiver::Receiver() : emitterTargets(new EmitterTargets), hasTargets(false) { - assert(emitterTargets != nullptr); + assert(emitterTargets != NULL); } //--------------------------------------------------------------------- diff --git a/engine/shared/library/sharedNetwork/src/linux/TcpClient.cpp b/engine/shared/library/sharedNetwork/src/linux/TcpClient.cpp index 8acf1289..8dfa1605 100755 --- a/engine/shared/library/sharedNetwork/src/linux/TcpClient.cpp +++ b/engine/shared/library/sharedNetwork/src/linux/TcpClient.cpp @@ -494,7 +494,7 @@ void TcpClient::update() // disconnected so we can handle cleanup. if (pollResult) { - if (m_recvBuffer == nullptr) + if (m_recvBuffer == NULL) { m_recvBufferLength = 1500; m_recvBuffer = new unsigned char [m_recvBufferLength]; @@ -533,7 +533,7 @@ void TcpClient::update() } else { - LOG("Network", ("(nullptr connection object) Read zero bytes on a successful poll (POLLIN|POLLHUP). Closing socket since we think it is closed.")); + LOG("Network", ("(null connection object) Read zero bytes on a successful poll (POLLIN|POLLHUP). Closing socket since we think it is closed.")); } onConnectionClosed(); } diff --git a/engine/shared/library/sharedNetwork/src/shared/Service.cpp b/engine/shared/library/sharedNetwork/src/shared/Service.cpp index 9e0f0c8f..84ec3dd8 100755 --- a/engine/shared/library/sharedNetwork/src/shared/Service.cpp +++ b/engine/shared/library/sharedNetwork/src/shared/Service.cpp @@ -186,8 +186,8 @@ Service::~Service() delete m_callback; connections.clear(); - connectionAllocator = nullptr; - m_callback = nullptr; + connectionAllocator = NULL; + m_callback = NULL; delete m_tcpServer; } diff --git a/engine/shared/library/sharedNetworkMessages/src/shared/core/SetupSharedNetworkMessages.cpp b/engine/shared/library/sharedNetworkMessages/src/shared/core/SetupSharedNetworkMessages.cpp index 134b7a9b..e92dd770 100755 --- a/engine/shared/library/sharedNetworkMessages/src/shared/core/SetupSharedNetworkMessages.cpp +++ b/engine/shared/library/sharedNetworkMessages/src/shared/core/SetupSharedNetworkMessages.cpp @@ -137,7 +137,7 @@ namespace SetupSharedNetworkMessagesNamespace MessageQueue::Data* unpackNothing(Archive::ReadIterator &) { - return nullptr; + return NULL; } void packGenericShipDamageMessage(const MessageQueue::Data * data, Archive::ByteStream & target) diff --git a/engine/shared/library/sharedObject/src/shared/ObjectWatcherList.cpp b/engine/shared/library/sharedObject/src/shared/ObjectWatcherList.cpp index fdfb4afa..a2cb6e67 100755 --- a/engine/shared/library/sharedObject/src/shared/ObjectWatcherList.cpp +++ b/engine/shared/library/sharedObject/src/shared/ObjectWatcherList.cpp @@ -23,7 +23,7 @@ namespace ObjectWatcherListNamespace { void setRegionOfInfluenceEnabled(Object const * const object, bool const enabled, bool skipCell) { - if (skipCell && nullptr != object->getCellProperty()) + if (skipCell && NULL != object->getCellProperty()) return; object->setRegionOfInfluenceEnabled(enabled); @@ -67,7 +67,7 @@ ObjectWatcherList::~ObjectWatcherList(void) /** * Add an Object to the ObjectWatcherList. * - * This routine will call Fatal in debug compiles if it is passed a nullptr + * This routine will call Fatal in debug compiles if it is passed a NULL * object. * * This routine will call Fatal in debug compiles if the object list @@ -85,7 +85,7 @@ void ObjectWatcherList::addObject(Object & objectToAdd) /** * Remove an Object from the ObjectWatcherList. * - * This routine will call Fatal in debug compiles if it is passed a nullptr + * This routine will call Fatal in debug compiles if it is passed a NULL * object. * * @param objectToRemove Pointer to the object to remove @@ -112,13 +112,13 @@ void ObjectWatcherList::removeObjectByIndex (const Object & object, int index) // Remove the last item in the vector. m_objectVector->pop_back(); - // nullptr the object from the alter-safe object list. + // NULL the object from the alter-safe object list. uint size = m_alterSafeObjectVector->size(); for (uint i = 0; i < size; ++i) { if ((*m_alterSafeObjectVector)[i] == &object) { - (*m_alterSafeObjectVector)[i] = nullptr; + (*m_alterSafeObjectVector)[i] = NULL; return; } } @@ -232,7 +232,7 @@ void ObjectWatcherList::alter(real time) // Make sure the object is still in the object list before removing it - if ((*m_alterSafeObjectVector)[i] != nullptr) + if ((*m_alterSafeObjectVector)[i] != NULL) { removeObject(*obj); } diff --git a/engine/shared/library/sharedObject/src/shared/appearance/Appearance.cpp b/engine/shared/library/sharedObject/src/shared/appearance/Appearance.cpp index f899e042..e1acba39 100755 --- a/engine/shared/library/sharedObject/src/shared/appearance/Appearance.cpp +++ b/engine/shared/library/sharedObject/src/shared/appearance/Appearance.cpp @@ -80,8 +80,8 @@ void Appearance::setRenderHardpointFunction(RenderHardpointFunction renderHardpo Appearance::Appearance(const AppearanceTemplate *newAppearanceTemplate) : m_appearanceTemplate(AppearanceTemplateList::fetch(newAppearanceTemplate)), - m_extent(m_appearanceTemplate ? ExtentList::fetch(m_appearanceTemplate->getExtent()) : nullptr), - m_owner(nullptr), + m_extent(m_appearanceTemplate ? ExtentList::fetch(m_appearanceTemplate->getExtent()) : NULL), + m_owner(NULL), m_renderedFrameNumber(0), m_scale(Vector::xyz111), m_keepAlive(false), @@ -100,15 +100,15 @@ Appearance::Appearance(const AppearanceTemplate *newAppearanceTemplate) : Appearance::~Appearance() { ExtentList::release(m_extent); - m_extent = nullptr; + m_extent = NULL; if (m_appearanceTemplate) { AppearanceTemplateList::release(m_appearanceTemplate); - m_appearanceTemplate = nullptr; + m_appearanceTemplate = NULL; } - m_owner = nullptr; + m_owner = NULL; } // ---------------------------------------------------------------------- @@ -269,7 +269,7 @@ void Appearance::render() const void Appearance::objectListCameraRenderDescend(Object const & obj) { //-- don't descend through cells - if (nullptr != obj.getCellProperty()) + if (NULL != obj.getCellProperty()) return; int const childCount = obj.getNumberOfChildObjects(); @@ -378,7 +378,7 @@ bool Appearance::implementsCollide() const * CustomizationDataProperty. If there is such a property, this * function will invoke Appearance::setCustomizationData() with the * appropriate value. If the property doesn't exist, this function - * will invoke Appearance::setCustomizationData() with nullptr. Note if + * will invoke Appearance::setCustomizationData() with NULL. Note if * the caller sets the CustomizationDataProperty for an Object after * associating the Object instance with the appearance, the caller is * responsible for calling Appearance::setCustomizationData(). @@ -457,7 +457,7 @@ const char * Appearance::getFloorName () const if (m_appearanceTemplate) return m_appearanceTemplate->getFloorName(); - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -607,7 +607,7 @@ const char * Appearance::getAppearanceTemplateName () const DPVS::Object *Appearance::getDpvsObject() const { - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -748,14 +748,14 @@ SkeletalAppearance2 const * Appearance::asSkeletalAppearance2() const ComponentAppearance * Appearance::asComponentAppearance() { - return nullptr; + return NULL; } // ---------------------------------------------------------------------- ComponentAppearance const * Appearance::asComponentAppearance() const { - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -783,14 +783,14 @@ void Appearance::onEvent(LabelHash::Id /* eventId */) int Appearance::getHardpointCount() const { - return m_appearanceTemplate != nullptr ? m_appearanceTemplate->getHardpointCount() : 0; + return m_appearanceTemplate != NULL ? m_appearanceTemplate->getHardpointCount() : 0; } // ---------------------------------------------------------------------- int Appearance::getHardpointIndex(CrcString const &hardpointName, bool optional) const { - return m_appearanceTemplate != nullptr ? m_appearanceTemplate->getHardpointIndex(hardpointName, optional) : -1; + return m_appearanceTemplate != NULL ? m_appearanceTemplate->getHardpointIndex(hardpointName, optional) : -1; } // ---------------------------------------------------------------------- @@ -855,42 +855,42 @@ bool Appearance::usesRenderEffectsFlag() const ParticleEffectAppearance * Appearance::asParticleEffectAppearance() { - return nullptr; + return NULL; } // ---------------------------------------------------------------------- ParticleEffectAppearance const * Appearance::asParticleEffectAppearance() const { - return nullptr; + return NULL; } // ---------------------------------------------------------------------- SwooshAppearance * Appearance::asSwooshAppearance() { - return nullptr; + return NULL; } // ---------------------------------------------------------------------- SwooshAppearance const * Appearance::asSwooshAppearance() const { - return nullptr; + return NULL; } // ---------------------------------------------------------------------- LightningAppearance * Appearance::asLightningAppearance() { - return nullptr; + return NULL; } // ---------------------------------------------------------------------- LightningAppearance const * Appearance::asLightningAppearance() const { - return nullptr; + return NULL; } // ====================================================================== diff --git a/engine/shared/library/sharedObject/src/shared/appearance/Appearance.h b/engine/shared/library/sharedObject/src/shared/appearance/Appearance.h index 4a7bd5cf..13b49530 100755 --- a/engine/shared/library/sharedObject/src/shared/appearance/Appearance.h +++ b/engine/shared/library/sharedObject/src/shared/appearance/Appearance.h @@ -206,7 +206,7 @@ private: /** * Get the AppearanceTemplate for this Appearance. * - * The AppearanceTemplate may be nullptr. + * The AppearanceTemplate may be NULL. * * AppearanceTemplates may be shared by multiple Appearances. * diff --git a/engine/shared/library/sharedObject/src/shared/appearance/AppearanceTemplate.cpp b/engine/shared/library/sharedObject/src/shared/appearance/AppearanceTemplate.cpp index 0975380d..89f44831 100755 --- a/engine/shared/library/sharedObject/src/shared/appearance/AppearanceTemplate.cpp +++ b/engine/shared/library/sharedObject/src/shared/appearance/AppearanceTemplate.cpp @@ -97,14 +97,14 @@ AppearanceTemplate::PreloadManager::~PreloadManager () AppearanceTemplate::AppearanceTemplate(const char *newName) : m_referenceCount(0), m_crcName(new CrcLowerString(newName)), - m_extent(nullptr), - m_collisionExtent(nullptr), - m_hardpoints(nullptr), - m_floorName(nullptr), + m_extent(NULL), + m_collisionExtent(NULL), + m_hardpoints(NULL), + m_floorName(NULL), m_preloadManager (0) { //-- Save info on most recently constructed appearance template. - IGNORE_RETURN(snprintf(ms_crashReportInfo, sizeof(ms_crashReportInfo) - 1, "AppearanceTemplate: %s\n", newName ? newName : "")); + IGNORE_RETURN(snprintf(ms_crashReportInfo, sizeof(ms_crashReportInfo) - 1, "AppearanceTemplate: %s\n", newName ? newName : "")); ms_crashReportInfo[sizeof(ms_crashReportInfo) - 1] = '\0'; } @@ -118,10 +118,10 @@ AppearanceTemplate::~AppearanceTemplate(void) delete m_crcName; ExtentList::release(m_extent); - m_extent = nullptr; + m_extent = NULL; ExtentList::release(m_collisionExtent); - m_collisionExtent = nullptr; + m_collisionExtent = NULL; if (m_hardpoints) { @@ -482,7 +482,7 @@ const CrcLowerString &AppearanceTemplate::getCrcName() const /** *Get the name of this AppearanceTemplate. * - *This routine may return nullptr. + *This routine may return NULL. */ const char *AppearanceTemplate::getName() const diff --git a/engine/shared/library/sharedObject/src/shared/appearance/AppearanceTemplateList.cpp b/engine/shared/library/sharedObject/src/shared/appearance/AppearanceTemplateList.cpp index d2afe802..37439f23 100755 --- a/engine/shared/library/sharedObject/src/shared/appearance/AppearanceTemplateList.cpp +++ b/engine/shared/library/sharedObject/src/shared/appearance/AppearanceTemplateList.cpp @@ -219,7 +219,7 @@ const AppearanceTemplate *AppearanceTemplateList::fetch(const char *const fileNa char const * actualFileName = fileName; if (!fileName) { - DEBUG_WARNING(true, ("AppearanceTemplateList::fetch passed nullptr fileName, using default")); + DEBUG_WARNING(true, ("AppearanceTemplateList::fetch passed NULL fileName, using default")); actualFileName = getDefaultAppearanceTemplateName(); } else if (!*fileName) @@ -246,14 +246,14 @@ const AppearanceTemplate *AppearanceTemplateList::fetch(const char *const fileNa DEBUG_WARNING(true, ("AppearanceTemplateList::fetch actualFileName fetch for %s failed.", actualFileName)); - return nullptr; + return NULL; } // ---------------------------------------------------------------------- /** * Add a reference to the specified Appearance. * - * This routine will do nothing if passed in nullptr. Otherwise, it will + * This routine will do nothing if passed in NULL. Otherwise, it will * increase the reference count of the specified AppearanceTemplate * by one. * @@ -297,7 +297,7 @@ const AppearanceTemplate *AppearanceTemplateList::fetch(Iff *const iff) return 0; //lint !e527 // unreachable } - AppearanceTemplate *const appearanceTemplate = (*iter).second(nullptr, iff); + AppearanceTemplate *const appearanceTemplate = (*iter).second(NULL, iff); NOT_NULL(appearanceTemplate); addAnonymousAppearanceTemplate(appearanceTemplate); @@ -351,7 +351,7 @@ const AppearanceTemplate *AppearanceTemplateList::fetchNew(AppearanceTemplate *c /** * Remove a reference to the specified AppearanceTemplate. * - * This routine will do nothing if passed in nullptr. + * This routine will do nothing if passed in NULL. * * If the reference count drops to 0, the AppearanceTemplate will be deleted. * @@ -404,9 +404,9 @@ Appearance *AppearanceTemplateList::createAppearance(const char *const fileName) #endif //probably should modify the macro sometime to just be quiet if this isn't defined - if (appearanceTemplate == nullptr){ + if (appearanceTemplate == NULL){ DEBUG_WARNING(true, ("FIX ME: Appearance template for %s could not be fetched - is it missing?", fileName)); - return nullptr; // Cekis: TODO: Figure out why the template can't be fetched. DarthArgus: always is due to a missing file or one of the redirectors having a bad path + return NULL; // Cekis: TODO: Figure out why the template can't be fetched. DarthArgus: always is due to a missing file or one of the redirectors having a bad path } //-- creating the appearance will increment the reference count @@ -581,7 +581,7 @@ AppearanceTemplate *AppearanceTemplateListNamespace::create(const char *const fi // DEBUG_REPORT_LOG_PRINT(true, ("Loading mesh %s\n", actualFileName.getString())); TagBindingMap::iterator iter = ms_tagBindingMap.find(TAG_MESH); if (iter != ms_tagBindingMap.end()) - appearanceTemplate = iter->second(actualFileName.getString(), nullptr); + appearanceTemplate = iter->second(actualFileName.getString(), NULL); } //-- we now need to create the appearance from disk diff --git a/engine/shared/library/sharedObject/src/shared/container/ArrangementDescriptorList.cpp b/engine/shared/library/sharedObject/src/shared/container/ArrangementDescriptorList.cpp index ddc27d42..31de898d 100755 --- a/engine/shared/library/sharedObject/src/shared/container/ArrangementDescriptorList.cpp +++ b/engine/shared/library/sharedObject/src/shared/container/ArrangementDescriptorList.cpp @@ -69,7 +69,7 @@ const ArrangementDescriptor *ArrangementDescriptorList::fetch(const CrcLowerStri } else { - WARNING(true, ("default ArrangementDescriptor [%s] could not be loaded, returning nullptr ArrangementDescriptor", filename.getString())); + WARNING(true, ("default ArrangementDescriptor [%s] could not be loaded, returning NULL ArrangementDescriptor", filename.getString())); return 0; } } diff --git a/engine/shared/library/sharedObject/src/shared/container/ContainedByProperty.cpp b/engine/shared/library/sharedObject/src/shared/container/ContainedByProperty.cpp index 74494ba9..1a25f0cd 100755 --- a/engine/shared/library/sharedObject/src/shared/container/ContainedByProperty.cpp +++ b/engine/shared/library/sharedObject/src/shared/container/ContainedByProperty.cpp @@ -49,7 +49,7 @@ ContainedByProperty::~ContainedByProperty() * property. * * @return Pointer to the object that contains the object with this - * ContainedByProperty. Returns nullptr if the object isn't + * ContainedByProperty. Returns NULL if the object isn't * contained by anything at the moment. */ diff --git a/engine/shared/library/sharedObject/src/shared/container/Container.cpp b/engine/shared/library/sharedObject/src/shared/container/Container.cpp index 66e9e9f4..b85e8f1f 100755 --- a/engine/shared/library/sharedObject/src/shared/container/Container.cpp +++ b/engine/shared/library/sharedObject/src/shared/container/Container.cpp @@ -21,13 +21,13 @@ // ====================================================================== //Lint suppressions. -//lint -esym(613, ContainerIterator::m_iterator) // (Warning -- Possible use of nullptr pointer 'ContainerIterator::m_iterator' ) // This is an opaque data type to us. We can only check against a container::end(). +//lint -esym(613, ContainerIterator::m_iterator) // (Warning -- Possible use of null pointer 'ContainerIterator::m_iterator' ) // This is an opaque data type to us. We can only check against a container::end(). //lint -esym(1540, ContainerIterator::m_iterator) // (Warning -- Pointer member 'ContainerIterator::m_iterator' neither freed nor zero'ed by destructor -- Effective C++ #6) // It's okay, the iterator type is opaque to us, we have no idea it's a pointer. //lint -esym(1554, ContainerIterator::m_iterator) // (Warning -- Direct copy of pointer 'ContainerIterator::m_iterator'. // It's okay, the iterator type is opaque to us, we have no idea it's a pointer. //lint -esym(1555, ContainerIterator::m_iterator) // (Warning -- Direct pointer copy of member 'ContainerIterator::m_iterator' within copy assignment operator: 'ContainerIterator::operator=(const ContainerIterator &) // Opaque type, we don't know its a pointer. //lint -esym(1555, ContainerIterator::m_owner) // (Warning -- Direct pointer copy of member 'ContainerIterator::m_owner' within copy assignment operator: 'ContainerIterator::operator=(const ContainerIterator &) // We do not own this memory, so it's okay to overwrite the pointer. We can't leak it. -//lint -esym(613, ContainerConstIterator::m_iterator) // (Warning -- Possible use of nullptr pointer 'ContainerConstIterator::m_iterator' ) // This is an opaque data type to us. We can only check against a container::end(). +//lint -esym(613, ContainerConstIterator::m_iterator) // (Warning -- Possible use of null pointer 'ContainerConstIterator::m_iterator' ) // This is an opaque data type to us. We can only check against a container::end(). //lint -esym(1540, ContainerConstIterator::m_iterator) // (Warning -- Pointer member 'ContainerConstIterator::m_iterator' neither freed nor zero'ed by destructor -- Effective C++ #6) // It's okay, the iterator type is opaque to us, we have no idea it's a pointer. //lint -esym(1554, ContainerConstIterator::m_iterator) // (Warning -- Direct copy of pointer 'ContainerConstIterator::m_iterator'. // It's okay, the iterator type is opaque to us, we have no idea it's a pointer. //lint -esym(1555, ContainerConstIterator::m_iterator) // (Warning -- Direct pointer copy of member 'ContainerConstIterator::m_iterator' within copy assignment operator: 'ContainerConstIterator::operator=(const ContainerConstIterator &) // Opaque type, we don't know its a pointer. @@ -108,7 +108,7 @@ ContainerIterator & ContainerIterator::operator= (const ContainerIterator & rhs) CachedNetworkId & ContainerIterator::operator*() { // @todo fix this interface -- it is broken. It is possible to - // construct a ContainerIterator with a nullptr m_iterator, but there is + // construct a ContainerIterator with a NULL m_iterator, but there is // no way to gracefully exit from this function since it requires a non-const // reference. Otherwise I would return CachedNetworkId::cms_cachedIvalid. NOT_NULL(m_owner); @@ -197,7 +197,7 @@ ContainerConstIterator & ContainerConstIterator::operator= (const ContainerConst const CachedNetworkId & ContainerConstIterator::operator*() const { // @todo fix this interface -- it is broken. It is possible to - // construct a ContainerIterator with a nullptr m_iterator, but there is + // construct a ContainerIterator with a NULL m_iterator, but there is // no way to gracefully exit from this function since it requires a non-const // reference. Otherwise I would return CachedNetworkId::cms_cachedIvalid. NOT_NULL(m_owner); @@ -677,7 +677,7 @@ void Container::debugPrint(std::string &buffer) const { Object const *const object = it->getObject(); - sprintf(tempBuffer, "\tindex [%d]: object id [%s], template [%s]\n", index, it->getValueString().c_str(), object ? object->getObjectTemplateName() : ""); + sprintf(tempBuffer, "\tindex [%d]: object id [%s], template [%s]\n", index, it->getValueString().c_str(), object ? object->getObjectTemplateName() : ""); buffer += tempBuffer; } @@ -699,7 +699,7 @@ void Container::debugLog() const for (Contents::const_iterator it = m_contents.begin(); it != endIt; ++it, ++index) { Object const *const object = it->getObject(); - DEBUG_REPORT_LOG(true, ("\tindex [%d]: object id [%s], template [%s]\n", index, it->getValueString().c_str(), object ? object->getObjectTemplateName() : "")); + DEBUG_REPORT_LOG(true, ("\tindex [%d]: object id [%s], template [%s]\n", index, it->getValueString().c_str(), object ? object->getObjectTemplateName() : "")); } DEBUG_REPORT_LOG(true, ("====[END: container]====\n")); diff --git a/engine/shared/library/sharedObject/src/shared/container/SlotIdManager.cpp b/engine/shared/library/sharedObject/src/shared/container/SlotIdManager.cpp index 70b6b34d..9aea59ef 100755 --- a/engine/shared/library/sharedObject/src/shared/container/SlotIdManager.cpp +++ b/engine/shared/library/sharedObject/src/shared/container/SlotIdManager.cpp @@ -351,7 +351,7 @@ bool SlotIdManager::isSlotPlayerModifiable(const SlotId &slotId) * * If the slot can have something put in it that directly affects what you * see on the client, this will return true. If this returns false, - * getSlotHardpointName() will return a nullptr string. + * getSlotHardpointName() will return a NULL string. * * @param slotId a SlotId instance for the slot under question. * @@ -381,9 +381,9 @@ bool SlotIdManager::isSlotAppearanceRelated(const SlotId &slotId) * * The caller should check the result of isSlotAppearanceRelated() before * calling this function. If the slot is not appearance related, this function - * will always return nullptr. Also, if the SlotIdManager is installed such that + * will always return NULL. Also, if the SlotIdManager is installed such that * hardpoint names are not loaded (currently the server is loaded this way), - * the specified hardpoint name will return nullptr. + * the specified hardpoint name will return NULL. * * @param slotId a SlotId instance for the slot under question. * diff --git a/engine/shared/library/sharedObject/src/shared/container/SlottedContainer.cpp b/engine/shared/library/sharedObject/src/shared/container/SlottedContainer.cpp index 98b85e82..b97b1a24 100755 --- a/engine/shared/library/sharedObject/src/shared/container/SlottedContainer.cpp +++ b/engine/shared/library/sharedObject/src/shared/container/SlottedContainer.cpp @@ -49,7 +49,7 @@ SlottedContainer::~SlottedContainer() if (m_slotMap) { delete m_slotMap; - m_slotMap = nullptr; + m_slotMap = NULL; } } diff --git a/engine/shared/library/sharedObject/src/shared/container/VolumeContainer.cpp b/engine/shared/library/sharedObject/src/shared/container/VolumeContainer.cpp index fe716109..02433163 100755 --- a/engine/shared/library/sharedObject/src/shared/container/VolumeContainer.cpp +++ b/engine/shared/library/sharedObject/src/shared/container/VolumeContainer.cpp @@ -36,7 +36,7 @@ namespace VolumeContainerNamespace return parent->getVolumeContainerProperty(); } } - return nullptr; + return NULL; } const VolumeContainer* getVolumeContainerParent(const VolumeContainer& self) @@ -51,7 +51,7 @@ namespace VolumeContainerNamespace return parent->getVolumeContainerProperty(); } } - return nullptr; + return NULL; } const unsigned int serverHolocronCrc = CrcLowerString::calculateCrc("object/player_quest/pgc_quest_holocron.iff"); diff --git a/engine/shared/library/sharedObject/src/shared/container/VolumeContainer.h b/engine/shared/library/sharedObject/src/shared/container/VolumeContainer.h index f99766dc..922154f7 100755 --- a/engine/shared/library/sharedObject/src/shared/container/VolumeContainer.h +++ b/engine/shared/library/sharedObject/src/shared/container/VolumeContainer.h @@ -69,8 +69,8 @@ public: private: bool checkVolume(const VolumeContainmentProperty &item) const; - bool internalRemove(const Object & item, const VolumeContainmentProperty *itemProp = nullptr); - void insertNewItem(const Object & item, const VolumeContainmentProperty *itemProp = nullptr); + bool internalRemove(const Object & item, const VolumeContainmentProperty *itemProp = NULL); + void insertNewItem(const Object & item, const VolumeContainmentProperty *itemProp = NULL); void childVolumeChanged(int volume, bool updateParent); diff --git a/engine/shared/library/sharedObject/src/shared/controller/Controller.cpp b/engine/shared/library/sharedObject/src/shared/controller/Controller.cpp index 2483e64b..66572a6a 100755 --- a/engine/shared/library/sharedObject/src/shared/controller/Controller.cpp +++ b/engine/shared/library/sharedObject/src/shared/controller/Controller.cpp @@ -88,7 +88,7 @@ MessageQueue::Data* Controller::peekHeldMessage( int message, float *value, uint { HeldMessageMap::iterator iter = m_heldMessages.find( message ); if ( iter == m_heldMessages.end() ) - return nullptr; + return NULL; if ( value ) *value = iter->second.value; if ( flags ) @@ -216,42 +216,42 @@ MessageQueue * Controller::getMessageQueue() TangibleController * Controller::asTangibleController() { - return nullptr; + return NULL; } //---------------------------------------------------------------------- TangibleController const * Controller::asTangibleController() const { - return nullptr; + return NULL; } //---------------------------------------------------------------------- CreatureController * Controller::asCreatureController() { - return nullptr; + return NULL; } //---------------------------------------------------------------------- CreatureController const * Controller::asCreatureController() const { - return nullptr; + return NULL; } //---------------------------------------------------------------------- ShipController * Controller::asShipController() { - return nullptr; + return NULL; } //---------------------------------------------------------------------- ShipController const * Controller::asShipController() const { - return nullptr; + return NULL; } // ====================================================================== diff --git a/engine/shared/library/sharedObject/src/shared/core/SetupSharedObject.cpp b/engine/shared/library/sharedObject/src/shared/core/SetupSharedObject.cpp index d25d9be1..69799beb 100755 --- a/engine/shared/library/sharedObject/src/shared/core/SetupSharedObject.cpp +++ b/engine/shared/library/sharedObject/src/shared/core/SetupSharedObject.cpp @@ -55,7 +55,7 @@ SetupSharedObject::Data::Data() customizationIdManagerFilename(0), objectsAlterChildrenAndContents(true), loadObjectTemplateCrcStringTable(true), - pobEjectionTransformFilename(nullptr) + pobEjectionTransformFilename(NULL) { } diff --git a/engine/shared/library/sharedObject/src/shared/core/SetupSharedObject.h b/engine/shared/library/sharedObject/src/shared/core/SetupSharedObject.h index ce43740e..dd38e215 100755 --- a/engine/shared/library/sharedObject/src/shared/core/SetupSharedObject.h +++ b/engine/shared/library/sharedObject/src/shared/core/SetupSharedObject.h @@ -70,7 +70,7 @@ public: // Specifies whether or not ObjectTemplateList should load the object template crc table bool loadObjectTemplateCrcStringTable; - // Specifies the name of the POB ejection point transform override filename to use; use nullptr (default) if no ejection point support. + // Specifies the name of the POB ejection point transform override filename to use; use NULL (default) if no ejection point support. char const *pobEjectionTransformFilename; private: diff --git a/engine/shared/library/sharedObject/src/shared/customization/CustomizationData.cpp b/engine/shared/library/sharedObject/src/shared/customization/CustomizationData.cpp index a05ed186..e27808f2 100755 --- a/engine/shared/library/sharedObject/src/shared/customization/CustomizationData.cpp +++ b/engine/shared/library/sharedObject/src/shared/customization/CustomizationData.cpp @@ -277,10 +277,10 @@ CustomizationData::CustomizationData(Object &owner) : void CustomizationData::addVariableTakeOwnership(const std::string &fullVariablePathName, CustomizationVariable *variable) { - //-- check for nullptr variable + //-- check for null variable if (!variable) { - WARNING(true, ("addVariableTakeOwnership() called with nullptr variable.\n")); + WARNING(true, ("addVariableTakeOwnership() called with null variable.\n")); return; } @@ -591,7 +591,7 @@ std::string CustomizationData::writeLocalDataToString() const saveToByteVector(binaryData); - //-- Convert binary data to string. We're escaping the 0 for the database so this is a non-nullptr string. + //-- Convert binary data to string. We're escaping the 0 for the database so this is a non-null string. // We translate 0x00 => 0xff 0x01 // 0xff => 0xff 0x02 std::string returnValue; @@ -1139,7 +1139,7 @@ void CustomizationData::notifyPendingRemoteDestruction(const CustomizationData * //-- validate arg if (!customizationData) { - DEBUG_WARNING(true, ("notifyPendingRemoteDestruction(): customizationData arg is nullptr")); + DEBUG_WARNING(true, ("notifyPendingRemoteDestruction(): customizationData arg is null")); return; } diff --git a/engine/shared/library/sharedObject/src/shared/customization/CustomizationData_LocalDirectory.cpp b/engine/shared/library/sharedObject/src/shared/customization/CustomizationData_LocalDirectory.cpp index 1a12a2fd..3a8422cb 100755 --- a/engine/shared/library/sharedObject/src/shared/customization/CustomizationData_LocalDirectory.cpp +++ b/engine/shared/library/sharedObject/src/shared/customization/CustomizationData_LocalDirectory.cpp @@ -95,7 +95,7 @@ bool CustomizationData::LocalDirectory::resolvePathNameToDirectory(const std::st //-- ensure we've got a directory if (!subdir) { - WARNING(true, ("resolvePathNameToDirectory(): logic failure, subdir is nullptr")); + WARNING(true, ("resolvePathNameToDirectory(): logic failure, subdir is null")); return false; } @@ -110,7 +110,7 @@ bool CustomizationData::LocalDirectory::addVariableTakeOwnership(const std::stri //-- ensure caller passed in valid customizationVariable if (!variable) { - WARNING(true, ("addVariableTakeOwnership(): caller passed in nullptr variable")); + WARNING(true, ("addVariableTakeOwnership(): caller passed in NULL variable")); return false; } @@ -210,10 +210,10 @@ CustomizationData::Directory *CustomizationData::LocalDirectory::findDirectory(c void CustomizationData::LocalDirectory::deleteDirectory(Directory *childDirectory) { - //-- check for nullptr directory + //-- check for null directory if (!childDirectory) { - WARNING(true, ("deleteDirectory(): nullptr childDirectory arg")); + WARNING(true, ("deleteDirectory(): NULL childDirectory arg")); return; } @@ -255,10 +255,10 @@ void CustomizationData::LocalDirectory::iterateOverConstVariables(const std::str const DirectoryMap::const_iterator endIt = m_directories.end(); for (DirectoryMap::const_iterator it = m_directories.begin(); it != endIt; ++it) { - //-- check for nullptr directory pointer (shouldn't happen but shouldn't FATAL) + //-- check for null directory pointer (shouldn't happen but shouldn't FATAL) if (!it->second) { - WARNING(true, ("iterateOverConstVariables(): directory 0x%08x has nullptr child directory for [%s].", this, it->first.getString())); + WARNING(true, ("iterateOverConstVariables(): directory 0x%08x has null child directory for [%s].", this, it->first.getString())); return; } @@ -292,10 +292,10 @@ void CustomizationData::LocalDirectory::iterateOverVariables(const std::string & const DirectoryMap::iterator endIt = m_directories.end(); for (DirectoryMap::iterator it = m_directories.begin(); it != endIt; ++it) { - //-- check for nullptr directory pointer (shouldn't happen but shouldn't FATAL) + //-- check for null directory pointer (shouldn't happen but shouldn't FATAL) if (!it->second) { - WARNING(true, ("iterateOverConstVariables(): directory 0x%08x has nullptr child directory for [%s].", this, it->first.getString())); + WARNING(true, ("iterateOverConstVariables(): directory 0x%08x has null child directory for [%s].", this, it->first.getString())); return; } @@ -314,10 +314,10 @@ void CustomizationData::LocalDirectory::iterateOverVariables(const std::string & void CustomizationData::LocalDirectory::replaceOrAddDirectory(const std::string &directoryPathName, int directoryNameStartIndex, Directory *directory) { - //-- ensure attached directory is not nullptr + //-- ensure attached directory is not null if (!directory) { - WARNING(true, ("replaceOrAddDirectory(): directory arg is nullptr")); + WARNING(true, ("replaceOrAddDirectory(): directory arg is NULL")); return; } @@ -411,7 +411,7 @@ std::string CustomizationData::LocalDirectory::writeLocalDirectoryToString() con const CustomizationVariableMap::const_iterator endIt = m_variables.end(); for (CustomizationVariableMap::const_iterator it = m_variables.begin(); it != endIt; ++it) { - //-- verify it's a non-nullptr variable + //-- verify it's a non-null variable const CustomizationVariable *const variable = it->second; if (variable && variable->doesVariablePersist()) { @@ -430,11 +430,11 @@ std::string CustomizationData::LocalDirectory::writeLocalDirectoryToString() con const CustomizationVariableMap::const_iterator endIt = m_variables.end(); for (CustomizationVariableMap::const_iterator it = m_variables.begin(); it != endIt; ++it) { - //-- verify it's a non-nullptr variable + //-- verify it's a non-null variable const CustomizationVariable *const variable = it->second; if (!variable) { - WARNING(true, ("writeLocalDirectoryToString: nullptr variable for [%s], skipping variable writing.")); + WARNING(true, ("writeLocalDirectoryToString: NULL variable for [%s], skipping variable writing.")); continue; } diff --git a/engine/shared/library/sharedObject/src/shared/customization/CustomizationIdManager.cpp b/engine/shared/library/sharedObject/src/shared/customization/CustomizationIdManager.cpp index b21696d4..32208e24 100755 --- a/engine/shared/library/sharedObject/src/shared/customization/CustomizationIdManager.cpp +++ b/engine/shared/library/sharedObject/src/shared/customization/CustomizationIdManager.cpp @@ -189,7 +189,7 @@ bool CustomizationIdManager::mapIdToString(int id, char *variableName, int buffe NOT_NULL(variableName); DEBUG_FATAL(bufferLength < 1, ("CustomizationIdManager: bufferLength of [%d] too small to hold anything.", bufferLength)); - //-- Copy variable name to user buffer, ensure it gets nullptr terminated. + //-- Copy variable name to user buffer, ensure it gets NULL terminated. strncpy(variableName, NON_NULL(s_idToVariableName[static_cast(id)])->getString(), static_cast(bufferLength - 1)); variableName[bufferLength - 1] = '\0'; diff --git a/engine/shared/library/sharedObject/src/shared/customization/ObjectTemplateCustomizationDataWriter.cpp b/engine/shared/library/sharedObject/src/shared/customization/ObjectTemplateCustomizationDataWriter.cpp index 3e18e9a9..a02bf9d0 100755 --- a/engine/shared/library/sharedObject/src/shared/customization/ObjectTemplateCustomizationDataWriter.cpp +++ b/engine/shared/library/sharedObject/src/shared/customization/ObjectTemplateCustomizationDataWriter.cpp @@ -149,7 +149,7 @@ bool ObjectTemplateCustomizationDataWriter::writeToFile(const std::string &pathN if (!allowOverwrite) { FILE *const testFile = fopen(pathName.c_str(), "r"); - if (testFile != nullptr) + if (testFile != NULL) { fclose(testFile); DEBUG_REPORT_LOG(true, ("writeToFile(): overwrite attempt: skipped writing [%s] because it already exists and allowOverwrite == false.\n", pathName.c_str())); diff --git a/engine/shared/library/sharedObject/src/shared/lot/LotManager.cpp b/engine/shared/library/sharedObject/src/shared/lot/LotManager.cpp index 6d379528..eb5ee6bf 100755 --- a/engine/shared/library/sharedObject/src/shared/lot/LotManager.cpp +++ b/engine/shared/library/sharedObject/src/shared/lot/LotManager.cpp @@ -129,7 +129,7 @@ void LotManager::addNoBuildEntry (Object const & object, float const noBuildRadi bool const result = m_noBuildEntryMap->insert (std::make_pair (&object, noBuildEntry)).second; UNREF (result); DEBUG_FATAL (!result, ("LotManager::addNoBuildEntry - entry already exists")); - DEBUG_REPORT_LOG (ms_logEntries, ("LotManager: added no build entry for object %s [%s] at <%1.2f, %1.2f>\n", object.getNetworkId ().getValueString ().c_str (), object.getObjectTemplateName () ? object.getObjectTemplateName () : "nullptr", position_w.x, position_w.z)); + DEBUG_REPORT_LOG (ms_logEntries, ("LotManager: added no build entry for object %s [%s] at <%1.2f, %1.2f>\n", object.getNetworkId ().getValueString ().c_str (), object.getObjectTemplateName () ? object.getObjectTemplateName () : "null", position_w.x, position_w.z)); } //------------------------------------------------------------------- @@ -150,7 +150,7 @@ void LotManager::removeNoBuildEntry (const Object& object) else DEBUG_FATAL (true, ("LotManager::removeNoBuildEntry - entry not found")); - DEBUG_REPORT_LOG (ms_logEntries, ("LotManager: removed no build entry for object %s [%s]\n", object.getNetworkId ().getValueString ().c_str (), object.getObjectTemplateName () ? object.getObjectTemplateName () : "nullptr")); + DEBUG_REPORT_LOG (ms_logEntries, ("LotManager: removed no build entry for object %s [%s]\n", object.getNetworkId ().getValueString ().c_str (), object.getObjectTemplateName () ? object.getObjectTemplateName () : "null")); } //------------------------------------------------------------------- @@ -177,7 +177,7 @@ void LotManager::addStructureFootprintEntry (const Object& object, const Structu UNREF (result); DEBUG_FATAL (!result, ("LotManager::addStructureFootprintEntry - entry already exists")); - DEBUG_REPORT_LOG (ms_logEntries, ("LotManager: added structure footprint entry for object %s [%s] at <%1.2f, %1.2f>\n", object.getNetworkId ().getValueString ().c_str (), object.getObjectTemplateName () ? object.getObjectTemplateName () : "nullptr", x * m_chunkWidthInMeters + m_chunkWidthInMeters * 0.5f, z * m_chunkWidthInMeters + m_chunkWidthInMeters * 0.5f)); + DEBUG_REPORT_LOG (ms_logEntries, ("LotManager: added structure footprint entry for object %s [%s] at <%1.2f, %1.2f>\n", object.getNetworkId ().getValueString ().c_str (), object.getObjectTemplateName () ? object.getObjectTemplateName () : "null", x * m_chunkWidthInMeters + m_chunkWidthInMeters * 0.5f, z * m_chunkWidthInMeters + m_chunkWidthInMeters * 0.5f)); } //------------------------------------------------------------------- @@ -191,7 +191,7 @@ void LotManager::removeStructureFootprintEntry (const Object& object) else DEBUG_FATAL (true, ("LotManager::removeStructureFootprintEntry - entry not found")); - DEBUG_REPORT_LOG (ms_logEntries, ("LotManager: removed structure footprint entry for object %s [%s]\n", object.getNetworkId ().getValueString ().c_str (), object.getObjectTemplateName () ? object.getObjectTemplateName () : "nullptr")); + DEBUG_REPORT_LOG (ms_logEntries, ("LotManager: removed structure footprint entry for object %s [%s]\n", object.getNetworkId ().getValueString ().c_str (), object.getObjectTemplateName () ? object.getObjectTemplateName () : "null")); } //------------------------------------------------------------------- diff --git a/engine/shared/library/sharedObject/src/shared/object/AlterScheduler.cpp b/engine/shared/library/sharedObject/src/shared/object/AlterScheduler.cpp index dc2a932c..e09b9c37 100755 --- a/engine/shared/library/sharedObject/src/shared/object/AlterScheduler.cpp +++ b/engine/shared/library/sharedObject/src/shared/object/AlterScheduler.cpp @@ -277,13 +277,13 @@ void AlterSchedulerNamespace::reportPrint() // ---------------------------------------------------------------------- /** - * nullptr objects are not considered valid by this function. Do not call this on a nullptr + * NULL objects are not considered valid by this function. Do not call this on a NULL * object if that happens to be valid in the context in which this function is used. */ void AlterSchedulerNamespace::validateObject(Object const *object) { - FATAL(!object, ("validateObject(): alter scheduler found nullptr object.")); + FATAL(!object, ("validateObject(): alter scheduler found NULL object.")); DO_ON_VALIDATE_OBJECTS(bool isInvalid = false); @@ -331,7 +331,7 @@ void AlterSchedulerNamespace::validateObject(Object const *object) if (isInvalid) { //-- Print out object info for the invalid object if we have it. - ObjectInfo *objectInfo = nullptr; + ObjectInfo *objectInfo = NULL; if (s_trackObjectInfo) { ObjectInfoMap::iterator findIt = s_objectInfoMap.find(const_cast(object)); @@ -352,7 +352,7 @@ void AlterSchedulerNamespace::validateObject(Object const *object) // ---------------------------------------------------------------------- /** - * Return true if two strings are the same (or are both nullptr); otherwise, return false. + * Return true if two strings are the same (or are both NULL); otherwise, return false. */ static bool SafeStringEqual(char const *string1, char const *string2) @@ -682,7 +682,7 @@ void AlterScheduler::alter(float elapsedTime) DO_ON_DEBUG(if (s_suspendExecution) return); PROFILER_AUTO_BLOCK_DEFINE("AlterScheduler::alter"); - doAlterAndConcludeForAllObjects(elapsedTime, CS_none, nullptr); + doAlterAndConcludeForAllObjects(elapsedTime, CS_none, NULL); } // ---------------------------------------------------------------------- @@ -702,7 +702,7 @@ void AlterScheduler::alterAndConclude(float elapsedTime) DO_ON_DEBUG(if (s_suspendExecution) return); PROFILER_AUTO_BLOCK_DEFINE("AlterScheduler::alterAndConclude"); - doAlterAndConcludeForAllObjects(elapsedTime, CS_all, nullptr); + doAlterAndConcludeForAllObjects(elapsedTime, CS_all, NULL); } // ---------------------------------------------------------------------- @@ -724,7 +724,7 @@ void AlterScheduler::initializeScheduleTimeMapIterator(Object &object) bool AlterScheduler::isIteratorInScheduleTimeMap(void const *iterator) { - DEBUG_FATAL(!iterator, ("AlterScheduler::isIteratorInScheduleTimeMap(): iterator pointer is nullptr.")); + DEBUG_FATAL(!iterator, ("AlterScheduler::isIteratorInScheduleTimeMap(): iterator pointer is NULL.")); return (*static_cast(iterator) != s_scheduleMap.end()); } @@ -734,7 +734,7 @@ bool AlterScheduler::findObjectInAlterNowList(Object const *object) { DO_ON_HARDCORE_VALIDATION(validateAlterNowList()); - for (Object *searchObject = s_alterNowListFirst->getNextFromAlterNowList(); searchObject != nullptr; searchObject = searchObject->getNextFromAlterNowList()) + for (Object *searchObject = s_alterNowListFirst->getNextFromAlterNowList(); searchObject != NULL; searchObject = searchObject->getNextFromAlterNowList()) { if (searchObject == object) return true; @@ -751,7 +751,7 @@ bool AlterScheduler::findObjectInAlterNextFrameLists(Object const *object) for (int phaseIndex = 0; phaseIndex < AS_MAX_SCHEDULE_PHASE_COUNT; ++phaseIndex) { - for (Object *searchObject = s_alterNextFrameListFirst[phaseIndex]->getNextFromAlterNextFrameList(); searchObject != nullptr; searchObject = searchObject->getNextFromAlterNextFrameList()) + for (Object *searchObject = s_alterNextFrameListFirst[phaseIndex]->getNextFromAlterNextFrameList(); searchObject != NULL; searchObject = searchObject->getNextFromAlterNextFrameList()) { if (searchObject == object) return true; @@ -767,7 +767,7 @@ bool AlterScheduler::findObjectInConcludeList(Object const *object) { DO_ON_HARDCORE_VALIDATION(validateConcludeList()); - for (Object *searchObject = s_concludeListFirst->getNextFromConcludeList(); searchObject != nullptr; searchObject = searchObject->getNextFromConcludeList()) + for (Object *searchObject = s_concludeListFirst->getNextFromConcludeList(); searchObject != NULL; searchObject = searchObject->getNextFromConcludeList()) { if (searchObject == object) return true; @@ -817,7 +817,7 @@ void AlterScheduler::validateAlterNowList() //-- Add each object to the set and list. { - for (Object *object = s_alterNowListFirst->getNextFromAlterNowList(); object != nullptr; object = object->getNextFromAlterNowList()) + for (Object *object = s_alterNowListFirst->getNextFromAlterNowList(); object != NULL; object = object->getNextFromAlterNowList()) { DO_ON_VALIDATE_OBJECTS(validateObject(object)); @@ -836,7 +836,7 @@ void AlterScheduler::validateAlterNowList() { ObjectList::iterator const endIt = objectList.end(); Object *object = s_alterNowListFirst->getNextFromAlterNowList(); - for (ObjectList::iterator it = objectList.begin(); (it != endIt) && (object != nullptr); object = object->getNextFromAlterNowList(), ++it) + for (ObjectList::iterator it = objectList.begin(); (it != endIt) && (object != NULL); object = object->getNextFromAlterNowList(), ++it) { lastObject = object; DEBUG_WARNING(object != *it, ("validateAlterNowList(): forward linkage check failed, stl list: pointer=[%p], object id=[%s], object template=[%s].", *it, (*it)->getNetworkId().getValueString().c_str(), (*it)->getObjectTemplateName())); @@ -848,7 +848,7 @@ void AlterScheduler::validateAlterNowList() { ObjectList::reverse_iterator const endIt = objectList.rend(); Object *object = lastObject; - for (ObjectList::reverse_iterator it = objectList.rbegin(); (it != endIt) && (object != nullptr); object = object->getPreviousFromAlterNowList(), ++it) + for (ObjectList::reverse_iterator it = objectList.rbegin(); (it != endIt) && (object != NULL); object = object->getPreviousFromAlterNowList(), ++it) { DEBUG_WARNING(object != *it, ("validateAlterNowList(): reverse linkage check failed, stl list: pointer=[%p], object id=[%s], object template=[%s].", *it, (*it)->getNetworkId().getValueString().c_str(), (*it)->getObjectTemplateName())); DEBUG_FATAL(object != *it, ("validateAlterNowList(): reverse linkage check failed, alter scheduler list: pointer=[%p], object id=[%s], object template=[%s].", object, object->getNetworkId().getValueString().c_str(), object->getObjectTemplateName())); @@ -867,7 +867,7 @@ void AlterScheduler::validateAlterNextFrameLists() { //-- Add each object to the set and list. { - for (Object *object = s_alterNextFrameListFirst[phaseIndex]->getNextFromAlterNextFrameList(); object != nullptr; object = object->getNextFromAlterNextFrameList()) + for (Object *object = s_alterNextFrameListFirst[phaseIndex]->getNextFromAlterNextFrameList(); object != NULL; object = object->getNextFromAlterNextFrameList()) { DO_ON_VALIDATE_OBJECTS(validateObject(object)); @@ -886,7 +886,7 @@ void AlterScheduler::validateAlterNextFrameLists() { ObjectList::iterator const endIt = objectList.end(); Object *object = s_alterNextFrameListFirst[phaseIndex]->getNextFromAlterNextFrameList(); - for (ObjectList::iterator it = objectList.begin(); (it != endIt) && (object != nullptr); object = object->getNextFromAlterNextFrameList(), ++it) + for (ObjectList::iterator it = objectList.begin(); (it != endIt) && (object != NULL); object = object->getNextFromAlterNextFrameList(), ++it) { lastObject = object; DEBUG_WARNING(object != *it, ("validateAlterNextFrameList(): forward linkage check failed, stl list: pointer=[%p], object id=[%s], object template=[%s].", *it, (*it)->getNetworkId().getValueString().c_str(), (*it)->getObjectTemplateName())); @@ -898,7 +898,7 @@ void AlterScheduler::validateAlterNextFrameLists() { ObjectList::reverse_iterator const endIt = objectList.rend(); Object *object = lastObject; - for (ObjectList::reverse_iterator it = objectList.rbegin(); (it != endIt) && (object != nullptr); object = object->getPreviousFromAlterNextFrameList(), ++it) + for (ObjectList::reverse_iterator it = objectList.rbegin(); (it != endIt) && (object != NULL); object = object->getPreviousFromAlterNextFrameList(), ++it) { DEBUG_WARNING(object != *it, ("validateAlterNextFrameList(): reverse linkage check failed, stl list: pointer=[%p], object id=[%s], object template=[%s].", *it, (*it)->getNetworkId().getValueString().c_str(), (*it)->getObjectTemplateName())); DEBUG_FATAL(object != *it, ("validateAlterNextFrameList(): reverse linkage check failed, alter scheduler list: pointer=[%p], object id=[%s], object template=[%s].", object, object->getNetworkId().getValueString().c_str(), object->getObjectTemplateName())); @@ -919,7 +919,7 @@ void AlterScheduler::validateConcludeList() //-- Add each object to the set and list. { - for (Object *object = s_concludeListFirst->getNextFromConcludeList(); object != nullptr; object = object->getNextFromConcludeList()) + for (Object *object = s_concludeListFirst->getNextFromConcludeList(); object != NULL; object = object->getNextFromConcludeList()) { DO_ON_VALIDATE_OBJECTS(validateObject(object)); @@ -938,7 +938,7 @@ void AlterScheduler::validateConcludeList() { ObjectList::iterator const endIt = objectList.end(); Object *object = s_concludeListFirst->getNextFromConcludeList(); - for (ObjectList::iterator it = objectList.begin(); (it != endIt) && (object != nullptr); object = object->getNextFromConcludeList(), ++it) + for (ObjectList::iterator it = objectList.begin(); (it != endIt) && (object != NULL); object = object->getNextFromConcludeList(), ++it) { lastObject = object; DEBUG_WARNING(object != *it, ("validateConcludeList(): forward linkage check failed, stl list: pointer=[%p], object id=[%s], object template=[%s].", *it, (*it)->getNetworkId().getValueString().c_str(), (*it)->getObjectTemplateName())); @@ -950,7 +950,7 @@ void AlterScheduler::validateConcludeList() { ObjectList::reverse_iterator const endIt = objectList.rend(); Object *object = lastObject; - for (ObjectList::reverse_iterator it = objectList.rbegin(); (it != endIt) && (object != nullptr); object = object->getPreviousFromConcludeList(), ++it) + for (ObjectList::reverse_iterator it = objectList.rbegin(); (it != endIt) && (object != NULL); object = object->getPreviousFromConcludeList(), ++it) { DEBUG_WARNING(object != *it, ("validateConcludeList(): reverse linkage check failed, stl list: pointer=[%p], object id=[%s], object template=[%s].", *it, (*it)->getNetworkId().getValueString().c_str(), (*it)->getObjectTemplateName())); DEBUG_FATAL(object != *it, ("validateConcludeList(): reverse linkage check failed, alter scheduler list: pointer=[%p], object id=[%s], object template=[%s].", object, object->getNetworkId().getValueString().c_str(), object->getObjectTemplateName())); @@ -1184,8 +1184,8 @@ void AlterScheduler::moveObjectsFromAlterNextFrameListToAlterNowList(int schedul { PROFILER_AUTO_BLOCK_DEFINE("copy next frame"); - //if (s_alterNextFrameListFirst != nullptr) { - for (Object *object = s_alterNextFrameListFirst[schedulePhaseIndex]->getNextFromAlterNextFrameList(); object != nullptr; ) + //if (s_alterNextFrameListFirst != NULL) { + for (Object *object = s_alterNextFrameListFirst[schedulePhaseIndex]->getNextFromAlterNextFrameList(); object != NULL; ) { //-- Add object to alter now list. This removes the object from the alter next frame list. DO_ON_VALIDATE_OBJECTS(validateObject(object)); @@ -1222,7 +1222,7 @@ void AlterScheduler::alterSingleObject(Object *object, ConcludeStyle concludeSty DO_ON_DEBUG(s_currentlyAlteringObject = object); #if defined(_WIN32) && defined(_DEBUG) - char const * const typeName = s_profileAlterByType ? typeid(*object).name() : nullptr; + char const * const typeName = s_profileAlterByType ? typeid(*object).name() : NULL; PROFILER_BLOCK_DEFINE(profilerBlock, typeName); if (typeName) PROFILER_BLOCK_ENTER(profilerBlock); @@ -1245,7 +1245,7 @@ void AlterScheduler::alterSingleObject(Object *object, ConcludeStyle concludeSty PROFILER_BLOCK_LEAVE(profilerBlock); #endif - DO_ON_DEBUG(s_currentlyAlteringObject = nullptr); + DO_ON_DEBUG(s_currentlyAlteringObject = NULL); DO_ON_VALIDATE_OBJECTS(validateObject(object)); } @@ -1254,7 +1254,7 @@ void AlterScheduler::alterSingleObject(Object *object, ConcludeStyle concludeSty nextObject = object->getNextFromAlterNowList(); #if VALIDATE_OBJECTS - if (nextObject != nullptr) + if (nextObject != NULL) { DO_ON_HARDCORE_VALIDATION(DEBUG_FATAL(!findObjectInAlterNowList(nextObject), ("didn't find object in alter now list, unexpected."))); validateObject(nextObject); @@ -1343,7 +1343,7 @@ void AlterScheduler::alterSingleObject(Object *object, ConcludeStyle concludeSty ScheduleTime const absoluteScheduleTime = s_currentTime + dt; // Add it to the schedule list for the specified scheduler time. - // If this object is nullptr, it means it returned an AlterResult that indicated it should still be alive but it somehow got killed. + // If this object is NULL, it means it returned an AlterResult that indicated it should still be alive but it somehow got killed. //DEBUG_REPORT_LOG(object->getNetworkId() != NetworkId::cms_invalid, ("[aitest] scheduling %s to alter at %lu (%lu + %lu)\n", // object->getNetworkId().getValueString().c_str(), // static_cast(absoluteScheduleTime), @@ -1363,7 +1363,7 @@ void AlterScheduler::concludeAndRemoveAllConcludeEntries() PROFILER_AUTO_BLOCK_DEFINE("conclude"); Object *nextObject; - for (Object *object = s_concludeListFirst->getNextFromConcludeList(); object != nullptr; object = nextObject) + for (Object *object = s_concludeListFirst->getNextFromConcludeList(); object != NULL; object = nextObject) { //-- Conclude the object. DO_ON_VALIDATE_OBJECTS(validateObject(object)); @@ -1400,7 +1400,7 @@ void AlterScheduler::doAlterAndConcludeForAllObjects(float schedulerElapsedTime, DO_ON_HARDCORE_VALIDATION(validateAllContainers()); Object *nextObject; - for (Object *object = s_alterNowListFirst->getNextFromAlterNowList(); object != nullptr; object = nextObject) + for (Object *object = s_alterNowListFirst->getNextFromAlterNowList(); object != NULL; object = nextObject) alterSingleObject(object, concludeStyle, nextObject); } diff --git a/engine/shared/library/sharedObject/src/shared/object/CachedNetworkId.cpp b/engine/shared/library/sharedObject/src/shared/object/CachedNetworkId.cpp index ea766f6e..47c87004 100755 --- a/engine/shared/library/sharedObject/src/shared/object/CachedNetworkId.cpp +++ b/engine/shared/library/sharedObject/src/shared/object/CachedNetworkId.cpp @@ -32,7 +32,7 @@ void CachedNetworkId::checkValidity() const CachedNetworkId::CachedNetworkId() : m_id(cms_invalid), -m_object(nullptr) +m_object(NULL) { } @@ -40,7 +40,7 @@ m_object(nullptr) CachedNetworkId::CachedNetworkId(const NetworkId& id) : m_id(id), -m_object(nullptr) +m_object(NULL) { } @@ -48,7 +48,7 @@ m_object(nullptr) CachedNetworkId::CachedNetworkId(NetworkId::NetworkIdType value) : m_id(value), -m_object(nullptr) +m_object(NULL) { } @@ -66,7 +66,7 @@ m_object(const_cast(&object)) CachedNetworkId::CachedNetworkId(const std::string &value) : m_id(value), -m_object(nullptr) +m_object(NULL) { } @@ -98,7 +98,7 @@ CachedNetworkId& CachedNetworkId::operator= (const CachedNetworkId& rhs) CachedNetworkId& CachedNetworkId::operator= (const NetworkId& rhs) { m_id = rhs; - m_object = nullptr; + m_object = NULL; return *this; } // ---------------------------------------------------------- @@ -178,7 +178,7 @@ Object* CachedNetworkId::getObject() const return m_object; } - return nullptr; + return NULL; } // ---------------------------------------------------------- diff --git a/engine/shared/library/sharedObject/src/shared/object/Object.cpp b/engine/shared/library/sharedObject/src/shared/object/Object.cpp index 2cad0571..73273e36 100755 --- a/engine/shared/library/sharedObject/src/shared/object/Object.cpp +++ b/engine/shared/library/sharedObject/src/shared/object/Object.cpp @@ -515,7 +515,7 @@ void ObjectNamespace::remove() #endif delete ms_transformMemoryBlockManager; - ms_transformMemoryBlockManager = nullptr; + ms_transformMemoryBlockManager = NULL; DEBUG_WARNING(static_cast(ms_freeDpvsObjectsList.size()) != ms_allocatedDpvsObjects, ("Leaked %d DpvsObjects lists", ms_allocatedDpvsObjects - static_cast(ms_freeDpvsObjectsList.size()))); while (!ms_systemAllocatedDpvsObjectsList.empty()) @@ -570,11 +570,11 @@ void ObjectNamespace::validatePosition(Object const & object, Vector const & pos object.getNetworkId().getValueString().c_str(), object.getObjectTemplateName(), &object, - object.getAppearance() ? object.getAppearance()->getAppearanceTemplateName() : nullptr, - parent ? parent->getNetworkId().getValueString().c_str() : nullptr, - parent ? parent->getObjectTemplateName() : nullptr, - parent ? parent : nullptr, - parent && parent->getAppearance() ? parent->getAppearance()->getAppearanceTemplateName() : nullptr)); + object.getAppearance() ? object.getAppearance()->getAppearanceTemplateName() : NULL, + parent ? parent->getNetworkId().getValueString().c_str() : NULL, + parent ? parent->getObjectTemplateName() : NULL, + parent ? parent : NULL, + parent && parent->getAppearance() ? parent->getAppearance()->getAppearanceTemplateName() : NULL)); } } @@ -703,30 +703,30 @@ Object::Object(): #if OBJECT_SUPPORTS_IS_ALTERING_FLAG m_isAltering(false), #endif - m_objectTemplate(nullptr), + m_objectTemplate(NULL), m_notificationList(NotificationListManager::getEmptyNotificationList()), - m_debugName(nullptr), + m_debugName(NULL), m_networkId(NetworkId::cms_invalid), - m_appearance(nullptr), - m_controller(nullptr), - m_dynamics(nullptr), - m_attachedToObject(nullptr), - m_attachedObjects(nullptr), - m_dpvsObjects(nullptr), + m_appearance(NULL), + m_controller(NULL), + m_dynamics(NULL), + m_attachedToObject(NULL), + m_attachedObjects(NULL), + m_dpvsObjects(NULL), m_rotations(0), m_scale(Vector::xyz111), m_objectToParent(), - m_objectToWorld(nullptr), + m_objectToWorld(NULL), m_watchedByList(), - m_containerProperty(nullptr), - m_collisionProperty(nullptr), + m_containerProperty(NULL), + m_collisionProperty(NULL), m_spatialSubdivisionHandle (0), m_useAlterScheduler(true), - m_scheduleData(nullptr), + m_scheduleData(NULL), m_shouldBakeIntoMesh(true), - m_defaultAppearance(nullptr), - m_alternateAppearance(nullptr), - m_containedBy(nullptr) + m_defaultAppearance(NULL), + m_alternateAppearance(NULL), + m_containedBy(NULL) { m_defaultAppearance = m_appearance; } @@ -752,25 +752,25 @@ Object::Object(const ObjectTemplate *objectTemplate, const NetworkId &networkId) m_debugName(0), m_networkId(networkId), m_appearance(0), - m_controller(nullptr), - m_dynamics(nullptr), - m_attachedToObject(nullptr), - m_attachedObjects(nullptr), - m_dpvsObjects(nullptr), + m_controller(NULL), + m_dynamics(NULL), + m_attachedToObject(NULL), + m_attachedObjects(NULL), + m_dpvsObjects(NULL), m_rotations(0), m_scale(Vector::xyz111), m_objectToParent(), - m_objectToWorld(nullptr), + m_objectToWorld(NULL), m_watchedByList(), - m_containerProperty(nullptr), - m_collisionProperty(nullptr), + m_containerProperty(NULL), + m_collisionProperty(NULL), m_spatialSubdivisionHandle (0), m_useAlterScheduler(true), - m_scheduleData(nullptr), + m_scheduleData(NULL), m_shouldBakeIntoMesh(true), - m_defaultAppearance(nullptr), - m_alternateAppearance(nullptr), - m_containedBy(nullptr) + m_defaultAppearance(NULL), + m_alternateAppearance(NULL), + m_containedBy(NULL) { objectTemplate->addReference(); NetworkIdManager::addObject(*this); @@ -799,25 +799,25 @@ Object::Object(const ObjectTemplate *objectTemplate, InitializeFlag): m_debugName(0), m_networkId(NetworkId::cms_invalid), m_appearance(0), - m_controller(nullptr), - m_dynamics(nullptr), - m_attachedToObject(nullptr), - m_attachedObjects(nullptr), - m_dpvsObjects(nullptr), + m_controller(NULL), + m_dynamics(NULL), + m_attachedToObject(NULL), + m_attachedObjects(NULL), + m_dpvsObjects(NULL), m_rotations(0), m_scale(Vector::xyz111), m_objectToParent(), - m_objectToWorld(nullptr), + m_objectToWorld(NULL), m_watchedByList(), - m_containerProperty(nullptr), - m_collisionProperty(nullptr), + m_containerProperty(NULL), + m_collisionProperty(NULL), m_spatialSubdivisionHandle (0), m_useAlterScheduler(true), - m_scheduleData(nullptr), + m_scheduleData(NULL), m_shouldBakeIntoMesh(true), - m_defaultAppearance(nullptr), - m_alternateAppearance(nullptr), - m_containedBy(nullptr) + m_defaultAppearance(NULL), + m_alternateAppearance(NULL), + m_containedBy(NULL) { objectTemplate->addReference(); NetworkIdManager::addObject(*this); @@ -836,7 +836,7 @@ Object::~Object(void) IGNORE_RETURN(snprintf(ms_crashReportInfo, sizeof(ms_crashReportInfo) - 1, "~Object: name=[%s] template=[%s]\n", getDebugName(), getObjectTemplateName())); ms_crashReportInfo[sizeof(ms_crashReportInfo) - 1] = '\0'; - DEBUG_REPORT_LOG(ms_logObjectDelete, ("Deleting object id=[%s], template=[%s], pointer=[%p], appearance=[%s], parent id=[%s], template=[%s], pointer=[%p], appearance=[%s]\n", getNetworkId().getValueString().c_str(), getObjectTemplateName(), this, getAppearance() ? getAppearance()->getAppearanceTemplateName() : nullptr, m_attachedToObject ? m_attachedToObject->getNetworkId().getValueString().c_str() : nullptr, m_attachedToObject ? m_attachedToObject->getObjectTemplateName() : nullptr, m_attachedToObject ? m_attachedToObject : nullptr, m_attachedToObject && m_attachedToObject->getAppearance() ? m_attachedToObject->getAppearance()->getAppearanceTemplateName() : nullptr)); + DEBUG_REPORT_LOG(ms_logObjectDelete, ("Deleting object id=[%s], template=[%s], pointer=[%p], appearance=[%s], parent id=[%s], template=[%s], pointer=[%p], appearance=[%s]\n", getNetworkId().getValueString().c_str(), getObjectTemplateName(), this, getAppearance() ? getAppearance()->getAppearanceTemplateName() : NULL, m_attachedToObject ? m_attachedToObject->getNetworkId().getValueString().c_str() : NULL, m_attachedToObject ? m_attachedToObject->getObjectTemplateName() : NULL, m_attachedToObject ? m_attachedToObject : NULL, m_attachedToObject && m_attachedToObject->getAppearance() ? m_attachedToObject->getAppearance()->getAppearanceTemplateName() : NULL)); FATAL(ConfigSharedObject::getAllowDisallowObjectDelete() && ms_disallowObjectDelete, ("Object id=[%s], template=[%s], pointer=[%p] is deleting itself when delete is not allowed", getNetworkId().getValueString().c_str(), getObjectTemplateName(), this)); #if OBJECT_SUPPORTS_IS_ALTERING_FLAG @@ -905,7 +905,7 @@ Object::~Object(void) } deleteAttachedObjects(m_attachedObjects); - m_attachedObjects = nullptr; + m_attachedObjects = NULL; } if (m_objectToWorld) @@ -914,9 +914,9 @@ Object::~Object(void) m_objectToWorld = 0; } - if (m_objectTemplate != nullptr) + if (m_objectTemplate != NULL) m_objectTemplate->releaseReference(); - m_objectTemplate = nullptr; + m_objectTemplate = NULL; m_notificationList = 0; @@ -1139,7 +1139,7 @@ void Object::removeFromWorld() { if (attached->isInWorld()) { - DEBUG_WARNING(true, ("Removing an object [id=%s template=%s] from the world with non-child attached objects [id=%s ptr=0x%08x template=%s name=%s]", getNetworkId ().getValueString ().c_str (), getObjectTemplateName () ? getObjectTemplateName () : "nullptr", attached->getNetworkId ().getValueString ().c_str (), attached, attached->getObjectTemplateName () ? attached->getObjectTemplateName () : "nullptr", attached->getDebugName())); + DEBUG_WARNING(true, ("Removing an object [id=%s template=%s] from the world with non-child attached objects [id=%s ptr=0x%08x template=%s name=%s]", getNetworkId ().getValueString ().c_str (), getObjectTemplateName () ? getObjectTemplateName () : "null", attached->getNetworkId ().getValueString ().c_str (), attached, attached->getObjectTemplateName () ? attached->getObjectTemplateName () : "null", attached->getDebugName())); attached->detachFromObject(DF_parent); } } @@ -1369,7 +1369,7 @@ bool Object::isInWorldCell() const CellProperty *Object::getParentCell() const { - Property *cell = nullptr; + Property *cell = NULL; for (Object *o = const_cast(getAttachedTo()); o && !cell; o = o->getAttachedTo()) cell = o->getCellProperty(); @@ -1580,7 +1580,7 @@ void Object::setAppearance(Appearance *newAppearance) * Steal the Appearance from this object. * * This routine will return the current appearance of this object, and - * then reset its appearance to nullptr. + * then reset its appearance to NULL. * * @return The current appearance of this object */ @@ -1590,18 +1590,18 @@ Appearance *Object::stealAppearance(void) Appearance *oldAppearance = m_appearance; if(m_appearance == m_defaultAppearance) - m_defaultAppearance = nullptr; + m_defaultAppearance = NULL; else if (m_appearance == m_alternateAppearance) - m_alternateAppearance = nullptr; + m_alternateAppearance = NULL; - m_appearance = nullptr; + m_appearance = NULL; if (oldAppearance) { if (isInWorld()) oldAppearance->removeFromWorld(); - oldAppearance->setOwner(nullptr); + oldAppearance->setOwner(NULL); } return oldAppearance; @@ -1999,7 +1999,7 @@ void Object::detachFromObject(DetachFlags const detachFlags) bool const shouldAttach = (!toParentCell || noCell) ? false : m_attachedToObject != &cellProperty->getOwner(); m_objectToParent = shouldAttach ? getTransform_o2c() : getTransform_o2w(); deleteLocalTransform(m_objectToWorld); - m_objectToWorld = nullptr; + m_objectToWorld = NULL; setObjectToWorldDirty(true); // remove from the attached objects list @@ -2010,7 +2010,7 @@ void Object::detachFromObject(DetachFlags const detachFlags) attachedObjects->pop_back(); // set as unattached - m_attachedToObject = nullptr; + m_attachedToObject = NULL; bool const wasChildObject = isChildObject(); bool const wasInWorld = isInWorld(); @@ -2102,7 +2102,7 @@ void Object::removeChildObject(Object * childObjectToRemove, DetachFlags detachF Object *Object::getRootParent(void) { - DEBUG_FATAL(m_childObject && m_attachedToObject == nullptr, ("am a child but attached to is nullptr")); + DEBUG_FATAL(m_childObject && m_attachedToObject == NULL, ("am a child but attached to is NULL")); return m_childObject ? NON_NULL(m_attachedToObject)->getRootParent() : this; } @@ -2116,7 +2116,7 @@ Object *Object::getRootParent(void) const Object *Object::getRootParent(void) const { - DEBUG_FATAL(m_childObject && m_attachedToObject == nullptr, ("am a child but attached to is nullptr")); + DEBUG_FATAL(m_childObject && m_attachedToObject == NULL, ("am a child but attached to is NULL")); return m_childObject ? NON_NULL(m_attachedToObject)->getRootParent() : this; } @@ -2231,7 +2231,7 @@ void Object::setRecursiveScale(Vector const & scale) Controller* Object::stealController(void) { Controller* returnValue = m_controller; - m_controller = nullptr; + m_controller = NULL; return returnValue; } @@ -2362,7 +2362,7 @@ Property const *Object::getProperty(PropertyId const &id) const if ((*i)->getPropertyId() == id) return *i; - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -2376,7 +2376,7 @@ Property *Object::getProperty(PropertyId const &id) if ((*i)->getPropertyId() == id) return *i; - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -2399,13 +2399,13 @@ void Object::removeProperty(PropertyId const &id) } if (id == CellProperty::getClassPropertyId() || id == PortalProperty::getClassPropertyId() || id == SlottedContainer::getClassPropertyId() || id == VolumeContainer::getClassPropertyId()) - m_containerProperty = nullptr; + m_containerProperty = NULL; else if (id == ContainedByProperty::getClassPropertyId()) - m_containedBy = nullptr; + m_containedBy = NULL; else if (id == CollisionProperty::getClassPropertyId()) - m_collisionProperty = nullptr; + m_collisionProperty = NULL; } // ---------------------------------------------------------------------- @@ -2453,7 +2453,7 @@ void Object::lookAt_o (const Vector &position_o, const Vector &j_o) void Object::setAppearanceByName(char const *path) { - if (path != nullptr) + if (path != NULL) { if (TreeFile::exists(path)) { @@ -2461,7 +2461,7 @@ void Object::setAppearanceByName(char const *path) Appearance *appearance = AppearanceTemplateList::createAppearance(path); - if (appearance != nullptr) + if (appearance != NULL) { setAppearance(appearance); } else { @@ -2475,7 +2475,7 @@ void Object::setAppearanceByName(char const *path) } else { - DEBUG_WARNING(true, ("Object::setAppearanceByName() - nullptr appearance path specified for object: %s", (getObjectTemplateName() == nullptr) ? "" : getObjectTemplateName())); + DEBUG_WARNING(true, ("Object::setAppearanceByName() - NULL appearance path specified for object: %s", (getObjectTemplateName() == NULL) ? "" : getObjectTemplateName())); } } @@ -2539,7 +2539,7 @@ SlottedContainer * Object::getSlottedContainerProperty() Container *container = getContainerProperty(); if (container && container->getPropertyId() == SlottedContainer::getClassPropertyId()) return safe_cast(container); - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -2549,7 +2549,7 @@ SlottedContainer const * Object::getSlottedContainerProperty() const Container const *container = getContainerProperty(); if (container && container->getPropertyId() == SlottedContainer::getClassPropertyId()) return safe_cast(container); - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -2559,7 +2559,7 @@ VolumeContainer * Object::getVolumeContainerProperty() Container *container = getContainerProperty(); if (container && container->getPropertyId() == VolumeContainer::getClassPropertyId()) return safe_cast(container); - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -2569,7 +2569,7 @@ VolumeContainer const * Object::getVolumeContainerProperty() const Container const *container = getContainerProperty(); if (container && container->getPropertyId() == VolumeContainer::getClassPropertyId()) return safe_cast(container); - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -2579,7 +2579,7 @@ CellProperty * Object::getCellProperty() Container *container = getContainerProperty(); if (container && container->getPropertyId() == CellProperty::getClassPropertyId()) return safe_cast(container); - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -2589,7 +2589,7 @@ CellProperty const * Object::getCellProperty() const Container const *container = getContainerProperty(); if (container && container->getPropertyId() == CellProperty::getClassPropertyId()) return safe_cast(container); - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -2599,7 +2599,7 @@ PortalProperty * Object::getPortalProperty() Container *container = getContainerProperty(); if (container && container->getPropertyId() == PortalProperty::getClassPropertyId()) return safe_cast(container); - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -2609,7 +2609,7 @@ PortalProperty const * Object::getPortalProperty() const Container const *container = getContainerProperty(); if (container && container->getPropertyId() == PortalProperty::getClassPropertyId()) return safe_cast(container); - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -2658,7 +2658,7 @@ ServerObject const * Object::asServerObject() const bool Object::hasScheduleData() const { - return (m_scheduleData != nullptr); + return (m_scheduleData != NULL); } // ---------------------------------------------------------------------- @@ -2697,7 +2697,7 @@ void Object::setMostRecentAlterTime(ScheduleTime mostRecentAlterTime) bool Object::isInAlterNextFrameList() const { - return (m_scheduleData == nullptr) ? false : (m_scheduleData->getAlterNextFrameNext() != nullptr) || (m_scheduleData->getAlterNextFramePrevious() != nullptr); + return (m_scheduleData == NULL) ? false : (m_scheduleData->getAlterNextFrameNext() != NULL) || (m_scheduleData->getAlterNextFramePrevious() != NULL); } // ---------------------------------------------------------------------- @@ -2708,7 +2708,7 @@ void Object::insertIntoAlterNextFrameList(Object *afterThisObject) DEBUG_FATAL(isInAlterNextFrameList(), ("insertIntoAlterNextFrameList(): object id=[%s],template=[%s] already in AlterNextFrame list.", getNetworkId().getValueString().c_str(), getObjectTemplateName())); NOT_NULL(afterThisObject); NOT_NULL(afterThisObject->m_scheduleData); - DEBUG_FATAL(afterThisObject->m_scheduleData->getAlterNextFrameNext() && !afterThisObject->m_scheduleData->getAlterNextFrameNext()->m_scheduleData, ("Non-nullptr forward link does not have schedule data.")); + DEBUG_FATAL(afterThisObject->m_scheduleData->getAlterNextFrameNext() && !afterThisObject->m_scheduleData->getAlterNextFrameNext()->m_scheduleData, ("Non-NULL forward link does not have schedule data.")); DEBUG_FATAL(afterThisObject->m_scheduleData->getAlterNextFrameNext() && (afterThisObject->m_scheduleData->getAlterNextFrameNext()->m_scheduleData->getAlterNextFramePrevious() != afterThisObject), ("List corruption: alter next frame.")); //-- Get new next and previous object for the list. @@ -2745,13 +2745,13 @@ void Object::removeFromAlterNextFrameList() DEBUG_FATAL(newNext && !newNext->m_scheduleData, ("Next node missing schedule data.")); //-- Handle previous. - m_scheduleData->setAlterNextFramePrevious(nullptr); + m_scheduleData->setAlterNextFramePrevious(NULL); if (newPrevious) newPrevious->m_scheduleData->setAlterNextFrameNext(newNext); //-- Handle next. - m_scheduleData->setAlterNextFrameNext(nullptr); + m_scheduleData->setAlterNextFrameNext(NULL); if (newNext) newNext->m_scheduleData->setAlterNextFramePrevious(newPrevious); @@ -2766,7 +2766,7 @@ void Object::removeFromAlterNextFrameList() int Object::getAlterSchedulePhase() const { - DEBUG_FATAL(m_scheduleData == nullptr, ("calling Object::getAlterSchedulePhase() when Object has no schedule data: id=[%s], template=[%s]", getNetworkId().getValueString().c_str(), getObjectTemplateName())); + DEBUG_FATAL(m_scheduleData == NULL, ("calling Object::getAlterSchedulePhase() when Object has no schedule data: id=[%s], template=[%s]", getNetworkId().getValueString().c_str(), getObjectTemplateName())); return m_scheduleData->getSchedulePhase(); } @@ -2774,7 +2774,7 @@ int Object::getAlterSchedulePhase() const void Object::setAlterSchedulePhase(int schedulePhaseIndex) { - DEBUG_FATAL(m_scheduleData == nullptr, ("calling Object::setAlterSchedulePhase() when Object has no schedule data: id=[%s], template=[%s]", getNetworkId().getValueString().c_str(), getObjectTemplateName())); + DEBUG_FATAL(m_scheduleData == NULL, ("calling Object::setAlterSchedulePhase() when Object has no schedule data: id=[%s], template=[%s]", getNetworkId().getValueString().c_str(), getObjectTemplateName())); m_scheduleData->setSchedulePhase(schedulePhaseIndex); } @@ -2782,7 +2782,7 @@ void Object::setAlterSchedulePhase(int schedulePhaseIndex) bool Object::isInAlterNowList() const { - return (m_scheduleData == nullptr) ? false : (m_scheduleData->getAlterNowNext() != nullptr) || (m_scheduleData->getAlterNowPrevious() != nullptr); + return (m_scheduleData == NULL) ? false : (m_scheduleData->getAlterNowNext() != NULL) || (m_scheduleData->getAlterNowPrevious() != NULL); } // ---------------------------------------------------------------------- @@ -2793,7 +2793,7 @@ void Object::insertIntoAlterNowList(Object *afterThisObject) DEBUG_FATAL(isInAlterNowList(), ("insertIntoAlterNowList(): object id=[%s],template=[%s] already in AlterNow list.", getNetworkId().getValueString().c_str(), getObjectTemplateName())); NOT_NULL(afterThisObject); NOT_NULL(afterThisObject->m_scheduleData); - DEBUG_FATAL(afterThisObject->m_scheduleData->getAlterNowNext() && !afterThisObject->m_scheduleData->getAlterNowNext()->m_scheduleData, ("Non-nullptr forward link does not have schedule data.")); + DEBUG_FATAL(afterThisObject->m_scheduleData->getAlterNowNext() && !afterThisObject->m_scheduleData->getAlterNowNext()->m_scheduleData, ("Non-NULL forward link does not have schedule data.")); DEBUG_FATAL(afterThisObject->m_scheduleData->getAlterNowNext() && (afterThisObject->m_scheduleData->getAlterNowNext()->m_scheduleData->getAlterNowPrevious() != afterThisObject), ("List corruption: alter now.")); //-- Get new next and previous object for the list. @@ -2830,12 +2830,12 @@ void Object::removeFromAlterNowList() DEBUG_FATAL(newNext && !newNext->m_scheduleData, ("Next node missing schedule data.")); //-- Handle previous. - m_scheduleData->setAlterNowPrevious(nullptr); + m_scheduleData->setAlterNowPrevious(NULL); if (newPrevious) newPrevious->m_scheduleData->setAlterNowNext(newNext); //-- Handle next. - m_scheduleData->setAlterNowNext(nullptr); + m_scheduleData->setAlterNowNext(NULL); if (newNext) newNext->m_scheduleData->setAlterNowPrevious(newPrevious); @@ -2849,7 +2849,7 @@ void Object::removeFromAlterNowList() bool Object::isInConcludeList() const { - return (m_scheduleData == nullptr) ? false : (m_scheduleData->getConcludeNext() != nullptr) || (m_scheduleData->getConcludePrevious() != nullptr); + return (m_scheduleData == NULL) ? false : (m_scheduleData->getConcludeNext() != NULL) || (m_scheduleData->getConcludePrevious() != NULL); } // ---------------------------------------------------------------------- @@ -2860,7 +2860,7 @@ void Object::insertIntoConcludeList(Object *afterThisObject) DEBUG_FATAL(isInConcludeList(), ("insertIntoConcludeList(): object id=[%s],template=[%s] already in Conclude list.", getNetworkId().getValueString().c_str(), getObjectTemplateName())); NOT_NULL(afterThisObject); NOT_NULL(afterThisObject->m_scheduleData); - DEBUG_FATAL(afterThisObject->m_scheduleData->getConcludeNext() && !afterThisObject->m_scheduleData->getConcludeNext()->m_scheduleData, ("Non-nullptr forward link does not have schedule data.")); + DEBUG_FATAL(afterThisObject->m_scheduleData->getConcludeNext() && !afterThisObject->m_scheduleData->getConcludeNext()->m_scheduleData, ("Non-NULL forward link does not have schedule data.")); DEBUG_FATAL(afterThisObject->m_scheduleData->getConcludeNext() && (afterThisObject->m_scheduleData->getConcludeNext()->m_scheduleData->getConcludePrevious() != afterThisObject), ("List corruption: alter now.")); //-- Get new next and previous object for the list. @@ -2897,12 +2897,12 @@ void Object::removeFromConcludeList() DEBUG_FATAL(newNext && !newNext->m_scheduleData, ("Next node missing schedule data.")); //-- Handle previous. - m_scheduleData->setConcludePrevious(nullptr); + m_scheduleData->setConcludePrevious(NULL); if (newPrevious) newPrevious->m_scheduleData->setConcludeNext(newNext); //-- Handle next. - m_scheduleData->setConcludeNext(nullptr); + m_scheduleData->setConcludeNext(NULL); if (newNext) newNext->m_scheduleData->setConcludePrevious(newPrevious); @@ -3015,7 +3015,7 @@ void Object::scheduleForAlter_scheduleTopmostWorldParent() do { //-- Traverse parent links until there is no more parent. - for (Object *parentObject = alterObject->getParent(); parentObject != nullptr; parentObject = alterObject->getParent()) + for (Object *parentObject = alterObject->getParent(); parentObject != NULL; parentObject = alterObject->getParent()) alterObject = parentObject; //-- Traverse container until we're at a container object that is in the world. @@ -3035,7 +3035,7 @@ void Object::scheduleForAlter_scheduleTopmostWorldParent() if (alterObject->isInWorld()) { // We're done searching. - containedByProperty = nullptr; + containedByProperty = NULL; } else { @@ -3052,7 +3052,7 @@ void Object::scheduleForAlter_scheduleTopmostWorldParent() // New container might be a child object, make sure we test for a parent again. // If a parent exists, we need to run through the loop again to find the parent object. - } while (alterObject->getParent() != nullptr); + } while (alterObject->getParent() != NULL); NOT_NULL(alterObject); if (alterObject->isInitialized()) @@ -3270,13 +3270,13 @@ void Object::setAlternateAppearance(const char * path) if(!path) return; - Appearance *alternateAppearance = nullptr; + Appearance *alternateAppearance = NULL; if (TreeFile::exists(path)) { alternateAppearance = AppearanceTemplateList::createAppearance(path); - if (alternateAppearance == nullptr) { + if (alternateAppearance == NULL) { DEBUG_WARNING(true, ("Object::setAlternateAppearance() - Unable to change the object's appearance because the file does not exist: %s", path)); return; } @@ -3313,7 +3313,7 @@ void Object::setAlternateAppearance(const char * path) delete m_alternateAppearance; - m_alternateAppearance = nullptr; + m_alternateAppearance = NULL; } else { diff --git a/engine/shared/library/sharedObject/src/shared/object/Object.h b/engine/shared/library/sharedObject/src/shared/object/Object.h index 9059b52d..7ac8cfe1 100755 --- a/engine/shared/library/sharedObject/src/shared/object/Object.h +++ b/engine/shared/library/sharedObject/src/shared/object/Object.h @@ -495,7 +495,7 @@ inline const ObjectTemplate *Object::getObjectTemplate() const // // Remarks: // -// This return may return nullptr. +// This return may return NULL. inline const char *Object::getDebugName() const { @@ -518,7 +518,7 @@ inline const Vector &Object::getScale() const /** * Get the controller for an object. * - * The return value may be nullptr. + * The return value may be NULL. * * @return Const pointer to the controller */ @@ -532,7 +532,7 @@ inline const Controller *Object::getController() const /** * Get the controller for an object. * - * The return value may be nullptr. + * The return value may be NULL. * * @return Non-const pointer to the controller */ @@ -546,7 +546,7 @@ inline Controller *Object::getController() /** * Get the dynamics for an object. * - * The return value may be nullptr. + * The return value may be NULL. * * @return Const pointer to the dynamics */ @@ -560,7 +560,7 @@ inline const Dynamics *Object::getDynamics() const /** * Get the dynamics for an object. * - * The return value may be nullptr. + * The return value may be NULL. * * @return Non-const pointer to the dynamics */ @@ -598,24 +598,24 @@ inline Appearance *Object::getAppearance() /** * Get the parent object for this object. * - * This routine will return nullptr if the object is not a child object. + * This routine will return NULL if the object is not a child object. */ inline Object *Object::getParent() { - return m_childObject ? m_attachedToObject : nullptr; + return m_childObject ? m_attachedToObject : NULL; } // ---------------------------------------------------------------------- /** * Get the parent object for this object. * - * This routine will return nullptr if the object is not a child object. + * This routine will return NULL if the object is not a child object. */ inline const Object *Object::getParent() const { - return m_childObject ? m_attachedToObject : nullptr; + return m_childObject ? m_attachedToObject : NULL; } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedObject/src/shared/object/ObjectList.cpp b/engine/shared/library/sharedObject/src/shared/object/ObjectList.cpp index e74133f8..9e72d27d 100755 --- a/engine/shared/library/sharedObject/src/shared/object/ObjectList.cpp +++ b/engine/shared/library/sharedObject/src/shared/object/ObjectList.cpp @@ -63,7 +63,7 @@ ObjectList::~ObjectList() /** * Add an Object to the ObjectList. * - * This routine will call Fatal in debug compiles if it is passed a nullptr + * This routine will call Fatal in debug compiles if it is passed a NULL * object. * * This routine will call Fatal in debug compiles if the object list @@ -85,7 +85,7 @@ void ObjectList::addObject(Object *objectToAdd) /** * Remove an Object from the ObjectList. * - * This routine will call Fatal in debug compiles if it is passed a nullptr + * This routine will call Fatal in debug compiles if it is passed a NULL * object. * * @param objectToRemove Pointer to the object to remove @@ -113,13 +113,13 @@ void ObjectList::removeObjectByIndex(const Object* object, int index) // Remove the last item in the vector. m_objectVector->pop_back(); - // nullptr the object from the alter-safe object list. + // NULL the object from the alter-safe object list. uint size = m_alterSafeObjectVector->size(); for (uint i = 0; i < size; ++i) { if ((*m_alterSafeObjectVector)[i] == object) { - (*m_alterSafeObjectVector)[i] = nullptr; + (*m_alterSafeObjectVector)[i] = NULL; return; } } @@ -224,7 +224,7 @@ float ObjectList::alter(real time) if (alterResult == AlterResult::cms_kill) //lint !e777 // Testing floats for equality // It's okay, we're using constants. { // Make sure the object is still in the object list before removing it - if ((*m_alterSafeObjectVector)[i] != nullptr) + if ((*m_alterSafeObjectVector)[i] != NULL) removeObject(obj); delete obj; } diff --git a/engine/shared/library/sharedObject/src/shared/object/ObjectTemplate.cpp b/engine/shared/library/sharedObject/src/shared/object/ObjectTemplate.cpp index 789b5d12..5729afef 100755 --- a/engine/shared/library/sharedObject/src/shared/object/ObjectTemplate.cpp +++ b/engine/shared/library/sharedObject/src/shared/object/ObjectTemplate.cpp @@ -66,7 +66,7 @@ ObjectTemplate::ObjectTemplate(const std::string & filename) : { //-- Track name of most recently loading object template name to give us more // data to work with when we receive crash info. - IGNORE_RETURN(snprintf(s_crashReportInfoConstructor, sizeof(s_crashReportInfoConstructor) - 1, "ObjectTemplate_Constructor: %s\n", !filename.empty() ? filename.c_str() : "")); + IGNORE_RETURN(snprintf(s_crashReportInfoConstructor, sizeof(s_crashReportInfoConstructor) - 1, "ObjectTemplate_Constructor: %s\n", !filename.empty() ? filename.c_str() : "")); s_crashReportInfoConstructor[sizeof(s_crashReportInfoConstructor) - 1] = '\0'; } @@ -165,7 +165,7 @@ Object *ObjectTemplate::createObject() const */ void ObjectTemplate::addReference() const { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->addReference(); DataResource::addReference(); @@ -178,7 +178,7 @@ void ObjectTemplate::addReference() const */ void ObjectTemplate::releaseReference() const { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); DataResource::releaseReference(); @@ -199,7 +199,7 @@ void ObjectTemplate::loadFromIff(Iff &iff) //-- Track name of most recently loading object template name to give us more // data to work with when we receive crash info. char const *const filename = iff.getFileName(); - IGNORE_RETURN(snprintf(s_crashReportInfoLoadFromIff, sizeof(s_crashReportInfoLoadFromIff) - 1, "ObjectTemplate_Iff: %s\n", (filename && *filename) ? filename : "")); + IGNORE_RETURN(snprintf(s_crashReportInfoLoadFromIff, sizeof(s_crashReportInfoLoadFromIff) - 1, "ObjectTemplate_Iff: %s\n", (filename && *filename) ? filename : "")); s_crashReportInfoLoadFromIff[sizeof(s_crashReportInfoLoadFromIff) - 1] = '\0'; preLoad(); diff --git a/engine/shared/library/sharedObject/src/shared/object/ObjectTemplateList.cpp b/engine/shared/library/sharedObject/src/shared/object/ObjectTemplateList.cpp index 96663b8a..4e45484b 100755 --- a/engine/shared/library/sharedObject/src/shared/object/ObjectTemplateList.cpp +++ b/engine/shared/library/sharedObject/src/shared/object/ObjectTemplateList.cpp @@ -24,8 +24,8 @@ typedef DataResourceList ObjectTemplateListDataResourceList; -template <> ObjectTemplateListDataResourceList::CreateDataResourceMap *ObjectTemplateListDataResourceList::ms_bindings = nullptr; -template <> ObjectTemplateListDataResourceList::LoadedDataResourceMap *ObjectTemplateListDataResourceList::ms_loaded = nullptr; +template <> ObjectTemplateListDataResourceList::CreateDataResourceMap *ObjectTemplateListDataResourceList::ms_bindings = NULL; +template <> ObjectTemplateListDataResourceList::LoadedDataResourceMap *ObjectTemplateListDataResourceList::ms_loaded = NULL; namespace ObjectTemplateListNamespace { diff --git a/engine/shared/library/sharedObject/src/shared/object/ScheduleData.cpp b/engine/shared/library/sharedObject/src/shared/object/ScheduleData.cpp index 0b323d4d..8de48b15 100755 --- a/engine/shared/library/sharedObject/src/shared/object/ScheduleData.cpp +++ b/engine/shared/library/sharedObject/src/shared/object/ScheduleData.cpp @@ -20,12 +20,12 @@ MEMORY_BLOCK_MANAGER_IMPLEMENTATION_WITH_INSTALL(ScheduleData, true, 0, 0, 0); ScheduleData::ScheduleData(AlterScheduler::ScheduleTime initialMostRecentAlterTime): m_mostRecentAlterTime(initialMostRecentAlterTime), - m_alterNowNext(nullptr), - m_alterNowPrevious(nullptr), - m_alterNextFrameNext(nullptr), - m_alterNextFramePrevious(nullptr), - m_concludeNext(nullptr), - m_concludePrevious(nullptr), + m_alterNowNext(NULL), + m_alterNowPrevious(NULL), + m_alterNextFrameNext(NULL), + m_alterNextFramePrevious(NULL), + m_concludeNext(NULL), + m_concludePrevious(NULL), m_scheduleTimeMapIterator(), m_schedulePhase(0) { diff --git a/engine/shared/library/sharedObject/src/shared/portal/CellProperty.cpp b/engine/shared/library/sharedObject/src/shared/portal/CellProperty.cpp index 95281e88..d6ae066b 100755 --- a/engine/shared/library/sharedObject/src/shared/portal/CellProperty.cpp +++ b/engine/shared/library/sharedObject/src/shared/portal/CellProperty.cpp @@ -70,14 +70,14 @@ namespace CellPropertyNamespace Object *ms_worldCellObject; Notification ms_portalCrossingNotification; bool ms_renderPortals; - CellProperty::CreateDpvsCellHookFunction ms_createDpvsCellHookFunction = nullptr; - CellProperty::DestroyDpvsCellHookFunction ms_destroyDpvsCellHookFunction = nullptr; - CellProperty::AddToRenderWorldHookFunction ms_addToRenderWorldHook = nullptr; + CellProperty::CreateDpvsCellHookFunction ms_createDpvsCellHookFunction = NULL; + CellProperty::DestroyDpvsCellHookFunction ms_destroyDpvsCellHookFunction = NULL; + CellProperty::AddToRenderWorldHookFunction ms_addToRenderWorldHook = NULL; - CellProperty::PolyAppearanceFactory ms_portalBarrierFactory = nullptr; - CellProperty::PolyAppearanceFactory ms_forceFieldFactory = nullptr; + CellProperty::PolyAppearanceFactory ms_portalBarrierFactory = NULL; + CellProperty::PolyAppearanceFactory ms_forceFieldFactory = NULL; - CellProperty::AccessAllowedHookFunction ms_accessAllowedHookFunction = nullptr; + CellProperty::AccessAllowedHookFunction ms_accessAllowedHookFunction = NULL; } using namespace CellPropertyNamespace; @@ -86,9 +86,9 @@ using namespace CellPropertyNamespace; bool CellPropertyNamespace::Notification::ms_enabled = true; CellProperty *CellProperty::ms_worldCellProperty; -CellProperty::TextureFetch CellProperty::ms_textureFetch = nullptr; -CellProperty::TextureRelease CellProperty::ms_textureRelease = nullptr; -CellProperty::DeleteVisibleCellProperty CellProperty::ms_deleteVisibleCellProperty = nullptr; +CellProperty::TextureFetch CellProperty::ms_textureFetch = NULL; +CellProperty::TextureRelease CellProperty::ms_textureRelease = NULL; +CellProperty::DeleteVisibleCellProperty CellProperty::ms_deleteVisibleCellProperty = NULL; // ====================================================================== @@ -148,9 +148,9 @@ bool CellPropertyNamespace::Notification::positionChanged(Object &object, bool c start += objUpW; end += objUpW; - CellProperty *targetCell = nullptr; + CellProperty *targetCell = NULL; - CellProperty *lastCell = nullptr; + CellProperty *lastCell = NULL; CellProperty *currentCell = object.getParentCell(); while(currentCell) @@ -163,7 +163,7 @@ bool CellPropertyNamespace::Notification::positionChanged(Object &object, bool c if(time == 1.0f) break; - if(nextCell == nullptr) break; + if(nextCell == NULL) break; if(nextCell == currentCell) break; if(nextCell == lastCell) break; @@ -235,8 +235,8 @@ void CellProperty::install() void CellProperty::remove() { delete ms_worldCellObject; - ms_worldCellObject = nullptr; - ms_worldCellProperty = nullptr; + ms_worldCellObject = NULL; + ms_worldCellProperty = NULL; } // ---------------------------------------------------------------------- @@ -282,7 +282,7 @@ Appearance *CellProperty::createPortalBarrier(VertexList const & verts, const Ve if (ms_portalBarrierFactory) return ms_portalBarrierFactory(verts,color); - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -292,7 +292,7 @@ Appearance *CellProperty::createForceField(VertexList const & verts, const Vecto if (ms_forceFieldFactory) return ms_forceFieldFactory(verts,color); - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -342,24 +342,24 @@ void CellProperty::setPortalTransitionsEnabled(bool enabled) CellProperty::CellProperty(Object &owner) : Container(getClassPropertyId(), owner), - m_portalProperty(nullptr), + m_portalProperty(NULL), m_cellIndex(-1), - m_appearanceObject(nullptr), + m_appearanceObject(NULL), m_portalObjectList(new PortalObjectList), m_visible(false), - m_floor(nullptr), - m_cellName(nullptr), + m_floor(NULL), + m_cellName(NULL), m_cellNameCrc(0), - m_dpvsCell(nullptr), - m_environmentTexture(nullptr), + m_dpvsCell(NULL), + m_environmentTexture(NULL), m_fogEnabled(false), m_fogColor(0), m_fogDensity(0.f), m_appliedInteriorLayout(false), - m_preVisibilityTraversalRenderHookFunctionList(nullptr), - m_enterRenderHookFunctionList(nullptr), - m_preDrawRenderHookFunctionList(nullptr), - m_exitRenderHookFunctionList(nullptr) + m_preVisibilityTraversalRenderHookFunctionList(NULL), + m_enterRenderHookFunctionList(NULL), + m_preDrawRenderHookFunctionList(NULL), + m_exitRenderHookFunctionList(NULL) { if (ms_createDpvsCellHookFunction) m_dpvsCell = (*ms_createDpvsCellHookFunction)(this); @@ -379,7 +379,7 @@ CellProperty::~CellProperty() { NOT_NULL(ms_textureRelease); ms_textureRelease(m_environmentTexture); - m_environmentTexture = nullptr; + m_environmentTexture = NULL; } if (!m_portalObjectList->empty()) @@ -391,18 +391,18 @@ CellProperty::~CellProperty() delete portalList; } - m_portalProperty = nullptr; + m_portalProperty = NULL; delete m_appearanceObject; delete m_portalObjectList; delete m_floor; - m_cellName = nullptr; + m_cellName = NULL; m_cellNameCrc = 0; if (m_dpvsCell) { NOT_NULL(ms_destroyDpvsCellHookFunction); (*ms_destroyDpvsCellHookFunction)(m_dpvsCell); - m_dpvsCell = nullptr; + m_dpvsCell = NULL; } delete m_preVisibilityTraversalRenderHookFunctionList; @@ -432,7 +432,7 @@ void CellProperty::initialize(const PortalProperty &portalProperty, int cellInde m_appearanceObject->attachToObject_p(&getOwner(), true); Appearance * const appearance = AppearanceTemplateList::createAppearance(cellTemplate.getAppearanceName()); - if (appearance != nullptr) { + if (appearance != NULL) { appearance->setShadowBlobAllowed(); m_appearanceObject->setAppearance(appearance); @@ -448,7 +448,7 @@ void CellProperty::initialize(const PortalProperty &portalProperty, int cellInde if (cellTemplate.getFloorName()) { - m_floor = FloorManager::createFloor(cellTemplate.getFloorName(),&getOwner(),nullptr,false); + m_floor = FloorManager::createFloor(cellTemplate.getFloorName(),&getOwner(),NULL,false); WARNING(!m_floor, ("Cell %s could not load floor %s", cellTemplate.getAppearanceName(), cellTemplate.getFloorName())); } else @@ -622,8 +622,8 @@ bool CellProperty::areAdjacent(const CellProperty *cellProperty1, const CellProp { bool result = false; - if ( (cellProperty1 != nullptr) - && (cellProperty2 != nullptr)) + if ( (cellProperty1 != NULL) + && (cellProperty2 != NULL)) { if (cellProperty1 == cellProperty2) { @@ -640,8 +640,8 @@ bool CellProperty::areAdjacent(const CellProperty *cellProperty1, const CellProp result = false; } - else if ( (cellProperty1->m_portalObjectList != nullptr) - && (cellProperty2->m_portalObjectList != nullptr)) + else if ( (cellProperty1->m_portalObjectList != NULL) + && (cellProperty2->m_portalObjectList != NULL)) { // Pick the list that is not the world cell property, or the // smallest list @@ -657,7 +657,7 @@ bool CellProperty::areAdjacent(const CellProperty *cellProperty1, const CellProp checkCellProperty = cellProperty1; } - if (portalObjectList != nullptr) + if (portalObjectList != NULL) { //DEBUG_REPORT_LOG((portalObjectList->size() > 1), ("Portal Object List > 1 - size: %d", portalObjectList->size())); @@ -714,7 +714,7 @@ void CellProperty::releaseWorldCellPropertyEnvironmentTexture() * * @param startPosition Starting position, in the space of this cell. * @param endPosition Ending position, in the space of this cell. - * @return The CellProperty that an object traversing the object is in. Will return nullptr if remaining in this cell. + * @return The CellProperty that an object traversing the object is in. Will return NULL if remaining in this cell. */ CellProperty *CellProperty::getDestinationCell(const Vector &startPosition, const Vector &endPosition, float &closestPortalT, bool passableOnly) const @@ -773,8 +773,8 @@ CellProperty *CellProperty::getDestinationCell(const Vector &startPosition, cons CellProperty *CellProperty::getDestinationCell(const Object *object, int portalId) const { - if(portalId < 0) return nullptr; - if(object == nullptr) return nullptr; + if(portalId < 0) return NULL; + if(object == NULL) return NULL; const PortalObjectList::const_iterator iEnd = m_portalObjectList->end(); for (PortalObjectList::const_iterator i = m_portalObjectList->begin(); i != iEnd; ++i) @@ -796,13 +796,13 @@ CellProperty *CellProperty::getDestinationCell(const Object *object, int portalI { DEBUG_WARNING(true,("CellProperty::getDestinationCell(portalId) - tried to get an invalid portal\n")); - return nullptr; + return NULL; } return portalList[static_cast(portalId)]->getNeighbor()->getParentCell(); } - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -840,7 +840,7 @@ bool CellProperty::getDestinationCells(const Sphere &sphere, std::vectorgetNeighbor(); - WARNING(neighbor == nullptr,("CellProperty::getDestinationCells - Cell %s has a portal without a neighbor\n",getOwner().getNetworkId().getValueString().c_str())); + WARNING(neighbor == NULL,("CellProperty::getDestinationCells - Cell %s has a portal without a neighbor\n",getOwner().getNetworkId().getValueString().c_str())); if(neighbor) { @@ -864,7 +864,7 @@ bool CellProperty::isAdjacentTo(const CellProperty *cell) const { if(this == cell) return true; - if(cell == nullptr) return false; + if(cell == NULL) return false; // ---------- @@ -964,7 +964,7 @@ const BaseExtent *CellProperty::getCollisionExtent() const } else { - return nullptr; + return NULL; } } @@ -982,7 +982,7 @@ const BaseClass *CellProperty::getPathGraph() const } } - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -1111,7 +1111,7 @@ void CellProperty::drawDebugShapes(DebugShapeRenderer * const renderer) const #ifdef _DEBUG - if (renderer == nullptr) + if (renderer == NULL) return; Floor const * const floor = getFloor(); @@ -1192,7 +1192,7 @@ CellProperty::PortalObjectEntry const &CellProperty::getPortalObject(int index) bool CellProperty::getAccessAllowed() const { - if (ms_accessAllowedHookFunction != nullptr) + if (ms_accessAllowedHookFunction != NULL) return (*ms_accessAllowedHookFunction)(*this); else return true; @@ -1286,7 +1286,7 @@ Vector const CellProperty::getPosition_w(Location const & location) Vector result = location.getCoordinates(); CellProperty const * const worldCellProperty = CellProperty::getWorldCellProperty(); - if (worldCellProperty != nullptr) + if (worldCellProperty != NULL) { if (location.getCell() != worldCellProperty->getOwner().getNetworkId()) { @@ -1295,7 +1295,7 @@ Vector const CellProperty::getPosition_w(Location const & location) Object const * const cell = NetworkIdManager::getObjectById(location.getCell()); - if (cell != nullptr) + if (cell != NULL) { result = cell->rotateTranslate_o2w(location.getCoordinates()); } diff --git a/engine/shared/library/sharedObject/src/shared/portal/Portal.cpp b/engine/shared/library/sharedObject/src/shared/portal/Portal.cpp index c8658b98..1fcd8d87 100755 --- a/engine/shared/library/sharedObject/src/shared/portal/Portal.cpp +++ b/engine/shared/library/sharedObject/src/shared/portal/Portal.cpp @@ -64,7 +64,7 @@ void Portal::install() void Portal::remove() { delete ms_doorStyleTable; - ms_doorStyleTable = nullptr; + ms_doorStyleTable = NULL; } // ---------------------------------------------------------------------- @@ -105,11 +105,11 @@ Portal::Portal(const PortalPropertyTemplateCellPortal &portalTemplate, CellPrope m_template(portalTemplate), m_relativeToObject(relativeTo), m_closed(false), - m_neighbor(nullptr), + m_neighbor(NULL), m_parentCell(parentCell), - m_dpvsPortal(nullptr), - m_door(nullptr), - m_appearance(nullptr) + m_dpvsPortal(NULL), + m_door(NULL), + m_appearance(NULL) { if(ms_createDoors) { @@ -126,13 +126,13 @@ Portal::~Portal() m_relativeToObject->removeDpvsObject(m_dpvsPortal); NOT_NULL(ms_destroyDpvsPortalHookFunction); (*ms_destroyDpvsPortalHookFunction)(m_dpvsPortal); - m_dpvsPortal = nullptr; + m_dpvsPortal = NULL; } - m_relativeToObject = nullptr; - m_neighbor = nullptr; - m_parentCell = nullptr; - m_door = nullptr; + m_relativeToObject = NULL; + m_neighbor = NULL; + m_parentCell = NULL; + m_door = NULL; delete m_appearance; } diff --git a/engine/shared/library/sharedObject/src/shared/portal/PortalProperty.cpp b/engine/shared/library/sharedObject/src/shared/portal/PortalProperty.cpp index 716b488a..e88349e2 100755 --- a/engine/shared/library/sharedObject/src/shared/portal/PortalProperty.cpp +++ b/engine/shared/library/sharedObject/src/shared/portal/PortalProperty.cpp @@ -57,9 +57,9 @@ PropertyId PortalProperty::getClassPropertyId() PortalProperty::PortalProperty(Object &owner, const char *fileName) : Container(getClassPropertyId(), owner), - m_template(nullptr), + m_template(NULL), m_cellList(new CellList), - m_fixupList(nullptr), + m_fixupList(NULL), m_hasPassablePortalToParentCell(false) { #ifdef _DEBUG @@ -67,7 +67,7 @@ PortalProperty::PortalProperty(Object &owner, const char *fileName) #endif // _DEBUG m_template = PortalPropertyTemplateList::fetch(CrcLowerString(fileName)); - m_cellList->resize(static_cast(m_template->getNumberOfCells()), nullptr); + m_cellList->resize(static_cast(m_template->getNumberOfCells()), NULL); #ifdef _DEBUG DataLint::popAsset(); @@ -139,7 +139,7 @@ void PortalProperty::addToWorld() int unloaded = 0; int const numberOfCells = static_cast(m_cellList->size()); for (int i = 1; i < numberOfCells; ++i) - if ((*m_cellList)[static_cast(i)] == nullptr) + if ((*m_cellList)[static_cast(i)] == NULL) { WARNING(true, ("cell %d/%d not loaded", i, numberOfCells)); ++unloaded; @@ -215,7 +215,7 @@ bool PortalProperty::serverEndBaselines(int serverObjectCrc, std::vectorsize(); for (uint i = 1; i < numberOfCells; ++i) { - if ((*m_cellList)[i] == nullptr) + if ((*m_cellList)[i] == NULL) { Object *object = ms_beginCreateObjectFunction(static_cast(i)); IGNORE_RETURN(addToContents(*object, tmp)); @@ -460,7 +460,7 @@ void PortalProperty::debugPrint(std::string &buffer) const void PortalProperty::createAppearance() { Appearance * const appearance = AppearanceTemplateList::createAppearance(m_template->getExteriorAppearanceName()); - if (appearance != nullptr) { + if (appearance != NULL) { appearance->setShadowBlobAllowed(); getOwner().setAppearance(appearance); } else { @@ -563,7 +563,7 @@ CellProperty *PortalProperty::getCell(const char *desiredCellName) return (*m_cellList)[static_cast(i)]; } - return nullptr; + return NULL; } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedObject/src/shared/portal/PortalPropertyTemplate.cpp b/engine/shared/library/sharedObject/src/shared/portal/PortalPropertyTemplate.cpp index a21c39b5..09d2e9e1 100755 --- a/engine/shared/library/sharedObject/src/shared/portal/PortalPropertyTemplate.cpp +++ b/engine/shared/library/sharedObject/src/shared/portal/PortalPropertyTemplate.cpp @@ -41,7 +41,7 @@ typedef BaseClass * (*ExpandBuildingGraphHook)( PortalPropertyTemplate * portalTemplate, BaseClass * baseBuildingGraph ); -ExpandBuildingGraphHook g_expandBuildingGraphHook = nullptr; +ExpandBuildingGraphHook g_expandBuildingGraphHook = NULL; // ====================================================================== @@ -257,8 +257,8 @@ PortalPropertyTemplateCellPortal::PortalPropertyTemplateCellPortal(const PortalP m_disabled(false), m_passable(false), m_geometryWindingClockwise(true), - m_portalGeometry(nullptr), - m_doorStyle(nullptr), + m_portalGeometry(NULL), + m_doorStyle(NULL), m_hasDoorHardpoint(false), m_doorHardpoint(), m_plane(), @@ -272,7 +272,7 @@ PortalPropertyTemplateCellPortal::PortalPropertyTemplateCellPortal(const PortalP PortalPropertyTemplateCellPortal::~PortalPropertyTemplateCellPortal() { - m_portalGeometry = nullptr; + m_portalGeometry = NULL; delete [] m_doorStyle; if (m_preloadManager) @@ -524,14 +524,14 @@ PortalPropertyTemplateCell::PreloadManager::~PreloadManager () PortalPropertyTemplateCell::PortalPropertyTemplateCell(const PortalPropertyTemplate &portalPropertyTemplate, int index, Iff &iff) : - m_name(nullptr), - m_appearanceName(nullptr), - m_floorName(nullptr), - m_floorMesh(nullptr), + m_name(NULL), + m_appearanceName(NULL), + m_floorName(NULL), + m_floorMesh(NULL), m_canSeeParentCell(false), - m_lightList(nullptr), + m_lightList(NULL), m_portalList(new PortalPropertyTemplateCellPortalList), - m_collisionExtent(nullptr), + m_collisionExtent(NULL), m_preloadManager (0) { load(portalPropertyTemplate, index, iff); @@ -556,7 +556,7 @@ PortalPropertyTemplateCell::~PortalPropertyTemplateCell() } delete m_collisionExtent; - m_collisionExtent = nullptr; + m_collisionExtent = NULL; if (m_preloadManager) { @@ -567,7 +567,7 @@ PortalPropertyTemplateCell::~PortalPropertyTemplateCell() if (m_floorMesh) { m_floorMesh->releaseReference (); - m_floorMesh = nullptr; + m_floorMesh = NULL; } } @@ -875,7 +875,7 @@ const char *PortalPropertyTemplateCell::getFloorName() const FloorMesh const * PortalPropertyTemplateCell::getFloorMesh() const { - if(m_floorMesh == nullptr) + if(m_floorMesh == NULL) { if(m_floorName) { @@ -885,7 +885,7 @@ FloorMesh const * PortalPropertyTemplateCell::getFloorMesh() const } else { - //-- cell template r0 always has a nullptr floor name for POBs without accessible exteriors (POB ships & POB-only dungeons) + //-- cell template r0 always has a null floor name for POBs without accessible exteriors (POB ships & POB-only dungeons) //-- don't warn for that cell template DEBUG_WARNING(ConfigSharedCollision::getReportWarnings() && strcmp(m_name, "r0"), ("PortalPropertyTemplateCell::getFloorMesh() - Cell template %s on [%s] has no floor name", m_name, m_appearanceName)); @@ -1039,7 +1039,7 @@ PortalPropertyTemplate::PortalPropertyTemplate(const CrcString &name) m_cellList(new CellList), m_cellNameList(new CellNameList), m_crc(0), - m_pathGraph(nullptr), + m_pathGraph(NULL), m_radarPortalGeometry(0) { FileName shortName(name.getString()); @@ -1079,7 +1079,7 @@ PortalPropertyTemplate::~PortalPropertyTemplate() delete m_portalOwnersList; delete m_pathGraph; - m_pathGraph = nullptr; + m_pathGraph = NULL; delete m_radarPortalGeometry; m_radarPortalGeometry = 0; diff --git a/engine/shared/library/sharedObject/src/shared/portal/SphereGrid.h b/engine/shared/library/sharedObject/src/shared/portal/SphereGrid.h index e83e48e3..00a1ea37 100755 --- a/engine/shared/library/sharedObject/src/shared/portal/SphereGrid.h +++ b/engine/shared/library/sharedObject/src/shared/portal/SphereGrid.h @@ -373,14 +373,14 @@ inline void SphereGrid::findInRangeCapsule( Object c template inline void SphereGrid::findInRange( const Capsule & range, std::set & results) { - findInRangeCapsule( INVALID_POB, range, nullptr, results ); + findInRangeCapsule( INVALID_POB, range, NULL, results ); } template inline void SphereGrid::findInRange( Vector const ¢er_w, float radius, std::set & results) { - findInRangeSphere( INVALID_POB, center_w, radius, nullptr, results ); + findInRangeSphere( INVALID_POB, center_w, radius, NULL, results ); } @@ -401,7 +401,7 @@ inline void SphereGrid::findInRange( Vector const &c template inline void SphereGrid::findInRange( Object const *pob, Vector const ¢er_w, float radius, std::set & results) { - findInRangeSphere( pob, center_w, radius, nullptr, results ); + findInRangeSphere( pob, center_w, radius, NULL, results ); } template diff --git a/engine/shared/library/sharedObject/src/shared/property/LayerProperty.cpp b/engine/shared/library/sharedObject/src/shared/property/LayerProperty.cpp index f331b5a4..63f5cc57 100755 --- a/engine/shared/library/sharedObject/src/shared/property/LayerProperty.cpp +++ b/engine/shared/library/sharedObject/src/shared/property/LayerProperty.cpp @@ -23,7 +23,7 @@ PropertyId LayerProperty::getClassPropertyId() LayerProperty::LayerProperty(Object& thisObject) : Property(getClassPropertyId(), thisObject), -m_layer(nullptr) +m_layer(NULL) { } @@ -31,10 +31,10 @@ m_layer(nullptr) LayerProperty::~LayerProperty() { - if (m_layer != nullptr) + if (m_layer != NULL) { delete m_layer; - m_layer = nullptr; + m_layer = NULL; } } diff --git a/engine/shared/library/sharedObject/src/shared/world/World.cpp b/engine/shared/library/sharedObject/src/shared/world/World.cpp index ce2ab931..e0d90fae 100755 --- a/engine/shared/library/sharedObject/src/shared/world/World.cpp +++ b/engine/shared/library/sharedObject/src/shared/world/World.cpp @@ -305,7 +305,7 @@ bool World::removeObject (const Object* object, int listIndex) { DEBUG_FATAL (!ms_installed, ("not installed")); NOT_NULL (object); - DEBUG_FATAL (!object, ("World::removeObject - object is nullptr")); + DEBUG_FATAL (!object, ("World::removeObject - object is null")); VALIDATE_RANGE_INCLUSIVE_EXCLUSIVE (0, listIndex, static_cast(WOL_Count)); ms_objectSet.erase(object); @@ -349,7 +349,7 @@ bool World::removeObject (const Object* object, int listIndex) void World::queueObject (Object* object) { DEBUG_FATAL (!ms_installed, ("not installed")); - DEBUG_FATAL (!object, ("World::queueObject - object is nullptr")); + DEBUG_FATAL (!object, ("World::queueObject - object is null")); ms_queuedObjectList->addObject (object); } diff --git a/engine/shared/library/sharedPathfinding/src/shared/DynamicPathGraph.cpp b/engine/shared/library/sharedPathfinding/src/shared/DynamicPathGraph.cpp index 8b264ebb..532ade02 100755 --- a/engine/shared/library/sharedPathfinding/src/shared/DynamicPathGraph.cpp +++ b/engine/shared/library/sharedPathfinding/src/shared/DynamicPathGraph.cpp @@ -25,10 +25,10 @@ DynamicPathGraph::~DynamicPathGraph() clear(); delete m_nodeList; - m_nodeList = nullptr; + m_nodeList = NULL; delete m_dirtyNodes; - m_dirtyNodes = nullptr; + m_dirtyNodes = NULL; } // ---------- @@ -72,7 +72,7 @@ int DynamicPathGraph::getEdgeCount ( int nodeIndex ) const { DynamicPathNode const * node = _getNode(nodeIndex); - if(node == nullptr) + if(node == NULL) { return 0; } @@ -86,13 +86,13 @@ PathEdge * DynamicPathGraph::getEdge ( int nodeIndex, int edgeIndex ) { DynamicPathNode * node = _getNode(nodeIndex); - if(node != nullptr) + if(node != NULL) { return node->getEdge(edgeIndex); } else { - return nullptr; + return NULL; } } @@ -100,13 +100,13 @@ PathEdge const * DynamicPathGraph::getEdge ( int nodeIndex, int edgeIndex ) cons { DynamicPathNode const * node = _getNode(nodeIndex); - if(node != nullptr) + if(node != NULL) { return node->getEdge(edgeIndex); } else { - return nullptr; + return NULL; } } @@ -114,7 +114,7 @@ PathEdge const * DynamicPathGraph::getEdge ( int nodeIndex, int edgeIndex ) cons int DynamicPathGraph::addNode ( DynamicPathNode * newNode ) { - if(newNode == nullptr) return -1; + if(newNode == NULL) return -1; int listSize = m_nodeList->size(); @@ -124,7 +124,7 @@ int DynamicPathGraph::addNode ( DynamicPathNode * newNode ) { for(int i = 0; i < listSize; i++) { - if(m_nodeList->at(i) == nullptr) + if(m_nodeList->at(i) == NULL) { nodeIndex = i; break; @@ -155,11 +155,11 @@ void DynamicPathGraph::removeNode ( int nodeIndex ) DynamicPathNode * node = _getNode(nodeIndex); - if(node != nullptr) + if(node != NULL) { unlinkNode(nodeIndex); - m_nodeList->at(nodeIndex) = nullptr; + m_nodeList->at(nodeIndex) = NULL; delete node; @@ -171,7 +171,7 @@ void DynamicPathGraph::moveNode ( int nodeIndex, Vector const & newPosition ) { DynamicPathNode * node = _getNode(nodeIndex); - if(node != nullptr) + if(node != NULL) { node->setPosition_p(newPosition); @@ -230,7 +230,7 @@ void DynamicPathGraph::unlinkNode ( int nodeIndex ) { DynamicPathNode * node = _getNode(nodeIndex); - if(node == nullptr) return; + if(node == NULL) return; // ---------- @@ -254,7 +254,7 @@ void DynamicPathGraph::relinkNode ( int nodeIndex ) { DynamicPathNode * nodeA = _getNode(nodeIndex); - if(nodeA == nullptr) return; + if(nodeA == NULL) return; // ---------- @@ -268,7 +268,7 @@ void DynamicPathGraph::relinkNode ( int nodeIndex ) { DynamicPathNode * nodeB = _getNode(i); - if(nodeB == nullptr) continue; + if(nodeB == NULL) continue; if(nodeA == nodeB) continue; Vector const & posA = nodeA->getPosition_p(); @@ -314,7 +314,7 @@ void DynamicPathGraph::relinkNode ( int nodeIndex ) { DynamicPathNode * neighborNode = _getNode(neighborList[i]); - if(neighborNode != nullptr) + if(neighborNode != NULL) { neighborNode->markRedundantEdges(); neighborNode->removeMarkedEdges(); @@ -326,7 +326,7 @@ void DynamicPathGraph::relinkNode ( int nodeIndex ) DynamicPathNode * DynamicPathGraph::_getNode ( int nodeIndex ) { - if(nodeIndex == -1) return nullptr; + if(nodeIndex == -1) return NULL; return m_nodeList->at(nodeIndex); } @@ -335,7 +335,7 @@ DynamicPathNode * DynamicPathGraph::_getNode ( int nodeIndex ) DynamicPathNode const * DynamicPathGraph::_getNode ( int nodeIndex ) const { - if(nodeIndex == -1) return nullptr; + if(nodeIndex == -1) return NULL; return m_nodeList->at(nodeIndex); } diff --git a/engine/shared/library/sharedPathfinding/src/shared/DynamicPathGraph.h b/engine/shared/library/sharedPathfinding/src/shared/DynamicPathGraph.h index b778ac1a..e2baf1f3 100755 --- a/engine/shared/library/sharedPathfinding/src/shared/DynamicPathGraph.h +++ b/engine/shared/library/sharedPathfinding/src/shared/DynamicPathGraph.h @@ -20,7 +20,7 @@ class DynamicPathNode; // and remove nodes on the fly (such as city graphs) // DynamicPathGraph uses a sparse array to store its nodes. Calling -// getNode with a nodeIndex in [0,nodeCount) may return nullptr. If you +// getNode with a nodeIndex in [0,nodeCount) may return NULL. If you // want to know the number of live nodes in the graph, call getLiveNodeCount. class DynamicPathGraph : public PathGraph diff --git a/engine/shared/library/sharedPathfinding/src/shared/DynamicPathNode.cpp b/engine/shared/library/sharedPathfinding/src/shared/DynamicPathNode.cpp index b82efe57..8f3798bf 100755 --- a/engine/shared/library/sharedPathfinding/src/shared/DynamicPathNode.cpp +++ b/engine/shared/library/sharedPathfinding/src/shared/DynamicPathNode.cpp @@ -105,7 +105,7 @@ bool DynamicPathNode::removeEdge ( int nodeIndex ) { DynamicPathNode * neighbor = _getGraph()->_getNode(nodeIndex); - if(neighbor == nullptr) return false; + if(neighbor == NULL) return false; if(!_removeEdge(nodeIndex)) return false; @@ -175,8 +175,8 @@ int DynamicPathNode::markRedundantEdges ( void ) const PathEdge const * edgeA = getEdge(i); PathEdge const * edgeB = getEdge(j); - if(edgeA == nullptr) continue; - if(edgeB == nullptr) continue; + if(edgeA == NULL) continue; + if(edgeB == NULL) continue; int iA = edgeA->getIndexA(); int iB = edgeA->getIndexB(); diff --git a/engine/shared/library/sharedPathfinding/src/shared/PathGraph.cpp b/engine/shared/library/sharedPathfinding/src/shared/PathGraph.cpp index 0585dc87..a72faa92 100755 --- a/engine/shared/library/sharedPathfinding/src/shared/PathGraph.cpp +++ b/engine/shared/library/sharedPathfinding/src/shared/PathGraph.cpp @@ -69,7 +69,7 @@ int PathGraph::findNode ( PathNodeType type, int key ) const if(getEdgeCount(i) == 0) continue; - if((node != nullptr) && (node->getType() == type) && (node->getKey() == key)) + if((node != NULL) && (node->getType() == type) && (node->getKey() == key)) { return i; } @@ -88,7 +88,7 @@ int PathGraph::findEntrance ( int key ) const { PathNode const * node = getNode(i); - if(node == nullptr) continue; + if(node == NULL) continue; if(getEdgeCount(i) == 0) continue; @@ -119,7 +119,7 @@ int PathGraph::findNearestNode ( Vector const & position_p ) const { PathNode const * node = getNode(i); - if(node == nullptr) continue; + if(node == NULL) continue; if(getEdgeCount(i) == 0) continue; @@ -148,7 +148,7 @@ int PathGraph::findNearestNode ( PathNodeType searchType, Vector const & positio { PathNode const * node = getNode(i); - if(node == nullptr) continue; + if(node == NULL) continue; if(getEdgeCount(i) == 0) continue; @@ -180,7 +180,7 @@ void PathGraph::findNodesInRange ( Vector const & position_p, float range, PathN { PathNode const * node = getNode(i); - if(node == nullptr) continue; + if(node == NULL) continue; if(getEdgeCount(i) == 0) continue; diff --git a/engine/shared/library/sharedPathfinding/src/shared/PathGraphIterator.cpp b/engine/shared/library/sharedPathfinding/src/shared/PathGraphIterator.cpp index d22b581c..92a4dc10 100755 --- a/engine/shared/library/sharedPathfinding/src/shared/PathGraphIterator.cpp +++ b/engine/shared/library/sharedPathfinding/src/shared/PathGraphIterator.cpp @@ -14,7 +14,7 @@ // ====================================================================== PathGraphIterator::PathGraphIterator () -: m_graph(nullptr), +: m_graph(NULL), m_nodeIndex(-1) { } @@ -29,18 +29,18 @@ PathGraphIterator::PathGraphIterator ( PathGraph const * graph, int nodeIndex ) bool PathGraphIterator::isValid ( void ) const { - return (m_graph != nullptr) && (m_nodeIndex != -1) && (m_graph->getNode(m_nodeIndex) != nullptr); + return (m_graph != NULL) && (m_nodeIndex != -1) && (m_graph->getNode(m_nodeIndex) != NULL); } PathNode const * PathGraphIterator::getNode ( void ) const { - if( (m_graph != nullptr) && (m_nodeIndex != -1) ) + if( (m_graph != NULL) && (m_nodeIndex != -1) ) { return m_graph->getNode( m_nodeIndex ); } else { - return nullptr; + return NULL; } } @@ -53,7 +53,7 @@ int PathGraphIterator::getNeighborCount ( void ) const PathNode const * PathGraphIterator::getNeighbor ( int whichNeighbor ) const { - if(!isValid()) return nullptr; + if(!isValid()) return NULL; return m_graph->getNode( m_graph->getEdge( m_nodeIndex, whichNeighbor )->getIndexB() ); } diff --git a/engine/shared/library/sharedPathfinding/src/shared/PathNode.cpp b/engine/shared/library/sharedPathfinding/src/shared/PathNode.cpp index 1eec246d..6ff18223 100755 --- a/engine/shared/library/sharedPathfinding/src/shared/PathNode.cpp +++ b/engine/shared/library/sharedPathfinding/src/shared/PathNode.cpp @@ -13,7 +13,7 @@ // ====================================================================== PathNode::PathNode() -: m_graph(nullptr), +: m_graph(NULL), m_index(-1), m_id(-1), m_key(-1), @@ -27,7 +27,7 @@ PathNode::PathNode() } PathNode::PathNode ( Vector const & position ) -: m_graph(nullptr), +: m_graph(NULL), m_index(-1), m_id(-1), m_key(-1), diff --git a/engine/shared/library/sharedPathfinding/src/shared/PathSearch.cpp b/engine/shared/library/sharedPathfinding/src/shared/PathSearch.cpp index e09a5cab..42abd9d7 100755 --- a/engine/shared/library/sharedPathfinding/src/shared/PathSearch.cpp +++ b/engine/shared/library/sharedPathfinding/src/shared/PathSearch.cpp @@ -137,7 +137,7 @@ MEMORY_BLOCK_MANAGER_IMPLEMENTATION_WITH_INSTALL(PathSearchNode, true, 0, 0, 0); PathSearchNode::PathSearchNode ( PathSearch * search, PathGraph const * graph, PathNode const * node ) : m_search(search), - m_parent(nullptr), + m_parent(NULL), m_graph(graph), m_node(node), m_queued(false), @@ -164,13 +164,13 @@ PathSearchNode * PathSearchNode::getNeighbor ( int whichNeighbor ) PathNode const * neighborNode = m_graph->getNode(neighborIndex); - if(neighborNode != nullptr) + if(neighborNode != NULL) { return getSearchNode(neighborNode); } else { - return nullptr; + return NULL; } } @@ -180,7 +180,7 @@ PathSearchNode * PathSearchNode::createSearchNode( PathNode const * node ) { // doing bad voodoo with the node marks - PathSearchNode * oldNode = nullptr; + PathSearchNode * oldNode = NULL; int mark = node->getMark(3); @@ -206,7 +206,7 @@ PathSearchNode * PathSearchNode::getSearchNode( PathNode const * node ) { // doing bad voodoo with the node marks - PathSearchNode * searchNode = nullptr; + PathSearchNode * searchNode = NULL; int mark = node->getMark(3); @@ -215,7 +215,7 @@ PathSearchNode * PathSearchNode::getSearchNode( PathNode const * node ) searchNode = (PathSearchNode*)((void*)mark); } - if(searchNode == nullptr) + if(searchNode == NULL) { return createSearchNode(node); } @@ -305,9 +305,9 @@ void PathSearch::install() // ---------------------------------------------------------------------- PathSearch::PathSearch ( void ) -: m_graph(nullptr), - m_start(nullptr), - m_goal(nullptr), +: m_graph(NULL), + m_start(NULL), + m_goal(NULL), m_multiGoal(false), m_goals(new NodeList()), m_queue(new PathSearchQueue()), @@ -321,16 +321,16 @@ PathSearch::PathSearch ( void ) PathSearch::~PathSearch() { delete m_goals; - m_goals = nullptr; + m_goals = NULL; delete m_queue; - m_queue = nullptr; + m_queue = NULL; delete m_path; - m_path = nullptr; + m_path = NULL; delete m_visitedNodes; - m_visitedNodes = nullptr; + m_visitedNodes = NULL; } // ---------------------------------------------------------------------- @@ -361,7 +361,7 @@ PathSearchNode * PathSearch::search ( void ) { PathSearchNode * neighbor = node->getNeighbor(i); - if(neighbor != nullptr) + if(neighbor != NULL) { float newCost = node->getCost() + costBetween(node->getPathNode(),neighbor->getPathNode()); @@ -377,7 +377,7 @@ PathSearchNode * PathSearch::search ( void ) } } - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -395,8 +395,8 @@ bool PathSearch::search ( PathGraph const * graph, int startIndex, int goalIndex m_goal = graph->getNode(goalIndex); m_multiGoal = false; - if(m_start == nullptr) return false; - if(m_goal == nullptr) return false; + if(m_start == NULL) return false; + if(m_goal == NULL) return false; m_path->clear(); @@ -429,7 +429,7 @@ bool PathSearch::search ( PathGraph const * graph, int startIndex, IndexList con int goalCount = goalIndices.size(); if(goalCount == 0) return false; - if(m_start == nullptr) return false; + if(m_start == NULL) return false; m_goals->resize(goalCount); @@ -455,7 +455,7 @@ bool PathSearch::search ( PathGraph const * graph, int startIndex, IndexList con bool PathSearch::buildPath ( PathSearchNode * endNode ) { - if( endNode == nullptr ) + if( endNode == NULL ) { m_path->clear(); return false; @@ -633,13 +633,13 @@ IndexList const & PathSearch::getPath ( void ) const bool PathSearch::atGoal ( PathSearchNode * searchNode ) const { - if(searchNode == nullptr) return false; + if(searchNode == NULL) return false; if(m_multiGoal) { PathNode const * pathNode = searchNode->getPathNode(); - if(pathNode == nullptr) return false; + if(pathNode == NULL) return false; return std::find( m_goals->begin(), m_goals->end(), pathNode ) != m_goals->end(); } diff --git a/engine/shared/library/sharedPathfinding/src/shared/Pathfinding.cpp b/engine/shared/library/sharedPathfinding/src/shared/Pathfinding.cpp index 67dfa06a..dc532a9a 100755 --- a/engine/shared/library/sharedPathfinding/src/shared/Pathfinding.cpp +++ b/engine/shared/library/sharedPathfinding/src/shared/Pathfinding.cpp @@ -69,7 +69,7 @@ BaseClass * Pathfinding::graphFactory ( Iff & iff ) { DEBUG_WARNING(true,("Pathfinding::graphFactory - Don't know how to construct a path graph from the IFF in %s\n",iff.getFileName())); - return nullptr; + return NULL; } } diff --git a/engine/shared/library/sharedPathfinding/src/shared/SetupSharedPathfinding.cpp b/engine/shared/library/sharedPathfinding/src/shared/SetupSharedPathfinding.cpp index 230186e9..304f3504 100755 --- a/engine/shared/library/sharedPathfinding/src/shared/SetupSharedPathfinding.cpp +++ b/engine/shared/library/sharedPathfinding/src/shared/SetupSharedPathfinding.cpp @@ -67,7 +67,7 @@ int findNeighbor ( PathNode * node, PathNodeType neighborType, int neighborKey ) BaseClass * expandBuildingGraph ( PortalPropertyTemplate * portalTemplate, BaseClass * baseBuildingGraph ) { - if(baseBuildingGraph == nullptr) return nullptr; + if(baseBuildingGraph == NULL) return NULL; SimplePathGraph * buildingGraph = safe_cast(baseBuildingGraph); @@ -92,11 +92,11 @@ BaseClass * expandBuildingGraph ( PortalPropertyTemplate * portalTemplate, BaseC FloorMesh const * floorMesh = cell->getFloorMesh(); - if(floorMesh == nullptr) continue; + if(floorMesh == NULL) continue; PathGraph const * cellGraph = safe_cast(floorMesh->getPathGraph()); - if(cellGraph == nullptr) continue; + if(cellGraph == NULL) continue; // ---------- diff --git a/engine/shared/library/sharedPathfinding/src/shared/SimplePathGraph.cpp b/engine/shared/library/sharedPathfinding/src/shared/SimplePathGraph.cpp index 2673b2e6..d408d035 100755 --- a/engine/shared/library/sharedPathfinding/src/shared/SimplePathGraph.cpp +++ b/engine/shared/library/sharedPathfinding/src/shared/SimplePathGraph.cpp @@ -39,7 +39,7 @@ void readArray_Class ( Iff & iff, T * & array, Tag tag ) { int count = iff.read_int32(); - if(array == nullptr) array = new T(); + if(array == NULL) array = new T(); array->resize(count); @@ -58,7 +58,7 @@ void readArray_Class ( Iff & iff, T * & array, Tag tag, Reader R ) { int count = iff.read_int32(); - if(array == nullptr) array = new T(); + if(array == NULL) array = new T(); array->resize(count); @@ -77,7 +77,7 @@ void readArray_Struct ( Iff & iff, T * & array, Tag tag ) { int count = iff.read_int32(); - if(array == nullptr) array = new T(); + if(array == NULL) array = new T(); array->resize(count); @@ -157,7 +157,7 @@ SimplePathGraph::SimplePathGraph ( PathGraphType type ) { #ifdef _DEBUG - m_debugLines = nullptr; + m_debugLines = NULL; #endif } @@ -181,7 +181,7 @@ SimplePathGraph::SimplePathGraph( SimplePathGraph::NodeList * nodes, SimplePathG #ifdef _DEBUG - m_debugLines = nullptr; + m_debugLines = NULL; #endif } @@ -189,21 +189,21 @@ SimplePathGraph::SimplePathGraph( SimplePathGraph::NodeList * nodes, SimplePathG SimplePathGraph::~SimplePathGraph() { delete m_nodes; - m_nodes = nullptr; + m_nodes = NULL; delete m_edges; - m_edges = nullptr; + m_edges = NULL; delete m_edgeCounts; - m_edgeCounts = nullptr; + m_edgeCounts = NULL; delete m_edgeStarts; - m_edgeStarts = nullptr; + m_edgeStarts = NULL; #ifdef _DEBUG delete m_debugLines; - m_debugLines = nullptr; + m_debugLines = NULL; #endif } @@ -265,7 +265,7 @@ PathNode * SimplePathGraph::getNode ( int nodeIndex ) if (static_cast(nodeIndex) < m_nodes->size()) return &m_nodes->at(nodeIndex); - return nullptr; + return NULL; } PathNode const * SimplePathGraph::getNode ( int nodeIndex ) const @@ -273,7 +273,7 @@ PathNode const * SimplePathGraph::getNode ( int nodeIndex ) const if (static_cast(nodeIndex) < m_nodes->size()) return &m_nodes->at(nodeIndex); - return nullptr; + return NULL; } // ---------------------------------------------------------------------- @@ -507,7 +507,7 @@ void SimplePathGraph::drawDebugShapes ( DebugShapeRenderer * renderer ) const #ifdef _DEBUG - if(renderer == nullptr) return; + if(renderer == NULL) return; if( m_debugLines ) renderer->drawLineList( *m_debugLines, VectorArgb::solidYellow ); diff --git a/engine/shared/library/sharedRemoteDebugServer/src/shared/SharedRemoteDebugServer.cpp b/engine/shared/library/sharedRemoteDebugServer/src/shared/SharedRemoteDebugServer.cpp index f33204ef..0e305c96 100755 --- a/engine/shared/library/sharedRemoteDebugServer/src/shared/SharedRemoteDebugServer.cpp +++ b/engine/shared/library/sharedRemoteDebugServer/src/shared/SharedRemoteDebugServer.cpp @@ -27,8 +27,8 @@ unsigned int SharedRemoteDebugServer::ms_remoteDebugToolChanne void SharedRemoteDebugServer::install() { - ms_serviceHandle = nullptr; - ms_connection = nullptr; + ms_serviceHandle = NULL; + ms_connection = NULL; if (!ConfigSharedFoundation::getUseRemoteDebug()) return; @@ -41,7 +41,7 @@ void SharedRemoteDebugServer::install() ms_serviceHandle = new Service(ConnectionAllocator(), setup); //even though this is the game client, this is a remoteDebug *server*, since it sends data to a Qt app for viewing - RemoteDebugServer::install(nullptr, open, close, send, nullptr); + RemoteDebugServer::install(NULL, open, close, send, NULL); //this value needs to be true before the call to RemoteDebugServer::open ms_installed = true; @@ -84,7 +84,7 @@ void SharedRemoteDebugServer::close(void) { DEBUG_FATAL(!ms_installed, ("sharedRemoteDebugServer not installed")); delete ms_connection; - ms_connection = nullptr; + ms_connection = NULL; } //------------------------------------------------------------------- diff --git a/engine/shared/library/sharedRemoteDebugServer/src/shared/SharedRemoteDebugServerConnection.cpp b/engine/shared/library/sharedRemoteDebugServer/src/shared/SharedRemoteDebugServerConnection.cpp index ac6fcd1b..ef51481a 100755 --- a/engine/shared/library/sharedRemoteDebugServer/src/shared/SharedRemoteDebugServerConnection.cpp +++ b/engine/shared/library/sharedRemoteDebugServer/src/shared/SharedRemoteDebugServerConnection.cpp @@ -16,7 +16,7 @@ SharedRemoteDebugServerConnection::SharedRemoteDebugServerConnection(const std::string & a, const unsigned short p) : Connection(a, p, NetworkSetupData()), -m_remotedebugCommandChannel (nullptr) +m_remotedebugCommandChannel (NULL) { } @@ -24,7 +24,7 @@ m_remotedebugCommandChannel (nullptr) SharedRemoteDebugServerConnection::SharedRemoteDebugServerConnection(UdpConnectionMT * u, TcpClient * t) : Connection(u, t), -m_remotedebugCommandChannel (nullptr) +m_remotedebugCommandChannel (NULL) { } diff --git a/engine/shared/library/sharedSkillSystem/src/shared/ExpertiseManager.cpp b/engine/shared/library/sharedSkillSystem/src/shared/ExpertiseManager.cpp index 17b9bc40..3326d378 100755 --- a/engine/shared/library/sharedSkillSystem/src/shared/ExpertiseManager.cpp +++ b/engine/shared/library/sharedSkillSystem/src/shared/ExpertiseManager.cpp @@ -298,7 +298,7 @@ int const ExpertiseManager::getNumExpertiseTiers() * exist. * * @return - skill object for expertise at grid location. - * returns nullptr if none found + * returns NULL if none found */ SkillObject const * ExpertiseManager::getExpertiseSkillAt(int tree, int tier, int grid, int rank) { diff --git a/engine/shared/library/sharedSkillSystem/src/shared/LevelManager.cpp b/engine/shared/library/sharedSkillSystem/src/shared/LevelManager.cpp index 5c81ffea..12195492 100755 --- a/engine/shared/library/sharedSkillSystem/src/shared/LevelManager.cpp +++ b/engine/shared/library/sharedSkillSystem/src/shared/LevelManager.cpp @@ -335,7 +335,7 @@ void LevelManager::updateLevelDataWithSkill(LevelData &levelData, std::string co //====================================================================== // Find the level corresponding to the xp value and -// returns nullptr if not found +// returns null if not found LevelRecord const * LevelManagerNamespace::getLevelRecord(int xp) { LevelRecordsIterator itr = ms_levelRecords.begin(); @@ -365,7 +365,7 @@ LevelRecord const * LevelManagerNamespace::getLevelRecord(int xp) WARNING(true, ("getLevelRecord: Couldn't find level for xp value[%d]\n", xp)); - return nullptr; + return NULL; } //====================================================================== diff --git a/engine/shared/library/sharedSkillSystem/src/shared/SkillManager.cpp b/engine/shared/library/sharedSkillSystem/src/shared/SkillManager.cpp index e0bc3718..c92f73c4 100755 --- a/engine/shared/library/sharedSkillSystem/src/shared/SkillManager.cpp +++ b/engine/shared/library/sharedSkillSystem/src/shared/SkillManager.cpp @@ -18,7 +18,7 @@ #include #include -SkillManager *SkillManager::ms_instance = nullptr; +SkillManager *SkillManager::ms_instance = NULL; const std::string &SkillManager::cms_skillsDatatableName = "datatables/skill/skills.iff"; //----------------------------------------------------------------- @@ -92,7 +92,7 @@ void SkillManager::remove() { DEBUG_FATAL (!ms_instance, ("SkillManager not installed")); delete ms_instance; - ms_instance = nullptr; + ms_instance = NULL; } //---------------------------------------------------------------------- @@ -170,7 +170,7 @@ const SkillObject * SkillManager::loadSkill(const std::string & skillName) uint32 SkillManager::getDefaultXpLimit(const std::string & experienceType) { - if (m_xpLimitMap != nullptr) + if (m_xpLimitMap != NULL) { XpLimitMap::const_iterator result = m_xpLimitMap->find(experienceType); if (result != m_xpLimitMap->end()) @@ -183,13 +183,13 @@ uint32 SkillManager::getDefaultXpLimit(const std::string & experienceType) void SkillManager::initXpLimits() { - if (m_xpLimitTable == nullptr) + if (m_xpLimitTable == NULL) { WARNING(true, ("SkillManager::initXpLimits, m_xpLimitTable not initialized")); return; } - if (m_xpLimitMap == nullptr) + if (m_xpLimitMap == NULL) { WARNING(true, ("SkillManager::initXpLimits, m_xpLimitMap not initialized")); return; diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerArmorTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerArmorTemplate.cpp index c162ae34..d6f5b854 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerArmorTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerArmorTemplate.cpp @@ -45,7 +45,7 @@ ServerArmorTemplate::~ServerArmorTemplate() for (iter = m_specialProtection.begin(); iter != m_specialProtection.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_specialProtection.clear(); } @@ -97,10 +97,10 @@ Tag ServerArmorTemplate::getTemplateVersion(void) const */ Tag ServerArmorTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerArmorTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerArmorTemplate::getHighestTemplateVersion @@ -114,9 +114,9 @@ CompilerIntegerParam * ServerArmorTemplate::getCompilerIntegerParam(const char * { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_rating; } @@ -128,9 +128,9 @@ CompilerIntegerParam * ServerArmorTemplate::getCompilerIntegerParam(const char * { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_integrity; } @@ -142,9 +142,9 @@ CompilerIntegerParam * ServerArmorTemplate::getCompilerIntegerParam(const char * { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_effectiveness; } @@ -156,9 +156,9 @@ CompilerIntegerParam * ServerArmorTemplate::getCompilerIntegerParam(const char * { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_vulnerability; } @@ -170,9 +170,9 @@ CompilerIntegerParam * ServerArmorTemplate::getCompilerIntegerParam(const char * { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_encumbrance[index]; } @@ -180,7 +180,7 @@ CompilerIntegerParam * ServerArmorTemplate::getCompilerIntegerParam(const char * } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerArmorTemplate::getCompilerIntegerParam FloatParam * ServerArmorTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -229,7 +229,7 @@ StructParamOT * ServerArmorTemplate::getStructParamOT(const char *name, bool dee } else return TpfTemplate::getStructParamOT(name, deepCheck, index); - return nullptr; + return NULL; } //ServerArmorTemplate::getStructParamOT TriggerVolumeParam * ServerArmorTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index) @@ -316,12 +316,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } @@ -355,7 +355,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_specialProtection.begin(); iter != m_specialProtection.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_specialProtection.clear(); m_specialProtectionAppend = file.read_bool8(); @@ -532,9 +532,9 @@ CompilerIntegerParam * ServerArmorTemplate::_SpecialProtection::getCompilerInteg { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_type; } @@ -546,9 +546,9 @@ CompilerIntegerParam * ServerArmorTemplate::_SpecialProtection::getCompilerInteg { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_effectiveness; } @@ -556,7 +556,7 @@ CompilerIntegerParam * ServerArmorTemplate::_SpecialProtection::getCompilerInteg } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerArmorTemplate::_SpecialProtection::getCompilerIntegerParam FloatParam * ServerArmorTemplate::_SpecialProtection::getFloatParam(const char *name, bool deepCheck, int index) diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerBattlefieldMarkerObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerBattlefieldMarkerObjectTemplate.cpp index aa5440ae..4394895d 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerBattlefieldMarkerObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerBattlefieldMarkerObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerBattlefieldMarkerObjectTemplate::getTemplateVersion(void) const */ Tag ServerBattlefieldMarkerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerBattlefieldMarkerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerBattlefieldMarkerObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerBuildingObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerBuildingObjectTemplate.cpp index 40cf8c4e..ba0b7c07 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerBuildingObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerBuildingObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerBuildingObjectTemplate::getTemplateVersion(void) const */ Tag ServerBuildingObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerBuildingObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerBuildingObjectTemplate::getHighestTemplateVersion @@ -103,9 +103,9 @@ CompilerIntegerParam * ServerBuildingObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_maintenanceCost; } @@ -113,7 +113,7 @@ CompilerIntegerParam * ServerBuildingObjectTemplate::getCompilerIntegerParam(con } else return ServerTangibleObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerBuildingObjectTemplate::getCompilerIntegerParam FloatParam * ServerBuildingObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -129,9 +129,9 @@ BoolParam * ServerBuildingObjectTemplate::getBoolParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_isPublic; } @@ -139,7 +139,7 @@ BoolParam * ServerBuildingObjectTemplate::getBoolParam(const char *name, bool de } else return ServerTangibleObjectTemplate::getBoolParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerBuildingObjectTemplate::getBoolParam StringParam * ServerBuildingObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) @@ -227,12 +227,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerCellObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerCellObjectTemplate.cpp index 427b3931..95175f0f 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerCellObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerCellObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerCellObjectTemplate::getTemplateVersion(void) const */ Tag ServerCellObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerCellObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerCellObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerCityObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerCityObjectTemplate.cpp index ac48b340..b3f18a79 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerCityObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerCityObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerCityObjectTemplate::getTemplateVersion(void) const */ Tag ServerCityObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerCityObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerCityObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerConstructionContractObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerConstructionContractObjectTemplate.cpp index 73096b66..9a0f8848 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerConstructionContractObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerConstructionContractObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerConstructionContractObjectTemplate::getTemplateVersion(void) const */ Tag ServerConstructionContractObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerConstructionContractObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerConstructionContractObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerCreatureObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerCreatureObjectTemplate.cpp index f63f0d43..7159e108 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerCreatureObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerCreatureObjectTemplate.cpp @@ -45,7 +45,7 @@ ServerCreatureObjectTemplate::~ServerCreatureObjectTemplate() for (iter = m_attribMods.begin(); iter != m_attribMods.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_attribMods.clear(); } @@ -97,10 +97,10 @@ Tag ServerCreatureObjectTemplate::getTemplateVersion(void) const */ Tag ServerCreatureObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerCreatureObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerCreatureObjectTemplate::getHighestTemplateVersion @@ -114,9 +114,9 @@ CompilerIntegerParam * ServerCreatureObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_attributes[index]; } @@ -128,9 +128,9 @@ CompilerIntegerParam * ServerCreatureObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_minAttributes[index]; } @@ -142,9 +142,9 @@ CompilerIntegerParam * ServerCreatureObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_maxAttributes[index]; } @@ -156,9 +156,9 @@ CompilerIntegerParam * ServerCreatureObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_shockWounds; } @@ -166,7 +166,7 @@ CompilerIntegerParam * ServerCreatureObjectTemplate::getCompilerIntegerParam(con } else return ServerTangibleObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerCreatureObjectTemplate::getCompilerIntegerParam FloatParam * ServerCreatureObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -177,9 +177,9 @@ FloatParam * ServerCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_minDrainModifier; } @@ -191,9 +191,9 @@ FloatParam * ServerCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_maxDrainModifier; } @@ -205,9 +205,9 @@ FloatParam * ServerCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_minFaucetModifier; } @@ -219,9 +219,9 @@ FloatParam * ServerCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_maxFaucetModifier; } @@ -233,9 +233,9 @@ FloatParam * ServerCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_approachTriggerRange; } @@ -247,9 +247,9 @@ FloatParam * ServerCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_maxMentalStates[index]; } @@ -261,9 +261,9 @@ FloatParam * ServerCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_mentalStatesDecay[index]; } @@ -271,7 +271,7 @@ FloatParam * ServerCreatureObjectTemplate::getFloatParam(const char *name, bool } else return ServerTangibleObjectTemplate::getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerCreatureObjectTemplate::getFloatParam BoolParam * ServerCreatureObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) @@ -282,9 +282,9 @@ BoolParam * ServerCreatureObjectTemplate::getBoolParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_canCreateAvatar; } @@ -292,7 +292,7 @@ BoolParam * ServerCreatureObjectTemplate::getBoolParam(const char *name, bool de } else return ServerTangibleObjectTemplate::getBoolParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerCreatureObjectTemplate::getBoolParam StringParam * ServerCreatureObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) @@ -303,9 +303,9 @@ StringParam * ServerCreatureObjectTemplate::getStringParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_defaultWeapon; } @@ -317,9 +317,9 @@ StringParam * ServerCreatureObjectTemplate::getStringParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_nameGeneratorType; } @@ -327,7 +327,7 @@ StringParam * ServerCreatureObjectTemplate::getStringParam(const char *name, boo } else return ServerTangibleObjectTemplate::getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerCreatureObjectTemplate::getStringParam StringIdParam * ServerCreatureObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -361,7 +361,7 @@ StructParamOT * ServerCreatureObjectTemplate::getStructParamOT(const char *name, } else return ServerTangibleObjectTemplate::getStructParamOT(name, deepCheck, index); - return nullptr; + return NULL; } //ServerCreatureObjectTemplate::getStructParamOT TriggerVolumeParam * ServerCreatureObjectTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index) @@ -464,12 +464,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } @@ -549,7 +549,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_attribMods.begin(); iter != m_attribMods.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_attribMods.clear(); m_attribModsAppend = file.read_bool8(); diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerDraftSchematicObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerDraftSchematicObjectTemplate.cpp index 53c05125..0bc765a5 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerDraftSchematicObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerDraftSchematicObjectTemplate.cpp @@ -49,7 +49,7 @@ ServerDraftSchematicObjectTemplate::~ServerDraftSchematicObjectTemplate() for (iter = m_slots.begin(); iter != m_slots.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_slots.clear(); } @@ -58,7 +58,7 @@ ServerDraftSchematicObjectTemplate::~ServerDraftSchematicObjectTemplate() for (iter = m_skillCommands.begin(); iter != m_skillCommands.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_skillCommands.clear(); } @@ -67,7 +67,7 @@ ServerDraftSchematicObjectTemplate::~ServerDraftSchematicObjectTemplate() for (iter = m_manufactureScripts.begin(); iter != m_manufactureScripts.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_manufactureScripts.clear(); } @@ -119,10 +119,10 @@ Tag ServerDraftSchematicObjectTemplate::getTemplateVersion(void) const */ Tag ServerDraftSchematicObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerDraftSchematicObjectTemplate::getHighestTemplateVersion @@ -136,9 +136,9 @@ CompilerIntegerParam * ServerDraftSchematicObjectTemplate::getCompilerIntegerPar { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_category; } @@ -150,9 +150,9 @@ CompilerIntegerParam * ServerDraftSchematicObjectTemplate::getCompilerIntegerPar { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_itemsPerContainer; } @@ -160,7 +160,7 @@ CompilerIntegerParam * ServerDraftSchematicObjectTemplate::getCompilerIntegerPar } else return ServerIntangibleObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerDraftSchematicObjectTemplate::getCompilerIntegerParam FloatParam * ServerDraftSchematicObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -171,9 +171,9 @@ FloatParam * ServerDraftSchematicObjectTemplate::getFloatParam(const char *name, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_manufactureTime; } @@ -185,9 +185,9 @@ FloatParam * ServerDraftSchematicObjectTemplate::getFloatParam(const char *name, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_prototypeTime; } @@ -195,7 +195,7 @@ FloatParam * ServerDraftSchematicObjectTemplate::getFloatParam(const char *name, } else return ServerIntangibleObjectTemplate::getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerDraftSchematicObjectTemplate::getFloatParam BoolParam * ServerDraftSchematicObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) @@ -206,9 +206,9 @@ BoolParam * ServerDraftSchematicObjectTemplate::getBoolParam(const char *name, b { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_destroyIngredients; } @@ -216,7 +216,7 @@ BoolParam * ServerDraftSchematicObjectTemplate::getBoolParam(const char *name, b } else return ServerIntangibleObjectTemplate::getBoolParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerDraftSchematicObjectTemplate::getBoolParam StringParam * ServerDraftSchematicObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) @@ -227,9 +227,9 @@ StringParam * ServerDraftSchematicObjectTemplate::getStringParam(const char *nam { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_craftedObjectTemplate; } @@ -241,9 +241,9 @@ StringParam * ServerDraftSchematicObjectTemplate::getStringParam(const char *nam { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_crateObjectTemplate; } @@ -275,7 +275,7 @@ StringParam * ServerDraftSchematicObjectTemplate::getStringParam(const char *nam } else return ServerIntangibleObjectTemplate::getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerDraftSchematicObjectTemplate::getStringParam StringIdParam * ServerDraftSchematicObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -309,7 +309,7 @@ StructParamOT * ServerDraftSchematicObjectTemplate::getStructParamOT(const char } else return ServerIntangibleObjectTemplate::getStructParamOT(name, deepCheck, index); - return nullptr; + return NULL; } //ServerDraftSchematicObjectTemplate::getStructParamOT TriggerVolumeParam * ServerDraftSchematicObjectTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index) @@ -418,12 +418,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } @@ -457,7 +457,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_slots.begin(); iter != m_slots.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_slots.clear(); m_slotsAppend = file.read_bool8(); @@ -476,7 +476,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_skillCommands.begin(); iter != m_skillCommands.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_skillCommands.clear(); m_skillCommandsAppend = file.read_bool8(); @@ -497,7 +497,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_manufactureScripts.begin(); iter != m_manufactureScripts.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_manufactureScripts.clear(); m_manufactureScriptsAppend = file.read_bool8(); @@ -672,7 +672,7 @@ ServerDraftSchematicObjectTemplate::_IngredientSlot::~_IngredientSlot() for (iter = m_options.begin(); iter != m_options.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_options.clear(); } @@ -719,9 +719,9 @@ FloatParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getFloatParam( { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_complexity; } @@ -729,7 +729,7 @@ FloatParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getFloatParam( } else return TpfTemplate::getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerDraftSchematicObjectTemplate::_IngredientSlot::getFloatParam BoolParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getBoolParam(const char *name, bool deepCheck, int index) @@ -740,9 +740,9 @@ BoolParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getBoolParam(co { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_optional; } @@ -750,7 +750,7 @@ BoolParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getBoolParam(co } else return TpfTemplate::getBoolParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerDraftSchematicObjectTemplate::_IngredientSlot::getBoolParam StringParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getStringParam(const char *name, bool deepCheck, int index) @@ -761,9 +761,9 @@ StringParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getStringPara { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_optionalSkillCommand; } @@ -775,9 +775,9 @@ StringParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getStringPara { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_appearance; } @@ -785,7 +785,7 @@ StringParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getStringPara } else return TpfTemplate::getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerDraftSchematicObjectTemplate::_IngredientSlot::getStringParam StringIdParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getStringIdParam(const char *name, bool deepCheck, int index) @@ -796,9 +796,9 @@ StringIdParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getStringId { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_name; } @@ -806,7 +806,7 @@ StringIdParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getStringId } else return TpfTemplate::getStringIdParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerDraftSchematicObjectTemplate::_IngredientSlot::getStringIdParam VectorParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getVectorParam(const char *name, bool deepCheck, int index) @@ -835,7 +835,7 @@ StructParamOT * ServerDraftSchematicObjectTemplate::_IngredientSlot::getStructPa } else return TpfTemplate::getStructParamOT(name, deepCheck, index); - return nullptr; + return NULL; } //ServerDraftSchematicObjectTemplate::_IngredientSlot::getStructParamOT TriggerVolumeParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getTriggerVolumeParam(const char *name, bool deepCheck, int index) @@ -921,7 +921,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_options.begin(); iter != m_options.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_options.clear(); m_optionsAppend = file.read_bool8(); diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerFactoryObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerFactoryObjectTemplate.cpp index a4d8ae8d..cd7ab927 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerFactoryObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerFactoryObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerFactoryObjectTemplate::getTemplateVersion(void) const */ Tag ServerFactoryObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerFactoryObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerFactoryObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerGroupObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerGroupObjectTemplate.cpp index a4c0367a..647b6606 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerGroupObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerGroupObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerGroupObjectTemplate::getTemplateVersion(void) const */ Tag ServerGroupObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerGroupObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerGroupObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerGuildObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerGuildObjectTemplate.cpp index b212df70..446f3c34 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerGuildObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerGuildObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerGuildObjectTemplate::getTemplateVersion(void) const */ Tag ServerGuildObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerGuildObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerGuildObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerHarvesterInstallationObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerHarvesterInstallationObjectTemplate.cpp index 6516811d..7bfaaf19 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerHarvesterInstallationObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerHarvesterInstallationObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerHarvesterInstallationObjectTemplate::getTemplateVersion(void) const */ Tag ServerHarvesterInstallationObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerHarvesterInstallationObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerHarvesterInstallationObjectTemplate::getHighestTemplateVersion @@ -103,9 +103,9 @@ CompilerIntegerParam * ServerHarvesterInstallationObjectTemplate::getCompilerInt { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_maxExtractionRate; } @@ -117,9 +117,9 @@ CompilerIntegerParam * ServerHarvesterInstallationObjectTemplate::getCompilerInt { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_currentExtractionRate; } @@ -131,9 +131,9 @@ CompilerIntegerParam * ServerHarvesterInstallationObjectTemplate::getCompilerInt { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_maxHopperSize; } @@ -141,7 +141,7 @@ CompilerIntegerParam * ServerHarvesterInstallationObjectTemplate::getCompilerInt } else return ServerInstallationObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerHarvesterInstallationObjectTemplate::getCompilerIntegerParam FloatParam * ServerHarvesterInstallationObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -162,9 +162,9 @@ StringParam * ServerHarvesterInstallationObjectTemplate::getStringParam(const ch { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_masterClassName; } @@ -172,7 +172,7 @@ StringParam * ServerHarvesterInstallationObjectTemplate::getStringParam(const ch } else return ServerInstallationObjectTemplate::getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerHarvesterInstallationObjectTemplate::getStringParam StringIdParam * ServerHarvesterInstallationObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -255,12 +255,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerInstallationObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerInstallationObjectTemplate.cpp index 6525ffe2..efc11fee 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerInstallationObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerInstallationObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerInstallationObjectTemplate::getTemplateVersion(void) const */ Tag ServerInstallationObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerInstallationObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerInstallationObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerIntangibleObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerIntangibleObjectTemplate.cpp index 43781914..efdbfac9 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerIntangibleObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerIntangibleObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerIntangibleObjectTemplate::getTemplateVersion(void) const */ Tag ServerIntangibleObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerIntangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerIntangibleObjectTemplate::getHighestTemplateVersion @@ -103,9 +103,9 @@ CompilerIntegerParam * ServerIntangibleObjectTemplate::getCompilerIntegerParam(c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_count; } @@ -113,7 +113,7 @@ CompilerIntegerParam * ServerIntangibleObjectTemplate::getCompilerIntegerParam(c } else return ServerObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerIntangibleObjectTemplate::getCompilerIntegerParam FloatParam * ServerIntangibleObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -211,12 +211,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } @@ -316,7 +316,7 @@ ServerIntangibleObjectTemplate::_Ingredient::~_Ingredient() for (iter = m_ingredients.begin(); iter != m_ingredients.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_ingredients.clear(); } @@ -358,9 +358,9 @@ CompilerIntegerParam * ServerIntangibleObjectTemplate::_Ingredient::getCompilerI { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_ingredientType; } @@ -368,7 +368,7 @@ CompilerIntegerParam * ServerIntangibleObjectTemplate::_Ingredient::getCompilerI } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerIntangibleObjectTemplate::_Ingredient::getCompilerIntegerParam FloatParam * ServerIntangibleObjectTemplate::_Ingredient::getFloatParam(const char *name, bool deepCheck, int index) @@ -379,9 +379,9 @@ FloatParam * ServerIntangibleObjectTemplate::_Ingredient::getFloatParam(const ch { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_complexity; } @@ -389,7 +389,7 @@ FloatParam * ServerIntangibleObjectTemplate::_Ingredient::getFloatParam(const ch } else return TpfTemplate::getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerIntangibleObjectTemplate::_Ingredient::getFloatParam BoolParam * ServerIntangibleObjectTemplate::_Ingredient::getBoolParam(const char *name, bool deepCheck, int index) @@ -405,9 +405,9 @@ StringParam * ServerIntangibleObjectTemplate::_Ingredient::getStringParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_skillCommand; } @@ -415,7 +415,7 @@ StringParam * ServerIntangibleObjectTemplate::_Ingredient::getStringParam(const } else return TpfTemplate::getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerIntangibleObjectTemplate::_Ingredient::getStringParam StringIdParam * ServerIntangibleObjectTemplate::_Ingredient::getStringIdParam(const char *name, bool deepCheck, int index) @@ -449,7 +449,7 @@ StructParamOT * ServerIntangibleObjectTemplate::_Ingredient::getStructParamOT(co } else return TpfTemplate::getStructParamOT(name, deepCheck, index); - return nullptr; + return NULL; } //ServerIntangibleObjectTemplate::_Ingredient::getStructParamOT TriggerVolumeParam * ServerIntangibleObjectTemplate::_Ingredient::getTriggerVolumeParam(const char *name, bool deepCheck, int index) @@ -533,7 +533,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_ingredients.begin(); iter != m_ingredients.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_ingredients.clear(); m_ingredientsAppend = file.read_bool8(); @@ -669,9 +669,9 @@ CompilerIntegerParam * ServerIntangibleObjectTemplate::_SchematicAttribute::getC { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_value; } @@ -679,7 +679,7 @@ CompilerIntegerParam * ServerIntangibleObjectTemplate::_SchematicAttribute::getC } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerIntangibleObjectTemplate::_SchematicAttribute::getCompilerIntegerParam FloatParam * ServerIntangibleObjectTemplate::_SchematicAttribute::getFloatParam(const char *name, bool deepCheck, int index) @@ -705,9 +705,9 @@ StringIdParam * ServerIntangibleObjectTemplate::_SchematicAttribute::getStringId { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_name; } @@ -715,7 +715,7 @@ StringIdParam * ServerIntangibleObjectTemplate::_SchematicAttribute::getStringId } else return TpfTemplate::getStringIdParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerIntangibleObjectTemplate::_SchematicAttribute::getStringIdParam VectorParam * ServerIntangibleObjectTemplate::_SchematicAttribute::getVectorParam(const char *name, bool deepCheck, int index) @@ -889,9 +889,9 @@ CompilerIntegerParam * ServerIntangibleObjectTemplate::_SimpleIngredient::getCom { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_count; } @@ -899,7 +899,7 @@ CompilerIntegerParam * ServerIntangibleObjectTemplate::_SimpleIngredient::getCom } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerIntangibleObjectTemplate::_SimpleIngredient::getCompilerIntegerParam FloatParam * ServerIntangibleObjectTemplate::_SimpleIngredient::getFloatParam(const char *name, bool deepCheck, int index) @@ -920,9 +920,9 @@ StringParam * ServerIntangibleObjectTemplate::_SimpleIngredient::getStringParam( { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_ingredient; } @@ -930,7 +930,7 @@ StringParam * ServerIntangibleObjectTemplate::_SimpleIngredient::getStringParam( } else return TpfTemplate::getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerIntangibleObjectTemplate::_SimpleIngredient::getStringParam StringIdParam * ServerIntangibleObjectTemplate::_SimpleIngredient::getStringIdParam(const char *name, bool deepCheck, int index) @@ -941,9 +941,9 @@ StringIdParam * ServerIntangibleObjectTemplate::_SimpleIngredient::getStringIdPa { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_name; } @@ -951,7 +951,7 @@ StringIdParam * ServerIntangibleObjectTemplate::_SimpleIngredient::getStringIdPa } else return TpfTemplate::getStringIdParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerIntangibleObjectTemplate::_SimpleIngredient::getStringIdParam VectorParam * ServerIntangibleObjectTemplate::_SimpleIngredient::getVectorParam(const char *name, bool deepCheck, int index) diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerJediManagerObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerJediManagerObjectTemplate.cpp index acecbef1..34919f61 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerJediManagerObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerJediManagerObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerJediManagerObjectTemplate::getTemplateVersion(void) const */ Tag ServerJediManagerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerJediManagerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerJediManagerObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerManufactureInstallationObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerManufactureInstallationObjectTemplate.cpp index 1747392d..82335f44 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerManufactureInstallationObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerManufactureInstallationObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerManufactureInstallationObjectTemplate::getTemplateVersion(void) const */ Tag ServerManufactureInstallationObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerManufactureInstallationObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerManufactureInstallationObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerManufactureSchematicObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerManufactureSchematicObjectTemplate.cpp index 73735880..54bbda83 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerManufactureSchematicObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerManufactureSchematicObjectTemplate.cpp @@ -47,7 +47,7 @@ ServerManufactureSchematicObjectTemplate::~ServerManufactureSchematicObjectTempl for (iter = m_ingredients.begin(); iter != m_ingredients.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_ingredients.clear(); } @@ -56,7 +56,7 @@ ServerManufactureSchematicObjectTemplate::~ServerManufactureSchematicObjectTempl for (iter = m_attributes.begin(); iter != m_attributes.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_attributes.clear(); } @@ -108,10 +108,10 @@ Tag ServerManufactureSchematicObjectTemplate::getTemplateVersion(void) const */ Tag ServerManufactureSchematicObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerManufactureSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerManufactureSchematicObjectTemplate::getHighestTemplateVersion @@ -125,9 +125,9 @@ CompilerIntegerParam * ServerManufactureSchematicObjectTemplate::getCompilerInte { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_itemCount; } @@ -135,7 +135,7 @@ CompilerIntegerParam * ServerManufactureSchematicObjectTemplate::getCompilerInte } else return ServerIntangibleObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerManufactureSchematicObjectTemplate::getCompilerIntegerParam FloatParam * ServerManufactureSchematicObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -156,9 +156,9 @@ StringParam * ServerManufactureSchematicObjectTemplate::getStringParam(const cha { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_draftSchematic; } @@ -170,9 +170,9 @@ StringParam * ServerManufactureSchematicObjectTemplate::getStringParam(const cha { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_creator; } @@ -180,7 +180,7 @@ StringParam * ServerManufactureSchematicObjectTemplate::getStringParam(const cha } else return ServerIntangibleObjectTemplate::getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerManufactureSchematicObjectTemplate::getStringParam StringIdParam * ServerManufactureSchematicObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -226,7 +226,7 @@ StructParamOT * ServerManufactureSchematicObjectTemplate::getStructParamOT(const } else return ServerIntangibleObjectTemplate::getStructParamOT(name, deepCheck, index); - return nullptr; + return NULL; } //ServerManufactureSchematicObjectTemplate::getStructParamOT TriggerVolumeParam * ServerManufactureSchematicObjectTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index) @@ -324,12 +324,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } @@ -361,7 +361,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_ingredients.begin(); iter != m_ingredients.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_ingredients.clear(); m_ingredientsAppend = file.read_bool8(); @@ -382,7 +382,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_attributes.begin(); iter != m_attributes.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_attributes.clear(); m_attributesAppend = file.read_bool8(); @@ -563,9 +563,9 @@ StringIdParam * ServerManufactureSchematicObjectTemplate::_IngredientSlot::getSt { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_name; } @@ -573,7 +573,7 @@ StringIdParam * ServerManufactureSchematicObjectTemplate::_IngredientSlot::getSt } else return TpfTemplate::getStringIdParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerManufactureSchematicObjectTemplate::_IngredientSlot::getStringIdParam VectorParam * ServerManufactureSchematicObjectTemplate::_IngredientSlot::getVectorParam(const char *name, bool deepCheck, int index) @@ -594,9 +594,9 @@ StructParamOT * ServerManufactureSchematicObjectTemplate::_IngredientSlot::getSt { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStructParamOT(name, deepCheck, index); - return nullptr; + return NULL; } return &m_ingredient; } @@ -604,7 +604,7 @@ StructParamOT * ServerManufactureSchematicObjectTemplate::_IngredientSlot::getSt } else return TpfTemplate::getStructParamOT(name, deepCheck, index); - return nullptr; + return NULL; } //ServerManufactureSchematicObjectTemplate::_IngredientSlot::getStructParamOT TriggerVolumeParam * ServerManufactureSchematicObjectTemplate::_IngredientSlot::getTriggerVolumeParam(const char *name, bool deepCheck, int index) diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerMissionObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerMissionObjectTemplate.cpp index 240882ac..39ab71f1 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerMissionObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerMissionObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerMissionObjectTemplate::getTemplateVersion(void) const */ Tag ServerMissionObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerMissionObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerMissionObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerObjectTemplate.cpp index 5df8660b..0307ce8c 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerObjectTemplate.cpp @@ -55,7 +55,7 @@ ServerObjectTemplate::~ServerObjectTemplate() for (iter = m_scripts.begin(); iter != m_scripts.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_scripts.clear(); } @@ -64,7 +64,7 @@ ServerObjectTemplate::~ServerObjectTemplate() for (iter = m_visibleFlags.begin(); iter != m_visibleFlags.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_visibleFlags.clear(); } @@ -73,7 +73,7 @@ ServerObjectTemplate::~ServerObjectTemplate() for (iter = m_deleteFlags.begin(); iter != m_deleteFlags.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_deleteFlags.clear(); } @@ -82,7 +82,7 @@ ServerObjectTemplate::~ServerObjectTemplate() for (iter = m_moveFlags.begin(); iter != m_moveFlags.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_moveFlags.clear(); } @@ -91,7 +91,7 @@ ServerObjectTemplate::~ServerObjectTemplate() for (iter = m_contents.begin(); iter != m_contents.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_contents.clear(); } @@ -100,7 +100,7 @@ ServerObjectTemplate::~ServerObjectTemplate() for (iter = m_xpPoints.begin(); iter != m_xpPoints.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_xpPoints.clear(); } @@ -152,10 +152,10 @@ Tag ServerObjectTemplate::getTemplateVersion(void) const */ Tag ServerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerObjectTemplate::getHighestTemplateVersion @@ -169,9 +169,9 @@ CompilerIntegerParam * ServerObjectTemplate::getCompilerIntegerParam(const char { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_volume; } @@ -219,9 +219,9 @@ CompilerIntegerParam * ServerObjectTemplate::getCompilerIntegerParam(const char { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_tintIndex; } @@ -229,7 +229,7 @@ CompilerIntegerParam * ServerObjectTemplate::getCompilerIntegerParam(const char } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerObjectTemplate::getCompilerIntegerParam FloatParam * ServerObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -240,9 +240,9 @@ FloatParam * ServerObjectTemplate::getFloatParam(const char *name, bool deepChec { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_complexity; } @@ -254,9 +254,9 @@ FloatParam * ServerObjectTemplate::getFloatParam(const char *name, bool deepChec { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_updateRanges[index]; } @@ -264,7 +264,7 @@ FloatParam * ServerObjectTemplate::getFloatParam(const char *name, bool deepChec } else return TpfTemplate::getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerObjectTemplate::getFloatParam BoolParam * ServerObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) @@ -275,9 +275,9 @@ BoolParam * ServerObjectTemplate::getBoolParam(const char *name, bool deepCheck, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_invulnerable; } @@ -289,9 +289,9 @@ BoolParam * ServerObjectTemplate::getBoolParam(const char *name, bool deepCheck, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_persistByDefault; } @@ -303,9 +303,9 @@ BoolParam * ServerObjectTemplate::getBoolParam(const char *name, bool deepCheck, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_persistContents; } @@ -313,7 +313,7 @@ BoolParam * ServerObjectTemplate::getBoolParam(const char *name, bool deepCheck, } else return TpfTemplate::getBoolParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerObjectTemplate::getBoolParam StringParam * ServerObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) @@ -324,9 +324,9 @@ StringParam * ServerObjectTemplate::getStringParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_sharedTemplate; } @@ -346,7 +346,7 @@ StringParam * ServerObjectTemplate::getStringParam(const char *name, bool deepCh } else return TpfTemplate::getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerObjectTemplate::getStringParam StringIdParam * ServerObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -367,9 +367,9 @@ DynamicVariableParam * ServerObjectTemplate::getDynamicVariableParam(const char { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getDynamicVariableParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_objvars; } @@ -377,7 +377,7 @@ DynamicVariableParam * ServerObjectTemplate::getDynamicVariableParam(const char } else return TpfTemplate::getDynamicVariableParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerObjectTemplate::getDynamicVariableParam StructParamOT * ServerObjectTemplate::getStructParamOT(const char *name, bool deepCheck, int index) @@ -408,7 +408,7 @@ StructParamOT * ServerObjectTemplate::getStructParamOT(const char *name, bool de } else return TpfTemplate::getStructParamOT(name, deepCheck, index); - return nullptr; + return NULL; } //ServerObjectTemplate::getStructParamOT TriggerVolumeParam * ServerObjectTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index) @@ -562,12 +562,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } @@ -597,7 +597,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_scripts.begin(); iter != m_scripts.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_scripts.clear(); m_scriptsAppend = file.read_bool8(); @@ -620,7 +620,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_visibleFlags.begin(); iter != m_visibleFlags.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_visibleFlags.clear(); m_visibleFlagsAppend = file.read_bool8(); @@ -639,7 +639,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_deleteFlags.begin(); iter != m_deleteFlags.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_deleteFlags.clear(); m_deleteFlagsAppend = file.read_bool8(); @@ -658,7 +658,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_moveFlags.begin(); iter != m_moveFlags.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_moveFlags.clear(); m_moveFlagsAppend = file.read_bool8(); @@ -697,7 +697,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_contents.begin(); iter != m_contents.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_contents.clear(); m_contentsAppend = file.read_bool8(); @@ -716,7 +716,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_xpPoints.begin(); iter != m_xpPoints.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_xpPoints.clear(); m_xpPointsAppend = file.read_bool8(); @@ -980,9 +980,9 @@ CompilerIntegerParam * ServerObjectTemplate::_AttribMod::getCompilerIntegerParam { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_target; } @@ -994,9 +994,9 @@ CompilerIntegerParam * ServerObjectTemplate::_AttribMod::getCompilerIntegerParam { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_value; } @@ -1004,7 +1004,7 @@ CompilerIntegerParam * ServerObjectTemplate::_AttribMod::getCompilerIntegerParam } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerObjectTemplate::_AttribMod::getCompilerIntegerParam FloatParam * ServerObjectTemplate::_AttribMod::getFloatParam(const char *name, bool deepCheck, int index) @@ -1015,9 +1015,9 @@ FloatParam * ServerObjectTemplate::_AttribMod::getFloatParam(const char *name, b { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_time; } @@ -1029,9 +1029,9 @@ FloatParam * ServerObjectTemplate::_AttribMod::getFloatParam(const char *name, b { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_timeAtValue; } @@ -1043,9 +1043,9 @@ FloatParam * ServerObjectTemplate::_AttribMod::getFloatParam(const char *name, b { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_decay; } @@ -1053,7 +1053,7 @@ FloatParam * ServerObjectTemplate::_AttribMod::getFloatParam(const char *name, b } else return TpfTemplate::getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerObjectTemplate::_AttribMod::getFloatParam BoolParam * ServerObjectTemplate::_AttribMod::getBoolParam(const char *name, bool deepCheck, int index) @@ -1276,9 +1276,9 @@ BoolParam * ServerObjectTemplate::_Contents::getBoolParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_equipObject; } @@ -1286,7 +1286,7 @@ BoolParam * ServerObjectTemplate::_Contents::getBoolParam(const char *name, bool } else return TpfTemplate::getBoolParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerObjectTemplate::_Contents::getBoolParam StringParam * ServerObjectTemplate::_Contents::getStringParam(const char *name, bool deepCheck, int index) @@ -1297,9 +1297,9 @@ StringParam * ServerObjectTemplate::_Contents::getStringParam(const char *name, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_slotName; } @@ -1311,9 +1311,9 @@ StringParam * ServerObjectTemplate::_Contents::getStringParam(const char *name, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_content; } @@ -1321,7 +1321,7 @@ StringParam * ServerObjectTemplate::_Contents::getStringParam(const char *name, } else return TpfTemplate::getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerObjectTemplate::_Contents::getStringParam StringIdParam * ServerObjectTemplate::_Contents::getStringIdParam(const char *name, bool deepCheck, int index) @@ -1508,9 +1508,9 @@ CompilerIntegerParam * ServerObjectTemplate::_MentalStateMod::getCompilerInteger { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_target; } @@ -1518,7 +1518,7 @@ CompilerIntegerParam * ServerObjectTemplate::_MentalStateMod::getCompilerInteger } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerObjectTemplate::_MentalStateMod::getCompilerIntegerParam FloatParam * ServerObjectTemplate::_MentalStateMod::getFloatParam(const char *name, bool deepCheck, int index) @@ -1529,9 +1529,9 @@ FloatParam * ServerObjectTemplate::_MentalStateMod::getFloatParam(const char *na { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_value; } @@ -1543,9 +1543,9 @@ FloatParam * ServerObjectTemplate::_MentalStateMod::getFloatParam(const char *na { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_time; } @@ -1557,9 +1557,9 @@ FloatParam * ServerObjectTemplate::_MentalStateMod::getFloatParam(const char *na { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_timeAtValue; } @@ -1571,9 +1571,9 @@ FloatParam * ServerObjectTemplate::_MentalStateMod::getFloatParam(const char *na { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_decay; } @@ -1581,7 +1581,7 @@ FloatParam * ServerObjectTemplate::_MentalStateMod::getFloatParam(const char *na } else return TpfTemplate::getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerObjectTemplate::_MentalStateMod::getFloatParam BoolParam * ServerObjectTemplate::_MentalStateMod::getBoolParam(const char *name, bool deepCheck, int index) @@ -1794,9 +1794,9 @@ CompilerIntegerParam * ServerObjectTemplate::_Xp::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_type; } @@ -1808,9 +1808,9 @@ CompilerIntegerParam * ServerObjectTemplate::_Xp::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_level; } @@ -1822,9 +1822,9 @@ CompilerIntegerParam * ServerObjectTemplate::_Xp::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_value; } @@ -1832,7 +1832,7 @@ CompilerIntegerParam * ServerObjectTemplate::_Xp::getCompilerIntegerParam(const } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerObjectTemplate::_Xp::getCompilerIntegerParam FloatParam * ServerObjectTemplate::_Xp::getFloatParam(const char *name, bool deepCheck, int index) diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerPlanetObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerPlanetObjectTemplate.cpp index fc998c4a..91f52345 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerPlanetObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerPlanetObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerPlanetObjectTemplate::getTemplateVersion(void) const */ Tag ServerPlanetObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerPlanetObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerPlanetObjectTemplate::getHighestTemplateVersion @@ -118,9 +118,9 @@ StringParam * ServerPlanetObjectTemplate::getStringParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_planetName; } @@ -128,7 +128,7 @@ StringParam * ServerPlanetObjectTemplate::getStringParam(const char *name, bool } else return ServerUniverseObjectTemplate::getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerPlanetObjectTemplate::getStringParam StringIdParam * ServerPlanetObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -211,12 +211,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerPlayerObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerPlayerObjectTemplate.cpp index bd678142..2824f83a 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerPlayerObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerPlayerObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerPlayerObjectTemplate::getTemplateVersion(void) const */ Tag ServerPlayerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerPlayerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerPlayerObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerPlayerQuestObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerPlayerQuestObjectTemplate.cpp index 36c23628..0c05dd79 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerPlayerQuestObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerPlayerQuestObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerPlayerQuestObjectTemplate::getTemplateVersion(void) const */ Tag ServerPlayerQuestObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerPlayerQuestObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerPlayerQuestObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerResourceClassObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerResourceClassObjectTemplate.cpp index 0a5c1bac..2df53960 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerResourceClassObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerResourceClassObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerResourceClassObjectTemplate::getTemplateVersion(void) const */ Tag ServerResourceClassObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerResourceClassObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerResourceClassObjectTemplate::getHighestTemplateVersion @@ -103,9 +103,9 @@ CompilerIntegerParam * ServerResourceClassObjectTemplate::getCompilerIntegerPara { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_numTypes; } @@ -117,9 +117,9 @@ CompilerIntegerParam * ServerResourceClassObjectTemplate::getCompilerIntegerPara { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_minTypes; } @@ -131,9 +131,9 @@ CompilerIntegerParam * ServerResourceClassObjectTemplate::getCompilerIntegerPara { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_maxTypes; } @@ -141,7 +141,7 @@ CompilerIntegerParam * ServerResourceClassObjectTemplate::getCompilerIntegerPara } else return ServerUniverseObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerResourceClassObjectTemplate::getCompilerIntegerParam FloatParam * ServerResourceClassObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -162,9 +162,9 @@ StringParam * ServerResourceClassObjectTemplate::getStringParam(const char *name { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_resourceClassName; } @@ -176,9 +176,9 @@ StringParam * ServerResourceClassObjectTemplate::getStringParam(const char *name { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_parentClass; } @@ -186,7 +186,7 @@ StringParam * ServerResourceClassObjectTemplate::getStringParam(const char *name } else return ServerUniverseObjectTemplate::getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerResourceClassObjectTemplate::getStringParam StringIdParam * ServerResourceClassObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -269,12 +269,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerResourceContainerObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerResourceContainerObjectTemplate.cpp index c4008c2f..c5e367cc 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerResourceContainerObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerResourceContainerObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerResourceContainerObjectTemplate::getTemplateVersion(void) const */ Tag ServerResourceContainerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerResourceContainerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerResourceContainerObjectTemplate::getHighestTemplateVersion @@ -103,9 +103,9 @@ CompilerIntegerParam * ServerResourceContainerObjectTemplate::getCompilerInteger { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_maxResources; } @@ -113,7 +113,7 @@ CompilerIntegerParam * ServerResourceContainerObjectTemplate::getCompilerInteger } else return ServerTangibleObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerResourceContainerObjectTemplate::getCompilerIntegerParam FloatParam * ServerResourceContainerObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -211,12 +211,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerResourcePoolObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerResourcePoolObjectTemplate.cpp index 15ad8ebc..6aa324d6 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerResourcePoolObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerResourcePoolObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerResourcePoolObjectTemplate::getTemplateVersion(void) const */ Tag ServerResourcePoolObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerResourcePoolObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerResourcePoolObjectTemplate::getHighestTemplateVersion @@ -103,9 +103,9 @@ CompilerIntegerParam * ServerResourcePoolObjectTemplate::getCompilerIntegerParam { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_mapSeed; } @@ -117,9 +117,9 @@ CompilerIntegerParam * ServerResourcePoolObjectTemplate::getCompilerIntegerParam { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_amountRemaining; } @@ -127,7 +127,7 @@ CompilerIntegerParam * ServerResourcePoolObjectTemplate::getCompilerIntegerParam } else return ServerUniverseObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerResourcePoolObjectTemplate::getCompilerIntegerParam FloatParam * ServerResourcePoolObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -225,12 +225,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerResourceTypeObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerResourceTypeObjectTemplate.cpp index 7ed9954d..dd44c902 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerResourceTypeObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerResourceTypeObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerResourceTypeObjectTemplate::getTemplateVersion(void) const */ Tag ServerResourceTypeObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerResourceTypeObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerResourceTypeObjectTemplate::getHighestTemplateVersion @@ -118,9 +118,9 @@ StringParam * ServerResourceTypeObjectTemplate::getStringParam(const char *name, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_resourceName; } @@ -128,7 +128,7 @@ StringParam * ServerResourceTypeObjectTemplate::getStringParam(const char *name, } else return ServerUniverseObjectTemplate::getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerResourceTypeObjectTemplate::getStringParam StringIdParam * ServerResourceTypeObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -211,12 +211,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerShipObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerShipObjectTemplate.cpp index c1bb613c..247bda11 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerShipObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerShipObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerShipObjectTemplate::getTemplateVersion(void) const */ Tag ServerShipObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerShipObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerShipObjectTemplate::getHighestTemplateVersion @@ -118,9 +118,9 @@ StringParam * ServerShipObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_shipType; } @@ -128,7 +128,7 @@ StringParam * ServerShipObjectTemplate::getStringParam(const char *name, bool de } else return ServerTangibleObjectTemplate::getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerShipObjectTemplate::getStringParam StringIdParam * ServerShipObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -211,12 +211,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerStaticObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerStaticObjectTemplate.cpp index 48fe0b50..fb078b58 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerStaticObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerStaticObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerStaticObjectTemplate::getTemplateVersion(void) const */ Tag ServerStaticObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerStaticObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerStaticObjectTemplate::getHighestTemplateVersion @@ -113,9 +113,9 @@ BoolParam * ServerStaticObjectTemplate::getBoolParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_clientOnlyBuildout; } @@ -123,7 +123,7 @@ BoolParam * ServerStaticObjectTemplate::getBoolParam(const char *name, bool deep } else return ServerObjectTemplate::getBoolParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerStaticObjectTemplate::getBoolParam StringParam * ServerStaticObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) @@ -211,12 +211,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerTangibleObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerTangibleObjectTemplate.cpp index 52fd36b3..5604b102 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerTangibleObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerTangibleObjectTemplate.cpp @@ -45,7 +45,7 @@ ServerTangibleObjectTemplate::~ServerTangibleObjectTemplate() for (iter = m_triggerVolumes.begin(); iter != m_triggerVolumes.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_triggerVolumes.clear(); } @@ -97,10 +97,10 @@ Tag ServerTangibleObjectTemplate::getTemplateVersion(void) const */ Tag ServerTangibleObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerTangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerTangibleObjectTemplate::getHighestTemplateVersion @@ -114,9 +114,9 @@ CompilerIntegerParam * ServerTangibleObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_combatSkeleton; } @@ -128,9 +128,9 @@ CompilerIntegerParam * ServerTangibleObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_maxHitPoints; } @@ -142,9 +142,9 @@ CompilerIntegerParam * ServerTangibleObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_interestRadius; } @@ -156,9 +156,9 @@ CompilerIntegerParam * ServerTangibleObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_count; } @@ -170,9 +170,9 @@ CompilerIntegerParam * ServerTangibleObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_condition; } @@ -180,7 +180,7 @@ CompilerIntegerParam * ServerTangibleObjectTemplate::getCompilerIntegerParam(con } else return ServerObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerTangibleObjectTemplate::getCompilerIntegerParam FloatParam * ServerTangibleObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -196,9 +196,9 @@ BoolParam * ServerTangibleObjectTemplate::getBoolParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_wantSawAttackTriggers; } @@ -206,7 +206,7 @@ BoolParam * ServerTangibleObjectTemplate::getBoolParam(const char *name, bool de } else return ServerObjectTemplate::getBoolParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerTangibleObjectTemplate::getBoolParam StringParam * ServerTangibleObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) @@ -217,9 +217,9 @@ StringParam * ServerTangibleObjectTemplate::getStringParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_armor; } @@ -227,7 +227,7 @@ StringParam * ServerTangibleObjectTemplate::getStringParam(const char *name, boo } else return ServerObjectTemplate::getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerTangibleObjectTemplate::getStringParam StringIdParam * ServerTangibleObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -266,7 +266,7 @@ TriggerVolumeParam * ServerTangibleObjectTemplate::getTriggerVolumeParam(const c } else return ServerObjectTemplate::getTriggerVolumeParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerTangibleObjectTemplate::getTriggerVolumeParam void ServerTangibleObjectTemplate::initStructParamOT(StructParamOT ¶m, const char *name) @@ -341,12 +341,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } @@ -374,7 +374,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_triggerVolumes.begin(); iter != m_triggerVolumes.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_triggerVolumes.clear(); m_triggerVolumesAppend = file.read_bool8(); diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerTokenObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerTokenObjectTemplate.cpp index a3cac916..b63a3f63 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerTokenObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerTokenObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerTokenObjectTemplate::getTemplateVersion(void) const */ Tag ServerTokenObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerTokenObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerTokenObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerUberObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerUberObjectTemplate.cpp index 6aba5832..20c3f1f8 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerUberObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerUberObjectTemplate.cpp @@ -87,7 +87,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_intListSimple.begin(); iter != m_intListSimple.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } } { @@ -95,7 +95,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_intListWeightedList.begin(); iter != m_intListWeightedList.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } } { @@ -103,7 +103,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_intListRandomRange.begin(); iter != m_intListRandomRange.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } } { @@ -111,7 +111,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_intListDiceRoll.begin(); iter != m_intListDiceRoll.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } } { @@ -119,7 +119,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_floatListSimple.begin(); iter != m_floatListSimple.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } } { @@ -127,7 +127,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_floatListWeightedList.begin(); iter != m_floatListWeightedList.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } } { @@ -135,7 +135,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_floatListRandomRange.begin(); iter != m_floatListRandomRange.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } } { @@ -143,7 +143,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_enumListIndexed.begin(); iter != m_enumListIndexed.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } } { @@ -151,7 +151,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_enumListWeightedList.begin(); iter != m_enumListWeightedList.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } } { @@ -159,7 +159,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_stringIdListSimple.begin(); iter != m_stringIdListSimple.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } } { @@ -167,7 +167,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_stringIdListWeightedList.begin(); iter != m_stringIdListWeightedList.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } } { @@ -175,7 +175,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_stringListSimple.begin(); iter != m_stringListSimple.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } } { @@ -183,7 +183,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_stringListWeightedList.begin(); iter != m_stringListWeightedList.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } } { @@ -191,7 +191,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_triggerVolumeList.begin(); iter != m_triggerVolumeList.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } } { @@ -199,7 +199,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_triggerVolumesListWeightedList.begin(); iter != m_triggerVolumesListWeightedList.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } } { @@ -207,7 +207,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_boolListDerived.begin(); iter != m_boolListDerived.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } } { @@ -215,7 +215,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_boolListSimple.begin(); iter != m_boolListSimple.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } } { @@ -223,7 +223,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_boolListWeightedList.begin(); iter != m_boolListWeightedList.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } } { @@ -231,7 +231,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_vectorListSimple.begin(); iter != m_vectorListSimple.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } } { @@ -239,7 +239,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_filenameListSimple.begin(); iter != m_filenameListSimple.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } } { @@ -247,7 +247,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_templateListSimple.begin(); iter != m_templateListSimple.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } } { @@ -255,7 +255,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_structListSimple.begin(); iter != m_structListSimple.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } } //@END TFD CLEANUP @@ -306,10 +306,10 @@ Tag ServerUberObjectTemplate::getTemplateVersion(void) const */ Tag ServerUberObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerUberObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerUberObjectTemplate::getHighestTemplateVersion @@ -323,9 +323,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_intAtDerived; } @@ -337,9 +337,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_intSimple; } @@ -351,9 +351,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_intSimpleDeltaPositive; } @@ -365,9 +365,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_intSimpleDeltaNegative; } @@ -379,9 +379,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_intSimpleDeltaPositivePercent; } @@ -393,9 +393,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_intSimpleDeltaNegativePercent; } @@ -407,9 +407,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_intWeightedList; } @@ -421,9 +421,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_intWeightedListDeltaPositive; } @@ -435,9 +435,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_intWeightedListDeltaNegative; } @@ -449,9 +449,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_intWeightedListDeltaPositivePercent; } @@ -463,9 +463,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_intWeightedListDeltaNegativePercent; } @@ -477,9 +477,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_intRandomRange1; } @@ -491,9 +491,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_intRandomRange2; } @@ -505,9 +505,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_intRandomRange3; } @@ -519,9 +519,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_intRandomRange4; } @@ -533,9 +533,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_intDiceRoll1; } @@ -547,9 +547,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_intDiceRoll2; } @@ -609,9 +609,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_enumIndexedByEnumSingle[index]; } @@ -623,9 +623,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_enumIndexedByEnumWeightedList[index]; } @@ -661,9 +661,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_integerArray[index]; } @@ -671,7 +671,7 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerUberObjectTemplate::getCompilerIntegerParam FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -682,9 +682,9 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_floatAtDerived; } @@ -696,9 +696,9 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_floatSimple; } @@ -710,9 +710,9 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_floatSimpleDeltaPositive; } @@ -724,9 +724,9 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_floatSimpleDeltaNegative; } @@ -738,9 +738,9 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_floatSimpleDeltaPositivePercent; } @@ -752,9 +752,9 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_floatSimpleDeltaNegativePercent; } @@ -766,9 +766,9 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_floatWeightedList; } @@ -780,9 +780,9 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_floatRandomRange1; } @@ -794,9 +794,9 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_floatRandomRange2; } @@ -808,9 +808,9 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_floatRandomRange3; } @@ -822,9 +822,9 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_floatRandomRange4; } @@ -872,9 +872,9 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_floatArray[index]; } @@ -882,7 +882,7 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep } else return TpfTemplate::getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerUberObjectTemplate::getFloatParam BoolParam * ServerUberObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) @@ -893,9 +893,9 @@ BoolParam * ServerUberObjectTemplate::getBoolParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_boolDerived; } @@ -907,9 +907,9 @@ BoolParam * ServerUberObjectTemplate::getBoolParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_boolSimple; } @@ -921,9 +921,9 @@ BoolParam * ServerUberObjectTemplate::getBoolParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_boolWeightedList; } @@ -971,9 +971,9 @@ BoolParam * ServerUberObjectTemplate::getBoolParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_boolArray[index]; } @@ -981,7 +981,7 @@ BoolParam * ServerUberObjectTemplate::getBoolParam(const char *name, bool deepCh } else return TpfTemplate::getBoolParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerUberObjectTemplate::getBoolParam StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) @@ -992,9 +992,9 @@ StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_stringDerived; } @@ -1006,9 +1006,9 @@ StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_stringSimple; } @@ -1020,9 +1020,9 @@ StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_stringWeightedList; } @@ -1058,9 +1058,9 @@ StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_filenameAtDerived; } @@ -1072,9 +1072,9 @@ StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_filenameSimple; } @@ -1086,9 +1086,9 @@ StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_filenameWeightedList; } @@ -1112,9 +1112,9 @@ StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_templateDerived; } @@ -1126,9 +1126,9 @@ StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_templateSimple; } @@ -1140,9 +1140,9 @@ StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_templateWeightedList; } @@ -1166,9 +1166,9 @@ StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_stringArray[index]; } @@ -1180,9 +1180,9 @@ StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_fileNameArray[index]; } @@ -1190,7 +1190,7 @@ StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool de } else return TpfTemplate::getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerUberObjectTemplate::getStringParam StringIdParam * ServerUberObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -1201,9 +1201,9 @@ StringIdParam * ServerUberObjectTemplate::getStringIdParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_stringIdDerived; } @@ -1215,9 +1215,9 @@ StringIdParam * ServerUberObjectTemplate::getStringIdParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_stringIdSimple; } @@ -1229,9 +1229,9 @@ StringIdParam * ServerUberObjectTemplate::getStringIdParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_stringIdWeightedList; } @@ -1267,9 +1267,9 @@ StringIdParam * ServerUberObjectTemplate::getStringIdParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_stringIdArray[index]; } @@ -1277,7 +1277,7 @@ StringIdParam * ServerUberObjectTemplate::getStringIdParam(const char *name, boo } else return TpfTemplate::getStringIdParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerUberObjectTemplate::getStringIdParam VectorParam * ServerUberObjectTemplate::getVectorParam(const char *name, bool deepCheck, int index) @@ -1288,9 +1288,9 @@ VectorParam * ServerUberObjectTemplate::getVectorParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getVectorParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_vectorAtDerived; } @@ -1302,9 +1302,9 @@ VectorParam * ServerUberObjectTemplate::getVectorParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getVectorParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_vectorSimple; } @@ -1328,9 +1328,9 @@ VectorParam * ServerUberObjectTemplate::getVectorParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getVectorParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_vectorArray[index]; } @@ -1338,7 +1338,7 @@ VectorParam * ServerUberObjectTemplate::getVectorParam(const char *name, bool de } else return TpfTemplate::getVectorParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerUberObjectTemplate::getVectorParam DynamicVariableParam * ServerUberObjectTemplate::getDynamicVariableParam(const char *name, bool deepCheck, int index) @@ -1349,9 +1349,9 @@ DynamicVariableParam * ServerUberObjectTemplate::getDynamicVariableParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getDynamicVariableParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_objvarDerived; } @@ -1363,9 +1363,9 @@ DynamicVariableParam * ServerUberObjectTemplate::getDynamicVariableParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getDynamicVariableParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_objvarSimple; } @@ -1373,7 +1373,7 @@ DynamicVariableParam * ServerUberObjectTemplate::getDynamicVariableParam(const c } else return TpfTemplate::getDynamicVariableParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerUberObjectTemplate::getDynamicVariableParam StructParamOT * ServerUberObjectTemplate::getStructParamOT(const char *name, bool deepCheck, int index) @@ -1384,9 +1384,9 @@ StructParamOT * ServerUberObjectTemplate::getStructParamOT(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStructParamOT(name, deepCheck, index); - return nullptr; + return NULL; } return &m_structAtDerived; } @@ -1398,9 +1398,9 @@ StructParamOT * ServerUberObjectTemplate::getStructParamOT(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStructParamOT(name, deepCheck, index); - return nullptr; + return NULL; } return &m_structSimple; } @@ -1424,9 +1424,9 @@ StructParamOT * ServerUberObjectTemplate::getStructParamOT(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStructParamOT(name, deepCheck, index); - return nullptr; + return NULL; } return &m_structArrayEnum[index]; } @@ -1438,9 +1438,9 @@ StructParamOT * ServerUberObjectTemplate::getStructParamOT(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStructParamOT(name, deepCheck, index); - return nullptr; + return NULL; } return &m_structArrayInteger[index]; } @@ -1448,7 +1448,7 @@ StructParamOT * ServerUberObjectTemplate::getStructParamOT(const char *name, boo } else return TpfTemplate::getStructParamOT(name, deepCheck, index); - return nullptr; + return NULL; } //ServerUberObjectTemplate::getStructParamOT TriggerVolumeParam * ServerUberObjectTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index) @@ -1459,9 +1459,9 @@ TriggerVolumeParam * ServerUberObjectTemplate::getTriggerVolumeParam(const char { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getTriggerVolumeParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_triggerVolumeDerived; } @@ -1473,9 +1473,9 @@ TriggerVolumeParam * ServerUberObjectTemplate::getTriggerVolumeParam(const char { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getTriggerVolumeParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_triggerVolumeSimple; } @@ -1487,9 +1487,9 @@ TriggerVolumeParam * ServerUberObjectTemplate::getTriggerVolumeParam(const char { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getTriggerVolumeParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_triggerVolumeWeightedList; } @@ -1525,9 +1525,9 @@ TriggerVolumeParam * ServerUberObjectTemplate::getTriggerVolumeParam(const char { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getTriggerVolumeParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_triggerArray[index]; } @@ -1535,7 +1535,7 @@ TriggerVolumeParam * ServerUberObjectTemplate::getTriggerVolumeParam(const char } else return TpfTemplate::getTriggerVolumeParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerUberObjectTemplate::getTriggerVolumeParam void ServerUberObjectTemplate::initStructParamOT(StructParamOT ¶m, const char *name) @@ -1942,12 +1942,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } @@ -2009,7 +2009,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_intListSimple.begin(); iter != m_intListSimple.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_intListSimpleAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2027,7 +2027,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_intListWeightedList.begin(); iter != m_intListWeightedList.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_intListWeightedListAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2045,7 +2045,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_intListRandomRange.begin(); iter != m_intListRandomRange.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_intListRandomRangeAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2063,7 +2063,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_intListDiceRoll.begin(); iter != m_intListDiceRoll.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_intListDiceRollAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2103,7 +2103,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_floatListSimple.begin(); iter != m_floatListSimple.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_floatListSimpleAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2121,7 +2121,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_floatListWeightedList.begin(); iter != m_floatListWeightedList.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_floatListWeightedListAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2139,7 +2139,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_floatListRandomRange.begin(); iter != m_floatListRandomRange.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_floatListRandomRangeAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2185,7 +2185,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_enumListIndexed.begin(); iter != m_enumListIndexed.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_enumListIndexedAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2203,7 +2203,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_enumListWeightedList.begin(); iter != m_enumListWeightedList.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_enumListWeightedListAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2227,7 +2227,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_stringIdListSimple.begin(); iter != m_stringIdListSimple.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_stringIdListSimpleAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2245,7 +2245,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_stringIdListWeightedList.begin(); iter != m_stringIdListWeightedList.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_stringIdListWeightedListAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2269,7 +2269,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_stringListSimple.begin(); iter != m_stringListSimple.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_stringListSimpleAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2287,7 +2287,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_stringListWeightedList.begin(); iter != m_stringListWeightedList.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_stringListWeightedListAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2311,7 +2311,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_triggerVolumeList.begin(); iter != m_triggerVolumeList.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_triggerVolumeListAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2329,7 +2329,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_triggerVolumesListWeightedList.begin(); iter != m_triggerVolumesListWeightedList.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_triggerVolumesListWeightedListAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2353,7 +2353,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_boolListDerived.begin(); iter != m_boolListDerived.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_boolListDerivedAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2371,7 +2371,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_boolListSimple.begin(); iter != m_boolListSimple.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_boolListSimpleAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2389,7 +2389,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_boolListWeightedList.begin(); iter != m_boolListWeightedList.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_boolListWeightedListAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2411,7 +2411,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_vectorListSimple.begin(); iter != m_vectorListSimple.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_vectorListSimpleAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2435,7 +2435,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_filenameListSimple.begin(); iter != m_filenameListSimple.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_filenameListSimpleAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2463,7 +2463,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_templateListSimple.begin(); iter != m_templateListSimple.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_templateListSimpleAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2485,7 +2485,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_structListSimple.begin(); iter != m_structListSimple.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_structListSimpleAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -3487,9 +3487,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::_Foo::getCompilerIntegerParam(c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_item1; } @@ -3497,7 +3497,7 @@ CompilerIntegerParam * ServerUberObjectTemplate::_Foo::getCompilerIntegerParam(c } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerUberObjectTemplate::_Foo::getCompilerIntegerParam FloatParam * ServerUberObjectTemplate::_Foo::getFloatParam(const char *name, bool deepCheck, int index) @@ -3508,9 +3508,9 @@ FloatParam * ServerUberObjectTemplate::_Foo::getFloatParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_item2; } @@ -3518,7 +3518,7 @@ FloatParam * ServerUberObjectTemplate::_Foo::getFloatParam(const char *name, boo } else return TpfTemplate::getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerUberObjectTemplate::_Foo::getFloatParam BoolParam * ServerUberObjectTemplate::_Foo::getBoolParam(const char *name, bool deepCheck, int index) @@ -3534,9 +3534,9 @@ StringParam * ServerUberObjectTemplate::_Foo::getStringParam(const char *name, b { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_item3; } @@ -3544,7 +3544,7 @@ StringParam * ServerUberObjectTemplate::_Foo::getStringParam(const char *name, b } else return TpfTemplate::getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerUberObjectTemplate::_Foo::getStringParam StringIdParam * ServerUberObjectTemplate::_Foo::getStringIdParam(const char *name, bool deepCheck, int index) diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerUniverseObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerUniverseObjectTemplate.cpp index 7f4176f1..359ddce6 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerUniverseObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerUniverseObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerUniverseObjectTemplate::getTemplateVersion(void) const */ Tag ServerUniverseObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerUniverseObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerUniverseObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerVehicleObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerVehicleObjectTemplate.cpp index e204aa23..663fdb2a 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerVehicleObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerVehicleObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerVehicleObjectTemplate::getTemplateVersion(void) const */ Tag ServerVehicleObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerVehicleObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerVehicleObjectTemplate::getHighestTemplateVersion @@ -108,9 +108,9 @@ FloatParam * ServerVehicleObjectTemplate::getFloatParam(const char *name, bool d { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_currentFuel; } @@ -122,9 +122,9 @@ FloatParam * ServerVehicleObjectTemplate::getFloatParam(const char *name, bool d { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_maxFuel; } @@ -136,9 +136,9 @@ FloatParam * ServerVehicleObjectTemplate::getFloatParam(const char *name, bool d { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_consumpsion; } @@ -146,7 +146,7 @@ FloatParam * ServerVehicleObjectTemplate::getFloatParam(const char *name, bool d } else return ServerTangibleObjectTemplate::getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerVehicleObjectTemplate::getFloatParam BoolParam * ServerVehicleObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) @@ -162,9 +162,9 @@ StringParam * ServerVehicleObjectTemplate::getStringParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_fuelType; } @@ -172,7 +172,7 @@ StringParam * ServerVehicleObjectTemplate::getStringParam(const char *name, bool } else return ServerTangibleObjectTemplate::getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerVehicleObjectTemplate::getStringParam StringIdParam * ServerVehicleObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -255,12 +255,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerWaypointObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerWaypointObjectTemplate.cpp index 23c83cd5..0cd323ea 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerWaypointObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerWaypointObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerWaypointObjectTemplate::getTemplateVersion(void) const */ Tag ServerWaypointObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerWaypointObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerWaypointObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerWeaponObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerWeaponObjectTemplate.cpp index 65775fd0..54aa2726 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerWeaponObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerWeaponObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerWeaponObjectTemplate::getTemplateVersion(void) const */ Tag ServerWeaponObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerWeaponObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerWeaponObjectTemplate::getHighestTemplateVersion @@ -103,9 +103,9 @@ CompilerIntegerParam * ServerWeaponObjectTemplate::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_weaponType; } @@ -117,9 +117,9 @@ CompilerIntegerParam * ServerWeaponObjectTemplate::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_attackType; } @@ -131,9 +131,9 @@ CompilerIntegerParam * ServerWeaponObjectTemplate::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_damageType; } @@ -145,9 +145,9 @@ CompilerIntegerParam * ServerWeaponObjectTemplate::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_elementalType; } @@ -159,9 +159,9 @@ CompilerIntegerParam * ServerWeaponObjectTemplate::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_elementalValue; } @@ -173,9 +173,9 @@ CompilerIntegerParam * ServerWeaponObjectTemplate::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_minDamageAmount; } @@ -187,9 +187,9 @@ CompilerIntegerParam * ServerWeaponObjectTemplate::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_maxDamageAmount; } @@ -201,9 +201,9 @@ CompilerIntegerParam * ServerWeaponObjectTemplate::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_attackCost; } @@ -215,9 +215,9 @@ CompilerIntegerParam * ServerWeaponObjectTemplate::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_accuracy; } @@ -225,7 +225,7 @@ CompilerIntegerParam * ServerWeaponObjectTemplate::getCompilerIntegerParam(const } else return ServerTangibleObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerWeaponObjectTemplate::getCompilerIntegerParam FloatParam * ServerWeaponObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -236,9 +236,9 @@ FloatParam * ServerWeaponObjectTemplate::getFloatParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_attackSpeed; } @@ -250,9 +250,9 @@ FloatParam * ServerWeaponObjectTemplate::getFloatParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_audibleRange; } @@ -264,9 +264,9 @@ FloatParam * ServerWeaponObjectTemplate::getFloatParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_minRange; } @@ -278,9 +278,9 @@ FloatParam * ServerWeaponObjectTemplate::getFloatParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_maxRange; } @@ -292,9 +292,9 @@ FloatParam * ServerWeaponObjectTemplate::getFloatParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_damageRadius; } @@ -306,9 +306,9 @@ FloatParam * ServerWeaponObjectTemplate::getFloatParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_woundChance; } @@ -316,7 +316,7 @@ FloatParam * ServerWeaponObjectTemplate::getFloatParam(const char *name, bool de } else return ServerTangibleObjectTemplate::getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } //ServerWeaponObjectTemplate::getFloatParam BoolParam * ServerWeaponObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) @@ -409,12 +409,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerXpManagerObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerXpManagerObjectTemplate.cpp index 0725fed2..b5969702 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerXpManagerObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerXpManagerObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerXpManagerObjectTemplate::getTemplateVersion(void) const */ Tag ServerXpManagerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerXpManagerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerXpManagerObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedBattlefieldMarkerObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedBattlefieldMarkerObjectTemplate.cpp index a5bd8fe4..21c891e3 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedBattlefieldMarkerObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedBattlefieldMarkerObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedBattlefieldMarkerObjectTemplate::getTemplateVersion(void) const */ Tag SharedBattlefieldMarkerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedBattlefieldMarkerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedBattlefieldMarkerObjectTemplate::getHighestTemplateVersion @@ -103,9 +103,9 @@ CompilerIntegerParam * SharedBattlefieldMarkerObjectTemplate::getCompilerInteger { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_numberOfPoles; } @@ -113,7 +113,7 @@ CompilerIntegerParam * SharedBattlefieldMarkerObjectTemplate::getCompilerInteger } else return SharedTangibleObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } //SharedBattlefieldMarkerObjectTemplate::getCompilerIntegerParam FloatParam * SharedBattlefieldMarkerObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -124,9 +124,9 @@ FloatParam * SharedBattlefieldMarkerObjectTemplate::getFloatParam(const char *na { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_radius; } @@ -134,7 +134,7 @@ FloatParam * SharedBattlefieldMarkerObjectTemplate::getFloatParam(const char *na } else return SharedTangibleObjectTemplate::getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } //SharedBattlefieldMarkerObjectTemplate::getFloatParam BoolParam * SharedBattlefieldMarkerObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) @@ -227,12 +227,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedBuildingObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedBuildingObjectTemplate.cpp index f4bba6f0..3af16bfb 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedBuildingObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedBuildingObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedBuildingObjectTemplate::getTemplateVersion(void) const */ Tag SharedBuildingObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedBuildingObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedBuildingObjectTemplate::getHighestTemplateVersion @@ -118,9 +118,9 @@ StringParam * SharedBuildingObjectTemplate::getStringParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_terrainModificationFileName; } @@ -132,9 +132,9 @@ StringParam * SharedBuildingObjectTemplate::getStringParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_interiorLayoutFileName; } @@ -142,7 +142,7 @@ StringParam * SharedBuildingObjectTemplate::getStringParam(const char *name, boo } else return SharedTangibleObjectTemplate::getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } //SharedBuildingObjectTemplate::getStringParam StringIdParam * SharedBuildingObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -225,12 +225,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedCellObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedCellObjectTemplate.cpp index 1a71a06d..7e96a950 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedCellObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedCellObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedCellObjectTemplate::getTemplateVersion(void) const */ Tag SharedCellObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedCellObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedCellObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedConstructionContractObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedConstructionContractObjectTemplate.cpp index 5c4b79e2..7426b7c1 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedConstructionContractObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedConstructionContractObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedConstructionContractObjectTemplate::getTemplateVersion(void) const */ Tag SharedConstructionContractObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedConstructionContractObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedConstructionContractObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedCreatureObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedCreatureObjectTemplate.cpp index e4034d22..913472e0 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedCreatureObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedCreatureObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedCreatureObjectTemplate::getTemplateVersion(void) const */ Tag SharedCreatureObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedCreatureObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedCreatureObjectTemplate::getHighestTemplateVersion @@ -103,9 +103,9 @@ CompilerIntegerParam * SharedCreatureObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_gender; } @@ -117,9 +117,9 @@ CompilerIntegerParam * SharedCreatureObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_niche; } @@ -131,9 +131,9 @@ CompilerIntegerParam * SharedCreatureObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_species; } @@ -145,9 +145,9 @@ CompilerIntegerParam * SharedCreatureObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_race; } @@ -155,7 +155,7 @@ CompilerIntegerParam * SharedCreatureObjectTemplate::getCompilerIntegerParam(con } else return SharedTangibleObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } //SharedCreatureObjectTemplate::getCompilerIntegerParam FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -166,9 +166,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_acceleration[index]; } @@ -180,9 +180,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_speed[index]; } @@ -194,9 +194,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_turnRate[index]; } @@ -208,9 +208,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_slopeModAngle; } @@ -222,9 +222,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_slopeModPercent; } @@ -236,9 +236,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_waterModPercent; } @@ -250,9 +250,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_stepHeight; } @@ -264,9 +264,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_collisionHeight; } @@ -278,9 +278,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_collisionRadius; } @@ -292,9 +292,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_swimHeight; } @@ -306,9 +306,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_warpTolerance; } @@ -320,9 +320,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_collisionOffsetX; } @@ -334,9 +334,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_collisionOffsetZ; } @@ -348,9 +348,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_collisionLength; } @@ -362,9 +362,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_cameraHeight; } @@ -372,7 +372,7 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool } else return SharedTangibleObjectTemplate::getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } //SharedCreatureObjectTemplate::getFloatParam BoolParam * SharedCreatureObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) @@ -383,9 +383,9 @@ BoolParam * SharedCreatureObjectTemplate::getBoolParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_postureAlignToTerrain[index]; } @@ -393,7 +393,7 @@ BoolParam * SharedCreatureObjectTemplate::getBoolParam(const char *name, bool de } else return SharedTangibleObjectTemplate::getBoolParam(name, deepCheck, index); - return nullptr; + return NULL; } //SharedCreatureObjectTemplate::getBoolParam StringParam * SharedCreatureObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) @@ -404,9 +404,9 @@ StringParam * SharedCreatureObjectTemplate::getStringParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_animationMapFilename; } @@ -418,9 +418,9 @@ StringParam * SharedCreatureObjectTemplate::getStringParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_movementDatatable; } @@ -428,7 +428,7 @@ StringParam * SharedCreatureObjectTemplate::getStringParam(const char *name, boo } else return SharedTangibleObjectTemplate::getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } //SharedCreatureObjectTemplate::getStringParam StringIdParam * SharedCreatureObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -528,12 +528,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedDraftSchematicObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedDraftSchematicObjectTemplate.cpp index 9c18023d..3f651ac8 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedDraftSchematicObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedDraftSchematicObjectTemplate.cpp @@ -47,7 +47,7 @@ SharedDraftSchematicObjectTemplate::~SharedDraftSchematicObjectTemplate() for (iter = m_slots.begin(); iter != m_slots.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_slots.clear(); } @@ -56,7 +56,7 @@ SharedDraftSchematicObjectTemplate::~SharedDraftSchematicObjectTemplate() for (iter = m_attributes.begin(); iter != m_attributes.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_attributes.clear(); } @@ -108,10 +108,10 @@ Tag SharedDraftSchematicObjectTemplate::getTemplateVersion(void) const */ Tag SharedDraftSchematicObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedDraftSchematicObjectTemplate::getHighestTemplateVersion @@ -140,9 +140,9 @@ StringParam * SharedDraftSchematicObjectTemplate::getStringParam(const char *nam { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_craftedSharedTemplate; } @@ -150,7 +150,7 @@ StringParam * SharedDraftSchematicObjectTemplate::getStringParam(const char *nam } else return SharedIntangibleObjectTemplate::getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } //SharedDraftSchematicObjectTemplate::getStringParam StringIdParam * SharedDraftSchematicObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -196,7 +196,7 @@ StructParamOT * SharedDraftSchematicObjectTemplate::getStructParamOT(const char } else return SharedIntangibleObjectTemplate::getStructParamOT(name, deepCheck, index); - return nullptr; + return NULL; } //SharedDraftSchematicObjectTemplate::getStructParamOT TriggerVolumeParam * SharedDraftSchematicObjectTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index) @@ -294,12 +294,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } @@ -327,7 +327,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_slots.begin(); iter != m_slots.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_slots.clear(); m_slotsAppend = file.read_bool8(); @@ -346,7 +346,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_attributes.begin(); iter != m_attributes.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_attributes.clear(); m_attributesAppend = file.read_bool8(); @@ -512,9 +512,9 @@ StringParam * SharedDraftSchematicObjectTemplate::_IngredientSlot::getStringPara { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_hardpoint; } @@ -522,7 +522,7 @@ StringParam * SharedDraftSchematicObjectTemplate::_IngredientSlot::getStringPara } else return TpfTemplate::getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } //SharedDraftSchematicObjectTemplate::_IngredientSlot::getStringParam StringIdParam * SharedDraftSchematicObjectTemplate::_IngredientSlot::getStringIdParam(const char *name, bool deepCheck, int index) @@ -533,9 +533,9 @@ StringIdParam * SharedDraftSchematicObjectTemplate::_IngredientSlot::getStringId { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_name; } @@ -543,7 +543,7 @@ StringIdParam * SharedDraftSchematicObjectTemplate::_IngredientSlot::getStringId } else return TpfTemplate::getStringIdParam(name, deepCheck, index); - return nullptr; + return NULL; } //SharedDraftSchematicObjectTemplate::_IngredientSlot::getStringIdParam VectorParam * SharedDraftSchematicObjectTemplate::_IngredientSlot::getVectorParam(const char *name, bool deepCheck, int index) @@ -717,9 +717,9 @@ CompilerIntegerParam * SharedDraftSchematicObjectTemplate::_SchematicAttribute:: { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_value; } @@ -727,7 +727,7 @@ CompilerIntegerParam * SharedDraftSchematicObjectTemplate::_SchematicAttribute:: } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } //SharedDraftSchematicObjectTemplate::_SchematicAttribute::getCompilerIntegerParam FloatParam * SharedDraftSchematicObjectTemplate::_SchematicAttribute::getFloatParam(const char *name, bool deepCheck, int index) @@ -753,9 +753,9 @@ StringIdParam * SharedDraftSchematicObjectTemplate::_SchematicAttribute::getStri { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_name; } @@ -767,9 +767,9 @@ StringIdParam * SharedDraftSchematicObjectTemplate::_SchematicAttribute::getStri { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_experiment; } @@ -777,7 +777,7 @@ StringIdParam * SharedDraftSchematicObjectTemplate::_SchematicAttribute::getStri } else return TpfTemplate::getStringIdParam(name, deepCheck, index); - return nullptr; + return NULL; } //SharedDraftSchematicObjectTemplate::_SchematicAttribute::getStringIdParam VectorParam * SharedDraftSchematicObjectTemplate::_SchematicAttribute::getVectorParam(const char *name, bool deepCheck, int index) diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedFactoryObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedFactoryObjectTemplate.cpp index 3088f935..e917394d 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedFactoryObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedFactoryObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedFactoryObjectTemplate::getTemplateVersion(void) const */ Tag SharedFactoryObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedFactoryObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedFactoryObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedGroupObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedGroupObjectTemplate.cpp index 6eecfb9e..a5bb8830 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedGroupObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedGroupObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedGroupObjectTemplate::getTemplateVersion(void) const */ Tag SharedGroupObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedGroupObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedGroupObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedGuildObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedGuildObjectTemplate.cpp index be710a73..26ba6d9a 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedGuildObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedGuildObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedGuildObjectTemplate::getTemplateVersion(void) const */ Tag SharedGuildObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedGuildObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedGuildObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedInstallationObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedInstallationObjectTemplate.cpp index 3b396c5a..70ae2f01 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedInstallationObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedInstallationObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedInstallationObjectTemplate::getTemplateVersion(void) const */ Tag SharedInstallationObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedInstallationObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedInstallationObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedIntangibleObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedIntangibleObjectTemplate.cpp index 077b284d..67245c19 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedIntangibleObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedIntangibleObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedIntangibleObjectTemplate::getTemplateVersion(void) const */ Tag SharedIntangibleObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedIntangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedIntangibleObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedJediManagerObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedJediManagerObjectTemplate.cpp index 66b0ddfa..0cce8f75 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedJediManagerObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedJediManagerObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedJediManagerObjectTemplate::getTemplateVersion(void) const */ Tag SharedJediManagerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedJediManagerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedJediManagerObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedManufactureSchematicObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedManufactureSchematicObjectTemplate.cpp index e1fa62c8..3b860316 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedManufactureSchematicObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedManufactureSchematicObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedManufactureSchematicObjectTemplate::getTemplateVersion(void) const */ Tag SharedManufactureSchematicObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedManufactureSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedManufactureSchematicObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedMissionObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedMissionObjectTemplate.cpp index 23330fc7..f52ed728 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedMissionObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedMissionObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedMissionObjectTemplate::getTemplateVersion(void) const */ Tag SharedMissionObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedMissionObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedMissionObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedObjectTemplate.cpp index 250ddd5c..ea1fa149 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedObjectTemplate::getTemplateVersion(void) const */ Tag SharedObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedObjectTemplate::getHighestTemplateVersion @@ -103,9 +103,9 @@ CompilerIntegerParam * SharedObjectTemplate::getCompilerIntegerParam(const char { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_containerType; } @@ -117,9 +117,9 @@ CompilerIntegerParam * SharedObjectTemplate::getCompilerIntegerParam(const char { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_containerVolumeLimit; } @@ -131,9 +131,9 @@ CompilerIntegerParam * SharedObjectTemplate::getCompilerIntegerParam(const char { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_gameObjectType; } @@ -145,9 +145,9 @@ CompilerIntegerParam * SharedObjectTemplate::getCompilerIntegerParam(const char { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_surfaceType; } @@ -155,7 +155,7 @@ CompilerIntegerParam * SharedObjectTemplate::getCompilerIntegerParam(const char } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } //SharedObjectTemplate::getCompilerIntegerParam FloatParam * SharedObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -166,9 +166,9 @@ FloatParam * SharedObjectTemplate::getFloatParam(const char *name, bool deepChec { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_scale; } @@ -180,9 +180,9 @@ FloatParam * SharedObjectTemplate::getFloatParam(const char *name, bool deepChec { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_scaleThresholdBeforeExtentTest; } @@ -194,9 +194,9 @@ FloatParam * SharedObjectTemplate::getFloatParam(const char *name, bool deepChec { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_clearFloraRadius; } @@ -208,9 +208,9 @@ FloatParam * SharedObjectTemplate::getFloatParam(const char *name, bool deepChec { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_noBuildRadius; } @@ -222,9 +222,9 @@ FloatParam * SharedObjectTemplate::getFloatParam(const char *name, bool deepChec { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_locationReservationRadius; } @@ -232,7 +232,7 @@ FloatParam * SharedObjectTemplate::getFloatParam(const char *name, bool deepChec } else return TpfTemplate::getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } //SharedObjectTemplate::getFloatParam BoolParam * SharedObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) @@ -243,9 +243,9 @@ BoolParam * SharedObjectTemplate::getBoolParam(const char *name, bool deepCheck, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_snapToTerrain; } @@ -257,9 +257,9 @@ BoolParam * SharedObjectTemplate::getBoolParam(const char *name, bool deepCheck, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_sendToClient; } @@ -271,9 +271,9 @@ BoolParam * SharedObjectTemplate::getBoolParam(const char *name, bool deepCheck, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_onlyVisibleInTools; } @@ -285,9 +285,9 @@ BoolParam * SharedObjectTemplate::getBoolParam(const char *name, bool deepCheck, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_forceNoCollision; } @@ -295,7 +295,7 @@ BoolParam * SharedObjectTemplate::getBoolParam(const char *name, bool deepCheck, } else return TpfTemplate::getBoolParam(name, deepCheck, index); - return nullptr; + return NULL; } //SharedObjectTemplate::getBoolParam StringParam * SharedObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) @@ -306,9 +306,9 @@ StringParam * SharedObjectTemplate::getStringParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_tintPalette; } @@ -320,9 +320,9 @@ StringParam * SharedObjectTemplate::getStringParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_slotDescriptorFilename; } @@ -334,9 +334,9 @@ StringParam * SharedObjectTemplate::getStringParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_arrangementDescriptorFilename; } @@ -348,9 +348,9 @@ StringParam * SharedObjectTemplate::getStringParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_appearanceFilename; } @@ -362,9 +362,9 @@ StringParam * SharedObjectTemplate::getStringParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_portalLayoutFilename; } @@ -376,9 +376,9 @@ StringParam * SharedObjectTemplate::getStringParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_clientDataFile; } @@ -386,7 +386,7 @@ StringParam * SharedObjectTemplate::getStringParam(const char *name, bool deepCh } else return TpfTemplate::getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } //SharedObjectTemplate::getStringParam StringIdParam * SharedObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -397,9 +397,9 @@ StringIdParam * SharedObjectTemplate::getStringIdParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_objectName; } @@ -411,9 +411,9 @@ StringIdParam * SharedObjectTemplate::getStringIdParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_detailedDescription; } @@ -425,9 +425,9 @@ StringIdParam * SharedObjectTemplate::getStringIdParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_lookAtText; } @@ -435,7 +435,7 @@ StringIdParam * SharedObjectTemplate::getStringIdParam(const char *name, bool de } else return TpfTemplate::getStringIdParam(name, deepCheck, index); - return nullptr; + return NULL; } //SharedObjectTemplate::getStringIdParam VectorParam * SharedObjectTemplate::getVectorParam(const char *name, bool deepCheck, int index) @@ -513,12 +513,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedPlayerObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedPlayerObjectTemplate.cpp index 5d99e4c9..b926fbb4 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedPlayerObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedPlayerObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedPlayerObjectTemplate::getTemplateVersion(void) const */ Tag SharedPlayerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedPlayerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedPlayerObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedPlayerQuestObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedPlayerQuestObjectTemplate.cpp index f3b04e88..b9ed644e 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedPlayerQuestObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedPlayerQuestObjectTemplate.cpp @@ -87,10 +87,10 @@ Tag SharedPlayerQuestObjectTemplate::getTemplateVersion(void) const */ Tag SharedPlayerQuestObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedPlayerQuestObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedPlayerQuestObjectTemplate::getHighestTemplateVersion @@ -196,12 +196,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedResourceContainerObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedResourceContainerObjectTemplate.cpp index 3ea96d3d..e77a29d6 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedResourceContainerObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedResourceContainerObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedResourceContainerObjectTemplate::getTemplateVersion(void) const */ Tag SharedResourceContainerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedResourceContainerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedResourceContainerObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedShipObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedShipObjectTemplate.cpp index d7705d97..25f8f375 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedShipObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedShipObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedShipObjectTemplate::getTemplateVersion(void) const */ Tag SharedShipObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedShipObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedShipObjectTemplate::getHighestTemplateVersion @@ -113,9 +113,9 @@ BoolParam * SharedShipObjectTemplate::getBoolParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_hasWings; } @@ -127,9 +127,9 @@ BoolParam * SharedShipObjectTemplate::getBoolParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_playerControlled; } @@ -137,7 +137,7 @@ BoolParam * SharedShipObjectTemplate::getBoolParam(const char *name, bool deepCh } else return SharedTangibleObjectTemplate::getBoolParam(name, deepCheck, index); - return nullptr; + return NULL; } //SharedShipObjectTemplate::getBoolParam StringParam * SharedShipObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) @@ -148,9 +148,9 @@ StringParam * SharedShipObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_cockpitFilename; } @@ -162,9 +162,9 @@ StringParam * SharedShipObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_interiorLayoutFileName; } @@ -172,7 +172,7 @@ StringParam * SharedShipObjectTemplate::getStringParam(const char *name, bool de } else return SharedTangibleObjectTemplate::getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } //SharedShipObjectTemplate::getStringParam StringIdParam * SharedShipObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -255,12 +255,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedStaticObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedStaticObjectTemplate.cpp index 19de68be..630e8239 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedStaticObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedStaticObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedStaticObjectTemplate::getTemplateVersion(void) const */ Tag SharedStaticObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedStaticObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedStaticObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedTangibleObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedTangibleObjectTemplate.cpp index 10a66071..3157fb24 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedTangibleObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedTangibleObjectTemplate.cpp @@ -55,7 +55,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() for (iter = m_paletteColorCustomizationVariables.begin(); iter != m_paletteColorCustomizationVariables.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_paletteColorCustomizationVariables.clear(); } @@ -64,7 +64,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() for (iter = m_rangedIntCustomizationVariables.begin(); iter != m_rangedIntCustomizationVariables.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_rangedIntCustomizationVariables.clear(); } @@ -73,7 +73,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() for (iter = m_constStringCustomizationVariables.begin(); iter != m_constStringCustomizationVariables.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_constStringCustomizationVariables.clear(); } @@ -82,7 +82,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() for (iter = m_socketDestinations.begin(); iter != m_socketDestinations.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_socketDestinations.clear(); } @@ -91,7 +91,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() for (iter = m_certificationsRequired.begin(); iter != m_certificationsRequired.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_certificationsRequired.clear(); } @@ -100,7 +100,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() for (iter = m_customizationVariableMapping.begin(); iter != m_customizationVariableMapping.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_customizationVariableMapping.clear(); } @@ -152,10 +152,10 @@ Tag SharedTangibleObjectTemplate::getTemplateVersion(void) const */ Tag SharedTangibleObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedTangibleObjectTemplate::getHighestTemplateVersion @@ -181,9 +181,9 @@ CompilerIntegerParam * SharedTangibleObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_clientVisabilityFlag; } @@ -191,7 +191,7 @@ CompilerIntegerParam * SharedTangibleObjectTemplate::getCompilerIntegerParam(con } else return SharedObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } //SharedTangibleObjectTemplate::getCompilerIntegerParam FloatParam * SharedTangibleObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -207,9 +207,9 @@ BoolParam * SharedTangibleObjectTemplate::getBoolParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_useStructureFootprintOutline; } @@ -221,9 +221,9 @@ BoolParam * SharedTangibleObjectTemplate::getBoolParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_targetable; } @@ -231,7 +231,7 @@ BoolParam * SharedTangibleObjectTemplate::getBoolParam(const char *name, bool de } else return SharedObjectTemplate::getBoolParam(name, deepCheck, index); - return nullptr; + return NULL; } //SharedTangibleObjectTemplate::getBoolParam StringParam * SharedTangibleObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) @@ -242,9 +242,9 @@ StringParam * SharedTangibleObjectTemplate::getStringParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_structureFootprintFileName; } @@ -264,7 +264,7 @@ StringParam * SharedTangibleObjectTemplate::getStringParam(const char *name, boo } else return SharedObjectTemplate::getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } //SharedTangibleObjectTemplate::getStringParam StringIdParam * SharedTangibleObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -334,7 +334,7 @@ StructParamOT * SharedTangibleObjectTemplate::getStructParamOT(const char *name, } else return SharedObjectTemplate::getStructParamOT(name, deepCheck, index); - return nullptr; + return NULL; } //SharedTangibleObjectTemplate::getStructParamOT TriggerVolumeParam * SharedTangibleObjectTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index) @@ -488,12 +488,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } @@ -521,7 +521,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_paletteColorCustomizationVariables.begin(); iter != m_paletteColorCustomizationVariables.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_paletteColorCustomizationVariables.clear(); m_paletteColorCustomizationVariablesAppend = file.read_bool8(); @@ -540,7 +540,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_rangedIntCustomizationVariables.begin(); iter != m_rangedIntCustomizationVariables.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_rangedIntCustomizationVariables.clear(); m_rangedIntCustomizationVariablesAppend = file.read_bool8(); @@ -559,7 +559,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_constStringCustomizationVariables.begin(); iter != m_constStringCustomizationVariables.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_constStringCustomizationVariables.clear(); m_constStringCustomizationVariablesAppend = file.read_bool8(); @@ -578,7 +578,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_socketDestinations.begin(); iter != m_socketDestinations.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_socketDestinations.clear(); m_socketDestinationsAppend = file.read_bool8(); @@ -603,7 +603,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_certificationsRequired.begin(); iter != m_certificationsRequired.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_certificationsRequired.clear(); m_certificationsRequiredAppend = file.read_bool8(); @@ -622,7 +622,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_customizationVariableMapping.begin(); iter != m_customizationVariableMapping.end(); ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } m_customizationVariableMapping.clear(); m_customizationVariableMappingAppend = file.read_bool8(); @@ -866,9 +866,9 @@ StringParam * SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::g { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_variableName; } @@ -880,9 +880,9 @@ StringParam * SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::g { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_constValue; } @@ -890,7 +890,7 @@ StringParam * SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::g } else return TpfTemplate::getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } //SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::getStringParam StringIdParam * SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::getStringIdParam(const char *name, bool deepCheck, int index) @@ -1084,9 +1084,9 @@ StringParam * SharedTangibleObjectTemplate::_CustomizationVariableMapping::getSt { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_sourceVariable; } @@ -1098,9 +1098,9 @@ StringParam * SharedTangibleObjectTemplate::_CustomizationVariableMapping::getSt { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_dependentVariable; } @@ -1108,7 +1108,7 @@ StringParam * SharedTangibleObjectTemplate::_CustomizationVariableMapping::getSt } else return TpfTemplate::getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } //SharedTangibleObjectTemplate::_CustomizationVariableMapping::getStringParam StringIdParam * SharedTangibleObjectTemplate::_CustomizationVariableMapping::getStringIdParam(const char *name, bool deepCheck, int index) @@ -1287,9 +1287,9 @@ CompilerIntegerParam * SharedTangibleObjectTemplate::_PaletteColorCustomizationV { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_defaultPaletteIndex; } @@ -1297,7 +1297,7 @@ CompilerIntegerParam * SharedTangibleObjectTemplate::_PaletteColorCustomizationV } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } //SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getCompilerIntegerParam FloatParam * SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getFloatParam(const char *name, bool deepCheck, int index) @@ -1318,9 +1318,9 @@ StringParam * SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable:: { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_variableName; } @@ -1332,9 +1332,9 @@ StringParam * SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable:: { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_palettePathName; } @@ -1342,7 +1342,7 @@ StringParam * SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable:: } else return TpfTemplate::getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } //SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getStringParam StringIdParam * SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getStringIdParam(const char *name, bool deepCheck, int index) @@ -1529,9 +1529,9 @@ CompilerIntegerParam * SharedTangibleObjectTemplate::_RangedIntCustomizationVari { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_minValueInclusive; } @@ -1543,9 +1543,9 @@ CompilerIntegerParam * SharedTangibleObjectTemplate::_RangedIntCustomizationVari { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_defaultValue; } @@ -1557,9 +1557,9 @@ CompilerIntegerParam * SharedTangibleObjectTemplate::_RangedIntCustomizationVari { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_maxValueExclusive; } @@ -1567,7 +1567,7 @@ CompilerIntegerParam * SharedTangibleObjectTemplate::_RangedIntCustomizationVari } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } //SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getCompilerIntegerParam FloatParam * SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getFloatParam(const char *name, bool deepCheck, int index) @@ -1588,9 +1588,9 @@ StringParam * SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::get { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_variableName; } @@ -1598,7 +1598,7 @@ StringParam * SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::get } else return TpfTemplate::getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } //SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getStringParam StringIdParam * SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getStringIdParam(const char *name, bool deepCheck, int index) diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedTerrainSurfaceObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedTerrainSurfaceObjectTemplate.cpp index aeaeff99..2eb61bd9 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedTerrainSurfaceObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedTerrainSurfaceObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedTerrainSurfaceObjectTemplate::getTemplateVersion(void) const */ Tag SharedTerrainSurfaceObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedTerrainSurfaceObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedTerrainSurfaceObjectTemplate::getHighestTemplateVersion @@ -108,9 +108,9 @@ FloatParam * SharedTerrainSurfaceObjectTemplate::getFloatParam(const char *name, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_cover; } @@ -118,7 +118,7 @@ FloatParam * SharedTerrainSurfaceObjectTemplate::getFloatParam(const char *name, } else return TpfTemplate::getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } //SharedTerrainSurfaceObjectTemplate::getFloatParam BoolParam * SharedTerrainSurfaceObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) @@ -134,9 +134,9 @@ StringParam * SharedTerrainSurfaceObjectTemplate::getStringParam(const char *nam { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_surfaceType; } @@ -144,7 +144,7 @@ StringParam * SharedTerrainSurfaceObjectTemplate::getStringParam(const char *nam } else return TpfTemplate::getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } //SharedTerrainSurfaceObjectTemplate::getStringParam StringIdParam * SharedTerrainSurfaceObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -227,12 +227,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedTokenObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedTokenObjectTemplate.cpp index 03f9ec94..cf352144 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedTokenObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedTokenObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedTokenObjectTemplate::getTemplateVersion(void) const */ Tag SharedTokenObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedTokenObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedTokenObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedUniverseObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedUniverseObjectTemplate.cpp index d429becf..62685a52 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedUniverseObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedUniverseObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedUniverseObjectTemplate::getTemplateVersion(void) const */ Tag SharedUniverseObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedUniverseObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedUniverseObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedVehicleObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedVehicleObjectTemplate.cpp index b1f83b74..ffa28bfb 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedVehicleObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedVehicleObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedVehicleObjectTemplate::getTemplateVersion(void) const */ Tag SharedVehicleObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedVehicleObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedVehicleObjectTemplate::getHighestTemplateVersion @@ -108,9 +108,9 @@ FloatParam * SharedVehicleObjectTemplate::getFloatParam(const char *name, bool d { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_speed[index]; } @@ -122,9 +122,9 @@ FloatParam * SharedVehicleObjectTemplate::getFloatParam(const char *name, bool d { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_slopeAversion; } @@ -136,9 +136,9 @@ FloatParam * SharedVehicleObjectTemplate::getFloatParam(const char *name, bool d { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_hoverValue; } @@ -150,9 +150,9 @@ FloatParam * SharedVehicleObjectTemplate::getFloatParam(const char *name, bool d { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_turnRate; } @@ -164,9 +164,9 @@ FloatParam * SharedVehicleObjectTemplate::getFloatParam(const char *name, bool d { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_maxVelocity; } @@ -178,9 +178,9 @@ FloatParam * SharedVehicleObjectTemplate::getFloatParam(const char *name, bool d { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_acceleration; } @@ -192,9 +192,9 @@ FloatParam * SharedVehicleObjectTemplate::getFloatParam(const char *name, bool d { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_braking; } @@ -202,7 +202,7 @@ FloatParam * SharedVehicleObjectTemplate::getFloatParam(const char *name, bool d } else return SharedTangibleObjectTemplate::getFloatParam(name, deepCheck, index); - return nullptr; + return NULL; } //SharedVehicleObjectTemplate::getFloatParam BoolParam * SharedVehicleObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) @@ -300,12 +300,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedWaypointObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedWaypointObjectTemplate.cpp index 69ad3053..b845d576 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedWaypointObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedWaypointObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedWaypointObjectTemplate::getTemplateVersion(void) const */ Tag SharedWaypointObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedWaypointObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedWaypointObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedWeaponObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedWeaponObjectTemplate.cpp index 690d160e..b6bf3e51 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedWeaponObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedWeaponObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedWeaponObjectTemplate::getTemplateVersion(void) const */ Tag SharedWeaponObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const SharedWeaponObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedWeaponObjectTemplate::getHighestTemplateVersion @@ -103,9 +103,9 @@ CompilerIntegerParam * SharedWeaponObjectTemplate::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_weaponEffectIndex; } @@ -117,9 +117,9 @@ CompilerIntegerParam * SharedWeaponObjectTemplate::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_attackType; } @@ -127,7 +127,7 @@ CompilerIntegerParam * SharedWeaponObjectTemplate::getCompilerIntegerParam(const } else return SharedTangibleObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return nullptr; + return NULL; } //SharedWeaponObjectTemplate::getCompilerIntegerParam FloatParam * SharedWeaponObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -148,9 +148,9 @@ StringParam * SharedWeaponObjectTemplate::getStringParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != nullptr) + if (getBaseTemplate() != NULL) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } return &m_weaponEffect; } @@ -158,7 +158,7 @@ StringParam * SharedWeaponObjectTemplate::getStringParam(const char *name, bool } else return SharedTangibleObjectTemplate::getStringParam(name, deepCheck, index); - return nullptr; + return NULL; } //SharedWeaponObjectTemplate::getStringParam StringIdParam * SharedWeaponObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -241,12 +241,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/File.cpp b/engine/shared/library/sharedTemplateDefinition/src/shared/core/File.cpp index 07755d95..d3b0322d 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/File.cpp +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/File.cpp @@ -19,7 +19,7 @@ // File static variables Filename File::m_basePath; -File::FunctionPtr File::m_callBack = nullptr; +File::FunctionPtr File::m_callBack = NULL; //======================================================================== // File functions @@ -49,7 +49,7 @@ bool File::open(const char *filename, const char *mode) // @todo: find an equivalent function for Linux m_fp = fopen(m_filename, mode); #endif - if (m_fp != nullptr) + if (m_fp != NULL) { m_currentLine = 0; return true; @@ -57,7 +57,7 @@ bool File::open(const char *filename, const char *mode) else { const char * errstr = strerror(errno); - if (errstr != nullptr) + if (errstr != NULL) { m_filename.clear(); printError(errstr); @@ -75,7 +75,7 @@ bool File::open(const char *filename, const char *mode) */ bool File::exists(const char *filename) { - if (filename == nullptr) + if (filename == NULL) return false; #if defined(WIN32) @@ -110,7 +110,7 @@ int File::readRawLine(char *buffer, int bufferSize) NOT_NULL(buffer); ++m_currentLine; - if (fgets(buffer, bufferSize, m_fp) == nullptr) + if (fgets(buffer, bufferSize, m_fp) == NULL) { if (feof(m_fp)) return -1; @@ -149,7 +149,7 @@ int File::readLine(char *buffer, int bufferSize) for (;;) { ++m_currentLine; - if (fgets(buffer, bufferSize, m_fp) == nullptr) + if (fgets(buffer, bufferSize, m_fp) == NULL) { if (feof(m_fp)) return -1; diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/File.h b/engine/shared/library/sharedTemplateDefinition/src/shared/core/File.h index c2292615..b8f655e6 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/File.h +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/File.h @@ -54,13 +54,13 @@ private: inline File::File(void) : - m_fp(nullptr), + m_fp(NULL), m_currentLine(0) { } // File::File(void) inline File::File(const char *filename, const char *mode) : - m_fp(nullptr), + m_fp(NULL), m_currentLine(0) { open(filename, mode); @@ -83,15 +83,15 @@ inline const Filename & File::getFilename(void) const inline bool File::isOpened(void) const { - return (m_fp != nullptr); + return (m_fp != NULL); } // File::isOpened inline void File::close(void) { - if (m_fp != nullptr) + if (m_fp != NULL) { fclose(m_fp); - m_fp = nullptr; + m_fp = NULL; } } // File::close @@ -110,7 +110,7 @@ inline void File::printWarning(const char *buffer) const fprintf(stderr, "%s", error); - if (m_callBack != nullptr) + if (m_callBack != NULL) { m_callBack(error); } @@ -125,7 +125,7 @@ inline void File::printError(const char *buffer) const fprintf(stderr, "%s", error); - if (m_callBack != nullptr) + if (m_callBack != NULL) { m_callBack(error); } diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/Filename.cpp b/engine/shared/library/sharedTemplateDefinition/src/shared/core/Filename.cpp index 1f329c77..82d85bfa 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/Filename.cpp +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/Filename.cpp @@ -39,7 +39,7 @@ const char PATH_SEPARATOR = LINUX_PATH_SEPARATOR; */ void Filename::setPath(const char *path) { - if (path == nullptr || *path == '\0') + if (path == NULL || *path == '\0') m_path.clear(); else { @@ -69,7 +69,7 @@ void Filename::setPath(const char *path) */ void Filename::setName(const char *name) { - if (name == nullptr || *name == '\0') + if (name == NULL || *name == '\0') m_name.clear(); else { @@ -85,7 +85,7 @@ void Filename::setName(const char *name) const char *dot = strrchr(localname.c_str(), '.'); const char *firstSeparator = strchr(localname.c_str(), PATH_SEPARATOR); const char *lastSeparator = strrchr(localname.c_str(), PATH_SEPARATOR); - if (firstSeparator != nullptr) + if (firstSeparator != NULL) { // name has a path if (firstSeparator == localname) @@ -100,11 +100,11 @@ void Filename::setName(const char *name) localname.c_str() + 1); } } - if (dot != nullptr && (lastSeparator == nullptr || dot > lastSeparator)) + if (dot != NULL && (lastSeparator == NULL || dot > lastSeparator)) { // name has an extension setExtension(dot); - if (lastSeparator == nullptr) + if (lastSeparator == NULL) m_name = std::string(localname.c_str(), dot - localname.c_str()); else m_name = std::string(lastSeparator + 1, dot - (lastSeparator + 1)); @@ -112,7 +112,7 @@ void Filename::setName(const char *name) else { // name doesn't have an extension - if (lastSeparator == nullptr) + if (lastSeparator == NULL) m_name = localname; else m_name = std::string(lastSeparator + 1); @@ -129,7 +129,7 @@ void Filename::setName(const char *name) */ void Filename::setExtension(const char *extension) { - if (extension == nullptr || *extension == '\0') + if (extension == NULL || *extension == '\0') m_extension.clear(); else { @@ -253,7 +253,7 @@ static const std::string PATH_SEPARATOR_STRING(PATH_SEPARATOR_BUFF); */ void Filename::setDrive(const char *drive) { - if (drive != nullptr && isalpha(*drive)) + if (drive != NULL && isalpha(*drive)) m_drive = std::string(drive, 1) + ":"; else m_drive.clear(); @@ -273,7 +273,7 @@ std::string path; #if defined(WIN32) char *pathBuf; - DWORD bufsize = GetFullPathName(getFullFilename().c_str(), 0, nullptr, nullptr); + DWORD bufsize = GetFullPathName(getFullFilename().c_str(), 0, NULL, NULL); if (bufsize != 0) { pathBuf = new char[bufsize + 1]; @@ -285,7 +285,7 @@ std::string path; } #elif defined(linux) char pathBuf[PATH_MAX]; - if (getcwd(pathBuf, PATH_MAX) != nullptr) + if (getcwd(pathBuf, PATH_MAX) != NULL) { strcat(pathBuf, "/"); strcat(pathBuf, getFullFilename().c_str()); @@ -306,19 +306,19 @@ void Filename::verifyAndCreatePath(void) const #if defined(WIN32) if (WindowsUnicode) { - char *buffer = nullptr; + char *buffer = NULL; DWORD buflen; // get our current path - buflen = GetFullPathName(".", 0, buffer, nullptr); + buflen = GetFullPathName(".", 0, buffer, NULL); buffer = new char[buflen + 1]; - buflen = GetFullPathName(".", buflen + 1, buffer, nullptr); + buflen = GetFullPathName(".", buflen + 1, buffer, NULL); Unicode::String srcPath = Unicode::narrowToWide(buffer); delete[] buffer; // get the destination path std::string correctPath(getDrive() + getPath()); - buflen = GetFullPathName(correctPath.c_str(), 0, buffer, nullptr); + buflen = GetFullPathName(correctPath.c_str(), 0, buffer, NULL); buffer = new char[buflen + 1]; - buflen = GetFullPathName(correctPath.c_str(), buflen + 1, buffer, nullptr); + buflen = GetFullPathName(correctPath.c_str(), buflen + 1, buffer, NULL); Unicode::String destPath = Unicode::narrowToWide(buffer); delete[] buffer; @@ -335,7 +335,7 @@ void Filename::verifyAndCreatePath(void) const destPath += splitDestPath[i]; if (SetCurrentDirectoryW((LPCWSTR)destPath.c_str()) == 0) { - if (CreateDirectoryW((LPCWSTR)destPath.c_str(), nullptr) == 0) + if (CreateDirectoryW((LPCWSTR)destPath.c_str(), NULL) == 0) return; if (SetCurrentDirectoryW((LPCWSTR)destPath.c_str()) == 0) return; @@ -347,19 +347,19 @@ void Filename::verifyAndCreatePath(void) const } else { - char *buffer = nullptr; + char *buffer = NULL; DWORD buflen; // get our current path - buflen = GetFullPathName(".", 0, buffer, nullptr); + buflen = GetFullPathName(".", 0, buffer, NULL); buffer = new char[buflen + 1]; - buflen = GetFullPathName(".", buflen + 1, buffer, nullptr); + buflen = GetFullPathName(".", buflen + 1, buffer, NULL); std::string srcPath = buffer; delete[] buffer; // get the destination path std::string correctPath(getDrive() + getPath()); - buflen = GetFullPathName(correctPath.c_str(), 0, buffer, nullptr); + buflen = GetFullPathName(correctPath.c_str(), 0, buffer, NULL); buffer = new char[buflen + 1]; - buflen = GetFullPathName(correctPath.c_str(), buflen + 1, buffer, nullptr); + buflen = GetFullPathName(correctPath.c_str(), buflen + 1, buffer, NULL); std::string destPath = buffer; delete[] buffer; @@ -378,7 +378,7 @@ void Filename::verifyAndCreatePath(void) const destPath += splitDestPath[i]; if (SetCurrentDirectory(destPath.c_str()) == 0) { - if (CreateDirectory(destPath.c_str(), nullptr) == 0) + if (CreateDirectory(destPath.c_str(), NULL) == 0) return; if (SetCurrentDirectory(destPath.c_str()) == 0) return; diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/Filename.h b/engine/shared/library/sharedTemplateDefinition/src/shared/core/Filename.h index a947e70d..62466a7a 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/Filename.h +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/Filename.h @@ -57,13 +57,13 @@ inline Filename::Filename(void) inline Filename::Filename(const char *drive, const char *path, const char *name, const char *extension) { - if (drive != nullptr) + if (drive != NULL) setDrive(drive); - if (path != nullptr) + if (path != NULL) setPath(path); - if (name != nullptr) + if (name != NULL) setName(name); - if (extension != nullptr) + if (extension != NULL) setExtension(extension); } // Filename::Filename @@ -115,7 +115,7 @@ inline void Filename::makeFullPath(void) //======================================================================== -const Filename NEXT_HIGHER_PATH(nullptr, "..", nullptr, nullptr); +const Filename NEXT_HIGHER_PATH(NULL, "..", NULL, NULL); #endif // _INCLUDED_Filename_H diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/ObjectTemplate.cpp b/engine/shared/library/sharedTemplateDefinition/src/shared/core/ObjectTemplate.cpp index 5492f6ec..42def7d2 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/ObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/ObjectTemplate.cpp @@ -16,8 +16,8 @@ //----------------------------------------------------------------- -template <> ObjectTemplateList::CreateDataResourceMap *ObjectTemplateList::ms_bindings = nullptr; -template <> ObjectTemplateList::LoadedDataResourceMap *ObjectTemplateList::ms_loaded = nullptr; +template <> ObjectTemplateList::CreateDataResourceMap *ObjectTemplateList::ms_bindings = NULL; +template <> ObjectTemplateList::LoadedDataResourceMap *ObjectTemplateList::ms_loaded = NULL; // ====================================================================== @@ -40,10 +40,10 @@ ObjectTemplate::ObjectTemplate(const std::string & filename) : ObjectTemplate::~ObjectTemplate(void) { - if (m_baseData != nullptr) + if (m_baseData != NULL) { m_baseData->releaseReference(); - m_baseData = nullptr; + m_baseData = NULL; } } @@ -63,7 +63,7 @@ void ObjectTemplate::load(Iff &iff) */ void ObjectTemplate::addReference(void) const { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->addReference(); DataResource::addReference(); @@ -76,7 +76,7 @@ void ObjectTemplate::addReference(void) const */ void ObjectTemplate::releaseReference(void) const { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); DataResource::releaseReference(); diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateData.cpp b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateData.cpp index 335347bc..a5974767 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateData.cpp +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateData.cpp @@ -52,8 +52,8 @@ static const bool HasMinMax[] = // map enum ParamType to access function return value static const char * const PaddedDataMethodNames[] = { - nullptr, - nullptr, + NULL, + NULL, "int ", "float ", "bool ", @@ -62,25 +62,25 @@ static const char * const PaddedDataMethodNames[] = "const Vector & ", "void ", "const ObjectTemplate *", - nullptr, - nullptr, + NULL, + NULL, "const TriggerVolumeData &", "const std::string & " }; static const char * const UnpaddedDataMethodNames[] = { - nullptr, - nullptr, + NULL, + NULL, "int", "float", "bool", "const std::string &", "const StringId", "const Vector &", - nullptr, + NULL, "const ObjectTemplate *", - nullptr, - nullptr, + NULL, + NULL, "const TriggerVolumeData &", "const std::string &" }; @@ -88,8 +88,8 @@ static const char * const UnpaddedDataMethodNames[] = // map enum ParamType to struct storage type static const char * const PaddedDataStructNames[] = { - nullptr, - nullptr, + NULL, + NULL, "int ", "float ", "bool ", @@ -98,15 +98,15 @@ static const char * const PaddedDataStructNames[] = "Vector ", "DynamicVariableList ", "const ObjectTemplate *", - nullptr, - nullptr, + NULL, + NULL, "TriggerVolumeData ", "std::string " }; static const char * const UnpaddedDataStructNames[] = { - nullptr, - nullptr, + NULL, + NULL, "int", "float", "bool", @@ -115,8 +115,8 @@ static const char * const UnpaddedDataStructNames[] = "Vector", "DynamicVariableList", "const ObjectTemplate *", - nullptr, - nullptr, + NULL, + NULL, "TriggerVolumeData", "std::string" }; @@ -160,8 +160,8 @@ static const char * const CompilerDataVariableNames[] = static const char * const DefaultDataReturnValue[] = { - nullptr, - nullptr, + NULL, + NULL, "0", "0.0f", "false", @@ -169,7 +169,7 @@ static const char * const DefaultDataReturnValue[] = "DefaultStringId", "DefaultVector", "", - "nullptr", + "NULL", "(0)", "", "DefaultTriggerVolumeData", @@ -217,7 +217,7 @@ static const char * const EnumLocationNames[] = */ TemplateData::TemplateData(int version, const TemplateDefinitionFile &parent) : m_fileParent(&parent), - m_templateParent(nullptr), + m_templateParent(NULL), m_hasTemplateParam(false), m_hasDynamicVarParam(false), m_hasList(false), @@ -228,9 +228,9 @@ TemplateData::TemplateData(int version, const TemplateDefinitionFile &parent) : m_parseState(STATE_PARAM), m_parameters(), m_parameterMap(), - m_currentEnumList(nullptr), + m_currentEnumList(NULL), m_enumMap(), - m_currentStruct(nullptr), + m_currentStruct(NULL), m_structMap(), m_structList() { @@ -252,7 +252,7 @@ TemplateData::TemplateData(int version, const TemplateDefinitionFile &parent) : * @param name the structure's name */ TemplateData::TemplateData(const TemplateData *parent, const std::string &name) : - m_fileParent(nullptr), + m_fileParent(NULL), m_templateParent(parent), m_hasTemplateParam(false), m_hasDynamicVarParam(false), @@ -265,9 +265,9 @@ TemplateData::TemplateData(const TemplateData *parent, const std::string &name) m_parseState(STATE_PARAM), m_parameters(), m_parameterMap(), - m_currentEnumList(nullptr), + m_currentEnumList(NULL), m_enumMap(), - m_currentStruct(nullptr), + m_currentStruct(NULL), m_structMap(), m_structList() { @@ -284,15 +284,15 @@ TemplateData::~TemplateData() for (iter = m_structMap.begin(); iter != m_structMap.end(); ++iter) { delete (*iter).second; - (*iter).second = nullptr; + (*iter).second = NULL; } m_parameterMap.clear(); m_parameters.clear(); m_structMap.clear(); m_structList.clear(); - m_currentEnumList = nullptr; - m_currentStruct = nullptr; + m_currentEnumList = NULL; + m_currentStruct = NULL; } // TemplateData::~TemplateData @@ -306,9 +306,9 @@ TemplateData::~TemplateData() */ const std::string TemplateData::getName(void) const { - if (m_fileParent != nullptr) + if (m_fileParent != NULL) return m_fileParent->getTemplateName(); - if (m_templateParent != nullptr) + if (m_templateParent != NULL) return m_templateParent->getName() + "::_" + m_name; return ""; } @@ -320,9 +320,9 @@ const std::string TemplateData::getName(void) const */ const std::string TemplateData::getBaseName(void) const { - if (m_fileParent != nullptr && !m_fileParent->getBaseName().empty()) + if (m_fileParent != NULL && !m_fileParent->getBaseName().empty()) return m_fileParent->getBaseName(); -// if (m_templateParent != nullptr) +// if (m_templateParent != NULL) return m_baseName; // return ""; } @@ -334,9 +334,9 @@ const std::string TemplateData::getBaseName(void) const */ TemplateLocation TemplateData::getTemplateLocation(void) const { - if (m_fileParent != nullptr) + if (m_fileParent != NULL) return m_fileParent->getTemplateLocation(); - if (m_templateParent != nullptr) + if (m_templateParent != NULL) return m_templateParent->getTemplateLocation(); return LOC_NONE; } // TemplateData::getTemplateLocation @@ -359,8 +359,8 @@ const char * TemplateData::parseLine(const File &fp, const char *buffer, { ParamState paramState = STATE_LIST; - if (buffer == nullptr || *buffer == '\0') - return nullptr; + if (buffer == NULL || *buffer == '\0') + return NULL; const char *line = buffer; @@ -413,7 +413,7 @@ ParamState paramState = STATE_LIST; return CHAR_ERROR; } const EnumList * enumList = getEnumList(tokenbuf, true); - if (enumList != nullptr) + if (enumList != NULL) { fp.printError("enum already defined"); return CHAR_ERROR; @@ -421,7 +421,7 @@ ParamState paramState = STATE_LIST; m_currentEnumList = &(*m_enumMap.insert(std::make_pair( std::string(tokenbuf), EnumList())).first).second; m_parseState = STATE_ENUM; - if (line != nullptr && *line != '\0') + if (line != NULL && *line != '\0') return parseEnum(fp, line, tokenbuf); return line; } @@ -455,7 +455,7 @@ ParamState paramState = STATE_LIST; m_structMap.insert(std::make_pair(tokenbuf, m_currentStruct)); m_structList.push_back(m_currentStruct); m_parseState = STATE_STRUCT; - if (line != nullptr && *line != '\0') + if (line != NULL && *line != '\0') return parseStruct(fp, line, tokenbuf); return line; } @@ -463,7 +463,7 @@ ParamState paramState = STATE_LIST; return CHAR_ERROR; } // if we are a structure, the 1st item should be the structure id - else if (strcmp(tokenbuf, "id") == 0 && m_templateParent != nullptr && + else if (strcmp(tokenbuf, "id") == 0 && m_templateParent != NULL && m_structId.tag == NO_TAG) { line = getNextToken(line, tokenbuf); @@ -479,7 +479,7 @@ ParamState paramState = STATE_LIST; } // if we are a structure, the 1st item should be the structure id - if (m_templateParent != nullptr && m_structId.tag == NO_TAG) + if (m_templateParent != NULL && m_structId.tag == NO_TAG) { fp.printError("struct id not defined"); return CHAR_ERROR; @@ -508,7 +508,7 @@ ParamState paramState = STATE_LIST; parameter.list_type = LIST_ENUM_ARRAY; parameter.enum_list_name = &tokenbuf[8]; const EnumList * list = getEnumList(parameter.enum_list_name.c_str(), false); - if (list == nullptr) + if (list == NULL) { fp.printError("enum name not defined!"); return CHAR_ERROR; @@ -592,7 +592,7 @@ ParamState paramState = STATE_LIST; { parameter.type = TYPE_ENUM; parameter.extendedName = &tokenbuf[4]; - if (getEnumList(&tokenbuf[4], false) == nullptr) + if (getEnumList(&tokenbuf[4], false) == NULL) { std::string errbuf = "enum type " + parameter.extendedName + " not defined"; @@ -605,7 +605,7 @@ ParamState paramState = STATE_LIST; { parameter.type = TYPE_STRUCT; parameter.extendedName = &tokenbuf[6]; - if (getStruct(&tokenbuf[6]) == nullptr) + if (getStruct(&tokenbuf[6]) == NULL) { std::string errbuf = "struct " + parameter.extendedName + " not defined"; @@ -640,12 +640,12 @@ ParamState paramState = STATE_LIST; tempToken = getNextToken(tempToken, tempBuf); if (parameter.type == TYPE_INTEGER) { - parameter.min_int_limit = strtol(tempBuf, nullptr, 10); + parameter.min_int_limit = strtol(tempBuf, NULL, 10); } else { parameter.min_float_limit = static_cast( - strtod(tempBuf, nullptr)); + strtod(tempBuf, NULL)); } } if (*tempToken == '.' && *(tempToken + 1) == '.') @@ -682,7 +682,7 @@ ParamState paramState = STATE_LIST; } // anything left over in the line is the parameter description - if (line != nullptr) + if (line != NULL) parameter.description = line; m_parameters.push_back(parameter); @@ -714,12 +714,12 @@ int TemplateData::getEnumValue(const char * enumValue) const } } - if (m_templateParent != nullptr) + if (m_templateParent != NULL) return m_templateParent->getEnumValue(enumValue); - if (m_fileParent != nullptr) + if (m_fileParent != NULL) { const TemplateDefinitionFile * baseFile = m_fileParent->getBaseDefinitionFile(); - if (baseFile != nullptr) + if (baseFile != NULL) { return baseFile->getTemplateData(baseFile->getHighestVersion())-> getEnumValue(enumValue); @@ -742,7 +742,7 @@ int TemplateData::getEnumValue(const std::string & enumType, NOT_NULL(enumValue); const EnumList *elist = getEnumList(enumType.c_str(), false); - if (elist == nullptr) + if (elist == NULL) return INVALID_ENUM_RESULT; EnumList::const_iterator listIter; for (listIter = elist->begin(); listIter != elist->end(); ++listIter) @@ -760,7 +760,7 @@ int TemplateData::getEnumValue(const std::string & enumType, * @param name the enum list name * @param define flag that we are defining templates and should not look in base templates * - * @return the enum list definition, or nullptr if not found + * @return the enum list definition, or NULL if not found */ const TemplateData::EnumList * TemplateData::getEnumList(const std::string & name, bool define) const @@ -768,17 +768,17 @@ const TemplateData::EnumList * TemplateData::getEnumList(const std::string & nam EnumMap::const_iterator iter = m_enumMap.find(name); if (iter != m_enumMap.end()) return &(*iter).second; - if (m_templateParent != nullptr) + if (m_templateParent != NULL) return m_templateParent->getEnumList(name, define); - if (!define && m_fileParent != nullptr && m_fileParent->getBaseDefinitionFile() != nullptr) + if (!define && m_fileParent != NULL && m_fileParent->getBaseDefinitionFile() != NULL) { const TemplateData * baseData = m_fileParent->getBaseDefinitionFile()-> getTemplateData(m_fileParent->getBaseDefinitionFile()-> getHighestVersion()); - if (baseData != nullptr) + if (baseData != NULL) return baseData->getEnumList(name, define); } - return nullptr; + return NULL; } // TemplateData::getEnumList /** @@ -787,7 +787,7 @@ const TemplateData::EnumList * TemplateData::getEnumList(const std::string & nam * * @param name the enum list name * - * @return the struct definition, or nullptr if not found + * @return the struct definition, or NULL if not found */ const TemplateData * TemplateData::getStruct(const char *name) const { @@ -796,23 +796,23 @@ const TemplateData * TemplateData::getStruct(const char *name) const StructMap::const_iterator iter = m_structMap.find(name); if (iter != m_structMap.end()) return (*iter).second; - if (m_templateParent != nullptr) + if (m_templateParent != NULL) return m_templateParent->getStruct(name); - if (m_fileParent != nullptr && m_fileParent->getBaseDefinitionFile() != nullptr) + if (m_fileParent != NULL && m_fileParent->getBaseDefinitionFile() != NULL) { const TemplateData * baseData = m_fileParent->getBaseDefinitionFile()-> getTemplateData(m_fileParent->getBaseDefinitionFile()-> getHighestVersion()); - if (baseData != nullptr) + if (baseData != NULL) return baseData->getStruct(name); } - return nullptr; + return NULL; } // TemplateData::getStruct /** * Returns the tdf file for this TemplateData * - * @return the TemplateDefinitionFile, or nullptr if not there + * @return the TemplateDefinitionFile, or NULL if not there */ const TemplateDefinitionFile * TemplateData::getTdf() const @@ -823,7 +823,7 @@ const TemplateDefinitionFile * TemplateData::getTdf() const /** * Returns the tdf file for this TemplateData's first ancestor * - * @return the TemplateDefinitionFile, or nullptr if not there + * @return the TemplateDefinitionFile, or NULL if not there */ const TemplateDefinitionFile * TemplateData::getTdfParent() const @@ -834,19 +834,19 @@ const TemplateDefinitionFile * TemplateData::getTdfParent() const } else { - return nullptr; + return NULL; } } /** * Returns the tdf file that contains the parameter * - * @return the TemplateDefinitionFile, or nullptr if not found + * @return the TemplateDefinitionFile, or NULL if not found */ const TemplateDefinitionFile * TemplateData::getTdfForParameter(const char *parameterName) const { - if(m_fileParent != nullptr) + if(m_fileParent != NULL) { if(getParameter(parameterName)) { @@ -855,18 +855,18 @@ const TemplateDefinitionFile * TemplateData::getTdfForParameter(const char *para const TemplateDefinitionFile* ancestorTemplateDefinitionFile = m_fileParent->getBaseDefinitionFile(); - if(ancestorTemplateDefinitionFile != nullptr) + if(ancestorTemplateDefinitionFile != NULL) { const TemplateData *ancestorTemplateData = ancestorTemplateDefinitionFile->getTemplateData(ancestorTemplateDefinitionFile->getHighestVersion()); - if(ancestorTemplateData != nullptr) + if(ancestorTemplateData != NULL) { return ancestorTemplateData->getTdfForParameter(parameterName); } } } - return nullptr; + return NULL; } /** @@ -883,7 +883,7 @@ int TemplateData::parseIntValue(const File &fp, const char * line, const char ** char * intbuf) const { NOT_NULL(endLine); - if (line == nullptr || *line == '\0' || intbuf == nullptr) + if (line == NULL || *line == '\0' || intbuf == NULL) { fp.printError("bad value passed to TemplateData::parseIntValue"); *endLine = CHAR_ERROR; @@ -920,7 +920,7 @@ int TemplateData::parseIntValue(const File &fp, const char * line, const char ** *endLine = CHAR_ERROR; return 0; } - if (tempLine != nullptr) + if (tempLine != NULL) line = tempLine; else line += strlen(line); @@ -954,8 +954,8 @@ int TemplateData::parseIntValue(const File &fp, const char * line, const char ** strncpy(intbuf, startLine, line - startLine); intbuf[line - startLine] = '\0'; intbuf += strlen(intbuf); - if (line != nullptr && *line == '\0') - *endLine = nullptr; + if (line != NULL && *line == '\0') + *endLine = NULL; else *endLine = line; @@ -1010,7 +1010,7 @@ const char * TemplateData::parseEnum(const File &fp, const char *buffer, if (m_bracketCount == 1) { m_bracketCount = 0; - m_currentEnumList = nullptr; + m_currentEnumList = NULL; m_parseState = STATE_PARAM; return line; } @@ -1023,7 +1023,7 @@ const char * TemplateData::parseEnum(const File &fp, const char *buffer, EnumData enumData; enumData.name = tokenbuf; - if (line != nullptr && *line == '=') + if (line != NULL && *line == '=') { line = getNextToken(line, tokenbuf); @@ -1054,12 +1054,12 @@ const char * TemplateData::parseEnum(const File &fp, const char *buffer, enumData.value = m_currentEnumList->back().value + 1; } - if (line != nullptr && *line == ',') + if (line != NULL && *line == ',') line = getNextToken(line, tokenbuf); - if (line != nullptr) + if (line != NULL) { enumData.comment = line; - line = nullptr; + line = NULL; } m_currentEnumList->push_back(enumData); @@ -1103,7 +1103,7 @@ const char * TemplateData::parseStruct(const File &fp, const char *buffer, if (m_bracketCount == 1) { m_bracketCount = 0; - m_currentStruct = nullptr; + m_currentStruct = NULL; m_parseState = STATE_PARAM; return line; } @@ -1194,7 +1194,7 @@ char buffer[256]; else if (param.list_type == LIST_ENUM_ARRAY) { const EnumList * enumList = getEnumList(param.enum_list_name, false); - FATAL(enumList == nullptr, ("Enum list %s missing", + FATAL(enumList == NULL, ("Enum list %s missing", param.enum_list_name.c_str())); sprintf(buffer, "missing parameter %s[%s] from section " "@class %s", param.name.c_str(), enumList->at(i).name.c_str(), @@ -1280,10 +1280,10 @@ void TemplateData::setWriteForCompiler(bool flag) */ void TemplateData::writeRegisterTemplate(File &fp, const char * leadInChars) const { - if (m_fileParent != nullptr) + if (m_fileParent != NULL) fp.print("%s\n", TDF_INSTALL_BEGIN); - if (leadInChars != nullptr) + if (leadInChars != NULL) fp.print("%s", leadInChars); fp.print("%s::registerMe();\n", getName().c_str()); @@ -1296,7 +1296,7 @@ void TemplateData::writeRegisterTemplate(File &fp, const char * leadInChars) con subStruct->writeRegisterTemplate(fp, leadInChars); } - if (m_fileParent != nullptr) + if (m_fileParent != NULL) fp.print("%s\n", TDF_INSTALL_END); } // TemplateData::writeRegisterTemplate @@ -1338,7 +1338,7 @@ std::vector paramStrings; paramStrings.push_back(param.enum_list_name + " index"); break; } - if (m_templateParent != nullptr) + if (m_templateParent != NULL) paramStrings.push_back("bool versionOk"); if (param.list_type == LIST_NONE) { @@ -1420,7 +1420,7 @@ void TemplateData::getTemplateNames(std::set &names) const else if (param.type == TYPE_STRUCT) { const TemplateData * structData = getStruct(param.extendedName.c_str()); - if (structData != nullptr) + if (structData != NULL) structData->getTemplateNames(names); } } @@ -1439,7 +1439,7 @@ void TemplateData::writeHeaderParams(File &fp) const return; } - if (m_fileParent != nullptr) + if (m_fileParent != NULL) fp.print("%s\n", TDF_BEGIN); writeHeaderEnums(fp); @@ -1447,7 +1447,7 @@ void TemplateData::writeHeaderParams(File &fp) const writeHeaderMethods(fp); writeHeaderVariables(fp); - if (m_fileParent != nullptr) + if (m_fileParent != NULL) fp.print("%s\n", TDF_END); } // TemplateData::writeHeaderParams @@ -1461,7 +1461,7 @@ void TemplateData::writeCompilerHeaderParams(File &fp) const { DEBUG_FATAL(!m_writeForCompilerFlag, ("write for compiler not enabled")); - if (m_fileParent != nullptr) + if (m_fileParent != NULL) fp.print("%s\n", TDF_BEGIN); writeHeaderEnums(fp); @@ -1469,7 +1469,7 @@ void TemplateData::writeCompilerHeaderParams(File &fp) const writeCompilerHeaderMethods(fp); writeHeaderVariables(fp); - if (m_fileParent != nullptr) + if (m_fileParent != NULL) fp.print("%s\n", TDF_END); } // TemplateData::writeCompilerHeaderParams @@ -1883,7 +1883,7 @@ ParameterList::const_iterator iter; case LIST_NONE: case LIST_INT_ARRAY: case LIST_ENUM_ARRAY: - if (PaddedDataStructNames[param.type] != nullptr) + if (PaddedDataStructNames[param.type] != NULL) { fp.print("\t\t%s %s", PaddedDataStructNames[param.type], param.name.c_str()); @@ -1904,7 +1904,7 @@ ParameterList::const_iterator iter; break; case LIST_LIST: fp.print("\t\tstdvector<"); - if (UnpaddedDataStructNames[param.type] != nullptr) + if (UnpaddedDataStructNames[param.type] != NULL) fp.print("%s", UnpaddedDataStructNames[param.type]); else if (param.type == TYPE_ENUM) fp.print("enum %s", param.extendedName.c_str()); @@ -1953,7 +1953,7 @@ void TemplateData::writeSourceLoadedFlagInit(File &fp) const { ParameterList::const_iterator iter; - if (m_fileParent != nullptr) + if (m_fileParent != NULL) fp.print("%s\n", TDF_INIT_BEGIN); fp.print("\t: %s(filename)\n", getBaseName().c_str()); @@ -1968,13 +1968,13 @@ ParameterList::const_iterator iter; fp.print("m_%sLoaded(false)\n", param.name.c_str()); fp.print("\t,m_%sAppend(false)\n", param.name.c_str()); } - if (m_templateParent == nullptr && !isWritingForCompiler()) + if (m_templateParent == NULL && !isWritingForCompiler()) { fp.print("\t,"); fp.print("m_versionOk(true)\n"); } - if (m_fileParent != nullptr) + if (m_fileParent != NULL) fp.print("%s\n", TDF_INIT_END); } // TemplateData::writeSourceLoadedFlagInit @@ -1985,7 +1985,7 @@ ParameterList::const_iterator iter; */ void TemplateData::writeSourceStructStart(File &fp) const { - if (m_templateParent == nullptr) + if (m_templateParent == NULL) return; const std::string & templateNameString = getName(); @@ -2051,7 +2051,7 @@ void TemplateData::writeSourceStructStart(File &fp, const std::string &name) con { ParameterList::const_iterator iter; - if (m_templateParent == nullptr || !m_hasTemplateParam) + if (m_templateParent == NULL || !m_hasTemplateParam) return; std::string className = m_templateParent->getName() + "::" + name; @@ -2079,18 +2079,18 @@ ParameterList::const_iterator iter; switch (param.list_type) { case LIST_NONE: - fp.print("\t%s = nullptr;\n", pname); + fp.print("\t%s = NULL;\n", pname); break; case LIST_INT_ARRAY: fp.print("\tfor (int i = 0; i < %d; ++i)\n", param.list_size); fp.print("\t{\n"); - fp.print("\t\t%s[i] = nullptr;\n", pname); + fp.print("\t\t%s[i] = NULL;\n", pname); fp.print("\t}\n"); break; case LIST_ENUM_ARRAY: fp.print("\tfor (int i = 0; i < %d; ++i)\n", param.list_size); fp.print("\t{\n"); - fp.print("\t\t%s[static_cast<%s>(i)] = nullptr;\n", pname, + fp.print("\t\t%s[static_cast<%s>(i)] = NULL;\n", pname, param.enum_list_name.c_str()); fp.print("\t}\n"); break; @@ -2134,14 +2134,14 @@ ParameterList::const_iterator iter; switch (param.list_type) { case LIST_NONE: - fp.print("\tif (%s != nullptr)\n", pname); + fp.print("\tif (%s != NULL)\n", pname); fp.print("\t\tconst_cast(%s)->addReference();\n", pname); break; case LIST_INT_ARRAY: fp.print("\tfor (int i = 0; i < %d; ++i)\n", param.list_size); fp.print("\t{\n"); - fp.print("\t\tif (%s[i] != nullptr)\n", pname); + fp.print("\t\tif (%s[i] != NULL)\n", pname); fp.print("\t\t\tconst_cast(%s[i])->addReference" "();\n", pname); fp.print("\t}\n"); @@ -2149,7 +2149,7 @@ ParameterList::const_iterator iter; case LIST_ENUM_ARRAY: fp.print("\tfor (int i = 0; i < %d; ++i)\n", param.list_size); fp.print("\t{\n"); - fp.print("\t\tif (%s[static_cast<%s>(i)] != nullptr)\n", pname, + fp.print("\t\tif (%s[static_cast<%s>(i)] != NULL)\n", pname, param.enum_list_name.c_str()); fp.print("\t\t\tconst_cast(%s[static_cast<%s>" "(i)])->addReference();\n", pname, param.enum_list_name.c_str()); @@ -2182,10 +2182,10 @@ ParameterList::const_iterator iter; switch (param.list_type) { case LIST_NONE: - fp.print("\tif (%s != nullptr)\n", pname); + fp.print("\tif (%s != NULL)\n", pname); fp.print("\t{\n"); fp.print("\t\t%s->releaseReference();\n", pname); - fp.print("\t\t%s = nullptr;\n", pname); + fp.print("\t\t%s = NULL;\n", pname); fp.print("\t}\n"); break; case LIST_LIST: @@ -2198,23 +2198,23 @@ ParameterList::const_iterator iter; else fp.print("\tfor (int i = 0; i < %d; ++i)\n", param.list_size); fp.print("\t{\n"); - fp.print("\t\tif (%s[i] != nullptr)\n", pname); + fp.print("\t\tif (%s[i] != NULL)\n", pname); fp.print("\t\t{\n"); fp.print("\t\t\t%s[i]->releaseReference();\n", pname); - fp.print("\t\t\t%s[i] = nullptr;\n", pname); + fp.print("\t\t\t%s[i] = NULL;\n", pname); fp.print("\t\t}\n"); fp.print("\t}\n"); break; case LIST_ENUM_ARRAY: fp.print("\tfor (int i = 0; i < %d; ++i)\n", param.list_size); fp.print("\t{\n"); - fp.print("\t\tif (%s[static_cast<%s>(i)] != nullptr)\n", pname, + fp.print("\t\tif (%s[static_cast<%s>(i)] != NULL)\n", pname, param.enum_list_name.c_str()); fp.print("\t\t{\n"); fp.print("\t\t\t%s[static_cast<%s>(i)]->releaseReference();\n", pname, param.enum_list_name.c_str()); - fp.print("\t\t\t%s[static_cast<%s>(i)] = nullptr;\n", pname, + fp.print("\t\t\t%s[static_cast<%s>(i)] = NULL;\n", pname, param.enum_list_name.c_str()); fp.print("\t\t}\n"); fp.print("\t}\n"); @@ -2259,7 +2259,7 @@ int result; return 0; } - if (m_fileParent != nullptr) + if (m_fileParent != NULL) fp.print("%s\n", TDF_BEGIN); result = writeSourceGetData(fp); @@ -2282,7 +2282,7 @@ int result; return result; } - if (m_fileParent != nullptr) + if (m_fileParent != NULL) fp.print("%s\n", TDF_END); return 0; } // TemplateData::writeSourceMethods @@ -2297,7 +2297,7 @@ void TemplateData::writeCompilerSourceMethods(File &fp) const { DEBUG_FATAL(!m_writeForCompilerFlag, ("write for compiler not enabled")); - if (m_fileParent != nullptr) + if (m_fileParent != NULL) fp.print("%s\n", TDF_BEGIN); writeCompilerSourceAccessMethods(fp); @@ -2314,7 +2314,7 @@ void TemplateData::writeCompilerSourceMethods(File &fp) const subStruct->writeCompilerSourceMethods(fp); } - if (m_fileParent != nullptr) + if (m_fileParent != NULL) fp.print("%s\n", TDF_END); } // TemplateData::writeCompilerSourceMethods @@ -2355,7 +2355,7 @@ void TemplateData::writeSourceReturnBaseValue(File &fp, const Parameter ¶m, } else if (param.list_type != LIST_NONE) indexString = "index"; - if (m_templateParent != nullptr) + if (m_templateParent != NULL) { if (!indexString.empty()) indexString += ", "; @@ -2372,10 +2372,10 @@ void TemplateData::writeSourceReturnBaseValue(File &fp, const Parameter ¶m, fp.print("\tif (!m_%s[index].isLoaded())\n", param.name.c_str()); fp.print("\t{\n"); - if (DefaultDataReturnValue[param.type] != nullptr) + if (DefaultDataReturnValue[param.type] != NULL) { fp.print("\t\tif (ms_allowDefaultTemplateParams && " - "/*!%s &&*/ base == nullptr)\n", m_templateParent == nullptr ? "m_versionOk" : + "/*!%s &&*/ base == NULL)\n", m_templateParent == NULL ? "m_versionOk" : "versionOk"); fp.print("\t\t{\n"); fp.print("\t\t\tDEBUG_WARNING(true, (\"Returning default value for " @@ -2391,7 +2391,7 @@ void TemplateData::writeSourceReturnBaseValue(File &fp, const Parameter ¶m, fp.print("\t\t}\n"); fp.print("\t\telse\n"); fp.print("\t\t{\n"); - fp.print("\t\t\tDEBUG_FATAL(base == nullptr, (\"Template parameter %s has " + fp.print("\t\t\tDEBUG_FATAL(base == NULL, (\"Template parameter %s has " "not been defined in template %%s!\", DataResource::getName()));\n", param.name.c_str()); if (DefaultDataReturnValue[param.type][0] != '\0') @@ -2419,7 +2419,7 @@ void TemplateData::writeSourceReturnBaseValue(File &fp, const Parameter ¶m, // we need to get the base value instead of ours if (param.list_type == LIST_LIST) { - fp.print("\tif (m_%sAppend && base != nullptr)\n", param.name.c_str()); + fp.print("\tif (m_%sAppend && base != NULL)\n", param.name.c_str()); fp.print("\t{\n"); fp.print("\t\tint baseCount = base->get%sCount();\n", upperName.c_str()); @@ -2505,21 +2505,21 @@ int result; fp.print("{\n"); fp.print("\tif (!m_%sLoaded)\n", pname); fp.print("\t{\n"); - fp.print("\t\tif (m_baseData == nullptr)\n"); + fp.print("\t\tif (m_baseData == NULL)\n"); fp.print("\t\t\treturn 0;\n"); fp.print("\t\tconst %s * base = dynamic_cast" "(m_baseData);\n", templateName, templateName); - fp.print("\t\tDEBUG_FATAL(base == nullptr, (\"base template wrong " + fp.print("\t\tDEBUG_FATAL(base == NULL, (\"base template wrong " "type\"));\n"); fp.print("\t\treturn base->get%sCount();\n", upperName.c_str()); fp.print("\t}\n\n"); fp.print("\tsize_t count = m_%s.size();\n\n", pname); fp.print("\t// if we are extending our base template, add it's count\n"); - fp.print("\tif (m_%sAppend && m_baseData != nullptr)\n", pname); + fp.print("\tif (m_%sAppend && m_baseData != NULL)\n", pname); fp.print("\t{\n"); fp.print("\t\tconst %s * base = dynamic_cast(m_baseData);\n", templateName, templateName); - fp.print("\t\tif (base != nullptr)\n"); + fp.print("\t\tif (base != NULL)\n"); fp.print("\t\t\tcount += base->get%sCount();\n", upperName.c_str()); fp.print("\t}\n\n"); fp.print("\treturn count;\n"); @@ -2582,7 +2582,7 @@ void TemplateData::writeSourceTestData(File &fp) const } } - if (m_fileParent != nullptr) + if (m_fileParent != NULL) { // check the base class if (!getBaseName().empty() && getBaseName() != ROOT_TEMPLATE_NAME) @@ -2631,18 +2631,18 @@ void TemplateData::writeSourceGetGeneric(File &fp, const Parameter ¶m) const fp.print("#endif\n\n"); } - fp.print("\tconst %s * base = nullptr;\n", templateName); - fp.print("\tif (m_baseData != nullptr)\n"); + fp.print("\tconst %s * base = NULL;\n", templateName); + fp.print("\tif (m_baseData != NULL)\n"); fp.print("\t{\n"); fp.print("\t\tbase = dynamic_cast(m_baseData);\n", templateName); -// fp.print("\t\tDEBUG_FATAL(base == nullptr, (\"base template wrong type\"));\n"); +// fp.print("\t\tDEBUG_FATAL(base == NULL, (\"base template wrong type\"));\n"); if (param.list_type == LIST_NONE) { // get the test base value fp.print("#ifdef _DEBUG\n"); - fp.print("\t\tif (testData && base != nullptr)\n"); + fp.print("\t\tif (testData && base != NULL)\n"); fp.print("\t\t\ttestDataValue = base->get%s%s(true);\n", upperName.c_str(), MinMaxNames[i]); fp.print("#endif\n"); @@ -2651,7 +2651,7 @@ void TemplateData::writeSourceGetGeneric(File &fp, const Parameter ¶m) const fp.print("\t}\n\n"); const char *arrayIndex = ""; - std::string indexName = m_templateParent == nullptr ? "" : "versionOk"; + std::string indexName = m_templateParent == NULL ? "" : "versionOk"; const char *access = "."; if (param.list_type == LIST_NONE) { @@ -2689,9 +2689,9 @@ void TemplateData::writeSourceGetGeneric(File &fp, const Parameter ¶m) const fp.print("\tif (delta == '+' || delta == '-' || delta == '_' || delta == '=')\n"); fp.print("\t{\n"); fp.print("\t\t%s baseValue = 0;\n", UnpaddedDataMethodNames[param.type]); - fp.print("\t\tif (m_baseData != nullptr)\n"); + fp.print("\t\tif (m_baseData != NULL)\n"); fp.print("\t\t{\n"); - fp.print("\t\t\tif (base != nullptr)\n"); + fp.print("\t\t\tif (base != NULL)\n"); fp.print("\t\t\t\tbaseValue = base->get%s%s(%s);\n", upperName.c_str(), MinMaxNames[i], indexName.c_str()); fp.print("\t\t\telse if (ms_allowDefaultTemplateParams)\n"); @@ -2716,7 +2716,7 @@ void TemplateData::writeSourceGetGeneric(File &fp, const Parameter ¶m) const { // check the return value vs the base value, and warn if the same fp.print("#ifdef _DEBUG\n"); - fp.print("\tif (testData && base != nullptr)\n"); + fp.print("\tif (testData && base != NULL)\n"); fp.print("\t{\n"); // fp.print("\t\tif (testDataValue == value)\n"); // fp.print("\t\t\tDEBUG_WARNING(true, (\"Template %%s, parameter %s is " @@ -2758,12 +2758,12 @@ void TemplateData::writeSourceGetVector(File &fp, const Parameter ¶m) const fp.print(") const\n"); fp.print("{\n"); - fp.print("\tconst %s * base = nullptr;\n", templateName); - fp.print("\tif (m_baseData != nullptr)\n"); + fp.print("\tconst %s * base = NULL;\n", templateName); + fp.print("\tif (m_baseData != NULL)\n"); fp.print("\t{\n"); fp.print("\t\tbase = dynamic_cast(m_baseData);\n", templateName); -// fp.print("\t\tDEBUG_FATAL(base == nullptr, (\"base template wrong type\"));\n"); +// fp.print("\t\tDEBUG_FATAL(base == NULL, (\"base template wrong type\"));\n"); fp.print("\t}\n\n"); const char *arrayIndex = ""; @@ -2820,18 +2820,18 @@ void TemplateData::writeSourceGetDynamicVariable(File &fp, const Parameter ¶ fp.print(") const\n"); fp.print("{\n"); - fp.print("\tconst %s * base = nullptr;\n", templateName); - fp.print("\tif (m_baseData != nullptr)\n"); + fp.print("\tconst %s * base = NULL;\n", templateName); + fp.print("\tif (m_baseData != NULL)\n"); fp.print("\t{\n"); fp.print("\t\tbase = dynamic_cast(m_baseData);\n", templateName); -// fp.print("\t\tDEBUG_FATAL(base == nullptr, (\"base template wrong type\"));\n"); +// fp.print("\t\tDEBUG_FATAL(base == NULL, (\"base template wrong type\"));\n"); fp.print("\t}\n\n"); if (param.list_type == LIST_NONE) { writeSourceReturnBaseValue(fp, param, ""); - fp.print("\tif (m_%s.isExtendingBaseList() && base != nullptr)\n", pname); + fp.print("\tif (m_%s.isExtendingBaseList() && base != NULL)\n", pname); fp.print("\t\tbase->get%s(list);\n", upperName.c_str()); fp.print("\tm_%s.getDynamicVariableList(list);\n", pname); } @@ -2840,7 +2840,7 @@ void TemplateData::writeSourceGetDynamicVariable(File &fp, const Parameter ¶ fp.print("\tDEBUG_FATAL(index < 0 || index >= %d, (\"" "template param index out of range\"));\n", param.list_size); writeSourceReturnBaseValue(fp, param, ""); - fp.print("\tif (m_%s[index].isExtendingBaseList() && base != nullptr)\n", pname); + fp.print("\tif (m_%s[index].isExtendingBaseList() && base != NULL)\n", pname); fp.print("\t\tbase->get%s(list, index);\n", upperName.c_str()); fp.print("\tm_%s[index].getDynamicVariableList(list);\n", pname); } @@ -2872,19 +2872,19 @@ void TemplateData::writeSourceGetTemplate(File &fp, const Parameter ¶m) cons fp.print(") const\n"); fp.print("{\n"); - fp.print("\tconst %s * base = nullptr;\n", templateName); - fp.print("\tif (m_baseData != nullptr)\n"); + fp.print("\tconst %s * base = NULL;\n", templateName); + fp.print("\tif (m_baseData != NULL)\n"); fp.print("\t{\n"); fp.print("\t\tbase = dynamic_cast(m_baseData);\n", templateName); -// fp.print("\t\tDEBUG_FATAL(base == nullptr, (\"base template wrong type\"));\n"); +// fp.print("\t\tDEBUG_FATAL(base == NULL, (\"base template wrong type\"));\n"); fp.print("\t}\n\n"); if (param.list_type == LIST_NONE) { writeSourceReturnBaseValue(fp, param, ""); - fp.print("\tconst %s%s * returnValue = nullptr;\n", + fp.print("\tconst %s%s * returnValue = NULL;\n", EnumLocationTypes[getTemplateLocation()], filenameLowerToUpper(param.extendedName).c_str()); fp.print("\tconst std::string & templateName = m_%s.getValue();\n", pname); @@ -2894,7 +2894,7 @@ void TemplateData::writeSourceGetTemplate(File &fp, const Parameter ¶m) cons "ObjectTemplateList::fetch(templateName));\n", EnumLocationTypes[getTemplateLocation()], filenameLowerToUpper(param.extendedName).c_str()); - fp.print("\t\tif (returnValue == nullptr)\n"); + fp.print("\t\tif (returnValue == NULL)\n"); fp.print("\t\t\tWARNING_STRICT_FATAL(true, (\"Error loading template %%s\"," "templateName.c_str()));\n"); fp.print("\t}\n"); @@ -2918,7 +2918,7 @@ void TemplateData::writeSourceGetTemplate(File &fp, const Parameter ¶m) cons writeSourceReturnBaseValue(fp, param, ""); } - fp.print("\tconst %s%s * returnValue = nullptr;\n", + fp.print("\tconst %s%s * returnValue = NULL;\n", EnumLocationTypes[getTemplateLocation()], filenameLowerToUpper(param.extendedName).c_str()); fp.print("\tconst std::string & templateName = m_%s[index]%sgetValue();\n", @@ -2929,7 +2929,7 @@ void TemplateData::writeSourceGetTemplate(File &fp, const Parameter ¶m) cons "ObjectTemplateList::fetch(templateName));\n", EnumLocationTypes[getTemplateLocation()], filenameLowerToUpper(param.extendedName).c_str()); - fp.print("\t\tif (returnValue == nullptr)\n"); + fp.print("\t\tif (returnValue == NULL)\n"); fp.print("\t\t\tWARNING_STRICT_FATAL(true, (\"Error loading template %%s\"," "templateName.c_str()));\n"); fp.print("\t}\n"); @@ -2974,17 +2974,17 @@ void TemplateData::writeSourceGetEnum(File &fp, const Parameter ¶m) const fp.print("#endif\n\n"); } - fp.print("\tconst %s * base = nullptr;\n", className); - fp.print("\tif (m_baseData != nullptr)\n"); + fp.print("\tconst %s * base = NULL;\n", className); + fp.print("\tif (m_baseData != NULL)\n"); fp.print("\t{\n"); fp.print("\t\tbase = dynamic_cast(m_baseData);\n", className); -// fp.print("\t\tDEBUG_FATAL(base == nullptr, (\"base template wrong type\"));\n"); +// fp.print("\t\tDEBUG_FATAL(base == NULL, (\"base template wrong type\"));\n"); if (param.list_type == LIST_NONE) { // get the test base value fp.print("#ifdef _DEBUG\n"); - fp.print("\t\tif (testData && base != nullptr)\n"); + fp.print("\t\tif (testData && base != NULL)\n"); fp.print("\t\t\ttestDataValue = base->get%s(true);\n", upperName.c_str()); fp.print("#endif\n"); } @@ -2999,7 +2999,7 @@ void TemplateData::writeSourceGetEnum(File &fp, const Parameter ¶m) const // check the return value vs the base value, and warn if the same fp.print("#ifdef _DEBUG\n"); - fp.print("\tif (testData && base != nullptr)\n"); + fp.print("\tif (testData && base != NULL)\n"); fp.print("\t{\n"); // fp.print("\t\tif (testDataValue == value)\n"); // fp.print("\t\t\tDEBUG_WARNING(true, (\"Template %%s, parameter %s is " @@ -3061,11 +3061,11 @@ std::string upperName; fp.print(") const\n"); fp.print("{\n"); - fp.print("\tconst %s * base = nullptr;\n", templateName); - fp.print("\tif (m_baseData != nullptr)\n"); + fp.print("\tconst %s * base = NULL;\n", templateName); + fp.print("\tif (m_baseData != NULL)\n"); fp.print("\t{\n"); fp.print("\t\tbase = dynamic_cast(m_baseData);\n", templateName); -// fp.print("\t\tDEBUG_FATAL(base == nullptr, (\"base template wrong type\"));\n"); +// fp.print("\t\tDEBUG_FATAL(base == NULL, (\"base template wrong type\"));\n"); fp.print("\t}\n\n"); if (param.list_type == LIST_NONE) @@ -3100,7 +3100,7 @@ std::string upperName; fp.print("\tNOT_NULL(param);\n"); const TemplateData *structData = getStruct(param.extendedName.c_str()); - if (structData == nullptr) + if (structData == NULL) { fprintf(stderr, "unable to find structure %s\n", param.extendedName.c_str()); @@ -3108,7 +3108,7 @@ std::string upperName; } std::string versionString = "versionOk"; - if (m_templateParent == nullptr) + if (m_templateParent == NULL) versionString = "m_" + versionString; structData->writeSourceGetStructAssignments(fp, versionString, MinMaxNames[i]); @@ -3248,7 +3248,7 @@ void TemplateData::writeSourceReadIff(File &fp) const fp.print("char paramName[MAX_NAME_SIZE];\n"); fp.print("\n"); - if (m_fileParent != nullptr) + if (m_fileParent != NULL) { // check that we are in our form fp.print("\tif (file.getCurrentName() != %s_tag)\n", @@ -3277,14 +3277,14 @@ void TemplateData::writeSourceReadIff(File &fp) const // fp.print("\t\t%s * mybase = dynamic_cast<%s *>(base);\n", // templateName, templateName); - // fp.print("\t\tFATAL(mybase == nullptr, (\"trying to derive a template from an incompatable template type\"));\n"); - fp.print("\t\tDEBUG_WARNING(base == nullptr, (\"was unable to load base template %%s\", baseFilename.c_str()));\n"); - fp.print("\t\tif (m_baseData == base && base != nullptr)\n"); + // fp.print("\t\tFATAL(mybase == NULL, (\"trying to derive a template from an incompatable template type\"));\n"); + fp.print("\t\tDEBUG_WARNING(base == NULL, (\"was unable to load base template %%s\", baseFilename.c_str()));\n"); + fp.print("\t\tif (m_baseData == base && base != NULL)\n"); fp.print("\t\t\tbase->releaseReference();\n"); fp.print("\t\telse\n"); fp.print("\t\t{\n"); - fp.print("\t\t\tif (m_baseData != nullptr)\n"); + fp.print("\t\t\tif (m_baseData != NULL)\n"); fp.print("\t\t\t\tm_baseData->releaseReference();\n"); fp.print("\t\t\tm_baseData = base;\n"); @@ -3356,7 +3356,7 @@ void TemplateData::writeSourceReadIff(File &fp) const " ++iter)\n", param.name.c_str(), param.name.c_str()); fp.print("\t\t\t{\n"); fp.print("\t\t\t\tdelete *iter;\n"); - fp.print("\t\t\t\t*iter = nullptr;\n"); + fp.print("\t\t\t\t*iter = NULL;\n"); fp.print("\t\t\t}\n"); fp.print("\t\t\tm_%s.clear();\n", param.name.c_str()); fp.print("\t\t\tm_%sAppend = file.read_bool8();\n", param.name.c_str()); @@ -3408,7 +3408,7 @@ void TemplateData::writeSourceReadIff(File &fp) const fp.print("\n"); fp.print("\tfile.exitForm();\n"); - if (m_fileParent != nullptr) + if (m_fileParent != NULL) { // enter the next form if (!baseNameString.empty() && baseNameString != ROOT_TEMPLATE_NAME) @@ -3450,7 +3450,7 @@ void TemplateData::writeSourceWriteIff(File &fp) const fp.print("int count;\n\n"); // write form enter header stuff - if (m_fileParent != nullptr) + if (m_fileParent != NULL) { fp.print("\tfile.insertForm(%s_tag);\n", m_fileParent->getTemplateName().c_str()); @@ -3552,7 +3552,7 @@ void TemplateData::writeSourceWriteIff(File &fp) const fp.print("\n"); fp.print("\tfile.exitForm(true);\n"); - if (m_fileParent != nullptr) + if (m_fileParent != NULL) { // call base class write iff method if (!getBaseName().empty() && getBaseName() != ROOT_TEMPLATE_NAME) @@ -3576,7 +3576,7 @@ void TemplateData::writeSourceWriteIff(File &fp) const */ void TemplateData::writeSourceCleanup(File &fp) const { - if (m_fileParent != nullptr) + if (m_fileParent != NULL) fp.print("%s\n", TDF_CLEANUP_BEGIN); const char * const * variableNames = DataVariableNames; @@ -3613,7 +3613,7 @@ void TemplateData::writeSourceCleanup(File &fp) const " ++iter)\n", param.name.c_str(), param.name.c_str()); fp.print("\t\t{\n"); fp.print("\t\t\tdelete *iter;\n"); - fp.print("\t\t\t*iter = nullptr;\n"); + fp.print("\t\t\t*iter = NULL;\n"); fp.print("\t\t}\n"); fp.print("\t\tm_%s.clear();\n", param.name.c_str()); fp.print("\t}\n"); @@ -3624,7 +3624,7 @@ void TemplateData::writeSourceCleanup(File &fp) const } } - if (m_fileParent != nullptr) + if (m_fileParent != NULL) fp.print("%s\n", TDF_CLEANUP_END); } // TemplateData::writeSourceCleanup @@ -3719,9 +3719,9 @@ ParameterList::const_iterator iter; fp.print("\t\t{\n"); fp.print("\t\t\tif (deepCheck && !isParamLoaded(name, false, 0))\n"); fp.print("\t\t\t{\n"); - fp.print("\t\t\t\tif (getBaseTemplate() != nullptr)\n"); + fp.print("\t\t\t\tif (getBaseTemplate() != NULL)\n"); fp.print("\t\t\t\t\treturn getBaseTemplate()->get%s(name, deepCheck, index);\n", FUNC_NAMES[i]); - fp.print("\t\t\t\treturn nullptr;\n"); + fp.print("\t\t\t\treturn NULL;\n"); fp.print("\t\t\t}\n"); fp.print("\t\t\treturn &m_%s;\n", pname); fp.print("\t\t}\n"); @@ -3751,9 +3751,9 @@ ParameterList::const_iterator iter; fp.print("\t\t{\n"); fp.print("\t\t\tif (deepCheck && !isParamLoaded(name, false, index))\n"); fp.print("\t\t\t{\n"); - fp.print("\t\t\t\tif (getBaseTemplate() != nullptr)\n"); + fp.print("\t\t\t\tif (getBaseTemplate() != NULL)\n"); fp.print("\t\t\t\t\treturn getBaseTemplate()->get%s(name, deepCheck, index);\n", FUNC_NAMES[i]); - fp.print("\t\t\t\treturn nullptr;\n"); + fp.print("\t\t\t\treturn NULL;\n"); fp.print("\t\t\t}\n"); fp.print("\t\t\treturn &m_%s[index];\n", pname); fp.print("\t\t}\n"); @@ -3774,7 +3774,7 @@ ParameterList::const_iterator iter; fp.print("\treturn %s::get%s(name, deepCheck, index);\n", baseName, FUNC_NAMES[i]); } if (paramCount != 0) - fp.print("\treturn nullptr;\n"); + fp.print("\treturn NULL;\n"); fp.print("}\t//%s::get%s\n", templateName, FUNC_NAMES[i]); fp.print("\n"); } @@ -4227,7 +4227,7 @@ void TemplateData::writeParameterDefault(File &fp, const Parameter ¶m, int i case LIST_ENUM_ARRAY: { const EnumList * enumList = getEnumList(param.enum_list_name, false); - DEBUG_FATAL(enumList == nullptr, ("unknown enum name %s", + DEBUG_FATAL(enumList == NULL, ("unknown enum name %s", param.enum_list_name.c_str())); if (index >= 0 && index < param.list_size) @@ -4288,7 +4288,7 @@ void TemplateData::writeStructParameterDefault(File &fp, const Parameter ¶m, case LIST_ENUM_ARRAY: { const EnumList * enumList = getEnumList(param.enum_list_name, false); - DEBUG_FATAL(enumList == nullptr, ("unknown enum name %s", + DEBUG_FATAL(enumList == NULL, ("unknown enum name %s", param.enum_list_name.c_str())); EnumList::const_iterator listIter; @@ -4357,7 +4357,7 @@ void TemplateData::writeDefaultValue(File &fp, const Parameter ¶m) const case TYPE_ENUM: { const EnumList * enumList = getEnumList(param.extendedName, false); - DEBUG_FATAL(enumList == nullptr, ("unknown enum name %s", + DEBUG_FATAL(enumList == NULL, ("unknown enum name %s", param.extendedName.c_str())); fp.print("%s", enumList->at(0).name.c_str()); } @@ -4398,7 +4398,7 @@ const TemplateData::Parameter *TemplateData::getParameter( { NOT_NULL(name); - TemplateData::Parameter const *result = nullptr; + TemplateData::Parameter const *result = NULL; // Shallow check, just checks this immediate tdf @@ -4414,7 +4414,7 @@ const TemplateData::Parameter *TemplateData::getParameter( const TemplateDefinitionFile *TemplateDefinitionFile = getTdfForParameter(name); - if (TemplateDefinitionFile != nullptr) + if (TemplateDefinitionFile != NULL) { result = TemplateDefinitionFile->getTemplateData(TemplateDefinitionFile->getHighestVersion())->getParameter(name); } diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateData.h b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateData.h index f7949388..cac38cd7 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateData.h +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateData.h @@ -238,11 +238,11 @@ inline bool TemplateData::isWritingForCompiler(void) const inline const TemplateDefinitionFile * TemplateData::getFileParent(void) const { - if (m_fileParent != nullptr) + if (m_fileParent != NULL) return m_fileParent; - if (m_templateParent != nullptr) + if (m_templateParent != NULL) return m_templateParent->getFileParent(); - return nullptr; + return NULL; } // TemplateData::getFileParent diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateDataIterator.cpp b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateDataIterator.cpp index 5a5c1c48..11b8d2dd 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateDataIterator.cpp +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateDataIterator.cpp @@ -25,7 +25,7 @@ //----------------------------------------------------------------------------- TemplateDataIterator::TemplateDataIterator() -: m_templateDataToIterate(nullptr), +: m_templateDataToIterate(NULL), m_numItems(0), m_noMoreData(true) { @@ -34,7 +34,7 @@ TemplateDataIterator::TemplateDataIterator() //----------------------------------------------------------------------------- TemplateDataIterator::TemplateDataIterator(const TemplateData& templateData) -: m_templateDataToIterate(nullptr), +: m_templateDataToIterate(NULL), m_numItems(0), m_noMoreData(true) { @@ -45,7 +45,7 @@ TemplateDataIterator::TemplateDataIterator(const TemplateData& templateData) TemplateDataIterator::~TemplateDataIterator() { - m_templateDataToIterate = nullptr; + m_templateDataToIterate = NULL; } //----------------------------------------------------------------------------- @@ -62,7 +62,7 @@ TemplateDataIterator::setTo(const TemplateData &templateData) // .. end at the child TDF's. const ParameterList* parameterListToAdd; - while(m_templateDataToIterate != nullptr) + while(m_templateDataToIterate != NULL) { parameterListToAdd = &(m_templateDataToIterate->m_parameters); m_numItems += parameterListToAdd->size(); @@ -75,23 +75,23 @@ TemplateDataIterator::setTo(const TemplateData &templateData) } // Get the template data from the parent TDF - if(m_templateDataToIterate->m_fileParent != nullptr) + if(m_templateDataToIterate->m_fileParent != NULL) { const TemplateDefinitionFile* parentFile = m_templateDataToIterate->m_fileParent->getBaseDefinitionFile(); - if(parentFile != nullptr) + if(parentFile != NULL) { m_templateDataToIterate = parentFile->getTemplateData(parentFile->getHighestVersion()); } else { - m_templateDataToIterate = nullptr; + m_templateDataToIterate = NULL; } } else { - m_templateDataToIterate = nullptr; + m_templateDataToIterate = NULL; } } @@ -164,7 +164,7 @@ TemplateDataIterator::operator *() const { if(this->end()) { - return nullptr; + return NULL; } else { diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateDefinitionFile.cpp b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateDefinitionFile.cpp index 4025ab5f..f191b3fb 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateDefinitionFile.cpp +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateDefinitionFile.cpp @@ -20,9 +20,9 @@ * Class constructor. */ TemplateDefinitionFile::TemplateDefinitionFile(void) : - m_baseDefinitionFile(nullptr), + m_baseDefinitionFile(NULL), m_writeForCompilerFlag(false), - m_filterCompiledRegex(nullptr) + m_filterCompiledRegex(NULL) { cleanup(); } // TemplateDefinitionFile::TemplateDefinitionFile @@ -51,24 +51,24 @@ void TemplateDefinitionFile::cleanup(void) m_compilerPath.clear(); m_fileComments.clear(); - if (m_baseDefinitionFile != nullptr) + if (m_baseDefinitionFile != NULL) { delete m_baseDefinitionFile; - m_baseDefinitionFile = nullptr; + m_baseDefinitionFile = NULL; } std::map::iterator iter; for (iter = m_templateMap.begin(); iter != m_templateMap.end(); ++iter) { delete (*iter).second; - (*iter).second = nullptr; + (*iter).second = NULL; } m_templateMap.clear(); - if (m_filterCompiledRegex != nullptr) + if (m_filterCompiledRegex != NULL) { RegexServices::freeMemory(m_filterCompiledRegex); - m_filterCompiledRegex = nullptr; + m_filterCompiledRegex = NULL; } } // TemplateDefinitionFile::cleanup @@ -104,7 +104,7 @@ static const std::string wildcard = "*"; if (!m_templateNameFilter.empty()) return m_templateNameFilter; - if (m_baseDefinitionFile != nullptr) + if (m_baseDefinitionFile != NULL) return m_baseDefinitionFile->getTemplateNameFilter(); return wildcard; @@ -121,7 +121,7 @@ bool TemplateDefinitionFile::isValidTemplateName(const Filename & name) const { if (m_templateNameFilter.empty()) { - if (m_baseDefinitionFile != nullptr) + if (m_baseDefinitionFile != NULL) return m_baseDefinitionFile->isValidTemplateName(name); else return true; @@ -131,7 +131,7 @@ bool TemplateDefinitionFile::isValidTemplateName(const Filename & name) const int const matchDataElementCount = maxCaptureCount * 3; int matchData[matchDataElementCount]; - int const matchCode = pcre_exec(m_filterCompiledRegex, nullptr, name.getName().c_str(), name.getName().length(), 0, 0, matchData, matchDataElementCount); + int const matchCode = pcre_exec(m_filterCompiledRegex, NULL, name.getName().c_str(), name.getName().length(), 0, 0, matchData, matchDataElementCount); bool const result = (matchCode >= 0); if (matchCode < -1) @@ -425,10 +425,10 @@ void TemplateDefinitionFile::writeClassSourceBegin(File &fp, const TemplateData fp.print(" */\n"); fp.print("Tag %s::getHighestTemplateVersion(void) const\n", name); fp.print("{\n"); - fp.print("\tif (m_baseData == nullptr)\n"); + fp.print("\tif (m_baseData == NULL)\n"); fp.print("\t\treturn m_templateVersion;\n"); fp.print("\tconst %s * base = dynamic_cast(m_baseData);\n", name, name); - fp.print("\tif (base == nullptr)\n"); + fp.print("\tif (base == NULL)\n"); fp.print("\t\treturn m_templateVersion;\n"); fp.print("\treturn std::max(m_templateVersion, base->getHighestTemplateVersion());\n"); fp.print("} // %s::getHighestTemplateVersion\n", name); @@ -449,7 +449,7 @@ static const int BUFFER_SIZE = 1024; int lineLen; char buffer[BUFFER_SIZE]; char token[BUFFER_SIZE]; -TemplateData *currentTemplate = nullptr; +TemplateData *currentTemplate = NULL; cleanup(); @@ -510,7 +510,7 @@ TemplateData *currentTemplate = nullptr; currentTemplate = new TemplateData(version, *this); m_templateMap[version] = currentTemplate; } - else if (currentTemplate != nullptr) + else if (currentTemplate != NULL) { line = currentTemplate->parseLine(fp, buffer, token); if (line == CHAR_ERROR) @@ -540,7 +540,7 @@ TemplateData *currentTemplate = nullptr; fp.printError("unable to open base template definition"); return -1; } - if (m_baseDefinitionFile == nullptr) + if (m_baseDefinitionFile == NULL) m_baseDefinitionFile = new TemplateDefinitionFile; else m_baseDefinitionFile->cleanup(); @@ -570,19 +570,19 @@ TemplateData *currentTemplate = nullptr; m_templateNameFilter = token; //-- Attempt to compile the regex. - if (m_filterCompiledRegex != nullptr) + if (m_filterCompiledRegex != NULL) { // First free the existing compiled regex. RegexServices::freeMemory(m_filterCompiledRegex); - m_filterCompiledRegex = nullptr; + m_filterCompiledRegex = NULL; } //-- Compile the new regex. - char const *errorString = nullptr; + char const *errorString = NULL; int errorOffset = 0; - m_filterCompiledRegex = pcre_compile(m_templateNameFilter.c_str(), 0, &errorString, &errorOffset, nullptr); - WARNING(m_filterCompiledRegex == nullptr, ("TemplateDefinitionFile::parse(): pcre_compile() failed, error=[%s], errorOffset=[%d], regex text=[%s].", errorString, errorOffset, m_templateNameFilter.c_str())); + m_filterCompiledRegex = pcre_compile(m_templateNameFilter.c_str(), 0, &errorString, &errorOffset, NULL); + WARNING(m_filterCompiledRegex == NULL, ("TemplateDefinitionFile::parse(): pcre_compile() failed, error=[%s], errorOffset=[%d], regex text=[%s].", errorString, errorOffset, m_templateNameFilter.c_str())); } else if (strcmp(token, "clientpath") == 0 || strcmp(token, "serverpath") == 0 || diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateDefinitionFile.h b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateDefinitionFile.h index 2ea426fc..82487e67 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateDefinitionFile.h +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateDefinitionFile.h @@ -111,7 +111,7 @@ inline TemplateData *TemplateDefinitionFile::getTemplateData(int version) const { std::map::const_iterator iter = m_templateMap.find(version); if (iter == m_templateMap.end()) - return nullptr; + return NULL; return (*iter).second; } diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateGlobals.cpp b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateGlobals.cpp index b12dc5ef..2b376aa0 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateGlobals.cpp +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateGlobals.cpp @@ -57,15 +57,15 @@ int strip(char *buffer) * the size of buffer * * @return the next non-whitespace character in the string after the token, or - * nullptr if the end of line has been reached + * NULL if the end of line has been reached */ const char *getNextWhitespaceToken(const char *buffer, char *token) { NOT_NULL(token); *token = '\0'; - if (buffer == nullptr) - return nullptr; + if (buffer == NULL) + return NULL; const char *from = buffer; char *to = token; @@ -74,7 +74,7 @@ const char *getNextWhitespaceToken(const char *buffer, char *token) while (isspace(*from) && *from != '\0') ++from; if (*from == '\0') - return nullptr; + return NULL; // copy the token while (!isspace(*from) && *from != '\0') @@ -85,7 +85,7 @@ const char *getNextWhitespaceToken(const char *buffer, char *token) while (isspace(*from) && *from != '\0') ++from; if (*from == '\0') - return nullptr; + return NULL; return from; } // getNextWhitespaceToken @@ -97,20 +97,20 @@ const char *getNextWhitespaceToken(const char *buffer, char *token) * the size of buffer * * @return the next token, defined by the 1st non-whitespace character in buffer: - * if it is '/' and the next character is '/', nullptr + * if it is '/' and the next character is '/', NULL * if it is a double-quote, the text until the next double quote (not including \") * if it is a symbol, the symbol * if it is a number, the next characters that make a valid integer or float * if it is a character, the text until the next whitespace or symbol, not including _ - * if it is nullptr, nullptr + * if it is NULL, NULL */ const char *getNextToken(const char *buffer, char *token) { NOT_NULL(token); *token = '\0'; - if (buffer == nullptr) - return nullptr; + if (buffer == NULL) + return NULL; const char *from = buffer; char *to = token; @@ -119,12 +119,12 @@ const char *getNextToken(const char *buffer, char *token) while (isspace(*from) && *from != '\0') ++from; if (*from == '\0') - return nullptr; + return NULL; if (*from == '/' && *(from+1) == '/') { // comment - return nullptr; + return NULL; } else if (isdigit(*from) || ((*from == '+' || *from == '-') && isdigit(*(from + 1))) @@ -173,7 +173,7 @@ const char *getNextToken(const char *buffer, char *token) while (isspace(*from) && *from != '\0') ++from; if (*from == '\0') - return nullptr; + return NULL; return from; } // getNextToken @@ -247,9 +247,9 @@ std::string filenameUpperToLower(const std::string & filename) std::string concatPaths(const char *path1, const char *path2) { // test for missing path - if (path1 == nullptr || *path1 == '\0') + if (path1 == NULL || *path1 == '\0') return path2; - if (path2 == nullptr || *path2 == '\0') + if (path2 == NULL || *path2 == '\0') return path1; #ifdef WIN32 @@ -286,7 +286,7 @@ std::string getNextHighestPath(const char *path) // find the two highest path separators const char *separator1 = strrchr(path, PATH_SEPARATOR); - if (separator1 == nullptr) + if (separator1 == NULL) { #ifdef WIN32 if (isalpha(*path) && *(path + 1) == ':') @@ -304,7 +304,7 @@ std::string getNextHighestPath(const char *path) return std::string(path, 3); #endif const char *separator2 = strrchr(separator1 - 1, PATH_SEPARATOR); - if (separator2 == nullptr) + if (separator2 == NULL) return std::string(path, separator1 - path); return std::string(path, separator2 - path); diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TpfFile.cpp b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TpfFile.cpp index 23b456d5..425bf716 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TpfFile.cpp +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TpfFile.cpp @@ -27,12 +27,12 @@ * Class constructor. */ TpfFile::TpfFile(void) : - m_template(nullptr), + m_template(NULL), m_baseTemplateName(), - m_currTemplateDef(nullptr), - m_templateData(nullptr), - m_highestTemplateData(nullptr), - m_parameter(nullptr), + m_currTemplateDef(NULL), + m_templateData(NULL), + m_highestTemplateData(NULL), + m_parameter(NULL), m_path(), m_iffPath(), m_templateLocation(LOC_NONE) @@ -53,14 +53,14 @@ TpfFile::~TpfFile() */ void TpfFile::cleanup(void) { - m_parameter = nullptr; + m_parameter = NULL; m_fp.close(); - if (m_template != nullptr) + if (m_template != NULL) { delete m_template; - m_template = nullptr; + m_template = NULL; } - m_currTemplateDef = nullptr; + m_currTemplateDef = NULL; IGNORE_RETURN(m_baseTemplateName.erase()); } // TpfFile::cleanup @@ -174,7 +174,7 @@ int TpfFile::loadTemplate(const Filename & filename) if (lineLen == -1) { // if we are a base template, check for missing parameters - if (m_highestTemplateData != nullptr && m_template != nullptr && + if (m_highestTemplateData != NULL && m_template != NULL && !m_highestTemplateData->verifyTemplate(m_template, m_fp)) { result = -1; @@ -190,7 +190,7 @@ int TpfFile::loadTemplate(const Filename & filename) // parse the 1st token: comment, @flag, or variable name const char *line = m_buffer; line = getNextToken(line, m_token); - if (*m_token == '\0' && line == nullptr) + if (*m_token == '\0' && line == NULL) { // empty line or comment continue; @@ -201,7 +201,7 @@ int TpfFile::loadTemplate(const Filename & filename) } else if (isalpha(*m_token)) { - if (m_template == nullptr) + if (m_template == NULL) { m_fp.printError("unable to parse parameters, no template class defined"); return -1; @@ -209,7 +209,7 @@ int TpfFile::loadTemplate(const Filename & filename) line = parseAssignment(line); if (line == CHAR_ERROR) result = -1; - else if (line != nullptr) + else if (line != NULL) { char buffer[1024]; if (getNextToken(line, buffer)) @@ -261,7 +261,7 @@ int TpfFile::makeIffFiles(const Filename & filename) if (result != 0) return result; - Filename iffname(nullptr, m_iffPath.c_str(), filename.getName().c_str(), + Filename iffname(NULL, m_iffPath.c_str(), filename.getName().c_str(), IFF_EXTENSION); Iff iffFile(1024, true, true); m_template->save(iffFile); @@ -291,20 +291,20 @@ int TpfFile::WriteIffFile(Iff & iffData, const Filename & fileName) { // there are problems with long path names in Windows that changing to // the directory seems to fix - char *buffer = nullptr; + char *buffer = NULL; DWORD buflen; // get our current path - buflen = GetFullPathName(".", 0, buffer, nullptr); + buflen = GetFullPathName(".", 0, buffer, NULL); buffer = new char[buflen + 1]; - buflen = GetFullPathName(".", buflen + 1, buffer, nullptr); + buflen = GetFullPathName(".", buflen + 1, buffer, NULL); Unicode::String srcPath = Unicode::narrowToWide(buffer); delete[] buffer; srcPath = L"\\\\?\\" + srcPath; // get the destination path std::string correctPath(fileName.getDrive() + fileName.getPath()); - buflen = GetFullPathName(correctPath.c_str(), 0, buffer, nullptr); + buflen = GetFullPathName(correctPath.c_str(), 0, buffer, NULL); buffer = new char[buflen + 1]; - buflen = GetFullPathName(correctPath.c_str(), buflen + 1, buffer, nullptr); + buflen = GetFullPathName(correctPath.c_str(), buflen + 1, buffer, NULL); Unicode::String destPath = Unicode::narrowToWide(buffer); delete[] buffer; destPath = L"\\\\?\\" + destPath; @@ -323,18 +323,18 @@ int TpfFile::WriteIffFile(Iff & iffData, const Filename & fileName) } else { - char *buffer = nullptr; + char *buffer = NULL; DWORD buflen; // get our current path - buflen = GetFullPathName(".", 0, buffer, nullptr); + buflen = GetFullPathName(".", 0, buffer, NULL); buffer = new char[buflen + 1]; - buflen = GetFullPathName(".", buflen + 1, buffer, nullptr); + buflen = GetFullPathName(".", buflen + 1, buffer, NULL); delete[] buffer; // get the destination path std::string correctPath(fileName.getDrive() + fileName.getPath()); - buflen = GetFullPathName(correctPath.c_str(), 0, buffer, nullptr); + buflen = GetFullPathName(correctPath.c_str(), 0, buffer, NULL); buffer = new char[buflen + 1]; - buflen = GetFullPathName(correctPath.c_str(), buflen + 1, buffer, nullptr); + buflen = GetFullPathName(correctPath.c_str(), buflen + 1, buffer, NULL); std::string destPath = buffer; delete[] buffer; // change to the destination path @@ -389,7 +389,7 @@ int result = 0; cleanup(); File temp_fp; - if (!temp_fp.open(tmpnam(nullptr), "wt")) + if (!temp_fp.open(tmpnam(NULL), "wt")) { fprintf(stderr, "error opening temp file for template replacement\n"); return -1; @@ -419,7 +419,7 @@ int result = 0; // parse the 1st token: comment, @flag, or variable name const char *line = m_buffer; line = getNextToken(line, m_token); - if (*m_token == '\0' && line == nullptr) + if (*m_token == '\0' && line == NULL) { // empty line or comment if (temp_fp.puts(m_buffer) < 0) @@ -432,7 +432,7 @@ int result = 0; { // @base or @class const char *templine = getNextToken(line, m_token); - if (templine == nullptr) + if (templine == NULL) { m_fp.printEolError(); return -1; @@ -452,7 +452,7 @@ int result = 0; else { // if we are a base template, check for missing parameters - if (m_highestTemplateData != nullptr && m_template != nullptr) + if (m_highestTemplateData != NULL && m_template != NULL) { m_highestTemplateData->updateTemplate(m_template, temp_fp); } @@ -462,7 +462,7 @@ int result = 0; else if (isalpha(*m_token)) { m_parameter = m_templateData->getParameter(m_token); - if (m_parameter == nullptr) + if (m_parameter == NULL) { } else @@ -494,14 +494,14 @@ int result = 0; int TpfFile::parseTemplateCommand(const char *line) { line = getNextToken(line, m_token); - if (line == nullptr) + if (line == NULL) { m_fp.printEolError(); return -1; } if (strcmp(m_token, "base") == 0) { - if (m_template != nullptr && !m_template->getBaseTemplateName().empty()) + if (m_template != NULL && !m_template->getBaseTemplateName().empty()) { m_fp.printError("base template already defined"); return -1; @@ -509,7 +509,7 @@ int TpfFile::parseTemplateCommand(const char *line) line = getNextWhitespaceToken(line, m_token); if (isalpha(*m_token)) { - if (m_template != nullptr) + if (m_template != NULL) { if (m_template->setBaseTemplateName(m_token) != 0) { @@ -536,7 +536,7 @@ int TpfFile::parseTemplateCommand(const char *line) { // if we are a base template, check for missing parameters // @todo: fix so we can verify non-base templates - if (m_highestTemplateData != nullptr && m_template != nullptr && + if (m_highestTemplateData != NULL && m_template != NULL && !m_highestTemplateData->verifyTemplate(m_template, m_fp)) { return -1; @@ -564,7 +564,7 @@ int TpfFile::parseTemplateCommand(const char *line) } int result = 0; - if(m_currTemplateDef == nullptr) + if(m_currTemplateDef == NULL) { result = m_templateDef.parse(fp); m_currTemplateDef = &m_templateDef; @@ -579,7 +579,7 @@ int TpfFile::parseTemplateCommand(const char *line) while(lookingForMatchingData) { - if(templateDataChild == nullptr) // DHERMAN Check here for template definition names not matching + if(templateDataChild == NULL) // DHERMAN Check here for template definition names not matching { char errbuf[256]; @@ -618,7 +618,7 @@ int TpfFile::parseTemplateCommand(const char *line) int version = static_cast(atol(m_token)); m_templateData = m_currTemplateDef->getTemplateData(version); - if (m_templateData == nullptr) + if (m_templateData == NULL) { char errbuf[256]; sprintf(errbuf, "can't find version %d in template definition %s", @@ -634,14 +634,14 @@ int TpfFile::parseTemplateCommand(const char *line) return -1; } - if (m_template == nullptr) + if (m_template == NULL) { // this is the highest class level, make a blank template // with it const TagInfo & templateId = m_currTemplateDef->getTemplateId(); m_template = dynamic_cast(TpfTemplate::createTemplate( templateId.tag)); - if (m_template == nullptr) + if (m_template == NULL) { m_fp.printError("Unable to create template class. May not be installed."); return -1; @@ -708,12 +708,12 @@ enum PARSE_ENUM_ASSIGNMENT, PARSE_ENUM_VALUE } parseState = PARSE_ENUM_TOKEN; -TemplateData::EnumList * enumList = nullptr; // current list being defined -TemplateData::EnumData * enumData = nullptr; // current item being defined +TemplateData::EnumList * enumList = NULL; // current list being defined +TemplateData::EnumData * enumData = NULL; // current item being defined int currentEnumValue = 0; File fp; - Filename headerFilename(nullptr, nullptr, headerName, nullptr); + Filename headerFilename(NULL, NULL, headerName, NULL); int i = 0; while (!fp.exists(headerFilename) && i < MAX_DIRECTORY_DEPTH) { @@ -744,7 +744,7 @@ int currentEnumValue = 0; } const char * line = m_buffer; - while (line != nullptr) + while (line != NULL) { const char * templine = getNextToken(line, m_token); switch (parseState) @@ -788,7 +788,7 @@ int currentEnumValue = 0; case PARSE_END_BRACKET : if (*m_token == '}') { - enumList = nullptr; + enumList = NULL; parseState = PARSE_ENUM_TOKEN; } else @@ -798,7 +798,7 @@ int currentEnumValue = 0; } break; case PARSE_ENUM_DEF: - if (isalpha(*m_token) && enumList != nullptr) + if (isalpha(*m_token) && enumList != NULL) { enumList->push_back(TemplateData::EnumData()); enumData = &enumList->back(); @@ -815,7 +815,7 @@ int currentEnumValue = 0; { enumData->value = currentEnumValue++; templine = line; - enumData = nullptr; + enumData = NULL; parseState = PARSE_END_BRACKET; } break; @@ -838,7 +838,7 @@ int currentEnumValue = 0; } currentEnumValue = (*iter).value; enumData->value = currentEnumValue++; - enumData = nullptr; + enumData = NULL; parseState = PARSE_END_BRACKET; } else @@ -895,7 +895,7 @@ const char * TpfFile::parseAssignment(const char *line) // get the parameter type info m_parameter = m_templateData->getParameter(m_token); - if (m_parameter == nullptr) + if (m_parameter == NULL) { std::string errmsg = "cannot find parameter "; errmsg += m_token; @@ -915,7 +915,7 @@ const char * TpfFile::parseAssignment(const char *line) m_fp.printError("non-array parameter being assigned as array"); return CHAR_ERROR; } - if (line == nullptr) + if (line == NULL) { // we need to read the next line to continue parsing line = goToNextLine(); @@ -943,7 +943,7 @@ const char * TpfFile::parseAssignment(const char *line) } // check for the ending ] line = getNextToken(line, m_token); - if (line == nullptr) + if (line == NULL) { m_fp.printEolError(); return CHAR_ERROR; @@ -954,13 +954,13 @@ const char * TpfFile::parseAssignment(const char *line) return CHAR_ERROR; } line = getNextToken(line, m_token); - if (line == nullptr) + if (line == NULL) { m_fp.printEolError(); return CHAR_ERROR; } } - else if (line == nullptr) + else if (line == NULL) { m_fp.printEolError(); return CHAR_ERROR; @@ -1038,7 +1038,7 @@ const char * TpfFile::parseAssignment(const char *line) * @param param template parameter * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or nullptr if at eol, or -1 if + * @return character in line where parsing stopped, or NULL if at eol, or -1 if * error */ const char * TpfFile::parseIntegerParameter(CompilerIntegerParam & param, const char *line) @@ -1064,7 +1064,7 @@ const char * TpfFile::parseIntegerParameter(CompilerIntegerParam & param, const if (line == CHAR_ERROR) return CHAR_ERROR; - if (line != nullptr && *line == 'd') + if (line != NULL && *line == 'd') { // rolling die int base = 0; @@ -1115,7 +1115,7 @@ const char * TpfFile::parseIntegerParameter(CompilerIntegerParam & param, const } param.setValue(num_dice, num_sides, base); } - else if (line != nullptr && *line == '.' && *(line+1) == '.') + else if (line != NULL && *line == '.' && *(line+1) == '.') { // range int min_value = value; @@ -1168,7 +1168,7 @@ const char * TpfFile::parseIntegerParameter(CompilerIntegerParam & param, const tempLine = m_token; char tempBuffer[64]; std::vector enumList; - while (tempLine != nullptr) + while (tempLine != NULL) { tempLine = getNextToken(tempLine, tempBuffer); if (isalpha(*tempBuffer)) @@ -1178,7 +1178,7 @@ const char * TpfFile::parseIntegerParameter(CompilerIntegerParam & param, const } } } - else if (*m_token == '.' && tempLine != nullptr && *tempLine == '.') + else if (*m_token == '.' && tempLine != NULL && *tempLine == '.') { // range with lower bound of INT_MIN line = tempLine + 1; @@ -1232,7 +1232,7 @@ const char * TpfFile::parseIntegerParameter(CompilerIntegerParam & param, const return CHAR_ERROR; } line = parseIntegerParameter(param, line); - if (line != nullptr && *line == '%') + if (line != NULL && *line == '%') { // % offset from base value line = getNextToken(line, m_token); @@ -1257,7 +1257,7 @@ const char * TpfFile::parseIntegerParameter(CompilerIntegerParam & param, const * @param param template parameter * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or nullptr if at eol, or -1 if + * @return character in line where parsing stopped, or NULL if at eol, or -1 if * error */ const char * TpfFile::parseFloatParameter(FloatParam & param, const char *line) @@ -1278,7 +1278,7 @@ const char * TpfFile::parseFloatParameter(FloatParam & param, const char *line) } else if (isfloat(m_token)) { - if (line != nullptr && *line == '.' && *(line+1) == '.') + if (line != NULL && *line == '.' && *(line+1) == '.') { // range float min_value = static_cast(atof(m_token)); @@ -1325,7 +1325,7 @@ const char * TpfFile::parseFloatParameter(FloatParam & param, const char *line) param.setValue(value); } } - else if (*m_token == '.' && line != nullptr && *line == '.') + else if (*m_token == '.' && line != NULL && *line == '.') { // range with lower bound of -FLT_MAX ++line; @@ -1378,7 +1378,7 @@ const char * TpfFile::parseFloatParameter(FloatParam & param, const char *line) return CHAR_ERROR; } line = parseFloatParameter(param, line); - if (line != nullptr && *line == '%') + if (line != NULL && *line == '%') { // % offset from base value line = getNextToken(line, m_token); @@ -1414,7 +1414,7 @@ const char * TpfFile::parseFloatParameter(FloatParam & param, const char *line) * @param param template parameter * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or nullptr if at eol, or -1 if + * @return character in line where parsing stopped, or NULL if at eol, or -1 if * error */ const char * TpfFile::parseBoolParameter(BoolParam & param, const char *line) @@ -1455,7 +1455,7 @@ const char * TpfFile::parseBoolParameter(BoolParam & param, const char *line) * @param param template parameter * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or nullptr if at eol, or -1 if + * @return character in line where parsing stopped, or NULL if at eol, or -1 if * error */ const char * TpfFile::parseStringParameter(StringParam & param, const char *line) @@ -1494,7 +1494,7 @@ const char * TpfFile::parseStringParameter(StringParam & param, const char *line * @param param template parameter * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or nullptr if at eol, or -1 if + * @return character in line where parsing stopped, or NULL if at eol, or -1 if * error */ const char * TpfFile::parseStringIdParameter(StringIdParam & param, const char *line) @@ -1530,7 +1530,7 @@ const char * TpfFile::parseStringIdParameter(StringIdParam & param, const char * * @param param template parameter * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or nullptr if at eol, or -1 if + * @return character in line where parsing stopped, or NULL if at eol, or -1 if * error */ const char * TpfFile::parseFilenameParameter(StringParam & param, const char *line) @@ -1586,7 +1586,7 @@ const char * TpfFile::parseFilenameParameter(StringParam & param, const char *li * @param param template parameter * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or nullptr if at eol, or -1 if + * @return character in line where parsing stopped, or NULL if at eol, or -1 if * error */ const char * TpfFile::parseVectorParameter(VectorParam & param, const char *line) @@ -1648,7 +1648,7 @@ const char * TpfFile::parseVectorParameter(VectorParam & param, const char *line * @param param template parameter * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or nullptr if at eol, or -1 if + * @return character in line where parsing stopped, or NULL if at eol, or -1 if * error */ const char * TpfFile::parseTemplateParameter(StringParam & param, const char *line) @@ -1662,7 +1662,7 @@ const char * TpfFile::parseTemplateParameter(StringParam & param, const char *li * @param param template parameter * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or nullptr if at eol, or -1 if + * @return character in line where parsing stopped, or NULL if at eol, or -1 if * error */ const char * TpfFile::parseEnumParameter(CompilerIntegerParam & param, const char *line) @@ -1707,7 +1707,7 @@ const char * TpfFile::parseEnumParameter(CompilerIntegerParam & param, const cha * @param param template parameter * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or nullptr if at eol, or -1 if + * @return character in line where parsing stopped, or NULL if at eol, or -1 if * error */ const char * TpfFile::parseDynamicVariableParameter(DynamicVariableParam & param, @@ -1731,7 +1731,7 @@ const char * TpfFile::parseDynamicVariableParameter(DynamicVariableParam & param if (*m_token == '+') { // extending an objevar list - if (m_template != nullptr && m_template->getBaseTemplateName().empty()) + if (m_template != NULL && m_template->getBaseTemplateName().empty()) { m_fp.printError("trying to extend an objvar list from a base template"); return CHAR_ERROR; @@ -1746,7 +1746,7 @@ const char * TpfFile::parseDynamicVariableParameter(DynamicVariableParam & param } else { - if (line == nullptr) + if (line == NULL) { // we need to read the next line to continue parsing line = goToNextLine(); @@ -1786,7 +1786,7 @@ const char * TpfFile::parseDynamicVariableParameter(DynamicVariableParam & param * @param param a DynamicVariableParamData containing an empty list * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or nullptr if at eol, or -1 if + * @return character in line where parsing stopped, or NULL if at eol, or -1 if * error */ const char * TpfFile::parseDynamicVariableParameterList( @@ -1797,7 +1797,7 @@ std::string name; NOT_NULL(line); if (data.m_type != DynamicVariableParamData::LIST || - data.m_data.lparam == nullptr) + data.m_data.lparam == NULL) { m_fp.printError("parse objvar list not given a list"); return CHAR_ERROR; @@ -1938,7 +1938,7 @@ std::string name; } else { - if (line == nullptr) + if (line == NULL) { // we need to read the next line to continue parsing line = goToNextLine(); @@ -1984,7 +1984,7 @@ std::string name; * @param param template parameter * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or nullptr if at eol, or -1 if + * @return character in line where parsing stopped, or NULL if at eol, or -1 if * error */ const char * TpfFile::parseStructParameter(StructParamOT & param, const char *line) @@ -2077,7 +2077,7 @@ const char * TpfFile::parseStructParameter(StructParamOT & param, const char *li * @param param template parameter * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or nullptr if at eol, or -1 if + * @return character in line where parsing stopped, or NULL if at eol, or -1 if * error */ const char * TpfFile::parseTriggerVolumeParameter(TriggerVolumeParam & param, @@ -2313,7 +2313,7 @@ Q * param; file.m_fp.printError("expected [ at start of list"); return CHAR_ERROR; } - if (line == nullptr) + if (line == NULL) { // we need to read the next line to continue parsing line = file.goToNextLine(); @@ -2339,7 +2339,7 @@ Q * param; // get the next parameters in the list param = (*getParamFunc)(*file.m_template, file.m_parameter->name, index); - if (param == nullptr) + if (param == NULL) { std::string errmsg = "cannot find parameter " + file.m_parameter->name; file.m_fp.printError(errmsg.c_str()); @@ -2385,7 +2385,7 @@ Q * param; arrayIndex = 0; param = (*getParamFunc)(*file.m_template, file.m_parameter->name, arrayIndex); - if (param == nullptr) + if (param == NULL) { // if the tpf version is less than the current version, print a // warning and ignore @@ -2396,7 +2396,7 @@ Q * param; " due to being removed from later version (need to update the " "template to the latest version)"; file.m_fp.printWarning(errmsg.c_str()); - return nullptr; + return NULL; } else { @@ -2434,7 +2434,7 @@ const char *parseWeightedList( for (;;) { VALUE value; - Q *valueParam = nullptr; + Q *valueParam = NULL; value.value = valueParam = new Q; list->push_back(value); VALUE *newValue = &list->back(); @@ -2505,7 +2505,7 @@ std::string TpfFile::getFileName() const const std::string & TpfFile::getBaseTemplateName() const { - if (m_template != nullptr) + if (m_template != NULL) return m_template->getBaseTemplateName(); return m_baseTemplateName; } diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TpfTemplate.cpp b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TpfTemplate.cpp index 2a0d76c0..3773bcfd 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TpfTemplate.cpp +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TpfTemplate.cpp @@ -21,9 +21,9 @@ */ TpfTemplate::TpfTemplate(const std::string & filename) : ObjectTemplate(filename), - m_parentFile(nullptr), + m_parentFile(NULL), m_baseTemplateName(), - m_baseTemplateFile(nullptr) + m_baseTemplateFile(NULL) { } // TpfTemplate::TpfTemplate @@ -32,12 +32,12 @@ TpfTemplate::TpfTemplate(const std::string & filename) : */ TpfTemplate::~TpfTemplate() { - m_parentFile = nullptr; + m_parentFile = NULL; m_baseTemplateName.clear(); - if (m_baseTemplateFile != nullptr) + if (m_baseTemplateFile != NULL) { delete m_baseTemplateFile; - m_baseTemplateFile = nullptr; + m_baseTemplateFile = NULL; } } // TpfTemplate::~TpfTemplate @@ -52,18 +52,18 @@ int TpfTemplate::setBaseTemplateName(const std::string & name) { m_baseTemplateName = name; - if (m_parentFile == nullptr) + if (m_parentFile == NULL) return -1; // load the base template - if (m_baseTemplateFile != nullptr) + if (m_baseTemplateFile != NULL) { delete m_baseTemplateFile; - m_baseTemplateFile = nullptr; + m_baseTemplateFile = NULL; } - Filename baseTemplateFileName(nullptr, nullptr, name.c_str(), TEMPLATE_EXTENSION); - Filename sourceTpfPath(nullptr, m_parentFile->getTpfPath().c_str(), nullptr, nullptr); + Filename baseTemplateFileName(NULL, NULL, name.c_str(), TEMPLATE_EXTENSION); + Filename sourceTpfPath(NULL, m_parentFile->getTpfPath().c_str(), NULL, NULL); Filename tempPath(baseTemplateFileName); tempPath.setPath(sourceTpfPath.getPath().c_str()); @@ -93,9 +93,9 @@ int TpfTemplate::setBaseTemplateName(const std::string & name) */ TpfTemplate * TpfTemplate::getBaseTemplate(void) const { - if (m_baseTemplateFile != nullptr) + if (m_baseTemplateFile != NULL) return m_baseTemplateFile->getTemplate(); - return nullptr; + return NULL; } // TpfTemplate::getBaseTemplate /** @@ -115,14 +115,14 @@ void TpfTemplate::save(Iff &file) * @param deepcheck flag to check base template if the parameter isn't loaded * @param index array index of the parameter * - * @return the parameter, or nullptr if not found + * @return the parameter, or NULL if not found */ CompilerIntegerParam *TpfTemplate::getCompilerIntegerParam(const char *name, bool deepCheck, int index) { UNREF(name); UNREF(deepCheck); UNREF(index); - return nullptr; + return NULL; } // TpfTemplate::getCompilerIntegerParam /** @@ -132,14 +132,14 @@ CompilerIntegerParam *TpfTemplate::getCompilerIntegerParam(const char *name, boo * @param deepcheck flag to check base template if the parameter isn't loaded * @param index array index of the parameter * - * @return the parameter, or nullptr if not found + * @return the parameter, or NULL if not found */ FloatParam *TpfTemplate::getFloatParam(const char *name, bool deepCheck, int index) { UNREF(name); UNREF(deepCheck); UNREF(index); - return nullptr; + return NULL; } // TpfTemplate::getFloatParam /** @@ -149,14 +149,14 @@ FloatParam *TpfTemplate::getFloatParam(const char *name, bool deepCheck, int ind * @param deepcheck flag to check base template if the parameter isn't loaded * @param index array index of the parameter * - * @return the parameter, or nullptr if not found + * @return the parameter, or NULL if not found */ BoolParam *TpfTemplate::getBoolParam(const char *name, bool deepCheck, int index) { UNREF(name); UNREF(deepCheck); UNREF(index); - return nullptr; + return NULL; } // TpfTemplate::getBoolParam /** @@ -166,14 +166,14 @@ BoolParam *TpfTemplate::getBoolParam(const char *name, bool deepCheck, int index * @param deepcheck flag to check base template if the parameter isn't loaded * @param index array index of the parameter * - * @return the parameter, or nullptr if not found + * @return the parameter, or NULL if not found */ StringParam *TpfTemplate::getStringParam(const char *name, bool deepCheck, int index) { UNREF(name); UNREF(deepCheck); UNREF(index); - return nullptr; + return NULL; } // TpfTemplate::getStringParam /** @@ -183,14 +183,14 @@ StringParam *TpfTemplate::getStringParam(const char *name, bool deepCheck, int i * @param deepcheck flag to check base template if the parameter isn't loaded * @param index array index of the parameter * - * @return the parameter, or nullptr if not found + * @return the parameter, or NULL if not found */ StringIdParam *TpfTemplate::getStringIdParam(const char *name, bool deepCheck, int index) { UNREF(name); UNREF(deepCheck); UNREF(index); - return nullptr; + return NULL; } // TpfTemplate::getStringIdParam /** @@ -200,14 +200,14 @@ StringIdParam *TpfTemplate::getStringIdParam(const char *name, bool deepCheck, i * @param deepcheck flag to check base template if the parameter isn't loaded * @param index array index of the parameter * - * @return the parameter, or nullptr if not found + * @return the parameter, or NULL if not found */ VectorParam *TpfTemplate::getVectorParam(const char *name, bool deepCheck, int index) { UNREF(name); UNREF(deepCheck); UNREF(index); - return nullptr; + return NULL; } // TpfTemplate::getVectorParam /** @@ -217,14 +217,14 @@ VectorParam *TpfTemplate::getVectorParam(const char *name, bool deepCheck, int i * @param deepcheck flag to check base template if the parameter isn't loaded * @param index array index of the parameter * - * @return the parameter, or nullptr if not found + * @return the parameter, or NULL if not found */ DynamicVariableParam *TpfTemplate::getDynamicVariableParam(const char *name, bool deepCheck, int index) { UNREF(name); UNREF(deepCheck); UNREF(index); - return nullptr; + return NULL; } // TpfTemplate::getDynamicVariableParam /** @@ -234,14 +234,14 @@ DynamicVariableParam *TpfTemplate::getDynamicVariableParam(const char *name, boo * @param deepcheck flag to check base template if the parameter isn't loaded * @param index array index of the parameter * - * @return the parameter, or nullptr if not found + * @return the parameter, or NULL if not found */ StructParamOT *TpfTemplate::getStructParamOT(const char *name, bool deepCheck, int index) { UNREF(name); UNREF(deepCheck); UNREF(index); - return nullptr; + return NULL; } // TpfTemplate::getStructParamOT /** @@ -251,14 +251,14 @@ StructParamOT *TpfTemplate::getStructParamOT(const char *name, bool deepCheck, i * @param deepcheck flag to check base template if the parameter isn't loaded * @param index array index of the parameter * - * @return the parameter, or nullptr if not found + * @return the parameter, or NULL if not found */ TriggerVolumeParam *TpfTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index) { UNREF(name); UNREF(deepCheck); UNREF(index); - return nullptr; + return NULL; } // TpfTemplate::getTriggerVolumeParam /** @@ -408,7 +408,7 @@ bool TpfTemplate::isParamLoadedLocal(const std::string &name, bool deepCheck) co { result = true; } - else if (deepCheck && getBaseTemplate() != nullptr) + else if (deepCheck && getBaseTemplate() != NULL) { result = getBaseTemplate()->isParamLoadedLocal(name); } @@ -433,7 +433,7 @@ bool TpfTemplate::isParamPureVirtualLocal(const std::string &name, bool deepChec { result = true; } - else if (deepCheck && (getBaseTemplate() != nullptr)) + else if (deepCheck && (getBaseTemplate() != NULL)) { result = getBaseTemplate()->isParamPureVirtualLocal(name); } diff --git a/engine/shared/library/sharedTerrain/src/shared/appearance/ProceduralTerrainAppearance.cpp b/engine/shared/library/sharedTerrain/src/shared/appearance/ProceduralTerrainAppearance.cpp index 3ffa961b..3aca2005 100755 --- a/engine/shared/library/sharedTerrain/src/shared/appearance/ProceduralTerrainAppearance.cpp +++ b/engine/shared/library/sharedTerrain/src/shared/appearance/ProceduralTerrainAppearance.cpp @@ -803,7 +803,7 @@ TerrainGeneratorWaterType ProceduralTerrainAppearance::getWaterType (const Vecto bool ProceduralTerrainAppearance::getWater (const int chunkX, const int chunkZ) const { - if (proceduralTerrainAppearanceTemplate->getBakedTerrain () != nullptr) + if (proceduralTerrainAppearanceTemplate->getBakedTerrain () != NULL) return proceduralTerrainAppearanceTemplate->getBakedTerrain ()->getWater (chunkX, chunkZ); return false; @@ -813,7 +813,7 @@ bool ProceduralTerrainAppearance::getWater (const int chunkX, const int chunkZ) bool ProceduralTerrainAppearance::getSlope (const int chunkX, const int chunkZ) const { - if (proceduralTerrainAppearanceTemplate->getBakedTerrain () != nullptr) + if (proceduralTerrainAppearanceTemplate->getBakedTerrain () != NULL) return proceduralTerrainAppearanceTemplate->getBakedTerrain ()->getSlope (chunkX, chunkZ); return false; @@ -823,7 +823,7 @@ bool ProceduralTerrainAppearance::getSlope (const int chunkX, const int chunkZ) bool ProceduralTerrainAppearance::getWater (const Rectangle2d& rectangle) const { - if (proceduralTerrainAppearanceTemplate->getBakedTerrain () != nullptr) + if (proceduralTerrainAppearanceTemplate->getBakedTerrain () != NULL) return proceduralTerrainAppearanceTemplate->getBakedTerrain ()->getWater (rectangle); return false; @@ -833,7 +833,7 @@ bool ProceduralTerrainAppearance::getWater (const Rectangle2d& rectangle) const bool ProceduralTerrainAppearance::getSlope (const Rectangle2d& rectangle) const { - if (proceduralTerrainAppearanceTemplate->getBakedTerrain () != nullptr) + if (proceduralTerrainAppearanceTemplate->getBakedTerrain () != NULL) return proceduralTerrainAppearanceTemplate->getBakedTerrain ()->getSlope (rectangle); return false; @@ -877,7 +877,7 @@ float ProceduralTerrainAppearance::alter (float elapsedTime) #ifdef _DEBUG const char* const appearanceTemplateName = object->getAppearance () && object->getAppearance ()->getAppearanceTemplate () ? object->getAppearance ()->getAppearanceTemplate ()->getCrcName ().getString () : 0; const Vector position = object->getPosition_w (); - DEBUG_REPORT_LOG (ms_logFloraCreation, ("flora delete: <%1.2f, %1.2f> [%s]\n", position.x, position.z, appearanceTemplateName ? appearanceTemplateName : "nullptr")); + DEBUG_REPORT_LOG (ms_logFloraCreation, ("flora delete: <%1.2f, %1.2f> [%s]\n", position.x, position.z, appearanceTemplateName ? appearanceTemplateName : "null")); #endif delete object; } @@ -1054,7 +1054,7 @@ bool ProceduralTerrainAppearance::isPassableForceChunkCreation(const Vector& pos #ifndef WIN32 if (!chunk) - LOG("PTA::isPFCC", ("(%g,%g,%g) chunk is nullptr, %d/%d/%d/%d", position.x, position.y, position.z, getNumberOfChunks(), maximumNumberOfChunksAllowed, getNumberOfReferenceObjects(), maximumNumberOfChunksAlongSide)); + LOG("PTA::isPFCC", ("(%g,%g,%g) chunk is NULL, %d/%d/%d/%d", position.x, position.y, position.z, getNumberOfChunks(), maximumNumberOfChunksAllowed, getNumberOfReferenceObjects(), maximumNumberOfChunksAlongSide)); #endif return isPassable; @@ -1183,7 +1183,7 @@ void ProceduralTerrainAppearance::_legacyCreateFlora(const Chunk* const chunk) object->yaw_o (yaw); Appearance * const appearance = AppearanceTemplateList::createAppearance (FileName (FileName::P_appearance, data.familyChildData->appearanceTemplateName)); - if (appearance != nullptr) { + if (appearance != NULL) { appearance->setKeepAlive (true); object->setAppearance (appearance); object->setScale (Vector::xyz111 * scale); @@ -1340,7 +1340,7 @@ void ProceduralTerrainAppearance::createFlora (const Chunk* const chunk) object->yaw_o (yaw); Appearance * const appearance = AppearanceTemplateList::createAppearance (FileName (FileName::P_appearance, data.familyChildData->appearanceTemplateName)); - if (appearance != nullptr) { + if (appearance != NULL) { appearance->setKeepAlive (true); object->setAppearance (appearance); object->setScale (Vector::xyz111 * scale); @@ -1403,7 +1403,7 @@ void ProceduralTerrainAppearance::destroyFlora (const Chunk* const chunk) { #ifdef _DEBUG const char* const appearanceTemplateName = object->getAppearance () && object->getAppearance ()->getAppearanceTemplate () ? object->getAppearance ()->getAppearanceTemplate ()->getCrcName ().getString () : 0; - DEBUG_REPORT_LOG (ms_logFloraCreation, ("flora cache: <%1.2f, %1.2f> [%s]\n", position.x, position.z, appearanceTemplateName ? appearanceTemplateName : "nullptr")); + DEBUG_REPORT_LOG (ms_logFloraCreation, ("flora cache: <%1.2f, %1.2f> [%s]\n", position.x, position.z, appearanceTemplateName ? appearanceTemplateName : "null")); #endif iter->second->removeFromWorld (); IGNORE_RETURN (m_cachedFloraMap->insert (std::make_pair (key, iter->second))); diff --git a/engine/shared/library/sharedTerrain/src/shared/appearance/SamplerProceduralTerrainAppearance.cpp b/engine/shared/library/sharedTerrain/src/shared/appearance/SamplerProceduralTerrainAppearance.cpp index dbe9e3fe..5cf95df7 100755 --- a/engine/shared/library/sharedTerrain/src/shared/appearance/SamplerProceduralTerrainAppearance.cpp +++ b/engine/shared/library/sharedTerrain/src/shared/appearance/SamplerProceduralTerrainAppearance.cpp @@ -910,7 +910,7 @@ void SamplerProceduralTerrainAppearance::generateBetween(Vector const & start_o, } } - // add on all chunks to be generated to chunkList. if we encounter invalid chunks (nullptr), don't include them + // add on all chunks to be generated to chunkList. if we encounter invalid chunks (null), don't include them const Chunk* chunk; for (GenerateList::iterator iter = generateList.begin(); iter != generateList.end(); ++iter) { diff --git a/engine/shared/library/sharedTerrain/src/shared/appearance/ServerProceduralTerrainAppearance.cpp b/engine/shared/library/sharedTerrain/src/shared/appearance/ServerProceduralTerrainAppearance.cpp index 938c4f2f..3045b129 100755 --- a/engine/shared/library/sharedTerrain/src/shared/appearance/ServerProceduralTerrainAppearance.cpp +++ b/engine/shared/library/sharedTerrain/src/shared/appearance/ServerProceduralTerrainAppearance.cpp @@ -805,7 +805,7 @@ void ServerProceduralTerrainAppearance::generateBetween(Vector const & start_o, } } - // add on all chunks to be generated to chunkList. if we encounter invalid chunks (nullptr), don't include them + // add on all chunks to be generated to chunkList. if we encounter invalid chunks (null), don't include them const Chunk* chunk; for (GenerateList::iterator iter = generateList.begin(); iter != generateList.end(); ++iter) { diff --git a/engine/shared/library/sharedTerrain/src/shared/appearance/TerrainQuadTree.cpp b/engine/shared/library/sharedTerrain/src/shared/appearance/TerrainQuadTree.cpp index 08cd30a7..275a6986 100755 --- a/engine/shared/library/sharedTerrain/src/shared/appearance/TerrainQuadTree.cpp +++ b/engine/shared/library/sharedTerrain/src/shared/appearance/TerrainQuadTree.cpp @@ -534,9 +534,9 @@ void TerrainQuadTree::Node::pruneTree () /** * Find the leaf node which directly contains this chunk. * -* @param aChunk the chunk to be located. If non nullptr, the parameters ax and az are ignored. -* @param ax the chunkspace coordinate of the chunk to be located. Only used if param aChunk is nullptr -* @param az the chunkspace coordinate of the chunk to be located. Only used if param aChunk is nullptr +* @param aChunk the chunk to be located. If non null, the parameters ax and az are ignored. +* @param ax the chunkspace coordinate of the chunk to be located. Only used if param aChunk is null +* @param az the chunkspace coordinate of the chunk to be located. Only used if param aChunk is null */ TerrainQuadTree::Node * TerrainQuadTree::Node::findChunkNode (const ProceduralTerrainAppearance::Chunk * const chunk, int x, int z, int size) { @@ -754,9 +754,9 @@ TerrainQuadTree::Node * TerrainQuadTree::Node::findFirstRenderableNode (const in /** * hasChunk is a wrapper for findChunkNode * -* @param aChunk the chunk to be located. If non nullptr, the parameters ax and az are ignored. -* @param ax the chunkspace coordinate of the chunk to be located. Only used if param aChunk is nullptr -* @param az the chunkspace coordinate of the chunk to be located. Only used if param aChunk is nullptr +* @param aChunk the chunk to be located. If non null, the parameters ax and az are ignored. +* @param ax the chunkspace coordinate of the chunk to be located. Only used if param aChunk is null +* @param az the chunkspace coordinate of the chunk to be located. Only used if param aChunk is null * @param chunkSize the relative size of the chunk in chunkspace. */ bool TerrainQuadTree::Node::hasChunk (const ProceduralTerrainAppearance::Chunk * const chunk, const int x, const int z, const int size) diff --git a/engine/shared/library/sharedTerrain/src/shared/appearance/TerrainQuadTree.h b/engine/shared/library/sharedTerrain/src/shared/appearance/TerrainQuadTree.h index a48d759e..cb92dce0 100755 --- a/engine/shared/library/sharedTerrain/src/shared/appearance/TerrainQuadTree.h +++ b/engine/shared/library/sharedTerrain/src/shared/appearance/TerrainQuadTree.h @@ -320,7 +320,7 @@ public: /** * TerrainQuadTree::Iterator is a preorder iterator - * To use an iterator, loop while the current node is non-nullptr. If the + * To use an iterator, loop while the current node is non-null. If the * current node's subtree should be processed further, call descend () * on the iterator, otherwise call advance () to go to the next node. * Either advance () or descend () should be called every loop iteration, diff --git a/engine/shared/library/sharedTerrain/src/shared/core/WaterTypeManager.cpp b/engine/shared/library/sharedTerrain/src/shared/core/WaterTypeManager.cpp index 4ec613d1..65b5b1d0 100755 --- a/engine/shared/library/sharedTerrain/src/shared/core/WaterTypeManager.cpp +++ b/engine/shared/library/sharedTerrain/src/shared/core/WaterTypeManager.cpp @@ -19,8 +19,8 @@ // ====================================================================== bool WaterTypeManager::ms_installed = false; -WaterTypeManager::WaterTypeDataType * WaterTypeManager::ms_waterTypeData=nullptr; -WaterTypeManager::CreatureWaterTypeDataType* WaterTypeManager::ms_creatureWaterTypeData=nullptr; +WaterTypeManager::WaterTypeDataType * WaterTypeManager::ms_waterTypeData=NULL; +WaterTypeManager::CreatureWaterTypeDataType* WaterTypeManager::ms_creatureWaterTypeData=NULL; // ====================================================================== @@ -116,9 +116,9 @@ void WaterTypeManager::remove() } delete ms_waterTypeData; - ms_waterTypeData=nullptr; + ms_waterTypeData=NULL; delete ms_creatureWaterTypeData; - ms_creatureWaterTypeData=nullptr; + ms_creatureWaterTypeData=NULL; ms_installed = false; } diff --git a/engine/shared/library/sharedTerrain/src/shared/generator/BitmapGroup.cpp b/engine/shared/library/sharedTerrain/src/shared/generator/BitmapGroup.cpp index 9d26743f..e9215147 100755 --- a/engine/shared/library/sharedTerrain/src/shared/generator/BitmapGroup.cpp +++ b/engine/shared/library/sharedTerrain/src/shared/generator/BitmapGroup.cpp @@ -159,7 +159,7 @@ void BitmapGroup::Family::loadBitmapByFilename() { if(!m_bitmapName) { - DEBUG_WARNING (true, ("BitmapGroup::Family::loadBitmapByFilename() - invalid image - m_bitmapName is nullptr")); + DEBUG_WARNING (true, ("BitmapGroup::Family::loadBitmapByFilename() - invalid image - m_bitmapName is NULL")); } else { diff --git a/engine/shared/library/sharedTerrain/src/shared/generator/ShaderGroup.cpp b/engine/shared/library/sharedTerrain/src/shared/generator/ShaderGroup.cpp index cbb9562d..b511c3a4 100755 --- a/engine/shared/library/sharedTerrain/src/shared/generator/ShaderGroup.cpp +++ b/engine/shared/library/sharedTerrain/src/shared/generator/ShaderGroup.cpp @@ -671,7 +671,7 @@ void ShaderGroup::load_0000 (Iff& iff) //-- add family Family* family = new Family (familyId); - family->setName ("nullptr"); + family->setName ("null"); PackedRgb color; color.r = 255; diff --git a/engine/shared/library/sharedTerrain/src/shared/object/TerrainObject.cpp b/engine/shared/library/sharedTerrain/src/shared/object/TerrainObject.cpp index 5206146a..f48a7b5d 100755 --- a/engine/shared/library/sharedTerrain/src/shared/object/TerrainObject.cpp +++ b/engine/shared/library/sharedTerrain/src/shared/object/TerrainObject.cpp @@ -159,7 +159,7 @@ TerrainObject::~TerrainObject () TerrainObject::removeFromWorld (); DEBUG_FATAL (ms_instance != this, ("TerrainObject instance is not this object")); - ms_instance = nullptr; + ms_instance = NULL; } //------------------------------------------------------------------- diff --git a/engine/shared/library/sharedUtility/src/shared/CachedFileManager.cpp b/engine/shared/library/sharedUtility/src/shared/CachedFileManager.cpp index 398ef20e..30bf9486 100755 --- a/engine/shared/library/sharedUtility/src/shared/CachedFileManager.cpp +++ b/engine/shared/library/sharedUtility/src/shared/CachedFileManager.cpp @@ -69,7 +69,7 @@ namespace CachedFileManagerNamespace Tag const TAG_CACH = TAG (C,A,C,H); - char * ms_filenames = nullptr; + char * ms_filenames = NULL; size_t ms_filenamesLength = 0; size_t ms_filenamesCurrentPos = 0; unsigned long ms_totalTime; @@ -150,7 +150,7 @@ void CachedFileManager::install(bool const allowFileCaching) iff.enterForm (TAG_CACH); iff.enterChunk (TAG_0000); - //-- the entire chunk is filled with nullptr terminated strings + //-- the entire chunk is filled with null terminated strings ms_filenamesLength = iff.getChunkLengthLeft(); ms_filenames = iff.readRest_char(); @@ -168,7 +168,7 @@ void CachedFileManager::install(bool const allowFileCaching) void CachedFileManagerNamespace::remove () { delete[] ms_filenames; - ms_filenames = nullptr; + ms_filenames = NULL; ms_filenamesCurrentPos = 0; ms_filenamesLength = 0; @@ -255,7 +255,7 @@ void CachedFileManager::preloadSomeAssets () #endif delete[] ms_filenames; - ms_filenames = nullptr; + ms_filenames = NULL; ms_filenamesCurrentPos = 0; ms_filenamesLength = 0; } @@ -266,7 +266,7 @@ void CachedFileManager::preloadSomeAssets () bool CachedFileManager::donePreloading () { - return ms_filenames == nullptr || (ms_filenamesCurrentPos >= ms_filenamesLength); + return ms_filenames == NULL || (ms_filenamesCurrentPos >= ms_filenamesLength); } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedUtility/src/shared/CurrentUserOptionManager.cpp b/engine/shared/library/sharedUtility/src/shared/CurrentUserOptionManager.cpp index dfb11487..626c7fcb 100755 --- a/engine/shared/library/sharedUtility/src/shared/CurrentUserOptionManager.cpp +++ b/engine/shared/library/sharedUtility/src/shared/CurrentUserOptionManager.cpp @@ -70,7 +70,7 @@ void CurrentUserOptionManager::load (char const * const userName) ms_optionManager->load (ms_userName.c_str ()); } else - DEBUG_WARNING (true, ("CurrentUserOptionManager::load: userName is nullptr")); + DEBUG_WARNING (true, ("CurrentUserOptionManager::load: userName is null")); } // ---------------------------------------------------------------------- @@ -82,7 +82,7 @@ void CurrentUserOptionManager::save () if (!ms_userName.empty ()) ms_optionManager->save (ms_userName.c_str ()); else - DEBUG_REPORT_LOG (s_verbose, ("CurrentUserOptionManager::save: userName is nullptr\n")); + DEBUG_REPORT_LOG (s_verbose, ("CurrentUserOptionManager::save: userName is null\n")); } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedUtility/src/shared/DataTable.cpp b/engine/shared/library/sharedUtility/src/shared/DataTable.cpp index 2a0974c7..0d08193b 100755 --- a/engine/shared/library/sharedUtility/src/shared/DataTable.cpp +++ b/engine/shared/library/sharedUtility/src/shared/DataTable.cpp @@ -50,7 +50,7 @@ DataTable::~DataTable() if (*k) { delete static_cast *>(*k); - *k = nullptr; + *k = NULL; } } break; @@ -59,7 +59,7 @@ DataTable::~DataTable() if (*k) { delete static_cast *>(*k); - *k = nullptr; + *k = NULL; } } @@ -69,7 +69,7 @@ DataTable::~DataTable() if (*k) { delete static_cast, std::multimap > *>(*k); - *k = nullptr; + *k = NULL; } } @@ -83,7 +83,7 @@ DataTable::~DataTable() case DataTableColumnType::DT_PackedObjVars: default: { - WARNING_STRICT_FATAL((*k) != nullptr, ("Bad column Index %d. Unsupported datatype. This may leak memory.", count)); + WARNING_STRICT_FATAL((*k) != NULL, ("Bad column Index %d. Unsupported datatype. This may leak memory.", count)); } break; } @@ -112,7 +112,7 @@ DataTable::~DataTable() } delete m_columnIndexMap; - m_columnIndexMap = nullptr; + m_columnIndexMap = NULL; } //---------------------------------------------------------------------------- @@ -464,12 +464,12 @@ void DataTable::load(Iff & iff) for (int i = 0; i < count; ++i) { //initialize the table index used for searching. - m_index.push_back(nullptr); + m_index.push_back(NULL); } buildColumnIndexMap(); - if (nullptr != iff.getFileName()) + if (NULL != iff.getFileName()) m_name = iff.getFileName(); else m_name.clear(); diff --git a/engine/shared/library/sharedUtility/src/shared/DataTableColumnType.cpp b/engine/shared/library/sharedUtility/src/shared/DataTableColumnType.cpp index 2f73061b..e0ac3cf4 100755 --- a/engine/shared/library/sharedUtility/src/shared/DataTableColumnType.cpp +++ b/engine/shared/library/sharedUtility/src/shared/DataTableColumnType.cpp @@ -148,7 +148,7 @@ DataTableColumnType::DataTableColumnType(std::string const &desc) : std::string::size_type endPos = enumList.find(','); std::string label = enumList.substr(0, eqPos); std::string val = enumList.substr(eqPos+1, endPos-eqPos-1); - (*m_enumMap)[label] = static_cast(strtol(val.c_str(), nullptr, 0)); + (*m_enumMap)[label] = static_cast(strtol(val.c_str(), NULL, 0)); enumList.erase(0, endPos+1); } // assure the default is a member of the enumeration @@ -173,7 +173,7 @@ DataTableColumnType::DataTableColumnType(std::string const &desc) : std::string::size_type endPos = enumList.find(','); std::string label = enumList.substr(0, eqPos); std::string val = enumList.substr(eqPos+1, endPos-eqPos-1); - int bit = static_cast(strtol(val.c_str(), nullptr, 0)); + int bit = static_cast(strtol(val.c_str(), NULL, 0)); if((bit < 1) || (bit > 32)) { WARNING(true, ("Flags value [%s] is not a whole number from 1 to 32", label.c_str())); @@ -247,7 +247,7 @@ void DataTableColumnType::createDefaultCell() switch(m_basicType) { case DT_Int: - m_defaultCell = new DataTableCell(static_cast(strtol(value.c_str(), nullptr, 0))); + m_defaultCell = new DataTableCell(static_cast(strtol(value.c_str(), NULL, 0))); break; case DT_Float: m_defaultCell = new DataTableCell(static_cast(atof(value.c_str()))); diff --git a/engine/shared/library/sharedUtility/src/shared/DataTableManager.cpp b/engine/shared/library/sharedUtility/src/shared/DataTableManager.cpp index f6f633c5..671a5b9c 100755 --- a/engine/shared/library/sharedUtility/src/shared/DataTableManager.cpp +++ b/engine/shared/library/sharedUtility/src/shared/DataTableManager.cpp @@ -129,7 +129,7 @@ DataTable * DataTableManager::getTable(const std::string& table, bool openIfNotF if (!dt) { DEBUG_WARNING(true, ("Could not find table [%s]", table.c_str())); - return nullptr; + return NULL; } else { @@ -140,7 +140,7 @@ DataTable * DataTableManager::getTable(const std::string& table, bool openIfNotF } else { - return nullptr; + return NULL; } } @@ -158,7 +158,7 @@ DataTable* DataTableManager::reload(const std::string & table) DataTable * const dataTable = open(table); - if (dataTable != nullptr) + if (dataTable != NULL) { std::multimap::const_iterator i = m_reloadCallbacks.lower_bound(table); for (; i != m_reloadCallbacks.end() && (*i).first == table; ++i) @@ -175,7 +175,7 @@ DataTable* DataTableManager::reloadIfOpen(const std::string & table) if(isOpen(table)) return reload(table); else - return nullptr; + return NULL; } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedUtility/src/shared/DataTableWriter.cpp b/engine/shared/library/sharedUtility/src/shared/DataTableWriter.cpp index 795c8696..d3dc927c 100755 --- a/engine/shared/library/sharedUtility/src/shared/DataTableWriter.cpp +++ b/engine/shared/library/sharedUtility/src/shared/DataTableWriter.cpp @@ -591,7 +591,7 @@ bool DataTableWriter::save(const char * outputFileName, bool optional) const { if (!outputFileName || outputFileName[0] != '\0') { - DEBUG_FATAL(true, ("OutputFileName is nullptr or empty.")); + DEBUG_FATAL(true, ("OutputFileName is NULL or empty.")); return false; } @@ -728,7 +728,7 @@ DataTableCell *DataTableWriter::_getNewCell(DataTableColumnType const &columnTyp switch (columnType.getBasicType()) { case DataTableColumnType::DT_Int: - return new DataTableCell(static_cast(strtol(value.c_str(), nullptr, 0))); + return new DataTableCell(static_cast(strtol(value.c_str(), NULL, 0))); break; case DataTableColumnType::DT_Float: return new DataTableCell(static_cast(atof(value.c_str()))); diff --git a/engine/shared/library/sharedUtility/src/shared/FileName.cpp b/engine/shared/library/sharedUtility/src/shared/FileName.cpp index 1e8936f4..93b579cf 100755 --- a/engine/shared/library/sharedUtility/src/shared/FileName.cpp +++ b/engine/shared/library/sharedUtility/src/shared/FileName.cpp @@ -52,14 +52,14 @@ FileName::FileName (FileName::Path path, const char* filename, const char* ext) // see if the filename already begins with the path const char *prePath = pathTable [path].path; - if (prePath != nullptr && *prePath != '\0') + if (prePath != NULL && *prePath != '\0') { if (strncmp(filename, prePath, strlen(prePath)) == 0) prePath = ""; } // see if the filename already ends in the extension - if (ext != nullptr && *ext != '\0') + if (ext != NULL && *ext != '\0') { int extLen = strlen(ext); int filenameLen = strlen(filename); diff --git a/engine/shared/library/sharedUtility/src/shared/RotaryCache.cpp b/engine/shared/library/sharedUtility/src/shared/RotaryCache.cpp index 6292e0d3..b406fe08 100644 --- a/engine/shared/library/sharedUtility/src/shared/RotaryCache.cpp +++ b/engine/shared/library/sharedUtility/src/shared/RotaryCache.cpp @@ -42,7 +42,7 @@ void* RotaryCache::add(const CrcLowerString& keyString, void* valuePtr) { CacheListEntry listEntry; - void* returnVal = nullptr; + void* returnVal = NULL; listEntry.key = keyString; listEntry.value = valuePtr; @@ -93,7 +93,7 @@ RotaryCache::fetch(const CrcLowerString& keyString) return entryList.value; } - return nullptr; + return NULL; } void* @@ -103,7 +103,7 @@ RotaryCache::remove(const CrcLowerString& keyString) if(iterFind != mMap.end()) { - void* retVal = nullptr; + void* retVal = NULL; CacheMapEntry& entryFind = (*iterFind).second; RotaryList::iterator iterList = entryFind.iter; @@ -119,7 +119,7 @@ RotaryCache::remove(const CrcLowerString& keyString) return retVal; } - return nullptr; + return NULL; } @@ -143,7 +143,7 @@ RotaryCache::getNext() return retVal; } - return nullptr; + return NULL; } void diff --git a/engine/shared/library/sharedUtility/src/shared/SetupSharedUtility.cpp b/engine/shared/library/sharedUtility/src/shared/SetupSharedUtility.cpp index 166f5548..3336890f 100755 --- a/engine/shared/library/sharedUtility/src/shared/SetupSharedUtility.cpp +++ b/engine/shared/library/sharedUtility/src/shared/SetupSharedUtility.cpp @@ -109,7 +109,7 @@ void SetupSharedUtility::installFileManifestEntries () if (!fileName.empty()) FileManifest::addStoredManifestEntry(fileName.c_str(), sceneId.c_str(), fileSize); else - DEBUG_WARNING(true, ("SetupSharedUtility::installFileManifestEntries(): found an entry with a nullptr filename: (row %i)\n", i)); + DEBUG_WARNING(true, ("SetupSharedUtility::installFileManifestEntries(): found an entry with a null filename: (row %i)\n", i)); } } else diff --git a/engine/shared/library/sharedUtility/src/shared/TemplateParameter.cpp b/engine/shared/library/sharedUtility/src/shared/TemplateParameter.cpp index 93af0652..751aa045 100755 --- a/engine/shared/library/sharedUtility/src/shared/TemplateParameter.cpp +++ b/engine/shared/library/sharedUtility/src/shared/TemplateParameter.cpp @@ -951,7 +951,7 @@ DynamicVariableParamData::~DynamicVariableParamData() for (int i = 0; i < count; ++i) { DynamicVariableParamData *temp = m_data.lparam->at(i); - m_data.lparam->at(i) = nullptr; + m_data.lparam->at(i) = NULL; delete temp; } delete m_data.lparam; @@ -1134,15 +1134,15 @@ void DynamicVariableParam::cleanSingleParam(void) { case DynamicVariableParamData::INTEGER: delete m_dataSingle.m_data.iparam; - m_dataSingle.m_data.iparam = nullptr; + m_dataSingle.m_data.iparam = NULL; break; case DynamicVariableParamData::FLOAT: delete m_dataSingle.m_data.fparam; - m_dataSingle.m_data.fparam = nullptr; + m_dataSingle.m_data.fparam = NULL; break; case DynamicVariableParamData::STRING: delete m_dataSingle.m_data.sparam; - m_dataSingle.m_data.sparam = nullptr; + m_dataSingle.m_data.sparam = NULL; break; case DynamicVariableParamData::LIST: { @@ -1152,11 +1152,11 @@ void DynamicVariableParam::cleanSingleParam(void) ++iter) { delete *iter; - *iter = nullptr; + *iter = NULL; } } delete m_dataSingle.m_data.lparam; - m_dataSingle.m_data.lparam = nullptr; + m_dataSingle.m_data.lparam = NULL; break; case DynamicVariableParamData::UNKNOWN: default: diff --git a/engine/shared/library/sharedUtility/src/shared/TemplateParameter.h b/engine/shared/library/sharedUtility/src/shared/TemplateParameter.h index 9c86d90b..e3db2210 100755 --- a/engine/shared/library/sharedUtility/src/shared/TemplateParameter.h +++ b/engine/shared/library/sharedUtility/src/shared/TemplateParameter.h @@ -210,19 +210,19 @@ inline void TemplateBase::cleanData(void) ++iter) { delete (*iter).value; - (*iter).value = nullptr; + (*iter).value = NULL; } delete m_data.weightedList; - m_data.weightedList = nullptr; + m_data.weightedList = NULL; } break; case RANGE: delete m_data.range; - m_data.range = nullptr; + m_data.range = NULL; break; case DIE_ROLL: delete m_data.dieRoll; - m_data.dieRoll = nullptr; + m_data.dieRoll = NULL; break; case NONE: default: @@ -288,7 +288,7 @@ inline const typename TemplateBase::Range * TemplateBase @@ -296,7 +296,7 @@ inline const typename TemplateBase::DieRoll * TemplateBase { if (m_dataType == DIE_ROLL) return m_data.dieRoll; - return nullptr; + return NULL; } template @@ -304,7 +304,7 @@ inline const typename TemplateBase::WeightedList * Templat { if (m_dataType == WEIGHTED_LIST) return m_data.weightedList; - return nullptr; + return NULL; } template @@ -541,7 +541,7 @@ inline const IntegerParam::DieRoll * IntegerParam::getDieRollStruct(void) const } else { - return nullptr; + return NULL; } } @@ -553,7 +553,7 @@ inline const IntegerParam::Range * IntegerParam::getRangeStruct(void) const } else { - return nullptr; + return NULL; } } @@ -637,7 +637,7 @@ inline const FloatParam::Range * FloatParam::getRangeStruct() const } else { - return nullptr; + return NULL; } } @@ -765,7 +765,7 @@ class TriggerVolumeData { friend class TriggerVolumeParam; public: - TriggerVolumeData(void) : m_name(nullptr), m_radius(0.0f) {} + TriggerVolumeData(void) : m_name(NULL), m_radius(0.0f) {} TriggerVolumeData(const std::string & name, float radius) : m_name(&name), m_radius(radius) {} const std::string & getName(void) const; @@ -962,7 +962,7 @@ inline TemplateBase *StructParam::createNewParam(void) template inline StructParam::StructParam(void) : TemplateBase() { - this->m_dataSingle = nullptr; + this->m_dataSingle = NULL; } // StructParam::StructParam /** @@ -974,7 +974,7 @@ inline StructParam::~StructParam() if (this->m_dataType == TemplateBase::SINGLE) { delete this->m_dataSingle; - this->m_dataSingle = nullptr; + this->m_dataSingle = NULL; this->m_dataType = TemplateBase::NONE; } } // StructParam::~StructParam @@ -986,7 +986,7 @@ template inline void StructParam::cleanSingleParam(void) { delete this->m_dataSingle; - this->m_dataSingle = nullptr; + this->m_dataSingle = NULL; } // StructParam::cleanSingleParam /** diff --git a/engine/shared/library/sharedUtility/src/shared/ValueDictionary.cpp b/engine/shared/library/sharedUtility/src/shared/ValueDictionary.cpp index 5e12a64b..cb90f847 100755 --- a/engine/shared/library/sharedUtility/src/shared/ValueDictionary.cpp +++ b/engine/shared/library/sharedUtility/src/shared/ValueDictionary.cpp @@ -103,7 +103,7 @@ bool ValueDictionary::exists(std::string const & name) const ValueTypeBase * ValueDictionary::getCopy(std::string const & name) const { - ValueTypeBase * returnValue = nullptr; + ValueTypeBase * returnValue = NULL; DictionaryValueMap::const_iterator iter = m_valueMap.find(name); if (iter != m_valueMap.end()) diff --git a/engine/shared/library/sharedUtility/src/shared/ValueDictionaryArchive.cpp b/engine/shared/library/sharedUtility/src/shared/ValueDictionaryArchive.cpp index f6ca8859..e6a638e0 100755 --- a/engine/shared/library/sharedUtility/src/shared/ValueDictionaryArchive.cpp +++ b/engine/shared/library/sharedUtility/src/shared/ValueDictionaryArchive.cpp @@ -59,7 +59,7 @@ namespace Archive std::string name; std::string type; - ValueTypeBase * value = nullptr; + ValueTypeBase * value = NULL; ValueObjectUnpackHandlerMap::const_iterator iterFind; for (int i = 0; i < static_cast(count); ++i) { @@ -77,7 +77,7 @@ namespace Archive target.insert(name, *value); delete value; - value = nullptr; + value = NULL; } } diff --git a/engine/shared/library/sharedXml/src/shared/tree/XmlTreeDocument.cpp b/engine/shared/library/sharedXml/src/shared/tree/XmlTreeDocument.cpp index 997a9dee..2a6d91d0 100755 --- a/engine/shared/library/sharedXml/src/shared/tree/XmlTreeDocument.cpp +++ b/engine/shared/library/sharedXml/src/shared/tree/XmlTreeDocument.cpp @@ -92,7 +92,7 @@ XmlTreeDocument* XmlTreeDocument::createDocument(const char * rootNodeName) doc = xmlNewDoc(BAD_CAST "1.0"); DEBUG_FATAL( !doc, ("Attempted to make new xmlDoc but failed") ); - xmlNode * node = xmlNewNode( nullptr, BAD_CAST rootNodeName ); + xmlNode * node = xmlNewNode( NULL, BAD_CAST rootNodeName ); DEBUG_FATAL( !node, ("Attempted to make root node for new xml document, but failed")); xmlDocSetRootElement(doc, node); @@ -136,8 +136,8 @@ XmlTreeDocument::XmlTreeDocument(CrcString const &name, xmlDoc *xmlDocument) : m_referenceCount(0), m_track( true ) { - DEBUG_FATAL(m_xmlDocument == nullptr, ("XmlTreeDocument(): tried to construct with a nullptr xmlDocument.")); - WARNING(m_xmlDocument == nullptr, ("XmlTreeDocument(): tried to construct with a nullptr xmlDocument.")); + DEBUG_FATAL(m_xmlDocument == NULL, ("XmlTreeDocument(): tried to construct with a NULL xmlDocument.")); + WARNING(m_xmlDocument == NULL, ("XmlTreeDocument(): tried to construct with a NULL xmlDocument.")); } // ---------------------------------------------------------------------- @@ -148,14 +148,14 @@ m_xmlDocument(xmlDocument), m_referenceCount(0), m_track(false) // documents without names are temporary documents for creation of formatted xml { - DEBUG_FATAL(m_xmlDocument == nullptr, ("XmlTreeDocument(): tried to construct with a nullptr xmlDocument.")); + DEBUG_FATAL(m_xmlDocument == NULL, ("XmlTreeDocument(): tried to construct with a NULL xmlDocument.")); } // ---------------------------------------------------------------------- XmlTreeDocument::~XmlTreeDocument() { xmlFreeDoc(m_xmlDocument); - m_xmlDocument = nullptr; + m_xmlDocument = NULL; } // ====================================================================== diff --git a/engine/shared/library/sharedXml/src/shared/tree/XmlTreeDocumentList.cpp b/engine/shared/library/sharedXml/src/shared/tree/XmlTreeDocumentList.cpp index 2299aaf5..6579b201 100755 --- a/engine/shared/library/sharedXml/src/shared/tree/XmlTreeDocumentList.cpp +++ b/engine/shared/library/sharedXml/src/shared/tree/XmlTreeDocumentList.cpp @@ -61,7 +61,7 @@ void XmlTreeDocumentListNamespace::remove() NamedDocumentMap::iterator const endIt = s_documents.end(); for (NamedDocumentMap::iterator it = s_documents.begin(); it != endIt; ++it) { - DEBUG_REPORT_LOG(true, ("-- xml tree document name [%s], reference count [%d].\n", it->first ? it->first->getString() : "", it->second ? it->second->getReferenceCount() : -1)); + DEBUG_REPORT_LOG(true, ("-- xml tree document name [%s], reference count [%d].\n", it->first ? it->first->getString() : "", it->second ? it->second->getReferenceCount() : -1)); } } } @@ -95,7 +95,7 @@ XmlTreeDocument const *XmlTreeDocumentList::fetch(CrcString const &filename) //-- Handle existing entry. if (haveEntry) { - FATAL(!lowerBound->second, ("XmlTreeDocumentList::fetch() found an entry for filename [%s] but the mapped document was nullptr.", filename.getString())); + FATAL(!lowerBound->second, ("XmlTreeDocumentList::fetch() found an entry for filename [%s] but the mapped document was NULL.", filename.getString())); // Increment reference count and return. lowerBound->second->fetch(); @@ -121,7 +121,7 @@ XmlTreeDocument const *XmlTreeDocumentList::fetch(CrcString const &filename) #endif xmlDocPtr const xmlDocument = xmlParseMemory(reinterpret_cast(fileContents), fileSize); - FATAL(!xmlDocument, ("xmlParseMemory() returned nullptr when parsing contents of file [%s].", cPathName)); + FATAL(!xmlDocument, ("xmlParseMemory() returned NULL when parsing contents of file [%s].", cPathName)); #ifdef _DEBUG unsigned long const postDomBytesAllocated = MemoryManager::getCurrentNumberOfBytesAllocated(); @@ -148,7 +148,7 @@ XmlTreeDocument const *XmlTreeDocumentList::fetch(CrcString const &filename) void XmlTreeDocumentList::stopTracking(XmlTreeDocument const *document) { FATAL(!s_installed, ("XmlTreeDocumentList not installed.")); - FATAL(!document, ("XmlTreeDocumentList::stopTracking(): nullptr document passed in.")); + FATAL(!document, ("XmlTreeDocumentList::stopTracking(): null document passed in.")); //-- Find the map entry for the xml tree document. NamedDocumentMap::iterator const findIt = s_documents.find(&(document->getName())); diff --git a/engine/shared/library/sharedXml/src/shared/tree/XmlTreeNode.cpp b/engine/shared/library/sharedXml/src/shared/tree/XmlTreeNode.cpp index 38692d89..c91ff6f6 100755 --- a/engine/shared/library/sharedXml/src/shared/tree/XmlTreeNode.cpp +++ b/engine/shared/library/sharedXml/src/shared/tree/XmlTreeNode.cpp @@ -42,7 +42,7 @@ XmlTreeNode::XmlTreeNode(const std::string &name, const std::string &content) : } xmlNode *textNode = xmlNewText(BAD_CAST contentCopy.c_str() ); - m_treeNode = xmlNewNode(nullptr, BAD_CAST nameCopy.c_str()); + m_treeNode = xmlNewNode(NULL, BAD_CAST nameCopy.c_str()); // verify new nodes DEBUG_FATAL(!textNode, ("Failed to create xml text node")); @@ -70,7 +70,7 @@ XmlTreeNode::XmlTreeNode(const std::string &name) : nameCopy = "garbage"; } - m_treeNode = xmlNewNode(nullptr, BAD_CAST nameCopy.c_str()); + m_treeNode = xmlNewNode(NULL, BAD_CAST nameCopy.c_str()); // verify new nodes DEBUG_FATAL(!m_treeNode, ("Failed to create new xml tree node")); @@ -80,7 +80,7 @@ XmlTreeNode::XmlTreeNode(const std::string &name) : XmlTreeNode XmlTreeNode::addChildNode(const char * name) { - DEBUG_FATAL( !m_treeNode, ("Attempted to add child to nullptr xml node")); + DEBUG_FATAL( !m_treeNode, ("Attempted to add child to null xml node")); XmlTreeNode node(name); if (m_treeNode) @@ -109,7 +109,7 @@ void XmlTreeNode::addChild( const XmlTreeNode& node ) bool XmlTreeNode::isNull() const { - return (m_treeNode == nullptr); + return (m_treeNode == NULL); } // ---------------------------------------------------------------------- @@ -140,7 +140,7 @@ void XmlTreeNode::assertIsElement(char const *const elementName) const char const *const nodeName = getName(); UNREF(elementName); UNREF(nodeName); - DEBUG_FATAL(!isElement(), ("expecting element named [%s], found non-element entity named [%s].", elementName ? elementName : "", nodeName)); + DEBUG_FATAL(!isElement(), ("expecting element named [%s], found non-element entity named [%s].", elementName ? elementName : "", nodeName)); DEBUG_FATAL(_stricmp(elementName, nodeName), ("expecting element named [%s], found element named [%s] instead.", nodeName)); } @@ -148,14 +148,14 @@ void XmlTreeNode::assertIsElement(char const *const elementName) const char const *XmlTreeNode::getName() const { - return (m_treeNode ? reinterpret_cast(m_treeNode->name) : ""); + return (m_treeNode ? reinterpret_cast(m_treeNode->name) : ""); } // ---------------------------------------------------------------------- XmlTreeNode XmlTreeNode::getNextSiblingElementNode() const { - xmlNode *siblingNode = m_treeNode ? m_treeNode->next : nullptr; + xmlNode *siblingNode = m_treeNode ? m_treeNode->next : NULL; while (siblingNode && (siblingNode->type != XML_ELEMENT_NODE)) siblingNode = siblingNode->next; @@ -166,16 +166,16 @@ XmlTreeNode XmlTreeNode::getNextSiblingElementNode() const XmlTreeNode XmlTreeNode::getFirstChildNode() const { - return XmlTreeNode(m_treeNode ? m_treeNode->children : nullptr); + return XmlTreeNode(m_treeNode ? m_treeNode->children : NULL); } // ---------------------------------------------------------------------- XmlTreeNode XmlTreeNode::getFirstChildElementNode() const { - //-- Check if we have a nullptr node. + //-- Check if we have a NULL node. if (!m_treeNode) - return XmlTreeNode(nullptr); + return XmlTreeNode(NULL); //-- Look for the first child node that is an element. xmlNode *childNode = m_treeNode->children; @@ -190,9 +190,9 @@ XmlTreeNode XmlTreeNode::getFirstChildElementNode() const XmlTreeNode XmlTreeNode::getFirstChildTextNode() const { - //-- Check if we have a nullptr node. + //-- Check if we have a NULL node. if (!m_treeNode) - return XmlTreeNode(nullptr); + return XmlTreeNode(NULL); //-- Look for the first child node that is a text node. xmlNode *childNode = m_treeNode->children; @@ -212,18 +212,18 @@ XmlTreeNode XmlTreeNode::getElementAttributeValueNode(char const *attributeName, //-- Validate parameters and preconditions. if (!isElement()) { - DEBUG_FATAL(!optional, ("getElementAttributeValueNode(): node [%s] is not an element.", m_treeNode ? reinterpret_cast(m_treeNode->name) : "")); - return XmlTreeNode(nullptr); + DEBUG_FATAL(!optional, ("getElementAttributeValueNode(): node [%s] is not an element.", m_treeNode ? reinterpret_cast(m_treeNode->name) : "")); + return XmlTreeNode(NULL); } if (!attributeName) { - DEBUG_FATAL(!optional, ("getElementAttributeValueNode(): attributeName is nullptr.")); - return XmlTreeNode(nullptr); + DEBUG_FATAL(!optional, ("getElementAttributeValueNode(): attributeName is NULL.")); + return XmlTreeNode(NULL); } //-- Check the attribute nodes for a match on the given name. Ignore case. - for (xmlAttr *attributeNode = m_treeNode ? m_treeNode->properties : nullptr; attributeNode; attributeNode = attributeNode->next) + for (xmlAttr *attributeNode = m_treeNode ? m_treeNode->properties : NULL; attributeNode; attributeNode = attributeNode->next) { if (!_stricmp(attributeName, reinterpret_cast(attributeNode->name))) { @@ -234,7 +234,7 @@ XmlTreeNode XmlTreeNode::getElementAttributeValueNode(char const *attributeName, //-- No attribute node matched the attribute name. DEBUG_FATAL(!optional, ("getElementAttributeValueNode(): failed to find attribute [%s] on element node [%s].", attributeName, getName())); - return XmlTreeNode(nullptr); + return XmlTreeNode(NULL); } // ---------------------------------------------------------------------- @@ -250,7 +250,7 @@ bool XmlTreeNode::getElementAttributeAsBool(char const *attributeName, bool &val char const *const contents = attributeValueNode.getTextValue(); if (!contents) { - DEBUG_FATAL(!contents, ("contents of attribute [%s] is nullptr.", attributeName)); + DEBUG_FATAL(!contents, ("contents of attribute [%s] is NULL.", attributeName)); return false; //lint !e527 // unreachable // reachable in release. } @@ -275,7 +275,7 @@ bool XmlTreeNode::getElementAttributeAsFloat(char const *attributeName, float &v char const *const contents = attributeValueNode.getTextValue(); if (!contents) { - DEBUG_FATAL(!contents, ("contents of attribute [%s] is nullptr.", attributeName)); + DEBUG_FATAL(!contents, ("contents of attribute [%s] is NULL.", attributeName)); return false; //lint !e527 // unreachable // reachable in release. } @@ -306,7 +306,7 @@ bool XmlTreeNode::getElementAttributeAsInt(char const *attributeName, int &value char const *const contents = attributeValueNode.getTextValue(); if (!contents) { - DEBUG_FATAL(!contents, ("contents of attribute [%s] is nullptr.", attributeName)); + DEBUG_FATAL(!contents, ("contents of attribute [%s] is NULL.", attributeName)); return false; //lint !e527 // unreachable // reachable in release. } @@ -366,12 +366,12 @@ char const *XmlTreeNode::getTextValue() const //-- Ensure we're a text node. if(!node.isText()) { - DEBUG_FATAL(true, ("node [%s] is not a text node", m_treeNode ? reinterpret_cast(m_treeNode->name) : "")); - return nullptr; //lint !e527 // unreachable // reachable in release. + DEBUG_FATAL(true, ("node [%s] is not a text node", m_treeNode ? reinterpret_cast(m_treeNode->name) : "")); + return NULL; //lint !e527 // unreachable // reachable in release. } //-- Return contents. - return node.m_treeNode ? reinterpret_cast(node.m_treeNode->content) : nullptr; + return node.m_treeNode ? reinterpret_cast(node.m_treeNode->content) : NULL; } // ---------------------------------------------------------------------- diff --git a/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.cpp b/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.cpp index cbe80abf..49aeee58 100755 --- a/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.cpp +++ b/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.cpp @@ -51,7 +51,7 @@ MonitorObject::~MonitorObject() if( mConnection ) { - mConnection->SetHandler(nullptr); + mConnection->SetHandler(NULL); mConnection->Disconnect(); mConnection->Release(); } @@ -75,10 +75,10 @@ char hold[214]; UdpConnection::DisconnectReasonText( mConnection->GetOtherSideDisconnectReason())); } } - mConnection->SetHandler(nullptr); + mConnection->SetHandler(NULL); mConnection->Disconnect(); mConnection->Release(); - mConnection = nullptr; + mConnection = NULL; } } @@ -94,10 +94,10 @@ void MonitorObject::OnRoutePacket( UdpConnection * con, const unsigned char *da simpleMessage msg(data); - if( con == nullptr ) + if( con == NULL ) { if( mbprint) - fprintf(stderr,"MONITOR API: MonitorObject.OnRoutePacket, recived a nullptr connection.?\n"); + fprintf(stderr,"MONITOR API: MonitorObject.OnRoutePacket, recived a NULL connection.?\n"); return; } @@ -123,7 +123,7 @@ void MonitorObject::OnRoutePacket( UdpConnection * con, const unsigned char *da if( mHierarchySent == true ) { mMonitorData->processElementsRequest(con,mSequence,(char *)&data[6],dataLen,mlastUpdateTime ); - mlastUpdateTime = (long)time(nullptr); + mlastUpdateTime = (long)time(NULL); break; } @@ -261,7 +261,7 @@ MonitorManager::MonitorManager(const char *configFile, CMonitorData *_gamedata, { mManager = manager; mbprint = _bprint; - passString = nullptr; + passString = NULL; mMonitorData = _gamedata; mObjectCount = 0; @@ -291,7 +291,7 @@ void MonitorManager::OnConnectRequest(UdpConnection *con) { if( con ) { - con->SetHandler(nullptr); + con->SetHandler(NULL); con->Disconnect(); con->Release(); } @@ -313,7 +313,7 @@ void MonitorManager::GiveTime() // check if the monitor object is no longer connected for (int i = 0; i < mObjectCount; i++) { - if( mObject[i]->mConnection == nullptr || + if( mObject[i]->mConnection == NULL || mObject[i]->mConnection->GetStatus() == UdpConnection::cStatusDisconnected ) { MonitorObject *o = mObject[i]; @@ -345,7 +345,7 @@ int x; char buffer[1024]; FILE *fp = fopen(filename,"r"); - if (fp == nullptr) + if (fp == NULL) { fprintf(stderr,"Monitor API: could not open %s file\nTHIS FILE IS REQUIRED.\n", filename); return false; @@ -367,7 +367,7 @@ char buffer[1024]; x = 0; while(!feof(fp)) { - if (fgets( buffer, 1023, fp) != nullptr) { + if (fgets( buffer, 1023, fp) != NULL) { // get rid of '\n' and '\r' for comparisons strtok(buffer,"\r\n"); len = (int)strlen(buffer); @@ -403,17 +403,17 @@ CMonitorAPI::CMonitorAPI( const char *configFile, unsigned short Port, bool _bpr mbprint = _bprint; mPort = Port; - mAddress = nullptr; + mAddress = NULL; if( address ) { mAddress = (char *)malloc(strlen(address)+1); strcpy(mAddress,address); } - if( mang == nullptr ) + if( mang == NULL ) { UdpManager::Params params; - params.handler = nullptr; + params.handler = NULL; params.maxConnections = CONNECTION_MAX; params.outgoingBufferSize = 1000000; params.noDataTimeout = 130000; @@ -595,7 +595,7 @@ int err; unsigned long S = 4000000; unsigned char *p; - data = nullptr; + data = NULL; p = (unsigned char *)malloc(4000000); memset(p,0,4000000); err = uncompress(p,&S,(source+6),(long)getSize()); diff --git a/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.h b/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.h index 975e2429..d97079c7 100755 --- a/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.h +++ b/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.h @@ -42,14 +42,14 @@ public: * * debug = turn on/off debugging. * - * address = (NOT USED) Leave as nullptr + * address = (NOT USED) Leave as NULL * - * UdpManager * mang = (NOT USED) Leave as nullptr + * UdpManager * mang = (NOT USED) Leave as NULL * - * // GenericNotifier *notifier = (NOT USED) Leave as nullptr + * // GenericNotifier *notifier = (NOT USED) Leave as NULL * */ - CMonitorAPI( const char *configFile, unsigned short port, bool debug = false , char * address = nullptr, UdpManager * mang = nullptr ); + CMonitorAPI( const char *configFile, unsigned short port, bool debug = false , char * address = NULL, UdpManager * mang = NULL ); ~CMonitorAPI(); @@ -112,7 +112,7 @@ public: * Max Limited * #define ELEMENT_MAX_START 2000 */ - int add( const char *label, int Key, int mode = MON_HISTORY, const char *Description = nullptr ); + int add( const char *label, int Key, int mode = MON_HISTORY, const char *Description = NULL ); /**************** Set the description of an element ** diff --git a/external/3rd/library/platform/projects/MonAPI2/MonitorData.cpp b/external/3rd/library/platform/projects/MonAPI2/MonitorData.cpp index 044c1a17..4b283bc6 100755 --- a/external/3rd/library/platform/projects/MonAPI2/MonitorData.cpp +++ b/external/3rd/library/platform/projects/MonAPI2/MonitorData.cpp @@ -58,7 +58,7 @@ CMonitorData::CMonitorData() { m_sequence = 1; - m_buffer = nullptr; + m_buffer = NULL; m_nbuffer = 0; m_count = 0; m_max = ELEMENT_MAX_START; @@ -103,7 +103,7 @@ void CMonitorData::resize_buffer(int new_size) { char *temp; - if( m_buffer != nullptr ) + if( m_buffer != NULL ) { temp = m_buffer; m_buffer = new char[ new_size]; @@ -331,7 +331,7 @@ char *p; if( get_bit(mark,x) == 0 ) { set_bit( mark, x ); - if( m_data[x].discription != nullptr ) + if( m_data[x].discription != NULL ) { sprintf(tmp,"%d,%s|",m_data[x].id, m_data[x].discription); size += (int)strlen(tmp); @@ -360,7 +360,7 @@ char *p; { flag = 2; set_bit(mark,x); - if( m_data[x].discription != nullptr ) + if( m_data[x].discription != NULL ) { sprintf(tmp,"%d,%s|",m_data[x].id, m_data[x].discription); size += (int)strlen(tmp); @@ -412,7 +412,7 @@ int x; //******* Discription ****** delete [] m_data[x].discription; - m_data[x].discription = nullptr; + m_data[x].discription = NULL; if( des ) { m_data[x].discription = new char [strlen(des)+1]; @@ -459,10 +459,10 @@ int x; { if( Id == m_data[x].id ) { - if( Description == nullptr ) + if( Description == NULL ) { delete [] m_data[x].discription; - m_data[x].discription = nullptr; + m_data[x].discription = NULL; mode = 0; return x; } @@ -510,7 +510,7 @@ int high, i, low; if ( high < m_count && Id==m_data[high].id ) { if (m_data[high].ChangedTime == 0 || m_data[high].value != value) { - m_data[high].ChangedTime = (long)time(nullptr); + m_data[high].ChangedTime = (long)time(NULL); m_data[high].value = value; } } @@ -560,7 +560,7 @@ int CMonitorData::parseList( char **list, char *data, char tok , int max ) int count; int cnt; - if( data == nullptr ) + if( data == NULL ) return 0; list[0] = data; diff --git a/external/3rd/library/platform/projects/MonAPI2/MonitorData.h b/external/3rd/library/platform/projects/MonAPI2/MonitorData.h index 56e3f0b9..1146d83e 100755 --- a/external/3rd/library/platform/projects/MonAPI2/MonitorData.h +++ b/external/3rd/library/platform/projects/MonAPI2/MonitorData.h @@ -35,7 +35,7 @@ Usage 'L' - long long int (8) 'i' - int (4) 's' - short int (2) - 'S' - C-style, nullptr-terminated string (n + nullptr) + 'S' - C-style, null-terminated string (n + null) 'Bn' - buffer, of size n. Used for non-terminated strings, or other binary data. */ @@ -115,7 +115,7 @@ private: //---------------------------------------------------------------- // stringMessage -// This message type is used for passing messages that can consist of a nullptr terminated string +// This message type is used for passing messages that can consist of a NULL terminated string class stringMessage : public monMessage { public: @@ -252,7 +252,7 @@ class CMonitorData { public: -// CMonitorData(GenericNotifier *notifier=nullptr ); +// CMonitorData(GenericNotifier *notifier=NULL ); CMonitorData(); virtual ~CMonitorData(); @@ -266,7 +266,7 @@ public: bool processDescriptionRequest(UdpConnection *con, short & sequence, char * userData, int dataLen,unsigned char *mark); int add(const char *label, int id, int ping, const char *des ); int setDescription( int Id, const char *Description , int & mode); - char *getDescription(int x){ if( m_ndata >= x ) return nullptr; return m_data[x].discription;} + char *getDescription(int x){ if( m_ndata >= x ) return NULL; return m_data[x].discription;} int pingValue(int p); void set(int Id, int value); void remove(int Id); diff --git a/external/3rd/library/platform/projects/Session/CommonAPI/CommonClient.cpp b/external/3rd/library/platform/projects/Session/CommonAPI/CommonClient.cpp index f61f6464..4856d6e2 100755 --- a/external/3rd/library/platform/projects/Session/CommonAPI/CommonClient.cpp +++ b/external/3rd/library/platform/projects/Session/CommonAPI/CommonClient.cpp @@ -42,7 +42,7 @@ CConnectionHandler::~CConnectionHandler() { if (mConnection) { - mConnection->SetHandler(nullptr); + mConnection->SetHandler(NULL); mConnection->Disconnect(); mConnection->Release(); } @@ -79,7 +79,7 @@ void CConnectionHandler::OnTerminated(UdpConnection *) if (mConnection) { - mConnection->SetHandler(nullptr); + mConnection->SetHandler(NULL); mConnection->Release(); mConnection = 0; } diff --git a/external/3rd/library/platform/projects/Session/LoginAPI/ClientCore.cpp b/external/3rd/library/platform/projects/Session/LoginAPI/ClientCore.cpp index 1cabca55..a9e2caf6 100755 --- a/external/3rd/library/platform/projects/Session/LoginAPI/ClientCore.cpp +++ b/external/3rd/library/platform/projects/Session/LoginAPI/ClientCore.cpp @@ -749,7 +749,7 @@ namespace LoginAPI else input.SetSessionID(sessionID); - // don't validate session type, there are clients that pass in nullptr. + // don't validate session type, there are clients that pass in NULL. input.SetSessionType(sessionType); //////////////////////////////////////// @@ -776,7 +776,7 @@ namespace LoginAPI else input.SetSessionID(sessionID); - // don't validate session type, there are clients that pass in nullptr. + // don't validate session type, there are clients that pass in NULL. input.SetSessionType(sessionType); //////////////////////////////////////// @@ -803,7 +803,7 @@ namespace LoginAPI else input.SetSessionID(sessionID); - // don't validate session type, there are clients that pass in nullptr. + // don't validate session type, there are clients that pass in NULL. input.SetSessionType(sessionType); //////////////////////////////////////// @@ -830,7 +830,7 @@ namespace LoginAPI else input.SetSessionID(sessionID); - // don't validate session type, there are clients that pass in nullptr. + // don't validate session type, there are clients that pass in NULL. input.SetSessionType(sessionType); //////////////////////////////////////// diff --git a/external/3rd/library/platform/utils/Base/Archive.cpp b/external/3rd/library/platform/utils/Base/Archive.cpp index 7d59c663..90f5f2f5 100755 --- a/external/3rd/library/platform/utils/Base/Archive.cpp +++ b/external/3rd/library/platform/utils/Base/Archive.cpp @@ -91,7 +91,7 @@ namespace Base ByteStream::ByteStream() : allocatedSize(0), beginReadIterator(), - data(nullptr), + data(NULL), size(0) { data = Data::getNewData(); @@ -187,7 +187,7 @@ namespace Base if(data->size < allocatedSize) { unsigned char * tmp = new unsigned char[newSize]; - if(data->buffer != nullptr) + if(data->buffer != NULL) memcpy(tmp, data->buffer, size); delete[] data->buffer; data->buffer = tmp; diff --git a/external/3rd/library/platform/utils/Base/AutoLog.cpp b/external/3rd/library/platform/utils/Base/AutoLog.cpp index aa84b96f..9b25380e 100755 --- a/external/3rd/library/platform/utils/Base/AutoLog.cpp +++ b/external/3rd/library/platform/utils/Base/AutoLog.cpp @@ -35,7 +35,7 @@ bool CAutoLog::Open(const char * filename) //------------------------------------- { - if( nullptr == filename) + if( NULL == filename) return false; if (pFilename) @@ -49,13 +49,13 @@ bool CAutoLog::Open(const char * filename) // Sanitize slashes char *ptr; - while ((ptr = strchr(pFilename,WRONGSLASH)) != nullptr) + while ((ptr = strchr(pFilename,WRONGSLASH)) != NULL) *ptr = SLASHCHAR[0]; char strPath[1024]; strcpy(strPath,pFilename); ptr = strrchr(strPath, SLASHCHAR[0]); - if (ptr != nullptr) + if (ptr != NULL) { *ptr = 0; @@ -63,11 +63,11 @@ bool CAutoLog::Open(const char * filename) char curdir[128]; // remember current directory - if( _getcwd(curdir,sizeof(curdir)) == nullptr ) + if( _getcwd(curdir,sizeof(curdir)) == NULL ) { fprintf(stderr,"CAutoLog::Archive failed to get current directory!\n"); free(pFilename); - pFilename = nullptr; + pFilename = NULL; return false; // error, can't proceed } @@ -78,7 +78,7 @@ bool CAutoLog::Open(const char * filename) { fprintf(stderr,"CAutoLog::Archive failed to make directory: %s\n", strPath); free(pFilename); - pFilename = nullptr; + pFilename = NULL; return false; // error, can't proceed } } @@ -98,7 +98,7 @@ bool CAutoLog::Open(const char * filename) { fprintf(stderr,"CAutoLog::Archive failed to make directory: %s\n", strPath); free(pFilename); - pFilename = nullptr; + pFilename = NULL; return false; // error, can't proceed } } @@ -107,7 +107,7 @@ bool CAutoLog::Open(const char * filename) pFile = fopen(pFilename,"a+"); - if( pFile == nullptr || pFile == (FILE *)-1) + if( pFile == NULL || pFile == (FILE *)-1) { //fprintf(stderr,"CAutoLog::Open failed to open log file: %s\n",pFilename); Close(); @@ -127,14 +127,14 @@ bool CAutoLog::Open(const char * filename) void CAutoLog::Close(void) //------------------------------------- { - if( pFile != (FILE *)-1 && pFile != nullptr) + if( pFile != (FILE *)-1 && pFile != NULL) { fclose(pFile); } pFile = (FILE *)-1; free(pFilename); - pFilename = nullptr; + pFilename = NULL; } //------------------------------------- @@ -197,7 +197,7 @@ void CAutoLog::LogDebug(char * format, ...) void CAutoLog::Log(eLogLevel severity, char *fmt, ...) //------------------------------------- { - if (pFile == (FILE *)-1 || pFile == nullptr) + if (pFile == (FILE *)-1 || pFile == NULL) { //fprintf(stderr,"CAutoLog::Log called with no file open!\n"); return; @@ -253,7 +253,7 @@ void CAutoLog::Log(eLogLevel severity, char *fmt, ...) void CAutoLog::Archive(void) //------------------------------------- { - if( pFile == (FILE *)-1 || pFile == nullptr) + if( pFile == (FILE *)-1 || pFile == NULL) { //fprintf(stderr,"CAutoLog::Archive called with no file open!\n"); return; @@ -284,7 +284,7 @@ void CAutoLog::Archive(void) strcpy(strCurrent,pFilename); pCurrent = strrchr(strCurrent, SLASHCHAR[0]); - if (pCurrent != nullptr) + if (pCurrent != NULL) *pCurrent = 0; else sprintf(strCurrent,"."); @@ -293,7 +293,7 @@ void CAutoLog::Archive(void) #ifdef WIN32 // remember current directory - if( _getcwd(curdir,sizeof(curdir)) == nullptr ) + if( _getcwd(curdir,sizeof(curdir)) == NULL ) { fprintf(stderr,"CAutoLog::Archive failed to get current directory!\n"); return; // error, can't proceed @@ -327,7 +327,7 @@ void CAutoLog::Archive(void) #endif pCurrent = strrchr(pFilename, SLASHCHAR[0]); - if (pCurrent == nullptr) + if (pCurrent == NULL) pCurrent = pFilename; else pCurrent++; diff --git a/external/3rd/library/platform/utils/Base/AutoLog.h b/external/3rd/library/platform/utils/Base/AutoLog.h index 18871c7f..0a90a774 100755 --- a/external/3rd/library/platform/utils/Base/AutoLog.h +++ b/external/3rd/library/platform/utils/Base/AutoLog.h @@ -92,14 +92,14 @@ namespace Base //------------------------------------- inline CAutoLog::CAutoLog() { - pFilename = nullptr; + pFilename = NULL; pFile = (FILE *)-1; } //------------------------------------- inline CAutoLog::CAutoLog(const char * file) { - pFilename = nullptr; + pFilename = NULL; pFile = (FILE *)-1; Open(file); } diff --git a/external/3rd/library/platform/utils/Base/Config.cpp b/external/3rd/library/platform/utils/Base/Config.cpp index 6351686f..a305cb9c 100755 --- a/external/3rd/library/platform/utils/Base/Config.cpp +++ b/external/3rd/library/platform/utils/Base/Config.cpp @@ -28,7 +28,7 @@ bool CConfig::LoadFile(char * file) // open file fp = fopen(file, "r"); - if (fp == nullptr || fp == (FILE *)-1) + if (fp == NULL || fp == (FILE *)-1) { //fprintf(stderr,"Failed to open config file %s!",file); delete fp; @@ -73,21 +73,21 @@ void CConfig::UnloadFile(void) //----------------------------------- { delete[] pConfig; - pConfig = nullptr; + pConfig = NULL; } //----------------------------------- /// finds a key of the config in memory // key argument is case-insensitive, but must be upper case in config file -// Returns true for success (passing nullptr is a special case returned as success) +// Returns true for success (passing NULL is a special case returned as success) bool CConfig::FindKey(char *key) //----------------------------------- { - if (pConfig == nullptr) + if (pConfig == NULL) return false; // special case...continue with existing key - if (key == nullptr) + if (key == NULL) return true; // form the search key @@ -98,12 +98,12 @@ bool CConfig::FindKey(char *key) // find the key heading pCursor = strstr(pConfig,strBuffer); - if (pCursor==nullptr) + if (pCursor==NULL) return false; // find the closing bracket of key heading pCursor = strchr(pCursor,']'); - if (pCursor==nullptr) + if (pCursor==NULL) return false; pCursor++; @@ -112,7 +112,7 @@ bool CConfig::FindKey(char *key) //----------------------------------- /// extract a number from the config string -// pass the key to find the first number in the list, else nullptr to find the next number in the list +// pass the key to find the first number in the list, else NULL to find the next number in the list // returns 0 if no number is found, else returns the number long CConfig::GetLong(char *key) //----------------------------------- @@ -135,20 +135,20 @@ long CConfig::GetLong(char *key) //----------------------------------- /// extract string (in double-quotes) from the list. -// pass the key to find the first string in the list, else nullptr to find the next string in the list -// returns nullptr if no string found, else returns a temporary copy of the string (without quotes) +// pass the key to find the first string in the list, else NULL to find the next string in the list +// returns NULL if no string found, else returns a temporary copy of the string (without quotes) char * CConfig::GetString(char *key) //----------------------------------- { if (!FindKey(key)) - return nullptr; + return NULL; // look for start of string or end of key while (*pCursor && *pCursor != '"' && *pCursor != '[') pCursor++; if (*(pCursor++) != '"') - return nullptr; + return NULL; // until closing quote int c = 0; @@ -162,7 +162,7 @@ char * CConfig::GetString(char *key) } } - return nullptr; + return NULL; } diff --git a/external/3rd/library/platform/utils/Base/Config.h b/external/3rd/library/platform/utils/Base/Config.h index f577eef6..56ad96af 100755 --- a/external/3rd/library/platform/utils/Base/Config.h +++ b/external/3rd/library/platform/utils/Base/Config.h @@ -10,7 +10,7 @@ ; list of strings, with code example # config.FindKey("NUMBERS"); -# while (number = config.GetLong(nullptr)) +# while (number = config.GetLong(NULL)) # YourHandleNumber(number); [NUMBERS] 100 200, 300 ; formatting is very flexible as long as numbers are delimited by non-numbers @@ -23,7 +23,7 @@ ; list of strings, with code example # config.FindKey("HOSTS"); -# while (string = config.GetString(nullptr)) +# while (string = config.GetString(NULL)) # YourHandleString(string); [HOSTS] "206.19.151.173:5999" @@ -68,16 +68,16 @@ namespace Base // returns TRUE if key is found. bool FindKey(char *key); - // extract string from config. If key is nullptr, extract next string in list, else extract first string. - // if key was not found, returns nullptr - char * GetString(char *key = nullptr); + // extract string from config. If key is NULL, extract next string in list, else extract first string. + // if key was not found, returns NULL + char * GetString(char *key = NULL); - // extract number from config. If key is nullptr, extract next number in list, else extract first number. + // extract number from config. If key is NULL, extract next number in list, else extract first number. // if key was not found, returns 0 - long GetLong(char *key = nullptr); // extract number from config. + long GetLong(char *key = NULL); // extract number from config. // indicate if config file has been loaded - inline bool FileLoaded() { return pConfig == nullptr ? false : true; } + inline bool FileLoaded() { return pConfig == NULL ? false : true; } private: char * pConfig; // pointer to file memory @@ -87,14 +87,14 @@ namespace Base inline CConfig::CConfig() { - pConfig = nullptr; - pCursor = nullptr; + pConfig = NULL; + pCursor = NULL; } inline CConfig::CConfig(char * file) { - pConfig = nullptr; - pCursor = nullptr; + pConfig = NULL; + pCursor = NULL; LoadFile(file); } diff --git a/external/3rd/library/platform/utils/Base/Statistics.h b/external/3rd/library/platform/utils/Base/Statistics.h index 0856034b..18e0579e 100755 --- a/external/3rd/library/platform/utils/Base/Statistics.h +++ b/external/3rd/library/platform/utils/Base/Statistics.h @@ -34,9 +34,9 @@ namespace Base bool commit = false; if (!mLastSampleTime) - mLastSampleTime = time(nullptr); + mLastSampleTime = time(NULL); - if (!mSampleFrequency || mLastSampleTime + mSampleFrequency < (unsigned)time(nullptr)) + if (!mSampleFrequency || mLastSampleTime + mSampleFrequency < (unsigned)time(NULL)) { mSampleTotal++; mAggregateTotal += value; diff --git a/external/3rd/library/platform/utils/Base/TemplateObjectAllocator.h b/external/3rd/library/platform/utils/Base/TemplateObjectAllocator.h index ed1a7937..40227673 100755 --- a/external/3rd/library/platform/utils/Base/TemplateObjectAllocator.h +++ b/external/3rd/library/platform/utils/Base/TemplateObjectAllocator.h @@ -93,7 +93,7 @@ namespace Base void Destroy(TYPE *object) { - if (object == nullptr) + if (object == NULL) return; #ifdef USE_ALLOCATOR_MUTEX @@ -142,7 +142,7 @@ namespace Base void FastDestroy(TYPE *object) { - if (object == nullptr) + if (object == NULL) return; object->~TYPE(); diff --git a/external/3rd/library/platform/utils/Base/linux/BlockAllocator.cpp b/external/3rd/library/platform/utils/Base/linux/BlockAllocator.cpp index 29d91074..4cefb9e7 100755 --- a/external/3rd/library/platform/utils/Base/linux/BlockAllocator.cpp +++ b/external/3rd/library/platform/utils/Base/linux/BlockAllocator.cpp @@ -12,7 +12,7 @@ namespace Base { for(unsigned i = 0; i < 31; i++) { - m_blocks[i] = nullptr; + m_blocks[i] = NULL; } } @@ -21,7 +21,7 @@ namespace Base // free all allocated memory blocks for(unsigned i = 0; i < 31; i++) { - while(m_blocks[i] != nullptr) + while(m_blocks[i] != NULL) { unsigned *tmp = m_blocks[i]; m_blocks[i] = (unsigned *)*m_blocks[i]; @@ -36,7 +36,7 @@ namespace Base void *BlockAllocator::getBlock(unsigned bytes) { unsigned accum = 16, bits = 16; - unsigned *handle = nullptr; + unsigned *handle = NULL; // Perform a binary search looking for the highest bit. @@ -96,7 +96,7 @@ namespace Base void BlockAllocator::returnBlock(unsigned *handle) { - // C++ allows for safe deletion of a nullptr pointer + // C++ allows for safe deletion of a NULL pointer if(handle) { // Update the allocator linked list, insert this entry at the head diff --git a/external/3rd/library/platform/utils/Base/linux/Event.cpp b/external/3rd/library/platform/utils/Base/linux/Event.cpp index 72190595..a3cce3b1 100755 --- a/external/3rd/library/platform/utils/Base/linux/Event.cpp +++ b/external/3rd/library/platform/utils/Base/linux/Event.cpp @@ -26,8 +26,8 @@ namespace Base mCond(), mThreadCount(0) { - pthread_mutex_init(&mMutex, nullptr); - pthread_cond_init(&mCond, nullptr); + pthread_mutex_init(&mMutex, NULL); + pthread_cond_init(&mCond, NULL); } CEvent::~CEvent() @@ -74,7 +74,7 @@ namespace Base struct timeval now; struct timespec abs_timeout; - gettimeofday(&now, nullptr); + gettimeofday(&now, NULL); abs_timeout.tv_sec = now.tv_sec + timeout/1000; abs_timeout.tv_nsec = now.tv_usec * 1000 + (timeout%1000)*1000000; abs_timeout.tv_sec += abs_timeout.tv_nsec / 1000000000; diff --git a/external/3rd/library/platform/utils/Base/linux/Logger.cpp b/external/3rd/library/platform/utils/Base/linux/Logger.cpp index 1510e1c1..f305703d 100755 --- a/external/3rd/library/platform/utils/Base/linux/Logger.cpp +++ b/external/3rd/library/platform/utils/Base/linux/Logger.cpp @@ -18,20 +18,20 @@ Logger::Logger(const char *prefix, int level, unsigned size, bool rollDate) : m_defaultLevel(level), m_defaultSize(size), m_dirPrefix(prefix), m_rollDate(rollDate) { char buf[1024]; - FILE *logDir = nullptr; + FILE *logDir = NULL; logDir = fopen(m_dirPrefix.c_str(), "r+"); if(errno == ENOENT) { cmkdir(m_dirPrefix.c_str(), 0755); } - else if(logDir != nullptr) + else if(logDir != NULL) { fclose(logDir); } tm now; - time_t t = time(nullptr); + time_t t = time(NULL); localtime_r(&t, &now); memcpy(&m_lastDateTime, &now, sizeof(tm)); @@ -48,7 +48,7 @@ Logger::Logger(const char *prefix, int level, unsigned size, bool rollDate) { cmkdir(buf, 0755); } - else if(logDir != nullptr) + else if(logDir != NULL) { fclose(logDir); } @@ -178,7 +178,7 @@ void Logger::logSimple(unsigned logenum, int level, const char *message) { return; } - time_t t = time(nullptr); + time_t t = time(NULL); LogInfo *info = (*iter).second; if(level >= info->level) { @@ -241,7 +241,7 @@ void Logger::log(unsigned logenum, int level, const char *message, ...) { return; } - time_t t = time(nullptr); + time_t t = time(NULL); LogInfo *info = (*iter).second; if(level >= info->level) { @@ -294,14 +294,14 @@ void Logger::log(unsigned logenum, int level, const char *message, ...) void Logger::rollDate(time_t t) { char buf[80]; - FILE *logDir = nullptr; + FILE *logDir = NULL; logDir = fopen(m_dirPrefix.c_str(), "r+"); if(errno == ENOENT) { cmkdir(m_dirPrefix.c_str(), 0755); } - else if(logDir != nullptr) + else if(logDir != NULL) { fclose(logDir); } @@ -316,7 +316,7 @@ void Logger::rollDate(time_t t) { cmkdir(buf, 0755); } - else if(logDir != nullptr) + else if(logDir != NULL) { fclose(logDir); } diff --git a/external/3rd/library/platform/utils/Base/linux/Thread.cpp b/external/3rd/library/platform/utils/Base/linux/Thread.cpp index 5cca2017..2bc4f26b 100755 --- a/external/3rd/library/platform/utils/Base/linux/Thread.cpp +++ b/external/3rd/library/platform/utils/Base/linux/Thread.cpp @@ -76,8 +76,8 @@ namespace Base CThreadPool::CMember::CMember(CThreadPool * parent) : mParent(parent), - mFunction(nullptr), - mArgument(nullptr), + mFunction(NULL), + mArgument(NULL), mSemaphore() { StartThread(); @@ -116,8 +116,8 @@ namespace Base if (mFunction) { mFunction(mArgument); - mArgument = nullptr; - mFunction = nullptr; + mArgument = NULL; + mFunction = NULL; } else if (mParent->OnDestory(this)) mThreadContinue = false; @@ -172,7 +172,7 @@ namespace Base } //////////////////////////////////////// - // (3) Delete the nullptr member threads + // (3) Delete the null member threads mMutex.Lock(); while (!mNullMember.empty()) { @@ -199,7 +199,7 @@ namespace Base } //////////////////////////////////////// - // (2) Delete any nullptr member threads. + // (2) Delete any null member threads. while (!mNullMember.empty()) { delete mNullMember.front(); diff --git a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistStressTest/test.cpp b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistStressTest/test.cpp index dae431dd..c9d48ca3 100755 --- a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistStressTest/test.cpp +++ b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistStressTest/test.cpp @@ -376,8 +376,8 @@ void createTicket() Plat_Unicode::String xml = narrowToWide("Stress Test XML here"); t.setDetails(details.c_str()); t.setLocation(location.c_str()); - track = api->requestCreateTicket(nullptr, &t, nullptr, t.uid); - //track = api->requestCreateTicket(nullptr, &t, xml.c_str(), t.uid); + track = api->requestCreateTicket(NULL, &t, NULL, t.uid); + //track = api->requestCreateTicket(NULL, &t, xml.c_str(), t.uid); submitted++; printf("creating ticket\n"); @@ -478,7 +478,7 @@ int main(int argc, char **argv) gamep = argv[4]; gameserver = argv[5]; - if (serverhost == nullptr || strlen(serverhost) == 0) + if (serverhost == NULL || strlen(serverhost) == 0) { std::cout << "Missing hostname!\n"; return 0; @@ -493,12 +493,12 @@ int main(int argc, char **argv) std::cout << "Missing or invalid number of functions to run!\n"; return 0; } - if (gamep == nullptr || strlen(gamep) == 0) + if (gamep == NULL || strlen(gamep) == 0) { std::cout << "Missing game name!\n"; return 0; } - if (gameserver == nullptr || strlen(gameserver) == 0) + if (gameserver == NULL || strlen(gameserver) == 0) { std::cout << "Missing game server name!\n"; return 0; @@ -517,7 +517,7 @@ while(1) unsigned loginWait(500); unsigned loginAttempts(0); //api = new apiTest(serverhost, serverport, 60, CSASSIST_APIFLAG_ASSUME_RECONNECT); //, 0, CSASSIST_APIFLAG_ASSUME_RECONNECT); - //api->connectCSAssist(nullptr, game.c_str(), server.c_str()); + //api->connectCSAssist(NULL, game.c_str(), server.c_str()); //while (!ready) // api->Update(); @@ -530,7 +530,7 @@ while(1) if (api) delete api; //api = new apiTest(serverhost, serverport, 60, CSASSIST_APIFLAG_ASSUME_RECONNECT); api = new apiTest(serverhost, serverport, 60, CSASSIST_APIFLAG_ASSUME_RECONNECT|CSASSIST_APIFLAG_NO_REDIRECT); - track = api->connectCSAssist(nullptr, game.c_str(), server.c_str()); + track = api->connectCSAssist(NULL, game.c_str(), server.c_str()); loginFailed = false; std::cout <<"Trying to connect..."<requestNewTicketActivity(nullptr, testUID, 0); + track = api->requestNewTicketActivity(NULL, testUID, 0); else - track = api->requestNewTicketActivity(nullptr, testUID, character.c_str()); + track = api->requestNewTicketActivity(NULL, testUID, character.c_str()); submitted++; break; case CSASSIST_CALL_REGISTERCHARACTER: uid = rand(); - track = api->requestRegisterCharacter(nullptr, uid, 0, 0); + track = api->requestRegisterCharacter(NULL, uid, 0, 0); register_list.push(uid); submitted++; break; case CSASSIST_CALL_GETISSUEHIERARCHY: lang = narrowToWide("en"); - track = api->requestGetIssueHierarchy(nullptr, hierarchy.c_str(), lang.c_str()); + track = api->requestGetIssueHierarchy(NULL, hierarchy.c_str(), lang.c_str()); submitted++; break; case CSASSIST_CALL_CREATETICKET: @@ -597,33 +597,33 @@ while(1) case CSASSIST_CALL_APPENDCOMMENT: comment = narrowToWide("Unicode comment by player."); tid = randomTicketID(); - track = api->requestAppendTicketComment(nullptr, tid, testUID, character.c_str(), comment.c_str()); + track = api->requestAppendTicketComment(NULL, tid, testUID, character.c_str(), comment.c_str()); submitted++; break; case CSASSIST_CALL_GETTICKETBYID: tid = randomTicketID(); - track = api->requestGetTicketByID(nullptr, tid, 1); + track = api->requestGetTicketByID(NULL, tid, 1); submitted++; break; case CSASSIST_CALL_GETTICKETCOMMENTS: tid = randomTicketID(); - track = api->requestGetTicketComments(nullptr, tid, 0, (rand() % 100)+1, CSASSIST_OFFSET_START); + track = api->requestGetTicketComments(NULL, tid, 0, (rand() % 100)+1, CSASSIST_OFFSET_START); submitted++; break; case CSASSIST_CALL_GETTICKET: - track = api->requestGetTicketByCharacter(nullptr, testUID, character.c_str(), 0, (rand() % 100)+1, 1); + track = api->requestGetTicketByCharacter(NULL, testUID, character.c_str(), 0, (rand() % 100)+1, 1); submitted++; break; case CSASSIST_CALL_MARKREAD: tid = randomTicketID(); - track = api->requestMarkTicketRead(nullptr, tid); + track = api->requestMarkTicketRead(NULL, tid); submitted++; break; case CSASSIST_CALL_CANCELTICKET: if (firstTicketID != 0) { comment = narrowToWide("Ticket closed by player"); - track = api->requestCancelTicket(nullptr, firstTicketID, testUID, comment.c_str()); + track = api->requestCancelTicket(NULL, firstTicketID, testUID, comment.c_str()); if (++firstTicketID > lastTicketID) { firstTicketID = 0; @@ -634,33 +634,33 @@ while(1) break; case CSASSIST_CALL_COMMENTCOUNT: tid = randomTicketID(); - track = api->requestGetTicketCommentsCount(nullptr, tid); + track = api->requestGetTicketCommentsCount(NULL, tid); submitted++; break; case CSASSIST_CALL_GETDOCUMENTLIST: // lang = narrowToWide("en"); -// track = api->requestGetDocumentList(nullptr, hierarchy.c_str(), lang.c_str()); +// track = api->requestGetDocumentList(NULL, hierarchy.c_str(), lang.c_str()); // submitted++; break; case CSASSIST_CALL_GETDOCUMENT: -// track = api->requestGetDocument(nullptr, 1); +// track = api->requestGetDocument(NULL, 1); // submitted++; break; case CSASSIST_CALL_GETTICKETXMLBLOCK: tid = randomTicketID(); - track = api->requestGetTicketXMLBlock(nullptr, tid); + track = api->requestGetTicketXMLBlock(NULL, tid); submitted++; break; case CSASSIST_CALL_GETKBARTICLE: /*id = narrowToWide("soe1401"); lang = narrowToWide("en"); - track = api->requestGetKBArticle(nullptr, id.c_str(), lang.c_str()); + track = api->requestGetKBArticle(NULL, id.c_str(), lang.c_str()); submitted++; */break; case CSASSIST_CALL_SEARCHKB: /*Plat_Unicode::String searchStr = narrowToWide("video drivers"); lang = narrowToWide("en"); - track = api->requestSearchKB(nullptr, searchStr.c_str(), lang.c_str()); + track = api->requestSearchKB(NULL, searchStr.c_str(), lang.c_str()); submitted++; */break; } @@ -692,7 +692,7 @@ while(1) { uid = register_list.front(); register_list.pop(); - api->requestUnRegisterCharacter(nullptr, uid, 0); + api->requestUnRegisterCharacter(NULL, uid, 0); submitted++; } cout<<"Waiting for unregisters..."<disconnectCSAssist(nullptr); + api->disconnectCSAssist(NULL); submitted++; while (submitted > received) @@ -718,7 +718,7 @@ while(1) cout<<"Going to delete API now."<::iterator iter = servers.begin(); iter != servers.end(); iter++) { @@ -147,7 +147,7 @@ CSAssistGameAPIcore::CSAssistGameAPIcore(CSAssistGameAPI *api, const char *serve memset(host, 0, size); sprintf(host, "%s", strtok(p, ":")); int res(1); - char *pc = strtok(nullptr, ":"); + char *pc = strtok(NULL, ":"); if (pc) { port = atoi(pc);res++; } //if (res == 2) { @@ -212,7 +212,7 @@ CSAssistGameAPIcore::~CSAssistGameAPIcore() m_connection->Disconnect(false); #endif m_connection->Release(); - m_connection = nullptr; + m_connection = NULL; } m_conManager->Release(); delete m_receiver; @@ -298,13 +298,13 @@ void CSAssistGameAPIcore::SubmitRequest(Request *req, Response *res) { if (req->getType() != CSASSIST_CALL_CONNECTLB) { - m_timeout.push(new timeout(res->getTrack(), time(nullptr) + m_userTimeout)); - req->setTimeout(time(nullptr) + m_userTimeout); + m_timeout.push(new timeout(res->getTrack(), time(NULL) + m_userTimeout)); + req->setTimeout(time(NULL) + m_userTimeout); } else { - m_timeout.push(new timeout(res->getTrack(), time(nullptr) + CONNECTLB_TIMEOUT)); - req->setTimeout(time(nullptr) + CONNECTLB_TIMEOUT); + m_timeout.push(new timeout(res->getTrack(), time(NULL) + CONNECTLB_TIMEOUT)); + req->setTimeout(time(NULL) + CONNECTLB_TIMEOUT); } m_outQueue.push(req); m_pending.insert(pair(res->getTrack(), res)); @@ -316,13 +316,13 @@ void CSAssistGameAPIcore::SubmitRequestInt(Request *req, Response *res) { if (req->getType() != CSASSIST_CALL_CONNECTLB) { - m_timeoutInt.push(new timeout(res->getTrack(), time(nullptr) + m_userTimeout)); - req->setTimeout(time(nullptr) + m_userTimeout); + m_timeoutInt.push(new timeout(res->getTrack(), time(NULL) + m_userTimeout)); + req->setTimeout(time(NULL) + m_userTimeout); } else { - m_timeoutInt.push(new timeout(res->getTrack(), time(nullptr) + CONNECTLB_TIMEOUT)); - req->setTimeout(time(nullptr) + CONNECTLB_TIMEOUT); + m_timeoutInt.push(new timeout(res->getTrack(), time(NULL) + CONNECTLB_TIMEOUT)); + req->setTimeout(time(NULL) + CONNECTLB_TIMEOUT); } m_outQueueInt.push(req); m_pendingInt.insert(pair(res->getTrack(), res)); @@ -390,14 +390,14 @@ void CSAssistGameAPIcore::CSAssistGameCallback(Response *response) if (!m_receiver->m_firstConnection) m_api->OnConnectCSAssist(track, result, userData); // normal application layer connect else - m_api->OnConnectCSAssist(0, result, nullptr); // internal re-connect + m_api->OnConnectCSAssist(0, result, NULL); // internal re-connect m_receiver->m_firstConnection = true; } else { if (m_receiver->m_firstConnection) - m_api->OnConnectRejectedCSAssist(0, result, nullptr); + m_api->OnConnectRejectedCSAssist(0, result, NULL); else m_api->OnConnectRejectedCSAssist(track, result, userData); @@ -413,7 +413,7 @@ void CSAssistGameAPIcore::CSAssistGameCallback(Response *response) m_connection->Disconnect(false); #endif m_connection->Release(); - m_connection = nullptr; + m_connection = NULL; } GetLBHost(); m_receiver->m_firstConnection = true; @@ -436,7 +436,7 @@ void CSAssistGameAPIcore::CSAssistGameCallback(Response *response) m_connection->Disconnect(false); #endif m_connection->Release(); - m_connection = nullptr; + m_connection = NULL; } m_api->OnDisconnectCSAssist(track, result, userData); } @@ -624,7 +624,7 @@ Response * CSAssistGameAPIcore::getPending(CSAssistGameAPITrack track) map::iterator iter; iter = m_pending.find(track); if (iter == m_pending.end()) - return nullptr; + return NULL; return (*iter).second; } @@ -635,7 +635,7 @@ Response * CSAssistGameAPIcore::getPendingInt(CSAssistGameAPITrack track) map::iterator iter; iter = m_pendingInt.find(track); if (iter == m_pendingInt.end()) - return nullptr; + return NULL; return (*iter).second; } @@ -681,22 +681,22 @@ void CSAssistGameAPIcore::Update() // ----- Process timeout queue, send timeout messages when appropriate ----- - while((m_timeout.size() > 0) && ((t = m_timeout.front())->time <= time(nullptr))) + while((m_timeout.size() > 0) && ((t = m_timeout.front())->time <= time(NULL))) { Response *Res = getPending(t->track); //fprintf(stderr, "processing timeouts: track(%u) response(%p)\n", t->track, Res); - if(Res != nullptr) + if(Res != NULL) { CSAssistGameCallback(Res); } m_timeout.pop(); delete t; } - while((m_timeoutInt.size() > 0) && ((t = m_timeoutInt.front())->time <= time(nullptr))) + while((m_timeoutInt.size() > 0) && ((t = m_timeoutInt.front())->time <= time(NULL))) { Response *Res = getPendingInt(t->track); //fprintf(stderr, "processing internal timeouts: track(%u) response(%p)\n", t->track, Res); - if(Res != nullptr) + if(Res != NULL) { CSAssistGameCallback(Res); } @@ -705,14 +705,14 @@ void CSAssistGameAPIcore::Update() } // ----- process timeouts for requests ----- - while ((m_outQueue.size() > 0) && (m_outQueue.front()->getTimeout() <= (unsigned)time(nullptr))) + while ((m_outQueue.size() > 0) && (m_outQueue.front()->getTimeout() <= (unsigned)time(NULL))) { Request *R = m_outQueue.front(); //fprintf(stderr, "processing request timeouts: track(%u) request(%u)\n", R->getTrack(), R->getType()); m_outQueue.pop(); delete R; } - while ((m_outQueueInt.size() > 0) && (m_outQueueInt.front()->getTimeout() <= (unsigned)time(nullptr))) + while ((m_outQueueInt.size() > 0) && (m_outQueueInt.front()->getTimeout() <= (unsigned)time(NULL))) { Request *R = m_outQueueInt.front(); //fprintf(stderr, "processing internal request timeouts: track(%u) request(%u)\n", R->getTrack(), R->getType()); @@ -724,18 +724,18 @@ void CSAssistGameAPIcore::Update() { // API does not have a connection, begin connection handshake process //fprintf(stderr, "Going to connect to %s:%d\n", m_ip.c_str(), m_port); - m_reconnectTimeout = time(nullptr) + 5; + m_reconnectTimeout = time(NULL) + 5; m_connection = m_conManager->EstablishConnection(m_ip.c_str(), m_port); // set connected host/port before changing with GetLBHost. m_connectedIP = m_ip.c_str(); m_connectedPort = m_port; - if (m_connection != nullptr) + if (m_connection != NULL) m_connection->SetHandler(m_receiver); else { - m_api->OnConnectRejectedCSAssist(0, CSASSIST_RESULT_FAIL, nullptr); + m_api->OnConnectRejectedCSAssist(0, CSASSIST_RESULT_FAIL, NULL); // Connection failed. Try getting a new host. GetLBHost(); } @@ -777,7 +777,7 @@ void CSAssistGameAPIcore::Update() else { //fprintf(stderr,"Update(1): timing out response(%p) for track(%u)\n", Res, t->track); - if(Res != nullptr) + if(Res != NULL) { CSAssistGameCallback(Res); } @@ -795,18 +795,18 @@ void CSAssistGameAPIcore::Update() //fprintf(stderr, "Update(2) enter\n"); #ifdef USE_UDP_LIBRARY if((m_connection->GetStatus() == UdpConnection::cStatusDisconnected) || - (m_connection->GetStatus() == UdpConnection::cStatusNegotiating && m_reconnectTimeout < time(nullptr))) + (m_connection->GetStatus() == UdpConnection::cStatusNegotiating && m_reconnectTimeout < time(NULL))) { m_connection->Disconnect(); #else if((m_connection->GetStatus() == TcpConnection::StatusDisconnected) || - (m_connection->GetStatus() == TcpConnection::StatusNegotiating && m_reconnectTimeout < time(nullptr))) + (m_connection->GetStatus() == TcpConnection::StatusNegotiating && m_reconnectTimeout < time(NULL))) { m_connection->Disconnect(false); #endif m_connection->Release(); - m_connection = nullptr; + m_connection = NULL; //fprintf(stderr, "Update(2): Disconnected!! m_connectState=%u\n", m_connectState); switch(m_connectState) @@ -835,7 +835,7 @@ void CSAssistGameAPIcore::Update() //if (t-> Response *Res = getPendingInt(t->track); //fprintf(stderr, "Update(2) timing out connect: track(%u) response(%p)\n", t->track, Res); - if(Res != nullptr) + if(Res != NULL) { Res->setResult(CSASSIST_RESULT_FAIL); CSAssistGameCallback(Res); @@ -964,7 +964,7 @@ void CSAssistGameAPIcore::Update() Response *CSAssistGameAPIcore::createServerResponse(short msgtype) //------------------------------------------------------------- { - Response *res = nullptr; + Response *res = NULL; switch (msgtype) { diff --git a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistgameapicore.h b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistgameapicore.h index d7dc8ac4..0f642423 100755 --- a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistgameapicore.h +++ b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistgameapicore.h @@ -166,11 +166,11 @@ private: void GetLBHost(); void OnConnectLB(unsigned track, unsigned result, std::string serverName, unsigned serverPort, Request *, Response *); #ifdef USE_UDP_LIBRARY - inline bool actuallyConnected() { return (bool)((m_connection != nullptr) && (m_connection->GetStatus() == UdpConnection::cStatusConnected)); } + inline bool actuallyConnected() { return (bool)((m_connection != NULL) && (m_connection->GetStatus() == UdpConnection::cStatusConnected)); } UdpManager *m_conManager; UdpConnection *m_connection; #else - inline bool actuallyConnected() { return (bool)((m_connection != nullptr) && (m_connection->GetStatus() == TcpConnection::StatusConnected)); } + inline bool actuallyConnected() { return (bool)((m_connection != NULL) && (m_connection->GetStatus() == TcpConnection::StatusConnected)); } TcpManager *m_conManager; TcpConnection *m_connection; #endif diff --git a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistreceiver.cpp b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistreceiver.cpp index a1b03cf9..5aa9430b 100755 --- a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistreceiver.cpp +++ b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistreceiver.cpp @@ -99,7 +99,7 @@ void CSAssistReceiver::OnTerminated(TcpConnection *con) break; case CONNECT_BACKEND_CONNECTED_AND_AUTHED: - m_api->m_api->OnDisconnectCSAssist(0, CSASSIST_RESULT_SERVER_DISCONNECT, nullptr); + m_api->m_api->OnDisconnectCSAssist(0, CSASSIST_RESULT_SERVER_DISCONNECT, NULL); case CONNECT_BACKEND_CONNECTED: m_api->GetLBHost(); case CONNECT_BACKEND_NEGOTIATING: m_api->m_connectState = CONNECT_BACKEND_DISCONNECTED; break; @@ -110,7 +110,7 @@ void CSAssistReceiver::OnTerminated(TcpConnection *con) else { if (m_api->m_connectState == CONNECT_BACKEND_CONNECTED_AND_AUTHED) - m_api->m_api->OnDisconnectCSAssist(0, CSASSIST_RESULT_SERVER_DISCONNECT, nullptr); + m_api->m_api->OnDisconnectCSAssist(0, CSASSIST_RESULT_SERVER_DISCONNECT, NULL); m_api->m_connectState = CONNECT_BACKEND_DISCONNECTED; m_api->GetLBHost(); } @@ -156,7 +156,7 @@ void CSAssistReceiver::OnRoutePacket(TcpConnection *con, const uchar *data, int { res = m_api->getPending(track); } - if(res != nullptr) + if(res != NULL) { res->init(type, track, result); res->decode(iter); diff --git a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssisttest/test.cpp b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssisttest/test.cpp index efbc0db4..c172511e 100755 --- a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssisttest/test.cpp +++ b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssisttest/test.cpp @@ -40,7 +40,7 @@ Plat_Unicode::String globalArticleID; //---------------------------------------------- CSAssistUnicodeChar *get_c_str(Plat_Unicode::String s) // This replaces c_str() by allocating a new buffer, erasing it, and then -// using the non-nullptr terminated data() to copy the data into the buffer. +// using the non-null terminated data() to copy the data into the buffer. //---------------------------------------------- { unsigned length = s.size() + 1; @@ -94,7 +94,7 @@ void DisplayTicket(const CSAssistGameAPITicket *t) std::cout << wideToNarrow(details) << "\n***\n"; } else - std::cout << "***Ticket IS nullptr! ***\n"; + std::cout << "***Ticket IS NULL! ***\n"; } //--------------------------------------------- @@ -110,7 +110,7 @@ void DisplayComment(const CSAssistGameAPITicketComment *t) std::cout << "\n " << wideToNarrow(comment) << "\n"; } else - std::cout << "***Comment IS nullptr! ***\n"; + std::cout << "***Comment IS NULL! ***\n"; } //--------------------------------------------- @@ -132,7 +132,7 @@ void DisplayDocumentHeader(const CSAssistGameAPIDocumentHeader *doc) std::cout << ", Modified: " << date2 << "\n"; } else - std::cout << "***Document Header IS nullptr! ***\n"; + std::cout << "***Document Header IS NULL! ***\n"; } //--------------------------------------------- @@ -148,7 +148,7 @@ void DisplaySearchResult(const CSAssistGameAPISearchResult *doc) std::cout << ", Title: " << wideToNarrow(title) << "\n"; } else - std::cout << "***Search Result IS nullptr! ***\n"; + std::cout << "***Search Result IS NULL! ***\n"; } @@ -360,7 +360,7 @@ void apiTest::OnRequestGameLocation(const CSAssistGameAPITrack sourceTrack, cons CSAssistUnicodeChar *rawLoc = get_c_str(loc); std::cout << "Request Game Location: Source Track(" << sourceTrack << "), uid(" << uid << "), character("; std::cout << wideToNarrow(charry) << "), CSR UID(" << CSRUID << ")\n"; - api->replyGameLocation(nullptr, sourceTrack, uid, rawCharry, CSRUID, rawLoc); + api->replyGameLocation(NULL, sourceTrack, uid, rawCharry, CSRUID, rawLoc); delete [] rawCharry; delete [] rawLoc; } diff --git a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/packdata.cpp b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/packdata.cpp index 9a8ef45e..4c267fd4 100755 --- a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/packdata.cpp +++ b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/packdata.cpp @@ -30,7 +30,7 @@ using namespace Plat_Unicode; //---------------------------------------------- CSAssistUnicodeChar *get_c_str(Plat_Unicode::String s) // This replaces c_str() by allocating a new buffer, erasing it, and then -// using the non-nullptr terminated data() to copy the data into the buffer. +// using the non-null terminated data() to copy the data into the buffer. //---------------------------------------------- { unsigned length = s.size() + 1; diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/Archive.cpp b/external/3rd/library/soePlatform/CSAssist/utils/Base/Archive.cpp index d55481a4..1afab822 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/Archive.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/Archive.cpp @@ -94,7 +94,7 @@ namespace Base ByteStream::ByteStream() : allocatedSize(0), beginReadIterator(), - data(nullptr), + data(NULL), size(0), lastPutSize(0) { @@ -211,7 +211,7 @@ namespace Base if(data->size < allocatedSize) { unsigned char * tmp = new unsigned char[newSize]; - if(data->buffer != nullptr) + if(data->buffer != NULL) memcpy(tmp, data->buffer, size); delete[] data->buffer; data->buffer = tmp; diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/AutoLog.cpp b/external/3rd/library/soePlatform/CSAssist/utils/Base/AutoLog.cpp index 4a8dc976..687381ed 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/AutoLog.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/AutoLog.cpp @@ -35,7 +35,7 @@ bool CAutoLog::Open(const char * filename) //------------------------------------- { - if( nullptr == filename) + if( NULL == filename) return false; if (pFilename) @@ -45,13 +45,13 @@ bool CAutoLog::Open(const char * filename) // Sanitize slashes char *ptr; - while ((ptr = strchr(pFilename,WRONGSLASH)) != nullptr) + while ((ptr = strchr(pFilename,WRONGSLASH)) != NULL) *ptr = SLASHCHAR[0]; char strPath[1024]; strcpy(strPath,pFilename); ptr = strrchr(strPath, SLASHCHAR[0]); - if (ptr != nullptr) + if (ptr != NULL) { *ptr = 0; @@ -59,11 +59,11 @@ bool CAutoLog::Open(const char * filename) char curdir[128]; // remember current directory - if( getcwd(curdir,sizeof(curdir)) == nullptr ) + if( getcwd(curdir,sizeof(curdir)) == NULL ) { fprintf(stderr,"CAutoLog::Archive failed to get current directory!\n"); free(pFilename); - pFilename = nullptr; + pFilename = NULL; return false; // error, can't proceed } @@ -74,7 +74,7 @@ bool CAutoLog::Open(const char * filename) { fprintf(stderr,"CAutoLog::Archive failed to make directory: %s\n", strPath); free(pFilename); - pFilename = nullptr; + pFilename = NULL; return false; // error, can't proceed } } @@ -94,7 +94,7 @@ bool CAutoLog::Open(const char * filename) { fprintf(stderr,"CAutoLog::Archive failed to make directory: %s\n", strPath); free(pFilename); - pFilename = nullptr; + pFilename = NULL; return false; // error, can't proceed } } @@ -103,7 +103,7 @@ bool CAutoLog::Open(const char * filename) pFile = fopen(pFilename,"a+"); - if( pFile == nullptr || pFile == (FILE *)-1) + if( pFile == NULL || pFile == (FILE *)-1) { //fprintf(stderr,"CAutoLog::Open failed to open log file: %s\n",pFilename); Close(); @@ -123,7 +123,7 @@ bool CAutoLog::Open(const char * filename) void CAutoLog::Close(void) //------------------------------------- { - if( pFile != (FILE *)-1 && pFile != nullptr) + if( pFile != (FILE *)-1 && pFile != NULL) { fclose(pFile); } @@ -131,7 +131,7 @@ void CAutoLog::Close(void) free(pFilename); - pFilename = nullptr; + pFilename = NULL; } //------------------------------------- @@ -194,7 +194,7 @@ void CAutoLog::LogDebug(char * format, ...) void CAutoLog::Log(eLogLevel severity, char *fmt, ...) //------------------------------------- { - if (pFile == (FILE *)-1 || pFile == nullptr) + if (pFile == (FILE *)-1 || pFile == NULL) { //fprintf(stderr,"CAutoLog::Log called with no file open!\n"); return; @@ -250,7 +250,7 @@ void CAutoLog::Log(eLogLevel severity, char *fmt, ...) void CAutoLog::Archive(void) //------------------------------------- { - if( pFile == (FILE *)-1 || pFile == nullptr) + if( pFile == (FILE *)-1 || pFile == NULL) { //fprintf(stderr,"CAutoLog::Archive called with no file open!\n"); return; @@ -281,7 +281,7 @@ void CAutoLog::Archive(void) strcpy(strCurrent,pFilename); pCurrent = strrchr(strCurrent, SLASHCHAR[0]); - if (pCurrent != nullptr) + if (pCurrent != NULL) *pCurrent = 0; else sprintf(strCurrent,"."); @@ -290,7 +290,7 @@ void CAutoLog::Archive(void) #ifdef WIN32 // remember current directory - if( getcwd(curdir,sizeof(curdir)) == nullptr ) + if( getcwd(curdir,sizeof(curdir)) == NULL ) { fprintf(stderr,"CAutoLog::Archive failed to get current directory!\n"); return; // error, can't proceed @@ -324,7 +324,7 @@ void CAutoLog::Archive(void) #endif pCurrent = strrchr(pFilename, SLASHCHAR[0]); - if (pCurrent == nullptr) + if (pCurrent == NULL) pCurrent = pFilename; else pCurrent++; diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/AutoLog.h b/external/3rd/library/soePlatform/CSAssist/utils/Base/AutoLog.h index 18871c7f..0a90a774 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/AutoLog.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/AutoLog.h @@ -92,14 +92,14 @@ namespace Base //------------------------------------- inline CAutoLog::CAutoLog() { - pFilename = nullptr; + pFilename = NULL; pFile = (FILE *)-1; } //------------------------------------- inline CAutoLog::CAutoLog(const char * file) { - pFilename = nullptr; + pFilename = NULL; pFile = (FILE *)-1; Open(file); } diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/Config.cpp b/external/3rd/library/soePlatform/CSAssist/utils/Base/Config.cpp index 97abcd41..a5b977fb 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/Config.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/Config.cpp @@ -28,7 +28,7 @@ bool CConfig::LoadFile(char * file) // open file fp = fopen(file, "r"); - if (fp == nullptr || fp == (FILE *)-1) + if (fp == NULL || fp == (FILE *)-1) { //fprintf(stderr,"Failed to open config file %s!",file); return false; @@ -72,21 +72,21 @@ void CConfig::UnloadFile(void) //----------------------------------- { delete[] pConfig; - pConfig = nullptr; + pConfig = NULL; } //----------------------------------- /// finds a key of the config in memory // key argument is case-insensitive, but must be upper case in config file -// Returns true for success (passing nullptr is a special case returned as success) +// Returns true for success (passing NULL is a special case returned as success) bool CConfig::FindKey(char *key) //----------------------------------- { - if (pConfig == nullptr) + if (pConfig == NULL) return false; // special case...continue with existing key - if (key == nullptr) + if (key == NULL) return true; // form the search key @@ -97,12 +97,12 @@ bool CConfig::FindKey(char *key) // find the key heading pCursor = strstr(pConfig,strBuffer); - if (pCursor==nullptr) + if (pCursor==NULL) return false; // find the closing bracket of key heading pCursor = strchr(pCursor,']'); - if (pCursor==nullptr) + if (pCursor==NULL) return false; pCursor++; @@ -111,7 +111,7 @@ bool CConfig::FindKey(char *key) //----------------------------------- /// extract a number from the config string -// pass the key to find the first number in the list, else nullptr to find the next number in the list +// pass the key to find the first number in the list, else NULL to find the next number in the list // returns 0 if no number is found, else returns the number long CConfig::GetLong(char *key) //----------------------------------- @@ -134,20 +134,20 @@ long CConfig::GetLong(char *key) //----------------------------------- /// extract string (in double-quotes) from the list. -// pass the key to find the first string in the list, else nullptr to find the next string in the list -// returns nullptr if no string found, else returns a temporary copy of the string (without quotes) +// pass the key to find the first string in the list, else NULL to find the next string in the list +// returns NULL if no string found, else returns a temporary copy of the string (without quotes) char * CConfig::GetString(char *key) //----------------------------------- { if (!FindKey(key)) - return nullptr; + return NULL; // look for start of string or end of key while (*pCursor && *pCursor != '"' && *pCursor != '[') pCursor++; if (*(pCursor++) != '"') - return nullptr; + return NULL; // until closing quote int c = 0; @@ -161,7 +161,7 @@ char * CConfig::GetString(char *key) } } - return nullptr; + return NULL; } diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/Config.h b/external/3rd/library/soePlatform/CSAssist/utils/Base/Config.h index 6f6dc376..864506f3 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/Config.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/Config.h @@ -10,7 +10,7 @@ ; list of strings, with code example # config.FindKey("NUMBERS"); -# while (number = config.GetLong(nullptr)) +# while (number = config.GetLong(NULL)) # YourHandleNumber(number); [NUMBERS] 100 200, 300 ; formatting is very flexible as long as numbers are delimited by non-numbers @@ -23,7 +23,7 @@ ; list of strings, with code example # config.FindKey("HOSTS"); -# while (string = config.GetString(nullptr)) +# while (string = config.GetString(NULL)) # YourHandleString(string); [HOSTS] "127.0.0.1:5999" @@ -68,16 +68,16 @@ namespace Base // returns TRUE if key is found. bool FindKey(char *key); - // extract string from config. If key is nullptr, extract next string in list, else extract first string. - // if key was not found, returns nullptr - char * GetString(char *key = nullptr); + // extract string from config. If key is NULL, extract next string in list, else extract first string. + // if key was not found, returns NULL + char * GetString(char *key = NULL); - // extract number from config. If key is nullptr, extract next number in list, else extract first number. + // extract number from config. If key is NULL, extract next number in list, else extract first number. // if key was not found, returns 0 - long GetLong(char *key = nullptr); // extract number from config. + long GetLong(char *key = NULL); // extract number from config. // indicate if config file has been loaded - inline bool FileLoaded() { return pConfig == nullptr ? false : true; } + inline bool FileLoaded() { return pConfig == NULL ? false : true; } private: char * pConfig; // pointer to file memory @@ -87,14 +87,14 @@ namespace Base inline CConfig::CConfig() { - pConfig = nullptr; - pCursor = nullptr; + pConfig = NULL; + pCursor = NULL; } inline CConfig::CConfig(char * file) { - pConfig = nullptr; - pCursor = nullptr; + pConfig = NULL; + pCursor = NULL; LoadFile(file); } diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/Logger.cpp b/external/3rd/library/soePlatform/CSAssist/utils/Base/Logger.cpp index bf3dcc39..1ce102af 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/Logger.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/Logger.cpp @@ -98,7 +98,7 @@ Logger::Logger(const char *programName, void Logger::LoggerInit(const char *programName) { char buf[1024]; - FILE *logDir = nullptr; + FILE *logDir = NULL; if (0 != (m_logType & eUseLocalFile)) { @@ -107,13 +107,13 @@ void Logger::LoggerInit(const char *programName) { cmkdir(m_dirPrefix.c_str(), 0755); } - else if(logDir != nullptr) + else if(logDir != NULL) { fclose(logDir); } tm now; - time_t t = time(nullptr); + time_t t = time(NULL); LOGGER_GET_CURR_TIME(now, t); @@ -131,7 +131,7 @@ void Logger::LoggerInit(const char *programName) { cmkdir(buf, 0755); } - else if(logDir != nullptr) + else if(logDir != NULL) { fclose(logDir); } @@ -300,7 +300,7 @@ void Logger::logSimple(unsigned logenum, int level, const char *message) { return; } - time_t t = time(nullptr); + time_t t = time(NULL); LogInfo *info = (*iter).second; if(level >= info->level) { @@ -377,7 +377,7 @@ void Logger::logSimpleWithSys(unsigned logenum, unsigned priority, int level, co { return; } - time_t t = time(nullptr); + time_t t = time(NULL); LogInfo *info = (*iter).second; if(level >= info->level) @@ -447,7 +447,7 @@ void Logger::log(unsigned logenum, int level, const char *message, ...) // ensure that the buf does not contain any '%' characters. // prevent crash problem char *rv; - while((rv = strchr(buf, '%')) != nullptr) + while((rv = strchr(buf, '%')) != NULL) { *rv = ' '; // replace with space } @@ -478,7 +478,7 @@ void Logger::logWithSys(unsigned logenum, unsigned priority, int level, const ch { return; } - time_t t = time(nullptr); + time_t t = time(NULL); LogInfo *info = (*iter).second; if(level >= info->level) @@ -536,14 +536,14 @@ void Logger::logWithSys(unsigned logenum, unsigned priority, int level, const ch void Logger::rollDate(time_t t) { char buf[80]; - FILE *logDir = nullptr; + FILE *logDir = NULL; logDir = fopen(m_dirPrefix.c_str(), "r+"); if(errno == ENOENT) { cmkdir(m_dirPrefix.c_str(), 0755); } - else if(logDir != nullptr) + else if(logDir != NULL) { fclose(logDir); } @@ -559,7 +559,7 @@ void Logger::rollDate(time_t t) { cmkdir(buf, 0755); } - else if(logDir != nullptr) + else if(logDir != NULL) { fclose(logDir); } @@ -643,7 +643,7 @@ void Logger::rollLog(LogInfo *logInfo) { std::string newLogName; char timeStampBuffer[256]; - time_t t = time(nullptr); + time_t t = time(NULL); tm now; int r; int nTries = 10; diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/Statistics.h b/external/3rd/library/soePlatform/CSAssist/utils/Base/Statistics.h index 0856034b..18e0579e 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/Statistics.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/Statistics.h @@ -34,9 +34,9 @@ namespace Base bool commit = false; if (!mLastSampleTime) - mLastSampleTime = time(nullptr); + mLastSampleTime = time(NULL); - if (!mSampleFrequency || mLastSampleTime + mSampleFrequency < (unsigned)time(nullptr)) + if (!mSampleFrequency || mLastSampleTime + mSampleFrequency < (unsigned)time(NULL)) { mSampleTotal++; mAggregateTotal += value; diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/TemplateObjectAllocator.h b/external/3rd/library/soePlatform/CSAssist/utils/Base/TemplateObjectAllocator.h index ed1a7937..40227673 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/TemplateObjectAllocator.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/TemplateObjectAllocator.h @@ -93,7 +93,7 @@ namespace Base void Destroy(TYPE *object) { - if (object == nullptr) + if (object == NULL) return; #ifdef USE_ALLOCATOR_MUTEX @@ -142,7 +142,7 @@ namespace Base void FastDestroy(TYPE *object) { - if (object == nullptr) + if (object == NULL) return; object->~TYPE(); diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/WideString.h b/external/3rd/library/soePlatform/CSAssist/utils/Base/WideString.h index 28159b18..775f9713 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/WideString.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/WideString.h @@ -94,12 +94,12 @@ namespace ucs2 } //////////////////////////////////////// - // target string is a nullptr-terminated C string + // target string is a null-terminated C string inline string::string(const char * copy) : mLength(0), mData(8,0) { - // (1) protect from nullptr pointer + // (1) protect from null pointer if (!copy) { return; @@ -111,12 +111,12 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *copy++; } - // (3) ensure nullptr termination + // (3) ensure null termination mData[mLength]=0; } //////////////////////////////////////// - // target string is a C string that may or may not include nullptr characters + // target string is a C string that may or may not include null characters inline string::string(const std::string & copy) : mLength(copy.length()), mData(8,0) @@ -126,17 +126,17 @@ namespace ucs2 // (2) perform transform to copy the narrow string to our // wide string std::transform(copy.begin(), copy.end(), mData.begin(), NarrowToWide); - // (3) ensure nullptr termination + // (3) ensure null termination mData[mLength] = 0; } //////////////////////////////////////// - // target string is a wide nullptr-terminated C string + // target string is a wide null-terminated C string inline string::string(const char_type * copy) : mLength(0), mData(8,0) { - // (1) protect from nullptr pointer + // (1) protect from null pointer if (!copy) { return; @@ -148,7 +148,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *copy++; } - // (3) ensure nullptr termination + // (3) ensure null termination mData[mLength]=0; } @@ -169,7 +169,7 @@ namespace ucs2 inline string & string::operator=(const char * rhs) { mLength = 0; - // (1) protect from nullptr pointer + // (1) protect from null pointer if (!rhs) { mData[0] = 0; @@ -182,7 +182,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure nullptr termination + // (3) ensure null termination mData[mLength]=0; return *this; } @@ -195,7 +195,7 @@ namespace ucs2 // (2) perform transform to copy the narrow string to our // wide string std::transform(rhs.begin(), rhs.end(), mData.begin(), NarrowToWide); - // (3) ensure nullptr termination + // (3) ensure null termination mData[mLength] = 0; return *this; } @@ -203,7 +203,7 @@ namespace ucs2 inline string & string::operator=(const char_type * rhs) { mLength = 0; - // (1) protect from nullptr pointer + // (1) protect from null pointer if (!rhs) { mData[0] = 0; @@ -216,7 +216,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure nullptr termination + // (3) ensure null termination mData[mLength]=0; return *this; } @@ -235,7 +235,7 @@ namespace ucs2 inline string & string::operator+=(const char * rhs) { - // (1) protect from nullptr pointer + // (1) protect from null pointer if (!rhs) { return *this; @@ -247,7 +247,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure nullptr termination + // (3) ensure null termination mData[mLength]=0; return *this; } @@ -259,7 +259,7 @@ namespace ucs2 // (2) perform transform to copy the narrow string to our // wide string std::transform(rhs.begin(), rhs.end(), mData.begin()+mLength, NarrowToWide); - // (3) ensure nullptr termination + // (3) ensure null termination mLength += rhs.length(); mData[mLength] = 0; return *this; @@ -267,7 +267,7 @@ namespace ucs2 inline string & string::operator+=(const char_type * rhs) { - // (1) protect from nullptr pointer + // (1) protect from null pointer if (!rhs) { return *this; @@ -279,7 +279,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure nullptr termination + // (3) ensure null termination mData[mLength]=0; return *this; } @@ -388,7 +388,7 @@ namespace ucs2 inline string & string::assign(const char_type * rhs) { mLength = 0; - // (1) protect from nullptr pointer + // (1) protect from null pointer if (!rhs) { mData[0] = 0; @@ -401,7 +401,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure nullptr termination + // (3) ensure null termination mData[mLength]=0; return *this; } @@ -409,7 +409,7 @@ namespace ucs2 inline string & string::assign(const char_type * rhs, size_type count) { mLength = 0; - // (1) protect from nullptr pointer + // (1) protect from null pointer if (!rhs) { mData[0] = 0; @@ -422,7 +422,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure nullptr termination + // (3) ensure null termination mData[mLength]=0; return *this; } @@ -463,7 +463,7 @@ namespace ucs2 inline string & string::assign(const char_type * first, const char_type * last) { mLength = 0; - // (1) protect from nullptr pointer + // (1) protect from null pointer if (!first || !last) { mData[0] = 0; @@ -476,14 +476,14 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *first++; } - // (3) ensure nullptr termination + // (3) ensure null termination mData[mLength]=0; return *this; } inline string & string::append(const char_type * rhs) { - // (1) protect from nullptr pointer + // (1) protect from null pointer if (!rhs) { return *this; @@ -495,14 +495,14 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure nullptr termination + // (3) ensure null termination mData[mLength]=0; return *this; } inline string & string::append(const char_type * rhs, size_type count) { - // (1) protect from nullptr pointer + // (1) protect from null pointer if (!rhs) { return *this; @@ -514,7 +514,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure nullptr termination + // (3) ensure null termination mData[mLength]=0; return *this; } @@ -558,7 +558,7 @@ namespace ucs2 inline string & string::append(const char_type * first, const char_type * last) { - // (1) protect from nullptr pointer + // (1) protect from null pointer if (!first || !last) { return *this; @@ -570,7 +570,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *first++; } - // (3) ensure nullptr termination + // (3) ensure null termination mData[mLength]=0; return *this; } diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/BlockAllocator.cpp b/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/BlockAllocator.cpp index 29d91074..4cefb9e7 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/BlockAllocator.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/BlockAllocator.cpp @@ -12,7 +12,7 @@ namespace Base { for(unsigned i = 0; i < 31; i++) { - m_blocks[i] = nullptr; + m_blocks[i] = NULL; } } @@ -21,7 +21,7 @@ namespace Base // free all allocated memory blocks for(unsigned i = 0; i < 31; i++) { - while(m_blocks[i] != nullptr) + while(m_blocks[i] != NULL) { unsigned *tmp = m_blocks[i]; m_blocks[i] = (unsigned *)*m_blocks[i]; @@ -36,7 +36,7 @@ namespace Base void *BlockAllocator::getBlock(unsigned bytes) { unsigned accum = 16, bits = 16; - unsigned *handle = nullptr; + unsigned *handle = NULL; // Perform a binary search looking for the highest bit. @@ -96,7 +96,7 @@ namespace Base void BlockAllocator::returnBlock(unsigned *handle) { - // C++ allows for safe deletion of a nullptr pointer + // C++ allows for safe deletion of a NULL pointer if(handle) { // Update the allocator linked list, insert this entry at the head diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/Event.cpp b/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/Event.cpp index 72190595..a3cce3b1 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/Event.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/Event.cpp @@ -26,8 +26,8 @@ namespace Base mCond(), mThreadCount(0) { - pthread_mutex_init(&mMutex, nullptr); - pthread_cond_init(&mCond, nullptr); + pthread_mutex_init(&mMutex, NULL); + pthread_cond_init(&mCond, NULL); } CEvent::~CEvent() @@ -74,7 +74,7 @@ namespace Base struct timeval now; struct timespec abs_timeout; - gettimeofday(&now, nullptr); + gettimeofday(&now, NULL); abs_timeout.tv_sec = now.tv_sec + timeout/1000; abs_timeout.tv_nsec = now.tv_usec * 1000 + (timeout%1000)*1000000; abs_timeout.tv_sec += abs_timeout.tv_nsec / 1000000000; diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/Thread.cpp b/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/Thread.cpp index 5cca2017..2bc4f26b 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/Thread.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/Thread.cpp @@ -76,8 +76,8 @@ namespace Base CThreadPool::CMember::CMember(CThreadPool * parent) : mParent(parent), - mFunction(nullptr), - mArgument(nullptr), + mFunction(NULL), + mArgument(NULL), mSemaphore() { StartThread(); @@ -116,8 +116,8 @@ namespace Base if (mFunction) { mFunction(mArgument); - mArgument = nullptr; - mFunction = nullptr; + mArgument = NULL; + mFunction = NULL; } else if (mParent->OnDestory(this)) mThreadContinue = false; @@ -172,7 +172,7 @@ namespace Base } //////////////////////////////////////// - // (3) Delete the nullptr member threads + // (3) Delete the null member threads mMutex.Lock(); while (!mNullMember.empty()) { @@ -199,7 +199,7 @@ namespace Base } //////////////////////////////////////// - // (2) Delete any nullptr member threads. + // (2) Delete any null member threads. while (!mNullMember.empty()) { delete mNullMember.front(); diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/serialize.h b/external/3rd/library/soePlatform/CSAssist/utils/Base/serialize.h index ed38802a..650681b5 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/serialize.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/serialize.h @@ -501,8 +501,8 @@ namespace soe } else { - //find nullptr terminator, if don't find it before maxLen, then err - const unsigned char *strEnd = nullptr; + //find null terminator, if don't find it before maxLen, then err + const unsigned char *strEnd = NULL; unsigned strLen = 0; for (;strLenm_next; - tmp->m_next = nullptr; + tmp->m_next = NULL; m_numAvailBlocks--; return(tmp); } @@ -56,7 +56,7 @@ void TcpBlockAllocator::returnBlock(data_block *b) void TcpBlockAllocator::realloc() { - data_block *tmp = nullptr, *cursor = nullptr; + data_block *tmp = NULL, *cursor = NULL; tmp = new data_block; m_numAvailBlocks++; cursor = tmp; diff --git a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpConnection.cpp b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpConnection.cpp index c74eaca4..97ca7fd1 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpConnection.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpConnection.cpp @@ -11,28 +11,28 @@ namespace NAMESPACE //used when want to open new connection with this socket TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, const IPAddress &destIP, short destPort, unsigned timeout) -: m_nextConnection(nullptr), - m_prevConnection(nullptr), +: m_nextConnection(NULL), + m_prevConnection(NULL), m_socket(INVALID_SOCKET), - m_nextKeepAliveConnection(nullptr), - m_prevKeepAliveConnection(nullptr), + m_nextKeepAliveConnection(NULL), + m_prevKeepAliveConnection(NULL), m_aliveListId(tcpManager->m_aliveList.m_listID), - m_nextRecvDataConnection(nullptr), - m_prevRecvDataConnection(nullptr), + m_nextRecvDataConnection(NULL), + m_prevRecvDataConnection(NULL), m_recvDataListId(tcpManager->m_dataList.m_listID), m_manager(tcpManager), m_status(StatusNegotiating), - m_handler(nullptr), + m_handler(NULL), m_destIP(destIP), m_destPort(destPort), m_refCount(0), m_sendAllocator(sendAlloc), - m_head(nullptr), - m_tail(nullptr), + m_head(NULL), + m_tail(NULL), m_bytesRead(0), m_bytesNeeded(0), m_params(params), - m_recvBuff(nullptr), + m_recvBuff(NULL), m_connectTimeout(timeout), m_connectTimer(), m_wasConRemovedFromMgr(false) @@ -94,28 +94,28 @@ TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAllo //used when server mode creates new connection object representing a connect request TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, SOCKET socket, const IPAddress &destIP, short destPort) -: m_nextConnection(nullptr), - m_prevConnection(nullptr), +: m_nextConnection(NULL), + m_prevConnection(NULL), m_socket(socket), - m_nextKeepAliveConnection(nullptr), - m_prevKeepAliveConnection(nullptr), + m_nextKeepAliveConnection(NULL), + m_prevKeepAliveConnection(NULL), m_aliveListId(tcpManager->m_aliveList.m_listID), - m_nextRecvDataConnection(nullptr), - m_prevRecvDataConnection(nullptr), + m_nextRecvDataConnection(NULL), + m_prevRecvDataConnection(NULL), m_recvDataListId(tcpManager->m_dataList.m_listID), m_manager(tcpManager), m_status(StatusConnected), - m_handler(nullptr), + m_handler(NULL), m_destIP(destIP), m_destPort(destPort), m_refCount(0), m_sendAllocator(sendAlloc), - m_head(nullptr), - m_tail(nullptr), + m_head(NULL), + m_tail(NULL), m_bytesRead(0), m_bytesNeeded(0), m_params(params), - m_recvBuff(nullptr), + m_recvBuff(NULL), m_connectTimeout(0), m_connectTimer(), m_wasConRemovedFromMgr(false) @@ -205,7 +205,7 @@ int TcpConnection::finishConnect() t.tv_sec = 0; t.tv_usec = 0; - int err = select(m_socket + 1, nullptr, &wrSet, nullptr, &t); + int err = select(m_socket + 1, NULL, &wrSet, NULL, &t); if (err == 0) { @@ -300,7 +300,7 @@ TcpConnection::~TcpConnection() { delete [] m_recvBuff; - while(m_head != nullptr) + while(m_head != NULL) { data_block *tmp = m_head; m_head = m_head->m_next; @@ -324,22 +324,22 @@ void TcpConnection::Send(const char *data, unsigned int dataLen) { m_aliveListId = m_manager->m_keepAliveList.m_listID; - if (m_prevKeepAliveConnection != nullptr) + if (m_prevKeepAliveConnection != NULL) m_prevKeepAliveConnection->m_nextKeepAliveConnection = m_nextKeepAliveConnection; - if (m_nextKeepAliveConnection != nullptr) + if (m_nextKeepAliveConnection != NULL) m_nextKeepAliveConnection->m_prevKeepAliveConnection = m_prevKeepAliveConnection; if (m_manager->m_keepAliveList.m_beginList == this) m_manager->m_keepAliveList.m_beginList = m_nextKeepAliveConnection; m_nextKeepAliveConnection = m_manager->m_aliveList.m_beginList; - m_prevKeepAliveConnection = nullptr; - if (m_manager->m_aliveList.m_beginList != nullptr) + m_prevKeepAliveConnection = NULL; + if (m_manager->m_aliveList.m_beginList != NULL) m_manager->m_aliveList.m_beginList->m_prevKeepAliveConnection = this; m_manager->m_aliveList.m_beginList = this; } - data_block *work = nullptr; + data_block *work = NULL; // this connection has no send buffer. Get a block if(!m_tail) @@ -464,16 +464,16 @@ int TcpConnection::processIncoming() { m_recvDataListId = m_manager->m_noDataList.m_listID; - if (m_prevRecvDataConnection != nullptr) + if (m_prevRecvDataConnection != NULL) m_prevRecvDataConnection->m_nextRecvDataConnection = m_nextRecvDataConnection; - if (m_nextRecvDataConnection != nullptr) + if (m_nextRecvDataConnection != NULL) m_nextRecvDataConnection->m_prevRecvDataConnection = m_prevRecvDataConnection; if (m_manager->m_noDataList.m_beginList == this) m_manager->m_noDataList.m_beginList = m_nextRecvDataConnection; m_nextRecvDataConnection = m_manager->m_dataList.m_beginList; - m_prevRecvDataConnection = nullptr; - if (m_manager->m_dataList.m_beginList != nullptr) + m_prevRecvDataConnection = NULL; + if (m_manager->m_dataList.m_beginList != NULL) m_manager->m_dataList.m_beginList->m_prevRecvDataConnection = this; m_manager->m_dataList.m_beginList = this; } @@ -619,7 +619,7 @@ int TcpConnection::processOutgoing() int sendError = 1; - // If m_head is not nullptr, then this connection has something to send + // If m_head is not null, then this connection has something to send if(m_head) diff --git a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpConnection.h b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpConnection.h index 92d631d1..07eb4f42 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpConnection.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpConnection.h @@ -50,7 +50,7 @@ public: * connection is disconnected, you simply need to derive your class * (multiply if necessary) from TcpConnectionHandler, then you can use * this method to set the object the TcpConnection will call as appropriate. - * default = nullptr (no callbacks made) + * default = NULL (no callbacks made) * * @param handler The object which will be called for notifications. */ diff --git a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpManager.cpp b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpManager.cpp index 86778910..29d51de0 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpManager.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpManager.cpp @@ -41,14 +41,14 @@ TcpManager::TcpParams::TcpParams(const TcpParams &cpy) } TcpManager::TcpManager(const TcpParams ¶ms) -: m_handler(nullptr), - m_keepAliveList(nullptr, 1), - m_aliveList(nullptr, 2), - m_noDataList(nullptr, 1), - m_dataList(nullptr, 2), +: m_handler(NULL), + m_keepAliveList(NULL, 1), + m_aliveList(NULL, 2), + m_noDataList(NULL, 1), + m_dataList(NULL, 2), m_params(params), m_refCount(1), - m_connectionList(nullptr), + m_connectionList(NULL), m_connectionListCount(0), m_socket(INVALID_SOCKET), m_boundAsServer(false), @@ -86,7 +86,7 @@ TcpManager::~TcpManager() close(m_socket); #endif } - while (m_connectionList != nullptr) + while (m_connectionList != NULL) { TcpConnection *con = m_connectionList; m_connectionList = m_connectionList->m_nextConnection; @@ -162,7 +162,7 @@ bool TcpManager::BindAsServer() { struct hostent * lphp; lphp = gethostbyname(m_params.bindAddress); - if (lphp != nullptr) + if (lphp != NULL) addr_loc.sin_addr.s_addr = ((struct in_addr *)(lphp->h_addr))->s_addr; } else @@ -187,7 +187,7 @@ bool TcpManager::BindAsServer() TcpConnection *TcpManager::acceptClient() { - TcpConnection *newConn = nullptr; + TcpConnection *newConn = NULL; if (m_boundAsServer && m_connectionListCount < m_params.maxConnections) { @@ -201,7 +201,7 @@ TcpConnection *TcpManager::acceptClient() { newConn = new TcpConnection(this, &m_allocator, m_params, sock, IPAddress(addr.sin_addr.s_addr), ntohs(addr.sin_port)); addNewConnection(newConn); - if (m_handler != nullptr) + if (m_handler != NULL) { m_handler->OnConnectRequest(newConn); } @@ -226,8 +226,8 @@ SOCKET TcpManager::getMaxFD() if (m_boundAsServer) maxfd = m_socket+1; - TcpConnection *next = nullptr; - for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) + TcpConnection *next = NULL; + for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) { next = con->m_nextConnection; if (con->GetStatus() != TcpConnection::StatusDisconnected && con->m_socket > maxfd) @@ -241,8 +241,8 @@ SOCKET TcpManager::getMaxFD() TcpConnection *TcpManager::getConnection(SOCKET fd) { - TcpConnection *next = nullptr; - for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) + TcpConnection *next = NULL; + for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) { next = con->m_nextConnection; if (con->m_socket == fd) @@ -251,7 +251,7 @@ TcpConnection *TcpManager::getConnection(SOCKET fd) } } //if get here ,couldn't find it - return nullptr; + return NULL; } bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendTimePerConnection, unsigned maxRecvTimePerConnection) @@ -273,8 +273,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT { // Send output from last heartbeat - TcpConnection *next = nullptr; - for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) + TcpConnection *next = NULL; + for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) { con->AddRef(); if (next) next->Release(); @@ -341,7 +341,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT tmpfds = m_permfds; timeout.tv_sec = 0; timeout.tv_usec = 0; - int cnt = select(maxfd, &tmpfds, nullptr, nullptr, &timeout); // blocks for timeout + int cnt = select(maxfd, &tmpfds, NULL, NULL, &timeout); // blocks for timeout if (cnt > 0) @@ -367,8 +367,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //process incoming client messages if (maxRecvTimePerConnection != 0) { - TcpConnection *next = nullptr; - for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) + TcpConnection *next = NULL; + for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) { con->AddRef(); if (next) next->Release(); @@ -433,8 +433,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT pollfds[0].events |= POLLIN; } - TcpConnection *next = nullptr; - for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next, idx++) + TcpConnection *next = NULL; + for (TcpConnection *con = m_connectionList ; con != NULL ; con = next, idx++) { next = con->m_nextConnection; pollfds[idx].fd = con->m_socket; @@ -474,7 +474,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT } //process regular msg(s) - if (con == nullptr) + if (con == NULL) { close(pollfds[idx].fd); continue; @@ -506,7 +506,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT }//if(pollfds[... else if (pollfds[idx].revents & POLLHUP) { - if (con == nullptr) + if (con == NULL) { close(pollfds[idx].fd); continue; @@ -524,21 +524,21 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //now process any keepalives, if time to do that if (m_params.keepAliveDelay > 0 && m_keepAliveTimer.isDone(m_params.keepAliveDelay)) { - TcpConnection *next = nullptr; - for (TcpConnection *con = m_keepAliveList.m_beginList ; con != nullptr ; con = next) + TcpConnection *next = NULL; + for (TcpConnection *con = m_keepAliveList.m_beginList ; con != NULL ; con = next) { con->AddRef(); if (next) next->Release(); next = con->m_nextKeepAliveConnection; if (next) next->AddRef(); - con->Send(nullptr, 0); //note: this request will move the connection from the keepAliveList to the aliveList + con->Send(NULL, 0); //note: this request will move the connection from the keepAliveList to the aliveList con->Release(); } //now move the complete alive list over to the keepalive list to reset those timers m_keepAliveList.m_beginList = m_aliveList.m_beginList; - m_aliveList.m_beginList = nullptr; + m_aliveList.m_beginList = NULL; //switch id's for those connections that were in the alive list last go - around int tmpID = m_aliveList.m_listID; @@ -552,8 +552,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //now process any noDataCons, if time to do that if (m_params.noDataTimeout > 0 && m_noDataTimer.isDone(m_params.noDataTimeout)) { - TcpConnection *next = nullptr; - for (TcpConnection *con = m_noDataList.m_beginList ; con != nullptr ; con = next) + TcpConnection *next = NULL; + for (TcpConnection *con = m_noDataList.m_beginList ; con != NULL ; con = next) { con->AddRef(); if (next) next->Release(); @@ -567,7 +567,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //now move the complete data list over to the nodata list to reset those timers m_noDataList.m_beginList = m_dataList.m_beginList; - m_dataList.m_beginList = nullptr; + m_dataList.m_beginList = NULL; //switch id's for those connections that were in the data list last go - around int tmpID = m_dataList.m_listID; @@ -589,11 +589,11 @@ TcpConnection *TcpManager::EstablishConnection(const char *serverAddress, unsign { //can't open outgoing connections when in server mode // use a different TcpManager to do that - return nullptr; + return NULL; } if (m_connectionListCount >= m_params.maxConnections) - return(nullptr); + return(NULL); // get server address unsigned long address = inet_addr(serverAddress); @@ -601,8 +601,8 @@ TcpConnection *TcpManager::EstablishConnection(const char *serverAddress, unsign { struct hostent * lphp; lphp = gethostbyname(serverAddress); - if (lphp == nullptr) - return(nullptr); + if (lphp == NULL) + return(NULL); address = ((struct in_addr *)(lphp->h_addr))->s_addr; } IPAddress destIP(address); @@ -622,22 +622,22 @@ void TcpManager::addNewConnection(TcpConnection *con) FD_SET(con->m_socket, &m_permfds); #endif con->m_nextConnection = m_connectionList; - con->m_prevConnection = nullptr; - if (m_connectionList != nullptr) + con->m_prevConnection = NULL; + if (m_connectionList != NULL) m_connectionList->m_prevConnection = con; m_connectionList = con; m_connectionListCount++; con->m_nextKeepAliveConnection = m_aliveList.m_beginList; - con->m_prevKeepAliveConnection = nullptr; - if (m_aliveList.m_beginList != nullptr) + con->m_prevKeepAliveConnection = NULL; + if (m_aliveList.m_beginList != NULL) m_aliveList.m_beginList->m_prevKeepAliveConnection = con; m_aliveList.m_beginList = con; con->m_aliveListId = m_keepAliveList.m_listID;//start it out thinking it's already in the alive list, since it is con->m_nextRecvDataConnection = m_dataList.m_beginList; - con->m_prevRecvDataConnection = nullptr; - if (m_dataList.m_beginList != nullptr) + con->m_prevRecvDataConnection = NULL; + if (m_dataList.m_beginList != NULL) m_dataList.m_beginList->m_prevRecvDataConnection = con; m_dataList.m_beginList = con; con->m_recvDataListId = m_noDataList.m_listID;//start it out thinking it's already in the data list, since it is @@ -655,40 +655,40 @@ void TcpManager::removeConnection(TcpConnection *con) FD_CLR(con->m_socket, &m_permfds); } #endif - if (con->m_prevConnection != nullptr) + if (con->m_prevConnection != NULL) con->m_prevConnection->m_nextConnection = con->m_nextConnection; - if (con->m_nextConnection != nullptr) + if (con->m_nextConnection != NULL) con->m_nextConnection->m_prevConnection = con->m_prevConnection; if (m_connectionList == con) m_connectionList = con->m_nextConnection; - con->m_nextConnection = nullptr; - con->m_prevConnection = nullptr; + con->m_nextConnection = NULL; + con->m_prevConnection = NULL; - if (con->m_prevKeepAliveConnection != nullptr) + if (con->m_prevKeepAliveConnection != NULL) con->m_prevKeepAliveConnection->m_nextKeepAliveConnection = con->m_nextKeepAliveConnection; - if (con->m_nextKeepAliveConnection != nullptr) + if (con->m_nextKeepAliveConnection != NULL) con->m_nextKeepAliveConnection->m_prevKeepAliveConnection = con->m_prevKeepAliveConnection; if (m_aliveList.m_beginList == con) m_aliveList.m_beginList = con->m_nextKeepAliveConnection; else if (m_keepAliveList.m_beginList == con) m_keepAliveList.m_beginList = con->m_nextKeepAliveConnection; - con->m_nextKeepAliveConnection = nullptr; - con->m_prevKeepAliveConnection = nullptr; + con->m_nextKeepAliveConnection = NULL; + con->m_prevKeepAliveConnection = NULL; - if (con->m_prevRecvDataConnection != nullptr) + if (con->m_prevRecvDataConnection != NULL) con->m_prevRecvDataConnection->m_nextRecvDataConnection = con->m_nextRecvDataConnection; - if (con->m_nextRecvDataConnection != nullptr) + if (con->m_nextRecvDataConnection != NULL) con->m_nextRecvDataConnection->m_prevRecvDataConnection = con->m_prevRecvDataConnection; if (m_dataList.m_beginList == con) m_dataList.m_beginList = con->m_nextRecvDataConnection; else if (m_noDataList.m_beginList == con) m_noDataList.m_beginList = con->m_nextRecvDataConnection; - con->m_nextRecvDataConnection = nullptr; - con->m_prevRecvDataConnection = nullptr; + con->m_nextRecvDataConnection = NULL; + con->m_prevRecvDataConnection = NULL; diff --git a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpManager.h b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpManager.h index cdc01daa..32132069 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpManager.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpManager.h @@ -156,7 +156,7 @@ public: * simply need to derive your class (multiply if necessary) from TcpManagerHandler, then you can use * this method to set the object the TcpManager will call as appropriate. The TcpConnection object * also has a handler mechanism that replaces the other callback functions below, see TcpConnection::SetHandler - * default = nullptr (no callbacks made) + * default = NULL (no callbacks made) * * @param handler The object which will be called for manager related notifications. */ @@ -211,7 +211,7 @@ public: * the connect-complete callback to be called if the connection is succesfull. * * @return A pointer to a TcpConnection object. - * nullptr if the manager object has exceeded its maximum number of connections + * NULL if the manager object has exceeded its maximum number of connections * or if the serverAddress cannot be resolved to an IP address. */ TcpConnection *EstablishConnection(const char *serverAddress, unsigned short serverPort, unsigned timeout = 0); diff --git a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TestClient/TestClient.cpp b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TestClient/TestClient.cpp index 35423e88..075062d5 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TestClient/TestClient.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TestClient/TestClient.cpp @@ -42,7 +42,7 @@ void TestClient::process() { m_con->SetHandler(this); m_conState = CON_NEGOTIATE; - m_conTimeout = time(nullptr) + 20;//m_reconnectTimeout; + m_conTimeout = time(NULL) + 20;//m_reconnectTimeout; } break; case CON_NEGOTIATE: @@ -51,10 +51,10 @@ void TestClient::process() m_conState = CON_CONNECT; printf("callback here.... connected\n"); } - else if(time(nullptr) > 20) + else if(time(NULL) > 20) { m_con->Release(); - m_con = nullptr; + m_con = NULL; m_conState = CON_DISCONNECT; } break; @@ -63,7 +63,7 @@ void TestClient::process() default: m_conState = CON_DISCONNECT; m_con->Release(); - m_con = nullptr; + m_con = NULL; } m_manager->GiveTime(); } @@ -95,7 +95,7 @@ void TestClient::OnTerminated(TcpConnection *con) if (m_con) { m_con->Release(); - m_con = nullptr; + m_con = NULL; } m_conState = CON_DISCONNECT; } diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Unicode/UnicodeCharacterDataMap.h b/external/3rd/library/soePlatform/CSAssist/utils/Unicode/UnicodeCharacterDataMap.h index 493c5a2d..741a6e80 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Unicode/UnicodeCharacterDataMap.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/Unicode/UnicodeCharacterDataMap.h @@ -122,7 +122,7 @@ namespace Plat_Unicode /** * Find a CharData for the given code point. - * @return nullptr if no CharData exists for this code point + * @return null if no CharData exists for this code point */ inline const CharData * CharDataMap::findCharData (const unicode_char_t code) const diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Unicode/utf8.cpp b/external/3rd/library/soePlatform/CSAssist/utils/Unicode/utf8.cpp index e7df40e2..527f246d 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Unicode/utf8.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/Unicode/utf8.cpp @@ -87,7 +87,7 @@ int UTF8_convertCharToUTF16( char * ptr , UTF16 * ret ) int UTF8_convertToUTF16( char * ptr , UTF16 * ret, int limit ) { int len = 0; - while (( *ptr != 0 ) && ( len < ( limit - 1 ) ))//we use limit -1 to leave room for the nullptr terminator + while (( *ptr != 0 ) && ( len < ( limit - 1 ) ))//we use limit -1 to leave room for the null terminator { int clen = UTF8_convertCharToUTF16( ptr, ret ); ptr += clen; diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/Base/Archive.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/Base/Archive.cpp index 8ad45428..e3400df0 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/Base/Archive.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/Base/Archive.cpp @@ -91,7 +91,7 @@ namespace Base ByteStream::ByteStream() : allocatedSize(0), beginReadIterator(), - data(nullptr), + data(NULL), size(0), lastPutSize(0) { @@ -208,7 +208,7 @@ namespace Base if(data->size < allocatedSize) { unsigned char * tmp = new unsigned char[newSize]; - if(data->buffer != nullptr) + if(data->buffer != NULL) memcpy(tmp, data->buffer, size); delete[] data->buffer; data->buffer = tmp; diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericApiCore.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericApiCore.cpp index 527f5b69..2f68dd50 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericApiCore.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericApiCore.cpp @@ -117,7 +117,7 @@ unsigned GenericAPICore::submitRequest(GenericRequest *req, GenericResponse *res } req->setTrack(m_currTrack); res->setTrack(m_currTrack); - time_t timeout = time(nullptr) + m_requestTimeout; + time_t timeout = time(NULL) + m_requestTimeout; req->setTimeout(timeout); res->setTimeout(timeout); @@ -136,7 +136,7 @@ void GenericAPICore::process() if (!m_suspended) { // Process timeout on pending requests - while((m_outCount > 0) && ((req = m_outboundQueue.front().first)->getTimeout() <= time(nullptr))) + while((m_outCount > 0) && ((req = m_outboundQueue.front().first)->getTimeout() <= time(NULL))) { --m_outCount; res = m_outboundQueue.front().second; @@ -148,7 +148,7 @@ void GenericAPICore::process() } // Process timeout on pending responses - while((m_pendingCount > 0) && ((res = (*m_pending.begin()).second)->getTimeout() <= time(nullptr))) + while((m_pendingCount > 0) && ((res = (*m_pending.begin()).second)->getTimeout() <= time(NULL))) { --m_pendingCount; m_pending.erase(m_pending.begin()); @@ -161,7 +161,7 @@ void GenericAPICore::process() pair out_pair = m_outboundQueue.front(); req = out_pair.first; res = out_pair.second; - GenericConnection *con = nullptr; + GenericConnection *con = NULL; if (req->getMappedServerTrack() == 0) // request has no originating "owner" server { con = getNextActiveConnection(); // it does not matter which server we send this to @@ -178,7 +178,7 @@ void GenericAPICore::process() } } - if (con != nullptr) + if (con != NULL) { Base::ByteStream msg; req->pack(msg); @@ -213,7 +213,7 @@ GenericConnection *GenericAPICore::getNextActiveConnection() unsigned startIndex = m_nextConnectionIndex; unsigned maxIndex = m_serverConnections.size() - 1; - GenericConnection *con = nullptr; + GenericConnection *con = NULL; //loop until we find an active connection, or until we get back // to where we started @@ -233,7 +233,7 @@ GenericConnection *GenericAPICore::getNextActiveConnection() //went past end of vector, start back at 0 m_nextConnectionIndex = 0; } - }while (con == nullptr && m_nextConnectionIndex != startIndex); + }while (con == NULL && m_nextConnectionIndex != startIndex); return con; } @@ -259,7 +259,7 @@ ServerTrackObject *GenericAPICore::findServer(unsigned server_track) { std::map::iterator iter = m_serverTracks.find(server_track); if (iter == m_serverTracks.end()) - return nullptr; + return NULL; ServerTrackObject *stobj = (*iter).second; m_serverTracks.erase(server_track); return stobj; diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericConnection.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericConnection.cpp index 2fd9ca45..ef652f08 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericConnection.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericConnection.cpp @@ -22,7 +22,7 @@ using namespace Base; GenericConnection::GenericConnection(const char *host, short port, GenericAPICore *apiCore, unsigned reconnectTimeout, unsigned noDataTimeoutSecs, unsigned noAckTimeoutSecs, unsigned incomingBufSizeInKB, unsigned outgoingBufSizeInKB, unsigned keepAlive, unsigned maxRecvMessageSizeInKB) : m_bConnected(CON_NONE), m_apiCore(apiCore), - m_con(nullptr), + m_con(NULL), m_host(host), m_port(port), m_lastTrack(123455), //random choice != 1 @@ -47,8 +47,8 @@ GenericConnection::~GenericConnection() { if(m_con) { - m_con->SetHandler(nullptr); - m_con->Disconnect();//don't worry about onterminated being called, we've set it's handler to nullptr, so it wont + m_con->SetHandler(NULL); + m_con->Disconnect();//don't worry about onterminated being called, we've set it's handler to null, so it wont m_con->Release(); } @@ -61,7 +61,7 @@ void GenericConnection::disconnect() { m_con->Disconnect(); //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); - m_con = nullptr; + m_con = NULL; } m_conState = CON_DISCONNECT; m_bConnected = CON_NONE; @@ -74,7 +74,7 @@ void GenericConnection::OnTerminated(TcpConnection *con) if(m_con) { m_con->Release(); - m_con = nullptr; + m_con = NULL; } m_conState = CON_DISCONNECT; m_bConnected = CON_NONE; @@ -90,7 +90,7 @@ void GenericConnection::OnRoutePacket(TcpConnection *con, const unsigned char *d get(iter, type); get(iter, track); - GenericResponse *res = nullptr; + GenericResponse *res = NULL; // the following if block is a temporary fix that prevents // a crash with a game team in which they occasionally find @@ -148,7 +148,7 @@ void GenericConnection::process() { m_con->SetHandler(this); m_conState = CON_NEGOTIATE; - m_conTimeout = time(nullptr) + m_reconnectTimeout; + m_conTimeout = time(NULL) + m_reconnectTimeout; } break; case CON_NEGOTIATE: @@ -169,12 +169,12 @@ void GenericConnection::process() put(msg, m_apiCore->getGameCode()); Send(msg); } - else if(time(nullptr) > m_conTimeout) + else if(time(NULL) > m_conTimeout) { // we did not connect m_con->Disconnect(); //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); - m_con = nullptr; + m_con = NULL; m_conState = CON_DISCONNECT; m_bConnected = CON_NONE; } @@ -190,7 +190,7 @@ void GenericConnection::process() { m_con->Disconnect(); //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); - m_con = nullptr; + m_con = NULL; } } m_manager->GiveTime(); diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/CTServiceAPI.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/CTServiceAPI.cpp index 4e6b0954..57f9b409 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/CTServiceAPI.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/CTServiceAPI.cpp @@ -23,7 +23,7 @@ CTServiceAPI::CTServiceAPI(const char *hostName, const char *game) std::vector hostArray; std::vector portArray; char hostConfig[4096]; - if (hostName == nullptr) + if (hostName == NULL) hostName = DEFAULT_HOST; if (!game) game = DEFAULT_GAMECODE; @@ -47,7 +47,7 @@ CTServiceAPI::CTServiceAPI(const char *hostName, const char *game) portArray.push_back(port); } } - while ((ptr = strtok(nullptr, " ")) != nullptr); + while ((ptr = strtok(NULL, " ")) != NULL); } if (hostArray.empty()) { diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/IPAddress.h b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/IPAddress.h index 03b59e8d..f6d5f886 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/IPAddress.h +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/IPAddress.h @@ -32,7 +32,7 @@ public: * @brief Used to retreive the the dot-notation represenatatiion of this address. * * @param buffer A pointer to the buffer to place the ip address into. - * Must be at least 17 characters long, will be nullptr terminated. + * Must be at least 17 characters long, will be null terminated. * * @return A pointer to the buffer the address was placed into. */ diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpBlockAllocator.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpBlockAllocator.cpp index b7da0f27..6d476d78 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpBlockAllocator.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpBlockAllocator.cpp @@ -6,7 +6,7 @@ namespace NAMESPACE #endif TcpBlockAllocator::TcpBlockAllocator(const unsigned initSize, const unsigned initCount) -: m_freeHead(nullptr), m_blockCount(initCount), m_blockSize(initSize), m_numAvailBlocks(0) +: m_freeHead(NULL), m_blockCount(initCount), m_blockSize(initSize), m_numAvailBlocks(0) { realloc(); } @@ -33,7 +33,7 @@ data_block *TcpBlockAllocator::getBlock() tmp = m_freeHead; m_freeHead = m_freeHead->m_next; - tmp->m_next = nullptr; + tmp->m_next = NULL; m_numAvailBlocks--; return(tmp); } @@ -56,7 +56,7 @@ void TcpBlockAllocator::returnBlock(data_block *b) void TcpBlockAllocator::realloc() { - data_block *tmp = nullptr, *cursor = nullptr; + data_block *tmp = NULL, *cursor = NULL; tmp = new data_block; m_numAvailBlocks++; cursor = tmp; diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpConnection.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpConnection.cpp index cd2c1f20..0b3366a8 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpConnection.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpConnection.cpp @@ -11,28 +11,28 @@ namespace NAMESPACE //used when want to open new connection with this socket TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, const IPAddress &destIP, short destPort, unsigned timeout) -: m_nextConnection(nullptr), - m_prevConnection(nullptr), +: m_nextConnection(NULL), + m_prevConnection(NULL), m_socket(INVALID_SOCKET), - m_nextKeepAliveConnection(nullptr), - m_prevKeepAliveConnection(nullptr), + m_nextKeepAliveConnection(NULL), + m_prevKeepAliveConnection(NULL), m_aliveListId(tcpManager->m_aliveList.m_listID), - m_nextRecvDataConnection(nullptr), - m_prevRecvDataConnection(nullptr), + m_nextRecvDataConnection(NULL), + m_prevRecvDataConnection(NULL), m_recvDataListId(tcpManager->m_dataList.m_listID), m_manager(tcpManager), m_status(StatusNegotiating), - m_handler(nullptr), + m_handler(NULL), m_destIP(destIP), m_destPort(destPort), m_refCount(0), m_sendAllocator(sendAlloc), - m_head(nullptr), - m_tail(nullptr), + m_head(NULL), + m_tail(NULL), m_bytesRead(0), m_bytesNeeded(0), m_params(params), - m_recvBuff(nullptr), + m_recvBuff(NULL), m_connectTimeout(timeout), m_connectTimer(), m_wasConRemovedFromMgr(false) @@ -94,28 +94,28 @@ TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAllo //used when server mode creates new connection object representing a connect request TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, SOCKET socket, const IPAddress &destIP, short destPort) -: m_nextConnection(nullptr), - m_prevConnection(nullptr), +: m_nextConnection(NULL), + m_prevConnection(NULL), m_socket(socket), - m_nextKeepAliveConnection(nullptr), - m_prevKeepAliveConnection(nullptr), + m_nextKeepAliveConnection(NULL), + m_prevKeepAliveConnection(NULL), m_aliveListId(tcpManager->m_aliveList.m_listID), - m_nextRecvDataConnection(nullptr), - m_prevRecvDataConnection(nullptr), + m_nextRecvDataConnection(NULL), + m_prevRecvDataConnection(NULL), m_recvDataListId(tcpManager->m_dataList.m_listID), m_manager(tcpManager), m_status(StatusConnected), - m_handler(nullptr), + m_handler(NULL), m_destIP(destIP), m_destPort(destPort), m_refCount(0), m_sendAllocator(sendAlloc), - m_head(nullptr), - m_tail(nullptr), + m_head(NULL), + m_tail(NULL), m_bytesRead(0), m_bytesNeeded(0), m_params(params), - m_recvBuff(nullptr), + m_recvBuff(NULL), m_connectTimeout(0), m_connectTimer(), m_wasConRemovedFromMgr(false) @@ -205,7 +205,7 @@ int TcpConnection::finishConnect() t.tv_sec = 0; t.tv_usec = 0; - int err = select(m_socket + 1, nullptr, &wrSet, nullptr, &t); + int err = select(m_socket + 1, NULL, &wrSet, NULL, &t); if (err == 0) { @@ -300,7 +300,7 @@ TcpConnection::~TcpConnection() { delete [] m_recvBuff; - while(m_head != nullptr) + while(m_head != NULL) { data_block *tmp = m_head; m_head = m_head->m_next; @@ -324,22 +324,22 @@ void TcpConnection::Send(const char *data, unsigned int dataLen) { m_aliveListId = m_manager->m_keepAliveList.m_listID; - if (m_prevKeepAliveConnection != nullptr) + if (m_prevKeepAliveConnection != NULL) m_prevKeepAliveConnection->m_nextKeepAliveConnection = m_nextKeepAliveConnection; - if (m_nextKeepAliveConnection != nullptr) + if (m_nextKeepAliveConnection != NULL) m_nextKeepAliveConnection->m_prevKeepAliveConnection = m_prevKeepAliveConnection; if (m_manager->m_keepAliveList.m_beginList == this) m_manager->m_keepAliveList.m_beginList = m_nextKeepAliveConnection; m_nextKeepAliveConnection = m_manager->m_aliveList.m_beginList; - m_prevKeepAliveConnection = nullptr; - if (m_manager->m_aliveList.m_beginList != nullptr) + m_prevKeepAliveConnection = NULL; + if (m_manager->m_aliveList.m_beginList != NULL) m_manager->m_aliveList.m_beginList->m_prevKeepAliveConnection = this; m_manager->m_aliveList.m_beginList = this; } - data_block *work = nullptr; + data_block *work = NULL; // this connection has no send buffer. Get a block if(!m_tail) @@ -464,16 +464,16 @@ int TcpConnection::processIncoming() { m_recvDataListId = m_manager->m_noDataList.m_listID; - if (m_prevRecvDataConnection != nullptr) + if (m_prevRecvDataConnection != NULL) m_prevRecvDataConnection->m_nextRecvDataConnection = m_nextRecvDataConnection; - if (m_nextRecvDataConnection != nullptr) + if (m_nextRecvDataConnection != NULL) m_nextRecvDataConnection->m_prevRecvDataConnection = m_prevRecvDataConnection; if (m_manager->m_noDataList.m_beginList == this) m_manager->m_noDataList.m_beginList = m_nextRecvDataConnection; m_nextRecvDataConnection = m_manager->m_dataList.m_beginList; - m_prevRecvDataConnection = nullptr; - if (m_manager->m_dataList.m_beginList != nullptr) + m_prevRecvDataConnection = NULL; + if (m_manager->m_dataList.m_beginList != NULL) m_manager->m_dataList.m_beginList->m_prevRecvDataConnection = this; m_manager->m_dataList.m_beginList = this; } @@ -619,7 +619,7 @@ int TcpConnection::processOutgoing() int sendError = 1; - // If m_head is not nullptr, then this connection has something to send + // If m_head is not null, then this connection has something to send if(m_head) diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpConnection.h b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpConnection.h index 92d631d1..07eb4f42 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpConnection.h +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpConnection.h @@ -50,7 +50,7 @@ public: * connection is disconnected, you simply need to derive your class * (multiply if necessary) from TcpConnectionHandler, then you can use * this method to set the object the TcpConnection will call as appropriate. - * default = nullptr (no callbacks made) + * default = NULL (no callbacks made) * * @param handler The object which will be called for notifications. */ diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpManager.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpManager.cpp index 2586fa64..fa4d61a4 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpManager.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpManager.cpp @@ -41,14 +41,14 @@ TcpManager::TcpParams::TcpParams(const TcpParams &cpy) } TcpManager::TcpManager(const TcpParams ¶ms) -: m_handler(nullptr), - m_keepAliveList(nullptr, 1), - m_aliveList(nullptr, 2), - m_noDataList(nullptr, 1), - m_dataList(nullptr, 2), +: m_handler(NULL), + m_keepAliveList(NULL, 1), + m_aliveList(NULL, 2), + m_noDataList(NULL, 1), + m_dataList(NULL, 2), m_params(params), m_refCount(1), - m_connectionList(nullptr), + m_connectionList(NULL), m_connectionListCount(0), m_socket(INVALID_SOCKET), m_boundAsServer(false), @@ -86,7 +86,7 @@ TcpManager::~TcpManager() close(m_socket); #endif } - while (m_connectionList != nullptr) + while (m_connectionList != NULL) { TcpConnection *con = m_connectionList; m_connectionList = m_connectionList->m_nextConnection; @@ -162,7 +162,7 @@ bool TcpManager::BindAsServer() { struct hostent * lphp; lphp = gethostbyname(m_params.bindAddress); - if (lphp != nullptr) + if (lphp != NULL) addr_loc.sin_addr.s_addr = ((struct in_addr *)(lphp->h_addr))->s_addr; } else @@ -187,7 +187,7 @@ bool TcpManager::BindAsServer() TcpConnection *TcpManager::acceptClient() { - TcpConnection *newConn = nullptr; + TcpConnection *newConn = NULL; if (m_boundAsServer && m_connectionListCount < m_params.maxConnections) { @@ -201,7 +201,7 @@ TcpConnection *TcpManager::acceptClient() { newConn = new TcpConnection(this, &m_allocator, m_params, sock, IPAddress(addr.sin_addr.s_addr), ntohs(addr.sin_port)); addNewConnection(newConn); - if (m_handler != nullptr) + if (m_handler != NULL) { m_handler->OnConnectRequest(newConn); } @@ -226,8 +226,8 @@ SOCKET TcpManager::getMaxFD() if (m_boundAsServer) maxfd = m_socket+1; - TcpConnection *next = nullptr; - for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) + TcpConnection *next = NULL; + for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) { next = con->m_nextConnection; if (con->GetStatus() != TcpConnection::StatusDisconnected && con->m_socket > maxfd) @@ -241,8 +241,8 @@ SOCKET TcpManager::getMaxFD() TcpConnection *TcpManager::getConnection(SOCKET fd) { - TcpConnection *next = nullptr; - for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) + TcpConnection *next = NULL; + for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) { next = con->m_nextConnection; if (con->m_socket == fd) @@ -251,7 +251,7 @@ TcpConnection *TcpManager::getConnection(SOCKET fd) } } //if get here ,couldn't find it - return nullptr; + return NULL; } bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendTimePerConnection, unsigned maxRecvTimePerConnection) @@ -273,8 +273,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT { // Send output from last heartbeat - TcpConnection *next = nullptr; - for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) + TcpConnection *next = NULL; + for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) { con->AddRef(); if (next) next->Release(); @@ -341,7 +341,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT tmpfds = m_permfds; timeout.tv_sec = 0; timeout.tv_usec = 0; - int cnt = select(maxfd, &tmpfds, nullptr, nullptr, &timeout); // blocks for timeout + int cnt = select(maxfd, &tmpfds, NULL, NULL, &timeout); // blocks for timeout if (cnt > 0) @@ -367,8 +367,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //process incoming client messages if (maxRecvTimePerConnection != 0) { - TcpConnection *next = nullptr; - for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) + TcpConnection *next = NULL; + for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) { con->AddRef(); if (next) next->Release(); @@ -433,8 +433,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT pollfds[0].events |= POLLIN; } - TcpConnection *next = nullptr; - for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next, idx++) + TcpConnection *next = NULL; + for (TcpConnection *con = m_connectionList ; con != NULL ; con = next, idx++) { next = con->m_nextConnection; pollfds[idx].fd = con->m_socket; @@ -474,7 +474,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT } //process regular msg(s) - if (con == nullptr) + if (con == NULL) { close(pollfds[idx].fd); continue; @@ -506,7 +506,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT }//if(pollfds[... else if (pollfds[idx].revents & POLLHUP) { - if (con == nullptr) + if (con == NULL) { close(pollfds[idx].fd); continue; @@ -524,21 +524,21 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //now process any keepalives, if time to do that if (m_params.keepAliveDelay > 0 && m_keepAliveTimer.isDone(m_params.keepAliveDelay)) { - TcpConnection *next = nullptr; - for (TcpConnection *con = m_keepAliveList.m_beginList ; con != nullptr ; con = next) + TcpConnection *next = NULL; + for (TcpConnection *con = m_keepAliveList.m_beginList ; con != NULL ; con = next) { con->AddRef(); if (next) next->Release(); next = con->m_nextKeepAliveConnection; if (next) next->AddRef(); - con->Send(nullptr, 0); //note: this request will move the connection from the keepAliveList to the aliveList + con->Send(NULL, 0); //note: this request will move the connection from the keepAliveList to the aliveList con->Release(); } //now move the complete alive list over to the keepalive list to reset those timers m_keepAliveList.m_beginList = m_aliveList.m_beginList; - m_aliveList.m_beginList = nullptr; + m_aliveList.m_beginList = NULL; //switch id's for those connections that were in the alive list last go - around int tmpID = m_aliveList.m_listID; @@ -552,8 +552,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //now process any noDataCons, if time to do that if (m_params.noDataTimeout > 0 && m_noDataTimer.isDone(m_params.noDataTimeout)) { - TcpConnection *next = nullptr; - for (TcpConnection *con = m_noDataList.m_beginList ; con != nullptr ; con = next) + TcpConnection *next = NULL; + for (TcpConnection *con = m_noDataList.m_beginList ; con != NULL ; con = next) { con->AddRef(); if (next) next->Release(); @@ -567,7 +567,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //now move the complete data list over to the nodata list to reset those timers m_noDataList.m_beginList = m_dataList.m_beginList; - m_dataList.m_beginList = nullptr; + m_dataList.m_beginList = NULL; //switch id's for those connections that were in the data list last go - around int tmpID = m_dataList.m_listID; @@ -589,11 +589,11 @@ TcpConnection *TcpManager::EstablishConnection(const char *serverAddress, unsign { //can't open outgoing connections when in server mode // use a different TcpManager to do that - return nullptr; + return NULL; } if (m_connectionListCount >= m_params.maxConnections) - return(nullptr); + return(NULL); // get server address unsigned long address = inet_addr(serverAddress); @@ -601,8 +601,8 @@ TcpConnection *TcpManager::EstablishConnection(const char *serverAddress, unsign { struct hostent * lphp; lphp = gethostbyname(serverAddress); - if (lphp == nullptr) - return(nullptr); + if (lphp == NULL) + return(NULL); address = ((struct in_addr *)(lphp->h_addr))->s_addr; } IPAddress destIP(address); @@ -622,22 +622,22 @@ void TcpManager::addNewConnection(TcpConnection *con) FD_SET(con->m_socket, &m_permfds); #endif con->m_nextConnection = m_connectionList; - con->m_prevConnection = nullptr; - if (m_connectionList != nullptr) + con->m_prevConnection = NULL; + if (m_connectionList != NULL) m_connectionList->m_prevConnection = con; m_connectionList = con; m_connectionListCount++; con->m_nextKeepAliveConnection = m_aliveList.m_beginList; - con->m_prevKeepAliveConnection = nullptr; - if (m_aliveList.m_beginList != nullptr) + con->m_prevKeepAliveConnection = NULL; + if (m_aliveList.m_beginList != NULL) m_aliveList.m_beginList->m_prevKeepAliveConnection = con; m_aliveList.m_beginList = con; con->m_aliveListId = m_keepAliveList.m_listID;//start it out thinking it's already in the alive list, since it is con->m_nextRecvDataConnection = m_dataList.m_beginList; - con->m_prevRecvDataConnection = nullptr; - if (m_dataList.m_beginList != nullptr) + con->m_prevRecvDataConnection = NULL; + if (m_dataList.m_beginList != NULL) m_dataList.m_beginList->m_prevRecvDataConnection = con; m_dataList.m_beginList = con; con->m_recvDataListId = m_noDataList.m_listID;//start it out thinking it's already in the data list, since it is @@ -655,40 +655,40 @@ void TcpManager::removeConnection(TcpConnection *con) FD_CLR(con->m_socket, &m_permfds); } #endif - if (con->m_prevConnection != nullptr) + if (con->m_prevConnection != NULL) con->m_prevConnection->m_nextConnection = con->m_nextConnection; - if (con->m_nextConnection != nullptr) + if (con->m_nextConnection != NULL) con->m_nextConnection->m_prevConnection = con->m_prevConnection; if (m_connectionList == con) m_connectionList = con->m_nextConnection; - con->m_nextConnection = nullptr; - con->m_prevConnection = nullptr; + con->m_nextConnection = NULL; + con->m_prevConnection = NULL; - if (con->m_prevKeepAliveConnection != nullptr) + if (con->m_prevKeepAliveConnection != NULL) con->m_prevKeepAliveConnection->m_nextKeepAliveConnection = con->m_nextKeepAliveConnection; - if (con->m_nextKeepAliveConnection != nullptr) + if (con->m_nextKeepAliveConnection != NULL) con->m_nextKeepAliveConnection->m_prevKeepAliveConnection = con->m_prevKeepAliveConnection; if (m_aliveList.m_beginList == con) m_aliveList.m_beginList = con->m_nextKeepAliveConnection; else if (m_keepAliveList.m_beginList == con) m_keepAliveList.m_beginList = con->m_nextKeepAliveConnection; - con->m_nextKeepAliveConnection = nullptr; - con->m_prevKeepAliveConnection = nullptr; + con->m_nextKeepAliveConnection = NULL; + con->m_prevKeepAliveConnection = NULL; - if (con->m_prevRecvDataConnection != nullptr) + if (con->m_prevRecvDataConnection != NULL) con->m_prevRecvDataConnection->m_nextRecvDataConnection = con->m_nextRecvDataConnection; - if (con->m_nextRecvDataConnection != nullptr) + if (con->m_nextRecvDataConnection != NULL) con->m_nextRecvDataConnection->m_prevRecvDataConnection = con->m_prevRecvDataConnection; if (m_dataList.m_beginList == con) m_dataList.m_beginList = con->m_nextRecvDataConnection; else if (m_noDataList.m_beginList == con) m_noDataList.m_beginList = con->m_nextRecvDataConnection; - con->m_nextRecvDataConnection = nullptr; - con->m_prevRecvDataConnection = nullptr; + con->m_nextRecvDataConnection = NULL; + con->m_prevRecvDataConnection = NULL; diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpManager.h b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpManager.h index c4e8b1cf..75eb6df4 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpManager.h +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpManager.h @@ -156,7 +156,7 @@ public: * simply need to derive your class (multiply if necessary) from TcpManagerHandler, then you can use * this method to set the object the TcpManager will call as appropriate. The TcpConnection object * also has a handler mechanism that replaces the other callback functions below, see TcpConnection::SetHandler - * default = nullptr (no callbacks made) + * default = NULL (no callbacks made) * * @param handler The object which will be called for manager related notifications. */ @@ -211,7 +211,7 @@ public: * the connect-complete callback to be called if the connection is succesfull. * * @return A pointer to a TcpConnection object. - * nullptr if the manager object has exceeded its maximum number of connections + * NULL if the manager object has exceeded its maximum number of connections * or if the serverAddress cannot be resolved to an IP address. */ TcpConnection *EstablishConnection(const char *serverAddress, unsigned short serverPort, unsigned timeout = 0); diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/TestClient/Main.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/TestClient/Main.cpp index 188be18e..eb7a09ab 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/TestClient/Main.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/TestClient/Main.cpp @@ -10,7 +10,7 @@ using namespace CTService; unsigned openRequests = 0; -CTServiceAPI *waitclient = nullptr; +CTServiceAPI *waitclient = NULL; std::map m_tests; std::string game_code; diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/Unicode/UnicodeCharacterDataMap.h b/external/3rd/library/soePlatform/CTServiceGameAPI/Unicode/UnicodeCharacterDataMap.h index 493c5a2d..741a6e80 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/Unicode/UnicodeCharacterDataMap.h +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/Unicode/UnicodeCharacterDataMap.h @@ -122,7 +122,7 @@ namespace Plat_Unicode /** * Find a CharData for the given code point. - * @return nullptr if no CharData exists for this code point + * @return null if no CharData exists for this code point */ inline const CharData * CharDataMap::findCharData (const unicode_char_t code) const diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/test/main.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/test/main.cpp index e24b265e..4f91d382 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/test/main.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/test/main.cpp @@ -135,7 +135,7 @@ namespace CTService const char *game, const char *param) { - printf("onServerTest(%u, %s, %s)\n", server_track, game ? game : "(nullptr)", param ? param : "(nullptr)"); + printf("onServerTest(%u, %s, %s)\n", server_track, game ? game : "(null)", param ? param : "(null)"); replyTest(server_track, 999, 0); } diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/AvatarIteratorCore.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/AvatarIteratorCore.cpp index 9548bc9f..3786718c 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/AvatarIteratorCore.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/AvatarIteratorCore.cpp @@ -9,7 +9,7 @@ namespace ChatSystem // AVATAR ITERATOR CORE AvatarIteratorCore::AvatarIteratorCore() -: m_map(nullptr) +: m_map(NULL) { } @@ -33,7 +33,7 @@ AvatarIteratorCore &AvatarIteratorCore::operator=(const AvatarIteratorCore& rhs) ChatAvatar *AvatarIteratorCore::getCurAvatar() { - ChatAvatar *returnVal = nullptr; + ChatAvatar *returnVal = NULL; if (!outOfBounds()) { @@ -87,7 +87,7 @@ bool AvatarIteratorCore::outOfBounds() // MODERATOR ITERATOR CORE ModeratorIteratorCore::ModeratorIteratorCore() -: m_set(nullptr) +: m_set(NULL) { } @@ -111,7 +111,7 @@ ModeratorIteratorCore &ModeratorIteratorCore::operator=(const ModeratorIteratorC ChatAvatar *ModeratorIteratorCore::getCurAvatar() { - ChatAvatar *returnVal = nullptr; + ChatAvatar *returnVal = NULL; if (!outOfBounds()) { @@ -165,7 +165,7 @@ bool ModeratorIteratorCore::outOfBounds() // TEMPORARY MODERATOR ITERATOR CORE TemporaryModeratorIteratorCore::TemporaryModeratorIteratorCore() -: m_set(nullptr) +: m_set(NULL) { } @@ -189,7 +189,7 @@ TemporaryModeratorIteratorCore &TemporaryModeratorIteratorCore::operator=(const ChatAvatar *TemporaryModeratorIteratorCore::getCurAvatar() { - ChatAvatar *returnVal = nullptr; + ChatAvatar *returnVal = NULL; if (!outOfBounds()) { @@ -243,7 +243,7 @@ bool TemporaryModeratorIteratorCore::outOfBounds() // VOICE ITERATOR CORE VoiceIteratorCore::VoiceIteratorCore() -: m_set(nullptr) +: m_set(NULL) { } @@ -267,7 +267,7 @@ VoiceIteratorCore &VoiceIteratorCore::operator=(const VoiceIteratorCore& rhs) ChatAvatar *VoiceIteratorCore::getCurAvatar() { - ChatAvatar *returnVal = nullptr; + ChatAvatar *returnVal = NULL; if (!outOfBounds()) { @@ -321,7 +321,7 @@ bool VoiceIteratorCore::outOfBounds() // INVITE ITERATOR CORE InviteIteratorCore::InviteIteratorCore() -: m_set(nullptr) +: m_set(NULL) { } @@ -345,7 +345,7 @@ InviteIteratorCore &InviteIteratorCore::operator=(const InviteIteratorCore& rhs) ChatAvatar *InviteIteratorCore::getCurAvatar() { - ChatAvatar *returnVal = nullptr; + ChatAvatar *returnVal = NULL; if (!outOfBounds()) { @@ -399,7 +399,7 @@ bool InviteIteratorCore::outOfBounds() // BAN ITERATOR CORE BanIteratorCore::BanIteratorCore() -: m_set(nullptr) +: m_set(NULL) { } @@ -423,7 +423,7 @@ BanIteratorCore &BanIteratorCore::operator=(const BanIteratorCore& rhs) ChatAvatar *BanIteratorCore::getCurAvatar() { - ChatAvatar *returnVal = nullptr; + ChatAvatar *returnVal = NULL; if (!outOfBounds()) { diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/AvatarListItemCore.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/AvatarListItemCore.cpp index 6bbc82e9..15e9af48 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/AvatarListItemCore.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/AvatarListItemCore.cpp @@ -7,7 +7,7 @@ namespace ChatSystem using namespace Plat_Unicode; AvatarListItem::AvatarListItem() - : m_core(nullptr) + : m_core(NULL) { } @@ -16,7 +16,7 @@ namespace ChatSystem } AvatarListItemCore::AvatarListItemCore() - : m_interface(nullptr) + : m_interface(NULL) { } diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPI.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPI.cpp index 9b1e1cd0..021afd5d 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPI.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPI.cpp @@ -13,7 +13,7 @@ namespace ChatSystem { ChatAPI::ChatAPI(const char *registrar_host, short registrar_port, const char *server_host, short server_port) -: m_defaultRoomParams(nullptr), +: m_defaultRoomParams(NULL), m_defaultLoginPriority(0), m_defaultEntryType(false) { @@ -25,13 +25,13 @@ ChatAPI::ChatAPI(const char *registrar_host, short registrar_port, const char *s ChatAPI::~ChatAPI() { delete m_defaultRoomParams; - m_defaultRoomParams = nullptr; + m_defaultRoomParams = NULL; delete m_core; - m_core = nullptr; + m_core = NULL; } ChatAPI::ChatAPI(ChatAPICore *core) -: m_defaultRoomParams(nullptr) +: m_defaultRoomParams(NULL) { m_core = core; m_core->setAPI(this); @@ -721,7 +721,7 @@ void ChatAPI::setDefaultRoomParams(RoomParams *roomParams) { if (roomParams) { - if (m_defaultRoomParams == nullptr) + if (m_defaultRoomParams == NULL) { m_defaultRoomParams = new RoomParams; } @@ -732,7 +732,7 @@ void ChatAPI::setDefaultRoomParams(RoomParams *roomParams) else { delete m_defaultRoomParams; - m_defaultRoomParams = nullptr; + m_defaultRoomParams = NULL; } } void ChatAPI::setDefaultLoginLocation(const ChatUnicodeString &defaultLoginLocation) diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPI.h b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPI.h index 0d255ca2..00533e05 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPI.h +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPI.h @@ -105,7 +105,7 @@ namespace ChatSystem // will be connected to, as well as the hostname and port of the Registrar // ChatServer (which will automatically reroute the ChatAPI connection to // a hotspare ChatServer if the provided choice is unavailable). - // nullptr pointers are NOT valid input. + // NULL pointers are NOT valid input. ChatAPI(const char *registrar_host, short registrar_port, const char *server_host, short server_port); virtual ~ChatAPI(); @@ -209,7 +209,7 @@ namespace ChatSystem // getAvatar // Requests immediate return of a ChatAvatar object that this API // has cached due to a RequestLoginAvatar. Request does not go - // to ChatServer. Returns nullptr if API does not have object locally. + // to ChatServer. Returns NULL if API does not have object locally. ChatAvatar *getAvatar(const ChatUnicodeString &avatarName, const ChatUnicodeString &avatarAddress); ChatAvatar *getAvatar(unsigned avatarID); @@ -286,7 +286,7 @@ namespace ChatSystem // Requests immediate return of a ChatRoom object that this API // has cached due to a RequestGetRoom, RequestCreateRoom, or // RequestEnterRoom. Request does not go to ChatServer. Returns - // nullptr if API does not have object locally. + // NULL if API does not have object locally. ChatRoom *getRoom(const ChatUnicodeString &roomAddress); ChatRoom *getRoom(unsigned roomID); @@ -298,13 +298,13 @@ namespace ChatSystem // getDefaultRoomParams // Requests the ChatAPI's current default RoomParams object. Used for - // the EnterRoom call. If nullptr, EnterRoom will not do passive room + // the EnterRoom call. If NULL, EnterRoom will not do passive room // creation if the room to enter does not yet exist. Initial value - // is nullptr (no RoomParams object defined). + // is NULL (no RoomParams object defined). const RoomParams *getDefaultRoomParams(void); // setDefaultRoomParams - // Sets the ChatAPI's current default RoomParams object. Passing a nullptr + // Sets the ChatAPI's current default RoomParams object. Passing a NULL // pointer will cause the default params not to be used by EnterRoom. void setDefaultRoomParams(RoomParams *roomParams); diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPICore.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPICore.cpp index 99cfe621..5724a68f 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPICore.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPICore.cpp @@ -67,7 +67,7 @@ const char * const ChatAPICore::ms_errorStringsEnglish[] = "UID node already exists", "Wrong chat server for request", "Succeeded, but local data is invalid", - "Login with nullptr name", + "Login with null name", "No server assigned to this identity", // 45 "Another server already assumed this identity", "Remote server is down", @@ -82,9 +82,9 @@ const char * const ChatAPICore::ms_errorStringsEnglish[] = "Duplicate voice", "Chat avatar must first be logged out", "No work to do", - "Cannot perform rename to nullptr avatar name", + "Cannot perform rename to NULL avatar name", "Cannot perform station acct transfer to stationID = 0", // 60 - "Cannot perform avatar move to nullptr avatar address", + "Cannot perform avatar move to NULL avatar address", "Failed to obtain an ID for a new room or avatar", "Room is local to namespace/world; cannot enter from other worlds", "Room is local to game; cannot enter from other game namespaces", @@ -122,7 +122,7 @@ ChatAPICore::ChatAPICore(const char *registrar_host, short registrar_port, const m_registrarPort(registrar_port), m_defaultServerPort(server_port), m_assignedServerPort(server_port), - m_timeSinceLastDisconnect(time(nullptr)), + m_timeSinceLastDisconnect(time(NULL)), m_rcvdRegistrarResponse(false), m_shouldSendVersion(true) { @@ -132,7 +132,7 @@ ChatAPICore::ChatAPICore(const char *registrar_host, short registrar_port, const ChatAPICore::~ChatAPICore() { - m_api = nullptr; + m_api = NULL; std::map::iterator iter = m_avatarCoreCache.begin(); for (; iter != m_avatarCoreCache.end(); ++iter) @@ -209,7 +209,7 @@ void ChatAPICore::cacheAvatar(ChatAvatarCore *avatarCore) ChatAvatarCore *ChatAPICore::getAvatarCore(unsigned avatarID) { - ChatAvatarCore *returnAvatar = nullptr; + ChatAvatarCore *returnAvatar = NULL; std::map::iterator iter = m_avatarCoreCache.find(avatarID); if(iter != m_avatarCoreCache.end()) @@ -221,7 +221,7 @@ ChatAvatarCore *ChatAPICore::getAvatarCore(unsigned avatarID) ChatAvatar *ChatAPICore::getAvatar(unsigned avatarID) { - ChatAvatar *returnAvatar = nullptr; + ChatAvatar *returnAvatar = NULL; std::map::iterator iter = m_avatarCache.find(avatarID); if(iter != m_avatarCache.end()) @@ -233,7 +233,7 @@ ChatAvatar *ChatAPICore::getAvatar(unsigned avatarID) ChatAvatarCore *ChatAPICore::decacheAvatar(unsigned avatarID) { - ChatAvatarCore *returnAvatar = nullptr; + ChatAvatarCore *returnAvatar = NULL; std::map::iterator iterCore = m_avatarCoreCache.find(avatarID); if(iterCore != m_avatarCoreCache.end()) { @@ -267,7 +267,7 @@ void ChatAPICore::cacheRoom(ChatRoomCore *roomCore) ChatRoomCore *ChatAPICore::getRoomCore(unsigned roomID) { - ChatRoomCore *returnRoom = nullptr; + ChatRoomCore *returnRoom = NULL; std::map::iterator iter = m_roomCoreCache.find(roomID); if(iter != m_roomCoreCache.end()) { @@ -279,7 +279,7 @@ ChatRoomCore *ChatAPICore::getRoomCore(unsigned roomID) ChatRoom *ChatAPICore::getRoom(unsigned roomID) { - ChatRoom *returnRoom = nullptr; + ChatRoom *returnRoom = NULL; std::map::iterator iter = m_roomCache.find(roomID); if(iter != m_roomCache.end()) { @@ -291,7 +291,7 @@ ChatRoom *ChatAPICore::getRoom(unsigned roomID) ChatRoomCore *ChatAPICore::decacheRoom(unsigned roomID) { - ChatRoomCore *returnRoom = nullptr; + ChatRoomCore *returnRoom = NULL; std::map::iterator iterCore = m_roomCoreCache.find(roomID); if(iterCore != m_roomCoreCache.end()) @@ -315,7 +315,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_LOGINAVATAR: { ResLoginAvatar *R = static_cast(res); - ChatAvatar *avatar = nullptr; + ChatAvatar *avatar = NULL; if(R->getAvatar()) { @@ -338,7 +338,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_TEMPORARYAVATAR: { ResTemporaryAvatar* R = static_cast(res); - ChatAvatar* avatar = nullptr; + ChatAvatar* avatar = NULL; if ( R->getAvatar() ) { @@ -394,8 +394,8 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_GETAVATAR: { ResGetAvatar *R = static_cast(res); - ChatAvatar *cachedAvatar = nullptr; - ChatAvatar *avatar = nullptr; + ChatAvatar *cachedAvatar = NULL; + ChatAvatar *avatar = NULL; ChatAvatarCore *avatarCore = R->getAvatar(); if (R->getResult() == 0 && avatarCore) // if success @@ -403,7 +403,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) // attempt to return locally cached avatar, if available cachedAvatar = getAvatar(avatarCore->getAvatarID()); - if (cachedAvatar != nullptr) + if (cachedAvatar != NULL) { // update cached information with returned data cachedAvatar->setAttributes(avatarCore->getAttributes()); @@ -427,7 +427,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) m_api->OnGetAvatar(R->getTrack(), R->getResult(), avatar, R->getUser()); - if (cachedAvatar == nullptr) + if (cachedAvatar == NULL) { delete avatar; } @@ -438,8 +438,8 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_GETANYAVATAR: { ResGetAnyAvatar *R = static_cast(res); - ChatAvatar *cachedAvatar = nullptr; - ChatAvatar *avatar = nullptr; + ChatAvatar *cachedAvatar = NULL; + ChatAvatar *avatar = NULL; ChatAvatarCore *avatarCore = R->getAvatar(); if (R->getResult() == 0 && avatarCore) // if success @@ -447,7 +447,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) // attempt to return locally cached avatar, if available cachedAvatar = getAvatar(avatarCore->getAvatarID()); - if (cachedAvatar != nullptr) + if (cachedAvatar != NULL) { // update cached information with returned data cachedAvatar->setAttributes(avatarCore->getAttributes()); @@ -471,7 +471,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) m_api->OnGetAnyAvatar(R->getTrack(), R->getResult(), avatar, R->isLoggedIn(), R->getUser()); - if (cachedAvatar == nullptr) + if (cachedAvatar == NULL) { delete avatar; } @@ -490,8 +490,8 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_SETAVATARATTRIBUTES: { ResSetAvatarAttributes *R = static_cast(res); - ChatAvatar *cachedAvatar = nullptr; - ChatAvatar *avatar = nullptr; + ChatAvatar *cachedAvatar = NULL; + ChatAvatar *avatar = NULL; ChatAvatarCore *avatarCore = R->getAvatar(); if (R->getResult() == 0 && avatarCore) // if success @@ -502,14 +502,14 @@ void ChatAPICore::responseCallback(GenericResponse *res) // attempt to return locally cached avatar, if available cachedAvatar = getAvatar(avatar->getAvatarID()); - if (cachedAvatar != nullptr) + if (cachedAvatar != NULL) { cachedAvatar->setAttributes(avatar->getAttributes()); } } } - if (cachedAvatar != nullptr) + if (cachedAvatar != NULL) { cachedAvatar = avatar; m_api->OnSetAvatarAttributes(R->getTrack(), R->getResult(), cachedAvatar, R->getUser()); @@ -531,8 +531,8 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_SETSTATUSMESSAGE: { ResSetAvatarStatusMessage *R = static_cast(res); - ChatAvatar *cachedAvatar = nullptr; - ChatAvatar *avatar = nullptr; + ChatAvatar *cachedAvatar = NULL; + ChatAvatar *avatar = NULL; ChatAvatarCore *avatarCore = R->getAvatar(); if (R->getResult() == 0 && avatarCore) // if success @@ -543,14 +543,14 @@ void ChatAPICore::responseCallback(GenericResponse *res) // attempt to return locally cached avatar, if available cachedAvatar = getAvatar(avatar->getAvatarID()); - if (cachedAvatar != nullptr) + if (cachedAvatar != NULL) { cachedAvatar->setStatusMessage(avatar->getStatusMessage()); } } } - if (cachedAvatar != nullptr) + if (cachedAvatar != NULL) { cachedAvatar = avatar; m_api->OnSetAvatarStatusMessage(R->getTrack(), R->getResult(), cachedAvatar, R->getUser()); @@ -572,8 +572,8 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_SETAVATAREMAIL: { ResSetAvatarForwardingEmail*R = static_cast(res); - ChatAvatar *cachedAvatar = nullptr; - ChatAvatar *avatar = nullptr; + ChatAvatar *cachedAvatar = NULL; + ChatAvatar *avatar = NULL; ChatAvatarCore *avatarCore = R->getAvatar(); if (R->getResult() == 0 && avatarCore) // if success @@ -584,14 +584,14 @@ void ChatAPICore::responseCallback(GenericResponse *res) // attempt to return locally cached avatar, if available cachedAvatar = getAvatar(avatar->getAvatarID()); - if (cachedAvatar != nullptr) + if (cachedAvatar != NULL) { cachedAvatar->setForwardingEmail(avatar->getForwardingEmail()); } } } - if (cachedAvatar != nullptr) + if (cachedAvatar != NULL) { cachedAvatar = avatar; m_api->OnSetAvatarForwardingEmail(R->getTrack(), R->getResult(), cachedAvatar, R->getUser()); @@ -613,8 +613,8 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_SETAVATARINBOXLIMIT: { ResSetAvatarInboxLimit *R = static_cast(res); - ChatAvatar *cachedAvatar = nullptr; - ChatAvatar *avatar = nullptr; + ChatAvatar *cachedAvatar = NULL; + ChatAvatar *avatar = NULL; ChatAvatarCore *avatarCore = R->getAvatar(); if (R->getResult() == 0 && avatarCore) // if success @@ -625,14 +625,14 @@ void ChatAPICore::responseCallback(GenericResponse *res) // attempt to return locally cached avatar, if available cachedAvatar = getAvatar(avatar->getAvatarID()); - if (cachedAvatar != nullptr) + if (cachedAvatar != NULL) { cachedAvatar->setInboxLimit(avatar->getInboxLimit()); } } } - if (cachedAvatar != nullptr) + if (cachedAvatar != NULL) { cachedAvatar = avatar; m_api->OnSetAvatarInboxLimit(R->getTrack(), R->getResult(), cachedAvatar, R->getUser()); @@ -654,13 +654,13 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_GETROOM: { ResGetRoom *R = static_cast(res); - ChatRoom *room = nullptr; + ChatRoom *room = NULL; ChatRoomCore *roomCore = R->getRoom(); if (R->getResult() == 0 && roomCore) // if success { unsigned roomid = roomCore->getRoomID(); - if (getRoomCore(roomid) == nullptr) + if (getRoomCore(roomid) == NULL) { // we need to cache this room first cacheRoom(roomCore); @@ -708,8 +708,8 @@ void ChatAPICore::responseCallback(GenericResponse *res) { ResCreateRoom *R = static_cast(res); - ChatRoom *room = nullptr; - ChatRoomCore* roomCore = nullptr; + ChatRoom *room = NULL; + ChatRoomCore* roomCore = NULL; if (R->getResult() == 0) // if success { @@ -939,7 +939,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) else if (!room && !roomCore) { // we didn't have room cached, and we didn't get one to cache, - // thus we'll have trouble giving a callback with a nullptr pointer. + // thus we'll have trouble giving a callback with a NULL pointer. _chatdebug_("ChatAPI:BadData: RESPONSE_ENTERROOM: avatar=%p, room=%p , roomCore=%p\n", avatar, room, roomCore); } } @@ -1175,8 +1175,8 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_FINDAVATARBYUID: { ResFindAvatarByUID *R = static_cast(res); - ChatAvatar **avatarMatches = nullptr; - ChatAvatarCore **avatarCoreMatches = nullptr; + ChatAvatar **avatarMatches = NULL; + ChatAvatarCore **avatarCoreMatches = NULL; unsigned numAvatarsOnline = R->getNumAvatarsOnline(); @@ -1374,7 +1374,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) // duplicate login from this API, then effectively // our API must consider him logged out because he's now // no longer logged in to his AID controller. - m_api->OnLogoutAvatar(0, 0, avatar, nullptr); + m_api->OnLogoutAvatar(0, 0, avatar, NULL); } } @@ -1476,7 +1476,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_GETAVATARKEYWORDS: { ResGetAvatarKeywords *R = static_cast(res); - ChatAvatar *avatar = nullptr; + ChatAvatar *avatar = NULL; if(R->getResult() == CHATRESULT_SUCCESS) { @@ -1494,7 +1494,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_SETAVATARKEYWORDS: { ResSetAvatarKeywords *R = static_cast(res); - ChatAvatar *avatar = nullptr; + ChatAvatar *avatar = NULL; if(R->getResult() == CHATRESULT_SUCCESS) { avatar = getAvatar(R->getAvatarID()); @@ -1510,8 +1510,8 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_SEARCHAVATARKEYWORDS: { ResSearchAvatarKeywords *R = static_cast(res); - ChatAvatar **avatarMatches = nullptr; - ChatAvatarCore **avatarCoreMatches = nullptr; + ChatAvatar **avatarMatches = NULL; + ChatAvatarCore **avatarCoreMatches = NULL; if(R->getResult() == CHATRESULT_SUCCESS) { @@ -1530,7 +1530,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_CONFIRMFRIEND: { ResFriendConfirm *R = static_cast(res); - ChatAvatar *avatar = nullptr; + ChatAvatar *avatar = NULL; if(R->getResult() == CHATRESULT_SUCCESS) { avatar = getAvatar(R->getAvatarID()); @@ -1546,7 +1546,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_CONFIRMFRIEND_RECIPROCATE: { ResFriendConfirmReciprocate *R = static_cast(res); - ChatAvatar *avatar = nullptr; + ChatAvatar *avatar = NULL; if(R->getResult() == CHATRESULT_SUCCESS) { avatar = getAvatar(R->getAvatarID()); @@ -1616,7 +1616,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_ADDSNOOPAVATAR: { ResAddSnoopAvatar *R = static_cast(res); - ChatAvatar *avatar = nullptr; + ChatAvatar *avatar = NULL; if(R->getResult() == CHATRESULT_SUCCESS) { avatar = getAvatar(R->getSrcAvatarID()); @@ -1632,7 +1632,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_REMOVESNOOPAVATAR: { ResRemoveSnoopAvatar *R = static_cast(res); - ChatAvatar *avatar = nullptr; + ChatAvatar *avatar = NULL; if(R->getResult() == CHATRESULT_SUCCESS) { avatar = getAvatar(R->getSrcAvatarID()); @@ -1648,7 +1648,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_ADDSNOOPROOM: { ResAddSnoopRoom *R = static_cast(res); - ChatAvatar *avatar = nullptr; + ChatAvatar *avatar = NULL; if(R->getResult() == CHATRESULT_SUCCESS) { avatar = getAvatar(R->getSrcAvatarID()); @@ -1664,7 +1664,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_REMOVESNOOPROOM: { ResRemoveSnoopRoom *R = static_cast(res); - ChatAvatar *avatar = nullptr; + ChatAvatar *avatar = NULL; if(R->getResult() == CHATRESULT_SUCCESS) { avatar = getAvatar(R->getSrcAvatarID()); @@ -1680,7 +1680,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_GETSNOOPLIST: { ResGetSnoopList *R = static_cast(res); - ChatAvatar *avatar = nullptr; + ChatAvatar *avatar = NULL; if(R->getResult() == CHATRESULT_SUCCESS) { avatar = getAvatar(R->getSrcAvatarID()); @@ -1691,8 +1691,8 @@ void ChatAPICore::responseCallback(GenericResponse *res) _chatdebug_("ChatAPI:BadData: RESPONSE_REMOVESNOOPROOM: avatar=%p\n", avatar); } - AvatarSnoopPair **avatarList = nullptr; - ChatUnicodeString **roomList = nullptr; + AvatarSnoopPair **avatarList = NULL; + ChatUnicodeString **roomList = NULL; unsigned numAvatars = R->getAvatarSnoopListLength(); unsigned numRooms = R->getRoomSnoopListLength(); @@ -1763,7 +1763,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) ChatAvatar *destAvatar = getAvatar(M.getDestList()[i]); if (!destAvatar) { - _chatdebug_("ChatAPI:BadData: MESSAGE_ROOMMESSAGE: destAvatar[%i]=nullptr\n", i); + _chatdebug_("ChatAPI:BadData: MESSAGE_ROOMMESSAGE: destAvatar[%i]=NULL\n", i); continue; } m_api->OnReceiveRoomMessage(srcAvatar, destAvatar, destRoom, ChatUnicodeString(M.getMsg().data(), M.getMsg().size()), ChatUnicodeString(M.getOOB().data(), M.getOOB().size())); @@ -1797,7 +1797,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) ChatAvatar *destAvatar = getAvatar(M.getDestList()[i]); if (!destAvatar) { - _chatdebug_("ChatAPI:BadData: MESSAGE_BROADCASTMESSAGE: destAvatar[%i]=nullptr\n", i); + _chatdebug_("ChatAPI:BadData: MESSAGE_BROADCASTMESSAGE: destAvatar[%i]=NULL\n", i); continue; } m_api->OnReceiveBroadcastMessage(srcAvatar, ChatUnicodeString(M.getSrcAddress().data(), M.getSrcAddress().size()), destAvatar, ChatUnicodeString(M.getMsg().data(), M.getMsg().size()), ChatUnicodeString(M.getOOB().data(), M.getOOB().size())); @@ -1877,7 +1877,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) ChatRoomCore *destRoomCore = getRoomCore(M.getRoomID()); if (!destRoomCore) { - _chatdebug_("ChatAPI:destroomCore is nullptr!"); + _chatdebug_("ChatAPI:destroomCore is null!"); break; } @@ -1889,7 +1889,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) ChatAvatar *destAvatar = M.getDestAvatar()->getNewChatAvatar(); ChatAvatar *srcAvatar = M.getSrcAvatar()->getNewChatAvatar(); - ChatAvatarCore *kickedAvatar = destRoomCore ? destRoomCore->removeAvatar(destAvatar->getAvatarID()) : nullptr; + ChatAvatarCore *kickedAvatar = destRoomCore ? destRoomCore->removeAvatar(destAvatar->getAvatarID()) : NULL; ChatRoom *destRoom = getRoom(M.getRoomID()); if (!srcAvatar || !destAvatar || !kickedAvatar || !destRoom) @@ -2439,12 +2439,12 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) ChatAvatar *srcAvatar = M.getSrcAvatar()->getNewChatAvatar(); if (!srcAvatar) { - _chatdebug_("ChatAPI:BadData: MESSAGE_ENTERROOM: srcAvatar=nullptr\n"); + _chatdebug_("ChatAPI:BadData: MESSAGE_ENTERROOM: srcAvatar=NULL\n"); delete M.getSrcAvatar(); break; } - bool isLocalAvatar = (getAvatar(srcAvatar->getAvatarID()) != nullptr); + bool isLocalAvatar = (getAvatar(srcAvatar->getAvatarID()) != NULL); if(!destRoomCore->addAvatar(M.getSrcAvatar(),isLocalAvatar)) { delete M.getSrcAvatar(); @@ -2492,10 +2492,10 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) if (destRoomCore) { ChatRoom *destRoom = getRoom(M.getRoomID()); - ChatAvatar *srcAvatar = nullptr; + ChatAvatar *srcAvatar = NULL; if (!M.getSrcAvatar()) { - _chatdebug_("ChatAPI:BadData: MESSAGE_DESTROYROOM: M.getSrcAvatar=nullptr\n"); + _chatdebug_("ChatAPI:BadData: MESSAGE_DESTROYROOM: M.getSrcAvatar=NULL\n"); } else { @@ -2527,7 +2527,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) ChatRoomCore *destRoomCore = getRoomCore(M.getRoomID()); if (!destRoomCore) { - _chatdebug_("ChatAPI:BadData: MESSAGE_SETROOMPARAMS: destRoomCore=nullptr\n"); + _chatdebug_("ChatAPI:BadData: MESSAGE_SETROOMPARAMS: destRoomCore=NULL\n"); break; } @@ -2544,7 +2544,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) if (!M.getSrcAvatar()) { - _chatdebug_("ChatAPI:BadData: MESSAGE_SETROOMPARAMS: M.getSrcAvatar=nullptr\n"); + _chatdebug_("ChatAPI:BadData: MESSAGE_SETROOMPARAMS: M.getSrcAvatar=NULL\n"); break; } ChatAvatar *srcAvatar = M.getSrcAvatar()->getNewChatAvatar(); @@ -2686,7 +2686,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) { MAddAdmin M(iter); ChatRoomCore *destRoomCore = getRoomCore(M.getRoomID()); - if (destRoomCore && (destRoomCore->addAdministrator(M.getAvatar()) == nullptr)) + if (destRoomCore && (destRoomCore->addAdministrator(M.getAvatar()) == NULL)) { delete (M.getAvatar()); } @@ -2696,7 +2696,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) { MRemoveAdmin M(iter); ChatRoomCore *destRoomCore = getRoomCore(M.getRoomID()); - ChatAvatarCore *admin = nullptr; + ChatAvatarCore *admin = NULL; if (destRoomCore) admin = destRoomCore->removeAdministrator(M.getAvatarID()); delete admin; @@ -2707,7 +2707,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) MFriendConfirmRequest M(iter); if (!M.getSrcAvatar()) { - _chatdebug_("ChatAPI:BadData: MESSAGE_FRIENDCONFIRMREQUEST: M.getSrcAvatar=nullptr\n"); + _chatdebug_("ChatAPI:BadData: MESSAGE_FRIENDCONFIRMREQUEST: M.getSrcAvatar=NULL\n"); break; } ChatAvatar *srcAvatar = M.getSrcAvatar()->getNewChatAvatar(); @@ -2730,7 +2730,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) if (!M.getSrcAvatar()) { - _chatdebug_("ChatAPI:BadData: MESSAGE_FRIENDCONFIRMRESPONSE: M.getSrcAvatar=nullptr\n"); + _chatdebug_("ChatAPI:BadData: MESSAGE_FRIENDCONFIRMRESPONSE: M.getSrcAvatar=NULL\n"); break; } ChatAvatar *srcAvatar = M.getSrcAvatar()->getNewChatAvatar(); @@ -2752,7 +2752,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) MFriendConfirmReciprocateRequest M(iter); if (!M.getSrcAvatar()) { - _chatdebug_("ChatAPI:BadData: MESSAGE_FRIENDCONFIRMRECIPROCATE_REQUEST: M.getSrcAvatar=nullptr\n"); + _chatdebug_("ChatAPI:BadData: MESSAGE_FRIENDCONFIRMRECIPROCATE_REQUEST: M.getSrcAvatar=NULL\n"); break; } ChatAvatar *srcAvatar = M.getSrcAvatar()->getNewChatAvatar(); @@ -2775,7 +2775,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) if (!M.getSrcAvatar()) { - _chatdebug_("ChatAPI:BadData: MESSAGE_FRIENDCONFIRMRECIPROCATE_RESPONSE: M.getSrcAvatar=nullptr\n"); + _chatdebug_("ChatAPI:BadData: MESSAGE_FRIENDCONFIRMRECIPROCATE_RESPONSE: M.getSrcAvatar=NULL\n"); break; } ChatAvatar *srcAvatar = M.getSrcAvatar()->getNewChatAvatar(); @@ -2799,7 +2799,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) ChatRoomCore *destRoomCore = getRoomCore(M.getDestRoomID()); if (!destRoomCore) { - _chatdebug_("ChatAPI:BadData: MESSAGE_CHANGEROOMOWNER: destRoomCore=nullptr\n"); + _chatdebug_("ChatAPI:BadData: MESSAGE_CHANGEROOMOWNER: destRoomCore=NULL\n"); break; } @@ -2822,7 +2822,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) if (!M.getRequestorAvatar()) { - _chatdebug_("ChatAPI:BadData: MESSAGE_REQUESTROOMENTRY: M.getRequestorAvatar=nullptr\n"); + _chatdebug_("ChatAPI:BadData: MESSAGE_REQUESTROOMENTRY: M.getRequestorAvatar=NULL\n"); break; } ChatAvatar *srcAvatar = M.getRequestorAvatar()->getNewChatAvatar(); @@ -3025,7 +3025,7 @@ void ChatAPICore::processAPI() } // if we've been disconnected for at least a minute... else if (!m_connected && - time(nullptr) - m_timeSinceLastDisconnect >= 60) + time(NULL) - m_timeSinceLastDisconnect >= 60) { if (m_setToRegistrar) { @@ -3043,7 +3043,7 @@ void ChatAPICore::processAPI() m_setToRegistrar = true; } - m_timeSinceLastDisconnect = time(nullptr); + m_timeSinceLastDisconnect = time(NULL); } @@ -3072,7 +3072,7 @@ void ChatAPICore::OnConnect(const char *host, short port) res->setTrack(m_currTrack); m_currTrack++; - time_t timeout = time(nullptr) + m_requestTimeout; + time_t timeout = time(NULL) + m_requestTimeout; req->setTimeout(timeout); res->setTimeout(timeout); @@ -3103,7 +3103,7 @@ void ChatAPICore::OnConnect(const char *host, short port) res->setTrack(m_currTrack); m_currTrack++; - time_t timeout = time(nullptr) + m_requestTimeout; + time_t timeout = time(NULL) + m_requestTimeout; req->setTimeout(timeout); res->setTimeout(timeout); @@ -3147,7 +3147,7 @@ void ChatAPICore::OnDisconnect(const char *host, short port) // stop processing immediately suspendProcessing(); - m_timeSinceLastDisconnect = time(nullptr); + m_timeSinceLastDisconnect = time(NULL); // determine who we disconnected from and take appropriate action if (strcmp(host, m_registrarHost.c_str()) == 0 && @@ -3214,7 +3214,7 @@ void ChatAPICore::failoverReloginOneAvatar(ChatAvatarCore * avatarCore) res->setTrack(m_currTrack); m_currTrack++; - time_t timeout = time(nullptr) + m_requestTimeout; + time_t timeout = time(NULL) + m_requestTimeout; req->setTimeout(timeout); res->setTimeout(timeout); @@ -3241,7 +3241,7 @@ void ChatAPICore::failoverRecreateRooms() { // first build multimap of rooms keyed by their node level (ascending order is default). multimap levelMap; - ChatRoomCore *roomCore = nullptr; + ChatRoomCore *roomCore = NULL; for (roomIter = m_roomCoreCache.begin(); roomIter != m_roomCoreCache.end(); ++roomIter) { roomCore = (*roomIter).second; @@ -3268,7 +3268,7 @@ void ChatAPICore::failoverRecreateRooms() res->setTrack(m_currTrack); m_currTrack++; - time_t timeout = time(nullptr) + m_requestTimeout; + time_t timeout = time(NULL) + m_requestTimeout; req->setTimeout(timeout); res->setTimeout(timeout); @@ -3296,7 +3296,7 @@ void ChatAPICore::failoverRecreateRooms() ChatAvatar *ChatAPICore::getAvatar(const ChatUnicodeString &avatarName, const ChatUnicodeString &avatarAddress) { - ChatAvatar *returnVal = nullptr; + ChatAvatar *returnVal = NULL; map::iterator iter = m_avatarCache.begin(); @@ -3317,7 +3317,7 @@ ChatAvatar *ChatAPICore::getAvatar(const ChatUnicodeString &avatarName, const Ch ChatRoom *ChatAPICore::getRoom(const ChatUnicodeString &roomAddress) { - ChatRoom *returnVal = nullptr; + ChatRoom *returnVal = NULL; map::iterator iter = m_roomCache.begin(); diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatEnum.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatEnum.cpp index f18fac5d..fba1bc17 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatEnum.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatEnum.cpp @@ -43,7 +43,7 @@ ChatUnicodeString::ChatUnicodeString(const std::string& nSrc) ChatUnicodeString::ChatUnicodeString(const char *nStrSrc) { - if (nStrSrc==nullptr) + if (nStrSrc==NULL) { m_wideString = getEmptyString(); m_cString = wideToNarrow(m_wideString); diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatFriendStatusCore.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatFriendStatusCore.cpp index 653f0cbd..c6eea945 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatFriendStatusCore.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatFriendStatusCore.cpp @@ -7,7 +7,7 @@ namespace ChatSystem using namespace Base; using namespace Plat_Unicode; ChatFriendStatusCore::ChatFriendStatusCore() -: m_interface(nullptr), +: m_interface(NULL), m_status(0) { } @@ -31,7 +31,7 @@ ChatFriendStatusCore::~ChatFriendStatusCore() } ChatFriendStatus::ChatFriendStatus() -: m_core(nullptr) +: m_core(NULL) { } diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatIgnoreStatusCore.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatIgnoreStatusCore.cpp index a3fefe08..06717992 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatIgnoreStatusCore.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatIgnoreStatusCore.cpp @@ -7,7 +7,7 @@ namespace ChatSystem using namespace Plat_Unicode; ChatIgnoreStatus::ChatIgnoreStatus() - : m_core(nullptr) + : m_core(NULL) { } @@ -16,7 +16,7 @@ namespace ChatSystem } ChatIgnoreStatusCore::ChatIgnoreStatusCore() - : m_interface(nullptr) + : m_interface(NULL) { } diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatRoom.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatRoom.cpp index cdd0238a..d022aafa 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatRoom.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatRoom.cpp @@ -581,7 +581,7 @@ unsigned RoomSummary::getRoomMaxSize() const ChatRoom::ChatRoom() { - m_core = nullptr; + m_core = NULL; } ChatRoom::ChatRoom(ChatRoomCore *core) diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatRoomCore.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatRoomCore.cpp index d0c70f68..715a943a 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatRoomCore.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatRoomCore.cpp @@ -189,7 +189,7 @@ ChatRoomCore::~ChatRoomCore() ChatAvatarCore *ChatRoomCore::getAvatarCore(unsigned avatarID) { - ChatAvatarCore *returnAvatar = nullptr; + ChatAvatarCore *returnAvatar = NULL; map::iterator iterCore = m_inroomAvatarsCore.find(avatarID); @@ -202,7 +202,7 @@ ChatAvatarCore *ChatRoomCore::getAvatarCore(unsigned avatarID) ChatAvatar *ChatRoomCore::getAvatar(unsigned avatarID) { - ChatAvatar *returnAvatar = nullptr; + ChatAvatar *returnAvatar = NULL; map::iterator iter = m_inroomAvatars.find(avatarID); @@ -215,7 +215,7 @@ ChatAvatar *ChatRoomCore::getAvatar(unsigned avatarID) ChatAvatarCore *ChatRoomCore::getModeratorCore(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - ChatAvatarCore *returnAvatar = nullptr; + ChatAvatarCore *returnAvatar = NULL; set::iterator iterCore = m_moderatorAvatarsCore.begin(); @@ -238,7 +238,7 @@ ChatAvatarCore *ChatRoomCore::getModeratorCore(const Plat_Unicode::String &name, ChatAvatar *ChatRoomCore::getModerator(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - ChatAvatar *returnAvatar = nullptr; + ChatAvatar *returnAvatar = NULL; set::iterator iter = m_moderatorAvatars.begin(); @@ -263,7 +263,7 @@ ChatAvatar *ChatRoomCore::getModerator(const Plat_Unicode::String &name, const P ChatAvatarCore *ChatRoomCore::getBannedCore(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - ChatAvatarCore *returnAvatar = nullptr; + ChatAvatarCore *returnAvatar = NULL; set::iterator iterCore = m_banAvatarsCore.begin(); @@ -286,7 +286,7 @@ ChatAvatarCore *ChatRoomCore::getBannedCore(const Plat_Unicode::String &name, co ChatAvatar *ChatRoomCore::getBanned(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - ChatAvatar *returnAvatar = nullptr; + ChatAvatar *returnAvatar = NULL; set::iterator iter = m_banAvatars.begin(); @@ -311,7 +311,7 @@ ChatAvatar *ChatRoomCore::getBanned(const Plat_Unicode::String &name, const Plat ChatAvatarCore *ChatRoomCore::getInvitedCore(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - ChatAvatarCore *returnAvatar = nullptr; + ChatAvatarCore *returnAvatar = NULL; set::iterator iterCore = m_inviteAvatarsCore.begin(); @@ -334,7 +334,7 @@ ChatAvatarCore *ChatRoomCore::getInvitedCore(const Plat_Unicode::String &name, c ChatAvatar *ChatRoomCore::getInvited(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - ChatAvatar *returnAvatar = nullptr; + ChatAvatar *returnAvatar = NULL; set::iterator iter = m_inviteAvatars.begin(); @@ -359,7 +359,7 @@ ChatAvatar *ChatRoomCore::getInvited(const Plat_Unicode::String &name, const Pla ChatAvatarCore *ChatRoomCore::addAvatar(ChatAvatarCore *newAvatar, bool local) { - ChatAvatarCore *returnAvatar = nullptr; + ChatAvatarCore *returnAvatar = NULL; if(newAvatar) { @@ -394,7 +394,7 @@ void ChatRoomCore::addLocalAvatar(unsigned avatarID) ChatAvatarCore *ChatRoomCore::removeAvatar(unsigned avatarID) { - ChatAvatarCore *returnAvatar = nullptr; + ChatAvatarCore *returnAvatar = NULL; map::iterator iterCore = m_inroomAvatarsCore.find(avatarID); @@ -422,7 +422,7 @@ ChatAvatarCore *ChatRoomCore::removeAvatar(unsigned avatarID) ChatAvatarCore *ChatRoomCore::addBan(ChatAvatarCore *newAvatar) { - ChatAvatarCore *returnAvatar = nullptr; + ChatAvatarCore *returnAvatar = NULL; if(newAvatar) { @@ -446,7 +446,7 @@ ChatAvatarCore *ChatRoomCore::addBan(ChatAvatarCore *newAvatar) ChatAvatarCore *ChatRoomCore::removeBan(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - ChatAvatarCore *returnAvatar = nullptr; + ChatAvatarCore *returnAvatar = NULL; set::iterator iterCore = m_banAvatarsCore.begin(); @@ -494,7 +494,7 @@ ChatAvatarCore *ChatRoomCore::removeBan(const Plat_Unicode::String &name, const ChatAvatarCore *ChatRoomCore::addAdministrator(ChatAvatarCore *newAvatar) { - ChatAvatarCore *returnAvatar = nullptr; + ChatAvatarCore *returnAvatar = NULL; if(newAvatar) { @@ -518,7 +518,7 @@ ChatAvatarCore *ChatRoomCore::addAdministrator(ChatAvatarCore *newAvatar) ChatAvatarCore *ChatRoomCore::removeAdministrator(unsigned avatarID) { - ChatAvatarCore *returnAvatar = nullptr; + ChatAvatarCore *returnAvatar = NULL; map::iterator iterCore = m_adminAvatarsCore.find(avatarID); @@ -541,7 +541,7 @@ ChatAvatarCore *ChatRoomCore::removeAdministrator(unsigned avatarID) ChatAvatarCore *ChatRoomCore::addModerator(ChatAvatarCore *newAvatar) { - ChatAvatarCore *returnAvatar = nullptr; + ChatAvatarCore *returnAvatar = NULL; if(newAvatar) { @@ -565,7 +565,7 @@ ChatAvatarCore *ChatRoomCore::addModerator(ChatAvatarCore *newAvatar) ChatAvatarCore *ChatRoomCore::removeModerator(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - ChatAvatarCore *returnAvatar = nullptr; + ChatAvatarCore *returnAvatar = NULL; set::iterator iterCore = m_moderatorAvatarsCore.begin(); @@ -613,7 +613,7 @@ ChatAvatarCore *ChatRoomCore::removeModerator(const Plat_Unicode::String &name, ChatAvatarCore *ChatRoomCore::addTempModerator(ChatAvatarCore *newAvatar) { - ChatAvatarCore *returnAvatar = nullptr; + ChatAvatarCore *returnAvatar = NULL; if(newAvatar) { @@ -637,7 +637,7 @@ ChatAvatarCore *ChatRoomCore::addTempModerator(ChatAvatarCore *newAvatar) ChatAvatarCore *ChatRoomCore::removeTempModerator(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - ChatAvatarCore *returnAvatar = nullptr; + ChatAvatarCore *returnAvatar = NULL; set::iterator iterCore = m_tempModeratorAvatarsCore.begin(); @@ -685,7 +685,7 @@ ChatAvatarCore *ChatRoomCore::removeTempModerator(const Plat_Unicode::String &na ChatAvatarCore *ChatRoomCore::addInvite(ChatAvatarCore* newAvatar) { - ChatAvatarCore *returnAvatar = nullptr; + ChatAvatarCore *returnAvatar = NULL; if(newAvatar) { @@ -709,7 +709,7 @@ ChatAvatarCore *ChatRoomCore::addInvite(ChatAvatarCore* newAvatar) ChatAvatarCore *ChatRoomCore::removeInvite(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - ChatAvatarCore *returnAvatar = nullptr; + ChatAvatarCore *returnAvatar = NULL; set::iterator iterCore = m_inviteAvatarsCore.begin(); @@ -757,7 +757,7 @@ ChatAvatarCore *ChatRoomCore::removeInvite(const Plat_Unicode::String &name, con ChatAvatarCore *ChatRoomCore::addVoice(ChatAvatarCore* newAvatar) { - ChatAvatarCore *returnAvatar = nullptr; + ChatAvatarCore *returnAvatar = NULL; if(newAvatar) { @@ -781,7 +781,7 @@ ChatAvatarCore *ChatRoomCore::addVoice(ChatAvatarCore* newAvatar) ChatAvatarCore *ChatRoomCore::removeVoice(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - ChatAvatarCore *returnAvatar = nullptr; + ChatAvatarCore *returnAvatar = NULL; set::iterator iterCore = m_voiceAvatarsCore.begin(); @@ -1053,7 +1053,7 @@ void ChatRoomCore::serializeWithLocalAvatarsOnly(Base::ByteStream &msg) for (avatarIter = m_inroomAvatarsCore.begin(); avatarIter != m_inroomAvatarsCore.end(); ++avatarIter) { // include only the avatars that are on this API - if ( this->getAvatar((*avatarIter).second->getAvatarID()) != nullptr ) + if ( this->getAvatar((*avatarIter).second->getAvatarID()) != NULL ) { avatarsToSend.insert((*avatarIter).second); } diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Message.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Message.cpp index 93e7e8e5..d38defbc 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Message.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Message.cpp @@ -21,7 +21,7 @@ namespace ChatSystem MRoomMessage::MRoomMessage(ByteStream::ReadIterator &iter) : GenericMessage(MESSAGE_ROOMMESSAGE), - m_destList(nullptr), + m_destList(NULL), m_srcAvatar(iter), m_messageID(0) { @@ -45,13 +45,13 @@ namespace ChatSystem MRoomMessage::~MRoomMessage() { delete[] m_destList; - m_destList = nullptr; + m_destList = NULL; } MBroadcastMessage::MBroadcastMessage(ByteStream::ReadIterator &iter) : GenericMessage(MESSAGE_BROADCASTMESSAGE), m_srcAvatar(iter), - m_destList(nullptr) + m_destList(NULL) { ASSERT_VALID_STRING_LENGTH(get(iter, m_srcAddress)); get(iter, m_listLength); @@ -68,7 +68,7 @@ namespace ChatSystem MBroadcastMessage::~MBroadcastMessage() { delete[] m_destList; - m_destList = nullptr; + m_destList = NULL; } MFilterMessage::MFilterMessage(ByteStream::ReadIterator &iter) diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/PersistentMessage.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/PersistentMessage.cpp index bb9cfb82..ca4b509e 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/PersistentMessage.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/PersistentMessage.cpp @@ -8,7 +8,7 @@ using namespace Base; using namespace Plat_Unicode; PersistentHeader::PersistentHeader() -: m_core(nullptr) +: m_core(NULL) { } @@ -66,7 +66,7 @@ PersistentHeaderCore::PersistentHeaderCore() m_avatarID(0), m_sentTime(0), m_status(0), - m_interface(nullptr) + m_interface(NULL) { } diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Request.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Request.cpp index 2f7600ac..01afbcf7 100644 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Request.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Request.cpp @@ -127,7 +127,7 @@ void RGetAvatarKeywords::pack(ByteStream &msg) RSearchAvatarKeywords::RSearchAvatarKeywords(const ChatUnicodeString &nodeAddress, const ChatUnicodeString *keywordsList, unsigned keywordsLength) : GenericRequest(REQUEST_SEARCHAVATARKEYWORDS), m_keywordsLength(keywordsLength), - m_keywordsList(nullptr) + m_keywordsList(NULL) { m_nodeAddress.assign(nodeAddress.string_data); m_keywordsList = new String[keywordsLength]; @@ -898,7 +898,7 @@ m_srcAddress(srcAddress.string_data, srcAddress.string_length), m_destRoomAddress(destRoomAddress.string_data, destRoomAddress.string_length) { // we take in a const RoomParams, so make our own and guarantee - // nullptr-terminated char buffers. + // null-terminated char buffers. m_newRoomName.assign(params->getRoomName().string_data, params->getRoomName().string_length); m_newRoomTopic.assign(params->getRoomTopic().string_data, params->getRoomTopic().string_length); m_newRoomPassword.assign(params->getRoomPassword().string_data, params->getRoomPassword().string_length); diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Response.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Response.cpp index 44a2f0dd..25d587fc 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Response.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Response.cpp @@ -20,7 +20,7 @@ using namespace Plat_Unicode; ResLoginAvatar::ResLoginAvatar(void *user, int avatarLoginPriority) : GenericResponse(RESPONSE_LOGINAVATAR, CHATRESULT_TIMEOUT, user), - m_avatar(nullptr), + m_avatar(NULL), m_submittedPriority(avatarLoginPriority), m_requiredPriority(INT_MAX) { @@ -63,7 +63,7 @@ void ResLoginAvatar::unpack(ByteStream::ReadIterator &iter) ResTemporaryAvatar::ResTemporaryAvatar(void *user) : GenericResponse(RESPONSE_TEMPORARYAVATAR, CHATRESULT_TIMEOUT, user) -, m_avatar(nullptr) +, m_avatar(NULL) { } @@ -110,7 +110,7 @@ void ResDestroyAvatar::unpack(ByteStream::ReadIterator &iter) ResGetAvatar::ResGetAvatar(void *user) : GenericResponse(RESPONSE_GETAVATAR, CHATRESULT_TIMEOUT, user), - m_avatar(nullptr) + m_avatar(NULL) { } @@ -144,7 +144,7 @@ void ResGetAvatar::unpack(ByteStream::ReadIterator &iter) ResGetAnyAvatar::ResGetAnyAvatar(void* user) : GenericResponse( RESPONSE_GETANYAVATAR, CHATRESULT_TIMEOUT, user ) - , m_avatar( nullptr ) + , m_avatar( NULL ) { } @@ -181,8 +181,8 @@ void ResGetAnyAvatar::unpack(Base::ByteStream::ReadIterator& iter) ResAvatarList::ResAvatarList(void *user) : GenericResponse(RESPONSE_AVATARLIST, CHATRESULT_TIMEOUT, user) , m_listLength(0) -, m_avatarList(nullptr) -, m_cores(nullptr) +, m_avatarList(NULL) +, m_cores(NULL) { } @@ -214,7 +214,7 @@ void ResAvatarList::unpack(ByteStream::ReadIterator &iter) ResSetAvatarAttributes::ResSetAvatarAttributes(void *user) : GenericResponse(RESPONSE_SETAVATARATTRIBUTES, CHATRESULT_TIMEOUT, user), - m_avatar(nullptr) + m_avatar(NULL) { } @@ -248,7 +248,7 @@ void ResSetAvatarAttributes::unpack(ByteStream::ReadIterator &iter) ResSetAvatarStatusMessage::ResSetAvatarStatusMessage(void *user) : GenericResponse(RESPONSE_SETSTATUSMESSAGE, CHATRESULT_TIMEOUT, user), -m_avatar(nullptr) +m_avatar(NULL) { } @@ -285,7 +285,7 @@ void ResSetAvatarStatusMessage::unpack(ByteStream::ReadIterator &iter) ResSetAvatarForwardingEmail::ResSetAvatarForwardingEmail(void *user) : GenericResponse(RESPONSE_SETAVATAREMAIL, CHATRESULT_TIMEOUT, user), - m_avatar(nullptr) + m_avatar(NULL) { } @@ -312,7 +312,7 @@ void ResSetAvatarForwardingEmail::unpack(ByteStream::ReadIterator &iter) ResSetAvatarInboxLimit::ResSetAvatarInboxLimit(void *user) : GenericResponse(RESPONSE_SETAVATARINBOXLIMIT, CHATRESULT_TIMEOUT, user), - m_avatar(nullptr) + m_avatar(NULL) { } @@ -340,7 +340,7 @@ void ResSetAvatarInboxLimit::unpack(ByteStream::ReadIterator &iter) ResSearchAvatarKeywords::ResSearchAvatarKeywords(void *user) : GenericResponse(RESPONSE_SETAVATARKEYWORDS, CHATRESULT_TIMEOUT, user), m_numMatches(0), - m_avatarMatches(nullptr) + m_avatarMatches(NULL) { } @@ -388,8 +388,8 @@ void ResSetAvatarKeywords::unpack(ByteStream::ReadIterator &iter) ResGetAvatarKeywords::ResGetAvatarKeywords(void *user, unsigned avatarID) : GenericResponse(RESPONSE_GETAVATARKEYWORDS, CHATRESULT_TIMEOUT, user), m_avatarID(avatarID), - m_keywordList(nullptr), - m_chatStrList(nullptr) + m_keywordList(NULL), + m_chatStrList(NULL) { } @@ -420,7 +420,7 @@ void ResGetAvatarKeywords::unpack(ByteStream::ReadIterator &iter) ResGetRoom::ResGetRoom(void *user) : GenericResponse(RESPONSE_GETROOM, CHATRESULT_TIMEOUT, user), - m_room(nullptr), + m_room(NULL), m_numExtraRooms(0) { } @@ -448,7 +448,7 @@ void ResGetRoom::unpack(ByteStream::ReadIterator &iter) ResCreateRoom::ResCreateRoom(void *user, unsigned avatarID) : GenericResponse(RESPONSE_CREATEROOM, CHATRESULT_TIMEOUT, user), m_srcAvatarID(avatarID), - m_room(nullptr), + m_room(NULL), m_numExtraRooms(0) { } @@ -637,8 +637,8 @@ ResFriendStatus::ResFriendStatus(void *user, unsigned avatarID) : GenericResponse(RESPONSE_FRIENDSTATUS, CHATRESULT_TIMEOUT, user), m_avatarID(avatarID), m_listLength(0), - m_friendList(nullptr), - m_cores(nullptr) + m_friendList(NULL), + m_cores(NULL) { } @@ -704,8 +704,8 @@ ResIgnoreStatus::ResIgnoreStatus(void *user, unsigned avatarID) : GenericResponse(RESPONSE_IGNORESTATUS, CHATRESULT_TIMEOUT, user), m_avatarID(avatarID), m_listLength(0), - m_ignoreList(nullptr), - m_cores(nullptr) + m_ignoreList(NULL), + m_cores(NULL) { } @@ -740,7 +740,7 @@ ResEnterRoom::ResEnterRoom(void *user, unsigned avatarID, const ChatUnicodeStrin m_avatarID(avatarID), m_destAddress(destAddress.string_data, destAddress.string_length), m_gotRoomObj(false), - m_room(nullptr), + m_room(NULL), m_numExtraRooms(0) { } @@ -1012,7 +1012,7 @@ void ResChangeRoomOwner::unpack(ByteStream::ReadIterator &iter) ResGetRoomSummaries::ResGetRoomSummaries(void *user) : GenericResponse(RESPONSE_GETROOMSUMMARIES, CHATRESULT_TIMEOUT, user), m_numRooms(0), - m_roomSummaries(nullptr) + m_roomSummaries(NULL) { } @@ -1132,8 +1132,8 @@ ResGetPersistentMessage::ResGetPersistentMessage(void *user, unsigned srcAvatarI : GenericResponse(RESPONSE_GETPERSISTENTMESSAGE, CHATRESULT_TIMEOUT, user), m_srcAvatarID(srcAvatarID), m_messageID(messageID), - m_core(nullptr), - m_header(nullptr) + m_core(NULL), + m_header(NULL) { } @@ -1167,7 +1167,7 @@ void ResGetPersistentMessage::unpack(ByteStream::ReadIterator &iter) ResGetMultiplePersistentMessages::ResGetMultiplePersistentMessages(void *user, unsigned srcAvatarID) : GenericResponse(RESPONSE_GETMULTIPLEPERSISTENTMESSAGES, CHATRESULT_TIMEOUT, user), m_srcAvatarID(srcAvatarID), - m_messages(nullptr) + m_messages(NULL) { } @@ -1217,8 +1217,8 @@ ResGetPersistentHeaders::ResGetPersistentHeaders(void *user, unsigned srcAvatarI : GenericResponse(RESPONSE_GETPERSISTENTHEADERS, CHATRESULT_TIMEOUT, user), m_srcAvatarID(srcAvatarID), m_listLength(0), - m_headers(nullptr), - m_cores(nullptr) + m_headers(NULL), + m_cores(NULL) { } @@ -1263,8 +1263,8 @@ ResGetPartialPersistentHeaders::ResGetPartialPersistentHeaders(void *user, unsig : GenericResponse(RESPONSE_PARTIALPERSISTENTHEADERS, CHATRESULT_TIMEOUT, user), m_srcAvatarID(srcAvatarID), m_listLength(0), - m_headers(nullptr), - m_cores(nullptr) + m_headers(NULL), + m_cores(NULL) { } @@ -1396,7 +1396,7 @@ void ResUnregisterRoom::unpack(ByteStream::ReadIterator &iter) } ResFailoverReloginAvatar::ResFailoverReloginAvatar(unsigned avatarID) -: GenericResponse(RESPONSE_FAILOVER_RELOGINAVATAR, CHATRESULT_TIMEOUT, nullptr), +: GenericResponse(RESPONSE_FAILOVER_RELOGINAVATAR, CHATRESULT_TIMEOUT, NULL), m_avatarID(avatarID) { } @@ -1414,9 +1414,9 @@ void ResFailoverReloginAvatar::unpack(ByteStream::ReadIterator &iter) } ResFailoverRecreateRoom::ResFailoverRecreateRoom(unsigned roomID, bool forced) -: GenericResponse(RESPONSE_FAILOVER_RECREATEROOM, CHATRESULT_TIMEOUT, nullptr), +: GenericResponse(RESPONSE_FAILOVER_RECREATEROOM, CHATRESULT_TIMEOUT, NULL), m_roomID(roomID), - m_room(nullptr), + m_room(NULL), m_forced(forced) { } @@ -1478,7 +1478,7 @@ void ResGetFanClubHandle::unpack(ByteStream::ReadIterator &iter) ResFindAvatarByUID::ResFindAvatarByUID(void *user) : GenericResponse(RESPONSE_FINDAVATARBYUID, CHATRESULT_TIMEOUT, user), m_numAvatarsOnline(0), - m_avatars(nullptr) + m_avatars(NULL) { } @@ -1512,7 +1512,7 @@ void ResFindAvatarByUID::unpack(ByteStream::ReadIterator &iter) } ResRegistrarGetChatServer::ResRegistrarGetChatServer() -: GenericResponse(RESPONSE_REGISTRAR_GETCHATSERVER, CHATRESULT_TIMEOUT, nullptr) +: GenericResponse(RESPONSE_REGISTRAR_GETCHATSERVER, CHATRESULT_TIMEOUT, NULL) { } @@ -1527,7 +1527,7 @@ void ResRegistrarGetChatServer::unpack(ByteStream::ReadIterator &iter) } ResSendApiVersion::ResSendApiVersion() -: GenericResponse(RESPONSE_SETAPIVERSION, CHATRESULT_TIMEOUT, nullptr) +: GenericResponse(RESPONSE_SETAPIVERSION, CHATRESULT_TIMEOUT, NULL) { } @@ -1600,8 +1600,8 @@ void ResRemoveSnoopRoom::unpack(ByteStream::ReadIterator &iter) ResGetSnoopList::ResGetSnoopList(void *user, unsigned srcAvatarID) : GenericResponse(RESPONSE_GETSNOOPLIST, CHATRESULT_TIMEOUT, user), m_srcAvatarID(srcAvatarID), - m_avatarSnoops(nullptr), - m_roomSnoops(nullptr) + m_avatarSnoops(NULL), + m_roomSnoops(NULL) { } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/Archive.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Base/Archive.cpp index 2d6b1839..c7a1b9a8 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/Archive.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/Archive.cpp @@ -107,7 +107,7 @@ namespace Base ByteStream::ByteStream() : allocatedSize(0), beginReadIterator(), - data(nullptr), + data(NULL), size(0), lastPutSize(0) { @@ -224,7 +224,7 @@ namespace Base if(data->size < allocatedSize) { unsigned char * tmp = new unsigned char[newSize]; - if(data->buffer != nullptr) + if(data->buffer != NULL) memcpy(tmp, data->buffer, size); delete[] data->buffer; data->buffer = tmp; diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/AutoLog.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Base/AutoLog.cpp index 24292a4e..660d838d 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/AutoLog.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/AutoLog.cpp @@ -35,7 +35,7 @@ bool CAutoLog::Open(const char * filename) //------------------------------------- { - if( nullptr == filename) + if( NULL == filename) return false; if (pFilename) @@ -45,13 +45,13 @@ bool CAutoLog::Open(const char * filename) // Sanitize slashes char *ptr; - while ((ptr = strchr(pFilename,WRONGSLASH)) != nullptr) + while ((ptr = strchr(pFilename,WRONGSLASH)) != NULL) *ptr = SLASHCHAR[0]; char strPath[1024]; strcpy(strPath,pFilename); ptr = strrchr(strPath, SLASHCHAR[0]); - if (ptr != nullptr) + if (ptr != NULL) { *ptr = 0; @@ -59,11 +59,11 @@ bool CAutoLog::Open(const char * filename) char curdir[128]; // remember current directory - if( getcwd(curdir,sizeof(curdir)) == nullptr ) + if( getcwd(curdir,sizeof(curdir)) == NULL ) { fprintf(stderr,"CAutoLog::Archive failed to get current directory!\n"); free(pFilename); - pFilename = nullptr; + pFilename = NULL; return false; // error, can't proceed } @@ -74,7 +74,7 @@ bool CAutoLog::Open(const char * filename) { fprintf(stderr,"CAutoLog::Archive failed to make directory: %s\n", strPath); free(pFilename); - pFilename = nullptr; + pFilename = NULL; return false; // error, can't proceed } } @@ -94,7 +94,7 @@ bool CAutoLog::Open(const char * filename) { fprintf(stderr,"CAutoLog::Archive failed to make directory: %s\n", strPath); free(pFilename); - pFilename = nullptr; + pFilename = NULL; return false; // error, can't proceed } } @@ -103,7 +103,7 @@ bool CAutoLog::Open(const char * filename) pFile = fopen(pFilename,"a+"); - if( pFile == nullptr || pFile == (FILE *)-1) + if( pFile == NULL || pFile == (FILE *)-1) { //fprintf(stderr,"CAutoLog::Open failed to open log file: %s\n",pFilename); Close(); @@ -123,7 +123,7 @@ bool CAutoLog::Open(const char * filename) void CAutoLog::Close(void) //------------------------------------- { - if( pFile != (FILE *)-1 && pFile != nullptr) + if( pFile != (FILE *)-1 && pFile != NULL) { fclose(pFile); } @@ -131,7 +131,7 @@ void CAutoLog::Close(void) free(pFilename); - pFilename = nullptr; + pFilename = NULL; } //------------------------------------- @@ -194,7 +194,7 @@ void CAutoLog::LogDebug(char * format, ...) void CAutoLog::Log(eLogLevel severity, char *fmt, ...) //------------------------------------- { - if (pFile == (FILE *)-1 || pFile == nullptr) + if (pFile == (FILE *)-1 || pFile == NULL) { //fprintf(stderr,"CAutoLog::Log called with no file open!\n"); return; @@ -250,7 +250,7 @@ void CAutoLog::Log(eLogLevel severity, char *fmt, ...) void CAutoLog::Archive(void) //------------------------------------- { - if( pFile == (FILE *)-1 || pFile == nullptr) + if( pFile == (FILE *)-1 || pFile == NULL) { //fprintf(stderr,"CAutoLog::Archive called with no file open!\n"); return; @@ -281,7 +281,7 @@ void CAutoLog::Archive(void) strcpy(strCurrent,pFilename); pCurrent = strrchr(strCurrent, SLASHCHAR[0]); - if (pCurrent != nullptr) + if (pCurrent != NULL) *pCurrent = 0; else sprintf(strCurrent,"."); @@ -290,7 +290,7 @@ void CAutoLog::Archive(void) #ifdef WIN32 // remember current directory - if( getcwd(curdir,sizeof(curdir)) == nullptr ) + if( getcwd(curdir,sizeof(curdir)) == NULL ) { fprintf(stderr,"CAutoLog::Archive failed to get current directory!\n"); return; // error, can't proceed @@ -324,7 +324,7 @@ void CAutoLog::Archive(void) #endif pCurrent = strrchr(pFilename, SLASHCHAR[0]); - if (pCurrent == nullptr) + if (pCurrent == NULL) pCurrent = pFilename; else pCurrent++; diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/AutoLog.h b/external/3rd/library/soePlatform/ChatAPI/utils/Base/AutoLog.h index 18871c7f..0a90a774 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/AutoLog.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/AutoLog.h @@ -92,14 +92,14 @@ namespace Base //------------------------------------- inline CAutoLog::CAutoLog() { - pFilename = nullptr; + pFilename = NULL; pFile = (FILE *)-1; } //------------------------------------- inline CAutoLog::CAutoLog(const char * file) { - pFilename = nullptr; + pFilename = NULL; pFile = (FILE *)-1; Open(file); } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/CmdLine.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Base/CmdLine.cpp index dcaf025a..b9d5b3e3 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/CmdLine.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/CmdLine.cpp @@ -135,7 +135,7 @@ int CCmdLine::SplitLine(int argc, char **argv) bool CCmdLine::IsSwitch(const char *pParam) { - if (pParam==nullptr) + if (pParam==NULL) return false; // switches must non-empty @@ -204,7 +204,7 @@ StringType CCmdLine::GetSafeArgument(const char *pSwitch, int iIdx, const char * { StringType sRet; - if (pDefault!=nullptr) + if (pDefault!=NULL) sRet = pDefault; try diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/Config.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Base/Config.cpp index eb6dc55e..c5dd63d8 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/Config.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/Config.cpp @@ -28,7 +28,7 @@ bool CConfig::LoadFile(char * file) // open file fp = fopen(file, "r"); - if (fp == nullptr || fp == (FILE *)-1) + if (fp == NULL || fp == (FILE *)-1) { //fprintf(stderr,"Failed to open config file %s!",file); return false; @@ -71,21 +71,21 @@ void CConfig::UnloadFile(void) //----------------------------------- { delete[] pConfig; - pConfig = nullptr; + pConfig = NULL; } //----------------------------------- /// finds a key of the config in memory // key argument is case-insensitive, but must be upper case in config file -// Returns true for success (passing nullptr is a special case returned as success) +// Returns true for success (passing NULL is a special case returned as success) bool CConfig::FindKey(char *key) //----------------------------------- { - if (pConfig == nullptr) + if (pConfig == NULL) return false; // special case...continue with existing key - if (key == nullptr) + if (key == NULL) return true; // form the search key @@ -96,12 +96,12 @@ bool CConfig::FindKey(char *key) // find the key heading pCursor = strstr(pConfig,strBuffer); - if (pCursor==nullptr) + if (pCursor==NULL) return false; // find the closing bracket of key heading pCursor = strchr(pCursor,']'); - if (pCursor==nullptr) + if (pCursor==NULL) return false; pCursor++; @@ -110,7 +110,7 @@ bool CConfig::FindKey(char *key) //----------------------------------- /// extract a number from the config string -// pass the key to find the first number in the list, else nullptr to find the next number in the list +// pass the key to find the first number in the list, else NULL to find the next number in the list // returns 0 if no number is found, else returns the number long CConfig::GetLong(char *key) //----------------------------------- @@ -133,20 +133,20 @@ long CConfig::GetLong(char *key) //----------------------------------- /// extract string (in double-quotes) from the list. -// pass the key to find the first string in the list, else nullptr to find the next string in the list -// returns nullptr if no string found, else returns a temporary copy of the string (without quotes) +// pass the key to find the first string in the list, else NULL to find the next string in the list +// returns NULL if no string found, else returns a temporary copy of the string (without quotes) char * CConfig::GetString(char *key) //----------------------------------- { if (!FindKey(key)) - return nullptr; + return NULL; // look for start of string or end of key while (*pCursor && *pCursor != '"' && *pCursor != '[') pCursor++; if (*(pCursor++) != '"') - return nullptr; + return NULL; // until closing quote int c = 0; @@ -160,7 +160,7 @@ char * CConfig::GetString(char *key) } } - return nullptr; + return NULL; } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/Config.h b/external/3rd/library/soePlatform/ChatAPI/utils/Base/Config.h index 6f6dc376..864506f3 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/Config.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/Config.h @@ -10,7 +10,7 @@ ; list of strings, with code example # config.FindKey("NUMBERS"); -# while (number = config.GetLong(nullptr)) +# while (number = config.GetLong(NULL)) # YourHandleNumber(number); [NUMBERS] 100 200, 300 ; formatting is very flexible as long as numbers are delimited by non-numbers @@ -23,7 +23,7 @@ ; list of strings, with code example # config.FindKey("HOSTS"); -# while (string = config.GetString(nullptr)) +# while (string = config.GetString(NULL)) # YourHandleString(string); [HOSTS] "127.0.0.1:5999" @@ -68,16 +68,16 @@ namespace Base // returns TRUE if key is found. bool FindKey(char *key); - // extract string from config. If key is nullptr, extract next string in list, else extract first string. - // if key was not found, returns nullptr - char * GetString(char *key = nullptr); + // extract string from config. If key is NULL, extract next string in list, else extract first string. + // if key was not found, returns NULL + char * GetString(char *key = NULL); - // extract number from config. If key is nullptr, extract next number in list, else extract first number. + // extract number from config. If key is NULL, extract next number in list, else extract first number. // if key was not found, returns 0 - long GetLong(char *key = nullptr); // extract number from config. + long GetLong(char *key = NULL); // extract number from config. // indicate if config file has been loaded - inline bool FileLoaded() { return pConfig == nullptr ? false : true; } + inline bool FileLoaded() { return pConfig == NULL ? false : true; } private: char * pConfig; // pointer to file memory @@ -87,14 +87,14 @@ namespace Base inline CConfig::CConfig() { - pConfig = nullptr; - pCursor = nullptr; + pConfig = NULL; + pCursor = NULL; } inline CConfig::CConfig(char * file) { - pConfig = nullptr; - pCursor = nullptr; + pConfig = NULL; + pCursor = NULL; LoadFile(file); } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/Logger.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Base/Logger.cpp index 4cdc4532..8942bfdd 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/Logger.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/Logger.cpp @@ -120,7 +120,7 @@ Logger::Logger(const char *programName, void Logger::LoggerInit(const char *programName) { char buf[1024]; - FILE *logDir = nullptr; + FILE *logDir = NULL; if (0 != (m_combinedLogType & eUseLocalFile)) { @@ -129,13 +129,13 @@ void Logger::LoggerInit(const char *programName) { cmkdir(m_dirPrefix.c_str(), 0755); } - else if(logDir != nullptr) + else if(logDir != NULL) { fclose(logDir); } tm now; - time_t t = time(nullptr); + time_t t = time(NULL); LOGGER_GET_CURR_TIME(now, t); @@ -153,7 +153,7 @@ void Logger::LoggerInit(const char *programName) { cmkdir(buf, 0755); } - else if(logDir != nullptr) + else if(logDir != NULL) { fclose(logDir); } @@ -279,7 +279,7 @@ void Logger::addLog(const char *id, unsigned logenum, int level, unsigned size) else { newLog->file = fopen(newLog->filename.c_str(), "a+"); - if(newLog->file == nullptr) + if(newLog->file == NULL) { printf("Open file %s failed\n", newLog->filename.c_str()); } @@ -313,7 +313,7 @@ void Logger::addLog(const char *id, unsigned logenum) else { newLog->file = fopen(newLog->filename.c_str(), "a+"); - if(newLog->file == nullptr) + if(newLog->file == NULL) { printf("Open file %s failed\n", newLog->filename.c_str()); } @@ -368,7 +368,7 @@ void Logger::logSimple(unsigned logenum, int level, const char *message) { return; } - time_t t = time(nullptr); + time_t t = time(NULL); LogInfo *info = (*iter).second; if(level >= info->level) { @@ -444,7 +444,7 @@ void Logger::logSimpleWithSys(unsigned logenum, unsigned priority, int level, co { return; } - time_t t = time(nullptr); + time_t t = time(NULL); LogInfo *info = (*iter).second; if(level >= info->level) @@ -514,7 +514,7 @@ void Logger::log(unsigned logenum, int level, const char *message, ...) // ensure that the buf does not contain any '%' characters. // prevent crash problem char *rv; - while((rv = strchr(buf, '%')) != nullptr) + while((rv = strchr(buf, '%')) != NULL) { *rv = ' '; // replace with space } @@ -546,7 +546,7 @@ void Logger::logWithSys(unsigned logenum, unsigned priority, int level, const ch { return; } - time_t t = time(nullptr); + time_t t = time(NULL); LogInfo *info = (*iter).second; if(level >= info->level) @@ -604,14 +604,14 @@ void Logger::logWithSys(unsigned logenum, unsigned priority, int level, const ch void Logger::rollDate(time_t t) { char buf[80]; - FILE *logDir = nullptr; + FILE *logDir = NULL; logDir = fopen(m_dirPrefix.c_str(), "r+"); if(errno == ENOENT) { cmkdir(m_dirPrefix.c_str(), 0755); } - else if(logDir != nullptr) + else if(logDir != NULL) { fclose(logDir); } @@ -627,7 +627,7 @@ void Logger::rollDate(time_t t) { cmkdir(buf, 0755); } - else if(logDir != nullptr) + else if(logDir != NULL) { fclose(logDir); } @@ -711,7 +711,7 @@ void Logger::rollLog(LogInfo *logInfo) { std::string newLogName; char timeStampBuffer[256]; - time_t t = time(nullptr); + time_t t = time(NULL); tm now; int r; int nTries = 10; diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/Statistics.h b/external/3rd/library/soePlatform/ChatAPI/utils/Base/Statistics.h index 0856034b..18e0579e 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/Statistics.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/Statistics.h @@ -34,9 +34,9 @@ namespace Base bool commit = false; if (!mLastSampleTime) - mLastSampleTime = time(nullptr); + mLastSampleTime = time(NULL); - if (!mSampleFrequency || mLastSampleTime + mSampleFrequency < (unsigned)time(nullptr)) + if (!mSampleFrequency || mLastSampleTime + mSampleFrequency < (unsigned)time(NULL)) { mSampleTotal++; mAggregateTotal += value; diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/TemplateObjectAllocator.h b/external/3rd/library/soePlatform/ChatAPI/utils/Base/TemplateObjectAllocator.h index ed1a7937..40227673 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/TemplateObjectAllocator.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/TemplateObjectAllocator.h @@ -93,7 +93,7 @@ namespace Base void Destroy(TYPE *object) { - if (object == nullptr) + if (object == NULL) return; #ifdef USE_ALLOCATOR_MUTEX @@ -142,7 +142,7 @@ namespace Base void FastDestroy(TYPE *object) { - if (object == nullptr) + if (object == NULL) return; object->~TYPE(); diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/WideString.h b/external/3rd/library/soePlatform/ChatAPI/utils/Base/WideString.h index 28159b18..775f9713 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/WideString.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/WideString.h @@ -94,12 +94,12 @@ namespace ucs2 } //////////////////////////////////////// - // target string is a nullptr-terminated C string + // target string is a null-terminated C string inline string::string(const char * copy) : mLength(0), mData(8,0) { - // (1) protect from nullptr pointer + // (1) protect from null pointer if (!copy) { return; @@ -111,12 +111,12 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *copy++; } - // (3) ensure nullptr termination + // (3) ensure null termination mData[mLength]=0; } //////////////////////////////////////// - // target string is a C string that may or may not include nullptr characters + // target string is a C string that may or may not include null characters inline string::string(const std::string & copy) : mLength(copy.length()), mData(8,0) @@ -126,17 +126,17 @@ namespace ucs2 // (2) perform transform to copy the narrow string to our // wide string std::transform(copy.begin(), copy.end(), mData.begin(), NarrowToWide); - // (3) ensure nullptr termination + // (3) ensure null termination mData[mLength] = 0; } //////////////////////////////////////// - // target string is a wide nullptr-terminated C string + // target string is a wide null-terminated C string inline string::string(const char_type * copy) : mLength(0), mData(8,0) { - // (1) protect from nullptr pointer + // (1) protect from null pointer if (!copy) { return; @@ -148,7 +148,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *copy++; } - // (3) ensure nullptr termination + // (3) ensure null termination mData[mLength]=0; } @@ -169,7 +169,7 @@ namespace ucs2 inline string & string::operator=(const char * rhs) { mLength = 0; - // (1) protect from nullptr pointer + // (1) protect from null pointer if (!rhs) { mData[0] = 0; @@ -182,7 +182,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure nullptr termination + // (3) ensure null termination mData[mLength]=0; return *this; } @@ -195,7 +195,7 @@ namespace ucs2 // (2) perform transform to copy the narrow string to our // wide string std::transform(rhs.begin(), rhs.end(), mData.begin(), NarrowToWide); - // (3) ensure nullptr termination + // (3) ensure null termination mData[mLength] = 0; return *this; } @@ -203,7 +203,7 @@ namespace ucs2 inline string & string::operator=(const char_type * rhs) { mLength = 0; - // (1) protect from nullptr pointer + // (1) protect from null pointer if (!rhs) { mData[0] = 0; @@ -216,7 +216,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure nullptr termination + // (3) ensure null termination mData[mLength]=0; return *this; } @@ -235,7 +235,7 @@ namespace ucs2 inline string & string::operator+=(const char * rhs) { - // (1) protect from nullptr pointer + // (1) protect from null pointer if (!rhs) { return *this; @@ -247,7 +247,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure nullptr termination + // (3) ensure null termination mData[mLength]=0; return *this; } @@ -259,7 +259,7 @@ namespace ucs2 // (2) perform transform to copy the narrow string to our // wide string std::transform(rhs.begin(), rhs.end(), mData.begin()+mLength, NarrowToWide); - // (3) ensure nullptr termination + // (3) ensure null termination mLength += rhs.length(); mData[mLength] = 0; return *this; @@ -267,7 +267,7 @@ namespace ucs2 inline string & string::operator+=(const char_type * rhs) { - // (1) protect from nullptr pointer + // (1) protect from null pointer if (!rhs) { return *this; @@ -279,7 +279,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure nullptr termination + // (3) ensure null termination mData[mLength]=0; return *this; } @@ -388,7 +388,7 @@ namespace ucs2 inline string & string::assign(const char_type * rhs) { mLength = 0; - // (1) protect from nullptr pointer + // (1) protect from null pointer if (!rhs) { mData[0] = 0; @@ -401,7 +401,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure nullptr termination + // (3) ensure null termination mData[mLength]=0; return *this; } @@ -409,7 +409,7 @@ namespace ucs2 inline string & string::assign(const char_type * rhs, size_type count) { mLength = 0; - // (1) protect from nullptr pointer + // (1) protect from null pointer if (!rhs) { mData[0] = 0; @@ -422,7 +422,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure nullptr termination + // (3) ensure null termination mData[mLength]=0; return *this; } @@ -463,7 +463,7 @@ namespace ucs2 inline string & string::assign(const char_type * first, const char_type * last) { mLength = 0; - // (1) protect from nullptr pointer + // (1) protect from null pointer if (!first || !last) { mData[0] = 0; @@ -476,14 +476,14 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *first++; } - // (3) ensure nullptr termination + // (3) ensure null termination mData[mLength]=0; return *this; } inline string & string::append(const char_type * rhs) { - // (1) protect from nullptr pointer + // (1) protect from null pointer if (!rhs) { return *this; @@ -495,14 +495,14 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure nullptr termination + // (3) ensure null termination mData[mLength]=0; return *this; } inline string & string::append(const char_type * rhs, size_type count) { - // (1) protect from nullptr pointer + // (1) protect from null pointer if (!rhs) { return *this; @@ -514,7 +514,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure nullptr termination + // (3) ensure null termination mData[mLength]=0; return *this; } @@ -558,7 +558,7 @@ namespace ucs2 inline string & string::append(const char_type * first, const char_type * last) { - // (1) protect from nullptr pointer + // (1) protect from null pointer if (!first || !last) { return *this; @@ -570,7 +570,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *first++; } - // (3) ensure nullptr termination + // (3) ensure null termination mData[mLength]=0; return *this; } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/BlockAllocator.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/BlockAllocator.cpp index 29d91074..4cefb9e7 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/BlockAllocator.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/BlockAllocator.cpp @@ -12,7 +12,7 @@ namespace Base { for(unsigned i = 0; i < 31; i++) { - m_blocks[i] = nullptr; + m_blocks[i] = NULL; } } @@ -21,7 +21,7 @@ namespace Base // free all allocated memory blocks for(unsigned i = 0; i < 31; i++) { - while(m_blocks[i] != nullptr) + while(m_blocks[i] != NULL) { unsigned *tmp = m_blocks[i]; m_blocks[i] = (unsigned *)*m_blocks[i]; @@ -36,7 +36,7 @@ namespace Base void *BlockAllocator::getBlock(unsigned bytes) { unsigned accum = 16, bits = 16; - unsigned *handle = nullptr; + unsigned *handle = NULL; // Perform a binary search looking for the highest bit. @@ -96,7 +96,7 @@ namespace Base void BlockAllocator::returnBlock(unsigned *handle) { - // C++ allows for safe deletion of a nullptr pointer + // C++ allows for safe deletion of a NULL pointer if(handle) { // Update the allocator linked list, insert this entry at the head diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/Event.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/Event.cpp index 72190595..a3cce3b1 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/Event.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/Event.cpp @@ -26,8 +26,8 @@ namespace Base mCond(), mThreadCount(0) { - pthread_mutex_init(&mMutex, nullptr); - pthread_cond_init(&mCond, nullptr); + pthread_mutex_init(&mMutex, NULL); + pthread_cond_init(&mCond, NULL); } CEvent::~CEvent() @@ -74,7 +74,7 @@ namespace Base struct timeval now; struct timespec abs_timeout; - gettimeofday(&now, nullptr); + gettimeofday(&now, NULL); abs_timeout.tv_sec = now.tv_sec + timeout/1000; abs_timeout.tv_nsec = now.tv_usec * 1000 + (timeout%1000)*1000000; abs_timeout.tv_sec += abs_timeout.tv_nsec / 1000000000; diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/Thread.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/Thread.cpp index f5bc4629..a4b1e3a2 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/Thread.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/Thread.cpp @@ -77,8 +77,8 @@ namespace Base CThreadPool::CMember::CMember(CThreadPool * parent) : mParent(parent), - mFunction(nullptr), - mArgument(nullptr), + mFunction(NULL), + mArgument(NULL), mSemaphore() { StartThread(); @@ -117,8 +117,8 @@ namespace Base if (mFunction) { mFunction(mArgument); - mArgument = nullptr; - mFunction = nullptr; + mArgument = NULL; + mFunction = NULL; } else if (mParent->OnDestory(this)) mThreadContinue = false; @@ -173,7 +173,7 @@ namespace Base } //////////////////////////////////////// - // (3) Delete the nullptr member threads + // (3) Delete the null member threads mMutex.Lock(); while (!mNullMember.empty()) { @@ -224,7 +224,7 @@ namespace Base } //////////////////////////////////////// - // (2) Delete any nullptr member threads. + // (2) Delete any null member threads. while (!mNullMember.empty()) { delete mNullMember.front(); diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/serialize.h b/external/3rd/library/soePlatform/ChatAPI/utils/Base/serialize.h index ed38802a..650681b5 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/serialize.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/serialize.h @@ -501,8 +501,8 @@ namespace soe } else { - //find nullptr terminator, if don't find it before maxLen, then err - const unsigned char *strEnd = nullptr; + //find null terminator, if don't find it before maxLen, then err + const unsigned char *strEnd = NULL; unsigned strLen = 0; for (;strLensetTrack(m_currTrack); res->setTrack(m_currTrack); - time_t timeout = time(nullptr) + m_requestTimeout; + time_t timeout = time(NULL) + m_requestTimeout; req->setTimeout(timeout); res->setTimeout(timeout); @@ -125,7 +125,7 @@ unsigned GenericAPICore::submitRequest(GenericRequest *req, GenericResponse *res } req->setTrack(m_currTrack); res->setTrack(m_currTrack); - time_t timeout = time(nullptr) + reqTimeout; + time_t timeout = time(NULL) + reqTimeout; req->setTimeout(timeout); res->setTimeout(timeout); @@ -140,7 +140,7 @@ void GenericAPICore::process() GenericResponse *res; // Process timeout on pending requests - regardless of whether processing is suspended or not - while((m_outCount > 0) && ((req = m_outboundQueue.front().first)->getTimeout() <= time(nullptr))) + while((m_outCount > 0) && ((req = m_outboundQueue.front().first)->getTimeout() <= time(NULL))) { --m_outCount; res = m_outboundQueue.front().second; @@ -152,7 +152,7 @@ void GenericAPICore::process() } // Process timeout on pending responses - while((m_pendingCount > 0) && ((res = (*m_pending.begin()).second)->getTimeout() <= time(nullptr))) + while((m_pendingCount > 0) && ((res = (*m_pending.begin()).second)->getTimeout() <= time(NULL))) { --m_pendingCount; m_pending.erase(m_pending.begin()); @@ -165,7 +165,7 @@ void GenericAPICore::process() while(m_outCount > 0) { GenericConnection *con = getNextActiveConnection(); - if (con != nullptr) + if (con != NULL) { pair out_pair = m_outboundQueue.front(); @@ -184,7 +184,7 @@ void GenericAPICore::process() else { #ifdef USE_SERIALIZE_LIB - const unsigned char *msgBuf = nullptr; + const unsigned char *msgBuf = NULL; unsigned msgSize = 0; msgBuf = req->pack(msgSize); con->Send(msgBuf, msgSize); @@ -222,7 +222,7 @@ GenericConnection *GenericAPICore::getNextActiveConnection() unsigned startIndex = m_nextConnectionIndex; unsigned maxIndex = m_serverConnections.size() - 1; - GenericConnection *con = nullptr; + GenericConnection *con = NULL; //loop until we find an active connection, or until we get back // to where we started @@ -242,7 +242,7 @@ GenericConnection *GenericAPICore::getNextActiveConnection() //went past end of vector, start back at 0 m_nextConnectionIndex = 0; } - }while (con == nullptr && m_nextConnectionIndex != startIndex); + }while (con == NULL && m_nextConnectionIndex != startIndex); return con; } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericConnection.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericConnection.cpp index 3c878e0a..3b677c70 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericConnection.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericConnection.cpp @@ -28,7 +28,7 @@ unsigned GenericConnection::ms_crcBytes = 0; GenericConnection::GenericConnection(const char *host, short port, GenericAPICore *apiCore, unsigned reconnectTimeout, unsigned noDataTimeoutSecs, unsigned noAckTimeoutSecs, unsigned incomingBufSizeInKB, unsigned outgoingBufSizeInKB, unsigned keepAlive, unsigned maxRecvMessageSizeInKB, unsigned holdTime) : m_bConnected(false), m_apiCore(apiCore), - m_con(nullptr), + m_con(NULL), m_host(host), m_nextHost(host), m_port(port), @@ -72,8 +72,8 @@ GenericConnection::~GenericConnection() { if(m_con) { - m_con->SetHandler(nullptr); - m_con->Disconnect();//don't worry about onterminated being called, we've set it's handler to nullptr, so it wont + m_con->SetHandler(NULL); + m_con->Disconnect();//don't worry about onterminated being called, we've set it's handler to null, so it wont m_con->Release(); } @@ -96,7 +96,7 @@ void GenericConnection::disconnect() { m_con->Disconnect(); //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); - m_con = nullptr; + m_con = NULL; } m_conState = CON_DISCONNECT; m_bConnected = false; @@ -112,7 +112,7 @@ void GenericConnection::OnTerminated(UdpConnection *con) if(m_con) { m_con->Release(); - m_con = nullptr; + m_con = NULL; } m_conState = CON_DISCONNECT; m_bConnected = false; @@ -146,7 +146,7 @@ void GenericConnection::OnRoutePacket(UdpConnection *con, const unsigned char *d get(iter, type); get(iter, track); #endif - GenericResponse *res = nullptr; + GenericResponse *res = NULL; // the following if block is a temporary fix that prevents // a crash with a game team in which they occasionally find @@ -208,7 +208,7 @@ void GenericConnection::process(bool giveTime) { m_con->SetHandler(this); m_conState = CON_NEGOTIATE; - m_conTimeout = time(nullptr) + m_reconnectTimeout; + m_conTimeout = time(NULL) + m_reconnectTimeout; } break; case CON_NEGOTIATE: @@ -225,12 +225,12 @@ void GenericConnection::process(bool giveTime) m_apiCore->OnConnect(m_host.c_str(), m_port); m_bConnected = true; } - else if(time(nullptr) > m_conTimeout) + else if(time(NULL) > m_conTimeout) { // we did not connect m_con->Disconnect(); //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); - m_con = nullptr; + m_con = NULL; m_conState = CON_DISCONNECT; m_bConnected = false; } @@ -246,7 +246,7 @@ void GenericConnection::process(bool giveTime) { m_con->Disconnect(); //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); - m_con = nullptr; + m_con = NULL; } } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpConnection.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpConnection.cpp index df2137bd..c9952e9a 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpConnection.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpConnection.cpp @@ -96,7 +96,7 @@ void UdpConnection::Init(UdpManager *udpManager, UdpPlatformAddress destIp, int mLastClockSyncTime = 0; mDataHoldTime = 0; mGettingTime = false; - mHandler = nullptr; + mHandler = NULL; mOtherSideProtocolVersion = 0; mNoDataTimeout = mUdpManager->mParams.noDataTimeout; @@ -108,7 +108,7 @@ void UdpConnection::Init(UdpManager *udpManager, UdpPlatformAddress destIp, int mIcmpErrorRetryStartStamp = 0; // when the timer started for ICMP error retry delay (gets reset on a successful packet receive) mPortRemapRequestStartStamp = 0; - mEncryptXorBuffer = nullptr; + mEncryptXorBuffer = NULL; mEncryptExpansionBytes = 0; mOrderedCountOutgoing = 0; mOrderedCountOutgoing2 = 0; @@ -120,7 +120,7 @@ void UdpConnection::Init(UdpManager *udpManager, UdpPlatformAddress destIp, int mConnectAttemptTimeout = 0; mConnectionCreateTime = mUdpManager->CachedClock(); mSimulateOutgoingQueueBytes = 0; - mPassThroughData = nullptr; + mPassThroughData = NULL; mSilentDisconnect = false; mLastSendBin = 0; @@ -140,7 +140,7 @@ UdpConnection::~UdpConnection() { UdpGuard myGuard(&mGuard); - assert(mUdpManager == nullptr); // this should not be possible, since the UdpManager holds a reference to us until we are disconnected and disassociated from the manager. If you are hitting this, then odds are the application is releasing the UdpConnection object more times than it should + assert(mUdpManager == NULL); // this should not be possible, since the UdpManager holds a reference to us until we are disconnected and disassociated from the manager. If you are hitting this, then odds are the application is releasing the UdpConnection object more times than it should for (int i = 0; i < cReliableChannelCount; i++) delete mChannel[i]; @@ -189,7 +189,7 @@ void UdpConnection::InternalDisconnect(int flushTimeout, DisconnectReason reason if (mStatus == cStatusNegotiating) flushTimeout = 0; - if (mUdpManager != nullptr) + if (mUdpManager != NULL) { if (flushTimeout > 0) { @@ -219,7 +219,7 @@ void UdpConnection::InternalDisconnect(int flushTimeout, DisconnectReason reason } UdpManager *holdUdpManager = mUdpManager; - mUdpManager = nullptr; + mUdpManager = NULL; mStatus = cStatusDisconnected; // only hold a reference to the UdpManager if it is not currently being destructed. @@ -274,7 +274,7 @@ bool UdpConnection::Send(UdpChannel channel, const void *data, int dataLen) if (dataLen == 0) // zero length packets are ignored return(false); - assert(data != nullptr); // can't send a nullptr packet + assert(data != NULL); // can't send a null packet // zero-escape application packets that start with 0 if ((*(const udp_uchar *)data) == 0) @@ -290,7 +290,7 @@ bool UdpConnection::Send(UdpChannel channel, const LogicalPacket *packet) { UdpGuard myGuard(&mGuard); - assert(packet != nullptr); // can't send a nullptr packet + assert(packet != NULL); // can't send a null packet if (mStatus != cStatusConnected) // if we are no longer connected return(false); @@ -337,7 +337,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const udp_uchar *data, int { udp_uchar *bufPtr = tempBuffer; memcpy(bufPtr, data, dataLen); - if (data2 != nullptr) + if (data2 != NULL) memcpy(bufPtr + dataLen, data2, dataLen2); PhysicalSend(bufPtr, totalDataLen, true); return(true); @@ -350,9 +350,9 @@ bool UdpConnection::InternalSend(UdpChannel channel, const udp_uchar *data, int bufPtr[1] = cUdpPacketOrdered; UdpMisc::PutValue16(bufPtr + 2, (udp_ushort)(++mOrderedCountOutgoing & 0xffff)); memcpy(bufPtr + 4, data, dataLen); - if (data2 != nullptr) + if (data2 != NULL) memcpy(bufPtr + 4 + dataLen, data2, dataLen2); - BufferedSend(bufPtr, totalDataLen + 4, nullptr, 0, true); + BufferedSend(bufPtr, totalDataLen + 4, NULL, 0, true); return(true); break; } @@ -363,7 +363,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const udp_uchar *data, int bufPtr[1] = cUdpPacketOrdered2; UdpMisc::PutValue16(bufPtr + 2, (udp_ushort)(++mOrderedCountOutgoing2 & 0xffff)); memcpy(bufPtr + 4, data, dataLen); - if (data2 != nullptr) + if (data2 != NULL) memcpy(bufPtr + 4 + dataLen, data2, dataLen2); PhysicalSend(bufPtr, totalDataLen + 4, true); return(true); @@ -375,7 +375,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const udp_uchar *data, int case cUdpChannelReliable4: { int num = channel - cUdpChannelReliable1; - if (mChannel[num] == nullptr) + if (mChannel[num] == NULL) mChannel[num] = new UdpReliableChannel(num, this, &mUdpManager->mParams.reliable[num]); mChannel[num]->Send(data, dataLen, data2, dataLen2); return(true); @@ -410,9 +410,9 @@ void UdpConnection::GetStats(UdpConnectionStatistics *cs) { UdpGuard myGuard(&mGuard); - assert(cs != nullptr); + assert(cs != NULL); - if (mUdpManager == nullptr) + if (mUdpManager == NULL) return; *cs = mConnectionStats; @@ -428,7 +428,7 @@ void UdpConnection::GetStats(UdpConnectionStatistics *cs) if (cs->syncTheirSent > 0) cs->percentReceivedSuccess = (float)cs->syncOurReceived / (float)cs->syncTheirSent; cs->reliableAveragePing = 0; - if (mChannel[0] != nullptr) + if (mChannel[0] != NULL) cs->reliableAveragePing = mChannel[0]->GetAveragePing(); } @@ -437,7 +437,7 @@ void UdpConnection::ProcessRawPacket(const UdpManager::PacketHistoryEntry *e) UdpRef ref(this); UdpGuard guard(&mGuard); - if (mUdpManager == nullptr) + if (mUdpManager == NULL) return; if (e->mLen == 0) @@ -572,7 +572,7 @@ void UdpConnection::ProcessRawPacket(const UdpManager::PacketHistoryEntry *e) *decryptPtr++ = finalStart[1]; int len = (this->*(mDecryptFunction[j]))(decryptPtr, finalStart + 2, finalLen - 2); - if (mUdpManager == nullptr) + if (mUdpManager == NULL) return; if (len == -1) @@ -627,7 +627,7 @@ void UdpConnection::ProcessCookedPacket(const udp_uchar *data, int dataLen) { udp_uchar buf[256]; udp_uchar *bufPtr; - if (mUdpManager == nullptr) + if (mUdpManager == NULL) return; if (data[0] == 0 && dataLen > 1) @@ -826,7 +826,7 @@ void UdpConnection::ProcessCookedPacket(const udp_uchar *data, int dataLen) // (while processing this packet) ended up touching the packet-data and corrupting the next // packet in the multi-sequence. CallbackCorruptPacket(data, dataLen, cUdpCorruptionReasonMultiPacket); - if (mUdpManager == nullptr) + if (mUdpManager == NULL) return; } else @@ -943,7 +943,7 @@ void UdpConnection::ProcessCookedPacket(const udp_uchar *data, int dataLen) case cUdpPacketFragment4: { int num = (data[1] - cUdpPacketReliable1) % cReliableChannelCount; - if (mChannel[num] == nullptr) + if (mChannel[num] == NULL) mChannel[num] = new UdpReliableChannel(num, this, &mUdpManager->mParams.reliable[num]); mChannel[num]->ReliablePacket(data, dataLen); break; @@ -954,7 +954,7 @@ void UdpConnection::ProcessCookedPacket(const udp_uchar *data, int dataLen) case cUdpPacketAck4: { int num = data[1] - cUdpPacketAck1; - if (mChannel[num] != nullptr) + if (mChannel[num] != NULL) mChannel[num]->AckPacket(data, dataLen); break; } @@ -964,7 +964,7 @@ void UdpConnection::ProcessCookedPacket(const udp_uchar *data, int dataLen) case cUdpPacketAckAll4: { int num = data[1] - cUdpPacketAckAll1; - if (mChannel[num] != nullptr) + if (mChannel[num] != NULL) mChannel[num]->AckAllPacket(data, dataLen); break; } @@ -1015,7 +1015,7 @@ void UdpConnection::FlagPortUnreachable() void UdpConnection::GiveTime(bool fromManager) { UdpGuard myGuard(&mGuard); - if (mUdpManager == nullptr) + if (mUdpManager == NULL) return; if (fromManager && GetRefCount() == 2) @@ -1115,11 +1115,11 @@ void UdpConnection::InternalGiveTime() int totalPendingBytes = 0; for (int i = 0; i < cReliableChannelCount; i++) { - if (mChannel[i] != nullptr) + if (mChannel[i] != NULL) { totalPendingBytes += mChannel[i]->TotalPendingBytes(); int myNext = mChannel[i]->GiveTime(); - if (mUdpManager == nullptr) + if (mUdpManager == NULL) return; // giving the reliable channel time caused it to callback the application which may disconnect us nextSchedule = udpMin(nextSchedule, myNext); } @@ -1208,7 +1208,7 @@ void UdpConnection::InternalGiveTime() break; } - if (mUdpManager != nullptr) + if (mUdpManager != NULL) { // safety to prevent us for scheduling ourselves for a time period that has already passed, // as doing so could result in infinite looping in the priority queue processing. @@ -1227,7 +1227,7 @@ int UdpConnection::TotalPendingBytes() const int total = 0; for (int i = 0; i < cReliableChannelCount; i++) { - if (mChannel[i] != nullptr) + if (mChannel[i] != NULL) total += mChannel[i]->TotalPendingBytes(); } return(total); @@ -1293,7 +1293,7 @@ void UdpConnection::ExpireReceiveBin() void UdpConnection::PhysicalSend(const udp_uchar *data, int dataLen, bool appendAllowed) { - if (mUdpManager == nullptr) + if (mUdpManager == NULL) return; // if we attempt to do a physical send (ie. encrypt/compress/crc a packet) while we are not connected @@ -1322,7 +1322,7 @@ void UdpConnection::PhysicalSend(const udp_uchar *data, int dataLen, bool append // we know this internal packet will not be a connect or confirm packet since they are sent directly to RawSend to avoid getting encrypted *destPtr++ = finalStart[1]; int len = (this->*(mEncryptFunction[j]))(destPtr, finalStart + 2, finalLen - 2); - if (mUdpManager == nullptr) + if (mUdpManager == NULL) return; // if this assert triggers, it means the encryption pass expanded the size of the encrypted @@ -1393,8 +1393,8 @@ void UdpConnection::PhysicalSend(const udp_uchar *data, int dataLen, bool append // can note where the ack was placed and replace it udp_uchar *UdpConnection::BufferedSend(const udp_uchar *data, int dataLen, const udp_uchar *data2, int dataLen2, bool appendAllowed) { - if (mUdpManager == nullptr) - return(nullptr); + if (mUdpManager == NULL) + return(NULL); int used = (int)(mMultiBufferPtr - mMultiBufferData); int actualMaxDataHoldSize = udpMin(mUdpManager->mParams.maxDataHoldSize, mConnectionConfig.maxRawPacketSize); @@ -1409,7 +1409,7 @@ udp_uchar *UdpConnection::BufferedSend(const udp_uchar *data, int dataLen, const FlushMultiBuffer(); // now send it (the multi-buffer is empty if you need to use it temporarily to concatenate two data chunks -- it is large enough to hold the largest raw packet) - if (data2 != nullptr) + if (data2 != NULL) { memcpy(mMultiBufferData, data, dataLen); memcpy(mMultiBufferData + dataLen, data2, dataLen2); @@ -1417,7 +1417,7 @@ udp_uchar *UdpConnection::BufferedSend(const udp_uchar *data, int dataLen, const } else PhysicalSend(data, dataLen, appendAllowed); - return(nullptr); + return(NULL); } // if this data will not fit into buffer @@ -1445,7 +1445,7 @@ udp_uchar *UdpConnection::BufferedSend(const udp_uchar *data, int dataLen, const udp_uchar *placementPtr = mMultiBufferPtr; memcpy(mMultiBufferPtr, data, dataLen); mMultiBufferPtr += dataLen; - if (data2 != nullptr) + if (data2 != NULL) { memcpy(mMultiBufferPtr, data2, dataLen2); mMultiBufferPtr += dataLen2; @@ -1454,7 +1454,7 @@ udp_uchar *UdpConnection::BufferedSend(const udp_uchar *data, int dataLen, const if ((mMultiBufferPtr - mMultiBufferData) >= actualMaxDataHoldSize) { FlushMultiBuffer(); - placementPtr = nullptr; // it got flushed + placementPtr = NULL; // it got flushed } return(placementPtr); } @@ -1474,7 +1474,7 @@ void UdpConnection::FlushMultiBuffer() // notify all the reliable channels to clear their buffered acks for (int i = 0; i < cReliableChannelCount; i++) { - if (mChannel[i] != nullptr) + if (mChannel[i] != NULL) { mChannel[i]->ClearBufferedAck(); } @@ -1684,7 +1684,7 @@ void UdpConnection::SetupEncryptModel() mEncryptExpansionBytes += 0; // set up encrypt buffer (random numbers generated based on seed) - if (mEncryptXorBuffer == nullptr) + if (mEncryptXorBuffer == NULL) { int len = ((mUdpManager->mParams.maxRawPacketSize + 1) / 4) * 4; mEncryptXorBuffer = new udp_uchar[len]; @@ -1718,7 +1718,7 @@ void UdpConnection::GetChannelStatus(UdpChannel channel, ChannelStatus *channelS case cUdpChannelReliable2: case cUdpChannelReliable3: case cUdpChannelReliable4: - if (mChannel[channel - cUdpChannelReliable1] != nullptr) + if (mChannel[channel - cUdpChannelReliable1] != NULL) { mChannel[channel - cUdpChannelReliable1]->GetChannelStatus(channelStatus); } @@ -1763,7 +1763,7 @@ char *UdpConnection::GetDestinationString(char *buf, int bufLen) const UdpGuard myGuard(&mGuard); if (bufLen < 22) - return(nullptr); + return(NULL); UdpPlatformAddress ip = GetDestinationIp(); int port = GetDestinationPort(); char hold[256]; @@ -1794,7 +1794,7 @@ void UdpConnection::OnRoutePacket(const udp_uchar *data, int dataLen) { UdpGuard myGuard(&mHandlerGuard); - if (mHandler != nullptr) + if (mHandler != NULL) { mHandler->OnRoutePacket(this, data, dataLen); } @@ -1814,7 +1814,7 @@ void UdpConnection::OnRoutePacket(const udp_uchar *data, int dataLen) void UdpConnection::OnConnectComplete() { UdpGuard myGuard(&mHandlerGuard); - if (mHandler != nullptr) + if (mHandler != NULL) { mHandler->OnConnectComplete(this); } @@ -1823,7 +1823,7 @@ void UdpConnection::OnConnectComplete() void UdpConnection::OnTerminated() { UdpGuard myGuard(&mHandlerGuard); - if (mHandler != nullptr) + if (mHandler != NULL) { mHandler->OnTerminated(this); } @@ -1832,7 +1832,7 @@ void UdpConnection::OnTerminated() void UdpConnection::OnCrcReject(const udp_uchar *data, int dataLen) { UdpGuard myGuard(&mHandlerGuard); - if (mHandler != nullptr) + if (mHandler != NULL) { mHandler->OnCrcReject(this, data, dataLen); } @@ -1841,7 +1841,7 @@ void UdpConnection::OnCrcReject(const udp_uchar *data, int dataLen) void UdpConnection::OnPacketCorrupt(const udp_uchar *data, int dataLen, UdpCorruptionReason reason) { UdpGuard myGuard(&mHandlerGuard); - if (mHandler != nullptr) + if (mHandler != NULL) { mHandler->OnPacketCorrupt(this, data, dataLen, reason); } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpConnection.h b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpConnection.h index 253e9139..9d64e460 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpConnection.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpConnection.h @@ -153,7 +153,7 @@ class UdpConnection : public UdpGuardedRefCount, public PriorityQueueMember, pub int ConnectionAge() const; // returns the UdpManager object that is managing this connection - // will return nullptr if the connection has been disconnected for some reason (because disconnecting severes the link to UdpManager) + // will return NULL if the connection has been disconnected for some reason (because disconnecting severes the link to UdpManager) UdpManager *GetUdpManager() const; // returns the 32-bit encryption-code that was negotiated as part of the connection-establishment process. @@ -234,9 +234,9 @@ class UdpConnection : public UdpGuardedRefCount, public PriorityQueueMember, pub friend class UdpManager; friend class UdpReliableChannel; - // note: if connectPacket is nullptr, that means this connection object is being created to establish + // note: if connectPacket is NULL, that means this connection object is being created to establish // a new connection to the specified ip/port (ie. the connection starts out in cStatusNegotiating mode) - // if connectPacket is non-nullptr, that menas this connection object is being created to handle an + // if connectPacket is non-NULL, that menas this connection object is being created to handle an // incoming connect request and it will start out in cStatusConnected mode. UdpConnection(UdpManager *udpManager, UdpPlatformAddress destIp, int destPort, int timeout); // starts connection-establishment protocol UdpConnection(UdpManager *udpManager, const UdpManager::PacketHistoryEntry *e); // starts already connected, replying to connection request @@ -281,7 +281,7 @@ class UdpConnection : public UdpGuardedRefCount, public PriorityQueueMember, pub void RawSend(const udp_uchar *data, int dataLen); // nothing happens to the data here, it is given to the udpmanager and sent out the port void PhysicalSend(const udp_uchar *data, int dataLen, bool appendAllowed); // sends a physical packet (encrypts and adds crc bytes) udp_uchar *BufferedSend(const udp_uchar *data, int dataLen, const udp_uchar *data2, int dataLen2, bool appendAllowed); // buffers logical packets waiting til we have more data (makes multi-packets) - bool InternalSend(UdpChannel channel, const udp_uchar *data, int dataLen, const udp_uchar *data2 = nullptr, int dataLen2 = 0); + bool InternalSend(UdpChannel channel, const udp_uchar *data, int dataLen, const udp_uchar *data2 = NULL, int dataLen2 = 0); void InternalGiveTime(); void InternalDisconnect(int flushTimeout, DisconnectReason reason); @@ -527,7 +527,7 @@ inline void UdpConnection::ScheduleTimeNow() // prevents us from reprioritizing to 0, only to shortly thereafter be reprioritized to where we actually belong. if (!mGettingTime) { - if (mUdpManager != nullptr) + if (mUdpManager != NULL) mUdpManager->SetPriority(this, 0); } } @@ -575,7 +575,7 @@ inline int UdpConnection::LastReceive(UdpClockStamp useStamp) const inline int UdpConnection::LastReceive() const { UdpGuard guard(&mGuard); - if (mUdpManager == nullptr) + if (mUdpManager == NULL) return(0); return(mUdpManager->CachedClockElapsed(mLastReceiveTime)); } @@ -583,7 +583,7 @@ inline int UdpConnection::LastReceive() const inline int UdpConnection::ConnectionAge() const { UdpGuard guard(&mGuard); - if (mUdpManager == nullptr) + if (mUdpManager == NULL) return(0); return(mUdpManager->CachedClockElapsed(mConnectionCreateTime)); } @@ -591,7 +591,7 @@ inline int UdpConnection::ConnectionAge() const inline int UdpConnection::LastSend() const { UdpGuard guard(&mGuard); - if (mUdpManager == nullptr) + if (mUdpManager == NULL) return(0); return(mUdpManager->CachedClockElapsed(mLastSendTime)); } @@ -599,7 +599,7 @@ inline int UdpConnection::LastSend() const inline udp_ushort UdpConnection::ServerSyncStampShort() const { UdpGuard guard(&mGuard); - if (mUdpManager == nullptr) + if (mUdpManager == NULL) return(0); return((udp_ushort)(mUdpManager->LocalSyncStampShort() + (mSyncTimeDelta & 0xffff))); } @@ -607,7 +607,7 @@ inline udp_ushort UdpConnection::ServerSyncStampShort() const inline udp_uint UdpConnection::ServerSyncStampLong() const { UdpGuard guard(&mGuard); - if (mUdpManager == nullptr) + if (mUdpManager == NULL) return(0); return(mUdpManager->LocalSyncStampLong() + mSyncTimeDelta); } @@ -649,7 +649,7 @@ inline UdpConnection::DisconnectReason UdpConnection::GetOtherSideDisconnectReas inline int UdpConnection::OutgoingBytesLastSecond() { UdpGuard guard(&mGuard); - if (mUdpManager == nullptr) + if (mUdpManager == NULL) return(0); ExpireSendBin(); @@ -659,7 +659,7 @@ inline int UdpConnection::OutgoingBytesLastSecond() inline int UdpConnection::IncomingBytesLastSecond() { UdpGuard guard(&mGuard); - if (mUdpManager == nullptr) + if (mUdpManager == NULL) return(0); ExpireReceiveBin(); diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpDriverLinux.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpDriverLinux.cpp index aa11f5cd..da7bcc5c 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpDriverLinux.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpDriverLinux.cpp @@ -101,7 +101,7 @@ bool UdpPlatformDriver::SocketOpen(int port, int incomingBufferSize, int outgoin addr_loc.sin_family = PF_INET; addr_loc.sin_port = htons((unsigned short)port); addr_loc.sin_addr.s_addr = htonl(INADDR_ANY); - if (bindIpAddress != nullptr && bindIpAddress[0] != 0) + if (bindIpAddress != NULL && bindIpAddress[0] != 0) { unsigned long address = inet_addr(bindIpAddress); if (address != INADDR_NONE) @@ -201,7 +201,7 @@ bool UdpPlatformDriver::GetHostByName(UdpPlatformAddress *ipAddress, const char { struct hostent *lphp; lphp = gethostbyname(hostName); - if (lphp == nullptr) + if (lphp == NULL) { address = 0; } @@ -223,7 +223,7 @@ bool UdpPlatformDriver::GetSelfAddress(UdpPlatformAddress *ipAddress, bool prefe if (gethostname(hostname, sizeof(hostname)) == 0) { struct hostent *entry = gethostbyname(hostname); - if (entry != nullptr) + if (entry != NULL) { for (int i = 0; entry->h_addr_list[i] != 0; i++) { @@ -273,7 +273,7 @@ UdpClockStamp UdpPlatformDriver::Clock() UdpGuard guard(&mData->clockGuard); struct timeval tv; - gettimeofday(&tv, nullptr); + gettimeofday(&tv, NULL); UdpClockStamp cs = static_cast(tv.tv_sec) * 1000 + static_cast(tv.tv_usec / 1000); cs += mData->currentCorrection; if (cs < mData->lastStamp) @@ -319,7 +319,7 @@ int IcmpReceive(SOCKET socket, unsigned *address, int *port) return(-1); struct cmsghdr *cmsg; - for(cmsg = CMSG_FIRSTHDR(&msgh); cmsg != nullptr; cmsg = CMSG_NXTHDR(&msgh, cmsg)) + for(cmsg = CMSG_FIRSTHDR(&msgh); cmsg != NULL; cmsg = CMSG_NXTHDR(&msgh, cmsg)) { if(cmsg->cmsg_level == SOL_IP && cmsg->cmsg_type == IP_RECVERR) { @@ -378,7 +378,7 @@ void *GoThread(void *param) thread->mThreadData->running = false; thread->mThreadData->handle = 0; thread->Release(); - return(nullptr); + return(NULL); } UdpPlatformThreadObject::~UdpPlatformThreadObject() @@ -435,7 +435,7 @@ char *UdpPlatformAddress::GetAddress(char *buffer, int bufferLen) const *buffer = 0; return(buffer); } - assert(buffer != nullptr); + assert(buffer != NULL); sprintf(buffer, "%d.%d.%d.%d", mData[0], mData[1], mData[2], mData[3]); return(buffer); } @@ -444,7 +444,7 @@ void UdpPlatformAddress::SetAddress(const char *address) { for (int i = 0; i < 4; i++) { - mData[i] = (unsigned char)strtol(address, nullptr, 10); + mData[i] = (unsigned char)strtol(address, NULL, 10); while (*address >= '0' && *address <= '9') address++; if (*address != 0) diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpDriverWindows.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpDriverWindows.cpp index 4a2a80e7..04c0c4d0 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpDriverWindows.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpDriverWindows.cpp @@ -102,7 +102,7 @@ bool UdpPlatformDriver::SocketOpen(int port, int incomingBufferSize, int outgoin addr_loc.sin_family = PF_INET; addr_loc.sin_port = htons((unsigned short)port); addr_loc.sin_addr.s_addr = htonl(INADDR_ANY); - if (bindIpAddress != nullptr && bindIpAddress[0] != 0) + if (bindIpAddress != NULL && bindIpAddress[0] != 0) { unsigned long address = inet_addr(bindIpAddress); if (address != INADDR_NONE) @@ -205,7 +205,7 @@ bool UdpPlatformDriver::GetHostByName(UdpPlatformAddress *ipAddress, const char { struct hostent *lphp; lphp = gethostbyname(hostName); - if (lphp == nullptr) + if (lphp == NULL) { address = 0; } @@ -227,7 +227,7 @@ bool UdpPlatformDriver::GetSelfAddress(UdpPlatformAddress *ipAddress, bool prefe if (gethostname(hostname, sizeof(hostname)) == 0) { struct hostent *entry = gethostbyname(hostname); - if (entry != nullptr) + if (entry != NULL) { for (int i = 0; entry->h_addr_list[i] != 0; i++) { @@ -329,10 +329,10 @@ unsigned __stdcall GoThread(void *param) UdpPlatformThreadObject::~UdpPlatformThreadObject() { #ifndef UDPLIBRARY_SINGLE_THREAD - if (mThreadData->handle != nullptr) + if (mThreadData->handle != NULL) { CloseHandle(mThreadData->handle); - mThreadData->handle = nullptr; + mThreadData->handle = NULL; } #endif delete mThreadData; @@ -343,7 +343,7 @@ void UdpPlatformThreadObject::Start() AddRef(); #ifndef UDPLIBRARY_SINGLE_THREAD unsigned threadId; - mThreadData->handle = (HANDLE)_beginthreadex(nullptr, 0, &GoThread, this, 0, &threadId); + mThreadData->handle = (HANDLE)_beginthreadex(NULL, 0, &GoThread, this, 0, &threadId); #else GoThread(this); // run it inline in main thread (blocks til it's finished, so odds are it won't work, but they shouldn't be using it anyhow in this mode) #endif @@ -352,7 +352,7 @@ void UdpPlatformThreadObject::Start() UdpPlatformThreadObject::UdpPlatformThreadObject() { mThreadData = new UdpPlatformThreadData; - mThreadData->handle = nullptr; + mThreadData->handle = NULL; mThreadData->running = false; } @@ -389,7 +389,7 @@ char *UdpPlatformAddress::GetAddress(char *buffer, int bufferLen) const *buffer = 0; return(buffer); } - assert(buffer != nullptr); + assert(buffer != NULL); sprintf(buffer, "%d.%d.%d.%d", mData[0], mData[1], mData[2], mData[3]); return(buffer); } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpHashTable.h b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpHashTable.h index 9f24044e..10af003d 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpHashTable.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpHashTable.h @@ -38,11 +38,11 @@ template class HashTable bool Remove(T& obj, int hashValue); void Reset(); // removes all entries from the table - T *FindFirst(int hashValue) const; // returns nullptr if not found - T *FindNext(T *prevResult) const; // returns nullptr if not found + T *FindFirst(int hashValue) const; // returns NULL if not found + T *FindNext(T *prevResult) const; // returns NULL if not found - T *WalkFirst() const; // returns nullptr if not found - T *WalkNext(T *prevResult) const; // returns nullptr if not found + T *WalkFirst() const; // returns NULL if not found + T *WalkNext(T *prevResult) const; // returns NULL if not found void Resize(int hashSize); // the actual hash size will be rounded up to the next larger prime number (very slow, not recommended) void GetStatistics(HashTableStatistics *stats) const; @@ -64,7 +64,7 @@ template class HashTable template HashTable::HashTable(int hashSize) { - mTable = nullptr; + mTable = NULL; mTableSize = 0; mEntryCount = 0; mStatUsedSlots = 0; @@ -84,9 +84,9 @@ template void HashTable::Insert(T& obj, int hashValue) entry->hashValue = hashValue; int spot = ((unsigned)hashValue) % mTableSize; - if (mTable[spot] == nullptr) + if (mTable[spot] == NULL) { - entry->nextEntry = nullptr; + entry->nextEntry = NULL; mTable[spot] = entry; mStatUsedSlots++; } @@ -103,14 +103,14 @@ template bool HashTable::Remove(T& obj, int hashValue) int spot = ((unsigned)hashValue) % mTableSize; HashEntry* next = mTable[spot]; HashEntry** prev = &mTable[spot]; - while (next != nullptr) + while (next != NULL) { if (next->obj == obj && next->hashValue == hashValue) { *prev = next->nextEntry; delete next; mEntryCount--; - if (mTable[spot] == nullptr) + if (mTable[spot] == NULL) mStatUsedSlots--; return(true); break; @@ -127,17 +127,17 @@ template void HashTable::Reset() for (int spot = 0; spot < mTableSize; spot++) { HashEntry *curr = mTable[spot]; - if (curr != nullptr) + if (curr != NULL) { mStatUsedSlots--; - while (curr != nullptr) + while (curr != NULL) { HashEntry *next = curr->nextEntry; delete curr; mEntryCount--; curr = next; } - mTable[spot] = nullptr; + mTable[spot] = NULL; } } } @@ -145,13 +145,13 @@ template void HashTable::Reset() template T *HashTable::FindFirst(int hashValue) const { HashEntry *entry = mTable[((unsigned)hashValue) % mTableSize]; - while (entry != nullptr) + while (entry != NULL) { if (entry->hashValue == hashValue) return(&entry->obj); entry = entry->nextEntry; } - return(nullptr); + return(NULL); } template T *HashTable::FindNext(T *prevResult) const @@ -159,13 +159,13 @@ template T *HashTable::FindNext(T *prevResult) const HashEntry *entry = (HashEntry *)(((char *)prevResult) - offsetof(HashEntry, obj)); int hashValue = entry->hashValue; entry = entry->nextEntry; - while (entry != nullptr) + while (entry != NULL) { if (entry->hashValue == hashValue) return(&entry->obj); entry = entry->nextEntry; } - return(nullptr); + return(NULL); } template T *HashTable::WalkFirst() const @@ -173,10 +173,10 @@ template T *HashTable::WalkFirst() const for (int bucket = 0; bucket < mTableSize; bucket++) { HashEntry *entry = mTable[bucket]; - if (entry != nullptr) + if (entry != NULL) return(&entry->obj); } - return(nullptr); + return(NULL); } template T *HashTable::WalkNext(T *prevResult) const @@ -185,17 +185,17 @@ template T *HashTable::WalkNext(T *prevResult) const int bucket = ((unsigned)entry->hashValue) % mTableSize; entry = entry->nextEntry; - if (entry != nullptr) + if (entry != NULL) return(&entry->obj); bucket++; // go onto next bucket for (; bucket < mTableSize; bucket++) { HashEntry *entry = mTable[bucket]; - if (entry != nullptr) + if (entry != NULL) return(&entry->obj); } - return(nullptr); + return(NULL); } template void HashTable::Resize(int hashSize) @@ -215,16 +215,16 @@ template void HashTable::Resize(int hashSize) for (int i = 0; i < oldSize; i++) { HashEntry* next = oldTable[i]; - while (next != nullptr) + while (next != NULL) { HashEntry* hold = next; next = next->nextEntry; // insert hold into new table int spot = ((unsigned)hold->hashValue) % mTableSize; - if (mTable[spot] == nullptr) + if (mTable[spot] == NULL) { - hold->nextEntry = nullptr; + hold->nextEntry = NULL; mTable[spot] = hold; mStatUsedSlots++; } @@ -284,11 +284,11 @@ template class ObjectHashTable bool Remove(T *obj); void Reset(); // removes all entries from the table - T *FindFirst(int hashValue) const; // returns nullptr if not found - T *FindNext(T *prevResult) const; // returns nullptr if not found + T *FindFirst(int hashValue) const; // returns NULL if not found + T *FindNext(T *prevResult) const; // returns NULL if not found - T *WalkFirst() const; // returns nullptr if not found - T *WalkNext(T *prevResult) const; // returns nullptr if not found + T *WalkFirst() const; // returns NULL if not found + T *WalkNext(T *prevResult) const; // returns NULL if not found void Resize(int hashSize); // the actual hash size will be rounded up to the next larger prime number (very slow, not recommended) void GetStatistics(HashTableStatistics *stats) const; @@ -303,7 +303,7 @@ template class ObjectHashTable template ObjectHashTable::ObjectHashTable(int hashSize) { - mTable = nullptr; + mTable = NULL; mTableSize = 0; mEntryCount = 0; mStatUsedSlots = 0; @@ -320,9 +320,9 @@ template void ObjectHashTable::Insert(T *obj, int static_cast(obj)->mHashValue = hashValue; int spot = ((unsigned)hashValue) % mTableSize; - if (mTable[spot] == nullptr) + if (mTable[spot] == NULL) { - static_cast(obj)->mHashNextEntry = nullptr; + static_cast(obj)->mHashNextEntry = NULL; mTable[spot] = obj; mStatUsedSlots++; } @@ -339,14 +339,14 @@ template bool ObjectHashTable::Remove(T *obj) int spot = ((unsigned)static_cast(obj)->mHashValue) % mTableSize; T *cur = mTable[spot]; T **prev = &mTable[spot]; - while (cur != nullptr) + while (cur != NULL) { if (cur == obj) { *prev = static_cast(cur)->mHashNextEntry; - static_cast(cur)->mHashNextEntry = nullptr; + static_cast(cur)->mHashNextEntry = NULL; mEntryCount--; - if (mTable[spot] == nullptr) + if (mTable[spot] == NULL) mStatUsedSlots--; return(true); break; @@ -368,13 +368,13 @@ template void ObjectHashTable::Reset() template T *ObjectHashTable::FindFirst(int hashValue) const { T *entry = mTable[((unsigned)hashValue) % mTableSize]; - while (entry != nullptr) + while (entry != NULL) { if (static_cast(entry)->mHashValue == hashValue) return(entry); entry = static_cast(entry)->mHashNextEntry; } - return(nullptr); + return(NULL); } template T *ObjectHashTable::FindNext(T *prevResult) const @@ -382,13 +382,13 @@ template T *ObjectHashTable::FindNext(T *prevResul T *entry = prevResult; int hashValue = static_cast(entry)->mHashValue; entry = static_cast(entry)->mHashNextEntry; - while (entry != nullptr) + while (entry != NULL) { if (static_cast(entry)->mHashValue == hashValue) return(entry); entry = static_cast(entry)->mHashNextEntry; } - return(nullptr); + return(NULL); } template T *ObjectHashTable::WalkFirst() const @@ -396,10 +396,10 @@ template T *ObjectHashTable::WalkFirst() const for (int bucket = 0; bucket < mTableSize; bucket++) { T *entry = mTable[bucket]; - if (entry != nullptr) + if (entry != NULL) return(entry); } - return(nullptr); + return(NULL); } template T *ObjectHashTable::WalkNext(T *prevResult) const @@ -408,17 +408,17 @@ template T *ObjectHashTable::WalkNext(T *prevResul int bucket = ((unsigned)static_cast(entry)->mHashValue) % mTableSize; entry = static_cast(entry)->mHashNextEntry; - if (entry != nullptr) + if (entry != NULL) return(entry); bucket++; // go onto next bucket for (; bucket < mTableSize; bucket++) { entry = mTable[bucket]; - if (entry != nullptr) + if (entry != NULL) return(entry); } - return(nullptr); + return(NULL); } template void ObjectHashTable::Resize(int hashSize) @@ -438,16 +438,16 @@ template void ObjectHashTable::Resize(int hashSize for (int i = 0; i < oldSize; i++) { T *cur = oldTable[i]; - while (cur != nullptr) + while (cur != NULL) { T *hold = cur; cur = static_cast(cur)->mHashNextEntry; // insert hold into new table int spot = ((unsigned)static_cast(hold)->mHashValue) % mTableSize; - if (mTable[spot] == nullptr) + if (mTable[spot] == NULL) { - static_cast(hold)->mHashNextEntry = nullptr; + static_cast(hold)->mHashNextEntry = NULL; mTable[spot] = hold; mStatUsedSlots++; } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpLinkedList.h b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpLinkedList.h index ad2d7e63..6fab2d03 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpLinkedList.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpLinkedList.h @@ -14,8 +14,8 @@ template class UdpLinkedList; template class UdpLinkedListMember { public: - UdpLinkedListMember() { mPrev = nullptr; mNext = nullptr; } - UdpLinkedListMember(const UdpLinkedListMember &) { mPrev = nullptr; mNext = nullptr; } + UdpLinkedListMember() { mPrev = NULL; mNext = NULL; } + UdpLinkedListMember(const UdpLinkedListMember &) { mPrev = NULL; mNext = NULL; } ~UdpLinkedListMember() {} #if defined(_MSC_VER) && (_MSC_VER < 1300) // MSVC 7.0 is the first version to support friend templates @@ -60,8 +60,8 @@ template class UdpLinkedList template UdpLinkedList::UdpLinkedList(UdpLinkedListMember T::*node) { - mHead = nullptr; - mTail = nullptr; + mHead = NULL; + mTail = NULL; mNode = node; mCount = 0; } @@ -98,7 +98,7 @@ template int UdpLinkedList::Count() const template T *UdpLinkedList::Position(int index) const { T *cur = mHead; - while (cur != nullptr && index > 0) + while (cur != NULL && index > 0) { cur = Next(cur); index--; @@ -109,43 +109,43 @@ template T *UdpLinkedList::Position(int index) const template T *UdpLinkedList::Remove(T *cur) { UdpLinkedListMember *node = &(cur->*mNode); - if (node->mPrev == nullptr) + if (node->mPrev == NULL) mHead = node->mNext; else ((node->mPrev)->*mNode).mNext = node->mNext; - if (node->mNext == nullptr) + if (node->mNext == NULL) mTail = node->mPrev; else ((node->mNext)->*mNode).mPrev = node->mPrev; - node->mNext = nullptr; - node->mPrev = nullptr; + node->mNext = NULL; + node->mPrev = NULL; mCount--; return(cur); } template T *UdpLinkedList::RemoveHead() { - if (mHead == nullptr) - return(nullptr); + if (mHead == NULL) + return(NULL); return(Remove(mHead)); } template T *UdpLinkedList::RemoveTail() { - if (mTail == nullptr) - return(nullptr); + if (mTail == NULL) + return(NULL); return(Remove(mTail)); } template T *UdpLinkedList::InsertHead(T *cur) { - assert((cur->*mNode).mPrev == nullptr); - assert((cur->*mNode).mNext == nullptr); + assert((cur->*mNode).mPrev == NULL); + assert((cur->*mNode).mNext == NULL); (cur->*mNode).mNext = mHead; - if (mHead != nullptr) + if (mHead != NULL) { (mHead->*mNode).mPrev = cur; mHead = cur; @@ -161,12 +161,12 @@ template T *UdpLinkedList::InsertHead(T *cur) template T *UdpLinkedList::InsertTail(T *cur) { - assert((cur->*mNode).mPrev == nullptr); - assert((cur->*mNode).mNext == nullptr); + assert((cur->*mNode).mPrev == NULL); + assert((cur->*mNode).mNext == NULL); (cur->*mNode).mPrev = mTail; - if (mTail != nullptr) + if (mTail != NULL) { (mTail->*mNode).mNext = cur; mTail = cur; @@ -182,17 +182,17 @@ template T *UdpLinkedList::InsertTail(T *cur) template T *UdpLinkedList::InsertAfter(T *cur, T *prev) { - assert((cur->*mNode).mPrev == nullptr); - assert((cur->*mNode).mNext == nullptr); + assert((cur->*mNode).mPrev == NULL); + assert((cur->*mNode).mNext == NULL); - if (prev == nullptr) + if (prev == NULL) return(InsertHead(cur)); (cur->*mNode).mPrev = prev; (cur->*mNode).mNext = (prev->*mNode).mNext; (prev->*mNode).mNext = cur; - if ((cur->*mNode).mNext != nullptr) + if ((cur->*mNode).mNext != NULL) (((cur->*mNode).mNext)->*mNode).mPrev = cur; else mTail = cur; @@ -204,7 +204,7 @@ template T *UdpLinkedList::InsertAfter(T *cur, T *prev) template void UdpLinkedList::DeleteAll() { T *cur = First(); - while (cur != nullptr) + while (cur != NULL) { T *next = Next(cur); Remove(cur); @@ -216,7 +216,7 @@ template void UdpLinkedList::DeleteAll() template void UdpLinkedList::ReleaseAll() { T *cur = First(); - while (cur != nullptr) + while (cur != NULL) { T *next = Next(cur); Remove(cur); diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpLogicalPacket.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpLogicalPacket.cpp index 76171367..5ecce2fb 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpLogicalPacket.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpLogicalPacket.cpp @@ -31,7 +31,7 @@ SimpleLogicalPacket::SimpleLogicalPacket(const void *data, int dataLen) { mDataLen = dataLen; mData = new udp_uchar[mDataLen]; - if (data != nullptr) + if (data != NULL) memcpy(mData, data, mDataLen); } @@ -66,7 +66,7 @@ void SimpleLogicalPacket::SetDataLen(int len) GroupLogicalPacket::GroupLogicalPacket() : LogicalPacket() { mDataLen = 0; - mData = nullptr; + mData = NULL; } GroupLogicalPacket::~GroupLogicalPacket() @@ -76,13 +76,13 @@ GroupLogicalPacket::~GroupLogicalPacket() void GroupLogicalPacket::AddPacket(const LogicalPacket *packet) { - assert(packet != nullptr); + assert(packet != NULL); AddPacketInternal(packet->GetDataPtr(), packet->GetDataLen(), packet->IsInternalPacket()); } void GroupLogicalPacket::AddPacket(const void *data, int dataLen) { - assert(data != nullptr); + assert(data != NULL); assert(dataLen >= 0); AddPacketInternal(data, dataLen, false); } @@ -152,10 +152,10 @@ PooledLogicalPacket::PooledLogicalPacket(UdpManager *manager, int len) PooledLogicalPacket::~PooledLogicalPacket() { - if (mUdpManager != nullptr) + if (mUdpManager != NULL) { mUdpManager->PoolDestroyed(this); - mUdpManager = nullptr; + mUdpManager = NULL; } delete[] mData; @@ -168,7 +168,7 @@ void PooledLogicalPacket::AddRef() const void PooledLogicalPacket::Release() const { - if (GetRefCount() == 1 && mUdpManager != nullptr) + if (GetRefCount() == 1 && mUdpManager != NULL) { // the PoolReturn function steals our reference (ie, we don't release, they don't addref), this is for thread safety reasons mUdpManager->PoolReturn(const_cast(this)); @@ -208,9 +208,9 @@ void PooledLogicalPacket::SetDataLen(int len) void PooledLogicalPacket::SetData(const void *data, int dataLen, const void *data2, int dataLen2) { mDataLen = dataLen + dataLen2; - if (data != nullptr) + if (data != NULL) memcpy(mData, data, dataLen); - if (data2 != nullptr) + if (data2 != NULL) memcpy(mData + dataLen, data2, dataLen2); } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpLogicalPacket.h b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpLogicalPacket.h index 8e1525a8..6a5962c4 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpLogicalPacket.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpLogicalPacket.h @@ -81,7 +81,7 @@ class SimpleLogicalPacket : public LogicalPacket // it was originally created to allow the internal code to handle reliable data that was sent // via the Send(char *, int) api call. public: - SimpleLogicalPacket(const void *data, int dataLen); // data can be nullptr if you want to populate it after it is allocated (get the pointer and write to it) + SimpleLogicalPacket(const void *data, int dataLen); // data can be NULL if you want to populate it after it is allocated (get the pointer and write to it) virtual void *GetDataPtr(); virtual const void *GetDataPtr() const; virtual int GetDataLen() const; @@ -152,7 +152,7 @@ template class StructLogicalPacket : public LogicalPacket // with virtual functions) via this method as they may contain hidden data-members (such as pointers // to vtables). public: - StructLogicalPacket(T *initData = nullptr); + StructLogicalPacket(T *initData = NULL); virtual void *GetDataPtr(); virtual const void *GetDataPtr() const; virtual int GetDataLen() const; @@ -226,7 +226,7 @@ class PooledLogicalPacket : public LogicalPacket protected: friend class UdpManager; void TrueRelease() const; - void SetData(const void *data, int dataLen, const void *data2 = nullptr, int dataLen2 = 0); + void SetData(const void *data, int dataLen, const void *data2 = NULL, int dataLen2 = 0); UdpManager *mUdpManager; UdpLinkedListMember mAvailableLink; // for available linked list in manager UdpLinkedListMember mCreatedLink; // for created linked list in manager @@ -240,7 +240,7 @@ class PooledLogicalPacket : public LogicalPacket template FixedLogicalPacket::FixedLogicalPacket(const void *data, int dataLen) { mDataLen = dataLen; - if (data != nullptr) + if (data != NULL) memcpy(mData, data, mDataLen); } @@ -270,7 +270,7 @@ template void FixedLogicalPacket::SetDataLen(int l ///////////////////////////////////////////////////////////////////////// template StructLogicalPacket::StructLogicalPacket(T *initData) { - if (initData != nullptr) + if (initData != NULL) mStruct = *initData; } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpManager.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpManager.cpp index 2129e06f..5a63f361 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpManager.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpManager.cpp @@ -111,10 +111,10 @@ UdpManager::UdpManager(const UdpParams *params) : mConnectionList(&UdpConnection mParams.maxDataHoldSize = udpMin(mParams.maxDataHoldSize, mParams.maxRawPacketSize); mParams.packetHistoryMax = udpMax(1, mParams.packetHistoryMax); mPacketHistoryPosition = 0; - mPassThroughData = nullptr; - mBackgroundThread = nullptr; + mPassThroughData = NULL; + mBackgroundThread = NULL; - if (mParams.udpDriver != nullptr) + if (mParams.udpDriver != NULL) { mDriver = mParams.udpDriver; } @@ -154,7 +154,7 @@ UdpManager::UdpManager(const UdpParams *params) : mConnectionList(&UdpConnection mSimulateOutgoingQueueBytes = 0; if (mParams.avoidPriorityQueue) - mPriorityQueue = nullptr; + mPriorityQueue = NULL; else mPriorityQueue = new PriorityQueue(mParams.maxConnections); @@ -181,7 +181,7 @@ UdpManager::~UdpManager() { // Since the background thread holds a reference to the UdpManager while it is running, this should // not be possible. The only way it could happen is if somebody released the manager who should not have. - assert(mBackgroundThread == nullptr); + assert(mBackgroundThread == NULL); // next thing we must do is tell all the connections to disconnect (which severs their link to this dying manager) // this has to be done first since they will call back into us and have themselves removed from our connection-list/priority-queue/etc @@ -191,7 +191,7 @@ UdpManager::~UdpManager() UdpGuard cg(&mConnectionGuard); UdpConnection *cur = mConnectionList.First(); - while (cur != nullptr) + while (cur != NULL) { cur->AddRef(); cur->InternalDisconnect(0, UdpConnection::cDisconnectReasonManagerDeleted); // this will cause it to remove us from the mConnectionList @@ -216,9 +216,9 @@ UdpManager::~UdpManager() UdpGuard guard(&mPoolGuard); PooledLogicalPacket *walk = mPoolCreatedList.RemoveHead(); - while (walk != nullptr) + while (walk != NULL) { - walk->mUdpManager = nullptr; + walk->mUdpManager = NULL; walk = mPoolCreatedList.RemoveHead(); } // next release the ones we have in our available pool @@ -232,11 +232,11 @@ UdpManager::~UdpManager() CloseSocket(); - if (mParams.udpDriver == nullptr) + if (mParams.udpDriver == NULL) { delete mDriver; // we were not given a driver to use, so we must own this driver we have, so destroy it } - mDriver = nullptr; + mDriver = NULL; delete mAddressHashTable; delete mConnectCodeHashTable; @@ -295,7 +295,7 @@ void UdpManager::ProcessDisconnectPending() UdpGuard guard(&mDisconnectPendingGuard); UdpConnection *entry = mDisconnectPendingList.First(); - while (entry != nullptr) + while (entry != NULL) { UdpConnection *next = mDisconnectPendingList.Next(entry); if (entry->GetStatus() == UdpConnection::cStatusDisconnected) @@ -309,12 +309,12 @@ void UdpManager::ProcessDisconnectPending() void UdpManager::RemoveConnection(UdpConnection *con) { - assert(con != nullptr); // attemped to remove a nullptr connection object + assert(con != NULL); // attemped to remove a NULL connection object // note: it's a bug to Remove a connection object that is already removed...should never be able to happen. UdpGuard cg(&mConnectionGuard); - if (mPriorityQueue != nullptr) + if (mPriorityQueue != NULL) { mPriorityQueue->Remove(con); } @@ -326,7 +326,7 @@ void UdpManager::RemoveConnection(UdpConnection *con) void UdpManager::AddConnection(UdpConnection *con) { - assert(con != nullptr); // attemped to add a nullptr connection object + assert(con != NULL); // attemped to add a NULL connection object UdpGuard cg(&mConnectionGuard); con->AddRef(); // UdpManager keeps a soft reference to the connection (ie. if it sees it is the only one holding a reference, it releases it) @@ -341,17 +341,17 @@ void UdpManager::FlushAllMultiBuffer() mConnectionGuard.Enter(); UdpConnection *cur = mConnectionList.First(); - if (cur != nullptr) + if (cur != NULL) cur->AddRef(); mConnectionGuard.Leave(); - while (cur != nullptr) + while (cur != NULL) { cur->FlushMultiBuffer(); mConnectionGuard.Enter(); UdpConnection *next = mConnectionList.Next(cur); - if (next != nullptr) + if (next != NULL) next->AddRef(); mConnectionGuard.Leave(); @@ -366,15 +366,15 @@ void UdpManager::DisconnectAll() mConnectionGuard.Enter(); UdpConnection *cur = mConnectionList.First(); - if (cur != nullptr) + if (cur != NULL) cur->AddRef(); mConnectionGuard.Leave(); - while (cur != nullptr) + while (cur != NULL) { mConnectionGuard.Enter(); UdpConnection *next = mConnectionList.Next(cur); - if (next != nullptr) + if (next != NULL) next->AddRef(); mConnectionGuard.Leave(); @@ -392,7 +392,7 @@ void UdpManager::DeliverEvents(int maxProcessingTime) for (;;) { CallbackEvent *ce = EventListPop(); - if (ce == nullptr) + if (ce == NULL) break; switch(ce->mEventType) @@ -426,13 +426,13 @@ void UdpManager::DeliverEvents(int maxProcessingTime) { { // guard block UdpGuard hguard(&mHandlerGuard); - if (mParams.handler != nullptr) + if (mParams.handler != NULL) { mParams.handler->OnConnectRequest(ce->mSource); } } - if (ce->mSource->GetHandler() == nullptr) // if application did not set a handler, then the connection is considered refused + if (ce->mSource->GetHandler() == NULL) // if application did not set a handler, then the connection is considered refused { ce->mSource->InternalDisconnect(0, UdpConnection::cDisconnectReasonConnectionRefused); } @@ -513,7 +513,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) PacketHistoryEntry *e = SimulationReceive(); #endif - if (e == nullptr) + if (e == NULL) { mLastEmptySocketBufferStamp = CachedClock(); break; @@ -545,7 +545,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) if (giveConnectionsTime) { - if (mPriorityQueue != nullptr) + if (mPriorityQueue != NULL) { // give time to everybody in the priority-queue that needs it UdpClockStamp curPriority = CachedClock(); @@ -570,10 +570,10 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) mConnectionGuard.Enter(); top = mPriorityQueue->TopRemove(curPriority); - if (top != nullptr) + if (top != NULL) top->AddRef(); // must always addref connections while inside the connection guard mConnectionGuard.Leave(); - if (top == nullptr) + if (top == NULL) break; top->GiveTime(true); @@ -593,17 +593,17 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) // give time to everybody mConnectionGuard.Enter(); UdpConnection *cur = mConnectionList.First(); - if (cur != nullptr) + if (cur != NULL) cur->AddRef(); mConnectionGuard.Leave(); - while (cur != nullptr) + while (cur != NULL) { cur->GiveTime(true); mConnectionGuard.Enter(); UdpConnection *next = mConnectionList.Next(cur); - if (next != nullptr) + if (next != NULL) next->AddRef(); mConnectionGuard.Leave(); @@ -621,13 +621,13 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) UdpClockStamp curStamp = CachedClock(); SimulateQueueEntry *entry = mSimulateOutgoingList.First(); - while (entry != nullptr && curStamp >= mSimulateNextOutgoingTime) + while (entry != NULL && curStamp >= mSimulateNextOutgoingTime) { mSimulateOutgoingList.Remove(entry); SimulateQueueEntry *next = mSimulateOutgoingList.First(); // simulate a delay before next packet is considered (ie. simple lag) - if (next != nullptr) + if (next != NULL) { int latencyDelay = (mSimulation.simulateOutgoingLatency - CachedClockElapsed(next->mQueueTime)); mSimulateNextOutgoingTime = curStamp + latencyDelay; @@ -644,7 +644,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) ActualSendHelper(entry->mData, entry->mDataLen, entry->mIp, entry->mPort); UdpConnection *con = AddressGetConnection(entry->mIp, entry->mPort); - if (con != nullptr) + if (con != NULL) { con->mSimulateOutgoingQueueBytes -= entry->mDataLen; con->Release(); @@ -664,12 +664,12 @@ UdpConnection *UdpManager::EstablishConnection(const char *serverAddress, int se { UdpGuard guard(&mGiveTimeGuard); // probably not needed, I don't see any reason we can't do this while GiveTime is happening in the background...the connection list is protected independently...still, better safe than sorry - assert(serverAddress != nullptr); + assert(serverAddress != NULL); char useServerAddress[512]; UdpLibrary::UdpMisc::Strncpy(useServerAddress, serverAddress, sizeof(useServerAddress)); char *portPtr = strchr(useServerAddress, ':'); - if (portPtr != nullptr) + if (portPtr != NULL) { *portPtr++ = 0; serverPort = atoi(portPtr); @@ -679,21 +679,21 @@ UdpConnection *UdpManager::EstablishConnection(const char *serverAddress, int se assert(serverPort != 0); // can't connect to no port if (mConnectionList.Count() >= mParams.maxConnections) - return(nullptr); + return(NULL); // get server address UdpPlatformAddress destIp; if (!mDriver->GetHostByName(&destIp, useServerAddress)) { - return(nullptr); // could not resolve name + return(NULL); // could not resolve name } // first, see if we already have a connection object managing this ip/port, if we do, then fail UdpConnection *con = AddressGetConnection(destIp, serverPort); - if (con != nullptr) + if (con != NULL) { con->Release(); - return(nullptr); // already connected to this address/port + return(NULL); // already connected to this address/port } return(new UdpConnection(this, destIp, serverPort, timeout)); } @@ -709,7 +709,7 @@ void UdpManager::GetStats(UdpManagerStatistics *stats) { UdpGuard sg(&mStatsGuard); - assert(stats != nullptr); + assert(stats != NULL); *stats = mManagerStats; stats->poolAvailable = mPoolAvailableList.Count(); stats->poolCreated = mPoolCreatedList.Count(); @@ -737,10 +737,10 @@ void UdpManager::DumpPacketHistory(const char *filename) const { UdpGuard guard(&mGiveTimeGuard); - assert(filename != nullptr); + assert(filename != NULL); assert(filename[0] != 0); FILE *file = fopen(filename, "wt"); - if (file != nullptr) + if (file != NULL) { // dump history of packets... for (int i = 0; i < mParams.packetHistoryMax; i++) @@ -789,7 +789,7 @@ UdpManager::PacketHistoryEntry *UdpManager::SimulationReceive() for (;;) { PacketHistoryEntry *entry = ActualReceive(); - if (entry == nullptr) + if (entry == NULL) break; SimulateQueueEntry *qe = new SimulateQueueEntry(entry->mBuffer, entry->mLen, entry->mIp, entry->mPort, curStamp); @@ -797,7 +797,7 @@ UdpManager::PacketHistoryEntry *UdpManager::SimulationReceive() } SimulateQueueEntry *winner = mSimulateIncomingList.First(); - if (winner != nullptr && CachedClockElapsed(winner->mQueueTime) >= mSimulation.simulateIncomingLatency) + if (winner != NULL && CachedClockElapsed(winner->mQueueTime) >= mSimulation.simulateIncomingLatency) { mSimulateIncomingList.Remove(winner); int pos = mPacketHistoryPosition; @@ -809,14 +809,14 @@ UdpManager::PacketHistoryEntry *UdpManager::SimulationReceive() delete winner; return(mPacketHistory[pos]); } - return(nullptr); + return(NULL); } UdpManager::PacketHistoryEntry *UdpManager::ActualReceive() { UdpClockStamp curStamp = CachedClock(); if (mSimulation.simulateIncomingByteRate > 0 && curStamp < mSimulateNextIncomingTime) - return(nullptr); + return(NULL); UdpPlatformAddress fromAddress; int fromPort = 0; @@ -855,7 +855,7 @@ UdpManager::PacketHistoryEntry *UdpManager::ActualReceive() } return(mPacketHistory[pos]); } - return(nullptr); + return(NULL); } void UdpManager::ActualSend(const udp_uchar *data, int dataLen, UdpPlatformAddress ip, int port) @@ -876,7 +876,7 @@ void UdpManager::ActualSend(const udp_uchar *data, int dataLen, UdpPlatformAddre return; // no room, packet gets lost UdpConnection *con = AddressGetConnection(ip, port); - if (con != nullptr) + if (con != NULL) { if (mSimulation.simulateDestinationOverloadLevel > 0 && con->mSimulateOutgoingQueueBytes + dataLen > mSimulation.simulateDestinationOverloadLevel) { @@ -928,7 +928,7 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) UdpConnection *con = AddressGetConnection(e->mIp, e->mPort); - if (con == nullptr) + if (con == NULL) { if (e->mLen == 0) // len = 0 = ICMP error { @@ -946,7 +946,7 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) if (mConnectionList.Count() >= mParams.maxConnections) return; // can't handle any more connections, so ignore this request entirely - if (mParams.handler != nullptr) + if (mParams.handler != NULL) { UdpConnection *newcon = new UdpConnection(this, e); CallbackConnectRequest(newcon); @@ -968,7 +968,7 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) int encryptCode = UdpMisc::GetValue32(ptr); UdpConnection *con = ConnectCodeGetConnection(connectCode); - if (con != nullptr) + if (con != NULL) { if (mParams.allowAddressRemapping || con->mIp == e->mIp) { @@ -1025,7 +1025,7 @@ UdpConnection *UdpManager::AddressGetConnection(UdpPlatformAddress ip, int port) UdpGuard guard(&mConnectionGuard); UdpConnection *found = mAddressHashTable->FindFirst(AddressHashValue(ip, port)); - while (found != nullptr) + while (found != NULL) { if (found->mIp == ip && found->mPort == port) { @@ -1034,7 +1034,7 @@ UdpConnection *UdpManager::AddressGetConnection(UdpPlatformAddress ip, int port) } found = mAddressHashTable->FindNext(found); } - return(nullptr); + return(NULL); } UdpConnection *UdpManager::ConnectCodeGetConnection(int connectCode) const @@ -1042,7 +1042,7 @@ UdpConnection *UdpManager::ConnectCodeGetConnection(int connectCode) const UdpGuard guard(&mConnectionGuard); UdpConnection *found = mConnectCodeHashTable->FindFirst(connectCode); - while (found != nullptr) + while (found != NULL) { if (found->mConnectCode == connectCode) { @@ -1051,7 +1051,7 @@ UdpConnection *UdpManager::ConnectCodeGetConnection(int connectCode) const } found = mConnectCodeHashTable->FindNext(found); } - return(nullptr); + return(NULL); } LogicalPacket *UdpManager::CreatePacket(const void *data, int dataLen, const void *data2, int dataLen2) @@ -1063,7 +1063,7 @@ LogicalPacket *UdpManager::CreatePacket(const void *data, int dataLen, const voi { UdpGuard guard(&mPoolGuard); PooledLogicalPacket *lp = mPoolAvailableList.RemoveHead(); - if (lp == nullptr) + if (lp == NULL) { // create a new pooled packet to fulfil request lp = new PooledLogicalPacket(this, mParams.pooledPacketSize); @@ -1091,7 +1091,7 @@ void UdpManager::PoolDestroyed(PooledLogicalPacket *packet) char *UdpManager::GetLocalString(char *buf, int bufLen) const { if (bufLen < 22) - return(nullptr); + return(NULL); UdpPlatformAddress ip = GetLocalIp(); int port = GetLocalPort(); char hold[256]; @@ -1103,7 +1103,7 @@ UdpManager::CallbackEvent *UdpManager::AvailableEventBorrow() { UdpGuard guard(&mAvailableEventGuard); CallbackEvent *ce = mAvailableEventList.RemoveHead(); - if (ce == nullptr) + if (ce == NULL) { ce = new CallbackEvent(); } @@ -1127,7 +1127,7 @@ void UdpManager::EventListAppend(CallbackEvent *ce) { UdpGuard guard(&mEventListGuard); mEventList.InsertTail(ce); - if (ce->mPayload != nullptr) + if (ce->mPayload != NULL) { mEventListBytes += ce->mPayload->GetDataLen(); } @@ -1137,7 +1137,7 @@ UdpManager::CallbackEvent *UdpManager::EventListPop() { UdpGuard guard(&mEventListGuard); CallbackEvent *event = mEventList.RemoveHead(); - if (event != nullptr && event->mPayload != nullptr) + if (event != NULL && event->mPayload != NULL) { mEventListBytes -= event->mPayload->GetDataLen(); } @@ -1148,7 +1148,7 @@ UdpManager::CallbackEvent *UdpManager::EventListPop() void UdpManager::ThreadStart() { UdpGuard guard(&mThreadGuard); - if (mBackgroundThread == nullptr) + if (mBackgroundThread == NULL) { mBackgroundThread = new UdpManagerThread(this, mParams.threadSleepTime); mBackgroundThread->Start(); @@ -1158,12 +1158,12 @@ void UdpManager::ThreadStart() void UdpManager::ThreadStop() { UdpGuard guard(&mThreadGuard); - if (mBackgroundThread != nullptr) + if (mBackgroundThread != NULL) { assert(mRefCount > 1); // caller must hold a reference, and thread must hold a reference, so this should be true. If it asserts, it means the caller is using a UdpManager that it does not hold a reference to. mBackgroundThread->Stop(true); mBackgroundThread->Release(); - mBackgroundThread = nullptr; + mBackgroundThread = NULL; } } @@ -1256,13 +1256,13 @@ void UdpManager::CallbackConnectRequest(UdpConnection *con) { { // guard block UdpGuard hguard(&mHandlerGuard); - if (mParams.handler != nullptr) + if (mParams.handler != NULL) { mParams.handler->OnConnectRequest(con); } } - if (con->GetHandler() == nullptr) // if application did not set a handler, then the connection is considered refused + if (con->GetHandler() == NULL) // if application did not set a handler, then the connection is considered refused { con->InternalDisconnect(0, UdpConnection::cDisconnectReasonConnectionRefused); } @@ -1276,8 +1276,8 @@ void UdpManager::CallbackConnectRequest(UdpConnection *con) UdpManager::CallbackEvent::CallbackEvent() { mEventType = cCallbackEventNone; - mSource = nullptr; - mPayload = nullptr; + mSource = NULL; + mPayload = NULL; mReason = cUdpCorruptionReasonNone; } @@ -1291,7 +1291,7 @@ void UdpManager::CallbackEvent::SetEventData(CallbackEventType eventType, UdpCon mEventType = eventType; mSource = con; mSource->AddRef(); - if (payload != nullptr) + if (payload != NULL) { mPayload = payload; mPayload->AddRef(); @@ -1300,16 +1300,16 @@ void UdpManager::CallbackEvent::SetEventData(CallbackEventType eventType, UdpCon void UdpManager::CallbackEvent::ClearEventData() { - if (mSource != nullptr) + if (mSource != NULL) { mSource->Release(); - mSource = nullptr; + mSource = NULL; } - if (mPayload != nullptr) + if (mPayload != NULL) { mPayload->Release(); - mPayload = nullptr; + mPayload = NULL; } } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpManager.h b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpManager.h index 7c263031..3715a0b2 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpManager.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpManager.h @@ -178,7 +178,7 @@ struct UdpParams // pointer equal to your object and the UdpManager will call it as appropriate. The UdpConnection object // also has a handler mechanism that replaces the other callback functions below, see UdpConnection::SetHandler // if a handler is specified, the callback function is ignored, even if specified. - // default = nullptr (not used) + // default = NULL (not used) UdpManagerHandler *handler; // this is the maximum number of connections that can be established by this manager, any incoming/outgoing connections @@ -496,7 +496,7 @@ struct UdpParams // the UdpPlatformDriver object itself and chain the calls on through, plus do whatever else it wants; // however, that is not required. The application maintains ownership of this object and the object must // not be destroyed by the application until the UdpManager using it is destroyed. - // default = nullptr, meaning the UdpManager it will create it's own UdpPlatformDriver for use. + // default = NULL, meaning the UdpManager it will create it's own UdpPlatformDriver for use. UdpDriver *udpDriver; @@ -642,7 +642,7 @@ class UdpManager : public UdpGuardedRefCount // will call EstablishConnection, then sit in a loop calling UdpManager::GiveTime and checking to see // if the status of the returned UdpConnection object is changed from cStatusNegotiating. This allows // the application to look for the ESC key or timeout an attempted connection. - // This function will return nullptr if the manager object has exceeded its maximum number of connections + // This function will return NULL if the manager object has exceeded its maximum number of connections // or if the serverAddress cannot be resolved to an IP address // as is noted in the declaration, it is the responsibility of the application establishing the connection to delete it // setting the timeout value (in milliseconds) to something greater than 0 will cause the UdpConnection object to change @@ -685,13 +685,13 @@ class UdpManager : public UdpGuardedRefCount // a terminated packet. void DisconnectAll(); - // creates a logical packet and populates it with data. data can be nullptr, in which case it gives you logical packet + // creates a logical packet and populates it with data. data can be NULL, in which case it gives you logical packet // of the size specified, but copies no data into it. If you are using pool management (see Params::poolPacketMax), // it will give you a packet out of the pool if possible, otherwise it will create a packet for you. When logical // are packets are needed internally for various things (like reliable channel sends that use the (void *, int) interface) // they are gotten from this function, so your application can likely take advantage of pooling, even if it never bothers // to explicitly call this function. - LogicalPacket *CreatePacket(const void *data, int dataLen, const void *data2 = nullptr, int dataLen2 = 0); + LogicalPacket *CreatePacket(const void *data, int dataLen, const void *data2 = NULL, int dataLen2 = 0); void GetSimulation(UdpSimulationParameters *simulationParameters) const; void SetSimulation(const UdpSimulationParameters *simulationParameters); @@ -796,7 +796,7 @@ class UdpManager : public UdpGuardedRefCount CallbackEvent(); ~CallbackEvent(); - void SetEventData(CallbackEventType eventType, UdpConnection *con, const LogicalPacket *payload = nullptr); + void SetEventData(CallbackEventType eventType, UdpConnection *con, const LogicalPacket *payload = NULL); void ClearEventData(); CallbackEventType mEventType; @@ -926,7 +926,7 @@ inline void UdpManager::SetPriority(UdpConnection *con, UdpClockStamp stamp) if (stamp < mMinimumScheduledStamp) stamp = mMinimumScheduledStamp; - if (mPriorityQueue != nullptr) + if (mPriorityQueue != NULL) { mPriorityQueue->Add(con, stamp); } @@ -1025,7 +1025,7 @@ inline int UdpManager::CachedClockElapsed(UdpClockStamp start) inline int UdpManager::EncryptUserSupplied(UdpConnection *con, udp_uchar *destData, const udp_uchar *sourceData, int sourceLen) { UdpGuard guard(&mHandlerGuard); - if (mParams.handler != nullptr) + if (mParams.handler != NULL) { return(mParams.handler->OnUserSuppliedEncrypt(con, destData, sourceData, sourceLen)); } @@ -1035,7 +1035,7 @@ inline int UdpManager::EncryptUserSupplied(UdpConnection *con, udp_uchar *destDa inline int UdpManager::EncryptUserSupplied2(UdpConnection *con, udp_uchar *destData, const udp_uchar *sourceData, int sourceLen) { UdpGuard guard(&mHandlerGuard); - if (mParams.handler != nullptr) + if (mParams.handler != NULL) { return(mParams.handler->OnUserSuppliedEncrypt2(con, destData, sourceData, sourceLen)); } @@ -1045,7 +1045,7 @@ inline int UdpManager::EncryptUserSupplied2(UdpConnection *con, udp_uchar *destD inline int UdpManager::DecryptUserSupplied(UdpConnection *con, udp_uchar *destData, const udp_uchar *sourceData, int sourceLen) { UdpGuard guard(&mHandlerGuard); - if (mParams.handler != nullptr) + if (mParams.handler != NULL) { return(mParams.handler->OnUserSuppliedDecrypt(con, destData, sourceData, sourceLen)); } @@ -1055,7 +1055,7 @@ inline int UdpManager::DecryptUserSupplied(UdpConnection *con, udp_uchar *destDa inline int UdpManager::DecryptUserSupplied2(UdpConnection *con, udp_uchar *destData, const udp_uchar *sourceData, int sourceLen) { UdpGuard guard(&mHandlerGuard); - if (mParams.handler != nullptr) + if (mParams.handler != NULL) { return(mParams.handler->OnUserSuppliedDecrypt2(con, destData, sourceData, sourceLen)); } @@ -1070,7 +1070,7 @@ inline int UdpManager::DecryptUserSupplied2(UdpConnection *con, udp_uchar *destD ///////////////////////////////////////////////////////////////////////////////////////////////////// inline UdpParams::UdpParams(ManagerRole role) { - handler = nullptr; + handler = NULL; outgoingBufferSize = 64 * 1024; incomingBufferSize = 64 * 1024; packetHistoryMax = 4; @@ -1103,7 +1103,7 @@ inline UdpParams::UdpParams(ManagerRole role) reliableOverflowBytes = 0; lingerDelay = 10; bindIpAddress[0] = 0; - udpDriver = nullptr; + udpDriver = NULL; callbackEventPoolMax = 5000; eventQueuing = false; threadSleepTime = 20; diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.cpp index 651492fc..b50daae0 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.cpp @@ -113,19 +113,19 @@ void *UdpMisc::SmartResize(void *ptr, int bytes, int round) if (bytes == 0) { - if (ptr != nullptr) + if (ptr != NULL) { free((udp_uchar *)ptr - cAlignment); } - return(nullptr); + return(NULL); } udp_uchar *ptr2; - if (ptr == nullptr) + if (ptr == NULL) { ptr2 = (udp_uchar *)malloc(bytes + cAlignment); - if (ptr2 == nullptr) - return(nullptr); + if (ptr2 == NULL) + return(NULL); *(int *)ptr2 = bytes; return(ptr2 + cAlignment); } @@ -135,8 +135,8 @@ void *UdpMisc::SmartResize(void *ptr, int bytes, int round) return(ptr); ptr2 = (udp_uchar *)realloc((udp_uchar *)ptr - cAlignment, bytes + cAlignment); - if (ptr2 == nullptr) - return(nullptr); + if (ptr2 == NULL) + return(NULL); *(int *)ptr2 = bytes; return(ptr2 + cAlignment); @@ -199,30 +199,30 @@ LogicalPacket *UdpMisc::CreateQuickLogicalPacket(const void *data, int dataLen, switch(q) { case 0: - tlp = new FixedLogicalPacket(nullptr, totalDataLen); + tlp = new FixedLogicalPacket(NULL, totalDataLen); break; case 1: - tlp = new FixedLogicalPacket(nullptr, totalDataLen); + tlp = new FixedLogicalPacket(NULL, totalDataLen); break; case 2: case 3: - tlp = new FixedLogicalPacket(nullptr, totalDataLen); + tlp = new FixedLogicalPacket(NULL, totalDataLen); break; case 4: case 5: case 6: case 7: - tlp = new FixedLogicalPacket(nullptr, totalDataLen); + tlp = new FixedLogicalPacket(NULL, totalDataLen); break; default: - tlp = new SimpleLogicalPacket(nullptr, totalDataLen); + tlp = new SimpleLogicalPacket(NULL, totalDataLen); break; } udp_uchar *dest = (udp_uchar *)tlp->GetDataPtr(); - if (data != nullptr) + if (data != NULL) memcpy(dest, data, dataLen); - if (data2 != nullptr) + if (data2 != NULL) memcpy(dest + dataLen, data2, dataLen2); return(tlp); } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.h b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.h index f77380ca..3961823f 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.h @@ -57,7 +57,7 @@ class UdpMisc // memory manager does a little bit of this, but if you know you have an allocation that is likely // to grow quite a bit, you can set the round'ing size up to a fairly large number and avoid // unnecessary reallocs at the cost of a little potentially wasted space - // initial allocations are done by passing in ptr==nullptr, freeing is done by passing in bytes==0 + // initial allocations are done by passing in ptr==NULL, freeing is done by passing in bytes==0 static void *SmartResize(void *ptr, int bytes, int round = 1); // the following two functions store values in the buffer as a variable length (B1, 0xffB2B1, 0xffffffB4B3B2B1) @@ -78,7 +78,7 @@ class UdpMisc static udp_uint GetValue24(const void *buffer); // gets a 24-bit value from the buffer in big-endian format static udp_ushort GetValue16(const void *buffer); // gets a 16-bit value from the buffer in big-endian format - static LogicalPacket *CreateQuickLogicalPacket(const void *data, int dataLen, const void *data2 = nullptr, int dataLen2 = 0); + static LogicalPacket *CreateQuickLogicalPacket(const void *data, int dataLen, const void *data2 = NULL, int dataLen2 = 0); // looks up the specified name and translates it to an IP address // this is a blocking call that can at times take a significant amount of time, but will generally be fast (less than 300ms) diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpPriority.h b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpPriority.h index e4f2df20..c50dee62 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpPriority.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpPriority.h @@ -43,12 +43,12 @@ template class PriorityQueue PriorityQueue(int queueSize); ~PriorityQueue(); - T* Top(); // returns nullptr if queue is empty - T* TopRemove(); // returns nullptr if queue is empty - T* TopRemove(P priority); // removes item from queue if it has a lower priority value, otherwise return nullptr + T* Top(); // returns NULL if queue is empty + T* TopRemove(); // returns NULL if queue is empty + T* TopRemove(P priority); // removes item from queue if it has a lower priority value, otherwise return NULL T* Add(T* entry, P priority); // reprioritizes if already in queue, returns entry always T* Remove(T* entry); // returns entry always (even if it was not in the queue) - P *GetPriority(T* entry); // returns nullptr if entry is not in the queue + P *GetPriority(T* entry); // returns NULL if entry is not in the queue int QueueUsed(); // returns how many entries are in the queue protected: struct QueueEntry @@ -94,14 +94,14 @@ template PriorityQueue::~PriorityQueue() template T* PriorityQueue::Top() { if (mQueueEnd == 0) - return(nullptr); + return(NULL); return(mQueue[0].entry); } template T* PriorityQueue::TopRemove() { if (mQueueEnd == 0) - return(nullptr); + return(NULL); T* top = mQueue[0].entry; Remove(top); return(top); @@ -111,14 +111,14 @@ template T* PriorityQueue::TopRemove(P priority) { if (mQueueEnd > 0 && mQueue[0].priority <= priority) return(Remove(mQueue[0].entry)); - return(nullptr); + return(NULL); } template P* PriorityQueue::GetPriority(T* entry) { if (entry->mPriorityQueuePosition >= 0) return(&mQueue[entry->mPriorityQueuePosition].priority); - return(nullptr); + return(NULL); } template T* PriorityQueue::Add(T* entry, P priority) @@ -127,7 +127,7 @@ template T* PriorityQueue::Add(T* entry, P priorit { // not in queue, so add it to the bottom if (mQueueEnd >= mQueueSize) - return(nullptr); + return(NULL); mQueue[mQueueEnd].entry = entry; mQueue[mQueueEnd].priority = priority; mQueue[mQueueEnd].entry->mPriorityQueuePosition = mQueueEnd; diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpReliableChannel.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpReliableChannel.cpp index 5b6250f5..d31de9b4 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpReliableChannel.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpReliableChannel.cpp @@ -48,12 +48,12 @@ UdpReliableChannel::UdpReliableChannel(int channelNumber, UdpConnection *con, Ud mReliableOutgoingBytes = 0; mLogicalBytesQueued = 0; - mCoalescePacket = nullptr; - mCoalesceStartPtr = nullptr; - mCoalesceEndPtr = nullptr; + mCoalescePacket = NULL; + mCoalesceStartPtr = NULL; + mCoalesceEndPtr = NULL; mCoalesceCount = 0; - mBufferedAckPtr = nullptr; + mBufferedAckPtr = NULL; mStatDuplicatePacketsReceived = 0; mStatResentPacketsAccelerated = 0; @@ -69,7 +69,7 @@ UdpReliableChannel::UdpReliableChannel(int channelNumber, UdpConnection *con, Ud mBigDataLen = 0; mBigDataTargetLen = 0; - mBigDataPtr = nullptr; + mBigDataPtr = NULL; mFragmentNextPos = 0; mLastTimeStampAcknowledged = 0; mMaxxedOutCurrentWindow = false; @@ -81,14 +81,14 @@ UdpReliableChannel::UdpReliableChannel(int channelNumber, UdpConnection *con, Ud UdpReliableChannel::~UdpReliableChannel() { - if (mCoalescePacket != nullptr) + if (mCoalescePacket != NULL) { mCoalescePacket->Release(); - mCoalescePacket = nullptr; + mCoalescePacket = NULL; } const LogicalPacket *cur = mLogicalPacketList.RemoveHead(); - while (cur != nullptr) + while (cur != NULL) { cur->Release(); cur = mLogicalPacketList.RemoveHead(); @@ -103,7 +103,7 @@ UdpReliableChannel::~UdpReliableChannel() void UdpReliableChannel::Send(const udp_uchar *data, int dataLen, const udp_uchar *data2, int dataLen2) { - if (mLogicalPacketList.Count() == 0 && mCoalescePacket == nullptr) + if (mLogicalPacketList.Count() == 0 && mCoalescePacket == NULL) { // if we are adding something to a previously empty logical queue, then it is possible that // we may be able to send it, so mark ourselves to take time the next time it is offered @@ -126,7 +126,7 @@ void UdpReliableChannel::Send(const udp_uchar *data, int dataLen, const udp_ucha void UdpReliableChannel::FlushCoalesce() { - if (mCoalescePacket != nullptr) + if (mCoalescePacket != NULL) { if (mCoalesceCount == 1) { @@ -140,16 +140,16 @@ void UdpReliableChannel::FlushCoalesce() mCoalescePacket->SetDataLen((int)(mCoalesceEndPtr - mCoalesceStartPtr)); QueueLogicalPacket(mCoalescePacket); mCoalescePacket->Release(); - mCoalescePacket = nullptr; + mCoalescePacket = NULL; } } void UdpReliableChannel::SendCoalesce(const udp_uchar *data, int dataLen, const udp_uchar *data2, int dataLen2) { int totalLen = dataLen + dataLen2; - if (mCoalescePacket == nullptr) + if (mCoalescePacket == NULL) { - mCoalescePacket = mUdpConnection->mUdpManager->CreatePacket(nullptr, mMaxDataBytes); + mCoalescePacket = mUdpConnection->mUdpManager->CreatePacket(NULL, mMaxDataBytes); mCoalesceEndPtr = mCoalesceStartPtr = (udp_uchar *)mCoalescePacket->GetDataPtr(); *mCoalesceEndPtr++ = 0; *mCoalesceEndPtr++ = UdpConnection::cUdpPacketGroup; @@ -169,10 +169,10 @@ void UdpReliableChannel::SendCoalesce(const udp_uchar *data, int dataLen, const // append on end of coalesce mCoalesceCount++; mCoalesceEndPtr += UdpMisc::PutVariableValue(mCoalesceEndPtr, totalLen); - if (data != nullptr) + if (data != NULL) memcpy(mCoalesceEndPtr, data, dataLen); mCoalesceEndPtr += dataLen; - if (data2 != nullptr) + if (data2 != NULL) memcpy(mCoalesceEndPtr, data2, dataLen2); mCoalesceEndPtr += dataLen2; } @@ -287,7 +287,7 @@ int UdpReliableChannel::GiveTime() mMaxxedOutCurrentWindow = false; int outstandingNextSendTime = 10 * 60000; // if we have something to do - if (mReliableOutgoingPendingId < mReliableOutgoingId || mLogicalPacketList.Count() != 0 || mCoalescePacket != nullptr) + if (mReliableOutgoingPendingId < mReliableOutgoingId || mLogicalPacketList.Count() != 0 || mCoalescePacket != NULL) { // first, let's calculate how many bytes we figure is outstanding based on who is still waiting for an ack-packet UdpClockStamp oldestResendTime = udpMax(hotClock - optimalResendDelay, mLastTimeStampAcknowledged); // anything older than this, we need to resend @@ -317,7 +317,7 @@ int UdpReliableChannel::GiveTime() // if this packet has not been acked and it is NOT ready to be sent (was recently sent) then we consider it outstanding // note: packets needing re-sending probably got lost and are therefore not outstanding PhysicalPacket *entry = &mPhysicalPackets[i % mConfig.maxOutstandingPackets]; - if (entry->mDataPtr != nullptr) // acked packets set the dataPtr to nullptr + if (entry->mDataPtr != NULL) // acked packets set the dataPtr to NULL { // if this packet is ready to be sent (ie: needs time now, or some later packet has already been ack'ed) windowSpaceLeft -= entry->mDataLen; // window-space is effectively taken whether we have sent it yet or not @@ -524,7 +524,7 @@ int UdpReliableChannel::GiveTime() void UdpReliableChannel::GetChannelStatus(UdpConnection::ChannelStatus *channelStatus) const { int coalesceBytes = 0; - if (mCoalescePacket != nullptr) + if (mCoalescePacket != NULL) coalesceBytes = (int)(mCoalesceEndPtr - mCoalesceStartPtr); channelStatus->totalPendingBytes = mLogicalBytesQueued + mReliableOutgoingBytes + coalesceBytes; @@ -550,7 +550,7 @@ void UdpReliableChannel::GetChannelStatus(UdpConnection::ChannelStatus *channelS PhysicalPacket *entry = &mPhysicalPackets[mReliableOutgoingPendingId % mConfig.maxOutstandingPackets]; if (entry->mFirstTimeStamp != 0) // if has been sent (we know it hasn't been acknowledged or we couldn't possibly be pointing at it as pending) { - if (mUdpConnection->GetUdpManager() != nullptr) + if (mUdpConnection->GetUdpManager() != NULL) { channelStatus->oldestUnacknowledgedAge = mUdpConnection->GetUdpManager()->CachedClockElapsed(entry->mFirstTimeStamp); } @@ -588,7 +588,7 @@ void UdpReliableChannel::ReliablePacket(const udp_uchar *data, int dataLen) mReliableIncomingId++; // process other packets that have arrived - while (mReliableIncoming[mReliableIncomingId % mConfig.maxInstandingPackets].mPacket != nullptr) + while (mReliableIncoming[mReliableIncomingId % mConfig.maxInstandingPackets].mPacket != NULL) { int spot = (int)(mReliableIncomingId % mConfig.maxInstandingPackets); if (mReliableIncoming[spot].mMode != cReliablePacketModeDelivered) @@ -597,7 +597,7 @@ void UdpReliableChannel::ReliablePacket(const udp_uchar *data, int dataLen) } mReliableIncoming[spot].mPacket->Release(); - mReliableIncoming[spot].mPacket = nullptr; + mReliableIncoming[spot].mPacket = NULL; mReliableIncomingId++; } } @@ -605,7 +605,7 @@ void UdpReliableChannel::ReliablePacket(const udp_uchar *data, int dataLen) { // not the one we need next, but it is later than the one we need , so store it in our buffer until it's turn comes up int spot = (int)(reliableId % mConfig.maxInstandingPackets); - if (mReliableIncoming[spot].mPacket == nullptr) // only make the copy of it if we don't already have it in our buffer (in cases where it was sent twice, there would be no harm in the copy again since it must be the same packet, it's just inefficient) + if (mReliableIncoming[spot].mPacket == NULL) // only make the copy of it if we don't already have it in our buffer (in cases where it was sent twice, there would be no harm in the copy again since it must be the same packet, it's just inefficient) { mReliableIncoming[spot].mMode = mode; mReliableIncoming[spot].mPacket = mUdpConnection->mUdpManager->CreatePacket(data + UdpConnection::cUdpPacketReliableSize, dataLen - UdpConnection::cUdpPacketReliableSize); @@ -651,14 +651,14 @@ void UdpReliableChannel::ReliablePacket(const udp_uchar *data, int dataLen) bufPtr += UdpMisc::PutValue16(bufPtr, (udp_ushort)(reliableId & 0xffff)); } - if (mBufferedAckPtr != nullptr && mConfig.ackDeduping && ackAll) + if (mBufferedAckPtr != NULL && mConfig.ackDeduping && ackAll) { memcpy(mBufferedAckPtr, buf, bufPtr - buf); } else { - udp_uchar *ptr = mUdpConnection->BufferedSend(buf, (int)(bufPtr - buf), nullptr, 0, true); // safe to append on our data, it is stack data - if (mBufferedAckPtr == nullptr) + udp_uchar *ptr = mUdpConnection->BufferedSend(buf, (int)(bufPtr - buf), NULL, 0, true); // safe to append on our data, it is stack data + if (mBufferedAckPtr == NULL) { // the buffered-ack ptr should always point to the earliest ack in the buffer, such that // a replacement ack-all will be processed by the receiver before any selective acks that may @@ -676,7 +676,7 @@ void UdpReliableChannel::ProcessPacket(ReliablePacketMode mode, const udp_uchar if (mode == cReliablePacketModeReliable) { // we are not a fragment, nor was there a fragment in progress, so we are a simple reliable packet, just send it to the app - if (mBigDataPtr != nullptr) + if (mBigDataPtr != NULL) { mUdpConnection->CallbackCorruptPacket(data, dataLen, cUdpCorruptionReasonFragmentExpected); return; @@ -687,7 +687,7 @@ void UdpReliableChannel::ProcessPacket(ReliablePacketMode mode, const udp_uchar else if (mode == cReliablePacketModeFragment) { // append onto end of big packet (or create new big packet if not existing already) - if (mBigDataPtr == nullptr) + if (mBigDataPtr == NULL) { if (dataLen < 4) { @@ -729,7 +729,7 @@ void UdpReliableChannel::ProcessPacket(ReliablePacketMode mode, const udp_uchar delete[] mBigDataPtr; mBigDataLen = 0; mBigDataTargetLen = 0; - mBigDataPtr = nullptr; + mBigDataPtr = NULL; } } } @@ -767,7 +767,7 @@ void UdpReliableChannel::Ack(udp_int64 reliableId) int pos = (int)(reliableId % mConfig.maxOutstandingPackets); PhysicalPacket *entry = &mPhysicalPackets[pos]; - if (entry->mDataPtr != nullptr) // if this packet has not been acknowledged yet (sometimes we get back two acks for the same packet) + if (entry->mDataPtr != NULL) // if this packet has not been acknowledged yet (sometimes we get back two acks for the same packet) { mNextNeedTime = 0; // something got acked, so we actually need to take the time next time it is offered @@ -829,14 +829,14 @@ void UdpReliableChannel::Ack(udp_int64 reliableId) // this packet we have queued has been acknowledged, so delete it from queue mReliableOutgoingBytes -= entry->mDataLen; entry->mDataLen = 0; - entry->mDataPtr = nullptr; + entry->mDataPtr = NULL; entry->mParent->Release(); - entry->mParent = nullptr; + entry->mParent = NULL; // advance the pending ptr until it reaches outgoingId or an entry that has yet to acknowledged while (mReliableOutgoingPendingId < mReliableOutgoingId) { - if (mPhysicalPackets[mReliableOutgoingPendingId % mConfig.maxOutstandingPackets].mDataPtr != nullptr) + if (mPhysicalPackets[mReliableOutgoingPendingId % mConfig.maxOutstandingPackets].mDataPtr != NULL) break; mReliableOutgoingPendingId++; } @@ -855,25 +855,25 @@ void UdpReliableChannel::Ack(udp_int64 reliableId) UdpReliableChannel::IncomingQueueEntry::IncomingQueueEntry() { - mPacket = nullptr; + mPacket = NULL; mMode = UdpReliableChannel::cReliablePacketModeReliable; } UdpReliableChannel::IncomingQueueEntry::~IncomingQueueEntry() { - if (mPacket != nullptr) + if (mPacket != NULL) mPacket->Release(); } UdpReliableChannel::PhysicalPacket::PhysicalPacket() { - mParent = nullptr; + mParent = NULL; } UdpReliableChannel::PhysicalPacket::~PhysicalPacket() { - if (mParent != nullptr) + if (mParent != NULL) mParent->Release(); } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpReliableChannel.h b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpReliableChannel.h index 033585eb..fab02474 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpReliableChannel.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpReliableChannel.h @@ -64,7 +64,7 @@ class UdpReliableChannel void ProcessPacket(ReliablePacketMode mode, const udp_uchar *data, int dataLen); bool PullDown(int windowSpaceLeft); void FlushCoalesce(); - void SendCoalesce(const udp_uchar *data, int dataLen, const udp_uchar *data2 = nullptr, int dataLen2 = 0); + void SendCoalesce(const udp_uchar *data, int dataLen, const udp_uchar *data2 = NULL, int dataLen2 = 0); void QueueLogicalPacket(LogicalPacket *packet); UdpReliableConfig mConfig; @@ -138,7 +138,7 @@ inline int UdpReliableChannel::TotalPendingBytes() const inline void UdpReliableChannel::ClearBufferedAck() { - mBufferedAckPtr = nullptr; + mBufferedAckPtr = NULL; } inline udp_int64 UdpReliableChannel::GetReliableOutgoingId(int reliableStamp) const diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/UnicodeCharacterDataMap.h b/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/UnicodeCharacterDataMap.h index 493c5a2d..741a6e80 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/UnicodeCharacterDataMap.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/UnicodeCharacterDataMap.h @@ -122,7 +122,7 @@ namespace Plat_Unicode /** * Find a CharData for the given code point. - * @return nullptr if no CharData exists for this code point + * @return null if no CharData exists for this code point */ inline const CharData * CharDataMap::findCharData (const unicode_char_t code) const diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/utf8.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/utf8.cpp index 57bd0a0d..da8e34e8 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/utf8.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/utf8.cpp @@ -87,7 +87,7 @@ int UTF8_convertCharToUTF16( char * ptr , UTF16 * ret ) int UTF8_convertToUTF16( char * ptr , UTF16 * ret, int limit ) { int len = 0; - while (( *ptr != 0 ) && ( len < ( limit - 1 ) ))//we use limit -1 to leave room for the nullptr terminator + while (( *ptr != 0 ) && ( len < ( limit - 1 ) ))//we use limit -1 to leave room for the null terminator { int clen = UTF8_convertCharToUTF16( ptr, ret ); ptr += clen; diff --git a/external/3rd/library/soePlatform/VChatAPI/projects/VChat/VChatAPI/common.cpp b/external/3rd/library/soePlatform/VChatAPI/projects/VChat/VChatAPI/common.cpp index 2c07d021..6076f618 100755 --- a/external/3rd/library/soePlatform/VChatAPI/projects/VChat/VChatAPI/common.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/projects/VChat/VChatAPI/common.cpp @@ -171,37 +171,37 @@ namespace VChatSystem token = strtok((char*)tmpTokenee.c_str(), seps ); - if( token != nullptr ) + if( token != NULL ) { game = token; /* Get next token: */ - token = strtok( nullptr, seps ); + token = strtok( NULL, seps ); } - if( token != nullptr ) + if( token != NULL ) { server = token; /* Get next token: */ - token = strtok( nullptr, seps ); + token = strtok( NULL, seps ); } - if( token != nullptr ) + if( token != NULL ) { name = token; /* Get next token: */ - token = strtok( nullptr, seps ); + token = strtok( NULL, seps ); } - while ( token != nullptr ) + while ( token != NULL ) { name += "."; name += token; /* Get next token: */ - token = strtok( nullptr, seps ); + token = strtok( NULL, seps ); } } @@ -216,29 +216,29 @@ namespace VChatSystem std::string tmpTokenee = userName; token = strtok((char*)tmpTokenee.c_str(), seps ); - if( token != nullptr ) + if( token != NULL ) { server = token; /* Get next token: */ - token = strtok( nullptr, seps ); + token = strtok( NULL, seps ); } - if( token != nullptr ) + if( token != NULL ) { name = token; /* Get next token: */ - token = strtok( nullptr, seps ); + token = strtok( NULL, seps ); } - while ( token != nullptr ) + while ( token != NULL ) { name += "."; name += token; /* Get next token: */ - token = strtok( nullptr, seps ); + token = strtok( NULL, seps ); } } diff --git a/external/3rd/library/soePlatform/VChatAPI/projects/VChat/VChatUnitTest/VChatClient.cpp b/external/3rd/library/soePlatform/VChatAPI/projects/VChat/VChatUnitTest/VChatClient.cpp index db94c3cd..869bf94a 100755 --- a/external/3rd/library/soePlatform/VChatAPI/projects/VChat/VChatUnitTest/VChatClient.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/projects/VChat/VChatUnitTest/VChatClient.cpp @@ -23,7 +23,7 @@ unsigned VChatClient::GetAccountEx(const std::string &avatarName, { Reset(); - VChatAPI::GetAccount(avatarName, game, world, userID, avatarID, nullptr); + VChatAPI::GetAccount(avatarName, game, world, userID, avatarID, NULL); while(!IsDone() && !HasFailed()) { @@ -69,7 +69,7 @@ unsigned VChatClient::DeactivateVoiceAccount(const std::string &avatarName, { Reset(); - VChatAPI::DeactivateVoiceAccount(avatarName, game, world, nullptr); + VChatAPI::DeactivateVoiceAccount(avatarName, game, world, NULL); while(!IsDone() && !HasFailed()) { @@ -99,7 +99,7 @@ unsigned VChatClient::GetChannelEx( const std::string &channelName, bool persistent) { Reset(); - VChatAPI::GetChannel(channelName, game, server, description, password, limit, persistent, nullptr); + VChatAPI::GetChannel(channelName, game, server, description, password, limit, persistent, NULL); while(!IsDone() && !HasFailed()) { @@ -146,7 +146,7 @@ unsigned VChatClient::GetProximityChannelEx(const std::string &channelName, unsigned distModel) { Reset(); - VChatAPI::GetProximityChannel(channelName, game, server, description, password, limit, persistent, maxRange, clamping, rollOff, maxGain, distModel, nullptr); + VChatAPI::GetProximityChannel(channelName, game, server, description, password, limit, persistent, maxRange, clamping, rollOff, maxGain, distModel, NULL); while(!IsDone() && !HasFailed()) { @@ -183,7 +183,7 @@ unsigned VChatClient::ChannelCommandEx( const std::string &srcUserName, unsigned banTimeout) { Reset(); - VChatAPI::ChannelCommand(srcUserName, destUserName, destChannelAddress, command, banTimeout, nullptr); + VChatAPI::ChannelCommand(srcUserName, destUserName, destChannelAddress, command, banTimeout, NULL); while(!IsDone() && !HasFailed()) { @@ -211,7 +211,7 @@ unsigned VChatClient::ChangePasswordEx(const std::string &channelName, const std::string &password) { Reset(); - VChatAPI::ChangePassword(channelName, game, server, password, nullptr); + VChatAPI::ChangePassword(channelName, game, server, password, NULL); while(!IsDone() && !HasFailed()) { @@ -236,7 +236,7 @@ void VChatClient::OnChangePassword( unsigned track, unsigned VChatClient::GetAllChannelsEx() { Reset(); - VChatAPI::GetAllChannels(nullptr); + VChatAPI::GetAllChannels(NULL); while(!IsDone() && !HasFailed()) { @@ -274,7 +274,7 @@ unsigned VChatClient::DeleteChannelEx(const std::string &channelName, const std::string &server) { Reset(); - VChatAPI::DeleteChannel(channelName, game, server, nullptr); + VChatAPI::DeleteChannel(channelName, game, server, NULL); while(!IsDone() && !HasFailed()) { @@ -301,7 +301,7 @@ unsigned VChatClient::SetBanStatusEx(unsigned userID, unsigned banStatus) { Reset(); - VChatAPI::SetBanStatus(userID, banStatus, nullptr); + VChatAPI::SetBanStatus(userID, banStatus, NULL); while(!IsDone() && !HasFailed()) { @@ -328,7 +328,7 @@ unsigned VChatClient::GetChannelInfoEx( const std::string &channelName, const std::string &server) { Reset(); - VChatAPI::GetChannelInfo(channelName, game, server, nullptr); + VChatAPI::GetChannelInfo(channelName, game, server, NULL); while(!IsDone() && !HasFailed()) { @@ -369,7 +369,7 @@ unsigned VChatClient::GetChannelV2Ex(const std::string &channelName, bool persistent) { Reset(); - VChatAPI::GetChannelV2(channelName, game, server, description, password, limit, persistent, nullptr); + VChatAPI::GetChannelV2(channelName, game, server, description, password, limit, persistent, NULL); while(!IsDone() && !HasFailed()) { @@ -419,7 +419,7 @@ unsigned VChatClient::AddCharacterChannelEx(const unsigned stationID, Reset(); VChatAPI::AddCharacterChannel(stationID, avatarID, characterName, worldName, gameCode, channelType, channelDescription, - password, channelAddress, locale, nullptr); + password, channelAddress, locale, NULL); while(!IsDone() && !HasFailed()) { @@ -449,7 +449,7 @@ unsigned VChatClient::RemoveCharacterChannelEx( const unsigned stationID, { Reset(); VChatAPI::RemoveCharacterChannel(stationID, avatarID, characterName, worldName, - gameCode, channelType, nullptr); + gameCode, channelType, NULL); while(!IsDone() && !HasFailed()) { @@ -477,7 +477,7 @@ unsigned VChatClient::GetCharacterChannelEx(const unsigned stationID, const std::string &gameCode) { Reset(); - VChatAPI::GetCharacterChannel(stationID, characterName, worldName, gameCode, nullptr); + VChatAPI::GetCharacterChannel(stationID, characterName, worldName, gameCode, NULL); while(!IsDone() && !HasFailed()) { diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/api.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/api.cpp index 9c9c8084..3af047a2 100644 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/api.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/api.cpp @@ -45,7 +45,7 @@ namespace API_NAMESPACE //////////////////////////////////////////////////////////////////////////////// CommonAPI::CommonAPI(const char * hostList, const char * failoverHostList, unsigned connectionLimit, unsigned maxMsgSize, unsigned bufferSize) - : mManager(nullptr) + : mManager(NULL) , mHostReconnectTimeout() , mIdleHosts() , mHostMap() @@ -247,7 +247,7 @@ namespace API_NAMESPACE connection->Send((const char*)buffer, size); #endif } - mLastRequestInputTime = time(nullptr); + mLastRequestInputTime = time(NULL); } #ifdef UDP_LIBRARY @@ -466,7 +466,7 @@ namespace API_NAMESPACE RequestMap_t::iterator reqIterator = mRequestMap.find(trackingNumber); bool found = false; - *pUserData = nullptr; + *pUserData = NULL; if (reqIterator != mRequestMap.end()) { TrackedRequest & request = reqIterator->second; @@ -594,7 +594,7 @@ namespace API_NAMESPACE CommonAPI::ApiConnectionInfo * CommonAPI::GetNextUsableConnection() { - ApiConnectionInfo * connectionInfo = nullptr; + ApiConnectionInfo * connectionInfo = NULL; if (!mUsableHosts[0].empty()) { @@ -617,7 +617,7 @@ namespace API_NAMESPACE CommonAPI::ApiConnectionInfo * CommonAPI::FindConnectionInfo(ApiConnection * connection) { // find the connection in the set - ApiConnectionInfo * pInfo = nullptr; + ApiConnectionInfo * pInfo = NULL; ConnectionMap_t::iterator iter; if ( ((iter = mActiveHosts[0].find(connection)) != mActiveHosts[0].end()) || ((iter = mActiveHosts[1].find(connection)) != mActiveHosts[1].end()) ) @@ -777,8 +777,8 @@ namespace API_NAMESPACE mspEnumerationToVersionStringMap = &enumerationToVersionStringMap; } - std::map *VersionMap::mspVersionStringToEnumerationMap = nullptr; - std::map *VersionMap::mspEnumerationToVersionStringMap = nullptr; + std::map *VersionMap::mspVersionStringToEnumerationMap = NULL; + std::map *VersionMap::mspEnumerationToVersionStringMap = NULL; //////////////////////////////////////////////////////////////////////////////// @@ -1009,7 +1009,7 @@ namespace API_NAMESPACE mspLabelToEntryMap = &labelToEntryMap; } - ConfigurationMap::LabelToEntryMap_t *ConfigurationMap::mspLabelToEntryMap = nullptr; + ConfigurationMap::LabelToEntryMap_t *ConfigurationMap::mspLabelToEntryMap = NULL; //////////////////////////////////////////////////////////////////////////////// diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/api.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/api.h index 9cd24094..37512cbd 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/api.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/api.h @@ -58,7 +58,7 @@ namespace API_NAMESPACE typedef std::set TrackingSet_t; struct ApiConnectionInfo { - ApiConnectionInfo(ApiConnection * Connection = nullptr) : mConnection(Connection), mIsShuttingDown(false) { } + ApiConnectionInfo(ApiConnection * Connection = NULL) : mConnection(Connection), mIsShuttingDown(false) { } ApiConnection * mConnection; TrackingSet_t mOutstandingRequests; diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/apiMessages.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/apiMessages.cpp index ae5cdc76..c38875ab 100644 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/apiMessages.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/apiMessages.cpp @@ -253,7 +253,7 @@ namespace API_NAMESPACE Base * Base::Create(unsigned MsgId, StorageVector_t *pStorageVector) { - Base * msg = nullptr; + Base * msg = NULL; if (ms_pClassMap) { std::map::iterator classIter = ms_pClassMap->find(MsgId); @@ -272,7 +272,7 @@ namespace API_NAMESPACE const char * Base::GetMessageName(unsigned msgId) { - const char * requestString = nullptr; + const char * requestString = NULL; if (ms_pClassMap) { std::map::iterator classIter = ms_pClassMap->find(msgId); @@ -287,7 +287,7 @@ namespace API_NAMESPACE const char * Base::GetMessageIDString(unsigned msgId) { - const char * idString = nullptr; + const char * idString = NULL; if (ms_pClassMap) { std::map::iterator classIter = ms_pClassMap->find(msgId); @@ -304,7 +304,7 @@ namespace API_NAMESPACE { static std::map classMap; - if (ms_pClassMap == nullptr) { + if (ms_pClassMap == NULL) { ms_pClassMap = &classMap; } @@ -326,24 +326,24 @@ namespace API_NAMESPACE } Base::DeepPointer::DeepPointer() : - m_ptr(nullptr) + m_ptr(NULL) { } Base::DeepPointer::DeepPointer(const Base & source) : - m_ptr(nullptr) + m_ptr(NULL) { m_ptr = source.Clone(m_storageVector); } Base::DeepPointer::DeepPointer(const Base * source) : - m_ptr(nullptr) + m_ptr(NULL) { m_ptr = source->Clone(m_storageVector); } Base::DeepPointer::DeepPointer(const DeepPointer & source) : - m_ptr(nullptr) + m_ptr(NULL) { if (source.m_ptr) { m_ptr = source->Clone(m_storageVector); } } @@ -364,7 +364,7 @@ namespace API_NAMESPACE { Base *oldPtr = m_ptr; - m_ptr = rhs ? rhs->Clone(m_storageVector) : nullptr; + m_ptr = rhs ? rhs->Clone(m_storageVector) : NULL; if (oldPtr) { oldPtr->~Base(); @@ -377,7 +377,7 @@ namespace API_NAMESPACE { Base *oldPtr = m_ptr; - m_ptr = rhs.m_ptr ? rhs->Clone(m_storageVector) : nullptr; + m_ptr = rhs.m_ptr ? rhs->Clone(m_storageVector) : NULL; if (oldPtr) { oldPtr->~Base(); @@ -396,7 +396,7 @@ namespace API_NAMESPACE return *m_ptr; } - std::map *Base::ms_pClassMap = nullptr; + std::map *Base::ms_pClassMap = NULL; #if defined(PRINTABLE_MESSAGES) || defined(TRACK_READ_WRITE_FAILURES) Basic::Basic() diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/apiMessages.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/apiMessages.h index 12b00516..ef733afb 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/apiMessages.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/apiMessages.h @@ -60,7 +60,7 @@ namespace API_NAMESPACE protected: struct DECLSPEC MemberInfo { - MemberInfo(soe::AutoVariableBase *dataIn = nullptr, unsigned sizeIn = 1, unsigned versionIn = 0, soe::EVersionEffect effectIn = soe::eNoEffect) + MemberInfo(soe::AutoVariableBase *dataIn = NULL, unsigned sizeIn = 1, unsigned versionIn = 0, soe::EVersionEffect effectIn = soe::eNoEffect) : data(dataIn) , size(sizeIn) , version(versionIn) @@ -97,8 +97,8 @@ namespace API_NAMESPACE virtual Base * Clone() const; virtual Base * Clone(StorageVector_t &storageVector) const; virtual const char * MessageName() const { return "Base"; } - virtual const char * MessageIDString() const { return "nullptr"; } - static Base * Create(unsigned MsgId, StorageVector_t *pStorageVector = nullptr); + virtual const char * MessageIDString() const { return "NULL"; } + static Base * Create(unsigned MsgId, StorageVector_t *pStorageVector = NULL); static const char * GetMessageName(unsigned msgId); static const char * GetMessageIDString(unsigned msgId); diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/apiPinned.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/apiPinned.cpp index 2f72d6e0..5a1dd30d 100644 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/apiPinned.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/apiPinned.cpp @@ -291,7 +291,7 @@ namespace NAMESPACE if (!mActiveHosts[0].empty()) { // get connection that corresponds to hash index - ApiConnection * connection = nullptr; + ApiConnection * connection = NULL; unsigned hashIndex = hashValue % mActiveHosts[0].size(); unsigned curIndex = 0; for (ConnectionSet_t::iterator it = mActiveHosts[0].begin(); it != mActiveHosts[0].end(); it++, curIndex++) @@ -314,7 +314,7 @@ namespace NAMESPACE else if (!mActiveHosts[1].empty()) { // get connection that corresponds to hash index - ApiConnection * connection = nullptr; + ApiConnection * connection = NULL; unsigned hashIndex = hashValue % mActiveHosts[1].size(); unsigned curIndex = 0; for (ConnectionSet_t::iterator it = mActiveHosts[1].begin(); it != mActiveHosts[1].end(); it++, curIndex++) diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/cmdLine.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/cmdLine.cpp index 9d82c979..8c04219e 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/cmdLine.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/cmdLine.cpp @@ -132,7 +132,7 @@ int CmdLine::SplitLine(int argc, char **argv) bool CmdLine::IsSwitch(const char *pParam) { - if (pParam==nullptr) + if (pParam==NULL) return false; // switches must non-empty @@ -201,7 +201,7 @@ StringType CmdLine::GetSafeArgument(const char *pSwitch, int iIdx, const char *p { StringType sRet; - if (pDefault!=nullptr) + if (pDefault!=NULL) sRet = pDefault; try diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/date.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/date.cpp index 0184793d..025883cd 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/date.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/date.cpp @@ -42,7 +42,7 @@ namespace soe , mSecond(0) { struct tm timeStruct; - struct tm *gotTime = nullptr; + struct tm *gotTime = NULL; #ifdef WIN32 gotTime = gmtime(&src); #else diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/dateUtils.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/dateUtils.h index be898b53..fecca883 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/dateUtils.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/dateUtils.h @@ -144,7 +144,7 @@ namespace soe inline time_t localTimeToGmt(int dstOffsetMinutes = DST_OFFSET_MINUTES_USA) { - time_t localTime = time(nullptr); + time_t localTime = time(NULL); struct tm gt = *(gmtime(&localTime)); struct tm lt = *(localtime(&localTime)); bool isDst = (lt.tm_isdst? true:false); @@ -187,7 +187,7 @@ namespace soe dstOffsetSecs = dstOffsetMS/1000; return retval; } - inline int getGMT(time_t & theTime, const char *id = nullptr) + inline int getGMT(time_t & theTime, const char *id = NULL) { UDate date; UErrorCode ec; diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/genericRateLimitingMechanism.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/genericRateLimitingMechanism.h index 66934bc1..20b16fa1 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/genericRateLimitingMechanism.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/genericRateLimitingMechanism.h @@ -245,7 +245,7 @@ namespace soe template const LimitType * GenericRateLimitingMechanism::GetRateLimit(const FixedKeyType & fixedKey) const { - LimitType const * rateLimit = nullptr; + LimitType const * rateLimit = NULL; typename RateLimitByFixedKeyMap_t::const_iterator limIter = mRateLimits.find(fixedKey); if (limIter != mRateLimits.end()) { @@ -258,7 +258,7 @@ namespace soe template const LimitType * GenericRateLimitingMechanism::GetNextRateLimit(FixedKeyType & fixedKey) const { - LimitType const * rateLimit = nullptr; + LimitType const * rateLimit = NULL; typename RateLimitByFixedKeyMap_t::const_iterator limIter = mRateLimits.upper_bound(fixedKey); if (limIter != mRateLimits.end()) { @@ -272,7 +272,7 @@ namespace soe template const CounterType * GenericRateLimitingMechanism::GetRateCounter(const FixedKeyType & fixedKey, const ArbitraryKeyType & arbitraryKey) const { - const CounterType * counter = nullptr; + const CounterType * counter = NULL; typename RateCounterByKeyPairMap_t::const_iterator counterIter = mRateCounters.find(KeyPair(fixedKey, arbitraryKey)); if (counterIter != mRateCounters.end()) { counter = &(counterIter->second->mCounter); diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/hashtable.hpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/hashtable.hpp index 4fc2ace9..00f9cd75 100644 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/hashtable.hpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/hashtable.hpp @@ -174,11 +174,11 @@ template class HashTable bool Remove(T& obj, int hashValue); void Reset(); // removes all entries from the table - T *FindFirst(int hashValue) const; // returns nullptr if not found - T *FindNext(T *prevResult) const; // returns nullptr if not found + T *FindFirst(int hashValue) const; // returns NULL if not found + T *FindNext(T *prevResult) const; // returns NULL if not found - T *WalkFirst() const; // returns nullptr if not found - T *WalkNext(T *prevResult) const; // returns nullptr if not found + T *WalkFirst() const; // returns NULL if not found + T *WalkNext(T *prevResult) const; // returns NULL if not found void Resize(int hashSize); // the actual hash size will be rounded up to the next larger prime number (very slow, not recommended) void GetStatistics(HashTableStatistics *stats) const; @@ -200,7 +200,7 @@ template class HashTable template HashTable::HashTable(int hashSize) { - mTable = nullptr; + mTable = NULL; mTableSize = 0; mEntryCount = 0; mStatUsedSlots = 0; @@ -220,9 +220,9 @@ template void HashTable::Insert(T& obj, int hashValue) entry->hashValue = hashValue; int spot = ((unsigned)hashValue) % mTableSize; - if (mTable[spot] == nullptr) + if (mTable[spot] == NULL) { - entry->nextEntry = nullptr; + entry->nextEntry = NULL; mTable[spot] = entry; mStatUsedSlots++; } @@ -239,14 +239,14 @@ template bool HashTable::Remove(T& obj, int hashValue) int spot = ((unsigned)hashValue) % mTableSize; HashEntry* next = mTable[spot]; HashEntry** prev = &mTable[spot]; - while (next != nullptr) + while (next != NULL) { if (next->obj == obj && next->hashValue == hashValue) { *prev = next->nextEntry; delete next; mEntryCount--; - if (mTable[spot] == nullptr) + if (mTable[spot] == NULL) mStatUsedSlots--; return(true); break; @@ -263,17 +263,17 @@ template void HashTable::Reset() for (int spot = 0; spot < mTableSize; spot++) { HashEntry *curr = mTable[spot]; - if (curr != nullptr) + if (curr != NULL) { mStatUsedSlots--; - while (curr != nullptr) + while (curr != NULL) { HashEntry *next = curr->nextEntry; delete curr; mEntryCount--; curr = next; } - mTable[spot] = nullptr; + mTable[spot] = NULL; } } } @@ -281,13 +281,13 @@ template void HashTable::Reset() template T *HashTable::FindFirst(int hashValue) const { HashEntry *entry = mTable[((unsigned)hashValue) % mTableSize]; - while (entry != nullptr) + while (entry != NULL) { if (entry->hashValue == hashValue) return(&entry->obj); entry = entry->nextEntry; } - return(nullptr); + return(NULL); } template T *HashTable::FindNext(T *prevResult) const @@ -295,13 +295,13 @@ template T *HashTable::FindNext(T *prevResult) const HashEntry *entry = (HashEntry *)(((char *)prevResult) - offsetof(HashEntry, obj)); int hashValue = entry->hashValue; entry = entry->nextEntry; - while (entry != nullptr) + while (entry != NULL) { if (entry->hashValue == hashValue) return(&entry->obj); entry = entry->nextEntry; } - return(nullptr); + return(NULL); } template T *HashTable::WalkFirst() const @@ -309,10 +309,10 @@ template T *HashTable::WalkFirst() const for (int bucket = 0; bucket < mTableSize; bucket++) { HashEntry *entry = mTable[bucket]; - if (entry != nullptr) + if (entry != NULL) return(&entry->obj); } - return(nullptr); + return(NULL); } template T *HashTable::WalkNext(T *prevResult) const @@ -321,17 +321,17 @@ template T *HashTable::WalkNext(T *prevResult) const int bucket = ((unsigned)entry->hashValue) % mTableSize; entry = entry->nextEntry; - if (entry != nullptr) + if (entry != NULL) return(&entry->obj); bucket++; // go onto next bucket for (; bucket < mTableSize; bucket++) { HashEntry *entry = mTable[bucket]; - if (entry != nullptr) + if (entry != NULL) return(&entry->obj); } - return(nullptr); + return(NULL); } template void HashTable::Resize(int hashSize) @@ -351,16 +351,16 @@ template void HashTable::Resize(int hashSize) for (int i = 0; i < oldSize; i++) { HashEntry* next = oldTable[i]; - while (next != nullptr) + while (next != NULL) { HashEntry* hold = next; next = next->nextEntry; // insert hold into new table int spot = ((unsigned)hold->hashValue) % mTableSize; - if (mTable[spot] == nullptr) + if (mTable[spot] == NULL) { - hold->nextEntry = nullptr; + hold->nextEntry = NULL; mTable[spot] = hold; mStatUsedSlots++; } @@ -414,11 +414,11 @@ template class ObjectHashTable bool Remove(T obj, int hashValue); void Reset(); // removes all entries from the table - T FindFirst(int hashValue) const; // returns nullptr if not found - T FindNext(T prevResult) const; // returns nullptr if not found + T FindFirst(int hashValue) const; // returns NULL if not found + T FindNext(T prevResult) const; // returns NULL if not found - T WalkFirst() const; // returns nullptr if not found - T WalkNext(T prevResult) const; // returns nullptr if not found + T WalkFirst() const; // returns NULL if not found + T WalkNext(T prevResult) const; // returns NULL if not found void Resize(int hashSize); // the actual hash size will be rounded up to the next larger prime number (very slow, not recommended) void GetStatistics(HashTableStatistics *stats) const; @@ -433,7 +433,7 @@ template class ObjectHashTable template ObjectHashTable::ObjectHashTable(int hashSize) { - mTable = nullptr; + mTable = NULL; mTableSize = 0; mEntryCount = 0; mStatUsedSlots = 0; @@ -451,9 +451,9 @@ template void ObjectHashTable::Insert(T obj, int hashValue) obj->mHashValue = hashValue; int spot = ((unsigned)hashValue) % mTableSize; - if (mTable[spot] == nullptr) + if (mTable[spot] == NULL) { - obj->mHashNextEntry = nullptr; + obj->mHashNextEntry = NULL; mTable[spot] = obj; mStatUsedSlots++; } @@ -470,14 +470,14 @@ template bool ObjectHashTable::Remove(T obj, int hashValue) int spot = ((unsigned)hashValue) % mTableSize; T next = mTable[spot]; T *prev = &mTable[spot]; - while (next != nullptr) + while (next != NULL) { if (next == obj) { *prev = (T)next->mHashNextEntry; - next->mHashNextEntry = nullptr; + next->mHashNextEntry = NULL; mEntryCount--; - if (mTable[spot] == nullptr) + if (mTable[spot] == NULL) mStatUsedSlots--; return(true); break; @@ -494,16 +494,16 @@ template void ObjectHashTable::Reset() for (int spot = 0; spot < mTableSize; spot++) { T curr = mTable[spot]; - if (curr != nullptr) + if (curr != NULL) { - while (curr != nullptr) + while (curr != NULL) { T next = (T)curr->mHashNextEntry; - curr->mHashNextEntry = nullptr; + curr->mHashNextEntry = NULL; mEntryCount--; curr = next; } - mTable[spot] = nullptr; + mTable[spot] = NULL; mStatUsedSlots--; } } @@ -512,13 +512,13 @@ template void ObjectHashTable::Reset() template T ObjectHashTable::FindFirst(int hashValue) const { T entry = mTable[((unsigned)hashValue) % mTableSize]; - while (entry != nullptr) + while (entry != NULL) { if (entry->mHashValue == hashValue) return(entry); entry = (T)entry->mHashNextEntry; } - return(nullptr); + return(NULL); } template T ObjectHashTable::FindNext(T prevResult) const @@ -526,13 +526,13 @@ template T ObjectHashTable::FindNext(T prevResult) const T entry = prevResult; int hashValue = entry->mHashValue; entry = (T)entry->mHashNextEntry; - while (entry != nullptr) + while (entry != NULL) { if (entry->mHashValue == hashValue) return(entry); entry = (T)entry->mHashNextEntry; } - return(nullptr); + return(NULL); } template T ObjectHashTable::WalkFirst() const @@ -540,10 +540,10 @@ template T ObjectHashTable::WalkFirst() const for (int bucket = 0; bucket < mTableSize; bucket++) { T entry = mTable[bucket]; - if (entry != nullptr) + if (entry != NULL) return(entry); } - return(nullptr); + return(NULL); } template T ObjectHashTable::WalkNext(T prevResult) const @@ -552,17 +552,17 @@ template T ObjectHashTable::WalkNext(T prevResult) const int bucket = ((unsigned)entry->mHashValue) % mTableSize; entry = (T)entry->mHashNextEntry; - if (entry != nullptr) + if (entry != NULL) return(entry); bucket++; // go onto next bucket for (; bucket < mTableSize; bucket++) { entry = mTable[bucket]; - if (entry != nullptr) + if (entry != NULL) return(entry); } - return(nullptr); + return(NULL); } template void ObjectHashTable::Resize(int hashSize) @@ -582,16 +582,16 @@ template void ObjectHashTable::Resize(int hashSize) for (int i = 0; i < oldSize; i++) { T next = oldTable[i]; - while (next != nullptr) + while (next != NULL) { T hold = next; next = (T)next->mHashNextEntry; // insert hold into new table int spot = ((unsigned)hold->mHashValue) % mTableSize; - if (mTable[spot] == nullptr) + if (mTable[spot] == NULL) { - hold->mHashNextEntry = nullptr; + hold->mHashNextEntry = NULL; mTable[spot] = hold; mStatUsedSlots++; } diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/log.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/log.cpp index 72cac84a..e14aee9a 100644 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/log.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/log.cpp @@ -115,7 +115,7 @@ Logger::Logger(const char *programName, void Logger::LoggerInit(const char *programName) { char buf[1024]; - FILE *logDir = nullptr; + FILE *logDir = NULL; if (0 != (m_logType & eUseLocalFile)) { @@ -124,13 +124,13 @@ void Logger::LoggerInit(const char *programName) { cmkdir(m_dirPrefix.c_str(), 0755); } - else if(logDir != nullptr) + else if(logDir != NULL) { fclose(logDir); } tm now; - time_t t = time(nullptr); + time_t t = time(NULL); LOGGER_GET_CURR_TIME(now, t); @@ -148,7 +148,7 @@ void Logger::LoggerInit(const char *programName) { cmkdir(buf, 0755); } - else if(logDir != nullptr) + else if(logDir != NULL) { fclose(logDir); } @@ -330,7 +330,7 @@ void Logger::logSimple(unsigned logenum, int level, const char *message) { return; } - time_t t = time(nullptr); + time_t t = time(NULL); LogInfo *info = (*iter).second; if(level >= info->level) { @@ -400,7 +400,7 @@ void Logger::logSimpleWithSys(unsigned logenum, unsigned priority, int level, co { return; } - time_t t = time(nullptr); + time_t t = time(NULL); LogInfo *info = (*iter).second; if(level >= info->level) @@ -482,7 +482,7 @@ void Logger::logWithSys(unsigned logenum, unsigned priority, int level, const ch { return; } - time_t t = time(nullptr); + time_t t = time(NULL); LogInfo *info = (*iter).second; if(level >= info->level) @@ -562,7 +562,7 @@ void Logger::vlogWithSys(unsigned logenum, unsigned priority, int level, const c { return; } - time_t t = time(nullptr); + time_t t = time(NULL); LogInfo *info = (*iter).second; if(level >= info->level) @@ -630,14 +630,14 @@ void Logger::vlog(unsigned logenum, int level, const char *message, va_list argp void Logger::rollDate(time_t t) { char buf[80]; - FILE *logDir = nullptr; + FILE *logDir = NULL; logDir = fopen(m_dirPrefix.c_str(), "r+"); if(errno == ENOENT) { cmkdir(m_dirPrefix.c_str(), 0755); } - else if(logDir != nullptr) + else if(logDir != NULL) { fclose(logDir); } @@ -653,7 +653,7 @@ void Logger::rollDate(time_t t) { cmkdir(buf, 0755); } - else if(logDir != nullptr) + else if(logDir != NULL) { fclose(logDir); } @@ -737,7 +737,7 @@ void Logger::rollLog(LogInfo *logInfo) { std::string newLogName; char timeStampBuffer[256]; - time_t t = time(nullptr); + time_t t = time(NULL); tm now; int r; int nTries = 10; diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorAPI.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorAPI.cpp index cb3a87d0..214e33be 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorAPI.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorAPI.cpp @@ -48,7 +48,7 @@ MonitorObject::~MonitorObject() if( mConnection ) { - mConnection->SetHandler(nullptr); + mConnection->SetHandler(NULL); mConnection->Disconnect(); mConnection->Release(); } @@ -72,10 +72,10 @@ char hold[214]; UdpConnection::DisconnectReasonText( mConnection->GetOtherSideDisconnectReason())); } } - mConnection->SetHandler(nullptr); + mConnection->SetHandler(NULL); mConnection->Disconnect(); mConnection->Release(); - mConnection = nullptr; + mConnection = NULL; } } @@ -91,10 +91,10 @@ void MonitorObject::OnRoutePacket(UdpConnection * con, const uchar *data, int d simpleMessage msg(data); - if( con == nullptr ) + if( con == NULL ) { if( mbprint) - fprintf(stderr,"MONITOR API: MonitorObject.OnRoutePacket, recived a nullptr connection.?\n"); + fprintf(stderr,"MONITOR API: MonitorObject.OnRoutePacket, recived a NULL connection.?\n"); return; } @@ -120,7 +120,7 @@ void MonitorObject::OnRoutePacket(UdpConnection * con, const uchar *data, int d if( mHierarchySent == true ) { if( mMonitorData->processElementsRequest(con,mSequence,(char *)&data[6],dataLen,mlastUpdateTime )) - mlastUpdateTime = time(nullptr); + mlastUpdateTime = time(NULL); break; } // NOTE: if mHierarchy is not sent or changed, then send it. @@ -258,7 +258,7 @@ MonitorManager::MonitorManager(char *configFile, CMonitorData *_gamedata, UdpMan { mManager = manager; mbprint = _bprint; - passString = nullptr; + passString = NULL; mMonitorData = _gamedata; mObjectCount = 0; @@ -288,7 +288,7 @@ void MonitorManager::OnConnectRequest(UdpConnection *con) { if( con ) { - con->SetHandler(nullptr); + con->SetHandler(NULL); con->Disconnect(); con->Release(); } @@ -310,7 +310,7 @@ void MonitorManager::GiveTime() // check if the monitor object is no longer connected for (int i = 0; i < mObjectCount; i++) { - if( mObject[i]->mConnection == nullptr || + if( mObject[i]->mConnection == NULL || mObject[i]->mConnection->GetStatus() == UdpConnection::cStatusDisconnected ) { MonitorObject *o = mObject[i]; @@ -342,7 +342,7 @@ int x; char buffer[1024]; FILE *fp = fopen(filename,"r"); - if (fp == nullptr) + if (fp == NULL) { fprintf(stderr,"Monitor API: could not open %s file\nTHIS FILE IS REQUIRED.\n", filename); return false; @@ -364,7 +364,7 @@ char buffer[1024]; x = 0; while(!feof(fp)) { - if (fgets( buffer, 1023, fp) != nullptr) { + if (fgets( buffer, 1023, fp) != NULL) { // get rid of '\n' and '\r' for comparisons strtok(buffer,"\r\n"); @@ -402,17 +402,17 @@ CMonitorAPI::CMonitorAPI( char *configFile, unsigned short Port, bool _bprint , mbprint = _bprint; mPort = Port; - mAddress = nullptr; + mAddress = NULL; if( address ) { mAddress = (char *)malloc(strlen(address)+1); strcpy(mAddress,address); } - if( mang == nullptr ) + if( mang == NULL ) { UdpManager::Params params; - params.handler = nullptr; + params.handler = NULL; params.maxConnections = CONNECTION_MAX; params.outgoingBufferSize = 1000000; params.noDataTimeout = 130000; diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorAPI.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorAPI.h index 60fa8509..fa60d698 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorAPI.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorAPI.h @@ -72,13 +72,13 @@ class CMonitorAPI { public: - CMonitorAPI( char *configFile, unsigned short Port, bool _bprint = false , char * address = nullptr, UdpManager * mang = nullptr ); + CMonitorAPI( char *configFile, unsigned short Port, bool _bprint = false , char * address = NULL, UdpManager * mang = NULL ); ~CMonitorAPI(); void Update(); - void add( const char *label, int id, int ping = MON_PING_5MIN, char *des = nullptr ); + void add( const char *label, int id, int ping = MON_PING_5MIN, char *des = NULL ); void setDescription( int Id, const char *Description ) ; diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorData.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorData.cpp index 0d3c66d5..38614bbf 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorData.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorData.cpp @@ -55,7 +55,7 @@ CMonitorData::CMonitorData() { m_sequence = 1; - m_buffer = nullptr; + m_buffer = NULL; m_nbuffer = 0; m_count = 0; m_max = ELEMENT_START_VALUE; @@ -85,7 +85,7 @@ void CMonitorData::resize_buffer(int new_size) { char *temp; - if( m_buffer != nullptr ) + if( m_buffer != NULL ) { temp = m_buffer; m_buffer = new char[ new_size]; @@ -252,7 +252,7 @@ char *p; { if( get_bit(mark,x) == 0 ) { - if( m_data[x].discription != nullptr ) + if( m_data[x].discription != NULL ) snprintf(tmp, sizeof(tmp), "%d,%s|", m_data[x].id, m_data[x].discription); else snprintf(tmp, sizeof(tmp), "%d, |", m_data[x].id); @@ -282,7 +282,7 @@ char *p; { flag = 2; - if( m_data[x].discription != nullptr ) + if( m_data[x].discription != NULL ) snprintf(tmp, sizeof(tmp), "%d,%s|", m_data[x].id, m_data[x].discription); else snprintf(tmp, sizeof(tmp), "%d, |", m_data[x].id); @@ -338,7 +338,7 @@ int x; //******* Discription ****** delete [] m_data[x].discription; - m_data[x].discription = nullptr; + m_data[x].discription = NULL; if( des ) { @@ -387,10 +387,10 @@ int x; for(x=0;x= x ) return nullptr; return m_data[x].discription;} + char *getDescription(int x){ if( m_ndata >= x ) return NULL; return m_data[x].discription;} int pingValue(int p); void set(int Id, int value); void remove(int Id); diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/priority.hpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/priority.hpp index 516619db..19f34ab3 100644 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/priority.hpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/priority.hpp @@ -37,12 +37,12 @@ template class PriorityQueue PriorityQueue(int queueSize); ~PriorityQueue(); - T* Top(); // returns nullptr if queue is empty - T* TopRemove(); // returns nullptr if queue is empty - T* TopRemove(P priority); // removes item from queue if it has a lower priority value, otherwise return nullptr + T* Top(); // returns NULL if queue is empty + T* TopRemove(); // returns NULL if queue is empty + T* TopRemove(P priority); // removes item from queue if it has a lower priority value, otherwise return NULL T* Add(T* entry, P priority); // reprioritizes if already in queue, returns entry always T* Remove(T* entry); // returns entry always (even if it was not in the queue) - P *GetPriority(T* entry); // returns nullptr if entry is not in the queue + P *GetPriority(T* entry); // returns NULL if entry is not in the queue int QueueUsed(); // returns how many entries are in the queue protected: struct QueueEntry @@ -88,14 +88,14 @@ template PriorityQueue::~PriorityQueue() template T* PriorityQueue::Top() { if (mQueueEnd == 0) - return(nullptr); + return(NULL); return(mQueue[0].entry); } template T* PriorityQueue::TopRemove() { if (mQueueEnd == 0) - return(nullptr); + return(NULL); T* top = mQueue[0].entry; Remove(top); return(top); @@ -105,14 +105,14 @@ template T* PriorityQueue::TopRemove(P priority) { if (mQueueEnd > 0 && mQueue[0].priority <= priority) return(Remove(mQueue[0].entry)); - return(nullptr); + return(NULL); } template P* PriorityQueue::GetPriority(T* entry) { if (entry->mPriorityQueuePosition >= 0) return(&mQueue[entry->mPriorityQueuePosition].priority); - return(nullptr); + return(NULL); } template T* PriorityQueue::Add(T* entry, P priority) @@ -121,7 +121,7 @@ template T* PriorityQueue::Add(T* entry, P priorit { // not in queue, so add it to the bottom if (mQueueEnd >= mQueueSize) - return(nullptr); + return(NULL); mQueue[mQueueEnd].entry = entry; mQueue[mQueueEnd].priority = priority; mQueue[mQueueEnd].entry->mPriorityQueuePosition = mQueueEnd; diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/stringutils.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/stringutils.cpp index 07c4bcc2..be0a4376 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/stringutils.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/stringutils.cpp @@ -78,12 +78,12 @@ namespace soe if (pos == std::string::npos) { // tok not found take the whole thing - if (dest != nullptr) { dest->assign(*base);} + if (dest != NULL) { dest->assign(*base);} base->clear(); return; } - if (dest != nullptr) {dest->assign(base->substr(0,pos));} + if (dest != NULL) {dest->assign(base->substr(0,pos));} base->erase(0,pos + tok.length()); } diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/stringutils.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/stringutils.h index f70facc5..f994210c 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/stringutils.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/stringutils.h @@ -21,7 +21,7 @@ namespace soe void trim(std::string& str); void crack(std::string * dest, std::string * base, const std::string& tok); void inline crack(std::string& dest, std::string& base, const std::string& tok) {crack(&dest, &base, tok);} - void inline crack(std::string& base, const std::string& tok) {crack(nullptr, &base, tok);} + void inline crack(std::string& base, const std::string& tok) {crack(NULL, &base, tok);} class lowerCaseString { diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/substringSearchTree.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/substringSearchTree.h index ebe0729d..9acfcea7 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/substringSearchTree.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/substringSearchTree.h @@ -156,15 +156,15 @@ private: class letterNode { public: - letterNode() : mpData(nullptr), mpChildren(nullptr), mNumChildren(0) { } - letterNode(const letter_t & letter) : mLetter(letter), mpData(nullptr), mpChildren(nullptr), mNumChildren(0) { } + letterNode() : mpData(NULL), mpChildren(NULL), mNumChildren(0) { } + letterNode(const letter_t & letter) : mLetter(letter), mpData(NULL), mpChildren(NULL), mNumChildren(0) { } ~letterNode(); - inline bool hasData() const { return (mpData != nullptr); } + inline bool hasData() const { return (mpData != NULL); } inline data_t & getData() { return *mpData; } inline const data_t & getData() const { return *mpData; } inline void setData(const data_t & data) { if (mpData) { *mpData = data; } else { mpData = new data_t(data); } } - inline void removeData() { delete mpData; mpData = nullptr; } + inline void removeData() { delete mpData; mpData = NULL; } letterNode * get(letter_t index) const; bool put(letter_t index, letterNode ** tree); @@ -182,7 +182,7 @@ private: inline letter_t & letter() { return mLetter; } inline const letter_t & letter() const { return mLetter; } - inline bool hasNoChildren() const { return (mpChildren == nullptr) || (mNumChildren == 0); } + inline bool hasNoChildren() const { return (mpChildren == NULL) || (mNumChildren == 0); } private: letter_t mLetter; @@ -272,9 +272,9 @@ bool stringTree::seek(iter_t & start, const iter_t & stop, typ position.mBranch.push_back(&mRoot); } - const letterNode * pnode = (start != stop) ? position.mBranch.back() : nullptr; + const letterNode * pnode = (start != stop) ? position.mBranch.back() : NULL; - for (; (start != stop) && ((pnode = pnode->get(*start)) != nullptr); start++) + for (; (start != stop) && ((pnode = pnode->get(*start)) != NULL); start++) { position.mBranch.push_back(pnode); if (pnode->hasData()) { @@ -298,9 +298,9 @@ bool stringTree::seek(iter_t & start, const iter_t & stop, typ position.mBranch.push_back(&mRoot); } - const letterNode * pnode = (start != stop) ? position.mBranch.back() : nullptr; + const letterNode * pnode = (start != stop) ? position.mBranch.back() : NULL; - for (; (start != stop) && ((pnode = pnode->get(*start)) != nullptr); start++) + for (; (start != stop) && ((pnode = pnode->get(*start)) != NULL); start++) { position.mBranch.push_back(pnode); if (pnode->hasData()) { @@ -441,7 +441,7 @@ stringTree::letterNode::~letterNode() template typename stringTree::letterNode * stringTree::letterNode::get(letter_t index) const { - letterNode * tree = nullptr; + letterNode * tree = NULL; letterNode * end = mpChildren + mNumChildren; letterNode * place = std::lower_bound(mpChildren, mpChildren + mNumChildren, index); @@ -495,10 +495,10 @@ bool stringTree::letterNode::take(letter_t index, bool dealloc mNumChildren--; if (!mNumChildren) { deallocate = true; } - letterNode * children = nullptr; + letterNode * children = NULL; if (deallocate) { - children = mNumChildren ? new letterNode[mNumChildren] : nullptr; + children = mNumChildren ? new letterNode[mNumChildren] : NULL; } else { children = mpChildren; } @@ -536,7 +536,7 @@ void stringTree::const_iterator::getKey(string_t & key) const template typename stringTree::letterNode * stringTree::letterNode::firstChild() const { - letterNode * child = nullptr; + letterNode * child = NULL; if (mpChildren) { child = mpChildren; @@ -548,7 +548,7 @@ typename stringTree::letterNode * stringTree template typename stringTree::letterNode * stringTree::letterNode::lastChild() const { - letterNode * child = nullptr; + letterNode * child = NULL; if (mpChildren) { child = mpChildren + mNumChildren - 1; @@ -560,7 +560,7 @@ typename stringTree::letterNode * stringTree template typename stringTree::letterNode * stringTree::letterNode::nextChild(const letterNode * child) const { - letterNode * next = nullptr; + letterNode * next = NULL; if (mpChildren) { size_t index = child - mpChildren; @@ -577,7 +577,7 @@ typename stringTree::letterNode * stringTree template typename stringTree::letterNode * stringTree::letterNode::previousChild(const letterNode * child) const { - letterNode * previous = nullptr; + letterNode * previous = NULL; if (mpChildren) { size_t index = child - mpChildren; @@ -623,13 +623,13 @@ template bool stringTree::const_iterator::advance() { bool wentForward = false; - const letterNode * terminal = nullptr; - const letterNode * penultimate = nullptr; - const letterNode * next = nullptr; + const letterNode * terminal = NULL; + const letterNode * penultimate = NULL; + const letterNode * next = NULL; if (mBranch.back()->hasNoChildren()) { // go forward - while ((mBranch.size() >= 2) && (next == nullptr)) + while ((mBranch.size() >= 2) && (next == NULL)) { penultimate = mBranch[mBranch.size() - 2]; terminal = mBranch[mBranch.size() - 1]; @@ -654,9 +654,9 @@ template bool stringTree::const_iterator::retreat() { bool wentBack = false; - const letterNode * terminal = nullptr; - const letterNode * penultimate = nullptr; - const letterNode * next = nullptr; + const letterNode * terminal = NULL; + const letterNode * penultimate = NULL; + const letterNode * next = NULL; if (mBranch.size() >= 2) { // go backwards @@ -670,7 +670,7 @@ bool stringTree::const_iterator::retreat() mBranch.pop_back(); } // go to leaf - for (; next != nullptr; next = next->lastChild()) + for (; next != NULL; next = next->lastChild()) { mBranch.push_back(next); if (next->hasData() && next->hasNoChildren()) { @@ -724,9 +724,9 @@ template void stringTree::setBegin() const { mBegin.mBranch.clear(); - const letterNode * leaf = nullptr; + const letterNode * leaf = NULL; - for (leaf = &mRoot; leaf != nullptr; leaf = leaf->firstChild()) + for (leaf = &mRoot; leaf != NULL; leaf = leaf->firstChild()) { mBegin.mBranch.push_back(leaf); if (leaf->hasData()) { @@ -782,7 +782,7 @@ template template const data_t * stringTree::finder::data() const { - const data_t * pData = nullptr; + const data_t * pData = NULL; if (mDictionaryIter != mDictionary.end()) { pData = &(*mDictionaryIter); diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/thread.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/thread.cpp index 7115e242..af797230 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/thread.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/thread.cpp @@ -120,10 +120,10 @@ Event::Event(bool signaled) : mEvent() { #ifdef WIN32 - mEvent = CreateEvent(nullptr, FALSE, signaled ? TRUE : FALSE, nullptr); + mEvent = CreateEvent(NULL, FALSE, signaled ? TRUE : FALSE, NULL); #else - pthread_mutex_init(&mMutex, nullptr); - pthread_cond_init(&mCond, nullptr); + pthread_mutex_init(&mMutex, NULL); + pthread_cond_init(&mCond, NULL); #endif } @@ -162,7 +162,7 @@ bool Event::Wait(unsigned timeoutMilliseconds) { struct timeval now; struct timespec abs_timeout; - gettimeofday(&now, nullptr); + gettimeofday(&now, NULL); abs_timeout.tv_sec = now.tv_sec + timeoutMilliseconds/1000; abs_timeout.tv_nsec = now.tv_usec * 1000 + (timeoutMilliseconds%1000)*1000000; abs_timeout.tv_sec += abs_timeout.tv_nsec / 1000000000; @@ -198,10 +198,10 @@ EventLock::EventLock(bool locked) : mEvent() { #ifdef WIN32 - mEvent = CreateEvent(nullptr, TRUE, locked ? FALSE : TRUE, nullptr); + mEvent = CreateEvent(NULL, TRUE, locked ? FALSE : TRUE, NULL); #else - pthread_mutex_init(&mMutex, nullptr); - pthread_cond_init(&mCond, nullptr); + pthread_mutex_init(&mMutex, NULL); + pthread_cond_init(&mCond, NULL); #endif } @@ -243,7 +243,7 @@ bool EventLock::Wait(unsigned timeoutMilliseconds) { struct timeval now; struct timespec abs_timeout; - gettimeofday(&now, nullptr); + gettimeofday(&now, NULL); abs_timeout.tv_sec = now.tv_sec + timeoutMilliseconds/1000; abs_timeout.tv_nsec = now.tv_usec * 1000 + (timeoutMilliseconds%1000)*1000000; abs_timeout.tv_sec += abs_timeout.tv_nsec / 1000000000; diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/utf8.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/utf8.cpp index ba5cc0d7..ce6b8f16 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/utf8.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/utf8.cpp @@ -81,7 +81,7 @@ namespace soe size_t UTF8_convertToUTF16( char * ptr , UTF16 * ret, size_t limit ) { size_t len = 0; - while (( *ptr != 0 ) && ( len < ( limit - 1 ) ))//we use limit -1 to leave room for the nullptr terminator + while (( *ptr != 0 ) && ( len < ( limit - 1 ) ))//we use limit -1 to leave room for the null terminator { size_t clen = UTF8_convertCharToUTF16( ptr, ret ); ptr += clen; diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/IPAddress.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/IPAddress.h index 03b59e8d..f6d5f886 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/IPAddress.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/IPAddress.h @@ -32,7 +32,7 @@ public: * @brief Used to retreive the the dot-notation represenatatiion of this address. * * @param buffer A pointer to the buffer to place the ip address into. - * Must be at least 17 characters long, will be nullptr terminated. + * Must be at least 17 characters long, will be null terminated. * * @return A pointer to the buffer the address was placed into. */ diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpBlockAllocator.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpBlockAllocator.cpp index b7da0f27..6d476d78 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpBlockAllocator.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpBlockAllocator.cpp @@ -6,7 +6,7 @@ namespace NAMESPACE #endif TcpBlockAllocator::TcpBlockAllocator(const unsigned initSize, const unsigned initCount) -: m_freeHead(nullptr), m_blockCount(initCount), m_blockSize(initSize), m_numAvailBlocks(0) +: m_freeHead(NULL), m_blockCount(initCount), m_blockSize(initSize), m_numAvailBlocks(0) { realloc(); } @@ -33,7 +33,7 @@ data_block *TcpBlockAllocator::getBlock() tmp = m_freeHead; m_freeHead = m_freeHead->m_next; - tmp->m_next = nullptr; + tmp->m_next = NULL; m_numAvailBlocks--; return(tmp); } @@ -56,7 +56,7 @@ void TcpBlockAllocator::returnBlock(data_block *b) void TcpBlockAllocator::realloc() { - data_block *tmp = nullptr, *cursor = nullptr; + data_block *tmp = NULL, *cursor = NULL; tmp = new data_block; m_numAvailBlocks++; cursor = tmp; diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpConnection.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpConnection.cpp index a41ad0df..42329552 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpConnection.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpConnection.cpp @@ -11,28 +11,28 @@ namespace NAMESPACE //used when want to open new connection with this socket TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, const IPAddress &destIP, unsigned short destPort, unsigned timeout) -: m_nextConnection(nullptr), - m_prevConnection(nullptr), +: m_nextConnection(NULL), + m_prevConnection(NULL), m_socket(INVALID_SOCKET), - m_nextKeepAliveConnection(nullptr), - m_prevKeepAliveConnection(nullptr), + m_nextKeepAliveConnection(NULL), + m_prevKeepAliveConnection(NULL), m_aliveListId(tcpManager->m_aliveList.m_listID), - m_nextRecvDataConnection(nullptr), - m_prevRecvDataConnection(nullptr), + m_nextRecvDataConnection(NULL), + m_prevRecvDataConnection(NULL), m_recvDataListId(tcpManager->m_dataList.m_listID), m_manager(tcpManager), m_status(StatusNegotiating), - m_handler(nullptr), + m_handler(NULL), m_destIP(destIP), m_destPort(destPort), m_refCount(0), m_sendAllocator(sendAlloc), - m_head(nullptr), - m_tail(nullptr), + m_head(NULL), + m_tail(NULL), m_bytesRead(0), m_bytesNeeded(0), m_params(params), - m_recvBuff(nullptr), + m_recvBuff(NULL), m_connectTimeout(timeout), m_connectTimer(), m_wasConRemovedFromMgr(false), @@ -94,28 +94,28 @@ TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAllo //used when server mode creates new connection object representing a connect request TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, SOCKET socket, const IPAddress &destIP, unsigned short destPort) -: m_nextConnection(nullptr), - m_prevConnection(nullptr), +: m_nextConnection(NULL), + m_prevConnection(NULL), m_socket(socket), - m_nextKeepAliveConnection(nullptr), - m_prevKeepAliveConnection(nullptr), + m_nextKeepAliveConnection(NULL), + m_prevKeepAliveConnection(NULL), m_aliveListId(tcpManager->m_aliveList.m_listID), - m_nextRecvDataConnection(nullptr), - m_prevRecvDataConnection(nullptr), + m_nextRecvDataConnection(NULL), + m_prevRecvDataConnection(NULL), m_recvDataListId(tcpManager->m_dataList.m_listID), m_manager(tcpManager), m_status(StatusConnected), - m_handler(nullptr), + m_handler(NULL), m_destIP(destIP), m_destPort(destPort), m_refCount(0), m_sendAllocator(sendAlloc), - m_head(nullptr), - m_tail(nullptr), + m_head(NULL), + m_tail(NULL), m_bytesRead(0), m_bytesNeeded(0), m_params(params), - m_recvBuff(nullptr), + m_recvBuff(NULL), m_connectTimeout(0), m_connectTimer(), m_wasConRemovedFromMgr(false) @@ -206,7 +206,7 @@ int TcpConnection::finishConnect() t.tv_sec = 0; t.tv_usec = 0; - int err = select(m_socket + 1, nullptr, &wrSet, nullptr, &t); + int err = select(m_socket + 1, NULL, &wrSet, NULL, &t); if (err == 0) { @@ -303,7 +303,7 @@ TcpConnection::~TcpConnection() { delete [] m_recvBuff; - while(m_head != nullptr) + while(m_head != NULL) { data_block *tmp = m_head; m_head = m_head->m_next; @@ -327,22 +327,22 @@ void TcpConnection::Send(const char *data, unsigned int dataLen) { m_aliveListId = m_manager->m_keepAliveList.m_listID; - if (m_prevKeepAliveConnection != nullptr) + if (m_prevKeepAliveConnection != NULL) m_prevKeepAliveConnection->m_nextKeepAliveConnection = m_nextKeepAliveConnection; - if (m_nextKeepAliveConnection != nullptr) + if (m_nextKeepAliveConnection != NULL) m_nextKeepAliveConnection->m_prevKeepAliveConnection = m_prevKeepAliveConnection; if (m_manager->m_keepAliveList.m_beginList == this) m_manager->m_keepAliveList.m_beginList = m_nextKeepAliveConnection; m_nextKeepAliveConnection = m_manager->m_aliveList.m_beginList; - m_prevKeepAliveConnection = nullptr; - if (m_manager->m_aliveList.m_beginList != nullptr) + m_prevKeepAliveConnection = NULL; + if (m_manager->m_aliveList.m_beginList != NULL) m_manager->m_aliveList.m_beginList->m_prevKeepAliveConnection = this; m_manager->m_aliveList.m_beginList = this; } - data_block *work = nullptr; + data_block *work = NULL; // this connection has no send buffer. Get a block if(!m_tail) @@ -471,16 +471,16 @@ int TcpConnection::processIncoming() { m_recvDataListId = m_manager->m_noDataList.m_listID; - if (m_prevRecvDataConnection != nullptr) + if (m_prevRecvDataConnection != NULL) m_prevRecvDataConnection->m_nextRecvDataConnection = m_nextRecvDataConnection; - if (m_nextRecvDataConnection != nullptr) + if (m_nextRecvDataConnection != NULL) m_nextRecvDataConnection->m_prevRecvDataConnection = m_prevRecvDataConnection; if (m_manager->m_noDataList.m_beginList == this) m_manager->m_noDataList.m_beginList = m_nextRecvDataConnection; m_nextRecvDataConnection = m_manager->m_dataList.m_beginList; - m_prevRecvDataConnection = nullptr; - if (m_manager->m_dataList.m_beginList != nullptr) + m_prevRecvDataConnection = NULL; + if (m_manager->m_dataList.m_beginList != NULL) m_manager->m_dataList.m_beginList->m_prevRecvDataConnection = this; m_manager->m_dataList.m_beginList = this; } @@ -626,7 +626,7 @@ int TcpConnection::processOutgoing() int sendError = 1; - // If m_head is not nullptr, then this connection has something to send + // If m_head is not null, then this connection has something to send if(m_head) diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpConnection.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpConnection.h index efe2d031..36a41e9f 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpConnection.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpConnection.h @@ -50,7 +50,7 @@ public: * connection is disconnected, you simply need to derive your class * (multiply if necessary) from TcpConnectionHandler, then you can use * this method to set the object the TcpConnection will call as appropriate. - * default = nullptr (no callbacks made) + * default = NULL (no callbacks made) * * @param handler The object which will be called for notifications. */ diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpManager.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpManager.cpp index 6f31e9ae..53105f3d 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpManager.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpManager.cpp @@ -57,14 +57,14 @@ TcpManager::TcpParams::TcpParams(const TcpParams &cpy) } TcpManager::TcpManager(const TcpParams ¶ms) -: m_handler(nullptr), - m_keepAliveList(nullptr, 1), - m_aliveList(nullptr, 2), - m_noDataList(nullptr, 1), - m_dataList(nullptr, 2), +: m_handler(NULL), + m_keepAliveList(NULL, 1), + m_aliveList(NULL, 2), + m_noDataList(NULL, 1), + m_dataList(NULL, 2), m_params(params), m_refCount(1), - m_connectionList(nullptr), + m_connectionList(NULL), m_connectionListCount(0), m_socket(INVALID_SOCKET), m_boundAsServer(false), @@ -103,7 +103,7 @@ TcpManager::~TcpManager() close(m_socket); #endif } - while (m_connectionList != nullptr) + while (m_connectionList != NULL) { TcpConnection *con = m_connectionList; con->AddRef(); @@ -179,7 +179,7 @@ bool TcpManager::BindAsServer() { struct hostent * lphp; lphp = gethostbyname(m_params.bindAddress); - if (lphp != nullptr) + if (lphp != NULL) addr_loc.sin_addr.s_addr = ((struct in_addr *)(lphp->h_addr))->s_addr; } else @@ -204,7 +204,7 @@ bool TcpManager::BindAsServer() TcpConnection *TcpManager::acceptClient() { - TcpConnection *newConn = nullptr; + TcpConnection *newConn = NULL; if (m_boundAsServer && m_connectionListCount < m_params.maxConnections) { @@ -218,7 +218,7 @@ TcpConnection *TcpManager::acceptClient() { newConn = new TcpConnection(this, &m_allocator, m_params, sock, IPAddress(addr.sin_addr.s_addr), ntohs(addr.sin_port)); addNewConnection(newConn); - if (m_handler != nullptr) + if (m_handler != NULL) { m_handler->OnConnectRequest(newConn); } @@ -243,8 +243,8 @@ SOCKET TcpManager::getMaxFD() if (m_boundAsServer) maxfd = m_socket+1; - TcpConnection *next = nullptr; - for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) + TcpConnection *next = NULL; + for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) { next = con->m_nextConnection; if (con->GetStatus() != TcpConnection::StatusDisconnected && con->m_socket > maxfd) @@ -258,8 +258,8 @@ SOCKET TcpManager::getMaxFD() TcpConnection *TcpManager::getConnection(SOCKET fd) { - TcpConnection *next = nullptr; - for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) + TcpConnection *next = NULL; + for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) { next = con->m_nextConnection; if (con->m_socket == fd) @@ -268,7 +268,7 @@ TcpConnection *TcpManager::getConnection(SOCKET fd) } } //if get here ,couldn't find it - return nullptr; + return NULL; } bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendTimePerConnection, unsigned maxRecvTimePerConnection) @@ -290,8 +290,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT { // Send output from last heartbeat - TcpConnection *next = nullptr; - for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) + TcpConnection *next = NULL; + for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) { con->AddRef(); if (next) next->Release(); @@ -358,7 +358,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT tmpfds = m_permfds; timeout.tv_sec = 0; timeout.tv_usec = 0; - int cnt = select(maxfd, &tmpfds, nullptr, nullptr, &timeout); // blocks for timeout + int cnt = select(maxfd, &tmpfds, NULL, NULL, &timeout); // blocks for timeout if (cnt > 0) @@ -384,8 +384,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //process incoming client messages if (maxRecvTimePerConnection != 0) { - TcpConnection *next = nullptr; - for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) + TcpConnection *next = NULL; + for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) { con->AddRef(); if (next) next->Release(); @@ -450,8 +450,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT pollfds[0].events |= POLLIN; } - TcpConnection *next = nullptr; - for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next, idx++) + TcpConnection *next = NULL; + for (TcpConnection *con = m_connectionList ; con != NULL ; con = next, idx++) { next = con->m_nextConnection; pollfds[idx].fd = con->m_socket; @@ -491,7 +491,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT } //process regular msg(s) - if (con == nullptr) + if (con == NULL) { close(pollfds[idx].fd); continue; @@ -523,7 +523,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT }//if(pollfds[... else if (pollfds[idx].revents & POLLHUP) { - if (con == nullptr) + if (con == NULL) { close(pollfds[idx].fd); continue; @@ -541,21 +541,21 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //now process any keepalives, if time to do that if (m_params.keepAliveDelay > 0 && m_keepAliveTimer.isDone(m_params.keepAliveDelay)) { - TcpConnection *next = nullptr; - for (TcpConnection *con = m_keepAliveList.m_beginList ; con != nullptr ; con = next) + TcpConnection *next = NULL; + for (TcpConnection *con = m_keepAliveList.m_beginList ; con != NULL ; con = next) { con->AddRef(); if (next) next->Release(); next = con->m_nextKeepAliveConnection; if (next) next->AddRef(); - con->Send(nullptr, 0); //note: this request will move the connection from the keepAliveList to the aliveList + con->Send(NULL, 0); //note: this request will move the connection from the keepAliveList to the aliveList con->Release(); } //now move the complete alive list over to the keepalive list to reset those timers m_keepAliveList.m_beginList = m_aliveList.m_beginList; - m_aliveList.m_beginList = nullptr; + m_aliveList.m_beginList = NULL; //switch id's for those connections that were in the alive list last go - around int tmpID = m_aliveList.m_listID; @@ -569,8 +569,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //now process any noDataCons, if time to do that if (m_params.noDataTimeout > 0 && m_noDataTimer.isDone(m_params.noDataTimeout)) { - TcpConnection *next = nullptr; - for (TcpConnection *con = m_noDataList.m_beginList ; con != nullptr ; con = next) + TcpConnection *next = NULL; + for (TcpConnection *con = m_noDataList.m_beginList ; con != NULL ; con = next) { con->AddRef(); if (next) next->Release(); @@ -584,7 +584,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //now move the complete data list over to the nodata list to reset those timers m_noDataList.m_beginList = m_dataList.m_beginList; - m_dataList.m_beginList = nullptr; + m_dataList.m_beginList = NULL; //switch id's for those connections that were in the data list last go - around int tmpID = m_dataList.m_listID; @@ -606,17 +606,17 @@ TcpConnection *TcpManager::EstablishConnection(const char *serverAddress, unsign { //can't open outgoing connections when in server mode // use a different TcpManager to do that - return nullptr; + return NULL; } if (m_connectionListCount >= m_params.maxConnections) - return(nullptr); + return(NULL); // get server address unsigned long address = inet_addr(serverAddress); if (address == INADDR_NONE) { - if (m_dnsMap[serverAddress].timeout >= time(nullptr)) + if (m_dnsMap[serverAddress].timeout >= time(NULL)) { address = m_dnsMap[serverAddress].addr; } @@ -624,12 +624,12 @@ TcpConnection *TcpManager::EstablishConnection(const char *serverAddress, unsign { struct hostent * lphp; lphp = gethostbyname(serverAddress); - if (lphp == nullptr) - return(nullptr); + if (lphp == NULL) + return(NULL); address = ((struct in_addr *)(lphp->h_addr))->s_addr; m_dnsMap[serverAddress].addr = address; - m_dnsMap[serverAddress].timeout = time(nullptr)+DNS_TIMEOUT; + m_dnsMap[serverAddress].timeout = time(NULL)+DNS_TIMEOUT; } } IPAddress destIP(address); @@ -649,22 +649,22 @@ void TcpManager::addNewConnection(TcpConnection *con) FD_SET(con->m_socket, &m_permfds); #endif con->m_nextConnection = m_connectionList; - con->m_prevConnection = nullptr; - if (m_connectionList != nullptr) + con->m_prevConnection = NULL; + if (m_connectionList != NULL) m_connectionList->m_prevConnection = con; m_connectionList = con; m_connectionListCount++; con->m_nextKeepAliveConnection = m_aliveList.m_beginList; - con->m_prevKeepAliveConnection = nullptr; - if (m_aliveList.m_beginList != nullptr) + con->m_prevKeepAliveConnection = NULL; + if (m_aliveList.m_beginList != NULL) m_aliveList.m_beginList->m_prevKeepAliveConnection = con; m_aliveList.m_beginList = con; con->m_aliveListId = m_keepAliveList.m_listID;//start it out thinking it's already in the alive list, since it is con->m_nextRecvDataConnection = m_dataList.m_beginList; - con->m_prevRecvDataConnection = nullptr; - if (m_dataList.m_beginList != nullptr) + con->m_prevRecvDataConnection = NULL; + if (m_dataList.m_beginList != NULL) m_dataList.m_beginList->m_prevRecvDataConnection = con; m_dataList.m_beginList = con; con->m_recvDataListId = m_noDataList.m_listID;//start it out thinking it's already in the data list, since it is @@ -682,40 +682,40 @@ void TcpManager::removeConnection(TcpConnection *con) FD_CLR(con->m_socket, &m_permfds); } #endif - if (con->m_prevConnection != nullptr) + if (con->m_prevConnection != NULL) con->m_prevConnection->m_nextConnection = con->m_nextConnection; - if (con->m_nextConnection != nullptr) + if (con->m_nextConnection != NULL) con->m_nextConnection->m_prevConnection = con->m_prevConnection; if (m_connectionList == con) m_connectionList = con->m_nextConnection; - con->m_nextConnection = nullptr; - con->m_prevConnection = nullptr; + con->m_nextConnection = NULL; + con->m_prevConnection = NULL; - if (con->m_prevKeepAliveConnection != nullptr) + if (con->m_prevKeepAliveConnection != NULL) con->m_prevKeepAliveConnection->m_nextKeepAliveConnection = con->m_nextKeepAliveConnection; - if (con->m_nextKeepAliveConnection != nullptr) + if (con->m_nextKeepAliveConnection != NULL) con->m_nextKeepAliveConnection->m_prevKeepAliveConnection = con->m_prevKeepAliveConnection; if (m_aliveList.m_beginList == con) m_aliveList.m_beginList = con->m_nextKeepAliveConnection; else if (m_keepAliveList.m_beginList == con) m_keepAliveList.m_beginList = con->m_nextKeepAliveConnection; - con->m_nextKeepAliveConnection = nullptr; - con->m_prevKeepAliveConnection = nullptr; + con->m_nextKeepAliveConnection = NULL; + con->m_prevKeepAliveConnection = NULL; - if (con->m_prevRecvDataConnection != nullptr) + if (con->m_prevRecvDataConnection != NULL) con->m_prevRecvDataConnection->m_nextRecvDataConnection = con->m_nextRecvDataConnection; - if (con->m_nextRecvDataConnection != nullptr) + if (con->m_nextRecvDataConnection != NULL) con->m_nextRecvDataConnection->m_prevRecvDataConnection = con->m_prevRecvDataConnection; if (m_dataList.m_beginList == con) m_dataList.m_beginList = con->m_nextRecvDataConnection; else if (m_noDataList.m_beginList == con) m_noDataList.m_beginList = con->m_nextRecvDataConnection; - con->m_nextRecvDataConnection = nullptr; - con->m_prevRecvDataConnection = nullptr; + con->m_nextRecvDataConnection = NULL; + con->m_prevRecvDataConnection = NULL; diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpManager.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpManager.h index e9b9e176..b2192dff 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpManager.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpManager.h @@ -168,7 +168,7 @@ public: * simply need to derive your class (multiply if necessary) from TcpManagerHandler, then you can use * this method to set the object the TcpManager will call as appropriate. The TcpConnection object * also has a handler mechanism that replaces the other callback functions below, see TcpConnection::SetHandler - * default = nullptr (no callbacks made) + * default = NULL (no callbacks made) * * @param handler The object which will be called for manager related notifications. */ @@ -223,7 +223,7 @@ public: * the connect-complete callback to be called if the connection is succesfull. * * @return A pointer to a TcpConnection object. - * nullptr if the manager object has exceeded its maximum number of connections + * NULL if the manager object has exceeded its maximum number of connections * or if the serverAddress cannot be resolved to an IP address. */ TcpConnection *EstablishConnection(const char *serverAddress, unsigned short serverPort, unsigned timeout = 0); diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpLibrary.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpLibrary.cpp index f86f5d7b..f8221166 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpLibrary.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpLibrary.cpp @@ -150,7 +150,7 @@ UdpIpAddress::UdpIpAddress(unsigned int ip) char *UdpIpAddress::GetAddress(char *buffer) const { - assert(buffer != nullptr); + assert(buffer != NULL); struct sockaddr_in addr_serverUDP; addr_serverUDP.sin_addr.s_addr = mIp; @@ -163,7 +163,7 @@ char *UdpIpAddress::GetAddress(char *buffer) const ///////////////////////////////////////////////////////////////////////////////////////////////////// UdpManager::Params::Params() { - handler = nullptr; + handler = NULL; outgoingBufferSize = 64 * 1024; incomingBufferSize = 64 * 1024; packetHistoryMax = 100; @@ -265,7 +265,7 @@ UdpManager::UdpManager(const UdpManager::Params *params) mParams.maxDataHoldSize = udpMin(mParams.maxDataHoldSize, mParams.maxRawPacketSize); mParams.packetHistoryMax = udpMax(1, mParams.packetHistoryMax); mPacketHistoryPosition = 0; - mPassThroughData = nullptr; + mPassThroughData = NULL; typedef PacketHistoryEntry *PacketHistoryEntryPtr; mPacketHistory = new PacketHistoryEntryPtr[mParams.packetHistoryMax]; @@ -286,17 +286,17 @@ UdpManager::UdpManager(const UdpManager::Params *params) mUdpSocket = INVALID_SOCKET; mConnectionListCount = 0; - mConnectionList = nullptr; + mConnectionList = NULL; mPoolCreated = 0; mPoolAvailable = 0; - mPoolAvailableRoot = nullptr; - mPoolCreatedRoot = nullptr; + mPoolAvailableRoot = NULL; + mPoolCreatedRoot = NULL; mWrappedCreated = 0; mWrappedAvailable = 0; - mWrappedAvailableRoot = nullptr; - mWrappedCreatedRoot = nullptr; + mWrappedAvailableRoot = NULL; + mWrappedCreatedRoot = NULL; for (i = 0; i < mParams.pooledPacketInitial && i < mParams.pooledPacketMax; i++) { @@ -306,16 +306,16 @@ UdpManager::UdpManager(const UdpManager::Params *params) lp->Release(); } - mSimulateQueueStart = nullptr; - mSimulateQueueEnd = nullptr; + mSimulateQueueStart = NULL; + mSimulateQueueEnd = NULL; mSimulateNextOutgoingTime = 0; mSimulateNextIncomingTime = 0; mSimulateQueueBytes = 0; - mDisconnectPendingList = nullptr; + mDisconnectPendingList = NULL; if (mParams.avoidPriorityQueue) - mPriorityQueue = nullptr; + mPriorityQueue = NULL; else mPriorityQueue = new PriorityQueue(mParams.maxConnections); @@ -346,14 +346,14 @@ UdpManager::~UdpManager() // first we need to tell all the pooled packets we have created that they can no longer check themselves back into use // when they are released PooledLogicalPacket *walk = mPoolCreatedRoot; - while (walk != nullptr) + while (walk != NULL) { - walk->mUdpManager = nullptr; + walk->mUdpManager = NULL; walk = walk->mCreatedNext; } // next release the ones we have in our available pool walk = mPoolAvailableRoot; - while (walk != nullptr) + while (walk != NULL) { PooledLogicalPacket *hold = walk; walk = walk->mAvailableNext; @@ -366,14 +366,14 @@ UdpManager::~UdpManager() // next we need to tell all the warpped packets we have created that they can no longer check themselves back into use // when they are released WrappedLogicalPacket *walk = mWrappedCreatedRoot; - while (walk != nullptr) + while (walk != NULL) { - walk->mUdpManager = nullptr; + walk->mUdpManager = NULL; walk = walk->mCreatedNext; } // next release the ones we have in our available pool walk = mWrappedAvailableRoot; - while (walk != nullptr) + while (walk != NULL) { WrappedLogicalPacket *hold = walk; walk = walk->mAvailableNext; @@ -383,7 +383,7 @@ UdpManager::~UdpManager() // next thing we must do is tell all the connections to disconnect (which severs their link to this dying manager) // this has to be done first since they will call back into us and have themselves removed from our connection-list/priority-queue/etc - while (mConnectionList != nullptr) + while (mConnectionList != NULL) { mConnectionList->InternalDisconnect(0, UdpConnection::cDisconnectReasonManagerDeleted); // the above call ended up calling us back and removing them from our connection list, so now mConnectionList is pointing to the next entry @@ -391,7 +391,7 @@ UdpManager::~UdpManager() } // release any objects that were pending disconnection - while (mDisconnectPendingList != nullptr) + while (mDisconnectPendingList != NULL) { UdpConnection *next = mDisconnectPendingList->mDisconnectPendingNextConnection; mDisconnectPendingList->Release(); @@ -416,7 +416,7 @@ UdpManager::~UdpManager() } delete[] mPacketHistory; - while (mSimulateQueueStart != nullptr) + while (mSimulateQueueStart != NULL) { SimulateQueueEntry *entry = mSimulateQueueStart; mSimulateQueueStart = entry->mNext; @@ -529,12 +529,12 @@ void UdpManager::ProcessDisconnectPending() { UdpConnection *entry = mDisconnectPendingList; UdpConnection **prev = &mDisconnectPendingList; - while (entry != nullptr) + while (entry != NULL) { if (entry->GetStatus() == UdpConnection::cStatusDisconnected) { *prev = entry->mDisconnectPendingNextConnection; - entry->mDisconnectPendingNextConnection = nullptr; + entry->mDisconnectPendingNextConnection = NULL; entry->Release(); entry = *prev; } @@ -548,19 +548,19 @@ void UdpManager::ProcessDisconnectPending() void UdpManager::RemoveConnection(UdpConnection *con) { - assert(con != nullptr); // attemped to remove a nullptr connection object + assert(con != NULL); // attemped to remove a NULL connection object // note: it's a bug to Remove a connection object that is already removed...should never be able to happen. mConnectionListCount--; - if (con->mPrevConnection != nullptr) + if (con->mPrevConnection != NULL) con->mPrevConnection->mNextConnection = con->mNextConnection; - if (con->mNextConnection != nullptr) + if (con->mNextConnection != NULL) con->mNextConnection->mPrevConnection = con->mPrevConnection; if (mConnectionList == con) mConnectionList = con->mNextConnection; - con->mNextConnection = nullptr; - con->mPrevConnection = nullptr; - if (mPriorityQueue != nullptr) + con->mNextConnection = NULL; + con->mPrevConnection = NULL; + if (mPriorityQueue != NULL) mPriorityQueue->Remove(con); mAddressHashTable->Remove(con, AddressHashValue(con->mIp, con->mPort)); @@ -569,11 +569,11 @@ void UdpManager::RemoveConnection(UdpConnection *con) void UdpManager::AddConnection(UdpConnection *con) { - assert(con != nullptr); // attemped to add a nullptr connection object + assert(con != NULL); // attemped to add a NULL connection object con->mNextConnection = mConnectionList; - con->mPrevConnection = nullptr; - if (mConnectionList != nullptr) + con->mPrevConnection = NULL; + if (mConnectionList != NULL) mConnectionList->mPrevConnection = con; mConnectionList = con; mConnectionListCount++; @@ -586,7 +586,7 @@ void UdpManager::FlushAllMultiBuffer() { AddRef(); UdpConnection *cur = mConnectionList; - while (cur != nullptr) + while (cur != NULL) { cur->FlushMultiBuffer(); cur = cur->mNextConnection; @@ -609,7 +609,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) { PacketHistoryEntry *e = ActualReceive(); - if (e == nullptr) + if (e == NULL) { mLastEmptySocketBufferStamp = UdpMisc::Clock(); break; @@ -637,7 +637,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) if (giveConnectionsTime) { - if (mPriorityQueue != nullptr) + if (mPriorityQueue != NULL) { // give time to everybody in the priority-queue that needs it UdpMisc::ClockStamp curPriority = UdpMisc::Clock(); @@ -655,7 +655,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) for (;;) { UdpConnection *top = mPriorityQueue->TopRemove(curPriority); - if (top == nullptr) + if (top == NULL) break; top->AddRef(); top->GiveTime(); @@ -668,7 +668,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) { // give time to everybody UdpConnection *cur = mConnectionList; - while (cur != nullptr) + while (cur != NULL) { cur->GiveTime(); cur = cur->mNextConnection; @@ -678,7 +678,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) ProcessDisconnectPending(); } - if (mSimulateQueueStart != nullptr && UdpMisc::Clock() >= mSimulateNextOutgoingTime) + if (mSimulateQueueStart != NULL && UdpMisc::Clock() >= mSimulateNextOutgoingTime) { SimulateQueueEntry *entry = mSimulateQueueStart; mSimulateQueueStart = mSimulateQueueStart->mNext; @@ -686,7 +686,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) ActualSendHelper(entry->mData, entry->mDataLen, entry->mIp, entry->mPort); UdpConnection *con = AddressGetConnection(entry->mIp, entry->mPort); - if (con != nullptr) + if (con != NULL) con->mSimulateQueueBytes -= entry->mDataLen; mSimulateQueueBytes -= entry->mDataLen; delete entry; @@ -699,11 +699,11 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) UdpConnection *UdpManager::EstablishConnection(const char *serverAddress, int serverPort, int timeout) { assert(serverPort != 0); // can't connect to no port - assert(serverAddress != nullptr); + assert(serverAddress != NULL); assert(serverAddress[0] != 0); if (mConnectionListCount >= mParams.maxConnections) - return(nullptr); + return(NULL); // get server address unsigned long address = inet_addr(serverAddress); @@ -711,16 +711,16 @@ UdpConnection *UdpManager::EstablishConnection(const char *serverAddress, int se { struct hostent * lphp; lphp = gethostbyname(serverAddress); - if (lphp == nullptr) - return(nullptr); + if (lphp == NULL) + return(NULL); address = ((struct in_addr *)(lphp->h_addr))->s_addr; } UdpIpAddress destIp(address); // first, see if we already have a connection object managing this ip/port, if we do, then fail UdpConnection *con = AddressGetConnection(destIp, serverPort); - if (con != nullptr) - return(nullptr); + if (con != NULL) + return(NULL); return(new UdpConnection(this, destIp, serverPort, timeout)); } @@ -733,7 +733,7 @@ void UdpManager::KeepUntilDisconnected(UdpConnection *con) void UdpManager::GetStats(UdpManagerStatistics *stats) const { - assert(stats != nullptr); + assert(stats != NULL); *stats = mManagerStats; stats->poolAvailable = mPoolAvailable; stats->poolCreated = mPoolCreated; @@ -748,10 +748,10 @@ void UdpManager::ResetStats() void UdpManager::DumpPacketHistory(const char *filename) const { - assert(filename != nullptr); + assert(filename != NULL); assert(filename[0] != 0); FILE *file = fopen(filename, "wt"); - if (file != nullptr) + if (file != NULL) { // dump history of packets... for (int i = 0; i < mParams.packetHistoryMax; i++) @@ -797,7 +797,7 @@ int UdpManager::GetLocalPort() const UdpManager::PacketHistoryEntry *UdpManager::ActualReceive() { if (mParams.simulateIncomingByteRate > 0 && UdpMisc::Clock() < mSimulateNextIncomingTime) - return(nullptr); + return(NULL); struct sockaddr_in addr_from; socklen_t sf = sizeof(addr_from); @@ -807,7 +807,7 @@ UdpManager::PacketHistoryEntry *UdpManager::ActualReceive() if (res != SOCKET_ERROR) { if (mParams.simulateIncomingLossPercent > 0 && ((rand() % 100) < mParams.simulateIncomingLossPercent)) - return(nullptr); // packet, what packet? + return(NULL); // packet, what packet? if (mParams.simulateIncomingByteRate > 0) mSimulateNextIncomingTime = UdpMisc::Clock() + (res * 1000 / mParams.simulateIncomingByteRate); @@ -832,7 +832,7 @@ UdpManager::PacketHistoryEntry *UdpManager::ActualReceive() UdpIpAddress ip = UdpIpAddress(addr_from.sin_addr.s_addr); int port = (int)ntohs(addr_from.sin_port); UdpConnection *con = AddressGetConnection(ip, port); - if (con != nullptr) + if (con != NULL) { con->AddRef(); con->PortUnreachable(); @@ -852,7 +852,7 @@ UdpManager::PacketHistoryEntry *UdpManager::ActualReceive() } #endif } - return(nullptr); + return(NULL); } void UdpManager::ProcessIcmpErrors() @@ -880,7 +880,7 @@ void UdpManager::ProcessIcmpErrors() struct cmsghdr * cmsg; if(CMSG_FIRSTHDR(&msgh)) { - for(cmsg = CMSG_FIRSTHDR(&msgh); cmsg != nullptr; cmsg = CMSG_NXTHDR(&msgh, cmsg)) + for(cmsg = CMSG_FIRSTHDR(&msgh); cmsg != NULL; cmsg = CMSG_NXTHDR(&msgh, cmsg)) { if(cmsg->cmsg_level == SOL_IP && cmsg->cmsg_type == IP_RECVERR) { @@ -894,7 +894,7 @@ void UdpManager::ProcessIcmpErrors() UdpIpAddress ip = UdpIpAddress(msg_name.sin_addr.s_addr); int port = (int)htons(msg_name.sin_port); UdpConnection *con = AddressGetConnection(ip, port); - if (con != nullptr) + if (con != NULL) { con->AddRef(); con->PortUnreachable(); @@ -923,7 +923,7 @@ void UdpManager::ActualSend(const uchar *data, int dataLen, UdpIpAddress ip, int { // simulating outgoing byte-rate, so queue it up for sending later UdpConnection *con = AddressGetConnection(ip, port); - if (con != nullptr) + if (con != NULL) { if (mParams.simulateDestinationOverloadLevel > 0 && con->mSimulateQueueBytes + dataLen > mParams.simulateDestinationOverloadLevel) return; // no room, packet gets lost @@ -931,17 +931,17 @@ void UdpManager::ActualSend(const uchar *data, int dataLen, UdpIpAddress ip, int if (mParams.simulateOutgoingOverloadLevel > 0 && mSimulateQueueBytes + dataLen > mParams.simulateOutgoingOverloadLevel) return; // no room, packet gets lost - if (con != nullptr) + if (con != NULL) con->mSimulateQueueBytes += dataLen; mSimulateQueueBytes += dataLen; SimulateQueueEntry *entry = new SimulateQueueEntry(data, dataLen, ip, port); - if (mSimulateQueueStart != nullptr) + if (mSimulateQueueStart != NULL) mSimulateQueueEnd->mNext = entry; else mSimulateQueueStart = entry; mSimulateQueueEnd = entry; - mSimulateQueueEnd->mNext = nullptr; + mSimulateQueueEnd->mNext = NULL; return; } ActualSendHelper(data, dataLen, ip, port); @@ -964,7 +964,7 @@ void UdpManager::ActualSendHelper(const uchar *data, int dataLen, UdpIpAddress i // flag connection to terminate itself for port-unreachable error on next give time // we need to flag it instead of actually terminating it to prevent callbacks from occuring during application sends UdpConnection *con = AddressGetConnection(ip, port); - if (con != nullptr) + if (con != NULL) con->FlagPortUnreachable(); return; } @@ -1002,7 +1002,7 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) UdpConnection *con = AddressGetConnection(e->mIp, e->mPort); - if (con == nullptr) + if (con == NULL) { // packet coming from an unknown ip/port // if it is a connection request packet, then establish a new connection object to reply to it @@ -1012,7 +1012,7 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) if (mConnectionListCount >= mParams.maxConnections) return; // can't handle any more connections, so ignore this request entirely - if (mParams.handler != nullptr) + if (mParams.handler != NULL) { UdpConnection *newcon = new UdpConnection(this, e); mParams.handler->OnConnectRequest(newcon); @@ -1040,7 +1040,7 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) int encryptCode = UdpMisc::GetValue32(ptr); UdpConnection *con = ConnectCodeGetConnection(connectCode); - if (con != nullptr) + if (con != NULL) { if (mParams.allowAddressRemapping || con->mIp == e->mIp) { @@ -1090,25 +1090,25 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) UdpConnection *UdpManager::AddressGetConnection(UdpIpAddress ip, int port) const { UdpConnection *found = static_cast(mAddressHashTable->FindFirst(AddressHashValue(ip, port))); - while (found != nullptr) + while (found != NULL) { if (found->mIp == ip && found->mPort == port) return(found); found = static_cast(mAddressHashTable->FindNext(found)); } - return(nullptr); + return(NULL); } UdpConnection *UdpManager::ConnectCodeGetConnection(int connectCode) const { UdpConnection *found = static_cast(mConnectCodeHashTable->FindFirst(connectCode)); - while (found != nullptr) + while (found != NULL) { if (found->mConnectCode == connectCode) return(found); found = static_cast(mConnectCodeHashTable->FindNext(found)); } - return(nullptr); + return(NULL); } WrappedLogicalPacket *UdpManager::WrappedBorrow(const LogicalPacket *lp) @@ -1132,7 +1132,7 @@ WrappedLogicalPacket *UdpManager::WrappedBorrow(const LogicalPacket *lp) void UdpManager::WrappedCreated(WrappedLogicalPacket *wp) { wp->mCreatedNext = mWrappedCreatedRoot; - if (mWrappedCreatedRoot != nullptr) + if (mWrappedCreatedRoot != NULL) mWrappedCreatedRoot->mCreatedPrev = wp; mWrappedCreatedRoot = wp; mWrappedCreated++; @@ -1140,11 +1140,11 @@ void UdpManager::WrappedCreated(WrappedLogicalPacket *wp) void UdpManager::WrappedDestroyed(WrappedLogicalPacket *wp) { - if (wp->mCreatedNext != nullptr) + if (wp->mCreatedNext != NULL) { wp->mCreatedNext->mCreatedPrev = wp->mCreatedPrev; } - if (wp->mCreatedPrev != nullptr) + if (wp->mCreatedPrev != NULL) { wp->mCreatedPrev->mCreatedNext = wp->mCreatedNext; } @@ -1154,9 +1154,9 @@ void UdpManager::WrappedDestroyed(WrappedLogicalPacket *wp) mWrappedCreatedRoot = wp->mCreatedNext; } - wp->mCreatedPrev = nullptr; - wp->mCreatedNext = nullptr; - wp->mUdpManager = nullptr; + wp->mCreatedPrev = NULL; + wp->mCreatedNext = NULL; + wp->mUdpManager = NULL; mWrappedCreated--; } @@ -1191,7 +1191,7 @@ LogicalPacket *UdpManager::CreatePacket(const void *data, int dataLen, const voi void UdpManager::PoolCreated(PooledLogicalPacket *packet) { packet->mCreatedNext = mPoolCreatedRoot; - if (mPoolCreatedRoot != nullptr) + if (mPoolCreatedRoot != NULL) mPoolCreatedRoot->mCreatedPrev = packet; mPoolCreatedRoot = packet; mPoolCreated++; @@ -1199,11 +1199,11 @@ void UdpManager::PoolCreated(PooledLogicalPacket *packet) void UdpManager::PoolDestroyed(PooledLogicalPacket *packet) { - if (packet->mCreatedNext != nullptr) + if (packet->mCreatedNext != NULL) { packet->mCreatedNext->mCreatedPrev = packet->mCreatedPrev; } - if (packet->mCreatedPrev != nullptr) + if (packet->mCreatedPrev != NULL) { packet->mCreatedPrev->mCreatedNext = packet->mCreatedNext; } @@ -1213,9 +1213,9 @@ void UdpManager::PoolDestroyed(PooledLogicalPacket *packet) mPoolCreatedRoot = packet->mCreatedNext; } - packet->mCreatedPrev = nullptr; - packet->mCreatedNext = nullptr; - packet->mUdpManager = nullptr; + packet->mCreatedPrev = NULL; + packet->mCreatedNext = NULL; + packet->mUdpManager = NULL; mPoolCreated--; } @@ -1290,7 +1290,7 @@ void UdpConnection::Init(UdpManager *udpManager, UdpIpAddress destIp, int destPo mLastClockSyncTime = 0; mDataHoldTime = 0; mGettingTime = false; - mHandler = nullptr; + mHandler = NULL; mOtherSideProtocolVersion = 0; mNoDataTimeout = mUdpManager->mParams.noDataTimeout; @@ -1299,13 +1299,13 @@ void UdpConnection::Init(UdpManager *udpManager, UdpIpAddress destIp, int destPo mMultiBufferData = new uchar[mUdpManager->mParams.maxRawPacketSize]; mMultiBufferPtr = mMultiBufferData; - mDisconnectPendingNextConnection = nullptr; - mNextConnection = nullptr; - mPrevConnection = nullptr; + mDisconnectPendingNextConnection = NULL; + mNextConnection = NULL; + mPrevConnection = NULL; mIcmpErrorRetryStartStamp = 0; // when the timer started for ICMP error retry delay (gets reset on a successful packet receive) mPortRemapRequestStartStamp = 0; - mEncryptXorBuffer = nullptr; + mEncryptXorBuffer = NULL; mEncryptExpansionBytes = 0; mOrderedCountOutgoing = 0; mOrderedCountOutgoing2 = 0; @@ -1316,7 +1316,7 @@ void UdpConnection::Init(UdpManager *udpManager, UdpIpAddress destIp, int destPo mConnectionCreateTime = UdpMisc::Clock(); mSimulateQueueBytes = 0; - mPassThroughData = nullptr; + mPassThroughData = NULL; mSilentDisconnect = false; mLastSendBin = 0; @@ -1334,7 +1334,7 @@ void UdpConnection::Init(UdpManager *udpManager, UdpIpAddress destIp, int destPo UdpConnection::~UdpConnection() { - if (mUdpManager != nullptr) + if (mUdpManager != NULL) InternalDisconnect(0, cDisconnectReasonApplicationReleased); for (int i = 0; i < UdpManager::cReliableChannelCount; i++) @@ -1385,7 +1385,7 @@ void UdpConnection::InternalDisconnect(int flushTimeout, DisconnectReason reason if (mStatus == cStatusNegotiating) flushTimeout = 0; - if (mUdpManager != nullptr) + if (mUdpManager != NULL) { if (flushTimeout > 0) { @@ -1415,13 +1415,13 @@ void UdpConnection::InternalDisconnect(int flushTimeout, DisconnectReason reason } mUdpManager->RemoveConnection(this); - mUdpManager = nullptr; + mUdpManager = NULL; } mStatus = cStatusDisconnected; - if (startStatus != cStatusDisconnected && startUdpManager != nullptr) + if (startStatus != cStatusDisconnected && startUdpManager != NULL) { - if (mHandler != nullptr) + if (mHandler != NULL) mHandler->OnTerminated(this); } } @@ -1455,7 +1455,7 @@ bool UdpConnection::Send(UdpChannel channel, const void *data, int dataLen) if (dataLen == 0) // zero length packets are ignored return(false); - assert(data != nullptr); // can't send a nullptr packet + assert(data != NULL); // can't send a null packet mUdpManager->mManagerStats.applicationPacketsSent++; mConnectionStats.applicationPacketsSent++; @@ -1472,7 +1472,7 @@ bool UdpConnection::Send(UdpChannel channel, const void *data, int dataLen) bool UdpConnection::Send(UdpChannel channel, const LogicalPacket *packet) { - assert(packet != nullptr); // can't send a nullptr packet + assert(packet != NULL); // can't send a null packet assert(channel >= 0 && channel < cUdpChannelCount); assert(mStatus != cStatusNegotiating); // you are not allowed to start sending data on a connection that is still in the process of negotiating (only applicable client-side obviously since servers never have connections in this state) @@ -1518,7 +1518,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const uchar *data, int data { uchar *bufPtr = tempBuffer; memcpy(bufPtr, data, dataLen); - if (data2 != nullptr) + if (data2 != NULL) memcpy(bufPtr + dataLen, data2, dataLen2); PhysicalSend(bufPtr, totalDataLen, true); return(true); @@ -1531,9 +1531,9 @@ bool UdpConnection::InternalSend(UdpChannel channel, const uchar *data, int data bufPtr[1] = cUdpPacketOrdered2; UdpMisc::PutValue16(bufPtr + 2, (ushort)(++mOrderedCountOutgoing2 & 0xffff)); memcpy(bufPtr + 4, data, dataLen); - if (data2 != nullptr) + if (data2 != NULL) memcpy(bufPtr + 4 + dataLen, data2, dataLen2); - BufferedSend(bufPtr, totalDataLen + 4, nullptr, 0, true); + BufferedSend(bufPtr, totalDataLen + 4, NULL, 0, true); return(true); break; } @@ -1544,7 +1544,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const uchar *data, int data bufPtr[1] = cUdpPacketOrdered2; UdpMisc::PutValue16(bufPtr + 2, (ushort)(++mOrderedCountOutgoing2 & 0xffff)); memcpy(bufPtr + 4, data, dataLen); - if (data2 != nullptr) + if (data2 != NULL) memcpy(bufPtr + 4 + dataLen, data2, dataLen2); PhysicalSend(bufPtr, totalDataLen + 4, true); return(true); @@ -1556,7 +1556,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const uchar *data, int data case cUdpChannelReliable4: { int num = channel - cUdpChannelReliable1; - if (mChannel[num] == nullptr) + if (mChannel[num] == NULL) mChannel[num] = new UdpReliableChannel(num, this, &mUdpManager->mParams.reliable[num]); mChannel[num]->Send(data, dataLen, data2, dataLen2); return(true); @@ -1578,7 +1578,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const LogicalPacket *packet case cUdpChannelReliable4: { int num = channel - cUdpChannelReliable1; - if (mChannel[num] == nullptr) + if (mChannel[num] == NULL) mChannel[num] = new UdpReliableChannel(num, this, &mUdpManager->mParams.reliable[num]); mChannel[num]->Send(packet); return(true); @@ -1618,9 +1618,9 @@ void UdpConnection::PingStatReset() void UdpConnection::GetStats(UdpConnectionStatistics *cs) const { - assert(cs != nullptr); + assert(cs != NULL); - if (mUdpManager == nullptr) + if (mUdpManager == NULL) return; *cs = mConnectionStats; @@ -1636,13 +1636,13 @@ void UdpConnection::GetStats(UdpConnectionStatistics *cs) const if (cs->syncTheirSent > 0) cs->percentReceivedSuccess = (float)cs->syncOurReceived / (float)cs->syncTheirSent; cs->reliableAveragePing = 0; - if (mChannel[0] != nullptr) + if (mChannel[0] != NULL) cs->reliableAveragePing = mChannel[0]->GetAveragePing(); } void UdpConnection::ProcessRawPacket(const UdpManager::PacketHistoryEntry *e) { - if (mUdpManager == nullptr) + if (mUdpManager == NULL) return; if (e->mBuffer[0] != 0 || e->mBuffer[1] != cUdpPacketUnreachableConnection) @@ -1744,7 +1744,7 @@ void UdpConnection::ProcessRawPacket(const UdpManager::PacketHistoryEntry *e) { mConnectionStats.crcRejectedPackets++; mUdpManager->mManagerStats.crcRejectedPackets++; - if (mHandler != nullptr) + if (mHandler != NULL) mHandler->OnCrcReject(this, e->mBuffer, e->mLen); return; } @@ -1771,7 +1771,7 @@ void UdpConnection::ProcessRawPacket(const UdpManager::PacketHistoryEntry *e) *decryptPtr++ = finalStart[1]; int len = (this->*(mDecryptFunction[j]))(decryptPtr, finalStart + 2, finalLen - 2); - if (mUdpManager == nullptr) + if (mUdpManager == NULL) return; if (len == -1) @@ -1808,7 +1808,7 @@ void UdpConnection::CallbackRoutePacket(const uchar *data, int dataLen) mUdpManager->mManagerStats.applicationPacketsReceived++; mConnectionStats.applicationPacketsReceived++; - if (mHandler != nullptr) + if (mHandler != NULL) mHandler->OnRoutePacket(this, data, dataLen); } } @@ -1819,7 +1819,7 @@ void UdpConnection::CallbackCorruptPacket(const uchar *data, int dataLen, UdpCor { mConnectionStats.corruptPacketErrors++; mUdpManager->mManagerStats.corruptPacketErrors++; - if (mHandler != nullptr) + if (mHandler != NULL) mHandler->OnPacketCorrupt(this, data, dataLen, reason); } } @@ -1828,7 +1828,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) { uchar buf[256]; uchar *bufPtr; - if (mUdpManager == nullptr) + if (mUdpManager == NULL) return; if (data[0] == 0 && dataLen > 1) @@ -1912,7 +1912,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) mOtherSideProtocolVersion = otherSideProtocolVersion; SetupEncryptModel(); mStatus = cStatusConnected; - if (mHandler != nullptr) + if (mHandler != NULL) mHandler->OnConnectComplete(this); } break; @@ -2028,7 +2028,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) // (while processing this packet) ended up touching the packet-data and corrupting the next // packet in the multi-sequence. CallbackCorruptPacket(data, dataLen, cUdpCorruptionMultiPacket); - if (mUdpManager == nullptr) + if (mUdpManager == NULL) return; } else @@ -2144,7 +2144,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) case cUdpPacketFragment4: { int num = (data[1] - cUdpPacketReliable1) % UdpManager::cReliableChannelCount; - if (mChannel[num] == nullptr) + if (mChannel[num] == NULL) mChannel[num] = new UdpReliableChannel(num, this, &mUdpManager->mParams.reliable[num]); mChannel[num]->ReliablePacket(data, dataLen); break; @@ -2155,7 +2155,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) case cUdpPacketAck4: { int num = data[1] - cUdpPacketAck1; - if (mChannel[num] != nullptr) + if (mChannel[num] != NULL) mChannel[num]->AckPacket(data, dataLen); break; } @@ -2165,7 +2165,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) case cUdpPacketAckAll4: { int num = data[1] - cUdpPacketAckAll1; - if (mChannel[num] != nullptr) + if (mChannel[num] != NULL) mChannel[num]->AckAllPacket(data, dataLen); break; } @@ -2205,7 +2205,7 @@ void UdpConnection::FlagPortUnreachable() void UdpConnection::GiveTime() { - if (mUdpManager == nullptr) + if (mUdpManager == NULL) return; UdpManager *myManager = mUdpManager; @@ -2298,11 +2298,11 @@ void UdpConnection::InternalGiveTime() int totalPendingBytes = 0; for (int i = 0; i < UdpManager::cReliableChannelCount; i++) { - if (mChannel[i] != nullptr) + if (mChannel[i] != NULL) { totalPendingBytes += mChannel[i]->TotalPendingBytes(); int myNext = mChannel[i]->GiveTime(); - if (mUdpManager == nullptr) + if (mUdpManager == NULL) return; // giving the reliable channel time caused it to callback the application which may disconnect us nextSchedule = udpMin(nextSchedule, myNext); } @@ -2391,7 +2391,7 @@ void UdpConnection::InternalGiveTime() break; } - if (mUdpManager != nullptr) + if (mUdpManager != NULL) { // safety to prevent us for scheduling ourselves for a time period that has already passed, // as doing so could result in infinite looping in the priority queue processing. @@ -2408,7 +2408,7 @@ int UdpConnection::TotalPendingBytes() const int total = 0; for (int i = 0; i < UdpManager::cReliableChannelCount; i++) { - if (mChannel[i] != nullptr) + if (mChannel[i] != NULL) total += mChannel[i]->TotalPendingBytes(); } return(total); @@ -2474,7 +2474,7 @@ int UdpConnection::ExpireReceiveBin() void UdpConnection::PhysicalSend(const uchar *data, int dataLen, bool appendAllowed) { - if (mUdpManager == nullptr) + if (mUdpManager == NULL) return; // if we attempt to do a physical send (ie. encrypt/compress/crc a packet) while we are not connected @@ -2503,7 +2503,7 @@ void UdpConnection::PhysicalSend(const uchar *data, int dataLen, bool appendAllo // we know this internal packet will not be a connect or confirm packet since they are sent directly to RawSend to avoid getting encrypted *destPtr++ = finalStart[1]; int len = (this->*(mEncryptFunction[j]))(destPtr, finalStart + 2, finalLen - 2); - if (mUdpManager == nullptr) + if (mUdpManager == NULL) return; // if this assert triggers, it means the encryption pass expanded the size of the encrypted @@ -2574,8 +2574,8 @@ void UdpConnection::PhysicalSend(const uchar *data, int dataLen, bool appendAllo // function can do its job uchar *UdpConnection::BufferedSend(const uchar *data, int dataLen, const uchar *data2, int dataLen2, bool appendAllowed) { - if (mUdpManager == nullptr) - return(nullptr); + if (mUdpManager == NULL) + return(NULL); int used = mMultiBufferPtr - mMultiBufferData; int actualMaxDataHoldSize = udpMin(mUdpManager->mParams.maxDataHoldSize, mConnectionConfig.maxRawPacketSize); @@ -2590,7 +2590,7 @@ uchar *UdpConnection::BufferedSend(const uchar *data, int dataLen, const uchar * FlushMultiBuffer(); // now send it (the multi-buffer is empty if you need to use it temporarily to concatenate two data chunks -- it is large enough to hold the largest raw packet) - if (data2 != nullptr) + if (data2 != NULL) { memcpy(mMultiBufferData, data, dataLen); memcpy(mMultiBufferData + dataLen, data2, dataLen2); @@ -2598,7 +2598,7 @@ uchar *UdpConnection::BufferedSend(const uchar *data, int dataLen, const uchar * } else PhysicalSend(data, dataLen, appendAllowed); - return(nullptr); + return(NULL); } // if this data will not fit into buffer @@ -2626,7 +2626,7 @@ uchar *UdpConnection::BufferedSend(const uchar *data, int dataLen, const uchar * uchar *placementPtr = mMultiBufferPtr; memcpy(mMultiBufferPtr, data, dataLen); mMultiBufferPtr += dataLen; - if (data2 != nullptr) + if (data2 != NULL) { memcpy(mMultiBufferPtr, data2, dataLen2); mMultiBufferPtr += dataLen2; @@ -2635,21 +2635,21 @@ uchar *UdpConnection::BufferedSend(const uchar *data, int dataLen, const uchar * if ((mMultiBufferPtr - mMultiBufferData) >= actualMaxDataHoldSize) { FlushMultiBuffer(); - placementPtr = nullptr; // it got flushed + placementPtr = NULL; // it got flushed } return(placementPtr); } uchar *UdpConnection::InternalAckSend(uchar *bufferedAckPtr, const uchar *ackPtr, int ackLen) { - if (bufferedAckPtr != nullptr) + if (bufferedAckPtr != NULL) { memcpy(bufferedAckPtr, ackPtr, ackLen); return(bufferedAckPtr); } - BufferedSend(ackPtr, ackLen, nullptr, 0, false); - return(nullptr); // FIX THIS + BufferedSend(ackPtr, ackLen, NULL, 0, false); + return(NULL); // FIX THIS } void UdpConnection::FlushMultiBuffer() @@ -2665,7 +2665,7 @@ void UdpConnection::FlushMultiBuffer() // notify all the reliable channels to clear their buffered acks for (int i = 0; i < UdpManager::cReliableChannelCount; i++) { - if (mChannel[i] != nullptr) + if (mChannel[i] != NULL) { mChannel[i]->ClearBufferedAck(); } @@ -2689,7 +2689,7 @@ int UdpConnection::DecryptNone(uchar *destData, const uchar *sourceData, int sou int UdpConnection::EncryptUserSupplied(uchar *destData, const uchar *sourceData, int sourceLen) { UdpManagerHandler *manHandler = mUdpManager->GetHandler(); - if (manHandler != nullptr) + if (manHandler != NULL) return(manHandler->OnUserSuppliedEncrypt(this, destData, sourceData, sourceLen)); assert(0); // if user-supplied encryption is specified, then you must have a manager handler installed to provide the routines return(0); @@ -2698,7 +2698,7 @@ int UdpConnection::EncryptUserSupplied(uchar *destData, const uchar *sourceData, int UdpConnection::DecryptUserSupplied(uchar *destData, const uchar *sourceData, int sourceLen) { UdpManagerHandler *manHandler = mUdpManager->GetHandler(); - if (manHandler != nullptr) + if (manHandler != NULL) return(manHandler->OnUserSuppliedDecrypt(this, destData, sourceData, sourceLen)); assert(0); // if user-supplied encryption is specified, then you must have a manager handler installed to provide the routines return(0); @@ -2707,7 +2707,7 @@ int UdpConnection::DecryptUserSupplied(uchar *destData, const uchar *sourceData, int UdpConnection::EncryptUserSupplied2(uchar *destData, const uchar *sourceData, int sourceLen) { UdpManagerHandler *manHandler = mUdpManager->GetHandler(); - if (manHandler != nullptr) + if (manHandler != NULL) return(manHandler->OnUserSuppliedEncrypt2(this, destData, sourceData, sourceLen)); assert(0); // if user-supplied encryption is specified, then you must have a manager handler installed to provide the routines return(0); @@ -2716,7 +2716,7 @@ int UdpConnection::EncryptUserSupplied2(uchar *destData, const uchar *sourceData int UdpConnection::DecryptUserSupplied2(uchar *destData, const uchar *sourceData, int sourceLen) { UdpManagerHandler *manHandler = mUdpManager->GetHandler(); - if (manHandler != nullptr) + if (manHandler != NULL) return(manHandler->OnUserSuppliedDecrypt2(this, destData, sourceData, sourceLen)); assert(0); // if user-supplied encryption is specified, then you must have a manager handler installed to provide the routines return(0); @@ -2866,7 +2866,7 @@ void UdpConnection::SetupEncryptModel() mEncryptExpansionBytes += 0; // set up encrypt buffer (random numbers generated based on seed) - if (mEncryptXorBuffer == nullptr) + if (mEncryptXorBuffer == NULL) { int len = ((mUdpManager->mParams.maxRawPacketSize + 1) / 4) * 4; mEncryptXorBuffer = new uchar[len]; @@ -2898,7 +2898,7 @@ void UdpConnection::GetChannelStatus(UdpChannel channel, ChannelStatus *channelS case cUdpChannelReliable2: case cUdpChannelReliable3: case cUdpChannelReliable4: - if (mChannel[channel - cUdpChannelReliable1] != nullptr) + if (mChannel[channel - cUdpChannelReliable1] != NULL) { mChannel[channel - cUdpChannelReliable1]->GetChannelStatus(channelStatus); } @@ -2975,12 +2975,12 @@ UdpReliableChannel::UdpReliableChannel(int channelNumber, UdpConnection *con, Ud mLogicalPacketsQueued = 0; mLogicalBytesQueued = 0; - mCoalescePacket = nullptr; - mCoalesceStartPtr = nullptr; - mCoalesceEndPtr = nullptr; + mCoalescePacket = NULL; + mCoalesceStartPtr = NULL; + mCoalesceEndPtr = NULL; mCoalesceCount = 0; - mBufferedAckPtr = nullptr; + mBufferedAckPtr = NULL; mStatDuplicatePacketsReceived = 0; mStatResentPacketsAccelerated = 0; @@ -2994,7 +2994,7 @@ UdpReliableChannel::UdpReliableChannel(int channelNumber, UdpConnection *con, Ud mBigDataLen = 0; mBigDataTargetLen = 0; - mBigDataPtr = nullptr; + mBigDataPtr = NULL; mFragmentNextPos = 0; mLastTimeStampAcknowledged = 0; mMaxxedOutCurrentWindow = false; @@ -3003,23 +3003,23 @@ UdpReliableChannel::UdpReliableChannel(int channelNumber, UdpConnection *con, Ud mPhysicalPackets = new PhysicalPacket[mConfig.maxOutstandingPackets]; mReliableIncoming = new IncomingQueueEntry[mConfig.maxInstandingPackets]; - mLogicalRoot = nullptr; - mLogicalEnd = nullptr; + mLogicalRoot = NULL; + mLogicalEnd = NULL; } UdpReliableChannel::~UdpReliableChannel() { - if (mCoalescePacket != nullptr) + if (mCoalescePacket != NULL) { mCoalescePacket->Release(); - mCoalescePacket = nullptr; + mCoalescePacket = NULL; } const LogicalPacket *cur = mLogicalRoot; - while (cur != nullptr) + while (cur != NULL) { const LogicalPacket *next = cur->mReliableQueueNext; - cur->mReliableQueueNext = nullptr; // make sure and mark it available so others could possibly use it (if it is a shared logical packet) + cur->mReliableQueueNext = NULL; // make sure and mark it available so others could possibly use it (if it is a shared logical packet) cur->Release(); if (cur == next) // pointing to self, so this is end of list break; @@ -3035,7 +3035,7 @@ UdpReliableChannel::~UdpReliableChannel() void UdpReliableChannel::Send(const uchar *data, int dataLen, const uchar *data2, int dataLen2) { - if (mLogicalPacketsQueued == 0 && mCoalescePacket == nullptr) + if (mLogicalPacketsQueued == 0 && mCoalescePacket == NULL) { // if we are adding something to a previously empty logical queue, then it is possible that // we may be able to send it, so mark ourselves to take time the next time it is offered @@ -3086,7 +3086,7 @@ void UdpReliableChannel::Send(const LogicalPacket *packet) void UdpReliableChannel::FlushCoalesce() { - if (mCoalescePacket != nullptr) + if (mCoalescePacket != NULL) { if (mCoalesceCount == 1) { @@ -3103,16 +3103,16 @@ void UdpReliableChannel::FlushCoalesce() } mCoalescePacket->Release(); - mCoalescePacket = nullptr; + mCoalescePacket = NULL; } } void UdpReliableChannel::SendCoalesce(const uchar *data, int dataLen, const uchar *data2, int dataLen2) { int totalLen = dataLen + dataLen2; - if (mCoalescePacket == nullptr) + if (mCoalescePacket == NULL) { - mCoalescePacket = mUdpConnection->mUdpManager->CreatePacket(nullptr, mMaxDataBytes); + mCoalescePacket = mUdpConnection->mUdpManager->CreatePacket(NULL, mMaxDataBytes); mCoalesceEndPtr = mCoalesceStartPtr = (uchar *)mCoalescePacket->GetDataPtr(); *mCoalesceEndPtr++ = 0; *mCoalesceEndPtr++ = UdpConnection::cUdpPacketGroup; @@ -3132,10 +3132,10 @@ void UdpReliableChannel::SendCoalesce(const uchar *data, int dataLen, const ucha // append on end of coalesce mCoalesceCount++; mCoalesceEndPtr += UdpMisc::PutVariableValue(mCoalesceEndPtr, totalLen); - if (data != nullptr) + if (data != NULL) memcpy(mCoalesceEndPtr, data, dataLen); mCoalesceEndPtr += dataLen; - if (data2 != nullptr) + if (data2 != NULL) memcpy(mCoalesceEndPtr, data2, dataLen2); mCoalesceEndPtr += dataLen2; } @@ -3145,7 +3145,7 @@ void UdpReliableChannel::QueueLogicalPacket(const LogicalPacket *packet) mLogicalPacketsQueued++; mLogicalBytesQueued += packet->GetDataLen(); - if (packet->mReliableQueueNext != nullptr) + if (packet->mReliableQueueNext != NULL) { packet = mUdpConnection->mUdpManager->WrappedBorrow(packet); } @@ -3155,13 +3155,13 @@ void UdpReliableChannel::QueueLogicalPacket(const LogicalPacket *packet) } packet->mReliableQueueNext = packet; // have it point to itself to signify that the mNext pointer is taken (ie. reserve it), yet still represents the end of the list - if (mLogicalEnd != nullptr) + if (mLogicalEnd != NULL) { mLogicalEnd->mReliableQueueNext = packet; } mLogicalEnd = packet; - if (mLogicalRoot == nullptr) + if (mLogicalRoot == NULL) { mLogicalRoot = packet; } @@ -3182,10 +3182,10 @@ bool UdpReliableChannel::PullDown(int windowSpaceLeft) int physicalCount = (int)(mReliableOutgoingId - mReliableOutgoingPendingId); while (windowSpaceLeft > 0 && physicalCount < mConfig.maxOutstandingPackets) { - if (mLogicalRoot == nullptr) + if (mLogicalRoot == NULL) { FlushCoalesce(); // this is guaranteed to stick - if (mLogicalRoot == nullptr) + if (mLogicalRoot == NULL) break; // nothing flushed, so we are done } @@ -3225,10 +3225,10 @@ bool UdpReliableChannel::PullDown(int windowSpaceLeft) mLogicalRoot = mLogicalRoot->mReliableQueueNext; if (mLogicalRoot == lp) // ie, we were pointing to ourself, meaning we were the end of the list { - mLogicalRoot = nullptr; - mLogicalEnd = nullptr; + mLogicalRoot = NULL; + mLogicalEnd = NULL; } - lp->mReliableQueueNext = nullptr; // clear our next link since we are no longer using it (so somebody else can use it potentially) + lp->mReliableQueueNext = NULL; // clear our next link since we are no longer using it (so somebody else can use it potentially) lp->Release(); // release from logical queue } else @@ -3279,7 +3279,7 @@ int UdpReliableChannel::GiveTime() mMaxxedOutCurrentWindow = false; int outstandingNextSendTime = 10 * 60000; // if we have something to do - if (mReliableOutgoingPendingId < mReliableOutgoingId || mLogicalRoot != nullptr || mCoalescePacket != nullptr) + if (mReliableOutgoingPendingId < mReliableOutgoingId || mLogicalRoot != NULL || mCoalescePacket != NULL) { // first, let's calculate how many bytes we figure is outstanding based on who is still waiting for an ack-packet UdpMisc::ClockStamp oldestResendTime = udpMax(hotClock - optimalResendDelay, mLastTimeStampAcknowledged); // anything older than this, we need to resend @@ -3304,7 +3304,7 @@ int UdpReliableChannel::GiveTime() // if this packet has not been acked and it is NOT ready to be sent (was recently sent) then we consider it outstanding // note: packets needing re-sending probably got lost and are therefore not outstanding PhysicalPacket *entry = &mPhysicalPackets[i % mConfig.maxOutstandingPackets]; - if (entry->mDataPtr != nullptr) // acked packets set the dataPtr to nullptr + if (entry->mDataPtr != NULL) // acked packets set the dataPtr to NULL { // if this packet is ready to be sent (ie: needs time now, or some later packet has already been ack'ed) windowSpaceLeft -= entry->mDataLen; // window-space is effectively taken whether we have sent it yet or not @@ -3464,7 +3464,7 @@ int UdpReliableChannel::GiveTime() void UdpReliableChannel::GetChannelStatus(UdpConnection::ChannelStatus *channelStatus) const { int coalesceBytes = 0; - if (mCoalescePacket != nullptr) + if (mCoalescePacket != NULL) coalesceBytes = mCoalesceEndPtr - mCoalesceStartPtr; channelStatus->totalPendingBytes = mLogicalBytesQueued + mReliableOutgoingBytes + coalesceBytes; @@ -3525,7 +3525,7 @@ void UdpReliableChannel::ReliablePacket(const uchar *data, int dataLen) mReliableIncomingId++; // process other packets that have arrived - while (mReliableIncoming[mReliableIncomingId % mConfig.maxInstandingPackets].mPacket != nullptr) + while (mReliableIncoming[mReliableIncomingId % mConfig.maxInstandingPackets].mPacket != NULL) { int spot = (int)(mReliableIncomingId % mConfig.maxInstandingPackets); if (mReliableIncoming[spot].mMode != cReliablePacketModeDelivered) @@ -3534,7 +3534,7 @@ void UdpReliableChannel::ReliablePacket(const uchar *data, int dataLen) } mReliableIncoming[spot].mPacket->Release(); - mReliableIncoming[spot].mPacket = nullptr; + mReliableIncoming[spot].mPacket = NULL; mReliableIncomingId++; } } @@ -3542,7 +3542,7 @@ void UdpReliableChannel::ReliablePacket(const uchar *data, int dataLen) { // not the one we need next, but it is later than the one we need , so store it in our buffer until it's turn comes up int spot = (int)(reliableId % mConfig.maxInstandingPackets); - if (mReliableIncoming[spot].mPacket == nullptr) // only make the copy of it if we don't already have it in our buffer (in cases where it was sent twice, there would be no harm in the copy again since it must be the same packet, it's just inefficient) + if (mReliableIncoming[spot].mPacket == NULL) // only make the copy of it if we don't already have it in our buffer (in cases where it was sent twice, there would be no harm in the copy again since it must be the same packet, it's just inefficient) { mReliableIncoming[spot].mMode = mode; mReliableIncoming[spot].mPacket = mUdpConnection->mUdpManager->CreatePacket(data + UdpConnection::cUdpPacketReliableSize, dataLen - UdpConnection::cUdpPacketReliableSize); @@ -3584,16 +3584,16 @@ void UdpReliableChannel::ReliablePacket(const uchar *data, int dataLen) // a simple ack for us only *bufPtr++ = (uchar)(UdpConnection::cUdpPacketAck1 + mChannelNumber); bufPtr += UdpMisc::PutValue16(bufPtr, (ushort)(reliableId & 0xffff)); - mBufferedAckPtr = nullptr; // not allowed to replace an old one with a selective-ack + mBufferedAckPtr = NULL; // not allowed to replace an old one with a selective-ack } - if (mBufferedAckPtr != nullptr && mConfig.ackDeduping) + if (mBufferedAckPtr != NULL && mConfig.ackDeduping) { memcpy(mBufferedAckPtr, buf, bufPtr - buf); } else { - mBufferedAckPtr = mUdpConnection->BufferedSend(buf, bufPtr - buf, nullptr, 0, true); // safe to append on our data, it is stack data + mBufferedAckPtr = mUdpConnection->BufferedSend(buf, bufPtr - buf, NULL, 0, true); // safe to append on our data, it is stack data } } @@ -3610,7 +3610,7 @@ void UdpReliableChannel::ProcessPacket(ReliablePacketMode mode, const uchar *dat else if (mode == cReliablePacketModeFragment) { // append onto end of big packet (or create new big packet if not existing already) - if (mBigDataPtr == nullptr) + if (mBigDataPtr == NULL) { mBigDataTargetLen = UdpMisc::GetValue32(data); // first fragment has a total-length int header on it. mBigDataPtr = new uchar[mBigDataTargetLen]; @@ -3633,7 +3633,7 @@ void UdpReliableChannel::ProcessPacket(ReliablePacketMode mode, const uchar *dat delete[] mBigDataPtr; mBigDataLen = 0; mBigDataTargetLen = 0; - mBigDataPtr = nullptr; + mBigDataPtr = NULL; } } } @@ -3663,7 +3663,7 @@ void UdpReliableChannel::Ack(udp_int64 reliableId) int pos = (int)(reliableId % mConfig.maxOutstandingPackets); PhysicalPacket *entry = &mPhysicalPackets[pos]; - if (entry->mDataPtr != nullptr) // if this packet has not been acknowledged yet (sometimes we get back two acks for the same packet) + if (entry->mDataPtr != NULL) // if this packet has not been acknowledged yet (sometimes we get back two acks for the same packet) { mNextNeedTime = 0; // something got acked, so we actually need to take the time next time it is offered @@ -3721,14 +3721,14 @@ void UdpReliableChannel::Ack(udp_int64 reliableId) // this packet we have queued has been acknowledged, so delete it from queue mReliableOutgoingBytes -= entry->mDataLen; entry->mDataLen = 0; - entry->mDataPtr = nullptr; + entry->mDataPtr = NULL; entry->mParent->Release(); - entry->mParent = nullptr; + entry->mParent = NULL; // advance the pending ptr until it reaches outgoingId or an entry that has yet to acknowledged while (mReliableOutgoingPendingId < mReliableOutgoingId) { - if (mPhysicalPackets[mReliableOutgoingPendingId % mConfig.maxOutstandingPackets].mDataPtr != nullptr) + if (mPhysicalPackets[mReliableOutgoingPendingId % mConfig.maxOutstandingPackets].mDataPtr != NULL) break; mReliableOutgoingPendingId++; } @@ -3750,25 +3750,25 @@ void UdpReliableChannel::Ack(udp_int64 reliableId) UdpReliableChannel::IncomingQueueEntry::IncomingQueueEntry() { - mPacket = nullptr; + mPacket = NULL; mMode = UdpReliableChannel::cReliablePacketModeReliable; } UdpReliableChannel::IncomingQueueEntry::~IncomingQueueEntry() { - if (mPacket != nullptr) + if (mPacket != NULL) mPacket->Release(); } UdpReliableChannel::PhysicalPacket::PhysicalPacket() { - mParent = nullptr; + mParent = NULL; } UdpReliableChannel::PhysicalPacket::~PhysicalPacket() { - if (mParent != nullptr) + if (mParent != NULL) mParent->Release(); } @@ -3780,7 +3780,7 @@ UdpReliableChannel::PhysicalPacket::~PhysicalPacket() LogicalPacket::LogicalPacket() { mRefCount = 1; - mReliableQueueNext = nullptr; + mReliableQueueNext = NULL; } LogicalPacket::~LogicalPacket() @@ -3815,7 +3815,7 @@ SimpleLogicalPacket::SimpleLogicalPacket(const void *data, int dataLen) { mDataLen = dataLen; mData = new uchar[mDataLen]; - if (data != nullptr) + if (data != NULL) memcpy(mData, data, mDataLen); } @@ -3850,7 +3850,7 @@ void SimpleLogicalPacket::SetDataLen(int len) GroupLogicalPacket::GroupLogicalPacket() : LogicalPacket() { mDataLen = 0; - mData = nullptr; + mData = NULL; } GroupLogicalPacket::~GroupLogicalPacket() @@ -3860,13 +3860,13 @@ GroupLogicalPacket::~GroupLogicalPacket() void GroupLogicalPacket::AddPacket(const LogicalPacket *packet) { - assert(packet != nullptr); + assert(packet != NULL); AddPacketInternal(packet->GetDataPtr(), packet->GetDataLen(), packet->IsInternalPacket()); } void GroupLogicalPacket::AddPacket(const void *data, int dataLen) { - assert(data != nullptr); + assert(data != NULL); assert(dataLen >= 0); AddPacketInternal(data, dataLen, false); } @@ -3932,16 +3932,16 @@ PooledLogicalPacket::PooledLogicalPacket(UdpManager *manager, int len) mDataLen = 0; mUdpManager = manager; - mAvailableNext = nullptr; - mCreatedNext = nullptr; - mCreatedPrev = nullptr; + mAvailableNext = NULL; + mCreatedNext = NULL; + mCreatedPrev = NULL; mUdpManager->PoolCreated(this); } PooledLogicalPacket::~PooledLogicalPacket() { - if (mUdpManager != nullptr) + if (mUdpManager != NULL) { mUdpManager->PoolDestroyed(this); } @@ -3956,7 +3956,7 @@ void PooledLogicalPacket::AddRef() const void PooledLogicalPacket::Release() const { - if (mRefCount == 1 && mUdpManager != nullptr) + if (mRefCount == 1 && mUdpManager != NULL) mUdpManager->PoolReturn(const_cast(this)); // if pool wants to keep us, it will inc our ref count, preventing our destruction // we cast off our const, as when we are added back to the pool, we can be modified LogicalPacket::Release(); @@ -3986,9 +3986,9 @@ void PooledLogicalPacket::SetDataLen(int len) void PooledLogicalPacket::SetData(const void *data, int dataLen, const void *data2, int dataLen2) { mDataLen = dataLen + dataLen2; - if (data != nullptr) + if (data != NULL) memcpy(mData, data, dataLen); - if (data2 != nullptr) + if (data2 != NULL) memcpy(mData + dataLen, data2, dataLen2); } @@ -3999,23 +3999,23 @@ void PooledLogicalPacket::SetData(const void *data, int dataLen, const void *dat /////////////////////////////////////////////////////////////////////////////////////////// WrappedLogicalPacket::WrappedLogicalPacket(UdpManager *udpManager) { - mPacket = nullptr; + mPacket = NULL; mUdpManager = udpManager; - mAvailableNext = nullptr; - mCreatedNext = nullptr; - mCreatedPrev = nullptr; + mAvailableNext = NULL; + mCreatedNext = NULL; + mCreatedPrev = NULL; mUdpManager->WrappedCreated(this); } WrappedLogicalPacket::~WrappedLogicalPacket() { - if (mUdpManager != nullptr) + if (mUdpManager != NULL) { mUdpManager->WrappedDestroyed(this); } - if (mPacket != nullptr) + if (mPacket != NULL) { mPacket->Release(); } @@ -4028,7 +4028,7 @@ void WrappedLogicalPacket::AddRef() const void WrappedLogicalPacket::Release() const { - if (mRefCount == 1 && mUdpManager != nullptr) + if (mRefCount == 1 && mUdpManager != NULL) mUdpManager->WrappedReturn(const_cast(this)); // if pool wants to keep us, it will inc our ref count, preventing our destruction // we cast off our const, as when we are added back to the pool, we can be modified LogicalPacket::Release(); @@ -4036,10 +4036,10 @@ void WrappedLogicalPacket::Release() const void WrappedLogicalPacket::SetLogicalPacket(const LogicalPacket *packet) { - if (mPacket != nullptr) + if (mPacket != NULL) mPacket->Release(); mPacket = packet; - if (mPacket != nullptr) + if (mPacket != NULL) mPacket->AddRef(); } @@ -4075,7 +4075,7 @@ UdpManager::SimulateQueueEntry::SimulateQueueEntry(const uchar *data, int dataLe memcpy(mData, data, dataLen); mIp = ip; mPort = port; - mNext = nullptr; + mNext = NULL; } UdpManager::SimulateQueueEntry::~SimulateQueueEntry() @@ -4110,7 +4110,7 @@ UdpMisc::ClockStamp UdpMisc::Clock() static ClockStamp sLastStamp = 0; static ClockStamp sCurrentCorrection = 0; struct timeval tv; - gettimeofday(&tv, nullptr); + gettimeofday(&tv, NULL); UdpMisc::ClockStamp cs = static_cast(tv.tv_sec) * 1000 + static_cast(tv.tv_usec / 1000); cs += sCurrentCorrection; if (cs < sLastStamp) @@ -4226,19 +4226,19 @@ void *UdpMisc::SmartResize(void *ptr, int bytes, int round) if (bytes == 0) { - if (ptr != nullptr) + if (ptr != NULL) { free((uchar *)ptr - cAlignment); } - return(nullptr); + return(NULL); } uchar *ptr2; - if (ptr == nullptr) + if (ptr == NULL) { ptr2 = (uchar *)malloc(bytes + cAlignment); - if (ptr2 == nullptr) - return(nullptr); + if (ptr2 == NULL) + return(NULL); *(int *)ptr2 = bytes; return(ptr2 + cAlignment); } @@ -4248,8 +4248,8 @@ void *UdpMisc::SmartResize(void *ptr, int bytes, int round) return(ptr); ptr2 = (uchar *)realloc((uchar *)ptr - cAlignment, bytes + cAlignment); - if (ptr2 == nullptr) - return(nullptr); + if (ptr2 == NULL) + return(NULL); *(int *)ptr2 = bytes; return(ptr2 + cAlignment); @@ -4312,30 +4312,30 @@ LogicalPacket *UdpMisc::CreateQuickLogicalPacket(const void *data, int dataLen, switch(q) { case 0: - tlp = new FixedLogicalPacket(nullptr, totalDataLen); + tlp = new FixedLogicalPacket(NULL, totalDataLen); break; case 1: - tlp = new FixedLogicalPacket(nullptr, totalDataLen); + tlp = new FixedLogicalPacket(NULL, totalDataLen); break; case 2: case 3: - tlp = new FixedLogicalPacket(nullptr, totalDataLen); + tlp = new FixedLogicalPacket(NULL, totalDataLen); break; case 4: case 5: case 6: case 7: - tlp = new FixedLogicalPacket(nullptr, totalDataLen); + tlp = new FixedLogicalPacket(NULL, totalDataLen); break; default: - tlp = new SimpleLogicalPacket(nullptr, totalDataLen); + tlp = new SimpleLogicalPacket(NULL, totalDataLen); break; } uchar *dest = (uchar *)tlp->GetDataPtr(); - if (data != nullptr) + if (data != NULL) memcpy(dest, data, dataLen); - if (data2 != nullptr) + if (data2 != NULL) memcpy(dest + dataLen, data2, dataLen2); return(tlp); } @@ -4349,7 +4349,7 @@ UdpIpAddress UdpMisc::GetHostByName(const char *hostName) { struct hostent * lphp; lphp = gethostbyname(hostName); - if (lphp == nullptr) + if (lphp == NULL) { address = 0; } diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpLibrary.hpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpLibrary.hpp index 9db50e40..27fc28d1 100644 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpLibrary.hpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpLibrary.hpp @@ -150,7 +150,7 @@ class UdpMisc // memory manager does a little bit of this, but if you know you have an allocation that is likely // to grow quite a bit, you can set the round'ing size up to a fairly large number and avoid // unnecessary reallocs at the cost of a little potentially wasted space - // initial allocations are done by passing in ptr==nullptr, freeing is done by passing in bytes==0 + // initial allocations are done by passing in ptr==NULL, freeing is done by passing in bytes==0 static void *SmartResize(void *ptr, int bytes, int round = 1); // the following two functions store values in the buffer as a variable length (B1, 0xffB2B1, 0xffffffB4B3B2B1) @@ -170,7 +170,7 @@ class UdpMisc static uint GetValue24(const void *buffer); // gets a 24-bit value from the buffer in big-endian format static ushort GetValue16(const void *buffer); // gets a 16-bit value from the buffer in big-endian format - static LogicalPacket *CreateQuickLogicalPacket(const void *data, int dataLen, const void *data2 = nullptr, int dataLen2 = 0); + static LogicalPacket *CreateQuickLogicalPacket(const void *data, int dataLen, const void *data2 = NULL, int dataLen2 = 0); // looks up the specified name and translates it to an IP address // this is a blocking call that can at times take a significant amount of time, but will generally be fast (less than 300ms) @@ -243,7 +243,7 @@ class LogicalPacket protected: friend class UdpReliableChannel; mutable const LogicalPacket *mReliableQueueNext; // owned/managed by the reliable channel object as an optimizations, do not touch - // nullptr = unclaimed, point-to-self = claimed, but end of list + // NULL = unclaimed, point-to-self = claimed, but end of list }; class SimpleLogicalPacket : public LogicalPacket @@ -252,7 +252,7 @@ class SimpleLogicalPacket : public LogicalPacket // it was originally created to allow the internal code to handle reliable data that was sent // via the Send(char *, int) api call. public: - SimpleLogicalPacket(const void *data, int dataLen); // data can be nullptr if you want to populate it after it is allocated (get the pointer and write to it) + SimpleLogicalPacket(const void *data, int dataLen); // data can be NULL if you want to populate it after it is allocated (get the pointer and write to it) virtual void *GetDataPtr(); virtual const void *GetDataPtr() const; virtual int GetDataLen() const; @@ -323,7 +323,7 @@ template class StructLogicalPacket : public LogicalPacket // with virtual functions) via this method as they may contain hidden data-members (such as pointers // to vtables). public: - StructLogicalPacket(T *initData = nullptr); + StructLogicalPacket(T *initData = NULL); virtual void *GetDataPtr(); virtual const void *GetDataPtr() const; virtual int GetDataLen() const; @@ -396,7 +396,7 @@ class PooledLogicalPacket : public LogicalPacket int mMaxDataLen; protected: friend class UdpManager; - void SetData(const void *data, int dataLen, const void *data2 = nullptr, int dataLen2 = 0); + void SetData(const void *data, int dataLen, const void *data2 = NULL, int dataLen2 = 0); UdpManager *mUdpManager; PooledLogicalPacket *mAvailableNext; PooledLogicalPacket *mCreatedNext; @@ -476,7 +476,7 @@ class UdpManager // pointer equal to your object and the UdpManager will call it as appropriate. The UdpConnection object // also has a handler mechanism that replaces the other callback functions below, see UdpConnection::SetHandler // if a handler is specified, the callback function is ignored, even if specified. - // default = nullptr (not used) + // default = NULL (not used) UdpManagerHandler *handler; // this is the maximum number of connections that can be established by this manager, any incoming/outgoing connections @@ -901,7 +901,7 @@ class UdpManager // will call EstablishConnection, then sit in a loop calling UdpManager::GiveTime and checking to see // if the status of the returned UdpConnection object is changed from cStatusNegotiating. This allows // the application to look for the ESC key or timeout an attempted connection. - // This function will return nullptr if the manager object has exceeded its maximum number of connections + // This function will return NULL if the manager object has exceeded its maximum number of connections // or if the serverAddress cannot be resolved to an IP address // as is noted in the declaration, it is the responsibility of the application establishing the connection to delete it // setting the timeout value (in milliseconds) to something greater than 0 will cause the UdpConnection object to change @@ -933,13 +933,13 @@ class UdpManager // manually forces all live connections to flush their multi buffers immediately void FlushAllMultiBuffer(); - // creates a logical packet and populates it with data. data can be nullptr, in which case it gives you logical packet + // creates a logical packet and populates it with data. data can be NULL, in which case it gives you logical packet // of the size specified, but copies no data into it. If you are using pool management (see Params::poolPacketMax), // it will give you a packet out of the pool if possible, otherwise it will create a packet for you. When logical // are packets are needed internally for various things (like reliable channel sends that use the (void *, int) interface) // they are gotten from this function, so your application can likely take advantage of pooling, even if it never bothers // to explicitly call this function. - LogicalPacket *CreatePacket(const void *data, int dataLen, const void *data2 = nullptr, int dataLen2 = 0); + LogicalPacket *CreatePacket(const void *data, int dataLen, const void *data2 = NULL, int dataLen2 = 0); protected: friend class PooledLogicalPacket; @@ -1165,7 +1165,7 @@ class UdpConnection : public PriorityQueueMember, public AddressHashTableMember, int ConnectionAge() const; // returns the UdpManager object that is managing this connection - // will return nullptr if the connection has been disconnected for some reason (because disconnecting severes the link to UdpManager) + // will return NULL if the connection has been disconnected for some reason (because disconnecting severes the link to UdpManager) UdpManager *GetUdpManager() const; // returns the 32-bit encryption-code that was negotiated as part of the connection-establishment process. @@ -1245,9 +1245,9 @@ class UdpConnection : public PriorityQueueMember, public AddressHashTableMember, friend class UdpManager; friend class UdpReliableChannel; - // note: if connectPacket is nullptr, that means this connection object is being created to establish + // note: if connectPacket is NULL, that means this connection object is being created to establish // a new connection to the specified ip/port (ie. the connection starts out in cStatusNegotiating mode) - // if connectPacket is non-nullptr, that menas this connection object is being created to handle an + // if connectPacket is non-NULL, that menas this connection object is being created to handle an // incoming connect request and it will start out in cStatusConnected mode. UdpConnection(UdpManager *udpManager, UdpIpAddress destIp, int destPort, int timeout); // starts connection-establishment protocol UdpConnection(UdpManager *udpManager, const UdpManager::PacketHistoryEntry *e); // starts already connected, replying to connection request @@ -1282,7 +1282,7 @@ class UdpConnection : public PriorityQueueMember, public AddressHashTableMember, void PhysicalSend(const uchar *data, int dataLen, bool appendAllowed); // sends a physical packet (encrypts and adds crc bytes) uchar *BufferedSend(const uchar *data, int dataLen, const uchar *data2, int dataLen2, bool appendAllowed); // buffers logical packets waiting til we have more data (makes multi-packets) bool InternalSend(UdpChannel channel, const LogicalPacket *packet); - bool InternalSend(UdpChannel channel, const uchar *data, int dataLen, const uchar *data2 = nullptr, int dataLen2 = 0); + bool InternalSend(UdpChannel channel, const uchar *data, int dataLen, const uchar *data2 = NULL, int dataLen2 = 0); uchar *InternalAckSend(uchar *bufferedAckPtr, const uchar *ackPtr, int ackLen); // used by reliable channel to send acks (special send that allows for deduping ack feature) @@ -1573,7 +1573,7 @@ class UdpReliableChannel void ProcessPacket(ReliablePacketMode mode, const uchar *data, int dataLen); bool PullDown(int windowSpaceLeft); void FlushCoalesce(); - void SendCoalesce(const uchar *data, int dataLen, const uchar *data2 = nullptr, int dataLen2 = 0); + void SendCoalesce(const uchar *data, int dataLen, const uchar *data2 = NULL, int dataLen2 = 0); void QueueLogicalPacket(const LogicalPacket *packet); UdpManager::ReliableConfig mConfig; @@ -1627,7 +1627,7 @@ class UdpReliableChannel template FixedLogicalPacket::FixedLogicalPacket(const void *data, int dataLen) { mDataLen = dataLen; - if (data != nullptr) + if (data != NULL) memcpy(mData, data, mDataLen); } @@ -1657,7 +1657,7 @@ template void FixedLogicalPacket::SetDataLen(int l ///////////////////////////////////////////////////////////////////////// template StructLogicalPacket::StructLogicalPacket(T *initData) { - if (initData != nullptr) + if (initData != NULL) mStruct = *initData; } @@ -1802,7 +1802,7 @@ inline void UdpManager::SetPriority(UdpConnection *con, UdpMisc::ClockStamp stam if (stamp < mMinimumScheduledStamp) stamp = mMinimumScheduledStamp; - if (mPriorityQueue != nullptr) + if (mPriorityQueue != NULL) mPriorityQueue->Add(con, stamp); } @@ -1829,7 +1829,7 @@ inline void UdpManager::PoolReturn(PooledLogicalPacket *packet) inline void UdpManager::WrappedReturn(WrappedLogicalPacket *wp) { - wp->SetLogicalPacket(nullptr); + wp->SetLogicalPacket(NULL); if (mWrappedAvailable < mParams.wrappedPoolMax) { @@ -1877,7 +1877,7 @@ inline void UdpConnection::ScheduleTimeNow() // prevents us from reprioritizing to 0, only to shortly thereafter be reprioritized to where we actually belong. if (!mGettingTime) { - if (mUdpManager != nullptr) + if (mUdpManager != NULL) mUdpManager->SetPriority(this, 0); } } @@ -2066,7 +2066,7 @@ inline int UdpReliableChannel::TotalPendingBytes() const inline void UdpReliableChannel::ClearBufferedAck() { - mBufferedAckPtr = nullptr; + mBufferedAckPtr = NULL; } inline udp_int64 UdpReliableChannel::GetReliableOutgoingId(int reliableStamp) const diff --git a/external/3rd/library/udplibrary/PointerDeque.hpp b/external/3rd/library/udplibrary/PointerDeque.hpp index 8cc2ccc2..6124afd8 100644 --- a/external/3rd/library/udplibrary/PointerDeque.hpp +++ b/external/3rd/library/udplibrary/PointerDeque.hpp @@ -2,7 +2,7 @@ #define POINTERDEQUE_HPP // This is a simple double ended queue template. Any pointer-type can be stored in this deque - // I pop/peek return nullptr if the queue is empty. + // I pop/peek return NULL if the queue is empty. template class PointerDeque { public: @@ -32,7 +32,7 @@ template class PointerDeque template PointerDeque::PointerDeque(int entriesPerPage) { mEntriesPerPage = entriesPerPage; - mEntries = nullptr; + mEntries = NULL; mOffsetLeft = 0; mEntriesMax = 0; mEntriesCount = 0; @@ -73,7 +73,7 @@ template void PointerDeque::PushLeft(T* obj) template T* PointerDeque::PopLeft() { if (mEntriesCount == 0) - return(nullptr); + return(NULL); T* hold = mEntries[mOffsetLeft]; mOffsetLeft = (mOffsetLeft + 1) % mEntriesMax; mEntriesCount--; @@ -91,7 +91,7 @@ template void PointerDeque::PushRight(T* obj) template T* PointerDeque::PopRight() { if (mEntriesCount == 0) - return(nullptr); + return(NULL); mEntriesCount--; return(mEntries[(mOffsetLeft + mEntriesCount) % mEntriesMax]); } @@ -99,21 +99,21 @@ template T* PointerDeque::PopRight() template T* PointerDeque::PeekLeft() { if (mEntriesCount == 0) - return(nullptr); + return(NULL); return(mEntries[mOffsetLeft]); } template T* PointerDeque::PeekRight() { if (mEntriesCount == 0) - return(nullptr); + return(NULL); return(mEntries[(mOffsetLeft + mEntriesCount - 1) % mEntriesMax]); } template T* PointerDeque::Peek(int index) { if (index >= mEntriesCount) - return(nullptr); + return(NULL); return(mEntries[(mOffsetLeft + index) % mEntriesMax]); } diff --git a/external/3rd/library/udplibrary/UdpLibrary.cpp b/external/3rd/library/udplibrary/UdpLibrary.cpp index c8436157..a84e147d 100755 --- a/external/3rd/library/udplibrary/UdpLibrary.cpp +++ b/external/3rd/library/udplibrary/UdpLibrary.cpp @@ -144,7 +144,7 @@ UdpIpAddress::UdpIpAddress(unsigned int ip) char *UdpIpAddress::GetAddress(char *buffer) const { - assert(buffer != nullptr); + assert(buffer != NULL); struct sockaddr_in addr_serverUDP; addr_serverUDP.sin_addr.s_addr = mIp; @@ -157,7 +157,7 @@ char *UdpIpAddress::GetAddress(char *buffer) const ///////////////////////////////////////////////////////////////////////////////////////////////////// UdpManager::Params::Params() { - handler = nullptr; + handler = NULL; outgoingBufferSize = 64 * 1024; incomingBufferSize = 64 * 1024; packetHistoryMax = 100; @@ -258,7 +258,7 @@ UdpManager::UdpManager(const UdpManager::Params *params) mParams.maxDataHoldSize = udpMin(mParams.maxDataHoldSize, mParams.maxRawPacketSize); mParams.packetHistoryMax = udpMax(1, mParams.packetHistoryMax); mPacketHistoryPosition = 0; - mPassThroughData = nullptr; + mPassThroughData = NULL; typedef PacketHistoryEntry *PacketHistoryEntryPtr; mPacketHistory = new PacketHistoryEntryPtr[mParams.packetHistoryMax]; @@ -279,17 +279,17 @@ UdpManager::UdpManager(const UdpManager::Params *params) mUdpSocket = INVALID_SOCKET; mConnectionListCount = 0; - mConnectionList = nullptr; + mConnectionList = NULL; mPoolCreated = 0; mPoolAvailable = 0; - mPoolAvailableRoot = nullptr; - mPoolCreatedRoot = nullptr; + mPoolAvailableRoot = NULL; + mPoolCreatedRoot = NULL; mWrappedCreated = 0; mWrappedAvailable = 0; - mWrappedAvailableRoot = nullptr; - mWrappedCreatedRoot = nullptr; + mWrappedAvailableRoot = NULL; + mWrappedCreatedRoot = NULL; for (i = 0; i < mParams.pooledPacketInitial && i < mParams.pooledPacketMax; i++) { @@ -299,16 +299,16 @@ UdpManager::UdpManager(const UdpManager::Params *params) lp->Release(); } - mSimulateQueueStart = nullptr; - mSimulateQueueEnd = nullptr; + mSimulateQueueStart = NULL; + mSimulateQueueEnd = NULL; mSimulateNextOutgoingTime = 0; mSimulateNextIncomingTime = 0; mSimulateQueueBytes = 0; - mDisconnectPendingList = nullptr; + mDisconnectPendingList = NULL; if (mParams.avoidPriorityQueue) - mPriorityQueue = nullptr; + mPriorityQueue = NULL; else mPriorityQueue = new PriorityQueue(mParams.maxConnections); @@ -339,14 +339,14 @@ UdpManager::~UdpManager() // first we need to tell all the pooled packets we have created that they can no longer check themselves back into use // when they are released PooledLogicalPacket *walk = mPoolCreatedRoot; - while (walk != nullptr) + while (walk != NULL) { - walk->mUdpManager = nullptr; + walk->mUdpManager = NULL; walk = walk->mCreatedNext; } // next release the ones we have in our available pool walk = mPoolAvailableRoot; - while (walk != nullptr) + while (walk != NULL) { PooledLogicalPacket *hold = walk; walk = walk->mAvailableNext; @@ -359,14 +359,14 @@ UdpManager::~UdpManager() // next we need to tell all the warpped packets we have created that they can no longer check themselves back into use // when they are released WrappedLogicalPacket *walk = mWrappedCreatedRoot; - while (walk != nullptr) + while (walk != NULL) { - walk->mUdpManager = nullptr; + walk->mUdpManager = NULL; walk = walk->mCreatedNext; } // next release the ones we have in our available pool walk = mWrappedAvailableRoot; - while (walk != nullptr) + while (walk != NULL) { WrappedLogicalPacket *hold = walk; walk = walk->mAvailableNext; @@ -376,7 +376,7 @@ UdpManager::~UdpManager() // next thing we must do is tell all the connections to disconnect (which severs their link to this dying manager) // this has to be done first since they will call back into us and have themselves removed from our connection-list/priority-queue/etc - while (mConnectionList != nullptr) + while (mConnectionList != NULL) { mConnectionList->InternalDisconnect(0, UdpConnection::cDisconnectReasonManagerDeleted); // the above call ended up calling us back and removing them from our connection list, so now mConnectionList is pointing to the next entry @@ -384,7 +384,7 @@ UdpManager::~UdpManager() } // release any objects that were pending disconnection - while (mDisconnectPendingList != nullptr) + while (mDisconnectPendingList != NULL) { UdpConnection *next = mDisconnectPendingList->mDisconnectPendingNextConnection; mDisconnectPendingList->Release(); @@ -404,7 +404,7 @@ UdpManager::~UdpManager() } delete[] mPacketHistory; - while (mSimulateQueueStart != nullptr) + while (mSimulateQueueStart != NULL) { SimulateQueueEntry *entry = mSimulateQueueStart; mSimulateQueueStart = entry->mNext; @@ -517,12 +517,12 @@ void UdpManager::ProcessDisconnectPending() { UdpConnection *entry = mDisconnectPendingList; UdpConnection **prev = &mDisconnectPendingList; - while (entry != nullptr) + while (entry != NULL) { if (entry->GetStatus() == UdpConnection::cStatusDisconnected) { *prev = entry->mDisconnectPendingNextConnection; - entry->mDisconnectPendingNextConnection = nullptr; + entry->mDisconnectPendingNextConnection = NULL; entry->Release(); entry = *prev; } @@ -536,19 +536,19 @@ void UdpManager::ProcessDisconnectPending() void UdpManager::RemoveConnection(UdpConnection *con) { - assert(con != nullptr); // attemped to remove a nullptr connection object + assert(con != NULL); // attemped to remove a NULL connection object // note: it's a bug to Remove a connection object that is already removed...should never be able to happen. mConnectionListCount--; - if (con->mPrevConnection != nullptr) + if (con->mPrevConnection != NULL) con->mPrevConnection->mNextConnection = con->mNextConnection; - if (con->mNextConnection != nullptr) + if (con->mNextConnection != NULL) con->mNextConnection->mPrevConnection = con->mPrevConnection; if (mConnectionList == con) mConnectionList = con->mNextConnection; - con->mNextConnection = nullptr; - con->mPrevConnection = nullptr; - if (mPriorityQueue != nullptr) + con->mNextConnection = NULL; + con->mPrevConnection = NULL; + if (mPriorityQueue != NULL) mPriorityQueue->Remove(con); mAddressHashTable->Remove(con, AddressHashValue(con->mIp, con->mPort)); @@ -557,11 +557,11 @@ void UdpManager::RemoveConnection(UdpConnection *con) void UdpManager::AddConnection(UdpConnection *con) { - assert(con != nullptr); // attemped to add a nullptr connection object + assert(con != NULL); // attemped to add a NULL connection object con->mNextConnection = mConnectionList; - con->mPrevConnection = nullptr; - if (mConnectionList != nullptr) + con->mPrevConnection = NULL; + if (mConnectionList != NULL) mConnectionList->mPrevConnection = con; mConnectionList = con; mConnectionListCount++; @@ -574,7 +574,7 @@ void UdpManager::FlushAllMultiBuffer() { AddRef(); UdpConnection *cur = mConnectionList; - while (cur != nullptr) + while (cur != NULL) { cur->FlushMultiBuffer(); cur = cur->mNextConnection; @@ -597,7 +597,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) { PacketHistoryEntry *e = ActualReceive(); - if (e == nullptr) + if (e == NULL) { mLastEmptySocketBufferStamp = UdpMisc::Clock(); break; @@ -625,7 +625,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) if (giveConnectionsTime) { - if (mPriorityQueue != nullptr) + if (mPriorityQueue != NULL) { // give time to everybody in the priority-queue that needs it UdpMisc::ClockStamp curPriority = UdpMisc::Clock(); @@ -643,7 +643,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) for (;;) { UdpConnection *top = mPriorityQueue->TopRemove(curPriority); - if (top == nullptr) + if (top == NULL) break; top->AddRef(); top->GiveTime(); @@ -656,7 +656,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) { // give time to everybody UdpConnection *cur = mConnectionList; - while (cur != nullptr) + while (cur != NULL) { cur->GiveTime(); cur = cur->mNextConnection; @@ -666,7 +666,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) ProcessDisconnectPending(); } - if (mSimulateQueueStart != nullptr && UdpMisc::Clock() >= mSimulateNextOutgoingTime) + if (mSimulateQueueStart != NULL && UdpMisc::Clock() >= mSimulateNextOutgoingTime) { SimulateQueueEntry *entry = mSimulateQueueStart; mSimulateQueueStart = mSimulateQueueStart->mNext; @@ -674,7 +674,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) ActualSendHelper(entry->mData, entry->mDataLen, entry->mIp, entry->mPort); UdpConnection *con = AddressGetConnection(entry->mIp, entry->mPort); - if (con != nullptr) + if (con != NULL) con->mSimulateQueueBytes -= entry->mDataLen; mSimulateQueueBytes -= entry->mDataLen; delete entry; @@ -687,11 +687,11 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) UdpConnection *UdpManager::EstablishConnection(const char *serverAddress, int serverPort, int timeout) { assert(serverPort != 0); // can't connect to no port - assert(serverAddress != nullptr); + assert(serverAddress != NULL); assert(serverAddress[0] != 0); if (mConnectionListCount >= mParams.maxConnections) - return(nullptr); + return(NULL); // get server address unsigned long address = inet_addr(serverAddress); @@ -699,16 +699,16 @@ UdpConnection *UdpManager::EstablishConnection(const char *serverAddress, int se { struct hostent * lphp; lphp = gethostbyname(serverAddress); - if (lphp == nullptr) - return(nullptr); + if (lphp == NULL) + return(NULL); address = ((struct in_addr *)(lphp->h_addr))->s_addr; } UdpIpAddress destIp(address); // first, see if we already have a connection object managing this ip/port, if we do, then fail UdpConnection *con = AddressGetConnection(destIp, serverPort); - if (con != nullptr) - return(nullptr); + if (con != NULL) + return(NULL); return(new UdpConnection(this, destIp, serverPort, timeout)); } @@ -721,7 +721,7 @@ void UdpManager::KeepUntilDisconnected(UdpConnection *con) void UdpManager::GetStats(UdpManagerStatistics *stats) const { - assert(stats != nullptr); + assert(stats != NULL); *stats = mManagerStats; stats->poolAvailable = mPoolAvailable; stats->poolCreated = mPoolCreated; @@ -736,10 +736,10 @@ void UdpManager::ResetStats() void UdpManager::DumpPacketHistory(const char *filename) const { - assert(filename != nullptr); + assert(filename != NULL); assert(filename[0] != 0); FILE *file = fopen(filename, "wt"); - if (file != nullptr) + if (file != NULL) { // dump history of packets... for (int i = 0; i < mParams.packetHistoryMax; i++) @@ -785,7 +785,7 @@ int UdpManager::GetLocalPort() const UdpManager::PacketHistoryEntry *UdpManager::ActualReceive() { if (mParams.simulateIncomingByteRate > 0 && UdpMisc::Clock() < mSimulateNextIncomingTime) - return(nullptr); + return(NULL); struct sockaddr_in addr_from; socklen_t sf = sizeof(addr_from); @@ -795,7 +795,7 @@ UdpManager::PacketHistoryEntry *UdpManager::ActualReceive() if (res != SOCKET_ERROR) { if (mParams.simulateIncomingLossPercent > 0 && ((rand() % 100) < mParams.simulateIncomingLossPercent)) - return(nullptr); // packet, what packet? + return(NULL); // packet, what packet? if (mParams.simulateIncomingByteRate > 0) mSimulateNextIncomingTime = UdpMisc::Clock() + (res * 1000 / mParams.simulateIncomingByteRate); @@ -820,7 +820,7 @@ UdpManager::PacketHistoryEntry *UdpManager::ActualReceive() UdpIpAddress ip = UdpIpAddress(addr_from.sin_addr.s_addr); int port = (int)ntohs(addr_from.sin_port); UdpConnection *con = AddressGetConnection(ip, port); - if (con != nullptr) + if (con != NULL) { con->AddRef(); con->PortUnreachable(); @@ -840,7 +840,7 @@ UdpManager::PacketHistoryEntry *UdpManager::ActualReceive() } #endif } - return(nullptr); + return(NULL); } void UdpManager::ProcessIcmpErrors() @@ -868,7 +868,7 @@ void UdpManager::ProcessIcmpErrors() struct cmsghdr * cmsg; if(CMSG_FIRSTHDR(&msgh)) { - for(cmsg = CMSG_FIRSTHDR(&msgh); cmsg != nullptr; cmsg = CMSG_NXTHDR(&msgh, cmsg)) + for(cmsg = CMSG_FIRSTHDR(&msgh); cmsg != NULL; cmsg = CMSG_NXTHDR(&msgh, cmsg)) { if(cmsg->cmsg_level == SOL_IP && cmsg->cmsg_type == IP_RECVERR) { @@ -882,7 +882,7 @@ void UdpManager::ProcessIcmpErrors() UdpIpAddress ip = UdpIpAddress(msg_name.sin_addr.s_addr); int port = (int)htons(msg_name.sin_port); UdpConnection *con = AddressGetConnection(ip, port); - if (con != nullptr) + if (con != NULL) { con->AddRef(); con->PortUnreachable(); @@ -911,7 +911,7 @@ void UdpManager::ActualSend(const uchar *data, int dataLen, UdpIpAddress ip, int { // simulating outgoing byte-rate, so queue it up for sending later UdpConnection *con = AddressGetConnection(ip, port); - if (con != nullptr) + if (con != NULL) { if (mParams.simulateDestinationOverloadLevel > 0 && con->mSimulateQueueBytes + dataLen > mParams.simulateDestinationOverloadLevel) return; // no room, packet gets lost @@ -919,17 +919,17 @@ void UdpManager::ActualSend(const uchar *data, int dataLen, UdpIpAddress ip, int if (mParams.simulateOutgoingOverloadLevel > 0 && mSimulateQueueBytes + dataLen > mParams.simulateOutgoingOverloadLevel) return; // no room, packet gets lost - if (con != nullptr) + if (con != NULL) con->mSimulateQueueBytes += dataLen; mSimulateQueueBytes += dataLen; SimulateQueueEntry *entry = new SimulateQueueEntry(data, dataLen, ip, port); - if (mSimulateQueueStart != nullptr) + if (mSimulateQueueStart != NULL) mSimulateQueueEnd->mNext = entry; else mSimulateQueueStart = entry; mSimulateQueueEnd = entry; - mSimulateQueueEnd->mNext = nullptr; + mSimulateQueueEnd->mNext = NULL; return; } ActualSendHelper(data, dataLen, ip, port); @@ -952,7 +952,7 @@ void UdpManager::ActualSendHelper(const uchar *data, int dataLen, UdpIpAddress i // flag connection to terminate itself for port-unreachable error on next give time // we need to flag it instead of actually terminating it to prevent callbacks from occuring during application sends UdpConnection *con = AddressGetConnection(ip, port); - if (con != nullptr) + if (con != NULL) con->FlagPortUnreachable(); return; } @@ -990,7 +990,7 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) UdpConnection *con = AddressGetConnection(e->mIp, e->mPort); - if (con == nullptr) + if (con == NULL) { // packet coming from an unknown ip/port // if it is a connection request packet, then establish a new connection object to reply to it @@ -1003,7 +1003,7 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) int protocolVersion = UdpMisc::GetValue32(e->mBuffer + 2); if (protocolVersion == cProtocolVersion) { - if (mParams.handler != nullptr) + if (mParams.handler != NULL) { UdpConnection *newcon = new UdpConnection(this, e); mParams.handler->OnConnectRequest(newcon); @@ -1032,7 +1032,7 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) int encryptCode = UdpMisc::GetValue32(ptr); UdpConnection *con = ConnectCodeGetConnection(connectCode); - if (con != nullptr) + if (con != NULL) { if (mParams.allowAddressRemapping || con->mIp == e->mIp) { @@ -1082,25 +1082,25 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) UdpConnection *UdpManager::AddressGetConnection(UdpIpAddress ip, int port) const { UdpConnection *found = static_cast(mAddressHashTable->FindFirst(AddressHashValue(ip, port))); - while (found != nullptr) + while (found != NULL) { if (found->mIp == ip && found->mPort == port) return(found); found = static_cast(mAddressHashTable->FindNext(found)); } - return(nullptr); + return(NULL); } UdpConnection *UdpManager::ConnectCodeGetConnection(int connectCode) const { UdpConnection *found = static_cast(mConnectCodeHashTable->FindFirst(connectCode)); - while (found != nullptr) + while (found != NULL) { if (found->mConnectCode == connectCode) return(found); found = static_cast(mConnectCodeHashTable->FindNext(found)); } - return(nullptr); + return(NULL); } WrappedLogicalPacket *UdpManager::WrappedBorrow(const LogicalPacket *lp) @@ -1124,7 +1124,7 @@ WrappedLogicalPacket *UdpManager::WrappedBorrow(const LogicalPacket *lp) void UdpManager::WrappedCreated(WrappedLogicalPacket *wp) { wp->mCreatedNext = mWrappedCreatedRoot; - if (mWrappedCreatedRoot != nullptr) + if (mWrappedCreatedRoot != NULL) mWrappedCreatedRoot->mCreatedPrev = wp; mWrappedCreatedRoot = wp; mWrappedCreated++; @@ -1132,11 +1132,11 @@ void UdpManager::WrappedCreated(WrappedLogicalPacket *wp) void UdpManager::WrappedDestroyed(WrappedLogicalPacket *wp) { - if (wp->mCreatedNext != nullptr) + if (wp->mCreatedNext != NULL) { wp->mCreatedNext->mCreatedPrev = wp->mCreatedPrev; } - if (wp->mCreatedPrev != nullptr) + if (wp->mCreatedPrev != NULL) { wp->mCreatedPrev->mCreatedNext = wp->mCreatedNext; } @@ -1146,9 +1146,9 @@ void UdpManager::WrappedDestroyed(WrappedLogicalPacket *wp) mWrappedCreatedRoot = wp->mCreatedNext; } - wp->mCreatedPrev = nullptr; - wp->mCreatedNext = nullptr; - wp->mUdpManager = nullptr; + wp->mCreatedPrev = NULL; + wp->mCreatedNext = NULL; + wp->mUdpManager = NULL; mWrappedCreated--; } @@ -1183,7 +1183,7 @@ LogicalPacket *UdpManager::CreatePacket(const void *data, int dataLen, const voi void UdpManager::PoolCreated(PooledLogicalPacket *packet) { packet->mCreatedNext = mPoolCreatedRoot; - if (mPoolCreatedRoot != nullptr) + if (mPoolCreatedRoot != NULL) mPoolCreatedRoot->mCreatedPrev = packet; mPoolCreatedRoot = packet; mPoolCreated++; @@ -1191,11 +1191,11 @@ void UdpManager::PoolCreated(PooledLogicalPacket *packet) void UdpManager::PoolDestroyed(PooledLogicalPacket *packet) { - if (packet->mCreatedNext != nullptr) + if (packet->mCreatedNext != NULL) { packet->mCreatedNext->mCreatedPrev = packet->mCreatedPrev; } - if (packet->mCreatedPrev != nullptr) + if (packet->mCreatedPrev != NULL) { packet->mCreatedPrev->mCreatedNext = packet->mCreatedNext; } @@ -1205,9 +1205,9 @@ void UdpManager::PoolDestroyed(PooledLogicalPacket *packet) mPoolCreatedRoot = packet->mCreatedNext; } - packet->mCreatedPrev = nullptr; - packet->mCreatedNext = nullptr; - packet->mUdpManager = nullptr; + packet->mCreatedPrev = NULL; + packet->mCreatedNext = NULL; + packet->mUdpManager = NULL; mPoolCreated--; } @@ -1282,7 +1282,7 @@ void UdpConnection::Init(UdpManager *udpManager, UdpIpAddress destIp, int destPo mLastClockSyncTime = 0; mDataHoldTime = 0; mGettingTime = false; - mHandler = nullptr; + mHandler = NULL; mNoDataTimeout = mUdpManager->mParams.noDataTimeout; mKeepAliveDelay = mUdpManager->mParams.keepAliveDelay; @@ -1290,13 +1290,13 @@ void UdpConnection::Init(UdpManager *udpManager, UdpIpAddress destIp, int destPo mMultiBufferData = new uchar[mUdpManager->mParams.maxRawPacketSize]; mMultiBufferPtr = mMultiBufferData; - mDisconnectPendingNextConnection = nullptr; - mNextConnection = nullptr; - mPrevConnection = nullptr; + mDisconnectPendingNextConnection = NULL; + mNextConnection = NULL; + mPrevConnection = NULL; mIcmpErrorRetryStartStamp = 0; // when the timer started for ICMP error retry delay (gets reset on a successful packet receive) mPortRemapRequestStartStamp = 0; - mEncryptXorBuffer = nullptr; + mEncryptXorBuffer = NULL; mEncryptExpansionBytes = 0; mOrderedCountOutgoing = 0; mOrderedCountOutgoing2 = 0; @@ -1307,7 +1307,7 @@ void UdpConnection::Init(UdpManager *udpManager, UdpIpAddress destIp, int destPo mConnectionCreateTime = UdpMisc::Clock(); mSimulateQueueBytes = 0; - mPassThroughData = nullptr; + mPassThroughData = NULL; mSilentDisconnect = false; mLastSendBin = 0; @@ -1325,7 +1325,7 @@ void UdpConnection::Init(UdpManager *udpManager, UdpIpAddress destIp, int destPo UdpConnection::~UdpConnection() { - if (mUdpManager != nullptr) + if (mUdpManager != NULL) InternalDisconnect(0, mDisconnectReason); for (int i = 0; i < UdpManager::cReliableChannelCount; i++) @@ -1372,7 +1372,7 @@ void UdpConnection::InternalDisconnect(int flushTimeout, DisconnectReason reason if (mStatus == cStatusNegotiating) flushTimeout = 0; - if (mUdpManager != nullptr) + if (mUdpManager != NULL) { if (flushTimeout > 0) { @@ -1402,13 +1402,13 @@ void UdpConnection::InternalDisconnect(int flushTimeout, DisconnectReason reason } mUdpManager->RemoveConnection(this); - mUdpManager = nullptr; + mUdpManager = NULL; } mStatus = cStatusDisconnected; - if (startStatus != cStatusDisconnected && startUdpManager != nullptr) + if (startStatus != cStatusDisconnected && startUdpManager != NULL) { - if (mHandler != nullptr) + if (mHandler != NULL) mHandler->OnTerminated(this); } } @@ -1442,7 +1442,7 @@ bool UdpConnection::Send(UdpChannel channel, const void *data, int dataLen) if (dataLen == 0) // zero length packets are ignored return(false); - assert(data != nullptr); // can't send a nullptr packet + assert(data != NULL); // can't send a null packet mUdpManager->mManagerStats.applicationPacketsSent++; mConnectionStats.applicationPacketsSent++; @@ -1459,7 +1459,7 @@ bool UdpConnection::Send(UdpChannel channel, const void *data, int dataLen) bool UdpConnection::Send(UdpChannel channel, const LogicalPacket *packet) { - assert(packet != nullptr); // can't send a nullptr packet + assert(packet != NULL); // can't send a null packet assert(channel >= 0 && channel < cUdpChannelCount); assert(mStatus != cStatusNegotiating); // you are not allowed to start sending data on a connection that is still in the process of negotiating (only applicable client-side obviously since servers never have connections in this state) @@ -1505,7 +1505,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const uchar *data, int data { uchar *bufPtr = tempBuffer; memcpy(bufPtr, data, dataLen); - if (data2 != nullptr) + if (data2 != NULL) memcpy(bufPtr + dataLen, data2, dataLen2); PhysicalSend(bufPtr, totalDataLen, true); return(true); @@ -1518,9 +1518,9 @@ bool UdpConnection::InternalSend(UdpChannel channel, const uchar *data, int data bufPtr[1] = cUdpPacketOrdered2; UdpMisc::PutValue16(bufPtr + 2, (ushort)(++mOrderedCountOutgoing2 & 0xffff)); memcpy(bufPtr + 4, data, dataLen); - if (data2 != nullptr) + if (data2 != NULL) memcpy(bufPtr + 4 + dataLen, data2, dataLen2); - BufferedSend(bufPtr, totalDataLen + 4, nullptr, 0, true); + BufferedSend(bufPtr, totalDataLen + 4, NULL, 0, true); return(true); break; } @@ -1531,7 +1531,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const uchar *data, int data bufPtr[1] = cUdpPacketOrdered2; UdpMisc::PutValue16(bufPtr + 2, (ushort)(++mOrderedCountOutgoing2 & 0xffff)); memcpy(bufPtr + 4, data, dataLen); - if (data2 != nullptr) + if (data2 != NULL) memcpy(bufPtr + 4 + dataLen, data2, dataLen2); PhysicalSend(bufPtr, totalDataLen + 4, true); return(true); @@ -1543,7 +1543,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const uchar *data, int data case cUdpChannelReliable4: { int num = channel - cUdpChannelReliable1; - if (mChannel[num] == nullptr) + if (mChannel[num] == NULL) mChannel[num] = new UdpReliableChannel(num, this, &mUdpManager->mParams.reliable[num]); mChannel[num]->Send(data, dataLen, data2, dataLen2); return(true); @@ -1565,7 +1565,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const LogicalPacket *packet case cUdpChannelReliable4: { int num = channel - cUdpChannelReliable1; - if (mChannel[num] == nullptr) + if (mChannel[num] == NULL) mChannel[num] = new UdpReliableChannel(num, this, &mUdpManager->mParams.reliable[num]); mChannel[num]->Send(packet); return(true); @@ -1605,9 +1605,9 @@ void UdpConnection::PingStatReset() void UdpConnection::GetStats(UdpConnectionStatistics *cs) const { - assert(cs != nullptr); + assert(cs != NULL); - if (mUdpManager == nullptr) + if (mUdpManager == NULL) return; *cs = mConnectionStats; @@ -1623,13 +1623,13 @@ void UdpConnection::GetStats(UdpConnectionStatistics *cs) const if (cs->syncTheirSent > 0) cs->percentReceivedSuccess = (float)cs->syncOurReceived / (float)cs->syncTheirSent; cs->reliableAveragePing = 0; - if (mChannel[0] != nullptr) + if (mChannel[0] != NULL) cs->reliableAveragePing = mChannel[0]->GetAveragePing(); } void UdpConnection::ProcessRawPacket(const UdpManager::PacketHistoryEntry *e) { - if (mUdpManager == nullptr) + if (mUdpManager == NULL) return; if (e->mBuffer[0] != 0 || e->mBuffer[1] != cUdpPacketUnreachableConnection) @@ -1731,7 +1731,7 @@ void UdpConnection::ProcessRawPacket(const UdpManager::PacketHistoryEntry *e) { mConnectionStats.crcRejectedPackets++; mUdpManager->mManagerStats.crcRejectedPackets++; - if (mHandler != nullptr) + if (mHandler != NULL) mHandler->OnCrcReject(this, e->mBuffer, e->mLen); return; } @@ -1792,7 +1792,7 @@ void UdpConnection::CallbackRoutePacket(const uchar *data, int dataLen) mUdpManager->mManagerStats.applicationPacketsReceived++; mConnectionStats.applicationPacketsReceived++; - if (mHandler != nullptr) + if (mHandler != NULL) mHandler->OnRoutePacket(this, data, dataLen); } } @@ -1801,7 +1801,7 @@ void UdpConnection::CallbackCorruptPacket(const uchar *data, int dataLen, UdpCor { mConnectionStats.corruptPacketErrors++; mUdpManager->mManagerStats.corruptPacketErrors++; - if (mHandler != nullptr) + if (mHandler != NULL) mHandler->OnPacketCorrupt(this, data, dataLen, reason); } @@ -1809,7 +1809,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) { uchar buf[256]; uchar *bufPtr; - if (mUdpManager == nullptr) + if (mUdpManager == NULL) return; if (data[0] == 0 && dataLen > 1) @@ -1882,7 +1882,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) mConnectionConfig = config; SetupEncryptModel(); mStatus = cStatusConnected; - if (mHandler != nullptr) + if (mHandler != NULL) mHandler->OnConnectComplete(this); } break; @@ -2112,7 +2112,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) case cUdpPacketFragment4: { int num = (data[1] - cUdpPacketReliable1) % UdpManager::cReliableChannelCount; - if (mChannel[num] == nullptr) + if (mChannel[num] == NULL) mChannel[num] = new UdpReliableChannel(num, this, &mUdpManager->mParams.reliable[num]); mChannel[num]->ReliablePacket(data, dataLen); break; @@ -2123,7 +2123,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) case cUdpPacketAck4: { int num = data[1] - cUdpPacketAck1; - if (mChannel[num] != nullptr) + if (mChannel[num] != NULL) mChannel[num]->AckPacket(data, dataLen); break; } @@ -2133,7 +2133,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) case cUdpPacketAckAll4: { int num = data[1] - cUdpPacketAckAll1; - if (mChannel[num] != nullptr) + if (mChannel[num] != NULL) mChannel[num]->AckAllPacket(data, dataLen); break; } @@ -2173,7 +2173,7 @@ void UdpConnection::FlagPortUnreachable() void UdpConnection::GiveTime() { - if (mUdpManager == nullptr) + if (mUdpManager == NULL) return; UdpManager *myManager = mUdpManager; @@ -2266,11 +2266,11 @@ void UdpConnection::InternalGiveTime() int totalPendingBytes = 0; for (int i = 0; i < UdpManager::cReliableChannelCount; i++) { - if (mChannel[i] != nullptr) + if (mChannel[i] != NULL) { totalPendingBytes += mChannel[i]->TotalPendingBytes(); int myNext = mChannel[i]->GiveTime(); - if (mUdpManager == nullptr) + if (mUdpManager == NULL) return; // giving the reliable channel time caused it to callback the application which may disconnect us nextSchedule = udpMin(nextSchedule, myNext); } @@ -2359,7 +2359,7 @@ void UdpConnection::InternalGiveTime() break; } - if (mUdpManager != nullptr) + if (mUdpManager != NULL) { // safety to prevent us for scheduling ourselves for a time period that has already passed, // as doing so could result in infinite looping in the priority queue processing. @@ -2376,7 +2376,7 @@ int UdpConnection::TotalPendingBytes() const int total = 0; for (int i = 0; i < UdpManager::cReliableChannelCount; i++) { - if (mChannel[i] != nullptr) + if (mChannel[i] != NULL) total += mChannel[i]->TotalPendingBytes(); } return(total); @@ -2442,7 +2442,7 @@ int UdpConnection::ExpireReceiveBin() void UdpConnection::PhysicalSend(const uchar *data, int dataLen, bool appendAllowed) { - if (mUdpManager == nullptr) + if (mUdpManager == NULL) return; // if we attempt to do a physical send (ie. encrypt/compress/crc a packet) while we are not connected @@ -2540,8 +2540,8 @@ void UdpConnection::PhysicalSend(const uchar *data, int dataLen, bool appendAllo // function can do its job uchar *UdpConnection::BufferedSend(const uchar *data, int dataLen, const uchar *data2, int dataLen2, bool appendAllowed) { - if (mUdpManager == nullptr) - return(nullptr); + if (mUdpManager == NULL) + return(NULL); int used = mMultiBufferPtr - mMultiBufferData; int actualMaxDataHoldSize = udpMin(mUdpManager->mParams.maxDataHoldSize, mConnectionConfig.maxRawPacketSize); @@ -2556,7 +2556,7 @@ uchar *UdpConnection::BufferedSend(const uchar *data, int dataLen, const uchar * FlushMultiBuffer(); // now send it (the multi-buffer is empty if you need to use it temporarily to concatenate two data chunks -- it is large enough to hold the largest raw packet) - if (data2 != nullptr) + if (data2 != NULL) { memcpy(mMultiBufferData, data, dataLen); memcpy(mMultiBufferData + dataLen, data2, dataLen2); @@ -2564,7 +2564,7 @@ uchar *UdpConnection::BufferedSend(const uchar *data, int dataLen, const uchar * } else PhysicalSend(data, dataLen, appendAllowed); - return(nullptr); + return(NULL); } // if this data will not fit into buffer @@ -2592,7 +2592,7 @@ uchar *UdpConnection::BufferedSend(const uchar *data, int dataLen, const uchar * uchar *placementPtr = mMultiBufferPtr; memcpy(mMultiBufferPtr, data, dataLen); mMultiBufferPtr += dataLen; - if (data2 != nullptr) + if (data2 != NULL) { memcpy(mMultiBufferPtr, data2, dataLen2); mMultiBufferPtr += dataLen2; @@ -2601,21 +2601,21 @@ uchar *UdpConnection::BufferedSend(const uchar *data, int dataLen, const uchar * if ((mMultiBufferPtr - mMultiBufferData) >= actualMaxDataHoldSize) { FlushMultiBuffer(); - placementPtr = nullptr; // it got flushed + placementPtr = NULL; // it got flushed } return(placementPtr); } uchar *UdpConnection::InternalAckSend(uchar *bufferedAckPtr, const uchar *ackPtr, int ackLen) { - if (bufferedAckPtr != nullptr) + if (bufferedAckPtr != NULL) { memcpy(bufferedAckPtr, ackPtr, ackLen); return(bufferedAckPtr); } - BufferedSend(ackPtr, ackLen, nullptr, 0, false); - return(nullptr); // FIX THIS + BufferedSend(ackPtr, ackLen, NULL, 0, false); + return(NULL); // FIX THIS } void UdpConnection::FlushMultiBuffer() @@ -2631,7 +2631,7 @@ void UdpConnection::FlushMultiBuffer() // notify all the reliable channels to clear their buffered acks for (int i = 0; i < UdpManager::cReliableChannelCount; i++) { - if (mChannel[i] != nullptr) + if (mChannel[i] != NULL) { mChannel[i]->ClearBufferedAck(); } @@ -2656,7 +2656,7 @@ int UdpConnection::DecryptNone(uchar *destData, const uchar *sourceData, int sou int UdpConnection::EncryptUserSupplied(uchar *destData, const uchar *sourceData, int sourceLen) { UdpManagerHandler *manHandler = mUdpManager->GetHandler(); - if (manHandler != nullptr) + if (manHandler != NULL) return(manHandler->OnUserSuppliedEncrypt(this, destData, sourceData, sourceLen)); assert(0); // if user-supplied encryption is specified, then you must have a manager handler installed to provide the routines return(0); @@ -2665,7 +2665,7 @@ int UdpConnection::EncryptUserSupplied(uchar *destData, const uchar *sourceData, int UdpConnection::DecryptUserSupplied(uchar *destData, const uchar *sourceData, int sourceLen) { UdpManagerHandler *manHandler = mUdpManager->GetHandler(); - if (manHandler != nullptr) + if (manHandler != NULL) return(manHandler->OnUserSuppliedDecrypt(this, destData, sourceData, sourceLen)); assert(0); // if user-supplied encryption is specified, then you must have a manager handler installed to provide the routines return(0); @@ -2674,7 +2674,7 @@ int UdpConnection::DecryptUserSupplied(uchar *destData, const uchar *sourceData, int UdpConnection::EncryptUserSupplied2(uchar *destData, const uchar *sourceData, int sourceLen) { UdpManagerHandler *manHandler = mUdpManager->GetHandler(); - if (manHandler != nullptr) + if (manHandler != NULL) return(manHandler->OnUserSuppliedEncrypt2(this, destData, sourceData, sourceLen)); assert(0); // if user-supplied encryption is specified, then you must have a manager handler installed to provide the routines return(0); @@ -2683,7 +2683,7 @@ int UdpConnection::EncryptUserSupplied2(uchar *destData, const uchar *sourceData int UdpConnection::DecryptUserSupplied2(uchar *destData, const uchar *sourceData, int sourceLen) { UdpManagerHandler *manHandler = mUdpManager->GetHandler(); - if (manHandler != nullptr) + if (manHandler != NULL) return(manHandler->OnUserSuppliedDecrypt2(this, destData, sourceData, sourceLen)); assert(0); // if user-supplied encryption is specified, then you must have a manager handler installed to provide the routines return(0); @@ -2833,7 +2833,7 @@ void UdpConnection::SetupEncryptModel() mEncryptExpansionBytes += 0; // set up encrypt buffer (random numbers generated based on seed) - if (mEncryptXorBuffer == nullptr) + if (mEncryptXorBuffer == NULL) { int len = ((mUdpManager->mParams.maxRawPacketSize + 1) / 4) * 4; mEncryptXorBuffer = new uchar[len]; @@ -2865,7 +2865,7 @@ void UdpConnection::GetChannelStatus(UdpChannel channel, ChannelStatus *channelS case cUdpChannelReliable2: case cUdpChannelReliable3: case cUdpChannelReliable4: - if (mChannel[channel - cUdpChannelReliable1] != nullptr) + if (mChannel[channel - cUdpChannelReliable1] != NULL) { mChannel[channel - cUdpChannelReliable1]->GetChannelStatus(channelStatus); } @@ -2941,12 +2941,12 @@ UdpReliableChannel::UdpReliableChannel(int channelNumber, UdpConnection *con, Ud mLogicalPacketsQueued = 0; mLogicalBytesQueued = 0; - mCoalescePacket = nullptr; - mCoalesceStartPtr = nullptr; - mCoalesceEndPtr = nullptr; + mCoalescePacket = NULL; + mCoalesceStartPtr = NULL; + mCoalesceEndPtr = NULL; mCoalesceCount = 0; - mBufferedAckPtr = nullptr; + mBufferedAckPtr = NULL; mStatDuplicatePacketsReceived = 0; mStatResentPacketsAccelerated = 0; @@ -2960,7 +2960,7 @@ UdpReliableChannel::UdpReliableChannel(int channelNumber, UdpConnection *con, Ud mBigDataLen = 0; mBigDataTargetLen = 0; - mBigDataPtr = nullptr; + mBigDataPtr = NULL; mFragmentNextPos = 0; mLastTimeStampAcknowledged = 0; mMaxxedOutCurrentWindow = false; @@ -2969,23 +2969,23 @@ UdpReliableChannel::UdpReliableChannel(int channelNumber, UdpConnection *con, Ud mPhysicalPackets = new PhysicalPacket[mConfig.maxOutstandingPackets]; mReliableIncoming = new IncomingQueueEntry[mConfig.maxInstandingPackets]; - mLogicalRoot = nullptr; - mLogicalEnd = nullptr; + mLogicalRoot = NULL; + mLogicalEnd = NULL; } UdpReliableChannel::~UdpReliableChannel() { - if (mCoalescePacket != nullptr) + if (mCoalescePacket != NULL) { mCoalescePacket->Release(); - mCoalescePacket = nullptr; + mCoalescePacket = NULL; } const LogicalPacket *cur = mLogicalRoot; - while (cur != nullptr) + while (cur != NULL) { const LogicalPacket *next = cur->mReliableQueueNext; - cur->mReliableQueueNext = nullptr; // make sure and mark it available so others could possibly use it (if it is a shared logical packet) + cur->mReliableQueueNext = NULL; // make sure and mark it available so others could possibly use it (if it is a shared logical packet) cur->Release(); if (cur == next) // pointing to self, so this is end of list break; @@ -3052,7 +3052,7 @@ void UdpReliableChannel::Send(const LogicalPacket *packet) void UdpReliableChannel::FlushCoalesce() { - if (mCoalescePacket != nullptr) + if (mCoalescePacket != NULL) { if (mCoalesceCount == 1) { @@ -3069,16 +3069,16 @@ void UdpReliableChannel::FlushCoalesce() } mCoalescePacket->Release(); - mCoalescePacket = nullptr; + mCoalescePacket = NULL; } } void UdpReliableChannel::SendCoalesce(const uchar *data, int dataLen, const uchar *data2, int dataLen2) { int totalLen = dataLen + dataLen2; - if (mCoalescePacket == nullptr) + if (mCoalescePacket == NULL) { - mCoalescePacket = mUdpConnection->mUdpManager->CreatePacket(nullptr, mMaxDataBytes); + mCoalescePacket = mUdpConnection->mUdpManager->CreatePacket(NULL, mMaxDataBytes); mCoalesceEndPtr = mCoalesceStartPtr = (uchar *)mCoalescePacket->GetDataPtr(); *mCoalesceEndPtr++ = 0; *mCoalesceEndPtr++ = UdpConnection::cUdpPacketGroup; @@ -3098,10 +3098,10 @@ void UdpReliableChannel::SendCoalesce(const uchar *data, int dataLen, const ucha // append on end of coalesce mCoalesceCount++; mCoalesceEndPtr += UdpMisc::PutVariableValue(mCoalesceEndPtr, totalLen); - if (data != nullptr) + if (data != NULL) memcpy(mCoalesceEndPtr, data, dataLen); mCoalesceEndPtr += dataLen; - if (data2 != nullptr) + if (data2 != NULL) memcpy(mCoalesceEndPtr, data2, dataLen2); mCoalesceEndPtr += dataLen2; } @@ -3111,7 +3111,7 @@ void UdpReliableChannel::QueueLogicalPacket(const LogicalPacket *packet) mLogicalPacketsQueued++; mLogicalBytesQueued += packet->GetDataLen(); - if (packet->mReliableQueueNext != nullptr) + if (packet->mReliableQueueNext != NULL) { packet = mUdpConnection->mUdpManager->WrappedBorrow(packet); } @@ -3121,13 +3121,13 @@ void UdpReliableChannel::QueueLogicalPacket(const LogicalPacket *packet) } packet->mReliableQueueNext = packet; // have it point to itself to signify that the mNext pointer is taken (ie. reserve it), yet still represents the end of the list - if (mLogicalEnd != nullptr) + if (mLogicalEnd != NULL) { mLogicalEnd->mReliableQueueNext = packet; } mLogicalEnd = packet; - if (mLogicalRoot == nullptr) + if (mLogicalRoot == NULL) { mLogicalRoot = packet; } @@ -3148,10 +3148,10 @@ bool UdpReliableChannel::PullDown(int windowSpaceLeft) int physicalCount = (int)(mReliableOutgoingId - mReliableOutgoingPendingId); while (windowSpaceLeft > 0 && physicalCount < mConfig.maxOutstandingPackets) { - if (mLogicalRoot == nullptr) + if (mLogicalRoot == NULL) { FlushCoalesce(); // this is guaranteed to stick - if (mLogicalRoot == nullptr) + if (mLogicalRoot == NULL) break; // nothing flushed, so we are done } @@ -3191,10 +3191,10 @@ bool UdpReliableChannel::PullDown(int windowSpaceLeft) mLogicalRoot = mLogicalRoot->mReliableQueueNext; if (mLogicalRoot == lp) // ie, we were pointing to ourself, meaning we were the end of the list { - mLogicalRoot = nullptr; - mLogicalEnd = nullptr; + mLogicalRoot = NULL; + mLogicalEnd = NULL; } - lp->mReliableQueueNext = nullptr; // clear our next link since we are no longer using it (so somebody else can use it potentially) + lp->mReliableQueueNext = NULL; // clear our next link since we are no longer using it (so somebody else can use it potentially) lp->Release(); // release from logical queue } else @@ -3249,9 +3249,9 @@ int UdpReliableChannel::GiveTime() // this next branch was replaced by JeffP in the latest UdpLibrary drop. Please integrate // that. If something catestrophic happens with reliable channels, uncomment this next line to // replace the existing branch - //if (mReliableOutgoingId < mReliableOutgoingPendingId || mLogicalRoot != nullptr || mCoalescePacket != nullptr) + //if (mReliableOutgoingId < mReliableOutgoingPendingId || mLogicalRoot != NULL || mCoalescePacket != NULL) - if (mReliableOutgoingPendingId < mReliableOutgoingId || mLogicalRoot != nullptr || mCoalescePacket != nullptr) + if (mReliableOutgoingPendingId < mReliableOutgoingId || mLogicalRoot != NULL || mCoalescePacket != NULL) { // first, let's calculate how many bytes we figure is outstanding based on who is still waiting for an ack-packet UdpMisc::ClockStamp oldestResendTime = udpMax(hotClock - optimalResendDelay, mLastTimeStampAcknowledged); // anything older than this, we need to resend @@ -3276,7 +3276,7 @@ int UdpReliableChannel::GiveTime() // if this packet has not been acked and it is NOT ready to be sent (was recently sent) then we consider it outstanding // note: packets needing re-sending probably got lost and are therefore not outstanding PhysicalPacket *entry = &mPhysicalPackets[i % mConfig.maxOutstandingPackets]; - if (entry->mDataPtr != nullptr) // acked packets set the dataPtr to nullptr + if (entry->mDataPtr != NULL) // acked packets set the dataPtr to NULL { // if this packet is ready to be sent (ie: needs time now, or some later packet has already been ack'ed) windowSpaceLeft -= entry->mDataLen; // window-space is effectively taken whether we have sent it yet or not @@ -3436,7 +3436,7 @@ int UdpReliableChannel::GiveTime() void UdpReliableChannel::GetChannelStatus(UdpConnection::ChannelStatus *channelStatus) const { int coalesceBytes = 0; - if (mCoalescePacket != nullptr) + if (mCoalescePacket != NULL) coalesceBytes = mCoalesceEndPtr - mCoalesceStartPtr; channelStatus->totalPendingBytes = mLogicalBytesQueued + mReliableOutgoingBytes + coalesceBytes; @@ -3497,7 +3497,7 @@ void UdpReliableChannel::ReliablePacket(const uchar *data, int dataLen) mReliableIncomingId++; // process other packets that have arrived - while (mReliableIncoming[mReliableIncomingId % mConfig.maxInstandingPackets].mPacket != nullptr) + while (mReliableIncoming[mReliableIncomingId % mConfig.maxInstandingPackets].mPacket != NULL) { int spot = (int)(mReliableIncomingId % mConfig.maxInstandingPackets); if (mReliableIncoming[spot].mMode != cReliablePacketModeDelivered) @@ -3506,7 +3506,7 @@ void UdpReliableChannel::ReliablePacket(const uchar *data, int dataLen) } mReliableIncoming[spot].mPacket->Release(); - mReliableIncoming[spot].mPacket = nullptr; + mReliableIncoming[spot].mPacket = NULL; mReliableIncomingId++; } } @@ -3514,7 +3514,7 @@ void UdpReliableChannel::ReliablePacket(const uchar *data, int dataLen) { // not the one we need next, but it is later than the one we need , so store it in our buffer until it's turn comes up int spot = (int)(reliableId % mConfig.maxInstandingPackets); - if (mReliableIncoming[spot].mPacket == nullptr) // only make the copy of it if we don't already have it in our buffer (in cases where it was sent twice, there would be no harm in the copy again since it must be the same packet, it's just inefficient) + if (mReliableIncoming[spot].mPacket == NULL) // only make the copy of it if we don't already have it in our buffer (in cases where it was sent twice, there would be no harm in the copy again since it must be the same packet, it's just inefficient) { mReliableIncoming[spot].mMode = mode; mReliableIncoming[spot].mPacket = mUdpConnection->mUdpManager->CreatePacket(data + UdpConnection::cUdpPacketReliableSize, dataLen - UdpConnection::cUdpPacketReliableSize); @@ -3556,16 +3556,16 @@ void UdpReliableChannel::ReliablePacket(const uchar *data, int dataLen) // a simple ack for us only *bufPtr++ = (uchar)(UdpConnection::cUdpPacketAck1 + mChannelNumber); bufPtr += UdpMisc::PutValue16(bufPtr, (ushort)(reliableId & 0xffff)); - mBufferedAckPtr = nullptr; // not allowed to replace an old one with a selective-ack + mBufferedAckPtr = NULL; // not allowed to replace an old one with a selective-ack } - if (mBufferedAckPtr != nullptr && mConfig.ackDeduping) + if (mBufferedAckPtr != NULL && mConfig.ackDeduping) { memcpy(mBufferedAckPtr, buf, bufPtr - buf); } else { - mBufferedAckPtr = mUdpConnection->BufferedSend(buf, bufPtr - buf, nullptr, 0, true); // safe to append on our data, it is stack data + mBufferedAckPtr = mUdpConnection->BufferedSend(buf, bufPtr - buf, NULL, 0, true); // safe to append on our data, it is stack data } } @@ -3582,7 +3582,7 @@ void UdpReliableChannel::ProcessPacket(ReliablePacketMode mode, const uchar *dat else if (mode == cReliablePacketModeFragment) { // append onto end of big packet (or create new big packet if not existing already) - if (mBigDataPtr == nullptr) + if (mBigDataPtr == NULL) { mBigDataTargetLen = UdpMisc::GetValue32(data); // first fragment has a total-length int header on it. mBigDataPtr = new uchar[mBigDataTargetLen]; @@ -3611,7 +3611,7 @@ void UdpReliableChannel::ProcessPacket(ReliablePacketMode mode, const uchar *dat delete[] mBigDataPtr; mBigDataLen = 0; mBigDataTargetLen = 0; - mBigDataPtr = nullptr; + mBigDataPtr = NULL; } } } @@ -3641,7 +3641,7 @@ void UdpReliableChannel::Ack(udp_int64 reliableId) int pos = (int)(reliableId % mConfig.maxOutstandingPackets); PhysicalPacket *entry = &mPhysicalPackets[pos]; - if (entry->mDataPtr != nullptr) // if this packet has not been acknowledged yet (sometimes we get back two acks for the same packet) + if (entry->mDataPtr != NULL) // if this packet has not been acknowledged yet (sometimes we get back two acks for the same packet) { mNextNeedTime = 0; // something got acked, so we actually need to take the time next time it is offered @@ -3699,14 +3699,14 @@ void UdpReliableChannel::Ack(udp_int64 reliableId) // this packet we have queued has been acknowledged, so delete it from queue mReliableOutgoingBytes -= entry->mDataLen; entry->mDataLen = 0; - entry->mDataPtr = nullptr; + entry->mDataPtr = NULL; entry->mParent->Release(); - entry->mParent = nullptr; + entry->mParent = NULL; // advance the pending ptr until it reaches outgoingId or an entry that has yet to acknowledged while (mReliableOutgoingPendingId < mReliableOutgoingId) { - if (mPhysicalPackets[mReliableOutgoingPendingId % mConfig.maxOutstandingPackets].mDataPtr != nullptr) + if (mPhysicalPackets[mReliableOutgoingPendingId % mConfig.maxOutstandingPackets].mDataPtr != NULL) break; mReliableOutgoingPendingId++; } @@ -3728,25 +3728,25 @@ void UdpReliableChannel::Ack(udp_int64 reliableId) UdpReliableChannel::IncomingQueueEntry::IncomingQueueEntry() { - mPacket = nullptr; + mPacket = NULL; mMode = UdpReliableChannel::cReliablePacketModeReliable; } UdpReliableChannel::IncomingQueueEntry::~IncomingQueueEntry() { - if (mPacket != nullptr) + if (mPacket != NULL) mPacket->Release(); } UdpReliableChannel::PhysicalPacket::PhysicalPacket() { - mParent = nullptr; + mParent = NULL; } UdpReliableChannel::PhysicalPacket::~PhysicalPacket() { - if (mParent != nullptr) + if (mParent != NULL) mParent->Release(); } @@ -3758,7 +3758,7 @@ UdpReliableChannel::PhysicalPacket::~PhysicalPacket() LogicalPacket::LogicalPacket() { mRefCount = 1; - mReliableQueueNext = nullptr; + mReliableQueueNext = NULL; } LogicalPacket::~LogicalPacket() @@ -3793,7 +3793,7 @@ SimpleLogicalPacket::SimpleLogicalPacket(const void *data, int dataLen) { mDataLen = dataLen; mData = new uchar[mDataLen]; - if (data != nullptr) + if (data != NULL) memcpy(mData, data, mDataLen); } @@ -3828,7 +3828,7 @@ void SimpleLogicalPacket::SetDataLen(int len) GroupLogicalPacket::GroupLogicalPacket() : LogicalPacket() { mDataLen = 0; - mData = nullptr; + mData = NULL; } GroupLogicalPacket::~GroupLogicalPacket() @@ -3838,13 +3838,13 @@ GroupLogicalPacket::~GroupLogicalPacket() void GroupLogicalPacket::AddPacket(const LogicalPacket *packet) { - assert(packet != nullptr); + assert(packet != NULL); AddPacketInternal(packet->GetDataPtr(), packet->GetDataLen(), packet->IsInternalPacket()); } void GroupLogicalPacket::AddPacket(const void *data, int dataLen) { - assert(data != nullptr); + assert(data != NULL); assert(dataLen >= 0); AddPacketInternal(data, dataLen, false); } @@ -3910,16 +3910,16 @@ PooledLogicalPacket::PooledLogicalPacket(UdpManager *manager, int len) mDataLen = 0; mUdpManager = manager; - mAvailableNext = nullptr; - mCreatedNext = nullptr; - mCreatedPrev = nullptr; + mAvailableNext = NULL; + mCreatedNext = NULL; + mCreatedPrev = NULL; mUdpManager->PoolCreated(this); } PooledLogicalPacket::~PooledLogicalPacket() { - if (mUdpManager != nullptr) + if (mUdpManager != NULL) { mUdpManager->PoolDestroyed(this); } @@ -3934,7 +3934,7 @@ void PooledLogicalPacket::AddRef() const void PooledLogicalPacket::Release() const { - if (mRefCount == 1 && mUdpManager != nullptr) + if (mRefCount == 1 && mUdpManager != NULL) mUdpManager->PoolReturn(const_cast(this)); // if pool wants to keep us, it will inc our ref count, preventing our destruction // we cast off our const, as when we are added back to the pool, we can be modified LogicalPacket::Release(); @@ -3964,9 +3964,9 @@ void PooledLogicalPacket::SetDataLen(int len) void PooledLogicalPacket::SetData(const void *data, int dataLen, const void *data2, int dataLen2) { mDataLen = dataLen + dataLen2; - if (data != nullptr) + if (data != NULL) memcpy(mData, data, dataLen); - if (data2 != nullptr) + if (data2 != NULL) memcpy(mData + dataLen, data2, dataLen2); } @@ -3977,23 +3977,23 @@ void PooledLogicalPacket::SetData(const void *data, int dataLen, const void *dat /////////////////////////////////////////////////////////////////////////////////////////// WrappedLogicalPacket::WrappedLogicalPacket(UdpManager *udpManager) { - mPacket = nullptr; + mPacket = NULL; mUdpManager = udpManager; - mAvailableNext = nullptr; - mCreatedNext = nullptr; - mCreatedPrev = nullptr; + mAvailableNext = NULL; + mCreatedNext = NULL; + mCreatedPrev = NULL; mUdpManager->WrappedCreated(this); } WrappedLogicalPacket::~WrappedLogicalPacket() { - if (mUdpManager != nullptr) + if (mUdpManager != NULL) { mUdpManager->WrappedDestroyed(this); } - if (mPacket != nullptr) + if (mPacket != NULL) { mPacket->Release(); } @@ -4006,7 +4006,7 @@ void WrappedLogicalPacket::AddRef() const void WrappedLogicalPacket::Release() const { - if (mRefCount == 1 && mUdpManager != nullptr) + if (mRefCount == 1 && mUdpManager != NULL) mUdpManager->WrappedReturn(const_cast(this)); // if pool wants to keep us, it will inc our ref count, preventing our destruction // we cast off our const, as when we are added back to the pool, we can be modified LogicalPacket::Release(); @@ -4014,10 +4014,10 @@ void WrappedLogicalPacket::Release() const void WrappedLogicalPacket::SetLogicalPacket(const LogicalPacket *packet) { - if (mPacket != nullptr) + if (mPacket != NULL) mPacket->Release(); mPacket = packet; - if (mPacket != nullptr) + if (mPacket != NULL) mPacket->AddRef(); } @@ -4053,7 +4053,7 @@ UdpManager::SimulateQueueEntry::SimulateQueueEntry(const uchar *data, int dataLe memcpy(mData, data, dataLen); mIp = ip; mPort = port; - mNext = nullptr; + mNext = NULL; } UdpManager::SimulateQueueEntry::~SimulateQueueEntry() @@ -4088,7 +4088,7 @@ UdpMisc::ClockStamp UdpMisc::Clock() static ClockStamp sLastStamp = 0; static ClockStamp sCurrentCorrection = 0; struct timeval tv; - gettimeofday(&tv, nullptr); + gettimeofday(&tv, NULL); UdpMisc::ClockStamp cs = static_cast(tv.tv_sec) * 1000 + static_cast(tv.tv_usec / 1000); cs += sCurrentCorrection; if (cs < sLastStamp) @@ -4204,19 +4204,19 @@ void *UdpMisc::SmartResize(void *ptr, int bytes, int round) if (bytes == 0) { - if (ptr != nullptr) + if (ptr != NULL) { free((uchar *)ptr - cAlignment); } - return(nullptr); + return(NULL); } uchar *ptr2; - if (ptr == nullptr) + if (ptr == NULL) { ptr2 = (uchar *)malloc(bytes + cAlignment); - if (ptr2 == nullptr) - return(nullptr); + if (ptr2 == NULL) + return(NULL); *(int *)ptr2 = bytes; return(ptr2 + cAlignment); } @@ -4226,8 +4226,8 @@ void *UdpMisc::SmartResize(void *ptr, int bytes, int round) return(ptr); ptr2 = (uchar *)realloc((uchar *)ptr - cAlignment, bytes + cAlignment); - if (ptr2 == nullptr) - return(nullptr); + if (ptr2 == NULL) + return(NULL); *(int *)ptr2 = bytes; return(ptr2 + cAlignment); @@ -4290,30 +4290,30 @@ LogicalPacket *UdpMisc::CreateQuickLogicalPacket(const void *data, int dataLen, switch(q) { case 0: - tlp = new FixedLogicalPacket(nullptr, totalDataLen); + tlp = new FixedLogicalPacket(NULL, totalDataLen); break; case 1: - tlp = new FixedLogicalPacket(nullptr, totalDataLen); + tlp = new FixedLogicalPacket(NULL, totalDataLen); break; case 2: case 3: - tlp = new FixedLogicalPacket(nullptr, totalDataLen); + tlp = new FixedLogicalPacket(NULL, totalDataLen); break; case 4: case 5: case 6: case 7: - tlp = new FixedLogicalPacket(nullptr, totalDataLen); + tlp = new FixedLogicalPacket(NULL, totalDataLen); break; default: - tlp = new SimpleLogicalPacket(nullptr, totalDataLen); + tlp = new SimpleLogicalPacket(NULL, totalDataLen); break; } uchar *dest = (uchar *)tlp->GetDataPtr(); - if (data != nullptr) + if (data != NULL) memcpy(dest, data, dataLen); - if (data2 != nullptr) + if (data2 != NULL) memcpy(dest + dataLen, data2, dataLen2); return(tlp); } @@ -4327,7 +4327,7 @@ UdpIpAddress UdpMisc::GetHostByName(const char *hostName) { struct hostent * lphp; lphp = gethostbyname(hostName); - if (lphp == nullptr) + if (lphp == NULL) { address = 0; } diff --git a/external/3rd/library/udplibrary/UdpLibrary.hpp b/external/3rd/library/udplibrary/UdpLibrary.hpp index 39f05a43..43a20328 100644 --- a/external/3rd/library/udplibrary/UdpLibrary.hpp +++ b/external/3rd/library/udplibrary/UdpLibrary.hpp @@ -148,7 +148,7 @@ class UdpMisc // memory manager does a little bit of this, but if you know you have an allocation that is likely // to grow quite a bit, you can set the round'ing size up to a fairly large number and avoid // unnecessary reallocs at the cost of a little potentially wasted space - // initial allocations are done by passing in ptr==nullptr, freeing is done by passing in bytes==0 + // initial allocations are done by passing in ptr==NULL, freeing is done by passing in bytes==0 static void *SmartResize(void *ptr, int bytes, int round = 1); // the following two functions store values in the buffer as a variable length (B1, 0xffB2B1, 0xffffffB4B3B2B1) @@ -168,7 +168,7 @@ class UdpMisc static uint GetValue24(const void *buffer); // gets a 24-bit value from the buffer in big-endian format static ushort GetValue16(const void *buffer); // gets a 16-bit value from the buffer in big-endian format - static LogicalPacket *CreateQuickLogicalPacket(const void *data, int dataLen, const void *data2 = nullptr, int dataLen2 = 0); + static LogicalPacket *CreateQuickLogicalPacket(const void *data, int dataLen, const void *data2 = NULL, int dataLen2 = 0); // looks up the specified name and translates it to an IP address // this is a blocking call that can at times take a significant amount of time, but will generally be fast (less than 300ms) @@ -241,7 +241,7 @@ class LogicalPacket protected: friend class UdpReliableChannel; mutable const LogicalPacket *mReliableQueueNext; // owned/managed by the reliable channel object as an optimizations, do not touch - // nullptr = unclaimed, point-to-self = claimed, but end of list + // NULL = unclaimed, point-to-self = claimed, but end of list }; class SimpleLogicalPacket : public LogicalPacket @@ -250,7 +250,7 @@ class SimpleLogicalPacket : public LogicalPacket // it was originally created to allow the internal code to handle reliable data that was sent // via the Send(char *, int) api call. public: - SimpleLogicalPacket(const void *data, int dataLen); // data can be nullptr if you want to populate it after it is allocated (get the pointer and write to it) + SimpleLogicalPacket(const void *data, int dataLen); // data can be NULL if you want to populate it after it is allocated (get the pointer and write to it) virtual void *GetDataPtr(); virtual const void *GetDataPtr() const; virtual int GetDataLen() const; @@ -321,7 +321,7 @@ template class StructLogicalPacket : public LogicalPacket // with virtual functions) via this method as they may contain hidden data-members (such as pointers // to vtables). public: - StructLogicalPacket(T *initData = nullptr); + StructLogicalPacket(T *initData = NULL); virtual void *GetDataPtr(); virtual const void *GetDataPtr() const; virtual int GetDataLen() const; @@ -394,7 +394,7 @@ class PooledLogicalPacket : public LogicalPacket int mMaxDataLen; protected: friend class UdpManager; - void SetData(const void *data, int dataLen, const void *data2 = nullptr, int dataLen2 = 0); + void SetData(const void *data, int dataLen, const void *data2 = NULL, int dataLen2 = 0); UdpManager *mUdpManager; PooledLogicalPacket *mAvailableNext; PooledLogicalPacket *mCreatedNext; @@ -474,7 +474,7 @@ class UdpManager // pointer equal to your object and the UdpManager will call it as appropriate. The UdpConnection object // also has a handler mechanism that replaces the other callback functions below, see UdpConnection::SetHandler // if a handler is specified, the callback function is ignored, even if specified. - // default = nullptr (not used) + // default = NULL (not used) UdpManagerHandler *handler; // this is the maximum number of connections that can be established by this manager, any incoming/outgoing connections @@ -883,7 +883,7 @@ class UdpManager // will call EstablishConnection, then sit in a loop calling UdpManager::GiveTime and checking to see // if the status of the returned UdpConnection object is changed from cStatusNegotiating. This allows // the application to look for the ESC key or timeout an attempted connection. - // This function will return nullptr if the manager object has exceeded its maximum number of connections + // This function will return NULL if the manager object has exceeded its maximum number of connections // or if the serverAddress cannot be resolved to an IP address // as is noted in the declaration, it is the responsibility of the application establishing the connection to delete it // setting the timeout value (in milliseconds) to something greater than 0 will cause the UdpConnection object to change @@ -915,13 +915,13 @@ class UdpManager // manually forces all live connections to flush their multi buffers immediately void FlushAllMultiBuffer(); - // creates a logical packet and populates it with data. data can be nullptr, in which case it gives you logical packet + // creates a logical packet and populates it with data. data can be NULL, in which case it gives you logical packet // of the size specified, but copies no data into it. If you are using pool management (see Params::poolPacketMax), // it will give you a packet out of the pool if possible, otherwise it will create a packet for you. When logical // are packets are needed internally for various things (like reliable channel sends that use the (void *, int) interface) // they are gotten from this function, so your application can likely take advantage of pooling, even if it never bothers // to explicitly call this function. - LogicalPacket *CreatePacket(const void *data, int dataLen, const void *data2 = nullptr, int dataLen2 = 0); + LogicalPacket *CreatePacket(const void *data, int dataLen, const void *data2 = NULL, int dataLen2 = 0); protected: friend class PooledLogicalPacket; @@ -1147,7 +1147,7 @@ class UdpConnection : public PriorityQueueMember, public AddressHashTableMember, int ConnectionAge() const; // returns the UdpManager object that is managing this connection - // will return nullptr if the connection has been disconnected for some reason (because disconnecting severes the link to UdpManager) + // will return NULL if the connection has been disconnected for some reason (because disconnecting severes the link to UdpManager) UdpManager *GetUdpManager() const; // returns the 32-bit encryption-code that was negotiated as part of the connection-establishment process. @@ -1227,9 +1227,9 @@ class UdpConnection : public PriorityQueueMember, public AddressHashTableMember, friend class UdpManager; friend class UdpReliableChannel; - // note: if connectPacket is nullptr, that means this connection object is being created to establish + // note: if connectPacket is NULL, that means this connection object is being created to establish // a new connection to the specified ip/port (ie. the connection starts out in cStatusNegotiating mode) - // if connectPacket is non-nullptr, that menas this connection object is being created to handle an + // if connectPacket is non-NULL, that menas this connection object is being created to handle an // incoming connect request and it will start out in cStatusConnected mode. UdpConnection(UdpManager *udpManager, UdpIpAddress destIp, int destPort, int timeout); // starts connection-establishment protocol UdpConnection(UdpManager *udpManager, const UdpManager::PacketHistoryEntry *e); // starts already connected, replying to connection request @@ -1264,7 +1264,7 @@ class UdpConnection : public PriorityQueueMember, public AddressHashTableMember, void PhysicalSend(const uchar *data, int dataLen, bool appendAllowed); // sends a physical packet (encrypts and adds crc bytes) uchar *BufferedSend(const uchar *data, int dataLen, const uchar *data2, int dataLen2, bool appendAllowed); // buffers logical packets waiting til we have more data (makes multi-packets) bool InternalSend(UdpChannel channel, const LogicalPacket *packet); - bool InternalSend(UdpChannel channel, const uchar *data, int dataLen, const uchar *data2 = nullptr, int dataLen2 = 0); + bool InternalSend(UdpChannel channel, const uchar *data, int dataLen, const uchar *data2 = NULL, int dataLen2 = 0); uchar *InternalAckSend(uchar *bufferedAckPtr, const uchar *ackPtr, int ackLen); // used by reliable channel to send acks (special send that allows for deduping ack feature) @@ -1555,7 +1555,7 @@ class UdpReliableChannel void ProcessPacket(ReliablePacketMode mode, const uchar *data, int dataLen); bool PullDown(int windowSpaceLeft); void FlushCoalesce(); - void SendCoalesce(const uchar *data, int dataLen, const uchar *data2 = nullptr, int dataLen2 = 0); + void SendCoalesce(const uchar *data, int dataLen, const uchar *data2 = NULL, int dataLen2 = 0); void QueueLogicalPacket(const LogicalPacket *packet); UdpManager::ReliableConfig mConfig; @@ -1609,7 +1609,7 @@ class UdpReliableChannel template FixedLogicalPacket::FixedLogicalPacket(const void *data, int dataLen) { mDataLen = dataLen; - if (data != nullptr) + if (data != NULL) memcpy(mData, data, mDataLen); } @@ -1639,7 +1639,7 @@ template void FixedLogicalPacket::SetDataLen(int l ///////////////////////////////////////////////////////////////////////// template StructLogicalPacket::StructLogicalPacket(T *initData) { - if (initData != nullptr) + if (initData != NULL) mStruct = *initData; } @@ -1784,7 +1784,7 @@ inline void UdpManager::SetPriority(UdpConnection *con, UdpMisc::ClockStamp stam if (stamp < mMinimumScheduledStamp) stamp = mMinimumScheduledStamp; - if (mPriorityQueue != nullptr) + if (mPriorityQueue != NULL) mPriorityQueue->Add(con, stamp); } @@ -1811,7 +1811,7 @@ inline void UdpManager::PoolReturn(PooledLogicalPacket *packet) inline void UdpManager::WrappedReturn(WrappedLogicalPacket *wp) { - wp->SetLogicalPacket(nullptr); + wp->SetLogicalPacket(NULL); if (mWrappedAvailable < mParams.wrappedPoolMax) { @@ -1859,7 +1859,7 @@ inline void UdpConnection::ScheduleTimeNow() // prevents us from reprioritizing to 0, only to shortly thereafter be reprioritized to where we actually belong. if (!mGettingTime) { - if (mUdpManager != nullptr) + if (mUdpManager != NULL) mUdpManager->SetPriority(this, 0); } } @@ -2048,7 +2048,7 @@ inline int UdpReliableChannel::TotalPendingBytes() const inline void UdpReliableChannel::ClearBufferedAck() { - mBufferedAckPtr = nullptr; + mBufferedAckPtr = NULL; } inline udp_int64 UdpReliableChannel::GetReliableOutgoingId(int reliableStamp) const diff --git a/external/3rd/library/udplibrary/hashtable.hpp b/external/3rd/library/udplibrary/hashtable.hpp index f37a40e1..8c7340bc 100644 --- a/external/3rd/library/udplibrary/hashtable.hpp +++ b/external/3rd/library/udplibrary/hashtable.hpp @@ -175,11 +175,11 @@ template class HashTable bool Remove(T& obj, int hashValue); void Reset(); // removes all entries from the table - T *FindFirst(int hashValue) const; // returns nullptr if not found - T *FindNext(T *prevResult) const; // returns nullptr if not found + T *FindFirst(int hashValue) const; // returns NULL if not found + T *FindNext(T *prevResult) const; // returns NULL if not found - T *WalkFirst() const; // returns nullptr if not found - T *WalkNext(T *prevResult) const; // returns nullptr if not found + T *WalkFirst() const; // returns NULL if not found + T *WalkNext(T *prevResult) const; // returns NULL if not found void Resize(int hashSize); // the actual hash size will be rounded up to the next larger prime number (very slow, not recommended) void GetStatistics(HashTableStatistics *stats) const; @@ -201,7 +201,7 @@ template class HashTable template HashTable::HashTable(int hashSize) { - mTable = nullptr; + mTable = NULL; mTableSize = 0; mEntryCount = 0; mStatUsedSlots = 0; @@ -221,9 +221,9 @@ template void HashTable::Insert(T& obj, int hashValue) entry->hashValue = hashValue; int spot = ((unsigned)hashValue) % mTableSize; - if (mTable[spot] == nullptr) + if (mTable[spot] == NULL) { - entry->nextEntry = nullptr; + entry->nextEntry = NULL; mTable[spot] = entry; mStatUsedSlots++; } @@ -240,14 +240,14 @@ template bool HashTable::Remove(T& obj, int hashValue) int spot = ((unsigned)hashValue) % mTableSize; HashEntry* next = mTable[spot]; HashEntry** prev = &mTable[spot]; - while (next != nullptr) + while (next != NULL) { if (next->obj == obj && next->hashValue == hashValue) { *prev = next->nextEntry; delete next; mEntryCount--; - if (mTable[spot] == nullptr) + if (mTable[spot] == NULL) mStatUsedSlots--; return(true); break; @@ -264,17 +264,17 @@ template void HashTable::Reset() for (int spot = 0; spot < mTableSize; spot++) { HashEntry *curr = mTable[spot]; - if (curr != nullptr) + if (curr != NULL) { mStatUsedSlots--; - while (curr != nullptr) + while (curr != NULL) { HashEntry *next = curr->nextEntry; delete curr; mEntryCount--; curr = next; } - mTable[spot] = nullptr; + mTable[spot] = NULL; } } } @@ -282,13 +282,13 @@ template void HashTable::Reset() template T *HashTable::FindFirst(int hashValue) const { HashEntry *entry = mTable[((unsigned)hashValue) % mTableSize]; - while (entry != nullptr) + while (entry != NULL) { if (entry->hashValue == hashValue) return(&entry->obj); entry = entry->nextEntry; } - return(nullptr); + return(NULL); } template T *HashTable::FindNext(T *prevResult) const @@ -296,13 +296,13 @@ template T *HashTable::FindNext(T *prevResult) const HashEntry *entry = (HashEntry *)(((char *)prevResult) - offsetof(HashEntry, obj)); int hashValue = entry->hashValue; entry = entry->nextEntry; - while (entry != nullptr) + while (entry != NULL) { if (entry->hashValue == hashValue) return(&entry->obj); entry = entry->nextEntry; } - return(nullptr); + return(NULL); } template T *HashTable::WalkFirst() const @@ -310,10 +310,10 @@ template T *HashTable::WalkFirst() const for (int bucket = 0; bucket < mTableSize; bucket++) { HashEntry *entry = mTable[bucket]; - if (entry != nullptr) + if (entry != NULL) return(&entry->obj); } - return(nullptr); + return(NULL); } template T *HashTable::WalkNext(T *prevResult) const @@ -322,17 +322,17 @@ template T *HashTable::WalkNext(T *prevResult) const int bucket = ((unsigned)entry->hashValue) % mTableSize; entry = entry->nextEntry; - if (entry != nullptr) + if (entry != NULL) return(&entry->obj); bucket++; // go onto next bucket for (; bucket < mTableSize; bucket++) { HashEntry *entry = mTable[bucket]; - if (entry != nullptr) + if (entry != NULL) return(&entry->obj); } - return(nullptr); + return(NULL); } template void HashTable::Resize(int hashSize) @@ -352,16 +352,16 @@ template void HashTable::Resize(int hashSize) for (int i = 0; i < oldSize; i++) { HashEntry* next = oldTable[i]; - while (next != nullptr) + while (next != NULL) { HashEntry* hold = next; next = next->nextEntry; // insert hold into new table int spot = ((unsigned)hold->hashValue) % mTableSize; - if (mTable[spot] == nullptr) + if (mTable[spot] == NULL) { - hold->nextEntry = nullptr; + hold->nextEntry = NULL; mTable[spot] = hold; mStatUsedSlots++; } @@ -415,11 +415,11 @@ template class ObjectHashTable bool Remove(T obj, int hashValue); void Reset(); // removes all entries from the table - T FindFirst(int hashValue) const; // returns nullptr if not found - T FindNext(T prevResult) const; // returns nullptr if not found + T FindFirst(int hashValue) const; // returns NULL if not found + T FindNext(T prevResult) const; // returns NULL if not found - T WalkFirst() const; // returns nullptr if not found - T WalkNext(T prevResult) const; // returns nullptr if not found + T WalkFirst() const; // returns NULL if not found + T WalkNext(T prevResult) const; // returns NULL if not found void Resize(int hashSize); // the actual hash size will be rounded up to the next larger prime number (very slow, not recommended) void GetStatistics(HashTableStatistics *stats) const; @@ -434,7 +434,7 @@ template class ObjectHashTable template ObjectHashTable::ObjectHashTable(int hashSize) { - mTable = nullptr; + mTable = NULL; mTableSize = 0; mEntryCount = 0; mStatUsedSlots = 0; @@ -452,9 +452,9 @@ template void ObjectHashTable::Insert(T obj, int hashValue) obj->mHashValue = hashValue; int spot = ((unsigned)hashValue) % mTableSize; - if (mTable[spot] == nullptr) + if (mTable[spot] == NULL) { - obj->mHashNextEntry = nullptr; + obj->mHashNextEntry = NULL; mTable[spot] = obj; mStatUsedSlots++; } @@ -471,14 +471,14 @@ template bool ObjectHashTable::Remove(T obj, int hashValue) int spot = ((unsigned)hashValue) % mTableSize; T next = mTable[spot]; T *prev = &mTable[spot]; - while (next != nullptr) + while (next != NULL) { if (next == obj) { *prev = (T)next->mHashNextEntry; - next->mHashNextEntry = nullptr; + next->mHashNextEntry = NULL; mEntryCount--; - if (mTable[spot] == nullptr) + if (mTable[spot] == NULL) mStatUsedSlots--; return(true); break; @@ -495,16 +495,16 @@ template void ObjectHashTable::Reset() for (int spot = 0; spot < mTableSize; spot++) { T curr = mTable[spot]; - if (curr != nullptr) + if (curr != NULL) { - while (curr != nullptr) + while (curr != NULL) { T next = (T)curr->mHashNextEntry; - curr->mHashNextEntry = nullptr; + curr->mHashNextEntry = NULL; mEntryCount--; curr = next; } - mTable[spot] = nullptr; + mTable[spot] = NULL; mStatUsedSlots--; } } @@ -513,13 +513,13 @@ template void ObjectHashTable::Reset() template T ObjectHashTable::FindFirst(int hashValue) const { T entry = mTable[((unsigned)hashValue) % mTableSize]; - while (entry != nullptr) + while (entry != NULL) { if (entry->mHashValue == hashValue) return(entry); entry = (T)entry->mHashNextEntry; } - return(nullptr); + return(NULL); } template T ObjectHashTable::FindNext(T prevResult) const @@ -527,13 +527,13 @@ template T ObjectHashTable::FindNext(T prevResult) const T entry = prevResult; int hashValue = entry->mHashValue; entry = (T)entry->mHashNextEntry; - while (entry != nullptr) + while (entry != NULL) { if (entry->mHashValue == hashValue) return(entry); entry = (T)entry->mHashNextEntry; } - return(nullptr); + return(NULL); } template T ObjectHashTable::WalkFirst() const @@ -541,10 +541,10 @@ template T ObjectHashTable::WalkFirst() const for (int bucket = 0; bucket < mTableSize; bucket++) { T entry = mTable[bucket]; - if (entry != nullptr) + if (entry != NULL) return(entry); } - return(nullptr); + return(NULL); } template T ObjectHashTable::WalkNext(T prevResult) const @@ -553,17 +553,17 @@ template T ObjectHashTable::WalkNext(T prevResult) const int bucket = ((unsigned)entry->mHashValue) % mTableSize; entry = (T)entry->mHashNextEntry; - if (entry != nullptr) + if (entry != NULL) return(entry); bucket++; // go onto next bucket for (; bucket < mTableSize; bucket++) { entry = mTable[bucket]; - if (entry != nullptr) + if (entry != NULL) return(entry); } - return(nullptr); + return(NULL); } template void ObjectHashTable::Resize(int hashSize) @@ -583,16 +583,16 @@ template void ObjectHashTable::Resize(int hashSize) for (int i = 0; i < oldSize; i++) { T next = oldTable[i]; - while (next != nullptr) + while (next != NULL) { T hold = next; next = (T)next->mHashNextEntry; // insert hold into new table int spot = ((unsigned)hold->mHashValue) % mTableSize; - if (mTable[spot] == nullptr) + if (mTable[spot] == NULL) { - hold->mHashNextEntry = nullptr; + hold->mHashNextEntry = NULL; mTable[spot] = hold; mStatUsedSlots++; } diff --git a/external/3rd/library/udplibrary/priority.hpp b/external/3rd/library/udplibrary/priority.hpp index 516619db..19f34ab3 100644 --- a/external/3rd/library/udplibrary/priority.hpp +++ b/external/3rd/library/udplibrary/priority.hpp @@ -37,12 +37,12 @@ template class PriorityQueue PriorityQueue(int queueSize); ~PriorityQueue(); - T* Top(); // returns nullptr if queue is empty - T* TopRemove(); // returns nullptr if queue is empty - T* TopRemove(P priority); // removes item from queue if it has a lower priority value, otherwise return nullptr + T* Top(); // returns NULL if queue is empty + T* TopRemove(); // returns NULL if queue is empty + T* TopRemove(P priority); // removes item from queue if it has a lower priority value, otherwise return NULL T* Add(T* entry, P priority); // reprioritizes if already in queue, returns entry always T* Remove(T* entry); // returns entry always (even if it was not in the queue) - P *GetPriority(T* entry); // returns nullptr if entry is not in the queue + P *GetPriority(T* entry); // returns NULL if entry is not in the queue int QueueUsed(); // returns how many entries are in the queue protected: struct QueueEntry @@ -88,14 +88,14 @@ template PriorityQueue::~PriorityQueue() template T* PriorityQueue::Top() { if (mQueueEnd == 0) - return(nullptr); + return(NULL); return(mQueue[0].entry); } template T* PriorityQueue::TopRemove() { if (mQueueEnd == 0) - return(nullptr); + return(NULL); T* top = mQueue[0].entry; Remove(top); return(top); @@ -105,14 +105,14 @@ template T* PriorityQueue::TopRemove(P priority) { if (mQueueEnd > 0 && mQueue[0].priority <= priority) return(Remove(mQueue[0].entry)); - return(nullptr); + return(NULL); } template P* PriorityQueue::GetPriority(T* entry) { if (entry->mPriorityQueuePosition >= 0) return(&mQueue[entry->mPriorityQueuePosition].priority); - return(nullptr); + return(NULL); } template T* PriorityQueue::Add(T* entry, P priority) @@ -121,7 +121,7 @@ template T* PriorityQueue::Add(T* entry, P priorit { // not in queue, so add it to the bottom if (mQueueEnd >= mQueueSize) - return(nullptr); + return(NULL); mQueue[mQueueEnd].entry = entry; mQueue[mQueueEnd].priority = priority; mQueue[mQueueEnd].entry->mPriorityQueuePosition = mQueueEnd; diff --git a/external/3rd/library/udplibrary/udpclient.cpp b/external/3rd/library/udplibrary/udpclient.cpp index 9ed52d3e..9debac0e 100755 --- a/external/3rd/library/udplibrary/udpclient.cpp +++ b/external/3rd/library/udplibrary/udpclient.cpp @@ -106,7 +106,7 @@ int main(int argc, char **argv) printf("Connecting to: %s,%d.", connectIp, connectPort); UdpConnection *myConnection = myUdpManager->EstablishConnection(connectIp, connectPort); myConnection->SetHandler(&myConnectionHandler); - assert(myConnection != nullptr); + assert(myConnection != NULL); int count = 0; while (myConnection->GetStatus() == UdpConnection::cStatusNegotiating) { @@ -181,7 +181,7 @@ int main(int argc, char **argv) if (myConnection->TotalPendingBytes() == 0) { // send another packet - SimpleLogicalPacket *lp = new SimpleLogicalPacket(nullptr, 30000000); + SimpleLogicalPacket *lp = new SimpleLogicalPacket(NULL, 30000000); int dlen = lp->GetDataLen(); char *ptr = (char *)lp->GetDataPtr(); diff --git a/external/3rd/library/udplibrary/udpserver.cpp b/external/3rd/library/udplibrary/udpserver.cpp index c8641671..c523a05b 100755 --- a/external/3rd/library/udplibrary/udpserver.cpp +++ b/external/3rd/library/udplibrary/udpserver.cpp @@ -182,7 +182,7 @@ Player::~Player() { char hold[256]; printf("TERMINATE %s,%d \n", mConnection->GetDestinationIp().GetAddress(hold), mConnection->GetDestinationPort()); - mConnection->SetHandler(nullptr); + mConnection->SetHandler(NULL); mConnection->Disconnect(); mConnection->Release(); } diff --git a/external/ours/library/archive/src/shared/AutoDeltaVariableCallback.h b/external/ours/library/archive/src/shared/AutoDeltaVariableCallback.h index 34373722..ef0cc7fa 100755 --- a/external/ours/library/archive/src/shared/AutoDeltaVariableCallback.h +++ b/external/ours/library/archive/src/shared/AutoDeltaVariableCallback.h @@ -186,7 +186,7 @@ inline void AutoDeltaVariableCallback::se ValueType const tmp = this->get(); AutoDeltaVariable::set(source); - if (sourceObject != nullptr && tmp != source) + if (sourceObject != NULL && tmp != source) callback.modified(*sourceObject, tmp, source, true); } diff --git a/external/ours/library/archive/src/shared/ByteStream.cpp b/external/ours/library/archive/src/shared/ByteStream.cpp index 4965bc8c..2e19cb81 100755 --- a/external/ours/library/archive/src/shared/ByteStream.cpp +++ b/external/ours/library/archive/src/shared/ByteStream.cpp @@ -20,7 +20,7 @@ namespace Archive { @brief ReadIterator ctor Initializes the read position to zero, and the ByteStream member value - is nullptr + is NULL */ ReadIterator::ReadIterator() : readPtr(0), diff --git a/external/ours/library/archive/src/shared/ByteStream.h b/external/ours/library/archive/src/shared/ByteStream.h index a94aeb36..eda154d5 100755 --- a/external/ours/library/archive/src/shared/ByteStream.h +++ b/external/ours/library/archive/src/shared/ByteStream.h @@ -261,7 +261,7 @@ inline void ReadIterator::get(void * target, const unsigned long int readSize) } else { - static const char * const desc = "Archive::ReadIterator::get - read operation on nullptr stream object"; + static const char * const desc = "Archive::ReadIterator::get - read operation on null stream object"; ReadException ex(desc); throw (ex); } diff --git a/external/ours/library/crypto/src/shared/original/cryptlib.h b/external/ours/library/crypto/src/shared/original/cryptlib.h index fd258706..dbbc7fa7 100755 --- a/external/ours/library/crypto/src/shared/original/cryptlib.h +++ b/external/ours/library/crypto/src/shared/original/cryptlib.h @@ -440,7 +440,7 @@ public: //@{ //! returns whether this object allows attachment virtual bool Attachable() {return false;} - //! returns the object immediately attached to this object or nullptr for no attachment + //! returns the object immediately attached to this object or NULL for no attachment virtual BufferedTransformation *AttachedTransformation() {return 0;} //! virtual const BufferedTransformation *AttachedTransformation() const diff --git a/external/ours/library/crypto/src/shared/original/filters.cpp b/external/ours/library/crypto/src/shared/original/filters.cpp index 852a7b7f..7caaf21d 100755 --- a/external/ours/library/crypto/src/shared/original/filters.cpp +++ b/external/ours/library/crypto/src/shared/original/filters.cpp @@ -55,7 +55,7 @@ const byte *FilterWithBufferedInput::BlockQueue::GetBlock() return ptr; } else - return nullptr; + return NULL; } const byte *FilterWithBufferedInput::BlockQueue::GetContigousBlocks(unsigned int &numberOfBlocks) @@ -175,7 +175,7 @@ void FilterWithBufferedInput::Put(const byte *inString, unsigned int length) void FilterWithBufferedInput::MessageEnd(int propagation) { if (!m_firstInputDone && m_firstSize==0) - FirstPut(nullptr); + FirstPut(NULL); SecByteBlock temp(m_queue.CurrentSize()); m_queue.GetAll(temp); @@ -200,7 +200,7 @@ void FilterWithBufferedInput::ForceNextPut() // ************************************************************* ProxyFilter::ProxyFilter(Filter *filter, unsigned int firstSize, unsigned int lastSize, BufferedTransformation *outQ) - : FilterWithBufferedInput(firstSize, 1, lastSize, outQ), m_filter(filter), m_proxy(nullptr) + : FilterWithBufferedInput(firstSize, 1, lastSize, outQ), m_filter(filter), m_proxy(NULL) { if (m_filter.get()) m_filter->Attach(m_proxy = new OutputProxy(*this, false)); @@ -229,7 +229,7 @@ void ProxyFilter::SetFilter(Filter *filter) m_filter->Attach(temp.release()); } else - m_proxy=nullptr; + m_proxy=NULL; } void ProxyFilter::NextPut(const byte *s, unsigned int len) diff --git a/external/ours/library/crypto/src/shared/original/filters.h b/external/ours/library/crypto/src/shared/original/filters.h index b80c518a..6a2f0389 100755 --- a/external/ours/library/crypto/src/shared/original/filters.h +++ b/external/ours/library/crypto/src/shared/original/filters.h @@ -17,7 +17,7 @@ public: bool Attachable() {return true;} BufferedTransformation *AttachedTransformation() {return m_outQueue.get();} const BufferedTransformation *AttachedTransformation() const {return m_outQueue.get();} - void Detach(BufferedTransformation *newOut = nullptr); + void Detach(BufferedTransformation *newOut = NULL); protected: virtual void NotifyAttachmentChange() {} @@ -33,7 +33,7 @@ private: class TransparentFilter : public Filter { public: - TransparentFilter(BufferedTransformation *outQ=nullptr) : Filter(outQ) {} + TransparentFilter(BufferedTransformation *outQ=NULL) : Filter(outQ) {} void Put(byte inByte) {AttachedTransformation()->Put(inByte);} void Put(const byte *inString, unsigned int length) {AttachedTransformation()->Put(inString, length);} }; @@ -42,7 +42,7 @@ public: class OpaqueFilter : public Filter { public: - OpaqueFilter(BufferedTransformation *outQ=nullptr) : Filter(outQ) {} + OpaqueFilter(BufferedTransformation *outQ=NULL) : Filter(outQ) {} void Put(byte inByte) {} void Put(const byte *inString, unsigned int length) {} }; @@ -122,7 +122,7 @@ class StreamCipherFilter : public Filter { public: StreamCipherFilter(StreamCipher &c, - BufferedTransformation *outQueue = nullptr) + BufferedTransformation *outQueue = NULL) : cipher(c), Filter(outQueue) {} void Put(byte inByte) @@ -138,7 +138,7 @@ private: class HashFilter : public Filter { public: - HashFilter(HashModule &hm, BufferedTransformation *outQueue = nullptr, bool putMessage=false) + HashFilter(HashModule &hm, BufferedTransformation *outQueue = NULL, bool putMessage=false) : Filter(outQueue), m_hashModule(hm), m_putMessage(putMessage) {} void MessageEnd(int propagation=-1); @@ -163,7 +163,7 @@ public: }; enum Flags {HASH_AT_BEGIN=1, PUT_MESSAGE=2, PUT_HASH=4, PUT_RESULT=8, THROW_EXCEPTION=16}; - HashVerifier(HashModule &hm, BufferedTransformation *outQueue = nullptr, word32 flags = HASH_AT_BEGIN | PUT_RESULT); + HashVerifier(HashModule &hm, BufferedTransformation *outQueue = NULL, word32 flags = HASH_AT_BEGIN | PUT_RESULT); bool GetLastResult() const {return m_verified;} @@ -183,7 +183,7 @@ private: class SignerFilter : public Filter { public: - SignerFilter(RandomNumberGenerator &rng, const PK_Signer &signer, BufferedTransformation *outQueue = nullptr) + SignerFilter(RandomNumberGenerator &rng, const PK_Signer &signer, BufferedTransformation *outQueue = NULL) : m_rng(rng), m_signer(signer), m_messageAccumulator(signer.NewMessageAccumulator()), Filter(outQueue) {} void MessageEnd(int propagation); @@ -204,7 +204,7 @@ private: class VerifierFilter : public Filter { public: - VerifierFilter(const PK_Verifier &verifier, BufferedTransformation *outQueue = nullptr) + VerifierFilter(const PK_Verifier &verifier, BufferedTransformation *outQueue = NULL) : m_verifier(verifier), m_messageAccumulator(verifier.NewMessageAccumulator()) , m_signature(verifier.SignatureLength()), Filter(outQueue) {} @@ -244,11 +244,11 @@ extern BitBucket g_bitBucket; class Redirector : public Sink { public: - Redirector() : m_target(nullptr), m_passSignal(true) {} + Redirector() : m_target(NULL), m_passSignal(true) {} Redirector(BufferedTransformation &target, bool passSignal=true) : m_target(&target), m_passSignal(passSignal) {} void Redirect(BufferedTransformation &target) {m_target = ⌖} - void StopRedirect() {m_target = nullptr;} + void StopRedirect() {m_target = NULL;} bool GetPassSignal() const {return m_passSignal;} void SetPassSignal(bool passSignal) {m_passSignal = passSignal;} @@ -498,7 +498,7 @@ public: class GeneralSource : public Source { public: - GeneralSource(BufferedTransformation &store, bool pumpAll, BufferedTransformation *outQueue = nullptr) + GeneralSource(BufferedTransformation &store, bool pumpAll, BufferedTransformation *outQueue = NULL) : Source(outQueue), m_store(store) { if (pumpAll) PumpAll(); @@ -517,13 +517,13 @@ private: class StringSource : public Source { public: - StringSource(const char *string, bool pumpAll, BufferedTransformation *outQueue = nullptr); - StringSource(const byte *string, unsigned int length, bool pumpAll, BufferedTransformation *outQueue = nullptr); + StringSource(const char *string, bool pumpAll, BufferedTransformation *outQueue = NULL); + StringSource(const byte *string, unsigned int length, bool pumpAll, BufferedTransformation *outQueue = NULL); #ifdef __MWERKS__ // CW60 workaround - StringSource(const std::string &string, bool pumpAll, BufferedTransformation *outQueue = nullptr) + StringSource(const std::string &string, bool pumpAll, BufferedTransformation *outQueue = NULL) #else - template StringSource(const T &string, bool pumpAll, BufferedTransformation *outQueue = nullptr) + template StringSource(const T &string, bool pumpAll, BufferedTransformation *outQueue = NULL) #endif : Source(outQueue), m_store(string) { @@ -544,7 +544,7 @@ private: class RandomNumberSource : public Source { public: - RandomNumberSource(RandomNumberGenerator &rng, unsigned int length, bool pumpAll, BufferedTransformation *outQueue = nullptr); + RandomNumberSource(RandomNumberGenerator &rng, unsigned int length, bool pumpAll, BufferedTransformation *outQueue = NULL); unsigned long Pump(unsigned long pumpMax=ULONG_MAX) {return m_store.TransferTo(*AttachedTransformation(), pumpMax);} diff --git a/external/ours/library/crypto/src/shared/original/queue.cpp b/external/ours/library/crypto/src/shared/original/queue.cpp index 2fb3250a..b18c2b4a 100755 --- a/external/ours/library/crypto/src/shared/original/queue.cpp +++ b/external/ours/library/crypto/src/shared/original/queue.cpp @@ -152,7 +152,7 @@ void ByteQueue::CopyFrom(const ByteQueue ©) m_tail = m_tail->next; } - m_tail->next = nullptr; + m_tail->next = NULL; Put(copy.m_lazyString, copy.m_lazyLength); } diff --git a/external/ours/library/crypto/src/shared/original/smartptr.h b/external/ours/library/crypto/src/shared/original/smartptr.h index f5c0b41b..6a0595a1 100755 --- a/external/ours/library/crypto/src/shared/original/smartptr.h +++ b/external/ours/library/crypto/src/shared/original/smartptr.h @@ -9,7 +9,7 @@ NAMESPACE_BEGIN(CryptoPP) template class member_ptr { public: - explicit member_ptr(T *p = nullptr) : m_p(p) {} + explicit member_ptr(T *p = NULL) : m_p(p) {} ~member_ptr(); @@ -47,9 +47,9 @@ template class value_ptr : public member_ptr { public: value_ptr(const T &obj) : member_ptr(new T(obj)) {} - value_ptr(T *p = nullptr) : member_ptr(p) {} + value_ptr(T *p = NULL) : member_ptr(p) {} value_ptr(const value_ptr& rhs) - : member_ptr(rhs.m_p ? new T(*rhs.m_p) : nullptr) {} + : member_ptr(rhs.m_p ? new T(*rhs.m_p) : NULL) {} value_ptr& operator=(const value_ptr& rhs); bool operator==(const value_ptr& rhs) @@ -61,7 +61,7 @@ public: template value_ptr& value_ptr::operator=(const value_ptr& rhs) { T *old_p = this->m_p; - this->m_p = rhs.m_p ? new T(*rhs.m_p) : nullptr; + this->m_p = rhs.m_p ? new T(*rhs.m_p) : NULL; delete old_p; return *this; } @@ -72,9 +72,9 @@ template class clonable_ptr : public member_ptr { public: clonable_ptr(const T &obj) : member_ptr(obj.Clone()) {} - clonable_ptr(T *p = nullptr) : member_ptr(p) {} + clonable_ptr(T *p = NULL) : member_ptr(p) {} clonable_ptr(const clonable_ptr& rhs) - : member_ptr(rhs.m_p ? rhs.m_p->Clone() : nullptr) {} + : member_ptr(rhs.m_p ? rhs.m_p->Clone() : NULL) {} clonable_ptr& operator=(const clonable_ptr& rhs); }; @@ -82,7 +82,7 @@ public: template clonable_ptr& clonable_ptr::operator=(const clonable_ptr& rhs) { T *old_p = this->m_p; - this->m_p = rhs.m_p ? rhs.m_p->Clone() : nullptr; + this->m_p = rhs.m_p ? rhs.m_p->Clone() : NULL; delete old_p; return *this; } @@ -184,8 +184,8 @@ template class ConstructorTemp { protected: - ConstructorTemp(const ConstructorTemp ©) : m_temp(nullptr) {} - ConstructorTemp(T *t = nullptr) : m_temp(t) {} + ConstructorTemp(const ConstructorTemp ©) : m_temp(NULL) {} + ConstructorTemp(T *t = NULL) : m_temp(t) {} ConstructorTemp(const T &t) : m_temp(new T(t)) {} member_ptr m_temp; }; diff --git a/external/ours/library/crypto/src/shared/wrapper/TwofishCrypt.cpp b/external/ours/library/crypto/src/shared/wrapper/TwofishCrypt.cpp index 9a272ae3..0a88c460 100755 --- a/external/ours/library/crypto/src/shared/wrapper/TwofishCrypt.cpp +++ b/external/ours/library/crypto/src/shared/wrapper/TwofishCrypt.cpp @@ -84,7 +84,7 @@ void TwofishCrypt::process(const unsigned char * const inputBuffer, unsigned cha } assert( r == 0 ); // size must be a 16 byte block for Twofish to do it's job! } - assert(cipher != nullptr); // can't process data without a twofish encryptor or decryptor! + assert(cipher != NULL); // can't process data without a twofish encryptor or decryptor! } //----------------------------------------------------------------------- diff --git a/external/ours/library/fileInterface/src/shared/AbstractFile.cpp b/external/ours/library/fileInterface/src/shared/AbstractFile.cpp index ef76c7cf..dd575c36 100755 --- a/external/ours/library/fileInterface/src/shared/AbstractFile.cpp +++ b/external/ours/library/fileInterface/src/shared/AbstractFile.cpp @@ -15,7 +15,7 @@ namespace AbstractFileNamespace { - AbstractFile::AudioServeFunction s_audioServeFunction = nullptr; + AbstractFile::AudioServeFunction s_audioServeFunction = NULL; } using namespace AbstractFileNamespace; @@ -51,7 +51,7 @@ void AbstractFile::flush() byte *AbstractFile::readEntireFileAndClose() { - if (s_audioServeFunction != nullptr) + if (s_audioServeFunction != NULL) (*s_audioServeFunction)(); seek(SeekBegin, 0); @@ -84,7 +84,7 @@ int AbstractFile::getZlibCompressedLength() const void AbstractFile::getZlibCompressedDataAndClose(byte *& compressedBuffer, int & compressedBufferLength) { - compressedBuffer = nullptr; + compressedBuffer = NULL; compressedBufferLength = -1; } diff --git a/external/ours/library/fileInterface/src/shared/AbstractFile.h b/external/ours/library/fileInterface/src/shared/AbstractFile.h index 62c4f804..0f649d1e 100755 --- a/external/ours/library/fileInterface/src/shared/AbstractFile.h +++ b/external/ours/library/fileInterface/src/shared/AbstractFile.h @@ -110,7 +110,7 @@ public: * Read the entire file into a memory buffer. The client is responsible for deleting the buffer * using operator delete(). The file will be closed after the read completes. * - * @return nullptr if an error occured + * @return null if an error occured */ virtual unsigned char *readEntireFileAndClose(); diff --git a/external/ours/library/fileInterface/src/shared/StdioFile.cpp b/external/ours/library/fileInterface/src/shared/StdioFile.cpp index bb890dfa..1e7225ed 100755 --- a/external/ours/library/fileInterface/src/shared/StdioFile.cpp +++ b/external/ours/library/fileInterface/src/shared/StdioFile.cpp @@ -35,7 +35,7 @@ void StdioFile::close() if(m_file) { fclose(m_file); - m_file = nullptr; + m_file = NULL; } } @@ -43,7 +43,7 @@ void StdioFile::close() bool StdioFile::isOpen() const { - return m_file != nullptr; + return m_file != NULL; } // ---------------------------------------------------------------------- @@ -71,7 +71,7 @@ int StdioFile::tell() const bool StdioFile::seek(SeekType seekType, int offset) { - assert(m_file != nullptr); + assert(m_file != NULL); m_justWrote = false; int result = 0; @@ -97,7 +97,7 @@ bool StdioFile::seek(SeekType seekType, int offset) int StdioFile::read(void* dest_buffer, int num_bytes) { - assert(m_file != nullptr); + assert(m_file != NULL); resyncStream(); return static_cast(fread(dest_buffer, 1, static_cast(num_bytes), m_file)); } @@ -106,7 +106,7 @@ int StdioFile::read(void* dest_buffer, int num_bytes) int StdioFile::write(int num_bytes, const void* source_buffer) { - assert(m_file != nullptr); + assert(m_file != NULL); m_justWrote = true; return static_cast(fwrite(source_buffer, 1, static_cast(num_bytes), m_file)); } @@ -115,7 +115,7 @@ int StdioFile::write(int num_bytes, const void* source_buffer) void StdioFile::flush() { - assert(m_file != nullptr); + assert(m_file != NULL); fflush(m_file); m_justWrote = false; } @@ -136,9 +136,9 @@ void StdioFile::resyncStream() AbstractFile* StdioFileFactory::createFile(const char *fileName, const char *openType) { if(!fileName || !openType) - return nullptr; + return NULL; else if (fileName[0] == '\0' || openType[0] == '\0') - return nullptr; + return NULL; else return new StdioFile(fileName, openType); } diff --git a/external/ours/library/localization/src/shared/LocalizationManager.cpp b/external/ours/library/localization/src/shared/LocalizationManager.cpp index e7b106ca..518bf42b 100755 --- a/external/ours/library/localization/src/shared/LocalizationManager.cpp +++ b/external/ours/library/localization/src/shared/LocalizationManager.cpp @@ -77,8 +77,8 @@ using namespace LocalizationManagerNamespace; //---------------------------------------------------------------------- bool LocalizationManager::ms_installed = 0; -LocalizationManager::LocalizationManagerHashMap * LocalizationManager::ms_singletonHashMap = nullptr; -Unicode::NarrowString * LocalizationManager::ms_firstLocaleLoaded = nullptr; +LocalizationManager::LocalizationManagerHashMap * LocalizationManager::ms_singletonHashMap = NULL; +Unicode::NarrowString * LocalizationManager::ms_firstLocaleLoaded = NULL; //----------------------------------------------------------------- @@ -103,7 +103,7 @@ m_displayBadStringIds (displayBadStringIds) m_usingEnglishLocale = false; } - assert (m_fileFactory != nullptr);//lint !e1924 // c-style cast. MSVC bug + assert (m_fileFactory != NULL);//lint !e1924 // c-style cast. MSVC bug } //----------------------------------------------------------------- @@ -181,23 +181,23 @@ void LocalizationManager::install (AbstractFileFactory * fileFactory, Unicode::U void LocalizationManager::remove () { assert (ms_installed);//lint !e1924 // c-style cast. MSVC bug - assert (ms_singletonHashMap != nullptr);//lint !e1924 // c-style cast. MSVC bug - assert (ms_firstLocaleLoaded != nullptr); + assert (ms_singletonHashMap != NULL);//lint !e1924 // c-style cast. MSVC bug + assert (ms_firstLocaleLoaded != NULL); LocalizationManagerHashMap::iterator end = ms_singletonHashMap->end(); for (LocalizationManagerHashMap::iterator it = ms_singletonHashMap->begin(); it != end; ++it) { LocalizationManager * current = (*it).second; - (*it).second = nullptr; + (*it).second = NULL; delete current; } ms_singletonHashMap->clear(); delete ms_singletonHashMap; - ms_singletonHashMap = nullptr; + ms_singletonHashMap = NULL; delete ms_firstLocaleLoaded; - ms_firstLocaleLoaded = nullptr; + ms_firstLocaleLoaded = NULL; ms_installed = false; } @@ -277,7 +277,7 @@ LocalizedStringTable * LocalizationManager::fetchStringTable(const Unicode::Narr if(find_iter != stmap.end ()) { TimedStringTable & tst = (*find_iter).second; - //-- this can be nullptr + //-- this can be null table = tst.second; tst.first = time(0); } diff --git a/external/ours/library/localization/src/shared/LocalizedString.cpp b/external/ours/library/localization/src/shared/LocalizedString.cpp index de996f95..88817b83 100755 --- a/external/ours/library/localization/src/shared/LocalizedString.cpp +++ b/external/ours/library/localization/src/shared/LocalizedString.cpp @@ -193,10 +193,10 @@ LocalizedString * LocalizedString::load_0000 (AbstractFile & fl) if (!fl.read (&buflen, sizeof (id_type))) return 0; - // buflen does not include nullptr terminator + // buflen does not include null terminator Unicode::unicode_char_t * buf = new Unicode::unicode_char_t [buflen+1]; - assert (buf != nullptr); //lint !e1924 // c-style cast. MSVC bug + assert (buf != NULL); //lint !e1924 // c-style cast. MSVC bug buf [buflen] = 0; @@ -214,7 +214,7 @@ LocalizedString * LocalizedString::load_0000 (AbstractFile & fl) // TODO: Localized strings are stored little endian! loc_str = new LocalizedString(id, buf); - assert (loc_str != nullptr); //lint !e1924 // c-style cast. MSVC bug + assert (loc_str != NULL); //lint !e1924 // c-style cast. MSVC bug loc_str->resetLineCounts (); @@ -247,10 +247,10 @@ LocalizedString * LocalizedString::load_0001 (AbstractFile & fl) if (!fl.read (&buflen, sizeof (id_type))) return 0; - // buflen does not include nullptr terminator + // buflen does not include null terminator Unicode::unicode_char_t * buf = new Unicode::unicode_char_t [buflen+1]; - assert (buf != nullptr); //lint !e1924 // c-style cast. MSVC bug + assert (buf != NULL); //lint !e1924 // c-style cast. MSVC bug buf [buflen] = 0; @@ -268,7 +268,7 @@ LocalizedString * LocalizedString::load_0001 (AbstractFile & fl) // TODO: Localized strings are stored little endian! loc_str = new LocalizedString(id, crcSource, buf); - assert (loc_str != nullptr); //lint !e1924 // c-style cast. MSVC bug + assert (loc_str != NULL); //lint !e1924 // c-style cast. MSVC bug loc_str->resetLineCounts (); diff --git a/external/ours/library/localization/src/shared/LocalizedStringTable.cpp b/external/ours/library/localization/src/shared/LocalizedStringTable.cpp index e0519d6e..10ab6c60 100755 --- a/external/ours/library/localization/src/shared/LocalizedStringTable.cpp +++ b/external/ours/library/localization/src/shared/LocalizedStringTable.cpp @@ -187,10 +187,10 @@ bool LocalizedStringTable::load_0000 (AbstractFile & fl) if (!fl.read (&buflen, sizeof (LocalizedString::id_type))) return false; - // buflen does not include nullptr terminator + // buflen does not include null terminator char * buf = new char [buflen+1]; - assert (buf != nullptr); //lint !e1924 // c-style cast. MSVC bug + assert (buf != NULL); //lint !e1924 // c-style cast. MSVC bug buf [buflen] = 0; @@ -276,10 +276,10 @@ bool LocalizedStringTable::load_0001(AbstractFile & fl) if (!fl.read (&buflen, sizeof (LocalizedString::id_type))) return false; - // buflen does not include nullptr terminator + // buflen does not include null terminator char * buf = new char [buflen+1]; - assert (buf != nullptr); //lint !e1924 // c-style cast. MSVC bug + assert (buf != NULL); //lint !e1924 // c-style cast. MSVC bug buf [buflen] = 0; @@ -333,7 +333,7 @@ LocalizedStringTable *LocalizedStringTable::load (AbstractFileFactory & fileFact { case 0: table = new LocalizedStringTable (filename); - assert (table != nullptr); //lint !e1924 // c-style cast. MSVC bug + assert (table != NULL); //lint !e1924 // c-style cast. MSVC bug if (table->load_0000 (*fl) == false) { @@ -344,7 +344,7 @@ LocalizedStringTable *LocalizedStringTable::load (AbstractFileFactory & fileFact case 1: table = new LocalizedStringTable (filename); - assert (table != nullptr); //lint !e1924 // c-style cast. MSVC bug + assert (table != NULL); //lint !e1924 // c-style cast. MSVC bug if (table->load_0001 (*fl) == false) { diff --git a/external/ours/library/localization/src/shared/LocalizedStringTableReaderWriter.cpp b/external/ours/library/localization/src/shared/LocalizedStringTableReaderWriter.cpp index e7dfbf27..19e95784 100755 --- a/external/ours/library/localization/src/shared/LocalizedStringTableReaderWriter.cpp +++ b/external/ours/library/localization/src/shared/LocalizedStringTableReaderWriter.cpp @@ -126,7 +126,7 @@ bool LocalizedStringTableRW::str_write(AbstractFile & fl, LocalizedString & locs // TODO: swab this buffer Unicode::unicode_char_t * buf = new Unicode::unicode_char_t [buflen+1]; - assert (buf != nullptr); //lint !e1924 // c-style cast. MSVC bug + assert (buf != NULL); //lint !e1924 // c-style cast. MSVC bug buf [buflen] = 0; memcpy (buf, locstr.m_str.c_str (), sizeof (Unicode::unicode_char_t) * buflen); @@ -183,7 +183,7 @@ bool LocalizedStringTableRW::write(AbstractFile & fl) const char * buf = new char [buflen + 1]; - assert (buf != nullptr); //lint !e1924 // c-style cast. MSVC bug + assert (buf != NULL); //lint !e1924 // c-style cast. MSVC bug buf [buflen] = 0; @@ -230,7 +230,7 @@ LocalizedStringTableRW *LocalizedStringTableRW::loadRW (AbstractFileFactory & fi { case 0: table = new LocalizedStringTableRW (filename); - assert (table != nullptr); //lint !e1924 // c-style cast. MSVC bug + assert (table != NULL); //lint !e1924 // c-style cast. MSVC bug if (table->load_0000 (*fl) == false) { @@ -241,7 +241,7 @@ LocalizedStringTableRW *LocalizedStringTableRW::loadRW (AbstractFileFactory & fi case 1: table = new LocalizedStringTableRW (filename); - assert (table != nullptr); //lint !e1924 // c-style cast. MSVC bug + assert (table != NULL); //lint !e1924 // c-style cast. MSVC bug if (table->load_0001 (*fl) == false) { @@ -336,7 +336,7 @@ LocalizedString * LocalizedStringTableRW::addString (const Unicode::String & st { LocalizedString * const locstr = (m_map [m_nextUniqueId] = new LocalizedString (m_nextUniqueId, int(time(0)), str)); - assert (locstr != nullptr); //lint !e1924 // c-style cast. MSVC bug + assert (locstr != NULL); //lint !e1924 // c-style cast. MSVC bug char buf[64]; sprintf (buf, "%03ld_default", m_nextUniqueId); @@ -538,7 +538,7 @@ void LocalizedStringTableRW::prepareTable (const LocalizedStringTableRW & rhs) LocalizedString * locstr = new LocalizedString (rhs_locstr->m_id, 0, rhs_locstr->m_str); - assert (locstr != nullptr); //lint !e1924 // c-style cast. MSVC bug + assert (locstr != NULL); //lint !e1924 // c-style cast. MSVC bug m_map.insert (Map_t::value_type (locstr->getId (), locstr )); } } diff --git a/external/ours/library/singleton/src/shared/Singleton2.h b/external/ours/library/singleton/src/shared/Singleton2.h index 1b42905d..130d0cd7 100755 --- a/external/ours/library/singleton/src/shared/Singleton2.h +++ b/external/ours/library/singleton/src/shared/Singleton2.h @@ -138,7 +138,7 @@ inline Singleton2::Singleton2() template inline Singleton2::~Singleton2() { - assert(instance != nullptr); + assert(instance != NULL); instance = 0; } @@ -165,7 +165,7 @@ inline Singleton2::~Singleton2() template inline ValueType & Singleton2::getInstance() { - assert(instance != nullptr); + assert(instance != NULL); return *instance; } diff --git a/external/ours/library/unicode/src/shared/UnicodeCharacterDataMap.cpp b/external/ours/library/unicode/src/shared/UnicodeCharacterDataMap.cpp index 6206b680..3f67e74a 100755 --- a/external/ours/library/unicode/src/shared/UnicodeCharacterDataMap.cpp +++ b/external/ours/library/unicode/src/shared/UnicodeCharacterDataMap.cpp @@ -218,7 +218,7 @@ CharDataMap::ErrorCode CharDataMap::generateMapFromBuffer (const Unicode::Blocks { CharData * data = new CharData; - assert (data != nullptr); //lint !e1924 // c-style cast. MSVC bug + assert (data != NULL); //lint !e1924 // c-style cast. MSVC bug data->m_reverseCase = 0; @@ -244,7 +244,7 @@ CharDataMap::ErrorCode CharDataMap::generateMapFromBuffer (const Unicode::Blocks m_contiguousData = new CharData [validChars]; - assert (m_contiguousData != nullptr); //lint !e1924 // c-style cast. MSVC bug + assert (m_contiguousData != NULL); //lint !e1924 // c-style cast. MSVC bug size_t dataIndex = 0; @@ -288,7 +288,7 @@ CharDataMap::ErrorCode CharDataMap::generateMap (const Unicode::Blocks::Mapping char * buffer = new char [fileLen + 1]; buffer [fileLen] = 0; - assert (buffer != nullptr); //lint !e1924 // c-style cast. MSVC bug + assert (buffer != NULL); //lint !e1924 // c-style cast. MSVC bug if (fread (buffer, fileLen, 1, fl) != 1) { diff --git a/external/ours/library/unicode/src/shared/UnicodeCharacterDataMap.h b/external/ours/library/unicode/src/shared/UnicodeCharacterDataMap.h index 7659b543..ba84cac2 100755 --- a/external/ours/library/unicode/src/shared/UnicodeCharacterDataMap.h +++ b/external/ours/library/unicode/src/shared/UnicodeCharacterDataMap.h @@ -117,7 +117,7 @@ namespace Unicode /** * Find a CharData for the given code point. - * @return nullptr if no CharData exists for this code point + * @return null if no CharData exists for this code point */ inline const CharData * CharDataMap::findCharData (const unicode_char_t code) const diff --git a/external/ours/library/unicode/src/shared/UnicodeUtils.cpp b/external/ours/library/unicode/src/shared/UnicodeUtils.cpp index 7bf90e7d..4417fc0c 100755 --- a/external/ours/library/unicode/src/shared/UnicodeUtils.cpp +++ b/external/ours/library/unicode/src/shared/UnicodeUtils.cpp @@ -103,7 +103,7 @@ namespace Unicode } else if (*from == 0x0000) { - // nullptr character + // null character str += static_cast(0x0000); } else if (*from >= 0x0800) diff --git a/external/ours/library/unicode/src/shared/UnicodeUtils.h b/external/ours/library/unicode/src/shared/UnicodeUtils.h index 348bb64f..f2a722ae 100755 --- a/external/ours/library/unicode/src/shared/UnicodeUtils.h +++ b/external/ours/library/unicode/src/shared/UnicodeUtils.h @@ -79,8 +79,8 @@ namespace Unicode bool getNthToken (const Unicode::NarrowString & str, const size_t n, size_t & pos, size_t & endpos, Unicode::NarrowString & token, const char * sepChars = ascii_whitespace); size_t skipWhitespace (const Unicode::NarrowString & str, size_t pos, const char * white = ascii_whitespace); - bool tokenize (const Unicode::String & theStr, UnicodeStringVector & result, Unicode::String const * const delimiters = nullptr, Unicode::String const * const separators = nullptr); - bool tokenize (const Unicode::String & theStr, UnicodeStringVector & result, const size_t tokenPos, size_t & whichToken, size_t & token_start, size_t & token_end, Unicode::String const * const delimiters = nullptr, Unicode::String const * const separators = nullptr); + bool tokenize (const Unicode::String & theStr, UnicodeStringVector & result, Unicode::String const * const delimiters = NULL, Unicode::String const * const separators = NULL); + bool tokenize (const Unicode::String & theStr, UnicodeStringVector & result, const size_t tokenPos, size_t & whichToken, size_t & token_start, size_t & token_end, Unicode::String const * const delimiters = NULL, Unicode::String const * const separators = NULL); bool isUnicode (const Unicode::String & theStr); diff --git a/external/ours/library/unicode/src/shared/utf8.cpp b/external/ours/library/unicode/src/shared/utf8.cpp index 3a19d82a..75901043 100755 --- a/external/ours/library/unicode/src/shared/utf8.cpp +++ b/external/ours/library/unicode/src/shared/utf8.cpp @@ -96,7 +96,7 @@ int UTF8_convertCharToUTF16( char * ptr , UTF16 * ret ) int UTF8_convertToUTF16( char * ptr , UTF16 * ret, int limit ) { int len = 0; - while (( *ptr != 0 ) && ( len < ( limit - 1 ) ))//we use limit -1 to leave room for the nullptr terminator + while (( *ptr != 0 ) && ( len < ( limit - 1 ) ))//we use limit -1 to leave room for the null terminator { int clen = UTF8_convertCharToUTF16( ptr, ret ); if (clen == 0) diff --git a/game/server/application/SwgDatabaseServer/src/linux/main.cpp b/game/server/application/SwgDatabaseServer/src/linux/main.cpp index 71cc11b2..9878eed1 100755 --- a/game/server/application/SwgDatabaseServer/src/linux/main.cpp +++ b/game/server/application/SwgDatabaseServer/src/linux/main.cpp @@ -43,7 +43,7 @@ int main(int argc, char ** argv) SetupSharedFoundation::install (setupFoundationData); SetupSharedFile::install(false); - SetupSharedRandom::install(time(nullptr)); + SetupSharedRandom::install(time(NULL)); SetupSharedNetwork::SetupData networkSetupData; SetupSharedNetwork::getDefaultServerSetupData(networkSetupData); SetupSharedNetwork::install(networkSetupData); diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/AuctionLocationsBuffer.cpp b/game/server/application/SwgDatabaseServer/src/shared/buffers/AuctionLocationsBuffer.cpp index ec5603db..c0baa227 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/AuctionLocationsBuffer.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/buffers/AuctionLocationsBuffer.cpp @@ -30,7 +30,7 @@ AuctionLocationsBuffer::~AuctionLocationsBuffer(void) for (IndexType::iterator i=m_rows.begin(); i!=m_rows.end(); ++i) { delete i->second; - i->second=nullptr; + i->second=NULL; } } @@ -56,7 +56,7 @@ void AuctionLocationsBuffer::removeAuctionLocations(const NetworkId &locationId) if (i!=m_rows.end()) { delete i->second; - i->second=nullptr; + i->second=NULL; m_rows.erase(i); } } diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/BattlefieldParticipantBuffer.cpp b/game/server/application/SwgDatabaseServer/src/shared/buffers/BattlefieldParticipantBuffer.cpp index 41038e8a..7abc8164 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/BattlefieldParticipantBuffer.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/buffers/BattlefieldParticipantBuffer.cpp @@ -30,7 +30,7 @@ BattlefieldParticipantBuffer::~BattlefieldParticipantBuffer(void) for (IndexType::iterator i=m_rows.begin(); i!=m_rows.end(); ++i) { delete i->second; - i->second=nullptr; + i->second=NULL; } } @@ -156,7 +156,7 @@ void BattlefieldParticipantBuffer::removeObject(const NetworkId &object) IndexType::iterator next=i; ++next; delete i->second; - i->second=nullptr; + i->second=NULL; m_rows.erase(i); i=next; } diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/BountyHunterTargetBuffer.cpp b/game/server/application/SwgDatabaseServer/src/shared/buffers/BountyHunterTargetBuffer.cpp index 16d361fe..4098e2c3 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/BountyHunterTargetBuffer.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/buffers/BountyHunterTargetBuffer.cpp @@ -31,7 +31,7 @@ BountyHunterTargetBuffer::~BountyHunterTargetBuffer() for (DataType::iterator i=m_data.begin(); i!=m_data.end(); ++i) { delete i->second; - i->second=nullptr; + i->second=NULL; } } diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/CreatureObjectBuffer.cpp b/game/server/application/SwgDatabaseServer/src/shared/buffers/CreatureObjectBuffer.cpp index 92dcbbfd..10556590 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/CreatureObjectBuffer.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/buffers/CreatureObjectBuffer.cpp @@ -238,7 +238,7 @@ void CreatureObjectBuffer::getAttributesForObject(const NetworkId &objectId, std } if (value == -999) { - WARNING(true,("Object %s had nullptr attribute %i, defaulting to 100",objectId.getValueString().c_str(), position)); + WARNING(true,("Object %s had null attribute %i, defaulting to 100",objectId.getValueString().c_str(), position)); value = 100; } diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/ExperienceBuffer.cpp b/game/server/application/SwgDatabaseServer/src/shared/buffers/ExperienceBuffer.cpp index ffd4068f..5c361b16 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/ExperienceBuffer.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/buffers/ExperienceBuffer.cpp @@ -31,7 +31,7 @@ ExperienceBuffer::~ExperienceBuffer(void) for (IndexType::iterator i=m_rows.begin(); i!=m_rows.end(); ++i) { delete i->second; - i->second=nullptr; + i->second=NULL; } } @@ -157,7 +157,7 @@ void ExperienceBuffer::removeObject(const NetworkId &object) IndexType::iterator next=i; ++next; delete i->second; - i->second=nullptr; + i->second=NULL; m_rows.erase(i); i=next; } diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/IndexedNetworkTableBuffer.h b/game/server/application/SwgDatabaseServer/src/shared/buffers/IndexedNetworkTableBuffer.h index 65ba2205..5180b92a 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/IndexedNetworkTableBuffer.h +++ b/game/server/application/SwgDatabaseServer/src/shared/buffers/IndexedNetworkTableBuffer.h @@ -103,7 +103,7 @@ IndexedNetworkTableBuffer::~IndexedNetworkTable { delete i->second; ++m_sRowsDeleted; - i->second=nullptr; + i->second=NULL; } } @@ -161,7 +161,7 @@ void IndexedNetworkTableBuffer::removeObject(co { delete i->second; ++m_sRowsDeleted; - i->second=nullptr; + i->second=NULL; m_rows.erase(i); } } diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/ManufactureSchematicAttributeBuffer.cpp b/game/server/application/SwgDatabaseServer/src/shared/buffers/ManufactureSchematicAttributeBuffer.cpp index 487169ef..12c4e790 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/ManufactureSchematicAttributeBuffer.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/buffers/ManufactureSchematicAttributeBuffer.cpp @@ -31,7 +31,7 @@ ManufactureSchematicAttributeBuffer::~ManufactureSchematicAttributeBuffer(void) for (IndexType::iterator i=m_rows.begin(); i!=m_rows.end(); ++i) { delete i->second; - i->second=nullptr; + i->second=NULL; } } @@ -174,7 +174,7 @@ void ManufactureSchematicAttributeBuffer::removeObject(const NetworkId &object) IndexType::iterator next=i; ++next; delete i->second; - i->second=nullptr; + i->second=NULL; m_rows.erase(i); i=next; } diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/MarketAuctionBidsBuffer.cpp b/game/server/application/SwgDatabaseServer/src/shared/buffers/MarketAuctionBidsBuffer.cpp index 65d95c48..3a024651 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/MarketAuctionBidsBuffer.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/buffers/MarketAuctionBidsBuffer.cpp @@ -31,7 +31,7 @@ MarketAuctionBidsBuffer::~MarketAuctionBidsBuffer(void) for (IndexType::iterator i=m_rows.begin(); i!=m_rows.end(); ++i) { delete i->second; - i->second=nullptr; + i->second=NULL; } } @@ -57,7 +57,7 @@ void MarketAuctionBidsBuffer::removeMarketAuctionBids(const NetworkId &itemId) if (i!=m_rows.end()) { delete i->second; - i->second=nullptr; + i->second=NULL; m_rows.erase(i); } } diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/MarketAuctionsBuffer.cpp b/game/server/application/SwgDatabaseServer/src/shared/buffers/MarketAuctionsBuffer.cpp index b8529107..8663d1ef 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/MarketAuctionsBuffer.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/buffers/MarketAuctionsBuffer.cpp @@ -31,7 +31,7 @@ MarketAuctionsBufferCreate::~MarketAuctionsBufferCreate(void) for (IndexType::iterator i=m_rows.begin(); i!=m_rows.end(); ++i) { delete i->second; - i->second=nullptr; + i->second=NULL; } } @@ -217,7 +217,7 @@ MarketAuctionsBufferDelete::~MarketAuctionsBufferDelete(void) for (IndexType::iterator i=m_rows.begin(); i!=m_rows.end(); ++i) { delete i->second; - i->second=nullptr; + i->second=NULL; } } @@ -330,7 +330,7 @@ MarketAuctionsBufferUpdate::~MarketAuctionsBufferUpdate(void) for (IndexType::iterator i=m_rows.begin(); i!=m_rows.end(); ++i) { delete i->second; - i->second=nullptr; + i->second=NULL; } } diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/ObjectTableBuffer.cpp b/game/server/application/SwgDatabaseServer/src/shared/buffers/ObjectTableBuffer.cpp index b3d787d0..4491b654 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/ObjectTableBuffer.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/buffers/ObjectTableBuffer.cpp @@ -265,11 +265,11 @@ bool ObjectTableBuffer::save(DB::Session *session) #if 0 // Enable this to debug load_with problems DEBUG_REPORT_LOG(true,("Save object %s ",i->second->object_id.getValue().getValueString().c_str())); if (i->second->contained_by.isNull()) - DEBUG_REPORT_LOG(true, ("contained_by nullptr ")); + DEBUG_REPORT_LOG(true, ("contained_by NULL ")); else DEBUG_REPORT_LOG(true, ("contained_by %s ",i->second->contained_by.getValue().getValueString().c_str())); if (i->second->load_with.isNull()) - DEBUG_REPORT_LOG(true,("load_with nullptr\n")); + DEBUG_REPORT_LOG(true,("load_with NULL\n")); else DEBUG_REPORT_LOG(true,("load_with %s\n",i->second->load_with.getValue().getValueString().c_str())); #endif @@ -671,7 +671,7 @@ void ObjectTableBuffer::getObjvarsForObject(const NetworkId &objectId, std::vect int ObjectTableBuffer::encodeObjVarFreeFlags(const NetworkId & objectId) const { const DBSchema::ObjectBufferRow *row=findConstRowByIndex(objectId); - WARNING_STRICT_FATAL(row==nullptr,("Loading object %s, no ObjectRow in the buffer\n",objectId.getValueString().c_str())); + WARNING_STRICT_FATAL(row==NULL,("Loading object %s, no ObjectRow in the buffer\n",objectId.getValueString().c_str())); if (!row) return 0; diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/ResourceTypeBuffer.cpp b/game/server/application/SwgDatabaseServer/src/shared/buffers/ResourceTypeBuffer.cpp index fe6cca4f..0784be9b 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/ResourceTypeBuffer.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/buffers/ResourceTypeBuffer.cpp @@ -31,7 +31,7 @@ ResourceTypeBuffer::~ResourceTypeBuffer() for (DataType::iterator i=m_data.begin(); i!=m_data.end(); ++i) { delete i->second; - i->second=nullptr; + i->second=NULL; } } @@ -41,7 +41,7 @@ void ResourceTypeBuffer::handleAddResourceTypeMessage(AddResourceTypeMessage con { for (std::vector::const_iterator typeData = message.getData().begin(); typeData != message.getData().end(); ++typeData) { - DBSchema::ResourceTypeRow * row = nullptr; + DBSchema::ResourceTypeRow * row = NULL; DataType::iterator rowIter = m_data.find(typeData->m_networkId); if (rowIter == m_data.end()) { diff --git a/game/server/application/SwgDatabaseServer/src/shared/cleanup/TaskObjectTemplateListUpdater.cpp b/game/server/application/SwgDatabaseServer/src/shared/cleanup/TaskObjectTemplateListUpdater.cpp index f4653cd9..7b73fc9b 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/cleanup/TaskObjectTemplateListUpdater.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/cleanup/TaskObjectTemplateListUpdater.cpp @@ -45,7 +45,7 @@ bool TaskObjectTemplateListUpdater::process(DB::Session *session) strcpy(s_sql,"commit"); else if ( i_retval == 2 ) // got ID & Name { - s_name[256]=0; // nullptr term to make sure it fits + s_name[256]=0; // null term to make sure it fits sprintf(s_sql,"insert into object_templates values (%d,'%s')",i_id,s_name); } else diff --git a/game/server/application/SwgDatabaseServer/src/shared/core/CMLoader.cpp b/game/server/application/SwgDatabaseServer/src/shared/core/CMLoader.cpp index 56ac35e8..405d6a80 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/core/CMLoader.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/core/CMLoader.cpp @@ -25,7 +25,7 @@ #include "TaskGetLocationList.h" #include "TaskGetBidList.h" -CMLoader *CMLoader::ms_instance = nullptr; +CMLoader *CMLoader::ms_instance = NULL; // ====================================================================== @@ -42,7 +42,7 @@ void CMLoader::remove() { NOT_NULL(ms_instance); delete ms_instance; - ms_instance = nullptr; + ms_instance = NULL; } // ---------------------------------------------------------------------- diff --git a/game/server/application/SwgDatabaseServer/src/shared/core/ObjvarNameManager.cpp b/game/server/application/SwgDatabaseServer/src/shared/core/ObjvarNameManager.cpp index e442f568..d5955036 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/core/ObjvarNameManager.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/core/ObjvarNameManager.cpp @@ -17,8 +17,8 @@ // ====================================================================== -ObjvarNameManager * ObjvarNameManager::ms_instance = nullptr; -ObjvarNameManager * ObjvarNameManager::ms_goldInstance = nullptr; +ObjvarNameManager * ObjvarNameManager::ms_instance = NULL; +ObjvarNameManager * ObjvarNameManager::ms_goldInstance = NULL; // ====================================================================== @@ -37,11 +37,11 @@ void ObjvarNameManager::remove() { NOT_NULL(ms_instance); delete ms_instance; - ms_instance = nullptr; + ms_instance = NULL; NOT_NULL(ms_goldInstance); delete ms_goldInstance; - ms_goldInstance = nullptr; + ms_goldInstance = NULL; } // ---------------------------------------------------------------------- @@ -64,9 +64,9 @@ ObjvarNameManager::~ObjvarNameManager() delete m_nameToIdMap; delete m_idToNameMap; delete m_newNames; - m_nameToIdMap=nullptr; - m_idToNameMap=nullptr; - m_newNames=nullptr; + m_nameToIdMap=NULL; + m_idToNameMap=NULL; + m_newNames=NULL; } // ---------------------------------------------------------------------- @@ -169,7 +169,7 @@ DB::TaskRequest *ObjvarNameManager::saveNewNames() return task; } else - return nullptr; + return NULL; } // ====================================================================== diff --git a/game/server/application/SwgDatabaseServer/src/shared/core/SwgLoader.cpp b/game/server/application/SwgDatabaseServer/src/shared/core/SwgLoader.cpp index 99d689d9..206cd1ee 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/core/SwgLoader.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/core/SwgLoader.cpp @@ -29,9 +29,9 @@ void SwgLoader::install() SwgLoader::SwgLoader() : Loader(), - m_pendingTaskVerifyCharacter(nullptr), - m_loadingTaskVerifyCharacter(nullptr), - m_verifyCharacterTaskQ(nullptr) + m_pendingTaskVerifyCharacter(NULL), + m_loadingTaskVerifyCharacter(NULL), + m_verifyCharacterTaskQ(NULL) { m_verifyCharacterTaskQ = new DB::TaskQueue(1,DatabaseProcess::getInstance().getDBServer(),4); } @@ -95,7 +95,7 @@ void SwgLoader::update(real updateTime) if (m_pendingTaskVerifyCharacter && !m_loadingTaskVerifyCharacter) { m_loadingTaskVerifyCharacter = m_pendingTaskVerifyCharacter; - m_pendingTaskVerifyCharacter = nullptr; + m_pendingTaskVerifyCharacter = NULL; m_verifyCharacterTaskQ->asyncRequest(m_loadingTaskVerifyCharacter); } @@ -109,7 +109,7 @@ void SwgLoader::verifyCharacterFinished (TaskVerifyCharacter *task) { UNREF(task); DEBUG_FATAL(task!=m_loadingTaskVerifyCharacter,("Programmer bug: wrong TaskVerifyCharacter finished.\n")); - m_loadingTaskVerifyCharacter = nullptr; + m_loadingTaskVerifyCharacter = NULL; } // ---------------------------------------------------------------------- diff --git a/game/server/application/SwgDatabaseServer/src/shared/core/SwgPersister.cpp b/game/server/application/SwgDatabaseServer/src/shared/core/SwgPersister.cpp index a792d1b5..216a6aec 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/core/SwgPersister.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/core/SwgPersister.cpp @@ -110,7 +110,7 @@ void SwgPersister::moveToPlayer(const NetworkId &oid, const NetworkId &player, c void SwgPersister::getMoneyFromOfflineObject(uint32 replyServer, NetworkId const & sourceObject, int amount, NetworkId const & replyTo, std::string const & successCallback, std::string const & failCallback, stdvector::fwd const & packedDictionary) { - SwgSnapshot * snapshot=nullptr; + SwgSnapshot * snapshot=NULL; if (hasDataForObject(sourceObject)) snapshot=safe_cast(&getSnapshotForObject(sourceObject, 0)); diff --git a/game/server/application/SwgDatabaseServer/src/shared/core/SwgSnapshot.cpp b/game/server/application/SwgDatabaseServer/src/shared/core/SwgSnapshot.cpp index ccb9ccad..b5e7e461 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/core/SwgSnapshot.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/core/SwgSnapshot.cpp @@ -96,8 +96,8 @@ SwgSnapshot::SwgSnapshot(DB::ModeQuery::Mode mode, bool useGoldDatabase) : m_vehicleObjectBuffer(mode), m_waypointBuffer(mode), m_weaponObjectBuffer(mode), - m_immediateDeleteStep(nullptr), - m_offlineMoneyCustomPersistStep(nullptr) + m_immediateDeleteStep(NULL), + m_offlineMoneyCustomPersistStep(NULL) { m_bufferList.push_back(&m_battlefieldMarkerObjectBuffer); m_bufferList.push_back(&m_battlefieldParticipantBuffer); @@ -290,10 +290,10 @@ void SwgSnapshot::decodeScriptObject(NetworkId const & objectId, Archive::ReadIt Archive::get(data,packedScriptList); if (packedScriptList.length()==0) - packedScriptList=' '; // avoid confusing an empty list with nullptr + packedScriptList=' '; // avoid confusing an empty list with NULL DBSchema::ObjectBufferRow *row=m_objectTableBuffer.findRowByIndex(objectId); - if (row==nullptr) + if (row==NULL) row=m_objectTableBuffer.addEmptyRow(objectId); row->script_list=packedScriptList; diff --git a/game/server/application/SwgDatabaseServer/src/shared/queries/CommoditiesQuery.cpp b/game/server/application/SwgDatabaseServer/src/shared/queries/CommoditiesQuery.cpp index f5ae1da4..9a245c47 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/queries/CommoditiesQuery.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/queries/CommoditiesQuery.cpp @@ -90,7 +90,7 @@ bool AuctionLocationsQuery::setupData(DB::Session *session) bool AuctionLocationsQuery::addData(const DB::Row *_data) { const AuctionLocationsRow *myData=dynamic_cast(_data); - FATAL(myData == nullptr, ("Adding nullptr data into AuctionLocations")); + FATAL(myData == NULL, ("Adding NULL data into AuctionLocations")); switch(mode) { case mode_UPDATE: @@ -413,7 +413,7 @@ bool MarketAuctionsQuery::addData(const DB::Row *_data) case mode_UPDATE: { const MarketAuctionsRowUpdate *myData=dynamic_cast(_data); - FATAL(myData == nullptr, ("Adding nullptr data into MarketAuctions for mode_UPDATE")); + FATAL(myData == NULL, ("Adding NULL data into MarketAuctions for mode_UPDATE")); if (!m_item_ids.push_back(myData->item_id.getValueASCII())) return false; if (!m_owner_ids.push_back(myData->owner_id.getValueASCII())) return false; @@ -424,7 +424,7 @@ bool MarketAuctionsQuery::addData(const DB::Row *_data) case mode_INSERT: { const MarketAuctionsRow *myData=dynamic_cast(_data); - FATAL(myData == nullptr, ("Adding nullptr data into MarketAuctions for mode_INSERT")); + FATAL(myData == NULL, ("Adding NULL data into MarketAuctions for mode_INSERT")); if (!m_item_ids.push_back(myData->item_id.getValueASCII())) return false; if (!m_owner_ids.push_back(myData->owner_id.getValueASCII())) return false; @@ -450,7 +450,7 @@ bool MarketAuctionsQuery::addData(const DB::Row *_data) case mode_DELETE: { const MarketAuctionsRowDelete *myData=dynamic_cast(_data); - FATAL(myData == nullptr, ("Adding nullptr data into MarketAuctions for mode_DELETE")); + FATAL(myData == NULL, ("Adding NULL data into MarketAuctions for mode_DELETE")); if (!m_item_ids.push_back(myData->item_id.getValueASCII())) return false; break; @@ -716,7 +716,7 @@ bool MarketAuctionBidsQuery::addData(const DB::Row *_data) { const MarketAuctionBidsRow *myData=dynamic_cast(_data); - FATAL(myData == nullptr, ("Adding nullptr data into MarketAuctionBids")); + FATAL(myData == NULL, ("Adding NULL data into MarketAuctionBids")); switch(mode) { diff --git a/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskSaveObjvarNames.cpp b/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskSaveObjvarNames.cpp index d809771f..f30e0962 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskSaveObjvarNames.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskSaveObjvarNames.cpp @@ -24,7 +24,7 @@ TaskSaveObjvarNames::TaskSaveObjvarNames(const NameList &names) : TaskSaveObjvarNames::~TaskSaveObjvarNames() { delete m_objvarNames; - m_objvarNames=nullptr; + m_objvarNames=NULL; } // ---------------------------------------------------------------------- diff --git a/game/server/application/SwgGameServer/src/shared/combat/CombatEngine.cpp b/game/server/application/SwgGameServer/src/shared/combat/CombatEngine.cpp index 4f4269cd..50a12bbb 100755 --- a/game/server/application/SwgGameServer/src/shared/combat/CombatEngine.cpp +++ b/game/server/application/SwgGameServer/src/shared/combat/CombatEngine.cpp @@ -102,7 +102,7 @@ void CombatEngine::aim(const Command &, const NetworkId & actor, const NetworkId CachedNetworkId attackerId(actor); TangibleObject * attacker = dynamic_cast(attackerId.getObject()); - if (attacker != nullptr) + if (attacker != NULL) { attacker->addAim(); } @@ -121,7 +121,7 @@ bool CombatEngine::addTargetAction(TangibleObject & attacker, { // @todo: support tangible attacks CreatureObject * const creatureAttacker = attacker.asCreatureObject (); - if (creatureAttacker == nullptr) + if (creatureAttacker == NULL) { WARNING_STRICT_FATAL(true, ("Tangible attackers not supported yet")); return false; @@ -146,7 +146,7 @@ bool CombatEngine::addAttackAction(TangibleObject & attacker, { // @todo: support tangible attacks CreatureObject * const creatureAttacker = attacker.asCreatureObject (); - if (creatureAttacker == nullptr) + if (creatureAttacker == NULL) { WARNING_STRICT_FATAL(true, ("Tangible attackers not supported yet")); return false; @@ -176,7 +176,7 @@ bool CombatEngine::addAimAction(TangibleObject & attacker) // @todo: support tangible attacks CreatureObject * const creatureAttacker = attacker.asCreatureObject (); - if (creatureAttacker == nullptr) + if (creatureAttacker == NULL) { WARNING_STRICT_FATAL(true, ("Tangible attackers not supported yet")); return false; @@ -203,7 +203,7 @@ bool CombatEngine::onSuccessfulAttack(const TangibleObject & attacker, TangibleObject & defender, const WeaponObject & weapon, int damageAmount, int hitLocation) { - const bool creatureDefender = defender.asCreatureObject() != nullptr; + const bool creatureDefender = defender.asCreatureObject() != NULL; const bool isVehicle = GameObjectTypes::isTypeOf (defender.getGameObjectType (), SharedObjectTemplate::GOT_vehicle); // if attacking an object, always hit location 0 @@ -262,9 +262,9 @@ bool CombatEngine::onSuccessfulAttack(const TangibleObject & attacker, } else { - TangibleController * const tangibleController = (defender.getController() != nullptr) ? defender.getController()->asTangibleController() : nullptr; + TangibleController * const tangibleController = (defender.getController() != NULL) ? defender.getController()->asTangibleController() : NULL; - if (tangibleController == nullptr) + if (tangibleController == NULL) { WARNING_STRICT_FATAL(true, ("CombatEngine::onSuccessfulAttack non-auth " "defender %s doesn't have a TangibleController!", @@ -311,7 +311,7 @@ bool CombatEngine::onSuccessfulAttack(const TangibleObject & attacker, TangibleObject & defender, int damageAmount, int hitLocation) { - const bool creatureDefender = defender.asCreatureObject() != nullptr; + const bool creatureDefender = defender.asCreatureObject() != NULL; const bool isVehicle = GameObjectTypes::isTypeOf (defender.getGameObjectType (), SharedObjectTemplate::GOT_vehicle); // if attacking an object, always hit location 0 @@ -359,9 +359,9 @@ bool CombatEngine::onSuccessfulAttack(const TangibleObject & attacker, } else { - TangibleController * const tangibleController = (defender.getController() != nullptr) ? defender.getController()->asTangibleController() : nullptr; + TangibleController * const tangibleController = (defender.getController() != NULL) ? defender.getController()->asTangibleController() : NULL; - if (tangibleController == nullptr) + if (tangibleController == NULL) { WARNING_STRICT_FATAL(true, ("CombatEngine::onSuccessfulAttack non-auth " "defender %s doesn't have a TangibleController!", @@ -411,7 +411,7 @@ bool CombatEngine::damage(TangibleObject & defender, const WeaponObject & weapon const bool isVehicle = GameObjectTypes::isTypeOf (defender.getGameObjectType (), SharedObjectTemplate::GOT_vehicle); // if attacking an object, always hit location 0 - if (critter == nullptr || isVehicle) + if (critter == NULL || isVehicle) hitLocation = 0; // get the damage profile for the hit location @@ -425,7 +425,7 @@ bool CombatEngine::damage(TangibleObject & defender, const WeaponObject & weapon // put a attribMod structure on the defender's damage list for each type of // damage received DamageList damageList; - if (critter != nullptr && !isVehicle) + if (critter != NULL && !isVehicle) { computeCreatureDamage(&hitLocationData, damageAmount, damageList); } @@ -456,7 +456,7 @@ bool CombatEngine::damage(TangibleObject & defender, const WeaponObject & weapon damageData.damage.insert(damageData.damage.end(), damageList.begin(), damageList.end()); damageData.wounded = isWounded; - if (critter != nullptr || !defender.isDisabled()) + if (critter != NULL || !defender.isDisabled()) { // update the object's hit points or attributes for the damage defender.applyDamage(damageData); @@ -485,7 +485,7 @@ void CombatEngine::damage(TangibleObject & defender, const bool isVehicle = GameObjectTypes::isTypeOf (defender.getGameObjectType (), SharedObjectTemplate::GOT_vehicle); // if attacking an object, always hit location 0 - if (critter == nullptr || isVehicle) + if (critter == NULL || isVehicle) hitLocation = 0; // get the damage profile for the hit location @@ -514,7 +514,7 @@ void CombatEngine::damage(TangibleObject & defender, damageData.hitLocationIndex = hitLocation; damageData.damage.insert(damageData.damage.end(), damageList.begin(), damageList.end()); - if (critter != nullptr || !defender.isDisabled()) + if (critter != NULL || !defender.isDisabled()) { // update the object's hit points or attributes for the damage defender.applyDamage(damageData); @@ -668,7 +668,7 @@ void CombatEngine::alter(TangibleObject & object) { NOT_NULL(object.getController()); - if ( (object.getCombatData() == nullptr) + if ( (object.getCombatData() == NULL) || object.getCombatData()->defenseData.damage.empty()) { return; @@ -682,7 +682,7 @@ void CombatEngine::alter(TangibleObject & object) // if the object is a creature, get it's attributes Attributes::Value currentAttribs[Attributes::NumberOfAttributes]; CreatureObject * const critter = object.asCreatureObject (); - if (critter != nullptr) + if (critter != NULL) { for (int i = 0; i < Attributes::NumberOfAttributes; ++i) currentAttribs[i] = critter->getAttribute(i); @@ -710,7 +710,7 @@ void CombatEngine::alter(TangibleObject & object) { TangibleController * const tangibleController = object.getController()->asTangibleController(); - if (tangibleController == nullptr) + if (tangibleController == NULL) { WARNING_STRICT_FATAL(true, ("CombatEngine::alter non-auth " "object %s doesn't have a TangibleController!", diff --git a/game/server/application/SwgGameServer/src/shared/controller/JediManagerController.cpp b/game/server/application/SwgGameServer/src/shared/controller/JediManagerController.cpp index defcc868..80099996 100755 --- a/game/server/application/SwgGameServer/src/shared/controller/JediManagerController.cpp +++ b/game/server/application/SwgGameServer/src/shared/controller/JediManagerController.cpp @@ -40,7 +40,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_removeJedi: { const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if (msg != nullptr) + if (msg != NULL) { owner->removeJedi(msg->getValue()); } @@ -49,7 +49,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_addJedi: { const MessageQueueJediData * const msg = safe_cast(data); - if (msg != nullptr) + if (msg != NULL) { owner->addJedi(msg->getId(), msg->getName(), @@ -69,7 +69,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_updateJedi: { const MessageQueueJediData * const msg = safe_cast(data); - if (msg != nullptr) + if (msg != NULL) { owner->updateJedi(msg->getId(), msg->getVisibility(), @@ -83,7 +83,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_updateJediState: { const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); - if (msg != nullptr) + if (msg != NULL) { owner->updateJedi(msg->getValue().first, static_cast(msg->getValue().second) @@ -95,7 +95,7 @@ void JediManagerController::handleMessage (const int message, const float value, { /* const MessageQueueGenericValueType > > * const msg = safe_cast > > *>(data); - if (msg != nullptr) + if (msg != NULL) { owner->updateJedi(msg->getValue().first, msg->getValue().second @@ -107,7 +107,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_updateJediLocation: { const MessageQueueJediLocation * const msg = safe_cast(data); - if (msg != nullptr) + if (msg != NULL) { owner->updateJediLocation(msg->getId(), msg->getLocation(), @@ -119,7 +119,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_setJediOffline: { const MessageQueueJediLocation * const msg = safe_cast(data); - if (msg != nullptr) + if (msg != NULL) { owner->setJediOffline(msg->getId(), msg->getLocation(), @@ -131,7 +131,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_requestJediBounty: { const MessageQueueRequestJediBounty * const msg = safe_cast(data); - if (msg != nullptr) + if (msg != NULL) { owner->requestJediBounty(msg->getTargetId(), msg->getHunterId(), @@ -145,7 +145,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_removeJediBounty: { const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); - if (msg != nullptr) + if (msg != NULL) { owner->removeJediBounty(msg->getValue().first, msg->getValue().second); } @@ -154,7 +154,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_removeAllJediBounties: { const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if (msg != nullptr) + if (msg != NULL) { owner->removeAllJediBounties(msg->getValue()); } @@ -163,7 +163,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_updateJediSpentJediSkillPoints: { const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); - if (msg != nullptr) + if (msg != NULL) { owner->updateJediSpentJediSkillPoints(msg->getValue().first, msg->getValue().second); } @@ -172,7 +172,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_updateJediFaction: { const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); - if (msg != nullptr) + if (msg != NULL) { owner->updateJediFaction(msg->getValue().first, msg->getValue().second); } @@ -181,7 +181,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_updateJediScriptData: { const MessageQueueGenericValueType > > * const msg = safe_cast > > *>(data); - if (msg != nullptr) + if (msg != NULL) { owner->updateJediScriptData(msg->getValue().first, msg->getValue().second.first, msg->getValue().second.second); } @@ -190,7 +190,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_removeJediScriptData: { const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); - if (msg != nullptr) + if (msg != NULL) { owner->removeJediScriptData(msg->getValue().first, msg->getValue().second); } diff --git a/game/server/application/SwgGameServer/src/shared/controller/SwgPlayerCreatureController.cpp b/game/server/application/SwgGameServer/src/shared/controller/SwgPlayerCreatureController.cpp index 1e417386..dea874be 100755 --- a/game/server/application/SwgGameServer/src/shared/controller/SwgPlayerCreatureController.cpp +++ b/game/server/application/SwgGameServer/src/shared/controller/SwgPlayerCreatureController.cpp @@ -40,7 +40,7 @@ void SwgPlayerCreatureController::handleMessage (const int message, const float case CM_setJediState: { const MessageQueueGenericValueType * const msg = dynamic_cast *>(data); - if (msg != nullptr) + if (msg != NULL) playerOwner->setJediState(static_cast(msg->getValue())); } break; diff --git a/game/server/application/SwgGameServer/src/shared/core/CSHandler.cpp b/game/server/application/SwgGameServer/src/shared/core/CSHandler.cpp index 869755e9..5bb0356e 100755 --- a/game/server/application/SwgGameServer/src/shared/core/CSHandler.cpp +++ b/game/server/application/SwgGameServer/src/shared/core/CSHandler.cpp @@ -767,7 +767,7 @@ CS_CMD( create_crafted_object ) if( !( target && target->isAuthoritative() ) ) return; ServerObject *inventory = target->getInventory(); - if( inventory == nullptr ) + if( inventory == NULL ) return; DEBUG_REPORT_LOG( true, ( "Trying to make %s\n", args[ 1 ].c_str())); GameScriptObject * script = target->getScriptObject(); @@ -1116,7 +1116,7 @@ CS_CMD( delete_object ) const NetworkId oid (args[0]); ServerObject *object = ServerObject::getServerObject( oid ); - if (object == nullptr) + if (object == NULL) { return; } @@ -1174,7 +1174,7 @@ CS_CMD( rename_player ) } if( player_id.isValid() ) { - // nullptr id to pass to the playercreationmanager. + // null id to pass to the playercreationmanager. NetworkId source( "0" ); DEBUG_REPORT_LOG( true, ( "Attempting to rename %s.", args[ 0 ].c_str() ) ); @@ -1213,7 +1213,7 @@ CS_CMD( set_bank_credits ) CreatureObject* creatureActor = CreatureObject::getCreatureObject(player_id); PlayerObject const * const player = PlayerCreatureController::getPlayerObject(creatureActor); - if( ( player != nullptr ) && ( player->isAuthoritative() ) ) + if( ( player != NULL ) && ( player->isAuthoritative() ) ) { amount -= creatureActor->getBankBalance(); DEBUG_REPORT_LOG( true, ( "Amount to modify by: %d (%d current balance)\n", amount, creatureActor->getBankBalance() ) ); @@ -1270,7 +1270,7 @@ CS_CMD( get_pc_info ) if(bindId != NetworkId::cms_invalid) { const ServerObject* const bindObject = ServerObject::getServerObject(bindId); - if (bindObject != nullptr) + if (bindObject != NULL) { bindLoc = bindObject->getPosition_w(); snprintf( stringbuffer, sizeof( stringbuffer ) -1, "%02f %02f %02f", bindLoc.x, bindLoc.y, bindLoc.z ); @@ -1380,11 +1380,11 @@ CS_CMD( get_pc_info ) // residence info PlayerObject const * const player = PlayerCreatureController::getPlayerObject(creatureActor); - if (player != nullptr) + if (player != NULL) { NetworkId houseNetworkId = creatureActor->getHouse(); const ServerObject* const resObject = ServerObject::getServerObject(houseNetworkId); - if (resObject != nullptr) + if (resObject != NULL) { resLoc = resObject->getPosition_w(); snprintf( stringbuffer, sizeof( stringbuffer ) - 1 , "%02f %02f %02f", resLoc.x, resLoc.y, resLoc.z ); diff --git a/game/server/application/SwgGameServer/src/shared/core/SwgGameServer.cpp b/game/server/application/SwgGameServer/src/shared/core/SwgGameServer.cpp index 1bf01f55..1b310ffd 100755 --- a/game/server/application/SwgGameServer/src/shared/core/SwgGameServer.cpp +++ b/game/server/application/SwgGameServer/src/shared/core/SwgGameServer.cpp @@ -55,7 +55,7 @@ SwgGameServer::~SwgGameServer() void SwgGameServer::install() { - DEBUG_FATAL (ms_instance != nullptr, ("already installed")); + DEBUG_FATAL (ms_instance != NULL, ("already installed")); ms_instance = new SwgGameServer; SwgServerUniverse::install(); @@ -110,7 +110,7 @@ void SwgGameServer::receiveMessage(const MessageDispatch::Emitter & source, cons JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager != nullptr && jediManager->isAuthoritative()) + if (jediManager != NULL && jediManager->isAuthoritative()) { jediManager->addJediBounties(*msg); delete msg; @@ -129,7 +129,7 @@ void SwgGameServer::receiveMessage(const MessageDispatch::Emitter & source, cons JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager != nullptr) + if (jediManager != NULL) { jediManager->characterBeingDeleted(msg.getValue()); } diff --git a/game/server/application/SwgGameServer/src/shared/core/SwgServerUniverse.cpp b/game/server/application/SwgGameServer/src/shared/core/SwgServerUniverse.cpp index 98bccf40..3d743c93 100755 --- a/game/server/application/SwgGameServer/src/shared/core/SwgServerUniverse.cpp +++ b/game/server/application/SwgGameServer/src/shared/core/SwgServerUniverse.cpp @@ -26,7 +26,7 @@ void SwgServerUniverse::install() SwgServerUniverse::SwgServerUniverse() : ServerUniverse (), - m_jediManager (nullptr) + m_jediManager (NULL) { } @@ -51,7 +51,7 @@ void SwgServerUniverse::updateAndValidateData() "only be called on the process that is authoritative for UniverseObjects.\n")); // create Jedi manager - if (m_jediManager == nullptr) + if (m_jediManager == NULL) { const ServerObjectTemplate * objTemplate = safe_cast(ObjectTemplateList::fetch(ConfigServerGame::getJediManagerTemplate())); m_jediManager = safe_cast(ServerWorld::createNewObject(*objTemplate, Transform::identity, 0, false)); diff --git a/game/server/application/SwgGameServer/src/shared/object/JediManagerObject.cpp b/game/server/application/SwgGameServer/src/shared/object/JediManagerObject.cpp index 89c24610..f4aa0944 100755 --- a/game/server/application/SwgGameServer/src/shared/object/JediManagerObject.cpp +++ b/game/server/application/SwgGameServer/src/shared/object/JediManagerObject.cpp @@ -43,7 +43,7 @@ namespace JediManagerObjectNamespace // the bounty hunter target list loaded from the DB; we store it here // and wait until the JediManagerObject object is created, and then // read it into the JediManagerObject object - const BountyHunterTargetListMessage * s_queuedBountyHunterTargetListFromDB = nullptr; + const BountyHunterTargetListMessage * s_queuedBountyHunterTargetListFromDB = NULL; } using namespace JediManagerObjectNamespace; @@ -151,7 +151,7 @@ void JediManagerObject::onServerUniverseGainedAuthority() addJediBounties(*s_queuedBountyHunterTargetListFromDB); delete s_queuedBountyHunterTargetListFromDB; - s_queuedBountyHunterTargetListFromDB = nullptr; + s_queuedBountyHunterTargetListFromDB = NULL; } } @@ -450,7 +450,7 @@ void JediManagerObject::characterBeingDeleted(const NetworkId & id) ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != nullptr) + if (dictionary.get() != NULL) { dictionary->serialize(); @@ -1252,7 +1252,7 @@ void JediManagerObject::requestJediBounty(const NetworkId & targetId, ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != nullptr) + if (dictionary.get() != NULL) { dictionary->serialize(); if (success) diff --git a/game/server/application/SwgGameServer/src/shared/object/SwgCreatureObject.cpp b/game/server/application/SwgGameServer/src/shared/object/SwgCreatureObject.cpp index 18cd7b6e..e1ab4b18 100755 --- a/game/server/application/SwgGameServer/src/shared/object/SwgCreatureObject.cpp +++ b/game/server/application/SwgGameServer/src/shared/object/SwgCreatureObject.cpp @@ -96,7 +96,7 @@ void SwgCreatureObject::onRemovingFromWorld() if (isAuthoritative() && isPlayerControlled() && (getBountyValue() > 0)) { JediManagerObject * const jediManager = static_cast(ServerUniverse::getInstance()).getJediManager(); - if (jediManager != nullptr) + if (jediManager != NULL) { jediManager->setJediOffline(getNetworkId(), getPosition_w(), getSceneId()); } @@ -116,7 +116,7 @@ void SwgCreatureObject::onPermanentlyDestroyed() if (isAuthoritative() && isPlayerControlled() && (getBountyValue() > 0)) { JediManagerObject * const jediManager = static_cast(ServerUniverse::getInstance()).getJediManager(); - if (jediManager != nullptr) + if (jediManager != NULL) { jediManager->removeJedi(getNetworkId()); } @@ -178,7 +178,7 @@ const int SwgCreatureObject::getSpentJediSkillPoints() const } else { - WARNING(true, ("Creature %s had a nullptr in their skill list", getNetworkId().getValueString().c_str())); + WARNING(true, ("Creature %s had a null in their skill list", getNetworkId().getValueString().c_str())); } } */ @@ -198,7 +198,7 @@ bool SwgCreatureObject::hasBounty(const CreatureObject & target) const { const SwgCreatureObject * swgTarget = dynamic_cast( &target); - if (swgTarget == nullptr) + if (swgTarget == NULL) return false; JediManagerObject * jediManager = static_cast( @@ -296,7 +296,7 @@ void SwgCreatureObject::onAddedToWorld() if (isAuthoritative() && isPlayerControlled() && (getBountyValue() > 0)) { JediManagerObject * jediManager = static_cast(ServerUniverse::getInstance()).getJediManager(); - if (jediManager != nullptr) + if (jediManager != NULL) { jediManager->updateJediLocation(getNetworkId(), getPosition_w(), getSceneId()); } @@ -330,7 +330,7 @@ void SwgCreatureObject::setPvpFaction(Pvp::FactionId factionId) if ((oldId != newId) && isAuthoritative() && isPlayerControlled() && (getBountyValue() > 0)) { JediManagerObject * jediManager = static_cast(ServerUniverse::getInstance()).getJediManager(); - if (jediManager != nullptr) + if (jediManager != NULL) { jediManager->updateJediFaction(getNetworkId(), newId); } diff --git a/game/server/application/SwgGameServer/src/shared/object/SwgPlayerObject.cpp b/game/server/application/SwgGameServer/src/shared/object/SwgPlayerObject.cpp index c8c838ec..ef587054 100755 --- a/game/server/application/SwgGameServer/src/shared/object/SwgPlayerObject.cpp +++ b/game/server/application/SwgGameServer/src/shared/object/SwgPlayerObject.cpp @@ -92,12 +92,12 @@ void SwgPlayerObject::virtualOnSetAuthority() PlayerObject::virtualOnSetAuthority(); const SwgCreatureObject * owner = safe_cast(getCreatureObject()); - if ((owner != nullptr) && owner->isPlayerControlled() && (owner->getBountyValue() > 0)) + if ((owner != NULL) && owner->isPlayerControlled() && (owner->getBountyValue() > 0)) { // tell the Jedi manager our position JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager != nullptr) + if (jediManager != NULL) { jediManager->updateJediLocation(owner->getNetworkId(), owner->getPosition_w(), owner->getSceneId()); @@ -192,7 +192,7 @@ void SwgPlayerObject::updateJediLocationTime(float time) // tell the Jedi manager our position JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager != nullptr) + if (jediManager != NULL) { const CreatureObject * owner = getCreatureObject(); if (owner->isInWorld()) @@ -324,7 +324,7 @@ void SwgPlayerObject::setJediBounties(const std::vector & bounties) // update the Jedi manager JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager != nullptr) + if (jediManager != NULL) { const CreatureObject * owner = getCreatureObject(); jediManager->updateJedi(owner->getNetworkId(), bounties); @@ -351,7 +351,7 @@ bool SwgPlayerObject::getJediBounties(std::vector & bounties) bounties.clear(); SwgCreatureObject * owner = safe_cast(getCreatureObject()); - if (owner != nullptr) + if (owner != NULL) { if (owner->getObjVars().getItem(OBJVAR_JEDI_BOUNTIES, bounties)) { diff --git a/game/server/application/SwgGameServer/src/shared/objectTemplate/ServerJediManagerObjectTemplate.cpp b/game/server/application/SwgGameServer/src/shared/objectTemplate/ServerJediManagerObjectTemplate.cpp index aaf9f5a9..90edb0a3 100755 --- a/game/server/application/SwgGameServer/src/shared/objectTemplate/ServerJediManagerObjectTemplate.cpp +++ b/game/server/application/SwgGameServer/src/shared/objectTemplate/ServerJediManagerObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag ServerJediManagerObjectTemplate::getTemplateVersion(void) const */ Tag ServerJediManagerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == nullptr) + if (m_baseData == NULL) return m_templateVersion; const ServerJediManagerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == nullptr) + if (base == NULL) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerJediManagerObjectTemplate::getHighestTemplateVersion @@ -150,12 +150,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != nullptr) + DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != NULL) base->releaseReference(); else { - if (m_baseData != nullptr) + if (m_baseData != NULL) m_baseData->releaseReference(); m_baseData = base; } diff --git a/game/server/library/swgServerNetworkMessages/src/shared/core/SetupSwgServerNetworkMessages.cpp b/game/server/library/swgServerNetworkMessages/src/shared/core/SetupSwgServerNetworkMessages.cpp index 864e2645..d93e323f 100755 --- a/game/server/library/swgServerNetworkMessages/src/shared/core/SetupSwgServerNetworkMessages.cpp +++ b/game/server/library/swgServerNetworkMessages/src/shared/core/SetupSwgServerNetworkMessages.cpp @@ -235,7 +235,7 @@ namespace SetupSwgServerNetworkMessagesNamespace } MessageQueue::Data* unpackNothing(Archive::ReadIterator &) { - return nullptr; + return NULL; } void packVectorNetworkIdVector(const MessageQueue::Data * data, Archive::ByteStream & target) diff --git a/game/shared/library/swgSharedNetworkMessages/src/shared/combat/MessageQueueCombatAction.cpp b/game/shared/library/swgSharedNetworkMessages/src/shared/combat/MessageQueueCombatAction.cpp index 44559bc5..e0c98b96 100755 --- a/game/shared/library/swgSharedNetworkMessages/src/shared/combat/MessageQueueCombatAction.cpp +++ b/game/shared/library/swgSharedNetworkMessages/src/shared/combat/MessageQueueCombatAction.cpp @@ -297,7 +297,7 @@ void MessageQueueCombatAction::debugDump() const bool hasActionName; char actionName[256]; - if (s_actionNameLookupFunction != nullptr) + if (s_actionNameLookupFunction != NULL) { hasActionName = true; (*s_actionNameLookupFunction)(m_actionId, actionName, sizeof(actionName)); @@ -316,9 +316,9 @@ void MessageQueueCombatAction::debugDump() const // Print attacker info. DEBUG_REPORT_LOG(true, ("MQCA: attacker: id =[%s].\n", m_attacker.id.getValueString().c_str())); - DEBUG_REPORT_LOG(true, ("MQCA: attacker: template =[%s].\n", attackerObject ? attackerObject->getObjectTemplateName() : "")); + DEBUG_REPORT_LOG(true, ("MQCA: attacker: template =[%s].\n", attackerObject ? attackerObject->getObjectTemplateName() : "")); DEBUG_REPORT_LOG(true, ("MQCA: attacker: weapon =[%s].\n", m_attacker.weapon.getValueString().c_str())); - DEBUG_REPORT_LOG(true, ("MQCA: attacker: weapon template =[%s].\n", weaponObject ? weaponObject->getObjectTemplateName() : "")); + DEBUG_REPORT_LOG(true, ("MQCA: attacker: weapon template =[%s].\n", weaponObject ? weaponObject->getObjectTemplateName() : "")); DEBUG_REPORT_LOG(true, ("MQCA: attacker: end posture =[%s].\n", Postures::getPostureName(m_attacker.endPosture))); DEBUG_REPORT_LOG(true, ("MQCA: attacker: trailBits =[0x%02x].\n", m_attacker.trailBits)); DEBUG_REPORT_LOG(true, ("MQCA: attacker: client effect id=[%d].\n", m_attacker.clientEffectId)); @@ -341,7 +341,7 @@ void MessageQueueCombatAction::debugDump() const UNREF(defenderObject); DEBUG_REPORT_LOG(true, ("MQCA: defender #%d: id =[%s].\n", i + 1, data.id.getValueString().c_str())); - DEBUG_REPORT_LOG(true, ("MQCA: defender #%d: template =[%s].\n", i + 1, defenderObject ? defenderObject->getObjectTemplateName() : "")); + DEBUG_REPORT_LOG(true, ("MQCA: defender #%d: template =[%s].\n", i + 1, defenderObject ? defenderObject->getObjectTemplateName() : "")); DEBUG_REPORT_LOG(true, ("MQCA: defender #%d: end posture =[%s].\n", i + 1, Postures::getPostureName(data.endPosture))); DEBUG_REPORT_LOG(true, ("MQCA: defender #%d: defense =[%s].\n", i + 1, CombatEngineData::getCombatDefenseName(data.defense))); DEBUG_REPORT_LOG(true, ("MQCA: defender #%d: client effect id=[%d].\n", i + 1, data.clientEffectId)); diff --git a/game/shared/library/swgSharedNetworkMessages/src/shared/core/SetupSwgSharedNetworkMessages.cpp b/game/shared/library/swgSharedNetworkMessages/src/shared/core/SetupSwgSharedNetworkMessages.cpp index 399a513c..fb9785c0 100755 --- a/game/shared/library/swgSharedNetworkMessages/src/shared/core/SetupSwgSharedNetworkMessages.cpp +++ b/game/shared/library/swgSharedNetworkMessages/src/shared/core/SetupSwgSharedNetworkMessages.cpp @@ -482,7 +482,7 @@ namespace SetupSwgSharedNetworkMessagesNamespace MessageQueue::Data* unpackNothing(Archive::ReadIterator &) { - return nullptr; + return NULL; } //---------------------------------------------------------------------- diff --git a/game/shared/library/swgSharedUtility/src/shared/CombatEngineData.h b/game/shared/library/swgSharedUtility/src/shared/CombatEngineData.h index 118e2167..0a86c6ee 100755 --- a/game/shared/library/swgSharedUtility/src/shared/CombatEngineData.h +++ b/game/shared/library/swgSharedUtility/src/shared/CombatEngineData.h @@ -139,7 +139,7 @@ namespace CombatEngineData std::vector damage;// list of attribute modifiers this damage // caused, pre armor effectiveness - CachedNetworkId attackerId; // who caused the damage (nullptr for + CachedNetworkId attackerId; // who caused the damage (null for // environmental effects, etc) NetworkId weaponId; // id of the weapon used DamageType damageType; @@ -175,10 +175,10 @@ namespace CombatEngineData inline ActionItem::~ActionItem(void) { - if (type == target && actionData.targetData.targets != nullptr) + if (type == target && actionData.targetData.targets != NULL) { delete[] actionData.targetData.targets; - actionData.targetData.targets = nullptr; + actionData.targetData.targets = NULL; } } // ActionItem::~ActionItem @@ -195,7 +195,7 @@ namespace CombatEngineData actionId(0), wounded(false), ignoreInvulnerable(false) -// combatActionMessage(nullptr) +// combatActionMessage(NULL) { } From dd9db6d350040c11f1f7b95ecc3f01f3a5a1aa60 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Thu, 11 Feb 2016 21:19:18 -0600 Subject: [PATCH 012/302] Revert "Revert "newer standards prefer nullptr over NULL - this is most of them but there are others too"" This reverts commit 8e2160f33eb008430981188677b502bd23014001. --- .../Miff/src/linux/InputFileHandler.cpp | 2 +- .../Miff/src/linux/OutputFileHandler.cpp | 4 +- .../application/Miff/src/linux/miff.cpp | 12 +- .../src/shared/AuctionTransferClient.cpp | 2 +- .../ATGenericAPI/GenericApiCore.cpp | 16 +- .../ATGenericAPI/GenericConnection.cpp | 20 +- .../AuctionTransferAPI.cpp | 10 +- .../AuctionTransferGameAPI/Base/Archive.cpp | 4 +- .../shared/AuctionTransferGameAPI/Request.cpp | 6 +- .../TcpLibrary/IPAddress.h | 2 +- .../TcpLibrary/TcpBlockAllocator.cpp | 6 +- .../TcpLibrary/TcpConnection.cpp | 64 +- .../TcpLibrary/TcpConnection.h | 2 +- .../TcpLibrary/TcpManager.cpp | 106 +- .../TcpLibrary/TcpManager.h | 4 +- .../AuctionTransferGameAPI/zip/GZipHelper.h | 4 +- .../AuctionTransferGameAPI/zip/Zip/zlib.h | 38 +- .../AuctionTransferGameAPI/zip/Zip/zutil.h | 4 +- .../src/shared/CentralCSHandler.h | 2 +- .../src/shared/CentralServer.cpp | 64 +- .../CentralServer/src/shared/CentralServer.h | 2 +- .../src/shared/CentralServerMetricsData.cpp | 10 +- .../src/shared/CharacterCreationTracker.cpp | 8 +- .../src/shared/ConsoleCommandParserGame.cpp | 6 +- .../src/shared/ConsoleManager.cpp | 2 +- .../src/shared/PlanetManager.cpp | 2 +- .../application/ChatServer/src/linux/main.cpp | 2 +- .../src/shared/CentralServerConnection.cpp | 2 +- .../ChatServer/src/shared/ChatInterface.cpp | 144 +-- .../ChatServer/src/shared/ChatServer.cpp | 104 +- .../src/shared/ChatServerRoomOwner.cpp | 2 +- .../ChatServer/src/shared/VChatInterface.cpp | 12 +- .../CommoditiesServer/src/linux/main.cpp | 2 +- .../CommoditiesServer/src/shared/Auction.cpp | 54 +- .../src/shared/AuctionLocation.cpp | 6 +- .../src/shared/AuctionMarket.cpp | 30 +- .../src/shared/CommodityServer.cpp | 10 +- .../src/shared/CommodityServerMetricsData.cpp | 2 +- .../ConnectionServer/src/linux/main.cpp | 2 +- .../src/shared/ClientConnection.cpp | 32 +- .../src/shared/ConnectionServer.cpp | 24 +- .../src/shared/GameConnection.cpp | 4 +- .../src/shared/PseudoClientConnection.cpp | 4 +- .../src/shared/SessionApiClient.cpp | 18 +- .../CustomerServiceServer/src/linux/main.cpp | 2 +- .../src/shared/CentralServerConnection.cpp | 8 +- .../src/shared/ChatServerConnection.cpp | 4 +- .../shared/ConfigCustomerServiceServer.cpp | 12 +- .../src/shared/CustomerServiceInterface.cpp | 104 +- .../src/shared/CustomerServiceServer.cpp | 28 +- .../LogServer/src/shared/LoggingServerApi.cpp | 52 +- .../LoginServer/src/linux/main.cpp | 2 +- .../src/shared/CSToolConnection.cpp | 4 +- .../src/shared/CentralServerConnection.cpp | 4 +- .../src/shared/ClientConnection.cpp | 4 +- .../LoginServer/src/shared/ConsoleManager.cpp | 2 +- .../LoginServer/src/shared/LoginServer.cpp | 30 +- .../LoginServer/src/shared/LoginServer.h | 2 +- .../src/shared/SessionApiClient.cpp | 2 +- .../src/shared/TaskCreateCharacter.cpp | 2 +- .../src/shared/TaskGetCharactersForDelete.cpp | 2 +- .../MetricsServer/src/linux/main.cpp | 2 +- .../src/shared/MetricsGatheringConnection.cpp | 20 +- .../src/shared/MetricsServer.cpp | 4 +- .../PlanetServer/src/linux/main.cpp | 2 +- .../src/shared/ConsoleCommandParser.cpp | 2 +- .../src/shared/ConsoleManager.cpp | 2 +- .../src/shared/GameServerData.cpp | 6 +- .../src/shared/PlanetProxyObject.cpp | 8 +- .../PlanetServer/src/shared/PlanetServer.cpp | 32 +- .../PlanetServer/src/shared/PlanetServer.h | 2 +- .../src/shared/PreloadManager.cpp | 2 +- .../PlanetServer/src/shared/Scene.cpp | 10 +- .../src/linux/main.cpp | 2 +- .../TaskManager/src/linux/ConsoleInput.cpp | 2 +- .../TaskManager/src/linux/ProcessSpawner.cpp | 2 +- .../TaskManager/src/linux/main.cpp | 2 +- .../TaskManager/src/shared/GameConnection.cpp | 2 +- .../TaskManager/src/shared/Locator.cpp | 6 +- .../src/shared/ManagerConnection.cpp | 4 +- .../TaskManager/src/shared/TaskManager.cpp | 10 +- .../src/shared/CTSAPIClient.cpp | 16 +- .../src/shared/ConsoleManager.cpp | 2 +- .../src/shared/TransferServer.cpp | 34 +- .../src/shared/ConsoleManager.cpp | 2 +- .../serverDatabase/src/shared/DataLookup.cpp | 4 +- .../src/shared/DatabaseProcess.cpp | 4 +- .../ImmediateDeleteCustomPersistStep.cpp | 2 +- .../serverDatabase/src/shared/LazyDeleter.cpp | 16 +- .../serverDatabase/src/shared/Loader.cpp | 18 +- .../src/shared/MessageToManager.cpp | 10 +- .../serverDatabase/src/shared/Persister.cpp | 34 +- .../src/shared/TaskGetBiography.cpp | 6 +- .../src/shared/TaskSetBiography.cpp | 2 +- .../src/shared/ai/AggroListProperty.cpp | 16 +- .../src/shared/ai/AiCombatPulseQueue.cpp | 6 +- .../src/shared/ai/AiCreatureCombatProfile.cpp | 10 +- .../src/shared/ai/AiCreatureData.cpp | 12 +- .../src/shared/ai/AiCreatureWeaponActions.cpp | 8 +- .../src/shared/ai/AiMovementArchive.cpp | 6 +- .../src/shared/ai/AiMovementBase.cpp | 26 +- .../src/shared/ai/AiMovementLoiter.cpp | 18 +- .../src/shared/ai/AiMovementMove.cpp | 4 +- .../src/shared/ai/AiMovementPathFollow.cpp | 8 +- .../src/shared/ai/AiMovementPatrol.cpp | 30 +- .../src/shared/ai/AiMovementSwarm.cpp | 28 +- .../src/shared/ai/AiMovementTarget.cpp | 10 +- .../shared/ai/AiMovementWanderInterior.cpp | 16 +- .../src/shared/ai/AiMovementWaypoint.cpp | 4 +- .../src/shared/ai/AiTargetingSystem.cpp | 2 +- .../serverGame/src/shared/ai/Formation.cpp | 4 +- .../serverGame/src/shared/ai/HateList.cpp | 46 +- .../serverGame/src/shared/ai/HateList.h | 2 +- .../serverGame/src/shared/ai/Squad.cpp | 6 +- .../behavior/AiCreatureStateArchive.cpp | 6 +- .../src/shared/behavior/AiLocation.cpp | 44 +- .../behavior/AiShipAttackTargetList.cpp | 22 +- .../behavior/AiShipBehaviorAttackBomber.cpp | 6 +- .../AiShipBehaviorAttackCapitalShip.cpp | 2 +- .../behavior/AiShipBehaviorAttackFighter.cpp | 28 +- .../AiShipBehaviorAttackFighter_Maneuver.cpp | 16 +- .../shared/behavior/AiShipBehaviorDock.cpp | 30 +- .../shared/behavior/AiShipBehaviorFollow.cpp | 18 +- .../shared/behavior/AiShipBehaviorIdle.cpp | 2 +- .../shared/behavior/AiShipBehaviorTrack.cpp | 4 +- .../behavior/AiShipBehaviorWaypoint.cpp | 14 +- .../behavior/ShipTurretTargetingSystem.cpp | 4 +- .../shared/collision/CollisionCallbacks.cpp | 12 +- .../src/shared/command/CommandCppFuncs.cpp | 414 ++++---- .../src/shared/command/CommandQueue.cpp | 38 +- .../src/shared/command/CommandQueue.h | 2 +- .../commoditiesMarket/CommoditiesMarket.cpp | 46 +- .../CommoditiesServerConnection.cpp | 2 +- .../shared/console/ConsoleCommandParserAi.cpp | 78 +- .../console/ConsoleCommandParserCity.cpp | 2 +- .../ConsoleCommandParserCollection.cpp | 56 +- .../console/ConsoleCommandParserCraft.cpp | 4 +- .../ConsoleCommandParserCraftStation.cpp | 30 +- .../console/ConsoleCommandParserGuild.cpp | 10 +- .../ConsoleCommandParserManufacture.cpp | 56 +- .../console/ConsoleCommandParserMoney.cpp | 12 +- .../console/ConsoleCommandParserNpc.cpp | 8 +- .../console/ConsoleCommandParserObject.cpp | 288 ++--- .../console/ConsoleCommandParserObjvar.cpp | 16 +- .../console/ConsoleCommandParserPvp.cpp | 140 +-- .../console/ConsoleCommandParserResource.cpp | 18 +- .../console/ConsoleCommandParserScript.cpp | 12 +- .../console/ConsoleCommandParserServer.cpp | 154 +-- .../console/ConsoleCommandParserShip.cpp | 42 +- .../console/ConsoleCommandParserSkill.cpp | 32 +- .../console/ConsoleCommandParserSpaceAi.cpp | 46 +- .../console/ConsoleCommandParserVeteran.cpp | 6 +- .../src/shared/console/ConsoleManager.cpp | 10 +- .../src/shared/console/ConsoleManager.h | 6 +- .../controller/AiCreatureController.cpp | 204 ++-- .../shared/controller/AiShipController.cpp | 176 ++-- .../controller/AiShipControllerInterface.cpp | 18 +- .../shared/controller/CreatureController.cpp | 48 +- .../shared/controller/PlanetController.cpp | 6 +- .../controller/PlayerCreatureController.cpp | 84 +- .../controller/PlayerShipController.cpp | 18 +- .../shared/controller/ServerController.cpp | 24 +- .../src/shared/controller/ShipController.cpp | 66 +- .../shared/controller/TangibleController.cpp | 22 +- .../src/shared/core/AttribModNameManager.cpp | 20 +- .../src/shared/core/BiographyManager.cpp | 2 +- .../src/shared/core/CharacterMatchManager.cpp | 28 +- .../serverGame/src/shared/core/Client.cpp | 22 +- .../src/shared/core/ClusterWideDataClient.cpp | 2 +- .../src/shared/core/CombatTracker.cpp | 14 +- .../src/shared/core/CommunityManager.cpp | 22 +- .../src/shared/core/ConfigServerGame.cpp | 8 +- .../src/shared/core/ConfigServerGame.h | 2 +- .../src/shared/core/ContainerInterface.cpp | 52 +- .../src/shared/core/FormManagerServer.cpp | 16 +- .../serverGame/src/shared/core/GameServer.cpp | 94 +- .../serverGame/src/shared/core/GameServer.h | 8 +- .../src/shared/core/InstantDeleteList.cpp | 4 +- .../src/shared/core/LogoutTracker.cpp | 4 +- .../src/shared/core/MessageToQueue.cpp | 4 +- .../src/shared/core/NameManager.cpp | 24 +- .../src/shared/core/NewbieTutorial.cpp | 6 +- .../src/shared/core/NpcConversation.cpp | 14 +- .../src/shared/core/ObserveTracker.cpp | 4 +- .../core/PlayerCreationManagerServer.cpp | 4 +- .../src/shared/core/PositionUpdateTracker.cpp | 4 +- .../serverGame/src/shared/core/RegexList.cpp | 6 +- .../src/shared/core/ReportManager.cpp | 6 +- .../src/shared/core/SceneGlobalData.cpp | 2 +- .../shared/core/ServerBuffBuilderManager.cpp | 28 +- .../src/shared/core/ServerBuildoutManager.cpp | 24 +- .../core/ServerImageDesignerManager.cpp | 50 +- .../src/shared/core/ServerUIManager.cpp | 36 +- .../src/shared/core/ServerUIPage.cpp | 12 +- .../src/shared/core/ServerUniverse.cpp | 36 +- .../src/shared/core/ServerWorld.cpp | 84 +- .../src/shared/core/SetupServerGame.cpp | 4 +- .../src/shared/core/StaticLootItemManager.cpp | 8 +- .../src/shared/core/VeteranRewardManager.cpp | 40 +- .../src/shared/guild/GuildInterface.cpp | 20 +- .../shared/metrics/GameServerMetricsData.cpp | 2 +- .../serverGame/src/shared/network/Chat.cpp | 2 +- .../network/ConnectionServerConnection.cpp | 14 +- .../CustomerServiceServerConnection.cpp | 4 +- .../network/GameServerMessageArchive.cpp | 2 +- .../src/shared/object/BuildingObject.cpp | 16 +- .../src/shared/object/CellObject.cpp | 42 +- .../src/shared/object/CityObject.cpp | 20 +- .../src/shared/object/CreatureObject.cpp | 356 +++---- .../src/shared/object/CreatureObject.h | 6 +- .../shared/object/CreatureObject_Mounts.cpp | 42 +- .../shared/object/CreatureObject_Ships.cpp | 8 +- .../shared/object/DraftSchematicObject.cpp | 52 +- .../src/shared/object/FactoryObject.cpp | 146 +-- .../src/shared/object/GroupIdObserver.cpp | 4 +- .../src/shared/object/GroupObject.cpp | 2 +- .../src/shared/object/GuildObject.cpp | 42 +- .../object/HarvesterInstallationObject.cpp | 12 +- .../object/HarvesterInstallationObject.h | 2 +- .../src/shared/object/InstallationObject.cpp | 12 +- .../src/shared/object/IntangibleObject.cpp | 52 +- .../src/shared/object/LineOfSightCache.cpp | 8 +- .../object/ManufactureInstallationObject.cpp | 142 +-- .../object/ManufactureSchematicObject.cpp | 180 ++-- .../src/shared/object/MissionObject.cpp | 22 +- .../src/shared/object/ObjectFactory.cpp | 6 +- .../src/shared/object/ObjectTracker.cpp | 2 +- .../shared/object/PatrolPathNodeProperty.cpp | 2 +- .../src/shared/object/PlanetObject.cpp | 26 +- .../src/shared/object/PlayerObject.cpp | 324 +++--- .../src/shared/object/PlayerObject.h | 18 +- .../src/shared/object/PlayerQuestObject.cpp | 4 +- .../shared/object/ResourceContainerObject.cpp | 22 +- .../src/shared/object/ResourcePoolObject.cpp | 4 +- .../src/shared/object/ResourceTypeObject.cpp | 10 +- .../src/shared/object/ServerObject.cpp | 202 ++-- .../src/shared/object/ServerObject.h | 8 +- .../object/ServerObject_AuthTransfer.cpp | 4 +- .../object/ServerResourceClassObject.cpp | 2 +- .../src/shared/object/ShipObject.cpp | 64 +- .../shared/object/ShipObject_Components.cpp | 50 +- .../src/shared/object/StaticObject.cpp | 14 +- .../object/TangibleConditionObserver.cpp | 8 +- .../src/shared/object/TangibleObject.cpp | 256 ++--- .../src/shared/object/TangibleObject.h | 2 +- .../object/TangibleObject_Conversation.cpp | 34 +- .../src/shared/object/UniverseObject.cpp | 12 +- .../src/shared/object/WeaponObject.cpp | 14 +- .../objectTemplate/ServerArmorTemplate.cpp | 304 +++--- .../ServerBattlefieldMarkerObjectTemplate.cpp | 10 +- .../ServerBuildingObjectTemplate.cpp | 70 +- .../ServerCellObjectTemplate.cpp | 10 +- .../ServerCityObjectTemplate.cpp | 10 +- ...rverConstructionContractObjectTemplate.cpp | 10 +- .../ServerCreatureObjectTemplate.cpp | 558 +++++----- .../ServerDraftSchematicObjectTemplate.cpp | 428 ++++---- .../ServerFactoryObjectTemplate.cpp | 10 +- .../ServerGroupObjectTemplate.cpp | 10 +- .../ServerGuildObjectTemplate.cpp | 10 +- ...verHarvesterInstallationObjectTemplate.cpp | 166 +-- .../ServerInstallationObjectTemplate.cpp | 10 +- .../ServerIntangibleObjectTemplate.cpp | 304 +++--- ...rManufactureInstallationObjectTemplate.cpp | 10 +- ...rverManufactureSchematicObjectTemplate.cpp | 210 ++-- .../ServerMissionObjectTemplate.cpp | 10 +- .../objectTemplate/ServerObjectTemplate.cpp | 992 +++++++++--------- .../ServerPlanetObjectTemplate.cpp | 22 +- .../ServerPlayerObjectTemplate.cpp | 10 +- .../ServerPlayerQuestObjectTemplate.cpp | 10 +- .../ServerResourceContainerObjectTemplate.cpp | 58 +- .../ServerShipObjectTemplate.cpp | 22 +- .../ServerStaticObjectTemplate.cpp | 22 +- .../ServerTangibleObjectTemplate.cpp | 262 ++--- .../ServerUniverseObjectTemplate.cpp | 10 +- .../ServerVehicleObjectTemplate.cpp | 166 +-- .../ServerWeaponObjectTemplate.cpp | 586 +++++------ .../ServerXpManagerObjectTemplate.cpp | 12 +- .../library/serverGame/src/shared/pvp/Pvp.cpp | 6 +- .../src/shared/pvp/PvpRuleSetBase.cpp | 4 +- .../src/shared/pvp/PvpUpdateObserver.cpp | 8 +- .../serverGame/src/shared/region/Region.cpp | 6 +- .../src/shared/region/RegionMaster.cpp | 106 +- .../src/shared/resource/SurveySystem.cpp | 2 +- .../serverGame/src/shared/space/Missile.cpp | 4 +- .../src/shared/space/MissileManager.cpp | 14 +- .../src/shared/space/NebulaManagerServer.cpp | 8 +- .../src/shared/space/ProjectileManager.cpp | 12 +- .../shared/space/ServerAsteroidManager.cpp | 12 +- .../shared/space/ServerShipComponentData.cpp | 10 +- .../shared/space/ShipAiEnemySearchManager.cpp | 6 +- .../space/ShipComponentDataCargoHold.cpp | 2 +- .../shared/space/ShipComponentDataManager.cpp | 10 +- .../space/ShipInternalDamageOverTime.cpp | 10 +- .../ShipInternalDamageOverTimeManager.cpp | 14 +- .../src/shared/space/SpaceAttackSquad.cpp | 28 +- .../src/shared/space/SpaceDockingManager.cpp | 6 +- .../serverGame/src/shared/space/SpacePath.cpp | 8 +- .../src/shared/space/SpacePathManager.cpp | 6 +- .../src/shared/space/SpaceSquad.cpp | 50 +- .../src/shared/space/SpaceSquadManager.cpp | 4 +- .../shared/space/SpaceVisibilityManager.cpp | 12 +- .../InstallationSynchronizedUi.cpp | 4 +- .../src/shared/trading/ServerSecureTrade.cpp | 20 +- .../src/shared/TaskConnectionIdMessage.cpp | 2 +- .../AccountFeatureIdResponse.cpp | 2 +- .../AccountFeatureIdResponse.h | 2 +- .../AdjustAccountFeatureIdResponse.cpp | 2 +- .../AdjustAccountFeatureIdResponse.h | 6 +- .../SceneTransferMessages.cpp | 4 +- .../centralGameServer/SceneTransferMessages.h | 4 +- .../core/SetupServerNetworkMessages.cpp | 2 +- .../gameGameServer/AiCreatureStateMessage.cpp | 6 +- .../gameGameServer/AiMovementMessage.cpp | 4 +- .../GameServerMessageInterface.cpp | 6 +- .../gameGameServer/RenameCharacterMessage.cpp | 4 +- .../src/shared/CityPathGraph.cpp | 74 +- .../src/shared/CityPathGraphManager.cpp | 98 +- .../src/shared/CityPathNode.cpp | 28 +- .../src/shared/PathAutoGenerator.cpp | 14 +- .../src/shared/ServerPathBuilder.cpp | 150 +-- .../src/shared/ServerPathfindingMessaging.cpp | 50 +- .../shared/ServerPathfindingNotification.cpp | 8 +- .../src/shared/GameScriptObject.cpp | 116 +- .../serverScript/src/shared/JNIWrappers.cpp | 28 +- .../serverScript/src/shared/JavaLibrary.cpp | 902 ++++++++-------- .../src/shared/ScriptFunctionTable.cpp | 6 +- .../src/shared/ScriptListEntry.cpp | 8 +- .../serverScript/src/shared/ScriptListEntry.h | 2 +- .../src/shared/ScriptMethodsAi.cpp | 100 +- .../src/shared/ScriptMethodsAnimation.cpp | 14 +- .../src/shared/ScriptMethodsAttributes.cpp | 46 +- .../src/shared/ScriptMethodsAuction.cpp | 22 +- .../src/shared/ScriptMethodsBroadcasting.cpp | 6 +- .../src/shared/ScriptMethodsBuffBuilder.cpp | 6 +- .../src/shared/ScriptMethodsChat.cpp | 12 +- .../src/shared/ScriptMethodsCity.cpp | 2 +- .../src/shared/ScriptMethodsClientEffect.cpp | 90 +- .../shared/ScriptMethodsClusterWideData.cpp | 4 +- .../src/shared/ScriptMethodsCombat.cpp | 158 +-- .../src/shared/ScriptMethodsCommandQueue.cpp | 28 +- .../src/shared/ScriptMethodsConsole.cpp | 4 +- .../src/shared/ScriptMethodsContainers.cpp | 112 +- .../src/shared/ScriptMethodsCrafting.cpp | 230 ++-- .../src/shared/ScriptMethodsDebug.cpp | 12 +- .../shared/ScriptMethodsDynamicVariable.cpp | 110 +- .../src/shared/ScriptMethodsForm.cpp | 4 +- .../src/shared/ScriptMethodsHateList.cpp | 32 +- .../src/shared/ScriptMethodsHolocube.cpp | 4 +- .../src/shared/ScriptMethodsHyperspace.cpp | 36 +- .../src/shared/ScriptMethodsImageDesign.cpp | 10 +- .../src/shared/ScriptMethodsInstallation.cpp | 12 +- .../src/shared/ScriptMethodsInteriors.cpp | 56 +- .../src/shared/ScriptMethodsJedi.cpp | 96 +- .../src/shared/ScriptMethodsMap.cpp | 16 +- .../src/shared/ScriptMethodsMentalStates.cpp | 4 +- .../src/shared/ScriptMethodsMission.cpp | 104 +- .../src/shared/ScriptMethodsMoney.cpp | 18 +- .../src/shared/ScriptMethodsMount.cpp | 6 +- .../shared/ScriptMethodsNewbieTutorial.cpp | 2 +- .../src/shared/ScriptMethodsNotification.cpp | 6 +- .../src/shared/ScriptMethodsNpc.cpp | 30 +- .../src/shared/ScriptMethodsObjectCreate.cpp | 124 +-- .../src/shared/ScriptMethodsObjectInfo.cpp | 434 ++++---- .../src/shared/ScriptMethodsObjectMove.cpp | 64 +- .../src/shared/ScriptMethodsPermissions.cpp | 8 +- .../src/shared/ScriptMethodsPilot.cpp | 74 +- .../src/shared/ScriptMethodsPlayerAccount.cpp | 42 +- .../src/shared/ScriptMethodsPlayerQuest.cpp | 30 +- .../src/shared/ScriptMethodsPvp.cpp | 16 +- .../src/shared/ScriptMethodsQuest.cpp | 28 +- .../src/shared/ScriptMethodsRegion.cpp | 140 +-- .../src/shared/ScriptMethodsRegion3d.cpp | 2 +- .../src/shared/ScriptMethodsResource.cpp | 74 +- .../src/shared/ScriptMethodsScript.cpp | 26 +- .../src/shared/ScriptMethodsServerUI.cpp | 18 +- .../src/shared/ScriptMethodsShip.cpp | 102 +- .../src/shared/ScriptMethodsSkill.cpp | 92 +- .../src/shared/ScriptMethodsString.cpp | 6 +- .../src/shared/ScriptMethodsSystem.cpp | 10 +- .../src/shared/ScriptMethodsTerrain.cpp | 70 +- .../src/shared/ScriptMethodsVeteran.cpp | 38 +- .../src/shared/ScriptMethodsWaypoint.cpp | 2 +- .../src/shared/ScriptMethodsWorldInfo.cpp | 86 +- .../src/shared/ScriptParamArchive.cpp | 2 +- .../src/shared/ScriptParameters.cpp | 4 +- .../src/shared/ScriptParameters.h | 2 +- .../src/shared/AdminAccountManager.cpp | 4 +- .../src/shared/ChatLogManager.cpp | 2 +- .../src/shared/ClusterWideDataManagerList.cpp | 6 +- .../src/shared/FreeCtsDataTable.cpp | 32 +- .../src/shared/DataTableTool.cpp | 2 +- .../src/shared/TemplateCompiler.cpp | 30 +- .../core/TemplateDefinitionCompiler.cpp | 26 +- .../src/shared/core/BarrierObject.cpp | 6 +- .../src/shared/core/BoxTree.cpp | 50 +- .../sharedCollision/src/shared/core/BoxTree.h | 2 +- .../src/shared/core/CollisionBuckets.cpp | 2 +- .../src/shared/core/CollisionMesh.cpp | 12 +- .../src/shared/core/CollisionNotification.cpp | 2 +- .../src/shared/core/CollisionProperty.cpp | 92 +- .../src/shared/core/CollisionResolve.cpp | 24 +- .../src/shared/core/CollisionResolve.h | 10 +- .../src/shared/core/CollisionUtils.cpp | 52 +- .../src/shared/core/CollisionWorld.cpp | 110 +- .../src/shared/core/ConfigSharedCollision.cpp | 4 +- .../src/shared/core/Contact3d.h | 6 +- .../src/shared/core/ContactPoint.cpp | 6 +- .../src/shared/core/DoorObject.cpp | 26 +- .../sharedCollision/src/shared/core/Floor.cpp | 26 +- .../src/shared/core/FloorLocator.cpp | 24 +- .../src/shared/core/FloorManager.cpp | 8 +- .../src/shared/core/FloorMesh.cpp | 78 +- .../src/shared/core/Footprint.cpp | 42 +- .../core/FootprintForceReattachManager.cpp | 2 +- .../src/shared/core/MultiList.cpp | 72 +- .../src/shared/core/MultiList.h | 20 +- .../src/shared/core/NeighborObject.cpp | 2 +- .../src/shared/core/SimpleCollisionMesh.cpp | 4 +- .../src/shared/core/SpatialDatabase.cpp | 68 +- .../src/shared/extent/BoxExtent.cpp | 2 +- .../src/shared/extent/CollisionDetect.cpp | 38 +- .../src/shared/extent/CollisionDetect.h | 8 +- .../src/shared/extent/CompositeExtent.cpp | 6 +- .../src/shared/extent/CylinderExtent.cpp | 2 +- .../src/shared/extent/DetailExtent.cpp | 4 +- .../src/shared/extent/Extent.cpp | 2 +- .../src/shared/extent/ExtentList.cpp | 10 +- .../src/shared/extent/MeshExtent.cpp | 10 +- .../shared/extent/OrientedCylinderExtent.cpp | 2 +- .../src/shared/extent/SimpleExtent.cpp | 2 +- .../src/shared/BitStream.cpp | 44 +- .../sharedCompression/src/shared/Lz77.cpp | 10 +- .../src/shared/ZlibCompressor.cpp | 16 +- .../src/shared/core/Bindable.h | 10 +- .../src/shared/core/DbBindableBase.h | 2 +- .../src/shared/core/DbBindableBool.h | 2 +- .../src/shared/core/DbBindableString.h | 10 +- .../src/shared/core/DbBindableUnicode.h | 2 +- .../src/shared/core/DbBufferRow.h | 4 +- .../src/shared/core/DbServer.cpp | 8 +- .../shared/core/NullEncodedStandardString.h | 2 +- .../shared/core/NullEncodedUnicodeString.h | 2 +- .../src_oci/DbBindableVarray.cpp | 30 +- .../src_oci/OciQueryImplementation.cpp | 18 +- .../src_oci/OciServer.cpp | 2 +- .../src_oci/OciSession.cpp | 20 +- .../sharedDebug/src/linux/DebugMonitor.cpp | 2 +- .../src/linux/PerformanceTimer.cpp | 10 +- .../sharedDebug/src/shared/DataLint.cpp | 64 +- .../sharedDebug/src/shared/DebugFlags.cpp | 18 +- .../sharedDebug/src/shared/DebugKey.cpp | 2 +- .../sharedDebug/src/shared/InstallTimer.cpp | 2 +- .../sharedDebug/src/shared/PixCounter.cpp | 12 +- .../sharedDebug/src/shared/Profiler.cpp | 32 +- .../sharedDebug/src/shared/RemoteDebug.cpp | 16 +- .../sharedDebug/src/shared/RemoteDebug.h | 4 +- .../src/shared/RemoteDebug_inner.cpp | 26 +- .../src/shared/RemoteDebug_inner.h | 4 +- .../library/sharedDebug/src/shared/Report.cpp | 4 +- .../src/shared/AsynchronousLoader.cpp | 38 +- .../sharedFile/src/shared/FileManifest.cpp | 10 +- .../sharedFile/src/shared/FileNameUtils.cpp | 8 +- .../sharedFile/src/shared/FileStreamer.cpp | 10 +- .../src/shared/FileStreamerFile.cpp | 4 +- .../src/shared/FileStreamerThread.cpp | 38 +- .../library/sharedFile/src/shared/Iff.cpp | 34 +- .../library/sharedFile/src/shared/Iff.h | 4 +- .../src/shared/IndentedFileWriter.cpp | 14 +- .../sharedFile/src/shared/MemoryFile.cpp | 8 +- .../sharedFile/src/shared/TreeFile.cpp | 40 +- .../src/shared/TreeFile_SearchNode.cpp | 42 +- .../sharedFile/src/shared/ZlibFile.cpp | 8 +- .../library/sharedFoundation/src/linux/Os.cpp | 12 +- .../src/linux/PerThreadData.cpp | 8 +- .../src/linux/PerThreadData.h | 8 +- .../src/linux/PlatformGlue.cpp | 6 +- .../sharedFoundation/src/linux/PlatformGlue.h | 6 +- .../src/linux/SetupSharedFoundation.cpp | 12 +- .../sharedFoundation/src/linux/vsnprintf.cpp | 2 +- .../sharedFoundation/src/shared/BitArray.cpp | 4 +- .../sharedFoundation/src/shared/BitArray.h | 2 +- .../src/shared/CalendarTime.cpp | 18 +- .../src/shared/CommandLine.cpp | 78 +- .../sharedFoundation/src/shared/CommandLine.h | 2 +- .../src/shared/ConfigFile.cpp | 50 +- .../sharedFoundation/src/shared/ConfigFile.h | 2 +- .../src/shared/CrashReportInformation.cpp | 2 +- .../sharedFoundation/src/shared/Crc.cpp | 2 +- .../src/shared/CrcStringTable.cpp | 14 +- .../src/shared/DataResourceList.h | 30 +- .../sharedFoundation/src/shared/ExitChain.cpp | 12 +- .../sharedFoundation/src/shared/Fatal.cpp | 6 +- .../sharedFoundation/src/shared/Fatal.h | 8 +- .../src/shared/FormattedString.h | 4 +- .../sharedFoundation/src/shared/LabelHash.cpp | 4 +- .../src/shared/MemoryBlockManager.cpp | 16 +- .../src/shared/MessageQueue.cpp | 4 +- .../sharedFoundation/src/shared/Misc.h | 20 +- .../src/shared/PersistentCrcString.cpp | 38 +- .../library/sharedFoundation/src/shared/Tag.h | 4 +- .../sharedFoundation/src/shared/Watcher.cpp | 4 +- .../sharedFoundation/src/shared/Watcher.h | 14 +- .../dynamicVariable/DynamicVariable.cpp | 96 +- .../shared/dynamicVariable/DynamicVariable.h | 4 +- .../appearance/WearableAppearanceMap.cpp | 12 +- .../collision/CollisionCallbackManager.cpp | 10 +- .../src/shared/core/AiDebugString.cpp | 2 +- .../shared/core/AssetCustomizationManager.cpp | 26 +- .../src/shared/core/CitizenRankDataTable.cpp | 6 +- .../src/shared/core/CollectionsDataTable.cpp | 38 +- .../CommoditiesAdvancedSearchAttribute.cpp | 6 +- .../src/shared/core/CustomizationManager.cpp | 6 +- .../src/shared/core/FormManager.cpp | 32 +- .../src/shared/core/GameScheduler.cpp | 2 +- .../src/shared/core/GroundZoneManager.cpp | 6 +- .../src/shared/core/GuildRankDataTable.cpp | 8 +- .../src/shared/core/LfgCharacterData.cpp | 2 +- .../src/shared/core/LfgDataTable.cpp | 24 +- .../sharedGame/src/shared/core/LfgDataTable.h | 2 +- .../src/shared/core/PlayerCreationManager.cpp | 4 +- .../shared/core/SharedBuffBuilderManager.cpp | 2 +- .../shared/core/SharedBuildoutAreaManager.cpp | 16 +- .../core/SharedImageDesignerManager.cpp | 2 +- .../sharedGame/src/shared/core/Universe.cpp | 6 +- .../src/shared/core/WearableEntry.cpp | 2 +- .../mount/MountValidScaleRangeTable.cpp | 4 +- .../src/shared/mount/SharedSaddleManager.cpp | 2 +- .../src/shared/object/ResourceClassObject.cpp | 34 +- .../src/shared/object/ResourceClassObject.h | 2 +- .../sharedGame/src/shared/object/Waypoint.cpp | 2 +- .../SharedBattlefieldMarkerObjectTemplate.cpp | 106 +- .../SharedBuildingObjectTemplate.cpp | 34 +- .../SharedCellObjectTemplate.cpp | 10 +- ...aredConstructionContractObjectTemplate.cpp | 10 +- .../SharedCreatureObjectTemplate.cpp | 774 +++++++------- .../SharedDraftSchematicObjectTemplate.cpp | 202 ++-- .../SharedFactoryObjectTemplate.cpp | 10 +- .../SharedGroupObjectTemplate.cpp | 10 +- .../SharedGuildObjectTemplate.cpp | 10 +- .../SharedInstallationObjectTemplate.cpp | 10 +- .../SharedIntangibleObjectTemplate.cpp | 10 +- .../SharedJediManagerObjectTemplate.cpp | 10 +- ...aredManufactureSchematicObjectTemplate.cpp | 10 +- .../SharedMissionObjectTemplate.cpp | 10 +- .../objectTemplate/SharedObjectTemplate.cpp | 494 ++++----- .../SharedPlayerObjectTemplate.cpp | 10 +- .../SharedPlayerQuestObjectTemplate.cpp | 10 +- .../SharedResourceContainerObjectTemplate.cpp | 10 +- .../SharedShipObjectTemplate.cpp | 58 +- .../SharedStaticObjectTemplate.cpp | 10 +- .../SharedTangibleObjectTemplate.cpp | 546 +++++----- .../SharedTerrainSurfaceObjectTemplate.cpp | 70 +- .../SharedUniverseObjectTemplate.cpp | 10 +- .../SharedVehicleObjectTemplate.cpp | 334 +++--- .../SharedWaypointObjectTemplate.cpp | 10 +- .../SharedWeaponObjectTemplate.cpp | 82 +- .../sharedGame/src/shared/quest/Quest.cpp | 2 +- .../src/shared/quest/QuestManager.cpp | 8 +- .../space/AsteroidGenerationManager.cpp | 12 +- .../src/shared/space/NebulaManager.cpp | 16 +- .../src/shared/space/ShipChassis.cpp | 16 +- .../src/shared/space/ShipChassisSlot.cpp | 4 +- .../src/shared/space/ShipChassisWritable.cpp | 4 +- .../space/ShipComponentAttachmentManager.cpp | 14 +- .../src/shared/space/ShipComponentData.cpp | 2 +- .../shared/space/ShipComponentDescriptor.cpp | 26 +- .../space/ShipComponentDescriptorWritable.cpp | 2 +- .../space/ShipComponentWeaponManager.cpp | 4 +- .../sharedGame/src/shared/sui/SuiPageData.cpp | 10 +- .../sharedImage/src/shared/TargaFormat.cpp | 4 +- .../library/sharedIoWin/src/shared/IoWin.cpp | 6 +- .../sharedIoWin/src/shared/IoWinManager.cpp | 44 +- .../sharedIoWin/src/shared/IoWinManager.h | 2 +- .../sharedMath/src/shared/MxCifQuadTree.cpp | 42 +- .../src/shared/MxCifQuadTreeBounds.h | 4 +- .../library/sharedMath/src/shared/Plane.cpp | 22 +- .../sharedMath/src/shared/Quaternion.cpp | 2 +- .../sharedMath/src/shared/SphereTreeNode.h | 6 +- .../sharedMath/src/shared/Transform.cpp | 18 +- .../library/sharedMath/src/shared/Vector.cpp | 4 +- .../src/shared/debug/DebugShapeRenderer.cpp | 6 +- .../src/shared/MemoryManager.cpp | 42 +- .../src/shared/Emitter.cpp | 2 +- .../src/shared/Receiver.cpp | 2 +- .../sharedNetwork/src/linux/TcpClient.cpp | 4 +- .../sharedNetwork/src/shared/Service.cpp | 4 +- .../core/SetupSharedNetworkMessages.cpp | 2 +- .../src/shared/ObjectWatcherList.cpp | 12 +- .../src/shared/appearance/Appearance.cpp | 38 +- .../src/shared/appearance/Appearance.h | 2 +- .../shared/appearance/AppearanceTemplate.cpp | 16 +- .../appearance/AppearanceTemplateList.cpp | 16 +- .../container/ArrangementDescriptorList.cpp | 2 +- .../shared/container/ContainedByProperty.cpp | 2 +- .../src/shared/container/Container.cpp | 12 +- .../src/shared/container/SlotIdManager.cpp | 6 +- .../src/shared/container/SlottedContainer.cpp | 2 +- .../src/shared/container/VolumeContainer.cpp | 4 +- .../src/shared/container/VolumeContainer.h | 4 +- .../src/shared/controller/Controller.cpp | 14 +- .../src/shared/core/SetupSharedObject.cpp | 2 +- .../src/shared/core/SetupSharedObject.h | 2 +- .../customization/CustomizationData.cpp | 8 +- .../CustomizationData_LocalDirectory.cpp | 26 +- .../customization/CustomizationIdManager.cpp | 2 +- .../ObjectTemplateCustomizationDataWriter.cpp | 2 +- .../src/shared/lot/LotManager.cpp | 8 +- .../src/shared/object/AlterScheduler.cpp | 54 +- .../src/shared/object/CachedNetworkId.cpp | 12 +- .../sharedObject/src/shared/object/Object.cpp | 196 ++-- .../sharedObject/src/shared/object/Object.h | 18 +- .../src/shared/object/ObjectList.cpp | 10 +- .../src/shared/object/ObjectTemplate.cpp | 8 +- .../src/shared/object/ObjectTemplateList.cpp | 4 +- .../src/shared/object/ScheduleData.cpp | 12 +- .../src/shared/portal/CellProperty.cpp | 100 +- .../sharedObject/src/shared/portal/Portal.cpp | 20 +- .../src/shared/portal/PortalProperty.cpp | 14 +- .../shared/portal/PortalPropertyTemplate.cpp | 32 +- .../src/shared/portal/SphereGrid.h | 6 +- .../src/shared/property/LayerProperty.cpp | 6 +- .../sharedObject/src/shared/world/World.cpp | 4 +- .../src/shared/DynamicPathGraph.cpp | 36 +- .../src/shared/DynamicPathGraph.h | 2 +- .../src/shared/DynamicPathNode.cpp | 6 +- .../src/shared/PathGraph.cpp | 10 +- .../src/shared/PathGraphIterator.cpp | 10 +- .../sharedPathfinding/src/shared/PathNode.cpp | 4 +- .../src/shared/PathSearch.cpp | 42 +- .../src/shared/Pathfinding.cpp | 2 +- .../src/shared/SetupSharedPathfinding.cpp | 6 +- .../src/shared/SimplePathGraph.cpp | 26 +- .../src/shared/SharedRemoteDebugServer.cpp | 8 +- .../SharedRemoteDebugServerConnection.cpp | 4 +- .../src/shared/ExpertiseManager.cpp | 2 +- .../src/shared/LevelManager.cpp | 4 +- .../src/shared/SkillManager.cpp | 10 +- .../shared/template/ServerArmorTemplate.cpp | 48 +- .../ServerBattlefieldMarkerObjectTemplate.cpp | 10 +- .../template/ServerBuildingObjectTemplate.cpp | 22 +- .../template/ServerCellObjectTemplate.cpp | 10 +- .../template/ServerCityObjectTemplate.cpp | 10 +- ...rverConstructionContractObjectTemplate.cpp | 10 +- .../template/ServerCreatureObjectTemplate.cpp | 80 +- .../ServerDraftSchematicObjectTemplate.cpp | 94 +- .../template/ServerFactoryObjectTemplate.cpp | 10 +- .../template/ServerGroupObjectTemplate.cpp | 10 +- .../template/ServerGuildObjectTemplate.cpp | 10 +- ...verHarvesterInstallationObjectTemplate.cpp | 30 +- .../ServerInstallationObjectTemplate.cpp | 10 +- .../ServerIntangibleObjectTemplate.cpp | 70 +- .../ServerJediManagerObjectTemplate.cpp | 10 +- ...rManufactureInstallationObjectTemplate.cpp | 10 +- ...rverManufactureSchematicObjectTemplate.cpp | 48 +- .../template/ServerMissionObjectTemplate.cpp | 10 +- .../shared/template/ServerObjectTemplate.cpp | 160 +-- .../template/ServerPlanetObjectTemplate.cpp | 16 +- .../template/ServerPlayerObjectTemplate.cpp | 10 +- .../ServerPlayerQuestObjectTemplate.cpp | 10 +- .../ServerResourceClassObjectTemplate.cpp | 34 +- .../ServerResourceContainerObjectTemplate.cpp | 16 +- .../ServerResourcePoolObjectTemplate.cpp | 20 +- .../ServerResourceTypeObjectTemplate.cpp | 16 +- .../template/ServerShipObjectTemplate.cpp | 16 +- .../template/ServerStaticObjectTemplate.cpp | 16 +- .../template/ServerTangibleObjectTemplate.cpp | 50 +- .../template/ServerTokenObjectTemplate.cpp | 10 +- .../template/ServerUberObjectTemplate.cpp | 390 +++---- .../template/ServerUniverseObjectTemplate.cpp | 10 +- .../template/ServerVehicleObjectTemplate.cpp | 30 +- .../template/ServerWaypointObjectTemplate.cpp | 10 +- .../template/ServerWeaponObjectTemplate.cpp | 74 +- .../ServerXpManagerObjectTemplate.cpp | 10 +- .../SharedBattlefieldMarkerObjectTemplate.cpp | 22 +- .../template/SharedBuildingObjectTemplate.cpp | 20 +- .../template/SharedCellObjectTemplate.cpp | 10 +- ...aredConstructionContractObjectTemplate.cpp | 10 +- .../template/SharedCreatureObjectTemplate.cpp | 106 +- .../SharedDraftSchematicObjectTemplate.cpp | 54 +- .../template/SharedFactoryObjectTemplate.cpp | 10 +- .../template/SharedGroupObjectTemplate.cpp | 10 +- .../template/SharedGuildObjectTemplate.cpp | 10 +- .../SharedInstallationObjectTemplate.cpp | 10 +- .../SharedIntangibleObjectTemplate.cpp | 10 +- .../SharedJediManagerObjectTemplate.cpp | 10 +- ...aredManufactureSchematicObjectTemplate.cpp | 10 +- .../template/SharedMissionObjectTemplate.cpp | 10 +- .../shared/template/SharedObjectTemplate.cpp | 108 +- .../template/SharedPlayerObjectTemplate.cpp | 10 +- .../SharedPlayerQuestObjectTemplate.cpp | 10 +- .../SharedResourceContainerObjectTemplate.cpp | 10 +- .../template/SharedShipObjectTemplate.cpp | 30 +- .../template/SharedStaticObjectTemplate.cpp | 10 +- .../template/SharedTangibleObjectTemplate.cpp | 114 +- .../SharedTerrainSurfaceObjectTemplate.cpp | 22 +- .../template/SharedTokenObjectTemplate.cpp | 10 +- .../template/SharedUniverseObjectTemplate.cpp | 10 +- .../template/SharedVehicleObjectTemplate.cpp | 40 +- .../template/SharedWaypointObjectTemplate.cpp | 10 +- .../template/SharedWeaponObjectTemplate.cpp | 26 +- .../src/shared/core/File.cpp | 12 +- .../src/shared/core/File.h | 14 +- .../src/shared/core/Filename.cpp | 44 +- .../src/shared/core/Filename.h | 10 +- .../src/shared/core/ObjectTemplate.cpp | 12 +- .../src/shared/core/TemplateData.cpp | 356 +++---- .../src/shared/core/TemplateData.h | 6 +- .../src/shared/core/TemplateDataIterator.cpp | 18 +- .../shared/core/TemplateDefinitionFile.cpp | 40 +- .../src/shared/core/TemplateDefinitionFile.h | 2 +- .../src/shared/core/TemplateGlobals.cpp | 32 +- .../src/shared/core/TpfFile.cpp | 164 +-- .../src/shared/core/TpfTemplate.cpp | 64 +- .../ProceduralTerrainAppearance.cpp | 18 +- .../SamplerProceduralTerrainAppearance.cpp | 2 +- .../ServerProceduralTerrainAppearance.cpp | 2 +- .../src/shared/appearance/TerrainQuadTree.cpp | 12 +- .../src/shared/appearance/TerrainQuadTree.h | 2 +- .../src/shared/core/WaterTypeManager.cpp | 8 +- .../src/shared/generator/BitmapGroup.cpp | 2 +- .../src/shared/generator/ShaderGroup.cpp | 2 +- .../src/shared/object/TerrainObject.cpp | 2 +- .../src/shared/CachedFileManager.cpp | 10 +- .../src/shared/CurrentUserOptionManager.cpp | 4 +- .../sharedUtility/src/shared/DataTable.cpp | 14 +- .../src/shared/DataTableColumnType.cpp | 6 +- .../src/shared/DataTableManager.cpp | 8 +- .../src/shared/DataTableWriter.cpp | 4 +- .../sharedUtility/src/shared/FileName.cpp | 4 +- .../sharedUtility/src/shared/RotaryCache.cpp | 10 +- .../src/shared/SetupSharedUtility.cpp | 2 +- .../src/shared/TemplateParameter.cpp | 12 +- .../src/shared/TemplateParameter.h | 28 +- .../src/shared/ValueDictionary.cpp | 2 +- .../src/shared/ValueDictionaryArchive.cpp | 4 +- .../src/shared/tree/XmlTreeDocument.cpp | 10 +- .../src/shared/tree/XmlTreeDocumentList.cpp | 8 +- .../sharedXml/src/shared/tree/XmlTreeNode.cpp | 48 +- .../platform/projects/MonAPI2/MonitorAPI.cpp | 30 +- .../platform/projects/MonAPI2/MonitorAPI.h | 10 +- .../platform/projects/MonAPI2/MonitorData.cpp | 18 +- .../platform/projects/MonAPI2/MonitorData.h | 8 +- .../Session/CommonAPI/CommonClient.cpp | 4 +- .../projects/Session/LoginAPI/ClientCore.cpp | 8 +- .../library/platform/utils/Base/Archive.cpp | 4 +- .../library/platform/utils/Base/AutoLog.cpp | 30 +- .../3rd/library/platform/utils/Base/AutoLog.h | 4 +- .../library/platform/utils/Base/Config.cpp | 26 +- .../3rd/library/platform/utils/Base/Config.h | 24 +- .../library/platform/utils/Base/Statistics.h | 4 +- .../utils/Base/TemplateObjectAllocator.h | 4 +- .../utils/Base/linux/BlockAllocator.cpp | 8 +- .../platform/utils/Base/linux/Event.cpp | 6 +- .../platform/utils/Base/linux/Logger.cpp | 18 +- .../platform/utils/Base/linux/Thread.cpp | 12 +- .../CSAssistStressTest/test.cpp | 54 +- .../CSAssistgameapi/CSAssistgameapicore.cpp | 72 +- .../CSAssistgameapi/CSAssistgameapicore.h | 4 +- .../CSAssistgameapi/CSAssistreceiver.cpp | 6 +- .../CSAssistgameapi/CSAssisttest/test.cpp | 12 +- .../CSAssist/CSAssistgameapi/packdata.cpp | 2 +- .../CSAssist/utils/Base/Archive.cpp | 4 +- .../CSAssist/utils/Base/AutoLog.cpp | 30 +- .../soePlatform/CSAssist/utils/Base/AutoLog.h | 4 +- .../CSAssist/utils/Base/Config.cpp | 26 +- .../soePlatform/CSAssist/utils/Base/Config.h | 24 +- .../CSAssist/utils/Base/Logger.cpp | 24 +- .../CSAssist/utils/Base/Statistics.h | 4 +- .../utils/Base/TemplateObjectAllocator.h | 4 +- .../CSAssist/utils/Base/WideString.h | 60 +- .../utils/Base/linux/BlockAllocator.cpp | 8 +- .../CSAssist/utils/Base/linux/Event.cpp | 6 +- .../CSAssist/utils/Base/linux/Thread.cpp | 12 +- .../CSAssist/utils/Base/serialize.h | 6 +- .../CSAssist/utils/TcpLibrary/IPAddress.h | 2 +- .../utils/TcpLibrary/TcpBlockAllocator.cpp | 6 +- .../utils/TcpLibrary/TcpConnection.cpp | 64 +- .../CSAssist/utils/TcpLibrary/TcpConnection.h | 2 +- .../CSAssist/utils/TcpLibrary/TcpManager.cpp | 106 +- .../CSAssist/utils/TcpLibrary/TcpManager.h | 4 +- .../TcpLibrary/TestClient/TestClient.cpp | 10 +- .../utils/Unicode/UnicodeCharacterDataMap.h | 2 +- .../CSAssist/utils/Unicode/utf8.cpp | 2 +- .../CTServiceGameAPI/Base/Archive.cpp | 4 +- .../CTGenericAPI/GenericApiCore.cpp | 16 +- .../CTGenericAPI/GenericConnection.cpp | 20 +- .../CTServiceGameAPI/CTServiceAPI.cpp | 4 +- .../CTServiceGameAPI/TcpLibrary/IPAddress.h | 2 +- .../TcpLibrary/TcpBlockAllocator.cpp | 6 +- .../TcpLibrary/TcpConnection.cpp | 64 +- .../TcpLibrary/TcpConnection.h | 2 +- .../TcpLibrary/TcpManager.cpp | 106 +- .../CTServiceGameAPI/TcpLibrary/TcpManager.h | 4 +- .../CTServiceGameAPI/TestClient/Main.cpp | 2 +- .../Unicode/UnicodeCharacterDataMap.h | 2 +- .../CTServiceGameAPI/test/main.cpp | 2 +- .../projects/ChatAPI/AvatarIteratorCore.cpp | 24 +- .../projects/ChatAPI/AvatarListItemCore.cpp | 4 +- .../ChatAPI/projects/ChatAPI/ChatAPI.cpp | 12 +- .../ChatAPI/projects/ChatAPI/ChatAPI.h | 12 +- .../ChatAPI/projects/ChatAPI/ChatAPICore.cpp | 172 +-- .../ChatAPI/projects/ChatAPI/ChatEnum.cpp | 2 +- .../projects/ChatAPI/ChatFriendStatusCore.cpp | 4 +- .../projects/ChatAPI/ChatIgnoreStatusCore.cpp | 4 +- .../ChatAPI/projects/ChatAPI/ChatRoom.cpp | 2 +- .../ChatAPI/projects/ChatAPI/ChatRoomCore.cpp | 46 +- .../ChatAPI/projects/ChatAPI/Message.cpp | 8 +- .../projects/ChatAPI/PersistentMessage.cpp | 4 +- .../ChatAPI/projects/ChatAPI/Request.cpp | 4 +- .../ChatAPI/projects/ChatAPI/Response.cpp | 72 +- .../ChatAPI/utils/Base/Archive.cpp | 4 +- .../ChatAPI/utils/Base/AutoLog.cpp | 30 +- .../soePlatform/ChatAPI/utils/Base/AutoLog.h | 4 +- .../ChatAPI/utils/Base/CmdLine.cpp | 4 +- .../soePlatform/ChatAPI/utils/Base/Config.cpp | 26 +- .../soePlatform/ChatAPI/utils/Base/Config.h | 24 +- .../soePlatform/ChatAPI/utils/Base/Logger.cpp | 28 +- .../ChatAPI/utils/Base/Statistics.h | 4 +- .../utils/Base/TemplateObjectAllocator.h | 4 +- .../ChatAPI/utils/Base/WideString.h | 60 +- .../utils/Base/linux/BlockAllocator.cpp | 8 +- .../ChatAPI/utils/Base/linux/Event.cpp | 6 +- .../ChatAPI/utils/Base/linux/Thread.cpp | 12 +- .../ChatAPI/utils/Base/serialize.h | 6 +- .../utils/GenericAPI/GenericApiCore.cpp | 16 +- .../utils/GenericAPI/GenericConnection.cpp | 20 +- .../utils/UdpLibrary/UdpConnection.cpp | 90 +- .../ChatAPI/utils/UdpLibrary/UdpConnection.h | 24 +- .../utils/UdpLibrary/UdpDriverLinux.cpp | 16 +- .../utils/UdpLibrary/UdpDriverWindows.cpp | 16 +- .../ChatAPI/utils/UdpLibrary/UdpHashTable.h | 92 +- .../ChatAPI/utils/UdpLibrary/UdpLinkedList.h | 50 +- .../utils/UdpLibrary/UdpLogicalPacket.cpp | 18 +- .../utils/UdpLibrary/UdpLogicalPacket.h | 10 +- .../ChatAPI/utils/UdpLibrary/UdpManager.cpp | 144 +-- .../ChatAPI/utils/UdpLibrary/UdpManager.h | 26 +- .../ChatAPI/utils/UdpLibrary/UdpMisc.cpp | 28 +- .../ChatAPI/utils/UdpLibrary/UdpMisc.h | 4 +- .../ChatAPI/utils/UdpLibrary/UdpPriority.h | 18 +- .../utils/UdpLibrary/UdpReliableChannel.cpp | 72 +- .../utils/UdpLibrary/UdpReliableChannel.h | 4 +- .../utils/Unicode/UnicodeCharacterDataMap.h | 2 +- .../ChatAPI/utils/Unicode/utf8.cpp | 2 +- .../projects/VChat/VChatAPI/common.cpp | 28 +- .../VChat/VChatUnitTest/VChatClient.cpp | 28 +- .../VChatAPI/utils2.0/utils/Api/api.cpp | 16 +- .../VChatAPI/utils2.0/utils/Api/api.h | 2 +- .../utils2.0/utils/Api/apiMessages.cpp | 22 +- .../VChatAPI/utils2.0/utils/Api/apiMessages.h | 6 +- .../VChatAPI/utils2.0/utils/Api/apiPinned.cpp | 4 +- .../VChatAPI/utils2.0/utils/Base/cmdLine.cpp | 4 +- .../VChatAPI/utils2.0/utils/Base/date.cpp | 2 +- .../VChatAPI/utils2.0/utils/Base/dateUtils.h | 4 +- .../utils/Base/genericRateLimitingMechanism.h | 6 +- .../utils2.0/utils/Base/hashtable.hpp | 100 +- .../VChatAPI/utils2.0/utils/Base/log.cpp | 24 +- .../utils2.0/utils/Base/monitorAPI.cpp | 28 +- .../VChatAPI/utils2.0/utils/Base/monitorAPI.h | 4 +- .../utils2.0/utils/Base/monitorData.cpp | 18 +- .../utils2.0/utils/Base/monitorData.h | 6 +- .../VChatAPI/utils2.0/utils/Base/priority.hpp | 18 +- .../utils2.0/utils/Base/stringutils.cpp | 4 +- .../utils2.0/utils/Base/stringutils.h | 2 +- .../utils2.0/utils/Base/substringSearchTree.h | 54 +- .../VChatAPI/utils2.0/utils/Base/thread.cpp | 16 +- .../VChatAPI/utils2.0/utils/Base/utf8.cpp | 2 +- .../utils2.0/utils/TcpLibrary/IPAddress.h | 2 +- .../utils/TcpLibrary/TcpBlockAllocator.cpp | 6 +- .../utils/TcpLibrary/TcpConnection.cpp | 64 +- .../utils2.0/utils/TcpLibrary/TcpConnection.h | 2 +- .../utils2.0/utils/TcpLibrary/TcpManager.cpp | 110 +- .../utils2.0/utils/TcpLibrary/TcpManager.h | 4 +- .../utils2.0/utils/UdpLibrary/UdpLibrary.cpp | 434 ++++---- .../utils2.0/utils/UdpLibrary/UdpLibrary.hpp | 42 +- .../3rd/library/udplibrary/PointerDeque.hpp | 14 +- .../3rd/library/udplibrary/UdpLibrary.cpp | 428 ++++---- .../3rd/library/udplibrary/UdpLibrary.hpp | 42 +- external/3rd/library/udplibrary/hashtable.hpp | 100 +- external/3rd/library/udplibrary/priority.hpp | 18 +- external/3rd/library/udplibrary/udpclient.cpp | 4 +- external/3rd/library/udplibrary/udpserver.cpp | 2 +- .../src/shared/AutoDeltaVariableCallback.h | 2 +- .../library/archive/src/shared/ByteStream.cpp | 2 +- .../library/archive/src/shared/ByteStream.h | 2 +- .../crypto/src/shared/original/cryptlib.h | 2 +- .../crypto/src/shared/original/filters.cpp | 8 +- .../crypto/src/shared/original/filters.h | 32 +- .../crypto/src/shared/original/queue.cpp | 2 +- .../crypto/src/shared/original/smartptr.h | 18 +- .../src/shared/wrapper/TwofishCrypt.cpp | 2 +- .../fileInterface/src/shared/AbstractFile.cpp | 6 +- .../fileInterface/src/shared/AbstractFile.h | 2 +- .../fileInterface/src/shared/StdioFile.cpp | 16 +- .../src/shared/LocalizationManager.cpp | 18 +- .../src/shared/LocalizedString.cpp | 12 +- .../src/shared/LocalizedStringTable.cpp | 12 +- .../LocalizedStringTableReaderWriter.cpp | 12 +- .../library/singleton/src/shared/Singleton2.h | 4 +- .../src/shared/UnicodeCharacterDataMap.cpp | 6 +- .../src/shared/UnicodeCharacterDataMap.h | 2 +- .../unicode/src/shared/UnicodeUtils.cpp | 2 +- .../library/unicode/src/shared/UnicodeUtils.h | 4 +- .../ours/library/unicode/src/shared/utf8.cpp | 2 +- .../SwgDatabaseServer/src/linux/main.cpp | 2 +- .../shared/buffers/AuctionLocationsBuffer.cpp | 4 +- .../buffers/BattlefieldParticipantBuffer.cpp | 4 +- .../buffers/BountyHunterTargetBuffer.cpp | 2 +- .../shared/buffers/CreatureObjectBuffer.cpp | 2 +- .../src/shared/buffers/ExperienceBuffer.cpp | 4 +- .../buffers/IndexedNetworkTableBuffer.h | 4 +- .../ManufactureSchematicAttributeBuffer.cpp | 4 +- .../buffers/MarketAuctionBidsBuffer.cpp | 4 +- .../shared/buffers/MarketAuctionsBuffer.cpp | 6 +- .../src/shared/buffers/ObjectTableBuffer.cpp | 6 +- .../src/shared/buffers/ResourceTypeBuffer.cpp | 4 +- .../cleanup/TaskObjectTemplateListUpdater.cpp | 2 +- .../src/shared/core/CMLoader.cpp | 4 +- .../src/shared/core/ObjvarNameManager.cpp | 16 +- .../src/shared/core/SwgLoader.cpp | 10 +- .../src/shared/core/SwgPersister.cpp | 2 +- .../src/shared/core/SwgSnapshot.cpp | 8 +- .../src/shared/queries/CommoditiesQuery.cpp | 10 +- .../src/shared/tasks/TaskSaveObjvarNames.cpp | 2 +- .../src/shared/combat/CombatEngine.cpp | 36 +- .../controller/JediManagerController.cpp | 28 +- .../SwgPlayerCreatureController.cpp | 2 +- .../src/shared/core/CSHandler.cpp | 14 +- .../src/shared/core/SwgGameServer.cpp | 6 +- .../src/shared/core/SwgServerUniverse.cpp | 4 +- .../src/shared/object/JediManagerObject.cpp | 8 +- .../src/shared/object/SwgCreatureObject.cpp | 12 +- .../src/shared/object/SwgPlayerObject.cpp | 10 +- .../ServerJediManagerObjectTemplate.cpp | 10 +- .../core/SetupSwgServerNetworkMessages.cpp | 2 +- .../combat/MessageQueueCombatAction.cpp | 8 +- .../core/SetupSwgSharedNetworkMessages.cpp | 2 +- .../src/shared/CombatEngineData.h | 8 +- 937 files changed, 14983 insertions(+), 14983 deletions(-) diff --git a/engine/client/application/Miff/src/linux/InputFileHandler.cpp b/engine/client/application/Miff/src/linux/InputFileHandler.cpp index ead23d7c..0cb2d496 100755 --- a/engine/client/application/Miff/src/linux/InputFileHandler.cpp +++ b/engine/client/application/Miff/src/linux/InputFileHandler.cpp @@ -124,7 +124,7 @@ int InputFileHandler::deleteFile( if (deleteHandleFlag && file) { delete file; - file = NULL; + file = nullptr; } return(unlink(filename)); } diff --git a/engine/client/application/Miff/src/linux/OutputFileHandler.cpp b/engine/client/application/Miff/src/linux/OutputFileHandler.cpp index 1c8ffe96..82fa61a9 100755 --- a/engine/client/application/Miff/src/linux/OutputFileHandler.cpp +++ b/engine/client/application/Miff/src/linux/OutputFileHandler.cpp @@ -20,7 +20,7 @@ OutputFileHandler::OutputFileHandler(const char *filename) { outputIFF = new Iff(MAXIFFDATASIZE); - outFilename = NULL; + outFilename = nullptr; setCurrentFilename(filename); } @@ -45,7 +45,7 @@ OutputFileHandler::~OutputFileHandler(void) delete [] outFilename; } - outputIFF = NULL; + outputIFF = nullptr; } diff --git a/engine/client/application/Miff/src/linux/miff.cpp b/engine/client/application/Miff/src/linux/miff.cpp index cd395ab5..5bf4af1b 100755 --- a/engine/client/application/Miff/src/linux/miff.cpp +++ b/engine/client/application/Miff/src/linux/miff.cpp @@ -55,7 +55,7 @@ //================================================= static vars assignment == const int entryPointVersion = 1; // constantly check DataEntryPoint.h to see if this value has changed -OutputFileHandler *outfileHandler = NULL; +OutputFileHandler *outfileHandler = nullptr; const int bufferSize = 16 * 1024 * 1024; const int maxStringSize = 256; const char version[] = "1.3 September 18, 2000"; @@ -242,7 +242,7 @@ int main( int argc, // number of args in commandline // static void callbackFunction(void) { - outfileHandler = NULL; + outfileHandler = nullptr; #ifdef WIN32 @@ -392,13 +392,13 @@ static errorType evaluateArgs(void) // get default values from DOS char currentDir[maxStringSize]; - if (NULL == getcwd(currentDir, maxStringSize)) // get current working directory + if (nullptr == getcwd(currentDir, maxStringSize)) // get current working directory { retVal = ERR_UNKNOWNDIR; return(retVal); } drive[0] = currentDir[0]; // drive letter - drive[1] = 0; // and null terminate it + drive[1] = 0; // and nullptr terminate it strcpy(extension, "IFF"); // default to uppercase .IFF strcpy(directory, ¤tDir[2]); // get everything after the Drive: including the first backslash filename[0] = 0; @@ -619,7 +619,7 @@ static errorType loadInputToBuffer( // we've successfully read the file, now close it... delete inFileHandler; } - else // inFileName is NULL + else // inFileName is nullptr { retVal = ERR_FILENOTFOUND; } @@ -746,7 +746,7 @@ static void handleError(errorType error) // Revisions and History: // 1/07/99 [] - created // -extern "C" void MIFFMessage(char *message, // null terminated string to be displayed +extern "C" void MIFFMessage(char *message, // nullptr terminated string to be displayed int forceOutput) // if non-zero, it will print out even in quiet mode (for ERRORs) { if (forceOutput) diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferClient.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferClient.cpp index eb67f237..c7ddebeb 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferClient.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferClient.cpp @@ -35,7 +35,7 @@ void AuctionTransferClient::addCoinToAuction( const ExchangeListCreditsMessage& // 2bi. if user connected: send VeAuctionCoinReply (with result code) to user's ES // 2bii. if user not connected: send immediate abort back to auction service - const unsigned uTrack = getNewTransactionID( NULL ); + const unsigned uTrack = getNewTransactionID( nullptr ); AuctionAssetDetails &details = m_mPendingRequestDetails[ uTrack ]; details.u8Type = AuctionAssetDetails::TYPE_COIN; diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericApiCore.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericApiCore.cpp index 6c412225..3735217d 100644 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericApiCore.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericApiCore.cpp @@ -119,7 +119,7 @@ unsigned GenericAPICore::submitRequest(GenericRequest *req, GenericResponse *res } req->setTrack(m_currTrack); res->setTrack(m_currTrack); - time_t timeout = time(NULL) + m_requestTimeout; + time_t timeout = time(nullptr) + m_requestTimeout; req->setTimeout(timeout); res->setTimeout(timeout); @@ -138,7 +138,7 @@ void GenericAPICore::process() if (!m_suspended) { // Process timeout on pending requests - while((m_outCount > 0) && ((req = m_outboundQueue.front().first)->getTimeout() <= time(NULL))) + while((m_outCount > 0) && ((req = m_outboundQueue.front().first)->getTimeout() <= time(nullptr))) { --m_outCount; res = m_outboundQueue.front().second; @@ -150,7 +150,7 @@ void GenericAPICore::process() } // Process timeout on pending responses - while((m_pendingCount > 0) && ((res = (*m_pending.begin()).second)->getTimeout() <= time(NULL))) + while((m_pendingCount > 0) && ((res = (*m_pending.begin()).second)->getTimeout() <= time(nullptr))) { --m_pendingCount; m_pending.erase(m_pending.begin()); @@ -163,7 +163,7 @@ void GenericAPICore::process() pair out_pair = m_outboundQueue.front(); req = out_pair.first; res = out_pair.second; - GenericConnection *con = NULL; + GenericConnection *con = nullptr; if (req->getMappedServerTrack() == 0) // request has no originating "owner" server { con = getNextActiveConnection(); // it does not matter which server we send this to @@ -180,7 +180,7 @@ void GenericAPICore::process() } } - if (con != NULL) + if (con != nullptr) { Base::ByteStream msg; req->pack(msg); @@ -215,7 +215,7 @@ GenericConnection *GenericAPICore::getNextActiveConnection() unsigned startIndex = m_nextConnectionIndex; unsigned maxIndex = m_serverConnections.size() - 1; - GenericConnection *con = NULL; + GenericConnection *con = nullptr; //loop until we find an active connection, or until we get back // to where we started @@ -235,7 +235,7 @@ GenericConnection *GenericAPICore::getNextActiveConnection() //went past end of vector, start back at 0 m_nextConnectionIndex = 0; } - }while (con == NULL && m_nextConnectionIndex != startIndex); + }while (con == nullptr && m_nextConnectionIndex != startIndex); return con; } @@ -261,7 +261,7 @@ ServerTrackObject *GenericAPICore::findServer(unsigned server_track) { std::map::iterator iter = m_serverTracks.find(server_track); if (iter == m_serverTracks.end()) - return NULL; + return nullptr; ServerTrackObject *stobj = (*iter).second; m_serverTracks.erase(server_track); return stobj; diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericConnection.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericConnection.cpp index 318f5c20..8abb0dff 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericConnection.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericConnection.cpp @@ -25,7 +25,7 @@ using namespace Base; GenericConnection::GenericConnection(const char *host, short port, GenericAPICore *apiCore, unsigned reconnectTimeout, unsigned noDataTimeoutSecs, unsigned, unsigned incomingBufSizeInKB, unsigned outgoingBufSizeInKB, unsigned keepAlive, unsigned maxRecvMessageSizeInKB) : m_bConnected(CON_NONE), m_apiCore(apiCore), - m_con(NULL), + m_con(nullptr), m_host(host), m_port(port), m_lastTrack(123455), //random choice != 1 @@ -50,8 +50,8 @@ GenericConnection::~GenericConnection() { if(m_con) { - m_con->SetHandler(NULL); - m_con->Disconnect();//don't worry about onterminated being called, we've set it's handler to null, so it wont + m_con->SetHandler(nullptr); + m_con->Disconnect();//don't worry about onterminated being called, we've set it's handler to nullptr, so it wont m_con->Release(); } @@ -64,7 +64,7 @@ void GenericConnection::disconnect() { m_con->Disconnect(); //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); - m_con = NULL; + m_con = nullptr; } m_conState = CON_DISCONNECT; m_bConnected = CON_NONE; @@ -77,7 +77,7 @@ void GenericConnection::OnTerminated(TcpConnection *) if(m_con) { m_con->Release(); - m_con = NULL; + m_con = nullptr; } m_conState = CON_DISCONNECT; m_bConnected = CON_NONE; @@ -93,7 +93,7 @@ void GenericConnection::OnRoutePacket(TcpConnection *, const unsigned char *data get(iter, type); get(iter, track); - GenericResponse *res = NULL; + GenericResponse *res = nullptr; // the following if block is a temporary fix that prevents // a crash with a game team in which they occasionally find @@ -152,7 +152,7 @@ void GenericConnection::process() { m_con->SetHandler(this); m_conState = CON_NEGOTIATE; - m_conTimeout = time(NULL) + m_reconnectTimeout; + m_conTimeout = time(nullptr) + m_reconnectTimeout; } break; case CON_NEGOTIATE: @@ -178,12 +178,12 @@ void GenericConnection::process() put(msg, std::string(m_apiCore->m_gameIdentifiers[index])); Send(msg); } - else if(time(NULL) > m_conTimeout) + else if(time(nullptr) > m_conTimeout) { // we did not connect m_con->Disconnect(); //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); - m_con = NULL; + m_con = nullptr; m_conState = CON_DISCONNECT; m_bConnected = CON_NONE; } @@ -199,7 +199,7 @@ void GenericConnection::process() { m_con->Disconnect(); //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); - m_con = NULL; + m_con = nullptr; } } m_manager->GiveTime(); diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/AuctionTransferAPI.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/AuctionTransferAPI.cpp index 872eff5e..7e716a00 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/AuctionTransferAPI.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/AuctionTransferAPI.cpp @@ -25,9 +25,9 @@ AuctionTransferAPI::AuctionTransferAPI(const char *hostNames, const char *identi std::vector portArray; char hostConfig[4096]; char identifierConfig[4096]; - if (hostNames == NULL) + if (hostNames == nullptr) hostNames = DEFAULT_HOST; - if(identifiers == NULL) + if(identifiers == nullptr) identifiers = DEFAULT_IDENTIFIER; // parse the hosts and ports out : @@ -52,7 +52,7 @@ AuctionTransferAPI::AuctionTransferAPI(const char *hostNames, const char *identi portArray.push_back(port); } } - while ((ptr = strtok(NULL, " ")) != NULL); + while ((ptr = strtok(nullptr, " ")) != nullptr); } strncpy(identifierConfig, identifiers, 4096); identifierConfig[4095] = 0; @@ -67,7 +67,7 @@ AuctionTransferAPI::AuctionTransferAPI(const char *hostNames, const char *identi identifierArray.push_back(identifier); } } - while ((ptr = strtok(NULL, ";")) != NULL); + while ((ptr = strtok(nullptr, ";")) != nullptr); } if (hostArray.empty()) @@ -134,7 +134,7 @@ unsigned AuctionTransferAPI::sendCommitTransaction(long long transactionID, void unsigned AuctionTransferAPI::sendPrepareTransaction(const char *serverIdentifier, long long transactionID, unsigned stationID, unsigned characterID, long long assetID, const char *xmlAsset, void *user, bool compress) { RequestTypes requestEnum = GAME_REQUEST_SEND_PREPARE_TRANSACTION; - GenericRequest *req = NULL; + GenericRequest *req = nullptr; if( compress ) { requestEnum = GAME_REQUEST_SEND_PREPARE_TRANSACTION_COMPRESSED; diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/Archive.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/Archive.cpp index e3400df0..8ad45428 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/Archive.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/Archive.cpp @@ -91,7 +91,7 @@ namespace Base ByteStream::ByteStream() : allocatedSize(0), beginReadIterator(), - data(NULL), + data(nullptr), size(0), lastPutSize(0) { @@ -208,7 +208,7 @@ namespace Base if(data->size < allocatedSize) { unsigned char * tmp = new unsigned char[newSize]; - if(data->buffer != NULL) + if(data->buffer != nullptr) memcpy(tmp, data->buffer, size); delete[] data->buffer; data->buffer = tmp; diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Request.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Request.cpp index 13291373..ed2e0ad3 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Request.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Request.cpp @@ -7,7 +7,7 @@ void put(Base::ByteStream &msg, const Blob &source); ////////////////////////////////////////////////////////////////////////////////////// Blob::Blob(const unsigned char *data, unsigned len) - : m_data(NULL), + : m_data(nullptr), m_len(len) { if (m_len > 0) @@ -20,7 +20,7 @@ void put(Base::ByteStream &msg, const Blob &source); ////////////////////////////////////////////////////////////////////////////////////// Blob::Blob(const Blob &cpy) - : m_data(NULL), + : m_data(nullptr), m_len(cpy.m_len) { if (m_len > 0) @@ -45,7 +45,7 @@ void put(Base::ByteStream &msg, const Blob &source); if (m_data) { delete [] m_data; - m_data = NULL; + m_data = nullptr; } m_len = cpy.m_len; diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/IPAddress.h b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/IPAddress.h index f6d5f886..03b59e8d 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/IPAddress.h +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/IPAddress.h @@ -32,7 +32,7 @@ public: * @brief Used to retreive the the dot-notation represenatatiion of this address. * * @param buffer A pointer to the buffer to place the ip address into. - * Must be at least 17 characters long, will be null terminated. + * Must be at least 17 characters long, will be nullptr terminated. * * @return A pointer to the buffer the address was placed into. */ diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpBlockAllocator.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpBlockAllocator.cpp index 6d476d78..b7da0f27 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpBlockAllocator.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpBlockAllocator.cpp @@ -6,7 +6,7 @@ namespace NAMESPACE #endif TcpBlockAllocator::TcpBlockAllocator(const unsigned initSize, const unsigned initCount) -: m_freeHead(NULL), m_blockCount(initCount), m_blockSize(initSize), m_numAvailBlocks(0) +: m_freeHead(nullptr), m_blockCount(initCount), m_blockSize(initSize), m_numAvailBlocks(0) { realloc(); } @@ -33,7 +33,7 @@ data_block *TcpBlockAllocator::getBlock() tmp = m_freeHead; m_freeHead = m_freeHead->m_next; - tmp->m_next = NULL; + tmp->m_next = nullptr; m_numAvailBlocks--; return(tmp); } @@ -56,7 +56,7 @@ void TcpBlockAllocator::returnBlock(data_block *b) void TcpBlockAllocator::realloc() { - data_block *tmp = NULL, *cursor = NULL; + data_block *tmp = nullptr, *cursor = nullptr; tmp = new data_block; m_numAvailBlocks++; cursor = tmp; diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpConnection.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpConnection.cpp index 41f75157..20fdad78 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpConnection.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpConnection.cpp @@ -11,28 +11,28 @@ namespace NAMESPACE //used when want to open new connection with this socket TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, const IPAddress &destIP, short destPort, unsigned timeout) -: m_nextConnection(NULL), - m_prevConnection(NULL), +: m_nextConnection(nullptr), + m_prevConnection(nullptr), m_socket(INVALID_SOCKET), - m_nextKeepAliveConnection(NULL), - m_prevKeepAliveConnection(NULL), + m_nextKeepAliveConnection(nullptr), + m_prevKeepAliveConnection(nullptr), m_aliveListId(tcpManager->m_aliveList.m_listID), - m_nextRecvDataConnection(NULL), - m_prevRecvDataConnection(NULL), + m_nextRecvDataConnection(nullptr), + m_prevRecvDataConnection(nullptr), m_recvDataListId(tcpManager->m_dataList.m_listID), m_manager(tcpManager), m_status(StatusNegotiating), - m_handler(NULL), + m_handler(nullptr), m_destIP(destIP), m_destPort(destPort), m_refCount(0), m_sendAllocator(sendAlloc), - m_head(NULL), - m_tail(NULL), + m_head(nullptr), + m_tail(nullptr), m_bytesRead(0), m_bytesNeeded(0), m_params(params), - m_recvBuff(NULL), + m_recvBuff(nullptr), m_connectTimeout(timeout), m_connectTimer(), m_wasConRemovedFromMgr(false) @@ -94,28 +94,28 @@ TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAllo //used when server mode creates new connection object representing a connect request TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, SOCKET socket, const IPAddress &destIP, short destPort) -: m_nextConnection(NULL), - m_prevConnection(NULL), +: m_nextConnection(nullptr), + m_prevConnection(nullptr), m_socket(socket), - m_nextKeepAliveConnection(NULL), - m_prevKeepAliveConnection(NULL), + m_nextKeepAliveConnection(nullptr), + m_prevKeepAliveConnection(nullptr), m_aliveListId(tcpManager->m_aliveList.m_listID), - m_nextRecvDataConnection(NULL), - m_prevRecvDataConnection(NULL), + m_nextRecvDataConnection(nullptr), + m_prevRecvDataConnection(nullptr), m_recvDataListId(tcpManager->m_dataList.m_listID), m_manager(tcpManager), m_status(StatusConnected), - m_handler(NULL), + m_handler(nullptr), m_destIP(destIP), m_destPort(destPort), m_refCount(0), m_sendAllocator(sendAlloc), - m_head(NULL), - m_tail(NULL), + m_head(nullptr), + m_tail(nullptr), m_bytesRead(0), m_bytesNeeded(0), m_params(params), - m_recvBuff(NULL), + m_recvBuff(nullptr), m_connectTimeout(0), m_connectTimer(), m_wasConRemovedFromMgr(false) @@ -208,7 +208,7 @@ int TcpConnection::finishConnect() t.tv_sec = 0; t.tv_usec = 0; - int err = select(m_socket + 1, NULL, &wrSet, NULL, &t); + int err = select(m_socket + 1, nullptr, &wrSet, nullptr, &t); if (err == 0) { @@ -303,7 +303,7 @@ TcpConnection::~TcpConnection() { delete [] m_recvBuff; - while(m_head != NULL) + while(m_head != nullptr) { data_block *tmp = m_head; m_head = m_head->m_next; @@ -327,22 +327,22 @@ void TcpConnection::Send(const char *data, unsigned int dataLen) { m_aliveListId = m_manager->m_keepAliveList.m_listID; - if (m_prevKeepAliveConnection != NULL) + if (m_prevKeepAliveConnection != nullptr) m_prevKeepAliveConnection->m_nextKeepAliveConnection = m_nextKeepAliveConnection; - if (m_nextKeepAliveConnection != NULL) + if (m_nextKeepAliveConnection != nullptr) m_nextKeepAliveConnection->m_prevKeepAliveConnection = m_prevKeepAliveConnection; if (m_manager->m_keepAliveList.m_beginList == this) m_manager->m_keepAliveList.m_beginList = m_nextKeepAliveConnection; m_nextKeepAliveConnection = m_manager->m_aliveList.m_beginList; - m_prevKeepAliveConnection = NULL; - if (m_manager->m_aliveList.m_beginList != NULL) + m_prevKeepAliveConnection = nullptr; + if (m_manager->m_aliveList.m_beginList != nullptr) m_manager->m_aliveList.m_beginList->m_prevKeepAliveConnection = this; m_manager->m_aliveList.m_beginList = this; } - data_block *work = NULL; + data_block *work = nullptr; // this connection has no send buffer. Get a block if(!m_tail) @@ -467,16 +467,16 @@ int TcpConnection::processIncoming() { m_recvDataListId = m_manager->m_noDataList.m_listID; - if (m_prevRecvDataConnection != NULL) + if (m_prevRecvDataConnection != nullptr) m_prevRecvDataConnection->m_nextRecvDataConnection = m_nextRecvDataConnection; - if (m_nextRecvDataConnection != NULL) + if (m_nextRecvDataConnection != nullptr) m_nextRecvDataConnection->m_prevRecvDataConnection = m_prevRecvDataConnection; if (m_manager->m_noDataList.m_beginList == this) m_manager->m_noDataList.m_beginList = m_nextRecvDataConnection; m_nextRecvDataConnection = m_manager->m_dataList.m_beginList; - m_prevRecvDataConnection = NULL; - if (m_manager->m_dataList.m_beginList != NULL) + m_prevRecvDataConnection = nullptr; + if (m_manager->m_dataList.m_beginList != nullptr) m_manager->m_dataList.m_beginList->m_prevRecvDataConnection = this; m_manager->m_dataList.m_beginList = this; } @@ -622,7 +622,7 @@ int TcpConnection::processOutgoing() int sendError = 1; - // If m_head is not null, then this connection has something to send + // If m_head is not nullptr, then this connection has something to send if(m_head) diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpConnection.h b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpConnection.h index 07eb4f42..92d631d1 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpConnection.h +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpConnection.h @@ -50,7 +50,7 @@ public: * connection is disconnected, you simply need to derive your class * (multiply if necessary) from TcpConnectionHandler, then you can use * this method to set the object the TcpConnection will call as appropriate. - * default = NULL (no callbacks made) + * default = nullptr (no callbacks made) * * @param handler The object which will be called for notifications. */ diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpManager.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpManager.cpp index a89065a6..7c00d9f6 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpManager.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpManager.cpp @@ -41,14 +41,14 @@ TcpManager::TcpParams::TcpParams(const TcpParams &cpy) } TcpManager::TcpManager(const TcpParams ¶ms) -: m_handler(NULL), - m_keepAliveList(NULL, 1), - m_aliveList(NULL, 2), - m_noDataList(NULL, 1), - m_dataList(NULL, 2), +: m_handler(nullptr), + m_keepAliveList(nullptr, 1), + m_aliveList(nullptr, 2), + m_noDataList(nullptr, 1), + m_dataList(nullptr, 2), m_params(params), m_refCount(1), - m_connectionList(NULL), + m_connectionList(nullptr), m_connectionListCount(0), m_socket(INVALID_SOCKET), m_boundAsServer(false), @@ -86,7 +86,7 @@ TcpManager::~TcpManager() close(m_socket); #endif } - while (m_connectionList != NULL) + while (m_connectionList != nullptr) { TcpConnection *con = m_connectionList; m_connectionList = m_connectionList->m_nextConnection; @@ -166,7 +166,7 @@ bool TcpManager::BindAsServer() { struct hostent * lphp; lphp = gethostbyname(m_params.bindAddress); - if (lphp != NULL) + if (lphp != nullptr) addr_loc.sin_addr.s_addr = ((struct in_addr *)(lphp->h_addr))->s_addr; } else @@ -191,7 +191,7 @@ bool TcpManager::BindAsServer() TcpConnection *TcpManager::acceptClient() { - TcpConnection *newConn = NULL; + TcpConnection *newConn = nullptr; if (m_boundAsServer && m_connectionListCount < m_params.maxConnections) { @@ -205,7 +205,7 @@ TcpConnection *TcpManager::acceptClient() { newConn = new TcpConnection(this, &m_allocator, m_params, sock, IPAddress(addr.sin_addr.s_addr), ntohs(addr.sin_port)); addNewConnection(newConn); - if (m_handler != NULL) + if (m_handler != nullptr) { m_handler->OnConnectRequest(newConn); } @@ -230,8 +230,8 @@ SOCKET TcpManager::getMaxFD() if (m_boundAsServer) maxfd = m_socket+1; - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) { next = con->m_nextConnection; if (con->GetStatus() != TcpConnection::StatusDisconnected && con->m_socket > maxfd) @@ -245,8 +245,8 @@ SOCKET TcpManager::getMaxFD() TcpConnection *TcpManager::getConnection(SOCKET fd) { - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) { next = con->m_nextConnection; if (con->m_socket == fd) @@ -255,7 +255,7 @@ TcpConnection *TcpManager::getConnection(SOCKET fd) } } //if get here ,couldn't find it - return NULL; + return nullptr; } bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendTimePerConnection, unsigned maxRecvTimePerConnection) @@ -277,8 +277,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT { // Send output from last heartbeat - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) { con->AddRef(); if (next) next->Release(); @@ -345,7 +345,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT tmpfds = m_permfds; timeout.tv_sec = 0; timeout.tv_usec = 0; - int cnt = select(maxfd, &tmpfds, NULL, NULL, &timeout); // blocks for timeout + int cnt = select(maxfd, &tmpfds, nullptr, nullptr, &timeout); // blocks for timeout if (cnt > 0) @@ -371,8 +371,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //process incoming client messages if (maxRecvTimePerConnection != 0) { - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) { con->AddRef(); if (next) next->Release(); @@ -437,8 +437,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT pollfds[0].events |= POLLIN; } - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next, idx++) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next, idx++) { next = con->m_nextConnection; pollfds[idx].fd = con->m_socket; @@ -478,7 +478,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT } //process regular msg(s) - if (con == NULL) + if (con == nullptr) { close(pollfds[idx].fd); continue; @@ -510,7 +510,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT }//if(pollfds[... else if (pollfds[idx].revents & POLLHUP) { - if (con == NULL) + if (con == nullptr) { close(pollfds[idx].fd); continue; @@ -528,21 +528,21 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //now process any keepalives, if time to do that if (m_params.keepAliveDelay > 0 && m_keepAliveTimer.isDone(m_params.keepAliveDelay)) { - TcpConnection *next = NULL; - for (TcpConnection *con = m_keepAliveList.m_beginList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_keepAliveList.m_beginList ; con != nullptr ; con = next) { con->AddRef(); if (next) next->Release(); next = con->m_nextKeepAliveConnection; if (next) next->AddRef(); - con->Send(NULL, 0); //note: this request will move the connection from the keepAliveList to the aliveList + con->Send(nullptr, 0); //note: this request will move the connection from the keepAliveList to the aliveList con->Release(); } //now move the complete alive list over to the keepalive list to reset those timers m_keepAliveList.m_beginList = m_aliveList.m_beginList; - m_aliveList.m_beginList = NULL; + m_aliveList.m_beginList = nullptr; //switch id's for those connections that were in the alive list last go - around int tmpID = m_aliveList.m_listID; @@ -556,8 +556,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //now process any noDataCons, if time to do that if (m_params.noDataTimeout > 0 && m_noDataTimer.isDone(m_params.noDataTimeout)) { - TcpConnection *next = NULL; - for (TcpConnection *con = m_noDataList.m_beginList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_noDataList.m_beginList ; con != nullptr ; con = next) { con->AddRef(); if (next) next->Release(); @@ -571,7 +571,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //now move the complete data list over to the nodata list to reset those timers m_noDataList.m_beginList = m_dataList.m_beginList; - m_dataList.m_beginList = NULL; + m_dataList.m_beginList = nullptr; //switch id's for those connections that were in the data list last go - around int tmpID = m_dataList.m_listID; @@ -593,11 +593,11 @@ TcpConnection *TcpManager::EstablishConnection(const char *serverAddress, unsign { //can't open outgoing connections when in server mode // use a different TcpManager to do that - return NULL; + return nullptr; } if (m_connectionListCount >= m_params.maxConnections) - return(NULL); + return(nullptr); // get server address unsigned long address = inet_addr(serverAddress); @@ -605,8 +605,8 @@ TcpConnection *TcpManager::EstablishConnection(const char *serverAddress, unsign { struct hostent * lphp; lphp = gethostbyname(serverAddress); - if (lphp == NULL) - return(NULL); + if (lphp == nullptr) + return(nullptr); address = ((struct in_addr *)(lphp->h_addr))->s_addr; } IPAddress destIP(address); @@ -631,22 +631,22 @@ void TcpManager::addNewConnection(TcpConnection *con) } #endif con->m_nextConnection = m_connectionList; - con->m_prevConnection = NULL; - if (m_connectionList != NULL) + con->m_prevConnection = nullptr; + if (m_connectionList != nullptr) m_connectionList->m_prevConnection = con; m_connectionList = con; m_connectionListCount++; con->m_nextKeepAliveConnection = m_aliveList.m_beginList; - con->m_prevKeepAliveConnection = NULL; - if (m_aliveList.m_beginList != NULL) + con->m_prevKeepAliveConnection = nullptr; + if (m_aliveList.m_beginList != nullptr) m_aliveList.m_beginList->m_prevKeepAliveConnection = con; m_aliveList.m_beginList = con; con->m_aliveListId = m_keepAliveList.m_listID;//start it out thinking it's already in the alive list, since it is con->m_nextRecvDataConnection = m_dataList.m_beginList; - con->m_prevRecvDataConnection = NULL; - if (m_dataList.m_beginList != NULL) + con->m_prevRecvDataConnection = nullptr; + if (m_dataList.m_beginList != nullptr) m_dataList.m_beginList->m_prevRecvDataConnection = con; m_dataList.m_beginList = con; con->m_recvDataListId = m_noDataList.m_listID;//start it out thinking it's already in the data list, since it is @@ -667,40 +667,40 @@ void TcpManager::removeConnection(TcpConnection *con) #pragma warning(pop) } #endif - if (con->m_prevConnection != NULL) + if (con->m_prevConnection != nullptr) con->m_prevConnection->m_nextConnection = con->m_nextConnection; - if (con->m_nextConnection != NULL) + if (con->m_nextConnection != nullptr) con->m_nextConnection->m_prevConnection = con->m_prevConnection; if (m_connectionList == con) m_connectionList = con->m_nextConnection; - con->m_nextConnection = NULL; - con->m_prevConnection = NULL; + con->m_nextConnection = nullptr; + con->m_prevConnection = nullptr; - if (con->m_prevKeepAliveConnection != NULL) + if (con->m_prevKeepAliveConnection != nullptr) con->m_prevKeepAliveConnection->m_nextKeepAliveConnection = con->m_nextKeepAliveConnection; - if (con->m_nextKeepAliveConnection != NULL) + if (con->m_nextKeepAliveConnection != nullptr) con->m_nextKeepAliveConnection->m_prevKeepAliveConnection = con->m_prevKeepAliveConnection; if (m_aliveList.m_beginList == con) m_aliveList.m_beginList = con->m_nextKeepAliveConnection; else if (m_keepAliveList.m_beginList == con) m_keepAliveList.m_beginList = con->m_nextKeepAliveConnection; - con->m_nextKeepAliveConnection = NULL; - con->m_prevKeepAliveConnection = NULL; + con->m_nextKeepAliveConnection = nullptr; + con->m_prevKeepAliveConnection = nullptr; - if (con->m_prevRecvDataConnection != NULL) + if (con->m_prevRecvDataConnection != nullptr) con->m_prevRecvDataConnection->m_nextRecvDataConnection = con->m_nextRecvDataConnection; - if (con->m_nextRecvDataConnection != NULL) + if (con->m_nextRecvDataConnection != nullptr) con->m_nextRecvDataConnection->m_prevRecvDataConnection = con->m_prevRecvDataConnection; if (m_dataList.m_beginList == con) m_dataList.m_beginList = con->m_nextRecvDataConnection; else if (m_noDataList.m_beginList == con) m_noDataList.m_beginList = con->m_nextRecvDataConnection; - con->m_nextRecvDataConnection = NULL; - con->m_prevRecvDataConnection = NULL; + con->m_nextRecvDataConnection = nullptr; + con->m_prevRecvDataConnection = nullptr; diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpManager.h b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpManager.h index 75eb6df4..c4e8b1cf 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpManager.h +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpManager.h @@ -156,7 +156,7 @@ public: * simply need to derive your class (multiply if necessary) from TcpManagerHandler, then you can use * this method to set the object the TcpManager will call as appropriate. The TcpConnection object * also has a handler mechanism that replaces the other callback functions below, see TcpConnection::SetHandler - * default = NULL (no callbacks made) + * default = nullptr (no callbacks made) * * @param handler The object which will be called for manager related notifications. */ @@ -211,7 +211,7 @@ public: * the connect-complete callback to be called if the connection is succesfull. * * @return A pointer to a TcpConnection object. - * NULL if the manager object has exceeded its maximum number of connections + * nullptr if the manager object has exceeded its maximum number of connections * or if the serverAddress cannot be resolved to an IP address. */ TcpConnection *EstablishConnection(const char *serverAddress, unsigned short serverPort, unsigned timeout = 0); diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/GZipHelper.h b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/GZipHelper.h index a01bf682..dab0f9b3 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/GZipHelper.h +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/GZipHelper.h @@ -187,7 +187,7 @@ class CA2GZIPT int destroy() { int err = Z_OK; - if (m_zstream.state != NULL) { + if (m_zstream.state != nullptr) { err = deflateEnd(&(m_zstream)); } if (m_z_err < 0) err = m_z_err; @@ -459,7 +459,7 @@ class CGZIP2AT int destroy() { int err = Z_OK; - if (m_zstream.state != NULL) { + if (m_zstream.state != nullptr) { err = inflateEnd(&(m_zstream)); } if (m_z_err < 0) err = m_z_err; diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/zlib.h b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/zlib.h index 52cb529f..fb425a3b 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/zlib.h +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/zlib.h @@ -74,7 +74,7 @@ typedef struct z_stream_s { uInt avail_out; /* remaining free space at next_out */ uLong total_out; /* total nb of bytes output so far */ - char *msg; /* last error message, NULL if no error */ + char *msg; /* last error message, nullptr if no error */ struct internal_state FAR *state; /* not visible by applications */ alloc_func zalloc; /* used to allocate the internal state */ @@ -193,7 +193,7 @@ ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); enough memory, Z_STREAM_ERROR if level is not a valid compression level, Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible with the version assumed by the caller (ZLIB_VERSION). - msg is set to null if there is no error message. deflateInit does not + msg is set to nullptr if there is no error message. deflateInit does not perform any compression: this will be done by deflate(). */ @@ -271,7 +271,7 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); processed or more output produced), Z_STREAM_END if all input has been consumed and all output has been produced (only when flush is set to Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example - if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible + if next_in or next_out was nullptr), Z_BUF_ERROR if no progress is possible (for example avail_in or avail_out was zero). */ @@ -304,7 +304,7 @@ ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_VERSION_ERROR if the zlib library version is incompatible with the - version assumed by the caller. msg is set to null if there is no error + version assumed by the caller. msg is set to nullptr if there is no error message. inflateInit does not perform any decompression apart from reading the zlib header if present: this will be done by inflate(). (So next_in and avail_in may be modified, but next_out and avail_out are unchanged.) @@ -372,7 +372,7 @@ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); preset dictionary is needed at this point, Z_DATA_ERROR if the input data was corrupted (input stream not conforming to the zlib format or incorrect adler32 checksum), Z_STREAM_ERROR if the stream structure was inconsistent - (for example if next_in or next_out was NULL), Z_MEM_ERROR if there was not + (for example if next_in or next_out was nullptr), Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if no progress is possible or if there was not enough room in the output buffer when Z_FINISH is used. In the Z_DATA_ERROR case, the application may then call inflateSync to look for a good @@ -437,7 +437,7 @@ ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid - method). msg is set to null if there is no error message. deflateInit2 does + method). msg is set to nullptr if there is no error message. deflateInit2 does not perform any compression: this will be done by deflate(). */ @@ -471,7 +471,7 @@ ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, actually used by the compressor.) deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a - parameter is invalid (such as NULL dictionary) or the stream state is + parameter is invalid (such as nullptr dictionary) or the stream state is inconsistent (for example if deflate has already been called for this stream or if the compression method is bsort). deflateSetDictionary does not perform any compression: this will be done by deflate(). @@ -491,7 +491,7 @@ ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if the source stream state was inconsistent - (such as zalloc being NULL). msg is left unchanged in both source and + (such as zalloc being nullptr). msg is left unchanged in both source and destination. */ @@ -503,7 +503,7 @@ ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); that may have been set by deflateInit2. deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being NULL). + stream state was inconsistent (such as zalloc or state being nullptr). */ ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, @@ -544,7 +544,7 @@ ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if a parameter is invalid (such as a negative - memLevel). msg is set to null if there is no error message. inflateInit2 + memLevel). msg is set to nullptr if there is no error message. inflateInit2 does not perform any decompression apart from reading the zlib header if present: this will be done by inflate(). (So next_in and avail_in may be modified, but next_out and avail_out are unchanged.) @@ -562,7 +562,7 @@ ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, dictionary (see deflateSetDictionary). inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a - parameter is invalid (such as NULL dictionary) or the stream state is + parameter is invalid (such as nullptr dictionary) or the stream state is inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the expected one (incorrect Adler32 value). inflateSetDictionary does not perform any decompression: this will be done by subsequent calls of @@ -591,7 +591,7 @@ ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); The stream will keep attributes that may have been set by inflateInit2. inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being NULL). + stream state was inconsistent (such as zalloc or state being nullptr). */ @@ -667,7 +667,7 @@ ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); gzopen can be used to read a file which is not in gzip format; in this case gzread will directly read from the file without decompression. - gzopen returns NULL if the file could not be opened or if there was + gzopen returns nullptr if the file could not be opened or if there was insufficient memory to allocate the (de)compression state; errno can be checked to distinguish the two cases (if errno is zero, the zlib error is Z_MEM_ERROR). */ @@ -681,7 +681,7 @@ ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); The next call of gzclose on the returned gzFile will also close the file descriptor fd, just like fclose(fdopen(fd), mode) closes the file descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode). - gzdopen returns NULL if there was insufficient memory to allocate + gzdopen returns nullptr if there was insufficient memory to allocate the (de)compression state. */ @@ -718,8 +718,8 @@ ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...)); ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); /* - Writes the given null-terminated string to the compressed file, excluding - the terminating null character. + Writes the given nullptr-terminated string to the compressed file, excluding + the terminating nullptr character. gzputs returns the number of characters written, or -1 in case of error. */ @@ -727,7 +727,7 @@ ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); /* Reads bytes from the compressed file until len-1 characters are read, or a newline character is read and transferred to buf, or an end-of-file - condition is encountered. The string is then terminated with a null + condition is encountered. The string is then terminated with a nullptr character. gzgets returns buf, or Z_NULL in case of error. */ @@ -822,7 +822,7 @@ ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); /* Update a running Adler-32 checksum with the bytes buf[0..len-1] and - return the updated checksum. If buf is NULL, this function returns + return the updated checksum. If buf is nullptr, this function returns the required initial value for the checksum. An Adler-32 checksum is almost as reliable as a CRC32 but can be computed much faster. Usage example: @@ -838,7 +838,7 @@ ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); /* Update a running crc with the bytes buf[0..len-1] and return the updated - crc. If buf is NULL, this function returns the required initial value + crc. If buf is nullptr, this function returns the required initial value for the crc. Pre- and post-conditioning (one's complement) is performed within this function so it shouldn't be done by the application. Usage example: diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/zutil.h b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/zutil.h index 718ebc15..fecd535d 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/zutil.h +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/zutil.h @@ -116,7 +116,7 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ # include /* for fdopen */ # else # ifndef fdopen -# define fdopen(fd,mode) NULL /* No fdopen() */ +# define fdopen(fd,mode) nullptr /* No fdopen() */ # endif # endif #endif @@ -130,7 +130,7 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ #endif #if defined(_BEOS_) || defined(RISCOS) -# define fdopen(fd,mode) NULL /* No fdopen() */ +# define fdopen(fd,mode) nullptr /* No fdopen() */ #endif #if (defined(_MSC_VER) && (_MSC_VER > 600)) diff --git a/engine/server/application/CentralServer/src/shared/CentralCSHandler.h b/engine/server/application/CentralServer/src/shared/CentralCSHandler.h index e2b5fd0b..b07690de 100755 --- a/engine/server/application/CentralServer/src/shared/CentralCSHandler.h +++ b/engine/server/application/CentralServer/src/shared/CentralCSHandler.h @@ -69,7 +69,7 @@ protected: std::string name; EntryType type; - CentralCSHandlerFunc func; // will be null unless it's of TYPE_CENTRAL. + CentralCSHandlerFunc func; // will be nullptr unless it's of TYPE_CENTRAL. }; diff --git a/engine/server/application/CentralServer/src/shared/CentralServer.cpp b/engine/server/application/CentralServer/src/shared/CentralServer.cpp index 35d9e51c..3c1578f9 100755 --- a/engine/server/application/CentralServer/src/shared/CentralServer.cpp +++ b/engine/server/application/CentralServer/src/shared/CentralServer.cpp @@ -587,7 +587,7 @@ void CentralServer::getReadyGameServers(std::vector &theList) GameServerConnection * CentralServer::getRandomGameServer(void) { if (m_gameServerConnectionsList.empty()) - return NULL; + return nullptr; // m_gameServerConnectionsList ***DOES NOT*** contain the DB server so // we don't have to worry about checking for and excluding the DB server @@ -611,7 +611,7 @@ GameServerConnection * CentralServer::getRandomGameServer(void) indexNextGameServer = 0; } - return NULL; + return nullptr; } //----------------------------------------------------------------------- @@ -696,7 +696,7 @@ void CentralServer::launchStartingProcesses() const if (!m_taskManager || !m_taskManager->isConnected() || (m_clusterId == 0)) { if (!m_taskManager) - REPORT_LOG(true, ("CentralServer not launching starting processes because m_taskManager is NULL\n")); + REPORT_LOG(true, ("CentralServer not launching starting processes because m_taskManager is nullptr\n")); else if (!m_taskManager->isConnected()) REPORT_LOG(true, ("CentralServer not launching starting processes because m_taskManager->isConnected() is false\n")); @@ -820,7 +820,7 @@ void CentralServer::launchStartingPlanetServers() char const * const p = ConfigCentralServer::getStartPlanet(i); if (p) { - FATAL(!*p, ("CentralServer::launchStartingPlanetServers: ConfigCentralServer::getStartPlanet(%d) specified a non-null but empty planet name", i)); + FATAL(!*p, ("CentralServer::launchStartingPlanetServers: ConfigCentralServer::getStartPlanet(%d) specified a non-nullptr but empty planet name", i)); std::string planetName; std::string hostName; @@ -1495,7 +1495,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons { ConnectionServerConnection * c = (*ci); - if ( (c != NULL) + if ( (c != nullptr) && !c->getChatServiceAddress().empty() && (c->getChatServicePort() != 0)) { @@ -1537,13 +1537,13 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons { ChatServerConnection *connection = (*iterChatServerConnections); - if (connection != NULL) + if (connection != nullptr) { connection->send(address, true); } else { - REPORT_LOG(true, ("Trying to send the customer service server: chat server service address to a NULL chat server\n")); + REPORT_LOG(true, ("Trying to send the customer service server: chat server service address to a nullptr chat server\n")); } } } @@ -1556,7 +1556,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons { ConnectionServerConnection * c = (*ci); - if ( (c != NULL) + if ( (c != nullptr) && !c->getCustomerServiceAddress().empty() && (c->getCustomerServicePort() != 0)) { @@ -1631,7 +1631,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); const RequestGameServerForLoginMessage msg(ri); - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); PlayerSceneMapType::const_iterator i = m_playerSceneMap.find(msg.getCharacterId()); if ((i != m_playerSceneMap.end()) && (i->second.second > timeNow)) { @@ -1892,14 +1892,14 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons } else { - if(getInstance().m_transferServerConnection != NULL) + if(getInstance().m_transferServerConnection != nullptr) { getInstance().m_transferServerConnection->disconnect(); getInstance().m_transferServerConnection = 0; s_retryTransferServerConnection = false; } - if(getInstance().m_stationPlayersCollectorConnection != NULL) + if(getInstance().m_stationPlayersCollectorConnection != nullptr) { getInstance().m_stationPlayersCollectorConnection->disconnect(); getInstance().m_stationPlayersCollectorConnection = 0; @@ -1947,11 +1947,11 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons if (iterFind != s_pendingRenameCharacter.end()) { ++(iterFind->second.second); - iterFind->second.first = ::time(NULL) + 3600; // 1 hour timeout + iterFind->second.first = ::time(nullptr) + 3600; // 1 hour timeout } else { - s_pendingRenameCharacter.insert(std::make_pair(msg.getValue().second.first, std::make_pair((::time(NULL) + 3600), 1))); // 1 hour timeout + s_pendingRenameCharacter.insert(std::make_pair(msg.getValue().second.first, std::make_pair((::time(nullptr) + 3600), 1))); // 1 hour timeout } // tell the chat server to destroy any avatar with the new name, but only if the first name changed @@ -2099,11 +2099,11 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons { i->second.first = ssfp.getValue().second.first; if (ssfp.getValue().second.second) - i->second.second = ::time(NULL) + static_cast(ConfigCentralServer::getCtsDenyLoginThresholdSeconds()); + i->second.second = ::time(nullptr) + static_cast(ConfigCentralServer::getCtsDenyLoginThresholdSeconds()); } else { - m_playerSceneMap[ssfp.getValue().first]=std::make_pair(ssfp.getValue().second.first, (ssfp.getValue().second.second ? (::time(NULL) + static_cast(ConfigCentralServer::getCtsDenyLoginThresholdSeconds())) : 0)); + m_playerSceneMap[ssfp.getValue().first]=std::make_pair(ssfp.getValue().second.first, (ssfp.getValue().second.second ? (::time(nullptr) + static_cast(ConfigCentralServer::getCtsDenyLoginThresholdSeconds())) : 0)); } } } @@ -2250,7 +2250,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); GenericValueTypeMessage > const msg(ri); - m_timePopulationStatisticsRefresh = ::time(NULL); + m_timePopulationStatisticsRefresh = ::time(nullptr); m_populationStatistics = msg.getValue(); } else if (message.isType("GcwScoreStatRsp")) @@ -2258,7 +2258,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); GenericValueTypeMessage, std::pair >, std::map > > > > const msg(ri); - m_timeGcwScoreStatisticsRefresh = ::time(NULL); + m_timeGcwScoreStatisticsRefresh = ::time(nullptr); std::string const timeGcwScoreStatisticsRefreshStr = CalendarTime::convertEpochToTimeStringLocal(m_timeGcwScoreStatisticsRefresh); std::map const & gcwImperialScorePercentile = msg.getValue().first; @@ -2330,7 +2330,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); GenericValueTypeMessage >, std::map > > > const msg(ri); - m_timeLastLoginTimeStatisticsRefresh = ::time(NULL); + m_timeLastLoginTimeStatisticsRefresh = ::time(nullptr); m_lastLoginTimeStatistics = msg.getValue().first; m_createTimeStatistics = msg.getValue().second; } @@ -2606,7 +2606,7 @@ void CentralServer::removeGameServer(GameServerConnection const *gameServer) } else { - DEBUG_WARNING(true, ("A game server crashed but our process ID ptr is null.")); + DEBUG_WARNING(true, ("A game server crashed but our process ID ptr is nullptr.")); } } @@ -2828,7 +2828,7 @@ void CentralServer::update() if ( ConfigCentralServer::getAuctionEnabled() ) // allow auctions? { - if ( m_pAuctionTransferClient == NULL ) + if ( m_pAuctionTransferClient == nullptr ) { const char* hostName[1] = { ConfigCentralServer::getAuctionServer() }; const short port[1] = { (short)ConfigCentralServer::getAuctionPort() }; @@ -2975,7 +2975,7 @@ void CentralServer::sendToPlanetServer(const std::string &sceneId, const GameNet // ---------------------------------------------------------------------- -void CentralServer::sendToAllConnectionServers(const GameNetworkMessage & message, const bool reliable, Connection const * exclude /*= NULL*/) +void CentralServer::sendToAllConnectionServers(const GameNetworkMessage & message, const bool reliable, Connection const * exclude /*= nullptr*/) { // send to all connection servers for (ConnectionServerConnectionList::const_iterator i = m_connectionServerConnections.begin(); i != m_connectionServerConnections.end(); ++i) @@ -3005,7 +3005,7 @@ void CentralServer::sendToDBProcess(const GameNetworkMessage & message, const bo bool CentralServer::hasDBConnection() const { const GameServerConnection * g = getGameServer(getDbProcessServerProcessId()); - return (g != NULL); + return (g != nullptr); } //----------------------------------------------------------------------- @@ -3110,7 +3110,7 @@ void CentralServer::startPlanetServer(const std::string & host, const std::strin TaskSpawnProcess spawn(host.empty() ? std::string("any") : host, "PlanetServer", options, spawnDelay); CentralServer::getInstance().sendTaskMessage(spawn); - m_pendingPlanetServers[sceneId] = std::make_pair(std::make_pair(host, options), ::time(NULL)); + m_pendingPlanetServers[sceneId] = std::make_pair(std::make_pair(host, options), ::time(nullptr)); IGNORE_RETURN(m_planetsWaitingForPreload.insert(sceneId)); bool const preloadFinished = isPreloadFinished(); @@ -3119,14 +3119,14 @@ void CentralServer::startPlanetServer(const std::string & host, const std::strin else if (m_timeClusterWentIntoLoadingState <= 0) m_timeClusterWentIntoLoadingState = time(0); - if(getInstance().m_transferServerConnection != NULL && !preloadFinished) + if(getInstance().m_transferServerConnection != nullptr && !preloadFinished) { getInstance().m_transferServerConnection->disconnect(); getInstance().m_transferServerConnection = 0; s_retryTransferServerConnection = false; } - if(getInstance().m_stationPlayersCollectorConnection != NULL && ! isPreloadFinished()) + if(getInstance().m_stationPlayersCollectorConnection != nullptr && ! isPreloadFinished()) { getInstance().m_stationPlayersCollectorConnection->disconnect(); getInstance().m_stationPlayersCollectorConnection = 0; @@ -3263,7 +3263,7 @@ void CentralServer::handleGameServerForLoginMessage(const GameServerForLoginMess void CentralServer::handleExchangeListCreditsMessage(const ExchangeListCreditsMessage &msg) { LOG("Exchange", ("Central Server got exchange list credits %d.",msg.getCredits())); - if ( m_pAuctionTransferClient == NULL ) + if ( m_pAuctionTransferClient == nullptr ) { // send failure packet } @@ -3299,7 +3299,7 @@ ConnectionServerConnection * CentralServer::getAnyConnectionServer() ConnectionServerConnection * CentralServer::getConnectionServerForAccount(StationId suid) { - ConnectionServerConnection * result = NULL; + ConnectionServerConnection * result = nullptr; ConnectionServerSUIDMap::iterator i=m_accountConnectionMap.find(suid); if (i!=m_accountConnectionMap.end()) { @@ -3707,7 +3707,7 @@ void CentralServer::checkShutdownProcess() { // if it's been "awhile" since we requested to restart the PlanetServer, // then assume that something has gone wrong, and try the restart again - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); if ((iterPendingPlanetServer->second.second + static_cast(ConfigCentralServer::getMaxTimeToWaitForPlanetServerStartSeconds())) < timeNow) { @@ -3982,7 +3982,7 @@ int CentralServer::getSecondsClusterHasBeenInLoadingState() const const std::map & CentralServer::getPopulationStatistics(time_t & refreshTime) { // periodically request updated statistics from the game server - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); if (m_timePopulationStatisticsNextRefresh <= timeNow) { GameServerConnection * universeGameServerConnection = getGameServer(UniverseManager::getInstance().getUniverseProcess()); @@ -4004,7 +4004,7 @@ const std::map & CentralServer::getPopulationStatistics(time_t const std::map > > & CentralServer::getGcwScoreStatistics(time_t & refreshTime) { // periodically request updated statistics from the game server - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); if (m_timeGcwScoreStatisticsNextRefresh <= timeNow) { GameServerConnection * universeGameServerConnection = getGameServer(UniverseManager::getInstance().getUniverseProcess()); @@ -4026,7 +4026,7 @@ const std::map > std::pair > const *, std::map > const *> CentralServer::getLastLoginTimeStatistics(time_t & refreshTime) { // periodically request updated statistics from the game server - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); if (m_timeLastLoginTimeStatisticsNextRefresh <= timeNow) { GameServerConnection * universeGameServerConnection = getGameServer(UniverseManager::getInstance().getUniverseProcess()); @@ -4049,7 +4049,7 @@ std::pair > const *, std::map characterMatchStatisticsRequest("LfgStatReq", 0); diff --git a/engine/server/application/CentralServer/src/shared/CentralServer.h b/engine/server/application/CentralServer/src/shared/CentralServer.h index d628b2fa..262552b0 100755 --- a/engine/server/application/CentralServer/src/shared/CentralServer.h +++ b/engine/server/application/CentralServer/src/shared/CentralServer.h @@ -121,7 +121,7 @@ public: void sendToAllGameServersExceptDBProcess(const GameNetworkMessage & message, const bool reliable); void sendToAllPlanetServers(const GameNetworkMessage & message, const bool reliable); void sendToPlanetServer(const std::string &sceneId, const GameNetworkMessage & message, const bool reliable); - void sendToAllConnectionServers(const GameNetworkMessage & message, const bool reliable, Connection const * exclude = NULL); + void sendToAllConnectionServers(const GameNetworkMessage & message, const bool reliable, Connection const * exclude = nullptr); void sendToConnectionServerForAccount(StationId account, const GameNetworkMessage & message, const bool reliable); void sendToDBProcess(const GameNetworkMessage & message, const bool reliable) const; void sendToLoginServer(uint32 loginServerId, const GameNetworkMessage &message); diff --git a/engine/server/application/CentralServer/src/shared/CentralServerMetricsData.cpp b/engine/server/application/CentralServer/src/shared/CentralServerMetricsData.cpp index 19307914..b34c0174 100755 --- a/engine/server/application/CentralServer/src/shared/CentralServerMetricsData.cpp +++ b/engine/server/application/CentralServer/src/shared/CentralServerMetricsData.cpp @@ -148,7 +148,7 @@ void CentralServerMetricsData::updateData() // appear yellow to draw attention) for some amount of time // after detecting a system time mismatch issue #ifndef WIN32 - if ((lastTimeSystemTimeMismatchNotification + ConfigCentralServer::getSystemTimeMismatchAlertIntervalSeconds()) > ::time(NULL)) + if ((lastTimeSystemTimeMismatchNotification + ConfigCentralServer::getSystemTimeMismatchAlertIntervalSeconds()) > ::time(nullptr)) m_data[m_systemTimeMismatch].m_value = STATUS_LOADING; else m_data[m_systemTimeMismatch].m_value = 1; @@ -202,7 +202,7 @@ void CentralServerMetricsData::updateData() std::string label("population."); label += iter->first; - m_mapPopulationStatisticsIndex[iter->first] = addMetric(label.c_str(), 0, NULL, false, false); + m_mapPopulationStatisticsIndex[iter->first] = addMetric(label.c_str(), 0, nullptr, false, false); } } } @@ -235,7 +235,7 @@ void CentralServerMetricsData::updateData() } else { - gcwScoreStatisticsIndex = addMetric(iter->first.c_str(), 0, NULL, false, false); + gcwScoreStatisticsIndex = addMetric(iter->first.c_str(), 0, nullptr, false, false); IGNORE_RETURN(m_mapGcwScoreStatisticsIndex.insert(std::make_pair(iter->first, gcwScoreStatisticsIndex))); } @@ -263,7 +263,7 @@ void CentralServerMetricsData::updateData() std::string label("population."); label += secondIter.first; - m_mapLastLoginTimeStatisticsIndex[secondIter.first] = addMetric(label.c_str(), 0, NULL, false, false); + m_mapLastLoginTimeStatisticsIndex[secondIter.first] = addMetric(label.c_str(), 0, nullptr, false, false); } } } @@ -288,7 +288,7 @@ void CentralServerMetricsData::updateData() std::string label("population."); label += iter->second.first; - m_mapCreateTimeStatisticsIndex[iter->second.first] = addMetric(label.c_str(), 0, NULL, false, false); + m_mapCreateTimeStatisticsIndex[iter->second.first] = addMetric(label.c_str(), 0, nullptr, false, false); } } } diff --git a/engine/server/application/CentralServer/src/shared/CharacterCreationTracker.cpp b/engine/server/application/CentralServer/src/shared/CharacterCreationTracker.cpp index 5cbdb5c9..b56ee398 100755 --- a/engine/server/application/CentralServer/src/shared/CharacterCreationTracker.cpp +++ b/engine/server/application/CentralServer/src/shared/CharacterCreationTracker.cpp @@ -26,13 +26,13 @@ // ====================================================================== -CharacterCreationTracker * CharacterCreationTracker::ms_instance = NULL; +CharacterCreationTracker * CharacterCreationTracker::ms_instance = nullptr; // ====================================================================== void CharacterCreationTracker::install() { - DEBUG_FATAL(ms_instance != NULL,("Called install() twice.\n")); + DEBUG_FATAL(ms_instance != nullptr,("Called install() twice.\n")); ms_instance = new CharacterCreationTracker; ExitChain::add(CharacterCreationTracker::remove,"CharacterCreationTracker::remove"); } @@ -354,8 +354,8 @@ void CharacterCreationTracker::setFastCreationLock(StationId account) CharacterCreationTracker::CreationRecord::CreationRecord() : m_stage(S_queuedForGameServer), - m_gameCreationRequest(NULL), - m_loginCreationRequest(NULL), + m_gameCreationRequest(nullptr), + m_loginCreationRequest(nullptr), m_creationTime(ServerClock::getInstance().getGameTimeSeconds()), m_gameServerId(0), m_loginServerId(0), diff --git a/engine/server/application/CentralServer/src/shared/ConsoleCommandParserGame.cpp b/engine/server/application/CentralServer/src/shared/ConsoleCommandParserGame.cpp index 3231ecff..5c5f351d 100755 --- a/engine/server/application/CentralServer/src/shared/ConsoleCommandParserGame.cpp +++ b/engine/server/application/CentralServer/src/shared/ConsoleCommandParserGame.cpp @@ -117,8 +117,8 @@ bool ConsoleCommandParserGame::performParsing(const NetworkId & track, const Str if( argv.size() > 4 ) { LOG("ServerConsole", ("Received command to shutdown the cluster.")); - uint32 timeToShutdown = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), NULL, 10); - uint32 maxTime = strtoul(Unicode::wideToNarrow(argv[3]).c_str(), NULL, 10); + uint32 timeToShutdown = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), nullptr, 10); + uint32 maxTime = strtoul(Unicode::wideToNarrow(argv[3]).c_str(), nullptr, 10); Unicode::String systemMessage = Unicode::narrowToWide(""); for(unsigned int i = 4; i < argv.size(); ++i) { @@ -141,7 +141,7 @@ bool ConsoleCommandParserGame::performParsing(const NetworkId & track, const Str { if(argv.size() > 1) { - unsigned int stationId = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), NULL, 10); + unsigned int stationId = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), nullptr, 10); if(stationId > 0) { GenericValueTypeMessage auth("AuthorizeDownload", stationId); diff --git a/engine/server/application/CentralServer/src/shared/ConsoleManager.cpp b/engine/server/application/CentralServer/src/shared/ConsoleManager.cpp index d162fbb3..6535d3db 100755 --- a/engine/server/application/CentralServer/src/shared/ConsoleManager.cpp +++ b/engine/server/application/CentralServer/src/shared/ConsoleManager.cpp @@ -16,7 +16,7 @@ namespace ConsoleManagerNamespace { - ConsoleCommandParser * s_consoleCommandParserRoot = NULL; + ConsoleCommandParser * s_consoleCommandParserRoot = nullptr; } using namespace ConsoleManagerNamespace; diff --git a/engine/server/application/CentralServer/src/shared/PlanetManager.cpp b/engine/server/application/CentralServer/src/shared/PlanetManager.cpp index f9912dde..33d47cbd 100755 --- a/engine/server/application/CentralServer/src/shared/PlanetManager.cpp +++ b/engine/server/application/CentralServer/src/shared/PlanetManager.cpp @@ -138,7 +138,7 @@ PlanetServerConnection *PlanetManager::getPlanetServerForScene(const std::string if (i!=instance().m_servers.end()) return (*i).second.m_connection; else - return NULL; + return nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/application/ChatServer/src/linux/main.cpp b/engine/server/application/ChatServer/src/linux/main.cpp index eecd0c24..295c53f2 100755 --- a/engine/server/application/ChatServer/src/linux/main.cpp +++ b/engine/server/application/ChatServer/src/linux/main.cpp @@ -29,7 +29,7 @@ int main(int argc, char ** argv) SetupSharedFile::install(false); SetupSharedNetworkMessages::install(); - SetupSharedRandom::install(static_cast(time(NULL))); //lint !e1924 !e64 // NULL is a C-Style cast? + SetupSharedRandom::install(static_cast(time(nullptr))); //lint !e1924 !e64 // nullptr is a C-Style cast? Os::setProgramName("ChatServer"); //setup the server diff --git a/engine/server/application/ChatServer/src/shared/CentralServerConnection.cpp b/engine/server/application/ChatServer/src/shared/CentralServerConnection.cpp index b9fa2835..decda6cf 100755 --- a/engine/server/application/ChatServer/src/shared/CentralServerConnection.cpp +++ b/engine/server/application/ChatServer/src/shared/CentralServerConnection.cpp @@ -98,7 +98,7 @@ void CentralServerConnection::onReceive(const Archive::ByteStream & message) std::string const newNameNormalized(newName, 0, newName.find(' ')); ChatAvatarId const newAvatar("SWG", ConfigChatServer::getClusterName(), newNameNormalized); - IGNORE_RETURN(ChatServer::getChatInterface()->RequestTransferAvatar(msg.getStationId(), oldAvatar.getName(), oldAvatar.getAPIAddress(), msg.getStationId(), newAvatar.getName(), newAvatar.getAPIAddress(), true, NULL)); + IGNORE_RETURN(ChatServer::getChatInterface()->RequestTransferAvatar(msg.getStationId(), oldAvatar.getName(), oldAvatar.getAPIAddress(), msg.getStationId(), newAvatar.getName(), newAvatar.getAPIAddress(), true, nullptr)); } } else if (m.isType("ChatDestroyAvatar")) diff --git a/engine/server/application/ChatServer/src/shared/ChatInterface.cpp b/engine/server/application/ChatServer/src/shared/ChatInterface.cpp index 1ad72571..75aeae1b 100755 --- a/engine/server/application/ChatServer/src/shared/ChatInterface.cpp +++ b/engine/server/application/ChatServer/src/shared/ChatInterface.cpp @@ -350,7 +350,7 @@ void ChatInterface::OnGetRoom(unsigned track, unsigned result, const ChatRoom *r if (room) makeRoomName(room, roomName); //printf("!!!!!!!!!!!!got room %s\n", roomName.c_str()); - if (strstr(roomName.c_str(), "group") == NULL) + if (strstr(roomName.c_str(), "group") == nullptr) { ChatServer::putSystemAvatarInRoom(roomName); } @@ -373,7 +373,7 @@ void ChatInterface::OnGetRoom(unsigned track, unsigned result, const ChatRoom *r } } - ChatServerRoomOwner *owner = NULL; + ChatServerRoomOwner *owner = nullptr; if (room) owner = getRoomOwner(room->getRoomID()); @@ -709,12 +709,12 @@ std::string makeCanonicalName(const std::string &characterName) { retVal = toUpper(tmp); } - tmp = strtok(NULL, "."); + tmp = strtok(nullptr, "."); if (tmp) { retVal += (dot + tmp); } - tmp = strtok(NULL, "."); + tmp = strtok(nullptr, "."); if (tmp) { retVal += (dot + tmp); @@ -796,7 +796,7 @@ void ChatInterface::DestroyAvatar(const std::string & characterName) // track how many times we have called RequestGetAnyAvatar() for this particular DestroyAvatar // operation, so that we can stop if we somehow get stuck in an infinite loop - unsigned const trackID = RequestGetAnyAvatar(ChatUnicodeString(avatar.getName()), ChatUnicodeString(avatar.getAPIAddress()), NULL); + unsigned const trackID = RequestGetAnyAvatar(ChatUnicodeString(avatar.getName()), ChatUnicodeString(avatar.getAPIAddress()), nullptr); trackingRequestGetAnyAvatarForDestroy[trackID] = std::make_pair(std::make_pair(ChatUnicodeString(avatar.getName()), ChatUnicodeString(avatar.getAPIAddress())), 1); } @@ -848,7 +848,7 @@ void ChatInterface::sendQueuedHeadersToClient() const unsigned long queuedHeadersSendTime = currentTime + static_cast(s_intervalToSendHeadersToClientSeconds); int numberHeadersSent = 0; - const ChatPersistentMessageToClient * header = NULL; + const ChatPersistentMessageToClient * header = nullptr; for (std::map > >::iterator iter = queuedHeaders.begin(); iter != queuedHeaders.end();) { @@ -900,7 +900,7 @@ void ChatInterface::clearQueuedHeadersForAvatar(const ChatAvatarId & avatarId) void ChatInterface::addQueuedHeaderForAvatar(const ChatAvatarId & avatarId, const ChatPersistentMessageToClient * header, unsigned long sendTime) { - if (header == NULL) + if (header == nullptr) return; std::pair > & queuedHeader = queuedHeaders[avatarId]; @@ -923,7 +923,7 @@ ChatServerAvatarOwner *ChatInterface::getAvatarOwner(const ChatAvatar *avatar) return (*f).second; } } - return NULL; + return nullptr; } //----------------------------------------------------------------------- @@ -944,7 +944,7 @@ void ChatInterface::OnAddModerator(unsigned track, unsigned result, const ChatAv sequence = pair->sequence; delete pair; - pair = NULL; + pair = nullptr; } ChatAvatarId srcId; @@ -1057,7 +1057,7 @@ void ChatInterface::OnRemoveModerator(unsigned track, unsigned result, const Cha sequence = pair->sequence; delete pair; - pair = NULL; + pair = nullptr; } ChatAvatarId srcId; @@ -1178,7 +1178,7 @@ void ChatInterface::OnAddFriend(unsigned track, unsigned result, const ChatAvata ChatAvatarId d; makeAvatarId(destName, destAddress, d); - ChatServerAvatarOwner * mo = NULL; + ChatServerAvatarOwner * mo = nullptr; if (srcAvatar) mo = getAvatarOwner(srcAvatar); @@ -1206,7 +1206,7 @@ void ChatInterface::OnRemoveFriend(unsigned track, unsigned result, const ChatAv ChatAvatarId d; makeAvatarId(destName, destAddress, d); - ChatServerAvatarOwner * mo = NULL; + ChatServerAvatarOwner * mo = nullptr; if (srcAvatar) mo = getAvatarOwner(srcAvatar); @@ -1245,7 +1245,7 @@ void ChatInterface::OnIgnoreStatus(unsigned track, unsigned result, const ChatAv } } - ChatServerAvatarOwner * mo = NULL; + ChatServerAvatarOwner * mo = nullptr; if (srcAvatar) mo = getAvatarOwner(srcAvatar); if(mo) @@ -1281,7 +1281,7 @@ void ChatInterface::OnFriendStatus(unsigned track, unsigned result, const ChatAv idList.push_back(id); } } - ChatServerAvatarOwner * mo = NULL; + ChatServerAvatarOwner * mo = nullptr; if (srcAvatar) mo = getAvatarOwner(srcAvatar); if(mo) @@ -1304,7 +1304,7 @@ void ChatInterface::OnReceiveFriendLogin(const ChatAvatar *srcAvatar, const Chat PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnReceiveFriendLogin"); UNREF(srcAddress); - ChatServerAvatarOwner * owner = NULL; + ChatServerAvatarOwner * owner = nullptr; if (destAvatar) owner = getAvatarOwner(destAvatar); if(owner) @@ -1332,7 +1332,7 @@ void ChatInterface::OnReceiveFriendLogout(const ChatAvatar *srcAvatar, const Cha PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnReceiveFriendLogout"); UNREF(srcAddress); - ChatServerAvatarOwner * owner = NULL; + ChatServerAvatarOwner * owner = nullptr; if (destAvatar) owner = getAvatarOwner(destAvatar); if(owner) @@ -1395,7 +1395,7 @@ void ChatInterface::OnRemoveIgnore(unsigned track, unsigned result, const ChatAv ChatAvatarId d; makeAvatarId(destName, destAddress, d); - ChatServerAvatarOwner * mo = NULL; + ChatServerAvatarOwner * mo = nullptr; if (srcAvatar) mo = getAvatarOwner(srcAvatar); if(mo) @@ -1435,7 +1435,7 @@ void ChatInterface::OnLoginAvatar(unsigned track, unsigned result, const ChatAva if ((result == CHATRESULT_SUCCESS) && newAvatar) { // destroy chat avatar - unsigned const trackID = RequestDestroyAvatar(newAvatar, NULL); + unsigned const trackID = RequestDestroyAvatar(newAvatar, nullptr); trackingRequestGetAnyAvatarForDestroy[trackID] = iterFind->second; } @@ -1504,7 +1504,7 @@ void ChatInterface::OnLoginAvatar(unsigned track, unsigned result, const ChatAva static Unicode::String wideFilter = Unicode::narrowToWide(""); static ChatUnicodeString swgNode(wideSWG.data(), wideSWG.size()); static ChatUnicodeString filter(wideFilter.data(), wideFilter.size()); - IGNORE_RETURN(RequestGetRoomSummaries(swgNode, filter, NULL)); + IGNORE_RETURN(RequestGetRoomSummaries(swgNode, filter, nullptr)); } } else @@ -1525,11 +1525,11 @@ void ChatInterface::OnLoginAvatar(unsigned track, unsigned result, const ChatAva if(ChatServer::isGod(f->second)) { - RequestSetAvatarAttributes(newAvatar, AVATARATTR_GM, NULL); + RequestSetAvatarAttributes(newAvatar, AVATARATTR_GM, nullptr); } else { - RequestSetAvatarAttributes(newAvatar, 0, NULL); + RequestSetAvatarAttributes(newAvatar, 0, nullptr); } ChatServer::chatConnectedAvatar((*f).second, *newAvatar); @@ -1549,7 +1549,7 @@ void ChatInterface::OnLoginAvatar(unsigned track, unsigned result, const ChatAva //ChatServer::getFriendsList(id); clearQueuedHeadersForAvatar(avId); - IGNORE_RETURN(RequestGetPersistentHeaders(newAvatar, NULL)); + IGNORE_RETURN(RequestGetPersistentHeaders(newAvatar, nullptr)); //REPORT_LOG(true, ("Connection to chat system for %s.%s.%s confirmed\n", avatar.GetGameCode().c_str(), avatar.GetGameServerName().c_str(), avatar.GetCharacterName().c_str())); }//lint !e429 Custodial pointer 'owner' has not been freed or returned // jrandall avatar owns it pendingAvatars.erase(f); @@ -1560,7 +1560,7 @@ void ChatInterface::OnLoginAvatar(unsigned track, unsigned result, const ChatAva // the time they connected to the connection server and the time // this message arrived from the chat backend. if (newAvatar) - IGNORE_RETURN(RequestLogoutAvatar(newAvatar, NULL)); + IGNORE_RETURN(RequestLogoutAvatar(newAvatar, nullptr)); } } ChatOnConnectAvatar const connect; @@ -1585,7 +1585,7 @@ void ChatInterface::OnCreateRoom(unsigned track,unsigned result, const ChatRoom static ChatUnicodeString swgNode(wideSWG.data(), wideSWG.size()); static ChatUnicodeString filter(wideFilter.data(), wideFilter.size()); //printf("!!!!Calling GetRoomSummaries from OnCreateRoom\n"); - //IGNORE_RETURN(RequestGetRoomSummaries(swgNode, filter, NULL)); + //IGNORE_RETURN(RequestGetRoomSummaries(swgNode, filter, nullptr)); ChatRoomData roomData; @@ -1598,7 +1598,7 @@ void ChatInterface::OnCreateRoom(unsigned track,unsigned result, const ChatRoom //Unicode::String wideRoomName(newRoom->getRoomName().string_data, newRoom->getRoomName().string_length); std::string roomName; makeRoomName(newRoom, roomName); - if (strstr(roomName.c_str(), "group") == NULL) + if (strstr(roomName.c_str(), "group") == nullptr) { ChatServer::putSystemAvatarInRoom(roomName); } @@ -1644,7 +1644,7 @@ void ChatInterface::OnGetRoomSummaries(unsigned track, unsigned result, unsigned std::unordered_map::const_iterator f = roomList.find(lowerRoomName); if(f == roomList.end()) { - RequestGetRoom(foundRooms[i].getRoomAddress(), NULL); + RequestGetRoom(foundRooms[i].getRoomAddress(), nullptr); //ChatServerRoomOwner * o = new ChatServerRoomOwner((*i)); //(*i)->SetRoomOwnerPtr(o); //IGNORE_RETURN(roomList.insert(std::make_pair(lowerRoomName, *o))); @@ -1664,7 +1664,7 @@ const ChatServerRoomOwner *ChatInterface::getRoomOwner(const std::string & roomN { return &((*f).second); } - return NULL; + return nullptr; } //----------------------------------------------------------------------- @@ -1680,7 +1680,7 @@ ChatServerRoomOwner *ChatInterface::getRoomOwner(unsigned roomId) } ++f; } - return NULL; + return nullptr; } //----------------------------------------------------------------------- @@ -1727,13 +1727,13 @@ void ChatInterface::OnDestroyRoom(unsigned track, unsigned result, void *user) static Unicode::String wideFilter = Unicode::narrowToWide(""); static ChatUnicodeString swgNode(wideSWG.data(), wideSWG.size()); static ChatUnicodeString filter(wideFilter.data(), wideFilter.size()); - //IGNORE_RETURN(RequestGetRoomSummaries(swgNode, filter, NULL)); + //IGNORE_RETURN(RequestGetRoomSummaries(swgNode, filter, nullptr)); ChatAvatarId destroyer; RoomOwnerSequencePair *pair = (RoomOwnerSequencePair *)user; - const ChatServerRoomOwner * owner = NULL; + const ChatServerRoomOwner * owner = nullptr; unsigned sequence = 0; if (pair) { @@ -1805,7 +1805,7 @@ void ChatInterface::OnDestroyAvatar(unsigned track, unsigned result, const ChatA // stop if it looks like we're in an infinite loop if (iterFind->second.second <= 25) { - unsigned const trackID = RequestGetAnyAvatar(iterFind->second.first.first, iterFind->second.first.second, NULL); + unsigned const trackID = RequestGetAnyAvatar(iterFind->second.first.first, iterFind->second.first.second, nullptr); trackingRequestGetAnyAvatarForDestroy[trackID] = std::make_pair(iterFind->second.first, (iterFind->second.second + 1)); } } @@ -1828,13 +1828,13 @@ void ChatInterface::OnGetAnyAvatar(unsigned track, unsigned result, const ChatAv // can only destroy the avatar if he is logged in if (loggedIn) { - unsigned const trackID = RequestDestroyAvatar(foundAvatar, NULL); + unsigned const trackID = RequestDestroyAvatar(foundAvatar, nullptr); trackingRequestGetAnyAvatarForDestroy[trackID] = iterFind->second; } // log in the chat avatar so we can destroy him else { - unsigned const trackID = RequestLoginAvatar(foundAvatar->getUserID(), foundAvatar->getName(), foundAvatar->getAddress(), NULL); + unsigned const trackID = RequestLoginAvatar(foundAvatar->getUserID(), foundAvatar->getName(), foundAvatar->getAddress(), nullptr); trackingRequestGetAnyAvatarForDestroy[trackID] = iterFind->second; } } @@ -1850,9 +1850,9 @@ void ChatInterface::OnReceiveForcedLogout(const ChatAvatar *oldAvatar) ChatServer::fileLog(false, "ChatInterface", "OnReceiveForcedLogout() oldAvatar(%s)", ChatServer::getFullChatAvatarName(oldAvatar).c_str()); PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnReceiveForcedLogout"); - if (oldAvatar == NULL) + if (oldAvatar == nullptr) { - DEBUG_WARNING(true, ("We received an OnReceiveForcedLogout with a success result code but NULL data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnReceiveForcedLogout with a success result code but nullptr data. This is an error that the API should never give.")); return; } ChatAvatarId id; @@ -1876,9 +1876,9 @@ void ChatInterface::OnEnterRoom(unsigned track, unsigned result, const ChatAvata PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnEnterRoom"); - if (result == CHATRESULT_SUCCESS && (srcAvatar == NULL || destRoom == NULL)) + if (result == CHATRESULT_SUCCESS && (srcAvatar == nullptr || destRoom == nullptr)) { - DEBUG_WARNING(true, ("We received an OnEnterRoom with a success result code but NULL data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnEnterRoom with a success result code but nullptr data. This is an error that the API should never give.")); return; } @@ -2097,9 +2097,9 @@ void ChatInterface::OnAddBan(unsigned track, unsigned result, const ChatAvatar * PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnAddBan"); - if (result == CHATRESULT_SUCCESS && (srcAvatar == NULL || destRoom == NULL)) + if (result == CHATRESULT_SUCCESS && (srcAvatar == nullptr || destRoom == nullptr)) { - DEBUG_WARNING(true, ("We received an OnAddBan with a success result code but NULL data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnAddBan with a success result code but nullptr data. This is an error that the API should never give.")); return; } @@ -2113,7 +2113,7 @@ void ChatInterface::OnAddBan(unsigned track, unsigned result, const ChatAvatar * sequence = pair->sequence; delete pair; - pair = NULL; + pair = nullptr; } ChatAvatarId srcId; @@ -2218,9 +2218,9 @@ void ChatInterface::OnRemoveBan(unsigned track, unsigned result, const ChatAvata PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnRemoveBan"); - if (result == CHATRESULT_SUCCESS && (srcAvatar == NULL || destRoom == NULL)) + if (result == CHATRESULT_SUCCESS && (srcAvatar == nullptr || destRoom == nullptr)) { - DEBUG_WARNING(true, ("We received an OnRemoveBan with a success result code but NULL data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnRemoveBan with a success result code but nullptr data. This is an error that the API should never give.")); return; } @@ -2234,7 +2234,7 @@ void ChatInterface::OnRemoveBan(unsigned track, unsigned result, const ChatAvata sequence = pair->sequence; delete pair; - pair = NULL; + pair = nullptr; } ChatAvatarId srcId; @@ -2337,9 +2337,9 @@ void ChatInterface::OnAddInvite(unsigned track, unsigned result, const ChatAvata PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnAddInvite"); - if (result == CHATRESULT_SUCCESS && (srcAvatar == NULL || destRoom == NULL)) + if (result == CHATRESULT_SUCCESS && (srcAvatar == nullptr || destRoom == nullptr)) { - DEBUG_WARNING(true, ("We received an OnAddInvite with a success result code but NULL data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnAddInvite with a success result code but nullptr data. This is an error that the API should never give.")); return; } @@ -2353,7 +2353,7 @@ void ChatInterface::OnAddInvite(unsigned track, unsigned result, const ChatAvata sequence = pair->sequence; delete pair; - pair = NULL; + pair = nullptr; } ChatAvatarId srcId; @@ -2378,7 +2378,7 @@ void ChatInterface::OnAddInvite(unsigned track, unsigned result, const ChatAvata { // Calling this on a room will cause the API to cache the room // and to receive room updates for the room. - RequestGetRoom(destRoom->getAddress(), NULL); + RequestGetRoom(destRoom->getAddress(), nullptr); // Send the room data for the room the avatar was invited to join // since the room may be private and may be unknown to the player @@ -2455,9 +2455,9 @@ void ChatInterface::OnRemoveInvite(unsigned track, unsigned result, const ChatAv PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnRemoveInvite"); - if (result == CHATRESULT_SUCCESS && (srcAvatar == NULL || destRoom == NULL)) + if (result == CHATRESULT_SUCCESS && (srcAvatar == nullptr || destRoom == nullptr)) { - DEBUG_WARNING(true, ("We received an OnRemoveInvite with a success result code but NULL data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnRemoveInvite with a success result code but nullptr data. This is an error that the API should never give.")); return; } @@ -2471,7 +2471,7 @@ void ChatInterface::OnRemoveInvite(unsigned track, unsigned result, const ChatAv sequence = pair->sequence; delete pair; - pair = NULL; + pair = nullptr; } std::string roomName; @@ -2555,9 +2555,9 @@ void ChatInterface::OnLeaveRoom(unsigned track, unsigned result, const ChatAvata PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnLeaveRoom"); - if (result == CHATRESULT_SUCCESS && (srcAvatar == NULL || destRoom == NULL)) + if (result == CHATRESULT_SUCCESS && (srcAvatar == nullptr || destRoom == nullptr)) { - DEBUG_WARNING(true, ("We received an OnLeaveRoom with a success result code but NULL data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnLeaveRoom with a success result code but nullptr data. This is an error that the API should never give.")); return; } @@ -2653,7 +2653,7 @@ void ChatInterface::OnKickAvatar(unsigned track, unsigned result, const ChatAvat sequence = pair->sequence; delete pair; - pair = NULL; + pair = nullptr; } std::string roomName; @@ -2755,9 +2755,9 @@ void ChatInterface::OnGetPersistentMessage(unsigned track, unsigned result, Chat ChatServer::fileLog(false, "ChatInterface", "OnGetPersistentMessage() track(%u) result(%u) destAvatar(%s)", track, result, ChatServer::getFullChatAvatarName(destAvatar).c_str()); PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnGetPersistentMessage"); - if (result == CHATRESULT_SUCCESS && (destAvatar == NULL)) + if (result == CHATRESULT_SUCCESS && (destAvatar == nullptr)) { - DEBUG_WARNING(true, ("We received an OnGetPersistentMessage with a success result code but NULL data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnGetPersistentMessage with a success result code but nullptr data. This is an error that the API should never give.")); return; } UNREF(user); @@ -2807,9 +2807,9 @@ void ChatInterface::OnGetPersistentHeaders(unsigned track, unsigned result, Chat ChatServer::fileLog(false, "ChatInterface", "OnGetPersistentHeaders() track(%u) result(%u) destAvatar(%s)", track, result, ChatServer::getFullChatAvatarName(destAvatar).c_str(), listLength); PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnGetPersistentHeaders"); - if (result == CHATRESULT_SUCCESS && (destAvatar == NULL)) + if (result == CHATRESULT_SUCCESS && (destAvatar == nullptr)) { - DEBUG_WARNING(true, ("We received an OnGetPersistentHeaders with a success result code but NULL data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnGetPersistentHeaders with a success result code but nullptr data. This is an error that the API should never give.")); return; } UNREF(track); @@ -2876,9 +2876,9 @@ void ChatInterface::OnReceivePersistentMessage(const ChatAvatar *destAvatar, con ChatServer::fileLog(false, "ChatInterface", "OnReceivePersistentMessage() destAvatar(%s)", ChatServer::getFullChatAvatarName(destAvatar).c_str()); PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnReceivePersistentMessage"); - if (destAvatar == NULL) + if (destAvatar == nullptr) { - DEBUG_WARNING(true, ("We received an OnREceivePersistentMessage with a success result code but NULL data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnREceivePersistentMessage with a success result code but nullptr data. This is an error that the API should never give.")); return; } if (!header) @@ -2910,9 +2910,9 @@ void ChatInterface::OnSendRoomMessage(unsigned track, unsigned result, const Cha ChatServer::fileLog(false, "ChatInterface", "OnSendRoomMessage() track(%u) result(%u) srcAvatar(%s) destRoom(%s)", track, result, ChatServer::getFullChatAvatarName(srcAvatar).c_str(), ChatServer::getChatRoomNameNarrow(destRoom).c_str()); PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnSendRoomMessage"); - if (result == CHATRESULT_SUCCESS && (srcAvatar == NULL || destRoom == NULL)) + if (result == CHATRESULT_SUCCESS && (srcAvatar == nullptr || destRoom == nullptr)) { - DEBUG_WARNING(true, ("We received an OnsendRoomMessage with a success result code but NULL data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnsendRoomMessage with a success result code but nullptr data. This is an error that the API should never give.")); return; } UNREF(srcAvatar); @@ -2931,7 +2931,7 @@ void ChatInterface::OnReceiveRoomMessage(const ChatAvatar *srcAvatar, const Chat PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnReceiveRoomMessage"); if(! srcAvatar || ! destAvatar || ! destRoom) { - DEBUG_WARNING(true, ("We received an OnREceiveRoomMessage with a success result code but NULL data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnREceiveRoomMessage with a success result code but nullptr data. This is an error that the API should never give.")); return; } @@ -2995,9 +2995,9 @@ void ChatInterface::OnSendInstantMessage(unsigned track, unsigned result, const PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnSendInstantMessage"); - if (result == CHATRESULT_SUCCESS && (srcAvatar == NULL)) + if (result == CHATRESULT_SUCCESS && (srcAvatar == nullptr)) { - DEBUG_WARNING(true, ("We received an OnSendInstantMessage with a success result code but NULL data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnSendInstantMessage with a success result code but nullptr data. This is an error that the API should never give.")); return; } UNREF(srcAvatar); @@ -3015,9 +3015,9 @@ void ChatInterface::OnReceiveInstantMessage(const ChatAvatar *srcAvatar, const C ChatServer::fileLog(false, "ChatInterface", "OnReceiveInstantMessage() srcAvatar(%s) destAvatar(%s)", ChatServer::getFullChatAvatarName(srcAvatar).c_str(), ChatServer::getFullChatAvatarName(destAvatar).c_str()); PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnReceiveInstantMessage"); - if ((srcAvatar == NULL || destAvatar == NULL)) + if ((srcAvatar == nullptr || destAvatar == nullptr)) { - DEBUG_WARNING(true, ("We received an OnReceiveInstantMessage with a success result code but NULL data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnReceiveInstantMessage with a success result code but nullptr data. This is an error that the API should never give.")); return; } ChatAvatarId fromId; @@ -3052,9 +3052,9 @@ void ChatInterface::OnSendPersistentMessage(unsigned track, unsigned result, con ChatServer::fileLog(false, "ChatInterface", "OnSendPersistentMessage() track(%u) result(%u) srcAvatar(%s)", track, result, ChatServer::getFullChatAvatarName(srcAvatar).c_str()); PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnSendPersistentMessage"); - if (result == CHATRESULT_SUCCESS && (srcAvatar == NULL)) + if (result == CHATRESULT_SUCCESS && (srcAvatar == nullptr)) { - DEBUG_WARNING(true, ("We received an OnSendPersistentMessage with a success result code but NULL data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnSendPersistentMessage with a success result code but nullptr data. This is an error that the API should never give.")); return; } unsigned sequence = (unsigned)user; @@ -3120,7 +3120,7 @@ void ChatInterface::OnUpdatePersistentMessages(unsigned track, unsigned result, ChatAvatarId targetChatAvatarId; - if (targetAvatar != NULL) + if (targetAvatar != nullptr) { makeAvatarId(*targetAvatar, targetChatAvatarId); } @@ -3130,17 +3130,17 @@ void ChatInterface::OnUpdatePersistentMessages(unsigned track, unsigned result, ChatAvatarId sourceChatAvatarId; NetworkId const *tmpNetworkId = reinterpret_cast(user); - if (tmpNetworkId != NULL) + if (tmpNetworkId != nullptr) { ChatAvatar const *sourceAvatar = ChatServer::getAvatarByNetworkId(*tmpNetworkId); - if (sourceAvatar != NULL) + if (sourceAvatar != nullptr) { makeAvatarId(*sourceAvatar, sourceChatAvatarId); } delete tmpNetworkId; - tmpNetworkId = NULL; + tmpNetworkId = nullptr; } ChatServer::fileLog(false, "ChatInterface", "OnUpdatePersistentMessage() track(%u) result(%u) sourceAvatar(%s) targetAvatar(%s)", track, result, sourceChatAvatarId.getFullName().c_str(), targetChatAvatarId.getFullName().c_str()); diff --git a/engine/server/application/ChatServer/src/shared/ChatServer.cpp b/engine/server/application/ChatServer/src/shared/ChatServer.cpp index 76d47a9c..c8e12a6d 100755 --- a/engine/server/application/ChatServer/src/shared/ChatServer.cpp +++ b/engine/server/application/ChatServer/src/shared/ChatServer.cpp @@ -162,7 +162,7 @@ void ChatServerNamespace::cleanChatLog() //----------------------------------------------------------------------- -ChatServer *ChatServer::m_instance = NULL; +ChatServer *ChatServer::m_instance = nullptr; #include @@ -250,7 +250,7 @@ if ((t3 - t2) > (1000 * 5)) static Unicode::String wideFilter = Unicode::narrowToWide(""); static ChatUnicodeString swgNode(wideSWG.data(), wideSWG.size()); static ChatUnicodeString filter(wideFilter.data(), wideFilter.size()); - instance().chatInterface->RequestGetRoomSummaries(swgNode, filter, NULL); + instance().chatInterface->RequestGetRoomSummaries(swgNode, filter, nullptr); } ++i; @@ -286,7 +286,7 @@ gameService(0), planetService(), ownerSystem(0), systemAvatarId("SWG", ConfigChatServer::getClusterName(), "SYSTEM"), -customerServiceServerConnection(NULL), +customerServiceServerConnection(nullptr), m_gameServerConnectionRegistry(), m_voiceChatIdMap() { @@ -452,7 +452,7 @@ void ChatServer::setOwnerSystem(const ChatAvatar * o) Connection *connection = safe_cast(instance().centralServerConnection); - if (connection != NULL) + if (connection != nullptr) { connection->send(bs, true); } @@ -618,7 +618,7 @@ const ChatAvatar * ChatServer::getAvatarByNetworkId(const NetworkId & id) { if (id.getValue() == 0) { - return NULL; + return nullptr; } const ChatAvatar * result = 0; ChatAvatarList::const_iterator f = instance().chatAvatars.find(id); @@ -635,7 +635,7 @@ ChatServer::AvatarExtendedData * ChatServer::getAvatarExtendedDataByNetworkId(co { if (id.getValue() == 0) { - return NULL; + return nullptr; } ChatServer::AvatarExtendedData * result = 0; ChatAvatarList::iterator f = instance().chatAvatars.find(id); @@ -783,7 +783,7 @@ void ChatServer::addFriend(const NetworkId & id, const unsigned int sequence, co unsigned track = instance().chatInterface->RequestAddFriend(from, ChatUnicodeString(friendName.data(), friendName.length()), ChatUnicodeString(friendAddress.data(), friendAddress.length()), - false, NULL); + false, nullptr); instance().pendingRequests[track] = id; } else @@ -810,7 +810,7 @@ void ChatServer::removeFriend(const NetworkId & id, const unsigned int sequence, splitChatAvatarId(friendId, friendName, friendAddress); unsigned track = instance().chatInterface->RequestRemoveFriend(from, ChatUnicodeString(friendName.data(), friendName.length()), - ChatUnicodeString(friendAddress.data(), friendAddress.length()), NULL); + ChatUnicodeString(friendAddress.data(), friendAddress.length()), nullptr); instance().pendingRequests[track] = id; } else @@ -829,7 +829,7 @@ void ChatServer::getFriendsList(const ChatAvatarId &characterName) const ChatAvatar *avatar = getAvatarByNetworkId(id); if (avatar) { - unsigned track = instance().chatInterface->RequestFriendStatus(avatar, NULL); + unsigned track = instance().chatInterface->RequestFriendStatus(avatar, nullptr); instance().pendingRequests[track] = id; } else @@ -857,7 +857,7 @@ void ChatServer::addIgnore(const NetworkId & id, const unsigned int sequence, co unsigned track = instance().chatInterface->RequestAddIgnore(from, ChatUnicodeString(ignoreName.data(), ignoreName.length()), ChatUnicodeString(ignoreAddress.data(), ignoreAddress.length()), - NULL); + nullptr); instance().pendingRequests[track] = id; } else @@ -884,7 +884,7 @@ void ChatServer::removeIgnore(const NetworkId & id, const unsigned int sequence, splitChatAvatarId(ignoreId, ignoreName, ignoreAddress); unsigned track = instance().chatInterface->RequestRemoveIgnore(from, ChatUnicodeString(ignoreName.data(), ignoreName.length()), - ChatUnicodeString(ignoreAddress.data(), ignoreAddress.length()), NULL); + ChatUnicodeString(ignoreAddress.data(), ignoreAddress.length()), nullptr); instance().pendingRequests[track] = id; } else @@ -905,7 +905,7 @@ void ChatServer::getIgnoreList(const ChatAvatarId &characterName) if (avatar) { - unsigned track = instance().chatInterface->RequestIgnoreStatus(avatar, NULL); + unsigned track = instance().chatInterface->RequestIgnoreStatus(avatar, nullptr); instance().pendingRequests[track] = id; } else @@ -1160,7 +1160,7 @@ void ChatServer::createRoom(const NetworkId & id, const unsigned int sequence, c { roomAttr |= ROOMATTR_PRIVATE; } - if (isSystemOwner && (strstr(roomName.c_str(), "system") != NULL)) + if (isSystemOwner && (strstr(roomName.c_str(), "system") != nullptr)) { roomAttr |= ROOMATTR_PERSISTENT; } @@ -1193,7 +1193,7 @@ void ChatServer::deleteAllPersistentMessages(const NetworkId &sourceNetworkId, c ChatAvatar const *avatar = getAvatarByNetworkId(targetNetworkId); - if (avatar != NULL) + if (avatar != nullptr) { { NetworkId *tmpNetworkId = new NetworkId(sourceNetworkId); @@ -1225,7 +1225,7 @@ void ChatServer::deletePersistentMessage(const NetworkId &id, const unsigned int const ChatAvatar *avatar = getAvatarByNetworkId(id); if (avatar) { - instance().chatInterface->RequestUpdatePersistentMessage(avatar, messageId, PERSISTENT_DELETED, NULL); + instance().chatInterface->RequestUpdatePersistentMessage(avatar, messageId, PERSISTENT_DELETED, nullptr); } } @@ -1290,10 +1290,10 @@ void ChatServer::destroyRoom(const std::string & roomName) { ChatServer::fileLog(s_enableChatRoomLogs, "ChatServer", "destroyRoom() roomName(%s)", roomName.c_str()); - if ((strstr(roomName.c_str(), ConfigChatServer::getClusterName()) != NULL) || + if ((strstr(roomName.c_str(), ConfigChatServer::getClusterName()) != nullptr) || (strstr(roomName.c_str(), toLower(std::string(ConfigChatServer::getClusterName() ) ).c_str() ) )) { - if ((strstr(roomName.c_str(), "GroupChat") != NULL) || (strstr(roomName.c_str(), "groupchat") != NULL)) + if ((strstr(roomName.c_str(), "GroupChat") != nullptr) || (strstr(roomName.c_str(), "groupchat") != nullptr)) { size_t pos = roomName.rfind("."); if (pos != roomName.npos) @@ -1311,7 +1311,7 @@ void ChatServer::destroyRoom(const std::string & roomName) const ChatServerRoomOwner *owner = instance().chatInterface->getRoomOwner(roomName); if (!instance().ownerSystem) { - DEBUG_WARNING(true, ("Chat ownerSystem is NULL")); + DEBUG_WARNING(true, ("Chat ownerSystem is nullptr")); return; } if (owner) @@ -1331,7 +1331,7 @@ void ChatServer::disconnectAvatar(const ChatAvatar & avatar) if (&avatar == instance().ownerSystem) { - instance().ownerSystem = NULL; + instance().ownerSystem = nullptr; } ChatAvatarList::iterator i; for(i = instance().chatAvatars.begin(); i != instance().chatAvatars.end(); ++i) @@ -1423,7 +1423,7 @@ void ChatServer::enterRoom(const ChatAvatarId & id, const std::string & roomName const ChatAvatar *avatar = getAvatarByNetworkId(getNetworkIdByAvatarId(id)); if (room && avatar) { - instance().chatInterface->RequestEnterRoom(avatar, room->getAddress(), NULL); + instance().chatInterface->RequestEnterRoom(avatar, room->getAddress(), nullptr); } else { @@ -1450,7 +1450,7 @@ void ChatServer::putSystemAvatarInRoom(const std::string & roomName) const ChatServerRoomOwner *room = instance().chatInterface->getRoomOwner(roomName); if (room && instance().ownerSystem) { - instance().chatInterface->RequestEnterRoom(instance().ownerSystem, room->getAddress(), NULL); + instance().chatInterface->RequestEnterRoom(instance().ownerSystem, room->getAddress(), nullptr); } } @@ -1619,7 +1619,7 @@ void ChatServer::invite(const NetworkId & id, const ChatAvatarId & avatarId, con ChatServer::fileLog(s_enableChatRoomLogs, "ChatServer", "invite() id(%s) avatar(%s) roomName(%s)", id.getValueString().c_str(), avatarId.getFullName().c_str(), roomName.c_str()); // Try to get an invitor - ChatAvatar const * invitor = NULL; + ChatAvatar const * invitor = nullptr; if (id != NetworkId::cms_invalid) { invitor = getAvatarByNetworkId(id); @@ -1738,7 +1738,7 @@ void ChatServer::inviteGroupMembers(const NetworkId & id, const ChatAvatarId & a void ChatServer::removeSystemAvatarFromRoom(const ChatRoom *room) { - ChatServer::fileLog(s_enableChatRoomLogs, "ChatServer", "removeSystemAvatarFromRoom() room(%s)", (room != NULL) ? toNarrowString(room->getRoomName()).c_str() : "NULL"); + ChatServer::fileLog(s_enableChatRoomLogs, "ChatServer", "removeSystemAvatarFromRoom() room(%s)", (room != nullptr) ? toNarrowString(room->getRoomName()).c_str() : "nullptr"); if (!room || !instance().ownerSystem) { @@ -1754,7 +1754,7 @@ void ChatServer::removeSystemAvatarFromRoom(const ChatRoom *room) } } - instance().chatInterface->RequestLeaveRoom(instance().ownerSystem, room->getAddress(), NULL); + instance().chatInterface->RequestLeaveRoom(instance().ownerSystem, room->getAddress(), nullptr); } //----------------------------------------------------------------------- @@ -1991,7 +1991,7 @@ void ChatServer::sendInstantMessage(const ChatAvatarId & from, const ChatAvatarI const NetworkId &toNetworkId = getNetworkIdByAvatarId(to); const ChatAvatar * toAvatar = getAvatarByNetworkId(toNetworkId); - if (toAvatar != NULL) + if (toAvatar != nullptr) { ChatServer::fileLog(false, "ChatServer", "sendInstantMessage() resolved tell locally"); @@ -2022,7 +2022,7 @@ void ChatServer::sendInstantMessage(const ChatAvatarId & from, const ChatAvatarI IGNORE_RETURN(instance().chatInterface->RequestSendInstantMessage(fromAvatar, ChatUnicodeString(friendName.data(), friendName.size()), ChatUnicodeString(friendAddress.data(), friendAddress.size()), - ChatUnicodeString(message.data(), message.size()), ChatUnicodeString(outOfBand.data(), outOfBand.size()), NULL)); + ChatUnicodeString(message.data(), message.size()), ChatUnicodeString(outOfBand.data(), outOfBand.size()), nullptr)); } } } @@ -2054,7 +2054,7 @@ void ChatServer::sendInstantMessage(const NetworkId & fromId, const unsigned int { return; } - else if (::time(NULL) < aed->unsquelchTime) // still in squelch period + else if (::time(nullptr) < aed->unsquelchTime) // still in squelch period { return; } @@ -2076,14 +2076,14 @@ void ChatServer::sendInstantMessage(const NetworkId & fromId, const unsigned int Unicode::String wideFrom; Unicode::String wideTo; - if (from != NULL) + if (from != nullptr) { makeAvatarId(*from, fromAvatarId); wideFrom = (Unicode::narrowToWide(fromAvatarId.getFullName())); } ChatAvatarId toAvatarId; - if (toAvatar != NULL) + if (toAvatar != nullptr) { ChatServer::fileLog(false, "ChatServer", "sendInstantMessage() resolved tell locally"); @@ -2158,7 +2158,7 @@ void ChatServer::sendPersistentMessage(const ChatAvatarId & from, const ChatAvat ChatUnicodeString(subject.data(), subject.size()), ChatUnicodeString(message.data(), message.size()), ChatUnicodeString(oob.data(), oob.size()), - NULL + nullptr ); Unicode::String log; @@ -2187,7 +2187,7 @@ void ChatServer::sendPersistentMessage(const NetworkId & fromId, const unsigned // to.cluster.c_str(), to.name.c_str()); UNREF(sequenceId); ChatServer::AvatarExtendedData * aed = getAvatarExtendedDataByNetworkId(fromId); - const ChatAvatar * from = (aed ? &(aed->chatAvatar) : NULL); + const ChatAvatar * from = (aed ? &(aed->chatAvatar) : nullptr); if(from) { // see if player is squelched @@ -2197,7 +2197,7 @@ void ChatServer::sendPersistentMessage(const NetworkId & fromId, const unsigned { return; } - else if (::time(NULL) < aed->unsquelchTime) // still in squelch period + else if (::time(nullptr) < aed->unsquelchTime) // still in squelch period { return; } @@ -2225,7 +2225,7 @@ void ChatServer::sendPersistentMessage(const NetworkId & fromId, const unsigned ChatAvatarId fromAvatarId; - if (from != NULL) + if (from != nullptr) { makeAvatarId(*from, fromAvatarId); } @@ -2255,7 +2255,7 @@ void ChatServer::sendRoomMessage(const ChatAvatarId &id, const std::string & roo if (!instance().ownerSystem) { - DEBUG_WARNING(true, ("Chat ownerSystem is NULL")); + DEBUG_WARNING(true, ("Chat ownerSystem is nullptr")); return; } // get room id @@ -2265,7 +2265,7 @@ void ChatServer::sendRoomMessage(const ChatAvatarId &id, const std::string & roo { const ChatAvatar *sender = instance().ownerSystem; - IGNORE_RETURN(instance().chatInterface->RequestSendRoomMessage(sender, (*f).second.getAddress(), ChatUnicodeString(msg.data(), msg.size()), ChatUnicodeString(oob.data(), oob.size()), NULL)); + IGNORE_RETURN(instance().chatInterface->RequestSendRoomMessage(sender, (*f).second.getAddress(), ChatUnicodeString(msg.data(), msg.size()), ChatUnicodeString(oob.data(), oob.size()), nullptr)); } } } @@ -2280,7 +2280,7 @@ void ChatServer::sendRoomMessage(const NetworkId & id, const unsigned int sequen UNREF(sequence); ChatServer::AvatarExtendedData * aed = getAvatarExtendedDataByNetworkId(id); - const ChatAvatar * sender = (aed ? &(aed->chatAvatar) : NULL); + const ChatAvatar * sender = (aed ? &(aed->chatAvatar) : nullptr); const ChatServerRoomOwner *room = instance().chatInterface->getRoomOwner(roomId); if(sender && room) { @@ -2296,7 +2296,7 @@ void ChatServer::sendRoomMessage(const NetworkId & id, const unsigned int sequen aed->nonSpatialCharCount += msg.size(); // sync chat character count with game server - timeNow = ::time(NULL); + timeNow = ::time(nullptr); if ((timeNow > aed->chatSpamNextTimeToSyncWithGameServer) || (timeNow > aed->chatSpamTimeEndInterval)) { GenericValueTypeMessage, std::pair > > chatStatistics("ChatStatisticsCS", std::make_pair(std::make_pair(id, static_cast(aed->chatSpamTimeEndInterval)), std::make_pair(aed->spatialCharCount, aed->nonSpatialCharCount))); @@ -2322,7 +2322,7 @@ void ChatServer::sendRoomMessage(const NetworkId & id, const unsigned int sequen allowToSpeak = false; squelched = true; } - else if (::time(NULL) < aed->unsquelchTime) // still in squelch period + else if (::time(nullptr) < aed->unsquelchTime) // still in squelch period { allowToSpeak = false; squelched = true; @@ -2393,7 +2393,7 @@ void ChatServer::sendStandardRoomMessage(const ChatAvatarId &senderId, const std } if (sender) { - IGNORE_RETURN(instance().chatInterface->RequestSendRoomMessage(sender, (*f).second.getAddress(), ChatUnicodeString(msg.data(), msg.size()), ChatUnicodeString(oob.data(), oob.size()), NULL)); + IGNORE_RETURN(instance().chatInterface->RequestSendRoomMessage(sender, (*f).second.getAddress(), ChatUnicodeString(msg.data(), msg.size()), ChatUnicodeString(oob.data(), oob.size()), nullptr)); } } } @@ -2505,7 +2505,7 @@ std::string ChatServer::getFullChatAvatarName(ChatAvatar const *chatAvatar) { std::string result; - if (chatAvatar != NULL) + if (chatAvatar != nullptr) { result += toNarrowString(chatAvatar->getName()); result += '.'; @@ -2513,7 +2513,7 @@ std::string ChatServer::getFullChatAvatarName(ChatAvatar const *chatAvatar) } else { - result = "NULL"; + result = "nullptr"; } return result; @@ -2539,7 +2539,7 @@ std::string ChatServer::getConnectionAddress(Connection const *connection) { std::string result; - if (connection != NULL) + if (connection != nullptr) { char text[256]; snprintf(text, sizeof(text), "%s:%d", connection->getRemoteAddress().c_str(), connection->getRemotePort()); @@ -2547,7 +2547,7 @@ std::string ChatServer::getConnectionAddress(Connection const *connection) } else { - result = "NULL"; + result = "nullptr"; } return result; @@ -2566,13 +2566,13 @@ Unicode::String ChatServer::getChatRoomName(ChatRoom const *chatRoom) { Unicode::String result; - if (chatRoom != NULL) + if (chatRoom != nullptr) { result = toUnicodeString(chatRoom->getRoomName()); } else { - result = Unicode::narrowToWide("NULL"); + result = Unicode::narrowToWide("nullptr"); } return result; @@ -2582,12 +2582,12 @@ Unicode::String ChatServer::getChatRoomName(ChatRoom const *chatRoom) void ChatServer::clearCustomerServiceServerConnection() { - if (instance().customerServiceServerConnection != NULL) + if (instance().customerServiceServerConnection != nullptr) { instance().customerServiceServerConnection->disconnect(); } - instance().customerServiceServerConnection = NULL; + instance().customerServiceServerConnection = nullptr; } // ---------------------------------------------------------------------- @@ -2596,7 +2596,7 @@ void ChatServer::connectToCustomerServiceServer(const std::string &address, cons { //DEBUG_REPORT_LOG(true, ("***ChatServer::connectToCustomerServiceServer() address(%s) port(%d)\n", address.c_str(), port)); - if (instance().customerServiceServerConnection != NULL) + if (instance().customerServiceServerConnection != nullptr) { instance().customerServiceServerConnection->disconnect(); } @@ -2670,7 +2670,7 @@ bool ChatServer::isValidChatAvatarName(Unicode::String const &chatAvatarName) void ChatServer::logChatMessage(Unicode::String const &logPlayer, Unicode::String const &fromPlayer, Unicode::String const &toPlayer, Unicode::String const &text, Unicode::String const &channel) { - DEBUG_WARNING(toPlayer.empty(), ("toPlayer is NULL")); + DEBUG_WARNING(toPlayer.empty(), ("toPlayer is nullptr")); Unicode::String lowerLogPlayer(Unicode::toLower(logPlayer)); Unicode::String lowerFromPlayer(Unicode::toLower(fromPlayer)); @@ -2760,7 +2760,7 @@ void ChatServer::requestTransferAvatar(const TransferCharacterData & request) ChatAvatarId destinationAvatar("SWG", destination, request.getDestinationCharacterName()); - instance().chatInterface->RequestTransferAvatar(request.getSourceStationId(), makeChatUnicodeString(sourceAvatar.getName()), makeChatUnicodeString(sourceAvatar.getAPIAddress()), request.getDestinationStationId(), makeChatUnicodeString(destinationAvatar.getName()), makeChatUnicodeString(destinationAvatar.getAPIAddress()), true, NULL); + instance().chatInterface->RequestTransferAvatar(request.getSourceStationId(), makeChatUnicodeString(sourceAvatar.getName()), makeChatUnicodeString(sourceAvatar.getAPIAddress()), request.getDestinationStationId(), makeChatUnicodeString(destinationAvatar.getName()), makeChatUnicodeString(destinationAvatar.getAPIAddress()), true, nullptr); } } @@ -2845,7 +2845,7 @@ void ChatServer::handleChatStatisticsFromGameServer(NetworkId const & character, // non-spatial chat to report to the game server else if (aed->nonSpatialCharCount != nonSpatialNumCharacters) { - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); if (timeNow > aed->chatSpamNextTimeToSyncWithGameServer) { GenericValueTypeMessage, std::pair > > chatStatistics("ChatStatisticsCS", std::make_pair(std::make_pair(character, static_cast(aed->chatSpamTimeEndInterval)), std::make_pair(aed->spatialCharCount, aed->nonSpatialCharCount))); @@ -2904,7 +2904,7 @@ void ChatServer::sendToGameServerById(unsigned const connectionId, GameNetworkMe GameServerConnection *ChatServer::getGameServerConnectionFromId(unsigned int sequence) { - GameServerConnection * result = NULL; + GameServerConnection * result = nullptr; std::unordered_map::iterator f = m_gameServerConnectionRegistry.find(sequence); if(f != m_gameServerConnectionRegistry.end()) { diff --git a/engine/server/application/ChatServer/src/shared/ChatServerRoomOwner.cpp b/engine/server/application/ChatServer/src/shared/ChatServerRoomOwner.cpp index 091a78ac..dc8cd1a3 100755 --- a/engine/server/application/ChatServer/src/shared/ChatServerRoomOwner.cpp +++ b/engine/server/application/ChatServer/src/shared/ChatServerRoomOwner.cpp @@ -86,7 +86,7 @@ const ChatRoom * ChatServerRoomOwner::getRoom() const if (chatInterface) return chatInterface->getRoom(roomID); - return NULL; + return nullptr; } //----------------------------------------------------------------------- diff --git a/engine/server/application/ChatServer/src/shared/VChatInterface.cpp b/engine/server/application/ChatServer/src/shared/VChatInterface.cpp index 6e7e257c..b98704bc 100755 --- a/engine/server/application/ChatServer/src/shared/VChatInterface.cpp +++ b/engine/server/application/ChatServer/src/shared/VChatInterface.cpp @@ -435,7 +435,7 @@ void VChatInterface::OnConnectionOpened( const char * address ) ChatServer::fileLog(ms_voiceLoggingEnabled, ms_logLable, "OnConnectionOpened: %s", address); - uint32 track = VChatAPI::GetAccount(ms_systemAvatarName, ConfigChatServer::getGameCode(), ConfigChatServer::getClusterName(), 0, 0, NULL); + uint32 track = VChatAPI::GetAccount(ms_systemAvatarName, ConfigChatServer::getGameCode(), ConfigChatServer::getClusterName(), 0, 0, nullptr); ChatServer::fileLog(ms_voiceLoggingEnabled, ms_logLable, "Creating system avatar: %s track(%u)", getSystemLoginName().c_str(), track); } @@ -477,7 +477,7 @@ void VChatInterface::OnGetAccount(unsigned track, unsigned result, unsigned user { requestConnectPlayer(info->suid,info->avatarName,info->id, info->failedAttempts+1); delete info; - info = NULL; + info = nullptr; return; } } @@ -501,7 +501,7 @@ void VChatInterface::OnGetAccount(unsigned track, unsigned result, unsigned user } delete info; - info = NULL; + info = nullptr; } void VChatInterface::OnGetChannelV2(unsigned track, unsigned result, @@ -639,7 +639,7 @@ void VChatInterface::OnGetAllChannels(unsigned track, unsigned result, const VCh if(shouldRetry) { - GetAllChannels(NULL); + GetAllChannels(nullptr); } } @@ -832,7 +832,7 @@ void VChatInterface::checkForCharacterChannelAdd(std::string const & name, std:: data.m_channelPassword, data.m_channelURI, "en_US", - NULL); + nullptr); (*iter).second.push_back(playerOID); @@ -877,7 +877,7 @@ void VChatInterface::checkForCharacterChannelRemove(std::string const & name, st parseWorldName(std::string(avatar->getServer().c_str())), "SWG", "guild", - NULL); + nullptr); } iter = (*chanIter).second.erase(iter); diff --git a/engine/server/application/CommoditiesServer/src/linux/main.cpp b/engine/server/application/CommoditiesServer/src/linux/main.cpp index b93208f5..ce3735d1 100755 --- a/engine/server/application/CommoditiesServer/src/linux/main.cpp +++ b/engine/server/application/CommoditiesServer/src/linux/main.cpp @@ -61,7 +61,7 @@ int main(int argc, char ** argv) Unicode::UnicodeNarrowStringVector localeVector; localeVector.push_back(defaultLocale); - LocalizationManager::install (new TreeFile::TreeFileFactory, localeVector, debugStringIds, NULL, displayBadStringIds); + LocalizationManager::install (new TreeFile::TreeFileFactory, localeVector, debugStringIds, nullptr, displayBadStringIds); ExitChain::add(LocalizationManager::remove, "LocalizationManager::remove"); DataTableManager::install(); diff --git a/engine/server/application/CommoditiesServer/src/shared/Auction.cpp b/engine/server/application/CommoditiesServer/src/shared/Auction.cpp index 0d1edd7f..63f43523 100755 --- a/engine/server/application/CommoditiesServer/src/shared/Auction.cpp +++ b/engine/server/application/CommoditiesServer/src/shared/Auction.cpp @@ -208,7 +208,7 @@ namespace AuctionNamespace if (iterAttr != searchableAttributeString->end()) { applicableSearchCondition = true; - return (NULL != strstr(iterAttr->second.c_str(), searchCondition.stringValue.c_str())); // lowercase is assumed (and required) + return (nullptr != strstr(iterAttr->second.c_str(), searchCondition.stringValue.c_str())); // lowercase is assumed (and required) } } @@ -242,7 +242,7 @@ namespace AuctionNamespace if (iterAttr != searchableAttributeString->end()) { applicableSearchCondition = true; - return (NULL == strstr(iterAttr->second.c_str(), searchCondition.stringValue.c_str())); // lowercase is assumed (and required) + return (nullptr == strstr(iterAttr->second.c_str(), searchCondition.stringValue.c_str())); // lowercase is assumed (and required) } } @@ -293,10 +293,10 @@ m_userDescription(userDescription), m_oobLength(oobLength), m_oobData(oobData), m_attributes(), -m_searchableAttributeInt(NULL), -m_searchableAttributeFloat(NULL), -m_searchableAttributeString(NULL), -m_highBid(NULL), +m_searchableAttributeInt(nullptr), +m_searchableAttributeFloat(nullptr), +m_searchableAttributeString(nullptr), +m_highBid(nullptr), m_item(new AuctionItem(itemId, itemType, itemTemplateId, itemTimer, itemNameLength, itemName, creatorId, itemSize)), m_sold(false), m_active(true), @@ -395,10 +395,10 @@ m_userDescription(userDescription), m_oobLength(oobLength), m_oobData(oobData), m_attributes(), -m_searchableAttributeInt(NULL), -m_searchableAttributeFloat(NULL), -m_searchableAttributeString(NULL), -m_highBid(NULL), +m_searchableAttributeInt(nullptr), +m_searchableAttributeFloat(nullptr), +m_searchableAttributeString(nullptr), +m_highBid(nullptr), m_item(new AuctionItem(itemId, itemType, itemTemplateId, itemTimer, itemNameLength, itemName, creatorId, itemSize)), m_sold(isSold), m_active(isActive), @@ -488,7 +488,7 @@ void Auction::Initialization() #ifdef _DEBUG for (int i = 0; i < static_cast(AuctionQueryHeadersMessage::SCC_LAST); ++i) { - s_searchConditionComparisonFn[i] = NULL; + s_searchConditionComparisonFn[i] = nullptr; } #endif @@ -502,7 +502,7 @@ void Auction::Initialization() #ifdef _DEBUG for (int j = 0; j < static_cast(AuctionQueryHeadersMessage::SCC_LAST); ++j) { - DEBUG_FATAL((s_searchConditionComparisonFn[j] == NULL), ("s_searchConditionComparisonFn array is NULL at index (%d)", j)); + DEBUG_FATAL((s_searchConditionComparisonFn[j] == nullptr), ("s_searchConditionComparisonFn array is nullptr at index (%d)", j)); } #endif @@ -659,7 +659,7 @@ const AuctionBid *Auction::GetPreviousBid() const { if (m_bids.size() <= 1) { - return NULL; + return nullptr; } else { @@ -677,9 +677,9 @@ const AuctionBid *Auction::GetPreviousBid() const */ int Auction::GetActualBid(AuctionBid *bid) { - assert(bid != NULL); + assert(bid != nullptr); int bidNeeded = std::max(m_minBid, bid->GetBid()); - if (m_highBid != NULL) + if (m_highBid != nullptr) { bidNeeded = m_highBid->GetBid(); if (*bid > *m_highBid) @@ -765,7 +765,7 @@ AuctionResultCode Auction::AddBid( AuctionBid *auctionBid = new AuctionBid(bidderId, bid, maxProxyBid); int newBidForHighBidder = GetActualBid(auctionBid); - if (m_highBid != NULL) + if (m_highBid != nullptr) { if (*auctionBid <= *m_highBid) { @@ -810,7 +810,7 @@ const AuctionBid *Auction::GetPlayerBid(const NetworkId & playerId) const } ++iter; } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -826,7 +826,7 @@ bool Auction::Update(int gameTime) //immediate sale DEBUG_REPORT_LOG(true, ("[Commodities Server Auction::Update] : Expiring immediate sale - Auction is active and sold.\n")); - if ((m_trackId != -1) && (CommodityServer::getInstance().getGameServer(m_trackId) != NULL)) + if ((m_trackId != -1) && (CommodityServer::getInstance().getGameServer(m_trackId) != nullptr)) { Expire(true, false, m_trackId); m_trackId = -1; @@ -840,14 +840,14 @@ bool Auction::Update(int gameTime) { DEBUG_REPORT_LOG(true, ("[Commodities Server Auction::Update] : Auction expiring based on timer.\n")); - if ((m_trackId != -1) && (CommodityServer::getInstance().getGameServer(m_trackId) != NULL)) + if ((m_trackId != -1) && (CommodityServer::getInstance().getGameServer(m_trackId) != nullptr)) { - Expire(m_highBid != NULL, true, m_trackId); + Expire(m_highBid != nullptr, true, m_trackId); m_trackId = -1; } else { - Expire(m_highBid != NULL, true); + Expire(m_highBid != nullptr, true); } } @@ -862,7 +862,7 @@ void Auction::Expire(bool sold, bool expiredBasedOnTimer, int track_id) m_auctionTimer = 0; m_active = false; - if (sold && m_highBid != NULL) + if (sold && m_highBid != nullptr) { m_sold = true; } @@ -934,7 +934,7 @@ void Auction::Expire(bool sold, bool expiredBasedOnTimer, int track_id) m_location.SetVendorFirstTimerExpiredAuctionDate(time(0)); } - DEBUG_REPORT_LOG(true, ("[Commodities Server Auction::Expire] : Sending OnAuctionExpired for non-sold auction and null high bid obj .\n")); + DEBUG_REPORT_LOG(true, ("[Commodities Server Auction::Expire] : Sending OnAuctionExpired for non-sold auction and nullptr high bid obj .\n")); AuctionMarket::getInstance().OnAuctionExpired( GetCreatorId(), m_sold, m_flags, NetworkId::cms_invalid, 0, m_item->GetItemId(), 0, @@ -1107,8 +1107,8 @@ void Auction::BuildSearchableAttributeList() std::map const & saAlias = CommoditiesAdvancedSearchAttribute::getSearchAttributeNameAliasesForGameObjectType(m_item->GetCategory()); // for factory crates, also include the attributes of the item inside the crate - std::map const * saItemInsideFactoryCrate = NULL; - std::map const * saAliasItemInsideFactoryCrate = NULL; + std::map const * saItemInsideFactoryCrate = nullptr; + std::map const * saAliasItemInsideFactoryCrate = nullptr; int gotItemInsideFactoryCrate = 0; if (m_item->GetCategory() == SharedObjectTemplate::GOT_misc_factory_crate) @@ -1134,10 +1134,10 @@ void Auction::BuildSearchableAttributeList() saAliasItemInsideFactoryCrate = &(CommoditiesAdvancedSearchAttribute::getSearchAttributeNameAliasesForGameObjectType(gotItemInsideFactoryCrate)); if (saItemInsideFactoryCrate->empty()) - saItemInsideFactoryCrate = NULL; + saItemInsideFactoryCrate = nullptr; if (saAliasItemInsideFactoryCrate->empty()) - saAliasItemInsideFactoryCrate = NULL; + saAliasItemInsideFactoryCrate = nullptr; } } diff --git a/engine/server/application/CommoditiesServer/src/shared/AuctionLocation.cpp b/engine/server/application/CommoditiesServer/src/shared/AuctionLocation.cpp index df458ef0..d692840d 100755 --- a/engine/server/application/CommoditiesServer/src/shared/AuctionLocation.cpp +++ b/engine/server/application/CommoditiesServer/src/shared/AuctionLocation.cpp @@ -137,7 +137,7 @@ AuctionLocation::~AuctionLocation() bool AuctionLocation::AddAuction(Auction *auction) { - assert(auction != NULL); + assert(auction != nullptr); if (IsVendorMarket() && (!auction->IsActive() || !IsOwner(auction->GetCreatorId()))) { @@ -189,7 +189,7 @@ void AuctionLocation::CancelVendorSale(Auction *auction) bool AuctionLocation::RemoveAuction(Auction *auction) { - assert(auction != NULL); + assert(auction != nullptr); return RemoveAuction(auction->GetItem().GetItemId()); } @@ -265,7 +265,7 @@ Auction *AuctionLocation::GetAuction(const NetworkId & itemId) return((*i).second); } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/application/CommoditiesServer/src/shared/AuctionMarket.cpp b/engine/server/application/CommoditiesServer/src/shared/AuctionMarket.cpp index a07b0864..328f189e 100644 --- a/engine/server/application/CommoditiesServer/src/shared/AuctionMarket.cpp +++ b/engine/server/application/CommoditiesServer/src/shared/AuctionMarket.cpp @@ -121,7 +121,7 @@ namespace AuctionMarketNamespace Auction const * const auction, int const type, int const entranceCharge, - AuctionBid const * const playerBid = NULL + AuctionBid const * const playerBid = nullptr ) { AuctionDataHeader *header = new AuctionDataHeader; @@ -301,7 +301,7 @@ namespace AuctionMarketNamespace std::map attributeValue; }; - GetItemAttributeDataRequest * getItemAttributeDataRequest = NULL; + GetItemAttributeDataRequest * getItemAttributeDataRequest = nullptr; void processItemAttributeData(std::map const & auctions); @@ -394,8 +394,8 @@ void AuctionMarketNamespace::processItemAttributeData(std::map const * skipAttribute = NULL; - std::map const * skipAttributeAlias = NULL; + std::map const * skipAttribute = nullptr; + std::map const * skipAttributeAlias = nullptr; if (getItemAttributeDataRequest->ignoreSearchableAttribute) { std::map const & sa = CommoditiesAdvancedSearchAttribute::getSearchAttributeForGameObjectType(iterAuction->second->GetItem().GetCategory()); @@ -590,7 +590,7 @@ void AuctionMarketNamespace::processItemAttributeData(std::mapGetLocation(); if (!location.IsOwner(auction->GetItem().GetOwnerId())) @@ -1979,7 +1979,7 @@ void AuctionMarket::AcceptHighBid(const AcceptHighBidMessage &message) DEBUG_REPORT_LOG(m_showAllDebugInfo, ("[Commodities Server AcceptHighBidMessage] : ResponseId : %d.\n", message.GetResponseId())); DEBUG_REPORT_LOG(m_showAllDebugInfo, ("[Commodities Server AcceptHighBidMessage] : TrackId : %d.\n", message.GetTrackId())); - Auction *auction = NULL; + Auction *auction = nullptr; AuctionResultCode result = ARC_Success; std::map::iterator iter = m_auctions.find( message.GetAuctionId()); @@ -1994,7 +1994,7 @@ void AuctionMarket::AcceptHighBid(const AcceptHighBidMessage &message) { result = ARC_NotItemOwner; } - else if (auction->GetHighBid() == NULL) + else if (auction->GetHighBid() == nullptr) { result = ARC_NoBids; } @@ -2525,19 +2525,19 @@ void AuctionMarket::QueryAuctionHeaders( int debugNumberLocationsMatched = 0; int debugNumberAuctionsTested = 0; - std::map *auctionsPtr = NULL; + std::map *auctionsPtr = nullptr; int entranceCharge = 0; - AuctionLocation *locationPtr = NULL; - Auction *auctionPtr = NULL; + AuctionLocation *locationPtr = nullptr; + Auction *auctionPtr = nullptr; std::map::const_iterator auctionIterator; - AuctionDataHeader *header = NULL; + AuctionDataHeader *header = nullptr; bool checkItemTemplate; while (locationIter != locationIterEnd) { ++debugNumberLocationsTested; checkItemTemplate = false; - auctionsPtr = NULL; + auctionsPtr = nullptr; entranceCharge = 0; locationPtr = (*locationIter).second; @@ -2606,7 +2606,7 @@ void AuctionMarket::QueryAuctionHeaders( auctionPtr = (*auctionIterator).second; const AuctionItem &item = auctionPtr->GetItem(); - header = NULL; + header = nullptr; // Check to see if the item template matches if (searchForResourceContainer && (itemTemplateId != 0)) @@ -4977,7 +4977,7 @@ void AuctionMarket::getAuctionLocationPriorityQueue(int requestingGameServerId, { std::string output; char buffer[2048]; - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); for (std::set >::const_iterator iterPQ = m_priorityQueueAuctionLocation.begin(); iterPQ != m_priorityQueueAuctionLocation.end(); ++iterPQ) { if (count <= 0) diff --git a/engine/server/application/CommoditiesServer/src/shared/CommodityServer.cpp b/engine/server/application/CommoditiesServer/src/shared/CommodityServer.cpp index 1e2671be..3c2019cd 100755 --- a/engine/server/application/CommoditiesServer/src/shared/CommodityServer.cpp +++ b/engine/server/application/CommoditiesServer/src/shared/CommodityServer.cpp @@ -191,7 +191,7 @@ void CommodityServer::run() s_commodityServerMetricsData = new CommodityServerMetricsData; MetricsManager::install(s_commodityServerMetricsData, false, "CommoditiesServer", "", 0); - time_t timePrevious = ::time(NULL); + time_t timePrevious = ::time(nullptr); time_t timeCurrent = timePrevious; while (true) @@ -202,7 +202,7 @@ void CommodityServer::run() break; NetworkHandler::update(); - timeCurrent = ::time(NULL); + timeCurrent = ::time(nullptr); MetricsManager::update(static_cast((timeCurrent - timePrevious) * 1000)); timePrevious = timeCurrent; @@ -229,18 +229,18 @@ void CommodityServer::run() // this is not a high priority thing, so wait until // the cluster has started and "stabilized" before // doing this; 3 hours should be adequate - time_t timeToRequestExcludedType = ::time(NULL) + 10800; + time_t timeToRequestExcludedType = ::time(nullptr) + 10800; // one time request from the game server (any game server) // to receive the resource tree hierarchy to support // searching for resource container - time_t timeToRequestResourceTree = ::time(NULL); + time_t timeToRequestResourceTree = ::time(nullptr); while(true) { NetworkHandler::update(); - timeCurrent = ::time(NULL); + timeCurrent = ::time(nullptr); MetricsManager::update(static_cast((timeCurrent - timePrevious) * 1000)); timePrevious = timeCurrent; diff --git a/engine/server/application/CommoditiesServer/src/shared/CommodityServerMetricsData.cpp b/engine/server/application/CommoditiesServer/src/shared/CommodityServerMetricsData.cpp index 4b1ff37e..90594e07 100755 --- a/engine/server/application/CommoditiesServer/src/shared/CommodityServerMetricsData.cpp +++ b/engine/server/application/CommoditiesServer/src/shared/CommodityServerMetricsData.cpp @@ -74,7 +74,7 @@ void CommodityServerMetricsData::updateData() buffer[sizeof(buffer)-1] = '\0'; } - m_mapAuctionsCountByGameObjectTypeIndex[iterGameObjectType->first] = addMetric(buffer, 0, NULL, false, false); + m_mapAuctionsCountByGameObjectTypeIndex[iterGameObjectType->first] = addMetric(buffer, 0, nullptr, false, false); } } } diff --git a/engine/server/application/ConnectionServer/src/linux/main.cpp b/engine/server/application/ConnectionServer/src/linux/main.cpp index 24c76421..5984dd4c 100755 --- a/engine/server/application/ConnectionServer/src/linux/main.cpp +++ b/engine/server/application/ConnectionServer/src/linux/main.cpp @@ -37,7 +37,7 @@ int main(int argc, char ** argv) SetupSharedFile::install(false); SetupSharedNetworkMessages::install(); - SetupSharedRandom::install(time(NULL)); + SetupSharedRandom::install(time(nullptr)); //setup the server NetworkHandler::install(); diff --git a/engine/server/application/ConnectionServer/src/shared/ClientConnection.cpp b/engine/server/application/ConnectionServer/src/shared/ClientConnection.cpp index f7b3020b..32b3811c 100755 --- a/engine/server/application/ConnectionServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/ConnectionServer/src/shared/ClientConnection.cpp @@ -82,7 +82,7 @@ m_canCreateRegularCharacter(false), m_canCreateJediCharacter(false), m_hasRequestedCharacterCreate(false), m_hasCreatedCharacter(false), -m_pendingCharacterCreate(NULL), +m_pendingCharacterCreate(nullptr), m_canSkipTutorial(false), m_characterId(NetworkId::cms_invalid), m_characterName(), @@ -144,7 +144,7 @@ ClientConnection::~ClientConnection() { hasBeenKicked = m_client->hasBeenKicked(); delete m_client; - m_client = NULL; + m_client = nullptr; } // tell Session to stop recording play time for the character @@ -177,7 +177,7 @@ ClientConnection::~ClientConnection() m_pendingChatQueryRoomRequests.clear(); delete m_pendingCharacterCreate; - m_pendingCharacterCreate = NULL; + m_pendingCharacterCreate = nullptr; } @@ -202,7 +202,7 @@ std::string ClientConnection::getPlayTimeDuration() const int playTimeDuration = 0; if (m_startPlayTime > 0) - playTimeDuration = static_cast(::time(NULL) - m_startPlayTime); + playTimeDuration = static_cast(::time(nullptr) - m_startPlayTime); return CalendarTime::convertSecondsToHMS(static_cast(playTimeDuration)); } @@ -214,7 +214,7 @@ std::string ClientConnection::getActivePlayTimeDuration() const int activePlayTimeDuration = static_cast(m_activePlayTimeDuration); if (m_lastActiveTime > 0) - activePlayTimeDuration += static_cast(::time(NULL) - m_lastActiveTime); + activePlayTimeDuration += static_cast(::time(nullptr) - m_lastActiveTime); return CalendarTime::convertSecondsToHMS(static_cast(activePlayTimeDuration)); } @@ -226,7 +226,7 @@ std::string ClientConnection::getCurrentActivePlayTimeDuration() const int activePlayTimeDuration = 0; if (m_lastActiveTime > 0) - activePlayTimeDuration = static_cast(::time(NULL) - m_lastActiveTime); + activePlayTimeDuration = static_cast(::time(nullptr) - m_lastActiveTime); return CalendarTime::convertSecondsToHMS(static_cast(activePlayTimeDuration)); } @@ -400,7 +400,7 @@ void ClientConnection::handleClientIdMessage(const ClientIdMsg& msg) std::hash h; m_suid = h(m_accountName.c_str()); } - onValidateClient(m_suid, m_accountName, m_isSecure, NULL, ConfigConnectionServer::getDefaultGameFeatures(), ConfigConnectionServer::getDefaultSubscriptionFeatures(), 0, 0, 0, 0, ConfigConnectionServer::getFakeBuddyPoints()); + onValidateClient(m_suid, m_accountName, m_isSecure, nullptr, ConfigConnectionServer::getDefaultGameFeatures(), ConfigConnectionServer::getDefaultSubscriptionFeatures(), 0, 0, 0, 0, ConfigConnectionServer::getFakeBuddyPoints()); } } else @@ -452,7 +452,7 @@ void ClientConnection::onIdValidated(bool canLogin, bool canCreateRegularCharact } delete m_pendingCharacterCreate; - m_pendingCharacterCreate = NULL; + m_pendingCharacterCreate = nullptr; return; } @@ -683,7 +683,7 @@ void ClientConnection::onReceive(const Archive::ByteStream & message) } else { - ConnectionServer::dropClient(this, "m_client is null while receiving a message!"); + ConnectionServer::dropClient(this, "m_client is nullptr while receiving a message!"); disconnect(); } } @@ -796,7 +796,7 @@ void ClientConnection::onReceive(const Archive::ByteStream & message) } else { - ConnectionServer::dropClient(this, "m_client is null while receiving a message!"); + ConnectionServer::dropClient(this, "m_client is nullptr while receiving a message!"); disconnect(); } } @@ -839,7 +839,7 @@ void ClientConnection::onReceive(const Archive::ByteStream & message) } else { - ConnectionServer::dropClient(this, "m_client is null while receiving a message!"); + ConnectionServer::dropClient(this, "m_client is nullptr while receiving a message!"); disconnect(); } } @@ -865,7 +865,7 @@ void ClientConnection::onReceive(const Archive::ByteStream & message) //DEBUG_REPORT_LOG(true, ("CONSRV::CS - suid: %i\n", getSUID())); - if (customerServiceConnection != NULL) + if (customerServiceConnection != nullptr) { static std::vector v; v.clear(); @@ -935,7 +935,7 @@ void ClientConnection::onReceive(const Archive::ByteStream & message) } else { - ConnectionServer::dropClient(this, "m_client is null while receiving a message!"); + ConnectionServer::dropClient(this, "m_client is nullptr while receiving a message!"); disconnect(); } } @@ -951,7 +951,7 @@ void ClientConnection::onReceive(const Archive::ByteStream & message) if (m_lastActiveTime > 0) { // record the amount of active time - m_activePlayTimeDuration += static_cast(::time(NULL) - m_lastActiveTime); + m_activePlayTimeDuration += static_cast(::time(nullptr) - m_lastActiveTime); // tell Session to stop recording play time for the character if (ConnectionServer::getSessionApiClient() && ConfigConnectionServer::getSessionRecordPlayTime()) @@ -988,7 +988,7 @@ void ClientConnection::onReceive(const Archive::ByteStream & message) if (m_lastActiveTime == 0) { // record the time client went active - m_lastActiveTime = ::time(NULL); + m_lastActiveTime = ::time(nullptr); // tell Session to start recording play time for the character if (ConnectionServer::getSessionApiClient() && ConfigConnectionServer::getSessionRecordPlayTime()) @@ -1616,7 +1616,7 @@ void ClientConnection::onValidateClient (uint32 suid, const std::string & userna } // tell client the server-side game and subscription feature bits and which ConnectionServer we are and the current server Epoch time - GenericValueTypeMessage, std::pair > > const msgFeatureBits("AccountFeatureBits", std::make_pair(std::make_pair(gameFeatures, subscriptionFeatures), std::make_pair(ConfigConnectionServer::getConnectionServerNumber(), static_cast(::time(NULL))))); + GenericValueTypeMessage, std::pair > > const msgFeatureBits("AccountFeatureBits", std::make_pair(std::make_pair(gameFeatures, subscriptionFeatures), std::make_pair(ConfigConnectionServer::getConnectionServerNumber(), static_cast(::time(nullptr))))); send(msgFeatureBits, true); std::string const gameFeaturesDescription = ClientGameFeature::getDescription(gameFeatures); diff --git a/engine/server/application/ConnectionServer/src/shared/ConnectionServer.cpp b/engine/server/application/ConnectionServer/src/shared/ConnectionServer.cpp index b698ecb6..10d0c99f 100755 --- a/engine/server/application/ConnectionServer/src/shared/ConnectionServer.cpp +++ b/engine/server/application/ConnectionServer/src/shared/ConnectionServer.cpp @@ -163,7 +163,7 @@ const CustomerServiceConnection * ConnectionServer::getCustomerServiceConnection { return (*(instance().customerServiceServers.begin())); } - return NULL; + return nullptr; } //----------------------------------------------------------------------- @@ -366,7 +366,7 @@ void ConnectionServer::addNewClient(ClientConnection* cconn, const NetworkId &oi //send the game server a message about this client. static const std::string loginTrace("TRACE_LOGIN"); LOG(loginTrace, ("NewClient(%d, %s, %s)", cconn->getSUID(), oid.getValueString().c_str(), cconn->getAccountName().c_str())); - NewClient m(oid, cconn->getAccountName(), cconn->getRemoteAddress(), cconn->getIsSecure(), false, cconn->getSUID(), NULL, cconn->getGameFeatures(), cconn->getSubscriptionFeatures(), cconn->getEntitlementTotalTime(), cconn->getEntitlementEntitledTime(), cconn->getEntitlementTotalTimeSinceLastLogin(), cconn->getEntitlementEntitledTimeSinceLastLogin(), cconn->getBuddyPoints(), cconn->getConsumedRewardEvents(), cconn->getClaimedRewardItems(), cconn->isUsingAdminLogin(), cconn->getCanSkipTutorial(), sendToStarport ); + NewClient m(oid, cconn->getAccountName(), cconn->getRemoteAddress(), cconn->getIsSecure(), false, cconn->getSUID(), nullptr, cconn->getGameFeatures(), cconn->getSubscriptionFeatures(), cconn->getEntitlementTotalTime(), cconn->getEntitlementEntitledTime(), cconn->getEntitlementTotalTimeSinceLastLogin(), cconn->getEntitlementEntitledTimeSinceLastLogin(), cconn->getBuddyPoints(), cconn->getConsumedRewardEvents(), cconn->getClaimedRewardItems(), cconn->isUsingAdminLogin(), cconn->getCanSkipTutorial(), sendToStarport ); gconn->send(m, true); //@todo move this to ClientConnection.cpp } @@ -375,7 +375,7 @@ void ConnectionServer::addNewClient(ClientConnection* cconn, const NetworkId &oi void ConnectionServer::dropClient(ClientConnection * conn, const std::string& description) { - DEBUG_FATAL(!conn, ("Cannot call dropClient with NULL connection")); + DEBUG_FATAL(!conn, ("Cannot call dropClient with nullptr connection")); if (!conn) //lint !e774 // boolean within 'if' always evaluates to False //suppresed because this is only relevant in DEBUG builds return; @@ -466,7 +466,7 @@ GameConnection* ConnectionServer::getGameConnection(const std::string &sceneName return (*i).second; } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -477,15 +477,15 @@ void ConnectionServer::handleConnectionServerIdMessage(const ConnectionServerId const Service * const servicePrivate = getClientServicePrivate(); const Service * const servicePublic = getClientServicePublic(); - FATAL(servicePrivate == NULL && servicePublic == NULL, ("No client service is active!")); + FATAL(servicePrivate == nullptr && servicePublic == nullptr, ("No client service is active!")); const Service * const g = getGameService(); - FATAL(g == NULL, ("No game service is active!")); + FATAL(g == nullptr, ("No game service is active!")); const Service * const c = getChatService(); const Service * const cs = getCustomerService(); const uint16 pingPort = getPingPort (); - if((servicePrivate != NULL || servicePublic != NULL) && g != NULL) //lint !e774 // always evaluates to false // suppresed because the FATAL macro triggers this lint warning + if((servicePrivate != nullptr || servicePublic != nullptr) && g != nullptr) //lint !e774 // always evaluates to false // suppresed because the FATAL macro triggers this lint warning { uint16 chatPort = 0; uint16 csPort = 0; @@ -739,7 +739,7 @@ void ConnectionServer::receiveMessage(const MessageDispatch::Emitter & source, c std::set::const_iterator i; for(i = clients.begin(); i != clients.end(); ++ i) { - (*i)->setChatConnection(NULL); + (*i)->setChatConnection(nullptr); } } } @@ -782,7 +782,7 @@ void ConnectionServer::receiveMessage(const MessageDispatch::Emitter & source, c std::set::const_iterator i; for(i = clients.begin(); i != clients.end(); ++ i) { - (*i)->setCustomerServiceConnection(NULL); + (*i)->setCustomerServiceConnection(nullptr); } } @@ -960,7 +960,7 @@ void ConnectionServer::remove() // explicitly delete all connections that were setup from setupConnections rather than letting // Connection::remove do it. There are connections that require a valid s_connectionServer which is deleted - // and set to NULL. + // and set to nullptr. s_connectionServer->unsetupConnections(); SetupSharedLog::remove(); @@ -1316,7 +1316,7 @@ GameConnection* ConnectionServer::getGameConnection(uint32 gameServerId) if (i != cs.gameServerMap.end()) return (*i).second; - return NULL; + return nullptr; } //----------------------------------------------------------------------- @@ -1327,7 +1327,7 @@ GameConnection* ConnectionServer::getAnyGameConnection() if (!cs.gameServerMap.empty()) return cs.gameServerMap.begin()->second; - return NULL; + return nullptr; } //----------------------------------------------------------------------- diff --git a/engine/server/application/ConnectionServer/src/shared/GameConnection.cpp b/engine/server/application/ConnectionServer/src/shared/GameConnection.cpp index ddf0fe38..ecfede1e 100755 --- a/engine/server/application/ConnectionServer/src/shared/GameConnection.cpp +++ b/engine/server/application/ConnectionServer/src/shared/GameConnection.cpp @@ -157,7 +157,7 @@ void GameConnection::onReceive(const Archive::ByteStream & message) ca.getStartYaw(), ca.getTemplateName(), ca.getTimeSeconds(), - static_cast(::time(NULL)), + static_cast(::time(nullptr)), ConfigConnectionServer::getDisableWorldSnapshot()); client->getClientConnection()->send(startScene, true); } @@ -166,7 +166,7 @@ void GameConnection::onReceive(const Archive::ByteStream & message) // record the time when play started for the character if (client->getClientConnection()->getStartPlayTime() == 0) { - client->getClientConnection()->setStartPlayTime(::time(NULL)); + client->getClientConnection()->setStartPlayTime(::time(nullptr)); } // update the play time info on the game server diff --git a/engine/server/application/ConnectionServer/src/shared/PseudoClientConnection.cpp b/engine/server/application/ConnectionServer/src/shared/PseudoClientConnection.cpp index 49553a04..9caa85e9 100755 --- a/engine/server/application/ConnectionServer/src/shared/PseudoClientConnection.cpp +++ b/engine/server/application/ConnectionServer/src/shared/PseudoClientConnection.cpp @@ -246,9 +246,9 @@ void PseudoClientConnection::receiveMessage(const Archive::ByteStream & message) characterId = m_transferCharacterData.getDestinationCharacterId(); } std::vector > static const emptyStringVector; - NewClient m(characterId, "TransferServer", NetworkHandler::getHostName(), true, false, stationId, NULL, 0, 0, 0, 0, 0, 0, 0, emptyStringVector, emptyStringVector, m_transferCharacterData.getCSToolId() != 0, true); + NewClient m(characterId, "TransferServer", NetworkHandler::getHostName(), true, false, stationId, nullptr, 0, 0, 0, 0, 0, 0, 0, emptyStringVector, emptyStringVector, m_transferCharacterData.getCSToolId() != 0, true); m_gameConnection->send(m, true); - LOG("CustomerService", ("CharacterTransfer: Sent NewClient(%s, \"TransferServer\", \"%s\", true, false, %d, NULL, 0, 0)\n", characterId.getValueString().c_str(), NetworkHandler::getHostName().c_str(), stationId)); + LOG("CustomerService", ("CharacterTransfer: Sent NewClient(%s, \"TransferServer\", \"%s\", true, false, %d, nullptr, 0, 0)\n", characterId.getValueString().c_str(), NetworkHandler::getHostName().c_str(), stationId)); } } else if(msg.isType("TransferLoginCharacterToSourceServer")) diff --git a/engine/server/application/ConnectionServer/src/shared/SessionApiClient.cpp b/engine/server/application/ConnectionServer/src/shared/SessionApiClient.cpp index dba551e9..67598bb4 100755 --- a/engine/server/application/ConnectionServer/src/shared/SessionApiClient.cpp +++ b/engine/server/application/ConnectionServer/src/shared/SessionApiClient.cpp @@ -303,10 +303,10 @@ void SessionApiClient::OnGetFeatures(const apiTrackingNumber trackingNumber, if (i != ms_getFeaturesTrackingNumberMap.end()) { bool reuseMessage = false; - AccountFeatureIdRequest const * accountFeatureIdRequest = NULL; - AdjustAccountFeatureIdRequest const * adjustAccountFeatureIdRequest = NULL; - AdjustAccountFeatureIdResponse * adjustAccountFeatureIdResponse = NULL; - ClaimRewardsMessage * claimRewardsMessage = NULL; + AccountFeatureIdRequest const * accountFeatureIdRequest = nullptr; + AdjustAccountFeatureIdRequest const * adjustAccountFeatureIdRequest = nullptr; + AdjustAccountFeatureIdResponse * adjustAccountFeatureIdResponse = nullptr; + ClaimRewardsMessage * claimRewardsMessage = nullptr; if (i->second->isType("AccountFeatureIdRequest")) accountFeatureIdRequest = dynamic_cast(i->second); @@ -319,7 +319,7 @@ void SessionApiClient::OnGetFeatures(const apiTrackingNumber trackingNumber, if (result == RESULT_SUCCESS) { - ClientConnection * clientConnection = NULL; + ClientConnection * clientConnection = nullptr; if (accountFeatureIdRequest) clientConnection = ConnectionServer::getClientConnection(accountFeatureIdRequest->getTargetStationId()); else if (adjustAccountFeatureIdRequest) @@ -391,7 +391,7 @@ void SessionApiClient::OnGetFeatures(const apiTrackingNumber trackingNumber, else { // if account already has the feature, adjust it, otherwise add the feature - LoginAPI::Feature const * existingFeature = NULL; + LoginAPI::Feature const * existingFeature = nullptr; for (unsigned k = 0; k < featureCount; ++k) { @@ -444,7 +444,7 @@ void SessionApiClient::OnGetFeatures(const apiTrackingNumber trackingNumber, } else { - LoginAPI::Feature const * newlyAddedFeature = NULL; + LoginAPI::Feature const * newlyAddedFeature = nullptr; for (unsigned k = 0; k < featureCount; ++k) { @@ -506,7 +506,7 @@ void SessionApiClient::OnGetFeatures(const apiTrackingNumber trackingNumber, else { // see if account already has the required feature - LoginAPI::Feature const * existingFeature = NULL; + LoginAPI::Feature const * existingFeature = nullptr; for (unsigned k = 0; k < featureCount; ++k) { @@ -904,7 +904,7 @@ void SessionApiClient::validateClient (ClientConnection* client, const std::stri void SessionApiClient::startPlay(const ClientConnection& client) { - IGNORE_RETURN(SessionStartPlay(client.getSessionId().c_str(), ConfigConnectionServer::getClusterName(), client.getCharacterName().c_str(), NULL)); + IGNORE_RETURN(SessionStartPlay(client.getSessionId().c_str(), ConfigConnectionServer::getClusterName(), client.getCharacterName().c_str(), nullptr)); } //------------------------------------------------------------ diff --git a/engine/server/application/CustomerServiceServer/src/linux/main.cpp b/engine/server/application/CustomerServiceServer/src/linux/main.cpp index 7cdc4016..35924a2c 100755 --- a/engine/server/application/CustomerServiceServer/src/linux/main.cpp +++ b/engine/server/application/CustomerServiceServer/src/linux/main.cpp @@ -30,7 +30,7 @@ int main(int argc, char *argv[]) SetupSharedFile::install(false); SetupSharedNetworkMessages::install(); - SetupSharedRandom::install(static_cast(time(NULL))); + SetupSharedRandom::install(static_cast(time(nullptr))); Os::setProgramName("CustomerServiceServer"); ConfigCustomerServiceServer::install(); NetworkHandler::install(); diff --git a/engine/server/application/CustomerServiceServer/src/shared/CentralServerConnection.cpp b/engine/server/application/CustomerServiceServer/src/shared/CentralServerConnection.cpp index 68a2ded3..8e74a876 100755 --- a/engine/server/application/CustomerServiceServer/src/shared/CentralServerConnection.cpp +++ b/engine/server/application/CustomerServiceServer/src/shared/CentralServerConnection.cpp @@ -49,7 +49,7 @@ void CentralServerConnection::onConnectionOpened() Service *chatServerService = CustomerServiceServer::getInstance().getChatServerService(); - if (chatServerService != NULL) + if (chatServerService != nullptr) { const std::string address(chatServerService->getBindAddress()); const int port = chatServerService->getBindPort(); @@ -62,7 +62,7 @@ void CentralServerConnection::onConnectionOpened() } else { - LOG("CentralServerConnection", ("onConnectionOpened() ERROR: ChatServerService is NULL")); + LOG("CentralServerConnection", ("onConnectionOpened() ERROR: ChatServerService is nullptr")); } } @@ -71,7 +71,7 @@ void CentralServerConnection::onConnectionOpened() Service *gameServerService = CustomerServiceServer::getInstance().getGameServerService(); - if (gameServerService != NULL) + if (gameServerService != nullptr) { const std::string address(gameServerService->getBindAddress()); const int port = gameServerService->getBindPort(); @@ -84,7 +84,7 @@ void CentralServerConnection::onConnectionOpened() } else { - LOG("CentralServerConnection", ("onConnectionOpened() ERROR: GameServerService is NULL")); + LOG("CentralServerConnection", ("onConnectionOpened() ERROR: GameServerService is nullptr")); } } } diff --git a/engine/server/application/CustomerServiceServer/src/shared/ChatServerConnection.cpp b/engine/server/application/CustomerServiceServer/src/shared/ChatServerConnection.cpp index 239a4630..30a167b1 100755 --- a/engine/server/application/CustomerServiceServer/src/shared/ChatServerConnection.cpp +++ b/engine/server/application/CustomerServiceServer/src/shared/ChatServerConnection.cpp @@ -64,13 +64,13 @@ void ChatServerConnection::sendTo(GameNetworkMessage const &message) { LOG("ChatServerConnection", ("sendTo() message(%s)", message.getCmdName().c_str())); - if (s_connection != NULL) + if (s_connection != nullptr) { s_connection->send(message, true); } else { - LOG("ChatServerConnection", ("sendTo() Unable to send, NULL ChatServerConnection")); + LOG("ChatServerConnection", ("sendTo() Unable to send, nullptr ChatServerConnection")); } } diff --git a/engine/server/application/CustomerServiceServer/src/shared/ConfigCustomerServiceServer.cpp b/engine/server/application/CustomerServiceServer/src/shared/ConfigCustomerServiceServer.cpp index eff05cf2..d0e93110 100755 --- a/engine/server/application/CustomerServiceServer/src/shared/ConfigCustomerServiceServer.cpp +++ b/engine/server/application/CustomerServiceServer/src/shared/ConfigCustomerServiceServer.cpp @@ -12,19 +12,19 @@ namespace ConfigCustomerServiceServerNamespace { - const char * s_clusterName = NULL; - const char * s_centralServerAddress = NULL; + const char * s_clusterName = nullptr; + const char * s_centralServerAddress = nullptr; int s_centralServerPort = 0; - const char * s_gameCode = NULL; - const char * s_csServerAddress = NULL; + const char * s_gameCode = nullptr; + const char * s_csServerAddress = nullptr; int s_csServerPort = 0; int s_maxPacketsPerSecond = 50; int s_requestTimeoutSeconds = 300; int s_maxAllowedNumberOfTickets = 1; int s_gameServicePort = 0; int s_chatServicePort = 0; - const char* s_chatServiceBindInterface = NULL; - const char* s_gameServiceBindInterface = NULL; + const char* s_chatServiceBindInterface = nullptr; + const char* s_gameServiceBindInterface = nullptr; bool s_writeTicketToBugLog = false; }; diff --git a/engine/server/application/CustomerServiceServer/src/shared/CustomerServiceInterface.cpp b/engine/server/application/CustomerServiceServer/src/shared/CustomerServiceInterface.cpp index e1e93c31..333117be 100755 --- a/engine/server/application/CustomerServiceServer/src/shared/CustomerServiceInterface.cpp +++ b/engine/server/application/CustomerServiceServer/src/shared/CustomerServiceInterface.cpp @@ -38,7 +38,7 @@ using namespace CSAssist; /////////////////////////////////////////////////////////////////////////////// CustomerServiceInterface::ClientInfo::ClientInfo() - : m_connection(NULL) + : m_connection(nullptr) , m_stationUserId(0) , m_ticketCount(-1) , m_pendingTicketCount(0) @@ -71,10 +71,10 @@ CustomerServiceInterface::~CustomerServiceInterface() delete m_japaneseCategoryList; delete m_clientConnectionMap; - m_clientConnectionMap = NULL; + m_clientConnectionMap = nullptr; delete m_suidToNetworkIdMap; - m_suidToNetworkIdMap = NULL; + m_suidToNetworkIdMap = nullptr; } //----------------------------------------------------------------------- @@ -97,8 +97,8 @@ void CustomerServiceInterface::OnConnectCSAssist( } m_connectionToBackEndEstablised = true; - m_englishCategoryTrack = requestGetIssueHierarchy(NULL, Unicode::narrowToWide("Default").data(), Unicode::narrowToWide("en").data());; - m_japaneseCategoryTrack = requestGetIssueHierarchy(NULL, Unicode::narrowToWide("Default").data(), Unicode::narrowToWide("ja").data());; + m_englishCategoryTrack = requestGetIssueHierarchy(nullptr, Unicode::narrowToWide("Default").data(), Unicode::narrowToWide("en").data());; + m_japaneseCategoryTrack = requestGetIssueHierarchy(nullptr, Unicode::narrowToWide("Default").data(), Unicode::narrowToWide("ja").data());; } } @@ -117,7 +117,7 @@ void CustomerServiceInterface::OnConnectRejectedCSAssist(const CSAssistGameAPITr void CustomerServiceInterface::parseIssueChild(CategoryList & categoryList, xmlNodePtr childPtr) { - static CustomerServiceCategory *currentCategory = NULL; + static CustomerServiceCategory *currentCategory = nullptr; xmlNodePtr child = childPtr->children; //start element @@ -142,19 +142,19 @@ void CustomerServiceInterface::parseIssueChild(CategoryList & categoryList, xmlN val = reinterpret_cast(xmlGetProp(childPtr, (const unsigned char *)"isBugType")); - bool const isBugType = (val != NULL) && (strcmp(val, "true") == 0); + bool const isBugType = (val != nullptr) && (strcmp(val, "true") == 0); // Check for service type val = reinterpret_cast(xmlGetProp(childPtr, (const unsigned char *)"isServiceType")); - bool const isServiceType = (val != NULL) && (strcmp(val, "true") == 0); + bool const isServiceType = (val != nullptr) && (strcmp(val, "true") == 0); // Check if valid val = reinterpret_cast(xmlGetProp(childPtr, (const unsigned char *)"invalid")); - bool const invalid = (val != NULL) && (strcmp(val, "true") == 0); + bool const invalid = (val != nullptr) && (strcmp(val, "true") == 0); if (!invalid) { @@ -187,9 +187,9 @@ void CustomerServiceInterface::parseIssueChild(CategoryList & categoryList, xmlN } } - while (child != NULL) + while (child != nullptr) { - if (child->name != NULL) + if (child->name != nullptr) { parseIssueChild(categoryList, child); } @@ -204,7 +204,7 @@ void CustomerServiceInterface::parseIssueChild(CategoryList & categoryList, xmlN if (currentCategory) { delete currentCategory; - currentCategory = NULL; + currentCategory = nullptr; } } @@ -215,13 +215,13 @@ void CustomerServiceInterface::parseIssueChild(CategoryList & categoryList, xmlN void CustomerServiceInterface::parseIssueHierarchy(CategoryList & categoryList, Unicode::String const & xmlData) { - xmlDocPtr xmlInfo = NULL; + xmlDocPtr xmlInfo = nullptr; Unicode::UTF8String xmlDataUtf8(Unicode::wideToUTF8(xmlData)); - if ((xmlInfo = xmlParseMemory(xmlDataUtf8.c_str(), xmlDataUtf8.length())) != NULL) + if ((xmlInfo = xmlParseMemory(xmlDataUtf8.c_str(), xmlDataUtf8.length())) != nullptr) { xmlNodePtr xmlCurrent = xmlDocGetRootElement(xmlInfo); - if (xmlCurrent != NULL) + if (xmlCurrent != nullptr) { parseIssueChild(categoryList, xmlCurrent); } @@ -247,7 +247,7 @@ void CustomerServiceInterface::OnGetIssueHierarchy( return; } - if (hierarchyBody != NULL) + if (hierarchyBody != nullptr) { if (track == m_englishCategoryTrack) { @@ -266,7 +266,7 @@ void CustomerServiceInterface::OnGetIssueHierarchy( } else { - LOG("CSServer", ("ERROR: NULL hierarchy returned from platform...why did this happen?", track, modifyData, result, getErrorString(result))); + LOG("CSServer", ("ERROR: nullptr hierarchy returned from platform...why did this happen?", track, modifyData, result, getErrorString(result))); } } @@ -282,9 +282,9 @@ void CustomerServiceInterface::OnCreateTicket( CreateTicketResponseMessage message(result, ticket); const NetworkId *tmpNetworkId = reinterpret_cast(userData); - LOG("CSServer", ("OnCreateTicket() track(%i) result(%i) (%s) networkId(%s) ticketId(%i)", track, result, getErrorString(result), (tmpNetworkId != NULL) ? tmpNetworkId->getValueString().c_str() : "NA", ticket)); + LOG("CSServer", ("OnCreateTicket() track(%i) result(%i) (%s) networkId(%s) ticketId(%i)", track, result, getErrorString(result), (tmpNetworkId != nullptr) ? tmpNetworkId->getValueString().c_str() : "NA", ticket)); - if (tmpNetworkId != NULL) + if (tmpNetworkId != nullptr) { if (result == CSASSIST_RESULT_SUCCESS) { @@ -296,7 +296,7 @@ void CustomerServiceInterface::OnCreateTicket( sendToClient(*tmpNetworkId, message); delete tmpNetworkId; - tmpNetworkId = NULL; + tmpNetworkId = nullptr; } } @@ -312,14 +312,14 @@ void CustomerServiceInterface::OnAppendTicketComment( AppendCommentResponseMessage message(result, ticket); const NetworkId *tmpNetworkId = reinterpret_cast(userData); - LOG("CSServer", ("OnAppendTicketComment() track(%i) result(%i) (%s) networkId(%s) ticketId(%i)", track, result, getErrorString(result), (tmpNetworkId != NULL) ? tmpNetworkId->getValueString().c_str() : "NA", ticket)); + LOG("CSServer", ("OnAppendTicketComment() track(%i) result(%i) (%s) networkId(%s) ticketId(%i)", track, result, getErrorString(result), (tmpNetworkId != nullptr) ? tmpNetworkId->getValueString().c_str() : "NA", ticket)); - if (tmpNetworkId != NULL) + if (tmpNetworkId != nullptr) { sendToClient(*tmpNetworkId, message); delete tmpNetworkId; - tmpNetworkId = NULL; + tmpNetworkId = nullptr; } } @@ -335,9 +335,9 @@ void CustomerServiceInterface::OnCancelTicket( CancelTicketResponseMessage message(result, ticket); const NetworkId *tmpNetworkId = reinterpret_cast(userData); - LOG("CSServer", ("OnCancelTicket() track(%i) result(%i) (%s) networkId(%s) ticketId(%i)", track, result, getErrorString(result), (tmpNetworkId != NULL) ? tmpNetworkId->getValueString().c_str() : "NA", ticket)); + LOG("CSServer", ("OnCancelTicket() track(%i) result(%i) (%s) networkId(%s) ticketId(%i)", track, result, getErrorString(result), (tmpNetworkId != nullptr) ? tmpNetworkId->getValueString().c_str() : "NA", ticket)); - if (tmpNetworkId != NULL) + if (tmpNetworkId != nullptr) { if (result == CSASSIST_RESULT_SUCCESS) { @@ -347,7 +347,7 @@ void CustomerServiceInterface::OnCancelTicket( sendToClient(*tmpNetworkId, message); delete tmpNetworkId; - tmpNetworkId = NULL; + tmpNetworkId = nullptr; } } @@ -378,9 +378,9 @@ void CustomerServiceInterface::OnGetTicketByCharacter( GetTicketsResponseMessage message(result, totalNumber, tickets); const NetworkId *tmpNetworkId = reinterpret_cast(userData); - LOG("CSServer", ("OnGetTicketByCharacter() track(%i) result(%i) (%s) networkId(%s) totalNumber(%i) numberReturned(%i)", track, result, getErrorString(result), (tmpNetworkId != NULL) ? tmpNetworkId->getValueString().c_str() : "NA", totalNumber, numberReturned)); + LOG("CSServer", ("OnGetTicketByCharacter() track(%i) result(%i) (%s) networkId(%s) totalNumber(%i) numberReturned(%i)", track, result, getErrorString(result), (tmpNetworkId != nullptr) ? tmpNetworkId->getValueString().c_str() : "NA", totalNumber, numberReturned)); - if (tmpNetworkId != NULL) + if (tmpNetworkId != nullptr) { // Save the number of tickets this player has @@ -396,7 +396,7 @@ void CustomerServiceInterface::OnGetTicketByCharacter( sendToClient(*tmpNetworkId, message); delete tmpNetworkId; - tmpNetworkId = NULL; + tmpNetworkId = nullptr; } } @@ -423,14 +423,14 @@ void CustomerServiceInterface::OnGetTicketComments( const NetworkId *tmpNetworkId = reinterpret_cast(userData); - LOG("CSServer", ("OnGetTicketComments() track(%i) result(%i) (%s) networkId(%s) numberRead(%i)", track, result, getErrorString(result), (tmpNetworkId != NULL) ? tmpNetworkId->getValueString().c_str() : "NA", numberRead)); + LOG("CSServer", ("OnGetTicketComments() track(%i) result(%i) (%s) networkId(%s) numberRead(%i)", track, result, getErrorString(result), (tmpNetworkId != nullptr) ? tmpNetworkId->getValueString().c_str() : "NA", numberRead)); - if (tmpNetworkId != NULL) + if (tmpNetworkId != nullptr) { sendToClient(*tmpNetworkId, message); delete tmpNetworkId; - tmpNetworkId = NULL; + tmpNetworkId = nullptr; } } @@ -455,14 +455,14 @@ void CustomerServiceInterface::OnSearchKB( SearchKnowledgeBaseResponseMessage message(result, searchResultsVector); const NetworkId *tmpNetworkId = reinterpret_cast(userData); - LOG("CSServer", ("OnSearchKB() track(%i) result(%i) (%s) networkId(%s) numberRead(%i)", track, result, getErrorString(result), (tmpNetworkId != NULL) ? tmpNetworkId->getValueString().c_str() : "NA", numberRead)); + LOG("CSServer", ("OnSearchKB() track(%i) result(%i) (%s) networkId(%s) numberRead(%i)", track, result, getErrorString(result), (tmpNetworkId != nullptr) ? tmpNetworkId->getValueString().c_str() : "NA", numberRead)); - if (tmpNetworkId != NULL) + if (tmpNetworkId != nullptr) { sendToClient(*tmpNetworkId, message); delete tmpNetworkId; - tmpNetworkId = NULL; + tmpNetworkId = nullptr; } } @@ -482,12 +482,12 @@ void CustomerServiceInterface::OnGetKBArticle( { GetArticleResponseMessage message(result, Unicode::String(articleBody)); const NetworkId *tmpNetworkId = reinterpret_cast(userData); - if (tmpNetworkId != NULL) + if (tmpNetworkId != nullptr) { sendToClient(*tmpNetworkId, message); delete tmpNetworkId; - tmpNetworkId = NULL; + tmpNetworkId = nullptr; } } } @@ -501,7 +501,7 @@ void CustomerServiceInterface::OnIssueHierarchyChanged( { LOG("CSServer", ("OnIssueHierarchyChanged()")); - requestGetIssueHierarchy(NULL, version, language); + requestGetIssueHierarchy(nullptr, version, language); } //----------------------------------------------------------------------- @@ -512,9 +512,9 @@ void CustomerServiceInterface::OnNewTicketActivity(const CSAssistGameAPITrack tr const NetworkId *tmpNetworkId = reinterpret_cast(userData); - LOG("CSServer", ("OnNewTicketActivity() track(%i) result(%i) (%s) networkId(%s) activity(%s) ticket count(%i)", track, result, getErrorString(result), (tmpNetworkId != NULL) ? tmpNetworkId->getValueString().c_str() : "NA", NewActivityFlag ? "yes" : "no", HasTickets)); + LOG("CSServer", ("OnNewTicketActivity() track(%i) result(%i) (%s) networkId(%s) activity(%s) ticket count(%i)", track, result, getErrorString(result), (tmpNetworkId != nullptr) ? tmpNetworkId->getValueString().c_str() : "NA", NewActivityFlag ? "yes" : "no", HasTickets)); - if (tmpNetworkId != NULL) + if (tmpNetworkId != nullptr) { // Save the number of tickets this player has @@ -530,7 +530,7 @@ void CustomerServiceInterface::OnNewTicketActivity(const CSAssistGameAPITrack tr sendToClient(*tmpNetworkId, message); delete tmpNetworkId; - tmpNetworkId = NULL; + tmpNetworkId = nullptr; } } @@ -540,12 +540,12 @@ void CustomerServiceInterface::OnMarkTicketRead(const CSAssistGameAPITrack track { const NetworkId *tmpNetworkId = reinterpret_cast(userData); - LOG("CSServer", ("OnMarkTicketRead() track(%i) result(%i) (%s) networkId(%s)", track, result, getErrorString(result), (tmpNetworkId != NULL) ? tmpNetworkId->getValueString().c_str() : "NA")); + LOG("CSServer", ("OnMarkTicketRead() track(%i) result(%i) (%s) networkId(%s)", track, result, getErrorString(result), (tmpNetworkId != nullptr) ? tmpNetworkId->getValueString().c_str() : "NA")); - if (tmpNetworkId != NULL) + if (tmpNetworkId != nullptr) { delete tmpNetworkId; - tmpNetworkId = NULL; + tmpNetworkId = nullptr; } } @@ -575,16 +575,16 @@ void CustomerServiceInterface::OnRegisterCharacter(const CSAssistGameAPITrack tr { const NetworkId *tmpNetworkId = reinterpret_cast(userData); - LOG("CSServer", ("OnRegisterCharacter() track(%i) result(%i) (%s) networkId(%s)", track, result, getErrorString(result), (tmpNetworkId != NULL) ? tmpNetworkId->getValueString().c_str() : "NA")); + LOG("CSServer", ("OnRegisterCharacter() track(%i) result(%i) (%s) networkId(%s)", track, result, getErrorString(result), (tmpNetworkId != nullptr) ? tmpNetworkId->getValueString().c_str() : "NA")); - if (tmpNetworkId != NULL) + if (tmpNetworkId != nullptr) { ConnectPlayerResponseMessage message(result); sendToClient(*tmpNetworkId, message); delete tmpNetworkId; - tmpNetworkId = NULL; + tmpNetworkId = nullptr; } } @@ -594,9 +594,9 @@ void CustomerServiceInterface::OnUnRegisterCharacter(const CSAssistGameAPITrack { const NetworkId *tmpNetworkId = reinterpret_cast(userData); - LOG("CSServer", ("OnUnRegisterCharacter() track(%i) result(%i) (%s) networkId(%s)", track, result, getErrorString(result), (tmpNetworkId != NULL) ? tmpNetworkId->getValueString().c_str() : "NA")); + LOG("CSServer", ("OnUnRegisterCharacter() track(%i) result(%i) (%s) networkId(%s)", track, result, getErrorString(result), (tmpNetworkId != nullptr) ? tmpNetworkId->getValueString().c_str() : "NA")); - if (tmpNetworkId != NULL) + if (tmpNetworkId != nullptr) { // If the player was successfully unregistered, remove the local cached reference @@ -606,7 +606,7 @@ void CustomerServiceInterface::OnUnRegisterCharacter(const CSAssistGameAPITrack } delete tmpNetworkId; - tmpNetworkId = NULL; + tmpNetworkId = nullptr; } } @@ -708,7 +708,7 @@ void CustomerServiceInterface::sendToClient(const NetworkId &player, const GameN } else { - LOG("CSServer", ("sendToClient() Connection is NULL: networkId(%s) cmdName(%s)", player.getValueString().c_str(), message.getCmdName().c_str())); + LOG("CSServer", ("sendToClient() Connection is nullptr: networkId(%s) cmdName(%s)", player.getValueString().c_str(), message.getCmdName().c_str())); } } else @@ -779,7 +779,7 @@ void CustomerServiceInterface::requestUnRegisterCharacter(const NetworkId &reque LOG("CSServer", ("requestUnRegisterCharacter() networkId(%s) suid(%i)", requester.getValueString().c_str(), suid)); NetworkId *tmpNetworkId = new NetworkId(requester); - CSAssistGameAPI::requestUnRegisterCharacter(reinterpret_cast(tmpNetworkId), suid, NULL); + CSAssistGameAPI::requestUnRegisterCharacter(reinterpret_cast(tmpNetworkId), suid, nullptr); } else { diff --git a/engine/server/application/CustomerServiceServer/src/shared/CustomerServiceServer.cpp b/engine/server/application/CustomerServiceServer/src/shared/CustomerServiceServer.cpp index 7beaacc5..fb4e7abe 100755 --- a/engine/server/application/CustomerServiceServer/src/shared/CustomerServiceServer.cpp +++ b/engine/server/application/CustomerServiceServer/src/shared/CustomerServiceServer.cpp @@ -49,7 +49,7 @@ namespace CustomerServiceServerNamespace using namespace CustomerServiceServerNamespace; -CustomerServiceServer *CustomerServiceServer::m_instance = NULL; +CustomerServiceServer *CustomerServiceServer::m_instance = nullptr; /////////////////////////////////////////////////////////////////////////////// // @@ -83,12 +83,12 @@ CustomerServiceServer::PendingTicket::PendingTicket() CustomerServiceServer::CustomerServiceServer() : m_callback(new MessageDispatch::Callback), -m_centralServerConnection(NULL), +m_centralServerConnection(nullptr), m_connectionServerSet(new ConnectionServerSet), m_done(false), m_csInterface(ConfigCustomerServiceServer::getCustomerServiceServerAddress(), ConfigCustomerServiceServer::getCustomerServiceServerPort(), ConfigCustomerServiceServer::getRequestTimeoutSeconds()), -m_gameServerService(NULL), -m_chatServerService(NULL), +m_gameServerService(nullptr), +m_chatServerService(nullptr), m_nextSequenceId(0), m_pendingTicketList(new PendingTicketList) { @@ -113,7 +113,7 @@ m_pendingTicketList(new PendingTicketList) m_csInterface.setMaxPacketsPerSecond(ConfigCustomerServiceServer::getMaxPacketsPerSecond()); - m_csInterface.connectCSAssist(NULL, + m_csInterface.connectCSAssist(nullptr, Unicode::narrowToWide(ConfigCustomerServiceServer::getGameCode()).data(), Unicode::narrowToWide(ConfigCustomerServiceServer::getClusterName()).data()); @@ -148,19 +148,19 @@ CustomerServiceServer::~CustomerServiceServer() m_centralServerConnection->disconnect(); delete m_callback; - m_callback = NULL; + m_callback = nullptr; delete m_connectionServerSet; - m_connectionServerSet = NULL; + m_connectionServerSet = nullptr; delete m_gameServerService; - m_gameServerService = NULL; + m_gameServerService = nullptr; delete m_chatServerService; - m_chatServerService = NULL; + m_chatServerService = nullptr; delete m_pendingTicketList; - m_pendingTicketList = NULL; + m_pendingTicketList = nullptr; MetricsManager::remove(); delete s_customerServiceServerMetricsData; @@ -233,7 +233,7 @@ void CustomerServiceServer::update() CustomerServiceServer &CustomerServiceServer::getInstance() { - if (m_instance == NULL) + if (m_instance == nullptr) { m_instance = new CustomerServiceServer; } @@ -405,7 +405,7 @@ void CustomerServiceServer::getTickets( NetworkId *tmpNetworkId = new NetworkId(requester); m_csInterface.requestGetTicketByCharacter( - reinterpret_cast(tmpNetworkId), suid, NULL, + reinterpret_cast(tmpNetworkId), suid, nullptr, start, count, markAsRead); } @@ -475,7 +475,7 @@ void CustomerServiceServer::requestNewTicketActivity(const NetworkId &requester, NetworkId *tmpNetworkId = new NetworkId(requester); - m_csInterface.requestNewTicketActivity(reinterpret_cast(tmpNetworkId), suid, NULL); + m_csInterface.requestNewTicketActivity(reinterpret_cast(tmpNetworkId), suid, nullptr); } //----------------------------------------------------------------------- @@ -497,7 +497,7 @@ void CustomerServiceServer::requestRegisterCharacter(const NetworkId &requester, LOG("CSServer", ("CustomerServiceInterface::requestRegisterCharacter() - networkId(%s) suid(%i)", requester.getValueString().c_str(), suid)); NetworkId *tmpNetworkId = new NetworkId(requester); - m_csInterface.requestRegisterCharacter(reinterpret_cast(tmpNetworkId), suid, NULL, 0); + m_csInterface.requestRegisterCharacter(reinterpret_cast(tmpNetworkId), suid, nullptr, 0); } } diff --git a/engine/server/application/LogServer/src/shared/LoggingServerApi.cpp b/engine/server/application/LogServer/src/shared/LoggingServerApi.cpp index 89591848..a6b9920f 100755 --- a/engine/server/application/LogServer/src/shared/LoggingServerApi.cpp +++ b/engine/server/application/LogServer/src/shared/LoggingServerApi.cpp @@ -23,16 +23,16 @@ LoggingServerApi::LoggingServerApi(LoggingServerHandler *handler, int queueSize) mLoginName[0] = 0; mPassword[0] = 0; mDefaultDirectory[0] = 0; - mConnection = NULL; - mUdpManager = NULL; - mTransaction = NULL; - mSessionId = int(time(NULL)); + mConnection = nullptr; + mUdpManager = nullptr; + mTransaction = nullptr; + mSessionId = int(time(nullptr)); mSessionSequence = 1; } LoggingServerApi::~LoggingServerApi() { - if (mTransaction != NULL) + if (mTransaction != nullptr) StopTransaction(); for (int i = 0; i < mQueueCount; i++) @@ -77,7 +77,7 @@ void LoggingServerApi::Connect(const char *address, int port, const char *loginN mUdpManager = new UdpManager(¶ms); mConnection = mUdpManager->EstablishConnection(address, port, 30000); - if (mConnection != NULL) + if (mConnection != nullptr) mConnection->SetHandler(this); mLoginSent = false; } @@ -89,17 +89,17 @@ void LoggingServerApi::Disconnect() mPassword[0] = 0; mDefaultDirectory[0] = 0; - if (mConnection != NULL) + if (mConnection != nullptr) { mConnection->Disconnect(); mConnection->Release(); - mConnection = NULL; + mConnection = nullptr; } - if (mUdpManager != NULL) + if (mUdpManager != nullptr) { mUdpManager->Release(); - mUdpManager = NULL; + mUdpManager = nullptr; } } @@ -119,7 +119,7 @@ void LoggingServerApi::Flush(int timeout) LoggingServerApi::Status LoggingServerApi::GetStatus() const { - if (mConnection != NULL) + if (mConnection != nullptr) { switch (mConnection->GetStatus()) { @@ -153,7 +153,7 @@ void LoggingServerApi::OnRoutePacket(UdpConnection *, const uchar *data, int) FlushQueue(); } - if (mHandler != NULL) + if (mHandler != nullptr) mHandler->LshOnLoginConfirm(mAuthenticated); break; } @@ -171,13 +171,13 @@ void LoggingServerApi::OnRoutePacket(UdpConnection *, const uchar *data, int) char *filename = ptr; ptr += strlen(ptr) + 1; char *message = ptr; - if (mHandler != NULL) + if (mHandler != nullptr) mHandler->LshOnMonitor(sessionId, sequenceNumber, name, filename, typeCode, message); break; } case cS2CPacketFileList: { - if (mHandler != NULL) + if (mHandler != nullptr) mHandler->LshOnFileList((char *)(data + 1)); break; } @@ -188,7 +188,7 @@ void LoggingServerApi::OnRoutePacket(UdpConnection *, const uchar *data, int) void LoggingServerApi::OnTerminated(UdpConnection *con) { - if(mHandler != NULL) + if(mHandler != nullptr) { mHandler->LshOnTerminated( con->GetDisconnectReason() ); } @@ -196,7 +196,7 @@ void LoggingServerApi::OnTerminated(UdpConnection *con) void LoggingServerApi::GiveTime() { - if (mConnection != NULL && mConnection->GetStatus() == UdpConnection::cStatusConnected) + if (mConnection != nullptr && mConnection->GetStatus() == UdpConnection::cStatusConnected) { if (!mLoginSent) { @@ -225,7 +225,7 @@ void LoggingServerApi::GiveTime() if (mQueue[spot].sentTime != 0 && UdpMisc::ClockElapsed(mQueue[spot].sentTime) > cSafetyQueueTime) { mQueue[spot].packet->Release(); - mQueue[spot].packet = NULL; + mQueue[spot].packet = nullptr; mQueuePosition++; mQueueCount--; } @@ -235,7 +235,7 @@ void LoggingServerApi::GiveTime() } } - if (mUdpManager != NULL) + if (mUdpManager != nullptr) { mUdpManager->GiveTime(); } @@ -243,17 +243,17 @@ void LoggingServerApi::GiveTime() void LoggingServerApi::StartTransaction() { - if (mTransaction == NULL) + if (mTransaction == nullptr) mTransaction = new GroupLogicalPacket(); } void LoggingServerApi::StopTransaction() { - if (mTransaction != NULL) + if (mTransaction != nullptr) { PacketSend(mTransaction); mTransaction->Release(); - mTransaction = NULL; + mTransaction = nullptr; } } @@ -264,7 +264,7 @@ void LoggingServerApi::PacketSend(LogicalPacket *lp) { int spot = mQueuePosition % mQueueSize; mQueue[spot].packet->Release(); - mQueue[spot].packet = NULL; + mQueue[spot].packet = nullptr; mQueuePosition++; mQueueCount--; } @@ -374,7 +374,7 @@ void LoggingServerApi::Log(const char *filename, int typeCode, const char *messa void LoggingServerApi::LogPacket(char *data, int len) { - if (mTransaction != NULL) + if (mTransaction != nullptr) { // add it to the transaction mTransaction->AddPacket(data, len); @@ -389,7 +389,7 @@ void LoggingServerApi::LogPacket(char *data, int len) LogicalPacket *LoggingServerApi::CreatePacket(char *data, int dataLen) { - if (mUdpManager != NULL) + if (mUdpManager != nullptr) { return(mUdpManager->CreatePacket(data, dataLen)); } @@ -440,7 +440,7 @@ void LoggingServerApi::GetStatistics(LoggingServerApiStatistics *stats) memset( stats, 0, sizeof( *stats) ); UdpConnectionStatistics udpConnectionStats; memset( &udpConnectionStats, 0, sizeof( udpConnectionStats ) ); - if( mConnection != NULL ) + if( mConnection != nullptr ) { mConnection->GetStats( &udpConnectionStats ); stats->applicationPacketsReceived = udpConnectionStats.applicationPacketsReceived; @@ -454,7 +454,7 @@ void LoggingServerApi::GetStatistics(LoggingServerApiStatistics *stats) } UdpManagerStatistics managerStats; - if( mUdpManager != NULL ) + if( mUdpManager != nullptr ) { mUdpManager->GetStats( &managerStats ); udp_int64 iterations = managerStats.iterations; diff --git a/engine/server/application/LoginServer/src/linux/main.cpp b/engine/server/application/LoginServer/src/linux/main.cpp index 7b4d7c1b..e08cb606 100755 --- a/engine/server/application/LoginServer/src/linux/main.cpp +++ b/engine/server/application/LoginServer/src/linux/main.cpp @@ -35,7 +35,7 @@ int main(int argc, char ** argv) SetupSharedFile::install(false); SetupSharedNetworkMessages::install(); - SetupSharedRandom::install(static_cast(time(NULL))); //lint !e1924 !e64 // NULL is a C-Style cast? + SetupSharedRandom::install(static_cast(time(nullptr))); //lint !e1924 !e64 // nullptr is a C-Style cast? Os::setProgramName("LoginServer"); //setup the server diff --git a/engine/server/application/LoginServer/src/shared/CSToolConnection.cpp b/engine/server/application/LoginServer/src/shared/CSToolConnection.cpp index 3da0b98b..7e10c623 100755 --- a/engine/server/application/LoginServer/src/shared/CSToolConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/CSToolConnection.cpp @@ -51,7 +51,7 @@ void CSToolConnection::validateCSTool(uint32 toolId, apiResult result, const api p_connection->m_bSecure = true; } - // if we have a null session type, then we aren't connected to the + // if we have a nullptr session type, then we aren't connected to the // Session Server and are in debug mode. // // if we *do* have a good session, then check the admin table for access level. @@ -71,7 +71,7 @@ void CSToolConnection::validateCSTool(uint32 toolId, apiResult result, const api bool canLogin = isInternal; // we always have to be internal. if (sessionNull) { - // null session means we can skip everything else. + // nullptr session means we can skip everything else. canLogin = canLogin && true; accessLevel = 100; } diff --git a/engine/server/application/LoginServer/src/shared/CentralServerConnection.cpp b/engine/server/application/LoginServer/src/shared/CentralServerConnection.cpp index 6b803038..2f096fce 100755 --- a/engine/server/application/LoginServer/src/shared/CentralServerConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/CentralServerConnection.cpp @@ -282,13 +282,13 @@ void CentralServerConnection::onReceive(const Archive::ByteStream & message) else if(m.isType("GcwScoreStatRaw")) { GenericValueTypeMessage >, std::map > > > > const msg(ri); - LoginServer::getInstance().sendToAllClusters(msg, NULL, 0, msg.getValue().first.c_str()); + LoginServer::getInstance().sendToAllClusters(msg, nullptr, 0, msg.getValue().first.c_str()); } else if(m.isType("GcwScoreStatPct")) { GenericValueTypeMessage, std::map > > > const msg(ri); - LoginServer::getInstance().sendToAllClusters(msg, NULL, 0, msg.getValue().first.c_str()); + LoginServer::getInstance().sendToAllClusters(msg, nullptr, 0, msg.getValue().first.c_str()); } } diff --git a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp index 087796db..6fe81a51 100755 --- a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp @@ -100,7 +100,7 @@ void ClientConnection::onReceive(const Archive::ByteStream & message) // client has an idea of how much difference there is between // the client's Epoch time and the server Epoch time GenericValueTypeMessage const serverNowEpochTime( - "ServerNowEpochTime", static_cast(::time(NULL))); + "ServerNowEpochTime", static_cast(::time(nullptr))); send(serverNowEpochTime, true); LoginClientId id(ri); @@ -202,7 +202,7 @@ void ClientConnection::validateClient(const std::string & id, const std::string LOG("LoginClientConnection", ("validateClient() for stationId (%lu) at IP (%s), id (%s) key (%s), skipping validating session", m_stationId, getRemoteAddress().c_str(), id.c_str(), key.c_str())); - LoginServer::getInstance().onValidateClient(suid, id, this, true, NULL, 0xFFFFFFFF, 0xFFFFFFFF); + LoginServer::getInstance().onValidateClient(suid, id, this, true, nullptr, 0xFFFFFFFF, 0xFFFFFFFF); } } diff --git a/engine/server/application/LoginServer/src/shared/ConsoleManager.cpp b/engine/server/application/LoginServer/src/shared/ConsoleManager.cpp index ecaaa8fa..8721d5c6 100755 --- a/engine/server/application/LoginServer/src/shared/ConsoleManager.cpp +++ b/engine/server/application/LoginServer/src/shared/ConsoleManager.cpp @@ -14,7 +14,7 @@ namespace ConsoleManagerNamespace { - ConsoleCommandParser * s_consoleCommandParserRoot = NULL; + ConsoleCommandParser * s_consoleCommandParserRoot = nullptr; } using namespace ConsoleManagerNamespace; diff --git a/engine/server/application/LoginServer/src/shared/LoginServer.cpp b/engine/server/application/LoginServer/src/shared/LoginServer.cpp index a38d3725..759331b4 100755 --- a/engine/server/application/LoginServer/src/shared/LoginServer.cpp +++ b/engine/server/application/LoginServer/src/shared/LoginServer.cpp @@ -130,7 +130,7 @@ LoginServer::LoginServer() : Singleton(), MessageDispatch::Receiver(), done(false), -m_centralService(NULL), +m_centralService(nullptr), clientService(0), pingService(0), keyServer(0), @@ -391,7 +391,7 @@ void LoginServer::receiveMessage(const MessageDispatch::Emitter & source, const { CentralServerConnection * connection = const_cast(safe_cast(&source)); DEBUG_REPORT_LOG(true, ("Cluster connection %s opened\n", msg.getClusterName().c_str())); - ClusterListEntry *cle=NULL; + ClusterListEntry *cle=nullptr; if (ConfigLoginServer::getDevelopmentMode()) { // in this mode, we trust the name sent by the cluster and we dynamically add clusters we don't know about @@ -410,7 +410,7 @@ void LoginServer::receiveMessage(const MessageDispatch::Emitter & source, const { WARNING(true,("Server %i is named \"%s\" in the database. The server at the specified address (%s:%hu) reports its name as \"%s\". It will not be allowed in the service. Either the name in the database or the name in Central's config file should be corrected.\n",cle->m_clusterId, cle->m_clusterName.c_str(), connection->getRemoteAddress().c_str(), connection->getRemotePort(), msg.getClusterName().c_str())); disconnectCluster(*cle,true,false); - cle=NULL; + cle=nullptr; } } @@ -589,7 +589,7 @@ void LoginServer::receiveMessage(const MessageDispatch::Emitter & source, const // for testing purpose when not using session authentication, store // the account feature Ids locally in memory, which will get cleared // (obviously) when the LoginServer is restarted - std::map > * nonSessionTestingAccountFeatureIds = NULL; + std::map > * nonSessionTestingAccountFeatureIds = nullptr; if (msg.getGameCode() == PlatformGameCode::SWG) nonSessionTestingAccountFeatureIds = &s_nonSessionTestingAccountSwgFeatureIds; else if (msg.getGameCode() == PlatformGameCode::SWGTCG) @@ -648,7 +648,7 @@ void LoginServer::receiveMessage(const MessageDispatch::Emitter & source, const // for testing purpose when not using session authentication, store // the account feature Ids locally in memory, which will get cleared // (obviously) when the LoginServer is restarted - std::map > * nonSessionTestingAccountFeatureIds = NULL; + std::map > * nonSessionTestingAccountFeatureIds = nullptr; if (msg.getGameCode() == PlatformGameCode::SWG) nonSessionTestingAccountFeatureIds = &s_nonSessionTestingAccountSwgFeatureIds; else if (msg.getGameCode() == PlatformGameCode::SWGTCG) @@ -826,7 +826,7 @@ void LoginServer::receiveMessage(const MessageDispatch::Emitter & source, const const CentralServerConnection *conn = dynamic_cast(&source); if (conn) - DatabaseConnection::getInstance().renameCharacter(conn->getClusterId(), msg.getCharacterId(), msg.getNewName(), NULL); + DatabaseConnection::getInstance().renameCharacter(conn->getClusterId(), msg.getCharacterId(), msg.getNewName(), nullptr); else WARNING_STRICT_FATAL(true,("Got RenameCharacterMessage from something other than CentralServerConnection.\n")); } @@ -1461,11 +1461,11 @@ LoginServer::ClusterListEntry *LoginServer::findClusterByName(const std::string ClusterListType::iterator i; for (i=m_clusterList.begin(); i!=m_clusterList.end(); ++i) { - NOT_NULL(*i); // not legal to push null pointers on the vector + NOT_NULL(*i); // not legal to push nullptr pointers on the vector if ((*i)->m_clusterName == clusterName) return *i; } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -1555,7 +1555,7 @@ void LoginServer::sendClusterStatus(ClientConnection &conn) const // 5) Cluster has told us its ready for players if (cle && cle->m_clusterId!=0 && cle->m_connected && !cle->m_connectionServers.empty() && (clientIsPrivate || !cle->m_secret)) { - DEBUG_FATAL(!cle->m_centralServerConnection,("Programmer bug: m_connected was true but m_centralServerConnection was NULL\n")); + DEBUG_FATAL(!cle->m_centralServerConnection,("Programmer bug: m_connected was true but m_centralServerConnection was nullptr\n")); LoginClusterStatus::ClusterData item; item.m_clusterId = cle->m_clusterId; item.m_timeZone = cle->m_timeZone; @@ -1840,12 +1840,12 @@ LoginServer::ClusterListEntry * LoginServer::findClusterById(uint32 clusterId) ClusterListType::const_iterator i; for (i=m_clusterList.begin(); i!=m_clusterList.end(); ++i) { - NOT_NULL(*i); // not legal to push null pointers on the vector + NOT_NULL(*i); // not legal to push nullptr pointers on the vector if ((*i)->m_clusterId == clusterId) return *i; } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -1859,12 +1859,12 @@ LoginServer::ClusterListEntry * LoginServer::findClusterByConnection(const Centr ClusterListType::const_iterator i; for (i=m_clusterList.begin(); i!=m_clusterList.end(); ++i) { - NOT_NULL(*i); // not legal to push null pointers on the vector + NOT_NULL(*i); // not legal to push nullptr pointers on the vector if ((*i)->m_centralServerConnection == connection) return *i; } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -1908,12 +1908,12 @@ void LoginServer::setDone(const bool isDone) // ---------------------------------------------------------------------- -void LoginServer::sendToAllClusters(GameNetworkMessage const & message, Connection const * excludeCentralConnection /*= NULL*/, uint32 excludeClusterId /*= 0*/, char const * excludeClusterName /*= NULL*/) +void LoginServer::sendToAllClusters(GameNetworkMessage const & message, Connection const * excludeCentralConnection /*= nullptr*/, uint32 excludeClusterId /*= 0*/, char const * excludeClusterName /*= nullptr*/) { ClusterListType::const_iterator i; for (i=m_clusterList.begin(); i!=m_clusterList.end(); ++i) { - if (NON_NULL(*i)->m_connected && (*i)->m_centralServerConnection && ((*i)->m_centralServerConnection != excludeCentralConnection) && ((*i)->m_clusterId != excludeClusterId) && ((excludeClusterName == NULL) || _stricmp(excludeClusterName, (*i)->m_centralServerConnection->getClusterName().c_str()))) + if (NON_NULL(*i)->m_connected && (*i)->m_centralServerConnection && ((*i)->m_centralServerConnection != excludeCentralConnection) && ((*i)->m_clusterId != excludeClusterId) && ((excludeClusterName == nullptr) || _stricmp(excludeClusterName, (*i)->m_centralServerConnection->getClusterName().c_str()))) (*i)->m_centralServerConnection->send(message,true); } } diff --git a/engine/server/application/LoginServer/src/shared/LoginServer.h b/engine/server/application/LoginServer/src/shared/LoginServer.h index a284068e..f1d4de5b 100755 --- a/engine/server/application/LoginServer/src/shared/LoginServer.h +++ b/engine/server/application/LoginServer/src/shared/LoginServer.h @@ -64,7 +64,7 @@ public: void validateAccount (const StationId& stationId, uint32 clusterId, uint32 subscriptionBits, bool canCreateRegular, bool canCreateJedi, bool canSkipTutorial, unsigned int track, std::vector > const & consumedRewardEvents, std::vector > const & claimedRewardItems); void validateAccountForTransfer(const TransferRequestMoveValidation & request, uint32 clusterId, uint32 sourceCharacterTemplateId, bool canCreateRegular, bool canCreateJedi); void sendToCluster (uint32 clusterId, const GameNetworkMessage &message); - void sendToAllClusters (GameNetworkMessage const & message, Connection const * excludeCentralConnection = NULL, uint32 excludeClusterId = 0, char const * excludeClusterName = NULL); + void sendToAllClusters (GameNetworkMessage const & message, Connection const * excludeCentralConnection = nullptr, uint32 excludeClusterId = 0, char const * excludeClusterName = nullptr); bool areAllClustersUp () const; void getClusterIds (stdvector::fwd result); void performAccountTransfer (const AvatarList &avatars, TransferAccountData * transferAccountData); diff --git a/engine/server/application/LoginServer/src/shared/SessionApiClient.cpp b/engine/server/application/LoginServer/src/shared/SessionApiClient.cpp index f130d691..73ff91ae 100755 --- a/engine/server/application/LoginServer/src/shared/SessionApiClient.cpp +++ b/engine/server/application/LoginServer/src/shared/SessionApiClient.cpp @@ -435,7 +435,7 @@ void SessionApiClient::NotifySessionKick(const char ** sessionList, void SessionApiClient::checkStatusForPurge(StationId account) { - GetAccountSubscription(account, PlatformGameCode::SWG, NULL); + GetAccountSubscription(account, PlatformGameCode::SWG, nullptr); } //------------------------------------------------------------------------------------------ diff --git a/engine/server/application/LoginServer/src/shared/TaskCreateCharacter.cpp b/engine/server/application/LoginServer/src/shared/TaskCreateCharacter.cpp index 6e8ed6d4..243f3c71 100755 --- a/engine/server/application/LoginServer/src/shared/TaskCreateCharacter.cpp +++ b/engine/server/application/LoginServer/src/shared/TaskCreateCharacter.cpp @@ -58,7 +58,7 @@ void TaskCreateCharacter::onComplete() // let all other galaxies know that a new character has been created for the station account GenericValueTypeMessage const ncc("NewCharacterCreated", m_stationId); - LoginServer::getInstance().sendToAllClusters(ncc, NULL, m_clusterId); + LoginServer::getInstance().sendToAllClusters(ncc, nullptr, m_clusterId); } // ====================================================================== diff --git a/engine/server/application/LoginServer/src/shared/TaskGetCharactersForDelete.cpp b/engine/server/application/LoginServer/src/shared/TaskGetCharactersForDelete.cpp index 5259daf4..3cc49cef 100755 --- a/engine/server/application/LoginServer/src/shared/TaskGetCharactersForDelete.cpp +++ b/engine/server/application/LoginServer/src/shared/TaskGetCharactersForDelete.cpp @@ -14,7 +14,7 @@ // ====================================================================== TaskGetCharactersForDelete::TaskGetCharactersForDelete (StationId stationId, int clusterGroupId) : - TaskGetAvatarList(stationId, clusterGroupId, NULL) + TaskGetAvatarList(stationId, clusterGroupId, nullptr) { } diff --git a/engine/server/application/MetricsServer/src/linux/main.cpp b/engine/server/application/MetricsServer/src/linux/main.cpp index 2287e9de..d4a429d8 100755 --- a/engine/server/application/MetricsServer/src/linux/main.cpp +++ b/engine/server/application/MetricsServer/src/linux/main.cpp @@ -40,7 +40,7 @@ int main(int argc, char ** argv) SetupSharedNetwork::getDefaultServerSetupData(networkSetupData); SetupSharedNetwork::install(networkSetupData); - SetupSharedRandom::install(static_cast(time(NULL))); //lint !e1924 !e64 // NULL is a C-Style cast? + SetupSharedRandom::install(static_cast(time(nullptr))); //lint !e1924 !e64 // nullptr is a C-Style cast? Os::setProgramName("MetricsServer"); //setup the server diff --git a/engine/server/application/MetricsServer/src/shared/MetricsGatheringConnection.cpp b/engine/server/application/MetricsServer/src/shared/MetricsGatheringConnection.cpp index 4cab5ae6..dd398ff2 100755 --- a/engine/server/application/MetricsServer/src/shared/MetricsGatheringConnection.cpp +++ b/engine/server/application/MetricsServer/src/shared/MetricsGatheringConnection.cpp @@ -169,19 +169,19 @@ void MetricsGatheringConnection::update(const std::vector & data) //note: we know that the "isSecret", and "isLocked" nodes will come after the "population" node in the list // we are iterating over, so they will override the population setting - if (strstr((*dataIter).m_label.c_str(), "population") != NULL) + if (strstr((*dataIter).m_label.c_str(), "population") != nullptr) { // there are nodes under the population node, so don't interpret them as the population - if (strstr((*dataIter).m_label.c_str(), "population.") == NULL) + if (strstr((*dataIter).m_label.c_str(), "population.") == nullptr) mon->set(MetricsServer::getWorldCountChannel(), std::max((*dataIter).m_value, 0)); } - else if (strstr((*dataIter).m_label.c_str(), "isSecret") != NULL - || strstr((*dataIter).m_label.c_str(), "isLocked") != NULL) + else if (strstr((*dataIter).m_label.c_str(), "isSecret") != nullptr + || strstr((*dataIter).m_label.c_str(), "isLocked") != nullptr) { if ((*dataIter).m_value == 1) mon->set(MetricsServer::getWorldCountChannel(), STATUS_LOCKED); } - else if (strstr((*dataIter).m_label.c_str(), "isLoading") != NULL) + else if (strstr((*dataIter).m_label.c_str(), "isLoading") != nullptr) { // include in the root node description how // long the cluster has been loading @@ -226,19 +226,19 @@ void MetricsGatheringConnection::update(const std::vector & data) //note: we know that the "isSecret", and "isLocked" nodes will come after the "population" node in the list // we are iterating over, so they will override the population setting - if (strstr((*dataIter).m_label.c_str(), "population") != NULL) + if (strstr((*dataIter).m_label.c_str(), "population") != nullptr) { // there are nodes under the population node, so don't interpret them as the population - if (strstr((*dataIter).m_label.c_str(), "population.") == NULL) + if (strstr((*dataIter).m_label.c_str(), "population.") == nullptr) mon->set(MetricsServer::getWorldCountChannel(), std::max((*dataIter).m_value, 0)); } - else if (strstr((*dataIter).m_label.c_str(), "isSecret") != NULL - || strstr((*dataIter).m_label.c_str(), "isLocked") != NULL) + else if (strstr((*dataIter).m_label.c_str(), "isSecret") != nullptr + || strstr((*dataIter).m_label.c_str(), "isLocked") != nullptr) { if ((*dataIter).m_value == 1) mon->set(MetricsServer::getWorldCountChannel(), STATUS_LOCKED); } - else if (strstr((*dataIter).m_label.c_str(), "isLoading") != NULL) + else if (strstr((*dataIter).m_label.c_str(), "isLoading") != nullptr) { // include in the root node description how // long the cluster has been loading diff --git a/engine/server/application/MetricsServer/src/shared/MetricsServer.cpp b/engine/server/application/MetricsServer/src/shared/MetricsServer.cpp index 9754caca..aab52220 100755 --- a/engine/server/application/MetricsServer/src/shared/MetricsServer.cpp +++ b/engine/server/application/MetricsServer/src/shared/MetricsServer.cpp @@ -29,8 +29,8 @@ std::string MetricsServer::m_worldCountChannelDescription; bool MetricsServer::m_done = false; Service* MetricsServer::m_metricsService; CMonitorAPI * MetricsServer::m_soeMonitor; -Service * MetricsServer::ms_service = NULL; -TaskConnection * MetricsServer::ms_taskConnection = NULL; +Service * MetricsServer::ms_service = nullptr; +TaskConnection * MetricsServer::ms_taskConnection = nullptr; //---------------------------------------------------------------- diff --git a/engine/server/application/PlanetServer/src/linux/main.cpp b/engine/server/application/PlanetServer/src/linux/main.cpp index d77747cf..7d8b5908 100755 --- a/engine/server/application/PlanetServer/src/linux/main.cpp +++ b/engine/server/application/PlanetServer/src/linux/main.cpp @@ -46,7 +46,7 @@ int main(int argc, char ** argv) SetupSharedNetworkMessages::install(); - SetupSharedRandom::install(time(NULL)); //lint !e732 loss of sign (of 0!) + SetupSharedRandom::install(time(nullptr)); //lint !e732 loss of sign (of 0!) SetupSharedUtility::Data sharedUtilityData; SetupSharedUtility::setupGameData (sharedUtilityData); diff --git a/engine/server/application/PlanetServer/src/shared/ConsoleCommandParser.cpp b/engine/server/application/PlanetServer/src/shared/ConsoleCommandParser.cpp index b5839b87..4a3fec7d 100755 --- a/engine/server/application/PlanetServer/src/shared/ConsoleCommandParser.cpp +++ b/engine/server/application/PlanetServer/src/shared/ConsoleCommandParser.cpp @@ -31,7 +31,7 @@ const CommandParser::CmdInfo cmds[] = //----------------------------------------------------------------------- ConsoleCommandParser::ConsoleCommandParser() : -CommandParser ("", 0, "...", "console commands", NULL) +CommandParser ("", 0, "...", "console commands", nullptr) { createDelegateCommands(cmds); } diff --git a/engine/server/application/PlanetServer/src/shared/ConsoleManager.cpp b/engine/server/application/PlanetServer/src/shared/ConsoleManager.cpp index 2326cbf2..4a94be0c 100755 --- a/engine/server/application/PlanetServer/src/shared/ConsoleManager.cpp +++ b/engine/server/application/PlanetServer/src/shared/ConsoleManager.cpp @@ -14,7 +14,7 @@ namespace ConsoleManagerNamespace { - ConsoleCommandParser * s_consoleCommandParserRoot = NULL; + ConsoleCommandParser * s_consoleCommandParserRoot = nullptr; } using namespace ConsoleManagerNamespace; diff --git a/engine/server/application/PlanetServer/src/shared/GameServerData.cpp b/engine/server/application/PlanetServer/src/shared/GameServerData.cpp index 58a57f31..e7e91d59 100755 --- a/engine/server/application/PlanetServer/src/shared/GameServerData.cpp +++ b/engine/server/application/PlanetServer/src/shared/GameServerData.cpp @@ -27,7 +27,7 @@ GameServerData::GameServerData(GameServerConnection *connection) : // ---------------------------------------------------------------------- GameServerData::GameServerData(const GameServerData &rhs) : - m_connection(NULL), // connection pointer is not copied when we copy GameServerDatas + m_connection(nullptr), // connection pointer is not copied when we copy GameServerDatas m_objectCount(rhs.m_objectCount), m_interestObjectCount(rhs.m_interestObjectCount), m_interestCreatureObjectCount(rhs.m_interestCreatureObjectCount), @@ -38,7 +38,7 @@ GameServerData::GameServerData(const GameServerData &rhs) : // ---------------------------------------------------------------------- GameServerData::GameServerData() : - m_connection(NULL), + m_connection(nullptr), m_objectCount(0), m_interestObjectCount(0), m_interestCreatureObjectCount(0), @@ -53,7 +53,7 @@ GameServerData &GameServerData::operator=(const GameServerData &rhs) if (&rhs == this) return *this; - m_connection=NULL; // connection pointer is not copied when we copy GameServerDatas + m_connection=nullptr; // connection pointer is not copied when we copy GameServerDatas m_objectCount=rhs.m_objectCount; m_interestObjectCount=rhs.m_interestObjectCount; m_interestCreatureObjectCount=rhs.m_interestCreatureObjectCount; diff --git a/engine/server/application/PlanetServer/src/shared/PlanetProxyObject.cpp b/engine/server/application/PlanetServer/src/shared/PlanetProxyObject.cpp index 0fff2eb7..b2d9cf79 100755 --- a/engine/server/application/PlanetServer/src/shared/PlanetProxyObject.cpp +++ b/engine/server/application/PlanetServer/src/shared/PlanetProxyObject.cpp @@ -41,9 +41,9 @@ PlanetProxyObject::PlanetProxyObject (const NetworkId &objectId) : m_authoritativeServer(0), m_lastReportedServer(0), m_interestRadius(0), - m_quadtreeNode(NULL), + m_quadtreeNode(nullptr), m_authTransferTimeMs(Clock::timeMs()), - m_contents(NULL), + m_contents(nullptr), m_level(0), m_hibernating(false), m_templateCrc(0), @@ -137,9 +137,9 @@ void PlanetProxyObject::update(int x, int y, int z, NetworkId containedBy, uint3 if (ConfigPlanetServer::getEnableContentsChecking() && (m_containedBy!=containedBy)) updateContentsTracking(containedBy); - bool const firstUpdate = (m_quadtreeNode == NULL); + bool const firstUpdate = (m_quadtreeNode == nullptr); - if (m_quadtreeNode!=NULL) // if this is the first update for this object, m_quadtreeNode will be NULL because it hasn't been placed anywhere yet + if (m_quadtreeNode!=nullptr) // if this is the first update for this object, m_quadtreeNode will be nullptr because it hasn't been placed anywhere yet { removeServerStatistics(); diff --git a/engine/server/application/PlanetServer/src/shared/PlanetServer.cpp b/engine/server/application/PlanetServer/src/shared/PlanetServer.cpp index d69a029c..a76929ce 100755 --- a/engine/server/application/PlanetServer/src/shared/PlanetServer.cpp +++ b/engine/server/application/PlanetServer/src/shared/PlanetServer.cpp @@ -102,12 +102,12 @@ using namespace PlanetServerNamespace; PlanetServer::PlanetServer() : Singleton(), MessageDispatch::Receiver(), - m_pendingCentralServerConnection(NULL), - m_centralServerConnection(NULL), - m_gameService(NULL), - m_watcherService(NULL), + m_pendingCentralServerConnection(nullptr), + m_centralServerConnection(nullptr), + m_gameService(nullptr), + m_watcherService(nullptr), m_gameServers(), - m_taskConnection(NULL), + m_taskConnection(nullptr), m_done(false), m_roundRobinGameServer(0), m_pendingServerStarts(new std::map()), @@ -117,7 +117,7 @@ PlanetServer::PlanetServer() : m_spaceMode(false), m_messagesWaitingForGameServer(), m_metricsData(0), - m_taskManagerConnection(NULL), + m_taskManagerConnection(nullptr), m_sceneTransferChunkLoads(new std::list), m_pendingCharacterSaves(new std::map), m_watchers(), @@ -433,7 +433,7 @@ void PlanetServer::receiveMessage(const MessageDispatch::Emitter & source, const GameServerConnection *gameServer=const_cast(dynamic_cast(&source)); std::set::iterator f = m_pendingGameServerDisconnects.find(gameServer); - WARNING_DEBUG_FATAL(gameServer==0,("Source was NULL or source was not a GameServerConnection.")); + WARNING_DEBUG_FATAL(gameServer==0,("Source was nullptr or source was not a GameServerConnection.")); DEBUG_REPORT_LOG(true, ("removing crashed gameserver\n")); uint32 id = gameServer->getProcessId(); GameServerMapType::iterator i=m_gameServers.find(id); @@ -688,7 +688,7 @@ void PlanetServer::receiveMessage(const MessageDispatch::Emitter & source, const UnloadedPlayerMessage msg(ri); GameServerConnection *gameServer=const_cast(dynamic_cast(&source)); - WARNING_DEBUG_FATAL(gameServer==0,("Source was NULL or source was not a GameServerConnection.")); + WARNING_DEBUG_FATAL(gameServer==0,("Source was nullptr or source was not a GameServerConnection.")); uint32 gameServerId = gameServer->getProcessId(); (*m_pendingCharacterSaves)[msg.getPlayerId()]=gameServerId; @@ -766,19 +766,19 @@ void PlanetServer::receiveMessage(const MessageDispatch::Emitter & source, const GameServerData * fromServer = PlanetServer::getGameServerData(msg.getFromProcess()); GameServerData * toServer = PlanetServer::getGameServerData(msg.getToProcess()); PlanetProxyObject * object = Scene::getInstance().findObjectByID(msg.getId()); - if (fromServer == NULL || toServer == NULL || object == NULL) + if (fromServer == nullptr || toServer == nullptr || object == nullptr) { - if (fromServer == NULL) + if (fromServer == nullptr) { WARNING(true, ("Message GameServerForceChangeAuthorityMessage: no " "from server %lu", msg.getFromProcess())); } - if (toServer == NULL) + if (toServer == nullptr) { WARNING(true, ("Message GameServerForceChangeAuthorityMessage: no " "to server %lu", msg.getToProcess())); } - if (object == NULL) + if (object == nullptr) { WARNING(true, ("Message GameServerForceChangeAuthorityMessage: no " "object for id %s", msg.getId().getValueString().c_str())); @@ -914,7 +914,7 @@ void PlanetServer::receiveMessage(const MessageDispatch::Emitter & source, const { // if it's been "awhile" since we requested to restart the GameServer, // then assume that something has gone wrong, and try the restart again - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); for (std::map >::iterator iter = m_startingGameServers->begin(); iter != m_startingGameServers->end(); ++iter) { @@ -1005,7 +1005,7 @@ GameServerConnection *PlanetServer::getGameServerConnection(uint32 serverId) if (i!=m_gameServers.end()) return (*i).second->getConnection(); else - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -1290,7 +1290,7 @@ void PlanetServer::startGameServer(const std::set & preloadServ TaskSpawnProcess spawn("any", "SwgGameServer", options, i->second); if (m_centralServerConnection) { - (*m_startingGameServers)[cookie] = std::make_pair(options, ::time(NULL)); + (*m_startingGameServers)[cookie] = std::make_pair(options, ::time(nullptr)); ++cookie; m_centralServerConnection->send(spawn,true); DEBUG_REPORT_LOG(true, ("Sent start gameserver request for scene %s\n", ConfigPlanetServer::getSceneID())); @@ -1321,7 +1321,7 @@ GameServerData *PlanetServer::getGameServerData(uint32 serverId) const if (i!=m_gameServers.end()) return i->second; else - return NULL; + return nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/application/PlanetServer/src/shared/PlanetServer.h b/engine/server/application/PlanetServer/src/shared/PlanetServer.h index cf457544..7a75e4fc 100755 --- a/engine/server/application/PlanetServer/src/shared/PlanetServer.h +++ b/engine/server/application/PlanetServer/src/shared/PlanetServer.h @@ -146,7 +146,7 @@ inline int PlanetServer::getNumberOfGameServers() const inline void PlanetServer::onCentralConnected(CentralServerConnection *connection) { - m_pendingCentralServerConnection=NULL; + m_pendingCentralServerConnection=nullptr; m_centralServerConnection=connection; } diff --git a/engine/server/application/PlanetServer/src/shared/PreloadManager.cpp b/engine/server/application/PlanetServer/src/shared/PreloadManager.cpp index 37371536..15811eeb 100755 --- a/engine/server/application/PlanetServer/src/shared/PreloadManager.cpp +++ b/engine/server/application/PlanetServer/src/shared/PreloadManager.cpp @@ -119,7 +119,7 @@ void PreloadManager::handlePreloadList() if (PlanetServer::getInstance().getEnablePreload()) { DataTable * data = DataTableManager::getTable(ConfigPlanetServer::getPreloadDataTableName(),true); - FATAL(data==NULL,("Could not find data table %s, needed for preload",ConfigPlanetServer::getPreloadDataTableName())); + FATAL(data==nullptr,("Could not find data table %s, needed for preload",ConfigPlanetServer::getPreloadDataTableName())); int numRows = data->getNumRows(); for (int row=0; row(&source); - WARNING_DEBUG_FATAL(gameServer==0,("Source was NULL or source was not a GameServerConnection.")); + WARNING_DEBUG_FATAL(gameServer==0,("Source was nullptr or source was not a GameServerConnection.")); if (message.isType("GameConnectionClosed")) { @@ -216,7 +216,7 @@ Node *Scene::findNodeByPosition(int x, int z) /** * Given coordinates, return a const pointer to the node that encloses - * those coordinates. Will not create new nodes, so it may return NULL. + * those coordinates. Will not create new nodes, so it may return nullptr. */ const Node *Scene::findNodeByPositionConst(int x, int z) const { @@ -245,7 +245,7 @@ Node *Scene::findNodeByRoundedPosition(int x, int z) /** * Given coordinates that are known to be a node boundary, return a const pointer - * to the node. Does not create new nodes, so may return NULL. + * to the node. Does not create new nodes, so may return nullptr. */ const Node *Scene::findNodeByRoundedPositionConst(int x, int z) const { @@ -254,7 +254,7 @@ const Node *Scene::findNodeByRoundedPositionConst(int x, int z) const if (i!=m_nodeMap.end()) return (*i).second; else - return NULL; + return nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/application/StationPlayersCollector/src/linux/main.cpp b/engine/server/application/StationPlayersCollector/src/linux/main.cpp index 7112ccde..d2abdabf 100755 --- a/engine/server/application/StationPlayersCollector/src/linux/main.cpp +++ b/engine/server/application/StationPlayersCollector/src/linux/main.cpp @@ -35,7 +35,7 @@ int main(int argc, char ** argv) SetupSharedFile::install(false); SetupSharedNetworkMessages::install(); - SetupSharedRandom::install(static_cast(time(NULL))); //lint !e1924 !e64 // NULL is a C-Style cast? + SetupSharedRandom::install(static_cast(time(nullptr))); //lint !e1924 !e64 // nullptr is a C-Style cast? Os::setProgramName("StationPlayersCollector"); diff --git a/engine/server/application/TaskManager/src/linux/ConsoleInput.cpp b/engine/server/application/TaskManager/src/linux/ConsoleInput.cpp index a0d4580c..756bd237 100755 --- a/engine/server/application/TaskManager/src/linux/ConsoleInput.cpp +++ b/engine/server/application/TaskManager/src/linux/ConsoleInput.cpp @@ -22,7 +22,7 @@ struct SetBufferMode SetBufferMode::SetBufferMode() { - setvbuf(stdin, NULL, _IONBF, 0); + setvbuf(stdin, nullptr, _IONBF, 0); } //----------------------------------------------------------------------- diff --git a/engine/server/application/TaskManager/src/linux/ProcessSpawner.cpp b/engine/server/application/TaskManager/src/linux/ProcessSpawner.cpp index 3996480b..e63ffd6b 100755 --- a/engine/server/application/TaskManager/src/linux/ProcessSpawner.cpp +++ b/engine/server/application/TaskManager/src/linux/ProcessSpawner.cpp @@ -92,7 +92,7 @@ void makeParameters(const std::vector & parameters, std::vector(time(NULL))); //lint !e1924 !e64 // NULL is a C-Style cast? + SetupSharedRandom::install(static_cast(time(nullptr))); //lint !e1924 !e64 // nullptr is a C-Style cast? Os::setProgramName("TaskManager"); //setup the server diff --git a/engine/server/application/TaskManager/src/shared/GameConnection.cpp b/engine/server/application/TaskManager/src/shared/GameConnection.cpp index d297a6dd..baa6adfb 100755 --- a/engine/server/application/TaskManager/src/shared/GameConnection.cpp +++ b/engine/server/application/TaskManager/src/shared/GameConnection.cpp @@ -89,7 +89,7 @@ void GameConnection::receive(const Archive::ByteStream & message) char filename[30]; snprintf(filename, sizeof(filename)-1, "/proc/%lu/cmdline", m_pid); - // format of the cmdline file is a NULL separates every + // format of the cmdline file is a nullptr separates every // parameter, so we'll have to replace the NULLs with spaces FILE *inFile = fopen(filename,"rb"); if (inFile) diff --git a/engine/server/application/TaskManager/src/shared/Locator.cpp b/engine/server/application/TaskManager/src/shared/Locator.cpp index 994d2184..2dac97f8 100755 --- a/engine/server/application/TaskManager/src/shared/Locator.cpp +++ b/engine/server/application/TaskManager/src/shared/Locator.cpp @@ -25,11 +25,11 @@ namespace LocatorNamespace float getConfigSetting(const char *section, const char *key, const float defaultValue) { const ConfigFile::Section * sec = ConfigFile::getSection(section); - if (sec == NULL) + if (sec == nullptr) return defaultValue; const ConfigFile::Key * ky = sec->findKey(key); - if (ky == NULL) + if (ky == nullptr) return defaultValue; return ky->getAsFloat(ky->getCount()-1, defaultValue); @@ -364,7 +364,7 @@ void Locator::opened(std::string const &label, ManagerConnection *newConnection) TaskManager::runSpawnRequestQueue(); } else - WARNING_STRICT_FATAL(true, ("Passed null connection to Locator::opened")); + WARNING_STRICT_FATAL(true, ("Passed nullptr connection to Locator::opened")); } // ---------------------------------------------------------------------- diff --git a/engine/server/application/TaskManager/src/shared/ManagerConnection.cpp b/engine/server/application/TaskManager/src/shared/ManagerConnection.cpp index 3720de92..08807765 100755 --- a/engine/server/application/TaskManager/src/shared/ManagerConnection.cpp +++ b/engine/server/application/TaskManager/src/shared/ManagerConnection.cpp @@ -98,7 +98,7 @@ void ManagerConnection::onReceive(const Archive::ByteStream & message) r = message.begin(); if (m.isType("SystemTimeCheck")) { - long const currentTime = static_cast(::time(NULL)); + long const currentTime = static_cast(::time(nullptr)); GenericValueTypeMessage > msg(r); if (TaskManager::getNodeLabel() == "node0") @@ -117,7 +117,7 @@ void ManagerConnection::onReceive(const Archive::ByteStream & message) else if (m.isType("TaskConnectionIdMessage")) { static long const clockDriftFatalTimePeriod = static_cast(TaskManager::getStartTime()) + ConfigTaskManager::getClockDriftFatalIntervalSeconds(); - long const currentTime = static_cast(::time(NULL)); + long const currentTime = static_cast(::time(nullptr)); TaskConnectionIdMessage t(r); WARNING_STRICT_FATAL(t.getServerType() != TaskConnectionIdMessage::TaskManager, ("ManagerConnection received wrong type identifier")); diff --git a/engine/server/application/TaskManager/src/shared/TaskManager.cpp b/engine/server/application/TaskManager/src/shared/TaskManager.cpp index 192ab1a3..04550a81 100755 --- a/engine/server/application/TaskManager/src/shared/TaskManager.cpp +++ b/engine/server/application/TaskManager/src/shared/TaskManager.cpp @@ -161,7 +161,7 @@ m_processEntries(), m_localServers(), m_remoteServers(), m_nodeLabel(), -m_startTime(::time(NULL)), +m_startTime(::time(nullptr)), m_nodeList(), m_nodeNumber(-1), m_nodeToConnectToList(), @@ -362,7 +362,7 @@ void TaskManager::processRcFile() void TaskManager::setupNodeList() { char buffer[64]; - const char* result = NULL; + const char* result = nullptr; int nodeIndex = 0; bool found = true; @@ -375,7 +375,7 @@ void TaskManager::setupNodeList() { found = false; sprintf(buffer, "node%d", nodeIndex); - result = ConfigFile::getKeyString("TaskManager", buffer, NULL); + result = ConfigFile::getKeyString("TaskManager", buffer, nullptr); if (result) { NodeEntry n(result, buffer, nodeIndex); @@ -967,8 +967,8 @@ void TaskManager::update() // of slave TaskManager that has disconnected but has not reconnected, // so that an alert can be made in SOEMon so ops can see it and restart // the disconnected TaskManager - static time_t timeSystemTimeCheck = ::time(NULL) + ConfigTaskManager::getSystemTimeCheckIntervalSeconds(); - time_t const timeNow = ::time(NULL); + static time_t timeSystemTimeCheck = ::time(nullptr) + ConfigTaskManager::getSystemTimeCheckIntervalSeconds(); + time_t const timeNow = ::time(nullptr); if (timeSystemTimeCheck <= timeNow) { if (getNodeLabel() != "node0") diff --git a/engine/server/application/TransferServer/src/shared/CTSAPIClient.cpp b/engine/server/application/TransferServer/src/shared/CTSAPIClient.cpp index 6d456516..ca5d0845 100755 --- a/engine/server/application/TransferServer/src/shared/CTSAPIClient.cpp +++ b/engine/server/application/TransferServer/src/shared/CTSAPIClient.cpp @@ -147,7 +147,7 @@ void CTSAPIClient::onRequestMove(const unsigned server_track, const char *langua { LOG("CTSAPI", ("Received a transfer request for station ID %d, but a transfer for that id is already in progress", uid)); const unsigned int result = static_cast(CTService::CT_GAMERESULT_SOFTERROR); - IGNORE_RETURN(replyMove(server_track, result, NULL, NULL)); + IGNORE_RETURN(replyMove(server_track, result, nullptr, nullptr)); } } @@ -165,7 +165,7 @@ void CTSAPIClient::onRequestTransferAccount(const unsigned server_track, const u { LOG("CTSAPI", ("Received a transfer request for station ID %d, but a transfer for that id is already in progress", uid)); const unsigned int result = static_cast(CTService::CT_GAMERESULT_SOFTERROR); - IGNORE_RETURN(replyTransferAccount(server_track, result, NULL, NULL)); + IGNORE_RETURN(replyTransferAccount(server_track, result, nullptr, nullptr)); } } @@ -197,12 +197,12 @@ void CTSAPIClient::onRequestServerList(const unsigned server_track, const char * if(! servers.empty()) { const unsigned int result = static_cast(CTService::CT_RESULT_SUCCESS); - IGNORE_RETURN(replyServerList(server_track, result, servers.size(), &servers[0], NULL)); + IGNORE_RETURN(replyServerList(server_track, result, servers.size(), &servers[0], nullptr)); } else { const unsigned int result = static_cast(CTService::CT_RESULT_FAILURE); - IGNORE_RETURN(replyServerList(server_track, result, servers.size(), NULL, NULL)); + IGNORE_RETURN(replyServerList(server_track, result, servers.size(), nullptr, nullptr)); } } @@ -226,12 +226,12 @@ void CTSAPIClient::onRequestDestinationServerList(const unsigned server_track, c if(! servers.empty()) { const unsigned int result = static_cast(CTService::CT_RESULT_SUCCESS); - IGNORE_RETURN(replyDestinationServerList(server_track, result, servers.size(), &servers[0], NULL)); + IGNORE_RETURN(replyDestinationServerList(server_track, result, servers.size(), &servers[0], nullptr)); } else { const unsigned int result = static_cast(CTService::CT_RESULT_FAILURE); - IGNORE_RETURN(replyDestinationServerList(server_track, result, servers.size(), NULL, NULL)); + IGNORE_RETURN(replyDestinationServerList(server_track, result, servers.size(), nullptr, nullptr)); } } @@ -260,7 +260,7 @@ void CTSAPIClient::moveStart(unsigned int stationId, unsigned int track, const C std::map::iterator f = s_completedTransfers.find(track); if(f != s_completedTransfers.end()) { - IGNORE_RETURN(replyMove(track, f->second, NULL, NULL)); + IGNORE_RETURN(replyMove(track, f->second, nullptr, nullptr)); } else { @@ -284,7 +284,7 @@ void CTSAPIClient::lostCentralServerConnection(const CentralServerConnection * c { if(i->second.m_sourceCentralServerConnection == centralServerConnection || i->second.m_destinationCentralServerConnection == centralServerConnection) { - IGNORE_RETURN(replyMove(i->second.m_track, result, NULL, NULL)); + IGNORE_RETURN(replyMove(i->second.m_track, result, nullptr, nullptr)); s_activeTransfers.erase(i++); } else diff --git a/engine/server/application/TransferServer/src/shared/ConsoleManager.cpp b/engine/server/application/TransferServer/src/shared/ConsoleManager.cpp index c0208e0d..1a04dc38 100755 --- a/engine/server/application/TransferServer/src/shared/ConsoleManager.cpp +++ b/engine/server/application/TransferServer/src/shared/ConsoleManager.cpp @@ -14,7 +14,7 @@ namespace ConsoleManagerNamespace { - ConsoleCommandParser * s_consoleCommandParserRoot = NULL; + ConsoleCommandParser * s_consoleCommandParserRoot = nullptr; } using namespace ConsoleManagerNamespace; diff --git a/engine/server/application/TransferServer/src/shared/TransferServer.cpp b/engine/server/application/TransferServer/src/shared/TransferServer.cpp index 07334ab4..6533fd3e 100755 --- a/engine/server/application/TransferServer/src/shared/TransferServer.cpp +++ b/engine/server/application/TransferServer/src/shared/TransferServer.cpp @@ -150,10 +150,10 @@ namespace TransferServerNamespace if(s_apiClient) { const std::string resultString = resultToString(resultCode); - LOG("CustomerService", ("CharacterTransfer: transactionId=%u replyMove(%u, %s, NULL, NULL)", reply.getTransactionId(), reply.getTrack(), resultString.c_str())); + LOG("CustomerService", ("CharacterTransfer: transactionId=%u replyMove(%u, %s, nullptr, nullptr)", reply.getTransactionId(), reply.getTrack(), resultString.c_str())); const unsigned int result = static_cast(resultCode); s_apiClient->moveComplete(reply.getSourceStationId(), reply.getTrack(), result); - IGNORE_RETURN(s_apiClient->replyMove(reply.getTrack(), result, Unicode::narrowToWide(resultString).c_str(), NULL)); + IGNORE_RETURN(s_apiClient->replyMove(reply.getTrack(), result, Unicode::narrowToWide(resultString).c_str(), nullptr)); } } @@ -282,7 +282,7 @@ void TransferServer::requestCharacterList(unsigned int track, unsigned int stati { const unsigned int result = static_cast(CTService::CT_RESULT_FAILURE); - IGNORE_RETURN(s_apiClient->replyCharacterList(track, result, 0, NULL, NULL)); + IGNORE_RETURN(s_apiClient->replyCharacterList(track, result, 0, nullptr, nullptr)); s_apiClient->moveComplete(stationId, track, result); } } @@ -410,7 +410,7 @@ void TransferServer::requestTransferAccount(unsigned int track, unsigned int sou if(s_apiClient) { const unsigned int result = static_cast(CTService::CT_GAMERESULT_HARDERROR); - IGNORE_RETURN(s_apiClient->replyValidateMove(track, result, NULL, NULL, NULL)); + IGNORE_RETURN(s_apiClient->replyValidateMove(track, result, nullptr, nullptr, nullptr)); s_apiClient->moveComplete(sourceStationId, track, result); } @@ -430,7 +430,7 @@ void TransferServer::requestTransferAccount(unsigned int track, unsigned int sou if(s_apiClient) { const unsigned int result = static_cast(CTService::CT_GAMERESULT_SERVER_IS_DOWN); - IGNORE_RETURN(s_apiClient->replyTransferAccount(track, result, NULL, NULL)); + IGNORE_RETURN(s_apiClient->replyTransferAccount(track, result, nullptr, nullptr)); s_apiClient->moveComplete(sourceStationId, track, result); } @@ -442,12 +442,12 @@ void TransferServer::requestTransferAccount(unsigned int track, unsigned int sou if(destinationStationId == 0 || sourceStationId == 0) { - LOG("CustomerService", ("CharacterTransfer: Account move request made with a null destination station id: or source station id: %lu\n", sourceStationId)); + LOG("CustomerService", ("CharacterTransfer: Account move request made with a nullptr destination station id: or source station id: %lu\n", sourceStationId)); if(s_apiClient) { const unsigned int result = static_cast(CTService::CT_GAMERESULT_HARDERROR); - IGNORE_RETURN(s_apiClient->replyTransferAccount(track, result, NULL, NULL)); + IGNORE_RETURN(s_apiClient->replyTransferAccount(track, result, nullptr, nullptr)); s_apiClient->moveComplete(sourceStationId, track, result); } @@ -488,7 +488,7 @@ void TransferServer::requestMoveValidation(unsigned int track, unsigned int sour if(s_apiClient) { const unsigned int result = static_cast(CTService::CT_GAMERESULT_HARDERROR); - IGNORE_RETURN(s_apiClient->replyValidateMove(track, result, NULL, NULL, NULL)); + IGNORE_RETURN(s_apiClient->replyValidateMove(track, result, nullptr, nullptr, nullptr)); s_apiClient->moveComplete(sourceStationId, track, result); } } @@ -516,7 +516,7 @@ void TransferServer::requestMoveValidation(unsigned int track, unsigned int sour if(s_apiClient) { const unsigned int result = static_cast(CTService::CT_GAMERESULT_SERVER_IS_DOWN); - IGNORE_RETURN(s_apiClient->replyValidateMove(track, result, NULL, NULL, NULL)); + IGNORE_RETURN(s_apiClient->replyValidateMove(track, result, nullptr, nullptr, nullptr)); s_apiClient->moveComplete(sourceStationId, track, result); } } @@ -651,8 +651,8 @@ void TransferServer::replyCharacterList(const TransferReplyCharacterList & reply result = static_cast(CTService::CT_RESULT_FAILURE); s_apiClient->moveComplete(reply.getStationId(), reply.getTrack(), result); } - LOG("CTSAPI", ("invoking CTServiceAPI::replyCharacterList(%d, %d, %d, characters, NULL)", reply.getTrack(), result, chars.size())); - IGNORE_RETURN(s_apiClient->replyCharacterList(reply.getTrack(), result, reply.getAvatarList().size(), characters, NULL)); + LOG("CTSAPI", ("invoking CTServiceAPI::replyCharacterList(%d, %d, %d, characters, nullptr)", reply.getTrack(), result, chars.size())); + IGNORE_RETURN(s_apiClient->replyCharacterList(reply.getTrack(), result, reply.getAvatarList().size(), characters, nullptr)); } // else use another interface if available } @@ -675,7 +675,7 @@ void TransferServer::replyValidateMove(const TransferCharacterData & reply) { LOG("CustomerService", ("CharacterTransfer: replyValidateMove passed name validation for %s", reply.toString().c_str())); } - IGNORE_RETURN(s_apiClient->replyValidateMove(reply.getTrack(), result, NULL, NULL, NULL)); + IGNORE_RETURN(s_apiClient->replyValidateMove(reply.getTrack(), result, nullptr, nullptr, nullptr)); s_apiClient->moveComplete(reply.getSourceStationId(), reply.getTrack(), result); } } @@ -736,7 +736,7 @@ void TransferServer::replyTransferAccountSuccess(const TransferAccountData & rep LOG("CustomerService", ("CharacterTransfer: Could not transfer chat avatars for character %s on cluster %s from %lu to %lu: central connection does not exist in transferserver", i->second.c_str(), i->first.c_str(), reply.getSourceStationId(), reply.getDestinationStationId())); const unsigned int result = static_cast(CTService::CT_GAMERESULT_HARDERROR); s_apiClient->moveComplete(reply.getSourceStationId(), reply.getTrack(), result); - IGNORE_RETURN(s_apiClient->replyTransferAccount(reply.getTrack(), result, NULL, NULL)); + IGNORE_RETURN(s_apiClient->replyTransferAccount(reply.getTrack(), result, nullptr, nullptr)); } } } @@ -748,7 +748,7 @@ void TransferServer::replyTransferAccountSuccess(const TransferAccountData & rep if(s_apiClient) { const unsigned int result = static_cast(CTService::CT_GAMERESULT_SUCCESS); - IGNORE_RETURN(s_apiClient->replyTransferAccount(reply.getTrack(), result, NULL, NULL)); + IGNORE_RETURN(s_apiClient->replyTransferAccount(reply.getTrack(), result, nullptr, nullptr)); s_apiClient->moveComplete(reply.getSourceStationId(), reply.getTrack(), result); } } @@ -808,7 +808,7 @@ void TransferServer::failedToTransferAccountNoCentralConnection(const TransferAc LOG("CustomerService", ("CharacterTransfer: Transfer failed: Could not connect to central server to update game database. Sending HARD ERROR to CTS API. %s", failed.toString().c_str())); const unsigned int result = static_cast(CTService::CT_GAMERESULT_HARDERROR); s_apiClient->moveComplete(failed.getSourceStationId(), failed.getTrack(), result); - IGNORE_RETURN(s_apiClient->replyTransferAccount(failed.getTrack(), result, NULL, NULL)); + IGNORE_RETURN(s_apiClient->replyTransferAccount(failed.getTrack(), result, nullptr, nullptr)); } } @@ -821,7 +821,7 @@ void TransferServer::failedToTransferAccountDestinationNotEmpty (const TransferA LOG("CustomerService", ("CharacterTransfer: Transfer failed: Destination stationId has avatars. Sending HARD ERROR to CTS API. %s", failed.toString().c_str())); const unsigned int result = static_cast(CTService::CT_GAMERESULT_HARDERROR); s_apiClient->moveComplete(failed.getSourceStationId(), failed.getTrack(), result); - IGNORE_RETURN(s_apiClient->replyTransferAccount(failed.getTrack(), result, NULL, NULL)); + IGNORE_RETURN(s_apiClient->replyTransferAccount(failed.getTrack(), result, nullptr, nullptr)); } } @@ -860,7 +860,7 @@ void TransferServer::failedToValidateTransfer(const TransferReplyMoveValidation { const unsigned int result = ((reply.getResult() == TransferReplyMoveValidation::TRMVR_cannot_create_regular_character) ? static_cast(CTService::CT_GAMERESULT_MAX_CHAR_ON_DEST_SERVER) : static_cast(CTService::CT_GAMERESULT_SERVER_IS_DOWN)); - IGNORE_RETURN(s_apiClient->replyValidateMove(reply.getTrack(), result, NULL, NULL, NULL)); + IGNORE_RETURN(s_apiClient->replyValidateMove(reply.getTrack(), result, nullptr, nullptr, nullptr)); s_apiClient->moveComplete(reply.getSourceStationId(), reply.getTrack(), result); // close pseudoclientconnections diff --git a/engine/server/library/serverDatabase/src/shared/ConsoleManager.cpp b/engine/server/library/serverDatabase/src/shared/ConsoleManager.cpp index 4e24a67e..70f8342d 100755 --- a/engine/server/library/serverDatabase/src/shared/ConsoleManager.cpp +++ b/engine/server/library/serverDatabase/src/shared/ConsoleManager.cpp @@ -14,7 +14,7 @@ namespace ConsoleManagerNamespace { - ConsoleCommandParser * s_consoleCommandParserRoot = NULL; + ConsoleCommandParser * s_consoleCommandParserRoot = nullptr; } using namespace ConsoleManagerNamespace; diff --git a/engine/server/library/serverDatabase/src/shared/DataLookup.cpp b/engine/server/library/serverDatabase/src/shared/DataLookup.cpp index dd42952a..33fef53a 100755 --- a/engine/server/library/serverDatabase/src/shared/DataLookup.cpp +++ b/engine/server/library/serverDatabase/src/shared/DataLookup.cpp @@ -30,7 +30,7 @@ //----------------------------------------------------------------------- -DataLookup *DataLookup::ms_theInstance = NULL; +DataLookup *DataLookup::ms_theInstance = nullptr; //----------------------------------------------------------------------- @@ -524,7 +524,7 @@ void DataLookup::deleteReservationList(uint32 stationId) reservationList * rl = rlIter->second; if (!rl) { - WARNING_STRICT_FATAL(true, ("Reservation list for stationID %lu is NULL", stationId)); + WARNING_STRICT_FATAL(true, ("Reservation list for stationID %lu is nullptr", stationId)); return; } reservationList::iterator i; diff --git a/engine/server/library/serverDatabase/src/shared/DatabaseProcess.cpp b/engine/server/library/serverDatabase/src/shared/DatabaseProcess.cpp index 1c0eca40..fb5a56fe 100755 --- a/engine/server/library/serverDatabase/src/shared/DatabaseProcess.cpp +++ b/engine/server/library/serverDatabase/src/shared/DatabaseProcess.cpp @@ -46,7 +46,7 @@ // ---------------------------------------------------------------------- -DatabaseProcess *DatabaseProcess::ms_theInstance = NULL; +DatabaseProcess *DatabaseProcess::ms_theInstance = nullptr; // ---------------------------------------------------------------------- @@ -627,7 +627,7 @@ void DatabaseProcess::sendToCommoditiesServer(GameNetworkMessage const &message, commoditiesConnection->send(message,reliable); } else - DEBUG_REPORT_LOG(true, ("commoditiesConnection is NULL\n")); + DEBUG_REPORT_LOG(true, ("commoditiesConnection is nullptr\n")); } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverDatabase/src/shared/ImmediateDeleteCustomPersistStep.cpp b/engine/server/library/serverDatabase/src/shared/ImmediateDeleteCustomPersistStep.cpp index e1c3d149..c205c79d 100755 --- a/engine/server/library/serverDatabase/src/shared/ImmediateDeleteCustomPersistStep.cpp +++ b/engine/server/library/serverDatabase/src/shared/ImmediateDeleteCustomPersistStep.cpp @@ -23,7 +23,7 @@ ImmediateDeleteCustomPersistStep::ImmediateDeleteCustomPersistStep() : ImmediateDeleteCustomPersistStep::~ImmediateDeleteCustomPersistStep() { delete m_objects; - m_objects = NULL; + m_objects = nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverDatabase/src/shared/LazyDeleter.cpp b/engine/server/library/serverDatabase/src/shared/LazyDeleter.cpp index 16baa713..ecdc4260 100755 --- a/engine/server/library/serverDatabase/src/shared/LazyDeleter.cpp +++ b/engine/server/library/serverDatabase/src/shared/LazyDeleter.cpp @@ -27,7 +27,7 @@ // ====================================================================== -LazyDeleter * LazyDeleter::ms_instance=NULL; +LazyDeleter * LazyDeleter::ms_instance=nullptr; // ====================================================================== @@ -80,13 +80,13 @@ void LazyDeleter::remove() { NOT_NULL(ms_instance); delete ms_instance; - ms_instance = NULL; + ms_instance = nullptr; } // ---------------------------------------------------------------------- LazyDeleter::LazyDeleter() : - m_workerThread(NULL), // Avoid starting the worker thread until the other member variables are initialized + m_workerThread(nullptr), // Avoid starting the worker thread until the other member variables are initialized m_incomingObjects(new std::vector), m_objectsToDelete(new std::deque), m_objectListLock(new Mutex), @@ -113,11 +113,11 @@ LazyDeleter::~LazyDeleter() delete m_objectsToDelete; delete m_objectListLock; - m_workerThread = NULL; - m_incomingObjects = NULL; - m_objectsToDelete = NULL; - m_objectListLock = NULL; - m_session = NULL; + m_workerThread = nullptr; + m_incomingObjects = nullptr; + m_objectsToDelete = nullptr; + m_objectListLock = nullptr; + m_session = nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverDatabase/src/shared/Loader.cpp b/engine/server/library/serverDatabase/src/shared/Loader.cpp index fb4b5a6c..3f863d80 100755 --- a/engine/server/library/serverDatabase/src/shared/Loader.cpp +++ b/engine/server/library/serverDatabase/src/shared/Loader.cpp @@ -55,7 +55,7 @@ // ====================================================================== -Loader *Loader::ms_instance = NULL; +Loader *Loader::ms_instance = nullptr; // ====================================================================== @@ -72,7 +72,7 @@ void Loader::remove() { NOT_NULL(ms_instance); delete ms_instance; - ms_instance = NULL; + ms_instance = nullptr; } // ---------------------------------------------------------------------- @@ -442,7 +442,7 @@ void Loader::receiveMessage(const MessageDispatch::Emitter & source, const Messa { Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); ValidateCharacterForLoginMessage msg(ri); - verifyCharacter(msg.getSuid(), msg.getCharacterId(), NULL); + verifyCharacter(msg.getSuid(), msg.getCharacterId(), nullptr); } else if(message.isType("TransferGetLoginLocationData")) { @@ -647,7 +647,7 @@ void Loader::checkVersionNumber(int expectedVersion, bool fatalOnMismatch) void Loader::requestChunk(uint32 processId,int nodeX, int nodeZ, const std::string &sceneId) { ObjectLocator * const regularLocator=new ChunkLocator(nodeX, nodeZ, sceneId, processId, true); - ObjectLocator * goldLocator=NULL; + ObjectLocator * goldLocator=nullptr; if (ConfigServerDatabase::getEnableGoldDatabase()) goldLocator = new ChunkLocator(nodeX, nodeZ, sceneId, processId, false); addLocatorsForServer(processId, regularLocator, goldLocator); @@ -671,7 +671,7 @@ void Loader::requestCharacter(const NetworkId &characterId, uint32 gameServerId) i=m_multipleLoginLock.find(characterId); if (i==m_multipleLoginLock.end()) { - addLocatorsForServer(gameServerId, new CharacterLocator(characterId), NULL); + addLocatorsForServer(gameServerId, new CharacterLocator(characterId), nullptr); DEBUG_REPORT_LOG(true,("Adding multipleLoginLock for %s\n",characterId.getValueString().c_str())); m_multipleLoginLock[characterId] = gameServerId; @@ -684,7 +684,7 @@ void Loader::requestCharacter(const NetworkId &characterId, uint32 gameServerId) } } else - addLocatorsForServer(gameServerId, new CharacterLocator(characterId), NULL); + addLocatorsForServer(gameServerId, new CharacterLocator(characterId), nullptr); } // ---------------------------------------------------------------------- @@ -692,7 +692,7 @@ void Loader::requestCharacter(const NetworkId &characterId, uint32 gameServerId) void Loader::loadContainedObject(const NetworkId &containerId, const NetworkId &objectId, uint32 gameServerId) { LOG("AuctionRetrieval", ("Loader::received loadContainedObject for loading object %s for retrieval", objectId.getValueString().c_str())); - addLocatorsForServer(gameServerId, new ContainedObjectLocator(containerId,objectId), NULL); + addLocatorsForServer(gameServerId, new ContainedObjectLocator(containerId,objectId), nullptr); } @@ -700,7 +700,7 @@ void Loader::loadContainedObject(const NetworkId &containerId, const NetworkId & void Loader::loadContents(const NetworkId &containerId, uint32 gameServerId) { - addLocatorsForServer(gameServerId, new ContentsLocator(containerId), NULL); + addLocatorsForServer(gameServerId, new ContentsLocator(containerId), nullptr); } // ---------------------------------------------------------------------- @@ -820,7 +820,7 @@ void Loader::removeLoadLock(const NetworkId &characterId) if (i->second!=0) { DEBUG_REPORT_LOG(true,("Now handling delayed login request for character %s\n",characterId.getValueString().c_str())); - addLocatorsForServer(i->second, new CharacterLocator(characterId), NULL); + addLocatorsForServer(i->second, new CharacterLocator(characterId), nullptr); } m_loadLock.erase(i); diff --git a/engine/server/library/serverDatabase/src/shared/MessageToManager.cpp b/engine/server/library/serverDatabase/src/shared/MessageToManager.cpp index 6773ccca..d47dc773 100755 --- a/engine/server/library/serverDatabase/src/shared/MessageToManager.cpp +++ b/engine/server/library/serverDatabase/src/shared/MessageToManager.cpp @@ -16,7 +16,7 @@ // ====================================================================== -MessageToManager *MessageToManager::ms_instance=NULL; +MessageToManager *MessageToManager::ms_instance=nullptr; // ====================================================================== @@ -34,7 +34,7 @@ void MessageToManager::remove() { NOT_NULL(ms_instance); delete ms_instance; - ms_instance = NULL; + ms_instance = nullptr; } // ---------------------------------------------------------------------- @@ -51,7 +51,7 @@ MessageToManager::~MessageToManager() for (MessagesByObjectType::iterator i=m_messagesByObject.begin(); i!=m_messagesByObject.end(); ++i) { delete i->second; - i->second=NULL; + i->second=nullptr; } } @@ -71,7 +71,7 @@ void MessageToManager::handleMessageTo(const MessageToPayload &data) { DEBUG_WARNING(true,("Received message %s twice.",data.getMessageId().getValueString().c_str())); delete i->second; - i->second = NULL; + i->second = nullptr; } m_messagesByObject[theKey]=new MessageToPayload(data); @@ -127,7 +127,7 @@ void MessageToManager::removeMessage(const MessageToId &messageId) if (j!=m_messagesByObject.end()) { delete j->second; - j->second=NULL; + j->second=nullptr; m_messagesByObject.erase(j); } m_messageToObjectMap.erase(i); diff --git a/engine/server/library/serverDatabase/src/shared/Persister.cpp b/engine/server/library/serverDatabase/src/shared/Persister.cpp index 89c299ff..bf178daa 100755 --- a/engine/server/library/serverDatabase/src/shared/Persister.cpp +++ b/engine/server/library/serverDatabase/src/shared/Persister.cpp @@ -70,7 +70,7 @@ // ====================================================================== -Persister *Persister::ms_instance=NULL; +Persister *Persister::ms_instance=nullptr; // ====================================================================== @@ -88,7 +88,7 @@ void Persister::remove() { NOT_NULL(ms_instance); delete ms_instance; - ms_instance = NULL; + ms_instance = nullptr; } //----------------------------------------------------------------------- @@ -108,9 +108,9 @@ Persister::Persister() : m_charactersToDeleteThisSaveCycle(new CharactersToDeleteType), m_charactersToDeleteNextSaveCycle(new CharactersToDeleteType), m_timeSinceLastSave(0), - m_messageSnapshot(NULL), - m_commoditiesSnapshot(NULL), - m_arbitraryGameDataSnapshot(NULL), + m_messageSnapshot(nullptr), + m_commoditiesSnapshot(nullptr), + m_arbitraryGameDataSnapshot(nullptr), m_saveStartTime(0), m_totalSaveTime(0), m_maxSaveTime(0), @@ -181,15 +181,15 @@ Persister::~Persister() m_currentSnapshots.clear(); m_newObjectSnapshots.clear(); m_objectSnapshotMap.clear(); - m_messageSnapshot = NULL; - m_commoditiesSnapshot = NULL; - m_arbitraryGameDataSnapshot = NULL; + m_messageSnapshot = nullptr; + m_commoditiesSnapshot = nullptr; + m_arbitraryGameDataSnapshot = nullptr; delete m_charactersToDeleteThisSaveCycle; - m_charactersToDeleteThisSaveCycle = NULL; + m_charactersToDeleteThisSaveCycle = nullptr; delete m_charactersToDeleteNextSaveCycle; - m_charactersToDeleteNextSaveCycle = NULL; + m_charactersToDeleteNextSaveCycle = nullptr; } // ---------------------------------------------------------------------- @@ -283,7 +283,7 @@ void Persister::onFrameBarrierReached() /** * Moves the current & new object snapshots onto the queue to be saved. * - * Does nothing if these snapshots are null. + * Does nothing if these snapshots are nullptr. */ void Persister::startSave(void) @@ -351,9 +351,9 @@ void Persister::startSave(void) m_currentSnapshots.clear(); m_newObjectSnapshots.clear(); m_objectSnapshotMap.clear(); - m_messageSnapshot = NULL; - m_commoditiesSnapshot = NULL; - m_arbitraryGameDataSnapshot = NULL; + m_messageSnapshot = nullptr; + m_commoditiesSnapshot = nullptr; + m_arbitraryGameDataSnapshot = nullptr; // prepare the list of characters to delete during the next save cycle if (m_charactersToDeleteNextSaveCycle && m_charactersToDeleteThisSaveCycle) @@ -515,7 +515,7 @@ void Persister::newObject(uint32 serverId, const NetworkId &objectId, int templa return; } - Snapshot *snap=NULL; + Snapshot *snap=nullptr; PendingCharactersType::iterator chardata=m_pendingCharacters.find(objectId); if (chardata!=m_pendingCharacters.end()) @@ -543,7 +543,7 @@ void Persister::newObject(uint32 serverId, const NetworkId &objectId, int templa else { // Add the object to the appropriate snapshot - snap=NULL; + snap=nullptr; { ObjectSnapshotMap::const_iterator j=m_objectSnapshotMap.find(container); if (j!=m_objectSnapshotMap.end() && j->second->getMode() == DB::ModeQuery::mode_INSERT) @@ -728,7 +728,7 @@ void Persister::receiveMessage(const MessageDispatch::Emitter & source, const Me Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); RenameCharacterMessageEx msg(ri); - renameCharacter(sourceGameServer, static_cast(msg.getRenameCharacterMessageSource()), msg.getStationId(), msg.getCharacterId(), msg.getNewName(), msg.getOldName(), msg.getLastNameChangeOnly(), msg.getRequestedBy(), NULL); + renameCharacter(sourceGameServer, static_cast(msg.getRenameCharacterMessageSource()), msg.getStationId(), msg.getCharacterId(), msg.getNewName(), msg.getOldName(), msg.getLastNameChangeOnly(), msg.getRequestedBy(), nullptr); } else if (message.isType("UnloadedPlayerMessage")) { diff --git a/engine/server/library/serverDatabase/src/shared/TaskGetBiography.cpp b/engine/server/library/serverDatabase/src/shared/TaskGetBiography.cpp index 9c6cb243..96b976fb 100755 --- a/engine/server/library/serverDatabase/src/shared/TaskGetBiography.cpp +++ b/engine/server/library/serverDatabase/src/shared/TaskGetBiography.cpp @@ -19,7 +19,7 @@ TaskGetBiography::TaskGetBiography(const NetworkId &owner, uint32 requestingProcess) : m_owner(owner), m_requestingProcess(requestingProcess), - m_bio(NULL) + m_bio(nullptr) { } @@ -28,7 +28,7 @@ TaskGetBiography::TaskGetBiography(const NetworkId &owner, uint32 requestingProc TaskGetBiography::~TaskGetBiography() { delete m_bio; - m_bio=NULL; + m_bio=nullptr; } // ---------------------------------------------------------------------- @@ -53,7 +53,7 @@ bool TaskGetBiography::process(DB::Session *session) void TaskGetBiography::onComplete() { - WARNING_STRICT_FATAL(!m_bio,("In TaskGetBiography::onComplete, but m_bio is NULL\n")); + WARNING_STRICT_FATAL(!m_bio,("In TaskGetBiography::onComplete, but m_bio is nullptr\n")); if (m_bio) { BiographyMessage msg(m_owner, *m_bio); diff --git a/engine/server/library/serverDatabase/src/shared/TaskSetBiography.cpp b/engine/server/library/serverDatabase/src/shared/TaskSetBiography.cpp index d8a98958..501cfe48 100755 --- a/engine/server/library/serverDatabase/src/shared/TaskSetBiography.cpp +++ b/engine/server/library/serverDatabase/src/shared/TaskSetBiography.cpp @@ -24,7 +24,7 @@ TaskSetBiography::TaskSetBiography(const NetworkId &owner, const Unicode::String TaskSetBiography::~TaskSetBiography() { delete m_bio; - m_bio=NULL; + m_bio=nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/ai/AggroListProperty.cpp b/engine/server/library/serverGame/src/shared/ai/AggroListProperty.cpp index 0b0a552d..e06b0d40 100755 --- a/engine/server/library/serverGame/src/shared/ai/AggroListProperty.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AggroListProperty.cpp @@ -106,7 +106,7 @@ bool AggroListPropertyNamespace::isIncapacitated(TangibleObject const & target) { CreatureObject const * const targetCreatureObject = target.asCreatureObject(); - return (targetCreatureObject != NULL) ? targetCreatureObject->isIncapacitated() : false; + return (targetCreatureObject != nullptr) ? targetCreatureObject->isIncapacitated() : false; } // ---------------------------------------------------------------------- @@ -114,7 +114,7 @@ bool AggroListPropertyNamespace::isDead(TangibleObject const & target) { CreatureObject const * const targetCreatureObject = target.asCreatureObject(); - return (targetCreatureObject != NULL) ? targetCreatureObject->isDead() : false; + return (targetCreatureObject != nullptr) ? targetCreatureObject->isDead() : false; } // ---------------------------------------------------------------------- @@ -122,7 +122,7 @@ bool AggroListPropertyNamespace::isInvulnerable(TangibleObject const & target) { CreatureObject const * const targetCreatureObject = target.asCreatureObject(); - return (targetCreatureObject != NULL) ? targetCreatureObject->isInvulnerable() : false; + return (targetCreatureObject != nullptr) ? targetCreatureObject->isInvulnerable() : false; } // ---------------------------------------------------------------------- @@ -138,7 +138,7 @@ bool AggroListPropertyNamespace::isFeigningDeath(TangibleObject const & target) { CreatureObject const * const targetCreatureObject = target.asCreatureObject(); - return (targetCreatureObject != NULL) ? targetCreatureObject->getState(States::FeignDeath) : false; + return (targetCreatureObject != nullptr) ? targetCreatureObject->getState(States::FeignDeath) : false; } // ---------------------------------------------------------------------- @@ -146,7 +146,7 @@ bool AggroListPropertyNamespace::isInPlayerBuilding(TangibleObject const & targe { ServerObject const * const topMostServerObject = ServerObject::asServerObject(ContainerInterface::getTopmostContainer(target)); - return (topMostServerObject != NULL) ? (topMostServerObject->getGameObjectType() == SharedObjectTemplate::GOT_building_player) : false; + return (topMostServerObject != nullptr) ? (topMostServerObject->getGameObjectType() == SharedObjectTemplate::GOT_building_player) : false; } // ---------------------------------------------------------------------- @@ -154,7 +154,7 @@ bool AggroListPropertyNamespace::isAggroImmune(TangibleObject const & target) { PlayerObject const * const playerObject = PlayerCreatureController::getPlayerObject(target.asCreatureObject()); - return (playerObject != NULL) ? playerObject->isAggroImmune() : false; + return (playerObject != nullptr) ? playerObject->isAggroImmune() : false; } // ====================================================================== @@ -212,7 +212,7 @@ void AggroListProperty::alter() // First, list things that invalidate this target in the aggro list // Second, list the things that promote the target to the hate list - if (target.getObject() == NULL) + if (target.getObject() == nullptr) { purgeList.push_back(iterTargetList); } @@ -315,7 +315,7 @@ TangibleObject & AggroListProperty::getTangibleOwner() AggroListProperty * AggroListProperty::getAggroListProperty(Object & object) { Property * const property = object.getProperty(getClassPropertyId()); - AggroListProperty * const aggroProperty = (property != NULL) ? static_cast(property) : NULL; + AggroListProperty * const aggroProperty = (property != nullptr) ? static_cast(property) : nullptr; return aggroProperty; } diff --git a/engine/server/library/serverGame/src/shared/ai/AiCombatPulseQueue.cpp b/engine/server/library/serverGame/src/shared/ai/AiCombatPulseQueue.cpp index c3e95004..328d9540 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiCombatPulseQueue.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiCombatPulseQueue.cpp @@ -45,7 +45,7 @@ void AiCombatPulseQueue::remove() void AiCombatPulseQueue::schedule(TangibleObject * const object, int waitTimeMs, unsigned long currentFrameTimeMs) { - if (object == NULL) + if (object == nullptr) return; unsigned long desiredTime = Clock::getFrameStartTimeMs() + currentFrameTimeMs + waitTimeMs; @@ -97,7 +97,7 @@ void AiCombatPulseQueue::alter(real time) TangibleObject * const object = (j->second)->first; - if (object != NULL && object->isInCombat()) + if (object != nullptr && object->isInCombat()) { NetworkId const & id = object->getNetworkId(); @@ -107,7 +107,7 @@ void AiCombatPulseQueue::alter(real time) GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(object); - if (gameScriptObject != NULL) + if (gameScriptObject != nullptr) { ScriptParams scriptParams; IGNORE_RETURN(gameScriptObject->trigAllScripts(Scripting::TRIG_AI_COMBAT_FRAME, scriptParams)); diff --git a/engine/server/library/serverGame/src/shared/ai/AiCreatureCombatProfile.cpp b/engine/server/library/serverGame/src/shared/ai/AiCreatureCombatProfile.cpp index cf2cb505..c27828d6 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiCreatureCombatProfile.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiCreatureCombatProfile.cpp @@ -136,9 +136,9 @@ void AiCreatureCombatProfileNamespace::loadCombatProfileTable(DataTable const & for (int i = 0; i < serverObjectCount; ++i) { ServerObject * const serverObject = ServerWorld::getObject(i); - CreatureObject * const creatureObject = (serverObject != NULL) ? serverObject->asCreatureObject() : NULL; + CreatureObject * const creatureObject = (serverObject != nullptr) ? serverObject->asCreatureObject() : nullptr; - if ( (creatureObject != NULL) + if ( (creatureObject != nullptr) && !creatureObject->isPlayerControlled()) { creatureObject->makeDead(NetworkId::cms_invalid, NetworkId::cms_invalid); @@ -228,7 +228,7 @@ void AiCreatureCombatProfileNamespace::grantActions(CreatureObject & owner, AiCr // ---------------------------------------------------------------------- AiCreatureCombatProfile::AiCreatureCombatProfile() - : m_profileId(NULL) + : m_profileId(nullptr) , m_singleUseActionList() , m_delayRepeatActionList() , m_instantRepeatActionList() @@ -247,7 +247,7 @@ void AiCreatureCombatProfile::install() bool const openIfNotFound = true; DataTable * const dataTable = DataTableManager::getTable(s_combatProfileTable, openIfNotFound); - if (dataTable != NULL) + if (dataTable != nullptr) { #ifdef _DEBUG DataTableManager::addReloadCallback(s_combatProfileTable, &loadCombatProfileTable); @@ -267,7 +267,7 @@ void AiCreatureCombatProfile::install() // ---------------------------------------------------------------------- AiCreatureCombatProfile const * AiCreatureCombatProfile::getCombatProfile(CrcString const & profileName) { - AiCreatureCombatProfile const * result = NULL; + AiCreatureCombatProfile const * result = nullptr; CombatProfileMap::const_iterator iterCombatProfileMap = s_combatProfileMap.find(PersistentCrcString(profileName)); if (iterCombatProfileMap != s_combatProfileMap.end()) diff --git a/engine/server/library/serverGame/src/shared/ai/AiCreatureData.cpp b/engine/server/library/serverGame/src/shared/ai/AiCreatureData.cpp index 034f9980..3d90a5f7 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiCreatureData.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiCreatureData.cpp @@ -46,7 +46,7 @@ namespace AiCreatureDataNamespace CreatureDataMap s_creatureDataMap; WeaponDataMap s_weaponDataMap; - AiCreatureData const * s_defaultCreatureData = NULL; + AiCreatureData const * s_defaultCreatureData = nullptr; int s_creatureErrorCount = 0; int s_weaponErrorCount = 0; @@ -154,7 +154,7 @@ void AiCreatureDataNamespace::verifySecondaryWeapon(CrcString const & creatureNa void AiCreatureDataNamespace::verifyPrimarySpecials(CrcString const & creatureName, CrcString & primarySpecials) { if ( !primarySpecials.isEmpty() - && (AiCreatureCombatProfile::getCombatProfile(primarySpecials) == NULL)) + && (AiCreatureCombatProfile::getCombatProfile(primarySpecials) == nullptr)) { ++s_creatureErrorCount; WARNING(true, ("AiCreatureData::verifyPrimarySpecials() Creature(%s) has invalid primary_weapon_specials(%s)", creatureName.getString(), primarySpecials.getString())); @@ -165,7 +165,7 @@ void AiCreatureDataNamespace::verifyPrimarySpecials(CrcString const & creatureNa void AiCreatureDataNamespace::verifySecondarySpecials(CrcString const & creatureName, CrcString & secondarySpecials) { if ( !secondarySpecials.isEmpty() - && (AiCreatureCombatProfile::getCombatProfile(secondarySpecials) == NULL)) + && (AiCreatureCombatProfile::getCombatProfile(secondarySpecials) == nullptr)) { ++s_creatureErrorCount; WARNING(true, ("AiCreatureData::verifySecondarySpecials() Creature(%s) has invalid secondary_weapon_specials(%s)", creatureName.getString(), secondarySpecials.getString())); @@ -320,7 +320,7 @@ void AiCreatureDataNamespace::loadWeaponColumn(WeaponList & weaponList, std::str // ---------------------------------------------------------------------- AiCreatureData::AiCreatureData() - : m_name(NULL) + : m_name(nullptr) , m_movementSpeedPercent(1.0f) , m_primaryWeapon() , m_secondaryWeapon() @@ -348,7 +348,7 @@ void AiCreatureData::install() bool const openIfNotFound = true; DataTable * const dataTable = DataTableManager::getTable(s_weaponDataTable, openIfNotFound); - if (dataTable != NULL) + if (dataTable != nullptr) { DataTableManager::addReloadCallback(s_weaponDataTable, &loadWeaponData); loadWeaponData(*dataTable); @@ -366,7 +366,7 @@ void AiCreatureData::install() bool const openIfNotFound = true; DataTable * const dataTable = DataTableManager::getTable(s_creaureDataTable, openIfNotFound); - if (dataTable != NULL) + if (dataTable != nullptr) { DataTableManager::addReloadCallback(s_creaureDataTable, &loadCreatureData); loadCreatureData(*dataTable); diff --git a/engine/server/library/serverGame/src/shared/ai/AiCreatureWeaponActions.cpp b/engine/server/library/serverGame/src/shared/ai/AiCreatureWeaponActions.cpp index 781bc2f1..4d5498f8 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiCreatureWeaponActions.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiCreatureWeaponActions.cpp @@ -58,7 +58,7 @@ AiCreatureWeaponActions::AiCreatureWeaponActions() : m_singleUseActionList() , m_delayRepeatActionList() , m_instantRepeatActionList() - , m_combatProfile(NULL) + , m_combatProfile(nullptr) { } @@ -81,7 +81,7 @@ void AiCreatureWeaponActions::setCombatProfile(CreatureObject & owner, AiCreatur // ---------------------------------------------------------------------- void AiCreatureWeaponActions::reset() { - if (m_combatProfile != NULL) + if (m_combatProfile != nullptr) { resetActionTimers(m_singleUseActionList, m_combatProfile->m_singleUseActionList); resetActionTimers(m_delayRepeatActionList, m_combatProfile->m_delayRepeatActionList); @@ -92,9 +92,9 @@ void AiCreatureWeaponActions::reset() // ---------------------------------------------------------------------- PersistentCrcString const & AiCreatureWeaponActions::getCombatAction() { - // If the combat profile is NULL, then the AI has no special actions assigned + // If the combat profile is nullptr, then the AI has no special actions assigned - if (m_combatProfile != NULL) + if (m_combatProfile != nullptr) { time_t const osTime = Os::getRealSystemTime(); diff --git a/engine/server/library/serverGame/src/shared/ai/AiMovementArchive.cpp b/engine/server/library/serverGame/src/shared/ai/AiMovementArchive.cpp index 723b8c7e..e1508bf4 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiMovementArchive.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiMovementArchive.cpp @@ -34,12 +34,12 @@ namespace Archive get(source, target.m_objectId); get(source, movementType); - AICreatureController * controller = NULL; + AICreatureController * controller = nullptr; Object * object = NetworkIdManager::getObjectById(target.getObjectId()); - if (object != NULL) + if (object != nullptr) controller = dynamic_cast(object->getController()); - if (controller == NULL) + if (controller == nullptr) { WARNING(true, ("AiMovementMessage Archive::get, got message to object %s that doesn't have an AICreatureController", target.getObjectId().getValueString().c_str())); target.m_movement = AiMovementBaseNullPtr; diff --git a/engine/server/library/serverGame/src/shared/ai/AiMovementBase.cpp b/engine/server/library/serverGame/src/shared/ai/AiMovementBase.cpp index dde28a05..79f1e119 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiMovementBase.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiMovementBase.cpp @@ -30,9 +30,9 @@ AiMovementBase::AiMovementBase( AICreatureController * controller ) : m_controller( controller ), - m_stateFunction( NULL ), + m_stateFunction( nullptr ), m_stateName(), - m_pendingFunction( NULL ), + m_pendingFunction( nullptr ), m_pendingName() { } @@ -41,9 +41,9 @@ AiMovementBase::AiMovementBase( AICreatureController * controller ) AiMovementBase::AiMovementBase( AICreatureController * controller, Archive::ReadIterator & source ) : m_controller( controller ), - m_stateFunction( NULL ), + m_stateFunction( nullptr ), m_stateName(), - m_pendingFunction( NULL ), + m_pendingFunction( nullptr ), m_pendingName() { // !!! @@ -177,7 +177,7 @@ void AiMovementBase::applyStateChange ( void ) m_stateFunction = m_pendingFunction; m_stateName = m_pendingName; - m_pendingFunction = NULL; + m_pendingFunction = nullptr; m_pendingName.clear(); } } @@ -249,49 +249,49 @@ char const * AiMovementBase::getMovementString(AiMovementType const aiMovementTy // ---------------------------------------------------------------------- AiMovementSwarm * AiMovementBase::asAiMovementSwarm() { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- AiMovementFace * AiMovementBase::asAiMovementFace() { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- AiMovementFlee * AiMovementBase::asAiMovementFlee() { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- AiMovementFollow * AiMovementBase::asAiMovementFollow() { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- AiMovementLoiter * AiMovementBase::asAiMovementLoiter() { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- AiMovementMove * AiMovementBase::asAiMovementMove() { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- AiMovementPatrol * AiMovementBase::asAiMovementPatrol() { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- AiMovementWander * AiMovementBase::asAiMovementWander() { - return NULL; + return nullptr; } // ====================================================================== diff --git a/engine/server/library/serverGame/src/shared/ai/AiMovementLoiter.cpp b/engine/server/library/serverGame/src/shared/ai/AiMovementLoiter.cpp index 8e4e5a2d..e8e0f5c4 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiMovementLoiter.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiMovementLoiter.cpp @@ -67,9 +67,9 @@ Vector AiMovementLoiterNamespace::getRandomLoiterPosition_p(Vector const anchorP bool AiMovementLoiterNamespace::isPositionOnFloor(Floor const * const floor, Vector const & position_p, float const radius, Vector & floorPosition_p) { bool result = false; - FloorMesh const * const floorMesh = (floor != NULL) ? floor->getFloorMesh() : NULL; + FloorMesh const * const floorMesh = (floor != nullptr) ? floor->getFloorMesh() : nullptr; - if (floorMesh != NULL) + if (floorMesh != nullptr) { // See if the circle fits entirely on the floor { @@ -199,7 +199,7 @@ AiMovementLoiter::AiMovementLoiter( AICreatureController * controller, Archive:: AiMovementLoiter::~AiMovementLoiter() { delete m_cachedAiLocations; - m_cachedAiLocations = NULL; + m_cachedAiLocations = nullptr; } // ---------------------------------------------------------------------- @@ -420,7 +420,7 @@ bool AiMovementLoiter::generateWaypoint() Floor const * const ownerFloor = CollisionWorld::getFloorStandingOn(*creatureOwner); - if (ownerFloor != NULL) + if (ownerFloor != nullptr) { // The owner is standing on a floor @@ -476,7 +476,7 @@ bool AiMovementLoiter::generateWaypoint() TerrainObject const * const terrainObject = TerrainObject::getConstInstance(); - if ( (terrainObject != NULL) + if ( (terrainObject != nullptr) && terrainObject->isPassable(randomPosition_p)) { // Snap the random position to the terrain @@ -518,7 +518,7 @@ bool AiMovementLoiter::generateWaypoint() { BaseExtent const * const extent = collisionProperty->getExtent_l(); - if (extent != NULL) + if (extent != nullptr) { Vector const begin_o(object.rotateTranslate_w2o(m_anchor.getPosition_p())); Vector const end_o(object.rotateTranslate_w2o(randomPosition_p)); @@ -580,7 +580,7 @@ void AiMovementLoiter::addDebug(AiDebugString & aiDebugString) AiMovementWaypoint::addDebug(aiDebugString); FormattedString<512> fs; - aiDebugString.addText(fs.sprintf("LOITER %s\n%s\ndist[%.0f...%.0f]\ndelay[%.1f...%.1f]\n", (m_anchor.getObject() != NULL) ? "TARGET" : "POSITION", m_stateName.c_str(), m_minDistance, m_maxDistance, m_minDelay, m_maxDelay), PackedRgb::solidCyan); + aiDebugString.addText(fs.sprintf("LOITER %s\n%s\ndist[%.0f...%.0f]\ndelay[%.1f...%.1f]\n", (m_anchor.getObject() != nullptr) ? "TARGET" : "POSITION", m_stateName.c_str(), m_minDistance, m_maxDistance, m_minDelay, m_maxDelay), PackedRgb::solidCyan); //if (m_bubbleCheckResult == BCR_invalid) //{ @@ -599,7 +599,7 @@ void AiMovementLoiter::addDebug(AiDebugString & aiDebugString) { Object const * const anchorObject = m_anchor.getObject(); - if (anchorObject != NULL) + if (anchorObject != nullptr) { // We are anchored to a moving target @@ -659,7 +659,7 @@ bool AiMovementLoiter::isAnchorValid() const { TangibleObject const * const tangibleObject = TangibleObject::asTangibleObject(m_anchor.getObject()); - if (tangibleObject != NULL) + if (tangibleObject != nullptr) { if (tangibleObject->isInCombat()) { diff --git a/engine/server/library/serverGame/src/shared/ai/AiMovementMove.cpp b/engine/server/library/serverGame/src/shared/ai/AiMovementMove.cpp index 9641e7e3..71b6b193 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiMovementMove.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiMovementMove.cpp @@ -85,7 +85,7 @@ AiMovementMove::AiMovementMove( AICreatureController * controller, Archive::Read AiMovementMove::~AiMovementMove() { delete m_pathBuilder; - m_pathBuilder = NULL; + m_pathBuilder = nullptr; } // ---------------------------------------------------------------------- @@ -151,7 +151,7 @@ void AiMovementMove::refresh( void ) m_target = target; m_targetName = targetName; - if (m_controller != NULL) + if (m_controller != nullptr) m_start = AiLocation(m_controller->getCreatureCell(), m_controller->getCreaturePosition_p()); CHANGE_STATE( AiMovementMove::stateWaiting ); } diff --git a/engine/server/library/serverGame/src/shared/ai/AiMovementPathFollow.cpp b/engine/server/library/serverGame/src/shared/ai/AiMovementPathFollow.cpp index 2105c898..34ab1e1f 100644 --- a/engine/server/library/serverGame/src/shared/ai/AiMovementPathFollow.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiMovementPathFollow.cpp @@ -73,7 +73,7 @@ AiMovementPathFollow::AiMovementPathFollow( AICreatureController * controller, A : AiMovementWaypoint( controller, source ), m_path( new AiPath() ) { - if (m_path != NULL) + if (m_path != nullptr) Archive::get(source, *m_path); } @@ -84,7 +84,7 @@ AiMovementPathFollow::~AiMovementPathFollow() clearPath(); delete m_path; - m_path = NULL; + m_path = nullptr; } // ---------------------------------------------------------------------- @@ -92,7 +92,7 @@ AiMovementPathFollow::~AiMovementPathFollow() void AiMovementPathFollow::pack( Archive::ByteStream & target ) const { AiMovementWaypoint::pack(target); - if (m_path != NULL) + if (m_path != nullptr) Archive::put(target, *m_path); else Archive::put(target, static_cast(0)); @@ -288,7 +288,7 @@ AiPath const * AiMovementPathFollow::getPath ( void ) const void AiMovementPathFollow::swapPath ( AiPath * newPath ) { - if(newPath == NULL) return; + if(newPath == nullptr) return; AiPath::iterator it; diff --git a/engine/server/library/serverGame/src/shared/ai/AiMovementPatrol.cpp b/engine/server/library/serverGame/src/shared/ai/AiMovementPatrol.cpp index 4ea6a593..c4c73b88 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiMovementPatrol.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiMovementPatrol.cpp @@ -60,7 +60,7 @@ AiMovementPatrol::AiMovementPatrol( AICreatureController * controller, std::vect m_patrolPointIndex(startPoint) { ServerObject * owner = safe_cast(controller->getOwner()); - if (owner != NULL) + if (owner != nullptr) { DEBUG_REPORT_LOG(ConfigServerGame::isAiLoggingEnabled(), ("AiMovementPatrol creating named path for %s\n", owner->getNetworkId().getValueString().c_str())); @@ -98,7 +98,7 @@ AiMovementPatrol::AiMovementPatrol( AICreatureController * controller, std::vect { const Unicode::String & pointName = *i; const CityPathNode * node = CityPathGraphManager::getNamedNodeFor(*owner, pointName); - if (node != NULL) + if (node != nullptr) { m_patrolPath.push_back(AiLocation(node->getSourceId())); } @@ -118,16 +118,16 @@ AiMovementPatrol::AiMovementPatrol( AICreatureController * controller, std::vect // try an find a node on the path that is a previous root node, or isn't // being used in any other path std::vector::iterator i; - const ServerObject * node = NULL; - const ServerObject * root = NULL; + const ServerObject * node = nullptr; + const ServerObject * root = nullptr; for (i = m_patrolPath.begin(); i != m_patrolPath.end(); ++i) { node = safe_cast(i->getObject()); - if (node != NULL) + if (node != nullptr) { if (node->isPatrolPathRoot()) { - if (root == NULL || !root->isPatrolPathRoot()) + if (root == nullptr || !root->isPatrolPathRoot()) { // if we already have a set up root node, use that root = node; @@ -135,18 +135,18 @@ AiMovementPatrol::AiMovementPatrol( AICreatureController * controller, std::vect else { // we've got two previous root nodes, we can't connect them - root = NULL; + root = nullptr; break; } } - else if (!node->isPatrolPathNode() && root == NULL) + else if (!node->isPatrolPathNode() && root == nullptr) { // found a free node root = node; } } } - if (root != NULL) + if (root != nullptr) { // set up the root node if (!root->isPatrolPathRoot()) @@ -156,7 +156,7 @@ AiMovementPatrol::AiMovementPatrol( AICreatureController * controller, std::vect for (i = m_patrolPath.begin(); i != m_patrolPath.end(); ++i) { node = safe_cast(i->getObject()); - if (node != NULL && node != root) + if (node != nullptr && node != root) const_cast(node)->setPatrolPathRoot(*root); } const_cast(root)->addPatrolPathingObject(*owner); @@ -167,7 +167,7 @@ AiMovementPatrol::AiMovementPatrol( AICreatureController * controller, std::vect for (i = m_patrolPath.begin(); i != m_patrolPath.end(); ++i) { node = safe_cast(i->getObject()); - if (node != NULL) + if (node != nullptr) nodes += node->getNetworkId().getValueString() + " "; } WARNING(true, ("AiMovementPatrol unable to find root node for path: %s", nodes.c_str())); @@ -266,15 +266,15 @@ void AiMovementPatrol::getDebugInfo ( std::string & outString ) const void AiMovementPatrol::endBehavior() { - if (!m_patrolPath.empty() && m_controller != NULL) + if (!m_patrolPath.empty() && m_controller != nullptr) { const ServerObject * owner = safe_cast(m_controller->getOwner()); - if (owner != NULL) + if (owner != nullptr) { for (std::vector::iterator i = m_patrolPath.begin(); i != m_patrolPath.end(); ++i) { const ServerObject * node = safe_cast(i->getObject()); - if (node != NULL && node->isPatrolPathRoot()) + if (node != nullptr && node->isPatrolPathRoot()) { const_cast(node)->removePatrolPathingObject(*owner); break; @@ -304,7 +304,7 @@ bool AiMovementPatrol::getHibernateOk() const if (!m_patrolPath.empty()) { const ServerObject * node = safe_cast(m_patrolPath.front().getObject()); - if (node != NULL) + if (node != nullptr) { return node->getPatrolPathObservers() == 0; } diff --git a/engine/server/library/serverGame/src/shared/ai/AiMovementSwarm.cpp b/engine/server/library/serverGame/src/shared/ai/AiMovementSwarm.cpp index 52a3e701..f9593a06 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiMovementSwarm.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiMovementSwarm.cpp @@ -104,10 +104,10 @@ void AiMovementSwarm::alter ( float time ) } // update the offset from our target we want to go to - if (m_target.getObject() != NULL) + if (m_target.getObject() != nullptr) { const CreatureObject * owner = m_controller->getCreature(); - if (owner != NULL) + if (owner != nullptr) { offsetMap::const_iterator found = s_offsetMap.find(CachedNetworkId(*owner)); if (found != s_offsetMap.end()) @@ -179,7 +179,7 @@ AiStateResult AiMovementSwarm::triggerWaiting() { // note: don't use the m_target position function, because it includes the offset position const Object * target = m_target.getObject(); - if (target != NULL) + if (target != nullptr) m_controller->turnToward(target->getParentCell(), target->getPosition_p()); return AiMovementFollow::triggerWaiting(); } @@ -196,7 +196,7 @@ void AiMovementSwarm::init() const CreatureObject * creatureOwner = m_controller->getCreature(); const CreatureObject * creatureTarget = CreatureObject::asCreatureObject(m_target.getObject()); - if (creatureOwner != NULL && creatureTarget != NULL) + if (creatureOwner != nullptr && creatureTarget != nullptr) { CreatureWatcher watchedCreature(creatureOwner); targetMap::iterator found = s_swarmMap.find(CachedNetworkId(*creatureTarget)); @@ -226,7 +226,7 @@ void AiMovementSwarm::cleanup() // note: using static_cast instead of safe_cast because the owner may be in the process of being destructed const CreatureObject * owner = static_cast(m_controller->getOwner()); const CreatureObject * target = static_cast(m_target.getObject()); - if (owner != NULL && target != NULL) + if (owner != nullptr && target != nullptr) { targetMap::iterator found = s_swarmMap.find(CachedNetworkId(*target)); if (found != s_swarmMap.end()) @@ -258,7 +258,7 @@ void AiMovementSwarm::computeGoals() for (targetMap::iterator i = s_swarmMap.begin(); i != s_swarmMap.end();) { const CreatureObject * target = CreatureObject::asCreatureObject((*i).first.getObject()); - if (target != NULL && !target->isDead()) + if (target != nullptr && !target->isDead()) { computeGoals(*target, (*i).second); if ((*i).second.empty()) @@ -294,16 +294,16 @@ void AiMovementSwarm::computeGoals(const CreatureObject & target, std::vectorgetController()); - if (controller != NULL) + if (controller != nullptr) swarmMovement = dynamic_cast(controller->getCurrentMovement()); } - if (mover == NULL || mover->isDead()) + if (mover == nullptr || mover->isDead()) { // dump the mover from our list --count; @@ -314,7 +314,7 @@ void AiMovementSwarm::computeGoals(const CreatureObject & target, std::vectorisDead()) + if (blocker == nullptr || blocker->isDead()) { continue; } @@ -361,7 +361,7 @@ void AiMovementSwarm::computeGoals(const CreatureObject & target, std::vectorasServerObject() != NULL) + if (o != nullptr && o->asServerObject() != nullptr) { // if the target is a player, don't hibernate if (o->asServerObject()->isPlayerControlled()) hibernate = false; // hibernate if who we're following is hibernating - else if (o->asServerObject()->asCreatureObject() != NULL) + else if (o->asServerObject()->asCreatureObject() != nullptr) hibernate = (safe_cast(o->getController()))->getHibernate(); } else @@ -114,7 +114,7 @@ static const AiMovementTarget * preventRecurse = NULL; // clean up recusion checkers if (preventRecurse == this) - preventRecurse = NULL; + preventRecurse = nullptr; --recursionCount; return hibernate; } diff --git a/engine/server/library/serverGame/src/shared/ai/AiMovementWanderInterior.cpp b/engine/server/library/serverGame/src/shared/ai/AiMovementWanderInterior.cpp index 24a4c66a..a5fe327d 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiMovementWanderInterior.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiMovementWanderInterior.cpp @@ -82,23 +82,23 @@ bool AiMovementWanderInterior::updateWaypoint ( void ) { CreatureObject const * creature = m_controller->getCreature(); - if(creature == NULL) return false; + if(creature == nullptr) return false; CellProperty const * cell = creature->getParentCell(); - if(cell == NULL) return false; + if(cell == nullptr) return false; Floor const * floor = cell->getFloor(); - if(floor == NULL) return false; + if(floor == nullptr) return false; FloorMesh const * floorMesh = floor->getFloorMesh(); - if(floorMesh == NULL) return false; + if(floorMesh == nullptr) return false; PathGraph const * graph = safe_cast(floorMesh->getPathGraph()); - if(graph == NULL) return false; + if(graph == nullptr) return false; // ---------- @@ -107,11 +107,11 @@ bool AiMovementWanderInterior::updateWaypoint ( void ) if(closestIndex == -2) { const CellObject *cellObject = dynamic_cast(&cell->getOwner()); - const BuildingObject *building = (cellObject ? cellObject->getOwnerBuilding() : NULL); + const BuildingObject *building = (cellObject ? cellObject->getOwnerBuilding() : nullptr); Vector creaturePosition = creature->getPosition_w(); LOG("building-data-error",("Building id=%s has no path data but creature id=%s at (x=%.2f,y=%.2f,z=%.2f) requires it for wandering, stopping behavior.", - (building ? building->getNetworkId().getValueString().c_str() : ""), + (building ? building->getNetworkId().getValueString().c_str() : ""), creature->getNetworkId().getValueString().c_str(), creaturePosition.x, creaturePosition.y, @@ -132,7 +132,7 @@ bool AiMovementWanderInterior::updateWaypoint ( void ) { PathNode const * closestNode = graph->getNode(closestIndex); - if(closestNode != NULL) + if(closestNode != nullptr) { m_target = AiLocation(m_controller->getCreatureCell(),closestNode->getPosition_p()); diff --git a/engine/server/library/serverGame/src/shared/ai/AiMovementWaypoint.cpp b/engine/server/library/serverGame/src/shared/ai/AiMovementWaypoint.cpp index 3b2b123e..c92d3100 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiMovementWaypoint.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiMovementWaypoint.cpp @@ -34,7 +34,7 @@ float computeMovementModifier (CreatureObject * const object) { if (!object) { - DEBUG_FATAL(true, ("object is NULL.")); + DEBUG_FATAL(true, ("object is nullptr.")); return 0.0f; } @@ -81,7 +81,7 @@ float computeMovementModifier (CreatureObject * const object) // if the creature has a slope effect property, see if it has a greater // (more negative) effect on the creature than the terrain const Property * property = object->getProperty(SlopeEffectProperty::getClassPropertyId()); - if (property != NULL) + if (property != nullptr) { // note we use the creature's base speed modifier, not the one modified by skills // (although for ai they're probably the same) diff --git a/engine/server/library/serverGame/src/shared/ai/AiTargetingSystem.cpp b/engine/server/library/serverGame/src/shared/ai/AiTargetingSystem.cpp index 2afac7bc..050263d3 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiTargetingSystem.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiTargetingSystem.cpp @@ -94,7 +94,7 @@ bool AiTargetingSystem::canAttackTarget(TangibleObject const * target) { bool result = false; - if (target != NULL) + if (target != nullptr) { if ( (m_owner.getDistanceBetweenCollisionSpheres_w(*target) <= ConfigServerGame::getMaxCombatRange()) && m_owner.checkLOSTo(*target)) diff --git a/engine/server/library/serverGame/src/shared/ai/Formation.cpp b/engine/server/library/serverGame/src/shared/ai/Formation.cpp index 713d9b00..415989a2 100755 --- a/engine/server/library/serverGame/src/shared/ai/Formation.cpp +++ b/engine/server/library/serverGame/src/shared/ai/Formation.cpp @@ -128,8 +128,8 @@ void Formation::build(Squad & squad) DEBUG_FATAL(squad.isEmpty(), ("Building a formation on an empty squad.")); Object const * const leaderObject = squad.getLeader().getObject(); - CollisionProperty const * const leaderCollisionProperty = (leaderObject != NULL) ? leaderObject->getCollisionProperty() : NULL; - float const leaderRadius = (leaderCollisionProperty != NULL) ? (leaderCollisionProperty->getBoundingSphere_l().getRadius() * 2.0f) : 1.0f; + CollisionProperty const * const leaderCollisionProperty = (leaderObject != nullptr) ? leaderObject->getCollisionProperty() : nullptr; + float const leaderRadius = (leaderCollisionProperty != nullptr) ? (leaderCollisionProperty->getBoundingSphere_l().getRadius() * 2.0f) : 1.0f; int slotIndex = 0; Squad::UnitMap const & unitSet = squad.getUnitMap(); diff --git a/engine/server/library/serverGame/src/shared/ai/HateList.cpp b/engine/server/library/serverGame/src/shared/ai/HateList.cpp index d57fc5cb..496fb2b9 100755 --- a/engine/server/library/serverGame/src/shared/ai/HateList.cpp +++ b/engine/server/library/serverGame/src/shared/ai/HateList.cpp @@ -41,8 +41,8 @@ // ---------------------------------------------------------------------- HateList::HateList() - : m_owner(NULL) - , m_playerObject(NULL) + : m_owner(nullptr) + , m_playerObject(nullptr) , m_hateList() , m_target(CachedNetworkId::cms_cachedInvalid) , m_maxHate(0.0f) @@ -56,8 +56,8 @@ HateList::HateList() HateList::~HateList() { clear(); - m_owner = NULL; - m_playerObject = NULL; + m_owner = nullptr; + m_playerObject = nullptr; } // ---------------------------------------------------------------------- @@ -119,7 +119,7 @@ bool HateList::addHate(NetworkId const & target, float const hate) // If a target AI has a master, the target and the master needs to be added to the hate list (ie. pets should cause their master to gain hate) { CreatureObject const * const targetCreatureObject = CreatureObject::asCreatureObject(targetObject); - NetworkId const & masterId = (targetCreatureObject != NULL) ? targetCreatureObject->getMasterId() : NetworkId::cms_invalid; + NetworkId const & masterId = (targetCreatureObject != nullptr) ? targetCreatureObject->getMasterId() : NetworkId::cms_invalid; if (masterId != NetworkId::cms_invalid) { @@ -274,7 +274,7 @@ bool HateList::removeTarget(NetworkId const & target) { AggroListProperty * const aggroList = AggroListProperty::getAggroListProperty(*m_owner); - if (aggroList != NULL) + if (aggroList != nullptr) { aggroList->addTarget(target); } @@ -301,7 +301,7 @@ bool HateList::isValidTarget(Object * const target) bool valid = true; TangibleObject * const targetTangibleObject = TangibleObject::asTangibleObject(target); - if (targetTangibleObject == NULL) + if (targetTangibleObject == nullptr) { LOGC(AiLogManager::isLogging(m_owner->getNetworkId()), "debug_ai", ("HateList::isValidTarget() owner(%s:%s) TARGET IS NOT A TANGIBLEOBJECT", m_owner->getNetworkId().getValueString().c_str(), FileNameUtils::get(m_owner->getDebugName(), FileNameUtils::fileName).c_str())); valid = false; @@ -334,7 +334,7 @@ bool HateList::isValidTarget(Object * const target) { CreatureObject const * const targetCreatureObject = targetTangibleObject->asCreatureObject(); - if (targetCreatureObject != NULL) + if (targetCreatureObject != nullptr) { if (targetTangibleObject->isDisabled()) { @@ -355,7 +355,7 @@ bool HateList::isValidTarget(Object * const target) { AICreatureController const * const targetAiCreatureController = AICreatureController::asAiCreatureController(targetCreatureObject->getController()); - if ( (targetAiCreatureController != NULL) + if ( (targetAiCreatureController != nullptr) && targetAiCreatureController->isRetreating()) { LOGC(AiLogManager::isLogging(m_owner->getNetworkId()), "debug_ai", ("HateList::isValidTarget() owner(%s:%s) TARGET IS RETREATING", m_owner->getNetworkId().getValueString().c_str(), FileNameUtils::get(m_owner->getDebugName(), FileNameUtils::fileName).c_str())); @@ -370,7 +370,7 @@ bool HateList::isValidTarget(Object * const target) // themselves towards the player so that they and the player // enter combat correctly. { - if ( (m_owner->asCreatureObject() != NULL) + if ( (m_owner->asCreatureObject() != nullptr) && !Pvp::canAttack(*m_owner, *targetTangibleObject)) { LOGC(AiLogManager::isLogging(m_owner->getNetworkId()), "debug_ai", ("HateList::isValidTarget() owner(%s:%s) PVP CAN'T ATTACK", m_owner->getNetworkId().getValueString().c_str(), FileNameUtils::get(m_owner->getDebugName(), FileNameUtils::fileName).c_str())); @@ -393,7 +393,7 @@ CachedNetworkId const & HateList::getTarget() const if ( (m_target.get() == CachedNetworkId::cms_cachedInvalid) && !isEmpty()) { - WARNING(true, ("HateList::getTarget() owner(%s) m_hateList.size(%u) m_target is NULL but the HateList is not empty.", m_owner->getDebugInformation().c_str(), m_hateList.size())); + WARNING(true, ("HateList::getTarget() owner(%s) m_hateList.size(%u) m_target is nullptr but the HateList is not empty.", m_owner->getDebugInformation().c_str(), m_hateList.size())); } #endif // _DEBUG @@ -458,7 +458,7 @@ void HateList::findNewTarget() for (; iterHateList != m_hateList.end(); ++iterHateList) { - if (iterHateList->first.getObject() == NULL) + if (iterHateList->first.getObject() == nullptr) { // This target will be removed in the next alter call continue; @@ -510,11 +510,11 @@ void HateList::setTarget(CachedNetworkId const & target, float const hate) #ifdef _DEBUG // We should only have tangible objects in our target list - if (m_target.get().getObject() != NULL) + if (m_target.get().getObject() != nullptr) { TangibleObject const * const targetTangibleObject = TangibleObject::asTangibleObject(m_target.get().getObject()->asServerObject()); - if (targetTangibleObject == NULL) + if (targetTangibleObject == nullptr) { WARNING(true, ("HateList::setTarget() owner(%s) How did we get a target(%s) that is not a TangibleObject", m_owner->getDebugInformation().c_str(), m_target.get().getObject()->getDebugInformation().c_str())); } @@ -559,7 +559,7 @@ void HateList::triggerTargetChanged(NetworkId const & target) { GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(m_owner); - if (gameScriptObject != NULL) + if (gameScriptObject != nullptr) { LOGC(AiLogManager::isLogging(m_owner->getNetworkId()), "debug_ai", ("HateList::triggerTargetChanged() owner(%s:%s) target(%s)", m_owner->getNetworkId().getValueString().c_str(), FileNameUtils::get(m_owner->getDebugName(), FileNameUtils::fileName).c_str(), target.getValueString().c_str())); @@ -578,7 +578,7 @@ void HateList::triggerTargetAdded(NetworkId const & target) { GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(m_owner); - if (gameScriptObject != NULL) + if (gameScriptObject != nullptr) { LOGC(AiLogManager::isLogging(m_owner->getNetworkId()), "debug_ai", ("HateList::triggerTargetAdded() owner(%s:%s) target(%s)", m_owner->getNetworkId().getValueString().c_str(), FileNameUtils::get(m_owner->getDebugName(), FileNameUtils::fileName).c_str(), target.getValueString().c_str())); @@ -597,7 +597,7 @@ void HateList::triggerTargetRemoved(NetworkId const & target) { GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(m_owner); - if (gameScriptObject != NULL) + if (gameScriptObject != nullptr) { LOGC(AiLogManager::isLogging(m_owner->getNetworkId()), "debug_ai", ("HateList::triggerTargetRemoved() owner(%s:%s) target(%s)", m_owner->getNetworkId().getValueString().c_str(), FileNameUtils::get(m_owner->getDebugName(), FileNameUtils::fileName).c_str(), target.getValueString().c_str())); @@ -628,7 +628,7 @@ int HateList::getAutoExpireTargetDuration() const bool HateList::isOwnerValid() const { CreatureObject const * const ownerCreature = CreatureObject::asCreatureObject(m_owner); - bool const ownerIncapacitated = (ownerCreature != NULL) ? ownerCreature->isIncapacitated() : false; + bool const ownerIncapacitated = (ownerCreature != nullptr) ? ownerCreature->isIncapacitated() : false; if (ownerIncapacitated) { @@ -636,7 +636,7 @@ bool HateList::isOwnerValid() const return false; } - bool const ownerDead = (ownerCreature != NULL) ? ownerCreature->isDead() : false; + bool const ownerDead = (ownerCreature != nullptr) ? ownerCreature->isDead() : false; if (ownerDead) { @@ -644,7 +644,7 @@ bool HateList::isOwnerValid() const return false; } - bool const ownerDisabled = (ownerCreature != NULL) ? ownerCreature->isDisabled() : false; + bool const ownerDisabled = (ownerCreature != nullptr) ? ownerCreature->isDisabled() : false; if (ownerDisabled) { @@ -653,7 +653,7 @@ bool HateList::isOwnerValid() const } AICreatureController const * const ownerAiCreatureController = AICreatureController::asAiCreatureController(m_owner->getController()); - const bool ownerRetreating = (ownerAiCreatureController != NULL) ? ownerAiCreatureController->isRetreating() : false; + const bool ownerRetreating = (ownerAiCreatureController != nullptr) ? ownerAiCreatureController->isRetreating() : false; if (ownerRetreating) { @@ -752,11 +752,11 @@ void HateList::forceHateTarget(const NetworkId &target) #ifdef _DEBUG // We should only have tangible objects in our target list - if (m_target.get().getObject() != NULL) + if (m_target.get().getObject() != nullptr) { TangibleObject const * const targetTangibleObject = TangibleObject::asTangibleObject(m_target.get().getObject()->asServerObject()); - if (targetTangibleObject == NULL) + if (targetTangibleObject == nullptr) { WARNING(true, ("HateList::setTarget() owner(%s) How did we get a target(%s) that is not a TangibleObject", m_owner->getDebugInformation().c_str(), m_target.get().getObject()->getDebugInformation().c_str())); } diff --git a/engine/server/library/serverGame/src/shared/ai/HateList.h b/engine/server/library/serverGame/src/shared/ai/HateList.h index c4f1b761..38a3a685 100755 --- a/engine/server/library/serverGame/src/shared/ai/HateList.h +++ b/engine/server/library/serverGame/src/shared/ai/HateList.h @@ -99,7 +99,7 @@ private: inline bool HateList::isOwnerPlayer() const { - return (m_playerObject != NULL); + return (m_playerObject != nullptr); } // ====================================================================== diff --git a/engine/server/library/serverGame/src/shared/ai/Squad.cpp b/engine/server/library/serverGame/src/shared/ai/Squad.cpp index caced74f..b4a23b20 100755 --- a/engine/server/library/serverGame/src/shared/ai/Squad.cpp +++ b/engine/server/library/serverGame/src/shared/ai/Squad.cpp @@ -380,7 +380,7 @@ void Squad::buildFormation() { NetworkId const & unit = iterUnitMap->first; PersistentCrcString const * unitName = iterUnitMap->second; - DEBUG_FATAL((unitName == NULL), ("The unit should have a non-null name.")); + DEBUG_FATAL((unitName == nullptr), ("The unit should have a non-nullptr name.")); if (unit == m_leader) { @@ -401,7 +401,7 @@ void Squad::buildFormation() #ifdef DEBUG Object * const unitObject = NetworkIdManager::getObjectById(unit); DEBUG_WARNING(true, ("className(%s) Unable to find the ship(%s) [%s] in the formation priority list.", - getClassName(), unitName->getString(), unitObject ? unitObject->getDebugInformation().c_str() : "NULL")); + getClassName(), unitName->getString(), unitObject ? unitObject->getDebugInformation().c_str() : "nullptr")); #endif } @@ -463,7 +463,7 @@ void Squad::calculateSquadPosition_w() Object * const object = NetworkIdManager::getObjectById(unit); - if (object != NULL) + if (object != nullptr) { m_squadPosition_w += object->getPosition_w(); } diff --git a/engine/server/library/serverGame/src/shared/behavior/AiCreatureStateArchive.cpp b/engine/server/library/serverGame/src/shared/behavior/AiCreatureStateArchive.cpp index 08bba97e..b6c5690b 100755 --- a/engine/server/library/serverGame/src/shared/behavior/AiCreatureStateArchive.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/AiCreatureStateArchive.cpp @@ -28,15 +28,15 @@ namespace Archive #ifdef _DEBUG Object * const object = NetworkIdManager::getObjectById(target.m_networkId); - if (object == NULL) + if (object == nullptr) { WARNING(true, ("AiCreatureStateArchive::get() Unable to resolve networkId(%s) to an Object", target.m_networkId.getValueString().c_str())); return; } - AICreatureController * const controller = (object != NULL) ? AICreatureController::asAiCreatureController(object->getController()) : NULL; + AICreatureController * const controller = (object != nullptr) ? AICreatureController::asAiCreatureController(object->getController()) : nullptr; - if (controller == NULL) + if (controller == nullptr) { WARNING(true, ("AiCreatureStateArchive::get() Message to object(%s) that does not have an AICreatureController", object->getDebugInformation().c_str())); return; diff --git a/engine/server/library/serverGame/src/shared/behavior/AiLocation.cpp b/engine/server/library/serverGame/src/shared/behavior/AiLocation.cpp index 885657b9..d73f1f43 100755 --- a/engine/server/library/serverGame/src/shared/behavior/AiLocation.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/AiLocation.cpp @@ -43,9 +43,9 @@ namespace AiLocationArchive AiLocation::AiLocation ( void ) : m_valid(false), m_attached(false), - m_object(NULL), + m_object(nullptr), m_objectId(), - m_cellObject(NULL), + m_cellObject(nullptr), m_position_p(Vector::zero), m_position_w(Vector::zero), m_radius(0.0f), @@ -60,9 +60,9 @@ AiLocation::AiLocation ( void ) AiLocation::AiLocation ( CellProperty const * cell, Vector const & position, float radius ) : m_valid(true), m_attached(false), - m_object(NULL), + m_object(nullptr), m_objectId(), - m_cellObject(cell ? &cell->getOwner() : NULL), + m_cellObject(cell ? &cell->getOwner() : nullptr), m_position_p(position), m_position_w(CollisionUtils::transformToWorld(cell,position)), m_radius(radius), @@ -78,9 +78,9 @@ AiLocation::AiLocation ( CellProperty const * cell, Vector const & position, flo AiLocation::AiLocation ( NetworkId const & cellId, Vector const & position, float radius ) : m_valid(true), m_attached(false), - m_object(NULL), + m_object(nullptr), m_objectId(), - m_cellObject(NULL), + m_cellObject(nullptr), m_position_p(position), m_position_w(position), m_radius(radius), @@ -110,9 +110,9 @@ AiLocation::AiLocation ( NetworkId const & cellId, Vector const & position, floa AiLocation::AiLocation ( Object const * object ) : m_valid(true), m_attached(true), - m_object(NULL), + m_object(nullptr), m_objectId(), - m_cellObject(NULL), + m_cellObject(nullptr), m_position_p(Vector::zero), m_position_w(Vector::zero), m_radius(0.0f), @@ -129,9 +129,9 @@ AiLocation::AiLocation ( Object const * object ) AiLocation::AiLocation ( NetworkId const & objectId ) : m_valid(true), m_attached(true), - m_object(NULL), + m_object(nullptr), m_objectId(), - m_cellObject(NULL), + m_cellObject(nullptr), m_position_p(Vector::zero), m_position_w(Vector::zero), m_radius(0.0f), @@ -148,9 +148,9 @@ AiLocation::AiLocation ( NetworkId const & objectId ) AiLocation::AiLocation ( Object const * object, Vector const & offset, bool relativeOffset ) : m_valid(true), m_attached(true), - m_object(NULL), + m_object(nullptr), m_objectId(), - m_cellObject(NULL), + m_cellObject(nullptr), m_position_p(Vector::zero), m_position_w(Vector::zero), m_radius(0.0f), @@ -167,9 +167,9 @@ AiLocation::AiLocation ( Object const * object, Vector const & offset, bool rela AiLocation::AiLocation ( NetworkId const & objectId, Vector const & offset, bool relativeOffset ) : m_valid(true), m_attached(true), - m_object(NULL), + m_object(nullptr), m_objectId(), - m_cellObject(NULL), + m_cellObject(nullptr), m_position_p(Vector::zero), m_position_w(Vector::zero), m_radius(0.0f), @@ -365,7 +365,7 @@ void AiLocation::setObject ( Object const * object ) { if(m_attached) { - if (object == NULL) + if (object == nullptr) { clear(); return; @@ -385,7 +385,7 @@ void AiLocation::setObject ( Object const * object ) void AiLocation::detach ( void ) { - m_object = NULL; + m_object = nullptr; m_objectId = NetworkId::cms_invalid; m_attached = false; } @@ -394,7 +394,7 @@ void AiLocation::detach ( void ) CellProperty const * AiLocation::getCell ( void ) const { - return m_cellObject ? m_cellObject->getCellProperty() : NULL; + return m_cellObject ? m_cellObject->getCellProperty() : nullptr; } // ---------- @@ -424,7 +424,7 @@ bool AiLocation::hasChanged ( void ) const Vector AiLocation::getPosition_p ( void ) const { - if(m_cellObject.getPointer() == NULL) + if(m_cellObject.getPointer() == nullptr) { WARNING(ConfigServerGame::getReportAiWarnings(),("AiLocation::getPosition_p - Locations's parent cell has disappeared\n")); @@ -572,8 +572,8 @@ void AiLocation::clear ( void ) m_valid = false; m_attached = false; - m_object = NULL; - m_cellObject = NULL; + m_object = nullptr; + m_cellObject = nullptr; m_position_p = Vector::zero; m_radius = 0.0f; m_offset_p = Vector::zero; @@ -585,7 +585,7 @@ void AiLocation::clear ( void ) bool AiLocation::isInWorldCell ( void ) const { - return isValid() && ( (getCell() == NULL) || (getCell() == CellProperty::getWorldCellProperty()) ); + return isValid() && ( (getCell() == nullptr) || (getCell() == CellProperty::getWorldCellProperty()) ); } @@ -599,7 +599,7 @@ bool AiLocation::validate ( void ) const TerrainObject * terrain = TerrainObject::getInstance(); - if(terrain == NULL) return true; + if(terrain == nullptr) return true; float w = terrain->getMapWidthInMeters() / 2.0f; diff --git a/engine/server/library/serverGame/src/shared/behavior/AiShipAttackTargetList.cpp b/engine/server/library/serverGame/src/shared/behavior/AiShipAttackTargetList.cpp index 08958488..9af5e0c8 100755 --- a/engine/server/library/serverGame/src/shared/behavior/AiShipAttackTargetList.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/AiShipAttackTargetList.cpp @@ -159,7 +159,7 @@ void AiShipAttackTargetList::add(ShipObject & unit, float const damage) AiShipController * const ownerAiShipController = AiShipController::asAiShipController(m_owner->getController()); - if (ownerAiShipController != NULL) + if (ownerAiShipController != nullptr) { if (!ownerAiShipController->isValidTarget(unit)) { @@ -204,7 +204,7 @@ void AiShipAttackTargetList::add(ShipObject & unit, float const damage) ShipController * const attackingUnitShipController = unit.getController()->asShipController(); - if (attackingUnitShipController != NULL) + if (attackingUnitShipController != nullptr) { attackingUnitShipController->addAiTargetingMe(m_owner->getNetworkId()); } @@ -217,7 +217,7 @@ void AiShipAttackTargetList::add(ShipObject & unit, float const damage) // ---------------------------------------------------------------------- bool AiShipAttackTargetList::remove(NetworkId const & unit, bool const inDestructorHack) { - DEBUG_FATAL((unit == NetworkId::cms_invalid), ("Removing a NULL unit")); + DEBUG_FATAL((unit == NetworkId::cms_invalid), ("Removing a nullptr unit")); bool result = false; @@ -238,11 +238,11 @@ bool AiShipAttackTargetList::remove(NetworkId const & unit, bool const inDestruc // Tell this unit that we are no longer targeting it - if (object != NULL) + if (object != nullptr) { ShipController * const shipController = object->getController()->asShipController(); - if (shipController != NULL) + if (shipController != nullptr) { shipController->removeAiTargetingMe(m_owner->getNetworkId()); } @@ -398,12 +398,12 @@ void AiShipAttackTargetList::findNewPrimaryTarget() // We should only have ship objects in our target list - if (m_primaryTarget.getObject() != NULL) + if (m_primaryTarget.getObject() != nullptr) { ServerObject * const targetServerObject = m_primaryTarget.getObject()->asServerObject(); - ShipObject * const targetShipObject = (targetServerObject != NULL) ? targetServerObject->asShipObject() : NULL; + ShipObject * const targetShipObject = (targetServerObject != nullptr) ? targetServerObject->asShipObject() : nullptr; - if (targetShipObject == NULL) + if (targetShipObject == nullptr) { DEBUG_WARNING(true, ("debug_ai: AiShipAttackTargetList::findNewPrimaryTarget() ERROR: How did we get a target that is not a ShipObject (%s)", m_primaryTarget.getObject()->getDebugInformation().c_str())); } @@ -444,7 +444,7 @@ void AiShipAttackTargetList::verify() AiShipController * const ownerAiShipController = AiShipController::asAiShipController(m_owner->getController()); - if (ownerAiShipController != NULL) + if (ownerAiShipController != nullptr) { if (ownerAiShipController->hasExclusiveAggros()) { @@ -457,9 +457,9 @@ void AiShipAttackTargetList::verify() for (; iterTargetList != m_targetList->end(); ++iterTargetList) { ShipObject * const unitShipObject = ShipObject::asShipObject(iterTargetList->first.getObject()); - CreatureObject const * const unitPilot = (unitShipObject != NULL) ? unitShipObject->getPilot() : NULL; + CreatureObject const * const unitPilot = (unitShipObject != nullptr) ? unitShipObject->getPilot() : nullptr; - if ( (unitPilot == NULL) + if ( (unitPilot == nullptr) || !ownerAiShipController->isExclusiveAggro(*unitPilot)) { s_purgeList.push_back(unitShipObject->getNetworkId()); diff --git a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackBomber.cpp b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackBomber.cpp index 239342d3..58e90c58 100755 --- a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackBomber.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackBomber.cpp @@ -56,7 +56,7 @@ AiShipBehaviorAttackBomber::AiShipBehaviorAttackBomber(AiShipController & aiShip m_evadeChangeDirectionTimer(0.5f), m_missilesFired(0) { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackBomber::AiShipBehaviorAttackBomber() unit(%s)", (aiShipController.getOwner() != NULL) ? aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner")); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackBomber::AiShipBehaviorAttackBomber() unit(%s)", (aiShipController.getOwner() != nullptr) ? aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner")); } // ---------------------------------------------------------------------- @@ -73,7 +73,7 @@ AiShipBehaviorAttackBomber::AiShipBehaviorAttackBomber(AiShipBehaviorAttack cons m_evadeChangeDirectionTimer(0.5f), m_missilesFired(0) { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackBomber::AiShipBehaviorAttackBomber(AiShipBehaviorAttack &) unit(%s)", (m_aiShipController.getOwner() != NULL) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner")); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackBomber::AiShipBehaviorAttackBomber(AiShipBehaviorAttack &) unit(%s)", (m_aiShipController.getOwner() != nullptr) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner")); } // ---------------------------------------------------------------------- @@ -293,7 +293,7 @@ ShipObject const * AiShipBehaviorAttackBomber::getTargetCapitalShip() const return targetShipObject; } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackCapitalShip.cpp b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackCapitalShip.cpp index d771b837..a1fe30da 100755 --- a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackCapitalShip.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackCapitalShip.cpp @@ -19,7 +19,7 @@ AiShipBehaviorAttackCapitalShip::AiShipBehaviorAttackCapitalShip(AiShipController & aiShipController) : AiShipBehaviorAttack(aiShipController) { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackCapitalShip::AiShipBehaviorAttackCapitalShip() unit(%s)", (m_aiShipController.getOwner() != NULL) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner")); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackCapitalShip::AiShipBehaviorAttackCapitalShip() unit(%s)", (m_aiShipController.getOwner() != nullptr) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner")); } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackFighter.cpp b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackFighter.cpp index 166eda11..d43510a4 100755 --- a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackFighter.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackFighter.cpp @@ -145,7 +145,7 @@ Vector const AiShipBehaviorAttackFighter::calculateEvadePositionWithinLeashDista AiShipBehaviorAttackFighter::AiShipBehaviorAttackFighter(AiShipController & aiShipController) : AiShipBehaviorAttack(aiShipController) - , m_currentManeuver(NULL) + , m_currentManeuver(nullptr) , m_timeDelta(0.0f) , m_projectileTimer() , m_missileLockOnTimer() @@ -165,7 +165,7 @@ AiShipBehaviorAttackFighter::AiShipBehaviorAttackFighter(AiShipController & aiSh , m_shotErrorPosition_l() , m_nextShotPosition_w() { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackFighter::AiShipBehaviorAttackFighter() unit(%s)", (aiShipController.getOwner() != NULL) ? aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner")); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackFighter::AiShipBehaviorAttackFighter() unit(%s)", (aiShipController.getOwner() != nullptr) ? aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner")); initializeTimers(); calculateEvadeHealthPercent(); calculateNextProjectileShotPerfect(); @@ -178,7 +178,7 @@ AiShipBehaviorAttackFighter::AiShipBehaviorAttackFighter(AiShipController & aiSh AiShipBehaviorAttackFighter::AiShipBehaviorAttackFighter(AiShipBehaviorAttack const & sourceBehavior) : AiShipBehaviorAttack(sourceBehavior) - , m_currentManeuver(NULL) + , m_currentManeuver(nullptr) , m_timeDelta(0.0f) , m_projectileTimer() , m_missileLockOnTimer() @@ -198,7 +198,7 @@ AiShipBehaviorAttackFighter::AiShipBehaviorAttackFighter(AiShipBehaviorAttack co , m_shotErrorPosition_l() , m_nextShotPosition_w() { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackFighter::AiShipBehaviorAttackFighter() unit(%s)", (getAiShipController().getOwner() != NULL) ? getAiShipController().getOwner()->getNetworkId().getValueString().c_str() : "NULL owner")); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackFighter::AiShipBehaviorAttackFighter() unit(%s)", (getAiShipController().getOwner() != nullptr) ? getAiShipController().getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner")); initializeTimers(); calculateEvadeHealthPercent(); calculateNextProjectileShotPerfect(); @@ -214,7 +214,7 @@ AiShipBehaviorAttackFighter::~AiShipBehaviorAttackFighter() delete m_targetInfo; delete m_currentManeuver; - m_currentManeuver = NULL; + m_currentManeuver = nullptr; } // ---------------------------------------------------------------------- @@ -265,7 +265,7 @@ void AiShipBehaviorAttackFighter::alterManeuver() } else { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackFighter::alterManeuver() owner(%s) Why does this ship in the attack state with a NULL attack target?", getAiShipController().getOwner()->getNetworkId().getValueString().c_str())); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackFighter::alterManeuver() owner(%s) Why does this ship in the attack state with a nullptr attack target?", getAiShipController().getOwner()->getNetworkId().getValueString().c_str())); } if (overallHealthPercent > m_lastEvadeHealthPercent) @@ -347,7 +347,7 @@ void AiShipBehaviorAttackFighter::alterWeapons() if (!targetShipObject) { - DEBUG_WARNING(true, ("debug_ai: unit(%s) ERROR: Why is the primary attack target NULL?", getAiShipController().getShipOwner()->getDebugInformation().c_str())); + DEBUG_WARNING(true, ("debug_ai: unit(%s) ERROR: Why is the primary attack target nullptr?", getAiShipController().getShipOwner()->getDebugInformation().c_str())); return; } @@ -584,7 +584,7 @@ void AiShipBehaviorAttackFighter::alterTargetInformation() ShipObject & ownerShipObject = *NON_NULL(getAiShipController().getShipOwner()); ShipObject const * const targetShipObject = getAiShipController().getPrimaryAttackTargetShipObject(); - if (targetShipObject != NULL) + if (targetShipObject != nullptr) { //-- Set pilot data here. AiShipPilotData const * pilotData = NON_NULL(getAiShipController().getPilotData()); @@ -600,7 +600,7 @@ void AiShipBehaviorAttackFighter::alterTargetInformation() CreatureObject const * const targetPilot = targetShipObject->getPilot(); - m_targetInfo->m_playerControlled = (targetPilot != NULL) ? targetPilot->isPlayerControlled() : false; + m_targetInfo->m_playerControlled = (targetPilot != nullptr) ? targetPilot->isPlayerControlled() : false; // Cached target info. bool const includeMissiles = true; @@ -707,7 +707,7 @@ void AiShipBehaviorAttackFighter::alterTargetInformation() } else { - DEBUG_WARNING(true, ("debug_ai: unit(%s) ERROR: The primary attack target is NULL.", ownerShipObject.getDebugInformation().c_str())); + DEBUG_WARNING(true, ("debug_ai: unit(%s) ERROR: The primary attack target is nullptr.", ownerShipObject.getDebugInformation().c_str())); } } @@ -956,7 +956,7 @@ void AiShipBehaviorAttackFighter::calculateNextShotPosition_w() if (!targetShipObject) { - DEBUG_WARNING(true, ("debug_ai: unit(%s) ERROR: Why is the primary attack target NULL?", getAiShipController().getShipOwner()->getDebugInformation().c_str())); + DEBUG_WARNING(true, ("debug_ai: unit(%s) ERROR: Why is the primary attack target nullptr?", getAiShipController().getShipOwner()->getDebugInformation().c_str())); return; } @@ -1014,7 +1014,7 @@ void AiShipBehaviorAttackFighter::addDebug(AiDebugString & aiDebugString) AiShipBehaviorAttackFighter::Maneuver::Path const * path = m_currentManeuver->getCurrentPath(); char pathSizeText[256]; - if (path != NULL) + if (path != nullptr) { snprintf(pathSizeText, sizeof(pathSizeText) - 1, "PATH(%d)", path->getLength()); } @@ -1027,7 +1027,7 @@ void AiShipBehaviorAttackFighter::addDebug(AiDebugString & aiDebugString) // Show the current maneuver { - char const * const text = FormattedString<512>().sprintf("attack[%s%s%s] %d %s\n", AiDebugString::getColorCode(PackedRgb::solidWhite).c_str(), (m_currentManeuver != NULL) ? m_currentManeuver->getFighterManeuverString() : "NULL", AiDebugString::getResetColorCode(), (m_currentManeuver != NULL) ? m_currentManeuver->getSequenceId() : -1, pathSizeText); + char const * const text = FormattedString<512>().sprintf("attack[%s%s%s] %d %s\n", AiDebugString::getColorCode(PackedRgb::solidWhite).c_str(), (m_currentManeuver != nullptr) ? m_currentManeuver->getFighterManeuverString() : "nullptr", AiDebugString::getResetColorCode(), (m_currentManeuver != nullptr) ? m_currentManeuver->getSequenceId() : -1, pathSizeText); aiDebugString.addText(text, PackedRgb::solidCyan); } @@ -1060,7 +1060,7 @@ void AiShipBehaviorAttackFighter::addDebug(AiDebugString & aiDebugString) // Show the maneuver path - if ( (path != NULL) + if ( (path != nullptr) && !path->isEmpty()) { AiDebugString::TransformList transformList; diff --git a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackFighter_Maneuver.cpp b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackFighter_Maneuver.cpp index 17fa39ea..c3b9d975 100755 --- a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackFighter_Maneuver.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackFighter_Maneuver.cpp @@ -72,7 +72,7 @@ AiShipBehaviorAttackFighter::Maneuver::~Maneuver() delete m_pathList; - //m_currentPath = NULL; + //m_currentPath = nullptr; } // ---------------------------------------------------------------------- @@ -128,7 +128,7 @@ void AiShipBehaviorAttackFighter::Maneuver::addPath(Path * const path) AiShipBehaviorAttackFighter::Maneuver::Path * AiShipBehaviorAttackFighter::Maneuver::getCurrentPath() { - Path * currentPath = NULL; + Path * currentPath = nullptr; if (!m_pathList->empty() && m_currentPath != m_pathList->end()) { @@ -230,7 +230,7 @@ void AiShipBehaviorAttackFighter::Maneuver::alterThrottle(float const /*timeDelt AiShipBehaviorAttackFighter::Maneuver * AiShipBehaviorAttackFighter::Maneuver::createManeuver(FighterManeuver const manueverType, AiShipBehaviorAttackFighter & aiShipBehaviorAttack, AiAttackTargetInformation const & targetInfo) { - Maneuver * aiManeuver = NULL; + Maneuver * aiManeuver = nullptr; switch(manueverType) { @@ -298,7 +298,7 @@ public: ShipObject const * const primaryTargetShipObject = getAiShipController().getPrimaryAttackTargetShipObject(); - if (primaryTargetShipObject != NULL) + if (primaryTargetShipObject != nullptr) { float const ownerShipRadius = getAiShipController().getShipOwner()->getRadius(); float const ownerTurnRadius = getAiShipController().getLargestTurnRadius(); @@ -337,7 +337,7 @@ protected: ShipObject const * const primaryTargetShipObject = getAiShipController().getPrimaryAttackTargetShipObject(); - if (primaryTargetShipObject != NULL) + if (primaryTargetShipObject != nullptr) { bool const facingTarget = m_aiShipBehaviorAttack.isFacingTarget(); @@ -450,7 +450,7 @@ private: { ShipObject const * const primaryTargetShipObject = getAiShipController().getPrimaryAttackTargetShipObject(); - if (primaryTargetShipObject != NULL) + if (primaryTargetShipObject != nullptr) { AiShipPilotData const & pilotData = *NON_NULL(getAiShipController().getPilotData()); float const currentSpeed = getAiShipController().getShipOwner()->getCurrentSpeed(); @@ -665,11 +665,11 @@ private: { ShipObject const * const primaryTargetShipObject = getAiShipController().getPrimaryAttackTargetShipObject(); - if (primaryTargetShipObject!= NULL) + if (primaryTargetShipObject!= nullptr) { ShipController const * const targetShipController = primaryTargetShipObject->getController()->asShipController(); - if (targetShipController != NULL) + if (targetShipController != nullptr) { Transform transform; Vector velocity; diff --git a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorDock.cpp b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorDock.cpp index e8c1aede..f023331c 100755 --- a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorDock.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorDock.cpp @@ -66,7 +66,7 @@ AiShipBehaviorDock::AiShipBehaviorDock(ShipController & shipController, ShipObje , m_goalPosition_w() , m_wingsOpenedBeforeDock(m_shipController.getShipOwner()->hasWings() && m_shipController.getShipOwner()->wingsOpened()) { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipBehaviorDock: [1/6] unit(%s) dockTarget(%s) secondsAtDock(%.2f) landingHardPoint(%s)", (shipController.getOwner() != NULL) ? shipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner", dockTarget.getNetworkId().getValueString().c_str(), secondsAtDock, m_hasLandingHardPoint ? "yes" : "no")); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipBehaviorDock: [1/6] unit(%s) dockTarget(%s) secondsAtDock(%.2f) landingHardPoint(%s)", (shipController.getOwner() != nullptr) ? shipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner", dockTarget.getNetworkId().getValueString().c_str(), secondsAtDock, m_hasLandingHardPoint ? "yes" : "no")); if (m_shipController.isBeingDocked()) { @@ -119,7 +119,7 @@ AiShipBehaviorDock::AiShipBehaviorDock(ShipController & shipController, ShipObje ShipController * const dockTargetShipController = dockTarget.getController()->asShipController(); - if (dockTargetShipController != NULL) + if (dockTargetShipController != nullptr) { dockTargetShipController->addDockedBy(*shipController.getOwner()); } @@ -146,7 +146,7 @@ AiShipBehaviorDock::AiShipBehaviorDock(ShipController & shipController, ShipObje m_initialApproachHardPointCount = static_cast(m_approachHardPointList->size()); - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipBehaviorDock() unit(%s) dockTarget(%s) approachHardPointCount(%u) exitHardPointCount(%u)", (shipController.getOwner() != NULL) ? shipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner", dockTarget.getNetworkId().getValueString().c_str(), m_approachHardPointList->size(), m_exitHardPointList->size())); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipBehaviorDock() unit(%s) dockTarget(%s) approachHardPointCount(%u) exitHardPointCount(%u)", (shipController.getOwner() != nullptr) ? shipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner", dockTarget.getNetworkId().getValueString().c_str(), m_approachHardPointList->size(), m_exitHardPointList->size())); } // ---------------------------------------------------------------------- @@ -156,7 +156,7 @@ AiShipBehaviorDock::~AiShipBehaviorDock() // Open the wings - if ( (ownerShipObject != NULL) + if ( (ownerShipObject != nullptr) && m_wingsOpenedBeforeDock) { m_shipController.getShipOwner()->openWings(); @@ -168,7 +168,7 @@ AiShipBehaviorDock::~AiShipBehaviorDock() { CollisionCallbackManager::removeIgnoreIntersect(m_shipController.getOwner()->getNetworkId(), m_dockTarget); - if ( (ownerShipObject != NULL) + if ( (ownerShipObject != nullptr) && ownerShipObject->isPlayerShip()) { m_shipController.appendMessage(CM_removeIgnoreIntersect, 0.0f, new MessageQueueGenericValueType(m_dockTarget), GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_CLIENT); @@ -179,11 +179,11 @@ AiShipBehaviorDock::~AiShipBehaviorDock() Object * const dockTarget = m_dockTarget.getObject(); - if (dockTarget != NULL) + if (dockTarget != nullptr) { ShipController * const dockTargetShipController = dockTarget->getController()->asShipController(); - if (dockTargetShipController != NULL) + if (dockTargetShipController != nullptr) { dockTargetShipController->removeDockedBy(*m_shipController.getOwner()); } @@ -200,7 +200,7 @@ void AiShipBehaviorDock::alter(float deltaSeconds) bool abortDocking = false; - if (m_dockTarget.getObject() == NULL) + if (m_dockTarget.getObject() == nullptr) { // If we lose the dock target, fail the docking procedure. @@ -213,7 +213,7 @@ void AiShipBehaviorDock::alter(float deltaSeconds) AiShipController * const dockTargetAiShipController = AiShipController::asAiShipController(m_dockTarget.getObject()->getController()); - if ( (dockTargetAiShipController != NULL) + if ( (dockTargetAiShipController != nullptr) && dockTargetAiShipController->isAttacking()) { LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipBehaviorDock::alter() unit(%s) dockTarget(%s) DOCK TARGET IS ATTACKING...UNDOCKING", m_shipController.getOwner()->getDebugInformation().c_str(), m_dockTarget.getValueString().c_str())); @@ -478,7 +478,7 @@ void AiShipBehaviorDock::triggerDocked() GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(m_shipController.getOwner()); - if(gameScriptObject != NULL) + if(gameScriptObject != nullptr) { ScriptParams scriptParams; scriptParams.addParam(m_dockTarget); @@ -499,7 +499,7 @@ void AiShipBehaviorDock::triggerStartUnDock() GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(m_shipController.getOwner()); - if(gameScriptObject != NULL) + if(gameScriptObject != nullptr) { ScriptParams scriptParams; scriptParams.addParam(m_dockTarget); @@ -520,7 +520,7 @@ void AiShipBehaviorDock::triggerUnDockWithSuccess() GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(m_shipController.getOwner()); - if(gameScriptObject != NULL) + if(gameScriptObject != nullptr) { ScriptParams scriptParams; scriptParams.addParam(m_dockTarget); @@ -542,7 +542,7 @@ void AiShipBehaviorDock::triggerUnDockWithFailure() GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(m_shipController.getOwner()); - if(gameScriptObject != NULL) + if(gameScriptObject != nullptr) { ScriptParams scriptParams; scriptParams.addParam(m_dockTarget); @@ -622,7 +622,7 @@ float AiShipBehaviorDock::getMaxTractorBeamSpeed() const float const shipActualSpeedMaximum = m_shipController.getShipOwner()->getShipActualSpeedMaximum(); AiShipController * const aiShipController = m_shipController.asAiShipController(); - return (aiShipController != NULL) ? (shipActualSpeedMaximum * aiShipController->getPilotData()->m_nonCombatMaxSpeedPercent) : shipActualSpeedMaximum; + return (aiShipController != nullptr) ? (shipActualSpeedMaximum * aiShipController->getPilotData()->m_nonCombatMaxSpeedPercent) : shipActualSpeedMaximum; } // ---------------------------------------------------------------------- @@ -676,7 +676,7 @@ void AiShipBehaviorDock::addDebug(AiDebugString & aiDebugString) aiDebugString.addLineToPosition(m_goalPosition_w, PackedRgb::solidCyan); - if (m_dockTarget.getObject() != NULL) + if (m_dockTarget.getObject() != nullptr) { Transform transform; transform.multiply(m_dockTarget.getObject()->getTransform_o2w(), m_dockHardPoint); diff --git a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorFollow.cpp b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorFollow.cpp index dedc3fda..e8ca1bd5 100755 --- a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorFollow.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorFollow.cpp @@ -45,9 +45,9 @@ AiShipBehaviorFollow::AiShipBehaviorFollow(AiShipController & aiShipController, , m_followedUnit(followedUnit) , m_followedUnitLost(false) { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorFollow::AiShipBehaviorFollow() unit(%s) followedUnit(%s)", (m_aiShipController.getOwner() != NULL) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner", followedUnit.getValueString().c_str())); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorFollow::AiShipBehaviorFollow() unit(%s) followedUnit(%s)", (m_aiShipController.getOwner() != nullptr) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner", followedUnit.getValueString().c_str())); - DEBUG_WARNING((m_followedUnit.getObject() == NULL), ("Trying to follow a NULL object.")); + DEBUG_WARNING((m_followedUnit.getObject() == nullptr), ("Trying to follow a nullptr object.")); } // ---------------------------------------------------------------------- @@ -60,7 +60,7 @@ void AiShipBehaviorFollow::alter(float const deltaSeconds) Object * const followedUnitObject = m_followedUnit.getObject(); Vector goalPosition_w; - if (followedUnitObject != NULL) + if (followedUnitObject != nullptr) { goalPosition_w = Formation::getPosition_w(followedUnitObject->getTransform_o2w(), m_aiShipController.getFormationPosition_l()); @@ -69,9 +69,9 @@ void AiShipBehaviorFollow::alter(float const deltaSeconds) if (m_aiShipController.getOwner()->getPosition_w().magnitudeBetweenSquared(goalPosition_w) > sqr(m_aiShipController.getLargestTurnRadius() * slowDownRequestRadiusGain)) { ShipController * const shipController = followedUnitObject->getController()->asShipController(); - AiShipController * const aiShipController = (shipController != NULL) ? shipController->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipController != nullptr) ? shipController->asAiShipController() : nullptr; - if (aiShipController != NULL) + if (aiShipController != nullptr) { aiShipController->requestSlowDown(); } @@ -90,7 +90,7 @@ void AiShipBehaviorFollow::alter(float const deltaSeconds) Object const * const object = m_aiShipController.getOwner(); - if (object != NULL) + if (object != nullptr) { goalPosition_w = object->getPosition_w(); } @@ -109,10 +109,10 @@ void AiShipBehaviorFollow::alter(float const deltaSeconds) void AiShipBehaviorFollow::triggerFollowedUnitLost() { Object * object = m_aiShipController.getOwner(); - ServerObject *serverObject = (object != NULL) ? object->asServerObject() : NULL; - GameScriptObject * gameScriptObject = (serverObject != NULL) ? serverObject->getScriptObject() : NULL; + ServerObject *serverObject = (object != nullptr) ? object->asServerObject() : nullptr; + GameScriptObject * gameScriptObject = (serverObject != nullptr) ? serverObject->getScriptObject() : nullptr; - if(gameScriptObject != NULL) + if(gameScriptObject != nullptr) { ScriptParams scriptParams; scriptParams.addParam(m_followedUnit); diff --git a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorIdle.cpp b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorIdle.cpp index 14d8253c..1654e5c8 100755 --- a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorIdle.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorIdle.cpp @@ -25,7 +25,7 @@ AiShipBehaviorIdle::AiShipBehaviorIdle(AiShipController & aiShipController) : AiShipBehaviorBase(aiShipController) { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorIdle() unit(%s)", (m_aiShipController.getOwner() != NULL) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner")); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorIdle() unit(%s)", (m_aiShipController.getOwner() != nullptr) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner")); } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorTrack.cpp b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorTrack.cpp index 68a47863..c1aa8506 100755 --- a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorTrack.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorTrack.cpp @@ -27,7 +27,7 @@ AiShipBehaviorTrack::AiShipBehaviorTrack(AiShipController & aiShipController, Ob : AiShipBehaviorBase(aiShipController) , m_target(&target) { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorTrack() unit(%s) target(%s)", (m_aiShipController.getOwner() != NULL) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner", target.getNetworkId().getValueString().c_str())); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorTrack() unit(%s) target(%s)", (m_aiShipController.getOwner() != nullptr) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner", target.getNetworkId().getValueString().c_str())); } // ---------------------------------------------------------------------- @@ -36,7 +36,7 @@ void AiShipBehaviorTrack::alter(float deltaSeconds) { PROFILER_AUTO_BLOCK_DEFINE("AiShipBehaviorTrack::alter"); - if (m_target != NULL) + if (m_target != nullptr) { IGNORE_RETURN(m_aiShipController.face(m_target->getPosition_w(), deltaSeconds)); } diff --git a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorWaypoint.cpp b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorWaypoint.cpp index f68335b9..6302a8f9 100755 --- a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorWaypoint.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorWaypoint.cpp @@ -35,7 +35,7 @@ AiShipBehaviorWaypoint::AiShipBehaviorWaypoint(AiShipController & aiShipControll , m_cyclic(cyclic) , m_moveToCompleteTriggerSent(false) { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorWaypoint::AiShipBehaviorWaypoint() unit(%s) cyclic(%s)", (aiShipController.getOwner() != NULL) ? aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner", cyclic ? "yes" : "no")); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorWaypoint::AiShipBehaviorWaypoint() unit(%s) cyclic(%s)", (aiShipController.getOwner() != nullptr) ? aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner", cyclic ? "yes" : "no")); } // ---------------------------------------------------------------------- @@ -61,7 +61,7 @@ void AiShipBehaviorWaypoint::alter(float deltaSeconds) { SpacePath const * const path = m_aiShipController.getPath(); - if ( (path != NULL) + if ( (path != nullptr) && !m_cyclic && (m_aiShipController.getCurrentPathIndex() == (path->getTransformList().size() - 1))) { @@ -76,7 +76,7 @@ void AiShipBehaviorWaypoint::alter(float deltaSeconds) GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(m_aiShipController.getOwner()); - if(gameScriptObject != NULL) + if(gameScriptObject != nullptr) { ScriptParams scriptParams; IGNORE_RETURN(gameScriptObject->trigAllScripts(Scripting::TRIG_SPACE_UNIT_MOVE_TO_COMPLETE, scriptParams)); @@ -104,13 +104,13 @@ bool AiShipBehaviorWaypoint::getNextPosition_w(Vector & position_w) SpacePath * const path = m_aiShipController.getPath(); - if ( (path != NULL) + if ( (path != nullptr) && !path->isEmpty() && (m_aiShipController.getCurrentPathIndex() < path->getTransformList().size())) { ShipObject const * const shipObject = m_aiShipController.getShipOwner(); - if (shipObject != NULL) + if (shipObject != nullptr) { SpacePath::TransformList const & transformList = path->getTransformList(); Vector const & nextPosition = getGoalPosition_w(); @@ -166,7 +166,7 @@ Vector AiShipBehaviorWaypoint::getGoalPosition_w() const SpacePath * const path = m_aiShipController.getPath(); - if ( (path != NULL) + if ( (path != nullptr) && !path->isEmpty()) { SpacePath::TransformList const & transformList = path->getTransformList(); @@ -245,7 +245,7 @@ void AiShipBehaviorWaypoint::addDebug(AiDebugString & aiDebugString) { SpacePath const * const path = m_aiShipController.getPath(); - if (path != NULL) + if (path != nullptr) { aiDebugString.addLineToPosition(m_aiShipController.getMoveToGoalPosition_w(), PackedRgb::solidGreen); aiDebugString.addCircle(m_aiShipController.getMoveToGoalPosition_w(), m_aiShipController.getLargestTurnRadius(), PackedRgb::solidGreen); diff --git a/engine/server/library/serverGame/src/shared/behavior/ShipTurretTargetingSystem.cpp b/engine/server/library/serverGame/src/shared/behavior/ShipTurretTargetingSystem.cpp index 23cbc81f..cf1af6f8 100755 --- a/engine/server/library/serverGame/src/shared/behavior/ShipTurretTargetingSystem.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/ShipTurretTargetingSystem.cpp @@ -124,7 +124,7 @@ void ShipTurretTargetingSystem::onTargetLost(NetworkId const & target) ShipObject * const shipObject = NON_NULL(NON_NULL(NON_NULL(m_shipController.getOwner())->asServerObject())->asShipObject()); if (!shipObject) // for release builds { - WARNING(true,("Programmer bug: got a NULL ShipObject in ShipTurretTargetingSystem::onTargetLost(). May indicate that the ShipObject has already been partially deconstructed.")); + WARNING(true,("Programmer bug: got a nullptr ShipObject in ShipTurretTargetingSystem::onTargetLost(). May indicate that the ShipObject has already been partially deconstructed.")); return; } @@ -168,7 +168,7 @@ bool ShipTurretTargetingSystem::buildTargetList() bool result = false; m_targetList->clear(); - if (ownerShipController != NULL) + if (ownerShipController != nullptr) { if (!ownerShipController->getAttackTargetList().isEmpty()) { diff --git a/engine/server/library/serverGame/src/shared/collision/CollisionCallbacks.cpp b/engine/server/library/serverGame/src/shared/collision/CollisionCallbacks.cpp index 99c4f3cb..9bce1404 100755 --- a/engine/server/library/serverGame/src/shared/collision/CollisionCallbacks.cpp +++ b/engine/server/library/serverGame/src/shared/collision/CollisionCallbacks.cpp @@ -86,7 +86,7 @@ void CollisionCallbacksNamespace::remove() int CollisionCallbacksNamespace::convertObjectToIndex(Object * const object) { - FATAL(!object, ("CollisionCallbacksNamespace::convertObjectToIndex: object == NULL.")); + FATAL(!object, ("CollisionCallbacksNamespace::convertObjectToIndex: object == nullptr.")); ServerObject const * serverObject = object->asServerObject(); if (serverObject) @@ -99,11 +99,11 @@ int CollisionCallbacksNamespace::convertObjectToIndex(Object * const object) bool CollisionCallbacksNamespace::onHitDoCollisionWith(Object * const object, Object * const wasHitByThisObject) { - DEBUG_WARNING(!object, ("CollisionCallbacksNamespace::onHitDoCollisionWith: Object == NULL")); - DEBUG_WARNING(!wasHitByThisObject, ("CollisionCallbacksNamespace::onHitDoCollisionWith: wasHitByThisObject == NULL")); + DEBUG_WARNING(!object, ("CollisionCallbacksNamespace::onHitDoCollisionWith: Object == nullptr")); + DEBUG_WARNING(!wasHitByThisObject, ("CollisionCallbacksNamespace::onHitDoCollisionWith: wasHitByThisObject == nullptr")); ShipObject * shipObject = safe_cast(object); - DEBUG_WARNING(!shipObject, ("CollisionCallbacksNamespace::onHitDoCollisionWith: shipObject == NULL")); + DEBUG_WARNING(!shipObject, ("CollisionCallbacksNamespace::onHitDoCollisionWith: shipObject == nullptr")); CollisionCallbackManager::Result result; if (CollisionCallbackManager::intersectAndReflect(object, wasHitByThisObject, result)) @@ -123,10 +123,10 @@ bool CollisionCallbacksNamespace::onHitDoCollisionWith(Object * const object, Ob bool CollisionCallbacksNamespace::onDoCollisionWithTerrain(Object * const object) { - DEBUG_FATAL (!object, ("CollisionCallbacksNamespace::onDoCollisionWithTerrain: Object == NULL")); + DEBUG_FATAL (!object, ("CollisionCallbacksNamespace::onDoCollisionWithTerrain: Object == nullptr")); ShipObject * shipObject = safe_cast(object); - DEBUG_FATAL (!shipObject, ("CollisionCallbacksNamespace::onDoCollisionWithTerrain: shipObject == NULL")); + DEBUG_FATAL (!shipObject, ("CollisionCallbacksNamespace::onDoCollisionWithTerrain: shipObject == nullptr")); CollisionCallbackManager::Result result; if (CollisionCallbackManager::intersectAndReflectWithTerrain(object, result)) diff --git a/engine/server/library/serverGame/src/shared/command/CommandCppFuncs.cpp b/engine/server/library/serverGame/src/shared/command/CommandCppFuncs.cpp index ff3f058c..f39fcae2 100755 --- a/engine/server/library/serverGame/src/shared/command/CommandCppFuncs.cpp +++ b/engine/server/library/serverGame/src/shared/command/CommandCppFuncs.cpp @@ -145,13 +145,13 @@ namespace CommandCppFuncsNamespace void internalSetBoosterOnOff(NetworkId const & actor, bool onOff) { ServerObject * const actorServerObj = safe_cast(NetworkIdManager::getObjectById(actor)); - CreatureObject * const actorCreature = actorServerObj != NULL ? actorServerObj->asCreatureObject() : NULL; + CreatureObject * const actorCreature = actorServerObj != nullptr ? actorServerObj->asCreatureObject() : nullptr; - if (actorCreature == NULL) + if (actorCreature == nullptr) return; ShipObject * const shipObject = actorCreature->getPilotedShip(); - if (shipObject == NULL) + if (shipObject == nullptr) return; if (!shipObject->isSlotInstalled(ShipChassisSlotType::SCST_booster)) @@ -212,22 +212,22 @@ namespace CommandCppFuncsNamespace CreatureObject * findAndResolveCreatureByNetworkId(NetworkId const & targetId) { - CreatureObject * targetCreatureObject = NULL; + CreatureObject * targetCreatureObject = nullptr; { // find the target. the target could be either a creature or ship ServerObject * const serverObject = ServerWorld::findObjectByNetworkId(targetId); - targetCreatureObject = (serverObject != NULL) ? serverObject->asCreatureObject() : NULL; + targetCreatureObject = (serverObject != nullptr) ? serverObject->asCreatureObject() : nullptr; - if (targetCreatureObject == NULL) + if (targetCreatureObject == nullptr) { - ShipObject * const shipObject = (serverObject != NULL) ? serverObject->asShipObject() : NULL; + ShipObject * const shipObject = (serverObject != nullptr) ? serverObject->asShipObject() : nullptr; - if (shipObject != NULL) + if (shipObject != nullptr) { targetCreatureObject = shipObject->getPilot(); - if (targetCreatureObject == NULL) + if (targetCreatureObject == nullptr) { // this means that it is a POB ship that doesn't have a pilot // in this case we find the owner @@ -237,7 +237,7 @@ namespace CommandCppFuncsNamespace std::vector::const_iterator ii = passengers.begin(); std::vector::const_iterator iiEnd = passengers.end(); - for (; ii != iiEnd && targetCreatureObject == NULL; ++ii) + for (; ii != iiEnd && targetCreatureObject == nullptr; ++ii) { if ((*ii)->getNetworkId() == shipObject->getOwnerId()) { @@ -290,7 +290,7 @@ namespace CommandCppFuncsNamespace Container::ContainerErrorCode errorCode = Container::CEC_Success; for (std::vector >::const_iterator i = oldItems.begin(); i != oldItems.end(); ++i) { - IGNORE_RETURN(ContainerInterface::transferItemToSlottedContainer(destination, *((*i).first), (*i).second, NULL, errorCode)); + IGNORE_RETURN(ContainerInterface::transferItemToSlottedContainer(destination, *((*i).first), (*i).second, nullptr, errorCode)); } } @@ -411,7 +411,7 @@ void CommandCppFuncsNamespace::triggerSpaceEjectPlayerFromShip(CreatureObject * { if (creatureObject == 0) { - WARNING(true, ("CommandCppFuncsNamespace::triggerSpaceEjectPlayerFromShip: NULL CreatureObject.")); + WARNING(true, ("CommandCppFuncsNamespace::triggerSpaceEjectPlayerFromShip: nullptr CreatureObject.")); return; } @@ -424,7 +424,7 @@ void CommandCppFuncsNamespace::triggerSpaceEjectPlayerFromShip(CreatureObject * } else { - WARNING(true, ("CommandCppFuncsNamespace::triggerSpaceEjectPlayerFromShip: NULL ScriptObject.")); + WARNING(true, ("CommandCppFuncsNamespace::triggerSpaceEjectPlayerFromShip: nullptr ScriptObject.")); } } @@ -432,7 +432,7 @@ void CommandCppFuncsNamespace::triggerSpaceEjectPlayerFromShip(CreatureObject * TravelPoint const * CommandCppFuncsNamespace::GroupHelpers::getNearestTravelPoint(std::string const & planetName, Vector const & location, std::vector const & cityBanList, uint32 faction, bool starPortAndShuttleportOnly) { - TravelPoint const * nearestTravelPoint = NULL; + TravelPoint const * nearestTravelPoint = nullptr; PlanetObject const * const planetObject = ServerUniverse::getInstance().getPlanetByName(planetName); if (planetObject) { @@ -537,7 +537,7 @@ static NetworkId nextOidParm(Unicode::String const &str, size_t &curpos) static float nextFloatParm(Unicode::String const &str, size_t &curpos) { - return static_cast(strtod(nextStringParm(str, curpos).c_str(), NULL)); + return static_cast(strtod(nextStringParm(str, curpos).c_str(), nullptr)); } @@ -821,7 +821,7 @@ static void commandFuncLocateStructure(Command const &, NetworkId const &actor, ownerId = actor; } - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); if (!isGod && actorObj->getObjVars().hasItem("timeNextLocateStructureCommandAllowed") && (actorObj->getObjVars().getType("timeNextLocateStructureCommandAllowed") == DynamicVariable::INT)) { int timeNextLocateStructureCommandAllowed = 0; @@ -889,7 +889,7 @@ static void commandFuncLocateVendor(Command const &, NetworkId const &actor, Net ownerId = actor; } - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); if (!isGod && actorObj->getObjVars().hasItem("timeNextLocateVendorCommandAllowed") && (actorObj->getObjVars().getType("timeNextLocateVendorCommandAllowed") == DynamicVariable::INT)) { int timeNextLocateVendorCommandAllowed = 0; @@ -956,7 +956,7 @@ static void commandFuncShowCtsHistory(Command const &, NetworkId const &actor, N if (target != actor) { targetObj = dynamic_cast(ServerWorld::findObjectByNetworkId(target)); - targetPlayerObj = (targetObj ? PlayerCreatureController::getPlayerObject(targetObj) : NULL); + targetPlayerObj = (targetObj ? PlayerCreatureController::getPlayerObject(targetObj) : nullptr); if (!targetPlayerObj) { ConsoleMgr::broadcastString(FormattedString<1024>().sprintf("%s is not a valid or nearby player character.", target.getValueString().c_str()), clientObj); @@ -980,7 +980,7 @@ static void commandFuncShowCtsHistory(Command const &, NetworkId const &actor, N if (i.getValue(ctsTransactionDetail)) { Unicode::UnicodeStringVector tokens; - if (Unicode::tokenize(ctsTransactionDetail, tokens, NULL, NULL) && (tokens.size() >= 4)) + if (Unicode::tokenize(ctsTransactionDetail, tokens, nullptr, nullptr) && (tokens.size() >= 4)) { Unicode::String characterName; for (size_t i = 3, j = tokens.size(); i < j; ++i) @@ -1196,7 +1196,7 @@ static void commandFuncAdminEditBank(Command const &cmd, NetworkId const &actor, CreatureObject * targetCreature = safe_cast(ServerWorld::findObjectByNetworkId(target)); if (!targetCreature || !actorCreature) { - DEBUG_REPORT_LOG(true, ("Received open command for null player or target.\n")); + DEBUG_REPORT_LOG(true, ("Received open command for nullptr player or target.\n")); return; } @@ -1241,14 +1241,14 @@ static void commandFuncAdminEditStats(Command const &, NetworkId const &actor, N CreatureObject* const creatureActor = dynamic_cast(NetworkIdManager::getObjectById (actor)); if (!creatureActor) { - WARNING (true, ("commandFuncAdminEditStats: null actor")); + WARNING (true, ("commandFuncAdminEditStats: nullptr actor")); return; } CreatureObject* const creatureTarget = dynamic_cast(NetworkIdManager::getObjectById (target)); if (!creatureTarget) { - WARNING (true, ("commandFuncAdminEditStats: null target")); + WARNING (true, ("commandFuncAdminEditStats: nullptr target")); return; } @@ -1265,14 +1265,14 @@ static void commandFuncAdminEditAppearance(Command const &, NetworkId const &act CreatureObject* const creatureActor = dynamic_cast(NetworkIdManager::getObjectById (actor)); if (!creatureActor) { - WARNING (true, ("commandFuncAdminEditAppearance: null actor")); + WARNING (true, ("commandFuncAdminEditAppearance: nullptr actor")); return; } CreatureObject* const creatureTarget = dynamic_cast(NetworkIdManager::getObjectById (target)); if (!creatureTarget) { - WARNING (true, ("commandFuncAdminEditAppearance: null target")); + WARNING (true, ("commandFuncAdminEditAppearance: nullptr target")); return; } @@ -1819,7 +1819,7 @@ static void commandFuncSpatialChatInternal(Command const &, NetworkId const &act else if (!squelched && (ConfigServerGame::getChatSpamNotifyPlayerWhenLimitedIntervalSeconds() > 0) && obj->getClient()) { // send message telling character he can no longer talk - const int timeNow = static_cast(::time(NULL)); + const int timeNow = static_cast(::time(nullptr)); const int chatSpamTimeEndInterval = playerObject->getChatSpamTimeEndInterval(); if ((chatSpamTimeEndInterval > timeNow) && (timeNow >= playerObject->getChatSpamNextTimeToNotifyPlayerWhenLimited())) { @@ -1837,7 +1837,7 @@ static void commandFuncSpatialChatInternal(Command const &, NetworkId const &act // ---------------------------------------------------------------------- /** -* Parameters: [null terminator + oob] +* Parameters: [nullptr terminator + oob] * All parameters are strings */ @@ -1957,7 +1957,7 @@ static void commandFuncSpatialChat(Command const &, NetworkId const &actor, Netw else if (!squelched && (ConfigServerGame::getChatSpamNotifyPlayerWhenLimitedIntervalSeconds() > 0) && obj->getClient()) { // send message telling character he can no longer talk - const int timeNow = static_cast(::time(NULL)); + const int timeNow = static_cast(::time(nullptr)); const int chatSpamTimeEndInterval = playerObject->getChatSpamTimeEndInterval(); if ((chatSpamTimeEndInterval > timeNow) && (timeNow >= playerObject->getChatSpamNextTimeToNotifyPlayerWhenLimited())) { @@ -1992,7 +1992,7 @@ static void commandFuncCombatSpam (Command const &, NetworkId const &actor, Netw ServerObject * const obj = safe_cast(actorId.getObject ()); if (!obj) { - WARNING (true, ("null actor in commandFuncCombatSpam")); + WARNING (true, ("nullptr actor in commandFuncCombatSpam")); return; } @@ -2213,10 +2213,10 @@ static void commandFuncSetWaypointName(Command const &, NetworkId const & actor, static void commandSetPosture(Command const &command, NetworkId const &actor, NetworkId const &, Unicode::String const &) { CachedNetworkId actorId(actor); - if (actorId.getObject() != NULL) + if (actorId.getObject() != nullptr) { CreatureController * const controller = dynamic_cast(actorId.getObject()->getController()); - if (controller != NULL) + if (controller != nullptr) { CreatureObject * const creature = safe_cast(actorId.getObject()); NOT_NULL (creature); @@ -2247,15 +2247,15 @@ static void commandSetPosture(Command const &command, NetworkId const &actor, Ne static void commandFuncJumpServer(Command const &command, NetworkId const &actor, NetworkId const &, Unicode::String const &) { CachedNetworkId actorId(actor); - if (actorId.getObject() != NULL) + if (actorId.getObject() != nullptr) { CreatureController * const controller = dynamic_cast(actorId.getObject()->getController()); - if (controller != NULL) + if (controller != nullptr) { controller->appendMessage( CM_jump, 0.0f, - NULL, + nullptr, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_ALL_CLIENT @@ -2621,7 +2621,7 @@ static void commandFuncEndDuel(Command const &, NetworkId const &actor, NetworkI params.addParam(targetObj->getNetworkId(), "target"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(actorFlagObj->getNetworkId(), @@ -2634,7 +2634,7 @@ static void commandFuncEndDuel(Command const &, NetworkId const &actor, NetworkI params.addParam(actorFlagObj->getNetworkId(), "target"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(targetObj->getNetworkId(), @@ -2867,7 +2867,7 @@ static void commandFuncFactoryCrateSplit(Command const &, NetworkId const &actor const int amount = nextIntParm(params,pos); const CachedNetworkId destContainerId (nextOidParm(params,pos)); ServerObject * destContainer = safe_cast(destContainerId.getObject()); - if (destContainer == NULL || ContainerInterface::getVolumeContainer(*destContainer) == NULL) + if (destContainer == nullptr || ContainerInterface::getVolumeContainer(*destContainer) == nullptr) { ContainerInterface::sendContainerMessageToClient(*player, Container::CEC_NotFound); return; @@ -2878,7 +2878,7 @@ static void commandFuncFactoryCrateSplit(Command const &, NetworkId const &actor { ContainerInterface::sendContainerMessageToClient(*player, error, sourceObj); } - else if (sourceObj->makeCopy(*destContainer, amount) == NULL) + else if (sourceObj->makeCopy(*destContainer, amount) == nullptr) { ContainerInterface::sendContainerMessageToClient(*player, Container::CEC_Full, destContainer); @@ -2952,7 +2952,7 @@ static void commandFuncTransferItem(Command const &, NetworkId const &actor, Net if (!playerSo || !item) { - DEBUG_REPORT_LOG(true, ("Received transfer item command for null player or target.\n")); + DEBUG_REPORT_LOG(true, ("Received transfer item command for nullptr player or target.\n")); return; } @@ -3185,7 +3185,7 @@ static void commandFuncTransferItem(Command const &, NetworkId const &actor, Net retval = false; } - else if (destination == player->getAppearanceInventory() && ContainerInterface::getContainer(*item) != NULL) + else if (destination == player->getAppearanceInventory() && ContainerInterface::getContainer(*item) != nullptr) { const Container * itemContainer = ContainerInterface::getContainer(*item); if(itemContainer && itemContainer->getNumberOfItems() == 0) @@ -3215,7 +3215,7 @@ static void commandFuncTransferItem(Command const &, NetworkId const &actor, Net const SlottedContainer * equipment = ContainerInterface::getSlottedContainer(*player); const SlottedContainmentProperty * itemContainmentProperty = ContainerInterface::getSlottedContainmentProperty(*item); - if (inventory != NULL && equipment != NULL && itemContainmentProperty != NULL) + if (inventory != nullptr && equipment != nullptr && itemContainmentProperty != nullptr) { std::vector > oldItems; retval = true; @@ -3225,7 +3225,7 @@ static void commandFuncTransferItem(Command const &, NetworkId const &actor, Net SlotId slot = itemContainmentProperty->getSlotId(arrangement, i); const Container::ContainedItem & currentWeaponId = equipment->getObjectInSlot(slot, errorCode); ServerObject * oldItem = safe_cast(currentWeaponId.getObject()); - if (oldItem != NULL) + if (oldItem != nullptr) { if (ContainerInterface::transferItemToVolumeContainer(*inventory, *oldItem, player, errorCode, true)) { @@ -3280,7 +3280,7 @@ static void commandFuncTransferItem(Command const &, NetworkId const &actor, Net SlotId slot = itemContainmentProperty->getSlotId(arrangement, i); const Container::ContainedItem & currentWeaponId = equipment->getObjectInSlot(slot, errorCode); ServerObject * oldItem = safe_cast(currentWeaponId.getObject()); - if (oldItem != NULL) + if (oldItem != nullptr) { if( std::find(objectsToSend.begin(), objectsToSend.end(), oldItem) == objectsToSend.end() ) objectsToSend.push_back(oldItem); @@ -3291,7 +3291,7 @@ static void commandFuncTransferItem(Command const &, NetworkId const &actor, Net for(; iter != objectsToSend.end(); ++iter) { // No idea how this could happen, but just incase. - if((*iter) == NULL) + if((*iter) == nullptr) continue; StringId const code("container_error_message", "container32_prose"); @@ -3411,7 +3411,7 @@ static void commandFuncOpenContainer(Command const & cmd, NetworkId const &actor CreatureObject * player = safe_cast(ServerWorld::findObjectByNetworkId(actor)); if (!container || !player) { - DEBUG_REPORT_LOG(true, ("Received open command for null player or target.\n")); + DEBUG_REPORT_LOG(true, ("Received open command for nullptr player or target.\n")); return; } //@todo check permissions @@ -3428,14 +3428,14 @@ static void commandFuncOpenContainer(Command const & cmd, NetworkId const &actor //-- if they are opening a crafting station, what they really want is the hopper //-- but only if the object is not a volume container if (container->getGameObjectType () == SharedObjectTemplate::GOT_misc_crafting_station - && (NULL == ContainerInterface::getVolumeContainer (*container))) + && (nullptr == ContainerInterface::getVolumeContainer (*container))) { static const SlotId inputHopperId(SlotIdManager::findSlotId(CrcLowerString("ingredient_hopper"))); ServerObject const * const station = container; - ServerObject * hopper = NULL; + ServerObject * hopper = nullptr; const SlottedContainer * stationContainer = ContainerInterface::getSlottedContainer (*station); - if (stationContainer != NULL) + if (stationContainer != nullptr) { Container::ContainerErrorCode tmp = Container::CEC_Success; Object* tmpHopperObj = (stationContainer->getObjectInSlot (inputHopperId, tmp)).getObject(); @@ -3526,7 +3526,7 @@ static void commandFuncCloseContainer(Command const &, NetworkId const &actor, N ServerObject * const player = ServerWorld::findObjectByNetworkId(actor); if (!container || !player) { - DEBUG_REPORT_LOG(true, ("Received close command for null player or target.\n")); + DEBUG_REPORT_LOG(true, ("Received close command for nullptr player or target.\n")); return; } @@ -3615,7 +3615,7 @@ static void commandFuncGiveItem(Command const &, NetworkId const &actor, Network ServerObject * const player = ServerWorld::findObjectByNetworkId(actor); if (!player || !item) { - DEBUG_REPORT_LOG(true, ("Received give item command for null player or target.\n")); + DEBUG_REPORT_LOG(true, ("Received give item command for nullptr player or target.\n")); return; } size_t curpos = 0; @@ -3669,10 +3669,10 @@ static void commandFuncGiveItem(Command const &, NetworkId const &actor, Network // check and see if this is a gem->socket operation, which is handled by our code TangibleObject * const socket = dynamic_cast(destination); - if (socket != NULL) + if (socket != nullptr) { TangibleObject * const gem = dynamic_cast(item); - if (gem != NULL) + if (gem != nullptr) { const int destGot = socket->getGameObjectType(); const SharedTangibleObjectTemplate * const gemTemplate = safe_cast(gem->getSharedTemplate()); @@ -3692,13 +3692,13 @@ static void commandFuncGiveItem(Command const &, NetworkId const &actor, Network } // if the socketed item is equipped, unequip it temporarily - CreatureObject * owner = NULL; + CreatureObject * owner = nullptr; Object * container = ContainerInterface::getContainedByObject(*socket); - if (container != NULL && container->asServerObject()->asCreatureObject() != NULL) + if (container != nullptr && container->asServerObject()->asCreatureObject() != nullptr) { owner = container->asServerObject()->asCreatureObject(); // fake unequipping the item - owner->onContainerLostItem(NULL, *socket, NULL); + owner->onContainerLostItem(nullptr, *socket, nullptr); } std::vector > skillModBonuses; @@ -3713,10 +3713,10 @@ static void commandFuncGiveItem(Command const &, NetworkId const &actor, Network // tell the player they can't use the gem Chat::sendSystemMessage(*player, SharedStringIds::gem_not_inserted, Unicode::emptyString); } - if (owner != NULL) + if (owner != nullptr) { // "re-equip" the item - owner->onContainerGainItem(*socket, NULL, NULL); + owner->onContainerGainItem(*socket, nullptr, nullptr); } return; } @@ -4138,7 +4138,7 @@ static void commandFuncGroupDisband(Command const &, NetworkId const &actor, Net { GroupMemberParam const & leader = *ii; - // create the new POB groups. notice NULL is passed in for the + // create the new POB groups. notice nullptr is passed in for the // groupToRemoveFrom because the original group has already had // all of the members removed @@ -4389,7 +4389,7 @@ static void commandFuncCreateGroupPickup(Command const &, NetworkId const &actor } // create the group pickup point - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); groupObj->setGroupPickupTimer(timeNow, timeNow + static_cast(ConfigServerGame::getGroupPickupPointTimeLimitSeconds())); groupObj->setGroupPickupLocation(currentScene, currentWorldLocation); @@ -4682,7 +4682,7 @@ static void commandFuncGroupPickRandomGroupMember(Command const &, NetworkId con if (!client) return; - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); if (!client->isGod() && targetObj->getObjVars().hasItem("timeNextGroupPickRandomGroupMemberCommandAllowed") && (targetObj->getObjVars().getType("timeNextGroupPickRandomGroupMemberCommandAllowed") == DynamicVariable::INT)) { int timeNextGroupPickRandomGroupMemberCommandAllowed = 0; @@ -4703,7 +4703,7 @@ static void commandFuncGroupPickRandomGroupMember(Command const &, NetworkId con if (!params.empty()) { Unicode::UnicodeStringVector tokens; - if (Unicode::tokenize(Unicode::toLower(params), tokens, NULL, NULL) && !tokens.empty()) + if (Unicode::tokenize(Unicode::toLower(params), tokens, nullptr, nullptr) && !tokens.empty()) { static Unicode::String const paramsPoint1 = Unicode::narrowToWide("-point"); static Unicode::String const paramsPoint2 = Unicode::narrowToWide("point"); @@ -4805,7 +4805,7 @@ static void commandFuncGroupTextChatRoomRejoin(Command const &, NetworkId const if (!client) return; - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); if (!client->isGod() && targetObj->getObjVars().hasItem("timeNextGroupTextChatRoomRejoinCommandAllowed") && (targetObj->getObjVars().getType("timeNextGroupTextChatRoomRejoinCommandAllowed") == DynamicVariable::INT)) { int timeNextGroupTextChatRoomRejoinCommandAllowed = 0; @@ -4868,7 +4868,7 @@ static void commandFuncGuildTextChatRoomRejoin(Command const &, NetworkId const if (!client) return; - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); if (!client->isGod() && targetObj->getObjVars().hasItem("timeNextGuildTextChatRoomRejoinCommandAllowed") && (targetObj->getObjVars().getType("timeNextGuildTextChatRoomRejoinCommandAllowed") == DynamicVariable::INT)) { int timeNextGuildTextChatRoomRejoinCommandAllowed = 0; @@ -4913,7 +4913,7 @@ static void commandFuncGuildPickRandomGuildMember(Command const &, NetworkId con if (!client) return; - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); if (!client->isGod() && targetObj->getObjVars().hasItem("timeNextGuildPickRandomGuildMemberCommandAllowed") && (targetObj->getObjVars().getType("timeNextGuildPickRandomGuildMemberCommandAllowed") == DynamicVariable::INT)) { int timeNextGuildPickRandomGuildMemberCommandAllowed = 0; @@ -4935,7 +4935,7 @@ static void commandFuncGuildPickRandomGuildMember(Command const &, NetworkId con if (!params.empty()) { Unicode::UnicodeStringVector tokens; - if (Unicode::tokenize(Unicode::toLower(params), tokens, NULL, NULL) && !tokens.empty()) + if (Unicode::tokenize(Unicode::toLower(params), tokens, nullptr, nullptr) && !tokens.empty()) { static Unicode::String const paramsOnline1 = Unicode::narrowToWide("-online"); static Unicode::String const paramsOnline2 = Unicode::narrowToWide("online"); @@ -5074,7 +5074,7 @@ static void commandFuncCityTextChatRoomRejoin(Command const &, NetworkId const & if (!client) return; - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); if (!client->isGod() && targetObj->getObjVars().hasItem("timeNextCityTextChatRoomRejoinCommandAllowed") && (targetObj->getObjVars().getType("timeNextCityTextChatRoomRejoinCommandAllowed") == DynamicVariable::INT)) { int timeNextCityTextChatRoomRejoinCommandAllowed = 0; @@ -5120,7 +5120,7 @@ static void commandFuncCityPickRandomCitizen(Command const &, NetworkId const &a if (!client) return; - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); if (!client->isGod() && targetObj->getObjVars().hasItem("timeNextCityPickRandomCitizenCommandAllowed") && (targetObj->getObjVars().getType("timeNextCityPickRandomCitizenCommandAllowed") == DynamicVariable::INT)) { int timeNextCityPickRandomCitizenCommandAllowed = 0; @@ -5142,7 +5142,7 @@ static void commandFuncCityPickRandomCitizen(Command const &, NetworkId const &a if (!params.empty()) { Unicode::UnicodeStringVector tokens; - if (Unicode::tokenize(Unicode::toLower(params), tokens, NULL, NULL) && !tokens.empty()) + if (Unicode::tokenize(Unicode::toLower(params), tokens, nullptr, nullptr) && !tokens.empty()) { static Unicode::String const paramsOnline1 = Unicode::narrowToWide("-online"); static Unicode::String const paramsOnline2 = Unicode::narrowToWide("online"); @@ -5272,7 +5272,7 @@ static void commandFuncPlaceStructure (const Command& /*command*/, const Network Object* const object = NetworkIdManager::getObjectById (actor); if (!object) { - DEBUG_WARNING (true, ("commandFuncPlaceStructure: PB null actor\n")); + DEBUG_WARNING (true, ("commandFuncPlaceStructure: PB nullptr actor\n")); return; } @@ -5478,9 +5478,9 @@ static void commandFuncPurchaseTicket (const Command& /*command*/, const Network static void commandFuncRequestResourceWeights(const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == NULL) + if (creature == nullptr) { - WARNING (true, ("commandFuncRequestResourceWeights: PB null actor")); + WARNING (true, ("commandFuncRequestResourceWeights: PB nullptr actor")); return; } @@ -5494,9 +5494,9 @@ static void commandFuncRequestResourceWeights(const Command& , const NetworkId& static void commandFuncRequestResourceWeightsBatch(const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) { CreatureObject* const creature = dynamic_cast(NetworkIdManager::getObjectById (actor)); - if (creature == NULL) + if (creature == nullptr) { - WARNING (true, ("commandFuncRequestResourceWeightsBatch: PB null actor")); + WARNING (true, ("commandFuncRequestResourceWeightsBatch: PB nullptr actor")); return; } @@ -5516,14 +5516,14 @@ static void commandFuncRequestResourceWeightsBatch(const Command& , const Networ static void commandFuncRequestDraftSlots (const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == NULL) + if (creature == nullptr) { - WARNING (true, ("commandFuncRequestDraftSlots: PB null actor")); + WARNING (true, ("commandFuncRequestDraftSlots: PB nullptr actor")); return; } PlayerObject * const player = PlayerCreatureController::getPlayerObject(creature); - if (player == NULL) + if (player == nullptr) { WARNING (true, ("commandFuncRequestDraftSlots: no player object for actor ""%s", actor.getValueString().c_str())); return; @@ -5533,7 +5533,7 @@ static void commandFuncRequestDraftSlots (const Command& , const NetworkId& acto sscanf(Unicode::wideToNarrow(params).c_str(), "%lu %lu", &serverCrc, &sharedCrc); MessageQueueDraftSlotsQueryResponse * const message = new MessageQueueDraftSlotsQueryResponse(std::make_pair(serverCrc, sharedCrc)); - if (!player->requestDraftSlots(serverCrc, NULL, message)) + if (!player->requestDraftSlots(serverCrc, nullptr, message)) { WARNING (true, ("commandFuncRequestDraftSlots failed to request draft slots for %u", serverCrc)); delete message; @@ -5545,14 +5545,14 @@ static void commandFuncRequestDraftSlots (const Command& , const NetworkId& acto static void commandFuncRequestDraftSlotsBatch (const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == NULL) + if (creature == nullptr) { - WARNING (true, ("commandFuncRequestDraftSlotsBatch: PB null actor")); + WARNING (true, ("commandFuncRequestDraftSlotsBatch: PB nullptr actor")); return; } PlayerObject * const player = PlayerCreatureController::getPlayerObject(creature); - if (player == NULL) + if (player == nullptr) { WARNING (true, ("commandFuncRequestDraftSlotsBatch: no player object for actor ""%s", actor.getValueString().c_str())); return; @@ -5575,7 +5575,7 @@ static void commandFuncRequestDraftSlotsBatch (const Command& , const NetworkId& while(uServerCrc != 0 && uSharedCrc != 0 && !done) { MessageQueueDraftSlotsQueryResponse * const message = new MessageQueueDraftSlotsQueryResponse(std::make_pair(uServerCrc, uSharedCrc)); - if (!player->requestDraftSlots(uServerCrc, NULL, message)) + if (!player->requestDraftSlots(uServerCrc, nullptr, message)) { WARNING (true, ("commandFuncRequestDraftSlotsBatch failed to request draft slots for %lu", uServerCrc)); delete message; @@ -5596,15 +5596,15 @@ static void commandFuncRequestDraftSlotsBatch (const Command& , const NetworkId& static void commandFuncRequestManfSchematicSlots (const Command& , const NetworkId& actor, const NetworkId& target, const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == NULL) + if (creature == nullptr) { - WARNING (true, ("commandFuncRequestDraftSlots: PB null actor")); + WARNING (true, ("commandFuncRequestDraftSlots: PB nullptr actor")); return; } const ManufactureSchematicObject * schematic = dynamic_cast< const ManufactureSchematicObject *>(NetworkIdManager::getObjectById(target)); - if (schematic != NULL) + if (schematic != nullptr) { schematic->requestSlots(*creature); } @@ -5615,14 +5615,14 @@ static void commandFuncRequestManfSchematicSlots (const Command& , const Network static void commandFuncRequestCraftingSession (const Command& , const NetworkId& actor, const NetworkId& target, const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == NULL) + if (creature == nullptr) { - WARNING (true, ("commandFuncRequestCraftingSession: PB null actor")); + WARNING (true, ("commandFuncRequestCraftingSession: PB nullptr actor")); return; } PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); - if (player == NULL) + if (player == nullptr) { WARNING (true, ("commandFuncRequestCraftingSession: no player object for actor " "%s", actor.getValueString().c_str())); @@ -5668,14 +5668,14 @@ static void commandFuncRequestCraftingSessionFail(Command const &, NetworkId con static void commandFuncSelectDraftSchematic (const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == NULL) + if (creature == nullptr) { - WARNING (true, ("commandFuncSelectDraftSchematic: PB null actor")); + WARNING (true, ("commandFuncSelectDraftSchematic: PB nullptr actor")); return; } PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); - if (player == NULL) + if (player == nullptr) { WARNING (true, ("commandFuncSelectDraftSchematic: no player object for actor " "%s", actor.getValueString().c_str())); @@ -5692,14 +5692,14 @@ static void commandFuncSelectDraftSchematic (const Command& , const NetworkId& a static void commandFuncNextCraftingStage(const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == NULL) + if (creature == nullptr) { - WARNING (true, ("commandFuncNextCraftingStage: PB null actor")); + WARNING (true, ("commandFuncNextCraftingStage: PB nullptr actor")); return; } PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); - if (player == NULL) + if (player == nullptr) { WARNING (true, ("commandFuncNextCraftingStage: no player object for actor " "%s", actor.getValueString().c_str())); @@ -5722,14 +5722,14 @@ static void commandFuncNextCraftingStage(const Command& , const NetworkId& actor static void commandFuncCreatePrototype(const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == NULL) + if (creature == nullptr) { - WARNING (true, ("commandFuncCreatePrototype: PB null actor")); + WARNING (true, ("commandFuncCreatePrototype: PB nullptr actor")); return; } PlayerObject * const player = PlayerCreatureController::getPlayerObject(creature); - if (player == NULL) + if (player == nullptr) { WARNING (true, ("commandFuncCreatePrototype: no player object for actor %s", actor.getValueString().c_str())); return; @@ -5756,14 +5756,14 @@ static void commandFuncCreatePrototype(const Command& , const NetworkId& actor, static void commandFuncCreateManfSchematic(const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == NULL) + if (creature == nullptr) { - WARNING (true, ("commandFuncCreateManfSchematic: PB null actor")); + WARNING (true, ("commandFuncCreateManfSchematic: PB nullptr actor")); return; } PlayerObject * const player = PlayerCreatureController::getPlayerObject(creature); - if (player == NULL) + if (player == nullptr) { WARNING (true, ("commandFuncCreateManfSchematic: no player object for actor %s", actor.getValueString().c_str())); return; @@ -5788,14 +5788,14 @@ static void commandFuncCreateManfSchematic(const Command& , const NetworkId& act static void commandFuncCancelCraftingSession(const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == NULL) + if (creature == nullptr) { - WARNING (true, ("commandFuncCancelCraftingSession: PB null actor")); + WARNING (true, ("commandFuncCancelCraftingSession: PB nullptr actor")); return; } PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); - if (player == NULL) + if (player == nullptr) { WARNING (true, ("commandFuncCancelCraftingSession: no player object for actor " "%s", actor.getValueString().c_str())); @@ -5810,14 +5810,14 @@ static void commandFuncCancelCraftingSession(const Command& , const NetworkId& a static void commandFuncStopCraftingSession(const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == NULL) + if (creature == nullptr) { - WARNING (true, ("commandFuncStopCraftingSession: PB null actor")); + WARNING (true, ("commandFuncStopCraftingSession: PB nullptr actor")); return; } PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); - if (player == NULL) + if (player == nullptr) { WARNING (true, ("commandFuncStopCraftingSession: no player object for actor " "%s", actor.getValueString().c_str())); @@ -5832,14 +5832,14 @@ static void commandFuncStopCraftingSession(const Command& , const NetworkId& act static void commandFuncRestartCraftingSession(const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == NULL) + if (creature == nullptr) { - WARNING (true, ("commandFuncRestartCraftingSession: PB null actor")); + WARNING (true, ("commandFuncRestartCraftingSession: PB nullptr actor")); return; } PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); - if (player == NULL) + if (player == nullptr) { WARNING (true, ("commandFuncRestartCraftingSession: no player object for actor " "%s", actor.getValueString().c_str())); @@ -5866,7 +5866,7 @@ static void commandFuncSetMatchMakingPersonalId(Command const &, NetworkId const PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(actor)); - if (playerObject != NULL) + if (playerObject != nullptr) { MatchMakingId matchMakingId; matchMakingId.unPackIntString(Unicode::wideToNarrow(params)); @@ -5885,7 +5885,7 @@ static void commandFuncSetMatchMakingCharacterId(Command const &, NetworkId cons PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(actor)); - if (playerObject != NULL) + if (playerObject != nullptr) { MatchMakingId matchMakingId; matchMakingId.unPackIntString(Unicode::wideToNarrow(params)); @@ -5902,7 +5902,7 @@ static void commandFuncAddFriend(Command const &, NetworkId const &actor, Networ { ServerObject * const serverObject = ServerObject::getServerObject(actor); - if (serverObject != NULL) + if (serverObject != nullptr) { size_t pos = 0; std::string name(nextStringParm(params, pos)); @@ -5924,7 +5924,7 @@ static void commandFuncRemoveFriend(Command const &, NetworkId const &actor, Net { ServerObject * const serverObject = ServerObject::getServerObject(actor); - if (serverObject != NULL) + if (serverObject != nullptr) { size_t pos = 0; std::string name(nextStringParm(params, pos)); @@ -5946,7 +5946,7 @@ static void commandFuncGetFriendList(Command const &, NetworkId const &actor, Ne { ServerObject * const serverObject = ServerObject::getServerObject(actor); - if (serverObject != NULL) + if (serverObject != nullptr) { std::string player(Chat::constructChatAvatarId(*serverObject).getFullName()); @@ -5962,7 +5962,7 @@ static void commandFuncAddIgnore(Command const &, NetworkId const &actor, Networ { ServerObject * const serverObject = ServerObject::getServerObject(actor); - if (serverObject != NULL) + if (serverObject != nullptr) { size_t pos = 0; std::string name(nextStringParm(params, pos)); @@ -5984,7 +5984,7 @@ static void commandFuncRemoveIgnore(Command const &, NetworkId const &actor, Net { ServerObject * const serverObject = ServerObject::getServerObject(actor); - if (serverObject != NULL) + if (serverObject != nullptr) { size_t pos = 0; std::string name(nextStringParm(params, pos)); @@ -6006,7 +6006,7 @@ static void commandFuncGetIgnoreList(Command const &, NetworkId const &actor, Ne { ServerObject * const serverObject = ServerObject::getServerObject(actor); - if (serverObject != NULL) + if (serverObject != nullptr) { std::string player(Chat::constructChatAvatarId(*serverObject).getFullName()); @@ -6022,7 +6022,7 @@ static void commandFuncRequestBiography(Command const &, NetworkId const &actor, { CreatureObject * const creatureObject = CreatureObject::getCreatureObject(actor); - if (creatureObject != NULL) + if (creatureObject != nullptr) { BiographyManager::requestBiography(target, creatureObject); } @@ -6069,9 +6069,9 @@ static void commandFuncSetBiography(Command const &, NetworkId const & actor, Ne static void commandFuncRequestCharacterSheetInfo(Command const &, NetworkId const &actor, NetworkId const &, Unicode::String const &) { const CreatureObject* const creatureActor = CreatureObject::getCreatureObject(actor); - if (creatureActor == NULL) + if (creatureActor == nullptr) { - WARNING (true, ("commandFuncRequestCharacterSheetInfo: null actor")); + WARNING (true, ("commandFuncRequestCharacterSheetInfo: nullptr actor")); return; } @@ -6090,7 +6090,7 @@ static void commandFuncRequestCharacterSheetInfo(Command const &, NetworkId cons if(bindId != NetworkId::cms_invalid) { const ServerObject* const bindObject = ServerObject::getServerObject(bindId); - if (bindObject != NULL) + if (bindObject != nullptr) { bindLoc = bindObject->getPosition_w(); bindPlanet = bindObject->getSceneId(); @@ -6142,7 +6142,7 @@ static void commandFuncRequestCharacterSheetInfo(Command const &, NetworkId cons houseNetworkId = cityHallOfMayorCity; const ServerObject* const resObject = ServerObject::getServerObject(houseNetworkId); - if (resObject != NULL) + if (resObject != nullptr) { resLoc = resObject->getPosition_w(); resPlanet = ServerWorld::getSceneId(); @@ -6201,13 +6201,13 @@ static void commandFuncRequestCharacterMatch(Command const &, NetworkId const &a static void commandFuncExtractObject(Command const &, NetworkId const &actor, NetworkId const & target, Unicode::String const ¶ms) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == NULL) + if (creature == nullptr) { - WARNING (true, ("commandFuncExtractObject: PB null actor")); + WARNING (true, ("commandFuncExtractObject: PB nullptr actor")); return; } - if (creature->getInventory() == NULL) + if (creature->getInventory() == nullptr) { WARNING (true, ("commandFuncExtractObject: actor %s has no inventory", actor.getValueString().c_str())); @@ -6215,9 +6215,9 @@ static void commandFuncExtractObject(Command const &, NetworkId const &actor, Ne } FactoryObject* const factory = dynamic_cast(NetworkIdManager::getObjectById (target)); - if (factory == NULL) + if (factory == nullptr) { - WARNING (true, ("commandFuncExtractObject: PB null target")); + WARNING (true, ("commandFuncExtractObject: PB nullptr target")); return; } @@ -6233,16 +6233,16 @@ static void commandFuncExtractObject(Command const &, NetworkId const &actor, Ne static void commandFuncRevokeSkill(Command const &, NetworkId const &actor, NetworkId const & target, Unicode::String const ¶ms) { CreatureObject * const creature = CreatureObject::getCreatureObject(actor); - if (creature == NULL) + if (creature == nullptr) { - WARNING (true, ("commandFuncRevokeSkill: PB null actor")); + WARNING (true, ("commandFuncRevokeSkill: PB nullptr actor")); return; } size_t pos = 0; std::string skillName = nextStringParm(params, pos); const SkillObject * skill = SkillManager::getInstance ().getSkill (skillName); - if (skill == NULL) + if (skill == nullptr) { WARNING (true, ("commandFuncRevokeSkill: can't revoke bad skill")); } @@ -6261,7 +6261,7 @@ static void commandFuncSetCurrentSkillTitle(Command const &, NetworkId const &ac CreatureObject * const creatureObject = CreatureObject::getCreatureObject(actor); PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(creatureObject); - if (playerObject != NULL) + if (playerObject != nullptr) { size_t pos = 0; std::string const &title = nextStringParm(params, pos); @@ -6378,7 +6378,7 @@ static void commandFuncSetCurrentSkillTitle(Command const &, NetworkId const &ac { SkillObject const *skillObject = (*iterSkillList); - if ( (skillObject != NULL) + if ( (skillObject != nullptr) && skillObject->isTitle() && (skillObject->getSkillName() == title)) { @@ -6402,16 +6402,16 @@ static void commandFuncSetCurrentSkillTitle(Command const &, NetworkId const &ac static void commandFuncRepair(Command const &, NetworkId const &actor, NetworkId const & target, Unicode::String const ¶ms) { CreatureObject* const creature = dynamic_cast(NetworkIdManager::getObjectById (actor)); - if (creature == NULL) + if (creature == nullptr) { - WARNING (true, ("commandFuncRepair: PB null actor")); + WARNING (true, ("commandFuncRepair: PB nullptr actor")); return; } TangibleObject* const object = dynamic_cast(NetworkIdManager::getObjectById (target)); - if (object == NULL) + if (object == nullptr) { - WARNING (true, ("commandFuncRepair: PB null target")); + WARNING (true, ("commandFuncRepair: PB nullptr target")); return; } } @@ -6424,7 +6424,7 @@ static void commandFuncToggleSearchableByCtsSourceGalaxy(Command const &, Networ PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(actor)); - if (playerObject != NULL) + if (playerObject != nullptr) { playerObject->toggleSearchableByCtsSourceGalaxy(); } @@ -6438,7 +6438,7 @@ static void commandFuncToggleDisplayLocationInSearchResults(Command const &, Net PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(actor)); - if (playerObject != NULL) + if (playerObject != nullptr) { playerObject->toggleDisplayLocationInSearchResults(); } @@ -6452,7 +6452,7 @@ static void commandFuncToggleAnonymous(Command const &, NetworkId const &actor, PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(actor)); - if (playerObject != NULL) + if (playerObject != nullptr) { playerObject->toggleAnonymous(); } @@ -6466,7 +6466,7 @@ static void commandFuncToggleHelper(Command const &, NetworkId const &actor, Net PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(actor)); - if (playerObject != NULL) + if (playerObject != nullptr) { playerObject->toggleHelper(); } @@ -6480,7 +6480,7 @@ static void commandFuncToggleRolePlay(Command const &, NetworkId const &actor, N PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(actor)); - if (playerObject != NULL) + if (playerObject != nullptr) { playerObject->toggleRolePlay(); } @@ -6493,7 +6493,7 @@ static void commandFuncToggleOutOfCharacter(Command const &, NetworkId const &ac { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(actor)); - if (playerObject != NULL) + if (playerObject != nullptr) { playerObject->toggleOutOfCharacter(); } @@ -6505,7 +6505,7 @@ static void commandFuncToggleLookingForWork(Command const &, NetworkId const &ac { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(actor)); - if (playerObject != NULL) + if (playerObject != nullptr) { playerObject->toggleLookingForWork(); } @@ -6520,7 +6520,7 @@ static void commandFuncToggleLookingForGroup(Command const &, NetworkId const &a PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(actor)); - if (playerObject != NULL) + if (playerObject != nullptr) { playerObject->toggleLookingForGroup(); } @@ -6534,7 +6534,7 @@ static void commandFuncToggleAwayFromKeyBoard(Command const &, NetworkId const & PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(actor)); - if (playerObject != NULL) + if (playerObject != nullptr) { playerObject->toggleAwayFromKeyBoard(); } @@ -6546,7 +6546,7 @@ static void commandFuncToggleDisplayingFactionRank(Command const &, NetworkId co { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(actor)); - if (playerObject != NULL) + if (playerObject != nullptr) { playerObject->toggleDisplayingFactionRank(); } @@ -6558,7 +6558,7 @@ static void commandFuncReport(Command const &, NetworkId const &actor, NetworkId { CreatureObject const * const reportingCreatureObject = CreatureObject::getCreatureObject(actor); - if (reportingCreatureObject != NULL) + if (reportingCreatureObject != nullptr) { if (ReportManager::isThrottled(actor)) { @@ -6635,16 +6635,16 @@ static void commandFuncReport(Command const &, NetworkId const &actor, NetworkId static void commandFuncNpcConversationStart(Command const &, NetworkId const &actor, NetworkId const & target, Unicode::String const ¶ms) { ServerObject * const actorObject = safe_cast(NetworkIdManager::getObjectById(actor)); - CreatureObject * const player = actorObject != NULL ? actorObject->asCreatureObject() : NULL; - if (player == NULL) + CreatureObject * const player = actorObject != nullptr ? actorObject->asCreatureObject() : nullptr; + if (player == nullptr) { DEBUG_WARNING(true, ("commandFuncNpcConversationStart: couldn't find actor")); return; } ServerObject * const npcObject = safe_cast(NetworkIdManager::getObjectById(target)); - TangibleObject * const npc = npcObject != NULL ? npcObject->asTangibleObject() : NULL; - if (npc == NULL) + TangibleObject * const npc = npcObject != nullptr ? npcObject->asTangibleObject() : nullptr; + if (npc == nullptr) { DEBUG_WARNING(true, ("commandFuncNpcConversationStart: Couldn't find npc to converse with")); return; @@ -6678,8 +6678,8 @@ static void commandFuncNpcConversationStart(Command const &, NetworkId const &ac static void commandFuncNpcConversationStop(Command const &, NetworkId const &actor, NetworkId const & target, Unicode::String const ¶ms) { ServerObject * const actorObject = safe_cast(NetworkIdManager::getObjectById(actor)); - TangibleObject * const player = actorObject != NULL ? actorObject->asTangibleObject(): NULL; - if (player == NULL) + TangibleObject * const player = actorObject != nullptr ? actorObject->asTangibleObject(): nullptr; + if (player == nullptr) { DEBUG_WARNING(true, ("commandFuncNpcConversationStop: couldn't find actor")); return; @@ -6693,7 +6693,7 @@ static void commandFuncNpcConversationSelect(Command const &, NetworkId const &a { Object * const actorObject = NetworkIdManager::getObjectById(actor); CreatureObject * const player = dynamic_cast(actorObject); - if (player == NULL) + if (player == nullptr) { DEBUG_WARNING(true, ("commandFuncNpcConversationStop: couldn't find actor")); return; @@ -6709,7 +6709,7 @@ static void commandFuncNpcConversationSelect(Command const &, NetworkId const &a static void commandFuncServerDestroyObject (Command const &, NetworkId const & actor, NetworkId const & target, Unicode::String const & params) { CreatureObject * const player = dynamic_cast (NetworkIdManager::getObjectById (actor)); - if (player == NULL) + if (player == nullptr) { DEBUG_WARNING (true, ("commandFuncServerDestroyObject: couldn't find actor")); return; @@ -6792,11 +6792,11 @@ static void commandFuncSetSpokenLanguage(Command const &, NetworkId const &actor Object * const object = NetworkIdManager::getObjectById(actor); CreatureObject * const creatureObject = dynamic_cast(object); - if (creatureObject != NULL) + if (creatureObject != nullptr) { PlayerObject *playerObject = PlayerCreatureController::getPlayerObject(creatureObject); - if (playerObject != NULL) + if (playerObject != nullptr) { size_t pos = 0; int const languageId = nextIntParm(params, pos); @@ -6831,14 +6831,14 @@ static void commandFuncUnstick(Command const &, NetworkId const &actor, NetworkI { Object * const object = NetworkIdManager::getObjectById(actor); CreatureObject * const creatureObject = dynamic_cast(object); - if (creatureObject != NULL) + if (creatureObject != nullptr) { if (!ShipObject::getContainingShipObject(creatureObject)) // no unsticking in ships { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(creatureObject); if (playerObject) { - Chat::sendSystemMessageSimple(*creatureObject, SharedStringIds::unstick_in_progress, NULL); + Chat::sendSystemMessageSimple(*creatureObject, SharedStringIds::unstick_in_progress, nullptr); if (!playerObject->getIsUnsticking()) { Vector position = creatureObject->getPosition_p(); @@ -7324,8 +7324,8 @@ static void commandFuncInstallShipComponents(Command const &, NetworkId const & //params for installShipComponent are " " Object const * const actorObj = NetworkIdManager::getObjectById(actor); - ServerObject const * const actorServerObj = actorObj ? actorObj->asServerObject() : NULL; - CreatureObject const * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : NULL; + ServerObject const * const actorServerObj = actorObj ? actorObj->asServerObject() : nullptr; + CreatureObject const * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : nullptr; if(!actorCreature) { return; @@ -7338,7 +7338,7 @@ static void commandFuncInstallShipComponents(Command const &, NetworkId const & if(!client->isGod()) { Object * const targetObj = NetworkIdManager::getObjectById(target); - ServerObject * const targetServerObj = targetObj ? targetObj->asServerObject() : NULL; + ServerObject * const targetServerObj = targetObj ? targetObj->asServerObject() : nullptr; if( !targetServerObj || ((targetServerObj->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space) && (targetServerObj->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space_npe)) ) return; @@ -7351,16 +7351,16 @@ static void commandFuncInstallShipComponents(Command const &, NetworkId const & size_t pos = 0; NetworkId const & shipId = nextOidParm(params, pos); Object * const shipObj = NetworkIdManager::getObjectById(shipId); - ServerObject * const shipServerObj = shipObj ? shipObj->asServerObject() : NULL; - ShipObject * const ship = shipServerObj ? shipServerObj->asShipObject() : NULL; + ServerObject * const shipServerObj = shipObj ? shipObj->asServerObject() : nullptr; + ShipObject * const ship = shipServerObj ? shipServerObj->asShipObject() : nullptr; if(!ship) return; ShipChassisSlotType::Type const slotType = static_cast(nextIntParm(params, pos)); NetworkId const & componentId = nextOidParm(params, pos); Object * const componentObj = NetworkIdManager::getObjectById(componentId); - ServerObject * const componentServerObj = componentObj ? componentObj->asServerObject() : NULL; - TangibleObject * const component = componentServerObj ? componentServerObj->asTangibleObject() : NULL; + ServerObject * const componentServerObj = componentObj ? componentObj->asServerObject() : nullptr; + TangibleObject * const component = componentServerObj ? componentServerObj->asTangibleObject() : nullptr; if(!component) { return; @@ -7409,8 +7409,8 @@ static void commandFuncUninstallShipComponents(Command const &, NetworkId const //params for uninstallShipComponent are " " Object * const actorObj = NetworkIdManager::getObjectById(actor); - ServerObject * const actorServerObj = actorObj ? actorObj->asServerObject() : NULL; - CreatureObject * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : NULL; + ServerObject * const actorServerObj = actorObj ? actorObj->asServerObject() : nullptr; + CreatureObject * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : nullptr; if(!actorCreature) return; ServerObject * const actorInv = actorCreature->getInventory(); @@ -7424,7 +7424,7 @@ static void commandFuncUninstallShipComponents(Command const &, NetworkId const if(!client->isGod()) { Object * const targetObj = NetworkIdManager::getObjectById(target); - ServerObject * const targetServerObj = targetObj ? targetObj->asServerObject() : NULL; + ServerObject * const targetServerObj = targetObj ? targetObj->asServerObject() : nullptr; if(!targetServerObj || ((targetServerObj->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space) && (targetServerObj->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space_npe)) ) @@ -7456,8 +7456,8 @@ static void commandFuncUninstallShipComponents(Command const &, NetworkId const size_t pos = 0; NetworkId const & shipId = nextOidParm(params, pos); Object * const shipObj = NetworkIdManager::getObjectById(shipId); - ServerObject * const shipServerObj = shipObj ? shipObj->asServerObject() : NULL; - ShipObject * const ship = shipServerObj ? shipServerObj->asShipObject() : NULL; + ServerObject * const shipServerObj = shipObj ? shipObj->asServerObject() : nullptr; + ShipObject * const ship = shipServerObj ? shipServerObj->asShipObject() : nullptr; if(!ship) return; @@ -7474,8 +7474,8 @@ static void commandFuncInsertItemIntoShipComponentSlot(Command const &, NetworkI //params for insertItemIntoShipComponentSlot are " " Object * const actorObj = NetworkIdManager::getObjectById(actor); - ServerObject * const actorServerObj = actorObj ? actorObj->asServerObject() : NULL; - CreatureObject * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : NULL; + ServerObject * const actorServerObj = actorObj ? actorObj->asServerObject() : nullptr; + CreatureObject * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : nullptr; if(!actorCreature) return; @@ -7486,7 +7486,7 @@ static void commandFuncInsertItemIntoShipComponentSlot(Command const &, NetworkI if(!client->isGod()) { Object * const targetObj = NetworkIdManager::getObjectById(target); - ServerObject * const targetServerObj = targetObj ? targetObj->asServerObject() : NULL; + ServerObject * const targetServerObj = targetObj ? targetObj->asServerObject() : nullptr; if(!targetServerObj || ((targetServerObj->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space) && (targetServerObj->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space_npe)) ) return; @@ -7499,8 +7499,8 @@ static void commandFuncInsertItemIntoShipComponentSlot(Command const &, NetworkI size_t pos = 0; NetworkId const & shipId = nextOidParm(params, pos); Object * const shipObj = NetworkIdManager::getObjectById(shipId); - ServerObject * const shipServerObj = shipObj ? shipObj->asServerObject() : NULL; - ShipObject * const ship = shipServerObj ? shipServerObj->asShipObject() : NULL; + ServerObject * const shipServerObj = shipObj ? shipObj->asServerObject() : nullptr; + ShipObject * const ship = shipServerObj ? shipServerObj->asShipObject() : nullptr; if(!ship) return; @@ -7527,8 +7527,8 @@ static void commandFuncAssociateDroidControlDeviceWithShip(Command const &, Netw //params for associateDroidControlDeviceWithShip are " " Object const * const actorObj = NetworkIdManager::getObjectById(actor); - ServerObject const * const actorServerObj = actorObj ? actorObj->asServerObject() : NULL; - CreatureObject const * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : NULL; + ServerObject const * const actorServerObj = actorObj ? actorObj->asServerObject() : nullptr; + CreatureObject const * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : nullptr; if (!actorCreature) return; @@ -7539,7 +7539,7 @@ static void commandFuncAssociateDroidControlDeviceWithShip(Command const &, Netw if(!client->isGod()) { Object * const targetObj = NetworkIdManager::getObjectById(target); - ServerObject * const targetServerObj = targetObj ? targetObj->asServerObject() : NULL; + ServerObject * const targetServerObj = targetObj ? targetObj->asServerObject() : nullptr; if(!targetServerObj || ((targetServerObj->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space) && (targetServerObj->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space_npe)) ) return; @@ -7552,8 +7552,8 @@ static void commandFuncAssociateDroidControlDeviceWithShip(Command const &, Netw size_t pos = 0; NetworkId const & shipId = nextOidParm(params, pos); Object * const shipObj = NetworkIdManager::getObjectById(shipId); - ServerObject * const shipServerObj = shipObj ? shipObj->asServerObject() : NULL; - ShipObject * const ship = shipServerObj ? shipServerObj->asShipObject() : NULL; + ServerObject * const shipServerObj = shipObj ? shipObj->asServerObject() : nullptr; + ShipObject * const ship = shipServerObj ? shipServerObj->asShipObject() : nullptr; if(!ship) return; @@ -7581,8 +7581,8 @@ static void commandFuncAssociateDroidControlDeviceWithShip(Command const &, Netw static void commandFuncServerAsteroidDataListen(Command const &, NetworkId const & actor, NetworkId const & , Unicode::String const & ) { Object const * const actorObj = NetworkIdManager::getObjectById(actor); - ServerObject const * const actorServerObj = actorObj ? actorObj->asServerObject() : NULL; - CreatureObject const * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : NULL; + ServerObject const * const actorServerObj = actorObj ? actorObj->asServerObject() : nullptr; + CreatureObject const * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : nullptr; if(!actorCreature) return; @@ -7594,8 +7594,8 @@ static void commandFuncServerAsteroidDataListen(Command const &, NetworkId const static void commandFuncServerAsteroidDataStopListening(Command const &, NetworkId const & actor, NetworkId const & , Unicode::String const & ) { Object const * const actorObj = NetworkIdManager::getObjectById(actor); - ServerObject const * const actorServerObj = actorObj ? actorObj->asServerObject() : NULL; - CreatureObject const * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : NULL; + ServerObject const * const actorServerObj = actorObj ? actorObj->asServerObject() : nullptr; + CreatureObject const * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : nullptr; if(!actorCreature) return; @@ -7621,8 +7621,8 @@ static void commandFuncBoosterOff(Command const &, NetworkId const & actor, Netw static void commandFuncSetFormation(Command const &, NetworkId const & actor, NetworkId const &, Unicode::String const & params) { Object * const o = NetworkIdManager::getObjectById(actor); - ServerObject * const so = o ? o->asServerObject() : NULL; - CreatureObject * const actorCreature = so ? so->asCreatureObject() : NULL; + ServerObject * const so = o ? o->asServerObject() : nullptr; + CreatureObject * const actorCreature = so ? so->asCreatureObject() : nullptr; if(actorCreature) { GroupObject * const group = actorCreature->getGroup(); @@ -7676,15 +7676,15 @@ static void commandFuncUnDock(Command const &, NetworkId const & actor, NetworkI { Object * const object = NetworkIdManager::getObjectById(actor); - if (object != NULL) + if (object != nullptr) { ShipObject * const shipObject = ShipObject::getContainingShipObject(object->asServerObject()); - if (shipObject != NULL) + if (shipObject != nullptr) { ShipController * const shipController = dynamic_cast(shipObject->getController()); - if (shipController != NULL) + if (shipController != nullptr) { shipController->unDock(); } @@ -7695,12 +7695,12 @@ static void commandFuncUnDock(Command const &, NetworkId const & actor, NetworkI } else { - WARNING(true, ("commandFuncUnDock() Undock requested on an object(%s) contained by a NULL ShipObject.", object->getDebugInformation().c_str())); + WARNING(true, ("commandFuncUnDock() Undock requested on an object(%s) contained by a nullptr ShipObject.", object->getDebugInformation().c_str())); } } else { - WARNING(true, ("commandFuncUnDock() Undock requested on a NULL object(%s).", actor.getValueString().c_str())); + WARNING(true, ("commandFuncUnDock() Undock requested on a nullptr object(%s).", actor.getValueString().c_str())); } } @@ -7709,7 +7709,7 @@ static void commandFuncUnDock(Command const &, NetworkId const & actor, NetworkI static void commandFuncLaunchIntoSpace(Command const &, NetworkId const & actor, NetworkId const & target, Unicode::String const & params) { ServerObject * const actorServerObj = safe_cast(NetworkIdManager::getObjectById(actor)); - CreatureObject * const actorCreature = actorServerObj != NULL ? actorServerObj->asCreatureObject() : NULL; + CreatureObject * const actorCreature = actorServerObj != nullptr ? actorServerObj->asCreatureObject() : nullptr; if(!actorCreature) { WARNING(true, ("No actorCreature in commandFuncLaunchIntoSpace")); @@ -7725,7 +7725,7 @@ static void commandFuncLaunchIntoSpace(Command const &, NetworkId const & actor, //target must be a space terminal Object const * const o = NetworkIdManager::getObjectById(target); - ServerObject const * const so = o ? o->asServerObject() : NULL; + ServerObject const * const so = o ? o->asServerObject() : nullptr; if(!so) { StringId invalidTargetId("player_utility", "target_not_server_object"); @@ -7759,7 +7759,7 @@ static void commandFuncLaunchIntoSpace(Command const &, NetworkId const & actor, return; } Object * const terminalO = NetworkIdManager::getObjectById(target); - ServerObject * const terminalSO = terminalO ? terminalO->asServerObject() : NULL; + ServerObject * const terminalSO = terminalO ? terminalO->asServerObject() : nullptr; if(terminalSO) { std::vector networkIds; @@ -7824,7 +7824,7 @@ static void commandFuncLaunchIntoSpace(Command const &, NetworkId const & actor, static void commandFuncAcceptQuest(Command const &, NetworkId const & actor, NetworkId const & target, Unicode::String const & params) { ServerObject * const actorServerObj = safe_cast(NetworkIdManager::getObjectById(actor)); - CreatureObject * const actorCreature = actorServerObj != NULL ? actorServerObj->asCreatureObject() : NULL; + CreatureObject * const actorCreature = actorServerObj != nullptr ? actorServerObj->asCreatureObject() : nullptr; if(!actorCreature) { WARNING(true, ("No actorCreature in commandFuncAcceptQuest")); @@ -7851,7 +7851,7 @@ static void commandFuncAcceptQuest(Command const &, NetworkId const & actor, Net static void commandFuncReceiveReward(Command const &, NetworkId const & actor, NetworkId const & target, Unicode::String const & params) { ServerObject * const actorServerObj = safe_cast(NetworkIdManager::getObjectById(actor)); - CreatureObject * const actorCreature = actorServerObj != NULL ? actorServerObj->asCreatureObject() : NULL; + CreatureObject * const actorCreature = actorServerObj != nullptr ? actorServerObj->asCreatureObject() : nullptr; if(!actorCreature) { WARNING(true, ("No actorCreature in commandFuncReceiveReward")); @@ -7895,7 +7895,7 @@ static void commandFuncAbandonQuest(Command const &, NetworkId const & actor, Ne if(QuestManager::isQuestAbandonable(questName)) { ServerObject * const actorServerObj = safe_cast(NetworkIdManager::getObjectById(actor)); - CreatureObject * const actorCreature = actorServerObj != NULL ? actorServerObj->asCreatureObject() : NULL; + CreatureObject * const actorCreature = actorServerObj != nullptr ? actorServerObj->asCreatureObject() : nullptr; if(actorCreature) { PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(actorCreature); @@ -7922,7 +7922,7 @@ static void commandFuncAbandonQuest(Command const &, NetworkId const & actor, Ne static void commandFuncExchangeListCredits(Command const &, NetworkId const &actor, NetworkId const &target, Unicode::String const ¶ms) { ServerObject * const actorServerObj = safe_cast(NetworkIdManager::getObjectById(actor)); - CreatureObject * const actorCreature = actorServerObj != NULL ? actorServerObj->asCreatureObject() : NULL; + CreatureObject * const actorCreature = actorServerObj != nullptr ? actorServerObj->asCreatureObject() : nullptr; if(!actorCreature) { WARNING(true, ("No actorCreature in commandFuncReceiveReward")); @@ -8680,7 +8680,7 @@ static void commandFuncOccupyUnlockedSlot(Command const &, NetworkId const &acto } // check to see if there is a cooldown is in effect for the command - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); if (!gmClient->isGod() && gm->getObjVars().hasItem("timeNextOccupyVacateUnlockedSlotCommandAllowed") && (gm->getObjVars().getType("timeNextOccupyVacateUnlockedSlotCommandAllowed") == DynamicVariable::INT)) { int timeNextOccupyVacateUnlockedSlotCommandAllowed = 0; @@ -8746,7 +8746,7 @@ static void commandFuncVacateUnlockedSlot(Command const &, NetworkId const &acto } // check to see if there is a cooldown is in effect for the command - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); if (!gmClient->isGod() && gm->getObjVars().hasItem("timeNextOccupyVacateUnlockedSlotCommandAllowed") && (gm->getObjVars().getType("timeNextOccupyVacateUnlockedSlotCommandAllowed") == DynamicVariable::INT)) { int timeNextOccupyVacateUnlockedSlotCommandAllowed = 0; @@ -8834,7 +8834,7 @@ static void commandFuncSwapUnlockedSlot(Command const &, NetworkId const &actor, } // check to see if there is a cooldown is in effect for the command - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); if (!gmClient->isGod() && gm->getObjVars().hasItem("timeNextOccupyVacateUnlockedSlotCommandAllowed") && (gm->getObjVars().getType("timeNextOccupyVacateUnlockedSlotCommandAllowed") == DynamicVariable::INT)) { int timeNextOccupyVacateUnlockedSlotCommandAllowed = 0; @@ -8902,7 +8902,7 @@ static void commandFuncPickupAllRoomItemsIntoInventory(Command const &, NetworkI return; // don't allow multiple /pickupAllRoomItemsIntoInventory and/or /dropAllInventoryItemsIntoRoom - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); int pickupDropAllItemsOperationTimeout = 0; if (targetObj->getObjVars().getItem("pickupDropAllItemsOperation.timeout", pickupDropAllItemsOperationTimeout) && (pickupDropAllItemsOperationTimeout > timeNow)) { @@ -9051,7 +9051,7 @@ static void commandFuncDropAllInventoryItemsIntoRoom(Command const &, NetworkId return; // don't allow multiple /pickupAllRoomItemsIntoInventory and/or /dropAllInventoryItemsIntoRoom - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); int pickupDropAllItemsOperationTimeout = 0; if (targetObj->getObjVars().getItem("pickupDropAllItemsOperation.timeout", pickupDropAllItemsOperationTimeout) && (pickupDropAllItemsOperationTimeout > timeNow)) { @@ -9255,7 +9255,7 @@ static void commandFuncRestoreDecorationLayout(Command const &, NetworkId const } // don't allow another restore on the pob while one is still in progress - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); int restoreDecorationOperationTimeout = 0; if (targetObj->getObjVars().getItem("restoreDecorationOperation.timeout", restoreDecorationOperationTimeout) && (restoreDecorationOperationTimeout > timeNow)) { @@ -9330,7 +9330,7 @@ static void commandFuncAreaPickRandomPlayer(Command const &, NetworkId const &ac if (!client) return; - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); if (!client->isGod() && targetObj->getObjVars().hasItem("timeNextAreaPickRandomPlayerCommandAllowed") && (targetObj->getObjVars().getType("timeNextAreaPickRandomPlayerCommandAllowed") == DynamicVariable::INT)) { int timeNextAreaPickRandomPlayerCommandAllowed = 0; @@ -9352,7 +9352,7 @@ static void commandFuncAreaPickRandomPlayer(Command const &, NetworkId const &ac if (!params.empty()) { Unicode::UnicodeStringVector tokens; - if (Unicode::tokenize(Unicode::toLower(params), tokens, NULL, NULL) && !tokens.empty()) + if (Unicode::tokenize(Unicode::toLower(params), tokens, nullptr, nullptr) && !tokens.empty()) { static Unicode::String const paramsPoint1 = Unicode::narrowToWide("-point"); static Unicode::String const paramsPoint2 = Unicode::narrowToWide("point"); @@ -9477,7 +9477,7 @@ static void commandFuncRoomPickRandomPlayer(Command const &, NetworkId const &ac if (!client) return; - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); if (!client->isGod() && targetObj->getObjVars().hasItem("timeNextRoomPickRandomPlayerCommandAllowed") && (targetObj->getObjVars().getType("timeNextRoomPickRandomPlayerCommandAllowed") == DynamicVariable::INT)) { int timeNextRoomPickRandomPlayerCommandAllowed = 0; @@ -9498,7 +9498,7 @@ static void commandFuncRoomPickRandomPlayer(Command const &, NetworkId const &ac if (!params.empty()) { Unicode::UnicodeStringVector tokens; - if (Unicode::tokenize(Unicode::toLower(params), tokens, NULL, NULL) && !tokens.empty()) + if (Unicode::tokenize(Unicode::toLower(params), tokens, nullptr, nullptr) && !tokens.empty()) { static Unicode::String const paramsPoint1 = Unicode::narrowToWide("-point"); static Unicode::String const paramsPoint2 = Unicode::narrowToWide("point"); diff --git a/engine/server/library/serverGame/src/shared/command/CommandQueue.cpp b/engine/server/library/serverGame/src/shared/command/CommandQueue.cpp index d581b8ae..913fa7e0 100755 --- a/engine/server/library/serverGame/src/shared/command/CommandQueue.cpp +++ b/engine/server/library/serverGame/src/shared/command/CommandQueue.cpp @@ -309,11 +309,11 @@ void CommandQueue::executeCommandQueue() { CommandQueueEntry &entry = *(m_queue.begin()); - // try to recover from having a null command + // try to recover from having a nullptr command // maybe this should result in a fatal error? if ( entry.m_command == 0 ) { - WARNING( true, ( "executeCommandQueue: entry.m_command was NULL! WTF?\n" ) ); + WARNING( true, ( "executeCommandQueue: entry.m_command was nullptr! WTF?\n" ) ); m_queue.pop(); m_state = State_Waiting; m_nextEventTime = 0.f; @@ -387,7 +387,7 @@ void CommandQueue::executeCommandQueue() // switch state might have removed elements from the queue and invalidated entry // so we can't assume that we're still safe - if(!m_queue.empty() && (&(*(m_queue.begin())) == &entry) && m_queue.begin()->m_command != NULL) + if(!m_queue.empty() && (&(*(m_queue.begin())) == &entry) && m_queue.begin()->m_command != nullptr) { handleEntryRemoved(*(m_queue.begin()), true); m_queue.pop(); @@ -458,7 +458,7 @@ void CommandQueue::updateClient(TimerClass timerClass ) { CreatureObject * const creatureOwner = getServerOwner().asCreatureObject(); - if ( (creatureOwner == NULL) + if ( (creatureOwner == nullptr) || !creatureOwner->getClient()) { return; @@ -475,7 +475,7 @@ void CommandQueue::updateClient(TimerClass timerClass ) if ( entry.m_command == 0 ) // woah that's bad news! { - WARNING( true, ( "CommandQueue::updateClient(): command was NULL!\n" ) ); + WARNING( true, ( "CommandQueue::updateClient(): command was nullptr!\n" ) ); return; } @@ -539,7 +539,7 @@ void CommandQueue::notifyClient() { CreatureObject * const creatureOwner = getServerOwner().asCreatureObject(); - if ( (creatureOwner == NULL) + if ( (creatureOwner == nullptr) || !creatureOwner->getClient()) { return; @@ -555,7 +555,7 @@ void CommandQueue::notifyClient() if ( entry.m_command == 0 ) { - WARNING( true, ( "CommandQueue::notifyClient(): command was NULL!\n" ) ); + WARNING( true, ( "CommandQueue::notifyClient(): command was nullptr!\n" ) ); return; } @@ -612,7 +612,7 @@ bool CommandQueue::doWarmupTrigger(const CommandQueueEntry &entry ) CreatureObject * const creatureOwner = getServerOwner().asCreatureObject(); - if (creatureOwner != NULL) + if (creatureOwner != nullptr) { creatureOwner->doWarmupChecks( *entry.m_command, entry.m_targetId, entry.m_params, m_status, m_statusDetail ); @@ -620,7 +620,7 @@ bool CommandQueue::doWarmupTrigger(const CommandQueueEntry &entry ) if ( m_status == Command::CEC_Success ) { - FATAL( entry.m_command == 0, ( "entry had a null command\n" ) ); + FATAL( entry.m_command == 0, ( "entry had a nullptr command\n" ) ); std::vector timeValues; timeValues.push_back( entry.m_command->m_warmTime ); @@ -659,7 +659,7 @@ uint32 CommandQueue::getCurrentCommand() const if ( entry.m_command == 0 ) { - WARNING( true, ( "CommandQueue::getCurrentCommand(): command was NULL!\n" ) ); + WARNING( true, ( "CommandQueue::getCurrentCommand(): command was nullptr!\n" ) ); return 0; } @@ -680,7 +680,7 @@ void CommandQueue::switchState() if ( entry.m_command == 0 ) { - WARNING( true, ( "CommandQueue::switchState(): command was NULL!\n" ) ); + WARNING( true, ( "CommandQueue::switchState(): command was nullptr!\n" ) ); return; } @@ -726,7 +726,7 @@ void CommandQueue::switchState() bool const targetIsAuthoritative = target && target->isAuthoritative(); REPORT_LOG(true, ("CommandQueue::switchState():QUEUE_ENTRY_COMMAND: commandName=[%s] commandHash=[%lu] owner=[%s][%s][%s] target=[%s][%s][%s] sequenceId=[%lu] params=[%s] clearable=[%s] priority=[%d]\n", - entryCopy.m_command ? entryCopy.m_command->m_commandName.c_str() : "NULL", + entryCopy.m_command ? entryCopy.m_command->m_commandName.c_str() : "nullptr", entryCopy.m_command ? entryCopy.m_command->m_commandHash : 0, NameManager::getInstance().getPlayerName(getOwner().getNetworkId()).c_str(), getOwner().getNetworkId().getValueString().c_str(), @@ -746,7 +746,7 @@ void CommandQueue::switchState() for (; itEntry != m_queue.end(); ++itEntry) { - REPORT_LOG(true, ("CommandQueue::switchState():QUEUE_ENTRY_QUEUE: commandName=[%s]\n", itEntry->m_command ? itEntry->m_command->m_commandName.c_str() : "NULL")); + REPORT_LOG(true, ("CommandQueue::switchState():QUEUE_ENTRY_QUEUE: commandName=[%s]\n", itEntry->m_command ? itEntry->m_command->m_commandName.c_str() : "nullptr")); } } #endif @@ -838,7 +838,7 @@ void CommandQueue::switchState() bool const targetIsAuthoritative = target && target->isAuthoritative(); REPORT_LOG(true, ("CommandQueue::switchState():QUEUE_ENTRY_COMMAND: commandName=[%s] commandHash=[%lu] owner=[%s][%s][%s] target=[%s][%s][%s] sequenceId=[%lu] params=[%s] clearable=[%s] priority=[%d]\n", - entryCopy.m_command ? entryCopy.m_command->m_commandName.c_str() : "NULL", + entryCopy.m_command ? entryCopy.m_command->m_commandName.c_str() : "nullptr", entryCopy.m_command ? entryCopy.m_command->m_commandHash : 0, NameManager::getInstance().getPlayerName(getOwner().getNetworkId()).c_str(), getOwner().getNetworkId().getValueString().c_str(), @@ -858,7 +858,7 @@ void CommandQueue::switchState() for (; itEntry != m_queue.end(); ++itEntry) { - REPORT_LOG(true, ("CommandQueue::switchState():QUEUE_ENTRY_QUEUE: commandName=[%s]\n", itEntry->m_command ? itEntry->m_command->m_commandName.c_str() : "NULL")); + REPORT_LOG(true, ("CommandQueue::switchState():QUEUE_ENTRY_QUEUE: commandName=[%s]\n", itEntry->m_command ? itEntry->m_command->m_commandName.c_str() : "nullptr")); } } #endif @@ -1160,7 +1160,7 @@ void CommandQueue::notifyClientOfCommandRemoval(uint32 sequenceId, float waitTim CreatureObject * const creatureOwner = getServerOwner().asCreatureObject(); - if ( (creatureOwner != NULL) + if ( (creatureOwner != nullptr) && creatureOwner->getClient() && (sequenceId != 0)) { @@ -1359,7 +1359,7 @@ void CommandQueue::executeCommand(Command const &command, NetworkId const &targe CreatureObject * const creatureOwner = getServerOwner().asCreatureObject(); - if (creatureOwner != NULL) + if (creatureOwner != nullptr) { CreatureController * const creatureController = creatureOwner->getCreatureController(); if (creatureController && creatureController->getSecureTrade()) @@ -1399,7 +1399,7 @@ void CommandQueue::executeCommand(Command const &command, NetworkId const &targe TangibleObject * const tangibleOwner = getServerOwner().asTangibleObject(); - if (tangibleOwner != NULL) + if (tangibleOwner != nullptr) { // Really execute the command - swap targets if necessary, and call // forceExecuteCommand (which will handle messaging if not authoritative) @@ -1440,7 +1440,7 @@ CommandQueue * CommandQueue::getCommandQueue(Object & object) { Property * const property = object.getProperty(getClassPropertyId()); - return (property != NULL) ? (static_cast(property)) : NULL; + return (property != nullptr) ? (static_cast(property)) : nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/command/CommandQueue.h b/engine/server/library/serverGame/src/shared/command/CommandQueue.h index bedf3717..03c861e0 100755 --- a/engine/server/library/serverGame/src/shared/command/CommandQueue.h +++ b/engine/server/library/serverGame/src/shared/command/CommandQueue.h @@ -218,7 +218,7 @@ public: void resetCooldowns(); // debug diagnostic - void spew(std::string * output = NULL); + void spew(std::string * output = nullptr); private: CommandQueue(CommandQueue const &); diff --git a/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesMarket.cpp b/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesMarket.cpp index d2d55dfd..7529726f 100755 --- a/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesMarket.cpp +++ b/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesMarket.cpp @@ -201,7 +201,7 @@ namespace CommoditiesMarketNamespace Container::ContainerErrorCode tmp = Container::CEC_Success; ServerObject *bazaarContainer = auctionContainer.getBazaarContainer(); - if (!bazaarContainer || !ContainerInterface::canTransferTo(bazaarContainer, item, NULL, tmp)) + if (!bazaarContainer || !ContainerInterface::canTransferTo(bazaarContainer, item, nullptr, tmp)) { errorCode = ar_INVALID_ITEM_ID; } @@ -326,7 +326,7 @@ bool CommoditiesMarketNamespace::isVendorItemRestriction(ServerObject const & it return false; } - ItemRestriction const * itemRestriction = NULL; + ItemRestriction const * itemRestriction = nullptr; std::map::const_iterator const iterFind = itemRestrictionList.find(itemRestrictionFile); if (iterFind != itemRestrictionList.end()) @@ -1068,7 +1068,7 @@ void CommoditiesMarket::getCommoditiesServerConnection() if (ObjectIdManager::hasAvailableObjectId()) { s_market = new CommoditiesServerConnection(ConfigServerGame::getCommoditiesServerServiceBindInterface(), static_cast(ConfigServerGame::getCommoditiesServerServiceBindPort())); - s_timeMarketConnectionCreated = ::time(NULL); + s_timeMarketConnectionCreated = ::time(nullptr); } } @@ -1082,10 +1082,10 @@ int CommoditiesMarket::getCommoditiesServerConnectionAgeSeconds() if (s_timeMarketConnectionCreated <= 0) return 0; - if (s_market == NULL) + if (s_market == nullptr) return 0; - return static_cast(::time(NULL) - s_timeMarketConnectionCreated); + return static_cast(::time(nullptr) - s_timeMarketConnectionCreated); } // ---------------------------------------------------------------------- @@ -1295,7 +1295,7 @@ void CommoditiesMarket::onAddAuction(int sequence, int32 result, const NetworkId CreatureObject * const auctionCreator = dynamic_cast(NetworkIdManager::getObjectById(auctionOwnerId)); ServerObject * const item = dynamic_cast(NetworkIdManager::getObjectById(itemId)); - Client *client = NULL; + Client *client = nullptr; if (auctionCreator) client = auctionCreator->getClient(); @@ -1347,7 +1347,7 @@ void CommoditiesMarket::onAddAuction(int sequence, int32 result, const NetworkId if (container) { Container::ContainerErrorCode tmp = Container::CEC_Success; - bool result = ContainerInterface::transferItemToVolumeContainer(*container,*item, NULL, tmp); + bool result = ContainerInterface::transferItemToVolumeContainer(*container,*item, nullptr, tmp); if (!result) { LOG("CustomerService", ("Auction: Player %s transfer of item (%Ld) to auction container (%Ld) failed with code %d", @@ -2536,7 +2536,7 @@ void CommoditiesMarket::checkPendingLoads(const NetworkId &itemId) bool transferAllowed = true; Container::ContainerErrorCode error = Container::CEC_Success; - transferAllowed = ContainerInterface::canTransferTo(targetContainer, *item, NULL, error); + transferAllowed = ContainerInterface::canTransferTo(targetContainer, *item, nullptr, error); if (!transferAllowed) { @@ -2603,11 +2603,11 @@ void CommoditiesMarket::onGetItemReply(int32 result, int32 requestId, NetworkId LOG("AuctionRetrieval", ("CommoditiesMarket::received onGetItemReply for loading object %s for retrieval", itemId.getValueString().c_str())); AuctionResult auctionResult = ar_OK; CreatureObject *player = dynamic_cast(NetworkIdManager::getObjectById(itemOwnerId)); - Client *client = player ? player->getClient() : NULL; + Client *client = player ? player->getClient() : nullptr; bool transactionFailed = false; - ServerObject* vendor = NULL; - ServerObject* item = NULL; + ServerObject* vendor = nullptr; + ServerObject* item = nullptr; if (result == ARC_AuctionDoesNotExist) { @@ -2637,7 +2637,7 @@ void CommoditiesMarket::onGetItemReply(int32 result, int32 requestId, NetworkId vendor = safe_cast(ContainerInterface::getContainedByObject(*item)); if (vendor && vendor->getNetworkId() == location) { - bool retval = ContainerInterface::transferItemToVolumeContainer(*inventory, *item, NULL, tmp, false); + bool retval = ContainerInterface::transferItemToVolumeContainer(*inventory, *item, nullptr, tmp, false); if (retval) { @@ -2779,7 +2779,7 @@ void CommoditiesMarket::onIsVendorOwner(const NetworkId & requesterId, const Net ServerObject * const auctionContainer = safe_cast(NetworkIdManager::getObjectById(container)); NetworkId resultContainer = container; - const TangibleObject * resultContainerObject = auctionContainer ? auctionContainer->asTangibleObject() : NULL; + const TangibleObject * resultContainerObject = auctionContainer ? auctionContainer->asTangibleObject() : nullptr; if (auctionContainer) { marketName = getLocationString(*auctionContainer); @@ -2952,7 +2952,7 @@ void CommoditiesMarket::onGetItemDetailsReply(int32 result, int32 requestId, Net OutOfBandBase *base = *it; if (!base) { - WARNING(true, ("NULL OOB Base for Auction Data")); + WARNING(true, ("nullptr OOB Base for Auction Data")); return; } if (base->getTypeId() == OutOfBandPackager::OT_auctionToken) @@ -2979,7 +2979,7 @@ void CommoditiesMarket::onGetItemDetailsReply(int32 result, int32 requestId, Net base = *it; if (!base) { - WARNING(true, ("NULL OOB Base for Auction Data")); + WARNING(true, ("nullptr OOB Base for Auction Data")); return; } if (base->getTypeId() == OutOfBandPackager::OT_objectAttributes) @@ -3624,22 +3624,22 @@ void CommoditiesMarket::updateItemTypeMap(int itemTypeMapVersionNumber, int item // get the server template const ObjectTemplate * ot = ObjectTemplateList::fetch(static_cast(itemTemplateId)); - if (ot != NULL) + if (ot != nullptr) { objectName = StringId(std::string(ot->getName())); // get the shared template const ServerObjectTemplate * serverOt = ot->asServerObjectTemplate(); - if (serverOt != NULL) + if (serverOt != nullptr) { const std::string sharedTemplateName(serverOt->getSharedTemplate()); serverOt->releaseReference(); - serverOt = NULL; + serverOt = nullptr; ot = ObjectTemplateList::fetch(sharedTemplateName); - if (ot != NULL) + if (ot != nullptr) { const SharedObjectTemplate * sharedOt = ot->asSharedObjectTemplate(); - if (sharedOt != NULL) + if (sharedOt != nullptr) { gameObjectType = static_cast(sharedOt->getGameObjectType()); StringId const tempObjectName(objectName); @@ -3649,19 +3649,19 @@ void CommoditiesMarket::updateItemTypeMap(int itemTypeMapVersionNumber, int item objectName = tempObjectName; } sharedOt->releaseReference(); - sharedOt = NULL; + sharedOt = nullptr; } else { ot->releaseReference(); - ot = NULL; + ot = nullptr; } } } else { ot->releaseReference(); - ot = NULL; + ot = nullptr; } } else diff --git a/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesServerConnection.cpp b/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesServerConnection.cpp index 1b7b95c9..ad3ff41c 100755 --- a/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesServerConnection.cpp +++ b/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesServerConnection.cpp @@ -576,7 +576,7 @@ void CommoditiesServerConnection::onReceive(const Archive::ByteStream & message) ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(response.getValue().first.first, diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserAi.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserAi.cpp index 65298e93..994b695b 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserAi.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserAi.cpp @@ -74,7 +74,7 @@ CreatureObject * const ConsoleCommandParserAiNamespace::getAiCreatureObject(Crea CreatureObject * const aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId); - if ( (aiCreatureObject == NULL) + if ( (aiCreatureObject == nullptr) || aiCreatureObject->isPlayerControlled()) { Chat::sendSystemMessage(user, Unicode::narrowToWide(FormattedString<1024>().sprintf("[FAILURE] Unable to resolve %s to an AI", aiNetworkId.getValueString().c_str())), Unicode::emptyString); @@ -113,7 +113,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { CreatureObject * const userCreatureObject = CreatureObject::getCreatureObject(userId); - if (userCreatureObject == NULL) + if (userCreatureObject == nullptr) { result += getErrorMessage(argv[0], ERR_FAIL); } @@ -121,7 +121,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { CreatureObject * const aiCreatureObject = getAiCreatureObject(*userCreatureObject, argv); - if (aiCreatureObject == NULL) + if (aiCreatureObject == nullptr) { result += getErrorMessage(argv[0], ERR_FAIL); } @@ -129,7 +129,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(aiCreatureObject->getController()); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { Chat::sendSystemMessage(*userCreatureObject, Unicode::narrowToWide(fs.sprintf("[FAILURE] Unable to resolve %s to an AI", aiCreatureObject->getNetworkId().getValueString().c_str())), Unicode::emptyString); result += getErrorMessage(argv[0], ERR_FAIL); @@ -148,7 +148,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { CreatureObject * const userCreatureObject = CreatureObject::getCreatureObject(userId); - if (userCreatureObject == NULL) + if (userCreatureObject == nullptr) { result += getErrorMessage(argv[0], ERR_FAIL); } @@ -167,7 +167,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri AICreatureController * const aiCreatureController = AICreatureController::getAiCreatureController(targetNetworkId); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { result = Unicode::narrowToWide(fs.sprintf("[FAILURE] Unable to resolve %s to an AI\n", targetNetworkId.getValueString().c_str())); result += getErrorMessage(argv[0], ERR_FAIL); @@ -190,7 +190,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { CellProperty const * const cellProperty = creatureOwner->getParentCell(); - if (cellProperty != NULL) + if (cellProperty != nullptr) { Vector const & position_p = creatureOwner->getPosition_p(); @@ -245,13 +245,13 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri TangibleObject const * const hateTargetTangibleObject = TangibleObject::asTangibleObject(hateTarget.getObject()); float const hate = iterHateList->second; std::string hateTargetName; - if (hateTargetTangibleObject != NULL) + if (hateTargetTangibleObject != nullptr) { hateTargetName = Unicode::wideToNarrow(hateTargetTangibleObject->getEncodedObjectName()).c_str(); } else { - hateTargetName = "NULL"; + hateTargetName = "nullptr"; } result += Unicode::narrowToWide(fs.sprintf("%s:%s(%.1f)\n", hateTargetName.c_str(), hateTarget.getValueString().c_str(), hate)); @@ -271,13 +271,13 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri CachedNetworkId const hateTarget(iter->first); TangibleObject const * const hateTargetTangibleObject = TangibleObject::asTangibleObject(hateTarget.getObject()); std::string hateTargetName; - if (hateTargetTangibleObject != NULL) + if (hateTargetTangibleObject != nullptr) { hateTargetName = Unicode::wideToNarrow(hateTargetTangibleObject->getEncodedObjectName()).c_str(); } else { - hateTargetName = "NULL"; + hateTargetName = "nullptr"; } result += Unicode::narrowToWide(fs.sprintf("%s:%s (%.2f, %lu, %lu)\n", hateTargetName.c_str(), hateTarget.getValueString().c_str(), iter->second.first, iter->second.second.first, iter->second.second.second)); @@ -295,7 +295,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { CreatureObject * const userCreatureObject = CreatureObject::getCreatureObject(userId); - if (userCreatureObject == NULL) + if (userCreatureObject == nullptr) { result += getErrorMessage(argv[0], ERR_FAIL); } @@ -313,7 +313,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri } TangibleObject const * const to = TangibleObject::asTangibleObject(NetworkIdManager::getObjectById(targetNetworkId)); - if (to == NULL) + if (to == nullptr) { result += Unicode::narrowToWide(fs.sprintf("Target %s not found or not TangibleObject\n", targetNetworkId.getValueString().c_str())); } @@ -342,13 +342,13 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri TangibleObject const * const hateTargetTangibleObject = TangibleObject::asTangibleObject(hateTarget.getObject()); float const hate = iterHateList->second; std::string hateTargetName; - if (hateTargetTangibleObject != NULL) + if (hateTargetTangibleObject != nullptr) { hateTargetName = Unicode::wideToNarrow(hateTargetTangibleObject->getEncodedObjectName()).c_str(); } else { - hateTargetName = "NULL"; + hateTargetName = "nullptr"; } result += Unicode::narrowToWide(fs.sprintf("%s:%s(%.1f)\n", hateTargetName.c_str(), hateTarget.getValueString().c_str(), hate)); @@ -368,13 +368,13 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri CachedNetworkId const hateTarget(iter->first); TangibleObject const * const hateTargetTangibleObject = TangibleObject::asTangibleObject(hateTarget.getObject()); std::string hateTargetName; - if (hateTargetTangibleObject != NULL) + if (hateTargetTangibleObject != nullptr) { hateTargetName = Unicode::wideToNarrow(hateTargetTangibleObject->getEncodedObjectName()).c_str(); } else { - hateTargetName = "NULL"; + hateTargetName = "nullptr"; } result += Unicode::narrowToWide(fs.sprintf("%s:%s (%.2f, %lu, %lu)\n", hateTargetName.c_str(), hateTarget.getValueString().c_str(), iter->second.first, iter->second.second.first, iter->second.second.second)); @@ -390,7 +390,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { CreatureObject * const userCreatureObject = CreatureObject::getCreatureObject(userId); - if (userCreatureObject == NULL) + if (userCreatureObject == nullptr) { result += getErrorMessage(argv[0], ERR_FAIL); } @@ -398,7 +398,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { CreatureObject * const aiCreatureObject = getAiCreatureObject(*userCreatureObject, argv); - if (aiCreatureObject == NULL) + if (aiCreatureObject == nullptr) { result += getErrorMessage(argv[0], ERR_FAIL); } @@ -416,7 +416,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { CreatureObject * const userCreatureObject = CreatureObject::getCreatureObject(userId); - if (userCreatureObject == NULL) + if (userCreatureObject == nullptr) { result += getErrorMessage(argv[0], ERR_FAIL); } @@ -424,7 +424,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { CreatureObject * const aiCreatureObject = getAiCreatureObject(*userCreatureObject, argv); - if (aiCreatureObject == NULL) + if (aiCreatureObject == nullptr) { result += getErrorMessage(argv[0], ERR_FAIL); } @@ -442,14 +442,14 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { CreatureObject * const userCreatureObject = CreatureObject::getCreatureObject(userId); - if (userCreatureObject == NULL) + if (userCreatureObject == nullptr) { result += getErrorMessage(argv[0], ERR_FAIL); } else { NetworkId aiNetworkId; - CreatureObject * aiCreatureObject = NULL; + CreatureObject * aiCreatureObject = nullptr; if (argv.size() > 2) { @@ -458,7 +458,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri aiNetworkId = NetworkId(Unicode::wideToNarrow(argv[1])); aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId); - if ( (aiCreatureObject != NULL) + if ( (aiCreatureObject != nullptr) && !aiCreatureObject->isPlayerControlled()) { aiCreatureObject->setBaseWalkSpeed(Unicode::toFloat(argv[2])); @@ -471,14 +471,14 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri aiNetworkId = userCreatureObject->getLookAtTarget(); aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId); - if ( (aiCreatureObject != NULL) + if ( (aiCreatureObject != nullptr) && !aiCreatureObject->isPlayerControlled()) { aiCreatureObject->setBaseWalkSpeed(Unicode::toFloat(argv[1])); } } - if ( (aiCreatureObject == NULL) + if ( (aiCreatureObject == nullptr) || aiCreatureObject->isPlayerControlled()) { Chat::sendSystemMessage(*userCreatureObject, Unicode::narrowToWide(fs.sprintf("[FAILURE] Unable to resolve %s to an AI", aiNetworkId.getValueString().c_str())), Unicode::emptyString); @@ -495,14 +495,14 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { CreatureObject * const userCreatureObject = CreatureObject::getCreatureObject(userId); - if (userCreatureObject == NULL) + if (userCreatureObject == nullptr) { result += getErrorMessage(argv[0], ERR_FAIL); } else { NetworkId aiNetworkId; - CreatureObject * aiCreatureObject = NULL; + CreatureObject * aiCreatureObject = nullptr; if (argv.size() > 2) { @@ -511,7 +511,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri aiNetworkId = NetworkId(Unicode::wideToNarrow(argv[1])); aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId); - if ( (aiCreatureObject != NULL) + if ( (aiCreatureObject != nullptr) && !aiCreatureObject->isPlayerControlled()) { aiCreatureObject->setBaseRunSpeed(Unicode::toFloat(argv[2])); @@ -524,14 +524,14 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri aiNetworkId = userCreatureObject->getLookAtTarget(); aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId); - if ( (aiCreatureObject != NULL) + if ( (aiCreatureObject != nullptr) && !aiCreatureObject->isPlayerControlled()) { aiCreatureObject->setBaseRunSpeed(Unicode::toFloat(argv[1])); } } - if ( (aiCreatureObject == NULL) + if ( (aiCreatureObject == nullptr) || aiCreatureObject->isPlayerControlled()) { Chat::sendSystemMessage(*userCreatureObject, Unicode::narrowToWide(fs.sprintf("[FAILURE] Unable to resolve %s to an AI", aiNetworkId.getValueString().c_str())), Unicode::emptyString); @@ -549,7 +549,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { CreatureObject * const userCreatureObject = CreatureObject::getCreatureObject(userId); - if (userCreatureObject != NULL) + if (userCreatureObject != nullptr) { NetworkId sparedAiNetworkId; @@ -573,9 +573,9 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri for (int i = 0; i < serverObjectCount; ++i) { ServerObject * const serverObject = ServerWorld::getObject(i); - CreatureObject * const creatureObject = (serverObject != NULL) ? serverObject->asCreatureObject() : NULL; + CreatureObject * const creatureObject = (serverObject != nullptr) ? serverObject->asCreatureObject() : nullptr; - if ( (creatureObject != NULL) + if ( (creatureObject != nullptr) && !creatureObject->isDead() && !creatureObject->isPlayerControlled() && (creatureObject->getNetworkId() != sparedAiNetworkId)) @@ -597,10 +597,10 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri else if (isAbbrev(argv[0], "debug")) { Object * const object = NetworkIdManager::getObjectById(userId); - ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; int temp; - if (serverObject != NULL) + if (serverObject != nullptr) { if ( serverObject->getObjVars().getItem("ai_debug_string", temp) && (temp > 0)) @@ -621,7 +621,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri Client * const client = serverObject->getClient(); - if (client != NULL) + if (client != nullptr) { AiDebugString aiDebugString; aiDebugString.enableClearClientFlag(); @@ -650,9 +650,9 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri else if (isAbbrev(argv[0], "debugText")) { Object * const object = NetworkIdManager::getObjectById(userId); - ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - if (serverObject != NULL) + if (serverObject != nullptr) { AiDebugString::setTextEnabled(!AiDebugString::isTextEnabled()); diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCity.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCity.cpp index 7b4af2ef..5a89f47e 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCity.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCity.cpp @@ -415,7 +415,7 @@ bool ConsoleCommandParserCity::performParsing (const NetworkId & userId, const S } else { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[3]).c_str()) - 1; diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCollection.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCollection.cpp index 442bc622..7397c1e8 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCollection.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCollection.cpp @@ -63,21 +63,21 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -172,21 +172,21 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -249,21 +249,21 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -326,21 +326,21 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -403,21 +403,21 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -466,21 +466,21 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -529,21 +529,21 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -592,21 +592,21 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -719,21 +719,21 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -776,7 +776,7 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c else if (isCommand (argv [0], "setServerFirstTime")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[3]).c_str()) - 1; diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCraft.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCraft.cpp index 6a28b3eb..51b45c94 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCraft.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCraft.cpp @@ -151,7 +151,7 @@ bool ConsoleCommandParserCraft::performParsing (const NetworkId & userId, const else if (isAbbrev( argv [0], "enableSchematicFilter")) { - if (creatureObject->getClient() == NULL || !creatureObject->getClient()->isGod()) + if (creatureObject->getClient() == nullptr || !creatureObject->getClient()->isGod()) result += getErrorMessage (argv[0], ERR_FAIL); else { @@ -164,7 +164,7 @@ bool ConsoleCommandParserCraft::performParsing (const NetworkId & userId, const else if (isAbbrev( argv [0], "disableSchematicFilter")) { - if (creatureObject->getClient() == NULL || !creatureObject->getClient()->isGod()) + if (creatureObject->getClient() == nullptr || !creatureObject->getClient()->isGod()) result += getErrorMessage (argv[0], ERR_FAIL); else { diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCraftStation.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCraftStation.cpp index cc9bebd7..e3a443db 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCraftStation.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCraftStation.cpp @@ -53,19 +53,19 @@ bool ConsoleCommandParserCraftStation::performParsing (const NetworkId & userId, { /* // get the station TangibleObject * station = getStation(argv, result); - if (station == NULL) + if (station == nullptr) return true; // get the ingredient NetworkId ingredientId(Unicode::wideToNarrow (argv[2])); ServerObject * object = ServerWorld::findObjectByNetworkId(ingredientId); - if (object == NULL) + if (object == nullptr) { result += getErrorMessage (argv [0], ERR_INVALID_INGREDIENT); return true; } TangibleObject * ingredient = dynamic_cast(object); - if (ingredient == NULL) + if (ingredient == nullptr) { result += getErrorMessage (argv [0], ERR_INVALID_INGREDIENT); return true; @@ -82,19 +82,19 @@ bool ConsoleCommandParserCraftStation::performParsing (const NetworkId & userId, { /* // get the station TangibleObject * station = getStation(argv, result); - if (station == NULL) + if (station == nullptr) return true; // get the ingredient NetworkId ingredientId(Unicode::wideToNarrow (argv[2])); ServerObject * object = ServerWorld::findObjectByNetworkId(ingredientId); - if (object == NULL) + if (object == nullptr) { result += getErrorMessage (argv [0], ERR_INVALID_INGREDIENT); return true; } TangibleObject * ingredient = dynamic_cast(object); - if (ingredient == NULL) + if (ingredient == nullptr) { result += getErrorMessage (argv [0], ERR_INVALID_INGREDIENT); return true; @@ -112,13 +112,13 @@ bool ConsoleCommandParserCraftStation::performParsing (const NetworkId & userId, /* // get the station NetworkId id(Unicode::wideToNarrow (argv[1])); ServerObject * object = ServerWorld::findObjectByNetworkId(id); - if (object == NULL) + if (object == nullptr) { result += getErrorMessage (argv [0], ERR_INVALID_OBJECT); return true; } TangibleObject * station = dynamic_cast(object); - if (station == NULL) + if (station == nullptr) { result += getErrorMessage (argv [0], ERR_INVALID_OBJECT); return true; @@ -144,33 +144,33 @@ bool ConsoleCommandParserCraftStation::performParsing (const NetworkId & userId, /** * Finds the crafting station for a given id. * - * @return the station or NULL on error + * @return the station or nullptr on error */ TangibleObject * ConsoleCommandParserCraftStation::getStation(const StringVector_t & argv, String_t & result) { NetworkId id(Unicode::wideToNarrow (argv[1])); ServerObject * object = ServerWorld::findObjectByNetworkId(id); - if (object == NULL) + if (object == nullptr) { result += getErrorMessage (argv [0], ERR_INVALID_OBJECT); - return NULL; + return nullptr; } TangibleObject * station = dynamic_cast(object); - if (station == NULL) + if (station == nullptr) { result += getErrorMessage (argv [0], ERR_INVALID_OBJECT); - return NULL; + return nullptr; } // make sure the station is a atation and that it isn't in use if (!station->getObjVars().hasItem("crafting.station")) { result += getErrorMessage (argv [0], ERR_INVALID_STATION); - return NULL; + return nullptr; } if (station->getObjVars().hasItem("crafting.crafter")) { result += getErrorMessage (argv [0], ERR_STATION_IN_USE); - return NULL; + return nullptr; } return station; } // ConsoleCommandParserCraftStation::getStation diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserGuild.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserGuild.cpp index f2ca6349..3484d6c2 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserGuild.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserGuild.cpp @@ -1218,17 +1218,17 @@ bool ConsoleCommandParserGuild::performParsing (const NetworkId & userId, const { // new guild leader is not a guild member, so make a guild member first, then make guild leader ServerObject const* o = dynamic_cast(ServerWorld::findObjectByNetworkId(leaderOid)); - CreatureObject const* c = (o ? o->asCreatureObject() : NULL); - PlayerObject const* p = (c ? PlayerCreatureController::getPlayerObject(c) : NULL); - if (o == NULL) + CreatureObject const* c = (o ? o->asCreatureObject() : nullptr); + PlayerObject const* p = (c ? PlayerCreatureController::getPlayerObject(c) : nullptr); + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); } - else if (c == NULL) + else if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); } - else if (p == NULL) + else if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); } diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserManufacture.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserManufacture.cpp index 1b405dd1..d8af83e3 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserManufacture.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserManufacture.cpp @@ -64,7 +64,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, ManufactureInstallationObject * station = dynamic_cast(stationId.getObject()); ServerObject * ingredient = safe_cast(ingredientId.getObject()); - if (station == NULL || ingredient == NULL) + if (station == nullptr || ingredient == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -77,7 +77,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, } ServerObject * hopper = station->getInputHopper(); - if (hopper == NULL) + if (hopper == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -99,7 +99,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, ManufactureInstallationObject * station = dynamic_cast(stationId.getObject()); ServerObject * ingredient = safe_cast(ingredientId.getObject()); - if (station == NULL || ingredient == NULL) + if (station == nullptr || ingredient == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -112,7 +112,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, } ServerObject * hopper = station->getInputHopper(); - if (hopper == NULL) + if (hopper == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -124,7 +124,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, return true; } - if (playerObject->getInventory() == NULL) + if (playerObject->getInventory() == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -144,7 +144,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, ManufactureInstallationObject * station = dynamic_cast(stationId.getObject()); - if (station == NULL) + if (station == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -157,14 +157,14 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, } ServerObject * hopper = station->getInputHopper(); - if (hopper == NULL) + if (hopper == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } VolumeContainer * container = ContainerInterface::getVolumeContainer(*hopper); - if (container == NULL) + if (container == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -174,7 +174,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, while (iter != container->end()) { const Container::ContainedItem & itemId = *iter; - if (itemId.getObject() != NULL) + if (itemId.getObject() != nullptr) { const ServerObject * item = safe_cast(itemId.getObject()); result += Unicode::narrowToWide("("); @@ -182,7 +182,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, result += Unicode::narrowToWide(") - "); const ResourceContainerObject * crate = dynamic_cast< const ResourceContainerObject *>(item); - if (crate != NULL) + if (crate != nullptr) { char buffer[32]; _itoa(crate->getQuantity(), buffer, 10); @@ -226,7 +226,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, ManufactureInstallationObject * station = dynamic_cast(stationId.getObject()); ManufactureSchematicObject * schematic = dynamic_cast(schematicId.getObject()); - if (station == NULL || schematic == NULL) + if (station == nullptr || schematic == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -239,7 +239,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, } // if (station->addSchematic(*schematic, playerObject)) - if (station->addSchematic(*schematic, NULL)) + if (station->addSchematic(*schematic, nullptr)) result += getErrorMessage(argv[0], ERR_SUCCESS); else result += getErrorMessage(argv[0], ERR_INVALID_CONTAINER_TRANSFER); @@ -253,7 +253,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, ManufactureInstallationObject * station = dynamic_cast(stationId.getObject()); - if (station == NULL) + if (station == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -266,9 +266,9 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, } ManufactureSchematicObject * schematic = station->getSchematic(); - if (schematic != NULL) + if (schematic != nullptr) { - if (playerObject->getDatapad() == NULL) + if (playerObject->getDatapad() == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -291,7 +291,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, ManufactureInstallationObject * station = dynamic_cast(stationId.getObject()); - if (station == NULL) + if (station == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -304,7 +304,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, } ManufactureSchematicObject * schematic = station->getSchematic(); - if (schematic != NULL) + if (schematic != nullptr) { result += Unicode::narrowToWide("("); result += Unicode::narrowToWide(schematic->getNetworkId().getValueString()); @@ -325,7 +325,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, ManufactureInstallationObject * station = dynamic_cast(stationId.getObject()); - if (station == NULL) + if (station == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); } @@ -344,7 +344,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, ManufactureInstallationObject * station = dynamic_cast(stationId.getObject()); - if (station == NULL) + if (station == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); } @@ -360,7 +360,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, else if (isAbbrev( argv [0], "getObjects")) { ServerObject * myInventory = playerObject->getInventory(); - if (myInventory == NULL) + if (myInventory == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -370,21 +370,21 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, ManufactureInstallationObject * station = dynamic_cast(stationId.getObject()); - if (station == NULL) + if (station == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } ServerObject * hopper = station->getOutputHopper(); - if (hopper == NULL) + if (hopper == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } VolumeContainer * container = ContainerInterface::getVolumeContainer(*hopper); - if (container == NULL) + if (container == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -394,7 +394,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, while (iter != container->end()) { const Container::ContainedItem & itemId = *iter; - if (itemId.getObject() != NULL) + if (itemId.getObject() != nullptr) { ContainerInterface::transferItemToVolumeContainer (*myInventory, *safe_cast(itemId.getObject()), playerObject, tmp); } @@ -419,21 +419,21 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, ManufactureInstallationObject * station = dynamic_cast(stationId.getObject()); - if (station == NULL) + if (station == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } ServerObject * hopper = station->getOutputHopper(); - if (hopper == NULL) + if (hopper == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } VolumeContainer * container = ContainerInterface::getVolumeContainer(*hopper); - if (container == NULL) + if (container == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -443,7 +443,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, while (iter != container->end()) { const Container::ContainedItem & itemId = *iter; - if (itemId.getObject() != NULL) + if (itemId.getObject() != nullptr) { const ServerObject * item = safe_cast(itemId.getObject()); result += Unicode::narrowToWide("("); diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserMoney.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserMoney.cpp index 33801387..feff5d1e 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserMoney.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserMoney.cpp @@ -58,7 +58,7 @@ bool ConsoleCommandParserMoney::performParsing (const NetworkId & userId, const { NetworkId sourceId(Unicode::wideToNarrow (argv[1])); NetworkId targetId(Unicode::wideToNarrow (argv[2])); - int amount(strtoul(Unicode::wideToNarrow (argv[3]).c_str (), NULL, 10)); + int amount(strtoul(Unicode::wideToNarrow (argv[3]).c_str (), nullptr, 10)); ServerObject* source = dynamic_cast(NetworkIdManager::getObjectById(sourceId)); if (!source) @@ -75,7 +75,7 @@ bool ConsoleCommandParserMoney::performParsing (const NetworkId & userId, const { NetworkId sourceId(Unicode::wideToNarrow (argv[1])); NetworkId targetId(Unicode::wideToNarrow (argv[2])); - int amount(strtoul(Unicode::wideToNarrow (argv[3]).c_str (), NULL, 10)); + int amount(strtoul(Unicode::wideToNarrow (argv[3]).c_str (), nullptr, 10)); ServerObject* source = dynamic_cast(NetworkIdManager::getObjectById(sourceId)); if (!source) @@ -91,7 +91,7 @@ bool ConsoleCommandParserMoney::performParsing (const NetworkId & userId, const else if (isAbbrev( argv [0], "namedTransfer")) { NetworkId sourceId(Unicode::wideToNarrow (argv[1])); - int amount(strtol(Unicode::wideToNarrow (argv[3]).c_str (), NULL, 10)); + int amount(strtol(Unicode::wideToNarrow (argv[3]).c_str (), nullptr, 10)); ServerObject* source = dynamic_cast(NetworkIdManager::getObjectById(sourceId)); if (!source) @@ -117,7 +117,7 @@ bool ConsoleCommandParserMoney::performParsing (const NetworkId & userId, const else if (isAbbrev( argv [0], "withdraw")) { NetworkId sourceId(Unicode::wideToNarrow (argv[1])); - int amount(strtoul(Unicode::wideToNarrow (argv[2]).c_str (), NULL, 10)); + int amount(strtoul(Unicode::wideToNarrow (argv[2]).c_str (), nullptr, 10)); ServerObject* source = dynamic_cast(NetworkIdManager::getObjectById(sourceId)); if (!source) @@ -133,7 +133,7 @@ bool ConsoleCommandParserMoney::performParsing (const NetworkId & userId, const else if (isAbbrev( argv [0], "deposit")) { NetworkId sourceId(Unicode::wideToNarrow (argv[1])); - int amount(strtoul(Unicode::wideToNarrow (argv[2]).c_str (), NULL, 10)); + int amount(strtoul(Unicode::wideToNarrow (argv[2]).c_str (), nullptr, 10)); ServerObject* source = dynamic_cast(NetworkIdManager::getObjectById(sourceId)); if (!source) @@ -175,7 +175,7 @@ bool ConsoleCommandParserMoney::performParsing (const NetworkId & userId, const } else if (isAbbrev( argv [0], "setGalacticReserve")) { - int const newGalacticReserve(strtoul(Unicode::wideToNarrow (argv[2]).c_str (), NULL, 10)); + int const newGalacticReserve(strtoul(Unicode::wideToNarrow (argv[2]).c_str (), nullptr, 10)); if ((newGalacticReserve < 0) || (newGalacticReserve > ConfigServerGame::getMaxGalacticReserveDepositBillion())) { result += Unicode::narrowToWide(FormattedString<1024>().sprintf("specified galactic reserve balance (%d) must be in the (inclusive) range (0, %d)\n", newGalacticReserve, ConfigServerGame::getMaxGalacticReserveDepositBillion())); diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserNpc.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserNpc.cpp index 929f6413..71f81106 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserNpc.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserNpc.cpp @@ -52,19 +52,19 @@ bool ConsoleCommandParserNpc::performParsing (const NetworkId & userId, const St NetworkId const oid(Unicode::wideToNarrow(argv[1])); ServerObject * const object = ServerWorld::findObjectByNetworkId(oid); - if (object == NULL) + if (object == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } TangibleObject * const npc = object->asTangibleObject(); - if (npc == NULL) + if (npc == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - playerObject->startNpcConversation(*npc, NULL, NpcConversationData::CS_Player, 0); + playerObject->startNpcConversation(*npc, nullptr, NpcConversationData::CS_Player, 0); result += getErrorMessage (argv[0], ERR_SUCCESS); } @@ -82,7 +82,7 @@ bool ConsoleCommandParserNpc::performParsing (const NetworkId & userId, const St else if (isAbbrev( argv [0], "respond")) { TangibleObject * const playerObject = safe_cast(ServerWorld::findObjectByNetworkId(userId)); - int const response = strtol(Unicode::wideToNarrow(argv[1]).c_str (), NULL, 10); + int const response = strtol(Unicode::wideToNarrow(argv[1]).c_str (), nullptr, 10); playerObject->respondToNpc(response); result += getErrorMessage (argv[0], ERR_SUCCESS); } diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserObject.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserObject.cpp index ed626f69..a092fc3a 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserObject.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserObject.cpp @@ -119,23 +119,23 @@ namespace ConsoleCommandParserObjectNamespace { WARNING(true, ("ConsoleCommandParserObject invalid object template [%s]", templateName.c_str())); ot->releaseReference(); - return NULL; + return nullptr; } if (sot->getId() == ServerShipObjectTemplate::ServerShipObjectTemplate_tag) { SharedObjectTemplate const * const sharedTemplate = safe_cast(ObjectTemplateList::fetch(sot->getSharedTemplate())); - if (NULL == sharedTemplate || + if (nullptr == sharedTemplate || (sharedTemplate->getGameObjectType() != SharedObjectTemplate::GOT_ship_mining_asteroid_dynamic && sharedTemplate->getGameObjectType() != SharedObjectTemplate::GOT_ship_mining_asteroid_static)) { ot->releaseReference(); - return NULL; + return nullptr; } } return sot; } - return NULL; + return nullptr; } void checkBadBuildClusterObject(ServerObject *& o) @@ -523,7 +523,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject const * const obj = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (obj == NULL) + if (obj == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -531,7 +531,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const Client const * const client = obj->getClient(); - if(client == NULL) + if(client == nullptr) { result += Unicode::narrowToWide("specified object is not a client object\n"); return true; @@ -561,7 +561,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const } const char *objectTemplateName = obj->getObjectTemplateName(); - result += Unicode::narrowToWide(FormattedString<512>().sprintf("object %s (%s) has %d total opened objects\n", obj->getNetworkId().getValueString().c_str(), (objectTemplateName ? objectTemplateName : "NULL object template"), opened.size())); + result += Unicode::narrowToWide(FormattedString<512>().sprintf("object %s (%s) has %d total opened objects\n", obj->getNetworkId().getValueString().c_str(), (objectTemplateName ? objectTemplateName : "nullptr object template"), opened.size())); if(!text.empty()) { @@ -615,7 +615,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const ServerObject * const object = dynamic_cast(NetworkIdManager::getObjectById(oid)); if (object) { - uint32 const pid = (strtoul(Unicode::wideToNarrow(argv[2]).c_str (), NULL, 10)); + uint32 const pid = (strtoul(Unicode::wideToNarrow(argv[2]).c_str (), nullptr, 10)); GenericValueTypeMessage > const msg( "RequestAuthTransfer", std::make_pair( @@ -646,9 +646,9 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const } real x,y,z; - x = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), NULL)); - y = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL)); - z = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), NULL)); + x = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), nullptr)); + y = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr)); + z = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), nullptr)); ServerObject *newObject = 0; ServerObjectTemplate const * const ot = getObjectTemplateForCreation(tmpString); @@ -706,9 +706,9 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const } real x,y,z; - x = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), NULL)); - y = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL)); - z = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), NULL)); + x = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), nullptr)); + y = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr)); + z = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), nullptr)); // check to see if we're in a region we shouldn't be building in if ( ConfigServerGame::getBlockBuildRegionPlacement() ) @@ -726,10 +726,10 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const } real quatW,quatX,quatY,quatZ; - quatW = static_cast(strtod(Unicode::wideToNarrow(argv[5]).c_str(), NULL)); - quatX = static_cast(strtod(Unicode::wideToNarrow(argv[6]).c_str(), NULL)); - quatY = static_cast(strtod(Unicode::wideToNarrow(argv[7]).c_str(), NULL)); - quatZ = static_cast(strtod(Unicode::wideToNarrow(argv[8]).c_str(), NULL)); + quatW = static_cast(strtod(Unicode::wideToNarrow(argv[5]).c_str(), nullptr)); + quatX = static_cast(strtod(Unicode::wideToNarrow(argv[6]).c_str(), nullptr)); + quatY = static_cast(strtod(Unicode::wideToNarrow(argv[7]).c_str(), nullptr)); + quatZ = static_cast(strtod(Unicode::wideToNarrow(argv[8]).c_str(), nullptr)); ServerObject * const cell = safe_cast(ContainerInterface::getContainingCellObject(*playerObject)); @@ -934,7 +934,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const NetworkId oid(Unicode::wideToNarrow(argv[2])); ServerObject* object = dynamic_cast(NetworkIdManager::getObjectById(oid)); - if (object == NULL) + if (object == nullptr) { //container does not exist result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); @@ -994,7 +994,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId cellId(Unicode::wideToNarrow(argv[2])); ServerObject* cell = dynamic_cast(NetworkIdManager::getObjectById(cellId)); - if (cell == NULL && cellId != NetworkId::cms_invalid) + if (cell == nullptr && cellId != NetworkId::cms_invalid) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1011,9 +1011,9 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const } real x,y,z; - x = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL)); - y = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), NULL)); - z = static_cast(strtod(Unicode::wideToNarrow(argv[5]).c_str(), NULL)); + x = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr)); + y = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), nullptr)); + z = static_cast(strtod(Unicode::wideToNarrow(argv[5]).c_str(), nullptr)); ServerObject *newObject = 0; ServerObjectTemplate const * const ot = getObjectTemplateForCreation(tmpString); @@ -1070,22 +1070,22 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const NetworkId cellId(Unicode::wideToNarrow(argv[2])); ServerObject * const cell = safe_cast(NetworkIdManager::getObjectById(cellId)); - if (cell == NULL && cellId != NetworkId::cms_invalid) + if (cell == nullptr && cellId != NetworkId::cms_invalid) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } real x,y,z; - x = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL)); - y = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), NULL)); - z = static_cast(strtod(Unicode::wideToNarrow(argv[5]).c_str(), NULL)); + x = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr)); + y = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), nullptr)); + z = static_cast(strtod(Unicode::wideToNarrow(argv[5]).c_str(), nullptr)); real quatW,quatX,quatY,quatZ; - quatW = static_cast(strtod(Unicode::wideToNarrow(argv[6]).c_str(), NULL)); - quatX = static_cast(strtod(Unicode::wideToNarrow(argv[7]).c_str(), NULL)); - quatY = static_cast(strtod(Unicode::wideToNarrow(argv[8]).c_str(), NULL)); - quatZ = static_cast(strtod(Unicode::wideToNarrow(argv[9]).c_str(), NULL)); + quatW = static_cast(strtod(Unicode::wideToNarrow(argv[6]).c_str(), nullptr)); + quatX = static_cast(strtod(Unicode::wideToNarrow(argv[7]).c_str(), nullptr)); + quatY = static_cast(strtod(Unicode::wideToNarrow(argv[8]).c_str(), nullptr)); + quatZ = static_cast(strtod(Unicode::wideToNarrow(argv[9]).c_str(), nullptr)); ServerObject *newObject = 0; ServerObjectTemplate const * const ot = getObjectTemplateForCreation(tmpString); @@ -1165,7 +1165,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject* object = dynamic_cast(NetworkIdManager::getObjectById(oid)); - if (object == NULL) + if (object == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1200,7 +1200,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject* object = dynamic_cast(NetworkIdManager::getObjectById(oid)); - if (object == NULL) + if (object == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1236,7 +1236,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const const NetworkId oid (Unicode::wideToNarrow(argv[1])); ServerObject* const object = safe_cast(NetworkIdManager::getObjectById(oid)); - if (object == NULL) + if (object == nullptr) result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); else if (object->getClient()) result += getErrorMessage(argv[0], ERR_INVALID_USER); @@ -1268,7 +1268,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const ServerObject* const object = safe_cast(NetworkIdManager::getObjectById(oid)); - if (object == NULL) + if (object == nullptr) result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); // ---------- @@ -1279,11 +1279,11 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { ServerObject * object = ServerWorld::getObject(i); - if(object == NULL) continue; + if(object == nullptr) continue; CreatureObject * creature = object->asCreatureObject(); - if(creature == NULL) continue; + if(creature == nullptr) continue; if(creature->getNetworkId() == oid) continue; @@ -1307,11 +1307,11 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { ServerObject * object = ServerWorld::getObject(i); - if(object == NULL) continue; + if(object == nullptr) continue; CreatureObject * creature = object->asCreatureObject(); - if(creature == NULL) continue; + if(creature == nullptr) continue; if(creature->getParentCell() != CellProperty::getWorldCellProperty()) continue; @@ -1331,9 +1331,9 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); Vector pos; - pos.x = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), NULL)); - pos.y = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL)); - pos.z = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), NULL)); + pos.x = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), nullptr)); + pos.y = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr)); + pos.z = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), nullptr)); // disallow certain object types from being "move" bool allowMove = true; @@ -1418,7 +1418,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject* o = ServerWorld::findObjectByNetworkId(oid); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1433,9 +1433,9 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); real r,p,y; - r = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), NULL)); - p = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL)); - y = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), NULL)); + r = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), nullptr)); + p = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr)); + y = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), nullptr)); if (rotateObject(oid, r, p, y)) { result += getErrorMessage(argv[0], ERR_SUCCESS); @@ -1450,7 +1450,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject* o = ServerWorld::findObjectByNetworkId(oid); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1479,7 +1479,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const // erase keys assigned to this player. s_playerCreatureNameMap.erase(userId); - if (dataTable != NULL) + if (dataTable != nullptr) { StringVector creatureStrings; { @@ -1548,7 +1548,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId const oid(Unicode::wideToNarrow(argv[1])); ServerObject* const o = ServerWorld::findObjectByNetworkId(oid); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1580,7 +1580,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - o->deletePobPersistedContents(NULL, DeleteReasons::God); + o->deletePobPersistedContents(nullptr, DeleteReasons::God); result += getErrorMessage(argv[0], ERR_SUCCESS); } else if (isCommand( argv[0], "moveItemInHouseToMe")) @@ -1607,7 +1607,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); TangibleObject* vendor = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (vendor == NULL) + if (vendor == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1621,7 +1621,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); TangibleObject* vendor = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (vendor == NULL) + if (vendor == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1699,13 +1699,13 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); CreatureObject* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } real scale; - scale = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), NULL)); + scale = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), nullptr)); o->setMovementScale(scale); result += getErrorMessage(argv[0], ERR_SUCCESS); } @@ -1716,13 +1716,13 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); CreatureObject* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } real scale; - scale = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), NULL)); + scale = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), nullptr)); o->setScaleFactor(scale); result += getErrorMessage(argv[0], ERR_SUCCESS); } @@ -1765,7 +1765,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject* o = ServerWorld::findObjectByNetworkId(oid); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1788,13 +1788,13 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { CachedNetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(oid.getObject()); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } Container const * const container = ContainerInterface::getContainer(*o); - if (container == NULL) + if (container == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1811,7 +1811,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = ServerWorld::findObjectByNetworkId(oid); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1846,7 +1846,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = ServerWorld::findObjectByNetworkId(oid); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1881,7 +1881,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = ServerWorld::findObjectByNetworkId(oid); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1914,7 +1914,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); TangibleObject* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1940,7 +1940,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); const ServerObject* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1976,7 +1976,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const ServerMessageForwarding::end(); - if (ObjectTemplateList::reload(templateFile) == NULL) + if (ObjectTemplateList::reload(templateFile) == nullptr) { result += getErrorMessage(argv[0], ERR_TEMPLATE_NOT_LOADED); return true; @@ -1991,7 +1991,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); CreatureObject * creature = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (creature == NULL || !creature->isIncapacitated()) + if (creature == nullptr || !creature->isIncapacitated()) result += Unicode::narrowToWide("no"); else if (creature->isDead()) result += Unicode::narrowToWide("dead"); @@ -2011,11 +2011,11 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const LocationData d; d.name = argv[2]; Vector pos; - pos.x = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL)); - pos.y = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), NULL)); - pos.z = static_cast(strtod(Unicode::wideToNarrow(argv[5]).c_str(), NULL)); + pos.x = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr)); + pos.y = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), nullptr)); + pos.z = static_cast(strtod(Unicode::wideToNarrow(argv[5]).c_str(), nullptr)); d.location.setCenter(pos); - float radius = static_cast(strtod(Unicode::wideToNarrow(argv[6]).c_str(), NULL)); + float radius = static_cast(strtod(Unicode::wideToNarrow(argv[6]).c_str(), nullptr)); d.location.setRadius(radius); o->addLocationTarget(d); } @@ -2079,7 +2079,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const oid.getObject()); const CreatureObject * creature = dynamic_cast( tangible); - if (creature != NULL) + if (creature != nullptr) { char buffer[1024]; sprintf(buffer, "he:%d, co=%d, ac=%d, st=%d, mi=%d, wi=%d", @@ -2091,7 +2091,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const creature->getAttribute(Attributes::Willpower)); result += Unicode::narrowToWide(buffer); } - else if (tangible != NULL) + else if (tangible != nullptr) { char buffer[1024]; sprintf(buffer, "max hp = %d, damage taken = %d", @@ -2156,13 +2156,13 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const bool value = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), 0, 10) != 0; ServerObject * const o = dynamic_cast(ServerWorld::findObjectByNetworkId(actorId)); - CreatureObject * const c = (o ? o->asCreatureObject() : NULL); - if (o == NULL) + CreatureObject * const c = (o ? o->asCreatureObject() : nullptr); + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; @@ -2261,7 +2261,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const const char *objectTemplateName = obj->getObjectTemplateName(); - result += Unicode::narrowToWide(FormattedString<512>().sprintf("object %s (%s) has %d total observers (%d observers on this game server)\n", obj->getNetworkId().getValueString().c_str(), (objectTemplateName ? objectTemplateName : "NULL object template"), obj->getObserversCount(), observerList.size())); + result += Unicode::narrowToWide(FormattedString<512>().sprintf("object %s (%s) has %d total observers (%d observers on this game server)\n", obj->getNetworkId().getValueString().c_str(), (objectTemplateName ? objectTemplateName : "nullptr object template"), obj->getObserversCount(), observerList.size())); if (!observers.empty()) { @@ -2560,7 +2560,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const else if(isCommand(argv[0], "setPathLinkDistance")) { - float dist = static_cast(strtod(Unicode::wideToNarrow(argv[1]).c_str(), NULL)); + float dist = static_cast(strtod(Unicode::wideToNarrow(argv[1]).c_str(), nullptr)); CityPathGraphManager::setLinkDistance(dist); @@ -2601,7 +2601,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { CachedNetworkId const oid(Unicode::wideToNarrow(argv[1])); TangibleObject * object = dynamic_cast(oid.getObject()); - if (object == NULL) + if (object == nullptr) result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); else { @@ -2619,7 +2619,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { CachedNetworkId const oid(Unicode::wideToNarrow(argv[1])); TangibleObject * object = dynamic_cast(oid.getObject()); - if (object == NULL) + if (object == nullptr) result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); else { @@ -2653,7 +2653,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const ServerObject * object = dynamic_cast(oid.getObject()); CreatureObject * creature = dynamic_cast(object); - if (object == NULL) + if (object == nullptr) result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); else { @@ -2694,7 +2694,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const NetworkId oid(Unicode::wideToNarrow(argv[1])); CreatureObject *creature = dynamic_cast(NetworkIdManager::getObjectById(oid)); - PlayerObject *player = NULL; + PlayerObject *player = nullptr; if (creature) player = PlayerCreatureController::getPlayerObject(creature); if (player) @@ -2739,7 +2739,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const NetworkId oid(Unicode::wideToNarrow(argv[1])); CreatureObject *creature = dynamic_cast(NetworkIdManager::getObjectById(oid)); - PlayerObject *player = NULL; + PlayerObject *player = nullptr; if (creature) player = PlayerCreatureController::getPlayerObject(creature); if (player) @@ -2864,7 +2864,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); const InstallationObject* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -2888,7 +2888,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const NetworkId oid(Unicode::wideToNarrow(argv[1])); InstallationObject* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -2904,7 +2904,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); const InstallationObject* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -2928,7 +2928,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const NetworkId oid(Unicode::wideToNarrow(argv[1])); InstallationObject* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -3056,7 +3056,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject *o = safe_cast(NetworkIdManager::getObjectById(oid)); - if (o != NULL && o->asCreatureObject() != NULL && o->isPlayerControlled()) + if (o != nullptr && o->asCreatureObject() != nullptr && o->isPlayerControlled()) { CreatureObject * creatureTarget = o->asCreatureObject(); @@ -3068,7 +3068,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const for (CreatureObject::SkillList::const_iterator i = skills.begin(); i != skills.end(); ++i) { const SkillObject * profession = (*i)->findProfessionForSkill(); - if (profession != NULL) + if (profession != nullptr) professionName = profession->getSkillName(); } } @@ -3317,7 +3317,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const NetworkId oid (Unicode::wideToNarrow(argv[1])); ServerObject* const object = safe_cast(NetworkIdManager::getObjectById(oid)); - if (object == NULL) + if (object == nullptr) result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); else if (!object->getClient()) result += getErrorMessage(argv[0], ERR_INVALID_USER); @@ -3346,7 +3346,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const NetworkId ownerId (Unicode::wideToNarrow(argv[2])); ServerObject * const object = safe_cast(NetworkIdManager::getObjectById(houseId)); - TangibleObject * const tangible = object ? object->asTangibleObject() : NULL; + TangibleObject * const tangible = object ? object->asTangibleObject() : nullptr; if (!tangible) result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); else @@ -3359,7 +3359,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { ServerObject * object = safe_cast(NetworkIdManager::getObjectById(playerObject->getLookAtTarget())); - if (NULL == object) + if (nullptr == object) object = playerObject; RegionMaster::RegionVector rv; @@ -3373,7 +3373,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const for (RegionMaster::RegionVector::const_iterator it = rv.begin(); it != rv.end(); ++it) { Region const * const r = *it; - if (NULL != r) + if (nullptr != r) { _itoa(r->getGeography(), buf, 10); result += Unicode::narrowToWide(buf); @@ -3390,7 +3390,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { ServerObject * const target = safe_cast(NetworkIdManager::getObjectById(playerObject->getLookAtTarget())); - if (NULL == target) + if (nullptr == target) { result += Unicode::narrowToWide("Invalid target"); return true; @@ -3434,7 +3434,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const ServerObject * object = safe_cast(NetworkIdManager::getObjectById(playerObject->getLookAtTarget())); - if (NULL == object) + if (nullptr == object) object = playerObject; Vector const & pos_w = object->getPosition_w(); @@ -3449,7 +3449,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { ServerObject * object = safe_cast(NetworkIdManager::getObjectById(playerObject->getLookAtTarget())); - if (NULL == object) + if (nullptr == object) object = playerObject; Vector const & pos_w = object->getPosition_w(); @@ -3463,7 +3463,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { ServerObject * object = safe_cast(NetworkIdManager::getObjectById(playerObject->getLookAtTarget())); - if (NULL == object) + if (nullptr == object) object = playerObject; Vector const & pos_w = object->getPosition_w(); @@ -3477,7 +3477,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); const ServerObject* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -3503,7 +3503,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); const ServerObject* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -3576,13 +3576,13 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject const* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - CreatureObject const* c = (o ? o->asCreatureObject() : NULL); - if (o == NULL) + CreatureObject const* c = (o ? o->asCreatureObject() : nullptr); + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - else if (c == NULL) + else if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; @@ -3590,7 +3590,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const else { PlayerObject const* p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -3612,8 +3612,8 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - CreatureObject* c = (o ? o->asCreatureObject() : NULL); - if (o == NULL) + CreatureObject* c = (o ? o->asCreatureObject() : nullptr); + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -3623,7 +3623,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const result += Unicode::narrowToWide("specified object is not authoritative on this game server\n"); return true; } - else if (c == NULL) + else if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; @@ -3631,7 +3631,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const else { PlayerObject* p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -3668,20 +3668,20 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - CreatureObject * c = (o ? o->asCreatureObject() : NULL); - if (o == NULL) + CreatureObject * c = (o ? o->asCreatureObject() : nullptr); + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - else if (c == NULL) + else if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -3755,14 +3755,14 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject const* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } TangibleObject const* t = o->asTangibleObject(); - if (t == NULL) + if (t == nullptr) { result += Unicode::narrowToWide("specified object is not a tangible object\n"); return true; @@ -3797,14 +3797,14 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId sourceOid(Unicode::wideToNarrow(argv[1])); ServerObject * sourceSo = dynamic_cast(ServerWorld::findObjectByNetworkId(sourceOid)); - if (sourceSo == NULL) + if (sourceSo == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is an invalid object\n", sourceOid.getValueString().c_str())); return true; } TangibleObject * sourceTo = sourceSo->asTangibleObject(); - if (sourceTo == NULL) + if (sourceTo == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is not a tangible object\n", sourceOid.getValueString().c_str())); return true; @@ -3812,14 +3812,14 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const NetworkId targetOid(Unicode::wideToNarrow(argv[2])); ServerObject * targetSo = dynamic_cast(ServerWorld::findObjectByNetworkId(targetOid)); - if (targetSo == NULL) + if (targetSo == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is an invalid object\n", targetOid.getValueString().c_str())); return true; } TangibleObject * targetTo = targetSo->asTangibleObject(); - if (targetTo == NULL) + if (targetTo == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is not a tangible object\n", targetOid.getValueString().c_str())); return true; @@ -3839,14 +3839,14 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId sourceOid(Unicode::wideToNarrow(argv[1])); ServerObject * sourceSo = dynamic_cast(ServerWorld::findObjectByNetworkId(sourceOid)); - if (sourceSo == NULL) + if (sourceSo == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is an invalid object\n", sourceOid.getValueString().c_str())); return true; } TangibleObject * sourceTo = sourceSo->asTangibleObject(); - if (sourceTo == NULL) + if (sourceTo == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is not a tangible object\n", sourceOid.getValueString().c_str())); return true; @@ -3866,14 +3866,14 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId sourceOid(Unicode::wideToNarrow(argv[1])); ServerObject * sourceSo = dynamic_cast(ServerWorld::findObjectByNetworkId(sourceOid)); - if (sourceSo == NULL) + if (sourceSo == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is an invalid object\n", sourceOid.getValueString().c_str())); return true; } TangibleObject * sourceTo = sourceSo->asTangibleObject(); - if (sourceTo == NULL) + if (sourceTo == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is not a tangible object\n", sourceOid.getValueString().c_str())); return true; @@ -3891,14 +3891,14 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId sourceOid(Unicode::wideToNarrow(argv[1])); ServerObject const * sourceSo = dynamic_cast(ServerWorld::findObjectByNetworkId(sourceOid)); - if (sourceSo == NULL) + if (sourceSo == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is an invalid object\n", sourceOid.getValueString().c_str())); return true; } CreatureObject const * sourceCo = sourceSo->asCreatureObject(); - if (sourceCo == NULL) + if (sourceCo == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is not a creature object\n", sourceOid.getValueString().c_str())); return true; @@ -3915,14 +3915,14 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId sourceOid(Unicode::wideToNarrow(argv[1])); ServerObject * sourceSo = dynamic_cast(ServerWorld::findObjectByNetworkId(sourceOid)); - if (sourceSo == NULL) + if (sourceSo == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is an invalid object\n", sourceOid.getValueString().c_str())); return true; } CreatureObject * sourceCo = sourceSo->asCreatureObject(); - if (sourceCo == NULL) + if (sourceCo == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is not a creature object\n", sourceOid.getValueString().c_str())); return true; @@ -3931,7 +3931,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const result += Unicode::narrowToWide(FormattedString<512>().sprintf("dumping %s's command queue contents\n", sourceCo->getNetworkId().getValueString().c_str())); CommandQueue * queue = sourceCo->getCommandQueue(); - if (queue != NULL) + if (queue != nullptr) { std::string output; queue->spew(&output); @@ -3947,26 +3947,26 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - CreatureObject * c = (o ? o->asCreatureObject() : NULL); - if (o == NULL) + CreatureObject * c = (o ? o->asCreatureObject() : nullptr); + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - else if (c == NULL) + else if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; } - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); time_t const timeStartInterval = ((p->getChatSpamTimeEndInterval() > 0) ? static_cast(p->getChatSpamTimeEndInterval() - (ConfigServerGame::getChatSpamLimiterIntervalMinutes() * 60)) : 0); if ((timeStartInterval <= 0) || (timeNow < timeStartInterval)) @@ -3986,28 +3986,28 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject const * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject const * c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject const * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; } Client * client = o->getClient(); - if (client == NULL) + if (client == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("specified character object %s (%s) doesn't have a Client object (possible causes are may not be authoritative, or may not be connected)\n", o->getNetworkId().getValueString().c_str(), Unicode::wideToNarrow(o->getAssignedObjectName()).c_str())); return true; @@ -4042,28 +4042,28 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject const * c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject const * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; } Client * client = o->getClient(); - if (client == NULL) + if (client == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("specified character object %s (%s) doesn't have a Client object (possible causes are may not be authoritative, or may not be connected)\n", o->getNetworkId().getValueString().c_str(), Unicode::wideToNarrow(o->getAssignedObjectName()).c_str())); return true; @@ -4083,28 +4083,28 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject const * c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject const * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; } Client * client = o->getClient(); - if (client == NULL) + if (client == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("specified character object %s (%s) doesn't have a Client object (possible causes are may not be authoritative, or may not be connected)\n", o->getNetworkId().getValueString().c_str(), Unicode::wideToNarrow(o->getAssignedObjectName()).c_str())); return true; @@ -4180,12 +4180,12 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const } else { - result += Unicode::narrowToWide(FormattedString<1024>().sprintf("object (%s) getFootprint() returns NULL.\n", oid.getValueString().c_str())); + result += Unicode::narrowToWide(FormattedString<1024>().sprintf("object (%s) getFootprint() returns nullptr.\n", oid.getValueString().c_str())); } } else { - result += Unicode::narrowToWide(FormattedString<1024>().sprintf("object (%s) getCollisionProperty() returns NULL.\n", oid.getValueString().c_str())); + result += Unicode::narrowToWide(FormattedString<1024>().sprintf("object (%s) getCollisionProperty() returns nullptr.\n", oid.getValueString().c_str())); } } else diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserObjvar.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserObjvar.cpp index e4a928c5..77063e84 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserObjvar.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserObjvar.cpp @@ -100,7 +100,7 @@ bool ConsoleCommandParserObjvar::performParsing (const NetworkId & userId, const { NetworkId oid (Unicode::wideToNarrow (argv[1])); ServerObject* object = ServerWorld::findObjectByNetworkId(oid); - if (object == NULL) + if (object == nullptr) { result += getErrorMessage (argv [0], ERR_INVALID_OBJECT); return true; @@ -224,7 +224,7 @@ bool ConsoleCommandParserObjvar::performParsing (const NetworkId & userId, const // This is now a no-op, but left in to avoid breaking the god client // NetworkId oid (Unicode::wideToNarrow (argv[1])); // ServerObject* object = ServerWorld::findObjectByNetworkId(oid); -// if (object == NULL) +// if (object == nullptr) // { // result += getErrorMessage (argv [0], ERR_INVALID_OBJECT); // return true; @@ -241,7 +241,7 @@ bool ConsoleCommandParserObjvar::performParsing (const NetworkId & userId, const { NetworkId oid (Unicode::wideToNarrow(argv[1])); ServerObject* object = ServerWorld::findObjectByNetworkId(oid); - if (object == NULL) + if (object == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -317,7 +317,7 @@ bool ConsoleCommandParserObjvar::performParsing (const NetworkId & userId, const { ServerObject * const userServerObject = ServerWorld::findObjectByNetworkId(userId); - if (userServerObject != NULL) + if (userServerObject != nullptr) { NetworkId specifiedNetworkId; @@ -329,7 +329,7 @@ bool ConsoleCommandParserObjvar::performParsing (const NetworkId & userId, const { CreatureObject * const userCreatureObject = CreatureObject::asCreatureObject(userServerObject); - if (userCreatureObject != NULL) + if (userCreatureObject != nullptr) { specifiedNetworkId = userCreatureObject->getLookAtTarget(); } @@ -337,7 +337,7 @@ bool ConsoleCommandParserObjvar::performParsing (const NetworkId & userId, const ServerObject * const specifiedServerObject = ServerWorld::findObjectByNetworkId(specifiedNetworkId); - if (specifiedServerObject != NULL) + if (specifiedServerObject != nullptr) { DynamicVariableList const & objVarList = specifiedServerObject->getObjVars(); FormattedString<1024> fs; @@ -357,7 +357,7 @@ bool ConsoleCommandParserObjvar::performParsing (const NetworkId & userId, const { NetworkId oid = NetworkId(Unicode::wideToNarrow(argv[1])); ServerObject* object = ServerWorld::findObjectByNetworkId(oid); - if (object == NULL) + if (object == nullptr) { result += getErrorMessage (argv [0], ERR_INVALID_OBJECT); return true; @@ -376,7 +376,7 @@ bool ConsoleCommandParserObjvar::performParsing (const NetworkId & userId, const { NetworkId oid = NetworkId(Unicode::wideToNarrow(argv[1])); ServerObject* object = ServerWorld::findObjectByNetworkId(oid); - if (object == NULL) + if (object == nullptr) { result += getErrorMessage (argv [0], ERR_INVALID_OBJECT); return true; diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserPvp.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserPvp.cpp index d212d0ca..a9f691b6 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserPvp.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserPvp.cpp @@ -103,13 +103,13 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject const* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - CreatureObject const* c = (o ? o->asCreatureObject() : NULL); - if (o == NULL) + CreatureObject const* c = (o ? o->asCreatureObject() : nullptr); + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - else if (c == NULL) + else if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; @@ -117,7 +117,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St else { PlayerObject const* p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -185,7 +185,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St result += Unicode::narrowToWide(FormattedString<512>().sprintf("lifetime PvP kills: %ld\n",p->getLifetimePvpKills())); result += Unicode::narrowToWide(FormattedString<512>().sprintf("next GCW rating calculation time: %ld",p->getNextGcwRatingCalcTime())); - int32 const now = static_cast(::time(NULL)); + int32 const now = static_cast(::time(nullptr)); if (p->getNextGcwRatingCalcTime() > 0) { if (p->getNextGcwRatingCalcTime() >= now) @@ -223,13 +223,13 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - CreatureObject * c = (o ? o->asCreatureObject() : NULL); - if (o == NULL) + CreatureObject * c = (o ? o->asCreatureObject() : nullptr); + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - else if (c == NULL) + else if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; @@ -237,7 +237,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St else { PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -259,13 +259,13 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - CreatureObject * c = (o ? o->asCreatureObject() : NULL); - if (o == NULL) + CreatureObject * c = (o ? o->asCreatureObject() : nullptr); + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - else if (c == NULL) + else if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; @@ -273,7 +273,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St else { PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -295,13 +295,13 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - CreatureObject * c = (o ? o->asCreatureObject() : NULL); - if (o == NULL) + CreatureObject * c = (o ? o->asCreatureObject() : nullptr); + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - else if (c == NULL) + else if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; @@ -309,7 +309,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St else { PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -331,13 +331,13 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - CreatureObject * c = (o ? o->asCreatureObject() : NULL); - if (o == NULL) + CreatureObject * c = (o ? o->asCreatureObject() : nullptr); + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - else if (c == NULL) + else if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; @@ -345,7 +345,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St else { PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -369,13 +369,13 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - CreatureObject * c = (o ? o->asCreatureObject() : NULL); - if (o == NULL) + CreatureObject * c = (o ? o->asCreatureObject() : nullptr); + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - else if (c == NULL) + else if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; @@ -383,7 +383,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St else { PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -405,13 +405,13 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - CreatureObject * c = (o ? o->asCreatureObject() : NULL); - if (o == NULL) + CreatureObject * c = (o ? o->asCreatureObject() : nullptr); + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - else if (c == NULL) + else if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; @@ -419,7 +419,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St else { PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -441,13 +441,13 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - CreatureObject * c = (o ? o->asCreatureObject() : NULL); - if (o == NULL) + CreatureObject * c = (o ? o->asCreatureObject() : nullptr); + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - else if (c == NULL) + else if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; @@ -455,7 +455,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St else { PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -477,21 +477,21 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -585,7 +585,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -612,21 +612,21 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * const o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * const c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * const p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -660,21 +660,21 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * const o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * const c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * const p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -708,21 +708,21 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * const o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * const c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * const p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -756,21 +756,21 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * const o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * const c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * const p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -804,21 +804,21 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * const o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * const c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * const p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -852,14 +852,14 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId const oid(Unicode::wideToNarrow(argv[1])); ServerObject const * const o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject const * const c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; @@ -874,14 +874,14 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId const actorOid(Unicode::wideToNarrow(argv[1])); ServerObject const * const actorSo = dynamic_cast(ServerWorld::findObjectByNetworkId(actorOid)); - if (actorSo == NULL) + if (actorSo == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } TangibleObject const * const actorTo = actorSo->asTangibleObject(); - if (actorTo == NULL) + if (actorTo == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("(%s) is not a TangibleObject\n", actorOid.getValueString().c_str())); return true; @@ -889,14 +889,14 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St NetworkId const targetOid(Unicode::wideToNarrow(argv[2])); ServerObject const * const targetSo = dynamic_cast(ServerWorld::findObjectByNetworkId(targetOid)); - if (targetSo == NULL) + if (targetSo == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } TangibleObject const * const targetTo = targetSo->asTangibleObject(); - if (targetTo == NULL) + if (targetTo == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("(%s) is not a TangibleObject\n", targetOid.getValueString().c_str())); return true; @@ -924,14 +924,14 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId const actorOid(Unicode::wideToNarrow(argv[1])); ServerObject * const actorSo = dynamic_cast(ServerWorld::findObjectByNetworkId(actorOid)); - if (actorSo == NULL) + if (actorSo == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } TangibleObject * const actorTo = actorSo->asTangibleObject(); - if (actorTo == NULL) + if (actorTo == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("(%s) is not a TangibleObject\n", actorOid.getValueString().c_str())); return true; @@ -939,14 +939,14 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St NetworkId const targetOid(Unicode::wideToNarrow(argv[2])); ServerObject * const targetSo = dynamic_cast(ServerWorld::findObjectByNetworkId(targetOid)); - if (targetSo == NULL) + if (targetSo == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } TangibleObject * const targetTo = targetSo->asTangibleObject(); - if (targetTo == NULL) + if (targetTo == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("(%s) is not a TangibleObject\n", targetOid.getValueString().c_str())); return true; @@ -968,28 +968,28 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St NetworkId const oid(Unicode::wideToNarrow(argv[1])); ServerObject const * const o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject const * const c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject const * const p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; } ShipObject const * const ship = ShipObject::getContainingShipObject(c); - if (ship == NULL) + if (ship == nullptr) { result += Unicode::narrowToWide("specified character object is not in a ship\n"); return true; @@ -1042,28 +1042,28 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St NetworkId const oid(Unicode::wideToNarrow(argv[1])); ServerObject const * const o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject const * const c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject const * const p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; } ShipObject const * const ship = ShipObject::getContainingShipObject(c); - if (ship == NULL) + if (ship == nullptr) { result += Unicode::narrowToWide("specified character object is not in a ship\n"); return true; diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserResource.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserResource.cpp index 2d22864d..cde60a8e 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserResource.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserResource.cpp @@ -73,7 +73,7 @@ bool ConsoleCommandParserResource::performParsing (const NetworkId & userId, con CachedNetworkId harvester(Unicode::wideToNarrow (argv[1])); ServerObject* harvesterObject = safe_cast(harvester.getObject()); - if (harvesterObject == NULL) + if (harvesterObject == nullptr) { result += getErrorMessage (argv [0], ERR_INVALID_OBJECT); return true; @@ -90,7 +90,7 @@ bool ConsoleCommandParserResource::performParsing (const NetworkId & userId, con CachedNetworkId harvester(Unicode::wideToNarrow (argv[1])); ServerObject* harvesterObject = safe_cast(harvester.getObject()); - if (harvesterObject == NULL) + if (harvesterObject == nullptr) { result += getErrorMessage (argv [0], ERR_INVALID_OBJECT); return true; @@ -123,7 +123,7 @@ bool ConsoleCommandParserResource::performParsing (const NetworkId & userId, con CachedNetworkId harvester(Unicode::wideToNarrow (argv[1])); ServerObject* harvesterObject = safe_cast(harvester.getObject()); - if (harvesterObject == NULL) + if (harvesterObject == nullptr) { result += getErrorMessage (argv [0], ERR_INVALID_OBJECT); return true; @@ -208,7 +208,7 @@ bool ConsoleCommandParserResource::performParsing (const NetworkId & userId, con ResourceContainerObject * const container = dynamic_cast(NetworkIdManager::getObjectById(contId)); std::string const & resourcePath = Unicode::wideToNarrow(argv[2]); ResourceTypeObject * const resType = ServerUniverse::getInstance().getResourceTypeByName(resourcePath); - int const amount = strtol(Unicode::wideToNarrow (argv[3]).c_str (), NULL, 10); + int const amount = strtol(Unicode::wideToNarrow (argv[3]).c_str (), nullptr, 10); NetworkId const source(Unicode::wideToNarrow (argv[4])); if (container && resType) @@ -228,7 +228,7 @@ bool ConsoleCommandParserResource::performParsing (const NetworkId & userId, con { NetworkId contId (Unicode::wideToNarrow (argv[1])); ResourceContainerObject* container=dynamic_cast(NetworkIdManager::getObjectById(contId)); - if (container != NULL) + if (container != nullptr) { NetworkId sourceId; if (argv.size() >= 3) @@ -251,7 +251,7 @@ bool ConsoleCommandParserResource::performParsing (const NetworkId & userId, con { NetworkId contId (Unicode::wideToNarrow (argv[1])); ResourceContainerObject* container=dynamic_cast(NetworkIdManager::getObjectById(contId)); - if (container != NULL) + if (container != nullptr) { if (container->debugRecycle()) result += getErrorMessage(argv[0], ERR_SUCCESS); @@ -267,7 +267,7 @@ bool ConsoleCommandParserResource::performParsing (const NetworkId & userId, con CachedNetworkId contId (Unicode::wideToNarrow (argv[1])); ResourceContainerObject* container=dynamic_cast(contId.getObject()); ResourceTypeObject *resType=ServerUniverse::getInstance().getResourceTypeByName(Unicode::wideToNarrow(argv[2])); - int amount=strtol(Unicode::wideToNarrow (argv[3]).c_str (), NULL, 10); + int amount=strtol(Unicode::wideToNarrow (argv[3]).c_str (), nullptr, 10); if (container && resType) { @@ -307,8 +307,8 @@ bool ConsoleCommandParserResource::performParsing (const NetworkId & userId, con { const std::string parentResourceClassName (Unicode::wideToNarrow(argv[1])); const std::string resourceTypeName (Unicode::wideToNarrow(argv[2])); - const int surveyRange = strtol(Unicode::wideToNarrow(argv[3]).c_str(),NULL,10); - const int numPoints = strtol(Unicode::wideToNarrow(argv[4]).c_str(),NULL,10); + const int surveyRange = strtol(Unicode::wideToNarrow(argv[3]).c_str(),nullptr,10); + const int numPoints = strtol(Unicode::wideToNarrow(argv[4]).c_str(),nullptr,10); const Object * player = NetworkIdManager::getObjectById(userId); if (player) diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserScript.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserScript.cpp index a2703595..99f1f236 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserScript.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserScript.cpp @@ -62,7 +62,7 @@ bool ConsoleCommandParserScript::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow (argv[2])); ServerObject* object = ServerWorld::findObjectByNetworkId(oid); - if (object == NULL) + if (object == nullptr) { result += getErrorMessage (argv [0], ERR_INVALID_OBJECT); return true; @@ -81,7 +81,7 @@ bool ConsoleCommandParserScript::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[2])); ServerObject* object = ServerWorld::findObjectByNetworkId(oid); - if (object == NULL) + if (object == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -100,7 +100,7 @@ bool ConsoleCommandParserScript::performParsing (const NetworkId & userId, const { ServerObject * const userServerObject = ServerWorld::findObjectByNetworkId(userId); - if (userServerObject != NULL) + if (userServerObject != nullptr) { NetworkId specifiedNetworkId; @@ -112,7 +112,7 @@ bool ConsoleCommandParserScript::performParsing (const NetworkId & userId, const { CreatureObject * const userCreatureObject = CreatureObject::asCreatureObject(userServerObject); - if (userCreatureObject != NULL) + if (userCreatureObject != nullptr) { specifiedNetworkId = userCreatureObject->getLookAtTarget(); } @@ -120,7 +120,7 @@ bool ConsoleCommandParserScript::performParsing (const NetworkId & userId, const ServerObject * const specifiedServerObject = ServerObject::getServerObject(specifiedNetworkId); - if (specifiedServerObject != NULL) + if (specifiedServerObject != nullptr) { ScriptList const & scripts = specifiedServerObject->getScriptObject()->getScripts(); FormattedString<1024> fs; @@ -226,7 +226,7 @@ bool ConsoleCommandParserScript::performParsing (const NetworkId & userId, const // get the object id NetworkId oid(Unicode::wideToNarrow(argv[oidIndex])); ServerObject* object = ServerWorld::findObjectByNetworkId(oid); - if (object == NULL) + if (object == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserServer.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserServer.cpp index f789d127..c81f8966 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserServer.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserServer.cpp @@ -301,7 +301,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const return true; } - unsigned long val = strtoul(Unicode::wideToNarrow(argv[1]).c_str(), NULL, 10); + unsigned long val = strtoul(Unicode::wideToNarrow(argv[1]).c_str(), nullptr, 10); const bool isPublic = (val != 0); SetConnectionServerPublic const p(isPublic); @@ -354,8 +354,8 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const return true; } - unsigned long secsToWait = strtoul(Unicode::wideToNarrow(argv[1]).c_str(), NULL, 10); - unsigned long maxSecs = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), NULL, 10); + unsigned long secsToWait = strtoul(Unicode::wideToNarrow(argv[1]).c_str(), nullptr, 10); + unsigned long maxSecs = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), nullptr, 10); Unicode::String systemMessage; for( size_t i=3; i< argv.size(); ++i) { @@ -386,7 +386,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const return true; } - unsigned long val = strtoul(Unicode::wideToNarrow(argv[1]).c_str (), NULL, 10); + unsigned long val = strtoul(Unicode::wideToNarrow(argv[1]).c_str (), nullptr, 10); switch (val) { case 1: @@ -482,7 +482,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject* object = ServerWorld::findObjectByNetworkId(oid); - if (object == NULL) + if (object == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -574,7 +574,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const } else if (isAbbrev (argv[0], "getSceneId")) { - if (user == NULL) + if (user == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -596,7 +596,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const return true; } - unsigned long val = strtoul(Unicode::wideToNarrow(argv[1]).c_str (), NULL, 10); + unsigned long val = strtoul(Unicode::wideToNarrow(argv[1]).c_str (), nullptr, 10); if (user->getClient()->setGodMode(val != 0)) result += getErrorMessage (argv[0], ERR_SUCCESS); else @@ -637,7 +637,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const { std::string tableName; tableName = Unicode::wideToNarrow(argv[1]); - if (DataTableManager::reload(tableName) != NULL) + if (DataTableManager::reload(tableName) != nullptr) { ServerMessageForwarding::beginBroadcast(); @@ -694,7 +694,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const else { PlanetObject * planet = ServerUniverse::getInstance().getCurrentPlanet(); - if (planet == NULL) + if (planet == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -708,7 +708,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const for (std::vector::const_iterator i = regions.begin(); i != regions.end(); ++i) { const RegionRectangle * ro = dynamic_cast(*i); - if (ro != NULL) + if (ro != nullptr) { float minX, minY, maxX, maxY; ro->getExtent(minX, minY, maxX, maxY); @@ -717,7 +717,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const client->send(mrgrr, true); } const RegionCircle* co = dynamic_cast(*i); - if (co != NULL) + if (co != nullptr) { float centerX, centerY, radius; co->getExtent(centerX, centerY, radius); @@ -743,7 +743,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const { uint32 processId = GameServer::getInstance().getProcessId(); if (argv.size() > 3) - processId = strtoul(Unicode::wideToNarrow(argv[3]).c_str(), NULL, 10); + processId = strtoul(Unicode::wideToNarrow(argv[3]).c_str(), nullptr, 10); std::string op = Unicode::wideToNarrow(argv[1]) + " " + Unicode::wideToNarrow(argv[2]); @@ -760,7 +760,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const { uint32 processId = GameServer::getInstance().getProcessId(); if (argv.size() > 2) - processId = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), NULL, 10); + processId = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), nullptr, 10); std::string op(Unicode::wideToNarrow(argv[1])); if (processId == GameServer::getInstance().getProcessId()) @@ -840,8 +840,8 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const } else if (isAbbrev(argv[0], "getRegionsAt")) { - float x = static_cast(strtod(Unicode::wideToNarrow(argv[1]).c_str(), NULL)); - float z = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), NULL)); + float x = static_cast(strtod(Unicode::wideToNarrow(argv[1]).c_str(), nullptr)); + float z = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), nullptr)); std::vector results; @@ -990,10 +990,10 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const //" ", "Save out an area for buildout datatables" std::string const &serverFilename = Unicode::wideToNarrow(argv[1]); std::string const &clientFilename = Unicode::wideToNarrow(argv[2]); - float x1 = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL)); - float z1 = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), NULL)); - float x2 = static_cast(strtod(Unicode::wideToNarrow(argv[5]).c_str(), NULL)); - float z2 = static_cast(strtod(Unicode::wideToNarrow(argv[6]).c_str(), NULL)); + float x1 = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr)); + float z1 = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), nullptr)); + float x2 = static_cast(strtod(Unicode::wideToNarrow(argv[5]).c_str(), nullptr)); + float z2 = static_cast(strtod(Unicode::wideToNarrow(argv[6]).c_str(), nullptr)); ServerBuildoutManager::saveArea(serverFilename, clientFilename, x1, z1, x2, z2); } else if (isAbbrev(argv[0], "clientSaveBuildoutArea")) @@ -1001,10 +1001,10 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const //" " std::string const &scene = Unicode::wideToNarrow(argv[1]); std::string const &areaName = Unicode::wideToNarrow(argv[2]); - float x1 = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL)); - float z1 = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), NULL)); - float x2 = static_cast(strtod(Unicode::wideToNarrow(argv[5]).c_str(), NULL)); - float z2 = static_cast(strtod(Unicode::wideToNarrow(argv[6]).c_str(), NULL)); + float x1 = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr)); + float z1 = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), nullptr)); + float x2 = static_cast(strtod(Unicode::wideToNarrow(argv[5]).c_str(), nullptr)); + float z2 = static_cast(strtod(Unicode::wideToNarrow(argv[6]).c_str(), nullptr)); if (scene == ConfigServerGame::getSceneID() && user->getClient()) ServerBuildoutManager::clientSaveArea(*user->getClient(), areaName, x1, z1, x2, z2); } @@ -1044,7 +1044,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const if (argv.size() == 2) { // specify server by process id - uint32 serverId = strtoul(Unicode::wideToNarrow(argv[1]).c_str(), NULL, 10); + uint32 serverId = strtoul(Unicode::wideToNarrow(argv[1]).c_str(), nullptr, 10); if (serverId != 0) { ExcommunicateGameServerMessage exmsg(serverId, 0, ""); @@ -1058,7 +1058,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const { // specify server by scene & preload role number std::string const &scene = Unicode::wideToNarrow(argv[1]); - uint32 preloadRole = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), NULL, 10); + uint32 preloadRole = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), nullptr, 10); GenericValueTypeMessage > msg("RestartServerByRoleMessage", std::make_pair(scene, preloadRole)); if (scene == ConfigServerGame::getSceneID()) @@ -1072,8 +1072,8 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const { // specify server by geographic location std::string const &scene = Unicode::wideToNarrow(argv[1]); - int x = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), NULL)); - int z = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL)); + int x = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), nullptr)); + int z = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr)); RestartServerMessage msg(scene, x, z); if (scene == ConfigServerGame::getSceneID()) @@ -1322,14 +1322,14 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const NetworkId oid2(Unicode::wideToNarrow(argv[2])); ServerObject const * const object1 = ServerWorld::findObjectByNetworkId(oid1); - if (object1 == NULL) + if (object1 == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } ServerObject const * const object2 = ServerWorld::findObjectByNetworkId(oid2); - if (object2 == NULL) + if (object2 == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1366,7 +1366,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const TerrainObject const * terrain = TerrainObject::getConstInstance(); if (!terrain) { - result += Unicode::narrowToWide("terrain object is NULL\n"); + result += Unicode::narrowToWide("terrain object is nullptr\n"); return true; } @@ -1443,7 +1443,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const TerrainObject const * terrain = TerrainObject::getConstInstance(); if (!terrain) { - result += Unicode::narrowToWide("terrain object is NULL\n"); + result += Unicode::narrowToWide("terrain object is nullptr\n"); return true; } @@ -1491,7 +1491,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const TerrainObject * terrain = TerrainObject::getInstance(); if (!terrain) { - result += Unicode::narrowToWide("terrain object is NULL\n"); + result += Unicode::narrowToWide("terrain object is nullptr\n"); return true; } @@ -1557,8 +1557,8 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const { result += Unicode::narrowToWide(iterFind->second.getDebugString()); - ServerObject const * const soGroupObject = (iterFind->second.groupId.isValid() ? safe_cast(NetworkIdManager::getObjectById(iterFind->second.groupId)) : NULL); - GroupObject const * const groupObject = (soGroupObject ? soGroupObject->asGroupObject() : NULL); + ServerObject const * const soGroupObject = (iterFind->second.groupId.isValid() ? safe_cast(NetworkIdManager::getObjectById(iterFind->second.groupId)) : nullptr); + GroupObject const * const groupObject = (soGroupObject ? soGroupObject->asGroupObject() : nullptr); if (groupObject) { unsigned int const secondsLeftOnGroupPickup = groupObject->getSecondsLeftOnGroupPickup(); @@ -1717,7 +1717,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const else if (isAbbrev(argv[0], "listCharacterLastLoginTimeBrief")) { int const days = atoi(Unicode::wideToNarrow(argv[1]).c_str()); - time_t const cutoff = std::max(static_cast(0), static_cast(::time(NULL) - (60 * 60 * 24 * days))); + time_t const cutoff = std::max(static_cast(0), static_cast(::time(nullptr) - (60 * 60 * 24 * days))); std::multimap, std::string> > resultList; NameManager::getInstance().getPlayerWithLastLoginTimeAfter(cutoff, resultList); @@ -1726,7 +1726,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "listCharacterLastLoginTimeAfterBrief")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -1749,7 +1749,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "listCharacterLastLoginTimeBeforeBrief")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -1772,7 +1772,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "listCharacterLastLoginTimeBetweenBrief")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -1817,7 +1817,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const else if (isAbbrev(argv[0], "listCharacterLastLoginTimeDetailed")) { int const days = atoi(Unicode::wideToNarrow(argv[1]).c_str()); - time_t const cutoff = std::max(static_cast(0), static_cast(::time(NULL) - (60 * 60 * 24 * days))); + time_t const cutoff = std::max(static_cast(0), static_cast(::time(nullptr) - (60 * 60 * 24 * days))); std::multimap, std::string> > resultList; NameManager::getInstance().getPlayerWithLastLoginTimeAfter(cutoff, resultList); @@ -1829,7 +1829,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "listCharacterLastLoginTimeAfterDetailed")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -1855,7 +1855,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "listCharacterLastLoginTimeBeforeDetailed")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -1881,7 +1881,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "listCharacterLastLoginTimeBetweenDetailed")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -1929,7 +1929,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const else if (isAbbrev(argv[0], "sendMailToCharacterLastLoginTime")) { int const days = atoi(Unicode::wideToNarrow(argv[1]).c_str()); - time_t const cutoff = std::max(static_cast(0), static_cast(::time(NULL) - (60 * 60 * 24 * days))); + time_t const cutoff = std::max(static_cast(0), static_cast(::time(nullptr) - (60 * 60 * 24 * days))); int const argc = argv.size(); Unicode::String mailBody; @@ -1952,7 +1952,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const static Unicode::String s_mailBody; static time_t s_confirmationTimeout = 0; - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); if ((s_days == days) && (s_confirmationTimeout > timeNow) && (s_fromName == Unicode::wideToNarrow(argv[2])) && (s_mailSubject == argv[3]) && (s_mailBody == mailBody)) { @@ -1991,7 +1991,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "sendMailToCharacterLastLoginTimeAfter")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -2028,7 +2028,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const static Unicode::String s_mailBody; static time_t s_confirmationTimeout = 0; - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); if ((s_cutoff == cutoff) && (s_confirmationTimeout > timeNow) && (s_fromName == Unicode::wideToNarrow(argv[7])) && (s_mailSubject == argv[8]) && (s_mailBody == mailBody)) { @@ -2067,7 +2067,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "sendMailToCharacterLastLoginTimeBefore")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -2104,7 +2104,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const static Unicode::String s_mailBody; static time_t s_confirmationTimeout = 0; - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); if ((s_cutoff == cutoff) && (s_confirmationTimeout > timeNow) && (s_fromName == Unicode::wideToNarrow(argv[7])) && (s_mailSubject == argv[8]) && (s_mailBody == mailBody)) { @@ -2143,7 +2143,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "sendMailToCharacterLastLoginTimeBetween")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -2202,7 +2202,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const static Unicode::String s_mailBody; static time_t s_confirmationTimeout = 0; - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); if ((s_cutoffLower == cutoffLower) && (s_cutoffUpper == cutoffUpper) && (s_confirmationTimeout > timeNow) && (s_fromName == Unicode::wideToNarrow(argv[13])) && (s_mailSubject == argv[14]) && (s_mailBody == mailBody)) { @@ -2244,7 +2244,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const else if (isAbbrev(argv[0], "listCharacterCreateTimeBrief")) { int const days = atoi(Unicode::wideToNarrow(argv[1]).c_str()); - time_t const cutoff = std::max(static_cast(0), static_cast(::time(NULL) - (60 * 60 * 24 * days))); + time_t const cutoff = std::max(static_cast(0), static_cast(::time(nullptr) - (60 * 60 * 24 * days))); std::multimap, std::string> > resultList; NameManager::getInstance().getPlayerWithCreateTimeAfter(cutoff, resultList); @@ -2253,7 +2253,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "listCharacterCreateTimeAfterBrief")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -2276,7 +2276,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "listCharacterCreateTimeBeforeBrief")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -2299,7 +2299,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "listCharacterCreateTimeBetweenBrief")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -2344,7 +2344,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const else if (isAbbrev(argv[0], "listCharacterCreateTimeDetailed")) { int const days = atoi(Unicode::wideToNarrow(argv[1]).c_str()); - time_t const cutoff = std::max(static_cast(0), static_cast(::time(NULL) - (60 * 60 * 24 * days))); + time_t const cutoff = std::max(static_cast(0), static_cast(::time(nullptr) - (60 * 60 * 24 * days))); std::multimap, std::string> > resultList; NameManager::getInstance().getPlayerWithCreateTimeAfter(cutoff, resultList); @@ -2356,7 +2356,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "listCharacterCreateTimeAfterDetailed")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -2382,7 +2382,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "listCharacterCreateTimeBeforeDetailed")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -2408,7 +2408,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "listCharacterCreateTimeBetweenDetailed")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -2456,7 +2456,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const else if (isAbbrev(argv[0], "sendMailToCharacterCreateTime")) { int const days = atoi(Unicode::wideToNarrow(argv[1]).c_str()); - time_t const cutoff = std::max(static_cast(0), static_cast(::time(NULL) - (60 * 60 * 24 * days))); + time_t const cutoff = std::max(static_cast(0), static_cast(::time(nullptr) - (60 * 60 * 24 * days))); int const argc = argv.size(); Unicode::String mailBody; @@ -2479,7 +2479,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const static Unicode::String s_mailBody; static time_t s_confirmationTimeout = 0; - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); if ((s_days == days) && (s_confirmationTimeout > timeNow) && (s_fromName == Unicode::wideToNarrow(argv[2])) && (s_mailSubject == argv[3]) && (s_mailBody == mailBody)) { @@ -2518,7 +2518,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "sendMailToCharacterCreateTimeAfter")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -2555,7 +2555,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const static Unicode::String s_mailBody; static time_t s_confirmationTimeout = 0; - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); if ((s_cutoff == cutoff) && (s_confirmationTimeout > timeNow) && (s_fromName == Unicode::wideToNarrow(argv[7])) && (s_mailSubject == argv[8]) && (s_mailBody == mailBody)) { @@ -2594,7 +2594,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "sendMailToCharacterCreateTimeBefore")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -2631,7 +2631,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const static Unicode::String s_mailBody; static time_t s_confirmationTimeout = 0; - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); if ((s_cutoff == cutoff) && (s_confirmationTimeout > timeNow) && (s_fromName == Unicode::wideToNarrow(argv[7])) && (s_mailSubject == argv[8]) && (s_mailBody == mailBody)) { @@ -2670,7 +2670,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "sendMailToCharacterCreateTimeBetween")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -2729,7 +2729,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const static Unicode::String s_mailBody; static time_t s_confirmationTimeout = 0; - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); if ((s_cutoffLower == cutoffLower) && (s_cutoffUpper == cutoffUpper) && (s_confirmationTimeout > timeNow) && (s_fromName == Unicode::wideToNarrow(argv[13])) && (s_mailSubject == argv[14]) && (s_mailBody == mailBody)) { @@ -2776,7 +2776,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const uint32 const targetStationId = static_cast(atoi(Unicode::wideToNarrow(argv[4]).c_str())); std::string const targetCluster = Unicode::wideToNarrow(argv[5]); - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); result += Unicode::narrowToWide(FormattedString<512>().sprintf(" currentTime: %ld, %s\n", timeNow, CalendarTime::convertEpochToTimeStringLocal(timeNow).c_str())); result += Unicode::narrowToWide(FormattedString<512>().sprintf("\n characterCreateTime: %ld\n", sourceCharacterCreateTime)); @@ -2837,7 +2837,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const { std::string const sourceCluster = Unicode::wideToNarrow(argv[1]); - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); result += Unicode::narrowToWide(FormattedString<512>().sprintf(" currentTime: %ld, %s\n", timeNow, CalendarTime::convertEpochToTimeStringLocal(timeNow).c_str())); result += Unicode::narrowToWide(FormattedString<512>().sprintf(" sourceCluster: %s\n", sourceCluster.c_str())); @@ -2893,7 +2893,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const { result += Unicode::narrowToWide(FormattedString<512>().sprintf(" free CTS info file: %s\n", FreeCtsDataTable::getFreeCtsFileName().c_str())); - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); result += Unicode::narrowToWide(FormattedString<512>().sprintf(" currentTime: %ld, %s\n", timeNow, CalendarTime::convertEpochToTimeStringLocal(timeNow).c_str())); } @@ -3125,7 +3125,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const else { result += Unicode::narrowToWide(FormattedString<1024>().sprintf("Requesting adjustment of imperial score for GCW score category (%s) by (%d). It can take up to 1 minute for the adjustment request to be completed.\n", category.c_str(), adjustment)); - ServerUniverse::getInstance().adjustGcwImperialScore("remote server adjustGcwImperialScore", NULL, category, adjustment); + ServerUniverse::getInstance().adjustGcwImperialScore("remote server adjustGcwImperialScore", nullptr, category, adjustment); } } else if (isAbbrev(argv[0], "adjustGcwRebelScore")) @@ -3148,7 +3148,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const else { result += Unicode::narrowToWide(FormattedString<1024>().sprintf("Requesting adjustment of rebel score for GCW score category (%s) by (%d). It can take up to 1 minute for the adjustment request to be completed.\n", category.c_str(), adjustment)); - ServerUniverse::getInstance().adjustGcwRebelScore("remote server adjustGcwRebelScore", NULL, category, adjustment); + ServerUniverse::getInstance().adjustGcwRebelScore("remote server adjustGcwRebelScore", nullptr, category, adjustment); } } else if (isAbbrev(argv[0], "decayGcwScore")) @@ -3202,20 +3202,20 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject const * const o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject const * const c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } - if (PlayerCreatureController::getPlayerObject(c) == NULL) + if (PlayerCreatureController::getPlayerObject(c) == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -3240,21 +3240,21 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject const * const o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject const * const c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject const * const p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserShip.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserShip.cpp index 38efa02a..3fc8ad7d 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserShip.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserShip.cpp @@ -116,7 +116,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S slotNameToken.clear (); } - if (ship == NULL) + if (ship == nullptr) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); return true; @@ -126,7 +126,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S ShipChassis const * const shipChassis = ShipChassis::findShipChassisByCrc (chassisType); - if (shipChassis == NULL) + if (shipChassis == nullptr) { result += Unicode::narrowToWide ("No chassis"); return true; @@ -178,7 +178,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S if (ship->isSlotInstalled(chassisSlot)) shipComponentData = ship->createShipComponentData(chassisSlot); - if (shipComponentData == NULL) + if (shipComponentData == nullptr) { result += Unicode::narrowToWide (" Loaded NONE\n"); } @@ -223,7 +223,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S { TangibleObject * const component = findTangible (user->getLookAtTarget (), argv, 1); - if (component == NULL) + if (component == nullptr) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); return true; @@ -231,7 +231,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S ShipComponentData * const shipComponentData = ShipComponentDataManager::create (*component); - if (shipComponentData == NULL) + if (shipComponentData == nullptr) { result += Unicode::narrowToWide ("Not a ship component"); return true; @@ -252,13 +252,13 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S TangibleObject * const component = findTangible (NetworkId::cms_invalid, argv, 1); std::string const & slotName = Unicode::wideToNarrow (argv [2]); - if (ship == NULL) + if (ship == nullptr) { result += Unicode::narrowToWide ("no ship"); return true; } - if (component == NULL) + if (component == nullptr) { result += Unicode::narrowToWide ("no component"); return true; @@ -279,14 +279,14 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S } ShipChassis const * const shipChassis = ShipChassis::findShipChassisByCrc (ship->getChassisType ()); - if (shipChassis == NULL) + if (shipChassis == nullptr) { result += Unicode::narrowToWide ("Ship chassis invalid"); return true; } ShipChassisSlot const * const slot = shipChassis->getSlot (shipChassisSlotType); - if (slot == NULL) + if (slot == nullptr) { result += Unicode::narrowToWide ("Ship chassis does not support that slot"); return true; @@ -294,7 +294,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S ShipComponentData * const shipComponentData = ShipComponentDataManager::create (*component); - if (shipComponentData == NULL) + if (shipComponentData == nullptr) { result += Unicode::narrowToWide ("Not a ship component"); return true; @@ -325,7 +325,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S std::string const & componentName = Unicode::wideToNarrow (argv [1]); std::string const & slotName = Unicode::wideToNarrow (argv [2]); - if (ship == NULL) + if (ship == nullptr) { result += Unicode::narrowToWide ("no ship"); return true; @@ -334,7 +334,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S uint32 const componentCrc = Crc::normalizeAndCalculate (componentName.c_str ()); ShipComponentDescriptor const * const shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByCrc (componentCrc); - if (shipComponentDescriptor == NULL) + if (shipComponentDescriptor == nullptr) { result += Unicode::narrowToWide ("Invalid component name"); return true; @@ -364,13 +364,13 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S TangibleObject * const targetContainer = findTangible (user->getInventory ()->getNetworkId (), argv, 2); std::string const & slotName = Unicode::wideToNarrow (argv [1]); - if (ship == NULL) + if (ship == nullptr) { result += Unicode::narrowToWide ("no ship"); return true; } - if (targetContainer == NULL) + if (targetContainer == nullptr) { result += Unicode::narrowToWide ("no target container"); return true; @@ -405,7 +405,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S ShipObject * const ship = dynamic_cast(findTangible (user->getLookAtTarget (), argv, 2)); std::string const & slotName = Unicode::wideToNarrow (argv [1]); - if (ship == NULL) + if (ship == nullptr) { result += Unicode::narrowToWide ("no ship"); return true; @@ -436,14 +436,14 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S else if (isCommand (argv[0], CommandNames::pseudoDamageShip)) { ShipObject const * const victimShipObject = user->getPilotedShip(); - if (victimShipObject == NULL) + if (victimShipObject == nullptr) { result += Unicode::narrowToWide ("You are not piloting a ship."); return true; } ShipObject const * const attackerShipObject = dynamic_cast(findTangible (user->getLookAtTarget (), argv, 2)); - if (attackerShipObject == NULL) + if (attackerShipObject == nullptr) { result += Unicode::narrowToWide ("You don't have attacker ship targeted."); return true; @@ -486,12 +486,12 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S ShipObject const * const idotShip = idot.getShipObject(); - if (ship != NULL && ship != idotShip) + if (ship != nullptr && ship != idotShip) continue; uint32 const chassisType = idotShip->getChassisType(); ShipChassis const * const chassis = ShipChassis::findShipChassisByCrc(chassisType); - std::string const chassisTypeName = (chassis != NULL) ? chassis->getName().getString() : ""; + std::string const chassisTypeName = (chassis != nullptr) ? chassis->getName().getString() : ""; float hpCur = 0.0f; float hpMax = 0.0f; @@ -522,7 +522,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S { ShipObject * const ship = dynamic_cast(findTangible (user->getLookAtTarget (), argv, 4)); - if (ship == NULL) + if (ship == nullptr) { result += Unicode::narrowToWide ("no ship"); return true; @@ -546,7 +546,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S { ShipObject * const ship = dynamic_cast(findTangible (user->getLookAtTarget (), argv, 4)); - if (ship == NULL) + if (ship == nullptr) { result += Unicode::narrowToWide ("no ship"); return true; diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserSkill.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserSkill.cpp index fc1a1a49..3b356f42 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserSkill.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserSkill.cpp @@ -99,7 +99,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 2); - if (creature == NULL) + if (creature == nullptr) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -107,7 +107,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { const std::string skillName = Unicode::wideToNarrow (argv[1]); const SkillObject * const skill = SkillManager::getInstance ().getSkill (skillName); - if (skill == NULL) + if (skill == nullptr) { result += Unicode::narrowToWide ("unknown skill"); } @@ -126,7 +126,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 3); - if (creature == NULL) + if (creature == nullptr) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -146,7 +146,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 2); - if (creature == NULL) + if (creature == nullptr) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -198,7 +198,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 1); - if (creature == NULL) + if (creature == nullptr) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -233,7 +233,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 1); - if (creature == NULL) + if (creature == nullptr) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -262,7 +262,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 1); - if (creature == NULL) + if (creature == nullptr) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -288,7 +288,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 2); - if (creature == NULL) + if (creature == nullptr) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -296,7 +296,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { std::string skillName = Unicode::wideToNarrow (argv[1]); const SkillObject * skill = SkillManager::getInstance ().getSkill (skillName); - if (skill == NULL) + if (skill == nullptr) { result += Unicode::narrowToWide ("unknown skill"); } @@ -317,7 +317,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 2); - if (creature == NULL) + if (creature == nullptr) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -336,7 +336,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 1); - if (creature == NULL) + if (creature == nullptr) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -367,7 +367,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 2); - if (creature == NULL) + if (creature == nullptr) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -384,7 +384,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 2); - if (creature == NULL) + if (creature == nullptr) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -401,7 +401,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 2); - if (creature == NULL) + if (creature == nullptr) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -418,7 +418,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 2); - if (creature == NULL) + if (creature == nullptr) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -435,7 +435,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 1); - if (creature == NULL) + if (creature == nullptr) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserSpaceAi.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserSpaceAi.cpp index 9972dcf5..0964cdac 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserSpaceAi.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserSpaceAi.cpp @@ -66,9 +66,9 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const AiShipController::setAttackingEnabled(true); Object * const object = NetworkIdManager::getObjectById(userId); - ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - if (serverObject != NULL) + if (serverObject != nullptr) { Chat::sendSystemMessage(*serverObject, Unicode::narrowToWide("[WAR] AI will now attack."), Unicode::emptyString); } @@ -80,9 +80,9 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const AiShipController::setAttackingEnabled(false); Object * const object = NetworkIdManager::getObjectById(userId); - ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - if (serverObject != NULL) + if (serverObject != nullptr) { Chat::sendSystemMessage(*serverObject, Unicode::narrowToWide("[PEACE] AI will no longer attack."), Unicode::emptyString); } @@ -92,20 +92,20 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const else if (isAbbrev(argv[0], "path")) { Object * const object = NetworkIdManager::getObjectById(userId); - ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - if ( (serverObject != NULL) + if ( (serverObject != nullptr) && (argv.size () > 1)) { NetworkId networkId(Unicode::wideToNarrow(argv[1])); AiShipController * const aiShipController = AiShipController::getAiShipController(networkId); - if (aiShipController != NULL) + if (aiShipController != nullptr) { SpacePath * const spacePath = aiShipController->getPath(); - if (spacePath != NULL) + if (spacePath != nullptr) { SpacePath::TransformList const & transformList = spacePath->getTransformList(); SpacePath::TransformList::const_iterator iterTransformList = transformList.begin(); @@ -127,7 +127,7 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const } else { - Chat::sendSystemMessage(*serverObject, Unicode::narrowToWide("NULL path"), Unicode::emptyString); + Chat::sendSystemMessage(*serverObject, Unicode::narrowToWide("nullptr path"), Unicode::emptyString); } } else @@ -141,9 +141,9 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const else if (isAbbrev(argv[0], "reloaddata")) { Object * const object = NetworkIdManager::getObjectById(userId); - ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - if (serverObject != NULL) + if (serverObject != nullptr) { AiShipPilotData::reload(); @@ -156,10 +156,10 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const else if (isAbbrev(argv[0], "clientDebug")) { Object * const object = NetworkIdManager::getObjectById(userId); - ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; int temp; - if (serverObject != NULL) + if (serverObject != nullptr) { if ( serverObject->getObjVars().getItem("ai_debug_string", temp) && (temp > 0)) @@ -180,7 +180,7 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const Client * const client = serverObject->getClient(); - if (client != NULL) + if (client != nullptr) { AiDebugString aiDebugString; aiDebugString.enableClearClientFlag(); @@ -209,9 +209,9 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const else if (isAbbrev(argv[0], "serverDebug")) { Object * const object = NetworkIdManager::getObjectById(userId); - ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - if (serverObject != NULL) + if (serverObject != nullptr) { AiShipController::setClientDebugEnabled(!AiShipController::isClientDebugEnabled()); @@ -225,9 +225,9 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const else if (isAbbrev(argv[0], "clientDebugText")) { Object * const object = NetworkIdManager::getObjectById(userId); - ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - if (serverObject != NULL) + if (serverObject != nullptr) { AiDebugString::setTextEnabled(!AiDebugString::isTextEnabled()); @@ -241,12 +241,12 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const else if (isAbbrev(argv[0], "maneuver")) { Object * const object = NetworkIdManager::getObjectById(userId); - ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; - CreatureObject const * const creatureObject = serverObject ? serverObject->asCreatureObject() : NULL; + ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; + CreatureObject const * const creatureObject = serverObject ? serverObject->asCreatureObject() : nullptr; if (serverObject) { - if ((creatureObject != NULL) && (argv.size () > 1)) + if ((creatureObject != nullptr) && (argv.size () > 1)) { AiShipController const * const lookAtAiShipController = AiShipController::getAiShipController(creatureObject->getLookAtTarget()); @@ -295,9 +295,9 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const else if (isAbbrev(argv[0], "fastAxis")) { Object * const object = NetworkIdManager::getObjectById(userId); - ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - if (serverObject != NULL) + if (serverObject != nullptr) { Unicode::String systemMessage; diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserVeteran.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserVeteran.cpp index 0152e24d..3b91f7f0 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserVeteran.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserVeteran.cpp @@ -42,7 +42,7 @@ bool ConsoleCommandParserVeteran::performParsing (const NetworkId & userId, cons { NetworkId targetPlayer(Unicode::wideToNarrow (argv[1])); ServerObject const * const so = safe_cast(NetworkIdManager::getObjectById(targetPlayer)); - Client const * const client = so ? so->getClient() : NULL; + Client const * const client = so ? so->getClient() : nullptr; if (client) { std::string output; @@ -107,7 +107,7 @@ bool ConsoleCommandParserVeteran::performParsing (const NetworkId & userId, cons { NetworkId targetPlayer(Unicode::wideToNarrow(argv[1])); ServerObject const * const so = safe_cast(NetworkIdManager::getObjectById(targetPlayer)); - CreatureObject const * const playerCreature = so ? so->asCreatureObject() : NULL; + CreatureObject const * const playerCreature = so ? so->asCreatureObject() : nullptr; if (!playerCreature) result += getErrorMessage(argv[0],ERR_INVALID_OBJECT); else @@ -126,7 +126,7 @@ bool ConsoleCommandParserVeteran::performParsing (const NetworkId & userId, cons { std::string url(Unicode::wideToNarrow(argv[1])); ServerObject const * const so = safe_cast(NetworkIdManager::getObjectById(userId)); - Client const * const client = so ? so->getClient() : NULL; + Client const * const client = so ? so->getClient() : nullptr; if (client) { client->launchWebBrowser(url); diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleManager.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleManager.cpp index 46e4a6fd..f31601df 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleManager.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleManager.cpp @@ -41,14 +41,14 @@ #include "sharedCommandParser/CommandParser.h" #include "sharedNetworkMessages/ConsoleChannelMessages.h" -CommandParser * ConsoleMgr::ms_parser = NULL; +CommandParser * ConsoleMgr::ms_parser = nullptr; //----------------------------------------------------------------------- void ConsoleMgr::install() { - if (ms_parser == NULL) + if (ms_parser == nullptr) { ms_parser = new ConsoleCommandParserDefault(); ms_parser->addSubCommand(new ConsoleCommandParserCombatEngine ()); @@ -80,10 +80,10 @@ void ConsoleMgr::install() void ConsoleMgr::remove() { - if (ms_parser != NULL) + if (ms_parser != nullptr) { delete ms_parser; - ms_parser = NULL; + ms_parser = nullptr; } } // ConsoleMgr::remove @@ -93,7 +93,7 @@ void ConsoleMgr::processString(const std::string & msg, Client *from, uint32 msg { DEBUG_REPORT_LOG_PRINT(true, ("Console Message Received: %s\n",(msg.c_str()))); - if (ms_parser == NULL) + if (ms_parser == nullptr) { DEBUG_WARNING(true, ("Console command parser has not been created!")); return; diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleManager.h b/engine/server/library/serverGame/src/shared/console/ConsoleManager.h index f32ac0a3..8f71dbd6 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleManager.h +++ b/engine/server/library/serverGame/src/shared/console/ConsoleManager.h @@ -17,9 +17,9 @@ public: static void install(); static void remove(); - static void processString(const std::string & msg, Client *from = NULL,uint32 msgId = 0); - static void broadcastString(const std::string & msg, Client *to = NULL, uint32 msgId = 0); - static void broadcastString(const CommandParser::String_t & msg, Client *to = NULL, uint32 msgId = 0); + static void processString(const std::string & msg, Client *from = nullptr,uint32 msgId = 0); + static void broadcastString(const std::string & msg, Client *to = nullptr, uint32 msgId = 0); + static void broadcastString(const CommandParser::String_t & msg, Client *to = nullptr, uint32 msgId = 0); static void broadcastString(const std::string & msg, NetworkId to, uint32 msgId = 0); private: diff --git a/engine/server/library/serverGame/src/shared/controller/AiCreatureController.cpp b/engine/server/library/serverGame/src/shared/controller/AiCreatureController.cpp index 040d0a9c..14425612 100755 --- a/engine/server/library/serverGame/src/shared/controller/AiCreatureController.cpp +++ b/engine/server/library/serverGame/src/shared/controller/AiCreatureController.cpp @@ -83,7 +83,7 @@ namespace AiCreatureControllerNamespace bool s_installed = false; typedef std::set ObserverList; - PersistentCrcString * s_defaultCreatureName = NULL; + PersistentCrcString * s_defaultCreatureName = nullptr; void remove(); Location getLocation(ServerObject const & serverObject); @@ -97,7 +97,7 @@ void AiCreatureControllerNamespace::remove() DEBUG_FATAL(!s_installed, ("Not installed.")); delete s_defaultCreatureName; - s_defaultCreatureName = NULL; + s_defaultCreatureName = nullptr; s_installed = false; } @@ -106,9 +106,9 @@ void AiCreatureControllerNamespace::remove() Location AiCreatureControllerNamespace::getLocation(ServerObject const & serverObject) { CellProperty const * const cellProperty = serverObject.getParentCell(); - Object const * const cellObject = (cellProperty != NULL) ? &cellProperty->getOwner() : NULL; - Vector const & positionRelativeToCellOrWorld = (cellObject != NULL) ? serverObject.getPosition_c() : serverObject.getPosition_w(); - NetworkId const & networkIdForCellOrWorld = (cellObject != NULL) ? cellObject->getNetworkId() : NetworkId::cms_invalid; + Object const * const cellObject = (cellProperty != nullptr) ? &cellProperty->getOwner() : nullptr; + Vector const & positionRelativeToCellOrWorld = (cellObject != nullptr) ? serverObject.getPosition_c() : serverObject.getPosition_w(); + NetworkId const & networkIdForCellOrWorld = (cellObject != nullptr) ? cellObject->getNetworkId() : NetworkId::cms_invalid; return Location(positionRelativeToCellOrWorld, networkIdForCellOrWorld, Location::getCrcBySceneName(serverObject.getSceneId())); } @@ -164,10 +164,10 @@ AICreatureController::~AICreatureController() Object * const owner = getOwner(); - if (owner != NULL && owner->isAuthoritative() && !getHibernate() && m_hibernationDelay.get() > 0 && m_hibernationTimer.get() > 0) + if (owner != nullptr && owner->isAuthoritative() && !getHibernate() && m_hibernationDelay.get() > 0 && m_hibernationTimer.get() > 0) ObjectTracker::removeDelayedHibernatingAI(); - if ( (owner != NULL) + if ( (owner != nullptr) && AiLogManager::isLogging(owner->getNetworkId())) { AiLogManager::setLogging(owner->getNetworkId(), false); @@ -205,9 +205,9 @@ void AICreatureController::CreatureNameChangedCallback::modified(AICreatureContr void AICreatureController::handleMessage (int message, float value, const MessageQueue::Data* const data, uint32 flags) { CreatureObject * const owner = static_cast(getOwner()); - if (owner == NULL) + if (owner == nullptr) { - DEBUG_FATAL(true, ("Owner is NULL in AiCreatureController::handleMessage\n")); + DEBUG_FATAL(true, ("Owner is nullptr in AiCreatureController::handleMessage\n")); return; } @@ -219,7 +219,7 @@ void AICreatureController::handleMessage (int message, float value, const Messag AiMovementMessage const * const msg = safe_cast(data); - if (msg != NULL) + if (msg != nullptr) { if (owner->isAuthoritative()) { @@ -256,7 +256,7 @@ void AICreatureController::handleMessage (int message, float value, const Messag LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::handleMessage(CM_aiSetCreatureName) owner(%s)", getDebugInformation().c_str())); MessageQueueGenericValueType const * const msg = safe_cast const *>(data); - if (msg != NULL) + if (msg != nullptr) { setCreatureName(msg->getValue()); } @@ -267,7 +267,7 @@ void AICreatureController::handleMessage (int message, float value, const Messag LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::handleMessage(CM_aiSetHomeLocation) owner(%s)", getDebugInformation().c_str())); MessageQueueGenericValueType const * const msg = safe_cast const *>(data); - if (msg != NULL) + if (msg != nullptr) { setHomeLocation(msg->getValue()); } @@ -278,7 +278,7 @@ void AICreatureController::handleMessage (int message, float value, const Messag LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::handleMessage(CM_aiSetFrozen) owner(%s)", getDebugInformation().c_str())); MessageQueueGenericValueType const * const msg = safe_cast const *>(data); - if (msg != NULL) + if (msg != nullptr) { setFrozen(msg->getValue()); } @@ -289,7 +289,7 @@ void AICreatureController::handleMessage (int message, float value, const Messag LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::handleMessage(CM_aiSetRetreating) owner(%s)", getDebugInformation().c_str())); MessageQueueGenericValueType const * const msg = safe_cast const *>(data); - if (msg != NULL) + if (msg != nullptr) { setRetreating(msg->getValue()); } @@ -300,7 +300,7 @@ void AICreatureController::handleMessage (int message, float value, const Messag LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::handleMessage(CM_aiSetLogging) owner(%s)", getDebugInformation().c_str())); MessageQueueGenericValueType const * const msg = safe_cast const *>(data); - if (msg != NULL) + if (msg != nullptr) { setLogging(msg->getValue()); } @@ -333,7 +333,7 @@ void AICreatureController::handleMessage (int message, float value, const Messag case CM_setHibernationDelay: { MessageQueueGenericValueType const * const msg = safe_cast const *>(data); - if (msg != NULL) + if (msg != nullptr) setHibernationDelay(msg->getValue()); } break; @@ -469,7 +469,7 @@ float AICreatureController::realAlter(float time) CreatureObject * const creatureOwner = getCreature(); #ifdef _DEBUG - AiDebugString * aiDebugString = NULL; + AiDebugString * aiDebugString = nullptr; if (!creatureOwner->getObservers().empty()) { aiDebugString = new AiDebugString; @@ -508,7 +508,7 @@ float AICreatureController::realAlter(float time) if (!creatureOwner->isInWorld() || getHibernate()) { #ifdef _DEBUG - if (aiDebugString != NULL) + if (aiDebugString != nullptr) { sendDebugAiToClients(*aiDebugString); delete aiDebugString; @@ -522,8 +522,8 @@ float AICreatureController::realAlter(float time) // check floating { CollisionProperty const * const collision = creatureOwner->getCollisionProperty(); - Footprint const * const foot = (collision != NULL) ? collision->getFootprint() : NULL; - bool floating = (foot != NULL) ? foot->isFloating() : false; + Footprint const * const foot = (collision != nullptr) ? collision->getFootprint() : nullptr; + bool floating = (foot != nullptr) ? foot->isFloating() : false; if (floating) { @@ -547,7 +547,7 @@ float AICreatureController::realAlter(float time) // Update our inPathfindingRegion flag whenever the behavior changes CityPathGraph const * graph = CityPathGraphManager::getCityGraphFor(creatureOwner); - m_inPathfindingRegion = (graph != NULL); + m_inPathfindingRegion = (graph != nullptr); applyMovementChange(); } @@ -589,10 +589,10 @@ float AICreatureController::realAlter(float time) bool resetHateTimer = false; CachedNetworkId const & hateTarget = creatureOwner->getHateTarget(); CreatureObject * const hateTargetCreatureObject = CreatureObject::asCreatureObject(hateTarget.getObject()); - CreatureController const * const hateTargetCreatureController = (hateTargetCreatureObject != NULL) ? CreatureController::asCreatureController(hateTargetCreatureObject->getController()) : NULL; + CreatureController const * const hateTargetCreatureController = (hateTargetCreatureObject != nullptr) ? CreatureController::asCreatureController(hateTargetCreatureObject->getController()) : nullptr; - if ( (hateTargetCreatureObject != NULL) - && (hateTargetCreatureController != NULL)) + if ( (hateTargetCreatureObject != nullptr) + && (hateTargetCreatureController != nullptr)) { float const hateTargetMovementSpeedSquared = hateTargetCreatureController->getCurrentVelocity().magnitudeSquared(); float const hateTargetWalkSpeedSquared = sqr(hateTargetCreatureObject->getWalkSpeed()); @@ -605,7 +605,7 @@ float AICreatureController::realAlter(float time) { Object * const combatStartLocationCell = NetworkIdManager::getObjectById(m_combatStartLocation.get().getCell()); Vector const & combatStartPosition_c = m_combatStartLocation.get().getCoordinates(); - Vector const & combatStartPosition_w = (combatStartLocationCell != NULL) ? combatStartLocationCell->rotateTranslate_o2w(combatStartPosition_c) : combatStartPosition_c; + Vector const & combatStartPosition_w = (combatStartLocationCell != nullptr) ? combatStartLocationCell->rotateTranslate_o2w(combatStartPosition_c) : combatStartPosition_c; float const distanceToCombatStartLocationSquared = creatureOwner->getPosition_w().magnitudeBetweenSquared(combatStartPosition_w); float const aggroRadius = getAggroRadius(); @@ -621,7 +621,7 @@ float AICreatureController::realAlter(float time) hateTargetCreatureObject->resetHateTimer(); } } - else if (hateTarget.getObject() != NULL) + else if (hateTarget.getObject() != nullptr) { // AI don't need to lose interest in stationary AI @@ -662,7 +662,7 @@ float AICreatureController::realAlter(float time) } #ifdef _DEBUG - if (aiDebugString != NULL) + if (aiDebugString != nullptr) { m_movement->addDebug(*aiDebugString); } @@ -697,7 +697,7 @@ float AICreatureController::realAlter(float time) updateMovementType(); #ifdef _DEBUG - if (aiDebugString != NULL) + if (aiDebugString != nullptr) { sendDebugAiToClients(*aiDebugString); delete aiDebugString; @@ -711,7 +711,7 @@ float AICreatureController::realAlter(float time) //---------------------------------------------------------------------- void AICreatureController::changeMovement(AiMovementBasePtr newMovement) { - LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::changeMovement() movement(%s)", (newMovement != AiMovementBaseNullPtr) ? AiMovementBase::getMovementString(newMovement->getType()) : "NULL")); + LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::changeMovement() movement(%s)", (newMovement != AiMovementBaseNullPtr) ? AiMovementBase::getMovementString(newMovement->getType()) : "nullptr")); if (getOwner()->isAuthoritative()) { @@ -876,11 +876,11 @@ void AICreatureController::loiter(CellProperty const * homeCell, Vector const & { if (isRetreating()) { - WARNING(true, ("AICreatureController::loiter() owner(%s) cell(%s) home(%.0f, %.0f, %.0f) distance[%.2f...%.2f] delay[%.0f...%.0f] Trying to loiter while retreating, failing request.", getDebugInformation().c_str(), ((homeCell != NULL) ? homeCell->getCellName() : "NULL"), home_p.x, home_p.y, home_p.z, minDistance, maxDistance, minDelay, maxDelay)); + WARNING(true, ("AICreatureController::loiter() owner(%s) cell(%s) home(%.0f, %.0f, %.0f) distance[%.2f...%.2f] delay[%.0f...%.0f] Trying to loiter while retreating, failing request.", getDebugInformation().c_str(), ((homeCell != nullptr) ? homeCell->getCellName() : "nullptr"), home_p.x, home_p.y, home_p.z, minDistance, maxDistance, minDelay, maxDelay)); return; } - LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::loiter() owner(%s) cell(%s) home(%.0f, %.0f, %.0f) distance[%.2f...%.2f] delay[%.0f...%.0f]", getDebugInformation().c_str(), ((homeCell != NULL) ? homeCell->getCellName() : "NULL"), home_p.x, home_p.y, home_p.z, minDistance, maxDistance, minDelay, maxDelay)); + LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::loiter() owner(%s) cell(%s) home(%.0f, %.0f, %.0f) distance[%.2f...%.2f] delay[%.0f...%.0f]", getDebugInformation().c_str(), ((homeCell != nullptr) ? homeCell->getCellName() : "nullptr"), home_p.x, home_p.y, home_p.z, minDistance, maxDistance, minDelay, maxDelay)); AiMovementBasePtr movement(new AiMovementLoiter(this, homeCell, home_p, minDistance, maxDistance, minDelay, maxDelay)); @@ -910,7 +910,7 @@ void AICreatureController::moveTo(CellProperty const * cell, Vector const & targ { if (isRetreating()) { - WARNING(true, ("AICreatureController::moveTo() owner(%s) cell(%s) position(%.0f, %.0f, %.0f) radius(%.2f) Trying to moveTo while retreating, failing request.", getDebugInformation().c_str(), ((cell != NULL) ? cell->getCellName() : "NULL"), target_p.x, target_p.y, target_p.z, radius)); + WARNING(true, ("AICreatureController::moveTo() owner(%s) cell(%s) position(%.0f, %.0f, %.0f) radius(%.2f) Trying to moveTo while retreating, failing request.", getDebugInformation().c_str(), ((cell != nullptr) ? cell->getCellName() : "nullptr"), target_p.x, target_p.y, target_p.z, radius)); return; } @@ -918,9 +918,9 @@ void AICreatureController::moveTo(CellProperty const * cell, Vector const & targ if (getMovementType() == AMT_move) { - AiMovementMove * const aiMovementMove = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementMove() : NULL; + AiMovementMove * const aiMovementMove = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementMove() : nullptr; - if (aiMovementMove != NULL) + if (aiMovementMove != nullptr) { AiLocation const & target = aiMovementMove->getTarget(); @@ -935,7 +935,7 @@ void AICreatureController::moveTo(CellProperty const * cell, Vector const & targ if (!duplicateMovement) { - LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::moveTo() owner(%s) cell(%s) position(%.0f, %.0f, %.0f) radius(%.2f)", getDebugInformation().c_str(), ((cell != NULL) ? cell->getCellName() : "NULL"), target_p.x, target_p.y, target_p.z, radius)); + LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::moveTo() owner(%s) cell(%s) position(%.0f, %.0f, %.0f) radius(%.2f)", getDebugInformation().c_str(), ((cell != nullptr) ? cell->getCellName() : "nullptr"), target_p.x, target_p.y, target_p.z, radius)); AiMovementBasePtr movement(new AiMovementMove(this, cell, target_p, radius)); @@ -957,9 +957,9 @@ void AICreatureController::moveTo(Unicode::String const & targetName) if (getMovementType() == AMT_move) { - AiMovementMove * const aiMovementMove = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementMove() : NULL; + AiMovementMove * const aiMovementMove = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementMove() : nullptr; - if (aiMovementMove != NULL) + if (aiMovementMove != nullptr) { if (aiMovementMove->getTargetName() == targetName) { @@ -992,8 +992,8 @@ void AICreatureController::patrol( std::vector const & locations, bool if (getMovementType() == AMT_patrol) { - AiMovementPatrol * const aiMovementPatrol = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementPatrol() : NULL; - if (aiMovementPatrol != NULL) + AiMovementPatrol * const aiMovementPatrol = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementPatrol() : nullptr; + if (aiMovementPatrol != nullptr) { // if () // { @@ -1026,8 +1026,8 @@ void AICreatureController::patrol( std::vector const & location if (getMovementType() == AMT_patrol) { - AiMovementPatrol * const aiMovementPatrol = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementPatrol() : NULL; - if (aiMovementPatrol != NULL) + AiMovementPatrol * const aiMovementPatrol = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementPatrol() : nullptr; + if (aiMovementPatrol != nullptr) { // if () // { @@ -1071,7 +1071,7 @@ bool AICreatureController::faceTo(CellProperty const * targetCell, Vector const { if (isRetreating()) { - WARNING(true, ("AICreatureController::faceTo() owner(%s) cell(%s) position(%.0f, %.0f, %.0f) Trying to faceTo while retreating, failing faceTo request.", getDebugInformation().c_str(), ((targetCell != NULL) ? targetCell->getCellName() : "NULL"), target_p.x, target_p.y, target_p.z)); + WARNING(true, ("AICreatureController::faceTo() owner(%s) cell(%s) position(%.0f, %.0f, %.0f) Trying to faceTo while retreating, failing faceTo request.", getDebugInformation().c_str(), ((targetCell != nullptr) ? targetCell->getCellName() : "nullptr"), target_p.x, target_p.y, target_p.z)); return false; } @@ -1079,9 +1079,9 @@ bool AICreatureController::faceTo(CellProperty const * targetCell, Vector const if (getMovementType() == AMT_face) { - AiMovementFace * const aiMovementFace = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementFace() : NULL; + AiMovementFace * const aiMovementFace = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementFace() : nullptr; - if (aiMovementFace != NULL) + if (aiMovementFace != nullptr) { AiLocation const & target = aiMovementFace->getTarget(); @@ -1095,7 +1095,7 @@ bool AICreatureController::faceTo(CellProperty const * targetCell, Vector const if (!duplicateMovement) { - LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::faceTo() owner(%s) cell(%s) position(%.0f, %.0f, %.0f)", getDebugInformation().c_str(), ((targetCell != NULL) ? targetCell->getCellName() : "NULL"), target_p.x, target_p.y, target_p.z)); + LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::faceTo() owner(%s) cell(%s) position(%.0f, %.0f, %.0f)", getDebugInformation().c_str(), ((targetCell != nullptr) ? targetCell->getCellName() : "nullptr"), target_p.x, target_p.y, target_p.z)); AiMovementBasePtr behavior(new AiMovementFace(this, targetCell, target_p)); @@ -1126,9 +1126,9 @@ bool AICreatureController::faceTo( NetworkId const & targetId ) if (getMovementType() == AMT_face) { - AiMovementFace * const aiMovementFace = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementFace() : NULL; + AiMovementFace * const aiMovementFace = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementFace() : nullptr; - if (aiMovementFace != NULL) + if (aiMovementFace != nullptr) { AiLocation const & target = aiMovementFace->getTarget(); @@ -1171,9 +1171,9 @@ bool AICreatureController::follow( NetworkId const & targetId, float minDistance if (getMovementType() == AMT_follow) { - AiMovementFollow * const aiMovementFollow = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementFollow() : NULL; + AiMovementFollow * const aiMovementFollow = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementFollow() : nullptr; - if (aiMovementFollow != NULL) + if (aiMovementFollow != nullptr) { AiLocation const & target = aiMovementFollow->getTarget(); @@ -1219,9 +1219,9 @@ bool AICreatureController::follow( NetworkId const & targetId, Vector const & of if (getMovementType() == AMT_follow) { - AiMovementFollow * const aiMovementFollow = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementFollow() : NULL; + AiMovementFollow * const aiMovementFollow = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementFollow() : nullptr; - if (aiMovementFollow != NULL) + if (aiMovementFollow != nullptr) { AiLocation const & offsetTarget = aiMovementFollow->getOffsetTarget(); @@ -1403,9 +1403,9 @@ void AICreatureController::moveCreature( CellProperty const * newCell, Vector co CellProperty * currentCell = getOwner()->getParentCell(); - CellObject * newCellObject = NULL; + CellObject * newCellObject = nullptr; - if( (newCell != NULL) && (newCell != CellProperty::getWorldCellProperty()) ) + if( (newCell != nullptr) && (newCell != CellProperty::getWorldCellProperty()) ) { newCellObject = const_cast(safe_cast(&newCell->getOwner())); } @@ -1422,12 +1422,12 @@ void AICreatureController::moveCreature( CellProperty const * newCell, Vector co CellProperty const * destCell = getCreatureCell()->getDestinationCell(oldPosition+offset,newPosition+offset,dummy); - if((destCell != NULL) && (destCell != newCell)) + if((destCell != nullptr) && (destCell != newCell)) { newPosition = CollisionUtils::transformToCell(newCell,newPosition,destCell); newCell = destCell; - newCellObject = NULL; + newCellObject = nullptr; if(newCell != CellProperty::getWorldCellProperty()) { @@ -1820,15 +1820,15 @@ AICreatureController * AICreatureController::getAiCreatureController(NetworkId c { Object * const object = NetworkIdManager::getObjectById(networkId); - return (object != NULL) ? AICreatureController::asAiCreatureController(object->getController()) : NULL; + return (object != nullptr) ? AICreatureController::asAiCreatureController(object->getController()) : nullptr; } // ---------------------------------------------------------------------- AICreatureController * AICreatureController::asAiCreatureController(Controller * controller) { - CreatureController * const creatureController = (controller != NULL) ? controller->asCreatureController() : NULL; - AICreatureController * const aiCreatureController = (creatureController != NULL) ? creatureController->asAiCreatureController() : NULL; + CreatureController * const creatureController = (controller != nullptr) ? controller->asCreatureController() : nullptr; + AICreatureController * const aiCreatureController = (creatureController != nullptr) ? creatureController->asAiCreatureController() : nullptr; return aiCreatureController; } @@ -1837,8 +1837,8 @@ AICreatureController * AICreatureController::asAiCreatureController(Controller * AICreatureController const * AICreatureController::asAiCreatureController(Controller const * controller) { - CreatureController const * const creatureController = (controller != NULL) ? controller->asCreatureController() : NULL; - AICreatureController const * const aiCreatureController = (creatureController != NULL) ? creatureController->asAiCreatureController() : NULL; + CreatureController const * const creatureController = (controller != nullptr) ? controller->asCreatureController() : nullptr; + AICreatureController const * const aiCreatureController = (creatureController != nullptr) ? creatureController->asAiCreatureController() : nullptr; return aiCreatureController; } @@ -1880,7 +1880,7 @@ float AICreatureController::getRespectRadius(NetworkId const & target) const CreatureObject const * respectCreatureObject = CreatureObject::getCreatureObject(target); - if (respectCreatureObject != NULL) + if (respectCreatureObject != nullptr) { // If the target has a master, then use the master's level for the respect calculation @@ -1893,7 +1893,7 @@ float AICreatureController::getRespectRadius(NetworkId const & target) const // Respect is only towards players - if ( (respectCreatureObject != NULL) + if ( (respectCreatureObject != nullptr) && respectCreatureObject->isPlayerControlled()) { CreatureObject const * const creatureOwner = getCreature(); @@ -1906,7 +1906,7 @@ float AICreatureController::getRespectRadius(NetworkId const & target) const } else { - WARNING(true, ("AICreatureController::getRespectRadius() owner(%s) master(%s) The owner has a master who is not a player. Why does this happen?", getDebugInformation().c_str(), (respectCreatureObject != NULL) ? respectCreatureObject->getDebugInformation().c_str() : masterId.getValueString().c_str())); + WARNING(true, ("AICreatureController::getRespectRadius() owner(%s) master(%s) The owner has a master who is not a player. Why does this happen?", getDebugInformation().c_str(), (respectCreatureObject != nullptr) ? respectCreatureObject->getDebugInformation().c_str() : masterId.getValueString().c_str())); } } @@ -1942,7 +1942,7 @@ void AICreatureController::sendDebugAiToClients(AiDebugString & aiDebugString) // Display the name and level { - aiDebugString.addText(fs.sprintf("%d %s\n", creatureOwner->getLevel(), (getCreatureName().isEmpty() ? "NULL" : getCreatureName().getString())), PackedRgb::solidWhite); + aiDebugString.addText(fs.sprintf("%d %s\n", creatureOwner->getLevel(), (getCreatureName().isEmpty() ? "nullptr" : getCreatureName().getString())), PackedRgb::solidWhite); } // Display the look at target @@ -1990,7 +1990,7 @@ void AICreatureController::sendDebugAiToClients(AiDebugString & aiDebugString) { Floor const * const floor = CollisionWorld::getFloorStandingOn(*creatureOwner); - aiDebugString.addText(fs.sprintf("floor (%s)\n", (floor == NULL) ? "none" : floor->getId().getValueString().c_str()), PackedRgb::solidWhite); + aiDebugString.addText(fs.sprintf("floor (%s)\n", (floor == nullptr) ? "none" : floor->getId().getValueString().c_str()), PackedRgb::solidWhite); } // Display the AI movement speed @@ -2008,15 +2008,15 @@ void AICreatureController::sendDebugAiToClients(AiDebugString & aiDebugString) // Primary Weapon { ServerObject const * const primaryServerObject = ServerObject::getServerObject(getPrimaryWeapon()); - WeaponObject const * const primaryWeaponObject = (primaryServerObject != NULL) ? primaryServerObject->asWeaponObject() : NULL; + WeaponObject const * const primaryWeaponObject = (primaryServerObject != nullptr) ? primaryServerObject->asWeaponObject() : nullptr; - if (primaryWeaponObject != NULL) + if (primaryWeaponObject != nullptr) { aiDebugString.addText(fs.sprintf("%s pri(%s) [%.0f...%.0f] sp(%s)\n", (usingPrimaryWeapon() ? "->" : ""), FileNameUtils::get(primaryWeaponObject->getObjectTemplateName(), FileNameUtils::fileName).c_str(), primaryWeaponObject->getMinRange(), primaryWeaponObject->getMaxRange(), m_aiCreatureData->m_primarySpecials.isEmpty() ? "none" : m_aiCreatureData->m_primarySpecials.getString()), PackedRgb::solidWhite); } else { - aiDebugString.addText(fs.sprintf("pri(NULL:ERROR)\n"), PackedRgb::solidWhite); + aiDebugString.addText(fs.sprintf("pri(nullptr:ERROR)\n"), PackedRgb::solidWhite); } //if (usingPrimaryWeapon()) @@ -2040,9 +2040,9 @@ void AICreatureController::sendDebugAiToClients(AiDebugString & aiDebugString) // Secondary Weapon { ServerObject const * const secondaryServerObject = ServerObject::getServerObject(getSecondaryWeapon()); - WeaponObject const * const secondaryWeaponObject = (secondaryServerObject != NULL) ? secondaryServerObject->asWeaponObject() : NULL; + WeaponObject const * const secondaryWeaponObject = (secondaryServerObject != nullptr) ? secondaryServerObject->asWeaponObject() : nullptr; - if (secondaryWeaponObject != NULL) + if (secondaryWeaponObject != nullptr) { aiDebugString.addText(fs.sprintf("%s sec (%s) [%.0f...%.0f] sp(%s)\n", (usingSecondaryWeapon() ? "->" : ""), FileNameUtils::get(secondaryWeaponObject->getObjectTemplateName(), FileNameUtils::fileName).c_str(), secondaryWeaponObject->getMinRange(), secondaryWeaponObject->getMaxRange(), m_aiCreatureData->m_secondarySpecials.isEmpty() ? "none" : m_aiCreatureData->m_secondarySpecials.getString()), PackedRgb::solidWhite); } @@ -2113,13 +2113,13 @@ void AICreatureController::sendDebugAiToClients(AiDebugString & aiDebugString) TangibleObject const * const hateTargetTangibleObject = TangibleObject::asTangibleObject(hateTarget.getObject()); float const hate = iterHateList->second; std::string hateTargetName; - if (hateTargetTangibleObject != NULL) + if (hateTargetTangibleObject != nullptr) { hateTargetName = Unicode::wideToNarrow(hateTargetTangibleObject->getEncodedObjectName()).c_str(); } else { - hateTargetName = "NULL"; + hateTargetName = "nullptr"; } aiDebugString.addText(fs.sprintf("%s:%s(%.1f)\n", hateTargetName.c_str(), hateTarget.getValueString().c_str(), hate), (iterHateList == hateList.begin()) ? PackedRgb::solidGreen : PackedRgb::solidRed); @@ -2174,7 +2174,7 @@ void AICreatureController::sendDebugAiToClients(AiDebugString & aiDebugString) // Only send to the client if the objvar is set int temp = 0; - if ( (characterObject != NULL) + if ( (characterObject != nullptr) && characterObject->getObjVars().getItem("ai_debug_string", temp)) { if (temp > 0) @@ -2196,7 +2196,7 @@ void AICreatureController::setHomeLocation(Location const & location) { if (getOwner()->isAuthoritative()) { - LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::setHomeLocation() owner(%s) sceneId(%u:%s) cell(%s) coordinates(%.2f, %.2f, %.2f)", getDebugInformation().c_str(), location.getSceneIdCrc(), (location.getSceneId() != NULL) ? location.getSceneId() : "NULL", location.getCell().getValueString().c_str(), location.getCoordinates().x, location.getCoordinates().y, location.getCoordinates().z)); + LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::setHomeLocation() owner(%s) sceneId(%u:%s) cell(%s) coordinates(%.2f, %.2f, %.2f)", getDebugInformation().c_str(), location.getSceneIdCrc(), (location.getSceneId() != nullptr) ? location.getSceneId() : "nullptr", location.getCell().getValueString().c_str(), location.getCoordinates().x, location.getCoordinates().y, location.getCoordinates().z)); m_homeLocation = location; } @@ -2221,7 +2221,7 @@ void AICreatureController::markCombatStartLocation() { m_combatStartLocation = getLocation(*creatureOwner); - LOGC(AiLogManager::isLogging(creatureOwner->getNetworkId()), "debug_ai", ("AICreatureController::markCombatStartLocation() owner(%s) sceneId(%u:%s) cell(%s) coordinates(%.2f, %.2f, %.2f)", getDebugInformation().c_str(), m_combatStartLocation.get().getSceneIdCrc(), (m_combatStartLocation.get().getSceneId() != NULL) ? m_combatStartLocation.get().getSceneId() : "NULL", m_combatStartLocation.get().getCell().getValueString().c_str(), m_combatStartLocation.get().getCoordinates().x, m_combatStartLocation.get().getCoordinates().y, m_combatStartLocation.get().getCoordinates().z)); + LOGC(AiLogManager::isLogging(creatureOwner->getNetworkId()), "debug_ai", ("AICreatureController::markCombatStartLocation() owner(%s) sceneId(%u:%s) cell(%s) coordinates(%.2f, %.2f, %.2f)", getDebugInformation().c_str(), m_combatStartLocation.get().getSceneIdCrc(), (m_combatStartLocation.get().getSceneId() != nullptr) ? m_combatStartLocation.get().getSceneId() : "nullptr", m_combatStartLocation.get().getCell().getValueString().c_str(), m_combatStartLocation.get().getCoordinates().x, m_combatStartLocation.get().getCoordinates().y, m_combatStartLocation.get().getCoordinates().z)); m_primaryWeaponActions.reset(); m_secondaryWeaponActions.reset(); @@ -2279,14 +2279,14 @@ void AICreatureController::onCreatureNameChanged(std::string const & creatureNam AiCreatureCombatProfile const * const primaryWeaponCombatProfile = AiCreatureCombatProfile::getCombatProfile(m_aiCreatureData->m_primarySpecials); - if (primaryWeaponCombatProfile != NULL) + if (primaryWeaponCombatProfile != nullptr) { m_primaryWeaponActions.setCombatProfile(*creatureOwner, *primaryWeaponCombatProfile); } AiCreatureCombatProfile const * const secondaryWeaponCombatProfile = AiCreatureCombatProfile::getCombatProfile(m_aiCreatureData->m_secondarySpecials); - if (secondaryWeaponCombatProfile != NULL) + if (secondaryWeaponCombatProfile != nullptr) { m_secondaryWeaponActions.setCombatProfile(*creatureOwner, *secondaryWeaponCombatProfile); } @@ -2326,7 +2326,7 @@ void AICreatureController::destroyPrimaryWeapon() { WeaponObject * const primaryWeapon = WeaponObject::getWeaponObject(getPrimaryWeapon()); - if (primaryWeapon != NULL) + if (primaryWeapon != nullptr) { unEquipWeapons(); primaryWeapon->permanentlyDestroy(DeleteReasons::God); @@ -2361,7 +2361,7 @@ void AICreatureController::destroySecondaryWeapon() { WeaponObject * const secondaryWeapon = WeaponObject::getWeaponObject(getSecondaryWeapon()); - if (secondaryWeapon != NULL) + if (secondaryWeapon != nullptr) { unEquipWeapons(); secondaryWeapon->permanentlyDestroy(DeleteReasons::God); @@ -2372,7 +2372,7 @@ void AICreatureController::destroySecondaryWeapon() PersistentCrcString const & AICreatureController::getCreatureName() const { - if (m_aiCreatureData->m_name == NULL) + if (m_aiCreatureData->m_name == nullptr) { return *s_defaultCreatureName; } @@ -2401,7 +2401,7 @@ NetworkId AICreatureController::createWeapon(char const * const functionName, Cr CreatureObject * const creatureOwner = getCreature(); ServerObject * const inventory = creatureOwner->getInventory(); - if (inventory == NULL) + if (inventory == nullptr) { WARNING(true, ("AICreatureController::%s() Unable to find inventory for (%s) to place a weapon(%s)", functionName, getDebugInformation().c_str(), weaponName.getString())); } @@ -2440,7 +2440,7 @@ NetworkId AICreatureController::createWeapon(char const * const functionName, Cr bool const persisted = false; ServerObject * const newObject = ServerWorld::createNewObject(weaponCrcName.getCrc(), *inventory, persisted); - if (newObject != NULL) + if (newObject != nullptr) { result = newObject->getNetworkId(); } @@ -2464,7 +2464,7 @@ NetworkId AICreatureController::getUnarmedWeapon() CreatureObject * const creatureOwner = getCreature(); WeaponObject * const defaultWeapon = creatureOwner->getDefaultWeapon(); - if (defaultWeapon != NULL) + if (defaultWeapon != nullptr) { result = defaultWeapon->getNetworkId(); } @@ -2492,9 +2492,9 @@ void AICreatureController::equipPrimaryWeapon() if (!usingPrimaryWeapon()) { ServerObject * const primaryWeaponServerObject = ServerObject::getServerObject(getPrimaryWeapon()); - WeaponObject * const primaryWeaponObject = (primaryWeaponServerObject != NULL) ? primaryWeaponServerObject->asWeaponObject() : NULL; + WeaponObject * const primaryWeaponObject = (primaryWeaponServerObject != nullptr) ? primaryWeaponServerObject->asWeaponObject() : nullptr; - if (primaryWeaponObject != NULL) + if (primaryWeaponObject != nullptr) { unEquipWeapons(); @@ -2508,7 +2508,7 @@ void AICreatureController::equipPrimaryWeapon() { Container::ContainerErrorCode errorCode; - if (ContainerInterface::transferItemToGeneralContainer(*creatureOwner, *primaryWeaponServerObject, NULL, errorCode)) + if (ContainerInterface::transferItemToGeneralContainer(*creatureOwner, *primaryWeaponServerObject, nullptr, errorCode)) { LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::equipPrimaryWeapon() owner(%s) primaryWeapon(%s)\n", getDebugInformation().c_str(), primaryWeaponServerObject->getDebugInformation().c_str())); @@ -2516,7 +2516,7 @@ void AICreatureController::equipPrimaryWeapon() GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(creatureOwner); - if (gameScriptObject != NULL) + if (gameScriptObject != nullptr) { ScriptParams scriptParams; scriptParams.addParam(primaryWeaponObject->getNetworkId()); @@ -2557,9 +2557,9 @@ void AICreatureController::equipSecondaryWeapon() if (!usingSecondaryWeapon()) { ServerObject * const secondaryWeaponServerObject = ServerObject::getServerObject(getSecondaryWeapon()); - WeaponObject * const secondaryWeaponObject = (secondaryWeaponServerObject != NULL) ? secondaryWeaponServerObject->asWeaponObject() : NULL; + WeaponObject * const secondaryWeaponObject = (secondaryWeaponServerObject != nullptr) ? secondaryWeaponServerObject->asWeaponObject() : nullptr; - if (secondaryWeaponObject != NULL) + if (secondaryWeaponObject != nullptr) { unEquipWeapons(); @@ -2573,7 +2573,7 @@ void AICreatureController::equipSecondaryWeapon() { Container::ContainerErrorCode errorCode; - if (ContainerInterface::transferItemToGeneralContainer(*creatureOwner, *secondaryWeaponServerObject, NULL, errorCode)) + if (ContainerInterface::transferItemToGeneralContainer(*creatureOwner, *secondaryWeaponServerObject, nullptr, errorCode)) { LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::equipSecondaryWeapon() owner(%s) secondaryWeapon(%s) errorCode(%d)\n", getDebugInformation().c_str(), secondaryWeaponServerObject->getDebugInformation().c_str())); @@ -2581,7 +2581,7 @@ void AICreatureController::equipSecondaryWeapon() GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(creatureOwner); - if (gameScriptObject != NULL) + if (gameScriptObject != nullptr) { ScriptParams scriptParams; scriptParams.addParam(secondaryWeaponObject->getNetworkId()); @@ -2631,7 +2631,7 @@ void AICreatureController::unEquipWeapons() { ServerObject * const inventory = creatureOwner->getInventory(); - if (inventory != NULL) + if (inventory != nullptr) { Container::ContainerErrorCode error; @@ -2648,13 +2648,13 @@ void AICreatureController::unEquipWeapons() // Equip the default weapon { - if (defaultWeapon != NULL) + if (defaultWeapon != nullptr) { creatureOwner->setCurrentWeapon(*defaultWeapon); } else { - WARNING(true, ("AICreatureController::unEquipWeapons() owner(%s) NULL default weapon", getDebugInformation().c_str())); + WARNING(true, ("AICreatureController::unEquipWeapons() owner(%s) nullptr default weapon", getDebugInformation().c_str())); } } } @@ -2690,7 +2690,7 @@ bool AICreatureController::usingPrimaryWeapon() { WeaponObject const * const currentWeaponObject = getCreature()->getCurrentWeapon(); - if (currentWeaponObject != NULL) + if (currentWeaponObject != nullptr) { result = (getPrimaryWeapon() == currentWeaponObject->getNetworkId()); } @@ -2708,7 +2708,7 @@ bool AICreatureController::usingSecondaryWeapon() { WeaponObject const * const currentWeaponObject = getCreature()->getCurrentWeapon(); - if (currentWeaponObject != NULL) + if (currentWeaponObject != nullptr) { result = (getSecondaryWeapon() == currentWeaponObject->getNetworkId()); } @@ -2815,7 +2815,7 @@ void AICreatureController::setRetreating(bool const retreating) { CellObject const * const cellObject = CellObject::getCellObject(cellId); - if (cellObject != NULL) + if (cellObject != nullptr) { CellProperty const * const cellProperty = cellObject->getCellProperty(); @@ -2965,7 +2965,7 @@ time_t AICreatureController::getKnockDownRecoveryTime() const { AiCreatureCombatProfile const * const combatProfile = AiCreatureCombatProfile::getCombatProfile(m_aiCreatureData->m_primarySpecials); - return (combatProfile != NULL) ? combatProfile->m_knockDownRecoveryTime : 0; + return (combatProfile != nullptr) ? combatProfile->m_knockDownRecoveryTime : 0; } //----------------------------------------------------------------------- std::string const AICreatureController::getCombatActionsString() @@ -2979,7 +2979,7 @@ std::string const AICreatureController::getCombatActionsString() { WeaponObject const * const primaryWeaponObject = WeaponObject::getWeaponObject(getPrimaryWeapon()); - if (primaryWeaponObject != NULL) + if (primaryWeaponObject != nullptr) { result += fs.sprintf("PRIMARY WEAPON >>> %s range[%.0f...%.0f] %s\n", FileNameUtils::get(primaryWeaponObject->getObjectTemplateName(), FileNameUtils::fileName).c_str(), primaryWeaponObject->getMinRange(), primaryWeaponObject->getMaxRange(), usingPrimaryWeapon() ? "(active)" : ""); } @@ -2989,7 +2989,7 @@ std::string const AICreatureController::getCombatActionsString() } AiCreatureCombatProfile const * const primaryWeaponCombatProfile = AiCreatureCombatProfile::getCombatProfile(m_aiCreatureData->m_primarySpecials); - if (primaryWeaponCombatProfile != NULL) + if (primaryWeaponCombatProfile != nullptr) { result += primaryWeaponCombatProfile->toString(); } @@ -3003,7 +3003,7 @@ std::string const AICreatureController::getCombatActionsString() { WeaponObject const * const secondaryWeaponObject = WeaponObject::getWeaponObject(getSecondaryWeapon()); - if (secondaryWeaponObject != NULL) + if (secondaryWeaponObject != nullptr) { result += fs.sprintf("SECONDARY WEAPON >>> %s range[%.0f...%.0f] %s\n", FileNameUtils::get(secondaryWeaponObject->getObjectTemplateName(), FileNameUtils::fileName).c_str(), secondaryWeaponObject->getMinRange(), secondaryWeaponObject->getMaxRange(), usingSecondaryWeapon() ? "(active)" : ""); } @@ -3014,7 +3014,7 @@ std::string const AICreatureController::getCombatActionsString() AiCreatureCombatProfile const * const secondaryWeaponCombatProfile = AiCreatureCombatProfile::getCombatProfile(m_aiCreatureData->m_secondarySpecials); - if (secondaryWeaponCombatProfile != NULL) + if (secondaryWeaponCombatProfile != nullptr) { result += secondaryWeaponCombatProfile->toString(); } diff --git a/engine/server/library/serverGame/src/shared/controller/AiShipController.cpp b/engine/server/library/serverGame/src/shared/controller/AiShipController.cpp index d2bf69f7..3fe9a88f 100755 --- a/engine/server/library/serverGame/src/shared/controller/AiShipController.cpp +++ b/engine/server/library/serverGame/src/shared/controller/AiShipController.cpp @@ -127,15 +127,15 @@ AiShipController * AiShipController::getAiShipController(NetworkId const & unit) { Object * const object = NetworkIdManager::getObjectById(unit); - return (object != NULL) ? AiShipController::asAiShipController(object->getController()) : NULL; + return (object != nullptr) ? AiShipController::asAiShipController(object->getController()) : nullptr; } // ---------------------------------------------------------------------- AiShipController * AiShipController::asAiShipController(Controller * const controller) { - ShipController * const shipController = (controller != NULL) ? controller->asShipController() : NULL; - AiShipController * const aiShipController = (shipController != NULL) ? shipController->asAiShipController() : NULL; + ShipController * const shipController = (controller != nullptr) ? controller->asShipController() : nullptr; + AiShipController * const aiShipController = (shipController != nullptr) ? shipController->asAiShipController() : nullptr; return aiShipController; } @@ -144,8 +144,8 @@ AiShipController * AiShipController::asAiShipController(Controller * const contr AiShipController const * AiShipController::asAiShipController(Controller const * const controller) { - ShipController const * const shipController = (controller != NULL) ? controller->asShipController() : NULL; - AiShipController const * const aiShipController = (shipController != NULL) ? shipController->asAiShipController() : NULL; + ShipController const * const shipController = (controller != nullptr) ? controller->asShipController() : nullptr; + AiShipController const * const aiShipController = (shipController != nullptr) ? shipController->asAiShipController() : nullptr; return aiShipController; } @@ -155,18 +155,18 @@ AiShipController const * AiShipController::asAiShipController(Controller const * AiShipController::AiShipController(ShipObject * const owner) : ShipController(owner), m_pilotData(&AiShipPilotData::getDefaultPilotData()), - m_pendingNonAttackBehavior(NULL), - m_nonAttackBehavior(NULL), - m_pendingAttackBehavior(NULL), - m_attackBehavior(NULL), + m_pendingNonAttackBehavior(nullptr), + m_nonAttackBehavior(nullptr), + m_pendingAttackBehavior(nullptr), + m_attackBehavior(nullptr), m_shipName(), m_shipClass(ShipAiReactionManager::SC_invalid), m_requestedSlowDown(false), - m_squad(NULL), - m_attackSquad(NULL), + m_squad(nullptr), + m_attackSquad(nullptr), m_formationPosition_l(), m_attackFormationPosition_l(), - m_path(NULL), + m_path(nullptr), m_currentPathIndex(0), m_aggroRadius(200.0f), m_countermeasureState(CS_none), @@ -190,22 +190,22 @@ AiShipController::~AiShipController() // Remove this unit from its squad - if (m_squad != NULL) + if (m_squad != nullptr) { // The owner of the squad is SpaceSquadManager getSquad().removeUnit(getOwner()->getNetworkId()); - m_squad = NULL; + m_squad = nullptr; } // Remove this unit from its attack squad - if (m_attackSquad != NULL) + if (m_attackSquad != nullptr) { // The owner of the attack squad is SpaceSquad m_attackSquad->removeUnit(getOwner()->getNetworkId()); - m_attackSquad = NULL; + m_attackSquad = nullptr; } else { @@ -215,17 +215,17 @@ AiShipController::~AiShipController() // Remove path here. SpacePathManager::release(m_path, getOwner()); - m_path = NULL; - m_pilotData = NULL; + m_path = nullptr; + m_pilotData = nullptr; delete m_nonAttackBehavior; - m_nonAttackBehavior = NULL; + m_nonAttackBehavior = nullptr; delete m_pendingNonAttackBehavior; - m_pendingNonAttackBehavior = NULL; + m_pendingNonAttackBehavior = nullptr; delete m_pendingAttackBehavior; - m_pendingAttackBehavior = NULL; + m_pendingAttackBehavior = nullptr; delete m_attackBehavior; - m_attackBehavior = NULL; + m_attackBehavior = nullptr; delete m_reactToMissileTimer; delete m_pilotManagerInfo; delete m_exclusiveAggroSet; @@ -234,7 +234,7 @@ AiShipController::~AiShipController() // ---------------------------------------------------------------------- void AiShipController::endBaselines() { - DEBUG_FATAL((m_squad != NULL), ("m_squad should be NULL")); + DEBUG_FATAL((m_squad != nullptr), ("m_squad should be nullptr")); m_squad = SpaceSquadManager::createSquad(); getSquad().addUnit(getOwner()->getNetworkId()); @@ -252,7 +252,7 @@ float AiShipController::realAlter(float const elapsedTime) #ifdef _DEBUG - AiDebugString * aiDebugString = NULL; + AiDebugString * aiDebugString = nullptr; if ( s_spaceAiClientDebugEnabled && !getShipOwner()->getObservers().empty()) { @@ -263,25 +263,25 @@ float AiShipController::realAlter(float const elapsedTime) // We have to have a pending behavior because while in a behavior a trigger can get called which can then kill that behavior, so we have to wait until the next frame to switch behaviors so they don't stomp each other from triggers. - if (m_pendingNonAttackBehavior != NULL) + if (m_pendingNonAttackBehavior != nullptr) { delete m_nonAttackBehavior; m_nonAttackBehavior = m_pendingNonAttackBehavior; - m_pendingNonAttackBehavior = NULL; + m_pendingNonAttackBehavior = nullptr; } - if (m_pendingDockingBehavior != NULL) + if (m_pendingDockingBehavior != nullptr) { delete m_dockingBehavior; m_dockingBehavior = m_pendingDockingBehavior; - m_pendingDockingBehavior = NULL; + m_pendingDockingBehavior = nullptr; } - if ( (m_dockingBehavior != NULL) + if ( (m_dockingBehavior != nullptr) && (m_dockingBehavior->isDockFinished())) { delete m_dockingBehavior; - m_dockingBehavior = NULL; + m_dockingBehavior = nullptr; } m_yawPosition = 0.f; @@ -292,7 +292,7 @@ float AiShipController::realAlter(float const elapsedTime) ShipObject * const shipOwner = NON_NULL(getShipOwner()); PROFILER_AUTO_BLOCK_DEFINE("behaviors"); - if (m_attackBehavior != NULL) // This was added for ships that are contructed for AI but not fully contructed proper using the space_mobile.tab + if (m_attackBehavior != nullptr) // This was added for ships that are contructed for AI but not fully contructed proper using the space_mobile.tab { if (isAttacking()) // Capital ships never go into attack mode as such, always follow their non-attacking behavior (although they may fire turrets as they go) { @@ -314,7 +314,7 @@ float AiShipController::realAlter(float const elapsedTime) shipOwner->openWings(); } - if (m_dockingBehavior != NULL) + if (m_dockingBehavior != nullptr) { m_dockingBehavior->unDock(); } @@ -325,7 +325,7 @@ float AiShipController::realAlter(float const elapsedTime) m_attackBehavior->alter(elapsedTime); #ifdef _DEBUG - if (aiDebugString != NULL) + if (aiDebugString != nullptr) { m_attackBehavior->addDebug(*aiDebugString); } @@ -337,9 +337,9 @@ float AiShipController::realAlter(float const elapsedTime) Object * const leaderObject = getAttackSquad().getLeader().getObject(); ShipController * const leaderShipController = leaderObject->getController()->asShipController(); - AiShipController * const leaderAiShipController = (leaderShipController != NULL) ? leaderShipController->asAiShipController() : NULL; + AiShipController * const leaderAiShipController = (leaderShipController != nullptr) ? leaderShipController->asAiShipController() : nullptr; - if (leaderAiShipController != NULL) + if (leaderAiShipController != nullptr) { Transform transform(leaderObject->getTransform_o2w()); transform.setPosition_p(leaderAiShipController->getMoveToGoalPosition_w()); @@ -361,7 +361,7 @@ float AiShipController::realAlter(float const elapsedTime) { delete m_attackBehavior; m_attackBehavior = m_pendingAttackBehavior; - m_pendingAttackBehavior = NULL; + m_pendingAttackBehavior = nullptr; } } else if (isBeingDocked()) @@ -370,18 +370,18 @@ float AiShipController::realAlter(float const elapsedTime) setThrottle(0.0f); } - else if (m_dockingBehavior != NULL) + else if (m_dockingBehavior != nullptr) { m_dockingBehavior->alter(elapsedTime); #ifdef _DEBUG - if (aiDebugString != NULL) + if (aiDebugString != nullptr) { m_dockingBehavior->addDebug(*aiDebugString); } #endif // _DEBUG } - else if (m_nonAttackBehavior != NULL) + else if (m_nonAttackBehavior != nullptr) { PROFILER_AUTO_BLOCK_DEFINE("non-attack behaviors"); @@ -413,7 +413,7 @@ float AiShipController::realAlter(float const elapsedTime) m_nonAttackBehavior->alter(elapsedTime); #ifdef _DEBUG - if (aiDebugString != NULL) + if (aiDebugString != nullptr) { m_nonAttackBehavior->addDebug(*aiDebugString); } @@ -425,7 +425,7 @@ float AiShipController::realAlter(float const elapsedTime) Object * const squadLeader = getSquad().getLeader().getObject(); - if (squadLeader != NULL) + if (squadLeader != nullptr) { Vector goalPosition_w(Formation::getPosition_w(squadLeader->getTransform_o2w(), getFormationPosition_l())); @@ -434,9 +434,9 @@ float AiShipController::realAlter(float const elapsedTime) if (getOwner()->getPosition_w().magnitudeBetweenSquared(goalPosition_w) > sqr(getLargestTurnRadius() * s_slowDownTurnRadiusGain)) { ShipController * const followedUnitShipController = squadLeader->getController()->asShipController(); - AiShipController * const followedUnitAiShipController = (followedUnitShipController != NULL) ? followedUnitShipController->asAiShipController() : NULL; + AiShipController * const followedUnitAiShipController = (followedUnitShipController != nullptr) ? followedUnitShipController->asAiShipController() : nullptr; - if (followedUnitAiShipController != NULL) + if (followedUnitAiShipController != nullptr) { followedUnitAiShipController->requestSlowDown(); } @@ -462,7 +462,7 @@ float AiShipController::realAlter(float const elapsedTime) } #ifdef _DEBUG - if (aiDebugString != NULL) + if (aiDebugString != nullptr) { m_nonAttackBehavior->addDebug(*aiDebugString); } @@ -476,7 +476,7 @@ float AiShipController::realAlter(float const elapsedTime) } else { - DEBUG_WARNING(true, ("debug_ai: There should never be a NULL non-attacking behavior %s", getOwner()->getDebugInformation().c_str())); + DEBUG_WARNING(true, ("debug_ai: There should never be a nullptr non-attacking behavior %s", getOwner()->getDebugInformation().c_str())); } } @@ -551,8 +551,8 @@ float AiShipController::realAlter(float const elapsedTime) } #ifdef _DEBUG - if ( (m_attackBehavior != NULL) - && (aiDebugString != NULL)) + if ( (m_attackBehavior != nullptr) + && (aiDebugString != nullptr)) { PROFILER_AUTO_BLOCK_DEFINE("sendDebugAiToClients"); sendDebugAiToClients(*aiDebugString); @@ -574,7 +574,7 @@ void AiShipController::moveTo(Vector const & position_w, float const throttle, f // If we are not following a unit, see if we need to slow down for someone - if ( (m_nonAttackBehavior != NULL) + if ( (m_nonAttackBehavior != nullptr) && (m_nonAttackBehavior->getBehaviorType() != ASBT_follow) && m_requestedSlowDown && !isAttacking()) @@ -645,16 +645,16 @@ bool AiShipController::addDamageTaken(NetworkId const & attackingUnit, float con { ShipObject const * const attackingShipObject = ShipObject::asShipObject(NetworkIdManager::getObjectById(attackingUnit)); - if (attackingShipObject != NULL) + if (attackingShipObject != nullptr) { CreatureObject const * const attackingPilotCreatureObject = attackingShipObject->getPilot(); - if ( (attackingPilotCreatureObject != NULL) + if ( (attackingPilotCreatureObject != nullptr) && attackingPilotCreatureObject->isPlayerControlled()) { GroupObject * const groupObject = attackingPilotCreatureObject->getGroup(); - if (groupObject != NULL) + if (groupObject != nullptr) { GroupObject::GroupMemberVector const & groupMembers = groupObject->getGroupMembers(); GroupObject::GroupMemberVector::const_iterator iterGroupMembers = groupMembers.begin(); @@ -665,11 +665,11 @@ bool AiShipController::addDamageTaken(NetworkId const & attackingUnit, float con NetworkId const & groupMemberPilotNetworkId = groupMember.first; CreatureObject const * const groupMemberPilotCreatureObject = CreatureObject::asCreatureObject(NetworkIdManager::getObjectById(groupMemberPilotNetworkId)); - if (groupMemberPilotCreatureObject != NULL) + if (groupMemberPilotCreatureObject != nullptr) { ShipObject const * const groupMemberShipObject = groupMemberPilotCreatureObject->getPilotedShip(); - if (groupMemberShipObject != NULL) + if (groupMemberShipObject != nullptr) { if (groupMemberShipObject != attackingShipObject) { @@ -749,24 +749,24 @@ void AiShipController::follow(NetworkId const & followedUnit, Vector const & dir LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipController::follow() owner(%s) followedUnit(%s) direction_o(%.1f, %.1f, %.1f) offset(%.1f)", getOwner()->getNetworkId().getValueString().c_str(), followedUnit.getValueString().c_str(), direction_l.x, direction_l.y, direction_l.z, distance)); SpacePathManager::release(m_path, getOwner()); - m_path = NULL; + m_path = nullptr; float appearanceRadius = 0.0f; Object const * const followedObject = NetworkIdManager::getObjectById(followedUnit); - if (followedObject != NULL) + if (followedObject != nullptr) { //-- This needs to be improved to cast a ray from this position back towards the ship and get the actual collision position CollisionProperty const * const ownerCollisionProperty = getOwner()->getCollisionProperty(); CollisionProperty const * const followedObjectCollisionProperty = followedObject->getCollisionProperty(); - if (ownerCollisionProperty != NULL) + if (ownerCollisionProperty != nullptr) { appearanceRadius += ownerCollisionProperty->getBoundingSphere_l().getRadius(); } - if (followedObjectCollisionProperty != NULL) + if (followedObjectCollisionProperty != nullptr) { appearanceRadius += followedObjectCollisionProperty ->getBoundingSphere_l().getRadius(); } @@ -786,7 +786,7 @@ int AiShipController::getBehaviorType() const { AiShipBehaviorType result = ASBT_idle; - if (m_nonAttackBehavior != NULL) + if (m_nonAttackBehavior != nullptr) { result = m_nonAttackBehavior->getBehaviorType(); } @@ -803,7 +803,7 @@ void AiShipController::idle() LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipController::idle() owner(%s)", getOwner()->getNetworkId().getValueString().c_str())); SpacePathManager::release(m_path, getOwner()); - m_path = NULL; + m_path = nullptr; delete m_pendingNonAttackBehavior; m_pendingNonAttackBehavior = new AiShipBehaviorIdle(*this);; @@ -818,7 +818,7 @@ void AiShipController::track(Object const & target) LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipController::track() owner(%s) target(%s)", getOwner()->getNetworkId().getValueString().c_str(), target.getNetworkId().getValueString().c_str())); SpacePathManager::release(m_path, getOwner()); - m_path = NULL; + m_path = nullptr; delete m_pendingNonAttackBehavior; m_pendingNonAttackBehavior = new AiShipBehaviorTrack(*this, target); @@ -871,7 +871,7 @@ void AiShipController::clearPatrolPath() { LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipController::clearPatrolPath() owner(%s)", getOwner()->getNetworkId().getValueString().c_str())); - if (m_path != NULL) + if (m_path != nullptr) { m_path->clear(); } @@ -896,15 +896,15 @@ void AiShipController::triggerBehaviorChanged(AiShipBehaviorType const newBehavi { // Only send the trigger if the new behavior is different from the old behavior - AiShipBehaviorType const oldBehavior = (m_nonAttackBehavior != NULL) ? m_nonAttackBehavior->getBehaviorType() : ASBT_idle; + AiShipBehaviorType const oldBehavior = (m_nonAttackBehavior != nullptr) ? m_nonAttackBehavior->getBehaviorType() : ASBT_idle; if (oldBehavior != newBehavior) { Object * const object = getOwner(); - ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; - GameScriptObject * const gameScriptObject = (serverObject != NULL) ? serverObject->getScriptObject() : NULL; + ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; + GameScriptObject * const gameScriptObject = (serverObject != nullptr) ? serverObject->getScriptObject() : nullptr; - if (gameScriptObject != NULL) + if (gameScriptObject != nullptr) { LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipController::triggerBehaviorChanged() unit(%s) old(%s) new(%s)", getOwner()->getNetworkId().getValueString().c_str(), AiShipBehaviorBase::getBehaviorString(oldBehavior), AiShipBehaviorBase::getBehaviorString(newBehavior))); @@ -925,10 +925,10 @@ void AiShipController::triggerBehaviorChanged(AiShipBehaviorType const newBehavi void AiShipController::triggerEnterCombat(NetworkId const & attackTarget) { Object * const object = getOwner(); - ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; - GameScriptObject * const gameScriptObject = (serverObject != NULL) ? serverObject->getScriptObject() : NULL; + ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; + GameScriptObject * const gameScriptObject = (serverObject != nullptr) ? serverObject->getScriptObject() : nullptr; - if (gameScriptObject != NULL) + if (gameScriptObject != nullptr) { LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipController::triggerEnterCombat() unit(%s) attackTarget(%s)", getOwner()->getNetworkId().getValueString().c_str(), attackTarget.getValueString().c_str())); @@ -968,7 +968,7 @@ void AiShipController::setPilotType(std::string const & pilotType) AiPilotManager::getPilotData(*m_pilotData, *m_pilotManagerInfo); // Make sure the ship name is set - if (shipObject != NULL) + if (shipObject != nullptr) { std::string shipName; @@ -986,7 +986,7 @@ void AiShipController::setPilotType(std::string const & pilotType) // Create the attack behavior based on the ship class delete m_attackBehavior; - m_attackBehavior = NULL; + m_attackBehavior = nullptr; m_shipClass = ShipAiReactionManager::getShipClass(m_shipName); @@ -1009,7 +1009,7 @@ void AiShipController::setPilotType(std::string const & pilotType) setAggroRadius(m_pilotData->m_aggroRadius); - FATAL((m_attackBehavior == NULL), ("The attack behavior can not be NULL.")); + FATAL((m_attackBehavior == nullptr), ("The attack behavior can not be nullptr.")); } // ---------------------------------------------------------------------- @@ -1029,8 +1029,8 @@ CachedNetworkId const & AiShipController::getPrimaryAttackTarget() const ShipObject const * AiShipController::getPrimaryAttackTargetShipObject() const { Object const * const targetObject = getPrimaryAttackTarget().getObject(); - ServerObject const * const targetServerObject = (targetObject != NULL) ? targetObject->asServerObject() : NULL; - ShipObject const * const targetShipObject = (targetServerObject != NULL) ? targetServerObject->asShipObject() : NULL; + ServerObject const * const targetServerObject = (targetObject != nullptr) ? targetObject->asServerObject() : nullptr; + ShipObject const * const targetShipObject = (targetServerObject != nullptr) ? targetServerObject->asShipObject() : nullptr; return targetShipObject; } @@ -1097,7 +1097,7 @@ void AiShipController::setSquad(SpaceSquad * const squad) { // Remove the unit from its previous squad - if ( (m_squad != NULL) + if ( (m_squad != nullptr) && !m_squad->isEmpty()) { m_squad->removeUnit(getOwner()->getNetworkId()); @@ -1170,7 +1170,7 @@ void AiShipController::setAttackSquad(SpaceAttackSquad * const attackSquad) { // Remove the unit from its pervious attack squad - if (m_attackSquad != NULL) + if (m_attackSquad != nullptr) { m_attackSquad->removeUnit(getOwner()->getNetworkId()); } @@ -1210,7 +1210,7 @@ float AiShipController::getShipRadius() const ShipObject const * const shipObject = getShipOwner(); CollisionProperty const * const shipCollision = shipObject->getCollisionProperty(); - if (shipCollision != NULL) + if (shipCollision != nullptr) { result = shipCollision->getBoundingSphere_l().getRadius(); } @@ -1288,9 +1288,9 @@ bool AiShipController::shouldCheckForEnemies() const void AiShipController::setCurrentPathIndex(unsigned int const index) { - //LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipController::setCurrentPathIndex() unit(%s) pathIndex(%u) pathSize(%u)", getOwner()->getNetworkId().getValueString().c_str(), index, (m_path != NULL) ? m_path->getTransformList().size() : 0)); + //LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipController::setCurrentPathIndex() unit(%s) pathIndex(%u) pathSize(%u)", getOwner()->getNetworkId().getValueString().c_str(), index, (m_path != nullptr) ? m_path->getTransformList().size() : 0)); - if ( (m_path != NULL) + if ( (m_path != nullptr) && !m_path->isEmpty()) { m_currentPathIndex = index; @@ -1298,7 +1298,7 @@ void AiShipController::setCurrentPathIndex(unsigned int const index) else { m_currentPathIndex = 0; - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled() && (m_currentPathIndex > 0), "debug_ai", ("AiShipController::setCurrentPathIndex() Setting a non-zero path index(%d) on a NULL or empty path", index)); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled() && (m_currentPathIndex > 0), "debug_ai", ("AiShipController::setCurrentPathIndex() Setting a non-zero path index(%d) on a nullptr or empty path", index)); } } @@ -1317,7 +1317,7 @@ float AiShipController::calculateThrottleToPosition_w(Vector const & position_w, Object const * const object = getOwner(); - if (object != NULL) + if (object != nullptr) { float const distanceToGoalSquared = object->getPosition_w().magnitudeBetweenSquared(position_w); @@ -1420,7 +1420,7 @@ void AiShipController::switchToBomberAttack() bool AiShipController::removeAttackTarget(NetworkId const & unit) { LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipController::removeAttackTarget() owner(%s) unit(%s)", getOwner()->getNetworkId().getValueString().c_str(), unit.getValueString().c_str())); - DEBUG_WARNING((unit == NetworkId::cms_invalid), ("debug_ai: owner(%s) ERROR: Trying to remove a NULL unit(%s) from the attack target list.", getOwner()->getNetworkId().getValueString().c_str(), unit.getValueString().c_str())); + DEBUG_WARNING((unit == NetworkId::cms_invalid), ("debug_ai: owner(%s) ERROR: Trying to remove a nullptr unit(%s) from the attack target list.", getOwner()->getNetworkId().getValueString().c_str(), unit.getValueString().c_str())); return ShipController::removeAttackTarget(unit); } @@ -1637,7 +1637,7 @@ void AiShipController::sendDebugAiToClients(AiDebugString & aiDebugString) bool const checkForEnemies = shouldCheckForEnemies(); float const leashRadius = m_attackBehavior->getLeashRadius(); - aiDebugString.addText(formattedString.sprintf("%s agg(%.0f) lsh(%.0f) %s\n", AiShipController::getAttackOrdersString(getAttackOrders()), m_aggroRadius, leashRadius, (m_attackBehavior == NULL) ? " [NO ATTACK BEHAVIOR]" : (checkForEnemies ? " [LFE]" : ""))); + aiDebugString.addText(formattedString.sprintf("%s agg(%.0f) lsh(%.0f) %s\n", AiShipController::getAttackOrdersString(getAttackOrders()), m_aggroRadius, leashRadius, (m_attackBehavior == nullptr) ? " [NO ATTACK BEHAVIOR]" : (checkForEnemies ? " [LFE]" : ""))); } } @@ -1687,7 +1687,7 @@ void AiShipController::sendDebugAiToClients(AiDebugString & aiDebugString) // Only send to the client if the objvar is set int temp = 0; - if ( (characterObject != NULL) + if ( (characterObject != nullptr) && characterObject->getObjVars().getItem("ai_debug_string", temp)) { if (temp > 0) @@ -1768,8 +1768,8 @@ void AiShipController::addExclusiveAggro(NetworkId const & unit) // Make sure this is a player Object * const unitObject = NetworkIdManager::getObjectById(unit); - ServerObject * const unitServerObject = (unitObject != NULL) ? unitObject->asServerObject() : NULL; - CreatureObject * const unitCreatureObject = (unitServerObject != NULL) ? unitServerObject->asCreatureObject() : NULL; + ServerObject * const unitServerObject = (unitObject != nullptr) ? unitObject->asServerObject() : nullptr; + CreatureObject * const unitCreatureObject = (unitServerObject != nullptr) ? unitServerObject->asCreatureObject() : nullptr; if ( !unitCreatureObject || !unitCreatureObject->isPlayerControlled()) @@ -1829,11 +1829,11 @@ bool AiShipController::isExclusiveAggro(CreatureObject const & pilot) const CreatureObject const * const aggroCreatureObject = CreatureObject::asCreatureObject(aggroCachedNetworkId.getObject()); - if (aggroCreatureObject != NULL) + if (aggroCreatureObject != nullptr) { GroupObject * const groupObject = aggroCreatureObject->getGroup(); - if (groupObject != NULL) + if (groupObject != nullptr) { GroupObject::GroupMemberVector const & groupMembers = groupObject->getGroupMembers(); GroupObject::GroupMemberVector::const_iterator iterGroupMembers = groupMembers.begin(); @@ -1871,7 +1871,7 @@ bool AiShipController::isValidTarget(ShipObject const & unit) const CreatureObject const * const pilotCreatureObject = unit.getPilot(); - if (pilotCreatureObject != NULL) + if (pilotCreatureObject != nullptr) { if (pilotCreatureObject->isPlayerControlled()) { diff --git a/engine/server/library/serverGame/src/shared/controller/AiShipControllerInterface.cpp b/engine/server/library/serverGame/src/shared/controller/AiShipControllerInterface.cpp index 3e4549aa..21fef53d 100755 --- a/engine/server/library/serverGame/src/shared/controller/AiShipControllerInterface.cpp +++ b/engine/server/library/serverGame/src/shared/controller/AiShipControllerInterface.cpp @@ -25,7 +25,7 @@ bool AiShipControllerInterface::addDamageTaken(NetworkId const & unit, NetworkId bool result = false; AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != NULL) + if (aiShipController != nullptr) { bool const verifyAttacker = false; @@ -45,7 +45,7 @@ bool AiShipControllerInterface::setAttackOrders(NetworkId const & unit, AiShipCo bool result = false; AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != NULL) + if (aiShipController != nullptr) { result = true; aiShipController->setAttackOrders(attackOrders); @@ -64,7 +64,7 @@ bool AiShipControllerInterface::idle(NetworkId const & unit) bool result = false; AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != NULL) + if (aiShipController != nullptr) { result = true; aiShipController->idle(); @@ -83,7 +83,7 @@ bool AiShipControllerInterface::track(NetworkId const & unit, Object const & tar bool result = false; AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != NULL) + if (aiShipController != nullptr) { result = true; aiShipController->track(target); @@ -102,7 +102,7 @@ bool AiShipControllerInterface::setLeashRadius(NetworkId const & unit, float con bool result = false; AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != NULL) + if (aiShipController != nullptr) { result = true; aiShipController->setLeashRadius(radius); @@ -121,7 +121,7 @@ bool AiShipControllerInterface::follow(NetworkId const & unit, NetworkId const & bool result = false; AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != NULL) + if (aiShipController != nullptr) { result = true; aiShipController->follow(followedUnit, direction_o, direction); @@ -140,7 +140,7 @@ bool AiShipControllerInterface::addPatrolPath(NetworkId const & unit, SpacePath bool result = false; AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != NULL) + if (aiShipController != nullptr) { result = true; aiShipController->addPatrolPath(path); @@ -159,7 +159,7 @@ bool AiShipControllerInterface::clearPatrolPath(NetworkId const & unit) bool result = false; AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != NULL) + if (aiShipController != nullptr) { result = true; aiShipController->clearPatrolPath(); @@ -178,7 +178,7 @@ bool AiShipControllerInterface::moveTo(NetworkId const & unit, SpacePath * const bool result = false; AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != NULL) + if (aiShipController != nullptr) { result = true; aiShipController->moveTo(path); diff --git a/engine/server/library/serverGame/src/shared/controller/CreatureController.cpp b/engine/server/library/serverGame/src/shared/controller/CreatureController.cpp index 067da019..f25d0fb1 100755 --- a/engine/server/library/serverGame/src/shared/controller/CreatureController.cpp +++ b/engine/server/library/serverGame/src/shared/controller/CreatureController.cpp @@ -122,7 +122,7 @@ CreatureController::~CreatureController() void CreatureController::handleMessage (const int message, const float value, const MessageQueue::Data* const data, const uint32 flags) { CreatureObject * const owner = static_cast(getOwner()); - DEBUG_FATAL(!owner, ("Owner is NULL in CreatureController::handleMessage\n")); + DEBUG_FATAL(!owner, ("Owner is nullptr in CreatureController::handleMessage\n")); switch(message) { @@ -629,7 +629,7 @@ void CreatureController::handleMessage (const int message, const float value, co case CM_setIncapacitated: { const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); - if (msg != NULL) + if (msg != nullptr) owner->setIncapacitated(msg->getValue().first, msg->getValue().second); } break; @@ -853,7 +853,7 @@ void CreatureController::handleMessage (const int message, const float value, co if (owner && msg) owner->setAlternateAppearance(msg->getValue()); else - WARNING(true, ("CreatureController: received CM_setAppearanceFromObjectTemplate but owner or message was NULL.")); + WARNING(true, ("CreatureController: received CM_setAppearanceFromObjectTemplate but owner or message was nullptr.")); } break; @@ -873,9 +873,9 @@ void CreatureController::handleMessage (const int message, const float value, co if (msg) { ServerObject * defender = safe_cast(NetworkIdManager::getObjectById(msg->getDefender())); - if (defender != NULL) + if (defender != nullptr) { - if (defender->asCreatureObject() != NULL) + if (defender->asCreatureObject() != nullptr) { defender->asCreatureObject()->pushedMe(msg->getAttacker(), msg->getAttackerPos(), msg->getDefenderPos(), msg->getDistance()); } @@ -894,7 +894,7 @@ void CreatureController::handleMessage (const int message, const float value, co if (msg) { ServerObject * target = safe_cast(NetworkIdManager::getObjectById(msg->getTarget())); - if (target != NULL && target->asTangibleObject() != NULL) + if (target != nullptr && target->asTangibleObject() != nullptr) { if (owner->isAuthoritative()) owner->addSlowDownEffect(*(target->asTangibleObject()), msg->getConeLength(), msg->getConeAngle(), msg->getSlopeAngle(), msg->getExpireTime()); @@ -964,7 +964,7 @@ void CreatureController::handleMessage (const int message, const float value, co { MessageQueueCyberneticsChangeRequest const * const msg = safe_cast(data); NOT_NULL(msg); - if (msg != NULL) + if (msg != nullptr) { NetworkId const & playerId = msg->getTarget(); GameScriptObject * const scriptObject = owner->getScriptObject(); @@ -984,10 +984,10 @@ void CreatureController::handleMessage (const int message, const float value, co case CM_setCurrentQuest: { MessageQueueGenericValueType const * const msg = safe_cast const *>(data); - if (msg != NULL) + if (msg != nullptr) { PlayerObject * player = PlayerCreatureController::getPlayerObject(owner); - if (player != NULL) + if (player != nullptr) { player->setCurrentQuest(msg->getValue()); } @@ -1003,7 +1003,7 @@ void CreatureController::handleMessage (const int message, const float value, co case CM_setRegenRate: { MessageQueueGenericValueType > const * const msg = safe_cast > const *>(data); - if (msg != NULL) + if (msg != nullptr) { owner->setRegenRate(static_cast(msg->getValue().first), msg->getValue().second); } @@ -1516,7 +1516,7 @@ void CreatureController::conclude() // combatants must be adjusted to reflect the server's idea of the post-alter end posture. // This information was not known at the time the message was constructed. MessageQueueCombatAction * combatMessage = safe_cast(data); - if (combatMessage != NULL) + if (combatMessage != nullptr) { //-- Fix up end postures in messages. @@ -1527,7 +1527,7 @@ void CreatureController::conclude() combatMessage->getAttacker()); const CreatureObject * attacker = dynamic_cast( NetworkIdManager::getObjectById(attackerData.id)); - attackerData.endPosture = (attacker != NULL) ? attacker->getPosture() : static_cast(0); + attackerData.endPosture = (attacker != nullptr) ? attacker->getPosture() : static_cast(0); // set the defenders' posture const MessageQueueCombatAction::DefenderDataVector & defenderData = @@ -1539,7 +1539,7 @@ void CreatureController::conclude() const_cast(*iter); const CreatureObject * defender = dynamic_cast( NetworkIdManager::getObjectById(defenderData.id)); - defenderData.endPosture = (defender != NULL) ? defender->getPosture() : static_cast(0); + defenderData.endPosture = (defender != nullptr) ? defender->getPosture() : static_cast(0); } } } @@ -1667,7 +1667,7 @@ void CreatureController::handleSecureTradeMessage(const MessageQueueSecureTrade )); } } - else if (recipient->getClient() == NULL) + else if (recipient->getClient() == nullptr) { // GameServer::getInstance().sendToPlanetServer( // GenericValueTypeMessage >( @@ -1862,7 +1862,7 @@ void CreatureController::setAppearanceFromObjectTemplate(std::string const &serv CreatureObject * owner = dynamic_cast(getOwner()); if (!owner) { - WARNING(true, ("setAppearanceFromObjectTemplate(): owner is NULL or not a CreatureObject.")); + WARNING(true, ("setAppearanceFromObjectTemplate(): owner is nullptr or not a CreatureObject.")); return; } @@ -2007,7 +2007,7 @@ void CreatureController::calculateWaterState(bool& isSwimming, bool &isBurning, if (ownerCreature->getState(States::RidingMount)) { CreatureObject const *const mountCreature = ownerCreature->getMountedCreature(); - CreatureController const *const mountCreatureController = mountCreature ? safe_cast(mountCreature->getController()) : NULL; + CreatureController const *const mountCreatureController = mountCreature ? safe_cast(mountCreature->getController()) : nullptr; if (mountCreatureController) { // Note: we do the real computation for the mount here because the rider gets @@ -2135,28 +2135,28 @@ CreatureController const * CreatureController::asCreatureController() const PlayerCreatureController * CreatureController::asPlayerCreatureController() { - return NULL; + return nullptr; } //---------------------------------------------------------------------- PlayerCreatureController const * CreatureController::asPlayerCreatureController() const { - return NULL; + return nullptr; } //---------------------------------------------------------------------- AICreatureController * CreatureController::asAiCreatureController() { - return NULL; + return nullptr; } //---------------------------------------------------------------------- AICreatureController const * CreatureController::asAiCreatureController() const { - return NULL; + return nullptr; } //----------------------------------------------------------------------- @@ -2170,23 +2170,23 @@ CreatureController * CreatureController::getCreatureController(NetworkId const & CreatureController * CreatureController::getCreatureController(Object * object) { - Controller * controller = (object != NULL) ? object->getController() : NULL; + Controller * controller = (object != nullptr) ? object->getController() : nullptr; - return (controller != NULL) ? controller->asCreatureController() : NULL; + return (controller != nullptr) ? controller->asCreatureController() : nullptr; } // ---------------------------------------------------------------------- CreatureController * CreatureController::asCreatureController(Controller * controller) { - return (controller != NULL) ? controller->asCreatureController() : NULL; + return (controller != nullptr) ? controller->asCreatureController() : nullptr; } // ---------------------------------------------------------------------- CreatureController const * CreatureController::asCreatureController(Controller const * controller) { - return (controller != NULL) ? controller->asCreatureController() : NULL; + return (controller != nullptr) ? controller->asCreatureController() : nullptr; } // ====================================================================== diff --git a/engine/server/library/serverGame/src/shared/controller/PlanetController.cpp b/engine/server/library/serverGame/src/shared/controller/PlanetController.cpp index 97a826ba..465bb3d5 100755 --- a/engine/server/library/serverGame/src/shared/controller/PlanetController.cpp +++ b/engine/server/library/serverGame/src/shared/controller/PlanetController.cpp @@ -61,7 +61,7 @@ void PlanetController::handleMessage (const int message, const float value, cons case CM_setWeather: { const MessageQueueGenericValueType >* const message = safe_cast >*> (data); - if (message != NULL) + if (message != nullptr) { owner->setWeather( message->getValue().first, @@ -280,7 +280,7 @@ void PlanetController::handleMessage (const int message, const float value, cons const std::map & data = message->getValue(); for (std::map::const_iterator iter = data.begin(); iter != data.end(); ++iter) - owner->adjustGcwImperialScore("CM_adjustGcwImperialScore", NULL, iter->first, iter->second); + owner->adjustGcwImperialScore("CM_adjustGcwImperialScore", nullptr, iter->first, iter->second); } } break; @@ -293,7 +293,7 @@ void PlanetController::handleMessage (const int message, const float value, cons const std::map & data = message->getValue(); for (std::map::const_iterator iter = data.begin(); iter != data.end(); ++iter) - owner->adjustGcwRebelScore("CM_adjustGcwRebelScore", NULL, iter->first, iter->second); + owner->adjustGcwRebelScore("CM_adjustGcwRebelScore", nullptr, iter->first, iter->second); } } break; diff --git a/engine/server/library/serverGame/src/shared/controller/PlayerCreatureController.cpp b/engine/server/library/serverGame/src/shared/controller/PlayerCreatureController.cpp index df4260bc..1097566c 100755 --- a/engine/server/library/serverGame/src/shared/controller/PlayerCreatureController.cpp +++ b/engine/server/library/serverGame/src/shared/controller/PlayerCreatureController.cpp @@ -164,7 +164,7 @@ namespace PlayerCreatureControllerNamespace if(!mount) { - LOG("mounts-bug", ("PlayerCreatureControllerNamespace::isCreaturePassenger(): server id=[%d],object id=[%s] creature has state RidingMount but getMountedCreature() returns NULL.", static_cast(GameServer::getInstance().getProcessId()), creature.getNetworkId().getValueString().c_str())); + LOG("mounts-bug", ("PlayerCreatureControllerNamespace::isCreaturePassenger(): server id=[%d],object id=[%s] creature has state RidingMount but getMountedCreature() returns nullptr.", static_cast(GameServer::getInstance().getProcessId()), creature.getNetworkId().getValueString().c_str())); return false; } @@ -172,7 +172,7 @@ namespace PlayerCreatureControllerNamespace if(!primaryRider) { - LOG("mounts-bug", ("PlayerCreatureControllerNamespace::isCreaturePassenger(): server id=[%d],object id=[%s] creature has state RidingMount but mount->getPrimaryMountingRider() returns NULL.", static_cast(GameServer::getInstance().getProcessId()), creature.getNetworkId().getValueString().c_str())); + LOG("mounts-bug", ("PlayerCreatureControllerNamespace::isCreaturePassenger(): server id=[%d],object id=[%s] creature has state RidingMount but mount->getPrimaryMountingRider() returns nullptr.", static_cast(GameServer::getInstance().getProcessId()), creature.getNetworkId().getValueString().c_str())); return false; } @@ -411,7 +411,7 @@ void PlayerCreatureController::logMoveFailed(char const *reason) "movement", ( "move fail - object %s stationId %u - %s", - creature ? creature->getNetworkId().getValueString().c_str() : "", + creature ? creature->getNetworkId().getValueString().c_str() : "", stationId, reason)); } @@ -425,7 +425,7 @@ bool PlayerCreatureController::isLocationValid(Vector const &position_w, CellObj return false; TerrainObject const *const terrainObject = TerrainObject::getConstInstance(); - if (NULL != terrainObject && (NULL == cell || cell->getCellProperty()->isWorldCell())) + if (nullptr != terrainObject && (nullptr == cell || cell->getCellProperty()->isWorldCell())) { if (!terrainObject->isPassableForceChunkCreation(position_w)) return false; @@ -445,7 +445,7 @@ bool PlayerCreatureController::isLocationValid(Vector const &position_w, CellObj Sphere testSphere(position_w + localSphere.getCenter(), localSphere.getRadius()); - if (CollisionWorld::query(testSphere, NULL)) + if (CollisionWorld::query(testSphere, nullptr)) return false; } return true; @@ -464,7 +464,7 @@ bool PlayerCreatureController::checkValidMove(MoveSnapshot const &m, float const CreatureObject * const creature = NON_NULL(getCreature()); // update the velocity in the serverController - if (creature != NULL) + if (creature != nullptr) { Vector moveDistance = m.getPosition_w() - creature->getPosition_w(); moveDistance.y = 0.0f; @@ -495,8 +495,8 @@ bool PlayerCreatureController::checkValidMove(MoveSnapshot const &m, float const if (!m.isValid()) return handleInvalidMove("invalid destination"); - if (creature == NULL) - return handleInvalidMove("creature is null"); + if (creature == nullptr) + return handleInvalidMove("creature is nullptr"); if (!m.isAllowed(*creature)) return handleInvalidMove("not allowed in dest cell"); @@ -513,7 +513,7 @@ bool PlayerCreatureController::checkValidMove(MoveSnapshot const &m, float const PortalProperty const *destPortalProperty = destCell ? ContainerInterface::getContainedByObject(*destCell)->getPortalProperty() : 0; if (sourcePortalProperty != destPortalProperty) { - // Moving between pobs. This is only valid if one of these is null, since pobs only connect to the world + // Moving between pobs. This is only valid if one of these is nullptr, since pobs only connect to the world if (sourcePortalProperty && destPortalProperty) return handleInvalidMove("tried to move from one pob to another without passing through the world cell"); if (sourcePortalProperty && !sourcePortalProperty->hasPassablePortalToParentCell()) @@ -548,7 +548,7 @@ bool PlayerCreatureController::checkValidMove(MoveSnapshot const &m, float const Client * const client = creature->getClient(); if (!client) - return handleInvalidMove("Creature's client is NULL"); + return handleInvalidMove("Creature's client is nullptr"); uint32 const currentServerSyncStamp = client->getServerSyncStampLong(); @@ -741,7 +741,7 @@ bool PlayerCreatureController::checkValidMove(MoveSnapshot const &m, float const } - m_lastSpeedCheckFailureTime = ::time(NULL); + m_lastSpeedCheckFailureTime = ::time(nullptr); ++m_speedCheckConsecutiveFailureCount; // if this is the first validation failure "in a while", let it pass, because it may be a false positive @@ -1153,11 +1153,11 @@ void PlayerCreatureController::handleMessage (const int message, const float val NetworkId const & designerId = inMsg->getDesignerId(); NetworkId const & recipientId = inMsg->getRecipientId(); Object const * const designerObj = NetworkIdManager::getObjectById(designerId); - ServerObject const * const designerServer = designerObj ? designerObj->asServerObject() : NULL; - CreatureObject const * const designer = designerServer ? designerServer->asCreatureObject() : NULL; + ServerObject const * const designerServer = designerObj ? designerObj->asServerObject() : nullptr; + CreatureObject const * const designer = designerServer ? designerServer->asCreatureObject() : nullptr; Object * const recipientObj = NetworkIdManager::getObjectById(recipientId); - ServerObject * const recipientServer = recipientObj ? recipientObj->asServerObject() : NULL; - CreatureObject * const recipient = recipientServer ? recipientServer->asCreatureObject() : NULL; + ServerObject * const recipientServer = recipientObj ? recipientObj->asServerObject() : nullptr; + CreatureObject * const recipient = recipientServer ? recipientServer->asCreatureObject() : nullptr; if(designer && recipient) { //designer-sent message, either data to sync to the recipient, or committed data to check and apply @@ -1167,7 +1167,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val { //designer hasn't accepted yet, send change to the client so they can see it before agreeing Object * const recipientObject = NetworkIdManager::getObjectById(inMsg->getRecipientId()); - Controller * const recipientController = recipientObject ? recipientObject->getController() : NULL; + Controller * const recipientController = recipientObject ? recipientObject->getController() : nullptr; if(recipientController) { ImageDesignChangeMessage * outMsg = new ImageDesignChangeMessage(); @@ -1182,7 +1182,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val { //check and apply this data once the recipient also accepts Object * const recipientObject = NetworkIdManager::getObjectById(inMsg->getRecipientId()); - Controller * const recipientController = recipientObject ? recipientObject->getController() : NULL; + Controller * const recipientController = recipientObject ? recipientObject->getController() : nullptr; if(recipientController) { ImageDesignChangeMessage * outMsg = new ImageDesignChangeMessage(); @@ -1201,7 +1201,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val //recipient hasn't accepted yet, send the data to the designer to update the recipient-sent amount of money //designer hasn't accepted yet, send change to the client so they can see it before agreeing Object * const designerObject = NetworkIdManager::getObjectById(inMsg->getDesignerId()); - Controller * const designerController = designerObject ? designerObject->getController() : NULL; + Controller * const designerController = designerObject ? designerObject->getController() : nullptr; if(designerController) { ImageDesignChangeMessage * outMsg = new ImageDesignChangeMessage(); @@ -1232,8 +1232,8 @@ void PlayerCreatureController::handleMessage (const int message, const float val std::string const recipientSpeciesGender = CustomizationManager::getServerSpeciesGender(*recipient); CustomizationData * const customizationData = recipient->fetchCustomizationData(); ServerObject * const hair = recipient->getHair(); - TangibleObject * const tangibleHair = hair ? hair->asTangibleObject() : NULL; - CustomizationData * customizationDataHair = NULL; + TangibleObject * const tangibleHair = hair ? hair->asTangibleObject() : nullptr; + CustomizationData * customizationDataHair = nullptr; if(tangibleHair) customizationDataHair = tangibleHair->fetchCustomizationData(); if(customizationData) @@ -1285,7 +1285,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val { //if the recipient canceled the session, tell the designer Object const * const designerObject = NetworkIdManager::getObjectById(session.designerId); - ServerObject const * const designer = designerObject ? designerObject->asServerObject() : NULL; + ServerObject const * const designer = designerObject ? designerObject->asServerObject() : nullptr; if(designer && (owner->getNetworkId() != session.designerId)) Chat::sendSystemMessage(*designer, SharedStringIds::imagedesigner_canceled_by_recip, Unicode::emptyString); @@ -1304,11 +1304,11 @@ void PlayerCreatureController::handleMessage (const int message, const float val NetworkId const & bufferId = inMsg->getBufferId(); NetworkId const & recipientId = inMsg->getRecipientId(); Object const * const bufferObj = NetworkIdManager::getObjectById(bufferId); - ServerObject const * const bufferServer = bufferObj ? bufferObj->asServerObject() : NULL; - CreatureObject const * const buffer = bufferServer ? bufferServer->asCreatureObject() : NULL; + ServerObject const * const bufferServer = bufferObj ? bufferObj->asServerObject() : nullptr; + CreatureObject const * const buffer = bufferServer ? bufferServer->asCreatureObject() : nullptr; Object * const recipientObj = NetworkIdManager::getObjectById(recipientId); - ServerObject * const recipientServer = recipientObj ? recipientObj->asServerObject() : NULL; - CreatureObject * const recipient = recipientServer ? recipientServer->asCreatureObject() : NULL; + ServerObject * const recipientServer = recipientObj ? recipientObj->asServerObject() : nullptr; + CreatureObject * const recipient = recipientServer ? recipientServer->asCreatureObject() : nullptr; if(buffer && recipient) { //buffer-sent message, either data to sync to the recipient, or committed data to check and apply @@ -1318,7 +1318,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val { //buffer hasn't accepted yet, send change to the client so they can see it before agreeing Object * const recipientObject = NetworkIdManager::getObjectById(inMsg->getRecipientId()); - Controller * const recipientController = recipientObject ? recipientObject->getController() : NULL; + Controller * const recipientController = recipientObject ? recipientObject->getController() : nullptr; if(recipientController) { BuffBuilderChangeMessage * outMsg = new BuffBuilderChangeMessage(); @@ -1333,7 +1333,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val { //check and apply this data once the recipient also accepts Object * const recipientObject = NetworkIdManager::getObjectById(inMsg->getRecipientId()); - Controller * const recipientController = recipientObject ? recipientObject->getController() : NULL; + Controller * const recipientController = recipientObject ? recipientObject->getController() : nullptr; if(recipientController) { BuffBuilderChangeMessage * outMsg = new BuffBuilderChangeMessage(); @@ -1351,7 +1351,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val //recipient hasn't accepted yet, send the data to the buffer to update the recipient-sent amount of money //buffer hasn't accepted yet, send change to the client so they can see it before agreeing Object * const bufferObject = NetworkIdManager::getObjectById(inMsg->getBufferId()); - Controller * const bufferController = bufferObject ? bufferObject->getController() : NULL; + Controller * const bufferController = bufferObject ? bufferObject->getController() : nullptr; if(bufferController) { BuffBuilderChangeMessage * outMsg = new BuffBuilderChangeMessage(); @@ -1425,7 +1425,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val { //if the recipient canceled the session, tell the designer Object const * const bufferObject = NetworkIdManager::getObjectById(session.bufferId); - ServerObject const * const buffer = bufferObject ? bufferObject->asServerObject() : NULL; + ServerObject const * const buffer = bufferObject ? bufferObject->asServerObject() : nullptr; if(buffer && (owner->getNetworkId() != session.bufferId)) { @@ -1447,7 +1447,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val if(msg) { Object const * const terminalO = NetworkIdManager::getObjectById(msg->getValue()); - ServerObject const * const terminal = terminalO ? terminalO->asServerObject() : NULL; + ServerObject const * const terminal = terminalO ? terminalO->asServerObject() : nullptr; if(terminal) { Client const * const client = owner->getClient(); @@ -1461,7 +1461,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val if(!client->isGod()) { Object const * const buildingO = ContainerInterface::getTopmostContainer(*terminal); - ServerObject const * const building = buildingO ? buildingO->asServerObject() : NULL; + ServerObject const * const building = buildingO ? buildingO->asServerObject() : nullptr; if(building) { DynamicVariableList const & buildingObjVars = building->getObjVars(); @@ -1478,13 +1478,13 @@ void PlayerCreatureController::handleMessage (const int message, const float val for(std::vector::const_iterator i = ships.begin(); i != ships.end(); ++i) { Object const * const shipO = NetworkIdManager::getObjectById(*i); - ServerObject const * const shipSO = shipO ? shipO->asServerObject() : NULL; - ShipObject const * const ship = shipSO ? shipSO->asShipObject() : NULL; + ServerObject const * const shipSO = shipO ? shipO->asServerObject() : nullptr; + ShipObject const * const ship = shipSO ? shipSO->asShipObject() : nullptr; if(ship) { ContainedByProperty const * const contained = ship->getContainedByProperty(); - Object const * const containerO = contained ? contained->getContainedBy() : NULL; - ServerObject const * const container = containerO ? containerO->asServerObject() : NULL; + Object const * const containerO = contained ? contained->getContainedBy() : nullptr; + ServerObject const * const container = containerO ? containerO->asServerObject() : nullptr; if(container) { DynamicVariableList const & shipControlDeviceObjVars = container->getObjVars(); @@ -1665,14 +1665,14 @@ void PlayerCreatureController::handleMessage (const int message, const float val { MessageQueueCyberneticsChangeRequest const * const msg = dynamic_cast(data); NOT_NULL(msg); - if (msg != NULL) + if (msg != nullptr) { CreatureObject * const owner = NON_NULL(getCreature()); if(owner) { NetworkId const & npcId = msg->getTarget(); Object * const o = NetworkIdManager::getObjectById(npcId); - ServerObject * const so = o ? o->asServerObject() : NULL; + ServerObject * const so = o ? o->asServerObject() : nullptr; if(so) { Controller * const npcController = so->getController(); @@ -1696,10 +1696,10 @@ void PlayerCreatureController::handleMessage (const int message, const float val case CM_spaceMiningSaleSellResource: { MessageQueueSpaceMiningSellResource const * const msg = dynamic_cast(data); - if (msg != NULL) + if (msg != nullptr) { ServerObject * const spaceStation = safe_cast(NetworkIdManager::getObjectById(msg->m_spaceStationId)); - if (NULL == spaceStation) + if (nullptr == spaceStation) { WARNING(true, ("PlayerCreatureController CM_spaceMiningSaleSellResource invalid station [%s]", msg->m_spaceStationId.getValueString().c_str())); } @@ -1784,7 +1784,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val DictionaryValueMap::const_iterator itr = valueMap.find(minigameResultTargetName); - if(itr != valueMap.end() && itr->second != NULL) + if(itr != valueMap.end() && itr->second != nullptr) { if(itr->second->getType() == ValueTypeObjId::ms_type) { @@ -1798,7 +1798,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(tableOid, @@ -1859,7 +1859,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val params.addParam(paramsDict, "taskDictionary"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(owner->getNetworkId(), diff --git a/engine/server/library/serverGame/src/shared/controller/PlayerShipController.cpp b/engine/server/library/serverGame/src/shared/controller/PlayerShipController.cpp index 6350d91b..921e3980 100755 --- a/engine/server/library/serverGame/src/shared/controller/PlayerShipController.cpp +++ b/engine/server/library/serverGame/src/shared/controller/PlayerShipController.cpp @@ -295,10 +295,10 @@ void PlayerShipController::handleMessage(int const message, float const value, M case CM_spaceMiningSaleSellResource: { MessageQueueSpaceMiningSellResource const * const msg = dynamic_cast(data); - if (msg != NULL) + if (msg != nullptr) { ServerObject * const spaceStation = safe_cast(NetworkIdManager::getObjectById(msg->m_spaceStationId)); - if (NULL == spaceStation) + if (nullptr == spaceStation) { WARNING(true, ("PlayerCreatureController CM_spaceMiningSaleSellResource invalid station [%s]", msg->m_spaceStationId.getValueString().c_str())); } @@ -376,16 +376,16 @@ float PlayerShipController::realAlter(float const elapsedTime) if (owner && owner->isInitialized()) { - if (m_pendingDockingBehavior != NULL) + if (m_pendingDockingBehavior != nullptr) { delete m_dockingBehavior; m_dockingBehavior = m_pendingDockingBehavior; - m_pendingDockingBehavior = NULL; + m_pendingDockingBehavior = nullptr; getShipOwner()->setCondition(static_cast(TangibleObject::C_docking)); Client * const client = owner->getClient(); - if (client != NULL) + if (client != nullptr) { ShipClientUpdateTracker::queueForUpdate(*client, *owner); } @@ -395,16 +395,16 @@ float PlayerShipController::realAlter(float const elapsedTime) } } - if ( (m_dockingBehavior != NULL) + if ( (m_dockingBehavior != nullptr) && m_dockingBehavior->isDockFinished()) { delete m_dockingBehavior; - m_dockingBehavior = NULL; + m_dockingBehavior = nullptr; getShipOwner()->clearCondition(static_cast(TangibleObject::C_docking)); } - if (m_dockingBehavior != NULL) + if (m_dockingBehavior != nullptr) { //-- The docking behavior will calculate new values for m_yaw/m_pitch/m_roll/m_throttle[Position] implicitly through calling ShipController members m_dockingBehavior->alter(elapsedTime); @@ -806,7 +806,7 @@ void PlayerShipController::setWeaponIndexPlayerControlled(int const weaponIndex, { DEBUG_FATAL((weaponIndex < 0), ("Invalid weaponIndex(%d)", weaponIndex)); - if (m_turretTargetingSystem != NULL) + if (m_turretTargetingSystem != nullptr) { safe_cast(m_turretTargetingSystem)->setWeaponIndexPlayerControlled(weaponIndex, playerControlled); } diff --git a/engine/server/library/serverGame/src/shared/controller/ServerController.cpp b/engine/server/library/serverGame/src/shared/controller/ServerController.cpp index bd5ffc3f..535341e6 100755 --- a/engine/server/library/serverGame/src/shared/controller/ServerController.cpp +++ b/engine/server/library/serverGame/src/shared/controller/ServerController.cpp @@ -55,7 +55,7 @@ CellProperty const * getCell(Object const * obj) { - if(obj == NULL) return NULL; + if(obj == nullptr) return nullptr; return obj->getCellProperty(); } @@ -74,7 +74,7 @@ Vector movePointBetweenCells ( Object const * oldCellObject, Object const * new Transform toWorld = Transform::identity; Transform toCell = Transform::identity; - if(oldCellObject != NULL) + if(oldCellObject != nullptr) { CellProperty const * oldCell = getCell(oldCellObject); @@ -84,7 +84,7 @@ Vector movePointBetweenCells ( Object const * oldCellObject, Object const * new } } - if(newCellObject != NULL) + if(newCellObject != nullptr) { CellProperty const * newCell = getCell(newCellObject); @@ -115,7 +115,7 @@ Transform moveTransformBetweenCells ( Object const * oldCellObject, Object const Transform toWorld = Transform::identity; Transform toCell = Transform::identity; - if(oldCellObject != NULL) + if(oldCellObject != nullptr) { CellProperty const * oldCell = getCell(oldCellObject); @@ -125,7 +125,7 @@ Transform moveTransformBetweenCells ( Object const * oldCellObject, Object const } } - if(newCellObject != NULL) + if(newCellObject != nullptr) { CellProperty const * newCell = getCell(newCellObject); @@ -220,7 +220,7 @@ void ServerController::setAuthoritative(bool newAuthoritative) { if (!newAuthoritative && m_bHasGoal && m_goalCellObject) { - m_goalCellObject = NULL; + m_goalCellObject = nullptr; m_bHasGoal = false; m_bAtGoal = true; } @@ -420,7 +420,7 @@ bool changeCells(ServerObject &object, ServerObject *newCellObject) // ---------- - if (newCellObject == NULL) + if (newCellObject == nullptr) { // Object was in a cell and is moving to the world, transfer from cell container to world @@ -428,7 +428,7 @@ bool changeCells(ServerObject &object, ServerObject *newCellObject) Transform const &newTransform = oldCellObject->getTransform_o2w().rotateTranslate_l2p(objectTransform); Container::ContainerErrorCode tmp = Container::CEC_Success; - result = ContainerInterface::transferItemToWorld(object, newTransform, NULL, tmp); + result = ContainerInterface::transferItemToWorld(object, newTransform, nullptr, tmp); if (!result) { @@ -444,13 +444,13 @@ bool changeCells(ServerObject &object, ServerObject *newCellObject) CellProperty * const pCell = ContainerInterface::getCell(*newCellObject); - DEBUG_REPORT_LOG(pCell == NULL, ("changeCells - Received transform with parent to a non-cell object. This should only happen from the DB\n")); + DEBUG_REPORT_LOG(pCell == nullptr, ("changeCells - Received transform with parent to a non-cell object. This should only happen from the DB\n")); if (pCell) { Transform objectTransform = object.getTransform_o2p(); Container::ContainerErrorCode tmp = Container::CEC_Success; - result = ContainerInterface::transferItemToCell(*newCellObject, object, NULL, tmp); + result = ContainerInterface::transferItemToCell(*newCellObject, object, nullptr, tmp); if (!result) { @@ -537,7 +537,7 @@ void ServerController::handleNetUpdateTransform(const MessageQueueDataTransform& return; } - setGoal( message.getTransform(), NULL ); + setGoal( message.getTransform(), nullptr ); } //----------------------------------------------------------------------- @@ -566,7 +566,7 @@ void ServerController::handleNetUpdateTransformWithParent(const MessageQueueData #if 1 Transform start = Transform::identity; start.setPosition_p(ConfigServerGame::getStartingPosition()); - setGoal( start, NULL ); + setGoal( start, nullptr ); #endif return; } diff --git a/engine/server/library/serverGame/src/shared/controller/ShipController.cpp b/engine/server/library/serverGame/src/shared/controller/ShipController.cpp index 3367476d..312131a9 100755 --- a/engine/server/library/serverGame/src/shared/controller/ShipController.cpp +++ b/engine/server/library/serverGame/src/shared/controller/ShipController.cpp @@ -58,12 +58,12 @@ ShipController::ShipController(ShipObject * newOwner) : m_pitchPosition(0.0f), m_rollPosition(0.0f), m_throttlePosition(0.0f), - m_pendingDockingBehavior(NULL), - m_dockingBehavior(NULL), + m_pendingDockingBehavior(nullptr), + m_dockingBehavior(nullptr), m_attackTargetList(new AiShipAttackTargetList(newOwner)), m_attackTargetDecayTimer(new Timer(static_cast(s_maxTargetAge))), m_enemyCheckQueued(false), - m_turretTargetingSystem(NULL), + m_turretTargetingSystem(nullptr), m_dockedByList(new DockedByList), m_aiTargetingMeList(new CachedNetworkIdList) { @@ -77,7 +77,7 @@ ShipController::~ShipController() // The turret targeting system must be deleted before clearAiTargetingMeList(), because // otherwise it will try to acquire new targets as the list is being cleared delete m_turretTargetingSystem; - m_turretTargetingSystem = NULL; + m_turretTargetingSystem = nullptr; clearAiTargetingMeList(); @@ -85,9 +85,9 @@ ShipController::~ShipController() delete m_dockedByList; delete m_aiTargetingMeList; delete m_pendingDockingBehavior; - m_pendingDockingBehavior = NULL; + m_pendingDockingBehavior = nullptr; delete m_dockingBehavior; - m_dockingBehavior = NULL; + m_dockingBehavior = nullptr; delete m_attackTargetList; delete m_attackTargetDecayTimer; } @@ -226,7 +226,7 @@ void ShipController::handleMessage (const int message, const float value, const UNREF(flags); UNREF(value); ShipObject * const owner = getShipOwner(); - DEBUG_FATAL(!owner, ("Owner is NULL in ShipController::handleMessage\n")); + DEBUG_FATAL(!owner, ("Owner is nullptr in ShipController::handleMessage\n")); switch(message) { case CM_clientLookAtTarget: @@ -265,7 +265,7 @@ void ShipController::addTurretTargetingSystem(ShipTurretTargetingSystem * newSys void ShipController::removeTurretTargetingSystem() { delete m_turretTargetingSystem; - m_turretTargetingSystem = NULL; + m_turretTargetingSystem = nullptr; } // ---------------------------------------------------------------------- @@ -281,7 +281,7 @@ void ShipController::addDockedBy(Object const & unit) { IGNORE_RETURN(m_dockedByList->insert(CachedNetworkId(unit))); - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("ShipController::addDockedBy() owner(%s) dockedBy(%s) dockedByListSize(%u)", (getOwner() != NULL) ? getOwner()->getNetworkId().getValueString().c_str() : "NULL", unit.getNetworkId().getValueString().c_str(), m_dockedByList->size())); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("ShipController::addDockedBy() owner(%s) dockedBy(%s) dockedByListSize(%u)", (getOwner() != nullptr) ? getOwner()->getNetworkId().getValueString().c_str() : "nullptr", unit.getNetworkId().getValueString().c_str(), m_dockedByList->size())); } // ---------------------------------------------------------------------- @@ -294,7 +294,7 @@ void ShipController::removeDockedBy(Object const & unit) { m_dockedByList->erase(iterDockedByList); - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("ShipController::removeDockedBy() owner(%s) dockedBy(%s) dockedByListSize(%u)", (getOwner() != NULL) ? getOwner()->getNetworkId().getValueString().c_str() : "NULL", unit.getNetworkId().getValueString().c_str(), m_dockedByList->size())); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("ShipController::removeDockedBy() owner(%s) dockedBy(%s) dockedByListSize(%u)", (getOwner() != nullptr) ? getOwner()->getNetworkId().getValueString().c_str() : "nullptr", unit.getNetworkId().getValueString().c_str(), m_dockedByList->size())); } else { @@ -314,7 +314,7 @@ ShipController::DockedByList const & ShipController::getDockedByList() const void ShipController::addAiTargetingMe(NetworkId const & unit) { //LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("ShipController::addAiTargetingMe() owner(%s) unit(%s) m_aiTargetingMeList->size(%u+1)", getOwner()->getNetworkId().getValueString().c_str(), unit.getValueString().c_str(), m_aiTargetingMeList->size())); - DEBUG_FATAL((NetworkIdManager::getObjectById(unit) == NULL), ("ShipController::addAiTargetingMe() owner(%s) unit(%s) ERROR: The Ai who is targeting you is not a valid networkId", getOwner()->getNetworkId().getValueString().c_str(), unit.getValueString().c_str())); + DEBUG_FATAL((NetworkIdManager::getObjectById(unit) == nullptr), ("ShipController::addAiTargetingMe() owner(%s) unit(%s) ERROR: The Ai who is targeting you is not a valid networkId", getOwner()->getNetworkId().getValueString().c_str(), unit.getValueString().c_str())); // Make sure this is a valid networkId of an alive object @@ -346,11 +346,11 @@ void ShipController::removeAiTargetingMe(NetworkId const & unit) { ShipObject * const shipOwner = getShipOwner(); - if (shipOwner != NULL) + if (shipOwner != nullptr) { CreatureObject * const pilotOwner = CreatureObject::asCreatureObject(shipOwner->getPilot()); - if ( (pilotOwner != NULL) + if ( (pilotOwner != nullptr) && pilotOwner->isPlayerControlled()) { shipOwner->clearCondition(static_cast(TangibleObject::C_spaceCombatMusic)); @@ -442,7 +442,7 @@ bool ShipController::face(Vector const & goalPosition_w, float elapsedTime) bool useFastAxis = true; AiShipController const * const aiShipController = asAiShipController(); - if (aiShipController != NULL) + if (aiShipController != nullptr) { if ( (aiShipController->getShipClass() == ShipAiReactionManager::SC_capitalShip) || (aiShipController->getShipClass() == ShipAiReactionManager::SC_transport) @@ -620,7 +620,7 @@ float ShipController::getLargestTurnRadius() const ShipObject const * const shipObject = getShipOwner(); - if (shipObject != NULL) + if (shipObject != nullptr) { float const maxYawRate = shipObject->getShipActualYawRateMaximum(); float const maxPitchRate = shipObject->getShipActualPitchRateMaximum(); @@ -650,11 +650,11 @@ void ShipController::dock(ShipObject & dockTarget, float const secondsAtDock) void ShipController::unDock() { - if (m_pendingDockingBehavior != NULL) + if (m_pendingDockingBehavior != nullptr) { m_pendingDockingBehavior->unDock(); } - else if (m_dockingBehavior != NULL) + else if (m_dockingBehavior != nullptr) { m_dockingBehavior->unDock(); } @@ -664,14 +664,14 @@ void ShipController::unDock() bool ShipController::isDocking() const { - return (m_dockingBehavior != NULL) || (m_pendingDockingBehavior != NULL); + return (m_dockingBehavior != nullptr) || (m_pendingDockingBehavior != nullptr); } // ---------------------------------------------------------------------- bool ShipController::isDocked() const { - return ((m_dockingBehavior != NULL) && m_dockingBehavior->isDocked()); + return ((m_dockingBehavior != nullptr) && m_dockingBehavior->isDocked()); } // ---------------------------------------------------------------------- @@ -698,28 +698,28 @@ ShipController const * ShipController::asShipController() const PlayerShipController * ShipController::asPlayerShipController() { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- PlayerShipController const * ShipController::asPlayerShipController() const { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- AiShipController * ShipController::asAiShipController() { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- AiShipController const * ShipController::asAiShipController() const { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -736,7 +736,7 @@ bool ShipController::addDamageTaken(NetworkId const & attackingUnit, float const bool result = false; ShipObject * const attackingUnitShipObject = ShipObject::asShipObject(NetworkIdManager::getObjectById(attackingUnit)); - if ( (attackingUnitShipObject != NULL) + if ( (attackingUnitShipObject != nullptr) && !attackingUnitShipObject->isDamageAggroImmune()) { result = verifyAttacker ? Pvp::canAttack(*attackingUnitShipObject, *NON_NULL(getShipOwner())) : true; @@ -754,7 +754,7 @@ bool ShipController::addDamageTaken(NetworkId const & attackingUnit, float const bool ShipController::hasTurretTargetingSystem() const { - return (m_turretTargetingSystem != NULL); + return (m_turretTargetingSystem != nullptr); } // ---------------------------------------------------------------------- @@ -792,7 +792,7 @@ bool ShipController::removeAttackTarget(NetworkId const & unit) void ShipController::onAttackTargetChanged(NetworkId const & target) { - if (m_turretTargetingSystem != NULL) + if (m_turretTargetingSystem != nullptr) { m_turretTargetingSystem->onTargetChanged(target); } @@ -802,7 +802,7 @@ void ShipController::onAttackTargetChanged(NetworkId const & target) void ShipController::onAttackTargetLost(NetworkId const & target) { - if (m_turretTargetingSystem != NULL) + if (m_turretTargetingSystem != nullptr) { m_turretTargetingSystem->onTargetLost(target); } @@ -834,12 +834,12 @@ int ShipController::getNumberOfAiUnitsAttackingMe() const CachedNetworkId const & ai = (*iterAiTargetingMeList); Object const * const aiObject = ai.getObject(); - if (aiObject != NULL) + if (aiObject != nullptr) { ShipController const * const shipController = aiObject->getController()->asShipController(); - AiShipController const * const aiShipController = (shipController != NULL) ? shipController->asAiShipController() : NULL; + AiShipController const * const aiShipController = (shipController != nullptr) ? shipController->asAiShipController() : nullptr; - if (aiShipController != NULL) + if (aiShipController != nullptr) { if (aiShipController->getPrimaryAttackTarget() == getOwner()->getNetworkId()) { @@ -849,7 +849,7 @@ int ShipController::getNumberOfAiUnitsAttackingMe() const } else { - DEBUG_WARNING(true, ("ShipController::getNumberOfAiShipAttackingMe() ERROR: Why am I(%s) being targeted by a NULL object(%s)?", getOwner()->getDebugInformation().c_str(), ai.getValueString().c_str())); + DEBUG_WARNING(true, ("ShipController::getNumberOfAiShipAttackingMe() ERROR: Why am I(%s) being targeted by a nullptr object(%s)?", getOwner()->getDebugInformation().c_str(), ai.getValueString().c_str())); } } @@ -910,11 +910,11 @@ void ShipController::clearAiTargetingMeList() { CachedNetworkId const & id = (*iterPurgeList); - if (id.getObject() != NULL) + if (id.getObject() != nullptr) { ShipController * const shipController = id.getObject()->getController()->asShipController(); - if (shipController != NULL) + if (shipController != nullptr) { IGNORE_RETURN(shipController->removeAttackTarget(getOwner()->getNetworkId())); } diff --git a/engine/server/library/serverGame/src/shared/controller/TangibleController.cpp b/engine/server/library/serverGame/src/shared/controller/TangibleController.cpp index d4e90806..ee670607 100755 --- a/engine/server/library/serverGame/src/shared/controller/TangibleController.cpp +++ b/engine/server/library/serverGame/src/shared/controller/TangibleController.cpp @@ -222,7 +222,7 @@ void TangibleController::handleMessage (const int message, const float value, co case CM_addHate: { const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); - WARNING((msg == NULL), ("TangibleController::handleMessage(CM_addHate) The message data should never be NULL")); + WARNING((msg == nullptr), ("TangibleController::handleMessage(CM_addHate) The message data should never be nullptr")); if(msg) { @@ -233,7 +233,7 @@ void TangibleController::handleMessage (const int message, const float value, co case CM_setHate: { const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); - WARNING((msg == NULL), ("TangibleController::handleMessage(CM_setHate) The message data should never be NULL")); + WARNING((msg == nullptr), ("TangibleController::handleMessage(CM_setHate) The message data should never be nullptr")); if(msg) { @@ -244,7 +244,7 @@ void TangibleController::handleMessage (const int message, const float value, co case CM_removeHateTarget: { const MessageQueueGenericValueType * const msg = safe_cast *>(data); - WARNING((msg == NULL), ("TangibleController::handleMessage(CM_removeHateTarget) The message data should never be NULL")); + WARNING((msg == nullptr), ("TangibleController::handleMessage(CM_removeHateTarget) The message data should never be nullptr")); if(msg) { @@ -265,7 +265,7 @@ void TangibleController::handleMessage (const int message, const float value, co case CM_forceHateTarget: { const MessageQueueGenericValueType * const msg = safe_cast *>(data); - WARNING((msg == NULL), ("TangibleController::handleMessage(CM_removeHateTarget) The message data should never be NULL")); + WARNING((msg == nullptr), ("TangibleController::handleMessage(CM_removeHateTarget) The message data should never be nullptr")); if(msg) { @@ -276,9 +276,9 @@ void TangibleController::handleMessage (const int message, const float value, co case CM_autoExpireHateListTargetEnabled: { const MessageQueueGenericValueType * const msg = safe_cast *>(data); - WARNING((msg == NULL), ("TangibleController::handleMessage(CM_setHateListExpireTargetEnabled) The message data should never be NULL")); + WARNING((msg == nullptr), ("TangibleController::handleMessage(CM_setHateListExpireTargetEnabled) The message data should never be nullptr")); - if (msg != NULL) + if (msg != nullptr) { owner->setHateListAutoExpireTargetEnabled(msg->getValue()); } @@ -315,7 +315,7 @@ void TangibleController::handleMessage (const int message, const float value, co if(object) { ServerObject * transferer = safe_cast(NetworkIdManager::getObjectById(msg->getValue().second)); - // transferer is allowed to be null + // transferer is allowed to be nullptr owner->addObjectToOutputSlot(*object, transferer); } } @@ -576,7 +576,7 @@ void TangibleController::handleMessage (const int message, const float value, co case CM_addUserToAccessList: { MessageQueueGenericValueType > const *msg = safe_cast > const *>(data); - WARNING((msg == NULL), ("TangibleController::handleMessage(CM_addUserToAccessList) The message data should never be NULL")); + WARNING((msg == nullptr), ("TangibleController::handleMessage(CM_addUserToAccessList) The message data should never be nullptr")); if(msg) { @@ -590,7 +590,7 @@ void TangibleController::handleMessage (const int message, const float value, co case CM_removeUserFromAccessList: { MessageQueueGenericValueType > const *msg = safe_cast > const *>(data); - WARNING((msg == NULL), ("TangibleController::handleMessage(CM_removeUserFromAccessList) The message data should never be NULL")); + WARNING((msg == nullptr), ("TangibleController::handleMessage(CM_removeUserFromAccessList) The message data should never be nullptr")); if(msg) { @@ -722,14 +722,14 @@ TangibleController const * TangibleController::asTangibleController() const AiTurretController * TangibleController::asAiTurretController() { - return NULL; + return nullptr; } //---------------------------------------------------------------------- AiTurretController const * TangibleController::asAiTurretController() const { - return NULL; + return nullptr; } //======================================================================== diff --git a/engine/server/library/serverGame/src/shared/core/AttribModNameManager.cpp b/engine/server/library/serverGame/src/shared/core/AttribModNameManager.cpp index 8cf03ed4..f2104fad 100755 --- a/engine/server/library/serverGame/src/shared/core/AttribModNameManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/AttribModNameManager.cpp @@ -24,7 +24,7 @@ namespace AttribModNameManagerNamespace std::set unknownCrcs; } -AttribModNameManager * AttribModNameManager::ms_attribModNameManager = NULL; +AttribModNameManager * AttribModNameManager::ms_attribModNameManager = nullptr; //======================================================================== @@ -65,8 +65,8 @@ AttribModNameManager::~AttribModNameManager() { delete m_names; delete m_crcMap; - m_names = NULL; - m_crcMap = NULL; + m_names = nullptr; + m_crcMap = nullptr; } // AttribModNameManager::~AttribModNameManager // ---------------------------------------------------------------------- @@ -76,7 +76,7 @@ AttribModNameManager::~AttribModNameManager() */ void AttribModNameManager::install() { - if (ms_attribModNameManager == NULL) + if (ms_attribModNameManager == nullptr) { ms_attribModNameManager = new AttribModNameManager; ExitChain::add(AttribModNameManager::remove, "AttribModNameManager::remove"); @@ -90,10 +90,10 @@ void AttribModNameManager::install() */ void AttribModNameManager::remove() { - if (ms_attribModNameManager != NULL) + if (ms_attribModNameManager != nullptr) { delete ms_attribModNameManager; - ms_attribModNameManager = NULL; + ms_attribModNameManager = nullptr; } } // AttribModNameManager::remove @@ -263,7 +263,7 @@ void AttribModNameManager::sendAllNamesToServer(std::vector const & serv * * @param crc the crc value to look up * - * @return the attrib mod name, or NULL if there was no name for the crc + * @return the attrib mod name, or nullptr if there was no name for the crc */ const char * AttribModNameManager::getAttribModName(uint32 crc) const { @@ -277,7 +277,7 @@ const char * AttribModNameManager::getAttribModName(uint32 crc) const ServerClock::getInstance().getServerFrame())); AttribModNameManagerNamespace::unknownCrcs.insert(crc); } - return NULL; + return nullptr; } // AttribModNameManager::getAttribModName // ---------------------------------------------------------------------- @@ -350,7 +350,7 @@ void AttribModNameManager::getAttribModNamesFromBase(uint32 base, std::vector & names) const { const char * baseName = getAttribModName(base); - if (baseName != NULL) + if (baseName != nullptr) getAttribModNamesFromBase(baseName, names); } // AttribModNameManager::getAttribModNamesFromBase @@ -366,7 +366,7 @@ void AttribModNameManager::getAttribModCrcsFromBase(uint32 base, std::vector & crcs) const { const char * baseName = getAttribModName(base); - if (baseName != NULL) + if (baseName != nullptr) getAttribModCrcsFromBase(baseName, crcs); } // AttribModNameManager::getAttribModCrcsFromBase diff --git a/engine/server/library/serverGame/src/shared/core/BiographyManager.cpp b/engine/server/library/serverGame/src/shared/core/BiographyManager.cpp index 6febe92c..6996f5fc 100755 --- a/engine/server/library/serverGame/src/shared/core/BiographyManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/BiographyManager.cpp @@ -133,7 +133,7 @@ void BiographyManager::deleteBiography(const NetworkId &owner) DEBUG_FATAL(!m_installed, ("BioManager not installed")); - BiographyMessage const msg(owner,NULL); + BiographyMessage const msg(owner,nullptr); GameServer::getInstance().sendToDatabaseServer(msg); // Save off the bio for viewing by other players diff --git a/engine/server/library/serverGame/src/shared/core/CharacterMatchManager.cpp b/engine/server/library/serverGame/src/shared/core/CharacterMatchManager.cpp index ce305b38..89668966 100755 --- a/engine/server/library/serverGame/src/shared/core/CharacterMatchManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/CharacterMatchManager.cpp @@ -55,7 +55,7 @@ namespace CharacterMatchManagerNamespace // used when invoking LfgDataTable::LfgNode::internalAttributeMatchFunction struct LfgInternalAttributeMatchFunctionParams { - LfgInternalAttributeMatchFunctionParams() : param1(NULL), param2(NULL), param3(NULL), param4(NULL), param5(NULL) {} + LfgInternalAttributeMatchFunctionParams() : param1(nullptr), param2(nullptr), param3(nullptr), param4(nullptr), param5(nullptr) {} void const * param1; void const * param2; @@ -151,8 +151,8 @@ bool CharacterMatchManagerNamespace::isMatch(std::map(NetworkIdManager::getObjectById(networkId)); - Client * const requestClient = (requestServerObject ? requestServerObject->getClient() : NULL); - CreatureObject * const requestCreatureObject = (requestServerObject ? requestServerObject->asCreatureObject() : NULL); - PlayerObject * const requestPlayerObject = (requestCreatureObject ? PlayerCreatureController::getPlayerObject(requestCreatureObject) : NULL); + Client * const requestClient = (requestServerObject ? requestServerObject->getClient() : nullptr); + CreatureObject * const requestCreatureObject = (requestServerObject ? requestServerObject->asCreatureObject() : nullptr); + PlayerObject * const requestPlayerObject = (requestCreatureObject ? PlayerCreatureController::getPlayerObject(requestCreatureObject) : nullptr); if (requestCreatureObject && requestPlayerObject && requestClient) { @@ -210,10 +210,10 @@ void CharacterMatchManager::requestMatch(NetworkId const &networkId, MatchMaking } // if "friend" is one of the search criteria, this will contain the requester's friends list - PlayerObject::StringVector const * requestPlayerObjectSortedLowercaseFriendList = NULL; + PlayerObject::StringVector const * requestPlayerObjectSortedLowercaseFriendList = nullptr; // if "cts_source_galaxy" is one of the search criteria, this will contain the requester's CTS source galaxy list - std::set const * requestPlayerObjectCtsSourceGalaxy = NULL; + std::set const * requestPlayerObjectCtsSourceGalaxy = nullptr; // if "in_same_guild" is one of the search criteria, this will contain the requester's guild abbrev bool inSameGuildSearch = false; @@ -224,7 +224,7 @@ void CharacterMatchManager::requestMatch(NetworkId const &networkId, MatchMaking std::string requestPlayerObjectCitizenOfCity; // if "cts_source_galaxy" is one of the search criteria, this will contain the list of matching CTS source galaxy - std::vector * matchingCtsSourceGalaxy = NULL; + std::vector * matchingCtsSourceGalaxy = nullptr; // allows search of characters marked anonymous bool bypassAnonymous = false; @@ -271,7 +271,7 @@ void CharacterMatchManager::requestMatch(NetworkId const &networkId, MatchMaking // special handling for "friend" search attribute if (iterLeafNode->second->name == "friend") { - if (requestPlayerObjectSortedLowercaseFriendList == NULL) + if (requestPlayerObjectSortedLowercaseFriendList == nullptr) { requestPlayerObjectSortedLowercaseFriendList = &(requestPlayerObject->getSortedLowercaseFriendList()); } @@ -284,7 +284,7 @@ void CharacterMatchManager::requestMatch(NetworkId const &networkId, MatchMaking // special handling for "cts_source_galaxy" search attribute else if (iterLeafNode->second->name == "cts_source_galaxy") { - if (requestPlayerObjectCtsSourceGalaxy == NULL) + if (requestPlayerObjectCtsSourceGalaxy == nullptr) { std::map const & connectedCharacterLfgData = ServerUniverse::getConnectedCharacterLfgData(); std::map::const_iterator iterFindLfg = connectedCharacterLfgData.find(networkId); @@ -292,7 +292,7 @@ void CharacterMatchManager::requestMatch(NetworkId const &networkId, MatchMaking requestPlayerObjectCtsSourceGalaxy = &(iterFindLfg->second.ctsSourceGalaxy); } - if (matchingCtsSourceGalaxy == NULL) + if (matchingCtsSourceGalaxy == nullptr) matchingCtsSourceGalaxy = new std::vector; LfgInternalAttributeMatchFunctionParams params; @@ -421,7 +421,7 @@ void CharacterMatchManager::requestMatch(NetworkId const &networkId, MatchMaking } else { - ConsoleMgr::broadcastString("(NULL) (All)", requestClient); + ConsoleMgr::broadcastString("(nullptr) (All)", requestClient); } for (std::vector >::const_iterator iterSearchAttribute = iterAnyAllParentNode->second.begin(); iterSearchAttribute != iterAnyAllParentNode->second.end(); ++iterSearchAttribute) @@ -544,7 +544,7 @@ void CharacterMatchManager::requestMatch(NetworkId const &networkId, MatchMaking if (lfgCharacterData.groupId.isValid() && (mmcr.m_matchingCharacterGroup.count(lfgCharacterData.groupId) == 0)) { ServerObject const * const soGroupObject = safe_cast(NetworkIdManager::getObjectById(lfgCharacterData.groupId)); - GroupObject const * const groupObject = (soGroupObject ? soGroupObject->asGroupObject() : NULL); + GroupObject const * const groupObject = (soGroupObject ? soGroupObject->asGroupObject() : nullptr); if (groupObject) { std::vector & groupInfo = mmcr.m_matchingCharacterGroup[lfgCharacterData.groupId]; diff --git a/engine/server/library/serverGame/src/shared/core/Client.cpp b/engine/server/library/serverGame/src/shared/core/Client.cpp index ab4e4e97..cdef65db 100755 --- a/engine/server/library/serverGame/src/shared/core/Client.cpp +++ b/engine/server/library/serverGame/src/shared/core/Client.cpp @@ -263,8 +263,8 @@ Client::Client(ConnectionServerConnection & connection, const NetworkId & charac { // Don't ever put the character into a packed house ServerObject * const serverObject = containerObject->asServerObject(); - CellObject * const cellObject = (serverObject ? serverObject->asCellObject() : NULL); - BuildingObject * const buildingObject = (cellObject ? cellObject->getOwnerBuilding() : NULL); + CellObject * const cellObject = (serverObject ? serverObject->asCellObject() : nullptr); + BuildingObject * const buildingObject = (cellObject ? cellObject->getOwnerBuilding() : nullptr); if ((buildingObject) && (!buildingObject->isInWorld())) { @@ -713,8 +713,8 @@ void Client::receiveClientMessage(const GameNetworkMessage & message) SlottedContainer const * const slottedContainer = ContainerInterface::getSlottedContainer(*containedBy); ShipObject * const shipObject = ShipObject::getContainingShipObject(containedBy); - if ( (shipObject != NULL) - && (slottedContainer != NULL) + if ( (shipObject != nullptr) + && (slottedContainer != nullptr) && !shipObject->hasCondition(TangibleObject::C_docking)) { bool shotOk = false; @@ -958,7 +958,7 @@ void Client::receiveClientMessage(const GameNetworkMessage & message) const ObjectMenuSelectMessage m (ri); ServerObject * const target = safe_cast(NetworkIdManager::getObjectById (m.getNetworkId())); GameScriptObject * const scriptObject = target ? target->getScriptObject() : 0; - Object * const targetContainedBy = target ? ContainerInterface::getContainedByObject(*target) : NULL; + Object * const targetContainedBy = target ? ContainerInterface::getContainedByObject(*target) : nullptr; const int menuType = m.getSelectedItemId(); static int examineMenuType = RadialMenuManager::getMenuTypeByName("EXAMINE"); @@ -1080,7 +1080,7 @@ void Client::receiveClientMessage(const GameNetworkMessage & message) { // apply the controller message ServerController * controller = dynamic_cast(target->getController()); - if (controller != NULL) + if (controller != nullptr) { uint32 flags = o.getFlags(); flags &= ~GameControllerMessageFlags::SOURCE_REMOTE; @@ -1096,7 +1096,7 @@ void Client::receiveClientMessage(const GameNetworkMessage & message) if (target) { ServerController * controller = dynamic_cast(target->getController()); - if (controller != NULL) + if (controller != nullptr) { uint32 flags = o.getFlags(); flags &= ~GameControllerMessageFlags::SOURCE_REMOTE; @@ -1315,11 +1315,11 @@ void Client::receiveClientMessage(const GameNetworkMessage & message) { CreatureObject *creatureObject = dynamic_cast(getCharacterObject()); - if (creatureObject != NULL) + if (creatureObject != nullptr) { GameScriptObject *gameScriptObject = creatureObject->getScriptObject(); - if(gameScriptObject != NULL) + if(gameScriptObject != nullptr) { ScriptParams scriptParams; IGNORE_RETURN(gameScriptObject->trigAllScripts(Scripting::TRIG_STOMACH_UPDATE, scriptParams)); @@ -1964,7 +1964,7 @@ void Client::receiveClientMessage(const GameNetworkMessage & message) GenericValueTypeMessage > > const msgPlayTimeInfo(readIterator); PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(safe_cast(getCharacterObject())); - if (playerObject != NULL) + if (playerObject != nullptr) { playerObject->setSessionPlayTimeInfo(msgPlayTimeInfo.getValue().first, msgPlayTimeInfo.getValue().second.first, msgPlayTimeInfo.getValue().second.second); } @@ -2222,7 +2222,7 @@ void Client::addObserving(ServerObject* o) { IGNORE_RETURN(m_observing.insert(o)); TangibleObject *to = o->asTangibleObject(); - if (to && PvpUpdateObserver::satisfyPvpSyncCondition(to->isNonPvpObject(), to->hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (o->asCreatureObject() != NULL), to->getPvpFaction())) + if (to && PvpUpdateObserver::satisfyPvpSyncCondition(to->isNonPvpObject(), to->hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (o->asCreatureObject() != nullptr), to->getPvpFaction())) addObservingPvpSync(to); } } diff --git a/engine/server/library/serverGame/src/shared/core/ClusterWideDataClient.cpp b/engine/server/library/serverGame/src/shared/core/ClusterWideDataClient.cpp index a0c10d82..ddf92605 100755 --- a/engine/server/library/serverGame/src/shared/core/ClusterWideDataClient.cpp +++ b/engine/server/library/serverGame/src/shared/core/ClusterWideDataClient.cpp @@ -115,7 +115,7 @@ bool ClusterWideDataClient::handleMessage(const MessageDispatch::Emitter &, cons // locate the callback object ClusterWideDataClientNamespace::CallbackObjectIdList::iterator iter = ClusterWideDataClientNamespace::callbackObjectIdList.find(msg.getRequestId()); - ServerObject * object = NULL; + ServerObject * object = nullptr; if (iter != ClusterWideDataClientNamespace::callbackObjectIdList.end()) object = dynamic_cast(NetworkIdManager::getObjectById(iter->second)); diff --git a/engine/server/library/serverGame/src/shared/core/CombatTracker.cpp b/engine/server/library/serverGame/src/shared/core/CombatTracker.cpp index 3c0882b9..ed0b1ffd 100755 --- a/engine/server/library/serverGame/src/shared/core/CombatTracker.cpp +++ b/engine/server/library/serverGame/src/shared/core/CombatTracker.cpp @@ -45,7 +45,7 @@ void CombatTracker::getInterestedViewers(TangibleObject const *defender, std::ve AICreatureController const * const defenderAiCreatureController = AICreatureController::asAiCreatureController(defender->getController()); bool const defenderIsInWorldCell = defender->isInWorldCell(); - if (defenderAiCreatureController != NULL) + if (defenderAiCreatureController != nullptr) { ServerWorld::findObjectsInRange(defender->getPosition_w(), defenderAiCreatureController->getAssistRadius(), unfilteredViewers); @@ -54,7 +54,7 @@ void CombatTracker::getInterestedViewers(TangibleObject const *defender, std::ve bool interested = true; ServerObject const * const serverObject = *i; - if ( (serverObject == NULL) + if ( (serverObject == nullptr) || (serverObject == defender) || serverObject->isPlayerControlled() || !serverObject->wantSawAttackTriggers()) @@ -65,7 +65,7 @@ void CombatTracker::getInterestedViewers(TangibleObject const *defender, std::ve { TangibleObject const * const tangibleObject = serverObject->asTangibleObject(); - if (tangibleObject != NULL) + if (tangibleObject != nullptr) { if ( tangibleObject->isInCombat() || tangibleObject->isDisabled() @@ -77,7 +77,7 @@ void CombatTracker::getInterestedViewers(TangibleObject const *defender, std::ve { CreatureObject const * const creatureObject = tangibleObject->asCreatureObject(); - if (creatureObject != NULL) + if (creatureObject != nullptr) { if ( creatureObject->isIncapacitated() || creatureObject->isDead()) @@ -88,7 +88,7 @@ void CombatTracker::getInterestedViewers(TangibleObject const *defender, std::ve { AICreatureController const * const aiCreatureController = AICreatureController::asAiCreatureController(creatureObject->getController()); - if (aiCreatureController != NULL) + if (aiCreatureController != nullptr) { if (aiCreatureController->isRetreating()) { @@ -138,7 +138,7 @@ void CombatTracker::update() { TangibleObject const * const attackerTangibleObject = TangibleObject::asTangibleObject(iterAttackers->getObject()); - if (attackerTangibleObject != NULL) + if (attackerTangibleObject != nullptr) { localAttackers.push_back(attackerTangibleObject->getNetworkId()); } @@ -158,7 +158,7 @@ void CombatTracker::update() ServerObject * const combatViewer = *iterCombatViewers; GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(combatViewer); - if (gameScriptObject != NULL) + if (gameScriptObject != nullptr) { ScriptParams scriptParams; scriptParams.addParam(defender->getNetworkId()); diff --git a/engine/server/library/serverGame/src/shared/core/CommunityManager.cpp b/engine/server/library/serverGame/src/shared/core/CommunityManager.cpp index dc479216..cc7f46e5 100755 --- a/engine/server/library/serverGame/src/shared/core/CommunityManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/CommunityManager.cpp @@ -42,14 +42,14 @@ using namespace CommunityManagerNameSpace; //----------------------------------------------------------------------------- PlayerObject *CommunityManagerNameSpace::getPlayerObject(NetworkId const &networkId) { - PlayerObject *result = NULL; + PlayerObject *result = nullptr; Object *object = NetworkIdManager::getObjectById(networkId); - if (object != NULL) + if (object != nullptr) { CreatureObject *creatureObject = dynamic_cast(object); - if (creatureObject != NULL) + if (creatureObject != nullptr) { result = PlayerCreatureController::getPlayerObject(creatureObject); } @@ -61,10 +61,10 @@ PlayerObject *CommunityManagerNameSpace::getPlayerObject(NetworkId const &networ //----------------------------------------------------------------------------- ServerObject *CommunityManagerNameSpace::getServerObject(NetworkId const &networkId) { - ServerObject *result = NULL; + ServerObject *result = nullptr; Object *object = NetworkIdManager::getObjectById(networkId); - if (object != NULL) + if (object != nullptr) { result = dynamic_cast(object); } @@ -77,11 +77,11 @@ void CommunityManagerNameSpace::sendProseChatMessage(NetworkId const &networkId, { Object *object = NetworkIdManager::getObjectById(networkId); - if (object != NULL) + if (object != nullptr) { ServerObject *serverObject = dynamic_cast(object); - if (serverObject != NULL) + if (serverObject != nullptr) { ProsePackage prosePackage; prosePackage.stringId = stringId; @@ -117,7 +117,7 @@ void CommunityManager::handleMessage(ChatOnChangeFriendStatus const &message) PlayerObject *playerObject = getPlayerObject(message.getCharacter()); - if (playerObject != NULL) + if (playerObject != nullptr) { if (message.getAdd()) { @@ -170,7 +170,7 @@ void CommunityManager::handleMessage(ChatOnGetFriendsList const &message) PlayerObject *playerObject = getPlayerObject(message.getCharacter()); - if (playerObject != NULL) + if (playerObject != nullptr) { typedef std::vector StringVector; StringVector friendList; @@ -231,7 +231,7 @@ void CommunityManager::handleMessage(ChatOnChangeIgnoreStatus const &message) PlayerObject *playerObject = getPlayerObject(message.getCharacter()); - if (playerObject != NULL) + if (playerObject != nullptr) { if (message.getIgnore()) { @@ -284,7 +284,7 @@ void CommunityManager::handleMessage(ChatOnGetIgnoreList const &message) PlayerObject *playerObject = getPlayerObject(message.getCharacter()); - if (playerObject != NULL) + if (playerObject != nullptr) { typedef std::vector StringVector; StringVector ignoreList; diff --git a/engine/server/library/serverGame/src/shared/core/ConfigServerGame.cpp b/engine/server/library/serverGame/src/shared/core/ConfigServerGame.cpp index cc5f64d9..03a9061f 100755 --- a/engine/server/library/serverGame/src/shared/core/ConfigServerGame.cpp +++ b/engine/server/library/serverGame/src/shared/core/ConfigServerGame.cpp @@ -528,10 +528,10 @@ void ConfigServerGame::install(void) // GCW score decay time(s) data->gcwScoreDecayTime.clear(); int index = 0; - char const * dayOfWeek = NULL; - char const * hour = NULL; - char const * minute = NULL; - char const * second = NULL; + char const * dayOfWeek = nullptr; + char const * hour = nullptr; + char const * minute = nullptr; + char const * second = nullptr; do { dayOfWeek = ConfigFile::getKeyString("GameServer", "gcwScoreDecayTimeDayOfWeek", index, 0); diff --git a/engine/server/library/serverGame/src/shared/core/ConfigServerGame.h b/engine/server/library/serverGame/src/shared/core/ConfigServerGame.h index 20465d94..0426f519 100755 --- a/engine/server/library/serverGame/src/shared/core/ConfigServerGame.h +++ b/engine/server/library/serverGame/src/shared/core/ConfigServerGame.h @@ -87,7 +87,7 @@ class ConfigServerGame int scriptWatcherInterruptTime; // time in ms (after scriptWatcherWarnTime) before we abort a script int scriptStackErrorLimit; // depth of stack error we assume to be a legit error int scriptStackErrorLevel; // how we handle a stack error: 0=recover, 1=javacore, 2=fatal - bool disableObjvarNullCheck; // flag to disable the check for a null object when get/setting objvars + bool disableObjvarNullCheck; // flag to disable the check for a nullptr object when get/setting objvars // throttle to limit how universe data is sent from // the universe game server to the other game servers; diff --git a/engine/server/library/serverGame/src/shared/core/ContainerInterface.cpp b/engine/server/library/serverGame/src/shared/core/ContainerInterface.cpp index 2fa62423..fdd5c6f2 100755 --- a/engine/server/library/serverGame/src/shared/core/ContainerInterface.cpp +++ b/engine/server/library/serverGame/src/shared/core/ContainerInterface.cpp @@ -68,7 +68,7 @@ namespace ContainerInterfaceNamespace if (creature->getBank() == lastContainer) { - //-- if player is passed in non-null, the found creature must match it + //-- if player is passed in non-nullptr, the found creature must match it if (player && player != creature) return false; @@ -340,8 +340,8 @@ namespace ContainerInterfaceNamespace { // This item is not contained by anything! // This means it is in the world! - // Return null for the source container, but succeed. - sourceContainer = NULL; + // Return nullptr for the source container, but succeed. + sourceContainer = nullptr; return true; } @@ -550,7 +550,7 @@ bool ContainerInterface::canTransferTo(ServerObject *destination, ServerObject & if (transfererCreatureObject->getObjVars().getItem("lotOverlimit.structure_id", lotOverlimitStructure) && lotOverlimitStructure.isValid()) { // determine the destination type - ServerObject const * topmostDestinationParent = NULL; + ServerObject const * topmostDestinationParent = nullptr; ServerObject const * destinationParent = destination; while (destinationParent) { @@ -734,8 +734,8 @@ bool ContainerInterface::transferItemToSlottedContainer(ServerObject &destinatio } } - ServerObject *sourceObject = NULL; - Container *sourceContainer = NULL; + ServerObject *sourceObject = nullptr; + Container *sourceContainer = nullptr; if (!sharedTransferBegin(item, sourceObject, sourceContainer, error)) return false; @@ -829,8 +829,8 @@ bool ContainerInterface::transferItemToVolumeContainer(ServerObject &destination { error = Container::CEC_Success; - ServerObject *sourceObject = NULL; - Container *sourceContainer = NULL; + ServerObject *sourceObject = nullptr; + Container *sourceContainer = nullptr; if (!sharedTransferBegin(item, sourceObject, sourceContainer, error)) return false; @@ -898,8 +898,8 @@ bool ContainerInterface::transferItemToCell(ServerObject &destination, ServerObj { error = Container::CEC_Success; - ServerObject *sourceObject = NULL; - Container *sourceContainer = NULL; + ServerObject *sourceObject = nullptr; + Container *sourceContainer = nullptr; //check source & item if (!sharedTransferBegin(item, sourceObject, sourceContainer, error)) @@ -980,13 +980,13 @@ bool ContainerInterface::transferItemToWorld(ServerObject &item, Transform const return false; } - if (!canTransferTo(NULL, item, transferer, error)) + if (!canTransferTo(nullptr, item, transferer, error)) { return false; } - ServerObject *sourceObject = NULL; - Container *sourceContainer = NULL; + ServerObject *sourceObject = nullptr; + Container *sourceContainer = nullptr; if (!sharedTransferBegin(item, sourceObject, sourceContainer, error)) { @@ -1009,8 +1009,8 @@ bool ContainerInterface::transferItemToWorld(ServerObject &item, Transform const item.setTransform_o2p(pos); - item.onContainerTransferComplete(sourceObject, NULL); - handleTransferScripts(item, sourceObject, NULL, transferer, error); + item.onContainerTransferComplete(sourceObject, nullptr); + handleTransferScripts(item, sourceObject, nullptr, transferer, error); return true; } @@ -1084,7 +1084,7 @@ Object *ContainerInterface::getContainedByObject(Object &obj) ContainedByProperty * const containedBy = getContainedByProperty(obj); if (containedBy) return containedBy->getContainedBy(); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -1094,7 +1094,7 @@ Object const *ContainerInterface::getContainedByObject(Object const &obj) ContainedByProperty const * const containedBy = getContainedByProperty(obj); if (containedBy) return containedBy->getContainedBy(); - return NULL; + return nullptr; } // ----------------------------------------------------------------------- @@ -1180,7 +1180,7 @@ Object const *ContainerInterface::getTopmostContainer(Object const &obj) // ----------------------------------------------------------------------- // Returns the object if it is in the world, or the first parent of the object -// that is in the world. This returns null, if the none of the parents of the object are in the world. +// that is in the world. This returns nullptr, if the none of the parents of the object are in the world. Object *ContainerInterface::getFirstParentInWorld(Object &obj) { @@ -1193,20 +1193,20 @@ Object *ContainerInterface::getFirstParentInWorld(Object &obj) if (!containedBy) { WARNING_STRICT_FATAL(true, ("All objects should have a containedby property")); - return NULL; + return nullptr; } // Is my containedBy property empty? If so I am topmost but am not in the world Object *currentContainer = containedBy->getContainedBy(); if (!currentContainer) { - return NULL; + return nullptr; } - // Does my parent expose contents? If it does, then return NULL since I have been removed from the world. + // Does my parent expose contents? If it does, then return nullptr since I have been removed from the world. if (!getContainer(*currentContainer) || getContainer(*currentContainer)->isContentItemExposedWith(*currentContainer)) { - return NULL; + return nullptr; } // Is my parent in the world? If so, he is topmost @@ -1218,7 +1218,7 @@ Object *ContainerInterface::getFirstParentInWorld(Object &obj) if (!containedBy) { WARNING_STRICT_FATAL(true, ("All objects should have a containedby property")); - return (currentContainer->isInWorld()) ? currentContainer : NULL; + return (currentContainer->isInWorld()) ? currentContainer : nullptr; } // Iterate from here. @@ -1236,12 +1236,12 @@ Object *ContainerInterface::getFirstParentInWorld(Object &obj) if (!containedBy) { WARNING_STRICT_FATAL(true, ("All objects should have a containedby property")); - return NULL; + return nullptr; } nextContainer = containedBy->getContainedBy(); } - return currentContainer->isInWorld() ? currentContainer : NULL; + return currentContainer->isInWorld() ? currentContainer : nullptr; } // ----------------------------------------------------------------------- @@ -1388,7 +1388,7 @@ bool ContainerInterface::onObjectDestroy(ServerObject& item) // currently only c return false; } - handleTransferScripts(item, parentObject, NULL, NULL, error); + handleTransferScripts(item, parentObject, nullptr, nullptr, error); } } return true; diff --git a/engine/server/library/serverGame/src/shared/core/FormManagerServer.cpp b/engine/server/library/serverGame/src/shared/core/FormManagerServer.cpp index 5a1c4b15..7fc312fa 100755 --- a/engine/server/library/serverGame/src/shared/core/FormManagerServer.cpp +++ b/engine/server/library/serverGame/src/shared/core/FormManagerServer.cpp @@ -101,7 +101,7 @@ void FormManagerServer::handleCreateObjectData(NetworkId const & actor, std::str Transform tr; tr.setPosition_p(position); ServerObject * const newObject = ServerWorld::createNewObject(crc, tr, cell, false); - if (newObject == NULL) + if (newObject == nullptr) return; if (cellId == NetworkId::cms_invalid) @@ -114,7 +114,7 @@ void FormManagerServer::handleCreateObjectData(NetworkId const & actor, std::str { //tell script to create the object in it's own special manner (since the datatable requests that) Object * const obj = NetworkIdManager::getObjectById(actor); - ServerObject * const serverObj = obj ? obj->asServerObject() : NULL; + ServerObject * const serverObj = obj ? obj->asServerObject() : nullptr; if(serverObj) { std::vector keys; @@ -151,11 +151,11 @@ void FormManagerServer::handleEditObjectData(NetworkId const & actor, NetworkId return; Object * const actorObj = NetworkIdManager::getObjectById(actor); - ServerObject * const actorServerObj = actorObj ? actorObj->asServerObject() : NULL; + ServerObject * const actorServerObj = actorObj ? actorObj->asServerObject() : nullptr; if(actorServerObj) { Object * const objectToEditObj = NetworkIdManager::getObjectById(objectToEdit); - ServerObject * const objectToEditServerObj = objectToEditObj ? objectToEditObj->asServerObject() : NULL; + ServerObject * const objectToEditServerObj = objectToEditObj ? objectToEditObj->asServerObject() : nullptr; if(objectToEditServerObj) { //get matching form @@ -207,11 +207,11 @@ void FormManagerServer::handleEditObjectData(NetworkId const & actor, NetworkId void FormManagerServer::requestEditObjectDataForClient(NetworkId const & actor, NetworkId const & objectToEdit) { Object * const actorObj = NetworkIdManager::getObjectById(actor); - ServerObject * const actorServerObj = actorObj ? actorObj->asServerObject() : NULL; + ServerObject * const actorServerObj = actorObj ? actorObj->asServerObject() : nullptr; if(actorServerObj) { Object * const objectToEditObj = NetworkIdManager::getObjectById(objectToEdit); - ServerObject * const objectToEditServerObj = objectToEditObj ? objectToEditObj->asServerObject() : NULL; + ServerObject * const objectToEditServerObj = objectToEditObj ? objectToEditObj->asServerObject() : nullptr; if(objectToEditServerObj) { //get matching form @@ -277,8 +277,8 @@ void FormManagerServer::sendEditObjectDataToClient(NetworkId const & client, Net return; Object * const playerObject = NetworkIdManager::getObjectById(client); - ServerObject * const playerServer = playerObject ? playerObject->asServerObject() : NULL; - CreatureObject * const playerCreature = playerServer ? playerServer->asCreatureObject() : NULL; + ServerObject * const playerServer = playerObject ? playerObject->asServerObject() : nullptr; + CreatureObject * const playerCreature = playerServer ? playerServer->asCreatureObject() : nullptr; if(playerCreature) { diff --git a/engine/server/library/serverGame/src/shared/core/GameServer.cpp b/engine/server/library/serverGame/src/shared/core/GameServer.cpp index 865b1078..30af19ef 100755 --- a/engine/server/library/serverGame/src/shared/core/GameServer.cpp +++ b/engine/server/library/serverGame/src/shared/core/GameServer.cpp @@ -317,11 +317,11 @@ namespace GameServerNamespace bool getConfigSetting(const char *section, const char *key, int & value) { const ConfigFile::Section * sec = ConfigFile::getSection(section); - if (sec == NULL) + if (sec == nullptr) return false; const ConfigFile::Key * ky = sec->findKey(key); - if (ky == NULL) + if (ky == nullptr) return false; value = ky->getAsInt(ky->getCount()-1, value); @@ -753,7 +753,7 @@ Client * GameServer::getClient(const NetworkId& networkId) { return i->second; } - return NULL; + return nullptr; } //----------------------------------------------------------------------- @@ -837,7 +837,7 @@ void GameServer::loadTerrain () terrainObject->setDebugName("terrain"); Appearance * const appearance = AppearanceTemplateList::createAppearance(terrainFileName); - if (appearance != NULL) { + if (appearance != nullptr) { terrainObject->setAppearance(appearance); } else { DEBUG_WARNING(true, ("FIX ME: Appearance template for GameServer::loadTerrain missing for %s.", terrainFileName)); @@ -866,7 +866,7 @@ void GameServer::shutdown() m_centralService = 0; m_planetServerConnection = 0; - if (m_customerServiceServerConnection != NULL) + if (m_customerServiceServerConnection != nullptr) { m_customerServiceServerConnection->disconnect(); } @@ -909,7 +909,7 @@ void GameServer::receiveMessage(const MessageDispatch::Emitter & source, const M DEBUG_REPORT_LOG(true, ("GameServer: Creating customer service server connection @ (%s:%d)\n", address.getValue().first.c_str(), address.getValue().second)); - if (m_customerServiceServerConnection != NULL) + if (m_customerServiceServerConnection != nullptr) { m_customerServiceServerConnection->disconnect(); } @@ -949,7 +949,7 @@ void GameServer::receiveMessage(const MessageDispatch::Emitter & source, const M std::vector const & baselines = m.getData(); - ServerObject * lastObject = NULL; + ServerObject * lastObject = nullptr; for (std::vector::const_iterator i=baselines.begin(); i!=baselines.end(); ++i) { @@ -1286,7 +1286,7 @@ void GameServer::receiveMessage(const MessageDispatch::Emitter & source, const M if (topmostContainer != object) { - WARNING(true, ("Denying authority transfer for (%s) from game server (%lu) to game server (%lu) because it is contained by (%s)", object->getDebugInformation().c_str(), GameServer::getInstance().getProcessId(), t.getProcess(), (topmostContainer ? topmostContainer->getDebugInformation().c_str() : "NULL"))); + WARNING(true, ("Denying authority transfer for (%s) from game server (%lu) to game server (%lu) because it is contained by (%s)", object->getDebugInformation().c_str(), GameServer::getInstance().getProcessId(), t.getProcess(), (topmostContainer ? topmostContainer->getDebugInformation().c_str() : "nullptr"))); allowed = false; @@ -1425,11 +1425,11 @@ void GameServer::receiveMessage(const MessageDispatch::Emitter & source, const M bool appended = false; ServerObject * const target = safe_cast(NetworkIdManager::getObjectById(c.getNetworkId())); - if (target != NULL) + if (target != nullptr) { // valid target, get its controller ServerController * const controller = safe_cast(target->getController()); - if (controller != NULL) + if (controller != nullptr) { uint32 flags = c.getFlags(); if(flags & GameControllerMessageFlags::DEST_AUTH_SERVER) @@ -1473,7 +1473,7 @@ void GameServer::receiveMessage(const MessageDispatch::Emitter & source, const M ri = static_cast(message).getByteStream().begin(); EndBaselinesMessage const t(ri); ServerObject * const object = ServerWorld::findUninitializedObjectByNetworkId(t.getId()); - if (object != NULL) + if (object != nullptr) { DEBUG_REPORT_LOG(ConfigServerGame::getLogObjectLoading(), ("Received EndBaselinesMessage for %s\n", t.getId().getValueString().c_str())); ServerController * const controller = dynamic_cast(object->getController()); @@ -1778,7 +1778,7 @@ void GameServer::receiveMessage(const MessageDispatch::Emitter & source, const M } else { - LOG("mounts-bug", ("GS::SceneTransferMessage: server id=[%d],rider id=[%s] has RidingMount state but getMountedCreature() returns NULL.", static_cast(getProcessId()), obj->getNetworkId().getValueString().c_str())); + LOG("mounts-bug", ("GS::SceneTransferMessage: server id=[%d],rider id=[%s] has RidingMount state but getMountedCreature() returns nullptr.", static_cast(getProcessId()), obj->getNetworkId().getValueString().c_str())); objAsCreature->emergencyDismountForRider(); } } @@ -2297,7 +2297,7 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const if (creatureObj->isAuthoritative()) { AICreatureController const * const aiCreatureController = AICreatureController::asAiCreatureController(creatureObj->getController()); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { continue; } @@ -2359,7 +2359,7 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const #endif std::string time = FormattedString<1024>().sprintf("(%3d,%5dms) %30s.%-2lu (%3lu) on %35s:%-7d (%lu) ", ObjectTracker::getNumPlayers(), static_cast(Clock::frameTime()*1000), ServerWorld::getSceneId().c_str(), m_preloadAreaId, m_processId, hostName.c_str(), Os::getProcessId(), ServerClock::getInstance().getGameTimeSeconds()); - time += CalendarTime::convertEpochToTimeStringGMT(::time(NULL)); + time += CalendarTime::convertEpochToTimeStringGMT(::time(nullptr)); GenericValueTypeMessage > > rsctr( "ReportSystemClockTimeResponse", std::make_pair(msg.getValue().first, std::make_pair(time, msg.getValue().second))); @@ -2378,7 +2378,7 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const ri = static_cast(message).getByteStream().begin(); GenericValueTypeMessage > const msg(ri); - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); std::string time = FormattedString<1024>().sprintf("%30s.%-2lu (%3lu) (%lu) (%ld, ", ServerWorld::getSceneId().c_str(), m_preloadAreaId, m_processId, ServerClock::getInstance().getGameTimeSeconds(), timeNow); time += CalendarTime::convertEpochToTimeStringGMT(timeNow); time += ")"; @@ -2404,7 +2404,7 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const } else { - time += " (terrainObject is NULL)"; + time += " (terrainObject is nullptr)"; } GenericValueTypeMessage > > rptr( @@ -2596,7 +2596,7 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const bool removeCurrentCitizenDeleted; bool removeCurrentCitizenInactive; bool hasDeclaredResidence; - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); bool const citizenInactivePackupActive = (ConfigServerGame::getCityCitizenshipInactivePackupStartTimeEpoch() <= timeNow); std::map, CitizenInfo> const & allCitizens = CityInterface::getAllCitizensInfo(); for (std::map >::iterator iterCityId = s_clusterStartupResidenceStructureListByCity.begin(); iterCityId != s_clusterStartupResidenceStructureListByCity.end(); ++iterCityId) @@ -2614,7 +2614,7 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const if (currentCityMayor.isValid()) currentCityMayorCitizenInfo = CityInterface::getCitizenInfo(iterCityId->first, currentCityMayor); else - currentCityMayorCitizenInfo = NULL; + currentCityMayorCitizenInfo = nullptr; if (currentCityMayorCitizenInfo) currentCityMayorName = currentCityMayorCitizenInfo->m_citizenName; @@ -2958,7 +2958,7 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const ScriptDictionaryPtr dictionary; responseObject->getScriptObject()->makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(responseObject->getNetworkId(), "foundObject", dictionary->getSerializedData(), 0, false); @@ -3140,11 +3140,11 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const CreatureObject * const creatureObject = CreatureObject::getCreatureObject(networkId); - if (creatureObject != NULL) + if (creatureObject != nullptr) { Controller * const controller = creatureObject->getController(); - if (controller != NULL) + if (controller != nullptr) { DEBUG_LOG("debug_ai", ("GameServer::receiveMessage() Received AiCreatureStateMessage for networkId(%s) movementType(%s)", networkId.getValueString().c_str(), AiMovementBase::getMovementString(movement.getMovementType()))); @@ -3211,7 +3211,7 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); PlayedTimeAccumMessage const ptam(ri); Object * obj = NetworkIdManager::getObjectById(ptam.getNetworkId()); - if (obj != NULL && obj->asServerObject() != NULL && obj->asServerObject()->asCreatureObject() != NULL) + if (obj != nullptr && obj->asServerObject() != nullptr && obj->asServerObject()->asCreatureObject() != nullptr) { CreatureObject * target = obj->asServerObject()->asCreatureObject(); PlayerObject *targetPlayer = target->asPlayerObject(); @@ -3260,13 +3260,13 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const // get the attacker Object * obj = NetworkIdManager::getObjectById(msg.getSource()); - if (obj != NULL && obj->asServerObject() != NULL && obj->asServerObject()->asCreatureObject() != NULL) + if (obj != nullptr && obj->asServerObject() != nullptr && obj->asServerObject()->asCreatureObject() != nullptr) { CreatureObject * attacker = obj->asServerObject()->asCreatureObject(); // get the target obj = NetworkIdManager::getObjectById(msg.getTarget()); - if (obj != NULL && obj->asServerObject() != NULL && obj->asServerObject()->asTangibleObject() != NULL) + if (obj != nullptr && obj->asServerObject() != nullptr && obj->asServerObject()->asTangibleObject() != nullptr) { TangibleObject * defender = obj->asServerObject()->asTangibleObject(); if (attacker->isAuthoritative()) @@ -3597,7 +3597,7 @@ bool GameServer::isPlanetEnabledForCluster(std::string const &sceneName) const void GameServerNamespace::broadCastHyperspaceOnWarp(ServerObject const * const owner) { - // warpingClient can be NULL if the owner is AI + // warpingClient can be nullptr if the owner is AI Client const * const warpingClient = owner->getClient(); typedef std::map > DistributionList; @@ -4098,13 +4098,13 @@ void GameServer::sendToConnectionServers(GameNetworkMessage const &message) void GameServer::sendToCustomerServiceServer(GameNetworkMessage const &message) { - if (m_customerServiceServerConnection != NULL) + if (m_customerServiceServerConnection != nullptr) { m_customerServiceServerConnection->send(message, true); } else { - REPORT_LOG(true, ("GameServer::sendToCustomerServiceServer() ERROR: Unable to send to NULL customer service server connection\n")); + REPORT_LOG(true, ("GameServer::sendToCustomerServiceServer() ERROR: Unable to send to nullptr customer service server connection\n")); } } @@ -4112,12 +4112,12 @@ void GameServer::sendToCustomerServiceServer(GameNetworkMessage const &message) void GameServer::clearCustomerServiceServerConnection() { - if (m_customerServiceServerConnection != NULL) + if (m_customerServiceServerConnection != nullptr) { m_customerServiceServerConnection->disconnect(); } - m_customerServiceServerConnection = NULL; + m_customerServiceServerConnection = nullptr; } // ---------------------------------------------------------------------- @@ -4600,7 +4600,7 @@ void GameServer::handleCharacterCreateNameVerification(const VerifyNameResponse { Container::ContainedItem itemId = container->getObjectInSlot(slot, tmp); Object* appearanceInventory = itemId.getObject(); - if(appearanceInventory == NULL) + if(appearanceInventory == nullptr) { WARNING(true, ("Player %s has lost their appearance inventory", newCharacterObject->getNetworkId().getValueString().c_str())); appearanceInventory = ServerWorld::createNewObject(s_appearanceTemplate, *newCharacterObject, slot, false); @@ -4663,7 +4663,7 @@ void GameServer::handleVerifyAndLockNameVerification(const VerifyNameResponse &v params.addParam(errorText.c_str(), "reason"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(vrn.getCharacterId(), "renameCharacterNameValidationFail", dictionary->getSerializedData(), 0, false); @@ -4943,7 +4943,7 @@ bool GameServer::addPendingLoadRequest(NetworkId const & id) if (s_pendingLoadRequests.find(id) != s_pendingLoadRequests.end()) return false; - s_pendingLoadRequests[id] = (unsigned int)::time(NULL); + s_pendingLoadRequests[id] = (unsigned int)::time(nullptr); return true; } @@ -5113,11 +5113,11 @@ void GameServerNamespace::loadRetroactiveCtsHistory() { int index = 0; - char const * pszCtsDataFromConfig = NULL; + char const * pszCtsDataFromConfig = nullptr; do { - pszCtsDataFromConfig = ConfigFile::getKeyString("GameServer", "retroactiveCtsHistory", index++, NULL); - if (pszCtsDataFromConfig != NULL) + pszCtsDataFromConfig = ConfigFile::getKeyString("GameServer", "retroactiveCtsHistory", index++, nullptr); + if (pszCtsDataFromConfig != nullptr) { ctsDataFromConfig.push_back(pszCtsDataFromConfig); } @@ -5196,7 +5196,7 @@ void GameServerNamespace::loadRetroactiveCtsHistory() else { ctsDataFromConfigTokens.clear(); - if ((Unicode::tokenize(Unicode::narrowToWide(*iterCtsDataFromConfig), ctsDataFromConfigTokens, &ctsDataFromConfigDelimiter, NULL)) && (ctsDataFromConfigTokens.size() == 7)) + if ((Unicode::tokenize(Unicode::narrowToWide(*iterCtsDataFromConfig), ctsDataFromConfigTokens, &ctsDataFromConfigDelimiter, nullptr)) && (ctsDataFromConfigTokens.size() == 7)) { // sanity check ctsDataFromConfigParsedData = FormattedString<2048>().sprintf("%s|%s|%s|%s|%s|%s|%s", Unicode::wideToNarrow(ctsDataFromConfigTokens[0]).c_str(), Unicode::wideToNarrow(ctsDataFromConfigTokens[1]).c_str(), Unicode::wideToNarrow(ctsDataFromConfigTokens[2]).c_str(), Unicode::wideToNarrow(ctsDataFromConfigTokens[3]).c_str(), Unicode::wideToNarrow(ctsDataFromConfigTokens[4]).c_str(), Unicode::wideToNarrow(ctsDataFromConfigTokens[5]).c_str(), Unicode::wideToNarrow(ctsDataFromConfigTokens[6]).c_str()); @@ -5225,7 +5225,7 @@ void GameServerNamespace::loadRetroactiveCtsHistory() FATAL(((sourceCharacterInfo.sourceCharacterBornDate > 0) && (sourceCharacterInfo.sourceCharacterBornDate < 907)), ("source character (%s, %s) has born date (%d) < 907", sourceCharacterInfo.sourceCluster.c_str(), sourceCharacterInfo.sourceCharacterId.getValueString().c_str(), sourceCharacterInfo.sourceCharacterBornDate)); FATAL((sourceCharacterInfo.sourceCharacterBornDate > currentBornDate), ("source character (%s, %s) has born date (%d) > current born date (%d)", sourceCharacterInfo.sourceCluster.c_str(), sourceCharacterInfo.sourceCharacterId.getValueString().c_str(), sourceCharacterInfo.sourceCharacterBornDate, currentBornDate)); - std::map > * clusterCtsHistory = NULL; + std::map > * clusterCtsHistory = nullptr; #ifdef _DEBUG IGNORE_RETURN(allCtsSourceCluster.insert(sourceCharacterInfo.sourceCluster)); clusterCtsHistory = &(s_retroactiveCtsHistoryList[targetCluster]); @@ -5381,11 +5381,11 @@ void GameServerNamespace::loadRetroactivePlayerCityCreationTime() { int index = 0; - char const * pszPlayerCityCreationTimeDataFromConfig = NULL; + char const * pszPlayerCityCreationTimeDataFromConfig = nullptr; do { - pszPlayerCityCreationTimeDataFromConfig = ConfigFile::getKeyString("GameServer", "retroactivePlayerCityCreationTime", index++, NULL); - if (pszPlayerCityCreationTimeDataFromConfig != NULL) + pszPlayerCityCreationTimeDataFromConfig = ConfigFile::getKeyString("GameServer", "retroactivePlayerCityCreationTime", index++, nullptr); + if (pszPlayerCityCreationTimeDataFromConfig != nullptr) { playerCityCreationTimeDataFromConfig.push_back(pszPlayerCityCreationTimeDataFromConfig); } @@ -5427,7 +5427,7 @@ void GameServerNamespace::loadRetroactivePlayerCityCreationTime() else { playerCityCreationTimeDataFromConfigTokens.clear(); - if ((Unicode::tokenize(Unicode::narrowToWide(*iterPlayerCityCreationTimeDataFromConfig), playerCityCreationTimeDataFromConfigTokens, &playerCityCreationTimeDataFromConfigDelimiter, NULL)) && (playerCityCreationTimeDataFromConfigTokens.size() == 3)) + if ((Unicode::tokenize(Unicode::narrowToWide(*iterPlayerCityCreationTimeDataFromConfig), playerCityCreationTimeDataFromConfigTokens, &playerCityCreationTimeDataFromConfigDelimiter, nullptr)) && (playerCityCreationTimeDataFromConfigTokens.size() == 3)) { // sanity check playerCityCreationTimeDataFromConfigParsedData = FormattedString<2048>().sprintf("%s|%s|%s", Unicode::wideToNarrow(playerCityCreationTimeDataFromConfigTokens[0]).c_str(), Unicode::wideToNarrow(playerCityCreationTimeDataFromConfigTokens[1]).c_str(), Unicode::wideToNarrow(playerCityCreationTimeDataFromConfigTokens[2]).c_str()); @@ -5449,7 +5449,7 @@ void GameServerNamespace::loadRetroactivePlayerCityCreationTime() ++iterPlayerCityCreationTimeDataFromConfig; } - std::map * clusterPlayerCityCreationTimeHistory = NULL; + std::map * clusterPlayerCityCreationTimeHistory = nullptr; #ifdef _DEBUG clusterPlayerCityCreationTimeHistory = &(s_retroactivePlayerCityCreationTime[cluster]); #else @@ -5475,7 +5475,7 @@ void GameServerNamespace::loadRetroactivePlayerCityCreationTime() bool GameServerNamespace::checkAndSetOutstandingRequestSceneTransfer(ServerObject & object) { - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); // don't send multiple RequestSceneTransfer message if (object.getObjVars().hasItem(OBJVAR_HAS_OUTSTANDING_REQUEST_SCENE_TRANSFER) && (object.getObjVars().getType(OBJVAR_HAS_OUTSTANDING_REQUEST_SCENE_TRANSFER) == DynamicVariable::INT)) @@ -5846,7 +5846,7 @@ void GameServerNamespace::handleAccountFeatureIdResponse(AccountFeatureIdRespons std::string GameServer::getRetroactiveCtsHistory(std::string const & clusterName, NetworkId const & characterId) { std::string result; - std::map > const * clusterCtsHistory = NULL; + std::map > const * clusterCtsHistory = nullptr; #ifdef _DEBUG std::map > >::const_iterator const iterFindCluster = s_retroactiveCtsHistoryList.find(clusterName); @@ -5901,7 +5901,7 @@ void GameServer::setRetroactiveCtsHistory(CreatureObject & player) if (!playerObject->isAuthoritative()) return; - std::map > const * clusterCtsHistory = NULL; + std::map > const * clusterCtsHistory = nullptr; #ifdef _DEBUG std::map > >::const_iterator const iterFindCluster = s_retroactiveCtsHistoryList.find(GameServer::getInstance().getClusterName()); @@ -5990,7 +5990,7 @@ std::vector > const *> const static std::vector > const *> returnValue; returnValue.clear(); - std::map > const * clusterCtsHistory = NULL; + std::map > const * clusterCtsHistory = nullptr; #ifdef _DEBUG std::map > >::const_iterator const iterFindCluster = s_retroactiveCtsHistoryList.find(GameServer::getInstance().getClusterName()); @@ -6028,7 +6028,7 @@ std::vector > const *> const time_t GameServer::getRetroactivePlayerCityCreationTime(std::string const & clusterName, int cityId) { - std::map const * clusterPlayerCityCreationTimeHistory = NULL; + std::map const * clusterPlayerCityCreationTimeHistory = nullptr; #ifdef _DEBUG std::map >::const_iterator const iterFindCluster = s_retroactivePlayerCityCreationTime.find(clusterName); diff --git a/engine/server/library/serverGame/src/shared/core/GameServer.h b/engine/server/library/serverGame/src/shared/core/GameServer.h index c3036761..2723090a 100755 --- a/engine/server/library/serverGame/src/shared/core/GameServer.h +++ b/engine/server/library/serverGame/src/shared/core/GameServer.h @@ -92,10 +92,10 @@ public: uint32 getProcessId () const; uint32 getPreloadAreaId () const; virtual void receiveMessage (const MessageDispatch::Emitter & source, const MessageDispatch::MessageBase & message); - bool requestSceneWarp (const CachedNetworkId &objectId, const std::string &sceneName, const Vector &newPosition_w, const NetworkId &newContainer, const Vector &newPosition_p, const char * scriptCallback = NULL, bool forceLoadScreen = false); - bool requestSceneWarp (const CachedNetworkId &objectId, const std::string &sceneName, const Vector &newPosition_w, const NetworkId &newBuilding, const std::string &newCellName, const Vector &newPosition_p, const char * scriptCallback = NULL, bool forceLoadScreen = false); - bool requestSceneWarpDelayed (const CachedNetworkId &objectId, const std::string &sceneName, const Vector &newPosition_w, const NetworkId &newContainer, const Vector &newPosition_p, float delayTime, const char * scriptCallback = NULL, bool forceLoadScreen = false); - bool requestSceneWarpDelayed (const CachedNetworkId &objectId, const std::string &sceneName, const Vector &newPosition_w, const NetworkId &newBuilding, const std::string &newCellName, const Vector &newPosition_p, float delayTime, const char * scriptCallback = NULL, bool forceLoadScreen = false); + bool requestSceneWarp (const CachedNetworkId &objectId, const std::string &sceneName, const Vector &newPosition_w, const NetworkId &newContainer, const Vector &newPosition_p, const char * scriptCallback = nullptr, bool forceLoadScreen = false); + bool requestSceneWarp (const CachedNetworkId &objectId, const std::string &sceneName, const Vector &newPosition_w, const NetworkId &newBuilding, const std::string &newCellName, const Vector &newPosition_p, const char * scriptCallback = nullptr, bool forceLoadScreen = false); + bool requestSceneWarpDelayed (const CachedNetworkId &objectId, const std::string &sceneName, const Vector &newPosition_w, const NetworkId &newContainer, const Vector &newPosition_p, float delayTime, const char * scriptCallback = nullptr, bool forceLoadScreen = false); + bool requestSceneWarpDelayed (const CachedNetworkId &objectId, const std::string &sceneName, const Vector &newPosition_w, const NetworkId &newBuilding, const std::string &newCellName, const Vector &newPosition_p, float delayTime, const char * scriptCallback = nullptr, bool forceLoadScreen = false); static void run (); void sendToCentralServer (GameNetworkMessage const &message); diff --git a/engine/server/library/serverGame/src/shared/core/InstantDeleteList.cpp b/engine/server/library/serverGame/src/shared/core/InstantDeleteList.cpp index a96e6cfa..4e645492 100755 --- a/engine/server/library/serverGame/src/shared/core/InstantDeleteList.cpp +++ b/engine/server/library/serverGame/src/shared/core/InstantDeleteList.cpp @@ -20,7 +20,7 @@ // ====================================================================== -InstantDeleteList::ListType *InstantDeleteList::ms_theList = NULL; +InstantDeleteList::ListType *InstantDeleteList::ms_theList = nullptr; // ====================================================================== @@ -47,7 +47,7 @@ void InstantDeleteList::install() void InstantDeleteList::remove() { delete ms_theList; - ms_theList = NULL; + ms_theList = nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/core/LogoutTracker.cpp b/engine/server/library/serverGame/src/shared/core/LogoutTracker.cpp index 77454c88..5d49ac3a 100755 --- a/engine/server/library/serverGame/src/shared/core/LogoutTracker.cpp +++ b/engine/server/library/serverGame/src/shared/core/LogoutTracker.cpp @@ -87,7 +87,7 @@ void LogoutTracker::add(NetworkId const &networkId) } // set the callback - getScheduler().setCallback(handleLogoutCallback, NULL, ConfigServerGame::getUnsafeLogoutTimeMs()); + getScheduler().setCallback(handleLogoutCallback, nullptr, ConfigServerGame::getUnsafeLogoutTimeMs()); } // ---------------------------------------------------------------------- @@ -223,7 +223,7 @@ ServerObject *LogoutTracker::findPendingCharacterSave(const NetworkId &character return obj; } else - return NULL; + return nullptr; } // ====================================================================== diff --git a/engine/server/library/serverGame/src/shared/core/MessageToQueue.cpp b/engine/server/library/serverGame/src/shared/core/MessageToQueue.cpp index 005a6260..847b6ff6 100755 --- a/engine/server/library/serverGame/src/shared/core/MessageToQueue.cpp +++ b/engine/server/library/serverGame/src/shared/core/MessageToQueue.cpp @@ -88,7 +88,7 @@ namespace MessageToQueueNamespace typedef std::set SchedulerItemsType; typedef std::vector FrameMessagesType; - MessageToQueue * ms_instance=NULL; + MessageToQueue * ms_instance=nullptr; LastKnownLocationsType ms_lastKnownLocations; ObjectLocatorsType ms_objectLocators; SchedulerItemsType ms_schedulerItems; @@ -134,7 +134,7 @@ void MessageToQueue::install() void MessageToQueue::remove() { delete ms_instance; - ms_instance = NULL; + ms_instance = nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/core/NameManager.cpp b/engine/server/library/serverGame/src/shared/core/NameManager.cpp index 6366130f..65453d39 100755 --- a/engine/server/library/serverGame/src/shared/core/NameManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/NameManager.cpp @@ -27,7 +27,7 @@ // ====================================================================== -NameManager *NameManager::ms_instance = NULL; +NameManager *NameManager::ms_instance = nullptr; // ====================================================================== @@ -45,14 +45,14 @@ void NameManager::remove() { NOT_NULL(ms_instance); delete ms_instance; - ms_instance = NULL; + ms_instance = nullptr; } // ---------------------------------------------------------------------- NameManager::NameManager() : m_nameGenerators (new NameGeneratorMapType), - m_reservedNames (NULL), + m_reservedNames (nullptr), m_nameToIdMap (new NameToIdMapType), m_idToCharacterDataMap(new IdToCharacterDataMapType) { @@ -72,20 +72,20 @@ NameManager::~NameManager() delete i->second; } delete m_nameGenerators; - m_nameGenerators = NULL; + m_nameGenerators = nullptr; delete m_reservedNames; - m_reservedNames = NULL; + m_reservedNames = nullptr; delete m_nameToIdMap; - m_nameToIdMap = NULL; + m_nameToIdMap = nullptr; delete m_idToCharacterDataMap; - m_idToCharacterDataMap = NULL; + m_idToCharacterDataMap = nullptr; } // ---------------------------------------------------------------------- const NameGenerator & NameManager::getNameGenerator(const std::string &directory, const std::string &nameTable) const { - NameGenerator *generator=NULL; + NameGenerator *generator=nullptr; NOT_NULL(m_nameGenerators); NameGeneratorMapType::const_iterator i=m_nameGenerators->find(NameTableIdentifier(directory,nameTable)); if (i==m_nameGenerators->end()) @@ -204,7 +204,7 @@ void NameManager::addPlayer(const NetworkId &id, uint32 stationId, const std::st { createTime = static_cast(getPlayerCreateTime(id)); if (createTime <= 0) - createTime = ::time(NULL); + createTime = ::time(nullptr); } characterData.createTime = createTime; @@ -212,7 +212,7 @@ void NameManager::addPlayer(const NetworkId &id, uint32 stationId, const std::st { lastLoginTime = static_cast(getPlayerLastLoginTime(id)); if (lastLoginTime <= 0) - lastLoginTime = ::time(NULL); + lastLoginTime = ::time(nullptr); } characterData.lastLoginTime = lastLoginTime; @@ -382,7 +382,7 @@ void NameManager::getPlayerWithLastLoginTimeAfterDistribution(std::map >::iterator iter = result.begin(); iter != result.end(); ++iter) iter->second.second = 0; - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); for (IdToCharacterDataMapType::const_iterator i = m_idToCharacterDataMap->begin(); i != m_idToCharacterDataMap->end(); ++i) { int const lastLoginTimeSecondsAgo = std::max(static_cast(0), static_cast(timeNow - static_cast(i->second.lastLoginTime))); @@ -439,7 +439,7 @@ void NameManager::getPlayerWithCreateTimeAfterDistribution(std::map >::iterator iter = result.begin(); iter != result.end(); ++iter) iter->second.second = 0; - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); for (IdToCharacterDataMapType::const_iterator i = m_idToCharacterDataMap->begin(); i != m_idToCharacterDataMap->end(); ++i) { int const createTimeSecondsAgo = std::max(static_cast(0), static_cast(timeNow - static_cast(i->second.createTime))); diff --git a/engine/server/library/serverGame/src/shared/core/NewbieTutorial.cpp b/engine/server/library/serverGame/src/shared/core/NewbieTutorial.cpp index 4388ad2a..98fdebc8 100755 --- a/engine/server/library/serverGame/src/shared/core/NewbieTutorial.cpp +++ b/engine/server/library/serverGame/src/shared/core/NewbieTutorial.cpp @@ -257,10 +257,10 @@ void NewbieTutorial::getNonFreeObjectsForDeletion(const Container* const contain { const CachedNetworkId & itemId = *i; ServerObject * item = safe_cast(itemId.getObject()); - if (item != NULL) + if (item != nullptr) { TangibleObject *itemTangible = item->asTangibleObject(); - if (itemTangible != NULL) + if (itemTangible != nullptr) { const char *templateName = itemTangible->getSharedTemplateName(); if (!FileManifest::contains(templateName)) @@ -273,7 +273,7 @@ void NewbieTutorial::getNonFreeObjectsForDeletion(const Container* const contain { // see if the item is a container and go through its contents const Container * const itemContainer = ContainerInterface::getContainer(*item); - if (itemContainer != NULL) + if (itemContainer != nullptr) getNonFreeObjectsForDeletion(itemContainer, objectsToDelete, character); } } diff --git a/engine/server/library/serverGame/src/shared/core/NpcConversation.cpp b/engine/server/library/serverGame/src/shared/core/NpcConversation.cpp index bc457bbd..e3c56b3e 100755 --- a/engine/server/library/serverGame/src/shared/core/NpcConversation.cpp +++ b/engine/server/library/serverGame/src/shared/core/NpcConversation.cpp @@ -81,7 +81,7 @@ NpcConversation::NpcConversation(TangibleObject & player, TangibleObject & npc, NpcConversation::~NpcConversation() { TangibleObject * const player = safe_cast(m_player.getObject()); - if (player != NULL) + if (player != nullptr) { MessageQueueStopNpcConversation * const message = new MessageQueueStopNpcConversation; @@ -110,13 +110,13 @@ void NpcConversation::sendMessage(const Response & npcMessage, const Unicode::St TangibleObject * const player = safe_cast(m_player.getObject()); TangibleObject * const npc = safe_cast(m_npc.getObject()); - if (player == NULL) + if (player == nullptr) { - if (npc != NULL) + if (npc != nullptr) npc->removeConversation(m_player); return; } - if (npc == NULL) + if (npc == nullptr) { player->endNpcConversation(); return; @@ -216,13 +216,13 @@ void NpcConversation::sendResponses() const int count = static_cast(m_responses->size()); - if (player == NULL) + if (player == nullptr) { - if (npc != NULL) + if (npc != nullptr) npc->removeConversation(m_player); return; } - if (npc == NULL) + if (npc == nullptr) { player->endNpcConversation(); return; diff --git a/engine/server/library/serverGame/src/shared/core/ObserveTracker.cpp b/engine/server/library/serverGame/src/shared/core/ObserveTracker.cpp index 78fe2d74..95bc6594 100755 --- a/engine/server/library/serverGame/src/shared/core/ObserveTracker.cpp +++ b/engine/server/library/serverGame/src/shared/core/ObserveTracker.cpp @@ -353,14 +353,14 @@ void ObserveTracker::onObjectContainerChanged(ServerObject &obj) bool isObservedWith = (newContainer->getContainerProperty() ? newContainer->getContainerProperty()->isContentItemObservedWith(obj) : false); CellProperty * newContainerCell = newContainer->getCellProperty(); ServerObject const * newContainerContainer = safe_cast(ContainerInterface::getContainedByObject(*newContainer)); - if (newContainerCell == NULL || newContainerContainer != NULL) + if (newContainerCell == nullptr || newContainerContainer != nullptr) { std::set const &newObservers = newContainer->getObservers(); for (std::set::const_iterator i = newObservers.begin(); i != newObservers.end(); ++i) { if (isObservedWith || (*i)->getOpenedContainers().count(newContainer) || - (newContainerCell != NULL && shouldObserveCellContentsDueToClientContainmentChain(**i, *newContainerContainer))) + (newContainerCell != nullptr && shouldObserveCellContentsDueToClientContainmentChain(**i, *newContainerContainer))) { IGNORE_RETURN(observe(**i, obj)); } diff --git a/engine/server/library/serverGame/src/shared/core/PlayerCreationManagerServer.cpp b/engine/server/library/serverGame/src/shared/core/PlayerCreationManagerServer.cpp index 9b2d5d2e..62cc2fb3 100755 --- a/engine/server/library/serverGame/src/shared/core/PlayerCreationManagerServer.cpp +++ b/engine/server/library/serverGame/src/shared/core/PlayerCreationManagerServer.cpp @@ -122,7 +122,7 @@ bool PlayerCreationManagerServer::setupPlayer(CreatureObject & obj, const std::s else { //Attach insurance variables here: - if (item->asTangibleObject() != NULL) + if (item->asTangibleObject() != nullptr) item->asTangibleObject()->setUninsurable(true); } } @@ -204,7 +204,7 @@ bool PlayerCreationManagerServer::setupPlayer(CreatureObject & obj, const std::s for (size_t i = 0; i < numSkills; ++i) { const SkillObject * skill = SkillManager::getInstance().getSkill(bounty_skills[i]); - if (skill != NULL) + if (skill != nullptr) obj.grantSkill(*skill); } } diff --git a/engine/server/library/serverGame/src/shared/core/PositionUpdateTracker.cpp b/engine/server/library/serverGame/src/shared/core/PositionUpdateTracker.cpp index 5d95b59b..a28ee96b 100755 --- a/engine/server/library/serverGame/src/shared/core/PositionUpdateTracker.cpp +++ b/engine/server/library/serverGame/src/shared/core/PositionUpdateTracker.cpp @@ -122,7 +122,7 @@ bool PositionUpdateTracker::shouldSendPositionUpdate(ServerObject const &obj) return false; ServerObject const *containedByObj = safe_cast(ContainerInterface::getContainedByObject(obj)); - CreatureObject const *creatureContainer = (containedByObj ? containedByObj->asCreatureObject() : NULL); + CreatureObject const *creatureContainer = (containedByObj ? containedByObj->asCreatureObject() : nullptr); bool const objectIsRidingMount = (creatureContainer && creatureContainer->isMountable()); if (containedByObj && !isContainerConsideredPersisted(obj, *containedByObj) && !objectIsRidingMount) @@ -204,7 +204,7 @@ void PositionUpdateTracker::sendPositionUpdate(ServerObject &obj) else { ServerObject const * const container = safe_cast(ContainerInterface::getContainedByObject(obj)); - CreatureObject const * const creatureContainer = (container ? container->asCreatureObject() : NULL); + CreatureObject const * const creatureContainer = (container ? container->asCreatureObject() : nullptr); if (creatureContainer && creatureContainer->isMountable()) { // Riders of mounts persist at the location of the mount diff --git a/engine/server/library/serverGame/src/shared/core/RegexList.cpp b/engine/server/library/serverGame/src/shared/core/RegexList.cpp index 5244818e..29c7ae32 100755 --- a/engine/server/library/serverGame/src/shared/core/RegexList.cpp +++ b/engine/server/library/serverGame/src/shared/core/RegexList.cpp @@ -55,7 +55,7 @@ RegexList::Entry::Entry(char const *pattern, bool matchWords, char const *reason char const *errorString = 0; int errorOffset = 0; - m_pcre = pcre_compile(pattern, 0, &errorString, &errorOffset, NULL); + m_pcre = pcre_compile(pattern, 0, &errorString, &errorOffset, nullptr); WARNING(!m_pcre, ("failed to compile regex pattern [%s] into a pcre regex.", pattern)); } @@ -175,7 +175,7 @@ bool RegexList::doesStringMatch(const Unicode::String &name, std::string &ruleDe std::vector::iterator nameIter; for (nameIter = names.begin(); nameIter != names.end(); ++nameIter) { - int const returnCode = pcre_exec(compiledRegex, NULL, nameIter->c_str(), nameIter->length(), 0, 0, captureData, dataElementCount); + int const returnCode = pcre_exec(compiledRegex, nullptr, nameIter->c_str(), nameIter->length(), 0, 0, captureData, dataElementCount); if (returnCode >= 0) { ruleDescription = entry->getReason(); @@ -187,7 +187,7 @@ bool RegexList::doesStringMatch(const Unicode::String &name, std::string &ruleDe } else { - int const returnCode = pcre_exec(compiledRegex, NULL, testName.c_str(), testName.length(), 0, 0, captureData, dataElementCount); + int const returnCode = pcre_exec(compiledRegex, nullptr, testName.c_str(), testName.length(), 0, 0, captureData, dataElementCount); if (returnCode >= 0) { ruleDescription = entry->getReason(); diff --git a/engine/server/library/serverGame/src/shared/core/ReportManager.cpp b/engine/server/library/serverGame/src/shared/core/ReportManager.cpp index 4bac637e..b73e89ff 100755 --- a/engine/server/library/serverGame/src/shared/core/ReportManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/ReportManager.cpp @@ -247,7 +247,7 @@ void ReportManager::handleMessage(ChatOnRequestLog const &chatOnRequestLog) CreatureObject * const reportingCreatureObject = CreatureObject::asCreatureObject(NetworkIdManager::getObjectById(reportData.m_reportingNetworkId)); PlayerObject * const reportingPlayerObject = PlayerCreatureController::getPlayerObject(reportingCreatureObject); - if (reportingPlayerObject != NULL) + if (reportingPlayerObject != nullptr) { // Make sure the chat log does not have any extra data in it @@ -297,7 +297,7 @@ void ReportManager::handleMessage(ChatOnRequestLog const &chatOnRequestLog) } if ( !foundHarassingPlayer - && (reportingCreatureObject != NULL)) + && (reportingCreatureObject != nullptr)) { // No harassing player match @@ -345,7 +345,7 @@ void ReportManager::handleMessage(ChatOnRequestLog const &chatOnRequestLog) target.str = reportData.m_harassingName; prosePackage.target = target; - if (reportingCreatureObject != NULL) + if (reportingCreatureObject != nullptr) { Chat::sendSystemMessage(*reportingCreatureObject, prosePackage); } diff --git a/engine/server/library/serverGame/src/shared/core/SceneGlobalData.cpp b/engine/server/library/serverGame/src/shared/core/SceneGlobalData.cpp index 5a7c12b8..5c25017b 100755 --- a/engine/server/library/serverGame/src/shared/core/SceneGlobalData.cpp +++ b/engine/server/library/serverGame/src/shared/core/SceneGlobalData.cpp @@ -113,7 +113,7 @@ SceneData * SceneGlobalDataNamespace::getSceneDataByName(std::string const & sce if (i!=ms_SceneDataItems.end()) return i->second; else - return NULL; + return nullptr; } // ====================================================================== diff --git a/engine/server/library/serverGame/src/shared/core/ServerBuffBuilderManager.cpp b/engine/server/library/serverGame/src/shared/core/ServerBuffBuilderManager.cpp index 829055b8..fcf18e02 100755 --- a/engine/server/library/serverGame/src/shared/core/ServerBuffBuilderManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/ServerBuffBuilderManager.cpp @@ -58,7 +58,7 @@ void ServerBuffBuilderManager::remove() ms_installed = false; delete ms_callback; - ms_callback = NULL; + ms_callback = nullptr; } //----------------------------------------------------------------------------- @@ -73,12 +73,12 @@ bool ServerBuffBuilderManager::makeChanges(SharedBuffBuilderManager::Session con NetworkId const & recipientId = session.recipientId; Object * const recipientObj = NetworkIdManager::getObjectById(recipientId); - ServerObject * const recipientServerObj = recipientObj ? recipientObj->asServerObject() : NULL; - CreatureObject * const recipient = recipientServerObj ? recipientServerObj->asCreatureObject() : NULL; + ServerObject * const recipientServerObj = recipientObj ? recipientObj->asServerObject() : nullptr; + CreatureObject * const recipient = recipientServerObj ? recipientServerObj->asCreatureObject() : nullptr; NetworkId const & bufferId = session.bufferId; Object * const bufferObj = NetworkIdManager::getObjectById(bufferId); - ServerObject * const bufferServerObj = bufferObj ? bufferObj->asServerObject() : NULL; - CreatureObject * const buffer = bufferServerObj ? bufferServerObj->asCreatureObject() : NULL; + ServerObject * const bufferServerObj = bufferObj ? bufferObj->asServerObject() : nullptr; + CreatureObject * const buffer = bufferServerObj ? bufferServerObj->asCreatureObject() : nullptr; if(buffer && recipient) { sendSessionToScript(session, session.bufferId, static_cast(Scripting::TRIG_BUFF_BUILDER_COMPLETED)); @@ -93,11 +93,11 @@ void ServerBuffBuilderManager::sendSessionToScriptForValidation(SharedBuffBuilde NetworkId const & bufferId = session.bufferId; NetworkId const & recipientId = session.recipientId; Object const * const bufferObj = NetworkIdManager::getObjectById(bufferId); - ServerObject const * const bufferServer = bufferObj ? bufferObj->asServerObject() : NULL; - CreatureObject const * const buffer = bufferServer ? bufferServer->asCreatureObject() : NULL; + ServerObject const * const bufferServer = bufferObj ? bufferObj->asServerObject() : nullptr; + CreatureObject const * const buffer = bufferServer ? bufferServer->asCreatureObject() : nullptr; Object * const recipientObj = NetworkIdManager::getObjectById(recipientId); - ServerObject * const recipientServer = recipientObj ? recipientObj->asServerObject() : NULL; - CreatureObject * const recipient = recipientServer ? recipientServer->asCreatureObject() : NULL; + ServerObject * const recipientServer = recipientObj ? recipientObj->asServerObject() : nullptr; + CreatureObject * const recipient = recipientServer ? recipientServer->asCreatureObject() : nullptr; if(buffer && recipient) { sendSessionToScript(session, session.bufferId, static_cast(Scripting::TRIG_BUFF_BUILDER_VALIDATE)); @@ -109,7 +109,7 @@ void ServerBuffBuilderManager::sendSessionToScriptForValidation(SharedBuffBuilde void ServerBuffBuilderManager::sendSessionToScript(SharedBuffBuilderManager::Session const & session, NetworkId const & objectToTriggerId, int const trigger) { Object * const objectToTrigger = NetworkIdManager::getObjectById(objectToTriggerId); - ServerObject * const serverObjectToTrigger = objectToTrigger ? objectToTrigger->asServerObject() : NULL; + ServerObject * const serverObjectToTrigger = objectToTrigger ? objectToTrigger->asServerObject() : nullptr; if(serverObjectToTrigger) { GameScriptObject * const scriptObject = serverObjectToTrigger->getScriptObject(); @@ -144,7 +144,7 @@ void ServerBuffBuilderManager::cancelSession(NetworkId const & bufferId, Network { //send the cancel message to the buffer Object * const bufferObject = NetworkIdManager::getObjectById(bufferId); - Controller * const bufferController = bufferObject ? bufferObject->getController() : NULL; + Controller * const bufferController = bufferObject ? bufferObject->getController() : nullptr; if(bufferController) { BuffBuilderChangeMessage * outMsg = new BuffBuilderChangeMessage(); @@ -157,7 +157,7 @@ void ServerBuffBuilderManager::cancelSession(NetworkId const & bufferId, Network //send the cancel message to the recipient Object * const recipientObject = NetworkIdManager::getObjectById(recipientId); - Controller * const recipientController = recipientObject ? recipientObject->getController() : NULL; + Controller * const recipientController = recipientObject ? recipientObject->getController() : nullptr; if(recipientController && bufferController != recipientController) { BuffBuilderChangeMessage * outMsg = new BuffBuilderChangeMessage(); @@ -169,7 +169,7 @@ void ServerBuffBuilderManager::cancelSession(NetworkId const & bufferId, Network } //send cancel trigger to buffer player - ServerObject * const bufferServerObject = bufferObject ? bufferObject->asServerObject() : NULL; + ServerObject * const bufferServerObject = bufferObject ? bufferObject->asServerObject() : nullptr; if(bufferServerObject) { GameScriptObject * const scriptObject = bufferServerObject->getScriptObject(); @@ -181,7 +181,7 @@ void ServerBuffBuilderManager::cancelSession(NetworkId const & bufferId, Network } //send cancel trigger to recipient player - ServerObject * const recipientServerObject = recipientObject ? recipientObject->asServerObject() : NULL; + ServerObject * const recipientServerObject = recipientObject ? recipientObject->asServerObject() : nullptr; if(recipientServerObject && recipientServerObject != bufferServerObject) { GameScriptObject * const scriptObject = recipientServerObject->getScriptObject(); diff --git a/engine/server/library/serverGame/src/shared/core/ServerBuildoutManager.cpp b/engine/server/library/serverGame/src/shared/core/ServerBuildoutManager.cpp index f371ee83..e38943e1 100755 --- a/engine/server/library/serverGame/src/shared/core/ServerBuildoutManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/ServerBuildoutManager.cpp @@ -81,8 +81,8 @@ namespace ServerBuildoutManagerNamespace struct ServerEventAreaInfo { ServerEventAreaInfo(): - buildOut(NULL), - loadedObject(NULL) + buildOut(nullptr), + loadedObject(nullptr) { } @@ -892,7 +892,7 @@ void ServerBuildoutManagerNamespace::instantiateAreaNode(AreaInfo const &areaInf ServerEventMap::iterator searchIter = s_eventObjects.find(buildoutRow.m_eventRequired); if(searchIter != s_eventObjects.end()) { - ServerEventAreaInfo newEventObj(&buildoutRow, NULL); + ServerEventAreaInfo newEventObj(&buildoutRow, nullptr); (*searchIter).second.push_back(newEventObj); } else @@ -947,7 +947,7 @@ void ServerBuildoutManagerNamespace::instantiateAreaNode(AreaInfo const &areaInf newObject->setAuthority(); - if (newObject->asTangibleObject() != NULL) + if (newObject->asTangibleObject() != nullptr) newObject->asTangibleObject()->initializeVisibility(); // @@ -1033,7 +1033,7 @@ void ServerBuildoutManagerNamespace::instantiateAreaNode(AreaInfo const &areaInf { GameScriptObject * const gso = newObject->getScriptObject(); - if (NULL != gso) + if (nullptr != gso) { std::string const &scripts = buildoutRow.m_scripts; unsigned int pos = 0; @@ -1077,7 +1077,7 @@ void ServerBuildoutManagerNamespace::instantiateAreaNode(AreaInfo const &areaInf if ( controllerObjectId.isValid() ) { ServerObject * const controllerObject = safe_cast(NetworkIdManager::getObjectById(controllerObjectId)); - if (NULL != controllerObject) + if (nullptr != controllerObject) { GameScriptObject * const script = controllerObject->getScriptObject(); @@ -1092,7 +1092,7 @@ void ServerBuildoutManagerNamespace::instantiateAreaNode(AreaInfo const &areaInf { if (registerWithController) { - if (NULL != script) + if (nullptr != script) { ScriptParams p; p.addParam(obj->getNetworkId()); @@ -1279,7 +1279,7 @@ void ServerBuildoutManager::onEventStarted(std::string const & eventName) newObject->setAuthority(); - if (newObject->asTangibleObject() != NULL) + if (newObject->asTangibleObject() != nullptr) newObject->asTangibleObject()->initializeVisibility(); // @@ -1369,7 +1369,7 @@ void ServerBuildoutManager::onEventStarted(std::string const & eventName) { GameScriptObject * const gso = newObject->getScriptObject(); - if (NULL != gso) + if (nullptr != gso) { std::string const &scripts = buildoutRow.m_scripts; unsigned int pos = 0; @@ -1407,7 +1407,7 @@ void ServerBuildoutManager::onEventStarted(std::string const & eventName) if ( controllerObjectId.isValid() ) { ServerObject * const controllerObject = safe_cast(NetworkIdManager::getObjectById(controllerObjectId)); - if (NULL != controllerObject) + if (nullptr != controllerObject) { GameScriptObject * const script = controllerObject->getScriptObject(); @@ -1422,7 +1422,7 @@ void ServerBuildoutManager::onEventStarted(std::string const & eventName) { if (registerWithController) { - if (NULL != script) + if (nullptr != script) { ScriptParams p; p.addParam(obj->getNetworkId()); @@ -1483,7 +1483,7 @@ void ServerBuildoutManager::onEventStopped(std::string const & eventName) object->unload(); - (*objIter).loadedObject = NULL; + (*objIter).loadedObject = nullptr; } } } diff --git a/engine/server/library/serverGame/src/shared/core/ServerImageDesignerManager.cpp b/engine/server/library/serverGame/src/shared/core/ServerImageDesignerManager.cpp index fe976e69..2fd9b849 100755 --- a/engine/server/library/serverGame/src/shared/core/ServerImageDesignerManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/ServerImageDesignerManager.cpp @@ -56,8 +56,8 @@ namespace ServerImageDesignerManagerNamespace { NetworkId const & nid = payload.first; Object * const o = NetworkIdManager::getObjectById(nid); - ServerObject * const so = o ? o->asServerObject() : NULL; - CreatureObject * const creature = so ? so->asCreatureObject() : NULL; + ServerObject * const so = o ? o->asServerObject() : nullptr; + CreatureObject * const creature = so ? so->asCreatureObject() : nullptr; if (creature) { ObjectTemplate const * const tmp = creature->getSharedTemplate(); @@ -157,7 +157,7 @@ void ServerImageDesignerManager::remove() ms_genderSpeciesToAllowBald.clear(); delete ms_callback; - ms_callback = NULL; + ms_callback = nullptr; } //----------------------------------------------------------------------------- @@ -172,12 +172,12 @@ bool ServerImageDesignerManager::makeChanges(SharedImageDesignerManager::Session NetworkId const & recipientId = session.recipientId; Object * const recipientObj = NetworkIdManager::getObjectById(recipientId); - ServerObject * const recipientServerObj = recipientObj ? recipientObj->asServerObject() : NULL; - CreatureObject * const recipient = recipientServerObj ? recipientServerObj->asCreatureObject() : NULL; + ServerObject * const recipientServerObj = recipientObj ? recipientObj->asServerObject() : nullptr; + CreatureObject * const recipient = recipientServerObj ? recipientServerObj->asCreatureObject() : nullptr; NetworkId const & designerId = session.designerId; Object * const designerObj = NetworkIdManager::getObjectById(designerId); - ServerObject * const designerServerObj = designerObj ? designerObj->asServerObject() : NULL; - CreatureObject * const designer = designerServerObj ? designerServerObj->asCreatureObject() : NULL; + ServerObject * const designerServerObj = designerObj ? designerObj->asServerObject() : nullptr; + CreatureObject * const designer = designerServerObj ? designerServerObj->asCreatureObject() : nullptr; if(designer && recipient) { @@ -332,8 +332,8 @@ bool ServerImageDesignerManager::makeChanges(SharedImageDesignerManager::Session SlotId const slot = SlotIdManager::findSlotId (ConstCharCrcLowerString (cms_hairSlotName)); Container::ContainerErrorCode tmp = Container::CEC_Success; Object * const originalHairObject = slotted->getObjectInSlot(slot, tmp).getObject(); - ServerObject * const originalHairServerObject = originalHairObject ? originalHairObject->asServerObject() : NULL; - TangibleObject * const orignalHair = originalHairServerObject ? originalHairServerObject->asTangibleObject() : NULL; + ServerObject * const originalHairServerObject = originalHairObject ? originalHairObject->asServerObject() : nullptr; + TangibleObject * const orignalHair = originalHairServerObject ? originalHairServerObject->asTangibleObject() : nullptr; std::string originalHairCustomizationData; if(orignalHair) { @@ -434,8 +434,8 @@ SharedImageDesignerManager::SkillMods ServerImageDesignerManager::getSkillModsFo } Object const * const o = NetworkIdManager::getObjectById(designerId); - ServerObject const * const so = o ? o->asServerObject() : NULL; - CreatureObject const * const designer = so ? so->asCreatureObject() : NULL; + ServerObject const * const so = o ? o->asServerObject() : nullptr; + CreatureObject const * const designer = so ? so->asCreatureObject() : nullptr; if(designer) { skillMods.bodySkillMod = designer->getModValue(SharedImageDesignerManager::cms_bodySkillModName); @@ -466,7 +466,7 @@ void ServerImageDesignerManager::updateGradualCustomizations(CreatureObject * ta //do this one immediately SlotId const slot = SlotIdManager::findSlotId (ConstCharCrcLowerString (cms_hairCustomizationName.c_str())); ServerObject * const hair = ServerWorld::createNewObject(i->second.templateName, *target, slot, true); - TangibleObject * const tangibleHair = hair ? hair->asTangibleObject() : NULL; + TangibleObject * const tangibleHair = hair ? hair->asTangibleObject() : nullptr; if(tangibleHair) { //first set hair color to colors from old hair (if any) @@ -503,11 +503,11 @@ void ServerImageDesignerManager::sendSessionToScriptForValidation(SharedImageDes NetworkId const & designerId = session.designerId; NetworkId const & recipientId = session.recipientId; Object const * const designerObj = NetworkIdManager::getObjectById(designerId); - ServerObject const * const designerServer = designerObj ? designerObj->asServerObject() : NULL; - CreatureObject const * const designer = designerServer ? designerServer->asCreatureObject() : NULL; + ServerObject const * const designerServer = designerObj ? designerObj->asServerObject() : nullptr; + CreatureObject const * const designer = designerServer ? designerServer->asCreatureObject() : nullptr; Object * const recipientObj = NetworkIdManager::getObjectById(recipientId); - ServerObject * const recipientServer = recipientObj ? recipientObj->asServerObject() : NULL; - CreatureObject * const recipient = recipientServer ? recipientServer->asCreatureObject() : NULL; + ServerObject * const recipientServer = recipientObj ? recipientObj->asServerObject() : nullptr; + CreatureObject * const recipient = recipientServer ? recipientServer->asCreatureObject() : nullptr; if(designer && recipient) { sendSessionToScript(session, session.designerId, static_cast(Scripting::TRIG_IMAGE_DESIGN_VALIDATE)); @@ -519,7 +519,7 @@ void ServerImageDesignerManager::sendSessionToScriptForValidation(SharedImageDes void ServerImageDesignerManager::sendSessionToScript(SharedImageDesignerManager::Session const & session, NetworkId const & objectToTriggerId, int const trigger) { Object * const objectToTrigger = NetworkIdManager::getObjectById(objectToTriggerId); - ServerObject * const serverObjectToTrigger = objectToTrigger ? objectToTrigger->asServerObject() : NULL; + ServerObject * const serverObjectToTrigger = objectToTrigger ? objectToTrigger->asServerObject() : nullptr; if(serverObjectToTrigger) { GameScriptObject * const scriptObject = serverObjectToTrigger->getScriptObject(); @@ -571,11 +571,11 @@ CustomizationData * ServerImageDesignerManager::fetchCustomizationDataForCustomi if(customization.isVarHairColor) { ServerObject * const hair = creature.getHair(); - TangibleObject * const tangibleHair = hair ? hair->asTangibleObject() : NULL; + TangibleObject * const tangibleHair = hair ? hair->asTangibleObject() : nullptr; if(tangibleHair) objectToQuery = tangibleHair; else - return NULL; + return nullptr; } return objectToQuery->fetchCustomizationData(); } @@ -586,7 +586,7 @@ void ServerImageDesignerManager::cancelSession(NetworkId const & designerId, Net { //send the cancel message to the designer Object * const designerObject = NetworkIdManager::getObjectById(designerId); - Controller * const designerController = designerObject ? designerObject->getController() : NULL; + Controller * const designerController = designerObject ? designerObject->getController() : nullptr; if(designerController) { ImageDesignChangeMessage * outMsg = new ImageDesignChangeMessage(); @@ -599,7 +599,7 @@ void ServerImageDesignerManager::cancelSession(NetworkId const & designerId, Net //send the cancel message to the recipient Object * const recipientObject = NetworkIdManager::getObjectById(recipientId); - Controller * const recipientController = recipientObject ? recipientObject->getController() : NULL; + Controller * const recipientController = recipientObject ? recipientObject->getController() : nullptr; if(recipientController && designerController != recipientController) { ImageDesignChangeMessage * outMsg = new ImageDesignChangeMessage(); @@ -611,7 +611,7 @@ void ServerImageDesignerManager::cancelSession(NetworkId const & designerId, Net } //send cancel trigger to designer player - ServerObject * const designerServerObject = designerObject ? designerObject->asServerObject() : NULL; + ServerObject * const designerServerObject = designerObject ? designerObject->asServerObject() : nullptr; if(designerServerObject) { GameScriptObject * const scriptObject = designerServerObject->getScriptObject(); @@ -623,7 +623,7 @@ void ServerImageDesignerManager::cancelSession(NetworkId const & designerId, Net } //send cancel trigger to recipient player - ServerObject * const recipientServerObject = recipientObject ? recipientObject->asServerObject() : NULL; + ServerObject * const recipientServerObject = recipientObject ? recipientObject->asServerObject() : nullptr; if(recipientServerObject && recipientServerObject != designerServerObject) { GameScriptObject * const scriptObject = recipientServerObject->getScriptObject(); @@ -644,8 +644,8 @@ void ServerImageDesignerManager::cancelSession(NetworkId const & designerId, Net std::map ServerImageDesignerManager::getHairCustomizations(SharedImageDesignerManager::Session const & session) { Object * const o = NetworkIdManager::getObjectById(session.recipientId); - ServerObject * const so = o ? o->asServerObject() : NULL; - CreatureObject * const recipient = so ? so->asCreatureObject() : NULL; + ServerObject * const so = o ? o->asServerObject() : nullptr; + CreatureObject * const recipient = so ? so->asCreatureObject() : nullptr; CustomizationManager::Customization customization; bool result = false; std::map hairCustomizations; diff --git a/engine/server/library/serverGame/src/shared/core/ServerUIManager.cpp b/engine/server/library/serverGame/src/shared/core/ServerUIManager.cpp index f94b1eee..be9ccc62 100755 --- a/engine/server/library/serverGame/src/shared/core/ServerUIManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/ServerUIManager.cpp @@ -105,7 +105,7 @@ int ServerUIManager::createPage(const std::string& pageName, const ServerObject& return pageId; ServerUIPage * const serverUIPage = ServerUIManager::getPage(pageId); - if (serverUIPage != NULL) + if (serverUIPage != nullptr) { serverUIPage->setCallback(callbackFunction); return pageId; @@ -153,7 +153,7 @@ ServerUIPage* ServerUIManager::getPage(int pageId) { std::map::const_iterator iterFind = m_pages.find(pageId); if (iterFind == m_pages.end()) - return NULL; + return nullptr; else return iterFind->second; } @@ -163,7 +163,7 @@ ServerUIPage* ServerUIManager::getPage(int pageId) bool ServerUIManager::showPage(int pageId) { ServerUIPage * const page = getPage(pageId); - if (page != NULL) + if (page != nullptr) return showPage(*page); WARNING(true, ("ServerUIManager::showPage(%d) invalid page", pageId)); @@ -175,14 +175,14 @@ bool ServerUIManager::showPage(int pageId) bool ServerUIManager::showPage(ServerUIPage & page) { Client * const client = page.getClient(); - if (client == NULL) + if (client == nullptr) { -// WARNING(true, ("ServerUIManager::showPage attempt to show page on null client")); +// WARNING(true, ("ServerUIManager::showPage attempt to show page on nullptr client")); return false; } ServerObject const * const characterObject = client->getCharacterObject(); - if (characterObject == NULL) + if (characterObject == nullptr) { WARNING(true, ("ServerUIManager::showPage attempt to show page to client with no character object")); return false; @@ -219,11 +219,11 @@ bool ServerUIManager::closePage(int pageId) { //send close_page message const ServerUIPage * const page = getPage(pageId); - if(page == NULL) + if(page == nullptr) return false; Client * const client = page->getClient(); - if(client == NULL) + if(client == nullptr) return false; SuiForceClosePage msg; @@ -239,7 +239,7 @@ bool ServerUIManager::removePage(int pageId) { //send close_page message const ServerUIPage * const page = getPage(pageId); - if(page == NULL) + if(page == nullptr) return false; NetworkId const & primaryControlledObject = page->getPrimaryControlledObject(); @@ -275,11 +275,11 @@ void ServerUIManager::receiveMessage(const MessageDispatch::MessageBase& message int const pageId = suiEventNotification.getPageId(); ServerUIPage const * const page = getPage(pageId); - if (page == NULL) + if (page == nullptr) return; Client * const client = page->getClient(); - if (client == NULL) + if (client == nullptr) { removePage(pageId); return; @@ -287,9 +287,9 @@ void ServerUIManager::receiveMessage(const MessageDispatch::MessageBase& message ServerObject * const characterObject = client->getCharacterObject(); - if (characterObject == NULL) + if (characterObject == nullptr) { - WARNING(true, ("ServerUIManager::recieveMessage got SuiEventNotification for null character object")); + WARNING(true, ("ServerUIManager::recieveMessage got SuiEventNotification for nullptr character object")); removePage(pageId); return; } @@ -300,15 +300,15 @@ void ServerUIManager::receiveMessage(const MessageDispatch::MessageBase& message ServerObject * const ownerObject = ServerWorld::findObjectByNetworkId(suiPageDataServer.getOwnerId()); - if (ownerObject == NULL) + if (ownerObject == nullptr) { - WARNING(true, ("ServerUIManager::recieveMessage got SuiEventNotification for null owner object")); + WARNING(true, ("ServerUIManager::recieveMessage got SuiEventNotification for nullptr owner object")); removePage(pageId); return; } GameScriptObject * const gso = ownerObject->getScriptObject(); - if (gso == NULL) + if (gso == nullptr) { WARNING(true, ("ServerUIManager::recieveMessage got SuiEventNotification for owner object with no scripts")); removePage(pageId); @@ -318,7 +318,7 @@ void ServerUIManager::receiveMessage(const MessageDispatch::MessageBase& message int const eventIndex = suiEventNotification.getSubscribedEventIndex(); SuiCommand const * const command = suiPageData.findSubscribeToEventCommandByIndex(eventIndex); - if (command == NULL) + if (command == nullptr) { WARNING(true, ("ServerUIManager::recieveMessage got SuiEventNotification invalid notification index [%d]", eventIndex)); return; @@ -385,7 +385,7 @@ void ServerUIManager::receiveMessage(const MessageDispatch::MessageBase& message ScriptDictionaryPtr sd; //it allocates sd, we have to clean it up later gso->makeScriptDictionary(sp, sd); - if(sd.get() == NULL) + if(sd.get() == nullptr) return; //call the script callback function diff --git a/engine/server/library/serverGame/src/shared/core/ServerUIPage.cpp b/engine/server/library/serverGame/src/shared/core/ServerUIPage.cpp index 289f1ada..1fc5e64a 100755 --- a/engine/server/library/serverGame/src/shared/core/ServerUIPage.cpp +++ b/engine/server/library/serverGame/src/shared/core/ServerUIPage.cpp @@ -36,7 +36,7 @@ m_pageDataServer(pageDataServer) ServerUIPage::~ServerUIPage() { delete m_pageDataServer; - m_pageDataServer = NULL; + m_pageDataServer = nullptr; } //----------------------------------------------------------------------- @@ -52,19 +52,19 @@ Client* ServerUIPage::getClient() const if(!object) { WARNING(true, ("ServerUIPage PrimaryControlledObject doesn't exist")); - return NULL; + return nullptr; } ServerObject *const serverObject = object->asServerObject(); if(!serverObject) { WARNING(true, ("ServerUIPage PrimaryControlledObject isn't a server object")); - return NULL; + return nullptr; } Client * const result = serverObject->getClient(); if(!result) { WARNING(true, ("ServerUIPage PrimaryControlledObject has no client yet")); - return NULL; + return nullptr; } return result; } @@ -74,9 +74,9 @@ Client* ServerUIPage::getClient() const ServerObject* ServerUIPage::getOwner() const { Object * const object = NetworkIdManager::getObjectById(getPageDataServer().getOwnerId()); - if (object != NULL) + if (object != nullptr) return object->asServerObject(); - return NULL; + return nullptr; } //----------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/core/ServerUniverse.cpp b/engine/server/library/serverGame/src/shared/core/ServerUniverse.cpp index 9729c039..29f8e60e 100755 --- a/engine/server/library/serverGame/src/shared/core/ServerUniverse.cpp +++ b/engine/server/library/serverGame/src/shared/core/ServerUniverse.cpp @@ -65,15 +65,15 @@ ServerUniverse::ServerUniverse() : m_universeProcess (0), m_nextCheckTimer (static_cast(ConfigServerGame::getUniverseCheckFrequencySeconds())), m_doImmediateCheck (false), - m_thisPlanet (NULL), - m_tatooinePlanet (NULL), + m_thisPlanet (nullptr), + m_tatooinePlanet (nullptr), m_planetNameMap (new PlanetNameMap), m_resourceTypeNameMap (new ResourceTypeNameMap), m_resourceTypeIdMap (new ResourceTypeIdMap), m_importedResourceTypeIdMap(new ResourceTypeIdMap), m_resourcesToSend (new ResourcesToSendType), - m_masterGuildObject (NULL), - m_masterCityObject (NULL), + m_masterGuildObject (nullptr), + m_masterCityObject (nullptr), m_theaterNameIdMap (new TheaterNameIdMap), m_theaterIdNameMap (new TheaterIdNameMap), m_populationList (new PopulationList), @@ -152,7 +152,7 @@ ResourceTypeObject *ServerUniverse::getResourceTypeByName(std::string const & na ResourceTypeObject * ServerUniverse::getResourceTypeById(NetworkId const & id) const { if (id==NetworkId::cms_invalid) - return NULL; + return nullptr; if (id.getValue() <= NetworkId::cms_maxNetworkIdWithoutClusterId) { @@ -160,7 +160,7 @@ ResourceTypeObject * ServerUniverse::getResourceTypeById(NetworkId const & id) c if (i!=m_resourceTypeIdMap->end()) return (*i).second; else - return NULL; + return nullptr; } else { @@ -168,7 +168,7 @@ ResourceTypeObject * ServerUniverse::getResourceTypeById(NetworkId const & id) c if (i!=m_importedResourceTypeIdMap->end()) return (*i).second; else - return NULL; + return nullptr; } } @@ -177,13 +177,13 @@ ResourceTypeObject * ServerUniverse::getResourceTypeById(NetworkId const & id) c ResourceTypeObject * ServerUniverse::getImportedResourceTypeById(NetworkId const & id) const { if (id==NetworkId::cms_invalid) - return NULL; + return nullptr; ResourceTypeIdMap::const_iterator i=m_importedResourceTypeIdMap->find(id); if (i!=m_importedResourceTypeIdMap->end()) return (*i).second; else - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -329,7 +329,7 @@ void ServerUniverse::createProxiesOnServer(std::vector const & remotePro LOG("UniverseLoading", ("Game Server %lu sent UniverseComplete to Game Servers %s.", GameServer::getInstance().getProcessId(), serverListAsString.c_str())); if (ConfigServerGame::getTimeoutToAckUniverseDataReceived() > 0) - m_timeUniverseDataSent = ::time(NULL); + m_timeUniverseDataSent = ::time(nullptr); } } else @@ -519,7 +519,7 @@ std::string ServerUniverse::generateRandomResourceName(const std::string &nameTa std::string newName(Unicode::wideToNarrow(NameManager::getInstance().generateRandomName("name_resource",nameTable))); // name generator always builds ASCII names, although it returns a Unicode string int failCount = 0; UNREF(failCount); // because of Windows release build - for(; getResourceTypeByName(newName) != NULL; newName = Unicode::wideToNarrow(NameManager::getInstance().generateRandomName("name_resource",nameTable))) // generate names until we find an unused one + for(; getResourceTypeByName(newName) != nullptr; newName = Unicode::wideToNarrow(NameManager::getInstance().generateRandomName("name_resource",nameTable))) // generate names until we find an unused one DEBUG_FATAL(++failCount > 100,("Failed to generate an unused resource name in 100 tries.\n")); return newName; @@ -725,7 +725,7 @@ void ServerUniverse::update(float frameTime) { if (!m_pendingUniverseLoadedAckList.empty()) { - time_t const nowTime = ::time(NULL); + time_t const nowTime = ::time(nullptr); int const secondsSinceUniverseDataSent = (int)(nowTime - m_timeUniverseDataSent); // don't wait forever for ack from another game server @@ -866,7 +866,7 @@ void ServerUniverse::handleAddResourceTypeMessage(AddResourceTypeMessage const & const NetworkId & ServerUniverse::findTheaterId(const std::string & name) { - if (m_theaterNameIdMap == NULL) + if (m_theaterNameIdMap == nullptr) return NetworkId::cms_invalid; TheaterNameIdMap::const_iterator result = m_theaterNameIdMap->find(name); @@ -882,7 +882,7 @@ const std::string & ServerUniverse::findTheaterName(const NetworkId & id) { static const std::string emptyString; - if (m_theaterIdNameMap == NULL) + if (m_theaterIdNameMap == nullptr) return emptyString; TheaterIdNameMap::const_iterator result = m_theaterIdNameMap->find(id); @@ -924,9 +924,9 @@ bool ServerUniverse::remoteSetTheater(const std::string & name, const NetworkId return false; } - if (m_theaterNameIdMap != NULL) + if (m_theaterNameIdMap != nullptr) m_theaterNameIdMap->insert(std::make_pair(name, id)); - if (m_theaterIdNameMap != NULL) + if (m_theaterIdNameMap != nullptr) m_theaterIdNameMap->insert(std::make_pair(id, name)); return true; } @@ -953,9 +953,9 @@ void ServerUniverse::remoteClearTheater(const std::string & name) { const NetworkId & id = findTheaterId(name); - if (m_theaterNameIdMap != NULL) + if (m_theaterNameIdMap != nullptr) m_theaterNameIdMap->erase(name); - if (m_theaterIdNameMap != NULL) + if (m_theaterIdNameMap != nullptr) m_theaterIdNameMap->erase(id); } diff --git a/engine/server/library/serverGame/src/shared/core/ServerWorld.cpp b/engine/server/library/serverGame/src/shared/core/ServerWorld.cpp index fefa1117..3b76b5db 100755 --- a/engine/server/library/serverGame/src/shared/core/ServerWorld.cpp +++ b/engine/server/library/serverGame/src/shared/core/ServerWorld.cpp @@ -415,7 +415,7 @@ class AuthoritativeNonPlayerCreatureFilter: public SpatialSubdivisionFilterisAuthoritative() && object->asCreatureObject() != NULL && !object->isPlayerControlled()); } + return (object->isAuthoritative() && object->asCreatureObject() != nullptr && !object->isPlayerControlled()); } }; class TriggerVolumeFilter: public SpatialSubdivisionFilter @@ -905,26 +905,26 @@ ManufactureSchematicObject* ServerWorld::createNewManufacturingSchematic ( bool persisted) { CreatureObject * const creature = dynamic_cast(creator.getObject()); - if (creature == NULL) - return NULL; + if (creature == nullptr) + return nullptr; PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); - if (player == NULL) - return NULL; + if (player == nullptr) + return nullptr; const DraftSchematicObject * const draftSchematic = player->getCurrentDraftSchematic(); - if (draftSchematic == NULL) - return NULL; + if (draftSchematic == nullptr) + return nullptr; ManufactureSchematicObject * const manfSchematic = draftSchematic->createManufactureSchematic(creator); - if (manfSchematic == NULL) - return NULL; + if (manfSchematic == nullptr) + return nullptr; if (createNewObjectIntermediate(manfSchematic, container, slotId, - persisted) == NULL) + persisted) == nullptr) { delete manfSchematic; - return NULL; + return nullptr; } return manfSchematic; @@ -948,15 +948,15 @@ ManufactureSchematicObject* ServerWorld::createNewManufacturingSchematic ( { ManufactureSchematicObject * const manfSchematic = source.createManufactureSchematic(CachedNetworkId::cms_cachedInvalid); - if (manfSchematic == NULL) - return NULL; + if (manfSchematic == nullptr) + return nullptr; Transform transform; transform.setPosition_p(position); - if (createNewObjectIntermediate(manfSchematic, transform, 0, persisted) == NULL) + if (createNewObjectIntermediate(manfSchematic, transform, 0, persisted) == nullptr) { delete manfSchematic; - return NULL; + return nullptr; } return manfSchematic; @@ -980,11 +980,11 @@ ManufactureSchematicObject* ServerWorld::createNewManufacturingSchematic ( { ManufactureSchematicObject * const manfSchematic = source.createManufactureSchematic(CachedNetworkId::cms_cachedInvalid); - if (manfSchematic == NULL) - return NULL; + if (manfSchematic == nullptr) + return nullptr; - if (createNewObjectIntermediate(manfSchematic, container, persisted, false) == NULL) - return NULL; + if (createNewObjectIntermediate(manfSchematic, container, persisted, false) == nullptr) + return nullptr; return manfSchematic; } // ServerWorld::createNewManufacturingSchematic @@ -1008,11 +1008,11 @@ ServerObject* ServerWorld::createNewObjectIntermediate(ServerObject *newObject, if (newObject->getNetworkId() == NetworkId::cms_invalid) { WARNING_STRICT_FATAL(true, ("Tried to create an object with network id 0.")); - return NULL; + return nullptr; } NetworkController *objectController = dynamic_cast(newObject->getController()); - if (objectController == NULL) + if (objectController == nullptr) objectController = dynamic_cast(newObject->createDefaultController()); NOT_NULL(objectController); @@ -1022,7 +1022,7 @@ ServerObject* ServerWorld::createNewObjectIntermediate(ServerObject *newObject, if (!newObject->serverObjectInitializeFirstTimeObject(cell, transform)) { delete newObject; - return NULL; + return nullptr; } // prevent initial object data from being re-sent as deltas @@ -1057,11 +1057,11 @@ ServerObject* ServerWorld::createNewObjectIntermediate(ServerObject* newObject, if (newObject->getNetworkId() == NetworkId::cms_invalid) { WARNING_STRICT_FATAL(true, ("Tried to create an object with network id 0.")); - return NULL; + return nullptr; } NetworkController *objectController = dynamic_cast(newObject->getController()); - if (objectController == NULL) + if (objectController == nullptr) objectController = dynamic_cast(newObject->createDefaultController()); NOT_NULL(objectController); @@ -1073,10 +1073,10 @@ ServerObject* ServerWorld::createNewObjectIntermediate(ServerObject* newObject, // prevent initial object data from being re-sent as deltas newObject->clearDeltas(); Container::ContainerErrorCode tmp = Container::CEC_Success; - if (!ContainerInterface::transferItemToGeneralContainer(container, *newObject, NULL, tmp, allowOverload)) + if (!ContainerInterface::transferItemToGeneralContainer(container, *newObject, nullptr, tmp, allowOverload)) { IGNORE_RETURN(newObject->permanentlyDestroy(DeleteReasons::BadContainerTransfer)); - newObject = NULL; + newObject = nullptr; } else { @@ -1101,13 +1101,13 @@ ServerObject* ServerWorld::createNewObjectIntermediate(ServerObject* newObject, if (newObject->getNetworkId() == NetworkId::cms_invalid) { WARNING_STRICT_FATAL(true, ("Tried to create an object with network id 0.")); - return NULL; + return nullptr; } { PROFILER_AUTO_BLOCK_DEFINE("createNewObjectIntermedate,getController"); NetworkController *objectController = dynamic_cast(newObject->getController()); - if (objectController == NULL) + if (objectController == nullptr) objectController = dynamic_cast(newObject->createDefaultController()); NOT_NULL(objectController); } @@ -1130,11 +1130,11 @@ ServerObject* ServerWorld::createNewObjectIntermediate(ServerObject* newObject, { PROFILER_AUTO_BLOCK_DEFINE("transferItem"); Container::ContainerErrorCode tmp = Container::CEC_Success; - if (!ContainerInterface::transferItemToSlottedContainer(container, *newObject, slotId, NULL, tmp)) + if (!ContainerInterface::transferItemToSlottedContainer(container, *newObject, slotId, nullptr, tmp)) { PROFILER_AUTO_BLOCK_DEFINE("failedTransfer"); IGNORE_RETURN(newObject->permanentlyDestroy(DeleteReasons::BadContainerTransfer)); - newObject = NULL; + newObject = nullptr; } else { @@ -1189,7 +1189,7 @@ ServerObject* ServerWorld::createProxyObject(uint32 templateCrc, const NetworkId if(newObject) { ServerController *objectController = dynamic_cast(newObject->getController()); - if (objectController == NULL) + if (objectController == nullptr) objectController = dynamic_cast(newObject->createDefaultController()); NOT_NULL(objectController); @@ -1455,10 +1455,10 @@ static void _isObjectInConeLoopSetup(const Object & coneCenterObject, const Loca // NOTE: all calculations are made within the object space of coneCenterObject. //-- Compute cone axis vector. - const ServerObject * cell = NULL; + const ServerObject * cell = nullptr; if (coneDirection.getCell() != NetworkId::cms_invalid) cell = safe_cast(NetworkIdManager::getObjectById(coneDirection.getCell())); - if (cell == NULL) + if (cell == nullptr) coneAxisVector = coneCenterObject.rotateTranslate_w2o(coneDirection.getCoordinates()); else { @@ -1984,7 +1984,7 @@ CellProperty const * ServerWorld::findCellAtLocation(const Vector & location_w) */ ServerObject *ServerWorld::findClosestObjectInList(const Vector &location, const std::vector &candidates) { - if (candidates.empty()) return NULL; + if (candidates.empty()) return nullptr; typedef std::vector CandidatesType; @@ -2097,7 +2097,7 @@ void ServerWorld::install() data.installExtents = true; data.installCollisionWorld = true; - data.playEffect = NULL; + data.playEffect = nullptr; data.isPlayerHouse = &isPlayerHouseHook; data.serverSide = true; @@ -2187,7 +2187,7 @@ void ServerWorld::install() m_sceneId = new std::string(ConfigServerGame::getSceneID()); - Pvp::getScheduler().setCallback(Pvp::updateTimedFlags, NULL, ConfigServerGame::getPvpUpdateTimeMs()); + Pvp::getScheduler().setCallback(Pvp::updateTimedFlags, nullptr, ConfigServerGame::getPvpUpdateTimeMs()); NebulaManagerServer::loadScene(*m_sceneId); @@ -2420,7 +2420,7 @@ void ServerWorld::triggerMovingTriggers(ServerObject &movingObject, Vector const clcount++; } - if (object != NULL) + if (object != nullptr) t->moveTriggerVolume(*object, start, end); } DEBUG_REPORT_LOG(ms_logTriggerStats, (" Creature count: %d Client count: %d\n", crcount, clcount)); @@ -2559,8 +2559,8 @@ void ServerWorld::remove() gs_pendingConcludeVector.clear(); - CollisionWorld::setNearWarpWarningCallback(NULL); - CollisionWorld::setFarWarpWarningCallback(NULL); + CollisionWorld::setNearWarpWarningCallback(nullptr); + CollisionWorld::setFarWarpWarningCallback(nullptr); Pvp::remove(); @@ -2629,7 +2629,7 @@ void ServerWorld::removeObjectFromGame(const ServerObject& object) void ServerWorld::removeTangibleObject(ServerObject *object) { PROFILER_AUTO_BLOCK_DEFINE("ServerWorld::removeTangibleObject"); - DEBUG_WARNING(!object, ("removeTangibleObject() was called with a NULL object parameter, this is probably not what the program intended to do")); + DEBUG_WARNING(!object, ("removeTangibleObject() was called with a nullptr object parameter, this is probably not what the program intended to do")); if (!object) return; @@ -2643,7 +2643,7 @@ void ServerWorld::removeTangibleObject(ServerObject *object) // if the object is being destroyed, the trigger has already gone off // player creatures aren't destroyed before being removed, so it's safe to invoke // the trigger here - if (object->isAuthoritative() && (object->getScriptObject() != NULL) && !object->isBeingDestroyed()) + if (object->isAuthoritative() && (object->getScriptObject() != nullptr) && !object->isBeingDestroyed()) { ScriptParams params; IGNORE_RETURN(object->getScriptObject()->trigAllScripts(Scripting::TRIG_REMOVING_FROM_WORLD, params)); @@ -2897,7 +2897,7 @@ void ServerWorld::update(real time) for(concludeIter = gs_pendingConcludeVector.begin(); concludeIter != gs_pendingConcludeVector.end(); ++concludeIter) { ServerObject *o = (*concludeIter)->asServerObject(); - WARNING_STRICT_FATAL(!o, ("NULL object in conclude list!")); + WARNING_STRICT_FATAL(!o, ("nullptr object in conclude list!")); if (o) { if (o->isInitialized()) diff --git a/engine/server/library/serverGame/src/shared/core/SetupServerGame.cpp b/engine/server/library/serverGame/src/shared/core/SetupServerGame.cpp index a8dadf30..7a047ac5 100755 --- a/engine/server/library/serverGame/src/shared/core/SetupServerGame.cpp +++ b/engine/server/library/serverGame/src/shared/core/SetupServerGame.cpp @@ -65,8 +65,8 @@ void SetupServerGame::install() PositionUpdateTracker::install(); LogoutTracker::install(); AuthTransferTracker::install(); - NonCriticalTaskQueue::install(static_cast(NULL)); - SurveySystem::install(static_cast(NULL)); + NonCriticalTaskQueue::install(static_cast(nullptr)); + SurveySystem::install(static_cast(nullptr)); CreatureObject::install(); NameManager::install(); MessageToQueue::install(); diff --git a/engine/server/library/serverGame/src/shared/core/StaticLootItemManager.cpp b/engine/server/library/serverGame/src/shared/core/StaticLootItemManager.cpp index 8202f8d1..9da3852f 100755 --- a/engine/server/library/serverGame/src/shared/core/StaticLootItemManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/StaticLootItemManager.cpp @@ -26,8 +26,8 @@ int const MAX_ATTRIBS = 2000; void StaticLootItemManager::sendDataToClient(NetworkId const & playerId, std::string const & staticItemName) { Object * const o = NetworkIdManager::getObjectById(playerId); - ServerObject * const so = o ? o->asServerObject() : NULL; - CreatureObject * const co = so ? so->asCreatureObject() : NULL; + ServerObject * const so = o ? o->asServerObject() : nullptr; + CreatureObject * const co = so ? so->asCreatureObject() : nullptr; if(co) { @@ -45,8 +45,8 @@ void StaticLootItemManager::sendDataToClient(NetworkId const & playerId, std::st void StaticLootItemManager::getAttributes(NetworkId const & playerId, std::string const & staticItemName, AttributeVector & data) { Object * const o = NetworkIdManager::getObjectById(playerId); - ServerObject * const so = o ? o->asServerObject() : NULL; - CreatureObject * const co = so ? so->asCreatureObject() : NULL; + ServerObject * const so = o ? o->asServerObject() : nullptr; + CreatureObject * const co = so ? so->asCreatureObject() : nullptr; if(co) { GameScriptObject * const gso = const_cast(co->getScriptObject()); diff --git a/engine/server/library/serverGame/src/shared/core/VeteranRewardManager.cpp b/engine/server/library/serverGame/src/shared/core/VeteranRewardManager.cpp index c9bb11a0..fcc97af2 100755 --- a/engine/server/library/serverGame/src/shared/core/VeteranRewardManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/VeteranRewardManager.cpp @@ -312,7 +312,7 @@ RewardEvent * VeteranRewardManagerNamespace::getRewardEventByName(std::string co if (i!=ms_rewardEvents.end()) return i->second; else - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -323,7 +323,7 @@ RewardItem * VeteranRewardManagerNamespace::getRewardItemByName(std::string cons if (i!=ms_rewardItems.end()) return i->second; else - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -389,7 +389,7 @@ void VeteranRewardManager::getTriggeredEventsIds(CreatureObject const & playerCr if (((*i)->getAccountFeatureId() > 0) && (*i)->getConsumeAccountFeatureId()) { std::vector rewardItems; - getAvailableRewardItemsForEvent(playerCreature, (*i)->getId(), rewardItems, NULL); + getAvailableRewardItemsForEvent(playerCreature, (*i)->getId(), rewardItems, nullptr); if (rewardItems.empty()) continue; @@ -512,7 +512,7 @@ bool VeteranRewardManager::claimRewards(CreatureObject const & playerCreature, s } std::vector possibleRewardItems; - getAvailableRewardItemsForEvent(playerCreature, rewardEventName, possibleRewardItems, NULL); + getAvailableRewardItemsForEvent(playerCreature, rewardEventName, possibleRewardItems, nullptr); if (possibleRewardItems.empty()) { if (debugMessage) @@ -589,7 +589,7 @@ void VeteranRewardManager::handleClaimRewardsReply(StationId stationId, NetworkI static std::vector const emptyMessageData; ServerObject * const so = safe_cast(NetworkIdManager::getObjectById(player)); - CreatureObject * const playerCreature = so ? so->asCreatureObject() : NULL; + CreatureObject * const playerCreature = so ? so->asCreatureObject() : nullptr; if (!playerCreature) return; // player has vanished -- reward claim will be handled by the recovery code at the next login if (!playerCreature->isAuthoritative()) @@ -628,7 +628,7 @@ void VeteranRewardManager::handleClaimRewardsReply(StationId stationId, NetworkI // Check that the requested item can be claimed with this event std::vector possibleRewardItems; - getAvailableRewardItemsForEvent(*playerCreature, rewardEvent, possibleRewardItems, NULL); + getAvailableRewardItemsForEvent(*playerCreature, rewardEvent, possibleRewardItems, nullptr); bool found = false; for (std::vector::const_iterator j=possibleRewardItems.begin(); j!=possibleRewardItems.end(); ++j) @@ -704,7 +704,7 @@ void VeteranRewardManager::handleClaimRewardsReply(StationId stationId, NetworkI params.addParam(item->getCanTradeIn(), "canTradeIn"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(player, "veteranItemGrantSucceeded",dictionary->getSerializedData(),0,false); @@ -808,11 +808,11 @@ time_t VeteranRewardManagerNamespace::yyyymmddToTime(int const yyyy, int const m FATAL(((mm < 1) || (mm > 12)),("Data bug: Reward event date (%d / %d / %d) - month %d specified for a reward event must be between 1 - 12.",mm,dd,yyyy,mm)); FATAL(((dd < 1) || (dd > 31)),("Data bug: Reward event date (%d / %d / %d) - day %d specified for a reward event must be between 1 - 31.",mm,dd,yyyy,dd)); - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * const timeinfo = ::localtime(&rawtime); if (!timeinfo) { - FATAL(true,(":localtime() returns NULL")); + FATAL(true,(":localtime() returns nullptr")); return 0; } @@ -848,7 +848,7 @@ void VeteranRewardManager::getRewardChoicesTags(CreatureObject const & playerCre std::vector rewardItems; - getAvailableRewardItemsForEvent(playerCreature, eventName, rewardItems, NULL); + getAvailableRewardItemsForEvent(playerCreature, eventName, rewardItems, nullptr); for (std::vector::const_iterator i=rewardItems.begin(); i!=rewardItems.end(); ++i) { rewardTagsUnicode.push_back(Unicode::narrowToWide(*i)); @@ -866,7 +866,7 @@ StringId const * VeteranRewardManager::getEventAnnouncement(std::string const & { return &(event->getAnnouncement()); } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -880,7 +880,7 @@ StringId const * VeteranRewardManager::getEventDescription(std::string const & e { return &(event->getDescription()); } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -894,7 +894,7 @@ std::string const * VeteranRewardManager::getEventUrl(std::string const & eventN { return &(event->getUrl()); } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -1147,7 +1147,7 @@ void VeteranRewardManager::tcgRedemption(CreatureObject const & playerCreature, // the redemption int const redemptionTimeout = 300; // 5 minutes; item.removeObjVarItem(ms_tcgRedemptionInProgressObjvar); - item.setObjVarItem(ms_tcgRedemptionInProgressObjvar, static_cast(::time(NULL) + redemptionTimeout)); // 5 minutes + item.setObjVarItem(ms_tcgRedemptionInProgressObjvar, static_cast(::time(nullptr) + redemptionTimeout)); // 5 minutes // send off request to adjust the account feature Id AdjustAccountFeatureIdRequest const msg(NetworkId::cms_invalid, GameServer::getInstance().getProcessId(), playerCreature.getNetworkId(), PlayerObject::getAccountDescription(&playerCreature), playerPlayer->getStationId(), item.getNetworkId(), ServerObject::getLogDescription(&item), PlatformGameCode::SWGTCG, static_cast(featureId), adjustment); @@ -1169,7 +1169,7 @@ bool VeteranRewardManager::checkForTcgRedemptionInProgress(ServerObject const & int redemptionTimeout; IGNORE_RETURN(item.getObjVars().getItem(ms_tcgRedemptionInProgressObjvar, redemptionTimeout)); - time_t const currentTime = ::time(NULL); + time_t const currentTime = ::time(nullptr); if (redemptionTimeout > currentTime) { // item should be in top level inventory; get the player object the item is in @@ -1308,7 +1308,7 @@ bool VeteranRewardManager::tradeInReward(CreatureObject const & playerCreature, if (itemClaimTime > 0) { time_t timeRedeem = itemClaimTime + static_cast(ConfigServerGame::getVeteranRewardTradeInWaitPeriodSeconds()); - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); // see if the item has its own trade-in wait period if (itemObjvar.hasItem("rewardTradeInWaitPeriod") && (itemObjvar.getType("rewardTradeInWaitPeriod") == DynamicVariable::INT)) @@ -1337,7 +1337,7 @@ bool VeteranRewardManager::tradeInReward(CreatureObject const & playerCreature, // the trade in int const redemptionTimeout = 300; // 5 minutes; item.removeObjVarItem(ms_tradeInInProgressObjvar); - item.setObjVarItem(ms_tradeInInProgressObjvar, static_cast(::time(NULL) + redemptionTimeout)); // 5 minutes + item.setObjVarItem(ms_tradeInInProgressObjvar, static_cast(::time(nullptr) + redemptionTimeout)); // 5 minutes // send off request to adjust the account feature Id AdjustAccountFeatureIdRequest const msg(NetworkId::cms_invalid, GameServer::getInstance().getProcessId(), playerCreature.getNetworkId(), PlayerObject::getAccountDescription(&playerCreature), playerPlayer->getStationId(), item.getNetworkId(), ServerObject::getLogDescription(&item), PlatformGameCode::SWG, static_cast(featureId), 1); @@ -1361,7 +1361,7 @@ bool VeteranRewardManager::checkForTradeInInProgress(ServerObject const & item) int redemptionTimeout; IGNORE_RETURN(item.getObjVars().getItem(ms_tradeInInProgressObjvar, redemptionTimeout)); - time_t const currentTime = ::time(NULL); + time_t const currentTime = ::time(nullptr); if (redemptionTimeout > currentTime) { // item should be in top level inventory; get the player object the item is in @@ -1742,7 +1742,7 @@ RewardEvent::RewardEvent(DataTable const & dataTable, int row) : m_id(dataTable.getStringValue("id",row)), m_specificItems(buildVectorFromString(dataTable.getStringValue("Items",row))), m_includeItemsFrom(buildVectorFromString(dataTable.getStringValue("Include Items From",row))), - m_allItems(NULL), + m_allItems(nullptr), m_category(dataTable.getIntValue("Category", row)), m_featureBitRewardExclusionMask(dataTable.getIntValue("Feature Bit Reward Exclusion Mask", row)), m_accountFlags(static_cast(dataTable.getIntValue("Account Flags",row))), @@ -1839,7 +1839,7 @@ bool RewardEvent::hasPlayerTriggered(CreatureObject const & playerCreature) cons if (m_startDate != 0 || m_endDate != 0) { - time_t currentTime = time(NULL); + time_t currentTime = time(nullptr); if ((m_startDate != 0 && currentTime < m_startDate) || (m_endDate != 0 && currentTime > m_endDate)) return false; diff --git a/engine/server/library/serverGame/src/shared/guild/GuildInterface.cpp b/engine/server/library/serverGame/src/shared/guild/GuildInterface.cpp index f30669aa..7f8f07c8 100755 --- a/engine/server/library/serverGame/src/shared/guild/GuildInterface.cpp +++ b/engine/server/library/serverGame/src/shared/guild/GuildInterface.cpp @@ -43,11 +43,11 @@ namespace GuildInterfaceNamespace bool s_needEnemiesRebuild; // dictionary containing the table showing all active guild wars with at least 1 kill - ScriptParams * s_activeGuildWars = NULL; + ScriptParams * s_activeGuildWars = nullptr; bool s_activeGuildWarsNeedRebuild = true; // dictionary containing the table showing the 100 most recently ended guild wars with at least 1 kill - ScriptParams * s_inactiveGuildWars = NULL; + ScriptParams * s_inactiveGuildWars = nullptr; int s_inactiveGuildWarsMostRecentUpdateIndex = 0; typedef std::map PendingChannelAddList; //using a map to make it easier to prevent redundant entries @@ -99,7 +99,7 @@ namespace GuildInterfaceNamespace const char * makeCopyOfString(const char * rhs) { - char * lhs = NULL; + char * lhs = nullptr; if (rhs) { lhs = new char[strlen(rhs) + 1]; @@ -245,7 +245,7 @@ std::pair const *GuildInterface::hasDeclaredWarAgainst(int actorGui } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -662,7 +662,7 @@ ScriptParams const *GuildInterface::getMasterGuildWarTableDictionary() } delete s_activeGuildWars; - s_activeGuildWars = NULL; + s_activeGuildWars = nullptr; // build the table if (!guildMutuallyAtWarWithKillSummary.empty()) @@ -810,9 +810,9 @@ void GuildInterface::updateInactiveGuildWarTrackingInfo(GuildObject &masterGuild // guild with higher kill count appears first if (guildAKillCount > guildBKillCount) - IGNORE_RETURN(masterGuildObject.setObjVarItem(FormattedString<32>().sprintf("%s.%d", s_objvarInactiveGuildWarsPrefix.c_str(), nextIndex), FormattedString<512>().sprintf("%s~%s~%d~%s~%s~%d~%ld", giA->m_name.c_str(), giA->m_abbrev.c_str(), guildAKillCount, giB->m_name.c_str(), giB->m_abbrev.c_str(), guildBKillCount, ::time(NULL)))); + IGNORE_RETURN(masterGuildObject.setObjVarItem(FormattedString<32>().sprintf("%s.%d", s_objvarInactiveGuildWarsPrefix.c_str(), nextIndex), FormattedString<512>().sprintf("%s~%s~%d~%s~%s~%d~%ld", giA->m_name.c_str(), giA->m_abbrev.c_str(), guildAKillCount, giB->m_name.c_str(), giB->m_abbrev.c_str(), guildBKillCount, ::time(nullptr)))); else - IGNORE_RETURN(masterGuildObject.setObjVarItem(FormattedString<32>().sprintf("%s.%d", s_objvarInactiveGuildWarsPrefix.c_str(), nextIndex), FormattedString<512>().sprintf("%s~%s~%d~%s~%s~%d~%ld", giB->m_name.c_str(), giB->m_abbrev.c_str(), guildBKillCount, giA->m_name.c_str(), giA->m_abbrev.c_str(), guildAKillCount, ::time(NULL)))); + IGNORE_RETURN(masterGuildObject.setObjVarItem(FormattedString<32>().sprintf("%s.%d", s_objvarInactiveGuildWarsPrefix.c_str(), nextIndex), FormattedString<512>().sprintf("%s~%s~%d~%s~%s~%d~%ld", giB->m_name.c_str(), giB->m_abbrev.c_str(), guildBKillCount, giA->m_name.c_str(), giA->m_abbrev.c_str(), guildAKillCount, ::time(nullptr)))); IGNORE_RETURN(masterGuildObject.setObjVarItem(s_objvarInactiveGuildWarsMostRecentIndex, nextIndex)); } @@ -869,7 +869,7 @@ ScriptParams const *GuildInterface::getInactiveGuildWarTableDictionary() if (!objVars.getItem(FormattedString<32>().sprintf("%s.%d", s_objvarInactiveGuildWarsPrefix.c_str(), currentIndex), guildWarData)) break; - if (!Unicode::tokenize(guildWarData, tokens, &delimiters, NULL) || (tokens.size() != 7)) + if (!Unicode::tokenize(guildWarData, tokens, &delimiters, nullptr) || (tokens.size() != 7)) break; scriptParamsGuildAName->push_back(new Unicode::String(tokens[0])); @@ -891,7 +891,7 @@ ScriptParams const *GuildInterface::getInactiveGuildWarTableDictionary() } delete s_inactiveGuildWars; - s_inactiveGuildWars = NULL; + s_inactiveGuildWars = nullptr; if (!scriptParamsGuildAName->empty()) { @@ -1120,7 +1120,7 @@ void GuildInterface::updateGuildWarKillTracking(CreatureObject const &killer, Cr && hasDeclaredWarAgainst(killer.getGuildId(), victim.getGuildId()) && hasDeclaredWarAgainst(victim.getGuildId(), killer.getGuildId())) { - ServerUniverse::getInstance().getMasterGuildObject()->modifyGuildWarKillTracking(killer.getGuildId(), victim.getGuildId(), 1, static_cast(::time(NULL))); + ServerUniverse::getInstance().getMasterGuildObject()->modifyGuildWarKillTracking(killer.getGuildId(), victim.getGuildId(), 1, static_cast(::time(nullptr))); } } diff --git a/engine/server/library/serverGame/src/shared/metrics/GameServerMetricsData.cpp b/engine/server/library/serverGame/src/shared/metrics/GameServerMetricsData.cpp index 96c0d19b..170181d6 100755 --- a/engine/server/library/serverGame/src/shared/metrics/GameServerMetricsData.cpp +++ b/engine/server/library/serverGame/src/shared/metrics/GameServerMetricsData.cpp @@ -239,7 +239,7 @@ void GameServerMetricsData::updateData() "Max: %s requested load on %s which has been pending for %s. Limit = %d.", id.getValueString().c_str(), CalendarTime::convertEpochToTimeStringLocal(oldestPendingLoadRequestTime).c_str(), - CalendarTime::convertSecondsToMS((int)::time(NULL) - oldestPendingLoadRequestTime).c_str(), + CalendarTime::convertSecondsToMS((int)::time(nullptr) - oldestPendingLoadRequestTime).c_str(), GameServer::getPendingLoadRequestLimit() ); else diff --git a/engine/server/library/serverGame/src/shared/network/Chat.cpp b/engine/server/library/serverGame/src/shared/network/Chat.cpp index 209ee89d..fede9920 100755 --- a/engine/server/library/serverGame/src/shared/network/Chat.cpp +++ b/engine/server/library/serverGame/src/shared/network/Chat.cpp @@ -64,7 +64,7 @@ using namespace ChatNamespace; //----------------------------------------------------------------------- -Chat *Chat::m_instance = NULL; +Chat *Chat::m_instance = nullptr; Chat::Chat () : diff --git a/engine/server/library/serverGame/src/shared/network/ConnectionServerConnection.cpp b/engine/server/library/serverGame/src/shared/network/ConnectionServerConnection.cpp index b6af7d42..f47cfe43 100755 --- a/engine/server/library/serverGame/src/shared/network/ConnectionServerConnection.cpp +++ b/engine/server/library/serverGame/src/shared/network/ConnectionServerConnection.cpp @@ -194,7 +194,7 @@ void ConnectionServerConnection::onReceive (const Archive::ByteStream & message) } } else - LOG("CustomerService", ("CharacterTransfer: character object was NULL so unable to check if bank is loaded")); + LOG("CustomerService", ("CharacterTransfer: character object was nullptr so unable to check if bank is loaded")); } @@ -224,10 +224,10 @@ void ConnectionServerConnection::onReceive (const Archive::ByteStream & message) } } else - LOG("CustomerService", ("CharacterTransfer: bank container object was NULL for getBankContainer call")); + LOG("CustomerService", ("CharacterTransfer: bank container object was nullptr for getBankContainer call")); } else - LOG("CustomerService", ("CharacterTransfer: character object was NULL so unable to check if bank is loaded")); + LOG("CustomerService", ("CharacterTransfer: character object was nullptr so unable to check if bank is loaded")); } else if (m.isType("RequestTransferData")) { @@ -237,7 +237,7 @@ void ConnectionServerConnection::onReceive (const Archive::ByteStream & message) CreatureObject * const character = dynamic_cast(NetworkIdManager::getObjectById(requestTransferData.getValue().getCharacterId())); PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(character); time_t characterCreateTime = -1; - FreeCtsDataTable::FreeCtsInfo const * freeCtsInfo = NULL; + FreeCtsDataTable::FreeCtsInfo const * freeCtsInfo = nullptr; bool freeCtsBypassTimeRestriction = false; if (character && playerObject) { @@ -292,7 +292,7 @@ void ConnectionServerConnection::onReceive (const Archive::ByteStream & message) for (CreatureObject::SkillList::const_iterator i = skills.begin(); i != skills.end(); ++i) { const SkillObject * profession = (*i)->findProfessionForSkill(); - if (profession != NULL) + if (profession != nullptr) professionName = profession->getSkillName(); } } @@ -414,7 +414,7 @@ void ConnectionServerConnection::onReceive (const Archive::ByteStream & message) unsigned int result = CHATRESULT_SUCCESS; ServerObject const * const o = ServerWorld::findObjectByNetworkId(cervreq.getValue().first.first); - CreatureObject const * const co = (o ? o->asCreatureObject() : NULL); + CreatureObject const * const co = (o ? o->asCreatureObject() : nullptr); if (co) { result = Chat::isAllowedToEnterRoom(*co, cervreq.getValue().first.second); @@ -440,7 +440,7 @@ void ConnectionServerConnection::onReceive (const Archive::ByteStream & message) bool success = false; ServerObject const * const o = ServerWorld::findObjectByNetworkId(cqrvreq.getValue().first.first); - CreatureObject const * const co = (o ? o->asCreatureObject() : NULL); + CreatureObject const * const co = (o ? o->asCreatureObject() : nullptr); if (co) { success = (CHATRESULT_SUCCESS == Chat::isAllowedToEnterRoom(*co, cqrvreq.getValue().first.second)); diff --git a/engine/server/library/serverGame/src/shared/network/CustomerServiceServerConnection.cpp b/engine/server/library/serverGame/src/shared/network/CustomerServiceServerConnection.cpp index 456ec031..cb1df8fd 100755 --- a/engine/server/library/serverGame/src/shared/network/CustomerServiceServerConnection.cpp +++ b/engine/server/library/serverGame/src/shared/network/CustomerServiceServerConnection.cpp @@ -58,12 +58,12 @@ void CustomerServiceServerConnection::onReceive(const Archive::ByteStream & mess ChatRequestLog chatRequestLog(ri); Object * const reportingObject = NetworkIdManager::getObjectById(NetworkId(Unicode::wideToNarrow(chatRequestLog.getPlayer()))); - if ( (reportingObject != NULL) + if ( (reportingObject != nullptr) && reportingObject->isAuthoritative()) { PlayerObject const * const reportingPlayerObject = PlayerCreatureController::getPlayerObject(CreatureObject::asCreatureObject(reportingObject)); - if (reportingPlayerObject != NULL) + if (reportingPlayerObject != nullptr) { PlayerObject::ChatLog const &reportingPlayerChatLog = reportingPlayerObject->getChatLog(); PlayerObject::ChatLog::const_iterator iterReportingPlayerChatLog = reportingPlayerChatLog.begin(); diff --git a/engine/server/library/serverGame/src/shared/network/GameServerMessageArchive.cpp b/engine/server/library/serverGame/src/shared/network/GameServerMessageArchive.cpp index bf76972f..d66d70fb 100755 --- a/engine/server/library/serverGame/src/shared/network/GameServerMessageArchive.cpp +++ b/engine/server/library/serverGame/src/shared/network/GameServerMessageArchive.cpp @@ -31,7 +31,7 @@ GameServerMessageArchive::~GameServerMessageArchive() void GameServerMessageArchive::install() { - if (getInstance() == NULL) + if (getInstance() == nullptr) { setInstance(new GameServerMessageArchive); ExitChain::add(GameServerMessageArchive::remove, "GameServerMessageArchive::remove"); diff --git a/engine/server/library/serverGame/src/shared/object/BuildingObject.cpp b/engine/server/library/serverGame/src/shared/object/BuildingObject.cpp index ed2eb7de..cdc6289f 100755 --- a/engine/server/library/serverGame/src/shared/object/BuildingObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/BuildingObject.cpp @@ -140,7 +140,7 @@ using namespace BuildingObjectNamespace; // ====================================================================== -const SharedObjectTemplate * BuildingObject::m_defaultSharedTemplate = NULL; +const SharedObjectTemplate * BuildingObject::m_defaultSharedTemplate = nullptr; // ====================================================================== @@ -380,13 +380,13 @@ const SharedObjectTemplate * BuildingObject::getDefaultSharedTemplate(void) cons { static const ConstCharCrcLowerString templateName("object/building/base/shared_building_default.iff"); - if (m_defaultSharedTemplate == NULL) + if (m_defaultSharedTemplate == nullptr) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create " + WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create " "default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) ExitChain::add (removeDefaultTemplate, "BuildingObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -399,10 +399,10 @@ static const ConstCharCrcLowerString templateName("object/building/base/shared_b */ void BuildingObject::removeDefaultTemplate(void) { - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } // BuildingObject::removeDefaultTemplate @@ -432,7 +432,7 @@ void BuildingObject::expelObject(ServerObject &who) if (controller) { CellProperty *parentCell = getParentCell(); - ServerObject *destinationCellObject = NULL; + ServerObject *destinationCellObject = nullptr; if (!parentCell->isWorldCell()) destinationCellObject = safe_cast(&parentCell->getOwner()); @@ -902,7 +902,7 @@ void BuildingObject::changeTeleportDestination(Vector & position, float & yaw) c { DataTable * respawnTable = DataTableManager::getTable(CLONE_RESPAWN_TABLE, true); - if (respawnTable != NULL) + if (respawnTable != nullptr) { int row = respawnTable->searchColumnString(0, getTemplateName()); if (row >= 0) diff --git a/engine/server/library/serverGame/src/shared/object/CellObject.cpp b/engine/server/library/serverGame/src/shared/object/CellObject.cpp index b2c6f994..e0211aa5 100755 --- a/engine/server/library/serverGame/src/shared/object/CellObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/CellObject.cpp @@ -39,7 +39,7 @@ #include -const SharedObjectTemplate * CellObject::m_defaultSharedTemplate = NULL; +const SharedObjectTemplate * CellObject::m_defaultSharedTemplate = nullptr; // ====================================================================== @@ -99,13 +99,13 @@ const SharedObjectTemplate * CellObject::getDefaultSharedTemplate(void) const { static const ConstCharCrcLowerString templateName("object/cell/base/shared_cell_default.iff"); - if (m_defaultSharedTemplate == NULL) + if (m_defaultSharedTemplate == nullptr) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create " + WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create " "default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) ExitChain::add (removeDefaultTemplate, "CellObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -118,10 +118,10 @@ static const ConstCharCrcLowerString templateName("object/cell/base/shared_cell_ */ void CellObject::removeDefaultTemplate(void) { - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } // CellObject::removeDefaultTemplate @@ -161,7 +161,7 @@ void CellObject::endBaselines() } Object *container = ContainerInterface::getContainedByObject(*this); - PortalProperty *portalProperty = NULL; + PortalProperty *portalProperty = nullptr; if (container) { portalProperty = container->getPortalProperty(); @@ -531,31 +531,31 @@ bool CellObject::isAllowed(CreatureObject const &who) const bool CellObject::getClosestPathNodePos( const ServerObject & object, Vector & outPos ) const { - const PathNode * closestNode = NULL; + const PathNode * closestNode = nullptr; float closestDistance = 0; const Vector objectPos = object.getPosition_w(); const CellProperty * cell = ContainerInterface::getCell(*this); - if (cell != NULL) + if (cell != nullptr) { const Floor * floor = cell->getFloor(); - if (floor != NULL) + if (floor != nullptr) { const FloorMesh * mesh = floor->getFloorMesh(); - if (mesh != NULL) + if (mesh != nullptr) { const PathGraph * path = safe_cast(mesh->getPathGraph()); - if (path != NULL) + if (path != nullptr) { int nodeCount = path->getNodeCount(); for (int i = 0; i < nodeCount; ++i) { const PathNode * node = path->getNode(i); - if (node != NULL) + if (node != nullptr) { float distance = objectPos.magnitudeBetweenSquared( rotateTranslate_p2w(node->getPosition_p())); - if (closestNode == NULL || distance < closestDistance) + if (closestNode == nullptr || distance < closestDistance) { closestNode = node; closestDistance = distance; @@ -567,9 +567,9 @@ bool CellObject::getClosestPathNodePos( const ServerObject & object, Vector & ou } } - if (closestNode != NULL) + if (closestNode != nullptr) outPos = closestNode->getPosition_p(); - return closestNode != NULL; + return closestNode != nullptr; } // ---------------------------------------------------------------------- @@ -648,7 +648,7 @@ void CellObject::onContainerLostItem(ServerObject * destination, ServerObject& i obj->getScriptObject()->trigAllScripts(Scripting::TRIG_LOST_ITEM, params); BuildingObject * const b_obj = getOwnerBuilding(); - if (b_obj && item.isPlayerControlled() && destination == NULL) + if (b_obj && item.isPlayerControlled() && destination == nullptr) { b_obj->lostPlayer(item); } @@ -772,8 +772,8 @@ CellObject * CellObject::getCellObject(NetworkId const & networkId) CellObject * CellObject::asCellObject(Object * object) { - ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; - CellObject * const cellObject = (serverObject != NULL) ? serverObject->asCellObject() : NULL; + ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; + CellObject * const cellObject = (serverObject != nullptr) ? serverObject->asCellObject() : nullptr; return cellObject; } @@ -782,8 +782,8 @@ CellObject * CellObject::asCellObject(Object * object) CellObject const * CellObject::asCellObject(Object const * object) { - ServerObject const * const serverObject = (object != NULL) ? object->asServerObject() : NULL; - CellObject const * const cellObject = (serverObject != NULL) ? serverObject->asCellObject() : NULL; + ServerObject const * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; + CellObject const * const cellObject = (serverObject != nullptr) ? serverObject->asCellObject() : nullptr; return cellObject; } diff --git a/engine/server/library/serverGame/src/shared/object/CityObject.cpp b/engine/server/library/serverGame/src/shared/object/CityObject.cpp index f8fd1778..da741dbf 100755 --- a/engine/server/library/serverGame/src/shared/object/CityObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/CityObject.cpp @@ -130,9 +130,9 @@ void CityObject::setupUniverse() // build the city info from data read in from DB // disable notification while building the initial list - m_citizensInfo.setOnErase(NULL, NULL); - m_citizensInfo.setOnInsert(NULL, NULL); - m_citizensInfo.setOnSet(NULL, NULL); + m_citizensInfo.setOnErase(nullptr, nullptr); + m_citizensInfo.setOnInsert(nullptr, nullptr); + m_citizensInfo.setOnSet(nullptr, nullptr); // build cities std::map tempCities; @@ -462,7 +462,7 @@ int CityObject::createCity(std::string const &cityName, NetworkId const &cityHal incomeTax, propertyTax, salesTax, travelLoc, travelCost, travelInterplanetary, cloneLoc, cloneRespawn, cloneRespawnCell, cloneId); - ci.setCityCreationTime(static_cast(::time(NULL))); + ci.setCityCreationTime(static_cast(::time(nullptr))); m_citiesInfo.set(cityId, ci); std::string citySpec; @@ -1724,7 +1724,7 @@ CitizenInfo const * CityObject::getCitizenSpec(int cityId, NetworkId const &citi } result.clear(); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -1739,7 +1739,7 @@ CityStructureInfo const * CityObject::getCityStructureSpec(int cityId, NetworkId } result.clear(); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -1975,7 +1975,7 @@ CitizenInfo const *CityObject::getCitizenInfo(int cityId, NetworkId const &citiz if (iterFind != m_citizensInfo.end()) return &(iterFind->second); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -2008,7 +2008,7 @@ CityStructureInfo const *CityObject::getCityStructureInfo(int cityId, NetworkId if (iterFind != m_structuresInfo.end()) return &(iterFind->second); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -2071,7 +2071,7 @@ PgcRatingInfo const * CityObject::getPgcRating(NetworkId const &chroniclerId) co if (iterFind != m_pgcRatingInfo.end()) return &(iterFind->second); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -2141,7 +2141,7 @@ void CityObject::adjustPgcRating(NetworkId const &chroniclerId, std::string cons m_pgcRatingChroniclerId.insert(std::make_pair(NameManager::normalizeName(updatedPgcRating.m_chroniclerName), chroniclerId)); } - updatedPgcRating.m_lastRatingTime = static_cast(::time(NULL)); + updatedPgcRating.m_lastRatingTime = static_cast(::time(nullptr)); std::string updatedPgcRatingSpec; CityStringParser::buildPgcRatingSpec(chroniclerId, updatedPgcRating, updatedPgcRatingSpec); diff --git a/engine/server/library/serverGame/src/shared/object/CreatureObject.cpp b/engine/server/library/serverGame/src/shared/object/CreatureObject.cpp index 336f2058..73803c0a 100755 --- a/engine/server/library/serverGame/src/shared/object/CreatureObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/CreatureObject.cpp @@ -189,7 +189,7 @@ //---------------------------------------------------------------------- // static CreatureObject vars -const SharedObjectTemplate * CreatureObject::m_defaultSharedTemplate = NULL; +const SharedObjectTemplate * CreatureObject::m_defaultSharedTemplate = nullptr; //---------------------------------------------------------------------- @@ -661,9 +661,9 @@ float MonitoredCreatureMovement::operator-(MonitoredCreatureMovement const &othe CreatureObject::CreatureObject(const ServerCreatureObjectTemplate* newTemplate) : TangibleObject(newTemplate), - m_commandQueue(NULL), + m_commandQueue(nullptr), m_isStatic(false), - m_shield(NULL), + m_shield(nullptr), m_regenerationTime(0), m_attributes(Attributes::NumberOfAttributes), m_maxAttributes(Attributes::NumberOfAttributes), @@ -942,7 +942,7 @@ CreatureObject::~CreatureObject() trade->cancelTrade(*this); } // AICreatureController * aiController = AICreatureController::asAiCreatureController(controller); -// if (aiController != NULL) +// if (aiController != nullptr) // { // aiController->stop(); // } @@ -1083,15 +1083,15 @@ const SharedObjectTemplate * CreatureObject::getDefaultSharedTemplate() const { static const ConstCharCrcLowerString templateName("object/creature/base/shared_creature_default.iff"); - if (m_defaultSharedTemplate == NULL) + if (m_defaultSharedTemplate == nullptr) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - DEBUG_WARNING(m_defaultSharedTemplate == NULL, ("Cannot create " + DEBUG_WARNING(m_defaultSharedTemplate == nullptr, ("Cannot create " "default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) ExitChain::add (removeDefaultTemplate, "CreatureObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -1104,10 +1104,10 @@ static const ConstCharCrcLowerString templateName("object/creature/base/shared_c */ void CreatureObject::removeDefaultTemplate() { - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } // CreatureObject::removeDefaultTemplate @@ -1192,7 +1192,7 @@ void CreatureObject::runSpawnQueue() ScriptParams params; ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(id, "spawn_Trigger", dictionary->getSerializedData(), 0, false); @@ -1263,7 +1263,7 @@ bool CreatureObject::assignMission(MissionObject * missionObject) } Container::ContainerErrorCode tmp = Container::CEC_Success; - result = ContainerInterface::transferItemToGeneralContainer(*datapad, *missionObject, NULL, tmp); + result = ContainerInterface::transferItemToGeneralContainer(*datapad, *missionObject, nullptr, tmp); if(result) { missionObject->setMissionHolderId(getNetworkId()); @@ -1725,7 +1725,7 @@ void CreatureObject::forwardServerObjectSpecificBaselines() const TangibleObject::forwardServerObjectSpecificBaselines(); Property const * const property = getProperty(SlowDownProperty::getClassPropertyId()); - if (property != NULL) + if (property != nullptr) { SlowDownProperty const * const slowdownProperty = safe_cast(property); @@ -1736,7 +1736,7 @@ void CreatureObject::forwardServerObjectSpecificBaselines() const // if we are an ai creature, have our controller send our current ai state AICreatureController const * const aiCreatureController = AICreatureController::asAiCreatureController(getController()); - if (aiCreatureController != NULL) + if (aiCreatureController != nullptr) { aiCreatureController->forwardServerObjectSpecificBaselines(); } @@ -1749,7 +1749,7 @@ void CreatureObject::sendObjectSpecificBaselinesToClient(Client const &client) c TangibleObject::sendObjectSpecificBaselinesToClient(client); Property const * const property = getProperty(SlowDownProperty::getClassPropertyId()); - if (property != NULL) + if (property != nullptr) { SlowDownProperty const * const slowdownProperty = safe_cast(property); @@ -1778,7 +1778,7 @@ void CreatureObject::initializeFirstTimeObject() // set the current weapon WeaponObject * weapon = getReadiedWeapon(); - if (weapon != NULL) + if (weapon != nullptr) setCurrentWeapon(*weapon); #ifdef _DEBUG @@ -1835,7 +1835,7 @@ void CreatureObject::onLoadedFromDatabase() { Container::ContainedItem itemId = container->getObjectInSlot(slot, tmp); Object* appearanceInventory = itemId.getObject(); - if(appearanceInventory == NULL) + if(appearanceInventory == nullptr) { WARNING(true, ("Player %s has lost their appearance inventory", getNetworkId().getValueString().c_str())); appearanceInventory = ServerWorld::createNewObject(s_appearanceTemplate, *this, slot, false); @@ -1941,7 +1941,7 @@ void CreatureObject::onLoadedFromDatabase() if (i.getValue(ctsTransactionDetail)) { Unicode::UnicodeStringVector tokens; - if (Unicode::tokenize(ctsTransactionDetail, tokens, NULL, NULL) && (tokens.size() >= 4)) + if (Unicode::tokenize(ctsTransactionDetail, tokens, nullptr, nullptr) && (tokens.size() >= 4)) { int const transferTime = atoi(Unicode::wideToNarrow(tokens[0]).c_str()); if ((earliestTransferTime == -1) || (transferTime < earliestTransferTime)) @@ -1978,7 +1978,7 @@ void CreatureObject::onLoadedFromDatabase() } // set "born on " collection slot and clear all the other "born on " collection slots; - // this still needs to be run even if collectionSlot is NULL in order to forcefully clear all of the + // this still needs to be run even if collectionSlot is nullptr in order to forcefully clear all of the // other "born on " collection slots, since we are reusing deleted/no longer used collection // slot bits, and those bits may be left in a set state at the time they were deleted/no longer used std::vector const & slots = CollectionsDataTable::getSlotsInCollection("born_on_collection"); @@ -2064,7 +2064,7 @@ void CreatureObject::onLoadedFromDatabase() std::vector > skillModBonuses; std::vector > attribBonuses; Container const * const equipment = ContainerInterface::getContainer(*this); - if (equipment != NULL) + if (equipment != nullptr) { for (ContainerConstIterator i(equipment->begin()); i != equipment->end(); ++i) { @@ -2072,7 +2072,7 @@ void CreatureObject::onLoadedFromDatabase() if (so) { TangibleObject const * const equippedItem = so->asTangibleObject(); - if (equippedItem != NULL) + if (equippedItem != nullptr) { equippedItem->getSkillModBonuses(skillModBonuses); int bonusCount = skillModBonuses.size(); @@ -2110,7 +2110,7 @@ void CreatureObject::onLoadedFromDatabase() setDefaultAlterTime(defaultAlterTime); CreatureController * controller = getCreatureController(); - if (controller != NULL) + if (controller != nullptr) controller->updateHibernate(); } } @@ -2379,7 +2379,7 @@ void CreatureObject::endBaselines() void CreatureObject::checkAndRestoreRequiredSlots() { SlottedContainer * const container = ContainerInterface::getSlottedContainer(*this); - if (container == NULL) + if (container == nullptr) { WARNING_STRICT_FATAL(true, ("This creature is not slotted!")); return; @@ -2422,7 +2422,7 @@ void CreatureObject::checkAndRestoreRequiredSlots() { Container::ContainedItem itemId = container->getObjectInSlot(slot, tmp); Object* inventory = itemId.getObject(); - if (inventory == NULL) + if (inventory == nullptr) { WARNING(true, ("Player %s has lost their inventory", getNetworkId().getValueString().c_str())); inventory = ServerWorld::createNewObject(s_inventoryTemplate, *this, slot, false); @@ -2438,7 +2438,7 @@ void CreatureObject::checkAndRestoreRequiredSlots() { Container::ContainedItem itemId = container->getObjectInSlot(slot, tmp); Object* datapad = itemId.getObject(); - if (datapad == NULL) + if (datapad == nullptr) { WARNING(true, ("Player %s has lost their datapad", getNetworkId().getValueString().c_str())); datapad = ServerWorld::createNewObject(s_datapadTemplate, *this, slot, false); @@ -2454,7 +2454,7 @@ void CreatureObject::checkAndRestoreRequiredSlots() { Container::ContainedItem itemId = container->getObjectInSlot(slot, tmp); ServerObject* missionBag = safe_cast(itemId.getObject()); - if (missionBag == NULL) + if (missionBag == nullptr) { WARNING(true, ("Player %s has lost their mission bag", getNetworkId().getValueString().c_str())); missionBag = ServerWorld::createNewObject(s_missionBagTemplate, *this, slot, false); @@ -2472,7 +2472,7 @@ void CreatureObject::checkAndRestoreRequiredSlots() { Container::ContainedItem itemId = container->getObjectInSlot(slot, tmp); ServerObject* bank = safe_cast(itemId.getObject()); - if (bank == NULL) + if (bank == nullptr) { WARNING(true, ("Player %s has lost their bank", getNetworkId().getValueString().c_str())); bank = ServerWorld::createNewObject(s_bankTemplate, *this, slot, false); @@ -2502,7 +2502,7 @@ void CreatureObject::onRemovingFromWorld() { // if we are crafting, end the crafting session PlayerObject * const player = PlayerCreatureController::getPlayerObject(this); - if (player != NULL && player->isCrafting()) + if (player != nullptr && player->isCrafting()) player->stopCrafting(false); // exit all notify regions @@ -2541,7 +2541,7 @@ void CreatureObject::addToWorld() Object::addToWorld(); updateTriggerVolumes(); - if (getScriptObject() != NULL) + if (getScriptObject() != nullptr) getScriptObject()->setOwnerIsLoaded(); ContainedByProperty * const containedByProperty = getContainedByProperty(); @@ -2607,7 +2607,7 @@ void CreatureObject::setupSkillData() clearCommands(); PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if (playerObject != NULL) + if (playerObject != nullptr) { playerObject->clearSchematics(); } @@ -2679,7 +2679,7 @@ void CreatureObject::setupSkillData() DynamicVariableList::NestedList::const_iterator i(schematics.begin()); for (; i != schematics.end(); ++i) { - grantSchematic(strtoul(i.getName().c_str(), NULL, 10), true); + grantSchematic(strtoul(i.getName().c_str(), nullptr, 10), true); } } @@ -2711,7 +2711,7 @@ Controller* CreatureObject::createDefaultController () AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(controller); - if (aiCreatureController != NULL) + if (aiCreatureController != nullptr) { aiCreatureController->addServerNpAutoDeltaVariables(m_serverPackage_np); } @@ -2758,7 +2758,7 @@ void CreatureObject::setAuthServerProcessId(uint32 processId) if (oldProcess != getAuthServerProcessId()) { // we can't trade if we are on different servers, so cancel it - if (getCreatureController()->getSecureTrade() != NULL) + if (getCreatureController()->getSecureTrade() != nullptr) { getCreatureController()->getSecureTrade()->cancelTrade(*this); } @@ -2786,7 +2786,7 @@ float CreatureObject::alter(float time) // If the player is trading, cancel the trade. // We need to force the issue to catch edge cases. ServerSecureTrade * const secureTradeObject = getCreatureController()->getSecureTrade(); - if (secureTradeObject != NULL) + if (secureTradeObject != nullptr) { secureTradeObject->cancelTrade(*this); } @@ -2854,7 +2854,7 @@ float CreatureObject::alter(float time) if (playerObject->getIsUnsticking() && getPositionChanged()) { - Chat::sendSystemMessageSimple(*this, SharedStringIds::unstick_request_cancelled, NULL); + Chat::sendSystemMessageSimple(*this, SharedStringIds::unstick_request_cancelled, nullptr); playerObject->setIsUnsticking(false); } } @@ -2862,13 +2862,13 @@ float CreatureObject::alter(float time) if (!ServerWorld::isSpaceScene()) { // if we're in a conversation, end it if we move too far from the npc - if (m_npcConversation != NULL) + if (m_npcConversation != nullptr) { PROFILER_AUTO_BLOCK_DEFINE("CreatureObject::alter::npcConvCheck"); bool endConversation = false; // check the distance to the npc ServerObject const * const npc = safe_cast(m_npcConversation->getNPC().getObject()); - if (npc != NULL) + if (npc != nullptr) { float distance = findPosition_w().magnitudeBetween(npc->findPosition_w()); distance -= getRadius(); @@ -2894,7 +2894,7 @@ float CreatureObject::alter(float time) // see if we are performing a slow down effect Property * property = getProperty(SlowDownProperty::getClassPropertyId()); - if (property != NULL) + if (property != nullptr) { // has it expired? SlowDownProperty * slowdown = safe_cast(property); @@ -2909,7 +2909,7 @@ float CreatureObject::alter(float time) // area, and and tell them they are moving on our effect "hill" during their next alter // (player creatures are handled on the player's client) Object * target = slowdown->getTarget().getObject(); - if (target != NULL) + if (target != nullptr) { std::vector found; ServerWorld::findAuthoritativeNonPlayerCreaturesInCone(*this, *target, slowdown->getConeLength(), slowdown->getConeAngle(), found); @@ -2974,14 +2974,14 @@ bool CreatureObject::canDestroy() const // turn off our default weapon so it won't prevent us from getting // destroyed WeaponObject * defaultWeapon = getDefaultWeapon(); - if (defaultWeapon != NULL) + if (defaultWeapon != nullptr) defaultWeapon->setAsDefaultWeapon(false); bool result = TangibleObject::canDestroy(); if (!result) { // we're not being destroyed, turn our default weapon back on - if (defaultWeapon != NULL) + if (defaultWeapon != nullptr) defaultWeapon->setAsDefaultWeapon(true); } @@ -3007,22 +3007,22 @@ void CreatureObject::initializeDefaultWeapon() FATAL(!isAuthoritative(), ("CreatureObject::initializeDefaultWeapon: obj %s, while nonauth", getDebugInformation().c_str())); ServerCreatureObjectTemplate const * const myTemplate = safe_cast(getObjectTemplate()); - if (myTemplate != NULL) + if (myTemplate != nullptr) { ServerWeaponObjectTemplate const *weaponTemplate = myTemplate->getDefaultWeapon(); - if (weaponTemplate == NULL) + if (weaponTemplate == nullptr) { WARNING(true, ("Creature template %s has no valid default weapon!", getTemplateName())); // try to use the fallback weapon weaponTemplate = dynamic_cast(ObjectTemplateList::fetch(ConfigServerGame::getFallbackDefaultWeapon())); - FATAL(weaponTemplate == NULL, ("CreatureObject::initializeFirstTimeObject fallback weapon template %s is bad!", ConfigServerGame::getFallbackDefaultWeapon())); + FATAL(weaponTemplate == nullptr, ("CreatureObject::initializeFirstTimeObject fallback weapon template %s is bad!", ConfigServerGame::getFallbackDefaultWeapon())); } WeaponObject * const weapon = safe_cast(ServerWorld::createNewObject(*weaponTemplate, *this, s_defaultWeaponSlotId, false)); - if (weapon != NULL) + if (weapon != nullptr) { weapon->setAsDefaultWeapon(true); } @@ -3044,7 +3044,7 @@ bool CreatureObject::swapDefaultWeapons(WeaponObject &newDefaultWeapon, ServerOb FATAL(!newDefaultWeapon.isAuthoritative(), ("CreatureObject::swapDefaultWeapons: obj %s, weapon %s, weaponContainer %s, while newDefaultWeapon nonauth", getDebugInformation().c_str(), newDefaultWeapon.getDebugInformation().c_str(), weaponContainer.getDebugInformation().c_str())); FATAL(!weaponContainer.isAuthoritative(), ("CreatureObject::swapDefaultWeapons: obj %s, weapon %s, weaponContainer %s, while weaponContainer nonauth", getDebugInformation().c_str(), newDefaultWeapon.getDebugInformation().c_str(), weaponContainer.getDebugInformation().c_str())); - // There is a window here where the default weapon can be null, so we + // There is a window here where the default weapon can be nullptr, so we // set a flag that it's ok until we've finished the transfer. FATAL(s_allowNullDefaultWeapon, ("CreatureObject::swapDefaultWeapons has been recursively called!")); @@ -3080,12 +3080,12 @@ bool CreatureObject::swapDefaultWeapons(WeaponObject &newDefaultWeapon, ServerOb WeaponObject *CreatureObject::getDefaultWeapon() const { SlottedContainer const * const container = ContainerInterface::getSlottedContainer(*this); - if (container == NULL) + if (container == nullptr) { - return NULL; + return nullptr; } - WeaponObject * defaultWeapon = NULL; + WeaponObject * defaultWeapon = nullptr; Container::ContainerErrorCode error; Container::ContainedItem itemId = container->getObjectInSlot(s_defaultWeaponSlotId, error); if (error == Container::CEC_Success) @@ -3097,7 +3097,7 @@ WeaponObject *CreatureObject::getDefaultWeapon() const if (so) defaultWeapon = so->asWeaponObject(); } - FATAL(!s_allowNullDefaultWeapon && defaultWeapon == NULL, ("CreatureObject::getDefaultWeapon, weapon is NULL! Object in default slot is %s", itemId.getValueString().c_str())); + FATAL(!s_allowNullDefaultWeapon && defaultWeapon == nullptr, ("CreatureObject::getDefaultWeapon, weapon is nullptr! Object in default slot is %s", itemId.getValueString().c_str())); } return defaultWeapon; } @@ -3376,7 +3376,7 @@ void CreatureObject::updateSlopeMovement(const std::string & modName) recomputeSlopeModPercent(); // if I'm modifiying the group slope mod and I'm a group leader, // update my group's speed - else if (modName == GROUP_SLOPE_MOD && getGroup() != NULL && + else if (modName == GROUP_SLOPE_MOD && getGroup() != nullptr && getGroup()->getGroupLeaderId() == getNetworkId()) { const GroupObject::GroupMemberVector & members = getGroup()->getGroupMembers(); @@ -3385,7 +3385,7 @@ void CreatureObject::updateSlopeMovement(const std::string & modName) { CreatureObject * member = safe_cast( NetworkIdManager::getObjectById((*iter).first)); - if (member != NULL) + if (member != nullptr) member->recomputeSlopeModPercent(); } } @@ -3581,7 +3581,7 @@ int CreatureObject::getExperiencePoints(const std::string & experienceType) cons if (isPlayerControlled()) { const PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if (playerObject != NULL) + if (playerObject != nullptr) return playerObject->getExperiencePoints(experienceType); } return 0; @@ -3595,7 +3595,7 @@ const std::map & CreatureObject::getExperiencePoints() const if(isPlayerControlled()) { const PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if(playerObject != NULL) + if(playerObject != nullptr) { return playerObject->getExperiencePoints(); } @@ -3617,7 +3617,7 @@ const int CreatureObject::grantExperiencePoints(const std::string & experienceTy if (isPlayerControlled()) { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if (playerObject != NULL) + if (playerObject != nullptr) { int const amountGranted = playerObject->grantExperiencePoints(experienceType, amount); @@ -3770,7 +3770,7 @@ void CreatureObject::revokeSkill(const SkillObject & oldSkill, bool silent) PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if ((playerObject != NULL) && + if ((playerObject != nullptr) && (oldSkill.getSkillName() == playerObject->getTitle())) { StringId message("shared", "skill_title_removed"); @@ -3809,7 +3809,7 @@ const bool CreatureObject::grantSchematicGroup(const std::string & groupNameWith if (isPlayerControlled()) { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if (playerObject != NULL) + if (playerObject != nullptr) return playerObject->grantSchematicGroup(groupNameWithModifier, fromSkill); } return false; @@ -3829,7 +3829,7 @@ const bool CreatureObject::grantSchematic(uint32 schematicCrc, bool fromSkill) if (isPlayerControlled()) { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if (playerObject != NULL) + if (playerObject != nullptr) return playerObject->grantSchematic(schematicCrc, fromSkill); } return false; @@ -3849,7 +3849,7 @@ const bool CreatureObject::revokeSchematic(uint32 schematicCrc, bool fromSkill) if (isPlayerControlled()) { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if (playerObject != NULL) + if (playerObject != nullptr) return playerObject->revokeSchematic(schematicCrc, fromSkill); } return false; @@ -3869,7 +3869,7 @@ const bool CreatureObject::hasSchematic(uint32 schematicCrc) if (isPlayerControlled()) { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if (playerObject != NULL) + if (playerObject != nullptr) return playerObject->hasSchematic(schematicCrc); } return false; @@ -3909,7 +3909,7 @@ void CreatureObject::setInCombat(bool inCombat) PlayerObject * const player = PlayerCreatureController::getPlayerObject(this); - if (player != NULL && player->isCrafting()) + if (player != nullptr && player->isCrafting()) { player->stopCrafting(false); } @@ -4274,10 +4274,10 @@ static const int internalTagBufLen = strlen(internalTagBuf); mod.value, m_attributes[mod.attrib] + mod.value); DEBUG_REPORT_LOG (true, ("%s", debugBuffer)); - if (attacker != NULL) + if (attacker != nullptr) { Client *client = attacker->getClient(); - if (client != NULL) + if (client != nullptr) ConsoleMgr::broadcastString(debugBuffer, client); } } @@ -4359,8 +4359,8 @@ static const int internalTagBufLen = strlen(internalTagBuf); else { const char * modName = AttribModNameManager::getInstance().getAttribModName(mod.tag); - if (modName == NULL) - modName = ""; + if (modName == nullptr) + modName = ""; WARNING(true, ("Creature %s received a mod %s with invalid " "attack(%.2f) or duration(%.2f)", getNetworkId().getValueString().c_str(), modName, mod.attack, @@ -4438,7 +4438,7 @@ void CreatureObject::removeAttributeModifier (const std::string & modName) if (AttribMod::isSkillMod(m.mod)) { const char * skillModName = AttribModNameManager::getInstance().getAttribModName(m.mod.skill); - if (skillModName != NULL) + if (skillModName != nullptr) addModValue(skillModName, -m.maxVal, true); else { @@ -4569,7 +4569,7 @@ void CreatureObject::removeAllAttributeAndSkillmodMods () if (AttribMod::isSkillMod(m.mod)) { const char * skillModName = AttribModNameManager::getInstance().getAttribModName(m.mod.skill); - if (skillModName != NULL) + if (skillModName != nullptr) addModValue(skillModName, -m.maxVal, true); } // if the mod is visible, we need to tell the player it's being @@ -4582,7 +4582,7 @@ void CreatureObject::removeAllAttributeAndSkillmodMods () if (m.mod.flags & AttribMod::AMF_triggerOnDone) { const char * modName = AttribModNameManager::getInstance().getAttribModName(m.mod.tag); - if (modName != NULL) + if (modName != nullptr) { ScriptParams params; params.addParam(modName); @@ -4624,7 +4624,7 @@ void CreatureObject::removeAllAttributeAndSkillmodMods () * * @param modName the mod to look for * - * @return the mod, or NULL if there is no mod with that name attached to us + * @return the mod, or nullptr if there is no mod with that name attached to us */ const AttribMod::AttribMod * CreatureObject::getAttributeModifier( const std::string & modName) const @@ -4642,7 +4642,7 @@ const AttribMod::AttribMod * CreatureObject::getAttributeModifier( if (found != m_attributeModList.end()) return &((*found).second.mod); } - return NULL; + return nullptr; } // CreatureObject::getAttributeModifier //----------------------------------------------------------------------- @@ -4666,7 +4666,7 @@ const std::map & CreatureObject::getAttributeModifiers() co */ void CreatureObject::sendTimedModData(uint32 id, float time, bool updateCache/* = true*/) { - if (isPlayerControlled() && getController() != NULL && id != 0) + if (isPlayerControlled() && getController() != nullptr && id != 0) { MessageQueueGenericValueType > * const msg = new MessageQueueGenericValueType >( @@ -4707,7 +4707,7 @@ void CreatureObject::sendTimedModData(uint32 id, float time, bool updateCache/* */ void CreatureObject::sendCancelTimedMod(uint32 id) { - if (isPlayerControlled() && getController() != NULL && id != 0) + if (isPlayerControlled() && getController() != nullptr && id != 0) { MessageQueueGenericValueType * const msg = new MessageQueueGenericValueType(id); @@ -4764,7 +4764,7 @@ void CreatureObject::applyDamage(const CombatEngineData::DamageData &damageData) // if the attacker is a player and we are not, and we are incapped/dead, // don't allow additional damage - if (attacker != NULL && attacker->isPlayerControlled() && !isPlayerControlled() && + if (attacker != nullptr && attacker->isPlayerControlled() && !isPlayerControlled() && (isIncapacitated() || isDead())) { return; @@ -5018,7 +5018,7 @@ void CreatureObject::decayAttributes(float time) if (AttribMod::isSkillMod(m.mod)) { const char * skillModName = AttribModNameManager::getInstance().getAttribModName(m.mod.skill); - if (skillModName != NULL) + if (skillModName != nullptr) { addModValue(skillModName, -m.maxVal, true); @@ -5051,7 +5051,7 @@ void CreatureObject::decayAttributes(float time) { // tell scripts the mod has ended const char * modName = AttribModNameManager::getInstance().getAttribModName(m.mod.tag); - if (modName != NULL) + if (modName != nullptr) { ScriptParams params; params.addParam(modName); @@ -5112,7 +5112,7 @@ void CreatureObject::decayAttributes(float time) // add the skillmod mod as if it were from a skill, // which makes it temporary const char * skillModName = AttribModNameManager::getInstance().getAttribModName(m.mod.skill); - if (skillModName != NULL) + if (skillModName != nullptr) addModValue(skillModName, delta, true); else { @@ -6014,7 +6014,7 @@ static const std::map,int> npcSchematics; if (isPlayerControlled()) { PlayerObject const * const playerObject = PlayerCreatureController::getPlayerObject(this); - if (playerObject != NULL) + if (playerObject != nullptr) return playerObject->getDraftSchematics(); } return npcSchematics; @@ -6032,11 +6032,11 @@ static const std::map,int> npcSchematics; bool CreatureObject::isIngredientInInventory(const Object & ingredient) const { const ServerObject * inventory = getInventory(); - if (inventory == NULL) + if (inventory == nullptr) return false; const Object * container = ContainerInterface::getContainedByObject(ingredient); - while (container != NULL) + while (container != nullptr) { if (inventory->getNetworkId() == container->getNetworkId() || getNetworkId() == container->getNetworkId()) @@ -6057,7 +6057,7 @@ bool CreatureObject::isIngredientInInventory(const Object & ingredient) const */ void CreatureObject::disableSchematicFiltering() { - if (getClient() == NULL || !getClient()->isGod()) + if (getClient() == nullptr || !getClient()->isGod()) return; setObjVarItem(OBJVAR_DISABLE_SCHEMATIC_FILTER, 1); @@ -6071,7 +6071,7 @@ void CreatureObject::disableSchematicFiltering() */ void CreatureObject::enableSchematicFiltering() { - if (getClient() == NULL || !getClient()->isGod()) + if (getClient() == nullptr || !getClient()->isGod()) return; removeObjVarItem(OBJVAR_DISABLE_SCHEMATIC_FILTER); @@ -6087,7 +6087,7 @@ void CreatureObject::enableSchematicFiltering() */ bool CreatureObject::isSchematicFilteringEnabled() { - if (getClient() == NULL || !getClient()->isGod()) + if (getClient() == nullptr || !getClient()->isGod()) return true; return (!getObjVars().hasItem(OBJVAR_DISABLE_SCHEMATIC_FILTER)); @@ -6103,17 +6103,17 @@ bool CreatureObject::isSchematicFilteringEnabled() void CreatureObject::getManufactureSchematics(std::vector & schematics) { const ServerObject * datapad = getDatapad(); - if (datapad == NULL) + if (datapad == nullptr) return; const VolumeContainer * container = ContainerInterface::getVolumeContainer(*datapad); - if (container == NULL) + if (container == nullptr) return; for (ContainerConstIterator iter = container->begin(); iter != container->end(); ++iter) { const ManufactureSchematicObject * schematic = dynamic_cast((*iter).getObject()); - if (schematic != NULL) + if (schematic != nullptr) schematics.push_back(schematic); } } // CreatureObject::getManufactureSchematics(unfiltered) @@ -6130,17 +6130,17 @@ void CreatureObject::getManufactureSchematics(std::vector & schematics, uint32 craftingTypes) { const ServerObject * datapad = getDatapad(); - if (datapad == NULL) + if (datapad == nullptr) return; const VolumeContainer * container = ContainerInterface::getVolumeContainer(*datapad); - if (container == NULL) + if (container == nullptr) return; for (ContainerConstIterator iter = container->begin(); iter != container->end(); ++iter) { const ManufactureSchematicObject * schematic = dynamic_cast((*iter).getObject()); - if (schematic != NULL && ((schematic->getCategory() & craftingTypes) != 0)) + if (schematic != nullptr && ((schematic->getCategory() & craftingTypes) != 0)) schematics.push_back(schematic); } } // CreatureObject::getManufactureSchematics(filtered) @@ -6278,7 +6278,7 @@ void CreatureObject::setIncapacitated(bool flag, const NetworkId & attackerId) // if we are crafting, end the crafting session PlayerObject * const player = PlayerCreatureController::getPlayerObject(this); - if (player != NULL && player->isCrafting()) + if (player != nullptr && player->isCrafting()) player->stopCrafting(false); if (isInNpcConversation()) @@ -6299,7 +6299,7 @@ void CreatureObject::setIncapacitated(bool flag, const NetworkId & attackerId) // invoke incapacitation script on who incapacitated us ServerObject * attacker = safe_cast( NetworkIdManager::getObjectById(attackerId)); - if (attacker != NULL) + if (attacker != nullptr) { params.clear(); params.addParam(getNetworkId()); @@ -6308,7 +6308,7 @@ void CreatureObject::setIncapacitated(bool flag, const NetworkId & attackerId) TangibleObject * const tangibleAttacker = attacker->asTangibleObject(); - if (tangibleAttacker != NULL) + if (tangibleAttacker != nullptr) { tangibleAttacker->verifyHateList(); } @@ -6335,7 +6335,7 @@ void CreatureObject::setIncapacitated(bool flag, const NetworkId & attackerId) setPosture(Postures::Upright); } // if we are a player, send us our new posture - if ((getController() != NULL) && !isInCombat()) + if ((getController() != nullptr) && !isInCombat()) { getController()->appendMessage( CM_setPosture, @@ -6466,7 +6466,7 @@ void CreatureObject::updateMovementInfo() rider->requestMovementInfoUpdate(); else { - LOG("mounts-bug", ("CreatureObject::updateMovementInfo(): server id=[%d],mount id=[%s],has MountedCreature state but getMountingRider() returns null.", static_cast(GameServer::getInstance().getProcessId()), getNetworkId().getValueString().c_str())); + LOG("mounts-bug", ("CreatureObject::updateMovementInfo(): server id=[%d],mount id=[%s],has MountedCreature state but getMountingRider() returns nullptr.", static_cast(GameServer::getInstance().getProcessId()), getNetworkId().getValueString().c_str())); detachAllRiders(); } } @@ -6538,7 +6538,7 @@ void CreatureObject::setPosture(Postures::Enumerator newPosture, bool isClientIm // guaranteed to be the authoritative object, this is an invalid thing to do. requestMovementInfoUpdate(); - if (getScriptObject() != NULL) + if (getScriptObject() != nullptr) { ScriptParams params; params.addParam(oldPosture); @@ -6950,13 +6950,13 @@ bool CreatureObject::onContainerAboutToTransfer(ServerObject * destination, Serv int CreatureObject::onContainerAboutToGainItem(ServerObject& item, ServerObject* transferer) { TangibleObject const * const object = item.asTangibleObject(); - if (object != NULL) + if (object != nullptr) { // See if this item is equippable const char *sharedTemplateName = item.getSharedTemplateName(); if (!isAppearanceEquippable(sharedTemplateName)) { - if (getClient() != NULL) + if (getClient() != nullptr) { StringId message("shared", "item_not_equippable"); Unicode::String outOfBand; @@ -6984,7 +6984,7 @@ int CreatureObject::onContainerAboutToGainItem(ServerObject& item, ServerObject* void CreatureObject::onContainerLostItem(ServerObject *destination, ServerObject &item, ServerObject *transferer) { TangibleObject const * const tangibleObject = item.asTangibleObject(); - if (tangibleObject == NULL) + if (tangibleObject == nullptr) return; // check if the object applies skill mod bonuses when equipped @@ -7026,12 +7026,12 @@ void CreatureObject::onContainerLostItem(ServerObject *destination, ServerObject // if the item is a weapon, make our current weapon our default weapon WeaponObject const * const weaponObject = tangibleObject->asWeaponObject(); - if (weaponObject != NULL && getDefaultWeapon() != NULL) + if (weaponObject != nullptr && getDefaultWeapon() != nullptr) setCurrentWeapon(*getDefaultWeapon()); // check if the object is our shield if (tangibleObject == m_shield) - m_shield = NULL; + m_shield = nullptr; //Update wearbles data SlottedContainmentProperty* scp = ContainerInterface::getSlottedContainmentProperty(item); @@ -7060,7 +7060,7 @@ void CreatureObject::onContainerLostItem(ServerObject *destination, ServerObject void CreatureObject::onContainerGainItem(ServerObject& item, ServerObject* source, ServerObject* transferer) { TangibleObject * const tangibleObject = item.asTangibleObject(); - if (tangibleObject == NULL) + if (tangibleObject == nullptr) return; // check if the object applies skill mod bonuses when equipped @@ -7100,7 +7100,7 @@ void CreatureObject::onContainerGainItem(ServerObject& item, ServerObject* sourc // if the item is a weapon, make it our current weapon WeaponObject * const weaponObject = tangibleObject->asWeaponObject(); - if (weaponObject != NULL) + if (weaponObject != nullptr) setCurrentWeapon(*weaponObject); //Update wearables data @@ -7141,7 +7141,7 @@ void CreatureObject::onContainerGainItem(ServerObject& item, ServerObject* sourc ConstCharCrcString clientSharedTemplateNameCrcString = ObjectTemplateList::lookUp(tangibleObject->getClientSharedTemplateName()); if (clientSharedTemplateNameCrcString.isEmpty()) WARNING(true, ("Could not find crc for %s. Wearable will not be streamed to client", tangibleObject->getClientSharedTemplateName())); - else if (tangibleObject->asWeaponObject() != NULL) + else if (tangibleObject->asWeaponObject() != nullptr) { addPackedWearable(tangibleObject->getAppearanceData(), scp->getCurrentArrangement(), tangibleObject->getNetworkId(), clientSharedTemplateNameCrcString.getCrc(), tangibleObject->createSharedBaselinesMessage(), tangibleObject->createSharedNpBaselinesMessage()); @@ -7591,7 +7591,7 @@ void CreatureObject::onClientReady(Client *c) { time_t timeUnsquelch = static_cast(player->getSecondsUntilUnsquelched()); if (timeUnsquelch > 0) - timeUnsquelch += ::time(NULL); + timeUnsquelch += ::time(nullptr); GenericValueTypeMessage, int>, std::pair > > chatStatistics("ChatStatisticsGS", std::make_pair(std::make_pair(std::make_pair(getNetworkId(), static_cast(timeUnsquelch)), player->getChatSpamTimeEndInterval()), std::make_pair(player->getChatSpamSpatialNumCharacters(), player->getChatSpamNonSpatialNumCharacters()))); Chat::sendToChatServer(chatStatistics); @@ -7926,7 +7926,7 @@ bool CreatureObject::makeDead(const NetworkId & killer, const NetworkId & corpse // if we are crafting, end the crafting session PlayerObject * const player = PlayerCreatureController::getPlayerObject(this); - if (player != NULL && player->isCrafting()) + if (player != nullptr && player->isCrafting()) player->stopCrafting(false); // if we are in a conversation, end it @@ -7991,7 +7991,7 @@ bool CreatureObject::makeDead(const NetworkId & killer, const NetworkId & corpse if (AttribMod::isSkillMod(m.mod)) { const char * skillModName = AttribModNameManager::getInstance().getAttribModName(m.mod.skill); - if (skillModName != NULL) + if (skillModName != nullptr) addModValue(skillModName, -m.maxVal, true); } // if the mod is visible, we need to tell the player it's being @@ -8004,7 +8004,7 @@ bool CreatureObject::makeDead(const NetworkId & killer, const NetworkId & corpse if (m.mod.flags & AttribMod::AMF_triggerOnDone) { const char * modName = AttribModNameManager::getInstance().getAttribModName(m.mod.tag); - if (modName != NULL) + if (modName != nullptr) { ScriptParams params; params.addParam(modName); @@ -8149,7 +8149,7 @@ Object const * CreatureObject::getStandingOn() const } else { - return NULL; + return nullptr; } } @@ -8302,7 +8302,7 @@ bool CreatureObject::setSlopeModPercent(float percent) // get my skill mod int movementMod = getEnhancedModValue(SLOPE_MOD); - if (getGroup() != NULL) + if (getGroup() != nullptr) { // get my group leader skill mod const NetworkId & leaderId = getGroup()->getGroupLeaderId(); @@ -8310,7 +8310,7 @@ bool CreatureObject::setSlopeModPercent(float percent) { const CreatureObject * leader = safe_cast( NetworkIdManager::getObjectById(leaderId)); - if (leader != NULL) + if (leader != nullptr) { movementMod += leader->getEnhancedModValue(GROUP_SLOPE_MOD); } @@ -8519,7 +8519,7 @@ void CreatureObject::onBiographyRetrieved(const NetworkId &owner, const Unicode: CreatureController *creatureController = getCreatureController(); - if (creatureController != NULL) + if (creatureController != nullptr) { typedef std::pair Payload; @@ -8535,7 +8535,7 @@ void CreatureObject::onCharacterMatchRetrieved(MatchMakingCharacterResult const { CreatureController *creatureController = getCreatureController(); - if (creatureController != NULL) + if (creatureController != nullptr) { MessageQueueGenericValueType * const msg = new MessageQueueGenericValueType(results); @@ -8939,7 +8939,7 @@ bool CreatureObject::isAppearanceEquippable(const char *appearanceTemplateName) // Make sure this object has a valid appearance - if (appearanceTemplateName == NULL) + if (appearanceTemplateName == nullptr) { result = false; } @@ -9063,7 +9063,7 @@ void CreatureObject::updatePlanetServerInternal(const bool forceUpdate) const AICreatureController const * const aiCreatureController = dynamic_cast(getCreatureController()); Object const * const topmostContainer = ContainerInterface::getTopmostContainer(*this); - FATAL(!topmostContainer, ("Object %s was contained by something, but getTopmostContainer() returned NULL", getNetworkId().getValueString().c_str())); + FATAL(!topmostContainer, ("Object %s was contained by something, but getTopmostContainer() returned nullptr", getNetworkId().getValueString().c_str())); Vector const &position = topmostContainer->getPosition_p(); UpdateObjectOnPlanetMessage const msg( getNetworkId(), @@ -9265,7 +9265,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) // set objvar to indicate there's a pending rename request for this character, // and the time of the rename request, to enforce the 90 days wait between rename if (!getClient() || !getClient()->isGod()) - setObjVarItem("renameCharacterRequest.requestTime", static_cast(::time(NULL))); + setObjVarItem("renameCharacterRequest.requestTime", static_cast(::time(nullptr))); std::string const newName(message.getDataAsString()); if (getObjVars().hasItem("renameCharacterRequest.requestTime") && !newName.empty()) @@ -9306,7 +9306,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) if (!getObjVars().hasItem(OBJVAR_ADD_JEDI_ACK)) { PlayerObject * const player = PlayerCreatureController::getPlayerObject(this); - if (player != NULL) + if (player != nullptr) { player->addJediToAccount(); MessageToQueue::getInstance().sendMessageToC(getNetworkId(), @@ -9461,7 +9461,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) MessageToQueue::cancelRecurringMessageTo(getNetworkId(), "C++WaitForPatrolPreload"); AICreatureController * const aiCreatureController = safe_cast(getController()); - if (aiCreatureController != NULL) + if (aiCreatureController != nullptr) { const std::string data = message.getDataAsString(); std::string::size_type locationStart = 0; @@ -9797,7 +9797,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) Unicode::String const delimiters(Unicode::narrowToWide("|")); Unicode::UnicodeStringVector tokens; - if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, NULL)) && (tokens.size() == 2)) + if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, nullptr)) && (tokens.size() == 2)) { existingWarden = NetworkId(Unicode::wideToNarrow(tokens[0])); @@ -9874,7 +9874,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) Unicode::String const delimiters(Unicode::narrowToWide("|")); Unicode::UnicodeStringVector tokens; - if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, NULL)) && (tokens.size() == 2)) + if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, nullptr)) && (tokens.size() == 2)) { existingWarden = NetworkId(Unicode::wideToNarrow(tokens[0])); @@ -9970,12 +9970,12 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) bool success = false; NetworkId actor, actorShip, group; std::string actorName; - GroupObject const * groupObject = NULL; + GroupObject const * groupObject = nullptr; StringId responseSid; Unicode::String const delimiters(Unicode::narrowToWide("|")); Unicode::UnicodeStringVector tokens; - if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, NULL)) && (tokens.size() == 4)) + if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, nullptr)) && (tokens.size() == 4)) { success = true; actor = NetworkId(Unicode::wideToNarrow(tokens[0])); @@ -9983,8 +9983,8 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) group = NetworkId(Unicode::wideToNarrow(tokens[2])); actorName = Unicode::wideToNarrow(tokens[3]); - ServerObject const * so = (group.isValid() ? safe_cast(NetworkIdManager::getObjectById(group)) : NULL); - groupObject = (so ? so->asGroupObject() : NULL); + ServerObject const * so = (group.isValid() ? safe_cast(NetworkIdManager::getObjectById(group)) : nullptr); + groupObject = (so ? so->asGroupObject() : nullptr); } if (success) @@ -10011,7 +10011,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) if (success) { GameScriptObject* const gso = getScriptObject(); - if (gso != NULL && gso->hasScript("ai.beast")) + if (gso != nullptr && gso->hasScript("ai.beast")) { responseSid = GroupStringId::SID_GROUP_BEASTS_CANT_JOIN; success = false; @@ -10092,7 +10092,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) } else if (message.getMethod() == "C++InviteToGroupRspTargetNotFound") { - Chat::sendSystemMessageSimple(*this, GroupStringId::SID_GROUP_INVITE_NO_TARGET_SELF, NULL); + Chat::sendSystemMessageSimple(*this, GroupStringId::SID_GROUP_INVITE_NO_TARGET_SELF, nullptr); } else if (message.getMethod() == "C++GroupOperationGenericRsp") { @@ -10101,7 +10101,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) std::string const result(message.getPackedDataVector().begin(), message.getPackedDataVector().end()); Unicode::String const delimiters(Unicode::narrowToWide("|")); Unicode::UnicodeStringVector tokens; - if ((Unicode::tokenize(Unicode::narrowToWide(result), tokens, &delimiters, NULL)) && (tokens.size() == 3)) + if ((Unicode::tokenize(Unicode::narrowToWide(result), tokens, &delimiters, nullptr)) && (tokens.size() == 3)) { std::string const response(Unicode::wideToNarrow(tokens[0])); std::string const responseParmType(Unicode::wideToNarrow(tokens[1])); @@ -10138,7 +10138,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) Unicode::String const delimiters(Unicode::narrowToWide("|")); Unicode::UnicodeStringVector tokens; - if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, NULL)) && (tokens.size() == 2)) + if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, nullptr)) && (tokens.size() == 2)) { success = true; actor = NetworkId(Unicode::wideToNarrow(tokens[0])); @@ -10194,7 +10194,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) } else if (message.getMethod() == "C++UninviteFromGroupRspTargetNotFound") { - Chat::sendSystemMessageSimple(*this, GroupStringId::SID_GROUP_UNINVITE_NO_TARGET_SELF, NULL); + Chat::sendSystemMessageSimple(*this, GroupStringId::SID_GROUP_UNINVITE_NO_TARGET_SELF, nullptr); } else if (message.getMethod() == "C++GroupJoinInviterInfoReq") { @@ -10250,7 +10250,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) Unicode::String const delimiters(Unicode::narrowToWide("|")); Unicode::UnicodeStringVector tokens; - if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, NULL)) && (tokens.size() == 10)) + if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, nullptr)) && (tokens.size() == 10)) { success = true; existingGroupId = NetworkId(Unicode::wideToNarrow(tokens[0])); @@ -10265,17 +10265,17 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) inviterInCombat = (atoi(Unicode::wideToNarrow(tokens[9]).c_str()) != 0); } - GroupObject * existingGroup = NULL; + GroupObject * existingGroup = nullptr; if (success) { if (existingGroupId.isValid()) { ServerObject * so = safe_cast(NetworkIdManager::getObjectById(existingGroupId)); - existingGroup = (so ? so->asGroupObject() : NULL); + existingGroup = (so ? so->asGroupObject() : nullptr); if (!existingGroup) { success = false; - Chat::sendSystemMessageSimple(*this, GroupStringId::SID_GROUP_EXISTING_GROUP_NOT_FOUND, NULL); + Chat::sendSystemMessageSimple(*this, GroupStringId::SID_GROUP_EXISTING_GROUP_NOT_FOUND, nullptr); } } } @@ -10318,7 +10318,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) if (existingGroup && !GroupHelpers::roomInGroup(existingGroup, targets.size())) { success = false; - Chat::sendSystemMessageSimple(*this, GroupStringId::SID_GROUP_JOIN_FULL, NULL); + Chat::sendSystemMessageSimple(*this, GroupStringId::SID_GROUP_JOIN_FULL, nullptr); } } @@ -10390,7 +10390,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) } else if (message.getMethod() == "C++GroupJoinInviterInfoReqInviterNotFound") { - Chat::sendSystemMessageSimple(*this, GroupStringId::SID_GROUP_MUST_BE_INVITED, NULL); + Chat::sendSystemMessageSimple(*this, GroupStringId::SID_GROUP_MUST_BE_INVITED, nullptr); } else if (message.getMethod() == "C++LeaveGroupReq") { @@ -10417,7 +10417,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) Unicode::String const delimiters(Unicode::narrowToWide("|")); Unicode::UnicodeStringVector tokens; - if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, NULL)) && (tokens.size() == 5)) + if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, nullptr)) && (tokens.size() == 5)) { // tell group member that the group pickup point has been created if (getClient()) @@ -10767,7 +10767,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) params.addParam(msg.getDestinationGalaxy().c_str(), "destinationGalaxy"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(getNetworkId(), "handleFreeCtsValidateFailCannotCreateCharacter", dictionary->getSerializedData(), 0, false); @@ -10781,7 +10781,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) params.addParam(msg.getDestinationGalaxy().c_str(), "destinationGalaxy"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(getNetworkId(), "handleFreeCtsValidateFailDestGalaxyUnavailable", dictionary->getSerializedData(), 0, false); @@ -10801,7 +10801,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) params.addParam(msg.getDestinationGalaxy().c_str(), "destinationGalaxy"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(getNetworkId(), "handleCtsValidateFailCannotCreateCharacter", dictionary->getSerializedData(), 0, false); @@ -10815,7 +10815,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) params.addParam(msg.getDestinationGalaxy().c_str(), "destinationGalaxy"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(getNetworkId(), "handleCtsValidateFailDestGalaxyUnavailable", dictionary->getSerializedData(), 0, false); @@ -10854,7 +10854,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) params.addParam(msg.getValue().first.c_str(), "reason"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(getNetworkId(), "handleFreeCtsValidateFailNameValidation", dictionary->getSerializedData(), 0, false); @@ -10868,7 +10868,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) params.addParam(msg.getValue().first.c_str(), "reason"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(getNetworkId(), "handleCtsValidateFailNameValidation", dictionary->getSerializedData(), 0, false); @@ -10882,7 +10882,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) params.addParam(msg.getValue().second.getDestinationCharacterName().c_str(), "destinationCharacterName"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(getNetworkId(), "handleFreeCtsValidateSuccess", dictionary->getSerializedData(), 0, false); @@ -10895,7 +10895,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) params.addParam(msg.getValue().second.getDestinationCharacterName().c_str(), "destinationCharacterName"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(getNetworkId(), "handleCtsValidateSuccess", dictionary->getSerializedData(), 0, false); @@ -10906,7 +10906,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) else if (message.getMethod() == "C++PickupAllRoomItemsIntoInventory") { // use while(true) loop to use break to discontinue processing and go to the end of loop to run cleanup code - PlayerObject * playerObject = NULL; + PlayerObject * playerObject = nullptr; while (true) { playerObject = PlayerCreatureController::getPlayerObject(this); @@ -11148,7 +11148,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) else if (message.getMethod() == "C++DropAllInventoryItemsIntoRoom") { // use while(true) loop to use break to discontinue processing and go to the end of loop to run cleanup code - PlayerObject * playerObject = NULL; + PlayerObject * playerObject = nullptr; while (true) { playerObject = PlayerCreatureController::getPlayerObject(this); @@ -11355,7 +11355,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) else if (message.getMethod() == "C++RestoreDecorationLayout") { // use while(true) loop to use break to discontinue processing and go to the end of loop to run cleanup code - PlayerObject * playerObject = NULL; + PlayerObject * playerObject = nullptr; while (true) { playerObject = PlayerCreatureController::getPlayerObject(this); @@ -11681,7 +11681,7 @@ void CreatureObject::virtualOnReleaseAuthority() if(controller) { - if (getProperty(SlopeEffectProperty::getClassPropertyId()) != NULL) + if (getProperty(SlopeEffectProperty::getClassPropertyId()) != nullptr) removeProperty(SlopeEffectProperty::getClassPropertyId()); controller->setAuthority(false); } @@ -11693,7 +11693,7 @@ void CreatureObject::virtualOnLogout() { TangibleObject::virtualOnLogout(); PlayerObject * const player = PlayerCreatureController::getPlayerObject(this); - if (player != NULL) + if (player != nullptr) player->virtualOnLogout(); } @@ -11789,7 +11789,7 @@ void CreatureObject::packWearables() ConstCharCrcString clientSharedTemplateNameCrcString = ObjectTemplateList::lookUp(tang->getClientSharedTemplateName()); if (clientSharedTemplateNameCrcString.isEmpty()) WARNING(true, ("Could not find crc for [%s]. Wearable will not be streamed to client", tang->getClientSharedTemplateName())); - else if (so->asWeaponObject() != NULL) + else if (so->asWeaponObject() != nullptr) { addPackedWearable(tang->getAppearanceData(), scp->getCurrentArrangement(), tang->getNetworkId(), clientSharedTemplateNameCrcString.getCrc(), tang->createSharedBaselinesMessage(), tang->createSharedNpBaselinesMessage()); @@ -12048,7 +12048,7 @@ int CreatureObject::loadPackedHouses() ++hcdIter) { Object * const houseId = (*hcdIter).getObject(); - BuildingObject * const house = (houseId ? houseId->asServerObject()->asBuildingObject() : NULL); + BuildingObject * const house = (houseId ? houseId->asServerObject()->asBuildingObject() : nullptr); if (house && !house->getContentsLoaded()) { LOG("CustomerService", ("CharacterTransfer: starting packed house load (%s) for CTS character %s", house->getNetworkId().getValueString().c_str(), PlayerObject::getAccountDescription(this).c_str())); @@ -12612,7 +12612,7 @@ void CreatureObject::unequipAllItems() Container::ContainerErrorCode errorCode = Container::CEC_Success; Container::ContainedItem inventoryContainedItem = equipmentContainer->getObjectInSlot(s_inventorySlotId, errorCode); Object *const inventoryObjectBase = inventoryContainedItem.getObject(); - ServerObject *const inventoryObject = inventoryObjectBase ? inventoryObjectBase->asServerObject() : NULL; + ServerObject *const inventoryObject = inventoryObjectBase ? inventoryObjectBase->asServerObject() : nullptr; if (!inventoryObject || (errorCode != Container::CEC_Success)) { WARNING(true, @@ -12629,7 +12629,7 @@ void CreatureObject::unequipAllItems() if (!inventoryContainer) { WARNING(true, - ("unequipAllItems() called on object id=[%s], template=[%s] on server id=[%d]: inventory object is NULL.", + ("unequipAllItems() called on object id=[%s], template=[%s] on server id=[%d]: inventory object is nullptr.", getNetworkId().getValueString().c_str(), getObjectTemplateName(), static_cast(GameServer::getInstance().getProcessId()) @@ -12648,11 +12648,11 @@ void CreatureObject::unequipAllItems() // Get the equipment item. Container::ContainedItem containedItem = *it; Object *const objectBase = containedItem.getObject(); - ServerObject *const object = objectBase ? objectBase->asServerObject() : NULL; + ServerObject *const object = objectBase ? objectBase->asServerObject() : nullptr; if (!object) { WARNING(true, - ("null object in equipment container for object id=[%s]: equipment item id=[%s].", + ("nullptr object in equipment container for object id=[%s]: equipment item id=[%s].", getNetworkId().getValueString().c_str(), containedItem.getValueString().c_str() )); @@ -12686,7 +12686,7 @@ void CreatureObject::unequipAllItems() if (!object) continue; - ContainerInterface::transferItemToVolumeContainer(*inventoryObject, *object, NULL, errorCode); + ContainerInterface::transferItemToVolumeContainer(*inventoryObject, *object, nullptr, errorCode); WARNING(errorCode != Container::CEC_Success, ("unequipAllItems(): CreatureObject id=[%s] failed to transfer item id=[%s], template=[%s] from equipment to inventory container, container error code [%d].", getNetworkId().getValueString().c_str(), @@ -13322,18 +13322,18 @@ CreatureObject * CreatureObject::getCreatureObject(NetworkId const & networkId) CreatureObject const * CreatureObject::asCreatureObject(Object const * object) { - ServerObject const * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + ServerObject const * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - return (serverObject != NULL) ? serverObject->asCreatureObject() : NULL; + return (serverObject != nullptr) ? serverObject->asCreatureObject() : nullptr; } // ---------------------------------------------------------------------- CreatureObject * CreatureObject::asCreatureObject(Object * object) { - ServerObject * serverObject = (object != NULL) ? object->asServerObject() : NULL; + ServerObject * serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - return (serverObject != NULL) ? serverObject->asCreatureObject() : NULL; + return (serverObject != nullptr) ? serverObject->asCreatureObject() : nullptr; } // ---------------------------------------------------------------------- @@ -13474,7 +13474,7 @@ void CreatureObject::pushedMe(const NetworkId & attackerId, UNREF(defenderPos); Vector offset(getPosition_w()); - if (attacker != NULL) + if (attacker != nullptr) offset -= attacker->getPosition_w(); else offset -= attackerPos; @@ -13489,14 +13489,14 @@ void CreatureObject::pushedMe(const NetworkId & attackerId, move_p(rotate_w2p(offset)); AICreatureController *controller = dynamic_cast(getController()); - if (controller != NULL) + if (controller != nullptr) { // we only need to do this for npcs, because we'll use the update from a player's client for players // we need to do this for npcs to prevent the ai from moving them back to their previous position const Vector newPos(getPosition_p()); float closestPortalT = 0.0f; const CellProperty * destinationCell = getParentCell()->getDestinationCell(oldPos, newPos, closestPortalT); - if (destinationCell == NULL || destinationCell == getParentCell()) + if (destinationCell == nullptr || destinationCell == getParentCell()) { // no cell change controller->warpTo(getParentCell(), newPos); @@ -13576,7 +13576,7 @@ bool CreatureObject::addSlowDownEffectProxy(const TangibleObject & defender, flo { // if we already are doing a slowdown, don't do another Property * property = getProperty(SlowDownProperty::getClassPropertyId()); - if (property != NULL) + if (property != nullptr) return false; property = new SlowDownProperty(*this, CachedNetworkId(defender), coneLength, coneAngle, slopeAngle, expireTime); @@ -13598,11 +13598,11 @@ void CreatureObject::removeSlowDownEffect() // tell all my proxies (client and server) to remove the effect Controller * const controller = getController(); if (controller) - controller->appendMessage(CM_removeSlowDownEffectProxy, 0, NULL, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_ALL_CLIENT | GameControllerMessageFlags::DEST_PROXY_SERVER); + controller->appendMessage(CM_removeSlowDownEffectProxy, 0, nullptr, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_ALL_CLIENT | GameControllerMessageFlags::DEST_PROXY_SERVER); } else { - sendControllerMessageToAuthServer(CM_removeSlowDownEffect, NULL); + sendControllerMessageToAuthServer(CM_removeSlowDownEffect, nullptr); } } @@ -13613,7 +13613,7 @@ void CreatureObject::removeSlowDownEffect() */ void CreatureObject::removeSlowDownEffectProxy() { - if (getProperty(SlowDownProperty::getClassPropertyId()) != NULL) + if (getProperty(SlowDownProperty::getClassPropertyId()) != nullptr) removeProperty(SlowDownProperty::getClassPropertyId()); } @@ -13631,7 +13631,7 @@ void CreatureObject::addTerrainSlopeEffect(const Vector & normal) if (isAuthoritative() && !isPlayerControlled()) { Property * property = getProperty(SlopeEffectProperty::getClassPropertyId()); - if (property == NULL) + if (property == nullptr) { property = new SlopeEffectProperty(*this); addProperty(*property, true); @@ -13994,7 +13994,7 @@ void CreatureObject::setLevel(int level) else { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if (playerObject == NULL) + if (playerObject == nullptr) { // this is an ai, so just set the level m_level = (int16) level; @@ -14014,7 +14014,7 @@ void CreatureObject::setLevel(int level) void CreatureObject::recalculateLevel() { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if (playerObject != NULL) + if (playerObject != nullptr) { if (!isAuthoritative()) { @@ -14044,7 +14044,7 @@ void CreatureObject::recalculateLevel() void CreatureObject::setLevelData(int16 level, int levelXp, int health) { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if (playerObject != NULL) + if (playerObject != nullptr) { m_totalLevelXp = levelXp; @@ -14278,7 +14278,7 @@ bool CreatureObject::doesLocomotionInvalidateCommand(Command const &cmd) const CommandQueue * CreatureObject::getCommandQueue() const { - if (m_commandQueue == NULL) + if (m_commandQueue == nullptr) { m_commandQueue = CommandQueue::getCommandQueue(*const_cast(this)); } @@ -14667,7 +14667,7 @@ void CreatureObject::incrementKillMeter(int amount) if (isPlayerControlled()) { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if (playerObject != NULL) + if (playerObject != nullptr) { playerObject->incrementKillMeter(amount); } @@ -14812,7 +14812,7 @@ void CreatureObject::getLfgCharacterData(LfgCharacterData & lfgCharacterData) co Vector const creaturePosition = findPosition_w(); Region const * const region = RegionMaster::getSmallestVisibleRegionAtPoint(planetObject->getName(), creaturePosition.x, creaturePosition.z); - if (region != NULL) + if (region != nullptr) lfgCharacterData.locationRegion = Unicode::wideToNarrow(region->getName()); // handle factional presence @@ -14853,7 +14853,7 @@ void CreatureObject::getLfgCharacterData(LfgCharacterData & lfgCharacterData) co { // is factional presence allowed while mounted? if (ConfigServerGame::getGcwFactionalPresenceMountedPct() <= 0) - playerOrMount = NULL; + playerOrMount = nullptr; } else { @@ -14863,7 +14863,7 @@ void CreatureObject::getLfgCharacterData(LfgCharacterData & lfgCharacterData) co if (playerOrMount) { CollisionProperty const * const collisionProperty = playerOrMount->getCollisionProperty(); - Footprint const * const footprint = (collisionProperty ? collisionProperty->getFootprint() : NULL); + Footprint const * const footprint = (collisionProperty ? collisionProperty->getFootprint() : nullptr); bool isOnSolidFloor = (footprint && footprint->isOnSolidFloor()); if (isOnSolidFloor) { @@ -14939,7 +14939,7 @@ void CreatureObject::getLfgCharacterData(LfgCharacterData & lfgCharacterData) co if (i.getValue(ctsTransactionDetail)) { Unicode::UnicodeStringVector tokens; - if (Unicode::tokenize(ctsTransactionDetail, tokens, NULL, NULL) && (tokens.size() >= 4)) + if (Unicode::tokenize(ctsTransactionDetail, tokens, nullptr, nullptr) && (tokens.size() >= 4)) { IGNORE_RETURN(lfgCharacterData.ctsSourceGalaxy.insert(Unicode::wideToNarrow(tokens[1]))); } @@ -15094,7 +15094,7 @@ void CreatureObjectNamespace::restoreItemDecorationLayout(CreatureObject & decor // item is not currently in the target room, need to move it bool needToMoveItem = false; bool needToRotateItem = false; - Transform const * itemCurrentTransform = NULL; + Transform const * itemCurrentTransform = nullptr; if (itemContainingCell->getNetworkId() != cellSo->getNetworkId()) { needToMoveItem = true; @@ -15344,7 +15344,7 @@ void CreatureObject::addPackedAppearanceWearable(std::string const &appearanceDa } } //-- Add the new entry. - m_wearableAppearanceData.push_back(WearableEntry(appearanceData, arrangementIndex, networkId, sharedTemplateCrcValue, NULL, NULL)); + m_wearableAppearanceData.push_back(WearableEntry(appearanceData, arrangementIndex, networkId, sharedTemplateCrcValue, nullptr, nullptr)); } // ---------------------------------------------------------------------- @@ -15511,7 +15511,7 @@ void CreatureObject::saveDecorationLayout(ServerObject const & pobSourceObject, } snprintf(buffer1, sizeof(buffer1)-1, "savedDecoration%d.saveTime", saveSlotNumber); - playerObj->setObjVarItem(buffer1, static_cast(::time(NULL))); + playerObj->setObjVarItem(buffer1, static_cast(::time(nullptr))); snprintf(buffer1, sizeof(buffer1)-1, "savedDecoration%d.pobName", saveSlotNumber); playerObj->setObjVarItem(buffer1, containingPOB->getObjectNameStringId().localize()); @@ -15607,7 +15607,7 @@ void CreatureObject::restoreDecorationLayout(ServerObject const & pobTargetObjec } // don't allow another restore on the pob while one is still in progress - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); int restoreDecorationOperationTimeout = 0; if (getObjVars().getItem("restoreDecorationOperation.timeout", restoreDecorationOperationTimeout) && (restoreDecorationOperationTimeout > timeNow)) { diff --git a/engine/server/library/serverGame/src/shared/object/CreatureObject.h b/engine/server/library/serverGame/src/shared/object/CreatureObject.h index f2fb0607..a1fab43b 100755 --- a/engine/server/library/serverGame/src/shared/object/CreatureObject.h +++ b/engine/server/library/serverGame/src/shared/object/CreatureObject.h @@ -194,7 +194,7 @@ public: virtual void onClientReady (Client *c); virtual void onClientAboutToLoad(); virtual void onLoadingScreenComplete(); - virtual bool canManipulateObject(ServerObject const &target, bool movingObject, bool doPermissionCheckOnItem, bool doPermissionCheckOnParent, float maxDistance, Container::ContainerErrorCode&, bool skipNoTradeCheck = false, bool * allowedByGodMode = NULL) const; + virtual bool canManipulateObject(ServerObject const &target, bool movingObject, bool doPermissionCheckOnItem, bool doPermissionCheckOnParent, float maxDistance, Container::ContainerErrorCode&, bool skipNoTradeCheck = false, bool * allowedByGodMode = nullptr) const; virtual void onRemovingFromWorld(); void addMembersToPackages(); @@ -330,7 +330,7 @@ public: void addAttributeModifier(const std::string & name, Attributes::Enumerator attrib, int value, float duration, float attackRate, float decayRate, int flags); void addSkillmodModifier(const std::string & name, const std::string & skill, int value, float duration, int flags); - int addAttributeModifier(const AttribMod::AttribMod & mod, ServerObject * attacker = NULL); + int addAttributeModifier(const AttribMod::AttribMod & mod, ServerObject * attacker = nullptr); bool hasAttribModifier(const std::string & modName) const; void removeAttributeModifier(const std::string & modName); void removeAttributeModifiers(Attributes::Enumerator attribute); @@ -747,7 +747,7 @@ private: void testIncapacitation(const NetworkId & attackerId); void initializeNewPlayer (); - void addPackedWearable(std::string const &appearanceData, int arrangementIndex, NetworkId const &networkId, uint32 sharedTemplateCrcValue, const BaselinesMessage * weaponSharedBaselines = NULL, const BaselinesMessage * weaponSharedNpBaselines = NULL); + void addPackedWearable(std::string const &appearanceData, int arrangementIndex, NetworkId const &networkId, uint32 sharedTemplateCrcValue, const BaselinesMessage * weaponSharedBaselines = nullptr, const BaselinesMessage * weaponSharedNpBaselines = nullptr); void addPackedAppearanceWearable(std::string const &appearanceData, int arrangementIndex, NetworkId const &networkId, uint32 sharedTemplateCrcValue); void packWearables(); void computeTotalAttributes (); diff --git a/engine/server/library/serverGame/src/shared/object/CreatureObject_Mounts.cpp b/engine/server/library/serverGame/src/shared/object/CreatureObject_Mounts.cpp index 1b164c1e..a0367619 100755 --- a/engine/server/library/serverGame/src/shared/object/CreatureObject_Mounts.cpp +++ b/engine/server/library/serverGame/src/shared/object/CreatureObject_Mounts.cpp @@ -77,18 +77,18 @@ CreatureObject * CreatureObjectNamespace::realGetMountingRider(CreatureObject co { //-- Ensure mounts are enabled. if (!ConfigServerGame::getMountsEnabled()) - return NULL; + return nullptr; //-- Get the rider element from the slotted container. SlottedContainer const * const slottedContainer = ContainerInterface::getSlottedContainer(*mount); if (!slottedContainer) - return NULL; + return nullptr; //-- Check for a rider. Container::ContainerErrorCode errorCode = Container::CEC_Success; CachedNetworkId riderId = slottedContainer->getObjectInSlot(slot, errorCode); if (errorCode != Container::CEC_Success) - return NULL; + return nullptr; Object * const riderObject = riderId.getObject(); @@ -236,7 +236,7 @@ bool CreatureObjectNamespace::realDetachRider(CreatureObject * const mount, Slot { // Transfer rider to world. // @todo: -TRF- transfer to mount's cell if we allow mounts inside cells. - IGNORE_RETURN(ContainerInterface::transferItemToWorld(*rider, mount->getTransform_o2w(), NULL, errorCode)); + IGNORE_RETURN(ContainerInterface::transferItemToWorld(*rider, mount->getTransform_o2w(), nullptr, errorCode)); if (errorCode == Container::CEC_Success) { detachedRider = true; @@ -318,7 +318,7 @@ void CreatureObject::transferRiderPositionToMount() CreatureObject *const mountObject = getMountedCreature(); if (!mountObject) { - LOG("mounts-bug", ("CreatureObject::transferRiderPositionToMount(): server id=[%d],object id=[%s] has state RidingMount but getMountedCreature() returns NULL.", static_cast(GameServer::getInstance().getProcessId()), getNetworkId().getValueString().c_str())); + LOG("mounts-bug", ("CreatureObject::transferRiderPositionToMount(): server id=[%d],object id=[%s] has state RidingMount but getMountedCreature() returns nullptr.", static_cast(GameServer::getInstance().getProcessId()), getNetworkId().getValueString().c_str())); emergencyDismountForRider(); return; } @@ -397,7 +397,7 @@ void CreatureObject::alterAuthoritativeForMounts() } } else - LOG(cs_mountErrorChannelName, ("unexpected: rider object id=[%s],template=[%s] is reporting state States::RidingMount turned on but getMountedCreature() returned NULL.", getNetworkId().getValueString().c_str(), getObjectTemplateName())); + LOG(cs_mountErrorChannelName, ("unexpected: rider object id=[%s],template=[%s] is reporting state States::RidingMount turned on but getMountedCreature() returned nullptr.", getNetworkId().getValueString().c_str(), getObjectTemplateName())); } else if (getState(States::MountedCreature)) { @@ -484,7 +484,7 @@ void CreatureObject::alterAnyForMounts() if (isAuthoritative() && !getState(States::MountedCreature)) { WARNING(true, - ("mounts sanity check failure: game server id=[%d], mount id=[%s,%s], rider id=[%s,%s]: authoritative mount does not have MountedCreature state set but getMountingRider returned a non-NULL value.", + ("mounts sanity check failure: game server id=[%d], mount id=[%s,%s], rider id=[%s,%s]: authoritative mount does not have MountedCreature state set but getMountingRider returned a non-nullptr value.", static_cast(GameServer::getInstance().getProcessId()), getNetworkId().getValueString().c_str(), isAuthoritative() ? "authoritative" : "proxy", @@ -511,7 +511,7 @@ void CreatureObject::alterAnyForMounts() // Ensure we don't have the mounted creature state set (only do check on authoritative mount). WARNING(isAuthoritative() && getState(States::MountedCreature), - ("mounts sanity check failure: game server id=[%d], mount id=[%s,%s]: authoritative mount does have MountedCreature state set but getMountingRider() returned a NULL value.", + ("mounts sanity check failure: game server id=[%d], mount id=[%s,%s]: authoritative mount does have MountedCreature state set but getMountingRider() returned a nullptr value.", static_cast(GameServer::getInstance().getProcessId()), getNetworkId().getValueString().c_str(), isAuthoritative() ? "authoritative" : "proxy" @@ -550,7 +550,7 @@ void CreatureObject::alterAnyForMounts() if (isAuthoritative() && !getState(States::RidingMount)) { WARNING(true, - ("mounts sanity check failure: game server id=[%d], rider id=[%s,%s], mount id=[%s,%s]: authoritative rider does not have RidingMount state set but getMountedCreature() returned a non-NULL value.", + ("mounts sanity check failure: game server id=[%d], rider id=[%s,%s], mount id=[%s,%s]: authoritative rider does not have RidingMount state set but getMountedCreature() returned a non-nullptr value.", static_cast(GameServer::getInstance().getProcessId()), getNetworkId().getValueString().c_str(), isAuthoritative() ? "authoritative" : "proxy", @@ -576,7 +576,7 @@ void CreatureObject::alterAnyForMounts() { // Ensure we don't have the RidingMount state set (only do check on authoritative rider). WARNING(isAuthoritative() && getState(States::RidingMount), - ("mounts sanity check failure: game server id=[%d], rider id=[%s,%s]: authoritative rider does have RidingMount state set but getMountedCreature() returned a NULL value.", + ("mounts sanity check failure: game server id=[%d], rider id=[%s,%s]: authoritative rider does have RidingMount state set but getMountedCreature() returned a nullptr value.", static_cast(GameServer::getInstance().getProcessId()), getNetworkId().getValueString().c_str(), isAuthoritative() ? "authoritative" : "proxy" @@ -599,13 +599,13 @@ bool CreatureObject::onContainerAboutToTransferForMounts(ServerObject const * de // (i.e. the container creature has not yet been set.) We must clear the RidingMount // state on a rider prior to intentionally dismounting the rider (see and use detachRider() // on the mount object. - bool const canChangeContainerNow = (getMountedCreature() == NULL); + bool const canChangeContainerNow = (getMountedCreature() == nullptr); if (!canChangeContainerNow) { LOG("mounts-bug", ("CO::onContainerAboutToTransferForMounts():server id=[%d],rider id=[%s] erroneously tried to transfer the player into object id=[%s].", static_cast(GameServer::getInstance().getProcessId()), getNetworkId().getValueString().c_str(), - (destination == NULL) ? "" : destination->getNetworkId().getValueString().c_str())); + (destination == nullptr) ? "" : destination->getNetworkId().getValueString().c_str())); } return canChangeContainerNow; } @@ -839,7 +839,7 @@ bool CreatureObject::detachAllRiders() if (!isAuthoritative()) { // add a plural message - sendControllerMessageToAuthServer(CM_detachAllRidersForMount, NULL); + sendControllerMessageToAuthServer(CM_detachAllRidersForMount, nullptr); return true; } @@ -988,9 +988,9 @@ bool CreatureObject::mountCreature(CreatureObject &mountObject) for (int i = 0; i < maxSlots; ++i) { - if (ContainerInterface::canTransferToSlot(mountObject, *this, s_riderSlotId[i], NULL, errorCode)) + if (ContainerInterface::canTransferToSlot(mountObject, *this, s_riderSlotId[i], nullptr, errorCode)) { - transferSuccess = ContainerInterface::transferItemToSlottedContainer(mountObject, *this, s_riderSlotId[i], NULL, errorCode); + transferSuccess = ContainerInterface::transferItemToSlottedContainer(mountObject, *this, s_riderSlotId[i], nullptr, errorCode); if ((transferSuccess) && (errorCode == Container::CEC_Success)) { @@ -1051,20 +1051,20 @@ CreatureObject *CreatureObject::getMountedCreature() { //-- Ensure mounts are enabled. if (!ConfigServerGame::getMountsEnabled()) - return NULL; + return nullptr; //-- Check this creature's container object. ServerObject *const container = safe_cast(ContainerInterface::getContainedByObject(*this)); if (!container) - return NULL; + return nullptr; //-- Check if the container is a creature. CreatureObject *const creatureContainer = container->asCreatureObject(); if (!creatureContainer) - return NULL; + return nullptr; //-- Ignore non-mountable creature objects. - CreatureObject *const mount = creatureContainer->isMountable() ? creatureContainer : NULL; + CreatureObject *const mount = creatureContainer->isMountable() ? creatureContainer : nullptr; return mount; } @@ -1096,7 +1096,7 @@ void CreatureObject::emergencyDismountForRider() //-- Pass request along to authoritative server if we're not it. if (!isAuthoritative()) { - sendControllerMessageToAuthServer(CM_emergencyDismountForRider, NULL); + sendControllerMessageToAuthServer(CM_emergencyDismountForRider, nullptr); return; } @@ -1116,7 +1116,7 @@ void CreatureObject::emergencyDismountForRider() //-- Transfer the rider to the world cell. Container::ContainerErrorCode errorCode = Container::CEC_Success; - bool const transferSucceeded = ContainerInterface::transferItemToWorld (*this, this->getTransform_o2w(), NULL, errorCode); + bool const transferSucceeded = ContainerInterface::transferItemToWorld (*this, this->getTransform_o2w(), nullptr, errorCode); WARNING(!transferSucceeded || (errorCode != Container::CEC_Success), ("Transfer to world failed, return value=[%s], error code=[%d].", transferSucceeded ? "true" : "false", static_cast(errorCode))); } diff --git a/engine/server/library/serverGame/src/shared/object/CreatureObject_Ships.cpp b/engine/server/library/serverGame/src/shared/object/CreatureObject_Ships.cpp index 3f9de076..a72020be 100755 --- a/engine/server/library/serverGame/src/shared/object/CreatureObject_Ships.cpp +++ b/engine/server/library/serverGame/src/shared/object/CreatureObject_Ships.cpp @@ -71,7 +71,7 @@ bool CreatureObject::pilotShip(ServerObject &pilotSlotObject) SlotId const pilotSlotId = pilotSlotObject.asShipObject() ? ShipSlotIdManager::getShipPilotSlotId() : ShipSlotIdManager::getPobShipPilotSlotId(); Container::ContainerErrorCode errorCode = Container::CEC_Success; - bool const transferSuccess = ContainerInterface::transferItemToSlottedContainer(pilotSlotObject, *this, pilotSlotId, NULL, errorCode); + bool const transferSuccess = ContainerInterface::transferItemToSlottedContainer(pilotSlotObject, *this, pilotSlotId, nullptr, errorCode); DEBUG_FATAL(transferSuccess && (errorCode != Container::CEC_Success), ("pilotShip(): transferItemToSlottedContainer() returned success but container error code returned error %d.", static_cast(errorCode))); if (transferSuccess) @@ -199,7 +199,7 @@ void CreatureObject::getAllShipsInDatapad(std::vector & result) const for(ContainerConstIterator iter = datapadContainer->begin(); iter != datapadContainer->end(); ++iter) { Object const * const itemO = (*iter).getObject(); - ServerObject const * const itemSO = itemO ? itemO->asServerObject() : NULL; + ServerObject const * const itemSO = itemO ? itemO->asServerObject() : nullptr; if(itemSO && (itemSO->getGameObjectType() == SharedObjectTemplate::GOT_data_ship_control_device)) { Container const * const itemContainer = ContainerInterface::getContainer(*itemSO); @@ -211,8 +211,8 @@ void CreatureObject::getAllShipsInDatapad(std::vector & result) const for(ContainerConstIterator iter2 = itemContainer->begin(); iter2 != itemContainer->end(); ++iter2) { Object const * const o = (*iter2).getObject(); - ServerObject const * const so = o ? o->asServerObject() : NULL; - ShipObject const * const ship = so ? so->asShipObject() : NULL; + ServerObject const * const so = o ? o->asServerObject() : nullptr; + ShipObject const * const ship = so ? so->asShipObject() : nullptr; if(ship) { result.push_back(ship->getNetworkId()); diff --git a/engine/server/library/serverGame/src/shared/object/DraftSchematicObject.cpp b/engine/server/library/serverGame/src/shared/object/DraftSchematicObject.cpp index 37ea045c..b0ec57ba 100755 --- a/engine/server/library/serverGame/src/shared/object/DraftSchematicObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/DraftSchematicObject.cpp @@ -36,8 +36,8 @@ static const std::string REQUEST_RESOURCE_WEIGHTS_SCRIPT_METHOD("OnRequestResour // ====================================================================== // static members -DraftSchematicObject::SchematicMap * DraftSchematicObject::m_schematics = NULL; -const SharedObjectTemplate * DraftSchematicObject::m_defaultSharedTemplate = NULL; +DraftSchematicObject::SchematicMap * DraftSchematicObject::m_schematics = nullptr; +const SharedObjectTemplate * DraftSchematicObject::m_defaultSharedTemplate = nullptr; // ====================================================================== @@ -105,13 +105,13 @@ const SharedObjectTemplate * DraftSchematicObject::getDefaultSharedTemplate(void { static const ConstCharCrcLowerString templateName("object/draft_schematic/base/shared_draft_schematic_default.iff"); - if (m_defaultSharedTemplate == NULL) + if (m_defaultSharedTemplate == nullptr) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create " + WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create " "default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) ExitChain::add (removeDefaultTemplate, "DraftSchematicObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -124,10 +124,10 @@ static const ConstCharCrcLowerString templateName("object/draft_schematic/base/s */ void DraftSchematicObject::removeDefaultTemplate(void) { - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } // DraftSchematicObject::removeDefaultTemplate @@ -141,21 +141,21 @@ void DraftSchematicObject::removeDefaultTemplate(void) */ void DraftSchematicObject::requestResourceWeights(ServerObject & requester, uint32 draftSchematicCrc) { - if (requester.getClient() == NULL) + if (requester.getClient() == nullptr) { WARNING (true, ("DraftSchematicObject::requestResourceWeights invalid client for [%s]", requester.getNetworkId ().getValueString ().c_str ())); return; } const DraftSchematicObject * const schematic = getSchematic(draftSchematicCrc); - if (schematic == NULL) + if (schematic == nullptr) { WARNING (true, ("DraftSchematicObject::requestResourceWeights invalid schematic [%lu] for [%s]", draftSchematicCrc, requester.getNetworkId ().getValueString ().c_str ())); return; } const ServerDraftSchematicObjectTemplate * const schematicTemplate = safe_cast(schematic->getObjectTemplate()); - if (schematicTemplate == NULL) + if (schematicTemplate == nullptr) { WARNING (true, ("DraftSchematicObject::requestResourceWeights invalid schematic template [%lu] for [%s]", draftSchematicCrc, requester.getNetworkId ().getValueString ().c_str ())); return; @@ -167,7 +167,7 @@ void DraftSchematicObject::requestResourceWeights(ServerObject & requester, uint desiredAttribs.push_back((*i).first.getText().c_str()); } - std::vector attributes(MAX_ATTRIBUTES * 2, static_cast(NULL)); + std::vector attributes(MAX_ATTRIBUTES * 2, static_cast(nullptr)); std::vector slots(MAX_ATTRIBUTES * 2, 0); std::vector counts(MAX_ATTRIBUTES * 2, 0); std::vector weights(MAX_ATTRIBUTES * 2 * Crafting::RA_numResourceAttributes * 2, 0); @@ -198,7 +198,7 @@ void DraftSchematicObject::requestResourceWeights(ServerObject & requester, uint for (std::vector::const_iterator i(newAttributes.begin()); i != newAttributes.end(); ++i, ++attribCount) { - if (*i == NULL) + if (*i == nullptr) break; } } @@ -257,8 +257,8 @@ ManufactureSchematicObject * DraftSchematicObject::createManufactureSchematic( { Object * object = ServerManufactureSchematicObjectTemplate::createObject( "object/manufacture_schematic/generic_schematic.iff", *this); - if (object == NULL) - return NULL; + if (object == nullptr) + return nullptr; ManufactureSchematicObject * schematic = safe_cast(object); schematic->init(*this, creator); schematic->setNetworkId(ObjectIdManager::getInstance().getNewObjectId()); @@ -478,8 +478,8 @@ const DraftSchematicObject * DraftSchematicObject::getSchematic( const DraftSchematicObject * DraftSchematicObject::getSchematic(uint32 crc) { NOT_NULL(m_schematics); - if (m_schematics == NULL || crc == 0) - return NULL; + if (m_schematics == nullptr || crc == 0) + return nullptr; // see if the schematic is already loaded SchematicMap::iterator result = m_schematics->find(crc); @@ -491,30 +491,30 @@ const DraftSchematicObject * DraftSchematicObject::getSchematic(uint32 crc) if (name.isEmpty()) { WARNING(true, ("Unable to find template name for crc %u", crc)); - return NULL; + return nullptr; } // create a new schematic if (!TreeFile::exists(name.getString())) { WARNING(true, ("Draft schematic template %s file not found", name.getString())); - return NULL; + return nullptr; } const ObjectTemplate * objTemplate = ObjectTemplateList::fetch(name); - if (objTemplate == NULL) + if (objTemplate == nullptr) { WARNING(true, ("Can't create object template %s", name.getString())); - return NULL; + return nullptr; } const ServerDraftSchematicObjectTemplate * schematicTemplate = dynamic_cast(objTemplate); - if (schematicTemplate == NULL) + if (schematicTemplate == nullptr) { WARNING(true, ("Template %s is not a draft schematic", name.getString())); objTemplate->releaseReference(); - return NULL; + return nullptr; } const DraftSchematicObject * schematic = new DraftSchematicObject(schematicTemplate); @@ -531,7 +531,7 @@ const DraftSchematicObject * DraftSchematicObject::getSchematic(uint32 crc) */ void DraftSchematicObject::install() { - if (m_schematics == NULL) + if (m_schematics == nullptr) m_schematics = new SchematicMap(); } // DraftSchematicObject::install @@ -542,16 +542,16 @@ void DraftSchematicObject::install() */ void DraftSchematicObject::remove() { - if (m_schematics != NULL) + if (m_schematics != nullptr) { SchematicMap::iterator iter; for (iter = m_schematics->begin(); iter != m_schematics->end(); ++iter) { delete (*iter).second; - (*iter).second = NULL; + (*iter).second = nullptr; } delete m_schematics; - m_schematics = NULL; + m_schematics = nullptr; } } // DraftSchematicObject::remove diff --git a/engine/server/library/serverGame/src/shared/object/FactoryObject.cpp b/engine/server/library/serverGame/src/shared/object/FactoryObject.cpp index 77e6780b..66481dad 100755 --- a/engine/server/library/serverGame/src/shared/object/FactoryObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/FactoryObject.cpp @@ -58,7 +58,7 @@ static const StringId STRING_ID_CANT_SPLIT("system_msg", "cant_split_crate"); //---------------------------------------------------------------------- -const SharedObjectTemplate * FactoryObject::m_defaultSharedTemplate = NULL; +const SharedObjectTemplate * FactoryObject::m_defaultSharedTemplate = nullptr; //----------------------------------------------------------------------- @@ -176,7 +176,7 @@ void FactoryObject::onLoadedFromDatabase() if (getLoadContents() && getCount() > 0) { // verify that we have a contained object - if (getContainedObject() == NULL) + if (getContainedObject() == nullptr) { WARNING_STRICT_FATAL(true, ("Factory object %s has a count of %d, " "but no contained object! We are setting the count to 0.", @@ -197,11 +197,11 @@ const SharedObjectTemplate * FactoryObject::getDefaultSharedTemplate() const { static const ConstCharCrcLowerString templateName("object/factory/base/shared_factory_default.iff"); - if (m_defaultSharedTemplate == NULL) + if (m_defaultSharedTemplate == nullptr) { m_defaultSharedTemplate = safe_cast(ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != NULL) + WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create default shared object template %s", templateName.getString())); + if (m_defaultSharedTemplate != nullptr) ExitChain::add (removeDefaultTemplate, "FactoryObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -214,10 +214,10 @@ const SharedObjectTemplate * FactoryObject::getDefaultSharedTemplate() const */ void FactoryObject::removeDefaultTemplate() { - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } // FactoryObject::removeDefaultTemplate @@ -288,10 +288,10 @@ bool FactoryObject::isFactoryOk() const char errBuffer[BUFSIZE]; const DraftSchematicObject * draft = DraftSchematicObject::getSchematic( getDraftSchematic()); - if (draft != NULL) + if (draft != nullptr) { // make sure we have an object instance defined - if (getCount() > 0 && getContainedObject() == NULL) + if (getCount() > 0 && getContainedObject() == nullptr) { sprintf(errBuffer, "not having a contained object instance"); factoryOk = false; @@ -307,16 +307,16 @@ bool FactoryObject::isFactoryOk() const { // send out logs/emails m_badFactoryLogged = true; - const ServerObject * owner = NULL; + const ServerObject * owner = nullptr; const Object * object = NetworkIdManager::getObjectById(getOwnerId()); - if (object != NULL) + if (object != nullptr) owner = object->asServerObject(); // log that the schematic can't be used LOG("CustomerService", ("Crafting: factory crate object %s " "owned by %s is unuseable due to %s", getNetworkId().getValueString().c_str(), PlayerObject::getAccountDescription(owner).c_str(), errBuffer)); - if (owner != NULL) + if (owner != nullptr) { // send mail to the owner telling them their schematic can't be used const static StringId message("system_msg", "crate_unuseable"); @@ -351,7 +351,7 @@ bool FactoryObject::canDestroy() const OutOfBandPackager::pack(pp, -1, oob); } const Object * const owner = NetworkIdManager::getObjectById(getOwnerId()); - if (owner != NULL) + if (owner != nullptr) { Chat::sendSystemMessage(*(owner->asServerObject()), Unicode::emptyString, oob); } @@ -367,14 +367,14 @@ bool FactoryObject::canDestroy() const void FactoryObject::onContainerTransfer(ServerObject * destination, ServerObject* transferer) { - if (inCraftingSession() && destination != NULL && + if (inCraftingSession() && destination != nullptr && destination->getNetworkId() != m_craftingSchematic.get()) { if (!isFactoryOk()) return; Object * schematic = m_craftingSchematic.get().getObject(); - if (schematic == NULL) + if (schematic == nullptr) { WARNING(true, ("FactoryObject::onContainerTransfer: could not get the schematic for factory %s", getNetworkId().getValueString().c_str())); return; @@ -387,13 +387,13 @@ void FactoryObject::onContainerTransfer(ServerObject * destination, // our components to reference if (m_craftingCount.get() != 0) { - FactoryObject * newFactory = NULL; + FactoryObject * newFactory = nullptr; if (getCount() > 1) { // make a new factory in the manf schematic newFactory = makeCopy(*(m_craftingSchematic.get().getObject()-> asServerObject()), 1); - if (newFactory != NULL) + if (newFactory != nullptr) { // NOTE: potential dupe here, but the player shouldn't be able to // remove the new factory without decreasing the component count @@ -403,26 +403,26 @@ void FactoryObject::onContainerTransfer(ServerObject * destination, // swap the contained item instances so that any current references // will point to a local object TangibleObject * myObject = const_cast(getContainedObject()); - if (myObject == NULL) + if (myObject == nullptr) { - WARNING(true, ("FactoryObject::onContainerTransfer: getContainedObject for %s returned NULL", getNetworkId().getValueString().c_str())); + WARNING(true, ("FactoryObject::onContainerTransfer: getContainedObject for %s returned nullptr", getNetworkId().getValueString().c_str())); return; } TangibleObject * newObject = const_cast(newFactory->getContainedObject()); - if (newObject == NULL) + if (newObject == nullptr) { - WARNING(true, ("FactoryObject::onContainerTransfer: getContainedObject for %s returned NULL", newFactory->getNetworkId().getValueString().c_str())); + WARNING(true, ("FactoryObject::onContainerTransfer: getContainedObject for %s returned nullptr", newFactory->getNetworkId().getValueString().c_str())); newFactory->permanentlyDestroy(DeleteReasons::SetupFailed); return; } Container::ContainerErrorCode error; - if (!ContainerInterface::transferItemToVolumeContainer (*newFactory, *myObject, NULL, error)) + if (!ContainerInterface::transferItemToVolumeContainer (*newFactory, *myObject, nullptr, error)) { WARNING(true, ("FactoryObject::onContainerTransfer: could not transfer factory %s to container %s", newFactory->getNetworkId().getValueString().c_str(), myObject->getNetworkId().getValueString().c_str())); newFactory->permanentlyDestroy(DeleteReasons::SetupFailed); return; } - if (!ContainerInterface::transferItemToVolumeContainer (*this, *newObject, NULL, error)) + if (!ContainerInterface::transferItemToVolumeContainer (*this, *newObject, nullptr, error)) { WARNING(true, ("FactoryObject::onContainerTransfer: could not transfer factory %s to container %s", getNetworkId().getValueString().c_str(), newObject->getNetworkId().getValueString().c_str())); return; @@ -434,7 +434,7 @@ void FactoryObject::onContainerTransfer(ServerObject * destination, // make a new factory with one item, but don't destroy ourself newFactory = makeCopy(*(m_craftingSchematic.get().getObject()-> asServerObject()), 1, false); - if (newFactory == NULL) + if (newFactory == nullptr) { WARNING(true, ("FactoryObject::onContainerTransfer: could not make a copy of factory %s", getNetworkId().getValueString().c_str())); return; @@ -448,9 +448,9 @@ void FactoryObject::onContainerTransfer(ServerObject * destination, // update the crafting status of ourself and the new factory ManufactureSchematicObject * schematic = safe_cast( m_craftingSchematic.get().getObject()); - if (schematic != NULL) + if (schematic != nullptr) { - if (newFactory != NULL) + if (newFactory != nullptr) { // set up the new factory to have the same crafting info // that we do @@ -525,7 +525,7 @@ bool FactoryObject::inCraftingSession() const return false; // make sure the crafting schematic id is a valid object - if (m_craftingSchematic.get().getObject() == NULL) + if (m_craftingSchematic.get().getObject() == nullptr) { WARNING_STRICT_FATAL(true, ("FactoryObject %s has a schematic id of %s " "that isn't a valid object!!!", getNetworkId().getValueString().c_str(), @@ -598,7 +598,7 @@ bool FactoryObject::addObject() if (getCount() == 0) { TangibleObject * object = manufactureObject(); - if (object != NULL) + if (object != nullptr) { setObjectName(object->getObjectName()); setComplexity(object->getComplexity()); @@ -615,7 +615,7 @@ bool FactoryObject::addObject() } const ServerObject * parent = safe_cast(ContainerInterface::getFirstParentInWorld(*this)); - if (parent != NULL) + if (parent != nullptr) LOG("CustomerService", ("Crafting:incrementing count of crate %s (owner %s) to %d", getNetworkId().getValueString().c_str(), PlayerObject::getAccountDescription(parent->getOwnerId()).c_str(), getCount())); else LOG("CustomerService", ("Crafting:incrementing count of crate %s to %d", getNetworkId().getValueString().c_str(), getCount())); @@ -645,7 +645,7 @@ bool FactoryObject::removeObject(ServerObject & destination) if (!isFactoryOk()) return false; - if (getCount() > 0 && ContainerInterface::getVolumeContainer(destination) != NULL) + if (getCount() > 0 && ContainerInterface::getVolumeContainer(destination) != nullptr) { if (!getLoadContents()) { @@ -665,7 +665,7 @@ bool FactoryObject::removeObject(ServerObject & destination) else { // new style factory - TangibleObject * object = NULL; + TangibleObject * object = nullptr; if (getCount() > 1) { object = manufactureObject(); @@ -686,7 +686,7 @@ bool FactoryObject::removeObject(ServerObject & destination) } const CachedNetworkId & id = *(container->begin()); Object * obj = id.getObject(); - if (obj != NULL && obj->asServerObject()->asTangibleObject() != NULL) + if (obj != nullptr && obj->asServerObject()->asTangibleObject() != nullptr) { object = obj->asServerObject()->asTangibleObject(); } @@ -706,15 +706,15 @@ bool FactoryObject::removeObject(ServerObject & destination) object = manufactureObject(); } } - if (object != NULL) + if (object != nullptr) { Container::ContainerErrorCode error; - if (ContainerInterface::transferItemToVolumeContainer(destination, *object, NULL, error)) + if (ContainerInterface::transferItemToVolumeContainer(destination, *object, nullptr, error)) { incrementCount(-1); const ServerObject * parent = safe_cast(ContainerInterface::getFirstParentInWorld(destination)); - if (parent != NULL) + if (parent != nullptr) LOG("CustomerService", ("Crafting:removed object %s from crate %s to container %s of player %s. Crate count = %d", object->getNetworkId().getValueString().c_str(), getNetworkId().getValueString().c_str(), destination.getNetworkId().getValueString().c_str(), PlayerObject::getAccountDescription(parent->getNetworkId()).c_str(), getCount())); else LOG("CustomerService", ("Crafting:removed object %s from crate %s to container %s. Crate count = %d", object->getNetworkId().getValueString().c_str(), getNetworkId().getValueString().c_str(), destination.getNetworkId().getValueString().c_str(), getCount())); @@ -828,14 +828,14 @@ void FactoryObject::onContainedObjectLoaded(const NetworkId &oid) // check if the object is on our pending list ServerObject * destination = removeIdFromPendingList(oid); - if (destination != NULL) + if (destination != nullptr) { TangibleObject * item = safe_cast(NetworkIdManager::getObjectById( oid)); - if (item != NULL) + if (item != nullptr) { Container::ContainerErrorCode error = Container::CEC_Success; - if (ContainerInterface::transferItemToVolumeContainer(*destination, *item, NULL, error)) + if (ContainerInterface::transferItemToVolumeContainer(*destination, *item, nullptr, error)) { // if that was the last item of ours, delete ourself if (getCount() == 0 && getPendingListCount() == 0) @@ -849,7 +849,7 @@ void FactoryObject::onContainedObjectLoaded(const NetworkId &oid) item->unload(); // tell the owner something went wrong Object * owner = NetworkIdManager::getObjectById(getOwnerId()); - if (owner != NULL) + if (owner != nullptr) { ContainerInterface::sendContainerMessageToClient(*safe_cast(owner), error); } @@ -873,35 +873,35 @@ void FactoryObject::onContainedObjectLoaded(const NetworkId &oid) * functionality of ManufactureSchematicObject::manufactureObject; if that * function changes, this one should too. * - * @return the new object, or NULL on error + * @return the new object, or nullptr on error */ TangibleObject * FactoryObject::manufactureObject() { if (!isFactoryOk()) - return NULL; + return nullptr; const DraftSchematicObject * draftSchematic = DraftSchematicObject::getSchematic(getDraftSchematic()); - if (draftSchematic == NULL) + if (draftSchematic == nullptr) { - return NULL; + return nullptr; } - if (draftSchematic->getCraftedObjectTemplate() == NULL) + if (draftSchematic->getCraftedObjectTemplate() == nullptr) { DEBUG_WARNING(true, ("Draft schematic %s does not have a craftable object template!\n", draftSchematic->getTemplateName())); - return NULL; + return nullptr; } // create the item TangibleObject * const object = dynamic_cast( ServerWorld::createNewObject(*draftSchematic->getCraftedObjectTemplate(), *this, false)); - if (object == NULL) + if (object == nullptr) { DEBUG_WARNING(true, ("Player %s failed to create object for template " "%s.\n", getOwnerId().getValueString().c_str(), draftSchematic->getCraftedObjectTemplate()->getName())); - return NULL; + return nullptr; } if (!getAssignedObjectName().empty()) @@ -928,7 +928,7 @@ TangibleObject * FactoryObject::manufactureObject() // set the creator xp type from the schematic template const ServerObjectTemplate * schematicTemplate = safe_cast(draftSchematic->getObjectTemplate()); - if (schematicTemplate != NULL && schematicTemplate->getXpPointsCount() > 0) + if (schematicTemplate != nullptr && schematicTemplate->getXpPointsCount() > 0) { ServerObjectTemplate::Xp xpData; schematicTemplate->getXpPoints(xpData, 0); @@ -948,7 +948,7 @@ TangibleObject * FactoryObject::manufactureObject() if (result == SCRIPT_OVERRIDE) { object->permanentlyDestroy(DeleteReasons::Script); - return NULL; + return nullptr; } return object; @@ -968,10 +968,10 @@ const char * FactoryObject::getContainedTemplateName() const const VolumeContainer * container = ContainerInterface::getVolumeContainer(*this); const CachedNetworkId & id = *(container->begin()); const Object * obj = id.getObject(); - if (obj != NULL && obj->asServerObject() != NULL) + if (obj != nullptr && obj->asServerObject() != nullptr) return obj->asServerObject()->getTemplateName(); } - return NULL; + return nullptr; } // FactoryObject::getContainedTemplateName // ---------------------------------------------------------------------- @@ -997,10 +997,10 @@ static std::string sharedTemplateName; const VolumeContainer * container = ContainerInterface::getVolumeContainer(*this); const CachedNetworkId & id = *(container->begin()); const Object * obj = id.getObject(); - if (obj != NULL && obj->asServerObject() != NULL) + if (obj != nullptr && obj->asServerObject() != nullptr) return obj->asServerObject()->getSharedTemplateName(); } - return NULL; + return nullptr; } // FactoryObject::getContainedSharedTemplateName // ---------------------------------------------------------------------- @@ -1017,10 +1017,10 @@ const ObjectTemplate * FactoryObject::getContainedObjectTemplate() const const VolumeContainer * container = ContainerInterface::getVolumeContainer(*this); const CachedNetworkId & id = *(container->begin()); const Object * obj = id.getObject(); - if (obj != NULL && obj->asServerObject() != NULL) + if (obj != nullptr && obj->asServerObject() != nullptr) return obj->asServerObject()->getObjectTemplate(); } - return NULL; + return nullptr; } // FactoryObject::getContainedObjectTemplate // ---------------------------------------------------------------------- @@ -1037,12 +1037,12 @@ const TangibleObject * FactoryObject::getContainedObject() const const VolumeContainer * container = ContainerInterface::getVolumeContainer(*this); const CachedNetworkId & id = *(container->begin()); const Object * obj = id.getObject(); - if (obj != NULL && obj->asServerObject() != NULL) + if (obj != nullptr && obj->asServerObject() != nullptr) { return obj->asServerObject()->asTangibleObject(); } } - return NULL; + return nullptr; } // FactoryObject::getContainedObject // ---------------------------------------------------------------------- @@ -1109,7 +1109,7 @@ ServerObject * FactoryObject::removeIdFromPendingList(const NetworkId & id) NetworkId objectId; if (!pendingList.getItem(idString,objectId)) - return NULL; + return nullptr; ServerObject * const object = safe_cast(NetworkIdManager::getObjectById(objectId)); removeObjVarItem(pendingList.getContextName() + idString); @@ -1415,7 +1415,7 @@ FactoryObject * FactoryObject::makeCopy(ServerObject & destination, int count, bool destroySource) { if (!isFactoryOk()) - return NULL; + return nullptr; // don't allow making a copy if we are an old crate if (!getLoadContents()) @@ -1428,52 +1428,52 @@ FactoryObject * FactoryObject::makeCopy(ServerObject & destination, int count, OutOfBandPackager::pack(pp, -1, oob); } const Object * const owner = NetworkIdManager::getObjectById(getOwnerId()); - if (owner != NULL) + if (owner != nullptr) { Chat::sendSystemMessage(*(owner->asServerObject()), Unicode::emptyString, oob); } - return NULL; + return nullptr; } if (count <= 0) { WARNING_STRICT_FATAL(true, ("FactoryObject::makeCopy %s passed invalid " "count %d", getNetworkId().getValueString().c_str(), count)); - return NULL; + return nullptr; } if (count > getCount()) { WARNING_STRICT_FATAL(true, ("FactoryObject::makeCopy %s given count %d " "that is > than our count %d", getNetworkId().getValueString().c_str(), count, getCount())); - return NULL; + return nullptr; } VolumeContainer *destVolumeContainer = ContainerInterface::getVolumeContainer(destination); - if (destVolumeContainer == NULL) + if (destVolumeContainer == nullptr) { WARNING_STRICT_FATAL(true, ("FactoryObject::makeCopy %s passed " "destination %s that is not a volume container", getNetworkId().getValueString().c_str(), destination.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } // create the new factory - if (safe_cast(getObjectTemplate()) == NULL) + if (safe_cast(getObjectTemplate()) == nullptr) { WARNING_STRICT_FATAL(true, ("FactoryObject::makeCopy: %s has no object template!", getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } FactoryObject * newFactory = safe_cast(ServerWorld::createNewObject( *safe_cast(getObjectTemplate()), destination, false)); - if (newFactory == NULL) + if (newFactory == nullptr) { WARNING_STRICT_FATAL(true, ("FactoryObject::makeCopy %s could not create " "the new factory", getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } // copy our objvars and scripts to the new factory @@ -1523,11 +1523,11 @@ FactoryObject * FactoryObject::makeCopy(ServerObject & destination, int count, // move our contained object to the new factory, and delete ourself if // we aren't already being deleted const TangibleObject * object = FactoryObject::getContainedObject(); - if (object != NULL) + if (object != nullptr) { Container::ContainerErrorCode error; ContainerInterface::transferItemToVolumeContainer(*newFactory, - *const_cast(object), NULL, error); + *const_cast(object), nullptr, error); newFactory->setCount(count); setCount(0); if (destroySource && !isBeingDestroyed()) @@ -1545,7 +1545,7 @@ FactoryObject * FactoryObject::makeCopy(ServerObject & destination, int count, else { newFactory->permanentlyDestroy(DeleteReasons::SetupFailed); - newFactory = NULL; + newFactory = nullptr; } } return newFactory; @@ -1575,7 +1575,7 @@ void FactoryObject::getAttributes(AttributeVector & data) const { // new-style crate const ServerObject * const storedObject = getContainedObject(); - if (storedObject != NULL) + if (storedObject != nullptr) { data.reserve (data.size () + 2); diff --git a/engine/server/library/serverGame/src/shared/object/GroupIdObserver.cpp b/engine/server/library/serverGame/src/shared/object/GroupIdObserver.cpp index 50373712..60b827ca 100755 --- a/engine/server/library/serverGame/src/shared/object/GroupIdObserver.cpp +++ b/engine/server/library/serverGame/src/shared/object/GroupIdObserver.cpp @@ -31,11 +31,11 @@ GroupIdObserver::~GroupIdObserver() if (m_group && m_creature->getGroup() != m_group) m_group->removeGroupMember(m_creature->getNetworkId()); - if (m_creature->getGroup() != NULL) + if (m_creature->getGroup() != nullptr) { PlayerObject *playerObject = PlayerCreatureController::getPlayerObject(m_creature); - if ((playerObject != NULL) && + if ((playerObject != nullptr) && playerObject->isLookingForGroup()) { playerObject->setLookingForGroup(false); diff --git a/engine/server/library/serverGame/src/shared/object/GroupObject.cpp b/engine/server/library/serverGame/src/shared/object/GroupObject.cpp index 76390349..4c8d69e4 100755 --- a/engine/server/library/serverGame/src/shared/object/GroupObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/GroupObject.cpp @@ -1412,7 +1412,7 @@ unsigned int GroupObject::getSecondsLeftOnGroupPickup() const std::pair const & groupPickupTimer = m_groupPickupTimer.get(); if ((groupPickupTimer.first > 0) && (groupPickupTimer.second > 0)) { - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); if (groupPickupTimer.second > timeNow) return (groupPickupTimer.second - (int)timeNow); } diff --git a/engine/server/library/serverGame/src/shared/object/GuildObject.cpp b/engine/server/library/serverGame/src/shared/object/GuildObject.cpp index f0215358..0ee903a1 100755 --- a/engine/server/library/serverGame/src/shared/object/GuildObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/GuildObject.cpp @@ -140,9 +140,9 @@ void GuildObject::setupUniverse() // build the guild and guild member info from data read in from DB // disable notification while building the initial list - m_membersInfo.setOnErase(NULL, NULL); - m_membersInfo.setOnInsert(NULL, NULL); - m_membersInfo.setOnSet(NULL, NULL); + m_membersInfo.setOnErase(nullptr, nullptr); + m_membersInfo.setOnInsert(nullptr, nullptr); + m_membersInfo.setOnSet(nullptr, nullptr); // build names { @@ -238,7 +238,7 @@ void GuildObject::setupUniverse() // update guild info members count GuildInfo & gi = guildInfoMembersCount[guildId]; GuildMemberInfo const * const existingGmi = getGuildMemberInfo(guildId, memberId); - updateGuildInfoMembersCount(gi, (existingGmi ? ((existingGmi->m_permissions == -1) ? &allAdministrativePermissions : &(existingGmi->m_permissions)) : NULL), ((permissions == -1) ? &allAdministrativePermissions : &permissions)); + updateGuildInfoMembersCount(gi, (existingGmi ? ((existingGmi->m_permissions == -1) ? &allAdministrativePermissions : &(existingGmi->m_permissions)) : nullptr), ((permissions == -1) ? &allAdministrativePermissions : &permissions)); if (existingGmi) { @@ -391,7 +391,7 @@ GuildInfo const * GuildObject::getGuildInfo(int guildId) const if (iterFind != m_guildsInfo.end()) return &(iterFind->second); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -402,7 +402,7 @@ GuildMemberInfo const * GuildObject::getGuildMemberInfo(int guildId, NetworkId c if (iterFind != m_membersInfo.end()) return &(iterFind->second); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -738,7 +738,7 @@ void GuildObject::removeGuildMember(int guildId, NetworkId const &memberId) m_members.erase(memberSpec); GuildInfo updatedGi(gi); - updateGuildInfoMembersCount(updatedGi, &(gmi->m_permissions), NULL); + updateGuildInfoMembersCount(updatedGi, &(gmi->m_permissions), nullptr); m_guildsInfo.set(guildId, updatedGi); std::map::const_iterator iterFind = m_fullMembers.find(memberId); @@ -771,7 +771,7 @@ void GuildObject::addGuildCreatorMember(int guildId, NetworkId const &memberId, if (realMemberName.empty() && existingGmi) realMemberName = existingGmi->m_name; - ServerObject const *so = NULL; + ServerObject const *so = nullptr; if (realMemberName.empty()) { so = ServerWorld::findObjectByNetworkId(memberId); @@ -848,7 +848,7 @@ void GuildObject::addGuildCreatorMember(int guildId, NetworkId const &memberId, m_members.insert(memberSpec); GuildInfo updatedGi(gi); - updateGuildInfoMembersCount(updatedGi, (existingGmi ? &(existingGmi->m_permissions) : NULL), &permissions); + updateGuildInfoMembersCount(updatedGi, (existingGmi ? &(existingGmi->m_permissions) : nullptr), &permissions); m_guildsInfo.set(guildId, updatedGi); if (existingGmi) @@ -883,7 +883,7 @@ void GuildObject::addGuildSponsorMember(int guildId, NetworkId const &memberId, if (realMemberName.empty() && existingGmi) realMemberName = existingGmi->m_name; - ServerObject const *so = NULL; + ServerObject const *so = nullptr; if (realMemberName.empty()) { so = ServerWorld::findObjectByNetworkId(memberId); @@ -958,7 +958,7 @@ void GuildObject::addGuildSponsorMember(int guildId, NetworkId const &memberId, m_members.insert(memberSpec); GuildInfo updatedGi(gi); - updateGuildInfoMembersCount(updatedGi, (existingGmi ? &(existingGmi->m_permissions) : NULL), &permissions); + updateGuildInfoMembersCount(updatedGi, (existingGmi ? &(existingGmi->m_permissions) : nullptr), &permissions); m_guildsInfo.set(guildId, updatedGi); if (existingGmi) @@ -1465,7 +1465,7 @@ void GuildObject::modifyGuildWarKillTracking(int killerGuildId, int victimGuildI } if (updateTime <= 0) - updateTime = static_cast(::time(NULL)); + updateTime = static_cast(::time(nullptr)); // queue up adjustments and periodically update the data std::pair, std::pair >::iterator, bool> result = m_guildWarKillTrackingAdjustment.insert(std::make_pair(std::make_pair(killerGuildId, victimGuildId), std::make_pair(adjustment, updateTime))); @@ -1635,7 +1635,7 @@ void GuildObject::setGuildFaction(int guildId, uint32 guildFaction) if (factionChange) { - int const timeLeftGuildFaction = static_cast(::time(NULL)); + int const timeLeftGuildFaction = static_cast(::time(nullptr)); std::string oldNameSpec, newNameSpec; GuildStringParser::buildNameSpec(guildId, gi->m_name, gi->m_guildElectionPreviousEndTime, gi->m_guildElectionNextEndTime, gi->m_guildFaction, gi->m_timeLeftGuildFaction, gi->m_guildGcwDefenderRegion, gi->m_timeJoinedGuildGcwDefenderRegion, gi->m_timeLeftGuildGcwDefenderRegion, oldNameSpec); @@ -1723,7 +1723,7 @@ void GuildObject::setGuildGcwDefenderRegion(int guildId, std::string const &guil if ((gi->m_guildGcwDefenderRegion == guildGcwDefenderRegion) && (gi->m_timeJoinedGuildGcwDefenderRegion > 0)) timeJoinedGuildGcwDefenderRegion = gi->m_timeJoinedGuildGcwDefenderRegion; else - timeJoinedGuildGcwDefenderRegion = static_cast(::time(NULL)); + timeJoinedGuildGcwDefenderRegion = static_cast(::time(nullptr)); } } else if (gi->m_guildGcwDefenderRegion != guildGcwDefenderRegion) @@ -1732,13 +1732,13 @@ void GuildObject::setGuildGcwDefenderRegion(int guildId, std::string const &guil if (!guildGcwDefenderRegion.empty()) { - timeJoinedGuildGcwDefenderRegion = static_cast(::time(NULL)); + timeJoinedGuildGcwDefenderRegion = static_cast(::time(nullptr)); } else { // stop defending timeJoinedGuildGcwDefenderRegion = gi->m_timeJoinedGuildGcwDefenderRegion; - timeLeftGuildGcwDefenderRegion = static_cast(::time(NULL)); + timeLeftGuildGcwDefenderRegion = static_cast(::time(nullptr)); } } @@ -2052,7 +2052,7 @@ void GuildObject::depersistGcwImperialScorePercentile() // GCW category { - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); int gcwImperialScorePercentile; std::map const & allGcwScoreCategory = Pvp::getAllGcwScoreCategory(); for (std::map::const_iterator iter = allGcwScoreCategory.begin(); iter != allGcwScoreCategory.end(); ++iter) @@ -2154,7 +2154,7 @@ void GuildObject::updateGcwImperialScorePercentile(std::set const & if (m_gcwImperialScorePercentileThisGalaxy.empty()) depersistGcwImperialScorePercentile(); - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); GameScriptObject * const gameScriptObject = tatooine->getScriptObject(); int currentScorePercentile, newScorePercentile, newGroupCategoryScoreRaw, scoreCategoryGroupTotalPoints, deltaGroupCategoryScoreRaw; std::map, int>::const_iterator iterGroupCategoryScoreRaw; @@ -2515,8 +2515,8 @@ void GuildObjectNamespace::replaceSetIfNeeded(char const *label, Archive::AutoDe } // ---------------------------------------------------------------------- -// NULL oldPermissions means wasn't an existing guild member -// NULL newPermissions means will not be a guild member +// nullptr oldPermissions means wasn't an existing guild member +// nullptr newPermissions means will not be a guild member void GuildObjectNamespace::updateGuildInfoMembersCount(GuildInfo & gi, int const * const oldPermissions, int const * const newPermissions) { bool existingMember = false; @@ -2596,7 +2596,7 @@ void GuildObjectNamespace::updateGcwPercentileHistory(Archive::AutoDeltaMap(::time(NULL))), score); + history.set(std::make_pair(scoreName, static_cast(::time(nullptr))), score); int newCount = 1; Archive::AutoDeltaMap::const_iterator const iterHistoryCount = historyCount.find(scoreName); diff --git a/engine/server/library/serverGame/src/shared/object/HarvesterInstallationObject.cpp b/engine/server/library/serverGame/src/shared/object/HarvesterInstallationObject.cpp index c8c7ad75..92f77f36 100755 --- a/engine/server/library/serverGame/src/shared/object/HarvesterInstallationObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/HarvesterInstallationObject.cpp @@ -67,7 +67,7 @@ HarvesterInstallationObject::HarvesterInstallationObject(const ServerHarvesterIn m_maxHopperAmount(newTemplate->getMaxHopperSize()), m_hopperResource(NetworkId::cms_invalid), m_hopperAmount(0.0f), - m_survey(NULL), + m_survey(nullptr), m_surveyTime(0) { //Installation objects have real time updated UI @@ -79,7 +79,7 @@ HarvesterInstallationObject::HarvesterInstallationObject(const ServerHarvesterIn HarvesterInstallationObject::~HarvesterInstallationObject() { delete m_survey; - m_survey = NULL; + m_survey = nullptr; // m_synchronizedUi deleted by superclass } @@ -397,7 +397,7 @@ std::vector const & HarvesterInstallationObject::get if (!m_survey || ServerClock::getInstance().getGameTimeSeconds() - m_surveyTime > (60*60)) { delete m_survey; - m_survey = NULL; + m_survey = nullptr; takeSurvey(); } @@ -728,7 +728,7 @@ void HarvesterInstallationObject::handleCMessageTo (const MessageToPayload &mess ResourceClassObject *HarvesterInstallationObject::getMasterClass() const { - ResourceClassObject *obj = NULL; + ResourceClassObject *obj = nullptr; const ServerHarvesterInstallationObjectTemplate *harvesterTemplate = dynamic_cast(getObjectTemplate()); if (harvesterTemplate) obj=ServerUniverse::getInstance().getResourceClassByName(harvesterTemplate->getMasterClassName()); @@ -855,7 +855,7 @@ NetworkId const &HarvesterInstallationObject::getSelectedResourceTypeId() const ResourcePoolObject const * HarvesterInstallationObject::getSelectedResourcePool() const { if (getSelectedResourceTypeId() == NetworkId::cms_invalid) - return NULL; + return nullptr; ResourceTypeObject const * const typeObject = ServerUniverse::getInstance().getResourceTypeById(getSelectedResourceTypeId()); if (typeObject) @@ -863,7 +863,7 @@ ResourcePoolObject const * HarvesterInstallationObject::getSelectedResourcePool( return typeObject->getPoolForCurrentPlanet(); } else - return NULL; + return nullptr; } // ====================================================================== diff --git a/engine/server/library/serverGame/src/shared/object/HarvesterInstallationObject.h b/engine/server/library/serverGame/src/shared/object/HarvesterInstallationObject.h index 7616aba5..1ea65df3 100755 --- a/engine/server/library/serverGame/src/shared/object/HarvesterInstallationObject.h +++ b/engine/server/library/serverGame/src/shared/object/HarvesterInstallationObject.h @@ -52,7 +52,7 @@ public: typedef std::pair HopperContentElement; typedef stdvector::fwd HopperContentsVector; - float getHopperContents(HopperContentsVector * data=NULL) const; + float getHopperContents(HopperContentsVector * data=nullptr) const; void getResourceData(ResourceDataVector & data); std::vector const & getSurveyTypes(); int getMaxExtractionRate() const; diff --git a/engine/server/library/serverGame/src/shared/object/InstallationObject.cpp b/engine/server/library/serverGame/src/shared/object/InstallationObject.cpp index 2f5b622b..97ddeef9 100755 --- a/engine/server/library/serverGame/src/shared/object/InstallationObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/InstallationObject.cpp @@ -45,7 +45,7 @@ static const std::string OBJVAR_ACCUMULATED_TIME("_installation.acclTime"); -const SharedObjectTemplate * InstallationObject::m_defaultSharedTemplate = NULL; +const SharedObjectTemplate * InstallationObject::m_defaultSharedTemplate = nullptr; namespace InstallationObjectNamespace { @@ -93,13 +93,13 @@ const SharedObjectTemplate * InstallationObject::getDefaultSharedTemplate(void) { static const ConstCharCrcLowerString templateName("object/installation/base/shared_installation_default.iff"); - if (m_defaultSharedTemplate == NULL) + if (m_defaultSharedTemplate == nullptr) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create " + WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create " "default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) ExitChain::add (removeDefaultTemplate, "InstallationObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -112,10 +112,10 @@ static const ConstCharCrcLowerString templateName("object/installation/base/shar */ void InstallationObject::removeDefaultTemplate(void) { - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } // InstallationObject::removeDefaultTemplate diff --git a/engine/server/library/serverGame/src/shared/object/IntangibleObject.cpp b/engine/server/library/serverGame/src/shared/object/IntangibleObject.cpp index 6d7b57c4..5d32403f 100755 --- a/engine/server/library/serverGame/src/shared/object/IntangibleObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/IntangibleObject.cpp @@ -43,7 +43,7 @@ // ====================================================================== -const SharedObjectTemplate * IntangibleObject::m_defaultSharedTemplate = NULL; +const SharedObjectTemplate * IntangibleObject::m_defaultSharedTemplate = nullptr; uint32 IntangibleObject::ms_lastFrame = 0; uint32 IntangibleObject::ms_theaterTime = 0; @@ -82,7 +82,7 @@ IntangibleObject::IntangibleObject(const ServerIntangibleObjectTemplate* newTemp #endif { - WARNING_STRICT_FATAL(!getSharedTemplate(), ("Shared template for %s is NULL", getTemplateName())); + WARNING_STRICT_FATAL(!getSharedTemplate(), ("Shared template for %s is nullptr", getTemplateName())); addMembersToPackages(); ObjectTracker::addIntangible(); } @@ -105,13 +105,13 @@ const SharedObjectTemplate * IntangibleObject::getDefaultSharedTemplate(void) co { static const ConstCharCrcLowerString templateName("object/intangible/base/shared_intangible_default.iff"); - if (m_defaultSharedTemplate == NULL) + if (m_defaultSharedTemplate == nullptr) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create " + WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create " "default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) ExitChain::add (removeDefaultTemplate, "IntangibleObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -124,10 +124,10 @@ static const ConstCharCrcLowerString templateName("object/intangible/base/shared */ void IntangibleObject::removeDefaultTemplate(void) { - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } // IntangibleObject::removeDefaultTemplate @@ -161,7 +161,7 @@ void IntangibleObject::onLoadedFromDatabase() if (flatten != 0) { TerrainGenerator::Layer * layer = TerrainModificationHelper::importLayer(THEATER_FLATTEN_LAYER.c_str()); - if (layer != NULL) + if (layer != nullptr) { setLayer(layer); } @@ -192,7 +192,7 @@ void IntangibleObject::onLoadedFromDatabase() void IntangibleObject::sendObjectSpecificBaselinesToClient(Client const &client) const { ServerObject::sendObjectSpecificBaselinesToClient(client); - if (getLayer() != NULL) + if (getLayer() != nullptr) { client.send(GenericValueTypeMessage >( "IsFlattenedTheaterMessage", std::make_pair(getNetworkId(), true)), true); @@ -235,9 +235,9 @@ size_t i; Transform tr; tr.setPosition_p(myPos+m_positions[i]); ServerObject * newObject = ServerWorld::createNewObject(m_crcs[i], tr, 0, false); - if (newObject != NULL) + if (newObject != nullptr) { - if (newObject->asTangibleObject() != NULL) + if (newObject->asTangibleObject() != nullptr) newObject->asTangibleObject()->setVisible(false); newObject->addToWorld(); m_objects.push_back(CachedNetworkId(*newObject)); @@ -300,7 +300,7 @@ size_t i; for (i = 0; i < count; ++i) { ServerObject * object = safe_cast(m_objects[i].getObject()); - if (object != NULL && object->asTangibleObject() != NULL) + if (object != nullptr && object->asTangibleObject() != nullptr) { const ServerObjectTemplate * objTemplate = safe_cast(object->getObjectTemplate()); for (size_t j = 0; j < objTemplate->getVisibleFlagsCount(); ++j) @@ -360,7 +360,7 @@ bool IntangibleObject::isVisibleOnClient (const Client & client) const { if (isTheater()) { - return getLayer() != NULL; + return getLayer() != nullptr; } return true; } @@ -388,7 +388,7 @@ void IntangibleObject::onPermanentlyDestroyed() for (size_t i = 0; i < count; ++i) { ServerObject * object = safe_cast(m_objects[i].getObject()); - if (object != NULL) + if (object != nullptr) object->permanentlyDestroy(DeleteReasons::Consumed); } if (!m_theaterName.get().empty()) @@ -439,7 +439,7 @@ bool IntangibleObject::persist() splitCount = 0; } ServerObject * o = safe_cast((*i).getObject()); - if (o != NULL) + if (o != nullptr) { o->persist(); splitObjects.back().push_back(*i); @@ -452,7 +452,7 @@ bool IntangibleObject::persist() if (m_player.get() != CachedNetworkId::cms_cachedInvalid) setObjVarItem(OBJVAR_THEATER_PLAYER, m_player.get()); setObjVarItem(OBJVAR_THEATER_NAME, m_theaterName.get()); - if (getLayer() != NULL) + if (getLayer() != nullptr) setObjVarItem(OBJVAR_THEATER_FLATTEN, 1); char buffer[32]; @@ -551,7 +551,7 @@ int IntangibleObject::getObjectsCreatedPerFrame() int IntangibleObject::getNumObjects(const std::string & datatable) { DataTable * dt = DataTableManager::getTable(datatable, true); - if (dt == NULL) + if (dt == nullptr) { WARNING(true, ("IntangibleObject::getNumObjects could not open " "datatable %s", datatable.c_str())); @@ -586,7 +586,7 @@ int IntangibleObject::getNumObjects(const std::string & datatable) float IntangibleObject::getRadius(const std::string & datatable) { DataTable * dt = DataTableManager::getTable(datatable, true); - if (dt == NULL) + if (dt == nullptr) { WARNING(true, ("IntangibleObject::getRadius could not open " "datatable %s", datatable.c_str())); @@ -648,18 +648,18 @@ IntangibleObject * IntangibleObject::spawnTheater(const std::string & datatable, const Vector & position, const std::string & script, TheaterLocationType locationType) { DataTable * dt = DataTableManager::getTable(datatable, true); - if (dt == NULL) + if (dt == nullptr) { WARNING(true, ("IntangibleObject::spawnTheater could not open " "datatable %s", datatable.c_str())); - return NULL; + return nullptr; } int rows = dt->getNumRows(); if (rows <= 0) { WARNING(true, ("IntangibleObject::spawnTheater datatable %s has no " "rows", datatable.c_str())); - return NULL; + return nullptr; } int templateColumn = dt->findColumnNumber("template"); @@ -684,7 +684,7 @@ IntangibleObject * IntangibleObject::spawnTheater(const std::string & datatable, { WARNING(true, ("IntangibleObject::spawnTheater datatable %s has no " "objects", datatable.c_str())); - return NULL; + return nullptr; } skipFirstRow = true; objectCrcs.erase(objectCrcs.begin()); @@ -737,11 +737,11 @@ IntangibleObject * IntangibleObject::spawnTheater(const std::string & datatable, float centerX = minx + dx / 2.0f + position.x; float centerZ = minz + dz / 2.0f + position.z; - TerrainGenerator::Layer * layer = NULL; + TerrainGenerator::Layer * layer = nullptr; if (locationType == TLT_flatten) { layer = TerrainModificationHelper::importLayer(THEATER_FLATTEN_LAYER.c_str()); - if (layer == NULL) + if (layer == nullptr) { WARNING (true, ("Layer %s not found for theater %s, using getGoodLocation " "instead", THEATER_FLATTEN_LAYER.c_str(), datatable.c_str())); @@ -770,7 +770,7 @@ IntangibleObject * IntangibleObject::spawnTheater(const std::string & datatable, iter != regions.end(); ++iter) { const Region * region = *iter; - if (region != NULL) + if (region != nullptr) { if (region->getPvp() == RegionNamespace::RP_pvpBattlefield || region->getPvp() == RegionNamespace::RP_pveBattlefield || @@ -796,7 +796,7 @@ IntangibleObject * IntangibleObject::spawnTheater(const std::string & datatable, IntangibleObject * theater = safe_cast(ServerWorld::createNewObject(THEATER_TEMPLATE, tr, 0, false)); NOT_NULL(theater); - if (layer != NULL) + if (layer != nullptr) { theater->setLayer(layer); } diff --git a/engine/server/library/serverGame/src/shared/object/LineOfSightCache.cpp b/engine/server/library/serverGame/src/shared/object/LineOfSightCache.cpp index a7de4055..3d3c72ff 100755 --- a/engine/server/library/serverGame/src/shared/object/LineOfSightCache.cpp +++ b/engine/server/library/serverGame/src/shared/object/LineOfSightCache.cpp @@ -308,14 +308,14 @@ bool LineOfSightCache::checkLOS(Object const &a, Location const &b) Clock::getFrameStartTimeMs() + ConfigServerGame::getLineOfSightCacheDurationMs())); CellProperty const * const sourceCell = source->getParentCell(); - CellProperty const * targetCell = NULL; + CellProperty const * targetCell = nullptr; if (b.getCell() != NetworkId::cms_invalid) { Object const * cellObject = NetworkIdManager::getObjectById(b.getCell()); - if (cellObject != NULL) + if (cellObject != nullptr) targetCell = ContainerInterface::getCell(*cellObject); } - if (targetCell == NULL) + if (targetCell == nullptr) targetCell = CellProperty::getWorldCellProperty(); // if source and target are in the same cell in a player structure, skip LOS check; @@ -418,7 +418,7 @@ bool LineOfSightCache::checkLOS(Object const &a, Location const &b) qirResult = CollisionWorld::queryInteraction( targetCell, b.getCoordinates(), sourceCell, sourceTop, - NULL, + nullptr, (!ConfigSharedCollision::getIgnoreTerrainLos() && !ConfigSharedCollision::getGenerateTerrainLos()), false, ConfigSharedCollision::getTerrainLOSMinDistance(), diff --git a/engine/server/library/serverGame/src/shared/object/ManufactureInstallationObject.cpp b/engine/server/library/serverGame/src/shared/object/ManufactureInstallationObject.cpp index c199bd84..50fec4c8 100755 --- a/engine/server/library/serverGame/src/shared/object/ManufactureInstallationObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/ManufactureInstallationObject.cpp @@ -99,11 +99,11 @@ namespace ManufactureInstallationObjectNamespace bool isOutputHopperFull(ManufactureInstallationObject const & mio) { ServerObject const * const outputHopper = mio.getOutputHopper(); - if (outputHopper == NULL) + if (outputHopper == nullptr) return false; VolumeContainer const * const hopperContainer = ContainerInterface::getVolumeContainer(*outputHopper); - if (hopperContainer == NULL) + if (hopperContainer == nullptr) return false; return (hopperContainer->getCurrentVolume() >= hopperContainer->getTotalVolume()); @@ -170,7 +170,7 @@ void ManufactureInstallationObject::endBaselines() // if we are active, make sure we have the right data if (isAuthoritative() && isActive()) { - if (getSchematic() == NULL) + if (getSchematic() == nullptr) { WARNING(true, ("Manufacture installation %s is set to active but has not schematic available!", getNetworkId().getValueString().c_str())); @@ -302,17 +302,17 @@ void ManufactureInstallationObject::setOwnerId(const NetworkId &id) InstallationObject::setOwnerId(id); const Object * const object = NetworkIdManager::getObjectById(id); - if (object != NULL) + if (object != nullptr) { const ServerObject * const owner = safe_cast(object); setObjVarItem(OBJVAR_OWNER_NAME, Unicode::wideToNarrow(owner->getObjectName())); // we need to store the owner's Station id for logging purposes const CreatureObject * const creatureOwner = owner->asCreatureObject(); - if (creatureOwner != NULL) + if (creatureOwner != nullptr) { const PlayerObject * const player = PlayerCreatureController::getPlayerObject(creatureOwner); - if (player != NULL) + if (player != nullptr) { setObjVarItem(OBJVAR_OWNER_STATION_ID, static_cast(player->getStationId())); } @@ -331,10 +331,10 @@ ServerObject * ManufactureInstallationObject::getInputHopper() const { SlottedContainer const * const container = ContainerInterface::getSlottedContainer(*this); - if (container == NULL) + if (container == nullptr) { DEBUG_WARNING(true, ("Manufacture installation %s does not have a container!", getDebugInformation().c_str())); - return NULL; + return nullptr; } Container::ContainerErrorCode tmp = Container::CEC_Success; @@ -342,7 +342,7 @@ ServerObject * ManufactureInstallationObject::getInputHopper() const if (hopperId == NetworkId::cms_invalid) { DEBUG_WARNING(true, ("Manufacture installation %s does not have an input hopper!", getDebugInformation().c_str())); - return NULL; + return nullptr; } return safe_cast(hopperId.getObject()); @@ -359,10 +359,10 @@ ServerObject * ManufactureInstallationObject::getOutputHopper() const { SlottedContainer const * const container = ContainerInterface::getSlottedContainer(*this); - if (container == NULL) + if (container == nullptr) { DEBUG_WARNING(true, ("Manufacture installation %s does not have a container!", getDebugInformation().c_str())); - return NULL; + return nullptr; } Container::ContainerErrorCode tmp = Container::CEC_Success; @@ -370,7 +370,7 @@ ServerObject * ManufactureInstallationObject::getOutputHopper() const if (hopperId == NetworkId::cms_invalid) { DEBUG_WARNING(true, ("Manufacture installation %s does not have an output hopper!", getDebugInformation().c_str())); - return NULL; + return nullptr; } return safe_cast(hopperId.getObject()); @@ -399,7 +399,7 @@ bool ManufactureInstallationObject::addSchematic(ManufactureSchematicObject & sc SlottedContainer const * const container = ContainerInterface::getSlottedContainer(*this); - if (container == NULL) + if (container == nullptr) { DEBUG_WARNING(true, ("Manufacture installation %s does not have a container!", getDebugInformation().c_str())); return false; @@ -433,7 +433,7 @@ bool ManufactureInstallationObject::onContainerAboutToLoseItem(ServerObject * de { bool isSchematic = false; const ManufactureSchematicObject * const schematic = getSchematic(); - if (schematic != NULL && schematic->getNetworkId() == item.getNetworkId()) + if (schematic != nullptr && schematic->getNetworkId() == item.getNetworkId()) { isSchematic = true; if (isActive()) @@ -465,10 +465,10 @@ ManufactureSchematicObject * ManufactureInstallationObject::getSchematic() const // get our manufacturing schematic SlottedContainer const * const container = ContainerInterface::getSlottedContainer(*this); - if (container == NULL) + if (container == nullptr) { DEBUG_WARNING(true, ("Manufacture installation %s does not have a container!", getDebugInformation().c_str())); - return NULL; + return nullptr; } Container::ContainerErrorCode tmp = Container::CEC_Success; @@ -486,7 +486,7 @@ ManufactureSchematicObject * ManufactureInstallationObject::getSchematic() const float ManufactureInstallationObject::getTimePerObject() const { ManufactureSchematicObject * const schematic = getSchematic(); - if (schematic == NULL) + if (schematic == nullptr) return 0; #ifdef _DEBUG @@ -516,7 +516,7 @@ float ManufactureInstallationObject::getTimePerObject() const getObjVars().getItem(OBJVAR_OWNER_SKILL,ownerSkill); int skill = 0; - if (owner != NULL) + if (owner != nullptr) { skill = owner->getEnhancedModValue(FACTORY_SKILL_MOD); @@ -551,7 +551,7 @@ void ManufactureInstallationObject::activate(const NetworkId &actorId) { if (isAuthoritative() && !isActive()) { - if (getSchematic() == NULL) + if (getSchematic() == nullptr) { WARNING(true, ("Manufacture installation %s tried to activate with " "no schematic available!", getNetworkId().getValueString().c_str())); @@ -588,7 +588,7 @@ void ManufactureInstallationObject::activate(const NetworkId &actorId) OutOfBandPackager::pack(pp, -1, oob); } const Object * const owner = NetworkIdManager::getObjectById(getOwnerId()); - if (owner != NULL) + if (owner != nullptr) { Chat::sendSystemMessage(getOwnerName(), Unicode::emptyString, oob); } @@ -615,7 +615,7 @@ void ManufactureInstallationObject::deactivate() OutOfBandPackager::pack(pp, -1, oob); } const Object * const owner = NetworkIdManager::getObjectById(getOwnerId()); - if (owner != NULL) + if (owner != nullptr) { Chat::sendSystemMessage(getOwnerName(), Unicode::emptyString, oob); } @@ -645,13 +645,13 @@ void ManufactureInstallationObject::harvest() maxItemCount = schematic->getCount(); } - if (schematic == NULL || maxItemCount <= 0) + if (schematic == nullptr || maxItemCount <= 0) { setTickCount(0); // to avoid recursion deactivate(); - if (schematic == NULL) + if (schematic == nullptr) { - WARNING(true, ("ManufactureInstallationObject::harvest called on object %s with a NULL schematic", + WARNING(true, ("ManufactureInstallationObject::harvest called on object %s with a nullptr schematic", getNetworkId().getValueString().c_str())); Chat::sendPersistentMessage(*this, getOwnerName(), StringIds::manf_error, StringIds::manf_error_1, Unicode::emptyString); @@ -694,7 +694,7 @@ void ManufactureInstallationObject::harvest() OutOfBandPackager::pack(pp, -1, oob); } const Object * owner = NetworkIdManager::getObjectById(getOwnerId()); - if (owner != NULL) + if (owner != nullptr) { Chat::sendSystemMessage(getOwnerName(), Unicode::emptyString, oob); } @@ -748,7 +748,7 @@ bool ManufactureInstallationObject::createObject(bool testOnly) int i; ManufactureSchematicObject * schematic = getSchematic(); - if (schematic == NULL) + if (schematic == nullptr) { WARNING(true, ("ManufactureInstallationObject::createObject can't find schematic for station %s", getNetworkId().getValueString().c_str())); @@ -771,7 +771,7 @@ bool ManufactureInstallationObject::createObject(bool testOnly) } ServerObject * inputHopper = getInputHopper(); - if (inputHopper == NULL) + if (inputHopper == nullptr) { WARNING_STRICT_FATAL(true, ("ManufactureInstallationObject::createObject can't find input hopper for station %s", getNetworkId().getValueString().c_str())); @@ -782,7 +782,7 @@ bool ManufactureInstallationObject::createObject(bool testOnly) } ServerObject * outputHopper = getOutputHopper(); - if (outputHopper == NULL) + if (outputHopper == nullptr) { WARNING_STRICT_FATAL(true, ("ManufactureInstallationObject::createObject can't find output hopper for station %s", getNetworkId().getValueString().c_str())); @@ -803,7 +803,7 @@ bool ManufactureInstallationObject::createObject(bool testOnly) { // is there a current crate in the output hopper put we can stuff objects into FactoryObject * crate = getCurrentCrate(*schematic); - if (crate == NULL) + if (crate == nullptr) { // is there room in the output hopper for a new crate outputHopperFull = isOutputHopperFull(*this); @@ -819,7 +819,7 @@ bool ManufactureInstallationObject::createObject(bool testOnly) OutOfBandPackager::pack(pp, -1, oob); } const Object * const owner = NetworkIdManager::getObjectById(getOwnerId()); - if (owner != NULL) + if (owner != nullptr) { Chat::sendSystemMessage(getOwnerName(), Unicode::emptyString, oob); } @@ -894,7 +894,7 @@ bool ManufactureInstallationObject::createObject(bool testOnly) // the ingredient needs to be made with the same template const ObjectTemplate * componentTemplate = ObjectTemplateList::fetch( componentInfo->templateName); - if (componentTemplate != NULL) + if (componentTemplate != nullptr) { for (j = 0; j < ingredientCount; ++j) { @@ -945,7 +945,7 @@ bool ManufactureInstallationObject::createObject(bool testOnly) ProsePackage pp; ProsePackageManagerServer::createSimpleProsePackageParticipant (*this, pp.target); - if (resource != NULL) + if (resource != nullptr) { pp.stringId = StringIds::manf_no_named_resource; pp.other.str = Unicode::narrowToWide(resource->getResourceName()); @@ -957,7 +957,7 @@ bool ManufactureInstallationObject::createObject(bool testOnly) } const Object * const owner = NetworkIdManager::getObjectById(getOwnerId()); - if (owner != NULL) + if (owner != nullptr) Chat::sendSystemMessage(getOwnerName(), Unicode::emptyString, oob); Chat::sendPersistentMessage(*this, getOwnerName(), StringIds::no_ingredients, Unicode::emptyString, oob); @@ -1000,7 +1000,7 @@ bool ManufactureInstallationObject::createObject(bool testOnly) { TangibleObject * object = safe_cast(schematic-> manufactureObject(getOwnerId(), *this, newObjectSlotId, false)); - if (object == NULL) + if (object == nullptr) { WARNING_STRICT_FATAL(true, ("ManufactureInstallationObject::createObject, Unable to create object for station %s", getNetworkId().getValueString().c_str())); @@ -1009,7 +1009,7 @@ bool ManufactureInstallationObject::createObject(bool testOnly) return false; } - if (!ContainerInterface::transferItemToVolumeContainer(*outputHopper, *object, NULL, tmp)) + if (!ContainerInterface::transferItemToVolumeContainer(*outputHopper, *object, nullptr, tmp)) { object->permanentlyDestroy(DeleteReasons::BadContainerTransfer); WARNING_STRICT_FATAL(true, ("ManufactureInstallationObject::createObject, Unable to transfer new object for station %s, error code = %d", @@ -1024,12 +1024,12 @@ bool ManufactureInstallationObject::createObject(bool testOnly) { // put the object in a box of objects FactoryObject * crate = getCurrentCrate(*schematic); - if (crate == NULL) + if (crate == nullptr) { // make a new crate to put the object in crate = makeNewCrate(*schematic); } - if (crate == NULL) + if (crate == nullptr) { WARNING_STRICT_FATAL(true, ("ManufactureInstallationObject::createObject, Unable to create factory crate for station %s", getNetworkId().getValueString().c_str())); @@ -1082,7 +1082,7 @@ void ManufactureInstallationObject::restoreIngredients(IngredientVector const &i if (count != 0) { FactoryObject * crate = dynamic_cast(itemId.getObject()); - if (crate != NULL) + if (crate != nullptr) crate->incrementCount(count); } } @@ -1109,7 +1109,7 @@ void ManufactureInstallationObject::destroyIngredients(IngredientVector const &i else { FactoryObject * crate = dynamic_cast(itemId.getObject()); - if (crate != NULL) + if (crate != nullptr) { LOG("CustomerService", ("Crafting:destroying %d ingredients from crate %s in manf station %s owned by %s", count, itemId.getValueString().c_str(), getNetworkId().getValueString().c_str(), PlayerObject::getAccountDescription(getOwnerId()).c_str())); if (crate->getCount() == 0) @@ -1149,7 +1149,7 @@ bool ManufactureInstallationObject::transferCraftedIngredientToSchematic( // crafted id as the component wanted VolumeContainer * container = ContainerInterface::getVolumeContainer(inputHopper); - if (container == NULL) + if (container == nullptr) return false; // stuff to keep track of crates that don't have enough ingredients @@ -1160,11 +1160,11 @@ bool ManufactureInstallationObject::transferCraftedIngredientToSchematic( { const Container::ContainedItem & itemId = *iter; TangibleObject * object = safe_cast(itemId.getObject()); - if (object != NULL && object->getCraftedId() == craftedId) + if (object != nullptr && object->getCraftedId() == craftedId) { // see if the object is a factory or not FactoryObject * crate = dynamic_cast(object); - if (crate != NULL) + if (crate != nullptr) { // see if the crate has enough objects or not int crateCount = crate->getCount(); @@ -1247,18 +1247,18 @@ const NetworkId & ManufactureInstallationObject::transferTemplateIngredientToSch VolumeContainer * container = ContainerInterface::getVolumeContainer( inputHopper); - if (container == NULL) + if (container == nullptr) return NetworkId::cms_invalid; for (ContainerIterator iter = container->begin(); iter != container->end(); ++iter) { const Container::ContainedItem & itemId = *iter; TangibleObject * object = safe_cast(itemId.getObject()); - if (object != NULL) + if (object != nullptr) { // see if the object is a factory or not FactoryObject * crate = dynamic_cast(object); - if (crate != NULL && crate->getCount() > 0) + if (crate != nullptr && crate->getCount() > 0) { if (crate->getContainedObjectTemplate() == &componentTemplate) { @@ -1300,7 +1300,7 @@ const NetworkId & ManufactureInstallationObject::transferResourceTypeToSchematic const NetworkId & resourceTypeId, int resourceCount) { VolumeContainer * const container = ContainerInterface::getVolumeContainer(inputHopper); - if (container == NULL) + if (container == nullptr) return NetworkId::cms_invalid; // keep a map of the sources that are providing the resources @@ -1317,7 +1317,7 @@ const NetworkId & ManufactureInstallationObject::transferResourceTypeToSchematic const Container::ContainedItem & itemId = *iter; ResourceContainerObject * object = dynamic_cast( itemId.getObject()); - if (object != NULL && object->getResourceTypeId() == resourceTypeId) + if (object != nullptr && object->getResourceTypeId() == resourceTypeId) { // see if this crate fills our requirements if (object->getQuantity() >= resourceCount) @@ -1346,7 +1346,7 @@ const NetworkId & ManufactureInstallationObject::transferResourceTypeToSchematic if (!smallCrate->removeResource(resourceTypeId, smallCrate->getQuantity(), &sources)) return NetworkId::cms_invalid; // small crate has been deleted by the resource system - *crateIter = NULL; + *crateIter = nullptr; ++crateIter; } else @@ -1390,41 +1390,41 @@ const NetworkId & ManufactureInstallationObject::transferResourceTypeToSchematic * * @param contents an object we want to put in the crate * - * @return the crate, or NULL if we have no crate + * @return the crate, or nullptr if we have no crate */ FactoryObject * ManufactureInstallationObject::getCurrentCrate(const ManufactureSchematicObject & source) { - FactoryObject * crate = NULL; + FactoryObject * crate = nullptr; ServerObject * outputHopper = getOutputHopper(); - if (outputHopper == NULL) - return NULL; + if (outputHopper == nullptr) + return nullptr; - if (m_currentCrate.getObject() != NULL) + if (m_currentCrate.getObject() != nullptr) { crate = safe_cast(m_currentCrate.getObject()); // make sure the crate is still in our hopper and is not full - if (crate != NULL && ContainerInterface::getContainedByObject(*crate) == outputHopper && + if (crate != nullptr && ContainerInterface::getContainedByObject(*crate) == outputHopper && crate->getCraftedId() == source.getOriginalId()) { if (crate->getCount() < source.getItemsPerContainer()) return crate; else - return NULL; + return nullptr; } } // see if there is another non-full crate in the output hopper we could use const VolumeContainer * hopperContainer = ContainerInterface::getVolumeContainer( *outputHopper); - if (hopperContainer != NULL) + if (hopperContainer != nullptr) { for (ContainerConstIterator iter = hopperContainer->begin(); iter != hopperContainer->end(); ++iter) { crate = dynamic_cast((*iter).getObject()); - if (crate != NULL && crate->getCraftedId() == source.getOriginalId() && crate->getCount() < source.getItemsPerContainer()) + if (crate != nullptr && crate->getCraftedId() == source.getOriginalId() && crate->getCount() < source.getItemsPerContainer()) { // change our current crate to the one we found m_currentCrate = CachedNetworkId(*crate); @@ -1433,7 +1433,7 @@ FactoryObject * ManufactureInstallationObject::getCurrentCrate(const Manufacture } } - return NULL; + return nullptr; } // ManufactureInstallationObject::getCurrentCrate // ---------------------------------------------------------------------- @@ -1449,21 +1449,21 @@ FactoryObject * ManufactureInstallationObject::getCurrentCrate(const Manufacture FactoryObject * ManufactureInstallationObject::makeNewCrate(const ManufactureSchematicObject & source) { ServerObject * outputHopper = getOutputHopper(); - if (outputHopper == NULL) - return NULL; + if (outputHopper == nullptr) + return nullptr; // get the correct factory object template from the draft schematic const ManufactureSchematicObject * manfSchematic = getSchematic(); - if (manfSchematic == NULL) - return NULL; + if (manfSchematic == nullptr) + return nullptr; const DraftSchematicObject * draftSchematic = DraftSchematicObject::getSchematic( manfSchematic->getDraftSchematic()); - if (draftSchematic == NULL) - return NULL; + if (draftSchematic == nullptr) + return nullptr; - ServerObject * object = NULL; + ServerObject * object = nullptr; const ServerFactoryObjectTemplate * crateTemplate = draftSchematic->getCrateObjectTemplate(); - if (crateTemplate != NULL) + if (crateTemplate != nullptr) { object = ServerWorld::createNewObject(*crateTemplate, *outputHopper, false); } @@ -1472,11 +1472,11 @@ FactoryObject * ManufactureInstallationObject::makeNewCrate(const ManufactureSch object = ServerWorld::createNewObject(DEFAULT_FACTORY_OBJECT_TEMPLATE, *outputHopper, false); } - if (object == NULL) - return NULL; + if (object == nullptr) + return nullptr; FactoryObject * crate = dynamic_cast(object); - if (crate == NULL) + if (crate == nullptr) object->permanentlyDestroy(DeleteReasons::SetupFailed); else { @@ -1526,7 +1526,7 @@ bool ManufactureInstallationObject::TaskManufactureObject::run() { ManufactureInstallationObject * manfInst = safe_cast (m_manfInstallation.getObject()); - if (manfInst == NULL || !manfInst->isActive()) + if (manfInst == nullptr || !manfInst->isActive()) return true; if (!manfInst->createObject()) @@ -1545,7 +1545,7 @@ void ManufactureInstallationObject::getAttributes(AttributeVector & data) const InstallationObject::getAttributes(data); ManufactureSchematicObject * schematic = getSchematic(); - if (schematic != NULL) + if (schematic != nullptr) { char valueBuffer[32]; const size_t valueBuffer_size = sizeof (valueBuffer); diff --git a/engine/server/library/serverGame/src/shared/object/ManufactureSchematicObject.cpp b/engine/server/library/serverGame/src/shared/object/ManufactureSchematicObject.cpp index 00b51fc1..e4646395 100755 --- a/engine/server/library/serverGame/src/shared/object/ManufactureSchematicObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/ManufactureSchematicObject.cpp @@ -96,7 +96,7 @@ using namespace ManufactureSchematicObjectNamespace; //---------------------------------------------------------------------- -const SharedObjectTemplate * ManufactureSchematicObject::m_defaultSharedTemplate = NULL; +const SharedObjectTemplate * ManufactureSchematicObject::m_defaultSharedTemplate = nullptr; //======================================================================== @@ -170,11 +170,11 @@ const SharedObjectTemplate * ManufactureSchematicObject::getDefaultSharedTemplat { static const ConstCharCrcLowerString templateName("object/manufacture_schematic/base/shared_manufacture_schematic_default.iff"); - if (m_defaultSharedTemplate == NULL) + if (m_defaultSharedTemplate == nullptr) { m_defaultSharedTemplate = safe_cast(ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != NULL) + WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create default shared object template %s", templateName.getString())); + if (m_defaultSharedTemplate != nullptr) ExitChain::add (removeDefaultTemplate, "ManufactureSchematicObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -187,10 +187,10 @@ const SharedObjectTemplate * ManufactureSchematicObject::getDefaultSharedTemplat */ void ManufactureSchematicObject::removeDefaultTemplate() { - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } // ManufactureSchematicObject::removeDefaultTemplate @@ -209,7 +209,7 @@ void ManufactureSchematicObject::init(const DraftSchematicObject & schematic, co m_draftSchematicSharedTemplate = schematic.getSharedTemplate()->getCrcName().getCrc(); m_creatorId = creator; - if (creator.getObject() != NULL) + if (creator.getObject() != nullptr) { m_creatorName = safe_cast(creator.getObject())-> getObjectName(); @@ -481,7 +481,7 @@ ServerIntangibleObjectTemplate::CraftingType ManufactureSchematicObject::getCate { schematicOk = false; } - else if (draft != NULL) + else if (draft != nullptr) { // test the ingredients Crafting::IngredientSlot sourceSlot; @@ -520,11 +520,11 @@ ServerIntangibleObjectTemplate::CraftingType ManufactureSchematicObject::getCate return draft->getCategory(); // this schematic can't be used, inform the player - const CreatureObject * owner = NULL; + const CreatureObject * owner = nullptr; const Object * object = ContainerInterface::getContainedByObject(*this); - while (owner == NULL && object != NULL && object->asServerObject() != NULL) + while (owner == nullptr && object != nullptr && object->asServerObject() != nullptr) { - if (object->asServerObject()->asCreatureObject() != NULL) + if (object->asServerObject()->asCreatureObject() != nullptr) owner = object->asServerObject()->asCreatureObject(); else object = ContainerInterface::getContainedByObject(*object); @@ -534,7 +534,7 @@ ServerIntangibleObjectTemplate::CraftingType ManufactureSchematicObject::getCate LOG("CustomerService", ("Crafting:Manufacturing schematic %s " "owned by %s is unuseable due to %s", getNetworkId().getValueString().c_str(), PlayerObject::getAccountDescription(owner).c_str(), errBuffer)); - if (owner != NULL) + if (owner != nullptr) { // send mail to the owner telling them their schematic can't be used const static StringId message("system_msg", "manf_schematic_unuseable"); @@ -562,7 +562,7 @@ bool ManufactureSchematicObject::mustDestroyIngredients() const const DraftSchematicObject * draft = DraftSchematicObject::getSchematic( m_draftSchematic.get()); NOT_NULL(draft); - if (draft != NULL) + if (draft != nullptr) return draft->mustDestroyIngredients(); return false; } // ManufactureSchematicObject::mustDestroyIngredients @@ -701,12 +701,12 @@ bool ManufactureSchematicObject::getSlot(int index, Crafting::IngredientSlot & d // get the xp type based on the resource container int xpType = 0; const ResourceTypeObject * const resourceType = ServerUniverse::getInstance().getResourceTypeById(ingredientId); - if (resourceType != NULL) + if (resourceType != nullptr) { std::string crateTemplateName; resourceType->getCrateTemplate(crateTemplateName); const ServerObjectTemplate * crateTemplate = safe_cast(ObjectTemplateList::fetch(crateTemplateName)); - if (crateTemplate != NULL && crateTemplate->getXpPointsCount() > 0) + if (crateTemplate != nullptr && crateTemplate->getXpPointsCount() > 0) { ServerObjectTemplate::Xp xpData; crateTemplate->getXpPoints(xpData, 0); @@ -1024,10 +1024,10 @@ void ManufactureSchematicObject::addSlotComponent(const StringId & name, // Check if the object being added is a factory const TangibleObject * componentPtr = &component; const FactoryObject * factory = dynamic_cast(&component); - if (factory != NULL) + if (factory != nullptr) { componentPtr = factory->getContainedObject(); - if (componentPtr == NULL) + if (componentPtr == nullptr) { WARNING(true, ("ManufactureSchematicObject::addSlotComponent passed " "FactoryObject %s with no contained object", @@ -1112,11 +1112,11 @@ TangibleObject * ManufactureSchematicObject::getComponent( const Crafting::ComponentIngredient & info) const { const VolumeContainer * volumeContainer = ContainerInterface::getVolumeContainer(*this); - if (volumeContainer == NULL) + if (volumeContainer == nullptr) { DEBUG_WARNING(true, ("Manf schematic %s does not have a volume container!", getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } // check if the component is in a FactoryObject; if it is, return the factory, @@ -1124,10 +1124,10 @@ TangibleObject * ManufactureSchematicObject::getComponent( if (info.ingredient != NetworkId::cms_invalid) { ServerObject * object = ServerWorld::findObjectByNetworkId(info.ingredient); - if (object != NULL) + if (object != nullptr) { Object * container = ContainerInterface::getContainedByObject(*object); - if (container != NULL && dynamic_cast(container) != NULL) + if (container != nullptr && dynamic_cast(container) != nullptr) return safe_cast(container); } } @@ -1137,7 +1137,7 @@ TangibleObject * ManufactureSchematicObject::getComponent( { const Container::ContainedItem & item = *iter; TangibleObject * object = safe_cast(item.getObject()); - if (object != NULL) + if (object != nullptr) { if (info.ingredient != NetworkId::cms_invalid) { @@ -1154,7 +1154,7 @@ TangibleObject * ManufactureSchematicObject::getComponent( } } } - return NULL; + return nullptr; } // ManufactureSchematicObject::getComponent //----------------------------------------------------------------------- @@ -1295,7 +1295,7 @@ void ManufactureSchematicObject::clearSlotSources() m_factories.begin(); iter != m_factories.end(); ++iter) { FactoryObject * factory = safe_cast((*iter).getObject()); - if (factory != NULL) + if (factory != nullptr) { factory->endCraftingSession(); } @@ -1305,23 +1305,23 @@ void ManufactureSchematicObject::clearSlotSources() // get rid of all our held ingredients VolumeContainer * volumeContainer = ContainerInterface::getVolumeContainer(*this); - if (volumeContainer != NULL && volumeContainer->getNumberOfItems() > 0) + if (volumeContainer != nullptr && volumeContainer->getNumberOfItems() > 0) { // for a stacked ingredient, if there are still more than one items in the stack, // "consume" 1 item from the stack, and return it to the player's inventory std::set itemsToReturnToInventory; - ServerObject* inventory = NULL; + ServerObject* inventory = nullptr; for (ContainerIterator iter = volumeContainer->begin(); iter != volumeContainer->end(); ++iter) { - if ((*iter).getObject() != NULL) + if ((*iter).getObject() != nullptr) { bool destroyItem = true; TangibleObject* to = safe_cast((*iter).getObject())->asTangibleObject(); - if (to && (to->getCount() > 1) && (dynamic_cast(to) == NULL)) + if (to && (to->getCount() > 1) && (dynamic_cast(to) == nullptr)) { - if (inventory == NULL) + if (inventory == nullptr) { ServerObject * o = safe_cast(ContainerInterface::getContainedByObject(*to)); while (o) @@ -1357,7 +1357,7 @@ void ManufactureSchematicObject::clearSlotSources() Container::ContainerErrorCode errCode; for (std::set::const_iterator iter = itemsToReturnToInventory.begin(); iter != itemsToReturnToInventory.end(); ++iter) { - if (!ContainerInterface::transferItemToVolumeContainer(*inventory, **iter, NULL, errCode)) + if (!ContainerInterface::transferItemToVolumeContainer(*inventory, **iter, nullptr, errCode)) { (*iter)->permanentlyDestroy(DeleteReasons::Replaced); } @@ -1741,11 +1741,11 @@ bool ManufactureSchematicObject::getCustomization(const std::string & name, const DynamicVariableList * objvars = getObjVars(); NOT_NULL(objvars); const DynamicVariableList * customs = safe_cast(objvars->getItemByName("cust")); - if (customs == NULL) + if (customs == nullptr) return false; const DynamicVariableList * custom = safe_cast(customs->getItemByName(name)); - if (custom == NULL) + if (custom == nullptr) return false; data.name = name; @@ -1771,7 +1771,7 @@ bool ManufactureSchematicObject::getCustomization(int index, const DynamicVariableList * objvars = getObjVars(); NOT_NULL(objvars); const DynamicVariableList * customs = safe_cast(objvars->getItemByName("cust")); - if (customs == NULL) + if (customs == nullptr) return false; int count = customs->getCount(); @@ -1799,7 +1799,7 @@ int ManufactureSchematicObject::getCustomizationsCount() const const DynamicVariableList * objvars = getObjVars(); NOT_NULL(objvars); const DynamicVariableList * customs = safe_cast(objvars->getItemByName("cust")); - if (customs == NULL) + if (customs == nullptr) return 0; return customs->getCount(); @@ -1838,7 +1838,7 @@ bool ManufactureSchematicObject::setCustomization(int index, int value, ServerObject & prototype) { ManufactureSchematicSynchronizedUi * sync = safe_cast(getSynchronizedUi ()); - if (sync == NULL) + if (sync == nullptr) return false; const std::string & customName = sync->getCustomizationName(index); @@ -1863,7 +1863,7 @@ bool ManufactureSchematicObject::setCustomization(const std::string & name, int value, ServerObject & prototype) { ManufactureSchematicSynchronizedUi * sync = safe_cast(getSynchronizedUi ()); - if (sync == NULL) + if (sync == nullptr) return false; // make sure the value is within range @@ -1878,10 +1878,10 @@ bool ManufactureSchematicObject::setCustomization(const std::string & name, // save the customization string CustomizationDataProperty * const cdProperty = safe_cast(prototype.getProperty(CustomizationDataProperty::getClassPropertyId())); - if (cdProperty != NULL) + if (cdProperty != nullptr) { CustomizationData *const customizationData = cdProperty->fetchCustomizationData(); - if (customizationData != NULL) + if (customizationData != nullptr) { m_appearanceData = customizationData->writeLocalDataToString(); setObjVarItem("customization_data", m_appearanceData.get()); @@ -1993,7 +1993,7 @@ void ManufactureSchematicObject::removeCraftingFactory(const FactoryObject & fac bool ManufactureSchematicObject::addIngredient(ServerObject & component) { Container::ContainerErrorCode tmp = Container::CEC_Success; - return ContainerInterface::transferItemToVolumeContainer(*this, component, NULL, tmp); + return ContainerInterface::transferItemToVolumeContainer(*this, component, nullptr, tmp); } // ManufactureSchematicObject::addIngredient //----------------------------------------------------------------------- @@ -2037,7 +2037,7 @@ bool ManufactureSchematicObject::removeIngredient(ServerObject & component, { // if the component is a factory, treat is differently FactoryObject * factory = dynamic_cast(&component); - if (factory != NULL) + if (factory != nullptr) { // if the factory is contained by us, move it to the destination, // making sure that its count is 1; if it is not contained by us, @@ -2050,7 +2050,7 @@ bool ManufactureSchematicObject::removeIngredient(ServerObject & component, factory->removeCraftingReferences(factory->getCount() - 1); Container::ContainerErrorCode errCode; return ContainerInterface::transferItemToVolumeContainer(destination, - *factory, NULL, errCode); + *factory, nullptr, errCode); } else { @@ -2064,17 +2064,17 @@ bool ManufactureSchematicObject::removeIngredient(ServerObject & component, { // make sure the component is in our container Object * container = ContainerInterface::getContainedByObject(component); - if (container == NULL || container->getNetworkId() != getNetworkId()) + if (container == nullptr || container->getNetworkId() != getNetworkId()) { FactoryObject * factory = dynamic_cast(container); - if (factory != NULL) + if (factory != nullptr) return removeIngredient(*factory, destination); return false; } Container::ContainerErrorCode errCode; return ContainerInterface::transferItemToVolumeContainer(destination, component, - NULL, errCode); + nullptr, errCode); } } // ManufactureSchematicObject::removeIngredient @@ -2169,7 +2169,7 @@ void ManufactureSchematicObject::destroyAllIngredients() m_factories.begin(); iter != m_factories.end(); ++iter) { FactoryObject * factory = safe_cast((*iter).getObject()); - if (factory != NULL) + if (factory != nullptr) { factory->endCraftingSession(); } @@ -2179,24 +2179,24 @@ void ManufactureSchematicObject::destroyAllIngredients() // empty our volume container VolumeContainer * const container = ContainerInterface::getVolumeContainer(*this); - if (container != NULL) + if (container != nullptr) { // for a stacked ingredient, if there are still more than one items in the stack, // "consume" 1 item from the stack, and return it to the player's inventory std::set itemsToReturnToInventory; - ServerObject* inventory = NULL; + ServerObject* inventory = nullptr; ContainerIterator iter; for (iter = container->begin(); iter != container->end(); ++iter) { CachedNetworkId & itemId = *iter; - if (itemId.getObject() != NULL) + if (itemId.getObject() != nullptr) { bool destroyItem = true; TangibleObject* to = safe_cast(itemId.getObject())->asTangibleObject(); - if (to && (to->getCount() > 1) && (dynamic_cast(to) == NULL)) + if (to && (to->getCount() > 1) && (dynamic_cast(to) == nullptr)) { - if (inventory == NULL) + if (inventory == nullptr) { ServerObject * o = safe_cast(ContainerInterface::getContainedByObject(*to)); while (o) @@ -2235,7 +2235,7 @@ void ManufactureSchematicObject::destroyAllIngredients() Container::ContainerErrorCode errCode; for (std::set::const_iterator iter = itemsToReturnToInventory.begin(); iter != itemsToReturnToInventory.end(); ++iter) { - if (!ContainerInterface::transferItemToVolumeContainer(*inventory, **iter, NULL, errCode)) + if (!ContainerInterface::transferItemToVolumeContainer(*inventory, **iter, nullptr, errCode)) { (*iter)->permanentlyDestroy(DeleteReasons::Consumed); } @@ -2281,29 +2281,29 @@ void ManufactureSchematicObject::destroyAllIngredients() ServerObject * ManufactureSchematicObject::manufactureObject(const NetworkId & creatorId, ServerObject & container, const SlotId & containerSlotId, bool prototype) { if (getCount() <= 0) - return NULL; + return nullptr; const DraftSchematicObject * draftSchematic = DraftSchematicObject::getSchematic(m_draftSchematic.get()); - if (draftSchematic == NULL) + if (draftSchematic == nullptr) { - return NULL; + return nullptr; } - if (draftSchematic->getCraftedObjectTemplate() == NULL) + if (draftSchematic->getCraftedObjectTemplate() == nullptr) { DEBUG_WARNING(true, ("Draft schematic %s does not have a craftable object template!\n", draftSchematic->getTemplateName())); - return NULL; + return nullptr; } // create the item TangibleObject * const object = dynamic_cast(ServerWorld::createNewObject(*draftSchematic->getCraftedObjectTemplate(), container, containerSlotId, false)); - if (object == NULL) + if (object == nullptr) { DEBUG_WARNING(true, ("Player %s failed to create object for template " "%s.\n", creatorId.getValueString().c_str(), draftSchematic->getCraftedObjectTemplate()->getName())); - return NULL; + return nullptr; } if (!getAssignedObjectName().empty()) @@ -2327,7 +2327,7 @@ ServerObject * ManufactureSchematicObject::manufactureObject(const NetworkId & c // set the creator xp type from the schematic template const ServerObjectTemplate * schematicTemplate = safe_cast(draftSchematic->getObjectTemplate()); - if (schematicTemplate != NULL && schematicTemplate->getXpPointsCount() > 0) + if (schematicTemplate != nullptr && schematicTemplate->getXpPointsCount() > 0) { ServerObjectTemplate::Xp xpData; schematicTemplate->getXpPoints(xpData, 0); @@ -2339,7 +2339,7 @@ ServerObject * ManufactureSchematicObject::manufactureObject(const NetworkId & c if (!setObjectComponents(object, true)) { object->permanentlyDestroy(DeleteReasons::BadContainerTransfer); - return NULL; + return nullptr; } // allow the schematic scripts to modify the object @@ -2356,7 +2356,7 @@ ServerObject * ManufactureSchematicObject::manufactureObject(const NetworkId & c if (result == SCRIPT_OVERRIDE) { object->permanentlyDestroy(DeleteReasons::Script); - return NULL; + return nullptr; } incrementCount(-1); @@ -2392,15 +2392,15 @@ ServerObject * ManufactureSchematicObject::manufactureObject(const Vector & posi { const DraftSchematicObject * draftSchematic = DraftSchematicObject::getSchematic( m_draftSchematic.get()); - if (draftSchematic == NULL) + if (draftSchematic == nullptr) { - return NULL; + return nullptr; } - if (draftSchematic->getCraftedObjectTemplate() == NULL) + if (draftSchematic->getCraftedObjectTemplate() == nullptr) { DEBUG_WARNING(true, ("Draft schematic %s does not have a craftable " "object template!\n", draftSchematic->getTemplateName())); - return NULL; + return nullptr; } Transform tr; @@ -2409,11 +2409,11 @@ ServerObject * ManufactureSchematicObject::manufactureObject(const Vector & posi TangibleObject * object = dynamic_cast(ServerWorld::createNewObject( *draftSchematic->getCraftedObjectTemplate(), tr, 0, false)); - if (object == NULL) + if (object == nullptr) { DEBUG_WARNING(true, ("Failed to create object for template " "%s.\n", draftSchematic->getCraftedObjectTemplate()->getName())); - return NULL; + return nullptr; } if (!getAssignedObjectName().empty()) @@ -2468,7 +2468,7 @@ bool ManufactureSchematicObject::setObjectComponents(TangibleObject * object, bo // check the objects in the schematic volume container to make sure they match VolumeContainer * volumeContainer = ContainerInterface::getVolumeContainer(*this); - if (volumeContainer == NULL) + if (volumeContainer == nullptr) { DEBUG_WARNING(true, ("Manf schematic %s does not have a volume container!", getNetworkId().getValueString().c_str())); @@ -2478,7 +2478,7 @@ bool ManufactureSchematicObject::setObjectComponents(TangibleObject * object, bo // for a stacked ingredient, if there are still more than one items in the stack, // "consume" 1 item from the stack, and return it to the player's inventory std::set itemsToReturnToInventory; - ServerObject* inventory = NULL; + ServerObject* inventory = nullptr; DynamicVariableList::NestedList slots(getObjVars(),OBJVAR_SLOTS); @@ -2533,11 +2533,11 @@ bool ManufactureSchematicObject::setObjectComponents(TangibleObject * object, bo { Container::ContainedItem & item = *iter; TangibleObject * const testComponent = dynamic_cast(item.getObject()); - if (testComponent == NULL) + if (testComponent == nullptr) continue; if (itemsToReturnToInventory.count(testComponent) > 0) continue; - FactoryObject * crate = NULL; + FactoryObject * crate = nullptr; bool found = false; bool foundCrate = false; if (component->ingredient != NetworkId::cms_invalid) @@ -2548,7 +2548,7 @@ bool ManufactureSchematicObject::setObjectComponents(TangibleObject * object, bo // see if the test component is a crate crate = dynamic_cast(testComponent); - if (crate != NULL && crate->getCount() == ingredientCount) + if (crate != nullptr && crate->getCount() == ingredientCount) { foundCrate = true; } @@ -2598,7 +2598,7 @@ bool ManufactureSchematicObject::setObjectComponents(TangibleObject * object, bo if (!componentTableName.empty()) { DataTable * componentTable = DataTableManager::getTable(componentTableName, true); - if (componentTable != NULL) + if (componentTable != nullptr) { uint32 value = INVALID_CRC; if (draftSlot.appearance == "component") @@ -2645,9 +2645,9 @@ bool ManufactureSchematicObject::setObjectComponents(TangibleObject * object, bo } bool destroyItem = true; - if ((testComponent->getCount() > 1) && (dynamic_cast(testComponent) == NULL)) + if ((testComponent->getCount() > 1) && (dynamic_cast(testComponent) == nullptr)) { - if (inventory == NULL) + if (inventory == nullptr) { ServerObject * o = safe_cast(ContainerInterface::getContainedByObject(*testComponent)); while (o) @@ -2701,7 +2701,7 @@ bool ManufactureSchematicObject::setObjectComponents(TangibleObject * object, bo Container::ContainerErrorCode errCode; for (std::set::const_iterator iter = itemsToReturnToInventory.begin(); iter != itemsToReturnToInventory.end(); ++iter) { - if (!ContainerInterface::transferItemToVolumeContainer(*inventory, **iter, NULL, errCode)) + if (!ContainerInterface::transferItemToVolumeContainer(*inventory, **iter, nullptr, errCode)) { (*iter)->permanentlyDestroy(DeleteReasons::Consumed); } @@ -2723,15 +2723,15 @@ bool ManufactureSchematicObject::setObjectComponents(TangibleObject * object, bo for (iter = volumeContainer->begin(); iter != volumeContainer->end(); ++iter) { - if ((*iter).getObject() != NULL) + if ((*iter).getObject() != nullptr) { ServerObject * temp = safe_cast((*iter).getObject()); bool destroyItem = true; TangibleObject* to = temp->asTangibleObject(); - if (to && (to->getCount() > 1) && (dynamic_cast(to) == NULL)) + if (to && (to->getCount() > 1) && (dynamic_cast(to) == nullptr)) { - if (inventory == NULL) + if (inventory == nullptr) { ServerObject * o = safe_cast(ContainerInterface::getContainedByObject(*to)); while (o) @@ -2787,7 +2787,7 @@ bool ManufactureSchematicObject::setObjectComponents(TangibleObject * object, bo Container::ContainerErrorCode errCode; for (std::set::const_iterator iter = itemsToReturnToInventory.begin(); iter != itemsToReturnToInventory.end(); ++iter) { - if (!ContainerInterface::transferItemToVolumeContainer(*inventory, **iter, NULL, errCode)) + if (!ContainerInterface::transferItemToVolumeContainer(*inventory, **iter, nullptr, errCode)) { (*iter)->permanentlyDestroy(DeleteReasons::Replaced); } @@ -2847,7 +2847,7 @@ void ManufactureSchematicObject::requestSlots(ServerObject & player) const case Crafting::IT_schematicGeneric: { const TangibleObject * const ingredient = dynamic_cast(NetworkIdManager::getObjectById(ingredientId)); - if (ingredient != NULL) + if (ingredient != nullptr) { optionInfo.ingredient = ingredient->getEncodedObjectName(); // since names can be duplicated, concatinate the id of @@ -2870,7 +2870,7 @@ void ManufactureSchematicObject::requestSlots(ServerObject & player) const case Crafting::IT_resourceClass: { ResourceTypeObject const * const ingredient = ServerUniverse::getInstance().getResourceTypeById(ingredientId); - if (ingredient != NULL) + if (ingredient != nullptr) optionInfo.ingredient = Unicode::narrowToWide(ingredient->getResourceName()); else optionInfo.ingredient = Unicode::narrowToWide("unknown"); @@ -2942,7 +2942,7 @@ void ManufactureSchematicObject::getIngredientInfo (IngredientInfoVector & iiv) // the manf schematic to the name if (component->ingredient != NetworkId::cms_invalid) { - //-- null-separate the string if needed + //-- nullptr-separate the string if needed if (!ingredientName.empty () && ingredientName [0] == '@') ingredientName.push_back ('\0'); @@ -2990,7 +2990,7 @@ void ManufactureSchematicObject::getIngredientInfo (IngredientInfoVector & iiv) case Crafting::IT_resourceClass: { ResourceTypeObject const * const ingredient = ServerUniverse::getInstance().getResourceTypeById(ingredientId); - if (ingredient != NULL) + if (ingredient != nullptr) ingredientName = Unicode::narrowToWide(ingredient->getResourceName ()); } break; @@ -3125,7 +3125,7 @@ const std::map & ManufactureSchematicObject::getAttributes() co int ManufactureSchematicObject::getVolume() const { const DraftSchematicObject * const schematic = DraftSchematicObject::getSchematic(getDraftSchematic()); - if (schematic != NULL) + if (schematic != nullptr) return schematic->getObjectTemplate()->asServerObjectTemplate()->getVolume(); return IntangibleObject::getVolume(); } // ManufactureSchematicObject::getVolume @@ -3212,7 +3212,7 @@ void ManufactureSchematicObject::recalculateData() else { const DraftSchematicObject * const missingSchematic = DraftSchematicObject::getSchematic(MISSING_SCHEMATIC_SUBSTITUTE); - if (missingSchematic != NULL) + if (missingSchematic != nullptr) m_draftSchematicSharedTemplate = missingSchematic->getSharedTemplate()->getCrcName().getCrc(); else WARNING_STRICT_FATAL(true, ("Cannot find draft schematic %s! This must always exist!", MISSING_SCHEMATIC_SUBSTITUTE.c_str())); @@ -3262,7 +3262,7 @@ void ManufactureSchematicObject::getByteStreamFromAutoVariable(const std::string if (name == "msoCtsPackUnpack") { // creator Id/Name - CreatureObject const * containingPlayer = NULL; + CreatureObject const * containingPlayer = nullptr; ServerObject const * parent = safe_cast(ContainerInterface::getContainedByObject(*this)); while (parent) @@ -3271,7 +3271,7 @@ void ManufactureSchematicObject::getByteStreamFromAutoVariable(const std::string if (containingPlayer && PlayerCreatureController::getPlayerObject(containingPlayer)) break; - containingPlayer = NULL; + containingPlayer = nullptr; parent = safe_cast(ContainerInterface::getContainedByObject(*parent)); } @@ -3329,7 +3329,7 @@ void ManufactureSchematicObject::setAutoVariableFromByteStream(const std::string Archive::AutoDeltaVariable creatorIsOwner; creatorIsOwner.unpackDelta(ri); - CreatureObject const * containingPlayer = NULL; + CreatureObject const * containingPlayer = nullptr; if (creatorIsOwner.get()) { @@ -3340,7 +3340,7 @@ void ManufactureSchematicObject::setAutoVariableFromByteStream(const std::string if (containingPlayer && PlayerCreatureController::getPlayerObject(containingPlayer)) break; - containingPlayer = NULL; + containingPlayer = nullptr; parent = safe_cast(ContainerInterface::getContainedByObject(*parent)); } } diff --git a/engine/server/library/serverGame/src/shared/object/MissionObject.cpp b/engine/server/library/serverGame/src/shared/object/MissionObject.cpp index 9aa5873a..fb7504f0 100755 --- a/engine/server/library/serverGame/src/shared/object/MissionObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/MissionObject.cpp @@ -32,7 +32,7 @@ //----------------------------------------------------------------------- -const SharedObjectTemplate * MissionObject::m_defaultSharedTemplate = NULL; +const SharedObjectTemplate * MissionObject::m_defaultSharedTemplate = nullptr; const char * const s_missionObjectTemplateName = "object/mission/base_mission_object.iff"; //----------------------------------------------------------------------- @@ -125,13 +125,13 @@ const SharedObjectTemplate * MissionObject::getDefaultSharedTemplate(void) const { static const ConstCharCrcLowerString templateName("object/mission/base/shared_mission_default.iff"); - if (m_defaultSharedTemplate == NULL) + if (m_defaultSharedTemplate == nullptr) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create " + WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create " "default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) ExitChain::add (removeDefaultTemplate, "MissionObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -144,10 +144,10 @@ static const ConstCharCrcLowerString templateName("object/mission/base/shared_mi */ void MissionObject::removeDefaultTemplate(void) { - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } // MissionObject::removeDefaultTemplate @@ -158,7 +158,7 @@ void MissionObject::abortMission() ScriptParams params; ScriptDictionaryPtr dictionary; getScriptObject()->makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(getNetworkId(), @@ -710,7 +710,7 @@ void MissionObject::getByteStreamFromAutoVariable(const std::string & name, Arch Archive::put(target, m_waypoint.get().getWaypointDataBase()); // mission location target - CreatureObject const * containingPlayer = NULL; + CreatureObject const * containingPlayer = nullptr; ServerObject const * parent = safe_cast(ContainerInterface::getContainedByObject(*this)); while (parent) { @@ -718,7 +718,7 @@ void MissionObject::getByteStreamFromAutoVariable(const std::string & name, Arch if (containingPlayer && PlayerCreatureController::getPlayerObject(containingPlayer)) break; - containingPlayer = NULL; + containingPlayer = nullptr; parent = safe_cast(ContainerInterface::getContainedByObject(*parent)); } @@ -785,7 +785,7 @@ void MissionObject::setAutoVariableFromByteStream(const std::string & name, cons m_title.unpackDelta(ri); // mission holder id - CreatureObject * containingPlayer = NULL; + CreatureObject * containingPlayer = nullptr; ServerObject * parent = safe_cast(ContainerInterface::getContainedByObject(*this)); while (parent) { @@ -793,7 +793,7 @@ void MissionObject::setAutoVariableFromByteStream(const std::string & name, cons if (containingPlayer && PlayerCreatureController::getPlayerObject(containingPlayer)) break; - containingPlayer = NULL; + containingPlayer = nullptr; parent = safe_cast(ContainerInterface::getContainedByObject(*parent)); } diff --git a/engine/server/library/serverGame/src/shared/object/ObjectFactory.cpp b/engine/server/library/serverGame/src/shared/object/ObjectFactory.cpp index bcba1d72..e23c7d1d 100755 --- a/engine/server/library/serverGame/src/shared/object/ObjectFactory.cpp +++ b/engine/server/library/serverGame/src/shared/object/ObjectFactory.cpp @@ -53,14 +53,14 @@ ServerObject * ServerWorld::createObjectFromTemplate(uint32 templateCrc, const N WARNING(!objectTemplate, ("Missing Template! Can't create object from " "template crc %lu(%s), file not found", templateCrc, ObjectTemplateList::lookUp(templateCrc).getString())); - Object *object = NULL; + Object *object = nullptr; if (objectTemplate) { ServerObjectTemplate const * serverObjectTemplate = objectTemplate->asServerObjectTemplate(); - if ( (serverObjectTemplate == NULL) - || ((serverObjectTemplate != NULL) && (ObjectTemplateList::lookUp(serverObjectTemplate->getSharedTemplate().c_str()).getCrc() != 0))) + if ( (serverObjectTemplate == nullptr) + || ((serverObjectTemplate != nullptr) && (ObjectTemplateList::lookUp(serverObjectTemplate->getSharedTemplate().c_str()).getCrc() != 0))) { PROFILER_AUTO_BLOCK_DEFINE("ObjectTemplate::createObject"); object = objectTemplate->createObject(); diff --git a/engine/server/library/serverGame/src/shared/object/ObjectTracker.cpp b/engine/server/library/serverGame/src/shared/object/ObjectTracker.cpp index 888b5d77..23b38bfe 100755 --- a/engine/server/library/serverGame/src/shared/object/ObjectTracker.cpp +++ b/engine/server/library/serverGame/src/shared/object/ObjectTracker.cpp @@ -81,7 +81,7 @@ int ObjectTracker::getNumPlayers() void ObjectTracker::getNumPlayersByFaction(int & imperial, int & rebel, int & neutral) { - time_t const now = ::time(NULL); + time_t const now = ::time(nullptr); if ((now - m_lastTimeCalculateFactionalPlayersCount) > 60) { m_numPlayersImperial = 0; diff --git a/engine/server/library/serverGame/src/shared/object/PatrolPathNodeProperty.cpp b/engine/server/library/serverGame/src/shared/object/PatrolPathNodeProperty.cpp index c17b6ca6..4731fcd7 100755 --- a/engine/server/library/serverGame/src/shared/object/PatrolPathNodeProperty.cpp +++ b/engine/server/library/serverGame/src/shared/object/PatrolPathNodeProperty.cpp @@ -36,7 +36,7 @@ m_roots(new std::set) PatrolPathNodeProperty::~PatrolPathNodeProperty() { delete m_roots; - m_roots = NULL; + m_roots = nullptr; } //------------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/object/PlanetObject.cpp b/engine/server/library/serverGame/src/shared/object/PlanetObject.cpp index f6a57df4..0ecbb8d6 100755 --- a/engine/server/library/serverGame/src/shared/object/PlanetObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/PlanetObject.cpp @@ -126,7 +126,7 @@ namespace PlanetObjectNamespace const char * makeCopyOfString(const char * rhs) { - char * lhs = NULL; + char * lhs = nullptr; if (rhs) { lhs = new char[strlen(rhs) + 1]; @@ -144,7 +144,7 @@ namespace PlanetObjectNamespace int getNextGcwScoreDecayTime(int base); // dictionary containing the table showing factional presence activity - ScriptParams * s_factionalPresenceSuiTable = NULL; + ScriptParams * s_factionalPresenceSuiTable = nullptr; bool s_factionalPresenceSuiTableNeedRebuild = true; void decrementConnectedCharacterLfgDataFactionalPresenceCount(Archive::AutoDeltaMap, PlanetObject> & connectedCharacterLfgDataFactionalPresence, const LfgCharacterData & lfgCharacterData); @@ -914,7 +914,7 @@ void PlanetObject::onLoadedFromDatabase() // "server first" information and manually create the CollectionServerFirstObserver // object, so that there will only be 1 call to the CollectionServerFirstObserver // object when it goes out of scope at the end of the function - m_collectionServerFirst.setSourceObject(NULL); + m_collectionServerFirst.setSourceObject(nullptr); CollectionServerFirstObserver observer(this, Archive::ADOO_set); const DynamicVariableList & objvars = getObjVars(); @@ -1004,7 +1004,7 @@ void PlanetObject::setCollectionServerFirst(const CollectionsDataTable::Collecti if (objvars.hasItem(objvar) && (DynamicVariable::STRING_ARRAY == objvars.getType(objvar))) return; - const time_t timeNow = ::time(NULL); + const time_t timeNow = ::time(nullptr); char buffer[64]; snprintf(buffer, sizeof(buffer)-1, "%ld", timeNow); buffer[sizeof(buffer)-1] = '\0'; @@ -1131,7 +1131,7 @@ void PlanetObject::handleCMessageTo(MessageToPayload const &message) std::string const params(message.getPackedDataVector().begin(), message.getPackedDataVector().end()); Unicode::String const delimiters(Unicode::narrowToWide("|")); Unicode::UnicodeStringVector tokens; - if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, NULL)) && (tokens.size() == 2)) + if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, nullptr)) && (tokens.size() == 2)) { CollectionsDataTable::CollectionInfoCollection const * const collectionInfo = CollectionsDataTable::getCollectionByName(Unicode::wideToNarrow(tokens[0])); if (collectionInfo && collectionInfo->trackServerFirst && (collectionInfo->serverFirstClaimTime > 0)) @@ -1193,7 +1193,7 @@ void PlanetObject::handleCMessageTo(MessageToPayload const &message) else if (message.getMethod() == "C++DoGcwDecay") { // start decay handling loop - int const now = static_cast(::time(NULL)); + int const now = static_cast(::time(nullptr)); int timeNextGcwScoreDecay; if (!getObjVars().getItem("gcwScore.nextDecayTime", timeNextGcwScoreDecay) || (timeNextGcwScoreDecay <= 0)) { @@ -1397,7 +1397,7 @@ void PlanetObject::endBaselines() } // start decay handling loop - int const now = static_cast(::time(NULL)); + int const now = static_cast(::time(nullptr)); int timeNextGcwScoreDecay; if (!getObjVars().getItem("gcwScore.nextDecayTime", timeNextGcwScoreDecay) || (timeNextGcwScoreDecay <= 0)) { @@ -1481,7 +1481,7 @@ ScriptParams const *PlanetObject::getConnectedCharacterLfgDataFactionalPresenceT if (s_factionalPresenceSuiTableNeedRebuild) { delete s_factionalPresenceSuiTable; - s_factionalPresenceSuiTable = NULL; + s_factionalPresenceSuiTable = nullptr; PlanetObject const * const tatooine = ServerUniverse::getInstance().getTatooinePlanet(); if (tatooine) @@ -2156,8 +2156,8 @@ void PlanetObject::updateGcwTrackingData() // send our GCW score to the other clusters and process GCW scores we received from other clusters if (isAuthoritative() && (ConfigServerGame::getBroadcastGcwScoreToOtherGalaxies() || ConfigServerGame::getReceiveGcwScoreFromOtherGalaxies())) { - static time_t timeNextBroadcast = ::time(NULL) + ConfigServerGame::getBroadcastGcwScoreToOtherGalaxiesIntervalSeconds(); - time_t const timeNow = ::time(NULL); + static time_t timeNextBroadcast = ::time(nullptr) + ConfigServerGame::getBroadcastGcwScoreToOtherGalaxiesIntervalSeconds(); + time_t const timeNow = ::time(nullptr); if (timeNextBroadcast < timeNow) { if (ConfigServerGame::getBroadcastGcwScoreToOtherGalaxies()) @@ -2342,7 +2342,7 @@ void PlanetObject::adjustGcwImperialScore(std::string const & source, CreatureOb PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(sourceObject); if (playerObject) { - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); IGNORE_RETURN(playerObject->setObjVarItem(std::string("gcwContributionTracking.") + gcwCategory, timeNow)); IGNORE_RETURN(playerObject->setObjVarItem(std::string("gcwContributionTrackingLastUpdated"), timeNow)); @@ -2387,7 +2387,7 @@ void PlanetObject::adjustGcwRebelScore(std::string const & source, CreatureObjec PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(sourceObject); if (playerObject) { - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); IGNORE_RETURN(playerObject->setObjVarItem(std::string("gcwContributionTracking.") + gcwCategory, timeNow)); IGNORE_RETURN(playerObject->setObjVarItem(std::string("gcwContributionTrackingLastUpdated"), timeNow)); @@ -2441,7 +2441,7 @@ int PlanetObjectNamespace::getNextGcwScoreDecayTime(int base) } if (nextTime < 0) - nextTime = static_cast(::time(NULL)) + (60 * 60 * 24 * 7); + nextTime = static_cast(::time(nullptr)) + (60 * 60 * 24 * 7); return nextTime; } diff --git a/engine/server/library/serverGame/src/shared/object/PlayerObject.cpp b/engine/server/library/serverGame/src/shared/object/PlayerObject.cpp index 1e574c40..5a481653 100755 --- a/engine/server/library/serverGame/src/shared/object/PlayerObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/PlayerObject.cpp @@ -95,7 +95,7 @@ #include #include -const SharedObjectTemplate * PlayerObject::m_defaultSharedTemplate = NULL; +const SharedObjectTemplate * PlayerObject::m_defaultSharedTemplate = nullptr; bool PlayerObject::m_allowEmptySlot = false; @@ -317,7 +317,7 @@ PlayerObject::PlayerObject(const ServerPlayerObjectTemplate* newTemplate) : m_craftingStation(), m_craftingComponentBioLink(), m_useableDraftSchematics(), - m_draftSchematic(NULL), + m_draftSchematic(nullptr), m_matchMakingPersonalProfileId(), m_matchMakingCharacterProfileId(), m_friendList(), @@ -451,13 +451,13 @@ const SharedObjectTemplate * PlayerObject::getDefaultSharedTemplate() const { static const ConstCharCrcLowerString templateName("object/player/base/shared_player_default.iff"); - if (m_defaultSharedTemplate == NULL) + if (m_defaultSharedTemplate == nullptr) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create " + WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create " "default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) ExitChain::add (removeDefaultTemplate, "PlayerObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -470,10 +470,10 @@ static const ConstCharCrcLowerString templateName("object/player/base/shared_pla */ void PlayerObject::removeDefaultTemplate() { - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } // PlayerObject::removeDefaultTemplate @@ -514,7 +514,7 @@ int PlayerObject::getCurrentBornDate() time_t baseTime = mktime(&baseTimeData); // get the current time and compute the birth date - time_t currentTime = time(NULL); + time_t currentTime = time(nullptr); time_t delta = (currentTime - baseTime) / (60 * 60 * 24); delta += ((currentTime - baseTime) % (60 * 60 * 24) != 0 ? 1 : 0); return int(delta); @@ -631,14 +631,14 @@ void PlayerObject::virtualOnSetAuthority() if (isCrafting()) { const TangibleObject * tool = safe_cast(getCraftingTool().getObject()); - if (tool != NULL) + if (tool != nullptr) { const ManufactureSchematicObject * manfSchematic = tool->getCraftingManufactureSchematic(); - if (manfSchematic != NULL) + if (manfSchematic != nullptr) { m_draftSchematic = DraftSchematicObject::getSchematic( manfSchematic->getDraftSchematic()); - if (m_draftSchematic.getPointer() == NULL) + if (m_draftSchematic.getPointer() == nullptr) { WARNING(true, ("PlayerObject::virtualOnSetAuthority object " "%s is flagged as crafting, but has bad manf schematic %lu", @@ -749,7 +749,7 @@ int PlayerObject::getExperienceLimit(const std::string & experienceType) const if((*iter)) { const SkillObject::ExperiencePair * xpInfo = (*iter)->getPrerequisiteExperience(); - if (xpInfo != NULL && experienceType == xpInfo->first && xpInfo->second.second > 0) + if (xpInfo != nullptr && experienceType == xpInfo->first && xpInfo->second.second > 0) { if (limit == static_cast(-1) || limit < static_cast(xpInfo->second.second)) @@ -797,9 +797,9 @@ int PlayerObject::grantExperiencePoints(const std::string & experienceType, int // adjust the xp based on what faction is doing best // NOTE: HACK HACK HACK! const PlanetObject * tatooine = ServerUniverse::getInstance().getTatooinePlanet(); - if (tatooine == NULL) + if (tatooine == nullptr) tatooine = ServerUniverse::getInstance().getPlanetByName("Tatooine"); - if (tatooine == NULL) + if (tatooine == nullptr) { WARNING(true, ("Can't find planet tatooine from ServerUniverse")); } @@ -932,7 +932,7 @@ bool PlayerObject::grantSchematic(uint32 schematicCrc, bool fromSkill) const DraftSchematicObject * schematic = DraftSchematicObject::getSchematic( schematicCrc); - if (schematic != NULL) + if (schematic != nullptr) { // add the schematic to the player's draft schematic list Archive::AutoDeltaMap, int>::const_iterator found = m_draftSchematics.find(schematic->getCombinedCrc()); @@ -982,7 +982,7 @@ bool PlayerObject::revokeSchematic(uint32 schematicCrc, bool fromSkill) stopCrafting(false); const DraftSchematicObject * schematic = DraftSchematicObject::getSchematic(schematicCrc); - if (schematic != NULL) + if (schematic != nullptr) { // remove the schematic from the player's draft schematic list Archive::AutoDeltaMap, int>::const_iterator found = m_draftSchematics.find(schematic->getCombinedCrc()); @@ -1028,7 +1028,7 @@ bool PlayerObject::revokeSchematic(uint32 schematicCrc, bool fromSkill) bool PlayerObject::hasSchematic(uint32 schematicCrc) { const DraftSchematicObject * schematic = DraftSchematicObject::getSchematic(schematicCrc); - if (schematic != NULL) + if (schematic != nullptr) { std::map,int>::const_iterator found = m_draftSchematics.find(schematic->getCombinedCrc()); if (found != m_draftSchematics.end()) @@ -1065,7 +1065,7 @@ void PlayerObject::setCraftingTool(const TangibleObject & tool) */ void PlayerObject::setCraftingStation(const TangibleObject * station) { - if (station != NULL) + if (station != nullptr) { // verify the crafting station is valid if (station->getObjVars().hasItem(OBJVAR_CRAFTING_STATION)) @@ -1075,7 +1075,7 @@ void PlayerObject::setCraftingStation(const TangibleObject * station) // if we are private, make sure we have an ingredient hopper int privateStation = 0; station->getObjVars().getItem(OBJVAR_PRIVATE_STATION, privateStation); - if (privateStation == 1 && getCraftingLevel() == 3 && station->getIngredientHopper() == NULL) + if (privateStation == 1 && getCraftingLevel() == 3 && station->getIngredientHopper() == nullptr) { CreatureObject * const owner = getCreatureObject(); NOT_NULL(owner); @@ -1105,7 +1105,7 @@ void PlayerObject::setCraftingStation(const TangibleObject * station) bool PlayerObject::requestCraftingSession(const NetworkId & toolId) { CreatureObject * const owner = getCreatureObject(); - if (owner == NULL) + if (owner == nullptr) return false; const std::string myId = getNetworkId().getValueString(); @@ -1133,7 +1133,7 @@ bool PlayerObject::requestCraftingSession(const NetworkId & toolId) } TangibleObject * const tool = dynamic_cast(CachedNetworkId(toolId).getObject()); - if (tool == NULL) + if (tool == nullptr) { DEBUG_WARNING(true, ("Player %s requesting crafting session with invalid " "object %s", myIdString, toolIdString)); @@ -1155,7 +1155,7 @@ bool PlayerObject::requestCraftingSession(const NetworkId & toolId) { CachedNetworkId const & objId = (*iter); TangibleObject * const obj = safe_cast(objId.getObject()); - if ((obj != NULL) && obj->isCraftingTool() && (toolType & obj->getCraftingType())) + if ((obj != nullptr) && obj->isCraftingTool() && (toolType & obj->getCraftingType())) { return requestCraftingSession(objId) ; } @@ -1182,7 +1182,7 @@ bool PlayerObject::requestCraftingSession(const NetworkId & toolId) void PlayerObject::sendUseableDraftSchematics(std::vector & schematicNames) { CreatureObject * const owner = getCreatureObject(); - if (owner == NULL) + if (owner == nullptr) return; // keep around the names since we are just going to get an index back from @@ -1198,7 +1198,7 @@ void PlayerObject::sendUseableDraftSchematics(std::vector & schematicNam if (*iter != 0) { const DraftSchematicObject * const schematic = DraftSchematicObject::getSchematic(*iter); - if (schematic != NULL) + if (schematic != nullptr) { message->addSchematic(schematic->getCombinedCrc(), static_cast(schematic->getCategory())); @@ -1248,37 +1248,37 @@ void PlayerObject::sendUseableDraftSchematics(std::vector & schematicNam */ bool PlayerObject::requestDraftSlots(uint32 draftSchematicCrc, MessageQueueDraftSlots * message, MessageQueueDraftSlotsQueryResponse * queryMessage) { - ManufactureSchematicObject * manfSchematic = NULL; + ManufactureSchematicObject * manfSchematic = nullptr; MessageQueueDraftSlots::Slot slotInfo; MessageQueueDraftSlots::Option optionInfo; - if ((message == NULL && queryMessage == NULL) || - (message != NULL && queryMessage != NULL)) + if ((message == nullptr && queryMessage == nullptr) || + (message != nullptr && queryMessage != nullptr)) { return false; } CreatureObject * const owner = getCreatureObject(); - if (owner == NULL) + if (owner == nullptr) return false; const ConstCharCrcString & schematicName = ObjectTemplateList::lookUp(draftSchematicCrc); UNREF(schematicName); const DraftSchematicObject * const draftSchematic = DraftSchematicObject::getSchematic(draftSchematicCrc); - if (draftSchematic == NULL) + if (draftSchematic == nullptr) { DEBUG_WARNING(true, ("Player %s requested invalid draft schematic %s", owner->getNetworkId().getValueString().c_str(), schematicName.getString())); return false; } - if (message != NULL) + if (message != nullptr) { m_draftSchematic = draftSchematic; TangibleObject * const tool = safe_cast(getCraftingTool().getObject()); NOT_NULL(tool); - if (tool == NULL) + if (tool == nullptr) return false; tool->clearCraftingManufactureSchematic(); @@ -1287,7 +1287,7 @@ bool PlayerObject::requestDraftSlots(uint32 draftSchematicCrc, MessageQueueDraft // make a temporary manufacturing schematic based on the draft scematic manfSchematic = ServerWorld::createNewManufacturingSchematic(CachedNetworkId( *owner), *tool, tool->getCraftingManufactureSchematicSlotId(), false); - if (manfSchematic == NULL) + if (manfSchematic == nullptr) { DEBUG_WARNING(true, ("Error creating manufacturing schematic!")); return false; @@ -1305,7 +1305,7 @@ bool PlayerObject::requestDraftSlots(uint32 draftSchematicCrc, MessageQueueDraft // being made ServerObject * prototype = manfSchematic->manufactureObject(owner->getNetworkId(), *tool, tool->getCraftingPrototypeSlotId(), true); - if (prototype == NULL) + if (prototype == nullptr) { DEBUG_WARNING(true, ("Error creating temp prototype!")); return false; @@ -1322,7 +1322,7 @@ bool PlayerObject::requestDraftSlots(uint32 draftSchematicCrc, MessageQueueDraft getAccountDescription().c_str())); } - if (queryMessage != NULL) + if (queryMessage != nullptr) { queryMessage->setComplexity(static_cast(draftSchematic->getComplexity())); queryMessage->setVolume(draftSchematic->getVolume()); @@ -1343,7 +1343,7 @@ bool PlayerObject::requestDraftSlots(uint32 draftSchematicCrc, MessageQueueDraft if (!slot.optional || slot.optionalSkillCommand.empty() || owner->hasCommand(slot.optionalSkillCommand)) { - if (manfSchematic != NULL) + if (manfSchematic != nullptr) { // create the slot IGNORE_RETURN(manfSchematic->getSlot(slot.name, manfSlot)); @@ -1370,13 +1370,13 @@ bool PlayerObject::requestDraftSlots(uint32 draftSchematicCrc, MessageQueueDraft { // get the default object name from the shared template const ObjectTemplate *const ingredientTemplate = ObjectTemplateList::fetch(simple.ingredient); - if (ingredientTemplate == NULL) + if (ingredientTemplate == nullptr) { DEBUG_WARNING(true, ("draft schematic component ingredient %s not found!", simple.ingredient.c_str())); continue; } const SharedObjectTemplate * const sharedTemplate = safe_cast(ObjectTemplateList::fetch((safe_cast(ingredientTemplate))->getSharedTemplate())); - if (sharedTemplate == NULL) + if (sharedTemplate == nullptr) { DEBUG_WARNING(true, ("draft schematic component ingredient %s shared template not found!", simple.ingredient.c_str())); continue; @@ -1391,19 +1391,19 @@ bool PlayerObject::requestDraftSlots(uint32 draftSchematicCrc, MessageQueueDraft { // get the default object name from the shared template of the crafted object const ObjectTemplate * const ingredientTemplate = ObjectTemplateList::fetch(simple.ingredient); - if (ingredientTemplate == NULL) + if (ingredientTemplate == nullptr) { DEBUG_WARNING(true, ("draft schematic schematic ingredient %s not found!", simple.ingredient.c_str())); continue; } const ServerObjectTemplate * const craftedTemplate = safe_cast(ingredientTemplate)->getCraftedObjectTemplate(); - if (craftedTemplate == NULL) + if (craftedTemplate == nullptr) { DEBUG_WARNING(true, ("draft schematic schematic ingredient %s not found!", simple.ingredient.c_str())); continue; } const SharedObjectTemplate * const sharedTemplate = safe_cast(ObjectTemplateList::fetch((safe_cast(craftedTemplate))->getSharedTemplate())); - if (sharedTemplate == NULL) + if (sharedTemplate == nullptr) { DEBUG_WARNING(true, ("draft schematic component ingredient %s shared template not found!", simple.ingredient.c_str())); continue; @@ -1434,7 +1434,7 @@ bool PlayerObject::requestDraftSlots(uint32 draftSchematicCrc, MessageQueueDraft } // for (int j = 0; j < optionsCount; ++j) if (componentSlot) slotInfo.hardpoint = slot.appearance; - if (message != NULL) + if (message != nullptr) message->addSlot(slotInfo); else queryMessage->addSlot(slotInfo); @@ -1443,7 +1443,7 @@ bool PlayerObject::requestDraftSlots(uint32 draftSchematicCrc, MessageQueueDraft } // for (int i = 0; i < slotCount; ++i) // send the slot info to the player - if (message != NULL) + if (message != nullptr) { (safe_cast(owner->getController()))->appendMessage( static_cast(CM_draftSlotsMessage), 0.0f, message, @@ -1475,7 +1475,7 @@ bool PlayerObject::requestDraftSlots(uint32 draftSchematicCrc, MessageQueueDraft void PlayerObject::selectDraftSchematic(int index) { CreatureObject * const owner = getCreatureObject(); - if (owner == NULL) + if (owner == nullptr) return; const std::string myId = getNetworkId().getValueString(); @@ -1510,7 +1510,7 @@ void PlayerObject::selectDraftSchematic(int index) MessageQueueDraftSlots * message = new MessageQueueDraftSlots( getCraftingTool(), NetworkId::cms_invalid); - if (requestDraftSlots(m_useableDraftSchematics[static_cast(index)], message, NULL)) + if (requestDraftSlots(m_useableDraftSchematics[static_cast(index)], message, nullptr)) { m_craftingStage = static_cast(Crafting::CS_assembly); m_craftingComponentBioLink = NetworkId::cms_invalid; @@ -1540,11 +1540,11 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde UNREF(myIdString); // needed for release mode CreatureObject * const owner = getCreatureObject(); - if (owner == NULL) + if (owner == nullptr) return Crafting::CE_noOwner; // check the draft schematic - if (m_draftSchematic.getPointer() == NULL) + if (m_draftSchematic.getPointer() == nullptr) { WARNING(true, ("Player %s trying to fill slot with no draft schematic!", myIdString)); return Crafting::CE_noDraftSchematic; @@ -1572,9 +1572,9 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde } TangibleObject * const tool = safe_cast(getCraftingTool().getObject()); - if (tool == NULL) + if (tool == nullptr) { - WARNING(true, ("Player %s trying to fill slot with crafting tool %s, but tool is NULL!", myIdString, getCraftingTool().getValueString().c_str())); + WARNING(true, ("Player %s trying to fill slot with crafting tool %s, but tool is nullptr!", myIdString, getCraftingTool().getValueString().c_str())); return Crafting::CE_noCraftingTool; } @@ -1583,7 +1583,7 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde // check the manufacturing schematic ManufactureSchematicObject * const manfSchematic = tool->getCraftingManufactureSchematic(); - if (manfSchematic == NULL) + if (manfSchematic == nullptr) { WARNING(true, ("Player %s trying to fill slot with no manufacturing schematic!", myIdString)); return Crafting::CE_noManfSchematic; @@ -1614,7 +1614,7 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde // get the draft schematic option, convert the passed-in option index to the // unfiltered index int i, j; - const ServerIntangibleObjectTemplate::Ingredient * slotOption = NULL; + const ServerIntangibleObjectTemplate::Ingredient * slotOption = nullptr; const int optionsCount = static_cast(draftSlot.options.size()); for (i = 0, j = 0; i < optionsCount; ++i) { @@ -1637,9 +1637,9 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde } slotOptionIndex = i; - if (slotOption == NULL || slotOption->ingredients.size() != 1) + if (slotOption == nullptr || slotOption->ingredients.size() != 1) { - WARNING(true, ("slotOption is NULL or ingredient %d for draft schematic %s, slot %s, has ingredient count != 1", + WARNING(true, ("slotOption is nullptr or ingredient %d for draft schematic %s, slot %s, has ingredient count != 1", slotOptionIndex, m_draftSchematic->getTemplateName(), draftSlot.name.getText().c_str())); return Crafting::CE_invalidIngredientSize; } @@ -1671,7 +1671,7 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde int numIngredientsToAdd = neededIngredientCount - currentIngredientCount; TangibleObject * const ingredient = dynamic_cast(NetworkIdManager::getObjectById(ingredientId)); - if (ingredient == NULL) + if (ingredient == nullptr) { WARNING(true, ("No object for ingredient id %s", ingredientId.getValueString().c_str())); return Crafting::CE_invalidIngredient; @@ -1698,7 +1698,7 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde if (!owner->isIngredientInInventory(*ingredient)) { // if we are crafting level 3, also check the crafting station's hopper - if (getCraftingLevel() != 3 || (station != NULL && + if (getCraftingLevel() != 3 || (station != nullptr && !station->isIngredientInHopper(ingredientId))) { DEBUG_WARNING(true, ("Player %s chose invalid ingredient %s", myIdString, ingredientId.getValueString().c_str())); @@ -1709,7 +1709,7 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde // see if the ingredient is a resource or component ResourceContainerObject * const crate = dynamic_cast(ingredient); - if (crate != NULL) + if (crate != nullptr) { // get the resource type name and class name ResourceTypeObject const * const resource = crate->getResourceType(); @@ -1731,7 +1731,7 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde else if (slotOption->ingredientType == ServerIntangibleObjectTemplate::IT_resourceClass) { ResourceClassObject const * resourceClass = &(resource->getParentClass()); - while (resourceClass != NULL) + while (resourceClass != nullptr) { const std::string className (resourceClass->getResourceClassName()); if (className == slotIngredient.ingredient) @@ -1805,11 +1805,11 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde FactoryObject * factory = dynamic_cast(ingredient); // if this is an old-style factory, we can't use it directly in crafting - if (factory != NULL && !factory->getLoadContents()) - factory = NULL; + if (factory != nullptr && !factory->getLoadContents()) + factory = nullptr; // make sure the component isn't damaged - if (factory == NULL && ingredient->getDamageTaken() != 0 && + if (factory == nullptr && ingredient->getDamageTaken() != 0 && !ingredient->getObjVars().hasItem(OBJVAR_CRAFTING_COMPONENT_CAN_BE_DAMAGED)) { DEBUG_WARNING(true, ("Tried to use damaged component %s for draft schematic %s, slot %s, option %d", @@ -1853,27 +1853,27 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde // check the ingredient template name for every template in it's // heirarchy - const ObjectTemplate * testTemplate = NULL; + const ObjectTemplate * testTemplate = nullptr; if (slotOption->ingredientType == ServerIntangibleObjectTemplate::IT_template || slotOption->ingredientType == ServerIntangibleObjectTemplate::IT_templateGeneric) { - if (factory == NULL) + if (factory == nullptr) testTemplate = ingredient->getObjectTemplate(); else testTemplate = factory->getContainedObjectTemplate(); } else { - const DraftSchematicObject * itemSchematic = NULL; - if (factory == NULL) + const DraftSchematicObject * itemSchematic = nullptr; + if (factory == nullptr) itemSchematic = DraftSchematicObject::getSchematic(ingredient->getSourceDraftSchematic()); else itemSchematic = DraftSchematicObject::getSchematic(factory->getDraftSchematic()); - if (itemSchematic != NULL) + if (itemSchematic != nullptr) testTemplate = itemSchematic->getObjectTemplate(); } - while (testTemplate != NULL) + while (testTemplate != nullptr) { const std::string ingredientName(testTemplate->getName()); if (ingredientName == requiredIngredientName) @@ -1896,7 +1896,7 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde // this is a configureable setting const Crafting::ComponentIngredient * testComponent = dynamic_cast< const Crafting::ComponentIngredient *>(manfSlot.ingredients.front().get()); - if (testComponent != NULL) + if (testComponent != nullptr) { if (ConfigServerGame::getCraftingComponentStrict() && (slotOption->ingredientType != ServerIntangibleObjectTemplate::IT_templateGeneric && @@ -1909,15 +1909,15 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde else { // component from same template - if (factory == NULL) + if (factory == nullptr) { - if (ingredient->getObjectTemplateName() != NULL && + if (ingredient->getObjectTemplateName() != nullptr && ingredient->getObjectTemplateName() == testComponent->templateName) { slotOk = true; } } - else if (factory->getContainedTemplateName() != NULL && + else if (factory->getContainedTemplateName() != nullptr && factory->getContainedTemplateName() == testComponent->templateName) { slotOk = true; @@ -1927,7 +1927,7 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde } if (slotOk) { - if (factory == NULL || factory->getCount() <= numIngredientsToAdd) + if (factory == nullptr || factory->getCount() <= numIngredientsToAdd) { // adding normal component or a complete factory object if (manfSchematic->addIngredient(*ingredient)) @@ -1938,7 +1938,7 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde manfSchematic->setSlotOption(manfSlot.name, slotOptionIndex); manfSchematic->modifySlotComplexity(manfSlot.name, slotOption->complexity); } - if (factory == NULL) + if (factory == nullptr) { manfSchematic->addSlotComponent(manfSlot.name, *ingredient, slotOption->ingredientType); @@ -2014,7 +2014,7 @@ Crafting::CraftingError PlayerObject::emptySlot(int slotIndex, const NetworkId & UNREF(myIdString); // needed for release mode CreatureObject * const owner = getCreatureObject(); - if (owner == NULL) + if (owner == nullptr) return Crafting::CE_noOwner; if (getCraftingStage() != Crafting::CS_assembly && !m_allowEmptySlot) @@ -2024,7 +2024,7 @@ Crafting::CraftingError PlayerObject::emptySlot(int slotIndex, const NetworkId & } // check the draft schematic - if (m_draftSchematic.getPointer() == NULL) + if (m_draftSchematic.getPointer() == nullptr) { WARNING(true, ("Player %s trying to empty slot with no draft schematic!", myIdString)); return Crafting::CE_noDraftSchematic; @@ -2037,15 +2037,15 @@ Crafting::CraftingError PlayerObject::emptySlot(int slotIndex, const NetworkId & return Crafting::CE_noCraftingTool; } TangibleObject * const tool = safe_cast(getCraftingTool().getObject()); - if (tool == NULL) + if (tool == nullptr) { - WARNING(true, ("Player %s trying to empty slot with crafting tool %s, but tool is NULL!", myIdString, getCraftingTool().getValueString().c_str())); + WARNING(true, ("Player %s trying to empty slot with crafting tool %s, but tool is nullptr!", myIdString, getCraftingTool().getValueString().c_str())); return Crafting::CE_noCraftingTool; } // get the crafting station (if any) TangibleObject * station = dynamic_cast(getCraftingStation().getObject()); - if (station != NULL && getCraftingLevel() == 3 && station->getIngredientHopper() == NULL) + if (station != nullptr && getCraftingLevel() == 3 && station->getIngredientHopper() == nullptr) { WARNING_STRICT_FATAL(true, ("Player %s trying to empty crafting slot near " "a crafting station %s that has no ingredient hopper!", @@ -2055,7 +2055,7 @@ Crafting::CraftingError PlayerObject::emptySlot(int slotIndex, const NetworkId & } ServerObject * const inventory = owner->getInventory(); - if (inventory == NULL) + if (inventory == nullptr) { WARNING (true, ("Player %s has no inventory.", myIdString)); return Crafting::CE_noInventory; @@ -2077,7 +2077,7 @@ Crafting::CraftingError PlayerObject::emptySlot(int slotIndex, const NetworkId & // if we are crafting level 3, also check the crafting station's hopper if (!containerIsWorn && - (getCraftingLevel() != 3 || (station != NULL && + (getCraftingLevel() != 3 || (station != nullptr && !isNestedInContainer (targetContainerId, station->getIngredientHopper()->getNetworkId())))) { WARNING (true, ("Player %s attempted to empty slot into invalid container [%s].", myIdString, targetContainerId.getValueString().c_str())); @@ -2087,7 +2087,7 @@ Crafting::CraftingError PlayerObject::emptySlot(int slotIndex, const NetworkId & targetContainer = safe_cast(NetworkIdManager::getObjectById (targetContainerId)); - if (targetContainer == NULL) + if (targetContainer == nullptr) { WARNING (true, ("Player %s attempted to empty slot into non-existant container [%s].", myIdString, targetContainerId.getValueString ().c_str ())); return Crafting::CE_badTargetContainer; @@ -2102,7 +2102,7 @@ Crafting::CraftingError PlayerObject::emptySlot(int slotIndex, const NetworkId & // check the manufacturing schematic ManufactureSchematicObject * const manfSchematic = tool->getCraftingManufactureSchematic(); - if (manfSchematic == NULL) + if (manfSchematic == nullptr) { WARNING(true, ("Player %s trying to empty slot with no manufacturing schematic!", myIdString)); return Crafting::CE_noManfSchematic; @@ -2154,7 +2154,7 @@ Crafting::CraftingError PlayerObject::emptySlot(int slotIndex, const NetworkId & const Crafting::ComponentIngredient * const componentInfo = dynamic_cast((*iter).get()); NOT_NULL(componentInfo); TangibleObject * const component = manfSchematic->getComponent(*componentInfo); - if (component != NULL) + if (component != nullptr) { // move the component from the schematic to the player if (!manfSchematic->removeIngredient(*component, *targetContainer)) @@ -2180,7 +2180,7 @@ Crafting::CraftingError PlayerObject::emptySlot(int slotIndex, const NetworkId & { // ingredient is a resource VolumeContainer * const targetVolumeContainer = ContainerInterface::getVolumeContainer(*targetContainer); - if (targetVolumeContainer == NULL) + if (targetVolumeContainer == nullptr) { DEBUG_WARNING(true, ("PlayerObject::emptySlot: targetContainer %s does not have a volume container", targetContainer->getNetworkId().getValueString().c_str())); @@ -2203,7 +2203,7 @@ Crafting::CraftingError PlayerObject::emptySlot(int slotIndex, const NetworkId & { ResourceContainerObject * crate = dynamic_cast< ResourceContainerObject *>(NetworkIdManager::getObjectById((*iter2))); - if (crate != NULL && crate->getResourceTypeId() == resourceId) + if (crate != nullptr && crate->getResourceTypeId() == resourceId) { int emptySpace = crate->getMaxQuantity() - crate->getQuantity(); if (emptySpace > 0) @@ -2236,7 +2236,7 @@ Crafting::CraftingError PlayerObject::emptySlot(int slotIndex, const NetworkId & { ServerObject * crateObject = ServerWorld::createNewObject( crateTemplateName, *targetContainer, true); - if (crateObject == NULL) + if (crateObject == nullptr) { // @todo: inform the player DEBUG_WARNING(true, ("PlayerObject::emptySlot tried to " @@ -2322,14 +2322,14 @@ int PlayerObject::startCraftingExperiment () int i; CreatureObject * const owner = getCreatureObject(); - if (owner == NULL) + if (owner == nullptr) return -Crafting::CE_noOwner; std::string myId = getNetworkId().getValueString(); const char * myIdString = myId.c_str(); UNREF(myIdString); // needed for release mode - if (m_draftSchematic.getPointer() == NULL) + if (m_draftSchematic.getPointer() == nullptr) { DEBUG_WARNING(true, ("Player %s tried to start crafting experimentation with invalid schematic.", myIdString)); return -Crafting::CE_noDraftSchematic; @@ -2350,13 +2350,13 @@ int PlayerObject::startCraftingExperiment () if (!tool) { - DEBUG_WARNING(true, ("Player %s tried to start crafting experimentation with null crafting tool [%s].", myIdString, getCraftingTool().getValueString().c_str())); + DEBUG_WARNING(true, ("Player %s tried to start crafting experimentation with nullptr crafting tool [%s].", myIdString, getCraftingTool().getValueString().c_str())); return -Crafting::CE_noCraftingTool; } // check the manufacturing schematic ManufactureSchematicObject * const manfSchematic = tool->getCraftingManufactureSchematic(); - if (manfSchematic == NULL) + if (manfSchematic == nullptr) { DEBUG_WARNING(true, ("Player %s tried to start crafting experimentation with invalid manufacture schematic.", myIdString)); return -Crafting::CE_noManfSchematic; @@ -2425,7 +2425,7 @@ int PlayerObject::startCraftingExperiment () } ServerObject * prototype = tool->getCraftingPrototype(); - if (prototype == NULL) + if (prototype == nullptr) { DEBUG_WARNING(true, ("PlayerObject::startCraftingExperiment crafting " "tool %s has no prototype object!", @@ -2530,7 +2530,7 @@ int PlayerObject::startCraftingExperiment () Crafting::CraftingResult PlayerObject::experiment(const std::vector & experiments, int totalPoints, int corelevel) { CreatureObject * const owner = getCreatureObject(); - if (owner == NULL) + if (owner == nullptr) return Crafting::CR_internalFailure; std::string myId = getNetworkId().getValueString(); @@ -2554,7 +2554,7 @@ Crafting::CraftingResult PlayerObject::experiment(const std::vectorgetCraftingManufactureSchematic(); - if (manfSchematic == NULL) + if (manfSchematic == nullptr) { DEBUG_WARNING(true, ("Player %s tried to experiment with invalid " "manufacture schematic.", myIdString)); @@ -2577,7 +2577,7 @@ Crafting::CraftingResult PlayerObject::experiment(const std::vectorgetCraftingPrototype(); - if (prototype == NULL) + if (prototype == nullptr) { DEBUG_WARNING(true, ("Player %s tried to experiment with invalid test " "prototype.", myIdString)); @@ -2680,7 +2680,7 @@ bool PlayerObject::customize(int property, int value) const return false; } - if (m_draftSchematic.getPointer() == NULL || getCraftingTool() == NetworkId::cms_invalid) + if (m_draftSchematic.getPointer() == nullptr || getCraftingTool() == NetworkId::cms_invalid) { DEBUG_WARNING(true, ("Player %s tried to customize with invalid " "schematic or crafting tool.", myIdString)); @@ -2732,7 +2732,7 @@ int PlayerObject::setCustomizationData(const Unicode::String & name, return Crafting::CE_notCustomizeStage; } - if (m_draftSchematic.getPointer() == NULL) + if (m_draftSchematic.getPointer() == nullptr) { DEBUG_WARNING(true, ("Player %s tried to customize with invalid schematic.", myIdString)); return Crafting::CE_noDraftSchematic; @@ -2804,7 +2804,7 @@ int PlayerObject::setCustomizationData(const Unicode::String & name, bool PlayerObject::createPrototype(bool keepPrototype) { CreatureObject * const owner = getCreatureObject(); - if (owner == NULL) + if (owner == nullptr) return false; std::string myId = getNetworkId().getValueString(); @@ -2821,7 +2821,7 @@ bool PlayerObject::createPrototype(bool keepPrototype) return false; } - if (m_draftSchematic.getPointer() == NULL || getCraftingTool() == NetworkId::cms_invalid) + if (m_draftSchematic.getPointer() == nullptr || getCraftingTool() == NetworkId::cms_invalid) { DEBUG_WARNING(true, ("Player %s tried to create prototype with invalid " "schematic or crafting tool.", myIdString)); @@ -2842,7 +2842,7 @@ bool PlayerObject::createPrototype(bool keepPrototype) } ManufactureSchematicObject * const manfSchematic = tool->getCraftingManufactureSchematic(); - if (manfSchematic == NULL) + if (manfSchematic == nullptr) { WARNING_STRICT_FATAL(true, ("No manf schematic in crafting tool %s", tool->getNetworkId().getValueString().c_str())); @@ -2961,7 +2961,7 @@ bool PlayerObject::createPrototype(bool keepPrototype) params.addParam(prototype->getNetworkId(), "prototype"); ScriptDictionaryPtr dictionary; getScriptObject()->makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); @@ -2969,7 +2969,7 @@ bool PlayerObject::createPrototype(bool keepPrototype) { Client * client = owner->getClient(); - if (client != NULL && client->isGod()) + if (client != nullptr && client->isGod()) { Chat::sendSystemMessage(*owner, Unicode::narrowToWide("Crafting time changed due to god mode and crafting_qa objvar."), Unicode::emptyString); prototypeTime = 1; @@ -3022,7 +3022,7 @@ bool PlayerObject::createManufacturingSchematic() return false; CreatureObject * const owner = getCreatureObject(); - if (owner == NULL) + if (owner == nullptr) return false; // @todo: need to filter the name @@ -3034,7 +3034,7 @@ bool PlayerObject::createManufacturingSchematic() return false; } - if (m_draftSchematic.getPointer() == NULL || getCraftingTool() == NetworkId::cms_invalid) + if (m_draftSchematic.getPointer() == nullptr || getCraftingTool() == NetworkId::cms_invalid) { WARNING(true, ("Player %s tried to create manf schematic with invalid schematic or crafting tool.", getNetworkId().getValueString().c_str ())); return false; @@ -3048,19 +3048,19 @@ bool PlayerObject::createManufacturingSchematic() } TangibleObject * const tool = safe_cast(getCraftingTool().getObject()); - if (tool == NULL) + if (tool == nullptr) { WARNING_STRICT_FATAL(true, ("Could not find crafting tool during create manf schematic phase.")); return false; } ManufactureSchematicObject * const manfSchematic = tool->removeCraftingManufactureSchematic(); - if (manfSchematic == NULL) + if (manfSchematic == nullptr) { WARNING_STRICT_FATAL(true, ("Could not find manf schematic during create manf schematic phase.")); return false; } TangibleObject * const prototype = safe_cast(tool->getCraftingPrototype()); - if (prototype == NULL) + if (prototype == nullptr) { WARNING_STRICT_FATAL(true, ("Could not find prototype during create manf schematic phase.")); return false; @@ -3141,14 +3141,14 @@ bool PlayerObject::createManufacturingSchematic() manfSchematic->persist(); ServerObject * const datapad = owner->getDatapad (); - if (datapad == NULL) + if (datapad == nullptr) { DEBUG_WARNING(true, ("Can't find datapad for player %s", getAccountDescription().c_str())); return false; } Container::ContainerErrorCode tmp = Container::CEC_Success; - if (!ContainerInterface::transferItemToVolumeContainer(*datapad, *manfSchematic, NULL, tmp)) + if (!ContainerInterface::transferItemToVolumeContainer(*datapad, *manfSchematic, nullptr, tmp)) { return false; } @@ -3173,7 +3173,7 @@ bool PlayerObject::createManufacturingSchematic() bool PlayerObject::restartCrafting () { CreatureObject * const owner = getCreatureObject(); - if (owner == NULL) + if (owner == nullptr) return false; std::string myId = getNetworkId().getValueString(); @@ -3195,7 +3195,7 @@ bool PlayerObject::restartCrafting () } // verify the tool - if (m_draftSchematic.getPointer() == NULL || getCraftingTool() == NetworkId::cms_invalid) + if (m_draftSchematic.getPointer() == nullptr || getCraftingTool() == NetworkId::cms_invalid) { DEBUG_WARNING(true, ("Player %s tried to start crafting experimentation " "with invalid schematic or crafting tool.", myIdString)); @@ -3208,7 +3208,7 @@ bool PlayerObject::restartCrafting () // reset the manf schematic ManufactureSchematicObject * manfSchematic = tool->getCraftingManufactureSchematic(); - if (manfSchematic == NULL) + if (manfSchematic == nullptr) { DEBUG_WARNING(true, ("Player %s has no manufacturing schematic!", myIdString)); return false; @@ -3262,21 +3262,21 @@ void PlayerObject::stopCrafting (bool normalExit) { CreatureObject * const owner = getCreatureObject(); - if (getCraftingTool().getObject() != NULL) + if (getCraftingTool().getObject() != nullptr) { TangibleObject * tool = dynamic_cast(getCraftingTool().getObject()); - if (tool != NULL) + if (tool != nullptr) { IGNORE_RETURN(tool->stopCraftingSession()); } // tell scripts that the session has ended ScriptParams params; - if (owner != NULL) + if (owner != nullptr) params.addParam(owner->getNetworkId()); else params.addParam(getNetworkId()); - if (getCurrentDraftSchematic() != NULL) + if (getCurrentDraftSchematic() != nullptr) params.addParam(getCurrentDraftSchematic()->getTemplateName()); else params.addParam(""); @@ -3292,7 +3292,7 @@ void PlayerObject::stopCrafting (bool normalExit) m_craftingComponentBioLink = NetworkId::cms_invalid; // tell the player crafting has ended - if (owner != NULL && owner->getController() != NULL) + if (owner != nullptr && owner->getController() != nullptr) { (safe_cast(owner->getController()))->appendMessage( static_cast(CM_craftingSessionEnded), 0.0f, @@ -3348,7 +3348,7 @@ void PlayerObject::requestFriendList() const { CreatureObject const *owner = safe_cast(ContainerInterface::getContainedByObject(*this)); - if (owner != NULL) + if (owner != nullptr) { ChatAvatarId chatAvatarId(Chat::constructChatAvatarId(*owner)); @@ -3410,7 +3410,7 @@ void PlayerObject::requestIgnoreList() const { CreatureObject const *owner = safe_cast(ContainerInterface::getContainedByObject(*this)); - if (owner != NULL) + if (owner != nullptr) { ChatAvatarId chatAvatarId(Chat::constructChatAvatarId(*owner)); @@ -3767,7 +3767,7 @@ void PlayerObject::setTitle(std::string const &title) m_skillTitle = title; } } - else if (title.empty() || (title == "citizenship") || (SkillManager::getInstance().getSkill(title) != NULL) || (CollectionsDataTable::isASlotTitle(title) != NULL) || (CollectionsDataTable::isACollectionTitle(title) != NULL) || (CollectionsDataTable::isAPageTitle(title) != NULL) || (GuildRankDataTable::isARankTitle(title) != NULL) || (CitizenRankDataTable::isARankTitle(title) != NULL)) + else if (title.empty() || (title == "citizenship") || (SkillManager::getInstance().getSkill(title) != nullptr) || (CollectionsDataTable::isASlotTitle(title) != nullptr) || (CollectionsDataTable::isACollectionTitle(title) != nullptr) || (CollectionsDataTable::isAPageTitle(title) != nullptr) || (GuildRankDataTable::isARankTitle(title) != nullptr) || (CitizenRankDataTable::isARankTitle(title) != nullptr)) { if (title != m_skillTitle.get()) m_skillTitle = title; @@ -4075,7 +4075,7 @@ void PlayerObject::handleCMessageTo(const MessageToPayload &message) } { - BiographyManager::requestBiography(owner->getNetworkId(), NULL); + BiographyManager::requestBiography(owner->getNetworkId(), nullptr); } bool needsTitleCheck = false; @@ -4139,7 +4139,7 @@ void PlayerObject::handleCMessageTo(const MessageToPayload &message) // also check to see if the citizen rank has changed, and if so, update the citizen rank information { std::vector const & cityIds = CityInterface::getCitizenOfCityId(owner->getNetworkId()); - CitizenInfo const * const citizenInfo = (!cityIds.empty() ? CityInterface::getCitizenInfo(cityIds.front(), owner->getNetworkId()) : NULL); + CitizenInfo const * const citizenInfo = (!cityIds.empty() ? CityInterface::getCitizenInfo(cityIds.front(), owner->getNetworkId()) : nullptr); if (!citizenInfo) { // not a citizen, so make sure the citizen rank is empty @@ -4265,12 +4265,12 @@ void PlayerObject::endBaselines() const CreatureObject * owner = safe_cast(ContainerInterface::getContainedByObject(*this)); - if (owner != NULL) + if (owner != nullptr) { SharedCreatureObjectTemplate::Species const species = owner->getSpecies(); setSpokenLanguage(GameLanguageManager::getStartingLanguage(species)); -// if (owner->isAuthoritative() && ServerUniverse::getInstance().getXpManager() != NULL) +// if (owner->isAuthoritative() && ServerUniverse::getInstance().getXpManager() != nullptr) // { // // get any xp we earned while offline // ServerUniverse::getInstance().getXpManager()->requestXp(*this); @@ -4326,7 +4326,7 @@ void PlayerObject::endBaselines() } else { - m_chatSpamTimeEndInterval = static_cast(::time(NULL)) + (ConfigServerGame::getChatSpamLimiterIntervalMinutes() * 60); + m_chatSpamTimeEndInterval = static_cast(::time(nullptr)) + (ConfigServerGame::getChatSpamLimiterIntervalMinutes() * 60); m_chatSpamSpatialNumCharacters = 0; m_chatSpamNonSpatialNumCharacters = 0; m_chatSpamNextTimeToSyncWithChatServer = 0; @@ -4362,7 +4362,7 @@ void PlayerObject::endBaselines() { m_squelchedById = tempNetworkId; m_squelchedByName = tempString; - m_squelchExpireTime = static_cast(::time(NULL)) + (temp - gameTimeNow); + m_squelchExpireTime = static_cast(::time(nullptr)) + (temp - gameTimeNow); } } } @@ -4373,7 +4373,7 @@ void PlayerObject::endBaselines() DynamicVariableList::NestedList const gcwContribution(getObjVars(), "gcwContributionTracking"); if (!gcwContribution.empty()) { - int const timeExpired = static_cast(::time(NULL)) - (60 * 60 * 24 * 30); // 30 days + int const timeExpired = static_cast(::time(nullptr)) - (60 * 60 * 24 * 30); // 30 days std::list gcwContributionToRemove; int timeLastContributed; for (DynamicVariableList::NestedList::const_iterator i = gcwContribution.begin(); i != gcwContribution.end(); ++i) @@ -4724,12 +4724,12 @@ std::string PlayerObject::getAccountDescription() const { const ServerObject * owner = safe_cast( ContainerInterface::getContainedByObject(*this)); - if (owner == NULL) + if (owner == nullptr) return "UNKNOWN"; bool isGod = false; bool isSecure = false; - Client * client = NULL; + Client * client = nullptr; if (owner && owner->getClient()) { client = owner->getClient(); @@ -4768,7 +4768,7 @@ std::string PlayerObject::getAccountDescription() const void PlayerObject::logChat(int const logIndex) { - if (m_chatLog != NULL) + if (m_chatLog != nullptr) { time_t const logTime = Os::getRealSystemTime(); @@ -5276,10 +5276,10 @@ void PlayerObject::checkTheater(const Vector & pos, const std::string & scene, IntangibleObject * theater = IntangibleObject::spawnTheater(m_theaterDatatable.get(), m_theaterPosition.get(), m_theaterScript.get(), static_cast(m_theaterLocationType.get())); - if (theater != NULL) + if (theater != nullptr) { const CreatureObject * owner = getCreatureObject(); - if (owner != NULL) + if (owner != nullptr) theater->setPlayer(*owner); theater->setTheaterCreator(m_theaterCreator.get()); if (!theater->setTheaterName(m_theaterName.get())) @@ -5287,10 +5287,10 @@ void PlayerObject::checkTheater(const Vector & pos, const std::string & scene, WARNING(true, ("PlayerObject::checkTheater could not create " "theater with name %s", m_theaterName.get().c_str())); theater->permanentlyDestroy(DeleteReasons::SetupFailed); - theater = NULL; + theater = nullptr; } } - if (theater == NULL) + if (theater == nullptr) { CreatureObject * creatureObject = getCreatureObject(); if (creatureObject) @@ -5357,7 +5357,7 @@ bool PlayerObject::setTheater(const std::string & datatable, const Vector & posi return false; } - if (ServerUniverse::getInstance().getPlanetByName(scene) == NULL) + if (ServerUniverse::getInstance().getPlanetByName(scene) == nullptr) { WARNING(true, ("PlayerObject::setTheater called with invalid scene %s", scene.c_str())); @@ -6342,7 +6342,7 @@ unsigned long PlayerObject::getSessionPlayTimeDuration() const time_t const sessionStartPlayTime = static_cast(m_sessionStartPlayTime.get()); if (sessionStartPlayTime > 0) { - time_t const now = ::time(NULL); + time_t const now = ::time(nullptr); if (now > sessionStartPlayTime) return static_cast(now - sessionStartPlayTime); } @@ -6359,7 +6359,7 @@ unsigned long PlayerObject::getSessionActivePlayTimeDuration() const time_t const sessionLastActiveTime = static_cast(m_sessionLastActiveTime.get()); if (sessionLastActiveTime > 0) { - time_t const now = ::time(NULL); + time_t const now = ::time(nullptr); if (now > sessionLastActiveTime) activePlayTimeDuration += static_cast(now - sessionLastActiveTime); } @@ -6393,7 +6393,7 @@ void PlayerObject::setSessionPlayTimeInfo(int32 sessionStartPlayTime, int32 sess ServerUniverse::setConnectedCharacterLfgData(owner->getNetworkId(), lfgCharacterData); - BiographyManager::requestBiography(owner->getNetworkId(), NULL); + BiographyManager::requestBiography(owner->getNetworkId(), nullptr); // check/set "account age" title checkAndSetAccountAgeTitle(*this); @@ -7040,7 +7040,7 @@ void PlayerObject::modifyNextGcwRatingCalcTime(int const weekCount) return; static int32 const max = std::numeric_limits::max(); - int32 const now = static_cast(::time(NULL)); + int32 const now = static_cast(::time(nullptr)); // m_nextGcwRatingCalcTime should always be >= 0 int32 const currentValue = std::max(static_cast(0), m_nextGcwRatingCalcTime.get()); @@ -7176,7 +7176,7 @@ void PlayerObject::setNextGcwRatingCalcTime(bool const alwaysSendMessageToForRec return; bool needToSendMessageTo = alwaysSendMessageToForRecalc; - int32 const now = static_cast(::time(NULL)); + int32 const now = static_cast(::time(nullptr)); // if the player needs a rating recalculation, // make sure that m_nextGcwRatingCalcTime is set so that the @@ -7232,7 +7232,7 @@ void PlayerObject::handleRecalculateGcwRating() return; // is it time to recalculate? - int32 const now = static_cast(::time(NULL)); + int32 const now = static_cast(::time(nullptr)); if ((m_nextGcwRatingCalcTime.get() > 0) && (m_nextGcwRatingCalcTime.get() <= now)) { // is recalculation required? @@ -7367,7 +7367,7 @@ void PlayerObject::sendRecalculateGcwRatingMessageTo(int delay) // send new messageTo int const adjustedDelay = std::max(5, delay); MessageToQueue::getInstance().sendMessageToC(getNetworkId(), "C++RecalculateGcwRating", "", adjustedDelay, false); - m_gcwRatingActualCalcTime = static_cast(::time(NULL) + adjustedDelay); + m_gcwRatingActualCalcTime = static_cast(::time(nullptr) + adjustedDelay); } // ---------------------------------------------------------------------- @@ -7728,7 +7728,7 @@ bool PlayerObject::getCollectionSlotValue(CollectionsDataTable::CollectionInfoSl // ---------------------------------------------------------------------- -bool PlayerObject::hasCompletedCollectionSlotPrereq(std::string const & slotName, std::vector * collectionInfo /*= NULL*/) const +bool PlayerObject::hasCompletedCollectionSlotPrereq(std::string const & slotName, std::vector * collectionInfo /*= nullptr*/) const { CollectionsDataTable::CollectionInfoSlot const * slotInfo = CollectionsDataTable::getSlotByName(slotName); if (!slotInfo) @@ -7742,7 +7742,7 @@ bool PlayerObject::hasCompletedCollectionSlotPrereq(std::string const & slotName // ---------------------------------------------------------------------- -bool PlayerObject::hasCompletedCollectionSlotPrereq(CollectionsDataTable::CollectionInfoSlot const & slotInfo, std::vector * collectionInfo /*= NULL*/) const +bool PlayerObject::hasCompletedCollectionSlotPrereq(CollectionsDataTable::CollectionInfoSlot const & slotInfo, std::vector * collectionInfo /*= nullptr*/) const { if (collectionInfo) collectionInfo->clear(); @@ -7862,7 +7862,7 @@ bool PlayerObject::hasCompletedCollectionBook(std::string const & bookName) cons // ---------------------------------------------------------------------- -int PlayerObject::getCompletedCollectionSlotCountInCollection(std::string const & collectionName, stdvector::fwd * collectionInfo /*= NULL*/) const +int PlayerObject::getCompletedCollectionSlotCountInCollection(std::string const & collectionName, stdvector::fwd * collectionInfo /*= nullptr*/) const { if (collectionInfo) collectionInfo->clear(); @@ -7885,7 +7885,7 @@ int PlayerObject::getCompletedCollectionSlotCountInCollection(std::string const // ---------------------------------------------------------------------- -int PlayerObject::getCompletedCollectionSlotCountInPage(std::string const & pageName, std::vector * collectionInfo /*= NULL*/) const +int PlayerObject::getCompletedCollectionSlotCountInPage(std::string const & pageName, std::vector * collectionInfo /*= nullptr*/) const { if (collectionInfo) collectionInfo->clear(); @@ -7908,7 +7908,7 @@ int PlayerObject::getCompletedCollectionSlotCountInPage(std::string const & page // ---------------------------------------------------------------------- -int PlayerObject::getCompletedCollectionCountInPage(std::string const & pageName, std::vector * collectionInfo /*= NULL*/) const +int PlayerObject::getCompletedCollectionCountInPage(std::string const & pageName, std::vector * collectionInfo /*= nullptr*/) const { if (collectionInfo) collectionInfo->clear(); @@ -7931,7 +7931,7 @@ int PlayerObject::getCompletedCollectionCountInPage(std::string const & pageName // ---------------------------------------------------------------------- -int PlayerObject::getCompletedCollectionSlotCountInBook(std::string const & bookName, std::vector * collectionInfo /*= NULL*/) const +int PlayerObject::getCompletedCollectionSlotCountInBook(std::string const & bookName, std::vector * collectionInfo /*= nullptr*/) const { if (collectionInfo) collectionInfo->clear(); @@ -7954,7 +7954,7 @@ int PlayerObject::getCompletedCollectionSlotCountInBook(std::string const & book // ---------------------------------------------------------------------- -int PlayerObject::getCompletedCollectionCountInBook(std::string const & bookName, std::vector * collectionInfo /*= NULL*/) const +int PlayerObject::getCompletedCollectionCountInBook(std::string const & bookName, std::vector * collectionInfo /*= nullptr*/) const { if (collectionInfo) collectionInfo->clear(); @@ -7977,7 +7977,7 @@ int PlayerObject::getCompletedCollectionCountInBook(std::string const & bookName // ---------------------------------------------------------------------- -int PlayerObject::getCompletedCollectionPageCountInBook(std::string const & bookName, std::vector * collectionInfo /*= NULL*/) const +int PlayerObject::getCompletedCollectionPageCountInBook(std::string const & bookName, std::vector * collectionInfo /*= nullptr*/) const { if (collectionInfo) collectionInfo->clear(); @@ -8000,7 +8000,7 @@ int PlayerObject::getCompletedCollectionPageCountInBook(std::string const & book // ---------------------------------------------------------------------- -int PlayerObject::getCompletedCollectionBookCount(std::vector * collectionInfo /*= NULL*/) const +int PlayerObject::getCompletedCollectionBookCount(std::vector * collectionInfo /*= nullptr*/) const { if (collectionInfo) collectionInfo->clear(); @@ -8103,7 +8103,7 @@ void PlayerObject::updateChatSpamSpatialNumCharacters(NetworkId const & characte if (!isAuthoritative()) return; - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); bool syncChatServer = false; // new interval, reset @@ -8125,7 +8125,7 @@ void PlayerObject::updateChatSpamSpatialNumCharacters(NetworkId const & characte { time_t timeUnsquelch = static_cast(getSecondsUntilUnsquelched()); if (timeUnsquelch > 0) - timeUnsquelch += ::time(NULL); + timeUnsquelch += ::time(nullptr); GenericValueTypeMessage, int>, std::pair > > chatStatistics("ChatStatisticsGS", std::make_pair(std::make_pair(std::make_pair(character, static_cast(timeUnsquelch)), m_chatSpamTimeEndInterval.get()), std::make_pair(m_chatSpamSpatialNumCharacters.get(), m_chatSpamNonSpatialNumCharacters.get()))); Chat::sendToChatServer(chatStatistics); @@ -8140,7 +8140,7 @@ void PlayerObject::handleChatStatisticsFromChatServer(NetworkId const & characte if (!isAuthoritative()) return; - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); bool syncChatServer = false; // new interval, reset @@ -8168,7 +8168,7 @@ void PlayerObject::handleChatStatisticsFromChatServer(NetworkId const & characte { time_t timeUnsquelch = static_cast(getSecondsUntilUnsquelched()); if (timeUnsquelch > 0) - timeUnsquelch += ::time(NULL); + timeUnsquelch += ::time(nullptr); GenericValueTypeMessage, int>, std::pair > > chatStatistics("ChatStatisticsGS", std::make_pair(std::make_pair(std::make_pair(character, static_cast(timeUnsquelch)), m_chatSpamTimeEndInterval.get()), std::make_pair(m_chatSpamSpatialNumCharacters.get(), m_chatSpamNonSpatialNumCharacters.get()))); Chat::sendToChatServer(chatStatistics); @@ -8274,7 +8274,7 @@ void PlayerObject::updateGcwDefenderRegionInfo() cityGcwDefenderRegion = gcwDefenderRegion; int const timeJoinedGcwDefenderRegion = cityInfo.getTimeJoinedGcwDefenderRegion(); - timeQualifyForBonus = static_cast(::time(NULL)) - (ConfigServerGame::getGcwDaysRequiredForGcwRegionDefenderBonus() * 86400); + timeQualifyForBonus = static_cast(::time(nullptr)) - (ConfigServerGame::getGcwDaysRequiredForGcwRegionDefenderBonus() * 86400); if (!PvpData::isNeutralFactionId(cityFaction) && (cityFaction == owner->getPvpFaction()) && (timeJoinedGcwDefenderRegion < timeQualifyForBonus)) { cityGcwDefenderRegionHasBonus = true; @@ -8316,7 +8316,7 @@ void PlayerObject::updateGcwDefenderRegionInfo() int const timeJoinedGcwDefenderRegion = GuildInterface::getTimeJoinedGuildCurrentGcwDefenderRegion(*gi); if (timeQualifyForBonus < 0) - timeQualifyForBonus = static_cast(::time(NULL)) - (ConfigServerGame::getGcwDaysRequiredForGcwRegionDefenderBonus() * 86400); + timeQualifyForBonus = static_cast(::time(nullptr)) - (ConfigServerGame::getGcwDaysRequiredForGcwRegionDefenderBonus() * 86400); if (!PvpData::isNeutralFactionId(guildFaction) && (guildFaction == owner->getPvpFaction()) && (timeJoinedGcwDefenderRegion < timeQualifyForBonus)) { @@ -8417,7 +8417,7 @@ void PlayerObject::squelch(NetworkId const & squelchedById, std::string const & } else { - m_squelchExpireTime = static_cast(::time(NULL)) + squelchDurationSeconds; + m_squelchExpireTime = static_cast(::time(nullptr)) + squelchDurationSeconds; // persist squelch info setObjVarItem(OBJVAR_SQUELCH_EXPIRE, static_cast(ServerClock::getInstance().getGameTimeSeconds()) + squelchDurationSeconds); @@ -8466,7 +8466,7 @@ void PlayerObject::unsquelch() { CreatureObject * const owner = getCreatureObject(); if (owner) - owner->sendControllerMessageToAuthServer(CM_unsquelch, NULL); + owner->sendControllerMessageToAuthServer(CM_unsquelch, nullptr); } } @@ -8482,7 +8482,7 @@ int PlayerObject::getSecondsUntilUnsquelched() if (m_squelchExpireTime.get() < 0) // squelched indefinitely return -1; - int32 const timeNow = static_cast(::time(NULL)); + int32 const timeNow = static_cast(::time(nullptr)); if (timeNow < m_squelchExpireTime.get()) // still in squelch period return (m_squelchExpireTime.get() - timeNow); @@ -8570,7 +8570,7 @@ void PlayerObject::setAccountNumLotsOverLimitSpam() { m_accountNumLotsOverLimitSpam = m_accountNumLots.get() - owner->getMaxNumberOfLots(); - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); int violationTime = 0; if (!owner->getObjVars().getItem("lotOverlimit.violation_time", violationTime)) { @@ -9010,7 +9010,7 @@ void PlayerObjectNamespace::grantGcwFactionalPresenceScore(std::string const & g // // for space, give bonus if the player's citizenship city is on the // corresponding ground planet and is the same faction as the player - CityInfo const * ci = NULL; + CityInfo const * ci = nullptr; if (!ServerWorld::isSpaceScene()) { Vector const creaturePosition = co.findPosition_w(); @@ -9132,7 +9132,7 @@ void PlayerObjectNamespace::grantGcwFactionalPresenceScore(std::string const & g playerCitySpaceZone = std::string("space_") + playerCityPlanet; if (playerCitySpaceZone != ServerWorld::getSceneId()) - ci = NULL; + ci = nullptr; } } @@ -9155,7 +9155,7 @@ void PlayerObjectNamespace::grantGcwFactionalPresenceScore(std::string const & g bonus += (cityRank * ConfigServerGame::getGcwFactionalPresenceAlignedCityRankBonusPct()); if (ci->getCreationTime() > 0) - bonus += std::max(0, (static_cast(::time(NULL)) - std::max(1041408000, ci->getCreationTime())) / 31536000 * ConfigServerGame::getGcwFactionalPresenceAlignedCityAgeBonusPct()); + bonus += std::max(0, (static_cast(::time(nullptr)) - std::max(1041408000, ci->getCreationTime())) / 31536000 * ConfigServerGame::getGcwFactionalPresenceAlignedCityAgeBonusPct()); } } diff --git a/engine/server/library/serverGame/src/shared/object/PlayerObject.h b/engine/server/library/serverGame/src/shared/object/PlayerObject.h index 2298e6bd..da5386d8 100755 --- a/engine/server/library/serverGame/src/shared/object/PlayerObject.h +++ b/engine/server/library/serverGame/src/shared/object/PlayerObject.h @@ -361,8 +361,8 @@ public: bool getCollectionSlotValue(std::string const & slotName, unsigned long & value) const; bool getCollectionSlotValue(CollectionsDataTable::CollectionInfoSlot const & slotInfo, unsigned long & value) const; - bool hasCompletedCollectionSlotPrereq(std::string const & slotName, stdvector::fwd * collectionInfo = NULL) const; - bool hasCompletedCollectionSlotPrereq(CollectionsDataTable::CollectionInfoSlot const & slotInfo, stdvector::fwd * collectionInfo = NULL) const; + bool hasCompletedCollectionSlotPrereq(std::string const & slotName, stdvector::fwd * collectionInfo = nullptr) const; + bool hasCompletedCollectionSlotPrereq(CollectionsDataTable::CollectionInfoSlot const & slotInfo, stdvector::fwd * collectionInfo = nullptr) const; bool hasCompletedCollectionSlot(std::string const & slotName) const; bool hasCompletedCollectionSlot(CollectionsDataTable::CollectionInfoSlot const & slotInfo) const; @@ -374,15 +374,15 @@ public: bool hasCompletedCollectionBook(std::string const & bookName) const; - int getCompletedCollectionSlotCountInCollection(std::string const & collectionName, stdvector::fwd * collectionInfo = NULL) const; + int getCompletedCollectionSlotCountInCollection(std::string const & collectionName, stdvector::fwd * collectionInfo = nullptr) const; - int getCompletedCollectionSlotCountInPage(std::string const & pageName, stdvector::fwd * collectionInfo = NULL) const; - int getCompletedCollectionCountInPage(std::string const & pageName, stdvector::fwd * collectionInfo = NULL) const; + int getCompletedCollectionSlotCountInPage(std::string const & pageName, stdvector::fwd * collectionInfo = nullptr) const; + int getCompletedCollectionCountInPage(std::string const & pageName, stdvector::fwd * collectionInfo = nullptr) const; - int getCompletedCollectionSlotCountInBook(std::string const & bookName, stdvector::fwd * collectionInfo = NULL) const; - int getCompletedCollectionCountInBook(std::string const & bookName, stdvector::fwd * collectionInfo = NULL) const; - int getCompletedCollectionPageCountInBook(std::string const & bookName, stdvector::fwd * collectionInfo = NULL) const; - int getCompletedCollectionBookCount(stdvector::fwd * collectionInfo = NULL) const; + int getCompletedCollectionSlotCountInBook(std::string const & bookName, stdvector::fwd * collectionInfo = nullptr) const; + int getCompletedCollectionCountInBook(std::string const & bookName, stdvector::fwd * collectionInfo = nullptr) const; + int getCompletedCollectionPageCountInBook(std::string const & bookName, stdvector::fwd * collectionInfo = nullptr) const; + int getCompletedCollectionBookCount(stdvector::fwd * collectionInfo = nullptr) const; void migrateLegacyBadgesToCollection(stdvector::fwd const & badges); diff --git a/engine/server/library/serverGame/src/shared/object/PlayerQuestObject.cpp b/engine/server/library/serverGame/src/shared/object/PlayerQuestObject.cpp index 54e63df9..dca33824 100755 --- a/engine/server/library/serverGame/src/shared/object/PlayerQuestObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/PlayerQuestObject.cpp @@ -27,7 +27,7 @@ //----------------------------------------------------------------------- -const SharedObjectTemplate * PlayerQuestObject::m_defaultSharedTemplate = NULL; +const SharedObjectTemplate * PlayerQuestObject::m_defaultSharedTemplate = nullptr; namespace PlayerQuestObjectNamespace { @@ -156,7 +156,7 @@ void PlayerQuestObject::removeDefaultTemplate() if(m_defaultSharedTemplate) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } diff --git a/engine/server/library/serverGame/src/shared/object/ResourceContainerObject.cpp b/engine/server/library/serverGame/src/shared/object/ResourceContainerObject.cpp index 9b47248b..398adf07 100755 --- a/engine/server/library/serverGame/src/shared/object/ResourceContainerObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/ResourceContainerObject.cpp @@ -27,7 +27,7 @@ // ====================================================================== -const SharedObjectTemplate * ResourceContainerObject::m_defaultSharedTemplate = NULL; +const SharedObjectTemplate * ResourceContainerObject::m_defaultSharedTemplate = nullptr; namespace ResourceContainerObjectNamespace { @@ -66,11 +66,11 @@ const SharedObjectTemplate * ResourceContainerObject::getDefaultSharedTemplate(v { static const ConstCharCrcLowerString templateName("object/resource_container/base/shared_resource_container_default.iff"); - if (m_defaultSharedTemplate == NULL) + if (m_defaultSharedTemplate == nullptr) { m_defaultSharedTemplate = safe_cast(ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != NULL) + WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create default shared object template %s", templateName.getString())); + if (m_defaultSharedTemplate != nullptr) ExitChain::add (removeDefaultTemplate, "ResourceContainerObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -83,10 +83,10 @@ const SharedObjectTemplate * ResourceContainerObject::getDefaultSharedTemplate(v */ void ResourceContainerObject::removeDefaultTemplate(void) { - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } // ResourceContainerObject::removeDefaultTemplate @@ -398,7 +398,7 @@ bool ResourceContainerObject::transferTo(ResourceContainerObject &destination, i * @param destContainer The container into which the new ResourceContainer should be placed, or cms_Invalid if no container * @param arrangementId -1 If destContainer is not slotted, otherwise the ID of the arrangement to use * @param newLocation The coordinates at which to place the new ResourceContainer. (Ignored if it is going into a non-positional container.) - * @param actor The player making the split, or NULL + * @param actor The player making the split, or nullptr */ bool ResourceContainerObject::splitContainer(int amount, const CachedNetworkId &destContainer, int arrangementId, const Vector &newLocation, ServerObject *actor) @@ -407,7 +407,7 @@ bool ResourceContainerObject::splitContainer(int amount, const CachedNetworkId & bool result = false; - ResourceContainerObject *newCrate = NULL; + ResourceContainerObject *newCrate = nullptr; if (destContainer == CachedNetworkId::cms_cachedInvalid) { @@ -420,7 +420,7 @@ bool ResourceContainerObject::splitContainer(int amount, const CachedNetworkId & { // create in volume container ServerObject * destObject = safe_cast(destContainer.getObject()); - if (destObject == NULL) + if (destObject == nullptr) return false; newCrate = dynamic_cast(ServerWorld::createNewObject(getObjectTemplateName(), *destObject, isPersisted())); } @@ -428,10 +428,10 @@ bool ResourceContainerObject::splitContainer(int amount, const CachedNetworkId & { // create in slotted container ServerObject * destObject = safe_cast(destContainer.getObject()); - if (destObject == NULL) + if (destObject == nullptr) return false; const SlottedContainmentProperty* containmentProperty = ContainerInterface::getSlottedContainmentProperty(*destObject); - if (containmentProperty == NULL) + if (containmentProperty == nullptr) return false; const SlottedContainmentProperty::SlotArrangement & slots = containmentProperty->getSlotArrangement(arrangementId); if (slots.empty()) diff --git a/engine/server/library/serverGame/src/shared/object/ResourcePoolObject.cpp b/engine/server/library/serverGame/src/shared/object/ResourcePoolObject.cpp index c5efc41b..82e2a710 100755 --- a/engine/server/library/serverGame/src/shared/object/ResourcePoolObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/ResourcePoolObject.cpp @@ -30,7 +30,7 @@ ResourcePoolObject::ResourcePoolObject(ResourceTypeObject const & resourceType, m_fractalData(resourceType.getFractalData()), m_fractalSeed(fractalSeed), m_depletedTimestamp(resourceType.getDepletedTimestamp()), - m_efficiencyMap(NULL) + m_efficiencyMap(nullptr) { } @@ -39,7 +39,7 @@ ResourcePoolObject::ResourcePoolObject(ResourceTypeObject const & resourceType, ResourcePoolObject::~ResourcePoolObject() { delete m_efficiencyMap; - m_efficiencyMap=NULL; + m_efficiencyMap=nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/object/ResourceTypeObject.cpp b/engine/server/library/serverGame/src/shared/object/ResourceTypeObject.cpp index 536c4e4f..d0b9123a 100755 --- a/engine/server/library/serverGame/src/shared/object/ResourceTypeObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/ResourceTypeObject.cpp @@ -146,7 +146,7 @@ void ResourceTypeObject::setName(const std::string &newName) ResourcePoolObject *ResourceTypeObject::getPoolForPlanet(PlanetObject const &planetObject) const { if (isRecycled()) - return NULL; + return nullptr; std::map::const_iterator i=m_pools.find(planetObject.getNetworkId()); if (i==m_pools.end()) @@ -167,7 +167,7 @@ ResourcePoolObject *ResourceTypeObject::getPoolForPlanet(PlanetObject const &pla m_pools[planetObject.getNetworkId()]=obj; return obj; } - return NULL; // no pool for this planet + return nullptr; // no pool for this planet } } else @@ -377,7 +377,7 @@ ResourceTypeObject const * ResourceTypeObject::getRecycledVersion() const return result; } else - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -437,7 +437,7 @@ NetworkId ResourceTypeObject::addImportedResourceType(std::string const & resour static Unicode::String const attributeDelimiters(Unicode::narrowToWide(" ")); Unicode::UnicodeStringVector tokens; static size_t const resourceAttributeIndex = 5; - if ((Unicode::tokenize(Unicode::narrowToWide(resourceData), tokens, &delimiters, NULL)) && (tokens.size() > resourceAttributeIndex)) + if ((Unicode::tokenize(Unicode::narrowToWide(resourceData), tokens, &delimiters, nullptr)) && (tokens.size() > resourceAttributeIndex)) { AddResourceTypeMessageNamespace::ResourceTypeData rtd; rtd.m_depletedTimestamp = 1; @@ -453,7 +453,7 @@ NetworkId ResourceTypeObject::addImportedResourceType(std::string const & resour for (size_t i = resourceAttributeIndex; i < tokens.size(); ++i) { attributeTokens.clear(); - if ((Unicode::tokenize(tokens[i], attributeTokens, &attributeDelimiters, NULL)) && (attributeTokens.size() == 2)) + if ((Unicode::tokenize(tokens[i], attributeTokens, &attributeDelimiters, nullptr)) && (attributeTokens.size() == 2)) { rtd.m_attributes.push_back(std::make_pair(Unicode::wideToNarrow(attributeTokens[0]), ::atoi(Unicode::wideToNarrow(attributeTokens[1]).c_str()))); } diff --git a/engine/server/library/serverGame/src/shared/object/ServerObject.cpp b/engine/server/library/serverGame/src/shared/object/ServerObject.cpp index d2598408..e96fc5b1 100755 --- a/engine/server/library/serverGame/src/shared/object/ServerObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/ServerObject.cpp @@ -507,7 +507,7 @@ using namespace ServerObjectNamespace; // ====================================================================== -const SharedObjectTemplate * ServerObject::m_defaultSharedTemplate = NULL; +const SharedObjectTemplate * ServerObject::m_defaultSharedTemplate = nullptr; float ServerObject::ms_buildingUpdateRadiusMultiplier = 0; // ====================================================================== @@ -691,7 +691,7 @@ void ServerObject::ObserversCountCallback::modified(ServerObject &target, int ol ServerObject::ServerObject(const ServerObjectTemplate* newTemplate, const ObjectNotification ¬ification, bool const hyperspaceOnCreate) : Object (newTemplate, NetworkId::cms_invalid), m_oldPosition (), -m_sharedTemplate (NULL), +m_sharedTemplate (nullptr), m_client (0), m_observers (), m_localFlags (0), @@ -732,7 +732,7 @@ m_serverPackage (), m_serverPackage_np (), m_sharedPackage (), m_sharedPackage_np (), -m_networkUpdateFar (NULL), +m_networkUpdateFar (nullptr), m_triggerVolumes (), m_attributesAttained (), m_attributesInterested (), @@ -765,13 +765,13 @@ m_loadCTSPackedHouses(false) const std::string & sharedTemplateName = newTemplate->getSharedTemplate(); m_sharedTemplate = dynamic_cast(ObjectTemplateList::fetch(sharedTemplateName)); - if (m_sharedTemplate == NULL) + if (m_sharedTemplate == nullptr) { WARNING_STRICT_FATAL(!sharedTemplateName.empty(), ("Template %s has an invalid shared template %s. We will use the default shared template for now.", newTemplate->getName(), sharedTemplateName.c_str())); } - if (getSharedTemplate() != NULL) + if (getSharedTemplate() != nullptr) { m_nameStringId = getSharedTemplate()->getObjectName(); m_descriptionStringId = getSharedTemplate()->getDetailedDescription(); @@ -779,7 +779,7 @@ m_loadCTSPackedHouses(false) m_scriptObject->setOwner(this); - ContainedByProperty *containedBy = new ContainedByProperty(*this, NULL); + ContainedByProperty *containedBy = new ContainedByProperty(*this, nullptr); addProperty(*containedBy); //-- create the SlottedContainment property @@ -787,7 +787,7 @@ m_loadCTSPackedHouses(false) addProperty(*slottedProperty); //-- get ArrangementDescriptor if specified - if (getSharedTemplate() != NULL) + if (getSharedTemplate() != nullptr) { const ArrangementDescriptor *const arrangementDescriptor = getSharedTemplate()->getArrangementDescriptor(); if (arrangementDescriptor) @@ -801,7 +801,7 @@ m_loadCTSPackedHouses(false) } //set up containers on this object if it has any - if (getSharedTemplate() != NULL) + if (getSharedTemplate() != nullptr) { SharedObjectTemplate::ContainerType const containerType = getSharedTemplate()->getContainerType(); @@ -883,7 +883,7 @@ m_loadCTSPackedHouses(false) // add the portal property if one is requested - if (getSharedTemplate() != NULL) + if (getSharedTemplate() != nullptr) { const std::string &portalLayoutFileName = getSharedTemplate()->getPortalLayoutFilename(); if (!portalLayoutFileName.empty()) @@ -952,10 +952,10 @@ ServerObject::~ServerObject() destroyTriggerVolumes(); } - if (m_sharedTemplate != NULL) + if (m_sharedTemplate != nullptr) { m_sharedTemplate->releaseReference(); - m_sharedTemplate = NULL; + m_sharedTemplate = nullptr; } if (getClient()) @@ -982,7 +982,7 @@ ServerObject::~ServerObject() PROFILER_AUTO_BLOCK_DEFINE("ServerObject::~ServerObject delete script object"); delete m_scriptObject; } - m_scriptObject = NULL; + m_scriptObject = nullptr; gs_objectCount--; @@ -1038,14 +1038,14 @@ ServerObject * ServerObject::getServerObject(NetworkId const & networkId) ServerObject * ServerObject::asServerObject(Object * const object) { - return (object != NULL) ? object->asServerObject() : NULL; + return (object != nullptr) ? object->asServerObject() : nullptr; } //----------------------------------------------------------------------- ServerObject const * ServerObject::asServerObject(Object const * const object) { - return (object != NULL) ? object->asServerObject() : NULL; + return (object != nullptr) ? object->asServerObject() : nullptr; } //----------------------------------------------------------------------- @@ -1255,12 +1255,12 @@ const SharedObjectTemplate * ServerObject::getDefaultSharedTemplate(void) const { static const ConstCharCrcLowerString templateName("object/object/base/shared_object_default.iff"); - if (m_defaultSharedTemplate == NULL) + if (m_defaultSharedTemplate == nullptr) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != NULL) + WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create default shared object template %s", templateName.getString())); + if (m_defaultSharedTemplate != nullptr) ExitChain::add (removeDefaultTemplate, "ServerObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -1280,10 +1280,10 @@ const unsigned long ServerObject::getObjectCount() */ void ServerObject::removeDefaultTemplate(void) { - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } // ServerObject::removeDefaultTemplate @@ -1570,7 +1570,7 @@ bool ServerObject::isInBazaarOrVendor() const { bool inBazaarOrVendor = false; const ServerObject *parent = safe_cast(ContainerInterface::getFirstParentInWorld(*this)); - const ServerObject *grandParent = NULL; + const ServerObject *grandParent = nullptr; if( parent ) { grandParent = safe_cast(ContainerInterface::getFirstParentInWorld(*parent)); @@ -1821,7 +1821,7 @@ void ServerObject::addTriggerVolume(TriggerVolume * t) { if (!t) { - WARNING_STRICT_FATAL(true, ("Cannot add null volume")); + WARNING_STRICT_FATAL(true, ("Cannot add nullptr volume")); return; } m_triggerVolumes.insert(std::make_pair(t->getName(), t)); @@ -1917,7 +1917,7 @@ void ServerObject::serverObjectEndBaselines(bool fromDatabase) onLoadedFromDatabase(); updateWorldSphere(); - if (getScriptObject() != NULL) + if (getScriptObject() != nullptr) { endBaselinesInitializeScript(*this, true); // If the object was created authoritative, trigger if needed @@ -2059,7 +2059,7 @@ void ServerObject::endBaselines() // and that buildout id got changed to some other object, like a rock if (isPlayerControlled() && isAuthoritative() && (immediateContainer->getNetworkId().getValue() < static_cast(0))) { - if (immediateContainer->asCellObject() != NULL || ContainerInterface::getCell(*immediateContainer) != NULL) + if (immediateContainer->asCellObject() != nullptr || ContainerInterface::getCell(*immediateContainer) != nullptr) ObserveTracker::onObjectContainerChanged(*this); else { @@ -2149,7 +2149,7 @@ bool ServerObject::handlePlayerInInteriorSetup(ContainedByProperty *containedBy) containedBy->setContainedBy(NetworkId::cms_invalid); fixOk = portal->fixupObject(*this, saveTransform); - containerHandleUpdateProxies(NULL, safe_cast(ContainerInterface::getContainedByObject(*this))); + containerHandleUpdateProxies(nullptr, safe_cast(ContainerInterface::getContainedByObject(*this))); if (building) building->gainedPlayer(*this); @@ -2306,8 +2306,8 @@ const int ServerObject::getCacheVersion() const const char * ServerObject::getSharedTemplateName() const { - if (getSharedTemplate() == NULL) - return NULL; + if (getSharedTemplate() == nullptr) + return nullptr; return getSharedTemplate()->ObjectTemplate::getName(); } @@ -2535,7 +2535,7 @@ bool ServerObject::serverObjectInitializeFirstTimeObject(ServerObject *cell, Tra if (cell) { Container::ContainerErrorCode tmp = Container::CEC_Success; - if (!ContainerInterface::transferItemToCell(*cell, *this, transform, NULL, tmp)) + if (!ContainerInterface::transferItemToCell(*cell, *this, transform, nullptr, tmp)) { WARNING(true, ("ServerWorld::createNewObjectIntermediate tried to create a new object in a cell, but it failed.")); return false; @@ -2587,7 +2587,7 @@ void ServerObject::initializeFirstTimeObject() //Don't move this declaration of contents out of the loop or you will leak a ref. ServerObjectTemplate::Contents contents; newTemplate->getContents(contents, i); - if (contents.content == NULL) + if (contents.content == nullptr) { DEBUG_WARNING(true, ("No template for contents item %d", i)); continue; @@ -2600,7 +2600,7 @@ void ServerObject::initializeFirstTimeObject() { //We'll persist the contents automatically if the parent object is persisted. ServerObject * newObject = ServerWorld::createNewObject(*(safe_cast(contents.content)), *this,slotId, false); - if (newObject == NULL) + if (newObject == nullptr) { DEBUG_WARNING(true, ("Can't create object from template %s",contents.content->getName())); } @@ -2615,7 +2615,7 @@ void ServerObject::initializeFirstTimeObject() // get the object (which we assume is a volume container) in the // desired slot SlottedContainer * const container = ContainerInterface::getSlottedContainer(*this); - if (container != NULL) + if (container != nullptr) { Container::ContainerErrorCode tmp = Container::CEC_Success; CachedNetworkId equippedObjectId = container->getObjectInSlot(SlotIdManager::findSlotId(CrcLowerString(contents.slotName.c_str())), tmp); @@ -2623,12 +2623,12 @@ void ServerObject::initializeFirstTimeObject() { // put the contents in the volume container ServerObject * equippedObject = safe_cast(equippedObjectId.getObject()); - if (equippedObject != NULL) + if (equippedObject != nullptr) { //We'll persist the contents automatically if the parent object is persisted. ServerObject * newObject = ServerWorld::createNewObject(*(safe_cast(contents.content)), *equippedObject,false); - if (newObject == NULL) + if (newObject == nullptr) { DEBUG_WARNING(true, ("Can't create object from template %s", contents.content->getName())); } @@ -2714,7 +2714,7 @@ void ServerObject::addToWorld() Object::addToWorld(); updateTriggerVolumes(); - if (getScriptObject() != NULL) + if (getScriptObject() != nullptr) getScriptObject()->setOwnerIsLoaded(); onAddedToWorld(); @@ -3012,8 +3012,8 @@ void ServerObject::onContainerTransferComplete(ServerObject *oldContainer, Serve void ServerObject::containerDepersistContents(ServerObject * oldParent, ServerObject * newParent) { - Container * const oldContainer = oldParent ? ContainerInterface::getContainer(*oldParent) : NULL; - Container * const newContainer = newParent ? ContainerInterface::getContainer(*newParent) : NULL; + Container * const oldContainer = oldParent ? ContainerInterface::getContainer(*oldParent) : nullptr; + Container * const newContainer = newParent ? ContainerInterface::getContainer(*newParent) : nullptr; if (oldContainer) oldContainer->internalItemRemoved(*this); @@ -3410,7 +3410,7 @@ void ServerObject::sendToClientsInUpdateRange(const GameNetworkMessage & message ServerObject * const obj = c->getCharacterObject(); - if (obj != NULL) + if (obj != nullptr) { if ( (ConfigServerGame::getSkipUnreliableTransformsForOtherCells() && obj->getAttachedTo() != getAttachedTo()) || (obj->getPosition_w().magnitudeBetweenSquared(getPosition_w()) > minDistanceSquared) @@ -3447,7 +3447,7 @@ void ServerObject::sendToSpecifiedClients(const GameNetworkMessage & message, bo for (std::vector::const_iterator i = clients.begin(); i != clients.end(); ++i) { ServerObject * o = safe_cast(NetworkIdManager::getObjectById(*i)); - if (o != NULL && o->getClient() != NULL) + if (o != nullptr && o->getClient() != nullptr) o->getClient()->send(message, reliable); } } @@ -3685,8 +3685,8 @@ void ServerObject::setParentCell(CellProperty * newCell) CellProperty * oldCell = getParentCell(); - if(oldCell == NULL) oldCell = CellProperty::getWorldCellProperty(); - if(newCell == NULL) newCell = CellProperty::getWorldCellProperty(); + if(oldCell == nullptr) oldCell = CellProperty::getWorldCellProperty(); + if(newCell == nullptr) newCell = CellProperty::getWorldCellProperty(); // ---------- @@ -3707,7 +3707,7 @@ void ServerObject::setParentCell(CellProperty * newCell) newTransform.multiply(oldCellTransform,oldTransform); Container::ContainerErrorCode tmp = Container::CEC_Success; - result = ContainerInterface::transferItemToWorld(*this, newTransform, NULL, tmp); + result = ContainerInterface::transferItemToWorld(*this, newTransform, nullptr, tmp); DEBUG_REPORT_LOG(!result, ("Object %s (id=%s) transfer to world was denied via ContainerInterface::transferItemToWorld()\n", getObjectTemplateName(), getNetworkId().getValueString().c_str())); } @@ -3720,7 +3720,7 @@ void ServerObject::setParentCell(CellProperty * newCell) ServerObject * newCellServerObject = safe_cast(newCellObject); Container::ContainerErrorCode tmp = Container::CEC_Success; - result = ContainerInterface::transferItemToCell(*newCellServerObject, *this, NULL, tmp); + result = ContainerInterface::transferItemToCell(*newCellServerObject, *this, nullptr, tmp); DEBUG_REPORT_LOG(!result, ("Object %s (id=%s) transfer to cell (id=%s) was denied via ContainerInterface::transferItemToCell()\n", getObjectTemplateName(), getNetworkId().getValueString().c_str(), newCellObject->getNetworkId().getValueString().c_str())); } @@ -4024,11 +4024,11 @@ void ServerObject::hearText(ServerObject const &source, MessageQueueSpatialChat CreatureObject * const creatureObject = asCreatureObject(); - if (creatureObject != NULL) + if (creatureObject != nullptr) { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(creatureObject); - if (playerObject != NULL) + if (playerObject != nullptr) { ChatAvatarId playerChatAvatarId(Chat::constructChatAvatarId(source)); Unicode::String playerName(Unicode::narrowToWide(playerChatAvatarId.getFullName())); @@ -4104,7 +4104,7 @@ void ServerObject::performSocial (const MessageQueueSocial & socialMsg) // allow scripts to prevent the player from performing the emote ScriptParams params; - if (getScriptObject() != NULL) + if (getScriptObject() != nullptr) { params.addParam(unicodeSocialTypeName); if (getScriptObject()->trigAllScripts(Scripting::TRIG_PERFORM_EMOTE, params) != SCRIPT_CONTINUE) @@ -4159,7 +4159,7 @@ void ServerObject::performCombatSpam (const MessageQueueCombatSpam & spamMsg, bo target->seeCombatSpam (spamMsg); } } else { - WARNING_STRICT_FATAL (!sendToSelf && !sendToBystanders, ("null target_obj in commandFuncCombatSpam, when sendToTarget was set true")); + WARNING_STRICT_FATAL (!sendToSelf && !sendToBystanders, ("nullptr target_obj in commandFuncCombatSpam, when sendToTarget was set true")); } } @@ -4217,10 +4217,10 @@ void ServerObject::teleportObject(Vector const &position_w, NetworkId const &tar { PortalProperty *portalProp = targetContainerObject->getPortalProperty(); targetContainerObject = 0; // clear in case we have a building that doesn't have the cell - if (portalProp != NULL) + if (portalProp != nullptr) { CellProperty *cellProp = portalProp->getCell(targetCellName.c_str()); - if (cellProp != NULL) + if (cellProp != nullptr) targetContainerObject = safe_cast(&(cellProp->getOwner())); } if (!targetContainerObject) @@ -4312,7 +4312,7 @@ void ServerObject::teleportObject(Vector const &position_w, NetworkId const &tar // Moves the object. If the new area is on a different server, the PlanetServer will change our authority. // What we really want to check here is whether we want to use the ServerController's teleport - // if a player has logged out, but we still have them loaded in game, their client will be null, + // if a player has logged out, but we still have them loaded in game, their client will be nullptr, // but we still want to use the ServerController's teleport method // so, we check against the player creature controller and player ship controller as well ServerController * controller = safe_cast(getController()); @@ -4383,7 +4383,7 @@ void ServerObject::updatePlanetServerInternal(bool) const /** * Attempts to create a synchronized ui object. If the synchronized ui object * does not exist, its creation is attempted via createSynchronizedUi. The default implementation -* of createSynchronizedUi returns null, and renders this method a no-op. +* of createSynchronizedUi returns nullptr, and renders this method a no-op. */ void ServerObject::addSynchronizedUi(const std::vector & clients) { @@ -4396,9 +4396,9 @@ void ServerObject::addSynchronizedUi(const std::vector & clients) { ServerObject * client = safe_cast( NetworkIdManager::getObjectById(*i)); - if (client != NULL) + if (client != nullptr) { - if (client->getClient() != NULL) + if (client->getClient() != nullptr) m_synchronizedUi->addClientObject (*client); else { @@ -4420,7 +4420,7 @@ void ServerObject::addSynchronizedUi(const std::vector & clients) /** * Attempts to add a client to the synchronized ui object. If the synchronized ui object * does not exist, its creation is attempted via createSynchronizedUi. The default implementation -* of createSynchronizedUi returns null, and renders this method a no-op. +* of createSynchronizedUi returns nullptr, and renders this method a no-op. * */ void ServerObject::addSynchronizedUiClient(ServerObject & client) @@ -4466,7 +4466,7 @@ void ServerObject::removeSynchronizedUiClient(const NetworkId & clientId) /** * Subclasses implement this if they have an appropriate synchronized ui object. -* Base class implementation returns null. +* Base class implementation returns nullptr. */ ServerSynchronizedUi * ServerObject::createSynchronizedUi () { @@ -4483,13 +4483,13 @@ ServerSynchronizedUi * ServerObject::createSynchronizedUi () */ void ServerObject::addPendingSynchronizedUi(const ServerObject & uiObject) { - if (getClient() != NULL) + if (getClient() != nullptr) { WARNING(true, ("ServerObject::addPendingSynchronizedUi called on object %s that already has a client", getNetworkId().getValueString().c_str())); return; } - if (m_pendingSyncUi == NULL) + if (m_pendingSyncUi == nullptr) m_pendingSyncUi = new std::vector; m_pendingSyncUi->push_back(uiObject.getNetworkId()); } @@ -5057,7 +5057,7 @@ std::string ServerObject::debugGetMessageToList() const { unsigned long const now = ServerClock::getInstance().getGameTimeSeconds(); std::string result; - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); for (Archive::AutoDeltaMap, MessageToId>, MessageToPayload>::const_iterator i=m_messageTos.begin(); i!=m_messageTos.end(); ++i) { char temp[256]; @@ -5126,7 +5126,7 @@ unsigned long ServerObject::processQueuedMessageTos(unsigned long effectiveMessa // if the message is going to be recurring, create a // new messageTo to reschedule the recurring message - MessageToPayload * copyOfRecurringMessage = NULL; + MessageToPayload * copyOfRecurringMessage = nullptr; if (message->second.getRecurringTime() > 0) { copyOfRecurringMessage = new MessageToPayload( @@ -5331,7 +5331,7 @@ void ServerObject::handleCMessageTo(const MessageToPayload &message) { //handle unstick static MessageDispatch::Emitter e; - Chat::sendSystemMessageSimple(*this, SharedStringIds::unstick_request_complete, NULL); + Chat::sendSystemMessageSimple(*this, SharedStringIds::unstick_request_complete, nullptr); RequestUnstick r; r.setClientId(getNetworkId()); e.emitMessage(r); @@ -5587,7 +5587,7 @@ bool ServerObject::handleTeleportFixup(bool force) } else if (destContainer != NetworkId::cms_invalid && !force) { - LOG("TeleportFixup", ("Failing teleport fixup because object %s is in a null dest container and force was passed in\n", getNetworkId().getValueString().c_str())); + LOG("TeleportFixup", ("Failing teleport fixup because object %s is in a nullptr dest container and force was passed in\n", getNetworkId().getValueString().c_str())); return false; // going to a container and it wasn't loaded, defer } } @@ -5626,15 +5626,15 @@ void ServerObject::customize(const std::string & customName, int value) if(isAuthoritative()) { CustomizationDataProperty *const cdProperty = safe_cast(getProperty(CustomizationDataProperty::getClassPropertyId())); - if (cdProperty != NULL) + if (cdProperty != nullptr) { CustomizationData *const customizationData = cdProperty->fetchCustomizationData(); - if (customizationData != NULL) + if (customizationData != nullptr) { RangedIntCustomizationVariable * variable = dynamic_cast< RangedIntCustomizationVariable*>(customizationData->findVariable( customName)); - if (variable != NULL) + if (variable != nullptr) variable->setValue(value); else { @@ -5646,7 +5646,7 @@ void ServerObject::customize(const std::string & customName, int value) else { // this shouldn't happen - DEBUG_WARNING(true, ("CustomizationDataProperty returned NULL CustomizationData on fetch.")); + DEBUG_WARNING(true, ("CustomizationDataProperty returned nullptr CustomizationData on fetch.")); } } else @@ -5725,7 +5725,7 @@ bool ServerObject::permanentlyDestroy(DeleteReasons::Enumerator reason) const bool houseDestroyedByScript = (reason == DeleteReasons::Script && buildingObject && buildingObject->isPlayerPlaced()); // tell scripts we want to destroy the object - if (getScriptObject() != NULL && !m_calledTriggerDestroy) + if (getScriptObject() != nullptr && !m_calledTriggerDestroy) { m_calledTriggerDestroy = true; ScriptParams params; @@ -5739,7 +5739,7 @@ bool ServerObject::permanentlyDestroy(DeleteReasons::Enumerator reason) } } - if (isAuthoritative() && (getScriptObject() != NULL) && !m_calledTriggerRemovingFromWorld) + if (isAuthoritative() && (getScriptObject() != nullptr) && !m_calledTriggerRemovingFromWorld) { ScriptParams params; m_calledTriggerRemovingFromWorld = true; @@ -6517,8 +6517,8 @@ void ServerObject::onAllContentsLoaded() if (isAuthoritative()) { - ServerObject *player = NULL; - if ((player = getServerObject(playerId)) != NULL) + ServerObject *player = nullptr; + if ((player = getServerObject(playerId)) != nullptr) { //Tell scripts we are loaded ScriptParams params; @@ -6588,7 +6588,7 @@ void ServerObject::handleDisconnect(bool immediate) { // client has disconnected, log pertinent information about the play session CreatureObject * const creatureObject = asCreatureObject(); - PlayerObject * playerObject = NULL; + PlayerObject * playerObject = nullptr; if (creatureObject) { playerObject = PlayerCreatureController::getPlayerObject(creatureObject); @@ -6927,13 +6927,13 @@ ServerObject * ServerObject::combineResourceContainers(ServerObject &item) { ResourceContainerObject *resourceContainerObject = safe_cast(&item); - if (resourceContainerObject != NULL) + if (resourceContainerObject != nullptr) { // If this is a container, see if it contains another resource container of the same type Container *container = ContainerInterface::getContainer(*this); - if (container != NULL) + if (container != nullptr) { ContainerIterator iterContainer = container->begin(); @@ -6945,12 +6945,12 @@ ServerObject * ServerObject::combineResourceContainers(ServerObject &item) // the item is a resource container if ((containedObject != &item) && - (containedObject != NULL) && + (containedObject != nullptr) && (containedObject->getObjectType() == ServerResourceContainerObjectTemplate::ServerResourceContainerObjectTemplate_tag)) { ResourceContainerObject *containedResourceContainerObject = safe_cast(containedObject); - if ((containedResourceContainerObject != NULL) && + if ((containedResourceContainerObject != nullptr) && (resourceContainerObject->getResourceType() == containedResourceContainerObject->getResourceType())) { // This is a container of similar type, if it is not full, save it to the list @@ -7064,7 +7064,7 @@ bool ServerObject::isContainedBy(const ServerObject & container, bool includeCon // our container is the desired container return true; } - else if (test != NULL && test != this && includeContents) + else if (test != nullptr && test != this && includeContents) { // our container isn't the desired container, see if it is contained return safe_cast(test)->isContainedBy(container, true); @@ -7564,7 +7564,7 @@ void ServerObject::sendDirtyObjectMenuNotification() Controller * const controller = getController(); if (controller) - controller->appendMessage(CM_objectMenuDirty, 0, NULL, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_ALL_CLIENT); + controller->appendMessage(CM_objectMenuDirty, 0, nullptr, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_ALL_CLIENT); } // ---------------------------------------------------------------------- @@ -7577,7 +7577,7 @@ void ServerObject::sendDirtyAttributesNotification() Controller * const controller = getController(); if (controller) - controller->appendMessage(CM_attributesDirty, 0, NULL, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_ALL_CLIENT); + controller->appendMessage(CM_attributesDirty, 0, nullptr, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_ALL_CLIENT); } //------------------------------------------------------------------------------------------ @@ -7615,15 +7615,15 @@ void ServerObject::triggerMadeAuthoritative() void ServerObject::setLayer(TerrainGenerator::Layer* layer) { - LayerProperty * layerProperty = NULL; + LayerProperty * layerProperty = nullptr; Property * property = getProperty(LayerProperty::getClassPropertyId()); - if (property != NULL) + if (property != nullptr) layerProperty = safe_cast(property); else layerProperty = new LayerProperty(*this); layerProperty->setLayer(layer); - if (property == NULL) + if (property == nullptr) { addProperty(*layerProperty, true); ObjectTracker::addRunTimeRule(); @@ -7636,12 +7636,12 @@ void ServerObject::setLayer(TerrainGenerator::Layer* layer) TerrainGenerator::Layer* ServerObject::getLayer() const { const Property * property = getProperty(LayerProperty::getClassPropertyId()); - if (property != NULL) + if (property != nullptr) { const LayerProperty * layerProperty = safe_cast(property); return layerProperty->getLayer(); } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------ @@ -7853,7 +7853,7 @@ void ServerObject::setPatrolPathRoot(const ServerObject & root) // make sure we aren't already a root node Property * p = getProperty(PatrolPathRootProperty::getClassPropertyId()); - if (p != NULL) + if (p != nullptr) { if (root.getNetworkId() != getNetworkId()) { @@ -7873,7 +7873,7 @@ void ServerObject::setPatrolPathRoot(const ServerObject & root) { // add the root node to our node list p = getProperty(PatrolPathNodeProperty::getClassPropertyId()); - if (p == NULL) + if (p == nullptr) { p = new PatrolPathNodeProperty(*this); addProperty(*p, true); @@ -7893,15 +7893,15 @@ void ServerObject::setPatrolPathRoot(const ServerObject & root) // we need to add any players in range to our path observer count TriggerVolume * triggerVolume = getNetworkTriggerVolume(); - if (triggerVolume != NULL) + if (triggerVolume != nullptr) { TriggerVolume::ContentsSet const & contents = triggerVolume->getContents(); for (TriggerVolume::ContentsSet::const_iterator i = contents.begin(); i != contents.end(); ++i) { - if (*i != NULL) + if (*i != nullptr) { Client * client = (*i)->getClient(); - if (client != NULL) + if (client != nullptr) { if (!ObserveTracker::isObserving(*client, *this)) ObserveTracker::onClientEnteredNetworkTriggerVolume(*client, *triggerVolume); @@ -7922,14 +7922,14 @@ void ServerObject::setPatrolPathRoot(const ServerObject & root) /** * Returns the root node for a patrol path node. * - * @return the root node, or NULL if this isn't a patrol path node + * @return the root node, or nullptr if this isn't a patrol path node */ const std::set & ServerObject::getPatrolPathRoots() const { static const std::set noRoots; const Property * p = getProperty(PatrolPathNodeProperty::getClassPropertyId()); - if (p != NULL) + if (p != nullptr) { return safe_cast(p)->getRoots(); } @@ -7957,7 +7957,7 @@ void ServerObject::addPatrolPathingObject(const ServerObject & ai) } Property * p = getProperty(PatrolPathRootProperty::getClassPropertyId()); - if (p != NULL) + if (p != nullptr) { safe_cast(p)->addPatrollingObject(ai); DEBUG_REPORT_LOG(true, ("[patrolpath] add patrol ai %s to root %s\n", @@ -7974,7 +7974,7 @@ void ServerObject::addPatrolPathingObject(const ServerObject & ai) if (roots.size() == 1) { ServerObject * root = safe_cast(roots.begin()->getObject()); - if (root != NULL) + if (root != nullptr) root->addPatrolPathingObject(ai); } else @@ -8004,7 +8004,7 @@ void ServerObject::removePatrolPathingObject(const ServerObject & ai) } Property * p = getProperty(PatrolPathRootProperty::getClassPropertyId()); - if (p != NULL) + if (p != nullptr) { safe_cast(p)->removePatrollingObject(ai); DEBUG_REPORT_LOG(true, ("[patrolpath] remove patrol ai %s from root %s\n", @@ -8019,7 +8019,7 @@ void ServerObject::removePatrolPathingObject(const ServerObject & ai) if (roots.size() == 1) { ServerObject * root = safe_cast(roots.begin()->getObject()); - if (root != NULL) + if (root != nullptr) root->removePatrolPathingObject(ai); } else @@ -8049,7 +8049,7 @@ void ServerObject::addPatrolPathObserver() // if we are a root node, increment our observer count Property * p = getProperty(PatrolPathRootProperty::getClassPropertyId()); - if (p != NULL) + if (p != nullptr) { PatrolPathRootProperty * pprp = safe_cast(p); pprp->incrementObserverCount(); @@ -8061,10 +8061,10 @@ void ServerObject::addPatrolPathObserver() const std::set > & ai = pprp->getPatrollingObjects(); for (std::set >::const_iterator i = ai.begin(); i != ai.end(); ++i) { - if (*i != NULL) + if (*i != nullptr) { const ServerObject * ai = *i; - if (ai->getController()->asCreatureController() != NULL) + if (ai->getController()->asCreatureController() != nullptr) { const CreatureController * controller = ai->getController()->asCreatureController(); if (controller->getHibernate()) @@ -8086,7 +8086,7 @@ void ServerObject::addPatrolPathObserver() for (std::set::const_iterator i = roots.begin(); i != roots.end(); ++i) { ServerObject * root = safe_cast(i->getObject()); - if (root != NULL) + if (root != nullptr) { root->addPatrolPathObserver(); } @@ -8112,7 +8112,7 @@ void ServerObject::removePatrolPathObserver() // if we are a root node, decrement our observer count Property * p = getProperty(PatrolPathRootProperty::getClassPropertyId()); - if (p != NULL) + if (p != nullptr) { PatrolPathRootProperty * pprp = safe_cast(p); pprp->decrementObserverCount(); @@ -8131,7 +8131,7 @@ void ServerObject::removePatrolPathObserver() for (std::set::const_iterator i = roots.begin(); i != roots.end(); ++i) { ServerObject * root = safe_cast(i->getObject()); - if (root != NULL) + if (root != nullptr) { root->removePatrolPathObserver(); } @@ -8152,7 +8152,7 @@ int ServerObject::getPatrolPathObservers() const int observers = 0; const Property * p = getProperty(PatrolPathRootProperty::getClassPropertyId()); - if (p != NULL) + if (p != nullptr) { observers = safe_cast(p)->getObserverCount(); } @@ -8162,7 +8162,7 @@ int ServerObject::getPatrolPathObservers() const for (std::set::const_iterator i = roots.begin(); i != roots.end(); ++i) { const ServerObject * root = safe_cast(i->getObject()); - if (root != NULL && root->isPatrolPathRoot()) + if (root != nullptr && root->isPatrolPathRoot()) { observers += root->getPatrolPathObservers(); } @@ -8175,14 +8175,14 @@ int ServerObject::getPatrolPathObservers() const bool ServerObject::isPatrolPathNode() const { - return (getProperty(PatrolPathNodeProperty::getClassPropertyId()) != NULL) || isPatrolPathRoot(); + return (getProperty(PatrolPathNodeProperty::getClassPropertyId()) != nullptr) || isPatrolPathRoot(); } // ---------------------------------------------------------------------- bool ServerObject::isPatrolPathRoot() const { - return getProperty(PatrolPathRootProperty::getClassPropertyId()) != NULL; + return getProperty(PatrolPathRootProperty::getClassPropertyId()) != nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/object/ServerObject.h b/engine/server/library/serverGame/src/shared/object/ServerObject.h index 32192ce3..5cdaed82 100755 --- a/engine/server/library/serverGame/src/shared/object/ServerObject.h +++ b/engine/server/library/serverGame/src/shared/object/ServerObject.h @@ -317,7 +317,7 @@ public: // Can this object manipulate other objects. CreatureObject overrides. Base class returns false. // generally an object is allowed to manipulate another object if it is container or "nearby". public: - virtual bool canManipulateObject(ServerObject const &target, bool movingObject, bool checkPermission, bool checkPermissionOnParent, float maxDistance, Container::ContainerErrorCode&, bool skipNoTradeCheck = false, bool * allowedByGodMode = NULL) const; + virtual bool canManipulateObject(ServerObject const &target, bool movingObject, bool checkPermission, bool checkPermissionOnParent, float maxDistance, Container::ContainerErrorCode&, bool skipNoTradeCheck = false, bool * allowedByGodMode = nullptr) const; //----------------------------------------------------------------------- // container support @@ -738,7 +738,7 @@ private: static float ms_buildingUpdateRadiusMultiplier; static void setBuildingUpdateRadiusMultiplier(float m); - /** If this object is being controlled by a client, this pointer will be set. NULL otherwise + /** If this object is being controlled by a client, this pointer will be set. nullptr otherwise */ Client * m_client; std::set m_observers; @@ -871,7 +871,7 @@ inline Client * ServerObject::getClient(void) const inline const SharedObjectTemplate * ServerObject::getSharedTemplate() const { - if (m_sharedTemplate != NULL) + if (m_sharedTemplate != nullptr) return m_sharedTemplate; return getDefaultSharedTemplate(); } @@ -936,7 +936,7 @@ inline ServerObject::TriggerVolumeMap & ServerObject::getTriggerVolumeMap() inline const std::set * ServerObject::getTriggerVolumeEntered() const { - return NULL; + return nullptr; } //----------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/object/ServerObject_AuthTransfer.cpp b/engine/server/library/serverGame/src/shared/object/ServerObject_AuthTransfer.cpp index 65655198..b7075ece 100755 --- a/engine/server/library/serverGame/src/shared/object/ServerObject_AuthTransfer.cpp +++ b/engine/server/library/serverGame/src/shared/object/ServerObject_AuthTransfer.cpp @@ -162,7 +162,7 @@ void ServerObject::transferAuthoritySceneChange(uint32 pid) client->getIpAddress(), client->isSecure(), client->getStationId(), - NULL, + nullptr, client->getGameFeatures(), client->getSubscriptionFeatures(), client->getAccountFeatureIds(), @@ -265,7 +265,7 @@ void ServerObject::transferAuthorityNoSceneChange(uint32 pid, bool skipLoadScree client->getIpAddress(), client->isSecure(), client->getStationId(), - (observeListIds.empty() ? NULL : &observeListIds), + (observeListIds.empty() ? nullptr : &observeListIds), client->getGameFeatures(), client->getSubscriptionFeatures(), client->getAccountFeatureIds(), diff --git a/engine/server/library/serverGame/src/shared/object/ServerResourceClassObject.cpp b/engine/server/library/serverGame/src/shared/object/ServerResourceClassObject.cpp index 5bb2df2f..49c6bd09 100755 --- a/engine/server/library/serverGame/src/shared/object/ServerResourceClassObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/ServerResourceClassObject.cpp @@ -577,7 +577,7 @@ ResourceTypeObject const * ServerResourceClassObject::getAResourceType() const if (!m_types.empty()) return m_types.front(); else - return NULL; + return nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/object/ShipObject.cpp b/engine/server/library/serverGame/src/shared/object/ShipObject.cpp index badd8030..2408018b 100755 --- a/engine/server/library/serverGame/src/shared/object/ShipObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/ShipObject.cpp @@ -110,9 +110,9 @@ namespace ShipObjectNamespace typedef std::map ShipTypeShipDataMap; ShipTypeShipDataMap ms_shipTypeShipDataMap; - ShipData const * ms_defaultShipData = NULL; + ShipData const * ms_defaultShipData = nullptr; - ShipComponentDataEngine * ms_defaultEngine = NULL; + ShipComponentDataEngine * ms_defaultEngine = nullptr; unsigned int s_lastShipId = 0; unsigned int const s_maxShipId = 4096; @@ -180,7 +180,7 @@ void ShipObject::install() DataTableManager::addReloadCallback(cs_shipTypeFileName, loadShipTypeDataTable); ShipComponentDescriptor const * const genericEngineDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByName(ConstCharCrcString("eng_generic")); - FATAL(genericEngineDescriptor == NULL, ("ShipObject genericEngineDescriptor [eng_generic] not found")); + FATAL(genericEngineDescriptor == nullptr, ("ShipObject genericEngineDescriptor [eng_generic] not found")); ms_defaultEngine = new ShipComponentDataEngine(*genericEngineDescriptor); // mark shipId 0 as used @@ -243,10 +243,10 @@ ShipObject * ShipObject::getContainingShipObject(ServerObject * serverObject) void ShipObjectNamespace::remove() { - ms_defaultShipData = NULL; + ms_defaultShipData = nullptr; delete ms_defaultEngine; - ms_defaultEngine = NULL; + ms_defaultEngine = nullptr; //-- Delete the ship type to ship data map std::for_each(ms_shipTypeShipDataMap.begin(), ms_shipTypeShipDataMap.end(), PointerDeleterPairSecond()); @@ -270,7 +270,7 @@ ShipObject::ShipObject(ServerShipObjectTemplate const *newTemplate) : m_currentRoll(0.f), m_currentChassisHitPoints(0.f), m_maximumChassisHitPoints(0.f), - m_weaponRefireTimers(NULL), + m_weaponRefireTimers(nullptr), m_numberOfHits(0), m_chassisType (0), m_chassisComponentMassMaximum(0.0f), @@ -406,19 +406,19 @@ ShipObject::~ShipObject() nullWatchers(); delete m_boosterAvailableTimer; - m_boosterAvailableTimer = NULL; + m_boosterAvailableTimer = nullptr; if (getLocalFlag(LocalObjectFlags::ShipObject_ShipIdAssigned)) freeShipId(m_shipId.get()); delete m_fireShotQueue; - m_fireShotQueue = NULL; + m_fireShotQueue = nullptr; delete[] m_weaponRefireTimers; - m_weaponRefireTimers = NULL; + m_weaponRefireTimers = nullptr; delete m_nebulas; - m_nebulas = NULL; + m_nebulas = nullptr; delete m_autoAggroImmuneTimer; delete m_turretWeaponIndices; @@ -465,7 +465,7 @@ void ShipObject::endBaselines() NetworkId const & resourceTypeId = (*it).first; ResourceTypeObject const * const resourceTypeObject = ServerUniverse::getInstance().getResourceTypeById(resourceTypeId); - if (NULL == ServerUniverse::getInstance().getResourceTypeById(resourceTypeId)) + if (nullptr == ServerUniverse::getInstance().getResourceTypeById(resourceTypeId)) { WARNING(true, ("ShipObject::endBaselines invalid resource type [%s]", resourceTypeId.getValueString().c_str())); continue; @@ -946,7 +946,7 @@ Controller *ShipObject::createDefaultController() /** * Get the ship's pilot, if any. * - * @return the pilot if there is one, otherwise NULL + * @return the pilot if there is one, otherwise nullptr */ CreatureObject *ShipObject::getPilot() { @@ -1180,7 +1180,7 @@ void ShipObject::internalHandleFireShot(Client const *gunnerClient, int const we { if (!gunnerCreature) { - WARNING(true, ("ShipObject::internalHandleFireShot cannot fire missile with a null gunner")); + WARNING(true, ("ShipObject::internalHandleFireShot cannot fire missile with a nullptr gunner")); return; } @@ -1284,14 +1284,14 @@ void ShipObject::fireShotTurretServer(int const weaponIndex, NetworkId const & t Object const * const targetObject = NetworkIdManager::getObjectById(targetId); - if (targetObject == NULL) + if (targetObject == nullptr) { WARNING(true, ("ERROR: The targetId(%s) could not be resolved to an Object. A turret shot will NOT be fired.", targetId.getValueString().c_str())); return; } ServerObject const * const targetServerObject = targetObject->asServerObject(); - ShipObject const * const targetShipObject = (targetServerObject != NULL) ? targetServerObject->asShipObject() : NULL; + ShipObject const * const targetShipObject = (targetServerObject != nullptr) ? targetServerObject->asShipObject() : nullptr; if ( !targetShipObject && goodShot) @@ -1299,7 +1299,7 @@ void ShipObject::fireShotTurretServer(int const weaponIndex, NetworkId const & t WARNING(true, ("ERROR: The targetId(%s) could not be resolved to a ShipObject. Perfect shot requested, but there is no way to lead with a perfect shot.", targetId.getValueString().c_str())); } - if ( (targetShipObject != NULL) + if ( (targetShipObject != nullptr) && goodShot) { // If its a good shot, lead perfectly @@ -1335,8 +1335,8 @@ void ShipObject::fireShotTurretServer(int const weaponIndex, NetworkId const & t ShipController const * const ownerShipController = getController()->asShipController(); DEBUG_WARNING(!ownerShipController, ("ERROR: Controller could not be resolved to a ShipController(%s)", getDebugInformation().c_str())); - float const missHalfAngle = (ownerShipController != NULL) ? (ownerShipController->getTurretMissAngle() / 2.0f) : 0.0f; - float const targetRadius = (targetServerObject != NULL) ? targetServerObject->getRadius() : 0.0f; + float const missHalfAngle = (ownerShipController != nullptr) ? (ownerShipController->getTurretMissAngle() / 2.0f) : 0.0f; + float const targetRadius = (targetServerObject != nullptr) ? targetServerObject->getRadius() : 0.0f; Transform transform; transform.roll_l(Random::randomReal() * PI_TIMES_2); @@ -1442,13 +1442,13 @@ void ShipObject::constructFromTemplate() //-- setup ship chassis ShipChassis const * shipChassis = ShipChassis::findShipChassisByName (TemporaryCrcString (shipType.c_str (), true)); - if (shipChassis == NULL) + if (shipChassis == nullptr) { WARNING (true, ("ShipObject::constructFromTemplate failed to find a valid ship chassis for [%s], trying generic", shipType.c_str ())); shipChassis = ShipChassis::findShipChassisByName (TemporaryCrcString ("generic", true)); } - if (shipChassis != NULL) + if (shipChassis != nullptr) m_chassisType = shipChassis->getCrc (); else { @@ -1456,7 +1456,7 @@ void ShipObject::constructFromTemplate() } //set initial slot targetability from the chassis setttings. Code or script can change these at runtime - if(shipChassis != NULL) + if(shipChassis != nullptr) { for (int slot = 0; slot < static_cast(ShipChassisSlotType::SCST_num_types); ++slot) { @@ -1473,7 +1473,7 @@ void ShipObject::constructFromTemplate() { ShipComponentData * const shipComponentData = shipData->m_components[i]; - if (shipComponentData != NULL) + if (shipComponentData != nullptr) { if (!installComponentFromData(i, *shipComponentData)) { std::string chassis = shipChassis->getName().getString(); @@ -1732,7 +1732,7 @@ ShipComponentDataEngine const & ShipObject::getShipDataEngine() const ShipComponentDataEngine const * const engine = safe_cast(shipData->m_components[static_cast(ShipChassisSlotType::SCST_engine)]); - if (engine == NULL) + if (engine == nullptr) return *ms_defaultEngine; return *engine; @@ -1761,9 +1761,9 @@ void ShipObject::handleGunnerChange(ServerObject const &player) } ShipController * const shipController = getController()->asShipController(); - PlayerShipController * const playerShipController = (shipController != NULL) ? shipController->asPlayerShipController() : NULL; + PlayerShipController * const playerShipController = (shipController != nullptr) ? shipController->asPlayerShipController() : nullptr; - if (playerShipController != NULL) + if (playerShipController != nullptr) { playerShipController->updateGunnerWeaponIndex(player.getNetworkId(), gunnerWeaponIndex); } @@ -2152,7 +2152,7 @@ void ShipObjectNamespace::loadShipTypeDataTable(DataTable const &dataTable) //-- find components for (int i = 0; i < static_cast(ShipChassisSlotType::SCST_num_types); ++i) { - shipData->m_components [i] = NULL; + shipData->m_components [i] = nullptr; std::string const & slotName = ShipChassisSlotType::getNameFromType (static_cast(i)); if (!dataTable.doesColumnExist (slotName)) continue; @@ -2164,14 +2164,14 @@ void ShipObjectNamespace::loadShipTypeDataTable(DataTable const &dataTable) uint32 const componentCrc = Crc::normalizeAndCalculate (componentName.c_str ()); ShipComponentDescriptor const * const shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByCrc (componentCrc); - if (shipComponentDescriptor == NULL) + if (shipComponentDescriptor == nullptr) WARNING (true, ("ShipObject ship type [%s] specified invalid [%s] component [%s]", name.c_str (), slotName.c_str (), componentName.c_str ())); else shipData->m_components[i] = ShipComponentDataManager::create(*shipComponentDescriptor); ShipComponentData * const shipComponentData = shipData->m_components[i]; - if (shipComponentData == NULL) + if (shipComponentData == nullptr) continue; //-- get common data @@ -2532,18 +2532,18 @@ void ShipObjectNamespace::freeShipId(uint16 shipId) ShipObject const * ShipObject::asShipObject(Object const * object) { - ServerObject const * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + ServerObject const * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - return (serverObject != NULL) ? serverObject->asShipObject() : NULL; + return (serverObject != nullptr) ? serverObject->asShipObject() : nullptr; } // ---------------------------------------------------------------------- ShipObject * ShipObject::asShipObject(Object * object) { - ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - return (serverObject != NULL) ? serverObject->asShipObject() : NULL; + return (serverObject != nullptr) ? serverObject->asShipObject() : nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/object/ShipObject_Components.cpp b/engine/server/library/serverGame/src/shared/object/ShipObject_Components.cpp index e6f4cb22..667c9ae7 100755 --- a/engine/server/library/serverGame/src/shared/object/ShipObject_Components.cpp +++ b/engine/server/library/serverGame/src/shared/object/ShipObject_Components.cpp @@ -1638,7 +1638,7 @@ bool ShipObject::canInstallComponent (int chassisSlot, TangibleObject const ShipChassisSlot const * const slot = shipChassis->getSlot (static_cast(effectiveCompatibilitySlot)); - if (slot != NULL) + if (slot != nullptr) { if (slot->canAcceptComponent (shipComponentData->getDescriptor ())) { @@ -1721,7 +1721,7 @@ bool ShipObject::installComponent (NetworkId const & installerId, int chassisS void ShipObject::purgeComponent (int chassisSlot) { - IGNORE_RETURN (internalUninstallComponent (NetworkId::cms_invalid, chassisSlot, NULL)); + IGNORE_RETURN (internalUninstallComponent (NetworkId::cms_invalid, chassisSlot, nullptr)); } //---------------------------------------------------------------------- @@ -1731,16 +1731,16 @@ TangibleObject * ShipObject::internalUninstallComponent (NetworkId const if (!isSlotInstalled (chassisSlot)) { WARNING (true, ("ShipObject::internalUninstallComponent failed... no component installed in slot")); - return NULL; + return nullptr; } ShipComponentData * const shipComponentData = createShipComponentData (chassisSlot); - if (shipComponentData == NULL) + if (shipComponentData == nullptr) { - WARNING (true, ("ShipObject::internalUninstallComponent failed null data")); + WARNING (true, ("ShipObject::internalUninstallComponent failed nullptr data")); delete shipComponentData; - return NULL; + return nullptr; } if(getScriptObject()) @@ -1751,7 +1751,7 @@ TangibleObject * ShipObject::internalUninstallComponent (NetworkId const p.addParam (containerTarget ? containerTarget->getNetworkId () : NetworkId::cms_invalid); if (getScriptObject()->trigAllScripts(Scripting::TRIG_SHIP_COMPONENT_UNINSTALLING, p) == SCRIPT_OVERRIDE) - return NULL; + return nullptr; } TangibleObject * tangible = 0; @@ -1765,7 +1765,7 @@ TangibleObject * ShipObject::internalUninstallComponent (NetworkId const { VolumeContainer * volContainer = ContainerInterface::getVolumeContainer(*containerTarget); - if (volContainer == NULL) + if (volContainer == nullptr) return 0; int oldCapacity = volContainer->debugDoNotUseSetCapacity(-1); @@ -1780,21 +1780,21 @@ TangibleObject * ShipObject::internalUninstallComponent (NetworkId const obj = safe_cast(ServerWorld::createNewObject (objectTemplateCrc, *containerTarget, true)); } - if (obj == NULL) + if (obj == nullptr) { WARNING (true, ("ShipObject::internalUninstallComponent failed for slot [%d] because ServerWorld could not create an object for [%d], or container is full", chassisSlot, objectTemplateCrc)); delete shipComponentData; - return NULL; + return nullptr; } tangible = obj->asTangibleObject (); - if (tangible == NULL) + if (tangible == nullptr) { WARNING (true, ("ShipObject::internalUninstallComponent failed for slot [%d] because object template [%d] is not tangible", chassisSlot, objectTemplateCrc)); delete shipComponentData; IGNORE_RETURN (obj->permanentlyDestroy (DeleteReasons::SetupFailed)); - return NULL; + return nullptr; } shipComponentData->writeDataToComponent (*tangible); @@ -1897,7 +1897,7 @@ TangibleObject * ShipObject::uninstallComponent (NetworkId const & uninstallerId bool ShipObject::installComponentFromData(int chassisSlot, ShipComponentData const & shipComponentData) { ShipChassis const * const shipChassis = ShipChassis::findShipChassisByCrc (getChassisType ()); - if (shipChassis == NULL) + if (shipChassis == nullptr) { DEBUG_WARNING (true, ("Ship [%s] chassis [%d] is invalid for installing component [%s]", getNetworkId().getValueString().c_str(), @@ -1922,7 +1922,7 @@ bool ShipObject::installComponentFromData(int chassisSlot, ShipComponentData con effectiveCompatibilitySlot = ShipChassisSlotType::SCST_weapon_first+((chassisSlot-ShipChassisSlotType::SCST_weapon_first)&7); ShipChassisSlot const * const slot = shipChassis->getSlot (static_cast(effectiveCompatibilitySlot)); - if (slot == NULL) + if (slot == nullptr) { DEBUG_WARNING (true, ("Ship [%s] chassis [%s] does not support slot [%s] for installing component [%s]", getNetworkId().getValueString().c_str(), @@ -1957,7 +1957,7 @@ bool ShipObject::installComponentFromData(int chassisSlot, ShipComponentData con bool ShipObject::pseudoInstallComponent(int chassisSlot, uint32 componentCrc) { ShipComponentDescriptor const * const shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByCrc (componentCrc); - if (shipComponentDescriptor == NULL) + if (shipComponentDescriptor == nullptr) { WARNING (true, ("Invalid component name")); return false; @@ -1965,7 +1965,7 @@ bool ShipObject::pseudoInstallComponent(int chassisSlot, uint32 componentCrc) ShipComponentData * const shipComponentData = ShipComponentDataManager::create (*shipComponentDescriptor); - if (shipComponentData == NULL) + if (shipComponentData == nullptr) { WARNING(true, ("ShipObject::pseudoInstallComponent invalid descriptor")); return false; @@ -1982,27 +1982,27 @@ bool ShipObject::pseudoInstallComponent(int chassisSlot, uint32 componentCrc) ShipComponentData * ShipObject::createShipComponentData (int chassisSlot) const { - ShipComponentDescriptor const * shipComponentDescriptor = NULL; + ShipComponentDescriptor const * shipComponentDescriptor = nullptr; uint32 const componentCrc = getComponentCrc (chassisSlot); if (componentCrc) { shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByCrc (componentCrc); - if (shipComponentDescriptor == NULL) + if (shipComponentDescriptor == nullptr) { WARNING (true, ("ShipObject::createShipComponentData failed for slot [%d] because component crc [%d] could not map to a component descriptor", chassisSlot, componentCrc)); - return NULL; + return nullptr; } } else - return NULL; + return nullptr; ShipComponentData * const shipComponentData = ShipComponentDataManager::create (*shipComponentDescriptor); - if (shipComponentData == NULL) + if (shipComponentData == nullptr) { WARNING (true, ("ShipObject::createShipComponentData failed for slot [%d] ship Component data could not be constructed", chassisSlot)); delete(shipComponentData); - return NULL; + return nullptr; } if (!shipComponentData->readDataFromShip (chassisSlot, *this)) @@ -2334,7 +2334,7 @@ float ShipObject::computeShipActualSpeedMaximum () const if (hasWings() && hasCondition(TangibleObject::C_wingsOpened)) { ShipChassis const * const shipChassis = ShipChassis::findShipChassisByCrc(getChassisType()); - if (NULL != shipChassis) + if (nullptr != shipChassis) { float const wingOpenSpeedFactor = shipChassis->getWingOpenSpeedFactor(); rate *= wingOpenSpeedFactor; @@ -2673,7 +2673,7 @@ void ShipObject::handlePowerPulse (float timeElapsedSecs) if (boosterEnergyCurrent <= 0.0f) { IGNORE_RETURN(setComponentActive(ShipChassisSlotType::SCST_booster, false)); - if (pilot != NULL) + if (pilot != nullptr) Chat::sendSystemMessage(*pilot, SharedStringIds::booster_energy_depleted, Unicode::emptyString); restartBoosterTimer(); @@ -3368,7 +3368,7 @@ void ShipObject::setCargoHoldContent(NetworkId const & resourceTypeId, int amoun else { ResourceTypeObject const * const resourceTypeObject = ServerUniverse::getInstance().getResourceTypeById(resourceTypeId); - if (NULL == ServerUniverse::getInstance().getResourceTypeById(resourceTypeId)) + if (nullptr == ServerUniverse::getInstance().getResourceTypeById(resourceTypeId)) { WARNING(true, ("ShipObject::setCargoHoldContent invalid resource type [%s]", resourceTypeId.getValueString().c_str())); return; diff --git a/engine/server/library/serverGame/src/shared/object/StaticObject.cpp b/engine/server/library/serverGame/src/shared/object/StaticObject.cpp index 8a9dfc3f..35366239 100755 --- a/engine/server/library/serverGame/src/shared/object/StaticObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/StaticObject.cpp @@ -21,7 +21,7 @@ #include "sharedObject/AppearanceTemplateList.h" #include "sharedObject/ObjectTemplateList.h" -const SharedObjectTemplate * StaticObject::m_defaultSharedTemplate = NULL; +const SharedObjectTemplate * StaticObject::m_defaultSharedTemplate = nullptr; //----------------------------------------------------------------------- @@ -39,7 +39,7 @@ StaticObject::StaticObject(const ServerStaticObjectTemplate* newTemplate) : { Appearance * newAppearance = AppearanceTemplateList::createAppearance(appearanceString.c_str()); - if(newAppearance != NULL) + if(newAppearance != nullptr) { setAppearance(newAppearance); } else { @@ -82,13 +82,13 @@ const SharedObjectTemplate * StaticObject::getDefaultSharedTemplate(void) const { static const ConstCharCrcLowerString templateName("object/static/base/shared_static_default.iff"); - if (m_defaultSharedTemplate == NULL) + if (m_defaultSharedTemplate == nullptr) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create " + WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create " "default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) ExitChain::add (removeDefaultTemplate, "StaticObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -101,10 +101,10 @@ static const ConstCharCrcLowerString templateName("object/static/base/shared_sta */ void StaticObject::removeDefaultTemplate(void) { - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } // StaticObject::removeDefaultTemplate diff --git a/engine/server/library/serverGame/src/shared/object/TangibleConditionObserver.cpp b/engine/server/library/serverGame/src/shared/object/TangibleConditionObserver.cpp index ab9526b4..b9f4cad8 100755 --- a/engine/server/library/serverGame/src/shared/object/TangibleConditionObserver.cpp +++ b/engine/server/library/serverGame/src/shared/object/TangibleConditionObserver.cpp @@ -27,10 +27,10 @@ TangibleConditionObserver::TangibleConditionObserver(TangibleObject const *who, TangibleConditionObserver::~TangibleConditionObserver() { - if (m_tangibleObject != NULL) + if (m_tangibleObject != nullptr) { const CreatureObject * creature = m_tangibleObject->asCreatureObject(); - if (creature != NULL) + if (creature != nullptr) { int currentCondition = creature->getCondition(); if ((m_oldCondition & TangibleObject::C_hibernating) != 0 && (currentCondition & TangibleObject::C_hibernating) == 0) @@ -50,8 +50,8 @@ TangibleConditionObserver::~TangibleConditionObserver() if ((wasInvulnerable != isInvulnerable) && !m_tangibleObject->getObservers().empty()) { // did the object's "pvp sync" status change because of the invulnerability change? - bool const wasPvpSync = PvpUpdateObserver::satisfyPvpSyncCondition(m_tangibleObject->isNonPvpObject(), wasInvulnerable, (m_tangibleObject->asCreatureObject() != NULL), m_tangibleObject->getPvpFaction()); - bool const isPvpSync = PvpUpdateObserver::satisfyPvpSyncCondition(m_tangibleObject->isNonPvpObject(), isInvulnerable, (m_tangibleObject->asCreatureObject() != NULL), m_tangibleObject->getPvpFaction()); + bool const wasPvpSync = PvpUpdateObserver::satisfyPvpSyncCondition(m_tangibleObject->isNonPvpObject(), wasInvulnerable, (m_tangibleObject->asCreatureObject() != nullptr), m_tangibleObject->getPvpFaction()); + bool const isPvpSync = PvpUpdateObserver::satisfyPvpSyncCondition(m_tangibleObject->isNonPvpObject(), isInvulnerable, (m_tangibleObject->asCreatureObject() != nullptr), m_tangibleObject->getPvpFaction()); if (wasPvpSync != isPvpSync) { diff --git a/engine/server/library/serverGame/src/shared/object/TangibleObject.cpp b/engine/server/library/serverGame/src/shared/object/TangibleObject.cpp index 196f9ce9..3602f9a6 100755 --- a/engine/server/library/serverGame/src/shared/object/TangibleObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/TangibleObject.cpp @@ -354,13 +354,13 @@ static const std::string NOMOVE_SCRIPT = "item.special.nomove"; static const std::string OBJVAR_DECLINE_DUEL = "decline_duel"; -const SharedObjectTemplate * TangibleObject::m_defaultSharedTemplate = NULL; +const SharedObjectTemplate * TangibleObject::m_defaultSharedTemplate = nullptr; //----------------------------------------------------------------------- TangibleObject::TangibleObject(const ServerTangibleObjectTemplate* newTemplate) : ServerObject(newTemplate), - m_combatData(NULL), + m_combatData(nullptr), m_pvpType(), m_pvpMercenaryType(PvpType_Neutral), m_pvpFutureType(-1), @@ -392,7 +392,7 @@ TangibleObject::TangibleObject(const ServerTangibleObjectTemplate* newTemplate) m_accessList(), m_guildAccessList(), m_effectsMap(), - m_npcConversation(NULL), + m_npcConversation(nullptr), m_conversations() { WARNING_STRICT_FATAL(!getSharedTemplate(), ("Tried to create a TANGIBLE %s object without a shared template!\n", newTemplate->DataResource::getName())); @@ -469,7 +469,7 @@ TangibleObject::TangibleObject(const ServerTangibleObjectTemplate* newTemplate) { Appearance * newAppearance = AppearanceTemplateList::createAppearance(appearanceString.c_str()); - if(newAppearance != NULL) + if(newAppearance != nullptr) { setAppearance(newAppearance); } else { @@ -522,11 +522,11 @@ TangibleObject::~TangibleObject() //-- This must be the first line in the destructor to invalidate any watchers watching this object nullWatchers(); - if (getSynchronizedUi() != NULL) + if (getSynchronizedUi() != nullptr) { CraftingToolSyncUi * sync = dynamic_cast( getSynchronizedUi()); - if (sync != NULL) + if (sync != nullptr) { if (isAuthoritative() && isCraftingTool()) { @@ -561,7 +561,7 @@ TangibleObject::~TangibleObject() CombatTracker::removeDefender(this); - if (m_combatData != NULL) + if (m_combatData != nullptr) { if (isAuthoritative()) { @@ -598,16 +598,16 @@ TangibleObject::~TangibleObject() } delete m_combatData; - m_combatData = NULL; + m_combatData = nullptr; if (!isPlayerControlled()) ObjectTracker::removeCombatAI(); } - if (m_npcConversation != NULL) + if (m_npcConversation != nullptr) { delete m_npcConversation; - m_npcConversation = NULL; + m_npcConversation = nullptr; } ObjectTracker::removeTangible(); @@ -625,7 +625,7 @@ void TangibleObject::initializeFirstTimeObject() // set up armor from the template const ServerTangibleObjectTemplate * newTemplate = safe_cast< const ServerTangibleObjectTemplate *>(getObjectTemplate()); - if (newTemplate != NULL) + if (newTemplate != nullptr) { setInvulnerable(newTemplate->getInvulnerable()); @@ -634,7 +634,7 @@ void TangibleObject::initializeFirstTimeObject() initializeVisibility(); const ServerArmorTemplate * armorTemplate = newTemplate->getArmor(); - if (armorTemplate != NULL) + if (armorTemplate != nullptr) { int const rating = static_cast(armorTemplate->getRating()); if ( rating < static_cast(ServerArmorTemplate::AR_armorNone) @@ -729,7 +729,7 @@ void TangibleObject::endBaselines() // check for existence of objvar to enable/disable m_logCommandEnqueue CommandQueue * const queue = getCommandQueue(); - if (queue != NULL) + if (queue != nullptr) { queue->setLogCommandEnqueue(getObjVars().hasItem("debuggingLogCommandEnqueue")); } @@ -781,7 +781,7 @@ void TangibleObject::onLoadedFromDatabase() params.addParam(prototypeId, "prototype"); ScriptDictionaryPtr dictionary; getScriptObject()->makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(getNetworkId(), @@ -973,16 +973,16 @@ TangibleObject * TangibleObject::getTangibleObject(NetworkId const & networkId) TangibleObject * TangibleObject::asTangibleObject(Object * object) { - ServerObject * serverObject = (object != NULL) ? object->asServerObject() : NULL; - return (serverObject != NULL) ? serverObject->asTangibleObject() : NULL; + ServerObject * serverObject = (object != nullptr) ? object->asServerObject() : nullptr; + return (serverObject != nullptr) ? serverObject->asTangibleObject() : nullptr; } //----------------------------------------------------------------------- TangibleObject const * TangibleObject::asTangibleObject(Object const * object) { - ServerObject const * serverObject = (object != NULL) ? object->asServerObject() : NULL; - return (serverObject != NULL) ? serverObject->asTangibleObject() : NULL; + ServerObject const * serverObject = (object != nullptr) ? object->asServerObject() : nullptr; + return (serverObject != nullptr) ? serverObject->asTangibleObject() : nullptr; } //----------------------------------------------------------------------- @@ -1010,13 +1010,13 @@ const SharedObjectTemplate * TangibleObject::getDefaultSharedTemplate(void) cons { static const ConstCharCrcLowerString templateName("object/tangible/base/shared_tangible_default.iff"); - if (m_defaultSharedTemplate == NULL) + if (m_defaultSharedTemplate == nullptr) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create " + WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create " "default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) ExitChain::add (removeDefaultTemplate, "TangibleObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -1029,10 +1029,10 @@ static const ConstCharCrcLowerString templateName("object/tangible/base/shared_t */ void TangibleObject::removeDefaultTemplate(void) { - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } // TangibleObject::removeDefaultTemplate @@ -1184,7 +1184,7 @@ void TangibleObject::appearanceDataModified(const std::string& value) void TangibleObject::getEquippedItems(uint32 combatBone, std::vector &items) const { SlottedContainer const * const container = ContainerInterface::getSlottedContainer(*this); - if (container == NULL) + if (container == nullptr) return; std::vector itemIds; @@ -1194,10 +1194,10 @@ void TangibleObject::getEquippedItems(uint32 combatBone, std::vector(object); - if (item != NULL) + if (item != nullptr) items.push_back(item); } } @@ -1219,7 +1219,7 @@ TangibleObject * TangibleObject::getRandomEquippedItem(uint32 combatBone) const if (items.empty()) { - return NULL; + return nullptr; } int index = Random::random(0, items.size() - 1); @@ -1401,17 +1401,17 @@ void TangibleObject::conclude() PROFILER_AUTO_BLOCK_DEFINE("TangibleObject::conclude"); // if we are a crafting tool, conclude our prototype and manf schematic - if (getSynchronizedUi() != NULL) + if (getSynchronizedUi() != nullptr) { const CraftingToolSyncUi * sync = dynamic_cast( getSynchronizedUi()); - if (sync != NULL) + if (sync != nullptr) { Object * object = sync->getPrototype().getObject(); - if (object != NULL) + if (object != nullptr) object->conclude(); object = sync->getManfSchematic().getObject(); - if (object != NULL) + if (object != nullptr) object->conclude(); } } @@ -1683,12 +1683,12 @@ void TangibleObject::setPvpMercenaryFaction(Pvp::FactionId factionId, Pvp::PvpTy { if (PvpData::isImperialFactionId(m_pvpMercenaryFaction.get())) { - IGNORE_RETURN(setObjVarItem("factionalHelper.timeStopHelpingImperial", static_cast(::time(NULL)))); + IGNORE_RETURN(setObjVarItem("factionalHelper.timeStopHelpingImperial", static_cast(::time(nullptr)))); removeObjVarItem("factionalHelper.timeStopHelpingRebel"); } else if (PvpData::isRebelFactionId(m_pvpMercenaryFaction.get())) { - IGNORE_RETURN(setObjVarItem("factionalHelper.timeStopHelpingRebel", static_cast(::time(NULL)))); + IGNORE_RETURN(setObjVarItem("factionalHelper.timeStopHelpingRebel", static_cast(::time(nullptr)))); removeObjVarItem("factionalHelper.timeStopHelpingImperial"); } } @@ -1821,11 +1821,11 @@ void TangibleObject::onPermanentlyDestroyed() if (isCraftingTool()) { ServerObject * owner = ServerWorld::findObjectByNetworkId(getOwnerId()); - if (owner != NULL && owner->asCreatureObject() != NULL) + if (owner != nullptr && owner->asCreatureObject() != nullptr) { PlayerObject * player = PlayerCreatureController::getPlayerObject( owner->asCreatureObject()); - if (player != NULL && player->isCrafting() && player->getCraftingTool() == getNetworkId()) + if (player != nullptr && player->isCrafting() && player->getCraftingTool() == getNetworkId()) player->stopCrafting(false); } } @@ -1942,11 +1942,11 @@ bool TangibleObject::onContainerAboutToTransfer(ServerObject * destination, Serv } } } - if (destination != NULL && getObjVars().hasItem(OBJVAR_BIO_LINK_ID)) + if (destination != nullptr && getObjVars().hasItem(OBJVAR_BIO_LINK_ID)) { // if this item is bio-linked and a player is trying to equip it, make // sure the link id matches the player's id - if (destination->asCreatureObject() != NULL) + if (destination->asCreatureObject() != nullptr) { // allow holograms to have biolinked items transferred to them int hologramVal = 0; @@ -2058,7 +2058,7 @@ Footprint *TangibleObject::getFootprint() if (property) return property->getFootprint(); else - return NULL; + return nullptr; } //----------------------------------------------------------------------- @@ -2069,7 +2069,7 @@ Footprint const *TangibleObject::getFootprint() const if (property) return property->getFootprint(); else - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -2151,9 +2151,9 @@ int TangibleObject::alterHitPoints(int delta, bool ignoreInvulnerable, #ifdef _DEBUG char debugBuffer[1024]; const char * craftedString = ""; - Client *client = NULL; + Client *client = nullptr; ServerObject * sourceObject = safe_cast(NetworkIdManager::getObjectById(source)); - if (source != NetworkId::cms_invalid && sourceObject != NULL) + if (source != NetworkId::cms_invalid && sourceObject != nullptr) client = sourceObject->getClient(); #endif @@ -2171,7 +2171,7 @@ int TangibleObject::alterHitPoints(int delta, bool ignoreInvulnerable, "from %d to %d\n", craftedString, getNetworkId().getValueString().c_str(), totalHitPoints, m_damageTaken.get(), totalDamageTaken); DEBUG_REPORT_LOG (true, ("%s", debugBuffer)); - if (source != NetworkId::cms_invalid && client != NULL) + if (source != NetworkId::cms_invalid && client != nullptr) ConsoleMgr::broadcastString(debugBuffer, client); } #endif @@ -2200,7 +2200,7 @@ int TangibleObject::alterHitPoints(int delta, bool ignoreInvulnerable, snprintf(debugBuffer, sizeof(debugBuffer), "%s object %s has been " "disabled\n", craftedString, getNetworkId().getValueString().c_str()); DEBUG_REPORT_LOG (true, ("%s", debugBuffer)); - if (source != NetworkId::cms_invalid && client != NULL) + if (source != NetworkId::cms_invalid && client != nullptr) ConsoleMgr::broadcastString(debugBuffer, client); } #endif @@ -2283,7 +2283,7 @@ void TangibleObject::updatePlanetServerInternal(const bool forceUpdate) const if ((forceUpdate || getPositionChanged()) && (!ContainerInterface::getContainedByObject(*this) || getInterestRadius() > 0)) { Object const * const topmostContainer = ContainerInterface::getTopmostContainer(*this); - FATAL(!topmostContainer, ("Object %s was contained by something, but getTopmostContainer() returned NULL\n",getNetworkId().getValueString().c_str())); + FATAL(!topmostContainer, ("Object %s was contained by something, but getTopmostContainer() returned nullptr\n",getNetworkId().getValueString().c_str())); Vector const &position = topmostContainer->getPosition_p(); UpdateObjectOnPlanetMessage const msg( @@ -2313,7 +2313,7 @@ void TangibleObject::updatePlanetServerInternal(const bool forceUpdate) const */ void TangibleObject::clearDamageList(void) { - if (m_combatData != NULL) + if (m_combatData != nullptr) { m_combatData->defenseData.damage.clear(); } @@ -2442,7 +2442,7 @@ void TangibleObject::clearHateList() } else { - sendControllerMessageToAuthServer(CM_clearHateList, NULL); + sendControllerMessageToAuthServer(CM_clearHateList, nullptr); } } @@ -2476,7 +2476,7 @@ bool TangibleObject::isHatedBy(Object * const object) bool result = false; TangibleObject * const hatedByTangibleObject = TangibleObject::asTangibleObject(object); - if (hatedByTangibleObject != NULL) + if (hatedByTangibleObject != nullptr) { HateList::UnSortedList const & hateList = hatedByTangibleObject->getUnSortedHateList(); @@ -2534,7 +2534,7 @@ void TangibleObject::resetHateTimer() } else { - sendControllerMessageToAuthServer(CM_resetHateTimer, NULL); + sendControllerMessageToAuthServer(CM_resetHateTimer, nullptr); } } @@ -2625,11 +2625,11 @@ void TangibleObject::setCraftedId(const NetworkId & id) IGNORE_RETURN(setObjVarItem(OBJVAR_CRAFTING_SCHEMATIC, id)); setCondition(C_crafted); const Object * object = NetworkIdManager::getObjectById(id); - if (object != NULL) + if (object != nullptr) { const ManufactureSchematicObject * schematic = dynamic_cast< const ManufactureSchematicObject *>(object); - if (schematic != NULL) + if (schematic != nullptr) m_sourceDraftSchematic = schematic->getDraftSchematic(); } } @@ -2869,7 +2869,7 @@ bool TangibleObject::startCraftingSession(CreatureObject & crafter) UNREF(myIdString); // needed for release mode PlayerObject * crafterPlayer = PlayerCreatureController::getPlayerObject(&crafter); - if (crafterPlayer == NULL) + if (crafterPlayer == nullptr) return false; // make sure we are a crafting tool @@ -2909,7 +2909,7 @@ bool TangibleObject::startCraftingSession(CreatureObject & crafter) // make sure the output slot is empty SlottedContainer const * const slotContainer = ContainerInterface::getSlottedContainer(*this); - if (slotContainer == NULL) + if (slotContainer == nullptr) { DEBUG_WARNING(true, ("Crafting tool %s does not have a container!", myIdString)); return false; @@ -2938,7 +2938,7 @@ bool TangibleObject::startCraftingSession(CreatureObject & crafter) for (iter = schematics.begin(); iter != schematics.end(); ++iter) { const DraftSchematicObject * schematic = DraftSchematicObject::getSchematic((*iter).first.first); - if (schematic != NULL && ((myType & ServerObjectTemplate::CT_genericItem) != 0 || + if (schematic != nullptr && ((myType & ServerObjectTemplate::CT_genericItem) != 0 || ((schematic->getCategory() & myType) != 0))) { // make sure the player has all the skill commands needed for the @@ -3068,11 +3068,11 @@ bool TangibleObject::stopCraftingSession(void) bool TangibleObject::isIngredientInHopper(const NetworkId & ingredientId) const { ServerObject const * const hopper = getIngredientHopper(); - if (hopper == NULL) + if (hopper == nullptr) return false; Object const * const ingredient = CachedNetworkId(ingredientId).getObject(); - if (ingredient == NULL) + if (ingredient == nullptr) return false; return ContainerInterface::isNestedWithin(*ingredient, getNetworkId()); @@ -3098,15 +3098,15 @@ static const SlotId hopperSlotId(SlotIdManager::findSlotId(INGREDIENT_HOPPER_SLO { DEBUG_WARNING(true, ("Tried to get input hopper for non-crafting station " "object %s", myIdString)); - return NULL; + return nullptr; } // get the ingredient hopper SlottedContainer const * const container = ContainerInterface::getSlottedContainer(*this); - if (container == NULL) + if (container == nullptr) { DEBUG_WARNING(true, ("Crafting tool %s does not have a container!", myIdString)); - return NULL; + return nullptr; } Container::ContainerErrorCode tmp = Container::CEC_Success; Container::ContainedItem hopperId = container->getObjectInSlot(hopperSlotId, tmp); @@ -3114,14 +3114,14 @@ static const SlotId hopperSlotId(SlotIdManager::findSlotId(INGREDIENT_HOPPER_SLO { DEBUG_WARNING(true, ("Crafting tool %s does not have a ingredient " "hopper!", myIdString)); - return NULL; + return nullptr; } ServerObject * hopper = safe_cast(hopperId.getObject()); - if (hopper == NULL) + if (hopper == nullptr) { DEBUG_WARNING(true, ("Can't find object for ingredient hopper id %s", hopperId.getValueString().c_str())); - return NULL; + return nullptr; } return hopper; @@ -3150,16 +3150,16 @@ static const SlotId outputSlotId(SlotIdManager::findSlotId(MANF_OUTPUT_SLOT_NAME // get output slot SlottedContainer const * const slotContainer = ContainerInterface::getSlottedContainer(*this); - if (slotContainer == NULL) + if (slotContainer == nullptr) { DEBUG_WARNING(true, ("Crafting tool %s does not have a container!", myIdString)); return false; } // make sure the transferer is in the final stage of crafting - if (transferer == NULL) + if (transferer == nullptr) { - DEBUG_WARNING(true, ("addObjectToOutputSlot, NULL transferer")); + DEBUG_WARNING(true, ("addObjectToOutputSlot, nullptr transferer")); return false; } NetworkId crafterVarId(NetworkId::cms_invalid); @@ -3178,14 +3178,14 @@ static const SlotId outputSlotId(SlotIdManager::findSlotId(MANF_OUTPUT_SLOT_NAME return false; } CreatureObject const * const creatureTransferer = transferer->asCreatureObject(); - if (creatureTransferer == NULL) + if (creatureTransferer == nullptr) { DEBUG_WARNING(true, ("addObjectToOutputSlot, transferer %s is not a " "creature", transferer->getNetworkId().getValueString().c_str())); return false; } PlayerObject const * const creaturePlayer = PlayerCreatureController::getPlayerObject(creatureTransferer); - if (creaturePlayer == NULL) + if (creaturePlayer == nullptr) return false; if (creaturePlayer->getCraftingStage() != Crafting::CS_finish) @@ -3197,11 +3197,11 @@ static const SlotId outputSlotId(SlotIdManager::findSlotId(MANF_OUTPUT_SLOT_NAME } // if the object is our prototype, clear the prototype - if (getSynchronizedUi() != NULL) + if (getSynchronizedUi() != nullptr) { CraftingToolSyncUi * sync = dynamic_cast( getSynchronizedUi()); - if (sync != NULL) + if (sync != nullptr) { if (sync->getPrototype() == object.getNetworkId()) { @@ -3212,7 +3212,7 @@ static const SlotId outputSlotId(SlotIdManager::findSlotId(MANF_OUTPUT_SLOT_NAME // put the object in the slot Container::ContainerErrorCode tmp = Container::CEC_Success; - if (!ContainerInterface::transferItemToSlottedContainer(*this, object, outputSlotId, NULL, tmp)) + if (!ContainerInterface::transferItemToSlottedContainer(*this, object, outputSlotId, nullptr, tmp)) { DEBUG_WARNING(true, ("Failed to transfer object %s to crafting " "tool %s", object.getNetworkId().getValueString().c_str(), @@ -3250,7 +3250,7 @@ ManufactureSchematicObject * TangibleObject::getCraftingManufactureSchematic(voi { DEBUG_WARNING(true, ("Tried to get non-crafting tool " "object %s", myIdString)); - return NULL; + return nullptr; } SlottedContainer const * const container = ContainerInterface::getSlottedContainer(*this); @@ -3264,7 +3264,7 @@ ManufactureSchematicObject * TangibleObject::getCraftingManufactureSchematic(voi else { DEBUG_WARNING(true, ("ManufactureSchematicObject doesn't have a slotted container.")); - return NULL; + return nullptr; } } // TangibleObject::getCraftingManufactureSchematic @@ -3282,17 +3282,17 @@ ManufactureSchematicObject * TangibleObject::removeCraftingManufactureSchematic( UNREF(myIdString); // needed for release mode // make sure we are a crafting tool - if (!isCraftingTool() || getSynchronizedUi() == NULL) + if (!isCraftingTool() || getSynchronizedUi() == nullptr) { DEBUG_WARNING(true, ("Tried to get non-crafting tool " "object %s", myIdString)); - return NULL; + return nullptr; } CraftingToolSyncUi * sync = dynamic_cast( getSynchronizedUi()); - if (sync == NULL) - return NULL; + if (sync == nullptr) + return nullptr; ManufactureSchematicObject * schematic = safe_cast( sync->getManfSchematic().getObject()); @@ -3320,7 +3320,7 @@ void TangibleObject::setCraftingManufactureSchematic(ManufactureSchematicObject UNREF(myIdString); // needed for release mode // make sure we are a crafting tool - if (!isCraftingTool() || getSynchronizedUi() == NULL) + if (!isCraftingTool() || getSynchronizedUi() == nullptr) { DEBUG_WARNING(true, ("Tried to get non-crafting tool " "object %s", myIdString)); @@ -3329,7 +3329,7 @@ void TangibleObject::setCraftingManufactureSchematic(ManufactureSchematicObject CraftingToolSyncUi * sync = dynamic_cast( getSynchronizedUi()); - if (sync == NULL) + if (sync == nullptr) return; // see if there is already a schematic object set @@ -3339,7 +3339,7 @@ void TangibleObject::setCraftingManufactureSchematic(ManufactureSchematicObject // remove the old schematic ServerObject * object = safe_cast(schematicId.getObject()); - if (object == NULL) + if (object == nullptr) { if (schematicId != NetworkId::cms_invalid) { @@ -3358,13 +3358,13 @@ void TangibleObject::setCraftingManufactureSchematic(ManufactureSchematicObject // the schematic isn't in the world or in a container, so we need to // tell the client about it int stationBonus = 0; - ServerObject * crafter = NULL; + ServerObject * crafter = nullptr; NetworkId crafterId; if (getObjVars().getItem(OBJVAR_CRAFTING_CRAFTER,crafterId)) { crafter = safe_cast(NetworkIdManager::getObjectById(crafterId)); } - if (crafter != NULL) + if (crafter != nullptr) { sync->setManfSchematic(CachedNetworkId(schematic), CachedNetworkId(*crafter), true); @@ -3373,7 +3373,7 @@ void TangibleObject::setCraftingManufactureSchematic(ManufactureSchematicObject // it has const PlayerObject * player = PlayerCreatureController::getPlayerObject( crafter->asCreatureObject()); - if (player != NULL && player->getCraftingStation().getObject() != NULL) + if (player != nullptr && player->getCraftingStation().getObject() != nullptr) { player->getCraftingStation().getObject()->asServerObject()-> getObjVars().getItem(OBJVAR_CRAFTING_STATIONMOD, stationBonus); @@ -3436,11 +3436,11 @@ void TangibleObject::clearCraftingManufactureSchematic(void) } // get our ui - CraftingToolSyncUi * sync = NULL; - if (getSynchronizedUi() != NULL) + CraftingToolSyncUi * sync = nullptr; + if (getSynchronizedUi() != nullptr) sync = dynamic_cast(getSynchronizedUi()); - if (schematicId == CachedNetworkId::cms_cachedInvalid && sync == NULL) + if (schematicId == CachedNetworkId::cms_cachedInvalid && sync == nullptr) { // no schematic return; @@ -3448,7 +3448,7 @@ void TangibleObject::clearCraftingManufactureSchematic(void) if (schematicId == CachedNetworkId::cms_invalid) schematicId = sync->getManfSchematic(); - else if (sync != NULL && sync->getManfSchematic() != CachedNetworkId::cms_invalid && + else if (sync != nullptr && sync->getManfSchematic() != CachedNetworkId::cms_invalid && schematicId != sync->getManfSchematic()) { WARNING(true, ("TangibleObject::clearCraftingManufactureSchematic " @@ -3456,7 +3456,7 @@ void TangibleObject::clearCraftingManufactureSchematic(void) "in its ui!!!", getNetworkId().getValueString().c_str(), schematicId.getValueString().c_str(), sync->getManfSchematic().getValueString().c_str())); - if (schematicId.getObject() != NULL) + if (schematicId.getObject() != nullptr) { schematicId.getObject()->asServerObject()->permanentlyDestroy( DeleteReasons::Consumed); @@ -3472,9 +3472,9 @@ void TangibleObject::clearCraftingManufactureSchematic(void) } // get the schematic - ManufactureSchematicObject * manfSchematic = NULL; + ManufactureSchematicObject * manfSchematic = nullptr; ServerObject * object = safe_cast(schematicId.getObject()); - if (object == NULL && schematicId != CachedNetworkId::cms_invalid) + if (object == nullptr && schematicId != CachedNetworkId::cms_invalid) { WARNING_STRICT_FATAL(true, ("Can't find object for manufactring schematic " "id %s", schematicId.getValueString().c_str())); @@ -3482,7 +3482,7 @@ void TangibleObject::clearCraftingManufactureSchematic(void) else manfSchematic = safe_cast(object); - if (manfSchematic != NULL) + if (manfSchematic != nullptr) { NetworkId crafterId; if (getObjVars().getItem(OBJVAR_CRAFTING_CRAFTER,crafterId)) @@ -3492,7 +3492,7 @@ void TangibleObject::clearCraftingManufactureSchematic(void) // in the tool CreatureObject * const crafter = dynamic_cast(NetworkIdManager::getObjectById(crafterId)); PlayerObject * const crafterPlayer = PlayerCreatureController::getPlayerObject(crafter); - if (!manfSchematic->mustDestroyIngredients() || (crafterPlayer != NULL && + if (!manfSchematic->mustDestroyIngredients() || (crafterPlayer != nullptr && crafterPlayer->getCraftingStage() == Crafting::CS_assembly)) { crafterPlayer->setAllowEmptySlot(true); @@ -3526,9 +3526,9 @@ void TangibleObject::clearCraftingManufactureSchematic(void) } } - if (sync != NULL) + if (sync != nullptr) sync->setManfSchematic(CachedNetworkId::cms_cachedInvalid, CachedNetworkId::cms_cachedInvalid, true); - if (object != NULL) + if (object != nullptr) { object->permanentlyDestroy(DeleteReasons::Consumed); } @@ -3554,17 +3554,17 @@ ServerObject * TangibleObject::getCraftingPrototype(void) const UNREF(myIdString); // needed for release mode // make sure we are a crafting tool - if (!isCraftingTool() || getSynchronizedUi() == NULL) + if (!isCraftingTool() || getSynchronizedUi() == nullptr) { DEBUG_WARNING(true, ("Tried to get non-crafting tool " "object %s", myIdString)); - return NULL; + return nullptr; } const CraftingToolSyncUi * sync = dynamic_cast( getSynchronizedUi()); - if (sync == NULL) - return NULL; + if (sync == nullptr) + return nullptr; return safe_cast(sync->getPrototype().getObject()); } // TangibleObject::getCraftingPrototype @@ -3586,7 +3586,7 @@ void TangibleObject::setCraftingPrototype(ServerObject & prototype) UNREF(myIdString); // needed for release mode // make sure we are a crafting tool - if (!isCraftingTool() || getSynchronizedUi() == NULL) + if (!isCraftingTool() || getSynchronizedUi() == nullptr) { DEBUG_WARNING(true, ("Tried to get non-crafting tool " "object %s", myIdString)); @@ -3595,7 +3595,7 @@ void TangibleObject::setCraftingPrototype(ServerObject & prototype) CraftingToolSyncUi * sync = dynamic_cast( getSynchronizedUi()); - if (sync == NULL) + if (sync == nullptr) return; // see if there is already a prototype object set @@ -3605,7 +3605,7 @@ void TangibleObject::setCraftingPrototype(ServerObject & prototype) // remove the old prototype ServerObject * object = safe_cast(prototypeId.getObject()); - if (object == NULL) + if (object == nullptr) { if (prototypeId != NetworkId::cms_invalid) { @@ -3624,7 +3624,7 @@ void TangibleObject::setCraftingPrototype(ServerObject & prototype) // about it Container::ContainerErrorCode tmp = Container::CEC_Success; if (!ContainerInterface::transferItemToSlottedContainer(*this, prototype, - getCraftingPrototypeSlotId(), NULL, tmp)) + getCraftingPrototypeSlotId(), nullptr, tmp)) { // see if there is something in the slot, and delete it if there is bool failed = true; @@ -3634,13 +3634,13 @@ void TangibleObject::setCraftingPrototype(ServerObject & prototype) getCraftingPrototypeSlotId(), tmp); if (oldItem != prototype.getNetworkId()) { - if (oldItem.getObject() != NULL) + if (oldItem.getObject() != nullptr) { safe_cast(oldItem.getObject())->permanentlyDestroy( DeleteReasons::Consumed); // try the transfer again if (ContainerInterface::transferItemToSlottedContainer(*this, - prototype, getCraftingPrototypeSlotId(), NULL, tmp)) + prototype, getCraftingPrototypeSlotId(), nullptr, tmp)) { failed = false; } @@ -3678,7 +3678,7 @@ void TangibleObject::clearCraftingPrototype(void) UNREF(myIdString); // needed for release mode // make sure we are a crafting tool - if (!isCraftingTool() || getSynchronizedUi() == NULL) + if (!isCraftingTool() || getSynchronizedUi() == nullptr) { DEBUG_WARNING(true, ("Tried to get non-crafting tool " "object %s", myIdString)); @@ -3687,12 +3687,12 @@ void TangibleObject::clearCraftingPrototype(void) CraftingToolSyncUi * sync = dynamic_cast( getSynchronizedUi()); - if (sync == NULL) + if (sync == nullptr) return; const CachedNetworkId & prototypeId = sync->getPrototype(); ServerObject * object = safe_cast(prototypeId.getObject()); - if (object != NULL) + if (object != nullptr) { object->permanentlyDestroy(DeleteReasons::Consumed); } @@ -3704,7 +3704,7 @@ void TangibleObject::clearCraftingPrototype(void) Container::ContainerErrorCode error; const Container::ContainedItem & contents = container->getObjectInSlot( getCraftingPrototypeSlotId(), error); - if (contents.getObject() != NULL) + if (contents.getObject() != nullptr) { safe_cast(contents.getObject())->permanentlyDestroy( DeleteReasons::Consumed); @@ -3856,7 +3856,7 @@ void TangibleObject::forceExecuteCommand(Command const &command, NetworkId const { CommandQueue * const queue = getCommandQueue(); - if (queue != NULL) + if (queue != nullptr) { queue->cancelCurrentCommand(); } @@ -3948,7 +3948,7 @@ void TangibleObject::initializeVisibility() { const ServerTangibleObjectTemplate * myTemplate = safe_cast< const ServerTangibleObjectTemplate *>(getObjectTemplate()); - if (myTemplate != NULL) + if (myTemplate != nullptr) { bool visible = false; for (size_t i = 0; i < myTemplate->getVisibleFlagsCount(); ++i) @@ -3999,7 +3999,7 @@ void TangibleObject::visibilityDataModified() { // show the object const TriggerVolume * triggerVolume = getTriggerVolume(NetworkTriggerVolumeNamespace::NetworkTriggerVolumeName); - if (triggerVolume != NULL) + if (triggerVolume != nullptr) { std::vector observers; ServerWorld::findPlayerCreaturesInRange(getPosition_w(), triggerVolume->getRadius(), observers); @@ -4017,7 +4017,7 @@ void TangibleObject::visibilityDataModified() if (isVisible() && isHidden() && !m_passiveRevealPlayerCharacter.empty()) { const TriggerVolume * triggerVolume = getTriggerVolume(NetworkTriggerVolumeNamespace::NetworkTriggerVolumeName); - if (triggerVolume != NULL) + if (triggerVolume != nullptr) { std::vector possibleObservers; ServerWorld::findPlayerCreaturesInRange(getPosition_w(), triggerVolume->getRadius(), possibleObservers); @@ -4077,10 +4077,10 @@ bool TangibleObject::isVisibleOnClient(Client const &client) const // if the client's character is grouped with the the owner, then he can see it. const CreatureObject * owner = safe_cast(ownerId.getObject()); - if (owner != NULL) + if (owner != nullptr) { const GroupObject * group = owner->getGroup(); - if (group != NULL) + if (group != nullptr) { if (group->isGroupMember(characterObject->getNetworkId())) return true; @@ -4129,7 +4129,7 @@ static int datatable_max_encumbrance_col = -1; encumbrances.clear(); DataTable * dt = DataTableManager::getTable(DATATABLE_ARMOR, true); - if (dt == NULL) + if (dt == nullptr) return false; else if (datatable_type_col == -1) { @@ -4690,7 +4690,7 @@ void TangibleObject::getAttributesForCraftingTool (AttributeVector & data) const // see if there is an object in the output hopper bool hasPrototype = false; SlottedContainer const * const slotContainer = ContainerInterface::getSlottedContainer(*this); - if (slotContainer != NULL) + if (slotContainer != nullptr) { Container::ContainerErrorCode tmp = Container::CEC_Success; if (slotContainer->getObjectInSlot(outputSlotId, tmp) != Container::ContainedItem::cms_invalid) @@ -5121,7 +5121,7 @@ void TangibleObject::handleCMessageTo(const MessageToPayload &message) std::string const & sceneId = ServerWorld::getSceneId(); Vector const &position = findPosition_w(); Region const * const region = RegionMaster::getSmallestVisibleRegionAtPoint(sceneId, position.x, position.z); - if (region != NULL) + if (region != nullptr) regionName = Unicode::wideToNarrow(region->getName()); int const cityId = CityInterface::getCityAtLocation(sceneId, static_cast(position.x), static_cast(position.z), 0); @@ -5248,7 +5248,7 @@ void TangibleObject::setInvulnerable(bool invulnerable) GameScriptObject * const gameScriptObject = getScriptObject(); - if (gameScriptObject != NULL) + if (gameScriptObject != nullptr) { ScriptParams scriptParams; scriptParams.addParam(hasCondition(ServerTangibleObjectTemplate::C_invulnerable)); @@ -5451,8 +5451,8 @@ void TangibleObject::setPvpable(bool pvpable) if ((oldPvpable != pvpable) && !getObservers().empty()) { // did the object's "pvp sync" status change because of the Pvpable change? - bool const wasPvpSync = PvpUpdateObserver::satisfyPvpSyncCondition(!oldPvpable, hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (asCreatureObject() != NULL), getPvpFaction()); - bool const isPvpSync = PvpUpdateObserver::satisfyPvpSyncCondition(!pvpable, hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (asCreatureObject() != NULL), getPvpFaction()); + bool const wasPvpSync = PvpUpdateObserver::satisfyPvpSyncCondition(!oldPvpable, hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (asCreatureObject() != nullptr), getPvpFaction()); + bool const isPvpSync = PvpUpdateObserver::satisfyPvpSyncCondition(!pvpable, hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (asCreatureObject() != nullptr), getPvpFaction()); if (wasPvpSync != isPvpSync) { @@ -5557,8 +5557,8 @@ void TangibleObject::AppearanceDataCallback::modified(TangibleObject &target, co target.appearanceDataModified(value); Object * const objectContainer = ContainerInterface::getContainedByObject(target); - ServerObject * const serverContainer = objectContainer ? objectContainer->asServerObject() : NULL; - TangibleObject * const tangibleContainer = serverContainer ? serverContainer->asTangibleObject() : NULL; + ServerObject * const serverContainer = objectContainer ? objectContainer->asServerObject() : nullptr; + TangibleObject * const tangibleContainer = serverContainer ? serverContainer->asTangibleObject() : nullptr; if(tangibleContainer) tangibleContainer->onContainedItemAppearanceDataModified(target, oldValue, value); } @@ -5802,7 +5802,7 @@ void TangibleObject::commandQueueEnqueue(Command const &command, NetworkId const else { CommandQueue * const queue = getCommandQueue(); - if (queue != NULL) + if (queue != nullptr) { queue->enqueue(command, targetId, params, sequenceId, clearable, priority); } @@ -5820,7 +5820,7 @@ void TangibleObject::commandQueueRemove(uint32 const sequenceId) else { CommandQueue * const queue = getCommandQueue(); - if (queue != NULL) + if (queue != nullptr) { queue->remove(sequenceId); } @@ -5840,7 +5840,7 @@ void TangibleObject::commandQueueClear() bool TangibleObject::commandQueueHasCommandFromGroup(uint32 groupHash) const { CommandQueue * const queue = getCommandQueue(); - if (queue != NULL) + if (queue != nullptr) { return queue->hasCommandFromGroup(groupHash); } @@ -5852,7 +5852,7 @@ bool TangibleObject::commandQueueHasCommandFromGroup(uint32 groupHash) const void TangibleObject::commandQueueClearCommandsFromGroup(uint32 groupHash, bool force) { CommandQueue * const queue = getCommandQueue(); - if (queue != NULL) + if (queue != nullptr) { queue->clearCommandsFromGroup(groupHash, force); } @@ -5895,12 +5895,12 @@ void TangibleObject::CombatStateChangedCallback::modified(TangibleObject & targe AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(target.getController()); - if (aiCreatureController != NULL) + if (aiCreatureController != nullptr) { aiCreatureController->markCombatStartLocation(); } - if (target.getScriptObject() != NULL) + if (target.getScriptObject() != nullptr) { ScriptParams params; IGNORE_RETURN(target.getScriptObject()->trigAllScripts(Scripting::TRIG_ENTERED_COMBAT, params)); @@ -5926,7 +5926,7 @@ void TangibleObject::CombatStateChangedCallback::modified(TangibleObject & targe target.commandQueueClearCommandsFromGroup(COMMAND_GROUP_COMBAT.getCrc()); - if (target.getScriptObject() != NULL) + if (target.getScriptObject() != nullptr) { ScriptParams params; IGNORE_RETURN(target.getScriptObject()->trigAllScripts(Scripting::TRIG_EXITED_COMBAT, params)); @@ -5985,7 +5985,7 @@ int TangibleObject::getPassiveRevealRange(NetworkId const & target) const void TangibleObject::addPassiveReveal(TangibleObject const & target, int range) { - addPassiveReveal(target.getNetworkId(), range, (NULL != PlayerCreatureController::getPlayerObject(target.asCreatureObject()))); + addPassiveReveal(target.getNetworkId(), range, (nullptr != PlayerCreatureController::getPlayerObject(target.asCreatureObject()))); } //---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/object/TangibleObject.h b/engine/server/library/serverGame/src/shared/object/TangibleObject.h index c05f93bf..f4b80817 100755 --- a/engine/server/library/serverGame/src/shared/object/TangibleObject.h +++ b/engine/server/library/serverGame/src/shared/object/TangibleObject.h @@ -777,7 +777,7 @@ inline uint32 TangibleObject::getSourceDraftSchematic() const inline void TangibleObject::createCombatData() { - if (m_combatData == NULL) + if (m_combatData == nullptr) { m_combatData = new CombatEngineData::CombatData; } diff --git a/engine/server/library/serverGame/src/shared/object/TangibleObject_Conversation.cpp b/engine/server/library/serverGame/src/shared/object/TangibleObject_Conversation.cpp index 7f7aafe5..fbf7881e 100755 --- a/engine/server/library/serverGame/src/shared/object/TangibleObject_Conversation.cpp +++ b/engine/server/library/serverGame/src/shared/object/TangibleObject_Conversation.cpp @@ -47,7 +47,7 @@ bool TangibleObject::startNpcConversation(TangibleObject & npc, const std::strin return false; // test if already in a conversation - if (m_npcConversation != NULL) + if (m_npcConversation != nullptr) return false; if (starter == NpcConversationData::CS_Player) @@ -120,7 +120,7 @@ void TangibleObject::endNpcConversation() { if (isAuthoritative()) { - if (m_npcConversation != NULL) + if (m_npcConversation != nullptr) { // I am a player, end my conversation @@ -128,7 +128,7 @@ void TangibleObject::endNpcConversation() if (isPlayerControlled()) { TangibleObject * const npc = safe_cast(m_npcConversation->getNPC().getObject()); - if (npc != NULL) + if (npc != nullptr) { // trigger OnEndNpcConversation ScriptParams params; @@ -157,13 +157,13 @@ void TangibleObject::endNpcConversation() } else { - WARNING(true,("TangibleObject::endNpcConversation: creature %s has a non-null m_npcConversation pointer %p but is not a player-controlled object!", + WARNING(true,("TangibleObject::endNpcConversation: creature %s has a non-nullptr m_npcConversation pointer %p but is not a player-controlled object!", getNetworkId().getValueString().c_str(), m_npcConversation)); m_conversations.clear(); } delete m_npcConversation; - m_npcConversation = NULL; + m_npcConversation = nullptr; } else { @@ -182,14 +182,14 @@ void TangibleObject::endNpcConversation() { NetworkId const & networkId = *it; TangibleObject * const player = dynamic_cast(NetworkIdManager::getObjectById(networkId)); - if (player != NULL) + if (player != nullptr) player->endNpcConversation(); } } } else { - WARNING(true,("TangibleObject::endNpcConversation: creature %s has a null m_npcConversation pointer but is a player-controlled object!", + WARNING(true,("TangibleObject::endNpcConversation: creature %s has a nullptr m_npcConversation pointer but is a player-controlled object!", getNetworkId().getValueString().c_str())); m_conversations.clear(); } @@ -217,7 +217,7 @@ void TangibleObject::endNpcConversation() */ void TangibleObject::clearNpcConversation() { - if (m_npcConversation != NULL) + if (m_npcConversation != nullptr) { m_npcConversation->clearResponses(); } @@ -234,7 +234,7 @@ void TangibleObject::sendNpcConversationMessage(const StringId & stringId, const { if (isAuthoritative()) { - if (m_npcConversation != NULL) + if (m_npcConversation != nullptr) { NpcConversation::Response response; response.stringId = stringId; @@ -262,7 +262,7 @@ bool TangibleObject::addNpcConversationResponse(const StringId & stringId, const { if (isAuthoritative()) { - if (m_npcConversation != NULL) + if (m_npcConversation != nullptr) { NpcConversation::Response response; response.stringId = stringId; @@ -293,7 +293,7 @@ bool TangibleObject::removeNpcConversationResponse(const StringId & stringId, co bool result = false; if (isAuthoritative()) { - if (m_npcConversation != NULL) + if (m_npcConversation != nullptr) { NpcConversation::Response response; response.stringId = stringId; @@ -319,7 +319,7 @@ void TangibleObject::sendNpcConversationResponses() { if (isAuthoritative()) { - if (m_npcConversation != NULL) + if (m_npcConversation != nullptr) { m_npcConversation->sendResponses(); } @@ -327,7 +327,7 @@ void TangibleObject::sendNpcConversationResponses() else { Controller * const controller = NON_NULL(getController()); - controller->appendMessage(CM_sendNpcConversationResponses, 0.0f, NULL, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_SERVER); + controller->appendMessage(CM_sendNpcConversationResponses, 0.0f, nullptr, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_SERVER); } } @@ -342,10 +342,10 @@ void TangibleObject::respondToNpc(int responseIndex) { if (isAuthoritative()) { - if (m_npcConversation != NULL) + if (m_npcConversation != nullptr) { TangibleObject * const npc = safe_cast(m_npcConversation->getNPC().getObject()); - if (npc == NULL) + if (npc == nullptr) { endNpcConversation(); return; @@ -363,7 +363,7 @@ void TangibleObject::respondToNpc(int responseIndex) { Controller * const controller = getController(); if (controller) - controller->appendMessage(CM_npcConversationSelect, static_cast(responseIndex), NULL, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_SERVER); + controller->appendMessage(CM_npcConversationSelect, static_cast(responseIndex), nullptr, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_SERVER); } } @@ -374,7 +374,7 @@ void TangibleObject::handlePlayerResponseToNpcConversation(const std::string & c if (isAuthoritative()) { TangibleObject * const playerObject = safe_cast(NetworkIdManager::getObjectById(player)); - if (playerObject != NULL) + if (playerObject != nullptr) { // trigger OnNpcConversationResponse ScriptParams params; diff --git a/engine/server/library/serverGame/src/shared/object/UniverseObject.cpp b/engine/server/library/serverGame/src/shared/object/UniverseObject.cpp index 6b283f5e..6e6b8d6c 100755 --- a/engine/server/library/serverGame/src/shared/object/UniverseObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/UniverseObject.cpp @@ -20,7 +20,7 @@ // objvars for dynamic regions const static std::string OBJVAR_DYNAMIC_REGION("dynamic_region"); -const SharedObjectTemplate * UniverseObject::m_defaultSharedTemplate = NULL; +const SharedObjectTemplate * UniverseObject::m_defaultSharedTemplate = nullptr; // ====================================================================== @@ -56,13 +56,13 @@ const SharedObjectTemplate * UniverseObject::getDefaultSharedTemplate(void) cons { static const ConstCharCrcLowerString templateName("object/universe/base/shared_universe_default.iff"); - if (m_defaultSharedTemplate == NULL) + if (m_defaultSharedTemplate == nullptr) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create " + WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create " "default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) ExitChain::add (removeDefaultTemplate, "UniverseObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -75,10 +75,10 @@ static const ConstCharCrcLowerString templateName("object/universe/base/shared_u */ void UniverseObject::removeDefaultTemplate(void) { - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } // UniverseObject::removeDefaultTemplate diff --git a/engine/server/library/serverGame/src/shared/object/WeaponObject.cpp b/engine/server/library/serverGame/src/shared/object/WeaponObject.cpp index 320d0c0b..b19b7cfb 100755 --- a/engine/server/library/serverGame/src/shared/object/WeaponObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/WeaponObject.cpp @@ -25,7 +25,7 @@ //---------------------------------------------------------------------- -const SharedObjectTemplate * WeaponObject::m_defaultSharedTemplate = NULL; +const SharedObjectTemplate * WeaponObject::m_defaultSharedTemplate = nullptr; static const std::string OBJVAR_CERTIFICATION = "weapon.strCertUsed"; @@ -68,13 +68,13 @@ const SharedObjectTemplate * WeaponObject::getDefaultSharedTemplate(void) const { static const ConstCharCrcLowerString templateName("object/weapon/base/shared_weapon_default.iff"); - if (m_defaultSharedTemplate == NULL) + if (m_defaultSharedTemplate == nullptr) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create " + WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create " "default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) ExitChain::add (removeDefaultTemplate, "WeaponObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -87,10 +87,10 @@ static const ConstCharCrcLowerString templateName("object/weapon/base/shared_wea */ void WeaponObject::removeDefaultTemplate(void) { - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } // WeaponObject::removeDefaultTemplate @@ -323,7 +323,7 @@ WeaponObject * WeaponObject::getWeaponObject(NetworkId const & networkId) { ServerObject * serverObject = ServerObject::getServerObject(networkId); - return (serverObject != NULL) ? serverObject->asWeaponObject() : NULL; + return (serverObject != nullptr) ? serverObject->asWeaponObject() : nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerArmorTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerArmorTemplate.cpp index a387b645..2e429325 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerArmorTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerArmorTemplate.cpp @@ -53,7 +53,7 @@ ServerArmorTemplate::~ServerArmorTemplate() for (iter = m_specialProtection.begin(); iter != m_specialProtection.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_specialProtection.clear(); } @@ -105,10 +105,10 @@ Tag ServerArmorTemplate::getTemplateVersion(void) const */ Tag ServerArmorTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerArmorTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerArmorTemplate::getHighestTemplateVersion @@ -122,33 +122,33 @@ ServerArmorTemplate::ArmorRating testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getRating(true); #endif } if (!m_rating.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter rating in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter rating has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter rating has not been defined in template %s!", DataResource::getName())); return base->getRating(); } } ArmorRating value = static_cast(m_rating.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -164,26 +164,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerArmorTemplate * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getIntegrity(true); #endif } if (!m_integrity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter integrity in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter integrity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter integrity has not been defined in template %s!", DataResource::getName())); return base->getIntegrity(); } } @@ -193,9 +193,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getIntegrity(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -212,7 +212,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -228,26 +228,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerArmorTemplate * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getIntegrityMin(true); #endif } if (!m_integrity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter integrity in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter integrity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter integrity has not been defined in template %s!", DataResource::getName())); return base->getIntegrityMin(); } } @@ -257,9 +257,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getIntegrityMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -276,7 +276,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -292,26 +292,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerArmorTemplate * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getIntegrityMax(true); #endif } if (!m_integrity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter integrity in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter integrity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter integrity has not been defined in template %s!", DataResource::getName())); return base->getIntegrityMax(); } } @@ -321,9 +321,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getIntegrityMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -340,7 +340,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -356,26 +356,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerArmorTemplate * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getEffectiveness(true); #endif } if (!m_effectiveness.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter effectiveness in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter effectiveness has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter effectiveness has not been defined in template %s!", DataResource::getName())); return base->getEffectiveness(); } } @@ -385,9 +385,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getEffectiveness(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -404,7 +404,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -420,26 +420,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerArmorTemplate * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getEffectivenessMin(true); #endif } if (!m_effectiveness.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter effectiveness in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter effectiveness has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter effectiveness has not been defined in template %s!", DataResource::getName())); return base->getEffectivenessMin(); } } @@ -449,9 +449,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getEffectivenessMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -468,7 +468,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -484,26 +484,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerArmorTemplate * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getEffectivenessMax(true); #endif } if (!m_effectiveness.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter effectiveness in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter effectiveness has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter effectiveness has not been defined in template %s!", DataResource::getName())); return base->getEffectivenessMax(); } } @@ -513,9 +513,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getEffectivenessMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -532,7 +532,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -542,28 +542,28 @@ UNREF(testData); void ServerArmorTemplate::getSpecialProtection(SpecialProtection &data, int index) const { - const ServerArmorTemplate * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_specialProtectionLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter specialProtection in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter specialProtection has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter specialProtection has not been defined in template %s!", DataResource::getName())); base->getSpecialProtection(data, index); return; } } - if (m_specialProtectionAppend && base != NULL) + if (m_specialProtectionAppend && base != nullptr) { int baseCount = base->getSpecialProtectionCount(); if (index < baseCount) @@ -585,28 +585,28 @@ void ServerArmorTemplate::getSpecialProtection(SpecialProtection &data, int inde void ServerArmorTemplate::getSpecialProtectionMin(SpecialProtection &data, int index) const { - const ServerArmorTemplate * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_specialProtectionLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter specialProtection in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter specialProtection has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter specialProtection has not been defined in template %s!", DataResource::getName())); base->getSpecialProtectionMin(data, index); return; } } - if (m_specialProtectionAppend && base != NULL) + if (m_specialProtectionAppend && base != nullptr) { int baseCount = base->getSpecialProtectionCount(); if (index < baseCount) @@ -628,28 +628,28 @@ void ServerArmorTemplate::getSpecialProtectionMin(SpecialProtection &data, int i void ServerArmorTemplate::getSpecialProtectionMax(SpecialProtection &data, int index) const { - const ServerArmorTemplate * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_specialProtectionLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter specialProtection in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter specialProtection has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter specialProtection has not been defined in template %s!", DataResource::getName())); base->getSpecialProtectionMax(data, index); return; } } - if (m_specialProtectionAppend && base != NULL) + if (m_specialProtectionAppend && base != nullptr) { int baseCount = base->getSpecialProtectionCount(); if (index < baseCount) @@ -673,20 +673,20 @@ size_t ServerArmorTemplate::getSpecialProtectionCount(void) const { if (!m_specialProtectionLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const ServerArmorTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getSpecialProtectionCount(); } size_t count = m_specialProtection.size(); // if we are extending our base template, add it's count - if (m_specialProtectionAppend && m_baseData != NULL) + if (m_specialProtectionAppend && m_baseData != nullptr) { const ServerArmorTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getSpecialProtectionCount(); } @@ -701,26 +701,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerArmorTemplate * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getVulnerability(true); #endif } if (!m_vulnerability.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter vulnerability in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter vulnerability has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter vulnerability has not been defined in template %s!", DataResource::getName())); return base->getVulnerability(); } } @@ -730,9 +730,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getVulnerability(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -749,7 +749,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -765,26 +765,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerArmorTemplate * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getVulnerabilityMin(true); #endif } if (!m_vulnerability.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter vulnerability in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter vulnerability has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter vulnerability has not been defined in template %s!", DataResource::getName())); return base->getVulnerabilityMin(); } } @@ -794,9 +794,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getVulnerabilityMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -813,7 +813,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -829,26 +829,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerArmorTemplate * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getVulnerabilityMax(true); #endif } if (!m_vulnerability.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter vulnerability in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter vulnerability has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter vulnerability has not been defined in template %s!", DataResource::getName())); return base->getVulnerabilityMax(); } } @@ -858,9 +858,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getVulnerabilityMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -877,7 +877,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -887,8 +887,8 @@ UNREF(testData); int ServerArmorTemplate::getEncumbrance(int index) const { - const ServerArmorTemplate * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -896,14 +896,14 @@ int ServerArmorTemplate::getEncumbrance(int index) const DEBUG_FATAL(index < 0 || index >= 3, ("template param index out of range")); if (!m_encumbrance[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter encumbrance in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter encumbrance has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter encumbrance has not been defined in template %s!", DataResource::getName())); return base->getEncumbrance(index); } } @@ -913,9 +913,9 @@ int ServerArmorTemplate::getEncumbrance(int index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getEncumbrance(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -936,8 +936,8 @@ int ServerArmorTemplate::getEncumbrance(int index) const int ServerArmorTemplate::getEncumbranceMin(int index) const { - const ServerArmorTemplate * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -945,14 +945,14 @@ int ServerArmorTemplate::getEncumbranceMin(int index) const DEBUG_FATAL(index < 0 || index >= 3, ("template param index out of range")); if (!m_encumbrance[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter encumbrance in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter encumbrance has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter encumbrance has not been defined in template %s!", DataResource::getName())); return base->getEncumbranceMin(index); } } @@ -962,9 +962,9 @@ int ServerArmorTemplate::getEncumbranceMin(int index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getEncumbranceMin(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -985,8 +985,8 @@ int ServerArmorTemplate::getEncumbranceMin(int index) const int ServerArmorTemplate::getEncumbranceMax(int index) const { - const ServerArmorTemplate * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -994,14 +994,14 @@ int ServerArmorTemplate::getEncumbranceMax(int index) const DEBUG_FATAL(index < 0 || index >= 3, ("template param index out of range")); if (!m_encumbrance[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter encumbrance in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter encumbrance has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter encumbrance has not been defined in template %s!", DataResource::getName())); return base->getEncumbranceMax(index); } } @@ -1011,9 +1011,9 @@ int ServerArmorTemplate::getEncumbranceMax(int index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getEncumbranceMax(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1074,12 +1074,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -1114,7 +1114,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_specialProtection.begin(); iter != m_specialProtection.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_specialProtection.clear(); m_specialProtectionAppend = file.read_bool8(); @@ -1205,33 +1205,33 @@ ServerArmorTemplate::DamageType testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getType(true); #endif } if (!m_type.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter type in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter type has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter type has not been defined in template %s!", DataResource::getName())); return base->getType(versionOk); } } DamageType value = static_cast(m_type.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1247,26 +1247,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerArmorTemplate::_SpecialProtection * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate::_SpecialProtection * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getEffectiveness(true); #endif } if (!m_effectiveness.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter effectiveness in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter effectiveness has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter effectiveness has not been defined in template %s!", DataResource::getName())); return base->getEffectiveness(versionOk); } } @@ -1276,9 +1276,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getEffectiveness(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1295,7 +1295,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1311,26 +1311,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerArmorTemplate::_SpecialProtection * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate::_SpecialProtection * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getEffectivenessMin(true); #endif } if (!m_effectiveness.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter effectiveness in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter effectiveness has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter effectiveness has not been defined in template %s!", DataResource::getName())); return base->getEffectivenessMin(versionOk); } } @@ -1340,9 +1340,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getEffectivenessMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1359,7 +1359,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1375,26 +1375,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerArmorTemplate::_SpecialProtection * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate::_SpecialProtection * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getEffectivenessMax(true); #endif } if (!m_effectiveness.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter effectiveness in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter effectiveness has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter effectiveness has not been defined in template %s!", DataResource::getName())); return base->getEffectivenessMax(versionOk); } } @@ -1404,9 +1404,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getEffectivenessMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1423,7 +1423,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerBattlefieldMarkerObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerBattlefieldMarkerObjectTemplate.cpp index 98360e9b..0a63ff2d 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerBattlefieldMarkerObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerBattlefieldMarkerObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag ServerBattlefieldMarkerObjectTemplate::getTemplateVersion(void) const */ Tag ServerBattlefieldMarkerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerBattlefieldMarkerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerBattlefieldMarkerObjectTemplate::getHighestTemplateVersion @@ -150,12 +150,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerBuildingObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerBuildingObjectTemplate.cpp index 57086652..57d3ab90 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerBuildingObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerBuildingObjectTemplate.cpp @@ -93,10 +93,10 @@ Tag ServerBuildingObjectTemplate::getTemplateVersion(void) const */ Tag ServerBuildingObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerBuildingObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerBuildingObjectTemplate::getHighestTemplateVersion @@ -120,26 +120,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerBuildingObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerBuildingObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaintenanceCost(true); #endif } if (!m_maintenanceCost.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maintenanceCost in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maintenanceCost has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maintenanceCost has not been defined in template %s!", DataResource::getName())); return base->getMaintenanceCost(); } } @@ -149,9 +149,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaintenanceCost(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -168,7 +168,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -184,26 +184,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerBuildingObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerBuildingObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaintenanceCostMin(true); #endif } if (!m_maintenanceCost.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maintenanceCost in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maintenanceCost has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maintenanceCost has not been defined in template %s!", DataResource::getName())); return base->getMaintenanceCostMin(); } } @@ -213,9 +213,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaintenanceCostMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -232,7 +232,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -248,26 +248,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerBuildingObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerBuildingObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaintenanceCostMax(true); #endif } if (!m_maintenanceCost.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maintenanceCost in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maintenanceCost has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maintenanceCost has not been defined in template %s!", DataResource::getName())); return base->getMaintenanceCostMax(); } } @@ -277,9 +277,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaintenanceCostMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -296,7 +296,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -312,33 +312,33 @@ bool testDataValue = false; UNREF(testData); #endif - const ServerBuildingObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerBuildingObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getIsPublic(true); #endif } if (!m_isPublic.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter isPublic in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter isPublic has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter isPublic has not been defined in template %s!", DataResource::getName())); return base->getIsPublic(); } } bool value = m_isPublic.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -386,12 +386,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerCellObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerCellObjectTemplate.cpp index 5a35a6f9..0c39dc7c 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerCellObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerCellObjectTemplate.cpp @@ -99,10 +99,10 @@ Tag ServerCellObjectTemplate::getTemplateVersion(void) const */ Tag ServerCellObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerCellObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerCellObjectTemplate::getHighestTemplateVersion @@ -155,12 +155,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerCityObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerCityObjectTemplate.cpp index 0b59a960..0f328d56 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerCityObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerCityObjectTemplate.cpp @@ -95,10 +95,10 @@ Tag ServerCityObjectTemplate::getTemplateVersion(void) const */ Tag ServerCityObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerCityObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerCityObjectTemplate::getHighestTemplateVersion @@ -151,12 +151,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerConstructionContractObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerConstructionContractObjectTemplate.cpp index 6daeee45..ba882146 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerConstructionContractObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerConstructionContractObjectTemplate.cpp @@ -84,10 +84,10 @@ Tag ServerConstructionContractObjectTemplate::getTemplateVersion(void) const */ Tag ServerConstructionContractObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerConstructionContractObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerConstructionContractObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerCreatureObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerCreatureObjectTemplate.cpp index babf8d0a..f1be807d 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerCreatureObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerCreatureObjectTemplate.cpp @@ -56,7 +56,7 @@ ServerCreatureObjectTemplate::~ServerCreatureObjectTemplate() for (iter = m_attribMods.begin(); iter != m_attribMods.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_attribMods.clear(); } @@ -108,10 +108,10 @@ Tag ServerCreatureObjectTemplate::getTemplateVersion(void) const */ Tag ServerCreatureObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerCreatureObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerCreatureObjectTemplate::getHighestTemplateVersion @@ -129,32 +129,32 @@ Object * ServerCreatureObjectTemplate::createObject(void) const //@BEGIN TFD const ServerWeaponObjectTemplate * ServerCreatureObjectTemplate::getDefaultWeapon() const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_defaultWeapon.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter defaultWeapon in template %s", DataResource::getName())); - return NULL; + return nullptr; } else { - DEBUG_FATAL(base == NULL, ("Template parameter defaultWeapon has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter defaultWeapon has not been defined in template %s!", DataResource::getName())); return base->getDefaultWeapon(); } } - const ServerWeaponObjectTemplate * returnValue = NULL; + const ServerWeaponObjectTemplate * returnValue = nullptr; const std::string & templateName = m_defaultWeapon.getValue(); if (!templateName.empty()) { returnValue = dynamic_cast(ObjectTemplateList::fetch(templateName)); - if (returnValue == NULL) + if (returnValue == nullptr) WARNING_STRICT_FATAL(true, ("Error loading template %s",templateName.c_str())); } return returnValue; @@ -162,8 +162,8 @@ const ServerWeaponObjectTemplate * ServerCreatureObjectTemplate::getDefaultWeapo int ServerCreatureObjectTemplate::getAttributes(Attributes index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -171,14 +171,14 @@ int ServerCreatureObjectTemplate::getAttributes(Attributes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 6, ("template param static_cast(index) getAttributes(index); } } @@ -188,9 +188,9 @@ int ServerCreatureObjectTemplate::getAttributes(Attributes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAttributes(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -211,8 +211,8 @@ int ServerCreatureObjectTemplate::getAttributes(Attributes index) const int ServerCreatureObjectTemplate::getAttributesMin(Attributes index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -220,14 +220,14 @@ int ServerCreatureObjectTemplate::getAttributesMin(Attributes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 6, ("template param static_cast(index) getAttributesMin(index); } } @@ -237,9 +237,9 @@ int ServerCreatureObjectTemplate::getAttributesMin(Attributes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAttributesMin(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -260,8 +260,8 @@ int ServerCreatureObjectTemplate::getAttributesMin(Attributes index) const int ServerCreatureObjectTemplate::getAttributesMax(Attributes index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -269,14 +269,14 @@ int ServerCreatureObjectTemplate::getAttributesMax(Attributes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 6, ("template param static_cast(index) getAttributesMax(index); } } @@ -286,9 +286,9 @@ int ServerCreatureObjectTemplate::getAttributesMax(Attributes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAttributesMax(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -309,8 +309,8 @@ int ServerCreatureObjectTemplate::getAttributesMax(Attributes index) const int ServerCreatureObjectTemplate::getMinAttributes(Attributes index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -318,14 +318,14 @@ int ServerCreatureObjectTemplate::getMinAttributes(Attributes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 6, ("template param static_cast(index) getMinAttributes(index); } } @@ -335,9 +335,9 @@ int ServerCreatureObjectTemplate::getMinAttributes(Attributes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinAttributes(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -358,8 +358,8 @@ int ServerCreatureObjectTemplate::getMinAttributes(Attributes index) const int ServerCreatureObjectTemplate::getMinAttributesMin(Attributes index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -367,14 +367,14 @@ int ServerCreatureObjectTemplate::getMinAttributesMin(Attributes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 6, ("template param static_cast(index) getMinAttributesMin(index); } } @@ -384,9 +384,9 @@ int ServerCreatureObjectTemplate::getMinAttributesMin(Attributes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinAttributesMin(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -407,8 +407,8 @@ int ServerCreatureObjectTemplate::getMinAttributesMin(Attributes index) const int ServerCreatureObjectTemplate::getMinAttributesMax(Attributes index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -416,14 +416,14 @@ int ServerCreatureObjectTemplate::getMinAttributesMax(Attributes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 6, ("template param static_cast(index) getMinAttributesMax(index); } } @@ -433,9 +433,9 @@ int ServerCreatureObjectTemplate::getMinAttributesMax(Attributes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinAttributesMax(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -456,8 +456,8 @@ int ServerCreatureObjectTemplate::getMinAttributesMax(Attributes index) const int ServerCreatureObjectTemplate::getMaxAttributes(Attributes index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -465,14 +465,14 @@ int ServerCreatureObjectTemplate::getMaxAttributes(Attributes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 6, ("template param static_cast(index) getMaxAttributes(index); } } @@ -482,9 +482,9 @@ int ServerCreatureObjectTemplate::getMaxAttributes(Attributes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxAttributes(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -505,8 +505,8 @@ int ServerCreatureObjectTemplate::getMaxAttributes(Attributes index) const int ServerCreatureObjectTemplate::getMaxAttributesMin(Attributes index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -514,14 +514,14 @@ int ServerCreatureObjectTemplate::getMaxAttributesMin(Attributes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 6, ("template param static_cast(index) getMaxAttributesMin(index); } } @@ -531,9 +531,9 @@ int ServerCreatureObjectTemplate::getMaxAttributesMin(Attributes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxAttributesMin(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -554,8 +554,8 @@ int ServerCreatureObjectTemplate::getMaxAttributesMin(Attributes index) const int ServerCreatureObjectTemplate::getMaxAttributesMax(Attributes index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -563,14 +563,14 @@ int ServerCreatureObjectTemplate::getMaxAttributesMax(Attributes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 6, ("template param static_cast(index) getMaxAttributesMax(index); } } @@ -580,9 +580,9 @@ int ServerCreatureObjectTemplate::getMaxAttributesMax(Attributes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxAttributesMax(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -609,26 +609,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMinDrainModifier(true); #endif } if (!m_minDrainModifier.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter minDrainModifier in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter minDrainModifier has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter minDrainModifier has not been defined in template %s!", DataResource::getName())); return base->getMinDrainModifier(); } } @@ -638,9 +638,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinDrainModifier(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -657,7 +657,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -673,26 +673,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMinDrainModifierMin(true); #endif } if (!m_minDrainModifier.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter minDrainModifier in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter minDrainModifier has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter minDrainModifier has not been defined in template %s!", DataResource::getName())); return base->getMinDrainModifierMin(); } } @@ -702,9 +702,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinDrainModifierMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -721,7 +721,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -737,26 +737,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMinDrainModifierMax(true); #endif } if (!m_minDrainModifier.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter minDrainModifier in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter minDrainModifier has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter minDrainModifier has not been defined in template %s!", DataResource::getName())); return base->getMinDrainModifierMax(); } } @@ -766,9 +766,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinDrainModifierMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -785,7 +785,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -801,26 +801,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxDrainModifier(true); #endif } if (!m_maxDrainModifier.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxDrainModifier in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxDrainModifier has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxDrainModifier has not been defined in template %s!", DataResource::getName())); return base->getMaxDrainModifier(); } } @@ -830,9 +830,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxDrainModifier(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -849,7 +849,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -865,26 +865,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxDrainModifierMin(true); #endif } if (!m_maxDrainModifier.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxDrainModifier in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxDrainModifier has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxDrainModifier has not been defined in template %s!", DataResource::getName())); return base->getMaxDrainModifierMin(); } } @@ -894,9 +894,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxDrainModifierMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -913,7 +913,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -929,26 +929,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxDrainModifierMax(true); #endif } if (!m_maxDrainModifier.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxDrainModifier in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxDrainModifier has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxDrainModifier has not been defined in template %s!", DataResource::getName())); return base->getMaxDrainModifierMax(); } } @@ -958,9 +958,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxDrainModifierMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -977,7 +977,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -993,26 +993,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMinFaucetModifier(true); #endif } if (!m_minFaucetModifier.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter minFaucetModifier in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter minFaucetModifier has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter minFaucetModifier has not been defined in template %s!", DataResource::getName())); return base->getMinFaucetModifier(); } } @@ -1022,9 +1022,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinFaucetModifier(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1041,7 +1041,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1057,26 +1057,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMinFaucetModifierMin(true); #endif } if (!m_minFaucetModifier.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter minFaucetModifier in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter minFaucetModifier has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter minFaucetModifier has not been defined in template %s!", DataResource::getName())); return base->getMinFaucetModifierMin(); } } @@ -1086,9 +1086,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinFaucetModifierMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1105,7 +1105,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1121,26 +1121,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMinFaucetModifierMax(true); #endif } if (!m_minFaucetModifier.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter minFaucetModifier in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter minFaucetModifier has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter minFaucetModifier has not been defined in template %s!", DataResource::getName())); return base->getMinFaucetModifierMax(); } } @@ -1150,9 +1150,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinFaucetModifierMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1169,7 +1169,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1185,26 +1185,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxFaucetModifier(true); #endif } if (!m_maxFaucetModifier.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxFaucetModifier in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxFaucetModifier has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxFaucetModifier has not been defined in template %s!", DataResource::getName())); return base->getMaxFaucetModifier(); } } @@ -1214,9 +1214,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxFaucetModifier(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1233,7 +1233,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1249,26 +1249,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxFaucetModifierMin(true); #endif } if (!m_maxFaucetModifier.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxFaucetModifier in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxFaucetModifier has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxFaucetModifier has not been defined in template %s!", DataResource::getName())); return base->getMaxFaucetModifierMin(); } } @@ -1278,9 +1278,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxFaucetModifierMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1297,7 +1297,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1313,26 +1313,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxFaucetModifierMax(true); #endif } if (!m_maxFaucetModifier.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxFaucetModifier in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxFaucetModifier has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxFaucetModifier has not been defined in template %s!", DataResource::getName())); return base->getMaxFaucetModifierMax(); } } @@ -1342,9 +1342,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxFaucetModifierMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1361,7 +1361,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1371,28 +1371,28 @@ UNREF(testData); void ServerCreatureObjectTemplate::getAttribMods(AttribMod &data, int index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_attribModsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attribMods in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter attribMods has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attribMods has not been defined in template %s!", DataResource::getName())); base->getAttribMods(data, index); return; } } - if (m_attribModsAppend && base != NULL) + if (m_attribModsAppend && base != nullptr) { int baseCount = base->getAttribModsCount(); if (static_cast(index) < baseCount) @@ -1417,28 +1417,28 @@ void ServerCreatureObjectTemplate::getAttribMods(AttribMod &data, int index) con void ServerCreatureObjectTemplate::getAttribModsMin(AttribMod &data, int index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_attribModsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attribMods in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter attribMods has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attribMods has not been defined in template %s!", DataResource::getName())); base->getAttribModsMin(data, index); return; } } - if (m_attribModsAppend && base != NULL) + if (m_attribModsAppend && base != nullptr) { int baseCount = base->getAttribModsCount(); if (static_cast(index) < baseCount) @@ -1463,28 +1463,28 @@ void ServerCreatureObjectTemplate::getAttribModsMin(AttribMod &data, int index) void ServerCreatureObjectTemplate::getAttribModsMax(AttribMod &data, int index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_attribModsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attribMods in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter attribMods has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attribMods has not been defined in template %s!", DataResource::getName())); base->getAttribModsMax(data, index); return; } } - if (m_attribModsAppend && base != NULL) + if (m_attribModsAppend && base != nullptr) { int baseCount = base->getAttribModsCount(); if (static_cast(index) < baseCount) @@ -1511,20 +1511,20 @@ size_t ServerCreatureObjectTemplate::getAttribModsCount(void) const { if (!m_attribModsLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const ServerCreatureObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getAttribModsCount(); } size_t count = m_attribMods.size(); // if we are extending our base template, add it's count - if (m_attribModsAppend && m_baseData != NULL) + if (m_attribModsAppend && m_baseData != nullptr) { const ServerCreatureObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getAttribModsCount(); } @@ -1539,26 +1539,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getShockWounds(true); #endif } if (!m_shockWounds.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter shockWounds in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter shockWounds has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter shockWounds has not been defined in template %s!", DataResource::getName())); return base->getShockWounds(); } } @@ -1568,9 +1568,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getShockWounds(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1587,7 +1587,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1603,26 +1603,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getShockWoundsMin(true); #endif } if (!m_shockWounds.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter shockWounds in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter shockWounds has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter shockWounds has not been defined in template %s!", DataResource::getName())); return base->getShockWoundsMin(); } } @@ -1632,9 +1632,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getShockWoundsMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1651,7 +1651,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1667,26 +1667,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getShockWoundsMax(true); #endif } if (!m_shockWounds.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter shockWounds in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter shockWounds has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter shockWounds has not been defined in template %s!", DataResource::getName())); return base->getShockWoundsMax(); } } @@ -1696,9 +1696,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getShockWoundsMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1715,7 +1715,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1731,33 +1731,33 @@ bool testDataValue = false; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCanCreateAvatar(true); #endif } if (!m_canCreateAvatar.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter canCreateAvatar in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter canCreateAvatar has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter canCreateAvatar has not been defined in template %s!", DataResource::getName())); return base->getCanCreateAvatar(); } } bool value = m_canCreateAvatar.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1773,33 +1773,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getNameGeneratorType(true); #endif } if (!m_nameGeneratorType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter nameGeneratorType in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter nameGeneratorType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter nameGeneratorType has not been defined in template %s!", DataResource::getName())); return base->getNameGeneratorType(); } } const std::string & value = m_nameGeneratorType.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1815,26 +1815,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getApproachTriggerRange(true); #endif } if (!m_approachTriggerRange.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter approachTriggerRange in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter approachTriggerRange has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter approachTriggerRange has not been defined in template %s!", DataResource::getName())); return base->getApproachTriggerRange(); } } @@ -1844,9 +1844,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getApproachTriggerRange(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1863,7 +1863,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1879,26 +1879,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getApproachTriggerRangeMin(true); #endif } if (!m_approachTriggerRange.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter approachTriggerRange in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter approachTriggerRange has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter approachTriggerRange has not been defined in template %s!", DataResource::getName())); return base->getApproachTriggerRangeMin(); } } @@ -1908,9 +1908,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getApproachTriggerRangeMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1927,7 +1927,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1943,26 +1943,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getApproachTriggerRangeMax(true); #endif } if (!m_approachTriggerRange.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter approachTriggerRange in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter approachTriggerRange has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter approachTriggerRange has not been defined in template %s!", DataResource::getName())); return base->getApproachTriggerRangeMax(); } } @@ -1972,9 +1972,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getApproachTriggerRangeMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1991,7 +1991,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2001,8 +2001,8 @@ UNREF(testData); float ServerCreatureObjectTemplate::getMaxMentalStates(MentalStates index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -2010,14 +2010,14 @@ float ServerCreatureObjectTemplate::getMaxMentalStates(MentalStates index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 4, ("template param static_cast(index) getMaxMentalStates(index); } } @@ -2027,9 +2027,9 @@ float ServerCreatureObjectTemplate::getMaxMentalStates(MentalStates index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxMentalStates(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2050,8 +2050,8 @@ float ServerCreatureObjectTemplate::getMaxMentalStates(MentalStates index) const float ServerCreatureObjectTemplate::getMaxMentalStatesMin(MentalStates index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -2059,14 +2059,14 @@ float ServerCreatureObjectTemplate::getMaxMentalStatesMin(MentalStates index) co DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 4, ("template param static_cast(index) getMaxMentalStatesMin(index); } } @@ -2076,9 +2076,9 @@ float ServerCreatureObjectTemplate::getMaxMentalStatesMin(MentalStates index) co if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxMentalStatesMin(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2099,8 +2099,8 @@ float ServerCreatureObjectTemplate::getMaxMentalStatesMin(MentalStates index) co float ServerCreatureObjectTemplate::getMaxMentalStatesMax(MentalStates index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -2108,14 +2108,14 @@ float ServerCreatureObjectTemplate::getMaxMentalStatesMax(MentalStates index) co DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 4, ("template param static_cast(index) getMaxMentalStatesMax(index); } } @@ -2125,9 +2125,9 @@ float ServerCreatureObjectTemplate::getMaxMentalStatesMax(MentalStates index) co if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxMentalStatesMax(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2148,8 +2148,8 @@ float ServerCreatureObjectTemplate::getMaxMentalStatesMax(MentalStates index) co float ServerCreatureObjectTemplate::getMentalStatesDecay(MentalStates index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -2157,14 +2157,14 @@ float ServerCreatureObjectTemplate::getMentalStatesDecay(MentalStates index) con DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 4, ("template param static_cast(index) getMentalStatesDecay(index); } } @@ -2174,9 +2174,9 @@ float ServerCreatureObjectTemplate::getMentalStatesDecay(MentalStates index) con if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMentalStatesDecay(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2197,8 +2197,8 @@ float ServerCreatureObjectTemplate::getMentalStatesDecay(MentalStates index) con float ServerCreatureObjectTemplate::getMentalStatesDecayMin(MentalStates index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -2206,14 +2206,14 @@ float ServerCreatureObjectTemplate::getMentalStatesDecayMin(MentalStates index) DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 4, ("template param static_cast(index) getMentalStatesDecayMin(index); } } @@ -2223,9 +2223,9 @@ float ServerCreatureObjectTemplate::getMentalStatesDecayMin(MentalStates index) if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMentalStatesDecayMin(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2246,8 +2246,8 @@ float ServerCreatureObjectTemplate::getMentalStatesDecayMin(MentalStates index) float ServerCreatureObjectTemplate::getMentalStatesDecayMax(MentalStates index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -2255,14 +2255,14 @@ float ServerCreatureObjectTemplate::getMentalStatesDecayMax(MentalStates index) DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 4, ("template param static_cast(index) getMentalStatesDecayMax(index); } } @@ -2272,9 +2272,9 @@ float ServerCreatureObjectTemplate::getMentalStatesDecayMax(MentalStates index) if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMentalStatesDecayMax(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2344,12 +2344,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -2430,7 +2430,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_attribMods.begin(); iter != m_attribMods.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_attribMods.clear(); m_attribModsAppend = file.read_bool8(); diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerDraftSchematicObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerDraftSchematicObjectTemplate.cpp index 6ed8a518..5cfd4169 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerDraftSchematicObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerDraftSchematicObjectTemplate.cpp @@ -58,7 +58,7 @@ ServerDraftSchematicObjectTemplate::~ServerDraftSchematicObjectTemplate() for (iter = m_slots.begin(); iter != m_slots.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_slots.clear(); } @@ -67,7 +67,7 @@ ServerDraftSchematicObjectTemplate::~ServerDraftSchematicObjectTemplate() for (iter = m_skillCommands.begin(); iter != m_skillCommands.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_skillCommands.clear(); } @@ -76,7 +76,7 @@ ServerDraftSchematicObjectTemplate::~ServerDraftSchematicObjectTemplate() for (iter = m_manufactureScripts.begin(); iter != m_manufactureScripts.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_manufactureScripts.clear(); } @@ -128,10 +128,10 @@ Tag ServerDraftSchematicObjectTemplate::getTemplateVersion(void) const */ Tag ServerDraftSchematicObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerDraftSchematicObjectTemplate::getHighestTemplateVersion @@ -152,7 +152,7 @@ Object * ServerDraftSchematicObjectTemplate::createObject(void) const WARNING(true, ("Trying to create a draft schematic %s outside the draft " "schematic factory!\n", getName())); - return NULL; + return nullptr; } // ServerDraftSchematicObjectTemplate::createObject /** @@ -188,33 +188,33 @@ ServerDraftSchematicObjectTemplate::CraftingType testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCategory(true); #endif } if (!m_category.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter category in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter category has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter category has not been defined in template %s!", DataResource::getName())); return base->getCategory(); } } CraftingType value = static_cast(m_category.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -224,86 +224,86 @@ UNREF(testData); const ServerObjectTemplate * ServerDraftSchematicObjectTemplate::getCraftedObjectTemplate() const { - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_craftedObjectTemplate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter craftedObjectTemplate in template %s", DataResource::getName())); - return NULL; + return nullptr; } else { - DEBUG_FATAL(base == NULL, ("Template parameter craftedObjectTemplate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter craftedObjectTemplate has not been defined in template %s!", DataResource::getName())); return base->getCraftedObjectTemplate(); } } const std::string & templateName = m_craftedObjectTemplate.getValue(); const ServerObjectTemplate * returnValue = dynamic_cast(ObjectTemplateList::fetch(templateName)); - if (returnValue == NULL) + if (returnValue == nullptr) WARNING_STRICT_FATAL(true, ("Error loading template %s",templateName.c_str())); return returnValue; } // ServerDraftSchematicObjectTemplate::getCraftedObjectTemplate const ServerFactoryObjectTemplate * ServerDraftSchematicObjectTemplate::getCrateObjectTemplate() const { - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_crateObjectTemplate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter crateObjectTemplate in template %s", DataResource::getName())); - return NULL; + return nullptr; } else { - DEBUG_FATAL(base == NULL, ("Template parameter crateObjectTemplate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter crateObjectTemplate has not been defined in template %s!", DataResource::getName())); return base->getCrateObjectTemplate(); } } const std::string & templateName = m_crateObjectTemplate.getValue(); const ServerFactoryObjectTemplate * returnValue = dynamic_cast(ObjectTemplateList::fetch(templateName)); - if (returnValue == NULL) + if (returnValue == nullptr) WARNING_STRICT_FATAL(true, ("Error loading template %s",templateName.c_str())); return returnValue; } // ServerDraftSchematicObjectTemplate::getCrateObjectTemplate void ServerDraftSchematicObjectTemplate::getSlots(IngredientSlot &data, int index) const { - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_slotsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slots in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slots has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slots has not been defined in template %s!", DataResource::getName())); base->getSlots(data, index); return; } } - if (m_slotsAppend && base != NULL) + if (m_slotsAppend && base != nullptr) { int baseCount = base->getSlotsCount(); if (index < baseCount) @@ -335,28 +335,28 @@ void ServerDraftSchematicObjectTemplate::getSlots(IngredientSlot &data, int inde void ServerDraftSchematicObjectTemplate::getSlotsMin(IngredientSlot &data, int index) const { - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_slotsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slots in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slots has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slots has not been defined in template %s!", DataResource::getName())); base->getSlotsMin(data, index); return; } } - if (m_slotsAppend && base != NULL) + if (m_slotsAppend && base != nullptr) { int baseCount = base->getSlotsCount(); if (index < baseCount) @@ -388,28 +388,28 @@ void ServerDraftSchematicObjectTemplate::getSlotsMin(IngredientSlot &data, int i void ServerDraftSchematicObjectTemplate::getSlotsMax(IngredientSlot &data, int index) const { - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_slotsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slots in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slots has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slots has not been defined in template %s!", DataResource::getName())); base->getSlotsMax(data, index); return; } } - if (m_slotsAppend && base != NULL) + if (m_slotsAppend && base != nullptr) { int baseCount = base->getSlotsCount(); if (index < baseCount) @@ -443,20 +443,20 @@ size_t ServerDraftSchematicObjectTemplate::getSlotsCount(void) const { if (!m_slotsLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const ServerDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getSlotsCount(); } size_t count = m_slots.size(); // if we are extending our base template, add it's count - if (m_slotsAppend && m_baseData != NULL) + if (m_slotsAppend && m_baseData != nullptr) { const ServerDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getSlotsCount(); } @@ -465,27 +465,27 @@ size_t ServerDraftSchematicObjectTemplate::getSlotsCount(void) const const std::string & ServerDraftSchematicObjectTemplate::getSkillCommands(int index) const { - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_skillCommandsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter skillCommands in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter skillCommands has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter skillCommands has not been defined in template %s!", DataResource::getName())); return base->getSkillCommands(index); } } - if (m_skillCommandsAppend && base != NULL) + if (m_skillCommandsAppend && base != nullptr) { int baseCount = base->getSkillCommandsCount(); if (index < baseCount) @@ -502,20 +502,20 @@ size_t ServerDraftSchematicObjectTemplate::getSkillCommandsCount(void) const { if (!m_skillCommandsLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const ServerDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getSkillCommandsCount(); } size_t count = m_skillCommands.size(); // if we are extending our base template, add it's count - if (m_skillCommandsAppend && m_baseData != NULL) + if (m_skillCommandsAppend && m_baseData != nullptr) { const ServerDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getSkillCommandsCount(); } @@ -530,33 +530,33 @@ bool testDataValue = false; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDestroyIngredients(true); #endif } if (!m_destroyIngredients.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter destroyIngredients in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter destroyIngredients has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter destroyIngredients has not been defined in template %s!", DataResource::getName())); return base->getDestroyIngredients(); } } bool value = m_destroyIngredients.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -566,27 +566,27 @@ UNREF(testData); const std::string & ServerDraftSchematicObjectTemplate::getManufactureScripts(int index) const { - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_manufactureScriptsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter manufactureScripts in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter manufactureScripts has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter manufactureScripts has not been defined in template %s!", DataResource::getName())); return base->getManufactureScripts(index); } } - if (m_manufactureScriptsAppend && base != NULL) + if (m_manufactureScriptsAppend && base != nullptr) { int baseCount = base->getManufactureScriptsCount(); if (index < baseCount) @@ -603,20 +603,20 @@ size_t ServerDraftSchematicObjectTemplate::getManufactureScriptsCount(void) cons { if (!m_manufactureScriptsLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const ServerDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getManufactureScriptsCount(); } size_t count = m_manufactureScripts.size(); // if we are extending our base template, add it's count - if (m_manufactureScriptsAppend && m_baseData != NULL) + if (m_manufactureScriptsAppend && m_baseData != nullptr) { const ServerDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getManufactureScriptsCount(); } @@ -631,26 +631,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getItemsPerContainer(true); #endif } if (!m_itemsPerContainer.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter itemsPerContainer in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter itemsPerContainer has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter itemsPerContainer has not been defined in template %s!", DataResource::getName())); return base->getItemsPerContainer(); } } @@ -660,9 +660,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getItemsPerContainer(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -679,7 +679,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -695,26 +695,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getItemsPerContainerMin(true); #endif } if (!m_itemsPerContainer.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter itemsPerContainer in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter itemsPerContainer has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter itemsPerContainer has not been defined in template %s!", DataResource::getName())); return base->getItemsPerContainerMin(); } } @@ -724,9 +724,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getItemsPerContainerMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -743,7 +743,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -759,26 +759,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getItemsPerContainerMax(true); #endif } if (!m_itemsPerContainer.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter itemsPerContainer in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter itemsPerContainer has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter itemsPerContainer has not been defined in template %s!", DataResource::getName())); return base->getItemsPerContainerMax(); } } @@ -788,9 +788,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getItemsPerContainerMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -807,7 +807,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -823,26 +823,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getManufactureTime(true); #endif } if (!m_manufactureTime.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter manufactureTime in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter manufactureTime has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter manufactureTime has not been defined in template %s!", DataResource::getName())); return base->getManufactureTime(); } } @@ -852,9 +852,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getManufactureTime(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -871,7 +871,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -887,26 +887,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getManufactureTimeMin(true); #endif } if (!m_manufactureTime.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter manufactureTime in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter manufactureTime has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter manufactureTime has not been defined in template %s!", DataResource::getName())); return base->getManufactureTimeMin(); } } @@ -916,9 +916,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getManufactureTimeMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -935,7 +935,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -951,26 +951,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getManufactureTimeMax(true); #endif } if (!m_manufactureTime.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter manufactureTime in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter manufactureTime has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter manufactureTime has not been defined in template %s!", DataResource::getName())); return base->getManufactureTimeMax(); } } @@ -980,9 +980,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getManufactureTimeMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -999,7 +999,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1015,26 +1015,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getPrototypeTime(true); #endif } if (!m_prototypeTime.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter prototypeTime in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter prototypeTime has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter prototypeTime has not been defined in template %s!", DataResource::getName())); return base->getPrototypeTime(); } } @@ -1044,9 +1044,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getPrototypeTime(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1063,7 +1063,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1079,26 +1079,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getPrototypeTimeMin(true); #endif } if (!m_prototypeTime.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter prototypeTime in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter prototypeTime has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter prototypeTime has not been defined in template %s!", DataResource::getName())); return base->getPrototypeTimeMin(); } } @@ -1108,9 +1108,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getPrototypeTimeMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1127,7 +1127,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1143,26 +1143,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getPrototypeTimeMax(true); #endif } if (!m_prototypeTime.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter prototypeTime in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter prototypeTime has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter prototypeTime has not been defined in template %s!", DataResource::getName())); return base->getPrototypeTimeMax(); } } @@ -1172,9 +1172,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getPrototypeTimeMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1191,7 +1191,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1244,12 +1244,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -1284,7 +1284,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_slots.begin(); iter != m_slots.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_slots.clear(); m_slotsAppend = file.read_bool8(); @@ -1303,7 +1303,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_skillCommands.begin(); iter != m_skillCommands.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_skillCommands.clear(); m_skillCommandsAppend = file.read_bool8(); @@ -1324,7 +1324,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_manufactureScripts.begin(); iter != m_manufactureScripts.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_manufactureScripts.clear(); m_manufactureScriptsAppend = file.read_bool8(); @@ -1376,7 +1376,7 @@ ServerDraftSchematicObjectTemplate::_IngredientSlot::~_IngredientSlot() for (iter = m_options.begin(); iter != m_options.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_options.clear(); } @@ -1418,33 +1418,33 @@ bool testDataValue = false; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getOptional(true); #endif } if (!m_optional.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter optional in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter optional has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter optional has not been defined in template %s!", DataResource::getName())); return base->getOptional(versionOk); } } bool value = m_optional.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1460,33 +1460,33 @@ StringId testDataValue = DefaultStringId; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getName(true); #endif } if (!m_name.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter name in template %s", DataResource::getName())); return DefaultStringId; } else { - DEBUG_FATAL(base == NULL, ("Template parameter name has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter name has not been defined in template %s!", DataResource::getName())); return base->getName(versionOk); } } const StringId value = m_name.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1496,28 +1496,28 @@ UNREF(testData); void ServerDraftSchematicObjectTemplate::_IngredientSlot::getOptions(Ingredient &data, int index, bool versionOk) const { - const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_optionsLoaded) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter options in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter options has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter options has not been defined in template %s!", DataResource::getName())); base->getOptions(data, index, versionOk); return; } } - if (m_optionsAppend && base != NULL) + if (m_optionsAppend && base != nullptr) { int baseCount = base->getOptionsCount(); if (index < baseCount) @@ -1547,28 +1547,28 @@ void ServerDraftSchematicObjectTemplate::_IngredientSlot::getOptions(Ingredient void ServerDraftSchematicObjectTemplate::_IngredientSlot::getOptionsMin(Ingredient &data, int index, bool versionOk) const { - const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_optionsLoaded) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter options in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter options has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter options has not been defined in template %s!", DataResource::getName())); base->getOptionsMin(data, index, versionOk); return; } } - if (m_optionsAppend && base != NULL) + if (m_optionsAppend && base != nullptr) { int baseCount = base->getOptionsCount(); if (index < baseCount) @@ -1598,28 +1598,28 @@ void ServerDraftSchematicObjectTemplate::_IngredientSlot::getOptionsMin(Ingredie void ServerDraftSchematicObjectTemplate::_IngredientSlot::getOptionsMax(Ingredient &data, int index, bool versionOk) const { - const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_optionsLoaded) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter options in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter options has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter options has not been defined in template %s!", DataResource::getName())); base->getOptionsMax(data, index, versionOk); return; } } - if (m_optionsAppend && base != NULL) + if (m_optionsAppend && base != nullptr) { int baseCount = base->getOptionsCount(); if (index < baseCount) @@ -1651,20 +1651,20 @@ size_t ServerDraftSchematicObjectTemplate::_IngredientSlot::getOptionsCount(void { if (!m_optionsLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getOptionsCount(); } size_t count = m_options.size(); // if we are extending our base template, add it's count - if (m_optionsAppend && m_baseData != NULL) + if (m_optionsAppend && m_baseData != nullptr) { const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getOptionsCount(); } @@ -1679,33 +1679,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getOptionalSkillCommand(true); #endif } if (!m_optionalSkillCommand.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter optionalSkillCommand in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter optionalSkillCommand has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter optionalSkillCommand has not been defined in template %s!", DataResource::getName())); return base->getOptionalSkillCommand(versionOk); } } const std::string & value = m_optionalSkillCommand.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1721,26 +1721,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getComplexity(true); #endif } if (!m_complexity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter complexity in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); return base->getComplexity(versionOk); } } @@ -1750,9 +1750,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getComplexity(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1769,7 +1769,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1785,26 +1785,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getComplexityMin(true); #endif } if (!m_complexity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter complexity in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); return base->getComplexityMin(versionOk); } } @@ -1814,9 +1814,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getComplexityMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1833,7 +1833,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1849,26 +1849,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getComplexityMax(true); #endif } if (!m_complexity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter complexity in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); return base->getComplexityMax(versionOk); } } @@ -1878,9 +1878,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getComplexityMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1897,7 +1897,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1913,33 +1913,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAppearance(true); #endif } if (!m_appearance.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter appearance in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter appearance has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter appearance has not been defined in template %s!", DataResource::getName())); return base->getAppearance(versionOk); } } const std::string & value = m_appearance.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1992,7 +1992,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_options.begin(); iter != m_options.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_options.clear(); m_optionsAppend = file.read_bool8(); diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerFactoryObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerFactoryObjectTemplate.cpp index 413f930b..21075a19 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerFactoryObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerFactoryObjectTemplate.cpp @@ -93,10 +93,10 @@ Tag ServerFactoryObjectTemplate::getTemplateVersion(void) const */ Tag ServerFactoryObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerFactoryObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerFactoryObjectTemplate::getHighestTemplateVersion @@ -149,12 +149,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerGroupObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerGroupObjectTemplate.cpp index 9f63f2db..d026ef4f 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerGroupObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerGroupObjectTemplate.cpp @@ -95,10 +95,10 @@ Tag ServerGroupObjectTemplate::getTemplateVersion(void) const */ Tag ServerGroupObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerGroupObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerGroupObjectTemplate::getHighestTemplateVersion @@ -151,12 +151,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerGuildObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerGuildObjectTemplate.cpp index 00d26b3f..d7a9bcef 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerGuildObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerGuildObjectTemplate.cpp @@ -95,10 +95,10 @@ Tag ServerGuildObjectTemplate::getTemplateVersion(void) const */ Tag ServerGuildObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerGuildObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerGuildObjectTemplate::getHighestTemplateVersion @@ -151,12 +151,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerHarvesterInstallationObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerHarvesterInstallationObjectTemplate.cpp index a226afb3..16bf4a31 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerHarvesterInstallationObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerHarvesterInstallationObjectTemplate.cpp @@ -93,10 +93,10 @@ Tag ServerHarvesterInstallationObjectTemplate::getTemplateVersion(void) const */ Tag ServerHarvesterInstallationObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerHarvesterInstallationObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerHarvesterInstallationObjectTemplate::getHighestTemplateVersion @@ -120,26 +120,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerHarvesterInstallationObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerHarvesterInstallationObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxExtractionRate(true); #endif } if (!m_maxExtractionRate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxExtractionRate in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxExtractionRate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxExtractionRate has not been defined in template %s!", DataResource::getName())); return base->getMaxExtractionRate(); } } @@ -149,9 +149,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxExtractionRate(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -168,7 +168,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -184,26 +184,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerHarvesterInstallationObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerHarvesterInstallationObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxExtractionRateMin(true); #endif } if (!m_maxExtractionRate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxExtractionRate in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxExtractionRate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxExtractionRate has not been defined in template %s!", DataResource::getName())); return base->getMaxExtractionRateMin(); } } @@ -213,9 +213,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxExtractionRateMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -232,7 +232,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -248,26 +248,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerHarvesterInstallationObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerHarvesterInstallationObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxExtractionRateMax(true); #endif } if (!m_maxExtractionRate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxExtractionRate in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxExtractionRate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxExtractionRate has not been defined in template %s!", DataResource::getName())); return base->getMaxExtractionRateMax(); } } @@ -277,9 +277,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxExtractionRateMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -296,7 +296,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -312,26 +312,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerHarvesterInstallationObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerHarvesterInstallationObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCurrentExtractionRate(true); #endif } if (!m_currentExtractionRate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter currentExtractionRate in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter currentExtractionRate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter currentExtractionRate has not been defined in template %s!", DataResource::getName())); return base->getCurrentExtractionRate(); } } @@ -341,9 +341,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCurrentExtractionRate(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -360,7 +360,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -376,26 +376,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerHarvesterInstallationObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerHarvesterInstallationObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCurrentExtractionRateMin(true); #endif } if (!m_currentExtractionRate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter currentExtractionRate in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter currentExtractionRate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter currentExtractionRate has not been defined in template %s!", DataResource::getName())); return base->getCurrentExtractionRateMin(); } } @@ -405,9 +405,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCurrentExtractionRateMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -424,7 +424,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -440,26 +440,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerHarvesterInstallationObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerHarvesterInstallationObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCurrentExtractionRateMax(true); #endif } if (!m_currentExtractionRate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter currentExtractionRate in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter currentExtractionRate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter currentExtractionRate has not been defined in template %s!", DataResource::getName())); return base->getCurrentExtractionRateMax(); } } @@ -469,9 +469,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCurrentExtractionRateMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -488,7 +488,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -504,26 +504,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerHarvesterInstallationObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerHarvesterInstallationObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxHopperSize(true); #endif } if (!m_maxHopperSize.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxHopperSize in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxHopperSize has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxHopperSize has not been defined in template %s!", DataResource::getName())); return base->getMaxHopperSize(); } } @@ -533,9 +533,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxHopperSize(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -552,7 +552,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -568,26 +568,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerHarvesterInstallationObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerHarvesterInstallationObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxHopperSizeMin(true); #endif } if (!m_maxHopperSize.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxHopperSize in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxHopperSize has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxHopperSize has not been defined in template %s!", DataResource::getName())); return base->getMaxHopperSizeMin(); } } @@ -597,9 +597,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxHopperSizeMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -616,7 +616,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -632,26 +632,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerHarvesterInstallationObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerHarvesterInstallationObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxHopperSizeMax(true); #endif } if (!m_maxHopperSize.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxHopperSize in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxHopperSize has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxHopperSize has not been defined in template %s!", DataResource::getName())); return base->getMaxHopperSizeMax(); } } @@ -661,9 +661,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxHopperSizeMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -680,7 +680,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -696,33 +696,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerHarvesterInstallationObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerHarvesterInstallationObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMasterClassName(true); #endif } if (!m_masterClassName.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter masterClassName in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter masterClassName has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter masterClassName has not been defined in template %s!", DataResource::getName())); return base->getMasterClassName(); } } const std::string & value = m_masterClassName.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -774,12 +774,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerInstallationObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerInstallationObjectTemplate.cpp index ad1661bb..8bb94ce5 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerInstallationObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerInstallationObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag ServerInstallationObjectTemplate::getTemplateVersion(void) const */ Tag ServerInstallationObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerInstallationObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerInstallationObjectTemplate::getHighestTemplateVersion @@ -150,12 +150,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerIntangibleObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerIntangibleObjectTemplate.cpp index 992bf06d..18cce6b3 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerIntangibleObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerIntangibleObjectTemplate.cpp @@ -93,10 +93,10 @@ Tag ServerIntangibleObjectTemplate::getTemplateVersion(void) const */ Tag ServerIntangibleObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerIntangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerIntangibleObjectTemplate::getHighestTemplateVersion @@ -120,26 +120,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerIntangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCount(true); #endif } if (!m_count.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter count in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter count has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter count has not been defined in template %s!", DataResource::getName())); return base->getCount(); } } @@ -149,9 +149,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCount(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -168,7 +168,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -184,26 +184,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerIntangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCountMin(true); #endif } if (!m_count.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter count in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter count has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter count has not been defined in template %s!", DataResource::getName())); return base->getCountMin(); } } @@ -213,9 +213,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCountMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -232,7 +232,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -248,26 +248,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerIntangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCountMax(true); #endif } if (!m_count.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter count in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter count has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter count has not been defined in template %s!", DataResource::getName())); return base->getCountMax(); } } @@ -277,9 +277,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCountMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -296,7 +296,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -343,12 +343,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -406,7 +406,7 @@ ServerIntangibleObjectTemplate::_Ingredient::~_Ingredient() for (iter = m_ingredients.begin(); iter != m_ingredients.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_ingredients.clear(); } @@ -448,33 +448,33 @@ ServerIntangibleObjectTemplate::IngredientType testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getIngredientType(true); #endif } if (!m_ingredientType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredientType in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter ingredientType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter ingredientType has not been defined in template %s!", DataResource::getName())); return base->getIngredientType(versionOk); } } IngredientType value = static_cast(m_ingredientType.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -484,28 +484,28 @@ UNREF(testData); void ServerIntangibleObjectTemplate::_Ingredient::getIngredients(SimpleIngredient &data, int index, bool versionOk) const { - const ServerIntangibleObjectTemplate::_Ingredient * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate::_Ingredient * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_ingredientsLoaded) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredients in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter ingredients has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter ingredients has not been defined in template %s!", DataResource::getName())); base->getIngredients(data, index, versionOk); return; } } - if (m_ingredientsAppend && base != NULL) + if (m_ingredientsAppend && base != nullptr) { int baseCount = base->getIngredientsCount(); if (index < baseCount) @@ -528,28 +528,28 @@ void ServerIntangibleObjectTemplate::_Ingredient::getIngredients(SimpleIngredien void ServerIntangibleObjectTemplate::_Ingredient::getIngredientsMin(SimpleIngredient &data, int index, bool versionOk) const { - const ServerIntangibleObjectTemplate::_Ingredient * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate::_Ingredient * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_ingredientsLoaded) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredients in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter ingredients has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter ingredients has not been defined in template %s!", DataResource::getName())); base->getIngredientsMin(data, index, versionOk); return; } } - if (m_ingredientsAppend && base != NULL) + if (m_ingredientsAppend && base != nullptr) { int baseCount = base->getIngredientsCount(); if (index < baseCount) @@ -572,28 +572,28 @@ void ServerIntangibleObjectTemplate::_Ingredient::getIngredientsMin(SimpleIngred void ServerIntangibleObjectTemplate::_Ingredient::getIngredientsMax(SimpleIngredient &data, int index, bool versionOk) const { - const ServerIntangibleObjectTemplate::_Ingredient * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate::_Ingredient * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_ingredientsLoaded) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredients in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter ingredients has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter ingredients has not been defined in template %s!", DataResource::getName())); base->getIngredientsMax(data, index, versionOk); return; } } - if (m_ingredientsAppend && base != NULL) + if (m_ingredientsAppend && base != nullptr) { int baseCount = base->getIngredientsCount(); if (index < baseCount) @@ -618,20 +618,20 @@ size_t ServerIntangibleObjectTemplate::_Ingredient::getIngredientsCount(void) co { if (!m_ingredientsLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const ServerIntangibleObjectTemplate::_Ingredient * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getIngredientsCount(); } size_t count = m_ingredients.size(); // if we are extending our base template, add it's count - if (m_ingredientsAppend && m_baseData != NULL) + if (m_ingredientsAppend && m_baseData != nullptr) { const ServerIntangibleObjectTemplate::_Ingredient * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getIngredientsCount(); } @@ -646,26 +646,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_Ingredient * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate::_Ingredient * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getComplexity(true); #endif } if (!m_complexity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter complexity in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); return base->getComplexity(versionOk); } } @@ -675,9 +675,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getComplexity(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -694,7 +694,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -710,26 +710,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_Ingredient * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate::_Ingredient * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getComplexityMin(true); #endif } if (!m_complexity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter complexity in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); return base->getComplexityMin(versionOk); } } @@ -739,9 +739,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getComplexityMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -758,7 +758,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -774,26 +774,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_Ingredient * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate::_Ingredient * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getComplexityMax(true); #endif } if (!m_complexity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter complexity in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); return base->getComplexityMax(versionOk); } } @@ -803,9 +803,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getComplexityMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -822,7 +822,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -838,33 +838,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_Ingredient * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate::_Ingredient * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSkillCommand(true); #endif } if (!m_skillCommand.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter skillCommand in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter skillCommand has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter skillCommand has not been defined in template %s!", DataResource::getName())); return base->getSkillCommand(versionOk); } } const std::string & value = m_skillCommand.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -913,7 +913,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_ingredients.begin(); iter != m_ingredients.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_ingredients.clear(); m_ingredientsAppend = file.read_bool8(); @@ -992,33 +992,33 @@ StringId testDataValue = DefaultStringId; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_SchematicAttribute * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate::_SchematicAttribute * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getName(true); #endif } if (!m_name.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter name in template %s", DataResource::getName())); return DefaultStringId; } else { - DEBUG_FATAL(base == NULL, ("Template parameter name has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter name has not been defined in template %s!", DataResource::getName())); return base->getName(versionOk); } } const StringId value = m_name.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1034,26 +1034,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_SchematicAttribute * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate::_SchematicAttribute * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getValue(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValue(versionOk); } } @@ -1063,9 +1063,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getValue(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1082,7 +1082,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1098,26 +1098,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_SchematicAttribute * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate::_SchematicAttribute * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getValueMin(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValueMin(versionOk); } } @@ -1127,9 +1127,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getValueMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1146,7 +1146,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1162,26 +1162,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_SchematicAttribute * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate::_SchematicAttribute * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getValueMax(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValueMax(versionOk); } } @@ -1191,9 +1191,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getValueMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1210,7 +1210,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1316,33 +1316,33 @@ StringId testDataValue = DefaultStringId; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_SimpleIngredient * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate::_SimpleIngredient * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getName(true); #endif } if (!m_name.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter name in template %s", DataResource::getName())); return DefaultStringId; } else { - DEBUG_FATAL(base == NULL, ("Template parameter name has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter name has not been defined in template %s!", DataResource::getName())); return base->getName(versionOk); } } const StringId value = m_name.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1358,33 +1358,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_SimpleIngredient * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate::_SimpleIngredient * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getIngredient(true); #endif } if (!m_ingredient.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredient in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter ingredient has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter ingredient has not been defined in template %s!", DataResource::getName())); return base->getIngredient(versionOk); } } const std::string & value = m_ingredient.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1400,26 +1400,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_SimpleIngredient * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate::_SimpleIngredient * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCount(true); #endif } if (!m_count.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter count in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter count has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter count has not been defined in template %s!", DataResource::getName())); return base->getCount(versionOk); } } @@ -1429,9 +1429,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCount(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1448,7 +1448,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1464,26 +1464,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_SimpleIngredient * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate::_SimpleIngredient * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCountMin(true); #endif } if (!m_count.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter count in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter count has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter count has not been defined in template %s!", DataResource::getName())); return base->getCountMin(versionOk); } } @@ -1493,9 +1493,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCountMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1512,7 +1512,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1528,26 +1528,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_SimpleIngredient * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate::_SimpleIngredient * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCountMax(true); #endif } if (!m_count.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter count in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter count has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter count has not been defined in template %s!", DataResource::getName())); return base->getCountMax(versionOk); } } @@ -1557,9 +1557,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCountMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1576,7 +1576,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureInstallationObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureInstallationObjectTemplate.cpp index 373a81f7..57b4db42 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureInstallationObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureInstallationObjectTemplate.cpp @@ -93,10 +93,10 @@ Tag ServerManufactureInstallationObjectTemplate::getTemplateVersion(void) const */ Tag ServerManufactureInstallationObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerManufactureInstallationObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerManufactureInstallationObjectTemplate::getHighestTemplateVersion @@ -149,12 +149,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureSchematicObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureSchematicObjectTemplate.cpp index 0f00a74b..3aee1103 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureSchematicObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureSchematicObjectTemplate.cpp @@ -54,7 +54,7 @@ ServerManufactureSchematicObjectTemplate::~ServerManufactureSchematicObjectTempl for (iter = m_ingredients.begin(); iter != m_ingredients.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_ingredients.clear(); } @@ -63,7 +63,7 @@ ServerManufactureSchematicObjectTemplate::~ServerManufactureSchematicObjectTempl for (iter = m_attributes.begin(); iter != m_attributes.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_attributes.clear(); } @@ -115,17 +115,17 @@ Tag ServerManufactureSchematicObjectTemplate::getTemplateVersion(void) const */ Tag ServerManufactureSchematicObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerManufactureSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerManufactureSchematicObjectTemplate::getHighestTemplateVersion /** * Called when the game tries to create a manf schematic via the default method. - * Manf must be created via a draft schematic, so we always return NULL; + * Manf must be created via a draft schematic, so we always return nullptr; * * @return the object */ @@ -146,17 +146,17 @@ Object * ServerManufactureSchematicObjectTemplate::createObject(const char *cons const ObjectTemplate *const objectTemplate = ObjectTemplateList::fetch(fileName); if (objectTemplate) { - Object * object = NULL; + Object * object = nullptr; const ServerManufactureSchematicObjectTemplate * const manfTemplate = dynamic_cast( objectTemplate); - if (manfTemplate != NULL) + if (manfTemplate != nullptr) object = manfTemplate->createObject(schematic); objectTemplate->releaseReference (); return object; } - return NULL; + return nullptr; } // ServerManufactureSchematicObjectTemplate::createObject /** @@ -178,33 +178,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerManufactureSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerManufactureSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDraftSchematic(true); #endif } if (!m_draftSchematic.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter draftSchematic in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter draftSchematic has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter draftSchematic has not been defined in template %s!", DataResource::getName())); return base->getDraftSchematic(); } } const std::string & value = m_draftSchematic.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -220,33 +220,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerManufactureSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerManufactureSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCreator(true); #endif } if (!m_creator.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter creator in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter creator has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter creator has not been defined in template %s!", DataResource::getName())); return base->getCreator(); } } const std::string & value = m_creator.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -256,28 +256,28 @@ UNREF(testData); void ServerManufactureSchematicObjectTemplate::getIngredients(IngredientSlot &data, int index) const { - const ServerManufactureSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerManufactureSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_ingredientsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredients in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter ingredients has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter ingredients has not been defined in template %s!", DataResource::getName())); base->getIngredients(data, index); return; } } - if (m_ingredientsAppend && base != NULL) + if (m_ingredientsAppend && base != nullptr) { int baseCount = base->getIngredientsCount(); if (index < baseCount) @@ -299,28 +299,28 @@ void ServerManufactureSchematicObjectTemplate::getIngredients(IngredientSlot &da void ServerManufactureSchematicObjectTemplate::getIngredientsMin(IngredientSlot &data, int index) const { - const ServerManufactureSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerManufactureSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_ingredientsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredients in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter ingredients has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter ingredients has not been defined in template %s!", DataResource::getName())); base->getIngredientsMin(data, index); return; } } - if (m_ingredientsAppend && base != NULL) + if (m_ingredientsAppend && base != nullptr) { int baseCount = base->getIngredientsCount(); if (index < baseCount) @@ -342,28 +342,28 @@ void ServerManufactureSchematicObjectTemplate::getIngredientsMin(IngredientSlot void ServerManufactureSchematicObjectTemplate::getIngredientsMax(IngredientSlot &data, int index) const { - const ServerManufactureSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerManufactureSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_ingredientsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredients in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter ingredients has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter ingredients has not been defined in template %s!", DataResource::getName())); base->getIngredientsMax(data, index); return; } } - if (m_ingredientsAppend && base != NULL) + if (m_ingredientsAppend && base != nullptr) { int baseCount = base->getIngredientsCount(); if (index < baseCount) @@ -387,20 +387,20 @@ size_t ServerManufactureSchematicObjectTemplate::getIngredientsCount(void) const { if (!m_ingredientsLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const ServerManufactureSchematicObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getIngredientsCount(); } size_t count = m_ingredients.size(); // if we are extending our base template, add it's count - if (m_ingredientsAppend && m_baseData != NULL) + if (m_ingredientsAppend && m_baseData != nullptr) { const ServerManufactureSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getIngredientsCount(); } @@ -415,26 +415,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerManufactureSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerManufactureSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getItemCount(true); #endif } if (!m_itemCount.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter itemCount in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter itemCount has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter itemCount has not been defined in template %s!", DataResource::getName())); return base->getItemCount(); } } @@ -444,9 +444,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getItemCount(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -463,7 +463,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -479,26 +479,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerManufactureSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerManufactureSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getItemCountMin(true); #endif } if (!m_itemCount.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter itemCount in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter itemCount has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter itemCount has not been defined in template %s!", DataResource::getName())); return base->getItemCountMin(); } } @@ -508,9 +508,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getItemCountMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -527,7 +527,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -543,26 +543,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerManufactureSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerManufactureSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getItemCountMax(true); #endif } if (!m_itemCount.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter itemCount in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter itemCount has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter itemCount has not been defined in template %s!", DataResource::getName())); return base->getItemCountMax(); } } @@ -572,9 +572,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getItemCountMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -591,7 +591,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -601,28 +601,28 @@ UNREF(testData); void ServerManufactureSchematicObjectTemplate::getAttributes(SchematicAttribute &data, int index) const { - const ServerManufactureSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerManufactureSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_attributesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attributes in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter attributes has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attributes has not been defined in template %s!", DataResource::getName())); base->getAttributes(data, index); return; } } - if (m_attributesAppend && base != NULL) + if (m_attributesAppend && base != nullptr) { int baseCount = base->getAttributesCount(); if (index < baseCount) @@ -644,28 +644,28 @@ void ServerManufactureSchematicObjectTemplate::getAttributes(SchematicAttribute void ServerManufactureSchematicObjectTemplate::getAttributesMin(SchematicAttribute &data, int index) const { - const ServerManufactureSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerManufactureSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_attributesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attributes in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter attributes has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attributes has not been defined in template %s!", DataResource::getName())); base->getAttributesMin(data, index); return; } } - if (m_attributesAppend && base != NULL) + if (m_attributesAppend && base != nullptr) { int baseCount = base->getAttributesCount(); if (index < baseCount) @@ -687,28 +687,28 @@ void ServerManufactureSchematicObjectTemplate::getAttributesMin(SchematicAttribu void ServerManufactureSchematicObjectTemplate::getAttributesMax(SchematicAttribute &data, int index) const { - const ServerManufactureSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerManufactureSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_attributesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attributes in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter attributes has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attributes has not been defined in template %s!", DataResource::getName())); base->getAttributesMax(data, index); return; } } - if (m_attributesAppend && base != NULL) + if (m_attributesAppend && base != nullptr) { int baseCount = base->getAttributesCount(); if (index < baseCount) @@ -732,20 +732,20 @@ size_t ServerManufactureSchematicObjectTemplate::getAttributesCount(void) const { if (!m_attributesLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const ServerManufactureSchematicObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getAttributesCount(); } size_t count = m_attributes.size(); // if we are extending our base template, add it's count - if (m_attributesAppend && m_baseData != NULL) + if (m_attributesAppend && m_baseData != nullptr) { const ServerManufactureSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getAttributesCount(); } @@ -793,12 +793,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -831,7 +831,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_ingredients.begin(); iter != m_ingredients.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_ingredients.clear(); m_ingredientsAppend = file.read_bool8(); @@ -852,7 +852,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_attributes.begin(); iter != m_attributes.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_attributes.clear(); m_attributesAppend = file.read_bool8(); @@ -929,33 +929,33 @@ StringId testDataValue = DefaultStringId; UNREF(testData); #endif - const ServerManufactureSchematicObjectTemplate::_IngredientSlot * base = NULL; - if (m_baseData != NULL) + const ServerManufactureSchematicObjectTemplate::_IngredientSlot * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getName(true); #endif } if (!m_name.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter name in template %s", DataResource::getName())); return DefaultStringId; } else { - DEBUG_FATAL(base == NULL, ("Template parameter name has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter name has not been defined in template %s!", DataResource::getName())); return base->getName(versionOk); } } const StringId value = m_name.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -965,22 +965,22 @@ UNREF(testData); void ServerManufactureSchematicObjectTemplate::_IngredientSlot::getIngredient(Ingredient &data, bool versionOk) const { - const ServerManufactureSchematicObjectTemplate::_IngredientSlot * base = NULL; - if (m_baseData != NULL) + const ServerManufactureSchematicObjectTemplate::_IngredientSlot * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_ingredient.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredient in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter ingredient has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter ingredient has not been defined in template %s!", DataResource::getName())); base->getIngredient(data, versionOk); return; } @@ -1004,22 +1004,22 @@ void ServerManufactureSchematicObjectTemplate::_IngredientSlot::getIngredient(In void ServerManufactureSchematicObjectTemplate::_IngredientSlot::getIngredientMin(Ingredient &data, bool versionOk) const { - const ServerManufactureSchematicObjectTemplate::_IngredientSlot * base = NULL; - if (m_baseData != NULL) + const ServerManufactureSchematicObjectTemplate::_IngredientSlot * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_ingredient.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredient in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter ingredient has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter ingredient has not been defined in template %s!", DataResource::getName())); base->getIngredientMin(data, versionOk); return; } @@ -1043,22 +1043,22 @@ void ServerManufactureSchematicObjectTemplate::_IngredientSlot::getIngredientMin void ServerManufactureSchematicObjectTemplate::_IngredientSlot::getIngredientMax(Ingredient &data, bool versionOk) const { - const ServerManufactureSchematicObjectTemplate::_IngredientSlot * base = NULL; - if (m_baseData != NULL) + const ServerManufactureSchematicObjectTemplate::_IngredientSlot * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_ingredient.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredient in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter ingredient has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter ingredient has not been defined in template %s!", DataResource::getName())); base->getIngredientMax(data, versionOk); return; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerMissionObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerMissionObjectTemplate.cpp index 66ee2754..9417be44 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerMissionObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerMissionObjectTemplate.cpp @@ -93,10 +93,10 @@ Tag ServerMissionObjectTemplate::getTemplateVersion(void) const */ Tag ServerMissionObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerMissionObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerMissionObjectTemplate::getHighestTemplateVersion @@ -149,12 +149,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerObjectTemplate.cpp index 78810b18..5e11c2e7 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerObjectTemplate.cpp @@ -32,7 +32,7 @@ const TriggerVolumeData DefaultTriggerVolumeData; bool ServerObjectTemplate::ms_allowDefaultTemplateParams = true; typedef std::unordered_map > XP_MAP; -static XP_MAP * XpMap = NULL; +static XP_MAP * XpMap = nullptr; /** @@ -74,7 +74,7 @@ ServerObjectTemplate::~ServerObjectTemplate() for (iter = m_scripts.begin(); iter != m_scripts.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_scripts.clear(); } @@ -83,7 +83,7 @@ ServerObjectTemplate::~ServerObjectTemplate() for (iter = m_visibleFlags.begin(); iter != m_visibleFlags.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_visibleFlags.clear(); } @@ -92,7 +92,7 @@ ServerObjectTemplate::~ServerObjectTemplate() for (iter = m_deleteFlags.begin(); iter != m_deleteFlags.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_deleteFlags.clear(); } @@ -101,7 +101,7 @@ ServerObjectTemplate::~ServerObjectTemplate() for (iter = m_moveFlags.begin(); iter != m_moveFlags.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_moveFlags.clear(); } @@ -110,7 +110,7 @@ ServerObjectTemplate::~ServerObjectTemplate() for (iter = m_contents.begin(); iter != m_contents.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_contents.clear(); } @@ -119,7 +119,7 @@ ServerObjectTemplate::~ServerObjectTemplate() for (iter = m_xpPoints.begin(); iter != m_xpPoints.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_xpPoints.clear(); } @@ -133,7 +133,7 @@ void ServerObjectTemplate::registerMe(void) { ObjectTemplateList::registerTemplate(ServerObjectTemplate_tag, create); - if (XpMap == NULL) + if (XpMap == nullptr) { XpMap = new XP_MAP(); ExitChain::add(exit, "ServerObjectTemplate"); @@ -208,10 +208,10 @@ void ServerObjectTemplate::registerMe(void) */ void ServerObjectTemplate::exit() { - if (XpMap != NULL) + if (XpMap != nullptr) { delete XpMap; - XpMap = NULL; + XpMap = nullptr; } } // ServerObjectTemplate::exit @@ -252,10 +252,10 @@ Tag ServerObjectTemplate::getTemplateVersion(void) const */ Tag ServerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerObjectTemplate::getHighestTemplateVersion @@ -287,7 +287,7 @@ const std::string & ServerObjectTemplate::getXpString(XpTypes type) { static const std::string emptyString; - if (XpMap != NULL) + if (XpMap != nullptr) { XP_MAP::const_iterator result = XpMap->find(type); if (result != XpMap->end()) @@ -371,33 +371,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSharedTemplate(true); #endif } if (!m_sharedTemplate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter sharedTemplate in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter sharedTemplate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter sharedTemplate has not been defined in template %s!", DataResource::getName())); return base->getSharedTemplate(); } } const std::string & value = m_sharedTemplate.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -407,27 +407,27 @@ UNREF(testData); const std::string & ServerObjectTemplate::getScripts(int index) const { - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_scriptsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter scripts in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter scripts has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter scripts has not been defined in template %s!", DataResource::getName())); return base->getScripts(index); } } - if (m_scriptsAppend && base != NULL) + if (m_scriptsAppend && base != nullptr) { int baseCount = base->getScriptsCount(); if (index < baseCount) @@ -444,20 +444,20 @@ size_t ServerObjectTemplate::getScriptsCount(void) const { if (!m_scriptsLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const ServerObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getScriptsCount(); } size_t count = m_scripts.size(); // if we are extending our base template, add it's count - if (m_scriptsAppend && m_baseData != NULL) + if (m_scriptsAppend && m_baseData != nullptr) { const ServerObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getScriptsCount(); } @@ -466,28 +466,28 @@ size_t ServerObjectTemplate::getScriptsCount(void) const void ServerObjectTemplate::getObjvars(DynamicVariableList &list) const { - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_objvars.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter objvars in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter objvars has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter objvars has not been defined in template %s!", DataResource::getName())); base->getObjvars(list); return; } } - if (m_objvars.isExtendingBaseList() && base != NULL) + if (m_objvars.isExtendingBaseList() && base != nullptr) base->getObjvars(list); m_objvars.getDynamicVariableList(list); } // ServerObjectTemplate::getObjvars @@ -500,26 +500,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getVolume(true); #endif } if (!m_volume.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter volume in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter volume has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter volume has not been defined in template %s!", DataResource::getName())); return base->getVolume(); } } @@ -529,9 +529,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getVolume(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -548,7 +548,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -564,26 +564,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getVolumeMin(true); #endif } if (!m_volume.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter volume in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter volume has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter volume has not been defined in template %s!", DataResource::getName())); return base->getVolumeMin(); } } @@ -593,9 +593,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getVolumeMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -612,7 +612,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -628,26 +628,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getVolumeMax(true); #endif } if (!m_volume.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter volume in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter volume has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter volume has not been defined in template %s!", DataResource::getName())); return base->getVolumeMax(); } } @@ -657,9 +657,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getVolumeMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -676,7 +676,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -686,27 +686,27 @@ UNREF(testData); ServerObjectTemplate::VisibleFlags ServerObjectTemplate::getVisibleFlags(int index) const { - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_visibleFlagsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter visibleFlags in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter visibleFlags has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter visibleFlags has not been defined in template %s!", DataResource::getName())); return base->getVisibleFlags(index); } } - if (m_visibleFlagsAppend && base != NULL) + if (m_visibleFlagsAppend && base != nullptr) { int baseCount = base->getVisibleFlagsCount(); if (index < baseCount) @@ -722,20 +722,20 @@ size_t ServerObjectTemplate::getVisibleFlagsCount(void) const { if (!m_visibleFlagsLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const ServerObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getVisibleFlagsCount(); } size_t count = m_visibleFlags.size(); // if we are extending our base template, add it's count - if (m_visibleFlagsAppend && m_baseData != NULL) + if (m_visibleFlagsAppend && m_baseData != nullptr) { const ServerObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getVisibleFlagsCount(); } @@ -744,27 +744,27 @@ size_t ServerObjectTemplate::getVisibleFlagsCount(void) const ServerObjectTemplate::DeleteFlags ServerObjectTemplate::getDeleteFlags(int index) const { - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_deleteFlagsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter deleteFlags in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter deleteFlags has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter deleteFlags has not been defined in template %s!", DataResource::getName())); return base->getDeleteFlags(index); } } - if (m_deleteFlagsAppend && base != NULL) + if (m_deleteFlagsAppend && base != nullptr) { int baseCount = base->getDeleteFlagsCount(); if (index < baseCount) @@ -780,20 +780,20 @@ size_t ServerObjectTemplate::getDeleteFlagsCount(void) const { if (!m_deleteFlagsLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const ServerObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getDeleteFlagsCount(); } size_t count = m_deleteFlags.size(); // if we are extending our base template, add it's count - if (m_deleteFlagsAppend && m_baseData != NULL) + if (m_deleteFlagsAppend && m_baseData != nullptr) { const ServerObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getDeleteFlagsCount(); } @@ -802,27 +802,27 @@ size_t ServerObjectTemplate::getDeleteFlagsCount(void) const ServerObjectTemplate::MoveFlags ServerObjectTemplate::getMoveFlags(int index) const { - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_moveFlagsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter moveFlags in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter moveFlags has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter moveFlags has not been defined in template %s!", DataResource::getName())); return base->getMoveFlags(index); } } - if (m_moveFlagsAppend && base != NULL) + if (m_moveFlagsAppend && base != nullptr) { int baseCount = base->getMoveFlagsCount(); if (index < baseCount) @@ -838,20 +838,20 @@ size_t ServerObjectTemplate::getMoveFlagsCount(void) const { if (!m_moveFlagsLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const ServerObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getMoveFlagsCount(); } size_t count = m_moveFlags.size(); // if we are extending our base template, add it's count - if (m_moveFlagsAppend && m_baseData != NULL) + if (m_moveFlagsAppend && m_baseData != nullptr) { const ServerObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getMoveFlagsCount(); } @@ -866,33 +866,33 @@ bool testDataValue = false; UNREF(testData); #endif - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getInvulnerable(true); #endif } if (!m_invulnerable.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter invulnerable in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter invulnerable has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter invulnerable has not been defined in template %s!", DataResource::getName())); return base->getInvulnerable(); } } bool value = m_invulnerable.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -908,26 +908,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getComplexity(true); #endif } if (!m_complexity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter complexity in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); return base->getComplexity(); } } @@ -937,9 +937,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getComplexity(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -956,7 +956,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -972,26 +972,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getComplexityMin(true); #endif } if (!m_complexity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter complexity in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); return base->getComplexityMin(); } } @@ -1001,9 +1001,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getComplexityMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1020,7 +1020,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1036,26 +1036,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getComplexityMax(true); #endif } if (!m_complexity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter complexity in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); return base->getComplexityMax(); } } @@ -1065,9 +1065,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getComplexityMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1084,7 +1084,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1100,26 +1100,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTintIndex(true); #endif } if (!m_tintIndex.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter tintIndex in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter tintIndex has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter tintIndex has not been defined in template %s!", DataResource::getName())); return base->getTintIndex(); } } @@ -1129,9 +1129,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTintIndex(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1148,7 +1148,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1164,26 +1164,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTintIndexMin(true); #endif } if (!m_tintIndex.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter tintIndex in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter tintIndex has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter tintIndex has not been defined in template %s!", DataResource::getName())); return base->getTintIndexMin(); } } @@ -1193,9 +1193,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTintIndexMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1212,7 +1212,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1228,26 +1228,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTintIndexMax(true); #endif } if (!m_tintIndex.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter tintIndex in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter tintIndex has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter tintIndex has not been defined in template %s!", DataResource::getName())); return base->getTintIndexMax(); } } @@ -1257,9 +1257,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTintIndexMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1276,7 +1276,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1286,8 +1286,8 @@ UNREF(testData); float ServerObjectTemplate::getUpdateRanges(UpdateRanges index) const { - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -1295,14 +1295,14 @@ float ServerObjectTemplate::getUpdateRanges(UpdateRanges index) const DEBUG_FATAL(index < 0 || index >= 3, ("template param index out of range")); if (!m_updateRanges[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter updateRanges in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter updateRanges has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter updateRanges has not been defined in template %s!", DataResource::getName())); return base->getUpdateRanges(index); } } @@ -1312,9 +1312,9 @@ float ServerObjectTemplate::getUpdateRanges(UpdateRanges index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getUpdateRanges(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1335,8 +1335,8 @@ float ServerObjectTemplate::getUpdateRanges(UpdateRanges index) const float ServerObjectTemplate::getUpdateRangesMin(UpdateRanges index) const { - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -1344,14 +1344,14 @@ float ServerObjectTemplate::getUpdateRangesMin(UpdateRanges index) const DEBUG_FATAL(index < 0 || index >= 3, ("template param index out of range")); if (!m_updateRanges[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter updateRanges in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter updateRanges has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter updateRanges has not been defined in template %s!", DataResource::getName())); return base->getUpdateRangesMin(index); } } @@ -1361,9 +1361,9 @@ float ServerObjectTemplate::getUpdateRangesMin(UpdateRanges index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getUpdateRangesMin(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1384,8 +1384,8 @@ float ServerObjectTemplate::getUpdateRangesMin(UpdateRanges index) const float ServerObjectTemplate::getUpdateRangesMax(UpdateRanges index) const { - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -1393,14 +1393,14 @@ float ServerObjectTemplate::getUpdateRangesMax(UpdateRanges index) const DEBUG_FATAL(index < 0 || index >= 3, ("template param index out of range")); if (!m_updateRanges[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter updateRanges in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter updateRanges has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter updateRanges has not been defined in template %s!", DataResource::getName())); return base->getUpdateRangesMax(index); } } @@ -1410,9 +1410,9 @@ float ServerObjectTemplate::getUpdateRangesMax(UpdateRanges index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getUpdateRangesMax(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1433,28 +1433,28 @@ float ServerObjectTemplate::getUpdateRangesMax(UpdateRanges index) const void ServerObjectTemplate::getContents(Contents &data, int index) const { - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_contentsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter contents in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter contents has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter contents has not been defined in template %s!", DataResource::getName())); base->getContents(data, index); return; } } - if (m_contentsAppend && base != NULL) + if (m_contentsAppend && base != nullptr) { int baseCount = base->getContentsCount(); if (index < baseCount) @@ -1477,28 +1477,28 @@ void ServerObjectTemplate::getContents(Contents &data, int index) const void ServerObjectTemplate::getContentsMin(Contents &data, int index) const { - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_contentsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter contents in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter contents has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter contents has not been defined in template %s!", DataResource::getName())); base->getContentsMin(data, index); return; } } - if (m_contentsAppend && base != NULL) + if (m_contentsAppend && base != nullptr) { int baseCount = base->getContentsCount(); if (index < baseCount) @@ -1521,28 +1521,28 @@ void ServerObjectTemplate::getContentsMin(Contents &data, int index) const void ServerObjectTemplate::getContentsMax(Contents &data, int index) const { - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_contentsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter contents in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter contents has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter contents has not been defined in template %s!", DataResource::getName())); base->getContentsMax(data, index); return; } } - if (m_contentsAppend && base != NULL) + if (m_contentsAppend && base != nullptr) { int baseCount = base->getContentsCount(); if (index < baseCount) @@ -1567,20 +1567,20 @@ size_t ServerObjectTemplate::getContentsCount(void) const { if (!m_contentsLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const ServerObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getContentsCount(); } size_t count = m_contents.size(); // if we are extending our base template, add it's count - if (m_contentsAppend && m_baseData != NULL) + if (m_contentsAppend && m_baseData != nullptr) { const ServerObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getContentsCount(); } @@ -1589,28 +1589,28 @@ size_t ServerObjectTemplate::getContentsCount(void) const void ServerObjectTemplate::getXpPoints(Xp &data, int index) const { - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_xpPointsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter xpPoints in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter xpPoints has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter xpPoints has not been defined in template %s!", DataResource::getName())); base->getXpPoints(data, index); return; } } - if (m_xpPointsAppend && base != NULL) + if (m_xpPointsAppend && base != nullptr) { int baseCount = base->getXpPointsCount(); if (index < baseCount) @@ -1633,28 +1633,28 @@ void ServerObjectTemplate::getXpPoints(Xp &data, int index) const void ServerObjectTemplate::getXpPointsMin(Xp &data, int index) const { - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_xpPointsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter xpPoints in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter xpPoints has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter xpPoints has not been defined in template %s!", DataResource::getName())); base->getXpPointsMin(data, index); return; } } - if (m_xpPointsAppend && base != NULL) + if (m_xpPointsAppend && base != nullptr) { int baseCount = base->getXpPointsCount(); if (index < baseCount) @@ -1677,28 +1677,28 @@ void ServerObjectTemplate::getXpPointsMin(Xp &data, int index) const void ServerObjectTemplate::getXpPointsMax(Xp &data, int index) const { - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_xpPointsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter xpPoints in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter xpPoints has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter xpPoints has not been defined in template %s!", DataResource::getName())); base->getXpPointsMax(data, index); return; } } - if (m_xpPointsAppend && base != NULL) + if (m_xpPointsAppend && base != nullptr) { int baseCount = base->getXpPointsCount(); if (index < baseCount) @@ -1723,20 +1723,20 @@ size_t ServerObjectTemplate::getXpPointsCount(void) const { if (!m_xpPointsLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const ServerObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getXpPointsCount(); } size_t count = m_xpPoints.size(); // if we are extending our base template, add it's count - if (m_xpPointsAppend && m_baseData != NULL) + if (m_xpPointsAppend && m_baseData != nullptr) { const ServerObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getXpPointsCount(); } @@ -1751,33 +1751,33 @@ bool testDataValue = false; UNREF(testData); #endif - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getPersistByDefault(true); #endif } if (!m_persistByDefault.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter persistByDefault in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter persistByDefault has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter persistByDefault has not been defined in template %s!", DataResource::getName())); return base->getPersistByDefault(); } } bool value = m_persistByDefault.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1793,33 +1793,33 @@ bool testDataValue = false; UNREF(testData); #endif - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getPersistContents(true); #endif } if (!m_persistContents.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter persistContents in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter persistContents has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter persistContents has not been defined in template %s!", DataResource::getName())); return base->getPersistContents(); } } bool value = m_persistContents.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1872,12 +1872,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -1908,7 +1908,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_scripts.begin(); iter != m_scripts.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_scripts.clear(); m_scriptsAppend = file.read_bool8(); @@ -1931,7 +1931,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_visibleFlags.begin(); iter != m_visibleFlags.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_visibleFlags.clear(); m_visibleFlagsAppend = file.read_bool8(); @@ -1950,7 +1950,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_deleteFlags.begin(); iter != m_deleteFlags.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_deleteFlags.clear(); m_deleteFlagsAppend = file.read_bool8(); @@ -1969,7 +1969,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_moveFlags.begin(); iter != m_moveFlags.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_moveFlags.clear(); m_moveFlagsAppend = file.read_bool8(); @@ -2008,7 +2008,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_contents.begin(); iter != m_contents.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_contents.clear(); m_contentsAppend = file.read_bool8(); @@ -2027,7 +2027,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_xpPoints.begin(); iter != m_xpPoints.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_xpPoints.clear(); m_xpPointsAppend = file.read_bool8(); @@ -2106,33 +2106,33 @@ ServerObjectTemplate::Attributes testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTarget(true); #endif } if (!m_target.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter target in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter target has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter target has not been defined in template %s!", DataResource::getName())); return base->getTarget(versionOk); } } Attributes value = static_cast(m_target.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2148,26 +2148,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate::_AttribMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_AttribMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getValue(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValue(versionOk); } } @@ -2177,9 +2177,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getValue(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2196,7 +2196,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2212,26 +2212,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate::_AttribMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_AttribMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getValueMin(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValueMin(versionOk); } } @@ -2241,9 +2241,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getValueMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2260,7 +2260,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2276,26 +2276,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate::_AttribMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_AttribMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getValueMax(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValueMax(versionOk); } } @@ -2305,9 +2305,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getValueMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2324,7 +2324,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2340,26 +2340,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_AttribMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_AttribMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTime(true); #endif } if (!m_time.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter time in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter time has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter time has not been defined in template %s!", DataResource::getName())); return base->getTime(versionOk); } } @@ -2369,9 +2369,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTime(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2388,7 +2388,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2404,26 +2404,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_AttribMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_AttribMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTimeMin(true); #endif } if (!m_time.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter time in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter time has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter time has not been defined in template %s!", DataResource::getName())); return base->getTimeMin(versionOk); } } @@ -2433,9 +2433,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTimeMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2452,7 +2452,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2468,26 +2468,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_AttribMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_AttribMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTimeMax(true); #endif } if (!m_time.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter time in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter time has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter time has not been defined in template %s!", DataResource::getName())); return base->getTimeMax(versionOk); } } @@ -2497,9 +2497,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTimeMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2516,7 +2516,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2532,26 +2532,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_AttribMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_AttribMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTimeAtValue(true); #endif } if (!m_timeAtValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter timeAtValue in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter timeAtValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter timeAtValue has not been defined in template %s!", DataResource::getName())); return base->getTimeAtValue(versionOk); } } @@ -2561,9 +2561,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTimeAtValue(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2580,7 +2580,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2596,26 +2596,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_AttribMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_AttribMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTimeAtValueMin(true); #endif } if (!m_timeAtValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter timeAtValue in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter timeAtValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter timeAtValue has not been defined in template %s!", DataResource::getName())); return base->getTimeAtValueMin(versionOk); } } @@ -2625,9 +2625,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTimeAtValueMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2644,7 +2644,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2660,26 +2660,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_AttribMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_AttribMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTimeAtValueMax(true); #endif } if (!m_timeAtValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter timeAtValue in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter timeAtValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter timeAtValue has not been defined in template %s!", DataResource::getName())); return base->getTimeAtValueMax(versionOk); } } @@ -2689,9 +2689,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTimeAtValueMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2708,7 +2708,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2724,26 +2724,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_AttribMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_AttribMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDecay(true); #endif } if (!m_decay.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter decay in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter decay has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter decay has not been defined in template %s!", DataResource::getName())); return base->getDecay(versionOk); } } @@ -2753,9 +2753,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getDecay(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2772,7 +2772,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2788,26 +2788,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_AttribMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_AttribMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDecayMin(true); #endif } if (!m_decay.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter decay in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter decay has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter decay has not been defined in template %s!", DataResource::getName())); return base->getDecayMin(versionOk); } } @@ -2817,9 +2817,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getDecayMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2836,7 +2836,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2852,26 +2852,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_AttribMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_AttribMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDecayMax(true); #endif } if (!m_decay.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter decay in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter decay has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter decay has not been defined in template %s!", DataResource::getName())); return base->getDecayMax(versionOk); } } @@ -2881,9 +2881,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getDecayMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2900,7 +2900,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2972,7 +2972,7 @@ char paramName[MAX_NAME_SIZE]; */ ServerObjectTemplate::Contents::Contents(void) { - content = NULL; + content = nullptr; } // ServerObjectTemplate::Contents::Contents() /** @@ -2983,7 +2983,7 @@ ServerObjectTemplate::Contents::Contents(const ServerObjectTemplate::Contents & equipObject(source.equipObject), content(source.content) { - if (content != NULL) + if (content != nullptr) const_cast(content)->addReference(); } // ServerObjectTemplate::Contents::Contents(const ServerObjectTemplate::Contents &) @@ -2992,10 +2992,10 @@ ServerObjectTemplate::Contents::Contents(const ServerObjectTemplate::Contents & */ ServerObjectTemplate::Contents::~Contents() { - if (content != NULL) + if (content != nullptr) { content->releaseReference(); - content = NULL; + content = nullptr; } } // ServerObjectTemplate::Contents::~Contents @@ -3065,33 +3065,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerObjectTemplate::_Contents * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_Contents * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSlotName(true); #endif } if (!m_slotName.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slotName in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slotName has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slotName has not been defined in template %s!", DataResource::getName())); return base->getSlotName(versionOk); } } const std::string & value = m_slotName.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3107,33 +3107,33 @@ bool testDataValue = false; UNREF(testData); #endif - const ServerObjectTemplate::_Contents * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_Contents * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getEquipObject(true); #endif } if (!m_equipObject.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter equipObject in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter equipObject has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter equipObject has not been defined in template %s!", DataResource::getName())); return base->getEquipObject(versionOk); } } bool value = m_equipObject.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3143,32 +3143,32 @@ UNREF(testData); const ServerObjectTemplate * ServerObjectTemplate::_Contents::getContent(bool versionOk) const { - const ServerObjectTemplate::_Contents * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_Contents * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_content.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter content in template %s", DataResource::getName())); - return NULL; + return nullptr; } else { - DEBUG_FATAL(base == NULL, ("Template parameter content has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter content has not been defined in template %s!", DataResource::getName())); return base->getContent(versionOk); } } - const ServerObjectTemplate * returnValue = NULL; + const ServerObjectTemplate * returnValue = nullptr; const std::string & templateName = m_content.getValue(); if (!templateName.empty()) { returnValue = dynamic_cast(ObjectTemplateList::fetch(templateName)); - if (returnValue == NULL) + if (returnValue == nullptr) WARNING_STRICT_FATAL(true, ("Error loading template %s",templateName.c_str())); } return returnValue; @@ -3273,33 +3273,33 @@ ServerObjectTemplate::MentalStates testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTarget(true); #endif } if (!m_target.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter target in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter target has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter target has not been defined in template %s!", DataResource::getName())); return base->getTarget(versionOk); } } MentalStates value = static_cast(m_target.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3315,26 +3315,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_MentalStateMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_MentalStateMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getValue(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValue(versionOk); } } @@ -3344,9 +3344,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getValue(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3363,7 +3363,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3379,26 +3379,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_MentalStateMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_MentalStateMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getValueMin(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValueMin(versionOk); } } @@ -3408,9 +3408,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getValueMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3427,7 +3427,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3443,26 +3443,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_MentalStateMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_MentalStateMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getValueMax(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValueMax(versionOk); } } @@ -3472,9 +3472,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getValueMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3491,7 +3491,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3507,26 +3507,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_MentalStateMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_MentalStateMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTime(true); #endif } if (!m_time.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter time in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter time has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter time has not been defined in template %s!", DataResource::getName())); return base->getTime(versionOk); } } @@ -3536,9 +3536,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTime(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3555,7 +3555,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3571,26 +3571,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_MentalStateMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_MentalStateMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTimeMin(true); #endif } if (!m_time.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter time in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter time has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter time has not been defined in template %s!", DataResource::getName())); return base->getTimeMin(versionOk); } } @@ -3600,9 +3600,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTimeMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3619,7 +3619,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3635,26 +3635,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_MentalStateMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_MentalStateMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTimeMax(true); #endif } if (!m_time.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter time in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter time has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter time has not been defined in template %s!", DataResource::getName())); return base->getTimeMax(versionOk); } } @@ -3664,9 +3664,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTimeMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3683,7 +3683,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3699,26 +3699,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_MentalStateMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_MentalStateMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTimeAtValue(true); #endif } if (!m_timeAtValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter timeAtValue in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter timeAtValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter timeAtValue has not been defined in template %s!", DataResource::getName())); return base->getTimeAtValue(versionOk); } } @@ -3728,9 +3728,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTimeAtValue(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3747,7 +3747,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3763,26 +3763,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_MentalStateMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_MentalStateMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTimeAtValueMin(true); #endif } if (!m_timeAtValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter timeAtValue in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter timeAtValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter timeAtValue has not been defined in template %s!", DataResource::getName())); return base->getTimeAtValueMin(versionOk); } } @@ -3792,9 +3792,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTimeAtValueMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3811,7 +3811,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3827,26 +3827,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_MentalStateMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_MentalStateMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTimeAtValueMax(true); #endif } if (!m_timeAtValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter timeAtValue in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter timeAtValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter timeAtValue has not been defined in template %s!", DataResource::getName())); return base->getTimeAtValueMax(versionOk); } } @@ -3856,9 +3856,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTimeAtValueMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3875,7 +3875,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3891,26 +3891,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_MentalStateMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_MentalStateMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDecay(true); #endif } if (!m_decay.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter decay in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter decay has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter decay has not been defined in template %s!", DataResource::getName())); return base->getDecay(versionOk); } } @@ -3920,9 +3920,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getDecay(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3939,7 +3939,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3955,26 +3955,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_MentalStateMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_MentalStateMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDecayMin(true); #endif } if (!m_decay.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter decay in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter decay has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter decay has not been defined in template %s!", DataResource::getName())); return base->getDecayMin(versionOk); } } @@ -3984,9 +3984,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getDecayMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -4003,7 +4003,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -4019,26 +4019,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_MentalStateMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_MentalStateMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDecayMax(true); #endif } if (!m_decay.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter decay in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter decay has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter decay has not been defined in template %s!", DataResource::getName())); return base->getDecayMax(versionOk); } } @@ -4048,9 +4048,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getDecayMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -4067,7 +4067,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -4185,33 +4185,33 @@ ServerObjectTemplate::XpTypes testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getType(true); #endif } if (!m_type.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter type in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter type has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter type has not been defined in template %s!", DataResource::getName())); return base->getType(versionOk); } } XpTypes value = static_cast(m_type.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -4227,26 +4227,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate::_Xp * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_Xp * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getLevel(true); #endif } if (!m_level.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter level in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter level has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter level has not been defined in template %s!", DataResource::getName())); return base->getLevel(versionOk); } } @@ -4256,9 +4256,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getLevel(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -4275,7 +4275,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -4291,26 +4291,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate::_Xp * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_Xp * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getLevelMin(true); #endif } if (!m_level.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter level in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter level has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter level has not been defined in template %s!", DataResource::getName())); return base->getLevelMin(versionOk); } } @@ -4320,9 +4320,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getLevelMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -4339,7 +4339,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -4355,26 +4355,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate::_Xp * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_Xp * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getLevelMax(true); #endif } if (!m_level.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter level in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter level has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter level has not been defined in template %s!", DataResource::getName())); return base->getLevelMax(versionOk); } } @@ -4384,9 +4384,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getLevelMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -4403,7 +4403,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -4419,26 +4419,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate::_Xp * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_Xp * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getValue(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValue(versionOk); } } @@ -4448,9 +4448,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getValue(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -4467,7 +4467,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -4483,26 +4483,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate::_Xp * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_Xp * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getValueMin(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValueMin(versionOk); } } @@ -4512,9 +4512,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getValueMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -4531,7 +4531,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -4547,26 +4547,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate::_Xp * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_Xp * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getValueMax(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValueMax(versionOk); } } @@ -4576,9 +4576,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getValueMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -4595,7 +4595,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlanetObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlanetObjectTemplate.cpp index 985007c1..3c4e1053 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlanetObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlanetObjectTemplate.cpp @@ -93,10 +93,10 @@ Tag ServerPlanetObjectTemplate::getTemplateVersion(void) const */ Tag ServerPlanetObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerPlanetObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerPlanetObjectTemplate::getHighestTemplateVersion @@ -120,33 +120,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerPlanetObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerPlanetObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getPlanetName(true); #endif } if (!m_planetName.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter planetName in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter planetName has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter planetName has not been defined in template %s!", DataResource::getName())); return base->getPlanetName(); } } const std::string & value = m_planetName.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -192,12 +192,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerObjectTemplate.cpp index 9051a1f9..effe5904 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerObjectTemplate.cpp @@ -95,10 +95,10 @@ Tag ServerPlayerObjectTemplate::getTemplateVersion(void) const */ Tag ServerPlayerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerPlayerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerPlayerObjectTemplate::getHighestTemplateVersion @@ -151,12 +151,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerQuestObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerQuestObjectTemplate.cpp index ea316d04..5949f691 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerQuestObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerQuestObjectTemplate.cpp @@ -95,10 +95,10 @@ Tag ServerPlayerQuestObjectTemplate::getTemplateVersion(void) const */ Tag ServerPlayerQuestObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerPlayerQuestObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerPlayerQuestObjectTemplate::getHighestTemplateVersion @@ -152,12 +152,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerResourceContainerObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerResourceContainerObjectTemplate.cpp index bdd03637..a5512489 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerResourceContainerObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerResourceContainerObjectTemplate.cpp @@ -93,10 +93,10 @@ Tag ServerResourceContainerObjectTemplate::getTemplateVersion(void) const */ Tag ServerResourceContainerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerResourceContainerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerResourceContainerObjectTemplate::getHighestTemplateVersion @@ -120,26 +120,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerResourceContainerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerResourceContainerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxResources(true); #endif } if (!m_maxResources.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxResources in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxResources has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxResources has not been defined in template %s!", DataResource::getName())); return base->getMaxResources(); } } @@ -149,9 +149,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxResources(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -168,7 +168,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -184,26 +184,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerResourceContainerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerResourceContainerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxResourcesMin(true); #endif } if (!m_maxResources.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxResources in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxResources has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxResources has not been defined in template %s!", DataResource::getName())); return base->getMaxResourcesMin(); } } @@ -213,9 +213,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxResourcesMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -232,7 +232,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -248,26 +248,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerResourceContainerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerResourceContainerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxResourcesMax(true); #endif } if (!m_maxResources.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxResources in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxResources has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxResources has not been defined in template %s!", DataResource::getName())); return base->getMaxResourcesMax(); } } @@ -277,9 +277,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxResourcesMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -296,7 +296,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -343,12 +343,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerShipObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerShipObjectTemplate.cpp index 1acde7a0..a2d12972 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerShipObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerShipObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag ServerShipObjectTemplate::getTemplateVersion(void) const */ Tag ServerShipObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerShipObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerShipObjectTemplate::getHighestTemplateVersion @@ -121,33 +121,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerShipObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerShipObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getShipType(true); #endif } if (!m_shipType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter shipType in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter shipType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter shipType has not been defined in template %s!", DataResource::getName())); return base->getShipType(); } } const std::string & value = m_shipType.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -193,12 +193,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerStaticObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerStaticObjectTemplate.cpp index 767901e7..f2e49fba 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerStaticObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerStaticObjectTemplate.cpp @@ -93,10 +93,10 @@ Tag ServerStaticObjectTemplate::getTemplateVersion(void) const */ Tag ServerStaticObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerStaticObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerStaticObjectTemplate::getHighestTemplateVersion @@ -120,33 +120,33 @@ bool testDataValue = false; UNREF(testData); #endif - const ServerStaticObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerStaticObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getClientOnlyBuildout(true); #endif } if (!m_clientOnlyBuildout.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter clientOnlyBuildout in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter clientOnlyBuildout has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter clientOnlyBuildout has not been defined in template %s!", DataResource::getName())); return base->getClientOnlyBuildout(); } } bool value = m_clientOnlyBuildout.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -192,12 +192,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerTangibleObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerTangibleObjectTemplate.cpp index 39d5e817..3bdb728d 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerTangibleObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerTangibleObjectTemplate.cpp @@ -53,7 +53,7 @@ ServerTangibleObjectTemplate::~ServerTangibleObjectTemplate() for (iter = m_triggerVolumes.begin(); iter != m_triggerVolumes.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_triggerVolumes.clear(); } @@ -105,10 +105,10 @@ Tag ServerTangibleObjectTemplate::getTemplateVersion(void) const */ Tag ServerTangibleObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerTangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerTangibleObjectTemplate::getHighestTemplateVersion @@ -126,27 +126,27 @@ Object * ServerTangibleObjectTemplate::createObject(void) const //@BEGIN TFD const TriggerVolumeData ServerTangibleObjectTemplate::getTriggerVolumes(int index) const { - const ServerTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_triggerVolumesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter triggerVolumes in template %s", DataResource::getName())); return DefaultTriggerVolumeData; } else { - DEBUG_FATAL(base == NULL, ("Template parameter triggerVolumes has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter triggerVolumes has not been defined in template %s!", DataResource::getName())); return base->getTriggerVolumes(index); } } - if (m_triggerVolumesAppend && base != NULL) + if (m_triggerVolumesAppend && base != nullptr) { int baseCount = base->getTriggerVolumesCount(); if (index < baseCount) @@ -164,20 +164,20 @@ size_t ServerTangibleObjectTemplate::getTriggerVolumesCount(void) const { if (!m_triggerVolumesLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const ServerTangibleObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getTriggerVolumesCount(); } size_t count = m_triggerVolumes.size(); // if we are extending our base template, add it's count - if (m_triggerVolumesAppend && m_baseData != NULL) + if (m_triggerVolumesAppend && m_baseData != nullptr) { const ServerTangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getTriggerVolumesCount(); } @@ -192,33 +192,33 @@ ServerTangibleObjectTemplate::CombatSkeleton testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCombatSkeleton(true); #endif } if (!m_combatSkeleton.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter combatSkeleton in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter combatSkeleton has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter combatSkeleton has not been defined in template %s!", DataResource::getName())); return base->getCombatSkeleton(); } } CombatSkeleton value = static_cast(m_combatSkeleton.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -234,26 +234,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxHitPoints(true); #endif } if (!m_maxHitPoints.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxHitPoints in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxHitPoints has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxHitPoints has not been defined in template %s!", DataResource::getName())); return base->getMaxHitPoints(); } } @@ -263,9 +263,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxHitPoints(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -282,7 +282,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -298,26 +298,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxHitPointsMin(true); #endif } if (!m_maxHitPoints.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxHitPoints in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxHitPoints has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxHitPoints has not been defined in template %s!", DataResource::getName())); return base->getMaxHitPointsMin(); } } @@ -327,9 +327,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxHitPointsMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -346,7 +346,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -362,26 +362,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxHitPointsMax(true); #endif } if (!m_maxHitPoints.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxHitPoints in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxHitPoints has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxHitPoints has not been defined in template %s!", DataResource::getName())); return base->getMaxHitPointsMax(); } } @@ -391,9 +391,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxHitPointsMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -410,7 +410,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -420,32 +420,32 @@ UNREF(testData); const ServerArmorTemplate * ServerTangibleObjectTemplate::getArmor() const { - const ServerTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_armor.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter armor in template %s", DataResource::getName())); - return NULL; + return nullptr; } else { - DEBUG_FATAL(base == NULL, ("Template parameter armor has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter armor has not been defined in template %s!", DataResource::getName())); return base->getArmor(); } } - const ServerArmorTemplate * returnValue = NULL; + const ServerArmorTemplate * returnValue = nullptr; const std::string & templateName = m_armor.getValue(); if (!templateName.empty()) { returnValue = dynamic_cast(ObjectTemplateList::fetch(templateName)); - if (returnValue == NULL) + if (returnValue == nullptr) WARNING_STRICT_FATAL(true, ("Error loading template %s",templateName.c_str())); } return returnValue; @@ -459,26 +459,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getInterestRadius(true); #endif } if (!m_interestRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter interestRadius in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter interestRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter interestRadius has not been defined in template %s!", DataResource::getName())); return base->getInterestRadius(); } } @@ -488,9 +488,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getInterestRadius(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -507,7 +507,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -523,26 +523,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getInterestRadiusMin(true); #endif } if (!m_interestRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter interestRadius in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter interestRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter interestRadius has not been defined in template %s!", DataResource::getName())); return base->getInterestRadiusMin(); } } @@ -552,9 +552,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getInterestRadiusMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -571,7 +571,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -587,26 +587,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getInterestRadiusMax(true); #endif } if (!m_interestRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter interestRadius in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter interestRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter interestRadius has not been defined in template %s!", DataResource::getName())); return base->getInterestRadiusMax(); } } @@ -616,9 +616,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getInterestRadiusMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -635,7 +635,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -651,26 +651,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCount(true); #endif } if (!m_count.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter count in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter count has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter count has not been defined in template %s!", DataResource::getName())); return base->getCount(); } } @@ -680,9 +680,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCount(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -699,7 +699,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -715,26 +715,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCountMin(true); #endif } if (!m_count.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter count in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter count has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter count has not been defined in template %s!", DataResource::getName())); return base->getCountMin(); } } @@ -744,9 +744,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCountMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -763,7 +763,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -779,26 +779,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCountMax(true); #endif } if (!m_count.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter count in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter count has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter count has not been defined in template %s!", DataResource::getName())); return base->getCountMax(); } } @@ -808,9 +808,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCountMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -827,7 +827,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -843,26 +843,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCondition(true); #endif } if (!m_condition.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter condition in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter condition has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter condition has not been defined in template %s!", DataResource::getName())); return base->getCondition(); } } @@ -872,9 +872,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCondition(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -891,7 +891,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -907,26 +907,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getConditionMin(true); #endif } if (!m_condition.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter condition in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter condition has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter condition has not been defined in template %s!", DataResource::getName())); return base->getConditionMin(); } } @@ -936,9 +936,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getConditionMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -955,7 +955,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -971,26 +971,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getConditionMax(true); #endif } if (!m_condition.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter condition in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter condition has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter condition has not been defined in template %s!", DataResource::getName())); return base->getConditionMax(); } } @@ -1000,9 +1000,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getConditionMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1019,7 +1019,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1035,33 +1035,33 @@ bool testDataValue = false; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getWantSawAttackTriggers(true); #endif } if (!m_wantSawAttackTriggers.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter wantSawAttackTriggers in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter wantSawAttackTriggers has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter wantSawAttackTriggers has not been defined in template %s!", DataResource::getName())); return base->getWantSawAttackTriggers(); } } bool value = m_wantSawAttackTriggers.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1116,12 +1116,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -1150,7 +1150,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_triggerVolumes.begin(); iter != m_triggerVolumes.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_triggerVolumes.clear(); m_triggerVolumesAppend = file.read_bool8(); diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerUniverseObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerUniverseObjectTemplate.cpp index 03a16459..9bba2b4b 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerUniverseObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerUniverseObjectTemplate.cpp @@ -93,10 +93,10 @@ Tag ServerUniverseObjectTemplate::getTemplateVersion(void) const */ Tag ServerUniverseObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerUniverseObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerUniverseObjectTemplate::getHighestTemplateVersion @@ -149,12 +149,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerVehicleObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerVehicleObjectTemplate.cpp index 501b241a..838e7107 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerVehicleObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerVehicleObjectTemplate.cpp @@ -93,10 +93,10 @@ Tag ServerVehicleObjectTemplate::getTemplateVersion(void) const */ Tag ServerVehicleObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerVehicleObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerVehicleObjectTemplate::getHighestTemplateVersion @@ -120,33 +120,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getFuelType(true); #endif } if (!m_fuelType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter fuelType in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter fuelType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter fuelType has not been defined in template %s!", DataResource::getName())); return base->getFuelType(); } } const std::string & value = m_fuelType.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -162,26 +162,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCurrentFuel(true); #endif } if (!m_currentFuel.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter currentFuel in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter currentFuel has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter currentFuel has not been defined in template %s!", DataResource::getName())); return base->getCurrentFuel(); } } @@ -191,9 +191,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCurrentFuel(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -210,7 +210,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -226,26 +226,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCurrentFuelMin(true); #endif } if (!m_currentFuel.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter currentFuel in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter currentFuel has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter currentFuel has not been defined in template %s!", DataResource::getName())); return base->getCurrentFuelMin(); } } @@ -255,9 +255,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCurrentFuelMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -274,7 +274,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -290,26 +290,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCurrentFuelMax(true); #endif } if (!m_currentFuel.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter currentFuel in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter currentFuel has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter currentFuel has not been defined in template %s!", DataResource::getName())); return base->getCurrentFuelMax(); } } @@ -319,9 +319,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCurrentFuelMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -338,7 +338,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -354,26 +354,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxFuel(true); #endif } if (!m_maxFuel.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxFuel in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxFuel has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxFuel has not been defined in template %s!", DataResource::getName())); return base->getMaxFuel(); } } @@ -383,9 +383,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxFuel(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -402,7 +402,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -418,26 +418,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxFuelMin(true); #endif } if (!m_maxFuel.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxFuel in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxFuel has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxFuel has not been defined in template %s!", DataResource::getName())); return base->getMaxFuelMin(); } } @@ -447,9 +447,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxFuelMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -466,7 +466,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -482,26 +482,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxFuelMax(true); #endif } if (!m_maxFuel.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxFuel in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxFuel has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxFuel has not been defined in template %s!", DataResource::getName())); return base->getMaxFuelMax(); } } @@ -511,9 +511,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxFuelMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -530,7 +530,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -546,26 +546,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getConsumpsion(true); #endif } if (!m_consumpsion.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter consumpsion in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter consumpsion has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter consumpsion has not been defined in template %s!", DataResource::getName())); return base->getConsumpsion(); } } @@ -575,9 +575,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getConsumpsion(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -594,7 +594,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -610,26 +610,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getConsumpsionMin(true); #endif } if (!m_consumpsion.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter consumpsion in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter consumpsion has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter consumpsion has not been defined in template %s!", DataResource::getName())); return base->getConsumpsionMin(); } } @@ -639,9 +639,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getConsumpsionMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -658,7 +658,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -674,26 +674,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getConsumpsionMax(true); #endif } if (!m_consumpsion.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter consumpsion in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter consumpsion has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter consumpsion has not been defined in template %s!", DataResource::getName())); return base->getConsumpsionMax(); } } @@ -703,9 +703,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getConsumpsionMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -722,7 +722,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -774,12 +774,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerWeaponObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerWeaponObjectTemplate.cpp index 8d4bbfa0..bf2ee2cb 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerWeaponObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerWeaponObjectTemplate.cpp @@ -93,10 +93,10 @@ Tag ServerWeaponObjectTemplate::getTemplateVersion(void) const */ Tag ServerWeaponObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerWeaponObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerWeaponObjectTemplate::getHighestTemplateVersion @@ -120,33 +120,33 @@ ServerWeaponObjectTemplate::WeaponType testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getWeaponType(true); #endif } if (!m_weaponType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter weaponType in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter weaponType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter weaponType has not been defined in template %s!", DataResource::getName())); return base->getWeaponType(); } } WeaponType value = static_cast(m_weaponType.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -162,33 +162,33 @@ ServerWeaponObjectTemplate::AttackType testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAttackType(true); #endif } if (!m_attackType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attackType in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter attackType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attackType has not been defined in template %s!", DataResource::getName())); return base->getAttackType(); } } AttackType value = static_cast(m_attackType.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -204,33 +204,33 @@ ServerWeaponObjectTemplate::DamageType testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDamageType(true); #endif } if (!m_damageType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter damageType in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter damageType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter damageType has not been defined in template %s!", DataResource::getName())); return base->getDamageType(); } } DamageType value = static_cast(m_damageType.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -246,33 +246,33 @@ ServerWeaponObjectTemplate::DamageType testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getElementalType(true); #endif } if (!m_elementalType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter elementalType in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter elementalType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter elementalType has not been defined in template %s!", DataResource::getName())); return base->getElementalType(); } } DamageType value = static_cast(m_elementalType.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -288,26 +288,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getElementalValue(true); #endif } if (!m_elementalValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter elementalValue in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter elementalValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter elementalValue has not been defined in template %s!", DataResource::getName())); return base->getElementalValue(); } } @@ -317,9 +317,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getElementalValue(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -336,7 +336,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -352,26 +352,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getElementalValueMin(true); #endif } if (!m_elementalValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter elementalValue in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter elementalValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter elementalValue has not been defined in template %s!", DataResource::getName())); return base->getElementalValueMin(); } } @@ -381,9 +381,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getElementalValueMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -400,7 +400,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -416,26 +416,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getElementalValueMax(true); #endif } if (!m_elementalValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter elementalValue in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter elementalValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter elementalValue has not been defined in template %s!", DataResource::getName())); return base->getElementalValueMax(); } } @@ -445,9 +445,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getElementalValueMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -464,7 +464,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -480,26 +480,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMinDamageAmount(true); #endif } if (!m_minDamageAmount.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter minDamageAmount in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter minDamageAmount has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter minDamageAmount has not been defined in template %s!", DataResource::getName())); return base->getMinDamageAmount(); } } @@ -509,9 +509,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinDamageAmount(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -528,7 +528,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -544,26 +544,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMinDamageAmountMin(true); #endif } if (!m_minDamageAmount.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter minDamageAmount in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter minDamageAmount has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter minDamageAmount has not been defined in template %s!", DataResource::getName())); return base->getMinDamageAmountMin(); } } @@ -573,9 +573,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinDamageAmountMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -592,7 +592,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -608,26 +608,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMinDamageAmountMax(true); #endif } if (!m_minDamageAmount.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter minDamageAmount in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter minDamageAmount has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter minDamageAmount has not been defined in template %s!", DataResource::getName())); return base->getMinDamageAmountMax(); } } @@ -637,9 +637,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinDamageAmountMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -656,7 +656,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -672,26 +672,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxDamageAmount(true); #endif } if (!m_maxDamageAmount.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxDamageAmount in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxDamageAmount has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxDamageAmount has not been defined in template %s!", DataResource::getName())); return base->getMaxDamageAmount(); } } @@ -701,9 +701,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxDamageAmount(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -720,7 +720,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -736,26 +736,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxDamageAmountMin(true); #endif } if (!m_maxDamageAmount.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxDamageAmount in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxDamageAmount has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxDamageAmount has not been defined in template %s!", DataResource::getName())); return base->getMaxDamageAmountMin(); } } @@ -765,9 +765,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxDamageAmountMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -784,7 +784,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -800,26 +800,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxDamageAmountMax(true); #endif } if (!m_maxDamageAmount.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxDamageAmount in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxDamageAmount has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxDamageAmount has not been defined in template %s!", DataResource::getName())); return base->getMaxDamageAmountMax(); } } @@ -829,9 +829,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxDamageAmountMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -848,7 +848,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -864,26 +864,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAttackSpeed(true); #endif } if (!m_attackSpeed.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attackSpeed in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter attackSpeed has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attackSpeed has not been defined in template %s!", DataResource::getName())); return base->getAttackSpeed(); } } @@ -893,9 +893,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAttackSpeed(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -912,7 +912,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -928,26 +928,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAttackSpeedMin(true); #endif } if (!m_attackSpeed.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attackSpeed in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter attackSpeed has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attackSpeed has not been defined in template %s!", DataResource::getName())); return base->getAttackSpeedMin(); } } @@ -957,9 +957,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAttackSpeedMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -976,7 +976,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -992,26 +992,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAttackSpeedMax(true); #endif } if (!m_attackSpeed.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attackSpeed in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter attackSpeed has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attackSpeed has not been defined in template %s!", DataResource::getName())); return base->getAttackSpeedMax(); } } @@ -1021,9 +1021,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAttackSpeedMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1040,7 +1040,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1056,26 +1056,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAudibleRange(true); #endif } if (!m_audibleRange.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter audibleRange in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter audibleRange has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter audibleRange has not been defined in template %s!", DataResource::getName())); return base->getAudibleRange(); } } @@ -1085,9 +1085,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAudibleRange(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1104,7 +1104,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1120,26 +1120,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAudibleRangeMin(true); #endif } if (!m_audibleRange.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter audibleRange in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter audibleRange has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter audibleRange has not been defined in template %s!", DataResource::getName())); return base->getAudibleRangeMin(); } } @@ -1149,9 +1149,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAudibleRangeMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1168,7 +1168,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1184,26 +1184,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAudibleRangeMax(true); #endif } if (!m_audibleRange.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter audibleRange in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter audibleRange has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter audibleRange has not been defined in template %s!", DataResource::getName())); return base->getAudibleRangeMax(); } } @@ -1213,9 +1213,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAudibleRangeMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1232,7 +1232,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1248,26 +1248,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMinRange(true); #endif } if (!m_minRange.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter minRange in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter minRange has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter minRange has not been defined in template %s!", DataResource::getName())); return base->getMinRange(); } } @@ -1277,9 +1277,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinRange(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1296,7 +1296,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1312,26 +1312,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMinRangeMin(true); #endif } if (!m_minRange.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter minRange in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter minRange has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter minRange has not been defined in template %s!", DataResource::getName())); return base->getMinRangeMin(); } } @@ -1341,9 +1341,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinRangeMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1360,7 +1360,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1376,26 +1376,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMinRangeMax(true); #endif } if (!m_minRange.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter minRange in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter minRange has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter minRange has not been defined in template %s!", DataResource::getName())); return base->getMinRangeMax(); } } @@ -1405,9 +1405,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinRangeMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1424,7 +1424,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1440,26 +1440,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxRange(true); #endif } if (!m_maxRange.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxRange in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxRange has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxRange has not been defined in template %s!", DataResource::getName())); return base->getMaxRange(); } } @@ -1469,9 +1469,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxRange(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1488,7 +1488,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1504,26 +1504,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxRangeMin(true); #endif } if (!m_maxRange.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxRange in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxRange has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxRange has not been defined in template %s!", DataResource::getName())); return base->getMaxRangeMin(); } } @@ -1533,9 +1533,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxRangeMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1552,7 +1552,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1568,26 +1568,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxRangeMax(true); #endif } if (!m_maxRange.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxRange in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxRange has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxRange has not been defined in template %s!", DataResource::getName())); return base->getMaxRangeMax(); } } @@ -1597,9 +1597,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxRangeMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1616,7 +1616,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1632,26 +1632,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDamageRadius(true); #endif } if (!m_damageRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter damageRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter damageRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter damageRadius has not been defined in template %s!", DataResource::getName())); return base->getDamageRadius(); } } @@ -1661,9 +1661,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getDamageRadius(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1680,7 +1680,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1696,26 +1696,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDamageRadiusMin(true); #endif } if (!m_damageRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter damageRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter damageRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter damageRadius has not been defined in template %s!", DataResource::getName())); return base->getDamageRadiusMin(); } } @@ -1725,9 +1725,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getDamageRadiusMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1744,7 +1744,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1760,26 +1760,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDamageRadiusMax(true); #endif } if (!m_damageRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter damageRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter damageRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter damageRadius has not been defined in template %s!", DataResource::getName())); return base->getDamageRadiusMax(); } } @@ -1789,9 +1789,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getDamageRadiusMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1808,7 +1808,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1824,26 +1824,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getWoundChance(true); #endif } if (!m_woundChance.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter woundChance in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter woundChance has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter woundChance has not been defined in template %s!", DataResource::getName())); return base->getWoundChance(); } } @@ -1853,9 +1853,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getWoundChance(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1872,7 +1872,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1888,26 +1888,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getWoundChanceMin(true); #endif } if (!m_woundChance.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter woundChance in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter woundChance has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter woundChance has not been defined in template %s!", DataResource::getName())); return base->getWoundChanceMin(); } } @@ -1917,9 +1917,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getWoundChanceMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1936,7 +1936,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1952,26 +1952,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getWoundChanceMax(true); #endif } if (!m_woundChance.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter woundChance in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter woundChance has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter woundChance has not been defined in template %s!", DataResource::getName())); return base->getWoundChanceMax(); } } @@ -1981,9 +1981,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getWoundChanceMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2000,7 +2000,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2016,26 +2016,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAttackCost(true); #endif } if (!m_attackCost.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attackCost in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter attackCost has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attackCost has not been defined in template %s!", DataResource::getName())); return base->getAttackCost(); } } @@ -2045,9 +2045,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAttackCost(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2064,7 +2064,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2080,26 +2080,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAttackCostMin(true); #endif } if (!m_attackCost.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attackCost in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter attackCost has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attackCost has not been defined in template %s!", DataResource::getName())); return base->getAttackCostMin(); } } @@ -2109,9 +2109,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAttackCostMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2128,7 +2128,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2144,26 +2144,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAttackCostMax(true); #endif } if (!m_attackCost.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attackCost in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter attackCost has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attackCost has not been defined in template %s!", DataResource::getName())); return base->getAttackCostMax(); } } @@ -2173,9 +2173,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAttackCostMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2192,7 +2192,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2208,26 +2208,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAccuracy(true); #endif } if (!m_accuracy.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter accuracy in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter accuracy has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter accuracy has not been defined in template %s!", DataResource::getName())); return base->getAccuracy(); } } @@ -2237,9 +2237,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAccuracy(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2256,7 +2256,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2272,26 +2272,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAccuracyMin(true); #endif } if (!m_accuracy.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter accuracy in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter accuracy has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter accuracy has not been defined in template %s!", DataResource::getName())); return base->getAccuracyMin(); } } @@ -2301,9 +2301,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAccuracyMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2320,7 +2320,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2336,26 +2336,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAccuracyMax(true); #endif } if (!m_accuracy.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter accuracy in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter accuracy has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter accuracy has not been defined in template %s!", DataResource::getName())); return base->getAccuracyMax(); } } @@ -2365,9 +2365,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAccuracyMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2384,7 +2384,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2455,12 +2455,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerXpManagerObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerXpManagerObjectTemplate.cpp index 4ee70d19..0fc6ff30 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerXpManagerObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerXpManagerObjectTemplate.cpp @@ -95,10 +95,10 @@ Tag ServerXpManagerObjectTemplate::getTemplateVersion(void) const */ Tag ServerXpManagerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerXpManagerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerXpManagerObjectTemplate::getHighestTemplateVersion @@ -111,7 +111,7 @@ Tag ServerXpManagerObjectTemplate::getHighestTemplateVersion(void) const Object * ServerXpManagerObjectTemplate::createObject(void) const { // return new XpManagerObject(this); - return NULL; + return nullptr; } // ServerXpManagerObjectTemplate::createObject //@BEGIN TFD @@ -152,12 +152,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/pvp/Pvp.cpp b/engine/server/library/serverGame/src/shared/pvp/Pvp.cpp index 4de849cd..d6e291ae 100755 --- a/engine/server/library/serverGame/src/shared/pvp/Pvp.cpp +++ b/engine/server/library/serverGame/src/shared/pvp/Pvp.cpp @@ -613,7 +613,7 @@ void Pvp::updateTimedFlags(const void *context) unsigned long const updateTimeMs = static_cast(ConfigServerGame::getPvpUpdateTimeMs()); PvpInternal::updateTimedFlags(updateTimeMs); - getScheduler().setCallback(Pvp::updateTimedFlags, NULL, updateTimeMs); + getScheduler().setCallback(Pvp::updateTimedFlags, nullptr, updateTimeMs); } // ---------------------------------------------------------------------- @@ -754,7 +754,7 @@ Pvp::GcwScoreCategory const * Pvp::getGcwScoreCategory(std::string const & score if (iterFind != s_gcwScoreCategory.end()) return iterFind->second; - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -765,7 +765,7 @@ Pvp::GcwScoreCategory const * Pvp::getGcwScoreDefaultCategoryForPlanet(std::stri if (iterFind != s_gcwScoreDefaultCategoryForPlanet.end()) return iterFind->second; - return NULL; + return nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/pvp/PvpRuleSetBase.cpp b/engine/server/library/serverGame/src/shared/pvp/PvpRuleSetBase.cpp index 440b0ed7..d0c4212f 100755 --- a/engine/server/library/serverGame/src/shared/pvp/PvpRuleSetBase.cpp +++ b/engine/server/library/serverGame/src/shared/pvp/PvpRuleSetBase.cpp @@ -27,8 +27,8 @@ namespace PvpRuleSetBaseNamespace // if object is authoritative, then apply repercussions immediately; // otherwise, forward repercussions over to the authoritative server - PvpUpdateObserver * o = NULL; - MessageQueuePvpCommand * messageQueuePvpCommand = NULL; + PvpUpdateObserver * o = nullptr; + MessageQueuePvpCommand * messageQueuePvpCommand = nullptr; if (actor.isAuthoritative()) o = new PvpUpdateObserver(&actor, Archive::ADOO_generic); diff --git a/engine/server/library/serverGame/src/shared/pvp/PvpUpdateObserver.cpp b/engine/server/library/serverGame/src/shared/pvp/PvpUpdateObserver.cpp index 70f55095..d333bbb0 100755 --- a/engine/server/library/serverGame/src/shared/pvp/PvpUpdateObserver.cpp +++ b/engine/server/library/serverGame/src/shared/pvp/PvpUpdateObserver.cpp @@ -81,7 +81,7 @@ PvpUpdateObserver::PvpUpdateObserver(TangibleObject const *who, Archive::AutoDel m_pvpFaction = who->getPvpFaction(); // get client visible status for everyone observing this object (including itself) - if ((s_objectsProcessedThisFrame.count(who->getNetworkId()) == 0) && satisfyPvpSyncCondition(who->isNonPvpObject(), who->hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (who->asCreatureObject() != NULL), who->getPvpFaction())) + if ((s_objectsProcessedThisFrame.count(who->getNetworkId()) == 0) && satisfyPvpSyncCondition(who->isNonPvpObject(), who->hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (who->asCreatureObject() != nullptr), who->getPvpFaction())) { std::set const &clients = who->getObservers(); for (std::set::const_iterator i = clients.begin(); i != clients.end(); ++i) @@ -146,8 +146,8 @@ PvpUpdateObserver::~PvpUpdateObserver() PvpData::isRebelFactionId(m_obj->getPvpFaction())) { // did the object's "pvp sync" status change because of the faction change? - bool const wasPvpSync = PvpUpdateObserver::satisfyPvpSyncCondition(m_obj->isNonPvpObject(), m_obj->hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (m_obj->asCreatureObject() != NULL), m_pvpFaction); - bool const isPvpSync = PvpUpdateObserver::satisfyPvpSyncCondition(m_obj->isNonPvpObject(), m_obj->hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (m_obj->asCreatureObject() != NULL), m_obj->getPvpFaction()); + bool const wasPvpSync = PvpUpdateObserver::satisfyPvpSyncCondition(m_obj->isNonPvpObject(), m_obj->hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (m_obj->asCreatureObject() != nullptr), m_pvpFaction); + bool const isPvpSync = PvpUpdateObserver::satisfyPvpSyncCondition(m_obj->isNonPvpObject(), m_obj->hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (m_obj->asCreatureObject() != nullptr), m_obj->getPvpFaction()); if (wasPvpSync != isPvpSync) { @@ -173,7 +173,7 @@ PvpUpdateObserver::~PvpUpdateObserver() void PvpUpdateObserver::updatePvpStatusCache(Client const *client, TangibleObject const &who, uint32 flags, uint32 factionId) { - if (!client || !who.getNetworkId().isValid() || !PvpUpdateObserver::satisfyPvpSyncCondition(who.isNonPvpObject(), who.hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (who.asCreatureObject() != NULL), who.getPvpFaction())) + if (!client || !who.getNetworkId().isValid() || !PvpUpdateObserver::satisfyPvpSyncCondition(who.isNonPvpObject(), who.hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (who.asCreatureObject() != nullptr), who.getPvpFaction())) return; s_pvpUpdateObserverCache[client][who.getNetworkId()] = std::make_pair(flags, factionId); diff --git a/engine/server/library/serverGame/src/shared/region/Region.cpp b/engine/server/library/serverGame/src/shared/region/Region.cpp index fc74229a..c24a3500 100755 --- a/engine/server/library/serverGame/src/shared/region/Region.cpp +++ b/engine/server/library/serverGame/src/shared/region/Region.cpp @@ -22,7 +22,7 @@ static std::map s_nameCrcRegionMap; * Class constructor for a static region. */ Region::Region() : - m_bounds(NULL), + m_bounds(nullptr), m_dynamicRegionId(), m_name(), m_nameCrc(0), @@ -49,7 +49,7 @@ Region::Region() : * @param dynamicRegionId the id of the dynamic region object */ Region::Region(const CachedNetworkId & dynamicRegionId) : - m_bounds(NULL), + m_bounds(nullptr), m_dynamicRegionId(dynamicRegionId), m_name(), m_nameCrc(0), @@ -83,7 +83,7 @@ Region::~Region() } delete const_cast(m_bounds); - m_bounds = NULL; + m_bounds = nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/region/RegionMaster.cpp b/engine/server/library/serverGame/src/shared/region/RegionMaster.cpp index 6cbb7710..d8f734a6 100755 --- a/engine/server/library/serverGame/src/shared/region/RegionMaster.cpp +++ b/engine/server/library/serverGame/src/shared/region/RegionMaster.cpp @@ -82,7 +82,7 @@ struct RegionMaster::RegionData MxCifQuadTree * tree; RegionsMappedByName nameMap; - RegionData() : tree(NULL), nameMap() {} + RegionData() : tree(nullptr), nameMap() {} }; namespace RegionMasterNamspace @@ -133,7 +133,7 @@ void RegionMaster::exit() i1 != ms_planetRegions.end(); ++i1) { delete (*i1).second.tree; - (*i1).second.tree = NULL; + (*i1).second.tree = nullptr; } ms_planetRegions.clear(); } @@ -143,7 +143,7 @@ void RegionMaster::exit() i2 != ms_staticRegions.end(); ++i2) { delete const_cast(*i2); - *i2 = NULL; + *i2 = nullptr; } ms_staticRegions.clear(); } @@ -153,7 +153,7 @@ void RegionMaster::exit() i2 != ms_dynamicRegions.end(); ++i2) { delete const_cast(*i2); - *i2 = NULL; + *i2 = nullptr; } ms_dynamicRegions.clear(); } @@ -178,7 +178,7 @@ void RegionMaster::readRegionDataTables() const char * regionFilesName = ConfigServerGame::getRegionFilesName(); DataTable * const regionFilesTable = DataTableManager::getTable(regionFilesName, true); - if (regionFilesTable == NULL) + if (regionFilesTable == nullptr) { WARNING(true, ("RegionMaster::readRegionDataTables could not open file %s, static regions will not be read!", regionFilesName)); return; @@ -197,14 +197,14 @@ void RegionMaster::readRegionDataTables() float regionMaxY = regionFilesTable->getFloatValue (5, i); DataTable * const regionTable = DataTableManager::getTable(regionFileName, true); - if (regionTable == NULL) + if (regionTable == nullptr) { WARNING(true, ("RegionMaster::readRegionDataTables could not open region file %s.", regionFileName.c_str())); continue; } RegionData & regionData = ms_planetRegions[planetName]; - if (regionData.tree == NULL) + if (regionData.tree == nullptr) { regionData.tree = new MxCifQuadTree(regionMinX, regionMinY, regionMaxX, regionMaxY, ConfigServerGame::getRegionTreeDepth()); } @@ -246,7 +246,7 @@ void RegionMaster::readRegionDataTables() } // create a rectangular or circular region and add it to the region tree - Region * region = NULL; + Region * region = nullptr; switch (geometry) { case RG_rectagle: @@ -284,7 +284,7 @@ void RegionMaster::readRegionDataTables() continue; } // set the rest of the region's data - if (region != NULL) + if (region != nullptr) { region->setName(name); region->setPlanet(planetName); @@ -400,7 +400,7 @@ void RegionMaster::createNewDynamicRegion(float minX, float minZ, * @param visible visible flag * @param notify notify flag * - * @return the new region, or NULL on error + * @return the new region, or nullptr on error */ void RegionMaster::createNewDynamicRegion(float centerX, float centerZ, float radius, const Unicode::String & name, const std::string & planet, int pvp, @@ -512,7 +512,7 @@ const Region * RegionMaster::addDynamicRegion(const UniverseObject & source) if (!ms_installed) { WARNING(true, ("RegionMaster::addDynamicRegion, not installed")); - return NULL; + return nullptr; } DynamicVariableList::NestedList regionObjvars(source.getObjVars(),OBJVAR_DYNAMIC_REGION); @@ -521,124 +521,124 @@ const Region * RegionMaster::addDynamicRegion(const UniverseObject & source) if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_PLANET,planet)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no planet data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } Unicode::String name; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_NAME,name)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no name data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } if (name.empty()) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has empty " "name data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } int geometry = 0; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_GEOMETRY,geometry)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "geometry data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } float minX; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_MINX,minX)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "minX data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } float minY; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_MINY,minY)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "minY data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } float maxX; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_MAXX,maxX)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "maxX data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } float maxY; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_MAXY,maxY)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "maxY data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } int pvp=0; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_PVP,pvp)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "pvp data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } int geography=0; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_GEOGRAPHY,geography)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "geography data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } int minDifficulty = 0; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_MIN_DIFFICULTY, minDifficulty)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "min difficulty data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } int maxDifficulty = 0; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_MAX_DIFFICULTY, maxDifficulty)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "max difficulty data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } int spawn = 0; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_SPAWN,spawn)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "spawn data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } int mission = 0; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_MISSION,mission)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "mission data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } int buildable = 0; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_BUILDABLE,buildable)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "buildable data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } int municipal = 0; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_MUNICIPAL,municipal)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "municipal data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } int visible = 0; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_VISIBLE,visible)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "visible data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } int notify = 0; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_NOTIFY,notify)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "notify data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } // find the appropriate region data for the planet @@ -650,14 +650,14 @@ const Region * RegionMaster::addDynamicRegion(const UniverseObject & source) WARNING(true, ("RegionMaster::addDynamicRegion object %s gave unknown " "planet %s for its region", source.getNetworkId().getValueString().c_str(), Unicode::wideToNarrow(planet).c_str())); - return NULL; + return nullptr; } RegionData & regionData = (*result).second; - if (regionData.tree == NULL) + if (regionData.tree == nullptr) { WARNING_STRICT_FATAL(true, ("RegionMaster::addDynamicRegion planet %s " "has no tree defined!", Unicode::wideToNarrow(planet).c_str())); - return NULL; + return nullptr; } // make sure the region name is unique @@ -666,11 +666,11 @@ const Region * RegionMaster::addDynamicRegion(const UniverseObject & source) WARNING(true, ("RegionMaster::addDynamicRegion object %s is trying " "to add duplicate region %s", source.getNetworkId().getValueString().c_str(), Unicode::wideToNarrow(name).c_str())); - return NULL; + return nullptr; } // create a rectangular or circular region and add it to the region tree - Region * region = NULL; + Region * region = nullptr; switch (geometry) { case RG_rectagle: @@ -706,14 +706,14 @@ const Region * RegionMaster::addDynamicRegion(const UniverseObject & source) DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has unknown " "geometry type", source.getNetworkId().getValueString().c_str(), geometry)); - return NULL; + return nullptr; } - if (region == NULL) + if (region == nullptr) { WARNING(true, ("RegionMaster::readRegionDataTables could " "not add region defined by object %s to region tree", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } // set the rest of the region's data @@ -803,7 +803,7 @@ void RegionMaster::removeDynamicRegion(const UniverseObject & source) return; } RegionData & regionData = (*dataResult).second; - if (regionData.tree == NULL) + if (regionData.tree == nullptr) { WARNING_STRICT_FATAL(true, ("RegionMaster::addDynamicRegion planet %s " "has no tree defined!", Unicode::wideToNarrow(planet).c_str())); @@ -888,7 +888,7 @@ const Region * RegionMaster::getDynamicRegionFromObject(const UniverseObject & s if (!ms_installed) { WARNING(true, ("RegionMaster::getDynamicRegionFromObject, not installed")); - return NULL; + return nullptr; } DynamicVariableList::NestedList regionObjVars(source.getObjVars(),OBJVAR_DYNAMIC_REGION); @@ -898,14 +898,14 @@ const Region * RegionMaster::getDynamicRegionFromObject(const UniverseObject & s { DEBUG_WARNING(true, ("RegionMaster::getDynamicRegionFromObject object %s has no " "planet data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } Unicode::String name; if (!regionObjVars.getItem(OBJVAR_DYNAMIC_REGION_NAME,name)) { DEBUG_WARNING(true, ("RegionMaster::getDynamicRegionFromObject object %s has no " "name data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } return getRegionByName(Unicode::wideToNarrow(planet), name); @@ -921,17 +921,17 @@ Region * RegionMaster::getRegionByName(const std::string & planetName, const Uni if (!ms_installed) { WARNING(true, ("RegionMaster::getRegionByName, not installed")); - return NULL; + return nullptr; } const RegionData & regionData = ms_planetRegions[planetName]; - if (regionData.tree != NULL) + if (regionData.tree != nullptr) { RegionsMappedByName::const_iterator result = regionData.nameMap.find(regionName); if (result != regionData.nameMap.end()) return (*result).second; } - return NULL; + return nullptr; } // RegionMaster::getRegionByName //---------------------------------------------------------------------- @@ -944,18 +944,18 @@ const Region * RegionMaster::getSmallestRegionAtPoint(const std::string & planet if (!ms_installed) { WARNING(true, ("RegionMaster::getSmallestRegionAtPoint, not installed")); - return NULL; + return nullptr; } std::vector regions; getRegionsAtPoint(planet, x, z, regions); float area = 0; - const Region * region = NULL; + const Region * region = nullptr; for (std::vector::const_iterator iter = regions.begin(); iter != regions.end(); ++iter) { - if (region == NULL) + if (region == nullptr) { region = *iter; area = region->getArea(); @@ -983,19 +983,19 @@ const Region * RegionMaster::getSmallestVisibleRegionAtPoint(const std::string & if (!ms_installed) { WARNING(true, ("RegionMaster::getSmallestRegionAtPoint, not installed")); - return NULL; + return nullptr; } std::vector regions; getRegionsAtPoint(planet, x, z, regions); float area = 0; - const Region * region = NULL; + const Region * region = nullptr; for (std::vector::const_iterator iter = regions.begin(); iter != regions.end(); ++iter) { if ((*iter)->isVisible()) { - if (region == NULL) + if (region == nullptr) { region = *iter; area = region->getArea(); @@ -1036,7 +1036,7 @@ void RegionMaster::getRegionsAtPoint(const std::string & planet, float x, float } const RegionData & regionData = ms_planetRegions[planet]; - if (regionData.tree != NULL) + if (regionData.tree != nullptr) { std::vector objects; regionData.tree->getObjectsAt(x, z, objects); @@ -1065,7 +1065,7 @@ void RegionMaster::getRegionsForPlanet(const std::string & planetName, } const RegionData & regionData = ms_planetRegions[planetName]; - if (regionData.tree != NULL) + if (regionData.tree != nullptr) { std::vector objects; regionData.tree->getAllObjects(objects); @@ -1222,7 +1222,7 @@ bool RegionMaster::setDynamicSpawnRegionObjectData(UniverseObject & object, int municipal, int geography, int minDifficulty, int maxDifficulty, int spawnable, int mission, bool visible, bool notify, std::string spawntable, int duration) { - time_t const birthEpoch = ::time(NULL); + time_t const birthEpoch = ::time(nullptr); time_t const endEpoch = birthEpoch + (duration * 60); // Duration is in minutes. object.setObjVarItem(OBJVAR_DYNAMIC_REGION + "." + OBJVAR_DYNAMIC_REGION_NAME, name); diff --git a/engine/server/library/serverGame/src/shared/resource/SurveySystem.cpp b/engine/server/library/serverGame/src/shared/resource/SurveySystem.cpp index cac26554..93c8f549 100755 --- a/engine/server/library/serverGame/src/shared/resource/SurveySystem.cpp +++ b/engine/server/library/serverGame/src/shared/resource/SurveySystem.cpp @@ -132,7 +132,7 @@ bool SurveySystem::TaskSurvey::run() Client const * client = GameServer::getInstance().getClient(m_playerId); ResourceTypeObject const * typeObj = ServerUniverse::getInstance().getResourceTypeByName(*m_resourceTypeName); ResourceClassObject const * parentClass = ServerUniverse::getInstance().getResourceClassByName(*m_parentResourceClassName); - ResourcePoolObject const * pool = typeObj ? typeObj->getPoolForCurrentPlanet() : NULL; + ResourcePoolObject const * pool = typeObj ? typeObj->getPoolForCurrentPlanet() : nullptr; int distBetweenPoints = m_surveyRange / (m_numPoints - 1); // -1 is so that we get points at both ends int radius = m_surveyRange / 2; diff --git a/engine/server/library/serverGame/src/shared/space/Missile.cpp b/engine/server/library/serverGame/src/shared/space/Missile.cpp index bd4400a5..67582022 100755 --- a/engine/server/library/serverGame/src/shared/space/Missile.cpp +++ b/engine/server/library/serverGame/src/shared/space/Missile.cpp @@ -304,7 +304,7 @@ ServerObject * Missile::getSourceServerObject() const if (sourceObject) return sourceObject->asServerObject(); else - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -315,7 +315,7 @@ ServerObject * Missile::getTargetServerObject() const if (targetObject) return targetObject->asServerObject(); else - return NULL; + return nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/space/MissileManager.cpp b/engine/server/library/serverGame/src/shared/space/MissileManager.cpp index ab30ae81..512696ff 100755 --- a/engine/server/library/serverGame/src/shared/space/MissileManager.cpp +++ b/engine/server/library/serverGame/src/shared/space/MissileManager.cpp @@ -21,7 +21,7 @@ // ====================================================================== -MissileManager * MissileManager::ms_instance = NULL; +MissileManager * MissileManager::ms_instance = nullptr; // ====================================================================== @@ -37,7 +37,7 @@ void MissileManager::install() void MissileManager::remove() { delete ms_instance; - ms_instance = NULL; + ms_instance = nullptr; } // ---------------------------------------------------------------------- @@ -217,7 +217,7 @@ Missile * MissileManager::getMissile(int missileId) if (i!=m_missiles.end()) return i->second; else - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -228,7 +228,7 @@ const Missile * MissileManager::getConstMissile(int missileId) const if (i!=m_missiles.end()) return i->second; else - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -241,13 +241,13 @@ int MissileManager::getNearestUnlockedMissileForTarget(const NetworkId &target) { const std::pair range=m_missilesForTarget.equal_range(target); - const Missile *targetedMissile=NULL; + const Missile *targetedMissile=nullptr; for (MissilesForTargetType::const_iterator i=range.first; i!=range.second; ++i) { const Missile * const missile=getConstMissile(i->second); DEBUG_FATAL(!missile,("Programmer bug: Missile %i was in m_missilesForTarget, but was not in m_missiles",i->second)); if (missile && missile->getState() == Missile::MS_Launched && - (!targetedMissile || (missile->getImpactTime() < targetedMissile->getImpactTime()))) //lint !e774: missile is non-null in debug mode + (!targetedMissile || (missile->getImpactTime() < targetedMissile->getImpactTime()))) //lint !e774: missile is non-nullptr in debug mode targetedMissile = missile; } @@ -315,7 +315,7 @@ const MissileManager::MissileTypeDataRecord * MissileManager::getMissileTypeData if (i!=m_missileTypeData.end()) return &(i->second); else - return NULL; + return nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/space/NebulaManagerServer.cpp b/engine/server/library/serverGame/src/shared/space/NebulaManagerServer.cpp index 432d57f6..910cbcc3 100755 --- a/engine/server/library/serverGame/src/shared/space/NebulaManagerServer.cpp +++ b/engine/server/library/serverGame/src/shared/space/NebulaManagerServer.cpp @@ -89,7 +89,7 @@ void NebulaManagerServer::update(float elapsedTime) void NebulaManagerServer::enqueueLightning(NebulaLightningData const & nebulaLightningData) { Nebula const * const nebula = NebulaManager::getNebulaById(nebulaLightningData.nebulaId); - if (nebula == NULL) + if (nebula == nullptr) { WARNING(true, ("NebulaManagerServer::enqueueLightning invalid nebula [%d]", nebulaLightningData.nebulaId)); return; @@ -164,7 +164,7 @@ void NebulaManagerServer::handleEnqueuedLightningEvents() NebulaLightningData const & nebulaLightningData = (*it); Nebula const * const nebula = NebulaManager::getNebulaById(nebulaLightningData.nebulaId); - if (nebula == NULL) + if (nebula == nullptr) { it = s_lightningDataVector.erase(it); continue; @@ -203,7 +203,7 @@ void NebulaManagerServer::handleEnqueuedLightningEvents() ServerObject const * const serverHitObject = hitObject->asServerObject(); ShipObject const * const shipHitObject = serverHitObject->asShipObject(); - if (shipHitObject != NULL) + if (shipHitObject != nullptr) { NetworkIdTimeMap::const_iterator const oit = s_objectsRecentlyHitByLightning.find(CachedNetworkId(*hitObject)); if (oit == s_objectsRecentlyHitByLightning.end() || (*oit).second < clockTimeMs) @@ -304,7 +304,7 @@ void NebulaManagerServer::generateLightningEvents(float elapsedTime) void NebulaManagerServer::handleEnvironmentalDamage(ServerObject & victim, int nebulaId) { Nebula const * const nebula = NebulaManager::getNebulaById(nebulaId); - if (nebula == NULL) + if (nebula == nullptr) return; float const environmentalDamageFrequency = nebula->getEnvironmentalDamageFrequency(); diff --git a/engine/server/library/serverGame/src/shared/space/ProjectileManager.cpp b/engine/server/library/serverGame/src/shared/space/ProjectileManager.cpp index 61ff31b3..2354ae60 100755 --- a/engine/server/library/serverGame/src/shared/space/ProjectileManager.cpp +++ b/engine/server/library/serverGame/src/shared/space/ProjectileManager.cpp @@ -85,7 +85,7 @@ namespace ProjectileManagerNamespace //---------------------------------------------------------------------- Projectile() : - m_owner(NULL), + m_owner(nullptr), m_weaponIndex(0), m_projectileIndex(0), m_targetedComponent(0), @@ -155,7 +155,7 @@ namespace ProjectileManagerNamespace ColliderList collidedWith; CollisionWorld::getDatabase()->queryFor(static_cast(SpatialDatabase::Q_Physicals), CellProperty::getWorldCellProperty(), true, projectileCapsule_w, collidedWith); - Object * closestObject = NULL; + Object * closestObject = nullptr; float smallestTime = 0.0f; Vector collisionPosition_o; @@ -166,14 +166,14 @@ namespace ProjectileManagerNamespace { // find which object it collided with first, and when BaseExtent const * const extent_l = (*i)->getExtent_l(); - if (extent_l == NULL) - WARNING(true, ("ProjectileManager collided with object with null extent. [%s], appearance=[%s]", collider.getDebugName(), collider.getAppearanceTemplateName())); + if (extent_l == nullptr) + WARNING(true, ("ProjectileManager collided with object with nullptr extent. [%s], appearance=[%s]", collider.getDebugName(), collider.getAppearanceTemplateName())); else { Vector const start_o = collider.rotateTranslate_w2o(projectilePosition_w); Vector const end_o = collider.rotateTranslate_w2o(projectilePosition_w + projectilePath); float time; - if (extent_l->intersect(start_o, end_o, NULL, &time)) + if (extent_l->intersect(start_o, end_o, nullptr, &time)) { if (!closestObject || time < smallestTime) { @@ -415,7 +415,7 @@ void ProjectileManager::update(float timePassed) // static ShipObject * const shipObject = projectile.getOwner(); - if (NULL == shipObject) + if (nullptr == shipObject) { WARNING(true, ("ProjectileManager beam weapon [%d] for ship id [%s], ship object no longer exists.", weaponIndex, shipId.getValueString().c_str())); } diff --git a/engine/server/library/serverGame/src/shared/space/ServerAsteroidManager.cpp b/engine/server/library/serverGame/src/shared/space/ServerAsteroidManager.cpp index 1a0cfa50..09fb57d0 100755 --- a/engine/server/library/serverGame/src/shared/space/ServerAsteroidManager.cpp +++ b/engine/server/library/serverGame/src/shared/space/ServerAsteroidManager.cpp @@ -116,10 +116,10 @@ ServerAsteroidManager::FieldHandle ServerAsteroidManager::generateField(Asteroid return BAD_HANDLE; } - ServerObject * newAsteroid = NULL; + ServerObject * newAsteroid = nullptr; //TODO disable server-rotation for now, it apparently spams the client horribly -// RotationDynamics * rotationDynamics = NULL; +// RotationDynamics * rotationDynamics = nullptr; for(std::vector::iterator i = asteroidDatas.begin(); i != asteroidDatas.end(); ++i) { @@ -274,7 +274,7 @@ void ServerAsteroidManager::getServerAsteroidData(std::vector & /*OUT*/ for(std::vector::iterator i = ms_asteroids.begin(); i != ms_asteroids.end(); ++i) { Object const * const o = NetworkIdManager::getObjectById(*i); - ServerObject const * const so = o ? o->asServerObject() : NULL; + ServerObject const * const so = o ? o->asServerObject() : nullptr; if(so) { spheres.push_back(so->getSphereExtent()); @@ -297,9 +297,9 @@ void ServerAsteroidManager::sendServerAsteroidDataToPlayer(NetworkId const & pla MessageQueueGenericValueType > * const msg = new MessageQueueGenericValueType >(spheres); Object * const o = NetworkIdManager::getObjectById(player); - ServerObject * const so = o ? o->asServerObject() : NULL; - CreatureObject * const co = so ? so->asCreatureObject() : NULL; - Client const * const client = co ? co->getClient() : NULL; + ServerObject * const so = o ? o->asServerObject() : nullptr; + CreatureObject * const co = so ? so->asCreatureObject() : nullptr; + Client const * const client = co ? co->getClient() : nullptr; if(client && co && co->isAuthoritative()) { co->getController()->appendMessage(static_cast(CM_serverAsteroidDebugData), 0.0f, msg, diff --git a/engine/server/library/serverGame/src/shared/space/ServerShipComponentData.cpp b/engine/server/library/serverGame/src/shared/space/ServerShipComponentData.cpp index b0817411..0fc6e7a6 100755 --- a/engine/server/library/serverGame/src/shared/space/ServerShipComponentData.cpp +++ b/engine/server/library/serverGame/src/shared/space/ServerShipComponentData.cpp @@ -89,7 +89,7 @@ void ServerShipComponentData::writeDataToShip (int const chassisSlot, Ship bool ServerShipComponentData::readDataFromComponent (TangibleObject const & component) { - if (component.getObjectTemplate () == NULL) + if (component.getObjectTemplate () == nullptr) { WARNING (true, ("ShipComponentData [%s] has no object template", component.getNetworkId ().getValueString ().c_str ())); return false; @@ -137,13 +137,13 @@ bool ServerShipComponentData::readDataFromComponent (TangibleObject const & comp void ServerShipComponentData::writeDataToComponent (TangibleObject & component) const { - if (m_descriptor == NULL) + if (m_descriptor == nullptr) { - WARNING (true, ("ShipComponentData::writeDataToComponent [%s] null descriptor", component.getNetworkId ().getValueString ().c_str ())); + WARNING (true, ("ShipComponentData::writeDataToComponent [%s] nullptr descriptor", component.getNetworkId ().getValueString ().c_str ())); return; } - if (component.getObjectTemplate () == NULL) + if (component.getObjectTemplate () == nullptr) { WARNING (true, ("ShipComponentData::writeDataToComponent [%s] has no object template", component.getNetworkId ().getValueString ().c_str ())); return; @@ -180,7 +180,7 @@ void ServerShipComponentData::writeDataToComponent (TangibleObject & component) void ServerShipComponentData::printDebugString (Unicode::String & result, Unicode::String const & padding) const { - if (m_descriptor == NULL) + if (m_descriptor == nullptr) return; char buf [2048]; diff --git a/engine/server/library/serverGame/src/shared/space/ShipAiEnemySearchManager.cpp b/engine/server/library/serverGame/src/shared/space/ShipAiEnemySearchManager.cpp index aca06580..81586895 100755 --- a/engine/server/library/serverGame/src/shared/space/ShipAiEnemySearchManager.cpp +++ b/engine/server/library/serverGame/src/shared/space/ShipAiEnemySearchManager.cpp @@ -60,8 +60,8 @@ void ShipAiEnemySearchManagerNamespace::checkForEnemies(ShipObject &ship) if (shipController) { - AiShipController * const aiShipController = (shipController != NULL) ? shipController->asAiShipController() : NULL; - float const aggroRadiusSquared = sqr((aiShipController != NULL) ? aiShipController->getAggroRadius() : 512.0f); // 512.0f is the distance at which turrets on player ships start getting targets + AiShipController * const aiShipController = (shipController != nullptr) ? shipController->asAiShipController() : nullptr; + float const aggroRadiusSquared = sqr((aiShipController != nullptr) ? aiShipController->getAggroRadius() : 512.0f); // 512.0f is the distance at which turrets on player ships start getting targets Vector const shipPosition_w = ship.getPosition_w(); static std::vector s_visibilityList; @@ -117,7 +117,7 @@ void ShipAiEnemySearchManagerNamespace::checkForEnemies(ShipObject &ship) ShipObject * const enemy = s_enemyList[randomIndex]; ShipController * const enemyShipController = enemy->getController()->asShipController(); - if (enemyShipController != NULL) + if (enemyShipController != nullptr) { // Limit the number of ships that can attack a single enemy diff --git a/engine/server/library/serverGame/src/shared/space/ShipComponentDataCargoHold.cpp b/engine/server/library/serverGame/src/shared/space/ShipComponentDataCargoHold.cpp index ba495697..bf76572c 100755 --- a/engine/server/library/serverGame/src/shared/space/ShipComponentDataCargoHold.cpp +++ b/engine/server/library/serverGame/src/shared/space/ShipComponentDataCargoHold.cpp @@ -165,7 +165,7 @@ void ShipComponentDataCargoHold::printDebugString (Unicode::String & result int const amount = (*it).second; ResourceTypeObject const * const resourceType = ServerUniverse::getInstance().getResourceTypeById(id); - std::string const resourceName = resourceType ? resourceType->getResourceName() : "NULL RESOURCE"; + std::string const resourceName = resourceType ? resourceType->getResourceName() : "nullptr RESOURCE"; snprintf(buf, buf_size, "%s %15s (%s): %3d\n", nPad.c_str (), id.getValueString().c_str(), resourceName.c_str(), amount); result += Unicode::narrowToWide(buf); diff --git a/engine/server/library/serverGame/src/shared/space/ShipComponentDataManager.cpp b/engine/server/library/serverGame/src/shared/space/ShipComponentDataManager.cpp index 60053125..74e9e4f6 100755 --- a/engine/server/library/serverGame/src/shared/space/ShipComponentDataManager.cpp +++ b/engine/server/library/serverGame/src/shared/space/ShipComponentDataManager.cpp @@ -42,16 +42,16 @@ ShipComponentData * ShipComponentDataManager::create (TangibleObject const & com ShipComponentDescriptor const * const shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByObjectTemplate (component.getObjectTemplate ()->getCrcName ().getCrc ()); - if (shipComponentDescriptor == NULL) + if (shipComponentDescriptor == nullptr) { WARNING (true, ("ShipComponentDataManager [%s] [%s] is not a component", component.getNetworkId ().getValueString ().c_str (), component.getObjectTemplateName())); - return NULL; + return nullptr; } ShipComponentData * const shipComponent = create (*shipComponentDescriptor); if (!shipComponent) - return NULL; + return nullptr; shipComponent->readDataFromComponent (component); return shipComponent; @@ -61,7 +61,7 @@ ShipComponentData * ShipComponentDataManager::create (TangibleObject const & com ShipComponentData * ShipComponentDataManager::create (ShipComponentDescriptor const & shipComponentDescriptor) { - ShipComponentData * shipComponent = NULL; + ShipComponentData * shipComponent = nullptr; switch (shipComponentDescriptor.getComponentType ()) { @@ -106,7 +106,7 @@ ShipComponentData * ShipComponentDataManager::create (ShipComponentDescriptor co break; default: WARNING (true, ("ShipComponentDataManager::create descriptor has type [%d] invalid", shipComponentDescriptor.getComponentType ())); - return NULL; + return nullptr; } return shipComponent; diff --git a/engine/server/library/serverGame/src/shared/space/ShipInternalDamageOverTime.cpp b/engine/server/library/serverGame/src/shared/space/ShipInternalDamageOverTime.cpp index 9411fb1b..98f76860 100755 --- a/engine/server/library/serverGame/src/shared/space/ShipInternalDamageOverTime.cpp +++ b/engine/server/library/serverGame/src/shared/space/ShipInternalDamageOverTime.cpp @@ -41,14 +41,14 @@ void ShipInternalDamageOverTime::setDamageThreshold(float damageThreshold) ShipObject * const ShipInternalDamageOverTime::getShipObject() const { Object * const object = m_shipId.getObject(); - if (object != NULL && object->isAuthoritative()) + if (object != nullptr && object->isAuthoritative()) { ServerObject * const serverObject = object->asServerObject(); - if (serverObject != NULL) + if (serverObject != nullptr) return serverObject->asShipObject(); } - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -56,7 +56,7 @@ ShipObject * const ShipInternalDamageOverTime::getShipObject() const bool ShipInternalDamageOverTime::checkValidity(float & hpCurrent, float & hpMaximum) const { ShipObject * const ship = getShipObject(); - if (ship == NULL) + if (ship == nullptr) return false; if (m_chassisSlot < 0 || m_chassisSlot > ShipChassisSlotType::SCST_num_types) @@ -91,7 +91,7 @@ bool ShipInternalDamageOverTime::checkValidity(float & hpCurrent, float & hpMaxi bool ShipInternalDamageOverTime::applyDamage(float elapsedTime, float & damageApplied) const { ShipObject * const ship = getShipObject(); - if (ship == NULL) + if (ship == nullptr) return false; float hpCurrent = 0.0f; diff --git a/engine/server/library/serverGame/src/shared/space/ShipInternalDamageOverTimeManager.cpp b/engine/server/library/serverGame/src/shared/space/ShipInternalDamageOverTimeManager.cpp index 3cc0f54f..475b2504 100755 --- a/engine/server/library/serverGame/src/shared/space/ShipInternalDamageOverTimeManager.cpp +++ b/engine/server/library/serverGame/src/shared/space/ShipInternalDamageOverTimeManager.cpp @@ -39,7 +39,7 @@ namespace ShipInternalDamageOverTimeManagerNamespace { GameScriptObject * const gameScriptObject = ship.getScriptObject(); - if (gameScriptObject != NULL) + if (gameScriptObject != nullptr) { ScriptParams p; p.addParam(idot.getChassisSlot()); @@ -56,7 +56,7 @@ namespace ShipInternalDamageOverTimeManagerNamespace { GameScriptObject * const gameScriptObject = ship.getScriptObject(); - if (gameScriptObject != NULL) + if (gameScriptObject != nullptr) { ScriptParams p; p.addParam(idot.getChassisSlot()); @@ -128,7 +128,7 @@ void ShipInternalDamageOverTimeManager::update(float elapsedTime) ShipObject * const shipObject = idot.getShipObject(); - if (NULL != shipObject) + if (nullptr != shipObject) notifyIdotDamage(*shipObject, idot, damageApplied); } } @@ -150,7 +150,7 @@ void ShipInternalDamageOverTimeManager::update(float elapsedTime) ShipInternalDamageOverTime const & expiredIdot = *it; ShipObject * const shipObject = expiredIdot.getShipObject(); - if (shipObject != NULL) + if (shipObject != nullptr) notifyIdotRemoval(*shipObject, expiredIdot); } } @@ -219,7 +219,7 @@ bool ShipInternalDamageOverTimeManager::removeEntry(ShipObject const & ship, int IGNORE_RETURN(s_idotVector.erase(lowerBound)); ShipObject * const shipObject = lowerBoundIdot.getShipObject(); - if (shipObject != NULL) + if (shipObject != nullptr) notifyIdotRemoval(*shipObject, lowerBoundIdot); return true; @@ -235,13 +235,13 @@ ShipInternalDamageOverTime const * const ShipInternalDamageOverTimeManager::find //-- there is no lower bound, the idot is not in the vector if (lowerBound == s_idotVector.end()) - return NULL; + return nullptr; ShipInternalDamageOverTime & lowerBoundIdot = *lowerBound; //-- the lower bound sorts greater than the new idot, therefore this is a new insertion if (idot < lowerBoundIdot) - return NULL; + return nullptr; return &lowerBoundIdot; } diff --git a/engine/server/library/serverGame/src/shared/space/SpaceAttackSquad.cpp b/engine/server/library/serverGame/src/shared/space/SpaceAttackSquad.cpp index de7693e5..d344d963 100755 --- a/engine/server/library/serverGame/src/shared/space/SpaceAttackSquad.cpp +++ b/engine/server/library/serverGame/src/shared/space/SpaceAttackSquad.cpp @@ -68,7 +68,7 @@ void SpaceAttackSquad::onAddUnit(NetworkId const & unit) { AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != NULL) + if (aiShipController != nullptr) { aiShipController->setAttackSquad(this); } @@ -96,7 +96,7 @@ void SpaceAttackSquad::onNewLeader(NetworkId const & /*oldLeader*/) { AiShipController * const newLeaderAiShipController = AiShipController::getAiShipController(getLeader()); - if (newLeaderAiShipController != NULL) + if (newLeaderAiShipController != nullptr) { m_leaderOffsetPosition_l = -newLeaderAiShipController->getFormationPosition_l(); } @@ -116,7 +116,7 @@ void SpaceAttackSquad::onSetUnitFormationPosition_l(NetworkId const & unit, Vect { AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != NULL) + if (aiShipController != nullptr) { aiShipController->setAttackFormationPosition_l(position_l); } @@ -154,7 +154,7 @@ CachedNetworkId const & SpaceAttackSquad::getPrimaryAttackTarget() const { Object * const leaderObject = getLeader().getObject(); - if (leaderObject != NULL) + if (leaderObject != nullptr) { AiShipController * const leaderAiShipController = AiShipController::asAiShipController(leaderObject->getController()); @@ -163,7 +163,7 @@ CachedNetworkId const & SpaceAttackSquad::getPrimaryAttackTarget() const #ifdef _DEBUG FormattedString<1024> fs; - char const * const text = fs.sprintf("SpaceAttackSquad::getPrimaryAttackTarget() ERROR: Why is the attack squad leader(%s) object NULL?", getLeader().getValueString().c_str()); + char const * const text = fs.sprintf("SpaceAttackSquad::getPrimaryAttackTarget() ERROR: Why is the attack squad leader(%s) object nullptr?", getLeader().getValueString().c_str()); DEBUG_WARNING(true, (text)); LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", (text)); #endif // _DEBUG @@ -176,7 +176,7 @@ bool SpaceAttackSquad::isAttacking() const { Object * const leaderObject = getLeader().getObject(); - if (leaderObject != NULL) + if (leaderObject != nullptr) { AiShipController * const leaderAiShipController = AiShipController::asAiShipController(leaderObject->getController()); @@ -185,7 +185,7 @@ bool SpaceAttackSquad::isAttacking() const #ifdef _DEBUG FormattedString<1024> fs; - char const * const text = fs.sprintf("SpaceAttackSquad::isAttacking() ERROR: Why is the attack squad leader(%s) object NULL?", getLeader().getValueString().c_str()); + char const * const text = fs.sprintf("SpaceAttackSquad::isAttacking() ERROR: Why is the attack squad leader(%s) object nullptr?", getLeader().getValueString().c_str()); DEBUG_WARNING(true, (text)); LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", (text)); #endif // _DEBUG @@ -231,7 +231,7 @@ int SpaceAttackSquad::getMaxNumberOfUnits() const NetworkId const & unit = unitMap.begin()->first; AiShipController * const unitAiShipController = AiShipController::getAiShipController(unit); - if (unitAiShipController != NULL) + if (unitAiShipController != nullptr) { if (unitAiShipController->getAttackOrders() == AiShipController::AO_holdFire) { @@ -282,10 +282,10 @@ void SpaceAttackSquad::calculateAttackRanges() { CachedNetworkId const & unit = iterUnitMap->first; Object * const unitObject = unit.getObject(); - ServerObject * const unitServerObject = (unitObject != NULL) ? unitObject->asServerObject() : NULL; - ShipObject * const unitShipObject = (unitServerObject != NULL) ? unitServerObject->asShipObject() : NULL; + ServerObject * const unitServerObject = (unitObject != nullptr) ? unitObject->asServerObject() : nullptr; + ShipObject * const unitShipObject = (unitServerObject != nullptr) ? unitServerObject->asShipObject() : nullptr; - if (unitShipObject != NULL) + if (unitShipObject != nullptr) { m_projectileAttackRange = std::min(m_projectileAttackRange, unitShipObject->getApproximateAttackRange()); @@ -328,10 +328,10 @@ void SpaceAttackSquad::assignNewLeader() { CachedNetworkId const & unit = iterUnitMap->first; Object * const unitObject = unit.getObject(); - ServerObject * const unitServerObject = (unitObject != NULL) ? unitObject->asServerObject() : NULL; - ShipObject * const unitShipObject = (unitServerObject != NULL) ? unitServerObject->asShipObject() : NULL; + ServerObject * const unitServerObject = (unitObject != nullptr) ? unitObject->asServerObject() : nullptr; + ShipObject * const unitShipObject = (unitServerObject != nullptr) ? unitServerObject->asShipObject() : nullptr; - if (unitShipObject != NULL) + if (unitShipObject != nullptr) { if (unitShipObject->isComponentFunctional(ShipChassisSlotType::SCST_engine)) { diff --git a/engine/server/library/serverGame/src/shared/space/SpaceDockingManager.cpp b/engine/server/library/serverGame/src/shared/space/SpaceDockingManager.cpp index c836be74..4e4a9821 100755 --- a/engine/server/library/serverGame/src/shared/space/SpaceDockingManager.cpp +++ b/engine/server/library/serverGame/src/shared/space/SpaceDockingManager.cpp @@ -78,7 +78,7 @@ namespace SpaceDockingManagerNamespace explicit DockableShip(Object const & object) : m_dockPadList() { - if (object.getAppearance() != NULL) + if (object.getAppearance() != nullptr) { // What dock pads do we have, and what are their radii @@ -176,7 +176,7 @@ float SpaceDockingManagerNamespace::getCollisionRadius(Object const & object) CollisionProperty const * const collisionProperty = object.getCollisionProperty(); float radius = 0.0f; - if (collisionProperty != NULL) + if (collisionProperty != nullptr) { radius = collisionProperty->getBoundingSphere_l().getRadius(); } @@ -257,7 +257,7 @@ bool SpaceDockingManagerNamespace::getHardPoints(Object const & object, char con hardPointList.clear(); - if (object.getAppearance() != NULL) + if (object.getAppearance() != nullptr) { int hardPointIndex = 1; bool done = false; diff --git a/engine/server/library/serverGame/src/shared/space/SpacePath.cpp b/engine/server/library/serverGame/src/shared/space/SpacePath.cpp index 6c50cee8..9834532b 100755 --- a/engine/server/library/serverGame/src/shared/space/SpacePath.cpp +++ b/engine/server/library/serverGame/src/shared/space/SpacePath.cpp @@ -96,7 +96,7 @@ bool SpacePath::isEmpty() const // ---------------------------------------------------------------------- void SpacePath::addReference(void const * const object, float const objectSize) { - DEBUG_FATAL(object == NULL, ("Passing a NULL object into path 0x%p.", this)); + DEBUG_FATAL(object == nullptr, ("Passing a nullptr object into path 0x%p.", this)); ++m_referenceCount; @@ -112,7 +112,7 @@ void SpacePath::addReference(void const * const object, float const objectSize) // ---------------------------------------------------------------------- void SpacePath::releaseReference(void const * const object) { - DEBUG_FATAL(object == NULL, ("Passing a NULL object into path 0x%p.", this)); + DEBUG_FATAL(object == nullptr, ("Passing a nullptr object into path 0x%p.", this)); if (--m_referenceCount < 0) { @@ -178,7 +178,7 @@ bool SpacePath::refine(int & pathRefinementsAvailable) Vector avoidancePosition_w; - bool const pathAdjusted = SpaceAvoidanceManager::getAvoidancePosition(currentTransform, collisionRadius, sweepVector, nextPosition_w, avoidancePosition_w, NULL); + bool const pathAdjusted = SpaceAvoidanceManager::getAvoidancePosition(currentTransform, collisionRadius, sweepVector, nextPosition_w, avoidancePosition_w, nullptr); if (pathAdjusted) { newTransform.setPosition_p(avoidancePosition_w); @@ -278,7 +278,7 @@ void SpacePath::requestPathResize() // ---------------------------------------------------------------------- bool SpacePath::updateCollisionRadius(void const * const object, float const objectSize) { - DEBUG_FATAL(object == NULL, ("Passing a NULL object into path(0x%p) updateCollisionRadius.", this)); + DEBUG_FATAL(object == nullptr, ("Passing a nullptr object into path(0x%p) updateCollisionRadius.", this)); bool requiresPathUpdate = false; diff --git a/engine/server/library/serverGame/src/shared/space/SpacePathManager.cpp b/engine/server/library/serverGame/src/shared/space/SpacePathManager.cpp index 79256ad5..2d9d088c 100755 --- a/engine/server/library/serverGame/src/shared/space/SpacePathManager.cpp +++ b/engine/server/library/serverGame/src/shared/space/SpacePathManager.cpp @@ -59,9 +59,9 @@ void SpacePathManager::remove() // ---------------------------------------------------------------------- SpacePath * SpacePathManager::fetch(SpacePath * const path, void const * const object, float const objectRadius) { - SpacePath * result = NULL; + SpacePath * result = nullptr; - if (path == NULL) + if (path == nullptr) { // This is a new path, add it to the list @@ -105,7 +105,7 @@ SpacePath * SpacePathManager::fetch(SpacePath * const path, void const * const o // ---------------------------------------------------------------------- void SpacePathManager::release(SpacePath * const path, void const * const object) { - if (path == NULL) + if (path == nullptr) { return; } diff --git a/engine/server/library/serverGame/src/shared/space/SpaceSquad.cpp b/engine/server/library/serverGame/src/shared/space/SpaceSquad.cpp index 332188c6..9b998274 100755 --- a/engine/server/library/serverGame/src/shared/space/SpaceSquad.cpp +++ b/engine/server/library/serverGame/src/shared/space/SpaceSquad.cpp @@ -95,7 +95,7 @@ void SpaceSquad::remove() // ---------------------------------------------------------------------- SpaceSquad::SpaceSquad() : Squad() - , m_guardTarget(NULL) + , m_guardTarget(nullptr) , m_guardedByList(new SpaceSquadList) , m_attackSquadList(new AttackSquadList) , m_guarding(false) @@ -109,10 +109,10 @@ SpaceSquad::~SpaceSquad() { // The the squad that I am guarding that I am no longer guarding it - if (m_guardTarget != NULL) + if (m_guardTarget != nullptr) { removeGuardTarget(); - m_guardTarget = NULL; + m_guardTarget = nullptr; } // Tell all the squads guarding me that I am not longer guardable @@ -156,7 +156,7 @@ SpacePath * SpaceSquad::getPath() const AiShipController * const aiShipController = AiShipController::getAiShipController(getLeader()); - return NULL != aiShipController ? aiShipController->getPath() : NULL; + return nullptr != aiShipController ? aiShipController->getPath() : nullptr; } // ---------------------------------------------------------------------- @@ -194,7 +194,7 @@ void SpaceSquad::track(Object const & target) const // ---------------------------------------------------------------------- void SpaceSquad::moveTo(SpacePath * const path) const { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("SpaceSquad::moveTo() squadId(%d) path(0x%p) pathSize(%u)", getId(), path, (path != NULL) ? path->getTransformList().size() : 0)); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("SpaceSquad::moveTo() squadId(%d) path(0x%p) pathSize(%u)", getId(), path, (path != nullptr) ? path->getTransformList().size() : 0)); UnitMap const & unitMap = getUnitMap(); UnitMap::const_iterator iterUnitMap = unitMap.begin(); @@ -210,7 +210,7 @@ void SpaceSquad::moveTo(SpacePath * const path) const // ---------------------------------------------------------------------- void SpaceSquad::addPatrolPath(SpacePath * const path) const { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("SpaceSquad::addPatrolPath() squadId(%d) squadSize(%u) path(0x%p) pathSize(%u)", getId(), getUnitMap().size(), path, (path != NULL) ? path->getTransformList().size() : 0)); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("SpaceSquad::addPatrolPath() squadId(%d) squadSize(%u) path(0x%p) pathSize(%u)", getId(), getUnitMap().size(), path, (path != nullptr) ? path->getTransformList().size() : 0)); UnitMap const & unitMap = getUnitMap(); UnitMap::const_iterator iterUnitMap = unitMap.begin(); @@ -293,7 +293,7 @@ bool SpaceSquad::setGuardTarget(int const squadId) #endif // _DEBUG } - return (m_guardTarget != NULL); + return (m_guardTarget != nullptr); } // ---------------------------------------------------------------------- @@ -305,14 +305,14 @@ SpaceSquad * SpaceSquad::getGuardTarget() // ---------------------------------------------------------------------- void SpaceSquad::removeGuardTarget() { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("SpaceSquad::removeGuardTarget() squadId(%d) guardedBySquad(%d)", getId(), (m_guardTarget != NULL) ? m_guardTarget->getId() : 0)); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("SpaceSquad::removeGuardTarget() squadId(%d) guardedBySquad(%d)", getId(), (m_guardTarget != nullptr) ? m_guardTarget->getId() : 0)); //-- Tell the guard target it's no longer being guarded - if (m_guardTarget != NULL) + if (m_guardTarget != nullptr) { m_guardTarget->removeGuardedBy(*this); - m_guardTarget = NULL; + m_guardTarget = nullptr; } } @@ -360,7 +360,7 @@ void SpaceSquad::onAddUnit(NetworkId const & unit) { AiShipController * unitAiShipController = AiShipController::getAiShipController(unit); - if (unitAiShipController != NULL) + if (unitAiShipController != nullptr) { unitAiShipController->setSquad(this); @@ -391,12 +391,12 @@ void SpaceSquad::onNewLeader(NetworkId const & oldLeader) { AiShipController * const newLeaderAiShipController = AiShipController::getAiShipController(getLeader()); - if (newLeaderAiShipController != NULL) + if (newLeaderAiShipController != nullptr) { AiShipController * const oldLeaderAiShipController = AiShipController::getAiShipController(oldLeader); - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled() && (oldLeaderAiShipController == NULL) && (getUnitCount() > 1), "space_debug_ai", ("Squad::onNewLeader() ERROR: The old leader(%s) could not resolve to an AiShipController.", oldLeader.getValueString().c_str())); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled() && (oldLeaderAiShipController == nullptr) && (getUnitCount() > 1), "space_debug_ai", ("Squad::onNewLeader() ERROR: The old leader(%s) could not resolve to an AiShipController.", oldLeader.getValueString().c_str())); - if (oldLeaderAiShipController != NULL) + if (oldLeaderAiShipController != nullptr) { newLeaderAiShipController->setCurrentPathIndex(oldLeaderAiShipController->getCurrentPathIndex()); } @@ -420,7 +420,7 @@ void SpaceSquad::onSetUnitFormationPosition_l(NetworkId const & unit, Vector con { AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != NULL) + if (aiShipController != nullptr) { aiShipController->setFormationPosition_l(position_l); } @@ -457,13 +457,13 @@ void SpaceSquad::alter(float const deltaSeconds) AiShipController const * const leaderAiShipController = AiShipController::getAiShipController(getLeader()); - if (leaderAiShipController != NULL) + if (leaderAiShipController != nullptr) { if (isGuarding()) { SpaceSquad * const guardTarget = getGuardTarget(); - if (guardTarget != NULL) + if (guardTarget != nullptr) { m_leashAnchorPosition_w = guardTarget->getSquadPosition_w(); } @@ -499,7 +499,7 @@ void SpaceSquad::assignNewLeader() CachedNetworkId const & unit = iterUnitMap->first; AiShipController const * const unitAiShipController = AiShipController::getAiShipController(unit); - if (unitAiShipController != NULL) + if (unitAiShipController != nullptr) { if ( unitAiShipController->getShipOwner()->isComponentFunctional(ShipChassisSlotType::SCST_engine) && !unitAiShipController->isAttacking() @@ -550,7 +550,7 @@ bool SpaceSquad::isGuarding() const && !m_guardTarget) { FormattedString<1024> fs; - char const * const text = fs.sprintf("SpaceSquad::isGuarding() squadId(%d) ERROR: Why are we guarding a NULL guard target?", getId()); + char const * const text = fs.sprintf("SpaceSquad::isGuarding() squadId(%d) ERROR: Why are we guarding a nullptr guard target?", getId()); DEBUG_WARNING(true, (text)); LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", (text)); } @@ -572,7 +572,7 @@ bool SpaceSquad::isAttackTargetListEmpty() const NetworkId const & unit = iterUnitMap->first; AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if ( (aiShipController != NULL) + if ( (aiShipController != nullptr) && !aiShipController->getAttackTargetList().isEmpty()) { result = false; @@ -623,10 +623,10 @@ Vector SpaceSquad::getAvoidanceVector(ShipObject const & unit) const } Object * const squadUnitObject = squadUnit.getObject(); - ServerObject * const squadUnitServerObject = (squadUnitObject != NULL) ? squadUnitObject->asServerObject() : NULL; - ShipObject * const squadUnitShipObject = (squadUnitServerObject != NULL) ? squadUnitServerObject->asShipObject() : NULL; + ServerObject * const squadUnitServerObject = (squadUnitObject != nullptr) ? squadUnitObject->asServerObject() : nullptr; + ShipObject * const squadUnitShipObject = (squadUnitServerObject != nullptr) ? squadUnitServerObject->asShipObject() : nullptr; - if (squadUnitShipObject != NULL) + if (squadUnitShipObject != nullptr) { Vector const & unitPosition_w = unit.getPosition_w(); Vector const & squadUnitPosition_w = squadUnitShipObject->getPosition_w(); @@ -760,7 +760,7 @@ float SpaceSquad::getLargestShipRadius() const { CachedNetworkId const & unit = iterUnitMap->first; Object const * const unitObject = unit.getObject(); - ServerObject const * const unitServerObject = unitObject ? unitObject->asServerObject() : NULL; + ServerObject const * const unitServerObject = unitObject ? unitObject->asServerObject() : nullptr; if (unitServerObject) { @@ -787,7 +787,7 @@ void SpaceSquad::refreshPathInfo() const { CachedNetworkId const & unit = iterUnitMap->first; Object const * const unitObject = unit.getObject(); - ServerObject const * const unitServerObject = unitObject ? unitObject->asServerObject() : NULL; + ServerObject const * const unitServerObject = unitObject ? unitObject->asServerObject() : nullptr; if (unitObject && unitServerObject) { IGNORE_RETURN(path->updateCollisionRadius(unitObject, unitServerObject->getRadius())); diff --git a/engine/server/library/serverGame/src/shared/space/SpaceSquadManager.cpp b/engine/server/library/serverGame/src/shared/space/SpaceSquadManager.cpp index 3a93d451..f2dc3552 100755 --- a/engine/server/library/serverGame/src/shared/space/SpaceSquadManager.cpp +++ b/engine/server/library/serverGame/src/shared/space/SpaceSquadManager.cpp @@ -194,7 +194,7 @@ bool SpaceSquadManager::setSquadId(NetworkId const & unit, int const newSquadId) bool result = false; AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != NULL) + if (aiShipController != nullptr) { result = true; @@ -239,7 +239,7 @@ bool SpaceSquadManager::setSquadId(NetworkId const & unit, int const newSquadId) // ---------------------------------------------------------------------- SpaceSquad * SpaceSquadManager::getSquad(int const squadId) { - SpaceSquad * result = NULL; + SpaceSquad * result = nullptr; SquadList::const_iterator iterSpaceSquadList = s_squadList.find(squadId); if (iterSpaceSquadList != s_squadList.end()) diff --git a/engine/server/library/serverGame/src/shared/space/SpaceVisibilityManager.cpp b/engine/server/library/serverGame/src/shared/space/SpaceVisibilityManager.cpp index 9113d33f..70f5bbef 100755 --- a/engine/server/library/serverGame/src/shared/space/SpaceVisibilityManager.cpp +++ b/engine/server/library/serverGame/src/shared/space/SpaceVisibilityManager.cpp @@ -141,7 +141,7 @@ void SpaceVisibilityManager::addClient(Client & client, ServerObject & observing DEBUG_REPORT_LOG(ConfigServerGame::getDebugSpaceVisibilityManager(),("SpaceVisibilityManager::addClient(Client & client, %s);\n",observingObject.getNetworkId().getValueString().c_str())); TrackedObjectsType::iterator i=ms_trackedObjects.find(observingObject.getNetworkId()); - TrackedObject *to=NULL; + TrackedObject *to=nullptr; if (i!=ms_trackedObjects.end()) { to=i->second; @@ -244,7 +244,7 @@ void SpaceVisibilityManager::removeObject(ServerObject & object) if (!vis) //lint !e774 //always false (in debug build only) return; delete vis; - vis=NULL; + vis=nullptr; object.removeNotification(VisibleObjectNotification::getInstance(),true); } @@ -534,7 +534,7 @@ TrackedObject::TrackedObject(const ServerObject &object, int updateRadius) : m_object(object), m_updateRadius(updateRadius), m_currentLocation(NodeId(object.getPosition_w())), - m_clients(NULL) + m_clients(nullptr) { ms_trackedObjects[object.getNetworkId()]=this; addToNodesInRange(*this, m_currentLocation, updateRadius); @@ -554,7 +554,7 @@ TrackedObject::~TrackedObject() } delete m_clients; - m_clients=NULL; + m_clients=nullptr; } removeFromNodesInRange(*this, m_currentLocation, m_updateRadius); @@ -572,7 +572,7 @@ const CachedNetworkId & TrackedObject::getNetworkId() const bool TrackedObject::hasClients() const { - return (m_clients != NULL); + return (m_clients != nullptr); } // ---------------------------------------------------------------------- @@ -594,7 +594,7 @@ void TrackedObject::removeClient(Client &client) if (m_clients->empty()) { delete m_clients; - m_clients=NULL; + m_clients=nullptr; getNode(m_currentLocation).removeObservingObject(*this); } diff --git a/engine/server/library/serverGame/src/shared/synchronizedUi/InstallationSynchronizedUi.cpp b/engine/server/library/serverGame/src/shared/synchronizedUi/InstallationSynchronizedUi.cpp index ca2e7048..b074a95d 100755 --- a/engine/server/library/serverGame/src/shared/synchronizedUi/InstallationSynchronizedUi.cpp +++ b/engine/server/library/serverGame/src/shared/synchronizedUi/InstallationSynchronizedUi.cpp @@ -87,7 +87,7 @@ namespace InstallationSynchronizedUiNamespace InstallationResourceData makeInstallationResourceData (const NetworkId & id, const Vector & position) { ResourceTypeObject const * const rto = ServerUniverse::getInstance().getResourceTypeById(id); - ResourcePoolObject const * const pool = rto ? rto->getPoolForCurrentPlanet() : NULL; + ResourcePoolObject const * const pool = rto ? rto->getPoolForCurrentPlanet() : nullptr; if (rto && pool) { std::string const & resourceTypeParent = rto->getParentClass().getResourceClassName(); @@ -219,7 +219,7 @@ void InstallationSynchronizedUi::resetResourcePools () HarvesterInstallationObject * const harvester = dynamic_cast(getOwner ()); NOT_NULL (harvester); - if (harvester) //lint !e774 // harvester is not NULL in debug + if (harvester) //lint !e774 // harvester is not nullptr in debug { std::vector const & pools = harvester->getSurveyTypes(); for (std::vector::const_iterator i=pools.begin(); i!=pools.end(); ++i) diff --git a/engine/server/library/serverGame/src/shared/trading/ServerSecureTrade.cpp b/engine/server/library/serverGame/src/shared/trading/ServerSecureTrade.cpp index a0b2f63b..c486c67f 100755 --- a/engine/server/library/serverGame/src/shared/trading/ServerSecureTrade.cpp +++ b/engine/server/library/serverGame/src/shared/trading/ServerSecureTrade.cpp @@ -385,7 +385,7 @@ void ServerSecureTrade::completeTrade() } if (dynamic_cast(item)) { - if (!ContainerInterface::canTransferTo(recipientInventory, *item, NULL, errorCode)) + if (!ContainerInterface::canTransferTo(recipientInventory, *item, nullptr, errorCode)) { ContainerInterface::sendContainerMessageToClient(*m_initiator, errorCode); ContainerInterface::sendContainerMessageToClient(*m_recipient, errorCode); @@ -397,7 +397,7 @@ void ServerSecureTrade::completeTrade() } else { - if (!ContainerInterface::canTransferTo(recipientDatapad, *item, NULL, errorCode)) + if (!ContainerInterface::canTransferTo(recipientDatapad, *item, nullptr, errorCode)) { ContainerInterface::sendContainerMessageToClient(*m_initiator, errorCode); ContainerInterface::sendContainerMessageToClient(*m_recipient, errorCode); @@ -423,7 +423,7 @@ void ServerSecureTrade::completeTrade() } if (dynamic_cast(item)) { - if (!ContainerInterface::canTransferTo(initiatorInventory, *item, NULL, errorCode)) + if (!ContainerInterface::canTransferTo(initiatorInventory, *item, nullptr, errorCode)) { ContainerInterface::sendContainerMessageToClient(*m_initiator, errorCode); ContainerInterface::sendContainerMessageToClient(*m_recipient, errorCode); @@ -434,7 +434,7 @@ void ServerSecureTrade::completeTrade() } else { - if (!ContainerInterface::canTransferTo(initiatorDatapad, *item, NULL, errorCode)) + if (!ContainerInterface::canTransferTo(initiatorDatapad, *item, nullptr, errorCode)) { ContainerInterface::sendContainerMessageToClient(*m_initiator, errorCode); ContainerInterface::sendContainerMessageToClient(*m_recipient, errorCode); @@ -516,7 +516,7 @@ void ServerSecureTrade::completeTrade() NOT_NULL(item); if (dynamic_cast(item)) { - if (!ContainerInterface::transferItemToVolumeContainer(*recipientInventory, *item, NULL, errorCode)) + if (!ContainerInterface::transferItemToVolumeContainer(*recipientInventory, *item, nullptr, errorCode)) { DEBUG_FATAL(true, ("Secure trade transfer failure in initiator transfer!!\n")); LOG("CustomerService", ("Trade:%s FAILED TO receive %s from %s", PlayerObject::getAccountDescription(m_recipient->getNetworkId()).c_str(), ServerObject::getLogDescription(item).c_str(), PlayerObject::getAccountDescription(m_initiator->getNetworkId()).c_str())); @@ -529,7 +529,7 @@ void ServerSecureTrade::completeTrade() } else { - if (!ContainerInterface::transferItemToVolumeContainer(*recipientDatapad, *item, NULL, errorCode)) + if (!ContainerInterface::transferItemToVolumeContainer(*recipientDatapad, *item, nullptr, errorCode)) { DEBUG_FATAL(true, ("Secure trade transfer failure in initiator transfer!!\n")); LOG("CustomerService", ("Trade:%s FAILED TO receive %s from %s", PlayerObject::getAccountDescription(m_recipient->getNetworkId()).c_str(), ServerObject::getLogDescription(item).c_str(), PlayerObject::getAccountDescription(m_initiator->getNetworkId()).c_str())); @@ -550,7 +550,7 @@ void ServerSecureTrade::completeTrade() NOT_NULL(item); if (dynamic_cast(item)) { - if (!ContainerInterface::transferItemToVolumeContainer(*initiatorInventory, *item, NULL, errorCode)) + if (!ContainerInterface::transferItemToVolumeContainer(*initiatorInventory, *item, nullptr, errorCode)) { DEBUG_FATAL(true, ("Secure trade transfer failure in recipient transfer!!\n")); LOG("CustomerService", ("Trade:%s FAILED TO receive %s from %s", PlayerObject::getAccountDescription(m_initiator->getNetworkId()).c_str(), ServerObject::getLogDescription(item).c_str(), PlayerObject::getAccountDescription(m_recipient->getNetworkId()).c_str())); @@ -564,7 +564,7 @@ void ServerSecureTrade::completeTrade() } else { - if (!ContainerInterface::transferItemToVolumeContainer(*initiatorDatapad, *item, NULL, errorCode)) + if (!ContainerInterface::transferItemToVolumeContainer(*initiatorDatapad, *item, nullptr, errorCode)) { DEBUG_FATAL(true, ("Secure trade transfer failure in recipient transfer!!\n")); LOG("CustomerService", ("Trade:%s FAILED TO receive %s from %s", PlayerObject::getAccountDescription(m_initiator->getNetworkId()).c_str(), ServerObject::getLogDescription(item).c_str(), PlayerObject::getAccountDescription(m_recipient->getNetworkId()).c_str())); @@ -602,12 +602,12 @@ void ServerSecureTrade::logTradeitemContents(const CreatureObject & to, const ServerObject & item, const CreatureObject & from) const { const Container * container = ContainerInterface::getContainer(item); - if (container != NULL) + if (container != nullptr) { for (ContainerConstIterator i = container->begin(); i != container->end(); ++i) { const Object * o = (*i).getObject(); - if (o != NULL) + if (o != nullptr) { const ServerObject * content = safe_cast(o); LOG("CustomerService", ("Trade:%s received %s contained in %s from %s", diff --git a/engine/server/library/serverNetworkMessages/src/shared/TaskConnectionIdMessage.cpp b/engine/server/library/serverNetworkMessages/src/shared/TaskConnectionIdMessage.cpp index 525fc1b6..2f314ed8 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/TaskConnectionIdMessage.cpp +++ b/engine/server/library/serverNetworkMessages/src/shared/TaskConnectionIdMessage.cpp @@ -14,7 +14,7 @@ GameNetworkMessage("TaskConnectionIdMessage"), serverType(static_cast(id)), commandLine(pCommandLine), clusterName(pClusterName), -currentEpochTime(static_cast(::time(NULL))) +currentEpochTime(static_cast(::time(nullptr))) { addVariable(serverType); addVariable(commandLine); diff --git a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AccountFeatureIdResponse.cpp b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AccountFeatureIdResponse.cpp index b7417e7b..f51e9f06 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AccountFeatureIdResponse.cpp +++ b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AccountFeatureIdResponse.cpp @@ -10,7 +10,7 @@ // ====================================================================== -AccountFeatureIdResponse::AccountFeatureIdResponse(NetworkId const & requester, uint32 gameServer, NetworkId const & target, StationId targetStationId, uint32 gameCode, AccountFeatureIdRequest::RequestReason requestReason, unsigned int resultCode, bool resultCameFromSession, std::map const & featureIds, std::map const & sessionFeatureIdsData, const char * sessionResultString /*= NULL*/, const char * sessionResultText /*= NULL*/) : +AccountFeatureIdResponse::AccountFeatureIdResponse(NetworkId const & requester, uint32 gameServer, NetworkId const & target, StationId targetStationId, uint32 gameCode, AccountFeatureIdRequest::RequestReason requestReason, unsigned int resultCode, bool resultCameFromSession, std::map const & featureIds, std::map const & sessionFeatureIdsData, const char * sessionResultString /*= nullptr*/, const char * sessionResultText /*= nullptr*/) : GameNetworkMessage("AccountFeatureIdResponse"), m_requester(requester), m_gameServer(gameServer), diff --git a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AccountFeatureIdResponse.h b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AccountFeatureIdResponse.h index 3bf69cd3..356d75e6 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AccountFeatureIdResponse.h +++ b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AccountFeatureIdResponse.h @@ -19,7 +19,7 @@ class AccountFeatureIdResponse : public GameNetworkMessage { public: - AccountFeatureIdResponse (NetworkId const & requester, uint32 gameServer, NetworkId const & target, StationId targetStationId, uint32 gameCode, AccountFeatureIdRequest::RequestReason requestReason, unsigned int resultCode, bool resultCameFromSession, std::map const & featureIds, std::map const & sessionFeatureIdsData, const char * sessionResultString = NULL, const char * sessionResultText = NULL); + AccountFeatureIdResponse (NetworkId const & requester, uint32 gameServer, NetworkId const & target, StationId targetStationId, uint32 gameCode, AccountFeatureIdRequest::RequestReason requestReason, unsigned int resultCode, bool resultCameFromSession, std::map const & featureIds, std::map const & sessionFeatureIdsData, const char * sessionResultString = nullptr, const char * sessionResultText = nullptr); AccountFeatureIdResponse (Archive::ReadIterator & source); virtual ~AccountFeatureIdResponse (); diff --git a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AdjustAccountFeatureIdResponse.cpp b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AdjustAccountFeatureIdResponse.cpp index 55ec5da9..5a118fce 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AdjustAccountFeatureIdResponse.cpp +++ b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AdjustAccountFeatureIdResponse.cpp @@ -10,7 +10,7 @@ // ====================================================================== -AdjustAccountFeatureIdResponse::AdjustAccountFeatureIdResponse(NetworkId const & requestingPlayer, uint32 gameServer, NetworkId const & targetPlayer, std::string const & targetPlayerDescription, StationId targetStationId, NetworkId const & targetItem, std::string const & targetItemDescription, uint32 gameCode, uint32 featureId, int oldValue, int newValue, unsigned int resultCode, bool resultCameFromSession, const char * sessionResultString /*= NULL*/, const char * sessionResultText /*= NULL*/) : +AdjustAccountFeatureIdResponse::AdjustAccountFeatureIdResponse(NetworkId const & requestingPlayer, uint32 gameServer, NetworkId const & targetPlayer, std::string const & targetPlayerDescription, StationId targetStationId, NetworkId const & targetItem, std::string const & targetItemDescription, uint32 gameCode, uint32 featureId, int oldValue, int newValue, unsigned int resultCode, bool resultCameFromSession, const char * sessionResultString /*= nullptr*/, const char * sessionResultText /*= nullptr*/) : GameNetworkMessage("AdjustAccountFeatureIdResponse"), m_requestingPlayer(requestingPlayer), m_gameServer(gameServer), diff --git a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AdjustAccountFeatureIdResponse.h b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AdjustAccountFeatureIdResponse.h index 940937ac..cecf0530 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AdjustAccountFeatureIdResponse.h +++ b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AdjustAccountFeatureIdResponse.h @@ -18,7 +18,7 @@ class AdjustAccountFeatureIdResponse : public GameNetworkMessage { public: - AdjustAccountFeatureIdResponse (NetworkId const & requestingPlayer, uint32 gameServer, NetworkId const & targetPlayer, std::string const & targetPlayerDescription, StationId targetStationId, NetworkId const & targetItem, std::string const & targetItemDescription, uint32 gameCode, uint32 featureId, int oldValue, int newValue, unsigned int resultCode, bool resultCameFromSession, const char * sessionResultString = NULL, const char * sessionResultText = NULL); + AdjustAccountFeatureIdResponse (NetworkId const & requestingPlayer, uint32 gameServer, NetworkId const & targetPlayer, std::string const & targetPlayerDescription, StationId targetStationId, NetworkId const & targetItem, std::string const & targetItemDescription, uint32 gameCode, uint32 featureId, int oldValue, int newValue, unsigned int resultCode, bool resultCameFromSession, const char * sessionResultString = nullptr, const char * sessionResultText = nullptr); AdjustAccountFeatureIdResponse (Archive::ReadIterator & source); virtual ~AdjustAccountFeatureIdResponse (); @@ -37,7 +37,7 @@ public: bool getResultCameFromSession() const; std::string const & getSessionResultString() const; std::string const & getSessionResultText() const; - void setSessionResultCode(unsigned int resultCode, const char * sessionResultString = NULL, const char * sessionResultText = NULL); + void setSessionResultCode(unsigned int resultCode, const char * sessionResultString = nullptr, const char * sessionResultText = nullptr); private: Archive::AutoVariable m_requestingPlayer; @@ -169,7 +169,7 @@ inline std::string const & AdjustAccountFeatureIdResponse::getSessionResultText( // ---------------------------------------------------------------------- -inline void AdjustAccountFeatureIdResponse::setSessionResultCode(unsigned int resultCode, const char * sessionResultString /*= NULL*/, const char * sessionResultText /*= NULL*/) +inline void AdjustAccountFeatureIdResponse::setSessionResultCode(unsigned int resultCode, const char * sessionResultString /*= nullptr*/, const char * sessionResultText /*= nullptr*/) { m_resultCode.set(resultCode); diff --git a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/SceneTransferMessages.cpp b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/SceneTransferMessages.cpp index 92b86d2c..34c3de3f 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/SceneTransferMessages.cpp +++ b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/SceneTransferMessages.cpp @@ -19,7 +19,7 @@ RequestSceneTransfer::RequestSceneTransfer(const NetworkId &oid, const std::stri m_containerName(), m_scriptCallback() { - if (scriptCallback != NULL) + if (scriptCallback != nullptr) m_scriptCallback.set(scriptCallback); addVariable(m_oid); @@ -45,7 +45,7 @@ RequestSceneTransfer::RequestSceneTransfer(const NetworkId &oid, const std::stri m_containerName(containerName), m_scriptCallback() { - if (scriptCallback != NULL) + if (scriptCallback != nullptr) m_scriptCallback.set(scriptCallback); addVariable(m_oid); diff --git a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/SceneTransferMessages.h b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/SceneTransferMessages.h index e7780d16..0fc2e843 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/SceneTransferMessages.h +++ b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/SceneTransferMessages.h @@ -21,8 +21,8 @@ class RequestSceneTransfer : public GameNetworkMessage { public: - RequestSceneTransfer(const NetworkId &oid, const std::string & sceneName, uint32 sourceGameServer, const Vector &position_p, const Vector &position_w, const NetworkId &containerId, const char * scriptCallback = NULL); - RequestSceneTransfer(const NetworkId &oid, const std::string & sceneName, uint32 sourceGameServer, const Vector &position_p, const Vector &position_w, const NetworkId &buildingId, const std::string &containerName, const char * scriptCallback = NULL); + RequestSceneTransfer(const NetworkId &oid, const std::string & sceneName, uint32 sourceGameServer, const Vector &position_p, const Vector &position_w, const NetworkId &containerId, const char * scriptCallback = nullptr); + RequestSceneTransfer(const NetworkId &oid, const std::string & sceneName, uint32 sourceGameServer, const Vector &position_p, const Vector &position_w, const NetworkId &buildingId, const std::string &containerName, const char * scriptCallback = nullptr); RequestSceneTransfer(Archive::ReadIterator & source); ~RequestSceneTransfer(); diff --git a/engine/server/library/serverNetworkMessages/src/shared/core/SetupServerNetworkMessages.cpp b/engine/server/library/serverNetworkMessages/src/shared/core/SetupServerNetworkMessages.cpp index d976dd62..007706a8 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/core/SetupServerNetworkMessages.cpp +++ b/engine/server/library/serverNetworkMessages/src/shared/core/SetupServerNetworkMessages.cpp @@ -254,7 +254,7 @@ namespace SetupServerNetworkMessagesNamespace } MessageQueue::Data* unpackNothing(Archive::ReadIterator &) { - return NULL; + return nullptr; } void packVectorNetworkIdVector(const MessageQueue::Data * data, Archive::ByteStream & target) diff --git a/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/AiCreatureStateMessage.cpp b/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/AiCreatureStateMessage.cpp index 95dc3fd7..74213208 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/AiCreatureStateMessage.cpp +++ b/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/AiCreatureStateMessage.cpp @@ -37,9 +37,9 @@ void AiCreatureStateMessage::pack(MessageQueue::Data const * const data, Archive { AiCreatureStateMessage const * const msg = safe_cast(data); - if (msg != NULL) + if (msg != nullptr) { - if (GameServerMessageInterface::getInstance() != NULL) + if (GameServerMessageInterface::getInstance() != nullptr) { GameServerMessageInterface::getInstance()->pack(target, *msg); } @@ -52,7 +52,7 @@ MessageQueue::Data * AiCreatureStateMessage::unpack(Archive::ReadIterator & sour { AiCreatureStateMessage * msg = new AiCreatureStateMessage(); - if (GameServerMessageInterface::getInstance() != NULL) + if (GameServerMessageInterface::getInstance() != nullptr) { GameServerMessageInterface::getInstance()->unpack(source, *msg); } diff --git a/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/AiMovementMessage.cpp b/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/AiMovementMessage.cpp index fde8e298..c87b7c66 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/AiMovementMessage.cpp +++ b/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/AiMovementMessage.cpp @@ -61,7 +61,7 @@ void AiMovementMessage::pack(const MessageQueue::Data* const data, Archive::Byte const AiMovementMessage * const msg = safe_cast (data); if (msg) { - if (GameServerMessageInterface::getInstance() != NULL) + if (GameServerMessageInterface::getInstance() != nullptr) GameServerMessageInterface::getInstance()->pack(target, *msg); } } @@ -72,7 +72,7 @@ MessageQueue::Data* AiMovementMessage::unpack(Archive::ReadIterator & source) { AiMovementMessage * msg = new AiMovementMessage(); - if (GameServerMessageInterface::getInstance() != NULL) + if (GameServerMessageInterface::getInstance() != nullptr) GameServerMessageInterface::getInstance()->unpack(source, *msg); return msg; diff --git a/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/GameServerMessageInterface.cpp b/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/GameServerMessageInterface.cpp index 5872a21e..e898606f 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/GameServerMessageInterface.cpp +++ b/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/GameServerMessageInterface.cpp @@ -13,7 +13,7 @@ //----------------------------------------------------------------------- -GameServerMessageInterface * GameServerMessageInterface::ms_instance = NULL; +GameServerMessageInterface * GameServerMessageInterface::ms_instance = nullptr; //======================================================================= @@ -27,14 +27,14 @@ GameServerMessageInterface::GameServerMessageInterface() GameServerMessageInterface::~GameServerMessageInterface() { if (ms_instance == this) - ms_instance = NULL; + ms_instance = nullptr; } //----------------------------------------------------------------------- void GameServerMessageInterface::setInstance(GameServerMessageInterface * instance) { - if (ms_instance == NULL) + if (ms_instance == nullptr) ms_instance = instance; else if (ms_instance != instance) { diff --git a/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/RenameCharacterMessage.cpp b/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/RenameCharacterMessage.cpp index bd4cae1a..8aa0309a 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/RenameCharacterMessage.cpp +++ b/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/RenameCharacterMessage.cpp @@ -64,11 +64,11 @@ RenameCharacterMessageEx::RenameCharacterMessageEx(RenameCharacterMessageSource static Unicode::String const delimiters(Unicode::narrowToWide(" ")); Unicode::UnicodeStringVector newNameTokens; - if (!Unicode::tokenize(newName, newNameTokens, &delimiters, NULL)) + if (!Unicode::tokenize(newName, newNameTokens, &delimiters, nullptr)) newNameTokens.clear(); Unicode::UnicodeStringVector oldNameTokens; - if (!Unicode::tokenize(oldName, oldNameTokens, &delimiters, NULL)) + if (!Unicode::tokenize(oldName, oldNameTokens, &delimiters, nullptr)) oldNameTokens.clear(); m_lastNameChangeOnly.set(((newNameTokens.size() >= 1) && (oldNameTokens.size() >= 1) && Unicode::caseInsensitiveCompare(newNameTokens[0], oldNameTokens[0]))); diff --git a/engine/server/library/serverPathfinding/src/shared/CityPathGraph.cpp b/engine/server/library/serverPathfinding/src/shared/CityPathGraph.cpp index 2f14d0ac..8ec08af5 100755 --- a/engine/server/library/serverPathfinding/src/shared/CityPathGraph.cpp +++ b/engine/server/library/serverPathfinding/src/shared/CityPathGraph.cpp @@ -72,13 +72,13 @@ CityPathGraph::CityPathGraph ( int cityToken ) CityPathGraph::~CityPathGraph() { delete m_namedNodes; - m_namedNodes = NULL; + m_namedNodes = nullptr; delete m_nodeTree; - m_nodeTree = NULL; + m_nodeTree = nullptr; delete m_dirtyBoxes; - m_dirtyBoxes = NULL; + m_dirtyBoxes = nullptr; } // ---------------------------------------------------------------------- @@ -92,7 +92,7 @@ int CityPathGraph::addNode ( DynamicPathNode * newNode ) int index = DynamicPathGraph::addNode(newNode); SpatialHandle * handle = m_nodeTree->addObject( cityNode ); - if (handle != NULL) + if (handle != nullptr) { if (cityNode->getName() != Unicode::emptyString) { @@ -134,7 +134,7 @@ void CityPathGraph::removeNode ( int nodeIndex ) SpatialHandle * handle = cityNode->getSpatialHandle(); - if (m_namedNodes != NULL) + if (m_namedNodes != nullptr) { std::map >::iterator found = m_namedNodes->find(cityNode->getName()); if (found != m_namedNodes->end()) @@ -146,7 +146,7 @@ void CityPathGraph::removeNode ( int nodeIndex ) } m_nodeTree->removeObject( handle ); - cityNode->setSpatialHandle(NULL); + cityNode->setSpatialHandle(nullptr); DynamicPathGraph::removeNode(nodeIndex); } @@ -160,7 +160,7 @@ void CityPathGraph::destroyNode ( int nodeIndex ) { CityPathNode * cityNode = _getNode(nodeIndex); - if(cityNode == NULL) return; + if(cityNode == nullptr) return; // ---------- // Remember which nodes were adjacent to the node we're removing @@ -185,7 +185,7 @@ void CityPathGraph::destroyNode ( int nodeIndex ) m_nodeTree->removeObject( handle ); - cityNode->setSpatialHandle(NULL); + cityNode->setSpatialHandle(nullptr); // ---------- // Remove the node @@ -217,7 +217,7 @@ void CityPathGraph::moveNode ( int nodeIndex, Vector const & newPosition ) { CityPathNode * cityNode = _getNode(nodeIndex); - if(cityNode == NULL) return; + if(cityNode == nullptr) return; // ---------- // Remember which nodes were adjacent to the node we're removing @@ -272,7 +272,7 @@ void CityPathGraph::relinkNode ( int nodeIndex ) { CityPathNode * nodeA = _getNode(nodeIndex); - if(nodeA == NULL) return; + if(nodeA == nullptr) return; // ---------- @@ -293,16 +293,16 @@ void CityPathGraph::relinkNode ( int nodeIndex ) { CityPathNode * nodeB = _getNode(i); - if(nodeB == NULL) continue; + if(nodeB == nullptr) continue; if(nodeA == nodeB) continue; PathNodeType typeB = nodeB->getType(); if(typeB != PNT_CityBuildingEntrance) continue; - if(nodeA->getCreatorObject() == NULL) continue; + if(nodeA->getCreatorObject() == nullptr) continue; - if(nodeB->getCreatorObject() == NULL) continue; + if(nodeB->getCreatorObject() == nullptr) continue; if(nodeA->getCreatorObject() != nodeB->getCreatorObject()) continue; @@ -330,16 +330,16 @@ void CityPathGraph::relinkNode ( int nodeIndex ) { CityPathNode * nodeB = _getNode(i); - if(nodeB == NULL) continue; + if(nodeB == nullptr) continue; if(nodeA == nodeB) continue; PathNodeType typeB = nodeB->getType(); if(typeB != PNT_CityBuilding) continue; - if(nodeA->getCreatorObject() == NULL) continue; + if(nodeA->getCreatorObject() == nullptr) continue; - if(nodeB->getCreatorObject() == NULL) continue; + if(nodeB->getCreatorObject() == nullptr) continue; if(nodeA->getCreatorObject() != nodeB->getCreatorObject()) continue; @@ -367,7 +367,7 @@ void CityPathGraph::relinkNode ( int nodeIndex ) { CityPathNode * nodeB = static_cast(results[i]); - if(nodeB == NULL) continue; + if(nodeB == nullptr) continue; if(nodeA == nodeB) continue; PathNodeType typeB = nodeB->getType(); @@ -420,7 +420,7 @@ void CityPathGraph::relinkNode ( int nodeIndex ) { CityPathNode * neighborNode = _getNode(neighborList[i]); - if(neighborNode != NULL) + if(neighborNode != nullptr) { neighborNode->markRedundantEdges(); neighborNode->removeMarkedEdges(); @@ -467,11 +467,11 @@ CityPathNode * CityPathGraph::findNodeForObject ( ServerObject const & object ) { CityPathNode * node = _getNode(i); - if(node == NULL) continue; + if(node == nullptr) continue; ServerObject const * source = node->getSourceObject(); - if(source == NULL) continue; + if(source == nullptr) continue; if(source == &object) { @@ -479,7 +479,7 @@ CityPathNode * CityPathGraph::findNodeForObject ( ServerObject const & object ) } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -492,11 +492,11 @@ CityPathNode const * CityPathGraph::findNodeForObject ( ServerObject const & obj { CityPathNode const * node = _getNode(i); - if(node == NULL) continue; + if(node == nullptr) continue; ServerObject const * source = node->getSourceObject(); - if(source == NULL) continue; + if(source == nullptr) continue; if(source == &object) { @@ -504,15 +504,15 @@ CityPathNode const * CityPathGraph::findNodeForObject ( ServerObject const & obj } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- CityPathNode * CityPathGraph::findNearestNodeForName( Unicode::String const & nodeName, Vector const & pos ) { - if (m_namedNodes == NULL) - return NULL; + if (m_namedNodes == nullptr) + return nullptr; std::map >::iterator found = m_namedNodes->find(nodeName); if (found != m_namedNodes->end() && !found->second.empty()) @@ -521,12 +521,12 @@ CityPathNode * CityPathGraph::findNearestNodeForName( Unicode::String const & no if (nodes.size() == 1) return *(nodes.begin()); - CityPathNode * node = NULL; + CityPathNode * node = nullptr; float distance = FLT_MAX; for (std::set::iterator i = nodes.begin(); i != nodes.end(); ++i) { float testDistance = pos.magnitudeBetweenSquared((*i)->getPosition_w()); - if (node == NULL || testDistance < distance) + if (node == nullptr || testDistance < distance) { distance = testDistance; node = *i; @@ -535,15 +535,15 @@ CityPathNode * CityPathGraph::findNearestNodeForName( Unicode::String const & no return node; } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- CityPathNode const * CityPathGraph::findNearestNodeForName( Unicode::String const & nodeName, Vector const & pos ) const { - if (m_namedNodes == NULL) - return NULL; + if (m_namedNodes == nullptr) + return nullptr; std::map >::const_iterator found = m_namedNodes->find(nodeName); if (found != m_namedNodes->end() && !found->second.empty()) @@ -552,12 +552,12 @@ CityPathNode const * CityPathGraph::findNearestNodeForName( Unicode::String cons if (nodes.size() == 1) return *(nodes.begin()); - CityPathNode const * node = NULL; + CityPathNode const * node = nullptr; float distance = FLT_MAX; for (std::set::const_iterator i = nodes.begin(); i != nodes.end(); ++i) { float testDistance = pos.magnitudeBetweenSquared((*i)->getPosition_w()); - if (node == NULL || testDistance < distance) + if (node == nullptr || testDistance < distance) { distance = testDistance; node = *i; @@ -566,14 +566,14 @@ CityPathNode const * CityPathGraph::findNearestNodeForName( Unicode::String cons return node; } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- int CityPathGraph::findNearestNode ( Vector const & position ) const { - PathNode * temp = NULL; + PathNode * temp = nullptr; float dummy1 = REAL_MAX; float dummy2 = REAL_MAX; @@ -713,7 +713,7 @@ int CityPathGraph::getNeighborCode ( int whichNode ) const { CityPathNode const * node = _getNode(whichNode); - if(node == NULL) return 0; + if(node == nullptr) return 0; int edgeCount = node->getEdgeCount(); @@ -725,7 +725,7 @@ int CityPathGraph::getNeighborCode ( int whichNode ) const CityPathNode const * neighbor = _getNode(neighborId); - if(neighbor == NULL) continue; + if(neighbor == nullptr) continue; int neighborInt = reinterpret_cast(neighbor); diff --git a/engine/server/library/serverPathfinding/src/shared/CityPathGraphManager.cpp b/engine/server/library/serverPathfinding/src/shared/CityPathGraphManager.cpp index 3e511c3c..9194452e 100755 --- a/engine/server/library/serverPathfinding/src/shared/CityPathGraphManager.cpp +++ b/engine/server/library/serverPathfinding/src/shared/CityPathGraphManager.cpp @@ -58,7 +58,7 @@ struct RegionCacheEntry { RegionCacheEntry ( void ) - : m_shape(), m_graph(NULL) + : m_shape(), m_graph(nullptr) { } @@ -143,7 +143,7 @@ void CityPathGraphManager::update ( float time ) CityPathGraph * graph = g_regionCache[g_scrubberGraphIndex].m_graph; - if(graph == NULL) return; + if(graph == nullptr) return; if(g_scrubberNodeIndex >= graph->getNodeCount()) { @@ -156,7 +156,7 @@ void CityPathGraphManager::update ( float time ) g_scrubberNodeIndex++; - if(node == NULL) return; + if(node == nullptr) return; if(!node->sanityCheck(false)) { @@ -233,14 +233,14 @@ Region const * getCityRegionFor( Vector const & position ) return results[0]; } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- int getCityTokenFor ( Region const * region ) { - if(region == NULL) return -1; + if(region == nullptr) return -1; Unicode::String const & name = region->getName(); @@ -294,7 +294,7 @@ bool checkRegionCache ( Vector const & position, CityPathGraph * & outGraph ) bool addToRegionCache ( MultiShape const & shape, CityPathGraph * graph ) { - if(graph == NULL) return false; + if(graph == nullptr) return false; RegionCacheEntry entry(shape,graph); @@ -325,12 +325,12 @@ bool addToRegionCache ( AxialBox const & box, CityPathGraph * graph ) bool addToRegionCache ( Region const * region, CityPathGraph * graph ) { - if(region == NULL) return false; - if(graph == NULL) return false; + if(region == nullptr) return false; + if(graph == nullptr) return false; MxCifQuadTreeBounds const * bounds = ®ion->getBounds(); - if(bounds == NULL) return false; + if(bounds == nullptr) return false; MxCifQuadTreeCircleBounds const * circleBounds = dynamic_cast(bounds); @@ -390,7 +390,7 @@ CityPathGraph * createCityGraphFor ( Region const * region ) { int token = getCityTokenFor(region); - if(token == -1) return NULL; + if(token == -1) return nullptr; CityPathGraph * graph = new CityPathGraph(token); @@ -401,7 +401,7 @@ CityPathGraph * createCityGraphFor ( Region const * region ) CityPathGraph * createCityGraphFor ( ServerObject const * creator, MultiShape const & shape ) { - if(creator == NULL) return NULL; + if(creator == nullptr) return nullptr; CityPathGraph * newGraph = new CityPathGraph(-1); @@ -416,7 +416,7 @@ CityPathGraph * createCityGraphFor ( ServerObject const * creator, MultiShape co CityPathGraph * _getCityGraphFor ( Vector const & position ) { - CityPathGraph * graph = NULL; + CityPathGraph * graph = nullptr; if(checkRegionCache(position,graph)) { @@ -436,9 +436,9 @@ CityPathGraph * _getCityGraphFor ( Vector const & position ) CityPathGraph * _getCityGraphFor ( ServerObject const * object ) { - if(object == NULL) + if(object == nullptr) { - return NULL; + return nullptr; } else { @@ -450,8 +450,8 @@ CityPathGraph * _getCityGraphFor ( ServerObject const * object ) CityPathNode * _getCityNodeFor ( ServerObject const * object, CityPathGraph * graph ) { - if(object == NULL) return NULL; - if(graph == NULL) return NULL; + if(object == nullptr) return nullptr; + if(graph == nullptr) return nullptr; return graph->findNodeForObject(*object); } @@ -462,7 +462,7 @@ CityPathNode * _getCityNodeFor ( ServerObject const * object ) { CityPathGraph * graph = _getCityGraphFor(object); - if(graph == NULL) return NULL; + if(graph == nullptr) return nullptr; return _getCityNodeFor(object,graph); } @@ -471,19 +471,19 @@ CityPathNode * _getCityNodeFor ( ServerObject const * object ) PathGraph const * _getExteriorGraph ( ServerObject const * object ) { - if(object == NULL) return NULL; + if(object == nullptr) return nullptr; CollisionProperty const * collision = object->getCollisionProperty(); - if(collision == NULL) return NULL; + if(collision == nullptr) return nullptr; Floor const * floor = collision->getFloor(); - if(floor == NULL) return NULL; + if(floor == nullptr) return nullptr; FloorMesh const * floorMesh = floor->getFloorMesh(); - if(floorMesh == NULL) return NULL; + if(floorMesh == nullptr) return nullptr; PathGraph const * pathGraph = safe_cast(floorMesh->getPathGraph()); @@ -507,8 +507,8 @@ CityPathGraph const * CityPathGraphManager::getCityGraphFor ( Vector const & pos CityPathNode const * CityPathGraphManager::getNamedNodeFor( ServerObject const & object, Unicode::String const & nodeName ) { CityPathGraph const * cityGraph = getCityGraphFor(&object); - if (cityGraph == NULL) - return NULL; + if (cityGraph == nullptr) + return nullptr; return cityGraph->findNearestNodeForName(nodeName, object.getPosition_w()); } @@ -517,7 +517,7 @@ CityPathNode const * CityPathGraphManager::getNamedNodeFor( ServerObject const & bool CityPathGraphManager::getClosestPathNodePos ( ServerObject const * object, Vector & outPos ) { - if(object == NULL) return false; + if(object == nullptr) return false; if(object->getParentCell() == CellProperty::getWorldCellProperty()) { @@ -548,11 +548,11 @@ bool CityPathGraphManager::getClosestPathNodePos ( ServerObject const * object, void CityPathGraphManager::addWaypoint ( ServerObject * sourceObject ) { - if(sourceObject == NULL) return; + if(sourceObject == nullptr) return; CityPathGraph * graph = _getCityGraphFor(sourceObject); - if(graph == NULL) + if(graph == nullptr) { return; } @@ -561,7 +561,7 @@ void CityPathGraphManager::addWaypoint ( ServerObject * sourceObject ) DynamicVariableList const & objvars = sourceObject->getObjVars(); - CityPathNode * newNode = NULL; + CityPathNode * newNode = nullptr; Vector sourcePos_w = sourceObject->getPosition_w(); @@ -626,11 +626,11 @@ void CityPathGraphManager::removeWaypoint ( ServerObject * sourceObject ) { CityPathGraph * graph = _getCityGraphFor(sourceObject); - if(graph == NULL) return; + if(graph == nullptr) return; CityPathNode * unloadingNode = _getCityNodeFor(sourceObject,graph); - if(unloadingNode == NULL) return; + if(unloadingNode == nullptr) return; // ---------- @@ -679,15 +679,15 @@ void CityPathGraphManager::moveWaypoint ( ServerObject * sourceObject, Vector co { UNREF(oldPosition); - if(sourceObject == NULL) return; + if(sourceObject == nullptr) return; CityPathGraph * graph = _getCityGraphFor(sourceObject); - if(graph == NULL) return; + if(graph == nullptr) return; CityPathNode * node = _getCityNodeFor(sourceObject,graph); - if(node == NULL) return; + if(node == nullptr) return; // ---------- @@ -719,11 +719,11 @@ void CityPathGraphManager::moveWaypoint ( ServerObject * sourceObject, Vector co void CityPathGraphManager::addBuilding ( BuildingObject * building ) { - if(building == NULL) return; + if(building == nullptr) return; CityPathGraph * graph = _getCityGraphFor(building); - if(graph == NULL) + if(graph == nullptr) { return; } @@ -752,11 +752,11 @@ void CityPathGraphManager::addBuilding ( BuildingObject * building ) { ServerObject * serverObject = ServerWorld::findObjectByNetworkId(ids[i]); - if(serverObject == NULL) continue; + if(serverObject == nullptr) continue; CityPathNode * node = _getCityNodeFor(serverObject,graph); - if(node == NULL) continue; + if(node == nullptr) continue; node->setCreator(building->getNetworkId()); } @@ -783,11 +783,11 @@ void CityPathGraphManager::destroyBuilding ( BuildingObject * building ) void CityPathGraphManager::moveBuilding ( BuildingObject * building, Vector const & oldPosition ) { - if(building == NULL) return; + if(building == nullptr) return; CityPathGraph * graph = _getCityGraphFor(building); - if(graph == NULL) return; + if(graph == nullptr) return; UNREF(oldPosition); @@ -800,11 +800,11 @@ void CityPathGraphManager::moveBuilding ( BuildingObject * building, Vector cons { ServerObject * serverObject = ServerWorld::findObjectByNetworkId(ids[i]); - if(serverObject == NULL) continue; + if(serverObject == nullptr) continue; CityPathNode * node = _getCityNodeFor(serverObject,graph); - if(node == NULL) continue; + if(node == nullptr) continue; Vector relativePos_o = node->getRelativePosition_o(); @@ -851,7 +851,7 @@ bool CityPathGraphManager::destroyPathGraph ( ServerObject const * creator ) bool CityPathGraphManager::createPathNodes ( ServerObject * building ) { - if(building == NULL) return false; + if(building == nullptr) return false; // Destroy any old path nodes for the building @@ -862,7 +862,7 @@ bool CityPathGraphManager::createPathNodes ( ServerObject * building ) PathGraph const * pathGraph = _getExteriorGraph(building); - if(pathGraph == NULL) return false; + if(pathGraph == nullptr) return false; // ---------- // Go through all the nodes in the building's graph and create city @@ -878,7 +878,7 @@ bool CityPathGraphManager::createPathNodes ( ServerObject * building ) { PathNode const * node = pathGraph->getNode(i); - if(node == NULL) continue; + if(node == nullptr) continue; // ---------- @@ -975,11 +975,11 @@ void CityPathGraphManager::destroyWaypoint ( ServerObject * object ) { CityPathGraph * graph = _getCityGraphFor(object); - if(graph == NULL) return; + if(graph == nullptr) return; CityPathNode * deadNode = _getCityNodeFor(object,graph); - if(deadNode == NULL) return; + if(deadNode == nullptr) return; // ---------- @@ -1025,11 +1025,11 @@ void CityPathGraphManager::destroyWaypoint ( ServerObject * object ) bool CityPathGraphManager::destroyPathNodes ( ServerObject * object ) { - if(object == NULL) return false; + if(object == nullptr) return false; BuildingObject * building = dynamic_cast(object); - if(building == NULL) return false; + if(building == nullptr) return false; NetworkIdList ids; if (!building->getObjVars().getItem(OBJVAR_PATHFINDING_BUILDING_WAYPOINTS,ids)) return false; @@ -1044,7 +1044,7 @@ bool CityPathGraphManager::destroyPathNodes ( ServerObject * object ) ServerObject * serverObject = ServerWorld::findObjectByNetworkId(id); - if(serverObject == NULL) continue; + if(serverObject == nullptr) continue; serverObject->permanentlyDestroy(DeleteReasons::Replaced); } @@ -1156,7 +1156,7 @@ void CityPathGraphManager::setLinkDistance ( float dist ) void CityPathGraphManager::relinkGraph ( CityPathGraph const * constGraph ) { - if(constGraph == NULL) return; + if(constGraph == nullptr) return; CityPathGraph * graph = const_cast(constGraph); diff --git a/engine/server/library/serverPathfinding/src/shared/CityPathNode.cpp b/engine/server/library/serverPathfinding/src/shared/CityPathNode.cpp index 8e4df130..11000b37 100755 --- a/engine/server/library/serverPathfinding/src/shared/CityPathNode.cpp +++ b/engine/server/library/serverPathfinding/src/shared/CityPathNode.cpp @@ -46,7 +46,7 @@ CityPathNode::CityPathNode ( Vector const & position_w, NetworkId const & source m_source(sourceId), m_creator(), m_relativePosition_o(Vector::zero), - m_spatialHandle(NULL), + m_spatialHandle(nullptr), m_debugId( gs_debugIdCounter++ ) { snapToTerrain(); @@ -59,7 +59,7 @@ CityPathNode::CityPathNode ( Vector const & position_w, NetworkId const & source m_source(sourceId), m_creator(creatorId), m_relativePosition_o(Vector::zero), - m_spatialHandle(NULL), + m_spatialHandle(nullptr), m_debugId( gs_debugIdCounter++ ) { updateRelativePosition(); @@ -158,7 +158,7 @@ void CityPathNode::loadInfoFromObjvars ( void ) { ServerObject const * sourceObject = getSourceObject(); - if(sourceObject == NULL) return; + if(sourceObject == nullptr) return; const DynamicVariableList & objvars = sourceObject->getObjVars(); @@ -188,7 +188,7 @@ void CityPathNode::loadEdgesFromObjvars ( void ) { ServerObject const * sourceObject = getSourceObject(); - if(sourceObject == NULL) return; + if(sourceObject == nullptr) return; DynamicVariableList const & objvars = sourceObject->getObjVars(); @@ -203,11 +203,11 @@ void CityPathNode::loadEdgesFromObjvars ( void ) { ServerObject * serverObject = ServerWorld::findObjectByNetworkId( idList[i] ); - if(serverObject == NULL) continue; + if(serverObject == nullptr) continue; CityPathNode * otherNode = _getGraph()->findNodeForObject(*serverObject); - if(otherNode == NULL) continue; + if(otherNode == nullptr) continue; addEdge(otherNode->getIndex()); otherNode->addEdge(getIndex()); @@ -233,7 +233,7 @@ void CityPathNode::saveInfoToObjvars ( void ) { ServerObject * sourceObject = getSourceObject(); - if(sourceObject == NULL) return; + if(sourceObject == nullptr) return; // ---------- @@ -294,7 +294,7 @@ void CityPathNode::saveEdgesToObjvars ( void ) CityPathNode * neighborNode = _getGraph()->_getNode(neighborIndex); - if(neighborNode == NULL) continue; + if(neighborNode == nullptr) continue; NetworkId const & neighborSourceId = neighborNode->getSourceId(); @@ -327,7 +327,7 @@ void CityPathNode::saveNeighbors ( void ) CityPathNode * neighborNode = _getGraph()->_getNode(neighborIndex); - if(neighborNode == NULL) continue; + if(neighborNode == nullptr) continue; neighborNode->saveToObjvars(); } @@ -420,7 +420,7 @@ bool CityPathNode::sanityCheck ( bool doWarnings ) const CityPathNode const * neighborNode = _getGraph()->_getNode(neighborIndex); - if(neighborNode == NULL) + if(neighborNode == nullptr) { DEBUG_WARNING(doWarnings,("CityPathNode::sanityCheck - Node has an edge to a non-existent node\n")); insaneCount++; @@ -458,7 +458,7 @@ bool CityPathNode::sanityCheck ( bool doWarnings ) const CityPathNode const * nodeA = this; CityPathNode const * nodeB = _getGraph()->_getNode(getNeighbor(i)); - if(nodeB == NULL) continue; + if(nodeB == nullptr) continue; if(nodeB->getType() == PNT_CityBuilding) continue; @@ -493,7 +493,7 @@ void CityPathNode::reload ( void ) { ServerObject const * sourceObject = getSourceObject(); - if(sourceObject == NULL) return; + if(sourceObject == nullptr) return; // ---------- @@ -521,7 +521,7 @@ bool CityPathNode::hasEdgeTo ( NetworkId const & neighborId ) const CityPathNode const * neighborNode = _getGraph()->_getNode(neighborIndex); - if(neighborNode == NULL) continue; + if(neighborNode == nullptr) continue; if(neighborNode->getSourceId() == neighborId) return true; } @@ -535,7 +535,7 @@ void CityPathNode::snapToTerrain ( void ) { CellProperty const * cell = getCell(); - if((cell == NULL) || (cell == CellProperty::getWorldCellProperty())) + if((cell == nullptr) || (cell == CellProperty::getWorldCellProperty())) { Vector pos_w = getPosition_w(); diff --git a/engine/server/library/serverPathfinding/src/shared/PathAutoGenerator.cpp b/engine/server/library/serverPathfinding/src/shared/PathAutoGenerator.cpp index d5f6cd8e..328a52aa 100755 --- a/engine/server/library/serverPathfinding/src/shared/PathAutoGenerator.cpp +++ b/engine/server/library/serverPathfinding/src/shared/PathAutoGenerator.cpp @@ -48,14 +48,14 @@ Region const * PathAutoGenerator::findPathRegion(Vector const & pos_w) for (RegionMaster::RegionVector::const_iterator it = rv.begin(); it != rv.end(); ++it) { Region const * const r = *it; - if (NULL != r) + if (nullptr != r) { if (r->getGeography() == RegionNamespace::RG_pathfind) return r; } } - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -63,7 +63,7 @@ Region const * PathAutoGenerator::findPathRegion(Vector const & pos_w) void PathAutoGenerator::pathAutoGenerate(Vector const & pos_w, float nodeDistance, float obstacleDistance, Unicode::String & result) { Region const * region = findPathRegion(pos_w); - if (NULL == region) + if (nullptr == region) { result += Unicode::narrowToWide("No pathfinding region at position"); return; @@ -144,7 +144,7 @@ void PathAutoGenerator::pathAutoGenerate(Vector const & pos_w, float nodeDistanc ++obstacleNearbySkipped; #if USE_OBSTACLE_TEMPLATE - if (NULL != PathAutoGeneratorNamespace::s_pathObstacleTemplate) + if (nullptr != PathAutoGeneratorNamespace::s_pathObstacleTemplate) { Transform transform_w; transform_w.setPosition_p(testPos_w); @@ -164,7 +164,7 @@ void PathAutoGenerator::pathAutoGenerate(Vector const & pos_w, float nodeDistanc transform_w.setPosition_p(testPos_w); ServerObject * newObject = ServerWorld::createNewObject(s_pathWaypointTemplate, transform_w, 0, false); - if (NULL != newObject) + if (nullptr != newObject) { newObject->addToWorld(); newObject->persist(); @@ -189,7 +189,7 @@ void PathAutoGenerator::pathAutoGenerate(Vector const & pos_w, float nodeDistanc void PathAutoGenerator::pathAutoCleanup(Vector const & pos_w, Unicode::String & result) { Region const * region = findPathRegion(pos_w); - if (NULL == region) + if (nullptr == region) { result += Unicode::narrowToWide("No pathfinding region at position"); return; @@ -236,7 +236,7 @@ void PathAutoGenerator::pathAutoCleanup(Vector const & pos_w, Unicode::String & } #if USE_OBSTACLE_TEMPLATE - if (NULL != s_pathObstacleTemplate && !strcmp(so->getTemplateName(), s_pathObstacleTemplate)) + if (nullptr != s_pathObstacleTemplate && !strcmp(so->getTemplateName(), s_pathObstacleTemplate)) { so->permanentlyDestroy(DeleteReasons::Script); ++obstacleDestroyCount; diff --git a/engine/server/library/serverPathfinding/src/shared/ServerPathBuilder.cpp b/engine/server/library/serverPathfinding/src/shared/ServerPathBuilder.cpp index 4ffdd288..109ba9c4 100755 --- a/engine/server/library/serverPathfinding/src/shared/ServerPathBuilder.cpp +++ b/engine/server/library/serverPathfinding/src/shared/ServerPathBuilder.cpp @@ -41,7 +41,7 @@ const float gs_maxCanMoveDistance2 = (64.0f * 64.0f); int findClosestReachablePathNode_slow( CreatureObject const * creature, PathGraph const * graph ) { - if(graph == NULL) return -1; + if(graph == nullptr) return -1; Vector creaturePos = creature->getPosition_p(); @@ -53,7 +53,7 @@ int findClosestReachablePathNode_slow( CreatureObject const * creature, PathGrap int resultCount = results.size(); - PathNode const * reachableNode = NULL; + PathNode const * reachableNode = nullptr; float reachableDist2 = gs_maxCanMoveDistance2; for(int i = 0; i < resultCount; i++) @@ -81,7 +81,7 @@ int findClosestReachablePathNode_slow( CreatureObject const * creature, PathGrap int findClosestReachablePathNode( CreatureObject const * creature, PathGraph const * graph ) { - if(graph == NULL) return -1; + if(graph == nullptr) return -1; Vector creaturePos = creature->getPosition_p(); @@ -98,7 +98,7 @@ int findClosestReachablePathNode( CreatureObject const * creature, PathGraph con PathNode const * node = graph->getNode(closestIndex); - if(node == NULL) return -2; + if(node == nullptr) return -2; Vector nodePos = node->getPosition_p(); float dist2 = nodePos.magnitudeBetweenSquared(creaturePos); @@ -135,7 +135,7 @@ int findClosestReachablePathNode_slow ( CellProperty const * cell, Vector const int resultCount = results.size(); - PathNode const * reachableNode = NULL; + PathNode const * reachableNode = nullptr; float reachableDist2 = gs_maxCanMoveDistance2; for(int i = 0; i < resultCount; i++) @@ -173,7 +173,7 @@ int findClosestReachablePathNode ( CellProperty const * cell, Vector const & goa PathNode const * node = graph->getNode(closestIndex); - if(node == NULL) return -2; + if(node == nullptr) return -2; Vector nodePos = node->getPosition_p(); float dist2 = nodePos.magnitudeBetweenSquared(goal); @@ -199,7 +199,7 @@ PathGraph const * getGraph ( CellProperty const * cell ) if(cell) return safe_cast(cell->getPathGraph()); else - return NULL; + return nullptr; } PathGraph const * getGraph ( PortalProperty const * building ) @@ -207,7 +207,7 @@ PathGraph const * getGraph ( PortalProperty const * building ) if(building) return safe_cast(building->getPortalPropertyTemplate().getBuildingPathGraph()); else - return NULL; + return nullptr; } // ---------- @@ -237,19 +237,19 @@ PortalProperty const * getBuilding ( BuildingObject const * buildingObject ) if(buildingObject) return buildingObject->getPortalProperty(); else - return NULL; + return nullptr; } PortalProperty const * getBuilding ( CreatureObject const * creature ) { - if(creature == NULL) return NULL; + if(creature == nullptr) return nullptr; CellProperty const * cell = creature->getParentCell(); if(cell) return cell->getPortalProperty(); else - return NULL; + return nullptr; } PortalProperty const * getBuilding ( AiLocation const & loc ) @@ -259,7 +259,7 @@ PortalProperty const * getBuilding ( AiLocation const & loc ) if(cell) return cell->getPortalProperty(); else - return NULL; + return nullptr; } // ---------- @@ -388,26 +388,26 @@ int getIndexFor ( CellProperty const * cell, PathGraph const * graph, AiLocation // ---------------------------------------------------------------------- ServerPathBuilder::ServerPathBuilder() -: m_creatureCell(NULL), - m_creatureCellGraph(NULL), +: m_creatureCell(nullptr), + m_creatureCellGraph(nullptr), m_creatureCellKey(-1), m_creatureCellNodeIndex(-1), m_creatureCellPart(-1), - m_creatureBuilding(NULL), - m_creatureBuildingGraph(NULL), + m_creatureBuilding(nullptr), + m_creatureBuildingGraph(nullptr), m_creatureBuildingKey(-1), m_creatureBuildingNodeIndex(-1), m_creaturePosition(), - m_goalCell(NULL), - m_goalCellGraph(NULL), + m_goalCell(nullptr), + m_goalCellGraph(nullptr), m_goalCellKey(-1), m_goalCellNodeIndex(-1), m_goalCellPart(-1), - m_goalBuilding(NULL), - m_goalBuildingGraph(NULL), + m_goalBuilding(nullptr), + m_goalBuildingGraph(nullptr), m_goalBuildingKey(-1), m_goalBuildingNodeIndex(-1), - m_goalCityGraph(NULL), + m_goalCityGraph(nullptr), m_goalCityNodeIndex(-1), m_path(new AiPath()), m_async(false), @@ -427,16 +427,16 @@ ServerPathBuilder::~ServerPathBuilder() ServerPathBuildManager::unqueue(this); delete m_path; - m_path = NULL; + m_path = nullptr; delete m_cellSearch; - m_cellSearch = NULL; + m_cellSearch = nullptr; delete m_buildingSearch; - m_buildingSearch = NULL; + m_buildingSearch = nullptr; delete m_citySearch; - m_citySearch = NULL; + m_citySearch = nullptr; } @@ -462,7 +462,7 @@ bool ServerPathBuilder::buildPathInternal( CellProperty const * cell, PathGraph PathNode const * node = graph->getNode(nodeIndex); - if(node == NULL) return false; + if(node == nullptr) return false; addPathNode( cell, node ); } @@ -484,9 +484,9 @@ bool ServerPathBuilder::buildPathInternal ( PortalProperty const * building, Pat // ---------- - PathNode const * nodeA = NULL; - PathNode const * nodeB = NULL; - PathNode const * nodeC = NULL; + PathNode const * nodeA = nullptr; + PathNode const * nodeB = nullptr; + PathNode const * nodeC = nullptr; int pathLength = path.size(); @@ -496,7 +496,7 @@ bool ServerPathBuilder::buildPathInternal ( PortalProperty const * building, Pat { PathNode const * nextNode = graph->getNode(path[i]); - if(nextNode == NULL) continue; + if(nextNode == nullptr) continue; nodeA = nodeB; nodeB = nodeC; @@ -506,10 +506,10 @@ bool ServerPathBuilder::buildPathInternal ( PortalProperty const * building, Pat { nodeA = nodeB; nodeB = nodeC; - nodeC = NULL; + nodeC = nullptr; } - if( nodeB == NULL ) continue; + if( nodeB == nullptr ) continue; // ---------- @@ -519,11 +519,11 @@ bool ServerPathBuilder::buildPathInternal ( PortalProperty const * building, Pat CellProperty const * subobject = building->getCell(cellIndex); - if(subobject == NULL) return false; + if(subobject == nullptr) return false; PathGraph const * subgraph = getGraph(subobject); - if(subgraph == NULL) return false; + if(subgraph == nullptr) return false; // ---------- @@ -576,9 +576,9 @@ bool ServerPathBuilder::buildPathInternal ( CityPathGraph const * graph, int ind bool ServerPathBuilder::expandPath ( CityPathGraph const * graph, IndexList const & path ) { - PathNode const * nodeA = NULL; - PathNode const * nodeB = NULL; - PathNode const * nodeC = NULL; + PathNode const * nodeA = nullptr; + PathNode const * nodeB = nullptr; + PathNode const * nodeC = nullptr; int pathLength = path.size(); @@ -588,7 +588,7 @@ bool ServerPathBuilder::expandPath ( CityPathGraph const * graph, IndexList cons { PathNode const * nextNode = graph->getNode(path[i]); - if(nextNode == NULL) continue; + if(nextNode == nullptr) continue; nodeA = nodeB; nodeB = nodeC; @@ -598,10 +598,10 @@ bool ServerPathBuilder::expandPath ( CityPathGraph const * graph, IndexList cons { nodeA = nodeB; nodeB = nodeC; - nodeC = NULL; + nodeC = nullptr; } - if( nodeB == NULL ) continue; + if( nodeB == nullptr ) continue; // ---------- @@ -609,19 +609,19 @@ bool ServerPathBuilder::expandPath ( CityPathGraph const * graph, IndexList cons { CityPathNode const * cityNode = safe_cast(nodeB); - if(cityNode == NULL) return false; + if(cityNode == nullptr) return false; BuildingObject const * buildingObject = safe_cast(cityNode->getCreatorObject()); - if(buildingObject == NULL) return false; + if(buildingObject == nullptr) return false; PortalProperty const * subobject = getBuilding(buildingObject); - if(subobject == NULL) return false; + if(subobject == nullptr) return false; PathGraph const * subgraph = getGraph(subobject); - if(subgraph == NULL) return false; + if(subgraph == nullptr) return false; // ---------- @@ -652,7 +652,7 @@ bool ServerPathBuilder::buildPath_World ( void ) { Vector exitPoint(m_creature ? m_creature->getPosition_w() : m_creaturePosition); - if((m_creatureCityGraph != NULL) && (m_creatureCityNodeIndex >= 0)) + if((m_creatureCityGraph != nullptr) && (m_creatureCityNodeIndex >= 0)) { int indexA = m_creatureCityNodeIndex; int indexB = m_creatureCityGraph->findNearestNode(m_goal.getPosition_w()); @@ -670,7 +670,7 @@ bool ServerPathBuilder::buildPath_World ( void ) } } - if((m_goalCityGraph != NULL) && (m_goalCityNodeIndex >= 0)) + if((m_goalCityGraph != nullptr) && (m_goalCityNodeIndex >= 0)) { int indexA = m_goalCityGraph->findNearestNode(exitPoint); int indexB = m_goalCityNodeIndex; @@ -701,8 +701,8 @@ bool ServerPathBuilder::buildPath_ToGoal ( void ) m_creatureCell = m_creature->getParentCell(); m_goalCell = m_goal.getCell(); - if(m_creatureCell == NULL) m_creatureCell = worldCell; - if(m_goalCell == NULL) m_goalCell = worldCell; + if(m_creatureCell == nullptr) m_creatureCell = worldCell; + if(m_goalCell == nullptr) m_goalCell = worldCell; { Vector goalPos_p = m_goal.getPosition_p(m_creatureCell); @@ -724,23 +724,23 @@ bool ServerPathBuilder::buildPath_ToGoal ( void ) // we can skip some work with looking up their cell and building // info. - m_creatureCellGraph = NULL; + m_creatureCellGraph = nullptr; m_creatureCellKey = -1; m_creatureCellNodeIndex = -1; m_creatureCellPart = -1; - m_goalCellGraph = NULL; + m_goalCellGraph = nullptr; m_goalCellKey = -1; m_goalCellNodeIndex = -1; m_goalCellPart = -1; - m_creatureBuilding = NULL; - m_creatureBuildingGraph = NULL; + m_creatureBuilding = nullptr; + m_creatureBuildingGraph = nullptr; m_creatureBuildingKey = -1; m_creatureBuildingNodeIndex = -1; - m_goalBuilding = NULL; - m_goalBuildingGraph = NULL; + m_goalBuilding = nullptr; + m_goalBuildingGraph = nullptr; m_goalBuildingKey = -1; m_goalBuildingNodeIndex = -1; } @@ -776,7 +776,7 @@ bool ServerPathBuilder::buildPath_ToGoal ( void ) // If they're in the same cell, start the search in the cell - if((m_creatureCell == m_goalCell) && (m_creatureCell != NULL) && (m_creatureCell != CellProperty::getWorldCellProperty()) && (m_creatureCellPart == m_goalCellPart)) + if((m_creatureCell == m_goalCell) && (m_creatureCell != nullptr) && (m_creatureCell != CellProperty::getWorldCellProperty()) && (m_creatureCellPart == m_goalCellPart)) { return buildPathInternal(m_creatureCell,m_creatureCellGraph,m_creatureCellNodeIndex,m_goalCellNodeIndex); } @@ -795,7 +795,7 @@ bool ServerPathBuilder::buildPath_ToGoal ( void ) // If they're in the same building, start the search in the building - if((m_creatureBuilding == m_goalBuilding) && (m_creatureBuilding != NULL)) + if((m_creatureBuilding == m_goalBuilding) && (m_creatureBuilding != nullptr)) { return buildPathInternal(m_creatureBuilding,m_creatureBuildingGraph,m_creatureBuildingNodeIndex,m_goalBuildingNodeIndex); } @@ -810,7 +810,7 @@ bool ServerPathBuilder::buildPath_ToGoal ( void ) m_goalCityGraph = CityPathGraphManager::getCityGraphFor(m_goal.getPosition_w()); m_goalCityNodeIndex = getIndexFor(m_goalCityGraph,m_goalBuilding,m_goal); - if((m_creatureCityGraph == m_goalCityGraph) && (m_creatureCityGraph != NULL)) + if((m_creatureCityGraph == m_goalCityGraph) && (m_creatureCityGraph != nullptr)) { // hack - If a creature in a city region tries to path search but it's not near a path node, // make its path search succeed @@ -875,7 +875,7 @@ bool ServerPathBuilder::buildPath_Named ( void ) // ---------- - if(m_creatureCityGraph != NULL) + if(m_creatureCityGraph != nullptr) { IndexList goalList; @@ -885,7 +885,7 @@ bool ServerPathBuilder::buildPath_Named ( void ) { CityPathNode const * node = m_creatureCityGraph->_getNode(i); - if(node == NULL) continue; + if(node == nullptr) continue; if(node->getName() == m_goalName) { @@ -954,7 +954,7 @@ void ServerPathBuilder::update ( void ) bool ServerPathBuilder::setupBuildPath ( CreatureObject const * creature, AiLocation const & goal ) { - if(creature == NULL) return false; + if(creature == nullptr) return false; if(!goal.isValid()) return false; m_creature = creature; @@ -971,7 +971,7 @@ bool ServerPathBuilder::setupBuildPath ( CreatureObject const * creature, AiLoca bool ServerPathBuilder::setupBuildPath ( CreatureObject const * creature, Unicode::String const & goalName ) { - if(creature == NULL) return false; + if(creature == nullptr) return false; if(goalName.empty()) return false; m_creature = creature; @@ -1058,23 +1058,23 @@ bool ServerPathBuilder::buildWorldPath(AiLocation const &startLocation, AiLocati // we can skip some work with looking up their cell and building // info. - m_creatureCellGraph = NULL; + m_creatureCellGraph = nullptr; m_creatureCellKey = -1; m_creatureCellNodeIndex = -1; m_creatureCellPart = -1; - m_goalCellGraph = NULL; + m_goalCellGraph = nullptr; m_goalCellKey = -1; m_goalCellNodeIndex = -1; m_goalCellPart = -1; - m_creatureBuilding = NULL; - m_creatureBuildingGraph = NULL; + m_creatureBuilding = nullptr; + m_creatureBuildingGraph = nullptr; m_creatureBuildingKey = -1; m_creatureBuildingNodeIndex = -1; - m_goalBuilding = NULL; - m_goalBuildingGraph = NULL; + m_goalBuilding = nullptr; + m_goalBuildingGraph = nullptr; m_goalBuildingKey = -1; m_goalBuildingNodeIndex = -1; @@ -1134,8 +1134,8 @@ bool ServerPathBuilder::buildWorldPath(AiLocation const &startLocation, AiLocati void ServerPathBuilder::addPathNode ( CellProperty const * cell, PathNode const * node ) { - if(node == NULL) return; - if(cell == NULL) cell = CellProperty::getWorldCellProperty(); + if(node == nullptr) return; + if(cell == nullptr) cell = CellProperty::getWorldCellProperty(); AiLocation loc(cell,node->getPosition_p()); @@ -1173,7 +1173,7 @@ void ServerPathBuilder::addPathNode ( CellProperty const * cell, PathNode const bool ServerPathBuilder::buildPathImmediate(AiLocation const & creature, AiLocation const & goal) { - m_creature = NULL; + m_creature = nullptr; m_goal = goal; m_buildDone = false; m_buildFailed = false; @@ -1190,9 +1190,9 @@ bool ServerPathBuilder::buildPathImmediate(AiLocation const & creature, AiLocati // ---------- CellProperty const * worldCell = CellProperty::getWorldCellProperty(); - if(m_creatureCell == NULL) + if(m_creatureCell == nullptr) m_creatureCell = worldCell; - if(m_goalCell == NULL) + if(m_goalCell == nullptr) m_goalCell = worldCell; @@ -1236,14 +1236,14 @@ bool ServerPathBuilder::buildPathImmediate(AiLocation const & creature, AiLocati m_goalBuildingNodeIndex = getIndexFor(m_goalBuilding, m_goalBuildingGraph, m_goal, m_goalCellPart); // If they're in the same building, start the search in the building - if((m_creatureBuilding == m_goalBuilding) && (m_creatureBuilding != NULL)) + if((m_creatureBuilding == m_goalBuilding) && (m_creatureBuilding != nullptr)) { if (buildPathInternal(m_creatureBuilding, m_creatureBuildingGraph, m_creatureBuildingNodeIndex, m_goalBuildingNodeIndex)) return true; } // If they're in the same cell, start the search in the cell - if((m_creatureCell == m_goalCell) && (m_creatureCell != NULL) && (m_creatureCell != CellProperty::getWorldCellProperty()) && (m_creatureCellPart == m_goalCellPart)) + if((m_creatureCell == m_goalCell) && (m_creatureCell != nullptr) && (m_creatureCell != CellProperty::getWorldCellProperty()) && (m_creatureCellPart == m_goalCellPart)) { if (buildPathInternal(m_creatureCell, m_creatureCellGraph, m_creatureCellNodeIndex, m_goalCellNodeIndex)) return true; @@ -1257,7 +1257,7 @@ bool ServerPathBuilder::buildPathImmediate(AiLocation const & creature, AiLocati m_goalCityGraph = CityPathGraphManager::getCityGraphFor(m_goal.getPosition_w()); m_goalCityNodeIndex = getIndexFor(m_goalCityGraph,m_goalBuilding,m_goal); - if((m_creatureCityGraph == m_goalCityGraph) && (m_creatureCityGraph != NULL)) + if((m_creatureCityGraph == m_goalCityGraph) && (m_creatureCityGraph != nullptr)) { // hack - If a creature in a city region tries to path search but it's not near a path node, // make its path search succeed diff --git a/engine/server/library/serverPathfinding/src/shared/ServerPathfindingMessaging.cpp b/engine/server/library/serverPathfinding/src/shared/ServerPathfindingMessaging.cpp index 068f9d3a..e71513d5 100755 --- a/engine/server/library/serverPathfinding/src/shared/ServerPathfindingMessaging.cpp +++ b/engine/server/library/serverPathfinding/src/shared/ServerPathfindingMessaging.cpp @@ -31,7 +31,7 @@ #include #include -ServerPathfindingMessaging * g_messaging = NULL; +ServerPathfindingMessaging * g_messaging = nullptr; // ====================================================================== @@ -51,7 +51,7 @@ void ServerPathfindingMessaging::remove ( void ) g_messaging->disconnectFromMessage(RequestUnstick::MESSAGE_TYPE); delete g_messaging; - g_messaging = NULL; + g_messaging = nullptr; } ServerPathfindingMessaging & ServerPathfindingMessaging::getInstance ( void ) @@ -75,10 +75,10 @@ ServerPathfindingMessaging::~ServerPathfindingMessaging() } delete m_clientList; - m_clientList = NULL; + m_clientList = nullptr; delete m_callback; - m_callback = NULL; + m_callback = nullptr; } // ---------- @@ -178,7 +178,7 @@ void ServerPathfindingMessaging::receiveMessage(const MessageDispatch::Emitter & { Transform newTransform = Transform::identity; newTransform.setPosition_p(unstickPoint); - controller->teleport(newTransform, NULL); + controller->teleport(newTransform, nullptr); } return; @@ -188,7 +188,7 @@ void ServerPathfindingMessaging::receiveMessage(const MessageDispatch::Emitter & Vector unstickPoint; CellObject * cell = ContainerInterface::getContainingCellObject(*s); - if (cell != NULL && s->asCreatureObject() != NULL) + if (cell != nullptr && s->asCreatureObject() != nullptr) { // try finding a waypoint in the cell first if (!cell->getClosestPathNodePos(*s, unstickPoint)) @@ -266,7 +266,7 @@ void ServerPathfindingMessaging::ignoreObjectPath(Client * client, const Network void ServerPathfindingMessaging::watchPathMap(Client * client) { - if(client == NULL) return; + if(client == nullptr) return; // Add the client to our client list @@ -290,7 +290,7 @@ void ServerPathfindingMessaging::watchPathMap(Client * client) void ServerPathfindingMessaging::ignorePathMap(Client * client) { - if(client == NULL) return; + if(client == nullptr) return; m_clientList->erase(client); @@ -319,7 +319,7 @@ void ServerPathfindingMessaging::onClientDestroy(ClientDestroy & d) void ServerPathfindingMessaging::sendGraphInfo ( CityPathGraph const * graph ) { - if(graph == NULL) return; + if(graph == nullptr) return; for(ClientList::iterator it = m_clientList->begin(); it != m_clientList->end(); ++it) { @@ -331,8 +331,8 @@ void ServerPathfindingMessaging::sendGraphInfo ( CityPathGraph const * graph ) void ServerPathfindingMessaging::sendGraphInfo ( CityPathGraph const * graph, Client * client ) { - if(client == NULL) return; - if(graph == NULL) return; + if(client == nullptr) return; + if(graph == nullptr) return; int nodeCount = graph->getNodeCount(); @@ -348,7 +348,7 @@ void ServerPathfindingMessaging::sendGraphInfo ( CityPathGraph const * graph, Cl void ServerPathfindingMessaging::sendEraseGraph ( CityPathGraph const * graph ) { - if(graph == NULL) return; + if(graph == nullptr) return; for(ClientList::iterator it = m_clientList->begin(); it != m_clientList->end(); ++it) { @@ -360,8 +360,8 @@ void ServerPathfindingMessaging::sendEraseGraph ( CityPathGraph const * graph ) void ServerPathfindingMessaging::sendEraseGraph ( CityPathGraph const * graph, Client * client ) { - if(client == NULL) return; - if(graph == NULL) return; + if(client == nullptr) return; + if(graph == nullptr) return; int nodeCount = graph->getNodeCount(); @@ -377,7 +377,7 @@ void ServerPathfindingMessaging::sendEraseGraph ( CityPathGraph const * graph, C void ServerPathfindingMessaging::sendNodeInfo ( CityPathNode const * node ) { - if(node == NULL) return; + if(node == nullptr) return; for(ClientList::iterator it = m_clientList->begin(); it != m_clientList->end(); ++it) { @@ -389,8 +389,8 @@ void ServerPathfindingMessaging::sendNodeInfo ( CityPathNode const * node ) void ServerPathfindingMessaging::sendNodeInfo ( CityPathNode const * node, Client * client ) { - if(node == NULL) return; - if(client == NULL) return; + if(node == nullptr) return; + if(client == nullptr) return; AINodeInfo m; @@ -428,7 +428,7 @@ void ServerPathfindingMessaging::sendNodeInfo ( CityPathNode const * node, Clien void ServerPathfindingMessaging::sendNeighborInfo ( CityPathNode const * node ) { - if(node == NULL) return; + if(node == nullptr) return; for(ClientList::iterator it = m_clientList->begin(); it != m_clientList->end(); ++it) { @@ -440,8 +440,8 @@ void ServerPathfindingMessaging::sendNeighborInfo ( CityPathNode const * node ) void ServerPathfindingMessaging::sendNeighborInfo ( CityPathNode const * node, Client * client ) { - if(node == NULL) return; - if(client == NULL) return; + if(node == nullptr) return; + if(client == nullptr) return; int edgeCount = node->getEdgeCount(); @@ -459,7 +459,7 @@ void ServerPathfindingMessaging::sendNeighborInfo ( CityPathNode const * node, C void ServerPathfindingMessaging::sendEraseNode ( CityPathNode const * node ) { - if(node == NULL) return; + if(node == nullptr) return; for(ClientList::iterator it = m_clientList->begin(); it != m_clientList->end(); ++it) { @@ -471,8 +471,8 @@ void ServerPathfindingMessaging::sendEraseNode ( CityPathNode const * node ) void ServerPathfindingMessaging::sendEraseNode ( CityPathNode const * node, Client * client ) { - if(node == NULL) return; - if(client == NULL) return; + if(node == nullptr) return; + if(client == nullptr) return; AINodeInfo m; @@ -497,7 +497,7 @@ void ServerPathfindingMessaging::sendWaypointInfo ( AiLocation const & loc ) void ServerPathfindingMessaging::sendWaypointInfo ( AiLocation const & loc, Client * client ) { - if(client == NULL) return; + if(client == nullptr) return; AINodeInfo m; @@ -531,7 +531,7 @@ void ServerPathfindingMessaging::sendEraseWaypoint ( AiLocation const & loc ) void ServerPathfindingMessaging::sendEraseWaypoint ( AiLocation const & loc, Client * client ) { - if(client == NULL) return; + if(client == nullptr) return; AINodeInfo m; diff --git a/engine/server/library/serverPathfinding/src/shared/ServerPathfindingNotification.cpp b/engine/server/library/serverPathfinding/src/shared/ServerPathfindingNotification.cpp index d524776c..25f8a676 100755 --- a/engine/server/library/serverPathfinding/src/shared/ServerPathfindingNotification.cpp +++ b/engine/server/library/serverPathfinding/src/shared/ServerPathfindingNotification.cpp @@ -44,7 +44,7 @@ void ServerPathfindingNotification::addToWorld ( Object & object ) const { CityPathGraphManager::addBuilding( building ); } - else if(object.asServerObject() != NULL && object.asServerObject()->isWaypoint()) + else if(object.asServerObject() != nullptr && object.asServerObject()->isWaypoint()) { CityPathGraphManager::addWaypoint( object.asServerObject() ); } @@ -61,7 +61,7 @@ void ServerPathfindingNotification::removeFromWorld ( Object & object ) const { CityPathGraphManager::removeBuilding( building ); } - else if(object.asServerObject() != NULL && object.asServerObject()->isWaypoint()) + else if(object.asServerObject() != nullptr && object.asServerObject()->isWaypoint()) { CityPathGraphManager::removeWaypoint( object.asServerObject() ); } @@ -79,7 +79,7 @@ bool ServerPathfindingNotification::positionChanged ( Object & object, bool /*du { CityPathGraphManager::moveBuilding( building, oldPosition ); } - else if(object.asServerObject() != NULL && object.asServerObject()->isWaypoint()) + else if(object.asServerObject() != nullptr && object.asServerObject()->isWaypoint()) { CityPathGraphManager::moveWaypoint( object.asServerObject(), oldPosition ); } @@ -95,7 +95,7 @@ bool ServerPathfindingNotification::positionAndRotationChanged ( Object & object { CityPathGraphManager::moveBuilding( building, oldPosition ); } - else if(object.asServerObject() != NULL && object.asServerObject()->isWaypoint()) + else if(object.asServerObject() != nullptr && object.asServerObject()->isWaypoint()) { CityPathGraphManager::moveWaypoint( object.asServerObject(), oldPosition ); } diff --git a/engine/server/library/serverScript/src/shared/GameScriptObject.cpp b/engine/server/library/serverScript/src/shared/GameScriptObject.cpp index c93ebbf4..3e8e9396 100755 --- a/engine/server/library/serverScript/src/shared/GameScriptObject.cpp +++ b/engine/server/library/serverScript/src/shared/GameScriptObject.cpp @@ -40,7 +40,7 @@ // class GameScriptObject static members //======================================================================== -GameScriptObject::ScriptDataMap * GameScriptObject::ms_scriptDataMap = NULL; +GameScriptObject::ScriptDataMap * GameScriptObject::ms_scriptDataMap = nullptr; bool GameScriptObject::m_pauseScripting = false; @@ -52,7 +52,7 @@ bool GameScriptObject::m_pauseScripting = false; * Class constructor. */ GameScriptObject::GameScriptObject(void) : - m_owner(NULL), + m_owner(nullptr), m_scriptList(), m_scriptListInitialized(false), m_scriptListValid(false), @@ -69,11 +69,11 @@ GameScriptObject::~GameScriptObject() { { PROFILER_AUTO_BLOCK_DEFINE("GameScriptObject::~GameScriptObject removeJavaId\n"); - if (JavaLibrary::instance() != NULL /*&& m_javaId != NULL*/) + if (JavaLibrary::instance() != nullptr /*&& m_javaId != nullptr*/) { NOT_NULL(m_owner); JavaLibrary::removeJavaId(m_owner->getNetworkId()); -// m_javaId = NULL; +// m_javaId = nullptr; } } @@ -82,7 +82,7 @@ GameScriptObject::~GameScriptObject() removeAll(); } m_scriptList.clear(); - m_owner = NULL; + m_owner = nullptr; } // GameScriptObject::~GameScriptObject /** @@ -92,7 +92,7 @@ GameScriptObject::~GameScriptObject() */ bool GameScriptObject::installScriptEngine(void) { - if (JavaLibrary::instance() != NULL) + if (JavaLibrary::instance() != nullptr) { DEBUG_WARNING(true, ("Trying to install script engine more than once")); return true; @@ -101,7 +101,7 @@ bool GameScriptObject::installScriptEngine(void) ms_scriptDataMap = new GameScriptObject::ScriptDataMap; Scripting::InitScriptFuncHashMap(); JavaLibrary::install(); - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return false; enableNewJediTracking(ConfigServerGame::getEnableNewJedi()); return true; @@ -114,7 +114,7 @@ void GameScriptObject::removeScriptEngine(void) { JavaLibrary::remove(); delete ms_scriptDataMap; - ms_scriptDataMap = NULL; + ms_scriptDataMap = nullptr; Scripting::RemoveScriptFuncHashMap(); } // GameScriptObject::removeScriptEngine @@ -145,10 +145,10 @@ void GameScriptObject::alter(real time) */ void GameScriptObject::setOwnerIsAuthoritative(bool authoritative, uint32 pid) { - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return; - if (m_owner != NULL && m_owner->getNetworkId() != NetworkId::cms_invalid) + if (m_owner != nullptr && m_owner->getNetworkId() != NetworkId::cms_invalid) { JavaLibrary::instance()->setObjIdAuthoritative(m_owner->getNetworkId(), authoritative, pid); @@ -171,9 +171,9 @@ void GameScriptObject::setOwnerIsAuthoritative(bool authoritative, uint32 pid) */ void GameScriptObject::setOwnerIsLoaded(void) { - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return; - if (m_owner != NULL && m_owner->getNetworkId() != NetworkId::cms_invalid) + if (m_owner != nullptr && m_owner->getNetworkId() != NetworkId::cms_invalid) { JavaLibrary::instance()->setObjIdLoaded(m_owner->getNetworkId()); } @@ -189,9 +189,9 @@ void GameScriptObject::setOwnerIsLoaded(void) */ void GameScriptObject::setOwnerIsInitialized(void) { - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return; - if (m_owner != NULL && m_owner->getNetworkId() != NetworkId::cms_invalid) + if (m_owner != nullptr && m_owner->getNetworkId() != NetworkId::cms_invalid) { JavaLibrary::instance()->setObjIdInitialized(m_owner->getNetworkId()); if (m_owner->isAuthoritative()) @@ -211,10 +211,10 @@ void GameScriptObject::setOwnerIsInitialized(void) */ void GameScriptObject::setOwnerDestroyed(void) { - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return; - if (m_owner != NULL && m_owner->getNetworkId() != NetworkId::cms_invalid && m_owner->isAuthoritative()) + if (m_owner != nullptr && m_owner->getNetworkId() != NetworkId::cms_invalid && m_owner->isAuthoritative()) JavaLibrary::flagDestroyed(m_owner->getNetworkId()); } //lint !e1762 Do not make const @@ -283,7 +283,7 @@ int GameScriptObject::attachScript(const std::string& scriptName, bool runTrigge } else { - if (ms_scriptDataMap == NULL || JavaLibrary::instance() == NULL) + if (ms_scriptDataMap == nullptr || JavaLibrary::instance() == nullptr) return SCRIPT_CONTINUE; if (ms_scriptDataMap->find(scriptName) == ms_scriptDataMap->end()) @@ -379,7 +379,7 @@ int GameScriptObject::detachScript(const std::string& scriptName) else { - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return SCRIPT_CONTINUE; // Make sure to call the detach trigger on this one script if one exists. @@ -420,12 +420,12 @@ void GameScriptObject::initScriptInstances() { m_scriptListInitialized = true; - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return; if (!m_owner) { - WARNING_STRICT_FATAL(true, ("Use of null m_owner in ::initScriptInstances()")); + WARNING_STRICT_FATAL(true, ("Use of nullptr m_owner in ::initScriptInstances()")); return; } @@ -454,7 +454,7 @@ void GameScriptObject::initScriptInstances() */ void GameScriptObject::removeAll(void) { - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return; // removeAll() cannot be overriden by scripts @@ -483,12 +483,12 @@ int GameScriptObject::trigAllScripts(Scripting::TrigId trigId, ScriptParams &par { NOT_NULL(m_owner); - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return SCRIPT_CONTINUE; -// if (m_javaId == NULL && m_owner != NULL && m_owner->getNetworkId().getValue() != 0) +// if (m_javaId == nullptr && m_owner != nullptr && m_owner->getNetworkId().getValue() != 0) // { -// if (JavaLibrary::instance() != NULL) +// if (JavaLibrary::instance() != nullptr) // m_javaId = JavaLibrary::getObjId(m_owner->getNetworkId()); // } @@ -497,7 +497,7 @@ int GameScriptObject::trigAllScripts(Scripting::TrigId trigId, ScriptParams &par //Authoritative check temporarily removed because some triggers aren't being called //because the setAuth message hasn't come in yet from Central on load. - if (m_owner == NULL) //@todo FIX THIS HACK || !m_owner->isAuthoritative()) + if (m_owner == nullptr) //@todo FIX THIS HACK || !m_owner->isAuthoritative()) return SCRIPT_CONTINUE; if(!m_owner->isAuthoritative()) @@ -506,7 +506,7 @@ int GameScriptObject::trigAllScripts(Scripting::TrigId trigId, ScriptParams &par Archive::put(paramArchive, params); MessageQueueScriptTrigger * data = new MessageQueueScriptTrigger(static_cast(trigId), paramArchive); ServerController * controller = dynamic_cast(m_owner->getController()); - if(controller != NULL) + if(controller != nullptr) { controller->appendMessage( CM_scriptTrigger, @@ -557,13 +557,13 @@ int GameScriptObject::trigAllScripts(Scripting::TrigId trigId, ScriptParams &par */ int GameScriptObject::trigOneScript(const std::string& scriptName, Scripting::TrigId trigId, ScriptParams ¶ms) const { - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return SCRIPT_CONTINUE; if (m_pauseScripting) return SCRIPT_CONTINUE; - if (m_owner == NULL /*|| !m_owner->isAuthoritative()*/) + if (m_owner == nullptr /*|| !m_owner->isAuthoritative()*/) return SCRIPT_OVERRIDE; if (!m_owner->isAuthoritative() && (trigId != Scripting::TRIG_ATTACH && @@ -607,7 +607,7 @@ int GameScriptObject::trigOneScript(const std::string& scriptName, Scripting::Tr int GameScriptObject::trigScriptFromConsole(const Scripting::TrigId trigId, const std::string &scriptName, const StringVector_t &args) const { - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) { LOG("ScriptInvestigation", ("Returning script continue from console trigger request because there is no JavaLibrary instance\n")); return SCRIPT_CONTINUE; @@ -619,9 +619,9 @@ int GameScriptObject::trigScriptFromConsole(const Scripting::TrigId trigId, return SCRIPT_CONTINUE; } - if (m_owner == NULL ) + if (m_owner == nullptr ) { - LOG("ScriptInvestigation", ("Returning script override from console trigger request becuase m_owner is null\n")); + LOG("ScriptInvestigation", ("Returning script override from console trigger request becuase m_owner is nullptr\n")); return SCRIPT_OVERRIDE; } @@ -660,14 +660,14 @@ int GameScriptObject::trigScriptFromConsole(const Scripting::TrigId trigId, bool GameScriptObject::handleMessage(const std::string &messageName, const ScriptDictionaryPtr & data) { - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) { WARNING_STRICT_FATAL(true, ("(messageToFailure) GameScriptObject::handleMessage got message " "when Java not running")); return true; } - if (getOwner() == NULL) + if (getOwner() == nullptr) { WARNING_STRICT_FATAL(true, ("(messageToFailure) GameScriptObject::handleMessage got message " "with no owner")); @@ -703,7 +703,7 @@ bool GameScriptObject::handleMessage(const std::string &messageName, const std:: { ScriptDictionaryPtr dictionary; - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return true; if (m_pauseScripting) @@ -733,7 +733,7 @@ bool GameScriptObject::handleMessage(const std::string &messageName, const std:: */ int GameScriptObject::callScriptCommandHandler(std::string const &funcName, ScriptParams ¶ms) const { - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return SCRIPT_CONTINUE; if (m_pauseScripting) @@ -757,7 +757,7 @@ int GameScriptObject::callScriptCommandHandler(std::string const &funcName, Scri */ int GameScriptObject::callScriptBuffHandler(std::string const &funcName, ScriptParams ¶ms) const { - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return SCRIPT_CONTINUE; if (m_pauseScripting) @@ -825,7 +825,7 @@ void GameScriptObject::enumerateScripts(std::vector &scriptNames) c */ void GameScriptObject::makeScriptDictionary(const ScriptParams & params, ScriptDictionaryPtr & dictionary) { - if (JavaLibrary::instance() != NULL) + if (JavaLibrary::instance() != nullptr) { JavaDictionaryPtr jdp; JavaLibrary::instance()->convert(params, jdp); @@ -840,7 +840,7 @@ void GameScriptObject::makeScriptDictionary(const ScriptParams & params, ScriptD */ bool GameScriptObject::isScriptingEnabled(void) { - if (JavaLibrary::instance() != NULL) + if (JavaLibrary::instance() != nullptr) return true; return false; } // GameScriptObject::isScriptingEnabled @@ -854,7 +854,7 @@ bool GameScriptObject::isScriptingEnabled(void) */ bool GameScriptObject::reloadScript(const std::string& scriptName) { - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return false; @@ -904,7 +904,7 @@ bool GameScriptObject::reloadScript(const std::string& scriptName) */ void GameScriptObject::enableLogging(bool enable) { - if (JavaLibrary::instance() != NULL) + if (JavaLibrary::instance() != nullptr) JavaLibrary::instance()->enableLogging(enable); } // GameScriptObject::enableLogging @@ -917,7 +917,7 @@ void GameScriptObject::enableLogging(bool enable) */ void GameScriptObject::enableNewJediTracking(bool enableTracking) { - if (JavaLibrary::instance() != NULL) + if (JavaLibrary::instance() != nullptr) JavaLibrary::instance()->enableNewJediTracking(enableTracking); } // GameScriptObject::enableNewJediTracking @@ -946,7 +946,7 @@ Scheduler & GameScriptObject::getScriptScheduler() void GameScriptObject::onStopWatching(ServerObject & subject) { - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return; if (m_owner) @@ -959,7 +959,7 @@ void GameScriptObject::onStopWatching(ServerObject & subject) void GameScriptObject::onWatching(ServerObject & subject) { - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return; if (m_owner) @@ -972,7 +972,7 @@ void GameScriptObject::onWatching(ServerObject & subject) void GameScriptObject::runOneScript(const std::string & scriptName, const std::string & methodName, const std::string & argTypes, ScriptParams & args) { - if (JavaLibrary::instance() != NULL) + if (JavaLibrary::instance() != nullptr) IGNORE_RETURN( JavaLibrary::instance()->runScript(NetworkId(), scriptName, methodName, argTypes, args) ); } @@ -994,7 +994,7 @@ std::string GameScriptObject::callScriptConsoleHandler(const std::string & scrip { static const std::string errorReturnString; - if (JavaLibrary::instance() != NULL) + if (JavaLibrary::instance() != nullptr) { return JavaLibrary::instance()->callScriptConsoleHandler(scriptName, methodName, argTypes, args); } @@ -1019,7 +1019,7 @@ void GameScriptObject::callSpaceClearOvert(const NetworkId &ship) std::string GameScriptObject::callDumpTargetInfo( NetworkId &id ) { - if( JavaLibrary::instance() != NULL ) + if( JavaLibrary::instance() != nullptr ) { return JavaLibrary::instance()->getObjectDumpInfo( id ); } @@ -1030,7 +1030,7 @@ std::string GameScriptObject::callDumpTargetInfo( NetworkId &id ) void GameScriptObject::setScriptVar(const std::string & name, int value) { - if (JavaLibrary::instance() == NULL || m_owner == NULL) + if (JavaLibrary::instance() == nullptr || m_owner == nullptr) return; JavaLibrary::setScriptVar(*m_owner, name, value); @@ -1040,7 +1040,7 @@ void GameScriptObject::setScriptVar(const std::string & name, int value) void GameScriptObject::setScriptVar(const std::string & name, float value) { - if (JavaLibrary::instance() == NULL || m_owner == NULL) + if (JavaLibrary::instance() == nullptr || m_owner == nullptr) return; JavaLibrary::setScriptVar(*m_owner, name, value); @@ -1050,7 +1050,7 @@ void GameScriptObject::setScriptVar(const std::string & name, float value) void GameScriptObject::setScriptVar(const std::string & name, const std::string & value) { - if (JavaLibrary::instance() == NULL || m_owner == NULL) + if (JavaLibrary::instance() == nullptr || m_owner == nullptr) return; JavaLibrary::setScriptVar(*m_owner, name, value); @@ -1060,7 +1060,7 @@ void GameScriptObject::setScriptVar(const std::string & name, const std::string void GameScriptObject::packAllScriptVarDeltas() { - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return; JavaLibrary::packAllDeltaScriptVars(); @@ -1070,7 +1070,7 @@ void GameScriptObject::packAllScriptVarDeltas() void GameScriptObject::clearScriptVars() { - if (JavaLibrary::instance() == NULL || m_owner == NULL) + if (JavaLibrary::instance() == nullptr || m_owner == nullptr) return; JavaLibrary::clearScriptVars(*m_owner); @@ -1080,7 +1080,7 @@ void GameScriptObject::clearScriptVars() void GameScriptObject::packScriptVars(std::vector & target) const { - if (JavaLibrary::instance() == NULL || m_owner == NULL) + if (JavaLibrary::instance() == nullptr || m_owner == nullptr) return; JavaLibrary::packScriptVars(*m_owner, target); @@ -1090,7 +1090,7 @@ void GameScriptObject::packScriptVars(std::vector & target) const void GameScriptObject::unpackScriptVars(const std::vector & source) const { - if (JavaLibrary::instance() == NULL || m_owner == NULL) + if (JavaLibrary::instance() == nullptr || m_owner == nullptr) return; JavaLibrary::unpackScriptVars(*m_owner, source); @@ -1100,7 +1100,7 @@ void GameScriptObject::unpackScriptVars(const std::vector & source) const void GameScriptObject::unpackDeltaScriptVars(const std::vector & data) const { - if (JavaLibrary::instance() == NULL || m_owner == NULL) + if (JavaLibrary::instance() == nullptr || m_owner == nullptr) return; DEBUG_REPORT_LOG(! m_owner, ("A game script object received a request to unpack script var synchronization data, but it has no owner object!!! All GameScriptObjects MUST have owners!\n")); @@ -1238,18 +1238,18 @@ namespace Archive GameScriptObject * GameScriptObject::asGameScriptObject(Object * const object) { - ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - return (serverObject != NULL) ? serverObject->getScriptObject() : NULL; + return (serverObject != nullptr) ? serverObject->getScriptObject() : nullptr; } // ---------------------------------------------------------------------- GameScriptObject const * GameScriptObject::asGameScriptObject(Object const * const object) { - ServerObject const * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + ServerObject const * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - return (serverObject != NULL) ? serverObject->getScriptObject() : NULL; + return (serverObject != nullptr) ? serverObject->getScriptObject() : nullptr; } // ====================================================================== diff --git a/engine/server/library/serverScript/src/shared/JNIWrappers.cpp b/engine/server/library/serverScript/src/shared/JNIWrappers.cpp index d4746415..d958183a 100755 --- a/engine/server/library/serverScript/src/shared/JNIWrappers.cpp +++ b/engine/server/library/serverScript/src/shared/JNIWrappers.cpp @@ -90,7 +90,7 @@ LocalRefPtr createNewObject(jclass clazz, jmethodID constructorID, ...) JavaStringPtr createNewString(const char * bytes) { - if (bytes != NULL) + if (bytes != nullptr) { JavaStringPtr result(new JavaString(JavaLibrary::getEnv()->NewStringUTF(bytes))); if (result->getValue() != 0) @@ -103,7 +103,7 @@ JavaStringPtr createNewString(const char * bytes) JavaStringPtr createNewString(const jchar * unicodeChars, jsize len) { - if (unicodeChars != NULL && len >= 0) + if (unicodeChars != nullptr && len >= 0) { JavaStringPtr result(new JavaString(JavaLibrary::getEnv()->NewString(unicodeChars, len))); if (result->getValue() != 0) @@ -902,7 +902,7 @@ LocalRef::LocalRef(jobject src) : LocalRef::~LocalRef() { - if (m_ref != 0 && JavaLibrary::getEnv() != NULL) + if (m_ref != 0 && JavaLibrary::getEnv() != nullptr) JavaLibrary::getEnv()->DeleteLocalRef(m_ref); m_ref = 0; } @@ -917,7 +917,7 @@ LocalArrayRef::LocalArrayRef(jarray src) : LocalArrayRef::~LocalArrayRef() { - if (m_ref != 0 && JavaLibrary::getEnv() != NULL) + if (m_ref != 0 && JavaLibrary::getEnv() != nullptr) JavaLibrary::getEnv()->DeleteLocalRef(m_ref); m_ref = 0; } @@ -932,7 +932,7 @@ LocalObjectArrayRef::LocalObjectArrayRef(jobjectArray src) : LocalObjectArrayRef::~LocalObjectArrayRef() { - if (m_ref != 0 && JavaLibrary::getEnv() != NULL) + if (m_ref != 0 && JavaLibrary::getEnv() != nullptr) JavaLibrary::getEnv()->DeleteLocalRef(m_ref); m_ref = 0; } @@ -1002,13 +1002,13 @@ LocalLongArrayRef::~LocalLongArrayRef() GlobalRef::GlobalRef(const LocalRefParam & src) : LocalRefParam(static_cast(0)) { - if (src.getValue() != 0 && JavaLibrary::getEnv() != NULL) + if (src.getValue() != 0 && JavaLibrary::getEnv() != nullptr) m_ref = JavaLibrary::getEnv()->NewGlobalRef(src.getValue()); } GlobalRef::~GlobalRef() { - if (m_ref != 0 && JavaLibrary::getEnv() != NULL) + if (m_ref != 0 && JavaLibrary::getEnv() != nullptr) JavaLibrary::getEnv()->DeleteGlobalRef(m_ref); m_ref = 0; } @@ -1019,13 +1019,13 @@ GlobalRef::~GlobalRef() GlobalArrayRef::GlobalArrayRef(const LocalObjectArrayRefParam & src) : LocalObjectArrayRefParam(static_cast(0)) { - if (src.getValue() != 0 && JavaLibrary::getEnv() != NULL) + if (src.getValue() != 0 && JavaLibrary::getEnv() != nullptr) m_ref = JavaLibrary::getEnv()->NewGlobalRef(src.getValue()); } GlobalArrayRef::~GlobalArrayRef() { - if (m_ref != 0 && JavaLibrary::getEnv() != NULL) + if (m_ref != 0 && JavaLibrary::getEnv() != nullptr) JavaLibrary::getEnv()->DeleteGlobalRef(m_ref); m_ref = 0; } @@ -1048,10 +1048,10 @@ JavaStringParam::~JavaStringParam() int JavaStringParam::fillBuffer(char * buffer, int size) const { - if (m_ref != 0 && buffer != NULL && JavaLibrary::getEnv() != NULL) + if (m_ref != 0 && buffer != nullptr && JavaLibrary::getEnv() != nullptr) { // Get the number of storage bytes required to convert this Java string into a UTF-8 string. - // Include the terminating null byte in the required buffer size. + // Include the terminating nullptr byte in the required buffer size. int requiredBufferSize = JavaLibrary::getEnv()->GetStringUTFLength(static_cast(m_ref)) + 1; if (requiredBufferSize <= size) { @@ -1059,7 +1059,7 @@ int JavaStringParam::fillBuffer(char * buffer, int size) const JavaLibrary::getEnv()->GetStringUTFRegion(static_cast(m_ref), 0, stringLength, buffer); - // Null terminate the string. requiredBufferSize already includes the byte count for the null terminator. + // Null terminate the string. requiredBufferSize already includes the byte count for the nullptr terminator. buffer[requiredBufferSize - 1] = '\0'; return requiredBufferSize; @@ -1077,7 +1077,7 @@ JavaString::JavaString(jstring src) : } JavaString::JavaString(const char * src) : - JavaStringParam(JavaLibrary::getEnv()->NewStringUTF(src != NULL ? src : "")) + JavaStringParam(JavaLibrary::getEnv()->NewStringUTF(src != nullptr ? src : "")) { } @@ -1093,7 +1093,7 @@ JavaString::JavaString(const Unicode::String & src) : JavaString::~JavaString() { - if (m_ref != 0 && JavaLibrary::getEnv() != NULL) + if (m_ref != 0 && JavaLibrary::getEnv() != nullptr) JavaLibrary::getEnv()->DeleteLocalRef(m_ref); m_ref = 0; } diff --git a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp index 39dfced2..0cbc73ac 100755 --- a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp +++ b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp @@ -70,7 +70,7 @@ using namespace JNIWrappersNamespace; #define GET_METHOD(var, clazz, name, sig) var = ms_env->GetMethodID(clazz, name, sig); if (ms_env->ExceptionCheck()) { ms_env->ExceptionDescribe(); WARNING(true, ("Unable to find Java method "#name" for class "#clazz)); return false; } #define GET_STATIC_METHOD(var, clazz, name, sig) var = ms_env->GetStaticMethodID(clazz, name, sig); if (ms_env->ExceptionCheck()) { ms_env->ExceptionDescribe(); WARNING(true, ("Unable to find Java static method "#name" for class "#clazz)); return false; } -#define FREE_CLASS(var) if (ms_env != NULL && var != NULL) { ms_env->DeleteGlobalRef(var); var = NULL; } +#define FREE_CLASS(var) if (ms_env != nullptr && var != nullptr) { ms_env->DeleteGlobalRef(var); var = nullptr; } //======================================================================== // local constants @@ -377,203 +377,203 @@ namespace ScriptMethodsWorldInfoNamespace // class JavaLibrary static members //======================================================================== -JavaLibrary* JavaLibrary::ms_instance = NULL; +JavaLibrary* JavaLibrary::ms_instance = nullptr; int JavaLibrary::ms_javaVmType = JV_none; -//void* JavaLibrary::ms_libHandle = NULL; -JavaVM* JavaLibrary::ms_jvm = NULL; -JNIEnv* JavaLibrary::ms_env = NULL; -Thread * JavaLibrary::m_initializerThread = NULL; +//void* JavaLibrary::ms_libHandle = nullptr; +JavaVM* JavaLibrary::ms_jvm = nullptr; +JNIEnv* JavaLibrary::ms_env = nullptr; +Thread * JavaLibrary::m_initializerThread = nullptr; int JavaLibrary::ms_envCount = 0; int JavaLibrary::ms_currentRecursionCount = 0; bool JavaLibrary::ms_resetJava = false; -jclass JavaLibrary::ms_clsScriptEntry = NULL; -jobject JavaLibrary::ms_scriptEntry = NULL; -jmethodID JavaLibrary::ms_midScriptEntryGetOwnerContext = NULL; -jmethodID JavaLibrary::ms_midScriptEntryEnableLogging = NULL; -jmethodID JavaLibrary::ms_midScriptEntryEnableNewJediTracking = NULL; -jmethodID JavaLibrary::ms_midScriptEntryGetFreeMem = NULL; -jclass JavaLibrary::ms_clsObject = NULL; -jclass JavaLibrary::ms_clsClass = NULL; -jmethodID JavaLibrary::ms_midClassGetName = NULL; -jmethodID JavaLibrary::ms_midClassGetMethods = NULL; -jclass JavaLibrary::ms_clsMethod = NULL; -jmethodID JavaLibrary::ms_midMethodGetName = NULL; -jclass JavaLibrary::ms_clsBoolean = NULL; -jclass JavaLibrary::ms_clsBooleanArray = NULL; -jmethodID JavaLibrary::ms_midBoolean = NULL; -jmethodID JavaLibrary::ms_midBooleanBooleanValue = NULL; -jclass JavaLibrary::ms_clsInteger = NULL; -jclass JavaLibrary::ms_clsIntegerArray = NULL; -jmethodID JavaLibrary::ms_midInteger = NULL; -jmethodID JavaLibrary::ms_midIntegerIntValue = NULL; -jclass JavaLibrary::ms_clsModifiableInt = NULL; -jmethodID JavaLibrary::ms_midModifiableInt = NULL; -jfieldID JavaLibrary::ms_fidModifiableIntData = NULL; -jclass JavaLibrary::ms_clsFloat = NULL; -jclass JavaLibrary::ms_clsFloatArray = NULL; -jmethodID JavaLibrary::ms_midFloat = NULL; -jmethodID JavaLibrary::ms_midFloatFloatValue = NULL; -jclass JavaLibrary::ms_clsModifiableFloat = NULL; -jmethodID JavaLibrary::ms_midModifiableFloat = NULL; -jfieldID JavaLibrary::ms_fidModifiableFloatData = NULL; -jclass JavaLibrary::ms_clsString = NULL; -jclass JavaLibrary::ms_clsStringArray = NULL; -jclass JavaLibrary::ms_clsMap = NULL; -jmethodID JavaLibrary::ms_midMapPut = NULL; -jmethodID JavaLibrary::ms_midMapGet = NULL; -jclass JavaLibrary::ms_clsHashtable = NULL; -jmethodID JavaLibrary::ms_midHashtable = NULL; -jclass JavaLibrary::ms_clsThrowable = NULL; -jclass JavaLibrary::ms_clsError = NULL; -jclass JavaLibrary::ms_clsStackOverflowError = NULL; -jmethodID JavaLibrary::ms_midThrowableGetMessage = NULL; -jclass JavaLibrary::ms_clsThread = NULL; -jmethodID JavaLibrary::ms_midThreadDumpStack = NULL; -jclass JavaLibrary::ms_clsInternalScriptError = NULL; -jclass JavaLibrary::ms_clsInternalScriptSeriousError = NULL; -jfieldID JavaLibrary::ms_fidInternalScriptSeriousErrorError = NULL; -jclass JavaLibrary::ms_clsDictionary = NULL; -jmethodID JavaLibrary::ms_midDictionary = NULL; -jmethodID JavaLibrary::ms_midDictionaryPack = NULL; -jmethodID JavaLibrary::ms_midDictionaryUnpack = NULL; -jmethodID JavaLibrary::ms_midDictionaryKeys = NULL; -jmethodID JavaLibrary::ms_midDictionaryValues = NULL; -jmethodID JavaLibrary::ms_midDictionaryPut = NULL; -jmethodID JavaLibrary::ms_midDictionaryPutInt = NULL; -jmethodID JavaLibrary::ms_midDictionaryPutFloat = NULL; -jmethodID JavaLibrary::ms_midDictionaryPutBool = NULL; -jmethodID JavaLibrary::ms_midDictionaryGet = NULL; -jclass JavaLibrary::ms_clsCollection = NULL; -jmethodID JavaLibrary::ms_midCollectionToArray = NULL; -jclass JavaLibrary::ms_clsEnumeration = NULL; -jmethodID JavaLibrary::ms_midEnumerationHasMoreElements = NULL; -jmethodID JavaLibrary::ms_midEnumerationNextElement = NULL; -jclass JavaLibrary::ms_clsBaseClassRangeInfo = NULL; -jfieldID JavaLibrary::ms_fidBaseClassRangeInfoMinRange = NULL; -jfieldID JavaLibrary::ms_fidBaseClassRangeInfoMaxRange = NULL; -jclass JavaLibrary::ms_clsBaseClassAttackerResults = NULL; -jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsId = NULL; -jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsWeapon = NULL; -jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsPosture = NULL; -jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsTrailBits = NULL; -jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsClientEffectId = NULL; -jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsActionName = NULL; -jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsUseLocation = NULL; -jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsTargetLocation = NULL; -jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsTargetCell = NULL; -jclass JavaLibrary::ms_clsBaseClassDefenderResults = NULL; -jfieldID JavaLibrary::ms_fidBaseClassDefenderResultsId = NULL; -jfieldID JavaLibrary::ms_fidBaseClassDefenderResultsPosture = NULL; -jfieldID JavaLibrary::ms_fidBaseClassDefenderResultsResult = NULL; -jfieldID JavaLibrary::ms_fidBaseClassDefenderResultsClientEffectId = NULL; -jfieldID JavaLibrary::ms_fidBaseClassDefenderResultsHitLocation = NULL; -jfieldID JavaLibrary::ms_fidBaseClassDefenderDamageAmount = NULL; -jclass JavaLibrary::ms_clsDynamicVariable = NULL; -jfieldID JavaLibrary::ms_fidDynamicVariableName = NULL; -jfieldID JavaLibrary::ms_fidDynamicVariableData = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableInt = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableIntArray = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableFloat = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableFloatArray = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableString = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableStringArray = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableObjId = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableObjIdArray = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableLocation = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableLocationArray = NULL; -jclass JavaLibrary::ms_clsDynamicVariableList = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableList = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSet = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSetInt = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSetIntArray = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSetFloat = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSetFloatArray = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSetString = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSetStringArray = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSetObjId = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSetObjIdArray = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSetLocation = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSetLocationArray = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSetStringId = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSetStringIdArray = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSetTransform = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSetTransformArray = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSetVector = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSetVectorArray = NULL; -jclass JavaLibrary::ms_clsObjId = NULL; -jclass JavaLibrary::ms_clsObjIdArray = NULL; -jmethodID JavaLibrary::ms_midObjIdGetValue = NULL; -jmethodID JavaLibrary::ms_midObjIdGetObjId = NULL; -jmethodID JavaLibrary::ms_midObjIdClearObjId = NULL; -jmethodID JavaLibrary::ms_midObjIdFlagDestroyed = NULL; -jmethodID JavaLibrary::ms_midObjIdSetAuthoritative = NULL; -jmethodID JavaLibrary::ms_midObjIdSetLoaded = NULL; -jmethodID JavaLibrary::ms_midObjIdSetInitialized = NULL; -jmethodID JavaLibrary::ms_midObjIdSetLoggedIn = NULL; -jmethodID JavaLibrary::ms_midObjIdPackAllDeltaScriptVars = NULL; -jmethodID JavaLibrary::ms_midObjIdSetScriptVarInt = NULL; -jmethodID JavaLibrary::ms_midObjIdSetScriptVarFloat = NULL; -jmethodID JavaLibrary::ms_midObjIdSetScriptVarString = NULL; -jmethodID JavaLibrary::ms_midObjIdClearScriptVars = NULL; -jmethodID JavaLibrary::ms_midObjIdPackScriptVars = NULL; -jmethodID JavaLibrary::ms_midObjIdUnpackDeltaScriptVars = NULL; -jmethodID JavaLibrary::ms_midObjIdUnpackScriptVars = NULL; -jmethodID JavaLibrary::ms_midObjIdAttachScript = NULL; -jmethodID JavaLibrary::ms_midObjIdAttachScripts = NULL; -jmethodID JavaLibrary::ms_midObjIdDetachScript = NULL; -jmethodID JavaLibrary::ms_midObjIdDetachAllScripts = NULL; -jclass JavaLibrary::ms_clsStringId = NULL; -jmethodID JavaLibrary::ms_midStringId = NULL; -jclass JavaLibrary::ms_clsStringIdArray = NULL; -jfieldID JavaLibrary::ms_fidStringIdTable = NULL; -jfieldID JavaLibrary::ms_fidStringIdAsciiId = NULL; -jfieldID JavaLibrary::ms_fidStringIdIndexId = NULL; -jclass JavaLibrary::ms_clsModifiableStringId = NULL; -jclass JavaLibrary::ms_clsAttribute = NULL; -jmethodID JavaLibrary::ms_midAttribute = NULL; -jfieldID JavaLibrary::ms_fidAttributeType = NULL; -jfieldID JavaLibrary::ms_fidAttributeValue = NULL; -jclass JavaLibrary::ms_clsAttribMod = NULL; -jmethodID JavaLibrary::ms_midAttribMod = NULL; -jfieldID JavaLibrary::ms_fidAttribModName = NULL; -jfieldID JavaLibrary::ms_fidAttribModSkill = NULL; -jfieldID JavaLibrary::ms_fidAttribModType = NULL; -jfieldID JavaLibrary::ms_fidAttribModValue = NULL; -jfieldID JavaLibrary::ms_fidAttribModTime = NULL; -jfieldID JavaLibrary::ms_fidAttribModAttack = NULL; -jfieldID JavaLibrary::ms_fidAttribModDecay = NULL; -jfieldID JavaLibrary::ms_fidAttribModFlags = NULL; -jclass JavaLibrary::ms_clsMentalState = NULL; -jmethodID JavaLibrary::ms_midMentalState = NULL; -jfieldID JavaLibrary::ms_fidMentalStateType = NULL; -jfieldID JavaLibrary::ms_fidMentalStateValue = NULL; -jclass JavaLibrary::ms_clsMentalStateMod = NULL; -jmethodID JavaLibrary::ms_midMentalStateMod = NULL; -jfieldID JavaLibrary::ms_fidMentalStateModType = NULL; -jfieldID JavaLibrary::ms_fidMentalStateModValue = NULL; -jfieldID JavaLibrary::ms_fidMentalStateModTime = NULL; -jfieldID JavaLibrary::ms_fidMentalStateModAttack = NULL; -jfieldID JavaLibrary::ms_fidMentalStateModDecay = NULL; -jclass JavaLibrary::ms_clsLocation = NULL; -jclass JavaLibrary::ms_clsLocationArray = NULL; -jfieldID JavaLibrary::ms_fidLocationX = NULL; -jfieldID JavaLibrary::ms_fidLocationY = NULL; -jfieldID JavaLibrary::ms_fidLocationZ = NULL; -jfieldID JavaLibrary::ms_fidLocationArea = NULL; -jfieldID JavaLibrary::ms_fidLocationCell = NULL; -jmethodID JavaLibrary::ms_midRunOne = NULL; -jmethodID JavaLibrary::ms_midRunAll = NULL; -jmethodID JavaLibrary::ms_midCallMessages = NULL; -jmethodID JavaLibrary::ms_midRunConsoleHandler = NULL; -jmethodID JavaLibrary::ms_midUnload = NULL; -jmethodID JavaLibrary::ms_midGetClass = NULL; -jmethodID JavaLibrary::ms_midGetScriptFunctions = NULL; -jclass JavaLibrary::ms_clsMenuInfo = NULL; -jmethodID JavaLibrary::ms_midMenuInfo = NULL; -jmethodID JavaLibrary::ms_midMenuInfoSetMenuItemsInternal = NULL; -jmethodID JavaLibrary::ms_midMenuInfoGetMenuItemsInternal = NULL; -jclass JavaLibrary::ms_clsMenuInfoData = NULL; -jmethodID JavaLibrary::ms_midMenuInfoData = NULL; +jclass JavaLibrary::ms_clsScriptEntry = nullptr; +jobject JavaLibrary::ms_scriptEntry = nullptr; +jmethodID JavaLibrary::ms_midScriptEntryGetOwnerContext = nullptr; +jmethodID JavaLibrary::ms_midScriptEntryEnableLogging = nullptr; +jmethodID JavaLibrary::ms_midScriptEntryEnableNewJediTracking = nullptr; +jmethodID JavaLibrary::ms_midScriptEntryGetFreeMem = nullptr; +jclass JavaLibrary::ms_clsObject = nullptr; +jclass JavaLibrary::ms_clsClass = nullptr; +jmethodID JavaLibrary::ms_midClassGetName = nullptr; +jmethodID JavaLibrary::ms_midClassGetMethods = nullptr; +jclass JavaLibrary::ms_clsMethod = nullptr; +jmethodID JavaLibrary::ms_midMethodGetName = nullptr; +jclass JavaLibrary::ms_clsBoolean = nullptr; +jclass JavaLibrary::ms_clsBooleanArray = nullptr; +jmethodID JavaLibrary::ms_midBoolean = nullptr; +jmethodID JavaLibrary::ms_midBooleanBooleanValue = nullptr; +jclass JavaLibrary::ms_clsInteger = nullptr; +jclass JavaLibrary::ms_clsIntegerArray = nullptr; +jmethodID JavaLibrary::ms_midInteger = nullptr; +jmethodID JavaLibrary::ms_midIntegerIntValue = nullptr; +jclass JavaLibrary::ms_clsModifiableInt = nullptr; +jmethodID JavaLibrary::ms_midModifiableInt = nullptr; +jfieldID JavaLibrary::ms_fidModifiableIntData = nullptr; +jclass JavaLibrary::ms_clsFloat = nullptr; +jclass JavaLibrary::ms_clsFloatArray = nullptr; +jmethodID JavaLibrary::ms_midFloat = nullptr; +jmethodID JavaLibrary::ms_midFloatFloatValue = nullptr; +jclass JavaLibrary::ms_clsModifiableFloat = nullptr; +jmethodID JavaLibrary::ms_midModifiableFloat = nullptr; +jfieldID JavaLibrary::ms_fidModifiableFloatData = nullptr; +jclass JavaLibrary::ms_clsString = nullptr; +jclass JavaLibrary::ms_clsStringArray = nullptr; +jclass JavaLibrary::ms_clsMap = nullptr; +jmethodID JavaLibrary::ms_midMapPut = nullptr; +jmethodID JavaLibrary::ms_midMapGet = nullptr; +jclass JavaLibrary::ms_clsHashtable = nullptr; +jmethodID JavaLibrary::ms_midHashtable = nullptr; +jclass JavaLibrary::ms_clsThrowable = nullptr; +jclass JavaLibrary::ms_clsError = nullptr; +jclass JavaLibrary::ms_clsStackOverflowError = nullptr; +jmethodID JavaLibrary::ms_midThrowableGetMessage = nullptr; +jclass JavaLibrary::ms_clsThread = nullptr; +jmethodID JavaLibrary::ms_midThreadDumpStack = nullptr; +jclass JavaLibrary::ms_clsInternalScriptError = nullptr; +jclass JavaLibrary::ms_clsInternalScriptSeriousError = nullptr; +jfieldID JavaLibrary::ms_fidInternalScriptSeriousErrorError = nullptr; +jclass JavaLibrary::ms_clsDictionary = nullptr; +jmethodID JavaLibrary::ms_midDictionary = nullptr; +jmethodID JavaLibrary::ms_midDictionaryPack = nullptr; +jmethodID JavaLibrary::ms_midDictionaryUnpack = nullptr; +jmethodID JavaLibrary::ms_midDictionaryKeys = nullptr; +jmethodID JavaLibrary::ms_midDictionaryValues = nullptr; +jmethodID JavaLibrary::ms_midDictionaryPut = nullptr; +jmethodID JavaLibrary::ms_midDictionaryPutInt = nullptr; +jmethodID JavaLibrary::ms_midDictionaryPutFloat = nullptr; +jmethodID JavaLibrary::ms_midDictionaryPutBool = nullptr; +jmethodID JavaLibrary::ms_midDictionaryGet = nullptr; +jclass JavaLibrary::ms_clsCollection = nullptr; +jmethodID JavaLibrary::ms_midCollectionToArray = nullptr; +jclass JavaLibrary::ms_clsEnumeration = nullptr; +jmethodID JavaLibrary::ms_midEnumerationHasMoreElements = nullptr; +jmethodID JavaLibrary::ms_midEnumerationNextElement = nullptr; +jclass JavaLibrary::ms_clsBaseClassRangeInfo = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassRangeInfoMinRange = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassRangeInfoMaxRange = nullptr; +jclass JavaLibrary::ms_clsBaseClassAttackerResults = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsId = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsWeapon = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsPosture = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsTrailBits = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsClientEffectId = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsActionName = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsUseLocation = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsTargetLocation = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsTargetCell = nullptr; +jclass JavaLibrary::ms_clsBaseClassDefenderResults = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassDefenderResultsId = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassDefenderResultsPosture = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassDefenderResultsResult = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassDefenderResultsClientEffectId = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassDefenderResultsHitLocation = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassDefenderDamageAmount = nullptr; +jclass JavaLibrary::ms_clsDynamicVariable = nullptr; +jfieldID JavaLibrary::ms_fidDynamicVariableName = nullptr; +jfieldID JavaLibrary::ms_fidDynamicVariableData = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableInt = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableIntArray = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableFloat = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableFloatArray = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableString = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableStringArray = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableObjId = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableObjIdArray = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableLocation = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableLocationArray = nullptr; +jclass JavaLibrary::ms_clsDynamicVariableList = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableList = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSet = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSetInt = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSetIntArray = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSetFloat = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSetFloatArray = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSetString = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSetStringArray = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSetObjId = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSetObjIdArray = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSetLocation = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSetLocationArray = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSetStringId = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSetStringIdArray = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSetTransform = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSetTransformArray = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSetVector = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSetVectorArray = nullptr; +jclass JavaLibrary::ms_clsObjId = nullptr; +jclass JavaLibrary::ms_clsObjIdArray = nullptr; +jmethodID JavaLibrary::ms_midObjIdGetValue = nullptr; +jmethodID JavaLibrary::ms_midObjIdGetObjId = nullptr; +jmethodID JavaLibrary::ms_midObjIdClearObjId = nullptr; +jmethodID JavaLibrary::ms_midObjIdFlagDestroyed = nullptr; +jmethodID JavaLibrary::ms_midObjIdSetAuthoritative = nullptr; +jmethodID JavaLibrary::ms_midObjIdSetLoaded = nullptr; +jmethodID JavaLibrary::ms_midObjIdSetInitialized = nullptr; +jmethodID JavaLibrary::ms_midObjIdSetLoggedIn = nullptr; +jmethodID JavaLibrary::ms_midObjIdPackAllDeltaScriptVars = nullptr; +jmethodID JavaLibrary::ms_midObjIdSetScriptVarInt = nullptr; +jmethodID JavaLibrary::ms_midObjIdSetScriptVarFloat = nullptr; +jmethodID JavaLibrary::ms_midObjIdSetScriptVarString = nullptr; +jmethodID JavaLibrary::ms_midObjIdClearScriptVars = nullptr; +jmethodID JavaLibrary::ms_midObjIdPackScriptVars = nullptr; +jmethodID JavaLibrary::ms_midObjIdUnpackDeltaScriptVars = nullptr; +jmethodID JavaLibrary::ms_midObjIdUnpackScriptVars = nullptr; +jmethodID JavaLibrary::ms_midObjIdAttachScript = nullptr; +jmethodID JavaLibrary::ms_midObjIdAttachScripts = nullptr; +jmethodID JavaLibrary::ms_midObjIdDetachScript = nullptr; +jmethodID JavaLibrary::ms_midObjIdDetachAllScripts = nullptr; +jclass JavaLibrary::ms_clsStringId = nullptr; +jmethodID JavaLibrary::ms_midStringId = nullptr; +jclass JavaLibrary::ms_clsStringIdArray = nullptr; +jfieldID JavaLibrary::ms_fidStringIdTable = nullptr; +jfieldID JavaLibrary::ms_fidStringIdAsciiId = nullptr; +jfieldID JavaLibrary::ms_fidStringIdIndexId = nullptr; +jclass JavaLibrary::ms_clsModifiableStringId = nullptr; +jclass JavaLibrary::ms_clsAttribute = nullptr; +jmethodID JavaLibrary::ms_midAttribute = nullptr; +jfieldID JavaLibrary::ms_fidAttributeType = nullptr; +jfieldID JavaLibrary::ms_fidAttributeValue = nullptr; +jclass JavaLibrary::ms_clsAttribMod = nullptr; +jmethodID JavaLibrary::ms_midAttribMod = nullptr; +jfieldID JavaLibrary::ms_fidAttribModName = nullptr; +jfieldID JavaLibrary::ms_fidAttribModSkill = nullptr; +jfieldID JavaLibrary::ms_fidAttribModType = nullptr; +jfieldID JavaLibrary::ms_fidAttribModValue = nullptr; +jfieldID JavaLibrary::ms_fidAttribModTime = nullptr; +jfieldID JavaLibrary::ms_fidAttribModAttack = nullptr; +jfieldID JavaLibrary::ms_fidAttribModDecay = nullptr; +jfieldID JavaLibrary::ms_fidAttribModFlags = nullptr; +jclass JavaLibrary::ms_clsMentalState = nullptr; +jmethodID JavaLibrary::ms_midMentalState = nullptr; +jfieldID JavaLibrary::ms_fidMentalStateType = nullptr; +jfieldID JavaLibrary::ms_fidMentalStateValue = nullptr; +jclass JavaLibrary::ms_clsMentalStateMod = nullptr; +jmethodID JavaLibrary::ms_midMentalStateMod = nullptr; +jfieldID JavaLibrary::ms_fidMentalStateModType = nullptr; +jfieldID JavaLibrary::ms_fidMentalStateModValue = nullptr; +jfieldID JavaLibrary::ms_fidMentalStateModTime = nullptr; +jfieldID JavaLibrary::ms_fidMentalStateModAttack = nullptr; +jfieldID JavaLibrary::ms_fidMentalStateModDecay = nullptr; +jclass JavaLibrary::ms_clsLocation = nullptr; +jclass JavaLibrary::ms_clsLocationArray = nullptr; +jfieldID JavaLibrary::ms_fidLocationX = nullptr; +jfieldID JavaLibrary::ms_fidLocationY = nullptr; +jfieldID JavaLibrary::ms_fidLocationZ = nullptr; +jfieldID JavaLibrary::ms_fidLocationArea = nullptr; +jfieldID JavaLibrary::ms_fidLocationCell = nullptr; +jmethodID JavaLibrary::ms_midRunOne = nullptr; +jmethodID JavaLibrary::ms_midRunAll = nullptr; +jmethodID JavaLibrary::ms_midCallMessages = nullptr; +jmethodID JavaLibrary::ms_midRunConsoleHandler = nullptr; +jmethodID JavaLibrary::ms_midUnload = nullptr; +jmethodID JavaLibrary::ms_midGetClass = nullptr; +jmethodID JavaLibrary::ms_midGetScriptFunctions = nullptr; +jclass JavaLibrary::ms_clsMenuInfo = nullptr; +jmethodID JavaLibrary::ms_midMenuInfo = nullptr; +jmethodID JavaLibrary::ms_midMenuInfoSetMenuItemsInternal = nullptr; +jmethodID JavaLibrary::ms_midMenuInfoGetMenuItemsInternal = nullptr; +jclass JavaLibrary::ms_clsMenuInfoData = nullptr; +jmethodID JavaLibrary::ms_midMenuInfoData = nullptr; jfieldID JavaLibrary::ms_fidMenuInfoDataId; jfieldID JavaLibrary::ms_fidMenuInfoDataParent; jfieldID JavaLibrary::ms_fidMenuInfoDataType; @@ -588,82 +588,82 @@ jclass JavaLibrary::ms_clsPalcolorCustomVar; jmethodID JavaLibrary::ms_midPalcolorCustomVar; jclass JavaLibrary::ms_clsColor; jmethodID JavaLibrary::ms_midColor; -jclass JavaLibrary::ms_clsDraftSchematic = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicCategory = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicComplexity = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicSlots = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicAttribs = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicExperimentalAttribs = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicCustomizations = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicAttribMap = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicObjectTemplateCreated = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicScripts = NULL; -jclass JavaLibrary::ms_clsDraftSchematicSlot = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicSlotName = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicSlotOption = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicSlotIngredientType = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicSlotIngredientName = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicSlotIngredients = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicSlotComplexity = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicSlotAmountRequired = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicSlotAppearance = NULL; -jclass JavaLibrary::ms_clsDraftSchematicAttrib = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicAttribName = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicAttribMinValue = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicAttribMaxValue = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicAttribResourceMaxValue = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicAttribCurrentValue = NULL; -jclass JavaLibrary::ms_clsDraftSchematicSimpleIngredient = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicSimpleIngredientIngredient = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicSimpleIngredientCount = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicSimpleIngredientSource = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicSimpleIngredientXpType = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicSimpleIngredientXpAmount = NULL; -jclass JavaLibrary::ms_clsDraftSchematicCustom = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicCustomName = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicCustomValue = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicCustomMinValue = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicCustomMaxValue = NULL; -//jfieldID JavaLibrary::ms_fidDraftSchematicCustomLocked = NULL; -jclass JavaLibrary::ms_clsMapLocation = NULL; -jmethodID JavaLibrary::ms_midMapLocation = NULL; -jclass JavaLibrary::ms_clsRegion = NULL; -jmethodID JavaLibrary::ms_midRegion = NULL; -jfieldID JavaLibrary::ms_fidRegionName = NULL; -jfieldID JavaLibrary::ms_fidRegionPlanet = NULL; -jclass JavaLibrary::ms_clsCombatEngine = NULL; -jclass JavaLibrary::ms_clsCombatEngineCombatantData = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataPos = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataWorldPos = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataRadius = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataIsCreature = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataPosture = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataLocomotion = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataScriptMod = NULL; -jclass JavaLibrary::ms_clsCombatEngineAttackerData = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineAttackerDataWeaponSkill = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineAttackerDataAims = NULL; -jclass JavaLibrary::ms_clsCombatEngineDefenderData = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineDefenderDataCombatSkeleton = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineDefenderDataCover = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineDefenderDataHitLocationChances = NULL; -jclass JavaLibrary::ms_clsCombatEngineWeaponData = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataId = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataMinDamage = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataMaxDamage = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataWeaponType = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataAttackType = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataDamageType = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataElementalType = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataElementalValue = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataAttackSpeed = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataWoundChance = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataAccuracy = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataMinRange = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataMaxRange = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataDamageRadius = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataAttackCost = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataIsDisabled = NULL; +jclass JavaLibrary::ms_clsDraftSchematic = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicCategory = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicComplexity = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicSlots = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicAttribs = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicExperimentalAttribs = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicCustomizations = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicAttribMap = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicObjectTemplateCreated = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicScripts = nullptr; +jclass JavaLibrary::ms_clsDraftSchematicSlot = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicSlotName = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicSlotOption = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicSlotIngredientType = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicSlotIngredientName = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicSlotIngredients = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicSlotComplexity = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicSlotAmountRequired = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicSlotAppearance = nullptr; +jclass JavaLibrary::ms_clsDraftSchematicAttrib = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicAttribName = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicAttribMinValue = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicAttribMaxValue = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicAttribResourceMaxValue = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicAttribCurrentValue = nullptr; +jclass JavaLibrary::ms_clsDraftSchematicSimpleIngredient = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicSimpleIngredientIngredient = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicSimpleIngredientCount = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicSimpleIngredientSource = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicSimpleIngredientXpType = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicSimpleIngredientXpAmount = nullptr; +jclass JavaLibrary::ms_clsDraftSchematicCustom = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicCustomName = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicCustomValue = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicCustomMinValue = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicCustomMaxValue = nullptr; +//jfieldID JavaLibrary::ms_fidDraftSchematicCustomLocked = nullptr; +jclass JavaLibrary::ms_clsMapLocation = nullptr; +jmethodID JavaLibrary::ms_midMapLocation = nullptr; +jclass JavaLibrary::ms_clsRegion = nullptr; +jmethodID JavaLibrary::ms_midRegion = nullptr; +jfieldID JavaLibrary::ms_fidRegionName = nullptr; +jfieldID JavaLibrary::ms_fidRegionPlanet = nullptr; +jclass JavaLibrary::ms_clsCombatEngine = nullptr; +jclass JavaLibrary::ms_clsCombatEngineCombatantData = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataPos = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataWorldPos = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataRadius = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataIsCreature = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataPosture = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataLocomotion = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataScriptMod = nullptr; +jclass JavaLibrary::ms_clsCombatEngineAttackerData = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineAttackerDataWeaponSkill = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineAttackerDataAims = nullptr; +jclass JavaLibrary::ms_clsCombatEngineDefenderData = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineDefenderDataCombatSkeleton = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineDefenderDataCover = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineDefenderDataHitLocationChances = nullptr; +jclass JavaLibrary::ms_clsCombatEngineWeaponData = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataId = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataMinDamage = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataMaxDamage = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataWeaponType = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataAttackType = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataDamageType = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataElementalType = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataElementalValue = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataAttackSpeed = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataWoundChance = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataAccuracy = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataMinRange = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataMaxRange = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataDamageRadius = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataAttackCost = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataIsDisabled = nullptr; jclass JavaLibrary::ms_clsCombatEngineHitResult; jfieldID JavaLibrary::ms_fidCombatEngineHitResultSuccess; jfieldID JavaLibrary::ms_fidCombatEngineHitResultCritical; @@ -693,40 +693,40 @@ jfieldID JavaLibrary::ms_fidCombatEngineHitResultCritDamage; jfieldID JavaLibrary::ms_fidCombatEngineHitResultBlockedDamage; jfieldID JavaLibrary::ms_fidCombatEngineHitResultBlockingArmor; jfieldID JavaLibrary::ms_fidCombatEngineHitResultBleedingChance; -jclass JavaLibrary::ms_clsTransform = NULL; -jclass JavaLibrary::ms_clsTransformArray = NULL; -jmethodID JavaLibrary::ms_midTransform = NULL; -jfieldID JavaLibrary::ms_fidTransformMatrix = NULL; -jclass JavaLibrary::ms_clsVector = NULL; -jclass JavaLibrary::ms_clsVectorArray = NULL; -jfieldID JavaLibrary::ms_fidVectorX = NULL; -jfieldID JavaLibrary::ms_fidVectorY = NULL; -jfieldID JavaLibrary::ms_fidVectorZ = NULL; -jclass JavaLibrary::ms_clsResourceDensity = NULL; -jfieldID JavaLibrary::ms_fidResourceDensityResourceType = NULL; -jfieldID JavaLibrary::ms_fidResourceDensityDensity = NULL; -jclass JavaLibrary::ms_clsResourceAttribute = NULL; -jfieldID JavaLibrary::ms_fidResourceAttributeName = NULL; -jfieldID JavaLibrary::ms_fidResourceAttributeValue = NULL; -jclass JavaLibrary::ms_clsLibrarySpaceTransition = NULL; -jmethodID JavaLibrary::ms_midLibrarySpaceTransitionSetPlayerOvert = NULL; -jmethodID JavaLibrary::ms_midLibrarySpaceTransitionClearOvertStatus = NULL; +jclass JavaLibrary::ms_clsTransform = nullptr; +jclass JavaLibrary::ms_clsTransformArray = nullptr; +jmethodID JavaLibrary::ms_midTransform = nullptr; +jfieldID JavaLibrary::ms_fidTransformMatrix = nullptr; +jclass JavaLibrary::ms_clsVector = nullptr; +jclass JavaLibrary::ms_clsVectorArray = nullptr; +jfieldID JavaLibrary::ms_fidVectorX = nullptr; +jfieldID JavaLibrary::ms_fidVectorY = nullptr; +jfieldID JavaLibrary::ms_fidVectorZ = nullptr; +jclass JavaLibrary::ms_clsResourceDensity = nullptr; +jfieldID JavaLibrary::ms_fidResourceDensityResourceType = nullptr; +jfieldID JavaLibrary::ms_fidResourceDensityDensity = nullptr; +jclass JavaLibrary::ms_clsResourceAttribute = nullptr; +jfieldID JavaLibrary::ms_fidResourceAttributeName = nullptr; +jfieldID JavaLibrary::ms_fidResourceAttributeValue = nullptr; +jclass JavaLibrary::ms_clsLibrarySpaceTransition = nullptr; +jmethodID JavaLibrary::ms_midLibrarySpaceTransitionSetPlayerOvert = nullptr; +jmethodID JavaLibrary::ms_midLibrarySpaceTransitionClearOvertStatus = nullptr; ////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// // CS handlers -jclass JavaLibrary::ms_clsLibraryDump = NULL; -jmethodID JavaLibrary::ms_midLibraryDumpDumpTargetInfo = NULL; +jclass JavaLibrary::ms_clsLibraryDump = nullptr; +jmethodID JavaLibrary::ms_midLibraryDumpDumpTargetInfo = nullptr; -jclass JavaLibrary::ms_clsLibraryGMLib = NULL; -jmethodID JavaLibrary::ms_midLibraryGMLibFreeze = NULL; -jmethodID JavaLibrary::ms_midLibraryGMLibUnfreeze = NULL; +jclass JavaLibrary::ms_clsLibraryGMLib = nullptr; +jmethodID JavaLibrary::ms_midLibraryGMLibFreeze = nullptr; +jmethodID JavaLibrary::ms_midLibraryGMLibUnfreeze = nullptr; ////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// int JavaLibrary::ms_loaded = 0; -Semaphore * JavaLibrary::ms_shutdownJava = NULL; +Semaphore * JavaLibrary::ms_shutdownJava = nullptr; int JavaLibrary::GlobalInstances::ms_stringIdIndex = 0; int JavaLibrary::GlobalInstances::ms_attribModIndex = 0; @@ -765,7 +765,7 @@ void JavaLibrary::throwScriptException(char const * const format, ...) void JavaLibrary::throwScriptException(char const * const format, va_list va) { - DEBUG_FATAL(!ms_env, ("JavaLibrary::throwScriptException: ms_env is NULL")); + DEBUG_FATAL(!ms_env, ("JavaLibrary::throwScriptException: ms_env is nullptr")); if (ms_env) { char buffer[1024]; @@ -805,28 +805,28 @@ void JavaLibrary::fatalHandler(int signum) // it turns out that in some java crashes we don't even have 2 return // addresses, so check 0 and 1 just to make sure bool result2 = false; - void *crashAddress2a = NULL; - void *crashAddress2b = NULL; - void *crashAddress2c = NULL; - void *frameAddressA = NULL; - void *frameAddressB = NULL; + void *crashAddress2a = nullptr; + void *crashAddress2b = nullptr; + void *crashAddress2c = nullptr; + void *frameAddressA = nullptr; + void *frameAddressB = nullptr; uint32 frameAddressHigh = (reinterpret_cast(frameAddress) >> 16); crashAddress2a = __builtin_return_address(0); - if (crashAddress2a != NULL) + if (crashAddress2a != nullptr) { frameAddressA = __builtin_frame_address(1); - if (frameAddressA != NULL && + if (frameAddressA != nullptr && (reinterpret_cast(frameAddressA) >> 16 == frameAddressHigh)) { crashAddress2b = __builtin_return_address(1); - if (crashAddress2b != NULL) + if (crashAddress2b != nullptr) { frameAddressB = __builtin_frame_address(2); - if (frameAddressB != NULL && + if (frameAddressB != nullptr && (reinterpret_cast(frameAddressB) >> 16 == frameAddressHigh)) { crashAddress2c = __builtin_return_address(2); - if (crashAddress2c != NULL) + if (crashAddress2c != nullptr) { result2 = DebugHelp::lookupAddress(reinterpret_cast( crashAddress2c), lib2, file2, BUFLEN, line2); @@ -837,7 +837,7 @@ void JavaLibrary::fatalHandler(int signum) } bool javaCrash = true; - if ((result1 || result2) && strstr(lib1, "libjvm.so") == NULL && strstr(lib2, "libjvm.so") == NULL) + if ((result1 || result2) && strstr(lib1, "libjvm.so") == nullptr && strstr(lib2, "libjvm.so") == nullptr) { if (result1 && result2) { @@ -860,7 +860,7 @@ void JavaLibrary::fatalHandler(int signum) if (javaCrash) { fprintf(stderr, "I think I crashed in Java, calling the Java segfault hanlder.\n"); - IGNORE_RETURN(sigaction(SIGSEGV, &JavaSa, NULL)); + IGNORE_RETURN(sigaction(SIGSEGV, &JavaSa, nullptr)); IGNORE_RETURN(pthread_kill(pthread_self(), SIGSEGV)); } else @@ -868,11 +868,11 @@ void JavaLibrary::fatalHandler(int signum) // destroy Java threads // this pthread method is not in later versions of glibc as the kernel should handle the kill //pthread_kill_other_threads_np(); - ms_instance = NULL; - ms_env = NULL; - ms_jvm = NULL; + ms_instance = nullptr; + ms_env = nullptr; + ms_jvm = nullptr; // restore original signal handler and rethrow signal - IGNORE_RETURN(sigaction(SIGSEGV, &OrgSa, NULL)); + IGNORE_RETURN(sigaction(SIGSEGV, &OrgSa, nullptr)); IGNORE_RETURN(pthread_kill(pthread_self(), SIGSEGV)); } } @@ -888,7 +888,7 @@ JavaLibrary::JavaLibrary(void) { int i; - if (ms_instance != NULL || ms_loaded != 0) + if (ms_instance != nullptr || ms_loaded != 0) return; ms_shutdownJava = new Semaphore(); @@ -938,7 +938,7 @@ JavaLibrary::~JavaLibrary() { disconnectFromJava(); - if (ms_shutdownJava != NULL) + if (ms_shutdownJava != nullptr) { // tell the initialize thread to shut down if (ms_loaded > 0) @@ -948,10 +948,10 @@ JavaLibrary::~JavaLibrary() Os::sleep(100); } delete ms_shutdownJava; - ms_shutdownJava = NULL; + ms_shutdownJava = nullptr; } - ms_instance = NULL; + ms_instance = nullptr; } // JavaLibrary::~JavaLibrary //---------------------------------------------------------------------- @@ -961,12 +961,12 @@ JavaLibrary::~JavaLibrary() */ void JavaLibrary::install(void) { - if (ms_instance == NULL) + if (ms_instance == nullptr) { JavaLibrary *lib = new JavaLibrary; if (lib != ms_instance) { - if (ms_instance == NULL) + if (ms_instance == nullptr) { delete lib; if (ms_javaVmType != JV_none) @@ -985,10 +985,10 @@ void JavaLibrary::install(void) */ void JavaLibrary::remove(void) { - if (ms_instance != NULL) + if (ms_instance != nullptr) { JavaLibrary * temp = ms_instance; - ms_instance = NULL; + ms_instance = nullptr; delete temp; s_profileSections.clear(); } @@ -1010,7 +1010,7 @@ void JavaLibrary::initializeJavaThread() } const char *javaVMName = ConfigServerGame::getJavaVMName(); - if (javaVMName == NULL || ( + if (javaVMName == nullptr || ( strcmp(javaVMName, "none") != 0 && strcmp(javaVMName, "ibm") != 0 && strcmp(javaVMName, "sun") != 0 && @@ -1038,21 +1038,21 @@ void JavaLibrary::initializeJavaThread() #ifdef linux // get the default signal handler - IGNORE_RETURN(sigaction(SIGSEGV, NULL, &OrgSa)); + IGNORE_RETURN(sigaction(SIGSEGV, nullptr, &OrgSa)); if (ms_javaVmType == JV_ibm) { // check PATH to make sure that it has /usr/bin/java const char * env = getenv("PATH"); - const char * bin = NULL; + const char * bin = nullptr; int envlen = 0; - if (env != NULL) + if (env != nullptr) { bin = strstr(env, "/usr/java/bin"); envlen = strlen(env); } - if (bin == NULL) + if (bin == nullptr) { WARNING(true, ("/usr/java/bin not found in PATH which is needed for IBM Java VM. Adding it now")); char * tmpbuffer = new char[envlen + 128]; @@ -1065,18 +1065,18 @@ void JavaLibrary::initializeJavaThread() // check LD_LIBRARY_PATH for /usr/java/jre/bin and /usr/java/jre/bin/classic env = getenv("LD_LIBRARY_PATH"); - bin = NULL; + bin = nullptr; envlen = 0; - const char * classic = NULL; - if (env != NULL) + const char * classic = nullptr; + if (env != nullptr) { bin = strstr(env, "/usr/java/jre/bin"); classic = strstr(env, "/usr/java/jre/bin/classic"); - if (bin == classic && bin != NULL) + if (bin == classic && bin != nullptr) bin = strstr(classic + 1, "/usr/java/jre/bin"); envlen = strlen(env); } - if (bin == NULL || classic == NULL) + if (bin == nullptr || classic == nullptr) { WARNING(true, ("/usr/java/jre/bin or /usr/java/jre/bin/classic not found " "in LD_LIBRARY_PATH, needed for IBM Java VM. Adding them both now.")); @@ -1093,12 +1093,12 @@ void JavaLibrary::initializeJavaThread() #endif // linux // dynamically load the jni dll and JNI_CreateJavaVM - void * libHandle = NULL; + void * libHandle = nullptr; JNI_CREATEJAVAVMPROC JNI_CreateJavaVMProc; #if defined(WIN32) std::string dllPath = ConfigServerGame::getJavaLibPath(); HINSTANCE hVm = LoadLibrary(dllPath.c_str()); - if (hVm == NULL) + if (hVm == nullptr) { FATAL(true, ("jvm open fail error: could not open %s", dllPath.c_str())); ms_loaded = -1; @@ -1108,10 +1108,10 @@ void JavaLibrary::initializeJavaThread() JNI_CreateJavaVMProc = (JNI_CREATEJAVAVMPROC)GetProcAddress(hVm, "JNI_CreateJavaVM"); //lint !e1924 C-style cast #else - void *libVM = NULL; + void *libVM = nullptr; std::string dllPath = ConfigServerGame::getJavaLibPath(); libVM = dlopen(dllPath.c_str(), RTLD_LAZY); - if (libVM == NULL) + if (libVM == nullptr) { FATAL(true, ("jvm open fail! error: %s", dlerror())); ms_loaded = -1; @@ -1121,7 +1121,7 @@ void JavaLibrary::initializeJavaThread() JNI_CreateJavaVMProc = (JNI_CREATEJAVAVMPROC)dlsym(libVM, "JNI_CreateJavaVM"); #endif - if (JNI_CreateJavaVMProc == NULL) + if (JNI_CreateJavaVMProc == nullptr) { FATAL(true, ("Error getting JNI_CreateJavaVM from jvm shared library")); ms_loaded = -1; @@ -1137,9 +1137,9 @@ void JavaLibrary::initializeJavaThread() classPath += ConfigServerGame::getScriptPath(); JavaVMInitArgs vm_args; - JavaVMOption tempOption = {NULL, NULL}; + JavaVMOption tempOption = {nullptr, nullptr}; std::vector options; - char *jdwpBuffer = NULL; + char *jdwpBuffer = nullptr; UNREF(jdwpBuffer); @@ -1206,7 +1206,7 @@ void JavaLibrary::initializeJavaThread() } #ifdef REMOTE_DEBUG_ON - char *jdwpBuffer = NULL; + char *jdwpBuffer = nullptr; if (ConfigServerGame::getUseRemoteDebugJava()) { if (ms_javaVmType == JV_ibm) @@ -1305,14 +1305,14 @@ void JavaLibrary::initializeJavaThread() vm_args.ignoreUnrecognized = JNI_TRUE; // create the JVM - JNIEnv * env = NULL; + JNIEnv * env = nullptr; jint result = (*JNI_CreateJavaVMProc)(&ms_jvm, reinterpret_cast(&env), &vm_args); #ifdef REMOTE_DEBUG_ON - if (jdwpBuffer != NULL) + if (jdwpBuffer != nullptr) { delete[] jdwpBuffer; - jdwpBuffer = NULL; + jdwpBuffer = nullptr; } #endif @@ -1329,7 +1329,7 @@ void JavaLibrary::initializeJavaThread() // clean up IGNORE_RETURN(ms_jvm->DestroyJavaVM()); - ms_jvm = NULL; + ms_jvm = nullptr; #if defined(_WIN32) @@ -1356,7 +1356,7 @@ bool JavaLibrary::connectToJava() return false; // attach our thread to the VM - jint result = ms_jvm->AttachCurrentThread(reinterpret_cast(&ms_env), NULL); + jint result = ms_jvm->AttachCurrentThread(reinterpret_cast(&ms_env), nullptr); if (result != 0) { FATAL(true, ("Failed to attach to the Java VM! Error code returned = %d", result)); @@ -1927,7 +1927,7 @@ bool JavaLibrary::connectToJava() for (i = 0; i < MAX_STRING_ID_PARAMS; ++i) { - localInstance = createNewObject(ms_clsStringId, ms_midStringId, NULL, -1); + localInstance = createNewObject(ms_clsStringId, ms_midStringId, nullptr, -1); if (ms_env->ExceptionCheck()) { ms_env->ExceptionDescribe(); @@ -1945,7 +1945,7 @@ bool JavaLibrary::connectToJava() for (i = 0; i < MAX_MODIFIABLE_STRING_ID_PARAMS; ++i) { localInstance = createNewObject(ms_clsModifiableStringId, constructor, - NULL, -1); + nullptr, -1); if (ms_env->ExceptionCheck()) { ms_env->ExceptionDescribe(); @@ -2100,7 +2100,7 @@ bool JavaLibrary::registerNatives(const JNINativeMethod natives[], int count) { if (!natives[i].signature) { - DEBUG_REPORT_LOG(true, ("RegisterNatives failed: %s - NULL signature\n", natives[i].name)); + DEBUG_REPORT_LOG(true, ("RegisterNatives failed: %s - nullptr signature\n", natives[i].name)); result = 1; continue; } @@ -2208,11 +2208,11 @@ int i; FREE_CLASS(ms_clsLibraryDump); FREE_CLASS(ms_clsLibraryGMLib); - if (ms_scriptEntry != NULL) + if (ms_scriptEntry != nullptr) { if (ms_env) ms_env->DeleteGlobalRef(ms_scriptEntry); - ms_scriptEntry = NULL; + ms_scriptEntry = nullptr; } for (i = 0; i < MAX_RECURSION_COUNT; ++i) @@ -2235,7 +2235,7 @@ int i; GlobalInstances::ms_menuInfo = GlobalRef::cms_nullPtr; IGNORE_RETURN(ms_jvm->DetachCurrentThread()); - ms_env = NULL; + ms_env = nullptr; } // JavaLibrary::disconnectFromJava //---------------------------------------------------------------------- @@ -2272,7 +2272,7 @@ void JavaLibrary::resetJavaConnection() */ bool JavaLibrary::queryScriptFunctions(const std::string & scriptName) { - if (ms_instance == NULL) + if (ms_instance == nullptr) return false; JavaString scriptClassName(("script." + scriptName).c_str()); @@ -2326,7 +2326,7 @@ bool JavaLibrary::queryScriptFunctions(const std::string & scriptName) */ jlong JavaLibrary::getFreeJavaMemory() { - if (ms_instance == NULL || ms_env == NULL) + if (ms_instance == nullptr || ms_env == nullptr) return 0; return ms_env->CallStaticLongMethod(ms_clsScriptEntry, ms_midScriptEntryGetFreeMem); @@ -2347,7 +2347,7 @@ void JavaLibrary::printJavaStack() */ void JavaLibrary::enableLogging(bool enable) const { - if (ms_instance == NULL || ms_env == NULL) + if (ms_instance == nullptr || ms_env == nullptr) return; ms_env->CallStaticVoidMethod(ms_clsScriptEntry, @@ -2361,7 +2361,7 @@ void JavaLibrary::enableLogging(bool enable) const */ void JavaLibrary::enableNewJediTracking(bool enableTracking) { - if (ms_instance == NULL || ms_env == NULL) + if (ms_instance == nullptr || ms_env == nullptr) return; ms_env->CallStaticVoidMethod(ms_clsScriptEntry, @@ -2401,7 +2401,7 @@ LocalRefPtr JavaLibrary::getObjId(const NetworkId::NetworkIdType & id) */ LocalRefPtr JavaLibrary::getObjId(const NetworkId & id) { - if (ms_env != NULL && ms_instance != NULL) + if (ms_env != nullptr && ms_instance != nullptr) return callStaticObjectMethod(ms_clsObjId, ms_midObjIdGetObjId, id.getValue()); return LocalRef::cms_nullPtr; } // JavaLibrary::getObjId(const CachedNetworkId &) @@ -2490,7 +2490,7 @@ LocalRefPtr JavaLibrary::getVector(Vector const & vector) */ void JavaLibrary::removeJavaId(const NetworkId & id) { - if (ms_env == NULL || ms_clsObjId == NULL || ms_midObjIdClearObjId == NULL) + if (ms_env == nullptr || ms_clsObjId == nullptr || ms_midObjIdClearObjId == nullptr) { return; } @@ -2508,7 +2508,7 @@ void JavaLibrary::removeJavaId(const NetworkId & id) */ void JavaLibrary::flagDestroyed(const NetworkId & id) { - if (ms_env == NULL || ms_clsObjId == NULL || ms_midObjIdFlagDestroyed == NULL) + if (ms_env == nullptr || ms_clsObjId == nullptr || ms_midObjIdFlagDestroyed == nullptr) { return; } @@ -2527,7 +2527,7 @@ void JavaLibrary::flagDestroyed(const NetworkId & id) */ void JavaLibrary::setObjIdAuthoritative(const NetworkId & object, bool authoritative, uint32 pid) { - if (ms_env == NULL || ms_midObjIdSetAuthoritative == NULL) + if (ms_env == nullptr || ms_midObjIdSetAuthoritative == nullptr) { return; } @@ -2550,7 +2550,7 @@ void JavaLibrary::setObjIdAuthoritative(const NetworkId & object, bool authorita */ void JavaLibrary::setObjIdLoaded(const NetworkId &object) { - if (ms_env == NULL || ms_midObjIdSetLoaded == NULL) + if (ms_env == nullptr || ms_midObjIdSetLoaded == nullptr) { return; } @@ -2572,7 +2572,7 @@ void JavaLibrary::setObjIdLoaded(const NetworkId &object) */ void JavaLibrary::setObjIdInitialized(const NetworkId &object) { - if (ms_env == NULL || ms_midObjIdSetInitialized == NULL) + if (ms_env == nullptr || ms_midObjIdSetInitialized == nullptr) { return; } @@ -2594,7 +2594,7 @@ void JavaLibrary::setObjIdInitialized(const NetworkId &object) */ void JavaLibrary::setObjIdLoggedIn(const NetworkId & object, bool loggedIn) { - if (ms_env == NULL || ms_midObjIdSetLoggedIn == NULL) + if (ms_env == nullptr || ms_midObjIdSetLoggedIn == nullptr) { return; } @@ -2617,7 +2617,7 @@ void JavaLibrary::setObjIdLoggedIn(const NetworkId & object, bool loggedIn) void JavaLibrary::attachScriptToObjId(const NetworkId &object, const std::string & script) { - if (ms_env != NULL) + if (ms_env != nullptr) { LocalRefPtr obj_id = getObjId(object); if (obj_id == LocalRef::cms_nullPtr) @@ -2638,7 +2638,7 @@ void JavaLibrary::attachScriptToObjId(const NetworkId &object, void JavaLibrary::attachScriptsToObjId(const NetworkId &object, const ScriptList & scripts) { - if (scripts.size() == 0 || ms_env == NULL) + if (scripts.size() == 0 || ms_env == nullptr) return; LocalRefPtr obj_id = getObjId(object); @@ -2684,7 +2684,7 @@ void JavaLibrary::attachScriptsToObjId(const NetworkId &object, void JavaLibrary::detachScriptFromObjId(const NetworkId &object, const std::string & script) { - if (ms_env != NULL) + if (ms_env != nullptr) { LocalRefPtr obj_id = getObjId(object); if (obj_id == LocalRef::cms_nullPtr) @@ -2703,7 +2703,7 @@ void JavaLibrary::detachScriptFromObjId(const NetworkId &object, */ void JavaLibrary::detachAllScriptsFromObjId(const NetworkId &object) { - if (ms_env != NULL) + if (ms_env != nullptr) { LocalRefPtr obj_id = getObjId(object); if (obj_id == LocalRef::cms_nullPtr) @@ -2766,7 +2766,7 @@ jint JavaLibrary::handleScriptEntryCleanup(jint result) if (ConfigServerGame::getTrapScriptCrashes()) { // the script threw an error or exception, restore our segfault handler - IGNORE_RETURN(sigaction(SIGSEGV, &OurSa, NULL)); + IGNORE_RETURN(sigaction(SIGSEGV, &OurSa, nullptr)); } #endif } @@ -2786,20 +2786,20 @@ jint JavaLibrary::handleScriptEntryCleanup(jint result) jint JavaLibrary::callScriptEntry(const JavaStringParam & script, const JavaStringParam & method, jobjectArray params) { - if (ms_env == NULL || ms_clsScriptEntry == NULL || ms_midRunOne == NULL) + if (ms_env == nullptr || ms_clsScriptEntry == nullptr || ms_midRunOne == nullptr) { - LOG("ScriptInvestigation", ("callScriptEntry failed because something was null")); + LOG("ScriptInvestigation", ("callScriptEntry failed because something was nullptr")); if (!ms_env) { - LOG("ScriptInvestigation", ("callScriptEntry failed because ms_env was null")); + LOG("ScriptInvestigation", ("callScriptEntry failed because ms_env was nullptr")); } if (!ms_clsScriptEntry) { - LOG("ScriptInvestigation", ("callScriptEntry failed because scriptEntry was null")); + LOG("ScriptInvestigation", ("callScriptEntry failed because scriptEntry was nullptr")); } if (!ms_midRunOne) { - LOG("ScriptInvestigation", ("callScriptEntry failed because runOne was null")); + LOG("ScriptInvestigation", ("callScriptEntry failed because runOne was nullptr")); } return SCRIPT_OVERRIDE; @@ -2837,20 +2837,20 @@ jint JavaLibrary::callScriptEntry(const JavaStringParam & script, */ jint JavaLibrary::callScriptEntry(const JavaStringParam & method, jobjectArray params) { - if (ms_env == NULL || ms_clsScriptEntry == NULL || ms_midRunAll == NULL) + if (ms_env == nullptr || ms_clsScriptEntry == nullptr || ms_midRunAll == nullptr) { - LOG("ScriptInvestigation", ("callScriptEntry2 failed because something was null")); + LOG("ScriptInvestigation", ("callScriptEntry2 failed because something was nullptr")); if (!ms_env) { - LOG("ScriptInvestigation", ("callScriptEntry2 failed because ms_env was null")); + LOG("ScriptInvestigation", ("callScriptEntry2 failed because ms_env was nullptr")); } if (!ms_clsScriptEntry) { - LOG("ScriptInvestigation", ("callScriptEntry2 failed because scriptEntry was null")); + LOG("ScriptInvestigation", ("callScriptEntry2 failed because scriptEntry was nullptr")); } if (!ms_midRunOne) { - LOG("ScriptInvestigation", ("callScriptEntry2 failed because runOne was null")); + LOG("ScriptInvestigation", ("callScriptEntry2 failed because runOne was nullptr")); } return SCRIPT_OVERRIDE; } @@ -2886,20 +2886,20 @@ jint JavaLibrary::callScriptEntry(const JavaStringParam & method, jobjectArray p */ jstring JavaLibrary::callScriptConsoleHandlerEntry(const JavaStringParam & script, const JavaStringParam & method, jobjectArray params) { - if (ms_env == NULL || ms_clsScriptEntry == NULL || ms_midRunConsoleHandler == NULL) + if (ms_env == nullptr || ms_clsScriptEntry == nullptr || ms_midRunConsoleHandler == nullptr) { - LOG("ScriptInvestigation", ("callScriptConsoleHandlerEntry failed because something was null")); + LOG("ScriptInvestigation", ("callScriptConsoleHandlerEntry failed because something was nullptr")); if (!ms_env) { - LOG("ScriptInvestigation", ("callScriptConsoleHandlerEntry failed because ms_env was null")); + LOG("ScriptInvestigation", ("callScriptConsoleHandlerEntry failed because ms_env was nullptr")); } if (!ms_clsScriptEntry) { - LOG("ScriptInvestigation", ("callScriptConsoleHandlerEntry failed because scriptEntry was null")); + LOG("ScriptInvestigation", ("callScriptConsoleHandlerEntry failed because scriptEntry was nullptr")); } if (!ms_midRunConsoleHandler) { - LOG("ScriptInvestigation", ("callScriptConsoleHandlerEntry failed because runConsoleHandler was null")); + LOG("ScriptInvestigation", ("callScriptConsoleHandlerEntry failed because runConsoleHandler was nullptr")); } return 0; @@ -2938,7 +2938,7 @@ void JavaLibrary::convert(const ScriptParams & params, JavaDictionaryPtr & dicti { dictionary.reset(); - if (ms_env == NULL) + if (ms_env == nullptr) return; // create the dictionary @@ -3132,7 +3132,7 @@ void JavaLibrary::convert(const ScriptParams & params, JavaDictionaryPtr & dicti for (int j = 0; j < count; ++j) { const std::vector * inner = objIds[j]; - if (inner != NULL) + if (inner != nullptr) { LocalObjectArrayRefPtr innerArray = createNewObjectArray(inner->size(), ms_clsObjId); if (innerArray != LocalObjectArrayRef::cms_nullPtr) @@ -3235,7 +3235,7 @@ void JavaLibrary::convert(const ScriptParams & params, JavaDictionaryPtr & dicti */ LocalObjectArrayRefPtr JavaLibrary::convert(const NetworkId & self, const std::string& argList, const ScriptParams &args) { - if (ms_env == NULL) + if (ms_env == nullptr) return LocalObjectArrayRef::cms_nullPtr; // convert the params to jobjects @@ -3272,7 +3272,7 @@ LocalObjectArrayRefPtr JavaLibrary::convert(const NetworkId & self, const std::s */ LocalObjectArrayRefPtr JavaLibrary::convert(const std::string& argList, const ScriptParams &args) { - if (ms_env == NULL) + if (ms_env == nullptr) return LocalObjectArrayRef::cms_nullPtr; // convert the params to jobjects @@ -3301,7 +3301,7 @@ LocalObjectArrayRefPtr JavaLibrary::convert(const std::string& argList, const Sc */ bool JavaLibrary::convert(LocalObjectArrayRefPtr & javaParams, int startIndex, const std::string& argList, const ScriptParams &args) { - if (ms_env == NULL) + if (ms_env == nullptr) return 0; GlobalInstances globals; @@ -3536,7 +3536,7 @@ bool JavaLibrary::convert(LocalObjectArrayRefPtr & javaParams, int startIndex, c for (i = 0, iter = strings.begin(); iter != strings.end(); ++i, ++iter) { - if (*iter != NULL) + if (*iter != nullptr) { JavaString newString(**iter); setObjectArrayElement(*localInstance, i, newString); @@ -3767,7 +3767,7 @@ bool JavaLibrary::convert(LocalObjectArrayRefPtr & javaParams, int startIndex, c ++paramCount; } } - // fill in the rest of ms_attribModList with null + // fill in the rest of ms_attribModList with nullptr for (; paramCount < MAX_ATTRIB_MOD_PARAMS; ++paramCount) { setObjectArrayElement(*ms_attribModList[ms_currentRecursionCount], static_cast(paramCount), *LocalRefParam::cms_nullPtr); @@ -3846,7 +3846,7 @@ bool JavaLibrary::convert(LocalObjectArrayRefPtr & javaParams, int startIndex, c ++paramCount; } } - // fill in the rest of ms_mentalStateModList with null + // fill in the rest of ms_mentalStateModList with nullptr for (; paramCount < MAX_MENTAL_STATE_MOD_PARAMS; ++paramCount) { setObjectArrayElement( @@ -3932,7 +3932,7 @@ bool JavaLibrary::convert(LocalObjectArrayRefPtr & javaParams, int startIndex, c static_cast(argType))); //lint !e571 suspicious cast return 0; } - if (arg.get() == NULL || arg == LocalRef::cms_nullPtr) + if (arg.get() == nullptr || arg == LocalRef::cms_nullPtr) { DEBUG_REPORT_LOG(true, ("bad parameter, %c%s%d%s\n", argType, modifiable ? "*" : "", @@ -3967,7 +3967,7 @@ bool JavaLibrary::convert(LocalObjectArrayRefPtr & javaParams, int startIndex, c void JavaLibrary::alterScriptParams(jobjectArray jparams, const std::string& argList, ScriptParams &args) { - if (ms_env == NULL) + if (ms_env == nullptr) return; PROFILER_AUTO_BLOCK_CHECK_DEFINE("JavaLibrary::alterScriptParams"); @@ -4003,7 +4003,7 @@ void JavaLibrary::alterScriptParams(jobjectArray jparams, const std::string& arg { int count = getArrayLength(*arg); std::vector * values = new std::vector(count, 0); - jint * jvalues = static_cast(ms_env->GetPrimitiveArrayCritical(static_cast(arg->getValue()), NULL)); + jint * jvalues = static_cast(ms_env->GetPrimitiveArrayCritical(static_cast(arg->getValue()), nullptr)); for (int j = 0; j < count; ++j) { values->at(j) = static_cast(jvalues[j]); @@ -4035,7 +4035,7 @@ void JavaLibrary::alterScriptParams(jobjectArray jparams, const std::string& arg { int count = getArrayLength(*arg); std::vector * values = new std::vector(count, 0); - jbyte * jvalues = static_cast(ms_env->GetPrimitiveArrayCritical(static_cast(arg->getValue()), NULL)); + jbyte * jvalues = static_cast(ms_env->GetPrimitiveArrayCritical(static_cast(arg->getValue()), nullptr)); for (int j = 0; j < count; ++j) { values->at(j) = static_cast(jvalues[j]); @@ -4121,7 +4121,7 @@ void JavaLibrary::alterScriptParams(jobjectArray jparams, const std::string& arg std::string localString; convert(*table, localString); value->setTable(localString); - // get the string id text, if it is not NULL/empty, use it + // get the string id text, if it is not nullptr/empty, use it localString.clear(); JavaStringPtr text = getStringField(*arg, ms_fidStringIdAsciiId); if (text != JavaString::cms_nullPtr) @@ -4197,18 +4197,18 @@ int JavaLibrary::runScripts(const NetworkId & caller, "JavaLibrary::runScripts enter, self = %s, method = %s\n", caller.getValueString().c_str(), method.c_str())); - if (ms_env == NULL || ms_clsObject == NULL) + if (ms_env == nullptr || ms_clsObject == nullptr) { DEBUG_REPORT_LOG(ConfigServerGame::getJavaConsoleDebugMessages(), ( "JavaLibrary::runScripts exit, self = %s, method = %s\n", caller.getValueString().c_str(), method.c_str())); if (!ms_env) { - LOG("ScriptInvestigation", ("runSCripts failed because env was null")); + LOG("ScriptInvestigation", ("runSCripts failed because env was nullptr")); } else { - LOG("ScriptInvestigation", ("runSCripts failed because clsObject was null")); + LOG("ScriptInvestigation", ("runSCripts failed because clsObject was nullptr")); } return SCRIPT_OVERRIDE; } @@ -4335,19 +4335,19 @@ int JavaLibrary::runScript(const NetworkId & caller, const std::string& script, "JavaLibrary::runScript %s enter, self = %s, method = %s\n", script.c_str(), caller.getValueString().c_str(), method.c_str())); - if (ms_env == NULL || ms_midRunOne == NULL || ms_clsObject == NULL) + if (ms_env == nullptr || ms_midRunOne == nullptr || ms_clsObject == nullptr) { if (!ms_env) { - LOG("ScriptInvestigation", ("runSCripts2 failed because env was null")); + LOG("ScriptInvestigation", ("runSCripts2 failed because env was nullptr")); } else if (!ms_midRunOne) { - LOG("ScriptInvestigation", ("runSCripts2 failed because midRunOne was null")); + LOG("ScriptInvestigation", ("runSCripts2 failed because midRunOne was nullptr")); } else { - LOG("ScriptInvestigation", ("runSCripts2 failed because clsObject was null")); + LOG("ScriptInvestigation", ("runSCripts2 failed because clsObject was nullptr")); } return SCRIPT_OVERRIDE; @@ -4455,19 +4455,19 @@ int JavaLibrary::runScript(const NetworkId & caller, const std::string& script, DEBUG_REPORT_LOG(true, ("JavaLibrary::runScript %s enter, method = %s\n", script.c_str(), method.c_str())); - if (ms_env == NULL || ms_midRunOne == NULL || ms_clsObject == NULL) + if (ms_env == nullptr || ms_midRunOne == nullptr || ms_clsObject == nullptr) { if (!ms_env) { - LOG("ScriptInvestigation", ("runSCripts3 failed because env was null")); + LOG("ScriptInvestigation", ("runSCripts3 failed because env was nullptr")); } else if (!ms_midRunOne) { - LOG("ScriptInvestigation", ("runSCripts3 failed because midRunOne was null")); + LOG("ScriptInvestigation", ("runSCripts3 failed because midRunOne was nullptr")); } else { - LOG("ScriptInvestigation", ("runSCripts3 failed because clsObject was null")); + LOG("ScriptInvestigation", ("runSCripts3 failed because clsObject was nullptr")); } return SCRIPT_OVERRIDE; } @@ -4582,19 +4582,19 @@ int JavaLibrary::runScript(const NetworkId & caller, const std::string& script, DEBUG_REPORT_LOG(true, ("JavaLibrary::runScript %s enter, method = %s\n", script.c_str(), method.c_str())); - if (ms_env == NULL || ms_midRunOne == NULL || ms_clsObject == NULL) + if (ms_env == nullptr || ms_midRunOne == nullptr || ms_clsObject == nullptr) { if (!ms_env) { - LOG("ScriptInvestigation", ("runSCripts4 failed because env was null")); + LOG("ScriptInvestigation", ("runSCripts4 failed because env was nullptr")); } else if (!ms_midRunOne) { - LOG("ScriptInvestigation", ("runSCripts4 failed because midRunOne was null")); + LOG("ScriptInvestigation", ("runSCripts4 failed because midRunOne was nullptr")); } else { - LOG("ScriptInvestigation", ("runSCripts4 failed because clsObject was null")); + LOG("ScriptInvestigation", ("runSCripts4 failed because clsObject was nullptr")); } return SCRIPT_OVERRIDE; @@ -4775,19 +4775,19 @@ static const std::string errorReturnString; "JavaLibrary::runScript %s enter, method = %s\n", script.c_str(), method.c_str())); - if (ms_env == NULL || ms_midRunConsoleHandler == NULL || ms_clsObject == NULL) + if (ms_env == nullptr || ms_midRunConsoleHandler == nullptr || ms_clsObject == nullptr) { if (!ms_env) { - LOG("ScriptInvestigation", ("runSCripts2 failed because env was null")); + LOG("ScriptInvestigation", ("runSCripts2 failed because env was nullptr")); } else if (!ms_midRunConsoleHandler) { - LOG("ScriptInvestigation", ("runSCripts2 failed because midRunConsoleHandler was null")); + LOG("ScriptInvestigation", ("runSCripts2 failed because midRunConsoleHandler was nullptr")); } else { - LOG("ScriptInvestigation", ("runSCripts2 failed because clsObject was null")); + LOG("ScriptInvestigation", ("runSCripts2 failed because clsObject was nullptr")); } return errorReturnString; @@ -4877,7 +4877,7 @@ static const std::string errorReturnString; */ bool JavaLibrary::reloadScript(const std::string& scriptName) { - if (ms_env == NULL || ms_clsScriptEntry == NULL || ms_midUnload == NULL) + if (ms_env == nullptr || ms_clsScriptEntry == nullptr || ms_midUnload == nullptr) return false; // convert the script name to jstring @@ -4919,22 +4919,22 @@ int JavaLibrary::callMessages(const NetworkId & caller, const std::string & meth int result = SCRIPT_CONTINUE; - if (ms_env == NULL || ms_midRunOne == NULL || ms_clsObject == NULL) + if (ms_env == nullptr || ms_midRunOne == nullptr || ms_clsObject == nullptr) { DEBUG_REPORT_LOG(ConfigServerGame::getJavaConsoleDebugMessages(), ( "JavaLibrary::callMessages exit, self = %s, method = %s\n", caller.getValueString().c_str(), method.c_str())); if (!ms_env) { - LOG("ScriptInvestigation", ("callMessages failed because env was null")); + LOG("ScriptInvestigation", ("callMessages failed because env was nullptr")); } else if (!ms_midRunOne) { - LOG("ScriptInvestigation", ("callMessages failed because midRunOne was null")); + LOG("ScriptInvestigation", ("callMessages failed because midRunOne was nullptr")); } else { - LOG("ScriptInvestigation", ("callMessages failed because clsObject was null")); + LOG("ScriptInvestigation", ("callMessages failed because clsObject was nullptr")); } return SCRIPT_OVERRIDE; @@ -4951,7 +4951,7 @@ int JavaLibrary::callMessages(const NetworkId & caller, const std::string & meth const JavaDictionary * dictionary = safe_cast(data.get()); jobject jdictionary = 0; - if (dictionary != NULL) + if (dictionary != nullptr) jdictionary = dictionary->getValue(); // convert the method string to jstrings @@ -5013,22 +5013,22 @@ int JavaLibrary::callMessage(const NetworkId & caller, const std::string & scrip "JavaLibrary::callMessage %s enter, self = %s, method = %s\n", script.c_str(), caller.getValueString().c_str(), method.c_str())); - if (ms_env == NULL || ms_midRunOne == NULL || ms_clsObject == NULL) + if (ms_env == nullptr || ms_midRunOne == nullptr || ms_clsObject == nullptr) { DEBUG_REPORT_LOG(ConfigServerGame::getJavaConsoleDebugMessages(), ( "JavaLibrary::callMessage %s exit, self = %s, method = %s\n", script.c_str(), caller.getValueString().c_str(), method.c_str())); if (!ms_env) { - LOG("ScriptInvestigation", ("callMessage failed because env was null")); + LOG("ScriptInvestigation", ("callMessage failed because env was nullptr")); } else if (!ms_midRunOne) { - LOG("ScriptInvestigation", ("callMessage failed because midRunOne was null")); + LOG("ScriptInvestigation", ("callMessage failed because midRunOne was nullptr")); } else { - LOG("ScriptInvestigation", ("callMessage failed because clsObject was null")); + LOG("ScriptInvestigation", ("callMessage failed because clsObject was nullptr")); } return SCRIPT_OVERRIDE; @@ -5044,7 +5044,7 @@ int JavaLibrary::callMessage(const NetworkId & caller, const std::string & scrip } const JavaDictionary * dictionary = dynamic_cast(&data); - if (dictionary == NULL) + if (dictionary == nullptr) { DEBUG_REPORT_LOG(ConfigServerGame::getJavaConsoleDebugMessages(), ( "JavaLibrary::callMessage %s exit, self = %s, method = %s\n", @@ -5218,7 +5218,7 @@ void JavaLibrary::packDictionary(const ScriptDictionary & dictionary, bool JavaLibrary::unpackDictionary(const std::vector & packedData, ScriptDictionaryPtr & dictionary) { - if (ms_env == NULL) + if (ms_env == nullptr) return false; dictionary = JavaDictionary::cms_nullPtr; @@ -5259,7 +5259,7 @@ bool JavaLibrary::unpackDictionary(const std::vector & packedData, } } */ - if (data != NULL && *data != '\0') + if (data != nullptr && *data != '\0') { LocalByteArrayRefPtr jdata = createNewByteArray(dataLen); if (jdata != LocalByteArrayRef::cms_nullPtr) @@ -5335,7 +5335,7 @@ const bool JavaLibrary::convert(const JavaStringParam & source, Unicode::String const bool JavaLibrary::convert(const JavaDictionary & source, std::vector & target) { bool result = false; - if (ms_env != NULL) + if (ms_env != nullptr) { if (source.getValue() != 0) { @@ -5463,7 +5463,7 @@ const bool convert(const std::vector & source, LocalObj result = true; for (int i = 0; i < count; ++i) { - if (source[i] != NULL) + if (source[i] != nullptr) { JavaString targetElement(*source[i]); setObjectArrayElement(*target, i, targetElement); @@ -6160,7 +6160,7 @@ const bool convert(const LocalRefParam & source, const Region * & target) const bool convert(const jobject & source, const Region * &target) { JNIEnv * env = JavaLibrary::getEnv(); - if (env == NULL || source == NULL) + if (env == nullptr || source == nullptr) return false; if (!env->IsInstanceOf(source, JavaLibrary::ms_clsRegion)) return false; @@ -6384,7 +6384,7 @@ const bool convert(const LocalRefParam & sourceVector, Vector & target) const bool convert(const AttribMod::AttribMod & source, LocalRefPtr & target) { JNIEnv * env = JavaLibrary::getEnv(); - if (env == NULL) + if (env == nullptr) return false; target = allocObject(JavaLibrary::ms_clsAttribMod); @@ -6418,7 +6418,7 @@ const bool convert(const AttribMod::AttribMod & source, LocalRefPtr & target) const bool convert(const jobject & source, AttribMod::AttribMod & target) { JNIEnv * env = JavaLibrary::getEnv(); - if (env == NULL) + if (env == nullptr) return false; if (source == 0 || env->IsInstanceOf(source, JavaLibrary::ms_clsAttribMod) == JNI_FALSE) @@ -6477,7 +6477,7 @@ const bool convert(const LocalRefParam & source, AttribMod::AttribMod & target) const bool convert(const std::vector & source, LocalObjectArrayRefPtr & target) { JNIEnv * env = JavaLibrary::getEnv(); - if (env == NULL) + if (env == nullptr) return false; int count = source.size(); @@ -6504,7 +6504,7 @@ const bool convert(const std::vector & source, LocalObject const bool convert(const jobjectArray & source, std::vector & target) { JNIEnv * env = JavaLibrary::getEnv(); - if (env == NULL) + if (env == nullptr) return false; if (source == 0) @@ -6529,7 +6529,7 @@ const bool convert(const jobjectArray & source, std::vector & target) { JNIEnv * env = JavaLibrary::getEnv(); - if (env == NULL) + if (env == nullptr) return false; if (source == 0) @@ -6545,7 +6545,7 @@ const bool convert(const jbyteArray & source, std::vector & target) const bool convert(const LocalByteArrayRef & source, std::vector & target) { JNIEnv * env = JavaLibrary::getEnv(); - if (env == NULL) + if (env == nullptr) return false; if (source.getValue() == 0) @@ -6561,7 +6561,7 @@ const bool convert(const LocalByteArrayRef & source, std::vector & target) const bool convert(const std::vector & source, LocalByteArrayRefPtr & target) { JNIEnv * env = JavaLibrary::getEnv(); - if (env == NULL) + if (env == nullptr) return false; int count = source.size(); @@ -6593,10 +6593,10 @@ CreatureObject *JavaLibrary::getCreatureThrow(JNIEnv *env, jlong objId, char con if (!objId) { - IGNORE_RETURN(snprintf(buffer, sizeof(buffer) - 1, "%s: null object id from script.", errorDescription)); + IGNORE_RETURN(snprintf(buffer, sizeof(buffer) - 1, "%s: nullptr object id from script.", errorDescription)); buffer[sizeof(buffer) - 1] = '\0'; throwInternalScriptError(buffer); - return NULL; + return nullptr; } else { @@ -6606,7 +6606,7 @@ CreatureObject *JavaLibrary::getCreatureThrow(JNIEnv *env, jlong objId, char con IGNORE_RETURN(snprintf(buffer, sizeof(buffer) - 1, "%s: invalid or non-convertable network id [%s].", errorDescription, networkId.getValueString().c_str())); buffer[sizeof(buffer) - 1] = '\0'; throwInternalScriptError(buffer); - return NULL; + return nullptr; } else { @@ -6616,19 +6616,19 @@ CreatureObject *JavaLibrary::getCreatureThrow(JNIEnv *env, jlong objId, char con if (!throwIfNotOnServer) { // The specified object is not on this server. It might not even be a real object. - // Since the caller does not want this to throw, simply return NULL. - return NULL; + // Since the caller does not want this to throw, simply return nullptr. + return nullptr; } IGNORE_RETURN(snprintf(buffer, sizeof(buffer) - 1, "%s: object for network id [%s] not on this server.", errorDescription, networkId.getValueString().c_str())); buffer[sizeof(buffer) - 1] = '\0'; throwInternalScriptError(buffer); - return NULL; + return nullptr; } else { ServerObject *const serverObject = object->asServerObject(); - CreatureObject *const creatureObject = serverObject ? serverObject->asCreatureObject() : NULL; + CreatureObject *const creatureObject = serverObject ? serverObject->asCreatureObject() : nullptr; if (creatureObject) return creatureObject; @@ -6637,7 +6637,7 @@ CreatureObject *JavaLibrary::getCreatureThrow(JNIEnv *env, jlong objId, char con IGNORE_RETURN(snprintf(buffer, sizeof(buffer) - 1, "%s: object id=[%s], template=[%s] is not a CreatureObject.", errorDescription, networkId.getValueString().c_str(), object->getObjectTemplateName())); buffer[sizeof(buffer) - 1] = '\0'; throwInternalScriptError(buffer); - return NULL; + return nullptr; } } } @@ -6654,10 +6654,10 @@ ShipObject *JavaLibrary::getShipThrow(JNIEnv *env, jlong objId, char const *erro if (objId == 0) { - IGNORE_RETURN(snprintf(buffer, sizeof(buffer) - 1, "%s: null object id from script.", errorDescription)); + IGNORE_RETURN(snprintf(buffer, sizeof(buffer) - 1, "%s: nullptr object id from script.", errorDescription)); buffer[sizeof(buffer) - 1] = '\0'; throwInternalScriptError(buffer); - return NULL; + return nullptr; } else { @@ -6667,7 +6667,7 @@ ShipObject *JavaLibrary::getShipThrow(JNIEnv *env, jlong objId, char const *erro IGNORE_RETURN(snprintf(buffer, sizeof(buffer) - 1, "%s: invalid or non-convertable network id [%s].", errorDescription, networkId.getValueString().c_str())); buffer[sizeof(buffer) - 1] = '\0'; throwInternalScriptError(buffer); - return NULL; + return nullptr; } else { @@ -6677,19 +6677,19 @@ ShipObject *JavaLibrary::getShipThrow(JNIEnv *env, jlong objId, char const *erro if (!throwIfNotOnServer) { // The specified object is not on this server. It might not even be a real object. - // Since the caller does not want this to throw, simply return NULL. - return NULL; + // Since the caller does not want this to throw, simply return nullptr. + return nullptr; } IGNORE_RETURN(snprintf(buffer, sizeof(buffer) - 1, "%s: object for network id [%s] not on this server.", errorDescription, networkId.getValueString().c_str())); buffer[sizeof(buffer) - 1] = '\0'; throwInternalScriptError(buffer); - return NULL; + return nullptr; } else { ServerObject *const serverObject = object->asServerObject(); - ShipObject *const shipObject = serverObject ? serverObject->asShipObject() : NULL; + ShipObject *const shipObject = serverObject ? serverObject->asShipObject() : nullptr; if (shipObject) return shipObject; @@ -6698,7 +6698,7 @@ ShipObject *JavaLibrary::getShipThrow(JNIEnv *env, jlong objId, char const *erro IGNORE_RETURN(snprintf(buffer, sizeof(buffer) - 1, "%s: object id=[%s], template=[%s] is not a ShipObject.", errorDescription, networkId.getValueString().c_str(), object->getObjectTemplateName())); buffer[sizeof(buffer) - 1] = '\0'; throwInternalScriptError(buffer); - return NULL; + return nullptr; } } } @@ -6714,7 +6714,7 @@ ShipObject *JavaLibrary::getShipThrow(JNIEnv *env, jlong objId, char const *erro */ void JavaLibrary::throwInternalScriptError(const char * message) { - if (ms_env != NULL && message != NULL) + if (ms_env != nullptr && message != nullptr) { ms_env->ThrowNew(ms_clsInternalScriptError, message); } diff --git a/engine/server/library/serverScript/src/shared/ScriptFunctionTable.cpp b/engine/server/library/serverScript/src/shared/ScriptFunctionTable.cpp index 976743ee..e9f4e88c 100755 --- a/engine/server/library/serverScript/src/shared/ScriptFunctionTable.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptFunctionTable.cpp @@ -434,7 +434,7 @@ static const Scripting::ScriptFuncTable ScriptFuncList[] = //-- finish it up - {Scripting::TRIG_LAST_TRIGGER, NULL, NULL} + {Scripting::TRIG_LAST_TRIGGER, nullptr, nullptr} }; const int NUM_SCRIPT_FUNCTIONS = sizeof(ScriptFuncList) / sizeof(ScriptFuncList[0]) - 1; @@ -444,7 +444,7 @@ const int NUM_SCRIPT_FUNCTIONS = sizeof(ScriptFuncList) / sizeof(ScriptFuncList[ // globals //======================================================================== -Scripting::_ScriptFuncHashMap *Scripting::ScriptFuncHashMap = NULL; +Scripting::_ScriptFuncHashMap *Scripting::ScriptFuncHashMap = nullptr; //======================================================================== @@ -468,6 +468,6 @@ void Scripting::InitScriptFuncHashMap(void) void Scripting::RemoveScriptFuncHashMap(void) { delete Scripting::ScriptFuncHashMap; - Scripting::ScriptFuncHashMap = NULL; + Scripting::ScriptFuncHashMap = nullptr; } diff --git a/engine/server/library/serverScript/src/shared/ScriptListEntry.cpp b/engine/server/library/serverScript/src/shared/ScriptListEntry.cpp index 1f55096a..8725947c 100755 --- a/engine/server/library/serverScript/src/shared/ScriptListEntry.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptListEntry.cpp @@ -16,9 +16,9 @@ std::string const &ScriptListEntry::getScriptName() const { static const std::string emptyString; - if (m_data != NULL) + if (m_data != nullptr) return m_data->first; - WARNING_STRICT_FATAL(true, ("ScriptListEntry::getScriptName called with m_data = NULL")); + WARNING_STRICT_FATAL(true, ("ScriptListEntry::getScriptName called with m_data = nullptr")); return emptyString; } @@ -28,9 +28,9 @@ ScriptData &ScriptListEntry::getScriptData() const { static ScriptData emptyData; - if (m_data != NULL) + if (m_data != nullptr) return m_data->second; - WARNING_STRICT_FATAL(true, ("ScriptListEntry::getScriptData called with m_data = NULL")); + WARNING_STRICT_FATAL(true, ("ScriptListEntry::getScriptData called with m_data = nullptr")); return emptyData; } diff --git a/engine/server/library/serverScript/src/shared/ScriptListEntry.h b/engine/server/library/serverScript/src/shared/ScriptListEntry.h index 1d5e8f66..37349274 100755 --- a/engine/server/library/serverScript/src/shared/ScriptListEntry.h +++ b/engine/server/library/serverScript/src/shared/ScriptListEntry.h @@ -53,7 +53,7 @@ inline bool ScriptListEntry::operator==(ScriptListEntry const &rhs) const inline bool ScriptListEntry::isValid() const { - return m_data != NULL; + return m_data != nullptr; } // ====================================================================== diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsAi.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsAi.cpp index eab60dd9..1d12a09a 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsAi.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsAi.cpp @@ -126,18 +126,18 @@ AICreatureController * const ScriptMethodsAiNamespace::getAiCreatureController(j NetworkId const aiNetworkId(ai); CreatureObject * const aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId); - if (aiCreatureObject == NULL) + if (aiCreatureObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("Unable to resolve the ai(%s) to a CreatureObject.", aiNetworkId.getValueString().c_str())); - return NULL; + return nullptr; } AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(aiCreatureObject->getController()); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("Unable to get the ai's(%s) AiCreatureController.", aiCreatureObject->getDebugInformation().c_str())); - return NULL; + return nullptr; } return aiCreatureController; @@ -155,14 +155,14 @@ jint JNICALL ScriptMethodsAiNamespace::aiGetMovementState(JNIEnv * /*env*/, jobj NetworkId const aiNetworkId(ai); CreatureObject * const aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId); - if (aiCreatureObject == NULL) + if (aiCreatureObject == nullptr) { return AMT_invalid; } AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(aiCreatureObject->getController()); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return AMT_invalid; } @@ -187,14 +187,14 @@ jboolean JNICALL ScriptMethodsAiNamespace::aiLoggingEnabled(JNIEnv * /*env*/, jo NetworkId const aiNetworkId(ai); CreatureObject * const aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId); - if (aiCreatureObject == NULL) + if (aiCreatureObject == nullptr) { return JNI_FALSE; } AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(aiCreatureObject->getController()); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return JNI_FALSE; } @@ -212,7 +212,7 @@ jboolean JNICALL ScriptMethodsAiNamespace::aiIsFrozen(JNIEnv * /*env*/, jobject { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return JNI_FALSE; } @@ -226,14 +226,14 @@ jboolean JNICALL ScriptMethodsAiNamespace::aiIsAggressive(JNIEnv * /*env*/, jobj NetworkId const aiNetworkId(ai); CreatureObject * const aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId); - if (aiCreatureObject == NULL) + if (aiCreatureObject == nullptr) { return JNI_FALSE; } AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(aiCreatureObject->getController()); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return JNI_FALSE; } @@ -247,14 +247,14 @@ jboolean JNICALL ScriptMethodsAiNamespace::aiIsAssist(JNIEnv * /*env*/, jobject NetworkId const aiNetworkId(ai); CreatureObject * const aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId); - if (aiCreatureObject == NULL) + if (aiCreatureObject == nullptr) { return JNI_FALSE; } AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(aiCreatureObject->getController()); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return JNI_FALSE; } @@ -267,7 +267,7 @@ jboolean JNICALL ScriptMethodsAiNamespace::aiIsStalker(JNIEnv * /*env*/, jobject { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return JNI_FALSE; } @@ -282,14 +282,14 @@ jboolean JNICALL ScriptMethodsAiNamespace::aiIsKiller(JNIEnv * /*env*/, jobject NetworkId const aiNetworkId(ai); CreatureObject * const aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId); - if (aiCreatureObject == NULL) + if (aiCreatureObject == nullptr) { return JNI_FALSE; } AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(aiCreatureObject->getController()); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return JNI_FALSE; } @@ -302,7 +302,7 @@ void JNICALL ScriptMethodsAiNamespace::aiTether(JNIEnv * /*env*/, jobject /*self { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return; } @@ -316,14 +316,14 @@ jboolean JNICALL ScriptMethodsAiNamespace::aiIsTethered(JNIEnv * /*env*/, jobjec NetworkId const aiNetworkId(ai); CreatureObject * const aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId); - if (aiCreatureObject == NULL) + if (aiCreatureObject == nullptr) { return JNI_FALSE; } AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(aiCreatureObject->getController()); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return JNI_FALSE; } @@ -336,7 +336,7 @@ void JNICALL ScriptMethodsAiNamespace::aiSetHomeLocation(JNIEnv * /*env*/, jobje { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return; } @@ -356,7 +356,7 @@ jobject JNICALL ScriptMethodsAiNamespace::aiGetHomeLocation(JNIEnv * /*env*/, jo { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return JavaLibrary::getVector(Vector::zero)->getReturnValue(); } @@ -373,7 +373,7 @@ jobject JNICALL ScriptMethodsAiNamespace::aiGetLeashAnchorLocation(JNIEnv * /*en { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return JavaLibrary::getVector(Vector::zero)->getReturnValue(); } @@ -396,7 +396,7 @@ jfloat JNICALL ScriptMethodsAiNamespace::aiGetRespectRadius(JNIEnv * /*env*/, jo { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return 0.0f; } @@ -411,7 +411,7 @@ jfloat JNICALL ScriptMethodsAiNamespace::aiGetAggroRadius(JNIEnv * /*env*/, jobj { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return 0.0f; } @@ -424,7 +424,7 @@ void JNICALL ScriptMethodsAiNamespace::aiEquipPrimaryWeapon(JNIEnv * /*env*/, jo { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return; } @@ -437,7 +437,7 @@ void JNICALL ScriptMethodsAiNamespace::aiEquipSecondaryWeapon(JNIEnv * /*env*/, { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return; } @@ -450,7 +450,7 @@ void JNICALL ScriptMethodsAiNamespace::aiUnEquipWeapons(JNIEnv * /*env*/, jobjec { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return; } @@ -463,7 +463,7 @@ jboolean JNICALL ScriptMethodsAiNamespace::aiHasPrimaryWeapon(JNIEnv * /*env*/, { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return JNI_FALSE; } @@ -476,7 +476,7 @@ jboolean JNICALL ScriptMethodsAiNamespace::aiHasSecondaryWeapon(JNIEnv * /*env*/ { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return JNI_FALSE; } @@ -489,7 +489,7 @@ jboolean JNICALL ScriptMethodsAiNamespace::aiUsingPrimaryWeapon(JNIEnv * /*env*/ { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return JNI_FALSE; } @@ -502,7 +502,7 @@ jboolean JNICALL ScriptMethodsAiNamespace::aiUsingSecondaryWeapon(JNIEnv * /*env { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return JNI_FALSE; } @@ -515,7 +515,7 @@ jlong JNICALL ScriptMethodsAiNamespace::aiGetPrimaryWeapon(JNIEnv * /*env*/, job { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return 0; } @@ -528,7 +528,7 @@ jlong JNICALL ScriptMethodsAiNamespace::aiGetSecondaryWeapon(JNIEnv * /*env*/, j { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return 0; } @@ -541,7 +541,7 @@ jfloat JNICALL ScriptMethodsAiNamespace::aiGetMovementSpeedPercent(JNIEnv * /*en { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return 0.0f; } @@ -554,7 +554,7 @@ void JNICALL ScriptMethodsAiNamespace::loiterLocation(JNIEnv * /*env*/, jobject { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return; } @@ -585,7 +585,7 @@ void JNICALL ScriptMethodsAiNamespace::loiterLocation(JNIEnv * /*env*/, jobject CellObject const * const cellObject = CellObject::getCellObject(cellId); - if (cellObject != NULL) + if (cellObject != nullptr) { CellProperty const * const cellProperty = cellObject->getCellProperty(); @@ -608,7 +608,7 @@ void JNICALL ScriptMethodsAiNamespace::loiterTarget(JNIEnv * /*env*/, jobject /* { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return; } @@ -623,7 +623,7 @@ void JNICALL ScriptMethodsAiNamespace::loiterTarget(JNIEnv * /*env*/, jobject /* NetworkId const targetNetworkId(static_cast(target)); Object * const targetObject = NetworkIdManager::getObjectById(targetNetworkId); - if (targetObject == NULL) + if (targetObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsAi::loiterTarget() ai(%s) Unable to resolve the target(%s) to a Object", aiCreatureController->getCreature()->getDebugInformation().c_str(), targetNetworkId.getValueString().c_str())); return; @@ -643,7 +643,7 @@ void JNICALL ScriptMethodsAiNamespace::pathToLocation(JNIEnv * /*env*/, jobject { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return; } @@ -664,7 +664,7 @@ void JNICALL ScriptMethodsAiNamespace::pathToLocation(JNIEnv * /*env*/, jobject { CellObject const * const cellObject = CellObject::getCellObject(cellId); - if (cellObject != NULL) + if (cellObject != nullptr) { CellProperty const * const cellProperty = cellObject->getCellProperty(); @@ -697,7 +697,7 @@ void JNICALL ScriptMethodsAiNamespace::pathToName(JNIEnv * /*env*/, jobject /*se { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return; } @@ -731,7 +731,7 @@ void JNICALL ScriptMethodsAiNamespace::pathToName(JNIEnv * /*env*/, jobject /*se void JNICALL ScriptMethodsAiNamespace::patrolToLocation(JNIEnv *, jobject, jlong ai, jobjectArray targets, jboolean random, jboolean flip, jboolean repeat, jint startPoint) { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) return; std::vector locations; @@ -755,7 +755,7 @@ void JNICALL ScriptMethodsAiNamespace::patrolToLocation(JNIEnv *, jobject, jlong void JNICALL ScriptMethodsAiNamespace::patrolToName(JNIEnv *, jobject, jlong ai, jobjectArray targetNames, jboolean random, jboolean flip, jboolean repeat, jint startPoint) { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) return; std::vector locations; @@ -768,11 +768,11 @@ void JNICALL ScriptMethodsAiNamespace::patrolToName(JNIEnv *, jobject, jlong ai, for (int i = 0; i < count; ++i) { const Unicode::String * location = locations[i]; - if (location != NULL) + if (location != nullptr) { realLocations.push_back(*location); delete location; - locations[i] = NULL; + locations[i] = nullptr; } } aiCreatureController->patrol(realLocations, random, flip, repeat, startPoint); @@ -783,16 +783,16 @@ jstring JNICALL ScriptMethodsAiNamespace::aiGetCombatAction(JNIEnv * /*env*/, jo { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { - return NULL; + return nullptr; } PersistentCrcString const & result = aiCreatureController->getCombatAction(); if (result.isEmpty()) { - return NULL; + return nullptr; } JavaString javaString(result.getString()); @@ -805,7 +805,7 @@ jint JNICALL ScriptMethodsAiNamespace::aiGetKnockDownRecoveryTime(JNIEnv * /*env { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return 0; } @@ -819,7 +819,7 @@ jboolean JNICALL ScriptMethodsAiNamespace::setHibernationDelay(JNIEnv *env, jobj { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(creature); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) return JNI_FALSE; aiCreatureController->setHibernationDelay(delay); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsAnimation.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsAnimation.cpp index d41f22ca..9c2ec894 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsAnimation.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsAnimation.cpp @@ -97,7 +97,7 @@ void JNICALL ScriptMethodsAnimationNamespace::setAnimationMood (JNIEnv *env, job JavaStringParam localMoodName(moodName); - ServerObject * targetObject = NULL; + ServerObject * targetObject = nullptr; if (!JavaLibrary::getObject(target, targetObject)) return; @@ -114,7 +114,7 @@ void JNICALL ScriptMethodsAnimationNamespace::setAnimationMood (JNIEnv *env, job jstring JNICALL ScriptMethodsAnimationNamespace::getAnimationMood (JNIEnv *env, jobject self, jlong target) { - ServerObject * targetObject = NULL; + ServerObject * targetObject = nullptr; if (!JavaLibrary::getObject(target, targetObject)) return 0; @@ -143,7 +143,7 @@ jboolean JNICALL ScriptMethodsAnimationNamespace::sitOnObject (JNIEnv *env, jobj CreatureObject *sitterObject = 0; if (!JavaLibrary::getObject (sitterId, sitterObject) || !sitterObject) { - DEBUG_WARNING (true, ("sitOnObject(): Sitter object is NULL.")); + DEBUG_WARNING (true, ("sitOnObject(): Sitter object is nullptr.")); return JNI_FALSE; } @@ -175,11 +175,11 @@ void JNICALL ScriptMethodsAnimationNamespace::setObjectAppearance(JNIEnv *env, j UNREF(env); UNREF(self); - CreatureObject* creature = NULL; + CreatureObject* creature = nullptr; if(!JavaLibrary::getObject(target, creature) || !creature) { - DEBUG_WARNING(true, ("SetObjectAppearance() : Creature object was NULL.\n")); + DEBUG_WARNING(true, ("SetObjectAppearance() : Creature object was nullptr.\n")); return; } @@ -209,11 +209,11 @@ void JNICALL ScriptMethodsAnimationNamespace::revertObjectAppearance(JNIEnv *env UNREF(env); UNREF(self); - CreatureObject* creature = NULL; + CreatureObject* creature = nullptr; if(!JavaLibrary::getObject(target, creature) || !creature) { - DEBUG_WARNING(true, ("RevertObjectAppearance() : Creature object was NULL.\n")); + DEBUG_WARNING(true, ("RevertObjectAppearance() : Creature object was nullptr.\n")); return; } diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsAttributes.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsAttributes.cpp index 266b10f8..42c47200 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsAttributes.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsAttributes.cpp @@ -549,12 +549,12 @@ jboolean JNICALL ScriptMethodsAttributesNamespace::hasAttribModifier(JNIEnv *env if (!JavaLibrary::convert(jmodName, name)) return JNI_FALSE; - const CreatureObject * creature = NULL; + const CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; const AttribMod::AttribMod * mod = creature->getAttributeModifier(name); - if (mod != NULL && AttribMod::isAttribMod(*mod)) + if (mod != nullptr && AttribMod::isAttribMod(*mod)) return JNI_TRUE; return JNI_FALSE; @@ -582,12 +582,12 @@ jboolean JNICALL ScriptMethodsAttributesNamespace::hasSkillModModifier(JNIEnv *e if (!JavaLibrary::convert(jmodName, name)) return JNI_FALSE; - const CreatureObject * creature = NULL; + const CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; const AttribMod::AttribMod * mod = creature->getAttributeModifier(name); - if (mod != NULL && AttribMod::isSkillMod(*mod)) + if (mod != nullptr && AttribMod::isSkillMod(*mod)) return JNI_TRUE; return JNI_FALSE; @@ -601,7 +601,7 @@ jboolean JNICALL ScriptMethodsAttributesNamespace::hasSkillModModifier(JNIEnv *e * @param target id of creature to access * @param attrib attribute we are interested in * - * @return the attribute modifiers for the creature, or null if it has none + * @return the attribute modifiers for the creature, or nullptr if it has none */ jobjectArray JNICALL ScriptMethodsAttributesNamespace::getAttribModifiers(JNIEnv *env, jobject self, jlong target, jint attrib) { @@ -642,7 +642,7 @@ jobjectArray JNICALL ScriptMethodsAttributesNamespace::getAttribModifiers(JNIEnv * @param self class calling this function * @param target id of creature to access * - * @return the attribute modifiers for the creature, or null if it has none + * @return the attribute modifiers for the creature, or nullptr if it has none */ jobjectArray JNICALL ScriptMethodsAttributesNamespace::getAllAttribModifiers(JNIEnv *env, jobject self, jlong target) { @@ -692,7 +692,7 @@ jboolean JNICALL ScriptMethodsAttributesNamespace::removeAttribModifier(JNIEnv * if (!JavaLibrary::convert(jmodName, name)) return JNI_FALSE; - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -1084,12 +1084,12 @@ jint JNICALL ScriptMethodsAttributesNamespace::getHitpoints(JNIEnv *env, jobject { UNREF(self); - const TangibleObject * object = NULL; + const TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return ATTRIB_ERROR; // make sure the object isn't a creature or is a vehicle - if (object->asCreatureObject () != NULL && + if (object->asCreatureObject () != nullptr && !GameObjectTypes::isTypeOf (object->getGameObjectType (), SharedObjectTemplate::GOT_vehicle)) return ATTRIB_ERROR; @@ -1111,12 +1111,12 @@ jint JNICALL ScriptMethodsAttributesNamespace::getMaxHitpoints(JNIEnv *env, jobj { UNREF(self); - const TangibleObject * object = NULL; + const TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return ATTRIB_ERROR; // make sure the object isn't a creature or is a vehicle - if (object->asCreatureObject () != NULL && + if (object->asCreatureObject () != nullptr && !GameObjectTypes::isTypeOf (object->getGameObjectType (), SharedObjectTemplate::GOT_vehicle)) return ATTRIB_ERROR; @@ -1136,13 +1136,13 @@ jint JNICALL ScriptMethodsAttributesNamespace::getTotalHitpoints(JNIEnv *env, jo { UNREF(self); - const TangibleObject * object = NULL; + const TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return ATTRIB_ERROR; // make sure the object isn't a creature // make sure the object isn't a creature or is a vehicle - if (object->asCreatureObject () != NULL && + if (object->asCreatureObject () != nullptr && !GameObjectTypes::isTypeOf (object->getGameObjectType (), SharedObjectTemplate::GOT_vehicle)) return ATTRIB_ERROR; @@ -1164,12 +1164,12 @@ jboolean JNICALL ScriptMethodsAttributesNamespace::setHitpoints(JNIEnv *env, job { UNREF(self); - TangibleObject * object = NULL; + TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; // make sure the object isn't a creature or is a vehicle - if (object->asCreatureObject () != NULL && + if (object->asCreatureObject () != nullptr && !GameObjectTypes::isTypeOf (object->getGameObjectType (), SharedObjectTemplate::GOT_vehicle)) return JNI_FALSE; @@ -1209,12 +1209,12 @@ jboolean JNICALL ScriptMethodsAttributesNamespace::setMaxHitpoints(JNIEnv *env, { UNREF(self); - TangibleObject * object = NULL; + TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; // make sure the object isn't a creature or is a vehicle - if (object->asCreatureObject () != NULL && + if (object->asCreatureObject () != nullptr && !GameObjectTypes::isTypeOf (object->getGameObjectType (), SharedObjectTemplate::GOT_vehicle)) return JNI_FALSE; @@ -1237,12 +1237,12 @@ jboolean JNICALL ScriptMethodsAttributesNamespace::setInvulnerableHitpoints(JNIE { UNREF(self); - TangibleObject * object = NULL; + TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; // make sure the object isn't a creature or is a vehicle - if (object->asCreatureObject () != NULL && + if (object->asCreatureObject () != nullptr && !GameObjectTypes::isTypeOf (object->getGameObjectType (), SharedObjectTemplate::GOT_vehicle)) return JNI_FALSE; @@ -1280,7 +1280,7 @@ jboolean JNICALL ScriptMethodsAttributesNamespace::setInvulnerableHitpoints(JNIE */ jint JNICALL ScriptMethodsAttributesNamespace::getShockWound(JNIEnv *env, jobject self, jlong target) { - const CreatureObject * creature = NULL; + const CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return ATTRIB_ERROR; @@ -1299,7 +1299,7 @@ jint JNICALL ScriptMethodsAttributesNamespace::getShockWound(JNIEnv *env, jobjec */ jboolean JNICALL ScriptMethodsAttributesNamespace::setShockWound(JNIEnv *env, jobject self, jlong target, jint wound) { - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -1319,7 +1319,7 @@ jboolean JNICALL ScriptMethodsAttributesNamespace::setShockWound(JNIEnv *env, jo */ jboolean JNICALL ScriptMethodsAttributesNamespace::addShockWound(JNIEnv *env, jobject self, jlong target, jint wound) { - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -1339,7 +1339,7 @@ jboolean JNICALL ScriptMethodsAttributesNamespace::addShockWound(JNIEnv *env, jo */ jboolean JNICALL ScriptMethodsAttributesNamespace::healShockWound(JNIEnv *env, jobject self, jlong target, jint value) { - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsAuction.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsAuction.cpp index 0a76643b..e288480b 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsAuction.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsAuction.cpp @@ -110,8 +110,8 @@ void JNICALL ScriptMethodsAuctionNamespace::createVendorMarket(JNIEnv *env, jobj void JNICALL ScriptMethodsAuctionNamespace::auctionCreatePermanent(JNIEnv *env, jobject script, jstring jownerName, jlong jitem, jlong jauctionContainer, jint jprice, jstring juserDescription) { - TangibleObject *itemObject = NULL; - ServerObject *containerObj = NULL; + TangibleObject *itemObject = nullptr; + ServerObject *containerObj = nullptr; if (!JavaLibrary::getObject(jitem, itemObject)) { @@ -194,7 +194,7 @@ void JNICALL ScriptMethodsAuctionNamespace::setSalesTax(JNIEnv *env, jobject scr void JNICALL ScriptMethodsAuctionNamespace::requestVendorItemCount(JNIEnv *env, jobject script, jlong vendor) { - ServerObject* vendorObject = NULL; + ServerObject* vendorObject = nullptr; if( !JavaLibrary::getObject(vendor, vendorObject) ) { WARNING(true, ("[designer bug] requestVendorItemLimit() vendor is invalid.")); @@ -206,7 +206,7 @@ void JNICALL ScriptMethodsAuctionNamespace::requestVendorItemCount(JNIEnv *env, void JNICALL ScriptMethodsAuctionNamespace::requestPlayerVendorCount(JNIEnv *env, jobject script, jlong player) { - ServerObject* playerObject = NULL; + ServerObject* playerObject = nullptr; if( !JavaLibrary::getObject(player, playerObject) ) { WARNING(true, ("[designer bug] requestPlayerVendorCount() player is invalid.")); @@ -218,7 +218,7 @@ void JNICALL ScriptMethodsAuctionNamespace::requestPlayerVendorCount(JNIEnv *env void JNICALL ScriptMethodsAuctionNamespace::updateVendorSearchOption(JNIEnv *env, jobject script, jlong vendor, jboolean enable) { - ServerObject* vendorObject = NULL; + ServerObject* vendorObject = nullptr; bool enabled; if( !JavaLibrary::getObject(vendor, vendorObject) ) { @@ -235,7 +235,7 @@ void JNICALL ScriptMethodsAuctionNamespace::updateVendorSearchOption(JNIEnv *env void JNICALL ScriptMethodsAuctionNamespace::setEntranceCharge(JNIEnv *env, jobject script, jlong vendor, jint entranceCharge) { - ServerObject* vendorObject = NULL; + ServerObject* vendorObject = nullptr; if( !JavaLibrary::getObject(vendor, vendorObject) ) { WARNING(true, ("[designer bug] setEntranceCharge() vendor is invalid.")); @@ -247,7 +247,7 @@ void JNICALL ScriptMethodsAuctionNamespace::setEntranceCharge(JNIEnv *env, jobje void JNICALL ScriptMethodsAuctionNamespace::removeAllAuctions(JNIEnv *env, jobject script, jlong jvendor) { - ServerObject* vendorObject = NULL; + ServerObject* vendorObject = nullptr; if( !JavaLibrary::getObject(jvendor, vendorObject) ) { WARNING(true, ("[designer bug] removeAllAuctions() vendor is invalid.")); @@ -259,21 +259,21 @@ void JNICALL ScriptMethodsAuctionNamespace::removeAllAuctions(JNIEnv *env, jobje void JNICALL ScriptMethodsAuctionNamespace::reinitializeVendor(JNIEnv *env, jobject script, jlong vendor, jlong player) { - ServerObject* vendorObject = NULL; + ServerObject* vendorObject = nullptr; if( !JavaLibrary::getObject(vendor, vendorObject) ) { WARNING(true, ("[designer bug] reinitializeVendor() vendor is invalid.")); return; } ServerObject* auctionContainer = vendorObject->getBazaarContainer(); - if ( auctionContainer == NULL ) + if ( auctionContainer == nullptr ) { WARNING(true, ("[designer bug] reinitializeVendor() vendor doesn't have an auction container.")); return; } - ServerObject* playerObject = NULL; + ServerObject* playerObject = nullptr; if ( !JavaLibrary::getObject(player, playerObject) ) { WARNING(true, ("[designer bug] reinitializeVendor() player is invalid.")); @@ -292,7 +292,7 @@ void JNICALL ScriptMethodsAuctionNamespace::reinitializeVendor(JNIEnv *env, jobj void JNICALL ScriptMethodsAuctionNamespace::updateVendorStatus(JNIEnv *env, jobject script, jlong vendor, jint status) { - ServerObject const * vendorObject = NULL; + ServerObject const * vendorObject = nullptr; if (!JavaLibrary::getObject(vendor, vendorObject)) { diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsBroadcasting.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsBroadcasting.cpp index aaea9f3c..2ee028b5 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsBroadcasting.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsBroadcasting.cpp @@ -63,7 +63,7 @@ void JNICALL ScriptMethodsBroadcastingNamespace::listenToMessage(JNIEnv *env, jo CachedNetworkId emitterId(emitter); ServerObject* listenerObject = dynamic_cast(listenerId.getObject()); - if (listenerObject == NULL) + if (listenerObject == nullptr) return; std::string messageHandlerNameString; @@ -88,7 +88,7 @@ void JNICALL ScriptMethodsBroadcastingNamespace::stopListeningToMessage(JNIEnv * CachedNetworkId emitterId(emitter); ServerObject* listenerObject = dynamic_cast(listenerId.getObject()); - if (listenerObject == NULL) + if (listenerObject == nullptr) return; std::string messageHandlerNameString; @@ -112,7 +112,7 @@ jlongArray JNICALL ScriptMethodsBroadcastingNamespace::getMessageListeners(JNIEn CachedNetworkId emitterId(emitter); ServerObject* emitterObject = dynamic_cast(emitterId.getObject()); - if (emitterObject == NULL) + if (emitterObject == nullptr) return 0; std::string messageHandlerNameString; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsBuffBuilder.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsBuffBuilder.cpp index 9eaabd1f..24289140 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsBuffBuilder.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsBuffBuilder.cpp @@ -162,8 +162,8 @@ jboolean JNICALL ScriptMethodsBuffBuilderNamespace::buffBuilderValidated(JNIEnv WARNING(true, ("index keys and values arrays are of diffent sizes")); return JNI_FALSE; } - jint * const buffComponentsValuesArray = env->GetIntArrayElements(jbuffComponentValues, NULL); - if (buffComponentsValuesArray == NULL) + jint * const buffComponentsValuesArray = env->GetIntArrayElements(jbuffComponentValues, nullptr); + if (buffComponentsValuesArray == nullptr) { return JNI_FALSE; } @@ -194,7 +194,7 @@ jboolean JNICALL ScriptMethodsBuffBuilderNamespace::buffBuilderValidated(JNIEnv { //send the final change message to the buffer to indicate acceptance - Controller * const bufferController = bufferObj ? bufferObj->getController() : NULL; + Controller * const bufferController = bufferObj ? bufferObj->getController() : nullptr; if(bufferController) { BuffBuilderChangeMessage * outMsg = new BuffBuilderChangeMessage(); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsChat.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsChat.cpp index 8e36a847..39fbf062 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsChat.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsChat.cpp @@ -218,7 +218,7 @@ jstring JNICALL ScriptMethodsChatNamespace::chatPackOutOfBandWaypointData(JNIEnv Unicode::String n; //name StringId nid; //nameId - //-- target may be null, we'll just start a new string + //-- target may be nullptr, we'll just start a new string if (target) { const JavaStringParam jtarget(target); @@ -229,7 +229,7 @@ jstring JNICALL ScriptMethodsChatNamespace::chatPackOutOfBandWaypointData(JNIEnv } } - //-- if planet is null, just use the current sceneId + //-- if planet is nullptr, just use the current sceneId if (planet) { const JavaStringParam jplanet(planet); @@ -304,7 +304,7 @@ jstring JNICALL ScriptMethodsChatNamespace::chatPackOutOfBandWaypoint(JNIEnv * e if (!source) { - DEBUG_WARNING (true, ("ScriptMethodsChat JavaLibrary::chatPackOutOfBandWaypoint failed null source")); + DEBUG_WARNING (true, ("ScriptMethodsChat JavaLibrary::chatPackOutOfBandWaypoint failed nullptr source")); return 0; } @@ -340,7 +340,7 @@ jstring JNICALL ScriptMethodsChatNamespace::packOutOfBandProsePackage(JNIEnv * e if (!stringId) { - DEBUG_WARNING (true, ("JavaLibrary::packOutOfBandProsePackage attempt to pack prose package with null stringId")); + DEBUG_WARNING (true, ("JavaLibrary::packOutOfBandProsePackage attempt to pack prose package with nullptr stringId")); return 0; } @@ -644,10 +644,10 @@ void JNICALL ScriptMethodsChatNamespace::chatSendSystemMessageObjId(JNIEnv * env if(!JavaLibrary::getObject(_to, player)) { - DEBUG_WARNING (true, ("ScriptMethodsChat JavaLibrary::chatSendSystemMessageObjId failed bad source object (not null)")); + DEBUG_WARNING (true, ("ScriptMethodsChat JavaLibrary::chatSendSystemMessageObjId failed bad source object (not nullptr)")); if (ConfigServerScript::allowDebugConsoleMessages()) { - fprintf(stderr, "WARNING: JavaLibrary::chatSendSystemMessageObjId: failed bad source object (not null)\n"); + fprintf(stderr, "WARNING: JavaLibrary::chatSendSystemMessageObjId: failed bad source object (not nullptr)\n"); JavaLibrary::printJavaStack(); } return; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsCity.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsCity.cpp index 6843dc85..db7499c7 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsCity.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsCity.cpp @@ -920,7 +920,7 @@ void JNICALL ScriptMethodsCityNamespace::cityRemoveStructure(JNIEnv *env, jobjec jboolean JNICALL ScriptMethodsCityNamespace::cityIsInactivePackupActive(JNIEnv *env, jobject self) { - return (ConfigServerGame::getCityCitizenshipInactivePackupStartTimeEpoch() <= static_cast(::time(NULL))); + return (ConfigServerGame::getCityCitizenshipInactivePackupStartTimeEpoch() <= static_cast(::time(nullptr))); } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsClientEffect.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsClientEffect.cpp index 28cb48e9..b3af259f 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsClientEffect.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsClientEffect.cpp @@ -91,7 +91,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEventObj(JNIEnv * { JavaStringParam localEventType(eventType); - ServerObject* so = NULL; + ServerObject* so = nullptr; if(!JavaLibrary::getObject(client, so)) return JNI_FALSE; Client* c = so->getClient(); @@ -100,7 +100,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEventObj(JNIEnv * if (!objectToPlayEventOn) return JNI_FALSE; - ServerObject* target = NULL; + ServerObject* target = nullptr; if(!JavaLibrary::getObject(objectToPlayEventOn, target)) return JNI_FALSE; if(!target) @@ -114,7 +114,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEventObj(JNIEnv * //get the hardpoint std::string hp; - if (NULL != jHardpoint) + if (nullptr != jHardpoint) { JavaStringParam localHardpoint(jHardpoint); JavaLibrary::convert(localHardpoint, hp); @@ -122,7 +122,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEventObj(JNIEnv * //get the transform Transform transform; - if (NULL != jTransform) + if (nullptr != jTransform) { ScriptConversion::convert(jTransform, transform); } @@ -158,7 +158,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEventObjLimited(J if (!objectToPlayEventOn) return JNI_FALSE; - ServerObject* target = NULL; + ServerObject* target = nullptr; if(!JavaLibrary::getObject(objectToPlayEventOn, target)) return JNI_FALSE; if(!target) @@ -172,7 +172,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEventObjLimited(J //get the hardpoint std::string hp; - if (NULL != jHardpoint) + if (nullptr != jHardpoint) { JavaStringParam localHardpoint(jHardpoint); JavaLibrary::convert(localHardpoint, hp); @@ -180,7 +180,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEventObjLimited(J //get the transform Transform transform; - if (NULL != jTransform) + if (nullptr != jTransform) { ScriptConversion::convert(jTransform, transform); } @@ -210,7 +210,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEventLoc(JNIEnv * JavaStringParam localEventSourceType(eventSourceType); JavaStringParam localEventDestType(eventDestType); - ServerObject* so = NULL; + ServerObject* so = nullptr; if(!JavaLibrary::getObject(client, so)) return JNI_FALSE; Client* c = so->getClient(); @@ -281,7 +281,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEffectObj(JNIEnv { JavaStringParam localEffectName(effectName); - ServerObject* so = NULL; + ServerObject* so = nullptr; if(!JavaLibrary::getObject(objectToPlayEffectOn, so)) return JNI_FALSE; /* TPERRY - This isn't used @@ -293,7 +293,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEffectObj(JNIEnv if (!objectToPlayEffectOn) return JNI_FALSE; - ServerObject* target = NULL; + ServerObject* target = nullptr; if(!JavaLibrary::getObject(objectToPlayEffectOn, target)) return JNI_FALSE; if(!target) @@ -307,7 +307,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEffectObj(JNIEnv //get the hardpoint std::string hp; - if (NULL != jHardpoint) + if (nullptr != jHardpoint) { JavaStringParam localHardpoint(jHardpoint); JavaLibrary::convert(localHardpoint, hp); @@ -315,14 +315,14 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEffectObj(JNIEnv //get the transform Transform transform; - if (NULL != jTransform) + if (nullptr != jTransform) { ScriptConversion::convert(jTransform, transform); } //get the optional labelName std::string strLabelName; - if (NULL != labelName) + if (nullptr != labelName) { JavaStringParam localLabel(labelName); JavaLibrary::convert(localLabel, strLabelName); @@ -360,7 +360,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEffectObjLimited( if (!objectToPlayEffectOn) return JNI_FALSE; - ServerObject* target = NULL; + ServerObject* target = nullptr; if(!JavaLibrary::getObject(objectToPlayEffectOn, target)) return JNI_FALSE; if(!target) @@ -374,7 +374,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEffectObjLimited( //get the hardpoint std::string hp; - if (NULL != jHardpoint) + if (nullptr != jHardpoint) { JavaStringParam localHardpoint(jHardpoint); JavaLibrary::convert(localHardpoint, hp); @@ -382,14 +382,14 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEffectObjLimited( //get the transform Transform transform; - if (NULL != jTransform) + if (nullptr != jTransform) { ScriptConversion::convert(jTransform, transform); } //get the optional labelName std::string strLabelName; - if (NULL != labelName) + if (nullptr != labelName) { JavaStringParam localLabel(labelName); JavaLibrary::convert(localLabel, strLabelName); @@ -419,7 +419,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEffectLoc(JNIEnv { JavaStringParam localEffectName(effectName); - ServerObject* so = NULL; + ServerObject* so = nullptr; if(!JavaLibrary::getObject(client, so)) return JNI_FALSE; @@ -444,7 +444,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEffectLoc(JNIEnv //get the optional labelName std::string strLabelName; - if (NULL != labelName) + if (nullptr != labelName) { JavaStringParam localLabel(labelName); JavaLibrary::convert(localLabel, strLabelName); @@ -482,7 +482,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEffectLocLimited( //get the optional labelName std::string strLabelName; - if (NULL != labelName) + if (nullptr != labelName) { JavaStringParam localLabel(labelName); JavaLibrary::convert(localLabel, strLabelName); @@ -501,7 +501,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playUiEffect(JNIEnv * /*env { JavaStringParam localUiEffectString(uiEffectString); - ServerObject* so = NULL; + ServerObject* so = nullptr; if(!JavaLibrary::getObject(client, so)) { NetworkId const networkId(client); @@ -531,7 +531,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::stopClientEffectObjByLabel( { JavaStringParam localLabel(labelName); - ServerObject* so = NULL; + ServerObject* so = nullptr; if(!JavaLibrary::getObject(objectEffectIsOn, so)) return JNI_FALSE; @@ -545,7 +545,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::stopClientEffectObjByLabel( if (!objectEffectIsOn) return JNI_FALSE; - ServerObject* target = NULL; + ServerObject* target = nullptr; if(!JavaLibrary::getObject(objectEffectIsOn, target)) return JNI_FALSE; if(!target) @@ -578,7 +578,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::stopClientEffectObjByLabelL if (!objectEffectIsOn) return JNI_FALSE; - ServerObject* target = NULL; + ServerObject* target = nullptr; if(!JavaLibrary::getObject(objectEffectIsOn, target)) return JNI_FALSE; if(!target) @@ -604,7 +604,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::play2dNonLoopingMusic(JNIEn { JavaStringParam localMusicName(musicName); - ServerObject* so = NULL; + ServerObject* so = nullptr; if (!JavaLibrary::getObject(client, so)) return JNI_FALSE; Client* c = so->getClient(); @@ -628,7 +628,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::play2dNonLoopingSound(JNIEn { JavaStringParam localMusicName(musicName); - ServerObject* so = NULL; + ServerObject* so = nullptr; if (!JavaLibrary::getObject(client, so)) return JNI_FALSE; Client* c = so->getClient(); @@ -652,7 +652,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playMusicWithParms(JNIEnv * { JavaStringParam localMusicName(musicName); - ServerObject* so = NULL; + ServerObject* so = nullptr; if (!JavaLibrary::getObject(client, so)) return JNI_FALSE; Client* c = so->getClient(); @@ -676,7 +676,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::createClientProjectile(JNIE { JavaStringParam localWeaponObjectTemplateName(weaponObjectTemplateName); - ServerObject* so = NULL; + ServerObject* so = nullptr; if (!JavaLibrary::getObject(client, so)) return JNI_FALSE; @@ -718,7 +718,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::createClientProjectileObjec { JavaStringParam localWeaponObjectTemplateName(weaponObjectTemplateName); - ServerObject* so = NULL; + ServerObject* so = nullptr; if (!JavaLibrary::getObject(client, so)) return JNI_FALSE; @@ -734,14 +734,14 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::createClientProjectileObjec return JNI_FALSE; // Get our source object - ServerObject* sourceObject = NULL; + ServerObject* sourceObject = nullptr; if (!JavaLibrary::getObject(source, sourceObject)) return JNI_FALSE; NetworkId sourceId = sourceObject->getNetworkId(); // The target of our effect - ServerObject* targetObject = NULL; + ServerObject* targetObject = nullptr; if (!JavaLibrary::getObject(target, targetObject)) return JNI_FALSE; @@ -759,8 +759,8 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::createClientProjectileObjec // Source's Cell ID CellProperty const * const cellProperty = sourceObject->getParentCell(); - Object const * const cellObject = (cellProperty != NULL) ? &cellProperty->getOwner() : NULL; - NetworkId const & networkIdForCellOrWorld = (cellObject != NULL) ? cellObject->getNetworkId() : NetworkId::cms_invalid; + Object const * const cellObject = (cellProperty != nullptr) ? &cellProperty->getOwner() : nullptr; + NetworkId const & networkIdForCellOrWorld = (cellObject != nullptr) ? cellObject->getNetworkId() : NetworkId::cms_invalid; CreateClientProjectileObjectToObjectMessage const ccpmoto(weaponObjectTemplateNameString, sourceId, sourceHardpointString, networkIdForCellOrWorld, targetId, targetHardpointString, speed, expiration, trail, PackedArgb(static_cast(a), static_cast(r), static_cast(g), static_cast(b)).getArgb()); @@ -776,7 +776,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::createClientProjectileObje { JavaStringParam localWeaponObjectTemplateName(weaponObjectTemplateName); - ServerObject* so = NULL; + ServerObject* so = nullptr; if (!JavaLibrary::getObject(client, so)) return JNI_FALSE; @@ -792,7 +792,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::createClientProjectileObje return JNI_FALSE; // Get our source object - ServerObject* sourceObject = NULL; + ServerObject* sourceObject = nullptr; if (!JavaLibrary::getObject(source, sourceObject)) return JNI_FALSE; @@ -812,8 +812,8 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::createClientProjectileObje // Source's Cell ID CellProperty const * const cellProperty = sourceObject->getParentCell(); - Object const * const cellObject = (cellProperty != NULL) ? &cellProperty->getOwner() : NULL; - NetworkId const & networkIdForCellOrWorld = (cellObject != NULL) ? cellObject->getNetworkId() : NetworkId::cms_invalid; + Object const * const cellObject = (cellProperty != nullptr) ? &cellProperty->getOwner() : nullptr; + NetworkId const & networkIdForCellOrWorld = (cellObject != nullptr) ? cellObject->getNetworkId() : NetworkId::cms_invalid; CreateClientProjectileObjectToLocationMessage const ccpmotl(weaponObjectTemplateNameString, sourceId, sourceHardpointString, networkIdForCellOrWorld, targetLocationVec, speed, expiration, trail, PackedArgb(static_cast(a), static_cast(r), static_cast(g), static_cast(b)).getArgb()); @@ -829,7 +829,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::createClientProjectileLocat { JavaStringParam localWeaponObjectTemplateName(weaponObjectTemplateName); - ServerObject* so = NULL; + ServerObject* so = nullptr; if (!JavaLibrary::getObject(client, so)) return JNI_FALSE; @@ -845,7 +845,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::createClientProjectileLocat return JNI_FALSE; // Get our target object - ServerObject* targetObject = NULL; + ServerObject* targetObject = nullptr; if (!JavaLibrary::getObject(target, targetObject)) return JNI_FALSE; @@ -865,8 +865,8 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::createClientProjectileLocat // Target's Cell ID CellProperty const * const cellProperty = targetObject->getParentCell(); - Object const * const cellObject = (cellProperty != NULL) ? &cellProperty->getOwner() : NULL; - NetworkId const & networkIdForCellOrWorld = (cellObject != NULL) ? cellObject->getNetworkId() : NetworkId::cms_invalid; + Object const * const cellObject = (cellProperty != nullptr) ? &cellProperty->getOwner() : nullptr; + NetworkId const & networkIdForCellOrWorld = (cellObject != nullptr) ? cellObject->getNetworkId() : NetworkId::cms_invalid; CreateClientProjectileLocationToObjectMessage const ccpmlto(weaponObjectTemplateNameString, sourceLocationVec, networkIdForCellOrWorld, targetId, targetHardpointString, speed, expiration, trail, PackedArgb(static_cast(a), static_cast(r), static_cast(g), static_cast(b)).getArgb()); @@ -878,7 +878,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::createClientProjectileLocat void JNICALL ScriptMethodsClientEffectNamespace::addObjectEffect(JNIEnv * env, jobject self, jlong obj, jstring filename, jstring hardpoint, jobject offset, jfloat scale, jstring label) { - ServerObject* so = NULL; + ServerObject* so = nullptr; if (!JavaLibrary::getObject(obj, so)) return; @@ -909,7 +909,7 @@ void JNICALL ScriptMethodsClientEffectNamespace::addObjectEffect(JNIEnv * env, j } void JNICALL ScriptMethodsClientEffectNamespace::removeObjectEffect(JNIEnv * env, jobject self, jlong obj, jstring label) { - ServerObject* so = NULL; + ServerObject* so = nullptr; if (!JavaLibrary::getObject(obj, so)) return; @@ -929,7 +929,7 @@ void JNICALL ScriptMethodsClientEffectNamespace::removeObjectEffect(JNIEnv * env void JNICALL ScriptMethodsClientEffectNamespace::removeAllObjectEffects(JNIEnv * env, jobject self, jlong obj) { - ServerObject* so = NULL; + ServerObject* so = nullptr; if (!JavaLibrary::getObject(obj, so)) return; @@ -942,7 +942,7 @@ void JNICALL ScriptMethodsClientEffectNamespace::removeAllObjectEffects(JNIEnv * jboolean JNICALL ScriptMethodsClientEffectNamespace::hasObjectEffect(JNIEnv * env, jobject self, jlong obj, jstring label) { - ServerObject* so = NULL; + ServerObject* so = nullptr; if (!JavaLibrary::getObject(obj, so)) return JNI_FALSE; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsClusterWideData.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsClusterWideData.cpp index 19df09ef..a93b72ae 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsClusterWideData.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsClusterWideData.cpp @@ -69,7 +69,7 @@ const JNINativeMethod NATIVES[] = { */ LocalRefPtr JavaLibrary::convert(const ValueDictionary & source) { - if (ms_env == NULL) + if (ms_env == nullptr) return LocalRef::cms_nullPtr; // create the dictionary @@ -150,7 +150,7 @@ void JavaLibrary::convert(const jobject & source, ValueDictionary & target) target.clear(); JNIEnv * env = getEnv(); - if (env == NULL) + if (env == nullptr) return; if (!env->IsInstanceOf(source, ms_clsDictionary)) diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsCombat.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsCombat.cpp index a12763bb..fdb842bc 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsCombat.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsCombat.cpp @@ -211,12 +211,12 @@ const JNINativeMethod NATIVES[] = { void JavaLibrary::setupWeaponCombatData(JNIEnv *env, const WeaponObject * weapon, jobject weaponData) { - if (env == NULL || weaponData == NULL) + if (env == nullptr || weaponData == nullptr) return; - if (weapon == NULL) + if (weapon == nullptr) { - env->SetObjectField(weaponData, ms_fidCombatEngineWeaponDataId, NULL); + env->SetObjectField(weaponData, ms_fidCombatEngineWeaponDataId, nullptr); return; } @@ -252,7 +252,7 @@ jint JNICALL ScriptMethodsCombatNamespace::getCombatDuration(JNIEnv * /*env*/, j NetworkId const networkId(object); TangibleObject const * const tangibleObject = TangibleObject::getTangibleObject(networkId); - if (tangibleObject == NULL) + if (tangibleObject == nullptr) { return 0; } @@ -267,7 +267,7 @@ jint JNICALL ScriptMethodsCombatNamespace::getCombatDuration(JNIEnv * /*env*/, j * @param self class calling this function * @param target id of the creature * - * @return the object id of the weapon, or NULL on error + * @return the object id of the weapon, or nullptr on error */ jlong JNICALL ScriptMethodsCombatNamespace::getCurrentWeapon(JNIEnv *env, jobject self, jlong target) { @@ -278,7 +278,7 @@ jlong JNICALL ScriptMethodsCombatNamespace::getCurrentWeapon(JNIEnv *env, jobjec return 0; const WeaponObject * weapon = creature->getCurrentWeapon(); - if (weapon == NULL) + if (weapon == nullptr) return 0; return (weapon->getNetworkId()).getValue(); @@ -313,7 +313,7 @@ jboolean JNICALL ScriptMethodsCombatNamespace::setCurrentWeapon(JNIEnv *env, job * @param self class calling this function * @param target id of the creature * - * @return the object id of the weapon, or NULL on error + * @return the object id of the weapon, or nullptr on error */ jlong JNICALL ScriptMethodsCombatNamespace::getHeldWeapon(JNIEnv *env, jobject self, jlong target) { @@ -324,7 +324,7 @@ jlong JNICALL ScriptMethodsCombatNamespace::getHeldWeapon(JNIEnv *env, jobject s return 0; const WeaponObject * weapon = creature->getReadiedWeapon(); - if (weapon == NULL) + if (weapon == nullptr) return 0; return (weapon->getNetworkId()).getValue(); @@ -337,7 +337,7 @@ jlong JNICALL ScriptMethodsCombatNamespace::getHeldWeapon(JNIEnv *env, jobject s * @param self class calling this function * @param target id of the creature * - * @return the object id of the default weapon, or NULL on error + * @return the object id of the default weapon, or nullptr on error */ jlong JNICALL ScriptMethodsCombatNamespace::getDefaultWeapon(JNIEnv *env, jobject self, jlong target) { @@ -348,7 +348,7 @@ UNREF(self); return 0; const WeaponObject * weapon = creature->getDefaultWeapon(); - if (weapon == NULL) + if (weapon == nullptr) return 0; return (weapon->getNetworkId()).getValue(); @@ -422,7 +422,7 @@ jboolean JNICALL ScriptMethodsCombatNamespace::isDefaultWeapon(JNIEnv *env, jobj return JNI_FALSE; const CreatureObject * owner = dynamic_cast(ContainerInterface::getContainedByObject(*weapon)); - if (owner == NULL || owner->getDefaultWeapon() != weapon) + if (owner == nullptr || owner->getDefaultWeapon() != weapon) return JNI_FALSE; return JNI_TRUE; @@ -441,7 +441,7 @@ jfloat JNICALL ScriptMethodsCombatNamespace::getMinRange(JNIEnv *env, jobject se { UNREF(self); - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return -1.0f; @@ -462,7 +462,7 @@ jfloat JNICALL ScriptMethodsCombatNamespace::getMaxRange(JNIEnv *env, jobject se { UNREF(self); - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return -1.0f; @@ -483,7 +483,7 @@ jfloat JNICALL ScriptMethodsCombatNamespace::getAverageDamage(JNIEnv *env, jobje { UNREF(self); - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return 0; @@ -506,7 +506,7 @@ jint JNICALL ScriptMethodsCombatNamespace::getWeaponType(JNIEnv *env, jobject se { UNREF(self); - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return -1; @@ -527,7 +527,7 @@ jint JNICALL ScriptMethodsCombatNamespace::getWeaponAttackType(JNIEnv *env, jobj { UNREF(self); - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return -1; @@ -546,7 +546,7 @@ jint JNICALL ScriptMethodsCombatNamespace::getWeaponDamageType(JNIEnv *env, jobj { UNREF(self); - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return -1; @@ -590,7 +590,7 @@ jint JNICALL ScriptMethodsCombatNamespace::getWeaponMinDamage(JNIEnv *env, jobje { UNREF(self); - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return -1; @@ -636,7 +636,7 @@ jint JNICALL ScriptMethodsCombatNamespace::getWeaponMaxDamage(JNIEnv *env, jobje { UNREF(self); - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return -1; @@ -682,7 +682,7 @@ jfloat JNICALL ScriptMethodsCombatNamespace::getWeaponAttackSpeed(JNIEnv *env, j { UNREF(self); - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return -1.0f; @@ -728,7 +728,7 @@ jfloat JNICALL ScriptMethodsCombatNamespace::getWeaponWoundChance(JNIEnv *env, j { UNREF(self); - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return -1.0f; @@ -743,13 +743,13 @@ jfloat JNICALL ScriptMethodsCombatNamespace::getWeaponWoundChance(JNIEnv *env, j * @param self class calling this function * @param weaponId the id of the weapon * - * @return the range info, or null on error + * @return the range info, or nullptr on error */ jobject JNICALL ScriptMethodsCombatNamespace::getWeaponRangeInfo(JNIEnv *env, jobject self, jlong weaponId) { UNREF(self); - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return 0; @@ -827,7 +827,7 @@ jfloat JNICALL ScriptMethodsCombatNamespace::getWeaponDamageRadius(JNIEnv *env, { UNREF(self); - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return -1.0f; @@ -865,7 +865,7 @@ jboolean JNICALL ScriptMethodsCombatNamespace::setWeaponDamageRadius(JNIEnv *env */ jfloat JNICALL ScriptMethodsCombatNamespace::getAudibleRange(JNIEnv *env, jobject self, jlong weaponId) { - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return -1; @@ -887,7 +887,7 @@ jint JNICALL ScriptMethodsCombatNamespace::getWeaponAttackCost(JNIEnv *env, jobj { UNREF(self); - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return 0; @@ -932,7 +932,7 @@ jint JNICALL ScriptMethodsCombatNamespace::getWeaponAccuracy(JNIEnv *env, jobjec { UNREF(self); - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return 0; @@ -977,7 +977,7 @@ jint JNICALL ScriptMethodsCombatNamespace::getWeaponElementalType(JNIEnv *env, j { UNREF(self); - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return 0; @@ -1022,7 +1022,7 @@ jint JNICALL ScriptMethodsCombatNamespace::getWeaponElementalValue(JNIEnv *env, { UNREF(self); - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return 0; @@ -1218,7 +1218,7 @@ void _startCombat(char const * const functionName, jlong attacker, jlong defende NetworkId const attackerId(attacker); TangibleObject * const attackerTangibleObject = TangibleObject::getTangibleObject(attackerId); - if (attackerTangibleObject == NULL) + if (attackerTangibleObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsCombat::%s() Unable to resolve the attacker(%s) to a TangibleObject.", functionName, attackerId.getValueString().c_str())); return; @@ -1227,7 +1227,7 @@ void _startCombat(char const * const functionName, jlong attacker, jlong defende NetworkId const defenderId(defender); TangibleObject * const defenderTangibleObject = TangibleObject::getTangibleObject(defenderId); - if (defenderTangibleObject == NULL) + if (defenderTangibleObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsCombat::%s() attacker(%s) Unable to resolve the defender(%s) to a TangibleObject.", functionName, attackerId.getValueString().c_str(), defenderId.getValueString().c_str())); return; @@ -1302,7 +1302,7 @@ void JNICALL ScriptMethodsCombatNamespace::stopCombat(JNIEnv * /*env*/, jobject NetworkId const objectId(object); TangibleObject * const tangibleObject = TangibleObject::getTangibleObject(objectId); - if (tangibleObject == NULL) + if (tangibleObject == nullptr) { return; } @@ -1334,9 +1334,9 @@ int i; int attackerCount = 0; int defenderCount = 0; - if (attackers != NULL) + if (attackers != nullptr) attackerCount = env->GetArrayLength(attackers); - if (defenders != NULL) + if (defenders != nullptr) defenderCount = env->GetArrayLength(defenders); // get the attacker and weapon data @@ -1348,22 +1348,22 @@ int i; LocalRefPtr weaponData = getObjectArrayElement(LocalObjectArrayRefParam(weaponsData), i); if (!attackerId) { - WARNING(true, ("JavaLibrary::getCombatData got null attacker id")); + WARNING(true, ("JavaLibrary::getCombatData got nullptr attacker id")); return JNI_FALSE; } if (attackerData == LocalRef::cms_nullPtr) { - WARNING(true, ("JavaLibrary::getCombatData got null attacker data")); + WARNING(true, ("JavaLibrary::getCombatData got nullptr attacker data")); return JNI_FALSE; } if (weaponData == LocalRef::cms_nullPtr) { - WARNING(true, ("JavaLibrary::getCombatData got null weapon data")); + WARNING(true, ("JavaLibrary::getCombatData got nullptr weapon data")); return JNI_FALSE; } // set up the attacker data - const TangibleObject * attacker = NULL; + const TangibleObject * attacker = nullptr; if (!JavaLibrary::getObject(attackerId, attacker)) { WARNING(true, ("JavaLibrary::getCombatData cannot get attacker object")); @@ -1377,7 +1377,7 @@ int i; ScriptConversion::convert(attacker->getPosition_p(), attacker->getSceneId(), attackerCell ? attackerCell->getNetworkId() : NetworkId::cms_invalid, location); - if (location.get() == NULL || location == LocalRef::cms_nullPtr) + if (location.get() == nullptr || location == LocalRef::cms_nullPtr) { WARNING(true, ("JavaLibrary::getCombatData cannot convert local position " "of attacker %s to Java", attacker->getNetworkId().getValueString().c_str())); @@ -1390,7 +1390,7 @@ int i; ScriptConversion::convert(attacker->getPosition_w(), attacker->getSceneId(), CellProperty::getWorldCellProperty()->getOwner().getNetworkId(), worldLocation); - if (worldLocation.get() == NULL || worldLocation == LocalRef::cms_nullPtr) + if (worldLocation.get() == nullptr || worldLocation == LocalRef::cms_nullPtr) { WARNING(true, ("JavaLibrary::getCombatData cannot convert world position " "of attacker %s to Java", attacker->getNetworkId().getValueString().c_str())); @@ -1398,14 +1398,14 @@ int i; } } - const WeaponObject * weapon = NULL; + const WeaponObject * weapon = nullptr; bool isCreature = false; int posture = 0; int locomotion = 0; int weaponSkill = 0; int aims = 0; const CreatureObject * creature = dynamic_cast(attacker); - if (creature != NULL) + if (creature != nullptr) { isCreature = true; posture = creature->getPosture(); @@ -1419,7 +1419,7 @@ int i; CombatEngineData::CombatData const * combatData = attacker->getCombatData(); - if (combatData != NULL) + if (combatData != nullptr) { aims = combatData->attackData.aims; } @@ -1446,17 +1446,17 @@ int i; LocalRefPtr defenderData = getObjectArrayElement(LocalObjectArrayRefParam(defendersData), i); if (!defenderId) { - WARNING(true, ("JavaLibrary::getCombatData got null defender id")); + WARNING(true, ("JavaLibrary::getCombatData got nullptr defender id")); return JNI_FALSE; } if (defenderData == LocalRef::cms_nullPtr) { - WARNING(true, ("JavaLibrary::getCombatData got null defender data")); + WARNING(true, ("JavaLibrary::getCombatData got nullptr defender data")); return JNI_FALSE; } // set up the defender data - const TangibleObject * defender = NULL; + const TangibleObject * defender = nullptr; if (!JavaLibrary::getObject(defenderId, defender)) { WARNING(true, ("JavaLibrary::getCombatData cannot get defender object")); @@ -1470,7 +1470,7 @@ int i; ScriptConversion::convert(defender->getPosition_p(), defender->getSceneId(), defenderCell ? defenderCell->getNetworkId() : NetworkId::cms_invalid, location); - if (location.get() == NULL || location == LocalRef::cms_nullPtr) + if (location.get() == nullptr || location == LocalRef::cms_nullPtr) { WARNING(true, ("JavaLibrary::getCombatData cannot convert local position " "of defender %s to Java", defender->getNetworkId().getValueString().c_str())); @@ -1483,7 +1483,7 @@ int i; ScriptConversion::convert(defender->getPosition_w(), defender->getSceneId(), CellProperty::getWorldCellProperty()->getOwner().getNetworkId(), worldLocation); - if (worldLocation.get() == NULL || worldLocation == LocalRef::cms_nullPtr) + if (worldLocation.get() == nullptr || worldLocation == LocalRef::cms_nullPtr) { WARNING(true, ("JavaLibrary::getCombatData cannot convert world position " "of defender %s to Java", defender->getNetworkId().getValueString().c_str())); @@ -1497,7 +1497,7 @@ int i; int combatSkeleton = defender->getCombatSkeleton(); int cover = 0; const CreatureObject * creature = dynamic_cast(defender); - if (creature != NULL) + if (creature != nullptr) { isCreature = true; posture = creature->getPosture(); @@ -1557,7 +1557,7 @@ jboolean JNICALL ScriptMethodsCombatNamespace::getWeaponData(JNIEnv *env, jobjec if (weapon == 0 || weaponData == 0) return JNI_FALSE; - const WeaponObject * localWeapon = NULL; + const WeaponObject * localWeapon = nullptr; if (!JavaLibrary::getObject(weapon, localWeapon)) return JNI_FALSE; @@ -1587,15 +1587,15 @@ jboolean JNICALL ScriptMethodsCombatNamespace::doDamage(JNIEnv *env, jobject sel if (damage <= 0) return JNI_TRUE; - TangibleObject * attacker = NULL; + TangibleObject * attacker = nullptr; if (!JavaLibrary::getObject(attackerId, attacker)) return JNI_FALSE; - TangibleObject * defender = NULL; + TangibleObject * defender = nullptr; if (!JavaLibrary::getObject(defenderId, defender)) return JNI_FALSE; - WeaponObject * weapon = NULL; + WeaponObject * weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return JNI_FALSE; @@ -1627,11 +1627,11 @@ jboolean JNICALL ScriptMethodsCombatNamespace::doDamageNoWeapon(JNIEnv *env, job if (damage <= 0) return JNI_TRUE; - TangibleObject * attacker = NULL; + TangibleObject * attacker = nullptr; if (!JavaLibrary::getObject(attackerId, attacker)) return JNI_FALSE; - TangibleObject * defender = NULL; + TangibleObject * defender = nullptr; if (!JavaLibrary::getObject(defenderId, defender)) return JNI_FALSE; @@ -1699,7 +1699,7 @@ jboolean JNICALL ScriptMethodsCombatNamespace::doCombatResults(JNIEnv *env, jobj { message->setAttacker(attacker, weapon); CreatureObject * creature = dynamic_cast(attacker.getObject()); - if (creature != NULL) + if (creature != nullptr) { Postures::Enumerator posture = static_cast( env->GetIntField(attackerResult, JavaLibrary::getFidBaseClassAttackerResultsPosture())); @@ -1816,7 +1816,7 @@ jboolean JNICALL ScriptMethodsCombatNamespace::doCombatResults(JNIEnv *env, jobj // send the message Controller *const controller = attacker.getObject()->getController(); - if (controller != NULL) + if (controller != nullptr) { float f_hold_ms = ConfigServerGame::getCombatDamageDelaySeconds() * 1000.0f; if ( f_hold_ms < 1.0 ) // 0 hold time (allowing for rounding error) @@ -1834,7 +1834,7 @@ jboolean JNICALL ScriptMethodsCombatNamespace::doCombatResults(JNIEnv *env, jobj { MessageQueueCombatAction *held = (MessageQueueCombatAction*)controller->peekHeldMessage( CM_combatAction ); bool b_merge = true; - if ( held == NULL ) + if ( held == nullptr ) b_merge = false; else if ( held->getComparisonChecksum() != message->getComparisonChecksum() ) b_merge = false; @@ -1900,24 +1900,24 @@ jboolean JNICALL ScriptMethodsCombatNamespace::callDefenderCombatAction(JNIEnv * { // use the attacker's current weapon CreatureObject * creatureAttacker = dynamic_cast(attackerId.getObject()); - if (creatureAttacker != NULL) + if (creatureAttacker != nullptr) { const WeaponObject * weaponObject = creatureAttacker->getCurrentWeapon(); - if (weaponObject != NULL) + if (weaponObject != nullptr) weaponId = weaponObject->getNetworkId(); } else { const WeaponObject * weaponAttacker = dynamic_cast( attackerId.getObject()); - if (weaponAttacker != NULL) + if (weaponAttacker != nullptr) weaponId = weaponAttacker->getNetworkId(); } } // call the trigger for each defender - jint * resultsArray = env->GetIntArrayElements(results, NULL); - if (resultsArray == NULL) + jint * resultsArray = env->GetIntArrayElements(results, nullptr); + if (resultsArray == nullptr) return JNI_FALSE; for (jsize i = 0; i < defenderCount; ++i) @@ -1927,11 +1927,11 @@ jboolean JNICALL ScriptMethodsCombatNamespace::callDefenderCombatAction(JNIEnv * if (defender) { CachedNetworkId defenderId(defender); - if (defenderId.getObject() != NULL) + if (defenderId.getObject() != nullptr) { ServerObject * defenderObject = safe_cast( defenderId.getObject()); - if (defenderObject->getScriptObject() != NULL) + if (defenderObject->getScriptObject() != nullptr) { ScriptParams params; params.addParam(attackerId); @@ -1961,7 +1961,7 @@ jboolean JNICALL ScriptMethodsCombatNamespace::callDefenderCombatAction(JNIEnv * */ void JNICALL ScriptMethodsCombatNamespace::setWantSawAttackTriggers(JNIEnv *env, jobject self, jlong obj, jboolean enable) { - TangibleObject * tangible = NULL; + TangibleObject * tangible = nullptr; if (!JavaLibrary::getObject(obj, tangible)) { @@ -2021,7 +2021,7 @@ jboolean JNICALL ScriptMethodsCombatNamespace::addSlowDownEffect(JNIEnv *env, jo return JNI_FALSE; } - CreatureObject * attackerObject = NULL; + CreatureObject * attackerObject = nullptr; if (!JavaLibrary::getObject(attacker, attackerObject)) { WARNING(true, ("[script bug] JavaLibrary::addSlowDownEffect called " @@ -2029,7 +2029,7 @@ jboolean JNICALL ScriptMethodsCombatNamespace::addSlowDownEffect(JNIEnv *env, jo return JNI_FALSE; } - const TangibleObject * defenderObject = NULL; + const TangibleObject * defenderObject = nullptr; if (!JavaLibrary::getObject(defender, defenderObject)) { WARNING(true, ("[script bug] JavaLibrary::addSlowDownEffect called " @@ -2057,7 +2057,7 @@ jboolean JNICALL ScriptMethodsCombatNamespace::addSlowDownEffect(JNIEnv *env, jo */ jboolean JNICALL ScriptMethodsCombatNamespace::removeSlowDownEffect(JNIEnv *env, jobject self, jlong attacker) { - CreatureObject * attackerObject = NULL; + CreatureObject * attackerObject = nullptr; if (!JavaLibrary::getObject(attacker, attackerObject)) { WARNING(true, ("[script bug] JavaLibrary::removeSlowDownEffect called " @@ -2090,14 +2090,14 @@ void JNICALL ScriptMethodsCombatNamespace::sendCombatSpam(JNIEnv *env, jobject s { NetworkId attackerId(attacker); ServerObject * attackerObj = safe_cast(NetworkIdManager::getObjectById(attackerId)); - if (attackerObj == NULL) + if (attackerObj == nullptr) { WARNING(true, ("WARNING: JavaLibrary::sendCombatSpam could not find attacker for id %s", attackerId.getValueString().c_str())); return; } NetworkId defenderId(defender); - Object const * const defenderObj = (defenderId.isValid() ? NetworkIdManager::getObjectById(defenderId) : NULL); + Object const * const defenderObj = (defenderId.isValid() ? NetworkIdManager::getObjectById(defenderId) : nullptr); NetworkId weaponId(weapon); StringId attackNameSid; @@ -2189,14 +2189,14 @@ void JNICALL ScriptMethodsCombatNamespace::sendCombatSpamWeaponString(JNIEnv *en { NetworkId attackerId(attacker); ServerObject * attackerObj = safe_cast(NetworkIdManager::getObjectById(attackerId)); - if (attackerObj == NULL) + if (attackerObj == nullptr) { WARNING(true, ("WARNING: JavaLibrary::sendCombatSpam could not find attacker for id %s", attackerId.getValueString().c_str())); return; } NetworkId defenderId(defender); - Object const * const defenderObj = (defenderId.isValid() ? NetworkIdManager::getObjectById(defenderId) : NULL); + Object const * const defenderObj = (defenderId.isValid() ? NetworkIdManager::getObjectById(defenderId) : nullptr); StringId weaponNameSid; if (!ScriptConversion::convert(weaponName, weaponNameSid)) @@ -2287,12 +2287,12 @@ void JNICALL ScriptMethodsCombatNamespace::sendCombatSpamWeaponString(JNIEnv *en */ void JNICALL ScriptMethodsCombatNamespace::sendCombatSpamMessage(JNIEnv *env, jobject self, jlong attacker, jlong defender, jobject message, jboolean sendToAttacker, jboolean sendToDefender, jboolean sendToBystanders, jint spamType) { - ServerObject * attackerObj = NULL; + ServerObject * attackerObj = nullptr; if (!JavaLibrary::getObject(attacker, attackerObj)) return; NetworkId defenderId(defender); - Object const * const defenderObj = (defenderId.isValid() ? NetworkIdManager::getObjectById(defenderId) : NULL); + Object const * const defenderObj = (defenderId.isValid() ? NetworkIdManager::getObjectById(defenderId) : nullptr); StringId messageSid; if (!ScriptConversion::convert(message, messageSid)) @@ -2322,12 +2322,12 @@ void JNICALL ScriptMethodsCombatNamespace::sendCombatSpamMessage(JNIEnv *env, jo */ void JNICALL ScriptMethodsCombatNamespace::sendCombatSpamMessageCGP(JNIEnv *env, jobject self, jlong attacker, jlong defender, jobject message, jboolean sendToAttacker, jboolean sendToDefender, jboolean sendToBystanders, jboolean critical, jboolean glancing, jboolean proc, jint spamType) { - ServerObject * attackerObj = NULL; + ServerObject * attackerObj = nullptr; if (!JavaLibrary::getObject(attacker, attackerObj)) return; NetworkId defenderId(defender); - Object const * const defenderObj = (defenderId.isValid() ? NetworkIdManager::getObjectById(defenderId) : NULL); + Object const * const defenderObj = (defenderId.isValid() ? NetworkIdManager::getObjectById(defenderId) : nullptr); StringId messageSid; if (!ScriptConversion::convert(message, messageSid)) @@ -2353,12 +2353,12 @@ void JNICALL ScriptMethodsCombatNamespace::sendCombatSpamMessageCGP(JNIEnv *env, */ void JNICALL ScriptMethodsCombatNamespace::sendCombatSpamMessageOob(JNIEnv *env, jobject self, jlong attacker, jlong defender, jstring oob, jboolean sendToAttacker, jboolean sendToDefender, jboolean sendToBystanders, jint spamType) { - ServerObject * attackerObj = NULL; + ServerObject * attackerObj = nullptr; if (!JavaLibrary::getObject(attacker, attackerObj)) return; NetworkId defenderId(defender); - Object const * const defenderObj = (defenderId.isValid() ? NetworkIdManager::getObjectById(defenderId) : NULL); + Object const * const defenderObj = (defenderId.isValid() ? NetworkIdManager::getObjectById(defenderId) : nullptr); Unicode::String oobString; if (!JavaLibrary::convert(JavaStringParam(oob), oobString)) diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsCommandQueue.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsCommandQueue.cpp index 2e400a0b..c95a74cb 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsCommandQueue.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsCommandQueue.cpp @@ -97,7 +97,7 @@ jboolean JNICALL ScriptMethodsCommandQueueNamespace::queueCommand(JNIEnv *env, j NetworkId actorId(actor); TangibleObject * const actorTangibleObject = TangibleObject::getTangibleObject(actorId); - if (actorTangibleObject == NULL) + if (actorTangibleObject == nullptr) { WARNING(true, ("JavaLibrary::queueCommand() Unable to resolve actor(%s) to a TangibleObject", actorId.getValueString().c_str())); return JNI_FALSE; @@ -142,7 +142,7 @@ jboolean JNICALL ScriptMethodsCommandQueueNamespace::queueClear(JNIEnv *env, job NetworkId actorId(actor); TangibleObject * const actorTangibleObject = TangibleObject::getTangibleObject(actorId); - if (actorTangibleObject == NULL) + if (actorTangibleObject == nullptr) { WARNING(true, ("JavaLibrary::queueClear() Unable to resolve actor(%s) to a TangibleObject", actorId.getValueString().c_str())); return JNI_FALSE; @@ -170,7 +170,7 @@ jboolean JNICALL ScriptMethodsCommandQueueNamespace::queueHasCommandFromGroup(JN NetworkId actorId(actor); TangibleObject * const actorTangibleObject = TangibleObject::getTangibleObject(actorId); - if (actorTangibleObject == NULL) + if (actorTangibleObject == nullptr) { WARNING(true, ("JavaLibrary::queueHasCommandFromGroup() Unable to resolve actor(%s) to a TangibleObject", actorId.getValueString().c_str())); return JNI_FALSE; @@ -196,7 +196,7 @@ jboolean JNICALL ScriptMethodsCommandQueueNamespace::queueClearCommandsFromGroup NetworkId actorId(actor); TangibleObject * const actorTangibleObject = TangibleObject::getTangibleObject(actorId); - if (actorTangibleObject == NULL) + if (actorTangibleObject == nullptr) { WARNING(true, ("JavaLibrary::queueClearCommandsFromGroup() Unable to resolve actor(%s) to a TangibleObject", actorId.getValueString().c_str())); return JNI_FALSE; @@ -239,14 +239,14 @@ jboolean JNICALL ScriptMethodsCommandQueueNamespace::setCommandTimerValue( JNIEn NetworkId actorId(actor); TangibleObject * const actorTangibleObject = TangibleObject::getTangibleObject(actorId); - if (actorTangibleObject == NULL) + if (actorTangibleObject == nullptr) { WARNING(true, ("JavaLibrary::setCommandTimerValue() Unable to resolve actor(%s) to a TangibleObject", actorId.getValueString().c_str())); return JNI_FALSE; } CommandQueue * const queue = actorTangibleObject->getCommandQueue(); - if (queue == NULL) + if (queue == nullptr) { WARNING(true, ("JavaLibrary::setCommandTimerValue() object(%s) does not have a CommandQueue", actorTangibleObject->getDebugInformation().c_str())); return JNI_FALSE; @@ -267,7 +267,7 @@ jint JNICALL ScriptMethodsCommandQueueNamespace::getCurrentCommand( JNIEnv *env, NetworkId actorId(actor); TangibleObject * const actorTangibleObject = TangibleObject::getTangibleObject(actorId); - if (actorTangibleObject == NULL) + if (actorTangibleObject == nullptr) { WARNING(true, ("JavaLibrary::getCurrentCommand() Unable to resolve actor(%s) to a TangibleObject", actorId.getValueString().c_str())); return 0; @@ -275,7 +275,7 @@ jint JNICALL ScriptMethodsCommandQueueNamespace::getCurrentCommand( JNIEnv *env, CommandQueue const * const queue = actorTangibleObject->getCommandQueue(); - if (queue == NULL) + if (queue == nullptr) { WARNING(true, ("JavaLibrary::getCurrentCommand() object(%s) does not have a CommandQueue", actorTangibleObject->getDebugInformation().c_str())); return 0; @@ -298,7 +298,7 @@ jfloat JNICALL ScriptMethodsCommandQueueNamespace::getCooldownTimeLeft( JNIEnv * NetworkId actorId(actor); TangibleObject * const actorTangibleObject = TangibleObject::getTangibleObject(actorId); - if (actorTangibleObject == NULL) + if (actorTangibleObject == nullptr) { WARNING(true, ("JavaLibrary::getCooldownTimeLeft() Unable to resolve actor(%s) to a TangibleObject", actorId.getValueString().c_str())); return 0.0f; @@ -306,7 +306,7 @@ jfloat JNICALL ScriptMethodsCommandQueueNamespace::getCooldownTimeLeft( JNIEnv * CommandQueue const * const queue = actorTangibleObject->getCommandQueue(); - if (queue == NULL) + if (queue == nullptr) { WARNING(true, ("JavaLibrary::getCooldownTimeLeft() object(%s) does not have a CommandQueue", actorTangibleObject->getDebugInformation().c_str())); return 0.0f; @@ -329,7 +329,7 @@ jfloat JNICALL ScriptMethodsCommandQueueNamespace::getCooldownTimeLeftString( JN NetworkId actorId(actor); TangibleObject * const actorTangibleObject = TangibleObject::getTangibleObject(actorId); - if (actorTangibleObject == NULL) + if (actorTangibleObject == nullptr) { WARNING(true, ("JavaLibrary::getCooldownTimeLeftString() Unable to resolve actor(%s) to a TangibleObject", actorId.getValueString().c_str())); return 0.0f; @@ -347,13 +347,13 @@ jfloat JNICALL ScriptMethodsCommandQueueNamespace::getCooldownTimeLeftString( JN CommandQueue const * const queue = actorTangibleObject->getCommandQueue(); float value = 0.0f; - if (queue == NULL) + if (queue == nullptr) { WARNING(true, ("JavaLibrary::getCooldownTimeLeftString() object(%s) does not have a CommandQueue", actorTangibleObject->getDebugInformation().c_str())); return 0.0f; } - if (queue != NULL) + if (queue != nullptr) { value = queue->getCooldownTimeLeft( out ); } @@ -369,7 +369,7 @@ void JNICALL ScriptMethodsCommandQueueNamespace::sendCooldownGroupTimingOnly(JNI NetworkId actorId(actor); CreatureObject * const actorCreatureObject = CreatureObject::getCreatureObject(actorId); - if (actorCreatureObject == NULL) + if (actorCreatureObject == nullptr) { WARNING(true, ("JavaLibrary::sendCooldownGroupTimingOnly() Unable to resolve actor(%s) to a CreatureObject", actorId.getValueString().c_str())); return; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsConsole.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsConsole.cpp index 9392677f..0355fb72 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsConsole.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsConsole.cpp @@ -52,10 +52,10 @@ void JNICALL ScriptMethodsConsoleNamespace::consoleSendMessageObjId(JNIEnv * env const ServerObject* player = 0; if(!JavaLibrary::getObject(_to, player)) { - DEBUG_WARNING (true, ("ScriptMethodsConsole JavaLibrary::consoleSendMessageObjId failed bad source object (not null)")); + DEBUG_WARNING (true, ("ScriptMethodsConsole JavaLibrary::consoleSendMessageObjId failed bad source object (not nullptr)")); if (ConfigServerScript::allowDebugConsoleMessages()) { - fprintf(stderr, "WARNING: ScriptMethodsConsole JavaLibrary::consoleSendMessageObjId: failed bad source object (not null)\n"); + fprintf(stderr, "WARNING: ScriptMethodsConsole JavaLibrary::consoleSendMessageObjId: failed bad source object (not nullptr)\n"); JavaLibrary::printJavaStack(); } return; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsContainers.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsContainers.cpp index 12a63612..acb9aba9 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsContainers.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsContainers.cpp @@ -136,7 +136,7 @@ const JNINativeMethod NATIVES[] = { jint JNICALL ScriptMethodsContainersNamespace::getContainerType(JNIEnv *env, jobject self, jlong container) { //@todo use enum - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) return 0; @@ -151,7 +151,7 @@ jint JNICALL ScriptMethodsContainersNamespace::getContainerType(JNIEnv *env, job jlongArray JNICALL ScriptMethodsContainersNamespace::getContents(JNIEnv *env, jobject self, jlong containerObj) { - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(containerObj, containerOwner)) return 0; @@ -190,7 +190,7 @@ jlongArray JNICALL ScriptMethodsContainersNamespace::getContents(JNIEnv *env, jo jlong JNICALL ScriptMethodsContainersNamespace::getContainedBy(JNIEnv *env, jobject self, jlong item) { - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(item, itemObj)) return 0; @@ -211,7 +211,7 @@ jboolean JNICALL ScriptMethodsContainersNamespace::contains(JNIEnv *env, jobject if (container_id.getValue() == 0) return JNI_FALSE; - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(item, itemObj)) return JNI_FALSE; @@ -226,11 +226,11 @@ jboolean JNICALL ScriptMethodsContainersNamespace::contains(JNIEnv *env, jobject jint JNICALL ScriptMethodsContainersNamespace::canPutIn(JNIEnv *env, jobject self, jlong target, jlong jcontainer) { const int unknownError = static_cast(Container::CEC_Unknown); - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(jcontainer, containerOwner)) return unknownError; - ServerObject * item = NULL; + ServerObject * item = nullptr; if (!JavaLibrary::getObject(target, item)) return unknownError; @@ -248,11 +248,11 @@ jint JNICALL ScriptMethodsContainersNamespace::canPutIn(JNIEnv *env, jobject sel jint JNICALL ScriptMethodsContainersNamespace::canPutInSlot(JNIEnv *env, jobject self, jlong target, jlong jcontainer, jstring slot) { const int unknownError = static_cast(Container::CEC_Unknown); - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(jcontainer, containerOwner)) return unknownError; - ServerObject * item = NULL; + ServerObject * item = nullptr; if (!JavaLibrary::getObject(target, item)) return unknownError; @@ -268,7 +268,7 @@ jint JNICALL ScriptMethodsContainersNamespace::canPutInSlot(JNIEnv *env, jobject if (slotId == SlotId::invalid) return static_cast(Container::CEC_NoSlot); - IGNORE_RETURN(ContainerInterface::canTransferToSlot(*containerOwner, *item, slotId, NULL, tmp)); + IGNORE_RETURN(ContainerInterface::canTransferToSlot(*containerOwner, *item, slotId, nullptr, tmp)); return static_cast(tmp); } @@ -279,7 +279,7 @@ jlong JNICALL ScriptMethodsContainersNamespace::getObjectInSlot(JNIEnv *env, job { JavaStringParam localSlot(slot); - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) return 0; @@ -301,7 +301,7 @@ jlong JNICALL ScriptMethodsContainersNamespace::getObjectInSlot(JNIEnv *env, job jlong JNICALL ScriptMethodsContainersNamespace::getFirstParentInWorld(JNIEnv *env, jobject self, jlong item) { - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(item, itemObj)) return 0; @@ -316,7 +316,7 @@ jlong JNICALL ScriptMethodsContainersNamespace::getFirstParentInWorld(JNIEnv *en jlong JNICALL ScriptMethodsContainersNamespace::getTopMostContainer(JNIEnv *env, jobject self, jlong item) { - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(item, itemObj)) return 0; @@ -331,7 +331,7 @@ jlong JNICALL ScriptMethodsContainersNamespace::getTopMostContainer(JNIEnv *env, jint JNICALL ScriptMethodsContainersNamespace::getNumItemsIn(JNIEnv *env, jobject self, jlong container) { - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) return 0; @@ -347,7 +347,7 @@ jint JNICALL ScriptMethodsContainersNamespace::getNumItemsIn(JNIEnv *env, jobjec void JNICALL ScriptMethodsContainersNamespace::destroyContents(JNIEnv *env, jobject self, jlong container) { #if 0 //@todo implement - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) return; @@ -359,11 +359,11 @@ void JNICALL ScriptMethodsContainersNamespace::destroyContents(JNIEnv *env, jobj jint JNICALL ScriptMethodsContainersNamespace::moveContents(JNIEnv *env, jobject self, jlong containerA, jlong containerB) { - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(containerA, containerOwner)) return 0; - ServerObject * targetContainer = NULL; + ServerObject * targetContainer = nullptr; if (!JavaLibrary::getObject(containerB, targetContainer)) return 0; @@ -377,7 +377,7 @@ jint JNICALL ScriptMethodsContainersNamespace::moveContents(JNIEnv *env, jobject for (; iter != container->end(); ++iter) { ServerObject* item = safe_cast((*iter).getObject()); - if (item && ContainerInterface::transferItemToGeneralContainer(*targetContainer, *item, NULL, tmp)) + if (item && ContainerInterface::transferItemToGeneralContainer(*targetContainer, *item, nullptr, tmp)) { ++count; } @@ -389,20 +389,20 @@ jint JNICALL ScriptMethodsContainersNamespace::moveContents(JNIEnv *env, jobject jint JNICALL ScriptMethodsContainersNamespace::moveObjects(JNIEnv *env, jobject self, jlongArray targets, jlong container) { - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) return 0; int count = 0; for (int i = 0; i < env->GetArrayLength(targets); ++i) { - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; jlong jlongTmp; env->GetLongArrayRegion(targets, i, 1, &jlongTmp); if (JavaLibrary::getObject(jlongTmp, itemObj)) { Container::ContainerErrorCode tmp = Container::CEC_Success; - if (ContainerInterface::transferItemToGeneralContainer(*containerOwner, *itemObj, NULL, tmp)) + if (ContainerInterface::transferItemToGeneralContainer(*containerOwner, *itemObj, nullptr, tmp)) { ++count; } @@ -417,15 +417,15 @@ jint JNICALL ScriptMethodsContainersNamespace::moveObjects(JNIEnv *env, jobject jboolean JNICALL ScriptMethodsContainersNamespace::putIn(JNIEnv *env, jobject self, jlong item, jlong container) { - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) return JNI_FALSE; - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(item, itemObj)) return JNI_FALSE; Container::ContainerErrorCode tmp = Container::CEC_Success; - return ContainerInterface::transferItemToGeneralContainer(*containerOwner, *itemObj, NULL, tmp); + return ContainerInterface::transferItemToGeneralContainer(*containerOwner, *itemObj, nullptr, tmp); } @@ -434,11 +434,11 @@ jboolean JNICALL ScriptMethodsContainersNamespace::putIn(JNIEnv *env, jobject se jboolean JNICALL ScriptMethodsContainersNamespace::putInPosition(JNIEnv *env, jobject self, jlong item, jlong container, jobject pos) { - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) return JNI_FALSE; - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(item, itemObj)) return JNI_FALSE; @@ -451,7 +451,7 @@ jboolean JNICALL ScriptMethodsContainersNamespace::putInPosition(JNIEnv *env, jo tr.setPosition_p(newPos); Container::ContainerErrorCode tmp = Container::CEC_Success; - return ContainerInterface::transferItemToCell(*containerOwner, *itemObj, tr, NULL, tmp); + return ContainerInterface::transferItemToCell(*containerOwner, *itemObj, tr, nullptr, tmp); } //-------------------------------------------------------------------------------------- @@ -459,20 +459,20 @@ jboolean JNICALL ScriptMethodsContainersNamespace::putInPosition(JNIEnv *env, jo jboolean JNICALL ScriptMethodsContainersNamespace::putInAndSendError(JNIEnv *env, jobject self, jlong item, jlong container, jlong player) { - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) return JNI_FALSE; - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(item, itemObj)) return JNI_FALSE; Container::ContainerErrorCode tmp = Container::CEC_Success; - bool retval = ContainerInterface::transferItemToGeneralContainer(*containerOwner, *itemObj, NULL, tmp); + bool retval = ContainerInterface::transferItemToGeneralContainer(*containerOwner, *itemObj, nullptr, tmp); if (!retval) { - ServerObject * playerObj = NULL; + ServerObject * playerObj = nullptr; if (!JavaLibrary::getObject(player, playerObj)) return JNI_FALSE; ContainerInterface::sendContainerMessageToClient(*playerObj, tmp); @@ -483,11 +483,11 @@ jboolean JNICALL ScriptMethodsContainersNamespace::putInAndSendError(JNIEnv *env //-------------------------------------------------------------------------------------- jboolean JNICALL ScriptMethodsContainersNamespace::putInOverloaded(JNIEnv *env, jobject self, jlong item, jlong container) { - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) return JNI_FALSE; - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(item, itemObj)) return JNI_FALSE; @@ -500,7 +500,7 @@ jboolean JNICALL ScriptMethodsContainersNamespace::putInOverloaded(JNIEnv *env, } else { - retval = ContainerInterface::transferItemToVolumeContainer(*containerOwner, *itemObj, NULL, tmp, true); + retval = ContainerInterface::transferItemToVolumeContainer(*containerOwner, *itemObj, nullptr, tmp, true); } return retval; @@ -509,11 +509,11 @@ jboolean JNICALL ScriptMethodsContainersNamespace::putInOverloaded(JNIEnv *env, //-------------------------------------------------------------------------------------- jboolean JNICALL ScriptMethodsContainersNamespace::equip(JNIEnv *env, jobject self, jlong item, jlong container) { - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) return JNI_FALSE; - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(item, itemObj)) return JNI_FALSE; @@ -521,7 +521,7 @@ jboolean JNICALL ScriptMethodsContainersNamespace::equip(JNIEnv *env, jobject se if (!test) return JNI_FALSE; Container::ContainerErrorCode tmp = Container::CEC_Success; - return ContainerInterface::transferItemToGeneralContainer(*containerOwner, *itemObj, NULL, tmp); + return ContainerInterface::transferItemToGeneralContainer(*containerOwner, *itemObj, nullptr, tmp); } @@ -532,11 +532,11 @@ jboolean JNICALL ScriptMethodsContainersNamespace::equipIn(JNIEnv *env, jobject JavaStringParam localSlot(slot); //@todo better error checking for invalid slot name. Do it above too. - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) return JNI_FALSE; - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(item, itemObj)) return JNI_FALSE; @@ -554,7 +554,7 @@ jboolean JNICALL ScriptMethodsContainersNamespace::equipIn(JNIEnv *env, jobject Container::ContainerErrorCode tmp = Container::CEC_Success; int arrangement = slotted ? slotted->getBestArrangementForSlot(slotName) : -1; - return ContainerInterface::transferItemToSlottedContainer(*containerOwner, *itemObj, arrangement, NULL, tmp); + return ContainerInterface::transferItemToSlottedContainer(*containerOwner, *itemObj, arrangement, nullptr, tmp); } @@ -565,14 +565,14 @@ jboolean JNICALL ScriptMethodsContainersNamespace::equipOverride(JNIEnv *env, j //This function will equip and object into the first valid arrangement, deleting objects if necessary. //Before it deletes things, it looks for a valid unoccupied arrangement. - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) { DEBUG_WARNING(true, ("JNI: EquipOverride param container could not be found")); return JNI_FALSE; } - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(item, itemObj)) { DEBUG_WARNING(true, ("JNI: EquipOverride param item could not be found")); @@ -592,7 +592,7 @@ jboolean JNICALL ScriptMethodsContainersNamespace::equipOverride(JNIEnv *env, j if (slotContainer->getFirstUnoccupiedArrangement(*itemObj, arrangement, tmp)) { //Found one - return ContainerInterface::transferItemToSlottedContainer(*containerOwner, *itemObj, arrangement, NULL, tmp); + return ContainerInterface::transferItemToSlottedContainer(*containerOwner, *itemObj, arrangement, nullptr, tmp); } //Couldn't find an unoccupied arrangement, so it's time to delete objects to make room for this one @@ -634,14 +634,14 @@ jboolean JNICALL ScriptMethodsContainersNamespace::equipOverride(JNIEnv *env, j } } - return ContainerInterface::transferItemToSlottedContainer(*containerOwner, *itemObj, arrangement, NULL, tmp); + return ContainerInterface::transferItemToSlottedContainer(*containerOwner, *itemObj, arrangement, nullptr, tmp); } //-------------------------------------------------------------------------------------- jint JNICALL ScriptMethodsContainersNamespace::getFilledVolume(JNIEnv *env, jobject self, jlong container) { - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) return 0; @@ -656,7 +656,7 @@ jint JNICALL ScriptMethodsContainersNamespace::getFilledVolume(JNIEnv *env, jobj jint JNICALL ScriptMethodsContainersNamespace::getTotalVolume(JNIEnv *env, jobject self, jlong container) { - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) return 0; @@ -672,7 +672,7 @@ jint JNICALL ScriptMethodsContainersNamespace::getTotalVolume(JNIEnv *env, jobje jint JNICALL ScriptMethodsContainersNamespace::getVolumeFree(JNIEnv *env, jobject self, jlong container) { - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) return 0; @@ -691,7 +691,7 @@ void JNICALL ScriptMethodsContainersNamespace::sendContainerErrorToClient(JNIEnv if (errorCode == 0) return; - ServerObject * playerObject = NULL; + ServerObject * playerObject = nullptr; if (!JavaLibrary::getObject(player, playerObject)) { DEBUG_WARNING(true, ("Player object not found in sendContainerErrorToClient")); @@ -767,7 +767,7 @@ void JNICALL ScriptMethodsContainersNamespace::moveToOfflinePlayerDatapadAndUnlo jboolean JNICALL ScriptMethodsContainersNamespace::isInSecureTrade(JNIEnv *env, jobject self, jlong item) { - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(item, itemObj)) return JNI_FALSE; @@ -807,7 +807,7 @@ void JNICALL ScriptMethodsContainersNamespace::fixLoadWith(JNIEnv *env, jobject jboolean JNICALL ScriptMethodsContainersNamespace::addUserToAccessList(JNIEnv *env, jobject self, jlong object, jlong user) { - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(object, itemObj)) return JNI_FALSE; @@ -829,7 +829,7 @@ jboolean JNICALL ScriptMethodsContainersNamespace::addUserToAccessList(JNIEnv *e jboolean JNICALL ScriptMethodsContainersNamespace::removeUserFromAccessList(JNIEnv * env, jobject self, jlong object, jlong user) { - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(object, itemObj)) return JNI_FALSE; @@ -851,7 +851,7 @@ jboolean JNICALL ScriptMethodsContainersNamespace::removeUserFromAccessList(JNIE jboolean JNICALL ScriptMethodsContainersNamespace::clearUserAccessList(JNIEnv * env, jobject self, jlong object) { - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(object, itemObj)) return JNI_FALSE; @@ -871,7 +871,7 @@ jboolean JNICALL ScriptMethodsContainersNamespace::clearUserAccessList(JNIEnv * jboolean JNICALL ScriptMethodsContainersNamespace::addGuildToAccessList(JNIEnv *env, jobject self, jlong object, jint guild) { - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(object, itemObj)) return JNI_FALSE; @@ -891,7 +891,7 @@ jboolean JNICALL ScriptMethodsContainersNamespace::addGuildToAccessList(JNIEnv * jboolean JNICALL ScriptMethodsContainersNamespace::removeGuildFromAccessList(JNIEnv * env, jobject self, jlong object, jint guild) { - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(object, itemObj)) return JNI_FALSE; @@ -911,7 +911,7 @@ jboolean JNICALL ScriptMethodsContainersNamespace::removeGuildFromAccessList(JNI jboolean JNICALL ScriptMethodsContainersNamespace::clearGuildAccessList(JNIEnv * env, jobject self, jlong object) { - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(object, itemObj)) return JNI_FALSE; @@ -931,7 +931,7 @@ jboolean JNICALL ScriptMethodsContainersNamespace::clearGuildAccessList(JNIEnv * jlongArray JNICALL ScriptMethodsContainersNamespace::getUserAccessList(JNIEnv * env, jobject self, jlong object) { - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(object, itemObj)) return JNI_FALSE; @@ -970,7 +970,7 @@ jlongArray JNICALL ScriptMethodsContainersNamespace::getUserAccessList(JNIEnv * jintArray JNICALL ScriptMethodsContainersNamespace::getGuildAccessList(JNIEnv * env, jobject self, jlong object) { - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(object, itemObj)) return JNI_FALSE; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsCrafting.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsCrafting.cpp index b5d325eb..735a0d23 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsCrafting.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsCrafting.cpp @@ -232,7 +232,7 @@ void ScriptMethodsCraftingNamespace::collectRangedIntVariableCallback(const std: * @param draftSchematic draft schematic the attribute belongs to * @param attribIndex index of the attribute * - * @return the attribute instance, or NULL on error + * @return the attribute instance, or nullptr on error */ LocalRefPtr JavaLibrary::createObjectAttribute(const ManufactureObjectInterface & manfSchematic, const DraftSchematicObject & draftSchematic, int attribIndex) @@ -291,7 +291,7 @@ LocalRefPtr JavaLibrary::createObjectAttribute(const ManufactureObjectInterface * @param manfSchematic manufacture schematic the attribute belongs to * @param attribName name of the attribute * - * @return the attribute instance, or NULL on error + * @return the attribute instance, or nullptr on error */ LocalRefPtr JavaLibrary::createExperimentAttribute(const ManufactureObjectInterface & manfSchematic, const StringId & attribName) @@ -341,7 +341,7 @@ int i; const DraftSchematicObject * draft = DraftSchematicObject::getSchematic( source.getDraftSchematic()); - if (draft == NULL) + if (draft == nullptr) return LocalRef::cms_nullPtr; LocalRefPtr target = allocObject(ms_clsDraftSchematic); @@ -501,7 +501,7 @@ int i; // set the customization info from the shared object template const ServerObjectTemplate * objectTemplate = draft->getCraftedObjectTemplate(); - if (objectTemplate == NULL) + if (objectTemplate == nullptr) { return LocalRef::cms_nullPtr; } @@ -509,7 +509,7 @@ int i; ObjectTemplateList::fetch(objectTemplate->getSharedTemplate())); const SharedTangibleObjectTemplate * sharedTangibleTemplate = dynamic_cast< const SharedTangibleObjectTemplate *>(sharedTemplate); - if (sharedTangibleTemplate != NULL) + if (sharedTangibleTemplate != nullptr) { // New method using the AssetCustomizationManager mechanism. @@ -818,9 +818,9 @@ int i; // set the created item template crc value const ServerObjectTemplate * craftedTemplate = source.getCraftedObjectTemplate(); - if (craftedTemplate == NULL) + if (craftedTemplate == nullptr) { - WARNING(true, ("JavaLibrary::convert DraftSchematicObject got null crafted " + WARNING(true, ("JavaLibrary::convert DraftSchematicObject got nullptr crafted " "template for draft schematic %s", source.getObjectTemplateName())); return 0; } @@ -830,7 +830,7 @@ int i; const ServerDraftSchematicObjectTemplate * const sourceSchematicTemplate = safe_cast(source.getObjectTemplate()); NOT_NULL(sourceSchematicTemplate); - if (sourceSchematicTemplate == NULL) + if (sourceSchematicTemplate == nullptr) { // emergency case for release mode return 0; @@ -873,11 +873,11 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::startCraftingSession(JNIEnv *en UNREF(env); UNREF(self); - CreatureObject* playerObj = NULL; + CreatureObject* playerObj = nullptr; if (!JavaLibrary::getObject(player, playerObj)) return JNI_FALSE; - TangibleObject* stationObj = NULL; + TangibleObject* stationObj = nullptr; if (!JavaLibrary::getObject(station, stationObj)) return JNI_FALSE; @@ -894,7 +894,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::startCraftingSession(JNIEnv *en * @param self class calling this function * @param crafter the player that was crafting * @param tool the crafting tool that was being used - * @param prototype the prototype that was created (may be null) + * @param prototype the prototype that was created (may be nullptr) * * @return true on success, false on fail */ @@ -908,11 +908,11 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::endCraftingSession(JNIEnv *env, if (prototype == 0) return JNI_TRUE; - CreatureObject * crafterObj = NULL; + CreatureObject * crafterObj = nullptr; if (!JavaLibrary::getObject(crafter, crafterObj)) return JNI_FALSE; - TangibleObject * prototypeObj = NULL; + TangibleObject * prototypeObj = nullptr; if (!JavaLibrary::getObject(prototype, prototypeObj)) return JNI_FALSE; @@ -937,11 +937,11 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setCraftingLevelAndStation(JNIE { UNREF(self); - CreatureObject* creatureObject = NULL; + CreatureObject* creatureObject = nullptr; if (!JavaLibrary::getObject(player, creatureObject)) return JNI_FALSE; PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(creatureObject); - if (playerObject == NULL) + if (playerObject == nullptr) return JNI_FALSE; if (craftingLevel >= 0 && craftingLevel <= Crafting::MAX_CRAFTING_LEVEL) @@ -949,12 +949,12 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setCraftingLevelAndStation(JNIE if (station != 0) { - const TangibleObject * stationObject = NULL; + const TangibleObject * stationObject = nullptr; const NetworkId stationId(station); if (stationId != NetworkId::cms_invalid) { stationObject = dynamic_cast(ServerWorld::findObjectByNetworkId(stationId)); - if (stationObject == NULL) + if (stationObject == nullptr) return JNI_FALSE; } playerObject->setCraftingStation(stationObject); @@ -976,11 +976,11 @@ jint JNICALL ScriptMethodsCraftingNamespace::getCraftingLevel(JNIEnv *env, jobje { UNREF(self); - const CreatureObject* creatureObject = NULL; + const CreatureObject* creatureObject = nullptr; if (!JavaLibrary::getObject(player, creatureObject)) return -1; const PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(creatureObject); - if (playerObject == NULL) + if (playerObject == nullptr) return -1; return playerObject->getCraftingLevel(); @@ -999,11 +999,11 @@ jlong JNICALL ScriptMethodsCraftingNamespace::getCraftingStation(JNIEnv *env, jo { UNREF(self); - const CreatureObject* creatureObject = NULL; + const CreatureObject* creatureObject = nullptr; if (!JavaLibrary::getObject(player, creatureObject)) return 0; const PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(creatureObject); - if (playerObject == NULL) + if (playerObject == nullptr) return 0; return (playerObject->getCraftingStation()).getValue(); @@ -1023,11 +1023,11 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::sendUseableDraftSchematics(JNIE { UNREF(self); - CreatureObject* creatureObject = NULL; + CreatureObject* creatureObject = nullptr; if (!JavaLibrary::getObject(player, creatureObject)) return JNI_FALSE; PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(creatureObject); - if (playerObject == NULL) + if (playerObject == nullptr) { DEBUG_WARNING(true, ("JavaLibrary::sendUseableDraftSchematics non-player " "object %s\n", creatureObject->getNetworkId().getValueString().c_str())); @@ -1038,8 +1038,8 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::sendUseableDraftSchematics(JNIE if (count == 0) return JNI_FALSE; - jint * schematicsArray = env->GetIntArrayElements(schematics, NULL); - if (schematicsArray != NULL) + jint * schematicsArray = env->GetIntArrayElements(schematics, nullptr); + if (schematicsArray != nullptr) { std::vector schematicCrcs(schematicsArray, &schematicsArray[count]); playerObject->sendUseableDraftSchematics(schematicCrcs); @@ -1072,7 +1072,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSchematicAttribute(JNIEnv *e if (manufacturingSchematic == 0 || attribute == 0) return JNI_FALSE; - ManufactureObjectInterface * schematic = NULL; + ManufactureObjectInterface * schematic = nullptr; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return JNI_FALSE; @@ -1120,7 +1120,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSchematicAttributes(JNIEnv * if (manufacturingSchematic == 0 || attributes == 0) return JNI_FALSE; - ManufactureObjectInterface * schematic = NULL; + ManufactureObjectInterface * schematic = nullptr; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return JNI_FALSE; @@ -1169,7 +1169,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSchematicAttributes(JNIEnv * * @param name name of the attribute to get * @param experiment flag that these are experimental attributes * - * @return the attribute, or null on error + * @return the attribute, or nullptr on error */ jobject JNICALL ScriptMethodsCraftingNamespace::getSchematicAttribute(JNIEnv *env, jobject self, jlong manufacturingSchematic, jobject name, jboolean experiment) { @@ -1178,13 +1178,13 @@ jobject JNICALL ScriptMethodsCraftingNamespace::getSchematicAttribute(JNIEnv *en if (manufacturingSchematic == 0 || name == 0) return 0; - ManufactureObjectInterface * schematic = NULL; + ManufactureObjectInterface * schematic = nullptr; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return 0; const DraftSchematicObject * draft = DraftSchematicObject::getSchematic( schematic->getDraftSchematic()); - if (draft == NULL) + if (draft == nullptr) return 0; StringId nameId; @@ -1210,7 +1210,7 @@ jobject JNICALL ScriptMethodsCraftingNamespace::getSchematicAttribute(JNIEnv *en * @param names names of the attributes to get * @param experiment flag that these are experimental attributes * - * @return the attributes, or null on error + * @return the attributes, or nullptr on error */ jobjectArray JNICALL ScriptMethodsCraftingNamespace::getSchematicAttributes(JNIEnv *env, jobject self, jlong manufacturingSchematic, jobjectArray names, jboolean experiment) { @@ -1219,13 +1219,13 @@ jobjectArray JNICALL ScriptMethodsCraftingNamespace::getSchematicAttributes(JNIE if (manufacturingSchematic == 0) return 0; - ManufactureObjectInterface * schematic = NULL; + ManufactureObjectInterface * schematic = nullptr; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return 0; const DraftSchematicObject * draft = DraftSchematicObject::getSchematic( schematic->getDraftSchematic()); - if (draft == NULL) + if (draft == nullptr) return 0; int numAttribs = env->GetArrayLength(names); @@ -1276,7 +1276,7 @@ jobjectArray JNICALL ScriptMethodsCraftingNamespace::getSchematicAttributes(JNIE * @param manufacturingSchematic the schematic * @param experiment flag that these are experimental attributes * - * @return the attributes, or null on error + * @return the attributes, or nullptr on error */ jobjectArray JNICALL ScriptMethodsCraftingNamespace::getAllSchematicAttributes(JNIEnv *env, jobject self, jlong manufacturingSchematic, jboolean experiment) { @@ -1286,13 +1286,13 @@ jobjectArray JNICALL ScriptMethodsCraftingNamespace::getAllSchematicAttributes(J if (manufacturingSchematic == 0) return 0; - ManufactureObjectInterface * schematic = NULL; + ManufactureObjectInterface * schematic = nullptr; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return 0; const DraftSchematicObject * draft = DraftSchematicObject::getSchematic( schematic->getDraftSchematic()); - if (draft == NULL) + if (draft == nullptr) return 0; // set the attributes @@ -1337,7 +1337,7 @@ jobjectArray JNICALL ScriptMethodsCraftingNamespace::getAllSchematicAttributes(J * @param manufacturingSchematic the schematic to get the data from * @param attributeNames the experimental attributes we're interested about * - * @return the draft_schematic object, or null on error + * @return the draft_schematic object, or nullptr on error */ jobject JNICALL ScriptMethodsCraftingNamespace::getSchematicForExperimentalAttributes(JNIEnv *env, jobject self, jlong manufacturingSchematic, jobjectArray attributeNames) { @@ -1348,13 +1348,13 @@ int i; if (manufacturingSchematic == 0 || attributeNames == 0) return 0; - const ManufactureObjectInterface * manfSchematic = NULL; + const ManufactureObjectInterface * manfSchematic = nullptr; if (!JavaLibrary::getObject(manufacturingSchematic, manfSchematic)) return 0; const DraftSchematicObject * draftSchematic = DraftSchematicObject::getSchematic( manfSchematic->getDraftSchematic()); - if (draftSchematic == NULL) + if (draftSchematic == nullptr) return 0; // create a draft_schematic object to return @@ -1481,7 +1481,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSchematicExperimentMod(JNIEn { UNREF(self); - ManufactureSchematicObject * schematic = NULL; + ManufactureSchematicObject * schematic = nullptr; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return JNI_FALSE; @@ -1510,7 +1510,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSchematicAppearances(JNIEnv if (manufacturingSchematic == 0 || appearances == 0) return JNI_FALSE; - ManufactureSchematicObject * schematic = NULL; + ManufactureSchematicObject * schematic = nullptr; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return JNI_FALSE; @@ -1550,7 +1550,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSchematicCustomizations(JNIE if (manufacturingSchematic == 0 || customizations == 0) return JNI_FALSE; - ManufactureSchematicObject * schematic = NULL; + ManufactureSchematicObject * schematic = nullptr; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return JNI_FALSE; @@ -1596,7 +1596,7 @@ jint JNICALL ScriptMethodsCraftingNamespace::getSchematicItemCount(JNIEnv *env, if (manufacturingSchematic == 0) return -1; - const ManufactureSchematicObject * schematic = NULL; + const ManufactureSchematicObject * schematic = nullptr; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return -1; @@ -1622,7 +1622,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSchematicItemCount(JNIEnv *e if (manufacturingSchematic == 0) return JNI_FALSE; - ManufactureSchematicObject * schematic = NULL; + ManufactureSchematicObject * schematic = nullptr; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return JNI_FALSE; @@ -1649,7 +1649,7 @@ jint JNICALL ScriptMethodsCraftingNamespace::getSchematicItemsPerContainer(JNIEn if (manufacturingSchematic == 0) return -1; - const ManufactureSchematicObject * schematic = NULL; + const ManufactureSchematicObject * schematic = nullptr; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return -1; @@ -1676,7 +1676,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSchematicItemsPerContainer(J if (manufacturingSchematic == 0) return JNI_FALSE; - ManufactureSchematicObject * schematic = NULL; + ManufactureSchematicObject * schematic = nullptr; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return JNI_FALSE; @@ -1703,7 +1703,7 @@ jfloat JNICALL ScriptMethodsCraftingNamespace::getSchematicManufactureTime(JNIEn if (manufacturingSchematic == 0) return -1.0f; - const ManufactureSchematicObject * schematic = NULL; + const ManufactureSchematicObject * schematic = nullptr; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return -1.0f; @@ -1730,7 +1730,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSchematicManufactureTime(JNI if (manufacturingSchematic == 0) return JNI_FALSE; - ManufactureSchematicObject * schematic = NULL; + ManufactureSchematicObject * schematic = nullptr; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return JNI_FALSE; @@ -1754,7 +1754,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setCreatorXp(JNIEnv *env, jobje { UNREF(self); - TangibleObject * target = NULL; + TangibleObject * target = nullptr; if (!JavaLibrary::getObject(object, target)) return JNI_FALSE; @@ -1778,7 +1778,7 @@ void JNICALL ScriptMethodsCraftingNamespace::getIngredientsForManufactureStation if (station == 0 || ingredients == 0) return; - const ManufactureInstallationObject * manfStation = NULL; + const ManufactureInstallationObject * manfStation = nullptr; if (!JavaLibrary::getObject(station, manfStation)) return; @@ -1786,7 +1786,7 @@ void JNICALL ScriptMethodsCraftingNamespace::getIngredientsForManufactureStation return; const ManufactureSchematicObject * const schematic = manfStation->getSchematic(); - if (schematic == NULL) + if (schematic == nullptr) return; static ManufactureSchematicObject::IngredientInfoVector iiv; @@ -1841,7 +1841,7 @@ void JNICALL ScriptMethodsCraftingNamespace::getIngredientsForManufactureStation * @param self class calling this function * @param station the station id * - * @return the hopper id, or null on error + * @return the hopper id, or nullptr on error */ jlong JNICALL ScriptMethodsCraftingNamespace::getManufactureStationInputHopper(JNIEnv *env, jobject self, jlong station) { @@ -1850,12 +1850,12 @@ jlong JNICALL ScriptMethodsCraftingNamespace::getManufactureStationInputHopper(J if (station == 0) return 0; - const ManufactureInstallationObject * manfStation = NULL; + const ManufactureInstallationObject * manfStation = nullptr; if (!JavaLibrary::getObject(station, manfStation)) return 0; ServerObject * hopper = manfStation->getInputHopper(); - if (hopper == NULL) + if (hopper == nullptr) return 0; return (hopper->getNetworkId()).getValue(); @@ -1870,7 +1870,7 @@ jlong JNICALL ScriptMethodsCraftingNamespace::getManufactureStationInputHopper(J * @param self class calling this function * @param station the station id * - * @return the hopper id, or null on error + * @return the hopper id, or nullptr on error */ jlong JNICALL ScriptMethodsCraftingNamespace::getManufactureStationOutputHopper(JNIEnv *env, jobject self, jlong station) { @@ -1879,12 +1879,12 @@ jlong JNICALL ScriptMethodsCraftingNamespace::getManufactureStationOutputHopper( if (station == 0) return 0; - const ManufactureInstallationObject * manfStation = NULL; + const ManufactureInstallationObject * manfStation = nullptr; if (!JavaLibrary::getObject(station, manfStation)) return 0; ServerObject * hopper = manfStation->getOutputHopper(); - if (hopper == NULL) + if (hopper == nullptr) return 0; return (hopper->getNetworkId()).getValue(); @@ -1899,7 +1899,7 @@ jlong JNICALL ScriptMethodsCraftingNamespace::getManufactureStationOutputHopper( * @param self class calling this function * @param station the station id * - * @return a string of the form "*" , or null if the station has no schematic + * @return a string of the form "*" , or nullptr if the station has no schematic */ jstring JNICALL ScriptMethodsCraftingNamespace::getManufactureStationSchematic(JNIEnv *env, jobject self, jlong station) { @@ -1907,12 +1907,12 @@ jstring JNICALL ScriptMethodsCraftingNamespace::getManufactureStationSchematic(J UNREF(self); - const ManufactureInstallationObject * manfStation = NULL; + const ManufactureInstallationObject * manfStation = nullptr; if (!JavaLibrary::getObject(station, manfStation)) return 0; const ManufactureSchematicObject * manfSchematic = manfStation->getSchematic(); - if (manfSchematic == NULL) + if (manfSchematic == nullptr) return 0; return JavaString( @@ -1943,11 +1943,11 @@ void JNICALL ScriptMethodsCraftingNamespace::getValidManufactureSchematicsForSta if (player == 0 || station == 0 || schematics == 0) return; - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature)) return; - const ManufactureInstallationObject * manfStation = NULL; + const ManufactureInstallationObject * manfStation = nullptr; if (!JavaLibrary::getObject(station, manfStation)) return; @@ -1997,11 +1997,11 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::hasValidManufactureSchematicsFo if (player == 0 || station == 0) return JNI_FALSE; - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature)) return JNI_FALSE; - const ManufactureInstallationObject * manfStation = NULL; + const ManufactureInstallationObject * manfStation = nullptr; if (!JavaLibrary::getObject(station, manfStation)) return JNI_FALSE; @@ -2030,24 +2030,24 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::transferManufactureSchematicToP { UNREF(self); - const ManufactureInstallationObject * manfStation = NULL; + const ManufactureInstallationObject * manfStation = nullptr; if (!JavaLibrary::getObject(station, manfStation)) return JNI_FALSE; ManufactureSchematicObject * schematic = manfStation->getSchematic(); - if (schematic == NULL) + if (schematic == nullptr) return JNI_TRUE; - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature)) return JNI_FALSE; ServerObject * datapad = playerCreature->getDatapad(); - if (datapad == NULL) + if (datapad == nullptr) return JNI_FALSE; Container::ContainerErrorCode tmp = Container::CEC_Success; - if (ContainerInterface::transferItemToVolumeContainer(*datapad, *schematic, NULL, tmp)) + if (ContainerInterface::transferItemToVolumeContainer(*datapad, *schematic, nullptr, tmp)) return JNI_TRUE; return JNI_FALSE; } // JavaLibrary::transferManufactureSchematicToPlayer @@ -2068,15 +2068,15 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::transferManufactureSchematicToS { UNREF(self); - ManufactureSchematicObject * manfSchematic = NULL; + ManufactureSchematicObject * manfSchematic = nullptr; if (!JavaLibrary::getObject(schematic, manfSchematic)) return JNI_FALSE; - ManufactureInstallationObject * manfStation = NULL; + ManufactureInstallationObject * manfStation = nullptr; if (!JavaLibrary::getObject(station, manfStation)) return JNI_FALSE; - if (manfStation->addSchematic(*manfSchematic, NULL)) + if (manfStation->addSchematic(*manfSchematic, nullptr)) return JNI_TRUE; return JNI_FALSE; } // JavaLibrary::transferManufactureSchematicToStation @@ -2099,11 +2099,11 @@ void JNICALL ScriptMethodsCraftingNamespace::getRepairableObjectsForTool(JNIEnv if (player == 0 || tool == 0 || objects == 0) return; - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature)) return; - const TangibleObject * toolObject = NULL; + const TangibleObject * toolObject = nullptr; if (!JavaLibrary::getObject(tool, toolObject)) return; if (!toolObject->isRepairTool()) @@ -2123,11 +2123,11 @@ void JNICALL ScriptMethodsCraftingNamespace::getRepairableObjectsForTool(JNIEnv // objects const ServerObject * inventory = playerCreature->getInventory(); - if (inventory == NULL) + if (inventory == nullptr) return; const VolumeContainer * inventoryContainer = ContainerInterface::getVolumeContainer(*inventory); - if (inventoryContainer == NULL) + if (inventoryContainer == nullptr) return; std::vector objList; @@ -2136,7 +2136,7 @@ void JNICALL ScriptMethodsCraftingNamespace::getRepairableObjectsForTool(JNIEnv { const CachedNetworkId & objId = (*iter); const TangibleObject * obj = safe_cast(objId.getObject()); - if (obj != NULL && !obj->isCraftingTool() && !obj->isRepairTool() && + if (obj != nullptr && !obj->isCraftingTool() && !obj->isRepairTool() && obj->getDamageTaken() > 0) { if ((genericTool && (toolType & obj->getGameObjectType()) != 0) || @@ -2172,22 +2172,22 @@ void JNICALL ScriptMethodsCraftingNamespace::getRepairableObjectsForTool(JNIEnv * @param self class calling this function * @param target the object * - * @return an array with the bonus for each attribute, or null on error + * @return an array with the bonus for each attribute, or nullptr on error */ jintArray JNICALL ScriptMethodsCraftingNamespace::getAttributeBonuses(JNIEnv *env, jobject self, jlong target) { UNREF(self); - const ServerObject * object = NULL; + const ServerObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return 0; std::vector > bonuses; - if (object->asTangibleObject() != NULL) + if (object->asTangibleObject() != nullptr) { object->asTangibleObject()->getAttribBonuses(bonuses); } - else if (object->asManufactureSchematicObject() != NULL) + else if (object->asManufactureSchematicObject() != nullptr) { object->asManufactureSchematicObject()->getAttribBonuses(bonuses); } @@ -2235,16 +2235,16 @@ jint JNICALL ScriptMethodsCraftingNamespace::getAttributeBonus(JNIEnv *env, jobj if (attribute < 0 || attribute >= Attributes::NumberOfAttributes) return 0; - const ServerObject * object = NULL; + const ServerObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return 0; jint bonus = 0; - if (object->asTangibleObject() != NULL) + if (object->asTangibleObject() != nullptr) { bonus = object->asTangibleObject()->getAttribBonus(attribute); } - else if (object->asManufactureSchematicObject() != NULL) + else if (object->asManufactureSchematicObject() != nullptr) { bonus = object->asManufactureSchematicObject()->getAttribBonus(attribute); } @@ -2271,15 +2271,15 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setAttributeBonus(JNIEnv *env, if (attribute < 0 || attribute >= Attributes::NumberOfAttributes) return JNI_FALSE; - ServerObject * object = NULL; + ServerObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; - if (object->asTangibleObject() != NULL) + if (object->asTangibleObject() != nullptr) { object->asTangibleObject()->setAttribBonus(attribute, bonus); } - else if (object->asManufactureSchematicObject() != NULL) + else if (object->asManufactureSchematicObject() != nullptr) { object->asManufactureSchematicObject()->setAttribBonus(attribute, bonus); } @@ -2307,7 +2307,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setAttributeBonuses(JNIEnv *env if (bonuses == 0) return JNI_FALSE; - ServerObject * object = NULL; + ServerObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -2322,13 +2322,13 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setAttributeBonuses(JNIEnv *env jint buffer[Attributes::NumberOfAttributes]; env->GetIntArrayRegion(bonuses, 0, count, buffer); - if (object->asTangibleObject() != NULL) + if (object->asTangibleObject() != nullptr) { TangibleObject * tangibleObject = object->asTangibleObject(); for (jsize i = 0; i < count; ++i) tangibleObject->setAttribBonus(i, buffer[i]); } - else if (object->asManufactureSchematicObject() != NULL) + else if (object->asManufactureSchematicObject() != nullptr) { ManufactureSchematicObject * manufactureSchematicObject = object->asManufactureSchematicObject(); for (jsize i = 0; i < count; ++i) @@ -2349,13 +2349,13 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setAttributeBonuses(JNIEnv *env * @param self class calling this function * @param target the object * - * @return a dictionary of skill mod names -> mod values, or null on error + * @return a dictionary of skill mod names -> mod values, or nullptr on error */ jobject JNICALL ScriptMethodsCraftingNamespace::getSkillModBonuses(JNIEnv *env, jobject self, jlong target) { UNREF(self); - const TangibleObject * object = NULL; + const TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return 0; @@ -2393,7 +2393,7 @@ jint JNICALL ScriptMethodsCraftingNamespace::getSkillModBonus(JNIEnv *env, jobje JavaStringParam jskillMod(skillMod); - const TangibleObject * object = NULL; + const TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return 0; @@ -2423,7 +2423,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSkillModBonus(JNIEnv *env, j JavaStringParam jskillMod(skillMod); - TangibleObject * object = NULL; + TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -2452,7 +2452,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSkillModBonuses(JNIEnv *env, { UNREF(self); - TangibleObject * object = NULL; + TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -2469,7 +2469,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSkillModBonuses(JNIEnv *env, } std::string skillName; - const jint * bonusArray = env->GetIntArrayElements(bonus, NULL); + const jint * bonusArray = env->GetIntArrayElements(bonus, nullptr); for (int i = 0; i < skillModCount; ++i) { JavaStringParam jskillName(static_cast(env->GetObjectArrayElement(skillMod, i))); @@ -2505,7 +2505,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setCategorizedSkillModBonus(JNI JavaStringParam jcategory(category); JavaStringParam jskillMod(skillMod); - TangibleObject * object = NULL; + TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -2540,7 +2540,7 @@ void JNICALL ScriptMethodsCraftingNamespace::removeCategorizedSkillModBonuses(JN JavaStringParam jcategory(category); - TangibleObject * object = NULL; + TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return; @@ -2566,7 +2566,7 @@ jint JNICALL ScriptMethodsCraftingNamespace::getSkillModSockets(JNIEnv *env, job { UNREF(self); - const TangibleObject * object = NULL; + const TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return 0; @@ -2589,7 +2589,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSkillModSockets(JNIEnv *env, { UNREF(self); - TangibleObject * object = NULL; + TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -2610,7 +2610,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSkillModSockets(JNIEnv *env, * @param qualityPercent % stat adjustment * @param container the container to create the item in * - * @return the item, or null on error + * @return the item, or nullptr on error */ jlong JNICALL ScriptMethodsCraftingNamespace::makeCraftedItem(JNIEnv *env, jobject self, jstring draftSchematic, jfloat qualityPercent, jlong container) { @@ -2618,7 +2618,7 @@ jlong JNICALL ScriptMethodsCraftingNamespace::makeCraftedItem(JNIEnv *env, jobje if (draftSchematic == 0 || container == 0) { - WARNING(true, ("[script bug] null schematic or container passed to " + WARNING(true, ("[script bug] nullptr schematic or container passed to " "makeCraftedItem")); return 0; } @@ -2634,21 +2634,21 @@ jlong JNICALL ScriptMethodsCraftingNamespace::makeCraftedItem(JNIEnv *env, jobje const DraftSchematicObject * schematic = DraftSchematicObject::getSchematic( draftSchematicName); - if (schematic == NULL) + if (schematic == nullptr) { WARNING(true, ("[script bug] bad schematic name %s passed to " "makeCraftedItem", draftSchematicName.c_str())); return 0; } - ServerObject * target = NULL; + ServerObject * target = nullptr; if (!JavaLibrary::getObject(container, target)) { WARNING(true, ("[script bug] bad container id passed to makeCraftedItem")); return 0; } Object * targetParent = ContainerInterface::getFirstParentInWorld(*target); - if (targetParent == NULL) + if (targetParent == nullptr) { WARNING(true, ("JavaLibrary::makeCraftedItem can't find parent in world " "for container %s", target->getNetworkId().getValueString().c_str())); @@ -2660,14 +2660,14 @@ jlong JNICALL ScriptMethodsCraftingNamespace::makeCraftedItem(JNIEnv *env, jobje // create a manf schematic and prototype ManufactureSchematicObject * manfSchematic = ServerWorld::createNewManufacturingSchematic( *schematic, createPos, false); - if (manfSchematic == NULL) + if (manfSchematic == nullptr) { WARNING(true, ("JavaLibrary::makeCraftedItem: error creating manf " "schematic!")); return 0; } ServerObject * prototype = manfSchematic->manufactureObject(createPos); - if (prototype == NULL) + if (prototype == nullptr) { WARNING(true, ("JavaLibrary::makeCraftedItem: error creating " "prototype!")); @@ -2690,7 +2690,7 @@ jlong JNICALL ScriptMethodsCraftingNamespace::makeCraftedItem(JNIEnv *env, jobje manfSchematic->permanentlyDestroy(DeleteReasons::Consumed); Container::ContainerErrorCode error; if (!ContainerInterface::transferItemToVolumeContainer (*target, *prototype, - NULL, error, true)) + nullptr, error, true)) { WARNING(true, ("JavaLibrary::makeCraftedItem: error can't store prototype " "in container, error = %d", error)); @@ -2711,14 +2711,14 @@ jlong JNICALL ScriptMethodsCraftingNamespace::makeCraftedItem(JNIEnv *env, jobje * @param self class calling this function * @param manufacturingSchematic the schematic to get the data from * - * @return the draft_schematic object, or null on error + * @return the draft_schematic object, or nullptr on error */ jobject JNICALL ScriptMethodsCraftingNamespace::getSchematicData(JNIEnv *env, jobject self, jlong manufacturingSchematic) { if (manufacturingSchematic == 0) return 0; - const ManufactureSchematicObject * schematicObject = NULL; + const ManufactureSchematicObject * schematicObject = nullptr; if (!JavaLibrary::getObject(manufacturingSchematic, schematicObject)) return 0; @@ -2735,7 +2735,7 @@ jobject JNICALL ScriptMethodsCraftingNamespace::getSchematicData(JNIEnv *env, jo * @param self class calling this function * @param draftSchematic the schematic to get the data from * - * @return the draft_schematic object, or null on error + * @return the draft_schematic object, or nullptr on error */ jobject JNICALL ScriptMethodsCraftingNamespace::getDraftSchematicData(JNIEnv *env, jobject self, jstring draftSchematic) @@ -2749,7 +2749,7 @@ jobject JNICALL ScriptMethodsCraftingNamespace::getDraftSchematicData(JNIEnv *en return 0; const DraftSchematicObject * schematicObject = DraftSchematicObject::getSchematic(schematicName); - if (schematicObject == NULL) + if (schematicObject == nullptr) return 0; return JavaLibrary::convert(*schematicObject); @@ -2765,7 +2765,7 @@ jobject JNICALL ScriptMethodsCraftingNamespace::getDraftSchematicData(JNIEnv *en * @param self class calling this function * @param draftSchematicCrc the schematic to get the data from * - * @return the draft_schematic object, or null on error + * @return the draft_schematic object, or nullptr on error */ jobject JNICALL ScriptMethodsCraftingNamespace::getDraftSchematicDataCrc(JNIEnv *env, jobject self, jint draftSchematicCrc) @@ -2774,7 +2774,7 @@ jobject JNICALL ScriptMethodsCraftingNamespace::getDraftSchematicDataCrc(JNIEnv return 0; const DraftSchematicObject * schematicObject = DraftSchematicObject::getSchematic(draftSchematicCrc); - if (schematicObject == NULL) + if (schematicObject == nullptr) return 0; return JavaLibrary::convert(*schematicObject); @@ -2794,7 +2794,7 @@ jobject JNICALL ScriptMethodsCraftingNamespace::getDraftSchematicDataCrc(JNIEnv */ void JNICALL ScriptMethodsCraftingNamespace::recomputeCrateAttributes(JNIEnv *env, jobject self, jlong crate) { - FactoryObject * factory = NULL; + FactoryObject * factory = nullptr; if (!JavaLibrary::getObject(crate, factory)) return; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsDebug.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsDebug.cpp index 9946fc28..6769ff57 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsDebug.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsDebug.cpp @@ -188,7 +188,7 @@ void JNICALL ScriptMethodsDebugNamespace::debugServerConsoleMsg(JNIEnv *env, job ServerObject * object = 0; JavaLibrary::getObject(objId, object); - if (object == NULL) + if (object == nullptr) { DEBUG_REPORT_LOG(true, ("debugServerConsoleMsg from : %s\n", msgString.c_str())); @@ -212,8 +212,8 @@ void JNICALL ScriptMethodsDebugNamespace::debugServerConsoleMsg(JNIEnv *env, job * @param channel the channel to log to * @param msg the message to log * @param logger id of the object where the log is coming from - * @param player1 the 1st player for the message (may be null) - * @param player2 the 2nd player for the message (may be null) + * @param player1 the 1st player for the message (may be nullptr) + * @param player2 the 2nd player for the message (may be nullptr) * @param alwaysLog flag to ignore the disableScriptLogs flag and always log this message */ void JNICALL ScriptMethodsDebugNamespace::log(JNIEnv *env, jobject self, jstring channel, jstring msg, jlong logger, jlong player1, jlong player2, jboolean alwaysLog) @@ -222,7 +222,7 @@ void JNICALL ScriptMethodsDebugNamespace::log(JNIEnv *env, jobject self, jstring if (channel == 0 || msg == 0) { - JavaLibrary::throwInternalScriptError("[designer bug] JavaLibrary::log called with null channel or message"); + JavaLibrary::throwInternalScriptError("[designer bug] JavaLibrary::log called with nullptr channel or message"); return; } @@ -248,7 +248,7 @@ void JNICALL ScriptMethodsDebugNamespace::log(JNIEnv *env, jobject self, jstring if (player1 != 0) { - const ServerObject * playerObject = NULL; + const ServerObject * playerObject = nullptr; if (JavaLibrary::getObject(player1, playerObject)) { std::string::size_type p = msgStr.find("%TU"); @@ -264,7 +264,7 @@ void JNICALL ScriptMethodsDebugNamespace::log(JNIEnv *env, jobject self, jstring if (player2 != 0) { - const ServerObject * playerObject = NULL; + const ServerObject * playerObject = nullptr; if (JavaLibrary::getObject(player2, playerObject)) { std::string::size_type p = msgStr.find("%TT"); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsDynamicVariable.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsDynamicVariable.cpp index dbf13ac0..effd5bed 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsDynamicVariable.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsDynamicVariable.cpp @@ -39,7 +39,7 @@ namespace NonAuthObjvarNamespace if (!ConfigServerGame::getTrackNonAuthoritativeObjvarSets()) return; - if (name == NULL || *name == '\0') + if (name == nullptr || *name == '\0') return; if (obj.isAuthoritative()) return; @@ -504,13 +504,13 @@ LocalRefPtr ScriptMethodsDynamicVariableNamespace::convertDynamicVariableListToO * @param buffer a buffer to be filled in with the converted C name * @param bufferSize the length of buffer * - * @return the ServerObject * for the obj_id, or null on error + * @return the ServerObject * for the obj_id, or nullptr on error */ ServerObject * ScriptMethodsDynamicVariableNamespace::getObjectAndName(JNIEnv *env, jlong objId, jstring name, char * buffer, size_t bufferSize) { NOT_NULL(buffer); - ServerObject * object = NULL; + ServerObject * object = nullptr; JavaStringParam localName(name); if (localName.fillBuffer(buffer, bufferSize) > 1) { @@ -523,7 +523,7 @@ ServerObject * ScriptMethodsDynamicVariableNamespace::getObjectAndName(JNIEnv *e { fprintf(stderr, "WARNING: Could not get objvar name\n"); } - if (object == NULL && !ConfigServerGame::getDisableObjvarNullCheck()) + if (object == nullptr && !ConfigServerGame::getDisableObjvarNullCheck()) JavaLibrary::printJavaStack(); return object; @@ -540,15 +540,15 @@ ServerObject * ScriptMethodsDynamicVariableNamespace::getObjectAndName(JNIEnv *e * @param buffer a buffer to be filled in with the converted C name * @param bufferSize the length of buffer * - * @return the DynamicVariableList * for the obj_id, or null on error + * @return the DynamicVariableList * for the obj_id, or nullptr on error */ const DynamicVariableList * ScriptMethodsDynamicVariableNamespace::getObjvarsAndName(JNIEnv *env, jlong objId, jstring name, char * buffer, size_t bufferSize) { NOT_NULL(buffer); - const DynamicVariableList * objvars = NULL; + const DynamicVariableList * objvars = nullptr; const ServerObject * object = getObjectAndName(env, objId, name, buffer, bufferSize); - if (object != NULL) + if (object != nullptr) { testIsSafeToReadObjvar(*object, buffer); objvars = &object->getObjVars(); @@ -582,7 +582,7 @@ jobject JNICALL ScriptMethodsDynamicVariableNamespace::getDynamicVariable(JNIEnv char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvars = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvars == NULL) + if (objvars == nullptr) return 0; const std::string objvarName(buffer); @@ -751,7 +751,7 @@ jint JNICALL ScriptMethodsDynamicVariableNamespace::getIntDynamicVariable(JNIEnv char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == NULL) + if (objvarList == nullptr) return 0; int localValue=0; @@ -781,7 +781,7 @@ jintArray JNICALL ScriptMethodsDynamicVariableNamespace::getIntArrayDynamicVaria char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == NULL) + if (objvarList == nullptr) return 0; std::vector value; @@ -816,7 +816,7 @@ jfloat JNICALL ScriptMethodsDynamicVariableNamespace::getFloatDynamicVariable(JN char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == NULL) + if (objvarList == nullptr) return 0; float localValue = 0; @@ -846,7 +846,7 @@ jfloatArray JNICALL ScriptMethodsDynamicVariableNamespace::getFloatArrayDynamicV char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == NULL) + if (objvarList == nullptr) return 0; std::vector value; @@ -878,7 +878,7 @@ jstring JNICALL ScriptMethodsDynamicVariableNamespace::getStringDynamicVariable( char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == NULL) + if (objvarList == nullptr) return 0; Unicode::String value; @@ -908,7 +908,7 @@ jobjectArray JNICALL ScriptMethodsDynamicVariableNamespace::getStringArrayDynami char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == NULL) + if (objvarList == nullptr) return 0; std::vector value; @@ -944,7 +944,7 @@ jlong JNICALL ScriptMethodsDynamicVariableNamespace::getObjIdDynamicVariable(JNI char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == NULL) + if (objvarList == nullptr) return 0; NetworkId localValue; @@ -972,7 +972,7 @@ jlongArray JNICALL ScriptMethodsDynamicVariableNamespace::getObjIdArrayDynamicVa char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList *objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == NULL) + if (objvarList == nullptr) return 0; std::vector value; @@ -1013,7 +1013,7 @@ jobject JNICALL ScriptMethodsDynamicVariableNamespace::getLocationDynamicVariabl char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == NULL) + if (objvarList == nullptr) return 0; DynamicVariableLocationData value; @@ -1046,7 +1046,7 @@ jobjectArray JNICALL ScriptMethodsDynamicVariableNamespace::getLocationArrayDyna char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == NULL) + if (objvarList == nullptr) return 0; std::vector value; @@ -1092,7 +1092,7 @@ jobject JNICALL ScriptMethodsDynamicVariableNamespace::getStringIdDynamicVariabl char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == NULL) + if (objvarList == nullptr) return 0; StringId value; @@ -1125,7 +1125,7 @@ jobjectArray JNICALL ScriptMethodsDynamicVariableNamespace::getStringIdArrayDyna char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == NULL) + if (objvarList == nullptr) return 0; std::vector value; @@ -1168,7 +1168,7 @@ jobject JNICALL ScriptMethodsDynamicVariableNamespace::getTransformDynamicVariab char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == NULL) + if (objvarList == nullptr) return 0; Transform value; @@ -1201,7 +1201,7 @@ jobjectArray JNICALL ScriptMethodsDynamicVariableNamespace::getTransformArrayDyn char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == NULL) + if (objvarList == nullptr) return 0; std::vector value; @@ -1244,7 +1244,7 @@ jobject JNICALL ScriptMethodsDynamicVariableNamespace::getVectorDynamicVariable( char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == NULL) + if (objvarList == nullptr) return 0; Vector value; @@ -1277,7 +1277,7 @@ jobjectArray JNICALL ScriptMethodsDynamicVariableNamespace::getVectorArrayDynami char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == NULL) + if (objvarList == nullptr) return 0; std::vector value; @@ -1320,7 +1320,7 @@ jobject JNICALL ScriptMethodsDynamicVariableNamespace::getDynamicVariableList(JN JavaStringParam localName(name); - const ServerObject* object = NULL; + const ServerObject* object = nullptr; if (!JavaLibrary::getObject(objId, object)) return 0; @@ -1342,7 +1342,7 @@ jobject JNICALL ScriptMethodsDynamicVariableNamespace::getDynamicVariableList(JN } } - if (result.get() == NULL) + if (result.get() == nullptr) return 0; return result->getReturnValue(); } // JavaLibrary::getDynamicVariableList @@ -1364,7 +1364,7 @@ void JNICALL ScriptMethodsDynamicVariableNamespace::removeDynamicVariable(JNIEnv char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return; object->removeObjVarItem(buffer); @@ -1384,7 +1384,7 @@ void JNICALL ScriptMethodsDynamicVariableNamespace::removeAllDynamicVariables(JN if (objId == 0) return; - ServerObject* object = NULL; + ServerObject* object = nullptr; if (!JavaLibrary::getObject(objId, object)) return; @@ -1410,7 +1410,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::hasDynamicVariable(JNIEn char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return 0; const DynamicVariableList &objvarList = object->getObjVars(); @@ -1441,11 +1441,11 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setDynamicVariable(JNIEn char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; const DynamicVariableList *objvarList = &(object->getObjVars()); - if (objvarList == NULL) + if (objvarList == nullptr) return JNI_FALSE; // determine what type the data is @@ -1454,9 +1454,9 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setDynamicVariable(JNIEn { // name is the name of an objvar list we will add data to DynamicVariable *objvar = objvarList->getItemByName(localName); - if (objvar == NULL) + if (objvar == nullptr) objvar = objvarList->addNestedList(localName); - if (objvar != NULL && objvar->getType() == DynamicVariable::LIST) + if (objvar != nullptr && objvar->getType() == DynamicVariable::LIST) return updateDynamicVariableList(env, *dynamic_cast(objvar), data); return JNI_FALSE; } @@ -1474,7 +1474,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setDynamicVariable(JNIEn } else if (env->IsInstanceOf(data, ms_clsString) == JNI_TRUE) { - if (objvarList->setItem(localName, Unicode::String(env->GetStringChars(static_cast(data), NULL)))) + if (objvarList->setItem(localName, Unicode::String(env->GetStringChars(static_cast(data), nullptr)))) #error must release characters return JNI_TRUE; return JNI_FALSE; @@ -1503,7 +1503,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setIntDynamicVariable(JN char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; addSetObjvar(*object, buffer); @@ -1531,7 +1531,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setIntArrayDynamicVariab char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; size_t size = env->GetArrayLength(value); @@ -1574,7 +1574,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setFloatDynamicVariable( char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; addSetObjvar(*object, buffer); @@ -1602,7 +1602,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setFloatArrayDynamicVari char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; size_t size = env->GetArrayLength(value); @@ -1645,7 +1645,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setStringDynamicVariable if (name == 0) { - DEBUG_WARNING(true, ("NULL name passed from script to JavaLibrary::setStringDynamicValue")); + DEBUG_WARNING(true, ("nullptr name passed from script to JavaLibrary::setStringDynamicValue")); return JNI_FALSE; } @@ -1653,17 +1653,17 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setStringDynamicVariable char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; if (value == 0) { - DEBUG_WARNING(true, ("NULL string passed from script to JavaLibrary::setStringDynamicValue (%s)",buffer)); + DEBUG_WARNING(true, ("nullptr string passed from script to JavaLibrary::setStringDynamicValue (%s)",buffer)); return JNI_FALSE; } const DynamicVariableList *objvarList = &(object->getObjVars()); - if (objvarList == NULL) + if (objvarList == nullptr) return JNI_FALSE; Unicode::String valueString; @@ -1698,7 +1698,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setStringArrayDynamicVar char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; std::vector valueArray; @@ -1754,7 +1754,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setObjIdDynamicVariable( char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; NetworkId oidValue(static_cast @@ -1785,7 +1785,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setObjIdArrayDynamicVari char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; std::vector valueArray; @@ -1838,7 +1838,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setLocationDynamicVariab char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; DynamicVariableLocationData locValue; @@ -1878,7 +1878,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setLocationArrayDynamicV char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; std::vector valueArray; @@ -1942,7 +1942,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setStringIdDynamicVariab char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; StringId locValue; @@ -1977,7 +1977,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setStringIdArrayDynamicV char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; std::vector valueArray; @@ -2033,7 +2033,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setTransformDynamicVaria char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; Transform locValue; @@ -2068,7 +2068,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setTransformArrayDynamic char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; std::vector valueArray; @@ -2120,7 +2120,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setVectorDynamicVariable char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; Vector locValue; @@ -2155,7 +2155,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setVectorArrayDynamicVar char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; std::vector valueArray; @@ -2227,10 +2227,10 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::copyDynamicVariable(JNIE return JNI_TRUE; ServerObject* fromObject = dynamic_cast(from.getObject()); - if (fromObject == NULL) + if (fromObject == nullptr) return JNI_FALSE; ServerObject* toObject = dynamic_cast(to.getObject()); - if (toObject == NULL) + if (toObject == nullptr) return JNI_FALSE; char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsForm.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsForm.cpp index 3ca7c226..3247b76e 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsForm.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsForm.cpp @@ -48,7 +48,7 @@ const JNINativeMethod NATIVES[] = { jboolean JNICALL ScriptMethodsFormNamespace::editFormData(JNIEnv * env, jobject self, jlong player, jlong jObjectToEdit, jobjectArray jKeys, jobjectArray jValues) { UNREF(self); - ServerObject * playerServerObject = NULL; + ServerObject * playerServerObject = nullptr; if (!JavaLibrary::getObject(player, playerServerObject) || !playerServerObject) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("[script bug] can't get player in editFormData")); @@ -62,7 +62,7 @@ jboolean JNICALL ScriptMethodsFormNamespace::editFormData(JNIEnv * env, jobject return JNI_FALSE; } - ServerObject * objectToEditServerObject = NULL; + ServerObject * objectToEditServerObject = nullptr; if (!JavaLibrary::getObject(jObjectToEdit, objectToEditServerObject) || !objectToEditServerObject) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("[script bug] objectToEdit is not a ServerObject in editFormData")); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsHateList.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsHateList.cpp index 324d719e..758d57e9 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsHateList.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsHateList.cpp @@ -90,7 +90,7 @@ void JNICALL ScriptMethodsHateListNamespace::setAggroImmuneDuration(JNIEnv * /*e NetworkId const playerNetworkId(player); PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(playerNetworkId)); - if (playerObject == NULL) + if (playerObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsHateList::setAggroImmuneDuration() player(%s) Unable to resolve the object to a PlayerObject.", playerNetworkId.getValueString().c_str())); return; @@ -105,7 +105,7 @@ jboolean JNICALL ScriptMethodsHateListNamespace::isAggroImmune(JNIEnv * /*env*/, NetworkId const playerNetworkId(player); PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(playerNetworkId)); - if (playerObject == NULL) + if (playerObject == nullptr) { return JNI_FALSE; } @@ -120,7 +120,7 @@ void JNICALL ScriptMethodsHateListNamespace::addHate(JNIEnv * /*env*/, jobject / NetworkId const hateTargetNetworkId(hateTarget); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == NULL) + if (objectTangibleObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsHateList::addHate() object(%s) hateTarget(%s) hate(%.2f) Unable to resolve the object to a TangibleObject.", networkId.getValueString().c_str(), hateTargetNetworkId.getValueString().c_str(), hate)); return; @@ -148,7 +148,7 @@ void JNICALL ScriptMethodsHateListNamespace::addHateDot(JNIEnv * /*env*/, jobjec NetworkId const hateTargetNetworkId(hateTarget); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == NULL) + if (objectTangibleObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsHateList::addHateDot() object(%s) hateTarget(%s) hate(%.2f) seconds(%d) Unable to resolve the object to a TangibleObject.", networkId.getValueString().c_str(), hateTargetNetworkId.getValueString().c_str(), hate, seconds)); return; @@ -178,7 +178,7 @@ void JNICALL ScriptMethodsHateListNamespace::setHate(JNIEnv * /*env*/, jobject / NetworkId const hateTargetNetworkId(hateTarget); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == NULL) + if (objectTangibleObject == nullptr) { WARNING(true, ("ScriptMethodsHateList::setHate() object(%s) hateTarget(%s) hate(%.2f) Unable to resolve the object to a TangibleObject.", networkId.getValueString().c_str(), hateTargetNetworkId.getValueString().c_str(), hate)); return; @@ -208,7 +208,7 @@ void JNICALL ScriptMethodsHateListNamespace::removeHateTarget(JNIEnv * /*env*/, NetworkId const hateTargetNetworkId(hateTarget); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == NULL) + if (objectTangibleObject == nullptr) { WARNING(true, ("ScriptMethodsHateList::removeHateTarget() object(%s) hateTarget(%s) Unable to resolve the object to a TangibleObject.", networkId.getValueString().c_str(), hateTargetNetworkId.getValueString().c_str())); return; @@ -238,7 +238,7 @@ jfloat JNICALL ScriptMethodsHateListNamespace::getHate(JNIEnv * /*env*/, jobject NetworkId const hateTargetNetworkId(hateTarget); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == NULL) + if (objectTangibleObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsHateList::getHate() object(%s) hateTarget(%s) Unable to resolve the object to a TangibleObject.", networkId.getValueString().c_str(), hateTargetNetworkId.getValueString().c_str())); return 0.0f; @@ -264,7 +264,7 @@ jfloat JNICALL ScriptMethodsHateListNamespace::getMaxHate(JNIEnv * /*env*/, jobj NetworkId const networkId(object); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == NULL) + if (objectTangibleObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsHateList::getMaxHate() object(%s) Unable to resolve the object to a TangibleObject.", networkId.getValueString().c_str())); return 0.0f; @@ -281,7 +281,7 @@ void JNICALL ScriptMethodsHateListNamespace::clearHateList(JNIEnv * /*env*/, job NetworkId const networkId(object); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == NULL) + if (objectTangibleObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsHateList::clearHateList() Unable to resolve the object(%s) to a TangibleObject.", networkId.getValueString().c_str())); return; @@ -298,7 +298,7 @@ jlong JNICALL ScriptMethodsHateListNamespace::getHateTarget(JNIEnv * /*env*/, jo NetworkId const networkId(object); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == NULL) + if (objectTangibleObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsHateList::getHateTarget() Unable to resolve the object(%s) to a TangibleObject.", networkId.getValueString().c_str())); return 0; @@ -317,7 +317,7 @@ jlongArray JNICALL ScriptMethodsHateListNamespace::getHateList(JNIEnv * /*env*/, LOGC(AiLogManager::isLogging(networkId), "debug_ai", ("ScriptMethodsHateList::getHateList() object(%s)", networkId.getValueString().c_str())); - if (objectTangibleObject == NULL) + if (objectTangibleObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsHateList::getHateList() Unable to resolve the object(%s) to a TangibleObject.", networkId.getValueString().c_str())); return 0; @@ -348,7 +348,7 @@ jboolean JNICALL ScriptMethodsHateListNamespace::isOnHateList(JNIEnv * /*env*/, NetworkId const targetNetworkId(target); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == NULL) + if (objectTangibleObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsHateList::isOnHateList() object(%s) target(%s) Unable to resolve the object to a TangibleObject.", networkId.getValueString().c_str(), targetNetworkId.getValueString().c_str())); return JNI_FALSE; @@ -369,7 +369,7 @@ void JNICALL ScriptMethodsHateListNamespace::resetHateTimer(JNIEnv * /*env*/, jo NetworkId const networkId(object); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == NULL) + if (objectTangibleObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsHateList::resetHateTimer() object(%s) Unable to resolve the object to a TangibleObject.", networkId.getValueString().c_str())); return; @@ -385,7 +385,7 @@ void JNICALL ScriptMethodsHateListNamespace::setAILeashTime(JNIEnv * /*env*/, jo NetworkId const networkId(object); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == NULL) + if (objectTangibleObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsHateList::setAILeashTime() object(%s) time(%.2f) Unable to resolve the object to a TangibleObject.", networkId.getValueString().c_str(), time)); return; @@ -408,7 +408,7 @@ jfloat JNICALL ScriptMethodsHateListNamespace::getAILeashTime(JNIEnv * /*env*/, NetworkId const networkId(object); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == NULL) + if (objectTangibleObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsHateList::setAILeashTime() object(%s) time(%.2f) Unable to resolve the object to a TangibleObject.", networkId.getValueString().c_str(), time)); return 0.0; @@ -434,7 +434,7 @@ void JNICALL ScriptMethodsHateListNamespace::forceHateTarget(JNIEnv * env, jobje NetworkId const hateTargetNetworkId(target); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == NULL) + if (objectTangibleObject == nullptr) { WARNING(true, ("ScriptMethodsHateList::forceHateTarget() object(%s) hateTarget(%s) Unable to resolve the object to a TangibleObject.", networkId.getValueString().c_str(), hateTargetNetworkId.getValueString().c_str())); return; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsHolocube.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsHolocube.cpp index 51088b13..31a83e7c 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsHolocube.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsHolocube.cpp @@ -47,7 +47,7 @@ jboolean JNICALL ScriptMethodsHolocubeNamespace::openHolocronToPage(JNIEnv *env, { JavaStringParam localPage(jpage); - ServerObject* so = NULL; + ServerObject* so = nullptr; if(!JavaLibrary::getObject(client, so)) { WARNING (true, ("[Script bug] Could not get ServerObject for value passed in for paramter:client in JavaLibrary::openHolocronToPage")); @@ -76,7 +76,7 @@ jboolean JNICALL ScriptMethodsHolocubeNamespace::openHolocronToPage(JNIEnv *env, jboolean JNICALL ScriptMethodsHolocubeNamespace::closeHolocron(JNIEnv *env, jobject self, jlong client) { - ServerObject* so = NULL; + ServerObject* so = nullptr; if(!JavaLibrary::getObject(client, so)) { WARNING (true, ("[Script bug] Could not get ServerObject for value passed in for paramter:client in JavaLibrary::closeHolocron")); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsHyperspace.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsHyperspace.cpp index 665f9460..784a2717 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsHyperspace.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsHyperspace.cpp @@ -131,10 +131,10 @@ void JNICALL ScriptMethodsHyperspaceNamespace::hyperspacePlayerToLocation(JNIEnv // Make sure the ship is not docking - Controller const * const controller = (shipObject != NULL) ? shipObject->getController() : NULL; - ShipController const * const shipController = (controller != NULL) ? controller->asShipController() : NULL; + Controller const * const controller = (shipObject != nullptr) ? shipObject->getController() : nullptr; + ShipController const * const shipController = (controller != nullptr) ? controller->asShipController() : nullptr; - if ( (shipController != NULL) + if ( (shipController != nullptr) && shipController->isDocking()) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("hyperspacePlayerToLocation - Hyperspacing is not allowed on ships that are currently docking: %s", shipObject->getDebugInformation().c_str())); @@ -211,10 +211,10 @@ void JNICALL ScriptMethodsHyperspaceNamespace::hyperspacePlayerToLocationCellNam // Make sure the ship is not docking - Controller const * const controller = (shipObject != NULL) ? shipObject->getController() : NULL; - ShipController const * const shipController = (controller != NULL) ? controller->asShipController() : NULL; + Controller const * const controller = (shipObject != nullptr) ? shipObject->getController() : nullptr; + ShipController const * const shipController = (controller != nullptr) ? controller->asShipController() : nullptr; - if ( (shipController != NULL) + if ( (shipController != nullptr) && shipController->isDocking()) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("hyperspacePlayerToLocation - Hyperspacing is not allowed on ships that are currently docking: %s", shipObject->getDebugInformation().c_str())); @@ -272,7 +272,7 @@ void JNICALL ScriptMethodsHyperspaceNamespace::hyperspacePlayerToHyperspacePoint return; } - CreatureObject * const playerCreature = playerObject ? playerObject->asCreatureObject() : NULL; + CreatureObject * const playerCreature = playerObject ? playerObject->asCreatureObject() : nullptr; if(!playerCreature) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("hyperspacePlayerToHyperspacePoint - player is not a creature")); @@ -309,10 +309,10 @@ void JNICALL ScriptMethodsHyperspaceNamespace::hyperspacePlayerToHyperspacePoint // Make sure the ship is not docking - Controller const * const controller = (shipObject != NULL) ? shipObject->getController() : NULL; - ShipController const * const shipController = (controller != NULL) ? controller->asShipController() : NULL; + Controller const * const controller = (shipObject != nullptr) ? shipObject->getController() : nullptr; + ShipController const * const shipController = (controller != nullptr) ? controller->asShipController() : nullptr; - if ( (shipController != NULL) + if ( (shipController != nullptr) && shipController->isDocking()) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("hyperspacePlayerToHyperspacePoint - Hyperspacing is not allowed on ships that are currently docking: %s", shipObject->getDebugInformation().c_str())); @@ -395,7 +395,7 @@ void JNICALL ScriptMethodsHyperspaceNamespace::hyperspacePrepareShipOnClient(JNI return; } - CreatureObject * const playerCreature = playerObject ? playerObject->asCreatureObject() : NULL; + CreatureObject * const playerCreature = playerObject ? playerObject->asCreatureObject() : nullptr; if(playerCreature == 0) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("hyperspacePlayerToHyperspacePoint - player is not a creature")); @@ -425,8 +425,8 @@ void JNICALL ScriptMethodsHyperspaceNamespace::hyperspacePrepareShipOnClient(JNI if (HyperspaceManager::getHyperspacePoint(hyperspacePoint, location)) { - Controller const * const controller = (shipObject != NULL) ? shipObject->getController() : NULL; - ShipController const * const shipController = (controller != NULL) ? controller->asShipController() : NULL; + Controller const * const controller = (shipObject != nullptr) ? shipObject->getController() : nullptr; + ShipController const * const shipController = (controller != nullptr) ? controller->asShipController() : nullptr; if (shipController != 0) { @@ -467,7 +467,7 @@ void JNICALL ScriptMethodsHyperspaceNamespace::hyperspaceRestoreShipOnClientFrom return; } - CreatureObject * const playerCreature = playerObject ? playerObject->asCreatureObject() : NULL; + CreatureObject * const playerCreature = playerObject ? playerObject->asCreatureObject() : nullptr; if(playerCreature == 0) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("hyperspacePlayerToHyperspacePoint - player is not a creature")); @@ -482,8 +482,8 @@ void JNICALL ScriptMethodsHyperspaceNamespace::hyperspaceRestoreShipOnClientFrom return; } - Controller const * const controller = (shipObject != NULL) ? shipObject->getController() : NULL; - ShipController const * const shipController = (controller != NULL) ? controller->asShipController() : NULL; + Controller const * const controller = (shipObject != nullptr) ? shipObject->getController() : nullptr; + ShipController const * const shipController = (controller != nullptr) ? controller->asShipController() : nullptr; if (shipController != 0) { @@ -514,7 +514,7 @@ jstring JNICALL ScriptMethodsHyperspaceNamespace::getSceneForHyperspacePoint(JNI if (!JavaLibrary::convert(localHyperspacePoint, hyperspacePoint)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("getSceneForHyperspacePoint - could not get hyperspace point name")); - return NULL; + return nullptr; } if(HyperspaceManager::isValidHyperspacePoint(hyperspacePoint)) @@ -528,7 +528,7 @@ jstring JNICALL ScriptMethodsHyperspaceNamespace::getSceneForHyperspacePoint(JNI return str.getReturnValue(); } } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------ diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsImageDesign.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsImageDesign.cpp index b85f1516..4866318b 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsImageDesign.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsImageDesign.cpp @@ -70,7 +70,7 @@ void JNICALL ScriptMethodsImageDesignNamespace::imagedesignStart(JNIEnv *env, jo return; } - //the terminal can be NULL (that means no ID terminal is being used, which is fine) + //the terminal can be nullptr (that means no ID terminal is being used, which is fine) ServerObject * terminalObj = 0; JavaLibrary::getObject(jterminalId, terminalObj); @@ -185,8 +185,8 @@ jboolean JNICALL ScriptMethodsImageDesignNamespace::imagedesignValidated(JNIEnv WARNING(true, ("morph keys and values arrays are of diffent sizes")); return JNI_FALSE; } - jfloat * const morphChangesValuesArray = env->GetFloatArrayElements(jmorphChangesValues, NULL); - if (morphChangesValuesArray == NULL) + jfloat * const morphChangesValuesArray = env->GetFloatArrayElements(jmorphChangesValues, nullptr); + if (morphChangesValuesArray == nullptr) { return JNI_FALSE; } @@ -211,8 +211,8 @@ jboolean JNICALL ScriptMethodsImageDesignNamespace::imagedesignValidated(JNIEnv WARNING(true, ("index keys and values arrays are of diffent sizes")); return JNI_FALSE; } - jint * const indexChangesValuesArray = env->GetIntArrayElements(jindexChangesValues, NULL); - if (indexChangesValuesArray == NULL) + jint * const indexChangesValuesArray = env->GetIntArrayElements(jindexChangesValues, nullptr); + if (indexChangesValuesArray == nullptr) { return JNI_FALSE; } diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsInstallation.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsInstallation.cpp index b96b27d2..5c159849 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsInstallation.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsInstallation.cpp @@ -224,7 +224,7 @@ void JNICALL ScriptMethodsInstallationNamespace::displayStructurePermissionData( UNREF(self); //get the player id from player - CreatureObject* creatureObject = NULL; + CreatureObject* creatureObject = nullptr; if (!JavaLibrary::getObject(player, creatureObject)) return; @@ -290,7 +290,7 @@ jfloat JNICALL ScriptMethodsInstallationNamespace::getPowerValue(JNIEnv *env, jo UNREF(self); //get the player id from player - const InstallationObject * installation = NULL; + const InstallationObject * installation = nullptr; if (!JavaLibrary::getObject(target, installation)) return 0; @@ -314,7 +314,7 @@ jboolean JNICALL ScriptMethodsInstallationNamespace::setPowerValue(JNIEnv *env, UNREF(self); //get the player id from player - InstallationObject * installation = NULL; + InstallationObject * installation = nullptr; if (!JavaLibrary::getObject(target, installation)) return JNI_FALSE; @@ -340,7 +340,7 @@ jboolean JNICALL ScriptMethodsInstallationNamespace::incrementPowerValue(JNIEnv UNREF(self); //get the player id from player - InstallationObject * installation = NULL; + InstallationObject * installation = nullptr; if (!JavaLibrary::getObject(target, installation)) return JNI_FALSE; @@ -365,7 +365,7 @@ jfloat JNICALL ScriptMethodsInstallationNamespace::getPowerRate(JNIEnv *env, job UNREF(self); //get the player id from player - const InstallationObject * installation = NULL; + const InstallationObject * installation = nullptr; if (!JavaLibrary::getObject(target, installation)) return 0; @@ -389,7 +389,7 @@ jboolean JNICALL ScriptMethodsInstallationNamespace::setPowerRate(JNIEnv *env, j UNREF(self); //get the player id from player - InstallationObject * installation = NULL; + InstallationObject * installation = nullptr; if (!JavaLibrary::getObject(target, installation)) return JNI_FALSE; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsInteriors.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsInteriors.cpp index fb6c3557..da0c833b 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsInteriors.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsInteriors.cpp @@ -137,7 +137,7 @@ jlong JNICALL ScriptMethodsInteriorsNamespace::createObjectInCell(JNIEnv *env, j return 0; std::string templateName; - ServerObject* sourceObject = NULL; + ServerObject* sourceObject = nullptr; if (!JavaLibrary::getObject(source, sourceObject)) return 0; templateName = sourceObject->getTemplateName(); @@ -149,7 +149,7 @@ jlong JNICALL ScriptMethodsInteriorsNamespace::_createObjectInCellInternal(JNIEn { JavaStringParam localCellName(cellName); - ServerObject * portallizedObject = NULL; + ServerObject * portallizedObject = nullptr; if (!JavaLibrary::getObject(building, portallizedObject)) return 0; @@ -183,7 +183,7 @@ jlong JNICALL ScriptMethodsInteriorsNamespace::_createObjectInCellInternal(JNIEn Transform tr; tr.setPosition_p(newPos); ServerObject *newObject = ServerWorld::createNewObject(templateName, tr, cellObject, false); - if (newObject == NULL) + if (newObject == nullptr) return 0; //@todo do we need to snap to floor or something? @@ -226,7 +226,7 @@ jlong JNICALL ScriptMethodsInteriorsNamespace::createObjectInCellAnywhere(JNIEnv return 0; std::string templateName; - ServerObject* sourceObject = NULL; + ServerObject* sourceObject = nullptr; if (!JavaLibrary::getObject(source, sourceObject)) return 0; templateName = sourceObject->getTemplateName(); @@ -261,7 +261,7 @@ jlong JNICALL ScriptMethodsInteriorsNamespace::_createObjectInCellAnywhereIntern //@todo need to find a way to get a good location in a cell. For now just use the coordinates of the cell? JavaStringParam localCellName(cellName); - ServerObject *portallizedObject = NULL; + ServerObject *portallizedObject = nullptr; if (!JavaLibrary::getObject(building, portallizedObject)) return 0; @@ -289,7 +289,7 @@ jlong JNICALL ScriptMethodsInteriorsNamespace::_createObjectInCellAnywhereIntern Transform tr; tr.setPosition_p(createPosition); ServerObject *newObject = ServerWorld::createNewObject(templateName, tr, cellObject, false); - if (newObject == NULL) + if (newObject == nullptr) return 0; // create an networkId to return @@ -306,7 +306,7 @@ jlong JNICALL ScriptMethodsInteriorsNamespace::_createObjectInCellAnywhereIntern jobjectArray JNICALL ScriptMethodsInteriorsNamespace::getCellNames(JNIEnv *env, jobject self, jlong target) { - ServerObject const *portallizedObject = NULL; + ServerObject const *portallizedObject = nullptr; if (!JavaLibrary::getObject(target, portallizedObject)) return 0; @@ -329,7 +329,7 @@ jobjectArray JNICALL ScriptMethodsInteriorsNamespace::getCellNames(JNIEnv *env, jstring JNICALL ScriptMethodsInteriorsNamespace::getCellName(JNIEnv *env, jobject self, jlong target) { - CellObject const *cellObject = NULL; + CellObject const *cellObject = nullptr; if (!JavaLibrary::getObject(target, cellObject)) return 0; @@ -342,7 +342,7 @@ jstring JNICALL ScriptMethodsInteriorsNamespace::getCellName(JNIEnv *env, jobjec } ServerObject const * const portallizedObject = safe_cast(ContainerInterface::getContainedByObject(*cellObject)); - if (portallizedObject == NULL) + if (portallizedObject == nullptr) return 0; PortalProperty const * const cellProp = portallizedObject->getPortalProperty(); @@ -370,7 +370,7 @@ jstring JNICALL ScriptMethodsInteriorsNamespace::getCellName(JNIEnv *env, jobjec jlongArray JNICALL ScriptMethodsInteriorsNamespace::getCellIds(JNIEnv *env, jobject self, jlong target) { - ServerObject const *portallizedObject = NULL; + ServerObject const *portallizedObject = nullptr; if (!JavaLibrary::getObject(target, portallizedObject)) return 0; @@ -387,11 +387,11 @@ jlongArray JNICALL ScriptMethodsInteriorsNamespace::getCellIds(JNIEnv *env, jobj cellIds.reserve(count); for (int i = 0; i < count; ++i) { - ServerObject const * cellObject = NULL; + ServerObject const * cellObject = nullptr; CellProperty const * const cellProp = portalProp->getCell(nameList[i]); - if (cellProp != NULL) + if (cellProp != nullptr) cellObject = cellProp->getOwner().asServerObject(); - if (cellObject != NULL) + if (cellObject != nullptr) { cellIds.push_back(cellObject->getNetworkId()); } @@ -412,7 +412,7 @@ jboolean JNICALL ScriptMethodsInteriorsNamespace::hasCell(JNIEnv *env, jobject s { JavaStringParam localCellName(cellName); - ServerObject const * serverObject = NULL; + ServerObject const * serverObject = nullptr; if (!JavaLibrary::getObject(portallizedObject, serverObject)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("JavaLibrary::hasCell passed invalid object")); @@ -448,7 +448,7 @@ jlong JNICALL ScriptMethodsInteriorsNamespace::getCellId(JNIEnv *env, jobject se { JavaStringParam localCellName(cellName); - ServerObject const * serverObject = NULL; + ServerObject const * serverObject = nullptr; if (!JavaLibrary::getObject(portallizedObject, serverObject)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("[script bug] JavaLibrary::getCellId passed invalid object")); @@ -571,7 +571,7 @@ jobject JNICALL ScriptMethodsInteriorsNamespace::getBuildingEjectLocation(JNIEnv if (building == 0) { - DEBUG_WARNING(true, ("[designer bug] getBuildingEjectLocation was passed a NULL building objid")); + DEBUG_WARNING(true, ("[designer bug] getBuildingEjectLocation was passed a nullptr building objid")); return 0; } @@ -598,7 +598,7 @@ jobject JNICALL ScriptMethodsInteriorsNamespace::getBuildingEjectLocation(JNIEnv CellProperty const *worldCell = CellProperty::getWorldCellProperty(); if (!worldCell) { - DEBUG_WARNING(true, ("getBuildingEjectLocation get a NULL worldCell back from CellProperty::getWorldCellProperty()")); + DEBUG_WARNING(true, ("getBuildingEjectLocation get a nullptr worldCell back from CellProperty::getWorldCellProperty()")); return 0; } @@ -666,7 +666,7 @@ jlong JNICALL ScriptMethodsInteriorsNamespace::moveHouseItemToPlayer(JNIEnv * /* { if (building == 0) { - DEBUG_WARNING(true, ("[designer bug] moveHouseItemToPlayer was passed a NULL building objid")); + DEBUG_WARNING(true, ("[designer bug] moveHouseItemToPlayer was passed a nullptr building objid")); return 0; } @@ -693,7 +693,7 @@ jlong JNICALL ScriptMethodsInteriorsNamespace::moveHouseItemToPlayer2(JNIEnv * / { if (building == 0) { - DEBUG_WARNING(true, ("[designer bug] moveHouseItemToPlayer2 was passed a NULL building objid")); + DEBUG_WARNING(true, ("[designer bug] moveHouseItemToPlayer2 was passed a nullptr building objid")); return 0; } @@ -721,7 +721,7 @@ void JNICALL ScriptMethodsInteriorsNamespace::deleteAllHouseItems(JNIEnv * /*env { if (building == 0) { - DEBUG_WARNING(true, ("[designer bug] deleteAllHouseItems was passed a NULL building objid")); + DEBUG_WARNING(true, ("[designer bug] deleteAllHouseItems was passed a nullptr building objid")); return ; } @@ -747,11 +747,11 @@ jboolean JNICALL ScriptMethodsInteriorsNamespace::areAllContentsLoaded(JNIEnv * { if (building == 0) { - DEBUG_WARNING(true, ("[designer bug] areAllContentsLoaded was passed a NULL building objid")); + DEBUG_WARNING(true, ("[designer bug] areAllContentsLoaded was passed a nullptr building objid")); return JNI_FALSE; } - const BuildingObject * buildingObject = NULL; + const BuildingObject * buildingObject = nullptr; if (!JavaLibrary::getObject(building, buildingObject)) { DEBUG_WARNING(true, ("[designer bug] areAllContentsLoaded was passed a non-ServerObject objid")); @@ -767,11 +767,11 @@ void JNICALL ScriptMethodsInteriorsNamespace::loadBuildingContents(JNIEnv * /*en { if (building == 0) { - DEBUG_WARNING(true, ("[designer bug] loadBuildingContents was passed a NULL building objid")); + DEBUG_WARNING(true, ("[designer bug] loadBuildingContents was passed a nullptr building objid")); return; } - BuildingObject * buildingObject = NULL; + BuildingObject * buildingObject = nullptr; if (!JavaLibrary::getObject(building, buildingObject)) { DEBUG_WARNING(true, ("[designer bug] loadBuildingContents was passed a non-ServerObject objid")); @@ -815,9 +815,9 @@ jboolean JNICALL ScriptMethodsInteriorsNamespace::isAtPendingLoadRequestLimit(JN jstring JNICALL ScriptMethodsInteriorsNamespace::getCellLabel(JNIEnv * env, jobject self, jlong target) { - CellObject const *cellObject = NULL; + CellObject const *cellObject = nullptr; if (!JavaLibrary::getObject(target, cellObject)) - return NULL; + return nullptr; JavaString cellLabel(cellObject->getCellLabel()); return cellLabel.getReturnValue(); @@ -833,7 +833,7 @@ jboolean JNICALL ScriptMethodsInteriorsNamespace::setCellLabel(JNIEnv * env, job if (!JavaLibrary::convert(localCellLabel, cellLabelString)) return JNI_FALSE; - CellObject * cellObject = NULL; + CellObject * cellObject = nullptr; if (!JavaLibrary::getObject(target, cellObject)) return JNI_FALSE; @@ -846,7 +846,7 @@ jboolean JNICALL ScriptMethodsInteriorsNamespace::setCellLabel(JNIEnv * env, job jboolean JNICALL ScriptMethodsInteriorsNamespace::setCellLabelOffset(JNIEnv * env, jobject self, jlong target, jfloat x, jfloat y, jfloat z) { - CellObject * cellObject = NULL; + CellObject * cellObject = nullptr; if (!JavaLibrary::getObject(target, cellObject)) return JNI_FALSE; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsJedi.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsJedi.cpp index 1afeec06..188193c7 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsJedi.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsJedi.cpp @@ -120,7 +120,7 @@ jint JNICALL ScriptMethodsJediNamespace::getMaxForcePower(JNIEnv *env, jobject s { UNREF(self); - const CreatureObject * creature = NULL; + const CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return 0; @@ -128,7 +128,7 @@ jint JNICALL ScriptMethodsJediNamespace::getMaxForcePower(JNIEnv *env, jobject s return 0; PlayerObject const * const playerObject = PlayerCreatureController::getPlayerObject(creature); - if (playerObject == NULL) + if (playerObject == nullptr) return 0; return playerObject->getMaxForcePower(); @@ -148,7 +148,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::setMaxForcePower(JNIEnv *env, jobje { UNREF(self); - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -159,7 +159,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::setMaxForcePower(JNIEnv *env, jobje } PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(creature); - if (playerObject == NULL) + if (playerObject == nullptr) return JNI_FALSE; playerObject->setMaxForcePower(value); @@ -180,7 +180,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::alterMaxForcePower(JNIEnv *env, job { UNREF(self); - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -191,7 +191,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::alterMaxForcePower(JNIEnv *env, job } PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(creature); - if (playerObject == NULL) + if (playerObject == nullptr) return JNI_FALSE; playerObject->setMaxForcePower(playerObject->getMaxForcePower() + delta); @@ -211,7 +211,7 @@ jint JNICALL ScriptMethodsJediNamespace::getForcePower(JNIEnv *env, jobject self { UNREF(self); - const CreatureObject * creature = NULL; + const CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return 0; @@ -219,7 +219,7 @@ jint JNICALL ScriptMethodsJediNamespace::getForcePower(JNIEnv *env, jobject self return 0; PlayerObject const * const playerObject = PlayerCreatureController::getPlayerObject(creature); - if (playerObject == NULL) + if (playerObject == nullptr) return 0; return playerObject->getForcePower(); @@ -239,7 +239,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::setForcePower(JNIEnv *env, jobject { UNREF(self); - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -250,7 +250,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::setForcePower(JNIEnv *env, jobject } PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(creature); - if (playerObject == NULL) + if (playerObject == nullptr) return JNI_FALSE; playerObject->setForcePower(value); @@ -271,7 +271,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::alterForcePower(JNIEnv *env, jobjec { UNREF(self); - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -282,7 +282,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::alterForcePower(JNIEnv *env, jobjec } PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(creature); - if (playerObject == NULL) + if (playerObject == nullptr) return JNI_FALSE; playerObject->setForcePower(playerObject->getForcePower() + delta); @@ -302,7 +302,7 @@ jfloat JNICALL ScriptMethodsJediNamespace::getForcePowerRegenRate(JNIEnv *env, j { UNREF(self); - const CreatureObject * creature = NULL; + const CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return 0; @@ -310,7 +310,7 @@ jfloat JNICALL ScriptMethodsJediNamespace::getForcePowerRegenRate(JNIEnv *env, j return 0; PlayerObject const * const playerObject = PlayerCreatureController::getPlayerObject(creature); - if (playerObject == NULL) + if (playerObject == nullptr) return 0; return playerObject->getForcePowerRegenRate(); @@ -330,7 +330,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::setForcePowerRegenRate(JNIEnv *env, { UNREF(self); - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -341,7 +341,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::setForcePowerRegenRate(JNIEnv *env, } PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(creature); - if (playerObject == NULL) + if (playerObject == nullptr) return JNI_FALSE; playerObject->setForcePowerRegenRate(rate); @@ -359,7 +359,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::setForcePowerRegenRate(JNIEnv *env, */ jint JNICALL ScriptMethodsJediNamespace::getJediState(JNIEnv *env, jobject self, jlong jedi) { - const CreatureObject * object = NULL; + const CreatureObject * object = nullptr; if (!JavaLibrary::getObject(jedi, object)) { WARNING(true, ("JavaLibrary::getJediState did not find creature for id passed in")); @@ -367,7 +367,7 @@ jint JNICALL ScriptMethodsJediNamespace::getJediState(JNIEnv *env, jobject self, } const SwgPlayerObject * player = safe_cast(PlayerCreatureController::getPlayerObject(object)); - if (player == NULL) + if (player == nullptr) { WARNING(true, ("JavaLibrary::getJediState did not find player for creature " "%s", object->getNetworkId().getValueString().c_str())); @@ -389,12 +389,12 @@ jint JNICALL ScriptMethodsJediNamespace::getJediState(JNIEnv *env, jobject self, */ jboolean JNICALL ScriptMethodsJediNamespace::setJediState(JNIEnv *env, jobject self, jlong jedi, jint state) { - CreatureObject * object = NULL; + CreatureObject * object = nullptr; if (!JavaLibrary::getObject(jedi, object)) return JNI_FALSE; SwgPlayerObject * const player = safe_cast(PlayerCreatureController::getPlayerObject(object)); - if (player == NULL) + if (player == nullptr) return JNI_FALSE; if (state == JS_none || @@ -424,7 +424,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::setJediState(JNIEnv *env, jobject s */ jboolean JNICALL ScriptMethodsJediNamespace::hasJediSlot(JNIEnv * env, jobject self, jlong target) { - const ServerObject * player = NULL; + const ServerObject * player = nullptr; if (!JavaLibrary::getObject(target, player)) return JNI_FALSE; @@ -444,12 +444,12 @@ jboolean JNICALL ScriptMethodsJediNamespace::hasJediSlot(JNIEnv * env, jobject s */ jboolean JNICALL ScriptMethodsJediNamespace::addJediSlot(JNIEnv * env, jobject self, jlong target) { - const CreatureObject * object = NULL; + const CreatureObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; PlayerObject const * const player = PlayerCreatureController::getPlayerObject(object); - if (player == NULL) + if (player == nullptr) return JNI_FALSE; player->addJediToAccount(); @@ -475,12 +475,12 @@ jboolean JNICALL ScriptMethodsJediNamespace::isJedi(JNIEnv * env, jobject self, { UNREF(self); - const CreatureObject * creature = NULL; + const CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; const PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); - if (player == NULL) + if (player == nullptr) return JNI_FALSE; const SwgPlayerObject * jedi = safe_cast(player); @@ -502,12 +502,12 @@ jint JNICALL ScriptMethodsJediNamespace::getJediVisibility(JNIEnv * env, jobject { UNREF(self); - const CreatureObject * creature = NULL; + const CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return -1; const PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); - if (player == NULL) + if (player == nullptr) return JNI_FALSE; const SwgPlayerObject * jedi = safe_cast(player); @@ -531,12 +531,12 @@ jboolean JNICALL ScriptMethodsJediNamespace::setJediVisibility(JNIEnv * env, job { UNREF(self); - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); - if (player == NULL) + if (player == nullptr) return JNI_FALSE; SwgPlayerObject * jedi = safe_cast(player); @@ -561,12 +561,12 @@ jboolean JNICALL ScriptMethodsJediNamespace::changeJediVisibility(JNIEnv * env, { UNREF(self); - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); - if (player == NULL) + if (player == nullptr) return JNI_FALSE; SwgPlayerObject * jedi = safe_cast(player); @@ -591,19 +591,19 @@ jboolean JNICALL ScriptMethodsJediNamespace::setJediBountyValue(JNIEnv * env, jo { UNREF(self); - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; SwgCreatureObject const * jediCreature = safe_cast(creature); PlayerObject const * player = PlayerCreatureController::getPlayerObject(creature); - if (player == NULL) + if (player == nullptr) return JNI_FALSE; SwgPlayerObject const * jediPlayer = safe_cast(player); JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager == NULL) + if (jediManager == nullptr) return JNI_FALSE; jediManager->addJedi(creature->getNetworkId(), creature->getObjectName(), @@ -631,7 +631,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::setJediBountyValue(JNIEnv * env, jo * @param bounties limit for number of bounties on the Jedi statistic * @param state what state(s) the Jedi should have * - * @return a dictionary with the Jedi data on success, null on error + * @return a dictionary with the Jedi data on success, nullptr on error */ jobject JNICALL ScriptMethodsJediNamespace::requestJedi(JNIEnv * env, jobject self, jint visibility, jint bountyValue, jint minLevel, jint maxLevel, jint hoursAlive, jint bounties, jint state) @@ -640,7 +640,7 @@ jobject JNICALL ScriptMethodsJediNamespace::requestJedi(JNIEnv * env, jobject se JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager == NULL) + if (jediManager == nullptr) return 0; ScriptParams params; @@ -658,7 +658,7 @@ jobject JNICALL ScriptMethodsJediNamespace::requestJedi(JNIEnv * env, jobject se * @param self class calling this function * @param target the id of the Jedi * - * @return a dictionary with the Jedi data on success, null on error + * @return a dictionary with the Jedi data on success, nullptr on error */ jobject JNICALL ScriptMethodsJediNamespace::requestOneJedi(JNIEnv * env, jobject self, jlong target) { @@ -666,7 +666,7 @@ jobject JNICALL ScriptMethodsJediNamespace::requestOneJedi(JNIEnv * env, jobject JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager == NULL) + if (jediManager == nullptr) return 0; const NetworkId id(target); @@ -704,7 +704,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::requestJediBounty(JNIEnv * env, job JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager == NULL) + if (jediManager == nullptr) return JNI_FALSE; const NetworkId targetId(target); @@ -751,7 +751,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::removeJediBounty(JNIEnv * env, jobj JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager == NULL) + if (jediManager == nullptr) return JNI_FALSE; const NetworkId targetId(target); @@ -781,7 +781,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::removeAllJediBounties(JNIEnv * env, JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager == NULL) + if (jediManager == nullptr) return JNI_FALSE; const NetworkId targetId(target); @@ -799,7 +799,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::removeAllJediBounties(JNIEnv * env, * @param self class calling this function * @param target the Jedi * - * @return an array of hunter ids, or null on error + * @return an array of hunter ids, or nullptr on error */ jlongArray JNICALL ScriptMethodsJediNamespace::getJediBounties(JNIEnv * env, jobject self, jlong target) { @@ -807,7 +807,7 @@ jlongArray JNICALL ScriptMethodsJediNamespace::getJediBounties(JNIEnv * env, job JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager == NULL) + if (jediManager == nullptr) return 0; const NetworkId targetId(target); @@ -837,7 +837,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::isBeingHuntedByBountyHunter(JNIEnv JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager == NULL) + if (jediManager == nullptr) return JNI_FALSE; const NetworkId targetId(target); @@ -861,7 +861,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::isBeingHuntedByBountyHunter(JNIEnv * @param self class calling this function * @param hunter the bounty hunter * - * @return an array of jedi ids, or null on error + * @return an array of jedi ids, or nullptr on error */ jlongArray JNICALL ScriptMethodsJediNamespace::getBountyHunterBounties(JNIEnv * env, jobject self, jlong hunter) { @@ -869,7 +869,7 @@ jlongArray JNICALL ScriptMethodsJediNamespace::getBountyHunterBounties(JNIEnv * JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager == NULL) + if (jediManager == nullptr) return 0; const NetworkId hunterId(hunter); @@ -899,7 +899,7 @@ void JNICALL ScriptMethodsJediNamespace::updateJediScriptData(JNIEnv * env, jobj { JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager == NULL) + if (jediManager == nullptr) return; const NetworkId targetId(target); @@ -926,7 +926,7 @@ void JNICALL ScriptMethodsJediNamespace::removeJediScriptData(JNIEnv * env, jobj { JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager == NULL) + if (jediManager == nullptr) return; const NetworkId targetId(target); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsMap.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsMap.cpp index 9bcaa8d8..9d7f4dc1 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsMap.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsMap.cpp @@ -253,7 +253,7 @@ jobjectArray JNICALL ScriptMethodsMapNamespace::getPlanetaryMapLocations( if(!JavaLibrary::convert(localCategory, categoryName)) { DEBUG_WARNING(true, ("[script bug] invalid category passed to getPlanetaryMapLocations")); - return NULL; + return nullptr; } } @@ -264,7 +264,7 @@ jobjectArray JNICALL ScriptMethodsMapNamespace::getPlanetaryMapLocations( if(!JavaLibrary::convert(localSubCategory, subCategoryName)) { DEBUG_WARNING(true, ("[script bug] invalid SubCategory passed to getPlanetaryMapLocations")); - return NULL; + return nullptr; } } @@ -282,12 +282,12 @@ jobjectArray JNICALL ScriptMethodsMapNamespace::getPlanetaryMapLocations( jlong jLocationId = mapLocation.getLocationId().getValue(); if (!jLocationId) - return NULL; + return nullptr; JavaString jNameString(mapLocation.getLocationName()); if (jNameString.getValue() == 0) - return NULL; + return nullptr; LocalRefPtr jMapLocation = createNewObject(JavaLibrary::getClsMapLocation(), JavaLibrary::getMidMapLocation(), @@ -299,7 +299,7 @@ jobjectArray JNICALL ScriptMethodsMapNamespace::getPlanetaryMapLocations( static_cast (mapLocation.getFlags())); if (jMapLocation == LocalRef::cms_nullPtr) - return NULL; + return nullptr; setObjectArrayElement(*jlocs, index, *jMapLocation); } @@ -318,7 +318,7 @@ jobjectArray JNICALL ScriptMethodsMapNamespace::getPlanetaryMapCategories (JNI if(!JavaLibrary::convert(localCategory, categoryName)) { DEBUG_WARNING(true, ("[script bug] invalid category passed to getPlanetaryMapCategories")); - return NULL; + return nullptr; } } @@ -350,14 +350,14 @@ jobject JNICALL ScriptMethodsMapNamespace::getPlanetaryMapLocation (JNI if (id == NetworkId::cms_invalid) { DEBUG_WARNING(true, ("[script bug] invalid locationId passed to getPlanetaryMapCategories")); - return NULL; + return nullptr; } int mlt = 0; const MapLocation * const mapLocation = PlanetMapManagerServer::getLocation (id, mlt); if (!mapLocation) - return NULL; + return nullptr; const JavaString jLocName (mapLocation->m_locationName); const JavaString jLocCategoryName (PlanetMapManager::findCategoryName (mapLocation->m_category)); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsMentalStates.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsMentalStates.cpp index c4dd20c1..fc11623f 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsMentalStates.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsMentalStates.cpp @@ -310,7 +310,7 @@ jboolean JNICALL ScriptMethodsMentalStatesNamespace::addMentalStateModifier(JNIE * @param mob id of creature to access * @param mentalState mental state we are interested in * - * @return the mental state modifiers for the creature, or null if it has none + * @return the mental state modifiers for the creature, or nullptr if it has none */ jobjectArray JNICALL ScriptMethodsMentalStatesNamespace::getMentalStateModifiers(JNIEnv *env, jobject self, jlong mob, jint mentalState) { @@ -697,7 +697,7 @@ jboolean JNICALL ScriptMethodsMentalStatesNamespace::addMentalStateModifierTowar * @param mob id of creature to access * @param mentalState mental state we are interested in * - * @return the mental state modifiers for the creature, or null if it has none + * @return the mental state modifiers for the creature, or nullptr if it has none */ jobjectArray JNICALL ScriptMethodsMentalStatesNamespace::getMentalStateModifiersToward(JNIEnv *env, jobject self, jlong mob, jlong target, jint mentalState) { diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsMission.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsMission.cpp index 815bb35a..13e82707 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsMission.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsMission.cpp @@ -170,17 +170,17 @@ void JNICALL ScriptMethodsMissionNamespace::abortMission(JNIEnv * env, jobject s } else { - DEBUG_WARNING(true, ("[designer bug] abortMission() missionObject is NULL")); + DEBUG_WARNING(true, ("[designer bug] abortMission() missionObject is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] abortMission() self is NULL")); + DEBUG_WARNING(true, ("[programmer bug] abortMission() self is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] abortMission() JNIEnv is NULL")); + DEBUG_WARNING(true, ("[programmer bug] abortMission() JNIEnv is nullptr")); } } @@ -283,17 +283,17 @@ jstring JNICALL ScriptMethodsMissionNamespace::getMissionCreator(JNIEnv * env, j } else { - DEBUG_WARNING(true, ("[designer bug] getMissionCreator() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] getMissionCreator() missionObject (parameter 1) is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] getMissionCreator() self is NULL")); + DEBUG_WARNING(true, ("[programmer bug] getMissionCreator() self is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] getMissionCreator() JNIEnv is NULL")); + DEBUG_WARNING(true, ("[programmer bug] getMissionCreator() JNIEnv is nullptr")); } return result; } @@ -304,13 +304,13 @@ jobject JNICALL ScriptMethodsMissionNamespace::getMissionDescription(JNIEnv * en { if(! env) { - DEBUG_WARNING(true, ("[programmer bug] getMissionDescription() JNIEnv is NULL")); + DEBUG_WARNING(true, ("[programmer bug] getMissionDescription() JNIEnv is nullptr")); return 0; } if(! missionObject) { - DEBUG_WARNING(true, ("[designer bug] getMissionDescription() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] getMissionDescription() missionObject (parameter 1) is nullptr")); return 0; } @@ -352,17 +352,17 @@ jint JNICALL ScriptMethodsMissionNamespace::getMissionDifficulty(JNIEnv * env, j } else { - DEBUG_WARNING(true, ("[designer bug] getMissionDifficulty() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] getMissionDifficulty() missionObject (parameter 1) is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] getMissionDifficulty() self is NULL")); + DEBUG_WARNING(true, ("[programmer bug] getMissionDifficulty() self is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] getMissionDifficulty() JNIEnv is NULL")); + DEBUG_WARNING(true, ("[programmer bug] getMissionDifficulty() JNIEnv is nullptr")); } return result; } @@ -390,7 +390,7 @@ jobject JNICALL ScriptMethodsMissionNamespace::getMissionEndLocation(JNIEnv * en } else { - DEBUG_WARNING(true, ("[designer bug] getMissionEndLocation() missionObject (parameter1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] getMissionEndLocation() missionObject (parameter1) is nullptr")); } return 0; } @@ -418,17 +418,17 @@ jint JNICALL ScriptMethodsMissionNamespace::getMissionReward(JNIEnv * env, jobje } else { - DEBUG_WARNING(true, ("[designer bug] getMissionReward() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] getMissionReward() missionObject (parameter 1) is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] getMissionReward() self is NULL")); + DEBUG_WARNING(true, ("[programmer bug] getMissionReward() self is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] getMissionReward() JNIEnv is NULL")); + DEBUG_WARNING(true, ("[programmer bug] getMissionReward() JNIEnv is nullptr")); } return result; } @@ -454,7 +454,7 @@ jobject JNICALL ScriptMethodsMissionNamespace::getMissionStartLocation(JNIEnv * } else { - DEBUG_WARNING(true, ("[designer bug] getMissionStartLocation() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] getMissionStartLocation() missionObject (parameter 1) is nullptr")); } return 0; } @@ -483,7 +483,7 @@ jstring JNICALL ScriptMethodsMissionNamespace::getMissionTargetName(JNIEnv * env } else { - DEBUG_WARNING(true, ("[designer bug] getMissionTargetName() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] getMissionTargetName() missionObject (parameter 1) is nullptr")); } return 0; } @@ -494,7 +494,7 @@ jobject JNICALL ScriptMethodsMissionNamespace::getMissionTitle(JNIEnv * env, job { if(! missionObject) { - DEBUG_WARNING(true, ("[designer bug] getMissionTitle() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] getMissionTitle() missionObject (parameter 1) is nullptr")); return 0; } @@ -537,7 +537,7 @@ jstring JNICALL ScriptMethodsMissionNamespace::getMissionType(JNIEnv * env, jobj } else { - DEBUG_WARNING(true, ("[designer bug] getMissionType() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] getMissionType() missionObject (parameter 1) is nullptr")); } return 0; } @@ -556,7 +556,7 @@ jlong JNICALL ScriptMethodsMissionNamespace::getMissionHolder(JNIEnv * env, jobj MissionObject * mo = 0; if(JavaLibrary::getObject(missionObject, mo)) { - if (mo != NULL && mo->getMissionHolderId() != NetworkId::cms_invalid) + if (mo != nullptr && mo->getMissionHolderId() != NetworkId::cms_invalid) { result = (mo->getMissionHolderId()).getValue(); } @@ -572,17 +572,17 @@ jlong JNICALL ScriptMethodsMissionNamespace::getMissionHolder(JNIEnv * env, jobj } else { - DEBUG_WARNING(true, ("[designer bug] getMissionHolder() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] getMissionHolder() missionObject (parameter 1) is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] getMissionHolder() self is NULL")); + DEBUG_WARNING(true, ("[programmer bug] getMissionHolder() self is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] getMissionHolder() JNIEnv is NULL")); + DEBUG_WARNING(true, ("[programmer bug] getMissionHolder() JNIEnv is nullptr")); } return result; } @@ -609,7 +609,7 @@ jstring JNICALL ScriptMethodsMissionNamespace::getMissionRootScriptName(JNIEnv * } else { - DEBUG_WARNING(true, ("[designer bug] getMissionRootScriptName() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] getMissionRootScriptName() missionObject (parameter 1) is nullptr")); } return 0; } @@ -641,22 +641,22 @@ void JNICALL ScriptMethodsMissionNamespace::setMissionCreator(JNIEnv *env, jobje } else { - DEBUG_WARNING(true, ("[designer bug] setMissionCreator() creator (parameter 2) is NULL")); + DEBUG_WARNING(true, ("[designer bug] setMissionCreator() creator (parameter 2) is nullptr")); } } else { - DEBUG_WARNING(true, ("[designer bug] setMissionCreator() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] setMissionCreator() missionObject (parameter 1) is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionCreator() self is NULL")); + DEBUG_WARNING(true, ("[programmer bug] setMissionCreator() self is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionCreator() JNIEnv is NULL")); + DEBUG_WARNING(true, ("[programmer bug] setMissionCreator() JNIEnv is nullptr")); } } @@ -686,7 +686,7 @@ void JNICALL ScriptMethodsMissionNamespace::setMissionDescription(JNIEnv * env, } else { - DEBUG_WARNING(true, ("[designer bug] setMissionDescription() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] setMissionDescription() missionObject (parameter 1) is nullptr")); } } @@ -708,7 +708,7 @@ void JNICALL ScriptMethodsMissionNamespace::setMissionDifficulty(JNIEnv * env, j } else { - DEBUG_WARNING(true, ("[designer bug] setMissionDifficulty() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] setMissionDifficulty() missionObject (parameter 1) is nullptr")); } } @@ -764,17 +764,17 @@ void JNICALL ScriptMethodsMissionNamespace::setMissionReward(JNIEnv * env, jobje } else { - DEBUG_WARNING(true, ("[designer bug] setMissionProfessionRank() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] setMissionProfessionRank() missionObject (parameter 1) is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionProfessionRank() self is NULL")); + DEBUG_WARNING(true, ("[programmer bug] setMissionProfessionRank() self is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionProfessionRank() JNIEnv is NULL")); + DEBUG_WARNING(true, ("[programmer bug] setMissionProfessionRank() JNIEnv is nullptr")); } } @@ -806,7 +806,7 @@ void JNICALL ScriptMethodsMissionNamespace::setMissionStartLocation(JNIEnv * env } else { - DEBUG_WARNING(true, ("[designer bug] setMissionStartLocation() location (parameter 2) is NULL")); + DEBUG_WARNING(true, ("[designer bug] setMissionStartLocation() location (parameter 2) is nullptr")); } } else @@ -816,17 +816,17 @@ void JNICALL ScriptMethodsMissionNamespace::setMissionStartLocation(JNIEnv * env } else { - DEBUG_WARNING(true, ("[designer bug] setMissionStartLocation() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] setMissionStartLocation() missionObject (parameter 1) is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionStartLocation() self is NULL")); + DEBUG_WARNING(true, ("[programmer bug] setMissionStartLocation() self is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionStartLocation() JNIEnv is NULL")); + DEBUG_WARNING(true, ("[programmer bug] setMissionStartLocation() JNIEnv is nullptr")); } } @@ -856,17 +856,17 @@ void JNICALL ScriptMethodsMissionNamespace::setMissionTargetAppearance(JNIEnv * } else { - DEBUG_WARNING(true, ("[designer bug] setMissionTarget() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] setMissionTarget() missionObject (parameter 1) is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionTarget() self is NULL")); + DEBUG_WARNING(true, ("[programmer bug] setMissionTarget() self is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionTarget() JNIEnv is NULL")); + DEBUG_WARNING(true, ("[programmer bug] setMissionTarget() JNIEnv is nullptr")); } } @@ -896,17 +896,17 @@ void JNICALL ScriptMethodsMissionNamespace::setMissionTargetName(JNIEnv * env, j } else { - DEBUG_WARNING(true, ("[designer bug] setMissionTarget() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] setMissionTarget() missionObject (parameter 1) is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionTarget() self is NULL")); + DEBUG_WARNING(true, ("[programmer bug] setMissionTarget() self is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionTarget() JNIEnv is NULL")); + DEBUG_WARNING(true, ("[programmer bug] setMissionTarget() JNIEnv is nullptr")); } } @@ -936,7 +936,7 @@ void JNICALL ScriptMethodsMissionNamespace::setMissionTitle(JNIEnv * env, jobjec } else { - DEBUG_WARNING(true, ("[designer bug] setMissionTitle() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] setMissionTitle() missionObject (parameter 1) is nullptr")); } } @@ -969,22 +969,22 @@ void JNICALL ScriptMethodsMissionNamespace::setMissionType(JNIEnv *env, jobject } else { - DEBUG_WARNING(true, ("[designer bug] setMissionType() typeName (parameter 2) is NULL")); + DEBUG_WARNING(true, ("[designer bug] setMissionType() typeName (parameter 2) is nullptr")); } } else { - DEBUG_WARNING(true, ("[designer bug] setMissionType() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] setMissionType() missionObject (parameter 1) is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionType() self is NULL")); + DEBUG_WARNING(true, ("[programmer bug] setMissionType() self is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionType() JNIEnv is NULL")); + DEBUG_WARNING(true, ("[programmer bug] setMissionType() JNIEnv is nullptr")); } } @@ -1022,22 +1022,22 @@ void JNICALL ScriptMethodsMissionNamespace::setMissionRootScriptName(JNIEnv *env } else { - DEBUG_WARNING(true, ("[designer bug] setMissionRootScriptName() rootScriptName (parameter 2) is NULL")); + DEBUG_WARNING(true, ("[designer bug] setMissionRootScriptName() rootScriptName (parameter 2) is nullptr")); } } else { - DEBUG_WARNING(true, ("[designer bug] setMissionRootScriptName() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] setMissionRootScriptName() missionObject (parameter 1) is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionRootScriptName() self is NULL")); + DEBUG_WARNING(true, ("[programmer bug] setMissionRootScriptName() self is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionRootScriptName() JNIEnv is NULL")); + DEBUG_WARNING(true, ("[programmer bug] setMissionRootScriptName() JNIEnv is nullptr")); } } diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsMoney.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsMoney.cpp index 542b801e..d0afcd98 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsMoney.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsMoney.cpp @@ -110,7 +110,7 @@ jboolean JNICALL ScriptMethodsMoneyNamespace::transferCashTo(JNIEnv *env, jobjec return JNI_FALSE; ServerObject *sourceObj = ServerWorld::findObjectByNetworkId(sourceObjId); - if (sourceObj == NULL || targetObjId == NetworkId::cms_invalid || ownerOID == NetworkId::cms_invalid) + if (sourceObj == nullptr || targetObjId == NetworkId::cms_invalid || ownerOID == NetworkId::cms_invalid) return JNI_FALSE; // Do money transfer (will be forwarded if object is not authoritative) @@ -157,7 +157,7 @@ jboolean JNICALL ScriptMethodsMoneyNamespace::transferBankCreditsTo(JNIEnv *env, return JNI_FALSE; ServerObject *sourceObj = ServerWorld::findObjectByNetworkId(sourceObjId); - if (sourceObj == NULL || targetObjId == NetworkId::cms_invalid || ownerOID == NetworkId::cms_invalid) + if (sourceObj == nullptr || targetObjId == NetworkId::cms_invalid || ownerOID == NetworkId::cms_invalid) return JNI_FALSE; // Do money transfer (will be forwarded if object is not authoritative) @@ -203,7 +203,7 @@ jboolean JNICALL ScriptMethodsMoneyNamespace::withdrawCashFromBank (JNIEnv *env, return JNI_FALSE; ServerObject *sourceObj = ServerWorld::findObjectByNetworkId(sourceObjId); - if (sourceObj == NULL || ownerOID == NetworkId::cms_invalid) + if (sourceObj == nullptr || ownerOID == NetworkId::cms_invalid) return JNI_FALSE; // Do money transfer (will be forwarded if object is not authoritative) @@ -243,7 +243,7 @@ jboolean JNICALL ScriptMethodsMoneyNamespace::depositCashToBank(JNIEnv *env, job if (failCallbackFunction != 0 && !JavaLibrary::convert(JavaStringParam(failCallbackFunction), failCallback)) return JNI_FALSE; - ServerObject *sourceObj = NULL; + ServerObject *sourceObj = nullptr; if (!JavaLibrary::getObject(source, sourceObj)) return JNI_FALSE; @@ -260,7 +260,7 @@ jboolean JNICALL ScriptMethodsMoneyNamespace::depositCashToBank(JNIEnv *env, job void JNICALL ScriptMethodsMoneyNamespace::depositToGalacticReserve(JNIEnv *env, jobject self, jlong player) { - CreatureObject * objPlayer = NULL; + CreatureObject * objPlayer = nullptr; if (!JavaLibrary::getObject(player, objPlayer) || !objPlayer) return; @@ -275,7 +275,7 @@ void JNICALL ScriptMethodsMoneyNamespace::depositToGalacticReserve(JNIEnv *env, void JNICALL ScriptMethodsMoneyNamespace::withdrawFromGalacticReserve(JNIEnv *env, jobject self, jlong player) { - CreatureObject * objPlayer = NULL; + CreatureObject * objPlayer = nullptr; if (!JavaLibrary::getObject(player, objPlayer) || !objPlayer) return; @@ -290,7 +290,7 @@ void JNICALL ScriptMethodsMoneyNamespace::withdrawFromGalacticReserve(JNIEnv *en jboolean JNICALL ScriptMethodsMoneyNamespace::canAccessGalacticReserve(JNIEnv *env, jobject self, jlong player) { - CreatureObject * objPlayer = NULL; + CreatureObject * objPlayer = nullptr; if (!JavaLibrary::getObject(player, objPlayer) || !objPlayer) return JNI_FALSE; @@ -376,7 +376,7 @@ jboolean JNICALL ScriptMethodsMoneyNamespace::transferBankCreditsToNamedAccount( return JNI_FALSE; ServerObject *sourceObj = ServerWorld::findObjectByNetworkId(sourceObjId); - if (sourceObj == NULL || targetString.size() == 0 || ownerOID == NetworkId::cms_invalid) + if (sourceObj == nullptr || targetString.size() == 0 || ownerOID == NetworkId::cms_invalid) return JNI_FALSE; // Do money transfer (will be forwarded if object is not authoritative) @@ -426,7 +426,7 @@ jboolean JNICALL ScriptMethodsMoneyNamespace::transferBankCreditsFromNamedAccoun return JNI_FALSE; ServerObject *targetObj = ServerWorld::findObjectByNetworkId(targetObjId); - if (targetObj == NULL || sourceString.size() == 0 || ownerOID == NetworkId::cms_invalid) + if (targetObj == nullptr || sourceString.size() == 0 || ownerOID == NetworkId::cms_invalid) return JNI_FALSE; // Do money transfer (will be forwarded if object is not authoritative) diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsMount.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsMount.cpp index 4f0e9c9f..2779be7b 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsMount.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsMount.cpp @@ -235,7 +235,7 @@ void JNICALL ScriptMethodsMountNamespace::dismountCreature(JNIEnv *env, jobject CreatureObject *const mountObject = riderObject->getMountedCreature(); if (!mountObject) { - LOG(LOCAL_LOG_CHANNEL, ("JavaLibrary::dismountCreature(): server id=[%d],rider id=[%s] has RidingMount state but CreatureObject::getMountedCreature() returns NULL, skipping dismount.", GameServer::getInstance().getProcessId(), riderObject->getNetworkId().getValueString().c_str())); + LOG(LOCAL_LOG_CHANNEL, ("JavaLibrary::dismountCreature(): server id=[%d],rider id=[%s] has RidingMount state but CreatureObject::getMountedCreature() returns nullptr, skipping dismount.", GameServer::getInstance().getProcessId(), riderObject->getNetworkId().getValueString().c_str())); return; } @@ -393,7 +393,7 @@ void JNICALL JNICALL ScriptMethodsMountNamespace::makeContainerStateInconsistent //-- Get the ServerObject from the object id. if (!containedObjectId) { - LOG("script-bug", ("makeContainerStateInconsistentTestOnly(): containedObjectId is NULL")); + LOG("script-bug", ("makeContainerStateInconsistentTestOnly(): containedObjectId is nullptr")); return; } @@ -428,7 +428,7 @@ void JNICALL JNICALL ScriptMethodsMountNamespace::makeContainerStateInconsistent Container* container = ContainerInterface::getContainer(*containerObject); if (!container) { - LOG("script-bug", ("makeContainerStateInconsistentTestOnly(): containerObject [%s] returned a NULL container", containerObject->getNetworkId().getValueString().c_str())); + LOG("script-bug", ("makeContainerStateInconsistentTestOnly(): containerObject [%s] returned a nullptr container", containerObject->getNetworkId().getValueString().c_str())); return; } diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsNewbieTutorial.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsNewbieTutorial.cpp index b94f7349..037b7ff5 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsNewbieTutorial.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsNewbieTutorial.cpp @@ -439,7 +439,7 @@ jobject JNICALL ScriptMethodsNewbieTutorialNamespace::getStartingLocationInf if (!jName) { - WARNING (true, ("getStartingLocationInfo null name")); + WARNING (true, ("getStartingLocationInfo nullptr name")); return JNI_FALSE; } diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsNotification.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsNotification.cpp index 8c8cff43..06d6b672 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsNotification.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsNotification.cpp @@ -52,7 +52,7 @@ const JNINativeMethod NATIVES[] = { jint JNICALL ScriptMethodsNotificationNamespace::addNotification(JNIEnv *env, jobject self, jlong player, jstring contents, jboolean useNotificationIcon, jint iconStyle, jfloat timeout, jint channel, jstring sound) { - CreatureObject const * playerObject = NULL; + CreatureObject const * playerObject = nullptr; if (!JavaLibrary::getObject(player, playerObject)) return 0; @@ -79,7 +79,7 @@ jint JNICALL ScriptMethodsNotificationNamespace::addNotification(JNIEnv *env, jo void JNICALL ScriptMethodsNotificationNamespace::cancelNotification(JNIEnv *env, jobject self, jlong player, jint notification) { - CreatureObject const * playerObject = NULL; + CreatureObject const * playerObject = nullptr; if (!JavaLibrary::getObject(player, playerObject)) return; ClientNotificationBoxMessage cnbm(notification, playerObject->getNetworkId(), Unicode::emptyString, FALSE, 0, 0.0f, ClientNotificationBoxMessage::NC_SPECIAL_CANCEL, std::string("")); @@ -94,7 +94,7 @@ void JNICALL ScriptMethodsNotificationNamespace::cancelNotification(JNIEnv *env, void JNICALL ScriptMethodsNotificationNamespace::cancelAllNotifications(JNIEnv *env, jobject self, jlong player) { - CreatureObject const * playerObject = NULL; + CreatureObject const * playerObject = nullptr; if (!JavaLibrary::getObject(player, playerObject)) return; ClientNotificationBoxMessage cnbm(0, playerObject->getNetworkId(), Unicode::emptyString, FALSE, 0, 0.0f, ClientNotificationBoxMessage::NC_SPECIAL_CANCEL_ALL, std::string("")); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsNpc.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsNpc.cpp index a617593b..f9c5e4ed 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsNpc.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsNpc.cpp @@ -190,14 +190,14 @@ jboolean JNICALL ScriptMethodsNpcNamespace::_npcStartConversation(JNIEnv *env, j if (!JavaLibrary::convert (localConvoName, convoNameStr)) return JNI_FALSE; - TangibleObject * playerObject = NULL; + TangibleObject * playerObject = nullptr; if (!JavaLibrary::getObject(player, playerObject)) return JNI_FALSE; if (playerObject->isInNpcConversation()) return JNI_FALSE; - TangibleObject * npcObject = NULL; + TangibleObject * npcObject = nullptr; if (!JavaLibrary::getObject(npc, npcObject)) return JNI_FALSE; @@ -234,7 +234,7 @@ jboolean JNICALL ScriptMethodsNpcNamespace::_npcStartConversation(JNIEnv *env, j jboolean JNICALL ScriptMethodsNpcNamespace::npcStartConversation(JNIEnv *env, jobject self, jlong player, jlong npc, jstring convoName, jobject greeting, jstring greetingOob, jobjectArray responses) { - TangibleObject * speakerObject = NULL; + TangibleObject * speakerObject = nullptr; if (!JavaLibrary::getObject(npc, speakerObject) || !speakerObject) return JNI_FALSE; @@ -243,7 +243,7 @@ jboolean JNICALL ScriptMethodsNpcNamespace::npcStartConversation(JNIEnv *env, jo uint32 crc = Crc::crcNull; ObjectTemplate const * const ot = ObjectTemplateList::fetch(conversationAppearanceOverride); - ServerObjectTemplate const * const sot = ot ? ot->asServerObjectTemplate() : NULL; + ServerObjectTemplate const * const sot = ot ? ot->asServerObjectTemplate() : nullptr; if(sot) { std::string const & sharedTemplateName = sot->getSharedTemplate(); @@ -263,7 +263,7 @@ jboolean JNICALL ScriptMethodsNpcNamespace::npcStartConversationAppearanceOverri return JNI_FALSE; ObjectTemplate const * const ot = ObjectTemplateList::fetch(appearanceOverrideSharedTemplateNameStr); - ServerObjectTemplate const * const sot = ot ? ot->asServerObjectTemplate() : NULL; + ServerObjectTemplate const * const sot = ot ? ot->asServerObjectTemplate() : nullptr; if(!sot) { return JNI_FALSE; @@ -290,7 +290,7 @@ jboolean JNICALL ScriptMethodsNpcNamespace::npcEndConversation(JNIEnv *env, jobj { UNREF(self); - TangibleObject * playerObject = NULL; + TangibleObject * playerObject = nullptr; if (!JavaLibrary::getObject(player, playerObject)) return JNI_FALSE; @@ -318,7 +318,7 @@ jboolean JNICALL ScriptMethodsNpcNamespace::npcSpeak(JNIEnv *env, jobject self, { UNREF(self); - TangibleObject * playerObject = NULL; + TangibleObject * playerObject = nullptr; if (!JavaLibrary::getObject(player, playerObject)) return JNI_FALSE; @@ -367,7 +367,7 @@ jboolean JNICALL ScriptMethodsNpcNamespace::npcSetConversationResponses(JNIEnv * { UNREF(self); - TangibleObject * playerObject = NULL; + TangibleObject * playerObject = nullptr; if (!JavaLibrary::getObject(player, playerObject)) return JNI_FALSE; @@ -396,7 +396,7 @@ jboolean JNICALL ScriptMethodsNpcNamespace::npcAddConversationResponse(JNIEnv *e { UNREF(self); - TangibleObject * playerObject = NULL; + TangibleObject * playerObject = nullptr; if (!JavaLibrary::getObject(player, playerObject)) return JNI_FALSE; @@ -455,7 +455,7 @@ jboolean JNICALL ScriptMethodsNpcNamespace::npcRemoveConversationResponse(JNIEnv { UNREF(self); - TangibleObject * playerObject = NULL; + TangibleObject * playerObject = nullptr; if (!JavaLibrary::getObject(player, playerObject)) return JNI_FALSE; @@ -488,7 +488,7 @@ jboolean JNICALL ScriptMethodsNpcNamespace::isInNpcConversation(JNIEnv *env, job { UNREF(self); - TangibleObject * tangibleObject = NULL; + TangibleObject * tangibleObject = nullptr; if (!JavaLibrary::getObject(creature, tangibleObject)) return JNI_FALSE; @@ -506,13 +506,13 @@ jboolean JNICALL ScriptMethodsNpcNamespace::isInNpcConversation(JNIEnv *env, job * @param self class calling this function * @param creature creature being asked about * - * @return an array of obj_ids the creature is in conversation with, or null on error + * @return an array of obj_ids the creature is in conversation with, or nullptr on error */ jlongArray JNICALL ScriptMethodsNpcNamespace::getNpcConversants(JNIEnv *env, jobject self, jlong creature) { UNREF(self); - TangibleObject * tangibleObject = NULL; + TangibleObject * tangibleObject = nullptr; if (!JavaLibrary::getObject(creature, tangibleObject)) return 0; @@ -621,7 +621,7 @@ jboolean JNICALL ScriptMethodsNpcNamespace::isNameReservedIgnoreRules(JNIEnv *en jboolean JNICALL ScriptMethodsNpcNamespace::npcEndConversationWithMessage(JNIEnv * /*env*/, jobject /*self*/, jlong player, jobject response, jstring responseOob) { - TangibleObject * playerObject = NULL; + TangibleObject * playerObject = nullptr; if(!JavaLibrary::getObject(player, playerObject)) return JNI_FALSE; @@ -658,7 +658,7 @@ jboolean JNICALL ScriptMethodsNpcNamespace::npcEndConversationWithMessage(JNIEnv jboolean JNICALL ScriptMethodsNpcNamespace::setNpcDifficulty(JNIEnv *env, jobject self, jlong npc, jlong difficulty) { - TangibleObject * npcObject = NULL; + TangibleObject * npcObject = nullptr; if (!JavaLibrary::getObject(npc, npcObject)) return JNI_FALSE; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsObjectCreate.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsObjectCreate.cpp index 37ab2bac..2f967f59 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsObjectCreate.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsObjectCreate.cpp @@ -257,11 +257,11 @@ jlong ScriptMethodsObjectCreateNamespace::createTheater(const std::vector float centerX = minx + dx / 2.0f + center.x; float centerZ = minz + dz / 2.0f + center.z; - TerrainGenerator::Layer * layer = NULL; + TerrainGenerator::Layer * layer = nullptr; if (locationType == IntangibleObject::TLT_flatten) { layer = TerrainModificationHelper::importLayer(THEATER_FLATTEN_LAYER.c_str()); - if (layer == NULL) + if (layer == nullptr) { WARNING (true, ("Layer %s not found for theater, using getGoodLocation " "instead", THEATER_FLATTEN_LAYER.c_str())); @@ -292,7 +292,7 @@ jlong ScriptMethodsObjectCreateNamespace::createTheater(const std::vector IntangibleObject * theater = safe_cast(ServerWorld::createNewObject(THEATER_TEMPLATE, tr, 0, false)); NOT_NULL(theater); theater->setTheater(); - if (layer != NULL) + if (layer != nullptr) { theater->setLayer(layer); } @@ -328,7 +328,7 @@ jlong ScriptMethodsObjectCreateNamespace::createTheater(const std::vector * @param source the template id or the object id to create the object with * @param location where to put the object * - * @return the new object, or null on error + * @return the new object, or nullptr on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInWorld(JNIEnv *env, jobject self, jlong source, jobject location) { @@ -340,7 +340,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInWorld(JNIEnv // determine what source is and create the object std::string localName; - ServerObject* object = NULL; + ServerObject* object = nullptr; if (!JavaLibrary::getObject(source, object)) return 0; localName = object->getTemplateName(); @@ -366,7 +366,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInWorld(JNIEnv * @param source the template id or the object id to create the object with * @param location where to put the object * - * @return the new object, or null on error + * @return the new object, or nullptr on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInWorldString(JNIEnv *env, jobject self, jobject source, jobject location) { @@ -445,7 +445,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectAt(JNIEnv *env, * @param container the object we want to put our new object into * @param slot the container slot we want to put the object in * - * @return the new object, or null on error + * @return the new object, or nullptr on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInContainer(JNIEnv *env, jobject self, jlong source, jlong container, jstring slot) { @@ -457,7 +457,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInContainer(JNI // determine what source is and create the object std::string templateName; - const ServerObject* object = NULL; + const ServerObject* object = nullptr; if (!JavaLibrary::getObject(source, object)) return 0; templateName = object->getTemplateName(); @@ -536,7 +536,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInContainerOver // determine what source is and create the object std::string templateName; - const ServerObject* object = NULL; + const ServerObject* object = nullptr; if (!JavaLibrary::getObject(source, object)) return 0; templateName = object->getTemplateName(); @@ -598,7 +598,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInContainerOver * @param sourceName the template name used to create the object * @param target the creature to create the object in * - * @return the obj_id of the created object, or null on error + * @return the obj_id of the created object, or nullptr on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInInventoryOverloaded(JNIEnv *env, jobject self, jstring sourceName, jlong target) { @@ -624,7 +624,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInInventoryOver * @param sourceCrc the template crc to create the object with * @param location where to put the object * - * @return the new object, or null on error + * @return the new object, or nullptr on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectCrc(JNIEnv *env, jobject self, int sourceCrc, jobject location) { @@ -656,7 +656,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectCrc(JNIEnv *env Transform tr; tr.setPosition_p(newPos); ServerObject *newObject = ServerWorld::createNewObject(sourceCrc, tr, cell, false); - if (newObject != NULL) + if (newObject != nullptr) { // get the networkId to return NetworkId netId = newObject->getNetworkId(); @@ -693,7 +693,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectCrc(JNIEnv *env * @param container the object we want to put our new object into * @param slot the container slot we want to put the object in * - * @return the new object, or null on error + * @return the new object, or nullptr on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInContainerCrc(JNIEnv *env, jobject self, int sourceCrc, jlong container, jstring slot) { @@ -707,10 +707,10 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInContainerCrc( return 0; // make sure the container exists - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) return 0; - if (ContainerInterface::getContainer(*containerOwner) == NULL) + if (ContainerInterface::getContainer(*containerOwner) == nullptr) return 0; //Create the object @@ -773,10 +773,10 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInContainerOver return 0; // make sure the container exists - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) return 0; - if (ContainerInterface::getVolumeContainer(*containerOwner) == NULL) + if (ContainerInterface::getVolumeContainer(*containerOwner) == nullptr) { DEBUG_WARNING(true, ("createObjectin an overloaded container only works on volume containers")); return 0; @@ -811,7 +811,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInContainerOver * @param sourceCrc the template crc used to create the object * @param target the creature to create the object in * - * @return the obj_id of the created object, or null on error + * @return the obj_id of the created object, or nullptr on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInInventoryOverloadedCrc( JNIEnv *env, jobject self, int sourceCrc, jlong target) @@ -819,16 +819,16 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInInventoryOver if (sourceCrc == 0 || target == 0) return 0; - CreatureObject * targetObject = NULL; + CreatureObject * targetObject = nullptr; if (!JavaLibrary::getObject(target, targetObject)) return 0; ServerObject * inventory = targetObject->getInventory(); - if (inventory == NULL) + if (inventory == nullptr) return 0; VolumeContainer * volContainer = ContainerInterface::getVolumeContainer(*inventory); - if (volContainer == NULL) + if (volContainer == nullptr) return 0; int oldCapacity = volContainer->debugDoNotUseSetCapacity(-1); @@ -838,7 +838,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInInventoryOver volContainer->debugDoNotUseSetCapacity(oldCapacity); volContainer->recalculateVolume(); - if (newObject == NULL) + if (newObject == nullptr) return 0; return (newObject->getNetworkId()).getValue(); @@ -852,7 +852,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInInventoryOver * @param self class calling this function * @param sourceCrc the template crc of the new object to create * @param target an object whose location and container/cell will be used to create the object. - * @return the obj_id of the created object, or null on error + * @return the obj_id of the created object, or nullptr on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectAtCrc(JNIEnv *env, jobject self, int sourceCrc, jlong target) { @@ -863,7 +863,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectAtCrc(JNIEnv *e if (target == 0) return 0; - ServerObject *sourceObject = NULL; + ServerObject *sourceObject = nullptr; if (!JavaLibrary::getObject(target, sourceObject)) return 0; @@ -878,7 +878,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectAtCrc(JNIEnv *e Transform tr; tr.setPosition_p(sourceObject->getPosition_p()); ServerObject *newObject = ServerWorld::createNewObject(sourceCrc, tr, cell, false); - if (newObject == NULL) + if (newObject == nullptr) { fprintf(stderr, "WARNING: Could not create object from crc %d\n", sourceCrc); JavaLibrary::printJavaStack(); @@ -911,7 +911,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectAtCrc(JNIEnv *e * @param source the template id or the object id to create the object with * @param location where to put the object * - * @return the new object, or null on error + * @return the new object, or nullptr on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectSimulator(JNIEnv *env, jobject self, jstring source, jobject location) { @@ -963,7 +963,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectSimulator(JNIEn Transform tr; tr.setPosition_p(newPos); ServerObject *newObject = ServerWorld::createNewObject(sourceCrc, tr, cell, false); - if (newObject != NULL) + if (newObject != nullptr) { // add on the player object CreatureObject * creature = dynamic_cast(newObject); @@ -1007,7 +1007,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectSimulator(JNIEn */ jboolean JNICALL ScriptMethodsObjectCreateNamespace::destroyObjectSimulator(JNIEnv *env, jobject self, jlong target) { - CreatureObject *playerObject = NULL; + CreatureObject *playerObject = nullptr; // get the object if (!JavaLibrary::getObject(target, playerObject)) { @@ -1046,7 +1046,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::destroyObject(JNIEnv *env, if (targetId == NetworkId::cms_invalid) return JNI_FALSE; - ServerObject* object = NULL; + ServerObject* object = nullptr; bool retval = JavaLibrary::getObject(target, object); if (!retval || !object) // || object->isPersisted()) will be done in permanently destroy @@ -1060,7 +1060,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::destroyObject(JNIEnv *env, { // check if the object is in a FactoryObject crate Object * container = ContainerInterface::getContainedByObject(*object); - if (container != NULL && dynamic_cast(container) != NULL) + if (container != nullptr && dynamic_cast(container) != nullptr) { // destroy an object in the factory; if it is the last object, // the factory will destroy itself @@ -1093,7 +1093,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::destroyObjectHyperspace(JNI if (targetId == NetworkId::cms_invalid) return JNI_FALSE; - ServerObject * object = NULL; + ServerObject * object = nullptr; bool retval = JavaLibrary::getObject(target, object); if(retval && object) { @@ -1120,7 +1120,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::persistObject(JNIEnv *env, UNREF(self); NOT_NULL(env); - ServerObject* object = NULL; + ServerObject* object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; if (object->persist()) { @@ -1144,7 +1144,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::isObjectPersisted(JNIEnv *e UNREF(self); NOT_NULL(env); - ServerObject* object = NULL; + ServerObject* object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -1320,7 +1320,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectTransformCrcInt * @param name the name of the theater * @param locationType how to create the theater * - * @return the id of the master theater object, or null on error (bad datatable name or position) + * @return the id of the master theater object, or nullptr on error (bad datatable name or position) */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createTheaterDatatableOnly(JNIEnv *env, jobject self, jstring datatable, jlong caller, jstring name, jint locationType) { @@ -1347,7 +1347,7 @@ int i; // read the object data from the datatable DataTable * dt = DataTableManager::getTable(datatableName, true); - if (dt == NULL) + if (dt == nullptr) { WARNING(true, ("JavaLibrary::createTheaterDatatable could not open " "datatable %s", datatableName.c_str())); @@ -1429,7 +1429,7 @@ int i; * @param name the name of the theater * @param locationType how to create the theater * - * @return the id of the master theater object, or null on error (bad datatable name or position) + * @return the id of the master theater object, or nullptr on error (bad datatable name or position) */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createTheaterDatatable(JNIEnv *env, jobject self, jstring datatable, jobject basePosition, jstring script, jlong caller, jstring name, jint locationType) { @@ -1466,7 +1466,7 @@ int i; // read the object data from the datatable DataTable * dt = DataTableManager::getTable(datatableName, true); - if (dt == NULL) + if (dt == nullptr) { WARNING(true, ("JavaLibrary::createTheaterDatatable could not open " "datatable %s", datatableName.c_str())); @@ -1567,7 +1567,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::createRemoteTheaterDatatabl // read the object data from the datatable DataTable * dt = DataTableManager::getTable(datatableName, true); - if (dt == NULL) + if (dt == nullptr) { WARNING(true, ("JavaLibrary::createRemoteTheaterDatatable could not open " "datatable %s", datatableName.c_str())); @@ -1613,7 +1613,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::createRemoteTheaterDatatabl params.addParam(locationType, "locationType"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() == NULL) + if (dictionary.get() == nullptr) { WARNING(true, ("JavaLibrary::createRemoteTheaterDatatable could not " "create dictionary for theater datatable %s", datatableName.c_str())); @@ -1624,7 +1624,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::createRemoteTheaterDatatabl Transform tr; tr.setPosition_p(location); ServerObject * spawner = ServerWorld::createNewObject("object/tangible/spawning/remote_theater_spawner.iff", tr, 0, false); - if (spawner == NULL) + if (spawner == nullptr) { WARNING(true, ("JavaLibrary::createRemoteTheaterDatatable unable to " "create remote theater spawner for datatable %s", datatableName.c_str())); @@ -1704,7 +1704,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::createRemoteTheaterDatatabl // read the object data from the datatable DataTable * dt = DataTableManager::getTable(datatableName, true); - if (dt == NULL) + if (dt == nullptr) { WARNING(true, ("JavaLibrary::createRemoteTheaterDatatable could not open " "datatable %s", datatableName.c_str())); @@ -1734,7 +1734,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::createRemoteTheaterDatatabl params.addParam(locationType, "locationType"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() == NULL) + if (dictionary.get() == nullptr) { WARNING(true, ("JavaLibrary::createRemoteTheaterDatatable could not " "create dictionary for theater datatable %s", datatableName.c_str())); @@ -1747,7 +1747,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::createRemoteTheaterDatatabl Transform tr; tr.setPosition_p(theaterCenter); ServerObject * spawner = ServerWorld::createNewObject("object/tangible/spawning/remote_theater_spawner.iff", tr, 0, false); - if (spawner == NULL) + if (spawner == nullptr) { WARNING(true, ("JavaLibrary::createRemoteTheaterDatatable unable to " "create remote theater spawner for datatable %s", datatableName.c_str())); @@ -1778,7 +1778,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::createRemoteTheaterDatatabl * theater objects have been created * @param caller who's creating the theater * - * @return the id of the master theater object, or null on error + * @return the id of the master theater object, or nullptr on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createTheaterCrc(JNIEnv *env, jobject self, jintArray crcs, jobjectArray positions, jobject basePosition, jstring script, jlong caller) { @@ -1843,7 +1843,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createTheaterCrc(JNIEnv *env, * theater objects have been created * @param caller who's creating the theater * - * @return the id of the master theater object, or null on error + * @return the id of the master theater object, or nullptr on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createTheaterString(JNIEnv *env, jobject self, jobjectArray templates, jobjectArray positions, jobject basePosition, jstring script, jlong caller) { @@ -1922,13 +1922,13 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::assignTheaterToPlayer(JNIEn JavaStringParam jdatatable(datatable); - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(playerId, playerCreature)) return JNI_FALSE; PlayerObject * const player = PlayerCreatureController::getPlayerObject( playerCreature); - if (player == NULL) + if (player == nullptr) return JNI_FALSE; if (player->hasTheater()) @@ -1962,7 +1962,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::assignTheaterToPlayer(JNIEn // read the object data from the datatable DataTable * dt = DataTableManager::getTable(datatableName, true); - if (dt == NULL) + if (dt == nullptr) { WARNING(true, ("JavaLibrary::assignTheaterToPlayer could not open " "datatable %s", datatableName.c_str())); @@ -2026,13 +2026,13 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::assignTheaterToPlayerLocati JavaStringParam jdatatable(datatable); JavaStringParam jscript(script); - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(playerId, playerCreature)) return JNI_FALSE; PlayerObject * const player = PlayerCreatureController::getPlayerObject( playerCreature); - if (player == NULL) + if (player == nullptr) return JNI_FALSE; std::string datatableName; @@ -2094,13 +2094,13 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::unassignTheaterFromPlayer(J if (playerId == 0) return JNI_FALSE; - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(playerId, playerCreature)) return JNI_FALSE; PlayerObject * const player = PlayerCreatureController::getPlayerObject( playerCreature); - if (player == NULL) + if (player == nullptr) return JNI_FALSE; player->clearTheater(); @@ -2123,13 +2123,13 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::hasTheaterAssigned(JNIEnv * if (playerId == 0) return JNI_FALSE; - const CreatureObject * playerCreature = NULL; + const CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(playerId, playerCreature)) return JNI_FALSE; const PlayerObject * player = PlayerCreatureController::getPlayerObject( playerCreature); - if (player == NULL) + if (player == nullptr) return JNI_FALSE; return player->hasTheater(); @@ -2142,7 +2142,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::hasTheaterAssigned(JNIEnv * * * @param theater the theater id * - * @return the theater's name, or null if it doesn't have one + * @return the theater's name, or nullptr if it doesn't have one */ jstring JNICALL ScriptMethodsObjectCreateNamespace::getTheaterName(JNIEnv *env, jobject self, jlong theater) { @@ -2167,7 +2167,7 @@ jstring JNICALL ScriptMethodsObjectCreateNamespace::getTheaterName(JNIEnv *env, * * @param name the theater name to look for * - * @return the theater's id, or null if the theater doesn't exist + * @return the theater's id, or nullptr if the theater doesn't exist */ jlong JNICALL ScriptMethodsObjectCreateNamespace::findTheater(JNIEnv *env, jobject self, jstring name) { @@ -2196,7 +2196,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::findTheater(JNIEnv *env, jobje * @param draftSchematic the draft schematic template to create the manufacturing schematic from * @param container the container to put the manufacturing schematic in * - * @return the id of the manufacturing schematic, or null on error + * @return the id of the manufacturing schematic, or nullptr on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createSchematicString(JNIEnv *env, jobject self, jstring draftSchematic, jlong container) { @@ -2222,25 +2222,25 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createSchematicString(JNIEnv * * @param draftSchematicCrc the draft schematic template crc value to create the manufacturing schematic from * @param container the container to put the manufacturing schematic in * - * @return the id of the manufacturing schematic, or null on error + * @return the id of the manufacturing schematic, or nullptr on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createSchematicCrc(JNIEnv *env, jobject self, jint draftSchematicCrc, jlong container) { if (draftSchematicCrc == 0 || container == 0) return 0; - ServerObject * containerObject = NULL; + ServerObject * containerObject = nullptr; if (!JavaLibrary::getObject(container, containerObject)) return 0; const DraftSchematicObject * const draftSchematic = DraftSchematicObject::getSchematic( draftSchematicCrc); - if (draftSchematic == NULL) + if (draftSchematic == nullptr) return 0; ManufactureSchematicObject * manfSchematic = ServerWorld::createNewManufacturingSchematic( *draftSchematic, *containerObject, false); - if (manfSchematic == NULL) + if (manfSchematic == nullptr) return 0; return (manfSchematic->getNetworkId()).getValue(); @@ -2260,7 +2260,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createSchematicCrc(JNIEnv *env jboolean JNICALL ScriptMethodsObjectCreateNamespace::updateNetworkTriggerVolume(JNIEnv *env, jobject self, jlong target, jfloat radius) { - ServerObject * object = NULL; + ServerObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsObjectInfo.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsObjectInfo.cpp index c50ab576..b285e0be 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsObjectInfo.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsObjectInfo.cpp @@ -561,15 +561,15 @@ void ScriptMethodsObjectInfoNamespace::getGoodItemsFromContainer(const Container { const ServerObject * owner = safe_cast( ContainerInterface::getFirstParentInWorld(container.getOwner())); - const ServerObject * ownerInventory = NULL; - const ServerObject * ownerDatapad = NULL; - const ServerObject * ownerAppearanceInventory = NULL; - const ServerObject * ownerHangar = NULL; + const ServerObject * ownerInventory = nullptr; + const ServerObject * ownerDatapad = nullptr; + const ServerObject * ownerAppearanceInventory = nullptr; + const ServerObject * ownerHangar = nullptr; - if (owner != NULL) + if (owner != nullptr) { const CreatureObject * creature = owner->asCreatureObject(); - if (creature != NULL) + if (creature != nullptr) { ownerInventory = creature->getInventory(); ownerDatapad = creature->getDatapad(); @@ -583,7 +583,7 @@ void ScriptMethodsObjectInfoNamespace::getGoodItemsFromContainer(const Container const CachedNetworkId & itemId = *i; const ServerObject * item = safe_cast( itemId.getObject()); - if (item != NULL && item->asTangibleObject() != NULL && + if (item != nullptr && item->asTangibleObject() != nullptr && item->asTangibleObject()->isVisible()) { // @@ -591,14 +591,14 @@ void ScriptMethodsObjectInfoNamespace::getGoodItemsFromContainer(const Container // // no player inventory - if (ownerInventory != NULL && ownerInventory->getNetworkId() == + if (ownerInventory != nullptr && ownerInventory->getNetworkId() == item->getNetworkId()) { continue; } // no player datapad - if (ownerDatapad != NULL && ownerDatapad->getNetworkId() == + if (ownerDatapad != nullptr && ownerDatapad->getNetworkId() == item->getNetworkId()) { continue; @@ -613,14 +613,14 @@ void ScriptMethodsObjectInfoNamespace::getGoodItemsFromContainer(const Container continue; // no creatures (pets/droids) - if (item->asCreatureObject() != NULL) + if (item->asCreatureObject() != nullptr) continue; // no hair const ServerObjectTemplate * itemTemplate = safe_cast< const ServerObjectTemplate *>(item->getObjectTemplate()); NOT_NULL(itemTemplate); - if (strstr(itemTemplate->getName(), "tangible/hair") != NULL) + if (strstr(itemTemplate->getName(), "tangible/hair") != nullptr) continue; // no Trandoshan feet @@ -631,7 +631,7 @@ void ScriptMethodsObjectInfoNamespace::getGoodItemsFromContainer(const Container // see if the item is a container and go through its contents const Container * itemContainer = ContainerInterface::getContainer(*item); - if (itemContainer != NULL) + if (itemContainer != nullptr) getGoodItemsFromContainer(*itemContainer, goodItems); } } @@ -644,7 +644,7 @@ void ScriptMethodsObjectInfoNamespace::getGoodItemsFromContainer(const Container * @param self class calling this function * @param jtemplateCrcs the template crcs * - * @return the names, or null on error + * @return the names, or nullptr on error */ jobjectArray ScriptMethodsObjectInfoNamespace::getNamesFromCrcs(JNIEnv *env, const std::vector & templateCrcs) @@ -661,7 +661,7 @@ jobjectArray ScriptMethodsObjectInfoNamespace::getNamesFromCrcs(JNIEnv *env, // get the server template const ObjectTemplate * ot = ObjectTemplateList::fetch(templateCrcs[i]); - if (ot == NULL) + if (ot == nullptr) { WARNING(true, ("JavaLibrary::getNamesFromTemplateCrcs: Could not " "find object template for crc %d", templateCrcs[i])); @@ -670,13 +670,13 @@ jobjectArray ScriptMethodsObjectInfoNamespace::getNamesFromCrcs(JNIEnv *env, // get the shared template const ServerObjectTemplate * serverOt = ot->asServerObjectTemplate(); - if (serverOt != NULL) + if (serverOt != nullptr) { const std::string sharedTemplateName(serverOt->getSharedTemplate()); serverOt->releaseReference(); - serverOt = NULL; + serverOt = nullptr; ot = ObjectTemplateList::fetch(sharedTemplateName); - if (ot == NULL) + if (ot == nullptr) { WARNING(true, ("JavaLibrary::getNamesFromTemplateCrcs: Could not " "find shared object template %s", sharedTemplateName.c_str())); @@ -685,18 +685,18 @@ jobjectArray ScriptMethodsObjectInfoNamespace::getNamesFromCrcs(JNIEnv *env, } const SharedObjectTemplate * sharedOt = ot->asSharedObjectTemplate(); - if (sharedOt == NULL) + if (sharedOt == nullptr) { WARNING(true, ("JavaLibrary::getNamesFromTemplateCrcs: template %s " "is not a shared template", ot->getName())); ot->releaseReference(); continue; } - ot = NULL; + ot = nullptr; const StringId objectName(sharedOt->getObjectName()); sharedOt->releaseReference(); - sharedOt = NULL; + sharedOt = nullptr; LocalRefPtr jobjectName; if (ScriptConversion::convert(objectName, jobjectName)) @@ -734,7 +734,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setNameFromString(JNIEnv *env JavaStringParam localName(name); - ServerObject* object = NULL; + ServerObject* object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -813,7 +813,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::setDescriptionStringId(JNIEnv * e * @param self class calling this function * @param target id of object whose name to get * -* @return the description, or null on error +* @return the description, or nullptr on error */ jobject JNICALL ScriptMethodsObjectInfoNamespace::getDescriptionStringId(JNIEnv * env, jobject self, jlong target) { @@ -837,13 +837,13 @@ jobject JNICALL ScriptMethodsObjectInfoNamespace::getDescriptionStringId(JNIEnv * @param self class calling this function * @param target id of object whose name to get * - * @return the name, or null on error + * @return the name, or nullptr on error */ jstring JNICALL ScriptMethodsObjectInfoNamespace::getName(JNIEnv *env, jobject self, jlong target) { UNREF(self); - ServerObject* object = NULL; + ServerObject* object = nullptr; if (!JavaLibrary::getObject(target, object)) return 0; @@ -859,7 +859,7 @@ jstring JNICALL ScriptMethodsObjectInfoNamespace::getName(JNIEnv *env, jobject s * @param self class calling this function * @param player id of the player to get * - * @return the name, or null on error + * @return the name, or nullptr on error */ jstring JNICALL ScriptMethodsObjectInfoNamespace::getPlayerName(JNIEnv *env, jobject self, jlong target) { @@ -894,13 +894,13 @@ jstring JNICALL ScriptMethodsObjectInfoNamespace::getPlayerFullName(JNIEnv *env, * @param self class calling this function * @param target id of object whose name to get * - * @return the name, or null on error + * @return the name, or nullptr on error */ jstring JNICALL ScriptMethodsObjectInfoNamespace::getAssignedName(JNIEnv *env, jobject self, jlong target) { UNREF(self); - ServerObject* object = NULL; + ServerObject* object = nullptr; if (!JavaLibrary::getObject(target, object)) return 0; @@ -915,7 +915,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::setCreatureName(JNIEnv * /*env*/, NetworkId const networkId(creature); CreatureObject * const creatureObject = CreatureObject::getCreatureObject(networkId); - if (creatureObject == NULL) + if (creatureObject == nullptr) { WARNING(true, ("ERROR: ScriptMethodsObjectInfo::setCreatureName() Unable to resolve the object(%s) to a CreatureObject.", networkId.getValueString().c_str())); return; @@ -923,7 +923,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::setCreatureName(JNIEnv * /*env*/, AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(creatureObject->getController()); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { WARNING(true, ("ERROR: ScriptMethodsObjectInfo::setCreatureName() Unable to resolve the object's(%s) controller to an AiCreatureController.", creatureObject->getDebugInformation().c_str())); return; @@ -941,14 +941,14 @@ jstring JNICALL ScriptMethodsObjectInfoNamespace::getCreatureName(JNIEnv * /*env NetworkId const networkId(creature); CreatureObject * const creatureObject = CreatureObject::getCreatureObject(networkId); - if (creatureObject == NULL) + if (creatureObject == nullptr) { return 0; } AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(creatureObject->getController()); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return 0; } @@ -972,13 +972,13 @@ jstring JNICALL ScriptMethodsObjectInfoNamespace::getCreatureName(JNIEnv * /*env * @param self class calling this function * @param target id of object whose name to get * - * @return the name, or null on error + * @return the name, or nullptr on error */ jobject JNICALL ScriptMethodsObjectInfoNamespace::getNameStringId(JNIEnv *env, jobject self, jlong target) { UNREF(self); - ServerObject* object = NULL; + ServerObject* object = nullptr; if (!JavaLibrary::getObject(target, object)) return 0; @@ -997,7 +997,7 @@ jobject JNICALL ScriptMethodsObjectInfoNamespace::getNameStringId(JNIEnv *env, j * @param self class calling this function * @param jtemplateName the template name * - * @return the name, or null if the template doesn't exist + * @return the name, or nullptr if the template doesn't exist */ jobject JNICALL ScriptMethodsObjectInfoNamespace::getNameFromTemplate(JNIEnv *env, jobject self, jstring jtemplateName) @@ -1020,41 +1020,41 @@ jobject JNICALL ScriptMethodsObjectInfoNamespace::getNameFromTemplate(JNIEnv *en * @param self class calling this function * @param templateCrc the template crc * - * @return the name, or null if the template doesn't exist + * @return the name, or nullptr if the template doesn't exist */ jobject JNICALL ScriptMethodsObjectInfoNamespace::getNameFromTemplateCrc(JNIEnv *env, jobject self, jint templateCrc) { const ObjectTemplate * ot = ObjectTemplateList::fetch(templateCrc); - if (ot == NULL) + if (ot == nullptr) return 0; // the name is stored in the shared template, so if this is a server template, // get the shared one from it - const SharedObjectTemplate * sharedOt = NULL; + const SharedObjectTemplate * sharedOt = nullptr; const ServerObjectTemplate * serverOt = dynamic_cast( ot); - if (serverOt != NULL) + if (serverOt != nullptr) { const std::string sharedTemplateName(serverOt->getSharedTemplate()); serverOt->releaseReference(); - serverOt = NULL; + serverOt = nullptr; ot = ObjectTemplateList::fetch(sharedTemplateName); - if (ot == NULL) + if (ot == nullptr) return 0; } sharedOt = dynamic_cast(ot); - if (sharedOt == NULL) + if (sharedOt == nullptr) { ot->releaseReference(); return 0; } - ot = NULL; + ot = nullptr; const StringId objectName(sharedOt->getObjectName()); sharedOt->releaseReference(); - sharedOt = NULL; + sharedOt = nullptr; LocalRefPtr jobjectName; if (!ScriptConversion::convert(objectName, jobjectName)) @@ -1069,7 +1069,7 @@ jobject JNICALL ScriptMethodsObjectInfoNamespace::getNameFromTemplateCrc(JNIEnv * @param self class calling this function * @param jtemplateNames the template names * - * @return the names, or null on error + * @return the names, or nullptr on error */ jobjectArray JNICALL ScriptMethodsObjectInfoNamespace::getNamesFromTemplates(JNIEnv *env, jobject self, jobjectArray jtemplateNames) @@ -1102,7 +1102,7 @@ jobjectArray JNICALL ScriptMethodsObjectInfoNamespace::getNamesFromTemplates(JNI * @param self class calling this function * @param jtemplateCrcs the template crcs * - * @return the names, or null on error + * @return the names, or nullptr on error */ jobjectArray JNICALL ScriptMethodsObjectInfoNamespace::getNamesFromTemplateCrcs(JNIEnv *env, jobject self, jintArray jtemplateCrcs) @@ -1140,7 +1140,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::internalIsAuthoritative(JNIEn { UNREF(self); - const ServerObject * object = NULL; + const ServerObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -1173,7 +1173,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::hasProxyOrAuthObject(JNIEnv * UNREF(self); - const ServerObject * object = NULL; + const ServerObject * object = nullptr; // if I'm not authoritative, then I must have an authoritative object on another game server // if I'm authoritative, then see if I'm proxied on any other game server @@ -1447,12 +1447,12 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isAwayFromKeyBoard(JNIEnv *en { UNREF(self); - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature)) return JNI_FALSE; PlayerObject * const playerObj = PlayerCreatureController::getPlayerObject(playerCreature); - if (playerObj != NULL && playerObj->isAwayFromKeyBoard()) + if (playerObj != nullptr && playerObj->isAwayFromKeyBoard()) { return JNI_TRUE; } @@ -1473,7 +1473,7 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getObjType(JNIEnv *env, jobject s { UNREF(self); - const Object *object = NULL; + const Object *object = nullptr; if (!JavaLibrary::getObject(target, object)) return -1; @@ -1487,13 +1487,13 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getObjType(JNIEnv *env, jobject s * @param self class calling this function * @param target object we want to check * - * @return the template type, or null on error + * @return the template type, or nullptr on error */ jstring JNICALL ScriptMethodsObjectInfoNamespace::getTemplateId(JNIEnv *env, jobject self, jlong target) { UNREF(self); - const Object *object = NULL; + const Object *object = nullptr; if (!JavaLibrary::getObject(target, object)) return 0; @@ -1507,12 +1507,12 @@ jstring JNICALL ScriptMethodsObjectInfoNamespace::getTemplateId(JNIEnv *env, job * @param self class calling this function * @param target object we want to check * - * @return the template type, or null on error + * @return the template type, or nullptr on error */ jstring JNICALL ScriptMethodsObjectInfoNamespace::getSharedObjectTemplateName(JNIEnv * /*env*/, jobject /*self*/, jlong target) { - Object const * object = NULL; + Object const * object = nullptr; if (!JavaLibrary::getObject(target, object)) return 0; @@ -2039,7 +2039,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isDisabled(JNIEnv *env, jobje return JNI_FALSE; // make sure the object isn't a creature or is a vehicle - if (object->asCreatureObject () != NULL && + if (object->asCreatureObject () != nullptr && !GameObjectTypes::isTypeOf (object->getGameObjectType (), SharedObjectTemplate::GOT_vehicle)) return JNI_FALSE; @@ -2093,7 +2093,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isCrafted(JNIEnv *env, jobjec return JNI_FALSE; // make sure the object isn't a creature - if (dynamic_cast(object) != NULL) + if (dynamic_cast(object) != nullptr) return JNI_FALSE; if (object->isCrafted()) @@ -2110,7 +2110,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isCrafted(JNIEnv *env, jobjec * @param self class calling this function * @param target object we want to know about * - * @return the crafter id, or null on error or if the item was not crafted + * @return the crafter id, or nullptr on error or if the item was not crafted */ jlong JNICALL ScriptMethodsObjectInfoNamespace::getCrafter(JNIEnv *env, jobject self, jlong target) { @@ -2168,7 +2168,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setCrafter(JNIEnv *env, jobje */ jfloat JNICALL ScriptMethodsObjectInfoNamespace::getScale(JNIEnv *env, jobject self, jlong target) { - const CreatureObject * creature = NULL; + const CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return -1.0f; @@ -2190,7 +2190,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setScale(JNIEnv *env, jobject if (scale <= 0) return JNI_FALSE; - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -2375,11 +2375,11 @@ jfloat JNICALL ScriptMethodsObjectInfoNamespace::getLocationDistance(JNIEnv *env // translate local coordinates to world coordinates Object * cell1 = NetworkIdManager::getObjectById(targetCell1); - if (cell1 == NULL) + if (cell1 == nullptr) return -1; const Vector & worldLoc1 = cell1->rotateTranslate_o2w(targetLoc1); Object * cell2 = NetworkIdManager::getObjectById(targetCell2); - if (cell2 == NULL) + if (cell2 == nullptr) return -1; const Vector & worldLoc2 = cell2->rotateTranslate_o2w(targetLoc2); @@ -2433,13 +2433,13 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isLocationInConicalFrustum(JN // translate local coordinates to world coordinates if they are in cells Object * testCell = NetworkIdManager::getObjectById(testCellId); - Vector testWorldLoc = (testCell != NULL) ? testCell->rotateTranslate_o2w(testLoc) : testLoc; + Vector testWorldLoc = (testCell != nullptr) ? testCell->rotateTranslate_o2w(testLoc) : testLoc; Object * startCell = NetworkIdManager::getObjectById(startCellId); - Vector startWorldLoc = (startCell != NULL) ? startCell->rotateTranslate_o2w(startLoc) : startLoc; + Vector startWorldLoc = (startCell != nullptr) ? startCell->rotateTranslate_o2w(startLoc) : startLoc; Object * endCell = NetworkIdManager::getObjectById(endCellId); - Vector endWorldLoc = (endCell != NULL) ? endCell->rotateTranslate_o2w(endLoc) : endLoc; + Vector endWorldLoc = (endCell != nullptr) ? endCell->rotateTranslate_o2w(endLoc) : endLoc; if(use2d) { @@ -2504,13 +2504,13 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isLocationInCone(JNIEnv *env, // translate local coordinates to world coordinates if they are in cells Object * testCell = NetworkIdManager::getObjectById(testCellId); - Vector const& testWorldLoc = (testCell != NULL) ? testCell->rotateTranslate_o2w(testLoc) : testLoc; + Vector const& testWorldLoc = (testCell != nullptr) ? testCell->rotateTranslate_o2w(testLoc) : testLoc; Object * startCell = NetworkIdManager::getObjectById(startCellId); - Vector const & startWorldLoc = (startCell != NULL) ? startCell->rotateTranslate_o2w(startLoc) : startLoc; + Vector const & startWorldLoc = (startCell != nullptr) ? startCell->rotateTranslate_o2w(startLoc) : startLoc; Object * endCell = NetworkIdManager::getObjectById(endCellId); - Vector const & endWorldLoc = (endCell != NULL) ? endCell->rotateTranslate_o2w(endLoc) : endLoc; + Vector const & endWorldLoc = (endCell != nullptr) ? endCell->rotateTranslate_o2w(endLoc) : endLoc; Vector testPointConeSpace = testWorldLoc - startWorldLoc; if(use2d) @@ -2606,7 +2606,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isInWorldCell(JNIEnv *env, jo UNREF(self); NOT_NULL(env); - ServerObject* object = NULL; + ServerObject* object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -2704,7 +2704,7 @@ namespace //-- validate arguments if (!customizationVariable || !context) { - DEBUG_FATAL(true, ("programmer error: callback made with NULL arguments.\n")); + DEBUG_FATAL(true, ("programmer error: callback made with nullptr arguments.\n")); return; } @@ -2736,7 +2736,7 @@ namespace * Java custom_var. * * @return the Java-accessible custom_var instance, the script-side counterpart to - * the given C++-side CustomizationVariable. Will return NULL if + * the given C++-side CustomizationVariable. Will return nullptr if * a Java exception or other error occurs. */ LocalRefPtr ScriptMethodsObjectInfoNamespace::createCustomVar(const jlong &objId, const std::string &variablePathName, CustomizationVariable &variable) @@ -2779,7 +2779,7 @@ LocalRefPtr ScriptMethodsObjectInfoNamespace::createCustomVar(const jlong &objId * Java custom_var. * * @return the Java-accessible ranged_int_custom_var instance, the script-side counterpart to - * the given C++-side CustomizationVariable. Will return NULL if + * the given C++-side CustomizationVariable. Will return nullptr if * a Java exception or other error occurs. */ LocalRefPtr ScriptMethodsObjectInfoNamespace::createRangedIntCustomVar(const jlong &objId, const std::string &variablePathName, RangedIntCustomizationVariable &rangedIntVariable) @@ -2818,7 +2818,7 @@ LocalRefPtr ScriptMethodsObjectInfoNamespace::createRangedIntCustomVar(const jlo * Java custom_var. * * @return the Java-accessible palcolor_custom_var instance, the script-side counterpart to - * the given C++-side CustomizationVariable. Will return NULL if + * the given C++-side CustomizationVariable. Will return nullptr if * a Java exception or other error occurs. */ LocalRefPtr ScriptMethodsObjectInfoNamespace::createPalcolorCustomVar(const jlong &objId, const std::string &variablePathName, PaletteColorCustomizationVariable &variable) @@ -2854,10 +2854,10 @@ LocalRefPtr ScriptMethodsObjectInfoNamespace::createColor(int r, int g, int b, i * Fetch the CustomizationData instance associated with the Object * specified by the given obj_id. * - * This function may return NULL if the specified object doesn't have + * This function may return nullptr if the specified object doesn't have * customization data or if some other error occurs. * - * The caller must call CustomizationData::release() on the non-NULL return + * The caller must call CustomizationData::release() on the non-nullptr return * value when the reference no longer is needed. Failure to do so will cause * a memory leak. * @@ -2865,21 +2865,21 @@ LocalRefPtr ScriptMethodsObjectInfoNamespace::createColor(int r, int g, int b, i * CustomizationData instance should be retrieved. * * @return the CustomizationData instance associated with the specified - * Object. May return NULL if the Object doesn't have customization + * Object. May return nullptr if the Object doesn't have customization * data or if an error occurs. */ CustomizationData *ScriptMethodsObjectInfoNamespace::fetchCustomizationDataFromObjId(jlong objId) { PROFILER_AUTO_BLOCK_DEFINE("JNI::fetchCustomizationDataFromObjId"); if (!objId) - return NULL; + return nullptr; //-- Get the target TangibleObject. TangibleObject *object = 0; if (!JavaLibrary::getObject(objId, object)) { // this Object doesn't exist or isn't derived from TangibleObject - return NULL; + return nullptr; } //-- Fetch the CustomizationData. @@ -2887,15 +2887,15 @@ CustomizationData *ScriptMethodsObjectInfoNamespace::fetchCustomizationDataFromO if (!cdProperty) { // this Object doesn't expose any customization data - return NULL; + return nullptr; } CustomizationData *const customizationData = cdProperty->fetchCustomizationData(); if (!customizationData) { // this shouldn't happen - DEBUG_WARNING(true, ("CustomizationDataProperty returned NULL CustomizationData on fetch().\n")); - return NULL; + DEBUG_WARNING(true, ("CustomizationDataProperty returned nullptr CustomizationData on fetch().\n")); + return nullptr; } //-- return the CustomizationData instance. @@ -2910,7 +2910,7 @@ jobjectArray JNICALL ScriptMethodsObjectInfoNamespace::getAllCustomVars(JNIEnv * //-- get the CustomizationData instance for the target object. CustomizationData *const customizationData = fetchCustomizationDataFromObjId(target); if (!customizationData) - return NULL; + return nullptr; //-- collect all local CustomizationVariable instances. // NOTE: if we allow multithreaded access to this code from script, we cannot use this static @@ -2961,7 +2961,7 @@ jobjectArray JNICALL ScriptMethodsObjectInfoNamespace::getAllCustomVars(JNIEnv * customizationData->release(); //-- return result - if (customVarArray.get() != NULL) + if (customVarArray.get() != nullptr) return customVarArray->getReturnValue(); return 0; } @@ -2975,7 +2975,7 @@ jobject JNICALL ScriptMethodsObjectInfoNamespace::getCustomVarByName(JNIEnv * /* //-- get the CustomizationData instance for the target object. CustomizationData *const customizationData = fetchCustomizationDataFromObjId(target); if (!customizationData) - return NULL; + return nullptr; //-- get the CustomizationVariable for the specified variable name std::string nativeVarPathName; @@ -2983,7 +2983,7 @@ jobject JNICALL ScriptMethodsObjectInfoNamespace::getCustomVarByName(JNIEnv * /* CustomizationVariable *const variable = customizationData->findVariable(nativeVarPathName); if (!variable) - return NULL; + return nullptr; //-- create a Java custom_var based on this CustomizationVariable LocalRefPtr newCustomVar = createCustomVar(target, nativeVarPathName, *variable); @@ -3089,7 +3089,7 @@ jobject JNICALL ScriptMethodsObjectInfoNamespace::getPalcolorCustomVarSelectedCo customizationData->release(); if (error) - return NULL; + return nullptr; //-- return value return createColor(color.getR(), color.getG(), color.getB(), color.getA())->getReturnValue(); @@ -3196,7 +3196,7 @@ jobjectArray JNICALL ScriptMethodsObjectInfoNamespace::getPalcolorCustomVarColor customizationData->release(); //-- return result - if (colorArray.get() != NULL) + if (colorArray.get() != nullptr) return colorArray->getReturnValue(); return 0; } @@ -3205,7 +3205,7 @@ jobjectArray JNICALL ScriptMethodsObjectInfoNamespace::getPalcolorCustomVarColor jobjectArray JNICALL ScriptMethodsObjectInfoNamespace::getCtsDestinationClusters(JNIEnv * /*env*/, jobject /*self*/) { - static std::set * s_ctsDestinationClusters = NULL; + static std::set * s_ctsDestinationClusters = nullptr; if (!s_ctsDestinationClusters) { s_ctsDestinationClusters = new std::set; @@ -3449,15 +3449,15 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::kill(JNIEnv *env, jobject sel * @param env Java environment * @param self class calling this function * @param player the player - * @param killer who killed the player (may be null) + * @param killer who killed the player (may be nullptr) * - * @return the corpse id of the player, or null on error + * @return the corpse id of the player, or nullptr on error */ jobject JNICALL ScriptMethodsObjectInfoNamespace::killPlayer(JNIEnv *env, jobject self, jobject player, jobject killer) { static const std::string corpseTemplateName("object/tangible/container/corpse/player_corpse.iff"); - CreatureObject * playerObject = NULL; + CreatureObject * playerObject = nullptr; if (!JavaLibrary::getObject(player, playerObject)) return 0; @@ -3474,7 +3474,7 @@ jobject JNICALL ScriptMethodsObjectInfoNamespace::killPlayer(JNIEnv *env, jobjec Transform tr; tr.setPosition_p(playerObject->getPosition_p()); ServerObject * corpse = ServerWorld::createNewObject(corpseTemplateName, tr, cell, true); - if (corpse == NULL) + if (corpse == nullptr) return 0; if (playerObject->makeDead(killerId, corpse->getNetworkId())) @@ -3557,7 +3557,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setInvulnerable(JNIEnv *env, { UNREF(self); - TangibleObject * object = NULL; + TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -3580,7 +3580,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isInvulnerable(JNIEnv *env, j { UNREF(self); - TangibleObject * object = NULL; + TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -3602,7 +3602,7 @@ jfloat JNICALL ScriptMethodsObjectInfoNamespace::getComplexity(JNIEnv *env, jobj { UNREF(self); - const ServerObject * object = NULL; + const ServerObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return -1; @@ -3625,7 +3625,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setComplexity(JNIEnv *env, jo { UNREF(self); - ServerObject * object = NULL; + ServerObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -3639,7 +3639,7 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getGameObjectType(JNIEnv *env, jo { UNREF (self); - ServerObject * object = NULL; + ServerObject * object = nullptr; if (!JavaLibrary::getObject(obj, object)) return JNI_FALSE; @@ -3662,13 +3662,13 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getGameObjectTypeFromTemplate(JNI jint JNICALL ScriptMethodsObjectInfoNamespace::getGameObjectTypeFromTemplateCrc(JNIEnv *env, jobject self, jint templateCrc) { const ObjectTemplate * objectTemplate = ObjectTemplateList::fetch(templateCrc); - if (objectTemplate == NULL) + if (objectTemplate == nullptr) return 0; const std::string & sharedTemplateName = safe_cast(objectTemplate)->getSharedTemplate(); const ObjectTemplate * sharedTemplate = ObjectTemplateList::fetch(sharedTemplateName); objectTemplate->releaseReference(); - if (sharedTemplate == NULL) + if (sharedTemplate == nullptr) return 0; jint got = safe_cast(sharedTemplate)->getGameObjectType(); @@ -3710,11 +3710,11 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isGod(JNIEnv *env, jobject se { UNREF (self); - const ServerObject * object = NULL; + const ServerObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; - if (object->getClient() == NULL) + if (object->getClient() == nullptr) return JNI_FALSE; return object->getClient()->isGod(); @@ -3735,11 +3735,11 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getGodLevel(JNIEnv *env, jobject { UNREF (self); - const ServerObject * object = NULL; + const ServerObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return 0; - if (object->getClient() == NULL) + if (object->getClient() == nullptr) return 0; if (object->getClient()->isGod()) @@ -3763,13 +3763,13 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getCount(JNIEnv *env, jobject sel // both Tangible and Intangible have counters, so we have to test for both // cases - const TangibleObject * tangibleObject = NULL; + const TangibleObject * tangibleObject = nullptr; if (JavaLibrary::getObject(target, tangibleObject)) { return tangibleObject->getCount(); } - const IntangibleObject * intangibleObject = NULL; + const IntangibleObject * intangibleObject = nullptr; if (JavaLibrary::getObject(target, intangibleObject)) { return intangibleObject->getCount(); @@ -3795,14 +3795,14 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setCount(JNIEnv *env, jobject // both Tangible and Intangible have counters, so we have to test for both // cases - TangibleObject * tangibleObject = NULL; + TangibleObject * tangibleObject = nullptr; if (JavaLibrary::getObject(target, tangibleObject)) { tangibleObject->setCount(value); return JNI_TRUE; } - IntangibleObject * intangibleObject = NULL; + IntangibleObject * intangibleObject = nullptr; if (JavaLibrary::getObject(target, intangibleObject)) { intangibleObject->setCount(value); @@ -3829,14 +3829,14 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::incrementCount(JNIEnv *env, j // both Tangible and Intangible have counters, so we have to test for both // cases - TangibleObject * tangibleObject = NULL; + TangibleObject * tangibleObject = nullptr; if (JavaLibrary::getObject(target, tangibleObject)) { tangibleObject->incrementCount(delta); return JNI_TRUE; } - IntangibleObject * intangibleObject = NULL; + IntangibleObject * intangibleObject = nullptr; if (JavaLibrary::getObject(target, intangibleObject)) { intangibleObject->incrementCount(delta); @@ -3859,7 +3859,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::incrementCount(JNIEnv *env, j */ jint JNICALL ScriptMethodsObjectInfoNamespace::getCondition(JNIEnv *env, jobject self, jlong target) { - const TangibleObject * object = NULL; + const TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return 0; @@ -3880,7 +3880,7 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getCondition(JNIEnv *env, jobject */ jboolean JNICALL ScriptMethodsObjectInfoNamespace::hasCondition(JNIEnv *env, jobject self, jlong target, jint condition) { - const TangibleObject * object = NULL; + const TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -3901,7 +3901,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::hasCondition(JNIEnv *env, job */ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setCondition(JNIEnv *env, jobject self, jlong target, jint condition) { - TangibleObject * object = NULL; + TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -3923,7 +3923,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setCondition(JNIEnv *env, job */ jboolean JNICALL ScriptMethodsObjectInfoNamespace::clearCondition(JNIEnv *env, jobject self, jlong target, jint condition) { - TangibleObject * object = NULL; + TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -4748,7 +4748,7 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getGroupLevel(JNIEnv *, jobject, { if (!target) { - DEBUG_WARNING (true, ("JavaLibrary::getGroupLevel null target ")); + DEBUG_WARNING (true, ("JavaLibrary::getGroupLevel nullptr target ")); return 0; } @@ -4864,18 +4864,18 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::getVisibleOnMapAndRadar(JNIEn * @param self class calling this function * @param target the object * - * @return the appearance name, or null on error + * @return the appearance name, or nullptr on error */ jstring JNICALL ScriptMethodsObjectInfoNamespace::getAppearance(JNIEnv * env, jobject self, jlong target) { UNREF(self); - const ServerObject * object = NULL; + const ServerObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return 0; const SharedObjectTemplate * sharedTemplate = object->getSharedTemplate(); - if (sharedTemplate == NULL) + if (sharedTemplate == nullptr) return 0; JavaString appearance(sharedTemplate->getAppearanceFilename()); @@ -4897,7 +4897,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isInsured(JNIEnv * env, jobje { UNREF(self); - const TangibleObject * object = NULL; + const TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -4919,7 +4919,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isAutoInsured(JNIEnv * env, j { UNREF(self); - const TangibleObject * object = NULL; + const TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -4941,7 +4941,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isUninsurable(JNIEnv * env, j { UNREF(self); - const TangibleObject * object = NULL; + const TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -4959,13 +4959,13 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isUninsurable(JNIEnv * env, j * @param self class calling this function * @param player the player to get objects from * - * @return an array of objects, or null on error + * @return an array of objects, or nullptr on error */ jlongArray JNICALL ScriptMethodsObjectInfoNamespace::getInventoryAndEquipment(JNIEnv * env, jobject self, jlong player) { UNREF(self); - const CreatureObject * playerCreature = NULL; + const CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature)) return 0; @@ -4973,11 +4973,11 @@ jlongArray JNICALL ScriptMethodsObjectInfoNamespace::getInventoryAndEquipment(JN // go through the player's inventory const ServerObject * inventoryObject = playerCreature->getInventory(); - if (inventoryObject != NULL) + if (inventoryObject != nullptr) { const VolumeContainer * inventoryContainer = ContainerInterface::getVolumeContainer(*inventoryObject); - if (inventoryContainer != NULL) + if (inventoryContainer != nullptr) { getGoodItemsFromContainer(*inventoryContainer, objectIds); } @@ -4998,7 +4998,7 @@ jlongArray JNICALL ScriptMethodsObjectInfoNamespace::getInventoryAndEquipment(JN // go through the player's equipment SlottedContainer const * const equipmentContainer = ContainerInterface::getSlottedContainer(*playerCreature); - if (equipmentContainer != NULL) + if (equipmentContainer != nullptr) getGoodItemsFromContainer(*equipmentContainer, objectIds); else { @@ -5022,12 +5022,12 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setCheaterLevel(JNIEnv * env, { UNREF(self); - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature)) return JNI_FALSE; PlayerObject * const playerObj = PlayerCreatureController::getPlayerObject(playerCreature); - if (playerObj != NULL && playerObj->isAuthoritative()) + if (playerObj != nullptr && playerObj->isAuthoritative()) { playerObj->setCheaterLevel(static_cast(level)); return JNI_TRUE; @@ -5042,12 +5042,12 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getCheaterLevel(JNIEnv * env, job { UNREF(self); - const CreatureObject * playerCreature = NULL; + const CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature)) return 0; PlayerObject const * const playerObj = PlayerCreatureController::getPlayerObject(playerCreature); - if (playerObj != NULL) + if (playerObj != nullptr) { return static_cast(playerObj->getCheaterLevel()); } @@ -5071,7 +5071,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setHouseId(JNIEnv * env, jobj { UNREF(self); - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature)) return JNI_FALSE; @@ -5090,13 +5090,13 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setHouseId(JNIEnv * env, jobj * @param self class calling this function * @param player the player * - * @return the house id, or null on error + * @return the house id, or nullptr on error */ jlong JNICALL ScriptMethodsObjectInfoNamespace::getHouseId(JNIEnv * env, jobject self, jlong player) { UNREF(self); - const CreatureObject * playerCreature = NULL; + const CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature)) return 0; @@ -5113,16 +5113,16 @@ jlong JNICALL ScriptMethodsObjectInfoNamespace::getHouseId(JNIEnv * env, jobject * @param self class calling this function * @param object the manf schematic or factory id * - * @return the draft schematic name, or null on error + * @return the draft schematic name, or nullptr on error */ jstring JNICALL ScriptMethodsObjectInfoNamespace::getDraftSchematic(JNIEnv * env, jobject self, jlong object) { UNREF(self); - const ManufactureObjectInterface * craftable = NULL; + const ManufactureObjectInterface * craftable = nullptr; - const FactoryObject * factoryObject = NULL; - const ManufactureSchematicObject * manfSchematicObject = NULL; + const FactoryObject * factoryObject = nullptr; + const ManufactureSchematicObject * manfSchematicObject = nullptr; if (JavaLibrary::getObject(object, manfSchematicObject)) { craftable = manfSchematicObject; @@ -5136,7 +5136,7 @@ jstring JNICALL ScriptMethodsObjectInfoNamespace::getDraftSchematic(JNIEnv * env const ConstCharCrcString draftSchematic(ObjectTemplateList::lookUp( craftable->getDraftSchematic())); - if (draftSchematic.getString() == NULL) + if (draftSchematic.getString() == nullptr) return 0; return JavaString(draftSchematic.getString()).getReturnValue(); @@ -5152,16 +5152,16 @@ jstring JNICALL ScriptMethodsObjectInfoNamespace::getDraftSchematic(JNIEnv * env * @param self class calling this function * @param object the manf schematic or factory id * - * @return the draft schematic name crc, or null on error + * @return the draft schematic name crc, or nullptr on error */ jint JNICALL ScriptMethodsObjectInfoNamespace::getDraftSchematicCrc(JNIEnv * env, jobject self, jlong object) { UNREF(self); - const ManufactureObjectInterface * craftable = NULL; + const ManufactureObjectInterface * craftable = nullptr; - const FactoryObject * factoryObject = NULL; - const ManufactureSchematicObject * manfSchematicObject = NULL; + const FactoryObject * factoryObject = nullptr; + const ManufactureSchematicObject * manfSchematicObject = nullptr; if (JavaLibrary::getObject(object, manfSchematicObject)) { craftable = manfSchematicObject; @@ -5175,7 +5175,7 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getDraftSchematicCrc(JNIEnv * env const ConstCharCrcString draftSchematic(ObjectTemplateList::lookUp( craftable->getDraftSchematic())); - if (draftSchematic.getString() == NULL) + if (draftSchematic.getString() == nullptr) return 0; return draftSchematic.getCrc(); @@ -5196,7 +5196,7 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getSourceDraftSchematic(JNIEnv * { UNREF(self); - const TangibleObject * object = NULL; + const TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return 0; @@ -5219,13 +5219,13 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getPlayerBirthDate(JNIEnv * env, { UNREF(self); - const CreatureObject * playerCreature = NULL; + const CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(playerId, playerCreature)) return -1; const PlayerObject * player = PlayerCreatureController::getPlayerObject( playerCreature); - if (player == NULL) + if (player == nullptr) return -1; return player->getBornDate(); @@ -5263,13 +5263,13 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getPlayerPlayedTime(JNIEnv * env, { UNREF(self); - const CreatureObject * playerCreature = NULL; + const CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(playerId, playerCreature)) return -1; const PlayerObject * player = PlayerCreatureController::getPlayerObject( playerCreature); - if (player == NULL) + if (player == nullptr) return -1; return player->getPlayedTime(); @@ -5306,7 +5306,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::setBuildingCityId(JNIEnv *env, jo * @param self class calling this function * @param jschematicName the schematic name * - * @return the object name, or null if the schematic doesn't exist + * @return the object name, or nullptr if the schematic doesn't exist */ jobject JNICALL ScriptMethodsObjectInfoNamespace::getProductNameFromSchematic(JNIEnv *env, jobject self, jstring jschematicName) @@ -5319,30 +5319,30 @@ jobject JNICALL ScriptMethodsObjectInfoNamespace::getProductNameFromSchematic(JN const DraftSchematicObject * schematic = DraftSchematicObject::getSchematic( schematicName); - if (schematic == NULL) + if (schematic == nullptr) return 0; const ServerObjectTemplate * serverOt = schematic->getCraftedObjectTemplate(); - if (serverOt == NULL) + if (serverOt == nullptr) return 0; const std::string sharedTemplateName(serverOt->getSharedTemplate()); const ObjectTemplate * ot = ObjectTemplateList::fetch(sharedTemplateName); - if (ot == NULL) + if (ot == nullptr) return 0; const SharedObjectTemplate * sharedOt = dynamic_cast( ot); - if (sharedOt == NULL) + if (sharedOt == nullptr) { ot->releaseReference(); return 0; } - ot = NULL; + ot = nullptr; const StringId objectName(sharedOt->getObjectName()); sharedOt->releaseReference(); - sharedOt = NULL; + sharedOt = nullptr; LocalRefPtr jobjectName; if (!ScriptConversion::convert(objectName, jobjectName)) @@ -5360,37 +5360,37 @@ jobject JNICALL ScriptMethodsObjectInfoNamespace::getProductNameFromSchematic(JN * @param self class calling this function * @param schematicCrc the schematic name crc * - * @return the object name, or null if the schematic doesn't exist + * @return the object name, or nullptr if the schematic doesn't exist */ jobject JNICALL ScriptMethodsObjectInfoNamespace::getProductNameFromSchematicCrc(JNIEnv *env, jobject self, jint schematicCrc) { const DraftSchematicObject * schematic = DraftSchematicObject::getSchematic( schematicCrc); - if (schematic == NULL) + if (schematic == nullptr) return 0; const ServerObjectTemplate * serverOt = schematic->getCraftedObjectTemplate(); - if (serverOt == NULL) + if (serverOt == nullptr) return 0; const std::string sharedTemplateName(serverOt->getSharedTemplate()); const ObjectTemplate * ot = ObjectTemplateList::fetch(sharedTemplateName); - if (ot == NULL) + if (ot == nullptr) return 0; const SharedObjectTemplate * sharedOt = dynamic_cast( ot); - if (sharedOt == NULL) + if (sharedOt == nullptr) { ot->releaseReference(); return 0; } - ot = NULL; + ot = nullptr; const StringId objectName(sharedOt->getObjectName()); sharedOt->releaseReference(); - sharedOt = NULL; + sharedOt = nullptr; LocalRefPtr jobjectName; if (!ScriptConversion::convert(objectName, jobjectName)) @@ -5407,7 +5407,7 @@ jobject JNICALL ScriptMethodsObjectInfoNamespace::getProductNameFromSchematicCrc * @param self class calling this function * @param draftSchematic the draft schematic's template * - * @return the template for the item the schematic creates, or null on error + * @return the template for the item the schematic creates, or nullptr on error */ jstring JNICALL ScriptMethodsObjectInfoNamespace::getTemplateCreatedFromSchematic(JNIEnv *env, jobject self, jstring draftSchematic) @@ -5433,7 +5433,7 @@ jstring JNICALL ScriptMethodsObjectInfoNamespace::getTemplateCreatedFromSchemati * @param self class calling this function * @param draftSchematicCrc the draft schematic's template crc * - * @return the template for the item the schematic creates, or null on error + * @return the template for the item the schematic creates, or nullptr on error */ jstring JNICALL ScriptMethodsObjectInfoNamespace::getTemplateCreatedFromSchematicCrc(JNIEnv *env, jobject self, jint draftSchematicCrc) @@ -5445,11 +5445,11 @@ jstring JNICALL ScriptMethodsObjectInfoNamespace::getTemplateCreatedFromSchemati const DraftSchematicObject * schematic = DraftSchematicObject::getSchematic( draftSchematicCrc); - if (schematic == NULL) + if (schematic == nullptr) return 0; const ServerObjectTemplate * serverOt = schematic->getCraftedObjectTemplate(); - if (serverOt == NULL) + if (serverOt == nullptr) return 0; JavaString templateName(serverOt->getName()); @@ -5503,11 +5503,11 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getTemplateCrcCreatedFromSchemati const DraftSchematicObject * schematic = DraftSchematicObject::getSchematic( draftSchematicCrc); - if (schematic == NULL) + if (schematic == nullptr) return 0; const ServerObjectTemplate * serverOt = schematic->getCraftedObjectTemplate(); - if (serverOt == NULL) + if (serverOt == nullptr) return 0; return Crc::calculate(serverOt->getName()); @@ -5717,7 +5717,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::requestPreloadCompleteTrigger(JNI void JNICALL ScriptMethodsObjectInfoNamespace::activateQuest(JNIEnv * env, jobject self, jlong target, jint questId) { - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (JavaLibrary::getObject(target, playerCreature)) { PlayerObject * player = PlayerCreatureController::getPlayerObject(playerCreature); @@ -5733,7 +5733,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::activateQuest(JNIEnv * env, jobje void JNICALL ScriptMethodsObjectInfoNamespace::deactivateQuest(JNIEnv * env, jobject self, jlong target, jint questId) { - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (JavaLibrary::getObject(target, playerCreature)) { PlayerObject * player = PlayerCreatureController::getPlayerObject(playerCreature); @@ -5749,7 +5749,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::deactivateQuest(JNIEnv * env, job void JNICALL ScriptMethodsObjectInfoNamespace::completeQuest(JNIEnv * env, jobject self, jlong target, jint questId) { - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (JavaLibrary::getObject(target, playerCreature)) { PlayerObject * player = PlayerCreatureController::getPlayerObject(playerCreature); @@ -5766,7 +5766,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::completeQuest(JNIEnv * env, jobje jboolean JNICALL ScriptMethodsObjectInfoNamespace::isQuestComplete(JNIEnv * env, jobject self, jlong target, jint questId) { jboolean result = false; - const CreatureObject * playerCreature = NULL; + const CreatureObject * playerCreature = nullptr; if (JavaLibrary::getObject(target, playerCreature)) { const PlayerObject * player = PlayerCreatureController::getPlayerObject(playerCreature); @@ -5783,7 +5783,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isQuestComplete(JNIEnv * env, jboolean JNICALL ScriptMethodsObjectInfoNamespace::isQuestActive(JNIEnv * env, jobject self, jlong target, jint questId) { jboolean result = false; - const CreatureObject * playerCreature = NULL; + const CreatureObject * playerCreature = nullptr; if (JavaLibrary::getObject(target, playerCreature)) { const PlayerObject * player = PlayerCreatureController::getPlayerObject(playerCreature); @@ -5801,7 +5801,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::clearCompletedQuest(JNIEnv * env, { if(questId >= 0) { - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (JavaLibrary::getObject(target, playerCreature)) { PlayerObject * player = PlayerCreatureController::getPlayerObject(playerCreature); @@ -5817,7 +5817,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::clearCompletedQuest(JNIEnv * env, jboolean JNICALL ScriptMethodsObjectInfoNamespace::canTrade(JNIEnv *env, jobject self, jlong target) { - const ServerObject * object = NULL; + const ServerObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -5828,7 +5828,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::canTrade(JNIEnv *env, jobject jboolean JNICALL ScriptMethodsObjectInfoNamespace::isNoTradeShared(JNIEnv *env, jobject self, jlong target) { - const ServerObject * object = NULL; + const ServerObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -5845,16 +5845,16 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isNoTradeShared(JNIEnv *env, * @param self class calling this function * @param player the player to check * - * @return the theater id, or null on error + * @return the theater id, or nullptr on error */ jlong JNICALL ScriptMethodsObjectInfoNamespace::getLastSpawnedTheater(JNIEnv *env, jobject self, jlong player) { - const CreatureObject * creature = NULL; + const CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(player, creature)) return 0; const PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(creature); - if (playerObject == NULL) + if (playerObject == nullptr) return 0; return (playerObject->getTheater()).getValue(); @@ -5930,7 +5930,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::setAutoVariableFromByteStream(JNI */ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setBioLink(JNIEnv *env, jobject self, jlong target, jlong link) { - TangibleObject * object = NULL; + TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -5955,7 +5955,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setBioLink(JNIEnv *env, jobje */ jboolean JNICALL ScriptMethodsObjectInfoNamespace::clearBioLink(JNIEnv *env, jobject self, jlong target) { - TangibleObject * object = NULL; + TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -5972,11 +5972,11 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::clearBioLink(JNIEnv *env, job * @param self class calling this function * @param target the item to get the link from * - * @return the bio-link id, null if the item isn't linked + * @return the bio-link id, nullptr if the item isn't linked */ jlong JNICALL ScriptMethodsObjectInfoNamespace::getBioLink(JNIEnv *env, jobject self, jlong target) { - const TangibleObject * object = NULL; + const TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return 0; @@ -5990,7 +5990,7 @@ jlong JNICALL ScriptMethodsObjectInfoNamespace::getBioLink(JNIEnv *env, jobject float JNICALL ScriptMethodsObjectInfoNamespace::getObjectCollisionRadius(JNIEnv * env, jobject self, jlong jobject_obj) { - const Object * object = NULL; + const Object * object = nullptr; if (!JavaLibrary::getObject(jobject_obj, object)) return 0.0f; @@ -6008,11 +6008,11 @@ float JNICALL ScriptMethodsObjectInfoNamespace::getObjectCollisionRadius(JNIEnv * @param self class calling this function * @param target id of the object * - * @return the name, or null on error + * @return the name, or nullptr on error */ jstring JNICALL ScriptMethodsObjectInfoNamespace::getStaticItemName(JNIEnv * /*env*/, jobject /*self*/, jlong target) { - const ServerObject * o = NULL; + const ServerObject * o = nullptr; if (!JavaLibrary::getObject(target, o)) return 0; @@ -6026,7 +6026,7 @@ jstring JNICALL ScriptMethodsObjectInfoNamespace::getStaticItemName(JNIEnv * /*e jint JNICALL ScriptMethodsObjectInfoNamespace::getStaticItemVersion(JNIEnv *env, jobject /*self*/, jlong target) { - const ServerObject * o = NULL; + const ServerObject * o = nullptr; if (!JavaLibrary::getObject(target, o)) return 0; @@ -6040,7 +6040,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::setStaticItemName(JNIEnv * /*env* NetworkId const networkId(target); ServerObject * const o = ServerObject::getServerObject(networkId); - if (o == NULL) + if (o == nullptr) { WARNING(true, ("ERROR: ScriptMethodsObjectInfo::setStaticItemName() Unable to resolve the object(%s).", networkId.getValueString().c_str())); return; @@ -6058,7 +6058,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::setStaticItemVersion(JNIEnv * /*e NetworkId const networkId(target); ServerObject * const o = ServerObject::getServerObject(networkId); - if (o == NULL) + if (o == nullptr) { WARNING(true, ("ERROR: ScriptMethodsObjectInfo::setStaticItemVersion() Unable to resolve the object(%s).", networkId.getValueString().c_str())); return; @@ -6071,7 +6071,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::setStaticItemVersion(JNIEnv * /*e jint JNICALL ScriptMethodsObjectInfoNamespace::getConversionId(JNIEnv * /*env*/, jobject /*self*/, jlong target) { - const ServerObject * o = NULL; + const ServerObject * o = nullptr; if (!JavaLibrary::getObject(target, o)) return 0; @@ -6085,7 +6085,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::setConversionId(JNIEnv * /*env*/, NetworkId const networkId(target); ServerObject * const o = ServerObject::getServerObject(networkId); - if (o == NULL) + if (o == nullptr) { WARNING(true, ("ERROR: ScriptMethodsObjectInfo::setConversionId() Unable to resolve the object(%s).", networkId.getValueString().c_str())); return; @@ -6098,7 +6098,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::setConversionId(JNIEnv * /*env*/, void JNICALL ScriptMethodsObjectInfoNamespace::openCustomizationWindow(JNIEnv *env, jobject self, jlong player, jlong object, jstring customVarName1, jint minVar1, jint maxVar1, jstring customVarName2, jint minVar2, jint maxVar2, jstring customVarName3, jint minVar3, jint maxVar3, jstring customVarName4, jint minVar4, jint maxVar4) { - CreatureObject * playerObject = NULL; + CreatureObject * playerObject = nullptr; if (!JavaLibrary::getObject(player, playerObject)) return; std::string customVarName1String; @@ -6142,7 +6142,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::openCustomizationWindow(JNIEnv *e NetworkId const objectId(object); - if (playerObject->isPlayerControlled() && playerObject->getController() != NULL) + if (playerObject->isPlayerControlled() && playerObject->getController() != nullptr) { playerObject->getController()->appendMessage( static_cast(CM_openCustomizationWindow), @@ -6253,7 +6253,7 @@ jfloat JNICALL ScriptMethodsObjectInfoNamespace::getDefaultScaleFromSharedObject jboolean JNICALL ScriptMethodsObjectInfoNamespace::setOverrideMapColor(JNIEnv * env, jobject self, jlong object, jint r, jint g, jint b) { - TangibleObject * tangible = NULL; + TangibleObject * tangible = nullptr; if (!JavaLibrary::getObject(object, tangible)) return JNI_FALSE; @@ -6269,7 +6269,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setOverrideMapColor(JNIEnv * jboolean JNICALL ScriptMethodsObjectInfoNamespace::clearOverrideMapColor(JNIEnv * env, jobject self, jlong object) { - TangibleObject * tangible = NULL; + TangibleObject * tangible = nullptr; if (!JavaLibrary::getObject(object, tangible)) return JNI_FALSE; @@ -6285,14 +6285,14 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::clearOverrideMapColor(JNIEnv jobject JNICALL ScriptMethodsObjectInfoNamespace::getOverrideMapColor(JNIEnv * env, jobject self, jlong object) { - TangibleObject * tangible = NULL; + TangibleObject * tangible = nullptr; if (!JavaLibrary::getObject(object, tangible)) - return NULL; + return nullptr; uint8 r, g, b; if(!tangible->getOverrideMapColor(r,g,b)) { - return NULL; + return nullptr; } return createColor(r, g, b, 255)->getReturnValue(); @@ -6302,7 +6302,7 @@ jobject JNICALL ScriptMethodsObjectInfoNamespace::getOverrideMapColor(JNIEnv * e jboolean JNICALL ScriptMethodsObjectInfoNamespace::setForceShowHam(JNIEnv * env, jobject self, jlong object, jboolean show) { - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(object, creature)) return JNI_FALSE; @@ -6317,8 +6317,8 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setForceShowHam(JNIEnv * env, jboolean JNICALL ScriptMethodsObjectInfoNamespace::isContainedByPlayerAppearanceInventory(JNIEnv *env, jobject self, jlong player, jlong item) { UNREF(self); - ServerObject *itemObj = NULL; - CreatureObject *playerObj = NULL; + ServerObject *itemObj = nullptr; + CreatureObject *playerObj = nullptr; if(!JavaLibrary::getObject(item, itemObj)) { @@ -6348,7 +6348,7 @@ jlongArray JNICALL ScriptMethodsObjectInfoNamespace::getAllItemsFromAppearanceIn { UNREF(self); - const CreatureObject * playerCreature = NULL; + const CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature)) return 0; @@ -6356,11 +6356,11 @@ jlongArray JNICALL ScriptMethodsObjectInfoNamespace::getAllItemsFromAppearanceIn // go through the player's appearance inventory const ServerObject * appearanceInventoryObject = playerCreature->getAppearanceInventory(); - if (appearanceInventoryObject != NULL) + if (appearanceInventoryObject != nullptr) { const SlottedContainer * appearanceInvContainer = ContainerInterface::getSlottedContainer(*appearanceInventoryObject); - if (appearanceInvContainer != NULL) + if (appearanceInvContainer != nullptr) { getGoodItemsFromContainer(*appearanceInvContainer, objectIds); } @@ -6395,7 +6395,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isAPlayerAppearanceInventoryC { UNREF(self); - const ServerObject * containerObj = NULL; + const ServerObject * containerObj = nullptr; if (!JavaLibrary::getObject(container, containerObj)) return JNI_FALSE; @@ -6412,7 +6412,7 @@ jlongArray JNICALL ScriptMethodsObjectInfoNamespace::getAllWornItems(JNIEnv *env { UNREF(self); - const CreatureObject * playerCreature = NULL; + const CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature)) return 0; @@ -6428,7 +6428,7 @@ jlongArray JNICALL ScriptMethodsObjectInfoNamespace::getAllWornItems(JNIEnv *env DEBUG_WARNING(true, ("JavaLibrary: getAllWornItems - Tried to get all the worn items(INCLUDING appearance items) from player [%s], but this player has no appearance inventory container.", playerCreature->getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } for (ContainerConstIterator i(appearanceInventory->begin()); i != appearanceInventory->end(); ++i) @@ -6436,7 +6436,7 @@ jlongArray JNICALL ScriptMethodsObjectInfoNamespace::getAllWornItems(JNIEnv *env const CachedNetworkId & itemId = *i; const ServerObject * item = safe_cast( itemId.getObject()); - if (item != NULL && item->asTangibleObject() != NULL && + if (item != nullptr && item->asTangibleObject() != nullptr && item->asTangibleObject()->isVisible()) { @@ -6459,7 +6459,7 @@ jlongArray JNICALL ScriptMethodsObjectInfoNamespace::getAllWornItems(JNIEnv *env DEBUG_WARNING(true, ("JavaLibrary: getAllWornItems - Tried to get all the worn items from player [%s], but this player has no creature slot container.", playerCreature->getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } for (ContainerConstIterator i(inventory->begin()); i != inventory->end(); ++i) @@ -6467,7 +6467,7 @@ jlongArray JNICALL ScriptMethodsObjectInfoNamespace::getAllWornItems(JNIEnv *env const CachedNetworkId & itemId = *i; const ServerObject * item = safe_cast( itemId.getObject()); - if (item != NULL && item->asTangibleObject() != NULL && + if (item != nullptr && item->asTangibleObject() != nullptr && item->asTangibleObject()->isVisible()) { const SlottedContainmentProperty * slottedContainment = ContainerInterface::getSlottedContainmentProperty(*item); // Get the slot property of our item. @@ -6507,7 +6507,7 @@ jlongArray JNICALL ScriptMethodsObjectInfoNamespace::getAllWornItems(JNIEnv *env return returnedIds->getReturnValue(); } - return NULL; + return nullptr; } @@ -6518,7 +6518,7 @@ jlong JNICALL ScriptMethodsObjectInfoNamespace::getAppearanceInventory(JNIEnv *e UNREF(env); UNREF(self); - const CreatureObject * playerCreature = NULL; + const CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature)) return 0; @@ -6536,11 +6536,11 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setDecoyOrigin(JNIEnv *env, j UNREF(env); UNREF(self); - CreatureObject * decoyCreature = NULL; + CreatureObject * decoyCreature = nullptr; if (!JavaLibrary::getObject(creature, decoyCreature)) return JNI_FALSE; - const CreatureObject * originCreature = NULL; + const CreatureObject * originCreature = nullptr; if (!JavaLibrary::getObject(origin, originCreature)) return JNI_FALSE; @@ -6561,7 +6561,7 @@ jlong JNICALL ScriptMethodsObjectInfoNamespace::getDecoyOrigin(JNIEnv *env, jobj UNREF(env); UNREF(self); - CreatureObject * decoyCreature = NULL; + CreatureObject * decoyCreature = nullptr; if (!JavaLibrary::getObject(creature, decoyCreature)) return JNI_FALSE; @@ -6578,7 +6578,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::openRatingWindow(JNIEnv * env UNREF(env); UNREF(self); - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature)) { DEBUG_WARNING(true, ("OpenRatingWindow: Failed to get valid creature object with OID %d", player)); @@ -6603,7 +6603,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::openRatingWindow(JNIEnv * env return JNI_FALSE; } - if (playerCreature->isPlayerControlled() && playerCreature->getController() != NULL) + if (playerCreature->isPlayerControlled() && playerCreature->getController() != nullptr) { playerCreature->getController()->appendMessage( static_cast(CM_openRatingWindow), @@ -6626,13 +6626,13 @@ void JNICALL ScriptMethodsObjectInfoNamespace::openExamineWindow(JNIEnv * env, j UNREF(env); UNREF(self); - CreatureObject const * playerCreature = NULL; + CreatureObject const * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature) || !playerCreature || !playerCreature->getClient()) { return; } - ServerObject const * itemObject = NULL; + ServerObject const * itemObject = nullptr; if (!JavaLibrary::getObject(item, itemObject) || !itemObject) { return; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsObjectMove.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsObjectMove.cpp index d345c4f0..2ba2beda 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsObjectMove.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsObjectMove.cpp @@ -215,7 +215,7 @@ const JNINativeMethod NATIVES[] = { */ bool ScriptMethodsObjectMoveNamespace::testInvalidObjectMove(const ServerObject * object) { - if (object->getCacheVersion() > 0 || object->getCellProperty() != NULL) + if (object->getCacheVersion() > 0 || object->getCellProperty() != nullptr) { char buffer[1024]; sprintf(buffer, "A script is trying to move object %s, which is a cached " @@ -323,7 +323,7 @@ jboolean JNICALL ScriptMethodsObjectMoveNamespace::setLocationFromObj(JNIEnv *en * @param self class calling this function * @param objectId object to get * - * @return the object's location, or null on error + * @return the object's location, or nullptr on error */ jobject JNICALL ScriptMethodsObjectMoveNamespace::getLocation(JNIEnv *env, jobject self, jlong objectId) { @@ -337,13 +337,13 @@ jobject JNICALL ScriptMethodsObjectMoveNamespace::getLocation(JNIEnv *env, jobje // (e.g. for mounts, the immediate Container is the mount). NOT_NULL(object); CellProperty const *const cellProperty = object->getParentCell(); - Object const *const cell = (cellProperty != NULL) ? &(cellProperty->getOwner()) : NULL; + Object const *const cell = (cellProperty != nullptr) ? &(cellProperty->getOwner()) : nullptr; // Remember, just because we're not in a cell doesn't mean we're not contained by something else, // particularly in the case of a rider mounted where the mount is in the world cell. - Vector const positionRelativeToCellOrWorld = (cell != NULL) ? object->getPosition_c() : + Vector const positionRelativeToCellOrWorld = (cell != nullptr) ? object->getPosition_c() : object->getPosition_w(); - NetworkId const &networkIdForCellOrWorld = (cell != NULL) ? cell->getNetworkId() : + NetworkId const &networkIdForCellOrWorld = (cell != nullptr) ? cell->getNetworkId() : NetworkId::cms_invalid; LocalRefPtr location; @@ -362,7 +362,7 @@ jobject JNICALL ScriptMethodsObjectMoveNamespace::getLocation(JNIEnv *env, jobje * @param self class calling this function * @param objectId object to get * - * @return the object's world location, or null on error + * @return the object's world location, or nullptr on error */ jobject JNICALL ScriptMethodsObjectMoveNamespace::getWorldLocation(JNIEnv *env, jobject self, jlong objectId) { @@ -387,7 +387,7 @@ jobject JNICALL ScriptMethodsObjectMoveNamespace::getWorldLocation(JNIEnv *env, * @param self class calling this function * @param objectId object to get * - * @return the object's location, or null on error + * @return the object's location, or nullptr on error */ jobject JNICALL ScriptMethodsObjectMoveNamespace::getHeading(JNIEnv *env, jobject self, jlong objectId) { @@ -553,7 +553,7 @@ jboolean JNICALL ScriptMethodsObjectMoveNamespace::faceToBehavior(JNIEnv *env, j jfloat JNICALL ScriptMethodsObjectMoveNamespace::getYaw(JNIEnv *env, jobject self, jlong target) { - const ServerObject * object = NULL; + const ServerObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return -1.0f; @@ -565,7 +565,7 @@ jfloat JNICALL ScriptMethodsObjectMoveNamespace::getYaw(JNIEnv *env, jobject sel jboolean JNICALL ScriptMethodsObjectMoveNamespace::setYaw(JNIEnv *env, jobject self, jlong target, jfloat yaw) { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::setYaw"); - ServerObject * object = NULL; + ServerObject * object = nullptr; { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::setYaw::getObject"); if (!JavaLibrary::getObject(target, object)) @@ -608,7 +608,7 @@ jboolean JNICALL ScriptMethodsObjectMoveNamespace::setYaw(JNIEnv *env, jobject s void JNICALL ScriptMethodsObjectMoveNamespace::modifyYaw(JNIEnv *env, jobject self, jlong target, jfloat degrees) { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::modifyYaw"); - ServerObject * object = NULL; + ServerObject * object = nullptr; { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::modifyYaw::getObject"); if (!JavaLibrary::getObject(target, object)) @@ -650,7 +650,7 @@ void JNICALL ScriptMethodsObjectMoveNamespace::modifyYaw(JNIEnv *env, jobject se void JNICALL ScriptMethodsObjectMoveNamespace::modifyPitch(JNIEnv *env, jobject self, jlong target, jfloat degrees) { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::modifyPitch"); - ServerObject * object = NULL; + ServerObject * object = nullptr; { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::modifyPitch::getObject"); if (!JavaLibrary::getObject(target, object)) @@ -692,7 +692,7 @@ void JNICALL ScriptMethodsObjectMoveNamespace::modifyPitch(JNIEnv *env, jobject void JNICALL ScriptMethodsObjectMoveNamespace::modifyRoll(JNIEnv *env, jobject self, jlong target, jfloat degrees) { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::modifyRoll"); - ServerObject * object = NULL; + ServerObject * object = nullptr; { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::modifyRoll::getObject"); if (!JavaLibrary::getObject(target, object)) @@ -734,7 +734,7 @@ void JNICALL ScriptMethodsObjectMoveNamespace::modifyRoll(JNIEnv *env, jobject s jfloatArray JNICALL ScriptMethodsObjectMoveNamespace::getQuaternion(JNIEnv *env, jobject self, jlong target) { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::getQuaternion"); - ServerObject * object = NULL; + ServerObject * object = nullptr; { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::getQuaternion::getObject"); if (!JavaLibrary::getObject(target, object)) @@ -771,7 +771,7 @@ jfloatArray JNICALL ScriptMethodsObjectMoveNamespace::getQuaternion(JNIEnv *env, void JNICALL ScriptMethodsObjectMoveNamespace::setQuaternion(JNIEnv *env, jobject self, jlong target, jfloat qw, jfloat qx, jfloat qy, jfloat qz) { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::setQuaternion"); - ServerObject * object = NULL; + ServerObject * object = nullptr; { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::setQuaternion::getObject"); if (!JavaLibrary::getObject(target, object)) @@ -804,7 +804,7 @@ void JNICALL ScriptMethodsObjectMoveNamespace::setQuaternion(JNIEnv *env, jobjec jint JNICALL ScriptMethodsObjectMoveNamespace::getFurnitureRotationDegree(JNIEnv *env, jobject self, jlong player) { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::getFurnitureRotationDegree"); - ServerObject * object = NULL; + ServerObject * object = nullptr; { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::getFurnitureRotationDegree::getObject"); if (!JavaLibrary::getObject(player, object)) @@ -823,11 +823,11 @@ jint JNICALL ScriptMethodsObjectMoveNamespace::getFurnitureRotationDegree(JNIEnv void JNICALL ScriptMethodsObjectMoveNamespace::saveDecorationLayout(JNIEnv *env, jobject self, jlong player, jlong pob, jint saveSlotNumber, jstring description) { - CreatureObject * playerObject = NULL; + CreatureObject * playerObject = nullptr; if (!JavaLibrary::getObject(player, playerObject) || !playerObject) return; - ServerObject const * pobObject = NULL; + ServerObject const * pobObject = nullptr; if (!JavaLibrary::getObject(pob, pobObject) || !pobObject) return; @@ -843,11 +843,11 @@ void JNICALL ScriptMethodsObjectMoveNamespace::saveDecorationLayout(JNIEnv *env, void JNICALL ScriptMethodsObjectMoveNamespace::restoreDecorationLayout(JNIEnv *env, jobject self, jlong player, jlong pob, jint saveSlotNumber) { - CreatureObject * playerObject = NULL; + CreatureObject * playerObject = nullptr; if (!JavaLibrary::getObject(player, playerObject) || !playerObject) return; - ServerObject const * pobObject = NULL; + ServerObject const * pobObject = nullptr; if (!JavaLibrary::getObject(pob, pobObject) || !pobObject) return; @@ -1402,11 +1402,11 @@ jobject JNICALL ScriptMethodsObjectMoveNamespace::getConnectedPlayerLocation(JNI std::map const & connectedCharacterLfgData = ServerUniverse::getConnectedCharacterLfgData(); std::map::const_iterator const iterFind = connectedCharacterLfgData.find(NetworkId(static_cast(player))); if (iterFind == connectedCharacterLfgData.end()) - return NULL; + return nullptr; LocalRefPtr dictionary = createNewObject(JavaLibrary::getClsDictionary(), JavaLibrary::getMidDictionary()); if (dictionary == LocalRef::cms_nullPtr) - return NULL; + return nullptr; callObjectMethod(*dictionary, JavaLibrary::getMidDictionaryPut(), JavaString("planet").getValue(), JavaString(iterFind->second.locationPlanet).getValue()); @@ -1457,7 +1457,7 @@ jfloat JNICALL ScriptMethodsObjectMoveNamespace::getMovementSpeed(JNIEnv * /*env NetworkId const networkId(object); CreatureController * const creatureController = CreatureController::getCreatureController(networkId); - return (creatureController != NULL) ? creatureController->getCurrentVelocity().magnitude() : 0.0f; + return (creatureController != nullptr) ? creatureController->getCurrentVelocity().magnitude() : 0.0f; } // ---------------------------------------------------------------------- @@ -1467,7 +1467,7 @@ jfloat JNICALL ScriptMethodsObjectMoveNamespace::getWalkSpeed(JNIEnv * /*env*/, NetworkId const networkId(object); CreatureObject * const creatureObject = CreatureObject::getCreatureObject(networkId); - return (creatureObject != NULL) ? creatureObject->getWalkSpeed() : 0.0f; + return (creatureObject != nullptr) ? creatureObject->getWalkSpeed() : 0.0f; } // ---------------------------------------------------------------------- @@ -1477,7 +1477,7 @@ jfloat JNICALL ScriptMethodsObjectMoveNamespace::getRunSpeed(JNIEnv * /*env*/, j NetworkId const networkId(object); CreatureObject * const creatureObject = CreatureObject::getCreatureObject(networkId); - return (creatureObject != NULL) ? creatureObject->getRunSpeed() : 0.0f; + return (creatureObject != nullptr) ? creatureObject->getRunSpeed() : 0.0f; } // ---------------------------------------------------------------------- @@ -1487,7 +1487,7 @@ void JNICALL ScriptMethodsObjectMoveNamespace::setBaseWalkSpeed(JNIEnv * /*env*/ NetworkId const networkId(object); CreatureObject * const creatureObject = CreatureObject::getCreatureObject(networkId); - if (creatureObject == NULL) + if (creatureObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsObjectMove::setBaseWalkSpeed() Unable to resolve the object(%s) to a CreatureObject.", networkId.getValueString().c_str())); return; @@ -1505,7 +1505,7 @@ jfloat JNICALL ScriptMethodsObjectMoveNamespace::getBaseWalkSpeed(JNIEnv * /*env NetworkId const networkId(object); CreatureObject * const creatureObject = CreatureObject::getCreatureObject(networkId); - return (creatureObject != NULL) ? creatureObject->getBaseWalkSpeed() : 0.0f; + return (creatureObject != nullptr) ? creatureObject->getBaseWalkSpeed() : 0.0f; } // ---------------------------------------------------------------------- @@ -1515,7 +1515,7 @@ void JNICALL ScriptMethodsObjectMoveNamespace::setBaseRunSpeed(JNIEnv * /*env*/, NetworkId const networkId(object); CreatureObject * const creatureObject = CreatureObject::getCreatureObject(networkId); - if (creatureObject == NULL) + if (creatureObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsObjectMove::setBaseRunSpeed() Unable to resolve the object(%s) to a CreatureObject.", networkId.getValueString().c_str())); return; @@ -1533,7 +1533,7 @@ jfloat JNICALL ScriptMethodsObjectMoveNamespace::getBaseRunSpeed(JNIEnv * /*env* NetworkId const networkId(object); CreatureObject * const creatureObject = CreatureObject::getCreatureObject(networkId); - return (creatureObject != NULL) ? creatureObject->getBaseRunSpeed() : 0.0f; + return (creatureObject != nullptr) ? creatureObject->getBaseRunSpeed() : 0.0f; } // ---------------------------------------------------------------------- @@ -1543,7 +1543,7 @@ void JNICALL ScriptMethodsObjectMoveNamespace::setMovementWalk(JNIEnv * /*env*/, NetworkId const networkId(object); CreatureObject * const creatureObject = CreatureObject::getCreatureObject(networkId); - if (creatureObject == NULL) + if (creatureObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsObjectMove::setMovementWalk() Unable to resolve the object(%s) to a CreatureObject.", networkId.getValueString().c_str())); return; @@ -1551,7 +1551,7 @@ void JNICALL ScriptMethodsObjectMoveNamespace::setMovementWalk(JNIEnv * /*env*/, AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(creatureObject->getController()); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsObjectMove::setMovementWalk() Unable to resolve the object's(%s) controller to an AiCreatureController.", creatureObject->getDebugInformation().c_str())); return; @@ -1569,7 +1569,7 @@ void JNICALL ScriptMethodsObjectMoveNamespace::setMovementRun(JNIEnv * /*env*/, NetworkId const networkId(object); CreatureObject * const creatureObject = CreatureObject::getCreatureObject(networkId); - if (creatureObject == NULL) + if (creatureObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsObjectMove::setMovementRun() Unable to resolve the object(%s) to a CreatureObject.", networkId.getValueString().c_str())); return; @@ -1577,7 +1577,7 @@ void JNICALL ScriptMethodsObjectMoveNamespace::setMovementRun(JNIEnv * /*env*/, AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(creatureObject->getController()); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsObjectMove::setMovementRun() Unable to resolve the object's(%s) controller to an AiCreatureController.", creatureObject->getDebugInformation().c_str())); return; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsPermissions.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsPermissions.cpp index 732a9f6d..82bf242b 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsPermissions.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsPermissions.cpp @@ -85,7 +85,7 @@ jobjectArray JNICALL ScriptMethodsPermissionsNamespace::permissionsGetBanned(JNI { ServerObject *serverObj = 0; if (!JavaLibrary::getObject(target, serverObj)) - return NULL; + return nullptr; LocalObjectArrayRefPtr strArray; BuildingObject *buildingObj = dynamic_cast(serverObj); @@ -96,7 +96,7 @@ jobjectArray JNICALL ScriptMethodsPermissionsNamespace::permissionsGetBanned(JNI if (cellObj) if (ScriptConversion::convert(cellObj->getBanned(), strArray)) return strArray->getReturnValue(); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -114,7 +114,7 @@ jobjectArray JNICALL ScriptMethodsPermissionsNamespace::permissionsGetAllowed(JN { ServerObject *serverObj = 0; if (!JavaLibrary::getObject(target, serverObj)) - return NULL; + return nullptr; LocalObjectArrayRefPtr strArray; BuildingObject *buildingObj = dynamic_cast(serverObj); @@ -125,7 +125,7 @@ jobjectArray JNICALL ScriptMethodsPermissionsNamespace::permissionsGetAllowed(JN if (cellObj) if (ScriptConversion::convert(cellObj->getAllowed(), strArray)) return strArray->getReturnValue(); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsPilot.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsPilot.cpp index 5d216dc2..96bf045b 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsPilot.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsPilot.cpp @@ -177,7 +177,7 @@ jint JNICALL ScriptMethodsPilotNamespace::spaceUnitGetBehavior(JNIEnv * env, job if (!shipObject) return JNI_FALSE; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitGetBehavior() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -200,7 +200,7 @@ jlong JNICALL ScriptMethodsPilotNamespace::spaceUnitGetPrimaryAttackTarget(JNIEn if (!shipObject) return JNI_FALSE; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitGetPrimaryAttackTarget() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -223,7 +223,7 @@ jlongArray JNICALL ScriptMethodsPilotNamespace::spaceUnitGetAttackTargetList(JNI if (!shipObject) return JNI_FALSE; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitGetAttackTargetList() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -311,7 +311,7 @@ jboolean JNICALL ScriptMethodsPilotNamespace::spaceUnitIsAttacking(JNIEnv * env, if (!shipObject) return JNI_FALSE; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitIsAttacking() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -334,7 +334,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitIdle(JNIEnv * env, jobject /* if (!shipObject) return; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitIdle() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -357,14 +357,14 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitTrack(JNIEnv * env, jobject / if (!shipObject) return; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitTrack() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); return; } - Object * target = NULL; + Object * target = nullptr; if (!JavaLibrary::getObject(jobject_target, target)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitTrack() The target did not resolve to an Object")); @@ -387,7 +387,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitMoveTo(JNIEnv * env, jobject if (!shipObject) return; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitMoveTo() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -410,7 +410,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitMoveTo(JNIEnv * env, jobject return; } - SpacePath * const path = SpacePathManager::fetch(NULL, aiShipController->getOwner(), aiShipController->getShipRadius()); + SpacePath * const path = SpacePathManager::fetch(nullptr, aiShipController->getOwner(), aiShipController->getShipRadius()); AiShipController::TransformList::const_iterator iterTransformList = convertedPath.begin(); for (; iterTransformList != convertedPath.end(); ++iterTransformList) @@ -435,7 +435,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitAddPatrolPath(JNIEnv * env, j if (!shipObject) return; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitAddPatrolPath() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -483,7 +483,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitClearPatrolPath(JNIEnv * env, if (!shipObject) return; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitClearPatrolPath() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -506,14 +506,14 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitFollow(JNIEnv * env, jobject if (!shipObject) return; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitFollow() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); return; } - Object * followedUnit = NULL; + Object * followedUnit = nullptr; if (!JavaLibrary::getObject(jobject_followedUnit, followedUnit)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitFollow() followedUnit did not resolve to an Object")); @@ -592,10 +592,10 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitAddDamageTaken(JNIEnv * env, } ShipController * const shipController = shipObject->getController()->asShipController(); - AiShipController * const aiShipController = (shipController != NULL) ? shipController->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipController != nullptr) ? shipController->asAiShipController() : nullptr; bool const verifyAttacker = true; - if (aiShipController != NULL) + if (aiShipController != nullptr) { // This adds damage to an AI unit @@ -607,7 +607,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitAddDamageTaken(JNIEnv * env, LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("ScriptMethodsPilot::spaceUnitAddDamageTaken() targetUnit(%s) is not attackable", targetShipObject->getNetworkId().getValueString().c_str())); } } - else if (shipController != NULL) + else if (shipController != nullptr) { // This adds damage to a player unit @@ -635,7 +635,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitSetAttackOrders(JNIEnv * env, if (!shipObject) return; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitSetAttackOrder() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -665,7 +665,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitSetPilotType(JNIEnv * env, jo if (!shipObject) return; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitSetPilotType() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -697,13 +697,13 @@ jstring JNICALL ScriptMethodsPilotNamespace::spaceUnitGetPilotType(JNIEnv * env, LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("ScriptMethodsPilot::spaceUnitGetPilotType()")); if (!verifyShipsEnabled()) - return NULL; + return nullptr; ShipObject * const shipObject = JavaLibrary::getShipThrow(env, jobject_unit, "ScriptMethodsPilot::spaceUnitGetPilotType() unit did not resolve to a ShipObject"); if (!shipObject) - return NULL; + return nullptr; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitGetPilotType() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -726,7 +726,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitRemoveAttackTarget(JNIEnv * e if (!shipObject) return; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitRemoveAttackTarget() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -765,7 +765,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitSetLeashDistance(JNIEnv * env if (!shipObject) return; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitSetLeashDistance() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -805,7 +805,7 @@ jint JNICALL ScriptMethodsPilotNamespace::spaceUnitGetSquadId(JNIEnv * env, jobj if (!shipObject) return JNI_FALSE; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitGetSquadId() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -849,7 +849,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceSquadMoveTo(JNIEnv * /*env*/, job } float const largestShipRadius = squad->getLargestShipRadius(); - SpacePath * const path = SpacePathManager::fetch(NULL, squad, largestShipRadius); + SpacePath * const path = SpacePathManager::fetch(nullptr, squad, largestShipRadius); AiShipController::TransformList::const_iterator iterTransformList = convertedPath.begin(); for (; iterTransformList != convertedPath.end(); ++iterTransformList) @@ -936,7 +936,7 @@ jint JNICALL ScriptMethodsPilotNamespace::spaceSquadRemoveUnit(JNIEnv * env, job if (!shipObject) return JNI_FALSE; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceSquadRemoveUnit() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -1148,7 +1148,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceSquadTrack(JNIEnv * /*env*/, jobj return; } - Object * target = NULL; + Object * target = nullptr; if (!JavaLibrary::getObject(jobject_target, target)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceSquadTrack() The target did not resolve to an Object")); @@ -1171,7 +1171,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceSquadSetLeader(JNIEnv * env, jobj if (!leaderShipObject) return; - AiShipController * const aiShipController = (leaderShipObject->getController()->asShipController() != NULL) ? leaderShipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (leaderShipObject->getController()->asShipController() != nullptr) ? leaderShipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceSquadSetLeader() called on unit(%s) without AiShipController", leaderShipObject->getNetworkId().getValueString().c_str())); @@ -1251,7 +1251,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceSquadFollow(JNIEnv * /*env*/, job return; } - Object * followedUnit = NULL; + Object * followedUnit = nullptr; if (!JavaLibrary::getObject(jobject_followedUnit, followedUnit)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceSquadFollow() followedUnit did not resolve to an Object")); @@ -1418,7 +1418,7 @@ jint JNICALL ScriptMethodsPilotNamespace::spaceSquadGetGuardTarget(JNIEnv * /*en return JNI_FALSE; } - if (squad->getGuardTarget() == NULL) + if (squad->getGuardTarget() == nullptr) { return 0; } @@ -1463,7 +1463,7 @@ void JNICALL ScriptMethodsPilotNamespace::setShipAggroDistance(JNIEnv * env, job if (!shipObject) return; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::setShipAggroDistance(): unit(%s) does not have an AiShipController",shipObject->getNetworkId().getValueString().c_str())); @@ -1557,14 +1557,14 @@ jobject JNICALL ScriptMethodsPilotNamespace::spaceUnitGetDockTransform(JNIEnv * if (!verifyShipsEnabled()) return 0; - Object * dockTarget = NULL; + Object * dockTarget = nullptr; if (!JavaLibrary::getObject(jobject_dockTarget, dockTarget)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitGetDockTransform() dockTarget did not resolve to an Object")); return 0; } - Object * dockingUnit = NULL; + Object * dockingUnit = nullptr; if (!JavaLibrary::getObject(jobject_dockingUnit, dockingUnit)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitGetDockTransform() dockingUnit did not resolve to an Object")); @@ -1600,14 +1600,14 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitAddExclusiveAggro(JNIEnv * en return; } - AiShipController * const unitAiShipController = (unitShipObject->getController()->asShipController() != NULL) ? unitShipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const unitAiShipController = (unitShipObject->getController()->asShipController() != nullptr) ? unitShipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!unitAiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitAddExclusiveAggro() called on unit(%s) without AiShipController", unitShipObject->getDebugInformation().c_str())); return; } - Object * pilotObject = NULL; + Object * pilotObject = nullptr; if (!JavaLibrary::getObject(jobject_pilot, pilotObject)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitAddExclusiveAggro() pilot did not resolve to an Object")); @@ -1642,14 +1642,14 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitRemoveExclusiveAggro(JNIEnv * return; } - AiShipController * const unitAiShipController = (unitShipObject->getController()->asShipController() != NULL) ? unitShipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const unitAiShipController = (unitShipObject->getController()->asShipController() != nullptr) ? unitShipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!unitAiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitRemoveExclusiveAggro() called on unit(%s) without AiShipController", unitShipObject->getDebugInformation().c_str())); return; } - Object * pilotObject = NULL; + Object * pilotObject = nullptr; if (!JavaLibrary::getObject(jobject_pilot, pilotObject)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitRemoveExclusiveAggro() pilot did not resolve to an Object")); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsPlayerAccount.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsPlayerAccount.cpp index 00aa9c9d..0234a47c 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsPlayerAccount.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsPlayerAccount.cpp @@ -127,7 +127,7 @@ jlong JNICALL ScriptMethodsPlayerAccountNamespace::getPlayerObject(JNIEnv *env, jlong objId = 0; - ServerObject * creatureServerObject = NULL; + ServerObject * creatureServerObject = nullptr; if (JavaLibrary::getObject(creature,creatureServerObject)) { SlotId slot = SlotIdManager::findSlotId(ConstCharCrcLowerString("ghost")); @@ -258,11 +258,11 @@ jobject JNICALL ScriptMethodsPlayerAccountNamespace::getAccountTimeData(JNIEnv * const PlayerObject * player = PlayerCreatureController::getPlayerObject( creature); - if (player == NULL) + if (player == nullptr) return 0; const Client * client = creature->getClient(); - if (client == NULL) + if (client == nullptr) return 0; // get the values that came from Platform @@ -463,7 +463,7 @@ jboolean JNICALL ScriptMethodsPlayerAccountNamespace::isAccountQualifiedForHouse * @returns a dictionary that contains the following data in paralled arrays * with the oldest CTS transaction first and the newest CTS transaction last * -* @returns null if the character doesn't have any CTS history +* @returns nullptr if the character doesn't have any CTS history * * string[] character_name full name of the source character * string[] cluster_name name of the source cluster @@ -471,7 +471,7 @@ jboolean JNICALL ScriptMethodsPlayerAccountNamespace::isAccountQualifiedForHouse */ jobject JNICALL ScriptMethodsPlayerAccountNamespace::getCharacterCtsHistory(JNIEnv * env, jobject self, jlong player) { - CreatureObject const * playerObject = NULL; + CreatureObject const * playerObject = nullptr; if (!JavaLibrary::getObject(player, playerObject)) { DEBUG_WARNING(true, ("JavaLibrary::getCharacterCtsHistory: bad player object")); @@ -491,7 +491,7 @@ jobject JNICALL ScriptMethodsPlayerAccountNamespace::getCharacterCtsHistory(JNIE if (i.getValue(ctsTransactionDetail)) { Unicode::UnicodeStringVector tokens; - if (Unicode::tokenize(ctsTransactionDetail, tokens, NULL, NULL) && (tokens.size() >= 4)) + if (Unicode::tokenize(ctsTransactionDetail, tokens, nullptr, nullptr) && (tokens.size() >= 4)) { Unicode::String * characterName = new Unicode::String(); for (size_t i = 3, j = tokens.size(); i < j; ++i) @@ -538,13 +538,13 @@ jobject JNICALL ScriptMethodsPlayerAccountNamespace::getCharacterCtsHistory(JNIE * for the particular CTS source character that this character at one time transferred from * with the oldest CTS transaction first and the newest CTS transaction last * -* @returns null if the character doesn't have any retroactive CTS objvars history +* @returns nullptr if the character doesn't have any retroactive CTS objvars history */ jobjectArray JNICALL ScriptMethodsPlayerAccountNamespace::getCharacterRetroactiveCtsObjvars(JNIEnv * env, jobject self, jlong player) { std::vector > const *> const & characterRetroactiveCtsObjvars = GameServer::getRetroactiveCtsHistoryObjvars(NetworkId(static_cast(player))); if (characterRetroactiveCtsObjvars.empty()) - return NULL; + return nullptr; LocalObjectArrayRefPtr results = createNewObjectArray(characterRetroactiveCtsObjvars.size(), JavaLibrary::getClsDictionary()); for (size_t i = 0, size = characterRetroactiveCtsObjvars.size(); i < size; ++i) @@ -603,7 +603,7 @@ jobjectArray JNICALL ScriptMethodsPlayerAccountNamespace::qualifyForFreeCts(JNIE // see if we can/should bypass the free CTS time restriction if (!freeCtsInfo && ConfigServerGame::getAllowIgnoreFreeCtsTimeRestriction()) { - CreatureObject const * playerObject = NULL; + CreatureObject const * playerObject = nullptr; if (JavaLibrary::getObject(player, playerObject) && playerObject && playerObject->getClient() && playerObject->getClient()->isGod()) { freeCtsInfo = FreeCtsDataTable::getFreeCtsInfoForCharacter(characterCreateTime, GameServer::getInstance().getClusterName(), true); @@ -615,7 +615,7 @@ jobjectArray JNICALL ScriptMethodsPlayerAccountNamespace::qualifyForFreeCts(JNIE } if (!freeCtsInfo || freeCtsInfo->targetCluster.empty()) - return NULL; + return nullptr; LocalObjectArrayRefPtr valueArray = createNewObjectArray(freeCtsInfo->targetCluster.size(), JavaLibrary::getClsString()); @@ -634,7 +634,7 @@ jobjectArray JNICALL ScriptMethodsPlayerAccountNamespace::qualifyForFreeCts(JNIE */ void JNICALL ScriptMethodsPlayerAccountNamespace::validateFreeCts(JNIEnv * /*env*/, jobject /*self*/, jlong player, jstring destinationGalaxy, jstring destinationCharacterName) { - CreatureObject const * creatureObject = NULL; + CreatureObject const * creatureObject = nullptr; if (!JavaLibrary::getObject(player, creatureObject) || !creatureObject) { DEBUG_WARNING(true, ("JavaLibrary::validateFreeCts: bad CreatureObject")); @@ -674,7 +674,7 @@ void JNICALL ScriptMethodsPlayerAccountNamespace::validateFreeCts(JNIEnv * /*env */ void JNICALL ScriptMethodsPlayerAccountNamespace::performFreeCts(JNIEnv * /*env*/, jobject /*self*/, jlong player, jstring destinationGalaxy, jstring destinationCharacterName) { - CreatureObject const * creatureObject = NULL; + CreatureObject const * creatureObject = nullptr; if (!JavaLibrary::getObject(player, creatureObject) || !creatureObject) { DEBUG_WARNING(true, ("JavaLibrary::performFreeCts: bad CreatureObject")); @@ -713,7 +713,7 @@ void JNICALL ScriptMethodsPlayerAccountNamespace::performFreeCts(JNIEnv * /*env* */ void JNICALL ScriptMethodsPlayerAccountNamespace::validateCts(JNIEnv * /*env*/, jobject /*self*/, jlong player, jstring destinationGalaxy, jstring destinationCharacterName) { - CreatureObject const * creatureObject = NULL; + CreatureObject const * creatureObject = nullptr; if (!JavaLibrary::getObject(player, creatureObject) || !creatureObject) { DEBUG_WARNING(true, ("JavaLibrary::validateCts: bad CreatureObject")); @@ -753,7 +753,7 @@ void JNICALL ScriptMethodsPlayerAccountNamespace::validateCts(JNIEnv * /*env*/, */ void JNICALL ScriptMethodsPlayerAccountNamespace::performCts(JNIEnv * /*env*/, jobject /*self*/, jlong player, jstring destinationGalaxy, jstring destinationCharacterName) { - CreatureObject const * creatureObject = NULL; + CreatureObject const * creatureObject = nullptr; if (!JavaLibrary::getObject(player, creatureObject) || !creatureObject) { DEBUG_WARNING(true, ("JavaLibrary::performCts: bad CreatureObject")); @@ -792,7 +792,7 @@ void JNICALL ScriptMethodsPlayerAccountNamespace::performCts(JNIEnv * /*env*/, j */ void JNICALL ScriptMethodsPlayerAccountNamespace::validateRenameCharacter(JNIEnv *env, jobject self, jlong player, jstring newName) { - CreatureObject const * creatureObject = NULL; + CreatureObject const * creatureObject = nullptr; if (!JavaLibrary::getObject(player, creatureObject) || !creatureObject) { DEBUG_WARNING(true, ("JavaLibrary::validateRenameCharacter: bad CreatureObject")); @@ -819,7 +819,7 @@ void JNICALL ScriptMethodsPlayerAccountNamespace::validateRenameCharacter(JNIEnv bool lastNameChangeOnly = false; static Unicode::String const delimiters(Unicode::narrowToWide(" ")); Unicode::UnicodeStringVector newNameTokens; - if (!Unicode::tokenize(newNameString, newNameTokens, &delimiters, NULL)) + if (!Unicode::tokenize(newNameString, newNameTokens, &delimiters, nullptr)) newNameTokens.clear(); size_t const newNameTokensCount = newNameTokens.size(); @@ -846,7 +846,7 @@ void JNICALL ScriptMethodsPlayerAccountNamespace::validateRenameCharacter(JNIEnv { Unicode::String const uniqueRandomName = NameManager::getInstance().generateUniqueRandomName(ConfigServerGame::getCharacterNameGeneratorDirectory(), creatureTemplate->getNameGeneratorType()); Unicode::UnicodeStringVector uniqueRandomNameTokens; - if (!Unicode::tokenize(uniqueRandomName, uniqueRandomNameTokens, &delimiters, NULL)) + if (!Unicode::tokenize(uniqueRandomName, uniqueRandomNameTokens, &delimiters, nullptr)) uniqueRandomNameTokens.clear(); newNameString = ((uniqueRandomNameTokens.size() >= 1) ? uniqueRandomNameTokens[0] : delimiters) + delimiters + newNameTokens[1]; @@ -861,7 +861,7 @@ void JNICALL ScriptMethodsPlayerAccountNamespace::validateRenameCharacter(JNIEnv params.addParam("@ui:name_declined_racially_inappropriate", "reason"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(creatureObject->getNetworkId(), "renameCharacterNameValidationFail", dictionary->getSerializedData(), 0, false); @@ -879,7 +879,7 @@ void JNICALL ScriptMethodsPlayerAccountNamespace::validateRenameCharacter(JNIEnv params.addParam(errorText.c_str(), "reason"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(creatureObject->getNetworkId(), "renameCharacterNameValidationFail", dictionary->getSerializedData(), 0, false); @@ -906,7 +906,7 @@ void JNICALL ScriptMethodsPlayerAccountNamespace::validateRenameCharacter(JNIEnv */ void JNICALL ScriptMethodsPlayerAccountNamespace::renameCharacterReleaseNameReservation(JNIEnv *env, jobject self, jlong player) { - CreatureObject const * creatureObject = NULL; + CreatureObject const * creatureObject = nullptr; if (!JavaLibrary::getObject(player, creatureObject) || !creatureObject) { DEBUG_WARNING(true, ("JavaLibrary::renameCharacterReleaseNameReservation: bad CreatureObject")); @@ -929,7 +929,7 @@ void JNICALL ScriptMethodsPlayerAccountNamespace::renameCharacterReleaseNameRese */ void JNICALL ScriptMethodsPlayerAccountNamespace::renameCharacter(JNIEnv *env, jobject self, jlong player, jstring newName) { - CreatureObject const * creatureObject = NULL; + CreatureObject const * creatureObject = nullptr; if (!JavaLibrary::getObject(player, creatureObject) || !creatureObject) { DEBUG_WARNING(true, ("JavaLibrary::renameCharacter: bad CreatureObject")); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsPlayerQuest.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsPlayerQuest.cpp index 2e523419..e72745fe 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsPlayerQuest.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsPlayerQuest.cpp @@ -159,7 +159,7 @@ jboolean ScriptMethodsPlayerQuestNamespace::addPlayerQuestTask(JNIEnv * env, job std::string sceneId; if (!ScriptConversion::convertWorld(waypointLocation, waypointVec, sceneId)) { - // NULL or Invalid Location passed in. That's fine, just means no waypoint. + // nullptr or Invalid Location passed in. That's fine, just means no waypoint. if(questObject) { std::string titleString; @@ -456,7 +456,7 @@ jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestWaypoint(JNIEnv * env, if(!JavaLibrary::getObject(quest, questObject)) { WARNING(true, ("getPlayerQuestWaypoint: Could not get valid Player Quest Object from OID: %d", quest)); - return NULL; + return nullptr; } if(questObject) @@ -465,7 +465,7 @@ jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestWaypoint(JNIEnv * env, return jString.getReturnValue(); } - return NULL; + return nullptr; } @@ -520,7 +520,7 @@ jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestTitle(JNIEnv * env, job if(!JavaLibrary::getObject(quest, questObject)) { WARNING(true, ("getPlayerQuestTitle: Could not get valid Player Quest Object from OID: %d", quest)); - return NULL; + return nullptr; } if(questObject) @@ -529,7 +529,7 @@ jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestTitle(JNIEnv * env, job return returnVal.getReturnValue(); } - return NULL; + return nullptr; } jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestDescription(JNIEnv * env, jobject self, jlong quest) @@ -541,7 +541,7 @@ jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestDescription(JNIEnv * en if(!JavaLibrary::getObject(quest, questObject)) { WARNING(true, ("getPlayerQuestDescription: Could not get valid Player Quest Object from OID: %d", quest)); - return NULL; + return nullptr; } if(questObject) @@ -550,7 +550,7 @@ jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestDescription(JNIEnv * en return returnVal.getReturnValue(); } - return NULL; + return nullptr; } jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestTaskTitle(JNIEnv * env, jobject self, jlong quest, jint index) @@ -562,7 +562,7 @@ jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestTaskTitle(JNIEnv * env, if(!JavaLibrary::getObject(quest, questObject)) { WARNING(true, ("getPlayerQuestTaskTitle: Could not get valid Player Quest Object from OID: %d", quest)); - return NULL; + return nullptr; } if(questObject) @@ -571,7 +571,7 @@ jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestTaskTitle(JNIEnv * env, return returnVal.getReturnValue(); } - return NULL; + return nullptr; } jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestTaskDescription(JNIEnv * env, jobject self, jlong quest, jint index) @@ -583,7 +583,7 @@ jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestTaskDescription(JNIEnv if(!JavaLibrary::getObject(quest, questObject)) { WARNING(true, ("getPlayerQuestTaskDescription: Could not get valid Player Quest Object from OID: %d", quest)); - return NULL; + return nullptr; } if(questObject) @@ -592,7 +592,7 @@ jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestTaskDescription(JNIEnv return returnVal.getReturnValue(); } - return NULL; + return nullptr; } void ScriptMethodsPlayerQuestNamespace::setPlayerQuestRecipe(JNIEnv * env, jobject self, jlong quest, jboolean recipe) @@ -768,21 +768,21 @@ void ScriptMethodsPlayerQuestNamespace::openPlayerQuestRecipe(JNIEnv * env, jobj UNREF(env); UNREF(self); - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature)) { DEBUG_WARNING(true, ("openPlayerQuestRecipe: Failed to get valid creature object with OID %d", player)); return; } - ServerObject * recipeObj = NULL; + ServerObject * recipeObj = nullptr; if (!JavaLibrary::getObject(recipe, recipeObj)) { DEBUG_WARNING(true, ("openPlayerQuestRecipe: Failed to get valid recipe object with OID %d", player)); return; } - if (playerCreature->isPlayerControlled() && playerCreature->getController() != NULL) + if (playerCreature->isPlayerControlled() && playerCreature->getController() != nullptr) { playerCreature->getController()->appendMessage( static_cast(CM_openRecipe), @@ -801,7 +801,7 @@ void ScriptMethodsPlayerQuestNamespace::resetAllPlayerQuestData(JNIEnv * env, jo UNREF(env); UNREF(self); - PlayerQuestObject * playerQuest = NULL; + PlayerQuestObject * playerQuest = nullptr; if (!JavaLibrary::getObject(quest, playerQuest)) { DEBUG_WARNING(true, ("resetAllPlayerQuestData: Failed to get valid recipe object with OID %d", quest)); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsPvp.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsPvp.cpp index b27444e7..75b7f1ec 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsPvp.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsPvp.cpp @@ -43,7 +43,7 @@ namespace ScriptMethodsPvpNamespace const char * makeCopyOfString(const char * rhs) { - char * lhs = NULL; + char * lhs = nullptr; if (rhs) { lhs = new char[strlen(rhs) + 1]; @@ -668,7 +668,7 @@ jobjectArray JNICALL ScriptMethodsPvpNamespace::pvpGetEnemyFlags(JNIEnv *env, jo if (ScriptConversion::convert(enemyStrings, strArray)) return strArray->getReturnValue(); } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -749,7 +749,7 @@ jboolean JNICALL ScriptMethodsPvpNamespace::pvpHasBattlefieldEnemyFlag(JNIEnv *e * @param actor The actor for the enemy check * @param from The center of the range * @param range The distance to query. - * @return null if there is an error, or an array of enemy objects which are in range. + * @return nullptr if there is an error, or an array of enemy objects which are in range. */ jlongArray JNICALL ScriptMethodsPvpNamespace::pvpGetEnemiesInRange(JNIEnv *env, jobject self, jlong actor, jlong location, jfloat range) { @@ -799,7 +799,7 @@ jlongArray JNICALL ScriptMethodsPvpNamespace::pvpGetEnemiesInRange(JNIEnv *env, * @param angle The cone angle, in degrees, that the cone sweeps out. The * total cone angle is twice this angle; therefore, this angle * represents the angle swept out to each side of the cone axis. - * @return null if there is an error, or an array of enemy objects which are in range. + * @return nullptr if there is an error, or an array of enemy objects which are in range. */ jlongArray JNICALL ScriptMethodsPvpNamespace::pvpGetEnemiesInCone(JNIEnv *env, jobject self, jlong actor, jlong coneCenterObjectId, jlong coneDirectionObjectId, jfloat range, jfloat angle) { @@ -853,7 +853,7 @@ jlongArray JNICALL ScriptMethodsPvpNamespace::pvpGetEnemiesInCone(JNIEnv *env, j * @param angle The cone angle, in degrees, that the cone sweeps out. The * total cone angle is twice this angle; therefore, this angle * represents the angle swept out to each side of the cone axis. - * @return null if there is an error, or an array of enemy objects which are in range. + * @return nullptr if there is an error, or an array of enemy objects which are in range. */ jlongArray JNICALL ScriptMethodsPvpNamespace::pvpGetEnemiesInConeLocation(JNIEnv *env, jobject self, jlong actor, jlong coneCenterObjectId, jobject coneDirectionLocation, jfloat range, jfloat angle) { @@ -900,7 +900,7 @@ jlongArray JNICALL ScriptMethodsPvpNamespace::pvpGetEnemiesInConeLocation(JNIEnv * @param actor The actor for the canAttack check * @param from The center of the range * @param range The distance to query. - * @return null if there is an error, or an array of attackable objects which are in range. + * @return nullptr if there is an error, or an array of attackable objects which are in range. */ jlongArray JNICALL ScriptMethodsPvpNamespace::pvpGetTargetsInRange(JNIEnv *env, jobject self, jlong actor, jlong location, jfloat range) { @@ -951,7 +951,7 @@ jlongArray JNICALL ScriptMethodsPvpNamespace::pvpGetTargetsInRange(JNIEnv *env, * @param angle The cone angle, in degrees, that the cone sweeps out. The * total cone angle is twice this angle; therefore, this angle * represents the angle swept out to each side of the cone axis. - * @return null if there is an error, or an array of attackable objects which are in range. + * @return nullptr if there is an error, or an array of attackable objects which are in range. */ jlongArray JNICALL ScriptMethodsPvpNamespace::pvpGetTargetsInCone(JNIEnv *env, jobject self, jlong actor, jlong coneCenterObjectId, jlong coneDirectionObjectId, jfloat range, jfloat angle) { @@ -1005,7 +1005,7 @@ jlongArray JNICALL ScriptMethodsPvpNamespace::pvpGetTargetsInCone(JNIEnv *env, j * @param angle The cone angle, in degrees, that the cone sweeps out. The * total cone angle is twice this angle; therefore, this angle * represents the angle swept out to each side of the cone axis. - * @return null if there is an error, or an array of attackable objects which are in range. + * @return nullptr if there is an error, or an array of attackable objects which are in range. */ jlongArray JNICALL ScriptMethodsPvpNamespace::pvpGetTargetsInConeLocation(JNIEnv *env, jobject self, jlong actor, jlong coneCenterObjectId, jobject coneDirectionLocation, jfloat range, jfloat angle) { diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsQuest.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsQuest.cpp index 43d65ff7..ea237c93 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsQuest.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsQuest.cpp @@ -35,7 +35,7 @@ namespace ScriptMethodsQuestNamespace { PlayerObject * getPlayerForCharacter(jlong playerCreatureId) { - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (JavaLibrary::getObject(playerCreatureId, playerCreature)) { return PlayerCreatureController::getPlayerObject(playerCreature); @@ -44,7 +44,7 @@ namespace ScriptMethodsQuestNamespace { NetworkId id(playerCreatureId); JAVA_THROW_SCRIPT_EXCEPTION(true, ("Requested player %s, who could not be found.", id.getValueString().c_str())); - return NULL; + return nullptr; } } @@ -397,8 +397,8 @@ void JNICALL ScriptMethodsQuestNamespace::questSetQuestTaskCounter(JNIEnv *env, } PlayerObject * const playerObject = getPlayerForCharacter(playerId); - CreatureObject * const creatureObject = playerObject ? playerObject->getCreatureObject() : NULL; - Controller * const controller = creatureObject ? creatureObject->getController() : NULL; + CreatureObject * const creatureObject = playerObject ? playerObject->getCreatureObject() : nullptr; + Controller * const controller = creatureObject ? creatureObject->getController() : nullptr; if(!controller) return; @@ -427,8 +427,8 @@ void JNICALL ScriptMethodsQuestNamespace::questSetQuestTaskLocation(JNIEnv *env, } PlayerObject * const playerObject = getPlayerForCharacter(playerId); - CreatureObject * const creatureObject = playerObject ? playerObject->getCreatureObject() : NULL; - Controller * const controller = creatureObject ? creatureObject->getController() : NULL; + CreatureObject * const creatureObject = playerObject ? playerObject->getCreatureObject() : nullptr; + Controller * const controller = creatureObject ? creatureObject->getController() : nullptr; if(!controller) return; @@ -456,8 +456,8 @@ void JNICALL ScriptMethodsQuestNamespace::questSetQuestTaskTimer(JNIEnv *env, jo } PlayerObject * const playerObject = getPlayerForCharacter(playerId); - CreatureObject * const creatureObject = playerObject ? playerObject->getCreatureObject() : NULL; - Controller * const controller = creatureObject ? creatureObject->getController() : NULL; + CreatureObject * const creatureObject = playerObject ? playerObject->getCreatureObject() : nullptr; + Controller * const controller = creatureObject ? creatureObject->getController() : nullptr; if(!controller) return; @@ -487,7 +487,7 @@ void JNICALL ScriptMethodsQuestNamespace::requestActivateQuest(JNIEnv * env, job return; } - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (JavaLibrary::getObject(playerId, playerCreature) && playerCreature) { Quest const * const q = QuestManager::getQuest(questCrc); @@ -557,7 +557,7 @@ void JNICALL ScriptMethodsQuestNamespace::requestCompleteQuest(JNIEnv * env, job return; } - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (JavaLibrary::getObject(playerId, playerCreature) && playerCreature) { Quest const * const q = QuestManager::getQuest(questCrc); @@ -576,14 +576,14 @@ void JNICALL ScriptMethodsQuestNamespace::showCyberneticsPage(JNIEnv *env, jobje { MessageQueueCyberneticsOpen::OpenType const type = static_cast(openType); - CreatureObject * npc = NULL; + CreatureObject * npc = nullptr; if (!JavaLibrary::getObject(npcId, npc)) return; if(!npc) return; - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (JavaLibrary::getObject(playerId, playerCreature)) { Controller * const playerController = playerCreature->getController(); @@ -659,7 +659,7 @@ void JNICALL ScriptMethodsQuestNamespace::sendStaticItemDataToPlayer(JNIEnv *env } //send to player - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (JavaLibrary::getObject(playerId, playerCreature)) { Controller * const playerController = playerCreature->getController(); @@ -683,7 +683,7 @@ void JNICALL ScriptMethodsQuestNamespace::showLootBox(JNIEnv *env, jobject self, return; //send to player - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (JavaLibrary::getObject(playerId, playerCreature)) { Controller * const playerController = playerCreature->getController(); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsRegion.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsRegion.cpp index 9a393578..d028ee48 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsRegion.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsRegion.cpp @@ -115,7 +115,7 @@ LocalObjectArrayRefPtr ScriptMethodsRegionNamespace::_getRegionsAtPoint(jobject std::vector result; RegionMaster::getRegionsAtPoint(sceneId, locationVec.x, locationVec.z, result); - //-- return null instead of a zero-length array + //-- return nullptr instead of a zero-length array if (result.empty ()) return LocalObjectArrayRef::cms_nullPtr; @@ -127,7 +127,7 @@ LocalObjectArrayRefPtr ScriptMethodsRegionNamespace::_getRegionsAtPoint(jobject { LocalRefPtr javaRegion; const Region * r = *it; - if (r != NULL) + if (r != nullptr) { if (!ScriptConversion::convert(*r, javaRegion)) return LocalObjectArrayRef::cms_nullPtr; @@ -195,7 +195,7 @@ void JNICALL ScriptMethodsRegionNamespace::createCircleRegion(JNIEnv *env, jobje UNREF(self); // validate scripter's input - if (center == NULL || radius <= 0 || name == 0) + if (center == nullptr || radius <= 0 || name == 0) return; JavaStringParam jname(name); @@ -239,7 +239,7 @@ jobject JNICALL ScriptMethodsRegionNamespace::getRegion(JNIEnv *env, jobject sel return 0; const Region * r = RegionMaster::getRegionByName(planetName, regionName); - if (r == NULL) + if (r == nullptr) return 0; LocalRefPtr jr; @@ -255,7 +255,7 @@ jobject JNICALL ScriptMethodsRegionNamespace::getRegion(JNIEnv *env, jobject sel jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsAtPoint(JNIEnv *env, jobject self, jobject location) { LocalObjectArrayRefPtr regions = _getRegionsAtPoint(location); - if (regions.get() == NULL) + if (regions.get() == nullptr) return 0; return regions->getReturnValue(); } @@ -279,9 +279,9 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegions(JNIEnv *env, jobje std::vector result; RegionMaster::getRegionsForPlanet(sceneId, result); - //-- return null instead of a zero-length array + //-- return nullptr instead of a zero-length array if (result.empty ()) - return NULL; + return nullptr; //put them into the jobjectarray LocalObjectArrayRefPtr regions = createNewObjectArray(result.size(), JavaLibrary::getClsRegion()); @@ -291,11 +291,11 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegions(JNIEnv *env, jobje { LocalRefPtr javaRegion; const Region * r = *i; - if (r != NULL) + if (r != nullptr) { if (!ScriptConversion::convert(*r, javaRegion)) { - return NULL; + return nullptr; } } setObjectArrayElement(*regions, index, *javaRegion); @@ -329,7 +329,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithPvP(JNIEnv *env goodRegions.push_back(*i); } - //-- return null instead of a zero-length array + //-- return nullptr instead of a zero-length array if (goodRegions.empty()) return 0; @@ -342,7 +342,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithPvP(JNIEnv *env LocalRefPtr javaRegion; if (!ScriptConversion::convert(**it, javaRegion)) { - return NULL; + return nullptr; } setObjectArrayElement(*result, index, *javaRegion); } @@ -375,7 +375,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithBuildable(JNIEn goodRegions.push_back(*i); } - //-- return null instead of a zero-length array + //-- return nullptr instead of a zero-length array if (goodRegions.empty()) return 0; @@ -388,7 +388,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithBuildable(JNIEn LocalRefPtr javaRegion; if (!ScriptConversion::convert(**it, javaRegion)) { - return NULL; + return nullptr; } setObjectArrayElement(*result, index, *javaRegion); } @@ -421,7 +421,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithMunicipal(JNIEn goodRegions.push_back(*i); } - //-- return null instead of a zero-length array + //-- return nullptr instead of a zero-length array if (goodRegions.empty()) return 0; @@ -434,7 +434,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithMunicipal(JNIEn LocalRefPtr javaRegion; if (!ScriptConversion::convert(**it, javaRegion)) { - return NULL; + return nullptr; } setObjectArrayElement(*result, index, *javaRegion); } @@ -467,7 +467,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithGeographical(JN goodRegions.push_back(*i); } - //-- return null instead of a zero-length array + //-- return nullptr instead of a zero-length array if (goodRegions.empty()) return 0; @@ -480,7 +480,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithGeographical(JN LocalRefPtr javaRegion; if (!ScriptConversion::convert(**it, javaRegion)) { - return NULL; + return nullptr; } setObjectArrayElement(*result, index, *javaRegion); } @@ -513,7 +513,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithDifficulty(JNIE goodRegions.push_back(*i); } - //-- return null instead of a zero-length array + //-- return nullptr instead of a zero-length array if (goodRegions.empty()) return 0; @@ -526,7 +526,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithDifficulty(JNIE LocalRefPtr javaRegion; if (!ScriptConversion::convert(**it, javaRegion)) { - return NULL; + return nullptr; } setObjectArrayElement(*result, index, *javaRegion); } @@ -559,7 +559,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithSpawnable(JNIEn goodRegions.push_back(*i); } - //-- return null instead of a zero-length array + //-- return nullptr instead of a zero-length array if (goodRegions.empty()) return 0; @@ -572,7 +572,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithSpawnable(JNIEn LocalRefPtr javaRegion; if (!ScriptConversion::convert(**it, javaRegion)) { - return NULL; + return nullptr; } setObjectArrayElement(*result, index, *javaRegion); } @@ -605,7 +605,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithMission(JNIEnv goodRegions.push_back(*i); } - //-- return null instead of a zero-length array + //-- return nullptr instead of a zero-length array if (goodRegions.empty()) return 0; @@ -618,7 +618,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithMission(JNIEnv LocalRefPtr javaRegion; if (!ScriptConversion::convert(**it, javaRegion)) { - return NULL; + return nullptr; } setObjectArrayElement(*result, index, *javaRegion); } @@ -657,7 +657,7 @@ jboolean JNICALL ScriptMethodsRegionNamespace::deleteRegion(JNIEnv *env, jobject return JNI_FALSE; UniverseObject * regionObject = dynamic_cast(r->getDynamicRegionId().getObject()); - if (regionObject == NULL) + if (regionObject == nullptr) return JNI_FALSE; regionObject->permanentlyDestroy(DeleteReasons::Script); return JNI_TRUE; @@ -711,7 +711,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionExtent(JNIEnv *env, //----------------------------------------------------------------------- /** Find a random point in the given region - * @return a script.location inside the region, or a null reference if any problems occur + * @return a script.location inside the region, or a nullptr reference if any problems occur */ jobject JNICALL ScriptMethodsRegionNamespace::findPointInRegion(JNIEnv *env, jobject self, jobject region) { @@ -732,7 +732,7 @@ jobject JNICALL ScriptMethodsRegionNamespace::findPointInRegion(JNIEnv *env, job Vector loc3d(x, 0, z); LocalRefPtr location; if (!ScriptConversion::convert(loc3d, r->getPlanet(), NetworkId::cms_invalid, location)) - return NULL; + return nullptr; return location->getReturnValue(); } @@ -744,7 +744,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithPvPAtPoint(JNIE { //get all the regions at the given point LocalObjectArrayRefPtr regionsAtPoint = _getRegionsAtPoint(location); - if (regionsAtPoint.get() == NULL || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) + if (regionsAtPoint.get() == nullptr || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) return 0; //parse out the ones with the right property @@ -760,9 +760,9 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithPvPAtPoint(JNIE result.push_back(r); } - //-- return null instead of a zero-length array + //-- return nullptr instead of a zero-length array if (result.empty ()) - return NULL; + return nullptr; //put them into the jobjectarray LocalObjectArrayRefPtr regions = createNewObjectArray(result.size(), JavaLibrary::getClsRegion()); @@ -772,10 +772,10 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithPvPAtPoint(JNIE { LocalRefPtr javaRegion; const Region * r = *it; - if (r != NULL) + if (r != nullptr) { if (!ScriptConversion::convert(*r, javaRegion)) - return NULL; + return nullptr; } setObjectArrayElement(*regions, index, *javaRegion); } @@ -790,7 +790,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithBuildableAtPoin { //get all the regions at the given point LocalObjectArrayRefPtr regionsAtPoint = _getRegionsAtPoint(location); - if (regionsAtPoint.get() == NULL || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) + if (regionsAtPoint.get() == nullptr || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) return 0; //parse out the ones with the right property @@ -806,9 +806,9 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithBuildableAtPoin result.push_back(r); } - //-- return null instead of a zero-length array + //-- return nullptr instead of a zero-length array if (result.empty ()) - return NULL; + return nullptr; //put them into the jobjectarray LocalObjectArrayRefPtr regions = createNewObjectArray(result.size(), JavaLibrary::getClsRegion()); @@ -818,10 +818,10 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithBuildableAtPoin { LocalRefPtr javaRegion; const Region * r = *it; - if (r != NULL) + if (r != nullptr) { if(!ScriptConversion::convert(*r, javaRegion)) - return NULL; + return nullptr; } setObjectArrayElement(*regions, index, *javaRegion); } @@ -837,7 +837,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithMunicipalAtPoin PROFILER_AUTO_BLOCK_DEFINE("JNI::getRegionsWithMunicipalAtPoint"); //get all the regions at the given point LocalObjectArrayRefPtr regionsAtPoint = _getRegionsAtPoint(location); - if (regionsAtPoint.get() == NULL || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) + if (regionsAtPoint.get() == nullptr || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) return 0; //parse out the ones with the right property @@ -853,9 +853,9 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithMunicipalAtPoin result.push_back(r); } - //-- return null instead of a zero-length array + //-- return nullptr instead of a zero-length array if (result.empty ()) - return NULL; + return nullptr; //put them into the jobjectarray LocalObjectArrayRefPtr regions = createNewObjectArray(result.size(), JavaLibrary::getClsRegion()); @@ -865,10 +865,10 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithMunicipalAtPoin { LocalRefPtr javaRegion; const Region * r = *it; - if (r != NULL) + if (r != nullptr) { if(!ScriptConversion::convert(*r, javaRegion)) - return NULL; + return nullptr; } setObjectArrayElement(*regions, index, *javaRegion); } @@ -884,7 +884,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithGeographicalAtP PROFILER_AUTO_BLOCK_DEFINE("JNI::getRegionsWithGeographicalAtPoint"); //get all the regions at the given point LocalObjectArrayRefPtr regionsAtPoint = _getRegionsAtPoint(location); - if (regionsAtPoint.get() == NULL || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) + if (regionsAtPoint.get() == nullptr || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) return 0; //parse out the ones with the right property @@ -900,9 +900,9 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithGeographicalAtP result.push_back(r); } - //-- return null instead of a zero-length array + //-- return nullptr instead of a zero-length array if (result.empty ()) - return NULL; + return nullptr; //put them into the jobjectarray LocalObjectArrayRefPtr regions = createNewObjectArray(result.size(), JavaLibrary::getClsRegion()); @@ -912,10 +912,10 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithGeographicalAtP { LocalRefPtr javaRegion; const Region * r = *it; - if (r != NULL) + if (r != nullptr) { if(!ScriptConversion::convert(*r, javaRegion)) - return NULL; + return nullptr; } setObjectArrayElement(*regions, index, *javaRegion); } @@ -930,7 +930,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithDifficultyAtPoi { //get all the regions at the given point LocalObjectArrayRefPtr regionsAtPoint = _getRegionsAtPoint(location); - if (regionsAtPoint.get() == NULL || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) + if (regionsAtPoint.get() == nullptr || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) return 0; //parse out the ones with the right property @@ -946,9 +946,9 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithDifficultyAtPoi result.push_back(r); } - //-- return null instead of a zero-length array + //-- return nullptr instead of a zero-length array if (result.empty ()) - return NULL; + return nullptr; //put them into the jobjectarray LocalObjectArrayRefPtr regions = createNewObjectArray(result.size(), JavaLibrary::getClsRegion()); @@ -958,10 +958,10 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithDifficultyAtPoi { LocalRefPtr javaRegion; const Region * r = *it; - if (r != NULL) + if (r != nullptr) { if(!ScriptConversion::convert(*r, javaRegion)) - return NULL; + return nullptr; } setObjectArrayElement(*regions, index, *javaRegion); } @@ -976,7 +976,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithSpawnableAtPoin { //get all the regions at the given point LocalObjectArrayRefPtr regionsAtPoint = _getRegionsAtPoint(location); - if (regionsAtPoint.get() == NULL || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) + if (regionsAtPoint.get() == nullptr || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) return 0; //parse out the ones with the right property @@ -992,9 +992,9 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithSpawnableAtPoin result.push_back(r); } - //-- return null instead of a zero-length array + //-- return nullptr instead of a zero-length array if (result.empty ()) - return NULL; + return nullptr; //put them into the jobjectarray LocalObjectArrayRefPtr regions = createNewObjectArray(result.size(), JavaLibrary::getClsRegion()); @@ -1004,10 +1004,10 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithSpawnableAtPoin { LocalRefPtr javaRegion; const Region * r = *it; - if (r != NULL) + if (r != nullptr) { if(!ScriptConversion::convert(*r, javaRegion)) - return NULL; + return nullptr; } setObjectArrayElement(*regions, index, *javaRegion); } @@ -1022,7 +1022,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithMissionAtPoint( { //get all the regions at the given point LocalObjectArrayRefPtr regionsAtPoint = _getRegionsAtPoint(location); - if (regionsAtPoint.get() == NULL || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) + if (regionsAtPoint.get() == nullptr || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) return 0; //parse out the ones with the right property @@ -1038,9 +1038,9 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithMissionAtPoint( result.push_back(r); } - //-- return null instead of a zero-length array + //-- return nullptr instead of a zero-length array if (result.empty ()) - return NULL; + return nullptr; //put them into the jobjectarray LocalObjectArrayRefPtr regions = createNewObjectArray(result.size(), JavaLibrary::getClsRegion()); @@ -1050,10 +1050,10 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithMissionAtPoint( { LocalRefPtr javaRegion; const Region * r = *it; - if (r != NULL) + if (r != nullptr) { if(!ScriptConversion::convert(*r, javaRegion)) - return NULL; + return nullptr; } setObjectArrayElement(*regions, index, *javaRegion); } @@ -1072,16 +1072,16 @@ jobject JNICALL ScriptMethodsRegionNamespace::getSmallestRegionAtPoint(JNIEnv *e Vector locationVec; std::string sceneId; if(!ScriptConversion::convertWorld(location, locationVec, sceneId)) - return NULL; + return nullptr; const Region * r = RegionMaster::getSmallestRegionAtPoint(sceneId, locationVec.x, locationVec.z); - if (r == NULL) - return NULL; + if (r == nullptr) + return nullptr; LocalRefPtr region; if (!ScriptConversion::convert(*r, region)) - return NULL; + return nullptr; return region->getReturnValue(); } @@ -1095,16 +1095,16 @@ jobject JNICALL ScriptMethodsRegionNamespace::getSmallestVisibleRegionAtPoint(JN Vector locationVec; std::string sceneId; if(!ScriptConversion::convertWorld(location, locationVec, sceneId)) - return NULL; + return nullptr; const Region * r = RegionMaster::getSmallestVisibleRegionAtPoint(sceneId, locationVec.x, locationVec.z); - if (r == NULL) - return NULL; + if (r == nullptr) + return nullptr; LocalRefPtr region; if (!ScriptConversion::convert(*r, region)) - return NULL; + return nullptr; return region->getReturnValue(); } @@ -1140,7 +1140,7 @@ jlong JNICALL ScriptMethodsRegionNamespace::createCircleRegionWithSpawn(JNIEnv * UNREF(self); // validate scripter's input - if (center == NULL || radius <= 0 || name == 0) + if (center == nullptr || radius <= 0 || name == 0) return 0; JavaStringParam jname(name); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsRegion3d.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsRegion3d.cpp index 37c9f942..6e209336 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsRegion3d.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsRegion3d.cpp @@ -87,7 +87,7 @@ struct Region3dPtrVolumeComparator ScriptParams *ScriptMethodsRegion3dNamespace::convertRegionDictionaryToScriptParams(jobject regionDictionary) { - // If we're passed a null dictionary, we just don't have any extra data but + // If we're passed a nullptr dictionary, we just don't have any extra data but // we still want to return a ScriptParams to fill in the standard values. if (!regionDictionary) return new ScriptParams; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsResource.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsResource.cpp index e908612c..04404908 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsResource.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsResource.cpp @@ -459,7 +459,7 @@ jstring JNICALL ScriptMethodsResourceNamespace::getResourceContainerForType(JNIE { ResourceTypeObject const * const typeObj = ServerUniverse::getInstance().getResourceTypeById(NetworkId(resourceType)); if (!typeObj) - return NULL; + return nullptr; std::string templateName; typeObj->getCrateTemplate(templateName); @@ -473,7 +473,7 @@ jstring JNICALL ScriptMethodsResourceNamespace::getResourceName(JNIEnv * /*env*/ { if (resourceType == 0) { - WARNING(true, ("JavaLibrary::getResourceName passed null resource type")); + WARNING(true, ("JavaLibrary::getResourceName passed nullptr resource type")); return 0; } @@ -494,7 +494,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::getResourceNames(JNIEnv *en { if (resourceTypes == 0) { - WARNING(true, ("JavaLibrary::getResourceNames passed null resource types")); + WARNING(true, ("JavaLibrary::getResourceNames passed nullptr resource types")); return 0; } @@ -517,7 +517,7 @@ jstring JNICALL ScriptMethodsResourceNamespace::getResourceClassName(JNIEnv *env { if (resourceClass == 0) { - WARNING(true, ("JavaLibrary::getResourceClassName passed null resource class")); + WARNING(true, ("JavaLibrary::getResourceClassName passed nullptr resource class")); return 0; } @@ -531,7 +531,7 @@ jstring JNICALL ScriptMethodsResourceNamespace::getResourceClassName(JNIEnv *env const ServerResourceClassObject * resClass = safe_cast( ServerUniverse::getInstance().getResourceClassByName(resourceClassName)); - if (resClass == NULL) + if (resClass == nullptr) { WARNING(true, ("JavaLibrary::getResourceClassName cannot find resource class for %s", resourceClassName.c_str())); return 0; @@ -547,7 +547,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::getResourceClassNames(JNIEn { if (resourceClasses == 0) { - WARNING(true, ("JavaLibrary::getResourceClassNames passed null resource classes")); + WARNING(true, ("JavaLibrary::getResourceClassNames passed nullptr resource classes")); return 0; } @@ -569,7 +569,7 @@ jlongArray JNICALL ScriptMethodsResourceNamespace::getResourceTypes(JNIEnv * env { if (resourceClass == 0) { - WARNING(true, ("JavaLibrary::getResourceTypes passed null resource class")); + WARNING(true, ("JavaLibrary::getResourceTypes passed nullptr resource class")); return 0; } @@ -583,7 +583,7 @@ jlongArray JNICALL ScriptMethodsResourceNamespace::getResourceTypes(JNIEnv * env const ServerResourceClassObject * resClass = safe_cast( ServerUniverse::getInstance().getResourceClassByName(resourceClassName)); - if (resClass == NULL) + if (resClass == nullptr) { WARNING(true, ("JavaLibrary::getResourceTypes cannot find resource class for %s", resourceClassName.c_str())); return 0; @@ -604,7 +604,7 @@ jlongArray JNICALL ScriptMethodsResourceNamespace::getResourceTypes(JNIEnv * env jlong jlongTmp; for (size_t i = 0; i < count; ++i) { - if (types[i] != NULL) + if (types[i] != nullptr) { jlongTmp = (types[i]->getNetworkId()).getValue(); setLongArrayRegion(*jtypes, i, 1, &jlongTmp); @@ -619,7 +619,7 @@ jstring JNICALL ScriptMethodsResourceNamespace::getResourceClass(JNIEnv * /*env* { if (resourceType == 0) { - WARNING(true, ("JavaLibrary::getResourceClass passed null resource type")); + WARNING(true, ("JavaLibrary::getResourceClass passed nullptr resource type")); return 0; } @@ -642,7 +642,7 @@ jstring JNICALL ScriptMethodsResourceNamespace::getResourceParentClass(JNIEnv * { if (resourceClass == 0) { - WARNING(true, ("JavaLibrary::getResourceParentClass passed null resource class")); + WARNING(true, ("JavaLibrary::getResourceParentClass passed nullptr resource class")); return 0; } @@ -655,14 +655,14 @@ jstring JNICALL ScriptMethodsResourceNamespace::getResourceParentClass(JNIEnv * } const ResourceClassObject * resClass = ServerUniverse::getInstance().getResourceClassByName(resourceClassName); - if (resClass == NULL) + if (resClass == nullptr) { WARNING(true, ("JavaLibrary::getResourceParentClass cannot find resource class for %s", resourceClassName.c_str())); return 0; } const ResourceClassObject * parentClass = resClass->getParent(); - if (parentClass == NULL) + if (parentClass == nullptr) return 0; JavaString parentClassName(parentClass->getResourceClassName()); @@ -675,7 +675,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::getResourceChildClasses(JNI { if (resourceClass == 0) { - WARNING(true, ("JavaLibrary::getResourceChildClasses passed null resource class")); + WARNING(true, ("JavaLibrary::getResourceChildClasses passed nullptr resource class")); return 0; } @@ -688,7 +688,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::getResourceChildClasses(JNI } const ResourceClassObject * resClass = ServerUniverse::getInstance().getResourceClassByName(resourceClassName); - if (resClass == NULL) + if (resClass == nullptr) { WARNING(true, ("JavaLibrary::getResourceChildClasses cannot find resource class for %s", resourceClassName.c_str())); return 0; @@ -701,7 +701,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::getResourceChildClasses(JNI LocalObjectArrayRefPtr childrenArray = createNewObjectArray(static_cast(count), JavaLibrary::getClsString()); for (size_t i = 0; i < count; ++i) { - if (children[i] != NULL) + if (children[i] != nullptr) { JavaString name(children[i]->getResourceClassName()); setObjectArrayElement(*childrenArray, static_cast(i), name); @@ -716,7 +716,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::getImmediateResourceChildCl { if (resourceClass == 0) { - WARNING(true, ("JavaLibrary::getImmediateResourceChildClasses passed null resource class")); + WARNING(true, ("JavaLibrary::getImmediateResourceChildClasses passed nullptr resource class")); return 0; } @@ -729,7 +729,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::getImmediateResourceChildCl } const ResourceClassObject * resClass = ServerUniverse::getInstance().getResourceClassByName(resourceClassName); - if (resClass == NULL) + if (resClass == nullptr) { WARNING(true, ("JavaLibrary::getImmediateResourceChildClasses cannot find resource class for %s", resourceClassName.c_str())); return 0; @@ -742,7 +742,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::getImmediateResourceChildCl LocalObjectArrayRefPtr childrenArray = createNewObjectArray(count, JavaLibrary::getClsString()); for (int i = 0; i < count; ++i) { - if (children[i] != NULL) + if (children[i] != nullptr) { JavaString name(children[i]->getResourceClassName()); setObjectArrayElement(*childrenArray, i, name); @@ -757,7 +757,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::getLeafResourceChildClasses { if (resourceClass == 0) { - WARNING(true, ("JavaLibrary::getLeafResourceChildClasses passed null resource class")); + WARNING(true, ("JavaLibrary::getLeafResourceChildClasses passed nullptr resource class")); return 0; } @@ -770,7 +770,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::getLeafResourceChildClasses } const ResourceClassObject * resClass = ServerUniverse::getInstance().getResourceClassByName(resourceClassName); - if (resClass == NULL) + if (resClass == nullptr) { WARNING(true, ("JavaLibrary::getLeafResourceChildClasses cannot find resource class for %s", resourceClassName.c_str())); return 0; @@ -783,7 +783,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::getLeafResourceChildClasses LocalObjectArrayRefPtr childrenArray = createNewObjectArray(count, JavaLibrary::getClsString()); for (int i = 0; i < count; ++i) { - if (children[i] != NULL) + if (children[i] != nullptr) { JavaString name(children[i]->getResourceClassName()); setObjectArrayElement(*childrenArray, i, name); @@ -798,7 +798,7 @@ jboolean JNICALL ScriptMethodsResourceNamespace::hasResourceType(JNIEnv *env, jo { if (resourceClass == 0) { - WARNING(true, ("JavaLibrary::hasResourceType passed null resource class")); + WARNING(true, ("JavaLibrary::hasResourceType passed nullptr resource class")); return JNI_FALSE; } @@ -811,7 +811,7 @@ jboolean JNICALL ScriptMethodsResourceNamespace::hasResourceType(JNIEnv *env, jo } ServerResourceClassObject const * const resClass = safe_cast(ServerUniverse::getInstance().getResourceClassByName(resourceClassName)); - if (resClass == NULL) + if (resClass == nullptr) { WARNING(true, ("JavaLibrary::hasResourceType cannot find resource class for %s", resourceClassName.c_str())); return JNI_FALSE; @@ -826,13 +826,13 @@ jlong JNICALL ScriptMethodsResourceNamespace::createResourceCrate(JNIEnv * /*env { if (resourceType == 0) { - WARNING(true, ("JavaLibrary::createResourceCrate passed null resource type")); + WARNING(true, ("JavaLibrary::createResourceCrate passed nullptr resource type")); return 0; } if (destination == 0) { - WARNING(true, ("JavaLibrary::createResourceCrate passed null destination")); + WARNING(true, ("JavaLibrary::createResourceCrate passed nullptr destination")); return 0; } @@ -849,7 +849,7 @@ jlong JNICALL ScriptMethodsResourceNamespace::createResourceCrate(JNIEnv * /*env return 0; } - ServerObject * container = NULL; + ServerObject * container = nullptr; if (!JavaLibrary::getObject(destination, container)) { WARNING(true, ("JavaLibrary::createResourceCrate cannot find destination object")); @@ -860,14 +860,14 @@ jlong JNICALL ScriptMethodsResourceNamespace::createResourceCrate(JNIEnv * /*env rt->getCrateTemplate(crateTemplateName); ServerObject * object = ServerWorld::createNewObject(crateTemplateName, *container, true); - if (object == NULL) + if (object == nullptr) { WARNING(true, ("JavaLibrary::createResourceCrate cannot create crate from template %s", crateTemplateName.c_str())); return 0; } ResourceContainerObject * crate = dynamic_cast(object); - if (crate == NULL) + if (crate == nullptr) { IGNORE_RETURN(object->permanentlyDestroy(DeleteReasons::SetupFailed)); WARNING(true, ("JavaLibrary::createResourceCrate crate %s is not a resource container", crateTemplateName.c_str())); @@ -888,13 +888,13 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::requestResourceList(JNIEnv { if (loc == 0) { - WARNING(true, ("JavaLibrary::requestResourceList passed null location")); + WARNING(true, ("JavaLibrary::requestResourceList passed nullptr location")); return 0; } if (resourceClass == 0) { - WARNING(true, ("JavaLibrary::requestResourceList passed null resource class")); + WARNING(true, ("JavaLibrary::requestResourceList passed nullptr resource class")); return 0; } @@ -921,7 +921,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::requestResourceList(JNIEnv const Vector & locationPos = location.getCoordinates(); const PlanetObject * planet = ServerUniverse::getInstance().getPlanetByName(location.getSceneId()); - if (planet == NULL) + if (planet == nullptr) { WARNING(true, ("JavaLibrary::requestResourceList cannot find planet %s", location.getSceneId())); return 0; @@ -929,7 +929,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::requestResourceList(JNIEnv // get the resource class and all its children ServerResourceClassObject const * const resClass = safe_cast(ServerUniverse::getInstance().getResourceClassByName(resourceClassName)); - if (resClass == NULL) + if (resClass == nullptr) { WARNING(true, ("JavaLibrary::requestResourceList cannot find resource class %s", resourceClassName.c_str())); return 0; @@ -951,7 +951,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::requestResourceList(JNIEnv if (!(*i)->isDepleted()) { ResourcePoolObject const * const pool = (*i)->getPoolForPlanet(*planet); - if (pool != NULL) + if (pool != nullptr) { float density = pool->getEfficiencyAtLocation(locationPos.x, locationPos.z); if (density >= minDensity && density <= maxDensity) @@ -1049,7 +1049,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::getScaledResourceAttributes return 0; } ServerResourceClassObject const * const resClass = safe_cast(ServerUniverse::getInstance().getResourceClassByName(resourceClassName)); - if (resClass == NULL) + if (resClass == nullptr) { WARNING(true, ("JavaLibrary::getScaledResourceAttributes cannot find resource class %s", resourceClassName.c_str())); return 0; @@ -1152,7 +1152,7 @@ jint JNICALL ScriptMethodsResourceNamespace::getResourceAttribute(JNIEnv * /*env if (resourceType == 0) { - WARNING(true, ("JavaLibrary::getResourceAttribute passed null resource type")); + WARNING(true, ("JavaLibrary::getResourceAttribute passed nullptr resource type")); return -1; } @@ -1171,7 +1171,7 @@ jint JNICALL ScriptMethodsResourceNamespace::getResourceAttribute(JNIEnv * /*env jlong JNICALL ScriptMethodsResourceNamespace::getRecycledVersionOfResourceType(JNIEnv * /*env*/, jobject /*self*/, jlong resourceType) { ResourceTypeObject const * const resourceTypeObject = ServerUniverse::getInstance().getResourceTypeById(NetworkId(resourceType)); - ResourceTypeObject const * const recycledTypeObject = resourceTypeObject ? resourceTypeObject->getRecycledVersion() : NULL; + ResourceTypeObject const * const recycledTypeObject = resourceTypeObject ? resourceTypeObject->getRecycledVersion() : nullptr; if (recycledTypeObject) return (recycledTypeObject->getNetworkId()).getValue(); else diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsScript.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsScript.cpp index 7d600707..a7e06d57 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsScript.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsScript.cpp @@ -121,7 +121,7 @@ jint JNICALL ScriptMethodsScriptNamespace::attachScript(JNIEnv *env, jobject sel return SCRIPT_OVERRIDE; GameScriptObject* scripts = object->getScriptObject(); - if (scripts == NULL) + if (scripts == nullptr) return SCRIPT_OVERRIDE; char buffer[MAX_SCRIPT_NAME_LEN]; @@ -162,7 +162,7 @@ jboolean JNICALL ScriptMethodsScriptNamespace::detachScript(JNIEnv *env, jobject return JNI_FALSE; GameScriptObject* scripts = object->getScriptObject(); - if (scripts == NULL) + if (scripts == nullptr) return JNI_FALSE; char buffer[MAX_SCRIPT_NAME_LEN]; @@ -192,7 +192,7 @@ jboolean JNICALL ScriptMethodsScriptNamespace::detachAllScripts(JNIEnv *env, job return JNI_FALSE; GameScriptObject* scriptObject = object->getScriptObject(); - if (scriptObject == NULL) + if (scriptObject == nullptr) return JNI_FALSE; std::vector scriptNames; @@ -230,7 +230,7 @@ jboolean JNICALL ScriptMethodsScriptNamespace::hasScript(JNIEnv *env, jobject se return JNI_FALSE; GameScriptObject* scripts = object->getScriptObject(); - if (scripts == NULL) + if (scripts == nullptr) return JNI_FALSE; char buffer[MAX_SCRIPT_NAME_LEN]; @@ -325,7 +325,7 @@ jboolean JNICALL ScriptMethodsScriptNamespace::localMessageTo(JNIEnv *env, jobje else { GameScriptObject* scripts = object->getScriptObject(); - if (scripts == NULL) + if (scripts == nullptr) return JNI_FALSE; ScriptDictionaryPtr dictionary(new JavaDictionary(params)); @@ -400,7 +400,7 @@ jboolean JNICALL ScriptMethodsScriptNamespace::remoteMessageTo(JNIEnv *env, jobj * "messageTo" for players on the current planet * * If you want everyone on the planet to receive the message, -* specify null for loc and -1.0f for radius; otherwise, specify +* specify nullptr for loc and -1.0f for radius; otherwise, specify * a loc and a radius and only players on the planet within the * specified area will receive the message */ @@ -447,7 +447,7 @@ jint JNICALL ScriptMethodsScriptNamespace::remoteMessageToCalendarTimeDayOfWeek( return -1; // calculate the absolute time when the messageTo should go off - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); time_t const timeTarget = CalendarTime::getNextGMTTimeOcurrence(timeNow, dayOfWeek, hour, minute, second); if ((timeTarget <= 0) || (timeTarget <= timeNow)) @@ -487,7 +487,7 @@ jint JNICALL ScriptMethodsScriptNamespace::remoteMessageToCalendarTimeDayOfMonth return -1; // calculate the absolute time when the messageTo should go off - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); time_t const timeTarget = CalendarTime::getNextGMTTimeOcurrence(timeNow, month, dayOfMonth, hour, minute, second); if ((timeTarget <= 0) || (timeTarget <= timeNow)) @@ -562,7 +562,7 @@ void JNICALL ScriptMethodsScriptNamespace::cancelRecurringMessageTo(JNIEnv *env, // returns -1 if object doesn't have the messageTo jint JNICALL ScriptMethodsScriptNamespace::timeUntilMessageTo(JNIEnv *env, jobject self, jlong object, jstring methodName) { - ServerObject const * so = NULL; + ServerObject const * so = nullptr; if (!JavaLibrary::getObject(object, so)) return -1; @@ -606,7 +606,7 @@ jint JNICALL ScriptMethodsScriptNamespace::getCalendarTimeSeconds(JNIEnv * env, if(env == 0) return 0; - return ::time(NULL); + return ::time(nullptr); } //----------------------------------------------------------------------- @@ -616,7 +616,7 @@ jint JNICALL ScriptMethodsScriptNamespace::getCalendarTimeSeconds2(JNIEnv * env, if(env == 0) return -1; - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); if (!timeinfo) return -1; @@ -678,7 +678,7 @@ jint JNICALL ScriptMethodsScriptNamespace::secondsUntilCalendarTimeDayOfWeek(JNI UNREF(self); // calculate the time between now and the specified time - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); time_t const timeTarget = CalendarTime::getNextGMTTimeOcurrence(timeNow, dayOfWeek, hour, minute, second); if ((timeTarget <= 0) || (timeTarget <= timeNow)) @@ -694,7 +694,7 @@ jint JNICALL ScriptMethodsScriptNamespace::secondsUntilCalendarTimeDayOfMonth(JN UNREF(self); // calculate the time between now and the specified time - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); time_t const timeTarget = CalendarTime::getNextGMTTimeOcurrence(timeNow, month, dayOfMonth, hour, minute, second); if ((timeTarget <= 0) || (timeTarget <= timeNow)) diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsServerUI.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsServerUI.cpp index db36bd13..c925aae3 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsServerUI.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsServerUI.cpp @@ -83,14 +83,14 @@ jint JNICALL ScriptMethodsServerUINamespace::createSuiPage(JNIEnv *env, jobject JavaStringParam localPageName(pageName); jint failureCode = -1; - ServerObject* owner = NULL; + ServerObject* owner = nullptr; if(!JavaLibrary::getObject(ownerobject, owner)) { WARNING(true, ("SUI: couldn't get owner ServerObject*, can't create a page")); return failureCode; } - ServerObject* so = NULL; + ServerObject* so = nullptr; if(!JavaLibrary::getObject(client, so)) return failureCode; @@ -296,7 +296,7 @@ jboolean JNICALL ScriptMethodsServerUINamespace::subscribeToSuiEvent(JNIEnv } std::string ewn; - if (eventWidgetName != NULL) + if (eventWidgetName != nullptr) { JavaStringParam localEventWidgetName(eventWidgetName); JavaLibrary::convert(localEventWidgetName, ewn); @@ -323,7 +323,7 @@ jboolean JNICALL ScriptMethodsServerUINamespace::subscribeToSuiPropertyForEv } std::string ewn; - if (eventWidgetName != NULL) + if (eventWidgetName != nullptr) { JavaStringParam localEventWidgetName(eventWidgetName); JavaLibrary::convert(localEventWidgetName, ewn); @@ -411,7 +411,7 @@ jboolean JNICALL ScriptMethodsServerUINamespace::setSuiAssociatedLocation(JN return JNI_FALSE; } - ServerObject* associatedObject = NULL; + ServerObject* associatedObject = nullptr; if(!JavaLibrary::getObject(j_associatedObjectId, associatedObject)) { DEBUG_WARNING(true, ("could not find object for associatedObjectid")); @@ -441,12 +441,12 @@ jboolean JNICALL ScriptMethodsServerUINamespace::setSuiMaxRangeToObject(JNIE jboolean JNICALL ScriptMethodsServerUINamespace::clientMinigameOpen(JNIEnv *env, jobject self, jlong player, jobject data) { - ServerObject* playerServerObject = NULL; + ServerObject* playerServerObject = nullptr; if(!JavaLibrary::getObject(player, playerServerObject)) return JNI_FALSE; CreatureObject * creatureObject = playerServerObject->asCreatureObject(); - if(creatureObject != NULL) + if(creatureObject != nullptr) { ValueDictionary gameData; JavaLibrary::convert(data, gameData); @@ -462,12 +462,12 @@ jboolean JNICALL ScriptMethodsServerUINamespace::clientMinigameOpen(JNIEnv *env, jboolean JNICALL ScriptMethodsServerUINamespace::clientMinigameClose(JNIEnv *env, jobject self, jlong player, jobject data) { - ServerObject* playerServerObject = NULL; + ServerObject* playerServerObject = nullptr; if(!JavaLibrary::getObject(player, playerServerObject)) return JNI_FALSE; CreatureObject * creatureObject = playerServerObject->asCreatureObject(); - if(creatureObject != NULL) + if(creatureObject != nullptr) { ValueDictionary gameData; JavaLibrary::convert(data, gameData); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsShip.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsShip.cpp index 8c40cd6c..4db4502b 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsShip.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsShip.cpp @@ -83,13 +83,13 @@ namespace ScriptMethodsShipNamespace { //-- Make sure ships are enabled if (!verifyShipsEnabled()) - return NULL; + return nullptr; char buf[256]; snprintf(buf, sizeof(buf), "JavaLibrary::%s: ship obj_id did not resolve to a ShipObject", functionName); ShipObject * const shipObject = JavaLibrary::getShipThrow(env, jobject_shipId, buf, throwIfNotOnServer); if (!shipObject) - return NULL; + return nullptr; if (chassisSlot != ShipChassisSlotType::SCST_num_types && !shipObject->isSlotInstalled(chassisSlot)) JAVA_THROW_SCRIPT_EXCEPTION(true, ("JavaLibrary::%s chassisSlot [%d] not installed", functionName, chassisSlot)); @@ -1115,17 +1115,17 @@ jstring JNICALL ScriptMethodsShipNamespace::getShipChassisType(JNIEnv * env, job { //-- Make sure ships are enabled if (!verifyShipsEnabled()) - return NULL; + return nullptr; ShipObject const * const shipObject = JavaLibrary::getShipThrow(env, jobject_shipId, "getShipChassisType(): shipId obj_id did not resolve to a ShipObject", false); if (!shipObject) - return NULL; + return nullptr; ShipChassis const * const shipChassis = ShipChassis::findShipChassisByCrc (shipObject->getChassisType()); if (shipChassis) return JavaString(shipChassis->getName ().getString ()).getReturnValue(); - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -1339,7 +1339,7 @@ jstring JNICALL ScriptMethodsShipNamespace::getShipComponentName(JNIEnv * env, j { ShipObject const * const shipObject = JavaLibrary::getShipThrow(env, jobject_shipId, "getShipComponentName() invalid ship", false); if (!shipObject) - return NULL; + return nullptr; Unicode::String const & name = shipObject->getComponentName(chassisSlot); if (!name.empty()) @@ -1918,9 +1918,9 @@ void JNICALL ScriptMethodsShipNamespace::setShipComponentName(JNIEnv * env, jobj if (!shipObject) return; - if (componentName == NULL) + if (componentName == nullptr) { - JAVA_THROW_SCRIPT_EXCEPTION(true, ("JavaLibrary::setShipComponentName (): null name")); + JAVA_THROW_SCRIPT_EXCEPTION(true, ("JavaLibrary::setShipComponentName (): nullptr name")); return; } @@ -2442,7 +2442,7 @@ jboolean JNICALL ScriptMethodsShipNamespace::shipCanInstallComponent(JNIEnv * en return false; TangibleObject * tangibleComponent = 0; - if (JavaLibrary::getObject (component, tangibleComponent) && tangibleComponent != NULL) + if (JavaLibrary::getObject (component, tangibleComponent) && tangibleComponent != nullptr) return shipObject->canInstallComponent(chassisSlot, *tangibleComponent); else { @@ -2481,7 +2481,7 @@ jboolean JNICALL ScriptMethodsShipNamespace::shipInstallComponent(JNIEnv * env, NetworkId installerId(jobject_installerId); TangibleObject * tangibleComponent = 0; - if (JavaLibrary::getObject (component, tangibleComponent) && tangibleComponent != NULL) + if (JavaLibrary::getObject (component, tangibleComponent) && tangibleComponent != nullptr) return shipObject->installComponent(installerId, chassisSlot, *tangibleComponent); else { @@ -2546,11 +2546,11 @@ jintArray JNICALL ScriptMethodsShipNamespace::getShipChassisSlots(JNIEnv * env, { //-- Make sure ships are enabled if (!verifyShipsEnabled()) - return NULL; + return nullptr; ShipObject const * const shipObject = JavaLibrary::getShipThrow(env, jobject_shipId, "getShipChassisSlots(): shipId obj_id did not resolve to a ShipObject", false); if (!shipObject) - return NULL; + return nullptr; ShipChassis const * const shipChassis = ShipChassis::findShipChassisByCrc (shipObject->getChassisType()); if (shipChassis) @@ -2571,7 +2571,7 @@ jintArray JNICALL ScriptMethodsShipNamespace::getShipChassisSlots(JNIEnv * env, } } - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -2585,7 +2585,7 @@ jint JNICALL ScriptMethodsShipNamespace::getShipComponentDescriptorType(JNIEnv * TangibleObject * tangibleComponent = 0; if (JavaLibrary::getObject (jobject_component, tangibleComponent)) { - if (tangibleComponent != NULL && tangibleComponent->getObjectTemplate () != NULL) + if (tangibleComponent != nullptr && tangibleComponent->getObjectTemplate () != nullptr) { ShipComponentDescriptor const * const shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByObjectTemplate (tangibleComponent->getObjectTemplate ()->getCrcName ().getCrc ()); @@ -2623,7 +2623,7 @@ jstring JNICALL ScriptMethodsShipNamespace::getShipComponentDescriptorTypeNam { //-- Make sure ships are enabled if (!verifyShipsEnabled()) - return NULL; + return nullptr; std::string const & typeName = ShipComponentType::getNameFromType(static_cast(componentType)); @@ -2641,7 +2641,7 @@ jint JNICALL ScriptMethodsShipNamespace::getShipComponentDescriptorCrc(JNI TangibleObject * tangibleComponent = 0; if (JavaLibrary::getObject (jobject_component, tangibleComponent)) { - if (tangibleComponent != NULL && tangibleComponent->getObjectTemplate () != NULL) + if (tangibleComponent != nullptr && tangibleComponent->getObjectTemplate () != nullptr) { ShipComponentDescriptor const * const shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByObjectTemplate (tangibleComponent->getObjectTemplate ()->getCrcName ().getCrc ()); @@ -2659,11 +2659,11 @@ jstring JNICALL ScriptMethodsShipNamespace::getShipComponentDescriptorCrcName { //-- Make sure ships are enabled if (!verifyShipsEnabled()) - return NULL; + return nullptr; ShipComponentDescriptor const * const shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByCrc(static_cast(componentCrc)); - if (shipComponentDescriptor == NULL) - return NULL; + if (shipComponentDescriptor == nullptr) + return nullptr; return JavaString(shipComponentDescriptor->getName().getString()).getReturnValue(); } @@ -2674,11 +2674,11 @@ jstring JNICALL ScriptMethodsShipNamespace::getShipComponentDescriptorCompati { //-- Make sure ships are enabled if (!verifyShipsEnabled()) - return NULL; + return nullptr; ShipComponentDescriptor const * const shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByCrc(static_cast(componentCrc)); - if (shipComponentDescriptor == NULL) - return NULL; + if (shipComponentDescriptor == nullptr) + return nullptr; return JavaString(shipComponentDescriptor->getCompatibility().getString()).getReturnValue(); } @@ -2776,15 +2776,15 @@ void JNICALL ScriptMethodsShipNamespace::notifyShipDamage(JNIEnv * env, jobject if (victimShipObject->isPlayerShip()) { //-- Get the attacker object. It can be any tangible object. - TangibleObject const * attackerTangibleObject = NULL; + TangibleObject const * attackerTangibleObject = nullptr; if (jobject_attacker) IGNORE_RETURN(JavaLibrary::getObject(jobject_attacker, attackerTangibleObject)); Controller * const victimShipController = victimShipObject->getController(); if (victimShipController) { - ShipDamageMessage shipDamage(attackerTangibleObject != NULL ? attackerTangibleObject->getNetworkId() : NetworkId::cms_invalid, - attackerTangibleObject != NULL ? attackerTangibleObject->getPosition_w() : victimShipObject->getPosition_w(), + ShipDamageMessage shipDamage(attackerTangibleObject != nullptr ? attackerTangibleObject->getNetworkId() : NetworkId::cms_invalid, + attackerTangibleObject != nullptr ? attackerTangibleObject->getPosition_w() : victimShipObject->getPosition_w(), totalDamage ); //lint -esym(429, damageMessage) @@ -3008,7 +3008,7 @@ jlong JNICALL ScriptMethodsShipNamespace::getDroidControlDeviceForShip(JNIEnv * NetworkId const & droidControlDeviceId = shipObject->getInstalledDroidControlDevice(); Object const * const droidControlDevice = NetworkIdManager::getObjectById(droidControlDeviceId); - ServerObject const * const serverDroidControlDevice = droidControlDevice ? droidControlDevice->asServerObject() : NULL; + ServerObject const * const serverDroidControlDevice = droidControlDevice ? droidControlDevice->asServerObject() : nullptr; if(!serverDroidControlDevice) return 0; else @@ -3050,7 +3050,7 @@ void JNICALL ScriptMethodsShipNamespace::commPlayers(JNIEnv *env, jobject /*self uint32 appearanceOverloadSharedTemplateCrc = 0; ObjectTemplate const * const ot = ObjectTemplateList::fetch(Unicode::wideToNarrow(appearanceOverloadServerTemplateWide)); - ServerObjectTemplate const * const sot = ot ? ot->asServerObjectTemplate() : NULL; + ServerObjectTemplate const * const sot = ot ? ot->asServerObjectTemplate() : nullptr; if(sot) { std::string const & sharedTemplateName = sot->getSharedTemplate(); @@ -3197,7 +3197,7 @@ jlong JNICALL ScriptMethodsShipNamespace::launchShipFromHangar(JNIEnv *env, jobj Transform const & finalCreateTransform = launchingShip->getTransform_o2p().rotateTranslate_l2p(finalHangarDelta_o); ServerObject * const newShip = ServerWorld::createNewObject(crcName.getCrc(), finalCreateTransform, cell, false); - if (newShip == NULL) + if (newShip == nullptr) return 0; // create an objId to return @@ -3223,7 +3223,7 @@ void JNICALL ScriptMethodsShipNamespace::handleShipDestruction(JNIEnv * en //convert ship ShipObject * const ship = JavaLibrary::getShipThrow(env, jship, "handleShipDestruction(): shipId obj_id did not resolve to a ShipObject", false); - if (ship == NULL) + if (ship == nullptr) return; DestroyShipMessage const msg(ship->getNetworkId(), severity); @@ -3401,7 +3401,7 @@ jfloat JNICALL ScriptMethodsShipNamespace::getShipInternalDamageOverTimeDamageRa return 0.0f; static ShipInternalDamageOverTime const * const idot = ShipInternalDamageOverTimeManager::findEntry(*ship, chassisSlot); - if (idot == NULL) + if (idot == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("JavaLibrary::getShipInternalDamageOverTimeDamageThreshold idot for [%s] slot [%d] not found", ship->getNetworkId().getValueString().c_str(), chassisSlot)); return 0.0f; @@ -3419,7 +3419,7 @@ jfloat JNICALL ScriptMethodsShipNamespace::getShipInternalDamageOverTimeDamageTh return 0.0f; static ShipInternalDamageOverTime const * const idot = ShipInternalDamageOverTimeManager::findEntry(*ship, chassisSlot); - if (idot == NULL) + if (idot == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("JavaLibrary::getShipInternalDamageOverTimeDamageThreshold idot for [%s] slot [%d] not found", ship->getNetworkId().getValueString().c_str(), chassisSlot)); return 0.0f; @@ -3437,11 +3437,11 @@ jboolean JNICALL ScriptMethodsShipNamespace::hasShipInternalDamageOverTime(JNIEn //convert ship ShipObject * const ship = JavaLibrary::getShipThrow(env, jship, "hasShipInternalDamageOverTime(): shipId obj_id did not resolve to a ShipObject", false); - if (ship == NULL) + if (ship == nullptr) return false; static ShipInternalDamageOverTime const * const idot = ShipInternalDamageOverTimeManager::findEntry(*ship, chassisSlot); - return idot != NULL; + return idot != nullptr; } // ---------------------------------------------------------------------- @@ -3576,7 +3576,7 @@ jboolean JNICALL ScriptMethodsShipNamespace::shipIsInNebula(JNIEnv *env, jobject std::string nebulaName; - if (NULL != j_nebulaName) + if (nullptr != j_nebulaName) { JavaStringParam const jsp(j_nebulaName); if (!JavaLibrary::convert(jsp, nebulaName)) @@ -3593,7 +3593,7 @@ jboolean JNICALL ScriptMethodsShipNamespace::shipIsInNebula(JNIEnv *env, jobject { int const id = *it; Nebula const * const nebula = NebulaManager::getNebulaById(id); - if (NULL != nebula) + if (nullptr != nebula) { if (nebula->getName() == nebulaName) return JNI_TRUE; @@ -3637,7 +3637,7 @@ jboolean JNICALL ScriptMethodsShipNamespace::setShipWingName(JNIEnv * /*env*/, j jstring JNICALL ScriptMethodsShipNamespace::getShipWingName(JNIEnv * /*env*/, jobject /*self*/, jlong target) { - ServerObject const * object = NULL; + ServerObject const * object = nullptr; if (!JavaLibrary::getObject(target, object)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("JavaLibrary::getShipWingName (): could not convert the target")); @@ -3686,7 +3686,7 @@ jboolean JNICALL ScriptMethodsShipNamespace::setShipTypeName(JNIEnv * /*env*/, j jstring JNICALL ScriptMethodsShipNamespace::getShipTypeName(JNIEnv * /*env*/, jobject /*self*/, jlong target) { - ServerObject const * object = NULL; + ServerObject const * object = nullptr; if (!JavaLibrary::getObject(target, object)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("JavaLibrary::getShipTypeName (): could not convert the target")); @@ -3735,7 +3735,7 @@ jboolean JNICALL ScriptMethodsShipNamespace::setShipDifficulty(JNIEnv * /*env*/, jstring JNICALL ScriptMethodsShipNamespace::getShipDifficulty(JNIEnv * /*env*/, jobject /*self*/, jlong target) { - ServerObject const * object = NULL; + ServerObject const * object = nullptr; if (!JavaLibrary::getObject(target, object)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("JavaLibrary::getShipDifficulty (): could not convert the target")); @@ -3783,7 +3783,7 @@ jboolean JNICALL ScriptMethodsShipNamespace::setShipFaction(JNIEnv * /*env*/, jo jstring JNICALL ScriptMethodsShipNamespace::getShipFaction(JNIEnv * /*env*/, jobject /*self*/, jlong target) { - ServerObject const * object = NULL; + ServerObject const * object = nullptr; if (!JavaLibrary::getObject(target, object)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("JavaLibrary::getShipFaction (): could not convert the target")); @@ -3871,7 +3871,7 @@ jboolean JNICALL ScriptMethodsShipNamespace::isMissionCriticalObject(JNIEnv * en if (!ship) { - JAVA_THROW_SCRIPT_EXCEPTION(true, ("isMissionCriticalObject(): playerId ship is null")); + JAVA_THROW_SCRIPT_EXCEPTION(true, ("isMissionCriticalObject(): playerId ship is nullptr")); return JNI_FALSE; } @@ -3973,7 +3973,7 @@ void JNICALL ScriptMethodsShipNamespace::setDynamicMiningAsteroidVelocity(JNIEnv } MiningAsteroidController * const miningAsteroidController = dynamic_cast(shipObject->getController()); - if (NULL == miningAsteroidController) + if (nullptr == miningAsteroidController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("setDynamicMiningAsteroidVelocity(): called on a ship which is not a dynamic mining asteroid")); return; @@ -3988,12 +3988,12 @@ jobject JNICALL ScriptMethodsShipNamespace::getDynamicMiningAsteroidVelocity(JNI { ShipObject * const shipObject = JavaLibrary::getShipThrow(env, jobject_asteroidId, "getDynamicMiningAsteroidVelocity(): shipId did not resolve to a ShipObject", false); if (!shipObject) - return NULL; + return nullptr; MiningAsteroidController * const miningAsteroidController = dynamic_cast(shipObject->getController()); - if (NULL == miningAsteroidController) + if (nullptr == miningAsteroidController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("setDynamicMiningAsteroidVelocity(): called on a ship which is not a dynamic mining asteroid")); - return NULL; + return nullptr; } Vector const & velocity_w = miningAsteroidController->getVelocity_w(); @@ -4073,7 +4073,7 @@ jlongArray JNICALL ScriptMethodsShipNamespace::getShipCargoHoldContentsResourceT { ShipObject const * const shipObject = getShipThrowTestSlot(env, jobject_shipId, "getShipCargoHoldContents()", false, static_cast(ShipChassisSlotType::SCST_cargo_hold)); if (!shipObject) - return NULL; + return nullptr; ShipObject::NetworkIdIntMap const & contents = shipObject->getCargoHoldContents(); @@ -4090,7 +4090,7 @@ jlongArray JNICALL ScriptMethodsShipNamespace::getShipCargoHoldContentsResourceT return jids->getReturnValue(); } - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -4099,7 +4099,7 @@ jintArray JNICALL ScriptMethodsShipNamespace::getShipCargoHoldContentsAmounts(JN { ShipObject const * const shipObject = getShipThrowTestSlot(env, jobject_shipId, "getShipCargoHoldContents()", false, static_cast(ShipChassisSlotType::SCST_cargo_hold)); if (!shipObject) - return NULL; + return nullptr; ShipObject::NetworkIdIntMap const & contents = shipObject->getCargoHoldContents(); @@ -4115,7 +4115,7 @@ jintArray JNICALL ScriptMethodsShipNamespace::getShipCargoHoldContentsAmounts(JN return jamounts->getReturnValue(); } - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -4125,9 +4125,9 @@ void JNICALL ScriptMethodsShipNamespace::openSpaceMiningUi(JNIEnv * env, jobject NetworkId const & playerId = NetworkId(jobject_player); NetworkId const & spaceStationId = NetworkId(jobject_spaceStation); - if (jstring_spaceStationName == NULL) + if (jstring_spaceStationName == nullptr) { - JAVA_THROW_SCRIPT_EXCEPTION(true, ("JavaLibrary::setShipComponentName (): null name")); + JAVA_THROW_SCRIPT_EXCEPTION(true, ("JavaLibrary::setShipComponentName (): nullptr name")); return; } @@ -4140,7 +4140,7 @@ void JNICALL ScriptMethodsShipNamespace::openSpaceMiningUi(JNIEnv * env, jobject } Object * const player = NetworkIdManager::getObjectById(playerId); - Controller * const controller = player ? player->getController(): NULL; + Controller * const controller = player ? player->getController(): nullptr; if (!controller) { diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsSkill.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsSkill.cpp index ae184f4b..07533c45 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsSkill.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsSkill.cpp @@ -276,7 +276,7 @@ jobjectArray JNICALL ScriptMethodsSkillNamespace::getSkillCommandsProvided(JNIEn const SkillObject * skill = getSkill(localSkillName); if(! skill) - return NULL; + return nullptr; LocalObjectArrayRefPtr strArray; if(! ScriptConversion::convert(skill->getCommandsProvided(), strArray)) @@ -293,7 +293,7 @@ jobject JNICALL ScriptMethodsSkillNamespace::getSkillPrerequisiteExperience(JNIE const SkillObject * skill = getSkill(localSkillName); if(! skill) - return NULL; + return nullptr; JavaDictionaryPtr dict; if (!JavaLibrary::convert(skill->getPrerequisiteExperienceVector(), dict)) @@ -334,7 +334,7 @@ jobjectArray JNICALL ScriptMethodsSkillNamespace::getSkillPrerequisiteSkills(JNI const SkillObject * skill = getSkill(localSkillName); if(! skill) - return NULL; + return nullptr; std::vector skillNames; std::vector::const_iterator i; @@ -358,7 +358,7 @@ jobject JNICALL ScriptMethodsSkillNamespace::getSkillPrerequisiteSpecies(JNIEnv const SkillObject * skill = getSkill(localSkillName); if(! skill) - return NULL; + return nullptr; JavaDictionaryPtr dict; if (!JavaLibrary::convert(skill->getPrerequisiteSpecies(), dict)) @@ -374,14 +374,14 @@ jstring JNICALL ScriptMethodsSkillNamespace::getSkillProfession(JNIEnv *env, job const SkillObject * const skill = getSkill(localSkillName); if(!skill) - return NULL; + return nullptr; const SkillObject * const prof = skill->findProfessionForSkill (); if(prof) { JavaString str(prof->getSkillName().c_str()); return str.getReturnValue(); } - return NULL; + return nullptr; } //----------------------------------------------------------------------- @@ -423,7 +423,7 @@ jobject JNICALL ScriptMethodsSkillNamespace::getSkillStatisticModifiers(JNIEnv * const SkillObject * skill = getSkill(localSkillName); if(! skill) - return NULL; + return nullptr; JavaDictionaryPtr dict; if (!JavaLibrary::convert(skill->getStatisticModifiers(), dict)) @@ -450,7 +450,7 @@ jint JNICALL ScriptMethodsSkillNamespace::getCreatureSkillStatisticModifier(JNIE JavaStringParam jskillStatName(skillStatName); - const CreatureObject * object = NULL; + const CreatureObject * object = nullptr; if (!JavaLibrary::getObject(creature, object)) return 0; @@ -472,7 +472,7 @@ jint JNICALL ScriptMethodsSkillNamespace::getCreatureSkillStatisticModifier(JNIE * @param creature the creature whose stat mod we want * @param skillStatNames array of names of the skill stat mods we want * - * @return the skill stat mod values, or null on error + * @return the skill stat mod values, or nullptr on error */ jintArray JNICALL ScriptMethodsSkillNamespace::getCreatureSkillStatisticModifiers(JNIEnv *env, jobject self, jlong creature, jobjectArray skillStatNames) { @@ -481,7 +481,7 @@ jintArray JNICALL ScriptMethodsSkillNamespace::getCreatureSkillStatisticModifier if (skillStatNames == 0) return 0; - const CreatureObject * object = NULL; + const CreatureObject * object = nullptr; if (!JavaLibrary::getObject(creature, object)) return 0; @@ -555,7 +555,7 @@ jint JNICALL ScriptMethodsSkillNamespace::internalGetCreatureEnhancedSkillStatis JavaStringParam jskillStatName(skillStatName); - const CreatureObject * object = NULL; + const CreatureObject * object = nullptr; if (!JavaLibrary::getObject(creature, object)) return 0; @@ -577,7 +577,7 @@ jint JNICALL ScriptMethodsSkillNamespace::internalGetCreatureEnhancedSkillStatis * @param creature the creature whose stat mod we want * @param skillStatNames array of names of the skill stat mods we want * - * @return the skill stat mod values, or null on error + * @return the skill stat mod values, or nullptr on error */ jintArray JNICALL ScriptMethodsSkillNamespace::internalGetCreatureEnhancedSkillStatisticModifiers(JNIEnv *env, jobject self, jlong creature, jobjectArray skillStatNames, jboolean useBonusCap) { @@ -586,7 +586,7 @@ jintArray JNICALL ScriptMethodsSkillNamespace::internalGetCreatureEnhancedSkillS if (skillStatNames == 0) return 0; - const CreatureObject * object = NULL; + const CreatureObject * object = nullptr; if (!JavaLibrary::getObject(creature, object)) return 0; @@ -621,7 +621,7 @@ jstring JNICALL ScriptMethodsSkillNamespace::getSkillTitleGranted(JNIEnv *env, j const SkillObject * const skill = getSkill(localSkillName); if(! skill) - return NULL; + return nullptr; if (skill->isTitle ()) return JavaString(skill->getSkillName ().c_str()).getReturnValue(); @@ -665,7 +665,7 @@ jint JNICALL ScriptMethodsSkillNamespace::grantExperiencePointsByString(JNIEnv * if(name.empty()) { // throw java exception - JavaLibrary::throwInternalScriptError("JavaLibrary::grantExperiencePoints() was passed an EMPTY or NULL experience name. This is probably not what the script intends to do, and the database cannot save unnamed XP. Change your script to ensure that it is calling grantExperiencePoints with the intended parameters."); + JavaLibrary::throwInternalScriptError("JavaLibrary::grantExperiencePoints() was passed an EMPTY or nullptr experience name. This is probably not what the script intends to do, and the database cannot save unnamed XP. Change your script to ensure that it is calling grantExperiencePoints with the intended parameters."); } else { @@ -675,7 +675,7 @@ jint JNICALL ScriptMethodsSkillNamespace::grantExperiencePointsByString(JNIEnv * WARNING(true, ("JavaLibrary::grantExperiencePointsByString called " "with target id = 0")); } - else if (targetId.getObject() == NULL) + else if (targetId.getObject() == nullptr) { if (NameManager::getInstance().getPlayerName(targetId).empty()) { @@ -683,7 +683,7 @@ jint JNICALL ScriptMethodsSkillNamespace::grantExperiencePointsByString(JNIEnv * "with target id = %s, who is not in the player name map", targetId.getValueString().c_str())); } -// else if (ServerUniverse::getInstance().getXpManager() != NULL) +// else if (ServerUniverse::getInstance().getXpManager() != nullptr) // { // ServerUniverse::getInstance().getXpManager()->grantXp(targetId, // name, amount); @@ -701,7 +701,7 @@ jint JNICALL ScriptMethodsSkillNamespace::grantExperiencePointsByString(JNIEnv * else { CreatureObject * creature = dynamic_cast(targetId.getObject()); - if (creature != NULL) + if (creature != nullptr) { result = creature->grantExperiencePoints(name, static_cast(amount)); } @@ -741,7 +741,7 @@ jint JNICALL ScriptMethodsSkillNamespace::grantExperiencePointsByInt(JNIEnv *env jint result = INT_MIN; CachedNetworkId targetId(target); - if (targetId.getObject() == NULL) + if (targetId.getObject() == nullptr) { if (targetId == CachedNetworkId::cms_cachedInvalid) { @@ -754,7 +754,7 @@ jint JNICALL ScriptMethodsSkillNamespace::grantExperiencePointsByInt(JNIEnv *env "with target id = %s, who is not in the player name map", targetId.getValueString().c_str())); } -// else if (ServerUniverse::getInstance().getXpManager() != NULL) +// else if (ServerUniverse::getInstance().getXpManager() != nullptr) // { // ServerUniverse::getInstance().getXpManager()->grantXp(targetId, // experienceTypeString, amount); @@ -772,7 +772,7 @@ jint JNICALL ScriptMethodsSkillNamespace::grantExperiencePointsByInt(JNIEnv *env else { CreatureObject * creature = dynamic_cast(targetId.getObject()); - if (creature != NULL) + if (creature != nullptr) { result = creature->grantExperiencePoints(experienceTypeString, static_cast(amount)); } @@ -977,7 +977,7 @@ jboolean JNICALL ScriptMethodsSkillNamespace::grantSchematicGroup(JNIEnv *env, j JavaStringParam groupNameParam(groupName); - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -1010,7 +1010,7 @@ jboolean JNICALL ScriptMethodsSkillNamespace::revokeSchematicGroup(JNIEnv *env, JavaStringParam groupNameParam(groupName); - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -1067,7 +1067,7 @@ jboolean JNICALL ScriptMethodsSkillNamespace::grantSchematicCrc(JNIEnv *env, job { UNREF(self); - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -1120,7 +1120,7 @@ jboolean JNICALL ScriptMethodsSkillNamespace::revokeSchematicCrc(JNIEnv *env, jo { UNREF(self); - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -1173,7 +1173,7 @@ jboolean JNICALL ScriptMethodsSkillNamespace::hasSchematicCrc(JNIEnv *env, jobje { UNREF(self); - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -1191,11 +1191,11 @@ jboolean JNICALL ScriptMethodsSkillNamespace::hasSchematicCrc(JNIEnv *env, jobje * @param self class calling this function * @param player the player * - * @return the skill mod names the player has, or null on error + * @return the skill mod names the player has, or nullptr on error */ jobjectArray JNICALL ScriptMethodsSkillNamespace::getSkillStatModListingForPlayer(JNIEnv *env, jobject self, jlong player) { - const CreatureObject * creature = NULL; + const CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(player, creature)) return 0; @@ -1221,11 +1221,11 @@ jobjectArray JNICALL ScriptMethodsSkillNamespace::getSkillStatModListingForPlaye * @param self class calling this function * @param player the player * - * @return the commands the player has, or null on error + * @return the commands the player has, or nullptr on error */ jobjectArray JNICALL ScriptMethodsSkillNamespace::getCommandListingForPlayer(JNIEnv *env, jobject self, jlong player) { - const CreatureObject * creature = NULL; + const CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(player, creature)) return 0; @@ -1261,7 +1261,7 @@ jintArray JNICALL ScriptMethodsSkillNamespace::getSkillSchematicsGranted(JNIEnv return 0; const SkillObject * skill = SkillManager::getInstance().getSkill(name); - if (skill == NULL) + if (skill == nullptr) return 0; // get all the granted schematics from the skill groups for the skill @@ -1304,11 +1304,11 @@ jintArray JNICALL ScriptMethodsSkillNamespace::getSkillSchematicsGranted(JNIEnv * @param self class calling this function * @param player the player * - * @return the schematics' crc, or null on error + * @return the schematics' crc, or nullptr on error */ jintArray JNICALL ScriptMethodsSkillNamespace::getSchematicListingForPlayer(JNIEnv *env, jobject self, jlong player) { - const CreatureObject * creature = NULL; + const CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(player, creature)) return 0; @@ -1335,7 +1335,7 @@ jintArray JNICALL ScriptMethodsSkillNamespace::getSchematicListingForPlayer(JNIE jboolean JNICALL ScriptMethodsSkillNamespace::hasCertificationsForItem(JNIEnv *env, jobject self, jlong player, jlong item) { - const CreatureObject * creatureObject = NULL; + const CreatureObject * creatureObject = nullptr; if (!JavaLibrary::getObject(player, creatureObject) || !creatureObject) return JNI_FALSE; @@ -1349,7 +1349,7 @@ jboolean JNICALL ScriptMethodsSkillNamespace::hasCertificationsForItem(JNIEnv *e } } - const TangibleObject * itemObject = NULL; + const TangibleObject * itemObject = nullptr; if (!JavaLibrary::getObject(item, itemObject) || !itemObject) return JNI_FALSE; @@ -1360,11 +1360,11 @@ jboolean JNICALL ScriptMethodsSkillNamespace::hasCertificationsForItem(JNIEnv *e jobjectArray JNICALL ScriptMethodsSkillNamespace::getRequiredCertifications(JNIEnv *env, jobject self, jlong item) { - const TangibleObject * itemAsTangible = NULL; + const TangibleObject * itemAsTangible = nullptr; if (!JavaLibrary::getObject(item, itemAsTangible) || !itemAsTangible) { JAVA_THROW_SCRIPT_EXCEPTION(true,("getRequiredCertifications called with an object that does not exist")); - return NULL; + return nullptr; } std::vector certs; @@ -1372,7 +1372,7 @@ jobjectArray JNICALL ScriptMethodsSkillNamespace::getRequiredCertifications(JNIE LocalObjectArrayRefPtr results; if (!ScriptConversion::convert(certs, results)) - return NULL; + return nullptr; return results->getReturnValue(); } @@ -1381,7 +1381,7 @@ jobjectArray JNICALL ScriptMethodsSkillNamespace::getRequiredCertifications(JNIE jstring JNICALL ScriptMethodsSkillNamespace::getSkillTemplate(JNIEnv *env, jobject self, jlong player) { - CreatureObject const * creature = NULL; + CreatureObject const * creature = nullptr; if (JavaLibrary::getObject(player, creature)) { @@ -1393,14 +1393,14 @@ jstring JNICALL ScriptMethodsSkillNamespace::getSkillTemplate(JNIEnv *env, jobje } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- void JNICALL ScriptMethodsSkillNamespace::setSkillTemplate(JNIEnv *env, jobject self, jlong player, jstring skillTemplateName) { - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (JavaLibrary::getObject(player, creature)) { @@ -1422,7 +1422,7 @@ void JNICALL ScriptMethodsSkillNamespace::setSkillTemplate(JNIEnv *env, jobject jstring JNICALL ScriptMethodsSkillNamespace::getWorkingSkill(JNIEnv *env, jobject self, jlong player) { - CreatureObject const * creature = NULL; + CreatureObject const * creature = nullptr; if (JavaLibrary::getObject(player, creature)) { @@ -1435,14 +1435,14 @@ jstring JNICALL ScriptMethodsSkillNamespace::getWorkingSkill(JNIEnv *env, jobjec } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- void JNICALL ScriptMethodsSkillNamespace::setWorkingSkill(JNIEnv *env, jobject self, jlong player, jstring workingSkillName) { - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (JavaLibrary::getObject(player, creature)) { @@ -1464,7 +1464,7 @@ void JNICALL ScriptMethodsSkillNamespace::setWorkingSkill(JNIEnv *env, jobject s void JNICALL ScriptMethodsSkillNamespace::recomputeCommandSeries(JNIEnv *env, jobject self, jlong player) { - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (JavaLibrary::getObject(player, creature)) { @@ -1476,7 +1476,7 @@ void JNICALL ScriptMethodsSkillNamespace::recomputeCommandSeries(JNIEnv *env, jo void JNICALL ScriptMethodsSkillNamespace::resetExpertises(JNIEnv *env, jobject self, jlong player) { - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (JavaLibrary::getObject(player, creature)) { diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsString.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsString.cpp index 344f0207..cb7135e7 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsString.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsString.cpp @@ -56,7 +56,7 @@ const JNINativeMethod NATIVES[] = { * @param self class calling this function * @param id the stringId to find * - * @return the string, or null on error + * @return the string, or nullptr on error */ jstring JNICALL ScriptMethodsStringNamespace::getString(JNIEnv *env, jobject self, jobject id) { @@ -64,7 +64,7 @@ jstring JNICALL ScriptMethodsStringNamespace::getString(JNIEnv *env, jobject sel if (id == 0) { - WARNING(true, ("JavaLibrary::log getString is NULL.")); + WARNING(true, ("JavaLibrary::log getString is nullptr.")); return 0; } @@ -116,7 +116,7 @@ jstring JNICALL ScriptMethodsStringNamespace::getString(JNIEnv *env, jobject sel * @param self class calling this function * @param ids array of stringIds to find * - * @return an array of strings, or null on error + * @return an array of strings, or nullptr on error */ jobjectArray JNICALL ScriptMethodsStringNamespace::getStrings(JNIEnv *env, jobject self, jobjectArray ids) { diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsSystem.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsSystem.cpp index 90861085..7dda71ba 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsSystem.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsSystem.cpp @@ -61,7 +61,7 @@ jboolean JNICALL ScriptMethodsSystemNamespace::sendConsoleCommand(JNIEnv * env, { JavaStringParam localCommand(command); - ServerObject* object = NULL; + ServerObject* object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -86,7 +86,7 @@ jboolean JNICALL ScriptMethodsSystemNamespace::sendConsoleCommand(JNIEnv * env, * @param section the config file section * @param key the config file key * - * @return the key value, or null if the key doesn't exist + * @return the key value, or nullptr if the key doesn't exist */ jstring JNICALL ScriptMethodsSystemNamespace::getConfigSetting(JNIEnv * env, jobject self, jstring section, jstring key) @@ -108,12 +108,12 @@ jstring JNICALL ScriptMethodsSystemNamespace::getConfigSetting(JNIEnv * env, job return 0; const ConfigFile::Section * sec = ConfigFile::getSection(sectionName.c_str()); - if (sec == NULL) + if (sec == nullptr) return 0; const ConfigFile::Key * ky = sec->findKey(keyName.c_str()); - if (ky == NULL) - return NULL; + if (ky == nullptr) + return nullptr; JavaString jvalue(ky->getAsString(ky->getCount()-1, "")); return jvalue.getReturnValue(); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsTerrain.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsTerrain.cpp index c56803c1..fabb32f6 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsTerrain.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsTerrain.cpp @@ -165,16 +165,16 @@ jobject JNICALL ScriptMethodsTerrainNamespace::getGoodLocation(JNIEnv * /*env*/, PROFILER_AUTO_BLOCK_DEFINE("JNI::getGoodLocation"); //validate scripter's input - if (searchRectLowerLeftLocation == NULL) + if (searchRectLowerLeftLocation == nullptr) { - DEBUG_WARNING (true, ("getGoodLocation (): DB lower left is NULL")); - return NULL; + DEBUG_WARNING (true, ("getGoodLocation (): DB lower left is nullptr")); + return nullptr; } - if (searchRectUpperRightLocation == NULL) + if (searchRectUpperRightLocation == nullptr) { - DEBUG_WARNING (true, ("getGoodLocation (): DB upper right is NULL")); - return NULL; + DEBUG_WARNING (true, ("getGoodLocation (): DB upper right is nullptr")); + return nullptr; } //pull the data from the java Location objects. sceneid and cell are not checked or used, but sent back in the good location, if one exists @@ -184,14 +184,14 @@ jobject JNICALL ScriptMethodsTerrainNamespace::getGoodLocation(JNIEnv * /*env*/, if (!ScriptConversion::convertWorld(searchRectLowerLeftLocation, srLLLocationVec, sceneId)) { DEBUG_WARNING (true, ("getGoodLocation (): DB could not convert lower left coordinates")); - return NULL; + return nullptr; } Vector srURLocationVec; if (!ScriptConversion::convertWorld(searchRectUpperRightLocation, srURLocationVec, sceneId)) { DEBUG_WARNING (true, ("getGoodLocation (): DB could not convert upper right coordinates")); - return NULL; + return nullptr; } // get the good location from ServerWorld @@ -199,7 +199,7 @@ jobject JNICALL ScriptMethodsTerrainNamespace::getGoodLocation(JNIEnv * /*env*/, if (successLoc3d.x == 0 && successLoc3d.y == 0 && successLoc3d.z == 0) { // no good location available - return NULL; + return nullptr; } //convert it back into scripter lingo (a "location"), using the default scene and cell ids @@ -207,7 +207,7 @@ jobject JNICALL ScriptMethodsTerrainNamespace::getGoodLocation(JNIEnv * /*env*/, if (!ScriptConversion::convert(successLoc3d, sceneId, NetworkId(), goodLocation)) { DEBUG_WARNING (true, ("getGoodLocation (): PB could not convert result back to a location")); - return NULL; + return nullptr; } return goodLocation->getReturnValue(); @@ -218,16 +218,16 @@ jobject JNICALL ScriptMethodsTerrainNamespace::getGoodLocationAvoidCollidables(J PROFILER_AUTO_BLOCK_DEFINE("JNI::getGoodLocationAvoidCollidables"); //validate scripter's input - if (searchRectLowerLeftLocation == NULL) + if (searchRectLowerLeftLocation == nullptr) { - DEBUG_WARNING (true, ("getGoodLocationAvoidCollidables (): DB lower left is NULL")); - return NULL; + DEBUG_WARNING (true, ("getGoodLocationAvoidCollidables (): DB lower left is nullptr")); + return nullptr; } - if (searchRectUpperRightLocation == NULL) + if (searchRectUpperRightLocation == nullptr) { - DEBUG_WARNING (true, ("getGoodLocationAvoidCollidables (): DB upper right is NULL")); - return NULL; + DEBUG_WARNING (true, ("getGoodLocationAvoidCollidables (): DB upper right is nullptr")); + return nullptr; } //pull the data from the java Location objects. sceneid and cell are not checked or used, but sent back in the good location, if one exists @@ -237,14 +237,14 @@ jobject JNICALL ScriptMethodsTerrainNamespace::getGoodLocationAvoidCollidables(J if (!ScriptConversion::convertWorld(searchRectLowerLeftLocation, srLLLocationVec, sceneId)) { DEBUG_WARNING (true, ("getGoodLocationAvoidCollidables (): DB could not convert lower left coordinates")); - return NULL; + return nullptr; } Vector srURLocationVec; if (!ScriptConversion::convertWorld(searchRectUpperRightLocation, srURLocationVec, sceneId)) { DEBUG_WARNING (true, ("getGoodLocationAvoidCollidables (): DB could not convert upper right coordinates")); - return NULL; + return nullptr; } // get the good location from ServerWorld @@ -252,7 +252,7 @@ jobject JNICALL ScriptMethodsTerrainNamespace::getGoodLocationAvoidCollidables(J if (successLoc3d.x == 0 && successLoc3d.y == 0 && successLoc3d.z == 0) { // no good location available - return NULL; + return nullptr; } //convert it back into scripter lingo (a "location"), using the default scene and cell ids @@ -260,7 +260,7 @@ jobject JNICALL ScriptMethodsTerrainNamespace::getGoodLocationAvoidCollidables(J if (!ScriptConversion::convert(successLoc3d, sceneId, NetworkId(), goodLocation)) { DEBUG_WARNING (true, ("getGoodLocationAvoidCollidables (): PB could not convert result back to a location")); - return NULL; + return nullptr; } return goodLocation->getReturnValue(); @@ -587,7 +587,7 @@ jboolean JNICALL ScriptMethodsTerrainNamespace::setWeatherData (JNIEnv* env, job UNREF(self); PlanetObject * planet = ServerUniverse::getInstance().getCurrentPlanet(); - if (planet != NULL) + if (planet != nullptr) { planet->setWeather(index, windVelocityX, 0.f, windVelocityZ); return JNI_TRUE; @@ -603,9 +603,9 @@ jboolean JNICALL ScriptMethodsTerrainNamespace::setWeatherData (JNIEnv* env, job jboolean JNICALL ScriptMethodsTerrainNamespace::isBelowWater (JNIEnv* /*env*/, jobject /*self*/, jobject location) { - if (location == NULL) + if (location == nullptr) { - DEBUG_WARNING(true, ("[designer bug] isBelowWater script hook was passed a NULL location reference")); + DEBUG_WARNING(true, ("[designer bug] isBelowWater script hook was passed a nullptr location reference")); return JNI_FALSE; } @@ -621,7 +621,7 @@ jboolean JNICALL ScriptMethodsTerrainNamespace::isBelowWater (JNIEnv* /*env*/, j const CellProperty* worldCell = CellProperty::getWorldCellProperty(); if(!worldCell) { - DEBUG_WARNING(true, ("isBelowWater got a NULL worldCell back from CellProperty::getWorldCellProperty()")); + DEBUG_WARNING(true, ("isBelowWater got a nullptr worldCell back from CellProperty::getWorldCellProperty()")); return JNI_FALSE; } const NetworkId& worldCellId = worldCell->getOwner().getNetworkId(); @@ -758,9 +758,9 @@ jfloat JNICALL ScriptMethodsTerrainNamespace::getWaterTableHeight (JNIEnv* /*env { float zero = 0.0f; - if (location == NULL) + if (location == nullptr) { - DEBUG_WARNING(true, ("[designer bug] getWaterTableHeight script hook was passed a NULL location reference")); + DEBUG_WARNING(true, ("[designer bug] getWaterTableHeight script hook was passed a nullptr location reference")); return zero; } @@ -776,7 +776,7 @@ jfloat JNICALL ScriptMethodsTerrainNamespace::getWaterTableHeight (JNIEnv* /*env const CellProperty* worldCell = CellProperty::getWorldCellProperty(); if(!worldCell) { - DEBUG_WARNING(true, ("getWaterTableHeight got a NULL worldCell back from CellProperty::getWorldCellProperty()")); + DEBUG_WARNING(true, ("getWaterTableHeight got a nullptr worldCell back from CellProperty::getWorldCellProperty()")); return zero; } const NetworkId& worldCellId = worldCell->getOwner().getNetworkId(); @@ -862,7 +862,7 @@ jboolean JNICALL ScriptMethodsTerrainNamespace::requestLocation (JNIEnv * /*env* jboolean JNICALL ScriptMethodsTerrainNamespace::isOnAFloor (JNIEnv * env, jobject self, jlong scriptObject) { //-- make sure we have a valid object - ServerObject * theObject = NULL; + ServerObject * theObject = nullptr; if (!JavaLibrary::getObject (scriptObject, theObject)) { DEBUG_WARNING (true, ("isOnAFloor (): could not find scriptObject")); @@ -876,7 +876,7 @@ jboolean JNICALL ScriptMethodsTerrainNamespace::isOnAFloor (JNIEnv * env, jobjec return JNI_FALSE; } - if(objectCollisionProp->getStandingOn() != NULL) + if(objectCollisionProp->getStandingOn() != nullptr) return JNI_TRUE; else return JNI_FALSE; @@ -890,7 +890,7 @@ jboolean JNICALL ScriptMethodsTerrainNamespace::isRelativePointOnSameFloorAsObje return JNI_FALSE; //-- make sure we have a valid object - ServerObject * theObject = NULL; + ServerObject * theObject = nullptr; if (!JavaLibrary::getObject (scriptObject, theObject)) { DEBUG_WARNING (true, ("isRelativePointOnSameFloorAsObject (): could not find scriptObject")); @@ -938,7 +938,7 @@ jfloat JNICALL ScriptMethodsTerrainNamespace::getFloorHeightAtRelativePointOnS return JNI_FALSE; //-- make sure we have a valid object - ServerObject * theObject = NULL; + ServerObject * theObject = nullptr; if (!JavaLibrary::getObject (scriptObject, theObject)) { DEBUG_WARNING (true, ("getFloorHeightAtRelativePointOnSameFloorAsObject (): could not find scriptObject")); @@ -1106,7 +1106,7 @@ jboolean JNICALL ScriptMethodsTerrainNamespace::createClientPathAdvanced(JNIEnv */ jboolean JNICALL ScriptMethodsTerrainNamespace::setCreatureCoverDefault(JNIEnv *env, jobject self, jlong target) { - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -1137,7 +1137,7 @@ jboolean JNICALL ScriptMethodsTerrainNamespace::setCreatureCover(JNIEnv *env, jo { UNREF(self); - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -1149,7 +1149,7 @@ jboolean JNICALL ScriptMethodsTerrainNamespace::setCreatureCover(JNIEnv *env, jo void JNICALL ScriptMethodsTerrainNamespace::setCreatureCoverVisibility(JNIEnv * env, jobject self, jlong target, jboolean isVisible) { - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if(!JavaLibrary::getObject(target, creature)) return; @@ -1160,7 +1160,7 @@ void JNICALL ScriptMethodsTerrainNamespace::setCreatureCoverVisibility(JNIEnv * jboolean JNICALL ScriptMethodsTerrainNamespace::getCreatureCoverVisibility(JNIEnv * env, jobject self, jlong target) { - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if(!JavaLibrary::getObject(target, creature)) return JNI_FALSE; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsVeteran.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsVeteran.cpp index d751acee..ed5f2322 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsVeteran.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsVeteran.cpp @@ -81,7 +81,7 @@ const JNINativeMethod NATIVES[] = { jobjectArray JNICALL ScriptMethodsVeteranNamespace::veteranGetTriggeredEvents(JNIEnv * /*env*/, jobject /*self*/, jlong player) { ServerObject const * const so = safe_cast(NetworkIdManager::getObjectById(NetworkId(player))); - CreatureObject const * const playerCreature = so ? so->asCreatureObject() : NULL; + CreatureObject const * const playerCreature = so ? so->asCreatureObject() : nullptr; if (playerCreature) { @@ -89,7 +89,7 @@ jobjectArray JNICALL ScriptMethodsVeteranNamespace::veteranGetTriggeredEvents(JN VeteranRewardManager::getTriggeredEventsIds(*playerCreature, eventsIds); if (eventsIds.empty()) - return NULL; + return nullptr; int i = 0; LocalObjectArrayRefPtr valueArray = createNewObjectArray(eventsIds.size(), JavaLibrary::getClsString()); @@ -102,7 +102,7 @@ jobjectArray JNICALL ScriptMethodsVeteranNamespace::veteranGetTriggeredEvents(JN return valueArray->getReturnValue(); } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -110,7 +110,7 @@ jobjectArray JNICALL ScriptMethodsVeteranNamespace::veteranGetTriggeredEvents(JN jboolean JNICALL ScriptMethodsVeteranNamespace::veteranAccountFeatureIdRequest(JNIEnv * /*env*/, jobject /*self*/, jlong player) { ServerObject * const so = safe_cast(NetworkIdManager::getObjectById(NetworkId(player))); - CreatureObject * const playerCreature = so ? so->asCreatureObject() : NULL; + CreatureObject * const playerCreature = so ? so->asCreatureObject() : nullptr; if (playerCreature) { @@ -131,7 +131,7 @@ jboolean JNICALL ScriptMethodsVeteranNamespace::veteranAccountFeatureIdRequest(J jobjectArray JNICALL ScriptMethodsVeteranNamespace::veteranGetRewardChoicesDescriptions(JNIEnv * /*env*/, jobject /*self*/, jlong player, jstring event) { ServerObject const * const so = safe_cast(NetworkIdManager::getObjectById(NetworkId(player))); - CreatureObject const * const playerCreature = so ? so->asCreatureObject() : NULL; + CreatureObject const * const playerCreature = so ? so->asCreatureObject() : nullptr; if (playerCreature) { @@ -152,7 +152,7 @@ jobjectArray JNICALL ScriptMethodsVeteranNamespace::veteranGetRewardChoicesDescr } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -160,7 +160,7 @@ jobjectArray JNICALL ScriptMethodsVeteranNamespace::veteranGetRewardChoicesDescr jobjectArray JNICALL ScriptMethodsVeteranNamespace::veteranGetRewardChoicesTags(JNIEnv * /*env*/, jobject /*self*/, jlong player, jstring event) { ServerObject const * const so = safe_cast(NetworkIdManager::getObjectById(NetworkId(player))); - CreatureObject const * const playerCreature = so ? so->asCreatureObject() : NULL; + CreatureObject const * const playerCreature = so ? so->asCreatureObject() : nullptr; if (playerCreature) { @@ -181,7 +181,7 @@ jobjectArray JNICALL ScriptMethodsVeteranNamespace::veteranGetRewardChoicesTags( } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -189,7 +189,7 @@ jobjectArray JNICALL ScriptMethodsVeteranNamespace::veteranGetRewardChoicesTags( jboolean JNICALL ScriptMethodsVeteranNamespace::veteranClaimReward(JNIEnv * /*env*/, jobject /*self*/, jlong player, jstring event, jstring rewardTag) { ServerObject const * const so = safe_cast(NetworkIdManager::getObjectById(NetworkId(player))); - CreatureObject const * const playerCreature = so ? so->asCreatureObject() : NULL; + CreatureObject const * const playerCreature = so ? so->asCreatureObject() : nullptr; if (playerCreature) { @@ -227,7 +227,7 @@ jstring JNICALL ScriptMethodsVeteranNamespace::veteranGetEventAnnouncement(JNIEn return eventAnnouncement.getReturnValue(); } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -245,7 +245,7 @@ jstring JNICALL ScriptMethodsVeteranNamespace::veteranGetEventDescription(JNIEnv return eventDescription.getReturnValue(); } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -263,7 +263,7 @@ jstring JNICALL ScriptMethodsVeteranNamespace::veteranGetEventUrl(JNIEnv * /*env return temp2.getReturnValue(); } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -313,7 +313,7 @@ jboolean JNICALL ScriptMethodsVeteranNamespace::veteranIsItemAccountUniqueFeatur void JNICALL ScriptMethodsVeteranNamespace::veteranWriteAccountDataToObjvars(JNIEnv * /*env*/, jobject /*self*/, jlong player) { ServerObject * const so = safe_cast(NetworkIdManager::getObjectById(NetworkId(player))); - CreatureObject * const playerCreature = so ? so->asCreatureObject() : NULL; + CreatureObject * const playerCreature = so ? so->asCreatureObject() : nullptr; if (playerCreature) VeteranRewardManager::writeAccountDataToObjvars(*playerCreature); @@ -323,11 +323,11 @@ void JNICALL ScriptMethodsVeteranNamespace::veteranWriteAccountDataToObjvars(JNI jboolean JNICALL ScriptMethodsVeteranNamespace::veteranCanTradeInReward(JNIEnv *env, jobject self, jlong player, jlong item) { - CreatureObject const * playerCreature = NULL; + CreatureObject const * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature) || !playerCreature) return JNI_FALSE; - ServerObject * itemObject = NULL; + ServerObject * itemObject = nullptr; if (!JavaLibrary::getObject(item, itemObject) || !itemObject) return JNI_FALSE; @@ -339,11 +339,11 @@ jboolean JNICALL ScriptMethodsVeteranNamespace::veteranCanTradeInReward(JNIEnv * void JNICALL ScriptMethodsVeteranNamespace::veteranTradeInReward(JNIEnv *env, jobject self, jlong player, jlong item) { - CreatureObject const * playerCreature = NULL; + CreatureObject const * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature) || !playerCreature) return; - ServerObject * itemObject = NULL; + ServerObject * itemObject = nullptr; if (!JavaLibrary::getObject(item, itemObject) || !itemObject) return; @@ -355,11 +355,11 @@ void JNICALL ScriptMethodsVeteranNamespace::veteranTradeInReward(JNIEnv *env, jo void JNICALL ScriptMethodsVeteranNamespace::adjustSwgTcgAccountFeatureId(JNIEnv *env, jobject self, jlong player, jlong item, jint featureId, jint adjustment) { - CreatureObject const * playerCreature = NULL; + CreatureObject const * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature) || !playerCreature) return; - ServerObject * itemObject = NULL; + ServerObject * itemObject = nullptr; if (!JavaLibrary::getObject(item, itemObject) || !itemObject) return; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsWaypoint.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsWaypoint.cpp index e9b3c546..18241735 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsWaypoint.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsWaypoint.cpp @@ -306,7 +306,7 @@ jobject JNICALL ScriptMethodsWaypointNamespace::getWaypointRegion(JNIEnv * env, if(w.isValid()) { const Region * region = RegionMaster::getSmallestVisibleRegionAtPoint(w.getLocation().getSceneId(), w.getLocation().getCoordinates().x, w.getLocation().getCoordinates().z); - if (region != NULL) + if (region != nullptr) { LocalRefPtr result; if (ScriptConversion::convert(*region, result)) diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsWorldInfo.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsWorldInfo.cpp index 3cc7c024..ca3d5b8d 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsWorldInfo.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsWorldInfo.cpp @@ -182,7 +182,7 @@ const JNINativeMethod NATIVES[] = { * @param location location that is the center of the search area * @param range radius of search area * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getObjectsInRangeLocation(JNIEnv *env, jobject self, jobject location, jfloat range) { @@ -212,7 +212,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getObjectsInRangeLocation(JN * @param location object that is the center of the search area * @param range radius of search area * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getObjectsInRangeObject(JNIEnv *env, jobject self, jlong object, jfloat range) { @@ -242,7 +242,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getObjectsInRangeObject(JNIE * @param location location that is the center of the search area * @param range radius of search area * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesInRangeLocation(JNIEnv *env, jobject self, jobject location, jfloat range) { @@ -271,7 +271,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesInRangeLocation( * @param location object that is the center of the search area * @param range radius of search area * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesInRangeObject(JNIEnv *env, jobject self, jlong object, jfloat range) { @@ -302,7 +302,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesInRangeObject(JN * @param type * @param mask * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfNicheInRangeLocation(JNIEnv *env, jobject self, jobject location, jfloat range, jint type, jint mask) { @@ -333,7 +333,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfNicheInRangeLo * @param type * @param mask * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfNicheInRangeObject(JNIEnv *env, jobject self, jlong object, jfloat range, jint type, jint mask) { @@ -363,7 +363,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfNicheInRangeOb * @param range radius of search area * @param species * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfSpeciesInRangeLocation(JNIEnv *env, jobject self, jobject location, jfloat range, jint species) { @@ -393,7 +393,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfSpeciesInRange * @param range radius of search area * @param species * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfSpeciesInRangeObject(JNIEnv *env, jobject self, jlong object, jfloat range, jint species) { @@ -424,7 +424,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfSpeciesInRange * @param species * @param race * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfRaceInRangeLocation(JNIEnv *env, jobject self, jobject location, jfloat range, jint species, jint race) { @@ -455,7 +455,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfRaceInRangeLoc * @param species * @param race * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfRaceInRangeObject(JNIEnv *env, jobject self, jlong object, jfloat range, jint species, jint race) { @@ -484,7 +484,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfRaceInRangeObj * @param location location that is the center of the search area * @param range radius of search area * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getNonCreaturesInRangeLocation(JNIEnv *env, jobject self, jobject location, jfloat range) { @@ -513,7 +513,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getNonCreaturesInRangeLocati * @param location object that is the center of the search area * @param range radius of search area * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getNonCreaturesInRangeObject(JNIEnv *env, jobject self, jlong object, jfloat range) { @@ -542,7 +542,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getNonCreaturesInRangeObject * @param location location that is the center of the search area * @param range radius of search area * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getNPCsInRangeLocation(JNIEnv *env, jobject self, jobject location, jfloat range) { @@ -571,7 +571,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getNPCsInRangeLocation(JNIEn * @param location object that is the center of the search area * @param range radius of search area * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getNPCsInRangeObject(JNIEnv *env, jobject self, jlong object, jfloat range) { @@ -600,7 +600,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getNPCsInRangeObject(JNIEnv * @param location location that is the center of the search area * @param range radius of search area * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getPlayerCreaturesInRangeLocation(JNIEnv *env, jobject self, jobject location, jfloat range) { @@ -629,7 +629,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getPlayerCreaturesInRangeLoc * @param location object that is the center of the search area * @param range radius of search area * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getPlayerCreaturesInRangeObject(JNIEnv *env, jobject self, jlong object, jfloat range) { @@ -658,7 +658,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getPlayerCreaturesInRangeObj * @param env Java environment * @param self class calling this function * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getObjectsInCone(JNIEnv *env, jobject self, jlong coneCenterObjectId, jlong coneDirectionObjectId, jfloat range, jfloat angle) { @@ -698,7 +698,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getObjectsInCone(JNIEnv *env * @param env Java environment * @param self class calling this function * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getObjectsInConeLocation(JNIEnv *env, jobject self, jlong coneCenterObjectId, jobject coneDirectionLocation, jfloat range, jfloat angle) { @@ -738,7 +738,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getObjectsInConeLocation(JNI * @param env Java environment * @param self class calling this function * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesInCone(JNIEnv *env, jobject self, jlong coneCenterObjectId, jlong coneDirectionObjectId, jfloat range, jfloat angle) { @@ -779,7 +779,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesInCone(JNIEnv *e * @param env Java environment * @param self class calling this function * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesInConeLocation(JNIEnv *env, jobject self, jlong coneCenterObjectId, jobject coneDirectionLocation, jfloat range, jfloat angle) { @@ -820,7 +820,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesInConeLocation(J * @param env Java environment * @param self class calling this function * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfNicheInCone(JNIEnv *env, jobject self, jlong coneCenterObjectId, jlong coneDirectionObjectId, jfloat range, jfloat angle, jint niche, jint mask) { @@ -860,7 +860,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfNicheInCone(JN * @param env Java environment * @param self class calling this function * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfSpeciesInCone(JNIEnv *env, jobject self, jlong coneCenterObjectId, jlong coneDirectionObjectId, jfloat range, jfloat angle, jint species) { @@ -900,7 +900,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfSpeciesInCone( * @param env Java environment * @param self class calling this function * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfRaceInCone(JNIEnv *env, jobject self, jlong coneCenterObjectId, jlong coneDirectionObjectId, jfloat range, jfloat angle, jint species, jint race) { @@ -940,7 +940,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfRaceInCone(JNI * @param env Java environment * @param self class calling this function * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getNonCreaturesInCone(JNIEnv *env, jobject self, jlong coneCenterObjectId, jlong coneDirectionObjectId, jfloat range, jfloat angle) { @@ -980,7 +980,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getNonCreaturesInCone(JNIEnv * @param env Java environment * @param self class calling this function * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getNPCsInCone(JNIEnv *env, jobject self, jlong coneCenterObjectId, jlong coneDirectionObjectId, jfloat range, jfloat angle) { @@ -1020,7 +1020,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getNPCsInCone(JNIEnv *env, j * @param env Java environment * @param self class calling this function * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getPlayerCreaturesInCone(JNIEnv *env, jobject self, jlong coneCenterObjectId, jlong coneDirectionObjectId, jfloat range, jfloat angle) { @@ -1169,7 +1169,7 @@ jlong JNICALL ScriptMethodsWorldInfoNamespace::getClosestMobile(JNIEnv *env, job return 0; ServerObject * npc = ServerWorld::findClosestNPC(target, radius); - if (npc == NULL) + if (npc == nullptr) return 0; return (npc->getNetworkId()).getValue(); } @@ -1184,7 +1184,7 @@ jlong JNICALL ScriptMethodsWorldInfoNamespace::getClosestPlayer(JNIEnv *env, job return 0; ServerObject * player = ServerWorld::findClosestPlayer(target, radius); - if (player == NULL) + if (player == nullptr) return 0; return (player->getNetworkId()).getValue(); } @@ -1209,7 +1209,7 @@ jlong JNICALL ScriptMethodsWorldInfoNamespace::getFirstObjectWithScript(JNIEnv * for (ResultsType::iterator i=results.begin(); i!=results.end(); ++i) { - if (*i != NULL && (*i)->getScriptObject()->hasScript(scriptName)) + if (*i != nullptr && (*i)->getScriptObject()->hasScript(scriptName)) return ((*i)->getNetworkId()).getValue(); } @@ -1237,7 +1237,7 @@ jlong JNICALL ScriptMethodsWorldInfoNamespace::getFirstObjectWithObjVar(JNIEnv * for (ResultsType::iterator i=results.begin(); i!=results.end(); ++i) { - if (*i != NULL && (*i)->getObjVars().hasItem(objvarName)) + if (*i != nullptr && (*i)->getObjVars().hasItem(objvarName)) return ((*i)->getNetworkId()).getValue(); } @@ -1265,7 +1265,7 @@ jlong JNICALL ScriptMethodsWorldInfoNamespace::getFirstObjectWithTemplate(JNIEnv for (ResultsType::iterator i=results.begin(); i!=results.end(); ++i) { - if (*i != NULL && templateStr == (*i)->getTemplateName()) + if (*i != nullptr && templateStr == (*i)->getTemplateName()) return ((*i)->getNetworkId()).getValue(); } @@ -1434,7 +1434,7 @@ jstring JNICALL ScriptMethodsWorldInfoNamespace::getNameForPlanetObject(JNIEnv * } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -1499,7 +1499,7 @@ jobject JNICALL ScriptMethodsWorldInfoNamespace::getValidLocation(JNIEnv *env, j // Determine if it's a valid point, and if not search for another one. - bool isValid = !CollisionWorld::query( Sphere(corralPoint,objectRadius),NULL); + bool isValid = !CollisionWorld::query( Sphere(corralPoint,objectRadius),nullptr); // ---------- @@ -1517,14 +1517,14 @@ jobject JNICALL ScriptMethodsWorldInfoNamespace::getValidLocation(JNIEnv *env, j // We failed to find a valid location - return NULL; + return nullptr; } // ---------------------------------------------------------------------- jboolean JNICALL ScriptMethodsWorldInfoNamespace::getCollidesWithObject(JNIEnv * env, jobject self, jobject jlocation, jfloat jradius) { - if (jlocation == NULL) + if (jlocation == nullptr) return JNI_FALSE; float const radius = jradius; @@ -1532,7 +1532,7 @@ jboolean JNICALL ScriptMethodsWorldInfoNamespace::getCollidesWithObject(JNIEnv * if (!ScriptConversion::convertWorld(jlocation, location)) return JNI_FALSE; - bool const result = CollisionWorld::query(Sphere(location, radius), NULL); + bool const result = CollisionWorld::query(Sphere(location, radius), nullptr); if(result) return JNI_TRUE; @@ -1556,7 +1556,7 @@ jboolean JNICALL ScriptMethodsWorldInfoNamespace::canSee(JNIEnv *env, jobject se { UNREF(self); - const ServerObject * sourceObject = NULL; + const ServerObject * sourceObject = nullptr; if (!JavaLibrary::getObject(source, sourceObject)) { NetworkId id(source); @@ -1572,7 +1572,7 @@ jboolean JNICALL ScriptMethodsWorldInfoNamespace::canSee(JNIEnv *env, jobject se return JNI_TRUE; } - const ServerObject * targetObject = NULL; + const ServerObject * targetObject = nullptr; if (!JavaLibrary::getObject(target, targetObject)) { NetworkId id(target); @@ -1608,7 +1608,7 @@ jboolean JNICALL ScriptMethodsWorldInfoNamespace::canSeeLocation(JNIEnv *env, jo { UNREF(self); - const ServerObject * sourceObject = NULL; + const ServerObject * sourceObject = nullptr; if (!JavaLibrary::getObject(source, sourceObject)) { NetworkId id(source); @@ -1640,11 +1640,11 @@ jboolean JNICALL ScriptMethodsWorldInfoNamespace::canManipulate(JNIEnv *env, job { UNREF(self); - const CreatureObject * sourceObject = NULL; + const CreatureObject * sourceObject = nullptr; if (!JavaLibrary::getObject(player, sourceObject)) return JNI_FALSE; - const ServerObject * targetObject = NULL; + const ServerObject * targetObject = nullptr; if (!JavaLibrary::getObject(target, targetObject)) return JNI_FALSE; @@ -1663,7 +1663,7 @@ jboolean JNICALL ScriptMethodsWorldInfoNamespace::canManipulate(JNIEnv *env, job * @param performer performer we are looking for listeners of * @param range radius of search area * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getPerformanceListenersInRange(JNIEnv *env, jobject self, jlong performer, jfloat range) { @@ -1697,7 +1697,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getPerformanceListenersInRan * @param performer performer we are looking for watchers of * @param range radius of search area * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getPerformanceWatchersInRange(JNIEnv *env, jobject self, jlong performer, jfloat range) { diff --git a/engine/server/library/serverScript/src/shared/ScriptParamArchive.cpp b/engine/server/library/serverScript/src/shared/ScriptParamArchive.cpp index 967939fb..46799842 100755 --- a/engine/server/library/serverScript/src/shared/ScriptParamArchive.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptParamArchive.cpp @@ -56,7 +56,7 @@ void put(ByteStream & target, const std::vector *> { const std::vector * inner = source[i]; signed int innerLength = 0; - if (inner != NULL) + if (inner != nullptr) innerLength = inner->size(); put(target, innerLength); for (int j = 0; j < innerLength; ++j) diff --git a/engine/server/library/serverScript/src/shared/ScriptParameters.cpp b/engine/server/library/serverScript/src/shared/ScriptParameters.cpp index 78c5fde4..3ea2df78 100755 --- a/engine/server/library/serverScript/src/shared/ScriptParameters.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptParameters.cpp @@ -207,7 +207,7 @@ void ScriptParams::addParam(bool param, const std::string & paramName, bool owne * This call occurs because of a conversion of a datatype passing through this function from std::string to Unicode::String. * Basically, most times it is called with std::string the c_str() function is called. Since this is still valid when the * type is changed to Unicode::String and the const Unicode::unicode_char_t * is successfully auto-converted to const char * - * you wind up having a NULL string when it get explicitly converted to const char * on the other side. So, this should never + * you wind up having a nullptr string when it get explicitly converted to const char * on the other side. So, this should never * be called except in error. * void ScriptParams::addParam(const Unicode::unicode_char_t * param, const std::string & paramName, bool owned) @@ -659,7 +659,7 @@ bool ScriptParams::changeParam(int index, const StringId & param, bool owned) if (p.m_type != Param::STRING_ID) return false; - if (p.m_param.sidParam == NULL) + if (p.m_param.sidParam == nullptr) return false; if (p.m_owned) diff --git a/engine/server/library/serverScript/src/shared/ScriptParameters.h b/engine/server/library/serverScript/src/shared/ScriptParameters.h index 98aa0870..ab7468f2 100755 --- a/engine/server/library/serverScript/src/shared/ScriptParameters.h +++ b/engine/server/library/serverScript/src/shared/ScriptParameters.h @@ -311,7 +311,7 @@ inline const stdvector::fwd & ScriptParams::getLocationArrayPara inline const NetworkId & ScriptParams::getObjIdParam(int index) const { - if (m_params[index].m_param.oidParam != NULL) + if (m_params[index].m_param.oidParam != nullptr) return *m_params[index].m_param.oidParam; return NetworkId::cms_invalid; } // ScriptParams::getObjIdParam diff --git a/engine/server/library/serverUtility/src/shared/AdminAccountManager.cpp b/engine/server/library/serverUtility/src/shared/AdminAccountManager.cpp index 85656cb2..e4075721 100755 --- a/engine/server/library/serverUtility/src/shared/AdminAccountManager.cpp +++ b/engine/server/library/serverUtility/src/shared/AdminAccountManager.cpp @@ -16,7 +16,7 @@ DataTable * AdminAccountManager::ms_adminTable = 0; bool AdminAccountManager::ms_installed = false; -std::string *AdminAccountManager::ms_dataTableName = NULL; +std::string *AdminAccountManager::ms_dataTableName = nullptr; //----------------------------------------------------------------------- @@ -42,7 +42,7 @@ void AdminAccountManager::remove() DataTableManager::close(*ms_dataTableName); ms_installed = false; delete ms_dataTableName; - ms_dataTableName = NULL; + ms_dataTableName = nullptr; } //----------------------------------------------------------------------- diff --git a/engine/server/library/serverUtility/src/shared/ChatLogManager.cpp b/engine/server/library/serverUtility/src/shared/ChatLogManager.cpp index 5f3cd77c..e5283c05 100755 --- a/engine/server/library/serverUtility/src/shared/ChatLogManager.cpp +++ b/engine/server/library/serverUtility/src/shared/ChatLogManager.cpp @@ -135,7 +135,7 @@ void ChatLogManagerNamespace::addChatLogEntry(Unicode::String const &fromPlayer, } else { - Unicode::String const *finalMessage = NULL; + Unicode::String const *finalMessage = nullptr; // Add the new string to the master message list, or if it already exists, just increase the reference count diff --git a/engine/server/library/serverUtility/src/shared/ClusterWideDataManagerList.cpp b/engine/server/library/serverUtility/src/shared/ClusterWideDataManagerList.cpp index 659f1c61..cfda04ff 100755 --- a/engine/server/library/serverUtility/src/shared/ClusterWideDataManagerList.cpp +++ b/engine/server/library/serverUtility/src/shared/ClusterWideDataManagerList.cpp @@ -36,7 +36,7 @@ namespace ClusterWideDataManagerListNamespace struct QueuedRequestInfo { - QueuedRequestInfo() : processId(0), requestTime(0.0), request(NULL), server(NULL) {}; + QueuedRequestInfo() : processId(0), requestTime(0.0), request(nullptr), server(nullptr) {}; unsigned long processId; float requestTime; @@ -272,7 +272,7 @@ void ClusterWideDataManagerList::onGameServerDisconnect(unsigned long const proc ClusterWideDataManagerListNamespace::ServerLockListConstRange range = ClusterWideDataManagerListNamespace::s_serverLockList.equal_range(processId); - ClusterWideDataManager * manager = NULL; + ClusterWideDataManager * manager = nullptr; for (ClusterWideDataManagerListNamespace::ServerLockList::const_iterator iter2 = range.first; iter2 != range.second; ++iter2) { manager = ClusterWideDataManagerListNamespace::getClusterWideDataManager((iter2->second).managerName, false); @@ -327,7 +327,7 @@ ClusterWideDataManager * ClusterWideDataManagerListNamespace::getClusterWideData return manager; } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverUtility/src/shared/FreeCtsDataTable.cpp b/engine/server/library/serverUtility/src/shared/FreeCtsDataTable.cpp index 3be9fe88..9f802549 100755 --- a/engine/server/library/serverUtility/src/shared/FreeCtsDataTable.cpp +++ b/engine/server/library/serverUtility/src/shared/FreeCtsDataTable.cpp @@ -205,7 +205,7 @@ void FreeCtsDataTableNamespace::loadData() tokensSourceClusterList.clear(); tokensTargetClusterList.clear(); - if (Unicode::tokenize(Unicode::narrowToWide(sourceClusterList), tokensSourceClusterList, &clusterListDelimiters, NULL) && (tokensSourceClusterList.size() > 0) && Unicode::tokenize(Unicode::narrowToWide(targetClusterList), tokensTargetClusterList, &clusterListDelimiters, NULL) && (tokensTargetClusterList.size() > 0)) + if (Unicode::tokenize(Unicode::narrowToWide(sourceClusterList), tokensSourceClusterList, &clusterListDelimiters, nullptr) && (tokensSourceClusterList.size() > 0) && Unicode::tokenize(Unicode::narrowToWide(targetClusterList), tokensTargetClusterList, &clusterListDelimiters, nullptr) && (tokensTargetClusterList.size() > 0)) { for (tokensIter = tokensTargetClusterList.begin(); tokensIter != tokensTargetClusterList.end(); ++tokensIter) freeCtsInfo.targetCluster[Unicode::wideToNarrow(Unicode::toLower(*tokensIter))] = Unicode::wideToNarrow(*tokensIter); @@ -258,9 +258,9 @@ void FreeCtsDataTableNamespace::loadData() time_t FreeCtsDataTableNamespace::convertToEpoch(int const year, int const month, int const day, int const hour, int const minute, int const second) { - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); struct tm * timeinfo = ::localtime(&timeNow); - FATAL(!timeinfo, ("::localtime() returns NULL")); + FATAL(!timeinfo, ("::localtime() returns nullptr")); // greater than zero if Daylight Saving Time is in effect, // zero if Daylight Saving Time is not in effect, @@ -288,7 +288,7 @@ time_t FreeCtsDataTableNamespace::convertToEpoch(int const year, int const month // "opposite" standard/daylight period than the current time, // and it should be OK timeinfo = ::localtime(&convertedTime); - FATAL(!timeinfo, ("::localtime() returns NULL")); + FATAL(!timeinfo, ("::localtime() returns nullptr")); if ((timeinfo->tm_year != (year - 1900)) || (timeinfo->tm_mon != (month - 1)) || @@ -342,9 +342,9 @@ FreeCtsDataTable::FreeCtsInfo const * FreeCtsDataTable::isFreeCtsSourceCluster(s loadData(); if (s_freeCtsList.empty()) - return NULL; + return nullptr; - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); std::pair::const_iterator, std::multimap::const_iterator> range = s_freeCtsList.equal_range(Unicode::toLower(sourceCluster)); for (std::multimap::const_iterator iter = range.first; iter != range.second; ++iter) { @@ -355,7 +355,7 @@ FreeCtsDataTable::FreeCtsInfo const * FreeCtsDataTable::isFreeCtsSourceCluster(s return &(iter->second); } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -366,15 +366,15 @@ FreeCtsDataTable::FreeCtsInfo const * FreeCtsDataTable::wouldCharacterTransferBe loadData(); if (s_freeCtsList.empty()) - return NULL; + return nullptr; if ((sourceCharacterCreateTime <= 0) && !ignoreTimeRestriction) - return NULL; + return nullptr; if (sourceStationId != targetStationId) - return NULL; + return nullptr; - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); std::string const lowerTargetCluster(Unicode::toLower(targetCluster)); std::pair::const_iterator, std::multimap::const_iterator> range = s_freeCtsList.equal_range(Unicode::toLower(sourceCluster)); @@ -396,7 +396,7 @@ FreeCtsDataTable::FreeCtsInfo const * FreeCtsDataTable::wouldCharacterTransferBe } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -407,12 +407,12 @@ FreeCtsDataTable::FreeCtsInfo const * FreeCtsDataTable::getFreeCtsInfoForCharact loadData(); if (s_freeCtsList.empty()) - return NULL; + return nullptr; if ((sourceCharacterCreateTime <= 0) && !ignoreTimeRestriction) - return NULL; + return nullptr; - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); std::pair::const_iterator, std::multimap::const_iterator> range = s_freeCtsList.equal_range(Unicode::toLower(sourceCluster)); for (std::multimap::const_iterator iter = range.first; iter != range.second; ++iter) { @@ -429,5 +429,5 @@ FreeCtsDataTable::FreeCtsInfo const * FreeCtsDataTable::getFreeCtsInfoForCharact return &(iter->second); } - return NULL; + return nullptr; } diff --git a/engine/shared/application/DataTableTool/src/shared/DataTableTool.cpp b/engine/shared/application/DataTableTool/src/shared/DataTableTool.cpp index 29d396da..c3dcaf32 100755 --- a/engine/shared/application/DataTableTool/src/shared/DataTableTool.cpp +++ b/engine/shared/application/DataTableTool/src/shared/DataTableTool.cpp @@ -245,7 +245,7 @@ void DataTableTool::createOutputDirectoryForFile(const std::string & fileName) std::string directoryName(fileName, 0, slashPos); #if defined(PLATFORM_WIN32) - int result = CreateDirectory(directoryName.c_str(), NULL); + int result = CreateDirectory(directoryName.c_str(), nullptr); #elif defined(PLATFORM_LINUX) // make sure slashes are forward { diff --git a/engine/shared/application/TemplateCompiler/src/shared/TemplateCompiler.cpp b/engine/shared/application/TemplateCompiler/src/shared/TemplateCompiler.cpp index 8611bb0b..2a3658bb 100755 --- a/engine/shared/application/TemplateCompiler/src/shared/TemplateCompiler.cpp +++ b/engine/shared/application/TemplateCompiler/src/shared/TemplateCompiler.cpp @@ -46,7 +46,7 @@ static const int SUBMIT_NO_FILE_ERR = 17; // need to add file before submitting // virtual ~MyPerforceUser() {} // virtual void HandleError( Error *err ) // { -// if (err != NULL && err->Test()) +// if (err != nullptr && err->Test()) // { // m_errorOccurred = true; // m_lastError = err->GetGeneric(); @@ -154,7 +154,7 @@ int generateTemplate(File &definitionFp, File &templateFp) // we now need to move down the template definition heiarchy and write the // parameters of the base class - Filename basename(NULL, definitionFp.getFilename().getPath().c_str(), + Filename basename(nullptr, definitionFp.getFilename().getPath().c_str(), TemplateDefinitionFile.getBaseFilename().c_str(), TEMPLATE_DEFINITION_EXTENSION); if (basename.getName().size() == 0) return 0; @@ -185,8 +185,8 @@ int generateTemplate(File &definitionFp, File &templateFp) int generateTemplate(const char *definitionFile, const char *templateFile) { // check filename extensions - Filename defFile(NULL, NULL, definitionFile, TEMPLATE_DEFINITION_EXTENSION); - Filename temFile(NULL, NULL, templateFile, TEMPLATE_EXTENSION); + Filename defFile(nullptr, nullptr, definitionFile, TEMPLATE_DEFINITION_EXTENSION); + Filename temFile(nullptr, nullptr, templateFile, TEMPLATE_EXTENSION); File definitionFp; int i = 0; @@ -231,8 +231,8 @@ int generateTemplate(const char *definitionFile, const char *templateFile) int deriveTemplate(const char *baseFile, const char *templateFile) { // check filename extensions - Filename basFile(NULL, NULL, baseFile, TEMPLATE_EXTENSION); - Filename temFile(NULL, NULL, templateFile, TEMPLATE_EXTENSION); + Filename basFile(nullptr, nullptr, baseFile, TEMPLATE_EXTENSION); + Filename temFile(nullptr, nullptr, templateFile, TEMPLATE_EXTENSION); File basFp; if (!basFp.open(basFile, "rt")) @@ -263,7 +263,7 @@ int compileTemplate(const char *filename) { TpfFile templateFile; - Filename templateFileName(NULL, NULL, filename, TEMPLATE_EXTENSION); + Filename templateFileName(nullptr, nullptr, filename, TEMPLATE_EXTENSION); return templateFile.makeIffFiles(templateFileName); } // compileTemplate @@ -279,7 +279,7 @@ int verifyTemplate(const char *filename) TpfFile templateFile; printf("Verifying %s: ", filename); - Filename templateFileName(NULL, NULL, filename, TEMPLATE_EXTENSION); + Filename templateFileName(nullptr, nullptr, filename, TEMPLATE_EXTENSION); int result = templateFile.loadTemplate(templateFileName); if (result == 0) printf("file ok"); @@ -299,7 +299,7 @@ int updateTemplate(const char *filename) { TpfFile templateFile; - Filename templateFileName(NULL, NULL, filename, TEMPLATE_EXTENSION); + Filename templateFileName(nullptr, nullptr, filename, TEMPLATE_EXTENSION); return templateFile.updateTemplate(templateFileName); } // updateTemplate */ @@ -317,7 +317,7 @@ TpfFile templateFile; //Error e; // // // check filename extensions -// Filename templateFileName(NULL, NULL, filename, TEMPLATE_EXTENSION); +// Filename templateFileName(nullptr, nullptr, filename, TEMPLATE_EXTENSION); // Filename iffFileName = templateFileName; // iffFileName.setExtension(IFF_EXTENSION); // @@ -345,7 +345,7 @@ TpfFile templateFile; // IGNORE_RETURN(templateFile.loadTemplate(templateFileName)); // // // check out the client template iff file -// Filename iffName(NULL, templateFile.getIffPath().c_str(), iffFileName, IFF_EXTENSION); +// Filename iffName(nullptr, templateFile.getIffPath().c_str(), iffFileName, IFF_EXTENSION); // commands[1] = iffName; // client.SetArgv( 1, const_cast(&commands[1]) ); // client.Run( commands[0], &ui ); @@ -370,7 +370,7 @@ TpfFile templateFile; //Error e; // // // check filename extensions -// Filename templateFileName(NULL, NULL, filename, TEMPLATE_EXTENSION); +// Filename templateFileName(nullptr, nullptr, filename, TEMPLATE_EXTENSION); // Filename iffFileName = templateFileName; // iffFileName.setExtension(IFF_EXTENSION); // @@ -424,7 +424,7 @@ TpfFile templateFile; // return -1; // // // add the client iff file -// Filename iffName(NULL, templateFile.getIffPath().c_str(), iffFileName, NULL); +// Filename iffName(nullptr, templateFile.getIffPath().c_str(), iffFileName, nullptr); // commands[1] = iffName; // client.SetArgv( 1, const_cast(&commands[1]) ); // client.Run( commands[0], &ui ); @@ -591,7 +591,7 @@ int main(int argc, char *argv[ ]) SetupSharedFoundation::Data data(SetupSharedFoundation::Data::D_console); #ifdef WIN32 char buffer[1024]; - GetModuleFileName(GetModuleHandle(NULL), buffer, 1024); + GetModuleFileName(GetModuleHandle(nullptr), buffer, 1024); Filename configName; configName.setName(buffer); configName.setName("templateCompiler.cfg"); @@ -607,7 +607,7 @@ int main(int argc, char *argv[ ]) // setup the random number generator // @todo need a better seed - SetupSharedRandom::install(static_cast(time(NULL))); + SetupSharedRandom::install(static_cast(time(nullptr))); // install templates SetupSharedTemplate::install(); diff --git a/engine/shared/application/TemplateDefinitionCompiler/src/shared/core/TemplateDefinitionCompiler.cpp b/engine/shared/application/TemplateDefinitionCompiler/src/shared/core/TemplateDefinitionCompiler.cpp index f95e5c6c..a9af01dd 100755 --- a/engine/shared/application/TemplateDefinitionCompiler/src/shared/core/TemplateDefinitionCompiler.cpp +++ b/engine/shared/application/TemplateDefinitionCompiler/src/shared/core/TemplateDefinitionCompiler.cpp @@ -30,7 +30,7 @@ //============================================================================== // file variables -const TemplateData *currentTemplateData = NULL; +const TemplateData *currentTemplateData = nullptr; //============================================================================== @@ -118,7 +118,7 @@ File fp; return; File temp_fp; - if (!temp_fp.open(tmpnam(NULL), "wt")) + if (!temp_fp.open(tmpnam(nullptr), "wt")) { fprintf(stderr, "error opening temp file for template header " "replacement [%s]\n", temp_fp.getFilename().getFullFilename().c_str()); @@ -244,7 +244,7 @@ int result; } File temp_fp; - if (!temp_fp.open(tmpnam(NULL), "wt")) + if (!temp_fp.open(tmpnam(nullptr), "wt")) { fprintf(stderr, "error opening temp file for template source " "replacement [%s]\n", temp_fp.getFilename().getFullFilename().c_str()); @@ -337,8 +337,8 @@ int result; // std::string oldTemplateName = tdfFile.getTemplateName(); // std::string oldBaseName = tdfFile.getBaseName(); - Filename fullName(NULL, path.getPath().c_str(), tdfFile.getTemplateName().c_str(), - NULL); + Filename fullName(nullptr, path.getPath().c_str(), tdfFile.getTemplateName().c_str(), + nullptr); writeTemplateHeader(tdfFile, fullName); result = writeTemplateSource(tdfFile, fullName); @@ -397,7 +397,7 @@ TemplateDefinitionFile tdfFile; //Error e; // // // check filename extensions -// Filename templateFileName(NULL, NULL, filename, TEMPLATE_DEFINITION_EXTENSION); +// Filename templateFileName(nullptr, nullptr, filename, TEMPLATE_DEFINITION_EXTENSION); // // // Connect to Perforce server // client.Init( &e ); @@ -433,7 +433,7 @@ TemplateDefinitionFile tdfFile; // if (tdfFile.getPath().getFullFilename().size() != 0) // { // // check out the source files -// Filename sourceName(NULL, tdfFile.getPath().getPath().c_str(), +// Filename sourceName(nullptr, tdfFile.getPath().getPath().c_str(), // tdfFile.getTemplateName().c_str(), "cpp"); // commands[1] = sourceName; // client.SetArgv( 1, const_cast(&commands[1]) ); @@ -453,7 +453,7 @@ TemplateDefinitionFile tdfFile; // std::string compilerFilename; // compilerFilename = EnumLocationTypes[tdfFile.getTemplateLocation()] + // filenameLowerToUpper(templateFileName.getName()); -// Filename compilerName(NULL, tdfFile.getCompilerPath().getPath().c_str(), +// Filename compilerName(nullptr, tdfFile.getCompilerPath().getPath().c_str(), // tdfFile.getTemplateName().c_str(), "cpp"); // commands[1] = compilerName; // client.SetArgv( 1, const_cast(&commands[1]) ); @@ -485,7 +485,7 @@ TemplateDefinitionFile tdfFile; //Error e; // // // check filename extensions -// Filename templateFileName(NULL, NULL, filename, TEMPLATE_DEFINITION_EXTENSION); +// Filename templateFileName(nullptr, nullptr, filename, TEMPLATE_DEFINITION_EXTENSION); // // // find the client and server paths // File fp(templateFileName, "rt"); @@ -546,7 +546,7 @@ TemplateDefinitionFile tdfFile; // if (tdfFile.getPath().getFullFilename().size() != 0) // { // // check in the source files -// Filename sourceName(NULL, tdfFile.getPath().getPath().c_str(), +// Filename sourceName(nullptr, tdfFile.getPath().getPath().c_str(), // tdfFile.getTemplateName().c_str(), "cpp"); // commands[1] = sourceName; // client.SetArgv( 1, const_cast(&commands[1]) ); @@ -563,7 +563,7 @@ TemplateDefinitionFile tdfFile; // if (tdfFile.getCompilerPath().getFullFilename().size() != 0) // { // // check in the compiler source files -// Filename compilerName(NULL, tdfFile.getCompilerPath().getPath().c_str(), +// Filename compilerName(nullptr, tdfFile.getCompilerPath().getPath().c_str(), // tdfFile.getTemplateName().c_str(), "cpp"); // commands[1] = compilerName; // client.SetArgv( 1, const_cast(&commands[1]) ); @@ -669,7 +669,7 @@ int main(int argc, char *argv[ ]) SetupSharedFoundation::Data data(SetupSharedFoundation::Data::D_console); #ifdef WIN32 char buffer[1024]; - GetModuleFileName(GetModuleHandle(NULL), buffer, 1024); + GetModuleFileName(GetModuleHandle(nullptr), buffer, 1024); Filename configName; configName.setName(buffer); configName.setName("templateCompiler.cfg"); @@ -685,7 +685,7 @@ int main(int argc, char *argv[ ]) // setup the random number generator // @todo need a better seed - SetupSharedRandom::install(static_cast(time(NULL))); + SetupSharedRandom::install(static_cast(time(nullptr))); int result = processArgs(argc, argv); diff --git a/engine/shared/library/sharedCollision/src/shared/core/BarrierObject.cpp b/engine/shared/library/sharedCollision/src/shared/core/BarrierObject.cpp index 204984ad..1c853c1b 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/BarrierObject.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/BarrierObject.cpp @@ -38,14 +38,14 @@ public: virtual bool canCollideWith ( CollisionProperty const * otherCollision ) const { - if(otherCollision == NULL) + if(otherCollision == nullptr) { return false; } BarrierObject const * barrier = safe_cast(&getOwner()); - if(barrier == NULL) + if(barrier == nullptr) { return false; } @@ -180,7 +180,7 @@ void BarrierObject::createAppearance ( void ) Appearance * appearance = CellProperty::createPortalBarrier(verts,gs_barrierColor); - if(appearance != NULL) + if(appearance != nullptr) { setAppearance( appearance ); diff --git a/engine/shared/library/sharedCollision/src/shared/core/BoxTree.cpp b/engine/shared/library/sharedCollision/src/shared/core/BoxTree.cpp index 1f046513..7e2c011b 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/BoxTree.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/BoxTree.cpp @@ -156,8 +156,8 @@ BoxTreeNode::BoxTreeNode() : m_box(), m_index(-1), m_userId(-1), - m_childA(NULL), - m_childB(NULL) + m_childA(nullptr), + m_childB(nullptr) { } @@ -165,8 +165,8 @@ BoxTreeNode::BoxTreeNode ( AxialBox const & box, int userId ) : m_box(box), m_index(-1), m_userId(userId), - m_childA(NULL), - m_childB(NULL) + m_childA(nullptr), + m_childB(nullptr) { } @@ -195,10 +195,10 @@ void BoxTreeNode::drawDebugShapes ( DebugShapeRenderer * renderer, VectorArgb co #ifdef _DEBUG - if(m_childA == NULL) return; - if(m_childB == NULL) return; + if(m_childA == nullptr) return; + if(m_childB == nullptr) return; - if(renderer == NULL) return; + if(renderer == nullptr) return; VectorArgb newColor( color.a, color.r * 0.9f, color.g * 0.9f, color.b * 0.9f ); @@ -227,7 +227,7 @@ int BoxTreeNode::getNodeCount ( void ) const float BoxTreeNode::calcWeight ( void ) const { - if((m_childA == NULL) && (m_childB == NULL)) return 1.0f; + if((m_childA == nullptr) && (m_childB == nullptr)) return 1.0f; float accum = 0.0f; @@ -241,9 +241,9 @@ float BoxTreeNode::calcWeight ( void ) const float BoxTreeNode::calcBalance ( void ) const { - if((m_childA == NULL) && (m_childB == NULL)) return 1.0f; + if((m_childA == nullptr) && (m_childB == nullptr)) return 1.0f; - if((m_childA != NULL) && (m_childB != NULL)) + if((m_childA != nullptr) && (m_childB != nullptr)) { return m_childA->calcWeight() / m_childB->calcWeight(); } @@ -288,8 +288,8 @@ void BoxTreeNode::packInto ( BoxTreeNode * node, BoxTreeNode * base ) const node->m_box = m_box; node->m_index = m_index; - node->m_childA = m_childA ? (base + m_childA->m_index) : NULL; - node->m_childB = m_childB ? (base + m_childB->m_index) : NULL; + node->m_childA = m_childA ? (base + m_childA->m_index) : nullptr; + node->m_childB = m_childB ? (base + m_childB->m_index) : nullptr; node->m_userId = m_userId; } @@ -302,10 +302,10 @@ void BoxTreeNode::deleteChildren ( void ) if(m_childB) m_childB->deleteChildren(); delete m_childA; - m_childA = NULL; + m_childA = nullptr; delete m_childB; - m_childB = NULL; + m_childB = nullptr; } // ---------------------------------------------------------------------- @@ -341,8 +341,8 @@ void BoxTreeNode::read ( Iff & iff, BoxTreeNode * base ) int indexA = iff.read_int32(); int indexB = iff.read_int32(); - m_childA = ( indexA != -1 ? base + indexA : NULL ); - m_childB = ( indexB != -1 ? base + indexB : NULL ); + m_childA = ( indexA != -1 ? base + indexA : nullptr ); + m_childB = ( indexB != -1 ? base + indexB : nullptr ); } // ---------------------------------------------------------------------- @@ -361,7 +361,7 @@ bool BoxTreeNode::findClosest ( Vector const & V, float maxDistance, float & out // ---------- // Leaf node case - this leaf node is closer - if((m_childA == NULL) && (m_childB == NULL)) + if((m_childA == nullptr) && (m_childB == nullptr)) { outDistance = dist; outIndex = m_userId; @@ -417,8 +417,8 @@ void BoxTree::install() // ---------------------------------------------------------------------- BoxTree::BoxTree() -: m_flatNodes(NULL), - m_root(NULL), +: m_flatNodes(nullptr), + m_root(nullptr), m_testCounter(0) { } @@ -443,7 +443,7 @@ void BoxTree::build ( BoxVec const & boxes ) // ---------- - BoxTreeNodePVec nodes(boxes.size(),NULL); + BoxTreeNodePVec nodes(boxes.size(),nullptr); int boxcount = boxes.size(); @@ -488,7 +488,7 @@ void BoxTree::drawDebugShapes ( DebugShapeRenderer * renderer ) const #ifdef _DEBUG - if(renderer == NULL) return; + if(renderer == nullptr) return; if(m_root) m_root->drawDebugShapes( renderer, VectorArgb::solidWhite, 0 ); @@ -546,7 +546,7 @@ static inline void templateTestOverlapRecurse( BoxTreeNode const * node, TestSha template< class TestShape > static inline bool templateTestOverlap( BoxTree const & tree, TestShape const & testShape, IdVec & outIds ) { - if(tree.getRoot() == NULL) return false; + if(tree.getRoot() == nullptr) return false; int oldSize = outIds.size(); @@ -580,7 +580,7 @@ static inline void templateTestOverlapRecurse2( BoxTreeNode const * node, TestSh template< class TestShape > static inline bool templateTestOverlap2( BoxTree const & tree, TestShape const & testShape, IdVec & outIds ) { - if(tree.getRoot() == NULL) return false; + if(tree.getRoot() == nullptr) return false; int oldSize = outIds.size(); @@ -701,11 +701,11 @@ void BoxTree::clear ( void ) m_root->deleteChildren(); delete m_root; - m_root = NULL; + m_root = nullptr; } delete m_flatNodes; - m_flatNodes = NULL; + m_flatNodes = nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedCollision/src/shared/core/BoxTree.h b/engine/shared/library/sharedCollision/src/shared/core/BoxTree.h index 9a2d6545..d32e2fea 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/BoxTree.h +++ b/engine/shared/library/sharedCollision/src/shared/core/BoxTree.h @@ -108,7 +108,7 @@ inline int BoxTree::getTestCounter ( void ) const inline bool BoxTree::isFlat ( void ) const { - return m_flatNodes != NULL; + return m_flatNodes != nullptr; } // ====================================================================== diff --git a/engine/shared/library/sharedCollision/src/shared/core/CollisionBuckets.cpp b/engine/shared/library/sharedCollision/src/shared/core/CollisionBuckets.cpp index af528e5f..c3c6c5c0 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/CollisionBuckets.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/CollisionBuckets.cpp @@ -162,7 +162,7 @@ void CollisionBuckets::build(Vector const & minimumBounds, Vector const & maximu (*m_nodeMatrix)[xx].resize(m_bucketsAlongY); for (unsigned int yy = 0; yy < m_bucketsAlongY; ++yy) { - // note that nodes are initialized to NULL + // note that nodes are initialized to nullptr (*m_nodeMatrix)[xx][yy].resize(m_bucketsAlongZ, 0); } } diff --git a/engine/shared/library/sharedCollision/src/shared/core/CollisionMesh.cpp b/engine/shared/library/sharedCollision/src/shared/core/CollisionMesh.cpp index 80a0e930..cca52f64 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/CollisionMesh.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/CollisionMesh.cpp @@ -106,8 +106,8 @@ CollisionMesh::CollisionMesh() : CollisionSurface(), m_id(0), m_version(1), - m_boxTree(NULL), - m_extent(NULL), + m_boxTree(nullptr), + m_extent(nullptr), m_boundsDirty(true) { m_extent = new SimpleExtent( MultiShape(AxialBox()) ); @@ -116,10 +116,10 @@ CollisionMesh::CollisionMesh() CollisionMesh::~CollisionMesh() { delete m_boxTree; - m_boxTree = NULL; + m_boxTree = nullptr; delete m_extent; - m_extent = NULL; + m_extent = nullptr; } // ---------------------------------------------------------------------- @@ -154,7 +154,7 @@ BaseExtent const * CollisionMesh::getExtent_p ( void ) const void CollisionMesh::clear ( void ) { delete m_boxTree; - m_boxTree = NULL; + m_boxTree = nullptr; } // ---------------------------------------------------------------------- @@ -1010,7 +1010,7 @@ void CollisionMesh::transform( CollisionMesh const * sourceMesh, Transform const bool CollisionMesh::hasBoxTree ( void ) const { - return m_boxTree != NULL; + return m_boxTree != nullptr; } // ---------- diff --git a/engine/shared/library/sharedCollision/src/shared/core/CollisionNotification.cpp b/engine/shared/library/sharedCollision/src/shared/core/CollisionNotification.cpp index 6fba343e..2c5d349d 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/CollisionNotification.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/CollisionNotification.cpp @@ -75,7 +75,7 @@ void CollisionNotification::purgeQueue ( void ) Object * object = entry.m_object; - if(object == NULL) continue; + if(object == nullptr) continue; if(entry.m_added) { diff --git a/engine/shared/library/sharedCollision/src/shared/core/CollisionProperty.cpp b/engine/shared/library/sharedCollision/src/shared/core/CollisionProperty.cpp index 5e22c064..b8cc9332 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/CollisionProperty.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/CollisionProperty.cpp @@ -44,7 +44,7 @@ namespace CollisionPropertyNamespace { - CollisionProperty * ms_activeListHead = NULL; + CollisionProperty * ms_activeListHead = nullptr; }; using namespace CollisionPropertyNamespace; @@ -64,8 +64,8 @@ void CollisionProperty::detachList ( void ) ms_activeListHead = m_next; } - m_prev = NULL; - m_next = NULL; + m_prev = nullptr; + m_next = nullptr; } // ---------- @@ -76,7 +76,7 @@ void CollisionProperty::attachList ( CollisionProperty * & head ) if(head) head->m_prev = this; - m_prev = NULL; + m_prev = nullptr; m_next = head; head = this; @@ -129,7 +129,7 @@ CollisionProperty * CollisionProperty::getActiveHead ( void ) Transform getTransform_o2c( Object const * object ) { - if(object == NULL) return Transform::identity; + if(object == nullptr) return Transform::identity; // If this object is a cell, its o2c transform is the identity transform @@ -164,23 +164,23 @@ CollisionProperty::CollisionProperty( Object & owner ) : Property( CollisionProperty::getClassPropertyId(), owner ), m_lastTransform_w(Transform::identity), m_lastTransform_p(Transform::identity), - m_lastCellObject(NULL), + m_lastCellObject(nullptr), m_stepHeight(0.0f), m_defaultRadius(0.0f), m_offsetX(0.0f), m_offsetZ(0.0f), m_extentsDirty(true), - m_extent_l(NULL), - m_extent_p(NULL), + m_extent_l(nullptr), + m_extent_p(nullptr), m_sphere_l(), m_sphere_w(), m_scale(owner.getScale().x), - m_spatialSubdivisionHandle(NULL), - m_floor(NULL), - m_footprint(NULL), + m_spatialSubdivisionHandle(nullptr), + m_floor(nullptr), + m_footprint(nullptr), m_idleCounter(3), - m_next(NULL), - m_prev(NULL), + m_next(nullptr), + m_prev(nullptr), m_flags(F_collidable), m_spatialDatabaseStorageType(SpatialDatabase::Q_None) { @@ -200,7 +200,7 @@ CollisionProperty::CollisionProperty( Object & owner ) { char const * const found = strstr(templateName,"lair"); - if(found != NULL) + if(found != nullptr) { setCollidable(false); } @@ -214,23 +214,23 @@ CollisionProperty::CollisionProperty( Object & owner, SharedObjectTemplate const : Property( CollisionProperty::getClassPropertyId(), owner ), m_lastTransform_w(Transform::identity), m_lastTransform_p(Transform::identity), - m_lastCellObject(NULL), + m_lastCellObject(nullptr), m_stepHeight(0.0f), m_defaultRadius(0.0f), m_offsetX(0.0f), m_offsetZ(0.0f), m_extentsDirty(true), - m_extent_l(NULL), - m_extent_p(NULL), + m_extent_l(nullptr), + m_extent_p(nullptr), m_sphere_l(), m_sphere_w(), m_scale(owner.getScale().x), - m_spatialSubdivisionHandle(NULL), - m_floor(NULL), - m_footprint(NULL), + m_spatialSubdivisionHandle(nullptr), + m_floor(nullptr), + m_footprint(nullptr), m_idleCounter(3), - m_next(NULL), - m_prev(NULL), + m_next(nullptr), + m_prev(nullptr), m_flags(F_collidable), m_spatialDatabaseStorageType(SpatialDatabase::Q_None) { @@ -248,7 +248,7 @@ CollisionProperty::CollisionProperty( Object & owner, SharedObjectTemplate const { char const * const found = strstr(templateName,"lair"); - if(found != NULL) + if(found != nullptr) { setCollidable(false); } @@ -373,7 +373,7 @@ CollisionProperty::~CollisionProperty() static_cast::NodeHandle *>(m_spatialSubdivisionHandle)->removeObject(); - m_spatialSubdivisionHandle = NULL; + m_spatialSubdivisionHandle = nullptr; } FATAL(CollisionWorld::isUpdating(),("CollisionProperty::~CollisionProperty - Trying to destroy a collision property while the collision world is updating. This is baaaad\n")); @@ -382,16 +382,16 @@ CollisionProperty::~CollisionProperty() detachList(); delete m_extent_l; - m_extent_l = NULL; + m_extent_l = nullptr; delete m_extent_p; - m_extent_p = NULL; + m_extent_p = nullptr; delete m_floor; - m_floor = NULL; + m_floor = nullptr; delete m_footprint; - m_footprint = NULL; + m_footprint = nullptr; } @@ -405,7 +405,7 @@ void CollisionProperty::attachSourceExtent ( BaseExtent * newSourceExtent ) cons m_extent_l = newSourceExtent; delete m_extent_p; - m_extent_p = NULL; + m_extent_p = nullptr; m_extentsDirty = true; } @@ -437,12 +437,12 @@ void CollisionProperty::initFloor ( void ) if (isMobile()) return; - if(m_floor != NULL) + if(m_floor != nullptr) return; // ---------- - char const *floorName = NULL; + char const *floorName = nullptr; Appearance * appearance = getOwner().getAppearance(); if(appearance) @@ -487,7 +487,7 @@ void CollisionProperty::addToCollisionWorld ( void ) if (getOwner().getNetworkId() < NetworkId::cms_invalid) { delete m_footprint; - m_footprint = NULL; + m_footprint = nullptr; } if (m_footprint) @@ -534,7 +534,7 @@ Transform CollisionProperty::getTransform_o2c ( void ) const BaseExtent * convertToSimpleExtent ( BaseExtent const * sourceExtent ) { - if(!sourceExtent) return NULL; + if(!sourceExtent) return nullptr; switch(sourceExtent->getType()) { @@ -549,7 +549,7 @@ BaseExtent * convertToSimpleExtent ( BaseExtent const * sourceExtent ) { Extent const * extent = safe_cast(sourceExtent); - if(!extent) return NULL; + if(!extent) return nullptr; return new SimpleExtent( MultiShape( extent->getShape() ) ); } @@ -558,7 +558,7 @@ BaseExtent * convertToSimpleExtent ( BaseExtent const * sourceExtent ) { CylinderExtent const * extent = safe_cast(sourceExtent); - if(!extent) return NULL; + if(!extent) return nullptr; return new SimpleExtent( MultiShape( extent->getShape() ) ); } @@ -567,7 +567,7 @@ BaseExtent * convertToSimpleExtent ( BaseExtent const * sourceExtent ) { BoxExtent const * extent = safe_cast(sourceExtent); - if(!extent) return NULL; + if(!extent) return nullptr; return new SimpleExtent( MultiShape( extent->getShape() ) ); } @@ -576,7 +576,7 @@ BaseExtent * convertToSimpleExtent ( BaseExtent const * sourceExtent ) { MeshExtent const * extent = safe_cast(sourceExtent); - if(!extent) return NULL; + if(!extent) return nullptr; return extent->clone(); } @@ -585,7 +585,7 @@ BaseExtent * convertToSimpleExtent ( BaseExtent const * sourceExtent ) { DetailExtent const * extent = safe_cast(sourceExtent); - if(!extent) return NULL; + if(!extent) return nullptr; DetailExtent * newExtent = new DetailExtent(); @@ -603,7 +603,7 @@ BaseExtent * convertToSimpleExtent ( BaseExtent const * sourceExtent ) { ComponentExtent const * extent = safe_cast(sourceExtent); - if(!extent) return NULL; + if(!extent) return nullptr; ComponentExtent * newExtent = new ComponentExtent(); @@ -623,7 +623,7 @@ BaseExtent * convertToSimpleExtent ( BaseExtent const * sourceExtent ) case ET_Null: case ET_ExtentTypeCount: default: - return NULL; + return nullptr; } } @@ -653,10 +653,10 @@ void CollisionProperty::updateExtents ( void ) const if(m_scale != newScale) { delete m_extent_l; - m_extent_l = NULL; + m_extent_l = nullptr; delete m_extent_p; - m_extent_p = NULL; + m_extent_p = nullptr; m_scale = newScale; } @@ -960,7 +960,7 @@ void CollisionProperty::drawDebugShapes ( DebugShapeRenderer * renderer ) const #ifdef _DEBUG - if(renderer == NULL) return; + if(renderer == nullptr) return; if(ConfigSharedCollision::getDrawExtents()) { @@ -1274,9 +1274,9 @@ void CollisionProperty::setLastPos ( CellProperty * cell, Transform const & tran { NAN_CHECK(transform_p); - if(cell == NULL) + if(cell == nullptr) { - m_lastCellObject = NULL; + m_lastCellObject = nullptr; m_lastTransform_p = transform_p; m_lastTransform_w = transform_p; } @@ -1298,7 +1298,7 @@ Object const * CollisionProperty::getStandingOn ( void ) const } else { - return NULL; + return nullptr; } } diff --git a/engine/shared/library/sharedCollision/src/shared/core/CollisionResolve.cpp b/engine/shared/library/sharedCollision/src/shared/core/CollisionResolve.cpp index 0638c13c..759a5f30 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/CollisionResolve.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/CollisionResolve.cpp @@ -87,7 +87,7 @@ namespace CollisionResolveNamespace FloorContactList ms_floorContactList; - Floor const * ms_ignoreFloor = NULL; + Floor const * ms_ignoreFloor = nullptr; int ms_ignoreTriId = -1; int ms_ignoreEdge = -1; Vector ms_ignoreNormal = Vector::zero; @@ -312,7 +312,7 @@ ResolutionResult CollisionResolve::resolveCollisions(CollisionProperty * collide if(result == RR_Resolved) { - colliderA->hitBy(NULL); + colliderA->hitBy(nullptr); colliderA->setExtentsDirty(true); Vector resetPos = moveSeg.getBegin(moveSeg.m_cellB); @@ -339,7 +339,7 @@ ResolutionResult CollisionResolve::resolveCollisions ( CellProperty const * cell const int iterationCount = 8; - ms_ignoreFloor = NULL; + ms_ignoreFloor = nullptr; ms_ignoreTriId = -1; ms_ignoreEdge = -1; ms_ignoreTime = REAL_MAX; @@ -484,12 +484,12 @@ ResolutionResult CollisionResolve::resolveCollisions ( CellProperty const * cell // ---------- // Remove the hit obstacle from the extent list - if(obstacleList->at(minIndex).m_extent != NULL) + if(obstacleList->at(minIndex).m_extent != nullptr) { obstacleList->at(minIndex) = obstacleList->back(); obstacleList->resize(obstacleList->size()-1); - ms_ignoreFloor = NULL; + ms_ignoreFloor = nullptr; ms_ignoreTriId = -1; ms_ignoreEdge = -1; ms_ignoreTime = REAL_MAX; @@ -561,13 +561,13 @@ void CollisionResolve::explodeExtent ( CellProperty const * cell, BaseExtent con void CollisionResolve::explodeFootprint ( Footprint * foot, ObstacleList & obstacleList, FloorContactList & floorContacts ) { - if(foot == NULL) return; + if(foot == nullptr) return; for(ContactIterator it(foot->getFloorList()); it; ++it) { FloorContactShape * contact = (*it); - if(contact == NULL) + if(contact == nullptr) continue; obstacleList.push_back( ObstacleInfo(contact->m_contact.getCell(),contact) ); @@ -594,7 +594,7 @@ void CollisionResolve::explodeCollider(CollisionProperty * colliderA, ColliderLi { CollisionProperty const * const colliderB = *ii; - if(colliderB == NULL) continue; + if(colliderB == nullptr) continue; BaseExtent const * const extentB = colliderB->getExtent_p(); @@ -613,7 +613,7 @@ void CollisionResolve::explodeCollider(CollisionProperty * colliderA, ColliderLi { FloorContactShape * const contact = (*it); - if(contact == NULL) continue; + if(contact == nullptr) continue; ms_floorContactList.push_back(contact); } @@ -713,7 +713,7 @@ Contact CollisionResolve::findContactWithFloor ( FloorContactShape * floorContac Floor const * floor = loc.getFloor(); - if(floor == NULL) return Contact::noContact; + if(floor == nullptr) return Contact::noContact; CellProperty const * floorCell = loc.getCell(); @@ -740,7 +740,7 @@ Contact CollisionResolve::findContactWithFloor ( FloorContactShape * floorContac return Contact::noContact; } - if((ms_ignoreFloor == NULL) || (floor != ms_ignoreFloor)) + if((ms_ignoreFloor == nullptr) || (floor != ms_ignoreFloor)) { walkResult = floor->canMove(loc,delta,-1,-1,result); } @@ -776,7 +776,7 @@ Contact CollisionResolve::findContactWithFloor ( FloorContactShape * floorContac tempContact.m_surfaceId2 = result.getHitEdgeId(); tempContact.m_cell = floorCell; - tempContact.m_extent = NULL; + tempContact.m_extent = nullptr; tempContact.m_surface = result.getFloor(); } } diff --git a/engine/shared/library/sharedCollision/src/shared/core/CollisionResolve.h b/engine/shared/library/sharedCollision/src/shared/core/CollisionResolve.h index 7e4b9e44..77bf73b0 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/CollisionResolve.h +++ b/engine/shared/library/sharedCollision/src/shared/core/CollisionResolve.h @@ -27,22 +27,22 @@ class Floor; struct ObstacleInfo { ObstacleInfo() - : m_cell(NULL), - m_extent(NULL), - m_floorContact(NULL) + : m_cell(nullptr), + m_extent(nullptr), + m_floorContact(nullptr) { } ObstacleInfo ( CellProperty const * cell, SimpleExtent const * extent ) : m_cell(cell), m_extent(extent), - m_floorContact(NULL) + m_floorContact(nullptr) { } ObstacleInfo ( CellProperty const * cell, FloorContactShape * contact ) : m_cell(cell), - m_extent(NULL), + m_extent(nullptr), m_floorContact(contact) { } diff --git a/engine/shared/library/sharedCollision/src/shared/core/CollisionUtils.cpp b/engine/shared/library/sharedCollision/src/shared/core/CollisionUtils.cpp index 4c994abf..5d8192b5 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/CollisionUtils.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/CollisionUtils.cpp @@ -881,7 +881,7 @@ void MergePolyPoly ( VertexList & polyA, VertexList & polyB, VertexList & outPol void BuildConvexHull ( Vector const * sortedVerts, int vertCount, VertexList & outPoly ) { - if(sortedVerts == NULL) return; + if(sortedVerts == nullptr) return; if(vertCount <= 0) return; if(vertCount == 1) { outPoly.push_back(sortedVerts[0]); return; } @@ -1104,7 +1104,7 @@ RangeLoop CalcAvoidanceThetas ( Sphere const & S, BaseExtent const * extent ); RangeLoop CalcAvoidanceThetas ( Sphere const & S, SimpleExtent const * extent ) { - if(extent == NULL) return RangeLoop::empty; + if(extent == nullptr) return RangeLoop::empty; return CalcAvoidanceThetas(S,extent->getShape()); } @@ -1113,7 +1113,7 @@ RangeLoop CalcAvoidanceThetas ( Sphere const & S, SimpleExtent const * extent ) RangeLoop CalcAvoidanceThetas ( Sphere const & S, ComponentExtent const * extent ) { - if(extent == NULL) return RangeLoop::empty; + if(extent == nullptr) return RangeLoop::empty; RangeLoop range = RangeLoop::empty; @@ -1123,7 +1123,7 @@ RangeLoop CalcAvoidanceThetas ( Sphere const & S, ComponentExtent const * extent { BaseExtent const * child = extent->getExtent(i); - if(child == NULL) continue; + if(child == nullptr) continue; RangeLoop temp = CalcAvoidanceThetas(S,child); @@ -1137,13 +1137,13 @@ RangeLoop CalcAvoidanceThetas ( Sphere const & S, ComponentExtent const * extent RangeLoop CalcAvoidanceThetas ( Sphere const & S, DetailExtent const * extent ) { - if(extent == NULL) return RangeLoop::empty; + if(extent == nullptr) return RangeLoop::empty; int count = extent->getExtentCount(); BaseExtent const * child = extent->getExtent(count - 1); - if(child == NULL) return RangeLoop::empty; + if(child == nullptr) return RangeLoop::empty; return CalcAvoidanceThetas(S,child); } @@ -1152,7 +1152,7 @@ RangeLoop CalcAvoidanceThetas ( Sphere const & S, DetailExtent const * extent ) RangeLoop CalcAvoidanceThetas ( Sphere const & S, BaseExtent const * extent ) { - if(extent == NULL) return RangeLoop::empty; + if(extent == nullptr) return RangeLoop::empty; ExtentType type = extent->getType(); @@ -1176,7 +1176,7 @@ RangeLoop CalcAvoidanceThetas ( Sphere const & S, ExtentVec const & extents ) { BaseExtent const * child = extents[i]; - if(child == NULL) continue; + if(child == nullptr) continue; RangeLoop temp = CalcAvoidanceThetas(S,child); @@ -1367,7 +1367,7 @@ void explodeObstacle ( Sphere const & sphere, Vector const & delta, SimpleExtent void explodeObstacle ( Sphere const & sphere, Vector const & delta, DetailExtent const * extent, ExtentVec & outList ) { - if(extent == NULL) return; + if(extent == nullptr) return; int count = extent->getExtentCount(); @@ -1376,7 +1376,7 @@ void explodeObstacle ( Sphere const & sphere, Vector const & delta, DetailExtent void explodeObstacle ( Sphere const & sphere, Vector const & delta, ComponentExtent const * extent, ExtentVec & outList ) { - if(extent == NULL) return; + if(extent == nullptr) return; int count = extent->getExtentCount(); @@ -1388,7 +1388,7 @@ void explodeObstacle ( Sphere const & sphere, Vector const & delta, ComponentExt void explodeObstacle ( Sphere const & sphere, Vector const & delta, BaseExtent const * extent, ExtentVec & outList ) { - if(extent == NULL) return; + if(extent == nullptr) return; ExtentType type = extent->getType(); @@ -1411,7 +1411,7 @@ void explodeObstacle ( Sphere const & sphere, Vector const & delta, ExtentVec co bool CalcAvoidancePoint ( Sphere const & sphere, Transform const & sphereTransform_p2w, Vector const & delta, CollisionProperty const * obstacle, Vector & out ) { - if(obstacle == NULL) return false; + if(obstacle == nullptr) return false; static ExtentVec tempExtents; @@ -1455,12 +1455,12 @@ bool CalcAvoidancePoint ( Sphere const & sphere, Transform const & sphereTransfo bool CalcAvoidancePoint ( CollisionProperty const * mob, Vector const & delta, CollisionProperty const * obstacle, Vector & out ) { - if(mob == NULL) return false; - if(obstacle == NULL) return false; + if(mob == nullptr) return false; + if(obstacle == nullptr) return false; BaseExtent const * mobExtent = mob->getExtent_p(); - if(mobExtent == NULL) return false; + if(mobExtent == nullptr) return false; Sphere mobSphere = mobExtent->getBoundingSphere(); @@ -1471,8 +1471,8 @@ bool CalcAvoidancePoint ( CollisionProperty const * mob, Vector const & delta, C bool CalcAvoidancePoint ( Object const * mob, Vector const & delta, Object const * obstacle, Vector & out ) { - if(mob == NULL) return false; - if(obstacle == NULL) return false; + if(mob == nullptr) return false; + if(obstacle == nullptr) return false; CollisionProperty const * mobCollision = mob->getCollisionProperty(); CollisionProperty const * obstacleCollision = obstacle->getCollisionProperty(); @@ -1601,8 +1601,8 @@ Vector transformToCell ( CellProperty const * cellA, Vector const & point_A, Cel { CellProperty const * worldCell = CellProperty::getWorldCellProperty(); - if(cellA == NULL) cellA = worldCell; - if(cellB == NULL) cellB = worldCell; + if(cellA == nullptr) cellA = worldCell; + if(cellB == nullptr) cellB = worldCell; if(cellA == cellB) return point_A; @@ -1627,8 +1627,8 @@ Vector rotateToCell ( CellProperty const * cellA, Vector const & point_A, CellPr { CellProperty const * worldCell = CellProperty::getWorldCellProperty(); - if(cellA == NULL) cellA = worldCell; - if(cellB == NULL) cellB = worldCell; + if(cellA == nullptr) cellA = worldCell; + if(cellB == nullptr) cellB = worldCell; if(cellA == cellB) return point_A; @@ -1655,8 +1655,8 @@ Transform transformToCell ( CellProperty const * cellA, Transform const & transf { CellProperty const * worldCell = CellProperty::getWorldCellProperty(); - if(cellA == NULL) cellA = worldCell; - if(cellB == NULL) cellB = worldCell; + if(cellA == nullptr) cellA = worldCell; + if(cellB == nullptr) cellB = worldCell; if(cellA == cellB) return transform_A; @@ -1743,8 +1743,8 @@ MultiShape transformToCell ( CellProperty const * cellA, MultiShape const & shap bool testPortalVis ( CellProperty const * cellA, Vector const & pointA, CellProperty const * cellB, Vector const & pointB ) { - if(cellA == NULL) return false; - if(cellB == NULL) return false; + if(cellA == nullptr) return false; + if(cellB == nullptr) return false; float hitTime = 0.0f; @@ -1753,7 +1753,7 @@ bool testPortalVis ( CellProperty const * cellA, Vector const & pointA, CellProp if(cellA == cellB) { - return cellA->getDestinationCell(pointA,pointB,hitTime) == NULL; + return cellA->getDestinationCell(pointA,pointB,hitTime) == nullptr; } // ---------- diff --git a/engine/shared/library/sharedCollision/src/shared/core/CollisionWorld.cpp b/engine/shared/library/sharedCollision/src/shared/core/CollisionWorld.cpp index 29d98133..61b199f9 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/CollisionWorld.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/CollisionWorld.cpp @@ -71,7 +71,7 @@ namespace CollisionWorldNamespace // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SpatialDatabase * ms_database = NULL; + SpatialDatabase * ms_database = nullptr; bool ms_updating = false; bool ms_serverSide = false; @@ -94,7 +94,7 @@ namespace CollisionWorldNamespace bool testPassableTerrain(Vector const & startPos, Vector const & delta, float & collisionTime) { TerrainObject const *const terrainObject = TerrainObject::getConstInstance(); - if (NULL != terrainObject) + if (nullptr != terrainObject) { float totalDistance = delta.magnitude(); float distanceTraversed = 0.0f; @@ -134,7 +134,7 @@ namespace CollisionWorldNamespace return; TerrainObject const *const terrainObject = TerrainObject::getConstInstance(); - if (NULL != terrainObject && terrainObject->hasPassableAffectors()) + if (nullptr != terrainObject && terrainObject->hasPassableAffectors()) { // pointA_w is *not* the previous world position, but actually the world @@ -289,7 +289,7 @@ bool CollisionWorldNamespace::testFloorCollision(FloorLocator const &startFloorL if (!floor) { // For some reason this solid floor does not have an attached floor. No collision. - WARNING(true, ("testFloorCollision(): attempted to test floor with a starting floor locator that had a NULL floor, unexpected. Check calling code's assumptions.")); + WARNING(true, ("testFloorCollision(): attempted to test floor with a starting floor locator that had a nullptr floor, unexpected. Check calling code's assumptions.")); return true; } @@ -319,7 +319,7 @@ bool CollisionWorldNamespace::testFloorCollision(FloorLocator const &startFloorL // if statement above. WARNING(true, ("testFloorCollision(): floor collision occurred while checking for floor collisions for floor of object id [%s] but collision floor location has no associated floor. Calling this a non-collision. PathWalkResult was [%d].", - floor->getOwner() ? floor->getOwner()->getNetworkId().getValueString().c_str() : "", + floor->getOwner() ? floor->getOwner()->getNetworkId().getValueString().c_str() : "", static_cast(pathWalkResult) )); return false; @@ -328,8 +328,8 @@ bool CollisionWorldNamespace::testFloorCollision(FloorLocator const &startFloorL collisionObject = destinationFloor->getOwner(); if (!collisionObject) { - // We had a collision on a floor, but the floor had a NULL owner. Consider this a non-collision. - WARNING(true, ("testFloorCollision(): floor collision occurred, destination collision floor location had a floor but floor reported a NULL owner. Calling this a non-collision.")); + // We had a collision on a floor, but the floor had a nullptr owner. Consider this a non-collision. + WARNING(true, ("testFloorCollision(): floor collision occurred, destination collision floor location had a floor but floor reported a nullptr owner. Calling this a non-collision.")); return false; } @@ -447,11 +447,11 @@ void CollisionWorld::remove ( void ) CollisionResolve::remove(); FloorMesh::remove(); - s_nearWarpWarningCallback = NULL; - s_farWarpWarningCallback = NULL; + s_nearWarpWarningCallback = nullptr; + s_farWarpWarningCallback = nullptr; delete ms_database; - ms_database = NULL; + ms_database = nullptr; } // ---------------------------------------------------------------------- @@ -595,7 +595,7 @@ bool CollisionWorld::spatialSweepAndResolve(CollisionProperty * collider) void CollisionWorld::update(CollisionProperty * collider, float time) { - FATAL(!collider, ("CollisionWorld::update(): collider is NULL.")); + FATAL(!collider, ("CollisionWorld::update(): collider is nullptr.")); PROFILER_AUTO_BLOCK_DEFINE("CollisionWorld::update"); @@ -603,9 +603,9 @@ void CollisionWorld::update(CollisionProperty * collider, float time) Footprint * foot = collider->getFootprint(); - if(foot == NULL) + if(foot == nullptr) { - PROFILER_AUTO_BLOCK_DEFINE("CollisionWorld::update: foot == NULL"); + PROFILER_AUTO_BLOCK_DEFINE("CollisionWorld::update: foot == nullptr"); IGNORE_RETURN (CollisionWorld::spatialSweepAndResolve(collider)); collider->storePosition(); @@ -1076,11 +1076,11 @@ void CollisionWorld::setFarWarpWarningCallback(WarpWarningCallback callback) void CollisionWorld::addObject ( Object * object ) { - if(object == NULL) return; + if(object == nullptr) return; CollisionProperty * collision = object->getCollisionProperty(); - if((collision == NULL) || collision->getDisableCollisionWorldAddRemove()) return; + if((collision == nullptr) || collision->getDisableCollisionWorldAddRemove()) return; if(collision->isInCollisionWorld()) return; @@ -1125,7 +1125,7 @@ void CollisionWorld::addObject ( Object * object ) { char const * name = object->getObjectTemplateName(); - if(name == NULL) + if(name == nullptr) { Appearance const * appearance = object->getAppearance(); @@ -1162,11 +1162,11 @@ void CollisionWorld::addObject ( Object * object ) void CollisionWorld::removeObject ( Object * object ) { - if(object == NULL) return; + if(object == nullptr) return; CollisionProperty * collision = object->getCollisionProperty(); - if((collision == NULL) || collision->getDisableCollisionWorldAddRemove()) return; + if((collision == nullptr) || collision->getDisableCollisionWorldAddRemove()) return; if(!collision->isInCollisionWorld()) return; @@ -1218,11 +1218,11 @@ void CollisionWorld::removeObject ( Object * object ) void CollisionWorld::moveObject (Object * object) { - if(object == NULL) return; + if(object == nullptr) return; CollisionProperty * collision = object->getCollisionProperty(); - if(collision == NULL) return; + if(collision == nullptr) return; if(!collision->isInCollisionWorld()) return; @@ -1248,11 +1248,11 @@ void CollisionWorld::moveObject (Object * object) void CollisionWorld::cellChanged ( Object * object ) { - if(object == NULL) return; + if(object == nullptr) return; CollisionProperty * collision = object->getCollisionProperty(); - if(collision == NULL) return; + if(collision == nullptr) return; if(!collision->isInCollisionWorld()) return; @@ -1266,11 +1266,11 @@ void CollisionWorld::cellChanged ( Object * object ) void CollisionWorld::appearanceChanged ( Object * object ) { - if(object == NULL) return; + if(object == nullptr) return; CollisionProperty * collision = object->getCollisionProperty(); - if(collision == NULL) return; + if(collision == nullptr) return; if(!collision->isInCollisionWorld()) return; @@ -1333,12 +1333,12 @@ SpatialDatabase * CollisionWorld::getDatabase ( void ) void CollisionWorld::objectWarped ( Object * object ) { - if(object == NULL) return; + if(object == nullptr) return; CollisionProperty * collision = object->getCollisionProperty(); // object does not have a CollisionProperty - if(collision == NULL) return; + if(collision == nullptr) return; // object is not in CollisionWorld if (!collision->isInCollisionWorld()) return; @@ -1458,7 +1458,7 @@ QueryInteractionResult CollisionWorld::queryInteraction ( CellProperty const * c if(hitTime < hitPortalTime) { outHitTime = hitTime; - outHitObject = NULL; + outHitObject = nullptr; return QIR_HitTerrain; } @@ -1472,12 +1472,12 @@ QueryInteractionResult CollisionWorld::queryInteraction ( CellProperty const * c // If we did not hit a portal, the query ends in this cell. // If this cell is not the goal cell, then the query fails. - if(nextCell == NULL) + if(nextCell == nullptr) { if(cellA != cellB) { outHitTime = 1.0f; - outHitObject = NULL; + outHitObject = nullptr; return QIR_MissedTarget; } @@ -1702,7 +1702,7 @@ CanMoveResult CollisionWorld::canMove ( CellProperty const * startCell, FloorLocator dummy; - return canMove( NULL, startCell, startLoc, goalPos, checkY, checkFlora, checkFauna, dummy ); + return canMove( nullptr, startCell, startLoc, goalPos, checkY, checkFlora, checkFauna, dummy ); } // ---------- @@ -1714,7 +1714,7 @@ CanMoveResult CollisionWorld::canMove ( Object const * object, bool checkFlora, bool checkFauna ) { - if(object == NULL) + if(object == nullptr) { return CMR_Error; } @@ -1766,7 +1766,7 @@ CanMoveResult CollisionWorld::canMove ( Object const * object, bool checkFauna, FloorLocator & endLoc ) { - if(startCell == NULL) + if(startCell == nullptr) { startCell = CellProperty::getWorldCellProperty(); } @@ -1858,7 +1858,7 @@ CanMoveResult CollisionWorld::canMove ( Object const * object, } // ---------- -// A NULL goal cell means we don't care what cell we end up in as long as we make it to the goal +// A nullptr goal cell means we don't care what cell we end up in as long as we make it to the goal CanMoveResult CollisionWorld::canMove ( Object const * object, CellProperty const * startCell, @@ -1871,12 +1871,12 @@ CanMoveResult CollisionWorld::canMove ( Object const * object, { // ---------- - if(startCell == NULL) + if(startCell == nullptr) { startCell = CellProperty::getWorldCellProperty(); } - if(goalCell == NULL) + if(goalCell == nullptr) { FloorLocator dummy; @@ -2233,17 +2233,17 @@ bool CollisionWorld::findFirstObstacle ( Object const * creature, float creature Vector delta = testPos - startPos; - if(creature == NULL) return false; + if(creature == nullptr) return false; CollisionProperty const * collision = creature->getCollisionProperty(); - if(collision == NULL) return false; + if(collision == nullptr) return false; BaseExtent const * baseExtent = collision->getExtent_p(); SimpleExtent const * simpleExtent = dynamic_cast(baseExtent); - if(simpleExtent == NULL) return false; + if(simpleExtent == nullptr) return false; MultiShape const & shape = simpleExtent->getShape(); @@ -2253,7 +2253,7 @@ bool CollisionWorld::findFirstObstacle ( Object const * creature, float creature // Test collision extents DetectResult minResult; - Object const * minObject = NULL; + Object const * minObject = nullptr; typedef std::vector ObjectVector; static ObjectVector statics; @@ -2262,7 +2262,7 @@ bool CollisionWorld::findFirstObstacle ( Object const * creature, float creature statics.clear(); creatures.clear(); - if(ms_database->queryObjects(creature->getParentCell(), shape, delta, (testStatics ? &statics : NULL), (testCreatures ? &creatures : NULL))) + if(ms_database->queryObjects(creature->getParentCell(), shape, delta, (testStatics ? &statics : nullptr), (testCreatures ? &creatures : nullptr))) { ObjectVector::size_type const nStatics = statics.size(); ObjectVector::size_type i; @@ -2271,7 +2271,7 @@ bool CollisionWorld::findFirstObstacle ( Object const * creature, float creature { Object const * obstacle = statics[i]; - if(obstacle == NULL) continue; + if(obstacle == nullptr) continue; if(obstacle == creature) continue; @@ -2292,7 +2292,7 @@ bool CollisionWorld::findFirstObstacle ( Object const * creature, float creature { Object const * obstacle = creatures[i]; - if(obstacle == NULL) continue; + if(obstacle == nullptr) continue; if(obstacle == creature) continue; @@ -2310,10 +2310,10 @@ bool CollisionWorld::findFirstObstacle ( Object const * creature, float creature //-- Check for floor collisions. Footprint const *const footprint = collision->getFootprint(); - FloorLocator const *const floorLocator = (footprint ? footprint->getAnyContact() : NULL); + FloorLocator const *const floorLocator = (footprint ? footprint->getAnyContact() : nullptr); if (floorLocator) { - Object const *floorCollisionObject = NULL; + Object const *floorCollisionObject = nullptr; Vector collisionLocation_w; // Do the floor check. @@ -2372,7 +2372,7 @@ bool CollisionWorld::findFirstObstacle ( Sphere const & sphere, Vector const & g // Test collision extents DetectResult minResult; - Object const * minObject = NULL; + Object const * minObject = nullptr; static std::vector statics; static std::vector creatures; @@ -2380,7 +2380,7 @@ bool CollisionWorld::findFirstObstacle ( Sphere const & sphere, Vector const & g statics.clear(); creatures.clear(); - if(ms_database->queryObjects(CellProperty::getWorldCellProperty(), shape, delta, (testStatics ? &statics : NULL), (testCreatures ? &creatures : NULL))) + if(ms_database->queryObjects(CellProperty::getWorldCellProperty(), shape, delta, (testStatics ? &statics : nullptr), (testCreatures ? &creatures : nullptr))) { size_t const nStatics = statics.size(); size_t i; @@ -2389,7 +2389,7 @@ bool CollisionWorld::findFirstObstacle ( Sphere const & sphere, Vector const & g { Object const * obstacle = statics[i]; - if(obstacle == NULL) continue; + if(obstacle == nullptr) continue; DetectResult result = CollisionDetect::testSphereObject(sphere,delta,obstacle); @@ -2406,7 +2406,7 @@ bool CollisionWorld::findFirstObstacle ( Sphere const & sphere, Vector const & g { Object const * obstacle = creatures[i]; - if(obstacle == NULL) continue; + if(obstacle == nullptr) continue; if(Distance2d::Distance2(obstacle->getPosition_w(),goalPos) < 0.000001) continue; @@ -2437,7 +2437,7 @@ bool CollisionWorld::findFirstObstacle ( Sphere const & sphere, Vector const & g bool CollisionWorld::calcBubble ( CellProperty const * cell, Vector const & point_p, float maxDistance, float & outRadius ) { - return calcBubble(cell,point_p,NULL,maxDistance,outRadius); + return calcBubble(cell,point_p,nullptr,maxDistance,outRadius); } bool CollisionWorld::calcBubble ( CellProperty const * cell, Vector const & point_p, Object const * ignoreObject, float maxDistance, float & outRadius ) @@ -2698,16 +2698,16 @@ void CollisionWorld::handleSceneChange(std::string const & sceneId) Floor const * CollisionWorld::getFloorStandingOn(Object const & object) { CollisionProperty const * const objectCollisionProperty = object.getCollisionProperty(); - Footprint const * const objectFootprint = (objectCollisionProperty != NULL) ? objectCollisionProperty->getFootprint() : NULL; + Footprint const * const objectFootprint = (objectCollisionProperty != nullptr) ? objectCollisionProperty->getFootprint() : nullptr; - if (objectFootprint == NULL) + if (objectFootprint == nullptr) { - return NULL; + return nullptr; } MultiListHandle const & floorList = objectFootprint->getFloorList(); float const objectHeight = object.getPosition_w().y; - Floor const * resultFloor = NULL; + Floor const * resultFloor = nullptr; float resultDistanceBelowObject = 0.0f; float dropTestHeight = std::numeric_limits::min(); @@ -2750,7 +2750,7 @@ Floor const * CollisionWorld::getFloorStandingOn(Object const & object) { TerrainObject const * const terrainObject = TerrainObject::getConstInstance(); - if (terrainObject != NULL) + if (terrainObject != nullptr) { CellProperty const * const parentCell = object.getParentCell(); @@ -2775,7 +2775,7 @@ Floor const * CollisionWorld::getFloorStandingOn(Object const & object) { if (dropTestHeight < terrainHeight) { - resultFloor = NULL; + resultFloor = nullptr; } } } diff --git a/engine/shared/library/sharedCollision/src/shared/core/ConfigSharedCollision.cpp b/engine/shared/library/sharedCollision/src/shared/core/ConfigSharedCollision.cpp index 0b3d4164..b9811896 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/ConfigSharedCollision.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/ConfigSharedCollision.cpp @@ -68,8 +68,8 @@ float ms_terrainLOSMaxDistance = 64.0f; float ms_losUprightScale = 1.5f; float ms_losProneScale = 1.0f; -PlayEffectHook ms_playEffectHook = NULL; -IsPlayerHouseHook ms_isPlayerHouseHook = NULL; +PlayEffectHook ms_playEffectHook = nullptr; +IsPlayerHouseHook ms_isPlayerHouseHook = nullptr; int ms_spatialSweepAndResolveDefaultMask = static_cast(SpatialDatabase::Q_Static); diff --git a/engine/shared/library/sharedCollision/src/shared/core/Contact3d.h b/engine/shared/library/sharedCollision/src/shared/core/Contact3d.h index 2d4d7236..551822e2 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/Contact3d.h +++ b/engine/shared/library/sharedCollision/src/shared/core/Contact3d.h @@ -52,9 +52,9 @@ public: m_normal(newNormal), m_surfaceId1(-1), m_surfaceId2(-1), - m_cell(NULL), - m_extent(NULL), - m_surface(NULL) + m_cell(nullptr), + m_extent(nullptr), + m_surface(nullptr) { } diff --git a/engine/shared/library/sharedCollision/src/shared/core/ContactPoint.cpp b/engine/shared/library/sharedCollision/src/shared/core/ContactPoint.cpp index 304a14b7..be31ca04 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/ContactPoint.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/ContactPoint.cpp @@ -18,7 +18,7 @@ // ---------------------------------------------------------------------- ContactPoint::ContactPoint() -: m_pSurface( NULL ), +: m_pSurface( nullptr ), m_position( Vector::zero ), m_offset( 0.0f ), m_hitId( -1 ) @@ -45,7 +45,7 @@ ContactPoint::ContactPoint ( ContactPoint const & locCopy ) bool ContactPoint::isAttached ( void ) const { - return (m_hitId != -1) && (m_pSurface != NULL); + return (m_hitId != -1) && (m_pSurface != nullptr); } // ---------------------------------------------------------------------- @@ -115,7 +115,7 @@ void ContactPoint::read_0000 ( Iff & iff ) { m_position = iff.read_floatVector(); m_offset = iff.read_float(); - m_pSurface = NULL; + m_pSurface = nullptr; m_hitId = iff.read_int32(); NAN_CHECK(m_position); diff --git a/engine/shared/library/sharedCollision/src/shared/core/DoorObject.cpp b/engine/shared/library/sharedCollision/src/shared/core/DoorObject.cpp index a14c9980..68b421e8 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/DoorObject.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/DoorObject.cpp @@ -99,11 +99,11 @@ DoorObject::DoorObject ( DoorInfo const & info, Portal * portal ) m_doorHelper2 ( info ), m_delta ( info.m_delta ), m_portal ( portal ), - m_neighbor ( NULL ), + m_neighbor ( nullptr ), m_spring ( info.m_spring ), m_smoothness ( info.m_smoothness ), m_draw ( true ), - m_barrier ( NULL ), + m_barrier ( nullptr ), m_oldDoorPos ( Vector::maxXYZ ), m_wasOpen(false), m_isForceField( false ), @@ -119,7 +119,7 @@ DoorObject::DoorObject ( DoorInfo const & info, Portal * portal ) setDebugName("Door object"); for (int i = 0; i < MAX_DRAWN_DOORS; ++i) - m_drawnDoor[i] = NULL; + m_drawnDoor[i] = nullptr; createAppearance(info); createTrigger(info); @@ -131,7 +131,7 @@ DoorObject::DoorObject ( DoorInfo const & info, Portal * portal ) DoorObject::~DoorObject() { m_hitByObjects.clear(); - m_portal = NULL; + m_portal = nullptr; } // ---------------------------------------------------------------------- @@ -181,7 +181,7 @@ DoorObject const * DoorObject::getNeighbor ( void ) const int DoorObject::getNumberOfDrawnDoors ( void ) { for (int i = 0; i < MAX_DRAWN_DOORS; ++i) - if (m_drawnDoor[i] == NULL) + if (m_drawnDoor[i] == nullptr) return i; return MAX_DRAWN_DOORS; @@ -210,7 +210,7 @@ void DoorObject::createAppearance ( DoorInfo const & info ) { Appearance * const appearance = AppearanceTemplateList::createAppearance(info.m_frameAppearance); - if (appearance != NULL) { + if (appearance != nullptr) { setAppearance(appearance); } else { DEBUG_WARNING(true, ("FIX ME: Appearance template for DoorObject::createAppearance missing, first stanza.")); @@ -233,7 +233,7 @@ void DoorObject::createAppearance ( DoorInfo const & info ) Collision3d::MovePolyOnto(verts,Vector::zero); Appearance * appearance = CellProperty::createForceField(verts,gs_forceFieldColor); - if(appearance != NULL) + if(appearance != nullptr) { m_drawnDoor[0]->setAppearance( appearance ); Extent * appearanceExtent = new Extent( Containment3d::EncloseSphere(verts) ); @@ -249,7 +249,7 @@ void DoorObject::createAppearance ( DoorInfo const & info ) { Appearance * const appearance = AppearanceTemplateList::createAppearance(info.m_doorAppearance); - if (appearance != NULL) { + if (appearance != nullptr) { m_drawnDoor[0]->setAppearance(appearance); } else { DEBUG_WARNING(true, ("FIX ME: Appearance template for DoorObject::createAppearance missing, third stanza.")); @@ -263,7 +263,7 @@ void DoorObject::createAppearance ( DoorInfo const & info ) Appearance * const appearance = AppearanceTemplateList::createAppearance(info.m_doorAppearance2); - if (appearance != NULL) { + if (appearance != nullptr) { m_drawnDoor[1]->setAppearance(appearance); } else { DEBUG_WARNING(true, ("FIX ME: Appearance template for DoorObject::createAppearance missing, fourth stanza.")); @@ -476,7 +476,7 @@ float DoorObject::tween ( float t ) const void DoorObject::hitBy( CollisionProperty const * collision ) { - if(collision == NULL) return; + if(collision == nullptr) return; CellProperty const * doorCell = getParentCell(); CellProperty const * doorNeighborCell = m_neighbor ? m_neighbor->getParentCell() : doorCell; @@ -533,7 +533,7 @@ void DoorObject::setNeighbor ( DoorObject * newNeighbor ) if (newNeighbor) m_barrier->setNeighbor( newNeighbor->m_barrier ); else - m_barrier->setNeighbor( NULL ); + m_barrier->setNeighbor( nullptr ); } } @@ -587,7 +587,7 @@ void DoorObject::trackHitByObject(Object const &hitByObject) if (static_cast(m_hitByObjects.size()) >= cs_maxHitByObjectsToTrack) return; - // NOTE: This can't be a set because the key's value can change when a watcher's value changes from non-NULL to NULL. + // NOTE: This can't be a set because the key's value can change when a watcher's value changes from non-nullptr to nullptr. // Check if the object already exists in the list. if (std::find(m_hitByObjects.begin(), m_hitByObjects.end(), ConstWatcher(&hitByObject)) != m_hitByObjects.end()) return; @@ -607,7 +607,7 @@ void DoorObject::maintainHitByObjectVector() // Remove any objects that no longer exist or no longer are within the trigger radius. for (WatcherObjectVector::iterator it = m_hitByObjects.begin(); it != m_hitByObjects.end(); ) { - if (it->getPointer() == NULL) + if (it->getPointer() == nullptr) { // This hit-by object has been deleted so clear it out of the tracking list. it = m_hitByObjects.erase(it); diff --git a/engine/shared/library/sharedCollision/src/shared/core/Floor.cpp b/engine/shared/library/sharedCollision/src/shared/core/Floor.cpp index 4d08d7df..8d23bff3 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/Floor.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/Floor.cpp @@ -49,8 +49,8 @@ Floor::Floor( FloorMesh const * pMesh, Object const * owner, Appearance const * m_mesh(pMesh), m_footList(this,1), m_databaseList(this,1), - m_spatialSubdivisionHandle(NULL), - m_extent(NULL), + m_spatialSubdivisionHandle(nullptr), + m_extent(nullptr), m_extentDirty(true), m_sphere_l(), m_sphere_w() @@ -104,15 +104,15 @@ Floor::~Floor() } const_cast(m_mesh)->releaseReference(); - m_mesh = NULL; + m_mesh = nullptr; - m_owner = NULL; - m_appearance = NULL; + m_owner = nullptr; + m_appearance = nullptr; - m_spatialSubdivisionHandle = NULL; + m_spatialSubdivisionHandle = nullptr; delete m_extent; - m_extent = NULL; + m_extent = nullptr; } // ---------------------------------------------------------------------- @@ -255,7 +255,7 @@ bool Floor::segTestBounds ( Vector const & begin, Vector const & end ) const Object const * Floor::getOwner ( void ) const { - if(m_owner != NULL) + if(m_owner != nullptr) { return m_owner; } @@ -265,7 +265,7 @@ Object const * Floor::getOwner ( void ) const } else { - return NULL; + return nullptr; } } @@ -273,7 +273,7 @@ Object const * Floor::getOwner ( void ) const Appearance const * Floor::getAppearance ( void ) const { - if(m_appearance != NULL) + if(m_appearance != nullptr) { return m_appearance; } @@ -283,7 +283,7 @@ Appearance const * Floor::getAppearance ( void ) const } else { - return NULL; + return nullptr; } } @@ -301,7 +301,7 @@ CellProperty const * Floor::getCell ( void ) const } else { - return NULL; + return nullptr; } } @@ -657,7 +657,7 @@ NetworkId const & Floor::getId() const { CellProperty const * const cellProperty = getCell(); - return (cellProperty != NULL) ? cellProperty->getOwner().getNetworkId() : NetworkId::cms_invalid; + return (cellProperty != nullptr) ? cellProperty->getOwner().getNetworkId() : NetworkId::cms_invalid; } // ====================================================================== diff --git a/engine/shared/library/sharedCollision/src/shared/core/FloorLocator.cpp b/engine/shared/library/sharedCollision/src/shared/core/FloorLocator.cpp index f595384a..5b728aee 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/FloorLocator.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/FloorLocator.cpp @@ -34,7 +34,7 @@ FloorTri gs_dummyFloorTri; FloorLocator::FloorLocator() : ContactPoint(), m_valid(false), - m_floor(NULL), + m_floor(nullptr), m_radius(0.0f), m_time(0.0f), m_edgeId(-1), @@ -47,7 +47,7 @@ FloorLocator::FloorLocator() // ---------- FloorLocator::FloorLocator( Floor const * floor, Vector const & localPoint, int triId, float dist, float radius ) -: ContactPoint((floor ? floor->getFloorMesh() : NULL),localPoint,triId,dist), +: ContactPoint((floor ? floor->getFloorMesh() : nullptr),localPoint,triId,dist), m_valid(true), m_floor(floor), m_radius(radius), @@ -64,7 +64,7 @@ FloorLocator::FloorLocator( Floor const * floor, Vector const & localPoint, int FloorLocator::FloorLocator( CollisionSurface const * mesh, Vector const & point, int triId, float dist, float radius ) : ContactPoint(mesh,point,triId,dist), m_valid(true), - m_floor(NULL), + m_floor(nullptr), m_radius(radius), m_time(0.0f), m_edgeId(-1), @@ -78,7 +78,7 @@ FloorLocator::FloorLocator( CollisionSurface const * mesh, Vector const & point, // ---------- FloorLocator::FloorLocator( Floor const * floor, Vector const & localPoint ) -: ContactPoint((floor ? floor->getFloorMesh() : NULL),localPoint,-1,0.0f), +: ContactPoint((floor ? floor->getFloorMesh() : nullptr),localPoint,-1,0.0f), m_valid(true), m_floor(floor), m_radius(0.0f), @@ -95,7 +95,7 @@ FloorLocator::FloorLocator( Floor const * floor, Vector const & localPoint ) FloorLocator::FloorLocator( CollisionSurface const * mesh, Vector const & point ) : ContactPoint(mesh,point,-1,0.0f), m_valid(true), - m_floor(NULL), + m_floor(nullptr), m_radius(0.0f), m_time(0.0f), m_edgeId(-1), @@ -109,9 +109,9 @@ FloorLocator::FloorLocator( CollisionSurface const * mesh, Vector const & point // ---------- FloorLocator::FloorLocator( Vector const & point, float radius ) -: ContactPoint(NULL,point,-1,0.0f), +: ContactPoint(nullptr,point,-1,0.0f), m_valid(true), - m_floor(NULL), + m_floor(nullptr), m_radius(radius), m_time(0.0f), m_edgeId(-1), @@ -226,7 +226,7 @@ void FloorLocator::setFloor ( Floor const * newFloor ) } else { - if(getFloorMesh() == NULL) + if(getFloorMesh() == nullptr) { Vector oldPos = getPosition_p(); @@ -239,7 +239,7 @@ void FloorLocator::setFloor ( Floor const * newFloor ) } else { - m_floor = NULL; + m_floor = nullptr; } } @@ -289,7 +289,7 @@ CellProperty const * FloorLocator::getCell ( void ) const { if(getFloorMesh()) { - return NULL; + return nullptr; } else { @@ -312,7 +312,7 @@ CellProperty * FloorLocator::getCell ( void ) { if(getFloorMesh()) { - return NULL; + return nullptr; } else { @@ -417,7 +417,7 @@ void FloorLocator::write ( Iff & iff ) const void FloorLocator::detach ( void ) { - setFloor(NULL); + setFloor(nullptr); setId(-1); } diff --git a/engine/shared/library/sharedCollision/src/shared/core/FloorManager.cpp b/engine/shared/library/sharedCollision/src/shared/core/FloorManager.cpp index 677849e7..1ea799b9 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/FloorManager.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/FloorManager.cpp @@ -19,9 +19,9 @@ namespace FloorManagerNamespace { -ObjectFactory ms_pathGraphFactory = NULL; -ObjectWriter ms_pathGraphWriter = NULL; -ObjectRenderer ms_pathGraphRenderer = NULL; +ObjectFactory ms_pathGraphFactory = nullptr; +ObjectWriter ms_pathGraphWriter = nullptr; +ObjectRenderer ms_pathGraphRenderer = nullptr; }; @@ -72,7 +72,7 @@ Floor * FloorManager::createFloor ( const char * floorMeshFilename, Object const if(!pMesh) { WARNING(true, ("Could not find floor mesh %s", floorMeshFilename)); - return NULL; + return nullptr; } // ---------- diff --git a/engine/shared/library/sharedCollision/src/shared/core/FloorMesh.cpp b/engine/shared/library/sharedCollision/src/shared/core/FloorMesh.cpp index 370f13b7..ae508f4a 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/FloorMesh.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/FloorMesh.cpp @@ -78,8 +78,8 @@ const Tag TAG_BTRE = TAG(B,T,R,E); const Tag TAG_BEDG = TAG(B,E,D,G); const Tag TAG_PGRF = TAG(P,G,R,F); -template <> FloorMeshList::CreateDataResourceMap *FloorMeshList::ms_bindings = NULL; -template <> FloorMeshList::LoadedDataResourceMap *FloorMeshList::ms_loaded = NULL; +template <> FloorMeshList::CreateDataResourceMap *FloorMeshList::ms_bindings = nullptr; +template <> FloorMeshList::LoadedDataResourceMap *FloorMeshList::ms_loaded = nullptr; // ---------------------------------------------------------------------- @@ -92,20 +92,20 @@ FloorMesh::FloorMesh(const std::string & filename) m_uncrossableEdges( new FloorEdgeIdVec() ), m_wallBaseEdges( new FloorEdgeIdVec() ), m_wallTopEdges( new FloorEdgeIdVec() ), - m_pathGraph(NULL), - m_appearance(NULL), + m_pathGraph(nullptr), + m_appearance(nullptr), m_triMarkCounter(1000), // just some random number m_objectFloor(false) { #ifdef _DEBUG - m_crossableLines = NULL; - m_uncrossableLines = NULL; - m_interiorLines = NULL; - m_portalLines = NULL; - m_rampLines = NULL; - m_fallthroughTriLines = NULL; - m_solidTriLines = NULL; + m_crossableLines = nullptr; + m_uncrossableLines = nullptr; + m_interiorLines = nullptr; + m_portalLines = nullptr; + m_rampLines = nullptr; + m_fallthroughTriLines = nullptr; + m_solidTriLines = nullptr; #endif } @@ -121,8 +121,8 @@ FloorMesh::FloorMesh( VectorVector const & vertices, IntVector const & indices ) m_uncrossableEdges( new FloorEdgeIdVec() ), m_wallBaseEdges( new FloorEdgeIdVec() ), m_wallTopEdges( new FloorEdgeIdVec() ), - m_pathGraph(NULL), - m_appearance(NULL), + m_pathGraph(nullptr), + m_appearance(nullptr), m_triMarkCounter(1000), m_objectFloor(false) { @@ -130,13 +130,13 @@ FloorMesh::FloorMesh( VectorVector const & vertices, IntVector const & indices ) #ifdef _DEBUG - m_crossableLines = NULL; - m_uncrossableLines = NULL; - m_interiorLines = NULL; - m_portalLines = NULL; - m_rampLines = NULL; - m_fallthroughTriLines = NULL; - m_solidTriLines = NULL; + m_crossableLines = nullptr; + m_uncrossableLines = nullptr; + m_interiorLines = nullptr; + m_portalLines = nullptr; + m_rampLines = nullptr; + m_fallthroughTriLines = nullptr; + m_solidTriLines = nullptr; #endif } @@ -146,50 +146,50 @@ FloorMesh::FloorMesh( VectorVector const & vertices, IntVector const & indices ) FloorMesh::~FloorMesh() { delete m_vertices; - m_vertices = NULL; + m_vertices = nullptr; delete m_floorTris; - m_floorTris = NULL; + m_floorTris = nullptr; delete m_crossableEdges; - m_crossableEdges = NULL; + m_crossableEdges = nullptr; delete m_uncrossableEdges; - m_crossableEdges = NULL; + m_crossableEdges = nullptr; delete m_wallBaseEdges; - m_wallBaseEdges = NULL; + m_wallBaseEdges = nullptr; delete m_wallTopEdges; - m_wallTopEdges = NULL; + m_wallTopEdges = nullptr; delete m_pathGraph; - m_pathGraph = NULL; + m_pathGraph = nullptr; - m_appearance = NULL; + m_appearance = nullptr; #ifdef _DEBUG delete m_crossableLines; - m_crossableLines = NULL; + m_crossableLines = nullptr; delete m_uncrossableLines; - m_uncrossableLines = NULL; + m_uncrossableLines = nullptr; delete m_interiorLines; - m_interiorLines = NULL; + m_interiorLines = nullptr; delete m_portalLines; - m_portalLines = NULL; + m_portalLines = nullptr; delete m_rampLines; - m_rampLines = NULL; + m_rampLines = nullptr; delete m_fallthroughTriLines; - m_fallthroughTriLines = NULL; + m_fallthroughTriLines = nullptr; delete m_solidTriLines; - m_solidTriLines = NULL; + m_solidTriLines = nullptr; #endif } @@ -833,7 +833,7 @@ void FloorMesh::write ( Iff & iff ) // ---------- - if(m_boxTree != NULL) + if(m_boxTree != nullptr) { m_boxTree->write(iff); } @@ -1772,7 +1772,7 @@ bool FloorMesh::canEnterEdge ( FloorLocator const & enterLoc ) const { if(enterLoc.getEdgeId() == -1) return false; if(enterLoc.getTriId() == -1) return false; - if(enterLoc.getFloorMesh() == NULL) return false; + if(enterLoc.getFloorMesh() == nullptr) return false; // Can't enter the tri if it's facing down @@ -1837,7 +1837,7 @@ bool FloorMesh::canExitEdge ( FloorLocator const & exitLoc, Vector const & delta { if(exitLoc.getTriId() == -1) return false; if(exitLoc.getEdgeId() == -1) return false; - if(exitLoc.getFloorMesh() == NULL) return false; + if(exitLoc.getFloorMesh() == nullptr) return false; FloorEdgeType edgeType = exitLoc.getFloorTri().getEdgeType(exitLoc.getEdgeId()); @@ -3808,7 +3808,7 @@ void FloorMesh::drawDebugShapes ( DebugShapeRenderer * renderer, bool drawExtent #ifdef _DEBUG - if(renderer == NULL) return; + if(renderer == nullptr) return; if(ConfigSharedCollision::getDrawFloors()) { diff --git a/engine/shared/library/sharedCollision/src/shared/core/Footprint.cpp b/engine/shared/library/sharedCollision/src/shared/core/Footprint.cpp index 00bec3b3..58471e36 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/Footprint.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/Footprint.cpp @@ -92,7 +92,7 @@ static bool epsilonEqual( float value, float target, float epsilon ) Footprint::Footprint ( Vector const & position, float radius, CollisionProperty * parent, const float swimHeight ) : BaseClass(), m_parent(parent), - m_cellObject(NULL), + m_cellObject(nullptr), m_position_p(Vector::zero), m_position_w(Vector::zero), m_radius(radius), @@ -112,9 +112,9 @@ Footprint::Footprint ( Vector const & position, float radius, CollisionProperty #ifdef _DEBUG , m_backupPosition_p(position), - m_backupCell(NULL), + m_backupCell(nullptr), m_backupObjectPosition_p(position), - m_backupObjectCell(NULL), + m_backupObjectCell(nullptr), m_lineHitTime( -1.0f ), m_lineOrigin( Vector(0.0f,1.5f,0.0f) ), m_lineDelta( Vector(0.0f,0.0f,10.0f) ), @@ -137,8 +137,8 @@ Footprint::~Footprint() { detach(); - m_parent = NULL; - m_cellObject = NULL; + m_parent = nullptr; + m_cellObject = nullptr; } // ====================================================================== @@ -334,7 +334,7 @@ Object * Footprint::getOwner ( void ) void Footprint::addContact ( FloorLocator const & loc ) { - if(loc.getFloor() == NULL) + if(loc.getFloor() == nullptr) { FLOOR_LOG("Footprint::addContact - loc isn't attached to a floor\n"); } @@ -445,7 +445,7 @@ void Footprint::setSwimHeight ( float swimHeight ) Vector const & Footprint::getPosition_p ( void ) const { - if(m_cellObject.getPointer() == NULL) + if(m_cellObject.getPointer() == nullptr) { WARNING(true,("Footprint::getPosition_p - Footprint's parent cell has disappeared")); @@ -525,7 +525,7 @@ void Footprint::setPosition ( CellProperty * pNewCell, Vector const & pos ) { NAN_CHECK(pos); - if(pNewCell == NULL) pNewCell = CellProperty::getWorldCellProperty(); + if(pNewCell == nullptr) pNewCell = CellProperty::getWorldCellProperty(); m_cellObject = &(pNewCell->getOwner()); m_position_p = pos; @@ -808,13 +808,13 @@ void Footprint::runDebugTests ( void ) IGNORE_RETURN(CollisionWorld::calcBubble(getCell(),getPosition_p(),20.0f,m_bubbleSize)); */ - Object const * hitObject = NULL; + Object const * hitObject = nullptr; QueryInteractionResult result = CollisionWorld::queryInteraction(objCell, objPos + m_lineOrigin, objCell, objPos + m_lineOrigin + delta, - NULL, + nullptr, !ConfigSharedCollision::getIgnoreTerrainLos(), ConfigSharedCollision::getGenerateTerrainLos(), ConfigSharedCollision::getTerrainLOSMinDistance(), @@ -843,14 +843,14 @@ FloorLocator const * Footprint::getAnyContact ( void ) const if(contact->m_contact.isAttached()) return &contact->m_contact; } - return NULL; + return nullptr; } // ---------- FloorLocator const * Footprint::getSolidContact ( void ) const { - FloorLocator const * temp = NULL; + FloorLocator const * temp = nullptr; float maxHeight = -REAL_MAX; @@ -883,11 +883,11 @@ Object const * Footprint::getStandingOn ( void ) const { FloorLocator const * contact = getSolidContact(); - if(contact == NULL) return NULL; + if(contact == nullptr) return nullptr; Floor const * floor = contact->getFloor(); - if(floor == NULL) return NULL; + if(floor == nullptr) return nullptr; return floor->getOwner(); } @@ -921,9 +921,9 @@ bool Footprint::snapToCellFloor ( void ) bool Footprint::isAttachedTo ( Floor const * floor ) const { - if(floor == NULL) return false; + if(floor == nullptr) return false; - return getFloorList().find( floor->getFootList() ) != NULL; + return getFloorList().find( floor->getFootList() ) != nullptr; } // ---------------------------------------------------------------------- @@ -1114,7 +1114,7 @@ void Footprint::updateOffsets ( void ) bool Footprint::attachTo ( Floor const * floor, bool fromObject ) { - if(floor == NULL) return false; + if(floor == nullptr) return false; if(isAttachedTo(floor)) return false; @@ -1240,7 +1240,7 @@ int Footprint::elevatorMove ( int nFloors, Transform & outTransform ) // ---------- // Find the contact that's on the cell's floor - FloorContactShape const * cellContact = NULL; + FloorContactShape const * cellContact = nullptr; for(ConstContactIterator it(getFloorList()); it; ++it) { @@ -1261,7 +1261,7 @@ int Footprint::elevatorMove ( int nFloors, Transform & outTransform ) } } - if(cellContact == NULL) + if(cellContact == nullptr) { return 0; } @@ -1328,7 +1328,7 @@ void Footprint::drawDebugShapes ( DebugShapeRenderer * renderer ) const #ifdef _DEBUG - if(renderer == NULL) return; + if(renderer == nullptr) return; if(ConfigSharedCollision::getDrawFootprints()) { @@ -1525,7 +1525,7 @@ void Footprint::alignToGroundNoFloat ( void ) if (owner) DEBUG_WARNING(true, ("Footprint::alignToGroundNoFloat(): called on object id=[%s],template=[%s] when no ground could be found.", owner->getNetworkId().getValueString().c_str(), owner->getObjectTemplateName())); else - DEBUG_WARNING(true, ("Footprint::alignToGroundNoFloat(): called on object id=[],template=[] when no ground could be found.")); + DEBUG_WARNING(true, ("Footprint::alignToGroundNoFloat(): called on object id=[],template=[] when no ground could be found.")); } #endif } diff --git a/engine/shared/library/sharedCollision/src/shared/core/FootprintForceReattachManager.cpp b/engine/shared/library/sharedCollision/src/shared/core/FootprintForceReattachManager.cpp index d0671160..680ff016 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/FootprintForceReattachManager.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/FootprintForceReattachManager.cpp @@ -31,7 +31,7 @@ namespace FootprintForceReattachManagerNamespace DataTable const * const dt = DataTableManager::getTable(ms_datatableName, true); - if (NULL == dt) + if (nullptr == dt) WARNING(true, ("FootprintForceReattachManager unable to find [%s]", ms_datatableName)); else { diff --git a/engine/shared/library/sharedCollision/src/shared/core/MultiList.cpp b/engine/shared/library/sharedCollision/src/shared/core/MultiList.cpp index 3917cd4d..af288bad 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/MultiList.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/MultiList.cpp @@ -14,8 +14,8 @@ MultiListHandle::MultiListHandle( BaseClass * object, int color ) : m_color(color), m_object(object), - m_head(NULL), - m_tail(NULL) + m_head(nullptr), + m_tail(nullptr) { } @@ -23,9 +23,9 @@ MultiListHandle::~MultiListHandle() { IGNORE_RETURN( detach() ); - m_object = NULL; - m_head = NULL; - m_tail = NULL; + m_object = nullptr; + m_head = nullptr; + m_tail = nullptr; } // ---------------------------------------------------------------------- @@ -55,7 +55,7 @@ MultiListNode * MultiListHandle::detachHead ( void ) } else { - return NULL; + return nullptr; } } @@ -72,7 +72,7 @@ MultiListHandle * MultiListHandle::detach ( void ) bool MultiListHandle::isConnected ( void ) const { - return m_head != NULL; + return m_head != nullptr; } // ---------- @@ -97,7 +97,7 @@ void MultiListHandle::erase ( MultiListNode * node ) bool MultiListHandle::isEmpty ( void ) const { - return m_head == NULL; + return m_head == nullptr; } // ---------- @@ -109,8 +109,8 @@ void MultiListHandle::insert( MultiListNode * node, MultiListNode * prev, MultiL DEBUG_FATAL( next == node, ("MultiListHandle::insert - Next and node are the same ")); DEBUG_FATAL( (prev || next) && (prev == next), ("MultiListHandle::insert - Prev and Next are the same")); - // verify that the node to insert is not null - DEBUG_FATAL( node == NULL, ("MultiListHandle::insert - Cannot insert null node")); + // verify that the node to insert is not nullptr + DEBUG_FATAL( node == nullptr, ("MultiListHandle::insert - Cannot insert nullptr node")); // verify that the nodes we're inserting between are adjacent DEBUG_FATAL( prev && (prev->m_next[m_color] != next), ("MultiListHandle::insert - Prev and Next are not adjacent")); @@ -155,7 +155,7 @@ void MultiListHandle::connectTo( MultiListHandle & handle, BaseClass * data ) void MultiListHandle::insert( MultiListNode * node ) { - insert( node, NULL, m_head ); + insert( node, nullptr, m_head ); } // ---------- @@ -175,9 +175,9 @@ MultiListNode * MultiListHandle::detach ( MultiListNode * node ) // ---------- - node->m_next[m_color] = NULL; - node->m_prev[m_color] = NULL; - node->m_list[m_color] = NULL; + node->m_next[m_color] = nullptr; + node->m_prev[m_color] = nullptr; + node->m_list[m_color] = nullptr; } return node; @@ -221,7 +221,7 @@ MultiListNode * MultiListHandle::find ( MultiListHandle & testHandle ) cursor = cursor->m_next[m_color]; } - return NULL; + return nullptr; } //lint !e1764 // testHandle could be made const ref MultiListNode const * MultiListHandle::find ( MultiListHandle const & testHandle ) const @@ -240,7 +240,7 @@ MultiListNode const * MultiListHandle::find ( MultiListHandle const & testHandle cursor = cursor->m_next[m_color]; } - return NULL; + return nullptr; } // ---------- @@ -288,13 +288,13 @@ void MultiListHandle::destroyNodes ( void ) // ====================================================================== MultiListNode::MultiListNode() -: m_data(NULL) +: m_data(nullptr) { for(int i = 0; i < nColors; i++) { - m_next[i] = NULL; - m_prev[i] = NULL; - m_list[i] = NULL; + m_next[i] = nullptr; + m_prev[i] = nullptr; + m_list[i] = nullptr; } } @@ -303,7 +303,7 @@ MultiListNode::~MultiListNode() IGNORE_RETURN( detach() ); BaseClass * data = m_data; - m_data = NULL; + m_data = nullptr; delete data; } @@ -346,7 +346,7 @@ BaseClass * MultiListNode::getObject ( int color ) if(m_list[color]) return m_list[color]->getObject(); else - return NULL; + return nullptr; } //lint !e1762 // function could be const @@ -355,7 +355,7 @@ BaseClass const * MultiListNode::getObject ( int color ) const if(m_list[color]) return m_list[color]->getObject(); else - return NULL; + return nullptr; } // ---------- @@ -375,7 +375,7 @@ void MultiListNode::setData( BaseClass * data ) if(m_data == data) return; BaseClass * deadData = m_data; - m_data = NULL; + m_data = nullptr; delete deadData; m_data = data; } @@ -403,7 +403,7 @@ void MultiListNode::swapNext ( int color ) /* MultiList::MultiList() -: m_free(0,NULL) +: m_free(0,nullptr) { } @@ -411,7 +411,7 @@ MultiList::MultiList() bool MultiList::connect ( MultiListHandle * red, MultiListHandle * blue ) { - return connect(red,blue,NULL); + return connect(red,blue,nullptr); } // ---------- @@ -436,7 +436,7 @@ bool MultiList::connect ( MultiListHandle & red, MultiListHandle & blue, BaseCla bool MultiList::connected( MultiListHandle & red, MultiListHandle & blue ) { - return red.find(blue) != NULL; + return red.find(blue) != nullptr; } // ---------- @@ -450,7 +450,7 @@ bool MultiList::disconnect( MultiListHandle & red, MultiListHandle & blue ) MultiListNode * MultiList::getFreeNode ( void ) { - if(m_free.m_head == NULL) + if(m_free.m_head == nullptr) { return new MultiListNode(); } @@ -502,8 +502,8 @@ void MultiList::insert( MultiListHandle * node, MultiListHandle * prev, MultiLis DEBUG_FATAL( next == node, ("MultiList::insert - Next and Node are the same")); DEBUG_FATAL( prev == next, ("MultiList::insert - Prev and Next are the same")); - // verify that the node to insert is not null - DEBUG_FATAL( node == NULL, ("MultiList::insert - Cannot insert a null node")); + // verify that the node to insert is not nullptr + DEBUG_FATAL( node == nullptr, ("MultiList::insert - Cannot insert a nullptr node")); // verify that the two nodes are adjacent DEBUG_FATAL( prev && (prev->m_next != next), ("MultiList::insert - Prev and Next are not adjacent")); @@ -539,7 +539,7 @@ void MultiList::insert( MultiListHandle * node, MultiListHandle * prev, MultiLis MultiListHandle * MultiList::detach( MultiListHandle * node ) { - DEBUG_FATAL( node == NULL, ("MultiList::detach - Cannot detach null node")); + DEBUG_FATAL( node == nullptr, ("MultiList::detach - Cannot detach nullptr node")); DEBUG_FATAL( node->m_list != this, ("MultiList::detach - Node is not part of this list")); // ---------- @@ -555,9 +555,9 @@ MultiListHandle * MultiList::detach( MultiListHandle * node ) if(m_head[color] == node) m_head[color] = node->m_next; if(m_tail[color] == node) m_tail[color] = node->m_prev; - node->m_prev = NULL; - node->m_next = NULL; - node->m_list = NULL; + node->m_prev = nullptr; + node->m_next = nullptr; + node->m_list = nullptr; return node; } @@ -566,13 +566,13 @@ MultiListHandle * MultiList::detach( MultiListHandle * node ) void MultiList::insert( MultiListHandle * node ) { - DEBUG_FATAL(node == NULL, ("MultiList::insert - Cannot insert NULL node")); + DEBUG_FATAL(node == nullptr, ("MultiList::insert - Cannot insert nullptr node")); // ---------- int color = node->m_color; - insert(node,NULL,m_head[color]); + insert(node,nullptr,m_head[color]); } */ diff --git a/engine/shared/library/sharedCollision/src/shared/core/MultiList.h b/engine/shared/library/sharedCollision/src/shared/core/MultiList.h index 48c5e92d..09d7a4ec 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/MultiList.h +++ b/engine/shared/library/sharedCollision/src/shared/core/MultiList.h @@ -168,12 +168,12 @@ public: if(m_node) return safe_cast(m_node->getObject(m_valueColor)); else - return NULL; + return nullptr; } operator bool ( void ) const { - return m_node != NULL; + return m_node != nullptr; } void operator ++ ( void ) @@ -212,12 +212,12 @@ public: if(m_node) return safe_cast(m_node->getObject(m_valueColor)); else - return NULL; + return nullptr; } operator bool ( void ) const { - return m_node != NULL; + return m_node != nullptr; } void operator ++ ( void ) @@ -246,7 +246,7 @@ public: MultiListConstDataIterator( void ) { - m_node = NULL; + m_node = nullptr; m_color = -1; } @@ -281,12 +281,12 @@ public: if(m_node) return safe_cast(m_node->getData()); else - return NULL; + return nullptr; } operator bool ( void ) const { - return m_node != NULL; + return m_node != nullptr; } void operator ++ ( void ) @@ -310,7 +310,7 @@ public: MultiListDataIterator( void ) { - m_node = NULL; + m_node = nullptr; m_color = -1; } @@ -345,12 +345,12 @@ public: if(m_node) return safe_cast(m_node->getData()); else - return NULL; + return nullptr; } operator bool ( void ) const { - return m_node != NULL; + return m_node != nullptr; } void operator ++ ( void ) diff --git a/engine/shared/library/sharedCollision/src/shared/core/NeighborObject.cpp b/engine/shared/library/sharedCollision/src/shared/core/NeighborObject.cpp index a5a0f37d..006db662 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/NeighborObject.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/NeighborObject.cpp @@ -12,7 +12,7 @@ // ---------------------------------------------------------------------- NeighborObject::NeighborObject() -: m_neighbor(NULL) +: m_neighbor(nullptr) { } diff --git a/engine/shared/library/sharedCollision/src/shared/core/SimpleCollisionMesh.cpp b/engine/shared/library/sharedCollision/src/shared/core/SimpleCollisionMesh.cpp index 3fa962f9..439f6c95 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/SimpleCollisionMesh.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/SimpleCollisionMesh.cpp @@ -48,7 +48,7 @@ SimpleCollisionMesh::SimpleCollisionMesh( IndexedTriangleList * tris ) SimpleCollisionMesh::~SimpleCollisionMesh() { delete m_tris; - m_tris = NULL; + m_tris = nullptr; delete m_bucket; } @@ -178,7 +178,7 @@ void SimpleCollisionMesh::drawDebugShapes ( DebugShapeRenderer * renderer ) cons UNREF(renderer); #ifdef _DEBUG - if(renderer == NULL) return; + if(renderer == nullptr) return; if (s_renderCollisionBuckets) { diff --git a/engine/shared/library/sharedCollision/src/shared/core/SpatialDatabase.cpp b/engine/shared/library/sharedCollision/src/shared/core/SpatialDatabase.cpp index 05abd3be..f2d68e94 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/SpatialDatabase.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/SpatialDatabase.cpp @@ -115,7 +115,7 @@ public: * This functionality is used on the client to prevent a door from visually opening for * a mounted creature or a rider. The actual stop logic for movement is on the server. * - * @param callback If NULL, no check is made. If non-NULL, the callback is called + * @param callback If nullptr, no check is made. If non-nullptr, the callback is called * any time a mobile is detected to have collided with a DoorObject. * The return value of the callback dictates whether the hit() and hitBy() * logic is called on the mobile and door. If the return value of callback @@ -152,29 +152,29 @@ SpatialDatabase::SpatialDatabase() SpatialDatabase::~SpatialDatabase ( void ) { delete m_staticTree; - m_staticTree = NULL; + m_staticTree = nullptr; delete m_dynamicTree; - m_dynamicTree = NULL; + m_dynamicTree = nullptr; delete m_doorTree; - m_doorTree = NULL; + m_doorTree = nullptr; delete m_barrierTree; - m_barrierTree = NULL; + m_barrierTree = nullptr; delete m_floorTree; - m_floorTree = NULL; + m_floorTree = nullptr; delete m_ignoreStack; - m_ignoreStack = NULL; + m_ignoreStack = nullptr; } // ---------------------------------------------------------------------- bool SpatialDatabase::canCollideWithStatics ( CollisionProperty * collision ) const { - if(collision == NULL) return false; + if(collision == nullptr) return false; // On the client, remote creatures and players don't collide with statics @@ -207,10 +207,10 @@ bool SpatialDatabase::canCollideWithStatics ( CollisionProperty * collision ) co bool SpatialDatabase::canCollideWithStatic ( Object const * mobObject, Object * staticObject ) const { - // Objects can't collide with NULL + // Objects can't collide with nullptr - if(mobObject == NULL) return false; - if(staticObject == NULL) return false; + if(mobObject == nullptr) return false; + if(staticObject == nullptr) return false; // Objects can't collide with themselves @@ -223,7 +223,7 @@ bool SpatialDatabase::canCollideWithStatic ( Object const * mobObject, Object * bool SpatialDatabase::canCollideWithCreatures ( CollisionProperty const * collision ) const { - if(collision == NULL) return false; + if(collision == nullptr) return false; if(collision->isPlayerControlled() && collision->isServerSide()) { @@ -253,9 +253,9 @@ bool SpatialDatabase::canCollideWithCreature ( Object * player, Object * creatur bool SpatialDatabase::canWalkOnFloor ( CollisionProperty * collision ) const { - if(collision == NULL) return false; + if(collision == nullptr) return false; - if(collision->getFootprint() == NULL) return false; + if(collision->getFootprint() == nullptr) return false; return true; } @@ -470,12 +470,12 @@ void SpatialDatabase::updateCreatureCollision(CollisionProperty * playerCollisio bool SpatialDatabase::addObject(Query const query, Object * const object) { - if(object == NULL) + if(object == nullptr) return false; CollisionProperty * collision = object->getCollisionProperty(); - if(collision == NULL) + if(collision == nullptr) return false; if(collision->getSpatialSubdivisionHandle()) @@ -511,15 +511,15 @@ bool SpatialDatabase::addObject(Query const query, Object * const object) bool SpatialDatabase::removeObject(Query const query, Object * const object) { - if(object == NULL) + if(object == nullptr) return false; CollisionProperty * collision = object->getCollisionProperty(); - if(collision == NULL) + if(collision == nullptr) return false; - if(collision->getSpatialSubdivisionHandle() == NULL) + if(collision->getSpatialSubdivisionHandle() == nullptr) return false; switch (query) @@ -548,7 +548,7 @@ bool SpatialDatabase::removeObject(Query const query, Object * const object) break; } - collision->setSpatialSubdivisionHandle(NULL); + collision->setSpatialSubdivisionHandle(nullptr); return true; } @@ -645,7 +645,7 @@ bool SpatialDatabase::checkIgnoreObject ( Object const * object ) const bool SpatialDatabase::addFloor ( Floor * floor ) { - if(floor == NULL) return false; + if(floor == nullptr) return false; if(floor->getSpatialSubdivisionHandle()) return false; @@ -660,15 +660,15 @@ bool SpatialDatabase::addFloor ( Floor * floor ) bool SpatialDatabase::removeFloor ( Floor * floor ) { - if(floor == NULL) return false; + if(floor == nullptr) return false; - if(floor->getSpatialSubdivisionHandle() == NULL) return false; + if(floor->getSpatialSubdivisionHandle() == nullptr) return false; // ---------- m_floorTree->removeObject( floor->getSpatialSubdivisionHandle() ); - floor->setSpatialSubdivisionHandle(NULL); + floor->setSpatialSubdivisionHandle(nullptr); return true; } @@ -684,11 +684,11 @@ int SpatialDatabase::getFloorCount ( void ) const bool SpatialDatabase::moveObject ( CollisionProperty * collision ) { - if(collision == NULL) return false; + if(collision == nullptr) return false; SpatialSubdivisionHandle * handle = collision->getSpatialSubdivisionHandle(); - if(handle == NULL) return false; + if(handle == nullptr) return false; // ---------- @@ -729,7 +729,7 @@ bool SpatialDatabase::queryStatics ( AxialBox const & box, ObjectVec * outList ) bool SpatialDatabase::queryStatics ( MultiShape const & shape, ObjectVec * outList ) const { - return queryStatics( NULL, shape, outList ); + return queryStatics( nullptr, shape, outList ); } // ---------- @@ -779,21 +779,21 @@ bool SpatialDatabase::queryStatics ( Line3d const & line, ObjectVec * outList ) bool SpatialDatabase::queryStatics ( CellProperty const * cell, MultiShape const & shape, ObjectVec * outList ) const { - return queryObjects(cell,shape,outList,NULL); + return queryObjects(cell,shape,outList,nullptr); } // ---------------------------------------------------------------------- bool SpatialDatabase::queryDynamics ( Sphere const & sphere, ObjectVec * outList ) const { - return queryObjects( NULL, MultiShape(sphere), NULL, outList ); + return queryObjects( nullptr, MultiShape(sphere), nullptr, outList ); } // ---------- bool SpatialDatabase::queryDynamics ( MultiShape const & shape, ObjectVec * outList ) const { - return queryObjects( NULL, shape, NULL, outList ); + return queryObjects( nullptr, shape, nullptr, outList ); } // ---------------------------------------------------------------------- @@ -982,7 +982,7 @@ bool SpatialDatabase::queryCloseStatics ( Vector const & point_w, float maxDista float minClose; float maxClose; - CollisionProperty * dummy = NULL; + CollisionProperty * dummy = nullptr; if(m_staticTree->findClosest(point_w,maxDistance,dummy,minClose,maxClose)) { @@ -1001,7 +1001,7 @@ bool SpatialDatabase::queryCloseFloors ( Vector const & point_w, float maxDistan float minClose; float maxClose; - Floor * dummy = NULL; + Floor * dummy = nullptr; if(m_floorTree->findClosest(point_w,maxDistance,dummy,minClose,maxClose)) { @@ -1163,7 +1163,7 @@ bool SpatialDatabase::queryMaterial ( CellProperty const * cell, // TODO: why are we skipping out on the tests when the extent is a MeshExtent??? MeshExtent const * mesh = dynamic_cast(extent); - if(mesh != NULL) continue; + if(mesh != nullptr) continue; Range hitRange = extent->rangedIntersect(seg_p); @@ -1244,7 +1244,7 @@ bool SpatialDatabase::queryMaterial ( CellProperty const * cellA, CollisionProperty * collisionB = results[i]; NOT_NULL(collisionB); - if (collisionB == NULL) + if (collisionB == nullptr) continue; // ---------- diff --git a/engine/shared/library/sharedCollision/src/shared/extent/BoxExtent.cpp b/engine/shared/library/sharedCollision/src/shared/extent/BoxExtent.cpp index 3adb1a61..96ce5e4c 100755 --- a/engine/shared/library/sharedCollision/src/shared/extent/BoxExtent.cpp +++ b/engine/shared/library/sharedCollision/src/shared/extent/BoxExtent.cpp @@ -394,7 +394,7 @@ void BoxExtent::drawDebugShapes ( DebugShapeRenderer * renderer ) const #ifdef _DEBUG - if(renderer == NULL) return; + if(renderer == nullptr) return; renderer->setColor( VectorArgb::solidBlue ); renderer->drawBox(m_box); diff --git a/engine/shared/library/sharedCollision/src/shared/extent/CollisionDetect.cpp b/engine/shared/library/sharedCollision/src/shared/extent/CollisionDetect.cpp index 1602025b..6f1dce72 100755 --- a/engine/shared/library/sharedCollision/src/shared/extent/CollisionDetect.cpp +++ b/engine/shared/library/sharedCollision/src/shared/extent/CollisionDetect.cpp @@ -49,11 +49,11 @@ int CollisionDetect::getTestCounter ( void ) BaseExtent const * getCollisionExtent_p ( Object const * obj ) { - if(obj == NULL) return NULL; + if(obj == nullptr) return nullptr; CollisionProperty const * collision = obj->getCollisionProperty(); - if(!collision) return NULL; + if(!collision) return nullptr; return collision->getExtent_p(); } @@ -62,8 +62,8 @@ BaseExtent const * getCollisionExtent_p ( Object const * obj ) DetectResult CollisionDetect::testObjects ( Object const * objA, Object const * objB ) { - if(objA == NULL) return false; - if(objB == NULL) return false; + if(objA == nullptr) return false; + if(objB == nullptr) return false; // ---------- @@ -85,8 +85,8 @@ DetectResult CollisionDetect::testObjects ( Object const * objA, Object const * DetectResult CollisionDetect::testObjects ( Object const * objA, Vector const & velocity, Object const * objB ) { - if(objA == NULL) return false; - if(objB == NULL) return false; + if(objA == nullptr) return false; + if(objB == nullptr) return false; // ---------- @@ -108,8 +108,8 @@ DetectResult CollisionDetect::testObjects ( Object const * objA, Vector const & DetectResult CollisionDetect::testObjectsAsCylinders ( Object const * objA, Object const * objB ) { - if(objA == NULL) return false; - if(objB == NULL) return false; + if(objA == nullptr) return false; + if(objB == nullptr) return false; // ---------- @@ -133,7 +133,7 @@ DetectResult CollisionDetect::testObjectsAsCylinders ( Object const * objA, Obje DetectResult CollisionDetect::testObjectExtent ( Object const * objA, BaseExtent const * extentB ) { - if(objA == NULL) return false; + if(objA == nullptr) return false; CollisionProperty const * collA = objA->getCollisionProperty(); @@ -158,7 +158,7 @@ DetectResult CollisionDetect::testSphereExtent ( Sphere const & sphereA, BaseExt // don't return a DetectResult that contains a pointer to a temporary - result.extentA = NULL; + result.extentA = nullptr; return result; } @@ -175,7 +175,7 @@ DetectResult CollisionDetect::testSphereExtent ( Sphere const & sphereA, Vector // don't return a DetectResult that contains a pointer to a temporary - result.extentA = NULL; + result.extentA = nullptr; return result; } @@ -184,7 +184,7 @@ DetectResult CollisionDetect::testSphereExtent ( Sphere const & sphereA, Vector DetectResult CollisionDetect::testSphereObject ( Sphere const & sphereA, Object const * objB ) { - if(objB == NULL) return false; + if(objB == nullptr) return false; CollisionProperty const * collB = objB->getCollisionProperty(); @@ -201,7 +201,7 @@ DetectResult CollisionDetect::testSphereObject ( Sphere const & sphereA, Object DetectResult CollisionDetect::testSphereObject ( Sphere const & sphereA, Vector const & velocity, Object const * objB ) { - if(objB == NULL) return false; + if(objB == nullptr) return false; CollisionProperty const * collB = objB->getCollisionProperty(); @@ -332,8 +332,8 @@ DetectResult CollisionDetect::testCapsuleObjectAgainstAllTypes(Capsule const & c DetectResult CollisionDetect::testExtents ( BaseExtent const * extentA, BaseExtent const * extentB ) { - if(extentA == NULL) return false; - if(extentB == NULL) return false; + if(extentA == nullptr) return false; + if(extentB == nullptr) return false; ExtentType typeA = extentA->getType(); ExtentType typeB = extentB->getType(); @@ -352,8 +352,8 @@ DetectResult CollisionDetect::testExtents ( BaseExtent const * extentA, BaseExte DetectResult CollisionDetect::testExtents ( BaseExtent const * extentA, Vector const & velocity, BaseExtent const * extentB ) { - if(extentA == NULL) return false; - if(extentB == NULL) return false; + if(extentA == nullptr) return false; + if(extentB == nullptr) return false; ExtentType typeA = extentA->getType(); ExtentType typeB = extentB->getType(); @@ -372,8 +372,8 @@ DetectResult CollisionDetect::testExtents ( BaseExtent const * extentA, Vector c DetectResult CollisionDetect::testExtentsAsCylinders ( BaseExtent const * extentA, BaseExtent const * extentB ) { - if(extentA == NULL) return false; - if(extentB == NULL) return false; + if(extentA == nullptr) return false; + if(extentB == nullptr) return false; SimpleExtent const * simpleExtentA = safe_cast(extentA); SimpleExtent const * simpleExtentB = safe_cast(extentB); diff --git a/engine/shared/library/sharedCollision/src/shared/extent/CollisionDetect.h b/engine/shared/library/sharedCollision/src/shared/extent/CollisionDetect.h index 8bc78848..0974a602 100755 --- a/engine/shared/library/sharedCollision/src/shared/extent/CollisionDetect.h +++ b/engine/shared/library/sharedCollision/src/shared/extent/CollisionDetect.h @@ -25,16 +25,16 @@ public: DetectResult() : collided(false), collisionTime(Range::empty), - extentA(NULL), - extentB(NULL) + extentA(nullptr), + extentB(nullptr) { } DetectResult ( bool result ) : collided(result), collisionTime( result ? Range::inf : Range::empty ), - extentA(NULL), - extentB(NULL) + extentA(nullptr), + extentB(nullptr) { } diff --git a/engine/shared/library/sharedCollision/src/shared/extent/CompositeExtent.cpp b/engine/shared/library/sharedCollision/src/shared/extent/CompositeExtent.cpp index d7a6d91a..e005e711 100755 --- a/engine/shared/library/sharedCollision/src/shared/extent/CompositeExtent.cpp +++ b/engine/shared/library/sharedCollision/src/shared/extent/CompositeExtent.cpp @@ -31,11 +31,11 @@ CompositeExtent::~CompositeExtent() { delete m_extents->at(i); - m_extents->at(i) = NULL; + m_extents->at(i) = nullptr; } delete m_extents; - m_extents = NULL; + m_extents = nullptr; } @@ -116,7 +116,7 @@ void CompositeExtent::drawDebugShapes ( DebugShapeRenderer * renderer ) const #ifdef _DEBUG - if(renderer == NULL) return; + if(renderer == nullptr) return; for(int i = 0; i < getExtentCount(); i++) { diff --git a/engine/shared/library/sharedCollision/src/shared/extent/CylinderExtent.cpp b/engine/shared/library/sharedCollision/src/shared/extent/CylinderExtent.cpp index 04d069c9..26cf80c5 100755 --- a/engine/shared/library/sharedCollision/src/shared/extent/CylinderExtent.cpp +++ b/engine/shared/library/sharedCollision/src/shared/extent/CylinderExtent.cpp @@ -146,7 +146,7 @@ void CylinderExtent::drawDebugShapes ( DebugShapeRenderer * renderer ) const #ifdef _DEBUG - if(renderer == NULL) return; + if(renderer == nullptr) return; renderer->setColor( VectorArgb::solidGreen ); renderer->drawCylinder(m_cylinder); diff --git a/engine/shared/library/sharedCollision/src/shared/extent/DetailExtent.cpp b/engine/shared/library/sharedCollision/src/shared/extent/DetailExtent.cpp index 8ceea23a..1648d2c2 100755 --- a/engine/shared/library/sharedCollision/src/shared/extent/DetailExtent.cpp +++ b/engine/shared/library/sharedCollision/src/shared/extent/DetailExtent.cpp @@ -232,11 +232,11 @@ void DetailExtent::updateBounds ( void ) int countExtents ( BaseExtent const * extent ) { - if(extent == NULL) return 0; + if(extent == nullptr) return 0; CompositeExtent const * composite = dynamic_cast(extent); - if(composite == NULL) return 1; + if(composite == nullptr) return 1; int accum = 0; diff --git a/engine/shared/library/sharedCollision/src/shared/extent/Extent.cpp b/engine/shared/library/sharedCollision/src/shared/extent/Extent.cpp index 24768bf9..248e54f1 100755 --- a/engine/shared/library/sharedCollision/src/shared/extent/Extent.cpp +++ b/engine/shared/library/sharedCollision/src/shared/extent/Extent.cpp @@ -369,7 +369,7 @@ void Extent::drawDebugShapes ( DebugShapeRenderer * renderer ) const #ifdef _DEBUG - if(renderer == NULL) return; + if(renderer == nullptr) return; renderer->setColor( VectorArgb::solidYellow ); renderer->drawSphere(m_sphere); diff --git a/engine/shared/library/sharedCollision/src/shared/extent/ExtentList.cpp b/engine/shared/library/sharedCollision/src/shared/extent/ExtentList.cpp index e77715a1..954aac1a 100755 --- a/engine/shared/library/sharedCollision/src/shared/extent/ExtentList.cpp +++ b/engine/shared/library/sharedCollision/src/shared/extent/ExtentList.cpp @@ -44,7 +44,7 @@ Extent * ExtentList::nullFactory ( Iff & iff ) IGNORE_RETURN( iff.goForward() ); - return NULL; + return nullptr; } // ====================================================================== @@ -110,7 +110,7 @@ void ExtentList::remove(void) void ExtentList::assignBinding(Tag tag, CreateFunction createFunction) { - DEBUG_FATAL(!createFunction, ("createFunction may not be NULL")); + DEBUG_FATAL(!createFunction, ("createFunction may not be nullptr")); (*ms_bindImpl.m_map) [tag] = createFunction; } @@ -133,7 +133,7 @@ void ExtentList::removeBinding(Tag tag) /** * Fetch an Extent. * - * This routine may be passed NULL. + * This routine may be passed nullptr. * * This routine will increase the reference count of the specified extent. * @@ -165,7 +165,7 @@ Extent * ExtentList::create(Iff & iff) // handle no extents if (iff.atEndOfForm()) - return NULL; + return nullptr; const Tag tag = iff.getCurrentName(); @@ -201,7 +201,7 @@ const Extent *ExtentList::fetch(Iff & iff) /** * Release an Extent. * - * This routine may be passed NULL. + * This routine may be passed nullptr. * * This routine will decrement the reference count of the Extent. When * the reference count becomes 0, the Extent will be deleted. diff --git a/engine/shared/library/sharedCollision/src/shared/extent/MeshExtent.cpp b/engine/shared/library/sharedCollision/src/shared/extent/MeshExtent.cpp index 2384b251..c32e7857 100755 --- a/engine/shared/library/sharedCollision/src/shared/extent/MeshExtent.cpp +++ b/engine/shared/library/sharedCollision/src/shared/extent/MeshExtent.cpp @@ -62,15 +62,15 @@ SimpleCollisionMesh * MeshExtent::createMesh( IndexedTriangleList * tris ) MeshExtent::MeshExtent() : Extent(ET_Mesh), - m_mesh(NULL), + m_mesh(nullptr), m_box() { - m_mesh = createMesh(NULL); + m_mesh = createMesh(nullptr); } MeshExtent::MeshExtent( IndexedTriangleList * tris ) : Extent(ET_Mesh), - m_mesh(NULL), + m_mesh(nullptr), m_box() { m_mesh = createMesh(tris); @@ -86,7 +86,7 @@ MeshExtent::MeshExtent( SimpleCollisionMesh * mesh ) MeshExtent::~MeshExtent() { delete m_mesh; - m_mesh = NULL; + m_mesh = nullptr; } // ---------------------------------------------------------------------- @@ -168,7 +168,7 @@ void MeshExtent::drawDebugShapes ( DebugShapeRenderer * renderer ) const #ifdef _DEBUG - if(renderer == NULL) return; + if(renderer == nullptr) return; renderer->setColor( VectorArgb::solidWhite ); m_mesh->drawDebugShapes(renderer); diff --git a/engine/shared/library/sharedCollision/src/shared/extent/OrientedCylinderExtent.cpp b/engine/shared/library/sharedCollision/src/shared/extent/OrientedCylinderExtent.cpp index 234db209..113784a6 100755 --- a/engine/shared/library/sharedCollision/src/shared/extent/OrientedCylinderExtent.cpp +++ b/engine/shared/library/sharedCollision/src/shared/extent/OrientedCylinderExtent.cpp @@ -106,7 +106,7 @@ void OrientedCylinderExtent::drawDebugShapes ( DebugShapeRenderer * renderer ) c #ifdef _DEBUG - if(renderer == NULL) return; + if(renderer == nullptr) return; renderer->setColor( VectorArgb::solidGreen ); renderer->draw(m_cylinder); diff --git a/engine/shared/library/sharedCollision/src/shared/extent/SimpleExtent.cpp b/engine/shared/library/sharedCollision/src/shared/extent/SimpleExtent.cpp index 5e744c37..bc8a27e6 100755 --- a/engine/shared/library/sharedCollision/src/shared/extent/SimpleExtent.cpp +++ b/engine/shared/library/sharedCollision/src/shared/extent/SimpleExtent.cpp @@ -146,7 +146,7 @@ void SimpleExtent::drawDebugShapes ( DebugShapeRenderer * renderer ) const #ifdef _DEBUG - if(renderer == NULL) return; + if(renderer == nullptr) return; switch( getShape().getShapeType() ) { diff --git a/engine/shared/library/sharedCompression/src/shared/BitStream.cpp b/engine/shared/library/sharedCompression/src/shared/BitStream.cpp index 7cc5876c..54d2a244 100755 --- a/engine/shared/library/sharedCompression/src/shared/BitStream.cpp +++ b/engine/shared/library/sharedCompression/src/shared/BitStream.cpp @@ -48,8 +48,8 @@ BitBuffer::BitBuffer(void *buffer, int size, bool inputStream) current(base), bufSize(size) { - DEBUG_FATAL(!buffer, ("buffer null")); - DEBUG_FATAL(!current, ("buffer null")); + DEBUG_FATAL(!buffer, ("buffer nullptr")); + DEBUG_FATAL(!current, ("buffer nullptr")); } // ---------------------------------------------------------------------- @@ -59,8 +59,8 @@ BitBuffer::BitBuffer(void *buffer, int size, bool inputStream) BitBuffer::~BitBuffer(void) { - base = NULL; - current = NULL; + base = nullptr; + current = nullptr; } // ---------------------------------------------------------------------- @@ -181,17 +181,17 @@ BitFile::BitFile(const char *fileName, bool inputStream) { if (isInput) { - hFile = CreateFile(fileName, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + hFile = CreateFile(fileName, GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); } else { // try to truncate it first - hFile = CreateFile(fileName, GENERIC_READ | GENERIC_WRITE, 0, NULL, TRUNCATE_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + hFile = CreateFile(fileName, GENERIC_READ | GENERIC_WRITE, 0, nullptr, TRUNCATE_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); if (hFile == INVALID_HANDLE_VALUE) { //if that fails, create it - hFile = CreateFile(fileName, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + hFile = CreateFile(fileName, GENERIC_READ | GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); } } @@ -215,7 +215,7 @@ BitFile::~BitFile(void) } } - hFile = NULL; + hFile = nullptr; delete [] name; } @@ -224,7 +224,7 @@ BitFile::~BitFile(void) int BitFile::getOffset(void) const { - return static_cast(SetFilePointer(hFile, 0, NULL, FILE_CURRENT)); + return static_cast(SetFilePointer(hFile, 0, nullptr, FILE_CURRENT)); } // ---------------------------------------------------------------------- @@ -254,7 +254,7 @@ void BitFile::outputBits(uint32 code, uint32 count) if (!mask) { uint32 bytesWritten; - if (!WriteFile(hFile, &rack, sizeof(rack), &bytesWritten, NULL)) + if (!WriteFile(hFile, &rack, sizeof(rack), &bytesWritten, nullptr)) { DEBUG_FATAL(true,("BitFile::outputBits error %d.", GetLastError())); } @@ -280,7 +280,7 @@ void BitFile::outputRack(void) if (mask != INITIAL_MASK_VALUE) { - if (!WriteFile(hFile, &rack, sizeof(rack), &bytesWritten, NULL)) + if (!WriteFile(hFile, &rack, sizeof(rack), &bytesWritten, nullptr)) { DEBUG_FATAL(true,("BitFile::outputRack writing error %d.", GetLastError())); } @@ -312,7 +312,7 @@ uint32 BitFile::inputBits(uint32 count) { uint32 bytesRead; - const BOOL result = ReadFile(hFile, &rack, sizeof(rack), &bytesRead, NULL); + const BOOL result = ReadFile(hFile, &rack, sizeof(rack), &bytesRead, nullptr); UNREF(result); DEBUG_FATAL(result && !bytesRead,("BitFile::inputBits hit EOF")); @@ -383,8 +383,8 @@ ByteBuffer::ByteBuffer(void *buffer, int size, bool inputStream) ByteBuffer::~ByteBuffer(void) { - base = NULL; - current = NULL; + base = nullptr; + current = nullptr; } // ---------------------------------------------------------------------- @@ -422,7 +422,7 @@ void ByteBuffer::output(byte b) bool ByteBuffer::input(byte *b) { - DEBUG_FATAL(!b, ("null pointer")); + DEBUG_FATAL(!b, ("nullptr pointer")); DEBUG_FATAL(!isInput,("ByteBuffer::input called on output stream")); if ((current - base) >= bufSize) @@ -446,15 +446,15 @@ ByteFile::ByteFile(const char *fileName, bool inputStream) { if (isInput) { - hFile = CreateFile(fileName, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + hFile = CreateFile(fileName, GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); } else { - hFile = CreateFile(fileName, GENERIC_READ | GENERIC_WRITE, 0, NULL, TRUNCATE_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + hFile = CreateFile(fileName, GENERIC_READ | GENERIC_WRITE, 0, nullptr, TRUNCATE_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); if (hFile == INVALID_HANDLE_VALUE) { - hFile = CreateFile(fileName, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + hFile = CreateFile(fileName, GENERIC_READ | GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); } } @@ -473,7 +473,7 @@ ByteFile::~ByteFile(void) if (hFile != INVALID_HANDLE_VALUE && !CloseHandle(hFile)) DEBUG_FATAL(true,("ByteFile::~ByteFile - Unable to close HANDLE for file %s - Error %d", name, GetLastError())); - hFile = NULL; + hFile = nullptr; delete [] name; } @@ -482,7 +482,7 @@ ByteFile::~ByteFile(void) int ByteFile::getOffset(void) const { - return static_cast(SetFilePointer(hFile, 0, NULL, FILE_CURRENT)); + return static_cast(SetFilePointer(hFile, 0, nullptr, FILE_CURRENT)); } // ---------------------------------------------------------------------- @@ -497,7 +497,7 @@ void ByteFile::output(byte b) byte out = b; uint32 bytesWritten; - if (!WriteFile(hFile, &out, sizeof(byte), &bytesWritten, NULL)) + if (!WriteFile(hFile, &out, sizeof(byte), &bytesWritten, nullptr)) { DEBUG_FATAL(true,("ByteFile::output error %d.", GetLastError())); } @@ -518,7 +518,7 @@ bool ByteFile::input(byte *b) DEBUG_FATAL(!isInput,("ByteFile::input called on output stream.")); uint32 bytesRead; - BOOL result = ReadFile(hFile, b, sizeof(byte), &bytesRead, NULL); + BOOL result = ReadFile(hFile, b, sizeof(byte), &bytesRead, nullptr); // check for EOS return (result && !bytesRead); diff --git a/engine/shared/library/sharedCompression/src/shared/Lz77.cpp b/engine/shared/library/sharedCompression/src/shared/Lz77.cpp index cb18232f..1f630cb8 100755 --- a/engine/shared/library/sharedCompression/src/shared/Lz77.cpp +++ b/engine/shared/library/sharedCompression/src/shared/Lz77.cpp @@ -47,7 +47,7 @@ Lz77::Lz77(uint32 _indexBitCount, uint32 _lengthBitCount) lookAheadSize(rawLookAheadSize + breakEven), treeRoot(windowSize), window(new byte[windowSize]), - tree(NULL) + tree(nullptr) { } @@ -232,10 +232,10 @@ uint32 Lz77::findNextNode(uint32 node) * Delete a string from the tree. * * This routine performs the classic binary tree deletion algorithm. - * If the node to be deleted has a null link in either direction, we - * just pull the non-null link up one to replace the existing link. + * If the node to be deleted has a nullptr link in either direction, we + * just pull the non-nullptr link up one to replace the existing link. * If both links exist, we instead delete the next link in order, which - * is guaranteed to have a null link, then replace the node to be deleted + * is guaranteed to have a nullptr link, then replace the node to be deleted * with the next link. */ @@ -286,7 +286,7 @@ uint32 Lz77::addString(uint32 newNode, uint32 *matchPosition) uint32 *child; int delta = 0; - DEBUG_FATAL(!matchPosition, ("matchPosition is NULL")); + DEBUG_FATAL(!matchPosition, ("matchPosition is nullptr")); if (newNode == endOfStream) return 0; diff --git a/engine/shared/library/sharedCompression/src/shared/ZlibCompressor.cpp b/engine/shared/library/sharedCompression/src/shared/ZlibCompressor.cpp index aedbda00..7f3aed3d 100755 --- a/engine/shared/library/sharedCompression/src/shared/ZlibCompressor.cpp +++ b/engine/shared/library/sharedCompression/src/shared/ZlibCompressor.cpp @@ -121,8 +121,8 @@ void ZlibCompressorNamespace::remove() DEBUG_FATAL(static_cast(ms_memoryPool.size()) != ms_poolElementCount, ("ZLibCompressor memory pool entries not all released")); operator delete(ms_memoryBottom); - ms_memoryBottom = NULL; - ms_memoryTop = NULL; + ms_memoryBottom = nullptr; + ms_memoryTop = nullptr; ms_memoryPool.clear(); ms_mutex.leave(); @@ -155,12 +155,12 @@ int ZlibCompressor::compress(const void *inputBuffer, int inputSize, void *outpu z.avail_out = outputSize; z.total_out = 0; - z.msg = NULL; - z.state = NULL; + z.msg = nullptr; + z.state = nullptr; z.zalloc = allocateWrapper; z.zfree = freeWrapper; - z.opaque = NULL; + z.opaque = nullptr; z.data_type = Z_BINARY; z.adler = 0; @@ -196,12 +196,12 @@ int ZlibCompressor::expand(const void *inputBuffer, int inputSize, void *outputB z.avail_out = outputSize; z.total_out = 0; - z.msg = NULL; - z.state = NULL; + z.msg = nullptr; + z.state = nullptr; z.zalloc = allocateWrapper; z.zfree = freeWrapper; - z.opaque = NULL; + z.opaque = nullptr; z.data_type = Z_BINARY; z.adler = 0; diff --git a/engine/shared/library/sharedDatabaseInterface/src/shared/core/Bindable.h b/engine/shared/library/sharedDatabaseInterface/src/shared/core/Bindable.h index 22617057..03c2d7dc 100755 --- a/engine/shared/library/sharedDatabaseInterface/src/shared/core/Bindable.h +++ b/engine/shared/library/sharedDatabaseInterface/src/shared/core/Bindable.h @@ -1,13 +1,13 @@ /* Bindable.h * * Defines classes based on built-in simple types that know how to bind themselves to - * database queries and support null values. + * database queries and support nullptr values. * * Each class supports the following functions: - * bool isNull -- test whether the value is null - * void setToNull -- set the value to null - * getValue -- return the value (make sure you test for null before calling this. The results - * are undefined if the Bindable is null.) + * bool isNull -- test whether the value is nullptr + * void setToNull -- set the value to nullptr + * getValue -- return the value (make sure you test for nullptr before calling this. The results + * are undefined if the Bindable is nullptr.) * setValue -- set the value * * ODBC version diff --git a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableBase.h b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableBase.h index 51008166..2aa7e5b8 100755 --- a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableBase.h +++ b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableBase.h @@ -31,7 +31,7 @@ namespace DB { explicit Bindable(int _indicator); /** - * The size of the data, or -1 for NULL. + * The size of the data, or -1 for nullptr. */ int indicator; }; diff --git a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableBool.h b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableBool.h index 36929d60..044371fe 100755 --- a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableBool.h +++ b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableBool.h @@ -18,7 +18,7 @@ namespace DB { /** Represents a bool in C++, bound to a CHAR(1) column. The column can have the values 'Y' or 'N'. - * TODO: use a boolean type in the database, if we can find one that allows NULL's and is fairly + * TODO: use a boolean type in the database, if we can find one that allows nullptr's and is fairly * portable. (May not exist -- according to the docs, Oracle does not have a boolean datatype.) */ class BindableBool : public Bindable diff --git a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableString.h b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableString.h index 103b2ada..2548990e 100755 --- a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableString.h +++ b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableString.h @@ -133,11 +133,11 @@ namespace DB std::string getValueASCII() const; /** Allocate a new string and copy the buffer to it. The caller takes responsibility - for delete[]ing it later. (If the string is NULL, this returns a null pointer.) + for delete[]ing it later. (If the string is nullptr, this returns a nullptr pointer.) */ char *makeCopyOfValue() const; -/** Set the value of the bindable string from another (null-terminated) string +/** Set the value of the bindable string from another (nullptr-terminated) string If the source buffer is too big, it FATAL's. Another alternative would be to have it truncate the string. Right now, it's better to FATAL to avoid hard-to-find bugs @@ -168,7 +168,7 @@ namespace DB private: - char m_value[S+1]; // column of size S, plus one byte for a trailing null + char m_value[S+1]; // column of size S, plus one byte for a trailing nullptr }; // ====================================================================== @@ -206,7 +206,7 @@ namespace DB { if (isNull()) { - return strncpy(buffer,"\0",1); // in the database, a zero-length string and a NULL aren't really + return strncpy(buffer,"\0",1); // in the database, a zero-length string and a nullptr aren't really // the same thing, but this is the closest we can do here. } return strncpy(buffer,m_value,(bufsize>(S+1))?(S+1):bufsize); @@ -259,7 +259,7 @@ namespace DB } FATAL((i==S+1) && (m_value[S]!='\0'),("Attempt to save string \"%s\" to the database. It is too long for the column.",buffer)); indicator=i; // set indicator to actual length of string -// m_value[S]='\0'; // guarantee null terminator -- uncomment if you remove the above FATAL +// m_value[S]='\0'; // guarantee nullptr terminator -- uncomment if you remove the above FATAL } template diff --git a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableUnicode.h b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableUnicode.h index 9c85e6d4..544ead4c 100755 --- a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableUnicode.h +++ b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableUnicode.h @@ -143,7 +143,7 @@ namespace DB private: - char m_value[S+1]; // column of size S, plus one byte for a trailing null + char m_value[S+1]; // column of size S, plus one byte for a trailing nullptr }; // ====================================================================== diff --git a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBufferRow.h b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBufferRow.h index 0d1b70d0..550f2896 100755 --- a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBufferRow.h +++ b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBufferRow.h @@ -33,9 +33,9 @@ namespace DB * Combines the values in this row with the values in newRow. * * For each column: - * If the column is null in newRow, do nothing. (Leave the value + * If the column is nullptr in newRow, do nothing. (Leave the value * in this row unchanged.) - * If the column is not null in newRow, replace the value in this + * If the column is not nullptr in newRow, replace the value in this * row with the value in newRow. */ virtual void combine(const DB::Row &newRow) =0; diff --git a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbServer.cpp b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbServer.cpp index 13f7460e..83015b31 100755 --- a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbServer.cpp +++ b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbServer.cpp @@ -29,7 +29,7 @@ using namespace DB; Mutex Server::ms_profileMutex; bool Server::ms_enableProfiling = false; bool Server::ms_enableVerboseMode = false; -DB::Profiler *Server::ms_profiler = NULL; +DB::Profiler *Server::ms_profiler = nullptr; int Server::ms_reconnectTime=0; int Server::ms_maxErrorCountBeforeDisconnect=5; int Server::ms_maxErrorCountBeforeBailout=10; @@ -51,7 +51,7 @@ Server::SesListElem::SesListElem (Session *_ses, SesListElem *_next) : ses (_ses // ---------------------------------------------------------------------- Server::Server(const char *_dsn, const char *_uid, const char *_pwd, bool useMemoryManager) : - sessionList (NULL), + sessionList (nullptr), sessionListLock(), m_useMemoryManager(useMemoryManager) { @@ -194,7 +194,7 @@ Session *Server::popSession() else { sessionListLock.leave(); - return NULL; + return nullptr; } } @@ -294,7 +294,7 @@ void Server::endProfiling() { ms_profileMutex.enter(); delete ms_profiler; - ms_profiler = NULL; + ms_profiler = nullptr; ms_enableProfiling = false; ms_profileMutex.leave(); } diff --git a/engine/shared/library/sharedDatabaseInterface/src/shared/core/NullEncodedStandardString.h b/engine/shared/library/sharedDatabaseInterface/src/shared/core/NullEncodedStandardString.h index ff154c7c..57a4395e 100755 --- a/engine/shared/library/sharedDatabaseInterface/src/shared/core/NullEncodedStandardString.h +++ b/engine/shared/library/sharedDatabaseInterface/src/shared/core/NullEncodedStandardString.h @@ -15,7 +15,7 @@ // ====================================================================== /** - * A unicode-string-compatible class that encodes a null value as a single space + * A unicode-string-compatible class that encodes a nullptr value as a single space */ class NullEncodedStandardString { diff --git a/engine/shared/library/sharedDatabaseInterface/src/shared/core/NullEncodedUnicodeString.h b/engine/shared/library/sharedDatabaseInterface/src/shared/core/NullEncodedUnicodeString.h index b28de588..45a2c521 100755 --- a/engine/shared/library/sharedDatabaseInterface/src/shared/core/NullEncodedUnicodeString.h +++ b/engine/shared/library/sharedDatabaseInterface/src/shared/core/NullEncodedUnicodeString.h @@ -15,7 +15,7 @@ // ====================================================================== /** - * A unicode-string-compatible class that encodes a null value as a single space + * A unicode-string-compatible class that encodes a nullptr value as a single space */ class NullEncodedUnicodeString { diff --git a/engine/shared/library/sharedDatabaseInterface/src_oci/DbBindableVarray.cpp b/engine/shared/library/sharedDatabaseInterface/src_oci/DbBindableVarray.cpp index 7fff3387..b0cec73d 100755 --- a/engine/shared/library/sharedDatabaseInterface/src_oci/DbBindableVarray.cpp +++ b/engine/shared/library/sharedDatabaseInterface/src_oci/DbBindableVarray.cpp @@ -22,9 +22,9 @@ using namespace DB; BindableVarray::BindableVarray() : m_initialized(false), - m_tdo (NULL), - m_data (NULL), - m_session (NULL) + m_tdo (nullptr), + m_data (nullptr), + m_session (nullptr) { } @@ -52,7 +52,7 @@ bool BindableVarray::create(DB::Session *session, const std::string &name, const schema.length(), reinterpret_cast(const_cast(name.c_str())), name.length(), - NULL, + nullptr, 0, OCI_DURATION_SESSION, OCI_TYPEGET_HEADER, @@ -64,7 +64,7 @@ bool BindableVarray::create(DB::Session *session, const std::string &name, const localSession->errhp, localSession->svchp, OCI_TYPECODE_VARRAY, - m_tdo, NULL, + m_tdo, nullptr, OCI_DURATION_DEFAULT, true, reinterpret_cast(&m_data))))) @@ -86,9 +86,9 @@ void BindableVarray::free() OCIObjectFree (localSession->envhp, localSession->errhp, m_data, 0))); m_initialized = false; - m_tdo=NULL; - m_data=NULL; - m_session=NULL; + m_tdo=nullptr; + m_data=nullptr; + m_session=nullptr; } // ---------------------------------------------------------------------- @@ -354,7 +354,7 @@ std::string BindableVarrayNumber::outputValue() const if (exists) { if (*indicator == OCI_IND_NULL) - result += "NULL"; + result += "nullptr"; else { double value; @@ -400,7 +400,7 @@ bool BindableVarrayString::push_back(const Unicode::String &value) bool BindableVarrayString::push_back(const std::string &value) { - OCIString *buffer = NULL; + OCIString *buffer = nullptr; OCIInd buffer_indicator (OCI_IND_NOTNULL); OCISession *localSession = safe_cast(m_session); @@ -437,7 +437,7 @@ bool BindableVarrayString::push_back(bool bvalue) else value = "N"; - OCIString *buffer = NULL; + OCIString *buffer = nullptr; OCIInd buffer_indicator (OCI_IND_NOTNULL); OCISession *localSession = safe_cast(m_session); @@ -469,7 +469,7 @@ bool BindableVarrayString::push_back(bool IsNULL, const Unicode::String &value) bool BindableVarrayString::push_back(bool IsNULL, const std::string &value) { - OCIString *buffer = NULL; + OCIString *buffer = nullptr; OCIInd buffer_indicator; if ( IsNULL ) { @@ -515,7 +515,7 @@ bool BindableVarrayString::push_back(bool IsNULL, bool bvalue) else value = "N"; - OCIString *buffer = NULL; + OCIString *buffer = nullptr; OCIInd buffer_indicator; if ( IsNULL ) { @@ -568,14 +568,14 @@ std::string BindableVarrayString::outputValue() const if (exists) { if (*indicator == OCI_IND_NULL) - result += "NULL"; + result += "nullptr"; else { OraText * text = OCIStringPtr(localSession->envhp, *element); if (text) result += '"' + std::string(reinterpret_cast(text)) + '"'; else - result += "NULL"; + result += "nullptr"; } } else diff --git a/engine/shared/library/sharedDatabaseInterface/src_oci/OciQueryImplementation.cpp b/engine/shared/library/sharedDatabaseInterface/src_oci/OciQueryImplementation.cpp index ab311290..b4486dc8 100755 --- a/engine/shared/library/sharedDatabaseInterface/src_oci/OciQueryImplementation.cpp +++ b/engine/shared/library/sharedDatabaseInterface/src_oci/OciQueryImplementation.cpp @@ -49,13 +49,13 @@ bool DB::OCIQueryImpl::setup(Session *session) { // setSession(session); - DEBUG_FATAL(m_session!=0,("m_session was not NULL")); - DEBUG_FATAL(m_server!=0,("m_server was not NULL")); + DEBUG_FATAL(m_session!=0,("m_session was not nullptr")); + DEBUG_FATAL(m_server!=0,("m_server was not nullptr")); DEBUG_FATAL(m_stmthp!=0,("m_stmthp was not 0")); DEBUG_FATAL(m_cursorhp!=0,("m_cursorhp was not 0")); m_session=dynamic_cast(session); - FATAL((m_session==0),("Must pass a non-NULL OCISession to setup().")); + FATAL((m_session==0),("Must pass a non-nullptr OCISession to setup().")); m_server=m_session->m_server; NOT_NULL(m_server); @@ -180,7 +180,7 @@ bool DB::OCIQueryImpl::exec() m_session->setOkToFetch(); m_session->setLastQueryStatement(m_sql); sword status=OCIStmtExecute(m_session->svchp, m_stmthp, m_session->errhp, 1, 0, - NULL, NULL, OCI_DEFAULT); + nullptr, nullptr, OCI_DEFAULT); if (status == OCI_NO_DATA) { @@ -393,8 +393,8 @@ DB::OCIQueryImpl::BindRec::BindRec(size_t numElements) : length(0), stringAdjust(false), m_numElements(numElements), - m_indicatorArray(NULL), - m_lengthArray(NULL) + m_indicatorArray(nullptr), + m_lengthArray(nullptr) { // This is ugly, but it avoids having to create two different kinds of bindrecs that inherit from an abstract base class if (m_numElements > 1) @@ -714,11 +714,11 @@ bool DB::OCIQueryImpl::bindParameter(BindableVarray &buffer) &(br->bindp), m_session->errhp, nextParameter++, - NULL, + nullptr, 0, SQLT_NTY, - NULL, - NULL, + nullptr, + nullptr, 0, 0, 0, diff --git a/engine/shared/library/sharedDatabaseInterface/src_oci/OciServer.cpp b/engine/shared/library/sharedDatabaseInterface/src_oci/OciServer.cpp index ead0cb9c..7c40e0ae 100755 --- a/engine/shared/library/sharedDatabaseInterface/src_oci/OciServer.cpp +++ b/engine/shared/library/sharedDatabaseInterface/src_oci/OciServer.cpp @@ -63,7 +63,7 @@ bool DB::OCIServer::checkerr(OCISession const & session, int status) text errbuf[512]; sb4 errcode = 0; - OCIErrorGet((dvoid *)(session.errhp), (ub4) 1, (text *) NULL, &errcode, + OCIErrorGet((dvoid *)(session.errhp), (ub4) 1, (text *) nullptr, &errcode, errbuf, (ub4) sizeof(errbuf), OCI_HTYPE_ERROR); WARNING(true,("Database error: %.*s",512,errbuf)); diff --git a/engine/shared/library/sharedDatabaseInterface/src_oci/OciSession.cpp b/engine/shared/library/sharedDatabaseInterface/src_oci/OciSession.cpp index 124998bc..e7e7bc66 100755 --- a/engine/shared/library/sharedDatabaseInterface/src_oci/OciSession.cpp +++ b/engine/shared/library/sharedDatabaseInterface/src_oci/OciSession.cpp @@ -56,11 +56,11 @@ static void freeHook(dvoid *, dvoid *memptr) DB::OCISession::OCISession(DB::OCIServer *server) : m_server(server), - envhp(NULL), - errhp(NULL), - srvhp(NULL), - sesp(NULL), - svchp(NULL), + envhp(nullptr), + errhp(nullptr), + srvhp(nullptr), + sesp(nullptr), + svchp(nullptr), autoCommitMode(true), m_resetTime(server->getReconnectTime()==0 ? 0 : time(0) + server->getReconnectTime()), m_okToFetch(true) @@ -235,11 +235,11 @@ bool DB::OCISession::disconnect() success = false; } - svchp = NULL; - sesp = NULL; - srvhp = NULL; - errhp = NULL; - envhp = NULL; + svchp = nullptr; + sesp = nullptr; + srvhp = nullptr; + errhp = nullptr; + envhp = nullptr; connectLock.leave(); return success; diff --git a/engine/shared/library/sharedDebug/src/linux/DebugMonitor.cpp b/engine/shared/library/sharedDebug/src/linux/DebugMonitor.cpp index 3dff8883..95dfef41 100755 --- a/engine/shared/library/sharedDebug/src/linux/DebugMonitor.cpp +++ b/engine/shared/library/sharedDebug/src/linux/DebugMonitor.cpp @@ -160,7 +160,7 @@ void DebugMonitor::install(void) // handle input from the output terminal, particularly to // handle profiler modifications when the output window // is active. - s_outputScreen = newterm(NULL, s_ttyOutputFile, stdin); + s_outputScreen = newterm(nullptr, s_ttyOutputFile, stdin); if (!s_outputScreen) { DEBUG_WARNING(true, ("DebugMonitor: newterm() failed [%s].", strerror(errno))); diff --git a/engine/shared/library/sharedDebug/src/linux/PerformanceTimer.cpp b/engine/shared/library/sharedDebug/src/linux/PerformanceTimer.cpp index 68c36d8c..f7bd1037 100755 --- a/engine/shared/library/sharedDebug/src/linux/PerformanceTimer.cpp +++ b/engine/shared/library/sharedDebug/src/linux/PerformanceTimer.cpp @@ -39,7 +39,7 @@ PerformanceTimer::~PerformanceTimer() void PerformanceTimer::start() { - int const result = gettimeofday(&startTime, NULL); + int const result = gettimeofday(&startTime, nullptr); FATAL(result != 0,("PerformanceTimer::start failed")); } @@ -55,7 +55,7 @@ void PerformanceTimer::resume() usec += 1000000; } - int const result = gettimeofday(&startTime, NULL); + int const result = gettimeofday(&startTime, nullptr); FATAL(result != 0,("PerformanceTimer::resume failed")); startTime.tv_sec -= sec; @@ -71,7 +71,7 @@ void PerformanceTimer::resume() void PerformanceTimer::stop() { - int result = gettimeofday(&stopTime, NULL); + int result = gettimeofday(&stopTime, nullptr); FATAL(result != 0,("PerformanceTimer::start failed")); } @@ -95,7 +95,7 @@ float PerformanceTimer::getSplitTime() const { timeval currentTime; - int const result = gettimeofday(¤tTime, NULL); + int const result = gettimeofday(¤tTime, nullptr); FATAL(result != 0,("PerformanceTimer::getSplitTime failed")); long sec = currentTime.tv_sec - startTime.tv_sec; @@ -117,7 +117,7 @@ void PerformanceTimer::logElapsedTime(const char* string) const #ifdef _DEBUG static char buffer [1000]; - sprintf(buffer, "%s : %1.5f seconds\n", string ? string : "null", getElapsedTime()); + sprintf(buffer, "%s : %1.5f seconds\n", string ? string : "nullptr", getElapsedTime()); DEBUG_REPORT_LOG_PRINT(true, ("%s", buffer)); #endif } diff --git a/engine/shared/library/sharedDebug/src/shared/DataLint.cpp b/engine/shared/library/sharedDebug/src/shared/DataLint.cpp index 5190728f..8f96856d 100755 --- a/engine/shared/library/sharedDebug/src/shared/DataLint.cpp +++ b/engine/shared/library/sharedDebug/src/shared/DataLint.cpp @@ -35,9 +35,9 @@ namespace DataLintNamespace bool ms_installed = false; DataLint::AssetType m_currentAssetType = DataLint::AT_invalid; bool m_enabled = false; - WarningList * m_warningList = NULL; - StringList * m_assetStack = NULL; - DataLint::StringPairList * m_assetList = NULL; + WarningList * m_warningList = nullptr; + StringList * m_assetStack = nullptr; + DataLint::StringPairList * m_assetList = nullptr; std::string m_dataLintCategorizedAssetsFile("DataLint_CategorizedAssets.txt"); std::string m_dataLintUnSupportedAssetsFile("DataLint_UnSupportedAssets.txt"); Mode m_mode = M_client; @@ -123,17 +123,17 @@ void DataLint::report() // Client only - FILE *assetErrorFileAppearance = NULL; - FILE *assetErrorFileArrangementDescriptor = NULL; - FILE *assetErrorFileLocalizedStringTable = NULL; - FILE *assetErrorFilePortalProperty = NULL; - FILE *assetErrorFileShaderTemplate = NULL; - FILE *assetErrorFileSkyBox = NULL; - FILE *assetErrorFileSlotDescriptor = NULL; - FILE *assetErrorFileSoundTemplate = NULL; - FILE *assetErrorFileTerrain = NULL; - FILE *assetErrorFileTexture = NULL; - FILE *assetErrorFileTextureRenderer = NULL; + FILE *assetErrorFileAppearance = nullptr; + FILE *assetErrorFileArrangementDescriptor = nullptr; + FILE *assetErrorFileLocalizedStringTable = nullptr; + FILE *assetErrorFilePortalProperty = nullptr; + FILE *assetErrorFileShaderTemplate = nullptr; + FILE *assetErrorFileSkyBox = nullptr; + FILE *assetErrorFileSlotDescriptor = nullptr; + FILE *assetErrorFileSoundTemplate = nullptr; + FILE *assetErrorFileTerrain = nullptr; + FILE *assetErrorFileTexture = nullptr; + FILE *assetErrorFileTextureRenderer = nullptr; if (m_mode == M_client) { @@ -450,7 +450,7 @@ std::string DataLintNamespace::formatErrorMessage(WarningPair &warningPair, int char *assetError = strstr(text, " : "); - if (assetError != NULL) + if (assetError != nullptr) { ++assetError; ++assetError; @@ -567,12 +567,12 @@ void DataLint::clearAssetStack() //----------------------------------------------------------------------------- void DataLint::addFilePath(char const *filePath) { - if (filePath == NULL || (strlen(filePath) <= 0)) + if (filePath == nullptr || (strlen(filePath) <= 0)) { return; } - if (m_assetList != NULL) + if (m_assetList != nullptr) { char text[4096]; sprintf(text, "%s", filePath); @@ -592,7 +592,7 @@ void DataLint::addFilePath(char const *filePath) //----------------------------------------------------------------------------- void DataLint::removeFilePath(char const *filePath) { - if (m_assetList != NULL) + if (m_assetList != nullptr) { StringPairList::iterator stringPairListIter = m_assetList->begin(); @@ -611,8 +611,8 @@ void DataLint::removeFilePath(char const *filePath) //----------------------------------------------------------------------------- bool DataLintNamespace::isAnAppearanceAsset(char const *text) { - bool const appearanceAsset = (strstr(text, "appearance/") != NULL); - bool const portalPropertyAsset = (strstr(text, ".pob") != NULL); + bool const appearanceAsset = (strstr(text, "appearance/") != nullptr); + bool const portalPropertyAsset = (strstr(text, ".pob") != nullptr); return (appearanceAsset && !portalPropertyAsset); } @@ -620,7 +620,7 @@ bool DataLintNamespace::isAnAppearanceAsset(char const *text) //----------------------------------------------------------------------------- bool DataLintNamespace::isAnArrangementDescriptorAsset(char const *text) { - bool const arrangementDescriptorAsset = (strstr(text, "slot/arrangement/") != NULL); + bool const arrangementDescriptorAsset = (strstr(text, "slot/arrangement/") != nullptr); return arrangementDescriptorAsset; } @@ -628,7 +628,7 @@ bool DataLintNamespace::isAnArrangementDescriptorAsset(char const *text) //----------------------------------------------------------------------------- bool DataLintNamespace::isALocalizedStringAsset(char const *text) { - bool const localizedStringAsset = (strstr(text, ".stf") != NULL); + bool const localizedStringAsset = (strstr(text, ".stf") != nullptr); return localizedStringAsset; } @@ -638,8 +638,8 @@ bool DataLintNamespace::isAnObjectTemplateAsset(char const *text) { bool result = false; UNREF(text); - bool const isInTheObjectDirectory = (strstr(text, "object/") != NULL); - bool const isInTheAbstractDirectory = (strstr(text, "abstract/") != NULL); + bool const isInTheObjectDirectory = (strstr(text, "object/") != nullptr); + bool const isInTheAbstractDirectory = (strstr(text, "abstract/") != nullptr); if (isInTheObjectDirectory || isInTheAbstractDirectory) { @@ -655,7 +655,7 @@ bool DataLintNamespace::isAnObjectTemplateAsset(char const *text) //----------------------------------------------------------------------------- bool DataLintNamespace::isAPortalProprtyAsset(char const *text) { - bool const portalPropertyAsset = (strstr(text, ".pob") != NULL); + bool const portalPropertyAsset = (strstr(text, ".pob") != nullptr); return portalPropertyAsset; } @@ -663,7 +663,7 @@ bool DataLintNamespace::isAPortalProprtyAsset(char const *text) //----------------------------------------------------------------------------- bool DataLintNamespace::isAShaderTemplateAsset(char const *text) { - bool const shaderTemplateAsset = (strstr(text, "shader/") != NULL); + bool const shaderTemplateAsset = (strstr(text, "shader/") != nullptr); return shaderTemplateAsset; } @@ -671,7 +671,7 @@ bool DataLintNamespace::isAShaderTemplateAsset(char const *text) //----------------------------------------------------------------------------- bool DataLintNamespace::isASkyBoxAsset(char const *text) { - bool const skyBoxAsset = (strstr(text, "skybox/") != NULL); + bool const skyBoxAsset = (strstr(text, "skybox/") != nullptr); return skyBoxAsset; } @@ -679,7 +679,7 @@ bool DataLintNamespace::isASkyBoxAsset(char const *text) //----------------------------------------------------------------------------- bool DataLintNamespace::isASlotDescriptorAsset(char const *text) { - bool const slotDescriptorAsset = (strstr(text, "slot/descriptor/") != NULL); + bool const slotDescriptorAsset = (strstr(text, "slot/descriptor/") != nullptr); return slotDescriptorAsset; } @@ -687,7 +687,7 @@ bool DataLintNamespace::isASlotDescriptorAsset(char const *text) //----------------------------------------------------------------------------- bool DataLintNamespace::isASoundAsset(char const *text) { - bool const soundAsset = (strstr(text, "sound/") != NULL); + bool const soundAsset = (strstr(text, "sound/") != nullptr); return soundAsset; } @@ -701,7 +701,7 @@ bool DataLintNamespace::isATerrainAsset(char const *text) //----------------------------------------------------------------------------- bool DataLintNamespace::isATextureAsset(char const *text) { - bool const textureAsset = (strstr(text, ".dds") != NULL); + bool const textureAsset = (strstr(text, ".dds") != nullptr); return textureAsset; } @@ -709,7 +709,7 @@ bool DataLintNamespace::isATextureAsset(char const *text) //----------------------------------------------------------------------------- bool DataLintNamespace::isATextureRendererTemplateAsset(char const *text) { - bool const textureRendererAsset = (strstr(text, ".trt") != NULL); + bool const textureRendererAsset = (strstr(text, ".trt") != nullptr); return textureRendererAsset; } @@ -749,7 +749,7 @@ bool DataLintNamespace::isAnUnSupportedAsset(char const *text) //----------------------------------------------------------------------------- DataLint::StringPairList DataLintNamespace::getList(int const reserveCount, AssetFunction assetTypeFunction) { - DEBUG_FATAL(!m_assetList, ("DataLint::getList() - m_assetList is NULL")); + DEBUG_FATAL(!m_assetList, ("DataLint::getList() - m_assetList is nullptr")); // Create the list of terrains diff --git a/engine/shared/library/sharedDebug/src/shared/DebugFlags.cpp b/engine/shared/library/sharedDebug/src/shared/DebugFlags.cpp index c676ddeb..c82795d4 100755 --- a/engine/shared/library/sharedDebug/src/shared/DebugFlags.cpp +++ b/engine/shared/library/sharedDebug/src/shared/DebugFlags.cpp @@ -25,8 +25,8 @@ std::vector DebugFlags::ms_flagsSortedByReportPriority; void DebugFlags::config(bool &variable, const char *configSection, const char *configName) { - DEBUG_FATAL(strchr(configSection, ' ') != NULL, ("no spaces are allowed in debug flag section names: %s", configSection)); - DEBUG_FATAL(strchr(configName, ' ') != NULL, ("no spaces are allowed in debug flag names: %s", configName)); + DEBUG_FATAL(strchr(configSection, ' ') != nullptr, ("no spaces are allowed in debug flag section names: %s", configSection)); + DEBUG_FATAL(strchr(configName, ' ') != nullptr, ("no spaces are allowed in debug flag names: %s", configName)); if (configSection && configName && ConfigFile::isInstalled()) { @@ -102,9 +102,9 @@ void DebugFlags::registerFlag(bool &variable, const char *section, const char *n f.section = section; f.name = name; f.reportPriority = 0; - f.reportRoutine1 = NULL; - f.reportRoutine2 = NULL; - f.context = NULL; + f.reportRoutine1 = nullptr; + f.reportRoutine2 = nullptr; + f.context = nullptr; #ifdef _DEBUG f.m_callStack.sample(); #endif @@ -127,8 +127,8 @@ void DebugFlags::registerFlag(bool &variable, const char *section, const char *n f.name = name; f.reportPriority = reportPriority; f.reportRoutine1 = reportRoutine; - f.reportRoutine2 = NULL; - f.context = NULL; + f.reportRoutine2 = nullptr; + f.context = nullptr; #ifdef _DEBUG f.m_callStack.sample(); #endif @@ -150,7 +150,7 @@ void DebugFlags::registerFlag(bool &variable, const char *section, const char *n f.section = section; f.name = name; f.reportPriority = reportPriority; - f.reportRoutine1 = NULL; + f.reportRoutine1 = nullptr; f.reportRoutine2 = reportRoutine; f.context = context; #ifdef _DEBUG @@ -230,7 +230,7 @@ DebugFlags::Flag const * DebugFlags::getFlag(char const * const section, char co return &f; } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedDebug/src/shared/DebugKey.cpp b/engine/shared/library/sharedDebug/src/shared/DebugKey.cpp index 1fb1eefe..3fd2a330 100755 --- a/engine/shared/library/sharedDebug/src/shared/DebugKey.cpp +++ b/engine/shared/library/sharedDebug/src/shared/DebugKey.cpp @@ -108,7 +108,7 @@ bool DebugKey::isDown(int i) bool DebugKey::isActive() { #if PRODUCTION == 0 - return ms_currentFlag != NULL; + return ms_currentFlag != nullptr; #else return false; #endif diff --git a/engine/shared/library/sharedDebug/src/shared/InstallTimer.cpp b/engine/shared/library/sharedDebug/src/shared/InstallTimer.cpp index 5fe48326..80e21bc9 100755 --- a/engine/shared/library/sharedDebug/src/shared/InstallTimer.cpp +++ b/engine/shared/library/sharedDebug/src/shared/InstallTimer.cpp @@ -64,7 +64,7 @@ void InstallTimer::manualExit() unsigned long const endingNumberOfBytesAllocated = MemoryManager::getCurrentNumberOfBytesAllocated(); --ms_indent; REPORT_LOG_PRINT(ms_enabled, ("InstallTimer:%*c%6.4f %d %s\n", ms_indent * 2, ' ', m_performanceTimer.getElapsedTime(), static_cast(endingNumberOfBytesAllocated - m_startingNumberOfBytesAllocated), m_description)); - m_description = NULL; + m_description = nullptr; } } diff --git a/engine/shared/library/sharedDebug/src/shared/PixCounter.cpp b/engine/shared/library/sharedDebug/src/shared/PixCounter.cpp index dcb14966..b0a63e6d 100755 --- a/engine/shared/library/sharedDebug/src/shared/PixCounter.cpp +++ b/engine/shared/library/sharedDebug/src/shared/PixCounter.cpp @@ -83,13 +83,13 @@ void PixCounterNamespace::remove() { #ifdef _WIN32 FreeLibrary(ms_pixDll); - ms_pixDll = NULL; + ms_pixDll = nullptr; #endif - ms_setCounterFloat = NULL; - ms_setCounterInt = NULL; - ms_setCounterInt64 = NULL; - ms_setCounterString = NULL; + ms_setCounterFloat = nullptr; + ms_setCounterInt = nullptr; + ms_setCounterInt64 = nullptr; + ms_setCounterString = nullptr; // Make sure the counter memory gets freed at this point Counters().swap(ms_counters); @@ -379,7 +379,7 @@ PixCounter::String::String() : Counter(), m_enabled(false), m_lastFrameValue(), - m_lastFrameValuePointer(NULL), + m_lastFrameValuePointer(nullptr), m_currentValue() { } diff --git a/engine/shared/library/sharedDebug/src/shared/Profiler.cpp b/engine/shared/library/sharedDebug/src/shared/Profiler.cpp index eb484451..59e92811 100755 --- a/engine/shared/library/sharedDebug/src/shared/Profiler.cpp +++ b/engine/shared/library/sharedDebug/src/shared/Profiler.cpp @@ -238,7 +238,7 @@ void Profiler::install() ms_profilerEntriesCurrent = &ms_profilerEntries1; ms_profilerEntriesLast = &ms_profilerEntries2; - ms_rootVisibleExpandableEntry = new VisibleExpandableEntry(NULL); + ms_rootVisibleExpandableEntry = new VisibleExpandableEntry(nullptr); ms_rootVisibleExpandableEntry->setExpanded(true); ms_selectedVisibleExpandableEntry = ms_rootVisibleExpandableEntry; } @@ -248,13 +248,13 @@ void Profiler::install() void Profiler::remove() { delete ms_rootVisibleExpandableEntry; - ms_rootVisibleExpandableEntry = NULL; - ms_beforeSelectedVisibleExpandableEntry = NULL; - ms_selectedVisibleExpandableEntry = NULL; - ms_afterSelectedVisibleExpandableEntry = NULL; - ms_previousVisibleExpandableEntry = NULL; - ms_profilerEntriesCurrent = NULL; - ms_profilerEntriesLast = NULL; + ms_rootVisibleExpandableEntry = nullptr; + ms_beforeSelectedVisibleExpandableEntry = nullptr; + ms_selectedVisibleExpandableEntry = nullptr; + ms_afterSelectedVisibleExpandableEntry = nullptr; + ms_previousVisibleExpandableEntry = nullptr; + ms_profilerEntriesCurrent = nullptr; + ms_profilerEntriesLast = nullptr; } // ---------------------------------------------------------------------- @@ -374,11 +374,11 @@ bool ProfilerNamespace::formatEntry(int indent, ProfilerTimer::Type totalTime, i void ProfilerNamespace::processEntry(char const *rootName, int indent, ProfilerEntry const & entry, VisibleExpandableEntry * visibleExpandableEntry) { if (rootName == entry.name) - rootName = NULL; + rootName = nullptr; if (!rootName) { - if (!formatEntry(indent, entry.totalTime, entry.totalCalls, visibleExpandableEntry != NULL, visibleExpandableEntry && visibleExpandableEntry->isExpanded(), visibleExpandableEntry == ms_selectedVisibleExpandableEntry, entry.name)) + if (!formatEntry(indent, entry.totalTime, entry.totalCalls, visibleExpandableEntry != nullptr, visibleExpandableEntry && visibleExpandableEntry->isExpanded(), visibleExpandableEntry == ms_selectedVisibleExpandableEntry, entry.name)) return; } @@ -410,7 +410,7 @@ void ProfilerNamespace::processEntry(char const *rootName, int indent, ProfilerE if (child.children.empty()) { - processEntry(rootName, indent, child, NULL); + processEntry(rootName, indent, child, nullptr); } else { @@ -483,9 +483,9 @@ void ProfilerNamespace::generateReport() ms_rootVisibleExpandableEntry->markAllChildrenInvisible(); ms_rootVisibleExpandableEntry->findOrAddExpandableChild(rootEntry.name); - ms_previousVisibleExpandableEntry = NULL; - ms_beforeSelectedVisibleExpandableEntry = NULL; - ms_afterSelectedVisibleExpandableEntry = NULL; + ms_previousVisibleExpandableEntry = nullptr; + ms_beforeSelectedVisibleExpandableEntry = nullptr; + ms_afterSelectedVisibleExpandableEntry = nullptr; processEntry(ms_rootProfilerName, 0, rootEntry, ms_rootVisibleExpandableEntry); if (ms_rootVisibleExpandableEntry->pruneInvisibleChildren()) @@ -494,7 +494,7 @@ void ProfilerNamespace::generateReport() if (ms_setRoot) { if (ms_rootProfilerName) - ms_rootProfilerName = NULL; + ms_rootProfilerName = nullptr; else ms_rootProfilerName = ms_selectedVisibleExpandableEntry->getName(); ms_setRoot = false; @@ -720,7 +720,7 @@ void ProfilerNamespace::enterWithTime(char const *name, ProfilerTimer::Type time // search for another call to this block from the parent int entryIndex = -1; - ProfilerEntry *entry = NULL; + ProfilerEntry *entry = nullptr; if (!ms_profilerEntryStack.empty()) { ProfilerEntry &parent = (*ms_profilerEntriesCurrent)[ms_profilerEntryStack.back()]; diff --git a/engine/shared/library/sharedDebug/src/shared/RemoteDebug.cpp b/engine/shared/library/sharedDebug/src/shared/RemoteDebug.cpp index c9e832b9..e6b40c19 100755 --- a/engine/shared/library/sharedDebug/src/shared/RemoteDebug.cpp +++ b/engine/shared/library/sharedDebug/src/shared/RemoteDebug.cpp @@ -92,10 +92,10 @@ void RemoteDebug::remove(void) return; } - ms_removeFunction = NULL; - ms_openFunction = NULL; - ms_closeFunction = NULL; - ms_sendFunction = NULL; + ms_removeFunction = nullptr; + ms_openFunction = nullptr; + ms_closeFunction = nullptr; + ms_sendFunction = nullptr; //empty out session-level data for (StreamMap::iterator it = ms_streams->begin(); it != ms_streams->end(); ++it) @@ -147,7 +147,7 @@ uint32 RemoteDebug::registerStream(const std::string& streamName) DEBUG_FATAL(!ms_installed, ("remoteDebug not installed")); uint32 streamNum = 0; - Channel *parent = NULL; + Channel *parent = nullptr; std::string base; std::string rest = streamName; //look for subchannels with a double backslash @@ -203,7 +203,7 @@ uint32 RemoteDebug::registerStaticView(const std::string& channelName) { DEBUG_FATAL(!ms_installed, ("remoteDebug not installed")); uint32 staticViewNum = 0; - Channel *parent = NULL; + Channel *parent = nullptr; std::string base; std::string rest = channelName; //look for subchannels with a double backslash @@ -356,7 +356,7 @@ uint32 RemoteDebug::registerVariable(const char* variableName, void *memLoc, VAR std::string variable = variableName; uint32 variableNum = 0; - Channel *parent = NULL; + Channel *parent = nullptr; std::string base; std::string rest = variable; //look for subchannels with a double backslash @@ -375,7 +375,7 @@ uint32 RemoteDebug::registerVariable(const char* variableName, void *memLoc, VAR //only add the variable if we don't have it yet if (variableNumber == -1) { - registerVariable(newBase.c_str(), NULL, BOOL, sendToClients); + registerVariable(newBase.c_str(), nullptr, BOOL, sendToClients); } //look for any other subChannel uint32 oldRestIndex = restIndex; diff --git a/engine/shared/library/sharedDebug/src/shared/RemoteDebug.h b/engine/shared/library/sharedDebug/src/shared/RemoteDebug.h index 8f24d6af..f2b7070c 100755 --- a/engine/shared/library/sharedDebug/src/shared/RemoteDebug.h +++ b/engine/shared/library/sharedDebug/src/shared/RemoteDebug.h @@ -62,7 +62,7 @@ public: { INT, //32 bit signed int FLOAT, //32 bit signed float - CSTRING, //null terminated char[] + CSTRING, //nullptr terminated char[] BOOL //0 or 1 (could use an int, but useful for tools) }; @@ -92,7 +92,7 @@ public: static void install(RemoveFunction, OpenFunction, CloseFunction, SendFunction, IsReadyFunction); ///open a session - static void open(const char *server = NULL, uint16 port = 0); + static void open(const char *server = nullptr, uint16 port = 0); ///packs the data into a packet, and sends it using the client-defined SendFunction static void send(MESSAGE_TYPE type, const char* name = ""); diff --git a/engine/shared/library/sharedDebug/src/shared/RemoteDebug_inner.cpp b/engine/shared/library/sharedDebug/src/shared/RemoteDebug_inner.cpp index da1f9878..e945d875 100755 --- a/engine/shared/library/sharedDebug/src/shared/RemoteDebug_inner.cpp +++ b/engine/shared/library/sharedDebug/src/shared/RemoteDebug_inner.cpp @@ -30,7 +30,7 @@ uint32 RemoteDebugServer::ms_inputTarget; // ====================================================================== RemoteDebug::Channel::Channel(const std::string& name, Channel *parent) -: m_name(NULL), +: m_name(nullptr), m_parent(parent) { m_name = new std::string(name); @@ -41,16 +41,16 @@ RemoteDebug::Channel::Channel(const std::string& name, Channel *parent) RemoteDebug::Channel::~Channel() { - m_parent = NULL; + m_parent = nullptr; if(m_name) { delete m_name; - m_name = NULL; + m_name = nullptr; } if (m_children) { delete m_children; - m_children = NULL; + m_children = nullptr; } } @@ -72,7 +72,7 @@ const std::string& RemoteDebug::Channel::name() RemoteDebug::Variable::Variable(const std::string& name, void *memLoc, VARIABLE_TYPES type) : m_memLoc(memLoc), - m_name(NULL), + m_name(nullptr), m_type(type) { m_name = new std::string(name); @@ -111,7 +111,7 @@ RemoteDebug::Variable::~Variable() if(m_name) { delete m_name; - m_name = NULL; + m_name = nullptr; } } @@ -307,7 +307,7 @@ void RemoteDebugClient::receive(const unsigned char * const message, const uint3 if (channelNumber < ms_nextVariable) return; //do not send value back to server (hence the "false") - registerVariable(ms_buffer, NULL, BOOL, false); + registerVariable(ms_buffer, nullptr, BOOL, false); if (ms_newVariableFunction) ms_newVariableFunction(channelNumber, const_cast(ms_buffer)); break; @@ -477,7 +477,7 @@ void RemoteDebugServer::receive(const unsigned char * const message, const uint3 memcpy(ms_buffer, charMessage + sizeOfMessageType + sizeOfChannelNumber + sizeOfSizeofPayload, sizeOfPayload); } - Variable* v = NULL; + Variable* v = nullptr; switch(type) { case STREAM: @@ -524,27 +524,27 @@ void RemoteDebugServer::receive(const unsigned char * const message, const uint3 break; case STATIC_UP: - if ((*ms_upFunctionMap)[ms_inputTarget] != NULL) + if ((*ms_upFunctionMap)[ms_inputTarget] != nullptr) (*ms_upFunctionMap)[ms_inputTarget](); //lint !e10, !e522 ("expecting a function" and "expected void assignment) break; case STATIC_DOWN: - if ((*ms_downFunctionMap)[ms_inputTarget] != NULL) + if ((*ms_downFunctionMap)[ms_inputTarget] != nullptr) (*ms_downFunctionMap)[ms_inputTarget](); //lint !e10, !e522 ("expecting a function" and "expected void assignment) break; case STATIC_LEFT: - if ((*ms_leftFunctionMap)[ms_inputTarget] != NULL) + if ((*ms_leftFunctionMap)[ms_inputTarget] != nullptr) (*ms_leftFunctionMap)[ms_inputTarget](); //lint !e10, !e522 ("expecting a function" and "expected void assignment) break; case STATIC_RIGHT: - if ((*ms_rightFunctionMap)[ms_inputTarget] != NULL) + if ((*ms_rightFunctionMap)[ms_inputTarget] != nullptr) (*ms_rightFunctionMap)[ms_inputTarget](); //lint !e10, !e522 ("expecting a function" and "expected void assignment) break; case STATIC_ENTER: - if ((*ms_enterFunctionMap)[ms_inputTarget] != NULL) + if ((*ms_enterFunctionMap)[ms_inputTarget] != nullptr) (*ms_enterFunctionMap)[ms_inputTarget](); //lint !e10, !e522 ("expecting a function" and "expected void assignment) break; diff --git a/engine/shared/library/sharedDebug/src/shared/RemoteDebug_inner.h b/engine/shared/library/sharedDebug/src/shared/RemoteDebug_inner.h index d3dd088a..8daccef3 100755 --- a/engine/shared/library/sharedDebug/src/shared/RemoteDebug_inner.h +++ b/engine/shared/library/sharedDebug/src/shared/RemoteDebug_inner.h @@ -29,13 +29,13 @@ class RemoteDebug::Channel NodeList* m_children; ///the fully qualified name of the channel std::string* m_name; - ///its parent (which is NULL for top-level nodes + ///its parent (which is nullptr for top-level nodes Channel *m_parent; }; /** This class stores data about a variable channel, both on the server (where the variable actually * resides), and the client (which just displays it). The client simply creates Variable's with - * NULL'd out memLoc's, since it doesn't have direct access to the memory. + * nullptr'd out memLoc's, since it doesn't have direct access to the memory. */ class RemoteDebug::Variable { diff --git a/engine/shared/library/sharedDebug/src/shared/Report.cpp b/engine/shared/library/sharedDebug/src/shared/Report.cpp index 69de29bd..5f7f8082 100755 --- a/engine/shared/library/sharedDebug/src/shared/Report.cpp +++ b/engine/shared/library/sharedDebug/src/shared/Report.cpp @@ -175,7 +175,7 @@ void Report::puts(const char *buffer) // if (flags & RF_fatal) // title = "Fatal Report"; - // MessageBox(NULL, buffer, title, MB_OK | MB_ICONEXCLAMATION); + // MessageBox(nullptr, buffer, title, MB_OK | MB_ICONEXCLAMATION); //} } @@ -198,7 +198,7 @@ void Report::vprintf(const char *format, va_list va) { char buffer[8 * 1024]; - // make sure the buffer is always NULL terminated + // make sure the buffer is always nullptr terminated buffer[sizeof(buffer)-1] = '\0'; // format the string diff --git a/engine/shared/library/sharedFile/src/shared/AsynchronousLoader.cpp b/engine/shared/library/sharedFile/src/shared/AsynchronousLoader.cpp index be918f39..b810a0b8 100755 --- a/engine/shared/library/sharedFile/src/shared/AsynchronousLoader.cpp +++ b/engine/shared/library/sharedFile/src/shared/AsynchronousLoader.cpp @@ -169,9 +169,9 @@ void AsynchronousLoader::install(const char *fileName) const int numberOfExtensions = iff.getChunkLengthTotal(sizeof(int32)); ms_extensionFunctionsList.reserve(numberOfExtensions); ExtensionFunctions extensionFunctions; - extensionFunctions.extension = NULL; - extensionFunctions.fetchFunction = NULL; - extensionFunctions.releaseFunction = NULL; + extensionFunctions.extension = nullptr; + extensionFunctions.fetchFunction = nullptr; + extensionFunctions.releaseFunction = nullptr; for (int i = 0; i < numberOfExtensions; ++i) { extensionFunctions.extension = ms_fileData + iff.read_int32(); @@ -235,10 +235,10 @@ void AsynchronousLoaderNamespace::remove() { DEBUG_FATAL(!ms_installed, ("not installed")); Request *request = reinterpret_cast(ms_requestMemoryBlockManager->allocate()); - request->fileRecordList = NULL; - request->callback = NULL; - request->data = NULL; - request->cachedFiles = NULL; + request->fileRecordList = nullptr; + request->callback = nullptr; + request->data = nullptr; + request->cachedFiles = nullptr; submitRequest(request); @@ -270,7 +270,7 @@ void AsynchronousLoaderNamespace::remove() ms_cachedFilesPool.clear(); delete ms_requestMemoryBlockManager; - ms_requestMemoryBlockManager = NULL; + ms_requestMemoryBlockManager = nullptr; } // ---------------------------------------------------------------------- @@ -369,7 +369,7 @@ void AsynchronousLoader::add(const char *fileName, Callback callback, void *data request->fileRecordList = i->second; request->callback = callback; request->data = data; - request->cachedFiles = NULL; + request->cachedFiles = nullptr; submitRequest(request); } else @@ -390,8 +390,8 @@ void AsynchronousLoader::remove(Callback callback, void *data) for (Requests::iterator i = ms_pendingRequests.begin(); i != iEnd; ++i) if ((*i)->callback == callback && (*i)->data == data) { - (*i)->callback = NULL; - (*i)->data = NULL; + (*i)->callback = nullptr; + (*i)->data = nullptr; } } @@ -400,8 +400,8 @@ void AsynchronousLoader::remove(Callback callback, void *data) for (Requests::iterator i = ms_completedRequests.begin(); i != iEnd; ++i) if ((*i)->callback == callback && (*i)->data == data) { - (*i)->callback = NULL; - (*i)->data = NULL; + (*i)->callback = nullptr; + (*i)->data = nullptr; } } @@ -466,8 +466,8 @@ void AsynchronousLoaderNamespace::threadRoutine() CachedFile cachedFile; cachedFile.fileRecord = fileRecord; - cachedFile.file = NULL; - cachedFile.resource = NULL; + cachedFile.file = nullptr; + cachedFile.resource = nullptr; // check if the resource is already loaded if (!fileRecord->alreadyCached) @@ -622,7 +622,7 @@ void AsynchronousLoader::processCallbacks() else bytes += cachedFile.file->length(); TreeFile::addCachedFile(cachedFile.fileRecord->fileName, cachedFile.file); - cachedFile.file = NULL; + cachedFile.file = nullptr; } } } @@ -653,13 +653,13 @@ void AsynchronousLoader::processCallbacks() else bytes += cachedFile.file->length(); delete cachedFile.file; - cachedFile.file = NULL; + cachedFile.file = nullptr; } if (cachedFile.resource) { ms_extensionFunctionsList[cachedFile.fileRecord->extensionFunctionsIndex].releaseFunction(cachedFile.resource); - cachedFile.resource = NULL; + cachedFile.resource = nullptr; } } request->cachedFiles->clear(); @@ -667,7 +667,7 @@ void AsynchronousLoader::processCallbacks() ms_mutex.enter(); ms_cachedFilesPool.push_back(request->cachedFiles); - request->cachedFiles = NULL; + request->cachedFiles = nullptr; ms_mutex.leave(); } diff --git a/engine/shared/library/sharedFile/src/shared/FileManifest.cpp b/engine/shared/library/sharedFile/src/shared/FileManifest.cpp index ecf1becf..c5552775 100755 --- a/engine/shared/library/sharedFile/src/shared/FileManifest.cpp +++ b/engine/shared/library/sharedFile/src/shared/FileManifest.cpp @@ -73,8 +73,8 @@ void FileManifest::install() s_accessThreshold = ConfigFile::getKeyInt("SharedFile", "fileManifestAccessThreshold", -1, s_accessThreshold); // if we are developing, and want to update the manifest, read in the tab file as well - const char * manifestFile = ConfigFile::getKeyString("SharedFile", "updateFileManifest", 0, NULL); - if (manifestFile != NULL) + const char * manifestFile = ConfigFile::getKeyString("SharedFile", "updateFileManifest", 0, nullptr); + if (manifestFile != nullptr) { s_updateManifest = true; @@ -183,8 +183,8 @@ void FileManifest::remove() #if PRODUCTION == 0 // dump out the new manifest if requested - const char * manifestFile = ConfigFile::getKeyString("SharedFile", "updateFileManifest", 0, NULL); - if (manifestFile != NULL) + const char * manifestFile = ConfigFile::getKeyString("SharedFile", "updateFileManifest", 0, nullptr); + if (manifestFile != nullptr) { StdioFile outputFile(manifestFile,"w"); DEBUG_FATAL(!outputFile.isOpen(), ("FileManifest::remove(): Could not open %s for writing.", manifestFile)); @@ -201,7 +201,7 @@ void FileManifest::remove() { if (!i->second) { - DEBUG_WARNING(true, ("FileManifest::remove(): Found a null pointer in the fileManifest map!\n")); + DEBUG_WARNING(true, ("FileManifest::remove(): Found a nullptr pointer in the fileManifest map!\n")); continue; } diff --git a/engine/shared/library/sharedFile/src/shared/FileNameUtils.cpp b/engine/shared/library/sharedFile/src/shared/FileNameUtils.cpp index 01ac3c98..58912176 100755 --- a/engine/shared/library/sharedFile/src/shared/FileNameUtils.cpp +++ b/engine/shared/library/sharedFile/src/shared/FileNameUtils.cpp @@ -59,9 +59,9 @@ bool FileNameUtils::isReadable(std::string const &path) { FILE *fp = fopen(path.c_str(), "r"); - result = (fp != NULL); + result = (fp != nullptr); - if (fp != NULL) + if (fp != nullptr) { fclose(fp); } @@ -79,9 +79,9 @@ bool FileNameUtils::isWritable(std::string const &path) { FILE *fp = fopen(path.c_str(), "w"); - result = (fp != NULL); + result = (fp != nullptr); - if (fp != NULL) + if (fp != nullptr) { fclose(fp); } diff --git a/engine/shared/library/sharedFile/src/shared/FileStreamer.cpp b/engine/shared/library/sharedFile/src/shared/FileStreamer.cpp index 6c47b26c..ff5eec8d 100755 --- a/engine/shared/library/sharedFile/src/shared/FileStreamer.cpp +++ b/engine/shared/library/sharedFile/src/shared/FileStreamer.cpp @@ -109,11 +109,11 @@ int FileStreamer::getFileSize(const char *fileName) FileStreamer::File *FileStreamer::open(const char *fileName, bool randomAccess) { DEBUG_FATAL(!ms_installed, ("not installed")); - DEBUG_FATAL(!fileName, ("file name null")); + DEBUG_FATAL(!fileName, ("file name nullptr")); OsFile *osFile = OsFile::open(fileName, randomAccess); if (!osFile) - return NULL; + return nullptr; #if PRODUCTION // Stop checking the fileName if one of these returns true @@ -150,7 +150,7 @@ void FileStreamer::File::install(bool useThread) void FileStreamer::File::remove() { delete ms_memoryBlockManager; - ms_memoryBlockManager = NULL; + ms_memoryBlockManager = nullptr; } // ---------------------------------------------------------------------- @@ -192,7 +192,7 @@ FileStreamer::File::~File() bool FileStreamer::File::isOpen() const { - return m_osFile != NULL; + return m_osFile != nullptr; } // ---------------------------------------------------------------------- @@ -249,7 +249,7 @@ void FileStreamer::File::close() if (isOpen()) { delete m_osFile; - m_osFile = NULL; + m_osFile = nullptr; } } diff --git a/engine/shared/library/sharedFile/src/shared/FileStreamerFile.cpp b/engine/shared/library/sharedFile/src/shared/FileStreamerFile.cpp index d6a798d5..e579ab9e 100755 --- a/engine/shared/library/sharedFile/src/shared/FileStreamerFile.cpp +++ b/engine/shared/library/sharedFile/src/shared/FileStreamerFile.cpp @@ -93,7 +93,7 @@ FileStreamerFile::~FileStreamerFile() bool FileStreamerFile::isOpen() const { - return m_file != NULL; + return m_file != nullptr; } // ---------------------------------------------------------------------- @@ -174,7 +174,7 @@ void FileStreamerFile::close() { if (m_owner) delete m_file; - m_file = NULL; + m_file = nullptr; } // ====================================================================== diff --git a/engine/shared/library/sharedFile/src/shared/FileStreamerThread.cpp b/engine/shared/library/sharedFile/src/shared/FileStreamerThread.cpp index 1d3c0b8c..a0789e5b 100755 --- a/engine/shared/library/sharedFile/src/shared/FileStreamerThread.cpp +++ b/engine/shared/library/sharedFile/src/shared/FileStreamerThread.cpp @@ -294,34 +294,34 @@ void FileStreamerThread::threadRoutine() //get the request to service ms_queueCriticalSection.enter(); - request = NULL; + request = nullptr; //if there is an AudioVideo request, service it first (interrupting any current data request) if (ms_firstAudioVideoRequest) { request = ms_firstAudioVideoRequest; ms_firstAudioVideoRequest = ms_firstAudioVideoRequest->next; - if (ms_firstAudioVideoRequest == NULL) - ms_lastAudioVideoRequest = NULL; - request->next = NULL; + if (ms_firstAudioVideoRequest == nullptr) + ms_lastAudioVideoRequest = nullptr; + request->next = nullptr; } else if (ms_firstDataRequest) { request = ms_firstDataRequest; ms_firstDataRequest = ms_firstDataRequest->next; - if (ms_firstDataRequest == NULL) - ms_lastDataRequest = NULL; - request->next = NULL; + if (ms_firstDataRequest == nullptr) + ms_lastDataRequest = nullptr; + request->next = nullptr; } else if (ms_firstLowRequest) { request = ms_firstLowRequest; ms_firstLowRequest = ms_firstLowRequest->next; - if (ms_firstLowRequest == NULL) - ms_lastLowRequest = NULL; - request->next = NULL; + if (ms_firstLowRequest == nullptr) + ms_lastLowRequest = nullptr; + request->next = nullptr; } else { @@ -369,7 +369,7 @@ void FileStreamerThread::Request::install() void FileStreamerThread::Request::remove() { delete ms_memoryBlockManager; - ms_memoryBlockManager = NULL; + ms_memoryBlockManager = nullptr; } // ---------------------------------------------------------------------- @@ -395,15 +395,15 @@ void FileStreamerThread::Request::operator delete(void *pointer) // ---------------------------------------------------------------------- FileStreamerThread::Request::Request() -: next(NULL), +: next(nullptr), type(Request::Unknown), - osFile(NULL), + osFile(nullptr), buffer(0), bytesToBeRead(0), bytesRead(0), - gate(NULL), + gate(nullptr), priority(AbstractFile::PriorityData), - returnValue(NULL) + returnValue(nullptr) { } @@ -412,10 +412,10 @@ FileStreamerThread::Request::Request() FileStreamerThread::Request::~Request() { #ifdef _DEBUG - next = NULL; - buffer = NULL; - gate = NULL; - returnValue = NULL; + next = nullptr; + buffer = nullptr; + gate = nullptr; + returnValue = nullptr; #endif } diff --git a/engine/shared/library/sharedFile/src/shared/Iff.cpp b/engine/shared/library/sharedFile/src/shared/Iff.cpp index 212ef576..48eaeed1 100755 --- a/engine/shared/library/sharedFile/src/shared/Iff.cpp +++ b/engine/shared/library/sharedFile/src/shared/Iff.cpp @@ -146,11 +146,11 @@ bool Iff::isValid(char const * fileName) int const fileLength = file->length(); byte *data = file->readEntireFileAndClose(); delete file; - file = NULL; + file = nullptr; bool const result = IffNamespace::isValid(data, fileLength); delete [] data; - data = NULL; + data = nullptr; return result; } @@ -167,12 +167,12 @@ bool Iff::isValid(char const * fileName) // Iff::open() Iff::Iff(void) -: fileName(NULL), +: fileName(nullptr), maxStackDepth(DEFAULT_STACK_DEPTH), stackDepth(0), stack(new Stack[DEFAULT_STACK_DEPTH]), length(0), - data(NULL), + data(nullptr), inChunk(false), growable(false), nonlinear(false), @@ -207,7 +207,7 @@ Iff::Iff(void) */ Iff::Iff(int newDataSize, const byte *newData, bool iffOwnsData) : - fileName(NULL), + fileName(nullptr), maxStackDepth(DEFAULT_STACK_DEPTH), stackDepth(0), stack(new Stack[DEFAULT_STACK_DEPTH]), @@ -242,12 +242,12 @@ Iff::Iff(int newDataSize, const byte *newData, bool iffOwnsData) : */ Iff::Iff(const char *newFileName, bool optional) -: fileName(NULL), +: fileName(nullptr), maxStackDepth(DEFAULT_STACK_DEPTH), stackDepth(0), stack(new Stack[DEFAULT_STACK_DEPTH]), length(0), - data(NULL), + data(nullptr), inChunk(false), growable(false), nonlinear(false), @@ -270,7 +270,7 @@ Iff::Iff(const char *newFileName, bool optional) */ Iff::Iff(int initialSize, bool isGrowable, bool clearDataBuffer) -: fileName(NULL), +: fileName(nullptr), maxStackDepth(DEFAULT_STACK_DEPTH), stackDepth(0), stack(new Stack[DEFAULT_STACK_DEPTH]), @@ -384,7 +384,7 @@ void Iff::open(AbstractFile & file, char const * const newFileName) DEBUG_FATAL(data, ("causing memory leak")); data = file.readEntireFileAndClose(); - FATAL(ConfigSharedFile::getValidateIff() && !IffNamespace::isValid(data, length), ("File corruption detected! Iff::isValid failed for %s (size=%d, crc=%08X). Please try a \"Full Scan\" from the LaunchPad.", newFileName ? newFileName : "null", length, Crc::calculate(data, length))); + FATAL(ConfigSharedFile::getValidateIff() && !IffNamespace::isValid(data, length), ("File corruption detected! Iff::isValid failed for %s (size=%d, crc=%08X). Please try a \"Full Scan\" from the LaunchPad.", newFileName ? newFileName : "nullptr", length, Crc::calculate(data, length))); // setup the stack data to know about the data stack[0].start = 0; @@ -406,11 +406,11 @@ void Iff::open(AbstractFile & file, char const * const newFileName) void Iff::close(void) { delete [] fileName; - fileName = NULL; + fileName = nullptr; if (ownsData) delete [] data; - data = NULL; //lint !e672 // possible memory leak in assignment to Iff::data // no, we only delete when we own it + data = nullptr; //lint !e672 // possible memory leak in assignment to Iff::data // no, we only delete when we own it stackDepth = 0; } @@ -886,7 +886,7 @@ void Iff::insertChunkFloatQuaternion(const Quaternion &quaternion) * Insert a string into the current chunk at the current location. * * This routine will call insertChunkData(const void *, int length) - * with the string using its string length (plus one for the null + * with the string using its string length (plus one for the nullptr * terminator). */ @@ -1555,10 +1555,10 @@ void Iff::read_string(char *string, int maxLength) *string = *source; } - // step over the null terminator on the input + // step over the nullptr terminator on the input ++s.used; - // null terminate the output string + // nullptr terminate the output string DEBUG_FATAL(maxLength <= 0, ("destination string too short")); *string = '\0'; } @@ -1594,7 +1594,7 @@ char *Iff::read_string(void) for ( ; sourceLength < maxLength && source[sourceLength]; ++sourceLength) ; - // verify that we found the null terminator + // verify that we found the nullptr terminator DEBUG_FATAL(sourceLength >= maxLength, ("hit end of chunk before string terminator")); // create and copy the string @@ -1634,10 +1634,10 @@ void Iff::read_string(std::string &string) for ( ; sourceLength < maxLength && source[sourceLength]; ++sourceLength) ; - // verify that we found the null terminator + // verify that we found the nullptr terminator DEBUG_FATAL(sourceLength >= maxLength, ("hit end of chunk before string terminator")); - // account for the null terminator + // account for the nullptr terminator ++sourceLength; s.used += sourceLength; diff --git a/engine/shared/library/sharedFile/src/shared/Iff.h b/engine/shared/library/sharedFile/src/shared/Iff.h index 71e07c44..1fe0660a 100755 --- a/engine/shared/library/sharedFile/src/shared/Iff.h +++ b/engine/shared/library/sharedFile/src/shared/Iff.h @@ -250,7 +250,7 @@ public: Unicode::String read_unicodeString(); #if 0 - real *read_float (int count, real *array=NULL); + real *read_float (int count, real *array=nullptr); #endif }; @@ -294,7 +294,7 @@ inline int Iff::getRawDataSize(void) const * to store raw iff data via a mechanism other than Iff::write(). * * @return A read-only pointer to the data buffer containing the raw Iff data - * managed by this Iff object. It may be NULL if no data is currently + * managed by this Iff object. It may be nullptr if no data is currently * managed by the Iff. * @see Iff::getRawDataSize(), Iff::write() */ diff --git a/engine/shared/library/sharedFile/src/shared/IndentedFileWriter.cpp b/engine/shared/library/sharedFile/src/shared/IndentedFileWriter.cpp index 2c5eb7f2..013c7204 100755 --- a/engine/shared/library/sharedFile/src/shared/IndentedFileWriter.cpp +++ b/engine/shared/library/sharedFile/src/shared/IndentedFileWriter.cpp @@ -23,7 +23,7 @@ IndentedFileWriter *IndentedFileWriter::createWriter(char const *filename) { // Kill the new writer since we weren't able to open the file for writing. delete newWriter; - return NULL; + return nullptr; } } @@ -36,7 +36,7 @@ IndentedFileWriter::~IndentedFileWriter() if (m_file) { fclose(m_file); - m_file = NULL; + m_file = nullptr; } } @@ -63,8 +63,8 @@ void IndentedFileWriter::unindent() void IndentedFileWriter::writeLine(char const *line) const { - FATAL(!m_file, ("writeLine(): m_file is NULL, programmer error.")); - FATAL(!line, ("writeLine(): line argument is NULL.")); + FATAL(!m_file, ("writeLine(): m_file is nullptr, programmer error.")); + FATAL(!line, ("writeLine(): line argument is nullptr.")); //-- Write one tab for each indentation level. for (int i = 0; i < m_indentCount; ++i) @@ -92,7 +92,7 @@ void IndentedFileWriter::writeLineFormat(char const *format, ...) const int const formatCount = vsnprintf(buffer, sizeof(buffer), format, varArgList); UNREF(formatCount); - //-- Ensure it's null terminated. + //-- Ensure it's nullptr terminated. buffer[sizeof(buffer) - 1] = '\0'; //-- Do the real print. @@ -108,7 +108,7 @@ void IndentedFileWriter::writeLineFormat(char const *format, ...) const IndentedFileWriter::IndentedFileWriter() : m_indentCount(0), - m_file(NULL) + m_file(nullptr) { } @@ -123,7 +123,7 @@ bool IndentedFileWriter::createFile(char const *filename) } m_file = fopen(filename, "w"); - return (m_file != NULL); + return (m_file != nullptr); } // ====================================================================== diff --git a/engine/shared/library/sharedFile/src/shared/MemoryFile.cpp b/engine/shared/library/sharedFile/src/shared/MemoryFile.cpp index 4c023f8c..d09b3c99 100755 --- a/engine/shared/library/sharedFile/src/shared/MemoryFile.cpp +++ b/engine/shared/library/sharedFile/src/shared/MemoryFile.cpp @@ -70,7 +70,7 @@ MemoryFile::MemoryFile(byte *buffer, int length) MemoryFile::MemoryFile(AbstractFile *file) : AbstractFile(PriorityData), - m_buffer(NULL), + m_buffer(nullptr), m_length(file->length()), m_offset(0) { @@ -88,7 +88,7 @@ MemoryFile::~MemoryFile() bool MemoryFile::isOpen() const { - return m_buffer != NULL; + return m_buffer != nullptr; } // ---------------------------------------------------------------------- @@ -162,7 +162,7 @@ int MemoryFile::write(int, const void *) void MemoryFile::close() { delete [] m_buffer; - m_buffer = NULL; + m_buffer = nullptr; } // ---------------------------------------------------------------------- @@ -170,7 +170,7 @@ void MemoryFile::close() byte *MemoryFile::readEntireFileAndClose() { byte *result = m_buffer; - m_buffer = NULL; + m_buffer = nullptr; return result; } diff --git a/engine/shared/library/sharedFile/src/shared/TreeFile.cpp b/engine/shared/library/sharedFile/src/shared/TreeFile.cpp index 09acf384..6c53bff5 100755 --- a/engine/shared/library/sharedFile/src/shared/TreeFile.cpp +++ b/engine/shared/library/sharedFile/src/shared/TreeFile.cpp @@ -123,7 +123,7 @@ void TreeFile::install(uint32 skuBits) sprintf(buffer, "searchPath%s%d", skuText, priority); char const * result; - for (int index = 0; (result = ConfigFile::getKeyString("SharedFile", buffer, index, NULL)) != NULL; ++index) + for (int index = 0; (result = ConfigFile::getKeyString("SharedFile", buffer, index, nullptr)) != nullptr; ++index) TreeFile::addSearchPath(result, priority); } @@ -133,7 +133,7 @@ void TreeFile::install(uint32 skuBits) sprintf(buffer, "searchTree%s%d", skuText, priority); char const * result; - for (int index = 0; (result = ConfigFile::getKeyString("SharedFile", buffer, index, NULL)) != NULL; ++index) + for (int index = 0; (result = ConfigFile::getKeyString("SharedFile", buffer, index, nullptr)) != nullptr; ++index) TreeFile::addSearchTree(result, priority); } @@ -143,7 +143,7 @@ void TreeFile::install(uint32 skuBits) sprintf(buffer, "searchTOC%s%d", skuText, priority); char const * result; - for (int index = 0; (result = ConfigFile::getKeyString("SharedFile", buffer, index, NULL)) != NULL; ++index) + for (int index = 0; (result = ConfigFile::getKeyString("SharedFile", buffer, index, nullptr)) != nullptr; ++index) TreeFile::addSearchTOC(result, priority); } } @@ -430,7 +430,7 @@ void TreeFile::removeAllSearches(void) * Find the node (if any) the requested file is in. * * @return Pointer to the highest priority node containing the file. If the - * file is not found, NULL is returned. If checking for filename collisions is + * file is not found, nullptr is returned. If checking for filename collisions is * set on, then this function DEBUG_FATALS if multiple files match */ @@ -440,14 +440,14 @@ TreeFile::SearchNode *TreeFile::find(const char *fileName) if (!fileName) { - DEBUG_WARNING(true, ("TreeFile::find() Cannot find a null filename")); - return NULL; + DEBUG_WARNING(true, ("TreeFile::find() Cannot find a nullptr filename")); + return nullptr; } if (fileName[0] == '\0') { DEBUG_WARNING(true, ("TreeFile::find() Cannot find an empty filename")); - return NULL; + return nullptr; } // search the list of nodes looking to see if the specified file exists @@ -457,7 +457,7 @@ TreeFile::SearchNode *TreeFile::find(const char *fileName) if ((*i)->exists(fileName, deleted)) return *i; - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -479,7 +479,7 @@ bool TreeFile::exists(const char *fileName) FileManifest::addNewManifestEntry(fixedFileName, 0); #endif - return (find(fixedFileName) != NULL); + return (find(fixedFileName) != nullptr); } // ---------------------------------------------------------------------- @@ -621,7 +621,7 @@ void TreeFile::fixUpFileName(const char *fileName, char *outName) * Find the node (if any) the requested file is in. * * @return Pointer to the highest priority node containing the file. If the - * file is not found, NULL is returned. + * file is not found, nullptr is returned. */ bool TreeFile::getPathName(const char *fileName, char *pathName, int pathNameLength) @@ -655,12 +655,12 @@ bool TreeFile::getPathName(const char *fileName, char *pathName, int pathNameLen * * @param fileName File name to open * @param allowFail True to return false on failure, otherwise Fatal - * @return pointer to a newly allocated AbstractFile-derived class (caller must delete), NULL if failure. + * @return pointer to a newly allocated AbstractFile-derived class (caller must delete), nullptr if failure. */ AbstractFile* TreeFile::open(const char *fileName, AbstractFile::PriorityType priority, bool allowFail) { - AbstractFile *file = NULL; + AbstractFile *file = nullptr; char fixedFileName[Os::MAX_PATH_LENGTH]; fixUpFileName(fixedFileName, fileName, true); @@ -678,7 +678,7 @@ AbstractFile* TreeFile::open(const char *fileName, AbstractFile::PriorityType pr if (cachedIterator != cachedFilesMap.end()) { file = cachedIterator->second; - cachedIterator->second = NULL; + cachedIterator->second = nullptr; } ms_criticalSection.leave(); @@ -747,7 +747,7 @@ AbstractFile* TreeFile::open(const char *fileName, AbstractFile::PriorityType pr FileManifest::addNewManifestEntry(fixedFileName, 0); #endif - return NULL; + return nullptr; } const int length = file->length(); @@ -787,7 +787,7 @@ const char *TreeFile::getSearchPath(int index) for (SearchNodes::iterator i = ms_searchNodes.begin(); i != iEnd; ++i) { const SearchPath *searchPath = dynamic_cast(*i); - if (searchPath != NULL) + if (searchPath != nullptr) { if (count == index) return searchPath->getPathName(); @@ -795,14 +795,14 @@ const char *TreeFile::getSearchPath(int index) } } - return NULL; + return nullptr; } //----------------------------------------------------------------- /** * This function will return the shortest trailing path of its input that * can be loaded by the TreeFile. If no files can be loaded, this routine - * will return NULL. + * will return nullptr. */ const char *TreeFile::getShortestExistingPath(const char *path) @@ -810,9 +810,9 @@ const char *TreeFile::getShortestExistingPath(const char *path) NOT_NULL(path); if (!*path) - return NULL; + return nullptr; - const char *result = NULL; + const char *result = nullptr; do { // check if this one exists @@ -866,7 +866,7 @@ bool TreeFile::stripTreeFileSearchPathFromFile(const char *inputPath, char *outp { // make sure it's a relative search path const SearchPath *searchPath = dynamic_cast(*i); - if (searchPath != NULL) + if (searchPath != nullptr) { // check to see if the the search path is a prefix for the requested path const char *path = searchPath->getPathName(); diff --git a/engine/shared/library/sharedFile/src/shared/TreeFile_SearchNode.cpp b/engine/shared/library/sharedFile/src/shared/TreeFile_SearchNode.cpp index 9c63e47d..11c7d2e3 100755 --- a/engine/shared/library/sharedFile/src/shared/TreeFile_SearchNode.cpp +++ b/engine/shared/library/sharedFile/src/shared/TreeFile_SearchNode.cpp @@ -53,7 +53,7 @@ TreeFile::SearchNode::~SearchNode(void) TreeFile::SearchPath::SearchPath(int priority, const char *path) : SearchNode(priority), - m_pathName(NULL), + m_pathName(nullptr), m_pathNameLength(0) { NOT_NULL(path); @@ -145,7 +145,7 @@ AbstractFile *TreeFile::SearchPath::open(const char *fileName, AbstractFile::Pri makeAbsolutePath(fileName, buffer); FileStreamer::File *file = FileStreamer::open(buffer); if (!file) - return NULL; + return nullptr; return new FileStreamerFile(priority, *file); } @@ -209,7 +209,7 @@ AbstractFile *TreeFile::SearchAbsolute::open(const char *fileName, AbstractFile: FileStreamer::File *file = FileStreamer::open(fileName); if (!file) - return NULL; + return nullptr; return new FileStreamerFile(priority, *file); } @@ -248,12 +248,12 @@ bool TreeFile::SearchTree::validate(const char *fileName) TreeFile::SearchTree::SearchTree(int priority, const char *fileName) : SearchNode(priority), - m_treeFileName(NULL), - m_treeFile(NULL), + m_treeFileName(nullptr), + m_treeFile(nullptr), m_version(0), m_numberOfFiles(0), - m_fileNames(NULL), - m_tableOfContents(NULL) + m_fileNames(nullptr), + m_tableOfContents(nullptr) { NOT_NULL(fileName); @@ -435,7 +435,7 @@ void TreeFile::SearchTree::debugPrint(void) bool TreeFile::SearchTree::exists(const char *fileName, bool &deleted) const { NOT_NULL(fileName); - return localExists(fileName, NULL, deleted); + return localExists(fileName, nullptr, deleted); } // ---------------------------------------------------------------------- @@ -497,7 +497,7 @@ AbstractFile *TreeFile::SearchTree::open(const char *fileName, AbstractFile::Pri return new ZlibFile(entry.length, compressedBuffer, entry.compressedLength, true); } - return NULL; + return nullptr; } // ====================================================================== @@ -535,14 +535,14 @@ bool TreeFile::SearchTOC::validate(const char *fileName) TreeFile::SearchTOC::SearchTOC(int priority, const char *fileName) : SearchNode(priority), - m_TOCFileName(NULL), - m_TOCFile(NULL), - m_treeFiles(NULL), + m_TOCFileName(nullptr), + m_TOCFile(nullptr), + m_treeFiles(nullptr), m_numberOfFiles(0), - m_treeFileNames(NULL), - m_treeFileNamePointers(NULL), - m_tableOfContents(NULL), - m_fileNames(NULL) + m_treeFileNames(nullptr), + m_treeFileNamePointers(nullptr), + m_tableOfContents(nullptr), + m_fileNames(nullptr) { NOT_NULL(fileName); @@ -587,7 +587,7 @@ TreeFile::SearchTOC::SearchTOC(int priority, const char *fileName) // add on all paths in config file const char * result; - for (int index = 0; (result = ConfigFile::getKeyString("SharedFile", "TOCTreePath", index, NULL)) != NULL; ++index) + for (int index = 0; (result = ConfigFile::getKeyString("SharedFile", "TOCTreePath", index, nullptr)) != nullptr; ++index) treePaths.push_back(result); // read in the tree file names and open the files @@ -598,7 +598,7 @@ TreeFile::SearchTOC::SearchTOC(int priority, const char *fileName) for (int treeFileNameIndex = 0, treeFileNameReadPosition = 0; treeFileNameIndex < static_cast(header.numberOfTreeFiles); treeFileNameIndex++) { m_treeFileNamePointers[treeFileNameIndex] = (m_treeFileNames + treeFileNameReadPosition); - m_treeFiles[treeFileNameIndex] = NULL; + m_treeFiles[treeFileNameIndex] = nullptr; // try to open the tree file in each of the relative paths for (std::vector::const_iterator pathIter = treePaths.begin(); pathIter != treePaths.end(); ++pathIter) @@ -656,7 +656,7 @@ TreeFile::SearchTOC::SearchTOC(int priority, const char *fileName) { currentFileNameLength = m_tableOfContents[i].fileNameOffset; m_tableOfContents[i].fileNameOffset = currentFileNameOffset; - // + 1 for the null termination + // + 1 for the nullptr termination currentFileNameOffset += (currentFileNameLength + 1); } } @@ -792,7 +792,7 @@ bool TreeFile::SearchTOC::exists(const char *fileName, bool &deleted) const { NOT_NULL(fileName); deleted = false; - return localExists(fileName, NULL); + return localExists(fileName, nullptr); } // ---------------------------------------------------------------------- @@ -862,7 +862,7 @@ AbstractFile *TreeFile::SearchTOC::open(const char *fileName, AbstractFile::Prio return new ZlibFile(entry.length, compressedBuffer, entry.compressedLength, true); } - return NULL; + return nullptr; } // ====================================================================== diff --git a/engine/shared/library/sharedFile/src/shared/ZlibFile.cpp b/engine/shared/library/sharedFile/src/shared/ZlibFile.cpp index 7c3778c7..9a498a87 100755 --- a/engine/shared/library/sharedFile/src/shared/ZlibFile.cpp +++ b/engine/shared/library/sharedFile/src/shared/ZlibFile.cpp @@ -66,7 +66,7 @@ ZlibFile::ZlibFile(int uncompressedLength, byte *compressedBuffer, int compresse m_compressedBuffer(compressedBuffer), m_compressedBufferLength(compressedBufferLength), m_ownsCompressedBuffer(ownsCompressedBuffer), - m_decompressedMemoryFile(NULL) + m_decompressedMemoryFile(nullptr) { } @@ -137,10 +137,10 @@ void ZlibFile::close() { if (m_ownsCompressedBuffer) delete [] m_compressedBuffer; - m_compressedBuffer = NULL; + m_compressedBuffer = nullptr; delete m_decompressedMemoryFile; - m_decompressedMemoryFile = NULL; + m_decompressedMemoryFile = nullptr; } // ---------------------------------------------------------------------- @@ -197,7 +197,7 @@ void ZlibFile::getZlibCompressedDataAndClose(byte *& compressedBuffer, int & com if (m_ownsCompressedBuffer) { compressedBuffer = m_compressedBuffer; - m_compressedBuffer = NULL; + m_compressedBuffer = nullptr; compressedBufferLength = m_compressedBufferLength; } else diff --git a/engine/shared/library/sharedFoundation/src/linux/Os.cpp b/engine/shared/library/sharedFoundation/src/linux/Os.cpp index 2ddccf74..b1e26987 100755 --- a/engine/shared/library/sharedFoundation/src/linux/Os.cpp +++ b/engine/shared/library/sharedFoundation/src/linux/Os.cpp @@ -97,7 +97,7 @@ void Os::installCommon(void) mainThreadId = pthread_self(); // get the name of the executable -//Can't find UNIX call for this: DWORD result = GetModuleFileName(NULL, programName, sizeof(programName)); +//Can't find UNIX call for this: DWORD result = GetModuleFileName(nullptr, programName, sizeof(programName)); strcpy(programName, "TempName"); DWORD result = 1; @@ -119,7 +119,7 @@ void Os::installCommon(void) char buffer[512]; while (!feof(f)) { - if (fgets(buffer, 512, f) != NULL) { + if (fgets(buffer, 512, f) != nullptr) { if (strncmp(buffer, "processor\t: ", 12)==0) { processorCount = atoi(buffer+12)+1; @@ -165,13 +165,13 @@ void Os::abort(void) if (!isMainThread()) { threadDied = true; - pthread_exit(NULL); + pthread_exit(nullptr); } if (!shouldReturnFromAbort) { // let the C runtime deal with the abnormal termination - int * dummy = NULL; + int * dummy = nullptr; int forceCrash = *dummy; UNREF(forceCrash); for (;;) @@ -256,14 +256,14 @@ bool Os::writeFile(const char *fileName, const void *data, int length) // Le DWORD written; // open the file for writing - handle = CreateFile(fileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + handle = CreateFile(fileName, GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); // check if it was opened if (handle == INVALID_HANDLE_VALUE) return false; // attempt to write the data - result = WriteFile(handle, data, static_cast(length), &written, NULL); + result = WriteFile(handle, data, static_cast(length), &written, nullptr); // make sure the data was written okay if (!result || written != static_cast(length)) diff --git a/engine/shared/library/sharedFoundation/src/linux/PerThreadData.cpp b/engine/shared/library/sharedFoundation/src/linux/PerThreadData.cpp index 3d7f8584..18bee813 100755 --- a/engine/shared/library/sharedFoundation/src/linux/PerThreadData.cpp +++ b/engine/shared/library/sharedFoundation/src/linux/PerThreadData.cpp @@ -81,7 +81,7 @@ PerThreadData::Data *PerThreadData::getData(bool allowReturnNull) if (!slotCreated) { DEBUG_FATAL(true && !allowReturnNull, ("not installed")); - return NULL; + return nullptr; } Data * const data = reinterpret_cast(pthread_getspecific(slot)); @@ -97,7 +97,7 @@ PerThreadData::Data *PerThreadData::getData(bool allowReturnNull) * * If the client is calling this function on a thread that existed before the engine was * installed, the client should set isNewThread to false. Setting isNewThread to false - * prevents the function from validating that the thread's TLS is NULL. For threads existing + * prevents the function from validating that the thread's TLS is nullptr. For threads existing * before the engine is installed, the TLS data for the thread is undefined. * * @param isNewThread [IN] true if the thread was created after the engine was installed, false otherwise @@ -147,10 +147,10 @@ void PerThreadData::threadRemove(void) //close the event used for file streaming reads delete data->readGate; - data->readGate = NULL; + data->readGate = nullptr; // wipe the data in the thread slot - const BOOL result2 = pthread_setspecific(slot, NULL); + const BOOL result2 = pthread_setspecific(slot, nullptr); UNREF(result2); DEBUG_FATAL(result2, ("TlsSetValue failed")); //NB: unlike Windows, returns 0 on success. diff --git a/engine/shared/library/sharedFoundation/src/linux/PerThreadData.h b/engine/shared/library/sharedFoundation/src/linux/PerThreadData.h index df4fd5f6..86adef53 100755 --- a/engine/shared/library/sharedFoundation/src/linux/PerThreadData.h +++ b/engine/shared/library/sharedFoundation/src/linux/PerThreadData.h @@ -93,7 +93,7 @@ public: * threads existing at the time of slot creation. Thus, if you build a * plugin that only initializes the engine the first time it is * used, and other threads already exist in the app, those threads - * will contain bogus non-null data in the TLS slot. If the plugin really + * will contain bogus non-nullptr data in the TLS slot. If the plugin really * wants to do lazy initialization of the engine, it will need * to handle calling PerThreadData::threadInstall() for all existing threads * (except the thread that initialized the engine, which already @@ -102,7 +102,7 @@ public: inline bool PerThreadData::isThreadInstalled(void) { - return (getData(true) != NULL); + return (getData(true) != nullptr); } // ---------------------------------------------------------------------- @@ -168,7 +168,7 @@ inline void PerThreadData::setExitChainFataling(bool newValue) * Get the first entry for the exit chain. * * This routine is not intended for general use; it should only be used by the ExitChain class. - * This routine may return NULL. + * This routine may return nullptr. * * @return Pointer to the first entry on the exit chain * @see ExitChain::isFataling() @@ -184,7 +184,7 @@ inline ExitChain::Entry *PerThreadData::getExitChainFirstEntry(void) * Set the exit chain fataling flag value. * * This routine is not intended for general use; it should only be used by the ExitChain class. - * The parameter to this routine may be NULL. + * The parameter to this routine may be nullptr. * * @param newValue New value for the exit chain first entry */ diff --git a/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.cpp b/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.cpp index 21668a79..822a4ee5 100755 --- a/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.cpp +++ b/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.cpp @@ -33,7 +33,7 @@ char* _itoa(int value, char* stringOut, int radix) bool QueryPerformanceCounter(__int64* time) { struct timeval tv; - gettimeofday(&tv, NULL); + gettimeofday(&tv, nullptr); *time = static_cast(tv.tv_sec); *time = (*time * 1000000) + static_cast(tv.tv_usec); @@ -107,7 +107,7 @@ FILE* CreateFile(const char* fileName, DWORD access, DWORD shareMode, void* unsu FILE* retval = 0; DEBUG_FATAL(flagsAndAttributes != FILE_ATTRIBUTE_NORMAL, ("Unsupported File mode call to CreateFile()")); - DEBUG_FATAL(unsupB != NULL, ("Unsupported File mode call to CreateFile()")); + DEBUG_FATAL(unsupB != nullptr, ("Unsupported File mode call to CreateFile()")); //DEBUG_FATAL(shareMode != 0, ("Unsupported File mode call to CreateFile()")); DEBUG_FATAL(unsupA != 0, ("Unsupported File mode call to CreateFile()")); @@ -118,7 +118,7 @@ FILE* CreateFile(const char* fileName, DWORD access, DWORD shareMode, void* unsu if (retval) { fclose(retval); - retval = NULL; + retval = nullptr; } else { diff --git a/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.h b/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.h index 5e92921c..0cab423f 100755 --- a/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.h +++ b/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.h @@ -46,7 +46,7 @@ void OutputDebugString(const char* stringOut); typedef FILE* HANDLE; -#define INVALID_HANDLE_VALUE NULL //Have to use a #define because this may be a FILE* +#define INVALID_HANDLE_VALUE nullptr //Have to use a #define because this may be a FILE* const int GENERIC_READ = 1 << 0; @@ -66,8 +66,8 @@ const int FILE_END = SEEK_END; const int FILE_SHARE_READ = 1; -BOOL WriteFile(FILE* hFile, const void* lpBuffer, DWORD numBytesToWrite, DWORD* numBytesWritten, void* unsup=NULL); -BOOL ReadFile(FILE* hFile, void* lpBuffer, DWORD numBytesToWrite, DWORD* numBytesRead, void* unsup=NULL); +BOOL WriteFile(FILE* hFile, const void* lpBuffer, DWORD numBytesToWrite, DWORD* numBytesWritten, void* unsup=nullptr); +BOOL ReadFile(FILE* hFile, void* lpBuffer, DWORD numBytesToWrite, DWORD* numBytesRead, void* unsup=nullptr); DWORD SetFilePointer(FILE* hFile, long lDistanceToMove, long* lpDistanceToMoveHigh, DWORD dwMoveMethod); FILE* CreateFile(const char* fileName, DWORD access, DWORD shareMode, void* unsupA, DWORD creationDisposition, DWORD flagsAndAttributes, FILE* unsup2); BOOL CloseHandle(FILE* hFile); diff --git a/engine/shared/library/sharedFoundation/src/linux/SetupSharedFoundation.cpp b/engine/shared/library/sharedFoundation/src/linux/SetupSharedFoundation.cpp index 07dec783..e54017fc 100755 --- a/engine/shared/library/sharedFoundation/src/linux/SetupSharedFoundation.cpp +++ b/engine/shared/library/sharedFoundation/src/linux/SetupSharedFoundation.cpp @@ -150,11 +150,11 @@ SetupSharedFoundation::Data::Data(Defaults defaults) case D_game: runInBackground = true; - lpCmdLine = NULL; + lpCmdLine = nullptr; argc = 0; - argv = NULL; + argv = nullptr; - configFile = NULL; + configFile = nullptr; frameRateLimit = CONST_REAL(0); break; @@ -162,11 +162,11 @@ SetupSharedFoundation::Data::Data(Defaults defaults) case D_console: runInBackground = true; - lpCmdLine = NULL; + lpCmdLine = nullptr; argc = 0; - argv = NULL; + argv = nullptr; - configFile = NULL; + configFile = nullptr; frameRateLimit = CONST_REAL(0); break; diff --git a/engine/shared/library/sharedFoundation/src/linux/vsnprintf.cpp b/engine/shared/library/sharedFoundation/src/linux/vsnprintf.cpp index 6b4c5647..069dcb48 100755 --- a/engine/shared/library/sharedFoundation/src/linux/vsnprintf.cpp +++ b/engine/shared/library/sharedFoundation/src/linux/vsnprintf.cpp @@ -21,7 +21,7 @@ // // Remarks: // -// If the buffer would overflow, the null terminating character is not written and -1 +// If the buffer would overflow, the nullptr terminating character is not written and -1 // will be returned. #ifdef _MSC_VER diff --git a/engine/shared/library/sharedFoundation/src/shared/BitArray.cpp b/engine/shared/library/sharedFoundation/src/shared/BitArray.cpp index f094d140..502b31a7 100755 --- a/engine/shared/library/sharedFoundation/src/shared/BitArray.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/BitArray.cpp @@ -35,7 +35,7 @@ m_numInUseBits(0) { if (numBits > (m_numAllocatedBytes << 3)) { - m_arrayData = NULL; + m_arrayData = nullptr; m_numAllocatedBytes = 0; reserve(numBits); m_numInUseBytes = 0; @@ -294,7 +294,7 @@ void BitArray::reserve(int const numBits) { signed char * tmp = new signed char[static_cast(m_numInUseBytes)]; memset(&(tmp[oldNumInUseBytes]), 0, static_cast(m_numInUseBytes - oldNumInUseBytes)); - if ((oldNumInUseBytes > 0) && (m_arrayData != NULL)) + if ((oldNumInUseBytes > 0) && (m_arrayData != nullptr)) memcpy(tmp, m_arrayData, static_cast(oldNumInUseBytes)); //lint !e671 !e670 logically, you can't enter this code block unless oldNumInUseBytes is smaller. m_numAllocatedBytes = m_numInUseBytes; diff --git a/engine/shared/library/sharedFoundation/src/shared/BitArray.h b/engine/shared/library/sharedFoundation/src/shared/BitArray.h index 70b04b41..082fa6b4 100755 --- a/engine/shared/library/sharedFoundation/src/shared/BitArray.h +++ b/engine/shared/library/sharedFoundation/src/shared/BitArray.h @@ -58,7 +58,7 @@ public: // for DB persistence purpose, returns the BitArray as a // std::string where each 4 bits are printed as a hex nibble; - // and the converse that takes the null-terminated string + // and the converse that takes the nullptr-terminated string // and converts it back into the BitArray void getAsDbTextString(std::string &result, int maxNibbleCount = 32767) const; void setFromDbTextString(const char * text); diff --git a/engine/shared/library/sharedFoundation/src/shared/CalendarTime.cpp b/engine/shared/library/sharedFoundation/src/shared/CalendarTime.cpp index 64595534..c73395af 100755 --- a/engine/shared/library/sharedFoundation/src/shared/CalendarTime.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/CalendarTime.cpp @@ -17,11 +17,11 @@ std::string CalendarTime::convertEpochToTimeStringGMT(time_t epoch) std::string result; struct tm * timeinfo = ::gmtime(&epoch); - if (timeinfo == NULL) + if (timeinfo == nullptr) return result; char * asciiTime = ::asctime(timeinfo); - if (asciiTime == NULL) + if (asciiTime == nullptr) return result; static char resultBuffer[512]; @@ -48,7 +48,7 @@ std::string CalendarTime::convertEpochToTimeStringGMT_YYYYMMDDHHMMSS(time_t epoc std::string result; struct tm * timeinfo = ::gmtime(&epoch); - if (timeinfo == NULL) + if (timeinfo == nullptr) return result; static char resultBuffer[512]; @@ -64,11 +64,11 @@ std::string CalendarTime::convertEpochToTimeStringLocal(time_t epoch) std::string result; struct tm * timeinfo = ::localtime(&epoch); - if (timeinfo == NULL) + if (timeinfo == nullptr) return result; char * asciiTime = ::asctime(timeinfo); - if (asciiTime == NULL) + if (asciiTime == nullptr) return result; static char resultBuffer[512]; @@ -105,7 +105,7 @@ std::string CalendarTime::convertEpochToTimeStringLocal_YYYYMMDDHHMMSS(time_t ep std::string result; struct tm * timeinfo = ::localtime(&epoch); - if (timeinfo == NULL) + if (timeinfo == nullptr) return result; static char resultBuffer[512]; @@ -218,7 +218,7 @@ time_t CalendarTime::getNextGMTTimeOcurrence(time_t const startTime, int const d // the year, month, day, day of week, hour, minute, second // in GMT time struct tm * timeinfo = ::gmtime(&startTime); - if (timeinfo == NULL) + if (timeinfo == nullptr) return -1; // get number of days until the specified day of week to search for @@ -333,7 +333,7 @@ time_t CalendarTime::getNextGMTTimeOcurrence(time_t const startTime, int const m // the year, month, day, day of week, hour, minute, second // in GMT time struct tm * timeinfo = ::gmtime(&startTime); - if (timeinfo == NULL) + if (timeinfo == nullptr) return -1; // calculate the Epoch GMT time for the specified start time @@ -358,7 +358,7 @@ time_t CalendarTime::getNextGMTTimeOcurrence(time_t const startTime, int const m startTimeAtSpecifiedHourMinuteSecond += (60 * 60 * 24); timeinfo = ::gmtime(&startTimeAtSpecifiedHourMinuteSecond); - if (timeinfo == NULL) + if (timeinfo == nullptr) return -1; if (++sentinel > maxIterations) diff --git a/engine/shared/library/sharedFoundation/src/shared/CommandLine.cpp b/engine/shared/library/sharedFoundation/src/shared/CommandLine.cpp index 1198c252..5209d788 100755 --- a/engine/shared/library/sharedFoundation/src/shared/CommandLine.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/CommandLine.cpp @@ -63,7 +63,7 @@ bool CommandLine::Option::isOptionNext( int optionSpecCount ) { - DEBUG_FATAL(!optionSpec, ("null optionSpec arg")); + DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg")); if (!optionSpecCount) return false; else @@ -77,8 +77,8 @@ CommandLine::Option *CommandLine::Option::createOption( int *optionCount ) { - DEBUG_FATAL(!optionSpec, ("null optionSpec arg")); - DEBUG_FATAL(!optionCount, ("null optionCount arg")); + DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg")); + DEBUG_FATAL(!optionCount, ("nullptr optionCount arg")); DEBUG_FATAL(!isOptionNext(*optionSpec, *optionCount), ("attempted to create option with non-option data")); const char newShortName = (*optionSpec)->char1; @@ -129,7 +129,7 @@ CommandLine::MatchCode CommandLine::Option::match(void) // matching this short or long name. If the arg specs don't match, we've // got an argument matching error. - DEBUG_FATAL(!optionTable, ("internal error: null option table")); + DEBUG_FATAL(!optionTable, ("internal error: nullptr option table")); OptionTable::Record *record = 0; @@ -145,7 +145,7 @@ CommandLine::MatchCode CommandLine::Option::match(void) DEBUG_FATAL(!record, ("failed to find option info record for option --%s", longName)); } else - DEBUG_FATAL(true, ("corrupted option? both short and long name are null")); + DEBUG_FATAL(true, ("corrupted option? both short and long name are nullptr")); // attempt to match against this option against commandline-specified options @@ -200,7 +200,7 @@ bool CommandLine::Collection::isCollectionNext( int optionSpecCount ) { - DEBUG_FATAL(!optionSpec, ("null optionSpec arg")); + DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg")); if (!optionSpecCount) return false; else @@ -214,8 +214,8 @@ CommandLine::Collection *CommandLine::Collection::createCollection( int *optionSpecCount ) { - DEBUG_FATAL(!optionSpec, ("null optionSpec arg")); - DEBUG_FATAL(!optionSpecCount, ("null optionSpecCount arg")); + DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg")); + DEBUG_FATAL(!optionSpecCount, ("nullptr optionSpecCount arg")); DEBUG_FATAL(!isCollectionNext(*optionSpec, *optionSpecCount), ("tried to create collection from non-collection optionSpec")); if ((*optionSpec)->optionType == OST_BeginList) @@ -289,7 +289,7 @@ bool CommandLine::List::Node::isNode( int optionCount ) { - DEBUG_FATAL(!optionSpec, ("null optionSpec arg")); + DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg")); if (!optionCount) return false; else @@ -303,8 +303,8 @@ CommandLine::List::Node *CommandLine::List::Node::createNode( int *optionCount ) { - DEBUG_FATAL(!optionSpec, ("null optionSpec arg")); - DEBUG_FATAL(!optionCount, ("null optionCount arg")); + DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg")); + DEBUG_FATAL(!optionCount, ("nullptr optionCount arg")); DEBUG_FATAL(!isNode(*optionSpec, *optionCount), ("attempted to create list node with non-list-node data")); Option *newOption = 0; @@ -350,7 +350,7 @@ CommandLine::List::List( listType(newListType), minimumNodeCount(0) { - DEBUG_FATAL(!newFirstNode, ("null newFirstNode arg")); + DEBUG_FATAL(!newFirstNode, ("nullptr newFirstNode arg")); DEBUG_FATAL(newListType != OPLT_Normal, ("constructor only good for OPLT_Normal lists, caller passed %d", newListType)); } @@ -366,7 +366,7 @@ CommandLine::List::List( listType(newListType), minimumNodeCount(newMinimumNodeCount) { - DEBUG_FATAL(!newFirstNode, ("null newFirstNode arg")); + DEBUG_FATAL(!newFirstNode, ("nullptr newFirstNode arg")); DEBUG_FATAL(newListType != OPLT_MinimumMatch, ("constructor only good for OPLT_MinimumMatch lists, caller passed %d", newListType)); } @@ -391,7 +391,7 @@ bool CommandLine::List::isListNext( int optionCount ) { - DEBUG_FATAL(!optionSpec, ("null optionSpec arg")); + DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg")); if (!optionCount) return false; else @@ -405,8 +405,8 @@ CommandLine::List *CommandLine::List::createList( int *optionCount ) { - DEBUG_FATAL(!optionSpec, ("null optionSpec arg")); - DEBUG_FATAL(!optionCount, ("null optionCount arg")); + DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg")); + DEBUG_FATAL(!optionCount, ("nullptr optionCount arg")); DEBUG_FATAL(!isListNext(*optionSpec, *optionCount), ("tried to create list from non-list optionSpec")); Node *newFirstNode = 0; @@ -582,7 +582,7 @@ bool CommandLine::Switch::Node::isNode( const OptionSpec *optionSpec, int optionCount) { - DEBUG_FATAL(!optionSpec, ("null optionSpec arg")); + DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg")); if (!optionCount) return false; else @@ -596,8 +596,8 @@ CommandLine::Switch::Node *CommandLine::Switch::Node::createNode( int *optionCount ) { - DEBUG_FATAL(!optionSpec, ("null optionSpec arg")); - DEBUG_FATAL(!optionCount, ("null optionCount arg")); + DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg")); + DEBUG_FATAL(!optionCount, ("nullptr optionCount arg")); DEBUG_FATAL(!isNode(*optionSpec, *optionCount), ("attempted to create list node with non-list-node data")); Option *newOption = 0; @@ -664,7 +664,7 @@ bool CommandLine::Switch::isSwitchNext( int optionCount ) { - DEBUG_FATAL(!optionSpec, ("null optionSpec arg")); + DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg")); if (!optionCount) return false; else @@ -678,8 +678,8 @@ CommandLine::Switch *CommandLine::Switch::createSwitch( int *optionCount ) { - DEBUG_FATAL(!optionSpec, ("null optionSpec arg")); - DEBUG_FATAL(!optionCount, ("null optionCount arg")); + DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg")); + DEBUG_FATAL(!optionCount, ("nullptr optionCount arg")); DEBUG_FATAL(!isSwitchNext(*optionSpec, *optionCount), ("tried to create switch from non-switch option spec")); const bool newOneNodeIsRequired = ((*optionSpec)->int1 != 0); @@ -886,7 +886,7 @@ CommandLine::OptionTable::Record *CommandLine::OptionTable::findOptionRecord( char shortName ) const { - DEBUG_FATAL(!shortName, ("null shortName arg")); + DEBUG_FATAL(!shortName, ("nullptr shortName arg")); // walk the list for (Record *record = firstRecord; record; record = record->getNext()) @@ -960,7 +960,7 @@ CommandLine::Lexer::Lexer( ) : nextCharacter(newBuffer) { - DEBUG_FATAL(!newBuffer, ("null newBuffer arg")); + DEBUG_FATAL(!newBuffer, ("nullptr newBuffer arg")); } // ---------------------------------------------------------------------- @@ -994,10 +994,10 @@ CommandLine::Lexer::~Lexer(void) bool CommandLine::Lexer::gobbleString(bool isRequired, char *stringBuffer, int stringSize) { - DEBUG_FATAL(!stringBuffer, ("null stringStart arg")); + DEBUG_FATAL(!stringBuffer, ("nullptr stringStart arg")); DEBUG_FATAL(!stringSize, ("stringSize is zero")); - DEBUG_FATAL(!nextCharacter, ("null nextChar")); + DEBUG_FATAL(!nextCharacter, ("nullptr nextChar")); int stringLength = 0; @@ -1069,7 +1069,7 @@ bool CommandLine::Lexer::gobbleString(bool isRequired, char *stringBuffer, int s if (isRequired && (stringLength == 0)) return false; - // null-terminate the string + // nullptr-terminate the string *stringBuffer = 0; return true; } @@ -1078,8 +1078,8 @@ bool CommandLine::Lexer::gobbleString(bool isRequired, char *stringBuffer, int s bool CommandLine::Lexer::getNextToken(Token *token) { - DEBUG_FATAL(!token, ("null token arg")); - DEBUG_FATAL(!nextCharacter, ("null nextCharacter")); + DEBUG_FATAL(!token, ("nullptr token arg")); + DEBUG_FATAL(!nextCharacter, ("nullptr nextCharacter")); // clear out the token memset(token, 0, sizeof(*token)); @@ -1204,7 +1204,7 @@ void CommandLine::remove(void) void CommandLine::buildOptionTree(const OptionSpec *specList, int specCount) { - DEBUG_FATAL(!specList, ("null specList arg")); + DEBUG_FATAL(!specList, ("nullptr specList arg")); if (!specCount) { @@ -1247,7 +1247,7 @@ CommandLine::MatchCode CommandLine::parseCommandLineBuffer(void) case Lexer::TT_ShortOption: // we've found a short option, make sure specified short option exists { - DEBUG_FATAL(!optionTable, ("internal error: null optionTable")); + DEBUG_FATAL(!optionTable, ("internal error: nullptr optionTable")); OptionTable::Record *record = optionTable->findOptionRecord(token.getShortName()); if (!record) { @@ -1279,7 +1279,7 @@ CommandLine::MatchCode CommandLine::parseCommandLineBuffer(void) case Lexer::TT_LongOption: // we've found a long option, make sure specified long option exists { - DEBUG_FATAL(!optionTable, ("internal error: null optionTable")); + DEBUG_FATAL(!optionTable, ("internal error: nullptr optionTable")); OptionTable::Record *record = optionTable->findOptionRecord(token.getLongName()); if (!record) { @@ -1322,7 +1322,7 @@ CommandLine::MatchCode CommandLine::parseCommandLineBuffer(void) case Lexer::TT_Argument: { - DEBUG_FATAL(!optionTable, ("internal error: null optionTable")); + DEBUG_FATAL(!optionTable, ("internal error: nullptr optionTable")); OptionTable::Record *record = optionTable->findOptionRecord(OP_SNAME_UNTAGGED); if (!record) { @@ -1382,7 +1382,7 @@ CommandLine::MatchCode CommandLine::parseCommandLineBuffer(void) void CommandLine::absorbString(const char *newString) { DEBUG_FATAL(!installed, ("CommandLine not installed")); - DEBUG_FATAL(!newString, ("null newString arg")); + DEBUG_FATAL(!newString, ("nullptr newString arg")); const int stringLength = static_cast(strlen(newString)); int requiredBufferSpace; @@ -1398,7 +1398,7 @@ void CommandLine::absorbString(const char *newString) buffer[bufferSize++] = ' '; } - // copy contents of buffer, including null + // copy contents of buffer, including nullptr memcpy(buffer + bufferSize, newString, stringLength + 1); bufferSize += stringLength; @@ -1437,7 +1437,7 @@ void CommandLine::absorbString(const char *newString) void CommandLine::absorbStrings(const char **stringArray, int stringCount) { DEBUG_FATAL(!installed, ("CommandLine not installed")); - DEBUG_FATAL(!stringArray, ("null string array")); + DEBUG_FATAL(!stringArray, ("nullptr string array")); for (int i = 0; i < stringCount; ++i) absorbString(stringArray[i]); @@ -1452,7 +1452,7 @@ void CommandLine::absorbStrings(const char **stringArray, int stringCount) * (i.e. "-- ") will be considered part of the post command line string. * * @return A read-only pointer to the portion of the command line not meant - * for CommandLine parsing. May be NULL if the entire command line + * for CommandLine parsing. May be nullptr if the entire command line * was meant for CommandLine or if no command line was specified. */ @@ -1704,7 +1704,7 @@ int CommandLine::getOccurrenceCount(const char *longName) * @param shortName [IN] short name of the option * @param occurrenceIndex [IN] zero-based occurrence number * @return The read-only argument string associated with the specified option occurrence. - * May be NULL if no argument was associated with the specified option. + * May be nullptr if no argument was associated with the specified option. */ const char *CommandLine::getOptionString(char shortName, int occurrenceIndex) @@ -1730,7 +1730,7 @@ const char *CommandLine::getOptionString(char shortName, int occurrenceIndex) * @param longName [IN] long name of the option * @param occurrenceIndex [IN] zero-based occurrence number * @return The read-only argument string associated with the specified option occurrence. - * May be NULL if no argument was associated with the specified option. + * May be nullptr if no argument was associated with the specified option. */ const char *CommandLine::getOptionString(const char *longName, int occurrenceIndex) diff --git a/engine/shared/library/sharedFoundation/src/shared/CommandLine.h b/engine/shared/library/sharedFoundation/src/shared/CommandLine.h index 358b2e40..d4eab6a0 100755 --- a/engine/shared/library/sharedFoundation/src/shared/CommandLine.h +++ b/engine/shared/library/sharedFoundation/src/shared/CommandLine.h @@ -755,7 +755,7 @@ inline const char *CommandLine::Lexer::getNextCharacter(void) inline void CommandLine::Lexer::gobbleWhitespace(void) { - DEBUG_FATAL(!nextCharacter, ("null nextCharacter")); + DEBUG_FATAL(!nextCharacter, ("nullptr nextCharacter")); while (isspace(*nextCharacter)) ++nextCharacter; } diff --git a/engine/shared/library/sharedFoundation/src/shared/ConfigFile.cpp b/engine/shared/library/sharedFoundation/src/shared/ConfigFile.cpp index 341f83e3..07c04692 100755 --- a/engine/shared/library/sharedFoundation/src/shared/ConfigFile.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/ConfigFile.cpp @@ -30,7 +30,7 @@ static char tagBuffer[6]; #define CONFIG_FILE_TEMPLATE_CREATE_INT(section, key, def) DEBUG_REPORT_LOG(true, ("cfg: [%s] %s=%d\n", section, key, def)) #define CONFIG_FILE_TEMPLATE_CREATE_BOOL(section, key, def) DEBUG_REPORT_LOG(true, ("cfg: [%s] %s=%s\n", section, key, def ? "true" : "false")) #define CONFIG_FILE_TEMPLATE_CREATE_FLOAT(section, key, def) DEBUG_REPORT_LOG(true, ("cfg: [%s] %s=%3.1f\n", section, key, def)) -#define CONFIG_FILE_TEMPLATE_CREATE_STRING(section, key, def) DEBUG_REPORT_LOG(true, ("cfg: [%s] %s=%s\n", section, key, def ? def : "NULL")) +#define CONFIG_FILE_TEMPLATE_CREATE_STRING(section, key, def) DEBUG_REPORT_LOG(true, ("cfg: [%s] %s=%s\n", section, key, def ? def : "nullptr")) #define CONFIG_FILE_TEMPLATE_CREATE_TAG(section, key, def) ConvertTagToString(def, tagBuffer), DEBUG_REPORT_LOG(true, ("cfg: [%s] %s=%d\n", section, key, tagBuffer)) #else @@ -43,8 +43,8 @@ static char tagBuffer[6]; #endif -#define NO_SPACE_SECTION(a) DEBUG_FATAL(strchr(a, ' ') != NULL, ("No spaces are allowed in config file section names: %s", a)) -#define NO_SPACE_KEY(a) DEBUG_FATAL(strchr(a, ' ') != NULL, ("No spaces are allowed in config file key names: %s", a)) +#define NO_SPACE_SECTION(a) DEBUG_FATAL(strchr(a, ' ') != nullptr, ("No spaces are allowed in config file section names: %s", a)) +#define NO_SPACE_KEY(a) DEBUG_FATAL(strchr(a, ' ') != nullptr, ("No spaces are allowed in config file key names: %s", a)) // ====================================================================== @@ -81,7 +81,7 @@ void ConfigFile::install(void) #endif ms_sections = new ConfigFile::SectionMap; - ms_currentSection = NULL; + ms_currentSection = nullptr; ExitChain::add(ConfigFile::remove, "ConfigFile::remove"); ms_installed = true; } @@ -110,7 +110,7 @@ void ConfigFile::remove(void) for (std::map::iterator it = ms_sections->begin(); it != ms_sections->end(); ++it) delete it->second; delete ms_sections; - ms_sections = NULL; + ms_sections = nullptr; ms_installed = false; } @@ -142,7 +142,7 @@ bool ConfigFile::loadFromCommandLine(const char *buffer) while (isspace(*buffer)) { ++buffer; - // advancing buffer, check for null (trailing white space on command line) + // advancing buffer, check for nullptr (trailing white space on command line) if(! *buffer) break; } @@ -196,7 +196,7 @@ bool ConfigFile::loadFromCommandLine(const char *buffer) //allocate a new section and set it as the current one Section *newSection = createSection(sectionName); //note that newSection is memory owned by the created Section object - //while sectionName is memory allocated to create a null terminated string + //while sectionName is memory allocated to create a nullptr terminated string ms_currentSection = newSection; } delete[] sectionName; @@ -292,7 +292,7 @@ bool ConfigFile::loadFromBuffer(char const * const buffer, int const length) processLine(currentLine); delete[] currentLine; bufferPosition += lineLength+1; - //trim ending whitespace. Remember that this string is not guaranteed to be NULL terminated. + //trim ending whitespace. Remember that this string is not guaranteed to be nullptr terminated. while (*bufferPosition && (bufferPosition < buffer + length) && isspace(static_cast(*bufferPosition))) ++bufferPosition; } @@ -311,26 +311,26 @@ bool ConfigFile::loadFile(const char *file) { DEBUG_FATAL(!ms_installed, ("ConfigFile not installed")); NOT_NULL(file); - ms_currentSection = NULL; - HANDLE handle = CreateFile(file, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + ms_currentSection = nullptr; + HANDLE handle = CreateFile(file, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); if (handle != INVALID_HANDLE_VALUE) { // get the length of the config file - const DWORD length = GetFileSize(handle, NULL); + const DWORD length = GetFileSize(handle, nullptr); if (length != 0xffffffff) { // create a buffer to load the config file into char * const buffer = new char[length+2]; - // make sure the buffer is null terminated + // make sure the buffer is nullptr terminated buffer[length] = '\n'; buffer[length+1] = '\0'; // read the config file in DWORD readResult; - const BOOL result = ReadFile(handle, buffer, length, &readResult, NULL); + const BOOL result = ReadFile(handle, buffer, length, &readResult, nullptr); // make sure we read all the correct stuff if (result && readResult == length) @@ -360,7 +360,7 @@ void ConfigFile::processLine(const char *line) { DEBUG_FATAL(!ms_installed, ("ConfigFile not installed")); // validate argument - DEBUG_FATAL(!line, ("ConfigFile::processLine NULL")); + DEBUG_FATAL(!line, ("ConfigFile::processLine nullptr")); // check for a full line comment if (*line == '#' || *line == ';') @@ -418,7 +418,7 @@ void ConfigFile::processLine(const char *line) //allocate a new section and set it as the current one Section *newSection = createSection(sectionName); //note that newSection is memory owned by the created Section object - //while sectionName is memory allocated to create a null terminated string + //while sectionName is memory allocated to create a nullptr terminated string ms_currentSection = newSection; } delete[] sectionName; @@ -468,7 +468,7 @@ void ConfigFile::processKeys(const char *line) while (*endValue) { //build the value - char *value = NULL; + char *value = nullptr; while(isspace(*beginValue)) ++beginValue; if (*beginValue != '"') @@ -542,7 +542,7 @@ void ConfigFile::processKeys(const char *line) /** Get a Section pointer from a string * * @param section the name of the section - * @return the pointer if valid, otherwise NULL + * @return the pointer if valid, otherwise nullptr */ ConfigFile::Section *ConfigFile::getSection(const char *section) { @@ -550,7 +550,7 @@ ConfigFile::Section *ConfigFile::getSection(const char *section) if (it != ms_sections->end()) return it->second; - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -581,7 +581,7 @@ void ConfigFile::removeSection(const char *name) if (iter != ms_sections->end()) { delete iter->second; - iter->second = NULL; + iter->second = nullptr; ms_sections->erase(iter); } } @@ -991,7 +991,7 @@ Tag ConfigFile::getKeyTag(const char *section, const char *key, Tag defaultValue ConfigFile::Element::Element(void) : - m_entry(NULL) + m_entry(nullptr) {} // ---------------------------------------------------------------------- @@ -1105,8 +1105,8 @@ Tag ConfigFile::Element::getAsTag(void) const ConfigFile::Key::Key(const char *name, const char *value, bool lazyAdd) : - m_elements(NULL), - m_name(NULL), + m_elements(nullptr), + m_name(nullptr), m_lazyAdd(lazyAdd) { m_name = new char[strlen(name)+1]; @@ -1248,8 +1248,8 @@ void ConfigFile::Key::dump(const char *keyName) const ConfigFile::Section::Section(const char *name) : - m_keys(NULL), - m_name(NULL) + m_keys(nullptr), + m_name(nullptr) { m_name = new char[strlen(name)+1]; strcpy(m_name, name); @@ -1284,7 +1284,7 @@ ConfigFile::Key *ConfigFile::Section::findKey(const char *key) const if (it != m_keys->end()) return it->second; - return NULL; + return nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedFoundation/src/shared/ConfigFile.h b/engine/shared/library/sharedFoundation/src/shared/ConfigFile.h index a4c034ed..09a78599 100755 --- a/engine/shared/library/sharedFoundation/src/shared/ConfigFile.h +++ b/engine/shared/library/sharedFoundation/src/shared/ConfigFile.h @@ -99,7 +99,7 @@ public: int getKeyInt (const char *key, int index, int defaultValue = 0) const; bool getKeyBool (const char *key, int index, bool defaultValue = false) const; float getKeyFloat (const char *key, int index, float defaultValue = 0.f) const; - const char *getKeyString(const char *key, int index, const char *defaultValue = NULL) const; + const char *getKeyString(const char *key, int index, const char *defaultValue = nullptr) const; Tag getKeyTag (const char *key, int index, Tag defaultValue = 0) const; int getKeyCount(const char *key) const; void addKey(const char *keyName, const char *value, bool lazyAdd = false); diff --git a/engine/shared/library/sharedFoundation/src/shared/CrashReportInformation.cpp b/engine/shared/library/sharedFoundation/src/shared/CrashReportInformation.cpp index 920f1ffa..983fd7ff 100755 --- a/engine/shared/library/sharedFoundation/src/shared/CrashReportInformation.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/CrashReportInformation.cpp @@ -87,7 +87,7 @@ char const * CrashReportInformation::getEntry(int index) if (index < static_cast(ms_dynamicText.size())) return ms_dynamicText[index]; - return NULL; + return nullptr; } // ====================================================================== diff --git a/engine/shared/library/sharedFoundation/src/shared/Crc.cpp b/engine/shared/library/sharedFoundation/src/shared/Crc.cpp index 4fddb3b8..28ef3514 100755 --- a/engine/shared/library/sharedFoundation/src/shared/Crc.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/Crc.cpp @@ -99,7 +99,7 @@ uint32 Crc::calculateWithToLower(const char *string) uint32 Crc::calculate(const void *data, int length, uint32 initCrc) { - DEBUG_FATAL(!data, ("null data arg")); + DEBUG_FATAL(!data, ("nullptr data arg")); uint32 crc; const byte *d = reinterpret_cast(data); diff --git a/engine/shared/library/sharedFoundation/src/shared/CrcStringTable.cpp b/engine/shared/library/sharedFoundation/src/shared/CrcStringTable.cpp index 206f0dea..9e8ca2b6 100755 --- a/engine/shared/library/sharedFoundation/src/shared/CrcStringTable.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/CrcStringTable.cpp @@ -31,9 +31,9 @@ using namespace CrcStringTableNamespace; CrcStringTable::CrcStringTable() : m_numberOfEntries(0), - m_crcTable(NULL), - m_stringsOffsetTable(NULL), - m_strings(NULL) + m_crcTable(nullptr), + m_stringsOffsetTable(nullptr), + m_strings(nullptr) { } @@ -42,9 +42,9 @@ CrcStringTable::CrcStringTable() CrcStringTable::CrcStringTable(char const * fileName) : m_numberOfEntries(0), - m_crcTable(NULL), - m_stringsOffsetTable(NULL), - m_strings(NULL) + m_crcTable(nullptr), + m_stringsOffsetTable(nullptr), + m_strings(nullptr) { load(fileName); } @@ -69,7 +69,7 @@ void CrcStringTable::load(char const * fileName) if(fileName) DEBUG_WARNING(true, ("Could not load CrcStringTable %s", fileName)); else - DEBUG_WARNING(true, ("Could not load CrcStringTable, NULL file given")); + DEBUG_WARNING(true, ("Could not load CrcStringTable, nullptr file given")); return; } diff --git a/engine/shared/library/sharedFoundation/src/shared/DataResourceList.h b/engine/shared/library/sharedFoundation/src/shared/DataResourceList.h index c5574f7f..a86629e5 100755 --- a/engine/shared/library/sharedFoundation/src/shared/DataResourceList.h +++ b/engine/shared/library/sharedFoundation/src/shared/DataResourceList.h @@ -82,7 +82,7 @@ private: template inline void DataResourceList::install() { - if (ms_bindings == NULL) + if (ms_bindings == nullptr) { ms_bindings = new CreateDataResourceMap(); ms_loaded = new LoadedDataResourceMap(); @@ -100,7 +100,7 @@ inline void DataResourceList::install() template inline void DataResourceList::remove(void) { - if (ms_loaded != NULL) + if (ms_loaded != nullptr) { #ifdef _DEBUG if (!ms_loaded->empty()) @@ -122,13 +122,13 @@ inline void DataResourceList::remove(void) #endif // _DEBUG delete ms_loaded; - ms_loaded = NULL; + ms_loaded = nullptr; } - if (ms_bindings != NULL) + if (ms_bindings != nullptr) { delete ms_bindings; - ms_bindings = NULL; + ms_bindings = nullptr; } } // DataResourceList::remove @@ -144,7 +144,7 @@ template inline void DataResourceList::registerTemplate(Tag id, CreateDataResourceFunc createFunc) { - if (ms_bindings == NULL) + if (ms_bindings == nullptr) install(); #ifdef _DEBUG @@ -237,7 +237,7 @@ inline T * DataResourceList::fetch(Tag id) typename CreateDataResourceMap::iterator iter = ms_bindings->find(id); if (iter == ms_bindings->end()) - return NULL; + return nullptr; return (*(*iter).second)(""); } // DataResourceList::fetch(Tag) @@ -268,11 +268,11 @@ inline const T * DataResourceList::fetch(Iff &source) char buffer[5]; ConvertTagToString(id, buffer); DEBUG_WARNING(true, ("DataResourceList::fetch Iff: trying to fetch resource for unknown tag %s!", buffer)); - return NULL; + return nullptr; } T *newDataResource = (*(*createIter).second)(source.getFileName()); - if (newDataResource != NULL) + if (newDataResource != nullptr) { // initialize the data resource newDataResource->loadFromIff(source); @@ -310,11 +310,11 @@ inline const T * DataResourceList::fetch(const CrcString &filename) // load the template Iff iff; if (!iff.open(filename.getString(), true)) - return NULL; + return nullptr; // put the template in the loaded list const T * const newDataResource = fetch(iff); - if (newDataResource != NULL) + if (newDataResource != nullptr) { newDataResource->addReference(); ms_loaded->insert(std::make_pair(&newDataResource->getCrcName (), newDataResource)); @@ -337,13 +337,13 @@ inline void DataResourceList::release(const T & dataResource) { NOT_NULL(ms_loaded); - if (ms_loaded != NULL && dataResource.getReferenceCount() == 0) + if (ms_loaded != nullptr && dataResource.getReferenceCount() == 0) { typename LoadedDataResourceMap::iterator iter = ms_loaded->find(&dataResource.getCrcName()); if (iter != ms_loaded->end()) { const T * const temp = (*iter).second; - (*iter).second = NULL; + (*iter).second = nullptr; ms_loaded->erase(iter); delete temp; } @@ -369,11 +369,11 @@ inline T * DataResourceList::reload(Iff &source) if (iter == ms_loaded->end()) { DEBUG_WARNING(true, ("DataResourceList::reload: trying to reload unloaded resource %s!", source.getFileName())); - return NULL; + return nullptr; } T * const dataResource = const_cast((*iter).second); - if (dataResource != NULL) + if (dataResource != nullptr) { // initialize the data resource dataResource->loadFromIff(source); diff --git a/engine/shared/library/sharedFoundation/src/shared/ExitChain.cpp b/engine/shared/library/sharedFoundation/src/shared/ExitChain.cpp index 3b1fb1bf..af70c5a0 100755 --- a/engine/shared/library/sharedFoundation/src/shared/ExitChain.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/ExitChain.cpp @@ -115,7 +115,7 @@ void ExitChain::add(Function function, const char *debugName, int priority, bool #endif // linked list traversal with a back pointer - for (back = NULL, front = PerThreadData::getExitChainFirstEntry(); front && front->priority > priority; back = front, front = front->next) + for (back = nullptr, front = PerThreadData::getExitChainFirstEntry(); front && front->priority > priority; back = front, front = front->next) ; // hook it into the linked list @@ -133,7 +133,7 @@ void ExitChain::add(Function function, const char *debugName, int priority, bool * The ExitChain will automatically remove a function from the ExitChain when it calls the function, so an * exit function should not attempt to remove itself from the ExitChain. * - * Calling this routine with a NULL pointer will cause this routine to call Fatal in debug compilations. + * Calling this routine with a nullptr pointer will cause this routine to call Fatal in debug compilations. * * Calling this routine with a function that is not on the ExitChain will cause this routine to call * Fatal in debug compilations. @@ -145,14 +145,14 @@ void ExitChain::remove(Function function) { Entry *back, *front; - if (function == NULL) + if (function == nullptr) { - DEBUG_FATAL(true, ("ExitChain::remove NULL function")); + DEBUG_FATAL(true, ("ExitChain::remove nullptr function")); return; //lint !e527 // Warning -- Unreachable } // linked list traversal with a back pointer - for (back = NULL, front = PerThreadData::getExitChainFirstEntry(); front && front->function != function; back = front, front = front->next) + for (back = nullptr, front = PerThreadData::getExitChainFirstEntry(); front && front->function != function; back = front, front = front->next) ; // make sure it was found @@ -191,7 +191,7 @@ void ExitChain::run(void) PerThreadData::setExitChainRunning(true); - while ((entry = PerThreadData::getExitChainFirstEntry()) != NULL) + while ((entry = PerThreadData::getExitChainFirstEntry()) != nullptr) { // remove the first entry off the ExitChain PerThreadData::setExitChainFirstEntry(entry->next); diff --git a/engine/shared/library/sharedFoundation/src/shared/Fatal.cpp b/engine/shared/library/sharedFoundation/src/shared/Fatal.cpp index 5d2c7327..37a3884f 100755 --- a/engine/shared/library/sharedFoundation/src/shared/Fatal.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/Fatal.cpp @@ -33,7 +33,7 @@ namespace FatalNamespace int ms_numberOfWarnings = 0; bool ms_strict = false; - WarningCallback s_warningCallback = NULL; + WarningCallback s_warningCallback = nullptr; #if PRODUCTION == 0 PixCounter::ResetInteger ms_numberOfWarningsThisFrame; @@ -70,7 +70,7 @@ static void formatMessage(char *buffer, int bufferLength, int stackDepth, const else DebugHelp::getCallStack(callStack, callStackOffset + stackDepth); - // make sure the buffer is always null terminated + // make sure the buffer is always nullptr terminated buffer[--bufferLength] = '\0'; // look up the caller's file and line @@ -191,7 +191,7 @@ static void InternalWarning(const char *format, int extraFlags, va_list va, int char buffer[4 * 1024]; - if (NULL != s_warningCallback) + if (nullptr != s_warningCallback) { strcpy(buffer, "WARNING: "); vsnprintf(buffer + 9, sizeof(buffer) - 9, format, va); diff --git a/engine/shared/library/sharedFoundation/src/shared/Fatal.h b/engine/shared/library/sharedFoundation/src/shared/Fatal.h index f33eb5ac..14215b90 100755 --- a/engine/shared/library/sharedFoundation/src/shared/Fatal.h +++ b/engine/shared/library/sharedFoundation/src/shared/Fatal.h @@ -68,15 +68,15 @@ void SetWarningCallback(WarningCallback); template inline T *NonNull(T *pointer, const char *name) { - WARNING(!pointer, ("%s pointer is null", name)); + WARNING(!pointer, ("%s pointer is nullptr", name)); return pointer; } #define NON_NULL(a) NonNull(a, #a) - #define NOT_NULL(a) FATAL(!a, ("%s pointer is null", #a)) + #define NOT_NULL(a) FATAL(!a, ("%s pointer is nullptr", #a)) - // FATAL if the specified pointer is not NULL (i.e. assert that the pointer is null, the opposite of NOT_NULL). - #define IS_NULL(a) FATAL(a, ("%s pointer is not null, unexpected.", #a)) + // FATAL if the specified pointer is not nullptr (i.e. assert that the pointer is nullptr, the opposite of NOT_NULL). + #define IS_NULL(a) FATAL(a, ("%s pointer is not nullptr, unexpected.", #a)) #else diff --git a/engine/shared/library/sharedFoundation/src/shared/FormattedString.h b/engine/shared/library/sharedFoundation/src/shared/FormattedString.h index b4e1f6de..d778be27 100755 --- a/engine/shared/library/sharedFoundation/src/shared/FormattedString.h +++ b/engine/shared/library/sharedFoundation/src/shared/FormattedString.h @@ -42,7 +42,7 @@ inline FormattedString::FormattedString() template inline char const * FormattedString::sprintf(char const * const format, ...) { - char const * result = NULL; + char const * result = nullptr; va_list va; va_start(va, format); @@ -64,7 +64,7 @@ inline char const * FormattedString::vsprintf(char const * const for int const charactersWritten = vsnprintf(m_text, lastIndex, format, va); // vsnprintf returns the number of characters written, not including - // the terminating null character, or a negative value if an output error occurs. + // the terminating nullptr character, or a negative value if an output error occurs. // If the number of characters to write exceeds count, then count characters are // written and -1 is returned. diff --git a/engine/shared/library/sharedFoundation/src/shared/LabelHash.cpp b/engine/shared/library/sharedFoundation/src/shared/LabelHash.cpp index 26848b94..2f28a3ca 100755 --- a/engine/shared/library/sharedFoundation/src/shared/LabelHash.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/LabelHash.cpp @@ -109,7 +109,7 @@ const char * LabelHash::findLabel( char const * const domain, uint32 hashValue ) { // Domain not found - return NULL; + return nullptr; } // ---------- @@ -127,6 +127,6 @@ const char * LabelHash::findLabel( char const * const domain, uint32 hashValue ) // ---------- // String not found - return NULL; + return nullptr; } diff --git a/engine/shared/library/sharedFoundation/src/shared/MemoryBlockManager.cpp b/engine/shared/library/sharedFoundation/src/shared/MemoryBlockManager.cpp index c5c86efd..c8067046 100755 --- a/engine/shared/library/sharedFoundation/src/shared/MemoryBlockManager.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/MemoryBlockManager.cpp @@ -138,8 +138,8 @@ using namespace MemoryBlockManagerNamespace; MemoryBlockManager::Allocator::Allocator(const int elementSize) : m_referenceCount(0), - m_firstBlock(NULL), - m_firstFreeElement(NULL), + m_firstBlock(nullptr), + m_firstFreeElement(nullptr), m_elementSize(elementSize), m_elementsPerBlock(64), m_currentNumberOfBlocks(0), @@ -157,8 +157,8 @@ MemoryBlockManager::Allocator::Allocator(const int elementSize) MemoryBlockManager::Allocator::Allocator(int elementSize, int elementsPerBlock, int minimumBlocks, int maximumNumberOfBlocks) : m_referenceCount(0), - m_firstBlock(NULL), - m_firstFreeElement(NULL), + m_firstBlock(nullptr), + m_firstFreeElement(nullptr), m_elementSize(elementSize), m_elementsPerBlock(elementsPerBlock), m_currentNumberOfBlocks(0), @@ -188,8 +188,8 @@ MemoryBlockManager::Allocator::~Allocator() delete block; } - m_firstBlock = NULL; - m_firstFreeElement = NULL; + m_firstBlock = nullptr; + m_firstFreeElement = nullptr; } // ---------------------------------------------------------------------- @@ -427,7 +427,7 @@ MemoryBlockManager::MemoryBlockManager(char const * name, bool shared, int eleme : m_name(name), m_shared(shared), m_currentNumberOfElements(0), - m_allocator(NULL) + m_allocator(nullptr) { //-- Handle config option where we force all MemoryBlockManagers to be non-shared. if (shared && ms_forceAllNonShared) @@ -598,7 +598,7 @@ void *MemoryBlockManager::allocate(bool returnNullOnFailure) { ms_globalCriticalSection.leave(); DEBUG_FATAL(!returnNullOnFailure, ("MBM %s is full %d", m_name, m_currentNumberOfElements)); - return NULL; + return nullptr; } ++m_currentNumberOfElements; diff --git a/engine/shared/library/sharedFoundation/src/shared/MessageQueue.cpp b/engine/shared/library/sharedFoundation/src/shared/MessageQueue.cpp index 5af0285d..4b77315c 100755 --- a/engine/shared/library/sharedFoundation/src/shared/MessageQueue.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/MessageQueue.cpp @@ -105,7 +105,7 @@ void MessageQueue::clearDataFromMessageList(MessageList &messageList, bool destr { DEBUG_WARNING(!destructor, ("clearing message data from beginFrame")); delete message.m_data; - message.m_data = NULL; + message.m_data = nullptr; } } } @@ -199,7 +199,7 @@ void MessageQueue::clearMessage(const int index) VALIDATE_RANGE_INCLUSIVE_EXCLUSIVE(0, index, getNumberOfMessages()); Message& message = (*m_messageQueueRead)[static_cast(index)]; - DEBUG_WARNING(message.m_data, ("MessageQueue::clearMessage - clearing message with non-null data")); + DEBUG_WARNING(message.m_data, ("MessageQueue::clearMessage - clearing message with non-nullptr data")); message.m_message = 0; } diff --git a/engine/shared/library/sharedFoundation/src/shared/Misc.h b/engine/shared/library/sharedFoundation/src/shared/Misc.h index 326d3341..1c29b6ed 100755 --- a/engine/shared/library/sharedFoundation/src/shared/Misc.h +++ b/engine/shared/library/sharedFoundation/src/shared/Misc.h @@ -135,7 +135,7 @@ templateinline void Zero(T &t) * the source string into the new memory, and then returns a pointer to * the new memory. * - * This routine will return NULL if called with NULL. + * This routine will return nullptr if called with nullptr. * * @param source The string to copy * @return A pointer to a copy of the source argument @@ -144,7 +144,7 @@ templateinline void Zero(T &t) inline char *DuplicateString(const char *source) { if (!source) - return NULL; + return nullptr; const uint length = strlen(source)+1; char *result = NON_NULL (new char[length]); @@ -160,7 +160,7 @@ inline char *DuplicateString(const char *source) * the source string into the new memory, and then returns a pointer to * the new memory. * - * This routine will return NULL if called with NULL. + * This routine will return nullptr if called with nullptr. * * @param source The string to copy * @return A pointer to a copy of the source argument @@ -169,7 +169,7 @@ inline char *DuplicateString(const char *source) inline char *DuplicateStringWithToLower(const char *source) { if (!source) - return NULL; + return nullptr; const uint length = strlen(source)+1; char *result = NON_NULL (new char[length]); @@ -193,7 +193,7 @@ inline char *DuplicateStringWithToLower(const char *source) inline void imemset(void *data, int value, int length) { - DEBUG_FATAL(!data, ("null data arg")); + DEBUG_FATAL(!data, ("nullptr data arg")); memset(data, value, static_cast(length)); } @@ -210,8 +210,8 @@ inline void imemset(void *data, int value, int length) inline void imemcpy(void *destination, const void *source, int length) { - DEBUG_FATAL(!destination, ("null destination arg")); - DEBUG_FATAL(!source, ("null source arg")); + DEBUG_FATAL(!destination, ("nullptr destination arg")); + DEBUG_FATAL(!source, ("nullptr source arg")); memcpy(destination, source, static_cast(length)); } @@ -228,8 +228,8 @@ inline void imemcpy(void *destination, const void *source, int length) inline void *memmove(void *destination, const void *source, int length) { - DEBUG_FATAL(!destination, ("null destination arg")); - DEBUG_FATAL(!source, ("null source arg")); + DEBUG_FATAL(!destination, ("nullptr destination arg")); + DEBUG_FATAL(!source, ("nullptr source arg")); return memmove(destination, source, static_cast(length)); } @@ -243,7 +243,7 @@ inline void *memmove(void *destination, const void *source, int length) inline int istrlen(const char *string) { - DEBUG_FATAL(!string, ("null string arg")); + DEBUG_FATAL(!string, ("nullptr string arg")); return static_cast(strlen(string)); } diff --git a/engine/shared/library/sharedFoundation/src/shared/PersistentCrcString.cpp b/engine/shared/library/sharedFoundation/src/shared/PersistentCrcString.cpp index 7de5a7d3..dae8108f 100755 --- a/engine/shared/library/sharedFoundation/src/shared/PersistentCrcString.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/PersistentCrcString.cpp @@ -50,23 +50,23 @@ void PersistentCrcString::install() void PersistentCrcStringNamespace::remove() { delete ms_memoryBlockManager8; - ms_memoryBlockManager8 = NULL; + ms_memoryBlockManager8 = nullptr; delete ms_memoryBlockManager16; - ms_memoryBlockManager16 = NULL; + ms_memoryBlockManager16 = nullptr; delete ms_memoryBlockManager32; - ms_memoryBlockManager32 = NULL; + ms_memoryBlockManager32 = nullptr; delete ms_memoryBlockManager48; - ms_memoryBlockManager48 = NULL; + ms_memoryBlockManager48 = nullptr; delete ms_memoryBlockManager64; - ms_memoryBlockManager64 = NULL; + ms_memoryBlockManager64 = nullptr; } // ====================================================================== PersistentCrcString::PersistentCrcString() : CrcString(), - m_memoryBlockManager(NULL), - m_buffer(NULL) + m_memoryBlockManager(nullptr), + m_buffer(nullptr) { DEBUG_FATAL(!ms_memoryBlockManager8, ("Constructing a PersistentCrcString before the class is installed")); } @@ -75,8 +75,8 @@ PersistentCrcString::PersistentCrcString() PersistentCrcString::PersistentCrcString(CrcString const &rhs) : CrcString(), - m_memoryBlockManager(NULL), - m_buffer(NULL) + m_memoryBlockManager(nullptr), + m_buffer(nullptr) { DEBUG_FATAL(!ms_memoryBlockManager8, ("Constructing a PersistentCrcString before the class is installed")); @@ -88,8 +88,8 @@ PersistentCrcString::PersistentCrcString(CrcString const &rhs) PersistentCrcString::PersistentCrcString(PersistentCrcString const &rhs) : CrcString(), //lint !e1738 // non copy constructor used to initialize base class // this appears to be intentional. - m_memoryBlockManager(NULL), - m_buffer(NULL) + m_memoryBlockManager(nullptr), + m_buffer(nullptr) { DEBUG_FATAL(!ms_memoryBlockManager8, ("Constructing a PersistentCrcString before the class is installed")); @@ -101,8 +101,8 @@ PersistentCrcString::PersistentCrcString(PersistentCrcString const &rhs) PersistentCrcString::PersistentCrcString(char const * string, bool applyNormalize) : CrcString(), - m_memoryBlockManager(NULL), - m_buffer(NULL) + m_memoryBlockManager(nullptr), + m_buffer(nullptr) { DEBUG_FATAL(!ms_memoryBlockManager8, ("Constructing a PersistentCrcString before the class is installed")); @@ -114,8 +114,8 @@ PersistentCrcString::PersistentCrcString(char const * string, bool applyNormaliz PersistentCrcString::PersistentCrcString(char const * string, uint32 crc) : CrcString(), - m_memoryBlockManager(NULL), - m_buffer(NULL) + m_memoryBlockManager(nullptr), + m_buffer(nullptr) { DEBUG_FATAL(!ms_memoryBlockManager8, ("Constructing a PersistentCrcString before the class is installed")); @@ -169,18 +169,18 @@ void PersistentCrcString::internalFree() { if (m_memoryBlockManager == ms_fakeConstCharMemoryBlockManager) { - m_memoryBlockManager = NULL; + m_memoryBlockManager = nullptr; } else { m_memoryBlockManager->free(m_buffer); - m_memoryBlockManager = NULL; + m_memoryBlockManager = nullptr; } } else delete [] m_buffer; - m_buffer = NULL; + m_buffer = nullptr; } } @@ -201,7 +201,7 @@ void PersistentCrcString::internalSet(char const * string, bool applyNormalize) const int stringLength = istrlen(string) + 1; DEBUG_FATAL(stringLength > Os::MAX_PATH_LENGTH, ("string too long for a filename")); - m_memoryBlockManager = NULL; + m_memoryBlockManager = nullptr; if (stringLength <= 8) m_memoryBlockManager = ms_memoryBlockManager8; else diff --git a/engine/shared/library/sharedFoundation/src/shared/Tag.h b/engine/shared/library/sharedFoundation/src/shared/Tag.h index 82a4f393..261b474e 100755 --- a/engine/shared/library/sharedFoundation/src/shared/Tag.h +++ b/engine/shared/library/sharedFoundation/src/shared/Tag.h @@ -158,7 +158,7 @@ inline Tag ConvertIntToTag(int value) * array with the name of the specified tag. If a character of the tag * is not printable, it will be replaced with a question mark. * - * A null-character will be appended to the output buffer. + * A nullptr-character will be appended to the output buffer. * * This routine assumes the specified character buffer is at least 5 characters * in length. @@ -171,7 +171,7 @@ inline void ConvertTagToString(Tag tag, char *buffer) { int i, j, ch; - DEBUG_FATAL(!buffer, ("buffer is null")); + DEBUG_FATAL(!buffer, ("buffer is nullptr")); for (i = 0, j = 24; i < 4; ++i, j -= 8) { diff --git a/engine/shared/library/sharedFoundation/src/shared/Watcher.cpp b/engine/shared/library/sharedFoundation/src/shared/Watcher.cpp index 3ca86728..c56201a6 100755 --- a/engine/shared/library/sharedFoundation/src/shared/Watcher.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/Watcher.cpp @@ -82,7 +82,7 @@ void WatchedByList::install() /** * Destroy a WatchedByList. * - * All watchers currently watching the owner of this object will be reset to NULL. + * All watchers currently watching the owner of this object will be reset to nullptr. */ WatchedByList::~WatchedByList() @@ -92,7 +92,7 @@ WatchedByList::~WatchedByList() if (m_list) { deleteList(m_list); - m_list = NULL; + m_list = nullptr; } } diff --git a/engine/shared/library/sharedFoundation/src/shared/Watcher.h b/engine/shared/library/sharedFoundation/src/shared/Watcher.h index ca637a79..921b91d5 100755 --- a/engine/shared/library/sharedFoundation/src/shared/Watcher.h +++ b/engine/shared/library/sharedFoundation/src/shared/Watcher.h @@ -8,7 +8,7 @@ // @todo How do I get this into doxygen? It's information that really spans multiple classes // // The Watcher system allows pointers to objects to be automatically -// reset to NULL when the object watching them is destoyed. +// reset to nullptr when the object watching them is destoyed. // // For something to be watchable, it must provide a routine of the form: // @@ -66,7 +66,7 @@ class Watcher : public BaseWatcher { public: - explicit Watcher(T *data=NULL); + explicit Watcher(T *data=nullptr); Watcher(const Watcher &newValue); ~Watcher(); //lint !e1509 // Warning -- base class destructor for class is not virtual @@ -96,7 +96,7 @@ class ConstWatcher : public BaseWatcher { public: - explicit ConstWatcher(const T *data=NULL); + explicit ConstWatcher(const T *data=nullptr); ConstWatcher(const ConstWatcher &newValue); ~ConstWatcher(); //lint !e1509 // Warning -- base class destructor for class is not virtual @@ -177,7 +177,7 @@ inline BaseWatcher::BaseWatcher(void *data) inline void BaseWatcher::reset() { - m_data = NULL; + m_data = nullptr; } // ---------------------------------------------------------------------- @@ -190,7 +190,7 @@ inline void BaseWatcher::reset() inline BaseWatcher::~BaseWatcher() { - m_data = NULL; + m_data = nullptr; } // ---------------------------------------------------------------------- @@ -593,11 +593,11 @@ inline const T *ConstWatcher::operator ->() const /** * Construct a WatchedByList. * - * This list of watchers remains NULL until someone first watches the object. + * This list of watchers remains nullptr until someone first watches the object. */ inline WatchedByList::WatchedByList() -: m_list(NULL) +: m_list(nullptr) { } diff --git a/engine/shared/library/sharedFoundation/src/shared/dynamicVariable/DynamicVariable.cpp b/engine/shared/library/sharedFoundation/src/shared/dynamicVariable/DynamicVariable.cpp index f11c603e..ada9369f 100755 --- a/engine/shared/library/sharedFoundation/src/shared/dynamicVariable/DynamicVariable.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/dynamicVariable/DynamicVariable.cpp @@ -106,8 +106,8 @@ m_value(), m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; } // ---------------------------------------------------------------------- @@ -131,8 +131,8 @@ DynamicVariable::DynamicVariable(const DynamicVariable &rhs) : m_position(rhs.m_position), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; } // ---------------------------------------------------------------------- @@ -158,8 +158,8 @@ DynamicVariable& DynamicVariable::operator=(const DynamicVariable &rhs) (*f)(m_cachedValue[0]); } - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; } } @@ -201,8 +201,8 @@ void DynamicVariable::load(int position, int typeId, const Unicode::String &pack (*f)(m_cachedValue[0]); } - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; } } @@ -235,8 +235,8 @@ DynamicVariable::DynamicVariable(int value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; pack(value, m_value); } @@ -249,8 +249,8 @@ DynamicVariable::DynamicVariable(const std::vector & value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; pack(value, m_value); } @@ -263,8 +263,8 @@ DynamicVariable::DynamicVariable(float value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; pack(value, m_value); } @@ -277,8 +277,8 @@ DynamicVariable::DynamicVariable(const std::vector & value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; pack(value, m_value); } @@ -291,8 +291,8 @@ DynamicVariable::DynamicVariable(const Unicode::String &value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; } // ---------------------------------------------------------------------- @@ -303,8 +303,8 @@ DynamicVariable::DynamicVariable(const std::string &value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; } // ---------------------------------------------------------------------- @@ -315,8 +315,8 @@ DynamicVariable::DynamicVariable(const std::vector & value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; pack(value, m_value); } @@ -329,8 +329,8 @@ DynamicVariable::DynamicVariable(const NetworkId & value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; } // ---------------------------------------------------------------------- @@ -341,8 +341,8 @@ DynamicVariable::DynamicVariable(const std::vector & value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; pack(value, m_value); } @@ -355,8 +355,8 @@ DynamicVariable::DynamicVariable(const DynamicVariableLocationData & value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; pack(value, m_value); } @@ -369,8 +369,8 @@ DynamicVariable::DynamicVariable(const std::vector m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; pack(value, m_value); } @@ -383,8 +383,8 @@ DynamicVariable::DynamicVariable(const StringId &value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; } // ---------------------------------------------------------------------- @@ -395,8 +395,8 @@ DynamicVariable::DynamicVariable(const std::vector &value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; pack(value, m_value); } @@ -409,8 +409,8 @@ DynamicVariable::DynamicVariable(const Transform &value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; pack(value, m_value); } @@ -423,8 +423,8 @@ DynamicVariable::DynamicVariable(const std::vector &value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; pack(value, m_value); } @@ -437,8 +437,8 @@ DynamicVariable::DynamicVariable(const Vector &value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; pack(value, m_value); } @@ -451,8 +451,8 @@ DynamicVariable::DynamicVariable(const std::vector &value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; pack(value, m_value); } @@ -786,7 +786,7 @@ bool DynamicVariable::get(DynamicVariableLocationData & value) const char tempCell[BUFSIZE]; std::string data(Unicode::wideToNarrow(m_value)); const char * bufptrStart = data.c_str(); - char * bufptrEnd = NULL; + char * bufptrEnd = nullptr; cachedValue.pos.x = static_cast(strtod(bufptrStart, &bufptrEnd)); bufptrStart = bufptrEnd; while (*bufptrStart != '\0' && isspace(*bufptrStart)) @@ -811,7 +811,7 @@ bool DynamicVariable::get(DynamicVariableLocationData & value) const while (*bufptrStart != '\0' && isspace(*bufptrStart)) ++bufptrStart; bufptrEnd = const_cast(strchr(bufptrStart, ' ')); - if (bufptrEnd == NULL || bufptrEnd - bufptrStart >= BUFSIZE) + if (bufptrEnd == nullptr || bufptrEnd - bufptrStart >= BUFSIZE) { WARNING_STRICT_FATAL(true, ("DynamicVariable::get location buffer overflow in scene")); return false; @@ -875,7 +875,7 @@ bool DynamicVariable::get(std::vector & value) cons char tempCell[BUFSIZE]; const char * bufptrStart = buffer; - char * bufptrEnd = NULL; + char * bufptrEnd = nullptr; temp.pos.x = static_cast(strtod(bufptrStart, &bufptrEnd)); bufptrStart = bufptrEnd; while (*bufptrStart != '\0' && isspace(*bufptrStart)) @@ -900,7 +900,7 @@ bool DynamicVariable::get(std::vector & value) cons while (*bufptrStart != '\0' && isspace(*bufptrStart)) ++bufptrStart; bufptrEnd = const_cast(strchr(bufptrStart, ' ')); - if (bufptrEnd == NULL || bufptrEnd - bufptrStart >= BUFSIZE) + if (bufptrEnd == nullptr || bufptrEnd - bufptrStart >= BUFSIZE) { WARNING_STRICT_FATAL(true, ("DynamicVariable::get location array buffer overflow in scene")); return false; @@ -1430,8 +1430,8 @@ namespace Archive (*f)(target.m_cachedValue[0]); } - target.m_cachedValue[0] = NULL; - target.m_cachedValue[1] = NULL; + target.m_cachedValue[0] = nullptr; + target.m_cachedValue[1] = nullptr; } } diff --git a/engine/shared/library/sharedFoundation/src/shared/dynamicVariable/DynamicVariable.h b/engine/shared/library/sharedFoundation/src/shared/dynamicVariable/DynamicVariable.h index 004de6fc..c69588ba 100755 --- a/engine/shared/library/sharedFoundation/src/shared/dynamicVariable/DynamicVariable.h +++ b/engine/shared/library/sharedFoundation/src/shared/dynamicVariable/DynamicVariable.h @@ -150,8 +150,8 @@ private: // caching the value so we don't constantly convert them from the string representation // // if the value can fit in m_cachedValue, we directly store it there - // int uses m_cachedValue[0], m_cachedValue[1] = NULL - // float uses m_cachedValue[0], m_cachedValue[1] = NULL + // int uses m_cachedValue[0], m_cachedValue[1] = nullptr + // float uses m_cachedValue[0], m_cachedValue[1] = nullptr // NetworkId uses both m_cachedValue[0] and m_cachedValue[1] // // if not, we allocate storage for the value and store the pointer to it diff --git a/engine/shared/library/sharedGame/src/shared/appearance/WearableAppearanceMap.cpp b/engine/shared/library/sharedGame/src/shared/appearance/WearableAppearanceMap.cpp index 63d98b04..5b7e478f 100755 --- a/engine/shared/library/sharedGame/src/shared/appearance/WearableAppearanceMap.cpp +++ b/engine/shared/library/sharedGame/src/shared/appearance/WearableAppearanceMap.cpp @@ -155,9 +155,9 @@ WearableAppearanceMapNamespace::PersistentMapEntry::PersistentMapEntry(char cons MapEntry(), m_sourceWearableAppearanceName(sourceWearableAppearanceName, true), m_wearerAppearanceName(wearerAppearanceName, true), - m_mappedWearableAppearanceName(NULL) + m_mappedWearableAppearanceName(nullptr) { - if (mappedWearableAppearanceName != NULL) + if (mappedWearableAppearanceName != nullptr) m_mappedWearableAppearanceName = new PersistentCrcString(mappedWearableAppearanceName, true); } @@ -218,7 +218,7 @@ CrcString const &WearableAppearanceMapNamespace::TemporaryMapEntry::getWearerApp CrcString const *WearableAppearanceMapNamespace::TemporaryMapEntry::getMappedWearableAppearanceName() const { - return NULL; + return nullptr; } // ====================================================================== @@ -297,7 +297,7 @@ void WearableAppearanceMapNamespace::loadTableData(char const *filename) std::string const &mappedWearableAppearanceName = table->getStringValue(mappedWearableAppearanceNameColumnNumber, rowIndex); //-- Create map entry, add to vector. - s_mapEntries.push_back(new PersistentMapEntry(sourceWearableAppearanceName.c_str(), wearerAppearanceName.c_str(), (mappedWearableAppearanceName == cs_forbiddenWearableCellContents) ? NULL : mappedWearableAppearanceName.c_str())); + s_mapEntries.push_back(new PersistentMapEntry(sourceWearableAppearanceName.c_str(), wearerAppearanceName.c_str(), (mappedWearableAppearanceName == cs_forbiddenWearableCellContents) ? nullptr : mappedWearableAppearanceName.c_str())); } DataTableManager::close(filename); @@ -388,7 +388,7 @@ WearableAppearanceMap::MapResult WearableAppearanceMap::getMapResultForWearableA if (findResult.first == findResult.second) { // We have no mapping for this entry. That implies the source wearable appearance name can be used as is. - return MapResult(false, false, NULL); + return MapResult(false, false, nullptr); } else { @@ -398,7 +398,7 @@ WearableAppearanceMap::MapResult WearableAppearanceMap::getMapResultForWearableA // We have a mapping. Return it. CrcString const *const mappedWearableAppearanceName = mapEntry->getMappedWearableAppearanceName(); - return MapResult(true, mappedWearableAppearanceName == NULL, mappedWearableAppearanceName); + return MapResult(true, mappedWearableAppearanceName == nullptr, mappedWearableAppearanceName); } } diff --git a/engine/shared/library/sharedGame/src/shared/collision/CollisionCallbackManager.cpp b/engine/shared/library/sharedGame/src/shared/collision/CollisionCallbackManager.cpp index fc8d7b13..89f58b9a 100755 --- a/engine/shared/library/sharedGame/src/shared/collision/CollisionCallbackManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/collision/CollisionCallbackManager.cpp @@ -279,8 +279,8 @@ bool CollisionCallbackManager::intersectAndReflectWithTerrain(Object * const obj void CollisionCallbackManagerNamespace::noCollisionDetectionThisFrame(Object * const object) { - FATAL(!ms_convertObjectToIndex, ("CollisionCallbackManagerNamespace::noCollisionDetectionThisFrame: ms_convertObjectToIndex == NULL.")); - FATAL(!object, ("CollisionCallbackManagerNamespace::noCollisionDetectionThisFrame: object == NULL.")); + FATAL(!ms_convertObjectToIndex, ("CollisionCallbackManagerNamespace::noCollisionDetectionThisFrame: ms_convertObjectToIndex == nullptr.")); + FATAL(!object, ("CollisionCallbackManagerNamespace::noCollisionDetectionThisFrame: object == nullptr.")); int const index = ms_convertObjectToIndex(object); @@ -298,9 +298,9 @@ void CollisionCallbackManagerNamespace::noCollisionDetectionThisFrame(Object * c bool CollisionCallbackManagerNamespace::collisionDetectionOnHit(Object * const object, Object * const wasHitByThisObject) { - FATAL(!ms_convertObjectToIndex, ("CollisionCallbackManagerNamespace::collisionDetectionOnHit: ms_convertObjectToIndex == NULL.")); - FATAL(!object, ("CollisionCallbackManagerNamespace::collisionDetectionOnHit: object == NULL.")); - FATAL(!wasHitByThisObject, ("CollisionCallbackManagerNamespace::collisionDetectionOnHit: wasHitByThisObject == NULL.")); + FATAL(!ms_convertObjectToIndex, ("CollisionCallbackManagerNamespace::collisionDetectionOnHit: ms_convertObjectToIndex == nullptr.")); + FATAL(!object, ("CollisionCallbackManagerNamespace::collisionDetectionOnHit: object == nullptr.")); + FATAL(!wasHitByThisObject, ("CollisionCallbackManagerNamespace::collisionDetectionOnHit: wasHitByThisObject == nullptr.")); CollisionCallbackManager::OnHitByObjectFunction function = 0; diff --git a/engine/shared/library/sharedGame/src/shared/core/AiDebugString.cpp b/engine/shared/library/sharedGame/src/shared/core/AiDebugString.cpp index 544cf1af..af8d3ef1 100755 --- a/engine/shared/library/sharedGame/src/shared/core/AiDebugString.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/AiDebugString.cpp @@ -69,7 +69,7 @@ AiDebugString::AiDebugString(std::string const & text) Unicode::String const delimiters(Unicode::narrowToWide("`")); Unicode::UnicodeStringVector result; - if (Unicode::tokenize(Unicode::narrowToWide(text), result, &delimiters, NULL)) + if (Unicode::tokenize(Unicode::narrowToWide(text), result, &delimiters, nullptr)) { Unicode::UnicodeStringVector::const_iterator iterStringVector = result.begin(); diff --git a/engine/shared/library/sharedGame/src/shared/core/AssetCustomizationManager.cpp b/engine/shared/library/sharedGame/src/shared/core/AssetCustomizationManager.cpp index 34acdca1..88432113 100755 --- a/engine/shared/library/sharedGame/src/shared/core/AssetCustomizationManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/AssetCustomizationManager.cpp @@ -192,31 +192,31 @@ void AssetCustomizationManagerNamespace::remove() s_installed = false; delete [] s_nameDataBlock; - s_nameDataBlock = NULL; + s_nameDataBlock = nullptr; s_nameDataBlockSize = 0; delete [] s_paletteIdNameOffsetMap; - s_paletteIdNameOffsetMap = NULL; + s_paletteIdNameOffsetMap = nullptr; s_maxValidPaletteId = 0; delete [] s_variableIdNameOffsetMap; - s_variableIdNameOffsetMap = NULL; + s_variableIdNameOffsetMap = nullptr; s_maxValidVariableId = 0; delete [] s_defaultValueMap; - s_defaultValueMap = NULL; + s_defaultValueMap = nullptr; s_maxValidDefaultId = 0; delete [] s_intRangeMap; - s_intRangeMap = NULL; + s_intRangeMap = nullptr; s_maxValidIntRangeId = 0; delete [] s_rangeTypeMap; - s_rangeTypeMap = NULL; + s_rangeTypeMap = nullptr; s_maxValidRangeId = 0; delete [] s_variableUsageMap; - s_variableUsageMap = NULL; + s_variableUsageMap = nullptr; s_maxValidVariableUsageId = 0; delete [] s_variableUsageList; @@ -224,19 +224,19 @@ void AssetCustomizationManagerNamespace::remove() s_variableUsageListEntryCount = 0; delete [] s_usageIndex; - s_usageIndex = NULL; + s_usageIndex = nullptr; s_usageIndexEntryCount = 0; delete [] s_linkList; - s_linkList = NULL; + s_linkList = nullptr; s_linkListEntryCount = 0; delete [] s_linkIndex; - s_linkIndex = NULL; + s_linkIndex = nullptr; s_linkIndexEntryCount = 0; delete [] s_crcLookupTable; - s_crcLookupTable = NULL; + s_crcLookupTable = nullptr; s_crcLookupEntryCount = 0; } @@ -488,7 +488,7 @@ int AssetCustomizationManagerNamespace::lookupAssetId(CrcString const &assetName uint32 const key = assetName.getCrc(); CrcLookupEntry const *entry = static_cast(bsearch(&key, s_crcLookupTable, static_cast(s_crcLookupEntryCount), sizeof(CrcLookupEntry), compare_uint32)); - return (entry != NULL) ? entry->assetId : 0; + return (entry != nullptr) ? entry->assetId : 0; } // ---------------------------------------------------------------------- @@ -584,7 +584,7 @@ void AssetCustomizationManagerNamespace::addVariablesForAssetAndLinks(int assetI getRangeTypeInfoFromRangeId(variableUsage->rangeId, isPalette, idForRealType); //-- Create variable based on type. - CustomizationVariable *variable = NULL; + CustomizationVariable *variable = nullptr; if (isPalette) { //-- Get palette. diff --git a/engine/shared/library/sharedGame/src/shared/core/CitizenRankDataTable.cpp b/engine/shared/library/sharedGame/src/shared/core/CitizenRankDataTable.cpp index 2edf349d..a5f37664 100755 --- a/engine/shared/library/sharedGame/src/shared/core/CitizenRankDataTable.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/CitizenRankDataTable.cpp @@ -63,7 +63,7 @@ void CitizenRankDataTable::install() FATAL((columnRankSlotId < 0), ("column \"rankSlotId\" not found in %s", cs_citizenRankDataTableName)); FATAL((columnTitle < 0), ("column \"title\" not found in %s", cs_citizenRankDataTableName)); - CitizenRankDataTable::CitizenRank const * currentRank = NULL; + CitizenRankDataTable::CitizenRank const * currentRank = nullptr; int const numRows = table->getNumRows(); std::string rankName, alternateTitle; @@ -199,7 +199,7 @@ CitizenRankDataTable::CitizenRank const * CitizenRankDataTable::getRank(std::str if (iterFind != s_allCitizenRanksByName.end()) return iterFind->second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -210,7 +210,7 @@ CitizenRankDataTable::CitizenRank const * CitizenRankDataTable::isARankTitle(std if (iterFind != s_allCitizenRanksByTitle.end()) return iterFind->second; - return NULL; + return nullptr; } // ====================================================================== diff --git a/engine/shared/library/sharedGame/src/shared/core/CollectionsDataTable.cpp b/engine/shared/library/sharedGame/src/shared/core/CollectionsDataTable.cpp index 74cc78cc..f7402fdb 100755 --- a/engine/shared/library/sharedGame/src/shared/core/CollectionsDataTable.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/CollectionsDataTable.cpp @@ -34,7 +34,7 @@ namespace CollectionsDataTableNamespace // for quick lookup of a slot by begin slot id, we use a vector because // slot id are guaranteed to start at 0 and be contiguous; for counter-type // slot, only the begin slot id index points to the slot; the other slot - // id indices point to NULL + // id indices point to nullptr std::vector s_allSlotsById; // all title(able) slots @@ -232,10 +232,10 @@ void CollectionsDataTable::install() FATAL((columnNoReward < 0), ("column \"noReward\" not found in %s", cs_collectionsDataTableName)); FATAL((columnTrackServerFirst < 0), ("column \"trackServerFirst\" not found in %s", cs_collectionsDataTableName)); - CollectionsDataTable::CollectionInfoBook const * currentBook = NULL; - CollectionsDataTable::CollectionInfoPage const * currentPage = NULL; - CollectionsDataTable::CollectionInfoCollection const * currentCollection = NULL; - CollectionsDataTable::CollectionInfoSlot const * currentSlot = NULL; + CollectionsDataTable::CollectionInfoBook const * currentBook = nullptr; + CollectionsDataTable::CollectionInfoPage const * currentPage = nullptr; + CollectionsDataTable::CollectionInfoCollection const * currentCollection = nullptr; + CollectionsDataTable::CollectionInfoSlot const * currentSlot = nullptr; int const numRows = table->getNumRows(); std::string bookName, pageName, collectionName, slotName, category, prereq, alternateTitle, icon, music; @@ -350,8 +350,8 @@ void CollectionsDataTable::install() FATAL(title, ("%s: book %s cannot be \"titleable\")", cs_collectionsDataTableName, bookName.c_str())); FATAL(!titles.empty(), ("%s: book %s cannot have any alternate titles (books are not \"titleable\")", cs_collectionsDataTableName, bookName.c_str())); currentBook = new CollectionInfoBook(bookName, icon, showIfNotYetEarned, hidden); - currentPage = NULL; - currentCollection = NULL; + currentPage = nullptr; + currentCollection = nullptr; s_allBooks.push_back(currentBook); s_allBooksByName[bookName] = currentBook; } @@ -376,7 +376,7 @@ void CollectionsDataTable::install() // start new page FATAL((!titles.empty() && !title), ("%s: page %s cannot have any alternate titles unless it is defined as \"titleable\")", cs_collectionsDataTableName, pageName.c_str())); currentPage = new CollectionInfoPage(pageName, icon, showIfNotYetEarned, hidden, titles, *currentBook); - currentCollection = NULL; + currentCollection = nullptr; s_pagesInBook[currentBook->name].push_back(currentPage); s_allPagesByName[pageName] = currentPage; @@ -549,7 +549,7 @@ void CollectionsDataTable::install() IGNORE_RETURN(s_slotCategoriesByCollection[currentCollection->name].insert(*iterCategories)); } - currentSlot = NULL; + currentSlot = nullptr; categories.clear(); prereqs.clear(); } @@ -575,7 +575,7 @@ void CollectionsDataTable::install() } // save off all slots ordered by slot ids - s_allSlotsById.resize(allSlotsById.size(), NULL); + s_allSlotsById.resize(allSlotsById.size(), nullptr); beginSlotId = -1; for (std::map::const_iterator iterSlotId = allSlotsById.begin(); iterSlotId != allSlotsById.end(); ++iterSlotId) { @@ -612,7 +612,7 @@ void CollectionsDataTable::install() } else { - s_allSlotsById[iterSlotId->first] = NULL; + s_allSlotsById[iterSlotId->first] = nullptr; } } @@ -733,7 +733,7 @@ CollectionsDataTable::CollectionInfoSlot const * CollectionsDataTable::getSlotBy if (iterFind != s_allSlotsByName.end()) return iterFind->second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -743,7 +743,7 @@ CollectionsDataTable::CollectionInfoSlot const * CollectionsDataTable::getSlotBy CollectionsDataTable::CollectionInfoSlot const * CollectionsDataTable::getSlotByBeginSlotId(int slotId) { if ((slotId < 0) || (slotId >= static_cast(s_allSlotsById.size()))) - return NULL; + return nullptr; return s_allSlotsById[slotId]; } @@ -763,7 +763,7 @@ CollectionsDataTable::CollectionInfoSlot const * CollectionsDataTable::isASlotTi if (iterFind != s_allSlotTitles.end()) return iterFind->second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -796,7 +796,7 @@ CollectionsDataTable::CollectionInfoCollection const * CollectionsDataTable::isA if (iterFind != s_allCollectionTitles.end()) return iterFind->second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -818,7 +818,7 @@ CollectionsDataTable::CollectionInfoCollection const * CollectionsDataTable::get if (iterFind != s_allCollectionsByName.end()) return iterFind->second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -866,7 +866,7 @@ CollectionsDataTable::CollectionInfoPage const * CollectionsDataTable::isAPageTi if (iterFind != s_allPageTitles.end()) return iterFind->second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -879,7 +879,7 @@ CollectionsDataTable::CollectionInfoPage const * CollectionsDataTable::getPageBy if (iterFind != s_allPagesByName.end()) return iterFind->second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -946,7 +946,7 @@ CollectionsDataTable::CollectionInfoBook const * CollectionsDataTable::getBookBy if (iterFind != s_allBooksByName.end()) return iterFind->second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedGame/src/shared/core/CommoditiesAdvancedSearchAttribute.cpp b/engine/shared/library/sharedGame/src/shared/core/CommoditiesAdvancedSearchAttribute.cpp index 585dbd1d..8c896b4f 100755 --- a/engine/shared/library/sharedGame/src/shared/core/CommoditiesAdvancedSearchAttribute.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/CommoditiesAdvancedSearchAttribute.cpp @@ -125,7 +125,7 @@ void CommoditiesAdvancedSearchAttribute::install() { // handle search attribute name alias tokens.clear(); - if (Unicode::tokenize(Unicode::narrowToWide(searchAttributeName), tokens, NULL, NULL) && (tokens.size() > 1)) + if (Unicode::tokenize(Unicode::narrowToWide(searchAttributeName), tokens, nullptr, nullptr) && (tokens.size() > 1)) { // the first value is the search attribute name to display searchAttributeName = Unicode::wideToNarrow(tokens[0]); @@ -177,7 +177,7 @@ void CommoditiesAdvancedSearchAttribute::install() { // for enum, parse out the aliases (if any) for the enum value tokens.clear(); - if (Unicode::tokenize(Unicode::narrowToWide(defaultSearchValue), tokens, NULL, NULL) && !tokens.empty()) + if (Unicode::tokenize(Unicode::narrowToWide(defaultSearchValue), tokens, nullptr, nullptr) && !tokens.empty()) { #ifdef _WIN32 #ifdef _DEBUG @@ -340,7 +340,7 @@ CommoditiesAdvancedSearchAttribute::SearchAttribute const * CommoditiesAdvancedS return iterFindAttribute->second; } - return NULL; + return nullptr; } //---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedGame/src/shared/core/CustomizationManager.cpp b/engine/shared/library/sharedGame/src/shared/core/CustomizationManager.cpp index 051bb14e..77dc02eb 100755 --- a/engine/shared/library/sharedGame/src/shared/core/CustomizationManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/CustomizationManager.cpp @@ -441,7 +441,7 @@ CustomizationVariable * CustomizationManager::findVariable (CustomizationData & if(!ms_installed) { DEBUG_FATAL(true, ("CustomizationManager not installed")); - return NULL; //lint !e527 unreachable (reachable in release) + return nullptr; //lint !e527 unreachable (reachable in release) } PathType type = PT_none; @@ -455,7 +455,7 @@ CustomizationVariable * CustomizationManager::findVariable (CustomizationData & if(!ms_installed) { DEBUG_FATAL(true, ("CustomizationManager not installed")); - return NULL; //lint !e527 unreachable (reachable in release) + return nullptr; //lint !e527 unreachable (reachable in release) } type = PT_none; @@ -467,7 +467,7 @@ CustomizationVariable * CustomizationManager::findVariable (CustomizationData & { //if we have the ranged customization variable is a dependent variable, ignore it (there will be another that controls it) if(rangedCV->getIsDependentVariable()) - cv = NULL; + cv = nullptr; } if (!cv) diff --git a/engine/shared/library/sharedGame/src/shared/core/FormManager.cpp b/engine/shared/library/sharedGame/src/shared/core/FormManager.cpp index 7074ff4c..789c118a 100755 --- a/engine/shared/library/sharedGame/src/shared/core/FormManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/FormManager.cpp @@ -81,10 +81,10 @@ FormManager::Field::Field(Form const * const parent) FormManager::Field::~Field() { delete m_choices; - m_choices = NULL; + m_choices = nullptr; delete m_otherValidationRules; - m_otherValidationRules = NULL; - m_parentForm = NULL; + m_otherValidationRules = nullptr; + m_parentForm = nullptr; } //---------------------------------------------------------------------- @@ -453,12 +453,12 @@ FormManager::Form::~Form() { //this vector does NOT own the pointers delete m_orderedFieldList; - m_orderedFieldList = NULL; + m_orderedFieldList = nullptr; //this list owns the pointers, so release it std::for_each(m_fields->begin(), m_fields->end(), PointerDeleterPairSecond()); delete m_fields; - m_fields = NULL; + m_fields = nullptr; } //---------------------------------------------------------------------- @@ -477,7 +477,7 @@ FormManager::Field const * FormManager::Form::getField(std::string const & field if(i != m_fields->end()) return i->second; else - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -531,13 +531,13 @@ void FormManager::remove () clearData(); delete ms_forms; - ms_forms = NULL; + ms_forms = nullptr; delete ms_serverObjectTemplateToForms; - ms_serverObjectTemplateToForms = NULL; + ms_serverObjectTemplateToForms = nullptr; delete ms_sharedObjectTemplateToForms; - ms_sharedObjectTemplateToForms = NULL; + ms_sharedObjectTemplateToForms = nullptr; delete ms_automaticallyCreateObjectForServerObjectTemplate; - ms_automaticallyCreateObjectForServerObjectTemplate = NULL; + ms_automaticallyCreateObjectForServerObjectTemplate = nullptr; s_tablesLoaded = false; s_installed = false; @@ -764,13 +764,13 @@ FormManager::Form const * FormManager::getFormByName(std::string const & formNam { DEBUG_FATAL (!s_installed, ("not installed")); if(!s_installed) - return NULL; + return nullptr; std::map::iterator i = ms_forms->find(formName); if(i != ms_forms->end()) return i->second; else - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -779,13 +779,13 @@ FormManager::Form const * FormManager::getFormForServerObjectTemplate(std::strin { DEBUG_FATAL (!s_installed, ("not installed")); if(!s_installed) - return NULL; + return nullptr; std::map::iterator i = ms_serverObjectTemplateToForms->find(serverTemplateName); if(i != ms_serverObjectTemplateToForms->end()) return i->second; else - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -794,13 +794,13 @@ FormManager::Form const * FormManager::getFormForSharedObjectTemplate(std::strin { DEBUG_FATAL (!s_installed, ("not installed")); if(!s_installed) - return NULL; + return nullptr; std::map::iterator i = ms_sharedObjectTemplateToForms->find(sharedTemplateName); if(i != ms_sharedObjectTemplateToForms->end()) return i->second; else - return NULL; + return nullptr; } //---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedGame/src/shared/core/GameScheduler.cpp b/engine/shared/library/sharedGame/src/shared/core/GameScheduler.cpp index e0b848ba..9ec51701 100755 --- a/engine/shared/library/sharedGame/src/shared/core/GameScheduler.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/GameScheduler.cpp @@ -74,7 +74,7 @@ void GameScheduler::remove() DEBUG_FATAL(!s_installed, ("GameScheduler not installed.")); delete s_scheduler; - s_scheduler = NULL; + s_scheduler = nullptr; s_installed = false; } diff --git a/engine/shared/library/sharedGame/src/shared/core/GroundZoneManager.cpp b/engine/shared/library/sharedGame/src/shared/core/GroundZoneManager.cpp index bc38d3e0..ddf2992d 100755 --- a/engine/shared/library/sharedGame/src/shared/core/GroundZoneManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/GroundZoneManager.cpp @@ -103,12 +103,12 @@ BuildoutArea const * GroundZoneManager::getZoneName(std::string const & sceneNam if(!SharedBuildoutAreaManager::isBuildoutScene(sceneName)) { - return NULL; + return nullptr; } else { BuildoutArea const * const ba = SharedBuildoutAreaManager::findBuildoutAreaAtPosition(sceneName, location_w.x, location_w.z, true); - if (NULL != ba) + if (nullptr != ba) { if (!ba->compositeName.empty()) zoneName = ba->compositeName; @@ -126,7 +126,7 @@ Vector GroundZoneManager::transformWorldLocationToZoneLocation(std::string const Vector pos_w = location_w; std::string zoneName; BuildoutArea const * const ba = GroundZoneManager::getZoneName(sceneName, location_w, zoneName); - if (NULL != ba) + if (nullptr != ba) { pos_w = ba->getRelativePosition(location_w, true); } diff --git a/engine/shared/library/sharedGame/src/shared/core/GuildRankDataTable.cpp b/engine/shared/library/sharedGame/src/shared/core/GuildRankDataTable.cpp index 2bd66b99..b5f2c62a 100755 --- a/engine/shared/library/sharedGame/src/shared/core/GuildRankDataTable.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/GuildRankDataTable.cpp @@ -65,7 +65,7 @@ void GuildRankDataTable::install() FATAL((columnRankSlotId < 0), ("column \"rankSlotId\" not found in %s", cs_guildRankDataTableName)); FATAL((columnTitle < 0), ("column \"title\" not found in %s", cs_guildRankDataTableName)); - GuildRankDataTable::GuildRank const * currentRank = NULL; + GuildRankDataTable::GuildRank const * currentRank = nullptr; int const numRows = table->getNumRows(); std::string rankName, alternateTitle; @@ -207,7 +207,7 @@ GuildRankDataTable::GuildRank const * GuildRankDataTable::getRank(std::string co if (iterFind != s_allGuildRanksByName.end()) return iterFind->second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -218,7 +218,7 @@ GuildRankDataTable::GuildRank const * GuildRankDataTable::getRankForDisplayRankN if (iterFind != s_allGuildRanksByDisplayName.end()) return iterFind->second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -229,7 +229,7 @@ GuildRankDataTable::GuildRank const * GuildRankDataTable::isARankTitle(std::stri if (iterFind != s_allGuildRanksByTitle.end()) return iterFind->second; - return NULL; + return nullptr; } // ====================================================================== diff --git a/engine/shared/library/sharedGame/src/shared/core/LfgCharacterData.cpp b/engine/shared/library/sharedGame/src/shared/core/LfgCharacterData.cpp index 31a0e655..3f26cadd 100755 --- a/engine/shared/library/sharedGame/src/shared/core/LfgCharacterData.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/LfgCharacterData.cpp @@ -1127,7 +1127,7 @@ std::map const & LfgCharacterData::calculateStatistics(std::ma } } - int32 const timeNow = static_cast(::time(NULL)); + int32 const timeNow = static_cast(::time(nullptr)); for (std::map::const_iterator iterLfgData = connectedCharacterLfgData.begin(); iterLfgData != connectedCharacterLfgData.end(); ++iterLfgData) { // searchable/anonymous diff --git a/engine/shared/library/sharedGame/src/shared/core/LfgDataTable.cpp b/engine/shared/library/sharedGame/src/shared/core/LfgDataTable.cpp index 6acce604..f7cfb688 100755 --- a/engine/shared/library/sharedGame/src/shared/core/LfgDataTable.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/LfgDataTable.cpp @@ -379,10 +379,10 @@ void LfgDataTable::install() unsigned long maxValueForNumBits; std::map names; std::map allSlotsById; - LfgNode * lfgNode = NULL; - LfgNode * currentTier1Node = NULL; - LfgNode * currentTier2Node = NULL; - LfgNode * currentTier3Node = NULL; + LfgNode * lfgNode = nullptr; + LfgNode * currentTier1Node = nullptr; + LfgNode * currentTier2Node = nullptr; + LfgNode * currentTier3Node = nullptr; for (int i = 0; i < numRows; ++i) { @@ -472,15 +472,15 @@ void LfgDataTable::install() FATAL(((minValue > 0) && (maxValueBeginSlotId < 0)), ("%s, row %d: minValueBeginSlotId/minValueEndSlotId/maxValueBeginSlotId/maxValueEndSlotId must be specified if minValue/maxValue is specified", cs_lfgDataTableName, (i+3))); // create a new node - lfgNode = NULL; + lfgNode = nullptr; if (!tier1.empty()) { - lfgNode = new LfgNode(tier1, internalAttribute, minValueBeginSlotId, minValueEndSlotId, maxValueBeginSlotId, maxValueEndSlotId, minValue, maxValue, defaultMatchCondition, NULL); + lfgNode = new LfgNode(tier1, internalAttribute, minValueBeginSlotId, minValueEndSlotId, maxValueBeginSlotId, maxValueEndSlotId, minValue, maxValue, defaultMatchCondition, nullptr); s_topLevelNodes.push_back(lfgNode); currentTier1Node = lfgNode; - currentTier2Node = NULL; - currentTier3Node = NULL; + currentTier2Node = nullptr; + currentTier3Node = nullptr; } else if (!tier2.empty()) { @@ -490,7 +490,7 @@ void LfgDataTable::install() currentTier1Node->children.push_back(lfgNode); currentTier2Node = lfgNode; - currentTier3Node = NULL; + currentTier3Node = nullptr; } else if (!tier3.empty()) { @@ -580,7 +580,7 @@ void LfgDataTable::install() // find out the leaf node's ancestor, if any, that has the Any/All option LfgNode const * parentNode = node.parent; - bool const hasParent = (parentNode != NULL); + bool const hasParent = (parentNode != nullptr); int countParentWithNonNaDefaultMatchCondition = 0; std::string stringParentWithNonNaDefaultMatchCondition; while (parentNode) @@ -670,7 +670,7 @@ LfgDataTable::LfgNode const * LfgDataTable::getLfgNodeByName(std::string const & { std::map::const_iterator iterNode = s_allNodesByName.find(lfgNodeName); if (iterNode == s_allNodesByName.end()) - return NULL; + return nullptr; return iterNode->second; } @@ -681,7 +681,7 @@ LfgDataTable::LfgNode const * LfgDataTable::getLfgLeafNodeByName(std::string con { std::map::const_iterator iterNode = s_allLeafNodesByName.find(lfgNodeName); if (iterNode == s_allLeafNodesByName.end()) - return NULL; + return nullptr; return iterNode->second; } diff --git a/engine/shared/library/sharedGame/src/shared/core/LfgDataTable.h b/engine/shared/library/sharedGame/src/shared/core/LfgDataTable.h index e95f1e85..5ffc3e70 100755 --- a/engine/shared/library/sharedGame/src/shared/core/LfgDataTable.h +++ b/engine/shared/library/sharedGame/src/shared/core/LfgDataTable.h @@ -47,7 +47,7 @@ public: { public: LfgNode(std::string const & pName, bool pInternalAttribute, int pMinValueBeginSlotId, int pMinValueEndSlotId, int pMaxValueBeginSlotId, int pMaxValueEndSlotId, int pMinValue, int pMaxValue, DefaultMatchConditionType pDefaultMatchCondition, LfgNode const * pParent) : - name(pName), internalAttribute(pInternalAttribute), minValueBeginSlotId(pMinValueBeginSlotId), minValueEndSlotId(pMinValueEndSlotId), maxValueBeginSlotId(pMaxValueBeginSlotId), maxValueEndSlotId(pMaxValueEndSlotId), minValue(pMinValue), maxValue(pMaxValue), defaultMatchCondition(pDefaultMatchCondition), actualMatchCondition(DMCT_NA), parent(pParent), anyAllGroupingParent(NULL), children(), hasAnyInternalAttributeLeafNodeDescendants(false), hasAnyExternalAttributeLeafNodeDescendants(false), internalAttributeMatchFunction(NULL) {}; + name(pName), internalAttribute(pInternalAttribute), minValueBeginSlotId(pMinValueBeginSlotId), minValueEndSlotId(pMinValueEndSlotId), maxValueBeginSlotId(pMaxValueBeginSlotId), maxValueEndSlotId(pMaxValueEndSlotId), minValue(pMinValue), maxValue(pMaxValue), defaultMatchCondition(pDefaultMatchCondition), actualMatchCondition(DMCT_NA), parent(pParent), anyAllGroupingParent(nullptr), children(), hasAnyInternalAttributeLeafNodeDescendants(false), hasAnyExternalAttributeLeafNodeDescendants(false), internalAttributeMatchFunction(nullptr) {}; std::string const name; bool const internalAttribute; diff --git a/engine/shared/library/sharedGame/src/shared/core/PlayerCreationManager.cpp b/engine/shared/library/sharedGame/src/shared/core/PlayerCreationManager.cpp index 24efe09a..d089cc2c 100755 --- a/engine/shared/library/sharedGame/src/shared/core/PlayerCreationManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/PlayerCreationManager.cpp @@ -530,9 +530,9 @@ void PlayerCreationManager::buildRacialMinsMaxes() const DataTable * dt = DataTableManager::getTable( "datatables/creation/attribute_limits.iff", true); - WARNING_STRICT_FATAL(dt == NULL, ("Unable to read the " + WARNING_STRICT_FATAL(dt == nullptr, ("Unable to read the " "attribute_limits datatable")); - if (dt == NULL) + if (dt == nullptr) return; int numAttribs = dt->getNumColumns() - 1; diff --git a/engine/shared/library/sharedGame/src/shared/core/SharedBuffBuilderManager.cpp b/engine/shared/library/sharedGame/src/shared/core/SharedBuffBuilderManager.cpp index 40e7ffb8..a9edcafd 100755 --- a/engine/shared/library/sharedGame/src/shared/core/SharedBuffBuilderManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/SharedBuffBuilderManager.cpp @@ -29,7 +29,7 @@ namespace SharedBuffBuilderManagerNamespace const std::string ms_reactiveSecondChanceComponentName = "reactive_second_chance"; } -SharedBuffBuilderManager::BuffBuilderDataType * SharedBuffBuilderManager::ms_buffBuilderData=NULL; +SharedBuffBuilderManager::BuffBuilderDataType * SharedBuffBuilderManager::ms_buffBuilderData=nullptr; using namespace SharedBuffBuilderManagerNamespace; // ====================================================================== diff --git a/engine/shared/library/sharedGame/src/shared/core/SharedBuildoutAreaManager.cpp b/engine/shared/library/sharedGame/src/shared/core/SharedBuildoutAreaManager.cpp index cec5ff33..5786d3e6 100755 --- a/engine/shared/library/sharedGame/src/shared/core/SharedBuildoutAreaManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/SharedBuildoutAreaManager.cpp @@ -321,7 +321,7 @@ std::string SharedBuildoutAreaManager::getBuildoutNameForPosition(std::string co { BuildoutArea const * const ba = findBuildoutAreaAtPosition(sceneName, location_w.x, location_w.z, ignoreInternal, ignoreNonActiveEvents); - if (NULL != ba) + if (nullptr != ba) return sceneName + cms_sceneAndAreaDelimeter + ba->areaName; return sceneName; @@ -537,7 +537,7 @@ SharedBuildoutAreaManager::BuildoutAreaVector const * SharedBuildoutAreaManager: { return &it->second; } - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -546,8 +546,8 @@ BuildoutArea const * SharedBuildoutAreaManager::findBuildoutAreaAtPosition(std:: { BuildoutAreaVector const * const bav = findBuildoutAreasForScene(sceneId); - if (NULL == bav) - return NULL; + if (nullptr == bav) + return nullptr; for (BuildoutAreaVector::const_iterator it = bav->begin(); it != bav->end(); ++it) { @@ -567,7 +567,7 @@ BuildoutArea const * SharedBuildoutAreaManager::findBuildoutAreaAtPosition(std:: } } - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -579,11 +579,11 @@ BuildoutArea const * SharedBuildoutAreaManager::findBuildoutAreaAtPosition(float if (ignoreInternal && buildoutArea.internalBuildoutArea) { - return NULL; + return nullptr; } if(ignoreNonActiveEvents && !buildoutArea.requiredEventName.empty()) - return NULL; + return nullptr; if (buildoutArea.isLocationInside(x, z)) { @@ -591,7 +591,7 @@ BuildoutArea const * SharedBuildoutAreaManager::findBuildoutAreaAtPosition(float } } - return NULL; + return nullptr; } //---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedGame/src/shared/core/SharedImageDesignerManager.cpp b/engine/shared/library/sharedGame/src/shared/core/SharedImageDesignerManager.cpp index 62e46247..c0ee57fa 100755 --- a/engine/shared/library/sharedGame/src/shared/core/SharedImageDesignerManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/SharedImageDesignerManager.cpp @@ -358,7 +358,7 @@ bool SharedImageDesignerManager::isSessionValid(SharedImageDesignerManager::Sess if(customizationDataHair) customizationDataForThisCustomization = customizationDataHair; else - customizationDataForThisCustomization = NULL; + customizationDataForThisCustomization = nullptr; } if(customizationDataForThisCustomization) diff --git a/engine/shared/library/sharedGame/src/shared/core/Universe.cpp b/engine/shared/library/sharedGame/src/shared/core/Universe.cpp index 5d5186d4..60eeba1e 100755 --- a/engine/shared/library/sharedGame/src/shared/core/Universe.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/Universe.cpp @@ -17,14 +17,14 @@ // ====================================================================== -Universe * Universe::ms_theInstance = NULL; +Universe * Universe::ms_theInstance = nullptr; bool Universe::ms_installed = false; //=================================================================== void Universe::installDerived(Universe *derivedInstance) { - DEBUG_FATAL(ms_installed || ms_theInstance!=NULL,("Installed Universe twice.\n")); + DEBUG_FATAL(ms_installed || ms_theInstance!=nullptr,("Installed Universe twice.\n")); ms_theInstance = derivedInstance; ms_installed = true; @@ -43,7 +43,7 @@ void Universe::remove() Universe::Universe() : m_resourceClassNameMap (new ResourceClassNameMap), m_resourceClassNameCrcMap (new ResourceClassNameCrcMap), - m_resourceTreeRoot (NULL) + m_resourceTreeRoot (nullptr) { ResourceClassObject::install(); // sets up some static strings used by the import process } diff --git a/engine/shared/library/sharedGame/src/shared/core/WearableEntry.cpp b/engine/shared/library/sharedGame/src/shared/core/WearableEntry.cpp index 767c20f4..f0c9912a 100755 --- a/engine/shared/library/sharedGame/src/shared/core/WearableEntry.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/WearableEntry.cpp @@ -103,7 +103,7 @@ namespace Archive put(target, source.m_networkId); put(target, source.m_objectTemplate); - bool isWeapon = (source.m_weaponSharedBaselines.get() != NULL); + bool isWeapon = (source.m_weaponSharedBaselines.get() != nullptr); put(target, isWeapon); if (isWeapon) { diff --git a/engine/shared/library/sharedGame/src/shared/mount/MountValidScaleRangeTable.cpp b/engine/shared/library/sharedGame/src/shared/mount/MountValidScaleRangeTable.cpp index 775c8119..4a4139a9 100755 --- a/engine/shared/library/sharedGame/src/shared/mount/MountValidScaleRangeTable.cpp +++ b/engine/shared/library/sharedGame/src/shared/mount/MountValidScaleRangeTable.cpp @@ -248,7 +248,7 @@ void MountValidScaleRangeTableNamespace::loadTableData(char const *filename) TemporaryCrcString const mountableCreatureAppearanceNameCrc(mountableCreatureAppearanceName.c_str(), true); //-- Find or create new MountableCreature instance for this creature name. - MountableCreature *mountableCreature = NULL; + MountableCreature *mountableCreature = nullptr; MountableCreatureTable::iterator lowerBoundIt = s_mountableCreatureTable.lower_bound((const CrcString*)&mountableCreatureAppearanceNameCrc); bool const mountableCreatureEntryExists = ((lowerBoundIt != s_mountableCreatureTable.end()) && !s_mountableCreatureTable.key_comp()(static_cast(&mountableCreatureAppearanceNameCrc), lowerBoundIt->first)); @@ -289,7 +289,7 @@ MountValidScaleRangeTableNamespace::MountableCreature const *MountValidScaleRang else { DEBUG_WARNING(true, ("'datatables/mount/valid_scale_range.iff' missing entry for creature appearance name '%s'", creatureAppearanceName.getString())); - return NULL; + return nullptr; } } diff --git a/engine/shared/library/sharedGame/src/shared/mount/SharedSaddleManager.cpp b/engine/shared/library/sharedGame/src/shared/mount/SharedSaddleManager.cpp index 5c2de639..083ed7c5 100755 --- a/engine/shared/library/sharedGame/src/shared/mount/SharedSaddleManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/mount/SharedSaddleManager.cpp @@ -433,7 +433,7 @@ int SharedSaddleManagerNamespace::TemporaryRiderPoseMapEntry::getRiderSeatIndex( CrcString const *SharedSaddleManagerNamespace::TemporaryRiderPoseMapEntry::getRiderPoseName() const { - return NULL; + return nullptr; } // ====================================================================== diff --git a/engine/shared/library/sharedGame/src/shared/object/ResourceClassObject.cpp b/engine/shared/library/sharedGame/src/shared/object/ResourceClassObject.cpp index 71d3696c..46293784 100755 --- a/engine/shared/library/sharedGame/src/shared/object/ResourceClassObject.cpp +++ b/engine/shared/library/sharedGame/src/shared/object/ResourceClassObject.cpp @@ -39,8 +39,8 @@ using namespace ResourceClassObjectNamespace; ResourceClassObject::ResourceClassObject() : m_resourceClassName(), - m_parentClass(NULL), - m_friendlyName(NULL), + m_parentClass(nullptr), + m_friendlyName(nullptr), m_minTypes(0), m_maxTypes(0), m_minPools(0), @@ -49,7 +49,7 @@ ResourceClassObject::ResourceClassObject() : m_nameTable(), m_recycled(false), m_permanent(false), - m_recycledVersion(NULL), + m_recycledVersion(nullptr), m_resourceAttributeRanges(new ResourceAttributeRangesType()), m_children(new ClassList) { @@ -60,18 +60,18 @@ ResourceClassObject::ResourceClassObject() : ResourceClassObject::~ResourceClassObject() { delete m_children; - m_children = NULL; + m_children = nullptr; delete m_resourceAttributeRanges; - m_resourceAttributeRanges = NULL; + m_resourceAttributeRanges = nullptr; - m_parentClass = NULL; - m_recycledVersion = NULL; + m_parentClass = nullptr; + m_recycledVersion = nullptr; - if (m_friendlyName != NULL) + if (m_friendlyName != nullptr) { delete m_friendlyName; - m_friendlyName = NULL; + m_friendlyName = nullptr; } } @@ -254,7 +254,7 @@ ResourceClassObject::ResourceAttributeRangesType const & ResourceClassObject::ge { static const ResourceAttributeRangesType emptyRanges; - if (m_resourceAttributeRanges != NULL) + if (m_resourceAttributeRanges != nullptr) return *m_resourceAttributeRanges; return emptyRanges; } @@ -304,7 +304,7 @@ void ResourceClassObject::loadTreeFromIff() int numRows = resourceDataTable->getNumRows(); ResourceClassObject * parents[8]; for (int i=0; i<8; ++i) - parents[i]=NULL; + parents[i]=nullptr; static const std::string colName_resourceClassName = "ENUM"; static const std::string colName_maxTypes = "Maximum # types"; @@ -334,7 +334,7 @@ void ResourceClassObject::loadTreeFromIff() if (possibleName.size()!=0) { if (wheresTheName==0) - newClass->m_parentClass = NULL; + newClass->m_parentClass = nullptr; else { newClass->m_parentClass = parents[wheresTheName-1]; @@ -438,12 +438,12 @@ bool ResourceClassObject::isLeaf() const void ResourceClassObject::getChildren(std::vector & children, bool recurse) const { - if (m_children == NULL) + if (m_children == nullptr) return; for (ClassList::const_iterator i = m_children->begin(); i != m_children->end(); ++i) { - if (*i != NULL) + if (*i != nullptr) { children.push_back(*i); if (recurse) @@ -456,12 +456,12 @@ void ResourceClassObject::getChildren(std::vector & void ResourceClassObject::getLeafChildren(std::vector & children) const { - if (m_children == NULL) + if (m_children == nullptr) return; for (ClassList::const_iterator i = m_children->begin(); i != m_children->end(); ++i) { - if (*i != NULL) + if (*i != nullptr) { if ((*i)->isLeaf()) children.push_back(*i); @@ -493,7 +493,7 @@ ResourceClassObject const * ResourceClassObject::getRecycledVersion() const return m_recycledVersion; else if (m_parentClass) return m_parentClass->getRecycledVersion(); - else return NULL; + else return nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedGame/src/shared/object/ResourceClassObject.h b/engine/shared/library/sharedGame/src/shared/object/ResourceClassObject.h index 16de81e8..1361de6e 100755 --- a/engine/shared/library/sharedGame/src/shared/object/ResourceClassObject.h +++ b/engine/shared/library/sharedGame/src/shared/object/ResourceClassObject.h @@ -118,7 +118,7 @@ inline const StringId & ResourceClassObject::getFriendlyName () const inline bool ResourceClassObject::isRoot() const { - return (m_parentClass == NULL); + return (m_parentClass == nullptr); } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedGame/src/shared/object/Waypoint.cpp b/engine/shared/library/sharedGame/src/shared/object/Waypoint.cpp index 08cc4479..74f3f8ba 100755 --- a/engine/shared/library/sharedGame/src/shared/object/Waypoint.cpp +++ b/engine/shared/library/sharedGame/src/shared/object/Waypoint.cpp @@ -160,7 +160,7 @@ WaypointDataBase::WaypointDataBase() : void WaypointDataBase::setName(Unicode::String const &name) { //This magical number (250) is chosen because the waypoint datatable has VARCHAR2(512) in this column, - //and we're assuming 2 bytes per char (which is not quite true actually) plus an extra one for null plus + //and we're assuming 2 bytes per char (which is not quite true actually) plus an extra one for nullptr plus //a few extra for good measure and because nobody needs 251-character waypoint names. if (name.length() > 250) { diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBattlefieldMarkerObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBattlefieldMarkerObjectTemplate.cpp index 9e973c36..a83d8b7f 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBattlefieldMarkerObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBattlefieldMarkerObjectTemplate.cpp @@ -95,10 +95,10 @@ Tag SharedBattlefieldMarkerObjectTemplate::getTemplateVersion(void) const */ Tag SharedBattlefieldMarkerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedBattlefieldMarkerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedBattlefieldMarkerObjectTemplate::getHighestTemplateVersion @@ -112,26 +112,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedBattlefieldMarkerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedBattlefieldMarkerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getNumberOfPoles(true); #endif } if (!m_numberOfPoles.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter numberOfPoles in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter numberOfPoles has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter numberOfPoles has not been defined in template %s!", DataResource::getName())); return base->getNumberOfPoles(); } } @@ -141,9 +141,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getNumberOfPoles(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -160,7 +160,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -176,26 +176,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedBattlefieldMarkerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedBattlefieldMarkerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getNumberOfPolesMin(true); #endif } if (!m_numberOfPoles.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter numberOfPoles in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter numberOfPoles has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter numberOfPoles has not been defined in template %s!", DataResource::getName())); return base->getNumberOfPolesMin(); } } @@ -205,9 +205,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getNumberOfPolesMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -224,7 +224,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -240,26 +240,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedBattlefieldMarkerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedBattlefieldMarkerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getNumberOfPolesMax(true); #endif } if (!m_numberOfPoles.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter numberOfPoles in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter numberOfPoles has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter numberOfPoles has not been defined in template %s!", DataResource::getName())); return base->getNumberOfPolesMax(); } } @@ -269,9 +269,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getNumberOfPolesMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -288,7 +288,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -304,26 +304,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedBattlefieldMarkerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedBattlefieldMarkerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getRadius(true); #endif } if (!m_radius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter radius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter radius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter radius has not been defined in template %s!", DataResource::getName())); return base->getRadius(); } } @@ -333,9 +333,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getRadius(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -352,7 +352,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -368,26 +368,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedBattlefieldMarkerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedBattlefieldMarkerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getRadiusMin(true); #endif } if (!m_radius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter radius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter radius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter radius has not been defined in template %s!", DataResource::getName())); return base->getRadiusMin(); } } @@ -397,9 +397,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getRadiusMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -416,7 +416,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -432,26 +432,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedBattlefieldMarkerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedBattlefieldMarkerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getRadiusMax(true); #endif } if (!m_radius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter radius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter radius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter radius has not been defined in template %s!", DataResource::getName())); return base->getRadiusMax(); } } @@ -461,9 +461,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getRadiusMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -480,7 +480,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -529,12 +529,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBuildingObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBuildingObjectTemplate.cpp index 793143b0..89b64952 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBuildingObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBuildingObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedBuildingObjectTemplate::getTemplateVersion(void) const */ Tag SharedBuildingObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedBuildingObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedBuildingObjectTemplate::getHighestTemplateVersion @@ -111,33 +111,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedBuildingObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedBuildingObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTerrainModificationFileName(true); #endif } if (!m_terrainModificationFileName.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter terrainModificationFileName in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter terrainModificationFileName has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter terrainModificationFileName has not been defined in template %s!", DataResource::getName())); return base->getTerrainModificationFileName(); } } const std::string & value = m_terrainModificationFileName.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -153,33 +153,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedBuildingObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedBuildingObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getInteriorLayoutFileName(true); #endif } if (!m_interiorLayoutFileName.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter interiorLayoutFileName in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter interiorLayoutFileName has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter interiorLayoutFileName has not been defined in template %s!", DataResource::getName())); return base->getInteriorLayoutFileName(); } } const std::string & value = m_interiorLayoutFileName.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -226,12 +226,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCellObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCellObjectTemplate.cpp index 1cdcca72..0c319760 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCellObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCellObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedCellObjectTemplate::getTemplateVersion(void) const */ Tag SharedCellObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedCellObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedCellObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedConstructionContractObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedConstructionContractObjectTemplate.cpp index ba6ece47..ab455e20 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedConstructionContractObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedConstructionContractObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedConstructionContractObjectTemplate::getTemplateVersion(void) const */ Tag SharedConstructionContractObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedConstructionContractObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedConstructionContractObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCreatureObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCreatureObjectTemplate.cpp index 5254f31c..6c5c3db1 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCreatureObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCreatureObjectTemplate.cpp @@ -104,10 +104,10 @@ Tag SharedCreatureObjectTemplate::getTemplateVersion(void) const */ Tag SharedCreatureObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedCreatureObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedCreatureObjectTemplate::getHighestTemplateVersion @@ -175,33 +175,33 @@ SharedCreatureObjectTemplate::Gender testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getGender(true); #endif } if (!m_gender.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter gender in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter gender has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter gender has not been defined in template %s!", DataResource::getName())); return base->getGender(); } } Gender value = static_cast(m_gender.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -217,33 +217,33 @@ SharedCreatureObjectTemplate::Niche testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getNiche(true); #endif } if (!m_niche.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter niche in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter niche has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter niche has not been defined in template %s!", DataResource::getName())); return base->getNiche(); } } Niche value = static_cast(m_niche.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -259,33 +259,33 @@ SharedCreatureObjectTemplate::Species testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSpecies(true); #endif } if (!m_species.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter species in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter species has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter species has not been defined in template %s!", DataResource::getName())); return base->getSpecies(); } } Species value = static_cast(m_species.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -301,33 +301,33 @@ SharedCreatureObjectTemplate::Race testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getRace(true); #endif } if (!m_race.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter race in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter race has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter race has not been defined in template %s!", DataResource::getName())); return base->getRace(); } } Race value = static_cast(m_race.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -337,8 +337,8 @@ UNREF(testData); float SharedCreatureObjectTemplate::getAcceleration(MovementTypes index) const { - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -346,14 +346,14 @@ float SharedCreatureObjectTemplate::getAcceleration(MovementTypes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 2, ("template param index out of range")); if (!m_acceleration[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter acceleration in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter acceleration has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter acceleration has not been defined in template %s!", DataResource::getName())); return base->getAcceleration(index); } } @@ -363,9 +363,9 @@ float SharedCreatureObjectTemplate::getAcceleration(MovementTypes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAcceleration(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -386,8 +386,8 @@ float SharedCreatureObjectTemplate::getAcceleration(MovementTypes index) const float SharedCreatureObjectTemplate::getAccelerationMin(MovementTypes index) const { - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -395,14 +395,14 @@ float SharedCreatureObjectTemplate::getAccelerationMin(MovementTypes index) cons DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 2, ("template param index out of range")); if (!m_acceleration[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter acceleration in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter acceleration has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter acceleration has not been defined in template %s!", DataResource::getName())); return base->getAccelerationMin(index); } } @@ -412,9 +412,9 @@ float SharedCreatureObjectTemplate::getAccelerationMin(MovementTypes index) cons if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAccelerationMin(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -435,8 +435,8 @@ float SharedCreatureObjectTemplate::getAccelerationMin(MovementTypes index) cons float SharedCreatureObjectTemplate::getAccelerationMax(MovementTypes index) const { - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -444,14 +444,14 @@ float SharedCreatureObjectTemplate::getAccelerationMax(MovementTypes index) cons DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 2, ("template param index out of range")); if (!m_acceleration[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter acceleration in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter acceleration has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter acceleration has not been defined in template %s!", DataResource::getName())); return base->getAccelerationMax(index); } } @@ -461,9 +461,9 @@ float SharedCreatureObjectTemplate::getAccelerationMax(MovementTypes index) cons if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAccelerationMax(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -484,8 +484,8 @@ float SharedCreatureObjectTemplate::getAccelerationMax(MovementTypes index) cons float SharedCreatureObjectTemplate::getSpeed(MovementTypes index) const { - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -493,14 +493,14 @@ float SharedCreatureObjectTemplate::getSpeed(MovementTypes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 2, ("template param index out of range")); if (!m_speed[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter speed in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter speed has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter speed has not been defined in template %s!", DataResource::getName())); return base->getSpeed(index); } } @@ -510,9 +510,9 @@ float SharedCreatureObjectTemplate::getSpeed(MovementTypes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSpeed(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -533,8 +533,8 @@ float SharedCreatureObjectTemplate::getSpeed(MovementTypes index) const float SharedCreatureObjectTemplate::getSpeedMin(MovementTypes index) const { - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -542,14 +542,14 @@ float SharedCreatureObjectTemplate::getSpeedMin(MovementTypes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 2, ("template param index out of range")); if (!m_speed[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter speed in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter speed has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter speed has not been defined in template %s!", DataResource::getName())); return base->getSpeedMin(index); } } @@ -559,9 +559,9 @@ float SharedCreatureObjectTemplate::getSpeedMin(MovementTypes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSpeedMin(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -582,8 +582,8 @@ float SharedCreatureObjectTemplate::getSpeedMin(MovementTypes index) const float SharedCreatureObjectTemplate::getSpeedMax(MovementTypes index) const { - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -591,14 +591,14 @@ float SharedCreatureObjectTemplate::getSpeedMax(MovementTypes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 2, ("template param index out of range")); if (!m_speed[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter speed in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter speed has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter speed has not been defined in template %s!", DataResource::getName())); return base->getSpeedMax(index); } } @@ -608,9 +608,9 @@ float SharedCreatureObjectTemplate::getSpeedMax(MovementTypes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSpeedMax(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -631,8 +631,8 @@ float SharedCreatureObjectTemplate::getSpeedMax(MovementTypes index) const float SharedCreatureObjectTemplate::getTurnRate(MovementTypes index) const { - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -640,14 +640,14 @@ float SharedCreatureObjectTemplate::getTurnRate(MovementTypes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 2, ("template param index out of range")); if (!m_turnRate[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter turnRate in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter turnRate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter turnRate has not been defined in template %s!", DataResource::getName())); return base->getTurnRate(index); } } @@ -657,9 +657,9 @@ float SharedCreatureObjectTemplate::getTurnRate(MovementTypes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTurnRate(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -680,8 +680,8 @@ float SharedCreatureObjectTemplate::getTurnRate(MovementTypes index) const float SharedCreatureObjectTemplate::getTurnRateMin(MovementTypes index) const { - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -689,14 +689,14 @@ float SharedCreatureObjectTemplate::getTurnRateMin(MovementTypes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 2, ("template param index out of range")); if (!m_turnRate[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter turnRate in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter turnRate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter turnRate has not been defined in template %s!", DataResource::getName())); return base->getTurnRateMin(index); } } @@ -706,9 +706,9 @@ float SharedCreatureObjectTemplate::getTurnRateMin(MovementTypes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTurnRateMin(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -729,8 +729,8 @@ float SharedCreatureObjectTemplate::getTurnRateMin(MovementTypes index) const float SharedCreatureObjectTemplate::getTurnRateMax(MovementTypes index) const { - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -738,14 +738,14 @@ float SharedCreatureObjectTemplate::getTurnRateMax(MovementTypes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 2, ("template param index out of range")); if (!m_turnRate[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter turnRate in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter turnRate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter turnRate has not been defined in template %s!", DataResource::getName())); return base->getTurnRateMax(index); } } @@ -755,9 +755,9 @@ float SharedCreatureObjectTemplate::getTurnRateMax(MovementTypes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTurnRateMax(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -784,33 +784,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAnimationMapFilename(true); #endif } if (!m_animationMapFilename.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter animationMapFilename in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter animationMapFilename has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter animationMapFilename has not been defined in template %s!", DataResource::getName())); return base->getAnimationMapFilename(); } } const std::string & value = m_animationMapFilename.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -826,26 +826,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSlopeModAngle(true); #endif } if (!m_slopeModAngle.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slopeModAngle in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slopeModAngle has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slopeModAngle has not been defined in template %s!", DataResource::getName())); return base->getSlopeModAngle(); } } @@ -855,9 +855,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSlopeModAngle(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -874,7 +874,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -890,26 +890,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSlopeModAngleMin(true); #endif } if (!m_slopeModAngle.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slopeModAngle in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slopeModAngle has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slopeModAngle has not been defined in template %s!", DataResource::getName())); return base->getSlopeModAngleMin(); } } @@ -919,9 +919,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSlopeModAngleMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -938,7 +938,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -954,26 +954,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSlopeModAngleMax(true); #endif } if (!m_slopeModAngle.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slopeModAngle in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slopeModAngle has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slopeModAngle has not been defined in template %s!", DataResource::getName())); return base->getSlopeModAngleMax(); } } @@ -983,9 +983,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSlopeModAngleMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1002,7 +1002,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1018,26 +1018,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSlopeModPercent(true); #endif } if (!m_slopeModPercent.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slopeModPercent in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slopeModPercent has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slopeModPercent has not been defined in template %s!", DataResource::getName())); return base->getSlopeModPercent(); } } @@ -1047,9 +1047,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSlopeModPercent(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1066,7 +1066,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1082,26 +1082,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSlopeModPercentMin(true); #endif } if (!m_slopeModPercent.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slopeModPercent in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slopeModPercent has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slopeModPercent has not been defined in template %s!", DataResource::getName())); return base->getSlopeModPercentMin(); } } @@ -1111,9 +1111,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSlopeModPercentMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1130,7 +1130,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1146,26 +1146,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSlopeModPercentMax(true); #endif } if (!m_slopeModPercent.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slopeModPercent in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slopeModPercent has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slopeModPercent has not been defined in template %s!", DataResource::getName())); return base->getSlopeModPercentMax(); } } @@ -1175,9 +1175,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSlopeModPercentMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1194,7 +1194,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1210,26 +1210,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getWaterModPercent(true); #endif } if (!m_waterModPercent.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter waterModPercent in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter waterModPercent has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter waterModPercent has not been defined in template %s!", DataResource::getName())); return base->getWaterModPercent(); } } @@ -1239,9 +1239,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getWaterModPercent(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1258,7 +1258,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1274,26 +1274,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getWaterModPercentMin(true); #endif } if (!m_waterModPercent.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter waterModPercent in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter waterModPercent has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter waterModPercent has not been defined in template %s!", DataResource::getName())); return base->getWaterModPercentMin(); } } @@ -1303,9 +1303,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getWaterModPercentMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1322,7 +1322,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1338,26 +1338,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getWaterModPercentMax(true); #endif } if (!m_waterModPercent.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter waterModPercent in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter waterModPercent has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter waterModPercent has not been defined in template %s!", DataResource::getName())); return base->getWaterModPercentMax(); } } @@ -1367,9 +1367,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getWaterModPercentMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1386,7 +1386,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1402,26 +1402,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getStepHeight(true); #endif } if (!m_stepHeight.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter stepHeight in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter stepHeight has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter stepHeight has not been defined in template %s!", DataResource::getName())); return base->getStepHeight(); } } @@ -1431,9 +1431,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getStepHeight(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1450,7 +1450,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1466,26 +1466,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getStepHeightMin(true); #endif } if (!m_stepHeight.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter stepHeight in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter stepHeight has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter stepHeight has not been defined in template %s!", DataResource::getName())); return base->getStepHeightMin(); } } @@ -1495,9 +1495,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getStepHeightMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1514,7 +1514,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1530,26 +1530,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getStepHeightMax(true); #endif } if (!m_stepHeight.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter stepHeight in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter stepHeight has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter stepHeight has not been defined in template %s!", DataResource::getName())); return base->getStepHeightMax(); } } @@ -1559,9 +1559,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getStepHeightMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1578,7 +1578,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1594,26 +1594,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCollisionHeight(true); #endif } if (!m_collisionHeight.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionHeight in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter collisionHeight has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter collisionHeight has not been defined in template %s!", DataResource::getName())); return base->getCollisionHeight(); } } @@ -1623,9 +1623,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCollisionHeight(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1642,7 +1642,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1658,26 +1658,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCollisionHeightMin(true); #endif } if (!m_collisionHeight.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionHeight in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter collisionHeight has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter collisionHeight has not been defined in template %s!", DataResource::getName())); return base->getCollisionHeightMin(); } } @@ -1687,9 +1687,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCollisionHeightMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1706,7 +1706,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1722,26 +1722,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCollisionHeightMax(true); #endif } if (!m_collisionHeight.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionHeight in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter collisionHeight has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter collisionHeight has not been defined in template %s!", DataResource::getName())); return base->getCollisionHeightMax(); } } @@ -1751,9 +1751,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCollisionHeightMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1770,7 +1770,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1786,26 +1786,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCollisionRadius(true); #endif } if (!m_collisionRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter collisionRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter collisionRadius has not been defined in template %s!", DataResource::getName())); return base->getCollisionRadius(); } } @@ -1815,9 +1815,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCollisionRadius(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1834,7 +1834,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1850,26 +1850,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCollisionRadiusMin(true); #endif } if (!m_collisionRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter collisionRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter collisionRadius has not been defined in template %s!", DataResource::getName())); return base->getCollisionRadiusMin(); } } @@ -1879,9 +1879,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCollisionRadiusMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1898,7 +1898,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1914,26 +1914,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCollisionRadiusMax(true); #endif } if (!m_collisionRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter collisionRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter collisionRadius has not been defined in template %s!", DataResource::getName())); return base->getCollisionRadiusMax(); } } @@ -1943,9 +1943,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCollisionRadiusMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1962,7 +1962,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1978,33 +1978,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMovementDatatable(true); #endif } if (!m_movementDatatable.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter movementDatatable in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter movementDatatable has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter movementDatatable has not been defined in template %s!", DataResource::getName())); return base->getMovementDatatable(); } } const std::string & value = m_movementDatatable.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2014,8 +2014,8 @@ UNREF(testData); bool SharedCreatureObjectTemplate::getPostureAlignToTerrain(Postures index) const { - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -2023,14 +2023,14 @@ bool SharedCreatureObjectTemplate::getPostureAlignToTerrain(Postures index) cons DEBUG_FATAL(index < 0 || index >= 15, ("template param index out of range")); if (!m_postureAlignToTerrain[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter postureAlignToTerrain in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter postureAlignToTerrain has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter postureAlignToTerrain has not been defined in template %s!", DataResource::getName())); return base->getPostureAlignToTerrain(index); } } @@ -2047,26 +2047,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSwimHeight(true); #endif } if (!m_swimHeight.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter swimHeight in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter swimHeight has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter swimHeight has not been defined in template %s!", DataResource::getName())); return base->getSwimHeight(); } } @@ -2076,9 +2076,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSwimHeight(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2095,7 +2095,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2111,26 +2111,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSwimHeightMin(true); #endif } if (!m_swimHeight.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter swimHeight in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter swimHeight has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter swimHeight has not been defined in template %s!", DataResource::getName())); return base->getSwimHeightMin(); } } @@ -2140,9 +2140,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSwimHeightMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2159,7 +2159,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2175,26 +2175,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSwimHeightMax(true); #endif } if (!m_swimHeight.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter swimHeight in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter swimHeight has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter swimHeight has not been defined in template %s!", DataResource::getName())); return base->getSwimHeightMax(); } } @@ -2204,9 +2204,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSwimHeightMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2223,7 +2223,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2239,26 +2239,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getWarpTolerance(true); #endif } if (!m_warpTolerance.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter warpTolerance in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter warpTolerance has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter warpTolerance has not been defined in template %s!", DataResource::getName())); return base->getWarpTolerance(); } } @@ -2268,9 +2268,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getWarpTolerance(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2287,7 +2287,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2303,26 +2303,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getWarpToleranceMin(true); #endif } if (!m_warpTolerance.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter warpTolerance in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter warpTolerance has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter warpTolerance has not been defined in template %s!", DataResource::getName())); return base->getWarpToleranceMin(); } } @@ -2332,9 +2332,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getWarpToleranceMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2351,7 +2351,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2367,26 +2367,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getWarpToleranceMax(true); #endif } if (!m_warpTolerance.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter warpTolerance in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter warpTolerance has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter warpTolerance has not been defined in template %s!", DataResource::getName())); return base->getWarpToleranceMax(); } } @@ -2396,9 +2396,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getWarpToleranceMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2415,7 +2415,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2431,26 +2431,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCollisionOffsetX(true); #endif } if (!m_collisionOffsetX.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionOffsetX in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter collisionOffsetX has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter collisionOffsetX has not been defined in template %s!", DataResource::getName())); return base->getCollisionOffsetX(); } } @@ -2460,9 +2460,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCollisionOffsetX(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2479,7 +2479,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2495,26 +2495,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCollisionOffsetXMin(true); #endif } if (!m_collisionOffsetX.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionOffsetX in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter collisionOffsetX has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter collisionOffsetX has not been defined in template %s!", DataResource::getName())); return base->getCollisionOffsetXMin(); } } @@ -2524,9 +2524,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCollisionOffsetXMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2543,7 +2543,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2559,26 +2559,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCollisionOffsetXMax(true); #endif } if (!m_collisionOffsetX.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionOffsetX in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter collisionOffsetX has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter collisionOffsetX has not been defined in template %s!", DataResource::getName())); return base->getCollisionOffsetXMax(); } } @@ -2588,9 +2588,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCollisionOffsetXMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2607,7 +2607,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2623,26 +2623,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCollisionOffsetZ(true); #endif } if (!m_collisionOffsetZ.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionOffsetZ in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter collisionOffsetZ has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter collisionOffsetZ has not been defined in template %s!", DataResource::getName())); return base->getCollisionOffsetZ(); } } @@ -2652,9 +2652,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCollisionOffsetZ(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2671,7 +2671,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2687,26 +2687,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCollisionOffsetZMin(true); #endif } if (!m_collisionOffsetZ.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionOffsetZ in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter collisionOffsetZ has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter collisionOffsetZ has not been defined in template %s!", DataResource::getName())); return base->getCollisionOffsetZMin(); } } @@ -2716,9 +2716,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCollisionOffsetZMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2735,7 +2735,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2751,26 +2751,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCollisionOffsetZMax(true); #endif } if (!m_collisionOffsetZ.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionOffsetZ in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter collisionOffsetZ has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter collisionOffsetZ has not been defined in template %s!", DataResource::getName())); return base->getCollisionOffsetZMax(); } } @@ -2780,9 +2780,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCollisionOffsetZMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2799,7 +2799,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2815,26 +2815,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCollisionLength(true); #endif } if (!m_collisionLength.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionLength in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter collisionLength has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter collisionLength has not been defined in template %s!", DataResource::getName())); return base->getCollisionLength(); } } @@ -2844,9 +2844,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCollisionLength(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2863,7 +2863,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2879,26 +2879,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCollisionLengthMin(true); #endif } if (!m_collisionLength.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionLength in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter collisionLength has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter collisionLength has not been defined in template %s!", DataResource::getName())); return base->getCollisionLengthMin(); } } @@ -2908,9 +2908,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCollisionLengthMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2927,7 +2927,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2943,26 +2943,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCollisionLengthMax(true); #endif } if (!m_collisionLength.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionLength in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter collisionLength has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter collisionLength has not been defined in template %s!", DataResource::getName())); return base->getCollisionLengthMax(); } } @@ -2972,9 +2972,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCollisionLengthMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2991,7 +2991,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3007,26 +3007,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCameraHeight(true); #endif } if (!m_cameraHeight.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter cameraHeight in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter cameraHeight has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter cameraHeight has not been defined in template %s!", DataResource::getName())); return base->getCameraHeight(); } } @@ -3036,9 +3036,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCameraHeight(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3055,7 +3055,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3071,26 +3071,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCameraHeightMin(true); #endif } if (!m_cameraHeight.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter cameraHeight in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter cameraHeight has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter cameraHeight has not been defined in template %s!", DataResource::getName())); return base->getCameraHeightMin(); } } @@ -3100,9 +3100,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCameraHeightMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3119,7 +3119,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3135,26 +3135,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCameraHeightMax(true); #endif } if (!m_cameraHeight.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter cameraHeight in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter cameraHeight has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter cameraHeight has not been defined in template %s!", DataResource::getName())); return base->getCameraHeightMax(); } } @@ -3164,9 +3164,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCameraHeightMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3183,7 +3183,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3258,12 +3258,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedDraftSchematicObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedDraftSchematicObjectTemplate.cpp index fe3956f4..961cebca 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedDraftSchematicObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedDraftSchematicObjectTemplate.cpp @@ -55,7 +55,7 @@ SharedDraftSchematicObjectTemplate::~SharedDraftSchematicObjectTemplate() for (iter = m_slots.begin(); iter != m_slots.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_slots.clear(); } @@ -64,7 +64,7 @@ SharedDraftSchematicObjectTemplate::~SharedDraftSchematicObjectTemplate() for (iter = m_attributes.begin(); iter != m_attributes.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_attributes.clear(); } @@ -116,10 +116,10 @@ Tag SharedDraftSchematicObjectTemplate::getTemplateVersion(void) const */ Tag SharedDraftSchematicObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedDraftSchematicObjectTemplate::getHighestTemplateVersion @@ -127,28 +127,28 @@ Tag SharedDraftSchematicObjectTemplate::getHighestTemplateVersion(void) const //@BEGIN TFD void SharedDraftSchematicObjectTemplate::getSlots(IngredientSlot &data, int index) const { - const SharedDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_slotsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slots in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slots has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slots has not been defined in template %s!", DataResource::getName())); base->getSlots(data, index); return; } } - if (m_slotsAppend && base != NULL) + if (m_slotsAppend && base != nullptr) { int baseCount = base->getSlotsCount(); if (index < baseCount) @@ -170,28 +170,28 @@ void SharedDraftSchematicObjectTemplate::getSlots(IngredientSlot &data, int inde void SharedDraftSchematicObjectTemplate::getSlotsMin(IngredientSlot &data, int index) const { - const SharedDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_slotsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slots in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slots has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slots has not been defined in template %s!", DataResource::getName())); base->getSlotsMin(data, index); return; } } - if (m_slotsAppend && base != NULL) + if (m_slotsAppend && base != nullptr) { int baseCount = base->getSlotsCount(); if (index < baseCount) @@ -213,28 +213,28 @@ void SharedDraftSchematicObjectTemplate::getSlotsMin(IngredientSlot &data, int i void SharedDraftSchematicObjectTemplate::getSlotsMax(IngredientSlot &data, int index) const { - const SharedDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_slotsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slots in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slots has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slots has not been defined in template %s!", DataResource::getName())); base->getSlotsMax(data, index); return; } } - if (m_slotsAppend && base != NULL) + if (m_slotsAppend && base != nullptr) { int baseCount = base->getSlotsCount(); if (index < baseCount) @@ -258,20 +258,20 @@ size_t SharedDraftSchematicObjectTemplate::getSlotsCount(void) const { if (!m_slotsLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const SharedDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getSlotsCount(); } size_t count = m_slots.size(); // if we are extending our base template, add it's count - if (m_slotsAppend && m_baseData != NULL) + if (m_slotsAppend && m_baseData != nullptr) { const SharedDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getSlotsCount(); } @@ -280,28 +280,28 @@ size_t SharedDraftSchematicObjectTemplate::getSlotsCount(void) const void SharedDraftSchematicObjectTemplate::getAttributes(SchematicAttribute &data, int index) const { - const SharedDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_attributesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attributes in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter attributes has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attributes has not been defined in template %s!", DataResource::getName())); base->getAttributes(data, index); return; } } - if (m_attributesAppend && base != NULL) + if (m_attributesAppend && base != nullptr) { int baseCount = base->getAttributesCount(); if (index < baseCount) @@ -324,28 +324,28 @@ void SharedDraftSchematicObjectTemplate::getAttributes(SchematicAttribute &data, void SharedDraftSchematicObjectTemplate::getAttributesMin(SchematicAttribute &data, int index) const { - const SharedDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_attributesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attributes in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter attributes has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attributes has not been defined in template %s!", DataResource::getName())); base->getAttributesMin(data, index); return; } } - if (m_attributesAppend && base != NULL) + if (m_attributesAppend && base != nullptr) { int baseCount = base->getAttributesCount(); if (index < baseCount) @@ -368,28 +368,28 @@ void SharedDraftSchematicObjectTemplate::getAttributesMin(SchematicAttribute &da void SharedDraftSchematicObjectTemplate::getAttributesMax(SchematicAttribute &data, int index) const { - const SharedDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_attributesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attributes in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter attributes has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attributes has not been defined in template %s!", DataResource::getName())); base->getAttributesMax(data, index); return; } } - if (m_attributesAppend && base != NULL) + if (m_attributesAppend && base != nullptr) { int baseCount = base->getAttributesCount(); if (index < baseCount) @@ -414,20 +414,20 @@ size_t SharedDraftSchematicObjectTemplate::getAttributesCount(void) const { if (!m_attributesLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const SharedDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getAttributesCount(); } size_t count = m_attributes.size(); // if we are extending our base template, add it's count - if (m_attributesAppend && m_baseData != NULL) + if (m_attributesAppend && m_baseData != nullptr) { const SharedDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getAttributesCount(); } @@ -442,33 +442,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCraftedSharedTemplate(true); #endif } if (!m_craftedSharedTemplate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter craftedSharedTemplate in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter craftedSharedTemplate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter craftedSharedTemplate has not been defined in template %s!", DataResource::getName())); return base->getCraftedSharedTemplate(); } } const std::string & value = m_craftedSharedTemplate.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -514,12 +514,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -548,7 +548,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_slots.begin(); iter != m_slots.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_slots.clear(); m_slotsAppend = file.read_bool8(); @@ -567,7 +567,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_attributes.begin(); iter != m_attributes.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_attributes.clear(); m_attributesAppend = file.read_bool8(); @@ -646,33 +646,33 @@ StringId testDataValue = DefaultStringId; UNREF(testData); #endif - const SharedDraftSchematicObjectTemplate::_IngredientSlot * base = NULL; - if (m_baseData != NULL) + const SharedDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getName(true); #endif } if (!m_name.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter name in template %s", DataResource::getName())); return DefaultStringId; } else { - DEBUG_FATAL(base == NULL, ("Template parameter name has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter name has not been defined in template %s!", DataResource::getName())); return base->getName(versionOk); } } const StringId value = m_name.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -688,33 +688,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedDraftSchematicObjectTemplate::_IngredientSlot * base = NULL; - if (m_baseData != NULL) + const SharedDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getHardpoint(true); #endif } if (!m_hardpoint.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter hardpoint in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter hardpoint has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter hardpoint has not been defined in template %s!", DataResource::getName())); return base->getHardpoint(versionOk); } } const std::string & value = m_hardpoint.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -819,33 +819,33 @@ StringId testDataValue = DefaultStringId; UNREF(testData); #endif - const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = NULL; - if (m_baseData != NULL) + const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getName(true); #endif } if (!m_name.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter name in template %s", DataResource::getName())); return DefaultStringId; } else { - DEBUG_FATAL(base == NULL, ("Template parameter name has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter name has not been defined in template %s!", DataResource::getName())); return base->getName(versionOk); } } const StringId value = m_name.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -861,33 +861,33 @@ StringId testDataValue = DefaultStringId; UNREF(testData); #endif - const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = NULL; - if (m_baseData != NULL) + const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getExperiment(true); #endif } if (!m_experiment.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter experiment in template %s", DataResource::getName())); return DefaultStringId; } else { - DEBUG_FATAL(base == NULL, ("Template parameter experiment has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter experiment has not been defined in template %s!", DataResource::getName())); return base->getExperiment(versionOk); } } const StringId value = m_experiment.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -903,26 +903,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = NULL; - if (m_baseData != NULL) + const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getValue(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValue(versionOk); } } @@ -932,9 +932,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getValue(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -951,7 +951,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -967,26 +967,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = NULL; - if (m_baseData != NULL) + const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getValueMin(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValueMin(versionOk); } } @@ -996,9 +996,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getValueMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1015,7 +1015,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1031,26 +1031,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = NULL; - if (m_baseData != NULL) + const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getValueMax(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValueMax(versionOk); } } @@ -1060,9 +1060,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getValueMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1079,7 +1079,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedFactoryObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedFactoryObjectTemplate.cpp index 5a07a293..4a7e73fa 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedFactoryObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedFactoryObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedFactoryObjectTemplate::getTemplateVersion(void) const */ Tag SharedFactoryObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedFactoryObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedFactoryObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGroupObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGroupObjectTemplate.cpp index 1c30083d..d3c1d6d0 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGroupObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGroupObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedGroupObjectTemplate::getTemplateVersion(void) const */ Tag SharedGroupObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedGroupObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedGroupObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGuildObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGuildObjectTemplate.cpp index 4243b93c..e57241db 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGuildObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGuildObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedGuildObjectTemplate::getTemplateVersion(void) const */ Tag SharedGuildObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedGuildObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedGuildObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedInstallationObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedInstallationObjectTemplate.cpp index 08158117..5e66bbf1 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedInstallationObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedInstallationObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedInstallationObjectTemplate::getTemplateVersion(void) const */ Tag SharedInstallationObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedInstallationObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedInstallationObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedIntangibleObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedIntangibleObjectTemplate.cpp index 0e9edb7c..4934dd40 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedIntangibleObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedIntangibleObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedIntangibleObjectTemplate::getTemplateVersion(void) const */ Tag SharedIntangibleObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedIntangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedIntangibleObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedJediManagerObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedJediManagerObjectTemplate.cpp index c4840885..3c8ad274 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedJediManagerObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedJediManagerObjectTemplate.cpp @@ -95,10 +95,10 @@ Tag SharedJediManagerObjectTemplate::getTemplateVersion(void) const */ Tag SharedJediManagerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedJediManagerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedJediManagerObjectTemplate::getHighestTemplateVersion @@ -141,12 +141,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedManufactureSchematicObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedManufactureSchematicObjectTemplate.cpp index 8b5e0965..de9c8b4d 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedManufactureSchematicObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedManufactureSchematicObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedManufactureSchematicObjectTemplate::getTemplateVersion(void) const */ Tag SharedManufactureSchematicObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedManufactureSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedManufactureSchematicObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedMissionObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedMissionObjectTemplate.cpp index b2745f8e..10eaba74 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedMissionObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedMissionObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedMissionObjectTemplate::getTemplateVersion(void) const */ Tag SharedMissionObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedMissionObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedMissionObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedObjectTemplate.cpp index 034adea5..dc0fe57a 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedObjectTemplate.cpp @@ -109,8 +109,8 @@ SharedObjectTemplate::SharedObjectTemplate(const std::string & filename) : ObjectTemplate(filename) ,m_versionOk(true) //@END TFD INIT - , m_slotDescriptor(NULL) - , m_arrangementDescriptor(NULL) + , m_slotDescriptor(nullptr) + , m_arrangementDescriptor(nullptr) , m_clientData (0) , m_preloadManager (0) { @@ -232,10 +232,10 @@ Tag SharedObjectTemplate::getTemplateVersion(void) const */ Tag SharedObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedObjectTemplate::getHighestTemplateVersion @@ -274,33 +274,33 @@ StringId testDataValue = DefaultStringId; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getObjectName(true); #endif } if (!m_objectName.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter objectName in template %s", DataResource::getName())); return DefaultStringId; } else { - DEBUG_FATAL(base == NULL, ("Template parameter objectName has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter objectName has not been defined in template %s!", DataResource::getName())); return base->getObjectName(); } } const StringId value = m_objectName.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -316,33 +316,33 @@ StringId testDataValue = DefaultStringId; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDetailedDescription(true); #endif } if (!m_detailedDescription.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter detailedDescription in template %s", DataResource::getName())); return DefaultStringId; } else { - DEBUG_FATAL(base == NULL, ("Template parameter detailedDescription has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter detailedDescription has not been defined in template %s!", DataResource::getName())); return base->getDetailedDescription(); } } const StringId value = m_detailedDescription.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -358,33 +358,33 @@ StringId testDataValue = DefaultStringId; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getLookAtText(true); #endif } if (!m_lookAtText.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter lookAtText in template %s", DataResource::getName())); return DefaultStringId; } else { - DEBUG_FATAL(base == NULL, ("Template parameter lookAtText has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter lookAtText has not been defined in template %s!", DataResource::getName())); return base->getLookAtText(); } } const StringId value = m_lookAtText.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -400,33 +400,33 @@ bool testDataValue = false; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSnapToTerrain(true); #endif } if (!m_snapToTerrain.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter snapToTerrain in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter snapToTerrain has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter snapToTerrain has not been defined in template %s!", DataResource::getName())); return base->getSnapToTerrain(); } } bool value = m_snapToTerrain.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -442,33 +442,33 @@ SharedObjectTemplate::ContainerType testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getContainerType(true); #endif } if (!m_containerType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter containerType in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter containerType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter containerType has not been defined in template %s!", DataResource::getName())); return base->getContainerType(); } } ContainerType value = static_cast(m_containerType.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -484,26 +484,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getContainerVolumeLimit(true); #endif } if (!m_containerVolumeLimit.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter containerVolumeLimit in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter containerVolumeLimit has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter containerVolumeLimit has not been defined in template %s!", DataResource::getName())); return base->getContainerVolumeLimit(); } } @@ -513,9 +513,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getContainerVolumeLimit(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -532,7 +532,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -548,26 +548,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getContainerVolumeLimitMin(true); #endif } if (!m_containerVolumeLimit.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter containerVolumeLimit in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter containerVolumeLimit has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter containerVolumeLimit has not been defined in template %s!", DataResource::getName())); return base->getContainerVolumeLimitMin(); } } @@ -577,9 +577,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getContainerVolumeLimitMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -596,7 +596,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -612,26 +612,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getContainerVolumeLimitMax(true); #endif } if (!m_containerVolumeLimit.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter containerVolumeLimit in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter containerVolumeLimit has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter containerVolumeLimit has not been defined in template %s!", DataResource::getName())); return base->getContainerVolumeLimitMax(); } } @@ -641,9 +641,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getContainerVolumeLimitMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -660,7 +660,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -676,33 +676,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTintPalette(true); #endif } if (!m_tintPalette.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter tintPalette in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter tintPalette has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter tintPalette has not been defined in template %s!", DataResource::getName())); return base->getTintPalette(); } } const std::string & value = m_tintPalette.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -718,33 +718,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSlotDescriptorFilename(true); #endif } if (!m_slotDescriptorFilename.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slotDescriptorFilename in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slotDescriptorFilename has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slotDescriptorFilename has not been defined in template %s!", DataResource::getName())); return base->getSlotDescriptorFilename(); } } const std::string & value = m_slotDescriptorFilename.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -760,33 +760,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getArrangementDescriptorFilename(true); #endif } if (!m_arrangementDescriptorFilename.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter arrangementDescriptorFilename in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter arrangementDescriptorFilename has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter arrangementDescriptorFilename has not been defined in template %s!", DataResource::getName())); return base->getArrangementDescriptorFilename(); } } const std::string & value = m_arrangementDescriptorFilename.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -802,33 +802,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAppearanceFilename(true); #endif } if (!m_appearanceFilename.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter appearanceFilename in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter appearanceFilename has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter appearanceFilename has not been defined in template %s!", DataResource::getName())); return base->getAppearanceFilename(); } } const std::string & value = m_appearanceFilename.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -844,33 +844,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getPortalLayoutFilename(true); #endif } if (!m_portalLayoutFilename.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter portalLayoutFilename in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter portalLayoutFilename has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter portalLayoutFilename has not been defined in template %s!", DataResource::getName())); return base->getPortalLayoutFilename(); } } const std::string & value = m_portalLayoutFilename.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -886,33 +886,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getClientDataFile(true); #endif } if (!m_clientDataFile.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter clientDataFile in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter clientDataFile has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter clientDataFile has not been defined in template %s!", DataResource::getName())); return base->getClientDataFile(); } } const std::string & value = m_clientDataFile.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -928,26 +928,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getScale(true); #endif } if (!m_scale.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter scale in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter scale has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter scale has not been defined in template %s!", DataResource::getName())); return base->getScale(); } } @@ -957,9 +957,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getScale(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -976,7 +976,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -992,26 +992,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getScaleMin(true); #endif } if (!m_scale.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter scale in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter scale has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter scale has not been defined in template %s!", DataResource::getName())); return base->getScaleMin(); } } @@ -1021,9 +1021,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getScaleMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1040,7 +1040,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1056,26 +1056,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getScaleMax(true); #endif } if (!m_scale.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter scale in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter scale has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter scale has not been defined in template %s!", DataResource::getName())); return base->getScaleMax(); } } @@ -1085,9 +1085,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getScaleMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1104,7 +1104,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1120,33 +1120,33 @@ SharedObjectTemplate::GameObjectType testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getGameObjectType(true); #endif } if (!m_gameObjectType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter gameObjectType in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter gameObjectType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter gameObjectType has not been defined in template %s!", DataResource::getName())); return base->getGameObjectType(); } } GameObjectType value = static_cast(m_gameObjectType.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1162,33 +1162,33 @@ bool testDataValue = false; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSendToClient(true); #endif } if (!m_sendToClient.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter sendToClient in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter sendToClient has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter sendToClient has not been defined in template %s!", DataResource::getName())); return base->getSendToClient(); } } bool value = m_sendToClient.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1204,26 +1204,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getScaleThresholdBeforeExtentTest(true); #endif } if (!m_scaleThresholdBeforeExtentTest.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter scaleThresholdBeforeExtentTest in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter scaleThresholdBeforeExtentTest has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter scaleThresholdBeforeExtentTest has not been defined in template %s!", DataResource::getName())); return base->getScaleThresholdBeforeExtentTest(); } } @@ -1233,9 +1233,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getScaleThresholdBeforeExtentTest(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1252,7 +1252,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1268,26 +1268,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getScaleThresholdBeforeExtentTestMin(true); #endif } if (!m_scaleThresholdBeforeExtentTest.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter scaleThresholdBeforeExtentTest in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter scaleThresholdBeforeExtentTest has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter scaleThresholdBeforeExtentTest has not been defined in template %s!", DataResource::getName())); return base->getScaleThresholdBeforeExtentTestMin(); } } @@ -1297,9 +1297,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getScaleThresholdBeforeExtentTestMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1316,7 +1316,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1332,26 +1332,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getScaleThresholdBeforeExtentTestMax(true); #endif } if (!m_scaleThresholdBeforeExtentTest.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter scaleThresholdBeforeExtentTest in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter scaleThresholdBeforeExtentTest has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter scaleThresholdBeforeExtentTest has not been defined in template %s!", DataResource::getName())); return base->getScaleThresholdBeforeExtentTestMax(); } } @@ -1361,9 +1361,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getScaleThresholdBeforeExtentTestMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1380,7 +1380,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1396,26 +1396,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getClearFloraRadius(true); #endif } if (!m_clearFloraRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter clearFloraRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter clearFloraRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter clearFloraRadius has not been defined in template %s!", DataResource::getName())); return base->getClearFloraRadius(); } } @@ -1425,9 +1425,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getClearFloraRadius(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1444,7 +1444,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1460,26 +1460,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getClearFloraRadiusMin(true); #endif } if (!m_clearFloraRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter clearFloraRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter clearFloraRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter clearFloraRadius has not been defined in template %s!", DataResource::getName())); return base->getClearFloraRadiusMin(); } } @@ -1489,9 +1489,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getClearFloraRadiusMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1508,7 +1508,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1524,26 +1524,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getClearFloraRadiusMax(true); #endif } if (!m_clearFloraRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter clearFloraRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter clearFloraRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter clearFloraRadius has not been defined in template %s!", DataResource::getName())); return base->getClearFloraRadiusMax(); } } @@ -1553,9 +1553,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getClearFloraRadiusMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1572,7 +1572,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1588,33 +1588,33 @@ SharedObjectTemplate::SurfaceType testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSurfaceType(true); #endif } if (!m_surfaceType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter surfaceType in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter surfaceType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter surfaceType has not been defined in template %s!", DataResource::getName())); return base->getSurfaceType(); } } SurfaceType value = static_cast(m_surfaceType.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1630,26 +1630,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getNoBuildRadius(true); #endif } if (!m_noBuildRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter noBuildRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter noBuildRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter noBuildRadius has not been defined in template %s!", DataResource::getName())); return base->getNoBuildRadius(); } } @@ -1659,9 +1659,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getNoBuildRadius(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1678,7 +1678,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1694,26 +1694,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getNoBuildRadiusMin(true); #endif } if (!m_noBuildRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter noBuildRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter noBuildRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter noBuildRadius has not been defined in template %s!", DataResource::getName())); return base->getNoBuildRadiusMin(); } } @@ -1723,9 +1723,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getNoBuildRadiusMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1742,7 +1742,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1758,26 +1758,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getNoBuildRadiusMax(true); #endif } if (!m_noBuildRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter noBuildRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter noBuildRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter noBuildRadius has not been defined in template %s!", DataResource::getName())); return base->getNoBuildRadiusMax(); } } @@ -1787,9 +1787,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getNoBuildRadiusMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1806,7 +1806,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1822,33 +1822,33 @@ bool testDataValue = false; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getOnlyVisibleInTools(true); #endif } if (!m_onlyVisibleInTools.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter onlyVisibleInTools in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter onlyVisibleInTools has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter onlyVisibleInTools has not been defined in template %s!", DataResource::getName())); return base->getOnlyVisibleInTools(); } } bool value = m_onlyVisibleInTools.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1864,26 +1864,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getLocationReservationRadius(true); #endif } if (!m_locationReservationRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter locationReservationRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter locationReservationRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter locationReservationRadius has not been defined in template %s!", DataResource::getName())); return base->getLocationReservationRadius(); } } @@ -1893,9 +1893,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getLocationReservationRadius(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1912,7 +1912,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1928,26 +1928,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getLocationReservationRadiusMin(true); #endif } if (!m_locationReservationRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter locationReservationRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter locationReservationRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter locationReservationRadius has not been defined in template %s!", DataResource::getName())); return base->getLocationReservationRadiusMin(); } } @@ -1957,9 +1957,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getLocationReservationRadiusMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1976,7 +1976,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1992,26 +1992,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getLocationReservationRadiusMax(true); #endif } if (!m_locationReservationRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter locationReservationRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter locationReservationRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter locationReservationRadius has not been defined in template %s!", DataResource::getName())); return base->getLocationReservationRadiusMax(); } } @@ -2021,9 +2021,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getLocationReservationRadiusMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2040,7 +2040,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2056,33 +2056,33 @@ bool testDataValue = false; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getForceNoCollision(true); #endif } if (!m_forceNoCollision.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter forceNoCollision in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter forceNoCollision has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter forceNoCollision has not been defined in template %s!", DataResource::getName())); return base->getForceNoCollision(); } } bool value = m_forceNoCollision.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2153,12 +2153,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerObjectTemplate.cpp index 03213f9f..7d020a59 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerObjectTemplate.cpp @@ -95,10 +95,10 @@ Tag SharedPlayerObjectTemplate::getTemplateVersion(void) const */ Tag SharedPlayerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedPlayerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedPlayerObjectTemplate::getHighestTemplateVersion @@ -141,12 +141,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerQuestObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerQuestObjectTemplate.cpp index c475f753..26380963 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerQuestObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerQuestObjectTemplate.cpp @@ -95,10 +95,10 @@ Tag SharedPlayerQuestObjectTemplate::getTemplateVersion(void) const */ Tag SharedPlayerQuestObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedPlayerQuestObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedPlayerQuestObjectTemplate::getHighestTemplateVersion @@ -141,12 +141,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedResourceContainerObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedResourceContainerObjectTemplate.cpp index 9eb6e580..dbb0635d 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedResourceContainerObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedResourceContainerObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedResourceContainerObjectTemplate::getTemplateVersion(void) const */ Tag SharedResourceContainerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedResourceContainerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedResourceContainerObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedShipObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedShipObjectTemplate.cpp index 8dce0c07..e374302c 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedShipObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedShipObjectTemplate.cpp @@ -101,10 +101,10 @@ Tag SharedShipObjectTemplate::getTemplateVersion(void) const */ Tag SharedShipObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedShipObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedShipObjectTemplate::getHighestTemplateVersion @@ -155,33 +155,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedShipObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedShipObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCockpitFilename(true); #endif } if (!m_cockpitFilename.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter cockpitFilename in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter cockpitFilename has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter cockpitFilename has not been defined in template %s!", DataResource::getName())); return base->getCockpitFilename(); } } const std::string & value = m_cockpitFilename.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -197,33 +197,33 @@ bool testDataValue = false; UNREF(testData); #endif - const SharedShipObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedShipObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getHasWings(true); #endif } if (!m_hasWings.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter hasWings in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter hasWings has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter hasWings has not been defined in template %s!", DataResource::getName())); return base->getHasWings(); } } bool value = m_hasWings.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -239,33 +239,33 @@ bool testDataValue = false; UNREF(testData); #endif - const SharedShipObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedShipObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getPlayerControlled(true); #endif } if (!m_playerControlled.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter playerControlled in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter playerControlled has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter playerControlled has not been defined in template %s!", DataResource::getName())); return base->getPlayerControlled(); } } bool value = m_playerControlled.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -281,33 +281,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedShipObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedShipObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getInteriorLayoutFileName(true); #endif } if (!m_interiorLayoutFileName.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter interiorLayoutFileName in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter interiorLayoutFileName has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter interiorLayoutFileName has not been defined in template %s!", DataResource::getName())); return base->getInteriorLayoutFileName(); } } const std::string & value = m_interiorLayoutFileName.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -356,12 +356,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedStaticObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedStaticObjectTemplate.cpp index 597d379a..3de71cf2 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedStaticObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedStaticObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedStaticObjectTemplate::getTemplateVersion(void) const */ Tag SharedStaticObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedStaticObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedStaticObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTangibleObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTangibleObjectTemplate.cpp index 57f841e2..95742f60 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTangibleObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTangibleObjectTemplate.cpp @@ -73,7 +73,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() for (iter = m_paletteColorCustomizationVariables.begin(); iter != m_paletteColorCustomizationVariables.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_paletteColorCustomizationVariables.clear(); } @@ -82,7 +82,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() for (iter = m_rangedIntCustomizationVariables.begin(); iter != m_rangedIntCustomizationVariables.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_rangedIntCustomizationVariables.clear(); } @@ -91,7 +91,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() for (iter = m_constStringCustomizationVariables.begin(); iter != m_constStringCustomizationVariables.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_constStringCustomizationVariables.clear(); } @@ -100,7 +100,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() for (iter = m_socketDestinations.begin(); iter != m_socketDestinations.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_socketDestinations.clear(); } @@ -109,7 +109,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() for (iter = m_certificationsRequired.begin(); iter != m_certificationsRequired.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_certificationsRequired.clear(); } @@ -118,7 +118,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() for (iter = m_customizationVariableMapping.begin(); iter != m_customizationVariableMapping.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_customizationVariableMapping.clear(); } @@ -176,10 +176,10 @@ Tag SharedTangibleObjectTemplate::getTemplateVersion(void) const */ Tag SharedTangibleObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedTangibleObjectTemplate::getHighestTemplateVersion @@ -355,28 +355,28 @@ void SharedTangibleObjectTemplate::createCustomizationDataPropertyAsNeeded(Objec //@BEGIN TFD void SharedTangibleObjectTemplate::getPaletteColorCustomizationVariables(PaletteColorCustomizationVariable &data, int index) const { - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_paletteColorCustomizationVariablesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter paletteColorCustomizationVariables in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter paletteColorCustomizationVariables has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter paletteColorCustomizationVariables has not been defined in template %s!", DataResource::getName())); base->getPaletteColorCustomizationVariables(data, index); return; } } - if (m_paletteColorCustomizationVariablesAppend && base != NULL) + if (m_paletteColorCustomizationVariablesAppend && base != nullptr) { int baseCount = base->getPaletteColorCustomizationVariablesCount(); if (index < baseCount) @@ -399,28 +399,28 @@ void SharedTangibleObjectTemplate::getPaletteColorCustomizationVariables(Palette void SharedTangibleObjectTemplate::getPaletteColorCustomizationVariablesMin(PaletteColorCustomizationVariable &data, int index) const { - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_paletteColorCustomizationVariablesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter paletteColorCustomizationVariables in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter paletteColorCustomizationVariables has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter paletteColorCustomizationVariables has not been defined in template %s!", DataResource::getName())); base->getPaletteColorCustomizationVariablesMin(data, index); return; } } - if (m_paletteColorCustomizationVariablesAppend && base != NULL) + if (m_paletteColorCustomizationVariablesAppend && base != nullptr) { int baseCount = base->getPaletteColorCustomizationVariablesCount(); if (index < baseCount) @@ -443,28 +443,28 @@ void SharedTangibleObjectTemplate::getPaletteColorCustomizationVariablesMin(Pale void SharedTangibleObjectTemplate::getPaletteColorCustomizationVariablesMax(PaletteColorCustomizationVariable &data, int index) const { - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_paletteColorCustomizationVariablesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter paletteColorCustomizationVariables in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter paletteColorCustomizationVariables has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter paletteColorCustomizationVariables has not been defined in template %s!", DataResource::getName())); base->getPaletteColorCustomizationVariablesMax(data, index); return; } } - if (m_paletteColorCustomizationVariablesAppend && base != NULL) + if (m_paletteColorCustomizationVariablesAppend && base != nullptr) { int baseCount = base->getPaletteColorCustomizationVariablesCount(); if (index < baseCount) @@ -489,20 +489,20 @@ size_t SharedTangibleObjectTemplate::getPaletteColorCustomizationVariablesCount( { if (!m_paletteColorCustomizationVariablesLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getPaletteColorCustomizationVariablesCount(); } size_t count = m_paletteColorCustomizationVariables.size(); // if we are extending our base template, add it's count - if (m_paletteColorCustomizationVariablesAppend && m_baseData != NULL) + if (m_paletteColorCustomizationVariablesAppend && m_baseData != nullptr) { const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getPaletteColorCustomizationVariablesCount(); } @@ -511,28 +511,28 @@ size_t SharedTangibleObjectTemplate::getPaletteColorCustomizationVariablesCount( void SharedTangibleObjectTemplate::getRangedIntCustomizationVariables(RangedIntCustomizationVariable &data, int index) const { - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_rangedIntCustomizationVariablesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter rangedIntCustomizationVariables in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter rangedIntCustomizationVariables has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter rangedIntCustomizationVariables has not been defined in template %s!", DataResource::getName())); base->getRangedIntCustomizationVariables(data, index); return; } } - if (m_rangedIntCustomizationVariablesAppend && base != NULL) + if (m_rangedIntCustomizationVariablesAppend && base != nullptr) { int baseCount = base->getRangedIntCustomizationVariablesCount(); if (index < baseCount) @@ -556,28 +556,28 @@ void SharedTangibleObjectTemplate::getRangedIntCustomizationVariables(RangedIntC void SharedTangibleObjectTemplate::getRangedIntCustomizationVariablesMin(RangedIntCustomizationVariable &data, int index) const { - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_rangedIntCustomizationVariablesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter rangedIntCustomizationVariables in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter rangedIntCustomizationVariables has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter rangedIntCustomizationVariables has not been defined in template %s!", DataResource::getName())); base->getRangedIntCustomizationVariablesMin(data, index); return; } } - if (m_rangedIntCustomizationVariablesAppend && base != NULL) + if (m_rangedIntCustomizationVariablesAppend && base != nullptr) { int baseCount = base->getRangedIntCustomizationVariablesCount(); if (index < baseCount) @@ -601,28 +601,28 @@ void SharedTangibleObjectTemplate::getRangedIntCustomizationVariablesMin(RangedI void SharedTangibleObjectTemplate::getRangedIntCustomizationVariablesMax(RangedIntCustomizationVariable &data, int index) const { - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_rangedIntCustomizationVariablesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter rangedIntCustomizationVariables in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter rangedIntCustomizationVariables has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter rangedIntCustomizationVariables has not been defined in template %s!", DataResource::getName())); base->getRangedIntCustomizationVariablesMax(data, index); return; } } - if (m_rangedIntCustomizationVariablesAppend && base != NULL) + if (m_rangedIntCustomizationVariablesAppend && base != nullptr) { int baseCount = base->getRangedIntCustomizationVariablesCount(); if (index < baseCount) @@ -648,20 +648,20 @@ size_t SharedTangibleObjectTemplate::getRangedIntCustomizationVariablesCount(voi { if (!m_rangedIntCustomizationVariablesLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getRangedIntCustomizationVariablesCount(); } size_t count = m_rangedIntCustomizationVariables.size(); // if we are extending our base template, add it's count - if (m_rangedIntCustomizationVariablesAppend && m_baseData != NULL) + if (m_rangedIntCustomizationVariablesAppend && m_baseData != nullptr) { const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getRangedIntCustomizationVariablesCount(); } @@ -670,28 +670,28 @@ size_t SharedTangibleObjectTemplate::getRangedIntCustomizationVariablesCount(voi void SharedTangibleObjectTemplate::getConstStringCustomizationVariables(ConstStringCustomizationVariable &data, int index) const { - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_constStringCustomizationVariablesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter constStringCustomizationVariables in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter constStringCustomizationVariables has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter constStringCustomizationVariables has not been defined in template %s!", DataResource::getName())); base->getConstStringCustomizationVariables(data, index); return; } } - if (m_constStringCustomizationVariablesAppend && base != NULL) + if (m_constStringCustomizationVariablesAppend && base != nullptr) { int baseCount = base->getConstStringCustomizationVariablesCount(); if (index < baseCount) @@ -713,28 +713,28 @@ void SharedTangibleObjectTemplate::getConstStringCustomizationVariables(ConstStr void SharedTangibleObjectTemplate::getConstStringCustomizationVariablesMin(ConstStringCustomizationVariable &data, int index) const { - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_constStringCustomizationVariablesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter constStringCustomizationVariables in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter constStringCustomizationVariables has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter constStringCustomizationVariables has not been defined in template %s!", DataResource::getName())); base->getConstStringCustomizationVariablesMin(data, index); return; } } - if (m_constStringCustomizationVariablesAppend && base != NULL) + if (m_constStringCustomizationVariablesAppend && base != nullptr) { int baseCount = base->getConstStringCustomizationVariablesCount(); if (index < baseCount) @@ -756,28 +756,28 @@ void SharedTangibleObjectTemplate::getConstStringCustomizationVariablesMin(Const void SharedTangibleObjectTemplate::getConstStringCustomizationVariablesMax(ConstStringCustomizationVariable &data, int index) const { - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_constStringCustomizationVariablesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter constStringCustomizationVariables in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter constStringCustomizationVariables has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter constStringCustomizationVariables has not been defined in template %s!", DataResource::getName())); base->getConstStringCustomizationVariablesMax(data, index); return; } } - if (m_constStringCustomizationVariablesAppend && base != NULL) + if (m_constStringCustomizationVariablesAppend && base != nullptr) { int baseCount = base->getConstStringCustomizationVariablesCount(); if (index < baseCount) @@ -801,20 +801,20 @@ size_t SharedTangibleObjectTemplate::getConstStringCustomizationVariablesCount(v { if (!m_constStringCustomizationVariablesLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getConstStringCustomizationVariablesCount(); } size_t count = m_constStringCustomizationVariables.size(); // if we are extending our base template, add it's count - if (m_constStringCustomizationVariablesAppend && m_baseData != NULL) + if (m_constStringCustomizationVariablesAppend && m_baseData != nullptr) { const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getConstStringCustomizationVariablesCount(); } @@ -823,27 +823,27 @@ size_t SharedTangibleObjectTemplate::getConstStringCustomizationVariablesCount(v SharedTangibleObjectTemplate::GameObjectType SharedTangibleObjectTemplate::getSocketDestinations(int index) const { - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_socketDestinationsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter socketDestinations in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter socketDestinations has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter socketDestinations has not been defined in template %s!", DataResource::getName())); return base->getSocketDestinations(index); } } - if (m_socketDestinationsAppend && base != NULL) + if (m_socketDestinationsAppend && base != nullptr) { int baseCount = base->getSocketDestinationsCount(); if (index < baseCount) @@ -859,20 +859,20 @@ size_t SharedTangibleObjectTemplate::getSocketDestinationsCount(void) const { if (!m_socketDestinationsLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getSocketDestinationsCount(); } size_t count = m_socketDestinations.size(); // if we are extending our base template, add it's count - if (m_socketDestinationsAppend && m_baseData != NULL) + if (m_socketDestinationsAppend && m_baseData != nullptr) { const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getSocketDestinationsCount(); } @@ -887,33 +887,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getStructureFootprintFileName(true); #endif } if (!m_structureFootprintFileName.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter structureFootprintFileName in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter structureFootprintFileName has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter structureFootprintFileName has not been defined in template %s!", DataResource::getName())); return base->getStructureFootprintFileName(); } } const std::string & value = m_structureFootprintFileName.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -929,33 +929,33 @@ bool testDataValue = false; UNREF(testData); #endif - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getUseStructureFootprintOutline(true); #endif } if (!m_useStructureFootprintOutline.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter useStructureFootprintOutline in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter useStructureFootprintOutline has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter useStructureFootprintOutline has not been defined in template %s!", DataResource::getName())); return base->getUseStructureFootprintOutline(); } } bool value = m_useStructureFootprintOutline.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -971,33 +971,33 @@ bool testDataValue = false; UNREF(testData); #endif - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTargetable(true); #endif } if (!m_targetable.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter targetable in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter targetable has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter targetable has not been defined in template %s!", DataResource::getName())); return base->getTargetable(); } } bool value = m_targetable.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1007,27 +1007,27 @@ UNREF(testData); const std::string & SharedTangibleObjectTemplate::getCertificationsRequired(int index) const { - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_certificationsRequiredLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter certificationsRequired in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter certificationsRequired has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter certificationsRequired has not been defined in template %s!", DataResource::getName())); return base->getCertificationsRequired(index); } } - if (m_certificationsRequiredAppend && base != NULL) + if (m_certificationsRequiredAppend && base != nullptr) { int baseCount = base->getCertificationsRequiredCount(); if (index < baseCount) @@ -1044,20 +1044,20 @@ size_t SharedTangibleObjectTemplate::getCertificationsRequiredCount(void) const { if (!m_certificationsRequiredLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getCertificationsRequiredCount(); } size_t count = m_certificationsRequired.size(); // if we are extending our base template, add it's count - if (m_certificationsRequiredAppend && m_baseData != NULL) + if (m_certificationsRequiredAppend && m_baseData != nullptr) { const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getCertificationsRequiredCount(); } @@ -1066,28 +1066,28 @@ size_t SharedTangibleObjectTemplate::getCertificationsRequiredCount(void) const void SharedTangibleObjectTemplate::getCustomizationVariableMapping(CustomizationVariableMapping &data, int index) const { - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_customizationVariableMappingLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter customizationVariableMapping in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter customizationVariableMapping has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter customizationVariableMapping has not been defined in template %s!", DataResource::getName())); base->getCustomizationVariableMapping(data, index); return; } } - if (m_customizationVariableMappingAppend && base != NULL) + if (m_customizationVariableMappingAppend && base != nullptr) { int baseCount = base->getCustomizationVariableMappingCount(); if (index < baseCount) @@ -1109,28 +1109,28 @@ void SharedTangibleObjectTemplate::getCustomizationVariableMapping(Customization void SharedTangibleObjectTemplate::getCustomizationVariableMappingMin(CustomizationVariableMapping &data, int index) const { - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_customizationVariableMappingLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter customizationVariableMapping in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter customizationVariableMapping has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter customizationVariableMapping has not been defined in template %s!", DataResource::getName())); base->getCustomizationVariableMappingMin(data, index); return; } } - if (m_customizationVariableMappingAppend && base != NULL) + if (m_customizationVariableMappingAppend && base != nullptr) { int baseCount = base->getCustomizationVariableMappingCount(); if (index < baseCount) @@ -1152,28 +1152,28 @@ void SharedTangibleObjectTemplate::getCustomizationVariableMappingMin(Customizat void SharedTangibleObjectTemplate::getCustomizationVariableMappingMax(CustomizationVariableMapping &data, int index) const { - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_customizationVariableMappingLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter customizationVariableMapping in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter customizationVariableMapping has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter customizationVariableMapping has not been defined in template %s!", DataResource::getName())); base->getCustomizationVariableMappingMax(data, index); return; } } - if (m_customizationVariableMappingAppend && base != NULL) + if (m_customizationVariableMappingAppend && base != nullptr) { int baseCount = base->getCustomizationVariableMappingCount(); if (index < baseCount) @@ -1197,20 +1197,20 @@ size_t SharedTangibleObjectTemplate::getCustomizationVariableMappingCount(void) { if (!m_customizationVariableMappingLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getCustomizationVariableMappingCount(); } size_t count = m_customizationVariableMapping.size(); // if we are extending our base template, add it's count - if (m_customizationVariableMappingAppend && m_baseData != NULL) + if (m_customizationVariableMappingAppend && m_baseData != nullptr) { const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getCustomizationVariableMappingCount(); } @@ -1225,33 +1225,33 @@ SharedTangibleObjectTemplate::ClientVisabilityFlags testDataValue = static_cast< UNREF(testData); #endif - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getClientVisabilityFlag(true); #endif } if (!m_clientVisabilityFlag.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter clientVisabilityFlag in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter clientVisabilityFlag has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter clientVisabilityFlag has not been defined in template %s!", DataResource::getName())); return base->getClientVisabilityFlag(); } } ClientVisabilityFlags value = static_cast(m_clientVisabilityFlag.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1300,12 +1300,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -1334,7 +1334,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_paletteColorCustomizationVariables.begin(); iter != m_paletteColorCustomizationVariables.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_paletteColorCustomizationVariables.clear(); m_paletteColorCustomizationVariablesAppend = file.read_bool8(); @@ -1353,7 +1353,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_rangedIntCustomizationVariables.begin(); iter != m_rangedIntCustomizationVariables.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_rangedIntCustomizationVariables.clear(); m_rangedIntCustomizationVariablesAppend = file.read_bool8(); @@ -1372,7 +1372,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_constStringCustomizationVariables.begin(); iter != m_constStringCustomizationVariables.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_constStringCustomizationVariables.clear(); m_constStringCustomizationVariablesAppend = file.read_bool8(); @@ -1391,7 +1391,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_socketDestinations.begin(); iter != m_socketDestinations.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_socketDestinations.clear(); m_socketDestinationsAppend = file.read_bool8(); @@ -1416,7 +1416,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_certificationsRequired.begin(); iter != m_certificationsRequired.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_certificationsRequired.clear(); m_certificationsRequiredAppend = file.read_bool8(); @@ -1435,7 +1435,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_customizationVariableMapping.begin(); iter != m_customizationVariableMapping.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_customizationVariableMapping.clear(); m_customizationVariableMappingAppend = file.read_bool8(); @@ -1514,33 +1514,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_ConstStringCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_ConstStringCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getVariableName(true); #endif } if (!m_variableName.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter variableName in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter variableName has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter variableName has not been defined in template %s!", DataResource::getName())); return base->getVariableName(versionOk); } } const std::string & value = m_variableName.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1556,33 +1556,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_ConstStringCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_ConstStringCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getConstValue(true); #endif } if (!m_constValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter constValue in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter constValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter constValue has not been defined in template %s!", DataResource::getName())); return base->getConstValue(versionOk); } } const std::string & value = m_constValue.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1687,33 +1687,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_CustomizationVariableMapping * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_CustomizationVariableMapping * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSourceVariable(true); #endif } if (!m_sourceVariable.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter sourceVariable in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter sourceVariable has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter sourceVariable has not been defined in template %s!", DataResource::getName())); return base->getSourceVariable(versionOk); } } const std::string & value = m_sourceVariable.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1729,33 +1729,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_CustomizationVariableMapping * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_CustomizationVariableMapping * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDependentVariable(true); #endif } if (!m_dependentVariable.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter dependentVariable in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter dependentVariable has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter dependentVariable has not been defined in template %s!", DataResource::getName())); return base->getDependentVariable(versionOk); } } const std::string & value = m_dependentVariable.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1860,33 +1860,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getVariableName(true); #endif } if (!m_variableName.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter variableName in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter variableName has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter variableName has not been defined in template %s!", DataResource::getName())); return base->getVariableName(versionOk); } } const std::string & value = m_variableName.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1902,33 +1902,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getPalettePathName(true); #endif } if (!m_palettePathName.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter palettePathName in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter palettePathName has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter palettePathName has not been defined in template %s!", DataResource::getName())); return base->getPalettePathName(versionOk); } } const std::string & value = m_palettePathName.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1944,26 +1944,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDefaultPaletteIndex(true); #endif } if (!m_defaultPaletteIndex.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter defaultPaletteIndex in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter defaultPaletteIndex has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter defaultPaletteIndex has not been defined in template %s!", DataResource::getName())); return base->getDefaultPaletteIndex(versionOk); } } @@ -1973,9 +1973,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getDefaultPaletteIndex(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1992,7 +1992,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2008,26 +2008,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDefaultPaletteIndexMin(true); #endif } if (!m_defaultPaletteIndex.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter defaultPaletteIndex in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter defaultPaletteIndex has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter defaultPaletteIndex has not been defined in template %s!", DataResource::getName())); return base->getDefaultPaletteIndexMin(versionOk); } } @@ -2037,9 +2037,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getDefaultPaletteIndexMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2056,7 +2056,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2072,26 +2072,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDefaultPaletteIndexMax(true); #endif } if (!m_defaultPaletteIndex.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter defaultPaletteIndex in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter defaultPaletteIndex has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter defaultPaletteIndex has not been defined in template %s!", DataResource::getName())); return base->getDefaultPaletteIndexMax(versionOk); } } @@ -2101,9 +2101,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getDefaultPaletteIndexMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2120,7 +2120,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2229,33 +2229,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getVariableName(true); #endif } if (!m_variableName.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter variableName in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter variableName has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter variableName has not been defined in template %s!", DataResource::getName())); return base->getVariableName(versionOk); } } const std::string & value = m_variableName.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2271,26 +2271,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMinValueInclusive(true); #endif } if (!m_minValueInclusive.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter minValueInclusive in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter minValueInclusive has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter minValueInclusive has not been defined in template %s!", DataResource::getName())); return base->getMinValueInclusive(versionOk); } } @@ -2300,9 +2300,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinValueInclusive(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2319,7 +2319,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2335,26 +2335,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMinValueInclusiveMin(true); #endif } if (!m_minValueInclusive.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter minValueInclusive in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter minValueInclusive has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter minValueInclusive has not been defined in template %s!", DataResource::getName())); return base->getMinValueInclusiveMin(versionOk); } } @@ -2364,9 +2364,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinValueInclusiveMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2383,7 +2383,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2399,26 +2399,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMinValueInclusiveMax(true); #endif } if (!m_minValueInclusive.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter minValueInclusive in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter minValueInclusive has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter minValueInclusive has not been defined in template %s!", DataResource::getName())); return base->getMinValueInclusiveMax(versionOk); } } @@ -2428,9 +2428,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinValueInclusiveMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2447,7 +2447,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2463,26 +2463,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDefaultValue(true); #endif } if (!m_defaultValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter defaultValue in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter defaultValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter defaultValue has not been defined in template %s!", DataResource::getName())); return base->getDefaultValue(versionOk); } } @@ -2492,9 +2492,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getDefaultValue(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2511,7 +2511,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2527,26 +2527,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDefaultValueMin(true); #endif } if (!m_defaultValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter defaultValue in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter defaultValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter defaultValue has not been defined in template %s!", DataResource::getName())); return base->getDefaultValueMin(versionOk); } } @@ -2556,9 +2556,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getDefaultValueMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2575,7 +2575,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2591,26 +2591,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDefaultValueMax(true); #endif } if (!m_defaultValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter defaultValue in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter defaultValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter defaultValue has not been defined in template %s!", DataResource::getName())); return base->getDefaultValueMax(versionOk); } } @@ -2620,9 +2620,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getDefaultValueMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2639,7 +2639,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2655,26 +2655,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxValueExclusive(true); #endif } if (!m_maxValueExclusive.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxValueExclusive in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxValueExclusive has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxValueExclusive has not been defined in template %s!", DataResource::getName())); return base->getMaxValueExclusive(versionOk); } } @@ -2684,9 +2684,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxValueExclusive(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2703,7 +2703,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2719,26 +2719,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxValueExclusiveMin(true); #endif } if (!m_maxValueExclusive.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxValueExclusive in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxValueExclusive has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxValueExclusive has not been defined in template %s!", DataResource::getName())); return base->getMaxValueExclusiveMin(versionOk); } } @@ -2748,9 +2748,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxValueExclusiveMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2767,7 +2767,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2783,26 +2783,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxValueExclusiveMax(true); #endif } if (!m_maxValueExclusive.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxValueExclusive in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxValueExclusive has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxValueExclusive has not been defined in template %s!", DataResource::getName())); return base->getMaxValueExclusiveMax(versionOk); } } @@ -2812,9 +2812,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxValueExclusiveMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2831,7 +2831,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTerrainSurfaceObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTerrainSurfaceObjectTemplate.cpp index cd2c216b..b518a9f7 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTerrainSurfaceObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTerrainSurfaceObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedTerrainSurfaceObjectTemplate::getTemplateVersion(void) const */ Tag SharedTerrainSurfaceObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedTerrainSurfaceObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedTerrainSurfaceObjectTemplate::getHighestTemplateVersion @@ -111,26 +111,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedTerrainSurfaceObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTerrainSurfaceObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCover(true); #endif } if (!m_cover.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter cover in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter cover has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter cover has not been defined in template %s!", DataResource::getName())); return base->getCover(); } } @@ -140,9 +140,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCover(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -159,7 +159,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { if (testDataValue == value) DEBUG_WARNING(true, ("Template %s, parameter cover is returning same value as base template.", DataResource::getName())); @@ -177,26 +177,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedTerrainSurfaceObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTerrainSurfaceObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCoverMin(true); #endif } if (!m_cover.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter cover in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter cover has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter cover has not been defined in template %s!", DataResource::getName())); return base->getCoverMin(); } } @@ -206,9 +206,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCoverMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -225,7 +225,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { if (testDataValue == value) DEBUG_WARNING(true, ("Template %s, parameter cover is returning same value as base template.", DataResource::getName())); @@ -243,26 +243,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedTerrainSurfaceObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTerrainSurfaceObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCoverMax(true); #endif } if (!m_cover.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter cover in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter cover has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter cover has not been defined in template %s!", DataResource::getName())); return base->getCoverMax(); } } @@ -272,9 +272,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCoverMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -291,7 +291,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { if (testDataValue == value) DEBUG_WARNING(true, ("Template %s, parameter cover is returning same value as base template.", DataResource::getName())); @@ -309,33 +309,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedTerrainSurfaceObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTerrainSurfaceObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSurfaceType(true); #endif } if (!m_surfaceType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter surfaceType in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter surfaceType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter surfaceType has not been defined in template %s!", DataResource::getName())); return base->getSurfaceType(); } } const std::string & value = m_surfaceType.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { if (testDataValue == value) DEBUG_WARNING(true, ("Template %s, parameter surfaceType is returning same value as base template.", DataResource::getName())); @@ -383,12 +383,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedUniverseObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedUniverseObjectTemplate.cpp index adf09d85..c6e9b692 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedUniverseObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedUniverseObjectTemplate.cpp @@ -95,10 +95,10 @@ Tag SharedUniverseObjectTemplate::getTemplateVersion(void) const */ Tag SharedUniverseObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedUniverseObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedUniverseObjectTemplate::getHighestTemplateVersion @@ -141,12 +141,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedVehicleObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedVehicleObjectTemplate.cpp index ccc2cb77..7467cf59 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedVehicleObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedVehicleObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedVehicleObjectTemplate::getTemplateVersion(void) const */ Tag SharedVehicleObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedVehicleObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedVehicleObjectTemplate::getHighestTemplateVersion @@ -105,8 +105,8 @@ Tag SharedVehicleObjectTemplate::getHighestTemplateVersion(void) const //@BEGIN TFD float SharedVehicleObjectTemplate::getSpeed(MovementTypes index) const { - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -114,14 +114,14 @@ float SharedVehicleObjectTemplate::getSpeed(MovementTypes index) const DEBUG_FATAL(index < 0 || index >= 5, ("template param index out of range")); if (!m_speed[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter speed in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter speed has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter speed has not been defined in template %s!", DataResource::getName())); return base->getSpeed(index); } } @@ -131,9 +131,9 @@ float SharedVehicleObjectTemplate::getSpeed(MovementTypes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSpeed(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -154,8 +154,8 @@ float SharedVehicleObjectTemplate::getSpeed(MovementTypes index) const float SharedVehicleObjectTemplate::getSpeedMin(MovementTypes index) const { - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -163,14 +163,14 @@ float SharedVehicleObjectTemplate::getSpeedMin(MovementTypes index) const DEBUG_FATAL(index < 0 || index >= 5, ("template param index out of range")); if (!m_speed[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter speed in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter speed has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter speed has not been defined in template %s!", DataResource::getName())); return base->getSpeedMin(index); } } @@ -180,9 +180,9 @@ float SharedVehicleObjectTemplate::getSpeedMin(MovementTypes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSpeedMin(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -203,8 +203,8 @@ float SharedVehicleObjectTemplate::getSpeedMin(MovementTypes index) const float SharedVehicleObjectTemplate::getSpeedMax(MovementTypes index) const { - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -212,14 +212,14 @@ float SharedVehicleObjectTemplate::getSpeedMax(MovementTypes index) const DEBUG_FATAL(index < 0 || index >= 5, ("template param index out of range")); if (!m_speed[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter speed in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter speed has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter speed has not been defined in template %s!", DataResource::getName())); return base->getSpeedMax(index); } } @@ -229,9 +229,9 @@ float SharedVehicleObjectTemplate::getSpeedMax(MovementTypes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSpeedMax(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -258,26 +258,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSlopeAversion(true); #endif } if (!m_slopeAversion.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slopeAversion in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slopeAversion has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slopeAversion has not been defined in template %s!", DataResource::getName())); return base->getSlopeAversion(); } } @@ -287,9 +287,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSlopeAversion(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -306,7 +306,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -322,26 +322,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSlopeAversionMin(true); #endif } if (!m_slopeAversion.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slopeAversion in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slopeAversion has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slopeAversion has not been defined in template %s!", DataResource::getName())); return base->getSlopeAversionMin(); } } @@ -351,9 +351,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSlopeAversionMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -370,7 +370,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -386,26 +386,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSlopeAversionMax(true); #endif } if (!m_slopeAversion.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slopeAversion in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slopeAversion has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slopeAversion has not been defined in template %s!", DataResource::getName())); return base->getSlopeAversionMax(); } } @@ -415,9 +415,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSlopeAversionMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -434,7 +434,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -450,26 +450,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getHoverValue(true); #endif } if (!m_hoverValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter hoverValue in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter hoverValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter hoverValue has not been defined in template %s!", DataResource::getName())); return base->getHoverValue(); } } @@ -479,9 +479,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getHoverValue(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -498,7 +498,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -514,26 +514,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getHoverValueMin(true); #endif } if (!m_hoverValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter hoverValue in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter hoverValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter hoverValue has not been defined in template %s!", DataResource::getName())); return base->getHoverValueMin(); } } @@ -543,9 +543,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getHoverValueMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -562,7 +562,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -578,26 +578,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getHoverValueMax(true); #endif } if (!m_hoverValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter hoverValue in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter hoverValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter hoverValue has not been defined in template %s!", DataResource::getName())); return base->getHoverValueMax(); } } @@ -607,9 +607,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getHoverValueMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -626,7 +626,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -642,26 +642,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTurnRate(true); #endif } if (!m_turnRate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter turnRate in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter turnRate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter turnRate has not been defined in template %s!", DataResource::getName())); return base->getTurnRate(); } } @@ -671,9 +671,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTurnRate(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -690,7 +690,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -706,26 +706,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTurnRateMin(true); #endif } if (!m_turnRate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter turnRate in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter turnRate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter turnRate has not been defined in template %s!", DataResource::getName())); return base->getTurnRateMin(); } } @@ -735,9 +735,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTurnRateMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -754,7 +754,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -770,26 +770,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTurnRateMax(true); #endif } if (!m_turnRate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter turnRate in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter turnRate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter turnRate has not been defined in template %s!", DataResource::getName())); return base->getTurnRateMax(); } } @@ -799,9 +799,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTurnRateMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -818,7 +818,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -834,26 +834,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxVelocity(true); #endif } if (!m_maxVelocity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxVelocity in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxVelocity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxVelocity has not been defined in template %s!", DataResource::getName())); return base->getMaxVelocity(); } } @@ -863,9 +863,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxVelocity(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -882,7 +882,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -898,26 +898,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxVelocityMin(true); #endif } if (!m_maxVelocity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxVelocity in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxVelocity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxVelocity has not been defined in template %s!", DataResource::getName())); return base->getMaxVelocityMin(); } } @@ -927,9 +927,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxVelocityMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -946,7 +946,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -962,26 +962,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxVelocityMax(true); #endif } if (!m_maxVelocity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxVelocity in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxVelocity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxVelocity has not been defined in template %s!", DataResource::getName())); return base->getMaxVelocityMax(); } } @@ -991,9 +991,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxVelocityMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1010,7 +1010,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1026,26 +1026,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAcceleration(true); #endif } if (!m_acceleration.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter acceleration in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter acceleration has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter acceleration has not been defined in template %s!", DataResource::getName())); return base->getAcceleration(); } } @@ -1055,9 +1055,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAcceleration(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1074,7 +1074,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1090,26 +1090,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAccelerationMin(true); #endif } if (!m_acceleration.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter acceleration in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter acceleration has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter acceleration has not been defined in template %s!", DataResource::getName())); return base->getAccelerationMin(); } } @@ -1119,9 +1119,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAccelerationMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1138,7 +1138,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1154,26 +1154,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAccelerationMax(true); #endif } if (!m_acceleration.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter acceleration in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter acceleration has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter acceleration has not been defined in template %s!", DataResource::getName())); return base->getAccelerationMax(); } } @@ -1183,9 +1183,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAccelerationMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1202,7 +1202,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1218,26 +1218,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getBraking(true); #endif } if (!m_braking.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter braking in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter braking has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter braking has not been defined in template %s!", DataResource::getName())); return base->getBraking(); } } @@ -1247,9 +1247,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getBraking(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1266,7 +1266,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1282,26 +1282,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getBrakingMin(true); #endif } if (!m_braking.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter braking in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter braking has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter braking has not been defined in template %s!", DataResource::getName())); return base->getBrakingMin(); } } @@ -1311,9 +1311,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getBrakingMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1330,7 +1330,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1346,26 +1346,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getBrakingMax(true); #endif } if (!m_braking.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter braking in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter braking has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter braking has not been defined in template %s!", DataResource::getName())); return base->getBrakingMax(); } } @@ -1375,9 +1375,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getBrakingMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1394,7 +1394,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1451,12 +1451,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWaypointObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWaypointObjectTemplate.cpp index 71ef4b39..2d82cd46 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWaypointObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWaypointObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedWaypointObjectTemplate::getTemplateVersion(void) const */ Tag SharedWaypointObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedWaypointObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedWaypointObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWeaponObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWeaponObjectTemplate.cpp index 7c9fa977..193d4ac7 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWeaponObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWeaponObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedWeaponObjectTemplate::getTemplateVersion(void) const */ Tag SharedWeaponObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedWeaponObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedWeaponObjectTemplate::getHighestTemplateVersion @@ -111,33 +111,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getWeaponEffect(true); #endif } if (!m_weaponEffect.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter weaponEffect in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter weaponEffect has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter weaponEffect has not been defined in template %s!", DataResource::getName())); return base->getWeaponEffect(); } } const std::string & value = m_weaponEffect.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -153,26 +153,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getWeaponEffectIndex(true); #endif } if (!m_weaponEffectIndex.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter weaponEffectIndex in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter weaponEffectIndex has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter weaponEffectIndex has not been defined in template %s!", DataResource::getName())); return base->getWeaponEffectIndex(); } } @@ -182,9 +182,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getWeaponEffectIndex(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -201,7 +201,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -217,26 +217,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getWeaponEffectIndexMin(true); #endif } if (!m_weaponEffectIndex.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter weaponEffectIndex in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter weaponEffectIndex has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter weaponEffectIndex has not been defined in template %s!", DataResource::getName())); return base->getWeaponEffectIndexMin(); } } @@ -246,9 +246,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getWeaponEffectIndexMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -265,7 +265,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -281,26 +281,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getWeaponEffectIndexMax(true); #endif } if (!m_weaponEffectIndex.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter weaponEffectIndex in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter weaponEffectIndex has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter weaponEffectIndex has not been defined in template %s!", DataResource::getName())); return base->getWeaponEffectIndexMax(); } } @@ -310,9 +310,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getWeaponEffectIndexMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -329,7 +329,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -345,33 +345,33 @@ SharedWeaponObjectTemplate::AttackType testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAttackType(true); #endif } if (!m_attackType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attackType in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter attackType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attackType has not been defined in template %s!", DataResource::getName())); return base->getAttackType(); } } AttackType value = static_cast(m_attackType.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -420,12 +420,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/quest/Quest.cpp b/engine/shared/library/sharedGame/src/shared/quest/Quest.cpp index 7cfaccef..14d2fcab 100755 --- a/engine/shared/library/sharedGame/src/shared/quest/Quest.cpp +++ b/engine/shared/library/sharedGame/src/shared/quest/Quest.cpp @@ -358,7 +358,7 @@ int Quest::getNumberOfTasks() const QuestTask const * Quest::getTask(int const taskId) const { if (taskId < 0 || taskId >= getNumberOfTasks()) - return NULL; + return nullptr; return (*m_tasks)[static_cast(taskId)]; } diff --git a/engine/shared/library/sharedGame/src/shared/quest/QuestManager.cpp b/engine/shared/library/sharedGame/src/shared/quest/QuestManager.cpp index ef210b43..3ba36a15 100755 --- a/engine/shared/library/sharedGame/src/shared/quest/QuestManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/quest/QuestManager.cpp @@ -192,7 +192,7 @@ void QuestManager::remove() Quest const * QuestManager::getQuest(CrcString const & fileName) { Quest const * const quest = getQuest(fileName.getCrc()); - DEBUG_WARNING(quest == NULL, ("QuestManager::getQuest(%s): FAILED - testquest not found", fileName.getString())); + DEBUG_WARNING(quest == nullptr, ("QuestManager::getQuest(%s): FAILED - testquest not found", fileName.getString())); return quest; } @@ -200,7 +200,7 @@ Quest const * QuestManager::getQuest(CrcString const & fileName) Quest const * QuestManager::getQuest(uint32 const questCrc) { - Quest * quest = NULL; + Quest * quest = nullptr; //-- Look for the quest in the quest map QuestMap::iterator const iter = s_quests.find(questCrc); @@ -223,7 +223,7 @@ Quest const * QuestManager::getQuest(uint32 const questCrc) } } - DEBUG_WARNING(quest == NULL, ("QuestManager::getQuest: FAILED - testquest not found")); + DEBUG_WARNING(quest == nullptr, ("QuestManager::getQuest: FAILED - testquest not found")); return quest; } @@ -234,7 +234,7 @@ Quest const * QuestManager::getQuest(std::string const & questName) { TemporaryCrcString const fileName(questName.c_str(), true); Quest const * const quest = getQuest(fileName); - DEBUG_WARNING(quest == NULL, ("QuestManager::getQuest(%s): FAILED - testquest not found", questName.c_str())); + DEBUG_WARNING(quest == nullptr, ("QuestManager::getQuest(%s): FAILED - testquest not found", questName.c_str())); return quest; } diff --git a/engine/shared/library/sharedGame/src/shared/space/AsteroidGenerationManager.cpp b/engine/shared/library/sharedGame/src/shared/space/AsteroidGenerationManager.cpp index 26b912b2..2fabba5e 100755 --- a/engine/shared/library/sharedGame/src/shared/space/AsteroidGenerationManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/space/AsteroidGenerationManager.cpp @@ -79,7 +79,7 @@ void AsteroidGenerationManager::install() DEBUG_FATAL(s_installed, ("AsteroidGenerationManager already installed")); s_installed = true; - ms_getRadiusFunction = NULL; + ms_getRadiusFunction = nullptr; ExitChain::add(AsteroidGenerationManager::remove, "AsteroidGenerationManager::remove"); } @@ -88,7 +88,7 @@ void AsteroidGenerationManager::install() void AsteroidGenerationManager::remove() { - ms_getRadiusFunction = NULL; + ms_getRadiusFunction = nullptr; clearStaticFieldData(); clearInstantiatedData(); @@ -381,7 +381,7 @@ bool AsteroidGenerationManager::generateField(AsteroidFieldData const & fieldDat s_randomGenerator.setSeed(fieldData.seed); - WaveForm3D * splineWaveform = NULL; + WaveForm3D * splineWaveform = nullptr; if (fieldData.fieldType == AsteroidFieldData::FT_spline) { splineWaveform = new WaveForm3D; @@ -403,7 +403,7 @@ bool AsteroidGenerationManager::generateField(AsteroidFieldData const & fieldDat { bool valid = false; std::vector collisionResult; - Sphere * s = NULL; + Sphere * s = nullptr; while(!valid) { //create asteroid locations until we find one that doesn't penetrate any existing objects @@ -444,11 +444,11 @@ bool AsteroidGenerationManager::generateField(AsteroidFieldData const & fieldDat { DEBUG_REPORT_LOG_PRINT(ConfigSharedGame::getSpamAsteroidGenerationData(), ("Asteroid creation collision at [%f, %f, %f], radius [%f], trying again...\n", newAsteroid.position.x, newAsteroid.position.y, newAsteroid.position.z, s->getRadius())); delete s; - s = NULL; + s = nullptr; } } - NOT_NULL(s); //lint !e644 // s could be uninitialized (not true -- initialized to NULL above, should be set to a value during the while loop) + NOT_NULL(s); //lint !e644 // s could be uninitialized (not true -- initialized to nullptr above, should be set to a value during the while loop) SpatialSubdivisionHandle* handle = ms_collisionSphereTree.addObject(s); if(handle) diff --git a/engine/shared/library/sharedGame/src/shared/space/NebulaManager.cpp b/engine/shared/library/sharedGame/src/shared/space/NebulaManager.cpp index 803c5a76..e48dc276 100755 --- a/engine/shared/library/sharedGame/src/shared/space/NebulaManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/space/NebulaManager.cpp @@ -52,7 +52,7 @@ namespace NebulaManagerNamespace }; typedef SphereTree NebulaSphereTree; - NebulaSphereTree * s_collisionSphereTree = NULL; + NebulaSphereTree * s_collisionSphereTree = nullptr; enum DatatableColumns { @@ -110,7 +110,7 @@ namespace NebulaManagerNamespace //---------------------------------------------------------------------- - NebulaManager::ImplementationClearFunction s_clearFunction = NULL; + NebulaManager::ImplementationClearFunction s_clearFunction = nullptr; } using namespace NebulaManagerNamespace; @@ -158,10 +158,10 @@ void NebulaManager::clear() s_nebulaMap.clear(); - if (s_collisionSphereTree != NULL) + if (s_collisionSphereTree != nullptr) { delete s_collisionSphereTree; - s_collisionSphereTree = NULL; + s_collisionSphereTree = nullptr; } //-- Remove nebulas for the current scene from the scene map @@ -178,7 +178,7 @@ void NebulaManager::clear() s_currentSceneId.clear(); - if (s_clearFunction != NULL) + if (s_clearFunction != nullptr) s_clearFunction(); } @@ -319,11 +319,11 @@ void NebulaManager::getNebulasInSphere(Vector const & pos, float const radius, N Nebula const * NebulaManager::getClosestNebula(Vector const & pos, float const maxDistance, float & outMinDistance, float & outMaxDistance) { - Nebula const * nebula = NULL; + Nebula const * nebula = nullptr; if (NON_NULL(s_collisionSphereTree)->findClosest(pos, maxDistance, nebula, outMinDistance, outMaxDistance)) return nebula; - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -334,7 +334,7 @@ Nebula const * NebulaManager::getNebulaById(int const id) if (it != s_nebulaMap.end()) return (*it).second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedGame/src/shared/space/ShipChassis.cpp b/engine/shared/library/sharedGame/src/shared/space/ShipChassis.cpp index ab3b0672..6d014f13 100755 --- a/engine/shared/library/sharedGame/src/shared/space/ShipChassis.cpp +++ b/engine/shared/library/sharedGame/src/shared/space/ShipChassis.cpp @@ -211,7 +211,7 @@ bool ShipChassis::save(std::string const & filename) ShipChassisSlot const * const chassisSlot = shipChassis->getSlot(static_cast(chassisSlotType)); - if (NULL == chassisSlot) + if (nullptr == chassisSlot) { tabStr += "\t\t"; continue; @@ -249,7 +249,7 @@ bool ShipChassis::save(std::string const & filename) StdioFileFactory sff; AbstractFile * const af = sff.createFile(filename.c_str(), "wb"); - if (NULL != af && af->isOpen()) + if (nullptr != af && af->isOpen()) { int const bytesWritten = af->write(static_cast(tabStr.size()), tabStr.c_str()); retval = (bytesWritten == static_cast(tabStr.size())); @@ -317,7 +317,7 @@ ShipChassis const * ShipChassis::findShipChassisByName (CrcString const & if (it != s_nameChassisMap->end ()) return (*it).second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -330,7 +330,7 @@ ShipChassis const * ShipChassis::findShipChassisByCrc (uint32 chassis if (it != s_crcChassisMap.end ()) return (*it).second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -365,7 +365,7 @@ void ShipChassis::setSlotTargetable(int const chassisSlotType, bool targetable) { if (targetable) { - if (NULL == getSlot(static_cast(chassisSlotType))) + if (nullptr == getSlot(static_cast(chassisSlotType))) { WARNING(true, ("ShipChassis cannot set non existant slot [%d] targetable", chassisSlotType)); return; @@ -398,7 +398,7 @@ ShipChassisSlot * ShipChassis::getSlot(ShipChassisSlotType::Type shipChassisSlot return &slot; } - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -582,7 +582,7 @@ void ShipChassis::setUseWritableChassis(bool onlyUseThisForTools) bool ShipChassis::addChassis(bool doSort) { - if (doSort && NULL != findShipChassisByCrc(getCrc())) + if (doSort && nullptr != findShipChassisByCrc(getCrc())) { WARNING(true, ("ShipChassis attempt to add multiple [%s] chassis", getName().getString())); return false; @@ -628,7 +628,7 @@ bool ShipChassis::removeChassis() bool ShipChassis::setName(CrcString const & name) { ShipChassis const * const dupeNameShipChassis = findShipChassisByName(name); - if (NULL != dupeNameShipChassis) + if (nullptr != dupeNameShipChassis) { WARNING(true, ("ShipChassis attempt to set name [%s] already exists", name.getString())); return false; diff --git a/engine/shared/library/sharedGame/src/shared/space/ShipChassisSlot.cpp b/engine/shared/library/sharedGame/src/shared/space/ShipChassisSlot.cpp index dec4fd3e..0830d52c 100755 --- a/engine/shared/library/sharedGame/src/shared/space/ShipChassisSlot.cpp +++ b/engine/shared/library/sharedGame/src/shared/space/ShipChassisSlot.cpp @@ -78,7 +78,7 @@ ShipChassisSlot::~ShipChassisSlot () std::for_each(m_compatibilities->begin(), m_compatibilities->end(), PointerDeleter()); m_compatibilities->clear(); delete m_compatibilities; - m_compatibilities = NULL; + m_compatibilities = nullptr; } //---------------------------------------------------------------------- @@ -145,7 +145,7 @@ bool ShipChassisSlot::canAcceptComponentType (int shipComponentType) const bool ShipChassisSlot::canAcceptCompatibility (CrcString const & compatibility) const { - //-- null compatibility components are universally accepted + //-- nullptr compatibility components are universally accepted if (compatibility.isEmpty ()) return true; diff --git a/engine/shared/library/sharedGame/src/shared/space/ShipChassisWritable.cpp b/engine/shared/library/sharedGame/src/shared/space/ShipChassisWritable.cpp index cfc58a90..b4f2c22a 100755 --- a/engine/shared/library/sharedGame/src/shared/space/ShipChassisWritable.cpp +++ b/engine/shared/library/sharedGame/src/shared/space/ShipChassisWritable.cpp @@ -51,7 +51,7 @@ bool ShipChassisWritable::setName(CrcString const & name) { if (ShipChassis::setName(name)) { - if (NULL != findShipChassisByCrc(name.getCrc())) + if (nullptr != findShipChassisByCrc(name.getCrc())) Transceivers::chassisListChanged.emitMessage(true); return true; } @@ -72,7 +72,7 @@ void ShipChassisWritable::setSlotTargetable(int chassisSlotType, bool targetable { ShipChassisSlot * const chassisSlot = getSlot(static_cast(chassisSlotType)); - if (NULL == chassisSlot) + if (nullptr == chassisSlot) { WARNING(true, ("ShipChassisWritable::setSlotTargetable() invalid slot")); } diff --git a/engine/shared/library/sharedGame/src/shared/space/ShipComponentAttachmentManager.cpp b/engine/shared/library/sharedGame/src/shared/space/ShipComponentAttachmentManager.cpp index 14897909..3a8dbd52 100755 --- a/engine/shared/library/sharedGame/src/shared/space/ShipComponentAttachmentManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/space/ShipComponentAttachmentManager.cpp @@ -164,7 +164,7 @@ void ShipComponentAttachmentManager::load() ShipComponentDescriptor const * const shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByName (TemporaryCrcString (componentName.c_str (), true)); - if (shipComponentDescriptor == NULL) + if (shipComponentDescriptor == nullptr) { WARNING (true, ("ShipComponentAttachmentManager chassis [%s] specified invalid component [%s] at row [%d] in file [%s]", name.getString (), componentName.c_str (), row, chassis_filename.c_str())); continue; @@ -266,7 +266,7 @@ bool ShipComponentAttachmentManager::save(std::string const & dsrcPath, std::str bool ShipComponentAttachmentManager::saveChassisInfo(std::string const & chassisName, std::string const & filenameTab, std::string const & filenameIff) { ShipChassis const * const chassis = ShipChassis::findShipChassisByName(ConstCharCrcString(chassisName.c_str())); - if (NULL == chassis) + if (nullptr == chassis) return false; uint32 const chassisCrc = chassis->getCrc(); @@ -283,7 +283,7 @@ bool ShipComponentAttachmentManager::saveChassisInfo(std::string const & chassis std::string const & componentName = *it; ShipComponentDescriptor const * const shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByName(ConstCharCrcString(componentName.c_str())); - if (NULL == shipComponentDescriptor) + if (nullptr == shipComponentDescriptor) return false; uint32 const componentCrc = shipComponentDescriptor->getCrc(); @@ -333,7 +333,7 @@ bool ShipComponentAttachmentManager::saveChassisInfo(std::string const & chassis std::string const & componentName = *it; ShipComponentDescriptor const * const shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByName(ConstCharCrcString(componentName.c_str())); - if (NULL == shipComponentDescriptor) + if (nullptr == shipComponentDescriptor) return false; uint32 const componentCrc = shipComponentDescriptor->getCrc(); @@ -427,7 +427,7 @@ bool ShipComponentAttachmentManager::saveChassisInfo(std::string const & chassis StdioFileFactory sff; AbstractFile * const af = sff.createFile(filenameTab.c_str(), "wb"); - if (NULL != af && af->isOpen()) + if (nullptr != af && af->isOpen()) { int const bytesWritten = af->write(static_cast(tabStr.size()), tabStr.c_str()); retval = (bytesWritten == static_cast(tabStr.size())); @@ -484,7 +484,7 @@ bool ShipComponentAttachmentManager::getAttachmentsForShip(uint32 chassisCrc, ui TemplateHardpointPairVector const & thpv = (*it).second; if (thpv.empty()) { - thpVectors[i] = NULL; + thpVectors[i] = nullptr; } else { @@ -493,7 +493,7 @@ bool ShipComponentAttachmentManager::getAttachmentsForShip(uint32 chassisCrc, ui } } else - thpVectors[i] = NULL; + thpVectors[i] = nullptr; } return found; diff --git a/engine/shared/library/sharedGame/src/shared/space/ShipComponentData.cpp b/engine/shared/library/sharedGame/src/shared/space/ShipComponentData.cpp index 78a26512..ae4882b5 100755 --- a/engine/shared/library/sharedGame/src/shared/space/ShipComponentData.cpp +++ b/engine/shared/library/sharedGame/src/shared/space/ShipComponentData.cpp @@ -53,7 +53,7 @@ ShipComponentData::~ShipComponentData () void ShipComponentData::printDebugString (Unicode::String & result, Unicode::String const & padding) const { - if (m_descriptor == NULL) + if (m_descriptor == nullptr) return; char buf [2048]; diff --git a/engine/shared/library/sharedGame/src/shared/space/ShipComponentDescriptor.cpp b/engine/shared/library/sharedGame/src/shared/space/ShipComponentDescriptor.cpp index 5c3560f0..b9e021b4 100755 --- a/engine/shared/library/sharedGame/src/shared/space/ShipComponentDescriptor.cpp +++ b/engine/shared/library/sharedGame/src/shared/space/ShipComponentDescriptor.cpp @@ -115,7 +115,7 @@ void ShipComponentDescriptor::load() DEBUG_WARNING(!sharedTemplateName.empty() && sharedCrcString.isEmpty(), ("Data error: in ship_components.tab - Component [%s] Shared template [%s] not found for row [%d]", name.c_str(), sharedTemplateName.c_str(), row)); #endif - ShipComponentDescriptor * componentDescriptor = NULL; + ShipComponentDescriptor * componentDescriptor = nullptr; if (s_useWritableComponentDescriptor) componentDescriptor = new ShipComponentDescriptorWritable (TemporaryCrcString (name.c_str (), true), type, TemporaryCrcString (compatibility.c_str (), true), serverObjectTemplateName, sharedTemplateName); @@ -174,7 +174,7 @@ bool ShipComponentDescriptor::save(std::string const & filename) StdioFileFactory sff; AbstractFile * const af = sff.createFile(filename.c_str(), "wb"); - if (NULL != af && af->isOpen()) + if (nullptr != af && af->isOpen()) { int const bytesWritten = af->write(static_cast(tabStr.size()), tabStr.c_str()); retval = (bytesWritten == static_cast(tabStr.size())); @@ -285,7 +285,7 @@ ShipComponentDescriptor const * ShipComponentDescriptor::findShipComponentDescri if (it != s_crcComponentMap.end ()) return (*it).second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -297,7 +297,7 @@ ShipComponentDescriptor const * ShipComponentDescriptor::findShipComponentDescri if (it != s_nameComponentMap->end ()) return (*it).second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -309,7 +309,7 @@ ShipComponentDescriptor const * ShipComponentDescriptor::findShipComponentDescri if (it != s_objectTemplateCrcComponentMap.end ()) return (*it).second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -321,7 +321,7 @@ ShipComponentDescriptor const * ShipComponentDescriptor::findShipComponentDescri if (it != s_sharedObjectTemplateCrcComponentMap.end ()) return (*it).second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -348,7 +348,7 @@ ShipComponentDescriptor::StringVector ShipComponentDescriptor::getComponentDescr bool ShipComponentDescriptor::setName(std::string const & name) { ShipComponentDescriptor const * const dupeNameShipComponentDescriptor = findShipComponentDescriptorByName(ConstCharCrcString(name.c_str())); - if (NULL != dupeNameShipComponentDescriptor) + if (nullptr != dupeNameShipComponentDescriptor) { WARNING(true, ("ShipComponentDescriptor attempt to set name [%s] already exists", name.c_str())); return false; @@ -379,14 +379,14 @@ bool ShipComponentDescriptor::setName(std::string const & name) bool ShipComponentDescriptor::setObjectTemplateCrcs(uint32 crc, uint32 sharedCrc) { ShipComponentDescriptor const * const dupeTemplateShipComponentDescriptor = findShipComponentDescriptorByObjectTemplate(crc); - if (NULL != dupeTemplateShipComponentDescriptor && this != dupeTemplateShipComponentDescriptor) + if (nullptr != dupeTemplateShipComponentDescriptor && this != dupeTemplateShipComponentDescriptor) { WARNING(true, ("ShipComponentDescriptor attempt to set ot crc [%s] already exists", dupeTemplateShipComponentDescriptor->getName().getString())); return false; } ShipComponentDescriptor const * const dupeSharedTemplateShipComponentDescriptor = findShipComponentDescriptorBySharedObjectTemplate(crc); - if (NULL != dupeSharedTemplateShipComponentDescriptor && this != dupeSharedTemplateShipComponentDescriptor) + if (nullptr != dupeSharedTemplateShipComponentDescriptor && this != dupeSharedTemplateShipComponentDescriptor) { WARNING(true, ("ShipComponentDescriptor attempt to set shared ot crc [%s] already exists", dupeSharedTemplateShipComponentDescriptor->getName().getString())); return false; @@ -432,7 +432,7 @@ bool ShipComponentDescriptor::addShipComponentDescriptor(bool checkValidity, boo { { ShipComponentDescriptor const * const shipComponentDescriptor = findShipComponentDescriptorByName(m_name); - if (NULL != shipComponentDescriptor) + if (nullptr != shipComponentDescriptor) { WARNING(true, ("ShipComponentDescriptor::addShipComponentDescriptor name [%s] is already in map", m_name.getString())); return false; @@ -441,7 +441,7 @@ bool ShipComponentDescriptor::addShipComponentDescriptor(bool checkValidity, boo { ShipComponentDescriptor const * const shipComponentDescriptor = findShipComponentDescriptorByCrc(getCrc()); - if (NULL != shipComponentDescriptor) + if (nullptr != shipComponentDescriptor) { WARNING(true, ("ShipComponentDescriptor::addShipComponentDescriptor [%s] crc [0x%x] is already in map via [%s]", m_name.getString(), static_cast(getCrc()), shipComponentDescriptor->getName().getString())); return false; @@ -453,7 +453,7 @@ bool ShipComponentDescriptor::addShipComponentDescriptor(bool checkValidity, boo if (0 != objectTemplateCrc) { ShipComponentDescriptor const * const shipComponentDescriptor = findShipComponentDescriptorByObjectTemplate(objectTemplateCrc); - if (NULL != shipComponentDescriptor) + if (nullptr != shipComponentDescriptor) { WARNING(true, ("ShipComponentDescriptor::addShipComponentDescriptor [%s] server template [%s] [0x%x] is already in map via [%s]", m_name.getString(), getObjectTemplateName().c_str(), static_cast(getObjectTemplateCrc()), shipComponentDescriptor->getName().getString())); if (strict) @@ -467,7 +467,7 @@ bool ShipComponentDescriptor::addShipComponentDescriptor(bool checkValidity, boo if (0 != sharedObjectTemplateCrc) { ShipComponentDescriptor const * const shipComponentDescriptor = findShipComponentDescriptorBySharedObjectTemplate(sharedObjectTemplateCrc); - if (NULL != shipComponentDescriptor) + if (nullptr != shipComponentDescriptor) { WARNING(true, ("ShipComponentDescriptor::addShipComponentDescriptor [%s] shared template [%s] [0x%x] is already in map via [%s]", m_name.getString(), getSharedTemplateName().c_str(), static_cast(getSharedObjectTemplateCrc()), shipComponentDescriptor->getName().getString())); if (strict) diff --git a/engine/shared/library/sharedGame/src/shared/space/ShipComponentDescriptorWritable.cpp b/engine/shared/library/sharedGame/src/shared/space/ShipComponentDescriptorWritable.cpp index 8e3cf0fb..aa3e25a3 100755 --- a/engine/shared/library/sharedGame/src/shared/space/ShipComponentDescriptorWritable.cpp +++ b/engine/shared/library/sharedGame/src/shared/space/ShipComponentDescriptorWritable.cpp @@ -85,7 +85,7 @@ bool ShipComponentDescriptorWritable::setName(std::string const & name) { if (ShipComponentDescriptor::setName(name)) { - if (NULL != ShipComponentDescriptor::findShipComponentDescriptorByCrc(Crc::normalizeAndCalculate(name.c_str()))) + if (nullptr != ShipComponentDescriptor::findShipComponentDescriptorByCrc(Crc::normalizeAndCalculate(name.c_str()))) { notifyChanged(); Transceivers::componentListChanged.emitMessage(true); diff --git a/engine/shared/library/sharedGame/src/shared/space/ShipComponentWeaponManager.cpp b/engine/shared/library/sharedGame/src/shared/space/ShipComponentWeaponManager.cpp index 4e6559c7..f929434c 100755 --- a/engine/shared/library/sharedGame/src/shared/space/ShipComponentWeaponManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/space/ShipComponentWeaponManager.cpp @@ -76,7 +76,7 @@ void ShipComponentWeaponManager::install() DataTable * const dt = DataTableManager::getTable(filename, true); - if (dt == NULL) + if (dt == nullptr) { WARNING(true, ("ShipComponentWeaponManager no such datatable [%s]", filename.c_str())); return; @@ -90,7 +90,7 @@ void ShipComponentWeaponManager::install() ShipComponentDescriptor const * const shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByName(TemporaryCrcString(componentName.c_str(), true)); - if (shipComponentDescriptor == NULL) + if (shipComponentDescriptor == nullptr) { WARNING(true, ("getComponentType datatable specified invalid component [%s]", componentName.c_str())); continue; diff --git a/engine/shared/library/sharedGame/src/shared/sui/SuiPageData.cpp b/engine/shared/library/sharedGame/src/shared/sui/SuiPageData.cpp index c0941d98..92c8403c 100755 --- a/engine/shared/library/sharedGame/src/shared/sui/SuiPageData.cpp +++ b/engine/shared/library/sharedGame/src/shared/sui/SuiPageData.cpp @@ -93,7 +93,7 @@ bool SuiPageData::addCommand(SuiCommand const & command) SuiCommand const * const oldCommand = findSubscribeToEventCommand(eventType, targetWidget); - if (oldCommand != NULL) + if (oldCommand != nullptr) { WARNING(true, ("SuiPageData::addCommand attempt to add duplicate SCT_subscribeToEvent command. Type=[%d], target=[%s]", eventType, targetWidget.c_str())); return false; @@ -130,7 +130,7 @@ void SuiPageData::subscribeToPropertyForEvent(int eventType, std::string const & { SuiCommand * const command = findSubscribeToEventCommand(eventType, eventWidgetName); - if (command == NULL) + if (command == nullptr) { SuiCommand newCommand(SuiCommand::SCT_subscribeToEvent, eventWidgetName); newCommand.initSubscribeToEvent(eventType, std::string()); @@ -148,7 +148,7 @@ bool SuiPageData::subscribeToEvent(int eventType, std::string const & eventWidge { SuiCommand * const command = findSubscribeToEventCommand(eventType, eventWidgetName); - if (command == NULL) + if (command == nullptr) { SuiCommand newCommand(SuiCommand::SCT_subscribeToEvent, eventWidgetName); newCommand.initSubscribeToEvent(eventType, callback); @@ -182,7 +182,7 @@ SuiCommand * SuiPageData::findSubscribeToEventCommand(int const eventType, std:: } } - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -203,7 +203,7 @@ SuiCommand * SuiPageData::findSubscribeToEventCommandByIndex(int const index) } } - return NULL; + return nullptr; } //---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedImage/src/shared/TargaFormat.cpp b/engine/shared/library/sharedImage/src/shared/TargaFormat.cpp index 3957c9ab..e8f6f545 100755 --- a/engine/shared/library/sharedImage/src/shared/TargaFormat.cpp +++ b/engine/shared/library/sharedImage/src/shared/TargaFormat.cpp @@ -224,7 +224,7 @@ bool TargaFormat::loadImage(const char *filename, Image **image) const if (!image) { - REPORT_LOG(true, ("TargaFormat::loadImage(): null image pointer\n")); + REPORT_LOG(true, ("TargaFormat::loadImage(): nullptr image pointer\n")); return false; } *image = 0; @@ -257,7 +257,7 @@ bool TargaFormat::loadImageReformat(const char *filename, Image **image, Image:: if (!image) { - REPORT_LOG(true, ("TargaFormat::loadImage(): null image pointer\n")); + REPORT_LOG(true, ("TargaFormat::loadImage(): nullptr image pointer\n")); return false; } *image = 0; diff --git a/engine/shared/library/sharedIoWin/src/shared/IoWin.cpp b/engine/shared/library/sharedIoWin/src/shared/IoWin.cpp index 2d4eff3e..3cb565b1 100755 --- a/engine/shared/library/sharedIoWin/src/shared/IoWin.cpp +++ b/engine/shared/library/sharedIoWin/src/shared/IoWin.cpp @@ -22,7 +22,7 @@ IoWin::IoWin( const char *debugName // Name used for debugging purposes ) : ioDebugName(DuplicateString(debugName)), - ioNext(NULL) + ioNext(nullptr) { } @@ -37,9 +37,9 @@ IoWin::IoWin( IoWin::~IoWin(void) { delete [] ioDebugName; - ioDebugName = NULL; + ioDebugName = nullptr; - ioNext = NULL; + ioNext = nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedIoWin/src/shared/IoWinManager.cpp b/engine/shared/library/sharedIoWin/src/shared/IoWinManager.cpp index 5fc8ea5e..11da17d5 100755 --- a/engine/shared/library/sharedIoWin/src/shared/IoWinManager.cpp +++ b/engine/shared/library/sharedIoWin/src/shared/IoWinManager.cpp @@ -35,7 +35,7 @@ namespace IoWinManagerNamespace // Inactivity timer. float const s_defaultInactivityTimeSeconds = 15.0f * 60.0f; - IoWinManager::InactivityCallback s_inactivityCallback = NULL; + IoWinManager::InactivityCallback s_inactivityCallback = nullptr; Timer s_inactivityTimer(s_defaultInactivityTimeSeconds); bool s_isInactive = true; @@ -76,7 +76,7 @@ void IoWinManagerNamespace::triggerInactive(bool inactive) { if (!boolEqual(s_isInactive, inactive)) { - if (s_inactivityCallback != NULL) + if (s_inactivityCallback != nullptr) { (*s_inactivityCallback)(inactive); } @@ -105,7 +105,7 @@ IoEvent *IoWinManager::firstEvent; IoEvent *IoWinManager::lastEvent; MemoryBlockManager *IoWinManager::eventBlockManager; -IoWinManager::IMEFunctionPointer IoWinManager::imeFunction = NULL; +IoWinManager::IMEFunctionPointer IoWinManager::imeFunction = nullptr; // ====================================================================== // Install the IoWinManager @@ -122,8 +122,8 @@ IoWinManager::IMEFunctionPointer IoWinManager::imeFunction = NULL; void IoWinManager::install() { DEBUG_FATAL(installed, ("double install")); - top = NULL; - captured = NULL; + top = nullptr; + captured = nullptr; ExitChain::add(IoWinManager::remove, "IoWinManager::remove"); eventBlockManager = new MemoryBlockManager("IoWinManager eventBlockManager", true, sizeof(IoEvent), 0, 0, 0); installed = true; @@ -162,9 +162,9 @@ void IoWinManager::remove(void) IoResult result; IoEvent *event; - Os::setQueueCharacterHookFunction(NULL); - Os::setSetSystemMouseCursorPositionHookFunction(NULL); - Os::setQueueKeyDownHookFunction(NULL); + Os::setQueueCharacterHookFunction(nullptr); + Os::setSetSystemMouseCursorPositionHookFunction(nullptr); + Os::setQueueKeyDownHookFunction(nullptr); DEBUG_FATAL(!installed, ("not installed")); installed = false; @@ -191,7 +191,7 @@ void IoWinManager::remove(void) delete eventBlockManager; // Remove the inactivity timer. - registerInactivityCallback(NULL, 0.0f); + registerInactivityCallback(nullptr, 0.0f); } // ---------------------------------------------------------------------- @@ -229,10 +229,10 @@ void IoWinManager::debugReport() void IoWinManager::processEvents(float elapsedTime) { - IoWin * w = NULL; - IoWin * next = NULL; - IoEvent * queue = NULL; - IoEvent * event = NULL; + IoWin * w = nullptr; + IoWin * next = nullptr; + IoEvent * queue = nullptr; + IoEvent * event = nullptr; IoResult result; @@ -244,8 +244,8 @@ void IoWinManager::processEvents(float elapsedTime) queue->next = firstEvent; // the event list is now empty - firstEvent = NULL; - lastEvent = NULL; + firstEvent = nullptr; + lastEvent = nullptr; // Update the activity timer. if (!s_isInactive) @@ -267,7 +267,7 @@ void IoWinManager::processEvents(float elapsedTime) queue = queue->next; // keep people from peeking ahead in the event queue - event->next = NULL; + event->next = nullptr; // Check to see if the event resets @@ -310,7 +310,7 @@ void IoWinManager::processEvents(float elapsedTime) if (debugReportEvents) { - const char *name = NULL; + const char *name = nullptr; switch (event->type) { @@ -434,7 +434,7 @@ void IoWinManager::open(IoWin *window) // validate the arguments if (!window) { - DEBUG_FATAL(true, ("null window")); + DEBUG_FATAL(true, ("nullptr window")); return; //lint !e527 // Warning -- Unreachable } @@ -511,13 +511,13 @@ void IoWinManager::close(IoWin *window, bool allowDelete) // validate the arguments if (!window) { - DEBUG_FATAL(true, ("null window")); + DEBUG_FATAL(true, ("nullptr window")); return; //lint !e527 // Warning -- Unreachable } // linked list traversal with a back pointer IoWin *back, *front; - for (back = NULL, front = top; front && front != window; back = front, front = front->ioNext) + for (back = nullptr, front = top; front && front != window; back = front, front = front->ioNext) ; // verify the window was found @@ -528,7 +528,7 @@ void IoWinManager::close(IoWin *window, bool allowDelete) } // -qq- lint hack - DEBUG_FATAL(!window, ("null window")); + DEBUG_FATAL(!window, ("nullptr window")); // remove it from the singly linked list if (back) @@ -566,7 +566,7 @@ IoEvent *IoWinManager::newEvent(IoEventType eventType, int arg1, int arg2, real IoEvent * const event = reinterpret_cast(eventBlockManager->allocate()); // fill out the event data - event->next = NULL; + event->next = nullptr; event->type = eventType; event->arg1 = arg1; event->arg2 = arg2; diff --git a/engine/shared/library/sharedIoWin/src/shared/IoWinManager.h b/engine/shared/library/sharedIoWin/src/shared/IoWinManager.h index d0b90b2b..6965393d 100755 --- a/engine/shared/library/sharedIoWin/src/shared/IoWinManager.h +++ b/engine/shared/library/sharedIoWin/src/shared/IoWinManager.h @@ -131,7 +131,7 @@ public: inline bool IoWinManager::haveWindow(void) { - return (top != NULL); + return (top != nullptr); } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedMath/src/shared/MxCifQuadTree.cpp b/engine/shared/library/sharedMath/src/shared/MxCifQuadTree.cpp index 0b77b2ec..92241997 100755 --- a/engine/shared/library/sharedMath/src/shared/MxCifQuadTree.cpp +++ b/engine/shared/library/sharedMath/src/shared/MxCifQuadTree.cpp @@ -32,10 +32,10 @@ MxCifQuadTree::MxCifQuadTree(float minX, float minY, float maxX, float maxY, int m_centerX((m_maxX - m_minX) / 2.0f + m_minX), m_centerY((m_maxY - m_minY) / 2.0f + m_minY), m_maxDepth(maxDepth), - m_urTree(NULL), - m_ulTree(NULL), - m_llTree(NULL), - m_lrTree(NULL), + m_urTree(nullptr), + m_ulTree(nullptr), + m_llTree(nullptr), + m_lrTree(nullptr), m_xAxisTree(minX, maxX, maxDepth), m_yAxisTree(minY, maxY, maxDepth) { @@ -49,13 +49,13 @@ MxCifQuadTree::MxCifQuadTree(float minX, float minY, float maxX, float maxY, int MxCifQuadTree::~MxCifQuadTree() { delete m_urTree; - m_urTree = NULL; + m_urTree = nullptr; delete m_ulTree; - m_ulTree = NULL; + m_ulTree = nullptr; delete m_llTree; - m_llTree = NULL; + m_llTree = nullptr; delete m_lrTree; - m_lrTree = NULL; + m_lrTree = nullptr; } // MxCifQuadTree::~MxCifQuadTree //------------------------------------------------------------------------------ @@ -99,7 +99,7 @@ bool MxCifQuadTree::addObject(const MxCifQuadTreeBounds & object) // try putting the object in a child node if (m_maxDepth > 1) { - if (m_urTree == NULL) + if (m_urTree == nullptr) { if (!split()) return false; @@ -158,7 +158,7 @@ bool MxCifQuadTree::removeObject(const MxCifQuadTreeBounds & object) { if (m_maxDepth > 1) { - if (m_urTree != NULL) + if (m_urTree != nullptr) { // check if the object is in a sub-node if (m_urTree->removeObject(object) || @@ -212,7 +212,7 @@ void MxCifQuadTree::getObjectsAt(float x, float y, y >= m_minY) { // if we have sub-trees, pass the point to the tree that contains it - if (m_urTree != NULL) + if (m_urTree != nullptr) { if (x >= m_centerX && y >= m_centerY) m_urTree->getObjectsAt(x, y, objects); @@ -239,7 +239,7 @@ void MxCifQuadTree::getObjectsAt(float x, float y, void MxCifQuadTree::getAllObjects(std::vector & objects) const { // if we have sub-trees, pass the point to the tree that contains it - if (m_urTree != NULL) + if (m_urTree != nullptr) { m_urTree->getAllObjects(objects); m_ulTree->getAllObjects(objects); @@ -265,8 +265,8 @@ MxCifQuadTree::MxCifBinTree::MxCifBinTree(float min, float max, int maxDepth) : m_max(max), m_center((max - min) / 2.0f + min), m_maxDepth(maxDepth), - m_left(NULL), - m_right(NULL), + m_left(nullptr), + m_right(nullptr), m_objects() { } // MxCifBinTree::MxCifBinTree @@ -277,9 +277,9 @@ MxCifQuadTree::MxCifBinTree::MxCifBinTree(float min, float max, int maxDepth) : MxCifQuadTree::MxCifBinTree::~MxCifBinTree() { delete m_left; - m_left = NULL; + m_left = nullptr; delete m_right; - m_right = NULL; + m_right = nullptr; m_objects.clear(); } // MxCifBinTree::~MxCifBinTree @@ -315,7 +315,7 @@ bool MxCifQuadTree::MxCifBinTree::addObject(const MxCifQuadTreeBounds & object) // try putting the object in a child node if (m_maxDepth > 1) { - if (m_left == NULL) + if (m_left == nullptr) { if (!split()) return false; @@ -348,7 +348,7 @@ bool MxCifQuadTree::MxCifBinTree::removeObject(const MxCifQuadTreeBounds & objec { if (m_maxDepth > 1) { - if (m_left != NULL) + if (m_left != nullptr) { // check if the object is in a sub-node if (m_left->removeObject(object) || @@ -379,7 +379,7 @@ void MxCifQuadTree::MxCifBinTree::getAllObjects( std::vector & objects) const { // if we have sub-trees, pass the point to the tree that contains it - if (m_left != NULL) + if (m_left != nullptr) { m_right->getAllObjects(objects); m_left->getAllObjects(objects); @@ -435,7 +435,7 @@ void MxCifQuadTree::MxCifXBinTree::getObjectsAt(float x, float y, x >= m_min) { // if we have sub-trees, pass the point to the tree that contains it - if (m_left != NULL) + if (m_left != nullptr) { if (x >= m_center) m_right->getObjectsAt(x, y, objects); @@ -498,7 +498,7 @@ void MxCifQuadTree::MxCifYBinTree::getObjectsAt(float x, float y, y >= m_min) { // if we have sub-trees, pass the point to the tree that contains it - if (m_left != NULL) + if (m_left != nullptr) { if (y >= m_center) m_right->getObjectsAt(x, y, objects); diff --git a/engine/shared/library/sharedMath/src/shared/MxCifQuadTreeBounds.h b/engine/shared/library/sharedMath/src/shared/MxCifQuadTreeBounds.h index 27006c07..3362c65a 100755 --- a/engine/shared/library/sharedMath/src/shared/MxCifQuadTreeBounds.h +++ b/engine/shared/library/sharedMath/src/shared/MxCifQuadTreeBounds.h @@ -19,7 +19,7 @@ class MxCifQuadTreeBounds { public: - MxCifQuadTreeBounds(float minX, float minY, float maxX, float maxY, void * data = NULL); + MxCifQuadTreeBounds(float minX, float minY, float maxX, float maxY, void * data = nullptr); virtual ~MxCifQuadTreeBounds(){}; const float getMinX(void) const; @@ -87,7 +87,7 @@ inline void * MxCifQuadTreeBounds::getData(void) const class MxCifQuadTreeCircleBounds : public MxCifQuadTreeBounds { public: - MxCifQuadTreeCircleBounds(float centerX, float centerY, float radius, void * data = NULL); + MxCifQuadTreeCircleBounds(float centerX, float centerY, float radius, void * data = nullptr); float getCenterX() const; float getCenterY() const; diff --git a/engine/shared/library/sharedMath/src/shared/Plane.cpp b/engine/shared/library/sharedMath/src/shared/Plane.cpp index de9e491f..716055b6 100755 --- a/engine/shared/library/sharedMath/src/shared/Plane.cpp +++ b/engine/shared/library/sharedMath/src/shared/Plane.cpp @@ -63,7 +63,7 @@ void Plane::set(const Vector &point0, const Vector &point1, const Vector &point2 * Find the intersection between a line segment and the plane. * * If the line segment does intersect the plane, and the intersection - * pointer is non-NULL, then intersection will be set to the point on + * pointer is non-nullptr, then intersection will be set to the point on * the line segment that crosses the plane. * * @param point0 [IN] Start of the line segment @@ -85,7 +85,7 @@ bool Plane::findIntersection(const Vector &point0, const Vector &point1) const * Find the intersection between a line segment and the plane. * * If the line segment does intersect the plane, and the intersection - * pointer is non-NULL, then intersection will be set to the point on + * pointer is non-nullptr, then intersection will be set to the point on * the line segment that crosses the plane. * * @param point0 [IN] Start of the line segment @@ -120,7 +120,7 @@ bool Plane::findIntersection(const Vector &point0, const Vector &point1, Vector * Find the intersection between a line segment and the plane. * * If the line segment does intersect the plane, and the intersection - * pointer is non-NULL, then intersection will be set to the point on + * pointer is non-nullptr, then intersection will be set to the point on * the line segment that crosses the plane. * * @param point0 [IN] Start of the line segment @@ -159,7 +159,7 @@ bool Plane::findIntersection(const Vector &point0, const Vector &point1, Vector * Find the intersection between a line segment and the plane. * * If the line segment does intersect the plane, and the intersection - * pointer is non-NULL, then intersection will be set to the point on + * pointer is non-nullptr, then intersection will be set to the point on * the line segment that crosses the plane. * * @param point0 [IN] Start of the line segment @@ -198,7 +198,7 @@ bool Plane::findIntersection(const Vector &point0, const Vector &point1, float & * back side of the plane. * * If the line segment does intersect the plane, and the intersection - * pointer is non-NULL, then intersection will be set to the point on + * pointer is non-nullptr, then intersection will be set to the point on * the line segment that crosses the plane. * * @param point0 [IN] Start of the line segment @@ -224,12 +224,12 @@ bool Plane::findDirectedIntersection(const Vector &point0, const Vector &point1) * back side of the plane. * * If the line segment does intersect the plane, and the intersection - * pointer is non-NULL, then intersection will be set to the point on + * pointer is non-nullptr, then intersection will be set to the point on * the line segment that crosses the plane. * * @param point0 [IN] Start of the line segment * @param point1 [IN] End of the line segment - * @param intersection [OUT] Intersection of the point and the plane (may be NULL) + * @param intersection [OUT] Intersection of the point and the plane (may be nullptr) * @param t [OUT] parameterized t from 0..1 * @return True if the line segment intersects the plane from front-to-rear, otherwise false. */ @@ -265,12 +265,12 @@ bool Plane::findDirectedIntersection(const Vector &point0, const Vector &point1, * back side of the plane. * * If the line segment does intersect the plane, and the intersection - * pointer is non-NULL, then intersection will be set to the point on + * pointer is non-nullptr, then intersection will be set to the point on * the line segment that crosses the plane. * * @param point0 [IN] Start of the line segment * @param point1 [IN] End of the line segment - * @param intersection [OUT] Intersection of the point and the plane (may be NULL) + * @param intersection [OUT] Intersection of the point and the plane (may be nullptr) * @param t [OUT] parameterized t from 0..1 * @return True if the line segment intersects the plane from front-to-rear, otherwise false. */ @@ -308,12 +308,12 @@ bool Plane::findDirectedIntersection(const Vector &point0, const Vector &point1, * back side of the plane. * * If the line segment does intersect the plane, and the intersection - * pointer is non-NULL, then intersection will be set to the point on + * pointer is non-nullptr, then intersection will be set to the point on * the line segment that crosses the plane. * * @param point0 [IN] Start of the line segment * @param point1 [IN] End of the line segment - * @param intersection [OUT] Intersection of the point and the plane (may be NULL) + * @param intersection [OUT] Intersection of the point and the plane (may be nullptr) * @param t [OUT] parameterized t from 0..1 * @return True if the line segment intersects the plane from front-to-rear, otherwise false. */ diff --git a/engine/shared/library/sharedMath/src/shared/Quaternion.cpp b/engine/shared/library/sharedMath/src/shared/Quaternion.cpp index 38ce35b6..15b349a5 100755 --- a/engine/shared/library/sharedMath/src/shared/Quaternion.cpp +++ b/engine/shared/library/sharedMath/src/shared/Quaternion.cpp @@ -138,7 +138,7 @@ void Quaternion::getTransform(Transform *transform) const void Quaternion::getTransformPreserveTranslation(Transform *transform) const { - DEBUG_FATAL(!transform, ("null transform arg")); + DEBUG_FATAL(!transform, ("nullptr transform arg")); if ((w + s_quatEqualityEpsilon) < 1.f) { diff --git a/engine/shared/library/sharedMath/src/shared/SphereTreeNode.h b/engine/shared/library/sharedMath/src/shared/SphereTreeNode.h index 706f846d..3d630b82 100755 --- a/engine/shared/library/sharedMath/src/shared/SphereTreeNode.h +++ b/engine/shared/library/sharedMath/src/shared/SphereTreeNode.h @@ -71,7 +71,7 @@ VectorPointerPool::~VectorPointerPool() } delete v; - v = NULL; + v = nullptr; } } @@ -209,7 +209,7 @@ public: node->move(this); else { - WARNING_STRICT_FATAL(true, ("SphereTree::move was invoked for an object, but the real sphere tree node it refers to is null.")); + WARNING_STRICT_FATAL(true, ("SphereTree::move was invoked for an object, but the real sphere tree node it refers to is nullptr.")); } }; @@ -292,7 +292,7 @@ inline SpatialSubdivisionHandle * SphereTreeNode::ad if(!isValidSphere(sphere)) { WARNING_STRICT_FATAL(true, ("SphereTreeNode::addObject - sphere for the object being added is invalid")); - return NULL; + return nullptr; } SphereTreeNode * candidateNode = 0; diff --git a/engine/shared/library/sharedMath/src/shared/Transform.cpp b/engine/shared/library/sharedMath/src/shared/Transform.cpp index 9cc8c181..ef35b3d0 100755 --- a/engine/shared/library/sharedMath/src/shared/Transform.cpp +++ b/engine/shared/library/sharedMath/src/shared/Transform.cpp @@ -493,7 +493,7 @@ void Transform::reorthonormalize(void) /** * Send this transform to the DebugPrint system. * - * The header parameter may be NULL. + * The header parameter may be nullptr. * * @param header Header for the transform */ @@ -524,8 +524,8 @@ void Transform::debugPrint(const char *header) const void Transform::rotate_l2p(const Vector *source, Vector *result, int count) const { - DEBUG_FATAL(!source, ("source array is NULL")); - DEBUG_FATAL(!result, ("result array is NULL")); + DEBUG_FATAL(!source, ("source array is nullptr")); + DEBUG_FATAL(!result, ("result array is nullptr")); DEBUG_FATAL(source == result, ("source and result array can not be the same")); NOT_NULL(source); @@ -559,8 +559,8 @@ void Transform::rotate_l2p(const Vector *source, Vector *result, int count) cons void Transform::rotateTranslate_l2p(const Vector *source, Vector *result, int count) const { - DEBUG_FATAL(!source, ("source array is NULL")); - DEBUG_FATAL(!result, ("result array is NULL")); + DEBUG_FATAL(!source, ("source array is nullptr")); + DEBUG_FATAL(!result, ("result array is nullptr")); NOT_NULL(source); NOT_NULL(result); @@ -594,8 +594,8 @@ void Transform::rotateTranslate_l2p(const Vector *source, Vector *result, int co void Transform::rotate_p2l(const Vector *source, Vector *result, int count) const { - DEBUG_FATAL(!source, ("source array is NULL")); - DEBUG_FATAL(!result, ("result array is NULL")); + DEBUG_FATAL(!source, ("source array is nullptr")); + DEBUG_FATAL(!result, ("result array is nullptr")); NOT_NULL(source); NOT_NULL(result); @@ -629,8 +629,8 @@ void Transform::rotate_p2l(const Vector *source, Vector *result, int count) cons void Transform::rotateTranslate_p2l(const Vector *source, Vector *result, int count) const { - DEBUG_FATAL(!source, ("source array is NULL")); - DEBUG_FATAL(!result, ("result array is NULL")); + DEBUG_FATAL(!source, ("source array is nullptr")); + DEBUG_FATAL(!result, ("result array is nullptr")); NOT_NULL(source); NOT_NULL(result); diff --git a/engine/shared/library/sharedMath/src/shared/Vector.cpp b/engine/shared/library/sharedMath/src/shared/Vector.cpp index 8f3ee55d..a694ccdd 100755 --- a/engine/shared/library/sharedMath/src/shared/Vector.cpp +++ b/engine/shared/library/sharedMath/src/shared/Vector.cpp @@ -115,7 +115,7 @@ bool Vector::isNormalized(void) const const Vector Vector::findClosestPointOnLine(const Vector &line0, const Vector &line1, real *t) const { - DEBUG_FATAL(!t, ("t arg is null")); + DEBUG_FATAL(!t, ("t arg is nullptr")); NOT_NULL(t); @@ -189,7 +189,7 @@ real Vector::distanceToLineSegment(const Vector &line0, const Vector &line1) con /** * Send this vector to the DebugPrint system. * - * The header parameter may be NULL. + * The header parameter may be nullptr. * * @param header Header for the vector */ diff --git a/engine/shared/library/sharedMath/src/shared/debug/DebugShapeRenderer.cpp b/engine/shared/library/sharedMath/src/shared/debug/DebugShapeRenderer.cpp index 3e4c8d34..4b0dc1ac 100755 --- a/engine/shared/library/sharedMath/src/shared/debug/DebugShapeRenderer.cpp +++ b/engine/shared/library/sharedMath/src/shared/debug/DebugShapeRenderer.cpp @@ -10,7 +10,7 @@ #include "sharedMath/Transform.h" -static DebugShapeRenderer::DebugShapeRendererFactory * gs_factory = NULL; +static DebugShapeRenderer::DebugShapeRendererFactory * gs_factory = nullptr; // ---------------------------------------------------------------------- @@ -145,8 +145,8 @@ void DebugShapeRenderer::setFactory ( DebugShapeRenderer::DebugShapeRendererFact DebugShapeRenderer * DebugShapeRenderer::create ( Object const * object ) { - if(gs_factory == NULL) - return NULL; + if(gs_factory == nullptr) + return nullptr; return gs_factory(object); } diff --git a/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp b/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp index 9c9ab336..a188f56f 100755 --- a/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp +++ b/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp @@ -327,7 +327,7 @@ using namespace MemoryManagerNamespace; SystemAllocation::SystemAllocation(int size) : m_size(size), - m_next(NULL), + m_next(nullptr), m_pad1(0), m_pad2(0) { @@ -343,7 +343,7 @@ SystemAllocation::SystemAllocation(int size) Block * lastMemoryBlock = getLastMemoryBlock(); // set up the prefix sentinel block - firstMemoryBlock->setPrevious(NULL); + firstMemoryBlock->setPrevious(nullptr); firstMemoryBlock->setNext(firstFreeBlock); firstMemoryBlock->setFree(false); @@ -353,7 +353,7 @@ SystemAllocation::SystemAllocation(int size) // set up the suffix sentinel block lastMemoryBlock->setPrevious(firstFreeBlock); - lastMemoryBlock->setNext(NULL); + lastMemoryBlock->setNext(nullptr); lastMemoryBlock->setFree(false); // put the first block on the free list @@ -748,7 +748,7 @@ void MemoryManagerNamespace::allocateSystemMemory(int megabytes) ms_systemMemoryAllocatedMegabytes += megabytes; // insert the memory into the sorted linked list of system allocations - SystemAllocation * back = NULL; + SystemAllocation * back = nullptr; SystemAllocation * front = ms_firstSystemAllocation; for ( ; front && front->getFirstMemoryBlock() < systemAllocation->getFirstMemoryBlock(); back = front, front = front->getNext()) {} @@ -967,7 +967,7 @@ void MemoryManagerNamespace::addToFreeList(Block * block) FreeBlock * freeBlock = static_cast(block); int const freeBlockSize = freeBlock->getSize(); - FreeBlock * parent = NULL; + FreeBlock * parent = nullptr; FreeBlock * * next = &ms_firstFreeBlock; FreeBlock * same = 0; @@ -991,7 +991,7 @@ void MemoryManagerNamespace::addToFreeList(Block * block) { freeBlock->m_smallerFreeBlock = same->m_smallerFreeBlock; - same->m_smallerFreeBlock = NULL; + same->m_smallerFreeBlock = nullptr; if (freeBlock->m_smallerFreeBlock) freeBlock->m_smallerFreeBlock->m_parentFreeBlock = freeBlock; @@ -999,7 +999,7 @@ void MemoryManagerNamespace::addToFreeList(Block * block) same->m_parentFreeBlock = freeBlock; freeBlock->m_largerFreeBlock = same->m_largerFreeBlock; - same->m_largerFreeBlock = NULL; + same->m_largerFreeBlock = nullptr; if (freeBlock->m_largerFreeBlock) freeBlock->m_largerFreeBlock->m_parentFreeBlock = freeBlock; @@ -1009,9 +1009,9 @@ void MemoryManagerNamespace::addToFreeList(Block * block) else { *next = freeBlock; - freeBlock->m_smallerFreeBlock = NULL; - freeBlock->m_sameFreeBlock = NULL; - freeBlock->m_largerFreeBlock = NULL; + freeBlock->m_smallerFreeBlock = nullptr; + freeBlock->m_sameFreeBlock = nullptr; + freeBlock->m_largerFreeBlock = nullptr; freeBlock->m_parentFreeBlock = parent; } @@ -1042,7 +1042,7 @@ void MemoryManagerNamespace::removeFromFreeList(FreeBlock * block) NOT_NULL(block); // find the pointer that points to block - FreeBlock * * parentPointer = NULL; + FreeBlock * * parentPointer = nullptr; FreeBlock * parent = block->m_parentFreeBlock; if (parent) { @@ -1088,7 +1088,7 @@ void MemoryManagerNamespace::removeFromFreeList(FreeBlock * block) { // this is the worst case. this free block has smaller and larger children, but not any same sized children // we're going to take the smallest block off the larger list and use that to replace the current node - FreeBlock * back = NULL; + FreeBlock * back = nullptr; FreeBlock * replacement = block->m_largerFreeBlock; while (replacement->m_smallerFreeBlock) { @@ -1133,16 +1133,16 @@ void MemoryManagerNamespace::removeFromFreeList(FreeBlock * block) else { // this block has no children - *parentPointer = NULL; + *parentPointer = nullptr; } } } // remove all the pointers the block may have had - block->m_smallerFreeBlock = NULL; - block->m_sameFreeBlock = NULL; - block->m_largerFreeBlock = NULL; - block->m_parentFreeBlock = NULL; + block->m_smallerFreeBlock = nullptr; + block->m_sameFreeBlock = nullptr; + block->m_largerFreeBlock = nullptr; + block->m_parentFreeBlock = nullptr; --ms_freeBlocks; } @@ -1151,7 +1151,7 @@ void MemoryManagerNamespace::removeFromFreeList(FreeBlock * block) FreeBlock *MemoryManagerNamespace::searchFreeList(int blockSize) { - FreeBlock * result = NULL; + FreeBlock * result = nullptr; FreeBlock * current = ms_firstFreeBlock; while (current) { @@ -1239,7 +1239,7 @@ void * MemoryManager::allocate(size_t size, uint32 owner, bool array, bool leakT // get the size of the allocation int allocSize = (cms_allocatedBlockSize + cms_guardBandSize + (size ? static_cast(size) : 1) + cms_guardBandSize + 15) & ~15; - FreeBlock * bestFreeBlock = NULL; + FreeBlock * bestFreeBlock = nullptr; for (int tries = 0; !bestFreeBlock && tries < 2; ++tries) { bestFreeBlock = searchFreeList(allocSize); @@ -1396,7 +1396,7 @@ void *MemoryManager::reallocate(void *userPointer, size_t newSize) { MemoryManager::free(userPointer, array); -// DEBUG_REPORT_LOG(ms_logEachAlloc, ("MemoryManager::reallocate() new_requested_size=%d, org ptr=%p, new ptr=NULL\n", newSize, userPointer)); +// DEBUG_REPORT_LOG(ms_logEachAlloc, ("MemoryManager::reallocate() new_requested_size=%d, org ptr=%p, new ptr=nullptr\n", newSize, userPointer)); return 0; } @@ -1440,7 +1440,7 @@ void *MemoryManager::reallocate(void *userPointer, size_t newSize) * Users should not call this routine directly. It should only be called * by operator delete. * - * This routine should not be called with the NULL pointer. + * This routine should not be called with the nullptr pointer. * * @param userPointer Pointer to the memory * @param array True if the array form of operator new was used, false if the scalar form was used diff --git a/engine/shared/library/sharedMessageDispatch/src/shared/Emitter.cpp b/engine/shared/library/sharedMessageDispatch/src/shared/Emitter.cpp index 8d161e58..b8c97860 100755 --- a/engine/shared/library/sharedMessageDispatch/src/shared/Emitter.cpp +++ b/engine/shared/library/sharedMessageDispatch/src/shared/Emitter.cpp @@ -31,7 +31,7 @@ struct Emitter::ReceiverList Emitter::Emitter() : receiverList(new ReceiverList) { - assert (receiverList != NULL); + assert (receiverList != nullptr); } //--------------------------------------------------------------------- diff --git a/engine/shared/library/sharedMessageDispatch/src/shared/Receiver.cpp b/engine/shared/library/sharedMessageDispatch/src/shared/Receiver.cpp index ff929dc2..bc8fc3b3 100755 --- a/engine/shared/library/sharedMessageDispatch/src/shared/Receiver.cpp +++ b/engine/shared/library/sharedMessageDispatch/src/shared/Receiver.cpp @@ -33,7 +33,7 @@ Receiver::Receiver() : emitterTargets(new EmitterTargets), hasTargets(false) { - assert(emitterTargets != NULL); + assert(emitterTargets != nullptr); } //--------------------------------------------------------------------- diff --git a/engine/shared/library/sharedNetwork/src/linux/TcpClient.cpp b/engine/shared/library/sharedNetwork/src/linux/TcpClient.cpp index 8dfa1605..8acf1289 100755 --- a/engine/shared/library/sharedNetwork/src/linux/TcpClient.cpp +++ b/engine/shared/library/sharedNetwork/src/linux/TcpClient.cpp @@ -494,7 +494,7 @@ void TcpClient::update() // disconnected so we can handle cleanup. if (pollResult) { - if (m_recvBuffer == NULL) + if (m_recvBuffer == nullptr) { m_recvBufferLength = 1500; m_recvBuffer = new unsigned char [m_recvBufferLength]; @@ -533,7 +533,7 @@ void TcpClient::update() } else { - LOG("Network", ("(null connection object) Read zero bytes on a successful poll (POLLIN|POLLHUP). Closing socket since we think it is closed.")); + LOG("Network", ("(nullptr connection object) Read zero bytes on a successful poll (POLLIN|POLLHUP). Closing socket since we think it is closed.")); } onConnectionClosed(); } diff --git a/engine/shared/library/sharedNetwork/src/shared/Service.cpp b/engine/shared/library/sharedNetwork/src/shared/Service.cpp index 84ec3dd8..9e0f0c8f 100755 --- a/engine/shared/library/sharedNetwork/src/shared/Service.cpp +++ b/engine/shared/library/sharedNetwork/src/shared/Service.cpp @@ -186,8 +186,8 @@ Service::~Service() delete m_callback; connections.clear(); - connectionAllocator = NULL; - m_callback = NULL; + connectionAllocator = nullptr; + m_callback = nullptr; delete m_tcpServer; } diff --git a/engine/shared/library/sharedNetworkMessages/src/shared/core/SetupSharedNetworkMessages.cpp b/engine/shared/library/sharedNetworkMessages/src/shared/core/SetupSharedNetworkMessages.cpp index e92dd770..134b7a9b 100755 --- a/engine/shared/library/sharedNetworkMessages/src/shared/core/SetupSharedNetworkMessages.cpp +++ b/engine/shared/library/sharedNetworkMessages/src/shared/core/SetupSharedNetworkMessages.cpp @@ -137,7 +137,7 @@ namespace SetupSharedNetworkMessagesNamespace MessageQueue::Data* unpackNothing(Archive::ReadIterator &) { - return NULL; + return nullptr; } void packGenericShipDamageMessage(const MessageQueue::Data * data, Archive::ByteStream & target) diff --git a/engine/shared/library/sharedObject/src/shared/ObjectWatcherList.cpp b/engine/shared/library/sharedObject/src/shared/ObjectWatcherList.cpp index a2cb6e67..fdfb4afa 100755 --- a/engine/shared/library/sharedObject/src/shared/ObjectWatcherList.cpp +++ b/engine/shared/library/sharedObject/src/shared/ObjectWatcherList.cpp @@ -23,7 +23,7 @@ namespace ObjectWatcherListNamespace { void setRegionOfInfluenceEnabled(Object const * const object, bool const enabled, bool skipCell) { - if (skipCell && NULL != object->getCellProperty()) + if (skipCell && nullptr != object->getCellProperty()) return; object->setRegionOfInfluenceEnabled(enabled); @@ -67,7 +67,7 @@ ObjectWatcherList::~ObjectWatcherList(void) /** * Add an Object to the ObjectWatcherList. * - * This routine will call Fatal in debug compiles if it is passed a NULL + * This routine will call Fatal in debug compiles if it is passed a nullptr * object. * * This routine will call Fatal in debug compiles if the object list @@ -85,7 +85,7 @@ void ObjectWatcherList::addObject(Object & objectToAdd) /** * Remove an Object from the ObjectWatcherList. * - * This routine will call Fatal in debug compiles if it is passed a NULL + * This routine will call Fatal in debug compiles if it is passed a nullptr * object. * * @param objectToRemove Pointer to the object to remove @@ -112,13 +112,13 @@ void ObjectWatcherList::removeObjectByIndex (const Object & object, int index) // Remove the last item in the vector. m_objectVector->pop_back(); - // NULL the object from the alter-safe object list. + // nullptr the object from the alter-safe object list. uint size = m_alterSafeObjectVector->size(); for (uint i = 0; i < size; ++i) { if ((*m_alterSafeObjectVector)[i] == &object) { - (*m_alterSafeObjectVector)[i] = NULL; + (*m_alterSafeObjectVector)[i] = nullptr; return; } } @@ -232,7 +232,7 @@ void ObjectWatcherList::alter(real time) // Make sure the object is still in the object list before removing it - if ((*m_alterSafeObjectVector)[i] != NULL) + if ((*m_alterSafeObjectVector)[i] != nullptr) { removeObject(*obj); } diff --git a/engine/shared/library/sharedObject/src/shared/appearance/Appearance.cpp b/engine/shared/library/sharedObject/src/shared/appearance/Appearance.cpp index e1acba39..f899e042 100755 --- a/engine/shared/library/sharedObject/src/shared/appearance/Appearance.cpp +++ b/engine/shared/library/sharedObject/src/shared/appearance/Appearance.cpp @@ -80,8 +80,8 @@ void Appearance::setRenderHardpointFunction(RenderHardpointFunction renderHardpo Appearance::Appearance(const AppearanceTemplate *newAppearanceTemplate) : m_appearanceTemplate(AppearanceTemplateList::fetch(newAppearanceTemplate)), - m_extent(m_appearanceTemplate ? ExtentList::fetch(m_appearanceTemplate->getExtent()) : NULL), - m_owner(NULL), + m_extent(m_appearanceTemplate ? ExtentList::fetch(m_appearanceTemplate->getExtent()) : nullptr), + m_owner(nullptr), m_renderedFrameNumber(0), m_scale(Vector::xyz111), m_keepAlive(false), @@ -100,15 +100,15 @@ Appearance::Appearance(const AppearanceTemplate *newAppearanceTemplate) : Appearance::~Appearance() { ExtentList::release(m_extent); - m_extent = NULL; + m_extent = nullptr; if (m_appearanceTemplate) { AppearanceTemplateList::release(m_appearanceTemplate); - m_appearanceTemplate = NULL; + m_appearanceTemplate = nullptr; } - m_owner = NULL; + m_owner = nullptr; } // ---------------------------------------------------------------------- @@ -269,7 +269,7 @@ void Appearance::render() const void Appearance::objectListCameraRenderDescend(Object const & obj) { //-- don't descend through cells - if (NULL != obj.getCellProperty()) + if (nullptr != obj.getCellProperty()) return; int const childCount = obj.getNumberOfChildObjects(); @@ -378,7 +378,7 @@ bool Appearance::implementsCollide() const * CustomizationDataProperty. If there is such a property, this * function will invoke Appearance::setCustomizationData() with the * appropriate value. If the property doesn't exist, this function - * will invoke Appearance::setCustomizationData() with NULL. Note if + * will invoke Appearance::setCustomizationData() with nullptr. Note if * the caller sets the CustomizationDataProperty for an Object after * associating the Object instance with the appearance, the caller is * responsible for calling Appearance::setCustomizationData(). @@ -457,7 +457,7 @@ const char * Appearance::getFloorName () const if (m_appearanceTemplate) return m_appearanceTemplate->getFloorName(); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -607,7 +607,7 @@ const char * Appearance::getAppearanceTemplateName () const DPVS::Object *Appearance::getDpvsObject() const { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -748,14 +748,14 @@ SkeletalAppearance2 const * Appearance::asSkeletalAppearance2() const ComponentAppearance * Appearance::asComponentAppearance() { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- ComponentAppearance const * Appearance::asComponentAppearance() const { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -783,14 +783,14 @@ void Appearance::onEvent(LabelHash::Id /* eventId */) int Appearance::getHardpointCount() const { - return m_appearanceTemplate != NULL ? m_appearanceTemplate->getHardpointCount() : 0; + return m_appearanceTemplate != nullptr ? m_appearanceTemplate->getHardpointCount() : 0; } // ---------------------------------------------------------------------- int Appearance::getHardpointIndex(CrcString const &hardpointName, bool optional) const { - return m_appearanceTemplate != NULL ? m_appearanceTemplate->getHardpointIndex(hardpointName, optional) : -1; + return m_appearanceTemplate != nullptr ? m_appearanceTemplate->getHardpointIndex(hardpointName, optional) : -1; } // ---------------------------------------------------------------------- @@ -855,42 +855,42 @@ bool Appearance::usesRenderEffectsFlag() const ParticleEffectAppearance * Appearance::asParticleEffectAppearance() { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- ParticleEffectAppearance const * Appearance::asParticleEffectAppearance() const { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- SwooshAppearance * Appearance::asSwooshAppearance() { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- SwooshAppearance const * Appearance::asSwooshAppearance() const { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- LightningAppearance * Appearance::asLightningAppearance() { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- LightningAppearance const * Appearance::asLightningAppearance() const { - return NULL; + return nullptr; } // ====================================================================== diff --git a/engine/shared/library/sharedObject/src/shared/appearance/Appearance.h b/engine/shared/library/sharedObject/src/shared/appearance/Appearance.h index 13b49530..4a7bd5cf 100755 --- a/engine/shared/library/sharedObject/src/shared/appearance/Appearance.h +++ b/engine/shared/library/sharedObject/src/shared/appearance/Appearance.h @@ -206,7 +206,7 @@ private: /** * Get the AppearanceTemplate for this Appearance. * - * The AppearanceTemplate may be NULL. + * The AppearanceTemplate may be nullptr. * * AppearanceTemplates may be shared by multiple Appearances. * diff --git a/engine/shared/library/sharedObject/src/shared/appearance/AppearanceTemplate.cpp b/engine/shared/library/sharedObject/src/shared/appearance/AppearanceTemplate.cpp index 89f44831..0975380d 100755 --- a/engine/shared/library/sharedObject/src/shared/appearance/AppearanceTemplate.cpp +++ b/engine/shared/library/sharedObject/src/shared/appearance/AppearanceTemplate.cpp @@ -97,14 +97,14 @@ AppearanceTemplate::PreloadManager::~PreloadManager () AppearanceTemplate::AppearanceTemplate(const char *newName) : m_referenceCount(0), m_crcName(new CrcLowerString(newName)), - m_extent(NULL), - m_collisionExtent(NULL), - m_hardpoints(NULL), - m_floorName(NULL), + m_extent(nullptr), + m_collisionExtent(nullptr), + m_hardpoints(nullptr), + m_floorName(nullptr), m_preloadManager (0) { //-- Save info on most recently constructed appearance template. - IGNORE_RETURN(snprintf(ms_crashReportInfo, sizeof(ms_crashReportInfo) - 1, "AppearanceTemplate: %s\n", newName ? newName : "")); + IGNORE_RETURN(snprintf(ms_crashReportInfo, sizeof(ms_crashReportInfo) - 1, "AppearanceTemplate: %s\n", newName ? newName : "")); ms_crashReportInfo[sizeof(ms_crashReportInfo) - 1] = '\0'; } @@ -118,10 +118,10 @@ AppearanceTemplate::~AppearanceTemplate(void) delete m_crcName; ExtentList::release(m_extent); - m_extent = NULL; + m_extent = nullptr; ExtentList::release(m_collisionExtent); - m_collisionExtent = NULL; + m_collisionExtent = nullptr; if (m_hardpoints) { @@ -482,7 +482,7 @@ const CrcLowerString &AppearanceTemplate::getCrcName() const /** *Get the name of this AppearanceTemplate. * - *This routine may return NULL. + *This routine may return nullptr. */ const char *AppearanceTemplate::getName() const diff --git a/engine/shared/library/sharedObject/src/shared/appearance/AppearanceTemplateList.cpp b/engine/shared/library/sharedObject/src/shared/appearance/AppearanceTemplateList.cpp index 37439f23..d2afe802 100755 --- a/engine/shared/library/sharedObject/src/shared/appearance/AppearanceTemplateList.cpp +++ b/engine/shared/library/sharedObject/src/shared/appearance/AppearanceTemplateList.cpp @@ -219,7 +219,7 @@ const AppearanceTemplate *AppearanceTemplateList::fetch(const char *const fileNa char const * actualFileName = fileName; if (!fileName) { - DEBUG_WARNING(true, ("AppearanceTemplateList::fetch passed NULL fileName, using default")); + DEBUG_WARNING(true, ("AppearanceTemplateList::fetch passed nullptr fileName, using default")); actualFileName = getDefaultAppearanceTemplateName(); } else if (!*fileName) @@ -246,14 +246,14 @@ const AppearanceTemplate *AppearanceTemplateList::fetch(const char *const fileNa DEBUG_WARNING(true, ("AppearanceTemplateList::fetch actualFileName fetch for %s failed.", actualFileName)); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- /** * Add a reference to the specified Appearance. * - * This routine will do nothing if passed in NULL. Otherwise, it will + * This routine will do nothing if passed in nullptr. Otherwise, it will * increase the reference count of the specified AppearanceTemplate * by one. * @@ -297,7 +297,7 @@ const AppearanceTemplate *AppearanceTemplateList::fetch(Iff *const iff) return 0; //lint !e527 // unreachable } - AppearanceTemplate *const appearanceTemplate = (*iter).second(NULL, iff); + AppearanceTemplate *const appearanceTemplate = (*iter).second(nullptr, iff); NOT_NULL(appearanceTemplate); addAnonymousAppearanceTemplate(appearanceTemplate); @@ -351,7 +351,7 @@ const AppearanceTemplate *AppearanceTemplateList::fetchNew(AppearanceTemplate *c /** * Remove a reference to the specified AppearanceTemplate. * - * This routine will do nothing if passed in NULL. + * This routine will do nothing if passed in nullptr. * * If the reference count drops to 0, the AppearanceTemplate will be deleted. * @@ -404,9 +404,9 @@ Appearance *AppearanceTemplateList::createAppearance(const char *const fileName) #endif //probably should modify the macro sometime to just be quiet if this isn't defined - if (appearanceTemplate == NULL){ + if (appearanceTemplate == nullptr){ DEBUG_WARNING(true, ("FIX ME: Appearance template for %s could not be fetched - is it missing?", fileName)); - return NULL; // Cekis: TODO: Figure out why the template can't be fetched. DarthArgus: always is due to a missing file or one of the redirectors having a bad path + return nullptr; // Cekis: TODO: Figure out why the template can't be fetched. DarthArgus: always is due to a missing file or one of the redirectors having a bad path } //-- creating the appearance will increment the reference count @@ -581,7 +581,7 @@ AppearanceTemplate *AppearanceTemplateListNamespace::create(const char *const fi // DEBUG_REPORT_LOG_PRINT(true, ("Loading mesh %s\n", actualFileName.getString())); TagBindingMap::iterator iter = ms_tagBindingMap.find(TAG_MESH); if (iter != ms_tagBindingMap.end()) - appearanceTemplate = iter->second(actualFileName.getString(), NULL); + appearanceTemplate = iter->second(actualFileName.getString(), nullptr); } //-- we now need to create the appearance from disk diff --git a/engine/shared/library/sharedObject/src/shared/container/ArrangementDescriptorList.cpp b/engine/shared/library/sharedObject/src/shared/container/ArrangementDescriptorList.cpp index 31de898d..ddc27d42 100755 --- a/engine/shared/library/sharedObject/src/shared/container/ArrangementDescriptorList.cpp +++ b/engine/shared/library/sharedObject/src/shared/container/ArrangementDescriptorList.cpp @@ -69,7 +69,7 @@ const ArrangementDescriptor *ArrangementDescriptorList::fetch(const CrcLowerStri } else { - WARNING(true, ("default ArrangementDescriptor [%s] could not be loaded, returning NULL ArrangementDescriptor", filename.getString())); + WARNING(true, ("default ArrangementDescriptor [%s] could not be loaded, returning nullptr ArrangementDescriptor", filename.getString())); return 0; } } diff --git a/engine/shared/library/sharedObject/src/shared/container/ContainedByProperty.cpp b/engine/shared/library/sharedObject/src/shared/container/ContainedByProperty.cpp index 1a25f0cd..74494ba9 100755 --- a/engine/shared/library/sharedObject/src/shared/container/ContainedByProperty.cpp +++ b/engine/shared/library/sharedObject/src/shared/container/ContainedByProperty.cpp @@ -49,7 +49,7 @@ ContainedByProperty::~ContainedByProperty() * property. * * @return Pointer to the object that contains the object with this - * ContainedByProperty. Returns NULL if the object isn't + * ContainedByProperty. Returns nullptr if the object isn't * contained by anything at the moment. */ diff --git a/engine/shared/library/sharedObject/src/shared/container/Container.cpp b/engine/shared/library/sharedObject/src/shared/container/Container.cpp index b85e8f1f..66e9e9f4 100755 --- a/engine/shared/library/sharedObject/src/shared/container/Container.cpp +++ b/engine/shared/library/sharedObject/src/shared/container/Container.cpp @@ -21,13 +21,13 @@ // ====================================================================== //Lint suppressions. -//lint -esym(613, ContainerIterator::m_iterator) // (Warning -- Possible use of null pointer 'ContainerIterator::m_iterator' ) // This is an opaque data type to us. We can only check against a container::end(). +//lint -esym(613, ContainerIterator::m_iterator) // (Warning -- Possible use of nullptr pointer 'ContainerIterator::m_iterator' ) // This is an opaque data type to us. We can only check against a container::end(). //lint -esym(1540, ContainerIterator::m_iterator) // (Warning -- Pointer member 'ContainerIterator::m_iterator' neither freed nor zero'ed by destructor -- Effective C++ #6) // It's okay, the iterator type is opaque to us, we have no idea it's a pointer. //lint -esym(1554, ContainerIterator::m_iterator) // (Warning -- Direct copy of pointer 'ContainerIterator::m_iterator'. // It's okay, the iterator type is opaque to us, we have no idea it's a pointer. //lint -esym(1555, ContainerIterator::m_iterator) // (Warning -- Direct pointer copy of member 'ContainerIterator::m_iterator' within copy assignment operator: 'ContainerIterator::operator=(const ContainerIterator &) // Opaque type, we don't know its a pointer. //lint -esym(1555, ContainerIterator::m_owner) // (Warning -- Direct pointer copy of member 'ContainerIterator::m_owner' within copy assignment operator: 'ContainerIterator::operator=(const ContainerIterator &) // We do not own this memory, so it's okay to overwrite the pointer. We can't leak it. -//lint -esym(613, ContainerConstIterator::m_iterator) // (Warning -- Possible use of null pointer 'ContainerConstIterator::m_iterator' ) // This is an opaque data type to us. We can only check against a container::end(). +//lint -esym(613, ContainerConstIterator::m_iterator) // (Warning -- Possible use of nullptr pointer 'ContainerConstIterator::m_iterator' ) // This is an opaque data type to us. We can only check against a container::end(). //lint -esym(1540, ContainerConstIterator::m_iterator) // (Warning -- Pointer member 'ContainerConstIterator::m_iterator' neither freed nor zero'ed by destructor -- Effective C++ #6) // It's okay, the iterator type is opaque to us, we have no idea it's a pointer. //lint -esym(1554, ContainerConstIterator::m_iterator) // (Warning -- Direct copy of pointer 'ContainerConstIterator::m_iterator'. // It's okay, the iterator type is opaque to us, we have no idea it's a pointer. //lint -esym(1555, ContainerConstIterator::m_iterator) // (Warning -- Direct pointer copy of member 'ContainerConstIterator::m_iterator' within copy assignment operator: 'ContainerConstIterator::operator=(const ContainerConstIterator &) // Opaque type, we don't know its a pointer. @@ -108,7 +108,7 @@ ContainerIterator & ContainerIterator::operator= (const ContainerIterator & rhs) CachedNetworkId & ContainerIterator::operator*() { // @todo fix this interface -- it is broken. It is possible to - // construct a ContainerIterator with a NULL m_iterator, but there is + // construct a ContainerIterator with a nullptr m_iterator, but there is // no way to gracefully exit from this function since it requires a non-const // reference. Otherwise I would return CachedNetworkId::cms_cachedIvalid. NOT_NULL(m_owner); @@ -197,7 +197,7 @@ ContainerConstIterator & ContainerConstIterator::operator= (const ContainerConst const CachedNetworkId & ContainerConstIterator::operator*() const { // @todo fix this interface -- it is broken. It is possible to - // construct a ContainerIterator with a NULL m_iterator, but there is + // construct a ContainerIterator with a nullptr m_iterator, but there is // no way to gracefully exit from this function since it requires a non-const // reference. Otherwise I would return CachedNetworkId::cms_cachedIvalid. NOT_NULL(m_owner); @@ -677,7 +677,7 @@ void Container::debugPrint(std::string &buffer) const { Object const *const object = it->getObject(); - sprintf(tempBuffer, "\tindex [%d]: object id [%s], template [%s]\n", index, it->getValueString().c_str(), object ? object->getObjectTemplateName() : ""); + sprintf(tempBuffer, "\tindex [%d]: object id [%s], template [%s]\n", index, it->getValueString().c_str(), object ? object->getObjectTemplateName() : ""); buffer += tempBuffer; } @@ -699,7 +699,7 @@ void Container::debugLog() const for (Contents::const_iterator it = m_contents.begin(); it != endIt; ++it, ++index) { Object const *const object = it->getObject(); - DEBUG_REPORT_LOG(true, ("\tindex [%d]: object id [%s], template [%s]\n", index, it->getValueString().c_str(), object ? object->getObjectTemplateName() : "")); + DEBUG_REPORT_LOG(true, ("\tindex [%d]: object id [%s], template [%s]\n", index, it->getValueString().c_str(), object ? object->getObjectTemplateName() : "")); } DEBUG_REPORT_LOG(true, ("====[END: container]====\n")); diff --git a/engine/shared/library/sharedObject/src/shared/container/SlotIdManager.cpp b/engine/shared/library/sharedObject/src/shared/container/SlotIdManager.cpp index 9aea59ef..70b6b34d 100755 --- a/engine/shared/library/sharedObject/src/shared/container/SlotIdManager.cpp +++ b/engine/shared/library/sharedObject/src/shared/container/SlotIdManager.cpp @@ -351,7 +351,7 @@ bool SlotIdManager::isSlotPlayerModifiable(const SlotId &slotId) * * If the slot can have something put in it that directly affects what you * see on the client, this will return true. If this returns false, - * getSlotHardpointName() will return a NULL string. + * getSlotHardpointName() will return a nullptr string. * * @param slotId a SlotId instance for the slot under question. * @@ -381,9 +381,9 @@ bool SlotIdManager::isSlotAppearanceRelated(const SlotId &slotId) * * The caller should check the result of isSlotAppearanceRelated() before * calling this function. If the slot is not appearance related, this function - * will always return NULL. Also, if the SlotIdManager is installed such that + * will always return nullptr. Also, if the SlotIdManager is installed such that * hardpoint names are not loaded (currently the server is loaded this way), - * the specified hardpoint name will return NULL. + * the specified hardpoint name will return nullptr. * * @param slotId a SlotId instance for the slot under question. * diff --git a/engine/shared/library/sharedObject/src/shared/container/SlottedContainer.cpp b/engine/shared/library/sharedObject/src/shared/container/SlottedContainer.cpp index b97b1a24..98b85e82 100755 --- a/engine/shared/library/sharedObject/src/shared/container/SlottedContainer.cpp +++ b/engine/shared/library/sharedObject/src/shared/container/SlottedContainer.cpp @@ -49,7 +49,7 @@ SlottedContainer::~SlottedContainer() if (m_slotMap) { delete m_slotMap; - m_slotMap = NULL; + m_slotMap = nullptr; } } diff --git a/engine/shared/library/sharedObject/src/shared/container/VolumeContainer.cpp b/engine/shared/library/sharedObject/src/shared/container/VolumeContainer.cpp index 02433163..fe716109 100755 --- a/engine/shared/library/sharedObject/src/shared/container/VolumeContainer.cpp +++ b/engine/shared/library/sharedObject/src/shared/container/VolumeContainer.cpp @@ -36,7 +36,7 @@ namespace VolumeContainerNamespace return parent->getVolumeContainerProperty(); } } - return NULL; + return nullptr; } const VolumeContainer* getVolumeContainerParent(const VolumeContainer& self) @@ -51,7 +51,7 @@ namespace VolumeContainerNamespace return parent->getVolumeContainerProperty(); } } - return NULL; + return nullptr; } const unsigned int serverHolocronCrc = CrcLowerString::calculateCrc("object/player_quest/pgc_quest_holocron.iff"); diff --git a/engine/shared/library/sharedObject/src/shared/container/VolumeContainer.h b/engine/shared/library/sharedObject/src/shared/container/VolumeContainer.h index 922154f7..f99766dc 100755 --- a/engine/shared/library/sharedObject/src/shared/container/VolumeContainer.h +++ b/engine/shared/library/sharedObject/src/shared/container/VolumeContainer.h @@ -69,8 +69,8 @@ public: private: bool checkVolume(const VolumeContainmentProperty &item) const; - bool internalRemove(const Object & item, const VolumeContainmentProperty *itemProp = NULL); - void insertNewItem(const Object & item, const VolumeContainmentProperty *itemProp = NULL); + bool internalRemove(const Object & item, const VolumeContainmentProperty *itemProp = nullptr); + void insertNewItem(const Object & item, const VolumeContainmentProperty *itemProp = nullptr); void childVolumeChanged(int volume, bool updateParent); diff --git a/engine/shared/library/sharedObject/src/shared/controller/Controller.cpp b/engine/shared/library/sharedObject/src/shared/controller/Controller.cpp index 66572a6a..2483e64b 100755 --- a/engine/shared/library/sharedObject/src/shared/controller/Controller.cpp +++ b/engine/shared/library/sharedObject/src/shared/controller/Controller.cpp @@ -88,7 +88,7 @@ MessageQueue::Data* Controller::peekHeldMessage( int message, float *value, uint { HeldMessageMap::iterator iter = m_heldMessages.find( message ); if ( iter == m_heldMessages.end() ) - return NULL; + return nullptr; if ( value ) *value = iter->second.value; if ( flags ) @@ -216,42 +216,42 @@ MessageQueue * Controller::getMessageQueue() TangibleController * Controller::asTangibleController() { - return NULL; + return nullptr; } //---------------------------------------------------------------------- TangibleController const * Controller::asTangibleController() const { - return NULL; + return nullptr; } //---------------------------------------------------------------------- CreatureController * Controller::asCreatureController() { - return NULL; + return nullptr; } //---------------------------------------------------------------------- CreatureController const * Controller::asCreatureController() const { - return NULL; + return nullptr; } //---------------------------------------------------------------------- ShipController * Controller::asShipController() { - return NULL; + return nullptr; } //---------------------------------------------------------------------- ShipController const * Controller::asShipController() const { - return NULL; + return nullptr; } // ====================================================================== diff --git a/engine/shared/library/sharedObject/src/shared/core/SetupSharedObject.cpp b/engine/shared/library/sharedObject/src/shared/core/SetupSharedObject.cpp index 69799beb..d25d9be1 100755 --- a/engine/shared/library/sharedObject/src/shared/core/SetupSharedObject.cpp +++ b/engine/shared/library/sharedObject/src/shared/core/SetupSharedObject.cpp @@ -55,7 +55,7 @@ SetupSharedObject::Data::Data() customizationIdManagerFilename(0), objectsAlterChildrenAndContents(true), loadObjectTemplateCrcStringTable(true), - pobEjectionTransformFilename(NULL) + pobEjectionTransformFilename(nullptr) { } diff --git a/engine/shared/library/sharedObject/src/shared/core/SetupSharedObject.h b/engine/shared/library/sharedObject/src/shared/core/SetupSharedObject.h index dd38e215..ce43740e 100755 --- a/engine/shared/library/sharedObject/src/shared/core/SetupSharedObject.h +++ b/engine/shared/library/sharedObject/src/shared/core/SetupSharedObject.h @@ -70,7 +70,7 @@ public: // Specifies whether or not ObjectTemplateList should load the object template crc table bool loadObjectTemplateCrcStringTable; - // Specifies the name of the POB ejection point transform override filename to use; use NULL (default) if no ejection point support. + // Specifies the name of the POB ejection point transform override filename to use; use nullptr (default) if no ejection point support. char const *pobEjectionTransformFilename; private: diff --git a/engine/shared/library/sharedObject/src/shared/customization/CustomizationData.cpp b/engine/shared/library/sharedObject/src/shared/customization/CustomizationData.cpp index e27808f2..a05ed186 100755 --- a/engine/shared/library/sharedObject/src/shared/customization/CustomizationData.cpp +++ b/engine/shared/library/sharedObject/src/shared/customization/CustomizationData.cpp @@ -277,10 +277,10 @@ CustomizationData::CustomizationData(Object &owner) : void CustomizationData::addVariableTakeOwnership(const std::string &fullVariablePathName, CustomizationVariable *variable) { - //-- check for null variable + //-- check for nullptr variable if (!variable) { - WARNING(true, ("addVariableTakeOwnership() called with null variable.\n")); + WARNING(true, ("addVariableTakeOwnership() called with nullptr variable.\n")); return; } @@ -591,7 +591,7 @@ std::string CustomizationData::writeLocalDataToString() const saveToByteVector(binaryData); - //-- Convert binary data to string. We're escaping the 0 for the database so this is a non-null string. + //-- Convert binary data to string. We're escaping the 0 for the database so this is a non-nullptr string. // We translate 0x00 => 0xff 0x01 // 0xff => 0xff 0x02 std::string returnValue; @@ -1139,7 +1139,7 @@ void CustomizationData::notifyPendingRemoteDestruction(const CustomizationData * //-- validate arg if (!customizationData) { - DEBUG_WARNING(true, ("notifyPendingRemoteDestruction(): customizationData arg is null")); + DEBUG_WARNING(true, ("notifyPendingRemoteDestruction(): customizationData arg is nullptr")); return; } diff --git a/engine/shared/library/sharedObject/src/shared/customization/CustomizationData_LocalDirectory.cpp b/engine/shared/library/sharedObject/src/shared/customization/CustomizationData_LocalDirectory.cpp index 3a8422cb..1a12a2fd 100755 --- a/engine/shared/library/sharedObject/src/shared/customization/CustomizationData_LocalDirectory.cpp +++ b/engine/shared/library/sharedObject/src/shared/customization/CustomizationData_LocalDirectory.cpp @@ -95,7 +95,7 @@ bool CustomizationData::LocalDirectory::resolvePathNameToDirectory(const std::st //-- ensure we've got a directory if (!subdir) { - WARNING(true, ("resolvePathNameToDirectory(): logic failure, subdir is null")); + WARNING(true, ("resolvePathNameToDirectory(): logic failure, subdir is nullptr")); return false; } @@ -110,7 +110,7 @@ bool CustomizationData::LocalDirectory::addVariableTakeOwnership(const std::stri //-- ensure caller passed in valid customizationVariable if (!variable) { - WARNING(true, ("addVariableTakeOwnership(): caller passed in NULL variable")); + WARNING(true, ("addVariableTakeOwnership(): caller passed in nullptr variable")); return false; } @@ -210,10 +210,10 @@ CustomizationData::Directory *CustomizationData::LocalDirectory::findDirectory(c void CustomizationData::LocalDirectory::deleteDirectory(Directory *childDirectory) { - //-- check for null directory + //-- check for nullptr directory if (!childDirectory) { - WARNING(true, ("deleteDirectory(): NULL childDirectory arg")); + WARNING(true, ("deleteDirectory(): nullptr childDirectory arg")); return; } @@ -255,10 +255,10 @@ void CustomizationData::LocalDirectory::iterateOverConstVariables(const std::str const DirectoryMap::const_iterator endIt = m_directories.end(); for (DirectoryMap::const_iterator it = m_directories.begin(); it != endIt; ++it) { - //-- check for null directory pointer (shouldn't happen but shouldn't FATAL) + //-- check for nullptr directory pointer (shouldn't happen but shouldn't FATAL) if (!it->second) { - WARNING(true, ("iterateOverConstVariables(): directory 0x%08x has null child directory for [%s].", this, it->first.getString())); + WARNING(true, ("iterateOverConstVariables(): directory 0x%08x has nullptr child directory for [%s].", this, it->first.getString())); return; } @@ -292,10 +292,10 @@ void CustomizationData::LocalDirectory::iterateOverVariables(const std::string & const DirectoryMap::iterator endIt = m_directories.end(); for (DirectoryMap::iterator it = m_directories.begin(); it != endIt; ++it) { - //-- check for null directory pointer (shouldn't happen but shouldn't FATAL) + //-- check for nullptr directory pointer (shouldn't happen but shouldn't FATAL) if (!it->second) { - WARNING(true, ("iterateOverConstVariables(): directory 0x%08x has null child directory for [%s].", this, it->first.getString())); + WARNING(true, ("iterateOverConstVariables(): directory 0x%08x has nullptr child directory for [%s].", this, it->first.getString())); return; } @@ -314,10 +314,10 @@ void CustomizationData::LocalDirectory::iterateOverVariables(const std::string & void CustomizationData::LocalDirectory::replaceOrAddDirectory(const std::string &directoryPathName, int directoryNameStartIndex, Directory *directory) { - //-- ensure attached directory is not null + //-- ensure attached directory is not nullptr if (!directory) { - WARNING(true, ("replaceOrAddDirectory(): directory arg is NULL")); + WARNING(true, ("replaceOrAddDirectory(): directory arg is nullptr")); return; } @@ -411,7 +411,7 @@ std::string CustomizationData::LocalDirectory::writeLocalDirectoryToString() con const CustomizationVariableMap::const_iterator endIt = m_variables.end(); for (CustomizationVariableMap::const_iterator it = m_variables.begin(); it != endIt; ++it) { - //-- verify it's a non-null variable + //-- verify it's a non-nullptr variable const CustomizationVariable *const variable = it->second; if (variable && variable->doesVariablePersist()) { @@ -430,11 +430,11 @@ std::string CustomizationData::LocalDirectory::writeLocalDirectoryToString() con const CustomizationVariableMap::const_iterator endIt = m_variables.end(); for (CustomizationVariableMap::const_iterator it = m_variables.begin(); it != endIt; ++it) { - //-- verify it's a non-null variable + //-- verify it's a non-nullptr variable const CustomizationVariable *const variable = it->second; if (!variable) { - WARNING(true, ("writeLocalDirectoryToString: NULL variable for [%s], skipping variable writing.")); + WARNING(true, ("writeLocalDirectoryToString: nullptr variable for [%s], skipping variable writing.")); continue; } diff --git a/engine/shared/library/sharedObject/src/shared/customization/CustomizationIdManager.cpp b/engine/shared/library/sharedObject/src/shared/customization/CustomizationIdManager.cpp index 32208e24..b21696d4 100755 --- a/engine/shared/library/sharedObject/src/shared/customization/CustomizationIdManager.cpp +++ b/engine/shared/library/sharedObject/src/shared/customization/CustomizationIdManager.cpp @@ -189,7 +189,7 @@ bool CustomizationIdManager::mapIdToString(int id, char *variableName, int buffe NOT_NULL(variableName); DEBUG_FATAL(bufferLength < 1, ("CustomizationIdManager: bufferLength of [%d] too small to hold anything.", bufferLength)); - //-- Copy variable name to user buffer, ensure it gets NULL terminated. + //-- Copy variable name to user buffer, ensure it gets nullptr terminated. strncpy(variableName, NON_NULL(s_idToVariableName[static_cast(id)])->getString(), static_cast(bufferLength - 1)); variableName[bufferLength - 1] = '\0'; diff --git a/engine/shared/library/sharedObject/src/shared/customization/ObjectTemplateCustomizationDataWriter.cpp b/engine/shared/library/sharedObject/src/shared/customization/ObjectTemplateCustomizationDataWriter.cpp index a02bf9d0..3e18e9a9 100755 --- a/engine/shared/library/sharedObject/src/shared/customization/ObjectTemplateCustomizationDataWriter.cpp +++ b/engine/shared/library/sharedObject/src/shared/customization/ObjectTemplateCustomizationDataWriter.cpp @@ -149,7 +149,7 @@ bool ObjectTemplateCustomizationDataWriter::writeToFile(const std::string &pathN if (!allowOverwrite) { FILE *const testFile = fopen(pathName.c_str(), "r"); - if (testFile != NULL) + if (testFile != nullptr) { fclose(testFile); DEBUG_REPORT_LOG(true, ("writeToFile(): overwrite attempt: skipped writing [%s] because it already exists and allowOverwrite == false.\n", pathName.c_str())); diff --git a/engine/shared/library/sharedObject/src/shared/lot/LotManager.cpp b/engine/shared/library/sharedObject/src/shared/lot/LotManager.cpp index eb5ee6bf..6d379528 100755 --- a/engine/shared/library/sharedObject/src/shared/lot/LotManager.cpp +++ b/engine/shared/library/sharedObject/src/shared/lot/LotManager.cpp @@ -129,7 +129,7 @@ void LotManager::addNoBuildEntry (Object const & object, float const noBuildRadi bool const result = m_noBuildEntryMap->insert (std::make_pair (&object, noBuildEntry)).second; UNREF (result); DEBUG_FATAL (!result, ("LotManager::addNoBuildEntry - entry already exists")); - DEBUG_REPORT_LOG (ms_logEntries, ("LotManager: added no build entry for object %s [%s] at <%1.2f, %1.2f>\n", object.getNetworkId ().getValueString ().c_str (), object.getObjectTemplateName () ? object.getObjectTemplateName () : "null", position_w.x, position_w.z)); + DEBUG_REPORT_LOG (ms_logEntries, ("LotManager: added no build entry for object %s [%s] at <%1.2f, %1.2f>\n", object.getNetworkId ().getValueString ().c_str (), object.getObjectTemplateName () ? object.getObjectTemplateName () : "nullptr", position_w.x, position_w.z)); } //------------------------------------------------------------------- @@ -150,7 +150,7 @@ void LotManager::removeNoBuildEntry (const Object& object) else DEBUG_FATAL (true, ("LotManager::removeNoBuildEntry - entry not found")); - DEBUG_REPORT_LOG (ms_logEntries, ("LotManager: removed no build entry for object %s [%s]\n", object.getNetworkId ().getValueString ().c_str (), object.getObjectTemplateName () ? object.getObjectTemplateName () : "null")); + DEBUG_REPORT_LOG (ms_logEntries, ("LotManager: removed no build entry for object %s [%s]\n", object.getNetworkId ().getValueString ().c_str (), object.getObjectTemplateName () ? object.getObjectTemplateName () : "nullptr")); } //------------------------------------------------------------------- @@ -177,7 +177,7 @@ void LotManager::addStructureFootprintEntry (const Object& object, const Structu UNREF (result); DEBUG_FATAL (!result, ("LotManager::addStructureFootprintEntry - entry already exists")); - DEBUG_REPORT_LOG (ms_logEntries, ("LotManager: added structure footprint entry for object %s [%s] at <%1.2f, %1.2f>\n", object.getNetworkId ().getValueString ().c_str (), object.getObjectTemplateName () ? object.getObjectTemplateName () : "null", x * m_chunkWidthInMeters + m_chunkWidthInMeters * 0.5f, z * m_chunkWidthInMeters + m_chunkWidthInMeters * 0.5f)); + DEBUG_REPORT_LOG (ms_logEntries, ("LotManager: added structure footprint entry for object %s [%s] at <%1.2f, %1.2f>\n", object.getNetworkId ().getValueString ().c_str (), object.getObjectTemplateName () ? object.getObjectTemplateName () : "nullptr", x * m_chunkWidthInMeters + m_chunkWidthInMeters * 0.5f, z * m_chunkWidthInMeters + m_chunkWidthInMeters * 0.5f)); } //------------------------------------------------------------------- @@ -191,7 +191,7 @@ void LotManager::removeStructureFootprintEntry (const Object& object) else DEBUG_FATAL (true, ("LotManager::removeStructureFootprintEntry - entry not found")); - DEBUG_REPORT_LOG (ms_logEntries, ("LotManager: removed structure footprint entry for object %s [%s]\n", object.getNetworkId ().getValueString ().c_str (), object.getObjectTemplateName () ? object.getObjectTemplateName () : "null")); + DEBUG_REPORT_LOG (ms_logEntries, ("LotManager: removed structure footprint entry for object %s [%s]\n", object.getNetworkId ().getValueString ().c_str (), object.getObjectTemplateName () ? object.getObjectTemplateName () : "nullptr")); } //------------------------------------------------------------------- diff --git a/engine/shared/library/sharedObject/src/shared/object/AlterScheduler.cpp b/engine/shared/library/sharedObject/src/shared/object/AlterScheduler.cpp index e09b9c37..dc2a932c 100755 --- a/engine/shared/library/sharedObject/src/shared/object/AlterScheduler.cpp +++ b/engine/shared/library/sharedObject/src/shared/object/AlterScheduler.cpp @@ -277,13 +277,13 @@ void AlterSchedulerNamespace::reportPrint() // ---------------------------------------------------------------------- /** - * NULL objects are not considered valid by this function. Do not call this on a NULL + * nullptr objects are not considered valid by this function. Do not call this on a nullptr * object if that happens to be valid in the context in which this function is used. */ void AlterSchedulerNamespace::validateObject(Object const *object) { - FATAL(!object, ("validateObject(): alter scheduler found NULL object.")); + FATAL(!object, ("validateObject(): alter scheduler found nullptr object.")); DO_ON_VALIDATE_OBJECTS(bool isInvalid = false); @@ -331,7 +331,7 @@ void AlterSchedulerNamespace::validateObject(Object const *object) if (isInvalid) { //-- Print out object info for the invalid object if we have it. - ObjectInfo *objectInfo = NULL; + ObjectInfo *objectInfo = nullptr; if (s_trackObjectInfo) { ObjectInfoMap::iterator findIt = s_objectInfoMap.find(const_cast(object)); @@ -352,7 +352,7 @@ void AlterSchedulerNamespace::validateObject(Object const *object) // ---------------------------------------------------------------------- /** - * Return true if two strings are the same (or are both NULL); otherwise, return false. + * Return true if two strings are the same (or are both nullptr); otherwise, return false. */ static bool SafeStringEqual(char const *string1, char const *string2) @@ -682,7 +682,7 @@ void AlterScheduler::alter(float elapsedTime) DO_ON_DEBUG(if (s_suspendExecution) return); PROFILER_AUTO_BLOCK_DEFINE("AlterScheduler::alter"); - doAlterAndConcludeForAllObjects(elapsedTime, CS_none, NULL); + doAlterAndConcludeForAllObjects(elapsedTime, CS_none, nullptr); } // ---------------------------------------------------------------------- @@ -702,7 +702,7 @@ void AlterScheduler::alterAndConclude(float elapsedTime) DO_ON_DEBUG(if (s_suspendExecution) return); PROFILER_AUTO_BLOCK_DEFINE("AlterScheduler::alterAndConclude"); - doAlterAndConcludeForAllObjects(elapsedTime, CS_all, NULL); + doAlterAndConcludeForAllObjects(elapsedTime, CS_all, nullptr); } // ---------------------------------------------------------------------- @@ -724,7 +724,7 @@ void AlterScheduler::initializeScheduleTimeMapIterator(Object &object) bool AlterScheduler::isIteratorInScheduleTimeMap(void const *iterator) { - DEBUG_FATAL(!iterator, ("AlterScheduler::isIteratorInScheduleTimeMap(): iterator pointer is NULL.")); + DEBUG_FATAL(!iterator, ("AlterScheduler::isIteratorInScheduleTimeMap(): iterator pointer is nullptr.")); return (*static_cast(iterator) != s_scheduleMap.end()); } @@ -734,7 +734,7 @@ bool AlterScheduler::findObjectInAlterNowList(Object const *object) { DO_ON_HARDCORE_VALIDATION(validateAlterNowList()); - for (Object *searchObject = s_alterNowListFirst->getNextFromAlterNowList(); searchObject != NULL; searchObject = searchObject->getNextFromAlterNowList()) + for (Object *searchObject = s_alterNowListFirst->getNextFromAlterNowList(); searchObject != nullptr; searchObject = searchObject->getNextFromAlterNowList()) { if (searchObject == object) return true; @@ -751,7 +751,7 @@ bool AlterScheduler::findObjectInAlterNextFrameLists(Object const *object) for (int phaseIndex = 0; phaseIndex < AS_MAX_SCHEDULE_PHASE_COUNT; ++phaseIndex) { - for (Object *searchObject = s_alterNextFrameListFirst[phaseIndex]->getNextFromAlterNextFrameList(); searchObject != NULL; searchObject = searchObject->getNextFromAlterNextFrameList()) + for (Object *searchObject = s_alterNextFrameListFirst[phaseIndex]->getNextFromAlterNextFrameList(); searchObject != nullptr; searchObject = searchObject->getNextFromAlterNextFrameList()) { if (searchObject == object) return true; @@ -767,7 +767,7 @@ bool AlterScheduler::findObjectInConcludeList(Object const *object) { DO_ON_HARDCORE_VALIDATION(validateConcludeList()); - for (Object *searchObject = s_concludeListFirst->getNextFromConcludeList(); searchObject != NULL; searchObject = searchObject->getNextFromConcludeList()) + for (Object *searchObject = s_concludeListFirst->getNextFromConcludeList(); searchObject != nullptr; searchObject = searchObject->getNextFromConcludeList()) { if (searchObject == object) return true; @@ -817,7 +817,7 @@ void AlterScheduler::validateAlterNowList() //-- Add each object to the set and list. { - for (Object *object = s_alterNowListFirst->getNextFromAlterNowList(); object != NULL; object = object->getNextFromAlterNowList()) + for (Object *object = s_alterNowListFirst->getNextFromAlterNowList(); object != nullptr; object = object->getNextFromAlterNowList()) { DO_ON_VALIDATE_OBJECTS(validateObject(object)); @@ -836,7 +836,7 @@ void AlterScheduler::validateAlterNowList() { ObjectList::iterator const endIt = objectList.end(); Object *object = s_alterNowListFirst->getNextFromAlterNowList(); - for (ObjectList::iterator it = objectList.begin(); (it != endIt) && (object != NULL); object = object->getNextFromAlterNowList(), ++it) + for (ObjectList::iterator it = objectList.begin(); (it != endIt) && (object != nullptr); object = object->getNextFromAlterNowList(), ++it) { lastObject = object; DEBUG_WARNING(object != *it, ("validateAlterNowList(): forward linkage check failed, stl list: pointer=[%p], object id=[%s], object template=[%s].", *it, (*it)->getNetworkId().getValueString().c_str(), (*it)->getObjectTemplateName())); @@ -848,7 +848,7 @@ void AlterScheduler::validateAlterNowList() { ObjectList::reverse_iterator const endIt = objectList.rend(); Object *object = lastObject; - for (ObjectList::reverse_iterator it = objectList.rbegin(); (it != endIt) && (object != NULL); object = object->getPreviousFromAlterNowList(), ++it) + for (ObjectList::reverse_iterator it = objectList.rbegin(); (it != endIt) && (object != nullptr); object = object->getPreviousFromAlterNowList(), ++it) { DEBUG_WARNING(object != *it, ("validateAlterNowList(): reverse linkage check failed, stl list: pointer=[%p], object id=[%s], object template=[%s].", *it, (*it)->getNetworkId().getValueString().c_str(), (*it)->getObjectTemplateName())); DEBUG_FATAL(object != *it, ("validateAlterNowList(): reverse linkage check failed, alter scheduler list: pointer=[%p], object id=[%s], object template=[%s].", object, object->getNetworkId().getValueString().c_str(), object->getObjectTemplateName())); @@ -867,7 +867,7 @@ void AlterScheduler::validateAlterNextFrameLists() { //-- Add each object to the set and list. { - for (Object *object = s_alterNextFrameListFirst[phaseIndex]->getNextFromAlterNextFrameList(); object != NULL; object = object->getNextFromAlterNextFrameList()) + for (Object *object = s_alterNextFrameListFirst[phaseIndex]->getNextFromAlterNextFrameList(); object != nullptr; object = object->getNextFromAlterNextFrameList()) { DO_ON_VALIDATE_OBJECTS(validateObject(object)); @@ -886,7 +886,7 @@ void AlterScheduler::validateAlterNextFrameLists() { ObjectList::iterator const endIt = objectList.end(); Object *object = s_alterNextFrameListFirst[phaseIndex]->getNextFromAlterNextFrameList(); - for (ObjectList::iterator it = objectList.begin(); (it != endIt) && (object != NULL); object = object->getNextFromAlterNextFrameList(), ++it) + for (ObjectList::iterator it = objectList.begin(); (it != endIt) && (object != nullptr); object = object->getNextFromAlterNextFrameList(), ++it) { lastObject = object; DEBUG_WARNING(object != *it, ("validateAlterNextFrameList(): forward linkage check failed, stl list: pointer=[%p], object id=[%s], object template=[%s].", *it, (*it)->getNetworkId().getValueString().c_str(), (*it)->getObjectTemplateName())); @@ -898,7 +898,7 @@ void AlterScheduler::validateAlterNextFrameLists() { ObjectList::reverse_iterator const endIt = objectList.rend(); Object *object = lastObject; - for (ObjectList::reverse_iterator it = objectList.rbegin(); (it != endIt) && (object != NULL); object = object->getPreviousFromAlterNextFrameList(), ++it) + for (ObjectList::reverse_iterator it = objectList.rbegin(); (it != endIt) && (object != nullptr); object = object->getPreviousFromAlterNextFrameList(), ++it) { DEBUG_WARNING(object != *it, ("validateAlterNextFrameList(): reverse linkage check failed, stl list: pointer=[%p], object id=[%s], object template=[%s].", *it, (*it)->getNetworkId().getValueString().c_str(), (*it)->getObjectTemplateName())); DEBUG_FATAL(object != *it, ("validateAlterNextFrameList(): reverse linkage check failed, alter scheduler list: pointer=[%p], object id=[%s], object template=[%s].", object, object->getNetworkId().getValueString().c_str(), object->getObjectTemplateName())); @@ -919,7 +919,7 @@ void AlterScheduler::validateConcludeList() //-- Add each object to the set and list. { - for (Object *object = s_concludeListFirst->getNextFromConcludeList(); object != NULL; object = object->getNextFromConcludeList()) + for (Object *object = s_concludeListFirst->getNextFromConcludeList(); object != nullptr; object = object->getNextFromConcludeList()) { DO_ON_VALIDATE_OBJECTS(validateObject(object)); @@ -938,7 +938,7 @@ void AlterScheduler::validateConcludeList() { ObjectList::iterator const endIt = objectList.end(); Object *object = s_concludeListFirst->getNextFromConcludeList(); - for (ObjectList::iterator it = objectList.begin(); (it != endIt) && (object != NULL); object = object->getNextFromConcludeList(), ++it) + for (ObjectList::iterator it = objectList.begin(); (it != endIt) && (object != nullptr); object = object->getNextFromConcludeList(), ++it) { lastObject = object; DEBUG_WARNING(object != *it, ("validateConcludeList(): forward linkage check failed, stl list: pointer=[%p], object id=[%s], object template=[%s].", *it, (*it)->getNetworkId().getValueString().c_str(), (*it)->getObjectTemplateName())); @@ -950,7 +950,7 @@ void AlterScheduler::validateConcludeList() { ObjectList::reverse_iterator const endIt = objectList.rend(); Object *object = lastObject; - for (ObjectList::reverse_iterator it = objectList.rbegin(); (it != endIt) && (object != NULL); object = object->getPreviousFromConcludeList(), ++it) + for (ObjectList::reverse_iterator it = objectList.rbegin(); (it != endIt) && (object != nullptr); object = object->getPreviousFromConcludeList(), ++it) { DEBUG_WARNING(object != *it, ("validateConcludeList(): reverse linkage check failed, stl list: pointer=[%p], object id=[%s], object template=[%s].", *it, (*it)->getNetworkId().getValueString().c_str(), (*it)->getObjectTemplateName())); DEBUG_FATAL(object != *it, ("validateConcludeList(): reverse linkage check failed, alter scheduler list: pointer=[%p], object id=[%s], object template=[%s].", object, object->getNetworkId().getValueString().c_str(), object->getObjectTemplateName())); @@ -1184,8 +1184,8 @@ void AlterScheduler::moveObjectsFromAlterNextFrameListToAlterNowList(int schedul { PROFILER_AUTO_BLOCK_DEFINE("copy next frame"); - //if (s_alterNextFrameListFirst != NULL) { - for (Object *object = s_alterNextFrameListFirst[schedulePhaseIndex]->getNextFromAlterNextFrameList(); object != NULL; ) + //if (s_alterNextFrameListFirst != nullptr) { + for (Object *object = s_alterNextFrameListFirst[schedulePhaseIndex]->getNextFromAlterNextFrameList(); object != nullptr; ) { //-- Add object to alter now list. This removes the object from the alter next frame list. DO_ON_VALIDATE_OBJECTS(validateObject(object)); @@ -1222,7 +1222,7 @@ void AlterScheduler::alterSingleObject(Object *object, ConcludeStyle concludeSty DO_ON_DEBUG(s_currentlyAlteringObject = object); #if defined(_WIN32) && defined(_DEBUG) - char const * const typeName = s_profileAlterByType ? typeid(*object).name() : NULL; + char const * const typeName = s_profileAlterByType ? typeid(*object).name() : nullptr; PROFILER_BLOCK_DEFINE(profilerBlock, typeName); if (typeName) PROFILER_BLOCK_ENTER(profilerBlock); @@ -1245,7 +1245,7 @@ void AlterScheduler::alterSingleObject(Object *object, ConcludeStyle concludeSty PROFILER_BLOCK_LEAVE(profilerBlock); #endif - DO_ON_DEBUG(s_currentlyAlteringObject = NULL); + DO_ON_DEBUG(s_currentlyAlteringObject = nullptr); DO_ON_VALIDATE_OBJECTS(validateObject(object)); } @@ -1254,7 +1254,7 @@ void AlterScheduler::alterSingleObject(Object *object, ConcludeStyle concludeSty nextObject = object->getNextFromAlterNowList(); #if VALIDATE_OBJECTS - if (nextObject != NULL) + if (nextObject != nullptr) { DO_ON_HARDCORE_VALIDATION(DEBUG_FATAL(!findObjectInAlterNowList(nextObject), ("didn't find object in alter now list, unexpected."))); validateObject(nextObject); @@ -1343,7 +1343,7 @@ void AlterScheduler::alterSingleObject(Object *object, ConcludeStyle concludeSty ScheduleTime const absoluteScheduleTime = s_currentTime + dt; // Add it to the schedule list for the specified scheduler time. - // If this object is NULL, it means it returned an AlterResult that indicated it should still be alive but it somehow got killed. + // If this object is nullptr, it means it returned an AlterResult that indicated it should still be alive but it somehow got killed. //DEBUG_REPORT_LOG(object->getNetworkId() != NetworkId::cms_invalid, ("[aitest] scheduling %s to alter at %lu (%lu + %lu)\n", // object->getNetworkId().getValueString().c_str(), // static_cast(absoluteScheduleTime), @@ -1363,7 +1363,7 @@ void AlterScheduler::concludeAndRemoveAllConcludeEntries() PROFILER_AUTO_BLOCK_DEFINE("conclude"); Object *nextObject; - for (Object *object = s_concludeListFirst->getNextFromConcludeList(); object != NULL; object = nextObject) + for (Object *object = s_concludeListFirst->getNextFromConcludeList(); object != nullptr; object = nextObject) { //-- Conclude the object. DO_ON_VALIDATE_OBJECTS(validateObject(object)); @@ -1400,7 +1400,7 @@ void AlterScheduler::doAlterAndConcludeForAllObjects(float schedulerElapsedTime, DO_ON_HARDCORE_VALIDATION(validateAllContainers()); Object *nextObject; - for (Object *object = s_alterNowListFirst->getNextFromAlterNowList(); object != NULL; object = nextObject) + for (Object *object = s_alterNowListFirst->getNextFromAlterNowList(); object != nullptr; object = nextObject) alterSingleObject(object, concludeStyle, nextObject); } diff --git a/engine/shared/library/sharedObject/src/shared/object/CachedNetworkId.cpp b/engine/shared/library/sharedObject/src/shared/object/CachedNetworkId.cpp index 47c87004..ea766f6e 100755 --- a/engine/shared/library/sharedObject/src/shared/object/CachedNetworkId.cpp +++ b/engine/shared/library/sharedObject/src/shared/object/CachedNetworkId.cpp @@ -32,7 +32,7 @@ void CachedNetworkId::checkValidity() const CachedNetworkId::CachedNetworkId() : m_id(cms_invalid), -m_object(NULL) +m_object(nullptr) { } @@ -40,7 +40,7 @@ m_object(NULL) CachedNetworkId::CachedNetworkId(const NetworkId& id) : m_id(id), -m_object(NULL) +m_object(nullptr) { } @@ -48,7 +48,7 @@ m_object(NULL) CachedNetworkId::CachedNetworkId(NetworkId::NetworkIdType value) : m_id(value), -m_object(NULL) +m_object(nullptr) { } @@ -66,7 +66,7 @@ m_object(const_cast(&object)) CachedNetworkId::CachedNetworkId(const std::string &value) : m_id(value), -m_object(NULL) +m_object(nullptr) { } @@ -98,7 +98,7 @@ CachedNetworkId& CachedNetworkId::operator= (const CachedNetworkId& rhs) CachedNetworkId& CachedNetworkId::operator= (const NetworkId& rhs) { m_id = rhs; - m_object = NULL; + m_object = nullptr; return *this; } // ---------------------------------------------------------- @@ -178,7 +178,7 @@ Object* CachedNetworkId::getObject() const return m_object; } - return NULL; + return nullptr; } // ---------------------------------------------------------- diff --git a/engine/shared/library/sharedObject/src/shared/object/Object.cpp b/engine/shared/library/sharedObject/src/shared/object/Object.cpp index 73273e36..2cad0571 100755 --- a/engine/shared/library/sharedObject/src/shared/object/Object.cpp +++ b/engine/shared/library/sharedObject/src/shared/object/Object.cpp @@ -515,7 +515,7 @@ void ObjectNamespace::remove() #endif delete ms_transformMemoryBlockManager; - ms_transformMemoryBlockManager = NULL; + ms_transformMemoryBlockManager = nullptr; DEBUG_WARNING(static_cast(ms_freeDpvsObjectsList.size()) != ms_allocatedDpvsObjects, ("Leaked %d DpvsObjects lists", ms_allocatedDpvsObjects - static_cast(ms_freeDpvsObjectsList.size()))); while (!ms_systemAllocatedDpvsObjectsList.empty()) @@ -570,11 +570,11 @@ void ObjectNamespace::validatePosition(Object const & object, Vector const & pos object.getNetworkId().getValueString().c_str(), object.getObjectTemplateName(), &object, - object.getAppearance() ? object.getAppearance()->getAppearanceTemplateName() : NULL, - parent ? parent->getNetworkId().getValueString().c_str() : NULL, - parent ? parent->getObjectTemplateName() : NULL, - parent ? parent : NULL, - parent && parent->getAppearance() ? parent->getAppearance()->getAppearanceTemplateName() : NULL)); + object.getAppearance() ? object.getAppearance()->getAppearanceTemplateName() : nullptr, + parent ? parent->getNetworkId().getValueString().c_str() : nullptr, + parent ? parent->getObjectTemplateName() : nullptr, + parent ? parent : nullptr, + parent && parent->getAppearance() ? parent->getAppearance()->getAppearanceTemplateName() : nullptr)); } } @@ -703,30 +703,30 @@ Object::Object(): #if OBJECT_SUPPORTS_IS_ALTERING_FLAG m_isAltering(false), #endif - m_objectTemplate(NULL), + m_objectTemplate(nullptr), m_notificationList(NotificationListManager::getEmptyNotificationList()), - m_debugName(NULL), + m_debugName(nullptr), m_networkId(NetworkId::cms_invalid), - m_appearance(NULL), - m_controller(NULL), - m_dynamics(NULL), - m_attachedToObject(NULL), - m_attachedObjects(NULL), - m_dpvsObjects(NULL), + m_appearance(nullptr), + m_controller(nullptr), + m_dynamics(nullptr), + m_attachedToObject(nullptr), + m_attachedObjects(nullptr), + m_dpvsObjects(nullptr), m_rotations(0), m_scale(Vector::xyz111), m_objectToParent(), - m_objectToWorld(NULL), + m_objectToWorld(nullptr), m_watchedByList(), - m_containerProperty(NULL), - m_collisionProperty(NULL), + m_containerProperty(nullptr), + m_collisionProperty(nullptr), m_spatialSubdivisionHandle (0), m_useAlterScheduler(true), - m_scheduleData(NULL), + m_scheduleData(nullptr), m_shouldBakeIntoMesh(true), - m_defaultAppearance(NULL), - m_alternateAppearance(NULL), - m_containedBy(NULL) + m_defaultAppearance(nullptr), + m_alternateAppearance(nullptr), + m_containedBy(nullptr) { m_defaultAppearance = m_appearance; } @@ -752,25 +752,25 @@ Object::Object(const ObjectTemplate *objectTemplate, const NetworkId &networkId) m_debugName(0), m_networkId(networkId), m_appearance(0), - m_controller(NULL), - m_dynamics(NULL), - m_attachedToObject(NULL), - m_attachedObjects(NULL), - m_dpvsObjects(NULL), + m_controller(nullptr), + m_dynamics(nullptr), + m_attachedToObject(nullptr), + m_attachedObjects(nullptr), + m_dpvsObjects(nullptr), m_rotations(0), m_scale(Vector::xyz111), m_objectToParent(), - m_objectToWorld(NULL), + m_objectToWorld(nullptr), m_watchedByList(), - m_containerProperty(NULL), - m_collisionProperty(NULL), + m_containerProperty(nullptr), + m_collisionProperty(nullptr), m_spatialSubdivisionHandle (0), m_useAlterScheduler(true), - m_scheduleData(NULL), + m_scheduleData(nullptr), m_shouldBakeIntoMesh(true), - m_defaultAppearance(NULL), - m_alternateAppearance(NULL), - m_containedBy(NULL) + m_defaultAppearance(nullptr), + m_alternateAppearance(nullptr), + m_containedBy(nullptr) { objectTemplate->addReference(); NetworkIdManager::addObject(*this); @@ -799,25 +799,25 @@ Object::Object(const ObjectTemplate *objectTemplate, InitializeFlag): m_debugName(0), m_networkId(NetworkId::cms_invalid), m_appearance(0), - m_controller(NULL), - m_dynamics(NULL), - m_attachedToObject(NULL), - m_attachedObjects(NULL), - m_dpvsObjects(NULL), + m_controller(nullptr), + m_dynamics(nullptr), + m_attachedToObject(nullptr), + m_attachedObjects(nullptr), + m_dpvsObjects(nullptr), m_rotations(0), m_scale(Vector::xyz111), m_objectToParent(), - m_objectToWorld(NULL), + m_objectToWorld(nullptr), m_watchedByList(), - m_containerProperty(NULL), - m_collisionProperty(NULL), + m_containerProperty(nullptr), + m_collisionProperty(nullptr), m_spatialSubdivisionHandle (0), m_useAlterScheduler(true), - m_scheduleData(NULL), + m_scheduleData(nullptr), m_shouldBakeIntoMesh(true), - m_defaultAppearance(NULL), - m_alternateAppearance(NULL), - m_containedBy(NULL) + m_defaultAppearance(nullptr), + m_alternateAppearance(nullptr), + m_containedBy(nullptr) { objectTemplate->addReference(); NetworkIdManager::addObject(*this); @@ -836,7 +836,7 @@ Object::~Object(void) IGNORE_RETURN(snprintf(ms_crashReportInfo, sizeof(ms_crashReportInfo) - 1, "~Object: name=[%s] template=[%s]\n", getDebugName(), getObjectTemplateName())); ms_crashReportInfo[sizeof(ms_crashReportInfo) - 1] = '\0'; - DEBUG_REPORT_LOG(ms_logObjectDelete, ("Deleting object id=[%s], template=[%s], pointer=[%p], appearance=[%s], parent id=[%s], template=[%s], pointer=[%p], appearance=[%s]\n", getNetworkId().getValueString().c_str(), getObjectTemplateName(), this, getAppearance() ? getAppearance()->getAppearanceTemplateName() : NULL, m_attachedToObject ? m_attachedToObject->getNetworkId().getValueString().c_str() : NULL, m_attachedToObject ? m_attachedToObject->getObjectTemplateName() : NULL, m_attachedToObject ? m_attachedToObject : NULL, m_attachedToObject && m_attachedToObject->getAppearance() ? m_attachedToObject->getAppearance()->getAppearanceTemplateName() : NULL)); + DEBUG_REPORT_LOG(ms_logObjectDelete, ("Deleting object id=[%s], template=[%s], pointer=[%p], appearance=[%s], parent id=[%s], template=[%s], pointer=[%p], appearance=[%s]\n", getNetworkId().getValueString().c_str(), getObjectTemplateName(), this, getAppearance() ? getAppearance()->getAppearanceTemplateName() : nullptr, m_attachedToObject ? m_attachedToObject->getNetworkId().getValueString().c_str() : nullptr, m_attachedToObject ? m_attachedToObject->getObjectTemplateName() : nullptr, m_attachedToObject ? m_attachedToObject : nullptr, m_attachedToObject && m_attachedToObject->getAppearance() ? m_attachedToObject->getAppearance()->getAppearanceTemplateName() : nullptr)); FATAL(ConfigSharedObject::getAllowDisallowObjectDelete() && ms_disallowObjectDelete, ("Object id=[%s], template=[%s], pointer=[%p] is deleting itself when delete is not allowed", getNetworkId().getValueString().c_str(), getObjectTemplateName(), this)); #if OBJECT_SUPPORTS_IS_ALTERING_FLAG @@ -905,7 +905,7 @@ Object::~Object(void) } deleteAttachedObjects(m_attachedObjects); - m_attachedObjects = NULL; + m_attachedObjects = nullptr; } if (m_objectToWorld) @@ -914,9 +914,9 @@ Object::~Object(void) m_objectToWorld = 0; } - if (m_objectTemplate != NULL) + if (m_objectTemplate != nullptr) m_objectTemplate->releaseReference(); - m_objectTemplate = NULL; + m_objectTemplate = nullptr; m_notificationList = 0; @@ -1139,7 +1139,7 @@ void Object::removeFromWorld() { if (attached->isInWorld()) { - DEBUG_WARNING(true, ("Removing an object [id=%s template=%s] from the world with non-child attached objects [id=%s ptr=0x%08x template=%s name=%s]", getNetworkId ().getValueString ().c_str (), getObjectTemplateName () ? getObjectTemplateName () : "null", attached->getNetworkId ().getValueString ().c_str (), attached, attached->getObjectTemplateName () ? attached->getObjectTemplateName () : "null", attached->getDebugName())); + DEBUG_WARNING(true, ("Removing an object [id=%s template=%s] from the world with non-child attached objects [id=%s ptr=0x%08x template=%s name=%s]", getNetworkId ().getValueString ().c_str (), getObjectTemplateName () ? getObjectTemplateName () : "nullptr", attached->getNetworkId ().getValueString ().c_str (), attached, attached->getObjectTemplateName () ? attached->getObjectTemplateName () : "nullptr", attached->getDebugName())); attached->detachFromObject(DF_parent); } } @@ -1369,7 +1369,7 @@ bool Object::isInWorldCell() const CellProperty *Object::getParentCell() const { - Property *cell = NULL; + Property *cell = nullptr; for (Object *o = const_cast(getAttachedTo()); o && !cell; o = o->getAttachedTo()) cell = o->getCellProperty(); @@ -1580,7 +1580,7 @@ void Object::setAppearance(Appearance *newAppearance) * Steal the Appearance from this object. * * This routine will return the current appearance of this object, and - * then reset its appearance to NULL. + * then reset its appearance to nullptr. * * @return The current appearance of this object */ @@ -1590,18 +1590,18 @@ Appearance *Object::stealAppearance(void) Appearance *oldAppearance = m_appearance; if(m_appearance == m_defaultAppearance) - m_defaultAppearance = NULL; + m_defaultAppearance = nullptr; else if (m_appearance == m_alternateAppearance) - m_alternateAppearance = NULL; + m_alternateAppearance = nullptr; - m_appearance = NULL; + m_appearance = nullptr; if (oldAppearance) { if (isInWorld()) oldAppearance->removeFromWorld(); - oldAppearance->setOwner(NULL); + oldAppearance->setOwner(nullptr); } return oldAppearance; @@ -1999,7 +1999,7 @@ void Object::detachFromObject(DetachFlags const detachFlags) bool const shouldAttach = (!toParentCell || noCell) ? false : m_attachedToObject != &cellProperty->getOwner(); m_objectToParent = shouldAttach ? getTransform_o2c() : getTransform_o2w(); deleteLocalTransform(m_objectToWorld); - m_objectToWorld = NULL; + m_objectToWorld = nullptr; setObjectToWorldDirty(true); // remove from the attached objects list @@ -2010,7 +2010,7 @@ void Object::detachFromObject(DetachFlags const detachFlags) attachedObjects->pop_back(); // set as unattached - m_attachedToObject = NULL; + m_attachedToObject = nullptr; bool const wasChildObject = isChildObject(); bool const wasInWorld = isInWorld(); @@ -2102,7 +2102,7 @@ void Object::removeChildObject(Object * childObjectToRemove, DetachFlags detachF Object *Object::getRootParent(void) { - DEBUG_FATAL(m_childObject && m_attachedToObject == NULL, ("am a child but attached to is NULL")); + DEBUG_FATAL(m_childObject && m_attachedToObject == nullptr, ("am a child but attached to is nullptr")); return m_childObject ? NON_NULL(m_attachedToObject)->getRootParent() : this; } @@ -2116,7 +2116,7 @@ Object *Object::getRootParent(void) const Object *Object::getRootParent(void) const { - DEBUG_FATAL(m_childObject && m_attachedToObject == NULL, ("am a child but attached to is NULL")); + DEBUG_FATAL(m_childObject && m_attachedToObject == nullptr, ("am a child but attached to is nullptr")); return m_childObject ? NON_NULL(m_attachedToObject)->getRootParent() : this; } @@ -2231,7 +2231,7 @@ void Object::setRecursiveScale(Vector const & scale) Controller* Object::stealController(void) { Controller* returnValue = m_controller; - m_controller = NULL; + m_controller = nullptr; return returnValue; } @@ -2362,7 +2362,7 @@ Property const *Object::getProperty(PropertyId const &id) const if ((*i)->getPropertyId() == id) return *i; - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -2376,7 +2376,7 @@ Property *Object::getProperty(PropertyId const &id) if ((*i)->getPropertyId() == id) return *i; - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -2399,13 +2399,13 @@ void Object::removeProperty(PropertyId const &id) } if (id == CellProperty::getClassPropertyId() || id == PortalProperty::getClassPropertyId() || id == SlottedContainer::getClassPropertyId() || id == VolumeContainer::getClassPropertyId()) - m_containerProperty = NULL; + m_containerProperty = nullptr; else if (id == ContainedByProperty::getClassPropertyId()) - m_containedBy = NULL; + m_containedBy = nullptr; else if (id == CollisionProperty::getClassPropertyId()) - m_collisionProperty = NULL; + m_collisionProperty = nullptr; } // ---------------------------------------------------------------------- @@ -2453,7 +2453,7 @@ void Object::lookAt_o (const Vector &position_o, const Vector &j_o) void Object::setAppearanceByName(char const *path) { - if (path != NULL) + if (path != nullptr) { if (TreeFile::exists(path)) { @@ -2461,7 +2461,7 @@ void Object::setAppearanceByName(char const *path) Appearance *appearance = AppearanceTemplateList::createAppearance(path); - if (appearance != NULL) + if (appearance != nullptr) { setAppearance(appearance); } else { @@ -2475,7 +2475,7 @@ void Object::setAppearanceByName(char const *path) } else { - DEBUG_WARNING(true, ("Object::setAppearanceByName() - NULL appearance path specified for object: %s", (getObjectTemplateName() == NULL) ? "" : getObjectTemplateName())); + DEBUG_WARNING(true, ("Object::setAppearanceByName() - nullptr appearance path specified for object: %s", (getObjectTemplateName() == nullptr) ? "" : getObjectTemplateName())); } } @@ -2539,7 +2539,7 @@ SlottedContainer * Object::getSlottedContainerProperty() Container *container = getContainerProperty(); if (container && container->getPropertyId() == SlottedContainer::getClassPropertyId()) return safe_cast(container); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -2549,7 +2549,7 @@ SlottedContainer const * Object::getSlottedContainerProperty() const Container const *container = getContainerProperty(); if (container && container->getPropertyId() == SlottedContainer::getClassPropertyId()) return safe_cast(container); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -2559,7 +2559,7 @@ VolumeContainer * Object::getVolumeContainerProperty() Container *container = getContainerProperty(); if (container && container->getPropertyId() == VolumeContainer::getClassPropertyId()) return safe_cast(container); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -2569,7 +2569,7 @@ VolumeContainer const * Object::getVolumeContainerProperty() const Container const *container = getContainerProperty(); if (container && container->getPropertyId() == VolumeContainer::getClassPropertyId()) return safe_cast(container); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -2579,7 +2579,7 @@ CellProperty * Object::getCellProperty() Container *container = getContainerProperty(); if (container && container->getPropertyId() == CellProperty::getClassPropertyId()) return safe_cast(container); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -2589,7 +2589,7 @@ CellProperty const * Object::getCellProperty() const Container const *container = getContainerProperty(); if (container && container->getPropertyId() == CellProperty::getClassPropertyId()) return safe_cast(container); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -2599,7 +2599,7 @@ PortalProperty * Object::getPortalProperty() Container *container = getContainerProperty(); if (container && container->getPropertyId() == PortalProperty::getClassPropertyId()) return safe_cast(container); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -2609,7 +2609,7 @@ PortalProperty const * Object::getPortalProperty() const Container const *container = getContainerProperty(); if (container && container->getPropertyId() == PortalProperty::getClassPropertyId()) return safe_cast(container); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -2658,7 +2658,7 @@ ServerObject const * Object::asServerObject() const bool Object::hasScheduleData() const { - return (m_scheduleData != NULL); + return (m_scheduleData != nullptr); } // ---------------------------------------------------------------------- @@ -2697,7 +2697,7 @@ void Object::setMostRecentAlterTime(ScheduleTime mostRecentAlterTime) bool Object::isInAlterNextFrameList() const { - return (m_scheduleData == NULL) ? false : (m_scheduleData->getAlterNextFrameNext() != NULL) || (m_scheduleData->getAlterNextFramePrevious() != NULL); + return (m_scheduleData == nullptr) ? false : (m_scheduleData->getAlterNextFrameNext() != nullptr) || (m_scheduleData->getAlterNextFramePrevious() != nullptr); } // ---------------------------------------------------------------------- @@ -2708,7 +2708,7 @@ void Object::insertIntoAlterNextFrameList(Object *afterThisObject) DEBUG_FATAL(isInAlterNextFrameList(), ("insertIntoAlterNextFrameList(): object id=[%s],template=[%s] already in AlterNextFrame list.", getNetworkId().getValueString().c_str(), getObjectTemplateName())); NOT_NULL(afterThisObject); NOT_NULL(afterThisObject->m_scheduleData); - DEBUG_FATAL(afterThisObject->m_scheduleData->getAlterNextFrameNext() && !afterThisObject->m_scheduleData->getAlterNextFrameNext()->m_scheduleData, ("Non-NULL forward link does not have schedule data.")); + DEBUG_FATAL(afterThisObject->m_scheduleData->getAlterNextFrameNext() && !afterThisObject->m_scheduleData->getAlterNextFrameNext()->m_scheduleData, ("Non-nullptr forward link does not have schedule data.")); DEBUG_FATAL(afterThisObject->m_scheduleData->getAlterNextFrameNext() && (afterThisObject->m_scheduleData->getAlterNextFrameNext()->m_scheduleData->getAlterNextFramePrevious() != afterThisObject), ("List corruption: alter next frame.")); //-- Get new next and previous object for the list. @@ -2745,13 +2745,13 @@ void Object::removeFromAlterNextFrameList() DEBUG_FATAL(newNext && !newNext->m_scheduleData, ("Next node missing schedule data.")); //-- Handle previous. - m_scheduleData->setAlterNextFramePrevious(NULL); + m_scheduleData->setAlterNextFramePrevious(nullptr); if (newPrevious) newPrevious->m_scheduleData->setAlterNextFrameNext(newNext); //-- Handle next. - m_scheduleData->setAlterNextFrameNext(NULL); + m_scheduleData->setAlterNextFrameNext(nullptr); if (newNext) newNext->m_scheduleData->setAlterNextFramePrevious(newPrevious); @@ -2766,7 +2766,7 @@ void Object::removeFromAlterNextFrameList() int Object::getAlterSchedulePhase() const { - DEBUG_FATAL(m_scheduleData == NULL, ("calling Object::getAlterSchedulePhase() when Object has no schedule data: id=[%s], template=[%s]", getNetworkId().getValueString().c_str(), getObjectTemplateName())); + DEBUG_FATAL(m_scheduleData == nullptr, ("calling Object::getAlterSchedulePhase() when Object has no schedule data: id=[%s], template=[%s]", getNetworkId().getValueString().c_str(), getObjectTemplateName())); return m_scheduleData->getSchedulePhase(); } @@ -2774,7 +2774,7 @@ int Object::getAlterSchedulePhase() const void Object::setAlterSchedulePhase(int schedulePhaseIndex) { - DEBUG_FATAL(m_scheduleData == NULL, ("calling Object::setAlterSchedulePhase() when Object has no schedule data: id=[%s], template=[%s]", getNetworkId().getValueString().c_str(), getObjectTemplateName())); + DEBUG_FATAL(m_scheduleData == nullptr, ("calling Object::setAlterSchedulePhase() when Object has no schedule data: id=[%s], template=[%s]", getNetworkId().getValueString().c_str(), getObjectTemplateName())); m_scheduleData->setSchedulePhase(schedulePhaseIndex); } @@ -2782,7 +2782,7 @@ void Object::setAlterSchedulePhase(int schedulePhaseIndex) bool Object::isInAlterNowList() const { - return (m_scheduleData == NULL) ? false : (m_scheduleData->getAlterNowNext() != NULL) || (m_scheduleData->getAlterNowPrevious() != NULL); + return (m_scheduleData == nullptr) ? false : (m_scheduleData->getAlterNowNext() != nullptr) || (m_scheduleData->getAlterNowPrevious() != nullptr); } // ---------------------------------------------------------------------- @@ -2793,7 +2793,7 @@ void Object::insertIntoAlterNowList(Object *afterThisObject) DEBUG_FATAL(isInAlterNowList(), ("insertIntoAlterNowList(): object id=[%s],template=[%s] already in AlterNow list.", getNetworkId().getValueString().c_str(), getObjectTemplateName())); NOT_NULL(afterThisObject); NOT_NULL(afterThisObject->m_scheduleData); - DEBUG_FATAL(afterThisObject->m_scheduleData->getAlterNowNext() && !afterThisObject->m_scheduleData->getAlterNowNext()->m_scheduleData, ("Non-NULL forward link does not have schedule data.")); + DEBUG_FATAL(afterThisObject->m_scheduleData->getAlterNowNext() && !afterThisObject->m_scheduleData->getAlterNowNext()->m_scheduleData, ("Non-nullptr forward link does not have schedule data.")); DEBUG_FATAL(afterThisObject->m_scheduleData->getAlterNowNext() && (afterThisObject->m_scheduleData->getAlterNowNext()->m_scheduleData->getAlterNowPrevious() != afterThisObject), ("List corruption: alter now.")); //-- Get new next and previous object for the list. @@ -2830,12 +2830,12 @@ void Object::removeFromAlterNowList() DEBUG_FATAL(newNext && !newNext->m_scheduleData, ("Next node missing schedule data.")); //-- Handle previous. - m_scheduleData->setAlterNowPrevious(NULL); + m_scheduleData->setAlterNowPrevious(nullptr); if (newPrevious) newPrevious->m_scheduleData->setAlterNowNext(newNext); //-- Handle next. - m_scheduleData->setAlterNowNext(NULL); + m_scheduleData->setAlterNowNext(nullptr); if (newNext) newNext->m_scheduleData->setAlterNowPrevious(newPrevious); @@ -2849,7 +2849,7 @@ void Object::removeFromAlterNowList() bool Object::isInConcludeList() const { - return (m_scheduleData == NULL) ? false : (m_scheduleData->getConcludeNext() != NULL) || (m_scheduleData->getConcludePrevious() != NULL); + return (m_scheduleData == nullptr) ? false : (m_scheduleData->getConcludeNext() != nullptr) || (m_scheduleData->getConcludePrevious() != nullptr); } // ---------------------------------------------------------------------- @@ -2860,7 +2860,7 @@ void Object::insertIntoConcludeList(Object *afterThisObject) DEBUG_FATAL(isInConcludeList(), ("insertIntoConcludeList(): object id=[%s],template=[%s] already in Conclude list.", getNetworkId().getValueString().c_str(), getObjectTemplateName())); NOT_NULL(afterThisObject); NOT_NULL(afterThisObject->m_scheduleData); - DEBUG_FATAL(afterThisObject->m_scheduleData->getConcludeNext() && !afterThisObject->m_scheduleData->getConcludeNext()->m_scheduleData, ("Non-NULL forward link does not have schedule data.")); + DEBUG_FATAL(afterThisObject->m_scheduleData->getConcludeNext() && !afterThisObject->m_scheduleData->getConcludeNext()->m_scheduleData, ("Non-nullptr forward link does not have schedule data.")); DEBUG_FATAL(afterThisObject->m_scheduleData->getConcludeNext() && (afterThisObject->m_scheduleData->getConcludeNext()->m_scheduleData->getConcludePrevious() != afterThisObject), ("List corruption: alter now.")); //-- Get new next and previous object for the list. @@ -2897,12 +2897,12 @@ void Object::removeFromConcludeList() DEBUG_FATAL(newNext && !newNext->m_scheduleData, ("Next node missing schedule data.")); //-- Handle previous. - m_scheduleData->setConcludePrevious(NULL); + m_scheduleData->setConcludePrevious(nullptr); if (newPrevious) newPrevious->m_scheduleData->setConcludeNext(newNext); //-- Handle next. - m_scheduleData->setConcludeNext(NULL); + m_scheduleData->setConcludeNext(nullptr); if (newNext) newNext->m_scheduleData->setConcludePrevious(newPrevious); @@ -3015,7 +3015,7 @@ void Object::scheduleForAlter_scheduleTopmostWorldParent() do { //-- Traverse parent links until there is no more parent. - for (Object *parentObject = alterObject->getParent(); parentObject != NULL; parentObject = alterObject->getParent()) + for (Object *parentObject = alterObject->getParent(); parentObject != nullptr; parentObject = alterObject->getParent()) alterObject = parentObject; //-- Traverse container until we're at a container object that is in the world. @@ -3035,7 +3035,7 @@ void Object::scheduleForAlter_scheduleTopmostWorldParent() if (alterObject->isInWorld()) { // We're done searching. - containedByProperty = NULL; + containedByProperty = nullptr; } else { @@ -3052,7 +3052,7 @@ void Object::scheduleForAlter_scheduleTopmostWorldParent() // New container might be a child object, make sure we test for a parent again. // If a parent exists, we need to run through the loop again to find the parent object. - } while (alterObject->getParent() != NULL); + } while (alterObject->getParent() != nullptr); NOT_NULL(alterObject); if (alterObject->isInitialized()) @@ -3270,13 +3270,13 @@ void Object::setAlternateAppearance(const char * path) if(!path) return; - Appearance *alternateAppearance = NULL; + Appearance *alternateAppearance = nullptr; if (TreeFile::exists(path)) { alternateAppearance = AppearanceTemplateList::createAppearance(path); - if (alternateAppearance == NULL) { + if (alternateAppearance == nullptr) { DEBUG_WARNING(true, ("Object::setAlternateAppearance() - Unable to change the object's appearance because the file does not exist: %s", path)); return; } @@ -3313,7 +3313,7 @@ void Object::setAlternateAppearance(const char * path) delete m_alternateAppearance; - m_alternateAppearance = NULL; + m_alternateAppearance = nullptr; } else { diff --git a/engine/shared/library/sharedObject/src/shared/object/Object.h b/engine/shared/library/sharedObject/src/shared/object/Object.h index 7ac8cfe1..9059b52d 100755 --- a/engine/shared/library/sharedObject/src/shared/object/Object.h +++ b/engine/shared/library/sharedObject/src/shared/object/Object.h @@ -495,7 +495,7 @@ inline const ObjectTemplate *Object::getObjectTemplate() const // // Remarks: // -// This return may return NULL. +// This return may return nullptr. inline const char *Object::getDebugName() const { @@ -518,7 +518,7 @@ inline const Vector &Object::getScale() const /** * Get the controller for an object. * - * The return value may be NULL. + * The return value may be nullptr. * * @return Const pointer to the controller */ @@ -532,7 +532,7 @@ inline const Controller *Object::getController() const /** * Get the controller for an object. * - * The return value may be NULL. + * The return value may be nullptr. * * @return Non-const pointer to the controller */ @@ -546,7 +546,7 @@ inline Controller *Object::getController() /** * Get the dynamics for an object. * - * The return value may be NULL. + * The return value may be nullptr. * * @return Const pointer to the dynamics */ @@ -560,7 +560,7 @@ inline const Dynamics *Object::getDynamics() const /** * Get the dynamics for an object. * - * The return value may be NULL. + * The return value may be nullptr. * * @return Non-const pointer to the dynamics */ @@ -598,24 +598,24 @@ inline Appearance *Object::getAppearance() /** * Get the parent object for this object. * - * This routine will return NULL if the object is not a child object. + * This routine will return nullptr if the object is not a child object. */ inline Object *Object::getParent() { - return m_childObject ? m_attachedToObject : NULL; + return m_childObject ? m_attachedToObject : nullptr; } // ---------------------------------------------------------------------- /** * Get the parent object for this object. * - * This routine will return NULL if the object is not a child object. + * This routine will return nullptr if the object is not a child object. */ inline const Object *Object::getParent() const { - return m_childObject ? m_attachedToObject : NULL; + return m_childObject ? m_attachedToObject : nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedObject/src/shared/object/ObjectList.cpp b/engine/shared/library/sharedObject/src/shared/object/ObjectList.cpp index 9e72d27d..e74133f8 100755 --- a/engine/shared/library/sharedObject/src/shared/object/ObjectList.cpp +++ b/engine/shared/library/sharedObject/src/shared/object/ObjectList.cpp @@ -63,7 +63,7 @@ ObjectList::~ObjectList() /** * Add an Object to the ObjectList. * - * This routine will call Fatal in debug compiles if it is passed a NULL + * This routine will call Fatal in debug compiles if it is passed a nullptr * object. * * This routine will call Fatal in debug compiles if the object list @@ -85,7 +85,7 @@ void ObjectList::addObject(Object *objectToAdd) /** * Remove an Object from the ObjectList. * - * This routine will call Fatal in debug compiles if it is passed a NULL + * This routine will call Fatal in debug compiles if it is passed a nullptr * object. * * @param objectToRemove Pointer to the object to remove @@ -113,13 +113,13 @@ void ObjectList::removeObjectByIndex(const Object* object, int index) // Remove the last item in the vector. m_objectVector->pop_back(); - // NULL the object from the alter-safe object list. + // nullptr the object from the alter-safe object list. uint size = m_alterSafeObjectVector->size(); for (uint i = 0; i < size; ++i) { if ((*m_alterSafeObjectVector)[i] == object) { - (*m_alterSafeObjectVector)[i] = NULL; + (*m_alterSafeObjectVector)[i] = nullptr; return; } } @@ -224,7 +224,7 @@ float ObjectList::alter(real time) if (alterResult == AlterResult::cms_kill) //lint !e777 // Testing floats for equality // It's okay, we're using constants. { // Make sure the object is still in the object list before removing it - if ((*m_alterSafeObjectVector)[i] != NULL) + if ((*m_alterSafeObjectVector)[i] != nullptr) removeObject(obj); delete obj; } diff --git a/engine/shared/library/sharedObject/src/shared/object/ObjectTemplate.cpp b/engine/shared/library/sharedObject/src/shared/object/ObjectTemplate.cpp index 5729afef..789b5d12 100755 --- a/engine/shared/library/sharedObject/src/shared/object/ObjectTemplate.cpp +++ b/engine/shared/library/sharedObject/src/shared/object/ObjectTemplate.cpp @@ -66,7 +66,7 @@ ObjectTemplate::ObjectTemplate(const std::string & filename) : { //-- Track name of most recently loading object template name to give us more // data to work with when we receive crash info. - IGNORE_RETURN(snprintf(s_crashReportInfoConstructor, sizeof(s_crashReportInfoConstructor) - 1, "ObjectTemplate_Constructor: %s\n", !filename.empty() ? filename.c_str() : "")); + IGNORE_RETURN(snprintf(s_crashReportInfoConstructor, sizeof(s_crashReportInfoConstructor) - 1, "ObjectTemplate_Constructor: %s\n", !filename.empty() ? filename.c_str() : "")); s_crashReportInfoConstructor[sizeof(s_crashReportInfoConstructor) - 1] = '\0'; } @@ -165,7 +165,7 @@ Object *ObjectTemplate::createObject() const */ void ObjectTemplate::addReference() const { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->addReference(); DataResource::addReference(); @@ -178,7 +178,7 @@ void ObjectTemplate::addReference() const */ void ObjectTemplate::releaseReference() const { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); DataResource::releaseReference(); @@ -199,7 +199,7 @@ void ObjectTemplate::loadFromIff(Iff &iff) //-- Track name of most recently loading object template name to give us more // data to work with when we receive crash info. char const *const filename = iff.getFileName(); - IGNORE_RETURN(snprintf(s_crashReportInfoLoadFromIff, sizeof(s_crashReportInfoLoadFromIff) - 1, "ObjectTemplate_Iff: %s\n", (filename && *filename) ? filename : "")); + IGNORE_RETURN(snprintf(s_crashReportInfoLoadFromIff, sizeof(s_crashReportInfoLoadFromIff) - 1, "ObjectTemplate_Iff: %s\n", (filename && *filename) ? filename : "")); s_crashReportInfoLoadFromIff[sizeof(s_crashReportInfoLoadFromIff) - 1] = '\0'; preLoad(); diff --git a/engine/shared/library/sharedObject/src/shared/object/ObjectTemplateList.cpp b/engine/shared/library/sharedObject/src/shared/object/ObjectTemplateList.cpp index 4e45484b..96663b8a 100755 --- a/engine/shared/library/sharedObject/src/shared/object/ObjectTemplateList.cpp +++ b/engine/shared/library/sharedObject/src/shared/object/ObjectTemplateList.cpp @@ -24,8 +24,8 @@ typedef DataResourceList ObjectTemplateListDataResourceList; -template <> ObjectTemplateListDataResourceList::CreateDataResourceMap *ObjectTemplateListDataResourceList::ms_bindings = NULL; -template <> ObjectTemplateListDataResourceList::LoadedDataResourceMap *ObjectTemplateListDataResourceList::ms_loaded = NULL; +template <> ObjectTemplateListDataResourceList::CreateDataResourceMap *ObjectTemplateListDataResourceList::ms_bindings = nullptr; +template <> ObjectTemplateListDataResourceList::LoadedDataResourceMap *ObjectTemplateListDataResourceList::ms_loaded = nullptr; namespace ObjectTemplateListNamespace { diff --git a/engine/shared/library/sharedObject/src/shared/object/ScheduleData.cpp b/engine/shared/library/sharedObject/src/shared/object/ScheduleData.cpp index 8de48b15..0b323d4d 100755 --- a/engine/shared/library/sharedObject/src/shared/object/ScheduleData.cpp +++ b/engine/shared/library/sharedObject/src/shared/object/ScheduleData.cpp @@ -20,12 +20,12 @@ MEMORY_BLOCK_MANAGER_IMPLEMENTATION_WITH_INSTALL(ScheduleData, true, 0, 0, 0); ScheduleData::ScheduleData(AlterScheduler::ScheduleTime initialMostRecentAlterTime): m_mostRecentAlterTime(initialMostRecentAlterTime), - m_alterNowNext(NULL), - m_alterNowPrevious(NULL), - m_alterNextFrameNext(NULL), - m_alterNextFramePrevious(NULL), - m_concludeNext(NULL), - m_concludePrevious(NULL), + m_alterNowNext(nullptr), + m_alterNowPrevious(nullptr), + m_alterNextFrameNext(nullptr), + m_alterNextFramePrevious(nullptr), + m_concludeNext(nullptr), + m_concludePrevious(nullptr), m_scheduleTimeMapIterator(), m_schedulePhase(0) { diff --git a/engine/shared/library/sharedObject/src/shared/portal/CellProperty.cpp b/engine/shared/library/sharedObject/src/shared/portal/CellProperty.cpp index d6ae066b..95281e88 100755 --- a/engine/shared/library/sharedObject/src/shared/portal/CellProperty.cpp +++ b/engine/shared/library/sharedObject/src/shared/portal/CellProperty.cpp @@ -70,14 +70,14 @@ namespace CellPropertyNamespace Object *ms_worldCellObject; Notification ms_portalCrossingNotification; bool ms_renderPortals; - CellProperty::CreateDpvsCellHookFunction ms_createDpvsCellHookFunction = NULL; - CellProperty::DestroyDpvsCellHookFunction ms_destroyDpvsCellHookFunction = NULL; - CellProperty::AddToRenderWorldHookFunction ms_addToRenderWorldHook = NULL; + CellProperty::CreateDpvsCellHookFunction ms_createDpvsCellHookFunction = nullptr; + CellProperty::DestroyDpvsCellHookFunction ms_destroyDpvsCellHookFunction = nullptr; + CellProperty::AddToRenderWorldHookFunction ms_addToRenderWorldHook = nullptr; - CellProperty::PolyAppearanceFactory ms_portalBarrierFactory = NULL; - CellProperty::PolyAppearanceFactory ms_forceFieldFactory = NULL; + CellProperty::PolyAppearanceFactory ms_portalBarrierFactory = nullptr; + CellProperty::PolyAppearanceFactory ms_forceFieldFactory = nullptr; - CellProperty::AccessAllowedHookFunction ms_accessAllowedHookFunction = NULL; + CellProperty::AccessAllowedHookFunction ms_accessAllowedHookFunction = nullptr; } using namespace CellPropertyNamespace; @@ -86,9 +86,9 @@ using namespace CellPropertyNamespace; bool CellPropertyNamespace::Notification::ms_enabled = true; CellProperty *CellProperty::ms_worldCellProperty; -CellProperty::TextureFetch CellProperty::ms_textureFetch = NULL; -CellProperty::TextureRelease CellProperty::ms_textureRelease = NULL; -CellProperty::DeleteVisibleCellProperty CellProperty::ms_deleteVisibleCellProperty = NULL; +CellProperty::TextureFetch CellProperty::ms_textureFetch = nullptr; +CellProperty::TextureRelease CellProperty::ms_textureRelease = nullptr; +CellProperty::DeleteVisibleCellProperty CellProperty::ms_deleteVisibleCellProperty = nullptr; // ====================================================================== @@ -148,9 +148,9 @@ bool CellPropertyNamespace::Notification::positionChanged(Object &object, bool c start += objUpW; end += objUpW; - CellProperty *targetCell = NULL; + CellProperty *targetCell = nullptr; - CellProperty *lastCell = NULL; + CellProperty *lastCell = nullptr; CellProperty *currentCell = object.getParentCell(); while(currentCell) @@ -163,7 +163,7 @@ bool CellPropertyNamespace::Notification::positionChanged(Object &object, bool c if(time == 1.0f) break; - if(nextCell == NULL) break; + if(nextCell == nullptr) break; if(nextCell == currentCell) break; if(nextCell == lastCell) break; @@ -235,8 +235,8 @@ void CellProperty::install() void CellProperty::remove() { delete ms_worldCellObject; - ms_worldCellObject = NULL; - ms_worldCellProperty = NULL; + ms_worldCellObject = nullptr; + ms_worldCellProperty = nullptr; } // ---------------------------------------------------------------------- @@ -282,7 +282,7 @@ Appearance *CellProperty::createPortalBarrier(VertexList const & verts, const Ve if (ms_portalBarrierFactory) return ms_portalBarrierFactory(verts,color); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -292,7 +292,7 @@ Appearance *CellProperty::createForceField(VertexList const & verts, const Vecto if (ms_forceFieldFactory) return ms_forceFieldFactory(verts,color); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -342,24 +342,24 @@ void CellProperty::setPortalTransitionsEnabled(bool enabled) CellProperty::CellProperty(Object &owner) : Container(getClassPropertyId(), owner), - m_portalProperty(NULL), + m_portalProperty(nullptr), m_cellIndex(-1), - m_appearanceObject(NULL), + m_appearanceObject(nullptr), m_portalObjectList(new PortalObjectList), m_visible(false), - m_floor(NULL), - m_cellName(NULL), + m_floor(nullptr), + m_cellName(nullptr), m_cellNameCrc(0), - m_dpvsCell(NULL), - m_environmentTexture(NULL), + m_dpvsCell(nullptr), + m_environmentTexture(nullptr), m_fogEnabled(false), m_fogColor(0), m_fogDensity(0.f), m_appliedInteriorLayout(false), - m_preVisibilityTraversalRenderHookFunctionList(NULL), - m_enterRenderHookFunctionList(NULL), - m_preDrawRenderHookFunctionList(NULL), - m_exitRenderHookFunctionList(NULL) + m_preVisibilityTraversalRenderHookFunctionList(nullptr), + m_enterRenderHookFunctionList(nullptr), + m_preDrawRenderHookFunctionList(nullptr), + m_exitRenderHookFunctionList(nullptr) { if (ms_createDpvsCellHookFunction) m_dpvsCell = (*ms_createDpvsCellHookFunction)(this); @@ -379,7 +379,7 @@ CellProperty::~CellProperty() { NOT_NULL(ms_textureRelease); ms_textureRelease(m_environmentTexture); - m_environmentTexture = NULL; + m_environmentTexture = nullptr; } if (!m_portalObjectList->empty()) @@ -391,18 +391,18 @@ CellProperty::~CellProperty() delete portalList; } - m_portalProperty = NULL; + m_portalProperty = nullptr; delete m_appearanceObject; delete m_portalObjectList; delete m_floor; - m_cellName = NULL; + m_cellName = nullptr; m_cellNameCrc = 0; if (m_dpvsCell) { NOT_NULL(ms_destroyDpvsCellHookFunction); (*ms_destroyDpvsCellHookFunction)(m_dpvsCell); - m_dpvsCell = NULL; + m_dpvsCell = nullptr; } delete m_preVisibilityTraversalRenderHookFunctionList; @@ -432,7 +432,7 @@ void CellProperty::initialize(const PortalProperty &portalProperty, int cellInde m_appearanceObject->attachToObject_p(&getOwner(), true); Appearance * const appearance = AppearanceTemplateList::createAppearance(cellTemplate.getAppearanceName()); - if (appearance != NULL) { + if (appearance != nullptr) { appearance->setShadowBlobAllowed(); m_appearanceObject->setAppearance(appearance); @@ -448,7 +448,7 @@ void CellProperty::initialize(const PortalProperty &portalProperty, int cellInde if (cellTemplate.getFloorName()) { - m_floor = FloorManager::createFloor(cellTemplate.getFloorName(),&getOwner(),NULL,false); + m_floor = FloorManager::createFloor(cellTemplate.getFloorName(),&getOwner(),nullptr,false); WARNING(!m_floor, ("Cell %s could not load floor %s", cellTemplate.getAppearanceName(), cellTemplate.getFloorName())); } else @@ -622,8 +622,8 @@ bool CellProperty::areAdjacent(const CellProperty *cellProperty1, const CellProp { bool result = false; - if ( (cellProperty1 != NULL) - && (cellProperty2 != NULL)) + if ( (cellProperty1 != nullptr) + && (cellProperty2 != nullptr)) { if (cellProperty1 == cellProperty2) { @@ -640,8 +640,8 @@ bool CellProperty::areAdjacent(const CellProperty *cellProperty1, const CellProp result = false; } - else if ( (cellProperty1->m_portalObjectList != NULL) - && (cellProperty2->m_portalObjectList != NULL)) + else if ( (cellProperty1->m_portalObjectList != nullptr) + && (cellProperty2->m_portalObjectList != nullptr)) { // Pick the list that is not the world cell property, or the // smallest list @@ -657,7 +657,7 @@ bool CellProperty::areAdjacent(const CellProperty *cellProperty1, const CellProp checkCellProperty = cellProperty1; } - if (portalObjectList != NULL) + if (portalObjectList != nullptr) { //DEBUG_REPORT_LOG((portalObjectList->size() > 1), ("Portal Object List > 1 - size: %d", portalObjectList->size())); @@ -714,7 +714,7 @@ void CellProperty::releaseWorldCellPropertyEnvironmentTexture() * * @param startPosition Starting position, in the space of this cell. * @param endPosition Ending position, in the space of this cell. - * @return The CellProperty that an object traversing the object is in. Will return NULL if remaining in this cell. + * @return The CellProperty that an object traversing the object is in. Will return nullptr if remaining in this cell. */ CellProperty *CellProperty::getDestinationCell(const Vector &startPosition, const Vector &endPosition, float &closestPortalT, bool passableOnly) const @@ -773,8 +773,8 @@ CellProperty *CellProperty::getDestinationCell(const Vector &startPosition, cons CellProperty *CellProperty::getDestinationCell(const Object *object, int portalId) const { - if(portalId < 0) return NULL; - if(object == NULL) return NULL; + if(portalId < 0) return nullptr; + if(object == nullptr) return nullptr; const PortalObjectList::const_iterator iEnd = m_portalObjectList->end(); for (PortalObjectList::const_iterator i = m_portalObjectList->begin(); i != iEnd; ++i) @@ -796,13 +796,13 @@ CellProperty *CellProperty::getDestinationCell(const Object *object, int portalI { DEBUG_WARNING(true,("CellProperty::getDestinationCell(portalId) - tried to get an invalid portal\n")); - return NULL; + return nullptr; } return portalList[static_cast(portalId)]->getNeighbor()->getParentCell(); } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -840,7 +840,7 @@ bool CellProperty::getDestinationCells(const Sphere &sphere, std::vectorgetNeighbor(); - WARNING(neighbor == NULL,("CellProperty::getDestinationCells - Cell %s has a portal without a neighbor\n",getOwner().getNetworkId().getValueString().c_str())); + WARNING(neighbor == nullptr,("CellProperty::getDestinationCells - Cell %s has a portal without a neighbor\n",getOwner().getNetworkId().getValueString().c_str())); if(neighbor) { @@ -864,7 +864,7 @@ bool CellProperty::isAdjacentTo(const CellProperty *cell) const { if(this == cell) return true; - if(cell == NULL) return false; + if(cell == nullptr) return false; // ---------- @@ -964,7 +964,7 @@ const BaseExtent *CellProperty::getCollisionExtent() const } else { - return NULL; + return nullptr; } } @@ -982,7 +982,7 @@ const BaseClass *CellProperty::getPathGraph() const } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -1111,7 +1111,7 @@ void CellProperty::drawDebugShapes(DebugShapeRenderer * const renderer) const #ifdef _DEBUG - if (renderer == NULL) + if (renderer == nullptr) return; Floor const * const floor = getFloor(); @@ -1192,7 +1192,7 @@ CellProperty::PortalObjectEntry const &CellProperty::getPortalObject(int index) bool CellProperty::getAccessAllowed() const { - if (ms_accessAllowedHookFunction != NULL) + if (ms_accessAllowedHookFunction != nullptr) return (*ms_accessAllowedHookFunction)(*this); else return true; @@ -1286,7 +1286,7 @@ Vector const CellProperty::getPosition_w(Location const & location) Vector result = location.getCoordinates(); CellProperty const * const worldCellProperty = CellProperty::getWorldCellProperty(); - if (worldCellProperty != NULL) + if (worldCellProperty != nullptr) { if (location.getCell() != worldCellProperty->getOwner().getNetworkId()) { @@ -1295,7 +1295,7 @@ Vector const CellProperty::getPosition_w(Location const & location) Object const * const cell = NetworkIdManager::getObjectById(location.getCell()); - if (cell != NULL) + if (cell != nullptr) { result = cell->rotateTranslate_o2w(location.getCoordinates()); } diff --git a/engine/shared/library/sharedObject/src/shared/portal/Portal.cpp b/engine/shared/library/sharedObject/src/shared/portal/Portal.cpp index 1fcd8d87..c8658b98 100755 --- a/engine/shared/library/sharedObject/src/shared/portal/Portal.cpp +++ b/engine/shared/library/sharedObject/src/shared/portal/Portal.cpp @@ -64,7 +64,7 @@ void Portal::install() void Portal::remove() { delete ms_doorStyleTable; - ms_doorStyleTable = NULL; + ms_doorStyleTable = nullptr; } // ---------------------------------------------------------------------- @@ -105,11 +105,11 @@ Portal::Portal(const PortalPropertyTemplateCellPortal &portalTemplate, CellPrope m_template(portalTemplate), m_relativeToObject(relativeTo), m_closed(false), - m_neighbor(NULL), + m_neighbor(nullptr), m_parentCell(parentCell), - m_dpvsPortal(NULL), - m_door(NULL), - m_appearance(NULL) + m_dpvsPortal(nullptr), + m_door(nullptr), + m_appearance(nullptr) { if(ms_createDoors) { @@ -126,13 +126,13 @@ Portal::~Portal() m_relativeToObject->removeDpvsObject(m_dpvsPortal); NOT_NULL(ms_destroyDpvsPortalHookFunction); (*ms_destroyDpvsPortalHookFunction)(m_dpvsPortal); - m_dpvsPortal = NULL; + m_dpvsPortal = nullptr; } - m_relativeToObject = NULL; - m_neighbor = NULL; - m_parentCell = NULL; - m_door = NULL; + m_relativeToObject = nullptr; + m_neighbor = nullptr; + m_parentCell = nullptr; + m_door = nullptr; delete m_appearance; } diff --git a/engine/shared/library/sharedObject/src/shared/portal/PortalProperty.cpp b/engine/shared/library/sharedObject/src/shared/portal/PortalProperty.cpp index e88349e2..716b488a 100755 --- a/engine/shared/library/sharedObject/src/shared/portal/PortalProperty.cpp +++ b/engine/shared/library/sharedObject/src/shared/portal/PortalProperty.cpp @@ -57,9 +57,9 @@ PropertyId PortalProperty::getClassPropertyId() PortalProperty::PortalProperty(Object &owner, const char *fileName) : Container(getClassPropertyId(), owner), - m_template(NULL), + m_template(nullptr), m_cellList(new CellList), - m_fixupList(NULL), + m_fixupList(nullptr), m_hasPassablePortalToParentCell(false) { #ifdef _DEBUG @@ -67,7 +67,7 @@ PortalProperty::PortalProperty(Object &owner, const char *fileName) #endif // _DEBUG m_template = PortalPropertyTemplateList::fetch(CrcLowerString(fileName)); - m_cellList->resize(static_cast(m_template->getNumberOfCells()), NULL); + m_cellList->resize(static_cast(m_template->getNumberOfCells()), nullptr); #ifdef _DEBUG DataLint::popAsset(); @@ -139,7 +139,7 @@ void PortalProperty::addToWorld() int unloaded = 0; int const numberOfCells = static_cast(m_cellList->size()); for (int i = 1; i < numberOfCells; ++i) - if ((*m_cellList)[static_cast(i)] == NULL) + if ((*m_cellList)[static_cast(i)] == nullptr) { WARNING(true, ("cell %d/%d not loaded", i, numberOfCells)); ++unloaded; @@ -215,7 +215,7 @@ bool PortalProperty::serverEndBaselines(int serverObjectCrc, std::vectorsize(); for (uint i = 1; i < numberOfCells; ++i) { - if ((*m_cellList)[i] == NULL) + if ((*m_cellList)[i] == nullptr) { Object *object = ms_beginCreateObjectFunction(static_cast(i)); IGNORE_RETURN(addToContents(*object, tmp)); @@ -460,7 +460,7 @@ void PortalProperty::debugPrint(std::string &buffer) const void PortalProperty::createAppearance() { Appearance * const appearance = AppearanceTemplateList::createAppearance(m_template->getExteriorAppearanceName()); - if (appearance != NULL) { + if (appearance != nullptr) { appearance->setShadowBlobAllowed(); getOwner().setAppearance(appearance); } else { @@ -563,7 +563,7 @@ CellProperty *PortalProperty::getCell(const char *desiredCellName) return (*m_cellList)[static_cast(i)]; } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedObject/src/shared/portal/PortalPropertyTemplate.cpp b/engine/shared/library/sharedObject/src/shared/portal/PortalPropertyTemplate.cpp index 09d2e9e1..a21c39b5 100755 --- a/engine/shared/library/sharedObject/src/shared/portal/PortalPropertyTemplate.cpp +++ b/engine/shared/library/sharedObject/src/shared/portal/PortalPropertyTemplate.cpp @@ -41,7 +41,7 @@ typedef BaseClass * (*ExpandBuildingGraphHook)( PortalPropertyTemplate * portalTemplate, BaseClass * baseBuildingGraph ); -ExpandBuildingGraphHook g_expandBuildingGraphHook = NULL; +ExpandBuildingGraphHook g_expandBuildingGraphHook = nullptr; // ====================================================================== @@ -257,8 +257,8 @@ PortalPropertyTemplateCellPortal::PortalPropertyTemplateCellPortal(const PortalP m_disabled(false), m_passable(false), m_geometryWindingClockwise(true), - m_portalGeometry(NULL), - m_doorStyle(NULL), + m_portalGeometry(nullptr), + m_doorStyle(nullptr), m_hasDoorHardpoint(false), m_doorHardpoint(), m_plane(), @@ -272,7 +272,7 @@ PortalPropertyTemplateCellPortal::PortalPropertyTemplateCellPortal(const PortalP PortalPropertyTemplateCellPortal::~PortalPropertyTemplateCellPortal() { - m_portalGeometry = NULL; + m_portalGeometry = nullptr; delete [] m_doorStyle; if (m_preloadManager) @@ -524,14 +524,14 @@ PortalPropertyTemplateCell::PreloadManager::~PreloadManager () PortalPropertyTemplateCell::PortalPropertyTemplateCell(const PortalPropertyTemplate &portalPropertyTemplate, int index, Iff &iff) : - m_name(NULL), - m_appearanceName(NULL), - m_floorName(NULL), - m_floorMesh(NULL), + m_name(nullptr), + m_appearanceName(nullptr), + m_floorName(nullptr), + m_floorMesh(nullptr), m_canSeeParentCell(false), - m_lightList(NULL), + m_lightList(nullptr), m_portalList(new PortalPropertyTemplateCellPortalList), - m_collisionExtent(NULL), + m_collisionExtent(nullptr), m_preloadManager (0) { load(portalPropertyTemplate, index, iff); @@ -556,7 +556,7 @@ PortalPropertyTemplateCell::~PortalPropertyTemplateCell() } delete m_collisionExtent; - m_collisionExtent = NULL; + m_collisionExtent = nullptr; if (m_preloadManager) { @@ -567,7 +567,7 @@ PortalPropertyTemplateCell::~PortalPropertyTemplateCell() if (m_floorMesh) { m_floorMesh->releaseReference (); - m_floorMesh = NULL; + m_floorMesh = nullptr; } } @@ -875,7 +875,7 @@ const char *PortalPropertyTemplateCell::getFloorName() const FloorMesh const * PortalPropertyTemplateCell::getFloorMesh() const { - if(m_floorMesh == NULL) + if(m_floorMesh == nullptr) { if(m_floorName) { @@ -885,7 +885,7 @@ FloorMesh const * PortalPropertyTemplateCell::getFloorMesh() const } else { - //-- cell template r0 always has a null floor name for POBs without accessible exteriors (POB ships & POB-only dungeons) + //-- cell template r0 always has a nullptr floor name for POBs without accessible exteriors (POB ships & POB-only dungeons) //-- don't warn for that cell template DEBUG_WARNING(ConfigSharedCollision::getReportWarnings() && strcmp(m_name, "r0"), ("PortalPropertyTemplateCell::getFloorMesh() - Cell template %s on [%s] has no floor name", m_name, m_appearanceName)); @@ -1039,7 +1039,7 @@ PortalPropertyTemplate::PortalPropertyTemplate(const CrcString &name) m_cellList(new CellList), m_cellNameList(new CellNameList), m_crc(0), - m_pathGraph(NULL), + m_pathGraph(nullptr), m_radarPortalGeometry(0) { FileName shortName(name.getString()); @@ -1079,7 +1079,7 @@ PortalPropertyTemplate::~PortalPropertyTemplate() delete m_portalOwnersList; delete m_pathGraph; - m_pathGraph = NULL; + m_pathGraph = nullptr; delete m_radarPortalGeometry; m_radarPortalGeometry = 0; diff --git a/engine/shared/library/sharedObject/src/shared/portal/SphereGrid.h b/engine/shared/library/sharedObject/src/shared/portal/SphereGrid.h index 00a1ea37..e83e48e3 100755 --- a/engine/shared/library/sharedObject/src/shared/portal/SphereGrid.h +++ b/engine/shared/library/sharedObject/src/shared/portal/SphereGrid.h @@ -373,14 +373,14 @@ inline void SphereGrid::findInRangeCapsule( Object c template inline void SphereGrid::findInRange( const Capsule & range, std::set & results) { - findInRangeCapsule( INVALID_POB, range, NULL, results ); + findInRangeCapsule( INVALID_POB, range, nullptr, results ); } template inline void SphereGrid::findInRange( Vector const ¢er_w, float radius, std::set & results) { - findInRangeSphere( INVALID_POB, center_w, radius, NULL, results ); + findInRangeSphere( INVALID_POB, center_w, radius, nullptr, results ); } @@ -401,7 +401,7 @@ inline void SphereGrid::findInRange( Vector const &c template inline void SphereGrid::findInRange( Object const *pob, Vector const ¢er_w, float radius, std::set & results) { - findInRangeSphere( pob, center_w, radius, NULL, results ); + findInRangeSphere( pob, center_w, radius, nullptr, results ); } template diff --git a/engine/shared/library/sharedObject/src/shared/property/LayerProperty.cpp b/engine/shared/library/sharedObject/src/shared/property/LayerProperty.cpp index 63f5cc57..f331b5a4 100755 --- a/engine/shared/library/sharedObject/src/shared/property/LayerProperty.cpp +++ b/engine/shared/library/sharedObject/src/shared/property/LayerProperty.cpp @@ -23,7 +23,7 @@ PropertyId LayerProperty::getClassPropertyId() LayerProperty::LayerProperty(Object& thisObject) : Property(getClassPropertyId(), thisObject), -m_layer(NULL) +m_layer(nullptr) { } @@ -31,10 +31,10 @@ m_layer(NULL) LayerProperty::~LayerProperty() { - if (m_layer != NULL) + if (m_layer != nullptr) { delete m_layer; - m_layer = NULL; + m_layer = nullptr; } } diff --git a/engine/shared/library/sharedObject/src/shared/world/World.cpp b/engine/shared/library/sharedObject/src/shared/world/World.cpp index e0d90fae..ce2ab931 100755 --- a/engine/shared/library/sharedObject/src/shared/world/World.cpp +++ b/engine/shared/library/sharedObject/src/shared/world/World.cpp @@ -305,7 +305,7 @@ bool World::removeObject (const Object* object, int listIndex) { DEBUG_FATAL (!ms_installed, ("not installed")); NOT_NULL (object); - DEBUG_FATAL (!object, ("World::removeObject - object is null")); + DEBUG_FATAL (!object, ("World::removeObject - object is nullptr")); VALIDATE_RANGE_INCLUSIVE_EXCLUSIVE (0, listIndex, static_cast(WOL_Count)); ms_objectSet.erase(object); @@ -349,7 +349,7 @@ bool World::removeObject (const Object* object, int listIndex) void World::queueObject (Object* object) { DEBUG_FATAL (!ms_installed, ("not installed")); - DEBUG_FATAL (!object, ("World::queueObject - object is null")); + DEBUG_FATAL (!object, ("World::queueObject - object is nullptr")); ms_queuedObjectList->addObject (object); } diff --git a/engine/shared/library/sharedPathfinding/src/shared/DynamicPathGraph.cpp b/engine/shared/library/sharedPathfinding/src/shared/DynamicPathGraph.cpp index 532ade02..8b264ebb 100755 --- a/engine/shared/library/sharedPathfinding/src/shared/DynamicPathGraph.cpp +++ b/engine/shared/library/sharedPathfinding/src/shared/DynamicPathGraph.cpp @@ -25,10 +25,10 @@ DynamicPathGraph::~DynamicPathGraph() clear(); delete m_nodeList; - m_nodeList = NULL; + m_nodeList = nullptr; delete m_dirtyNodes; - m_dirtyNodes = NULL; + m_dirtyNodes = nullptr; } // ---------- @@ -72,7 +72,7 @@ int DynamicPathGraph::getEdgeCount ( int nodeIndex ) const { DynamicPathNode const * node = _getNode(nodeIndex); - if(node == NULL) + if(node == nullptr) { return 0; } @@ -86,13 +86,13 @@ PathEdge * DynamicPathGraph::getEdge ( int nodeIndex, int edgeIndex ) { DynamicPathNode * node = _getNode(nodeIndex); - if(node != NULL) + if(node != nullptr) { return node->getEdge(edgeIndex); } else { - return NULL; + return nullptr; } } @@ -100,13 +100,13 @@ PathEdge const * DynamicPathGraph::getEdge ( int nodeIndex, int edgeIndex ) cons { DynamicPathNode const * node = _getNode(nodeIndex); - if(node != NULL) + if(node != nullptr) { return node->getEdge(edgeIndex); } else { - return NULL; + return nullptr; } } @@ -114,7 +114,7 @@ PathEdge const * DynamicPathGraph::getEdge ( int nodeIndex, int edgeIndex ) cons int DynamicPathGraph::addNode ( DynamicPathNode * newNode ) { - if(newNode == NULL) return -1; + if(newNode == nullptr) return -1; int listSize = m_nodeList->size(); @@ -124,7 +124,7 @@ int DynamicPathGraph::addNode ( DynamicPathNode * newNode ) { for(int i = 0; i < listSize; i++) { - if(m_nodeList->at(i) == NULL) + if(m_nodeList->at(i) == nullptr) { nodeIndex = i; break; @@ -155,11 +155,11 @@ void DynamicPathGraph::removeNode ( int nodeIndex ) DynamicPathNode * node = _getNode(nodeIndex); - if(node != NULL) + if(node != nullptr) { unlinkNode(nodeIndex); - m_nodeList->at(nodeIndex) = NULL; + m_nodeList->at(nodeIndex) = nullptr; delete node; @@ -171,7 +171,7 @@ void DynamicPathGraph::moveNode ( int nodeIndex, Vector const & newPosition ) { DynamicPathNode * node = _getNode(nodeIndex); - if(node != NULL) + if(node != nullptr) { node->setPosition_p(newPosition); @@ -230,7 +230,7 @@ void DynamicPathGraph::unlinkNode ( int nodeIndex ) { DynamicPathNode * node = _getNode(nodeIndex); - if(node == NULL) return; + if(node == nullptr) return; // ---------- @@ -254,7 +254,7 @@ void DynamicPathGraph::relinkNode ( int nodeIndex ) { DynamicPathNode * nodeA = _getNode(nodeIndex); - if(nodeA == NULL) return; + if(nodeA == nullptr) return; // ---------- @@ -268,7 +268,7 @@ void DynamicPathGraph::relinkNode ( int nodeIndex ) { DynamicPathNode * nodeB = _getNode(i); - if(nodeB == NULL) continue; + if(nodeB == nullptr) continue; if(nodeA == nodeB) continue; Vector const & posA = nodeA->getPosition_p(); @@ -314,7 +314,7 @@ void DynamicPathGraph::relinkNode ( int nodeIndex ) { DynamicPathNode * neighborNode = _getNode(neighborList[i]); - if(neighborNode != NULL) + if(neighborNode != nullptr) { neighborNode->markRedundantEdges(); neighborNode->removeMarkedEdges(); @@ -326,7 +326,7 @@ void DynamicPathGraph::relinkNode ( int nodeIndex ) DynamicPathNode * DynamicPathGraph::_getNode ( int nodeIndex ) { - if(nodeIndex == -1) return NULL; + if(nodeIndex == -1) return nullptr; return m_nodeList->at(nodeIndex); } @@ -335,7 +335,7 @@ DynamicPathNode * DynamicPathGraph::_getNode ( int nodeIndex ) DynamicPathNode const * DynamicPathGraph::_getNode ( int nodeIndex ) const { - if(nodeIndex == -1) return NULL; + if(nodeIndex == -1) return nullptr; return m_nodeList->at(nodeIndex); } diff --git a/engine/shared/library/sharedPathfinding/src/shared/DynamicPathGraph.h b/engine/shared/library/sharedPathfinding/src/shared/DynamicPathGraph.h index e2baf1f3..b778ac1a 100755 --- a/engine/shared/library/sharedPathfinding/src/shared/DynamicPathGraph.h +++ b/engine/shared/library/sharedPathfinding/src/shared/DynamicPathGraph.h @@ -20,7 +20,7 @@ class DynamicPathNode; // and remove nodes on the fly (such as city graphs) // DynamicPathGraph uses a sparse array to store its nodes. Calling -// getNode with a nodeIndex in [0,nodeCount) may return NULL. If you +// getNode with a nodeIndex in [0,nodeCount) may return nullptr. If you // want to know the number of live nodes in the graph, call getLiveNodeCount. class DynamicPathGraph : public PathGraph diff --git a/engine/shared/library/sharedPathfinding/src/shared/DynamicPathNode.cpp b/engine/shared/library/sharedPathfinding/src/shared/DynamicPathNode.cpp index 8f3798bf..b82efe57 100755 --- a/engine/shared/library/sharedPathfinding/src/shared/DynamicPathNode.cpp +++ b/engine/shared/library/sharedPathfinding/src/shared/DynamicPathNode.cpp @@ -105,7 +105,7 @@ bool DynamicPathNode::removeEdge ( int nodeIndex ) { DynamicPathNode * neighbor = _getGraph()->_getNode(nodeIndex); - if(neighbor == NULL) return false; + if(neighbor == nullptr) return false; if(!_removeEdge(nodeIndex)) return false; @@ -175,8 +175,8 @@ int DynamicPathNode::markRedundantEdges ( void ) const PathEdge const * edgeA = getEdge(i); PathEdge const * edgeB = getEdge(j); - if(edgeA == NULL) continue; - if(edgeB == NULL) continue; + if(edgeA == nullptr) continue; + if(edgeB == nullptr) continue; int iA = edgeA->getIndexA(); int iB = edgeA->getIndexB(); diff --git a/engine/shared/library/sharedPathfinding/src/shared/PathGraph.cpp b/engine/shared/library/sharedPathfinding/src/shared/PathGraph.cpp index a72faa92..0585dc87 100755 --- a/engine/shared/library/sharedPathfinding/src/shared/PathGraph.cpp +++ b/engine/shared/library/sharedPathfinding/src/shared/PathGraph.cpp @@ -69,7 +69,7 @@ int PathGraph::findNode ( PathNodeType type, int key ) const if(getEdgeCount(i) == 0) continue; - if((node != NULL) && (node->getType() == type) && (node->getKey() == key)) + if((node != nullptr) && (node->getType() == type) && (node->getKey() == key)) { return i; } @@ -88,7 +88,7 @@ int PathGraph::findEntrance ( int key ) const { PathNode const * node = getNode(i); - if(node == NULL) continue; + if(node == nullptr) continue; if(getEdgeCount(i) == 0) continue; @@ -119,7 +119,7 @@ int PathGraph::findNearestNode ( Vector const & position_p ) const { PathNode const * node = getNode(i); - if(node == NULL) continue; + if(node == nullptr) continue; if(getEdgeCount(i) == 0) continue; @@ -148,7 +148,7 @@ int PathGraph::findNearestNode ( PathNodeType searchType, Vector const & positio { PathNode const * node = getNode(i); - if(node == NULL) continue; + if(node == nullptr) continue; if(getEdgeCount(i) == 0) continue; @@ -180,7 +180,7 @@ void PathGraph::findNodesInRange ( Vector const & position_p, float range, PathN { PathNode const * node = getNode(i); - if(node == NULL) continue; + if(node == nullptr) continue; if(getEdgeCount(i) == 0) continue; diff --git a/engine/shared/library/sharedPathfinding/src/shared/PathGraphIterator.cpp b/engine/shared/library/sharedPathfinding/src/shared/PathGraphIterator.cpp index 92a4dc10..d22b581c 100755 --- a/engine/shared/library/sharedPathfinding/src/shared/PathGraphIterator.cpp +++ b/engine/shared/library/sharedPathfinding/src/shared/PathGraphIterator.cpp @@ -14,7 +14,7 @@ // ====================================================================== PathGraphIterator::PathGraphIterator () -: m_graph(NULL), +: m_graph(nullptr), m_nodeIndex(-1) { } @@ -29,18 +29,18 @@ PathGraphIterator::PathGraphIterator ( PathGraph const * graph, int nodeIndex ) bool PathGraphIterator::isValid ( void ) const { - return (m_graph != NULL) && (m_nodeIndex != -1) && (m_graph->getNode(m_nodeIndex) != NULL); + return (m_graph != nullptr) && (m_nodeIndex != -1) && (m_graph->getNode(m_nodeIndex) != nullptr); } PathNode const * PathGraphIterator::getNode ( void ) const { - if( (m_graph != NULL) && (m_nodeIndex != -1) ) + if( (m_graph != nullptr) && (m_nodeIndex != -1) ) { return m_graph->getNode( m_nodeIndex ); } else { - return NULL; + return nullptr; } } @@ -53,7 +53,7 @@ int PathGraphIterator::getNeighborCount ( void ) const PathNode const * PathGraphIterator::getNeighbor ( int whichNeighbor ) const { - if(!isValid()) return NULL; + if(!isValid()) return nullptr; return m_graph->getNode( m_graph->getEdge( m_nodeIndex, whichNeighbor )->getIndexB() ); } diff --git a/engine/shared/library/sharedPathfinding/src/shared/PathNode.cpp b/engine/shared/library/sharedPathfinding/src/shared/PathNode.cpp index 6ff18223..1eec246d 100755 --- a/engine/shared/library/sharedPathfinding/src/shared/PathNode.cpp +++ b/engine/shared/library/sharedPathfinding/src/shared/PathNode.cpp @@ -13,7 +13,7 @@ // ====================================================================== PathNode::PathNode() -: m_graph(NULL), +: m_graph(nullptr), m_index(-1), m_id(-1), m_key(-1), @@ -27,7 +27,7 @@ PathNode::PathNode() } PathNode::PathNode ( Vector const & position ) -: m_graph(NULL), +: m_graph(nullptr), m_index(-1), m_id(-1), m_key(-1), diff --git a/engine/shared/library/sharedPathfinding/src/shared/PathSearch.cpp b/engine/shared/library/sharedPathfinding/src/shared/PathSearch.cpp index 42abd9d7..e09a5cab 100755 --- a/engine/shared/library/sharedPathfinding/src/shared/PathSearch.cpp +++ b/engine/shared/library/sharedPathfinding/src/shared/PathSearch.cpp @@ -137,7 +137,7 @@ MEMORY_BLOCK_MANAGER_IMPLEMENTATION_WITH_INSTALL(PathSearchNode, true, 0, 0, 0); PathSearchNode::PathSearchNode ( PathSearch * search, PathGraph const * graph, PathNode const * node ) : m_search(search), - m_parent(NULL), + m_parent(nullptr), m_graph(graph), m_node(node), m_queued(false), @@ -164,13 +164,13 @@ PathSearchNode * PathSearchNode::getNeighbor ( int whichNeighbor ) PathNode const * neighborNode = m_graph->getNode(neighborIndex); - if(neighborNode != NULL) + if(neighborNode != nullptr) { return getSearchNode(neighborNode); } else { - return NULL; + return nullptr; } } @@ -180,7 +180,7 @@ PathSearchNode * PathSearchNode::createSearchNode( PathNode const * node ) { // doing bad voodoo with the node marks - PathSearchNode * oldNode = NULL; + PathSearchNode * oldNode = nullptr; int mark = node->getMark(3); @@ -206,7 +206,7 @@ PathSearchNode * PathSearchNode::getSearchNode( PathNode const * node ) { // doing bad voodoo with the node marks - PathSearchNode * searchNode = NULL; + PathSearchNode * searchNode = nullptr; int mark = node->getMark(3); @@ -215,7 +215,7 @@ PathSearchNode * PathSearchNode::getSearchNode( PathNode const * node ) searchNode = (PathSearchNode*)((void*)mark); } - if(searchNode == NULL) + if(searchNode == nullptr) { return createSearchNode(node); } @@ -305,9 +305,9 @@ void PathSearch::install() // ---------------------------------------------------------------------- PathSearch::PathSearch ( void ) -: m_graph(NULL), - m_start(NULL), - m_goal(NULL), +: m_graph(nullptr), + m_start(nullptr), + m_goal(nullptr), m_multiGoal(false), m_goals(new NodeList()), m_queue(new PathSearchQueue()), @@ -321,16 +321,16 @@ PathSearch::PathSearch ( void ) PathSearch::~PathSearch() { delete m_goals; - m_goals = NULL; + m_goals = nullptr; delete m_queue; - m_queue = NULL; + m_queue = nullptr; delete m_path; - m_path = NULL; + m_path = nullptr; delete m_visitedNodes; - m_visitedNodes = NULL; + m_visitedNodes = nullptr; } // ---------------------------------------------------------------------- @@ -361,7 +361,7 @@ PathSearchNode * PathSearch::search ( void ) { PathSearchNode * neighbor = node->getNeighbor(i); - if(neighbor != NULL) + if(neighbor != nullptr) { float newCost = node->getCost() + costBetween(node->getPathNode(),neighbor->getPathNode()); @@ -377,7 +377,7 @@ PathSearchNode * PathSearch::search ( void ) } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -395,8 +395,8 @@ bool PathSearch::search ( PathGraph const * graph, int startIndex, int goalIndex m_goal = graph->getNode(goalIndex); m_multiGoal = false; - if(m_start == NULL) return false; - if(m_goal == NULL) return false; + if(m_start == nullptr) return false; + if(m_goal == nullptr) return false; m_path->clear(); @@ -429,7 +429,7 @@ bool PathSearch::search ( PathGraph const * graph, int startIndex, IndexList con int goalCount = goalIndices.size(); if(goalCount == 0) return false; - if(m_start == NULL) return false; + if(m_start == nullptr) return false; m_goals->resize(goalCount); @@ -455,7 +455,7 @@ bool PathSearch::search ( PathGraph const * graph, int startIndex, IndexList con bool PathSearch::buildPath ( PathSearchNode * endNode ) { - if( endNode == NULL ) + if( endNode == nullptr ) { m_path->clear(); return false; @@ -633,13 +633,13 @@ IndexList const & PathSearch::getPath ( void ) const bool PathSearch::atGoal ( PathSearchNode * searchNode ) const { - if(searchNode == NULL) return false; + if(searchNode == nullptr) return false; if(m_multiGoal) { PathNode const * pathNode = searchNode->getPathNode(); - if(pathNode == NULL) return false; + if(pathNode == nullptr) return false; return std::find( m_goals->begin(), m_goals->end(), pathNode ) != m_goals->end(); } diff --git a/engine/shared/library/sharedPathfinding/src/shared/Pathfinding.cpp b/engine/shared/library/sharedPathfinding/src/shared/Pathfinding.cpp index dc532a9a..67dfa06a 100755 --- a/engine/shared/library/sharedPathfinding/src/shared/Pathfinding.cpp +++ b/engine/shared/library/sharedPathfinding/src/shared/Pathfinding.cpp @@ -69,7 +69,7 @@ BaseClass * Pathfinding::graphFactory ( Iff & iff ) { DEBUG_WARNING(true,("Pathfinding::graphFactory - Don't know how to construct a path graph from the IFF in %s\n",iff.getFileName())); - return NULL; + return nullptr; } } diff --git a/engine/shared/library/sharedPathfinding/src/shared/SetupSharedPathfinding.cpp b/engine/shared/library/sharedPathfinding/src/shared/SetupSharedPathfinding.cpp index 304f3504..230186e9 100755 --- a/engine/shared/library/sharedPathfinding/src/shared/SetupSharedPathfinding.cpp +++ b/engine/shared/library/sharedPathfinding/src/shared/SetupSharedPathfinding.cpp @@ -67,7 +67,7 @@ int findNeighbor ( PathNode * node, PathNodeType neighborType, int neighborKey ) BaseClass * expandBuildingGraph ( PortalPropertyTemplate * portalTemplate, BaseClass * baseBuildingGraph ) { - if(baseBuildingGraph == NULL) return NULL; + if(baseBuildingGraph == nullptr) return nullptr; SimplePathGraph * buildingGraph = safe_cast(baseBuildingGraph); @@ -92,11 +92,11 @@ BaseClass * expandBuildingGraph ( PortalPropertyTemplate * portalTemplate, BaseC FloorMesh const * floorMesh = cell->getFloorMesh(); - if(floorMesh == NULL) continue; + if(floorMesh == nullptr) continue; PathGraph const * cellGraph = safe_cast(floorMesh->getPathGraph()); - if(cellGraph == NULL) continue; + if(cellGraph == nullptr) continue; // ---------- diff --git a/engine/shared/library/sharedPathfinding/src/shared/SimplePathGraph.cpp b/engine/shared/library/sharedPathfinding/src/shared/SimplePathGraph.cpp index d408d035..2673b2e6 100755 --- a/engine/shared/library/sharedPathfinding/src/shared/SimplePathGraph.cpp +++ b/engine/shared/library/sharedPathfinding/src/shared/SimplePathGraph.cpp @@ -39,7 +39,7 @@ void readArray_Class ( Iff & iff, T * & array, Tag tag ) { int count = iff.read_int32(); - if(array == NULL) array = new T(); + if(array == nullptr) array = new T(); array->resize(count); @@ -58,7 +58,7 @@ void readArray_Class ( Iff & iff, T * & array, Tag tag, Reader R ) { int count = iff.read_int32(); - if(array == NULL) array = new T(); + if(array == nullptr) array = new T(); array->resize(count); @@ -77,7 +77,7 @@ void readArray_Struct ( Iff & iff, T * & array, Tag tag ) { int count = iff.read_int32(); - if(array == NULL) array = new T(); + if(array == nullptr) array = new T(); array->resize(count); @@ -157,7 +157,7 @@ SimplePathGraph::SimplePathGraph ( PathGraphType type ) { #ifdef _DEBUG - m_debugLines = NULL; + m_debugLines = nullptr; #endif } @@ -181,7 +181,7 @@ SimplePathGraph::SimplePathGraph( SimplePathGraph::NodeList * nodes, SimplePathG #ifdef _DEBUG - m_debugLines = NULL; + m_debugLines = nullptr; #endif } @@ -189,21 +189,21 @@ SimplePathGraph::SimplePathGraph( SimplePathGraph::NodeList * nodes, SimplePathG SimplePathGraph::~SimplePathGraph() { delete m_nodes; - m_nodes = NULL; + m_nodes = nullptr; delete m_edges; - m_edges = NULL; + m_edges = nullptr; delete m_edgeCounts; - m_edgeCounts = NULL; + m_edgeCounts = nullptr; delete m_edgeStarts; - m_edgeStarts = NULL; + m_edgeStarts = nullptr; #ifdef _DEBUG delete m_debugLines; - m_debugLines = NULL; + m_debugLines = nullptr; #endif } @@ -265,7 +265,7 @@ PathNode * SimplePathGraph::getNode ( int nodeIndex ) if (static_cast(nodeIndex) < m_nodes->size()) return &m_nodes->at(nodeIndex); - return NULL; + return nullptr; } PathNode const * SimplePathGraph::getNode ( int nodeIndex ) const @@ -273,7 +273,7 @@ PathNode const * SimplePathGraph::getNode ( int nodeIndex ) const if (static_cast(nodeIndex) < m_nodes->size()) return &m_nodes->at(nodeIndex); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -507,7 +507,7 @@ void SimplePathGraph::drawDebugShapes ( DebugShapeRenderer * renderer ) const #ifdef _DEBUG - if(renderer == NULL) return; + if(renderer == nullptr) return; if( m_debugLines ) renderer->drawLineList( *m_debugLines, VectorArgb::solidYellow ); diff --git a/engine/shared/library/sharedRemoteDebugServer/src/shared/SharedRemoteDebugServer.cpp b/engine/shared/library/sharedRemoteDebugServer/src/shared/SharedRemoteDebugServer.cpp index 0e305c96..f33204ef 100755 --- a/engine/shared/library/sharedRemoteDebugServer/src/shared/SharedRemoteDebugServer.cpp +++ b/engine/shared/library/sharedRemoteDebugServer/src/shared/SharedRemoteDebugServer.cpp @@ -27,8 +27,8 @@ unsigned int SharedRemoteDebugServer::ms_remoteDebugToolChanne void SharedRemoteDebugServer::install() { - ms_serviceHandle = NULL; - ms_connection = NULL; + ms_serviceHandle = nullptr; + ms_connection = nullptr; if (!ConfigSharedFoundation::getUseRemoteDebug()) return; @@ -41,7 +41,7 @@ void SharedRemoteDebugServer::install() ms_serviceHandle = new Service(ConnectionAllocator(), setup); //even though this is the game client, this is a remoteDebug *server*, since it sends data to a Qt app for viewing - RemoteDebugServer::install(NULL, open, close, send, NULL); + RemoteDebugServer::install(nullptr, open, close, send, nullptr); //this value needs to be true before the call to RemoteDebugServer::open ms_installed = true; @@ -84,7 +84,7 @@ void SharedRemoteDebugServer::close(void) { DEBUG_FATAL(!ms_installed, ("sharedRemoteDebugServer not installed")); delete ms_connection; - ms_connection = NULL; + ms_connection = nullptr; } //------------------------------------------------------------------- diff --git a/engine/shared/library/sharedRemoteDebugServer/src/shared/SharedRemoteDebugServerConnection.cpp b/engine/shared/library/sharedRemoteDebugServer/src/shared/SharedRemoteDebugServerConnection.cpp index ef51481a..ac6fcd1b 100755 --- a/engine/shared/library/sharedRemoteDebugServer/src/shared/SharedRemoteDebugServerConnection.cpp +++ b/engine/shared/library/sharedRemoteDebugServer/src/shared/SharedRemoteDebugServerConnection.cpp @@ -16,7 +16,7 @@ SharedRemoteDebugServerConnection::SharedRemoteDebugServerConnection(const std::string & a, const unsigned short p) : Connection(a, p, NetworkSetupData()), -m_remotedebugCommandChannel (NULL) +m_remotedebugCommandChannel (nullptr) { } @@ -24,7 +24,7 @@ m_remotedebugCommandChannel (NULL) SharedRemoteDebugServerConnection::SharedRemoteDebugServerConnection(UdpConnectionMT * u, TcpClient * t) : Connection(u, t), -m_remotedebugCommandChannel (NULL) +m_remotedebugCommandChannel (nullptr) { } diff --git a/engine/shared/library/sharedSkillSystem/src/shared/ExpertiseManager.cpp b/engine/shared/library/sharedSkillSystem/src/shared/ExpertiseManager.cpp index 3326d378..17b9bc40 100755 --- a/engine/shared/library/sharedSkillSystem/src/shared/ExpertiseManager.cpp +++ b/engine/shared/library/sharedSkillSystem/src/shared/ExpertiseManager.cpp @@ -298,7 +298,7 @@ int const ExpertiseManager::getNumExpertiseTiers() * exist. * * @return - skill object for expertise at grid location. - * returns NULL if none found + * returns nullptr if none found */ SkillObject const * ExpertiseManager::getExpertiseSkillAt(int tree, int tier, int grid, int rank) { diff --git a/engine/shared/library/sharedSkillSystem/src/shared/LevelManager.cpp b/engine/shared/library/sharedSkillSystem/src/shared/LevelManager.cpp index 12195492..5c81ffea 100755 --- a/engine/shared/library/sharedSkillSystem/src/shared/LevelManager.cpp +++ b/engine/shared/library/sharedSkillSystem/src/shared/LevelManager.cpp @@ -335,7 +335,7 @@ void LevelManager::updateLevelDataWithSkill(LevelData &levelData, std::string co //====================================================================== // Find the level corresponding to the xp value and -// returns null if not found +// returns nullptr if not found LevelRecord const * LevelManagerNamespace::getLevelRecord(int xp) { LevelRecordsIterator itr = ms_levelRecords.begin(); @@ -365,7 +365,7 @@ LevelRecord const * LevelManagerNamespace::getLevelRecord(int xp) WARNING(true, ("getLevelRecord: Couldn't find level for xp value[%d]\n", xp)); - return NULL; + return nullptr; } //====================================================================== diff --git a/engine/shared/library/sharedSkillSystem/src/shared/SkillManager.cpp b/engine/shared/library/sharedSkillSystem/src/shared/SkillManager.cpp index c92f73c4..e0bc3718 100755 --- a/engine/shared/library/sharedSkillSystem/src/shared/SkillManager.cpp +++ b/engine/shared/library/sharedSkillSystem/src/shared/SkillManager.cpp @@ -18,7 +18,7 @@ #include #include -SkillManager *SkillManager::ms_instance = NULL; +SkillManager *SkillManager::ms_instance = nullptr; const std::string &SkillManager::cms_skillsDatatableName = "datatables/skill/skills.iff"; //----------------------------------------------------------------- @@ -92,7 +92,7 @@ void SkillManager::remove() { DEBUG_FATAL (!ms_instance, ("SkillManager not installed")); delete ms_instance; - ms_instance = NULL; + ms_instance = nullptr; } //---------------------------------------------------------------------- @@ -170,7 +170,7 @@ const SkillObject * SkillManager::loadSkill(const std::string & skillName) uint32 SkillManager::getDefaultXpLimit(const std::string & experienceType) { - if (m_xpLimitMap != NULL) + if (m_xpLimitMap != nullptr) { XpLimitMap::const_iterator result = m_xpLimitMap->find(experienceType); if (result != m_xpLimitMap->end()) @@ -183,13 +183,13 @@ uint32 SkillManager::getDefaultXpLimit(const std::string & experienceType) void SkillManager::initXpLimits() { - if (m_xpLimitTable == NULL) + if (m_xpLimitTable == nullptr) { WARNING(true, ("SkillManager::initXpLimits, m_xpLimitTable not initialized")); return; } - if (m_xpLimitMap == NULL) + if (m_xpLimitMap == nullptr) { WARNING(true, ("SkillManager::initXpLimits, m_xpLimitMap not initialized")); return; diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerArmorTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerArmorTemplate.cpp index d6f5b854..c162ae34 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerArmorTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerArmorTemplate.cpp @@ -45,7 +45,7 @@ ServerArmorTemplate::~ServerArmorTemplate() for (iter = m_specialProtection.begin(); iter != m_specialProtection.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_specialProtection.clear(); } @@ -97,10 +97,10 @@ Tag ServerArmorTemplate::getTemplateVersion(void) const */ Tag ServerArmorTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerArmorTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerArmorTemplate::getHighestTemplateVersion @@ -114,9 +114,9 @@ CompilerIntegerParam * ServerArmorTemplate::getCompilerIntegerParam(const char * { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_rating; } @@ -128,9 +128,9 @@ CompilerIntegerParam * ServerArmorTemplate::getCompilerIntegerParam(const char * { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_integrity; } @@ -142,9 +142,9 @@ CompilerIntegerParam * ServerArmorTemplate::getCompilerIntegerParam(const char * { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_effectiveness; } @@ -156,9 +156,9 @@ CompilerIntegerParam * ServerArmorTemplate::getCompilerIntegerParam(const char * { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_vulnerability; } @@ -170,9 +170,9 @@ CompilerIntegerParam * ServerArmorTemplate::getCompilerIntegerParam(const char * { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_encumbrance[index]; } @@ -180,7 +180,7 @@ CompilerIntegerParam * ServerArmorTemplate::getCompilerIntegerParam(const char * } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerArmorTemplate::getCompilerIntegerParam FloatParam * ServerArmorTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -229,7 +229,7 @@ StructParamOT * ServerArmorTemplate::getStructParamOT(const char *name, bool dee } else return TpfTemplate::getStructParamOT(name, deepCheck, index); - return NULL; + return nullptr; } //ServerArmorTemplate::getStructParamOT TriggerVolumeParam * ServerArmorTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index) @@ -316,12 +316,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -355,7 +355,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_specialProtection.begin(); iter != m_specialProtection.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_specialProtection.clear(); m_specialProtectionAppend = file.read_bool8(); @@ -532,9 +532,9 @@ CompilerIntegerParam * ServerArmorTemplate::_SpecialProtection::getCompilerInteg { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_type; } @@ -546,9 +546,9 @@ CompilerIntegerParam * ServerArmorTemplate::_SpecialProtection::getCompilerInteg { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_effectiveness; } @@ -556,7 +556,7 @@ CompilerIntegerParam * ServerArmorTemplate::_SpecialProtection::getCompilerInteg } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerArmorTemplate::_SpecialProtection::getCompilerIntegerParam FloatParam * ServerArmorTemplate::_SpecialProtection::getFloatParam(const char *name, bool deepCheck, int index) diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerBattlefieldMarkerObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerBattlefieldMarkerObjectTemplate.cpp index 4394895d..aa5440ae 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerBattlefieldMarkerObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerBattlefieldMarkerObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerBattlefieldMarkerObjectTemplate::getTemplateVersion(void) const */ Tag ServerBattlefieldMarkerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerBattlefieldMarkerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerBattlefieldMarkerObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerBuildingObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerBuildingObjectTemplate.cpp index ba0b7c07..40cf8c4e 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerBuildingObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerBuildingObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerBuildingObjectTemplate::getTemplateVersion(void) const */ Tag ServerBuildingObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerBuildingObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerBuildingObjectTemplate::getHighestTemplateVersion @@ -103,9 +103,9 @@ CompilerIntegerParam * ServerBuildingObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_maintenanceCost; } @@ -113,7 +113,7 @@ CompilerIntegerParam * ServerBuildingObjectTemplate::getCompilerIntegerParam(con } else return ServerTangibleObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerBuildingObjectTemplate::getCompilerIntegerParam FloatParam * ServerBuildingObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -129,9 +129,9 @@ BoolParam * ServerBuildingObjectTemplate::getBoolParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_isPublic; } @@ -139,7 +139,7 @@ BoolParam * ServerBuildingObjectTemplate::getBoolParam(const char *name, bool de } else return ServerTangibleObjectTemplate::getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerBuildingObjectTemplate::getBoolParam StringParam * ServerBuildingObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) @@ -227,12 +227,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerCellObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerCellObjectTemplate.cpp index 95175f0f..427b3931 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerCellObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerCellObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerCellObjectTemplate::getTemplateVersion(void) const */ Tag ServerCellObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerCellObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerCellObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerCityObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerCityObjectTemplate.cpp index b3f18a79..ac48b340 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerCityObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerCityObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerCityObjectTemplate::getTemplateVersion(void) const */ Tag ServerCityObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerCityObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerCityObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerConstructionContractObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerConstructionContractObjectTemplate.cpp index 9a0f8848..73096b66 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerConstructionContractObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerConstructionContractObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerConstructionContractObjectTemplate::getTemplateVersion(void) const */ Tag ServerConstructionContractObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerConstructionContractObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerConstructionContractObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerCreatureObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerCreatureObjectTemplate.cpp index 7159e108..f63f0d43 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerCreatureObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerCreatureObjectTemplate.cpp @@ -45,7 +45,7 @@ ServerCreatureObjectTemplate::~ServerCreatureObjectTemplate() for (iter = m_attribMods.begin(); iter != m_attribMods.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_attribMods.clear(); } @@ -97,10 +97,10 @@ Tag ServerCreatureObjectTemplate::getTemplateVersion(void) const */ Tag ServerCreatureObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerCreatureObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerCreatureObjectTemplate::getHighestTemplateVersion @@ -114,9 +114,9 @@ CompilerIntegerParam * ServerCreatureObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_attributes[index]; } @@ -128,9 +128,9 @@ CompilerIntegerParam * ServerCreatureObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_minAttributes[index]; } @@ -142,9 +142,9 @@ CompilerIntegerParam * ServerCreatureObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_maxAttributes[index]; } @@ -156,9 +156,9 @@ CompilerIntegerParam * ServerCreatureObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_shockWounds; } @@ -166,7 +166,7 @@ CompilerIntegerParam * ServerCreatureObjectTemplate::getCompilerIntegerParam(con } else return ServerTangibleObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerCreatureObjectTemplate::getCompilerIntegerParam FloatParam * ServerCreatureObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -177,9 +177,9 @@ FloatParam * ServerCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_minDrainModifier; } @@ -191,9 +191,9 @@ FloatParam * ServerCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_maxDrainModifier; } @@ -205,9 +205,9 @@ FloatParam * ServerCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_minFaucetModifier; } @@ -219,9 +219,9 @@ FloatParam * ServerCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_maxFaucetModifier; } @@ -233,9 +233,9 @@ FloatParam * ServerCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_approachTriggerRange; } @@ -247,9 +247,9 @@ FloatParam * ServerCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_maxMentalStates[index]; } @@ -261,9 +261,9 @@ FloatParam * ServerCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_mentalStatesDecay[index]; } @@ -271,7 +271,7 @@ FloatParam * ServerCreatureObjectTemplate::getFloatParam(const char *name, bool } else return ServerTangibleObjectTemplate::getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerCreatureObjectTemplate::getFloatParam BoolParam * ServerCreatureObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) @@ -282,9 +282,9 @@ BoolParam * ServerCreatureObjectTemplate::getBoolParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_canCreateAvatar; } @@ -292,7 +292,7 @@ BoolParam * ServerCreatureObjectTemplate::getBoolParam(const char *name, bool de } else return ServerTangibleObjectTemplate::getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerCreatureObjectTemplate::getBoolParam StringParam * ServerCreatureObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) @@ -303,9 +303,9 @@ StringParam * ServerCreatureObjectTemplate::getStringParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_defaultWeapon; } @@ -317,9 +317,9 @@ StringParam * ServerCreatureObjectTemplate::getStringParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_nameGeneratorType; } @@ -327,7 +327,7 @@ StringParam * ServerCreatureObjectTemplate::getStringParam(const char *name, boo } else return ServerTangibleObjectTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerCreatureObjectTemplate::getStringParam StringIdParam * ServerCreatureObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -361,7 +361,7 @@ StructParamOT * ServerCreatureObjectTemplate::getStructParamOT(const char *name, } else return ServerTangibleObjectTemplate::getStructParamOT(name, deepCheck, index); - return NULL; + return nullptr; } //ServerCreatureObjectTemplate::getStructParamOT TriggerVolumeParam * ServerCreatureObjectTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index) @@ -464,12 +464,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -549,7 +549,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_attribMods.begin(); iter != m_attribMods.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_attribMods.clear(); m_attribModsAppend = file.read_bool8(); diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerDraftSchematicObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerDraftSchematicObjectTemplate.cpp index 0bc765a5..53c05125 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerDraftSchematicObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerDraftSchematicObjectTemplate.cpp @@ -49,7 +49,7 @@ ServerDraftSchematicObjectTemplate::~ServerDraftSchematicObjectTemplate() for (iter = m_slots.begin(); iter != m_slots.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_slots.clear(); } @@ -58,7 +58,7 @@ ServerDraftSchematicObjectTemplate::~ServerDraftSchematicObjectTemplate() for (iter = m_skillCommands.begin(); iter != m_skillCommands.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_skillCommands.clear(); } @@ -67,7 +67,7 @@ ServerDraftSchematicObjectTemplate::~ServerDraftSchematicObjectTemplate() for (iter = m_manufactureScripts.begin(); iter != m_manufactureScripts.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_manufactureScripts.clear(); } @@ -119,10 +119,10 @@ Tag ServerDraftSchematicObjectTemplate::getTemplateVersion(void) const */ Tag ServerDraftSchematicObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerDraftSchematicObjectTemplate::getHighestTemplateVersion @@ -136,9 +136,9 @@ CompilerIntegerParam * ServerDraftSchematicObjectTemplate::getCompilerIntegerPar { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_category; } @@ -150,9 +150,9 @@ CompilerIntegerParam * ServerDraftSchematicObjectTemplate::getCompilerIntegerPar { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_itemsPerContainer; } @@ -160,7 +160,7 @@ CompilerIntegerParam * ServerDraftSchematicObjectTemplate::getCompilerIntegerPar } else return ServerIntangibleObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerDraftSchematicObjectTemplate::getCompilerIntegerParam FloatParam * ServerDraftSchematicObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -171,9 +171,9 @@ FloatParam * ServerDraftSchematicObjectTemplate::getFloatParam(const char *name, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_manufactureTime; } @@ -185,9 +185,9 @@ FloatParam * ServerDraftSchematicObjectTemplate::getFloatParam(const char *name, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_prototypeTime; } @@ -195,7 +195,7 @@ FloatParam * ServerDraftSchematicObjectTemplate::getFloatParam(const char *name, } else return ServerIntangibleObjectTemplate::getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerDraftSchematicObjectTemplate::getFloatParam BoolParam * ServerDraftSchematicObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) @@ -206,9 +206,9 @@ BoolParam * ServerDraftSchematicObjectTemplate::getBoolParam(const char *name, b { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_destroyIngredients; } @@ -216,7 +216,7 @@ BoolParam * ServerDraftSchematicObjectTemplate::getBoolParam(const char *name, b } else return ServerIntangibleObjectTemplate::getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerDraftSchematicObjectTemplate::getBoolParam StringParam * ServerDraftSchematicObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) @@ -227,9 +227,9 @@ StringParam * ServerDraftSchematicObjectTemplate::getStringParam(const char *nam { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_craftedObjectTemplate; } @@ -241,9 +241,9 @@ StringParam * ServerDraftSchematicObjectTemplate::getStringParam(const char *nam { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_crateObjectTemplate; } @@ -275,7 +275,7 @@ StringParam * ServerDraftSchematicObjectTemplate::getStringParam(const char *nam } else return ServerIntangibleObjectTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerDraftSchematicObjectTemplate::getStringParam StringIdParam * ServerDraftSchematicObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -309,7 +309,7 @@ StructParamOT * ServerDraftSchematicObjectTemplate::getStructParamOT(const char } else return ServerIntangibleObjectTemplate::getStructParamOT(name, deepCheck, index); - return NULL; + return nullptr; } //ServerDraftSchematicObjectTemplate::getStructParamOT TriggerVolumeParam * ServerDraftSchematicObjectTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index) @@ -418,12 +418,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -457,7 +457,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_slots.begin(); iter != m_slots.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_slots.clear(); m_slotsAppend = file.read_bool8(); @@ -476,7 +476,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_skillCommands.begin(); iter != m_skillCommands.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_skillCommands.clear(); m_skillCommandsAppend = file.read_bool8(); @@ -497,7 +497,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_manufactureScripts.begin(); iter != m_manufactureScripts.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_manufactureScripts.clear(); m_manufactureScriptsAppend = file.read_bool8(); @@ -672,7 +672,7 @@ ServerDraftSchematicObjectTemplate::_IngredientSlot::~_IngredientSlot() for (iter = m_options.begin(); iter != m_options.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_options.clear(); } @@ -719,9 +719,9 @@ FloatParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getFloatParam( { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_complexity; } @@ -729,7 +729,7 @@ FloatParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getFloatParam( } else return TpfTemplate::getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerDraftSchematicObjectTemplate::_IngredientSlot::getFloatParam BoolParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getBoolParam(const char *name, bool deepCheck, int index) @@ -740,9 +740,9 @@ BoolParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getBoolParam(co { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_optional; } @@ -750,7 +750,7 @@ BoolParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getBoolParam(co } else return TpfTemplate::getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerDraftSchematicObjectTemplate::_IngredientSlot::getBoolParam StringParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getStringParam(const char *name, bool deepCheck, int index) @@ -761,9 +761,9 @@ StringParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getStringPara { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_optionalSkillCommand; } @@ -775,9 +775,9 @@ StringParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getStringPara { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_appearance; } @@ -785,7 +785,7 @@ StringParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getStringPara } else return TpfTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerDraftSchematicObjectTemplate::_IngredientSlot::getStringParam StringIdParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getStringIdParam(const char *name, bool deepCheck, int index) @@ -796,9 +796,9 @@ StringIdParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getStringId { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_name; } @@ -806,7 +806,7 @@ StringIdParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getStringId } else return TpfTemplate::getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerDraftSchematicObjectTemplate::_IngredientSlot::getStringIdParam VectorParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getVectorParam(const char *name, bool deepCheck, int index) @@ -835,7 +835,7 @@ StructParamOT * ServerDraftSchematicObjectTemplate::_IngredientSlot::getStructPa } else return TpfTemplate::getStructParamOT(name, deepCheck, index); - return NULL; + return nullptr; } //ServerDraftSchematicObjectTemplate::_IngredientSlot::getStructParamOT TriggerVolumeParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getTriggerVolumeParam(const char *name, bool deepCheck, int index) @@ -921,7 +921,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_options.begin(); iter != m_options.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_options.clear(); m_optionsAppend = file.read_bool8(); diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerFactoryObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerFactoryObjectTemplate.cpp index cd7ab927..a4d8ae8d 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerFactoryObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerFactoryObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerFactoryObjectTemplate::getTemplateVersion(void) const */ Tag ServerFactoryObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerFactoryObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerFactoryObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerGroupObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerGroupObjectTemplate.cpp index 647b6606..a4c0367a 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerGroupObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerGroupObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerGroupObjectTemplate::getTemplateVersion(void) const */ Tag ServerGroupObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerGroupObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerGroupObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerGuildObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerGuildObjectTemplate.cpp index 446f3c34..b212df70 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerGuildObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerGuildObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerGuildObjectTemplate::getTemplateVersion(void) const */ Tag ServerGuildObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerGuildObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerGuildObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerHarvesterInstallationObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerHarvesterInstallationObjectTemplate.cpp index 7bfaaf19..6516811d 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerHarvesterInstallationObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerHarvesterInstallationObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerHarvesterInstallationObjectTemplate::getTemplateVersion(void) const */ Tag ServerHarvesterInstallationObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerHarvesterInstallationObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerHarvesterInstallationObjectTemplate::getHighestTemplateVersion @@ -103,9 +103,9 @@ CompilerIntegerParam * ServerHarvesterInstallationObjectTemplate::getCompilerInt { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_maxExtractionRate; } @@ -117,9 +117,9 @@ CompilerIntegerParam * ServerHarvesterInstallationObjectTemplate::getCompilerInt { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_currentExtractionRate; } @@ -131,9 +131,9 @@ CompilerIntegerParam * ServerHarvesterInstallationObjectTemplate::getCompilerInt { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_maxHopperSize; } @@ -141,7 +141,7 @@ CompilerIntegerParam * ServerHarvesterInstallationObjectTemplate::getCompilerInt } else return ServerInstallationObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerHarvesterInstallationObjectTemplate::getCompilerIntegerParam FloatParam * ServerHarvesterInstallationObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -162,9 +162,9 @@ StringParam * ServerHarvesterInstallationObjectTemplate::getStringParam(const ch { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_masterClassName; } @@ -172,7 +172,7 @@ StringParam * ServerHarvesterInstallationObjectTemplate::getStringParam(const ch } else return ServerInstallationObjectTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerHarvesterInstallationObjectTemplate::getStringParam StringIdParam * ServerHarvesterInstallationObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -255,12 +255,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerInstallationObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerInstallationObjectTemplate.cpp index efc11fee..6525ffe2 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerInstallationObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerInstallationObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerInstallationObjectTemplate::getTemplateVersion(void) const */ Tag ServerInstallationObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerInstallationObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerInstallationObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerIntangibleObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerIntangibleObjectTemplate.cpp index efdbfac9..43781914 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerIntangibleObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerIntangibleObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerIntangibleObjectTemplate::getTemplateVersion(void) const */ Tag ServerIntangibleObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerIntangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerIntangibleObjectTemplate::getHighestTemplateVersion @@ -103,9 +103,9 @@ CompilerIntegerParam * ServerIntangibleObjectTemplate::getCompilerIntegerParam(c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_count; } @@ -113,7 +113,7 @@ CompilerIntegerParam * ServerIntangibleObjectTemplate::getCompilerIntegerParam(c } else return ServerObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerIntangibleObjectTemplate::getCompilerIntegerParam FloatParam * ServerIntangibleObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -211,12 +211,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -316,7 +316,7 @@ ServerIntangibleObjectTemplate::_Ingredient::~_Ingredient() for (iter = m_ingredients.begin(); iter != m_ingredients.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_ingredients.clear(); } @@ -358,9 +358,9 @@ CompilerIntegerParam * ServerIntangibleObjectTemplate::_Ingredient::getCompilerI { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_ingredientType; } @@ -368,7 +368,7 @@ CompilerIntegerParam * ServerIntangibleObjectTemplate::_Ingredient::getCompilerI } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerIntangibleObjectTemplate::_Ingredient::getCompilerIntegerParam FloatParam * ServerIntangibleObjectTemplate::_Ingredient::getFloatParam(const char *name, bool deepCheck, int index) @@ -379,9 +379,9 @@ FloatParam * ServerIntangibleObjectTemplate::_Ingredient::getFloatParam(const ch { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_complexity; } @@ -389,7 +389,7 @@ FloatParam * ServerIntangibleObjectTemplate::_Ingredient::getFloatParam(const ch } else return TpfTemplate::getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerIntangibleObjectTemplate::_Ingredient::getFloatParam BoolParam * ServerIntangibleObjectTemplate::_Ingredient::getBoolParam(const char *name, bool deepCheck, int index) @@ -405,9 +405,9 @@ StringParam * ServerIntangibleObjectTemplate::_Ingredient::getStringParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_skillCommand; } @@ -415,7 +415,7 @@ StringParam * ServerIntangibleObjectTemplate::_Ingredient::getStringParam(const } else return TpfTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerIntangibleObjectTemplate::_Ingredient::getStringParam StringIdParam * ServerIntangibleObjectTemplate::_Ingredient::getStringIdParam(const char *name, bool deepCheck, int index) @@ -449,7 +449,7 @@ StructParamOT * ServerIntangibleObjectTemplate::_Ingredient::getStructParamOT(co } else return TpfTemplate::getStructParamOT(name, deepCheck, index); - return NULL; + return nullptr; } //ServerIntangibleObjectTemplate::_Ingredient::getStructParamOT TriggerVolumeParam * ServerIntangibleObjectTemplate::_Ingredient::getTriggerVolumeParam(const char *name, bool deepCheck, int index) @@ -533,7 +533,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_ingredients.begin(); iter != m_ingredients.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_ingredients.clear(); m_ingredientsAppend = file.read_bool8(); @@ -669,9 +669,9 @@ CompilerIntegerParam * ServerIntangibleObjectTemplate::_SchematicAttribute::getC { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_value; } @@ -679,7 +679,7 @@ CompilerIntegerParam * ServerIntangibleObjectTemplate::_SchematicAttribute::getC } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerIntangibleObjectTemplate::_SchematicAttribute::getCompilerIntegerParam FloatParam * ServerIntangibleObjectTemplate::_SchematicAttribute::getFloatParam(const char *name, bool deepCheck, int index) @@ -705,9 +705,9 @@ StringIdParam * ServerIntangibleObjectTemplate::_SchematicAttribute::getStringId { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_name; } @@ -715,7 +715,7 @@ StringIdParam * ServerIntangibleObjectTemplate::_SchematicAttribute::getStringId } else return TpfTemplate::getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerIntangibleObjectTemplate::_SchematicAttribute::getStringIdParam VectorParam * ServerIntangibleObjectTemplate::_SchematicAttribute::getVectorParam(const char *name, bool deepCheck, int index) @@ -889,9 +889,9 @@ CompilerIntegerParam * ServerIntangibleObjectTemplate::_SimpleIngredient::getCom { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_count; } @@ -899,7 +899,7 @@ CompilerIntegerParam * ServerIntangibleObjectTemplate::_SimpleIngredient::getCom } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerIntangibleObjectTemplate::_SimpleIngredient::getCompilerIntegerParam FloatParam * ServerIntangibleObjectTemplate::_SimpleIngredient::getFloatParam(const char *name, bool deepCheck, int index) @@ -920,9 +920,9 @@ StringParam * ServerIntangibleObjectTemplate::_SimpleIngredient::getStringParam( { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_ingredient; } @@ -930,7 +930,7 @@ StringParam * ServerIntangibleObjectTemplate::_SimpleIngredient::getStringParam( } else return TpfTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerIntangibleObjectTemplate::_SimpleIngredient::getStringParam StringIdParam * ServerIntangibleObjectTemplate::_SimpleIngredient::getStringIdParam(const char *name, bool deepCheck, int index) @@ -941,9 +941,9 @@ StringIdParam * ServerIntangibleObjectTemplate::_SimpleIngredient::getStringIdPa { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_name; } @@ -951,7 +951,7 @@ StringIdParam * ServerIntangibleObjectTemplate::_SimpleIngredient::getStringIdPa } else return TpfTemplate::getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerIntangibleObjectTemplate::_SimpleIngredient::getStringIdParam VectorParam * ServerIntangibleObjectTemplate::_SimpleIngredient::getVectorParam(const char *name, bool deepCheck, int index) diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerJediManagerObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerJediManagerObjectTemplate.cpp index 34919f61..acecbef1 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerJediManagerObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerJediManagerObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerJediManagerObjectTemplate::getTemplateVersion(void) const */ Tag ServerJediManagerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerJediManagerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerJediManagerObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerManufactureInstallationObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerManufactureInstallationObjectTemplate.cpp index 82335f44..1747392d 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerManufactureInstallationObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerManufactureInstallationObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerManufactureInstallationObjectTemplate::getTemplateVersion(void) const */ Tag ServerManufactureInstallationObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerManufactureInstallationObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerManufactureInstallationObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerManufactureSchematicObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerManufactureSchematicObjectTemplate.cpp index 54bbda83..73735880 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerManufactureSchematicObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerManufactureSchematicObjectTemplate.cpp @@ -47,7 +47,7 @@ ServerManufactureSchematicObjectTemplate::~ServerManufactureSchematicObjectTempl for (iter = m_ingredients.begin(); iter != m_ingredients.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_ingredients.clear(); } @@ -56,7 +56,7 @@ ServerManufactureSchematicObjectTemplate::~ServerManufactureSchematicObjectTempl for (iter = m_attributes.begin(); iter != m_attributes.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_attributes.clear(); } @@ -108,10 +108,10 @@ Tag ServerManufactureSchematicObjectTemplate::getTemplateVersion(void) const */ Tag ServerManufactureSchematicObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerManufactureSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerManufactureSchematicObjectTemplate::getHighestTemplateVersion @@ -125,9 +125,9 @@ CompilerIntegerParam * ServerManufactureSchematicObjectTemplate::getCompilerInte { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_itemCount; } @@ -135,7 +135,7 @@ CompilerIntegerParam * ServerManufactureSchematicObjectTemplate::getCompilerInte } else return ServerIntangibleObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerManufactureSchematicObjectTemplate::getCompilerIntegerParam FloatParam * ServerManufactureSchematicObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -156,9 +156,9 @@ StringParam * ServerManufactureSchematicObjectTemplate::getStringParam(const cha { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_draftSchematic; } @@ -170,9 +170,9 @@ StringParam * ServerManufactureSchematicObjectTemplate::getStringParam(const cha { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_creator; } @@ -180,7 +180,7 @@ StringParam * ServerManufactureSchematicObjectTemplate::getStringParam(const cha } else return ServerIntangibleObjectTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerManufactureSchematicObjectTemplate::getStringParam StringIdParam * ServerManufactureSchematicObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -226,7 +226,7 @@ StructParamOT * ServerManufactureSchematicObjectTemplate::getStructParamOT(const } else return ServerIntangibleObjectTemplate::getStructParamOT(name, deepCheck, index); - return NULL; + return nullptr; } //ServerManufactureSchematicObjectTemplate::getStructParamOT TriggerVolumeParam * ServerManufactureSchematicObjectTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index) @@ -324,12 +324,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -361,7 +361,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_ingredients.begin(); iter != m_ingredients.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_ingredients.clear(); m_ingredientsAppend = file.read_bool8(); @@ -382,7 +382,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_attributes.begin(); iter != m_attributes.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_attributes.clear(); m_attributesAppend = file.read_bool8(); @@ -563,9 +563,9 @@ StringIdParam * ServerManufactureSchematicObjectTemplate::_IngredientSlot::getSt { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_name; } @@ -573,7 +573,7 @@ StringIdParam * ServerManufactureSchematicObjectTemplate::_IngredientSlot::getSt } else return TpfTemplate::getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerManufactureSchematicObjectTemplate::_IngredientSlot::getStringIdParam VectorParam * ServerManufactureSchematicObjectTemplate::_IngredientSlot::getVectorParam(const char *name, bool deepCheck, int index) @@ -594,9 +594,9 @@ StructParamOT * ServerManufactureSchematicObjectTemplate::_IngredientSlot::getSt { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStructParamOT(name, deepCheck, index); - return NULL; + return nullptr; } return &m_ingredient; } @@ -604,7 +604,7 @@ StructParamOT * ServerManufactureSchematicObjectTemplate::_IngredientSlot::getSt } else return TpfTemplate::getStructParamOT(name, deepCheck, index); - return NULL; + return nullptr; } //ServerManufactureSchematicObjectTemplate::_IngredientSlot::getStructParamOT TriggerVolumeParam * ServerManufactureSchematicObjectTemplate::_IngredientSlot::getTriggerVolumeParam(const char *name, bool deepCheck, int index) diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerMissionObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerMissionObjectTemplate.cpp index 39ab71f1..240882ac 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerMissionObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerMissionObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerMissionObjectTemplate::getTemplateVersion(void) const */ Tag ServerMissionObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerMissionObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerMissionObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerObjectTemplate.cpp index 0307ce8c..5df8660b 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerObjectTemplate.cpp @@ -55,7 +55,7 @@ ServerObjectTemplate::~ServerObjectTemplate() for (iter = m_scripts.begin(); iter != m_scripts.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_scripts.clear(); } @@ -64,7 +64,7 @@ ServerObjectTemplate::~ServerObjectTemplate() for (iter = m_visibleFlags.begin(); iter != m_visibleFlags.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_visibleFlags.clear(); } @@ -73,7 +73,7 @@ ServerObjectTemplate::~ServerObjectTemplate() for (iter = m_deleteFlags.begin(); iter != m_deleteFlags.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_deleteFlags.clear(); } @@ -82,7 +82,7 @@ ServerObjectTemplate::~ServerObjectTemplate() for (iter = m_moveFlags.begin(); iter != m_moveFlags.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_moveFlags.clear(); } @@ -91,7 +91,7 @@ ServerObjectTemplate::~ServerObjectTemplate() for (iter = m_contents.begin(); iter != m_contents.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_contents.clear(); } @@ -100,7 +100,7 @@ ServerObjectTemplate::~ServerObjectTemplate() for (iter = m_xpPoints.begin(); iter != m_xpPoints.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_xpPoints.clear(); } @@ -152,10 +152,10 @@ Tag ServerObjectTemplate::getTemplateVersion(void) const */ Tag ServerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerObjectTemplate::getHighestTemplateVersion @@ -169,9 +169,9 @@ CompilerIntegerParam * ServerObjectTemplate::getCompilerIntegerParam(const char { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_volume; } @@ -219,9 +219,9 @@ CompilerIntegerParam * ServerObjectTemplate::getCompilerIntegerParam(const char { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_tintIndex; } @@ -229,7 +229,7 @@ CompilerIntegerParam * ServerObjectTemplate::getCompilerIntegerParam(const char } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerObjectTemplate::getCompilerIntegerParam FloatParam * ServerObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -240,9 +240,9 @@ FloatParam * ServerObjectTemplate::getFloatParam(const char *name, bool deepChec { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_complexity; } @@ -254,9 +254,9 @@ FloatParam * ServerObjectTemplate::getFloatParam(const char *name, bool deepChec { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_updateRanges[index]; } @@ -264,7 +264,7 @@ FloatParam * ServerObjectTemplate::getFloatParam(const char *name, bool deepChec } else return TpfTemplate::getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerObjectTemplate::getFloatParam BoolParam * ServerObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) @@ -275,9 +275,9 @@ BoolParam * ServerObjectTemplate::getBoolParam(const char *name, bool deepCheck, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_invulnerable; } @@ -289,9 +289,9 @@ BoolParam * ServerObjectTemplate::getBoolParam(const char *name, bool deepCheck, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_persistByDefault; } @@ -303,9 +303,9 @@ BoolParam * ServerObjectTemplate::getBoolParam(const char *name, bool deepCheck, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_persistContents; } @@ -313,7 +313,7 @@ BoolParam * ServerObjectTemplate::getBoolParam(const char *name, bool deepCheck, } else return TpfTemplate::getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerObjectTemplate::getBoolParam StringParam * ServerObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) @@ -324,9 +324,9 @@ StringParam * ServerObjectTemplate::getStringParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_sharedTemplate; } @@ -346,7 +346,7 @@ StringParam * ServerObjectTemplate::getStringParam(const char *name, bool deepCh } else return TpfTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerObjectTemplate::getStringParam StringIdParam * ServerObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -367,9 +367,9 @@ DynamicVariableParam * ServerObjectTemplate::getDynamicVariableParam(const char { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getDynamicVariableParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_objvars; } @@ -377,7 +377,7 @@ DynamicVariableParam * ServerObjectTemplate::getDynamicVariableParam(const char } else return TpfTemplate::getDynamicVariableParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerObjectTemplate::getDynamicVariableParam StructParamOT * ServerObjectTemplate::getStructParamOT(const char *name, bool deepCheck, int index) @@ -408,7 +408,7 @@ StructParamOT * ServerObjectTemplate::getStructParamOT(const char *name, bool de } else return TpfTemplate::getStructParamOT(name, deepCheck, index); - return NULL; + return nullptr; } //ServerObjectTemplate::getStructParamOT TriggerVolumeParam * ServerObjectTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index) @@ -562,12 +562,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -597,7 +597,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_scripts.begin(); iter != m_scripts.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_scripts.clear(); m_scriptsAppend = file.read_bool8(); @@ -620,7 +620,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_visibleFlags.begin(); iter != m_visibleFlags.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_visibleFlags.clear(); m_visibleFlagsAppend = file.read_bool8(); @@ -639,7 +639,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_deleteFlags.begin(); iter != m_deleteFlags.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_deleteFlags.clear(); m_deleteFlagsAppend = file.read_bool8(); @@ -658,7 +658,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_moveFlags.begin(); iter != m_moveFlags.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_moveFlags.clear(); m_moveFlagsAppend = file.read_bool8(); @@ -697,7 +697,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_contents.begin(); iter != m_contents.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_contents.clear(); m_contentsAppend = file.read_bool8(); @@ -716,7 +716,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_xpPoints.begin(); iter != m_xpPoints.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_xpPoints.clear(); m_xpPointsAppend = file.read_bool8(); @@ -980,9 +980,9 @@ CompilerIntegerParam * ServerObjectTemplate::_AttribMod::getCompilerIntegerParam { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_target; } @@ -994,9 +994,9 @@ CompilerIntegerParam * ServerObjectTemplate::_AttribMod::getCompilerIntegerParam { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_value; } @@ -1004,7 +1004,7 @@ CompilerIntegerParam * ServerObjectTemplate::_AttribMod::getCompilerIntegerParam } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerObjectTemplate::_AttribMod::getCompilerIntegerParam FloatParam * ServerObjectTemplate::_AttribMod::getFloatParam(const char *name, bool deepCheck, int index) @@ -1015,9 +1015,9 @@ FloatParam * ServerObjectTemplate::_AttribMod::getFloatParam(const char *name, b { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_time; } @@ -1029,9 +1029,9 @@ FloatParam * ServerObjectTemplate::_AttribMod::getFloatParam(const char *name, b { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_timeAtValue; } @@ -1043,9 +1043,9 @@ FloatParam * ServerObjectTemplate::_AttribMod::getFloatParam(const char *name, b { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_decay; } @@ -1053,7 +1053,7 @@ FloatParam * ServerObjectTemplate::_AttribMod::getFloatParam(const char *name, b } else return TpfTemplate::getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerObjectTemplate::_AttribMod::getFloatParam BoolParam * ServerObjectTemplate::_AttribMod::getBoolParam(const char *name, bool deepCheck, int index) @@ -1276,9 +1276,9 @@ BoolParam * ServerObjectTemplate::_Contents::getBoolParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_equipObject; } @@ -1286,7 +1286,7 @@ BoolParam * ServerObjectTemplate::_Contents::getBoolParam(const char *name, bool } else return TpfTemplate::getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerObjectTemplate::_Contents::getBoolParam StringParam * ServerObjectTemplate::_Contents::getStringParam(const char *name, bool deepCheck, int index) @@ -1297,9 +1297,9 @@ StringParam * ServerObjectTemplate::_Contents::getStringParam(const char *name, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_slotName; } @@ -1311,9 +1311,9 @@ StringParam * ServerObjectTemplate::_Contents::getStringParam(const char *name, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_content; } @@ -1321,7 +1321,7 @@ StringParam * ServerObjectTemplate::_Contents::getStringParam(const char *name, } else return TpfTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerObjectTemplate::_Contents::getStringParam StringIdParam * ServerObjectTemplate::_Contents::getStringIdParam(const char *name, bool deepCheck, int index) @@ -1508,9 +1508,9 @@ CompilerIntegerParam * ServerObjectTemplate::_MentalStateMod::getCompilerInteger { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_target; } @@ -1518,7 +1518,7 @@ CompilerIntegerParam * ServerObjectTemplate::_MentalStateMod::getCompilerInteger } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerObjectTemplate::_MentalStateMod::getCompilerIntegerParam FloatParam * ServerObjectTemplate::_MentalStateMod::getFloatParam(const char *name, bool deepCheck, int index) @@ -1529,9 +1529,9 @@ FloatParam * ServerObjectTemplate::_MentalStateMod::getFloatParam(const char *na { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_value; } @@ -1543,9 +1543,9 @@ FloatParam * ServerObjectTemplate::_MentalStateMod::getFloatParam(const char *na { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_time; } @@ -1557,9 +1557,9 @@ FloatParam * ServerObjectTemplate::_MentalStateMod::getFloatParam(const char *na { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_timeAtValue; } @@ -1571,9 +1571,9 @@ FloatParam * ServerObjectTemplate::_MentalStateMod::getFloatParam(const char *na { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_decay; } @@ -1581,7 +1581,7 @@ FloatParam * ServerObjectTemplate::_MentalStateMod::getFloatParam(const char *na } else return TpfTemplate::getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerObjectTemplate::_MentalStateMod::getFloatParam BoolParam * ServerObjectTemplate::_MentalStateMod::getBoolParam(const char *name, bool deepCheck, int index) @@ -1794,9 +1794,9 @@ CompilerIntegerParam * ServerObjectTemplate::_Xp::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_type; } @@ -1808,9 +1808,9 @@ CompilerIntegerParam * ServerObjectTemplate::_Xp::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_level; } @@ -1822,9 +1822,9 @@ CompilerIntegerParam * ServerObjectTemplate::_Xp::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_value; } @@ -1832,7 +1832,7 @@ CompilerIntegerParam * ServerObjectTemplate::_Xp::getCompilerIntegerParam(const } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerObjectTemplate::_Xp::getCompilerIntegerParam FloatParam * ServerObjectTemplate::_Xp::getFloatParam(const char *name, bool deepCheck, int index) diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerPlanetObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerPlanetObjectTemplate.cpp index 91f52345..fc998c4a 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerPlanetObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerPlanetObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerPlanetObjectTemplate::getTemplateVersion(void) const */ Tag ServerPlanetObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerPlanetObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerPlanetObjectTemplate::getHighestTemplateVersion @@ -118,9 +118,9 @@ StringParam * ServerPlanetObjectTemplate::getStringParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_planetName; } @@ -128,7 +128,7 @@ StringParam * ServerPlanetObjectTemplate::getStringParam(const char *name, bool } else return ServerUniverseObjectTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerPlanetObjectTemplate::getStringParam StringIdParam * ServerPlanetObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -211,12 +211,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerPlayerObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerPlayerObjectTemplate.cpp index 2824f83a..bd678142 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerPlayerObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerPlayerObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerPlayerObjectTemplate::getTemplateVersion(void) const */ Tag ServerPlayerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerPlayerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerPlayerObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerPlayerQuestObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerPlayerQuestObjectTemplate.cpp index 0c05dd79..36c23628 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerPlayerQuestObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerPlayerQuestObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerPlayerQuestObjectTemplate::getTemplateVersion(void) const */ Tag ServerPlayerQuestObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerPlayerQuestObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerPlayerQuestObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerResourceClassObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerResourceClassObjectTemplate.cpp index 2df53960..0a5c1bac 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerResourceClassObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerResourceClassObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerResourceClassObjectTemplate::getTemplateVersion(void) const */ Tag ServerResourceClassObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerResourceClassObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerResourceClassObjectTemplate::getHighestTemplateVersion @@ -103,9 +103,9 @@ CompilerIntegerParam * ServerResourceClassObjectTemplate::getCompilerIntegerPara { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_numTypes; } @@ -117,9 +117,9 @@ CompilerIntegerParam * ServerResourceClassObjectTemplate::getCompilerIntegerPara { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_minTypes; } @@ -131,9 +131,9 @@ CompilerIntegerParam * ServerResourceClassObjectTemplate::getCompilerIntegerPara { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_maxTypes; } @@ -141,7 +141,7 @@ CompilerIntegerParam * ServerResourceClassObjectTemplate::getCompilerIntegerPara } else return ServerUniverseObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerResourceClassObjectTemplate::getCompilerIntegerParam FloatParam * ServerResourceClassObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -162,9 +162,9 @@ StringParam * ServerResourceClassObjectTemplate::getStringParam(const char *name { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_resourceClassName; } @@ -176,9 +176,9 @@ StringParam * ServerResourceClassObjectTemplate::getStringParam(const char *name { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_parentClass; } @@ -186,7 +186,7 @@ StringParam * ServerResourceClassObjectTemplate::getStringParam(const char *name } else return ServerUniverseObjectTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerResourceClassObjectTemplate::getStringParam StringIdParam * ServerResourceClassObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -269,12 +269,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerResourceContainerObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerResourceContainerObjectTemplate.cpp index c5e367cc..c4008c2f 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerResourceContainerObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerResourceContainerObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerResourceContainerObjectTemplate::getTemplateVersion(void) const */ Tag ServerResourceContainerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerResourceContainerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerResourceContainerObjectTemplate::getHighestTemplateVersion @@ -103,9 +103,9 @@ CompilerIntegerParam * ServerResourceContainerObjectTemplate::getCompilerInteger { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_maxResources; } @@ -113,7 +113,7 @@ CompilerIntegerParam * ServerResourceContainerObjectTemplate::getCompilerInteger } else return ServerTangibleObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerResourceContainerObjectTemplate::getCompilerIntegerParam FloatParam * ServerResourceContainerObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -211,12 +211,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerResourcePoolObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerResourcePoolObjectTemplate.cpp index 6aa324d6..15ad8ebc 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerResourcePoolObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerResourcePoolObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerResourcePoolObjectTemplate::getTemplateVersion(void) const */ Tag ServerResourcePoolObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerResourcePoolObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerResourcePoolObjectTemplate::getHighestTemplateVersion @@ -103,9 +103,9 @@ CompilerIntegerParam * ServerResourcePoolObjectTemplate::getCompilerIntegerParam { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_mapSeed; } @@ -117,9 +117,9 @@ CompilerIntegerParam * ServerResourcePoolObjectTemplate::getCompilerIntegerParam { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_amountRemaining; } @@ -127,7 +127,7 @@ CompilerIntegerParam * ServerResourcePoolObjectTemplate::getCompilerIntegerParam } else return ServerUniverseObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerResourcePoolObjectTemplate::getCompilerIntegerParam FloatParam * ServerResourcePoolObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -225,12 +225,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerResourceTypeObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerResourceTypeObjectTemplate.cpp index dd44c902..7ed9954d 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerResourceTypeObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerResourceTypeObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerResourceTypeObjectTemplate::getTemplateVersion(void) const */ Tag ServerResourceTypeObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerResourceTypeObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerResourceTypeObjectTemplate::getHighestTemplateVersion @@ -118,9 +118,9 @@ StringParam * ServerResourceTypeObjectTemplate::getStringParam(const char *name, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_resourceName; } @@ -128,7 +128,7 @@ StringParam * ServerResourceTypeObjectTemplate::getStringParam(const char *name, } else return ServerUniverseObjectTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerResourceTypeObjectTemplate::getStringParam StringIdParam * ServerResourceTypeObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -211,12 +211,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerShipObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerShipObjectTemplate.cpp index 247bda11..c1bb613c 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerShipObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerShipObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerShipObjectTemplate::getTemplateVersion(void) const */ Tag ServerShipObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerShipObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerShipObjectTemplate::getHighestTemplateVersion @@ -118,9 +118,9 @@ StringParam * ServerShipObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_shipType; } @@ -128,7 +128,7 @@ StringParam * ServerShipObjectTemplate::getStringParam(const char *name, bool de } else return ServerTangibleObjectTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerShipObjectTemplate::getStringParam StringIdParam * ServerShipObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -211,12 +211,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerStaticObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerStaticObjectTemplate.cpp index fb078b58..48fe0b50 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerStaticObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerStaticObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerStaticObjectTemplate::getTemplateVersion(void) const */ Tag ServerStaticObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerStaticObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerStaticObjectTemplate::getHighestTemplateVersion @@ -113,9 +113,9 @@ BoolParam * ServerStaticObjectTemplate::getBoolParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_clientOnlyBuildout; } @@ -123,7 +123,7 @@ BoolParam * ServerStaticObjectTemplate::getBoolParam(const char *name, bool deep } else return ServerObjectTemplate::getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerStaticObjectTemplate::getBoolParam StringParam * ServerStaticObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) @@ -211,12 +211,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerTangibleObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerTangibleObjectTemplate.cpp index 5604b102..52fd36b3 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerTangibleObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerTangibleObjectTemplate.cpp @@ -45,7 +45,7 @@ ServerTangibleObjectTemplate::~ServerTangibleObjectTemplate() for (iter = m_triggerVolumes.begin(); iter != m_triggerVolumes.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_triggerVolumes.clear(); } @@ -97,10 +97,10 @@ Tag ServerTangibleObjectTemplate::getTemplateVersion(void) const */ Tag ServerTangibleObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerTangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerTangibleObjectTemplate::getHighestTemplateVersion @@ -114,9 +114,9 @@ CompilerIntegerParam * ServerTangibleObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_combatSkeleton; } @@ -128,9 +128,9 @@ CompilerIntegerParam * ServerTangibleObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_maxHitPoints; } @@ -142,9 +142,9 @@ CompilerIntegerParam * ServerTangibleObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_interestRadius; } @@ -156,9 +156,9 @@ CompilerIntegerParam * ServerTangibleObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_count; } @@ -170,9 +170,9 @@ CompilerIntegerParam * ServerTangibleObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_condition; } @@ -180,7 +180,7 @@ CompilerIntegerParam * ServerTangibleObjectTemplate::getCompilerIntegerParam(con } else return ServerObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerTangibleObjectTemplate::getCompilerIntegerParam FloatParam * ServerTangibleObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -196,9 +196,9 @@ BoolParam * ServerTangibleObjectTemplate::getBoolParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_wantSawAttackTriggers; } @@ -206,7 +206,7 @@ BoolParam * ServerTangibleObjectTemplate::getBoolParam(const char *name, bool de } else return ServerObjectTemplate::getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerTangibleObjectTemplate::getBoolParam StringParam * ServerTangibleObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) @@ -217,9 +217,9 @@ StringParam * ServerTangibleObjectTemplate::getStringParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_armor; } @@ -227,7 +227,7 @@ StringParam * ServerTangibleObjectTemplate::getStringParam(const char *name, boo } else return ServerObjectTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerTangibleObjectTemplate::getStringParam StringIdParam * ServerTangibleObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -266,7 +266,7 @@ TriggerVolumeParam * ServerTangibleObjectTemplate::getTriggerVolumeParam(const c } else return ServerObjectTemplate::getTriggerVolumeParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerTangibleObjectTemplate::getTriggerVolumeParam void ServerTangibleObjectTemplate::initStructParamOT(StructParamOT ¶m, const char *name) @@ -341,12 +341,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -374,7 +374,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_triggerVolumes.begin(); iter != m_triggerVolumes.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_triggerVolumes.clear(); m_triggerVolumesAppend = file.read_bool8(); diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerTokenObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerTokenObjectTemplate.cpp index b63a3f63..a3cac916 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerTokenObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerTokenObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerTokenObjectTemplate::getTemplateVersion(void) const */ Tag ServerTokenObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerTokenObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerTokenObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerUberObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerUberObjectTemplate.cpp index 20c3f1f8..6aba5832 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerUberObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerUberObjectTemplate.cpp @@ -87,7 +87,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_intListSimple.begin(); iter != m_intListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -95,7 +95,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_intListWeightedList.begin(); iter != m_intListWeightedList.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -103,7 +103,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_intListRandomRange.begin(); iter != m_intListRandomRange.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -111,7 +111,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_intListDiceRoll.begin(); iter != m_intListDiceRoll.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -119,7 +119,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_floatListSimple.begin(); iter != m_floatListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -127,7 +127,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_floatListWeightedList.begin(); iter != m_floatListWeightedList.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -135,7 +135,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_floatListRandomRange.begin(); iter != m_floatListRandomRange.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -143,7 +143,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_enumListIndexed.begin(); iter != m_enumListIndexed.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -151,7 +151,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_enumListWeightedList.begin(); iter != m_enumListWeightedList.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -159,7 +159,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_stringIdListSimple.begin(); iter != m_stringIdListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -167,7 +167,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_stringIdListWeightedList.begin(); iter != m_stringIdListWeightedList.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -175,7 +175,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_stringListSimple.begin(); iter != m_stringListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -183,7 +183,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_stringListWeightedList.begin(); iter != m_stringListWeightedList.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -191,7 +191,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_triggerVolumeList.begin(); iter != m_triggerVolumeList.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -199,7 +199,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_triggerVolumesListWeightedList.begin(); iter != m_triggerVolumesListWeightedList.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -207,7 +207,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_boolListDerived.begin(); iter != m_boolListDerived.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -215,7 +215,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_boolListSimple.begin(); iter != m_boolListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -223,7 +223,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_boolListWeightedList.begin(); iter != m_boolListWeightedList.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -231,7 +231,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_vectorListSimple.begin(); iter != m_vectorListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -239,7 +239,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_filenameListSimple.begin(); iter != m_filenameListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -247,7 +247,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_templateListSimple.begin(); iter != m_templateListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -255,7 +255,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_structListSimple.begin(); iter != m_structListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } //@END TFD CLEANUP @@ -306,10 +306,10 @@ Tag ServerUberObjectTemplate::getTemplateVersion(void) const */ Tag ServerUberObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerUberObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerUberObjectTemplate::getHighestTemplateVersion @@ -323,9 +323,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intAtDerived; } @@ -337,9 +337,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intSimple; } @@ -351,9 +351,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intSimpleDeltaPositive; } @@ -365,9 +365,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intSimpleDeltaNegative; } @@ -379,9 +379,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intSimpleDeltaPositivePercent; } @@ -393,9 +393,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intSimpleDeltaNegativePercent; } @@ -407,9 +407,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intWeightedList; } @@ -421,9 +421,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intWeightedListDeltaPositive; } @@ -435,9 +435,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intWeightedListDeltaNegative; } @@ -449,9 +449,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intWeightedListDeltaPositivePercent; } @@ -463,9 +463,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intWeightedListDeltaNegativePercent; } @@ -477,9 +477,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intRandomRange1; } @@ -491,9 +491,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intRandomRange2; } @@ -505,9 +505,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intRandomRange3; } @@ -519,9 +519,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intRandomRange4; } @@ -533,9 +533,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intDiceRoll1; } @@ -547,9 +547,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intDiceRoll2; } @@ -609,9 +609,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_enumIndexedByEnumSingle[index]; } @@ -623,9 +623,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_enumIndexedByEnumWeightedList[index]; } @@ -661,9 +661,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_integerArray[index]; } @@ -671,7 +671,7 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerUberObjectTemplate::getCompilerIntegerParam FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -682,9 +682,9 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_floatAtDerived; } @@ -696,9 +696,9 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_floatSimple; } @@ -710,9 +710,9 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_floatSimpleDeltaPositive; } @@ -724,9 +724,9 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_floatSimpleDeltaNegative; } @@ -738,9 +738,9 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_floatSimpleDeltaPositivePercent; } @@ -752,9 +752,9 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_floatSimpleDeltaNegativePercent; } @@ -766,9 +766,9 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_floatWeightedList; } @@ -780,9 +780,9 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_floatRandomRange1; } @@ -794,9 +794,9 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_floatRandomRange2; } @@ -808,9 +808,9 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_floatRandomRange3; } @@ -822,9 +822,9 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_floatRandomRange4; } @@ -872,9 +872,9 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_floatArray[index]; } @@ -882,7 +882,7 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep } else return TpfTemplate::getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerUberObjectTemplate::getFloatParam BoolParam * ServerUberObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) @@ -893,9 +893,9 @@ BoolParam * ServerUberObjectTemplate::getBoolParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_boolDerived; } @@ -907,9 +907,9 @@ BoolParam * ServerUberObjectTemplate::getBoolParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_boolSimple; } @@ -921,9 +921,9 @@ BoolParam * ServerUberObjectTemplate::getBoolParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_boolWeightedList; } @@ -971,9 +971,9 @@ BoolParam * ServerUberObjectTemplate::getBoolParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_boolArray[index]; } @@ -981,7 +981,7 @@ BoolParam * ServerUberObjectTemplate::getBoolParam(const char *name, bool deepCh } else return TpfTemplate::getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerUberObjectTemplate::getBoolParam StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) @@ -992,9 +992,9 @@ StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_stringDerived; } @@ -1006,9 +1006,9 @@ StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_stringSimple; } @@ -1020,9 +1020,9 @@ StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_stringWeightedList; } @@ -1058,9 +1058,9 @@ StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_filenameAtDerived; } @@ -1072,9 +1072,9 @@ StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_filenameSimple; } @@ -1086,9 +1086,9 @@ StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_filenameWeightedList; } @@ -1112,9 +1112,9 @@ StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_templateDerived; } @@ -1126,9 +1126,9 @@ StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_templateSimple; } @@ -1140,9 +1140,9 @@ StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_templateWeightedList; } @@ -1166,9 +1166,9 @@ StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_stringArray[index]; } @@ -1180,9 +1180,9 @@ StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_fileNameArray[index]; } @@ -1190,7 +1190,7 @@ StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool de } else return TpfTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerUberObjectTemplate::getStringParam StringIdParam * ServerUberObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -1201,9 +1201,9 @@ StringIdParam * ServerUberObjectTemplate::getStringIdParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_stringIdDerived; } @@ -1215,9 +1215,9 @@ StringIdParam * ServerUberObjectTemplate::getStringIdParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_stringIdSimple; } @@ -1229,9 +1229,9 @@ StringIdParam * ServerUberObjectTemplate::getStringIdParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_stringIdWeightedList; } @@ -1267,9 +1267,9 @@ StringIdParam * ServerUberObjectTemplate::getStringIdParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_stringIdArray[index]; } @@ -1277,7 +1277,7 @@ StringIdParam * ServerUberObjectTemplate::getStringIdParam(const char *name, boo } else return TpfTemplate::getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerUberObjectTemplate::getStringIdParam VectorParam * ServerUberObjectTemplate::getVectorParam(const char *name, bool deepCheck, int index) @@ -1288,9 +1288,9 @@ VectorParam * ServerUberObjectTemplate::getVectorParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getVectorParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_vectorAtDerived; } @@ -1302,9 +1302,9 @@ VectorParam * ServerUberObjectTemplate::getVectorParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getVectorParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_vectorSimple; } @@ -1328,9 +1328,9 @@ VectorParam * ServerUberObjectTemplate::getVectorParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getVectorParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_vectorArray[index]; } @@ -1338,7 +1338,7 @@ VectorParam * ServerUberObjectTemplate::getVectorParam(const char *name, bool de } else return TpfTemplate::getVectorParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerUberObjectTemplate::getVectorParam DynamicVariableParam * ServerUberObjectTemplate::getDynamicVariableParam(const char *name, bool deepCheck, int index) @@ -1349,9 +1349,9 @@ DynamicVariableParam * ServerUberObjectTemplate::getDynamicVariableParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getDynamicVariableParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_objvarDerived; } @@ -1363,9 +1363,9 @@ DynamicVariableParam * ServerUberObjectTemplate::getDynamicVariableParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getDynamicVariableParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_objvarSimple; } @@ -1373,7 +1373,7 @@ DynamicVariableParam * ServerUberObjectTemplate::getDynamicVariableParam(const c } else return TpfTemplate::getDynamicVariableParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerUberObjectTemplate::getDynamicVariableParam StructParamOT * ServerUberObjectTemplate::getStructParamOT(const char *name, bool deepCheck, int index) @@ -1384,9 +1384,9 @@ StructParamOT * ServerUberObjectTemplate::getStructParamOT(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStructParamOT(name, deepCheck, index); - return NULL; + return nullptr; } return &m_structAtDerived; } @@ -1398,9 +1398,9 @@ StructParamOT * ServerUberObjectTemplate::getStructParamOT(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStructParamOT(name, deepCheck, index); - return NULL; + return nullptr; } return &m_structSimple; } @@ -1424,9 +1424,9 @@ StructParamOT * ServerUberObjectTemplate::getStructParamOT(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStructParamOT(name, deepCheck, index); - return NULL; + return nullptr; } return &m_structArrayEnum[index]; } @@ -1438,9 +1438,9 @@ StructParamOT * ServerUberObjectTemplate::getStructParamOT(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStructParamOT(name, deepCheck, index); - return NULL; + return nullptr; } return &m_structArrayInteger[index]; } @@ -1448,7 +1448,7 @@ StructParamOT * ServerUberObjectTemplate::getStructParamOT(const char *name, boo } else return TpfTemplate::getStructParamOT(name, deepCheck, index); - return NULL; + return nullptr; } //ServerUberObjectTemplate::getStructParamOT TriggerVolumeParam * ServerUberObjectTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index) @@ -1459,9 +1459,9 @@ TriggerVolumeParam * ServerUberObjectTemplate::getTriggerVolumeParam(const char { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getTriggerVolumeParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_triggerVolumeDerived; } @@ -1473,9 +1473,9 @@ TriggerVolumeParam * ServerUberObjectTemplate::getTriggerVolumeParam(const char { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getTriggerVolumeParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_triggerVolumeSimple; } @@ -1487,9 +1487,9 @@ TriggerVolumeParam * ServerUberObjectTemplate::getTriggerVolumeParam(const char { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getTriggerVolumeParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_triggerVolumeWeightedList; } @@ -1525,9 +1525,9 @@ TriggerVolumeParam * ServerUberObjectTemplate::getTriggerVolumeParam(const char { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getTriggerVolumeParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_triggerArray[index]; } @@ -1535,7 +1535,7 @@ TriggerVolumeParam * ServerUberObjectTemplate::getTriggerVolumeParam(const char } else return TpfTemplate::getTriggerVolumeParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerUberObjectTemplate::getTriggerVolumeParam void ServerUberObjectTemplate::initStructParamOT(StructParamOT ¶m, const char *name) @@ -1942,12 +1942,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -2009,7 +2009,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_intListSimple.begin(); iter != m_intListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_intListSimpleAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2027,7 +2027,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_intListWeightedList.begin(); iter != m_intListWeightedList.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_intListWeightedListAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2045,7 +2045,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_intListRandomRange.begin(); iter != m_intListRandomRange.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_intListRandomRangeAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2063,7 +2063,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_intListDiceRoll.begin(); iter != m_intListDiceRoll.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_intListDiceRollAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2103,7 +2103,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_floatListSimple.begin(); iter != m_floatListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_floatListSimpleAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2121,7 +2121,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_floatListWeightedList.begin(); iter != m_floatListWeightedList.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_floatListWeightedListAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2139,7 +2139,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_floatListRandomRange.begin(); iter != m_floatListRandomRange.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_floatListRandomRangeAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2185,7 +2185,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_enumListIndexed.begin(); iter != m_enumListIndexed.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_enumListIndexedAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2203,7 +2203,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_enumListWeightedList.begin(); iter != m_enumListWeightedList.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_enumListWeightedListAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2227,7 +2227,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_stringIdListSimple.begin(); iter != m_stringIdListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_stringIdListSimpleAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2245,7 +2245,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_stringIdListWeightedList.begin(); iter != m_stringIdListWeightedList.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_stringIdListWeightedListAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2269,7 +2269,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_stringListSimple.begin(); iter != m_stringListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_stringListSimpleAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2287,7 +2287,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_stringListWeightedList.begin(); iter != m_stringListWeightedList.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_stringListWeightedListAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2311,7 +2311,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_triggerVolumeList.begin(); iter != m_triggerVolumeList.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_triggerVolumeListAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2329,7 +2329,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_triggerVolumesListWeightedList.begin(); iter != m_triggerVolumesListWeightedList.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_triggerVolumesListWeightedListAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2353,7 +2353,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_boolListDerived.begin(); iter != m_boolListDerived.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_boolListDerivedAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2371,7 +2371,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_boolListSimple.begin(); iter != m_boolListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_boolListSimpleAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2389,7 +2389,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_boolListWeightedList.begin(); iter != m_boolListWeightedList.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_boolListWeightedListAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2411,7 +2411,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_vectorListSimple.begin(); iter != m_vectorListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_vectorListSimpleAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2435,7 +2435,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_filenameListSimple.begin(); iter != m_filenameListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_filenameListSimpleAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2463,7 +2463,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_templateListSimple.begin(); iter != m_templateListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_templateListSimpleAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2485,7 +2485,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_structListSimple.begin(); iter != m_structListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_structListSimpleAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -3487,9 +3487,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::_Foo::getCompilerIntegerParam(c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_item1; } @@ -3497,7 +3497,7 @@ CompilerIntegerParam * ServerUberObjectTemplate::_Foo::getCompilerIntegerParam(c } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerUberObjectTemplate::_Foo::getCompilerIntegerParam FloatParam * ServerUberObjectTemplate::_Foo::getFloatParam(const char *name, bool deepCheck, int index) @@ -3508,9 +3508,9 @@ FloatParam * ServerUberObjectTemplate::_Foo::getFloatParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_item2; } @@ -3518,7 +3518,7 @@ FloatParam * ServerUberObjectTemplate::_Foo::getFloatParam(const char *name, boo } else return TpfTemplate::getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerUberObjectTemplate::_Foo::getFloatParam BoolParam * ServerUberObjectTemplate::_Foo::getBoolParam(const char *name, bool deepCheck, int index) @@ -3534,9 +3534,9 @@ StringParam * ServerUberObjectTemplate::_Foo::getStringParam(const char *name, b { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_item3; } @@ -3544,7 +3544,7 @@ StringParam * ServerUberObjectTemplate::_Foo::getStringParam(const char *name, b } else return TpfTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerUberObjectTemplate::_Foo::getStringParam StringIdParam * ServerUberObjectTemplate::_Foo::getStringIdParam(const char *name, bool deepCheck, int index) diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerUniverseObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerUniverseObjectTemplate.cpp index 359ddce6..7f4176f1 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerUniverseObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerUniverseObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerUniverseObjectTemplate::getTemplateVersion(void) const */ Tag ServerUniverseObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerUniverseObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerUniverseObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerVehicleObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerVehicleObjectTemplate.cpp index 663fdb2a..e204aa23 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerVehicleObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerVehicleObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerVehicleObjectTemplate::getTemplateVersion(void) const */ Tag ServerVehicleObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerVehicleObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerVehicleObjectTemplate::getHighestTemplateVersion @@ -108,9 +108,9 @@ FloatParam * ServerVehicleObjectTemplate::getFloatParam(const char *name, bool d { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_currentFuel; } @@ -122,9 +122,9 @@ FloatParam * ServerVehicleObjectTemplate::getFloatParam(const char *name, bool d { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_maxFuel; } @@ -136,9 +136,9 @@ FloatParam * ServerVehicleObjectTemplate::getFloatParam(const char *name, bool d { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_consumpsion; } @@ -146,7 +146,7 @@ FloatParam * ServerVehicleObjectTemplate::getFloatParam(const char *name, bool d } else return ServerTangibleObjectTemplate::getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerVehicleObjectTemplate::getFloatParam BoolParam * ServerVehicleObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) @@ -162,9 +162,9 @@ StringParam * ServerVehicleObjectTemplate::getStringParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_fuelType; } @@ -172,7 +172,7 @@ StringParam * ServerVehicleObjectTemplate::getStringParam(const char *name, bool } else return ServerTangibleObjectTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerVehicleObjectTemplate::getStringParam StringIdParam * ServerVehicleObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -255,12 +255,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerWaypointObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerWaypointObjectTemplate.cpp index 0cd323ea..23c83cd5 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerWaypointObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerWaypointObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerWaypointObjectTemplate::getTemplateVersion(void) const */ Tag ServerWaypointObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerWaypointObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerWaypointObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerWeaponObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerWeaponObjectTemplate.cpp index 54aa2726..65775fd0 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerWeaponObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerWeaponObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerWeaponObjectTemplate::getTemplateVersion(void) const */ Tag ServerWeaponObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerWeaponObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerWeaponObjectTemplate::getHighestTemplateVersion @@ -103,9 +103,9 @@ CompilerIntegerParam * ServerWeaponObjectTemplate::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_weaponType; } @@ -117,9 +117,9 @@ CompilerIntegerParam * ServerWeaponObjectTemplate::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_attackType; } @@ -131,9 +131,9 @@ CompilerIntegerParam * ServerWeaponObjectTemplate::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_damageType; } @@ -145,9 +145,9 @@ CompilerIntegerParam * ServerWeaponObjectTemplate::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_elementalType; } @@ -159,9 +159,9 @@ CompilerIntegerParam * ServerWeaponObjectTemplate::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_elementalValue; } @@ -173,9 +173,9 @@ CompilerIntegerParam * ServerWeaponObjectTemplate::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_minDamageAmount; } @@ -187,9 +187,9 @@ CompilerIntegerParam * ServerWeaponObjectTemplate::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_maxDamageAmount; } @@ -201,9 +201,9 @@ CompilerIntegerParam * ServerWeaponObjectTemplate::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_attackCost; } @@ -215,9 +215,9 @@ CompilerIntegerParam * ServerWeaponObjectTemplate::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_accuracy; } @@ -225,7 +225,7 @@ CompilerIntegerParam * ServerWeaponObjectTemplate::getCompilerIntegerParam(const } else return ServerTangibleObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerWeaponObjectTemplate::getCompilerIntegerParam FloatParam * ServerWeaponObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -236,9 +236,9 @@ FloatParam * ServerWeaponObjectTemplate::getFloatParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_attackSpeed; } @@ -250,9 +250,9 @@ FloatParam * ServerWeaponObjectTemplate::getFloatParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_audibleRange; } @@ -264,9 +264,9 @@ FloatParam * ServerWeaponObjectTemplate::getFloatParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_minRange; } @@ -278,9 +278,9 @@ FloatParam * ServerWeaponObjectTemplate::getFloatParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_maxRange; } @@ -292,9 +292,9 @@ FloatParam * ServerWeaponObjectTemplate::getFloatParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_damageRadius; } @@ -306,9 +306,9 @@ FloatParam * ServerWeaponObjectTemplate::getFloatParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_woundChance; } @@ -316,7 +316,7 @@ FloatParam * ServerWeaponObjectTemplate::getFloatParam(const char *name, bool de } else return ServerTangibleObjectTemplate::getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerWeaponObjectTemplate::getFloatParam BoolParam * ServerWeaponObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) @@ -409,12 +409,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerXpManagerObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerXpManagerObjectTemplate.cpp index b5969702..0725fed2 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerXpManagerObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerXpManagerObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerXpManagerObjectTemplate::getTemplateVersion(void) const */ Tag ServerXpManagerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerXpManagerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerXpManagerObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedBattlefieldMarkerObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedBattlefieldMarkerObjectTemplate.cpp index 21c891e3..a5bd8fe4 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedBattlefieldMarkerObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedBattlefieldMarkerObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedBattlefieldMarkerObjectTemplate::getTemplateVersion(void) const */ Tag SharedBattlefieldMarkerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedBattlefieldMarkerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedBattlefieldMarkerObjectTemplate::getHighestTemplateVersion @@ -103,9 +103,9 @@ CompilerIntegerParam * SharedBattlefieldMarkerObjectTemplate::getCompilerInteger { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_numberOfPoles; } @@ -113,7 +113,7 @@ CompilerIntegerParam * SharedBattlefieldMarkerObjectTemplate::getCompilerInteger } else return SharedTangibleObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedBattlefieldMarkerObjectTemplate::getCompilerIntegerParam FloatParam * SharedBattlefieldMarkerObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -124,9 +124,9 @@ FloatParam * SharedBattlefieldMarkerObjectTemplate::getFloatParam(const char *na { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_radius; } @@ -134,7 +134,7 @@ FloatParam * SharedBattlefieldMarkerObjectTemplate::getFloatParam(const char *na } else return SharedTangibleObjectTemplate::getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedBattlefieldMarkerObjectTemplate::getFloatParam BoolParam * SharedBattlefieldMarkerObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) @@ -227,12 +227,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedBuildingObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedBuildingObjectTemplate.cpp index 3af16bfb..f4bba6f0 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedBuildingObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedBuildingObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedBuildingObjectTemplate::getTemplateVersion(void) const */ Tag SharedBuildingObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedBuildingObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedBuildingObjectTemplate::getHighestTemplateVersion @@ -118,9 +118,9 @@ StringParam * SharedBuildingObjectTemplate::getStringParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_terrainModificationFileName; } @@ -132,9 +132,9 @@ StringParam * SharedBuildingObjectTemplate::getStringParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_interiorLayoutFileName; } @@ -142,7 +142,7 @@ StringParam * SharedBuildingObjectTemplate::getStringParam(const char *name, boo } else return SharedTangibleObjectTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedBuildingObjectTemplate::getStringParam StringIdParam * SharedBuildingObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -225,12 +225,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedCellObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedCellObjectTemplate.cpp index 7e96a950..1a71a06d 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedCellObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedCellObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedCellObjectTemplate::getTemplateVersion(void) const */ Tag SharedCellObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedCellObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedCellObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedConstructionContractObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedConstructionContractObjectTemplate.cpp index 7426b7c1..5c4b79e2 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedConstructionContractObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedConstructionContractObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedConstructionContractObjectTemplate::getTemplateVersion(void) const */ Tag SharedConstructionContractObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedConstructionContractObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedConstructionContractObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedCreatureObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedCreatureObjectTemplate.cpp index 913472e0..e4034d22 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedCreatureObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedCreatureObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedCreatureObjectTemplate::getTemplateVersion(void) const */ Tag SharedCreatureObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedCreatureObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedCreatureObjectTemplate::getHighestTemplateVersion @@ -103,9 +103,9 @@ CompilerIntegerParam * SharedCreatureObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_gender; } @@ -117,9 +117,9 @@ CompilerIntegerParam * SharedCreatureObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_niche; } @@ -131,9 +131,9 @@ CompilerIntegerParam * SharedCreatureObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_species; } @@ -145,9 +145,9 @@ CompilerIntegerParam * SharedCreatureObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_race; } @@ -155,7 +155,7 @@ CompilerIntegerParam * SharedCreatureObjectTemplate::getCompilerIntegerParam(con } else return SharedTangibleObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedCreatureObjectTemplate::getCompilerIntegerParam FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -166,9 +166,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_acceleration[index]; } @@ -180,9 +180,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_speed[index]; } @@ -194,9 +194,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_turnRate[index]; } @@ -208,9 +208,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_slopeModAngle; } @@ -222,9 +222,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_slopeModPercent; } @@ -236,9 +236,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_waterModPercent; } @@ -250,9 +250,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_stepHeight; } @@ -264,9 +264,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_collisionHeight; } @@ -278,9 +278,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_collisionRadius; } @@ -292,9 +292,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_swimHeight; } @@ -306,9 +306,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_warpTolerance; } @@ -320,9 +320,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_collisionOffsetX; } @@ -334,9 +334,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_collisionOffsetZ; } @@ -348,9 +348,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_collisionLength; } @@ -362,9 +362,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_cameraHeight; } @@ -372,7 +372,7 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool } else return SharedTangibleObjectTemplate::getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedCreatureObjectTemplate::getFloatParam BoolParam * SharedCreatureObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) @@ -383,9 +383,9 @@ BoolParam * SharedCreatureObjectTemplate::getBoolParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_postureAlignToTerrain[index]; } @@ -393,7 +393,7 @@ BoolParam * SharedCreatureObjectTemplate::getBoolParam(const char *name, bool de } else return SharedTangibleObjectTemplate::getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedCreatureObjectTemplate::getBoolParam StringParam * SharedCreatureObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) @@ -404,9 +404,9 @@ StringParam * SharedCreatureObjectTemplate::getStringParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_animationMapFilename; } @@ -418,9 +418,9 @@ StringParam * SharedCreatureObjectTemplate::getStringParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_movementDatatable; } @@ -428,7 +428,7 @@ StringParam * SharedCreatureObjectTemplate::getStringParam(const char *name, boo } else return SharedTangibleObjectTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedCreatureObjectTemplate::getStringParam StringIdParam * SharedCreatureObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -528,12 +528,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedDraftSchematicObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedDraftSchematicObjectTemplate.cpp index 3f651ac8..9c18023d 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedDraftSchematicObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedDraftSchematicObjectTemplate.cpp @@ -47,7 +47,7 @@ SharedDraftSchematicObjectTemplate::~SharedDraftSchematicObjectTemplate() for (iter = m_slots.begin(); iter != m_slots.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_slots.clear(); } @@ -56,7 +56,7 @@ SharedDraftSchematicObjectTemplate::~SharedDraftSchematicObjectTemplate() for (iter = m_attributes.begin(); iter != m_attributes.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_attributes.clear(); } @@ -108,10 +108,10 @@ Tag SharedDraftSchematicObjectTemplate::getTemplateVersion(void) const */ Tag SharedDraftSchematicObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedDraftSchematicObjectTemplate::getHighestTemplateVersion @@ -140,9 +140,9 @@ StringParam * SharedDraftSchematicObjectTemplate::getStringParam(const char *nam { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_craftedSharedTemplate; } @@ -150,7 +150,7 @@ StringParam * SharedDraftSchematicObjectTemplate::getStringParam(const char *nam } else return SharedIntangibleObjectTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedDraftSchematicObjectTemplate::getStringParam StringIdParam * SharedDraftSchematicObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -196,7 +196,7 @@ StructParamOT * SharedDraftSchematicObjectTemplate::getStructParamOT(const char } else return SharedIntangibleObjectTemplate::getStructParamOT(name, deepCheck, index); - return NULL; + return nullptr; } //SharedDraftSchematicObjectTemplate::getStructParamOT TriggerVolumeParam * SharedDraftSchematicObjectTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index) @@ -294,12 +294,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -327,7 +327,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_slots.begin(); iter != m_slots.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_slots.clear(); m_slotsAppend = file.read_bool8(); @@ -346,7 +346,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_attributes.begin(); iter != m_attributes.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_attributes.clear(); m_attributesAppend = file.read_bool8(); @@ -512,9 +512,9 @@ StringParam * SharedDraftSchematicObjectTemplate::_IngredientSlot::getStringPara { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_hardpoint; } @@ -522,7 +522,7 @@ StringParam * SharedDraftSchematicObjectTemplate::_IngredientSlot::getStringPara } else return TpfTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedDraftSchematicObjectTemplate::_IngredientSlot::getStringParam StringIdParam * SharedDraftSchematicObjectTemplate::_IngredientSlot::getStringIdParam(const char *name, bool deepCheck, int index) @@ -533,9 +533,9 @@ StringIdParam * SharedDraftSchematicObjectTemplate::_IngredientSlot::getStringId { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_name; } @@ -543,7 +543,7 @@ StringIdParam * SharedDraftSchematicObjectTemplate::_IngredientSlot::getStringId } else return TpfTemplate::getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedDraftSchematicObjectTemplate::_IngredientSlot::getStringIdParam VectorParam * SharedDraftSchematicObjectTemplate::_IngredientSlot::getVectorParam(const char *name, bool deepCheck, int index) @@ -717,9 +717,9 @@ CompilerIntegerParam * SharedDraftSchematicObjectTemplate::_SchematicAttribute:: { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_value; } @@ -727,7 +727,7 @@ CompilerIntegerParam * SharedDraftSchematicObjectTemplate::_SchematicAttribute:: } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedDraftSchematicObjectTemplate::_SchematicAttribute::getCompilerIntegerParam FloatParam * SharedDraftSchematicObjectTemplate::_SchematicAttribute::getFloatParam(const char *name, bool deepCheck, int index) @@ -753,9 +753,9 @@ StringIdParam * SharedDraftSchematicObjectTemplate::_SchematicAttribute::getStri { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_name; } @@ -767,9 +767,9 @@ StringIdParam * SharedDraftSchematicObjectTemplate::_SchematicAttribute::getStri { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_experiment; } @@ -777,7 +777,7 @@ StringIdParam * SharedDraftSchematicObjectTemplate::_SchematicAttribute::getStri } else return TpfTemplate::getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedDraftSchematicObjectTemplate::_SchematicAttribute::getStringIdParam VectorParam * SharedDraftSchematicObjectTemplate::_SchematicAttribute::getVectorParam(const char *name, bool deepCheck, int index) diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedFactoryObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedFactoryObjectTemplate.cpp index e917394d..3088f935 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedFactoryObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedFactoryObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedFactoryObjectTemplate::getTemplateVersion(void) const */ Tag SharedFactoryObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedFactoryObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedFactoryObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedGroupObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedGroupObjectTemplate.cpp index a5bb8830..6eecfb9e 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedGroupObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedGroupObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedGroupObjectTemplate::getTemplateVersion(void) const */ Tag SharedGroupObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedGroupObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedGroupObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedGuildObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedGuildObjectTemplate.cpp index 26ba6d9a..be710a73 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedGuildObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedGuildObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedGuildObjectTemplate::getTemplateVersion(void) const */ Tag SharedGuildObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedGuildObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedGuildObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedInstallationObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedInstallationObjectTemplate.cpp index 70ae2f01..3b396c5a 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedInstallationObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedInstallationObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedInstallationObjectTemplate::getTemplateVersion(void) const */ Tag SharedInstallationObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedInstallationObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedInstallationObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedIntangibleObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedIntangibleObjectTemplate.cpp index 67245c19..077b284d 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedIntangibleObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedIntangibleObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedIntangibleObjectTemplate::getTemplateVersion(void) const */ Tag SharedIntangibleObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedIntangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedIntangibleObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedJediManagerObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedJediManagerObjectTemplate.cpp index 0cce8f75..66b0ddfa 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedJediManagerObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedJediManagerObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedJediManagerObjectTemplate::getTemplateVersion(void) const */ Tag SharedJediManagerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedJediManagerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedJediManagerObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedManufactureSchematicObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedManufactureSchematicObjectTemplate.cpp index 3b860316..e1fa62c8 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedManufactureSchematicObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedManufactureSchematicObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedManufactureSchematicObjectTemplate::getTemplateVersion(void) const */ Tag SharedManufactureSchematicObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedManufactureSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedManufactureSchematicObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedMissionObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedMissionObjectTemplate.cpp index f52ed728..23330fc7 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedMissionObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedMissionObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedMissionObjectTemplate::getTemplateVersion(void) const */ Tag SharedMissionObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedMissionObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedMissionObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedObjectTemplate.cpp index ea1fa149..250ddd5c 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedObjectTemplate::getTemplateVersion(void) const */ Tag SharedObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedObjectTemplate::getHighestTemplateVersion @@ -103,9 +103,9 @@ CompilerIntegerParam * SharedObjectTemplate::getCompilerIntegerParam(const char { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_containerType; } @@ -117,9 +117,9 @@ CompilerIntegerParam * SharedObjectTemplate::getCompilerIntegerParam(const char { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_containerVolumeLimit; } @@ -131,9 +131,9 @@ CompilerIntegerParam * SharedObjectTemplate::getCompilerIntegerParam(const char { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_gameObjectType; } @@ -145,9 +145,9 @@ CompilerIntegerParam * SharedObjectTemplate::getCompilerIntegerParam(const char { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_surfaceType; } @@ -155,7 +155,7 @@ CompilerIntegerParam * SharedObjectTemplate::getCompilerIntegerParam(const char } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedObjectTemplate::getCompilerIntegerParam FloatParam * SharedObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -166,9 +166,9 @@ FloatParam * SharedObjectTemplate::getFloatParam(const char *name, bool deepChec { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_scale; } @@ -180,9 +180,9 @@ FloatParam * SharedObjectTemplate::getFloatParam(const char *name, bool deepChec { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_scaleThresholdBeforeExtentTest; } @@ -194,9 +194,9 @@ FloatParam * SharedObjectTemplate::getFloatParam(const char *name, bool deepChec { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_clearFloraRadius; } @@ -208,9 +208,9 @@ FloatParam * SharedObjectTemplate::getFloatParam(const char *name, bool deepChec { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_noBuildRadius; } @@ -222,9 +222,9 @@ FloatParam * SharedObjectTemplate::getFloatParam(const char *name, bool deepChec { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_locationReservationRadius; } @@ -232,7 +232,7 @@ FloatParam * SharedObjectTemplate::getFloatParam(const char *name, bool deepChec } else return TpfTemplate::getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedObjectTemplate::getFloatParam BoolParam * SharedObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) @@ -243,9 +243,9 @@ BoolParam * SharedObjectTemplate::getBoolParam(const char *name, bool deepCheck, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_snapToTerrain; } @@ -257,9 +257,9 @@ BoolParam * SharedObjectTemplate::getBoolParam(const char *name, bool deepCheck, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_sendToClient; } @@ -271,9 +271,9 @@ BoolParam * SharedObjectTemplate::getBoolParam(const char *name, bool deepCheck, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_onlyVisibleInTools; } @@ -285,9 +285,9 @@ BoolParam * SharedObjectTemplate::getBoolParam(const char *name, bool deepCheck, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_forceNoCollision; } @@ -295,7 +295,7 @@ BoolParam * SharedObjectTemplate::getBoolParam(const char *name, bool deepCheck, } else return TpfTemplate::getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedObjectTemplate::getBoolParam StringParam * SharedObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) @@ -306,9 +306,9 @@ StringParam * SharedObjectTemplate::getStringParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_tintPalette; } @@ -320,9 +320,9 @@ StringParam * SharedObjectTemplate::getStringParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_slotDescriptorFilename; } @@ -334,9 +334,9 @@ StringParam * SharedObjectTemplate::getStringParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_arrangementDescriptorFilename; } @@ -348,9 +348,9 @@ StringParam * SharedObjectTemplate::getStringParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_appearanceFilename; } @@ -362,9 +362,9 @@ StringParam * SharedObjectTemplate::getStringParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_portalLayoutFilename; } @@ -376,9 +376,9 @@ StringParam * SharedObjectTemplate::getStringParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_clientDataFile; } @@ -386,7 +386,7 @@ StringParam * SharedObjectTemplate::getStringParam(const char *name, bool deepCh } else return TpfTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedObjectTemplate::getStringParam StringIdParam * SharedObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -397,9 +397,9 @@ StringIdParam * SharedObjectTemplate::getStringIdParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_objectName; } @@ -411,9 +411,9 @@ StringIdParam * SharedObjectTemplate::getStringIdParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_detailedDescription; } @@ -425,9 +425,9 @@ StringIdParam * SharedObjectTemplate::getStringIdParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_lookAtText; } @@ -435,7 +435,7 @@ StringIdParam * SharedObjectTemplate::getStringIdParam(const char *name, bool de } else return TpfTemplate::getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedObjectTemplate::getStringIdParam VectorParam * SharedObjectTemplate::getVectorParam(const char *name, bool deepCheck, int index) @@ -513,12 +513,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedPlayerObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedPlayerObjectTemplate.cpp index b926fbb4..5d99e4c9 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedPlayerObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedPlayerObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedPlayerObjectTemplate::getTemplateVersion(void) const */ Tag SharedPlayerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedPlayerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedPlayerObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedPlayerQuestObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedPlayerQuestObjectTemplate.cpp index b9ed644e..f3b04e88 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedPlayerQuestObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedPlayerQuestObjectTemplate.cpp @@ -87,10 +87,10 @@ Tag SharedPlayerQuestObjectTemplate::getTemplateVersion(void) const */ Tag SharedPlayerQuestObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedPlayerQuestObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedPlayerQuestObjectTemplate::getHighestTemplateVersion @@ -196,12 +196,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedResourceContainerObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedResourceContainerObjectTemplate.cpp index e77a29d6..3ea96d3d 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedResourceContainerObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedResourceContainerObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedResourceContainerObjectTemplate::getTemplateVersion(void) const */ Tag SharedResourceContainerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedResourceContainerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedResourceContainerObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedShipObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedShipObjectTemplate.cpp index 25f8f375..d7705d97 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedShipObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedShipObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedShipObjectTemplate::getTemplateVersion(void) const */ Tag SharedShipObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedShipObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedShipObjectTemplate::getHighestTemplateVersion @@ -113,9 +113,9 @@ BoolParam * SharedShipObjectTemplate::getBoolParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_hasWings; } @@ -127,9 +127,9 @@ BoolParam * SharedShipObjectTemplate::getBoolParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_playerControlled; } @@ -137,7 +137,7 @@ BoolParam * SharedShipObjectTemplate::getBoolParam(const char *name, bool deepCh } else return SharedTangibleObjectTemplate::getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedShipObjectTemplate::getBoolParam StringParam * SharedShipObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) @@ -148,9 +148,9 @@ StringParam * SharedShipObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_cockpitFilename; } @@ -162,9 +162,9 @@ StringParam * SharedShipObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_interiorLayoutFileName; } @@ -172,7 +172,7 @@ StringParam * SharedShipObjectTemplate::getStringParam(const char *name, bool de } else return SharedTangibleObjectTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedShipObjectTemplate::getStringParam StringIdParam * SharedShipObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -255,12 +255,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedStaticObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedStaticObjectTemplate.cpp index 630e8239..19de68be 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedStaticObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedStaticObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedStaticObjectTemplate::getTemplateVersion(void) const */ Tag SharedStaticObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedStaticObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedStaticObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedTangibleObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedTangibleObjectTemplate.cpp index 3157fb24..10a66071 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedTangibleObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedTangibleObjectTemplate.cpp @@ -55,7 +55,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() for (iter = m_paletteColorCustomizationVariables.begin(); iter != m_paletteColorCustomizationVariables.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_paletteColorCustomizationVariables.clear(); } @@ -64,7 +64,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() for (iter = m_rangedIntCustomizationVariables.begin(); iter != m_rangedIntCustomizationVariables.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_rangedIntCustomizationVariables.clear(); } @@ -73,7 +73,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() for (iter = m_constStringCustomizationVariables.begin(); iter != m_constStringCustomizationVariables.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_constStringCustomizationVariables.clear(); } @@ -82,7 +82,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() for (iter = m_socketDestinations.begin(); iter != m_socketDestinations.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_socketDestinations.clear(); } @@ -91,7 +91,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() for (iter = m_certificationsRequired.begin(); iter != m_certificationsRequired.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_certificationsRequired.clear(); } @@ -100,7 +100,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() for (iter = m_customizationVariableMapping.begin(); iter != m_customizationVariableMapping.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_customizationVariableMapping.clear(); } @@ -152,10 +152,10 @@ Tag SharedTangibleObjectTemplate::getTemplateVersion(void) const */ Tag SharedTangibleObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedTangibleObjectTemplate::getHighestTemplateVersion @@ -181,9 +181,9 @@ CompilerIntegerParam * SharedTangibleObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_clientVisabilityFlag; } @@ -191,7 +191,7 @@ CompilerIntegerParam * SharedTangibleObjectTemplate::getCompilerIntegerParam(con } else return SharedObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedTangibleObjectTemplate::getCompilerIntegerParam FloatParam * SharedTangibleObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -207,9 +207,9 @@ BoolParam * SharedTangibleObjectTemplate::getBoolParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_useStructureFootprintOutline; } @@ -221,9 +221,9 @@ BoolParam * SharedTangibleObjectTemplate::getBoolParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_targetable; } @@ -231,7 +231,7 @@ BoolParam * SharedTangibleObjectTemplate::getBoolParam(const char *name, bool de } else return SharedObjectTemplate::getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedTangibleObjectTemplate::getBoolParam StringParam * SharedTangibleObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) @@ -242,9 +242,9 @@ StringParam * SharedTangibleObjectTemplate::getStringParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_structureFootprintFileName; } @@ -264,7 +264,7 @@ StringParam * SharedTangibleObjectTemplate::getStringParam(const char *name, boo } else return SharedObjectTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedTangibleObjectTemplate::getStringParam StringIdParam * SharedTangibleObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -334,7 +334,7 @@ StructParamOT * SharedTangibleObjectTemplate::getStructParamOT(const char *name, } else return SharedObjectTemplate::getStructParamOT(name, deepCheck, index); - return NULL; + return nullptr; } //SharedTangibleObjectTemplate::getStructParamOT TriggerVolumeParam * SharedTangibleObjectTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index) @@ -488,12 +488,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -521,7 +521,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_paletteColorCustomizationVariables.begin(); iter != m_paletteColorCustomizationVariables.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_paletteColorCustomizationVariables.clear(); m_paletteColorCustomizationVariablesAppend = file.read_bool8(); @@ -540,7 +540,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_rangedIntCustomizationVariables.begin(); iter != m_rangedIntCustomizationVariables.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_rangedIntCustomizationVariables.clear(); m_rangedIntCustomizationVariablesAppend = file.read_bool8(); @@ -559,7 +559,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_constStringCustomizationVariables.begin(); iter != m_constStringCustomizationVariables.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_constStringCustomizationVariables.clear(); m_constStringCustomizationVariablesAppend = file.read_bool8(); @@ -578,7 +578,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_socketDestinations.begin(); iter != m_socketDestinations.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_socketDestinations.clear(); m_socketDestinationsAppend = file.read_bool8(); @@ -603,7 +603,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_certificationsRequired.begin(); iter != m_certificationsRequired.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_certificationsRequired.clear(); m_certificationsRequiredAppend = file.read_bool8(); @@ -622,7 +622,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_customizationVariableMapping.begin(); iter != m_customizationVariableMapping.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_customizationVariableMapping.clear(); m_customizationVariableMappingAppend = file.read_bool8(); @@ -866,9 +866,9 @@ StringParam * SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::g { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_variableName; } @@ -880,9 +880,9 @@ StringParam * SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::g { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_constValue; } @@ -890,7 +890,7 @@ StringParam * SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::g } else return TpfTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::getStringParam StringIdParam * SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::getStringIdParam(const char *name, bool deepCheck, int index) @@ -1084,9 +1084,9 @@ StringParam * SharedTangibleObjectTemplate::_CustomizationVariableMapping::getSt { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_sourceVariable; } @@ -1098,9 +1098,9 @@ StringParam * SharedTangibleObjectTemplate::_CustomizationVariableMapping::getSt { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_dependentVariable; } @@ -1108,7 +1108,7 @@ StringParam * SharedTangibleObjectTemplate::_CustomizationVariableMapping::getSt } else return TpfTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedTangibleObjectTemplate::_CustomizationVariableMapping::getStringParam StringIdParam * SharedTangibleObjectTemplate::_CustomizationVariableMapping::getStringIdParam(const char *name, bool deepCheck, int index) @@ -1287,9 +1287,9 @@ CompilerIntegerParam * SharedTangibleObjectTemplate::_PaletteColorCustomizationV { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_defaultPaletteIndex; } @@ -1297,7 +1297,7 @@ CompilerIntegerParam * SharedTangibleObjectTemplate::_PaletteColorCustomizationV } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getCompilerIntegerParam FloatParam * SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getFloatParam(const char *name, bool deepCheck, int index) @@ -1318,9 +1318,9 @@ StringParam * SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable:: { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_variableName; } @@ -1332,9 +1332,9 @@ StringParam * SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable:: { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_palettePathName; } @@ -1342,7 +1342,7 @@ StringParam * SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable:: } else return TpfTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getStringParam StringIdParam * SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getStringIdParam(const char *name, bool deepCheck, int index) @@ -1529,9 +1529,9 @@ CompilerIntegerParam * SharedTangibleObjectTemplate::_RangedIntCustomizationVari { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_minValueInclusive; } @@ -1543,9 +1543,9 @@ CompilerIntegerParam * SharedTangibleObjectTemplate::_RangedIntCustomizationVari { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_defaultValue; } @@ -1557,9 +1557,9 @@ CompilerIntegerParam * SharedTangibleObjectTemplate::_RangedIntCustomizationVari { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_maxValueExclusive; } @@ -1567,7 +1567,7 @@ CompilerIntegerParam * SharedTangibleObjectTemplate::_RangedIntCustomizationVari } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getCompilerIntegerParam FloatParam * SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getFloatParam(const char *name, bool deepCheck, int index) @@ -1588,9 +1588,9 @@ StringParam * SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::get { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_variableName; } @@ -1598,7 +1598,7 @@ StringParam * SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::get } else return TpfTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getStringParam StringIdParam * SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getStringIdParam(const char *name, bool deepCheck, int index) diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedTerrainSurfaceObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedTerrainSurfaceObjectTemplate.cpp index 2eb61bd9..aeaeff99 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedTerrainSurfaceObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedTerrainSurfaceObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedTerrainSurfaceObjectTemplate::getTemplateVersion(void) const */ Tag SharedTerrainSurfaceObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedTerrainSurfaceObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedTerrainSurfaceObjectTemplate::getHighestTemplateVersion @@ -108,9 +108,9 @@ FloatParam * SharedTerrainSurfaceObjectTemplate::getFloatParam(const char *name, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_cover; } @@ -118,7 +118,7 @@ FloatParam * SharedTerrainSurfaceObjectTemplate::getFloatParam(const char *name, } else return TpfTemplate::getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedTerrainSurfaceObjectTemplate::getFloatParam BoolParam * SharedTerrainSurfaceObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) @@ -134,9 +134,9 @@ StringParam * SharedTerrainSurfaceObjectTemplate::getStringParam(const char *nam { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_surfaceType; } @@ -144,7 +144,7 @@ StringParam * SharedTerrainSurfaceObjectTemplate::getStringParam(const char *nam } else return TpfTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedTerrainSurfaceObjectTemplate::getStringParam StringIdParam * SharedTerrainSurfaceObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -227,12 +227,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedTokenObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedTokenObjectTemplate.cpp index cf352144..03f9ec94 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedTokenObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedTokenObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedTokenObjectTemplate::getTemplateVersion(void) const */ Tag SharedTokenObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedTokenObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedTokenObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedUniverseObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedUniverseObjectTemplate.cpp index 62685a52..d429becf 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedUniverseObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedUniverseObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedUniverseObjectTemplate::getTemplateVersion(void) const */ Tag SharedUniverseObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedUniverseObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedUniverseObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedVehicleObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedVehicleObjectTemplate.cpp index ffa28bfb..b1f83b74 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedVehicleObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedVehicleObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedVehicleObjectTemplate::getTemplateVersion(void) const */ Tag SharedVehicleObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedVehicleObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedVehicleObjectTemplate::getHighestTemplateVersion @@ -108,9 +108,9 @@ FloatParam * SharedVehicleObjectTemplate::getFloatParam(const char *name, bool d { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_speed[index]; } @@ -122,9 +122,9 @@ FloatParam * SharedVehicleObjectTemplate::getFloatParam(const char *name, bool d { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_slopeAversion; } @@ -136,9 +136,9 @@ FloatParam * SharedVehicleObjectTemplate::getFloatParam(const char *name, bool d { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_hoverValue; } @@ -150,9 +150,9 @@ FloatParam * SharedVehicleObjectTemplate::getFloatParam(const char *name, bool d { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_turnRate; } @@ -164,9 +164,9 @@ FloatParam * SharedVehicleObjectTemplate::getFloatParam(const char *name, bool d { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_maxVelocity; } @@ -178,9 +178,9 @@ FloatParam * SharedVehicleObjectTemplate::getFloatParam(const char *name, bool d { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_acceleration; } @@ -192,9 +192,9 @@ FloatParam * SharedVehicleObjectTemplate::getFloatParam(const char *name, bool d { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_braking; } @@ -202,7 +202,7 @@ FloatParam * SharedVehicleObjectTemplate::getFloatParam(const char *name, bool d } else return SharedTangibleObjectTemplate::getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedVehicleObjectTemplate::getFloatParam BoolParam * SharedVehicleObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) @@ -300,12 +300,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedWaypointObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedWaypointObjectTemplate.cpp index b845d576..69ad3053 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedWaypointObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedWaypointObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedWaypointObjectTemplate::getTemplateVersion(void) const */ Tag SharedWaypointObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedWaypointObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedWaypointObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedWeaponObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedWeaponObjectTemplate.cpp index b6bf3e51..690d160e 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedWeaponObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedWeaponObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedWeaponObjectTemplate::getTemplateVersion(void) const */ Tag SharedWeaponObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedWeaponObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedWeaponObjectTemplate::getHighestTemplateVersion @@ -103,9 +103,9 @@ CompilerIntegerParam * SharedWeaponObjectTemplate::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_weaponEffectIndex; } @@ -117,9 +117,9 @@ CompilerIntegerParam * SharedWeaponObjectTemplate::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_attackType; } @@ -127,7 +127,7 @@ CompilerIntegerParam * SharedWeaponObjectTemplate::getCompilerIntegerParam(const } else return SharedTangibleObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedWeaponObjectTemplate::getCompilerIntegerParam FloatParam * SharedWeaponObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -148,9 +148,9 @@ StringParam * SharedWeaponObjectTemplate::getStringParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_weaponEffect; } @@ -158,7 +158,7 @@ StringParam * SharedWeaponObjectTemplate::getStringParam(const char *name, bool } else return SharedTangibleObjectTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedWeaponObjectTemplate::getStringParam StringIdParam * SharedWeaponObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -241,12 +241,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/File.cpp b/engine/shared/library/sharedTemplateDefinition/src/shared/core/File.cpp index d3b0322d..07755d95 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/File.cpp +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/File.cpp @@ -19,7 +19,7 @@ // File static variables Filename File::m_basePath; -File::FunctionPtr File::m_callBack = NULL; +File::FunctionPtr File::m_callBack = nullptr; //======================================================================== // File functions @@ -49,7 +49,7 @@ bool File::open(const char *filename, const char *mode) // @todo: find an equivalent function for Linux m_fp = fopen(m_filename, mode); #endif - if (m_fp != NULL) + if (m_fp != nullptr) { m_currentLine = 0; return true; @@ -57,7 +57,7 @@ bool File::open(const char *filename, const char *mode) else { const char * errstr = strerror(errno); - if (errstr != NULL) + if (errstr != nullptr) { m_filename.clear(); printError(errstr); @@ -75,7 +75,7 @@ bool File::open(const char *filename, const char *mode) */ bool File::exists(const char *filename) { - if (filename == NULL) + if (filename == nullptr) return false; #if defined(WIN32) @@ -110,7 +110,7 @@ int File::readRawLine(char *buffer, int bufferSize) NOT_NULL(buffer); ++m_currentLine; - if (fgets(buffer, bufferSize, m_fp) == NULL) + if (fgets(buffer, bufferSize, m_fp) == nullptr) { if (feof(m_fp)) return -1; @@ -149,7 +149,7 @@ int File::readLine(char *buffer, int bufferSize) for (;;) { ++m_currentLine; - if (fgets(buffer, bufferSize, m_fp) == NULL) + if (fgets(buffer, bufferSize, m_fp) == nullptr) { if (feof(m_fp)) return -1; diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/File.h b/engine/shared/library/sharedTemplateDefinition/src/shared/core/File.h index b8f655e6..c2292615 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/File.h +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/File.h @@ -54,13 +54,13 @@ private: inline File::File(void) : - m_fp(NULL), + m_fp(nullptr), m_currentLine(0) { } // File::File(void) inline File::File(const char *filename, const char *mode) : - m_fp(NULL), + m_fp(nullptr), m_currentLine(0) { open(filename, mode); @@ -83,15 +83,15 @@ inline const Filename & File::getFilename(void) const inline bool File::isOpened(void) const { - return (m_fp != NULL); + return (m_fp != nullptr); } // File::isOpened inline void File::close(void) { - if (m_fp != NULL) + if (m_fp != nullptr) { fclose(m_fp); - m_fp = NULL; + m_fp = nullptr; } } // File::close @@ -110,7 +110,7 @@ inline void File::printWarning(const char *buffer) const fprintf(stderr, "%s", error); - if (m_callBack != NULL) + if (m_callBack != nullptr) { m_callBack(error); } @@ -125,7 +125,7 @@ inline void File::printError(const char *buffer) const fprintf(stderr, "%s", error); - if (m_callBack != NULL) + if (m_callBack != nullptr) { m_callBack(error); } diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/Filename.cpp b/engine/shared/library/sharedTemplateDefinition/src/shared/core/Filename.cpp index 82d85bfa..1f329c77 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/Filename.cpp +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/Filename.cpp @@ -39,7 +39,7 @@ const char PATH_SEPARATOR = LINUX_PATH_SEPARATOR; */ void Filename::setPath(const char *path) { - if (path == NULL || *path == '\0') + if (path == nullptr || *path == '\0') m_path.clear(); else { @@ -69,7 +69,7 @@ void Filename::setPath(const char *path) */ void Filename::setName(const char *name) { - if (name == NULL || *name == '\0') + if (name == nullptr || *name == '\0') m_name.clear(); else { @@ -85,7 +85,7 @@ void Filename::setName(const char *name) const char *dot = strrchr(localname.c_str(), '.'); const char *firstSeparator = strchr(localname.c_str(), PATH_SEPARATOR); const char *lastSeparator = strrchr(localname.c_str(), PATH_SEPARATOR); - if (firstSeparator != NULL) + if (firstSeparator != nullptr) { // name has a path if (firstSeparator == localname) @@ -100,11 +100,11 @@ void Filename::setName(const char *name) localname.c_str() + 1); } } - if (dot != NULL && (lastSeparator == NULL || dot > lastSeparator)) + if (dot != nullptr && (lastSeparator == nullptr || dot > lastSeparator)) { // name has an extension setExtension(dot); - if (lastSeparator == NULL) + if (lastSeparator == nullptr) m_name = std::string(localname.c_str(), dot - localname.c_str()); else m_name = std::string(lastSeparator + 1, dot - (lastSeparator + 1)); @@ -112,7 +112,7 @@ void Filename::setName(const char *name) else { // name doesn't have an extension - if (lastSeparator == NULL) + if (lastSeparator == nullptr) m_name = localname; else m_name = std::string(lastSeparator + 1); @@ -129,7 +129,7 @@ void Filename::setName(const char *name) */ void Filename::setExtension(const char *extension) { - if (extension == NULL || *extension == '\0') + if (extension == nullptr || *extension == '\0') m_extension.clear(); else { @@ -253,7 +253,7 @@ static const std::string PATH_SEPARATOR_STRING(PATH_SEPARATOR_BUFF); */ void Filename::setDrive(const char *drive) { - if (drive != NULL && isalpha(*drive)) + if (drive != nullptr && isalpha(*drive)) m_drive = std::string(drive, 1) + ":"; else m_drive.clear(); @@ -273,7 +273,7 @@ std::string path; #if defined(WIN32) char *pathBuf; - DWORD bufsize = GetFullPathName(getFullFilename().c_str(), 0, NULL, NULL); + DWORD bufsize = GetFullPathName(getFullFilename().c_str(), 0, nullptr, nullptr); if (bufsize != 0) { pathBuf = new char[bufsize + 1]; @@ -285,7 +285,7 @@ std::string path; } #elif defined(linux) char pathBuf[PATH_MAX]; - if (getcwd(pathBuf, PATH_MAX) != NULL) + if (getcwd(pathBuf, PATH_MAX) != nullptr) { strcat(pathBuf, "/"); strcat(pathBuf, getFullFilename().c_str()); @@ -306,19 +306,19 @@ void Filename::verifyAndCreatePath(void) const #if defined(WIN32) if (WindowsUnicode) { - char *buffer = NULL; + char *buffer = nullptr; DWORD buflen; // get our current path - buflen = GetFullPathName(".", 0, buffer, NULL); + buflen = GetFullPathName(".", 0, buffer, nullptr); buffer = new char[buflen + 1]; - buflen = GetFullPathName(".", buflen + 1, buffer, NULL); + buflen = GetFullPathName(".", buflen + 1, buffer, nullptr); Unicode::String srcPath = Unicode::narrowToWide(buffer); delete[] buffer; // get the destination path std::string correctPath(getDrive() + getPath()); - buflen = GetFullPathName(correctPath.c_str(), 0, buffer, NULL); + buflen = GetFullPathName(correctPath.c_str(), 0, buffer, nullptr); buffer = new char[buflen + 1]; - buflen = GetFullPathName(correctPath.c_str(), buflen + 1, buffer, NULL); + buflen = GetFullPathName(correctPath.c_str(), buflen + 1, buffer, nullptr); Unicode::String destPath = Unicode::narrowToWide(buffer); delete[] buffer; @@ -335,7 +335,7 @@ void Filename::verifyAndCreatePath(void) const destPath += splitDestPath[i]; if (SetCurrentDirectoryW((LPCWSTR)destPath.c_str()) == 0) { - if (CreateDirectoryW((LPCWSTR)destPath.c_str(), NULL) == 0) + if (CreateDirectoryW((LPCWSTR)destPath.c_str(), nullptr) == 0) return; if (SetCurrentDirectoryW((LPCWSTR)destPath.c_str()) == 0) return; @@ -347,19 +347,19 @@ void Filename::verifyAndCreatePath(void) const } else { - char *buffer = NULL; + char *buffer = nullptr; DWORD buflen; // get our current path - buflen = GetFullPathName(".", 0, buffer, NULL); + buflen = GetFullPathName(".", 0, buffer, nullptr); buffer = new char[buflen + 1]; - buflen = GetFullPathName(".", buflen + 1, buffer, NULL); + buflen = GetFullPathName(".", buflen + 1, buffer, nullptr); std::string srcPath = buffer; delete[] buffer; // get the destination path std::string correctPath(getDrive() + getPath()); - buflen = GetFullPathName(correctPath.c_str(), 0, buffer, NULL); + buflen = GetFullPathName(correctPath.c_str(), 0, buffer, nullptr); buffer = new char[buflen + 1]; - buflen = GetFullPathName(correctPath.c_str(), buflen + 1, buffer, NULL); + buflen = GetFullPathName(correctPath.c_str(), buflen + 1, buffer, nullptr); std::string destPath = buffer; delete[] buffer; @@ -378,7 +378,7 @@ void Filename::verifyAndCreatePath(void) const destPath += splitDestPath[i]; if (SetCurrentDirectory(destPath.c_str()) == 0) { - if (CreateDirectory(destPath.c_str(), NULL) == 0) + if (CreateDirectory(destPath.c_str(), nullptr) == 0) return; if (SetCurrentDirectory(destPath.c_str()) == 0) return; diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/Filename.h b/engine/shared/library/sharedTemplateDefinition/src/shared/core/Filename.h index 62466a7a..a947e70d 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/Filename.h +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/Filename.h @@ -57,13 +57,13 @@ inline Filename::Filename(void) inline Filename::Filename(const char *drive, const char *path, const char *name, const char *extension) { - if (drive != NULL) + if (drive != nullptr) setDrive(drive); - if (path != NULL) + if (path != nullptr) setPath(path); - if (name != NULL) + if (name != nullptr) setName(name); - if (extension != NULL) + if (extension != nullptr) setExtension(extension); } // Filename::Filename @@ -115,7 +115,7 @@ inline void Filename::makeFullPath(void) //======================================================================== -const Filename NEXT_HIGHER_PATH(NULL, "..", NULL, NULL); +const Filename NEXT_HIGHER_PATH(nullptr, "..", nullptr, nullptr); #endif // _INCLUDED_Filename_H diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/ObjectTemplate.cpp b/engine/shared/library/sharedTemplateDefinition/src/shared/core/ObjectTemplate.cpp index 42def7d2..5492f6ec 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/ObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/ObjectTemplate.cpp @@ -16,8 +16,8 @@ //----------------------------------------------------------------- -template <> ObjectTemplateList::CreateDataResourceMap *ObjectTemplateList::ms_bindings = NULL; -template <> ObjectTemplateList::LoadedDataResourceMap *ObjectTemplateList::ms_loaded = NULL; +template <> ObjectTemplateList::CreateDataResourceMap *ObjectTemplateList::ms_bindings = nullptr; +template <> ObjectTemplateList::LoadedDataResourceMap *ObjectTemplateList::ms_loaded = nullptr; // ====================================================================== @@ -40,10 +40,10 @@ ObjectTemplate::ObjectTemplate(const std::string & filename) : ObjectTemplate::~ObjectTemplate(void) { - if (m_baseData != NULL) + if (m_baseData != nullptr) { m_baseData->releaseReference(); - m_baseData = NULL; + m_baseData = nullptr; } } @@ -63,7 +63,7 @@ void ObjectTemplate::load(Iff &iff) */ void ObjectTemplate::addReference(void) const { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->addReference(); DataResource::addReference(); @@ -76,7 +76,7 @@ void ObjectTemplate::addReference(void) const */ void ObjectTemplate::releaseReference(void) const { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); DataResource::releaseReference(); diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateData.cpp b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateData.cpp index a5974767..335347bc 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateData.cpp +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateData.cpp @@ -52,8 +52,8 @@ static const bool HasMinMax[] = // map enum ParamType to access function return value static const char * const PaddedDataMethodNames[] = { - NULL, - NULL, + nullptr, + nullptr, "int ", "float ", "bool ", @@ -62,25 +62,25 @@ static const char * const PaddedDataMethodNames[] = "const Vector & ", "void ", "const ObjectTemplate *", - NULL, - NULL, + nullptr, + nullptr, "const TriggerVolumeData &", "const std::string & " }; static const char * const UnpaddedDataMethodNames[] = { - NULL, - NULL, + nullptr, + nullptr, "int", "float", "bool", "const std::string &", "const StringId", "const Vector &", - NULL, + nullptr, "const ObjectTemplate *", - NULL, - NULL, + nullptr, + nullptr, "const TriggerVolumeData &", "const std::string &" }; @@ -88,8 +88,8 @@ static const char * const UnpaddedDataMethodNames[] = // map enum ParamType to struct storage type static const char * const PaddedDataStructNames[] = { - NULL, - NULL, + nullptr, + nullptr, "int ", "float ", "bool ", @@ -98,15 +98,15 @@ static const char * const PaddedDataStructNames[] = "Vector ", "DynamicVariableList ", "const ObjectTemplate *", - NULL, - NULL, + nullptr, + nullptr, "TriggerVolumeData ", "std::string " }; static const char * const UnpaddedDataStructNames[] = { - NULL, - NULL, + nullptr, + nullptr, "int", "float", "bool", @@ -115,8 +115,8 @@ static const char * const UnpaddedDataStructNames[] = "Vector", "DynamicVariableList", "const ObjectTemplate *", - NULL, - NULL, + nullptr, + nullptr, "TriggerVolumeData", "std::string" }; @@ -160,8 +160,8 @@ static const char * const CompilerDataVariableNames[] = static const char * const DefaultDataReturnValue[] = { - NULL, - NULL, + nullptr, + nullptr, "0", "0.0f", "false", @@ -169,7 +169,7 @@ static const char * const DefaultDataReturnValue[] = "DefaultStringId", "DefaultVector", "", - "NULL", + "nullptr", "(0)", "", "DefaultTriggerVolumeData", @@ -217,7 +217,7 @@ static const char * const EnumLocationNames[] = */ TemplateData::TemplateData(int version, const TemplateDefinitionFile &parent) : m_fileParent(&parent), - m_templateParent(NULL), + m_templateParent(nullptr), m_hasTemplateParam(false), m_hasDynamicVarParam(false), m_hasList(false), @@ -228,9 +228,9 @@ TemplateData::TemplateData(int version, const TemplateDefinitionFile &parent) : m_parseState(STATE_PARAM), m_parameters(), m_parameterMap(), - m_currentEnumList(NULL), + m_currentEnumList(nullptr), m_enumMap(), - m_currentStruct(NULL), + m_currentStruct(nullptr), m_structMap(), m_structList() { @@ -252,7 +252,7 @@ TemplateData::TemplateData(int version, const TemplateDefinitionFile &parent) : * @param name the structure's name */ TemplateData::TemplateData(const TemplateData *parent, const std::string &name) : - m_fileParent(NULL), + m_fileParent(nullptr), m_templateParent(parent), m_hasTemplateParam(false), m_hasDynamicVarParam(false), @@ -265,9 +265,9 @@ TemplateData::TemplateData(const TemplateData *parent, const std::string &name) m_parseState(STATE_PARAM), m_parameters(), m_parameterMap(), - m_currentEnumList(NULL), + m_currentEnumList(nullptr), m_enumMap(), - m_currentStruct(NULL), + m_currentStruct(nullptr), m_structMap(), m_structList() { @@ -284,15 +284,15 @@ TemplateData::~TemplateData() for (iter = m_structMap.begin(); iter != m_structMap.end(); ++iter) { delete (*iter).second; - (*iter).second = NULL; + (*iter).second = nullptr; } m_parameterMap.clear(); m_parameters.clear(); m_structMap.clear(); m_structList.clear(); - m_currentEnumList = NULL; - m_currentStruct = NULL; + m_currentEnumList = nullptr; + m_currentStruct = nullptr; } // TemplateData::~TemplateData @@ -306,9 +306,9 @@ TemplateData::~TemplateData() */ const std::string TemplateData::getName(void) const { - if (m_fileParent != NULL) + if (m_fileParent != nullptr) return m_fileParent->getTemplateName(); - if (m_templateParent != NULL) + if (m_templateParent != nullptr) return m_templateParent->getName() + "::_" + m_name; return ""; } @@ -320,9 +320,9 @@ const std::string TemplateData::getName(void) const */ const std::string TemplateData::getBaseName(void) const { - if (m_fileParent != NULL && !m_fileParent->getBaseName().empty()) + if (m_fileParent != nullptr && !m_fileParent->getBaseName().empty()) return m_fileParent->getBaseName(); -// if (m_templateParent != NULL) +// if (m_templateParent != nullptr) return m_baseName; // return ""; } @@ -334,9 +334,9 @@ const std::string TemplateData::getBaseName(void) const */ TemplateLocation TemplateData::getTemplateLocation(void) const { - if (m_fileParent != NULL) + if (m_fileParent != nullptr) return m_fileParent->getTemplateLocation(); - if (m_templateParent != NULL) + if (m_templateParent != nullptr) return m_templateParent->getTemplateLocation(); return LOC_NONE; } // TemplateData::getTemplateLocation @@ -359,8 +359,8 @@ const char * TemplateData::parseLine(const File &fp, const char *buffer, { ParamState paramState = STATE_LIST; - if (buffer == NULL || *buffer == '\0') - return NULL; + if (buffer == nullptr || *buffer == '\0') + return nullptr; const char *line = buffer; @@ -413,7 +413,7 @@ ParamState paramState = STATE_LIST; return CHAR_ERROR; } const EnumList * enumList = getEnumList(tokenbuf, true); - if (enumList != NULL) + if (enumList != nullptr) { fp.printError("enum already defined"); return CHAR_ERROR; @@ -421,7 +421,7 @@ ParamState paramState = STATE_LIST; m_currentEnumList = &(*m_enumMap.insert(std::make_pair( std::string(tokenbuf), EnumList())).first).second; m_parseState = STATE_ENUM; - if (line != NULL && *line != '\0') + if (line != nullptr && *line != '\0') return parseEnum(fp, line, tokenbuf); return line; } @@ -455,7 +455,7 @@ ParamState paramState = STATE_LIST; m_structMap.insert(std::make_pair(tokenbuf, m_currentStruct)); m_structList.push_back(m_currentStruct); m_parseState = STATE_STRUCT; - if (line != NULL && *line != '\0') + if (line != nullptr && *line != '\0') return parseStruct(fp, line, tokenbuf); return line; } @@ -463,7 +463,7 @@ ParamState paramState = STATE_LIST; return CHAR_ERROR; } // if we are a structure, the 1st item should be the structure id - else if (strcmp(tokenbuf, "id") == 0 && m_templateParent != NULL && + else if (strcmp(tokenbuf, "id") == 0 && m_templateParent != nullptr && m_structId.tag == NO_TAG) { line = getNextToken(line, tokenbuf); @@ -479,7 +479,7 @@ ParamState paramState = STATE_LIST; } // if we are a structure, the 1st item should be the structure id - if (m_templateParent != NULL && m_structId.tag == NO_TAG) + if (m_templateParent != nullptr && m_structId.tag == NO_TAG) { fp.printError("struct id not defined"); return CHAR_ERROR; @@ -508,7 +508,7 @@ ParamState paramState = STATE_LIST; parameter.list_type = LIST_ENUM_ARRAY; parameter.enum_list_name = &tokenbuf[8]; const EnumList * list = getEnumList(parameter.enum_list_name.c_str(), false); - if (list == NULL) + if (list == nullptr) { fp.printError("enum name not defined!"); return CHAR_ERROR; @@ -592,7 +592,7 @@ ParamState paramState = STATE_LIST; { parameter.type = TYPE_ENUM; parameter.extendedName = &tokenbuf[4]; - if (getEnumList(&tokenbuf[4], false) == NULL) + if (getEnumList(&tokenbuf[4], false) == nullptr) { std::string errbuf = "enum type " + parameter.extendedName + " not defined"; @@ -605,7 +605,7 @@ ParamState paramState = STATE_LIST; { parameter.type = TYPE_STRUCT; parameter.extendedName = &tokenbuf[6]; - if (getStruct(&tokenbuf[6]) == NULL) + if (getStruct(&tokenbuf[6]) == nullptr) { std::string errbuf = "struct " + parameter.extendedName + " not defined"; @@ -640,12 +640,12 @@ ParamState paramState = STATE_LIST; tempToken = getNextToken(tempToken, tempBuf); if (parameter.type == TYPE_INTEGER) { - parameter.min_int_limit = strtol(tempBuf, NULL, 10); + parameter.min_int_limit = strtol(tempBuf, nullptr, 10); } else { parameter.min_float_limit = static_cast( - strtod(tempBuf, NULL)); + strtod(tempBuf, nullptr)); } } if (*tempToken == '.' && *(tempToken + 1) == '.') @@ -682,7 +682,7 @@ ParamState paramState = STATE_LIST; } // anything left over in the line is the parameter description - if (line != NULL) + if (line != nullptr) parameter.description = line; m_parameters.push_back(parameter); @@ -714,12 +714,12 @@ int TemplateData::getEnumValue(const char * enumValue) const } } - if (m_templateParent != NULL) + if (m_templateParent != nullptr) return m_templateParent->getEnumValue(enumValue); - if (m_fileParent != NULL) + if (m_fileParent != nullptr) { const TemplateDefinitionFile * baseFile = m_fileParent->getBaseDefinitionFile(); - if (baseFile != NULL) + if (baseFile != nullptr) { return baseFile->getTemplateData(baseFile->getHighestVersion())-> getEnumValue(enumValue); @@ -742,7 +742,7 @@ int TemplateData::getEnumValue(const std::string & enumType, NOT_NULL(enumValue); const EnumList *elist = getEnumList(enumType.c_str(), false); - if (elist == NULL) + if (elist == nullptr) return INVALID_ENUM_RESULT; EnumList::const_iterator listIter; for (listIter = elist->begin(); listIter != elist->end(); ++listIter) @@ -760,7 +760,7 @@ int TemplateData::getEnumValue(const std::string & enumType, * @param name the enum list name * @param define flag that we are defining templates and should not look in base templates * - * @return the enum list definition, or NULL if not found + * @return the enum list definition, or nullptr if not found */ const TemplateData::EnumList * TemplateData::getEnumList(const std::string & name, bool define) const @@ -768,17 +768,17 @@ const TemplateData::EnumList * TemplateData::getEnumList(const std::string & nam EnumMap::const_iterator iter = m_enumMap.find(name); if (iter != m_enumMap.end()) return &(*iter).second; - if (m_templateParent != NULL) + if (m_templateParent != nullptr) return m_templateParent->getEnumList(name, define); - if (!define && m_fileParent != NULL && m_fileParent->getBaseDefinitionFile() != NULL) + if (!define && m_fileParent != nullptr && m_fileParent->getBaseDefinitionFile() != nullptr) { const TemplateData * baseData = m_fileParent->getBaseDefinitionFile()-> getTemplateData(m_fileParent->getBaseDefinitionFile()-> getHighestVersion()); - if (baseData != NULL) + if (baseData != nullptr) return baseData->getEnumList(name, define); } - return NULL; + return nullptr; } // TemplateData::getEnumList /** @@ -787,7 +787,7 @@ const TemplateData::EnumList * TemplateData::getEnumList(const std::string & nam * * @param name the enum list name * - * @return the struct definition, or NULL if not found + * @return the struct definition, or nullptr if not found */ const TemplateData * TemplateData::getStruct(const char *name) const { @@ -796,23 +796,23 @@ const TemplateData * TemplateData::getStruct(const char *name) const StructMap::const_iterator iter = m_structMap.find(name); if (iter != m_structMap.end()) return (*iter).second; - if (m_templateParent != NULL) + if (m_templateParent != nullptr) return m_templateParent->getStruct(name); - if (m_fileParent != NULL && m_fileParent->getBaseDefinitionFile() != NULL) + if (m_fileParent != nullptr && m_fileParent->getBaseDefinitionFile() != nullptr) { const TemplateData * baseData = m_fileParent->getBaseDefinitionFile()-> getTemplateData(m_fileParent->getBaseDefinitionFile()-> getHighestVersion()); - if (baseData != NULL) + if (baseData != nullptr) return baseData->getStruct(name); } - return NULL; + return nullptr; } // TemplateData::getStruct /** * Returns the tdf file for this TemplateData * - * @return the TemplateDefinitionFile, or NULL if not there + * @return the TemplateDefinitionFile, or nullptr if not there */ const TemplateDefinitionFile * TemplateData::getTdf() const @@ -823,7 +823,7 @@ const TemplateDefinitionFile * TemplateData::getTdf() const /** * Returns the tdf file for this TemplateData's first ancestor * - * @return the TemplateDefinitionFile, or NULL if not there + * @return the TemplateDefinitionFile, or nullptr if not there */ const TemplateDefinitionFile * TemplateData::getTdfParent() const @@ -834,19 +834,19 @@ const TemplateDefinitionFile * TemplateData::getTdfParent() const } else { - return NULL; + return nullptr; } } /** * Returns the tdf file that contains the parameter * - * @return the TemplateDefinitionFile, or NULL if not found + * @return the TemplateDefinitionFile, or nullptr if not found */ const TemplateDefinitionFile * TemplateData::getTdfForParameter(const char *parameterName) const { - if(m_fileParent != NULL) + if(m_fileParent != nullptr) { if(getParameter(parameterName)) { @@ -855,18 +855,18 @@ const TemplateDefinitionFile * TemplateData::getTdfForParameter(const char *para const TemplateDefinitionFile* ancestorTemplateDefinitionFile = m_fileParent->getBaseDefinitionFile(); - if(ancestorTemplateDefinitionFile != NULL) + if(ancestorTemplateDefinitionFile != nullptr) { const TemplateData *ancestorTemplateData = ancestorTemplateDefinitionFile->getTemplateData(ancestorTemplateDefinitionFile->getHighestVersion()); - if(ancestorTemplateData != NULL) + if(ancestorTemplateData != nullptr) { return ancestorTemplateData->getTdfForParameter(parameterName); } } } - return NULL; + return nullptr; } /** @@ -883,7 +883,7 @@ int TemplateData::parseIntValue(const File &fp, const char * line, const char ** char * intbuf) const { NOT_NULL(endLine); - if (line == NULL || *line == '\0' || intbuf == NULL) + if (line == nullptr || *line == '\0' || intbuf == nullptr) { fp.printError("bad value passed to TemplateData::parseIntValue"); *endLine = CHAR_ERROR; @@ -920,7 +920,7 @@ int TemplateData::parseIntValue(const File &fp, const char * line, const char ** *endLine = CHAR_ERROR; return 0; } - if (tempLine != NULL) + if (tempLine != nullptr) line = tempLine; else line += strlen(line); @@ -954,8 +954,8 @@ int TemplateData::parseIntValue(const File &fp, const char * line, const char ** strncpy(intbuf, startLine, line - startLine); intbuf[line - startLine] = '\0'; intbuf += strlen(intbuf); - if (line != NULL && *line == '\0') - *endLine = NULL; + if (line != nullptr && *line == '\0') + *endLine = nullptr; else *endLine = line; @@ -1010,7 +1010,7 @@ const char * TemplateData::parseEnum(const File &fp, const char *buffer, if (m_bracketCount == 1) { m_bracketCount = 0; - m_currentEnumList = NULL; + m_currentEnumList = nullptr; m_parseState = STATE_PARAM; return line; } @@ -1023,7 +1023,7 @@ const char * TemplateData::parseEnum(const File &fp, const char *buffer, EnumData enumData; enumData.name = tokenbuf; - if (line != NULL && *line == '=') + if (line != nullptr && *line == '=') { line = getNextToken(line, tokenbuf); @@ -1054,12 +1054,12 @@ const char * TemplateData::parseEnum(const File &fp, const char *buffer, enumData.value = m_currentEnumList->back().value + 1; } - if (line != NULL && *line == ',') + if (line != nullptr && *line == ',') line = getNextToken(line, tokenbuf); - if (line != NULL) + if (line != nullptr) { enumData.comment = line; - line = NULL; + line = nullptr; } m_currentEnumList->push_back(enumData); @@ -1103,7 +1103,7 @@ const char * TemplateData::parseStruct(const File &fp, const char *buffer, if (m_bracketCount == 1) { m_bracketCount = 0; - m_currentStruct = NULL; + m_currentStruct = nullptr; m_parseState = STATE_PARAM; return line; } @@ -1194,7 +1194,7 @@ char buffer[256]; else if (param.list_type == LIST_ENUM_ARRAY) { const EnumList * enumList = getEnumList(param.enum_list_name, false); - FATAL(enumList == NULL, ("Enum list %s missing", + FATAL(enumList == nullptr, ("Enum list %s missing", param.enum_list_name.c_str())); sprintf(buffer, "missing parameter %s[%s] from section " "@class %s", param.name.c_str(), enumList->at(i).name.c_str(), @@ -1280,10 +1280,10 @@ void TemplateData::setWriteForCompiler(bool flag) */ void TemplateData::writeRegisterTemplate(File &fp, const char * leadInChars) const { - if (m_fileParent != NULL) + if (m_fileParent != nullptr) fp.print("%s\n", TDF_INSTALL_BEGIN); - if (leadInChars != NULL) + if (leadInChars != nullptr) fp.print("%s", leadInChars); fp.print("%s::registerMe();\n", getName().c_str()); @@ -1296,7 +1296,7 @@ void TemplateData::writeRegisterTemplate(File &fp, const char * leadInChars) con subStruct->writeRegisterTemplate(fp, leadInChars); } - if (m_fileParent != NULL) + if (m_fileParent != nullptr) fp.print("%s\n", TDF_INSTALL_END); } // TemplateData::writeRegisterTemplate @@ -1338,7 +1338,7 @@ std::vector paramStrings; paramStrings.push_back(param.enum_list_name + " index"); break; } - if (m_templateParent != NULL) + if (m_templateParent != nullptr) paramStrings.push_back("bool versionOk"); if (param.list_type == LIST_NONE) { @@ -1420,7 +1420,7 @@ void TemplateData::getTemplateNames(std::set &names) const else if (param.type == TYPE_STRUCT) { const TemplateData * structData = getStruct(param.extendedName.c_str()); - if (structData != NULL) + if (structData != nullptr) structData->getTemplateNames(names); } } @@ -1439,7 +1439,7 @@ void TemplateData::writeHeaderParams(File &fp) const return; } - if (m_fileParent != NULL) + if (m_fileParent != nullptr) fp.print("%s\n", TDF_BEGIN); writeHeaderEnums(fp); @@ -1447,7 +1447,7 @@ void TemplateData::writeHeaderParams(File &fp) const writeHeaderMethods(fp); writeHeaderVariables(fp); - if (m_fileParent != NULL) + if (m_fileParent != nullptr) fp.print("%s\n", TDF_END); } // TemplateData::writeHeaderParams @@ -1461,7 +1461,7 @@ void TemplateData::writeCompilerHeaderParams(File &fp) const { DEBUG_FATAL(!m_writeForCompilerFlag, ("write for compiler not enabled")); - if (m_fileParent != NULL) + if (m_fileParent != nullptr) fp.print("%s\n", TDF_BEGIN); writeHeaderEnums(fp); @@ -1469,7 +1469,7 @@ void TemplateData::writeCompilerHeaderParams(File &fp) const writeCompilerHeaderMethods(fp); writeHeaderVariables(fp); - if (m_fileParent != NULL) + if (m_fileParent != nullptr) fp.print("%s\n", TDF_END); } // TemplateData::writeCompilerHeaderParams @@ -1883,7 +1883,7 @@ ParameterList::const_iterator iter; case LIST_NONE: case LIST_INT_ARRAY: case LIST_ENUM_ARRAY: - if (PaddedDataStructNames[param.type] != NULL) + if (PaddedDataStructNames[param.type] != nullptr) { fp.print("\t\t%s %s", PaddedDataStructNames[param.type], param.name.c_str()); @@ -1904,7 +1904,7 @@ ParameterList::const_iterator iter; break; case LIST_LIST: fp.print("\t\tstdvector<"); - if (UnpaddedDataStructNames[param.type] != NULL) + if (UnpaddedDataStructNames[param.type] != nullptr) fp.print("%s", UnpaddedDataStructNames[param.type]); else if (param.type == TYPE_ENUM) fp.print("enum %s", param.extendedName.c_str()); @@ -1953,7 +1953,7 @@ void TemplateData::writeSourceLoadedFlagInit(File &fp) const { ParameterList::const_iterator iter; - if (m_fileParent != NULL) + if (m_fileParent != nullptr) fp.print("%s\n", TDF_INIT_BEGIN); fp.print("\t: %s(filename)\n", getBaseName().c_str()); @@ -1968,13 +1968,13 @@ ParameterList::const_iterator iter; fp.print("m_%sLoaded(false)\n", param.name.c_str()); fp.print("\t,m_%sAppend(false)\n", param.name.c_str()); } - if (m_templateParent == NULL && !isWritingForCompiler()) + if (m_templateParent == nullptr && !isWritingForCompiler()) { fp.print("\t,"); fp.print("m_versionOk(true)\n"); } - if (m_fileParent != NULL) + if (m_fileParent != nullptr) fp.print("%s\n", TDF_INIT_END); } // TemplateData::writeSourceLoadedFlagInit @@ -1985,7 +1985,7 @@ ParameterList::const_iterator iter; */ void TemplateData::writeSourceStructStart(File &fp) const { - if (m_templateParent == NULL) + if (m_templateParent == nullptr) return; const std::string & templateNameString = getName(); @@ -2051,7 +2051,7 @@ void TemplateData::writeSourceStructStart(File &fp, const std::string &name) con { ParameterList::const_iterator iter; - if (m_templateParent == NULL || !m_hasTemplateParam) + if (m_templateParent == nullptr || !m_hasTemplateParam) return; std::string className = m_templateParent->getName() + "::" + name; @@ -2079,18 +2079,18 @@ ParameterList::const_iterator iter; switch (param.list_type) { case LIST_NONE: - fp.print("\t%s = NULL;\n", pname); + fp.print("\t%s = nullptr;\n", pname); break; case LIST_INT_ARRAY: fp.print("\tfor (int i = 0; i < %d; ++i)\n", param.list_size); fp.print("\t{\n"); - fp.print("\t\t%s[i] = NULL;\n", pname); + fp.print("\t\t%s[i] = nullptr;\n", pname); fp.print("\t}\n"); break; case LIST_ENUM_ARRAY: fp.print("\tfor (int i = 0; i < %d; ++i)\n", param.list_size); fp.print("\t{\n"); - fp.print("\t\t%s[static_cast<%s>(i)] = NULL;\n", pname, + fp.print("\t\t%s[static_cast<%s>(i)] = nullptr;\n", pname, param.enum_list_name.c_str()); fp.print("\t}\n"); break; @@ -2134,14 +2134,14 @@ ParameterList::const_iterator iter; switch (param.list_type) { case LIST_NONE: - fp.print("\tif (%s != NULL)\n", pname); + fp.print("\tif (%s != nullptr)\n", pname); fp.print("\t\tconst_cast(%s)->addReference();\n", pname); break; case LIST_INT_ARRAY: fp.print("\tfor (int i = 0; i < %d; ++i)\n", param.list_size); fp.print("\t{\n"); - fp.print("\t\tif (%s[i] != NULL)\n", pname); + fp.print("\t\tif (%s[i] != nullptr)\n", pname); fp.print("\t\t\tconst_cast(%s[i])->addReference" "();\n", pname); fp.print("\t}\n"); @@ -2149,7 +2149,7 @@ ParameterList::const_iterator iter; case LIST_ENUM_ARRAY: fp.print("\tfor (int i = 0; i < %d; ++i)\n", param.list_size); fp.print("\t{\n"); - fp.print("\t\tif (%s[static_cast<%s>(i)] != NULL)\n", pname, + fp.print("\t\tif (%s[static_cast<%s>(i)] != nullptr)\n", pname, param.enum_list_name.c_str()); fp.print("\t\t\tconst_cast(%s[static_cast<%s>" "(i)])->addReference();\n", pname, param.enum_list_name.c_str()); @@ -2182,10 +2182,10 @@ ParameterList::const_iterator iter; switch (param.list_type) { case LIST_NONE: - fp.print("\tif (%s != NULL)\n", pname); + fp.print("\tif (%s != nullptr)\n", pname); fp.print("\t{\n"); fp.print("\t\t%s->releaseReference();\n", pname); - fp.print("\t\t%s = NULL;\n", pname); + fp.print("\t\t%s = nullptr;\n", pname); fp.print("\t}\n"); break; case LIST_LIST: @@ -2198,23 +2198,23 @@ ParameterList::const_iterator iter; else fp.print("\tfor (int i = 0; i < %d; ++i)\n", param.list_size); fp.print("\t{\n"); - fp.print("\t\tif (%s[i] != NULL)\n", pname); + fp.print("\t\tif (%s[i] != nullptr)\n", pname); fp.print("\t\t{\n"); fp.print("\t\t\t%s[i]->releaseReference();\n", pname); - fp.print("\t\t\t%s[i] = NULL;\n", pname); + fp.print("\t\t\t%s[i] = nullptr;\n", pname); fp.print("\t\t}\n"); fp.print("\t}\n"); break; case LIST_ENUM_ARRAY: fp.print("\tfor (int i = 0; i < %d; ++i)\n", param.list_size); fp.print("\t{\n"); - fp.print("\t\tif (%s[static_cast<%s>(i)] != NULL)\n", pname, + fp.print("\t\tif (%s[static_cast<%s>(i)] != nullptr)\n", pname, param.enum_list_name.c_str()); fp.print("\t\t{\n"); fp.print("\t\t\t%s[static_cast<%s>(i)]->releaseReference();\n", pname, param.enum_list_name.c_str()); - fp.print("\t\t\t%s[static_cast<%s>(i)] = NULL;\n", pname, + fp.print("\t\t\t%s[static_cast<%s>(i)] = nullptr;\n", pname, param.enum_list_name.c_str()); fp.print("\t\t}\n"); fp.print("\t}\n"); @@ -2259,7 +2259,7 @@ int result; return 0; } - if (m_fileParent != NULL) + if (m_fileParent != nullptr) fp.print("%s\n", TDF_BEGIN); result = writeSourceGetData(fp); @@ -2282,7 +2282,7 @@ int result; return result; } - if (m_fileParent != NULL) + if (m_fileParent != nullptr) fp.print("%s\n", TDF_END); return 0; } // TemplateData::writeSourceMethods @@ -2297,7 +2297,7 @@ void TemplateData::writeCompilerSourceMethods(File &fp) const { DEBUG_FATAL(!m_writeForCompilerFlag, ("write for compiler not enabled")); - if (m_fileParent != NULL) + if (m_fileParent != nullptr) fp.print("%s\n", TDF_BEGIN); writeCompilerSourceAccessMethods(fp); @@ -2314,7 +2314,7 @@ void TemplateData::writeCompilerSourceMethods(File &fp) const subStruct->writeCompilerSourceMethods(fp); } - if (m_fileParent != NULL) + if (m_fileParent != nullptr) fp.print("%s\n", TDF_END); } // TemplateData::writeCompilerSourceMethods @@ -2355,7 +2355,7 @@ void TemplateData::writeSourceReturnBaseValue(File &fp, const Parameter ¶m, } else if (param.list_type != LIST_NONE) indexString = "index"; - if (m_templateParent != NULL) + if (m_templateParent != nullptr) { if (!indexString.empty()) indexString += ", "; @@ -2372,10 +2372,10 @@ void TemplateData::writeSourceReturnBaseValue(File &fp, const Parameter ¶m, fp.print("\tif (!m_%s[index].isLoaded())\n", param.name.c_str()); fp.print("\t{\n"); - if (DefaultDataReturnValue[param.type] != NULL) + if (DefaultDataReturnValue[param.type] != nullptr) { fp.print("\t\tif (ms_allowDefaultTemplateParams && " - "/*!%s &&*/ base == NULL)\n", m_templateParent == NULL ? "m_versionOk" : + "/*!%s &&*/ base == nullptr)\n", m_templateParent == nullptr ? "m_versionOk" : "versionOk"); fp.print("\t\t{\n"); fp.print("\t\t\tDEBUG_WARNING(true, (\"Returning default value for " @@ -2391,7 +2391,7 @@ void TemplateData::writeSourceReturnBaseValue(File &fp, const Parameter ¶m, fp.print("\t\t}\n"); fp.print("\t\telse\n"); fp.print("\t\t{\n"); - fp.print("\t\t\tDEBUG_FATAL(base == NULL, (\"Template parameter %s has " + fp.print("\t\t\tDEBUG_FATAL(base == nullptr, (\"Template parameter %s has " "not been defined in template %%s!\", DataResource::getName()));\n", param.name.c_str()); if (DefaultDataReturnValue[param.type][0] != '\0') @@ -2419,7 +2419,7 @@ void TemplateData::writeSourceReturnBaseValue(File &fp, const Parameter ¶m, // we need to get the base value instead of ours if (param.list_type == LIST_LIST) { - fp.print("\tif (m_%sAppend && base != NULL)\n", param.name.c_str()); + fp.print("\tif (m_%sAppend && base != nullptr)\n", param.name.c_str()); fp.print("\t{\n"); fp.print("\t\tint baseCount = base->get%sCount();\n", upperName.c_str()); @@ -2505,21 +2505,21 @@ int result; fp.print("{\n"); fp.print("\tif (!m_%sLoaded)\n", pname); fp.print("\t{\n"); - fp.print("\t\tif (m_baseData == NULL)\n"); + fp.print("\t\tif (m_baseData == nullptr)\n"); fp.print("\t\t\treturn 0;\n"); fp.print("\t\tconst %s * base = dynamic_cast" "(m_baseData);\n", templateName, templateName); - fp.print("\t\tDEBUG_FATAL(base == NULL, (\"base template wrong " + fp.print("\t\tDEBUG_FATAL(base == nullptr, (\"base template wrong " "type\"));\n"); fp.print("\t\treturn base->get%sCount();\n", upperName.c_str()); fp.print("\t}\n\n"); fp.print("\tsize_t count = m_%s.size();\n\n", pname); fp.print("\t// if we are extending our base template, add it's count\n"); - fp.print("\tif (m_%sAppend && m_baseData != NULL)\n", pname); + fp.print("\tif (m_%sAppend && m_baseData != nullptr)\n", pname); fp.print("\t{\n"); fp.print("\t\tconst %s * base = dynamic_cast(m_baseData);\n", templateName, templateName); - fp.print("\t\tif (base != NULL)\n"); + fp.print("\t\tif (base != nullptr)\n"); fp.print("\t\t\tcount += base->get%sCount();\n", upperName.c_str()); fp.print("\t}\n\n"); fp.print("\treturn count;\n"); @@ -2582,7 +2582,7 @@ void TemplateData::writeSourceTestData(File &fp) const } } - if (m_fileParent != NULL) + if (m_fileParent != nullptr) { // check the base class if (!getBaseName().empty() && getBaseName() != ROOT_TEMPLATE_NAME) @@ -2631,18 +2631,18 @@ void TemplateData::writeSourceGetGeneric(File &fp, const Parameter ¶m) const fp.print("#endif\n\n"); } - fp.print("\tconst %s * base = NULL;\n", templateName); - fp.print("\tif (m_baseData != NULL)\n"); + fp.print("\tconst %s * base = nullptr;\n", templateName); + fp.print("\tif (m_baseData != nullptr)\n"); fp.print("\t{\n"); fp.print("\t\tbase = dynamic_cast(m_baseData);\n", templateName); -// fp.print("\t\tDEBUG_FATAL(base == NULL, (\"base template wrong type\"));\n"); +// fp.print("\t\tDEBUG_FATAL(base == nullptr, (\"base template wrong type\"));\n"); if (param.list_type == LIST_NONE) { // get the test base value fp.print("#ifdef _DEBUG\n"); - fp.print("\t\tif (testData && base != NULL)\n"); + fp.print("\t\tif (testData && base != nullptr)\n"); fp.print("\t\t\ttestDataValue = base->get%s%s(true);\n", upperName.c_str(), MinMaxNames[i]); fp.print("#endif\n"); @@ -2651,7 +2651,7 @@ void TemplateData::writeSourceGetGeneric(File &fp, const Parameter ¶m) const fp.print("\t}\n\n"); const char *arrayIndex = ""; - std::string indexName = m_templateParent == NULL ? "" : "versionOk"; + std::string indexName = m_templateParent == nullptr ? "" : "versionOk"; const char *access = "."; if (param.list_type == LIST_NONE) { @@ -2689,9 +2689,9 @@ void TemplateData::writeSourceGetGeneric(File &fp, const Parameter ¶m) const fp.print("\tif (delta == '+' || delta == '-' || delta == '_' || delta == '=')\n"); fp.print("\t{\n"); fp.print("\t\t%s baseValue = 0;\n", UnpaddedDataMethodNames[param.type]); - fp.print("\t\tif (m_baseData != NULL)\n"); + fp.print("\t\tif (m_baseData != nullptr)\n"); fp.print("\t\t{\n"); - fp.print("\t\t\tif (base != NULL)\n"); + fp.print("\t\t\tif (base != nullptr)\n"); fp.print("\t\t\t\tbaseValue = base->get%s%s(%s);\n", upperName.c_str(), MinMaxNames[i], indexName.c_str()); fp.print("\t\t\telse if (ms_allowDefaultTemplateParams)\n"); @@ -2716,7 +2716,7 @@ void TemplateData::writeSourceGetGeneric(File &fp, const Parameter ¶m) const { // check the return value vs the base value, and warn if the same fp.print("#ifdef _DEBUG\n"); - fp.print("\tif (testData && base != NULL)\n"); + fp.print("\tif (testData && base != nullptr)\n"); fp.print("\t{\n"); // fp.print("\t\tif (testDataValue == value)\n"); // fp.print("\t\t\tDEBUG_WARNING(true, (\"Template %%s, parameter %s is " @@ -2758,12 +2758,12 @@ void TemplateData::writeSourceGetVector(File &fp, const Parameter ¶m) const fp.print(") const\n"); fp.print("{\n"); - fp.print("\tconst %s * base = NULL;\n", templateName); - fp.print("\tif (m_baseData != NULL)\n"); + fp.print("\tconst %s * base = nullptr;\n", templateName); + fp.print("\tif (m_baseData != nullptr)\n"); fp.print("\t{\n"); fp.print("\t\tbase = dynamic_cast(m_baseData);\n", templateName); -// fp.print("\t\tDEBUG_FATAL(base == NULL, (\"base template wrong type\"));\n"); +// fp.print("\t\tDEBUG_FATAL(base == nullptr, (\"base template wrong type\"));\n"); fp.print("\t}\n\n"); const char *arrayIndex = ""; @@ -2820,18 +2820,18 @@ void TemplateData::writeSourceGetDynamicVariable(File &fp, const Parameter ¶ fp.print(") const\n"); fp.print("{\n"); - fp.print("\tconst %s * base = NULL;\n", templateName); - fp.print("\tif (m_baseData != NULL)\n"); + fp.print("\tconst %s * base = nullptr;\n", templateName); + fp.print("\tif (m_baseData != nullptr)\n"); fp.print("\t{\n"); fp.print("\t\tbase = dynamic_cast(m_baseData);\n", templateName); -// fp.print("\t\tDEBUG_FATAL(base == NULL, (\"base template wrong type\"));\n"); +// fp.print("\t\tDEBUG_FATAL(base == nullptr, (\"base template wrong type\"));\n"); fp.print("\t}\n\n"); if (param.list_type == LIST_NONE) { writeSourceReturnBaseValue(fp, param, ""); - fp.print("\tif (m_%s.isExtendingBaseList() && base != NULL)\n", pname); + fp.print("\tif (m_%s.isExtendingBaseList() && base != nullptr)\n", pname); fp.print("\t\tbase->get%s(list);\n", upperName.c_str()); fp.print("\tm_%s.getDynamicVariableList(list);\n", pname); } @@ -2840,7 +2840,7 @@ void TemplateData::writeSourceGetDynamicVariable(File &fp, const Parameter ¶ fp.print("\tDEBUG_FATAL(index < 0 || index >= %d, (\"" "template param index out of range\"));\n", param.list_size); writeSourceReturnBaseValue(fp, param, ""); - fp.print("\tif (m_%s[index].isExtendingBaseList() && base != NULL)\n", pname); + fp.print("\tif (m_%s[index].isExtendingBaseList() && base != nullptr)\n", pname); fp.print("\t\tbase->get%s(list, index);\n", upperName.c_str()); fp.print("\tm_%s[index].getDynamicVariableList(list);\n", pname); } @@ -2872,19 +2872,19 @@ void TemplateData::writeSourceGetTemplate(File &fp, const Parameter ¶m) cons fp.print(") const\n"); fp.print("{\n"); - fp.print("\tconst %s * base = NULL;\n", templateName); - fp.print("\tif (m_baseData != NULL)\n"); + fp.print("\tconst %s * base = nullptr;\n", templateName); + fp.print("\tif (m_baseData != nullptr)\n"); fp.print("\t{\n"); fp.print("\t\tbase = dynamic_cast(m_baseData);\n", templateName); -// fp.print("\t\tDEBUG_FATAL(base == NULL, (\"base template wrong type\"));\n"); +// fp.print("\t\tDEBUG_FATAL(base == nullptr, (\"base template wrong type\"));\n"); fp.print("\t}\n\n"); if (param.list_type == LIST_NONE) { writeSourceReturnBaseValue(fp, param, ""); - fp.print("\tconst %s%s * returnValue = NULL;\n", + fp.print("\tconst %s%s * returnValue = nullptr;\n", EnumLocationTypes[getTemplateLocation()], filenameLowerToUpper(param.extendedName).c_str()); fp.print("\tconst std::string & templateName = m_%s.getValue();\n", pname); @@ -2894,7 +2894,7 @@ void TemplateData::writeSourceGetTemplate(File &fp, const Parameter ¶m) cons "ObjectTemplateList::fetch(templateName));\n", EnumLocationTypes[getTemplateLocation()], filenameLowerToUpper(param.extendedName).c_str()); - fp.print("\t\tif (returnValue == NULL)\n"); + fp.print("\t\tif (returnValue == nullptr)\n"); fp.print("\t\t\tWARNING_STRICT_FATAL(true, (\"Error loading template %%s\"," "templateName.c_str()));\n"); fp.print("\t}\n"); @@ -2918,7 +2918,7 @@ void TemplateData::writeSourceGetTemplate(File &fp, const Parameter ¶m) cons writeSourceReturnBaseValue(fp, param, ""); } - fp.print("\tconst %s%s * returnValue = NULL;\n", + fp.print("\tconst %s%s * returnValue = nullptr;\n", EnumLocationTypes[getTemplateLocation()], filenameLowerToUpper(param.extendedName).c_str()); fp.print("\tconst std::string & templateName = m_%s[index]%sgetValue();\n", @@ -2929,7 +2929,7 @@ void TemplateData::writeSourceGetTemplate(File &fp, const Parameter ¶m) cons "ObjectTemplateList::fetch(templateName));\n", EnumLocationTypes[getTemplateLocation()], filenameLowerToUpper(param.extendedName).c_str()); - fp.print("\t\tif (returnValue == NULL)\n"); + fp.print("\t\tif (returnValue == nullptr)\n"); fp.print("\t\t\tWARNING_STRICT_FATAL(true, (\"Error loading template %%s\"," "templateName.c_str()));\n"); fp.print("\t}\n"); @@ -2974,17 +2974,17 @@ void TemplateData::writeSourceGetEnum(File &fp, const Parameter ¶m) const fp.print("#endif\n\n"); } - fp.print("\tconst %s * base = NULL;\n", className); - fp.print("\tif (m_baseData != NULL)\n"); + fp.print("\tconst %s * base = nullptr;\n", className); + fp.print("\tif (m_baseData != nullptr)\n"); fp.print("\t{\n"); fp.print("\t\tbase = dynamic_cast(m_baseData);\n", className); -// fp.print("\t\tDEBUG_FATAL(base == NULL, (\"base template wrong type\"));\n"); +// fp.print("\t\tDEBUG_FATAL(base == nullptr, (\"base template wrong type\"));\n"); if (param.list_type == LIST_NONE) { // get the test base value fp.print("#ifdef _DEBUG\n"); - fp.print("\t\tif (testData && base != NULL)\n"); + fp.print("\t\tif (testData && base != nullptr)\n"); fp.print("\t\t\ttestDataValue = base->get%s(true);\n", upperName.c_str()); fp.print("#endif\n"); } @@ -2999,7 +2999,7 @@ void TemplateData::writeSourceGetEnum(File &fp, const Parameter ¶m) const // check the return value vs the base value, and warn if the same fp.print("#ifdef _DEBUG\n"); - fp.print("\tif (testData && base != NULL)\n"); + fp.print("\tif (testData && base != nullptr)\n"); fp.print("\t{\n"); // fp.print("\t\tif (testDataValue == value)\n"); // fp.print("\t\t\tDEBUG_WARNING(true, (\"Template %%s, parameter %s is " @@ -3061,11 +3061,11 @@ std::string upperName; fp.print(") const\n"); fp.print("{\n"); - fp.print("\tconst %s * base = NULL;\n", templateName); - fp.print("\tif (m_baseData != NULL)\n"); + fp.print("\tconst %s * base = nullptr;\n", templateName); + fp.print("\tif (m_baseData != nullptr)\n"); fp.print("\t{\n"); fp.print("\t\tbase = dynamic_cast(m_baseData);\n", templateName); -// fp.print("\t\tDEBUG_FATAL(base == NULL, (\"base template wrong type\"));\n"); +// fp.print("\t\tDEBUG_FATAL(base == nullptr, (\"base template wrong type\"));\n"); fp.print("\t}\n\n"); if (param.list_type == LIST_NONE) @@ -3100,7 +3100,7 @@ std::string upperName; fp.print("\tNOT_NULL(param);\n"); const TemplateData *structData = getStruct(param.extendedName.c_str()); - if (structData == NULL) + if (structData == nullptr) { fprintf(stderr, "unable to find structure %s\n", param.extendedName.c_str()); @@ -3108,7 +3108,7 @@ std::string upperName; } std::string versionString = "versionOk"; - if (m_templateParent == NULL) + if (m_templateParent == nullptr) versionString = "m_" + versionString; structData->writeSourceGetStructAssignments(fp, versionString, MinMaxNames[i]); @@ -3248,7 +3248,7 @@ void TemplateData::writeSourceReadIff(File &fp) const fp.print("char paramName[MAX_NAME_SIZE];\n"); fp.print("\n"); - if (m_fileParent != NULL) + if (m_fileParent != nullptr) { // check that we are in our form fp.print("\tif (file.getCurrentName() != %s_tag)\n", @@ -3277,14 +3277,14 @@ void TemplateData::writeSourceReadIff(File &fp) const // fp.print("\t\t%s * mybase = dynamic_cast<%s *>(base);\n", // templateName, templateName); - // fp.print("\t\tFATAL(mybase == NULL, (\"trying to derive a template from an incompatable template type\"));\n"); - fp.print("\t\tDEBUG_WARNING(base == NULL, (\"was unable to load base template %%s\", baseFilename.c_str()));\n"); - fp.print("\t\tif (m_baseData == base && base != NULL)\n"); + // fp.print("\t\tFATAL(mybase == nullptr, (\"trying to derive a template from an incompatable template type\"));\n"); + fp.print("\t\tDEBUG_WARNING(base == nullptr, (\"was unable to load base template %%s\", baseFilename.c_str()));\n"); + fp.print("\t\tif (m_baseData == base && base != nullptr)\n"); fp.print("\t\t\tbase->releaseReference();\n"); fp.print("\t\telse\n"); fp.print("\t\t{\n"); - fp.print("\t\t\tif (m_baseData != NULL)\n"); + fp.print("\t\t\tif (m_baseData != nullptr)\n"); fp.print("\t\t\t\tm_baseData->releaseReference();\n"); fp.print("\t\t\tm_baseData = base;\n"); @@ -3356,7 +3356,7 @@ void TemplateData::writeSourceReadIff(File &fp) const " ++iter)\n", param.name.c_str(), param.name.c_str()); fp.print("\t\t\t{\n"); fp.print("\t\t\t\tdelete *iter;\n"); - fp.print("\t\t\t\t*iter = NULL;\n"); + fp.print("\t\t\t\t*iter = nullptr;\n"); fp.print("\t\t\t}\n"); fp.print("\t\t\tm_%s.clear();\n", param.name.c_str()); fp.print("\t\t\tm_%sAppend = file.read_bool8();\n", param.name.c_str()); @@ -3408,7 +3408,7 @@ void TemplateData::writeSourceReadIff(File &fp) const fp.print("\n"); fp.print("\tfile.exitForm();\n"); - if (m_fileParent != NULL) + if (m_fileParent != nullptr) { // enter the next form if (!baseNameString.empty() && baseNameString != ROOT_TEMPLATE_NAME) @@ -3450,7 +3450,7 @@ void TemplateData::writeSourceWriteIff(File &fp) const fp.print("int count;\n\n"); // write form enter header stuff - if (m_fileParent != NULL) + if (m_fileParent != nullptr) { fp.print("\tfile.insertForm(%s_tag);\n", m_fileParent->getTemplateName().c_str()); @@ -3552,7 +3552,7 @@ void TemplateData::writeSourceWriteIff(File &fp) const fp.print("\n"); fp.print("\tfile.exitForm(true);\n"); - if (m_fileParent != NULL) + if (m_fileParent != nullptr) { // call base class write iff method if (!getBaseName().empty() && getBaseName() != ROOT_TEMPLATE_NAME) @@ -3576,7 +3576,7 @@ void TemplateData::writeSourceWriteIff(File &fp) const */ void TemplateData::writeSourceCleanup(File &fp) const { - if (m_fileParent != NULL) + if (m_fileParent != nullptr) fp.print("%s\n", TDF_CLEANUP_BEGIN); const char * const * variableNames = DataVariableNames; @@ -3613,7 +3613,7 @@ void TemplateData::writeSourceCleanup(File &fp) const " ++iter)\n", param.name.c_str(), param.name.c_str()); fp.print("\t\t{\n"); fp.print("\t\t\tdelete *iter;\n"); - fp.print("\t\t\t*iter = NULL;\n"); + fp.print("\t\t\t*iter = nullptr;\n"); fp.print("\t\t}\n"); fp.print("\t\tm_%s.clear();\n", param.name.c_str()); fp.print("\t}\n"); @@ -3624,7 +3624,7 @@ void TemplateData::writeSourceCleanup(File &fp) const } } - if (m_fileParent != NULL) + if (m_fileParent != nullptr) fp.print("%s\n", TDF_CLEANUP_END); } // TemplateData::writeSourceCleanup @@ -3719,9 +3719,9 @@ ParameterList::const_iterator iter; fp.print("\t\t{\n"); fp.print("\t\t\tif (deepCheck && !isParamLoaded(name, false, 0))\n"); fp.print("\t\t\t{\n"); - fp.print("\t\t\t\tif (getBaseTemplate() != NULL)\n"); + fp.print("\t\t\t\tif (getBaseTemplate() != nullptr)\n"); fp.print("\t\t\t\t\treturn getBaseTemplate()->get%s(name, deepCheck, index);\n", FUNC_NAMES[i]); - fp.print("\t\t\t\treturn NULL;\n"); + fp.print("\t\t\t\treturn nullptr;\n"); fp.print("\t\t\t}\n"); fp.print("\t\t\treturn &m_%s;\n", pname); fp.print("\t\t}\n"); @@ -3751,9 +3751,9 @@ ParameterList::const_iterator iter; fp.print("\t\t{\n"); fp.print("\t\t\tif (deepCheck && !isParamLoaded(name, false, index))\n"); fp.print("\t\t\t{\n"); - fp.print("\t\t\t\tif (getBaseTemplate() != NULL)\n"); + fp.print("\t\t\t\tif (getBaseTemplate() != nullptr)\n"); fp.print("\t\t\t\t\treturn getBaseTemplate()->get%s(name, deepCheck, index);\n", FUNC_NAMES[i]); - fp.print("\t\t\t\treturn NULL;\n"); + fp.print("\t\t\t\treturn nullptr;\n"); fp.print("\t\t\t}\n"); fp.print("\t\t\treturn &m_%s[index];\n", pname); fp.print("\t\t}\n"); @@ -3774,7 +3774,7 @@ ParameterList::const_iterator iter; fp.print("\treturn %s::get%s(name, deepCheck, index);\n", baseName, FUNC_NAMES[i]); } if (paramCount != 0) - fp.print("\treturn NULL;\n"); + fp.print("\treturn nullptr;\n"); fp.print("}\t//%s::get%s\n", templateName, FUNC_NAMES[i]); fp.print("\n"); } @@ -4227,7 +4227,7 @@ void TemplateData::writeParameterDefault(File &fp, const Parameter ¶m, int i case LIST_ENUM_ARRAY: { const EnumList * enumList = getEnumList(param.enum_list_name, false); - DEBUG_FATAL(enumList == NULL, ("unknown enum name %s", + DEBUG_FATAL(enumList == nullptr, ("unknown enum name %s", param.enum_list_name.c_str())); if (index >= 0 && index < param.list_size) @@ -4288,7 +4288,7 @@ void TemplateData::writeStructParameterDefault(File &fp, const Parameter ¶m, case LIST_ENUM_ARRAY: { const EnumList * enumList = getEnumList(param.enum_list_name, false); - DEBUG_FATAL(enumList == NULL, ("unknown enum name %s", + DEBUG_FATAL(enumList == nullptr, ("unknown enum name %s", param.enum_list_name.c_str())); EnumList::const_iterator listIter; @@ -4357,7 +4357,7 @@ void TemplateData::writeDefaultValue(File &fp, const Parameter ¶m) const case TYPE_ENUM: { const EnumList * enumList = getEnumList(param.extendedName, false); - DEBUG_FATAL(enumList == NULL, ("unknown enum name %s", + DEBUG_FATAL(enumList == nullptr, ("unknown enum name %s", param.extendedName.c_str())); fp.print("%s", enumList->at(0).name.c_str()); } @@ -4398,7 +4398,7 @@ const TemplateData::Parameter *TemplateData::getParameter( { NOT_NULL(name); - TemplateData::Parameter const *result = NULL; + TemplateData::Parameter const *result = nullptr; // Shallow check, just checks this immediate tdf @@ -4414,7 +4414,7 @@ const TemplateData::Parameter *TemplateData::getParameter( const TemplateDefinitionFile *TemplateDefinitionFile = getTdfForParameter(name); - if (TemplateDefinitionFile != NULL) + if (TemplateDefinitionFile != nullptr) { result = TemplateDefinitionFile->getTemplateData(TemplateDefinitionFile->getHighestVersion())->getParameter(name); } diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateData.h b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateData.h index cac38cd7..f7949388 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateData.h +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateData.h @@ -238,11 +238,11 @@ inline bool TemplateData::isWritingForCompiler(void) const inline const TemplateDefinitionFile * TemplateData::getFileParent(void) const { - if (m_fileParent != NULL) + if (m_fileParent != nullptr) return m_fileParent; - if (m_templateParent != NULL) + if (m_templateParent != nullptr) return m_templateParent->getFileParent(); - return NULL; + return nullptr; } // TemplateData::getFileParent diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateDataIterator.cpp b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateDataIterator.cpp index 11b8d2dd..5a5c1c48 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateDataIterator.cpp +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateDataIterator.cpp @@ -25,7 +25,7 @@ //----------------------------------------------------------------------------- TemplateDataIterator::TemplateDataIterator() -: m_templateDataToIterate(NULL), +: m_templateDataToIterate(nullptr), m_numItems(0), m_noMoreData(true) { @@ -34,7 +34,7 @@ TemplateDataIterator::TemplateDataIterator() //----------------------------------------------------------------------------- TemplateDataIterator::TemplateDataIterator(const TemplateData& templateData) -: m_templateDataToIterate(NULL), +: m_templateDataToIterate(nullptr), m_numItems(0), m_noMoreData(true) { @@ -45,7 +45,7 @@ TemplateDataIterator::TemplateDataIterator(const TemplateData& templateData) TemplateDataIterator::~TemplateDataIterator() { - m_templateDataToIterate = NULL; + m_templateDataToIterate = nullptr; } //----------------------------------------------------------------------------- @@ -62,7 +62,7 @@ TemplateDataIterator::setTo(const TemplateData &templateData) // .. end at the child TDF's. const ParameterList* parameterListToAdd; - while(m_templateDataToIterate != NULL) + while(m_templateDataToIterate != nullptr) { parameterListToAdd = &(m_templateDataToIterate->m_parameters); m_numItems += parameterListToAdd->size(); @@ -75,23 +75,23 @@ TemplateDataIterator::setTo(const TemplateData &templateData) } // Get the template data from the parent TDF - if(m_templateDataToIterate->m_fileParent != NULL) + if(m_templateDataToIterate->m_fileParent != nullptr) { const TemplateDefinitionFile* parentFile = m_templateDataToIterate->m_fileParent->getBaseDefinitionFile(); - if(parentFile != NULL) + if(parentFile != nullptr) { m_templateDataToIterate = parentFile->getTemplateData(parentFile->getHighestVersion()); } else { - m_templateDataToIterate = NULL; + m_templateDataToIterate = nullptr; } } else { - m_templateDataToIterate = NULL; + m_templateDataToIterate = nullptr; } } @@ -164,7 +164,7 @@ TemplateDataIterator::operator *() const { if(this->end()) { - return NULL; + return nullptr; } else { diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateDefinitionFile.cpp b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateDefinitionFile.cpp index f191b3fb..4025ab5f 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateDefinitionFile.cpp +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateDefinitionFile.cpp @@ -20,9 +20,9 @@ * Class constructor. */ TemplateDefinitionFile::TemplateDefinitionFile(void) : - m_baseDefinitionFile(NULL), + m_baseDefinitionFile(nullptr), m_writeForCompilerFlag(false), - m_filterCompiledRegex(NULL) + m_filterCompiledRegex(nullptr) { cleanup(); } // TemplateDefinitionFile::TemplateDefinitionFile @@ -51,24 +51,24 @@ void TemplateDefinitionFile::cleanup(void) m_compilerPath.clear(); m_fileComments.clear(); - if (m_baseDefinitionFile != NULL) + if (m_baseDefinitionFile != nullptr) { delete m_baseDefinitionFile; - m_baseDefinitionFile = NULL; + m_baseDefinitionFile = nullptr; } std::map::iterator iter; for (iter = m_templateMap.begin(); iter != m_templateMap.end(); ++iter) { delete (*iter).second; - (*iter).second = NULL; + (*iter).second = nullptr; } m_templateMap.clear(); - if (m_filterCompiledRegex != NULL) + if (m_filterCompiledRegex != nullptr) { RegexServices::freeMemory(m_filterCompiledRegex); - m_filterCompiledRegex = NULL; + m_filterCompiledRegex = nullptr; } } // TemplateDefinitionFile::cleanup @@ -104,7 +104,7 @@ static const std::string wildcard = "*"; if (!m_templateNameFilter.empty()) return m_templateNameFilter; - if (m_baseDefinitionFile != NULL) + if (m_baseDefinitionFile != nullptr) return m_baseDefinitionFile->getTemplateNameFilter(); return wildcard; @@ -121,7 +121,7 @@ bool TemplateDefinitionFile::isValidTemplateName(const Filename & name) const { if (m_templateNameFilter.empty()) { - if (m_baseDefinitionFile != NULL) + if (m_baseDefinitionFile != nullptr) return m_baseDefinitionFile->isValidTemplateName(name); else return true; @@ -131,7 +131,7 @@ bool TemplateDefinitionFile::isValidTemplateName(const Filename & name) const int const matchDataElementCount = maxCaptureCount * 3; int matchData[matchDataElementCount]; - int const matchCode = pcre_exec(m_filterCompiledRegex, NULL, name.getName().c_str(), name.getName().length(), 0, 0, matchData, matchDataElementCount); + int const matchCode = pcre_exec(m_filterCompiledRegex, nullptr, name.getName().c_str(), name.getName().length(), 0, 0, matchData, matchDataElementCount); bool const result = (matchCode >= 0); if (matchCode < -1) @@ -425,10 +425,10 @@ void TemplateDefinitionFile::writeClassSourceBegin(File &fp, const TemplateData fp.print(" */\n"); fp.print("Tag %s::getHighestTemplateVersion(void) const\n", name); fp.print("{\n"); - fp.print("\tif (m_baseData == NULL)\n"); + fp.print("\tif (m_baseData == nullptr)\n"); fp.print("\t\treturn m_templateVersion;\n"); fp.print("\tconst %s * base = dynamic_cast(m_baseData);\n", name, name); - fp.print("\tif (base == NULL)\n"); + fp.print("\tif (base == nullptr)\n"); fp.print("\t\treturn m_templateVersion;\n"); fp.print("\treturn std::max(m_templateVersion, base->getHighestTemplateVersion());\n"); fp.print("} // %s::getHighestTemplateVersion\n", name); @@ -449,7 +449,7 @@ static const int BUFFER_SIZE = 1024; int lineLen; char buffer[BUFFER_SIZE]; char token[BUFFER_SIZE]; -TemplateData *currentTemplate = NULL; +TemplateData *currentTemplate = nullptr; cleanup(); @@ -510,7 +510,7 @@ TemplateData *currentTemplate = NULL; currentTemplate = new TemplateData(version, *this); m_templateMap[version] = currentTemplate; } - else if (currentTemplate != NULL) + else if (currentTemplate != nullptr) { line = currentTemplate->parseLine(fp, buffer, token); if (line == CHAR_ERROR) @@ -540,7 +540,7 @@ TemplateData *currentTemplate = NULL; fp.printError("unable to open base template definition"); return -1; } - if (m_baseDefinitionFile == NULL) + if (m_baseDefinitionFile == nullptr) m_baseDefinitionFile = new TemplateDefinitionFile; else m_baseDefinitionFile->cleanup(); @@ -570,19 +570,19 @@ TemplateData *currentTemplate = NULL; m_templateNameFilter = token; //-- Attempt to compile the regex. - if (m_filterCompiledRegex != NULL) + if (m_filterCompiledRegex != nullptr) { // First free the existing compiled regex. RegexServices::freeMemory(m_filterCompiledRegex); - m_filterCompiledRegex = NULL; + m_filterCompiledRegex = nullptr; } //-- Compile the new regex. - char const *errorString = NULL; + char const *errorString = nullptr; int errorOffset = 0; - m_filterCompiledRegex = pcre_compile(m_templateNameFilter.c_str(), 0, &errorString, &errorOffset, NULL); - WARNING(m_filterCompiledRegex == NULL, ("TemplateDefinitionFile::parse(): pcre_compile() failed, error=[%s], errorOffset=[%d], regex text=[%s].", errorString, errorOffset, m_templateNameFilter.c_str())); + m_filterCompiledRegex = pcre_compile(m_templateNameFilter.c_str(), 0, &errorString, &errorOffset, nullptr); + WARNING(m_filterCompiledRegex == nullptr, ("TemplateDefinitionFile::parse(): pcre_compile() failed, error=[%s], errorOffset=[%d], regex text=[%s].", errorString, errorOffset, m_templateNameFilter.c_str())); } else if (strcmp(token, "clientpath") == 0 || strcmp(token, "serverpath") == 0 || diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateDefinitionFile.h b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateDefinitionFile.h index 82487e67..2ea426fc 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateDefinitionFile.h +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateDefinitionFile.h @@ -111,7 +111,7 @@ inline TemplateData *TemplateDefinitionFile::getTemplateData(int version) const { std::map::const_iterator iter = m_templateMap.find(version); if (iter == m_templateMap.end()) - return NULL; + return nullptr; return (*iter).second; } diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateGlobals.cpp b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateGlobals.cpp index 2b376aa0..b12dc5ef 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateGlobals.cpp +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateGlobals.cpp @@ -57,15 +57,15 @@ int strip(char *buffer) * the size of buffer * * @return the next non-whitespace character in the string after the token, or - * NULL if the end of line has been reached + * nullptr if the end of line has been reached */ const char *getNextWhitespaceToken(const char *buffer, char *token) { NOT_NULL(token); *token = '\0'; - if (buffer == NULL) - return NULL; + if (buffer == nullptr) + return nullptr; const char *from = buffer; char *to = token; @@ -74,7 +74,7 @@ const char *getNextWhitespaceToken(const char *buffer, char *token) while (isspace(*from) && *from != '\0') ++from; if (*from == '\0') - return NULL; + return nullptr; // copy the token while (!isspace(*from) && *from != '\0') @@ -85,7 +85,7 @@ const char *getNextWhitespaceToken(const char *buffer, char *token) while (isspace(*from) && *from != '\0') ++from; if (*from == '\0') - return NULL; + return nullptr; return from; } // getNextWhitespaceToken @@ -97,20 +97,20 @@ const char *getNextWhitespaceToken(const char *buffer, char *token) * the size of buffer * * @return the next token, defined by the 1st non-whitespace character in buffer: - * if it is '/' and the next character is '/', NULL + * if it is '/' and the next character is '/', nullptr * if it is a double-quote, the text until the next double quote (not including \") * if it is a symbol, the symbol * if it is a number, the next characters that make a valid integer or float * if it is a character, the text until the next whitespace or symbol, not including _ - * if it is NULL, NULL + * if it is nullptr, nullptr */ const char *getNextToken(const char *buffer, char *token) { NOT_NULL(token); *token = '\0'; - if (buffer == NULL) - return NULL; + if (buffer == nullptr) + return nullptr; const char *from = buffer; char *to = token; @@ -119,12 +119,12 @@ const char *getNextToken(const char *buffer, char *token) while (isspace(*from) && *from != '\0') ++from; if (*from == '\0') - return NULL; + return nullptr; if (*from == '/' && *(from+1) == '/') { // comment - return NULL; + return nullptr; } else if (isdigit(*from) || ((*from == '+' || *from == '-') && isdigit(*(from + 1))) @@ -173,7 +173,7 @@ const char *getNextToken(const char *buffer, char *token) while (isspace(*from) && *from != '\0') ++from; if (*from == '\0') - return NULL; + return nullptr; return from; } // getNextToken @@ -247,9 +247,9 @@ std::string filenameUpperToLower(const std::string & filename) std::string concatPaths(const char *path1, const char *path2) { // test for missing path - if (path1 == NULL || *path1 == '\0') + if (path1 == nullptr || *path1 == '\0') return path2; - if (path2 == NULL || *path2 == '\0') + if (path2 == nullptr || *path2 == '\0') return path1; #ifdef WIN32 @@ -286,7 +286,7 @@ std::string getNextHighestPath(const char *path) // find the two highest path separators const char *separator1 = strrchr(path, PATH_SEPARATOR); - if (separator1 == NULL) + if (separator1 == nullptr) { #ifdef WIN32 if (isalpha(*path) && *(path + 1) == ':') @@ -304,7 +304,7 @@ std::string getNextHighestPath(const char *path) return std::string(path, 3); #endif const char *separator2 = strrchr(separator1 - 1, PATH_SEPARATOR); - if (separator2 == NULL) + if (separator2 == nullptr) return std::string(path, separator1 - path); return std::string(path, separator2 - path); diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TpfFile.cpp b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TpfFile.cpp index 425bf716..23b456d5 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TpfFile.cpp +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TpfFile.cpp @@ -27,12 +27,12 @@ * Class constructor. */ TpfFile::TpfFile(void) : - m_template(NULL), + m_template(nullptr), m_baseTemplateName(), - m_currTemplateDef(NULL), - m_templateData(NULL), - m_highestTemplateData(NULL), - m_parameter(NULL), + m_currTemplateDef(nullptr), + m_templateData(nullptr), + m_highestTemplateData(nullptr), + m_parameter(nullptr), m_path(), m_iffPath(), m_templateLocation(LOC_NONE) @@ -53,14 +53,14 @@ TpfFile::~TpfFile() */ void TpfFile::cleanup(void) { - m_parameter = NULL; + m_parameter = nullptr; m_fp.close(); - if (m_template != NULL) + if (m_template != nullptr) { delete m_template; - m_template = NULL; + m_template = nullptr; } - m_currTemplateDef = NULL; + m_currTemplateDef = nullptr; IGNORE_RETURN(m_baseTemplateName.erase()); } // TpfFile::cleanup @@ -174,7 +174,7 @@ int TpfFile::loadTemplate(const Filename & filename) if (lineLen == -1) { // if we are a base template, check for missing parameters - if (m_highestTemplateData != NULL && m_template != NULL && + if (m_highestTemplateData != nullptr && m_template != nullptr && !m_highestTemplateData->verifyTemplate(m_template, m_fp)) { result = -1; @@ -190,7 +190,7 @@ int TpfFile::loadTemplate(const Filename & filename) // parse the 1st token: comment, @flag, or variable name const char *line = m_buffer; line = getNextToken(line, m_token); - if (*m_token == '\0' && line == NULL) + if (*m_token == '\0' && line == nullptr) { // empty line or comment continue; @@ -201,7 +201,7 @@ int TpfFile::loadTemplate(const Filename & filename) } else if (isalpha(*m_token)) { - if (m_template == NULL) + if (m_template == nullptr) { m_fp.printError("unable to parse parameters, no template class defined"); return -1; @@ -209,7 +209,7 @@ int TpfFile::loadTemplate(const Filename & filename) line = parseAssignment(line); if (line == CHAR_ERROR) result = -1; - else if (line != NULL) + else if (line != nullptr) { char buffer[1024]; if (getNextToken(line, buffer)) @@ -261,7 +261,7 @@ int TpfFile::makeIffFiles(const Filename & filename) if (result != 0) return result; - Filename iffname(NULL, m_iffPath.c_str(), filename.getName().c_str(), + Filename iffname(nullptr, m_iffPath.c_str(), filename.getName().c_str(), IFF_EXTENSION); Iff iffFile(1024, true, true); m_template->save(iffFile); @@ -291,20 +291,20 @@ int TpfFile::WriteIffFile(Iff & iffData, const Filename & fileName) { // there are problems with long path names in Windows that changing to // the directory seems to fix - char *buffer = NULL; + char *buffer = nullptr; DWORD buflen; // get our current path - buflen = GetFullPathName(".", 0, buffer, NULL); + buflen = GetFullPathName(".", 0, buffer, nullptr); buffer = new char[buflen + 1]; - buflen = GetFullPathName(".", buflen + 1, buffer, NULL); + buflen = GetFullPathName(".", buflen + 1, buffer, nullptr); Unicode::String srcPath = Unicode::narrowToWide(buffer); delete[] buffer; srcPath = L"\\\\?\\" + srcPath; // get the destination path std::string correctPath(fileName.getDrive() + fileName.getPath()); - buflen = GetFullPathName(correctPath.c_str(), 0, buffer, NULL); + buflen = GetFullPathName(correctPath.c_str(), 0, buffer, nullptr); buffer = new char[buflen + 1]; - buflen = GetFullPathName(correctPath.c_str(), buflen + 1, buffer, NULL); + buflen = GetFullPathName(correctPath.c_str(), buflen + 1, buffer, nullptr); Unicode::String destPath = Unicode::narrowToWide(buffer); delete[] buffer; destPath = L"\\\\?\\" + destPath; @@ -323,18 +323,18 @@ int TpfFile::WriteIffFile(Iff & iffData, const Filename & fileName) } else { - char *buffer = NULL; + char *buffer = nullptr; DWORD buflen; // get our current path - buflen = GetFullPathName(".", 0, buffer, NULL); + buflen = GetFullPathName(".", 0, buffer, nullptr); buffer = new char[buflen + 1]; - buflen = GetFullPathName(".", buflen + 1, buffer, NULL); + buflen = GetFullPathName(".", buflen + 1, buffer, nullptr); delete[] buffer; // get the destination path std::string correctPath(fileName.getDrive() + fileName.getPath()); - buflen = GetFullPathName(correctPath.c_str(), 0, buffer, NULL); + buflen = GetFullPathName(correctPath.c_str(), 0, buffer, nullptr); buffer = new char[buflen + 1]; - buflen = GetFullPathName(correctPath.c_str(), buflen + 1, buffer, NULL); + buflen = GetFullPathName(correctPath.c_str(), buflen + 1, buffer, nullptr); std::string destPath = buffer; delete[] buffer; // change to the destination path @@ -389,7 +389,7 @@ int result = 0; cleanup(); File temp_fp; - if (!temp_fp.open(tmpnam(NULL), "wt")) + if (!temp_fp.open(tmpnam(nullptr), "wt")) { fprintf(stderr, "error opening temp file for template replacement\n"); return -1; @@ -419,7 +419,7 @@ int result = 0; // parse the 1st token: comment, @flag, or variable name const char *line = m_buffer; line = getNextToken(line, m_token); - if (*m_token == '\0' && line == NULL) + if (*m_token == '\0' && line == nullptr) { // empty line or comment if (temp_fp.puts(m_buffer) < 0) @@ -432,7 +432,7 @@ int result = 0; { // @base or @class const char *templine = getNextToken(line, m_token); - if (templine == NULL) + if (templine == nullptr) { m_fp.printEolError(); return -1; @@ -452,7 +452,7 @@ int result = 0; else { // if we are a base template, check for missing parameters - if (m_highestTemplateData != NULL && m_template != NULL) + if (m_highestTemplateData != nullptr && m_template != nullptr) { m_highestTemplateData->updateTemplate(m_template, temp_fp); } @@ -462,7 +462,7 @@ int result = 0; else if (isalpha(*m_token)) { m_parameter = m_templateData->getParameter(m_token); - if (m_parameter == NULL) + if (m_parameter == nullptr) { } else @@ -494,14 +494,14 @@ int result = 0; int TpfFile::parseTemplateCommand(const char *line) { line = getNextToken(line, m_token); - if (line == NULL) + if (line == nullptr) { m_fp.printEolError(); return -1; } if (strcmp(m_token, "base") == 0) { - if (m_template != NULL && !m_template->getBaseTemplateName().empty()) + if (m_template != nullptr && !m_template->getBaseTemplateName().empty()) { m_fp.printError("base template already defined"); return -1; @@ -509,7 +509,7 @@ int TpfFile::parseTemplateCommand(const char *line) line = getNextWhitespaceToken(line, m_token); if (isalpha(*m_token)) { - if (m_template != NULL) + if (m_template != nullptr) { if (m_template->setBaseTemplateName(m_token) != 0) { @@ -536,7 +536,7 @@ int TpfFile::parseTemplateCommand(const char *line) { // if we are a base template, check for missing parameters // @todo: fix so we can verify non-base templates - if (m_highestTemplateData != NULL && m_template != NULL && + if (m_highestTemplateData != nullptr && m_template != nullptr && !m_highestTemplateData->verifyTemplate(m_template, m_fp)) { return -1; @@ -564,7 +564,7 @@ int TpfFile::parseTemplateCommand(const char *line) } int result = 0; - if(m_currTemplateDef == NULL) + if(m_currTemplateDef == nullptr) { result = m_templateDef.parse(fp); m_currTemplateDef = &m_templateDef; @@ -579,7 +579,7 @@ int TpfFile::parseTemplateCommand(const char *line) while(lookingForMatchingData) { - if(templateDataChild == NULL) // DHERMAN Check here for template definition names not matching + if(templateDataChild == nullptr) // DHERMAN Check here for template definition names not matching { char errbuf[256]; @@ -618,7 +618,7 @@ int TpfFile::parseTemplateCommand(const char *line) int version = static_cast(atol(m_token)); m_templateData = m_currTemplateDef->getTemplateData(version); - if (m_templateData == NULL) + if (m_templateData == nullptr) { char errbuf[256]; sprintf(errbuf, "can't find version %d in template definition %s", @@ -634,14 +634,14 @@ int TpfFile::parseTemplateCommand(const char *line) return -1; } - if (m_template == NULL) + if (m_template == nullptr) { // this is the highest class level, make a blank template // with it const TagInfo & templateId = m_currTemplateDef->getTemplateId(); m_template = dynamic_cast(TpfTemplate::createTemplate( templateId.tag)); - if (m_template == NULL) + if (m_template == nullptr) { m_fp.printError("Unable to create template class. May not be installed."); return -1; @@ -708,12 +708,12 @@ enum PARSE_ENUM_ASSIGNMENT, PARSE_ENUM_VALUE } parseState = PARSE_ENUM_TOKEN; -TemplateData::EnumList * enumList = NULL; // current list being defined -TemplateData::EnumData * enumData = NULL; // current item being defined +TemplateData::EnumList * enumList = nullptr; // current list being defined +TemplateData::EnumData * enumData = nullptr; // current item being defined int currentEnumValue = 0; File fp; - Filename headerFilename(NULL, NULL, headerName, NULL); + Filename headerFilename(nullptr, nullptr, headerName, nullptr); int i = 0; while (!fp.exists(headerFilename) && i < MAX_DIRECTORY_DEPTH) { @@ -744,7 +744,7 @@ int currentEnumValue = 0; } const char * line = m_buffer; - while (line != NULL) + while (line != nullptr) { const char * templine = getNextToken(line, m_token); switch (parseState) @@ -788,7 +788,7 @@ int currentEnumValue = 0; case PARSE_END_BRACKET : if (*m_token == '}') { - enumList = NULL; + enumList = nullptr; parseState = PARSE_ENUM_TOKEN; } else @@ -798,7 +798,7 @@ int currentEnumValue = 0; } break; case PARSE_ENUM_DEF: - if (isalpha(*m_token) && enumList != NULL) + if (isalpha(*m_token) && enumList != nullptr) { enumList->push_back(TemplateData::EnumData()); enumData = &enumList->back(); @@ -815,7 +815,7 @@ int currentEnumValue = 0; { enumData->value = currentEnumValue++; templine = line; - enumData = NULL; + enumData = nullptr; parseState = PARSE_END_BRACKET; } break; @@ -838,7 +838,7 @@ int currentEnumValue = 0; } currentEnumValue = (*iter).value; enumData->value = currentEnumValue++; - enumData = NULL; + enumData = nullptr; parseState = PARSE_END_BRACKET; } else @@ -895,7 +895,7 @@ const char * TpfFile::parseAssignment(const char *line) // get the parameter type info m_parameter = m_templateData->getParameter(m_token); - if (m_parameter == NULL) + if (m_parameter == nullptr) { std::string errmsg = "cannot find parameter "; errmsg += m_token; @@ -915,7 +915,7 @@ const char * TpfFile::parseAssignment(const char *line) m_fp.printError("non-array parameter being assigned as array"); return CHAR_ERROR; } - if (line == NULL) + if (line == nullptr) { // we need to read the next line to continue parsing line = goToNextLine(); @@ -943,7 +943,7 @@ const char * TpfFile::parseAssignment(const char *line) } // check for the ending ] line = getNextToken(line, m_token); - if (line == NULL) + if (line == nullptr) { m_fp.printEolError(); return CHAR_ERROR; @@ -954,13 +954,13 @@ const char * TpfFile::parseAssignment(const char *line) return CHAR_ERROR; } line = getNextToken(line, m_token); - if (line == NULL) + if (line == nullptr) { m_fp.printEolError(); return CHAR_ERROR; } } - else if (line == NULL) + else if (line == nullptr) { m_fp.printEolError(); return CHAR_ERROR; @@ -1038,7 +1038,7 @@ const char * TpfFile::parseAssignment(const char *line) * @param param template parameter * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or NULL if at eol, or -1 if + * @return character in line where parsing stopped, or nullptr if at eol, or -1 if * error */ const char * TpfFile::parseIntegerParameter(CompilerIntegerParam & param, const char *line) @@ -1064,7 +1064,7 @@ const char * TpfFile::parseIntegerParameter(CompilerIntegerParam & param, const if (line == CHAR_ERROR) return CHAR_ERROR; - if (line != NULL && *line == 'd') + if (line != nullptr && *line == 'd') { // rolling die int base = 0; @@ -1115,7 +1115,7 @@ const char * TpfFile::parseIntegerParameter(CompilerIntegerParam & param, const } param.setValue(num_dice, num_sides, base); } - else if (line != NULL && *line == '.' && *(line+1) == '.') + else if (line != nullptr && *line == '.' && *(line+1) == '.') { // range int min_value = value; @@ -1168,7 +1168,7 @@ const char * TpfFile::parseIntegerParameter(CompilerIntegerParam & param, const tempLine = m_token; char tempBuffer[64]; std::vector enumList; - while (tempLine != NULL) + while (tempLine != nullptr) { tempLine = getNextToken(tempLine, tempBuffer); if (isalpha(*tempBuffer)) @@ -1178,7 +1178,7 @@ const char * TpfFile::parseIntegerParameter(CompilerIntegerParam & param, const } } } - else if (*m_token == '.' && tempLine != NULL && *tempLine == '.') + else if (*m_token == '.' && tempLine != nullptr && *tempLine == '.') { // range with lower bound of INT_MIN line = tempLine + 1; @@ -1232,7 +1232,7 @@ const char * TpfFile::parseIntegerParameter(CompilerIntegerParam & param, const return CHAR_ERROR; } line = parseIntegerParameter(param, line); - if (line != NULL && *line == '%') + if (line != nullptr && *line == '%') { // % offset from base value line = getNextToken(line, m_token); @@ -1257,7 +1257,7 @@ const char * TpfFile::parseIntegerParameter(CompilerIntegerParam & param, const * @param param template parameter * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or NULL if at eol, or -1 if + * @return character in line where parsing stopped, or nullptr if at eol, or -1 if * error */ const char * TpfFile::parseFloatParameter(FloatParam & param, const char *line) @@ -1278,7 +1278,7 @@ const char * TpfFile::parseFloatParameter(FloatParam & param, const char *line) } else if (isfloat(m_token)) { - if (line != NULL && *line == '.' && *(line+1) == '.') + if (line != nullptr && *line == '.' && *(line+1) == '.') { // range float min_value = static_cast(atof(m_token)); @@ -1325,7 +1325,7 @@ const char * TpfFile::parseFloatParameter(FloatParam & param, const char *line) param.setValue(value); } } - else if (*m_token == '.' && line != NULL && *line == '.') + else if (*m_token == '.' && line != nullptr && *line == '.') { // range with lower bound of -FLT_MAX ++line; @@ -1378,7 +1378,7 @@ const char * TpfFile::parseFloatParameter(FloatParam & param, const char *line) return CHAR_ERROR; } line = parseFloatParameter(param, line); - if (line != NULL && *line == '%') + if (line != nullptr && *line == '%') { // % offset from base value line = getNextToken(line, m_token); @@ -1414,7 +1414,7 @@ const char * TpfFile::parseFloatParameter(FloatParam & param, const char *line) * @param param template parameter * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or NULL if at eol, or -1 if + * @return character in line where parsing stopped, or nullptr if at eol, or -1 if * error */ const char * TpfFile::parseBoolParameter(BoolParam & param, const char *line) @@ -1455,7 +1455,7 @@ const char * TpfFile::parseBoolParameter(BoolParam & param, const char *line) * @param param template parameter * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or NULL if at eol, or -1 if + * @return character in line where parsing stopped, or nullptr if at eol, or -1 if * error */ const char * TpfFile::parseStringParameter(StringParam & param, const char *line) @@ -1494,7 +1494,7 @@ const char * TpfFile::parseStringParameter(StringParam & param, const char *line * @param param template parameter * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or NULL if at eol, or -1 if + * @return character in line where parsing stopped, or nullptr if at eol, or -1 if * error */ const char * TpfFile::parseStringIdParameter(StringIdParam & param, const char *line) @@ -1530,7 +1530,7 @@ const char * TpfFile::parseStringIdParameter(StringIdParam & param, const char * * @param param template parameter * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or NULL if at eol, or -1 if + * @return character in line where parsing stopped, or nullptr if at eol, or -1 if * error */ const char * TpfFile::parseFilenameParameter(StringParam & param, const char *line) @@ -1586,7 +1586,7 @@ const char * TpfFile::parseFilenameParameter(StringParam & param, const char *li * @param param template parameter * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or NULL if at eol, or -1 if + * @return character in line where parsing stopped, or nullptr if at eol, or -1 if * error */ const char * TpfFile::parseVectorParameter(VectorParam & param, const char *line) @@ -1648,7 +1648,7 @@ const char * TpfFile::parseVectorParameter(VectorParam & param, const char *line * @param param template parameter * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or NULL if at eol, or -1 if + * @return character in line where parsing stopped, or nullptr if at eol, or -1 if * error */ const char * TpfFile::parseTemplateParameter(StringParam & param, const char *line) @@ -1662,7 +1662,7 @@ const char * TpfFile::parseTemplateParameter(StringParam & param, const char *li * @param param template parameter * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or NULL if at eol, or -1 if + * @return character in line where parsing stopped, or nullptr if at eol, or -1 if * error */ const char * TpfFile::parseEnumParameter(CompilerIntegerParam & param, const char *line) @@ -1707,7 +1707,7 @@ const char * TpfFile::parseEnumParameter(CompilerIntegerParam & param, const cha * @param param template parameter * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or NULL if at eol, or -1 if + * @return character in line where parsing stopped, or nullptr if at eol, or -1 if * error */ const char * TpfFile::parseDynamicVariableParameter(DynamicVariableParam & param, @@ -1731,7 +1731,7 @@ const char * TpfFile::parseDynamicVariableParameter(DynamicVariableParam & param if (*m_token == '+') { // extending an objevar list - if (m_template != NULL && m_template->getBaseTemplateName().empty()) + if (m_template != nullptr && m_template->getBaseTemplateName().empty()) { m_fp.printError("trying to extend an objvar list from a base template"); return CHAR_ERROR; @@ -1746,7 +1746,7 @@ const char * TpfFile::parseDynamicVariableParameter(DynamicVariableParam & param } else { - if (line == NULL) + if (line == nullptr) { // we need to read the next line to continue parsing line = goToNextLine(); @@ -1786,7 +1786,7 @@ const char * TpfFile::parseDynamicVariableParameter(DynamicVariableParam & param * @param param a DynamicVariableParamData containing an empty list * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or NULL if at eol, or -1 if + * @return character in line where parsing stopped, or nullptr if at eol, or -1 if * error */ const char * TpfFile::parseDynamicVariableParameterList( @@ -1797,7 +1797,7 @@ std::string name; NOT_NULL(line); if (data.m_type != DynamicVariableParamData::LIST || - data.m_data.lparam == NULL) + data.m_data.lparam == nullptr) { m_fp.printError("parse objvar list not given a list"); return CHAR_ERROR; @@ -1938,7 +1938,7 @@ std::string name; } else { - if (line == NULL) + if (line == nullptr) { // we need to read the next line to continue parsing line = goToNextLine(); @@ -1984,7 +1984,7 @@ std::string name; * @param param template parameter * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or NULL if at eol, or -1 if + * @return character in line where parsing stopped, or nullptr if at eol, or -1 if * error */ const char * TpfFile::parseStructParameter(StructParamOT & param, const char *line) @@ -2077,7 +2077,7 @@ const char * TpfFile::parseStructParameter(StructParamOT & param, const char *li * @param param template parameter * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or NULL if at eol, or -1 if + * @return character in line where parsing stopped, or nullptr if at eol, or -1 if * error */ const char * TpfFile::parseTriggerVolumeParameter(TriggerVolumeParam & param, @@ -2313,7 +2313,7 @@ Q * param; file.m_fp.printError("expected [ at start of list"); return CHAR_ERROR; } - if (line == NULL) + if (line == nullptr) { // we need to read the next line to continue parsing line = file.goToNextLine(); @@ -2339,7 +2339,7 @@ Q * param; // get the next parameters in the list param = (*getParamFunc)(*file.m_template, file.m_parameter->name, index); - if (param == NULL) + if (param == nullptr) { std::string errmsg = "cannot find parameter " + file.m_parameter->name; file.m_fp.printError(errmsg.c_str()); @@ -2385,7 +2385,7 @@ Q * param; arrayIndex = 0; param = (*getParamFunc)(*file.m_template, file.m_parameter->name, arrayIndex); - if (param == NULL) + if (param == nullptr) { // if the tpf version is less than the current version, print a // warning and ignore @@ -2396,7 +2396,7 @@ Q * param; " due to being removed from later version (need to update the " "template to the latest version)"; file.m_fp.printWarning(errmsg.c_str()); - return NULL; + return nullptr; } else { @@ -2434,7 +2434,7 @@ const char *parseWeightedList( for (;;) { VALUE value; - Q *valueParam = NULL; + Q *valueParam = nullptr; value.value = valueParam = new Q; list->push_back(value); VALUE *newValue = &list->back(); @@ -2505,7 +2505,7 @@ std::string TpfFile::getFileName() const const std::string & TpfFile::getBaseTemplateName() const { - if (m_template != NULL) + if (m_template != nullptr) return m_template->getBaseTemplateName(); return m_baseTemplateName; } diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TpfTemplate.cpp b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TpfTemplate.cpp index 3773bcfd..2a0d76c0 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TpfTemplate.cpp +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TpfTemplate.cpp @@ -21,9 +21,9 @@ */ TpfTemplate::TpfTemplate(const std::string & filename) : ObjectTemplate(filename), - m_parentFile(NULL), + m_parentFile(nullptr), m_baseTemplateName(), - m_baseTemplateFile(NULL) + m_baseTemplateFile(nullptr) { } // TpfTemplate::TpfTemplate @@ -32,12 +32,12 @@ TpfTemplate::TpfTemplate(const std::string & filename) : */ TpfTemplate::~TpfTemplate() { - m_parentFile = NULL; + m_parentFile = nullptr; m_baseTemplateName.clear(); - if (m_baseTemplateFile != NULL) + if (m_baseTemplateFile != nullptr) { delete m_baseTemplateFile; - m_baseTemplateFile = NULL; + m_baseTemplateFile = nullptr; } } // TpfTemplate::~TpfTemplate @@ -52,18 +52,18 @@ int TpfTemplate::setBaseTemplateName(const std::string & name) { m_baseTemplateName = name; - if (m_parentFile == NULL) + if (m_parentFile == nullptr) return -1; // load the base template - if (m_baseTemplateFile != NULL) + if (m_baseTemplateFile != nullptr) { delete m_baseTemplateFile; - m_baseTemplateFile = NULL; + m_baseTemplateFile = nullptr; } - Filename baseTemplateFileName(NULL, NULL, name.c_str(), TEMPLATE_EXTENSION); - Filename sourceTpfPath(NULL, m_parentFile->getTpfPath().c_str(), NULL, NULL); + Filename baseTemplateFileName(nullptr, nullptr, name.c_str(), TEMPLATE_EXTENSION); + Filename sourceTpfPath(nullptr, m_parentFile->getTpfPath().c_str(), nullptr, nullptr); Filename tempPath(baseTemplateFileName); tempPath.setPath(sourceTpfPath.getPath().c_str()); @@ -93,9 +93,9 @@ int TpfTemplate::setBaseTemplateName(const std::string & name) */ TpfTemplate * TpfTemplate::getBaseTemplate(void) const { - if (m_baseTemplateFile != NULL) + if (m_baseTemplateFile != nullptr) return m_baseTemplateFile->getTemplate(); - return NULL; + return nullptr; } // TpfTemplate::getBaseTemplate /** @@ -115,14 +115,14 @@ void TpfTemplate::save(Iff &file) * @param deepcheck flag to check base template if the parameter isn't loaded * @param index array index of the parameter * - * @return the parameter, or NULL if not found + * @return the parameter, or nullptr if not found */ CompilerIntegerParam *TpfTemplate::getCompilerIntegerParam(const char *name, bool deepCheck, int index) { UNREF(name); UNREF(deepCheck); UNREF(index); - return NULL; + return nullptr; } // TpfTemplate::getCompilerIntegerParam /** @@ -132,14 +132,14 @@ CompilerIntegerParam *TpfTemplate::getCompilerIntegerParam(const char *name, boo * @param deepcheck flag to check base template if the parameter isn't loaded * @param index array index of the parameter * - * @return the parameter, or NULL if not found + * @return the parameter, or nullptr if not found */ FloatParam *TpfTemplate::getFloatParam(const char *name, bool deepCheck, int index) { UNREF(name); UNREF(deepCheck); UNREF(index); - return NULL; + return nullptr; } // TpfTemplate::getFloatParam /** @@ -149,14 +149,14 @@ FloatParam *TpfTemplate::getFloatParam(const char *name, bool deepCheck, int ind * @param deepcheck flag to check base template if the parameter isn't loaded * @param index array index of the parameter * - * @return the parameter, or NULL if not found + * @return the parameter, or nullptr if not found */ BoolParam *TpfTemplate::getBoolParam(const char *name, bool deepCheck, int index) { UNREF(name); UNREF(deepCheck); UNREF(index); - return NULL; + return nullptr; } // TpfTemplate::getBoolParam /** @@ -166,14 +166,14 @@ BoolParam *TpfTemplate::getBoolParam(const char *name, bool deepCheck, int index * @param deepcheck flag to check base template if the parameter isn't loaded * @param index array index of the parameter * - * @return the parameter, or NULL if not found + * @return the parameter, or nullptr if not found */ StringParam *TpfTemplate::getStringParam(const char *name, bool deepCheck, int index) { UNREF(name); UNREF(deepCheck); UNREF(index); - return NULL; + return nullptr; } // TpfTemplate::getStringParam /** @@ -183,14 +183,14 @@ StringParam *TpfTemplate::getStringParam(const char *name, bool deepCheck, int i * @param deepcheck flag to check base template if the parameter isn't loaded * @param index array index of the parameter * - * @return the parameter, or NULL if not found + * @return the parameter, or nullptr if not found */ StringIdParam *TpfTemplate::getStringIdParam(const char *name, bool deepCheck, int index) { UNREF(name); UNREF(deepCheck); UNREF(index); - return NULL; + return nullptr; } // TpfTemplate::getStringIdParam /** @@ -200,14 +200,14 @@ StringIdParam *TpfTemplate::getStringIdParam(const char *name, bool deepCheck, i * @param deepcheck flag to check base template if the parameter isn't loaded * @param index array index of the parameter * - * @return the parameter, or NULL if not found + * @return the parameter, or nullptr if not found */ VectorParam *TpfTemplate::getVectorParam(const char *name, bool deepCheck, int index) { UNREF(name); UNREF(deepCheck); UNREF(index); - return NULL; + return nullptr; } // TpfTemplate::getVectorParam /** @@ -217,14 +217,14 @@ VectorParam *TpfTemplate::getVectorParam(const char *name, bool deepCheck, int i * @param deepcheck flag to check base template if the parameter isn't loaded * @param index array index of the parameter * - * @return the parameter, or NULL if not found + * @return the parameter, or nullptr if not found */ DynamicVariableParam *TpfTemplate::getDynamicVariableParam(const char *name, bool deepCheck, int index) { UNREF(name); UNREF(deepCheck); UNREF(index); - return NULL; + return nullptr; } // TpfTemplate::getDynamicVariableParam /** @@ -234,14 +234,14 @@ DynamicVariableParam *TpfTemplate::getDynamicVariableParam(const char *name, boo * @param deepcheck flag to check base template if the parameter isn't loaded * @param index array index of the parameter * - * @return the parameter, or NULL if not found + * @return the parameter, or nullptr if not found */ StructParamOT *TpfTemplate::getStructParamOT(const char *name, bool deepCheck, int index) { UNREF(name); UNREF(deepCheck); UNREF(index); - return NULL; + return nullptr; } // TpfTemplate::getStructParamOT /** @@ -251,14 +251,14 @@ StructParamOT *TpfTemplate::getStructParamOT(const char *name, bool deepCheck, i * @param deepcheck flag to check base template if the parameter isn't loaded * @param index array index of the parameter * - * @return the parameter, or NULL if not found + * @return the parameter, or nullptr if not found */ TriggerVolumeParam *TpfTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index) { UNREF(name); UNREF(deepCheck); UNREF(index); - return NULL; + return nullptr; } // TpfTemplate::getTriggerVolumeParam /** @@ -408,7 +408,7 @@ bool TpfTemplate::isParamLoadedLocal(const std::string &name, bool deepCheck) co { result = true; } - else if (deepCheck && getBaseTemplate() != NULL) + else if (deepCheck && getBaseTemplate() != nullptr) { result = getBaseTemplate()->isParamLoadedLocal(name); } @@ -433,7 +433,7 @@ bool TpfTemplate::isParamPureVirtualLocal(const std::string &name, bool deepChec { result = true; } - else if (deepCheck && (getBaseTemplate() != NULL)) + else if (deepCheck && (getBaseTemplate() != nullptr)) { result = getBaseTemplate()->isParamPureVirtualLocal(name); } diff --git a/engine/shared/library/sharedTerrain/src/shared/appearance/ProceduralTerrainAppearance.cpp b/engine/shared/library/sharedTerrain/src/shared/appearance/ProceduralTerrainAppearance.cpp index 3aca2005..3ffa961b 100755 --- a/engine/shared/library/sharedTerrain/src/shared/appearance/ProceduralTerrainAppearance.cpp +++ b/engine/shared/library/sharedTerrain/src/shared/appearance/ProceduralTerrainAppearance.cpp @@ -803,7 +803,7 @@ TerrainGeneratorWaterType ProceduralTerrainAppearance::getWaterType (const Vecto bool ProceduralTerrainAppearance::getWater (const int chunkX, const int chunkZ) const { - if (proceduralTerrainAppearanceTemplate->getBakedTerrain () != NULL) + if (proceduralTerrainAppearanceTemplate->getBakedTerrain () != nullptr) return proceduralTerrainAppearanceTemplate->getBakedTerrain ()->getWater (chunkX, chunkZ); return false; @@ -813,7 +813,7 @@ bool ProceduralTerrainAppearance::getWater (const int chunkX, const int chunkZ) bool ProceduralTerrainAppearance::getSlope (const int chunkX, const int chunkZ) const { - if (proceduralTerrainAppearanceTemplate->getBakedTerrain () != NULL) + if (proceduralTerrainAppearanceTemplate->getBakedTerrain () != nullptr) return proceduralTerrainAppearanceTemplate->getBakedTerrain ()->getSlope (chunkX, chunkZ); return false; @@ -823,7 +823,7 @@ bool ProceduralTerrainAppearance::getSlope (const int chunkX, const int chunkZ) bool ProceduralTerrainAppearance::getWater (const Rectangle2d& rectangle) const { - if (proceduralTerrainAppearanceTemplate->getBakedTerrain () != NULL) + if (proceduralTerrainAppearanceTemplate->getBakedTerrain () != nullptr) return proceduralTerrainAppearanceTemplate->getBakedTerrain ()->getWater (rectangle); return false; @@ -833,7 +833,7 @@ bool ProceduralTerrainAppearance::getWater (const Rectangle2d& rectangle) const bool ProceduralTerrainAppearance::getSlope (const Rectangle2d& rectangle) const { - if (proceduralTerrainAppearanceTemplate->getBakedTerrain () != NULL) + if (proceduralTerrainAppearanceTemplate->getBakedTerrain () != nullptr) return proceduralTerrainAppearanceTemplate->getBakedTerrain ()->getSlope (rectangle); return false; @@ -877,7 +877,7 @@ float ProceduralTerrainAppearance::alter (float elapsedTime) #ifdef _DEBUG const char* const appearanceTemplateName = object->getAppearance () && object->getAppearance ()->getAppearanceTemplate () ? object->getAppearance ()->getAppearanceTemplate ()->getCrcName ().getString () : 0; const Vector position = object->getPosition_w (); - DEBUG_REPORT_LOG (ms_logFloraCreation, ("flora delete: <%1.2f, %1.2f> [%s]\n", position.x, position.z, appearanceTemplateName ? appearanceTemplateName : "null")); + DEBUG_REPORT_LOG (ms_logFloraCreation, ("flora delete: <%1.2f, %1.2f> [%s]\n", position.x, position.z, appearanceTemplateName ? appearanceTemplateName : "nullptr")); #endif delete object; } @@ -1054,7 +1054,7 @@ bool ProceduralTerrainAppearance::isPassableForceChunkCreation(const Vector& pos #ifndef WIN32 if (!chunk) - LOG("PTA::isPFCC", ("(%g,%g,%g) chunk is NULL, %d/%d/%d/%d", position.x, position.y, position.z, getNumberOfChunks(), maximumNumberOfChunksAllowed, getNumberOfReferenceObjects(), maximumNumberOfChunksAlongSide)); + LOG("PTA::isPFCC", ("(%g,%g,%g) chunk is nullptr, %d/%d/%d/%d", position.x, position.y, position.z, getNumberOfChunks(), maximumNumberOfChunksAllowed, getNumberOfReferenceObjects(), maximumNumberOfChunksAlongSide)); #endif return isPassable; @@ -1183,7 +1183,7 @@ void ProceduralTerrainAppearance::_legacyCreateFlora(const Chunk* const chunk) object->yaw_o (yaw); Appearance * const appearance = AppearanceTemplateList::createAppearance (FileName (FileName::P_appearance, data.familyChildData->appearanceTemplateName)); - if (appearance != NULL) { + if (appearance != nullptr) { appearance->setKeepAlive (true); object->setAppearance (appearance); object->setScale (Vector::xyz111 * scale); @@ -1340,7 +1340,7 @@ void ProceduralTerrainAppearance::createFlora (const Chunk* const chunk) object->yaw_o (yaw); Appearance * const appearance = AppearanceTemplateList::createAppearance (FileName (FileName::P_appearance, data.familyChildData->appearanceTemplateName)); - if (appearance != NULL) { + if (appearance != nullptr) { appearance->setKeepAlive (true); object->setAppearance (appearance); object->setScale (Vector::xyz111 * scale); @@ -1403,7 +1403,7 @@ void ProceduralTerrainAppearance::destroyFlora (const Chunk* const chunk) { #ifdef _DEBUG const char* const appearanceTemplateName = object->getAppearance () && object->getAppearance ()->getAppearanceTemplate () ? object->getAppearance ()->getAppearanceTemplate ()->getCrcName ().getString () : 0; - DEBUG_REPORT_LOG (ms_logFloraCreation, ("flora cache: <%1.2f, %1.2f> [%s]\n", position.x, position.z, appearanceTemplateName ? appearanceTemplateName : "null")); + DEBUG_REPORT_LOG (ms_logFloraCreation, ("flora cache: <%1.2f, %1.2f> [%s]\n", position.x, position.z, appearanceTemplateName ? appearanceTemplateName : "nullptr")); #endif iter->second->removeFromWorld (); IGNORE_RETURN (m_cachedFloraMap->insert (std::make_pair (key, iter->second))); diff --git a/engine/shared/library/sharedTerrain/src/shared/appearance/SamplerProceduralTerrainAppearance.cpp b/engine/shared/library/sharedTerrain/src/shared/appearance/SamplerProceduralTerrainAppearance.cpp index 5cf95df7..dbe9e3fe 100755 --- a/engine/shared/library/sharedTerrain/src/shared/appearance/SamplerProceduralTerrainAppearance.cpp +++ b/engine/shared/library/sharedTerrain/src/shared/appearance/SamplerProceduralTerrainAppearance.cpp @@ -910,7 +910,7 @@ void SamplerProceduralTerrainAppearance::generateBetween(Vector const & start_o, } } - // add on all chunks to be generated to chunkList. if we encounter invalid chunks (null), don't include them + // add on all chunks to be generated to chunkList. if we encounter invalid chunks (nullptr), don't include them const Chunk* chunk; for (GenerateList::iterator iter = generateList.begin(); iter != generateList.end(); ++iter) { diff --git a/engine/shared/library/sharedTerrain/src/shared/appearance/ServerProceduralTerrainAppearance.cpp b/engine/shared/library/sharedTerrain/src/shared/appearance/ServerProceduralTerrainAppearance.cpp index 3045b129..938c4f2f 100755 --- a/engine/shared/library/sharedTerrain/src/shared/appearance/ServerProceduralTerrainAppearance.cpp +++ b/engine/shared/library/sharedTerrain/src/shared/appearance/ServerProceduralTerrainAppearance.cpp @@ -805,7 +805,7 @@ void ServerProceduralTerrainAppearance::generateBetween(Vector const & start_o, } } - // add on all chunks to be generated to chunkList. if we encounter invalid chunks (null), don't include them + // add on all chunks to be generated to chunkList. if we encounter invalid chunks (nullptr), don't include them const Chunk* chunk; for (GenerateList::iterator iter = generateList.begin(); iter != generateList.end(); ++iter) { diff --git a/engine/shared/library/sharedTerrain/src/shared/appearance/TerrainQuadTree.cpp b/engine/shared/library/sharedTerrain/src/shared/appearance/TerrainQuadTree.cpp index 275a6986..08cd30a7 100755 --- a/engine/shared/library/sharedTerrain/src/shared/appearance/TerrainQuadTree.cpp +++ b/engine/shared/library/sharedTerrain/src/shared/appearance/TerrainQuadTree.cpp @@ -534,9 +534,9 @@ void TerrainQuadTree::Node::pruneTree () /** * Find the leaf node which directly contains this chunk. * -* @param aChunk the chunk to be located. If non null, the parameters ax and az are ignored. -* @param ax the chunkspace coordinate of the chunk to be located. Only used if param aChunk is null -* @param az the chunkspace coordinate of the chunk to be located. Only used if param aChunk is null +* @param aChunk the chunk to be located. If non nullptr, the parameters ax and az are ignored. +* @param ax the chunkspace coordinate of the chunk to be located. Only used if param aChunk is nullptr +* @param az the chunkspace coordinate of the chunk to be located. Only used if param aChunk is nullptr */ TerrainQuadTree::Node * TerrainQuadTree::Node::findChunkNode (const ProceduralTerrainAppearance::Chunk * const chunk, int x, int z, int size) { @@ -754,9 +754,9 @@ TerrainQuadTree::Node * TerrainQuadTree::Node::findFirstRenderableNode (const in /** * hasChunk is a wrapper for findChunkNode * -* @param aChunk the chunk to be located. If non null, the parameters ax and az are ignored. -* @param ax the chunkspace coordinate of the chunk to be located. Only used if param aChunk is null -* @param az the chunkspace coordinate of the chunk to be located. Only used if param aChunk is null +* @param aChunk the chunk to be located. If non nullptr, the parameters ax and az are ignored. +* @param ax the chunkspace coordinate of the chunk to be located. Only used if param aChunk is nullptr +* @param az the chunkspace coordinate of the chunk to be located. Only used if param aChunk is nullptr * @param chunkSize the relative size of the chunk in chunkspace. */ bool TerrainQuadTree::Node::hasChunk (const ProceduralTerrainAppearance::Chunk * const chunk, const int x, const int z, const int size) diff --git a/engine/shared/library/sharedTerrain/src/shared/appearance/TerrainQuadTree.h b/engine/shared/library/sharedTerrain/src/shared/appearance/TerrainQuadTree.h index cb92dce0..a48d759e 100755 --- a/engine/shared/library/sharedTerrain/src/shared/appearance/TerrainQuadTree.h +++ b/engine/shared/library/sharedTerrain/src/shared/appearance/TerrainQuadTree.h @@ -320,7 +320,7 @@ public: /** * TerrainQuadTree::Iterator is a preorder iterator - * To use an iterator, loop while the current node is non-null. If the + * To use an iterator, loop while the current node is non-nullptr. If the * current node's subtree should be processed further, call descend () * on the iterator, otherwise call advance () to go to the next node. * Either advance () or descend () should be called every loop iteration, diff --git a/engine/shared/library/sharedTerrain/src/shared/core/WaterTypeManager.cpp b/engine/shared/library/sharedTerrain/src/shared/core/WaterTypeManager.cpp index 65b5b1d0..4ec613d1 100755 --- a/engine/shared/library/sharedTerrain/src/shared/core/WaterTypeManager.cpp +++ b/engine/shared/library/sharedTerrain/src/shared/core/WaterTypeManager.cpp @@ -19,8 +19,8 @@ // ====================================================================== bool WaterTypeManager::ms_installed = false; -WaterTypeManager::WaterTypeDataType * WaterTypeManager::ms_waterTypeData=NULL; -WaterTypeManager::CreatureWaterTypeDataType* WaterTypeManager::ms_creatureWaterTypeData=NULL; +WaterTypeManager::WaterTypeDataType * WaterTypeManager::ms_waterTypeData=nullptr; +WaterTypeManager::CreatureWaterTypeDataType* WaterTypeManager::ms_creatureWaterTypeData=nullptr; // ====================================================================== @@ -116,9 +116,9 @@ void WaterTypeManager::remove() } delete ms_waterTypeData; - ms_waterTypeData=NULL; + ms_waterTypeData=nullptr; delete ms_creatureWaterTypeData; - ms_creatureWaterTypeData=NULL; + ms_creatureWaterTypeData=nullptr; ms_installed = false; } diff --git a/engine/shared/library/sharedTerrain/src/shared/generator/BitmapGroup.cpp b/engine/shared/library/sharedTerrain/src/shared/generator/BitmapGroup.cpp index e9215147..9d26743f 100755 --- a/engine/shared/library/sharedTerrain/src/shared/generator/BitmapGroup.cpp +++ b/engine/shared/library/sharedTerrain/src/shared/generator/BitmapGroup.cpp @@ -159,7 +159,7 @@ void BitmapGroup::Family::loadBitmapByFilename() { if(!m_bitmapName) { - DEBUG_WARNING (true, ("BitmapGroup::Family::loadBitmapByFilename() - invalid image - m_bitmapName is NULL")); + DEBUG_WARNING (true, ("BitmapGroup::Family::loadBitmapByFilename() - invalid image - m_bitmapName is nullptr")); } else { diff --git a/engine/shared/library/sharedTerrain/src/shared/generator/ShaderGroup.cpp b/engine/shared/library/sharedTerrain/src/shared/generator/ShaderGroup.cpp index b511c3a4..cbb9562d 100755 --- a/engine/shared/library/sharedTerrain/src/shared/generator/ShaderGroup.cpp +++ b/engine/shared/library/sharedTerrain/src/shared/generator/ShaderGroup.cpp @@ -671,7 +671,7 @@ void ShaderGroup::load_0000 (Iff& iff) //-- add family Family* family = new Family (familyId); - family->setName ("null"); + family->setName ("nullptr"); PackedRgb color; color.r = 255; diff --git a/engine/shared/library/sharedTerrain/src/shared/object/TerrainObject.cpp b/engine/shared/library/sharedTerrain/src/shared/object/TerrainObject.cpp index f48a7b5d..5206146a 100755 --- a/engine/shared/library/sharedTerrain/src/shared/object/TerrainObject.cpp +++ b/engine/shared/library/sharedTerrain/src/shared/object/TerrainObject.cpp @@ -159,7 +159,7 @@ TerrainObject::~TerrainObject () TerrainObject::removeFromWorld (); DEBUG_FATAL (ms_instance != this, ("TerrainObject instance is not this object")); - ms_instance = NULL; + ms_instance = nullptr; } //------------------------------------------------------------------- diff --git a/engine/shared/library/sharedUtility/src/shared/CachedFileManager.cpp b/engine/shared/library/sharedUtility/src/shared/CachedFileManager.cpp index 30bf9486..398ef20e 100755 --- a/engine/shared/library/sharedUtility/src/shared/CachedFileManager.cpp +++ b/engine/shared/library/sharedUtility/src/shared/CachedFileManager.cpp @@ -69,7 +69,7 @@ namespace CachedFileManagerNamespace Tag const TAG_CACH = TAG (C,A,C,H); - char * ms_filenames = NULL; + char * ms_filenames = nullptr; size_t ms_filenamesLength = 0; size_t ms_filenamesCurrentPos = 0; unsigned long ms_totalTime; @@ -150,7 +150,7 @@ void CachedFileManager::install(bool const allowFileCaching) iff.enterForm (TAG_CACH); iff.enterChunk (TAG_0000); - //-- the entire chunk is filled with null terminated strings + //-- the entire chunk is filled with nullptr terminated strings ms_filenamesLength = iff.getChunkLengthLeft(); ms_filenames = iff.readRest_char(); @@ -168,7 +168,7 @@ void CachedFileManager::install(bool const allowFileCaching) void CachedFileManagerNamespace::remove () { delete[] ms_filenames; - ms_filenames = NULL; + ms_filenames = nullptr; ms_filenamesCurrentPos = 0; ms_filenamesLength = 0; @@ -255,7 +255,7 @@ void CachedFileManager::preloadSomeAssets () #endif delete[] ms_filenames; - ms_filenames = NULL; + ms_filenames = nullptr; ms_filenamesCurrentPos = 0; ms_filenamesLength = 0; } @@ -266,7 +266,7 @@ void CachedFileManager::preloadSomeAssets () bool CachedFileManager::donePreloading () { - return ms_filenames == NULL || (ms_filenamesCurrentPos >= ms_filenamesLength); + return ms_filenames == nullptr || (ms_filenamesCurrentPos >= ms_filenamesLength); } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedUtility/src/shared/CurrentUserOptionManager.cpp b/engine/shared/library/sharedUtility/src/shared/CurrentUserOptionManager.cpp index 626c7fcb..dfb11487 100755 --- a/engine/shared/library/sharedUtility/src/shared/CurrentUserOptionManager.cpp +++ b/engine/shared/library/sharedUtility/src/shared/CurrentUserOptionManager.cpp @@ -70,7 +70,7 @@ void CurrentUserOptionManager::load (char const * const userName) ms_optionManager->load (ms_userName.c_str ()); } else - DEBUG_WARNING (true, ("CurrentUserOptionManager::load: userName is null")); + DEBUG_WARNING (true, ("CurrentUserOptionManager::load: userName is nullptr")); } // ---------------------------------------------------------------------- @@ -82,7 +82,7 @@ void CurrentUserOptionManager::save () if (!ms_userName.empty ()) ms_optionManager->save (ms_userName.c_str ()); else - DEBUG_REPORT_LOG (s_verbose, ("CurrentUserOptionManager::save: userName is null\n")); + DEBUG_REPORT_LOG (s_verbose, ("CurrentUserOptionManager::save: userName is nullptr\n")); } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedUtility/src/shared/DataTable.cpp b/engine/shared/library/sharedUtility/src/shared/DataTable.cpp index 0d08193b..2a0974c7 100755 --- a/engine/shared/library/sharedUtility/src/shared/DataTable.cpp +++ b/engine/shared/library/sharedUtility/src/shared/DataTable.cpp @@ -50,7 +50,7 @@ DataTable::~DataTable() if (*k) { delete static_cast *>(*k); - *k = NULL; + *k = nullptr; } } break; @@ -59,7 +59,7 @@ DataTable::~DataTable() if (*k) { delete static_cast *>(*k); - *k = NULL; + *k = nullptr; } } @@ -69,7 +69,7 @@ DataTable::~DataTable() if (*k) { delete static_cast, std::multimap > *>(*k); - *k = NULL; + *k = nullptr; } } @@ -83,7 +83,7 @@ DataTable::~DataTable() case DataTableColumnType::DT_PackedObjVars: default: { - WARNING_STRICT_FATAL((*k) != NULL, ("Bad column Index %d. Unsupported datatype. This may leak memory.", count)); + WARNING_STRICT_FATAL((*k) != nullptr, ("Bad column Index %d. Unsupported datatype. This may leak memory.", count)); } break; } @@ -112,7 +112,7 @@ DataTable::~DataTable() } delete m_columnIndexMap; - m_columnIndexMap = NULL; + m_columnIndexMap = nullptr; } //---------------------------------------------------------------------------- @@ -464,12 +464,12 @@ void DataTable::load(Iff & iff) for (int i = 0; i < count; ++i) { //initialize the table index used for searching. - m_index.push_back(NULL); + m_index.push_back(nullptr); } buildColumnIndexMap(); - if (NULL != iff.getFileName()) + if (nullptr != iff.getFileName()) m_name = iff.getFileName(); else m_name.clear(); diff --git a/engine/shared/library/sharedUtility/src/shared/DataTableColumnType.cpp b/engine/shared/library/sharedUtility/src/shared/DataTableColumnType.cpp index e0ac3cf4..2f73061b 100755 --- a/engine/shared/library/sharedUtility/src/shared/DataTableColumnType.cpp +++ b/engine/shared/library/sharedUtility/src/shared/DataTableColumnType.cpp @@ -148,7 +148,7 @@ DataTableColumnType::DataTableColumnType(std::string const &desc) : std::string::size_type endPos = enumList.find(','); std::string label = enumList.substr(0, eqPos); std::string val = enumList.substr(eqPos+1, endPos-eqPos-1); - (*m_enumMap)[label] = static_cast(strtol(val.c_str(), NULL, 0)); + (*m_enumMap)[label] = static_cast(strtol(val.c_str(), nullptr, 0)); enumList.erase(0, endPos+1); } // assure the default is a member of the enumeration @@ -173,7 +173,7 @@ DataTableColumnType::DataTableColumnType(std::string const &desc) : std::string::size_type endPos = enumList.find(','); std::string label = enumList.substr(0, eqPos); std::string val = enumList.substr(eqPos+1, endPos-eqPos-1); - int bit = static_cast(strtol(val.c_str(), NULL, 0)); + int bit = static_cast(strtol(val.c_str(), nullptr, 0)); if((bit < 1) || (bit > 32)) { WARNING(true, ("Flags value [%s] is not a whole number from 1 to 32", label.c_str())); @@ -247,7 +247,7 @@ void DataTableColumnType::createDefaultCell() switch(m_basicType) { case DT_Int: - m_defaultCell = new DataTableCell(static_cast(strtol(value.c_str(), NULL, 0))); + m_defaultCell = new DataTableCell(static_cast(strtol(value.c_str(), nullptr, 0))); break; case DT_Float: m_defaultCell = new DataTableCell(static_cast(atof(value.c_str()))); diff --git a/engine/shared/library/sharedUtility/src/shared/DataTableManager.cpp b/engine/shared/library/sharedUtility/src/shared/DataTableManager.cpp index 671a5b9c..f6f633c5 100755 --- a/engine/shared/library/sharedUtility/src/shared/DataTableManager.cpp +++ b/engine/shared/library/sharedUtility/src/shared/DataTableManager.cpp @@ -129,7 +129,7 @@ DataTable * DataTableManager::getTable(const std::string& table, bool openIfNotF if (!dt) { DEBUG_WARNING(true, ("Could not find table [%s]", table.c_str())); - return NULL; + return nullptr; } else { @@ -140,7 +140,7 @@ DataTable * DataTableManager::getTable(const std::string& table, bool openIfNotF } else { - return NULL; + return nullptr; } } @@ -158,7 +158,7 @@ DataTable* DataTableManager::reload(const std::string & table) DataTable * const dataTable = open(table); - if (dataTable != NULL) + if (dataTable != nullptr) { std::multimap::const_iterator i = m_reloadCallbacks.lower_bound(table); for (; i != m_reloadCallbacks.end() && (*i).first == table; ++i) @@ -175,7 +175,7 @@ DataTable* DataTableManager::reloadIfOpen(const std::string & table) if(isOpen(table)) return reload(table); else - return NULL; + return nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedUtility/src/shared/DataTableWriter.cpp b/engine/shared/library/sharedUtility/src/shared/DataTableWriter.cpp index d3dc927c..795c8696 100755 --- a/engine/shared/library/sharedUtility/src/shared/DataTableWriter.cpp +++ b/engine/shared/library/sharedUtility/src/shared/DataTableWriter.cpp @@ -591,7 +591,7 @@ bool DataTableWriter::save(const char * outputFileName, bool optional) const { if (!outputFileName || outputFileName[0] != '\0') { - DEBUG_FATAL(true, ("OutputFileName is NULL or empty.")); + DEBUG_FATAL(true, ("OutputFileName is nullptr or empty.")); return false; } @@ -728,7 +728,7 @@ DataTableCell *DataTableWriter::_getNewCell(DataTableColumnType const &columnTyp switch (columnType.getBasicType()) { case DataTableColumnType::DT_Int: - return new DataTableCell(static_cast(strtol(value.c_str(), NULL, 0))); + return new DataTableCell(static_cast(strtol(value.c_str(), nullptr, 0))); break; case DataTableColumnType::DT_Float: return new DataTableCell(static_cast(atof(value.c_str()))); diff --git a/engine/shared/library/sharedUtility/src/shared/FileName.cpp b/engine/shared/library/sharedUtility/src/shared/FileName.cpp index 93b579cf..1e8936f4 100755 --- a/engine/shared/library/sharedUtility/src/shared/FileName.cpp +++ b/engine/shared/library/sharedUtility/src/shared/FileName.cpp @@ -52,14 +52,14 @@ FileName::FileName (FileName::Path path, const char* filename, const char* ext) // see if the filename already begins with the path const char *prePath = pathTable [path].path; - if (prePath != NULL && *prePath != '\0') + if (prePath != nullptr && *prePath != '\0') { if (strncmp(filename, prePath, strlen(prePath)) == 0) prePath = ""; } // see if the filename already ends in the extension - if (ext != NULL && *ext != '\0') + if (ext != nullptr && *ext != '\0') { int extLen = strlen(ext); int filenameLen = strlen(filename); diff --git a/engine/shared/library/sharedUtility/src/shared/RotaryCache.cpp b/engine/shared/library/sharedUtility/src/shared/RotaryCache.cpp index b406fe08..6292e0d3 100644 --- a/engine/shared/library/sharedUtility/src/shared/RotaryCache.cpp +++ b/engine/shared/library/sharedUtility/src/shared/RotaryCache.cpp @@ -42,7 +42,7 @@ void* RotaryCache::add(const CrcLowerString& keyString, void* valuePtr) { CacheListEntry listEntry; - void* returnVal = NULL; + void* returnVal = nullptr; listEntry.key = keyString; listEntry.value = valuePtr; @@ -93,7 +93,7 @@ RotaryCache::fetch(const CrcLowerString& keyString) return entryList.value; } - return NULL; + return nullptr; } void* @@ -103,7 +103,7 @@ RotaryCache::remove(const CrcLowerString& keyString) if(iterFind != mMap.end()) { - void* retVal = NULL; + void* retVal = nullptr; CacheMapEntry& entryFind = (*iterFind).second; RotaryList::iterator iterList = entryFind.iter; @@ -119,7 +119,7 @@ RotaryCache::remove(const CrcLowerString& keyString) return retVal; } - return NULL; + return nullptr; } @@ -143,7 +143,7 @@ RotaryCache::getNext() return retVal; } - return NULL; + return nullptr; } void diff --git a/engine/shared/library/sharedUtility/src/shared/SetupSharedUtility.cpp b/engine/shared/library/sharedUtility/src/shared/SetupSharedUtility.cpp index 3336890f..166f5548 100755 --- a/engine/shared/library/sharedUtility/src/shared/SetupSharedUtility.cpp +++ b/engine/shared/library/sharedUtility/src/shared/SetupSharedUtility.cpp @@ -109,7 +109,7 @@ void SetupSharedUtility::installFileManifestEntries () if (!fileName.empty()) FileManifest::addStoredManifestEntry(fileName.c_str(), sceneId.c_str(), fileSize); else - DEBUG_WARNING(true, ("SetupSharedUtility::installFileManifestEntries(): found an entry with a null filename: (row %i)\n", i)); + DEBUG_WARNING(true, ("SetupSharedUtility::installFileManifestEntries(): found an entry with a nullptr filename: (row %i)\n", i)); } } else diff --git a/engine/shared/library/sharedUtility/src/shared/TemplateParameter.cpp b/engine/shared/library/sharedUtility/src/shared/TemplateParameter.cpp index 751aa045..93af0652 100755 --- a/engine/shared/library/sharedUtility/src/shared/TemplateParameter.cpp +++ b/engine/shared/library/sharedUtility/src/shared/TemplateParameter.cpp @@ -951,7 +951,7 @@ DynamicVariableParamData::~DynamicVariableParamData() for (int i = 0; i < count; ++i) { DynamicVariableParamData *temp = m_data.lparam->at(i); - m_data.lparam->at(i) = NULL; + m_data.lparam->at(i) = nullptr; delete temp; } delete m_data.lparam; @@ -1134,15 +1134,15 @@ void DynamicVariableParam::cleanSingleParam(void) { case DynamicVariableParamData::INTEGER: delete m_dataSingle.m_data.iparam; - m_dataSingle.m_data.iparam = NULL; + m_dataSingle.m_data.iparam = nullptr; break; case DynamicVariableParamData::FLOAT: delete m_dataSingle.m_data.fparam; - m_dataSingle.m_data.fparam = NULL; + m_dataSingle.m_data.fparam = nullptr; break; case DynamicVariableParamData::STRING: delete m_dataSingle.m_data.sparam; - m_dataSingle.m_data.sparam = NULL; + m_dataSingle.m_data.sparam = nullptr; break; case DynamicVariableParamData::LIST: { @@ -1152,11 +1152,11 @@ void DynamicVariableParam::cleanSingleParam(void) ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } delete m_dataSingle.m_data.lparam; - m_dataSingle.m_data.lparam = NULL; + m_dataSingle.m_data.lparam = nullptr; break; case DynamicVariableParamData::UNKNOWN: default: diff --git a/engine/shared/library/sharedUtility/src/shared/TemplateParameter.h b/engine/shared/library/sharedUtility/src/shared/TemplateParameter.h index e3db2210..9c86d90b 100755 --- a/engine/shared/library/sharedUtility/src/shared/TemplateParameter.h +++ b/engine/shared/library/sharedUtility/src/shared/TemplateParameter.h @@ -210,19 +210,19 @@ inline void TemplateBase::cleanData(void) ++iter) { delete (*iter).value; - (*iter).value = NULL; + (*iter).value = nullptr; } delete m_data.weightedList; - m_data.weightedList = NULL; + m_data.weightedList = nullptr; } break; case RANGE: delete m_data.range; - m_data.range = NULL; + m_data.range = nullptr; break; case DIE_ROLL: delete m_data.dieRoll; - m_data.dieRoll = NULL; + m_data.dieRoll = nullptr; break; case NONE: default: @@ -288,7 +288,7 @@ inline const typename TemplateBase::Range * TemplateBase @@ -296,7 +296,7 @@ inline const typename TemplateBase::DieRoll * TemplateBase { if (m_dataType == DIE_ROLL) return m_data.dieRoll; - return NULL; + return nullptr; } template @@ -304,7 +304,7 @@ inline const typename TemplateBase::WeightedList * Templat { if (m_dataType == WEIGHTED_LIST) return m_data.weightedList; - return NULL; + return nullptr; } template @@ -541,7 +541,7 @@ inline const IntegerParam::DieRoll * IntegerParam::getDieRollStruct(void) const } else { - return NULL; + return nullptr; } } @@ -553,7 +553,7 @@ inline const IntegerParam::Range * IntegerParam::getRangeStruct(void) const } else { - return NULL; + return nullptr; } } @@ -637,7 +637,7 @@ inline const FloatParam::Range * FloatParam::getRangeStruct() const } else { - return NULL; + return nullptr; } } @@ -765,7 +765,7 @@ class TriggerVolumeData { friend class TriggerVolumeParam; public: - TriggerVolumeData(void) : m_name(NULL), m_radius(0.0f) {} + TriggerVolumeData(void) : m_name(nullptr), m_radius(0.0f) {} TriggerVolumeData(const std::string & name, float radius) : m_name(&name), m_radius(radius) {} const std::string & getName(void) const; @@ -962,7 +962,7 @@ inline TemplateBase *StructParam::createNewParam(void) template inline StructParam::StructParam(void) : TemplateBase() { - this->m_dataSingle = NULL; + this->m_dataSingle = nullptr; } // StructParam::StructParam /** @@ -974,7 +974,7 @@ inline StructParam::~StructParam() if (this->m_dataType == TemplateBase::SINGLE) { delete this->m_dataSingle; - this->m_dataSingle = NULL; + this->m_dataSingle = nullptr; this->m_dataType = TemplateBase::NONE; } } // StructParam::~StructParam @@ -986,7 +986,7 @@ template inline void StructParam::cleanSingleParam(void) { delete this->m_dataSingle; - this->m_dataSingle = NULL; + this->m_dataSingle = nullptr; } // StructParam::cleanSingleParam /** diff --git a/engine/shared/library/sharedUtility/src/shared/ValueDictionary.cpp b/engine/shared/library/sharedUtility/src/shared/ValueDictionary.cpp index cb90f847..5e12a64b 100755 --- a/engine/shared/library/sharedUtility/src/shared/ValueDictionary.cpp +++ b/engine/shared/library/sharedUtility/src/shared/ValueDictionary.cpp @@ -103,7 +103,7 @@ bool ValueDictionary::exists(std::string const & name) const ValueTypeBase * ValueDictionary::getCopy(std::string const & name) const { - ValueTypeBase * returnValue = NULL; + ValueTypeBase * returnValue = nullptr; DictionaryValueMap::const_iterator iter = m_valueMap.find(name); if (iter != m_valueMap.end()) diff --git a/engine/shared/library/sharedUtility/src/shared/ValueDictionaryArchive.cpp b/engine/shared/library/sharedUtility/src/shared/ValueDictionaryArchive.cpp index e6a638e0..f6ca8859 100755 --- a/engine/shared/library/sharedUtility/src/shared/ValueDictionaryArchive.cpp +++ b/engine/shared/library/sharedUtility/src/shared/ValueDictionaryArchive.cpp @@ -59,7 +59,7 @@ namespace Archive std::string name; std::string type; - ValueTypeBase * value = NULL; + ValueTypeBase * value = nullptr; ValueObjectUnpackHandlerMap::const_iterator iterFind; for (int i = 0; i < static_cast(count); ++i) { @@ -77,7 +77,7 @@ namespace Archive target.insert(name, *value); delete value; - value = NULL; + value = nullptr; } } diff --git a/engine/shared/library/sharedXml/src/shared/tree/XmlTreeDocument.cpp b/engine/shared/library/sharedXml/src/shared/tree/XmlTreeDocument.cpp index 2a6d91d0..997a9dee 100755 --- a/engine/shared/library/sharedXml/src/shared/tree/XmlTreeDocument.cpp +++ b/engine/shared/library/sharedXml/src/shared/tree/XmlTreeDocument.cpp @@ -92,7 +92,7 @@ XmlTreeDocument* XmlTreeDocument::createDocument(const char * rootNodeName) doc = xmlNewDoc(BAD_CAST "1.0"); DEBUG_FATAL( !doc, ("Attempted to make new xmlDoc but failed") ); - xmlNode * node = xmlNewNode( NULL, BAD_CAST rootNodeName ); + xmlNode * node = xmlNewNode( nullptr, BAD_CAST rootNodeName ); DEBUG_FATAL( !node, ("Attempted to make root node for new xml document, but failed")); xmlDocSetRootElement(doc, node); @@ -136,8 +136,8 @@ XmlTreeDocument::XmlTreeDocument(CrcString const &name, xmlDoc *xmlDocument) : m_referenceCount(0), m_track( true ) { - DEBUG_FATAL(m_xmlDocument == NULL, ("XmlTreeDocument(): tried to construct with a NULL xmlDocument.")); - WARNING(m_xmlDocument == NULL, ("XmlTreeDocument(): tried to construct with a NULL xmlDocument.")); + DEBUG_FATAL(m_xmlDocument == nullptr, ("XmlTreeDocument(): tried to construct with a nullptr xmlDocument.")); + WARNING(m_xmlDocument == nullptr, ("XmlTreeDocument(): tried to construct with a nullptr xmlDocument.")); } // ---------------------------------------------------------------------- @@ -148,14 +148,14 @@ m_xmlDocument(xmlDocument), m_referenceCount(0), m_track(false) // documents without names are temporary documents for creation of formatted xml { - DEBUG_FATAL(m_xmlDocument == NULL, ("XmlTreeDocument(): tried to construct with a NULL xmlDocument.")); + DEBUG_FATAL(m_xmlDocument == nullptr, ("XmlTreeDocument(): tried to construct with a nullptr xmlDocument.")); } // ---------------------------------------------------------------------- XmlTreeDocument::~XmlTreeDocument() { xmlFreeDoc(m_xmlDocument); - m_xmlDocument = NULL; + m_xmlDocument = nullptr; } // ====================================================================== diff --git a/engine/shared/library/sharedXml/src/shared/tree/XmlTreeDocumentList.cpp b/engine/shared/library/sharedXml/src/shared/tree/XmlTreeDocumentList.cpp index 6579b201..2299aaf5 100755 --- a/engine/shared/library/sharedXml/src/shared/tree/XmlTreeDocumentList.cpp +++ b/engine/shared/library/sharedXml/src/shared/tree/XmlTreeDocumentList.cpp @@ -61,7 +61,7 @@ void XmlTreeDocumentListNamespace::remove() NamedDocumentMap::iterator const endIt = s_documents.end(); for (NamedDocumentMap::iterator it = s_documents.begin(); it != endIt; ++it) { - DEBUG_REPORT_LOG(true, ("-- xml tree document name [%s], reference count [%d].\n", it->first ? it->first->getString() : "", it->second ? it->second->getReferenceCount() : -1)); + DEBUG_REPORT_LOG(true, ("-- xml tree document name [%s], reference count [%d].\n", it->first ? it->first->getString() : "", it->second ? it->second->getReferenceCount() : -1)); } } } @@ -95,7 +95,7 @@ XmlTreeDocument const *XmlTreeDocumentList::fetch(CrcString const &filename) //-- Handle existing entry. if (haveEntry) { - FATAL(!lowerBound->second, ("XmlTreeDocumentList::fetch() found an entry for filename [%s] but the mapped document was NULL.", filename.getString())); + FATAL(!lowerBound->second, ("XmlTreeDocumentList::fetch() found an entry for filename [%s] but the mapped document was nullptr.", filename.getString())); // Increment reference count and return. lowerBound->second->fetch(); @@ -121,7 +121,7 @@ XmlTreeDocument const *XmlTreeDocumentList::fetch(CrcString const &filename) #endif xmlDocPtr const xmlDocument = xmlParseMemory(reinterpret_cast(fileContents), fileSize); - FATAL(!xmlDocument, ("xmlParseMemory() returned NULL when parsing contents of file [%s].", cPathName)); + FATAL(!xmlDocument, ("xmlParseMemory() returned nullptr when parsing contents of file [%s].", cPathName)); #ifdef _DEBUG unsigned long const postDomBytesAllocated = MemoryManager::getCurrentNumberOfBytesAllocated(); @@ -148,7 +148,7 @@ XmlTreeDocument const *XmlTreeDocumentList::fetch(CrcString const &filename) void XmlTreeDocumentList::stopTracking(XmlTreeDocument const *document) { FATAL(!s_installed, ("XmlTreeDocumentList not installed.")); - FATAL(!document, ("XmlTreeDocumentList::stopTracking(): null document passed in.")); + FATAL(!document, ("XmlTreeDocumentList::stopTracking(): nullptr document passed in.")); //-- Find the map entry for the xml tree document. NamedDocumentMap::iterator const findIt = s_documents.find(&(document->getName())); diff --git a/engine/shared/library/sharedXml/src/shared/tree/XmlTreeNode.cpp b/engine/shared/library/sharedXml/src/shared/tree/XmlTreeNode.cpp index c91ff6f6..38692d89 100755 --- a/engine/shared/library/sharedXml/src/shared/tree/XmlTreeNode.cpp +++ b/engine/shared/library/sharedXml/src/shared/tree/XmlTreeNode.cpp @@ -42,7 +42,7 @@ XmlTreeNode::XmlTreeNode(const std::string &name, const std::string &content) : } xmlNode *textNode = xmlNewText(BAD_CAST contentCopy.c_str() ); - m_treeNode = xmlNewNode(NULL, BAD_CAST nameCopy.c_str()); + m_treeNode = xmlNewNode(nullptr, BAD_CAST nameCopy.c_str()); // verify new nodes DEBUG_FATAL(!textNode, ("Failed to create xml text node")); @@ -70,7 +70,7 @@ XmlTreeNode::XmlTreeNode(const std::string &name) : nameCopy = "garbage"; } - m_treeNode = xmlNewNode(NULL, BAD_CAST nameCopy.c_str()); + m_treeNode = xmlNewNode(nullptr, BAD_CAST nameCopy.c_str()); // verify new nodes DEBUG_FATAL(!m_treeNode, ("Failed to create new xml tree node")); @@ -80,7 +80,7 @@ XmlTreeNode::XmlTreeNode(const std::string &name) : XmlTreeNode XmlTreeNode::addChildNode(const char * name) { - DEBUG_FATAL( !m_treeNode, ("Attempted to add child to null xml node")); + DEBUG_FATAL( !m_treeNode, ("Attempted to add child to nullptr xml node")); XmlTreeNode node(name); if (m_treeNode) @@ -109,7 +109,7 @@ void XmlTreeNode::addChild( const XmlTreeNode& node ) bool XmlTreeNode::isNull() const { - return (m_treeNode == NULL); + return (m_treeNode == nullptr); } // ---------------------------------------------------------------------- @@ -140,7 +140,7 @@ void XmlTreeNode::assertIsElement(char const *const elementName) const char const *const nodeName = getName(); UNREF(elementName); UNREF(nodeName); - DEBUG_FATAL(!isElement(), ("expecting element named [%s], found non-element entity named [%s].", elementName ? elementName : "", nodeName)); + DEBUG_FATAL(!isElement(), ("expecting element named [%s], found non-element entity named [%s].", elementName ? elementName : "", nodeName)); DEBUG_FATAL(_stricmp(elementName, nodeName), ("expecting element named [%s], found element named [%s] instead.", nodeName)); } @@ -148,14 +148,14 @@ void XmlTreeNode::assertIsElement(char const *const elementName) const char const *XmlTreeNode::getName() const { - return (m_treeNode ? reinterpret_cast(m_treeNode->name) : ""); + return (m_treeNode ? reinterpret_cast(m_treeNode->name) : ""); } // ---------------------------------------------------------------------- XmlTreeNode XmlTreeNode::getNextSiblingElementNode() const { - xmlNode *siblingNode = m_treeNode ? m_treeNode->next : NULL; + xmlNode *siblingNode = m_treeNode ? m_treeNode->next : nullptr; while (siblingNode && (siblingNode->type != XML_ELEMENT_NODE)) siblingNode = siblingNode->next; @@ -166,16 +166,16 @@ XmlTreeNode XmlTreeNode::getNextSiblingElementNode() const XmlTreeNode XmlTreeNode::getFirstChildNode() const { - return XmlTreeNode(m_treeNode ? m_treeNode->children : NULL); + return XmlTreeNode(m_treeNode ? m_treeNode->children : nullptr); } // ---------------------------------------------------------------------- XmlTreeNode XmlTreeNode::getFirstChildElementNode() const { - //-- Check if we have a NULL node. + //-- Check if we have a nullptr node. if (!m_treeNode) - return XmlTreeNode(NULL); + return XmlTreeNode(nullptr); //-- Look for the first child node that is an element. xmlNode *childNode = m_treeNode->children; @@ -190,9 +190,9 @@ XmlTreeNode XmlTreeNode::getFirstChildElementNode() const XmlTreeNode XmlTreeNode::getFirstChildTextNode() const { - //-- Check if we have a NULL node. + //-- Check if we have a nullptr node. if (!m_treeNode) - return XmlTreeNode(NULL); + return XmlTreeNode(nullptr); //-- Look for the first child node that is a text node. xmlNode *childNode = m_treeNode->children; @@ -212,18 +212,18 @@ XmlTreeNode XmlTreeNode::getElementAttributeValueNode(char const *attributeName, //-- Validate parameters and preconditions. if (!isElement()) { - DEBUG_FATAL(!optional, ("getElementAttributeValueNode(): node [%s] is not an element.", m_treeNode ? reinterpret_cast(m_treeNode->name) : "")); - return XmlTreeNode(NULL); + DEBUG_FATAL(!optional, ("getElementAttributeValueNode(): node [%s] is not an element.", m_treeNode ? reinterpret_cast(m_treeNode->name) : "")); + return XmlTreeNode(nullptr); } if (!attributeName) { - DEBUG_FATAL(!optional, ("getElementAttributeValueNode(): attributeName is NULL.")); - return XmlTreeNode(NULL); + DEBUG_FATAL(!optional, ("getElementAttributeValueNode(): attributeName is nullptr.")); + return XmlTreeNode(nullptr); } //-- Check the attribute nodes for a match on the given name. Ignore case. - for (xmlAttr *attributeNode = m_treeNode ? m_treeNode->properties : NULL; attributeNode; attributeNode = attributeNode->next) + for (xmlAttr *attributeNode = m_treeNode ? m_treeNode->properties : nullptr; attributeNode; attributeNode = attributeNode->next) { if (!_stricmp(attributeName, reinterpret_cast(attributeNode->name))) { @@ -234,7 +234,7 @@ XmlTreeNode XmlTreeNode::getElementAttributeValueNode(char const *attributeName, //-- No attribute node matched the attribute name. DEBUG_FATAL(!optional, ("getElementAttributeValueNode(): failed to find attribute [%s] on element node [%s].", attributeName, getName())); - return XmlTreeNode(NULL); + return XmlTreeNode(nullptr); } // ---------------------------------------------------------------------- @@ -250,7 +250,7 @@ bool XmlTreeNode::getElementAttributeAsBool(char const *attributeName, bool &val char const *const contents = attributeValueNode.getTextValue(); if (!contents) { - DEBUG_FATAL(!contents, ("contents of attribute [%s] is NULL.", attributeName)); + DEBUG_FATAL(!contents, ("contents of attribute [%s] is nullptr.", attributeName)); return false; //lint !e527 // unreachable // reachable in release. } @@ -275,7 +275,7 @@ bool XmlTreeNode::getElementAttributeAsFloat(char const *attributeName, float &v char const *const contents = attributeValueNode.getTextValue(); if (!contents) { - DEBUG_FATAL(!contents, ("contents of attribute [%s] is NULL.", attributeName)); + DEBUG_FATAL(!contents, ("contents of attribute [%s] is nullptr.", attributeName)); return false; //lint !e527 // unreachable // reachable in release. } @@ -306,7 +306,7 @@ bool XmlTreeNode::getElementAttributeAsInt(char const *attributeName, int &value char const *const contents = attributeValueNode.getTextValue(); if (!contents) { - DEBUG_FATAL(!contents, ("contents of attribute [%s] is NULL.", attributeName)); + DEBUG_FATAL(!contents, ("contents of attribute [%s] is nullptr.", attributeName)); return false; //lint !e527 // unreachable // reachable in release. } @@ -366,12 +366,12 @@ char const *XmlTreeNode::getTextValue() const //-- Ensure we're a text node. if(!node.isText()) { - DEBUG_FATAL(true, ("node [%s] is not a text node", m_treeNode ? reinterpret_cast(m_treeNode->name) : "")); - return NULL; //lint !e527 // unreachable // reachable in release. + DEBUG_FATAL(true, ("node [%s] is not a text node", m_treeNode ? reinterpret_cast(m_treeNode->name) : "")); + return nullptr; //lint !e527 // unreachable // reachable in release. } //-- Return contents. - return node.m_treeNode ? reinterpret_cast(node.m_treeNode->content) : NULL; + return node.m_treeNode ? reinterpret_cast(node.m_treeNode->content) : nullptr; } // ---------------------------------------------------------------------- diff --git a/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.cpp b/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.cpp index 49aeee58..cbe80abf 100755 --- a/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.cpp +++ b/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.cpp @@ -51,7 +51,7 @@ MonitorObject::~MonitorObject() if( mConnection ) { - mConnection->SetHandler(NULL); + mConnection->SetHandler(nullptr); mConnection->Disconnect(); mConnection->Release(); } @@ -75,10 +75,10 @@ char hold[214]; UdpConnection::DisconnectReasonText( mConnection->GetOtherSideDisconnectReason())); } } - mConnection->SetHandler(NULL); + mConnection->SetHandler(nullptr); mConnection->Disconnect(); mConnection->Release(); - mConnection = NULL; + mConnection = nullptr; } } @@ -94,10 +94,10 @@ void MonitorObject::OnRoutePacket( UdpConnection * con, const unsigned char *da simpleMessage msg(data); - if( con == NULL ) + if( con == nullptr ) { if( mbprint) - fprintf(stderr,"MONITOR API: MonitorObject.OnRoutePacket, recived a NULL connection.?\n"); + fprintf(stderr,"MONITOR API: MonitorObject.OnRoutePacket, recived a nullptr connection.?\n"); return; } @@ -123,7 +123,7 @@ void MonitorObject::OnRoutePacket( UdpConnection * con, const unsigned char *da if( mHierarchySent == true ) { mMonitorData->processElementsRequest(con,mSequence,(char *)&data[6],dataLen,mlastUpdateTime ); - mlastUpdateTime = (long)time(NULL); + mlastUpdateTime = (long)time(nullptr); break; } @@ -261,7 +261,7 @@ MonitorManager::MonitorManager(const char *configFile, CMonitorData *_gamedata, { mManager = manager; mbprint = _bprint; - passString = NULL; + passString = nullptr; mMonitorData = _gamedata; mObjectCount = 0; @@ -291,7 +291,7 @@ void MonitorManager::OnConnectRequest(UdpConnection *con) { if( con ) { - con->SetHandler(NULL); + con->SetHandler(nullptr); con->Disconnect(); con->Release(); } @@ -313,7 +313,7 @@ void MonitorManager::GiveTime() // check if the monitor object is no longer connected for (int i = 0; i < mObjectCount; i++) { - if( mObject[i]->mConnection == NULL || + if( mObject[i]->mConnection == nullptr || mObject[i]->mConnection->GetStatus() == UdpConnection::cStatusDisconnected ) { MonitorObject *o = mObject[i]; @@ -345,7 +345,7 @@ int x; char buffer[1024]; FILE *fp = fopen(filename,"r"); - if (fp == NULL) + if (fp == nullptr) { fprintf(stderr,"Monitor API: could not open %s file\nTHIS FILE IS REQUIRED.\n", filename); return false; @@ -367,7 +367,7 @@ char buffer[1024]; x = 0; while(!feof(fp)) { - if (fgets( buffer, 1023, fp) != NULL) { + if (fgets( buffer, 1023, fp) != nullptr) { // get rid of '\n' and '\r' for comparisons strtok(buffer,"\r\n"); len = (int)strlen(buffer); @@ -403,17 +403,17 @@ CMonitorAPI::CMonitorAPI( const char *configFile, unsigned short Port, bool _bpr mbprint = _bprint; mPort = Port; - mAddress = NULL; + mAddress = nullptr; if( address ) { mAddress = (char *)malloc(strlen(address)+1); strcpy(mAddress,address); } - if( mang == NULL ) + if( mang == nullptr ) { UdpManager::Params params; - params.handler = NULL; + params.handler = nullptr; params.maxConnections = CONNECTION_MAX; params.outgoingBufferSize = 1000000; params.noDataTimeout = 130000; @@ -595,7 +595,7 @@ int err; unsigned long S = 4000000; unsigned char *p; - data = NULL; + data = nullptr; p = (unsigned char *)malloc(4000000); memset(p,0,4000000); err = uncompress(p,&S,(source+6),(long)getSize()); diff --git a/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.h b/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.h index d97079c7..975e2429 100755 --- a/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.h +++ b/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.h @@ -42,14 +42,14 @@ public: * * debug = turn on/off debugging. * - * address = (NOT USED) Leave as NULL + * address = (NOT USED) Leave as nullptr * - * UdpManager * mang = (NOT USED) Leave as NULL + * UdpManager * mang = (NOT USED) Leave as nullptr * - * // GenericNotifier *notifier = (NOT USED) Leave as NULL + * // GenericNotifier *notifier = (NOT USED) Leave as nullptr * */ - CMonitorAPI( const char *configFile, unsigned short port, bool debug = false , char * address = NULL, UdpManager * mang = NULL ); + CMonitorAPI( const char *configFile, unsigned short port, bool debug = false , char * address = nullptr, UdpManager * mang = nullptr ); ~CMonitorAPI(); @@ -112,7 +112,7 @@ public: * Max Limited * #define ELEMENT_MAX_START 2000 */ - int add( const char *label, int Key, int mode = MON_HISTORY, const char *Description = NULL ); + int add( const char *label, int Key, int mode = MON_HISTORY, const char *Description = nullptr ); /**************** Set the description of an element ** diff --git a/external/3rd/library/platform/projects/MonAPI2/MonitorData.cpp b/external/3rd/library/platform/projects/MonAPI2/MonitorData.cpp index 4b283bc6..044c1a17 100755 --- a/external/3rd/library/platform/projects/MonAPI2/MonitorData.cpp +++ b/external/3rd/library/platform/projects/MonAPI2/MonitorData.cpp @@ -58,7 +58,7 @@ CMonitorData::CMonitorData() { m_sequence = 1; - m_buffer = NULL; + m_buffer = nullptr; m_nbuffer = 0; m_count = 0; m_max = ELEMENT_MAX_START; @@ -103,7 +103,7 @@ void CMonitorData::resize_buffer(int new_size) { char *temp; - if( m_buffer != NULL ) + if( m_buffer != nullptr ) { temp = m_buffer; m_buffer = new char[ new_size]; @@ -331,7 +331,7 @@ char *p; if( get_bit(mark,x) == 0 ) { set_bit( mark, x ); - if( m_data[x].discription != NULL ) + if( m_data[x].discription != nullptr ) { sprintf(tmp,"%d,%s|",m_data[x].id, m_data[x].discription); size += (int)strlen(tmp); @@ -360,7 +360,7 @@ char *p; { flag = 2; set_bit(mark,x); - if( m_data[x].discription != NULL ) + if( m_data[x].discription != nullptr ) { sprintf(tmp,"%d,%s|",m_data[x].id, m_data[x].discription); size += (int)strlen(tmp); @@ -412,7 +412,7 @@ int x; //******* Discription ****** delete [] m_data[x].discription; - m_data[x].discription = NULL; + m_data[x].discription = nullptr; if( des ) { m_data[x].discription = new char [strlen(des)+1]; @@ -459,10 +459,10 @@ int x; { if( Id == m_data[x].id ) { - if( Description == NULL ) + if( Description == nullptr ) { delete [] m_data[x].discription; - m_data[x].discription = NULL; + m_data[x].discription = nullptr; mode = 0; return x; } @@ -510,7 +510,7 @@ int high, i, low; if ( high < m_count && Id==m_data[high].id ) { if (m_data[high].ChangedTime == 0 || m_data[high].value != value) { - m_data[high].ChangedTime = (long)time(NULL); + m_data[high].ChangedTime = (long)time(nullptr); m_data[high].value = value; } } @@ -560,7 +560,7 @@ int CMonitorData::parseList( char **list, char *data, char tok , int max ) int count; int cnt; - if( data == NULL ) + if( data == nullptr ) return 0; list[0] = data; diff --git a/external/3rd/library/platform/projects/MonAPI2/MonitorData.h b/external/3rd/library/platform/projects/MonAPI2/MonitorData.h index 1146d83e..56e3f0b9 100755 --- a/external/3rd/library/platform/projects/MonAPI2/MonitorData.h +++ b/external/3rd/library/platform/projects/MonAPI2/MonitorData.h @@ -35,7 +35,7 @@ Usage 'L' - long long int (8) 'i' - int (4) 's' - short int (2) - 'S' - C-style, null-terminated string (n + null) + 'S' - C-style, nullptr-terminated string (n + nullptr) 'Bn' - buffer, of size n. Used for non-terminated strings, or other binary data. */ @@ -115,7 +115,7 @@ private: //---------------------------------------------------------------- // stringMessage -// This message type is used for passing messages that can consist of a NULL terminated string +// This message type is used for passing messages that can consist of a nullptr terminated string class stringMessage : public monMessage { public: @@ -252,7 +252,7 @@ class CMonitorData { public: -// CMonitorData(GenericNotifier *notifier=NULL ); +// CMonitorData(GenericNotifier *notifier=nullptr ); CMonitorData(); virtual ~CMonitorData(); @@ -266,7 +266,7 @@ public: bool processDescriptionRequest(UdpConnection *con, short & sequence, char * userData, int dataLen,unsigned char *mark); int add(const char *label, int id, int ping, const char *des ); int setDescription( int Id, const char *Description , int & mode); - char *getDescription(int x){ if( m_ndata >= x ) return NULL; return m_data[x].discription;} + char *getDescription(int x){ if( m_ndata >= x ) return nullptr; return m_data[x].discription;} int pingValue(int p); void set(int Id, int value); void remove(int Id); diff --git a/external/3rd/library/platform/projects/Session/CommonAPI/CommonClient.cpp b/external/3rd/library/platform/projects/Session/CommonAPI/CommonClient.cpp index 4856d6e2..f61f6464 100755 --- a/external/3rd/library/platform/projects/Session/CommonAPI/CommonClient.cpp +++ b/external/3rd/library/platform/projects/Session/CommonAPI/CommonClient.cpp @@ -42,7 +42,7 @@ CConnectionHandler::~CConnectionHandler() { if (mConnection) { - mConnection->SetHandler(NULL); + mConnection->SetHandler(nullptr); mConnection->Disconnect(); mConnection->Release(); } @@ -79,7 +79,7 @@ void CConnectionHandler::OnTerminated(UdpConnection *) if (mConnection) { - mConnection->SetHandler(NULL); + mConnection->SetHandler(nullptr); mConnection->Release(); mConnection = 0; } diff --git a/external/3rd/library/platform/projects/Session/LoginAPI/ClientCore.cpp b/external/3rd/library/platform/projects/Session/LoginAPI/ClientCore.cpp index a9e2caf6..1cabca55 100755 --- a/external/3rd/library/platform/projects/Session/LoginAPI/ClientCore.cpp +++ b/external/3rd/library/platform/projects/Session/LoginAPI/ClientCore.cpp @@ -749,7 +749,7 @@ namespace LoginAPI else input.SetSessionID(sessionID); - // don't validate session type, there are clients that pass in NULL. + // don't validate session type, there are clients that pass in nullptr. input.SetSessionType(sessionType); //////////////////////////////////////// @@ -776,7 +776,7 @@ namespace LoginAPI else input.SetSessionID(sessionID); - // don't validate session type, there are clients that pass in NULL. + // don't validate session type, there are clients that pass in nullptr. input.SetSessionType(sessionType); //////////////////////////////////////// @@ -803,7 +803,7 @@ namespace LoginAPI else input.SetSessionID(sessionID); - // don't validate session type, there are clients that pass in NULL. + // don't validate session type, there are clients that pass in nullptr. input.SetSessionType(sessionType); //////////////////////////////////////// @@ -830,7 +830,7 @@ namespace LoginAPI else input.SetSessionID(sessionID); - // don't validate session type, there are clients that pass in NULL. + // don't validate session type, there are clients that pass in nullptr. input.SetSessionType(sessionType); //////////////////////////////////////// diff --git a/external/3rd/library/platform/utils/Base/Archive.cpp b/external/3rd/library/platform/utils/Base/Archive.cpp index 90f5f2f5..7d59c663 100755 --- a/external/3rd/library/platform/utils/Base/Archive.cpp +++ b/external/3rd/library/platform/utils/Base/Archive.cpp @@ -91,7 +91,7 @@ namespace Base ByteStream::ByteStream() : allocatedSize(0), beginReadIterator(), - data(NULL), + data(nullptr), size(0) { data = Data::getNewData(); @@ -187,7 +187,7 @@ namespace Base if(data->size < allocatedSize) { unsigned char * tmp = new unsigned char[newSize]; - if(data->buffer != NULL) + if(data->buffer != nullptr) memcpy(tmp, data->buffer, size); delete[] data->buffer; data->buffer = tmp; diff --git a/external/3rd/library/platform/utils/Base/AutoLog.cpp b/external/3rd/library/platform/utils/Base/AutoLog.cpp index 9b25380e..aa84b96f 100755 --- a/external/3rd/library/platform/utils/Base/AutoLog.cpp +++ b/external/3rd/library/platform/utils/Base/AutoLog.cpp @@ -35,7 +35,7 @@ bool CAutoLog::Open(const char * filename) //------------------------------------- { - if( NULL == filename) + if( nullptr == filename) return false; if (pFilename) @@ -49,13 +49,13 @@ bool CAutoLog::Open(const char * filename) // Sanitize slashes char *ptr; - while ((ptr = strchr(pFilename,WRONGSLASH)) != NULL) + while ((ptr = strchr(pFilename,WRONGSLASH)) != nullptr) *ptr = SLASHCHAR[0]; char strPath[1024]; strcpy(strPath,pFilename); ptr = strrchr(strPath, SLASHCHAR[0]); - if (ptr != NULL) + if (ptr != nullptr) { *ptr = 0; @@ -63,11 +63,11 @@ bool CAutoLog::Open(const char * filename) char curdir[128]; // remember current directory - if( _getcwd(curdir,sizeof(curdir)) == NULL ) + if( _getcwd(curdir,sizeof(curdir)) == nullptr ) { fprintf(stderr,"CAutoLog::Archive failed to get current directory!\n"); free(pFilename); - pFilename = NULL; + pFilename = nullptr; return false; // error, can't proceed } @@ -78,7 +78,7 @@ bool CAutoLog::Open(const char * filename) { fprintf(stderr,"CAutoLog::Archive failed to make directory: %s\n", strPath); free(pFilename); - pFilename = NULL; + pFilename = nullptr; return false; // error, can't proceed } } @@ -98,7 +98,7 @@ bool CAutoLog::Open(const char * filename) { fprintf(stderr,"CAutoLog::Archive failed to make directory: %s\n", strPath); free(pFilename); - pFilename = NULL; + pFilename = nullptr; return false; // error, can't proceed } } @@ -107,7 +107,7 @@ bool CAutoLog::Open(const char * filename) pFile = fopen(pFilename,"a+"); - if( pFile == NULL || pFile == (FILE *)-1) + if( pFile == nullptr || pFile == (FILE *)-1) { //fprintf(stderr,"CAutoLog::Open failed to open log file: %s\n",pFilename); Close(); @@ -127,14 +127,14 @@ bool CAutoLog::Open(const char * filename) void CAutoLog::Close(void) //------------------------------------- { - if( pFile != (FILE *)-1 && pFile != NULL) + if( pFile != (FILE *)-1 && pFile != nullptr) { fclose(pFile); } pFile = (FILE *)-1; free(pFilename); - pFilename = NULL; + pFilename = nullptr; } //------------------------------------- @@ -197,7 +197,7 @@ void CAutoLog::LogDebug(char * format, ...) void CAutoLog::Log(eLogLevel severity, char *fmt, ...) //------------------------------------- { - if (pFile == (FILE *)-1 || pFile == NULL) + if (pFile == (FILE *)-1 || pFile == nullptr) { //fprintf(stderr,"CAutoLog::Log called with no file open!\n"); return; @@ -253,7 +253,7 @@ void CAutoLog::Log(eLogLevel severity, char *fmt, ...) void CAutoLog::Archive(void) //------------------------------------- { - if( pFile == (FILE *)-1 || pFile == NULL) + if( pFile == (FILE *)-1 || pFile == nullptr) { //fprintf(stderr,"CAutoLog::Archive called with no file open!\n"); return; @@ -284,7 +284,7 @@ void CAutoLog::Archive(void) strcpy(strCurrent,pFilename); pCurrent = strrchr(strCurrent, SLASHCHAR[0]); - if (pCurrent != NULL) + if (pCurrent != nullptr) *pCurrent = 0; else sprintf(strCurrent,"."); @@ -293,7 +293,7 @@ void CAutoLog::Archive(void) #ifdef WIN32 // remember current directory - if( _getcwd(curdir,sizeof(curdir)) == NULL ) + if( _getcwd(curdir,sizeof(curdir)) == nullptr ) { fprintf(stderr,"CAutoLog::Archive failed to get current directory!\n"); return; // error, can't proceed @@ -327,7 +327,7 @@ void CAutoLog::Archive(void) #endif pCurrent = strrchr(pFilename, SLASHCHAR[0]); - if (pCurrent == NULL) + if (pCurrent == nullptr) pCurrent = pFilename; else pCurrent++; diff --git a/external/3rd/library/platform/utils/Base/AutoLog.h b/external/3rd/library/platform/utils/Base/AutoLog.h index 0a90a774..18871c7f 100755 --- a/external/3rd/library/platform/utils/Base/AutoLog.h +++ b/external/3rd/library/platform/utils/Base/AutoLog.h @@ -92,14 +92,14 @@ namespace Base //------------------------------------- inline CAutoLog::CAutoLog() { - pFilename = NULL; + pFilename = nullptr; pFile = (FILE *)-1; } //------------------------------------- inline CAutoLog::CAutoLog(const char * file) { - pFilename = NULL; + pFilename = nullptr; pFile = (FILE *)-1; Open(file); } diff --git a/external/3rd/library/platform/utils/Base/Config.cpp b/external/3rd/library/platform/utils/Base/Config.cpp index a305cb9c..6351686f 100755 --- a/external/3rd/library/platform/utils/Base/Config.cpp +++ b/external/3rd/library/platform/utils/Base/Config.cpp @@ -28,7 +28,7 @@ bool CConfig::LoadFile(char * file) // open file fp = fopen(file, "r"); - if (fp == NULL || fp == (FILE *)-1) + if (fp == nullptr || fp == (FILE *)-1) { //fprintf(stderr,"Failed to open config file %s!",file); delete fp; @@ -73,21 +73,21 @@ void CConfig::UnloadFile(void) //----------------------------------- { delete[] pConfig; - pConfig = NULL; + pConfig = nullptr; } //----------------------------------- /// finds a key of the config in memory // key argument is case-insensitive, but must be upper case in config file -// Returns true for success (passing NULL is a special case returned as success) +// Returns true for success (passing nullptr is a special case returned as success) bool CConfig::FindKey(char *key) //----------------------------------- { - if (pConfig == NULL) + if (pConfig == nullptr) return false; // special case...continue with existing key - if (key == NULL) + if (key == nullptr) return true; // form the search key @@ -98,12 +98,12 @@ bool CConfig::FindKey(char *key) // find the key heading pCursor = strstr(pConfig,strBuffer); - if (pCursor==NULL) + if (pCursor==nullptr) return false; // find the closing bracket of key heading pCursor = strchr(pCursor,']'); - if (pCursor==NULL) + if (pCursor==nullptr) return false; pCursor++; @@ -112,7 +112,7 @@ bool CConfig::FindKey(char *key) //----------------------------------- /// extract a number from the config string -// pass the key to find the first number in the list, else NULL to find the next number in the list +// pass the key to find the first number in the list, else nullptr to find the next number in the list // returns 0 if no number is found, else returns the number long CConfig::GetLong(char *key) //----------------------------------- @@ -135,20 +135,20 @@ long CConfig::GetLong(char *key) //----------------------------------- /// extract string (in double-quotes) from the list. -// pass the key to find the first string in the list, else NULL to find the next string in the list -// returns NULL if no string found, else returns a temporary copy of the string (without quotes) +// pass the key to find the first string in the list, else nullptr to find the next string in the list +// returns nullptr if no string found, else returns a temporary copy of the string (without quotes) char * CConfig::GetString(char *key) //----------------------------------- { if (!FindKey(key)) - return NULL; + return nullptr; // look for start of string or end of key while (*pCursor && *pCursor != '"' && *pCursor != '[') pCursor++; if (*(pCursor++) != '"') - return NULL; + return nullptr; // until closing quote int c = 0; @@ -162,7 +162,7 @@ char * CConfig::GetString(char *key) } } - return NULL; + return nullptr; } diff --git a/external/3rd/library/platform/utils/Base/Config.h b/external/3rd/library/platform/utils/Base/Config.h index 56ad96af..f577eef6 100755 --- a/external/3rd/library/platform/utils/Base/Config.h +++ b/external/3rd/library/platform/utils/Base/Config.h @@ -10,7 +10,7 @@ ; list of strings, with code example # config.FindKey("NUMBERS"); -# while (number = config.GetLong(NULL)) +# while (number = config.GetLong(nullptr)) # YourHandleNumber(number); [NUMBERS] 100 200, 300 ; formatting is very flexible as long as numbers are delimited by non-numbers @@ -23,7 +23,7 @@ ; list of strings, with code example # config.FindKey("HOSTS"); -# while (string = config.GetString(NULL)) +# while (string = config.GetString(nullptr)) # YourHandleString(string); [HOSTS] "206.19.151.173:5999" @@ -68,16 +68,16 @@ namespace Base // returns TRUE if key is found. bool FindKey(char *key); - // extract string from config. If key is NULL, extract next string in list, else extract first string. - // if key was not found, returns NULL - char * GetString(char *key = NULL); + // extract string from config. If key is nullptr, extract next string in list, else extract first string. + // if key was not found, returns nullptr + char * GetString(char *key = nullptr); - // extract number from config. If key is NULL, extract next number in list, else extract first number. + // extract number from config. If key is nullptr, extract next number in list, else extract first number. // if key was not found, returns 0 - long GetLong(char *key = NULL); // extract number from config. + long GetLong(char *key = nullptr); // extract number from config. // indicate if config file has been loaded - inline bool FileLoaded() { return pConfig == NULL ? false : true; } + inline bool FileLoaded() { return pConfig == nullptr ? false : true; } private: char * pConfig; // pointer to file memory @@ -87,14 +87,14 @@ namespace Base inline CConfig::CConfig() { - pConfig = NULL; - pCursor = NULL; + pConfig = nullptr; + pCursor = nullptr; } inline CConfig::CConfig(char * file) { - pConfig = NULL; - pCursor = NULL; + pConfig = nullptr; + pCursor = nullptr; LoadFile(file); } diff --git a/external/3rd/library/platform/utils/Base/Statistics.h b/external/3rd/library/platform/utils/Base/Statistics.h index 18e0579e..0856034b 100755 --- a/external/3rd/library/platform/utils/Base/Statistics.h +++ b/external/3rd/library/platform/utils/Base/Statistics.h @@ -34,9 +34,9 @@ namespace Base bool commit = false; if (!mLastSampleTime) - mLastSampleTime = time(NULL); + mLastSampleTime = time(nullptr); - if (!mSampleFrequency || mLastSampleTime + mSampleFrequency < (unsigned)time(NULL)) + if (!mSampleFrequency || mLastSampleTime + mSampleFrequency < (unsigned)time(nullptr)) { mSampleTotal++; mAggregateTotal += value; diff --git a/external/3rd/library/platform/utils/Base/TemplateObjectAllocator.h b/external/3rd/library/platform/utils/Base/TemplateObjectAllocator.h index 40227673..ed1a7937 100755 --- a/external/3rd/library/platform/utils/Base/TemplateObjectAllocator.h +++ b/external/3rd/library/platform/utils/Base/TemplateObjectAllocator.h @@ -93,7 +93,7 @@ namespace Base void Destroy(TYPE *object) { - if (object == NULL) + if (object == nullptr) return; #ifdef USE_ALLOCATOR_MUTEX @@ -142,7 +142,7 @@ namespace Base void FastDestroy(TYPE *object) { - if (object == NULL) + if (object == nullptr) return; object->~TYPE(); diff --git a/external/3rd/library/platform/utils/Base/linux/BlockAllocator.cpp b/external/3rd/library/platform/utils/Base/linux/BlockAllocator.cpp index 4cefb9e7..29d91074 100755 --- a/external/3rd/library/platform/utils/Base/linux/BlockAllocator.cpp +++ b/external/3rd/library/platform/utils/Base/linux/BlockAllocator.cpp @@ -12,7 +12,7 @@ namespace Base { for(unsigned i = 0; i < 31; i++) { - m_blocks[i] = NULL; + m_blocks[i] = nullptr; } } @@ -21,7 +21,7 @@ namespace Base // free all allocated memory blocks for(unsigned i = 0; i < 31; i++) { - while(m_blocks[i] != NULL) + while(m_blocks[i] != nullptr) { unsigned *tmp = m_blocks[i]; m_blocks[i] = (unsigned *)*m_blocks[i]; @@ -36,7 +36,7 @@ namespace Base void *BlockAllocator::getBlock(unsigned bytes) { unsigned accum = 16, bits = 16; - unsigned *handle = NULL; + unsigned *handle = nullptr; // Perform a binary search looking for the highest bit. @@ -96,7 +96,7 @@ namespace Base void BlockAllocator::returnBlock(unsigned *handle) { - // C++ allows for safe deletion of a NULL pointer + // C++ allows for safe deletion of a nullptr pointer if(handle) { // Update the allocator linked list, insert this entry at the head diff --git a/external/3rd/library/platform/utils/Base/linux/Event.cpp b/external/3rd/library/platform/utils/Base/linux/Event.cpp index a3cce3b1..72190595 100755 --- a/external/3rd/library/platform/utils/Base/linux/Event.cpp +++ b/external/3rd/library/platform/utils/Base/linux/Event.cpp @@ -26,8 +26,8 @@ namespace Base mCond(), mThreadCount(0) { - pthread_mutex_init(&mMutex, NULL); - pthread_cond_init(&mCond, NULL); + pthread_mutex_init(&mMutex, nullptr); + pthread_cond_init(&mCond, nullptr); } CEvent::~CEvent() @@ -74,7 +74,7 @@ namespace Base struct timeval now; struct timespec abs_timeout; - gettimeofday(&now, NULL); + gettimeofday(&now, nullptr); abs_timeout.tv_sec = now.tv_sec + timeout/1000; abs_timeout.tv_nsec = now.tv_usec * 1000 + (timeout%1000)*1000000; abs_timeout.tv_sec += abs_timeout.tv_nsec / 1000000000; diff --git a/external/3rd/library/platform/utils/Base/linux/Logger.cpp b/external/3rd/library/platform/utils/Base/linux/Logger.cpp index f305703d..1510e1c1 100755 --- a/external/3rd/library/platform/utils/Base/linux/Logger.cpp +++ b/external/3rd/library/platform/utils/Base/linux/Logger.cpp @@ -18,20 +18,20 @@ Logger::Logger(const char *prefix, int level, unsigned size, bool rollDate) : m_defaultLevel(level), m_defaultSize(size), m_dirPrefix(prefix), m_rollDate(rollDate) { char buf[1024]; - FILE *logDir = NULL; + FILE *logDir = nullptr; logDir = fopen(m_dirPrefix.c_str(), "r+"); if(errno == ENOENT) { cmkdir(m_dirPrefix.c_str(), 0755); } - else if(logDir != NULL) + else if(logDir != nullptr) { fclose(logDir); } tm now; - time_t t = time(NULL); + time_t t = time(nullptr); localtime_r(&t, &now); memcpy(&m_lastDateTime, &now, sizeof(tm)); @@ -48,7 +48,7 @@ Logger::Logger(const char *prefix, int level, unsigned size, bool rollDate) { cmkdir(buf, 0755); } - else if(logDir != NULL) + else if(logDir != nullptr) { fclose(logDir); } @@ -178,7 +178,7 @@ void Logger::logSimple(unsigned logenum, int level, const char *message) { return; } - time_t t = time(NULL); + time_t t = time(nullptr); LogInfo *info = (*iter).second; if(level >= info->level) { @@ -241,7 +241,7 @@ void Logger::log(unsigned logenum, int level, const char *message, ...) { return; } - time_t t = time(NULL); + time_t t = time(nullptr); LogInfo *info = (*iter).second; if(level >= info->level) { @@ -294,14 +294,14 @@ void Logger::log(unsigned logenum, int level, const char *message, ...) void Logger::rollDate(time_t t) { char buf[80]; - FILE *logDir = NULL; + FILE *logDir = nullptr; logDir = fopen(m_dirPrefix.c_str(), "r+"); if(errno == ENOENT) { cmkdir(m_dirPrefix.c_str(), 0755); } - else if(logDir != NULL) + else if(logDir != nullptr) { fclose(logDir); } @@ -316,7 +316,7 @@ void Logger::rollDate(time_t t) { cmkdir(buf, 0755); } - else if(logDir != NULL) + else if(logDir != nullptr) { fclose(logDir); } diff --git a/external/3rd/library/platform/utils/Base/linux/Thread.cpp b/external/3rd/library/platform/utils/Base/linux/Thread.cpp index 2bc4f26b..5cca2017 100755 --- a/external/3rd/library/platform/utils/Base/linux/Thread.cpp +++ b/external/3rd/library/platform/utils/Base/linux/Thread.cpp @@ -76,8 +76,8 @@ namespace Base CThreadPool::CMember::CMember(CThreadPool * parent) : mParent(parent), - mFunction(NULL), - mArgument(NULL), + mFunction(nullptr), + mArgument(nullptr), mSemaphore() { StartThread(); @@ -116,8 +116,8 @@ namespace Base if (mFunction) { mFunction(mArgument); - mArgument = NULL; - mFunction = NULL; + mArgument = nullptr; + mFunction = nullptr; } else if (mParent->OnDestory(this)) mThreadContinue = false; @@ -172,7 +172,7 @@ namespace Base } //////////////////////////////////////// - // (3) Delete the null member threads + // (3) Delete the nullptr member threads mMutex.Lock(); while (!mNullMember.empty()) { @@ -199,7 +199,7 @@ namespace Base } //////////////////////////////////////// - // (2) Delete any null member threads. + // (2) Delete any nullptr member threads. while (!mNullMember.empty()) { delete mNullMember.front(); diff --git a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistStressTest/test.cpp b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistStressTest/test.cpp index c9d48ca3..dae431dd 100755 --- a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistStressTest/test.cpp +++ b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistStressTest/test.cpp @@ -376,8 +376,8 @@ void createTicket() Plat_Unicode::String xml = narrowToWide("Stress Test XML here"); t.setDetails(details.c_str()); t.setLocation(location.c_str()); - track = api->requestCreateTicket(NULL, &t, NULL, t.uid); - //track = api->requestCreateTicket(NULL, &t, xml.c_str(), t.uid); + track = api->requestCreateTicket(nullptr, &t, nullptr, t.uid); + //track = api->requestCreateTicket(nullptr, &t, xml.c_str(), t.uid); submitted++; printf("creating ticket\n"); @@ -478,7 +478,7 @@ int main(int argc, char **argv) gamep = argv[4]; gameserver = argv[5]; - if (serverhost == NULL || strlen(serverhost) == 0) + if (serverhost == nullptr || strlen(serverhost) == 0) { std::cout << "Missing hostname!\n"; return 0; @@ -493,12 +493,12 @@ int main(int argc, char **argv) std::cout << "Missing or invalid number of functions to run!\n"; return 0; } - if (gamep == NULL || strlen(gamep) == 0) + if (gamep == nullptr || strlen(gamep) == 0) { std::cout << "Missing game name!\n"; return 0; } - if (gameserver == NULL || strlen(gameserver) == 0) + if (gameserver == nullptr || strlen(gameserver) == 0) { std::cout << "Missing game server name!\n"; return 0; @@ -517,7 +517,7 @@ while(1) unsigned loginWait(500); unsigned loginAttempts(0); //api = new apiTest(serverhost, serverport, 60, CSASSIST_APIFLAG_ASSUME_RECONNECT); //, 0, CSASSIST_APIFLAG_ASSUME_RECONNECT); - //api->connectCSAssist(NULL, game.c_str(), server.c_str()); + //api->connectCSAssist(nullptr, game.c_str(), server.c_str()); //while (!ready) // api->Update(); @@ -530,7 +530,7 @@ while(1) if (api) delete api; //api = new apiTest(serverhost, serverport, 60, CSASSIST_APIFLAG_ASSUME_RECONNECT); api = new apiTest(serverhost, serverport, 60, CSASSIST_APIFLAG_ASSUME_RECONNECT|CSASSIST_APIFLAG_NO_REDIRECT); - track = api->connectCSAssist(NULL, game.c_str(), server.c_str()); + track = api->connectCSAssist(nullptr, game.c_str(), server.c_str()); loginFailed = false; std::cout <<"Trying to connect..."<requestNewTicketActivity(NULL, testUID, 0); + track = api->requestNewTicketActivity(nullptr, testUID, 0); else - track = api->requestNewTicketActivity(NULL, testUID, character.c_str()); + track = api->requestNewTicketActivity(nullptr, testUID, character.c_str()); submitted++; break; case CSASSIST_CALL_REGISTERCHARACTER: uid = rand(); - track = api->requestRegisterCharacter(NULL, uid, 0, 0); + track = api->requestRegisterCharacter(nullptr, uid, 0, 0); register_list.push(uid); submitted++; break; case CSASSIST_CALL_GETISSUEHIERARCHY: lang = narrowToWide("en"); - track = api->requestGetIssueHierarchy(NULL, hierarchy.c_str(), lang.c_str()); + track = api->requestGetIssueHierarchy(nullptr, hierarchy.c_str(), lang.c_str()); submitted++; break; case CSASSIST_CALL_CREATETICKET: @@ -597,33 +597,33 @@ while(1) case CSASSIST_CALL_APPENDCOMMENT: comment = narrowToWide("Unicode comment by player."); tid = randomTicketID(); - track = api->requestAppendTicketComment(NULL, tid, testUID, character.c_str(), comment.c_str()); + track = api->requestAppendTicketComment(nullptr, tid, testUID, character.c_str(), comment.c_str()); submitted++; break; case CSASSIST_CALL_GETTICKETBYID: tid = randomTicketID(); - track = api->requestGetTicketByID(NULL, tid, 1); + track = api->requestGetTicketByID(nullptr, tid, 1); submitted++; break; case CSASSIST_CALL_GETTICKETCOMMENTS: tid = randomTicketID(); - track = api->requestGetTicketComments(NULL, tid, 0, (rand() % 100)+1, CSASSIST_OFFSET_START); + track = api->requestGetTicketComments(nullptr, tid, 0, (rand() % 100)+1, CSASSIST_OFFSET_START); submitted++; break; case CSASSIST_CALL_GETTICKET: - track = api->requestGetTicketByCharacter(NULL, testUID, character.c_str(), 0, (rand() % 100)+1, 1); + track = api->requestGetTicketByCharacter(nullptr, testUID, character.c_str(), 0, (rand() % 100)+1, 1); submitted++; break; case CSASSIST_CALL_MARKREAD: tid = randomTicketID(); - track = api->requestMarkTicketRead(NULL, tid); + track = api->requestMarkTicketRead(nullptr, tid); submitted++; break; case CSASSIST_CALL_CANCELTICKET: if (firstTicketID != 0) { comment = narrowToWide("Ticket closed by player"); - track = api->requestCancelTicket(NULL, firstTicketID, testUID, comment.c_str()); + track = api->requestCancelTicket(nullptr, firstTicketID, testUID, comment.c_str()); if (++firstTicketID > lastTicketID) { firstTicketID = 0; @@ -634,33 +634,33 @@ while(1) break; case CSASSIST_CALL_COMMENTCOUNT: tid = randomTicketID(); - track = api->requestGetTicketCommentsCount(NULL, tid); + track = api->requestGetTicketCommentsCount(nullptr, tid); submitted++; break; case CSASSIST_CALL_GETDOCUMENTLIST: // lang = narrowToWide("en"); -// track = api->requestGetDocumentList(NULL, hierarchy.c_str(), lang.c_str()); +// track = api->requestGetDocumentList(nullptr, hierarchy.c_str(), lang.c_str()); // submitted++; break; case CSASSIST_CALL_GETDOCUMENT: -// track = api->requestGetDocument(NULL, 1); +// track = api->requestGetDocument(nullptr, 1); // submitted++; break; case CSASSIST_CALL_GETTICKETXMLBLOCK: tid = randomTicketID(); - track = api->requestGetTicketXMLBlock(NULL, tid); + track = api->requestGetTicketXMLBlock(nullptr, tid); submitted++; break; case CSASSIST_CALL_GETKBARTICLE: /*id = narrowToWide("soe1401"); lang = narrowToWide("en"); - track = api->requestGetKBArticle(NULL, id.c_str(), lang.c_str()); + track = api->requestGetKBArticle(nullptr, id.c_str(), lang.c_str()); submitted++; */break; case CSASSIST_CALL_SEARCHKB: /*Plat_Unicode::String searchStr = narrowToWide("video drivers"); lang = narrowToWide("en"); - track = api->requestSearchKB(NULL, searchStr.c_str(), lang.c_str()); + track = api->requestSearchKB(nullptr, searchStr.c_str(), lang.c_str()); submitted++; */break; } @@ -692,7 +692,7 @@ while(1) { uid = register_list.front(); register_list.pop(); - api->requestUnRegisterCharacter(NULL, uid, 0); + api->requestUnRegisterCharacter(nullptr, uid, 0); submitted++; } cout<<"Waiting for unregisters..."<disconnectCSAssist(NULL); + api->disconnectCSAssist(nullptr); submitted++; while (submitted > received) @@ -718,7 +718,7 @@ while(1) cout<<"Going to delete API now."<::iterator iter = servers.begin(); iter != servers.end(); iter++) { @@ -147,7 +147,7 @@ CSAssistGameAPIcore::CSAssistGameAPIcore(CSAssistGameAPI *api, const char *serve memset(host, 0, size); sprintf(host, "%s", strtok(p, ":")); int res(1); - char *pc = strtok(NULL, ":"); + char *pc = strtok(nullptr, ":"); if (pc) { port = atoi(pc);res++; } //if (res == 2) { @@ -212,7 +212,7 @@ CSAssistGameAPIcore::~CSAssistGameAPIcore() m_connection->Disconnect(false); #endif m_connection->Release(); - m_connection = NULL; + m_connection = nullptr; } m_conManager->Release(); delete m_receiver; @@ -298,13 +298,13 @@ void CSAssistGameAPIcore::SubmitRequest(Request *req, Response *res) { if (req->getType() != CSASSIST_CALL_CONNECTLB) { - m_timeout.push(new timeout(res->getTrack(), time(NULL) + m_userTimeout)); - req->setTimeout(time(NULL) + m_userTimeout); + m_timeout.push(new timeout(res->getTrack(), time(nullptr) + m_userTimeout)); + req->setTimeout(time(nullptr) + m_userTimeout); } else { - m_timeout.push(new timeout(res->getTrack(), time(NULL) + CONNECTLB_TIMEOUT)); - req->setTimeout(time(NULL) + CONNECTLB_TIMEOUT); + m_timeout.push(new timeout(res->getTrack(), time(nullptr) + CONNECTLB_TIMEOUT)); + req->setTimeout(time(nullptr) + CONNECTLB_TIMEOUT); } m_outQueue.push(req); m_pending.insert(pair(res->getTrack(), res)); @@ -316,13 +316,13 @@ void CSAssistGameAPIcore::SubmitRequestInt(Request *req, Response *res) { if (req->getType() != CSASSIST_CALL_CONNECTLB) { - m_timeoutInt.push(new timeout(res->getTrack(), time(NULL) + m_userTimeout)); - req->setTimeout(time(NULL) + m_userTimeout); + m_timeoutInt.push(new timeout(res->getTrack(), time(nullptr) + m_userTimeout)); + req->setTimeout(time(nullptr) + m_userTimeout); } else { - m_timeoutInt.push(new timeout(res->getTrack(), time(NULL) + CONNECTLB_TIMEOUT)); - req->setTimeout(time(NULL) + CONNECTLB_TIMEOUT); + m_timeoutInt.push(new timeout(res->getTrack(), time(nullptr) + CONNECTLB_TIMEOUT)); + req->setTimeout(time(nullptr) + CONNECTLB_TIMEOUT); } m_outQueueInt.push(req); m_pendingInt.insert(pair(res->getTrack(), res)); @@ -390,14 +390,14 @@ void CSAssistGameAPIcore::CSAssistGameCallback(Response *response) if (!m_receiver->m_firstConnection) m_api->OnConnectCSAssist(track, result, userData); // normal application layer connect else - m_api->OnConnectCSAssist(0, result, NULL); // internal re-connect + m_api->OnConnectCSAssist(0, result, nullptr); // internal re-connect m_receiver->m_firstConnection = true; } else { if (m_receiver->m_firstConnection) - m_api->OnConnectRejectedCSAssist(0, result, NULL); + m_api->OnConnectRejectedCSAssist(0, result, nullptr); else m_api->OnConnectRejectedCSAssist(track, result, userData); @@ -413,7 +413,7 @@ void CSAssistGameAPIcore::CSAssistGameCallback(Response *response) m_connection->Disconnect(false); #endif m_connection->Release(); - m_connection = NULL; + m_connection = nullptr; } GetLBHost(); m_receiver->m_firstConnection = true; @@ -436,7 +436,7 @@ void CSAssistGameAPIcore::CSAssistGameCallback(Response *response) m_connection->Disconnect(false); #endif m_connection->Release(); - m_connection = NULL; + m_connection = nullptr; } m_api->OnDisconnectCSAssist(track, result, userData); } @@ -624,7 +624,7 @@ Response * CSAssistGameAPIcore::getPending(CSAssistGameAPITrack track) map::iterator iter; iter = m_pending.find(track); if (iter == m_pending.end()) - return NULL; + return nullptr; return (*iter).second; } @@ -635,7 +635,7 @@ Response * CSAssistGameAPIcore::getPendingInt(CSAssistGameAPITrack track) map::iterator iter; iter = m_pendingInt.find(track); if (iter == m_pendingInt.end()) - return NULL; + return nullptr; return (*iter).second; } @@ -681,22 +681,22 @@ void CSAssistGameAPIcore::Update() // ----- Process timeout queue, send timeout messages when appropriate ----- - while((m_timeout.size() > 0) && ((t = m_timeout.front())->time <= time(NULL))) + while((m_timeout.size() > 0) && ((t = m_timeout.front())->time <= time(nullptr))) { Response *Res = getPending(t->track); //fprintf(stderr, "processing timeouts: track(%u) response(%p)\n", t->track, Res); - if(Res != NULL) + if(Res != nullptr) { CSAssistGameCallback(Res); } m_timeout.pop(); delete t; } - while((m_timeoutInt.size() > 0) && ((t = m_timeoutInt.front())->time <= time(NULL))) + while((m_timeoutInt.size() > 0) && ((t = m_timeoutInt.front())->time <= time(nullptr))) { Response *Res = getPendingInt(t->track); //fprintf(stderr, "processing internal timeouts: track(%u) response(%p)\n", t->track, Res); - if(Res != NULL) + if(Res != nullptr) { CSAssistGameCallback(Res); } @@ -705,14 +705,14 @@ void CSAssistGameAPIcore::Update() } // ----- process timeouts for requests ----- - while ((m_outQueue.size() > 0) && (m_outQueue.front()->getTimeout() <= (unsigned)time(NULL))) + while ((m_outQueue.size() > 0) && (m_outQueue.front()->getTimeout() <= (unsigned)time(nullptr))) { Request *R = m_outQueue.front(); //fprintf(stderr, "processing request timeouts: track(%u) request(%u)\n", R->getTrack(), R->getType()); m_outQueue.pop(); delete R; } - while ((m_outQueueInt.size() > 0) && (m_outQueueInt.front()->getTimeout() <= (unsigned)time(NULL))) + while ((m_outQueueInt.size() > 0) && (m_outQueueInt.front()->getTimeout() <= (unsigned)time(nullptr))) { Request *R = m_outQueueInt.front(); //fprintf(stderr, "processing internal request timeouts: track(%u) request(%u)\n", R->getTrack(), R->getType()); @@ -724,18 +724,18 @@ void CSAssistGameAPIcore::Update() { // API does not have a connection, begin connection handshake process //fprintf(stderr, "Going to connect to %s:%d\n", m_ip.c_str(), m_port); - m_reconnectTimeout = time(NULL) + 5; + m_reconnectTimeout = time(nullptr) + 5; m_connection = m_conManager->EstablishConnection(m_ip.c_str(), m_port); // set connected host/port before changing with GetLBHost. m_connectedIP = m_ip.c_str(); m_connectedPort = m_port; - if (m_connection != NULL) + if (m_connection != nullptr) m_connection->SetHandler(m_receiver); else { - m_api->OnConnectRejectedCSAssist(0, CSASSIST_RESULT_FAIL, NULL); + m_api->OnConnectRejectedCSAssist(0, CSASSIST_RESULT_FAIL, nullptr); // Connection failed. Try getting a new host. GetLBHost(); } @@ -777,7 +777,7 @@ void CSAssistGameAPIcore::Update() else { //fprintf(stderr,"Update(1): timing out response(%p) for track(%u)\n", Res, t->track); - if(Res != NULL) + if(Res != nullptr) { CSAssistGameCallback(Res); } @@ -795,18 +795,18 @@ void CSAssistGameAPIcore::Update() //fprintf(stderr, "Update(2) enter\n"); #ifdef USE_UDP_LIBRARY if((m_connection->GetStatus() == UdpConnection::cStatusDisconnected) || - (m_connection->GetStatus() == UdpConnection::cStatusNegotiating && m_reconnectTimeout < time(NULL))) + (m_connection->GetStatus() == UdpConnection::cStatusNegotiating && m_reconnectTimeout < time(nullptr))) { m_connection->Disconnect(); #else if((m_connection->GetStatus() == TcpConnection::StatusDisconnected) || - (m_connection->GetStatus() == TcpConnection::StatusNegotiating && m_reconnectTimeout < time(NULL))) + (m_connection->GetStatus() == TcpConnection::StatusNegotiating && m_reconnectTimeout < time(nullptr))) { m_connection->Disconnect(false); #endif m_connection->Release(); - m_connection = NULL; + m_connection = nullptr; //fprintf(stderr, "Update(2): Disconnected!! m_connectState=%u\n", m_connectState); switch(m_connectState) @@ -835,7 +835,7 @@ void CSAssistGameAPIcore::Update() //if (t-> Response *Res = getPendingInt(t->track); //fprintf(stderr, "Update(2) timing out connect: track(%u) response(%p)\n", t->track, Res); - if(Res != NULL) + if(Res != nullptr) { Res->setResult(CSASSIST_RESULT_FAIL); CSAssistGameCallback(Res); @@ -964,7 +964,7 @@ void CSAssistGameAPIcore::Update() Response *CSAssistGameAPIcore::createServerResponse(short msgtype) //------------------------------------------------------------- { - Response *res = NULL; + Response *res = nullptr; switch (msgtype) { diff --git a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistgameapicore.h b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistgameapicore.h index 0f642423..d7dc8ac4 100755 --- a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistgameapicore.h +++ b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistgameapicore.h @@ -166,11 +166,11 @@ private: void GetLBHost(); void OnConnectLB(unsigned track, unsigned result, std::string serverName, unsigned serverPort, Request *, Response *); #ifdef USE_UDP_LIBRARY - inline bool actuallyConnected() { return (bool)((m_connection != NULL) && (m_connection->GetStatus() == UdpConnection::cStatusConnected)); } + inline bool actuallyConnected() { return (bool)((m_connection != nullptr) && (m_connection->GetStatus() == UdpConnection::cStatusConnected)); } UdpManager *m_conManager; UdpConnection *m_connection; #else - inline bool actuallyConnected() { return (bool)((m_connection != NULL) && (m_connection->GetStatus() == TcpConnection::StatusConnected)); } + inline bool actuallyConnected() { return (bool)((m_connection != nullptr) && (m_connection->GetStatus() == TcpConnection::StatusConnected)); } TcpManager *m_conManager; TcpConnection *m_connection; #endif diff --git a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistreceiver.cpp b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistreceiver.cpp index 5aa9430b..a1b03cf9 100755 --- a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistreceiver.cpp +++ b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistreceiver.cpp @@ -99,7 +99,7 @@ void CSAssistReceiver::OnTerminated(TcpConnection *con) break; case CONNECT_BACKEND_CONNECTED_AND_AUTHED: - m_api->m_api->OnDisconnectCSAssist(0, CSASSIST_RESULT_SERVER_DISCONNECT, NULL); + m_api->m_api->OnDisconnectCSAssist(0, CSASSIST_RESULT_SERVER_DISCONNECT, nullptr); case CONNECT_BACKEND_CONNECTED: m_api->GetLBHost(); case CONNECT_BACKEND_NEGOTIATING: m_api->m_connectState = CONNECT_BACKEND_DISCONNECTED; break; @@ -110,7 +110,7 @@ void CSAssistReceiver::OnTerminated(TcpConnection *con) else { if (m_api->m_connectState == CONNECT_BACKEND_CONNECTED_AND_AUTHED) - m_api->m_api->OnDisconnectCSAssist(0, CSASSIST_RESULT_SERVER_DISCONNECT, NULL); + m_api->m_api->OnDisconnectCSAssist(0, CSASSIST_RESULT_SERVER_DISCONNECT, nullptr); m_api->m_connectState = CONNECT_BACKEND_DISCONNECTED; m_api->GetLBHost(); } @@ -156,7 +156,7 @@ void CSAssistReceiver::OnRoutePacket(TcpConnection *con, const uchar *data, int { res = m_api->getPending(track); } - if(res != NULL) + if(res != nullptr) { res->init(type, track, result); res->decode(iter); diff --git a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssisttest/test.cpp b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssisttest/test.cpp index c172511e..efbc0db4 100755 --- a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssisttest/test.cpp +++ b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssisttest/test.cpp @@ -40,7 +40,7 @@ Plat_Unicode::String globalArticleID; //---------------------------------------------- CSAssistUnicodeChar *get_c_str(Plat_Unicode::String s) // This replaces c_str() by allocating a new buffer, erasing it, and then -// using the non-null terminated data() to copy the data into the buffer. +// using the non-nullptr terminated data() to copy the data into the buffer. //---------------------------------------------- { unsigned length = s.size() + 1; @@ -94,7 +94,7 @@ void DisplayTicket(const CSAssistGameAPITicket *t) std::cout << wideToNarrow(details) << "\n***\n"; } else - std::cout << "***Ticket IS NULL! ***\n"; + std::cout << "***Ticket IS nullptr! ***\n"; } //--------------------------------------------- @@ -110,7 +110,7 @@ void DisplayComment(const CSAssistGameAPITicketComment *t) std::cout << "\n " << wideToNarrow(comment) << "\n"; } else - std::cout << "***Comment IS NULL! ***\n"; + std::cout << "***Comment IS nullptr! ***\n"; } //--------------------------------------------- @@ -132,7 +132,7 @@ void DisplayDocumentHeader(const CSAssistGameAPIDocumentHeader *doc) std::cout << ", Modified: " << date2 << "\n"; } else - std::cout << "***Document Header IS NULL! ***\n"; + std::cout << "***Document Header IS nullptr! ***\n"; } //--------------------------------------------- @@ -148,7 +148,7 @@ void DisplaySearchResult(const CSAssistGameAPISearchResult *doc) std::cout << ", Title: " << wideToNarrow(title) << "\n"; } else - std::cout << "***Search Result IS NULL! ***\n"; + std::cout << "***Search Result IS nullptr! ***\n"; } @@ -360,7 +360,7 @@ void apiTest::OnRequestGameLocation(const CSAssistGameAPITrack sourceTrack, cons CSAssistUnicodeChar *rawLoc = get_c_str(loc); std::cout << "Request Game Location: Source Track(" << sourceTrack << "), uid(" << uid << "), character("; std::cout << wideToNarrow(charry) << "), CSR UID(" << CSRUID << ")\n"; - api->replyGameLocation(NULL, sourceTrack, uid, rawCharry, CSRUID, rawLoc); + api->replyGameLocation(nullptr, sourceTrack, uid, rawCharry, CSRUID, rawLoc); delete [] rawCharry; delete [] rawLoc; } diff --git a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/packdata.cpp b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/packdata.cpp index 4c267fd4..9a8ef45e 100755 --- a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/packdata.cpp +++ b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/packdata.cpp @@ -30,7 +30,7 @@ using namespace Plat_Unicode; //---------------------------------------------- CSAssistUnicodeChar *get_c_str(Plat_Unicode::String s) // This replaces c_str() by allocating a new buffer, erasing it, and then -// using the non-null terminated data() to copy the data into the buffer. +// using the non-nullptr terminated data() to copy the data into the buffer. //---------------------------------------------- { unsigned length = s.size() + 1; diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/Archive.cpp b/external/3rd/library/soePlatform/CSAssist/utils/Base/Archive.cpp index 1afab822..d55481a4 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/Archive.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/Archive.cpp @@ -94,7 +94,7 @@ namespace Base ByteStream::ByteStream() : allocatedSize(0), beginReadIterator(), - data(NULL), + data(nullptr), size(0), lastPutSize(0) { @@ -211,7 +211,7 @@ namespace Base if(data->size < allocatedSize) { unsigned char * tmp = new unsigned char[newSize]; - if(data->buffer != NULL) + if(data->buffer != nullptr) memcpy(tmp, data->buffer, size); delete[] data->buffer; data->buffer = tmp; diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/AutoLog.cpp b/external/3rd/library/soePlatform/CSAssist/utils/Base/AutoLog.cpp index 687381ed..4a8dc976 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/AutoLog.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/AutoLog.cpp @@ -35,7 +35,7 @@ bool CAutoLog::Open(const char * filename) //------------------------------------- { - if( NULL == filename) + if( nullptr == filename) return false; if (pFilename) @@ -45,13 +45,13 @@ bool CAutoLog::Open(const char * filename) // Sanitize slashes char *ptr; - while ((ptr = strchr(pFilename,WRONGSLASH)) != NULL) + while ((ptr = strchr(pFilename,WRONGSLASH)) != nullptr) *ptr = SLASHCHAR[0]; char strPath[1024]; strcpy(strPath,pFilename); ptr = strrchr(strPath, SLASHCHAR[0]); - if (ptr != NULL) + if (ptr != nullptr) { *ptr = 0; @@ -59,11 +59,11 @@ bool CAutoLog::Open(const char * filename) char curdir[128]; // remember current directory - if( getcwd(curdir,sizeof(curdir)) == NULL ) + if( getcwd(curdir,sizeof(curdir)) == nullptr ) { fprintf(stderr,"CAutoLog::Archive failed to get current directory!\n"); free(pFilename); - pFilename = NULL; + pFilename = nullptr; return false; // error, can't proceed } @@ -74,7 +74,7 @@ bool CAutoLog::Open(const char * filename) { fprintf(stderr,"CAutoLog::Archive failed to make directory: %s\n", strPath); free(pFilename); - pFilename = NULL; + pFilename = nullptr; return false; // error, can't proceed } } @@ -94,7 +94,7 @@ bool CAutoLog::Open(const char * filename) { fprintf(stderr,"CAutoLog::Archive failed to make directory: %s\n", strPath); free(pFilename); - pFilename = NULL; + pFilename = nullptr; return false; // error, can't proceed } } @@ -103,7 +103,7 @@ bool CAutoLog::Open(const char * filename) pFile = fopen(pFilename,"a+"); - if( pFile == NULL || pFile == (FILE *)-1) + if( pFile == nullptr || pFile == (FILE *)-1) { //fprintf(stderr,"CAutoLog::Open failed to open log file: %s\n",pFilename); Close(); @@ -123,7 +123,7 @@ bool CAutoLog::Open(const char * filename) void CAutoLog::Close(void) //------------------------------------- { - if( pFile != (FILE *)-1 && pFile != NULL) + if( pFile != (FILE *)-1 && pFile != nullptr) { fclose(pFile); } @@ -131,7 +131,7 @@ void CAutoLog::Close(void) free(pFilename); - pFilename = NULL; + pFilename = nullptr; } //------------------------------------- @@ -194,7 +194,7 @@ void CAutoLog::LogDebug(char * format, ...) void CAutoLog::Log(eLogLevel severity, char *fmt, ...) //------------------------------------- { - if (pFile == (FILE *)-1 || pFile == NULL) + if (pFile == (FILE *)-1 || pFile == nullptr) { //fprintf(stderr,"CAutoLog::Log called with no file open!\n"); return; @@ -250,7 +250,7 @@ void CAutoLog::Log(eLogLevel severity, char *fmt, ...) void CAutoLog::Archive(void) //------------------------------------- { - if( pFile == (FILE *)-1 || pFile == NULL) + if( pFile == (FILE *)-1 || pFile == nullptr) { //fprintf(stderr,"CAutoLog::Archive called with no file open!\n"); return; @@ -281,7 +281,7 @@ void CAutoLog::Archive(void) strcpy(strCurrent,pFilename); pCurrent = strrchr(strCurrent, SLASHCHAR[0]); - if (pCurrent != NULL) + if (pCurrent != nullptr) *pCurrent = 0; else sprintf(strCurrent,"."); @@ -290,7 +290,7 @@ void CAutoLog::Archive(void) #ifdef WIN32 // remember current directory - if( getcwd(curdir,sizeof(curdir)) == NULL ) + if( getcwd(curdir,sizeof(curdir)) == nullptr ) { fprintf(stderr,"CAutoLog::Archive failed to get current directory!\n"); return; // error, can't proceed @@ -324,7 +324,7 @@ void CAutoLog::Archive(void) #endif pCurrent = strrchr(pFilename, SLASHCHAR[0]); - if (pCurrent == NULL) + if (pCurrent == nullptr) pCurrent = pFilename; else pCurrent++; diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/AutoLog.h b/external/3rd/library/soePlatform/CSAssist/utils/Base/AutoLog.h index 0a90a774..18871c7f 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/AutoLog.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/AutoLog.h @@ -92,14 +92,14 @@ namespace Base //------------------------------------- inline CAutoLog::CAutoLog() { - pFilename = NULL; + pFilename = nullptr; pFile = (FILE *)-1; } //------------------------------------- inline CAutoLog::CAutoLog(const char * file) { - pFilename = NULL; + pFilename = nullptr; pFile = (FILE *)-1; Open(file); } diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/Config.cpp b/external/3rd/library/soePlatform/CSAssist/utils/Base/Config.cpp index a5b977fb..97abcd41 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/Config.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/Config.cpp @@ -28,7 +28,7 @@ bool CConfig::LoadFile(char * file) // open file fp = fopen(file, "r"); - if (fp == NULL || fp == (FILE *)-1) + if (fp == nullptr || fp == (FILE *)-1) { //fprintf(stderr,"Failed to open config file %s!",file); return false; @@ -72,21 +72,21 @@ void CConfig::UnloadFile(void) //----------------------------------- { delete[] pConfig; - pConfig = NULL; + pConfig = nullptr; } //----------------------------------- /// finds a key of the config in memory // key argument is case-insensitive, but must be upper case in config file -// Returns true for success (passing NULL is a special case returned as success) +// Returns true for success (passing nullptr is a special case returned as success) bool CConfig::FindKey(char *key) //----------------------------------- { - if (pConfig == NULL) + if (pConfig == nullptr) return false; // special case...continue with existing key - if (key == NULL) + if (key == nullptr) return true; // form the search key @@ -97,12 +97,12 @@ bool CConfig::FindKey(char *key) // find the key heading pCursor = strstr(pConfig,strBuffer); - if (pCursor==NULL) + if (pCursor==nullptr) return false; // find the closing bracket of key heading pCursor = strchr(pCursor,']'); - if (pCursor==NULL) + if (pCursor==nullptr) return false; pCursor++; @@ -111,7 +111,7 @@ bool CConfig::FindKey(char *key) //----------------------------------- /// extract a number from the config string -// pass the key to find the first number in the list, else NULL to find the next number in the list +// pass the key to find the first number in the list, else nullptr to find the next number in the list // returns 0 if no number is found, else returns the number long CConfig::GetLong(char *key) //----------------------------------- @@ -134,20 +134,20 @@ long CConfig::GetLong(char *key) //----------------------------------- /// extract string (in double-quotes) from the list. -// pass the key to find the first string in the list, else NULL to find the next string in the list -// returns NULL if no string found, else returns a temporary copy of the string (without quotes) +// pass the key to find the first string in the list, else nullptr to find the next string in the list +// returns nullptr if no string found, else returns a temporary copy of the string (without quotes) char * CConfig::GetString(char *key) //----------------------------------- { if (!FindKey(key)) - return NULL; + return nullptr; // look for start of string or end of key while (*pCursor && *pCursor != '"' && *pCursor != '[') pCursor++; if (*(pCursor++) != '"') - return NULL; + return nullptr; // until closing quote int c = 0; @@ -161,7 +161,7 @@ char * CConfig::GetString(char *key) } } - return NULL; + return nullptr; } diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/Config.h b/external/3rd/library/soePlatform/CSAssist/utils/Base/Config.h index 864506f3..6f6dc376 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/Config.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/Config.h @@ -10,7 +10,7 @@ ; list of strings, with code example # config.FindKey("NUMBERS"); -# while (number = config.GetLong(NULL)) +# while (number = config.GetLong(nullptr)) # YourHandleNumber(number); [NUMBERS] 100 200, 300 ; formatting is very flexible as long as numbers are delimited by non-numbers @@ -23,7 +23,7 @@ ; list of strings, with code example # config.FindKey("HOSTS"); -# while (string = config.GetString(NULL)) +# while (string = config.GetString(nullptr)) # YourHandleString(string); [HOSTS] "127.0.0.1:5999" @@ -68,16 +68,16 @@ namespace Base // returns TRUE if key is found. bool FindKey(char *key); - // extract string from config. If key is NULL, extract next string in list, else extract first string. - // if key was not found, returns NULL - char * GetString(char *key = NULL); + // extract string from config. If key is nullptr, extract next string in list, else extract first string. + // if key was not found, returns nullptr + char * GetString(char *key = nullptr); - // extract number from config. If key is NULL, extract next number in list, else extract first number. + // extract number from config. If key is nullptr, extract next number in list, else extract first number. // if key was not found, returns 0 - long GetLong(char *key = NULL); // extract number from config. + long GetLong(char *key = nullptr); // extract number from config. // indicate if config file has been loaded - inline bool FileLoaded() { return pConfig == NULL ? false : true; } + inline bool FileLoaded() { return pConfig == nullptr ? false : true; } private: char * pConfig; // pointer to file memory @@ -87,14 +87,14 @@ namespace Base inline CConfig::CConfig() { - pConfig = NULL; - pCursor = NULL; + pConfig = nullptr; + pCursor = nullptr; } inline CConfig::CConfig(char * file) { - pConfig = NULL; - pCursor = NULL; + pConfig = nullptr; + pCursor = nullptr; LoadFile(file); } diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/Logger.cpp b/external/3rd/library/soePlatform/CSAssist/utils/Base/Logger.cpp index 1ce102af..bf3dcc39 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/Logger.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/Logger.cpp @@ -98,7 +98,7 @@ Logger::Logger(const char *programName, void Logger::LoggerInit(const char *programName) { char buf[1024]; - FILE *logDir = NULL; + FILE *logDir = nullptr; if (0 != (m_logType & eUseLocalFile)) { @@ -107,13 +107,13 @@ void Logger::LoggerInit(const char *programName) { cmkdir(m_dirPrefix.c_str(), 0755); } - else if(logDir != NULL) + else if(logDir != nullptr) { fclose(logDir); } tm now; - time_t t = time(NULL); + time_t t = time(nullptr); LOGGER_GET_CURR_TIME(now, t); @@ -131,7 +131,7 @@ void Logger::LoggerInit(const char *programName) { cmkdir(buf, 0755); } - else if(logDir != NULL) + else if(logDir != nullptr) { fclose(logDir); } @@ -300,7 +300,7 @@ void Logger::logSimple(unsigned logenum, int level, const char *message) { return; } - time_t t = time(NULL); + time_t t = time(nullptr); LogInfo *info = (*iter).second; if(level >= info->level) { @@ -377,7 +377,7 @@ void Logger::logSimpleWithSys(unsigned logenum, unsigned priority, int level, co { return; } - time_t t = time(NULL); + time_t t = time(nullptr); LogInfo *info = (*iter).second; if(level >= info->level) @@ -447,7 +447,7 @@ void Logger::log(unsigned logenum, int level, const char *message, ...) // ensure that the buf does not contain any '%' characters. // prevent crash problem char *rv; - while((rv = strchr(buf, '%')) != NULL) + while((rv = strchr(buf, '%')) != nullptr) { *rv = ' '; // replace with space } @@ -478,7 +478,7 @@ void Logger::logWithSys(unsigned logenum, unsigned priority, int level, const ch { return; } - time_t t = time(NULL); + time_t t = time(nullptr); LogInfo *info = (*iter).second; if(level >= info->level) @@ -536,14 +536,14 @@ void Logger::logWithSys(unsigned logenum, unsigned priority, int level, const ch void Logger::rollDate(time_t t) { char buf[80]; - FILE *logDir = NULL; + FILE *logDir = nullptr; logDir = fopen(m_dirPrefix.c_str(), "r+"); if(errno == ENOENT) { cmkdir(m_dirPrefix.c_str(), 0755); } - else if(logDir != NULL) + else if(logDir != nullptr) { fclose(logDir); } @@ -559,7 +559,7 @@ void Logger::rollDate(time_t t) { cmkdir(buf, 0755); } - else if(logDir != NULL) + else if(logDir != nullptr) { fclose(logDir); } @@ -643,7 +643,7 @@ void Logger::rollLog(LogInfo *logInfo) { std::string newLogName; char timeStampBuffer[256]; - time_t t = time(NULL); + time_t t = time(nullptr); tm now; int r; int nTries = 10; diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/Statistics.h b/external/3rd/library/soePlatform/CSAssist/utils/Base/Statistics.h index 18e0579e..0856034b 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/Statistics.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/Statistics.h @@ -34,9 +34,9 @@ namespace Base bool commit = false; if (!mLastSampleTime) - mLastSampleTime = time(NULL); + mLastSampleTime = time(nullptr); - if (!mSampleFrequency || mLastSampleTime + mSampleFrequency < (unsigned)time(NULL)) + if (!mSampleFrequency || mLastSampleTime + mSampleFrequency < (unsigned)time(nullptr)) { mSampleTotal++; mAggregateTotal += value; diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/TemplateObjectAllocator.h b/external/3rd/library/soePlatform/CSAssist/utils/Base/TemplateObjectAllocator.h index 40227673..ed1a7937 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/TemplateObjectAllocator.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/TemplateObjectAllocator.h @@ -93,7 +93,7 @@ namespace Base void Destroy(TYPE *object) { - if (object == NULL) + if (object == nullptr) return; #ifdef USE_ALLOCATOR_MUTEX @@ -142,7 +142,7 @@ namespace Base void FastDestroy(TYPE *object) { - if (object == NULL) + if (object == nullptr) return; object->~TYPE(); diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/WideString.h b/external/3rd/library/soePlatform/CSAssist/utils/Base/WideString.h index 775f9713..28159b18 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/WideString.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/WideString.h @@ -94,12 +94,12 @@ namespace ucs2 } //////////////////////////////////////// - // target string is a null-terminated C string + // target string is a nullptr-terminated C string inline string::string(const char * copy) : mLength(0), mData(8,0) { - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!copy) { return; @@ -111,12 +111,12 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *copy++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; } //////////////////////////////////////// - // target string is a C string that may or may not include null characters + // target string is a C string that may or may not include nullptr characters inline string::string(const std::string & copy) : mLength(copy.length()), mData(8,0) @@ -126,17 +126,17 @@ namespace ucs2 // (2) perform transform to copy the narrow string to our // wide string std::transform(copy.begin(), copy.end(), mData.begin(), NarrowToWide); - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength] = 0; } //////////////////////////////////////// - // target string is a wide null-terminated C string + // target string is a wide nullptr-terminated C string inline string::string(const char_type * copy) : mLength(0), mData(8,0) { - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!copy) { return; @@ -148,7 +148,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *copy++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; } @@ -169,7 +169,7 @@ namespace ucs2 inline string & string::operator=(const char * rhs) { mLength = 0; - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!rhs) { mData[0] = 0; @@ -182,7 +182,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } @@ -195,7 +195,7 @@ namespace ucs2 // (2) perform transform to copy the narrow string to our // wide string std::transform(rhs.begin(), rhs.end(), mData.begin(), NarrowToWide); - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength] = 0; return *this; } @@ -203,7 +203,7 @@ namespace ucs2 inline string & string::operator=(const char_type * rhs) { mLength = 0; - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!rhs) { mData[0] = 0; @@ -216,7 +216,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } @@ -235,7 +235,7 @@ namespace ucs2 inline string & string::operator+=(const char * rhs) { - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!rhs) { return *this; @@ -247,7 +247,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } @@ -259,7 +259,7 @@ namespace ucs2 // (2) perform transform to copy the narrow string to our // wide string std::transform(rhs.begin(), rhs.end(), mData.begin()+mLength, NarrowToWide); - // (3) ensure null termination + // (3) ensure nullptr termination mLength += rhs.length(); mData[mLength] = 0; return *this; @@ -267,7 +267,7 @@ namespace ucs2 inline string & string::operator+=(const char_type * rhs) { - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!rhs) { return *this; @@ -279,7 +279,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } @@ -388,7 +388,7 @@ namespace ucs2 inline string & string::assign(const char_type * rhs) { mLength = 0; - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!rhs) { mData[0] = 0; @@ -401,7 +401,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } @@ -409,7 +409,7 @@ namespace ucs2 inline string & string::assign(const char_type * rhs, size_type count) { mLength = 0; - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!rhs) { mData[0] = 0; @@ -422,7 +422,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } @@ -463,7 +463,7 @@ namespace ucs2 inline string & string::assign(const char_type * first, const char_type * last) { mLength = 0; - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!first || !last) { mData[0] = 0; @@ -476,14 +476,14 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *first++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } inline string & string::append(const char_type * rhs) { - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!rhs) { return *this; @@ -495,14 +495,14 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } inline string & string::append(const char_type * rhs, size_type count) { - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!rhs) { return *this; @@ -514,7 +514,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } @@ -558,7 +558,7 @@ namespace ucs2 inline string & string::append(const char_type * first, const char_type * last) { - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!first || !last) { return *this; @@ -570,7 +570,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *first++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/BlockAllocator.cpp b/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/BlockAllocator.cpp index 4cefb9e7..29d91074 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/BlockAllocator.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/BlockAllocator.cpp @@ -12,7 +12,7 @@ namespace Base { for(unsigned i = 0; i < 31; i++) { - m_blocks[i] = NULL; + m_blocks[i] = nullptr; } } @@ -21,7 +21,7 @@ namespace Base // free all allocated memory blocks for(unsigned i = 0; i < 31; i++) { - while(m_blocks[i] != NULL) + while(m_blocks[i] != nullptr) { unsigned *tmp = m_blocks[i]; m_blocks[i] = (unsigned *)*m_blocks[i]; @@ -36,7 +36,7 @@ namespace Base void *BlockAllocator::getBlock(unsigned bytes) { unsigned accum = 16, bits = 16; - unsigned *handle = NULL; + unsigned *handle = nullptr; // Perform a binary search looking for the highest bit. @@ -96,7 +96,7 @@ namespace Base void BlockAllocator::returnBlock(unsigned *handle) { - // C++ allows for safe deletion of a NULL pointer + // C++ allows for safe deletion of a nullptr pointer if(handle) { // Update the allocator linked list, insert this entry at the head diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/Event.cpp b/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/Event.cpp index a3cce3b1..72190595 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/Event.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/Event.cpp @@ -26,8 +26,8 @@ namespace Base mCond(), mThreadCount(0) { - pthread_mutex_init(&mMutex, NULL); - pthread_cond_init(&mCond, NULL); + pthread_mutex_init(&mMutex, nullptr); + pthread_cond_init(&mCond, nullptr); } CEvent::~CEvent() @@ -74,7 +74,7 @@ namespace Base struct timeval now; struct timespec abs_timeout; - gettimeofday(&now, NULL); + gettimeofday(&now, nullptr); abs_timeout.tv_sec = now.tv_sec + timeout/1000; abs_timeout.tv_nsec = now.tv_usec * 1000 + (timeout%1000)*1000000; abs_timeout.tv_sec += abs_timeout.tv_nsec / 1000000000; diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/Thread.cpp b/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/Thread.cpp index 2bc4f26b..5cca2017 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/Thread.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/Thread.cpp @@ -76,8 +76,8 @@ namespace Base CThreadPool::CMember::CMember(CThreadPool * parent) : mParent(parent), - mFunction(NULL), - mArgument(NULL), + mFunction(nullptr), + mArgument(nullptr), mSemaphore() { StartThread(); @@ -116,8 +116,8 @@ namespace Base if (mFunction) { mFunction(mArgument); - mArgument = NULL; - mFunction = NULL; + mArgument = nullptr; + mFunction = nullptr; } else if (mParent->OnDestory(this)) mThreadContinue = false; @@ -172,7 +172,7 @@ namespace Base } //////////////////////////////////////// - // (3) Delete the null member threads + // (3) Delete the nullptr member threads mMutex.Lock(); while (!mNullMember.empty()) { @@ -199,7 +199,7 @@ namespace Base } //////////////////////////////////////// - // (2) Delete any null member threads. + // (2) Delete any nullptr member threads. while (!mNullMember.empty()) { delete mNullMember.front(); diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/serialize.h b/external/3rd/library/soePlatform/CSAssist/utils/Base/serialize.h index 650681b5..ed38802a 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/serialize.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/serialize.h @@ -501,8 +501,8 @@ namespace soe } else { - //find null terminator, if don't find it before maxLen, then err - const unsigned char *strEnd = NULL; + //find nullptr terminator, if don't find it before maxLen, then err + const unsigned char *strEnd = nullptr; unsigned strLen = 0; for (;strLenm_next; - tmp->m_next = NULL; + tmp->m_next = nullptr; m_numAvailBlocks--; return(tmp); } @@ -56,7 +56,7 @@ void TcpBlockAllocator::returnBlock(data_block *b) void TcpBlockAllocator::realloc() { - data_block *tmp = NULL, *cursor = NULL; + data_block *tmp = nullptr, *cursor = nullptr; tmp = new data_block; m_numAvailBlocks++; cursor = tmp; diff --git a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpConnection.cpp b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpConnection.cpp index 97ca7fd1..c74eaca4 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpConnection.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpConnection.cpp @@ -11,28 +11,28 @@ namespace NAMESPACE //used when want to open new connection with this socket TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, const IPAddress &destIP, short destPort, unsigned timeout) -: m_nextConnection(NULL), - m_prevConnection(NULL), +: m_nextConnection(nullptr), + m_prevConnection(nullptr), m_socket(INVALID_SOCKET), - m_nextKeepAliveConnection(NULL), - m_prevKeepAliveConnection(NULL), + m_nextKeepAliveConnection(nullptr), + m_prevKeepAliveConnection(nullptr), m_aliveListId(tcpManager->m_aliveList.m_listID), - m_nextRecvDataConnection(NULL), - m_prevRecvDataConnection(NULL), + m_nextRecvDataConnection(nullptr), + m_prevRecvDataConnection(nullptr), m_recvDataListId(tcpManager->m_dataList.m_listID), m_manager(tcpManager), m_status(StatusNegotiating), - m_handler(NULL), + m_handler(nullptr), m_destIP(destIP), m_destPort(destPort), m_refCount(0), m_sendAllocator(sendAlloc), - m_head(NULL), - m_tail(NULL), + m_head(nullptr), + m_tail(nullptr), m_bytesRead(0), m_bytesNeeded(0), m_params(params), - m_recvBuff(NULL), + m_recvBuff(nullptr), m_connectTimeout(timeout), m_connectTimer(), m_wasConRemovedFromMgr(false) @@ -94,28 +94,28 @@ TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAllo //used when server mode creates new connection object representing a connect request TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, SOCKET socket, const IPAddress &destIP, short destPort) -: m_nextConnection(NULL), - m_prevConnection(NULL), +: m_nextConnection(nullptr), + m_prevConnection(nullptr), m_socket(socket), - m_nextKeepAliveConnection(NULL), - m_prevKeepAliveConnection(NULL), + m_nextKeepAliveConnection(nullptr), + m_prevKeepAliveConnection(nullptr), m_aliveListId(tcpManager->m_aliveList.m_listID), - m_nextRecvDataConnection(NULL), - m_prevRecvDataConnection(NULL), + m_nextRecvDataConnection(nullptr), + m_prevRecvDataConnection(nullptr), m_recvDataListId(tcpManager->m_dataList.m_listID), m_manager(tcpManager), m_status(StatusConnected), - m_handler(NULL), + m_handler(nullptr), m_destIP(destIP), m_destPort(destPort), m_refCount(0), m_sendAllocator(sendAlloc), - m_head(NULL), - m_tail(NULL), + m_head(nullptr), + m_tail(nullptr), m_bytesRead(0), m_bytesNeeded(0), m_params(params), - m_recvBuff(NULL), + m_recvBuff(nullptr), m_connectTimeout(0), m_connectTimer(), m_wasConRemovedFromMgr(false) @@ -205,7 +205,7 @@ int TcpConnection::finishConnect() t.tv_sec = 0; t.tv_usec = 0; - int err = select(m_socket + 1, NULL, &wrSet, NULL, &t); + int err = select(m_socket + 1, nullptr, &wrSet, nullptr, &t); if (err == 0) { @@ -300,7 +300,7 @@ TcpConnection::~TcpConnection() { delete [] m_recvBuff; - while(m_head != NULL) + while(m_head != nullptr) { data_block *tmp = m_head; m_head = m_head->m_next; @@ -324,22 +324,22 @@ void TcpConnection::Send(const char *data, unsigned int dataLen) { m_aliveListId = m_manager->m_keepAliveList.m_listID; - if (m_prevKeepAliveConnection != NULL) + if (m_prevKeepAliveConnection != nullptr) m_prevKeepAliveConnection->m_nextKeepAliveConnection = m_nextKeepAliveConnection; - if (m_nextKeepAliveConnection != NULL) + if (m_nextKeepAliveConnection != nullptr) m_nextKeepAliveConnection->m_prevKeepAliveConnection = m_prevKeepAliveConnection; if (m_manager->m_keepAliveList.m_beginList == this) m_manager->m_keepAliveList.m_beginList = m_nextKeepAliveConnection; m_nextKeepAliveConnection = m_manager->m_aliveList.m_beginList; - m_prevKeepAliveConnection = NULL; - if (m_manager->m_aliveList.m_beginList != NULL) + m_prevKeepAliveConnection = nullptr; + if (m_manager->m_aliveList.m_beginList != nullptr) m_manager->m_aliveList.m_beginList->m_prevKeepAliveConnection = this; m_manager->m_aliveList.m_beginList = this; } - data_block *work = NULL; + data_block *work = nullptr; // this connection has no send buffer. Get a block if(!m_tail) @@ -464,16 +464,16 @@ int TcpConnection::processIncoming() { m_recvDataListId = m_manager->m_noDataList.m_listID; - if (m_prevRecvDataConnection != NULL) + if (m_prevRecvDataConnection != nullptr) m_prevRecvDataConnection->m_nextRecvDataConnection = m_nextRecvDataConnection; - if (m_nextRecvDataConnection != NULL) + if (m_nextRecvDataConnection != nullptr) m_nextRecvDataConnection->m_prevRecvDataConnection = m_prevRecvDataConnection; if (m_manager->m_noDataList.m_beginList == this) m_manager->m_noDataList.m_beginList = m_nextRecvDataConnection; m_nextRecvDataConnection = m_manager->m_dataList.m_beginList; - m_prevRecvDataConnection = NULL; - if (m_manager->m_dataList.m_beginList != NULL) + m_prevRecvDataConnection = nullptr; + if (m_manager->m_dataList.m_beginList != nullptr) m_manager->m_dataList.m_beginList->m_prevRecvDataConnection = this; m_manager->m_dataList.m_beginList = this; } @@ -619,7 +619,7 @@ int TcpConnection::processOutgoing() int sendError = 1; - // If m_head is not null, then this connection has something to send + // If m_head is not nullptr, then this connection has something to send if(m_head) diff --git a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpConnection.h b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpConnection.h index 07eb4f42..92d631d1 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpConnection.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpConnection.h @@ -50,7 +50,7 @@ public: * connection is disconnected, you simply need to derive your class * (multiply if necessary) from TcpConnectionHandler, then you can use * this method to set the object the TcpConnection will call as appropriate. - * default = NULL (no callbacks made) + * default = nullptr (no callbacks made) * * @param handler The object which will be called for notifications. */ diff --git a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpManager.cpp b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpManager.cpp index 29d51de0..86778910 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpManager.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpManager.cpp @@ -41,14 +41,14 @@ TcpManager::TcpParams::TcpParams(const TcpParams &cpy) } TcpManager::TcpManager(const TcpParams ¶ms) -: m_handler(NULL), - m_keepAliveList(NULL, 1), - m_aliveList(NULL, 2), - m_noDataList(NULL, 1), - m_dataList(NULL, 2), +: m_handler(nullptr), + m_keepAliveList(nullptr, 1), + m_aliveList(nullptr, 2), + m_noDataList(nullptr, 1), + m_dataList(nullptr, 2), m_params(params), m_refCount(1), - m_connectionList(NULL), + m_connectionList(nullptr), m_connectionListCount(0), m_socket(INVALID_SOCKET), m_boundAsServer(false), @@ -86,7 +86,7 @@ TcpManager::~TcpManager() close(m_socket); #endif } - while (m_connectionList != NULL) + while (m_connectionList != nullptr) { TcpConnection *con = m_connectionList; m_connectionList = m_connectionList->m_nextConnection; @@ -162,7 +162,7 @@ bool TcpManager::BindAsServer() { struct hostent * lphp; lphp = gethostbyname(m_params.bindAddress); - if (lphp != NULL) + if (lphp != nullptr) addr_loc.sin_addr.s_addr = ((struct in_addr *)(lphp->h_addr))->s_addr; } else @@ -187,7 +187,7 @@ bool TcpManager::BindAsServer() TcpConnection *TcpManager::acceptClient() { - TcpConnection *newConn = NULL; + TcpConnection *newConn = nullptr; if (m_boundAsServer && m_connectionListCount < m_params.maxConnections) { @@ -201,7 +201,7 @@ TcpConnection *TcpManager::acceptClient() { newConn = new TcpConnection(this, &m_allocator, m_params, sock, IPAddress(addr.sin_addr.s_addr), ntohs(addr.sin_port)); addNewConnection(newConn); - if (m_handler != NULL) + if (m_handler != nullptr) { m_handler->OnConnectRequest(newConn); } @@ -226,8 +226,8 @@ SOCKET TcpManager::getMaxFD() if (m_boundAsServer) maxfd = m_socket+1; - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) { next = con->m_nextConnection; if (con->GetStatus() != TcpConnection::StatusDisconnected && con->m_socket > maxfd) @@ -241,8 +241,8 @@ SOCKET TcpManager::getMaxFD() TcpConnection *TcpManager::getConnection(SOCKET fd) { - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) { next = con->m_nextConnection; if (con->m_socket == fd) @@ -251,7 +251,7 @@ TcpConnection *TcpManager::getConnection(SOCKET fd) } } //if get here ,couldn't find it - return NULL; + return nullptr; } bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendTimePerConnection, unsigned maxRecvTimePerConnection) @@ -273,8 +273,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT { // Send output from last heartbeat - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) { con->AddRef(); if (next) next->Release(); @@ -341,7 +341,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT tmpfds = m_permfds; timeout.tv_sec = 0; timeout.tv_usec = 0; - int cnt = select(maxfd, &tmpfds, NULL, NULL, &timeout); // blocks for timeout + int cnt = select(maxfd, &tmpfds, nullptr, nullptr, &timeout); // blocks for timeout if (cnt > 0) @@ -367,8 +367,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //process incoming client messages if (maxRecvTimePerConnection != 0) { - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) { con->AddRef(); if (next) next->Release(); @@ -433,8 +433,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT pollfds[0].events |= POLLIN; } - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next, idx++) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next, idx++) { next = con->m_nextConnection; pollfds[idx].fd = con->m_socket; @@ -474,7 +474,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT } //process regular msg(s) - if (con == NULL) + if (con == nullptr) { close(pollfds[idx].fd); continue; @@ -506,7 +506,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT }//if(pollfds[... else if (pollfds[idx].revents & POLLHUP) { - if (con == NULL) + if (con == nullptr) { close(pollfds[idx].fd); continue; @@ -524,21 +524,21 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //now process any keepalives, if time to do that if (m_params.keepAliveDelay > 0 && m_keepAliveTimer.isDone(m_params.keepAliveDelay)) { - TcpConnection *next = NULL; - for (TcpConnection *con = m_keepAliveList.m_beginList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_keepAliveList.m_beginList ; con != nullptr ; con = next) { con->AddRef(); if (next) next->Release(); next = con->m_nextKeepAliveConnection; if (next) next->AddRef(); - con->Send(NULL, 0); //note: this request will move the connection from the keepAliveList to the aliveList + con->Send(nullptr, 0); //note: this request will move the connection from the keepAliveList to the aliveList con->Release(); } //now move the complete alive list over to the keepalive list to reset those timers m_keepAliveList.m_beginList = m_aliveList.m_beginList; - m_aliveList.m_beginList = NULL; + m_aliveList.m_beginList = nullptr; //switch id's for those connections that were in the alive list last go - around int tmpID = m_aliveList.m_listID; @@ -552,8 +552,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //now process any noDataCons, if time to do that if (m_params.noDataTimeout > 0 && m_noDataTimer.isDone(m_params.noDataTimeout)) { - TcpConnection *next = NULL; - for (TcpConnection *con = m_noDataList.m_beginList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_noDataList.m_beginList ; con != nullptr ; con = next) { con->AddRef(); if (next) next->Release(); @@ -567,7 +567,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //now move the complete data list over to the nodata list to reset those timers m_noDataList.m_beginList = m_dataList.m_beginList; - m_dataList.m_beginList = NULL; + m_dataList.m_beginList = nullptr; //switch id's for those connections that were in the data list last go - around int tmpID = m_dataList.m_listID; @@ -589,11 +589,11 @@ TcpConnection *TcpManager::EstablishConnection(const char *serverAddress, unsign { //can't open outgoing connections when in server mode // use a different TcpManager to do that - return NULL; + return nullptr; } if (m_connectionListCount >= m_params.maxConnections) - return(NULL); + return(nullptr); // get server address unsigned long address = inet_addr(serverAddress); @@ -601,8 +601,8 @@ TcpConnection *TcpManager::EstablishConnection(const char *serverAddress, unsign { struct hostent * lphp; lphp = gethostbyname(serverAddress); - if (lphp == NULL) - return(NULL); + if (lphp == nullptr) + return(nullptr); address = ((struct in_addr *)(lphp->h_addr))->s_addr; } IPAddress destIP(address); @@ -622,22 +622,22 @@ void TcpManager::addNewConnection(TcpConnection *con) FD_SET(con->m_socket, &m_permfds); #endif con->m_nextConnection = m_connectionList; - con->m_prevConnection = NULL; - if (m_connectionList != NULL) + con->m_prevConnection = nullptr; + if (m_connectionList != nullptr) m_connectionList->m_prevConnection = con; m_connectionList = con; m_connectionListCount++; con->m_nextKeepAliveConnection = m_aliveList.m_beginList; - con->m_prevKeepAliveConnection = NULL; - if (m_aliveList.m_beginList != NULL) + con->m_prevKeepAliveConnection = nullptr; + if (m_aliveList.m_beginList != nullptr) m_aliveList.m_beginList->m_prevKeepAliveConnection = con; m_aliveList.m_beginList = con; con->m_aliveListId = m_keepAliveList.m_listID;//start it out thinking it's already in the alive list, since it is con->m_nextRecvDataConnection = m_dataList.m_beginList; - con->m_prevRecvDataConnection = NULL; - if (m_dataList.m_beginList != NULL) + con->m_prevRecvDataConnection = nullptr; + if (m_dataList.m_beginList != nullptr) m_dataList.m_beginList->m_prevRecvDataConnection = con; m_dataList.m_beginList = con; con->m_recvDataListId = m_noDataList.m_listID;//start it out thinking it's already in the data list, since it is @@ -655,40 +655,40 @@ void TcpManager::removeConnection(TcpConnection *con) FD_CLR(con->m_socket, &m_permfds); } #endif - if (con->m_prevConnection != NULL) + if (con->m_prevConnection != nullptr) con->m_prevConnection->m_nextConnection = con->m_nextConnection; - if (con->m_nextConnection != NULL) + if (con->m_nextConnection != nullptr) con->m_nextConnection->m_prevConnection = con->m_prevConnection; if (m_connectionList == con) m_connectionList = con->m_nextConnection; - con->m_nextConnection = NULL; - con->m_prevConnection = NULL; + con->m_nextConnection = nullptr; + con->m_prevConnection = nullptr; - if (con->m_prevKeepAliveConnection != NULL) + if (con->m_prevKeepAliveConnection != nullptr) con->m_prevKeepAliveConnection->m_nextKeepAliveConnection = con->m_nextKeepAliveConnection; - if (con->m_nextKeepAliveConnection != NULL) + if (con->m_nextKeepAliveConnection != nullptr) con->m_nextKeepAliveConnection->m_prevKeepAliveConnection = con->m_prevKeepAliveConnection; if (m_aliveList.m_beginList == con) m_aliveList.m_beginList = con->m_nextKeepAliveConnection; else if (m_keepAliveList.m_beginList == con) m_keepAliveList.m_beginList = con->m_nextKeepAliveConnection; - con->m_nextKeepAliveConnection = NULL; - con->m_prevKeepAliveConnection = NULL; + con->m_nextKeepAliveConnection = nullptr; + con->m_prevKeepAliveConnection = nullptr; - if (con->m_prevRecvDataConnection != NULL) + if (con->m_prevRecvDataConnection != nullptr) con->m_prevRecvDataConnection->m_nextRecvDataConnection = con->m_nextRecvDataConnection; - if (con->m_nextRecvDataConnection != NULL) + if (con->m_nextRecvDataConnection != nullptr) con->m_nextRecvDataConnection->m_prevRecvDataConnection = con->m_prevRecvDataConnection; if (m_dataList.m_beginList == con) m_dataList.m_beginList = con->m_nextRecvDataConnection; else if (m_noDataList.m_beginList == con) m_noDataList.m_beginList = con->m_nextRecvDataConnection; - con->m_nextRecvDataConnection = NULL; - con->m_prevRecvDataConnection = NULL; + con->m_nextRecvDataConnection = nullptr; + con->m_prevRecvDataConnection = nullptr; diff --git a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpManager.h b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpManager.h index 32132069..cdc01daa 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpManager.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpManager.h @@ -156,7 +156,7 @@ public: * simply need to derive your class (multiply if necessary) from TcpManagerHandler, then you can use * this method to set the object the TcpManager will call as appropriate. The TcpConnection object * also has a handler mechanism that replaces the other callback functions below, see TcpConnection::SetHandler - * default = NULL (no callbacks made) + * default = nullptr (no callbacks made) * * @param handler The object which will be called for manager related notifications. */ @@ -211,7 +211,7 @@ public: * the connect-complete callback to be called if the connection is succesfull. * * @return A pointer to a TcpConnection object. - * NULL if the manager object has exceeded its maximum number of connections + * nullptr if the manager object has exceeded its maximum number of connections * or if the serverAddress cannot be resolved to an IP address. */ TcpConnection *EstablishConnection(const char *serverAddress, unsigned short serverPort, unsigned timeout = 0); diff --git a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TestClient/TestClient.cpp b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TestClient/TestClient.cpp index 075062d5..35423e88 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TestClient/TestClient.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TestClient/TestClient.cpp @@ -42,7 +42,7 @@ void TestClient::process() { m_con->SetHandler(this); m_conState = CON_NEGOTIATE; - m_conTimeout = time(NULL) + 20;//m_reconnectTimeout; + m_conTimeout = time(nullptr) + 20;//m_reconnectTimeout; } break; case CON_NEGOTIATE: @@ -51,10 +51,10 @@ void TestClient::process() m_conState = CON_CONNECT; printf("callback here.... connected\n"); } - else if(time(NULL) > 20) + else if(time(nullptr) > 20) { m_con->Release(); - m_con = NULL; + m_con = nullptr; m_conState = CON_DISCONNECT; } break; @@ -63,7 +63,7 @@ void TestClient::process() default: m_conState = CON_DISCONNECT; m_con->Release(); - m_con = NULL; + m_con = nullptr; } m_manager->GiveTime(); } @@ -95,7 +95,7 @@ void TestClient::OnTerminated(TcpConnection *con) if (m_con) { m_con->Release(); - m_con = NULL; + m_con = nullptr; } m_conState = CON_DISCONNECT; } diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Unicode/UnicodeCharacterDataMap.h b/external/3rd/library/soePlatform/CSAssist/utils/Unicode/UnicodeCharacterDataMap.h index 741a6e80..493c5a2d 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Unicode/UnicodeCharacterDataMap.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/Unicode/UnicodeCharacterDataMap.h @@ -122,7 +122,7 @@ namespace Plat_Unicode /** * Find a CharData for the given code point. - * @return null if no CharData exists for this code point + * @return nullptr if no CharData exists for this code point */ inline const CharData * CharDataMap::findCharData (const unicode_char_t code) const diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Unicode/utf8.cpp b/external/3rd/library/soePlatform/CSAssist/utils/Unicode/utf8.cpp index 527f246d..e7df40e2 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Unicode/utf8.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/Unicode/utf8.cpp @@ -87,7 +87,7 @@ int UTF8_convertCharToUTF16( char * ptr , UTF16 * ret ) int UTF8_convertToUTF16( char * ptr , UTF16 * ret, int limit ) { int len = 0; - while (( *ptr != 0 ) && ( len < ( limit - 1 ) ))//we use limit -1 to leave room for the null terminator + while (( *ptr != 0 ) && ( len < ( limit - 1 ) ))//we use limit -1 to leave room for the nullptr terminator { int clen = UTF8_convertCharToUTF16( ptr, ret ); ptr += clen; diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/Base/Archive.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/Base/Archive.cpp index e3400df0..8ad45428 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/Base/Archive.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/Base/Archive.cpp @@ -91,7 +91,7 @@ namespace Base ByteStream::ByteStream() : allocatedSize(0), beginReadIterator(), - data(NULL), + data(nullptr), size(0), lastPutSize(0) { @@ -208,7 +208,7 @@ namespace Base if(data->size < allocatedSize) { unsigned char * tmp = new unsigned char[newSize]; - if(data->buffer != NULL) + if(data->buffer != nullptr) memcpy(tmp, data->buffer, size); delete[] data->buffer; data->buffer = tmp; diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericApiCore.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericApiCore.cpp index 2f68dd50..527f5b69 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericApiCore.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericApiCore.cpp @@ -117,7 +117,7 @@ unsigned GenericAPICore::submitRequest(GenericRequest *req, GenericResponse *res } req->setTrack(m_currTrack); res->setTrack(m_currTrack); - time_t timeout = time(NULL) + m_requestTimeout; + time_t timeout = time(nullptr) + m_requestTimeout; req->setTimeout(timeout); res->setTimeout(timeout); @@ -136,7 +136,7 @@ void GenericAPICore::process() if (!m_suspended) { // Process timeout on pending requests - while((m_outCount > 0) && ((req = m_outboundQueue.front().first)->getTimeout() <= time(NULL))) + while((m_outCount > 0) && ((req = m_outboundQueue.front().first)->getTimeout() <= time(nullptr))) { --m_outCount; res = m_outboundQueue.front().second; @@ -148,7 +148,7 @@ void GenericAPICore::process() } // Process timeout on pending responses - while((m_pendingCount > 0) && ((res = (*m_pending.begin()).second)->getTimeout() <= time(NULL))) + while((m_pendingCount > 0) && ((res = (*m_pending.begin()).second)->getTimeout() <= time(nullptr))) { --m_pendingCount; m_pending.erase(m_pending.begin()); @@ -161,7 +161,7 @@ void GenericAPICore::process() pair out_pair = m_outboundQueue.front(); req = out_pair.first; res = out_pair.second; - GenericConnection *con = NULL; + GenericConnection *con = nullptr; if (req->getMappedServerTrack() == 0) // request has no originating "owner" server { con = getNextActiveConnection(); // it does not matter which server we send this to @@ -178,7 +178,7 @@ void GenericAPICore::process() } } - if (con != NULL) + if (con != nullptr) { Base::ByteStream msg; req->pack(msg); @@ -213,7 +213,7 @@ GenericConnection *GenericAPICore::getNextActiveConnection() unsigned startIndex = m_nextConnectionIndex; unsigned maxIndex = m_serverConnections.size() - 1; - GenericConnection *con = NULL; + GenericConnection *con = nullptr; //loop until we find an active connection, or until we get back // to where we started @@ -233,7 +233,7 @@ GenericConnection *GenericAPICore::getNextActiveConnection() //went past end of vector, start back at 0 m_nextConnectionIndex = 0; } - }while (con == NULL && m_nextConnectionIndex != startIndex); + }while (con == nullptr && m_nextConnectionIndex != startIndex); return con; } @@ -259,7 +259,7 @@ ServerTrackObject *GenericAPICore::findServer(unsigned server_track) { std::map::iterator iter = m_serverTracks.find(server_track); if (iter == m_serverTracks.end()) - return NULL; + return nullptr; ServerTrackObject *stobj = (*iter).second; m_serverTracks.erase(server_track); return stobj; diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericConnection.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericConnection.cpp index ef652f08..2fd9ca45 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericConnection.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericConnection.cpp @@ -22,7 +22,7 @@ using namespace Base; GenericConnection::GenericConnection(const char *host, short port, GenericAPICore *apiCore, unsigned reconnectTimeout, unsigned noDataTimeoutSecs, unsigned noAckTimeoutSecs, unsigned incomingBufSizeInKB, unsigned outgoingBufSizeInKB, unsigned keepAlive, unsigned maxRecvMessageSizeInKB) : m_bConnected(CON_NONE), m_apiCore(apiCore), - m_con(NULL), + m_con(nullptr), m_host(host), m_port(port), m_lastTrack(123455), //random choice != 1 @@ -47,8 +47,8 @@ GenericConnection::~GenericConnection() { if(m_con) { - m_con->SetHandler(NULL); - m_con->Disconnect();//don't worry about onterminated being called, we've set it's handler to null, so it wont + m_con->SetHandler(nullptr); + m_con->Disconnect();//don't worry about onterminated being called, we've set it's handler to nullptr, so it wont m_con->Release(); } @@ -61,7 +61,7 @@ void GenericConnection::disconnect() { m_con->Disconnect(); //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); - m_con = NULL; + m_con = nullptr; } m_conState = CON_DISCONNECT; m_bConnected = CON_NONE; @@ -74,7 +74,7 @@ void GenericConnection::OnTerminated(TcpConnection *con) if(m_con) { m_con->Release(); - m_con = NULL; + m_con = nullptr; } m_conState = CON_DISCONNECT; m_bConnected = CON_NONE; @@ -90,7 +90,7 @@ void GenericConnection::OnRoutePacket(TcpConnection *con, const unsigned char *d get(iter, type); get(iter, track); - GenericResponse *res = NULL; + GenericResponse *res = nullptr; // the following if block is a temporary fix that prevents // a crash with a game team in which they occasionally find @@ -148,7 +148,7 @@ void GenericConnection::process() { m_con->SetHandler(this); m_conState = CON_NEGOTIATE; - m_conTimeout = time(NULL) + m_reconnectTimeout; + m_conTimeout = time(nullptr) + m_reconnectTimeout; } break; case CON_NEGOTIATE: @@ -169,12 +169,12 @@ void GenericConnection::process() put(msg, m_apiCore->getGameCode()); Send(msg); } - else if(time(NULL) > m_conTimeout) + else if(time(nullptr) > m_conTimeout) { // we did not connect m_con->Disconnect(); //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); - m_con = NULL; + m_con = nullptr; m_conState = CON_DISCONNECT; m_bConnected = CON_NONE; } @@ -190,7 +190,7 @@ void GenericConnection::process() { m_con->Disconnect(); //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); - m_con = NULL; + m_con = nullptr; } } m_manager->GiveTime(); diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/CTServiceAPI.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/CTServiceAPI.cpp index 57f9b409..4e6b0954 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/CTServiceAPI.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/CTServiceAPI.cpp @@ -23,7 +23,7 @@ CTServiceAPI::CTServiceAPI(const char *hostName, const char *game) std::vector hostArray; std::vector portArray; char hostConfig[4096]; - if (hostName == NULL) + if (hostName == nullptr) hostName = DEFAULT_HOST; if (!game) game = DEFAULT_GAMECODE; @@ -47,7 +47,7 @@ CTServiceAPI::CTServiceAPI(const char *hostName, const char *game) portArray.push_back(port); } } - while ((ptr = strtok(NULL, " ")) != NULL); + while ((ptr = strtok(nullptr, " ")) != nullptr); } if (hostArray.empty()) { diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/IPAddress.h b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/IPAddress.h index f6d5f886..03b59e8d 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/IPAddress.h +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/IPAddress.h @@ -32,7 +32,7 @@ public: * @brief Used to retreive the the dot-notation represenatatiion of this address. * * @param buffer A pointer to the buffer to place the ip address into. - * Must be at least 17 characters long, will be null terminated. + * Must be at least 17 characters long, will be nullptr terminated. * * @return A pointer to the buffer the address was placed into. */ diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpBlockAllocator.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpBlockAllocator.cpp index 6d476d78..b7da0f27 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpBlockAllocator.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpBlockAllocator.cpp @@ -6,7 +6,7 @@ namespace NAMESPACE #endif TcpBlockAllocator::TcpBlockAllocator(const unsigned initSize, const unsigned initCount) -: m_freeHead(NULL), m_blockCount(initCount), m_blockSize(initSize), m_numAvailBlocks(0) +: m_freeHead(nullptr), m_blockCount(initCount), m_blockSize(initSize), m_numAvailBlocks(0) { realloc(); } @@ -33,7 +33,7 @@ data_block *TcpBlockAllocator::getBlock() tmp = m_freeHead; m_freeHead = m_freeHead->m_next; - tmp->m_next = NULL; + tmp->m_next = nullptr; m_numAvailBlocks--; return(tmp); } @@ -56,7 +56,7 @@ void TcpBlockAllocator::returnBlock(data_block *b) void TcpBlockAllocator::realloc() { - data_block *tmp = NULL, *cursor = NULL; + data_block *tmp = nullptr, *cursor = nullptr; tmp = new data_block; m_numAvailBlocks++; cursor = tmp; diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpConnection.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpConnection.cpp index 0b3366a8..cd2c1f20 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpConnection.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpConnection.cpp @@ -11,28 +11,28 @@ namespace NAMESPACE //used when want to open new connection with this socket TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, const IPAddress &destIP, short destPort, unsigned timeout) -: m_nextConnection(NULL), - m_prevConnection(NULL), +: m_nextConnection(nullptr), + m_prevConnection(nullptr), m_socket(INVALID_SOCKET), - m_nextKeepAliveConnection(NULL), - m_prevKeepAliveConnection(NULL), + m_nextKeepAliveConnection(nullptr), + m_prevKeepAliveConnection(nullptr), m_aliveListId(tcpManager->m_aliveList.m_listID), - m_nextRecvDataConnection(NULL), - m_prevRecvDataConnection(NULL), + m_nextRecvDataConnection(nullptr), + m_prevRecvDataConnection(nullptr), m_recvDataListId(tcpManager->m_dataList.m_listID), m_manager(tcpManager), m_status(StatusNegotiating), - m_handler(NULL), + m_handler(nullptr), m_destIP(destIP), m_destPort(destPort), m_refCount(0), m_sendAllocator(sendAlloc), - m_head(NULL), - m_tail(NULL), + m_head(nullptr), + m_tail(nullptr), m_bytesRead(0), m_bytesNeeded(0), m_params(params), - m_recvBuff(NULL), + m_recvBuff(nullptr), m_connectTimeout(timeout), m_connectTimer(), m_wasConRemovedFromMgr(false) @@ -94,28 +94,28 @@ TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAllo //used when server mode creates new connection object representing a connect request TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, SOCKET socket, const IPAddress &destIP, short destPort) -: m_nextConnection(NULL), - m_prevConnection(NULL), +: m_nextConnection(nullptr), + m_prevConnection(nullptr), m_socket(socket), - m_nextKeepAliveConnection(NULL), - m_prevKeepAliveConnection(NULL), + m_nextKeepAliveConnection(nullptr), + m_prevKeepAliveConnection(nullptr), m_aliveListId(tcpManager->m_aliveList.m_listID), - m_nextRecvDataConnection(NULL), - m_prevRecvDataConnection(NULL), + m_nextRecvDataConnection(nullptr), + m_prevRecvDataConnection(nullptr), m_recvDataListId(tcpManager->m_dataList.m_listID), m_manager(tcpManager), m_status(StatusConnected), - m_handler(NULL), + m_handler(nullptr), m_destIP(destIP), m_destPort(destPort), m_refCount(0), m_sendAllocator(sendAlloc), - m_head(NULL), - m_tail(NULL), + m_head(nullptr), + m_tail(nullptr), m_bytesRead(0), m_bytesNeeded(0), m_params(params), - m_recvBuff(NULL), + m_recvBuff(nullptr), m_connectTimeout(0), m_connectTimer(), m_wasConRemovedFromMgr(false) @@ -205,7 +205,7 @@ int TcpConnection::finishConnect() t.tv_sec = 0; t.tv_usec = 0; - int err = select(m_socket + 1, NULL, &wrSet, NULL, &t); + int err = select(m_socket + 1, nullptr, &wrSet, nullptr, &t); if (err == 0) { @@ -300,7 +300,7 @@ TcpConnection::~TcpConnection() { delete [] m_recvBuff; - while(m_head != NULL) + while(m_head != nullptr) { data_block *tmp = m_head; m_head = m_head->m_next; @@ -324,22 +324,22 @@ void TcpConnection::Send(const char *data, unsigned int dataLen) { m_aliveListId = m_manager->m_keepAliveList.m_listID; - if (m_prevKeepAliveConnection != NULL) + if (m_prevKeepAliveConnection != nullptr) m_prevKeepAliveConnection->m_nextKeepAliveConnection = m_nextKeepAliveConnection; - if (m_nextKeepAliveConnection != NULL) + if (m_nextKeepAliveConnection != nullptr) m_nextKeepAliveConnection->m_prevKeepAliveConnection = m_prevKeepAliveConnection; if (m_manager->m_keepAliveList.m_beginList == this) m_manager->m_keepAliveList.m_beginList = m_nextKeepAliveConnection; m_nextKeepAliveConnection = m_manager->m_aliveList.m_beginList; - m_prevKeepAliveConnection = NULL; - if (m_manager->m_aliveList.m_beginList != NULL) + m_prevKeepAliveConnection = nullptr; + if (m_manager->m_aliveList.m_beginList != nullptr) m_manager->m_aliveList.m_beginList->m_prevKeepAliveConnection = this; m_manager->m_aliveList.m_beginList = this; } - data_block *work = NULL; + data_block *work = nullptr; // this connection has no send buffer. Get a block if(!m_tail) @@ -464,16 +464,16 @@ int TcpConnection::processIncoming() { m_recvDataListId = m_manager->m_noDataList.m_listID; - if (m_prevRecvDataConnection != NULL) + if (m_prevRecvDataConnection != nullptr) m_prevRecvDataConnection->m_nextRecvDataConnection = m_nextRecvDataConnection; - if (m_nextRecvDataConnection != NULL) + if (m_nextRecvDataConnection != nullptr) m_nextRecvDataConnection->m_prevRecvDataConnection = m_prevRecvDataConnection; if (m_manager->m_noDataList.m_beginList == this) m_manager->m_noDataList.m_beginList = m_nextRecvDataConnection; m_nextRecvDataConnection = m_manager->m_dataList.m_beginList; - m_prevRecvDataConnection = NULL; - if (m_manager->m_dataList.m_beginList != NULL) + m_prevRecvDataConnection = nullptr; + if (m_manager->m_dataList.m_beginList != nullptr) m_manager->m_dataList.m_beginList->m_prevRecvDataConnection = this; m_manager->m_dataList.m_beginList = this; } @@ -619,7 +619,7 @@ int TcpConnection::processOutgoing() int sendError = 1; - // If m_head is not null, then this connection has something to send + // If m_head is not nullptr, then this connection has something to send if(m_head) diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpConnection.h b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpConnection.h index 07eb4f42..92d631d1 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpConnection.h +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpConnection.h @@ -50,7 +50,7 @@ public: * connection is disconnected, you simply need to derive your class * (multiply if necessary) from TcpConnectionHandler, then you can use * this method to set the object the TcpConnection will call as appropriate. - * default = NULL (no callbacks made) + * default = nullptr (no callbacks made) * * @param handler The object which will be called for notifications. */ diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpManager.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpManager.cpp index fa4d61a4..2586fa64 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpManager.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpManager.cpp @@ -41,14 +41,14 @@ TcpManager::TcpParams::TcpParams(const TcpParams &cpy) } TcpManager::TcpManager(const TcpParams ¶ms) -: m_handler(NULL), - m_keepAliveList(NULL, 1), - m_aliveList(NULL, 2), - m_noDataList(NULL, 1), - m_dataList(NULL, 2), +: m_handler(nullptr), + m_keepAliveList(nullptr, 1), + m_aliveList(nullptr, 2), + m_noDataList(nullptr, 1), + m_dataList(nullptr, 2), m_params(params), m_refCount(1), - m_connectionList(NULL), + m_connectionList(nullptr), m_connectionListCount(0), m_socket(INVALID_SOCKET), m_boundAsServer(false), @@ -86,7 +86,7 @@ TcpManager::~TcpManager() close(m_socket); #endif } - while (m_connectionList != NULL) + while (m_connectionList != nullptr) { TcpConnection *con = m_connectionList; m_connectionList = m_connectionList->m_nextConnection; @@ -162,7 +162,7 @@ bool TcpManager::BindAsServer() { struct hostent * lphp; lphp = gethostbyname(m_params.bindAddress); - if (lphp != NULL) + if (lphp != nullptr) addr_loc.sin_addr.s_addr = ((struct in_addr *)(lphp->h_addr))->s_addr; } else @@ -187,7 +187,7 @@ bool TcpManager::BindAsServer() TcpConnection *TcpManager::acceptClient() { - TcpConnection *newConn = NULL; + TcpConnection *newConn = nullptr; if (m_boundAsServer && m_connectionListCount < m_params.maxConnections) { @@ -201,7 +201,7 @@ TcpConnection *TcpManager::acceptClient() { newConn = new TcpConnection(this, &m_allocator, m_params, sock, IPAddress(addr.sin_addr.s_addr), ntohs(addr.sin_port)); addNewConnection(newConn); - if (m_handler != NULL) + if (m_handler != nullptr) { m_handler->OnConnectRequest(newConn); } @@ -226,8 +226,8 @@ SOCKET TcpManager::getMaxFD() if (m_boundAsServer) maxfd = m_socket+1; - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) { next = con->m_nextConnection; if (con->GetStatus() != TcpConnection::StatusDisconnected && con->m_socket > maxfd) @@ -241,8 +241,8 @@ SOCKET TcpManager::getMaxFD() TcpConnection *TcpManager::getConnection(SOCKET fd) { - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) { next = con->m_nextConnection; if (con->m_socket == fd) @@ -251,7 +251,7 @@ TcpConnection *TcpManager::getConnection(SOCKET fd) } } //if get here ,couldn't find it - return NULL; + return nullptr; } bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendTimePerConnection, unsigned maxRecvTimePerConnection) @@ -273,8 +273,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT { // Send output from last heartbeat - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) { con->AddRef(); if (next) next->Release(); @@ -341,7 +341,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT tmpfds = m_permfds; timeout.tv_sec = 0; timeout.tv_usec = 0; - int cnt = select(maxfd, &tmpfds, NULL, NULL, &timeout); // blocks for timeout + int cnt = select(maxfd, &tmpfds, nullptr, nullptr, &timeout); // blocks for timeout if (cnt > 0) @@ -367,8 +367,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //process incoming client messages if (maxRecvTimePerConnection != 0) { - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) { con->AddRef(); if (next) next->Release(); @@ -433,8 +433,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT pollfds[0].events |= POLLIN; } - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next, idx++) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next, idx++) { next = con->m_nextConnection; pollfds[idx].fd = con->m_socket; @@ -474,7 +474,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT } //process regular msg(s) - if (con == NULL) + if (con == nullptr) { close(pollfds[idx].fd); continue; @@ -506,7 +506,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT }//if(pollfds[... else if (pollfds[idx].revents & POLLHUP) { - if (con == NULL) + if (con == nullptr) { close(pollfds[idx].fd); continue; @@ -524,21 +524,21 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //now process any keepalives, if time to do that if (m_params.keepAliveDelay > 0 && m_keepAliveTimer.isDone(m_params.keepAliveDelay)) { - TcpConnection *next = NULL; - for (TcpConnection *con = m_keepAliveList.m_beginList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_keepAliveList.m_beginList ; con != nullptr ; con = next) { con->AddRef(); if (next) next->Release(); next = con->m_nextKeepAliveConnection; if (next) next->AddRef(); - con->Send(NULL, 0); //note: this request will move the connection from the keepAliveList to the aliveList + con->Send(nullptr, 0); //note: this request will move the connection from the keepAliveList to the aliveList con->Release(); } //now move the complete alive list over to the keepalive list to reset those timers m_keepAliveList.m_beginList = m_aliveList.m_beginList; - m_aliveList.m_beginList = NULL; + m_aliveList.m_beginList = nullptr; //switch id's for those connections that were in the alive list last go - around int tmpID = m_aliveList.m_listID; @@ -552,8 +552,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //now process any noDataCons, if time to do that if (m_params.noDataTimeout > 0 && m_noDataTimer.isDone(m_params.noDataTimeout)) { - TcpConnection *next = NULL; - for (TcpConnection *con = m_noDataList.m_beginList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_noDataList.m_beginList ; con != nullptr ; con = next) { con->AddRef(); if (next) next->Release(); @@ -567,7 +567,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //now move the complete data list over to the nodata list to reset those timers m_noDataList.m_beginList = m_dataList.m_beginList; - m_dataList.m_beginList = NULL; + m_dataList.m_beginList = nullptr; //switch id's for those connections that were in the data list last go - around int tmpID = m_dataList.m_listID; @@ -589,11 +589,11 @@ TcpConnection *TcpManager::EstablishConnection(const char *serverAddress, unsign { //can't open outgoing connections when in server mode // use a different TcpManager to do that - return NULL; + return nullptr; } if (m_connectionListCount >= m_params.maxConnections) - return(NULL); + return(nullptr); // get server address unsigned long address = inet_addr(serverAddress); @@ -601,8 +601,8 @@ TcpConnection *TcpManager::EstablishConnection(const char *serverAddress, unsign { struct hostent * lphp; lphp = gethostbyname(serverAddress); - if (lphp == NULL) - return(NULL); + if (lphp == nullptr) + return(nullptr); address = ((struct in_addr *)(lphp->h_addr))->s_addr; } IPAddress destIP(address); @@ -622,22 +622,22 @@ void TcpManager::addNewConnection(TcpConnection *con) FD_SET(con->m_socket, &m_permfds); #endif con->m_nextConnection = m_connectionList; - con->m_prevConnection = NULL; - if (m_connectionList != NULL) + con->m_prevConnection = nullptr; + if (m_connectionList != nullptr) m_connectionList->m_prevConnection = con; m_connectionList = con; m_connectionListCount++; con->m_nextKeepAliveConnection = m_aliveList.m_beginList; - con->m_prevKeepAliveConnection = NULL; - if (m_aliveList.m_beginList != NULL) + con->m_prevKeepAliveConnection = nullptr; + if (m_aliveList.m_beginList != nullptr) m_aliveList.m_beginList->m_prevKeepAliveConnection = con; m_aliveList.m_beginList = con; con->m_aliveListId = m_keepAliveList.m_listID;//start it out thinking it's already in the alive list, since it is con->m_nextRecvDataConnection = m_dataList.m_beginList; - con->m_prevRecvDataConnection = NULL; - if (m_dataList.m_beginList != NULL) + con->m_prevRecvDataConnection = nullptr; + if (m_dataList.m_beginList != nullptr) m_dataList.m_beginList->m_prevRecvDataConnection = con; m_dataList.m_beginList = con; con->m_recvDataListId = m_noDataList.m_listID;//start it out thinking it's already in the data list, since it is @@ -655,40 +655,40 @@ void TcpManager::removeConnection(TcpConnection *con) FD_CLR(con->m_socket, &m_permfds); } #endif - if (con->m_prevConnection != NULL) + if (con->m_prevConnection != nullptr) con->m_prevConnection->m_nextConnection = con->m_nextConnection; - if (con->m_nextConnection != NULL) + if (con->m_nextConnection != nullptr) con->m_nextConnection->m_prevConnection = con->m_prevConnection; if (m_connectionList == con) m_connectionList = con->m_nextConnection; - con->m_nextConnection = NULL; - con->m_prevConnection = NULL; + con->m_nextConnection = nullptr; + con->m_prevConnection = nullptr; - if (con->m_prevKeepAliveConnection != NULL) + if (con->m_prevKeepAliveConnection != nullptr) con->m_prevKeepAliveConnection->m_nextKeepAliveConnection = con->m_nextKeepAliveConnection; - if (con->m_nextKeepAliveConnection != NULL) + if (con->m_nextKeepAliveConnection != nullptr) con->m_nextKeepAliveConnection->m_prevKeepAliveConnection = con->m_prevKeepAliveConnection; if (m_aliveList.m_beginList == con) m_aliveList.m_beginList = con->m_nextKeepAliveConnection; else if (m_keepAliveList.m_beginList == con) m_keepAliveList.m_beginList = con->m_nextKeepAliveConnection; - con->m_nextKeepAliveConnection = NULL; - con->m_prevKeepAliveConnection = NULL; + con->m_nextKeepAliveConnection = nullptr; + con->m_prevKeepAliveConnection = nullptr; - if (con->m_prevRecvDataConnection != NULL) + if (con->m_prevRecvDataConnection != nullptr) con->m_prevRecvDataConnection->m_nextRecvDataConnection = con->m_nextRecvDataConnection; - if (con->m_nextRecvDataConnection != NULL) + if (con->m_nextRecvDataConnection != nullptr) con->m_nextRecvDataConnection->m_prevRecvDataConnection = con->m_prevRecvDataConnection; if (m_dataList.m_beginList == con) m_dataList.m_beginList = con->m_nextRecvDataConnection; else if (m_noDataList.m_beginList == con) m_noDataList.m_beginList = con->m_nextRecvDataConnection; - con->m_nextRecvDataConnection = NULL; - con->m_prevRecvDataConnection = NULL; + con->m_nextRecvDataConnection = nullptr; + con->m_prevRecvDataConnection = nullptr; diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpManager.h b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpManager.h index 75eb6df4..c4e8b1cf 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpManager.h +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpManager.h @@ -156,7 +156,7 @@ public: * simply need to derive your class (multiply if necessary) from TcpManagerHandler, then you can use * this method to set the object the TcpManager will call as appropriate. The TcpConnection object * also has a handler mechanism that replaces the other callback functions below, see TcpConnection::SetHandler - * default = NULL (no callbacks made) + * default = nullptr (no callbacks made) * * @param handler The object which will be called for manager related notifications. */ @@ -211,7 +211,7 @@ public: * the connect-complete callback to be called if the connection is succesfull. * * @return A pointer to a TcpConnection object. - * NULL if the manager object has exceeded its maximum number of connections + * nullptr if the manager object has exceeded its maximum number of connections * or if the serverAddress cannot be resolved to an IP address. */ TcpConnection *EstablishConnection(const char *serverAddress, unsigned short serverPort, unsigned timeout = 0); diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/TestClient/Main.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/TestClient/Main.cpp index eb7a09ab..188be18e 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/TestClient/Main.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/TestClient/Main.cpp @@ -10,7 +10,7 @@ using namespace CTService; unsigned openRequests = 0; -CTServiceAPI *waitclient = NULL; +CTServiceAPI *waitclient = nullptr; std::map m_tests; std::string game_code; diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/Unicode/UnicodeCharacterDataMap.h b/external/3rd/library/soePlatform/CTServiceGameAPI/Unicode/UnicodeCharacterDataMap.h index 741a6e80..493c5a2d 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/Unicode/UnicodeCharacterDataMap.h +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/Unicode/UnicodeCharacterDataMap.h @@ -122,7 +122,7 @@ namespace Plat_Unicode /** * Find a CharData for the given code point. - * @return null if no CharData exists for this code point + * @return nullptr if no CharData exists for this code point */ inline const CharData * CharDataMap::findCharData (const unicode_char_t code) const diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/test/main.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/test/main.cpp index 4f91d382..e24b265e 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/test/main.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/test/main.cpp @@ -135,7 +135,7 @@ namespace CTService const char *game, const char *param) { - printf("onServerTest(%u, %s, %s)\n", server_track, game ? game : "(null)", param ? param : "(null)"); + printf("onServerTest(%u, %s, %s)\n", server_track, game ? game : "(nullptr)", param ? param : "(nullptr)"); replyTest(server_track, 999, 0); } diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/AvatarIteratorCore.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/AvatarIteratorCore.cpp index 3786718c..9548bc9f 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/AvatarIteratorCore.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/AvatarIteratorCore.cpp @@ -9,7 +9,7 @@ namespace ChatSystem // AVATAR ITERATOR CORE AvatarIteratorCore::AvatarIteratorCore() -: m_map(NULL) +: m_map(nullptr) { } @@ -33,7 +33,7 @@ AvatarIteratorCore &AvatarIteratorCore::operator=(const AvatarIteratorCore& rhs) ChatAvatar *AvatarIteratorCore::getCurAvatar() { - ChatAvatar *returnVal = NULL; + ChatAvatar *returnVal = nullptr; if (!outOfBounds()) { @@ -87,7 +87,7 @@ bool AvatarIteratorCore::outOfBounds() // MODERATOR ITERATOR CORE ModeratorIteratorCore::ModeratorIteratorCore() -: m_set(NULL) +: m_set(nullptr) { } @@ -111,7 +111,7 @@ ModeratorIteratorCore &ModeratorIteratorCore::operator=(const ModeratorIteratorC ChatAvatar *ModeratorIteratorCore::getCurAvatar() { - ChatAvatar *returnVal = NULL; + ChatAvatar *returnVal = nullptr; if (!outOfBounds()) { @@ -165,7 +165,7 @@ bool ModeratorIteratorCore::outOfBounds() // TEMPORARY MODERATOR ITERATOR CORE TemporaryModeratorIteratorCore::TemporaryModeratorIteratorCore() -: m_set(NULL) +: m_set(nullptr) { } @@ -189,7 +189,7 @@ TemporaryModeratorIteratorCore &TemporaryModeratorIteratorCore::operator=(const ChatAvatar *TemporaryModeratorIteratorCore::getCurAvatar() { - ChatAvatar *returnVal = NULL; + ChatAvatar *returnVal = nullptr; if (!outOfBounds()) { @@ -243,7 +243,7 @@ bool TemporaryModeratorIteratorCore::outOfBounds() // VOICE ITERATOR CORE VoiceIteratorCore::VoiceIteratorCore() -: m_set(NULL) +: m_set(nullptr) { } @@ -267,7 +267,7 @@ VoiceIteratorCore &VoiceIteratorCore::operator=(const VoiceIteratorCore& rhs) ChatAvatar *VoiceIteratorCore::getCurAvatar() { - ChatAvatar *returnVal = NULL; + ChatAvatar *returnVal = nullptr; if (!outOfBounds()) { @@ -321,7 +321,7 @@ bool VoiceIteratorCore::outOfBounds() // INVITE ITERATOR CORE InviteIteratorCore::InviteIteratorCore() -: m_set(NULL) +: m_set(nullptr) { } @@ -345,7 +345,7 @@ InviteIteratorCore &InviteIteratorCore::operator=(const InviteIteratorCore& rhs) ChatAvatar *InviteIteratorCore::getCurAvatar() { - ChatAvatar *returnVal = NULL; + ChatAvatar *returnVal = nullptr; if (!outOfBounds()) { @@ -399,7 +399,7 @@ bool InviteIteratorCore::outOfBounds() // BAN ITERATOR CORE BanIteratorCore::BanIteratorCore() -: m_set(NULL) +: m_set(nullptr) { } @@ -423,7 +423,7 @@ BanIteratorCore &BanIteratorCore::operator=(const BanIteratorCore& rhs) ChatAvatar *BanIteratorCore::getCurAvatar() { - ChatAvatar *returnVal = NULL; + ChatAvatar *returnVal = nullptr; if (!outOfBounds()) { diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/AvatarListItemCore.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/AvatarListItemCore.cpp index 15e9af48..6bbc82e9 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/AvatarListItemCore.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/AvatarListItemCore.cpp @@ -7,7 +7,7 @@ namespace ChatSystem using namespace Plat_Unicode; AvatarListItem::AvatarListItem() - : m_core(NULL) + : m_core(nullptr) { } @@ -16,7 +16,7 @@ namespace ChatSystem } AvatarListItemCore::AvatarListItemCore() - : m_interface(NULL) + : m_interface(nullptr) { } diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPI.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPI.cpp index 021afd5d..9b1e1cd0 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPI.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPI.cpp @@ -13,7 +13,7 @@ namespace ChatSystem { ChatAPI::ChatAPI(const char *registrar_host, short registrar_port, const char *server_host, short server_port) -: m_defaultRoomParams(NULL), +: m_defaultRoomParams(nullptr), m_defaultLoginPriority(0), m_defaultEntryType(false) { @@ -25,13 +25,13 @@ ChatAPI::ChatAPI(const char *registrar_host, short registrar_port, const char *s ChatAPI::~ChatAPI() { delete m_defaultRoomParams; - m_defaultRoomParams = NULL; + m_defaultRoomParams = nullptr; delete m_core; - m_core = NULL; + m_core = nullptr; } ChatAPI::ChatAPI(ChatAPICore *core) -: m_defaultRoomParams(NULL) +: m_defaultRoomParams(nullptr) { m_core = core; m_core->setAPI(this); @@ -721,7 +721,7 @@ void ChatAPI::setDefaultRoomParams(RoomParams *roomParams) { if (roomParams) { - if (m_defaultRoomParams == NULL) + if (m_defaultRoomParams == nullptr) { m_defaultRoomParams = new RoomParams; } @@ -732,7 +732,7 @@ void ChatAPI::setDefaultRoomParams(RoomParams *roomParams) else { delete m_defaultRoomParams; - m_defaultRoomParams = NULL; + m_defaultRoomParams = nullptr; } } void ChatAPI::setDefaultLoginLocation(const ChatUnicodeString &defaultLoginLocation) diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPI.h b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPI.h index 00533e05..0d255ca2 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPI.h +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPI.h @@ -105,7 +105,7 @@ namespace ChatSystem // will be connected to, as well as the hostname and port of the Registrar // ChatServer (which will automatically reroute the ChatAPI connection to // a hotspare ChatServer if the provided choice is unavailable). - // NULL pointers are NOT valid input. + // nullptr pointers are NOT valid input. ChatAPI(const char *registrar_host, short registrar_port, const char *server_host, short server_port); virtual ~ChatAPI(); @@ -209,7 +209,7 @@ namespace ChatSystem // getAvatar // Requests immediate return of a ChatAvatar object that this API // has cached due to a RequestLoginAvatar. Request does not go - // to ChatServer. Returns NULL if API does not have object locally. + // to ChatServer. Returns nullptr if API does not have object locally. ChatAvatar *getAvatar(const ChatUnicodeString &avatarName, const ChatUnicodeString &avatarAddress); ChatAvatar *getAvatar(unsigned avatarID); @@ -286,7 +286,7 @@ namespace ChatSystem // Requests immediate return of a ChatRoom object that this API // has cached due to a RequestGetRoom, RequestCreateRoom, or // RequestEnterRoom. Request does not go to ChatServer. Returns - // NULL if API does not have object locally. + // nullptr if API does not have object locally. ChatRoom *getRoom(const ChatUnicodeString &roomAddress); ChatRoom *getRoom(unsigned roomID); @@ -298,13 +298,13 @@ namespace ChatSystem // getDefaultRoomParams // Requests the ChatAPI's current default RoomParams object. Used for - // the EnterRoom call. If NULL, EnterRoom will not do passive room + // the EnterRoom call. If nullptr, EnterRoom will not do passive room // creation if the room to enter does not yet exist. Initial value - // is NULL (no RoomParams object defined). + // is nullptr (no RoomParams object defined). const RoomParams *getDefaultRoomParams(void); // setDefaultRoomParams - // Sets the ChatAPI's current default RoomParams object. Passing a NULL + // Sets the ChatAPI's current default RoomParams object. Passing a nullptr // pointer will cause the default params not to be used by EnterRoom. void setDefaultRoomParams(RoomParams *roomParams); diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPICore.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPICore.cpp index 5724a68f..99cfe621 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPICore.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPICore.cpp @@ -67,7 +67,7 @@ const char * const ChatAPICore::ms_errorStringsEnglish[] = "UID node already exists", "Wrong chat server for request", "Succeeded, but local data is invalid", - "Login with null name", + "Login with nullptr name", "No server assigned to this identity", // 45 "Another server already assumed this identity", "Remote server is down", @@ -82,9 +82,9 @@ const char * const ChatAPICore::ms_errorStringsEnglish[] = "Duplicate voice", "Chat avatar must first be logged out", "No work to do", - "Cannot perform rename to NULL avatar name", + "Cannot perform rename to nullptr avatar name", "Cannot perform station acct transfer to stationID = 0", // 60 - "Cannot perform avatar move to NULL avatar address", + "Cannot perform avatar move to nullptr avatar address", "Failed to obtain an ID for a new room or avatar", "Room is local to namespace/world; cannot enter from other worlds", "Room is local to game; cannot enter from other game namespaces", @@ -122,7 +122,7 @@ ChatAPICore::ChatAPICore(const char *registrar_host, short registrar_port, const m_registrarPort(registrar_port), m_defaultServerPort(server_port), m_assignedServerPort(server_port), - m_timeSinceLastDisconnect(time(NULL)), + m_timeSinceLastDisconnect(time(nullptr)), m_rcvdRegistrarResponse(false), m_shouldSendVersion(true) { @@ -132,7 +132,7 @@ ChatAPICore::ChatAPICore(const char *registrar_host, short registrar_port, const ChatAPICore::~ChatAPICore() { - m_api = NULL; + m_api = nullptr; std::map::iterator iter = m_avatarCoreCache.begin(); for (; iter != m_avatarCoreCache.end(); ++iter) @@ -209,7 +209,7 @@ void ChatAPICore::cacheAvatar(ChatAvatarCore *avatarCore) ChatAvatarCore *ChatAPICore::getAvatarCore(unsigned avatarID) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; std::map::iterator iter = m_avatarCoreCache.find(avatarID); if(iter != m_avatarCoreCache.end()) @@ -221,7 +221,7 @@ ChatAvatarCore *ChatAPICore::getAvatarCore(unsigned avatarID) ChatAvatar *ChatAPICore::getAvatar(unsigned avatarID) { - ChatAvatar *returnAvatar = NULL; + ChatAvatar *returnAvatar = nullptr; std::map::iterator iter = m_avatarCache.find(avatarID); if(iter != m_avatarCache.end()) @@ -233,7 +233,7 @@ ChatAvatar *ChatAPICore::getAvatar(unsigned avatarID) ChatAvatarCore *ChatAPICore::decacheAvatar(unsigned avatarID) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; std::map::iterator iterCore = m_avatarCoreCache.find(avatarID); if(iterCore != m_avatarCoreCache.end()) { @@ -267,7 +267,7 @@ void ChatAPICore::cacheRoom(ChatRoomCore *roomCore) ChatRoomCore *ChatAPICore::getRoomCore(unsigned roomID) { - ChatRoomCore *returnRoom = NULL; + ChatRoomCore *returnRoom = nullptr; std::map::iterator iter = m_roomCoreCache.find(roomID); if(iter != m_roomCoreCache.end()) { @@ -279,7 +279,7 @@ ChatRoomCore *ChatAPICore::getRoomCore(unsigned roomID) ChatRoom *ChatAPICore::getRoom(unsigned roomID) { - ChatRoom *returnRoom = NULL; + ChatRoom *returnRoom = nullptr; std::map::iterator iter = m_roomCache.find(roomID); if(iter != m_roomCache.end()) { @@ -291,7 +291,7 @@ ChatRoom *ChatAPICore::getRoom(unsigned roomID) ChatRoomCore *ChatAPICore::decacheRoom(unsigned roomID) { - ChatRoomCore *returnRoom = NULL; + ChatRoomCore *returnRoom = nullptr; std::map::iterator iterCore = m_roomCoreCache.find(roomID); if(iterCore != m_roomCoreCache.end()) @@ -315,7 +315,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_LOGINAVATAR: { ResLoginAvatar *R = static_cast(res); - ChatAvatar *avatar = NULL; + ChatAvatar *avatar = nullptr; if(R->getAvatar()) { @@ -338,7 +338,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_TEMPORARYAVATAR: { ResTemporaryAvatar* R = static_cast(res); - ChatAvatar* avatar = NULL; + ChatAvatar* avatar = nullptr; if ( R->getAvatar() ) { @@ -394,8 +394,8 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_GETAVATAR: { ResGetAvatar *R = static_cast(res); - ChatAvatar *cachedAvatar = NULL; - ChatAvatar *avatar = NULL; + ChatAvatar *cachedAvatar = nullptr; + ChatAvatar *avatar = nullptr; ChatAvatarCore *avatarCore = R->getAvatar(); if (R->getResult() == 0 && avatarCore) // if success @@ -403,7 +403,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) // attempt to return locally cached avatar, if available cachedAvatar = getAvatar(avatarCore->getAvatarID()); - if (cachedAvatar != NULL) + if (cachedAvatar != nullptr) { // update cached information with returned data cachedAvatar->setAttributes(avatarCore->getAttributes()); @@ -427,7 +427,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) m_api->OnGetAvatar(R->getTrack(), R->getResult(), avatar, R->getUser()); - if (cachedAvatar == NULL) + if (cachedAvatar == nullptr) { delete avatar; } @@ -438,8 +438,8 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_GETANYAVATAR: { ResGetAnyAvatar *R = static_cast(res); - ChatAvatar *cachedAvatar = NULL; - ChatAvatar *avatar = NULL; + ChatAvatar *cachedAvatar = nullptr; + ChatAvatar *avatar = nullptr; ChatAvatarCore *avatarCore = R->getAvatar(); if (R->getResult() == 0 && avatarCore) // if success @@ -447,7 +447,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) // attempt to return locally cached avatar, if available cachedAvatar = getAvatar(avatarCore->getAvatarID()); - if (cachedAvatar != NULL) + if (cachedAvatar != nullptr) { // update cached information with returned data cachedAvatar->setAttributes(avatarCore->getAttributes()); @@ -471,7 +471,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) m_api->OnGetAnyAvatar(R->getTrack(), R->getResult(), avatar, R->isLoggedIn(), R->getUser()); - if (cachedAvatar == NULL) + if (cachedAvatar == nullptr) { delete avatar; } @@ -490,8 +490,8 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_SETAVATARATTRIBUTES: { ResSetAvatarAttributes *R = static_cast(res); - ChatAvatar *cachedAvatar = NULL; - ChatAvatar *avatar = NULL; + ChatAvatar *cachedAvatar = nullptr; + ChatAvatar *avatar = nullptr; ChatAvatarCore *avatarCore = R->getAvatar(); if (R->getResult() == 0 && avatarCore) // if success @@ -502,14 +502,14 @@ void ChatAPICore::responseCallback(GenericResponse *res) // attempt to return locally cached avatar, if available cachedAvatar = getAvatar(avatar->getAvatarID()); - if (cachedAvatar != NULL) + if (cachedAvatar != nullptr) { cachedAvatar->setAttributes(avatar->getAttributes()); } } } - if (cachedAvatar != NULL) + if (cachedAvatar != nullptr) { cachedAvatar = avatar; m_api->OnSetAvatarAttributes(R->getTrack(), R->getResult(), cachedAvatar, R->getUser()); @@ -531,8 +531,8 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_SETSTATUSMESSAGE: { ResSetAvatarStatusMessage *R = static_cast(res); - ChatAvatar *cachedAvatar = NULL; - ChatAvatar *avatar = NULL; + ChatAvatar *cachedAvatar = nullptr; + ChatAvatar *avatar = nullptr; ChatAvatarCore *avatarCore = R->getAvatar(); if (R->getResult() == 0 && avatarCore) // if success @@ -543,14 +543,14 @@ void ChatAPICore::responseCallback(GenericResponse *res) // attempt to return locally cached avatar, if available cachedAvatar = getAvatar(avatar->getAvatarID()); - if (cachedAvatar != NULL) + if (cachedAvatar != nullptr) { cachedAvatar->setStatusMessage(avatar->getStatusMessage()); } } } - if (cachedAvatar != NULL) + if (cachedAvatar != nullptr) { cachedAvatar = avatar; m_api->OnSetAvatarStatusMessage(R->getTrack(), R->getResult(), cachedAvatar, R->getUser()); @@ -572,8 +572,8 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_SETAVATAREMAIL: { ResSetAvatarForwardingEmail*R = static_cast(res); - ChatAvatar *cachedAvatar = NULL; - ChatAvatar *avatar = NULL; + ChatAvatar *cachedAvatar = nullptr; + ChatAvatar *avatar = nullptr; ChatAvatarCore *avatarCore = R->getAvatar(); if (R->getResult() == 0 && avatarCore) // if success @@ -584,14 +584,14 @@ void ChatAPICore::responseCallback(GenericResponse *res) // attempt to return locally cached avatar, if available cachedAvatar = getAvatar(avatar->getAvatarID()); - if (cachedAvatar != NULL) + if (cachedAvatar != nullptr) { cachedAvatar->setForwardingEmail(avatar->getForwardingEmail()); } } } - if (cachedAvatar != NULL) + if (cachedAvatar != nullptr) { cachedAvatar = avatar; m_api->OnSetAvatarForwardingEmail(R->getTrack(), R->getResult(), cachedAvatar, R->getUser()); @@ -613,8 +613,8 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_SETAVATARINBOXLIMIT: { ResSetAvatarInboxLimit *R = static_cast(res); - ChatAvatar *cachedAvatar = NULL; - ChatAvatar *avatar = NULL; + ChatAvatar *cachedAvatar = nullptr; + ChatAvatar *avatar = nullptr; ChatAvatarCore *avatarCore = R->getAvatar(); if (R->getResult() == 0 && avatarCore) // if success @@ -625,14 +625,14 @@ void ChatAPICore::responseCallback(GenericResponse *res) // attempt to return locally cached avatar, if available cachedAvatar = getAvatar(avatar->getAvatarID()); - if (cachedAvatar != NULL) + if (cachedAvatar != nullptr) { cachedAvatar->setInboxLimit(avatar->getInboxLimit()); } } } - if (cachedAvatar != NULL) + if (cachedAvatar != nullptr) { cachedAvatar = avatar; m_api->OnSetAvatarInboxLimit(R->getTrack(), R->getResult(), cachedAvatar, R->getUser()); @@ -654,13 +654,13 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_GETROOM: { ResGetRoom *R = static_cast(res); - ChatRoom *room = NULL; + ChatRoom *room = nullptr; ChatRoomCore *roomCore = R->getRoom(); if (R->getResult() == 0 && roomCore) // if success { unsigned roomid = roomCore->getRoomID(); - if (getRoomCore(roomid) == NULL) + if (getRoomCore(roomid) == nullptr) { // we need to cache this room first cacheRoom(roomCore); @@ -708,8 +708,8 @@ void ChatAPICore::responseCallback(GenericResponse *res) { ResCreateRoom *R = static_cast(res); - ChatRoom *room = NULL; - ChatRoomCore* roomCore = NULL; + ChatRoom *room = nullptr; + ChatRoomCore* roomCore = nullptr; if (R->getResult() == 0) // if success { @@ -939,7 +939,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) else if (!room && !roomCore) { // we didn't have room cached, and we didn't get one to cache, - // thus we'll have trouble giving a callback with a NULL pointer. + // thus we'll have trouble giving a callback with a nullptr pointer. _chatdebug_("ChatAPI:BadData: RESPONSE_ENTERROOM: avatar=%p, room=%p , roomCore=%p\n", avatar, room, roomCore); } } @@ -1175,8 +1175,8 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_FINDAVATARBYUID: { ResFindAvatarByUID *R = static_cast(res); - ChatAvatar **avatarMatches = NULL; - ChatAvatarCore **avatarCoreMatches = NULL; + ChatAvatar **avatarMatches = nullptr; + ChatAvatarCore **avatarCoreMatches = nullptr; unsigned numAvatarsOnline = R->getNumAvatarsOnline(); @@ -1374,7 +1374,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) // duplicate login from this API, then effectively // our API must consider him logged out because he's now // no longer logged in to his AID controller. - m_api->OnLogoutAvatar(0, 0, avatar, NULL); + m_api->OnLogoutAvatar(0, 0, avatar, nullptr); } } @@ -1476,7 +1476,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_GETAVATARKEYWORDS: { ResGetAvatarKeywords *R = static_cast(res); - ChatAvatar *avatar = NULL; + ChatAvatar *avatar = nullptr; if(R->getResult() == CHATRESULT_SUCCESS) { @@ -1494,7 +1494,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_SETAVATARKEYWORDS: { ResSetAvatarKeywords *R = static_cast(res); - ChatAvatar *avatar = NULL; + ChatAvatar *avatar = nullptr; if(R->getResult() == CHATRESULT_SUCCESS) { avatar = getAvatar(R->getAvatarID()); @@ -1510,8 +1510,8 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_SEARCHAVATARKEYWORDS: { ResSearchAvatarKeywords *R = static_cast(res); - ChatAvatar **avatarMatches = NULL; - ChatAvatarCore **avatarCoreMatches = NULL; + ChatAvatar **avatarMatches = nullptr; + ChatAvatarCore **avatarCoreMatches = nullptr; if(R->getResult() == CHATRESULT_SUCCESS) { @@ -1530,7 +1530,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_CONFIRMFRIEND: { ResFriendConfirm *R = static_cast(res); - ChatAvatar *avatar = NULL; + ChatAvatar *avatar = nullptr; if(R->getResult() == CHATRESULT_SUCCESS) { avatar = getAvatar(R->getAvatarID()); @@ -1546,7 +1546,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_CONFIRMFRIEND_RECIPROCATE: { ResFriendConfirmReciprocate *R = static_cast(res); - ChatAvatar *avatar = NULL; + ChatAvatar *avatar = nullptr; if(R->getResult() == CHATRESULT_SUCCESS) { avatar = getAvatar(R->getAvatarID()); @@ -1616,7 +1616,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_ADDSNOOPAVATAR: { ResAddSnoopAvatar *R = static_cast(res); - ChatAvatar *avatar = NULL; + ChatAvatar *avatar = nullptr; if(R->getResult() == CHATRESULT_SUCCESS) { avatar = getAvatar(R->getSrcAvatarID()); @@ -1632,7 +1632,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_REMOVESNOOPAVATAR: { ResRemoveSnoopAvatar *R = static_cast(res); - ChatAvatar *avatar = NULL; + ChatAvatar *avatar = nullptr; if(R->getResult() == CHATRESULT_SUCCESS) { avatar = getAvatar(R->getSrcAvatarID()); @@ -1648,7 +1648,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_ADDSNOOPROOM: { ResAddSnoopRoom *R = static_cast(res); - ChatAvatar *avatar = NULL; + ChatAvatar *avatar = nullptr; if(R->getResult() == CHATRESULT_SUCCESS) { avatar = getAvatar(R->getSrcAvatarID()); @@ -1664,7 +1664,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_REMOVESNOOPROOM: { ResRemoveSnoopRoom *R = static_cast(res); - ChatAvatar *avatar = NULL; + ChatAvatar *avatar = nullptr; if(R->getResult() == CHATRESULT_SUCCESS) { avatar = getAvatar(R->getSrcAvatarID()); @@ -1680,7 +1680,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_GETSNOOPLIST: { ResGetSnoopList *R = static_cast(res); - ChatAvatar *avatar = NULL; + ChatAvatar *avatar = nullptr; if(R->getResult() == CHATRESULT_SUCCESS) { avatar = getAvatar(R->getSrcAvatarID()); @@ -1691,8 +1691,8 @@ void ChatAPICore::responseCallback(GenericResponse *res) _chatdebug_("ChatAPI:BadData: RESPONSE_REMOVESNOOPROOM: avatar=%p\n", avatar); } - AvatarSnoopPair **avatarList = NULL; - ChatUnicodeString **roomList = NULL; + AvatarSnoopPair **avatarList = nullptr; + ChatUnicodeString **roomList = nullptr; unsigned numAvatars = R->getAvatarSnoopListLength(); unsigned numRooms = R->getRoomSnoopListLength(); @@ -1763,7 +1763,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) ChatAvatar *destAvatar = getAvatar(M.getDestList()[i]); if (!destAvatar) { - _chatdebug_("ChatAPI:BadData: MESSAGE_ROOMMESSAGE: destAvatar[%i]=NULL\n", i); + _chatdebug_("ChatAPI:BadData: MESSAGE_ROOMMESSAGE: destAvatar[%i]=nullptr\n", i); continue; } m_api->OnReceiveRoomMessage(srcAvatar, destAvatar, destRoom, ChatUnicodeString(M.getMsg().data(), M.getMsg().size()), ChatUnicodeString(M.getOOB().data(), M.getOOB().size())); @@ -1797,7 +1797,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) ChatAvatar *destAvatar = getAvatar(M.getDestList()[i]); if (!destAvatar) { - _chatdebug_("ChatAPI:BadData: MESSAGE_BROADCASTMESSAGE: destAvatar[%i]=NULL\n", i); + _chatdebug_("ChatAPI:BadData: MESSAGE_BROADCASTMESSAGE: destAvatar[%i]=nullptr\n", i); continue; } m_api->OnReceiveBroadcastMessage(srcAvatar, ChatUnicodeString(M.getSrcAddress().data(), M.getSrcAddress().size()), destAvatar, ChatUnicodeString(M.getMsg().data(), M.getMsg().size()), ChatUnicodeString(M.getOOB().data(), M.getOOB().size())); @@ -1877,7 +1877,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) ChatRoomCore *destRoomCore = getRoomCore(M.getRoomID()); if (!destRoomCore) { - _chatdebug_("ChatAPI:destroomCore is null!"); + _chatdebug_("ChatAPI:destroomCore is nullptr!"); break; } @@ -1889,7 +1889,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) ChatAvatar *destAvatar = M.getDestAvatar()->getNewChatAvatar(); ChatAvatar *srcAvatar = M.getSrcAvatar()->getNewChatAvatar(); - ChatAvatarCore *kickedAvatar = destRoomCore ? destRoomCore->removeAvatar(destAvatar->getAvatarID()) : NULL; + ChatAvatarCore *kickedAvatar = destRoomCore ? destRoomCore->removeAvatar(destAvatar->getAvatarID()) : nullptr; ChatRoom *destRoom = getRoom(M.getRoomID()); if (!srcAvatar || !destAvatar || !kickedAvatar || !destRoom) @@ -2439,12 +2439,12 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) ChatAvatar *srcAvatar = M.getSrcAvatar()->getNewChatAvatar(); if (!srcAvatar) { - _chatdebug_("ChatAPI:BadData: MESSAGE_ENTERROOM: srcAvatar=NULL\n"); + _chatdebug_("ChatAPI:BadData: MESSAGE_ENTERROOM: srcAvatar=nullptr\n"); delete M.getSrcAvatar(); break; } - bool isLocalAvatar = (getAvatar(srcAvatar->getAvatarID()) != NULL); + bool isLocalAvatar = (getAvatar(srcAvatar->getAvatarID()) != nullptr); if(!destRoomCore->addAvatar(M.getSrcAvatar(),isLocalAvatar)) { delete M.getSrcAvatar(); @@ -2492,10 +2492,10 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) if (destRoomCore) { ChatRoom *destRoom = getRoom(M.getRoomID()); - ChatAvatar *srcAvatar = NULL; + ChatAvatar *srcAvatar = nullptr; if (!M.getSrcAvatar()) { - _chatdebug_("ChatAPI:BadData: MESSAGE_DESTROYROOM: M.getSrcAvatar=NULL\n"); + _chatdebug_("ChatAPI:BadData: MESSAGE_DESTROYROOM: M.getSrcAvatar=nullptr\n"); } else { @@ -2527,7 +2527,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) ChatRoomCore *destRoomCore = getRoomCore(M.getRoomID()); if (!destRoomCore) { - _chatdebug_("ChatAPI:BadData: MESSAGE_SETROOMPARAMS: destRoomCore=NULL\n"); + _chatdebug_("ChatAPI:BadData: MESSAGE_SETROOMPARAMS: destRoomCore=nullptr\n"); break; } @@ -2544,7 +2544,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) if (!M.getSrcAvatar()) { - _chatdebug_("ChatAPI:BadData: MESSAGE_SETROOMPARAMS: M.getSrcAvatar=NULL\n"); + _chatdebug_("ChatAPI:BadData: MESSAGE_SETROOMPARAMS: M.getSrcAvatar=nullptr\n"); break; } ChatAvatar *srcAvatar = M.getSrcAvatar()->getNewChatAvatar(); @@ -2686,7 +2686,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) { MAddAdmin M(iter); ChatRoomCore *destRoomCore = getRoomCore(M.getRoomID()); - if (destRoomCore && (destRoomCore->addAdministrator(M.getAvatar()) == NULL)) + if (destRoomCore && (destRoomCore->addAdministrator(M.getAvatar()) == nullptr)) { delete (M.getAvatar()); } @@ -2696,7 +2696,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) { MRemoveAdmin M(iter); ChatRoomCore *destRoomCore = getRoomCore(M.getRoomID()); - ChatAvatarCore *admin = NULL; + ChatAvatarCore *admin = nullptr; if (destRoomCore) admin = destRoomCore->removeAdministrator(M.getAvatarID()); delete admin; @@ -2707,7 +2707,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) MFriendConfirmRequest M(iter); if (!M.getSrcAvatar()) { - _chatdebug_("ChatAPI:BadData: MESSAGE_FRIENDCONFIRMREQUEST: M.getSrcAvatar=NULL\n"); + _chatdebug_("ChatAPI:BadData: MESSAGE_FRIENDCONFIRMREQUEST: M.getSrcAvatar=nullptr\n"); break; } ChatAvatar *srcAvatar = M.getSrcAvatar()->getNewChatAvatar(); @@ -2730,7 +2730,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) if (!M.getSrcAvatar()) { - _chatdebug_("ChatAPI:BadData: MESSAGE_FRIENDCONFIRMRESPONSE: M.getSrcAvatar=NULL\n"); + _chatdebug_("ChatAPI:BadData: MESSAGE_FRIENDCONFIRMRESPONSE: M.getSrcAvatar=nullptr\n"); break; } ChatAvatar *srcAvatar = M.getSrcAvatar()->getNewChatAvatar(); @@ -2752,7 +2752,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) MFriendConfirmReciprocateRequest M(iter); if (!M.getSrcAvatar()) { - _chatdebug_("ChatAPI:BadData: MESSAGE_FRIENDCONFIRMRECIPROCATE_REQUEST: M.getSrcAvatar=NULL\n"); + _chatdebug_("ChatAPI:BadData: MESSAGE_FRIENDCONFIRMRECIPROCATE_REQUEST: M.getSrcAvatar=nullptr\n"); break; } ChatAvatar *srcAvatar = M.getSrcAvatar()->getNewChatAvatar(); @@ -2775,7 +2775,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) if (!M.getSrcAvatar()) { - _chatdebug_("ChatAPI:BadData: MESSAGE_FRIENDCONFIRMRECIPROCATE_RESPONSE: M.getSrcAvatar=NULL\n"); + _chatdebug_("ChatAPI:BadData: MESSAGE_FRIENDCONFIRMRECIPROCATE_RESPONSE: M.getSrcAvatar=nullptr\n"); break; } ChatAvatar *srcAvatar = M.getSrcAvatar()->getNewChatAvatar(); @@ -2799,7 +2799,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) ChatRoomCore *destRoomCore = getRoomCore(M.getDestRoomID()); if (!destRoomCore) { - _chatdebug_("ChatAPI:BadData: MESSAGE_CHANGEROOMOWNER: destRoomCore=NULL\n"); + _chatdebug_("ChatAPI:BadData: MESSAGE_CHANGEROOMOWNER: destRoomCore=nullptr\n"); break; } @@ -2822,7 +2822,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) if (!M.getRequestorAvatar()) { - _chatdebug_("ChatAPI:BadData: MESSAGE_REQUESTROOMENTRY: M.getRequestorAvatar=NULL\n"); + _chatdebug_("ChatAPI:BadData: MESSAGE_REQUESTROOMENTRY: M.getRequestorAvatar=nullptr\n"); break; } ChatAvatar *srcAvatar = M.getRequestorAvatar()->getNewChatAvatar(); @@ -3025,7 +3025,7 @@ void ChatAPICore::processAPI() } // if we've been disconnected for at least a minute... else if (!m_connected && - time(NULL) - m_timeSinceLastDisconnect >= 60) + time(nullptr) - m_timeSinceLastDisconnect >= 60) { if (m_setToRegistrar) { @@ -3043,7 +3043,7 @@ void ChatAPICore::processAPI() m_setToRegistrar = true; } - m_timeSinceLastDisconnect = time(NULL); + m_timeSinceLastDisconnect = time(nullptr); } @@ -3072,7 +3072,7 @@ void ChatAPICore::OnConnect(const char *host, short port) res->setTrack(m_currTrack); m_currTrack++; - time_t timeout = time(NULL) + m_requestTimeout; + time_t timeout = time(nullptr) + m_requestTimeout; req->setTimeout(timeout); res->setTimeout(timeout); @@ -3103,7 +3103,7 @@ void ChatAPICore::OnConnect(const char *host, short port) res->setTrack(m_currTrack); m_currTrack++; - time_t timeout = time(NULL) + m_requestTimeout; + time_t timeout = time(nullptr) + m_requestTimeout; req->setTimeout(timeout); res->setTimeout(timeout); @@ -3147,7 +3147,7 @@ void ChatAPICore::OnDisconnect(const char *host, short port) // stop processing immediately suspendProcessing(); - m_timeSinceLastDisconnect = time(NULL); + m_timeSinceLastDisconnect = time(nullptr); // determine who we disconnected from and take appropriate action if (strcmp(host, m_registrarHost.c_str()) == 0 && @@ -3214,7 +3214,7 @@ void ChatAPICore::failoverReloginOneAvatar(ChatAvatarCore * avatarCore) res->setTrack(m_currTrack); m_currTrack++; - time_t timeout = time(NULL) + m_requestTimeout; + time_t timeout = time(nullptr) + m_requestTimeout; req->setTimeout(timeout); res->setTimeout(timeout); @@ -3241,7 +3241,7 @@ void ChatAPICore::failoverRecreateRooms() { // first build multimap of rooms keyed by their node level (ascending order is default). multimap levelMap; - ChatRoomCore *roomCore = NULL; + ChatRoomCore *roomCore = nullptr; for (roomIter = m_roomCoreCache.begin(); roomIter != m_roomCoreCache.end(); ++roomIter) { roomCore = (*roomIter).second; @@ -3268,7 +3268,7 @@ void ChatAPICore::failoverRecreateRooms() res->setTrack(m_currTrack); m_currTrack++; - time_t timeout = time(NULL) + m_requestTimeout; + time_t timeout = time(nullptr) + m_requestTimeout; req->setTimeout(timeout); res->setTimeout(timeout); @@ -3296,7 +3296,7 @@ void ChatAPICore::failoverRecreateRooms() ChatAvatar *ChatAPICore::getAvatar(const ChatUnicodeString &avatarName, const ChatUnicodeString &avatarAddress) { - ChatAvatar *returnVal = NULL; + ChatAvatar *returnVal = nullptr; map::iterator iter = m_avatarCache.begin(); @@ -3317,7 +3317,7 @@ ChatAvatar *ChatAPICore::getAvatar(const ChatUnicodeString &avatarName, const Ch ChatRoom *ChatAPICore::getRoom(const ChatUnicodeString &roomAddress) { - ChatRoom *returnVal = NULL; + ChatRoom *returnVal = nullptr; map::iterator iter = m_roomCache.begin(); diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatEnum.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatEnum.cpp index fba1bc17..f18fac5d 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatEnum.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatEnum.cpp @@ -43,7 +43,7 @@ ChatUnicodeString::ChatUnicodeString(const std::string& nSrc) ChatUnicodeString::ChatUnicodeString(const char *nStrSrc) { - if (nStrSrc==NULL) + if (nStrSrc==nullptr) { m_wideString = getEmptyString(); m_cString = wideToNarrow(m_wideString); diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatFriendStatusCore.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatFriendStatusCore.cpp index c6eea945..653f0cbd 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatFriendStatusCore.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatFriendStatusCore.cpp @@ -7,7 +7,7 @@ namespace ChatSystem using namespace Base; using namespace Plat_Unicode; ChatFriendStatusCore::ChatFriendStatusCore() -: m_interface(NULL), +: m_interface(nullptr), m_status(0) { } @@ -31,7 +31,7 @@ ChatFriendStatusCore::~ChatFriendStatusCore() } ChatFriendStatus::ChatFriendStatus() -: m_core(NULL) +: m_core(nullptr) { } diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatIgnoreStatusCore.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatIgnoreStatusCore.cpp index 06717992..a3fefe08 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatIgnoreStatusCore.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatIgnoreStatusCore.cpp @@ -7,7 +7,7 @@ namespace ChatSystem using namespace Plat_Unicode; ChatIgnoreStatus::ChatIgnoreStatus() - : m_core(NULL) + : m_core(nullptr) { } @@ -16,7 +16,7 @@ namespace ChatSystem } ChatIgnoreStatusCore::ChatIgnoreStatusCore() - : m_interface(NULL) + : m_interface(nullptr) { } diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatRoom.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatRoom.cpp index d022aafa..cdd0238a 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatRoom.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatRoom.cpp @@ -581,7 +581,7 @@ unsigned RoomSummary::getRoomMaxSize() const ChatRoom::ChatRoom() { - m_core = NULL; + m_core = nullptr; } ChatRoom::ChatRoom(ChatRoomCore *core) diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatRoomCore.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatRoomCore.cpp index 715a943a..d0c70f68 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatRoomCore.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatRoomCore.cpp @@ -189,7 +189,7 @@ ChatRoomCore::~ChatRoomCore() ChatAvatarCore *ChatRoomCore::getAvatarCore(unsigned avatarID) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; map::iterator iterCore = m_inroomAvatarsCore.find(avatarID); @@ -202,7 +202,7 @@ ChatAvatarCore *ChatRoomCore::getAvatarCore(unsigned avatarID) ChatAvatar *ChatRoomCore::getAvatar(unsigned avatarID) { - ChatAvatar *returnAvatar = NULL; + ChatAvatar *returnAvatar = nullptr; map::iterator iter = m_inroomAvatars.find(avatarID); @@ -215,7 +215,7 @@ ChatAvatar *ChatRoomCore::getAvatar(unsigned avatarID) ChatAvatarCore *ChatRoomCore::getModeratorCore(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; set::iterator iterCore = m_moderatorAvatarsCore.begin(); @@ -238,7 +238,7 @@ ChatAvatarCore *ChatRoomCore::getModeratorCore(const Plat_Unicode::String &name, ChatAvatar *ChatRoomCore::getModerator(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - ChatAvatar *returnAvatar = NULL; + ChatAvatar *returnAvatar = nullptr; set::iterator iter = m_moderatorAvatars.begin(); @@ -263,7 +263,7 @@ ChatAvatar *ChatRoomCore::getModerator(const Plat_Unicode::String &name, const P ChatAvatarCore *ChatRoomCore::getBannedCore(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; set::iterator iterCore = m_banAvatarsCore.begin(); @@ -286,7 +286,7 @@ ChatAvatarCore *ChatRoomCore::getBannedCore(const Plat_Unicode::String &name, co ChatAvatar *ChatRoomCore::getBanned(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - ChatAvatar *returnAvatar = NULL; + ChatAvatar *returnAvatar = nullptr; set::iterator iter = m_banAvatars.begin(); @@ -311,7 +311,7 @@ ChatAvatar *ChatRoomCore::getBanned(const Plat_Unicode::String &name, const Plat ChatAvatarCore *ChatRoomCore::getInvitedCore(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; set::iterator iterCore = m_inviteAvatarsCore.begin(); @@ -334,7 +334,7 @@ ChatAvatarCore *ChatRoomCore::getInvitedCore(const Plat_Unicode::String &name, c ChatAvatar *ChatRoomCore::getInvited(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - ChatAvatar *returnAvatar = NULL; + ChatAvatar *returnAvatar = nullptr; set::iterator iter = m_inviteAvatars.begin(); @@ -359,7 +359,7 @@ ChatAvatar *ChatRoomCore::getInvited(const Plat_Unicode::String &name, const Pla ChatAvatarCore *ChatRoomCore::addAvatar(ChatAvatarCore *newAvatar, bool local) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; if(newAvatar) { @@ -394,7 +394,7 @@ void ChatRoomCore::addLocalAvatar(unsigned avatarID) ChatAvatarCore *ChatRoomCore::removeAvatar(unsigned avatarID) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; map::iterator iterCore = m_inroomAvatarsCore.find(avatarID); @@ -422,7 +422,7 @@ ChatAvatarCore *ChatRoomCore::removeAvatar(unsigned avatarID) ChatAvatarCore *ChatRoomCore::addBan(ChatAvatarCore *newAvatar) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; if(newAvatar) { @@ -446,7 +446,7 @@ ChatAvatarCore *ChatRoomCore::addBan(ChatAvatarCore *newAvatar) ChatAvatarCore *ChatRoomCore::removeBan(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; set::iterator iterCore = m_banAvatarsCore.begin(); @@ -494,7 +494,7 @@ ChatAvatarCore *ChatRoomCore::removeBan(const Plat_Unicode::String &name, const ChatAvatarCore *ChatRoomCore::addAdministrator(ChatAvatarCore *newAvatar) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; if(newAvatar) { @@ -518,7 +518,7 @@ ChatAvatarCore *ChatRoomCore::addAdministrator(ChatAvatarCore *newAvatar) ChatAvatarCore *ChatRoomCore::removeAdministrator(unsigned avatarID) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; map::iterator iterCore = m_adminAvatarsCore.find(avatarID); @@ -541,7 +541,7 @@ ChatAvatarCore *ChatRoomCore::removeAdministrator(unsigned avatarID) ChatAvatarCore *ChatRoomCore::addModerator(ChatAvatarCore *newAvatar) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; if(newAvatar) { @@ -565,7 +565,7 @@ ChatAvatarCore *ChatRoomCore::addModerator(ChatAvatarCore *newAvatar) ChatAvatarCore *ChatRoomCore::removeModerator(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; set::iterator iterCore = m_moderatorAvatarsCore.begin(); @@ -613,7 +613,7 @@ ChatAvatarCore *ChatRoomCore::removeModerator(const Plat_Unicode::String &name, ChatAvatarCore *ChatRoomCore::addTempModerator(ChatAvatarCore *newAvatar) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; if(newAvatar) { @@ -637,7 +637,7 @@ ChatAvatarCore *ChatRoomCore::addTempModerator(ChatAvatarCore *newAvatar) ChatAvatarCore *ChatRoomCore::removeTempModerator(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; set::iterator iterCore = m_tempModeratorAvatarsCore.begin(); @@ -685,7 +685,7 @@ ChatAvatarCore *ChatRoomCore::removeTempModerator(const Plat_Unicode::String &na ChatAvatarCore *ChatRoomCore::addInvite(ChatAvatarCore* newAvatar) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; if(newAvatar) { @@ -709,7 +709,7 @@ ChatAvatarCore *ChatRoomCore::addInvite(ChatAvatarCore* newAvatar) ChatAvatarCore *ChatRoomCore::removeInvite(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; set::iterator iterCore = m_inviteAvatarsCore.begin(); @@ -757,7 +757,7 @@ ChatAvatarCore *ChatRoomCore::removeInvite(const Plat_Unicode::String &name, con ChatAvatarCore *ChatRoomCore::addVoice(ChatAvatarCore* newAvatar) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; if(newAvatar) { @@ -781,7 +781,7 @@ ChatAvatarCore *ChatRoomCore::addVoice(ChatAvatarCore* newAvatar) ChatAvatarCore *ChatRoomCore::removeVoice(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; set::iterator iterCore = m_voiceAvatarsCore.begin(); @@ -1053,7 +1053,7 @@ void ChatRoomCore::serializeWithLocalAvatarsOnly(Base::ByteStream &msg) for (avatarIter = m_inroomAvatarsCore.begin(); avatarIter != m_inroomAvatarsCore.end(); ++avatarIter) { // include only the avatars that are on this API - if ( this->getAvatar((*avatarIter).second->getAvatarID()) != NULL ) + if ( this->getAvatar((*avatarIter).second->getAvatarID()) != nullptr ) { avatarsToSend.insert((*avatarIter).second); } diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Message.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Message.cpp index d38defbc..93e7e8e5 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Message.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Message.cpp @@ -21,7 +21,7 @@ namespace ChatSystem MRoomMessage::MRoomMessage(ByteStream::ReadIterator &iter) : GenericMessage(MESSAGE_ROOMMESSAGE), - m_destList(NULL), + m_destList(nullptr), m_srcAvatar(iter), m_messageID(0) { @@ -45,13 +45,13 @@ namespace ChatSystem MRoomMessage::~MRoomMessage() { delete[] m_destList; - m_destList = NULL; + m_destList = nullptr; } MBroadcastMessage::MBroadcastMessage(ByteStream::ReadIterator &iter) : GenericMessage(MESSAGE_BROADCASTMESSAGE), m_srcAvatar(iter), - m_destList(NULL) + m_destList(nullptr) { ASSERT_VALID_STRING_LENGTH(get(iter, m_srcAddress)); get(iter, m_listLength); @@ -68,7 +68,7 @@ namespace ChatSystem MBroadcastMessage::~MBroadcastMessage() { delete[] m_destList; - m_destList = NULL; + m_destList = nullptr; } MFilterMessage::MFilterMessage(ByteStream::ReadIterator &iter) diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/PersistentMessage.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/PersistentMessage.cpp index ca4b509e..bb9cfb82 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/PersistentMessage.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/PersistentMessage.cpp @@ -8,7 +8,7 @@ using namespace Base; using namespace Plat_Unicode; PersistentHeader::PersistentHeader() -: m_core(NULL) +: m_core(nullptr) { } @@ -66,7 +66,7 @@ PersistentHeaderCore::PersistentHeaderCore() m_avatarID(0), m_sentTime(0), m_status(0), - m_interface(NULL) + m_interface(nullptr) { } diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Request.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Request.cpp index 01afbcf7..2f7600ac 100644 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Request.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Request.cpp @@ -127,7 +127,7 @@ void RGetAvatarKeywords::pack(ByteStream &msg) RSearchAvatarKeywords::RSearchAvatarKeywords(const ChatUnicodeString &nodeAddress, const ChatUnicodeString *keywordsList, unsigned keywordsLength) : GenericRequest(REQUEST_SEARCHAVATARKEYWORDS), m_keywordsLength(keywordsLength), - m_keywordsList(NULL) + m_keywordsList(nullptr) { m_nodeAddress.assign(nodeAddress.string_data); m_keywordsList = new String[keywordsLength]; @@ -898,7 +898,7 @@ m_srcAddress(srcAddress.string_data, srcAddress.string_length), m_destRoomAddress(destRoomAddress.string_data, destRoomAddress.string_length) { // we take in a const RoomParams, so make our own and guarantee - // null-terminated char buffers. + // nullptr-terminated char buffers. m_newRoomName.assign(params->getRoomName().string_data, params->getRoomName().string_length); m_newRoomTopic.assign(params->getRoomTopic().string_data, params->getRoomTopic().string_length); m_newRoomPassword.assign(params->getRoomPassword().string_data, params->getRoomPassword().string_length); diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Response.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Response.cpp index 25d587fc..44a2f0dd 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Response.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Response.cpp @@ -20,7 +20,7 @@ using namespace Plat_Unicode; ResLoginAvatar::ResLoginAvatar(void *user, int avatarLoginPriority) : GenericResponse(RESPONSE_LOGINAVATAR, CHATRESULT_TIMEOUT, user), - m_avatar(NULL), + m_avatar(nullptr), m_submittedPriority(avatarLoginPriority), m_requiredPriority(INT_MAX) { @@ -63,7 +63,7 @@ void ResLoginAvatar::unpack(ByteStream::ReadIterator &iter) ResTemporaryAvatar::ResTemporaryAvatar(void *user) : GenericResponse(RESPONSE_TEMPORARYAVATAR, CHATRESULT_TIMEOUT, user) -, m_avatar(NULL) +, m_avatar(nullptr) { } @@ -110,7 +110,7 @@ void ResDestroyAvatar::unpack(ByteStream::ReadIterator &iter) ResGetAvatar::ResGetAvatar(void *user) : GenericResponse(RESPONSE_GETAVATAR, CHATRESULT_TIMEOUT, user), - m_avatar(NULL) + m_avatar(nullptr) { } @@ -144,7 +144,7 @@ void ResGetAvatar::unpack(ByteStream::ReadIterator &iter) ResGetAnyAvatar::ResGetAnyAvatar(void* user) : GenericResponse( RESPONSE_GETANYAVATAR, CHATRESULT_TIMEOUT, user ) - , m_avatar( NULL ) + , m_avatar( nullptr ) { } @@ -181,8 +181,8 @@ void ResGetAnyAvatar::unpack(Base::ByteStream::ReadIterator& iter) ResAvatarList::ResAvatarList(void *user) : GenericResponse(RESPONSE_AVATARLIST, CHATRESULT_TIMEOUT, user) , m_listLength(0) -, m_avatarList(NULL) -, m_cores(NULL) +, m_avatarList(nullptr) +, m_cores(nullptr) { } @@ -214,7 +214,7 @@ void ResAvatarList::unpack(ByteStream::ReadIterator &iter) ResSetAvatarAttributes::ResSetAvatarAttributes(void *user) : GenericResponse(RESPONSE_SETAVATARATTRIBUTES, CHATRESULT_TIMEOUT, user), - m_avatar(NULL) + m_avatar(nullptr) { } @@ -248,7 +248,7 @@ void ResSetAvatarAttributes::unpack(ByteStream::ReadIterator &iter) ResSetAvatarStatusMessage::ResSetAvatarStatusMessage(void *user) : GenericResponse(RESPONSE_SETSTATUSMESSAGE, CHATRESULT_TIMEOUT, user), -m_avatar(NULL) +m_avatar(nullptr) { } @@ -285,7 +285,7 @@ void ResSetAvatarStatusMessage::unpack(ByteStream::ReadIterator &iter) ResSetAvatarForwardingEmail::ResSetAvatarForwardingEmail(void *user) : GenericResponse(RESPONSE_SETAVATAREMAIL, CHATRESULT_TIMEOUT, user), - m_avatar(NULL) + m_avatar(nullptr) { } @@ -312,7 +312,7 @@ void ResSetAvatarForwardingEmail::unpack(ByteStream::ReadIterator &iter) ResSetAvatarInboxLimit::ResSetAvatarInboxLimit(void *user) : GenericResponse(RESPONSE_SETAVATARINBOXLIMIT, CHATRESULT_TIMEOUT, user), - m_avatar(NULL) + m_avatar(nullptr) { } @@ -340,7 +340,7 @@ void ResSetAvatarInboxLimit::unpack(ByteStream::ReadIterator &iter) ResSearchAvatarKeywords::ResSearchAvatarKeywords(void *user) : GenericResponse(RESPONSE_SETAVATARKEYWORDS, CHATRESULT_TIMEOUT, user), m_numMatches(0), - m_avatarMatches(NULL) + m_avatarMatches(nullptr) { } @@ -388,8 +388,8 @@ void ResSetAvatarKeywords::unpack(ByteStream::ReadIterator &iter) ResGetAvatarKeywords::ResGetAvatarKeywords(void *user, unsigned avatarID) : GenericResponse(RESPONSE_GETAVATARKEYWORDS, CHATRESULT_TIMEOUT, user), m_avatarID(avatarID), - m_keywordList(NULL), - m_chatStrList(NULL) + m_keywordList(nullptr), + m_chatStrList(nullptr) { } @@ -420,7 +420,7 @@ void ResGetAvatarKeywords::unpack(ByteStream::ReadIterator &iter) ResGetRoom::ResGetRoom(void *user) : GenericResponse(RESPONSE_GETROOM, CHATRESULT_TIMEOUT, user), - m_room(NULL), + m_room(nullptr), m_numExtraRooms(0) { } @@ -448,7 +448,7 @@ void ResGetRoom::unpack(ByteStream::ReadIterator &iter) ResCreateRoom::ResCreateRoom(void *user, unsigned avatarID) : GenericResponse(RESPONSE_CREATEROOM, CHATRESULT_TIMEOUT, user), m_srcAvatarID(avatarID), - m_room(NULL), + m_room(nullptr), m_numExtraRooms(0) { } @@ -637,8 +637,8 @@ ResFriendStatus::ResFriendStatus(void *user, unsigned avatarID) : GenericResponse(RESPONSE_FRIENDSTATUS, CHATRESULT_TIMEOUT, user), m_avatarID(avatarID), m_listLength(0), - m_friendList(NULL), - m_cores(NULL) + m_friendList(nullptr), + m_cores(nullptr) { } @@ -704,8 +704,8 @@ ResIgnoreStatus::ResIgnoreStatus(void *user, unsigned avatarID) : GenericResponse(RESPONSE_IGNORESTATUS, CHATRESULT_TIMEOUT, user), m_avatarID(avatarID), m_listLength(0), - m_ignoreList(NULL), - m_cores(NULL) + m_ignoreList(nullptr), + m_cores(nullptr) { } @@ -740,7 +740,7 @@ ResEnterRoom::ResEnterRoom(void *user, unsigned avatarID, const ChatUnicodeStrin m_avatarID(avatarID), m_destAddress(destAddress.string_data, destAddress.string_length), m_gotRoomObj(false), - m_room(NULL), + m_room(nullptr), m_numExtraRooms(0) { } @@ -1012,7 +1012,7 @@ void ResChangeRoomOwner::unpack(ByteStream::ReadIterator &iter) ResGetRoomSummaries::ResGetRoomSummaries(void *user) : GenericResponse(RESPONSE_GETROOMSUMMARIES, CHATRESULT_TIMEOUT, user), m_numRooms(0), - m_roomSummaries(NULL) + m_roomSummaries(nullptr) { } @@ -1132,8 +1132,8 @@ ResGetPersistentMessage::ResGetPersistentMessage(void *user, unsigned srcAvatarI : GenericResponse(RESPONSE_GETPERSISTENTMESSAGE, CHATRESULT_TIMEOUT, user), m_srcAvatarID(srcAvatarID), m_messageID(messageID), - m_core(NULL), - m_header(NULL) + m_core(nullptr), + m_header(nullptr) { } @@ -1167,7 +1167,7 @@ void ResGetPersistentMessage::unpack(ByteStream::ReadIterator &iter) ResGetMultiplePersistentMessages::ResGetMultiplePersistentMessages(void *user, unsigned srcAvatarID) : GenericResponse(RESPONSE_GETMULTIPLEPERSISTENTMESSAGES, CHATRESULT_TIMEOUT, user), m_srcAvatarID(srcAvatarID), - m_messages(NULL) + m_messages(nullptr) { } @@ -1217,8 +1217,8 @@ ResGetPersistentHeaders::ResGetPersistentHeaders(void *user, unsigned srcAvatarI : GenericResponse(RESPONSE_GETPERSISTENTHEADERS, CHATRESULT_TIMEOUT, user), m_srcAvatarID(srcAvatarID), m_listLength(0), - m_headers(NULL), - m_cores(NULL) + m_headers(nullptr), + m_cores(nullptr) { } @@ -1263,8 +1263,8 @@ ResGetPartialPersistentHeaders::ResGetPartialPersistentHeaders(void *user, unsig : GenericResponse(RESPONSE_PARTIALPERSISTENTHEADERS, CHATRESULT_TIMEOUT, user), m_srcAvatarID(srcAvatarID), m_listLength(0), - m_headers(NULL), - m_cores(NULL) + m_headers(nullptr), + m_cores(nullptr) { } @@ -1396,7 +1396,7 @@ void ResUnregisterRoom::unpack(ByteStream::ReadIterator &iter) } ResFailoverReloginAvatar::ResFailoverReloginAvatar(unsigned avatarID) -: GenericResponse(RESPONSE_FAILOVER_RELOGINAVATAR, CHATRESULT_TIMEOUT, NULL), +: GenericResponse(RESPONSE_FAILOVER_RELOGINAVATAR, CHATRESULT_TIMEOUT, nullptr), m_avatarID(avatarID) { } @@ -1414,9 +1414,9 @@ void ResFailoverReloginAvatar::unpack(ByteStream::ReadIterator &iter) } ResFailoverRecreateRoom::ResFailoverRecreateRoom(unsigned roomID, bool forced) -: GenericResponse(RESPONSE_FAILOVER_RECREATEROOM, CHATRESULT_TIMEOUT, NULL), +: GenericResponse(RESPONSE_FAILOVER_RECREATEROOM, CHATRESULT_TIMEOUT, nullptr), m_roomID(roomID), - m_room(NULL), + m_room(nullptr), m_forced(forced) { } @@ -1478,7 +1478,7 @@ void ResGetFanClubHandle::unpack(ByteStream::ReadIterator &iter) ResFindAvatarByUID::ResFindAvatarByUID(void *user) : GenericResponse(RESPONSE_FINDAVATARBYUID, CHATRESULT_TIMEOUT, user), m_numAvatarsOnline(0), - m_avatars(NULL) + m_avatars(nullptr) { } @@ -1512,7 +1512,7 @@ void ResFindAvatarByUID::unpack(ByteStream::ReadIterator &iter) } ResRegistrarGetChatServer::ResRegistrarGetChatServer() -: GenericResponse(RESPONSE_REGISTRAR_GETCHATSERVER, CHATRESULT_TIMEOUT, NULL) +: GenericResponse(RESPONSE_REGISTRAR_GETCHATSERVER, CHATRESULT_TIMEOUT, nullptr) { } @@ -1527,7 +1527,7 @@ void ResRegistrarGetChatServer::unpack(ByteStream::ReadIterator &iter) } ResSendApiVersion::ResSendApiVersion() -: GenericResponse(RESPONSE_SETAPIVERSION, CHATRESULT_TIMEOUT, NULL) +: GenericResponse(RESPONSE_SETAPIVERSION, CHATRESULT_TIMEOUT, nullptr) { } @@ -1600,8 +1600,8 @@ void ResRemoveSnoopRoom::unpack(ByteStream::ReadIterator &iter) ResGetSnoopList::ResGetSnoopList(void *user, unsigned srcAvatarID) : GenericResponse(RESPONSE_GETSNOOPLIST, CHATRESULT_TIMEOUT, user), m_srcAvatarID(srcAvatarID), - m_avatarSnoops(NULL), - m_roomSnoops(NULL) + m_avatarSnoops(nullptr), + m_roomSnoops(nullptr) { } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/Archive.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Base/Archive.cpp index c7a1b9a8..2d6b1839 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/Archive.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/Archive.cpp @@ -107,7 +107,7 @@ namespace Base ByteStream::ByteStream() : allocatedSize(0), beginReadIterator(), - data(NULL), + data(nullptr), size(0), lastPutSize(0) { @@ -224,7 +224,7 @@ namespace Base if(data->size < allocatedSize) { unsigned char * tmp = new unsigned char[newSize]; - if(data->buffer != NULL) + if(data->buffer != nullptr) memcpy(tmp, data->buffer, size); delete[] data->buffer; data->buffer = tmp; diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/AutoLog.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Base/AutoLog.cpp index 660d838d..24292a4e 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/AutoLog.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/AutoLog.cpp @@ -35,7 +35,7 @@ bool CAutoLog::Open(const char * filename) //------------------------------------- { - if( NULL == filename) + if( nullptr == filename) return false; if (pFilename) @@ -45,13 +45,13 @@ bool CAutoLog::Open(const char * filename) // Sanitize slashes char *ptr; - while ((ptr = strchr(pFilename,WRONGSLASH)) != NULL) + while ((ptr = strchr(pFilename,WRONGSLASH)) != nullptr) *ptr = SLASHCHAR[0]; char strPath[1024]; strcpy(strPath,pFilename); ptr = strrchr(strPath, SLASHCHAR[0]); - if (ptr != NULL) + if (ptr != nullptr) { *ptr = 0; @@ -59,11 +59,11 @@ bool CAutoLog::Open(const char * filename) char curdir[128]; // remember current directory - if( getcwd(curdir,sizeof(curdir)) == NULL ) + if( getcwd(curdir,sizeof(curdir)) == nullptr ) { fprintf(stderr,"CAutoLog::Archive failed to get current directory!\n"); free(pFilename); - pFilename = NULL; + pFilename = nullptr; return false; // error, can't proceed } @@ -74,7 +74,7 @@ bool CAutoLog::Open(const char * filename) { fprintf(stderr,"CAutoLog::Archive failed to make directory: %s\n", strPath); free(pFilename); - pFilename = NULL; + pFilename = nullptr; return false; // error, can't proceed } } @@ -94,7 +94,7 @@ bool CAutoLog::Open(const char * filename) { fprintf(stderr,"CAutoLog::Archive failed to make directory: %s\n", strPath); free(pFilename); - pFilename = NULL; + pFilename = nullptr; return false; // error, can't proceed } } @@ -103,7 +103,7 @@ bool CAutoLog::Open(const char * filename) pFile = fopen(pFilename,"a+"); - if( pFile == NULL || pFile == (FILE *)-1) + if( pFile == nullptr || pFile == (FILE *)-1) { //fprintf(stderr,"CAutoLog::Open failed to open log file: %s\n",pFilename); Close(); @@ -123,7 +123,7 @@ bool CAutoLog::Open(const char * filename) void CAutoLog::Close(void) //------------------------------------- { - if( pFile != (FILE *)-1 && pFile != NULL) + if( pFile != (FILE *)-1 && pFile != nullptr) { fclose(pFile); } @@ -131,7 +131,7 @@ void CAutoLog::Close(void) free(pFilename); - pFilename = NULL; + pFilename = nullptr; } //------------------------------------- @@ -194,7 +194,7 @@ void CAutoLog::LogDebug(char * format, ...) void CAutoLog::Log(eLogLevel severity, char *fmt, ...) //------------------------------------- { - if (pFile == (FILE *)-1 || pFile == NULL) + if (pFile == (FILE *)-1 || pFile == nullptr) { //fprintf(stderr,"CAutoLog::Log called with no file open!\n"); return; @@ -250,7 +250,7 @@ void CAutoLog::Log(eLogLevel severity, char *fmt, ...) void CAutoLog::Archive(void) //------------------------------------- { - if( pFile == (FILE *)-1 || pFile == NULL) + if( pFile == (FILE *)-1 || pFile == nullptr) { //fprintf(stderr,"CAutoLog::Archive called with no file open!\n"); return; @@ -281,7 +281,7 @@ void CAutoLog::Archive(void) strcpy(strCurrent,pFilename); pCurrent = strrchr(strCurrent, SLASHCHAR[0]); - if (pCurrent != NULL) + if (pCurrent != nullptr) *pCurrent = 0; else sprintf(strCurrent,"."); @@ -290,7 +290,7 @@ void CAutoLog::Archive(void) #ifdef WIN32 // remember current directory - if( getcwd(curdir,sizeof(curdir)) == NULL ) + if( getcwd(curdir,sizeof(curdir)) == nullptr ) { fprintf(stderr,"CAutoLog::Archive failed to get current directory!\n"); return; // error, can't proceed @@ -324,7 +324,7 @@ void CAutoLog::Archive(void) #endif pCurrent = strrchr(pFilename, SLASHCHAR[0]); - if (pCurrent == NULL) + if (pCurrent == nullptr) pCurrent = pFilename; else pCurrent++; diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/AutoLog.h b/external/3rd/library/soePlatform/ChatAPI/utils/Base/AutoLog.h index 0a90a774..18871c7f 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/AutoLog.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/AutoLog.h @@ -92,14 +92,14 @@ namespace Base //------------------------------------- inline CAutoLog::CAutoLog() { - pFilename = NULL; + pFilename = nullptr; pFile = (FILE *)-1; } //------------------------------------- inline CAutoLog::CAutoLog(const char * file) { - pFilename = NULL; + pFilename = nullptr; pFile = (FILE *)-1; Open(file); } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/CmdLine.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Base/CmdLine.cpp index b9d5b3e3..dcaf025a 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/CmdLine.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/CmdLine.cpp @@ -135,7 +135,7 @@ int CCmdLine::SplitLine(int argc, char **argv) bool CCmdLine::IsSwitch(const char *pParam) { - if (pParam==NULL) + if (pParam==nullptr) return false; // switches must non-empty @@ -204,7 +204,7 @@ StringType CCmdLine::GetSafeArgument(const char *pSwitch, int iIdx, const char * { StringType sRet; - if (pDefault!=NULL) + if (pDefault!=nullptr) sRet = pDefault; try diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/Config.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Base/Config.cpp index c5dd63d8..eb6dc55e 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/Config.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/Config.cpp @@ -28,7 +28,7 @@ bool CConfig::LoadFile(char * file) // open file fp = fopen(file, "r"); - if (fp == NULL || fp == (FILE *)-1) + if (fp == nullptr || fp == (FILE *)-1) { //fprintf(stderr,"Failed to open config file %s!",file); return false; @@ -71,21 +71,21 @@ void CConfig::UnloadFile(void) //----------------------------------- { delete[] pConfig; - pConfig = NULL; + pConfig = nullptr; } //----------------------------------- /// finds a key of the config in memory // key argument is case-insensitive, but must be upper case in config file -// Returns true for success (passing NULL is a special case returned as success) +// Returns true for success (passing nullptr is a special case returned as success) bool CConfig::FindKey(char *key) //----------------------------------- { - if (pConfig == NULL) + if (pConfig == nullptr) return false; // special case...continue with existing key - if (key == NULL) + if (key == nullptr) return true; // form the search key @@ -96,12 +96,12 @@ bool CConfig::FindKey(char *key) // find the key heading pCursor = strstr(pConfig,strBuffer); - if (pCursor==NULL) + if (pCursor==nullptr) return false; // find the closing bracket of key heading pCursor = strchr(pCursor,']'); - if (pCursor==NULL) + if (pCursor==nullptr) return false; pCursor++; @@ -110,7 +110,7 @@ bool CConfig::FindKey(char *key) //----------------------------------- /// extract a number from the config string -// pass the key to find the first number in the list, else NULL to find the next number in the list +// pass the key to find the first number in the list, else nullptr to find the next number in the list // returns 0 if no number is found, else returns the number long CConfig::GetLong(char *key) //----------------------------------- @@ -133,20 +133,20 @@ long CConfig::GetLong(char *key) //----------------------------------- /// extract string (in double-quotes) from the list. -// pass the key to find the first string in the list, else NULL to find the next string in the list -// returns NULL if no string found, else returns a temporary copy of the string (without quotes) +// pass the key to find the first string in the list, else nullptr to find the next string in the list +// returns nullptr if no string found, else returns a temporary copy of the string (without quotes) char * CConfig::GetString(char *key) //----------------------------------- { if (!FindKey(key)) - return NULL; + return nullptr; // look for start of string or end of key while (*pCursor && *pCursor != '"' && *pCursor != '[') pCursor++; if (*(pCursor++) != '"') - return NULL; + return nullptr; // until closing quote int c = 0; @@ -160,7 +160,7 @@ char * CConfig::GetString(char *key) } } - return NULL; + return nullptr; } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/Config.h b/external/3rd/library/soePlatform/ChatAPI/utils/Base/Config.h index 864506f3..6f6dc376 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/Config.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/Config.h @@ -10,7 +10,7 @@ ; list of strings, with code example # config.FindKey("NUMBERS"); -# while (number = config.GetLong(NULL)) +# while (number = config.GetLong(nullptr)) # YourHandleNumber(number); [NUMBERS] 100 200, 300 ; formatting is very flexible as long as numbers are delimited by non-numbers @@ -23,7 +23,7 @@ ; list of strings, with code example # config.FindKey("HOSTS"); -# while (string = config.GetString(NULL)) +# while (string = config.GetString(nullptr)) # YourHandleString(string); [HOSTS] "127.0.0.1:5999" @@ -68,16 +68,16 @@ namespace Base // returns TRUE if key is found. bool FindKey(char *key); - // extract string from config. If key is NULL, extract next string in list, else extract first string. - // if key was not found, returns NULL - char * GetString(char *key = NULL); + // extract string from config. If key is nullptr, extract next string in list, else extract first string. + // if key was not found, returns nullptr + char * GetString(char *key = nullptr); - // extract number from config. If key is NULL, extract next number in list, else extract first number. + // extract number from config. If key is nullptr, extract next number in list, else extract first number. // if key was not found, returns 0 - long GetLong(char *key = NULL); // extract number from config. + long GetLong(char *key = nullptr); // extract number from config. // indicate if config file has been loaded - inline bool FileLoaded() { return pConfig == NULL ? false : true; } + inline bool FileLoaded() { return pConfig == nullptr ? false : true; } private: char * pConfig; // pointer to file memory @@ -87,14 +87,14 @@ namespace Base inline CConfig::CConfig() { - pConfig = NULL; - pCursor = NULL; + pConfig = nullptr; + pCursor = nullptr; } inline CConfig::CConfig(char * file) { - pConfig = NULL; - pCursor = NULL; + pConfig = nullptr; + pCursor = nullptr; LoadFile(file); } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/Logger.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Base/Logger.cpp index 8942bfdd..4cdc4532 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/Logger.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/Logger.cpp @@ -120,7 +120,7 @@ Logger::Logger(const char *programName, void Logger::LoggerInit(const char *programName) { char buf[1024]; - FILE *logDir = NULL; + FILE *logDir = nullptr; if (0 != (m_combinedLogType & eUseLocalFile)) { @@ -129,13 +129,13 @@ void Logger::LoggerInit(const char *programName) { cmkdir(m_dirPrefix.c_str(), 0755); } - else if(logDir != NULL) + else if(logDir != nullptr) { fclose(logDir); } tm now; - time_t t = time(NULL); + time_t t = time(nullptr); LOGGER_GET_CURR_TIME(now, t); @@ -153,7 +153,7 @@ void Logger::LoggerInit(const char *programName) { cmkdir(buf, 0755); } - else if(logDir != NULL) + else if(logDir != nullptr) { fclose(logDir); } @@ -279,7 +279,7 @@ void Logger::addLog(const char *id, unsigned logenum, int level, unsigned size) else { newLog->file = fopen(newLog->filename.c_str(), "a+"); - if(newLog->file == NULL) + if(newLog->file == nullptr) { printf("Open file %s failed\n", newLog->filename.c_str()); } @@ -313,7 +313,7 @@ void Logger::addLog(const char *id, unsigned logenum) else { newLog->file = fopen(newLog->filename.c_str(), "a+"); - if(newLog->file == NULL) + if(newLog->file == nullptr) { printf("Open file %s failed\n", newLog->filename.c_str()); } @@ -368,7 +368,7 @@ void Logger::logSimple(unsigned logenum, int level, const char *message) { return; } - time_t t = time(NULL); + time_t t = time(nullptr); LogInfo *info = (*iter).second; if(level >= info->level) { @@ -444,7 +444,7 @@ void Logger::logSimpleWithSys(unsigned logenum, unsigned priority, int level, co { return; } - time_t t = time(NULL); + time_t t = time(nullptr); LogInfo *info = (*iter).second; if(level >= info->level) @@ -514,7 +514,7 @@ void Logger::log(unsigned logenum, int level, const char *message, ...) // ensure that the buf does not contain any '%' characters. // prevent crash problem char *rv; - while((rv = strchr(buf, '%')) != NULL) + while((rv = strchr(buf, '%')) != nullptr) { *rv = ' '; // replace with space } @@ -546,7 +546,7 @@ void Logger::logWithSys(unsigned logenum, unsigned priority, int level, const ch { return; } - time_t t = time(NULL); + time_t t = time(nullptr); LogInfo *info = (*iter).second; if(level >= info->level) @@ -604,14 +604,14 @@ void Logger::logWithSys(unsigned logenum, unsigned priority, int level, const ch void Logger::rollDate(time_t t) { char buf[80]; - FILE *logDir = NULL; + FILE *logDir = nullptr; logDir = fopen(m_dirPrefix.c_str(), "r+"); if(errno == ENOENT) { cmkdir(m_dirPrefix.c_str(), 0755); } - else if(logDir != NULL) + else if(logDir != nullptr) { fclose(logDir); } @@ -627,7 +627,7 @@ void Logger::rollDate(time_t t) { cmkdir(buf, 0755); } - else if(logDir != NULL) + else if(logDir != nullptr) { fclose(logDir); } @@ -711,7 +711,7 @@ void Logger::rollLog(LogInfo *logInfo) { std::string newLogName; char timeStampBuffer[256]; - time_t t = time(NULL); + time_t t = time(nullptr); tm now; int r; int nTries = 10; diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/Statistics.h b/external/3rd/library/soePlatform/ChatAPI/utils/Base/Statistics.h index 18e0579e..0856034b 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/Statistics.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/Statistics.h @@ -34,9 +34,9 @@ namespace Base bool commit = false; if (!mLastSampleTime) - mLastSampleTime = time(NULL); + mLastSampleTime = time(nullptr); - if (!mSampleFrequency || mLastSampleTime + mSampleFrequency < (unsigned)time(NULL)) + if (!mSampleFrequency || mLastSampleTime + mSampleFrequency < (unsigned)time(nullptr)) { mSampleTotal++; mAggregateTotal += value; diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/TemplateObjectAllocator.h b/external/3rd/library/soePlatform/ChatAPI/utils/Base/TemplateObjectAllocator.h index 40227673..ed1a7937 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/TemplateObjectAllocator.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/TemplateObjectAllocator.h @@ -93,7 +93,7 @@ namespace Base void Destroy(TYPE *object) { - if (object == NULL) + if (object == nullptr) return; #ifdef USE_ALLOCATOR_MUTEX @@ -142,7 +142,7 @@ namespace Base void FastDestroy(TYPE *object) { - if (object == NULL) + if (object == nullptr) return; object->~TYPE(); diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/WideString.h b/external/3rd/library/soePlatform/ChatAPI/utils/Base/WideString.h index 775f9713..28159b18 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/WideString.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/WideString.h @@ -94,12 +94,12 @@ namespace ucs2 } //////////////////////////////////////// - // target string is a null-terminated C string + // target string is a nullptr-terminated C string inline string::string(const char * copy) : mLength(0), mData(8,0) { - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!copy) { return; @@ -111,12 +111,12 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *copy++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; } //////////////////////////////////////// - // target string is a C string that may or may not include null characters + // target string is a C string that may or may not include nullptr characters inline string::string(const std::string & copy) : mLength(copy.length()), mData(8,0) @@ -126,17 +126,17 @@ namespace ucs2 // (2) perform transform to copy the narrow string to our // wide string std::transform(copy.begin(), copy.end(), mData.begin(), NarrowToWide); - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength] = 0; } //////////////////////////////////////// - // target string is a wide null-terminated C string + // target string is a wide nullptr-terminated C string inline string::string(const char_type * copy) : mLength(0), mData(8,0) { - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!copy) { return; @@ -148,7 +148,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *copy++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; } @@ -169,7 +169,7 @@ namespace ucs2 inline string & string::operator=(const char * rhs) { mLength = 0; - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!rhs) { mData[0] = 0; @@ -182,7 +182,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } @@ -195,7 +195,7 @@ namespace ucs2 // (2) perform transform to copy the narrow string to our // wide string std::transform(rhs.begin(), rhs.end(), mData.begin(), NarrowToWide); - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength] = 0; return *this; } @@ -203,7 +203,7 @@ namespace ucs2 inline string & string::operator=(const char_type * rhs) { mLength = 0; - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!rhs) { mData[0] = 0; @@ -216,7 +216,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } @@ -235,7 +235,7 @@ namespace ucs2 inline string & string::operator+=(const char * rhs) { - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!rhs) { return *this; @@ -247,7 +247,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } @@ -259,7 +259,7 @@ namespace ucs2 // (2) perform transform to copy the narrow string to our // wide string std::transform(rhs.begin(), rhs.end(), mData.begin()+mLength, NarrowToWide); - // (3) ensure null termination + // (3) ensure nullptr termination mLength += rhs.length(); mData[mLength] = 0; return *this; @@ -267,7 +267,7 @@ namespace ucs2 inline string & string::operator+=(const char_type * rhs) { - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!rhs) { return *this; @@ -279,7 +279,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } @@ -388,7 +388,7 @@ namespace ucs2 inline string & string::assign(const char_type * rhs) { mLength = 0; - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!rhs) { mData[0] = 0; @@ -401,7 +401,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } @@ -409,7 +409,7 @@ namespace ucs2 inline string & string::assign(const char_type * rhs, size_type count) { mLength = 0; - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!rhs) { mData[0] = 0; @@ -422,7 +422,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } @@ -463,7 +463,7 @@ namespace ucs2 inline string & string::assign(const char_type * first, const char_type * last) { mLength = 0; - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!first || !last) { mData[0] = 0; @@ -476,14 +476,14 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *first++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } inline string & string::append(const char_type * rhs) { - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!rhs) { return *this; @@ -495,14 +495,14 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } inline string & string::append(const char_type * rhs, size_type count) { - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!rhs) { return *this; @@ -514,7 +514,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } @@ -558,7 +558,7 @@ namespace ucs2 inline string & string::append(const char_type * first, const char_type * last) { - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!first || !last) { return *this; @@ -570,7 +570,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *first++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/BlockAllocator.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/BlockAllocator.cpp index 4cefb9e7..29d91074 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/BlockAllocator.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/BlockAllocator.cpp @@ -12,7 +12,7 @@ namespace Base { for(unsigned i = 0; i < 31; i++) { - m_blocks[i] = NULL; + m_blocks[i] = nullptr; } } @@ -21,7 +21,7 @@ namespace Base // free all allocated memory blocks for(unsigned i = 0; i < 31; i++) { - while(m_blocks[i] != NULL) + while(m_blocks[i] != nullptr) { unsigned *tmp = m_blocks[i]; m_blocks[i] = (unsigned *)*m_blocks[i]; @@ -36,7 +36,7 @@ namespace Base void *BlockAllocator::getBlock(unsigned bytes) { unsigned accum = 16, bits = 16; - unsigned *handle = NULL; + unsigned *handle = nullptr; // Perform a binary search looking for the highest bit. @@ -96,7 +96,7 @@ namespace Base void BlockAllocator::returnBlock(unsigned *handle) { - // C++ allows for safe deletion of a NULL pointer + // C++ allows for safe deletion of a nullptr pointer if(handle) { // Update the allocator linked list, insert this entry at the head diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/Event.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/Event.cpp index a3cce3b1..72190595 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/Event.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/Event.cpp @@ -26,8 +26,8 @@ namespace Base mCond(), mThreadCount(0) { - pthread_mutex_init(&mMutex, NULL); - pthread_cond_init(&mCond, NULL); + pthread_mutex_init(&mMutex, nullptr); + pthread_cond_init(&mCond, nullptr); } CEvent::~CEvent() @@ -74,7 +74,7 @@ namespace Base struct timeval now; struct timespec abs_timeout; - gettimeofday(&now, NULL); + gettimeofday(&now, nullptr); abs_timeout.tv_sec = now.tv_sec + timeout/1000; abs_timeout.tv_nsec = now.tv_usec * 1000 + (timeout%1000)*1000000; abs_timeout.tv_sec += abs_timeout.tv_nsec / 1000000000; diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/Thread.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/Thread.cpp index a4b1e3a2..f5bc4629 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/Thread.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/Thread.cpp @@ -77,8 +77,8 @@ namespace Base CThreadPool::CMember::CMember(CThreadPool * parent) : mParent(parent), - mFunction(NULL), - mArgument(NULL), + mFunction(nullptr), + mArgument(nullptr), mSemaphore() { StartThread(); @@ -117,8 +117,8 @@ namespace Base if (mFunction) { mFunction(mArgument); - mArgument = NULL; - mFunction = NULL; + mArgument = nullptr; + mFunction = nullptr; } else if (mParent->OnDestory(this)) mThreadContinue = false; @@ -173,7 +173,7 @@ namespace Base } //////////////////////////////////////// - // (3) Delete the null member threads + // (3) Delete the nullptr member threads mMutex.Lock(); while (!mNullMember.empty()) { @@ -224,7 +224,7 @@ namespace Base } //////////////////////////////////////// - // (2) Delete any null member threads. + // (2) Delete any nullptr member threads. while (!mNullMember.empty()) { delete mNullMember.front(); diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/serialize.h b/external/3rd/library/soePlatform/ChatAPI/utils/Base/serialize.h index 650681b5..ed38802a 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/serialize.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/serialize.h @@ -501,8 +501,8 @@ namespace soe } else { - //find null terminator, if don't find it before maxLen, then err - const unsigned char *strEnd = NULL; + //find nullptr terminator, if don't find it before maxLen, then err + const unsigned char *strEnd = nullptr; unsigned strLen = 0; for (;strLensetTrack(m_currTrack); res->setTrack(m_currTrack); - time_t timeout = time(NULL) + m_requestTimeout; + time_t timeout = time(nullptr) + m_requestTimeout; req->setTimeout(timeout); res->setTimeout(timeout); @@ -125,7 +125,7 @@ unsigned GenericAPICore::submitRequest(GenericRequest *req, GenericResponse *res } req->setTrack(m_currTrack); res->setTrack(m_currTrack); - time_t timeout = time(NULL) + reqTimeout; + time_t timeout = time(nullptr) + reqTimeout; req->setTimeout(timeout); res->setTimeout(timeout); @@ -140,7 +140,7 @@ void GenericAPICore::process() GenericResponse *res; // Process timeout on pending requests - regardless of whether processing is suspended or not - while((m_outCount > 0) && ((req = m_outboundQueue.front().first)->getTimeout() <= time(NULL))) + while((m_outCount > 0) && ((req = m_outboundQueue.front().first)->getTimeout() <= time(nullptr))) { --m_outCount; res = m_outboundQueue.front().second; @@ -152,7 +152,7 @@ void GenericAPICore::process() } // Process timeout on pending responses - while((m_pendingCount > 0) && ((res = (*m_pending.begin()).second)->getTimeout() <= time(NULL))) + while((m_pendingCount > 0) && ((res = (*m_pending.begin()).second)->getTimeout() <= time(nullptr))) { --m_pendingCount; m_pending.erase(m_pending.begin()); @@ -165,7 +165,7 @@ void GenericAPICore::process() while(m_outCount > 0) { GenericConnection *con = getNextActiveConnection(); - if (con != NULL) + if (con != nullptr) { pair out_pair = m_outboundQueue.front(); @@ -184,7 +184,7 @@ void GenericAPICore::process() else { #ifdef USE_SERIALIZE_LIB - const unsigned char *msgBuf = NULL; + const unsigned char *msgBuf = nullptr; unsigned msgSize = 0; msgBuf = req->pack(msgSize); con->Send(msgBuf, msgSize); @@ -222,7 +222,7 @@ GenericConnection *GenericAPICore::getNextActiveConnection() unsigned startIndex = m_nextConnectionIndex; unsigned maxIndex = m_serverConnections.size() - 1; - GenericConnection *con = NULL; + GenericConnection *con = nullptr; //loop until we find an active connection, or until we get back // to where we started @@ -242,7 +242,7 @@ GenericConnection *GenericAPICore::getNextActiveConnection() //went past end of vector, start back at 0 m_nextConnectionIndex = 0; } - }while (con == NULL && m_nextConnectionIndex != startIndex); + }while (con == nullptr && m_nextConnectionIndex != startIndex); return con; } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericConnection.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericConnection.cpp index 3b677c70..3c878e0a 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericConnection.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericConnection.cpp @@ -28,7 +28,7 @@ unsigned GenericConnection::ms_crcBytes = 0; GenericConnection::GenericConnection(const char *host, short port, GenericAPICore *apiCore, unsigned reconnectTimeout, unsigned noDataTimeoutSecs, unsigned noAckTimeoutSecs, unsigned incomingBufSizeInKB, unsigned outgoingBufSizeInKB, unsigned keepAlive, unsigned maxRecvMessageSizeInKB, unsigned holdTime) : m_bConnected(false), m_apiCore(apiCore), - m_con(NULL), + m_con(nullptr), m_host(host), m_nextHost(host), m_port(port), @@ -72,8 +72,8 @@ GenericConnection::~GenericConnection() { if(m_con) { - m_con->SetHandler(NULL); - m_con->Disconnect();//don't worry about onterminated being called, we've set it's handler to null, so it wont + m_con->SetHandler(nullptr); + m_con->Disconnect();//don't worry about onterminated being called, we've set it's handler to nullptr, so it wont m_con->Release(); } @@ -96,7 +96,7 @@ void GenericConnection::disconnect() { m_con->Disconnect(); //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); - m_con = NULL; + m_con = nullptr; } m_conState = CON_DISCONNECT; m_bConnected = false; @@ -112,7 +112,7 @@ void GenericConnection::OnTerminated(UdpConnection *con) if(m_con) { m_con->Release(); - m_con = NULL; + m_con = nullptr; } m_conState = CON_DISCONNECT; m_bConnected = false; @@ -146,7 +146,7 @@ void GenericConnection::OnRoutePacket(UdpConnection *con, const unsigned char *d get(iter, type); get(iter, track); #endif - GenericResponse *res = NULL; + GenericResponse *res = nullptr; // the following if block is a temporary fix that prevents // a crash with a game team in which they occasionally find @@ -208,7 +208,7 @@ void GenericConnection::process(bool giveTime) { m_con->SetHandler(this); m_conState = CON_NEGOTIATE; - m_conTimeout = time(NULL) + m_reconnectTimeout; + m_conTimeout = time(nullptr) + m_reconnectTimeout; } break; case CON_NEGOTIATE: @@ -225,12 +225,12 @@ void GenericConnection::process(bool giveTime) m_apiCore->OnConnect(m_host.c_str(), m_port); m_bConnected = true; } - else if(time(NULL) > m_conTimeout) + else if(time(nullptr) > m_conTimeout) { // we did not connect m_con->Disconnect(); //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); - m_con = NULL; + m_con = nullptr; m_conState = CON_DISCONNECT; m_bConnected = false; } @@ -246,7 +246,7 @@ void GenericConnection::process(bool giveTime) { m_con->Disconnect(); //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); - m_con = NULL; + m_con = nullptr; } } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpConnection.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpConnection.cpp index c9952e9a..df2137bd 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpConnection.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpConnection.cpp @@ -96,7 +96,7 @@ void UdpConnection::Init(UdpManager *udpManager, UdpPlatformAddress destIp, int mLastClockSyncTime = 0; mDataHoldTime = 0; mGettingTime = false; - mHandler = NULL; + mHandler = nullptr; mOtherSideProtocolVersion = 0; mNoDataTimeout = mUdpManager->mParams.noDataTimeout; @@ -108,7 +108,7 @@ void UdpConnection::Init(UdpManager *udpManager, UdpPlatformAddress destIp, int mIcmpErrorRetryStartStamp = 0; // when the timer started for ICMP error retry delay (gets reset on a successful packet receive) mPortRemapRequestStartStamp = 0; - mEncryptXorBuffer = NULL; + mEncryptXorBuffer = nullptr; mEncryptExpansionBytes = 0; mOrderedCountOutgoing = 0; mOrderedCountOutgoing2 = 0; @@ -120,7 +120,7 @@ void UdpConnection::Init(UdpManager *udpManager, UdpPlatformAddress destIp, int mConnectAttemptTimeout = 0; mConnectionCreateTime = mUdpManager->CachedClock(); mSimulateOutgoingQueueBytes = 0; - mPassThroughData = NULL; + mPassThroughData = nullptr; mSilentDisconnect = false; mLastSendBin = 0; @@ -140,7 +140,7 @@ UdpConnection::~UdpConnection() { UdpGuard myGuard(&mGuard); - assert(mUdpManager == NULL); // this should not be possible, since the UdpManager holds a reference to us until we are disconnected and disassociated from the manager. If you are hitting this, then odds are the application is releasing the UdpConnection object more times than it should + assert(mUdpManager == nullptr); // this should not be possible, since the UdpManager holds a reference to us until we are disconnected and disassociated from the manager. If you are hitting this, then odds are the application is releasing the UdpConnection object more times than it should for (int i = 0; i < cReliableChannelCount; i++) delete mChannel[i]; @@ -189,7 +189,7 @@ void UdpConnection::InternalDisconnect(int flushTimeout, DisconnectReason reason if (mStatus == cStatusNegotiating) flushTimeout = 0; - if (mUdpManager != NULL) + if (mUdpManager != nullptr) { if (flushTimeout > 0) { @@ -219,7 +219,7 @@ void UdpConnection::InternalDisconnect(int flushTimeout, DisconnectReason reason } UdpManager *holdUdpManager = mUdpManager; - mUdpManager = NULL; + mUdpManager = nullptr; mStatus = cStatusDisconnected; // only hold a reference to the UdpManager if it is not currently being destructed. @@ -274,7 +274,7 @@ bool UdpConnection::Send(UdpChannel channel, const void *data, int dataLen) if (dataLen == 0) // zero length packets are ignored return(false); - assert(data != NULL); // can't send a null packet + assert(data != nullptr); // can't send a nullptr packet // zero-escape application packets that start with 0 if ((*(const udp_uchar *)data) == 0) @@ -290,7 +290,7 @@ bool UdpConnection::Send(UdpChannel channel, const LogicalPacket *packet) { UdpGuard myGuard(&mGuard); - assert(packet != NULL); // can't send a null packet + assert(packet != nullptr); // can't send a nullptr packet if (mStatus != cStatusConnected) // if we are no longer connected return(false); @@ -337,7 +337,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const udp_uchar *data, int { udp_uchar *bufPtr = tempBuffer; memcpy(bufPtr, data, dataLen); - if (data2 != NULL) + if (data2 != nullptr) memcpy(bufPtr + dataLen, data2, dataLen2); PhysicalSend(bufPtr, totalDataLen, true); return(true); @@ -350,9 +350,9 @@ bool UdpConnection::InternalSend(UdpChannel channel, const udp_uchar *data, int bufPtr[1] = cUdpPacketOrdered; UdpMisc::PutValue16(bufPtr + 2, (udp_ushort)(++mOrderedCountOutgoing & 0xffff)); memcpy(bufPtr + 4, data, dataLen); - if (data2 != NULL) + if (data2 != nullptr) memcpy(bufPtr + 4 + dataLen, data2, dataLen2); - BufferedSend(bufPtr, totalDataLen + 4, NULL, 0, true); + BufferedSend(bufPtr, totalDataLen + 4, nullptr, 0, true); return(true); break; } @@ -363,7 +363,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const udp_uchar *data, int bufPtr[1] = cUdpPacketOrdered2; UdpMisc::PutValue16(bufPtr + 2, (udp_ushort)(++mOrderedCountOutgoing2 & 0xffff)); memcpy(bufPtr + 4, data, dataLen); - if (data2 != NULL) + if (data2 != nullptr) memcpy(bufPtr + 4 + dataLen, data2, dataLen2); PhysicalSend(bufPtr, totalDataLen + 4, true); return(true); @@ -375,7 +375,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const udp_uchar *data, int case cUdpChannelReliable4: { int num = channel - cUdpChannelReliable1; - if (mChannel[num] == NULL) + if (mChannel[num] == nullptr) mChannel[num] = new UdpReliableChannel(num, this, &mUdpManager->mParams.reliable[num]); mChannel[num]->Send(data, dataLen, data2, dataLen2); return(true); @@ -410,9 +410,9 @@ void UdpConnection::GetStats(UdpConnectionStatistics *cs) { UdpGuard myGuard(&mGuard); - assert(cs != NULL); + assert(cs != nullptr); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; *cs = mConnectionStats; @@ -428,7 +428,7 @@ void UdpConnection::GetStats(UdpConnectionStatistics *cs) if (cs->syncTheirSent > 0) cs->percentReceivedSuccess = (float)cs->syncOurReceived / (float)cs->syncTheirSent; cs->reliableAveragePing = 0; - if (mChannel[0] != NULL) + if (mChannel[0] != nullptr) cs->reliableAveragePing = mChannel[0]->GetAveragePing(); } @@ -437,7 +437,7 @@ void UdpConnection::ProcessRawPacket(const UdpManager::PacketHistoryEntry *e) UdpRef ref(this); UdpGuard guard(&mGuard); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; if (e->mLen == 0) @@ -572,7 +572,7 @@ void UdpConnection::ProcessRawPacket(const UdpManager::PacketHistoryEntry *e) *decryptPtr++ = finalStart[1]; int len = (this->*(mDecryptFunction[j]))(decryptPtr, finalStart + 2, finalLen - 2); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; if (len == -1) @@ -627,7 +627,7 @@ void UdpConnection::ProcessCookedPacket(const udp_uchar *data, int dataLen) { udp_uchar buf[256]; udp_uchar *bufPtr; - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; if (data[0] == 0 && dataLen > 1) @@ -826,7 +826,7 @@ void UdpConnection::ProcessCookedPacket(const udp_uchar *data, int dataLen) // (while processing this packet) ended up touching the packet-data and corrupting the next // packet in the multi-sequence. CallbackCorruptPacket(data, dataLen, cUdpCorruptionReasonMultiPacket); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; } else @@ -943,7 +943,7 @@ void UdpConnection::ProcessCookedPacket(const udp_uchar *data, int dataLen) case cUdpPacketFragment4: { int num = (data[1] - cUdpPacketReliable1) % cReliableChannelCount; - if (mChannel[num] == NULL) + if (mChannel[num] == nullptr) mChannel[num] = new UdpReliableChannel(num, this, &mUdpManager->mParams.reliable[num]); mChannel[num]->ReliablePacket(data, dataLen); break; @@ -954,7 +954,7 @@ void UdpConnection::ProcessCookedPacket(const udp_uchar *data, int dataLen) case cUdpPacketAck4: { int num = data[1] - cUdpPacketAck1; - if (mChannel[num] != NULL) + if (mChannel[num] != nullptr) mChannel[num]->AckPacket(data, dataLen); break; } @@ -964,7 +964,7 @@ void UdpConnection::ProcessCookedPacket(const udp_uchar *data, int dataLen) case cUdpPacketAckAll4: { int num = data[1] - cUdpPacketAckAll1; - if (mChannel[num] != NULL) + if (mChannel[num] != nullptr) mChannel[num]->AckAllPacket(data, dataLen); break; } @@ -1015,7 +1015,7 @@ void UdpConnection::FlagPortUnreachable() void UdpConnection::GiveTime(bool fromManager) { UdpGuard myGuard(&mGuard); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; if (fromManager && GetRefCount() == 2) @@ -1115,11 +1115,11 @@ void UdpConnection::InternalGiveTime() int totalPendingBytes = 0; for (int i = 0; i < cReliableChannelCount; i++) { - if (mChannel[i] != NULL) + if (mChannel[i] != nullptr) { totalPendingBytes += mChannel[i]->TotalPendingBytes(); int myNext = mChannel[i]->GiveTime(); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; // giving the reliable channel time caused it to callback the application which may disconnect us nextSchedule = udpMin(nextSchedule, myNext); } @@ -1208,7 +1208,7 @@ void UdpConnection::InternalGiveTime() break; } - if (mUdpManager != NULL) + if (mUdpManager != nullptr) { // safety to prevent us for scheduling ourselves for a time period that has already passed, // as doing so could result in infinite looping in the priority queue processing. @@ -1227,7 +1227,7 @@ int UdpConnection::TotalPendingBytes() const int total = 0; for (int i = 0; i < cReliableChannelCount; i++) { - if (mChannel[i] != NULL) + if (mChannel[i] != nullptr) total += mChannel[i]->TotalPendingBytes(); } return(total); @@ -1293,7 +1293,7 @@ void UdpConnection::ExpireReceiveBin() void UdpConnection::PhysicalSend(const udp_uchar *data, int dataLen, bool appendAllowed) { - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; // if we attempt to do a physical send (ie. encrypt/compress/crc a packet) while we are not connected @@ -1322,7 +1322,7 @@ void UdpConnection::PhysicalSend(const udp_uchar *data, int dataLen, bool append // we know this internal packet will not be a connect or confirm packet since they are sent directly to RawSend to avoid getting encrypted *destPtr++ = finalStart[1]; int len = (this->*(mEncryptFunction[j]))(destPtr, finalStart + 2, finalLen - 2); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; // if this assert triggers, it means the encryption pass expanded the size of the encrypted @@ -1393,8 +1393,8 @@ void UdpConnection::PhysicalSend(const udp_uchar *data, int dataLen, bool append // can note where the ack was placed and replace it udp_uchar *UdpConnection::BufferedSend(const udp_uchar *data, int dataLen, const udp_uchar *data2, int dataLen2, bool appendAllowed) { - if (mUdpManager == NULL) - return(NULL); + if (mUdpManager == nullptr) + return(nullptr); int used = (int)(mMultiBufferPtr - mMultiBufferData); int actualMaxDataHoldSize = udpMin(mUdpManager->mParams.maxDataHoldSize, mConnectionConfig.maxRawPacketSize); @@ -1409,7 +1409,7 @@ udp_uchar *UdpConnection::BufferedSend(const udp_uchar *data, int dataLen, const FlushMultiBuffer(); // now send it (the multi-buffer is empty if you need to use it temporarily to concatenate two data chunks -- it is large enough to hold the largest raw packet) - if (data2 != NULL) + if (data2 != nullptr) { memcpy(mMultiBufferData, data, dataLen); memcpy(mMultiBufferData + dataLen, data2, dataLen2); @@ -1417,7 +1417,7 @@ udp_uchar *UdpConnection::BufferedSend(const udp_uchar *data, int dataLen, const } else PhysicalSend(data, dataLen, appendAllowed); - return(NULL); + return(nullptr); } // if this data will not fit into buffer @@ -1445,7 +1445,7 @@ udp_uchar *UdpConnection::BufferedSend(const udp_uchar *data, int dataLen, const udp_uchar *placementPtr = mMultiBufferPtr; memcpy(mMultiBufferPtr, data, dataLen); mMultiBufferPtr += dataLen; - if (data2 != NULL) + if (data2 != nullptr) { memcpy(mMultiBufferPtr, data2, dataLen2); mMultiBufferPtr += dataLen2; @@ -1454,7 +1454,7 @@ udp_uchar *UdpConnection::BufferedSend(const udp_uchar *data, int dataLen, const if ((mMultiBufferPtr - mMultiBufferData) >= actualMaxDataHoldSize) { FlushMultiBuffer(); - placementPtr = NULL; // it got flushed + placementPtr = nullptr; // it got flushed } return(placementPtr); } @@ -1474,7 +1474,7 @@ void UdpConnection::FlushMultiBuffer() // notify all the reliable channels to clear their buffered acks for (int i = 0; i < cReliableChannelCount; i++) { - if (mChannel[i] != NULL) + if (mChannel[i] != nullptr) { mChannel[i]->ClearBufferedAck(); } @@ -1684,7 +1684,7 @@ void UdpConnection::SetupEncryptModel() mEncryptExpansionBytes += 0; // set up encrypt buffer (random numbers generated based on seed) - if (mEncryptXorBuffer == NULL) + if (mEncryptXorBuffer == nullptr) { int len = ((mUdpManager->mParams.maxRawPacketSize + 1) / 4) * 4; mEncryptXorBuffer = new udp_uchar[len]; @@ -1718,7 +1718,7 @@ void UdpConnection::GetChannelStatus(UdpChannel channel, ChannelStatus *channelS case cUdpChannelReliable2: case cUdpChannelReliable3: case cUdpChannelReliable4: - if (mChannel[channel - cUdpChannelReliable1] != NULL) + if (mChannel[channel - cUdpChannelReliable1] != nullptr) { mChannel[channel - cUdpChannelReliable1]->GetChannelStatus(channelStatus); } @@ -1763,7 +1763,7 @@ char *UdpConnection::GetDestinationString(char *buf, int bufLen) const UdpGuard myGuard(&mGuard); if (bufLen < 22) - return(NULL); + return(nullptr); UdpPlatformAddress ip = GetDestinationIp(); int port = GetDestinationPort(); char hold[256]; @@ -1794,7 +1794,7 @@ void UdpConnection::OnRoutePacket(const udp_uchar *data, int dataLen) { UdpGuard myGuard(&mHandlerGuard); - if (mHandler != NULL) + if (mHandler != nullptr) { mHandler->OnRoutePacket(this, data, dataLen); } @@ -1814,7 +1814,7 @@ void UdpConnection::OnRoutePacket(const udp_uchar *data, int dataLen) void UdpConnection::OnConnectComplete() { UdpGuard myGuard(&mHandlerGuard); - if (mHandler != NULL) + if (mHandler != nullptr) { mHandler->OnConnectComplete(this); } @@ -1823,7 +1823,7 @@ void UdpConnection::OnConnectComplete() void UdpConnection::OnTerminated() { UdpGuard myGuard(&mHandlerGuard); - if (mHandler != NULL) + if (mHandler != nullptr) { mHandler->OnTerminated(this); } @@ -1832,7 +1832,7 @@ void UdpConnection::OnTerminated() void UdpConnection::OnCrcReject(const udp_uchar *data, int dataLen) { UdpGuard myGuard(&mHandlerGuard); - if (mHandler != NULL) + if (mHandler != nullptr) { mHandler->OnCrcReject(this, data, dataLen); } @@ -1841,7 +1841,7 @@ void UdpConnection::OnCrcReject(const udp_uchar *data, int dataLen) void UdpConnection::OnPacketCorrupt(const udp_uchar *data, int dataLen, UdpCorruptionReason reason) { UdpGuard myGuard(&mHandlerGuard); - if (mHandler != NULL) + if (mHandler != nullptr) { mHandler->OnPacketCorrupt(this, data, dataLen, reason); } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpConnection.h b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpConnection.h index 9d64e460..253e9139 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpConnection.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpConnection.h @@ -153,7 +153,7 @@ class UdpConnection : public UdpGuardedRefCount, public PriorityQueueMember, pub int ConnectionAge() const; // returns the UdpManager object that is managing this connection - // will return NULL if the connection has been disconnected for some reason (because disconnecting severes the link to UdpManager) + // will return nullptr if the connection has been disconnected for some reason (because disconnecting severes the link to UdpManager) UdpManager *GetUdpManager() const; // returns the 32-bit encryption-code that was negotiated as part of the connection-establishment process. @@ -234,9 +234,9 @@ class UdpConnection : public UdpGuardedRefCount, public PriorityQueueMember, pub friend class UdpManager; friend class UdpReliableChannel; - // note: if connectPacket is NULL, that means this connection object is being created to establish + // note: if connectPacket is nullptr, that means this connection object is being created to establish // a new connection to the specified ip/port (ie. the connection starts out in cStatusNegotiating mode) - // if connectPacket is non-NULL, that menas this connection object is being created to handle an + // if connectPacket is non-nullptr, that menas this connection object is being created to handle an // incoming connect request and it will start out in cStatusConnected mode. UdpConnection(UdpManager *udpManager, UdpPlatformAddress destIp, int destPort, int timeout); // starts connection-establishment protocol UdpConnection(UdpManager *udpManager, const UdpManager::PacketHistoryEntry *e); // starts already connected, replying to connection request @@ -281,7 +281,7 @@ class UdpConnection : public UdpGuardedRefCount, public PriorityQueueMember, pub void RawSend(const udp_uchar *data, int dataLen); // nothing happens to the data here, it is given to the udpmanager and sent out the port void PhysicalSend(const udp_uchar *data, int dataLen, bool appendAllowed); // sends a physical packet (encrypts and adds crc bytes) udp_uchar *BufferedSend(const udp_uchar *data, int dataLen, const udp_uchar *data2, int dataLen2, bool appendAllowed); // buffers logical packets waiting til we have more data (makes multi-packets) - bool InternalSend(UdpChannel channel, const udp_uchar *data, int dataLen, const udp_uchar *data2 = NULL, int dataLen2 = 0); + bool InternalSend(UdpChannel channel, const udp_uchar *data, int dataLen, const udp_uchar *data2 = nullptr, int dataLen2 = 0); void InternalGiveTime(); void InternalDisconnect(int flushTimeout, DisconnectReason reason); @@ -527,7 +527,7 @@ inline void UdpConnection::ScheduleTimeNow() // prevents us from reprioritizing to 0, only to shortly thereafter be reprioritized to where we actually belong. if (!mGettingTime) { - if (mUdpManager != NULL) + if (mUdpManager != nullptr) mUdpManager->SetPriority(this, 0); } } @@ -575,7 +575,7 @@ inline int UdpConnection::LastReceive(UdpClockStamp useStamp) const inline int UdpConnection::LastReceive() const { UdpGuard guard(&mGuard); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return(0); return(mUdpManager->CachedClockElapsed(mLastReceiveTime)); } @@ -583,7 +583,7 @@ inline int UdpConnection::LastReceive() const inline int UdpConnection::ConnectionAge() const { UdpGuard guard(&mGuard); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return(0); return(mUdpManager->CachedClockElapsed(mConnectionCreateTime)); } @@ -591,7 +591,7 @@ inline int UdpConnection::ConnectionAge() const inline int UdpConnection::LastSend() const { UdpGuard guard(&mGuard); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return(0); return(mUdpManager->CachedClockElapsed(mLastSendTime)); } @@ -599,7 +599,7 @@ inline int UdpConnection::LastSend() const inline udp_ushort UdpConnection::ServerSyncStampShort() const { UdpGuard guard(&mGuard); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return(0); return((udp_ushort)(mUdpManager->LocalSyncStampShort() + (mSyncTimeDelta & 0xffff))); } @@ -607,7 +607,7 @@ inline udp_ushort UdpConnection::ServerSyncStampShort() const inline udp_uint UdpConnection::ServerSyncStampLong() const { UdpGuard guard(&mGuard); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return(0); return(mUdpManager->LocalSyncStampLong() + mSyncTimeDelta); } @@ -649,7 +649,7 @@ inline UdpConnection::DisconnectReason UdpConnection::GetOtherSideDisconnectReas inline int UdpConnection::OutgoingBytesLastSecond() { UdpGuard guard(&mGuard); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return(0); ExpireSendBin(); @@ -659,7 +659,7 @@ inline int UdpConnection::OutgoingBytesLastSecond() inline int UdpConnection::IncomingBytesLastSecond() { UdpGuard guard(&mGuard); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return(0); ExpireReceiveBin(); diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpDriverLinux.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpDriverLinux.cpp index da7bcc5c..aa11f5cd 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpDriverLinux.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpDriverLinux.cpp @@ -101,7 +101,7 @@ bool UdpPlatformDriver::SocketOpen(int port, int incomingBufferSize, int outgoin addr_loc.sin_family = PF_INET; addr_loc.sin_port = htons((unsigned short)port); addr_loc.sin_addr.s_addr = htonl(INADDR_ANY); - if (bindIpAddress != NULL && bindIpAddress[0] != 0) + if (bindIpAddress != nullptr && bindIpAddress[0] != 0) { unsigned long address = inet_addr(bindIpAddress); if (address != INADDR_NONE) @@ -201,7 +201,7 @@ bool UdpPlatformDriver::GetHostByName(UdpPlatformAddress *ipAddress, const char { struct hostent *lphp; lphp = gethostbyname(hostName); - if (lphp == NULL) + if (lphp == nullptr) { address = 0; } @@ -223,7 +223,7 @@ bool UdpPlatformDriver::GetSelfAddress(UdpPlatformAddress *ipAddress, bool prefe if (gethostname(hostname, sizeof(hostname)) == 0) { struct hostent *entry = gethostbyname(hostname); - if (entry != NULL) + if (entry != nullptr) { for (int i = 0; entry->h_addr_list[i] != 0; i++) { @@ -273,7 +273,7 @@ UdpClockStamp UdpPlatformDriver::Clock() UdpGuard guard(&mData->clockGuard); struct timeval tv; - gettimeofday(&tv, NULL); + gettimeofday(&tv, nullptr); UdpClockStamp cs = static_cast(tv.tv_sec) * 1000 + static_cast(tv.tv_usec / 1000); cs += mData->currentCorrection; if (cs < mData->lastStamp) @@ -319,7 +319,7 @@ int IcmpReceive(SOCKET socket, unsigned *address, int *port) return(-1); struct cmsghdr *cmsg; - for(cmsg = CMSG_FIRSTHDR(&msgh); cmsg != NULL; cmsg = CMSG_NXTHDR(&msgh, cmsg)) + for(cmsg = CMSG_FIRSTHDR(&msgh); cmsg != nullptr; cmsg = CMSG_NXTHDR(&msgh, cmsg)) { if(cmsg->cmsg_level == SOL_IP && cmsg->cmsg_type == IP_RECVERR) { @@ -378,7 +378,7 @@ void *GoThread(void *param) thread->mThreadData->running = false; thread->mThreadData->handle = 0; thread->Release(); - return(NULL); + return(nullptr); } UdpPlatformThreadObject::~UdpPlatformThreadObject() @@ -435,7 +435,7 @@ char *UdpPlatformAddress::GetAddress(char *buffer, int bufferLen) const *buffer = 0; return(buffer); } - assert(buffer != NULL); + assert(buffer != nullptr); sprintf(buffer, "%d.%d.%d.%d", mData[0], mData[1], mData[2], mData[3]); return(buffer); } @@ -444,7 +444,7 @@ void UdpPlatformAddress::SetAddress(const char *address) { for (int i = 0; i < 4; i++) { - mData[i] = (unsigned char)strtol(address, NULL, 10); + mData[i] = (unsigned char)strtol(address, nullptr, 10); while (*address >= '0' && *address <= '9') address++; if (*address != 0) diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpDriverWindows.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpDriverWindows.cpp index 04c0c4d0..4a2a80e7 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpDriverWindows.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpDriverWindows.cpp @@ -102,7 +102,7 @@ bool UdpPlatformDriver::SocketOpen(int port, int incomingBufferSize, int outgoin addr_loc.sin_family = PF_INET; addr_loc.sin_port = htons((unsigned short)port); addr_loc.sin_addr.s_addr = htonl(INADDR_ANY); - if (bindIpAddress != NULL && bindIpAddress[0] != 0) + if (bindIpAddress != nullptr && bindIpAddress[0] != 0) { unsigned long address = inet_addr(bindIpAddress); if (address != INADDR_NONE) @@ -205,7 +205,7 @@ bool UdpPlatformDriver::GetHostByName(UdpPlatformAddress *ipAddress, const char { struct hostent *lphp; lphp = gethostbyname(hostName); - if (lphp == NULL) + if (lphp == nullptr) { address = 0; } @@ -227,7 +227,7 @@ bool UdpPlatformDriver::GetSelfAddress(UdpPlatformAddress *ipAddress, bool prefe if (gethostname(hostname, sizeof(hostname)) == 0) { struct hostent *entry = gethostbyname(hostname); - if (entry != NULL) + if (entry != nullptr) { for (int i = 0; entry->h_addr_list[i] != 0; i++) { @@ -329,10 +329,10 @@ unsigned __stdcall GoThread(void *param) UdpPlatformThreadObject::~UdpPlatformThreadObject() { #ifndef UDPLIBRARY_SINGLE_THREAD - if (mThreadData->handle != NULL) + if (mThreadData->handle != nullptr) { CloseHandle(mThreadData->handle); - mThreadData->handle = NULL; + mThreadData->handle = nullptr; } #endif delete mThreadData; @@ -343,7 +343,7 @@ void UdpPlatformThreadObject::Start() AddRef(); #ifndef UDPLIBRARY_SINGLE_THREAD unsigned threadId; - mThreadData->handle = (HANDLE)_beginthreadex(NULL, 0, &GoThread, this, 0, &threadId); + mThreadData->handle = (HANDLE)_beginthreadex(nullptr, 0, &GoThread, this, 0, &threadId); #else GoThread(this); // run it inline in main thread (blocks til it's finished, so odds are it won't work, but they shouldn't be using it anyhow in this mode) #endif @@ -352,7 +352,7 @@ void UdpPlatformThreadObject::Start() UdpPlatformThreadObject::UdpPlatformThreadObject() { mThreadData = new UdpPlatformThreadData; - mThreadData->handle = NULL; + mThreadData->handle = nullptr; mThreadData->running = false; } @@ -389,7 +389,7 @@ char *UdpPlatformAddress::GetAddress(char *buffer, int bufferLen) const *buffer = 0; return(buffer); } - assert(buffer != NULL); + assert(buffer != nullptr); sprintf(buffer, "%d.%d.%d.%d", mData[0], mData[1], mData[2], mData[3]); return(buffer); } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpHashTable.h b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpHashTable.h index 10af003d..9f24044e 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpHashTable.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpHashTable.h @@ -38,11 +38,11 @@ template class HashTable bool Remove(T& obj, int hashValue); void Reset(); // removes all entries from the table - T *FindFirst(int hashValue) const; // returns NULL if not found - T *FindNext(T *prevResult) const; // returns NULL if not found + T *FindFirst(int hashValue) const; // returns nullptr if not found + T *FindNext(T *prevResult) const; // returns nullptr if not found - T *WalkFirst() const; // returns NULL if not found - T *WalkNext(T *prevResult) const; // returns NULL if not found + T *WalkFirst() const; // returns nullptr if not found + T *WalkNext(T *prevResult) const; // returns nullptr if not found void Resize(int hashSize); // the actual hash size will be rounded up to the next larger prime number (very slow, not recommended) void GetStatistics(HashTableStatistics *stats) const; @@ -64,7 +64,7 @@ template class HashTable template HashTable::HashTable(int hashSize) { - mTable = NULL; + mTable = nullptr; mTableSize = 0; mEntryCount = 0; mStatUsedSlots = 0; @@ -84,9 +84,9 @@ template void HashTable::Insert(T& obj, int hashValue) entry->hashValue = hashValue; int spot = ((unsigned)hashValue) % mTableSize; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) { - entry->nextEntry = NULL; + entry->nextEntry = nullptr; mTable[spot] = entry; mStatUsedSlots++; } @@ -103,14 +103,14 @@ template bool HashTable::Remove(T& obj, int hashValue) int spot = ((unsigned)hashValue) % mTableSize; HashEntry* next = mTable[spot]; HashEntry** prev = &mTable[spot]; - while (next != NULL) + while (next != nullptr) { if (next->obj == obj && next->hashValue == hashValue) { *prev = next->nextEntry; delete next; mEntryCount--; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) mStatUsedSlots--; return(true); break; @@ -127,17 +127,17 @@ template void HashTable::Reset() for (int spot = 0; spot < mTableSize; spot++) { HashEntry *curr = mTable[spot]; - if (curr != NULL) + if (curr != nullptr) { mStatUsedSlots--; - while (curr != NULL) + while (curr != nullptr) { HashEntry *next = curr->nextEntry; delete curr; mEntryCount--; curr = next; } - mTable[spot] = NULL; + mTable[spot] = nullptr; } } } @@ -145,13 +145,13 @@ template void HashTable::Reset() template T *HashTable::FindFirst(int hashValue) const { HashEntry *entry = mTable[((unsigned)hashValue) % mTableSize]; - while (entry != NULL) + while (entry != nullptr) { if (entry->hashValue == hashValue) return(&entry->obj); entry = entry->nextEntry; } - return(NULL); + return(nullptr); } template T *HashTable::FindNext(T *prevResult) const @@ -159,13 +159,13 @@ template T *HashTable::FindNext(T *prevResult) const HashEntry *entry = (HashEntry *)(((char *)prevResult) - offsetof(HashEntry, obj)); int hashValue = entry->hashValue; entry = entry->nextEntry; - while (entry != NULL) + while (entry != nullptr) { if (entry->hashValue == hashValue) return(&entry->obj); entry = entry->nextEntry; } - return(NULL); + return(nullptr); } template T *HashTable::WalkFirst() const @@ -173,10 +173,10 @@ template T *HashTable::WalkFirst() const for (int bucket = 0; bucket < mTableSize; bucket++) { HashEntry *entry = mTable[bucket]; - if (entry != NULL) + if (entry != nullptr) return(&entry->obj); } - return(NULL); + return(nullptr); } template T *HashTable::WalkNext(T *prevResult) const @@ -185,17 +185,17 @@ template T *HashTable::WalkNext(T *prevResult) const int bucket = ((unsigned)entry->hashValue) % mTableSize; entry = entry->nextEntry; - if (entry != NULL) + if (entry != nullptr) return(&entry->obj); bucket++; // go onto next bucket for (; bucket < mTableSize; bucket++) { HashEntry *entry = mTable[bucket]; - if (entry != NULL) + if (entry != nullptr) return(&entry->obj); } - return(NULL); + return(nullptr); } template void HashTable::Resize(int hashSize) @@ -215,16 +215,16 @@ template void HashTable::Resize(int hashSize) for (int i = 0; i < oldSize; i++) { HashEntry* next = oldTable[i]; - while (next != NULL) + while (next != nullptr) { HashEntry* hold = next; next = next->nextEntry; // insert hold into new table int spot = ((unsigned)hold->hashValue) % mTableSize; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) { - hold->nextEntry = NULL; + hold->nextEntry = nullptr; mTable[spot] = hold; mStatUsedSlots++; } @@ -284,11 +284,11 @@ template class ObjectHashTable bool Remove(T *obj); void Reset(); // removes all entries from the table - T *FindFirst(int hashValue) const; // returns NULL if not found - T *FindNext(T *prevResult) const; // returns NULL if not found + T *FindFirst(int hashValue) const; // returns nullptr if not found + T *FindNext(T *prevResult) const; // returns nullptr if not found - T *WalkFirst() const; // returns NULL if not found - T *WalkNext(T *prevResult) const; // returns NULL if not found + T *WalkFirst() const; // returns nullptr if not found + T *WalkNext(T *prevResult) const; // returns nullptr if not found void Resize(int hashSize); // the actual hash size will be rounded up to the next larger prime number (very slow, not recommended) void GetStatistics(HashTableStatistics *stats) const; @@ -303,7 +303,7 @@ template class ObjectHashTable template ObjectHashTable::ObjectHashTable(int hashSize) { - mTable = NULL; + mTable = nullptr; mTableSize = 0; mEntryCount = 0; mStatUsedSlots = 0; @@ -320,9 +320,9 @@ template void ObjectHashTable::Insert(T *obj, int static_cast(obj)->mHashValue = hashValue; int spot = ((unsigned)hashValue) % mTableSize; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) { - static_cast(obj)->mHashNextEntry = NULL; + static_cast(obj)->mHashNextEntry = nullptr; mTable[spot] = obj; mStatUsedSlots++; } @@ -339,14 +339,14 @@ template bool ObjectHashTable::Remove(T *obj) int spot = ((unsigned)static_cast(obj)->mHashValue) % mTableSize; T *cur = mTable[spot]; T **prev = &mTable[spot]; - while (cur != NULL) + while (cur != nullptr) { if (cur == obj) { *prev = static_cast(cur)->mHashNextEntry; - static_cast(cur)->mHashNextEntry = NULL; + static_cast(cur)->mHashNextEntry = nullptr; mEntryCount--; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) mStatUsedSlots--; return(true); break; @@ -368,13 +368,13 @@ template void ObjectHashTable::Reset() template T *ObjectHashTable::FindFirst(int hashValue) const { T *entry = mTable[((unsigned)hashValue) % mTableSize]; - while (entry != NULL) + while (entry != nullptr) { if (static_cast(entry)->mHashValue == hashValue) return(entry); entry = static_cast(entry)->mHashNextEntry; } - return(NULL); + return(nullptr); } template T *ObjectHashTable::FindNext(T *prevResult) const @@ -382,13 +382,13 @@ template T *ObjectHashTable::FindNext(T *prevResul T *entry = prevResult; int hashValue = static_cast(entry)->mHashValue; entry = static_cast(entry)->mHashNextEntry; - while (entry != NULL) + while (entry != nullptr) { if (static_cast(entry)->mHashValue == hashValue) return(entry); entry = static_cast(entry)->mHashNextEntry; } - return(NULL); + return(nullptr); } template T *ObjectHashTable::WalkFirst() const @@ -396,10 +396,10 @@ template T *ObjectHashTable::WalkFirst() const for (int bucket = 0; bucket < mTableSize; bucket++) { T *entry = mTable[bucket]; - if (entry != NULL) + if (entry != nullptr) return(entry); } - return(NULL); + return(nullptr); } template T *ObjectHashTable::WalkNext(T *prevResult) const @@ -408,17 +408,17 @@ template T *ObjectHashTable::WalkNext(T *prevResul int bucket = ((unsigned)static_cast(entry)->mHashValue) % mTableSize; entry = static_cast(entry)->mHashNextEntry; - if (entry != NULL) + if (entry != nullptr) return(entry); bucket++; // go onto next bucket for (; bucket < mTableSize; bucket++) { entry = mTable[bucket]; - if (entry != NULL) + if (entry != nullptr) return(entry); } - return(NULL); + return(nullptr); } template void ObjectHashTable::Resize(int hashSize) @@ -438,16 +438,16 @@ template void ObjectHashTable::Resize(int hashSize for (int i = 0; i < oldSize; i++) { T *cur = oldTable[i]; - while (cur != NULL) + while (cur != nullptr) { T *hold = cur; cur = static_cast(cur)->mHashNextEntry; // insert hold into new table int spot = ((unsigned)static_cast(hold)->mHashValue) % mTableSize; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) { - static_cast(hold)->mHashNextEntry = NULL; + static_cast(hold)->mHashNextEntry = nullptr; mTable[spot] = hold; mStatUsedSlots++; } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpLinkedList.h b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpLinkedList.h index 6fab2d03..ad2d7e63 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpLinkedList.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpLinkedList.h @@ -14,8 +14,8 @@ template class UdpLinkedList; template class UdpLinkedListMember { public: - UdpLinkedListMember() { mPrev = NULL; mNext = NULL; } - UdpLinkedListMember(const UdpLinkedListMember &) { mPrev = NULL; mNext = NULL; } + UdpLinkedListMember() { mPrev = nullptr; mNext = nullptr; } + UdpLinkedListMember(const UdpLinkedListMember &) { mPrev = nullptr; mNext = nullptr; } ~UdpLinkedListMember() {} #if defined(_MSC_VER) && (_MSC_VER < 1300) // MSVC 7.0 is the first version to support friend templates @@ -60,8 +60,8 @@ template class UdpLinkedList template UdpLinkedList::UdpLinkedList(UdpLinkedListMember T::*node) { - mHead = NULL; - mTail = NULL; + mHead = nullptr; + mTail = nullptr; mNode = node; mCount = 0; } @@ -98,7 +98,7 @@ template int UdpLinkedList::Count() const template T *UdpLinkedList::Position(int index) const { T *cur = mHead; - while (cur != NULL && index > 0) + while (cur != nullptr && index > 0) { cur = Next(cur); index--; @@ -109,43 +109,43 @@ template T *UdpLinkedList::Position(int index) const template T *UdpLinkedList::Remove(T *cur) { UdpLinkedListMember *node = &(cur->*mNode); - if (node->mPrev == NULL) + if (node->mPrev == nullptr) mHead = node->mNext; else ((node->mPrev)->*mNode).mNext = node->mNext; - if (node->mNext == NULL) + if (node->mNext == nullptr) mTail = node->mPrev; else ((node->mNext)->*mNode).mPrev = node->mPrev; - node->mNext = NULL; - node->mPrev = NULL; + node->mNext = nullptr; + node->mPrev = nullptr; mCount--; return(cur); } template T *UdpLinkedList::RemoveHead() { - if (mHead == NULL) - return(NULL); + if (mHead == nullptr) + return(nullptr); return(Remove(mHead)); } template T *UdpLinkedList::RemoveTail() { - if (mTail == NULL) - return(NULL); + if (mTail == nullptr) + return(nullptr); return(Remove(mTail)); } template T *UdpLinkedList::InsertHead(T *cur) { - assert((cur->*mNode).mPrev == NULL); - assert((cur->*mNode).mNext == NULL); + assert((cur->*mNode).mPrev == nullptr); + assert((cur->*mNode).mNext == nullptr); (cur->*mNode).mNext = mHead; - if (mHead != NULL) + if (mHead != nullptr) { (mHead->*mNode).mPrev = cur; mHead = cur; @@ -161,12 +161,12 @@ template T *UdpLinkedList::InsertHead(T *cur) template T *UdpLinkedList::InsertTail(T *cur) { - assert((cur->*mNode).mPrev == NULL); - assert((cur->*mNode).mNext == NULL); + assert((cur->*mNode).mPrev == nullptr); + assert((cur->*mNode).mNext == nullptr); (cur->*mNode).mPrev = mTail; - if (mTail != NULL) + if (mTail != nullptr) { (mTail->*mNode).mNext = cur; mTail = cur; @@ -182,17 +182,17 @@ template T *UdpLinkedList::InsertTail(T *cur) template T *UdpLinkedList::InsertAfter(T *cur, T *prev) { - assert((cur->*mNode).mPrev == NULL); - assert((cur->*mNode).mNext == NULL); + assert((cur->*mNode).mPrev == nullptr); + assert((cur->*mNode).mNext == nullptr); - if (prev == NULL) + if (prev == nullptr) return(InsertHead(cur)); (cur->*mNode).mPrev = prev; (cur->*mNode).mNext = (prev->*mNode).mNext; (prev->*mNode).mNext = cur; - if ((cur->*mNode).mNext != NULL) + if ((cur->*mNode).mNext != nullptr) (((cur->*mNode).mNext)->*mNode).mPrev = cur; else mTail = cur; @@ -204,7 +204,7 @@ template T *UdpLinkedList::InsertAfter(T *cur, T *prev) template void UdpLinkedList::DeleteAll() { T *cur = First(); - while (cur != NULL) + while (cur != nullptr) { T *next = Next(cur); Remove(cur); @@ -216,7 +216,7 @@ template void UdpLinkedList::DeleteAll() template void UdpLinkedList::ReleaseAll() { T *cur = First(); - while (cur != NULL) + while (cur != nullptr) { T *next = Next(cur); Remove(cur); diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpLogicalPacket.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpLogicalPacket.cpp index 5ecce2fb..76171367 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpLogicalPacket.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpLogicalPacket.cpp @@ -31,7 +31,7 @@ SimpleLogicalPacket::SimpleLogicalPacket(const void *data, int dataLen) { mDataLen = dataLen; mData = new udp_uchar[mDataLen]; - if (data != NULL) + if (data != nullptr) memcpy(mData, data, mDataLen); } @@ -66,7 +66,7 @@ void SimpleLogicalPacket::SetDataLen(int len) GroupLogicalPacket::GroupLogicalPacket() : LogicalPacket() { mDataLen = 0; - mData = NULL; + mData = nullptr; } GroupLogicalPacket::~GroupLogicalPacket() @@ -76,13 +76,13 @@ GroupLogicalPacket::~GroupLogicalPacket() void GroupLogicalPacket::AddPacket(const LogicalPacket *packet) { - assert(packet != NULL); + assert(packet != nullptr); AddPacketInternal(packet->GetDataPtr(), packet->GetDataLen(), packet->IsInternalPacket()); } void GroupLogicalPacket::AddPacket(const void *data, int dataLen) { - assert(data != NULL); + assert(data != nullptr); assert(dataLen >= 0); AddPacketInternal(data, dataLen, false); } @@ -152,10 +152,10 @@ PooledLogicalPacket::PooledLogicalPacket(UdpManager *manager, int len) PooledLogicalPacket::~PooledLogicalPacket() { - if (mUdpManager != NULL) + if (mUdpManager != nullptr) { mUdpManager->PoolDestroyed(this); - mUdpManager = NULL; + mUdpManager = nullptr; } delete[] mData; @@ -168,7 +168,7 @@ void PooledLogicalPacket::AddRef() const void PooledLogicalPacket::Release() const { - if (GetRefCount() == 1 && mUdpManager != NULL) + if (GetRefCount() == 1 && mUdpManager != nullptr) { // the PoolReturn function steals our reference (ie, we don't release, they don't addref), this is for thread safety reasons mUdpManager->PoolReturn(const_cast(this)); @@ -208,9 +208,9 @@ void PooledLogicalPacket::SetDataLen(int len) void PooledLogicalPacket::SetData(const void *data, int dataLen, const void *data2, int dataLen2) { mDataLen = dataLen + dataLen2; - if (data != NULL) + if (data != nullptr) memcpy(mData, data, dataLen); - if (data2 != NULL) + if (data2 != nullptr) memcpy(mData + dataLen, data2, dataLen2); } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpLogicalPacket.h b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpLogicalPacket.h index 6a5962c4..8e1525a8 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpLogicalPacket.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpLogicalPacket.h @@ -81,7 +81,7 @@ class SimpleLogicalPacket : public LogicalPacket // it was originally created to allow the internal code to handle reliable data that was sent // via the Send(char *, int) api call. public: - SimpleLogicalPacket(const void *data, int dataLen); // data can be NULL if you want to populate it after it is allocated (get the pointer and write to it) + SimpleLogicalPacket(const void *data, int dataLen); // data can be nullptr if you want to populate it after it is allocated (get the pointer and write to it) virtual void *GetDataPtr(); virtual const void *GetDataPtr() const; virtual int GetDataLen() const; @@ -152,7 +152,7 @@ template class StructLogicalPacket : public LogicalPacket // with virtual functions) via this method as they may contain hidden data-members (such as pointers // to vtables). public: - StructLogicalPacket(T *initData = NULL); + StructLogicalPacket(T *initData = nullptr); virtual void *GetDataPtr(); virtual const void *GetDataPtr() const; virtual int GetDataLen() const; @@ -226,7 +226,7 @@ class PooledLogicalPacket : public LogicalPacket protected: friend class UdpManager; void TrueRelease() const; - void SetData(const void *data, int dataLen, const void *data2 = NULL, int dataLen2 = 0); + void SetData(const void *data, int dataLen, const void *data2 = nullptr, int dataLen2 = 0); UdpManager *mUdpManager; UdpLinkedListMember mAvailableLink; // for available linked list in manager UdpLinkedListMember mCreatedLink; // for created linked list in manager @@ -240,7 +240,7 @@ class PooledLogicalPacket : public LogicalPacket template FixedLogicalPacket::FixedLogicalPacket(const void *data, int dataLen) { mDataLen = dataLen; - if (data != NULL) + if (data != nullptr) memcpy(mData, data, mDataLen); } @@ -270,7 +270,7 @@ template void FixedLogicalPacket::SetDataLen(int l ///////////////////////////////////////////////////////////////////////// template StructLogicalPacket::StructLogicalPacket(T *initData) { - if (initData != NULL) + if (initData != nullptr) mStruct = *initData; } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpManager.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpManager.cpp index 5a63f361..2129e06f 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpManager.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpManager.cpp @@ -111,10 +111,10 @@ UdpManager::UdpManager(const UdpParams *params) : mConnectionList(&UdpConnection mParams.maxDataHoldSize = udpMin(mParams.maxDataHoldSize, mParams.maxRawPacketSize); mParams.packetHistoryMax = udpMax(1, mParams.packetHistoryMax); mPacketHistoryPosition = 0; - mPassThroughData = NULL; - mBackgroundThread = NULL; + mPassThroughData = nullptr; + mBackgroundThread = nullptr; - if (mParams.udpDriver != NULL) + if (mParams.udpDriver != nullptr) { mDriver = mParams.udpDriver; } @@ -154,7 +154,7 @@ UdpManager::UdpManager(const UdpParams *params) : mConnectionList(&UdpConnection mSimulateOutgoingQueueBytes = 0; if (mParams.avoidPriorityQueue) - mPriorityQueue = NULL; + mPriorityQueue = nullptr; else mPriorityQueue = new PriorityQueue(mParams.maxConnections); @@ -181,7 +181,7 @@ UdpManager::~UdpManager() { // Since the background thread holds a reference to the UdpManager while it is running, this should // not be possible. The only way it could happen is if somebody released the manager who should not have. - assert(mBackgroundThread == NULL); + assert(mBackgroundThread == nullptr); // next thing we must do is tell all the connections to disconnect (which severs their link to this dying manager) // this has to be done first since they will call back into us and have themselves removed from our connection-list/priority-queue/etc @@ -191,7 +191,7 @@ UdpManager::~UdpManager() UdpGuard cg(&mConnectionGuard); UdpConnection *cur = mConnectionList.First(); - while (cur != NULL) + while (cur != nullptr) { cur->AddRef(); cur->InternalDisconnect(0, UdpConnection::cDisconnectReasonManagerDeleted); // this will cause it to remove us from the mConnectionList @@ -216,9 +216,9 @@ UdpManager::~UdpManager() UdpGuard guard(&mPoolGuard); PooledLogicalPacket *walk = mPoolCreatedList.RemoveHead(); - while (walk != NULL) + while (walk != nullptr) { - walk->mUdpManager = NULL; + walk->mUdpManager = nullptr; walk = mPoolCreatedList.RemoveHead(); } // next release the ones we have in our available pool @@ -232,11 +232,11 @@ UdpManager::~UdpManager() CloseSocket(); - if (mParams.udpDriver == NULL) + if (mParams.udpDriver == nullptr) { delete mDriver; // we were not given a driver to use, so we must own this driver we have, so destroy it } - mDriver = NULL; + mDriver = nullptr; delete mAddressHashTable; delete mConnectCodeHashTable; @@ -295,7 +295,7 @@ void UdpManager::ProcessDisconnectPending() UdpGuard guard(&mDisconnectPendingGuard); UdpConnection *entry = mDisconnectPendingList.First(); - while (entry != NULL) + while (entry != nullptr) { UdpConnection *next = mDisconnectPendingList.Next(entry); if (entry->GetStatus() == UdpConnection::cStatusDisconnected) @@ -309,12 +309,12 @@ void UdpManager::ProcessDisconnectPending() void UdpManager::RemoveConnection(UdpConnection *con) { - assert(con != NULL); // attemped to remove a NULL connection object + assert(con != nullptr); // attemped to remove a nullptr connection object // note: it's a bug to Remove a connection object that is already removed...should never be able to happen. UdpGuard cg(&mConnectionGuard); - if (mPriorityQueue != NULL) + if (mPriorityQueue != nullptr) { mPriorityQueue->Remove(con); } @@ -326,7 +326,7 @@ void UdpManager::RemoveConnection(UdpConnection *con) void UdpManager::AddConnection(UdpConnection *con) { - assert(con != NULL); // attemped to add a NULL connection object + assert(con != nullptr); // attemped to add a nullptr connection object UdpGuard cg(&mConnectionGuard); con->AddRef(); // UdpManager keeps a soft reference to the connection (ie. if it sees it is the only one holding a reference, it releases it) @@ -341,17 +341,17 @@ void UdpManager::FlushAllMultiBuffer() mConnectionGuard.Enter(); UdpConnection *cur = mConnectionList.First(); - if (cur != NULL) + if (cur != nullptr) cur->AddRef(); mConnectionGuard.Leave(); - while (cur != NULL) + while (cur != nullptr) { cur->FlushMultiBuffer(); mConnectionGuard.Enter(); UdpConnection *next = mConnectionList.Next(cur); - if (next != NULL) + if (next != nullptr) next->AddRef(); mConnectionGuard.Leave(); @@ -366,15 +366,15 @@ void UdpManager::DisconnectAll() mConnectionGuard.Enter(); UdpConnection *cur = mConnectionList.First(); - if (cur != NULL) + if (cur != nullptr) cur->AddRef(); mConnectionGuard.Leave(); - while (cur != NULL) + while (cur != nullptr) { mConnectionGuard.Enter(); UdpConnection *next = mConnectionList.Next(cur); - if (next != NULL) + if (next != nullptr) next->AddRef(); mConnectionGuard.Leave(); @@ -392,7 +392,7 @@ void UdpManager::DeliverEvents(int maxProcessingTime) for (;;) { CallbackEvent *ce = EventListPop(); - if (ce == NULL) + if (ce == nullptr) break; switch(ce->mEventType) @@ -426,13 +426,13 @@ void UdpManager::DeliverEvents(int maxProcessingTime) { { // guard block UdpGuard hguard(&mHandlerGuard); - if (mParams.handler != NULL) + if (mParams.handler != nullptr) { mParams.handler->OnConnectRequest(ce->mSource); } } - if (ce->mSource->GetHandler() == NULL) // if application did not set a handler, then the connection is considered refused + if (ce->mSource->GetHandler() == nullptr) // if application did not set a handler, then the connection is considered refused { ce->mSource->InternalDisconnect(0, UdpConnection::cDisconnectReasonConnectionRefused); } @@ -513,7 +513,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) PacketHistoryEntry *e = SimulationReceive(); #endif - if (e == NULL) + if (e == nullptr) { mLastEmptySocketBufferStamp = CachedClock(); break; @@ -545,7 +545,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) if (giveConnectionsTime) { - if (mPriorityQueue != NULL) + if (mPriorityQueue != nullptr) { // give time to everybody in the priority-queue that needs it UdpClockStamp curPriority = CachedClock(); @@ -570,10 +570,10 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) mConnectionGuard.Enter(); top = mPriorityQueue->TopRemove(curPriority); - if (top != NULL) + if (top != nullptr) top->AddRef(); // must always addref connections while inside the connection guard mConnectionGuard.Leave(); - if (top == NULL) + if (top == nullptr) break; top->GiveTime(true); @@ -593,17 +593,17 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) // give time to everybody mConnectionGuard.Enter(); UdpConnection *cur = mConnectionList.First(); - if (cur != NULL) + if (cur != nullptr) cur->AddRef(); mConnectionGuard.Leave(); - while (cur != NULL) + while (cur != nullptr) { cur->GiveTime(true); mConnectionGuard.Enter(); UdpConnection *next = mConnectionList.Next(cur); - if (next != NULL) + if (next != nullptr) next->AddRef(); mConnectionGuard.Leave(); @@ -621,13 +621,13 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) UdpClockStamp curStamp = CachedClock(); SimulateQueueEntry *entry = mSimulateOutgoingList.First(); - while (entry != NULL && curStamp >= mSimulateNextOutgoingTime) + while (entry != nullptr && curStamp >= mSimulateNextOutgoingTime) { mSimulateOutgoingList.Remove(entry); SimulateQueueEntry *next = mSimulateOutgoingList.First(); // simulate a delay before next packet is considered (ie. simple lag) - if (next != NULL) + if (next != nullptr) { int latencyDelay = (mSimulation.simulateOutgoingLatency - CachedClockElapsed(next->mQueueTime)); mSimulateNextOutgoingTime = curStamp + latencyDelay; @@ -644,7 +644,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) ActualSendHelper(entry->mData, entry->mDataLen, entry->mIp, entry->mPort); UdpConnection *con = AddressGetConnection(entry->mIp, entry->mPort); - if (con != NULL) + if (con != nullptr) { con->mSimulateOutgoingQueueBytes -= entry->mDataLen; con->Release(); @@ -664,12 +664,12 @@ UdpConnection *UdpManager::EstablishConnection(const char *serverAddress, int se { UdpGuard guard(&mGiveTimeGuard); // probably not needed, I don't see any reason we can't do this while GiveTime is happening in the background...the connection list is protected independently...still, better safe than sorry - assert(serverAddress != NULL); + assert(serverAddress != nullptr); char useServerAddress[512]; UdpLibrary::UdpMisc::Strncpy(useServerAddress, serverAddress, sizeof(useServerAddress)); char *portPtr = strchr(useServerAddress, ':'); - if (portPtr != NULL) + if (portPtr != nullptr) { *portPtr++ = 0; serverPort = atoi(portPtr); @@ -679,21 +679,21 @@ UdpConnection *UdpManager::EstablishConnection(const char *serverAddress, int se assert(serverPort != 0); // can't connect to no port if (mConnectionList.Count() >= mParams.maxConnections) - return(NULL); + return(nullptr); // get server address UdpPlatformAddress destIp; if (!mDriver->GetHostByName(&destIp, useServerAddress)) { - return(NULL); // could not resolve name + return(nullptr); // could not resolve name } // first, see if we already have a connection object managing this ip/port, if we do, then fail UdpConnection *con = AddressGetConnection(destIp, serverPort); - if (con != NULL) + if (con != nullptr) { con->Release(); - return(NULL); // already connected to this address/port + return(nullptr); // already connected to this address/port } return(new UdpConnection(this, destIp, serverPort, timeout)); } @@ -709,7 +709,7 @@ void UdpManager::GetStats(UdpManagerStatistics *stats) { UdpGuard sg(&mStatsGuard); - assert(stats != NULL); + assert(stats != nullptr); *stats = mManagerStats; stats->poolAvailable = mPoolAvailableList.Count(); stats->poolCreated = mPoolCreatedList.Count(); @@ -737,10 +737,10 @@ void UdpManager::DumpPacketHistory(const char *filename) const { UdpGuard guard(&mGiveTimeGuard); - assert(filename != NULL); + assert(filename != nullptr); assert(filename[0] != 0); FILE *file = fopen(filename, "wt"); - if (file != NULL) + if (file != nullptr) { // dump history of packets... for (int i = 0; i < mParams.packetHistoryMax; i++) @@ -789,7 +789,7 @@ UdpManager::PacketHistoryEntry *UdpManager::SimulationReceive() for (;;) { PacketHistoryEntry *entry = ActualReceive(); - if (entry == NULL) + if (entry == nullptr) break; SimulateQueueEntry *qe = new SimulateQueueEntry(entry->mBuffer, entry->mLen, entry->mIp, entry->mPort, curStamp); @@ -797,7 +797,7 @@ UdpManager::PacketHistoryEntry *UdpManager::SimulationReceive() } SimulateQueueEntry *winner = mSimulateIncomingList.First(); - if (winner != NULL && CachedClockElapsed(winner->mQueueTime) >= mSimulation.simulateIncomingLatency) + if (winner != nullptr && CachedClockElapsed(winner->mQueueTime) >= mSimulation.simulateIncomingLatency) { mSimulateIncomingList.Remove(winner); int pos = mPacketHistoryPosition; @@ -809,14 +809,14 @@ UdpManager::PacketHistoryEntry *UdpManager::SimulationReceive() delete winner; return(mPacketHistory[pos]); } - return(NULL); + return(nullptr); } UdpManager::PacketHistoryEntry *UdpManager::ActualReceive() { UdpClockStamp curStamp = CachedClock(); if (mSimulation.simulateIncomingByteRate > 0 && curStamp < mSimulateNextIncomingTime) - return(NULL); + return(nullptr); UdpPlatformAddress fromAddress; int fromPort = 0; @@ -855,7 +855,7 @@ UdpManager::PacketHistoryEntry *UdpManager::ActualReceive() } return(mPacketHistory[pos]); } - return(NULL); + return(nullptr); } void UdpManager::ActualSend(const udp_uchar *data, int dataLen, UdpPlatformAddress ip, int port) @@ -876,7 +876,7 @@ void UdpManager::ActualSend(const udp_uchar *data, int dataLen, UdpPlatformAddre return; // no room, packet gets lost UdpConnection *con = AddressGetConnection(ip, port); - if (con != NULL) + if (con != nullptr) { if (mSimulation.simulateDestinationOverloadLevel > 0 && con->mSimulateOutgoingQueueBytes + dataLen > mSimulation.simulateDestinationOverloadLevel) { @@ -928,7 +928,7 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) UdpConnection *con = AddressGetConnection(e->mIp, e->mPort); - if (con == NULL) + if (con == nullptr) { if (e->mLen == 0) // len = 0 = ICMP error { @@ -946,7 +946,7 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) if (mConnectionList.Count() >= mParams.maxConnections) return; // can't handle any more connections, so ignore this request entirely - if (mParams.handler != NULL) + if (mParams.handler != nullptr) { UdpConnection *newcon = new UdpConnection(this, e); CallbackConnectRequest(newcon); @@ -968,7 +968,7 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) int encryptCode = UdpMisc::GetValue32(ptr); UdpConnection *con = ConnectCodeGetConnection(connectCode); - if (con != NULL) + if (con != nullptr) { if (mParams.allowAddressRemapping || con->mIp == e->mIp) { @@ -1025,7 +1025,7 @@ UdpConnection *UdpManager::AddressGetConnection(UdpPlatformAddress ip, int port) UdpGuard guard(&mConnectionGuard); UdpConnection *found = mAddressHashTable->FindFirst(AddressHashValue(ip, port)); - while (found != NULL) + while (found != nullptr) { if (found->mIp == ip && found->mPort == port) { @@ -1034,7 +1034,7 @@ UdpConnection *UdpManager::AddressGetConnection(UdpPlatformAddress ip, int port) } found = mAddressHashTable->FindNext(found); } - return(NULL); + return(nullptr); } UdpConnection *UdpManager::ConnectCodeGetConnection(int connectCode) const @@ -1042,7 +1042,7 @@ UdpConnection *UdpManager::ConnectCodeGetConnection(int connectCode) const UdpGuard guard(&mConnectionGuard); UdpConnection *found = mConnectCodeHashTable->FindFirst(connectCode); - while (found != NULL) + while (found != nullptr) { if (found->mConnectCode == connectCode) { @@ -1051,7 +1051,7 @@ UdpConnection *UdpManager::ConnectCodeGetConnection(int connectCode) const } found = mConnectCodeHashTable->FindNext(found); } - return(NULL); + return(nullptr); } LogicalPacket *UdpManager::CreatePacket(const void *data, int dataLen, const void *data2, int dataLen2) @@ -1063,7 +1063,7 @@ LogicalPacket *UdpManager::CreatePacket(const void *data, int dataLen, const voi { UdpGuard guard(&mPoolGuard); PooledLogicalPacket *lp = mPoolAvailableList.RemoveHead(); - if (lp == NULL) + if (lp == nullptr) { // create a new pooled packet to fulfil request lp = new PooledLogicalPacket(this, mParams.pooledPacketSize); @@ -1091,7 +1091,7 @@ void UdpManager::PoolDestroyed(PooledLogicalPacket *packet) char *UdpManager::GetLocalString(char *buf, int bufLen) const { if (bufLen < 22) - return(NULL); + return(nullptr); UdpPlatformAddress ip = GetLocalIp(); int port = GetLocalPort(); char hold[256]; @@ -1103,7 +1103,7 @@ UdpManager::CallbackEvent *UdpManager::AvailableEventBorrow() { UdpGuard guard(&mAvailableEventGuard); CallbackEvent *ce = mAvailableEventList.RemoveHead(); - if (ce == NULL) + if (ce == nullptr) { ce = new CallbackEvent(); } @@ -1127,7 +1127,7 @@ void UdpManager::EventListAppend(CallbackEvent *ce) { UdpGuard guard(&mEventListGuard); mEventList.InsertTail(ce); - if (ce->mPayload != NULL) + if (ce->mPayload != nullptr) { mEventListBytes += ce->mPayload->GetDataLen(); } @@ -1137,7 +1137,7 @@ UdpManager::CallbackEvent *UdpManager::EventListPop() { UdpGuard guard(&mEventListGuard); CallbackEvent *event = mEventList.RemoveHead(); - if (event != NULL && event->mPayload != NULL) + if (event != nullptr && event->mPayload != nullptr) { mEventListBytes -= event->mPayload->GetDataLen(); } @@ -1148,7 +1148,7 @@ UdpManager::CallbackEvent *UdpManager::EventListPop() void UdpManager::ThreadStart() { UdpGuard guard(&mThreadGuard); - if (mBackgroundThread == NULL) + if (mBackgroundThread == nullptr) { mBackgroundThread = new UdpManagerThread(this, mParams.threadSleepTime); mBackgroundThread->Start(); @@ -1158,12 +1158,12 @@ void UdpManager::ThreadStart() void UdpManager::ThreadStop() { UdpGuard guard(&mThreadGuard); - if (mBackgroundThread != NULL) + if (mBackgroundThread != nullptr) { assert(mRefCount > 1); // caller must hold a reference, and thread must hold a reference, so this should be true. If it asserts, it means the caller is using a UdpManager that it does not hold a reference to. mBackgroundThread->Stop(true); mBackgroundThread->Release(); - mBackgroundThread = NULL; + mBackgroundThread = nullptr; } } @@ -1256,13 +1256,13 @@ void UdpManager::CallbackConnectRequest(UdpConnection *con) { { // guard block UdpGuard hguard(&mHandlerGuard); - if (mParams.handler != NULL) + if (mParams.handler != nullptr) { mParams.handler->OnConnectRequest(con); } } - if (con->GetHandler() == NULL) // if application did not set a handler, then the connection is considered refused + if (con->GetHandler() == nullptr) // if application did not set a handler, then the connection is considered refused { con->InternalDisconnect(0, UdpConnection::cDisconnectReasonConnectionRefused); } @@ -1276,8 +1276,8 @@ void UdpManager::CallbackConnectRequest(UdpConnection *con) UdpManager::CallbackEvent::CallbackEvent() { mEventType = cCallbackEventNone; - mSource = NULL; - mPayload = NULL; + mSource = nullptr; + mPayload = nullptr; mReason = cUdpCorruptionReasonNone; } @@ -1291,7 +1291,7 @@ void UdpManager::CallbackEvent::SetEventData(CallbackEventType eventType, UdpCon mEventType = eventType; mSource = con; mSource->AddRef(); - if (payload != NULL) + if (payload != nullptr) { mPayload = payload; mPayload->AddRef(); @@ -1300,16 +1300,16 @@ void UdpManager::CallbackEvent::SetEventData(CallbackEventType eventType, UdpCon void UdpManager::CallbackEvent::ClearEventData() { - if (mSource != NULL) + if (mSource != nullptr) { mSource->Release(); - mSource = NULL; + mSource = nullptr; } - if (mPayload != NULL) + if (mPayload != nullptr) { mPayload->Release(); - mPayload = NULL; + mPayload = nullptr; } } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpManager.h b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpManager.h index 3715a0b2..7c263031 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpManager.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpManager.h @@ -178,7 +178,7 @@ struct UdpParams // pointer equal to your object and the UdpManager will call it as appropriate. The UdpConnection object // also has a handler mechanism that replaces the other callback functions below, see UdpConnection::SetHandler // if a handler is specified, the callback function is ignored, even if specified. - // default = NULL (not used) + // default = nullptr (not used) UdpManagerHandler *handler; // this is the maximum number of connections that can be established by this manager, any incoming/outgoing connections @@ -496,7 +496,7 @@ struct UdpParams // the UdpPlatformDriver object itself and chain the calls on through, plus do whatever else it wants; // however, that is not required. The application maintains ownership of this object and the object must // not be destroyed by the application until the UdpManager using it is destroyed. - // default = NULL, meaning the UdpManager it will create it's own UdpPlatformDriver for use. + // default = nullptr, meaning the UdpManager it will create it's own UdpPlatformDriver for use. UdpDriver *udpDriver; @@ -642,7 +642,7 @@ class UdpManager : public UdpGuardedRefCount // will call EstablishConnection, then sit in a loop calling UdpManager::GiveTime and checking to see // if the status of the returned UdpConnection object is changed from cStatusNegotiating. This allows // the application to look for the ESC key or timeout an attempted connection. - // This function will return NULL if the manager object has exceeded its maximum number of connections + // This function will return nullptr if the manager object has exceeded its maximum number of connections // or if the serverAddress cannot be resolved to an IP address // as is noted in the declaration, it is the responsibility of the application establishing the connection to delete it // setting the timeout value (in milliseconds) to something greater than 0 will cause the UdpConnection object to change @@ -685,13 +685,13 @@ class UdpManager : public UdpGuardedRefCount // a terminated packet. void DisconnectAll(); - // creates a logical packet and populates it with data. data can be NULL, in which case it gives you logical packet + // creates a logical packet and populates it with data. data can be nullptr, in which case it gives you logical packet // of the size specified, but copies no data into it. If you are using pool management (see Params::poolPacketMax), // it will give you a packet out of the pool if possible, otherwise it will create a packet for you. When logical // are packets are needed internally for various things (like reliable channel sends that use the (void *, int) interface) // they are gotten from this function, so your application can likely take advantage of pooling, even if it never bothers // to explicitly call this function. - LogicalPacket *CreatePacket(const void *data, int dataLen, const void *data2 = NULL, int dataLen2 = 0); + LogicalPacket *CreatePacket(const void *data, int dataLen, const void *data2 = nullptr, int dataLen2 = 0); void GetSimulation(UdpSimulationParameters *simulationParameters) const; void SetSimulation(const UdpSimulationParameters *simulationParameters); @@ -796,7 +796,7 @@ class UdpManager : public UdpGuardedRefCount CallbackEvent(); ~CallbackEvent(); - void SetEventData(CallbackEventType eventType, UdpConnection *con, const LogicalPacket *payload = NULL); + void SetEventData(CallbackEventType eventType, UdpConnection *con, const LogicalPacket *payload = nullptr); void ClearEventData(); CallbackEventType mEventType; @@ -926,7 +926,7 @@ inline void UdpManager::SetPriority(UdpConnection *con, UdpClockStamp stamp) if (stamp < mMinimumScheduledStamp) stamp = mMinimumScheduledStamp; - if (mPriorityQueue != NULL) + if (mPriorityQueue != nullptr) { mPriorityQueue->Add(con, stamp); } @@ -1025,7 +1025,7 @@ inline int UdpManager::CachedClockElapsed(UdpClockStamp start) inline int UdpManager::EncryptUserSupplied(UdpConnection *con, udp_uchar *destData, const udp_uchar *sourceData, int sourceLen) { UdpGuard guard(&mHandlerGuard); - if (mParams.handler != NULL) + if (mParams.handler != nullptr) { return(mParams.handler->OnUserSuppliedEncrypt(con, destData, sourceData, sourceLen)); } @@ -1035,7 +1035,7 @@ inline int UdpManager::EncryptUserSupplied(UdpConnection *con, udp_uchar *destDa inline int UdpManager::EncryptUserSupplied2(UdpConnection *con, udp_uchar *destData, const udp_uchar *sourceData, int sourceLen) { UdpGuard guard(&mHandlerGuard); - if (mParams.handler != NULL) + if (mParams.handler != nullptr) { return(mParams.handler->OnUserSuppliedEncrypt2(con, destData, sourceData, sourceLen)); } @@ -1045,7 +1045,7 @@ inline int UdpManager::EncryptUserSupplied2(UdpConnection *con, udp_uchar *destD inline int UdpManager::DecryptUserSupplied(UdpConnection *con, udp_uchar *destData, const udp_uchar *sourceData, int sourceLen) { UdpGuard guard(&mHandlerGuard); - if (mParams.handler != NULL) + if (mParams.handler != nullptr) { return(mParams.handler->OnUserSuppliedDecrypt(con, destData, sourceData, sourceLen)); } @@ -1055,7 +1055,7 @@ inline int UdpManager::DecryptUserSupplied(UdpConnection *con, udp_uchar *destDa inline int UdpManager::DecryptUserSupplied2(UdpConnection *con, udp_uchar *destData, const udp_uchar *sourceData, int sourceLen) { UdpGuard guard(&mHandlerGuard); - if (mParams.handler != NULL) + if (mParams.handler != nullptr) { return(mParams.handler->OnUserSuppliedDecrypt2(con, destData, sourceData, sourceLen)); } @@ -1070,7 +1070,7 @@ inline int UdpManager::DecryptUserSupplied2(UdpConnection *con, udp_uchar *destD ///////////////////////////////////////////////////////////////////////////////////////////////////// inline UdpParams::UdpParams(ManagerRole role) { - handler = NULL; + handler = nullptr; outgoingBufferSize = 64 * 1024; incomingBufferSize = 64 * 1024; packetHistoryMax = 4; @@ -1103,7 +1103,7 @@ inline UdpParams::UdpParams(ManagerRole role) reliableOverflowBytes = 0; lingerDelay = 10; bindIpAddress[0] = 0; - udpDriver = NULL; + udpDriver = nullptr; callbackEventPoolMax = 5000; eventQueuing = false; threadSleepTime = 20; diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.cpp index b50daae0..651492fc 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.cpp @@ -113,19 +113,19 @@ void *UdpMisc::SmartResize(void *ptr, int bytes, int round) if (bytes == 0) { - if (ptr != NULL) + if (ptr != nullptr) { free((udp_uchar *)ptr - cAlignment); } - return(NULL); + return(nullptr); } udp_uchar *ptr2; - if (ptr == NULL) + if (ptr == nullptr) { ptr2 = (udp_uchar *)malloc(bytes + cAlignment); - if (ptr2 == NULL) - return(NULL); + if (ptr2 == nullptr) + return(nullptr); *(int *)ptr2 = bytes; return(ptr2 + cAlignment); } @@ -135,8 +135,8 @@ void *UdpMisc::SmartResize(void *ptr, int bytes, int round) return(ptr); ptr2 = (udp_uchar *)realloc((udp_uchar *)ptr - cAlignment, bytes + cAlignment); - if (ptr2 == NULL) - return(NULL); + if (ptr2 == nullptr) + return(nullptr); *(int *)ptr2 = bytes; return(ptr2 + cAlignment); @@ -199,30 +199,30 @@ LogicalPacket *UdpMisc::CreateQuickLogicalPacket(const void *data, int dataLen, switch(q) { case 0: - tlp = new FixedLogicalPacket(NULL, totalDataLen); + tlp = new FixedLogicalPacket(nullptr, totalDataLen); break; case 1: - tlp = new FixedLogicalPacket(NULL, totalDataLen); + tlp = new FixedLogicalPacket(nullptr, totalDataLen); break; case 2: case 3: - tlp = new FixedLogicalPacket(NULL, totalDataLen); + tlp = new FixedLogicalPacket(nullptr, totalDataLen); break; case 4: case 5: case 6: case 7: - tlp = new FixedLogicalPacket(NULL, totalDataLen); + tlp = new FixedLogicalPacket(nullptr, totalDataLen); break; default: - tlp = new SimpleLogicalPacket(NULL, totalDataLen); + tlp = new SimpleLogicalPacket(nullptr, totalDataLen); break; } udp_uchar *dest = (udp_uchar *)tlp->GetDataPtr(); - if (data != NULL) + if (data != nullptr) memcpy(dest, data, dataLen); - if (data2 != NULL) + if (data2 != nullptr) memcpy(dest + dataLen, data2, dataLen2); return(tlp); } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.h b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.h index 3961823f..f77380ca 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.h @@ -57,7 +57,7 @@ class UdpMisc // memory manager does a little bit of this, but if you know you have an allocation that is likely // to grow quite a bit, you can set the round'ing size up to a fairly large number and avoid // unnecessary reallocs at the cost of a little potentially wasted space - // initial allocations are done by passing in ptr==NULL, freeing is done by passing in bytes==0 + // initial allocations are done by passing in ptr==nullptr, freeing is done by passing in bytes==0 static void *SmartResize(void *ptr, int bytes, int round = 1); // the following two functions store values in the buffer as a variable length (B1, 0xffB2B1, 0xffffffB4B3B2B1) @@ -78,7 +78,7 @@ class UdpMisc static udp_uint GetValue24(const void *buffer); // gets a 24-bit value from the buffer in big-endian format static udp_ushort GetValue16(const void *buffer); // gets a 16-bit value from the buffer in big-endian format - static LogicalPacket *CreateQuickLogicalPacket(const void *data, int dataLen, const void *data2 = NULL, int dataLen2 = 0); + static LogicalPacket *CreateQuickLogicalPacket(const void *data, int dataLen, const void *data2 = nullptr, int dataLen2 = 0); // looks up the specified name and translates it to an IP address // this is a blocking call that can at times take a significant amount of time, but will generally be fast (less than 300ms) diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpPriority.h b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpPriority.h index c50dee62..e4f2df20 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpPriority.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpPriority.h @@ -43,12 +43,12 @@ template class PriorityQueue PriorityQueue(int queueSize); ~PriorityQueue(); - T* Top(); // returns NULL if queue is empty - T* TopRemove(); // returns NULL if queue is empty - T* TopRemove(P priority); // removes item from queue if it has a lower priority value, otherwise return NULL + T* Top(); // returns nullptr if queue is empty + T* TopRemove(); // returns nullptr if queue is empty + T* TopRemove(P priority); // removes item from queue if it has a lower priority value, otherwise return nullptr T* Add(T* entry, P priority); // reprioritizes if already in queue, returns entry always T* Remove(T* entry); // returns entry always (even if it was not in the queue) - P *GetPriority(T* entry); // returns NULL if entry is not in the queue + P *GetPriority(T* entry); // returns nullptr if entry is not in the queue int QueueUsed(); // returns how many entries are in the queue protected: struct QueueEntry @@ -94,14 +94,14 @@ template PriorityQueue::~PriorityQueue() template T* PriorityQueue::Top() { if (mQueueEnd == 0) - return(NULL); + return(nullptr); return(mQueue[0].entry); } template T* PriorityQueue::TopRemove() { if (mQueueEnd == 0) - return(NULL); + return(nullptr); T* top = mQueue[0].entry; Remove(top); return(top); @@ -111,14 +111,14 @@ template T* PriorityQueue::TopRemove(P priority) { if (mQueueEnd > 0 && mQueue[0].priority <= priority) return(Remove(mQueue[0].entry)); - return(NULL); + return(nullptr); } template P* PriorityQueue::GetPriority(T* entry) { if (entry->mPriorityQueuePosition >= 0) return(&mQueue[entry->mPriorityQueuePosition].priority); - return(NULL); + return(nullptr); } template T* PriorityQueue::Add(T* entry, P priority) @@ -127,7 +127,7 @@ template T* PriorityQueue::Add(T* entry, P priorit { // not in queue, so add it to the bottom if (mQueueEnd >= mQueueSize) - return(NULL); + return(nullptr); mQueue[mQueueEnd].entry = entry; mQueue[mQueueEnd].priority = priority; mQueue[mQueueEnd].entry->mPriorityQueuePosition = mQueueEnd; diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpReliableChannel.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpReliableChannel.cpp index d31de9b4..5b6250f5 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpReliableChannel.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpReliableChannel.cpp @@ -48,12 +48,12 @@ UdpReliableChannel::UdpReliableChannel(int channelNumber, UdpConnection *con, Ud mReliableOutgoingBytes = 0; mLogicalBytesQueued = 0; - mCoalescePacket = NULL; - mCoalesceStartPtr = NULL; - mCoalesceEndPtr = NULL; + mCoalescePacket = nullptr; + mCoalesceStartPtr = nullptr; + mCoalesceEndPtr = nullptr; mCoalesceCount = 0; - mBufferedAckPtr = NULL; + mBufferedAckPtr = nullptr; mStatDuplicatePacketsReceived = 0; mStatResentPacketsAccelerated = 0; @@ -69,7 +69,7 @@ UdpReliableChannel::UdpReliableChannel(int channelNumber, UdpConnection *con, Ud mBigDataLen = 0; mBigDataTargetLen = 0; - mBigDataPtr = NULL; + mBigDataPtr = nullptr; mFragmentNextPos = 0; mLastTimeStampAcknowledged = 0; mMaxxedOutCurrentWindow = false; @@ -81,14 +81,14 @@ UdpReliableChannel::UdpReliableChannel(int channelNumber, UdpConnection *con, Ud UdpReliableChannel::~UdpReliableChannel() { - if (mCoalescePacket != NULL) + if (mCoalescePacket != nullptr) { mCoalescePacket->Release(); - mCoalescePacket = NULL; + mCoalescePacket = nullptr; } const LogicalPacket *cur = mLogicalPacketList.RemoveHead(); - while (cur != NULL) + while (cur != nullptr) { cur->Release(); cur = mLogicalPacketList.RemoveHead(); @@ -103,7 +103,7 @@ UdpReliableChannel::~UdpReliableChannel() void UdpReliableChannel::Send(const udp_uchar *data, int dataLen, const udp_uchar *data2, int dataLen2) { - if (mLogicalPacketList.Count() == 0 && mCoalescePacket == NULL) + if (mLogicalPacketList.Count() == 0 && mCoalescePacket == nullptr) { // if we are adding something to a previously empty logical queue, then it is possible that // we may be able to send it, so mark ourselves to take time the next time it is offered @@ -126,7 +126,7 @@ void UdpReliableChannel::Send(const udp_uchar *data, int dataLen, const udp_ucha void UdpReliableChannel::FlushCoalesce() { - if (mCoalescePacket != NULL) + if (mCoalescePacket != nullptr) { if (mCoalesceCount == 1) { @@ -140,16 +140,16 @@ void UdpReliableChannel::FlushCoalesce() mCoalescePacket->SetDataLen((int)(mCoalesceEndPtr - mCoalesceStartPtr)); QueueLogicalPacket(mCoalescePacket); mCoalescePacket->Release(); - mCoalescePacket = NULL; + mCoalescePacket = nullptr; } } void UdpReliableChannel::SendCoalesce(const udp_uchar *data, int dataLen, const udp_uchar *data2, int dataLen2) { int totalLen = dataLen + dataLen2; - if (mCoalescePacket == NULL) + if (mCoalescePacket == nullptr) { - mCoalescePacket = mUdpConnection->mUdpManager->CreatePacket(NULL, mMaxDataBytes); + mCoalescePacket = mUdpConnection->mUdpManager->CreatePacket(nullptr, mMaxDataBytes); mCoalesceEndPtr = mCoalesceStartPtr = (udp_uchar *)mCoalescePacket->GetDataPtr(); *mCoalesceEndPtr++ = 0; *mCoalesceEndPtr++ = UdpConnection::cUdpPacketGroup; @@ -169,10 +169,10 @@ void UdpReliableChannel::SendCoalesce(const udp_uchar *data, int dataLen, const // append on end of coalesce mCoalesceCount++; mCoalesceEndPtr += UdpMisc::PutVariableValue(mCoalesceEndPtr, totalLen); - if (data != NULL) + if (data != nullptr) memcpy(mCoalesceEndPtr, data, dataLen); mCoalesceEndPtr += dataLen; - if (data2 != NULL) + if (data2 != nullptr) memcpy(mCoalesceEndPtr, data2, dataLen2); mCoalesceEndPtr += dataLen2; } @@ -287,7 +287,7 @@ int UdpReliableChannel::GiveTime() mMaxxedOutCurrentWindow = false; int outstandingNextSendTime = 10 * 60000; // if we have something to do - if (mReliableOutgoingPendingId < mReliableOutgoingId || mLogicalPacketList.Count() != 0 || mCoalescePacket != NULL) + if (mReliableOutgoingPendingId < mReliableOutgoingId || mLogicalPacketList.Count() != 0 || mCoalescePacket != nullptr) { // first, let's calculate how many bytes we figure is outstanding based on who is still waiting for an ack-packet UdpClockStamp oldestResendTime = udpMax(hotClock - optimalResendDelay, mLastTimeStampAcknowledged); // anything older than this, we need to resend @@ -317,7 +317,7 @@ int UdpReliableChannel::GiveTime() // if this packet has not been acked and it is NOT ready to be sent (was recently sent) then we consider it outstanding // note: packets needing re-sending probably got lost and are therefore not outstanding PhysicalPacket *entry = &mPhysicalPackets[i % mConfig.maxOutstandingPackets]; - if (entry->mDataPtr != NULL) // acked packets set the dataPtr to NULL + if (entry->mDataPtr != nullptr) // acked packets set the dataPtr to nullptr { // if this packet is ready to be sent (ie: needs time now, or some later packet has already been ack'ed) windowSpaceLeft -= entry->mDataLen; // window-space is effectively taken whether we have sent it yet or not @@ -524,7 +524,7 @@ int UdpReliableChannel::GiveTime() void UdpReliableChannel::GetChannelStatus(UdpConnection::ChannelStatus *channelStatus) const { int coalesceBytes = 0; - if (mCoalescePacket != NULL) + if (mCoalescePacket != nullptr) coalesceBytes = (int)(mCoalesceEndPtr - mCoalesceStartPtr); channelStatus->totalPendingBytes = mLogicalBytesQueued + mReliableOutgoingBytes + coalesceBytes; @@ -550,7 +550,7 @@ void UdpReliableChannel::GetChannelStatus(UdpConnection::ChannelStatus *channelS PhysicalPacket *entry = &mPhysicalPackets[mReliableOutgoingPendingId % mConfig.maxOutstandingPackets]; if (entry->mFirstTimeStamp != 0) // if has been sent (we know it hasn't been acknowledged or we couldn't possibly be pointing at it as pending) { - if (mUdpConnection->GetUdpManager() != NULL) + if (mUdpConnection->GetUdpManager() != nullptr) { channelStatus->oldestUnacknowledgedAge = mUdpConnection->GetUdpManager()->CachedClockElapsed(entry->mFirstTimeStamp); } @@ -588,7 +588,7 @@ void UdpReliableChannel::ReliablePacket(const udp_uchar *data, int dataLen) mReliableIncomingId++; // process other packets that have arrived - while (mReliableIncoming[mReliableIncomingId % mConfig.maxInstandingPackets].mPacket != NULL) + while (mReliableIncoming[mReliableIncomingId % mConfig.maxInstandingPackets].mPacket != nullptr) { int spot = (int)(mReliableIncomingId % mConfig.maxInstandingPackets); if (mReliableIncoming[spot].mMode != cReliablePacketModeDelivered) @@ -597,7 +597,7 @@ void UdpReliableChannel::ReliablePacket(const udp_uchar *data, int dataLen) } mReliableIncoming[spot].mPacket->Release(); - mReliableIncoming[spot].mPacket = NULL; + mReliableIncoming[spot].mPacket = nullptr; mReliableIncomingId++; } } @@ -605,7 +605,7 @@ void UdpReliableChannel::ReliablePacket(const udp_uchar *data, int dataLen) { // not the one we need next, but it is later than the one we need , so store it in our buffer until it's turn comes up int spot = (int)(reliableId % mConfig.maxInstandingPackets); - if (mReliableIncoming[spot].mPacket == NULL) // only make the copy of it if we don't already have it in our buffer (in cases where it was sent twice, there would be no harm in the copy again since it must be the same packet, it's just inefficient) + if (mReliableIncoming[spot].mPacket == nullptr) // only make the copy of it if we don't already have it in our buffer (in cases where it was sent twice, there would be no harm in the copy again since it must be the same packet, it's just inefficient) { mReliableIncoming[spot].mMode = mode; mReliableIncoming[spot].mPacket = mUdpConnection->mUdpManager->CreatePacket(data + UdpConnection::cUdpPacketReliableSize, dataLen - UdpConnection::cUdpPacketReliableSize); @@ -651,14 +651,14 @@ void UdpReliableChannel::ReliablePacket(const udp_uchar *data, int dataLen) bufPtr += UdpMisc::PutValue16(bufPtr, (udp_ushort)(reliableId & 0xffff)); } - if (mBufferedAckPtr != NULL && mConfig.ackDeduping && ackAll) + if (mBufferedAckPtr != nullptr && mConfig.ackDeduping && ackAll) { memcpy(mBufferedAckPtr, buf, bufPtr - buf); } else { - udp_uchar *ptr = mUdpConnection->BufferedSend(buf, (int)(bufPtr - buf), NULL, 0, true); // safe to append on our data, it is stack data - if (mBufferedAckPtr == NULL) + udp_uchar *ptr = mUdpConnection->BufferedSend(buf, (int)(bufPtr - buf), nullptr, 0, true); // safe to append on our data, it is stack data + if (mBufferedAckPtr == nullptr) { // the buffered-ack ptr should always point to the earliest ack in the buffer, such that // a replacement ack-all will be processed by the receiver before any selective acks that may @@ -676,7 +676,7 @@ void UdpReliableChannel::ProcessPacket(ReliablePacketMode mode, const udp_uchar if (mode == cReliablePacketModeReliable) { // we are not a fragment, nor was there a fragment in progress, so we are a simple reliable packet, just send it to the app - if (mBigDataPtr != NULL) + if (mBigDataPtr != nullptr) { mUdpConnection->CallbackCorruptPacket(data, dataLen, cUdpCorruptionReasonFragmentExpected); return; @@ -687,7 +687,7 @@ void UdpReliableChannel::ProcessPacket(ReliablePacketMode mode, const udp_uchar else if (mode == cReliablePacketModeFragment) { // append onto end of big packet (or create new big packet if not existing already) - if (mBigDataPtr == NULL) + if (mBigDataPtr == nullptr) { if (dataLen < 4) { @@ -729,7 +729,7 @@ void UdpReliableChannel::ProcessPacket(ReliablePacketMode mode, const udp_uchar delete[] mBigDataPtr; mBigDataLen = 0; mBigDataTargetLen = 0; - mBigDataPtr = NULL; + mBigDataPtr = nullptr; } } } @@ -767,7 +767,7 @@ void UdpReliableChannel::Ack(udp_int64 reliableId) int pos = (int)(reliableId % mConfig.maxOutstandingPackets); PhysicalPacket *entry = &mPhysicalPackets[pos]; - if (entry->mDataPtr != NULL) // if this packet has not been acknowledged yet (sometimes we get back two acks for the same packet) + if (entry->mDataPtr != nullptr) // if this packet has not been acknowledged yet (sometimes we get back two acks for the same packet) { mNextNeedTime = 0; // something got acked, so we actually need to take the time next time it is offered @@ -829,14 +829,14 @@ void UdpReliableChannel::Ack(udp_int64 reliableId) // this packet we have queued has been acknowledged, so delete it from queue mReliableOutgoingBytes -= entry->mDataLen; entry->mDataLen = 0; - entry->mDataPtr = NULL; + entry->mDataPtr = nullptr; entry->mParent->Release(); - entry->mParent = NULL; + entry->mParent = nullptr; // advance the pending ptr until it reaches outgoingId or an entry that has yet to acknowledged while (mReliableOutgoingPendingId < mReliableOutgoingId) { - if (mPhysicalPackets[mReliableOutgoingPendingId % mConfig.maxOutstandingPackets].mDataPtr != NULL) + if (mPhysicalPackets[mReliableOutgoingPendingId % mConfig.maxOutstandingPackets].mDataPtr != nullptr) break; mReliableOutgoingPendingId++; } @@ -855,25 +855,25 @@ void UdpReliableChannel::Ack(udp_int64 reliableId) UdpReliableChannel::IncomingQueueEntry::IncomingQueueEntry() { - mPacket = NULL; + mPacket = nullptr; mMode = UdpReliableChannel::cReliablePacketModeReliable; } UdpReliableChannel::IncomingQueueEntry::~IncomingQueueEntry() { - if (mPacket != NULL) + if (mPacket != nullptr) mPacket->Release(); } UdpReliableChannel::PhysicalPacket::PhysicalPacket() { - mParent = NULL; + mParent = nullptr; } UdpReliableChannel::PhysicalPacket::~PhysicalPacket() { - if (mParent != NULL) + if (mParent != nullptr) mParent->Release(); } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpReliableChannel.h b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpReliableChannel.h index fab02474..033585eb 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpReliableChannel.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpReliableChannel.h @@ -64,7 +64,7 @@ class UdpReliableChannel void ProcessPacket(ReliablePacketMode mode, const udp_uchar *data, int dataLen); bool PullDown(int windowSpaceLeft); void FlushCoalesce(); - void SendCoalesce(const udp_uchar *data, int dataLen, const udp_uchar *data2 = NULL, int dataLen2 = 0); + void SendCoalesce(const udp_uchar *data, int dataLen, const udp_uchar *data2 = nullptr, int dataLen2 = 0); void QueueLogicalPacket(LogicalPacket *packet); UdpReliableConfig mConfig; @@ -138,7 +138,7 @@ inline int UdpReliableChannel::TotalPendingBytes() const inline void UdpReliableChannel::ClearBufferedAck() { - mBufferedAckPtr = NULL; + mBufferedAckPtr = nullptr; } inline udp_int64 UdpReliableChannel::GetReliableOutgoingId(int reliableStamp) const diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/UnicodeCharacterDataMap.h b/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/UnicodeCharacterDataMap.h index 741a6e80..493c5a2d 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/UnicodeCharacterDataMap.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/UnicodeCharacterDataMap.h @@ -122,7 +122,7 @@ namespace Plat_Unicode /** * Find a CharData for the given code point. - * @return null if no CharData exists for this code point + * @return nullptr if no CharData exists for this code point */ inline const CharData * CharDataMap::findCharData (const unicode_char_t code) const diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/utf8.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/utf8.cpp index da8e34e8..57bd0a0d 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/utf8.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/utf8.cpp @@ -87,7 +87,7 @@ int UTF8_convertCharToUTF16( char * ptr , UTF16 * ret ) int UTF8_convertToUTF16( char * ptr , UTF16 * ret, int limit ) { int len = 0; - while (( *ptr != 0 ) && ( len < ( limit - 1 ) ))//we use limit -1 to leave room for the null terminator + while (( *ptr != 0 ) && ( len < ( limit - 1 ) ))//we use limit -1 to leave room for the nullptr terminator { int clen = UTF8_convertCharToUTF16( ptr, ret ); ptr += clen; diff --git a/external/3rd/library/soePlatform/VChatAPI/projects/VChat/VChatAPI/common.cpp b/external/3rd/library/soePlatform/VChatAPI/projects/VChat/VChatAPI/common.cpp index 6076f618..2c07d021 100755 --- a/external/3rd/library/soePlatform/VChatAPI/projects/VChat/VChatAPI/common.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/projects/VChat/VChatAPI/common.cpp @@ -171,37 +171,37 @@ namespace VChatSystem token = strtok((char*)tmpTokenee.c_str(), seps ); - if( token != NULL ) + if( token != nullptr ) { game = token; /* Get next token: */ - token = strtok( NULL, seps ); + token = strtok( nullptr, seps ); } - if( token != NULL ) + if( token != nullptr ) { server = token; /* Get next token: */ - token = strtok( NULL, seps ); + token = strtok( nullptr, seps ); } - if( token != NULL ) + if( token != nullptr ) { name = token; /* Get next token: */ - token = strtok( NULL, seps ); + token = strtok( nullptr, seps ); } - while ( token != NULL ) + while ( token != nullptr ) { name += "."; name += token; /* Get next token: */ - token = strtok( NULL, seps ); + token = strtok( nullptr, seps ); } } @@ -216,29 +216,29 @@ namespace VChatSystem std::string tmpTokenee = userName; token = strtok((char*)tmpTokenee.c_str(), seps ); - if( token != NULL ) + if( token != nullptr ) { server = token; /* Get next token: */ - token = strtok( NULL, seps ); + token = strtok( nullptr, seps ); } - if( token != NULL ) + if( token != nullptr ) { name = token; /* Get next token: */ - token = strtok( NULL, seps ); + token = strtok( nullptr, seps ); } - while ( token != NULL ) + while ( token != nullptr ) { name += "."; name += token; /* Get next token: */ - token = strtok( NULL, seps ); + token = strtok( nullptr, seps ); } } diff --git a/external/3rd/library/soePlatform/VChatAPI/projects/VChat/VChatUnitTest/VChatClient.cpp b/external/3rd/library/soePlatform/VChatAPI/projects/VChat/VChatUnitTest/VChatClient.cpp index 869bf94a..db94c3cd 100755 --- a/external/3rd/library/soePlatform/VChatAPI/projects/VChat/VChatUnitTest/VChatClient.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/projects/VChat/VChatUnitTest/VChatClient.cpp @@ -23,7 +23,7 @@ unsigned VChatClient::GetAccountEx(const std::string &avatarName, { Reset(); - VChatAPI::GetAccount(avatarName, game, world, userID, avatarID, NULL); + VChatAPI::GetAccount(avatarName, game, world, userID, avatarID, nullptr); while(!IsDone() && !HasFailed()) { @@ -69,7 +69,7 @@ unsigned VChatClient::DeactivateVoiceAccount(const std::string &avatarName, { Reset(); - VChatAPI::DeactivateVoiceAccount(avatarName, game, world, NULL); + VChatAPI::DeactivateVoiceAccount(avatarName, game, world, nullptr); while(!IsDone() && !HasFailed()) { @@ -99,7 +99,7 @@ unsigned VChatClient::GetChannelEx( const std::string &channelName, bool persistent) { Reset(); - VChatAPI::GetChannel(channelName, game, server, description, password, limit, persistent, NULL); + VChatAPI::GetChannel(channelName, game, server, description, password, limit, persistent, nullptr); while(!IsDone() && !HasFailed()) { @@ -146,7 +146,7 @@ unsigned VChatClient::GetProximityChannelEx(const std::string &channelName, unsigned distModel) { Reset(); - VChatAPI::GetProximityChannel(channelName, game, server, description, password, limit, persistent, maxRange, clamping, rollOff, maxGain, distModel, NULL); + VChatAPI::GetProximityChannel(channelName, game, server, description, password, limit, persistent, maxRange, clamping, rollOff, maxGain, distModel, nullptr); while(!IsDone() && !HasFailed()) { @@ -183,7 +183,7 @@ unsigned VChatClient::ChannelCommandEx( const std::string &srcUserName, unsigned banTimeout) { Reset(); - VChatAPI::ChannelCommand(srcUserName, destUserName, destChannelAddress, command, banTimeout, NULL); + VChatAPI::ChannelCommand(srcUserName, destUserName, destChannelAddress, command, banTimeout, nullptr); while(!IsDone() && !HasFailed()) { @@ -211,7 +211,7 @@ unsigned VChatClient::ChangePasswordEx(const std::string &channelName, const std::string &password) { Reset(); - VChatAPI::ChangePassword(channelName, game, server, password, NULL); + VChatAPI::ChangePassword(channelName, game, server, password, nullptr); while(!IsDone() && !HasFailed()) { @@ -236,7 +236,7 @@ void VChatClient::OnChangePassword( unsigned track, unsigned VChatClient::GetAllChannelsEx() { Reset(); - VChatAPI::GetAllChannels(NULL); + VChatAPI::GetAllChannels(nullptr); while(!IsDone() && !HasFailed()) { @@ -274,7 +274,7 @@ unsigned VChatClient::DeleteChannelEx(const std::string &channelName, const std::string &server) { Reset(); - VChatAPI::DeleteChannel(channelName, game, server, NULL); + VChatAPI::DeleteChannel(channelName, game, server, nullptr); while(!IsDone() && !HasFailed()) { @@ -301,7 +301,7 @@ unsigned VChatClient::SetBanStatusEx(unsigned userID, unsigned banStatus) { Reset(); - VChatAPI::SetBanStatus(userID, banStatus, NULL); + VChatAPI::SetBanStatus(userID, banStatus, nullptr); while(!IsDone() && !HasFailed()) { @@ -328,7 +328,7 @@ unsigned VChatClient::GetChannelInfoEx( const std::string &channelName, const std::string &server) { Reset(); - VChatAPI::GetChannelInfo(channelName, game, server, NULL); + VChatAPI::GetChannelInfo(channelName, game, server, nullptr); while(!IsDone() && !HasFailed()) { @@ -369,7 +369,7 @@ unsigned VChatClient::GetChannelV2Ex(const std::string &channelName, bool persistent) { Reset(); - VChatAPI::GetChannelV2(channelName, game, server, description, password, limit, persistent, NULL); + VChatAPI::GetChannelV2(channelName, game, server, description, password, limit, persistent, nullptr); while(!IsDone() && !HasFailed()) { @@ -419,7 +419,7 @@ unsigned VChatClient::AddCharacterChannelEx(const unsigned stationID, Reset(); VChatAPI::AddCharacterChannel(stationID, avatarID, characterName, worldName, gameCode, channelType, channelDescription, - password, channelAddress, locale, NULL); + password, channelAddress, locale, nullptr); while(!IsDone() && !HasFailed()) { @@ -449,7 +449,7 @@ unsigned VChatClient::RemoveCharacterChannelEx( const unsigned stationID, { Reset(); VChatAPI::RemoveCharacterChannel(stationID, avatarID, characterName, worldName, - gameCode, channelType, NULL); + gameCode, channelType, nullptr); while(!IsDone() && !HasFailed()) { @@ -477,7 +477,7 @@ unsigned VChatClient::GetCharacterChannelEx(const unsigned stationID, const std::string &gameCode) { Reset(); - VChatAPI::GetCharacterChannel(stationID, characterName, worldName, gameCode, NULL); + VChatAPI::GetCharacterChannel(stationID, characterName, worldName, gameCode, nullptr); while(!IsDone() && !HasFailed()) { diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/api.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/api.cpp index 3af047a2..9c9c8084 100644 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/api.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/api.cpp @@ -45,7 +45,7 @@ namespace API_NAMESPACE //////////////////////////////////////////////////////////////////////////////// CommonAPI::CommonAPI(const char * hostList, const char * failoverHostList, unsigned connectionLimit, unsigned maxMsgSize, unsigned bufferSize) - : mManager(NULL) + : mManager(nullptr) , mHostReconnectTimeout() , mIdleHosts() , mHostMap() @@ -247,7 +247,7 @@ namespace API_NAMESPACE connection->Send((const char*)buffer, size); #endif } - mLastRequestInputTime = time(NULL); + mLastRequestInputTime = time(nullptr); } #ifdef UDP_LIBRARY @@ -466,7 +466,7 @@ namespace API_NAMESPACE RequestMap_t::iterator reqIterator = mRequestMap.find(trackingNumber); bool found = false; - *pUserData = NULL; + *pUserData = nullptr; if (reqIterator != mRequestMap.end()) { TrackedRequest & request = reqIterator->second; @@ -594,7 +594,7 @@ namespace API_NAMESPACE CommonAPI::ApiConnectionInfo * CommonAPI::GetNextUsableConnection() { - ApiConnectionInfo * connectionInfo = NULL; + ApiConnectionInfo * connectionInfo = nullptr; if (!mUsableHosts[0].empty()) { @@ -617,7 +617,7 @@ namespace API_NAMESPACE CommonAPI::ApiConnectionInfo * CommonAPI::FindConnectionInfo(ApiConnection * connection) { // find the connection in the set - ApiConnectionInfo * pInfo = NULL; + ApiConnectionInfo * pInfo = nullptr; ConnectionMap_t::iterator iter; if ( ((iter = mActiveHosts[0].find(connection)) != mActiveHosts[0].end()) || ((iter = mActiveHosts[1].find(connection)) != mActiveHosts[1].end()) ) @@ -777,8 +777,8 @@ namespace API_NAMESPACE mspEnumerationToVersionStringMap = &enumerationToVersionStringMap; } - std::map *VersionMap::mspVersionStringToEnumerationMap = NULL; - std::map *VersionMap::mspEnumerationToVersionStringMap = NULL; + std::map *VersionMap::mspVersionStringToEnumerationMap = nullptr; + std::map *VersionMap::mspEnumerationToVersionStringMap = nullptr; //////////////////////////////////////////////////////////////////////////////// @@ -1009,7 +1009,7 @@ namespace API_NAMESPACE mspLabelToEntryMap = &labelToEntryMap; } - ConfigurationMap::LabelToEntryMap_t *ConfigurationMap::mspLabelToEntryMap = NULL; + ConfigurationMap::LabelToEntryMap_t *ConfigurationMap::mspLabelToEntryMap = nullptr; //////////////////////////////////////////////////////////////////////////////// diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/api.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/api.h index 37512cbd..9cd24094 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/api.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/api.h @@ -58,7 +58,7 @@ namespace API_NAMESPACE typedef std::set TrackingSet_t; struct ApiConnectionInfo { - ApiConnectionInfo(ApiConnection * Connection = NULL) : mConnection(Connection), mIsShuttingDown(false) { } + ApiConnectionInfo(ApiConnection * Connection = nullptr) : mConnection(Connection), mIsShuttingDown(false) { } ApiConnection * mConnection; TrackingSet_t mOutstandingRequests; diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/apiMessages.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/apiMessages.cpp index c38875ab..ae5cdc76 100644 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/apiMessages.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/apiMessages.cpp @@ -253,7 +253,7 @@ namespace API_NAMESPACE Base * Base::Create(unsigned MsgId, StorageVector_t *pStorageVector) { - Base * msg = NULL; + Base * msg = nullptr; if (ms_pClassMap) { std::map::iterator classIter = ms_pClassMap->find(MsgId); @@ -272,7 +272,7 @@ namespace API_NAMESPACE const char * Base::GetMessageName(unsigned msgId) { - const char * requestString = NULL; + const char * requestString = nullptr; if (ms_pClassMap) { std::map::iterator classIter = ms_pClassMap->find(msgId); @@ -287,7 +287,7 @@ namespace API_NAMESPACE const char * Base::GetMessageIDString(unsigned msgId) { - const char * idString = NULL; + const char * idString = nullptr; if (ms_pClassMap) { std::map::iterator classIter = ms_pClassMap->find(msgId); @@ -304,7 +304,7 @@ namespace API_NAMESPACE { static std::map classMap; - if (ms_pClassMap == NULL) { + if (ms_pClassMap == nullptr) { ms_pClassMap = &classMap; } @@ -326,24 +326,24 @@ namespace API_NAMESPACE } Base::DeepPointer::DeepPointer() : - m_ptr(NULL) + m_ptr(nullptr) { } Base::DeepPointer::DeepPointer(const Base & source) : - m_ptr(NULL) + m_ptr(nullptr) { m_ptr = source.Clone(m_storageVector); } Base::DeepPointer::DeepPointer(const Base * source) : - m_ptr(NULL) + m_ptr(nullptr) { m_ptr = source->Clone(m_storageVector); } Base::DeepPointer::DeepPointer(const DeepPointer & source) : - m_ptr(NULL) + m_ptr(nullptr) { if (source.m_ptr) { m_ptr = source->Clone(m_storageVector); } } @@ -364,7 +364,7 @@ namespace API_NAMESPACE { Base *oldPtr = m_ptr; - m_ptr = rhs ? rhs->Clone(m_storageVector) : NULL; + m_ptr = rhs ? rhs->Clone(m_storageVector) : nullptr; if (oldPtr) { oldPtr->~Base(); @@ -377,7 +377,7 @@ namespace API_NAMESPACE { Base *oldPtr = m_ptr; - m_ptr = rhs.m_ptr ? rhs->Clone(m_storageVector) : NULL; + m_ptr = rhs.m_ptr ? rhs->Clone(m_storageVector) : nullptr; if (oldPtr) { oldPtr->~Base(); @@ -396,7 +396,7 @@ namespace API_NAMESPACE return *m_ptr; } - std::map *Base::ms_pClassMap = NULL; + std::map *Base::ms_pClassMap = nullptr; #if defined(PRINTABLE_MESSAGES) || defined(TRACK_READ_WRITE_FAILURES) Basic::Basic() diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/apiMessages.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/apiMessages.h index ef733afb..12b00516 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/apiMessages.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/apiMessages.h @@ -60,7 +60,7 @@ namespace API_NAMESPACE protected: struct DECLSPEC MemberInfo { - MemberInfo(soe::AutoVariableBase *dataIn = NULL, unsigned sizeIn = 1, unsigned versionIn = 0, soe::EVersionEffect effectIn = soe::eNoEffect) + MemberInfo(soe::AutoVariableBase *dataIn = nullptr, unsigned sizeIn = 1, unsigned versionIn = 0, soe::EVersionEffect effectIn = soe::eNoEffect) : data(dataIn) , size(sizeIn) , version(versionIn) @@ -97,8 +97,8 @@ namespace API_NAMESPACE virtual Base * Clone() const; virtual Base * Clone(StorageVector_t &storageVector) const; virtual const char * MessageName() const { return "Base"; } - virtual const char * MessageIDString() const { return "NULL"; } - static Base * Create(unsigned MsgId, StorageVector_t *pStorageVector = NULL); + virtual const char * MessageIDString() const { return "nullptr"; } + static Base * Create(unsigned MsgId, StorageVector_t *pStorageVector = nullptr); static const char * GetMessageName(unsigned msgId); static const char * GetMessageIDString(unsigned msgId); diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/apiPinned.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/apiPinned.cpp index 5a1dd30d..2f72d6e0 100644 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/apiPinned.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/apiPinned.cpp @@ -291,7 +291,7 @@ namespace NAMESPACE if (!mActiveHosts[0].empty()) { // get connection that corresponds to hash index - ApiConnection * connection = NULL; + ApiConnection * connection = nullptr; unsigned hashIndex = hashValue % mActiveHosts[0].size(); unsigned curIndex = 0; for (ConnectionSet_t::iterator it = mActiveHosts[0].begin(); it != mActiveHosts[0].end(); it++, curIndex++) @@ -314,7 +314,7 @@ namespace NAMESPACE else if (!mActiveHosts[1].empty()) { // get connection that corresponds to hash index - ApiConnection * connection = NULL; + ApiConnection * connection = nullptr; unsigned hashIndex = hashValue % mActiveHosts[1].size(); unsigned curIndex = 0; for (ConnectionSet_t::iterator it = mActiveHosts[1].begin(); it != mActiveHosts[1].end(); it++, curIndex++) diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/cmdLine.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/cmdLine.cpp index 8c04219e..9d82c979 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/cmdLine.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/cmdLine.cpp @@ -132,7 +132,7 @@ int CmdLine::SplitLine(int argc, char **argv) bool CmdLine::IsSwitch(const char *pParam) { - if (pParam==NULL) + if (pParam==nullptr) return false; // switches must non-empty @@ -201,7 +201,7 @@ StringType CmdLine::GetSafeArgument(const char *pSwitch, int iIdx, const char *p { StringType sRet; - if (pDefault!=NULL) + if (pDefault!=nullptr) sRet = pDefault; try diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/date.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/date.cpp index 025883cd..0184793d 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/date.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/date.cpp @@ -42,7 +42,7 @@ namespace soe , mSecond(0) { struct tm timeStruct; - struct tm *gotTime = NULL; + struct tm *gotTime = nullptr; #ifdef WIN32 gotTime = gmtime(&src); #else diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/dateUtils.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/dateUtils.h index fecca883..be898b53 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/dateUtils.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/dateUtils.h @@ -144,7 +144,7 @@ namespace soe inline time_t localTimeToGmt(int dstOffsetMinutes = DST_OFFSET_MINUTES_USA) { - time_t localTime = time(NULL); + time_t localTime = time(nullptr); struct tm gt = *(gmtime(&localTime)); struct tm lt = *(localtime(&localTime)); bool isDst = (lt.tm_isdst? true:false); @@ -187,7 +187,7 @@ namespace soe dstOffsetSecs = dstOffsetMS/1000; return retval; } - inline int getGMT(time_t & theTime, const char *id = NULL) + inline int getGMT(time_t & theTime, const char *id = nullptr) { UDate date; UErrorCode ec; diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/genericRateLimitingMechanism.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/genericRateLimitingMechanism.h index 20b16fa1..66934bc1 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/genericRateLimitingMechanism.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/genericRateLimitingMechanism.h @@ -245,7 +245,7 @@ namespace soe template const LimitType * GenericRateLimitingMechanism::GetRateLimit(const FixedKeyType & fixedKey) const { - LimitType const * rateLimit = NULL; + LimitType const * rateLimit = nullptr; typename RateLimitByFixedKeyMap_t::const_iterator limIter = mRateLimits.find(fixedKey); if (limIter != mRateLimits.end()) { @@ -258,7 +258,7 @@ namespace soe template const LimitType * GenericRateLimitingMechanism::GetNextRateLimit(FixedKeyType & fixedKey) const { - LimitType const * rateLimit = NULL; + LimitType const * rateLimit = nullptr; typename RateLimitByFixedKeyMap_t::const_iterator limIter = mRateLimits.upper_bound(fixedKey); if (limIter != mRateLimits.end()) { @@ -272,7 +272,7 @@ namespace soe template const CounterType * GenericRateLimitingMechanism::GetRateCounter(const FixedKeyType & fixedKey, const ArbitraryKeyType & arbitraryKey) const { - const CounterType * counter = NULL; + const CounterType * counter = nullptr; typename RateCounterByKeyPairMap_t::const_iterator counterIter = mRateCounters.find(KeyPair(fixedKey, arbitraryKey)); if (counterIter != mRateCounters.end()) { counter = &(counterIter->second->mCounter); diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/hashtable.hpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/hashtable.hpp index 00f9cd75..4fc2ace9 100644 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/hashtable.hpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/hashtable.hpp @@ -174,11 +174,11 @@ template class HashTable bool Remove(T& obj, int hashValue); void Reset(); // removes all entries from the table - T *FindFirst(int hashValue) const; // returns NULL if not found - T *FindNext(T *prevResult) const; // returns NULL if not found + T *FindFirst(int hashValue) const; // returns nullptr if not found + T *FindNext(T *prevResult) const; // returns nullptr if not found - T *WalkFirst() const; // returns NULL if not found - T *WalkNext(T *prevResult) const; // returns NULL if not found + T *WalkFirst() const; // returns nullptr if not found + T *WalkNext(T *prevResult) const; // returns nullptr if not found void Resize(int hashSize); // the actual hash size will be rounded up to the next larger prime number (very slow, not recommended) void GetStatistics(HashTableStatistics *stats) const; @@ -200,7 +200,7 @@ template class HashTable template HashTable::HashTable(int hashSize) { - mTable = NULL; + mTable = nullptr; mTableSize = 0; mEntryCount = 0; mStatUsedSlots = 0; @@ -220,9 +220,9 @@ template void HashTable::Insert(T& obj, int hashValue) entry->hashValue = hashValue; int spot = ((unsigned)hashValue) % mTableSize; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) { - entry->nextEntry = NULL; + entry->nextEntry = nullptr; mTable[spot] = entry; mStatUsedSlots++; } @@ -239,14 +239,14 @@ template bool HashTable::Remove(T& obj, int hashValue) int spot = ((unsigned)hashValue) % mTableSize; HashEntry* next = mTable[spot]; HashEntry** prev = &mTable[spot]; - while (next != NULL) + while (next != nullptr) { if (next->obj == obj && next->hashValue == hashValue) { *prev = next->nextEntry; delete next; mEntryCount--; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) mStatUsedSlots--; return(true); break; @@ -263,17 +263,17 @@ template void HashTable::Reset() for (int spot = 0; spot < mTableSize; spot++) { HashEntry *curr = mTable[spot]; - if (curr != NULL) + if (curr != nullptr) { mStatUsedSlots--; - while (curr != NULL) + while (curr != nullptr) { HashEntry *next = curr->nextEntry; delete curr; mEntryCount--; curr = next; } - mTable[spot] = NULL; + mTable[spot] = nullptr; } } } @@ -281,13 +281,13 @@ template void HashTable::Reset() template T *HashTable::FindFirst(int hashValue) const { HashEntry *entry = mTable[((unsigned)hashValue) % mTableSize]; - while (entry != NULL) + while (entry != nullptr) { if (entry->hashValue == hashValue) return(&entry->obj); entry = entry->nextEntry; } - return(NULL); + return(nullptr); } template T *HashTable::FindNext(T *prevResult) const @@ -295,13 +295,13 @@ template T *HashTable::FindNext(T *prevResult) const HashEntry *entry = (HashEntry *)(((char *)prevResult) - offsetof(HashEntry, obj)); int hashValue = entry->hashValue; entry = entry->nextEntry; - while (entry != NULL) + while (entry != nullptr) { if (entry->hashValue == hashValue) return(&entry->obj); entry = entry->nextEntry; } - return(NULL); + return(nullptr); } template T *HashTable::WalkFirst() const @@ -309,10 +309,10 @@ template T *HashTable::WalkFirst() const for (int bucket = 0; bucket < mTableSize; bucket++) { HashEntry *entry = mTable[bucket]; - if (entry != NULL) + if (entry != nullptr) return(&entry->obj); } - return(NULL); + return(nullptr); } template T *HashTable::WalkNext(T *prevResult) const @@ -321,17 +321,17 @@ template T *HashTable::WalkNext(T *prevResult) const int bucket = ((unsigned)entry->hashValue) % mTableSize; entry = entry->nextEntry; - if (entry != NULL) + if (entry != nullptr) return(&entry->obj); bucket++; // go onto next bucket for (; bucket < mTableSize; bucket++) { HashEntry *entry = mTable[bucket]; - if (entry != NULL) + if (entry != nullptr) return(&entry->obj); } - return(NULL); + return(nullptr); } template void HashTable::Resize(int hashSize) @@ -351,16 +351,16 @@ template void HashTable::Resize(int hashSize) for (int i = 0; i < oldSize; i++) { HashEntry* next = oldTable[i]; - while (next != NULL) + while (next != nullptr) { HashEntry* hold = next; next = next->nextEntry; // insert hold into new table int spot = ((unsigned)hold->hashValue) % mTableSize; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) { - hold->nextEntry = NULL; + hold->nextEntry = nullptr; mTable[spot] = hold; mStatUsedSlots++; } @@ -414,11 +414,11 @@ template class ObjectHashTable bool Remove(T obj, int hashValue); void Reset(); // removes all entries from the table - T FindFirst(int hashValue) const; // returns NULL if not found - T FindNext(T prevResult) const; // returns NULL if not found + T FindFirst(int hashValue) const; // returns nullptr if not found + T FindNext(T prevResult) const; // returns nullptr if not found - T WalkFirst() const; // returns NULL if not found - T WalkNext(T prevResult) const; // returns NULL if not found + T WalkFirst() const; // returns nullptr if not found + T WalkNext(T prevResult) const; // returns nullptr if not found void Resize(int hashSize); // the actual hash size will be rounded up to the next larger prime number (very slow, not recommended) void GetStatistics(HashTableStatistics *stats) const; @@ -433,7 +433,7 @@ template class ObjectHashTable template ObjectHashTable::ObjectHashTable(int hashSize) { - mTable = NULL; + mTable = nullptr; mTableSize = 0; mEntryCount = 0; mStatUsedSlots = 0; @@ -451,9 +451,9 @@ template void ObjectHashTable::Insert(T obj, int hashValue) obj->mHashValue = hashValue; int spot = ((unsigned)hashValue) % mTableSize; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) { - obj->mHashNextEntry = NULL; + obj->mHashNextEntry = nullptr; mTable[spot] = obj; mStatUsedSlots++; } @@ -470,14 +470,14 @@ template bool ObjectHashTable::Remove(T obj, int hashValue) int spot = ((unsigned)hashValue) % mTableSize; T next = mTable[spot]; T *prev = &mTable[spot]; - while (next != NULL) + while (next != nullptr) { if (next == obj) { *prev = (T)next->mHashNextEntry; - next->mHashNextEntry = NULL; + next->mHashNextEntry = nullptr; mEntryCount--; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) mStatUsedSlots--; return(true); break; @@ -494,16 +494,16 @@ template void ObjectHashTable::Reset() for (int spot = 0; spot < mTableSize; spot++) { T curr = mTable[spot]; - if (curr != NULL) + if (curr != nullptr) { - while (curr != NULL) + while (curr != nullptr) { T next = (T)curr->mHashNextEntry; - curr->mHashNextEntry = NULL; + curr->mHashNextEntry = nullptr; mEntryCount--; curr = next; } - mTable[spot] = NULL; + mTable[spot] = nullptr; mStatUsedSlots--; } } @@ -512,13 +512,13 @@ template void ObjectHashTable::Reset() template T ObjectHashTable::FindFirst(int hashValue) const { T entry = mTable[((unsigned)hashValue) % mTableSize]; - while (entry != NULL) + while (entry != nullptr) { if (entry->mHashValue == hashValue) return(entry); entry = (T)entry->mHashNextEntry; } - return(NULL); + return(nullptr); } template T ObjectHashTable::FindNext(T prevResult) const @@ -526,13 +526,13 @@ template T ObjectHashTable::FindNext(T prevResult) const T entry = prevResult; int hashValue = entry->mHashValue; entry = (T)entry->mHashNextEntry; - while (entry != NULL) + while (entry != nullptr) { if (entry->mHashValue == hashValue) return(entry); entry = (T)entry->mHashNextEntry; } - return(NULL); + return(nullptr); } template T ObjectHashTable::WalkFirst() const @@ -540,10 +540,10 @@ template T ObjectHashTable::WalkFirst() const for (int bucket = 0; bucket < mTableSize; bucket++) { T entry = mTable[bucket]; - if (entry != NULL) + if (entry != nullptr) return(entry); } - return(NULL); + return(nullptr); } template T ObjectHashTable::WalkNext(T prevResult) const @@ -552,17 +552,17 @@ template T ObjectHashTable::WalkNext(T prevResult) const int bucket = ((unsigned)entry->mHashValue) % mTableSize; entry = (T)entry->mHashNextEntry; - if (entry != NULL) + if (entry != nullptr) return(entry); bucket++; // go onto next bucket for (; bucket < mTableSize; bucket++) { entry = mTable[bucket]; - if (entry != NULL) + if (entry != nullptr) return(entry); } - return(NULL); + return(nullptr); } template void ObjectHashTable::Resize(int hashSize) @@ -582,16 +582,16 @@ template void ObjectHashTable::Resize(int hashSize) for (int i = 0; i < oldSize; i++) { T next = oldTable[i]; - while (next != NULL) + while (next != nullptr) { T hold = next; next = (T)next->mHashNextEntry; // insert hold into new table int spot = ((unsigned)hold->mHashValue) % mTableSize; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) { - hold->mHashNextEntry = NULL; + hold->mHashNextEntry = nullptr; mTable[spot] = hold; mStatUsedSlots++; } diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/log.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/log.cpp index e14aee9a..72cac84a 100644 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/log.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/log.cpp @@ -115,7 +115,7 @@ Logger::Logger(const char *programName, void Logger::LoggerInit(const char *programName) { char buf[1024]; - FILE *logDir = NULL; + FILE *logDir = nullptr; if (0 != (m_logType & eUseLocalFile)) { @@ -124,13 +124,13 @@ void Logger::LoggerInit(const char *programName) { cmkdir(m_dirPrefix.c_str(), 0755); } - else if(logDir != NULL) + else if(logDir != nullptr) { fclose(logDir); } tm now; - time_t t = time(NULL); + time_t t = time(nullptr); LOGGER_GET_CURR_TIME(now, t); @@ -148,7 +148,7 @@ void Logger::LoggerInit(const char *programName) { cmkdir(buf, 0755); } - else if(logDir != NULL) + else if(logDir != nullptr) { fclose(logDir); } @@ -330,7 +330,7 @@ void Logger::logSimple(unsigned logenum, int level, const char *message) { return; } - time_t t = time(NULL); + time_t t = time(nullptr); LogInfo *info = (*iter).second; if(level >= info->level) { @@ -400,7 +400,7 @@ void Logger::logSimpleWithSys(unsigned logenum, unsigned priority, int level, co { return; } - time_t t = time(NULL); + time_t t = time(nullptr); LogInfo *info = (*iter).second; if(level >= info->level) @@ -482,7 +482,7 @@ void Logger::logWithSys(unsigned logenum, unsigned priority, int level, const ch { return; } - time_t t = time(NULL); + time_t t = time(nullptr); LogInfo *info = (*iter).second; if(level >= info->level) @@ -562,7 +562,7 @@ void Logger::vlogWithSys(unsigned logenum, unsigned priority, int level, const c { return; } - time_t t = time(NULL); + time_t t = time(nullptr); LogInfo *info = (*iter).second; if(level >= info->level) @@ -630,14 +630,14 @@ void Logger::vlog(unsigned logenum, int level, const char *message, va_list argp void Logger::rollDate(time_t t) { char buf[80]; - FILE *logDir = NULL; + FILE *logDir = nullptr; logDir = fopen(m_dirPrefix.c_str(), "r+"); if(errno == ENOENT) { cmkdir(m_dirPrefix.c_str(), 0755); } - else if(logDir != NULL) + else if(logDir != nullptr) { fclose(logDir); } @@ -653,7 +653,7 @@ void Logger::rollDate(time_t t) { cmkdir(buf, 0755); } - else if(logDir != NULL) + else if(logDir != nullptr) { fclose(logDir); } @@ -737,7 +737,7 @@ void Logger::rollLog(LogInfo *logInfo) { std::string newLogName; char timeStampBuffer[256]; - time_t t = time(NULL); + time_t t = time(nullptr); tm now; int r; int nTries = 10; diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorAPI.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorAPI.cpp index 214e33be..cb3a87d0 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorAPI.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorAPI.cpp @@ -48,7 +48,7 @@ MonitorObject::~MonitorObject() if( mConnection ) { - mConnection->SetHandler(NULL); + mConnection->SetHandler(nullptr); mConnection->Disconnect(); mConnection->Release(); } @@ -72,10 +72,10 @@ char hold[214]; UdpConnection::DisconnectReasonText( mConnection->GetOtherSideDisconnectReason())); } } - mConnection->SetHandler(NULL); + mConnection->SetHandler(nullptr); mConnection->Disconnect(); mConnection->Release(); - mConnection = NULL; + mConnection = nullptr; } } @@ -91,10 +91,10 @@ void MonitorObject::OnRoutePacket(UdpConnection * con, const uchar *data, int d simpleMessage msg(data); - if( con == NULL ) + if( con == nullptr ) { if( mbprint) - fprintf(stderr,"MONITOR API: MonitorObject.OnRoutePacket, recived a NULL connection.?\n"); + fprintf(stderr,"MONITOR API: MonitorObject.OnRoutePacket, recived a nullptr connection.?\n"); return; } @@ -120,7 +120,7 @@ void MonitorObject::OnRoutePacket(UdpConnection * con, const uchar *data, int d if( mHierarchySent == true ) { if( mMonitorData->processElementsRequest(con,mSequence,(char *)&data[6],dataLen,mlastUpdateTime )) - mlastUpdateTime = time(NULL); + mlastUpdateTime = time(nullptr); break; } // NOTE: if mHierarchy is not sent or changed, then send it. @@ -258,7 +258,7 @@ MonitorManager::MonitorManager(char *configFile, CMonitorData *_gamedata, UdpMan { mManager = manager; mbprint = _bprint; - passString = NULL; + passString = nullptr; mMonitorData = _gamedata; mObjectCount = 0; @@ -288,7 +288,7 @@ void MonitorManager::OnConnectRequest(UdpConnection *con) { if( con ) { - con->SetHandler(NULL); + con->SetHandler(nullptr); con->Disconnect(); con->Release(); } @@ -310,7 +310,7 @@ void MonitorManager::GiveTime() // check if the monitor object is no longer connected for (int i = 0; i < mObjectCount; i++) { - if( mObject[i]->mConnection == NULL || + if( mObject[i]->mConnection == nullptr || mObject[i]->mConnection->GetStatus() == UdpConnection::cStatusDisconnected ) { MonitorObject *o = mObject[i]; @@ -342,7 +342,7 @@ int x; char buffer[1024]; FILE *fp = fopen(filename,"r"); - if (fp == NULL) + if (fp == nullptr) { fprintf(stderr,"Monitor API: could not open %s file\nTHIS FILE IS REQUIRED.\n", filename); return false; @@ -364,7 +364,7 @@ char buffer[1024]; x = 0; while(!feof(fp)) { - if (fgets( buffer, 1023, fp) != NULL) { + if (fgets( buffer, 1023, fp) != nullptr) { // get rid of '\n' and '\r' for comparisons strtok(buffer,"\r\n"); @@ -402,17 +402,17 @@ CMonitorAPI::CMonitorAPI( char *configFile, unsigned short Port, bool _bprint , mbprint = _bprint; mPort = Port; - mAddress = NULL; + mAddress = nullptr; if( address ) { mAddress = (char *)malloc(strlen(address)+1); strcpy(mAddress,address); } - if( mang == NULL ) + if( mang == nullptr ) { UdpManager::Params params; - params.handler = NULL; + params.handler = nullptr; params.maxConnections = CONNECTION_MAX; params.outgoingBufferSize = 1000000; params.noDataTimeout = 130000; diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorAPI.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorAPI.h index fa60d698..60fa8509 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorAPI.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorAPI.h @@ -72,13 +72,13 @@ class CMonitorAPI { public: - CMonitorAPI( char *configFile, unsigned short Port, bool _bprint = false , char * address = NULL, UdpManager * mang = NULL ); + CMonitorAPI( char *configFile, unsigned short Port, bool _bprint = false , char * address = nullptr, UdpManager * mang = nullptr ); ~CMonitorAPI(); void Update(); - void add( const char *label, int id, int ping = MON_PING_5MIN, char *des = NULL ); + void add( const char *label, int id, int ping = MON_PING_5MIN, char *des = nullptr ); void setDescription( int Id, const char *Description ) ; diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorData.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorData.cpp index 38614bbf..0d3c66d5 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorData.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorData.cpp @@ -55,7 +55,7 @@ CMonitorData::CMonitorData() { m_sequence = 1; - m_buffer = NULL; + m_buffer = nullptr; m_nbuffer = 0; m_count = 0; m_max = ELEMENT_START_VALUE; @@ -85,7 +85,7 @@ void CMonitorData::resize_buffer(int new_size) { char *temp; - if( m_buffer != NULL ) + if( m_buffer != nullptr ) { temp = m_buffer; m_buffer = new char[ new_size]; @@ -252,7 +252,7 @@ char *p; { if( get_bit(mark,x) == 0 ) { - if( m_data[x].discription != NULL ) + if( m_data[x].discription != nullptr ) snprintf(tmp, sizeof(tmp), "%d,%s|", m_data[x].id, m_data[x].discription); else snprintf(tmp, sizeof(tmp), "%d, |", m_data[x].id); @@ -282,7 +282,7 @@ char *p; { flag = 2; - if( m_data[x].discription != NULL ) + if( m_data[x].discription != nullptr ) snprintf(tmp, sizeof(tmp), "%d,%s|", m_data[x].id, m_data[x].discription); else snprintf(tmp, sizeof(tmp), "%d, |", m_data[x].id); @@ -338,7 +338,7 @@ int x; //******* Discription ****** delete [] m_data[x].discription; - m_data[x].discription = NULL; + m_data[x].discription = nullptr; if( des ) { @@ -387,10 +387,10 @@ int x; for(x=0;x= x ) return NULL; return m_data[x].discription;} + char *getDescription(int x){ if( m_ndata >= x ) return nullptr; return m_data[x].discription;} int pingValue(int p); void set(int Id, int value); void remove(int Id); diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/priority.hpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/priority.hpp index 19f34ab3..516619db 100644 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/priority.hpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/priority.hpp @@ -37,12 +37,12 @@ template class PriorityQueue PriorityQueue(int queueSize); ~PriorityQueue(); - T* Top(); // returns NULL if queue is empty - T* TopRemove(); // returns NULL if queue is empty - T* TopRemove(P priority); // removes item from queue if it has a lower priority value, otherwise return NULL + T* Top(); // returns nullptr if queue is empty + T* TopRemove(); // returns nullptr if queue is empty + T* TopRemove(P priority); // removes item from queue if it has a lower priority value, otherwise return nullptr T* Add(T* entry, P priority); // reprioritizes if already in queue, returns entry always T* Remove(T* entry); // returns entry always (even if it was not in the queue) - P *GetPriority(T* entry); // returns NULL if entry is not in the queue + P *GetPriority(T* entry); // returns nullptr if entry is not in the queue int QueueUsed(); // returns how many entries are in the queue protected: struct QueueEntry @@ -88,14 +88,14 @@ template PriorityQueue::~PriorityQueue() template T* PriorityQueue::Top() { if (mQueueEnd == 0) - return(NULL); + return(nullptr); return(mQueue[0].entry); } template T* PriorityQueue::TopRemove() { if (mQueueEnd == 0) - return(NULL); + return(nullptr); T* top = mQueue[0].entry; Remove(top); return(top); @@ -105,14 +105,14 @@ template T* PriorityQueue::TopRemove(P priority) { if (mQueueEnd > 0 && mQueue[0].priority <= priority) return(Remove(mQueue[0].entry)); - return(NULL); + return(nullptr); } template P* PriorityQueue::GetPriority(T* entry) { if (entry->mPriorityQueuePosition >= 0) return(&mQueue[entry->mPriorityQueuePosition].priority); - return(NULL); + return(nullptr); } template T* PriorityQueue::Add(T* entry, P priority) @@ -121,7 +121,7 @@ template T* PriorityQueue::Add(T* entry, P priorit { // not in queue, so add it to the bottom if (mQueueEnd >= mQueueSize) - return(NULL); + return(nullptr); mQueue[mQueueEnd].entry = entry; mQueue[mQueueEnd].priority = priority; mQueue[mQueueEnd].entry->mPriorityQueuePosition = mQueueEnd; diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/stringutils.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/stringutils.cpp index be0a4376..07c4bcc2 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/stringutils.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/stringutils.cpp @@ -78,12 +78,12 @@ namespace soe if (pos == std::string::npos) { // tok not found take the whole thing - if (dest != NULL) { dest->assign(*base);} + if (dest != nullptr) { dest->assign(*base);} base->clear(); return; } - if (dest != NULL) {dest->assign(base->substr(0,pos));} + if (dest != nullptr) {dest->assign(base->substr(0,pos));} base->erase(0,pos + tok.length()); } diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/stringutils.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/stringutils.h index f994210c..f70facc5 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/stringutils.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/stringutils.h @@ -21,7 +21,7 @@ namespace soe void trim(std::string& str); void crack(std::string * dest, std::string * base, const std::string& tok); void inline crack(std::string& dest, std::string& base, const std::string& tok) {crack(&dest, &base, tok);} - void inline crack(std::string& base, const std::string& tok) {crack(NULL, &base, tok);} + void inline crack(std::string& base, const std::string& tok) {crack(nullptr, &base, tok);} class lowerCaseString { diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/substringSearchTree.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/substringSearchTree.h index 9acfcea7..ebe0729d 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/substringSearchTree.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/substringSearchTree.h @@ -156,15 +156,15 @@ private: class letterNode { public: - letterNode() : mpData(NULL), mpChildren(NULL), mNumChildren(0) { } - letterNode(const letter_t & letter) : mLetter(letter), mpData(NULL), mpChildren(NULL), mNumChildren(0) { } + letterNode() : mpData(nullptr), mpChildren(nullptr), mNumChildren(0) { } + letterNode(const letter_t & letter) : mLetter(letter), mpData(nullptr), mpChildren(nullptr), mNumChildren(0) { } ~letterNode(); - inline bool hasData() const { return (mpData != NULL); } + inline bool hasData() const { return (mpData != nullptr); } inline data_t & getData() { return *mpData; } inline const data_t & getData() const { return *mpData; } inline void setData(const data_t & data) { if (mpData) { *mpData = data; } else { mpData = new data_t(data); } } - inline void removeData() { delete mpData; mpData = NULL; } + inline void removeData() { delete mpData; mpData = nullptr; } letterNode * get(letter_t index) const; bool put(letter_t index, letterNode ** tree); @@ -182,7 +182,7 @@ private: inline letter_t & letter() { return mLetter; } inline const letter_t & letter() const { return mLetter; } - inline bool hasNoChildren() const { return (mpChildren == NULL) || (mNumChildren == 0); } + inline bool hasNoChildren() const { return (mpChildren == nullptr) || (mNumChildren == 0); } private: letter_t mLetter; @@ -272,9 +272,9 @@ bool stringTree::seek(iter_t & start, const iter_t & stop, typ position.mBranch.push_back(&mRoot); } - const letterNode * pnode = (start != stop) ? position.mBranch.back() : NULL; + const letterNode * pnode = (start != stop) ? position.mBranch.back() : nullptr; - for (; (start != stop) && ((pnode = pnode->get(*start)) != NULL); start++) + for (; (start != stop) && ((pnode = pnode->get(*start)) != nullptr); start++) { position.mBranch.push_back(pnode); if (pnode->hasData()) { @@ -298,9 +298,9 @@ bool stringTree::seek(iter_t & start, const iter_t & stop, typ position.mBranch.push_back(&mRoot); } - const letterNode * pnode = (start != stop) ? position.mBranch.back() : NULL; + const letterNode * pnode = (start != stop) ? position.mBranch.back() : nullptr; - for (; (start != stop) && ((pnode = pnode->get(*start)) != NULL); start++) + for (; (start != stop) && ((pnode = pnode->get(*start)) != nullptr); start++) { position.mBranch.push_back(pnode); if (pnode->hasData()) { @@ -441,7 +441,7 @@ stringTree::letterNode::~letterNode() template typename stringTree::letterNode * stringTree::letterNode::get(letter_t index) const { - letterNode * tree = NULL; + letterNode * tree = nullptr; letterNode * end = mpChildren + mNumChildren; letterNode * place = std::lower_bound(mpChildren, mpChildren + mNumChildren, index); @@ -495,10 +495,10 @@ bool stringTree::letterNode::take(letter_t index, bool dealloc mNumChildren--; if (!mNumChildren) { deallocate = true; } - letterNode * children = NULL; + letterNode * children = nullptr; if (deallocate) { - children = mNumChildren ? new letterNode[mNumChildren] : NULL; + children = mNumChildren ? new letterNode[mNumChildren] : nullptr; } else { children = mpChildren; } @@ -536,7 +536,7 @@ void stringTree::const_iterator::getKey(string_t & key) const template typename stringTree::letterNode * stringTree::letterNode::firstChild() const { - letterNode * child = NULL; + letterNode * child = nullptr; if (mpChildren) { child = mpChildren; @@ -548,7 +548,7 @@ typename stringTree::letterNode * stringTree template typename stringTree::letterNode * stringTree::letterNode::lastChild() const { - letterNode * child = NULL; + letterNode * child = nullptr; if (mpChildren) { child = mpChildren + mNumChildren - 1; @@ -560,7 +560,7 @@ typename stringTree::letterNode * stringTree template typename stringTree::letterNode * stringTree::letterNode::nextChild(const letterNode * child) const { - letterNode * next = NULL; + letterNode * next = nullptr; if (mpChildren) { size_t index = child - mpChildren; @@ -577,7 +577,7 @@ typename stringTree::letterNode * stringTree template typename stringTree::letterNode * stringTree::letterNode::previousChild(const letterNode * child) const { - letterNode * previous = NULL; + letterNode * previous = nullptr; if (mpChildren) { size_t index = child - mpChildren; @@ -623,13 +623,13 @@ template bool stringTree::const_iterator::advance() { bool wentForward = false; - const letterNode * terminal = NULL; - const letterNode * penultimate = NULL; - const letterNode * next = NULL; + const letterNode * terminal = nullptr; + const letterNode * penultimate = nullptr; + const letterNode * next = nullptr; if (mBranch.back()->hasNoChildren()) { // go forward - while ((mBranch.size() >= 2) && (next == NULL)) + while ((mBranch.size() >= 2) && (next == nullptr)) { penultimate = mBranch[mBranch.size() - 2]; terminal = mBranch[mBranch.size() - 1]; @@ -654,9 +654,9 @@ template bool stringTree::const_iterator::retreat() { bool wentBack = false; - const letterNode * terminal = NULL; - const letterNode * penultimate = NULL; - const letterNode * next = NULL; + const letterNode * terminal = nullptr; + const letterNode * penultimate = nullptr; + const letterNode * next = nullptr; if (mBranch.size() >= 2) { // go backwards @@ -670,7 +670,7 @@ bool stringTree::const_iterator::retreat() mBranch.pop_back(); } // go to leaf - for (; next != NULL; next = next->lastChild()) + for (; next != nullptr; next = next->lastChild()) { mBranch.push_back(next); if (next->hasData() && next->hasNoChildren()) { @@ -724,9 +724,9 @@ template void stringTree::setBegin() const { mBegin.mBranch.clear(); - const letterNode * leaf = NULL; + const letterNode * leaf = nullptr; - for (leaf = &mRoot; leaf != NULL; leaf = leaf->firstChild()) + for (leaf = &mRoot; leaf != nullptr; leaf = leaf->firstChild()) { mBegin.mBranch.push_back(leaf); if (leaf->hasData()) { @@ -782,7 +782,7 @@ template template const data_t * stringTree::finder::data() const { - const data_t * pData = NULL; + const data_t * pData = nullptr; if (mDictionaryIter != mDictionary.end()) { pData = &(*mDictionaryIter); diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/thread.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/thread.cpp index af797230..7115e242 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/thread.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/thread.cpp @@ -120,10 +120,10 @@ Event::Event(bool signaled) : mEvent() { #ifdef WIN32 - mEvent = CreateEvent(NULL, FALSE, signaled ? TRUE : FALSE, NULL); + mEvent = CreateEvent(nullptr, FALSE, signaled ? TRUE : FALSE, nullptr); #else - pthread_mutex_init(&mMutex, NULL); - pthread_cond_init(&mCond, NULL); + pthread_mutex_init(&mMutex, nullptr); + pthread_cond_init(&mCond, nullptr); #endif } @@ -162,7 +162,7 @@ bool Event::Wait(unsigned timeoutMilliseconds) { struct timeval now; struct timespec abs_timeout; - gettimeofday(&now, NULL); + gettimeofday(&now, nullptr); abs_timeout.tv_sec = now.tv_sec + timeoutMilliseconds/1000; abs_timeout.tv_nsec = now.tv_usec * 1000 + (timeoutMilliseconds%1000)*1000000; abs_timeout.tv_sec += abs_timeout.tv_nsec / 1000000000; @@ -198,10 +198,10 @@ EventLock::EventLock(bool locked) : mEvent() { #ifdef WIN32 - mEvent = CreateEvent(NULL, TRUE, locked ? FALSE : TRUE, NULL); + mEvent = CreateEvent(nullptr, TRUE, locked ? FALSE : TRUE, nullptr); #else - pthread_mutex_init(&mMutex, NULL); - pthread_cond_init(&mCond, NULL); + pthread_mutex_init(&mMutex, nullptr); + pthread_cond_init(&mCond, nullptr); #endif } @@ -243,7 +243,7 @@ bool EventLock::Wait(unsigned timeoutMilliseconds) { struct timeval now; struct timespec abs_timeout; - gettimeofday(&now, NULL); + gettimeofday(&now, nullptr); abs_timeout.tv_sec = now.tv_sec + timeoutMilliseconds/1000; abs_timeout.tv_nsec = now.tv_usec * 1000 + (timeoutMilliseconds%1000)*1000000; abs_timeout.tv_sec += abs_timeout.tv_nsec / 1000000000; diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/utf8.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/utf8.cpp index ce6b8f16..ba5cc0d7 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/utf8.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/utf8.cpp @@ -81,7 +81,7 @@ namespace soe size_t UTF8_convertToUTF16( char * ptr , UTF16 * ret, size_t limit ) { size_t len = 0; - while (( *ptr != 0 ) && ( len < ( limit - 1 ) ))//we use limit -1 to leave room for the null terminator + while (( *ptr != 0 ) && ( len < ( limit - 1 ) ))//we use limit -1 to leave room for the nullptr terminator { size_t clen = UTF8_convertCharToUTF16( ptr, ret ); ptr += clen; diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/IPAddress.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/IPAddress.h index f6d5f886..03b59e8d 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/IPAddress.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/IPAddress.h @@ -32,7 +32,7 @@ public: * @brief Used to retreive the the dot-notation represenatatiion of this address. * * @param buffer A pointer to the buffer to place the ip address into. - * Must be at least 17 characters long, will be null terminated. + * Must be at least 17 characters long, will be nullptr terminated. * * @return A pointer to the buffer the address was placed into. */ diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpBlockAllocator.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpBlockAllocator.cpp index 6d476d78..b7da0f27 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpBlockAllocator.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpBlockAllocator.cpp @@ -6,7 +6,7 @@ namespace NAMESPACE #endif TcpBlockAllocator::TcpBlockAllocator(const unsigned initSize, const unsigned initCount) -: m_freeHead(NULL), m_blockCount(initCount), m_blockSize(initSize), m_numAvailBlocks(0) +: m_freeHead(nullptr), m_blockCount(initCount), m_blockSize(initSize), m_numAvailBlocks(0) { realloc(); } @@ -33,7 +33,7 @@ data_block *TcpBlockAllocator::getBlock() tmp = m_freeHead; m_freeHead = m_freeHead->m_next; - tmp->m_next = NULL; + tmp->m_next = nullptr; m_numAvailBlocks--; return(tmp); } @@ -56,7 +56,7 @@ void TcpBlockAllocator::returnBlock(data_block *b) void TcpBlockAllocator::realloc() { - data_block *tmp = NULL, *cursor = NULL; + data_block *tmp = nullptr, *cursor = nullptr; tmp = new data_block; m_numAvailBlocks++; cursor = tmp; diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpConnection.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpConnection.cpp index 42329552..a41ad0df 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpConnection.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpConnection.cpp @@ -11,28 +11,28 @@ namespace NAMESPACE //used when want to open new connection with this socket TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, const IPAddress &destIP, unsigned short destPort, unsigned timeout) -: m_nextConnection(NULL), - m_prevConnection(NULL), +: m_nextConnection(nullptr), + m_prevConnection(nullptr), m_socket(INVALID_SOCKET), - m_nextKeepAliveConnection(NULL), - m_prevKeepAliveConnection(NULL), + m_nextKeepAliveConnection(nullptr), + m_prevKeepAliveConnection(nullptr), m_aliveListId(tcpManager->m_aliveList.m_listID), - m_nextRecvDataConnection(NULL), - m_prevRecvDataConnection(NULL), + m_nextRecvDataConnection(nullptr), + m_prevRecvDataConnection(nullptr), m_recvDataListId(tcpManager->m_dataList.m_listID), m_manager(tcpManager), m_status(StatusNegotiating), - m_handler(NULL), + m_handler(nullptr), m_destIP(destIP), m_destPort(destPort), m_refCount(0), m_sendAllocator(sendAlloc), - m_head(NULL), - m_tail(NULL), + m_head(nullptr), + m_tail(nullptr), m_bytesRead(0), m_bytesNeeded(0), m_params(params), - m_recvBuff(NULL), + m_recvBuff(nullptr), m_connectTimeout(timeout), m_connectTimer(), m_wasConRemovedFromMgr(false), @@ -94,28 +94,28 @@ TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAllo //used when server mode creates new connection object representing a connect request TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, SOCKET socket, const IPAddress &destIP, unsigned short destPort) -: m_nextConnection(NULL), - m_prevConnection(NULL), +: m_nextConnection(nullptr), + m_prevConnection(nullptr), m_socket(socket), - m_nextKeepAliveConnection(NULL), - m_prevKeepAliveConnection(NULL), + m_nextKeepAliveConnection(nullptr), + m_prevKeepAliveConnection(nullptr), m_aliveListId(tcpManager->m_aliveList.m_listID), - m_nextRecvDataConnection(NULL), - m_prevRecvDataConnection(NULL), + m_nextRecvDataConnection(nullptr), + m_prevRecvDataConnection(nullptr), m_recvDataListId(tcpManager->m_dataList.m_listID), m_manager(tcpManager), m_status(StatusConnected), - m_handler(NULL), + m_handler(nullptr), m_destIP(destIP), m_destPort(destPort), m_refCount(0), m_sendAllocator(sendAlloc), - m_head(NULL), - m_tail(NULL), + m_head(nullptr), + m_tail(nullptr), m_bytesRead(0), m_bytesNeeded(0), m_params(params), - m_recvBuff(NULL), + m_recvBuff(nullptr), m_connectTimeout(0), m_connectTimer(), m_wasConRemovedFromMgr(false) @@ -206,7 +206,7 @@ int TcpConnection::finishConnect() t.tv_sec = 0; t.tv_usec = 0; - int err = select(m_socket + 1, NULL, &wrSet, NULL, &t); + int err = select(m_socket + 1, nullptr, &wrSet, nullptr, &t); if (err == 0) { @@ -303,7 +303,7 @@ TcpConnection::~TcpConnection() { delete [] m_recvBuff; - while(m_head != NULL) + while(m_head != nullptr) { data_block *tmp = m_head; m_head = m_head->m_next; @@ -327,22 +327,22 @@ void TcpConnection::Send(const char *data, unsigned int dataLen) { m_aliveListId = m_manager->m_keepAliveList.m_listID; - if (m_prevKeepAliveConnection != NULL) + if (m_prevKeepAliveConnection != nullptr) m_prevKeepAliveConnection->m_nextKeepAliveConnection = m_nextKeepAliveConnection; - if (m_nextKeepAliveConnection != NULL) + if (m_nextKeepAliveConnection != nullptr) m_nextKeepAliveConnection->m_prevKeepAliveConnection = m_prevKeepAliveConnection; if (m_manager->m_keepAliveList.m_beginList == this) m_manager->m_keepAliveList.m_beginList = m_nextKeepAliveConnection; m_nextKeepAliveConnection = m_manager->m_aliveList.m_beginList; - m_prevKeepAliveConnection = NULL; - if (m_manager->m_aliveList.m_beginList != NULL) + m_prevKeepAliveConnection = nullptr; + if (m_manager->m_aliveList.m_beginList != nullptr) m_manager->m_aliveList.m_beginList->m_prevKeepAliveConnection = this; m_manager->m_aliveList.m_beginList = this; } - data_block *work = NULL; + data_block *work = nullptr; // this connection has no send buffer. Get a block if(!m_tail) @@ -471,16 +471,16 @@ int TcpConnection::processIncoming() { m_recvDataListId = m_manager->m_noDataList.m_listID; - if (m_prevRecvDataConnection != NULL) + if (m_prevRecvDataConnection != nullptr) m_prevRecvDataConnection->m_nextRecvDataConnection = m_nextRecvDataConnection; - if (m_nextRecvDataConnection != NULL) + if (m_nextRecvDataConnection != nullptr) m_nextRecvDataConnection->m_prevRecvDataConnection = m_prevRecvDataConnection; if (m_manager->m_noDataList.m_beginList == this) m_manager->m_noDataList.m_beginList = m_nextRecvDataConnection; m_nextRecvDataConnection = m_manager->m_dataList.m_beginList; - m_prevRecvDataConnection = NULL; - if (m_manager->m_dataList.m_beginList != NULL) + m_prevRecvDataConnection = nullptr; + if (m_manager->m_dataList.m_beginList != nullptr) m_manager->m_dataList.m_beginList->m_prevRecvDataConnection = this; m_manager->m_dataList.m_beginList = this; } @@ -626,7 +626,7 @@ int TcpConnection::processOutgoing() int sendError = 1; - // If m_head is not null, then this connection has something to send + // If m_head is not nullptr, then this connection has something to send if(m_head) diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpConnection.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpConnection.h index 36a41e9f..efe2d031 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpConnection.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpConnection.h @@ -50,7 +50,7 @@ public: * connection is disconnected, you simply need to derive your class * (multiply if necessary) from TcpConnectionHandler, then you can use * this method to set the object the TcpConnection will call as appropriate. - * default = NULL (no callbacks made) + * default = nullptr (no callbacks made) * * @param handler The object which will be called for notifications. */ diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpManager.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpManager.cpp index 53105f3d..6f31e9ae 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpManager.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpManager.cpp @@ -57,14 +57,14 @@ TcpManager::TcpParams::TcpParams(const TcpParams &cpy) } TcpManager::TcpManager(const TcpParams ¶ms) -: m_handler(NULL), - m_keepAliveList(NULL, 1), - m_aliveList(NULL, 2), - m_noDataList(NULL, 1), - m_dataList(NULL, 2), +: m_handler(nullptr), + m_keepAliveList(nullptr, 1), + m_aliveList(nullptr, 2), + m_noDataList(nullptr, 1), + m_dataList(nullptr, 2), m_params(params), m_refCount(1), - m_connectionList(NULL), + m_connectionList(nullptr), m_connectionListCount(0), m_socket(INVALID_SOCKET), m_boundAsServer(false), @@ -103,7 +103,7 @@ TcpManager::~TcpManager() close(m_socket); #endif } - while (m_connectionList != NULL) + while (m_connectionList != nullptr) { TcpConnection *con = m_connectionList; con->AddRef(); @@ -179,7 +179,7 @@ bool TcpManager::BindAsServer() { struct hostent * lphp; lphp = gethostbyname(m_params.bindAddress); - if (lphp != NULL) + if (lphp != nullptr) addr_loc.sin_addr.s_addr = ((struct in_addr *)(lphp->h_addr))->s_addr; } else @@ -204,7 +204,7 @@ bool TcpManager::BindAsServer() TcpConnection *TcpManager::acceptClient() { - TcpConnection *newConn = NULL; + TcpConnection *newConn = nullptr; if (m_boundAsServer && m_connectionListCount < m_params.maxConnections) { @@ -218,7 +218,7 @@ TcpConnection *TcpManager::acceptClient() { newConn = new TcpConnection(this, &m_allocator, m_params, sock, IPAddress(addr.sin_addr.s_addr), ntohs(addr.sin_port)); addNewConnection(newConn); - if (m_handler != NULL) + if (m_handler != nullptr) { m_handler->OnConnectRequest(newConn); } @@ -243,8 +243,8 @@ SOCKET TcpManager::getMaxFD() if (m_boundAsServer) maxfd = m_socket+1; - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) { next = con->m_nextConnection; if (con->GetStatus() != TcpConnection::StatusDisconnected && con->m_socket > maxfd) @@ -258,8 +258,8 @@ SOCKET TcpManager::getMaxFD() TcpConnection *TcpManager::getConnection(SOCKET fd) { - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) { next = con->m_nextConnection; if (con->m_socket == fd) @@ -268,7 +268,7 @@ TcpConnection *TcpManager::getConnection(SOCKET fd) } } //if get here ,couldn't find it - return NULL; + return nullptr; } bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendTimePerConnection, unsigned maxRecvTimePerConnection) @@ -290,8 +290,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT { // Send output from last heartbeat - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) { con->AddRef(); if (next) next->Release(); @@ -358,7 +358,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT tmpfds = m_permfds; timeout.tv_sec = 0; timeout.tv_usec = 0; - int cnt = select(maxfd, &tmpfds, NULL, NULL, &timeout); // blocks for timeout + int cnt = select(maxfd, &tmpfds, nullptr, nullptr, &timeout); // blocks for timeout if (cnt > 0) @@ -384,8 +384,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //process incoming client messages if (maxRecvTimePerConnection != 0) { - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) { con->AddRef(); if (next) next->Release(); @@ -450,8 +450,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT pollfds[0].events |= POLLIN; } - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next, idx++) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next, idx++) { next = con->m_nextConnection; pollfds[idx].fd = con->m_socket; @@ -491,7 +491,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT } //process regular msg(s) - if (con == NULL) + if (con == nullptr) { close(pollfds[idx].fd); continue; @@ -523,7 +523,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT }//if(pollfds[... else if (pollfds[idx].revents & POLLHUP) { - if (con == NULL) + if (con == nullptr) { close(pollfds[idx].fd); continue; @@ -541,21 +541,21 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //now process any keepalives, if time to do that if (m_params.keepAliveDelay > 0 && m_keepAliveTimer.isDone(m_params.keepAliveDelay)) { - TcpConnection *next = NULL; - for (TcpConnection *con = m_keepAliveList.m_beginList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_keepAliveList.m_beginList ; con != nullptr ; con = next) { con->AddRef(); if (next) next->Release(); next = con->m_nextKeepAliveConnection; if (next) next->AddRef(); - con->Send(NULL, 0); //note: this request will move the connection from the keepAliveList to the aliveList + con->Send(nullptr, 0); //note: this request will move the connection from the keepAliveList to the aliveList con->Release(); } //now move the complete alive list over to the keepalive list to reset those timers m_keepAliveList.m_beginList = m_aliveList.m_beginList; - m_aliveList.m_beginList = NULL; + m_aliveList.m_beginList = nullptr; //switch id's for those connections that were in the alive list last go - around int tmpID = m_aliveList.m_listID; @@ -569,8 +569,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //now process any noDataCons, if time to do that if (m_params.noDataTimeout > 0 && m_noDataTimer.isDone(m_params.noDataTimeout)) { - TcpConnection *next = NULL; - for (TcpConnection *con = m_noDataList.m_beginList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_noDataList.m_beginList ; con != nullptr ; con = next) { con->AddRef(); if (next) next->Release(); @@ -584,7 +584,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //now move the complete data list over to the nodata list to reset those timers m_noDataList.m_beginList = m_dataList.m_beginList; - m_dataList.m_beginList = NULL; + m_dataList.m_beginList = nullptr; //switch id's for those connections that were in the data list last go - around int tmpID = m_dataList.m_listID; @@ -606,17 +606,17 @@ TcpConnection *TcpManager::EstablishConnection(const char *serverAddress, unsign { //can't open outgoing connections when in server mode // use a different TcpManager to do that - return NULL; + return nullptr; } if (m_connectionListCount >= m_params.maxConnections) - return(NULL); + return(nullptr); // get server address unsigned long address = inet_addr(serverAddress); if (address == INADDR_NONE) { - if (m_dnsMap[serverAddress].timeout >= time(NULL)) + if (m_dnsMap[serverAddress].timeout >= time(nullptr)) { address = m_dnsMap[serverAddress].addr; } @@ -624,12 +624,12 @@ TcpConnection *TcpManager::EstablishConnection(const char *serverAddress, unsign { struct hostent * lphp; lphp = gethostbyname(serverAddress); - if (lphp == NULL) - return(NULL); + if (lphp == nullptr) + return(nullptr); address = ((struct in_addr *)(lphp->h_addr))->s_addr; m_dnsMap[serverAddress].addr = address; - m_dnsMap[serverAddress].timeout = time(NULL)+DNS_TIMEOUT; + m_dnsMap[serverAddress].timeout = time(nullptr)+DNS_TIMEOUT; } } IPAddress destIP(address); @@ -649,22 +649,22 @@ void TcpManager::addNewConnection(TcpConnection *con) FD_SET(con->m_socket, &m_permfds); #endif con->m_nextConnection = m_connectionList; - con->m_prevConnection = NULL; - if (m_connectionList != NULL) + con->m_prevConnection = nullptr; + if (m_connectionList != nullptr) m_connectionList->m_prevConnection = con; m_connectionList = con; m_connectionListCount++; con->m_nextKeepAliveConnection = m_aliveList.m_beginList; - con->m_prevKeepAliveConnection = NULL; - if (m_aliveList.m_beginList != NULL) + con->m_prevKeepAliveConnection = nullptr; + if (m_aliveList.m_beginList != nullptr) m_aliveList.m_beginList->m_prevKeepAliveConnection = con; m_aliveList.m_beginList = con; con->m_aliveListId = m_keepAliveList.m_listID;//start it out thinking it's already in the alive list, since it is con->m_nextRecvDataConnection = m_dataList.m_beginList; - con->m_prevRecvDataConnection = NULL; - if (m_dataList.m_beginList != NULL) + con->m_prevRecvDataConnection = nullptr; + if (m_dataList.m_beginList != nullptr) m_dataList.m_beginList->m_prevRecvDataConnection = con; m_dataList.m_beginList = con; con->m_recvDataListId = m_noDataList.m_listID;//start it out thinking it's already in the data list, since it is @@ -682,40 +682,40 @@ void TcpManager::removeConnection(TcpConnection *con) FD_CLR(con->m_socket, &m_permfds); } #endif - if (con->m_prevConnection != NULL) + if (con->m_prevConnection != nullptr) con->m_prevConnection->m_nextConnection = con->m_nextConnection; - if (con->m_nextConnection != NULL) + if (con->m_nextConnection != nullptr) con->m_nextConnection->m_prevConnection = con->m_prevConnection; if (m_connectionList == con) m_connectionList = con->m_nextConnection; - con->m_nextConnection = NULL; - con->m_prevConnection = NULL; + con->m_nextConnection = nullptr; + con->m_prevConnection = nullptr; - if (con->m_prevKeepAliveConnection != NULL) + if (con->m_prevKeepAliveConnection != nullptr) con->m_prevKeepAliveConnection->m_nextKeepAliveConnection = con->m_nextKeepAliveConnection; - if (con->m_nextKeepAliveConnection != NULL) + if (con->m_nextKeepAliveConnection != nullptr) con->m_nextKeepAliveConnection->m_prevKeepAliveConnection = con->m_prevKeepAliveConnection; if (m_aliveList.m_beginList == con) m_aliveList.m_beginList = con->m_nextKeepAliveConnection; else if (m_keepAliveList.m_beginList == con) m_keepAliveList.m_beginList = con->m_nextKeepAliveConnection; - con->m_nextKeepAliveConnection = NULL; - con->m_prevKeepAliveConnection = NULL; + con->m_nextKeepAliveConnection = nullptr; + con->m_prevKeepAliveConnection = nullptr; - if (con->m_prevRecvDataConnection != NULL) + if (con->m_prevRecvDataConnection != nullptr) con->m_prevRecvDataConnection->m_nextRecvDataConnection = con->m_nextRecvDataConnection; - if (con->m_nextRecvDataConnection != NULL) + if (con->m_nextRecvDataConnection != nullptr) con->m_nextRecvDataConnection->m_prevRecvDataConnection = con->m_prevRecvDataConnection; if (m_dataList.m_beginList == con) m_dataList.m_beginList = con->m_nextRecvDataConnection; else if (m_noDataList.m_beginList == con) m_noDataList.m_beginList = con->m_nextRecvDataConnection; - con->m_nextRecvDataConnection = NULL; - con->m_prevRecvDataConnection = NULL; + con->m_nextRecvDataConnection = nullptr; + con->m_prevRecvDataConnection = nullptr; diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpManager.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpManager.h index b2192dff..e9b9e176 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpManager.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpManager.h @@ -168,7 +168,7 @@ public: * simply need to derive your class (multiply if necessary) from TcpManagerHandler, then you can use * this method to set the object the TcpManager will call as appropriate. The TcpConnection object * also has a handler mechanism that replaces the other callback functions below, see TcpConnection::SetHandler - * default = NULL (no callbacks made) + * default = nullptr (no callbacks made) * * @param handler The object which will be called for manager related notifications. */ @@ -223,7 +223,7 @@ public: * the connect-complete callback to be called if the connection is succesfull. * * @return A pointer to a TcpConnection object. - * NULL if the manager object has exceeded its maximum number of connections + * nullptr if the manager object has exceeded its maximum number of connections * or if the serverAddress cannot be resolved to an IP address. */ TcpConnection *EstablishConnection(const char *serverAddress, unsigned short serverPort, unsigned timeout = 0); diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpLibrary.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpLibrary.cpp index f8221166..f86f5d7b 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpLibrary.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpLibrary.cpp @@ -150,7 +150,7 @@ UdpIpAddress::UdpIpAddress(unsigned int ip) char *UdpIpAddress::GetAddress(char *buffer) const { - assert(buffer != NULL); + assert(buffer != nullptr); struct sockaddr_in addr_serverUDP; addr_serverUDP.sin_addr.s_addr = mIp; @@ -163,7 +163,7 @@ char *UdpIpAddress::GetAddress(char *buffer) const ///////////////////////////////////////////////////////////////////////////////////////////////////// UdpManager::Params::Params() { - handler = NULL; + handler = nullptr; outgoingBufferSize = 64 * 1024; incomingBufferSize = 64 * 1024; packetHistoryMax = 100; @@ -265,7 +265,7 @@ UdpManager::UdpManager(const UdpManager::Params *params) mParams.maxDataHoldSize = udpMin(mParams.maxDataHoldSize, mParams.maxRawPacketSize); mParams.packetHistoryMax = udpMax(1, mParams.packetHistoryMax); mPacketHistoryPosition = 0; - mPassThroughData = NULL; + mPassThroughData = nullptr; typedef PacketHistoryEntry *PacketHistoryEntryPtr; mPacketHistory = new PacketHistoryEntryPtr[mParams.packetHistoryMax]; @@ -286,17 +286,17 @@ UdpManager::UdpManager(const UdpManager::Params *params) mUdpSocket = INVALID_SOCKET; mConnectionListCount = 0; - mConnectionList = NULL; + mConnectionList = nullptr; mPoolCreated = 0; mPoolAvailable = 0; - mPoolAvailableRoot = NULL; - mPoolCreatedRoot = NULL; + mPoolAvailableRoot = nullptr; + mPoolCreatedRoot = nullptr; mWrappedCreated = 0; mWrappedAvailable = 0; - mWrappedAvailableRoot = NULL; - mWrappedCreatedRoot = NULL; + mWrappedAvailableRoot = nullptr; + mWrappedCreatedRoot = nullptr; for (i = 0; i < mParams.pooledPacketInitial && i < mParams.pooledPacketMax; i++) { @@ -306,16 +306,16 @@ UdpManager::UdpManager(const UdpManager::Params *params) lp->Release(); } - mSimulateQueueStart = NULL; - mSimulateQueueEnd = NULL; + mSimulateQueueStart = nullptr; + mSimulateQueueEnd = nullptr; mSimulateNextOutgoingTime = 0; mSimulateNextIncomingTime = 0; mSimulateQueueBytes = 0; - mDisconnectPendingList = NULL; + mDisconnectPendingList = nullptr; if (mParams.avoidPriorityQueue) - mPriorityQueue = NULL; + mPriorityQueue = nullptr; else mPriorityQueue = new PriorityQueue(mParams.maxConnections); @@ -346,14 +346,14 @@ UdpManager::~UdpManager() // first we need to tell all the pooled packets we have created that they can no longer check themselves back into use // when they are released PooledLogicalPacket *walk = mPoolCreatedRoot; - while (walk != NULL) + while (walk != nullptr) { - walk->mUdpManager = NULL; + walk->mUdpManager = nullptr; walk = walk->mCreatedNext; } // next release the ones we have in our available pool walk = mPoolAvailableRoot; - while (walk != NULL) + while (walk != nullptr) { PooledLogicalPacket *hold = walk; walk = walk->mAvailableNext; @@ -366,14 +366,14 @@ UdpManager::~UdpManager() // next we need to tell all the warpped packets we have created that they can no longer check themselves back into use // when they are released WrappedLogicalPacket *walk = mWrappedCreatedRoot; - while (walk != NULL) + while (walk != nullptr) { - walk->mUdpManager = NULL; + walk->mUdpManager = nullptr; walk = walk->mCreatedNext; } // next release the ones we have in our available pool walk = mWrappedAvailableRoot; - while (walk != NULL) + while (walk != nullptr) { WrappedLogicalPacket *hold = walk; walk = walk->mAvailableNext; @@ -383,7 +383,7 @@ UdpManager::~UdpManager() // next thing we must do is tell all the connections to disconnect (which severs their link to this dying manager) // this has to be done first since they will call back into us and have themselves removed from our connection-list/priority-queue/etc - while (mConnectionList != NULL) + while (mConnectionList != nullptr) { mConnectionList->InternalDisconnect(0, UdpConnection::cDisconnectReasonManagerDeleted); // the above call ended up calling us back and removing them from our connection list, so now mConnectionList is pointing to the next entry @@ -391,7 +391,7 @@ UdpManager::~UdpManager() } // release any objects that were pending disconnection - while (mDisconnectPendingList != NULL) + while (mDisconnectPendingList != nullptr) { UdpConnection *next = mDisconnectPendingList->mDisconnectPendingNextConnection; mDisconnectPendingList->Release(); @@ -416,7 +416,7 @@ UdpManager::~UdpManager() } delete[] mPacketHistory; - while (mSimulateQueueStart != NULL) + while (mSimulateQueueStart != nullptr) { SimulateQueueEntry *entry = mSimulateQueueStart; mSimulateQueueStart = entry->mNext; @@ -529,12 +529,12 @@ void UdpManager::ProcessDisconnectPending() { UdpConnection *entry = mDisconnectPendingList; UdpConnection **prev = &mDisconnectPendingList; - while (entry != NULL) + while (entry != nullptr) { if (entry->GetStatus() == UdpConnection::cStatusDisconnected) { *prev = entry->mDisconnectPendingNextConnection; - entry->mDisconnectPendingNextConnection = NULL; + entry->mDisconnectPendingNextConnection = nullptr; entry->Release(); entry = *prev; } @@ -548,19 +548,19 @@ void UdpManager::ProcessDisconnectPending() void UdpManager::RemoveConnection(UdpConnection *con) { - assert(con != NULL); // attemped to remove a NULL connection object + assert(con != nullptr); // attemped to remove a nullptr connection object // note: it's a bug to Remove a connection object that is already removed...should never be able to happen. mConnectionListCount--; - if (con->mPrevConnection != NULL) + if (con->mPrevConnection != nullptr) con->mPrevConnection->mNextConnection = con->mNextConnection; - if (con->mNextConnection != NULL) + if (con->mNextConnection != nullptr) con->mNextConnection->mPrevConnection = con->mPrevConnection; if (mConnectionList == con) mConnectionList = con->mNextConnection; - con->mNextConnection = NULL; - con->mPrevConnection = NULL; - if (mPriorityQueue != NULL) + con->mNextConnection = nullptr; + con->mPrevConnection = nullptr; + if (mPriorityQueue != nullptr) mPriorityQueue->Remove(con); mAddressHashTable->Remove(con, AddressHashValue(con->mIp, con->mPort)); @@ -569,11 +569,11 @@ void UdpManager::RemoveConnection(UdpConnection *con) void UdpManager::AddConnection(UdpConnection *con) { - assert(con != NULL); // attemped to add a NULL connection object + assert(con != nullptr); // attemped to add a nullptr connection object con->mNextConnection = mConnectionList; - con->mPrevConnection = NULL; - if (mConnectionList != NULL) + con->mPrevConnection = nullptr; + if (mConnectionList != nullptr) mConnectionList->mPrevConnection = con; mConnectionList = con; mConnectionListCount++; @@ -586,7 +586,7 @@ void UdpManager::FlushAllMultiBuffer() { AddRef(); UdpConnection *cur = mConnectionList; - while (cur != NULL) + while (cur != nullptr) { cur->FlushMultiBuffer(); cur = cur->mNextConnection; @@ -609,7 +609,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) { PacketHistoryEntry *e = ActualReceive(); - if (e == NULL) + if (e == nullptr) { mLastEmptySocketBufferStamp = UdpMisc::Clock(); break; @@ -637,7 +637,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) if (giveConnectionsTime) { - if (mPriorityQueue != NULL) + if (mPriorityQueue != nullptr) { // give time to everybody in the priority-queue that needs it UdpMisc::ClockStamp curPriority = UdpMisc::Clock(); @@ -655,7 +655,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) for (;;) { UdpConnection *top = mPriorityQueue->TopRemove(curPriority); - if (top == NULL) + if (top == nullptr) break; top->AddRef(); top->GiveTime(); @@ -668,7 +668,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) { // give time to everybody UdpConnection *cur = mConnectionList; - while (cur != NULL) + while (cur != nullptr) { cur->GiveTime(); cur = cur->mNextConnection; @@ -678,7 +678,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) ProcessDisconnectPending(); } - if (mSimulateQueueStart != NULL && UdpMisc::Clock() >= mSimulateNextOutgoingTime) + if (mSimulateQueueStart != nullptr && UdpMisc::Clock() >= mSimulateNextOutgoingTime) { SimulateQueueEntry *entry = mSimulateQueueStart; mSimulateQueueStart = mSimulateQueueStart->mNext; @@ -686,7 +686,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) ActualSendHelper(entry->mData, entry->mDataLen, entry->mIp, entry->mPort); UdpConnection *con = AddressGetConnection(entry->mIp, entry->mPort); - if (con != NULL) + if (con != nullptr) con->mSimulateQueueBytes -= entry->mDataLen; mSimulateQueueBytes -= entry->mDataLen; delete entry; @@ -699,11 +699,11 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) UdpConnection *UdpManager::EstablishConnection(const char *serverAddress, int serverPort, int timeout) { assert(serverPort != 0); // can't connect to no port - assert(serverAddress != NULL); + assert(serverAddress != nullptr); assert(serverAddress[0] != 0); if (mConnectionListCount >= mParams.maxConnections) - return(NULL); + return(nullptr); // get server address unsigned long address = inet_addr(serverAddress); @@ -711,16 +711,16 @@ UdpConnection *UdpManager::EstablishConnection(const char *serverAddress, int se { struct hostent * lphp; lphp = gethostbyname(serverAddress); - if (lphp == NULL) - return(NULL); + if (lphp == nullptr) + return(nullptr); address = ((struct in_addr *)(lphp->h_addr))->s_addr; } UdpIpAddress destIp(address); // first, see if we already have a connection object managing this ip/port, if we do, then fail UdpConnection *con = AddressGetConnection(destIp, serverPort); - if (con != NULL) - return(NULL); + if (con != nullptr) + return(nullptr); return(new UdpConnection(this, destIp, serverPort, timeout)); } @@ -733,7 +733,7 @@ void UdpManager::KeepUntilDisconnected(UdpConnection *con) void UdpManager::GetStats(UdpManagerStatistics *stats) const { - assert(stats != NULL); + assert(stats != nullptr); *stats = mManagerStats; stats->poolAvailable = mPoolAvailable; stats->poolCreated = mPoolCreated; @@ -748,10 +748,10 @@ void UdpManager::ResetStats() void UdpManager::DumpPacketHistory(const char *filename) const { - assert(filename != NULL); + assert(filename != nullptr); assert(filename[0] != 0); FILE *file = fopen(filename, "wt"); - if (file != NULL) + if (file != nullptr) { // dump history of packets... for (int i = 0; i < mParams.packetHistoryMax; i++) @@ -797,7 +797,7 @@ int UdpManager::GetLocalPort() const UdpManager::PacketHistoryEntry *UdpManager::ActualReceive() { if (mParams.simulateIncomingByteRate > 0 && UdpMisc::Clock() < mSimulateNextIncomingTime) - return(NULL); + return(nullptr); struct sockaddr_in addr_from; socklen_t sf = sizeof(addr_from); @@ -807,7 +807,7 @@ UdpManager::PacketHistoryEntry *UdpManager::ActualReceive() if (res != SOCKET_ERROR) { if (mParams.simulateIncomingLossPercent > 0 && ((rand() % 100) < mParams.simulateIncomingLossPercent)) - return(NULL); // packet, what packet? + return(nullptr); // packet, what packet? if (mParams.simulateIncomingByteRate > 0) mSimulateNextIncomingTime = UdpMisc::Clock() + (res * 1000 / mParams.simulateIncomingByteRate); @@ -832,7 +832,7 @@ UdpManager::PacketHistoryEntry *UdpManager::ActualReceive() UdpIpAddress ip = UdpIpAddress(addr_from.sin_addr.s_addr); int port = (int)ntohs(addr_from.sin_port); UdpConnection *con = AddressGetConnection(ip, port); - if (con != NULL) + if (con != nullptr) { con->AddRef(); con->PortUnreachable(); @@ -852,7 +852,7 @@ UdpManager::PacketHistoryEntry *UdpManager::ActualReceive() } #endif } - return(NULL); + return(nullptr); } void UdpManager::ProcessIcmpErrors() @@ -880,7 +880,7 @@ void UdpManager::ProcessIcmpErrors() struct cmsghdr * cmsg; if(CMSG_FIRSTHDR(&msgh)) { - for(cmsg = CMSG_FIRSTHDR(&msgh); cmsg != NULL; cmsg = CMSG_NXTHDR(&msgh, cmsg)) + for(cmsg = CMSG_FIRSTHDR(&msgh); cmsg != nullptr; cmsg = CMSG_NXTHDR(&msgh, cmsg)) { if(cmsg->cmsg_level == SOL_IP && cmsg->cmsg_type == IP_RECVERR) { @@ -894,7 +894,7 @@ void UdpManager::ProcessIcmpErrors() UdpIpAddress ip = UdpIpAddress(msg_name.sin_addr.s_addr); int port = (int)htons(msg_name.sin_port); UdpConnection *con = AddressGetConnection(ip, port); - if (con != NULL) + if (con != nullptr) { con->AddRef(); con->PortUnreachable(); @@ -923,7 +923,7 @@ void UdpManager::ActualSend(const uchar *data, int dataLen, UdpIpAddress ip, int { // simulating outgoing byte-rate, so queue it up for sending later UdpConnection *con = AddressGetConnection(ip, port); - if (con != NULL) + if (con != nullptr) { if (mParams.simulateDestinationOverloadLevel > 0 && con->mSimulateQueueBytes + dataLen > mParams.simulateDestinationOverloadLevel) return; // no room, packet gets lost @@ -931,17 +931,17 @@ void UdpManager::ActualSend(const uchar *data, int dataLen, UdpIpAddress ip, int if (mParams.simulateOutgoingOverloadLevel > 0 && mSimulateQueueBytes + dataLen > mParams.simulateOutgoingOverloadLevel) return; // no room, packet gets lost - if (con != NULL) + if (con != nullptr) con->mSimulateQueueBytes += dataLen; mSimulateQueueBytes += dataLen; SimulateQueueEntry *entry = new SimulateQueueEntry(data, dataLen, ip, port); - if (mSimulateQueueStart != NULL) + if (mSimulateQueueStart != nullptr) mSimulateQueueEnd->mNext = entry; else mSimulateQueueStart = entry; mSimulateQueueEnd = entry; - mSimulateQueueEnd->mNext = NULL; + mSimulateQueueEnd->mNext = nullptr; return; } ActualSendHelper(data, dataLen, ip, port); @@ -964,7 +964,7 @@ void UdpManager::ActualSendHelper(const uchar *data, int dataLen, UdpIpAddress i // flag connection to terminate itself for port-unreachable error on next give time // we need to flag it instead of actually terminating it to prevent callbacks from occuring during application sends UdpConnection *con = AddressGetConnection(ip, port); - if (con != NULL) + if (con != nullptr) con->FlagPortUnreachable(); return; } @@ -1002,7 +1002,7 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) UdpConnection *con = AddressGetConnection(e->mIp, e->mPort); - if (con == NULL) + if (con == nullptr) { // packet coming from an unknown ip/port // if it is a connection request packet, then establish a new connection object to reply to it @@ -1012,7 +1012,7 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) if (mConnectionListCount >= mParams.maxConnections) return; // can't handle any more connections, so ignore this request entirely - if (mParams.handler != NULL) + if (mParams.handler != nullptr) { UdpConnection *newcon = new UdpConnection(this, e); mParams.handler->OnConnectRequest(newcon); @@ -1040,7 +1040,7 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) int encryptCode = UdpMisc::GetValue32(ptr); UdpConnection *con = ConnectCodeGetConnection(connectCode); - if (con != NULL) + if (con != nullptr) { if (mParams.allowAddressRemapping || con->mIp == e->mIp) { @@ -1090,25 +1090,25 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) UdpConnection *UdpManager::AddressGetConnection(UdpIpAddress ip, int port) const { UdpConnection *found = static_cast(mAddressHashTable->FindFirst(AddressHashValue(ip, port))); - while (found != NULL) + while (found != nullptr) { if (found->mIp == ip && found->mPort == port) return(found); found = static_cast(mAddressHashTable->FindNext(found)); } - return(NULL); + return(nullptr); } UdpConnection *UdpManager::ConnectCodeGetConnection(int connectCode) const { UdpConnection *found = static_cast(mConnectCodeHashTable->FindFirst(connectCode)); - while (found != NULL) + while (found != nullptr) { if (found->mConnectCode == connectCode) return(found); found = static_cast(mConnectCodeHashTable->FindNext(found)); } - return(NULL); + return(nullptr); } WrappedLogicalPacket *UdpManager::WrappedBorrow(const LogicalPacket *lp) @@ -1132,7 +1132,7 @@ WrappedLogicalPacket *UdpManager::WrappedBorrow(const LogicalPacket *lp) void UdpManager::WrappedCreated(WrappedLogicalPacket *wp) { wp->mCreatedNext = mWrappedCreatedRoot; - if (mWrappedCreatedRoot != NULL) + if (mWrappedCreatedRoot != nullptr) mWrappedCreatedRoot->mCreatedPrev = wp; mWrappedCreatedRoot = wp; mWrappedCreated++; @@ -1140,11 +1140,11 @@ void UdpManager::WrappedCreated(WrappedLogicalPacket *wp) void UdpManager::WrappedDestroyed(WrappedLogicalPacket *wp) { - if (wp->mCreatedNext != NULL) + if (wp->mCreatedNext != nullptr) { wp->mCreatedNext->mCreatedPrev = wp->mCreatedPrev; } - if (wp->mCreatedPrev != NULL) + if (wp->mCreatedPrev != nullptr) { wp->mCreatedPrev->mCreatedNext = wp->mCreatedNext; } @@ -1154,9 +1154,9 @@ void UdpManager::WrappedDestroyed(WrappedLogicalPacket *wp) mWrappedCreatedRoot = wp->mCreatedNext; } - wp->mCreatedPrev = NULL; - wp->mCreatedNext = NULL; - wp->mUdpManager = NULL; + wp->mCreatedPrev = nullptr; + wp->mCreatedNext = nullptr; + wp->mUdpManager = nullptr; mWrappedCreated--; } @@ -1191,7 +1191,7 @@ LogicalPacket *UdpManager::CreatePacket(const void *data, int dataLen, const voi void UdpManager::PoolCreated(PooledLogicalPacket *packet) { packet->mCreatedNext = mPoolCreatedRoot; - if (mPoolCreatedRoot != NULL) + if (mPoolCreatedRoot != nullptr) mPoolCreatedRoot->mCreatedPrev = packet; mPoolCreatedRoot = packet; mPoolCreated++; @@ -1199,11 +1199,11 @@ void UdpManager::PoolCreated(PooledLogicalPacket *packet) void UdpManager::PoolDestroyed(PooledLogicalPacket *packet) { - if (packet->mCreatedNext != NULL) + if (packet->mCreatedNext != nullptr) { packet->mCreatedNext->mCreatedPrev = packet->mCreatedPrev; } - if (packet->mCreatedPrev != NULL) + if (packet->mCreatedPrev != nullptr) { packet->mCreatedPrev->mCreatedNext = packet->mCreatedNext; } @@ -1213,9 +1213,9 @@ void UdpManager::PoolDestroyed(PooledLogicalPacket *packet) mPoolCreatedRoot = packet->mCreatedNext; } - packet->mCreatedPrev = NULL; - packet->mCreatedNext = NULL; - packet->mUdpManager = NULL; + packet->mCreatedPrev = nullptr; + packet->mCreatedNext = nullptr; + packet->mUdpManager = nullptr; mPoolCreated--; } @@ -1290,7 +1290,7 @@ void UdpConnection::Init(UdpManager *udpManager, UdpIpAddress destIp, int destPo mLastClockSyncTime = 0; mDataHoldTime = 0; mGettingTime = false; - mHandler = NULL; + mHandler = nullptr; mOtherSideProtocolVersion = 0; mNoDataTimeout = mUdpManager->mParams.noDataTimeout; @@ -1299,13 +1299,13 @@ void UdpConnection::Init(UdpManager *udpManager, UdpIpAddress destIp, int destPo mMultiBufferData = new uchar[mUdpManager->mParams.maxRawPacketSize]; mMultiBufferPtr = mMultiBufferData; - mDisconnectPendingNextConnection = NULL; - mNextConnection = NULL; - mPrevConnection = NULL; + mDisconnectPendingNextConnection = nullptr; + mNextConnection = nullptr; + mPrevConnection = nullptr; mIcmpErrorRetryStartStamp = 0; // when the timer started for ICMP error retry delay (gets reset on a successful packet receive) mPortRemapRequestStartStamp = 0; - mEncryptXorBuffer = NULL; + mEncryptXorBuffer = nullptr; mEncryptExpansionBytes = 0; mOrderedCountOutgoing = 0; mOrderedCountOutgoing2 = 0; @@ -1316,7 +1316,7 @@ void UdpConnection::Init(UdpManager *udpManager, UdpIpAddress destIp, int destPo mConnectionCreateTime = UdpMisc::Clock(); mSimulateQueueBytes = 0; - mPassThroughData = NULL; + mPassThroughData = nullptr; mSilentDisconnect = false; mLastSendBin = 0; @@ -1334,7 +1334,7 @@ void UdpConnection::Init(UdpManager *udpManager, UdpIpAddress destIp, int destPo UdpConnection::~UdpConnection() { - if (mUdpManager != NULL) + if (mUdpManager != nullptr) InternalDisconnect(0, cDisconnectReasonApplicationReleased); for (int i = 0; i < UdpManager::cReliableChannelCount; i++) @@ -1385,7 +1385,7 @@ void UdpConnection::InternalDisconnect(int flushTimeout, DisconnectReason reason if (mStatus == cStatusNegotiating) flushTimeout = 0; - if (mUdpManager != NULL) + if (mUdpManager != nullptr) { if (flushTimeout > 0) { @@ -1415,13 +1415,13 @@ void UdpConnection::InternalDisconnect(int flushTimeout, DisconnectReason reason } mUdpManager->RemoveConnection(this); - mUdpManager = NULL; + mUdpManager = nullptr; } mStatus = cStatusDisconnected; - if (startStatus != cStatusDisconnected && startUdpManager != NULL) + if (startStatus != cStatusDisconnected && startUdpManager != nullptr) { - if (mHandler != NULL) + if (mHandler != nullptr) mHandler->OnTerminated(this); } } @@ -1455,7 +1455,7 @@ bool UdpConnection::Send(UdpChannel channel, const void *data, int dataLen) if (dataLen == 0) // zero length packets are ignored return(false); - assert(data != NULL); // can't send a null packet + assert(data != nullptr); // can't send a nullptr packet mUdpManager->mManagerStats.applicationPacketsSent++; mConnectionStats.applicationPacketsSent++; @@ -1472,7 +1472,7 @@ bool UdpConnection::Send(UdpChannel channel, const void *data, int dataLen) bool UdpConnection::Send(UdpChannel channel, const LogicalPacket *packet) { - assert(packet != NULL); // can't send a null packet + assert(packet != nullptr); // can't send a nullptr packet assert(channel >= 0 && channel < cUdpChannelCount); assert(mStatus != cStatusNegotiating); // you are not allowed to start sending data on a connection that is still in the process of negotiating (only applicable client-side obviously since servers never have connections in this state) @@ -1518,7 +1518,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const uchar *data, int data { uchar *bufPtr = tempBuffer; memcpy(bufPtr, data, dataLen); - if (data2 != NULL) + if (data2 != nullptr) memcpy(bufPtr + dataLen, data2, dataLen2); PhysicalSend(bufPtr, totalDataLen, true); return(true); @@ -1531,9 +1531,9 @@ bool UdpConnection::InternalSend(UdpChannel channel, const uchar *data, int data bufPtr[1] = cUdpPacketOrdered2; UdpMisc::PutValue16(bufPtr + 2, (ushort)(++mOrderedCountOutgoing2 & 0xffff)); memcpy(bufPtr + 4, data, dataLen); - if (data2 != NULL) + if (data2 != nullptr) memcpy(bufPtr + 4 + dataLen, data2, dataLen2); - BufferedSend(bufPtr, totalDataLen + 4, NULL, 0, true); + BufferedSend(bufPtr, totalDataLen + 4, nullptr, 0, true); return(true); break; } @@ -1544,7 +1544,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const uchar *data, int data bufPtr[1] = cUdpPacketOrdered2; UdpMisc::PutValue16(bufPtr + 2, (ushort)(++mOrderedCountOutgoing2 & 0xffff)); memcpy(bufPtr + 4, data, dataLen); - if (data2 != NULL) + if (data2 != nullptr) memcpy(bufPtr + 4 + dataLen, data2, dataLen2); PhysicalSend(bufPtr, totalDataLen + 4, true); return(true); @@ -1556,7 +1556,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const uchar *data, int data case cUdpChannelReliable4: { int num = channel - cUdpChannelReliable1; - if (mChannel[num] == NULL) + if (mChannel[num] == nullptr) mChannel[num] = new UdpReliableChannel(num, this, &mUdpManager->mParams.reliable[num]); mChannel[num]->Send(data, dataLen, data2, dataLen2); return(true); @@ -1578,7 +1578,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const LogicalPacket *packet case cUdpChannelReliable4: { int num = channel - cUdpChannelReliable1; - if (mChannel[num] == NULL) + if (mChannel[num] == nullptr) mChannel[num] = new UdpReliableChannel(num, this, &mUdpManager->mParams.reliable[num]); mChannel[num]->Send(packet); return(true); @@ -1618,9 +1618,9 @@ void UdpConnection::PingStatReset() void UdpConnection::GetStats(UdpConnectionStatistics *cs) const { - assert(cs != NULL); + assert(cs != nullptr); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; *cs = mConnectionStats; @@ -1636,13 +1636,13 @@ void UdpConnection::GetStats(UdpConnectionStatistics *cs) const if (cs->syncTheirSent > 0) cs->percentReceivedSuccess = (float)cs->syncOurReceived / (float)cs->syncTheirSent; cs->reliableAveragePing = 0; - if (mChannel[0] != NULL) + if (mChannel[0] != nullptr) cs->reliableAveragePing = mChannel[0]->GetAveragePing(); } void UdpConnection::ProcessRawPacket(const UdpManager::PacketHistoryEntry *e) { - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; if (e->mBuffer[0] != 0 || e->mBuffer[1] != cUdpPacketUnreachableConnection) @@ -1744,7 +1744,7 @@ void UdpConnection::ProcessRawPacket(const UdpManager::PacketHistoryEntry *e) { mConnectionStats.crcRejectedPackets++; mUdpManager->mManagerStats.crcRejectedPackets++; - if (mHandler != NULL) + if (mHandler != nullptr) mHandler->OnCrcReject(this, e->mBuffer, e->mLen); return; } @@ -1771,7 +1771,7 @@ void UdpConnection::ProcessRawPacket(const UdpManager::PacketHistoryEntry *e) *decryptPtr++ = finalStart[1]; int len = (this->*(mDecryptFunction[j]))(decryptPtr, finalStart + 2, finalLen - 2); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; if (len == -1) @@ -1808,7 +1808,7 @@ void UdpConnection::CallbackRoutePacket(const uchar *data, int dataLen) mUdpManager->mManagerStats.applicationPacketsReceived++; mConnectionStats.applicationPacketsReceived++; - if (mHandler != NULL) + if (mHandler != nullptr) mHandler->OnRoutePacket(this, data, dataLen); } } @@ -1819,7 +1819,7 @@ void UdpConnection::CallbackCorruptPacket(const uchar *data, int dataLen, UdpCor { mConnectionStats.corruptPacketErrors++; mUdpManager->mManagerStats.corruptPacketErrors++; - if (mHandler != NULL) + if (mHandler != nullptr) mHandler->OnPacketCorrupt(this, data, dataLen, reason); } } @@ -1828,7 +1828,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) { uchar buf[256]; uchar *bufPtr; - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; if (data[0] == 0 && dataLen > 1) @@ -1912,7 +1912,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) mOtherSideProtocolVersion = otherSideProtocolVersion; SetupEncryptModel(); mStatus = cStatusConnected; - if (mHandler != NULL) + if (mHandler != nullptr) mHandler->OnConnectComplete(this); } break; @@ -2028,7 +2028,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) // (while processing this packet) ended up touching the packet-data and corrupting the next // packet in the multi-sequence. CallbackCorruptPacket(data, dataLen, cUdpCorruptionMultiPacket); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; } else @@ -2144,7 +2144,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) case cUdpPacketFragment4: { int num = (data[1] - cUdpPacketReliable1) % UdpManager::cReliableChannelCount; - if (mChannel[num] == NULL) + if (mChannel[num] == nullptr) mChannel[num] = new UdpReliableChannel(num, this, &mUdpManager->mParams.reliable[num]); mChannel[num]->ReliablePacket(data, dataLen); break; @@ -2155,7 +2155,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) case cUdpPacketAck4: { int num = data[1] - cUdpPacketAck1; - if (mChannel[num] != NULL) + if (mChannel[num] != nullptr) mChannel[num]->AckPacket(data, dataLen); break; } @@ -2165,7 +2165,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) case cUdpPacketAckAll4: { int num = data[1] - cUdpPacketAckAll1; - if (mChannel[num] != NULL) + if (mChannel[num] != nullptr) mChannel[num]->AckAllPacket(data, dataLen); break; } @@ -2205,7 +2205,7 @@ void UdpConnection::FlagPortUnreachable() void UdpConnection::GiveTime() { - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; UdpManager *myManager = mUdpManager; @@ -2298,11 +2298,11 @@ void UdpConnection::InternalGiveTime() int totalPendingBytes = 0; for (int i = 0; i < UdpManager::cReliableChannelCount; i++) { - if (mChannel[i] != NULL) + if (mChannel[i] != nullptr) { totalPendingBytes += mChannel[i]->TotalPendingBytes(); int myNext = mChannel[i]->GiveTime(); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; // giving the reliable channel time caused it to callback the application which may disconnect us nextSchedule = udpMin(nextSchedule, myNext); } @@ -2391,7 +2391,7 @@ void UdpConnection::InternalGiveTime() break; } - if (mUdpManager != NULL) + if (mUdpManager != nullptr) { // safety to prevent us for scheduling ourselves for a time period that has already passed, // as doing so could result in infinite looping in the priority queue processing. @@ -2408,7 +2408,7 @@ int UdpConnection::TotalPendingBytes() const int total = 0; for (int i = 0; i < UdpManager::cReliableChannelCount; i++) { - if (mChannel[i] != NULL) + if (mChannel[i] != nullptr) total += mChannel[i]->TotalPendingBytes(); } return(total); @@ -2474,7 +2474,7 @@ int UdpConnection::ExpireReceiveBin() void UdpConnection::PhysicalSend(const uchar *data, int dataLen, bool appendAllowed) { - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; // if we attempt to do a physical send (ie. encrypt/compress/crc a packet) while we are not connected @@ -2503,7 +2503,7 @@ void UdpConnection::PhysicalSend(const uchar *data, int dataLen, bool appendAllo // we know this internal packet will not be a connect or confirm packet since they are sent directly to RawSend to avoid getting encrypted *destPtr++ = finalStart[1]; int len = (this->*(mEncryptFunction[j]))(destPtr, finalStart + 2, finalLen - 2); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; // if this assert triggers, it means the encryption pass expanded the size of the encrypted @@ -2574,8 +2574,8 @@ void UdpConnection::PhysicalSend(const uchar *data, int dataLen, bool appendAllo // function can do its job uchar *UdpConnection::BufferedSend(const uchar *data, int dataLen, const uchar *data2, int dataLen2, bool appendAllowed) { - if (mUdpManager == NULL) - return(NULL); + if (mUdpManager == nullptr) + return(nullptr); int used = mMultiBufferPtr - mMultiBufferData; int actualMaxDataHoldSize = udpMin(mUdpManager->mParams.maxDataHoldSize, mConnectionConfig.maxRawPacketSize); @@ -2590,7 +2590,7 @@ uchar *UdpConnection::BufferedSend(const uchar *data, int dataLen, const uchar * FlushMultiBuffer(); // now send it (the multi-buffer is empty if you need to use it temporarily to concatenate two data chunks -- it is large enough to hold the largest raw packet) - if (data2 != NULL) + if (data2 != nullptr) { memcpy(mMultiBufferData, data, dataLen); memcpy(mMultiBufferData + dataLen, data2, dataLen2); @@ -2598,7 +2598,7 @@ uchar *UdpConnection::BufferedSend(const uchar *data, int dataLen, const uchar * } else PhysicalSend(data, dataLen, appendAllowed); - return(NULL); + return(nullptr); } // if this data will not fit into buffer @@ -2626,7 +2626,7 @@ uchar *UdpConnection::BufferedSend(const uchar *data, int dataLen, const uchar * uchar *placementPtr = mMultiBufferPtr; memcpy(mMultiBufferPtr, data, dataLen); mMultiBufferPtr += dataLen; - if (data2 != NULL) + if (data2 != nullptr) { memcpy(mMultiBufferPtr, data2, dataLen2); mMultiBufferPtr += dataLen2; @@ -2635,21 +2635,21 @@ uchar *UdpConnection::BufferedSend(const uchar *data, int dataLen, const uchar * if ((mMultiBufferPtr - mMultiBufferData) >= actualMaxDataHoldSize) { FlushMultiBuffer(); - placementPtr = NULL; // it got flushed + placementPtr = nullptr; // it got flushed } return(placementPtr); } uchar *UdpConnection::InternalAckSend(uchar *bufferedAckPtr, const uchar *ackPtr, int ackLen) { - if (bufferedAckPtr != NULL) + if (bufferedAckPtr != nullptr) { memcpy(bufferedAckPtr, ackPtr, ackLen); return(bufferedAckPtr); } - BufferedSend(ackPtr, ackLen, NULL, 0, false); - return(NULL); // FIX THIS + BufferedSend(ackPtr, ackLen, nullptr, 0, false); + return(nullptr); // FIX THIS } void UdpConnection::FlushMultiBuffer() @@ -2665,7 +2665,7 @@ void UdpConnection::FlushMultiBuffer() // notify all the reliable channels to clear their buffered acks for (int i = 0; i < UdpManager::cReliableChannelCount; i++) { - if (mChannel[i] != NULL) + if (mChannel[i] != nullptr) { mChannel[i]->ClearBufferedAck(); } @@ -2689,7 +2689,7 @@ int UdpConnection::DecryptNone(uchar *destData, const uchar *sourceData, int sou int UdpConnection::EncryptUserSupplied(uchar *destData, const uchar *sourceData, int sourceLen) { UdpManagerHandler *manHandler = mUdpManager->GetHandler(); - if (manHandler != NULL) + if (manHandler != nullptr) return(manHandler->OnUserSuppliedEncrypt(this, destData, sourceData, sourceLen)); assert(0); // if user-supplied encryption is specified, then you must have a manager handler installed to provide the routines return(0); @@ -2698,7 +2698,7 @@ int UdpConnection::EncryptUserSupplied(uchar *destData, const uchar *sourceData, int UdpConnection::DecryptUserSupplied(uchar *destData, const uchar *sourceData, int sourceLen) { UdpManagerHandler *manHandler = mUdpManager->GetHandler(); - if (manHandler != NULL) + if (manHandler != nullptr) return(manHandler->OnUserSuppliedDecrypt(this, destData, sourceData, sourceLen)); assert(0); // if user-supplied encryption is specified, then you must have a manager handler installed to provide the routines return(0); @@ -2707,7 +2707,7 @@ int UdpConnection::DecryptUserSupplied(uchar *destData, const uchar *sourceData, int UdpConnection::EncryptUserSupplied2(uchar *destData, const uchar *sourceData, int sourceLen) { UdpManagerHandler *manHandler = mUdpManager->GetHandler(); - if (manHandler != NULL) + if (manHandler != nullptr) return(manHandler->OnUserSuppliedEncrypt2(this, destData, sourceData, sourceLen)); assert(0); // if user-supplied encryption is specified, then you must have a manager handler installed to provide the routines return(0); @@ -2716,7 +2716,7 @@ int UdpConnection::EncryptUserSupplied2(uchar *destData, const uchar *sourceData int UdpConnection::DecryptUserSupplied2(uchar *destData, const uchar *sourceData, int sourceLen) { UdpManagerHandler *manHandler = mUdpManager->GetHandler(); - if (manHandler != NULL) + if (manHandler != nullptr) return(manHandler->OnUserSuppliedDecrypt2(this, destData, sourceData, sourceLen)); assert(0); // if user-supplied encryption is specified, then you must have a manager handler installed to provide the routines return(0); @@ -2866,7 +2866,7 @@ void UdpConnection::SetupEncryptModel() mEncryptExpansionBytes += 0; // set up encrypt buffer (random numbers generated based on seed) - if (mEncryptXorBuffer == NULL) + if (mEncryptXorBuffer == nullptr) { int len = ((mUdpManager->mParams.maxRawPacketSize + 1) / 4) * 4; mEncryptXorBuffer = new uchar[len]; @@ -2898,7 +2898,7 @@ void UdpConnection::GetChannelStatus(UdpChannel channel, ChannelStatus *channelS case cUdpChannelReliable2: case cUdpChannelReliable3: case cUdpChannelReliable4: - if (mChannel[channel - cUdpChannelReliable1] != NULL) + if (mChannel[channel - cUdpChannelReliable1] != nullptr) { mChannel[channel - cUdpChannelReliable1]->GetChannelStatus(channelStatus); } @@ -2975,12 +2975,12 @@ UdpReliableChannel::UdpReliableChannel(int channelNumber, UdpConnection *con, Ud mLogicalPacketsQueued = 0; mLogicalBytesQueued = 0; - mCoalescePacket = NULL; - mCoalesceStartPtr = NULL; - mCoalesceEndPtr = NULL; + mCoalescePacket = nullptr; + mCoalesceStartPtr = nullptr; + mCoalesceEndPtr = nullptr; mCoalesceCount = 0; - mBufferedAckPtr = NULL; + mBufferedAckPtr = nullptr; mStatDuplicatePacketsReceived = 0; mStatResentPacketsAccelerated = 0; @@ -2994,7 +2994,7 @@ UdpReliableChannel::UdpReliableChannel(int channelNumber, UdpConnection *con, Ud mBigDataLen = 0; mBigDataTargetLen = 0; - mBigDataPtr = NULL; + mBigDataPtr = nullptr; mFragmentNextPos = 0; mLastTimeStampAcknowledged = 0; mMaxxedOutCurrentWindow = false; @@ -3003,23 +3003,23 @@ UdpReliableChannel::UdpReliableChannel(int channelNumber, UdpConnection *con, Ud mPhysicalPackets = new PhysicalPacket[mConfig.maxOutstandingPackets]; mReliableIncoming = new IncomingQueueEntry[mConfig.maxInstandingPackets]; - mLogicalRoot = NULL; - mLogicalEnd = NULL; + mLogicalRoot = nullptr; + mLogicalEnd = nullptr; } UdpReliableChannel::~UdpReliableChannel() { - if (mCoalescePacket != NULL) + if (mCoalescePacket != nullptr) { mCoalescePacket->Release(); - mCoalescePacket = NULL; + mCoalescePacket = nullptr; } const LogicalPacket *cur = mLogicalRoot; - while (cur != NULL) + while (cur != nullptr) { const LogicalPacket *next = cur->mReliableQueueNext; - cur->mReliableQueueNext = NULL; // make sure and mark it available so others could possibly use it (if it is a shared logical packet) + cur->mReliableQueueNext = nullptr; // make sure and mark it available so others could possibly use it (if it is a shared logical packet) cur->Release(); if (cur == next) // pointing to self, so this is end of list break; @@ -3035,7 +3035,7 @@ UdpReliableChannel::~UdpReliableChannel() void UdpReliableChannel::Send(const uchar *data, int dataLen, const uchar *data2, int dataLen2) { - if (mLogicalPacketsQueued == 0 && mCoalescePacket == NULL) + if (mLogicalPacketsQueued == 0 && mCoalescePacket == nullptr) { // if we are adding something to a previously empty logical queue, then it is possible that // we may be able to send it, so mark ourselves to take time the next time it is offered @@ -3086,7 +3086,7 @@ void UdpReliableChannel::Send(const LogicalPacket *packet) void UdpReliableChannel::FlushCoalesce() { - if (mCoalescePacket != NULL) + if (mCoalescePacket != nullptr) { if (mCoalesceCount == 1) { @@ -3103,16 +3103,16 @@ void UdpReliableChannel::FlushCoalesce() } mCoalescePacket->Release(); - mCoalescePacket = NULL; + mCoalescePacket = nullptr; } } void UdpReliableChannel::SendCoalesce(const uchar *data, int dataLen, const uchar *data2, int dataLen2) { int totalLen = dataLen + dataLen2; - if (mCoalescePacket == NULL) + if (mCoalescePacket == nullptr) { - mCoalescePacket = mUdpConnection->mUdpManager->CreatePacket(NULL, mMaxDataBytes); + mCoalescePacket = mUdpConnection->mUdpManager->CreatePacket(nullptr, mMaxDataBytes); mCoalesceEndPtr = mCoalesceStartPtr = (uchar *)mCoalescePacket->GetDataPtr(); *mCoalesceEndPtr++ = 0; *mCoalesceEndPtr++ = UdpConnection::cUdpPacketGroup; @@ -3132,10 +3132,10 @@ void UdpReliableChannel::SendCoalesce(const uchar *data, int dataLen, const ucha // append on end of coalesce mCoalesceCount++; mCoalesceEndPtr += UdpMisc::PutVariableValue(mCoalesceEndPtr, totalLen); - if (data != NULL) + if (data != nullptr) memcpy(mCoalesceEndPtr, data, dataLen); mCoalesceEndPtr += dataLen; - if (data2 != NULL) + if (data2 != nullptr) memcpy(mCoalesceEndPtr, data2, dataLen2); mCoalesceEndPtr += dataLen2; } @@ -3145,7 +3145,7 @@ void UdpReliableChannel::QueueLogicalPacket(const LogicalPacket *packet) mLogicalPacketsQueued++; mLogicalBytesQueued += packet->GetDataLen(); - if (packet->mReliableQueueNext != NULL) + if (packet->mReliableQueueNext != nullptr) { packet = mUdpConnection->mUdpManager->WrappedBorrow(packet); } @@ -3155,13 +3155,13 @@ void UdpReliableChannel::QueueLogicalPacket(const LogicalPacket *packet) } packet->mReliableQueueNext = packet; // have it point to itself to signify that the mNext pointer is taken (ie. reserve it), yet still represents the end of the list - if (mLogicalEnd != NULL) + if (mLogicalEnd != nullptr) { mLogicalEnd->mReliableQueueNext = packet; } mLogicalEnd = packet; - if (mLogicalRoot == NULL) + if (mLogicalRoot == nullptr) { mLogicalRoot = packet; } @@ -3182,10 +3182,10 @@ bool UdpReliableChannel::PullDown(int windowSpaceLeft) int physicalCount = (int)(mReliableOutgoingId - mReliableOutgoingPendingId); while (windowSpaceLeft > 0 && physicalCount < mConfig.maxOutstandingPackets) { - if (mLogicalRoot == NULL) + if (mLogicalRoot == nullptr) { FlushCoalesce(); // this is guaranteed to stick - if (mLogicalRoot == NULL) + if (mLogicalRoot == nullptr) break; // nothing flushed, so we are done } @@ -3225,10 +3225,10 @@ bool UdpReliableChannel::PullDown(int windowSpaceLeft) mLogicalRoot = mLogicalRoot->mReliableQueueNext; if (mLogicalRoot == lp) // ie, we were pointing to ourself, meaning we were the end of the list { - mLogicalRoot = NULL; - mLogicalEnd = NULL; + mLogicalRoot = nullptr; + mLogicalEnd = nullptr; } - lp->mReliableQueueNext = NULL; // clear our next link since we are no longer using it (so somebody else can use it potentially) + lp->mReliableQueueNext = nullptr; // clear our next link since we are no longer using it (so somebody else can use it potentially) lp->Release(); // release from logical queue } else @@ -3279,7 +3279,7 @@ int UdpReliableChannel::GiveTime() mMaxxedOutCurrentWindow = false; int outstandingNextSendTime = 10 * 60000; // if we have something to do - if (mReliableOutgoingPendingId < mReliableOutgoingId || mLogicalRoot != NULL || mCoalescePacket != NULL) + if (mReliableOutgoingPendingId < mReliableOutgoingId || mLogicalRoot != nullptr || mCoalescePacket != nullptr) { // first, let's calculate how many bytes we figure is outstanding based on who is still waiting for an ack-packet UdpMisc::ClockStamp oldestResendTime = udpMax(hotClock - optimalResendDelay, mLastTimeStampAcknowledged); // anything older than this, we need to resend @@ -3304,7 +3304,7 @@ int UdpReliableChannel::GiveTime() // if this packet has not been acked and it is NOT ready to be sent (was recently sent) then we consider it outstanding // note: packets needing re-sending probably got lost and are therefore not outstanding PhysicalPacket *entry = &mPhysicalPackets[i % mConfig.maxOutstandingPackets]; - if (entry->mDataPtr != NULL) // acked packets set the dataPtr to NULL + if (entry->mDataPtr != nullptr) // acked packets set the dataPtr to nullptr { // if this packet is ready to be sent (ie: needs time now, or some later packet has already been ack'ed) windowSpaceLeft -= entry->mDataLen; // window-space is effectively taken whether we have sent it yet or not @@ -3464,7 +3464,7 @@ int UdpReliableChannel::GiveTime() void UdpReliableChannel::GetChannelStatus(UdpConnection::ChannelStatus *channelStatus) const { int coalesceBytes = 0; - if (mCoalescePacket != NULL) + if (mCoalescePacket != nullptr) coalesceBytes = mCoalesceEndPtr - mCoalesceStartPtr; channelStatus->totalPendingBytes = mLogicalBytesQueued + mReliableOutgoingBytes + coalesceBytes; @@ -3525,7 +3525,7 @@ void UdpReliableChannel::ReliablePacket(const uchar *data, int dataLen) mReliableIncomingId++; // process other packets that have arrived - while (mReliableIncoming[mReliableIncomingId % mConfig.maxInstandingPackets].mPacket != NULL) + while (mReliableIncoming[mReliableIncomingId % mConfig.maxInstandingPackets].mPacket != nullptr) { int spot = (int)(mReliableIncomingId % mConfig.maxInstandingPackets); if (mReliableIncoming[spot].mMode != cReliablePacketModeDelivered) @@ -3534,7 +3534,7 @@ void UdpReliableChannel::ReliablePacket(const uchar *data, int dataLen) } mReliableIncoming[spot].mPacket->Release(); - mReliableIncoming[spot].mPacket = NULL; + mReliableIncoming[spot].mPacket = nullptr; mReliableIncomingId++; } } @@ -3542,7 +3542,7 @@ void UdpReliableChannel::ReliablePacket(const uchar *data, int dataLen) { // not the one we need next, but it is later than the one we need , so store it in our buffer until it's turn comes up int spot = (int)(reliableId % mConfig.maxInstandingPackets); - if (mReliableIncoming[spot].mPacket == NULL) // only make the copy of it if we don't already have it in our buffer (in cases where it was sent twice, there would be no harm in the copy again since it must be the same packet, it's just inefficient) + if (mReliableIncoming[spot].mPacket == nullptr) // only make the copy of it if we don't already have it in our buffer (in cases where it was sent twice, there would be no harm in the copy again since it must be the same packet, it's just inefficient) { mReliableIncoming[spot].mMode = mode; mReliableIncoming[spot].mPacket = mUdpConnection->mUdpManager->CreatePacket(data + UdpConnection::cUdpPacketReliableSize, dataLen - UdpConnection::cUdpPacketReliableSize); @@ -3584,16 +3584,16 @@ void UdpReliableChannel::ReliablePacket(const uchar *data, int dataLen) // a simple ack for us only *bufPtr++ = (uchar)(UdpConnection::cUdpPacketAck1 + mChannelNumber); bufPtr += UdpMisc::PutValue16(bufPtr, (ushort)(reliableId & 0xffff)); - mBufferedAckPtr = NULL; // not allowed to replace an old one with a selective-ack + mBufferedAckPtr = nullptr; // not allowed to replace an old one with a selective-ack } - if (mBufferedAckPtr != NULL && mConfig.ackDeduping) + if (mBufferedAckPtr != nullptr && mConfig.ackDeduping) { memcpy(mBufferedAckPtr, buf, bufPtr - buf); } else { - mBufferedAckPtr = mUdpConnection->BufferedSend(buf, bufPtr - buf, NULL, 0, true); // safe to append on our data, it is stack data + mBufferedAckPtr = mUdpConnection->BufferedSend(buf, bufPtr - buf, nullptr, 0, true); // safe to append on our data, it is stack data } } @@ -3610,7 +3610,7 @@ void UdpReliableChannel::ProcessPacket(ReliablePacketMode mode, const uchar *dat else if (mode == cReliablePacketModeFragment) { // append onto end of big packet (or create new big packet if not existing already) - if (mBigDataPtr == NULL) + if (mBigDataPtr == nullptr) { mBigDataTargetLen = UdpMisc::GetValue32(data); // first fragment has a total-length int header on it. mBigDataPtr = new uchar[mBigDataTargetLen]; @@ -3633,7 +3633,7 @@ void UdpReliableChannel::ProcessPacket(ReliablePacketMode mode, const uchar *dat delete[] mBigDataPtr; mBigDataLen = 0; mBigDataTargetLen = 0; - mBigDataPtr = NULL; + mBigDataPtr = nullptr; } } } @@ -3663,7 +3663,7 @@ void UdpReliableChannel::Ack(udp_int64 reliableId) int pos = (int)(reliableId % mConfig.maxOutstandingPackets); PhysicalPacket *entry = &mPhysicalPackets[pos]; - if (entry->mDataPtr != NULL) // if this packet has not been acknowledged yet (sometimes we get back two acks for the same packet) + if (entry->mDataPtr != nullptr) // if this packet has not been acknowledged yet (sometimes we get back two acks for the same packet) { mNextNeedTime = 0; // something got acked, so we actually need to take the time next time it is offered @@ -3721,14 +3721,14 @@ void UdpReliableChannel::Ack(udp_int64 reliableId) // this packet we have queued has been acknowledged, so delete it from queue mReliableOutgoingBytes -= entry->mDataLen; entry->mDataLen = 0; - entry->mDataPtr = NULL; + entry->mDataPtr = nullptr; entry->mParent->Release(); - entry->mParent = NULL; + entry->mParent = nullptr; // advance the pending ptr until it reaches outgoingId or an entry that has yet to acknowledged while (mReliableOutgoingPendingId < mReliableOutgoingId) { - if (mPhysicalPackets[mReliableOutgoingPendingId % mConfig.maxOutstandingPackets].mDataPtr != NULL) + if (mPhysicalPackets[mReliableOutgoingPendingId % mConfig.maxOutstandingPackets].mDataPtr != nullptr) break; mReliableOutgoingPendingId++; } @@ -3750,25 +3750,25 @@ void UdpReliableChannel::Ack(udp_int64 reliableId) UdpReliableChannel::IncomingQueueEntry::IncomingQueueEntry() { - mPacket = NULL; + mPacket = nullptr; mMode = UdpReliableChannel::cReliablePacketModeReliable; } UdpReliableChannel::IncomingQueueEntry::~IncomingQueueEntry() { - if (mPacket != NULL) + if (mPacket != nullptr) mPacket->Release(); } UdpReliableChannel::PhysicalPacket::PhysicalPacket() { - mParent = NULL; + mParent = nullptr; } UdpReliableChannel::PhysicalPacket::~PhysicalPacket() { - if (mParent != NULL) + if (mParent != nullptr) mParent->Release(); } @@ -3780,7 +3780,7 @@ UdpReliableChannel::PhysicalPacket::~PhysicalPacket() LogicalPacket::LogicalPacket() { mRefCount = 1; - mReliableQueueNext = NULL; + mReliableQueueNext = nullptr; } LogicalPacket::~LogicalPacket() @@ -3815,7 +3815,7 @@ SimpleLogicalPacket::SimpleLogicalPacket(const void *data, int dataLen) { mDataLen = dataLen; mData = new uchar[mDataLen]; - if (data != NULL) + if (data != nullptr) memcpy(mData, data, mDataLen); } @@ -3850,7 +3850,7 @@ void SimpleLogicalPacket::SetDataLen(int len) GroupLogicalPacket::GroupLogicalPacket() : LogicalPacket() { mDataLen = 0; - mData = NULL; + mData = nullptr; } GroupLogicalPacket::~GroupLogicalPacket() @@ -3860,13 +3860,13 @@ GroupLogicalPacket::~GroupLogicalPacket() void GroupLogicalPacket::AddPacket(const LogicalPacket *packet) { - assert(packet != NULL); + assert(packet != nullptr); AddPacketInternal(packet->GetDataPtr(), packet->GetDataLen(), packet->IsInternalPacket()); } void GroupLogicalPacket::AddPacket(const void *data, int dataLen) { - assert(data != NULL); + assert(data != nullptr); assert(dataLen >= 0); AddPacketInternal(data, dataLen, false); } @@ -3932,16 +3932,16 @@ PooledLogicalPacket::PooledLogicalPacket(UdpManager *manager, int len) mDataLen = 0; mUdpManager = manager; - mAvailableNext = NULL; - mCreatedNext = NULL; - mCreatedPrev = NULL; + mAvailableNext = nullptr; + mCreatedNext = nullptr; + mCreatedPrev = nullptr; mUdpManager->PoolCreated(this); } PooledLogicalPacket::~PooledLogicalPacket() { - if (mUdpManager != NULL) + if (mUdpManager != nullptr) { mUdpManager->PoolDestroyed(this); } @@ -3956,7 +3956,7 @@ void PooledLogicalPacket::AddRef() const void PooledLogicalPacket::Release() const { - if (mRefCount == 1 && mUdpManager != NULL) + if (mRefCount == 1 && mUdpManager != nullptr) mUdpManager->PoolReturn(const_cast(this)); // if pool wants to keep us, it will inc our ref count, preventing our destruction // we cast off our const, as when we are added back to the pool, we can be modified LogicalPacket::Release(); @@ -3986,9 +3986,9 @@ void PooledLogicalPacket::SetDataLen(int len) void PooledLogicalPacket::SetData(const void *data, int dataLen, const void *data2, int dataLen2) { mDataLen = dataLen + dataLen2; - if (data != NULL) + if (data != nullptr) memcpy(mData, data, dataLen); - if (data2 != NULL) + if (data2 != nullptr) memcpy(mData + dataLen, data2, dataLen2); } @@ -3999,23 +3999,23 @@ void PooledLogicalPacket::SetData(const void *data, int dataLen, const void *dat /////////////////////////////////////////////////////////////////////////////////////////// WrappedLogicalPacket::WrappedLogicalPacket(UdpManager *udpManager) { - mPacket = NULL; + mPacket = nullptr; mUdpManager = udpManager; - mAvailableNext = NULL; - mCreatedNext = NULL; - mCreatedPrev = NULL; + mAvailableNext = nullptr; + mCreatedNext = nullptr; + mCreatedPrev = nullptr; mUdpManager->WrappedCreated(this); } WrappedLogicalPacket::~WrappedLogicalPacket() { - if (mUdpManager != NULL) + if (mUdpManager != nullptr) { mUdpManager->WrappedDestroyed(this); } - if (mPacket != NULL) + if (mPacket != nullptr) { mPacket->Release(); } @@ -4028,7 +4028,7 @@ void WrappedLogicalPacket::AddRef() const void WrappedLogicalPacket::Release() const { - if (mRefCount == 1 && mUdpManager != NULL) + if (mRefCount == 1 && mUdpManager != nullptr) mUdpManager->WrappedReturn(const_cast(this)); // if pool wants to keep us, it will inc our ref count, preventing our destruction // we cast off our const, as when we are added back to the pool, we can be modified LogicalPacket::Release(); @@ -4036,10 +4036,10 @@ void WrappedLogicalPacket::Release() const void WrappedLogicalPacket::SetLogicalPacket(const LogicalPacket *packet) { - if (mPacket != NULL) + if (mPacket != nullptr) mPacket->Release(); mPacket = packet; - if (mPacket != NULL) + if (mPacket != nullptr) mPacket->AddRef(); } @@ -4075,7 +4075,7 @@ UdpManager::SimulateQueueEntry::SimulateQueueEntry(const uchar *data, int dataLe memcpy(mData, data, dataLen); mIp = ip; mPort = port; - mNext = NULL; + mNext = nullptr; } UdpManager::SimulateQueueEntry::~SimulateQueueEntry() @@ -4110,7 +4110,7 @@ UdpMisc::ClockStamp UdpMisc::Clock() static ClockStamp sLastStamp = 0; static ClockStamp sCurrentCorrection = 0; struct timeval tv; - gettimeofday(&tv, NULL); + gettimeofday(&tv, nullptr); UdpMisc::ClockStamp cs = static_cast(tv.tv_sec) * 1000 + static_cast(tv.tv_usec / 1000); cs += sCurrentCorrection; if (cs < sLastStamp) @@ -4226,19 +4226,19 @@ void *UdpMisc::SmartResize(void *ptr, int bytes, int round) if (bytes == 0) { - if (ptr != NULL) + if (ptr != nullptr) { free((uchar *)ptr - cAlignment); } - return(NULL); + return(nullptr); } uchar *ptr2; - if (ptr == NULL) + if (ptr == nullptr) { ptr2 = (uchar *)malloc(bytes + cAlignment); - if (ptr2 == NULL) - return(NULL); + if (ptr2 == nullptr) + return(nullptr); *(int *)ptr2 = bytes; return(ptr2 + cAlignment); } @@ -4248,8 +4248,8 @@ void *UdpMisc::SmartResize(void *ptr, int bytes, int round) return(ptr); ptr2 = (uchar *)realloc((uchar *)ptr - cAlignment, bytes + cAlignment); - if (ptr2 == NULL) - return(NULL); + if (ptr2 == nullptr) + return(nullptr); *(int *)ptr2 = bytes; return(ptr2 + cAlignment); @@ -4312,30 +4312,30 @@ LogicalPacket *UdpMisc::CreateQuickLogicalPacket(const void *data, int dataLen, switch(q) { case 0: - tlp = new FixedLogicalPacket(NULL, totalDataLen); + tlp = new FixedLogicalPacket(nullptr, totalDataLen); break; case 1: - tlp = new FixedLogicalPacket(NULL, totalDataLen); + tlp = new FixedLogicalPacket(nullptr, totalDataLen); break; case 2: case 3: - tlp = new FixedLogicalPacket(NULL, totalDataLen); + tlp = new FixedLogicalPacket(nullptr, totalDataLen); break; case 4: case 5: case 6: case 7: - tlp = new FixedLogicalPacket(NULL, totalDataLen); + tlp = new FixedLogicalPacket(nullptr, totalDataLen); break; default: - tlp = new SimpleLogicalPacket(NULL, totalDataLen); + tlp = new SimpleLogicalPacket(nullptr, totalDataLen); break; } uchar *dest = (uchar *)tlp->GetDataPtr(); - if (data != NULL) + if (data != nullptr) memcpy(dest, data, dataLen); - if (data2 != NULL) + if (data2 != nullptr) memcpy(dest + dataLen, data2, dataLen2); return(tlp); } @@ -4349,7 +4349,7 @@ UdpIpAddress UdpMisc::GetHostByName(const char *hostName) { struct hostent * lphp; lphp = gethostbyname(hostName); - if (lphp == NULL) + if (lphp == nullptr) { address = 0; } diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpLibrary.hpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpLibrary.hpp index 27fc28d1..9db50e40 100644 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpLibrary.hpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpLibrary.hpp @@ -150,7 +150,7 @@ class UdpMisc // memory manager does a little bit of this, but if you know you have an allocation that is likely // to grow quite a bit, you can set the round'ing size up to a fairly large number and avoid // unnecessary reallocs at the cost of a little potentially wasted space - // initial allocations are done by passing in ptr==NULL, freeing is done by passing in bytes==0 + // initial allocations are done by passing in ptr==nullptr, freeing is done by passing in bytes==0 static void *SmartResize(void *ptr, int bytes, int round = 1); // the following two functions store values in the buffer as a variable length (B1, 0xffB2B1, 0xffffffB4B3B2B1) @@ -170,7 +170,7 @@ class UdpMisc static uint GetValue24(const void *buffer); // gets a 24-bit value from the buffer in big-endian format static ushort GetValue16(const void *buffer); // gets a 16-bit value from the buffer in big-endian format - static LogicalPacket *CreateQuickLogicalPacket(const void *data, int dataLen, const void *data2 = NULL, int dataLen2 = 0); + static LogicalPacket *CreateQuickLogicalPacket(const void *data, int dataLen, const void *data2 = nullptr, int dataLen2 = 0); // looks up the specified name and translates it to an IP address // this is a blocking call that can at times take a significant amount of time, but will generally be fast (less than 300ms) @@ -243,7 +243,7 @@ class LogicalPacket protected: friend class UdpReliableChannel; mutable const LogicalPacket *mReliableQueueNext; // owned/managed by the reliable channel object as an optimizations, do not touch - // NULL = unclaimed, point-to-self = claimed, but end of list + // nullptr = unclaimed, point-to-self = claimed, but end of list }; class SimpleLogicalPacket : public LogicalPacket @@ -252,7 +252,7 @@ class SimpleLogicalPacket : public LogicalPacket // it was originally created to allow the internal code to handle reliable data that was sent // via the Send(char *, int) api call. public: - SimpleLogicalPacket(const void *data, int dataLen); // data can be NULL if you want to populate it after it is allocated (get the pointer and write to it) + SimpleLogicalPacket(const void *data, int dataLen); // data can be nullptr if you want to populate it after it is allocated (get the pointer and write to it) virtual void *GetDataPtr(); virtual const void *GetDataPtr() const; virtual int GetDataLen() const; @@ -323,7 +323,7 @@ template class StructLogicalPacket : public LogicalPacket // with virtual functions) via this method as they may contain hidden data-members (such as pointers // to vtables). public: - StructLogicalPacket(T *initData = NULL); + StructLogicalPacket(T *initData = nullptr); virtual void *GetDataPtr(); virtual const void *GetDataPtr() const; virtual int GetDataLen() const; @@ -396,7 +396,7 @@ class PooledLogicalPacket : public LogicalPacket int mMaxDataLen; protected: friend class UdpManager; - void SetData(const void *data, int dataLen, const void *data2 = NULL, int dataLen2 = 0); + void SetData(const void *data, int dataLen, const void *data2 = nullptr, int dataLen2 = 0); UdpManager *mUdpManager; PooledLogicalPacket *mAvailableNext; PooledLogicalPacket *mCreatedNext; @@ -476,7 +476,7 @@ class UdpManager // pointer equal to your object and the UdpManager will call it as appropriate. The UdpConnection object // also has a handler mechanism that replaces the other callback functions below, see UdpConnection::SetHandler // if a handler is specified, the callback function is ignored, even if specified. - // default = NULL (not used) + // default = nullptr (not used) UdpManagerHandler *handler; // this is the maximum number of connections that can be established by this manager, any incoming/outgoing connections @@ -901,7 +901,7 @@ class UdpManager // will call EstablishConnection, then sit in a loop calling UdpManager::GiveTime and checking to see // if the status of the returned UdpConnection object is changed from cStatusNegotiating. This allows // the application to look for the ESC key or timeout an attempted connection. - // This function will return NULL if the manager object has exceeded its maximum number of connections + // This function will return nullptr if the manager object has exceeded its maximum number of connections // or if the serverAddress cannot be resolved to an IP address // as is noted in the declaration, it is the responsibility of the application establishing the connection to delete it // setting the timeout value (in milliseconds) to something greater than 0 will cause the UdpConnection object to change @@ -933,13 +933,13 @@ class UdpManager // manually forces all live connections to flush their multi buffers immediately void FlushAllMultiBuffer(); - // creates a logical packet and populates it with data. data can be NULL, in which case it gives you logical packet + // creates a logical packet and populates it with data. data can be nullptr, in which case it gives you logical packet // of the size specified, but copies no data into it. If you are using pool management (see Params::poolPacketMax), // it will give you a packet out of the pool if possible, otherwise it will create a packet for you. When logical // are packets are needed internally for various things (like reliable channel sends that use the (void *, int) interface) // they are gotten from this function, so your application can likely take advantage of pooling, even if it never bothers // to explicitly call this function. - LogicalPacket *CreatePacket(const void *data, int dataLen, const void *data2 = NULL, int dataLen2 = 0); + LogicalPacket *CreatePacket(const void *data, int dataLen, const void *data2 = nullptr, int dataLen2 = 0); protected: friend class PooledLogicalPacket; @@ -1165,7 +1165,7 @@ class UdpConnection : public PriorityQueueMember, public AddressHashTableMember, int ConnectionAge() const; // returns the UdpManager object that is managing this connection - // will return NULL if the connection has been disconnected for some reason (because disconnecting severes the link to UdpManager) + // will return nullptr if the connection has been disconnected for some reason (because disconnecting severes the link to UdpManager) UdpManager *GetUdpManager() const; // returns the 32-bit encryption-code that was negotiated as part of the connection-establishment process. @@ -1245,9 +1245,9 @@ class UdpConnection : public PriorityQueueMember, public AddressHashTableMember, friend class UdpManager; friend class UdpReliableChannel; - // note: if connectPacket is NULL, that means this connection object is being created to establish + // note: if connectPacket is nullptr, that means this connection object is being created to establish // a new connection to the specified ip/port (ie. the connection starts out in cStatusNegotiating mode) - // if connectPacket is non-NULL, that menas this connection object is being created to handle an + // if connectPacket is non-nullptr, that menas this connection object is being created to handle an // incoming connect request and it will start out in cStatusConnected mode. UdpConnection(UdpManager *udpManager, UdpIpAddress destIp, int destPort, int timeout); // starts connection-establishment protocol UdpConnection(UdpManager *udpManager, const UdpManager::PacketHistoryEntry *e); // starts already connected, replying to connection request @@ -1282,7 +1282,7 @@ class UdpConnection : public PriorityQueueMember, public AddressHashTableMember, void PhysicalSend(const uchar *data, int dataLen, bool appendAllowed); // sends a physical packet (encrypts and adds crc bytes) uchar *BufferedSend(const uchar *data, int dataLen, const uchar *data2, int dataLen2, bool appendAllowed); // buffers logical packets waiting til we have more data (makes multi-packets) bool InternalSend(UdpChannel channel, const LogicalPacket *packet); - bool InternalSend(UdpChannel channel, const uchar *data, int dataLen, const uchar *data2 = NULL, int dataLen2 = 0); + bool InternalSend(UdpChannel channel, const uchar *data, int dataLen, const uchar *data2 = nullptr, int dataLen2 = 0); uchar *InternalAckSend(uchar *bufferedAckPtr, const uchar *ackPtr, int ackLen); // used by reliable channel to send acks (special send that allows for deduping ack feature) @@ -1573,7 +1573,7 @@ class UdpReliableChannel void ProcessPacket(ReliablePacketMode mode, const uchar *data, int dataLen); bool PullDown(int windowSpaceLeft); void FlushCoalesce(); - void SendCoalesce(const uchar *data, int dataLen, const uchar *data2 = NULL, int dataLen2 = 0); + void SendCoalesce(const uchar *data, int dataLen, const uchar *data2 = nullptr, int dataLen2 = 0); void QueueLogicalPacket(const LogicalPacket *packet); UdpManager::ReliableConfig mConfig; @@ -1627,7 +1627,7 @@ class UdpReliableChannel template FixedLogicalPacket::FixedLogicalPacket(const void *data, int dataLen) { mDataLen = dataLen; - if (data != NULL) + if (data != nullptr) memcpy(mData, data, mDataLen); } @@ -1657,7 +1657,7 @@ template void FixedLogicalPacket::SetDataLen(int l ///////////////////////////////////////////////////////////////////////// template StructLogicalPacket::StructLogicalPacket(T *initData) { - if (initData != NULL) + if (initData != nullptr) mStruct = *initData; } @@ -1802,7 +1802,7 @@ inline void UdpManager::SetPriority(UdpConnection *con, UdpMisc::ClockStamp stam if (stamp < mMinimumScheduledStamp) stamp = mMinimumScheduledStamp; - if (mPriorityQueue != NULL) + if (mPriorityQueue != nullptr) mPriorityQueue->Add(con, stamp); } @@ -1829,7 +1829,7 @@ inline void UdpManager::PoolReturn(PooledLogicalPacket *packet) inline void UdpManager::WrappedReturn(WrappedLogicalPacket *wp) { - wp->SetLogicalPacket(NULL); + wp->SetLogicalPacket(nullptr); if (mWrappedAvailable < mParams.wrappedPoolMax) { @@ -1877,7 +1877,7 @@ inline void UdpConnection::ScheduleTimeNow() // prevents us from reprioritizing to 0, only to shortly thereafter be reprioritized to where we actually belong. if (!mGettingTime) { - if (mUdpManager != NULL) + if (mUdpManager != nullptr) mUdpManager->SetPriority(this, 0); } } @@ -2066,7 +2066,7 @@ inline int UdpReliableChannel::TotalPendingBytes() const inline void UdpReliableChannel::ClearBufferedAck() { - mBufferedAckPtr = NULL; + mBufferedAckPtr = nullptr; } inline udp_int64 UdpReliableChannel::GetReliableOutgoingId(int reliableStamp) const diff --git a/external/3rd/library/udplibrary/PointerDeque.hpp b/external/3rd/library/udplibrary/PointerDeque.hpp index 6124afd8..8cc2ccc2 100644 --- a/external/3rd/library/udplibrary/PointerDeque.hpp +++ b/external/3rd/library/udplibrary/PointerDeque.hpp @@ -2,7 +2,7 @@ #define POINTERDEQUE_HPP // This is a simple double ended queue template. Any pointer-type can be stored in this deque - // I pop/peek return NULL if the queue is empty. + // I pop/peek return nullptr if the queue is empty. template class PointerDeque { public: @@ -32,7 +32,7 @@ template class PointerDeque template PointerDeque::PointerDeque(int entriesPerPage) { mEntriesPerPage = entriesPerPage; - mEntries = NULL; + mEntries = nullptr; mOffsetLeft = 0; mEntriesMax = 0; mEntriesCount = 0; @@ -73,7 +73,7 @@ template void PointerDeque::PushLeft(T* obj) template T* PointerDeque::PopLeft() { if (mEntriesCount == 0) - return(NULL); + return(nullptr); T* hold = mEntries[mOffsetLeft]; mOffsetLeft = (mOffsetLeft + 1) % mEntriesMax; mEntriesCount--; @@ -91,7 +91,7 @@ template void PointerDeque::PushRight(T* obj) template T* PointerDeque::PopRight() { if (mEntriesCount == 0) - return(NULL); + return(nullptr); mEntriesCount--; return(mEntries[(mOffsetLeft + mEntriesCount) % mEntriesMax]); } @@ -99,21 +99,21 @@ template T* PointerDeque::PopRight() template T* PointerDeque::PeekLeft() { if (mEntriesCount == 0) - return(NULL); + return(nullptr); return(mEntries[mOffsetLeft]); } template T* PointerDeque::PeekRight() { if (mEntriesCount == 0) - return(NULL); + return(nullptr); return(mEntries[(mOffsetLeft + mEntriesCount - 1) % mEntriesMax]); } template T* PointerDeque::Peek(int index) { if (index >= mEntriesCount) - return(NULL); + return(nullptr); return(mEntries[(mOffsetLeft + index) % mEntriesMax]); } diff --git a/external/3rd/library/udplibrary/UdpLibrary.cpp b/external/3rd/library/udplibrary/UdpLibrary.cpp index a84e147d..c8436157 100755 --- a/external/3rd/library/udplibrary/UdpLibrary.cpp +++ b/external/3rd/library/udplibrary/UdpLibrary.cpp @@ -144,7 +144,7 @@ UdpIpAddress::UdpIpAddress(unsigned int ip) char *UdpIpAddress::GetAddress(char *buffer) const { - assert(buffer != NULL); + assert(buffer != nullptr); struct sockaddr_in addr_serverUDP; addr_serverUDP.sin_addr.s_addr = mIp; @@ -157,7 +157,7 @@ char *UdpIpAddress::GetAddress(char *buffer) const ///////////////////////////////////////////////////////////////////////////////////////////////////// UdpManager::Params::Params() { - handler = NULL; + handler = nullptr; outgoingBufferSize = 64 * 1024; incomingBufferSize = 64 * 1024; packetHistoryMax = 100; @@ -258,7 +258,7 @@ UdpManager::UdpManager(const UdpManager::Params *params) mParams.maxDataHoldSize = udpMin(mParams.maxDataHoldSize, mParams.maxRawPacketSize); mParams.packetHistoryMax = udpMax(1, mParams.packetHistoryMax); mPacketHistoryPosition = 0; - mPassThroughData = NULL; + mPassThroughData = nullptr; typedef PacketHistoryEntry *PacketHistoryEntryPtr; mPacketHistory = new PacketHistoryEntryPtr[mParams.packetHistoryMax]; @@ -279,17 +279,17 @@ UdpManager::UdpManager(const UdpManager::Params *params) mUdpSocket = INVALID_SOCKET; mConnectionListCount = 0; - mConnectionList = NULL; + mConnectionList = nullptr; mPoolCreated = 0; mPoolAvailable = 0; - mPoolAvailableRoot = NULL; - mPoolCreatedRoot = NULL; + mPoolAvailableRoot = nullptr; + mPoolCreatedRoot = nullptr; mWrappedCreated = 0; mWrappedAvailable = 0; - mWrappedAvailableRoot = NULL; - mWrappedCreatedRoot = NULL; + mWrappedAvailableRoot = nullptr; + mWrappedCreatedRoot = nullptr; for (i = 0; i < mParams.pooledPacketInitial && i < mParams.pooledPacketMax; i++) { @@ -299,16 +299,16 @@ UdpManager::UdpManager(const UdpManager::Params *params) lp->Release(); } - mSimulateQueueStart = NULL; - mSimulateQueueEnd = NULL; + mSimulateQueueStart = nullptr; + mSimulateQueueEnd = nullptr; mSimulateNextOutgoingTime = 0; mSimulateNextIncomingTime = 0; mSimulateQueueBytes = 0; - mDisconnectPendingList = NULL; + mDisconnectPendingList = nullptr; if (mParams.avoidPriorityQueue) - mPriorityQueue = NULL; + mPriorityQueue = nullptr; else mPriorityQueue = new PriorityQueue(mParams.maxConnections); @@ -339,14 +339,14 @@ UdpManager::~UdpManager() // first we need to tell all the pooled packets we have created that they can no longer check themselves back into use // when they are released PooledLogicalPacket *walk = mPoolCreatedRoot; - while (walk != NULL) + while (walk != nullptr) { - walk->mUdpManager = NULL; + walk->mUdpManager = nullptr; walk = walk->mCreatedNext; } // next release the ones we have in our available pool walk = mPoolAvailableRoot; - while (walk != NULL) + while (walk != nullptr) { PooledLogicalPacket *hold = walk; walk = walk->mAvailableNext; @@ -359,14 +359,14 @@ UdpManager::~UdpManager() // next we need to tell all the warpped packets we have created that they can no longer check themselves back into use // when they are released WrappedLogicalPacket *walk = mWrappedCreatedRoot; - while (walk != NULL) + while (walk != nullptr) { - walk->mUdpManager = NULL; + walk->mUdpManager = nullptr; walk = walk->mCreatedNext; } // next release the ones we have in our available pool walk = mWrappedAvailableRoot; - while (walk != NULL) + while (walk != nullptr) { WrappedLogicalPacket *hold = walk; walk = walk->mAvailableNext; @@ -376,7 +376,7 @@ UdpManager::~UdpManager() // next thing we must do is tell all the connections to disconnect (which severs their link to this dying manager) // this has to be done first since they will call back into us and have themselves removed from our connection-list/priority-queue/etc - while (mConnectionList != NULL) + while (mConnectionList != nullptr) { mConnectionList->InternalDisconnect(0, UdpConnection::cDisconnectReasonManagerDeleted); // the above call ended up calling us back and removing them from our connection list, so now mConnectionList is pointing to the next entry @@ -384,7 +384,7 @@ UdpManager::~UdpManager() } // release any objects that were pending disconnection - while (mDisconnectPendingList != NULL) + while (mDisconnectPendingList != nullptr) { UdpConnection *next = mDisconnectPendingList->mDisconnectPendingNextConnection; mDisconnectPendingList->Release(); @@ -404,7 +404,7 @@ UdpManager::~UdpManager() } delete[] mPacketHistory; - while (mSimulateQueueStart != NULL) + while (mSimulateQueueStart != nullptr) { SimulateQueueEntry *entry = mSimulateQueueStart; mSimulateQueueStart = entry->mNext; @@ -517,12 +517,12 @@ void UdpManager::ProcessDisconnectPending() { UdpConnection *entry = mDisconnectPendingList; UdpConnection **prev = &mDisconnectPendingList; - while (entry != NULL) + while (entry != nullptr) { if (entry->GetStatus() == UdpConnection::cStatusDisconnected) { *prev = entry->mDisconnectPendingNextConnection; - entry->mDisconnectPendingNextConnection = NULL; + entry->mDisconnectPendingNextConnection = nullptr; entry->Release(); entry = *prev; } @@ -536,19 +536,19 @@ void UdpManager::ProcessDisconnectPending() void UdpManager::RemoveConnection(UdpConnection *con) { - assert(con != NULL); // attemped to remove a NULL connection object + assert(con != nullptr); // attemped to remove a nullptr connection object // note: it's a bug to Remove a connection object that is already removed...should never be able to happen. mConnectionListCount--; - if (con->mPrevConnection != NULL) + if (con->mPrevConnection != nullptr) con->mPrevConnection->mNextConnection = con->mNextConnection; - if (con->mNextConnection != NULL) + if (con->mNextConnection != nullptr) con->mNextConnection->mPrevConnection = con->mPrevConnection; if (mConnectionList == con) mConnectionList = con->mNextConnection; - con->mNextConnection = NULL; - con->mPrevConnection = NULL; - if (mPriorityQueue != NULL) + con->mNextConnection = nullptr; + con->mPrevConnection = nullptr; + if (mPriorityQueue != nullptr) mPriorityQueue->Remove(con); mAddressHashTable->Remove(con, AddressHashValue(con->mIp, con->mPort)); @@ -557,11 +557,11 @@ void UdpManager::RemoveConnection(UdpConnection *con) void UdpManager::AddConnection(UdpConnection *con) { - assert(con != NULL); // attemped to add a NULL connection object + assert(con != nullptr); // attemped to add a nullptr connection object con->mNextConnection = mConnectionList; - con->mPrevConnection = NULL; - if (mConnectionList != NULL) + con->mPrevConnection = nullptr; + if (mConnectionList != nullptr) mConnectionList->mPrevConnection = con; mConnectionList = con; mConnectionListCount++; @@ -574,7 +574,7 @@ void UdpManager::FlushAllMultiBuffer() { AddRef(); UdpConnection *cur = mConnectionList; - while (cur != NULL) + while (cur != nullptr) { cur->FlushMultiBuffer(); cur = cur->mNextConnection; @@ -597,7 +597,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) { PacketHistoryEntry *e = ActualReceive(); - if (e == NULL) + if (e == nullptr) { mLastEmptySocketBufferStamp = UdpMisc::Clock(); break; @@ -625,7 +625,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) if (giveConnectionsTime) { - if (mPriorityQueue != NULL) + if (mPriorityQueue != nullptr) { // give time to everybody in the priority-queue that needs it UdpMisc::ClockStamp curPriority = UdpMisc::Clock(); @@ -643,7 +643,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) for (;;) { UdpConnection *top = mPriorityQueue->TopRemove(curPriority); - if (top == NULL) + if (top == nullptr) break; top->AddRef(); top->GiveTime(); @@ -656,7 +656,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) { // give time to everybody UdpConnection *cur = mConnectionList; - while (cur != NULL) + while (cur != nullptr) { cur->GiveTime(); cur = cur->mNextConnection; @@ -666,7 +666,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) ProcessDisconnectPending(); } - if (mSimulateQueueStart != NULL && UdpMisc::Clock() >= mSimulateNextOutgoingTime) + if (mSimulateQueueStart != nullptr && UdpMisc::Clock() >= mSimulateNextOutgoingTime) { SimulateQueueEntry *entry = mSimulateQueueStart; mSimulateQueueStart = mSimulateQueueStart->mNext; @@ -674,7 +674,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) ActualSendHelper(entry->mData, entry->mDataLen, entry->mIp, entry->mPort); UdpConnection *con = AddressGetConnection(entry->mIp, entry->mPort); - if (con != NULL) + if (con != nullptr) con->mSimulateQueueBytes -= entry->mDataLen; mSimulateQueueBytes -= entry->mDataLen; delete entry; @@ -687,11 +687,11 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) UdpConnection *UdpManager::EstablishConnection(const char *serverAddress, int serverPort, int timeout) { assert(serverPort != 0); // can't connect to no port - assert(serverAddress != NULL); + assert(serverAddress != nullptr); assert(serverAddress[0] != 0); if (mConnectionListCount >= mParams.maxConnections) - return(NULL); + return(nullptr); // get server address unsigned long address = inet_addr(serverAddress); @@ -699,16 +699,16 @@ UdpConnection *UdpManager::EstablishConnection(const char *serverAddress, int se { struct hostent * lphp; lphp = gethostbyname(serverAddress); - if (lphp == NULL) - return(NULL); + if (lphp == nullptr) + return(nullptr); address = ((struct in_addr *)(lphp->h_addr))->s_addr; } UdpIpAddress destIp(address); // first, see if we already have a connection object managing this ip/port, if we do, then fail UdpConnection *con = AddressGetConnection(destIp, serverPort); - if (con != NULL) - return(NULL); + if (con != nullptr) + return(nullptr); return(new UdpConnection(this, destIp, serverPort, timeout)); } @@ -721,7 +721,7 @@ void UdpManager::KeepUntilDisconnected(UdpConnection *con) void UdpManager::GetStats(UdpManagerStatistics *stats) const { - assert(stats != NULL); + assert(stats != nullptr); *stats = mManagerStats; stats->poolAvailable = mPoolAvailable; stats->poolCreated = mPoolCreated; @@ -736,10 +736,10 @@ void UdpManager::ResetStats() void UdpManager::DumpPacketHistory(const char *filename) const { - assert(filename != NULL); + assert(filename != nullptr); assert(filename[0] != 0); FILE *file = fopen(filename, "wt"); - if (file != NULL) + if (file != nullptr) { // dump history of packets... for (int i = 0; i < mParams.packetHistoryMax; i++) @@ -785,7 +785,7 @@ int UdpManager::GetLocalPort() const UdpManager::PacketHistoryEntry *UdpManager::ActualReceive() { if (mParams.simulateIncomingByteRate > 0 && UdpMisc::Clock() < mSimulateNextIncomingTime) - return(NULL); + return(nullptr); struct sockaddr_in addr_from; socklen_t sf = sizeof(addr_from); @@ -795,7 +795,7 @@ UdpManager::PacketHistoryEntry *UdpManager::ActualReceive() if (res != SOCKET_ERROR) { if (mParams.simulateIncomingLossPercent > 0 && ((rand() % 100) < mParams.simulateIncomingLossPercent)) - return(NULL); // packet, what packet? + return(nullptr); // packet, what packet? if (mParams.simulateIncomingByteRate > 0) mSimulateNextIncomingTime = UdpMisc::Clock() + (res * 1000 / mParams.simulateIncomingByteRate); @@ -820,7 +820,7 @@ UdpManager::PacketHistoryEntry *UdpManager::ActualReceive() UdpIpAddress ip = UdpIpAddress(addr_from.sin_addr.s_addr); int port = (int)ntohs(addr_from.sin_port); UdpConnection *con = AddressGetConnection(ip, port); - if (con != NULL) + if (con != nullptr) { con->AddRef(); con->PortUnreachable(); @@ -840,7 +840,7 @@ UdpManager::PacketHistoryEntry *UdpManager::ActualReceive() } #endif } - return(NULL); + return(nullptr); } void UdpManager::ProcessIcmpErrors() @@ -868,7 +868,7 @@ void UdpManager::ProcessIcmpErrors() struct cmsghdr * cmsg; if(CMSG_FIRSTHDR(&msgh)) { - for(cmsg = CMSG_FIRSTHDR(&msgh); cmsg != NULL; cmsg = CMSG_NXTHDR(&msgh, cmsg)) + for(cmsg = CMSG_FIRSTHDR(&msgh); cmsg != nullptr; cmsg = CMSG_NXTHDR(&msgh, cmsg)) { if(cmsg->cmsg_level == SOL_IP && cmsg->cmsg_type == IP_RECVERR) { @@ -882,7 +882,7 @@ void UdpManager::ProcessIcmpErrors() UdpIpAddress ip = UdpIpAddress(msg_name.sin_addr.s_addr); int port = (int)htons(msg_name.sin_port); UdpConnection *con = AddressGetConnection(ip, port); - if (con != NULL) + if (con != nullptr) { con->AddRef(); con->PortUnreachable(); @@ -911,7 +911,7 @@ void UdpManager::ActualSend(const uchar *data, int dataLen, UdpIpAddress ip, int { // simulating outgoing byte-rate, so queue it up for sending later UdpConnection *con = AddressGetConnection(ip, port); - if (con != NULL) + if (con != nullptr) { if (mParams.simulateDestinationOverloadLevel > 0 && con->mSimulateQueueBytes + dataLen > mParams.simulateDestinationOverloadLevel) return; // no room, packet gets lost @@ -919,17 +919,17 @@ void UdpManager::ActualSend(const uchar *data, int dataLen, UdpIpAddress ip, int if (mParams.simulateOutgoingOverloadLevel > 0 && mSimulateQueueBytes + dataLen > mParams.simulateOutgoingOverloadLevel) return; // no room, packet gets lost - if (con != NULL) + if (con != nullptr) con->mSimulateQueueBytes += dataLen; mSimulateQueueBytes += dataLen; SimulateQueueEntry *entry = new SimulateQueueEntry(data, dataLen, ip, port); - if (mSimulateQueueStart != NULL) + if (mSimulateQueueStart != nullptr) mSimulateQueueEnd->mNext = entry; else mSimulateQueueStart = entry; mSimulateQueueEnd = entry; - mSimulateQueueEnd->mNext = NULL; + mSimulateQueueEnd->mNext = nullptr; return; } ActualSendHelper(data, dataLen, ip, port); @@ -952,7 +952,7 @@ void UdpManager::ActualSendHelper(const uchar *data, int dataLen, UdpIpAddress i // flag connection to terminate itself for port-unreachable error on next give time // we need to flag it instead of actually terminating it to prevent callbacks from occuring during application sends UdpConnection *con = AddressGetConnection(ip, port); - if (con != NULL) + if (con != nullptr) con->FlagPortUnreachable(); return; } @@ -990,7 +990,7 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) UdpConnection *con = AddressGetConnection(e->mIp, e->mPort); - if (con == NULL) + if (con == nullptr) { // packet coming from an unknown ip/port // if it is a connection request packet, then establish a new connection object to reply to it @@ -1003,7 +1003,7 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) int protocolVersion = UdpMisc::GetValue32(e->mBuffer + 2); if (protocolVersion == cProtocolVersion) { - if (mParams.handler != NULL) + if (mParams.handler != nullptr) { UdpConnection *newcon = new UdpConnection(this, e); mParams.handler->OnConnectRequest(newcon); @@ -1032,7 +1032,7 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) int encryptCode = UdpMisc::GetValue32(ptr); UdpConnection *con = ConnectCodeGetConnection(connectCode); - if (con != NULL) + if (con != nullptr) { if (mParams.allowAddressRemapping || con->mIp == e->mIp) { @@ -1082,25 +1082,25 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) UdpConnection *UdpManager::AddressGetConnection(UdpIpAddress ip, int port) const { UdpConnection *found = static_cast(mAddressHashTable->FindFirst(AddressHashValue(ip, port))); - while (found != NULL) + while (found != nullptr) { if (found->mIp == ip && found->mPort == port) return(found); found = static_cast(mAddressHashTable->FindNext(found)); } - return(NULL); + return(nullptr); } UdpConnection *UdpManager::ConnectCodeGetConnection(int connectCode) const { UdpConnection *found = static_cast(mConnectCodeHashTable->FindFirst(connectCode)); - while (found != NULL) + while (found != nullptr) { if (found->mConnectCode == connectCode) return(found); found = static_cast(mConnectCodeHashTable->FindNext(found)); } - return(NULL); + return(nullptr); } WrappedLogicalPacket *UdpManager::WrappedBorrow(const LogicalPacket *lp) @@ -1124,7 +1124,7 @@ WrappedLogicalPacket *UdpManager::WrappedBorrow(const LogicalPacket *lp) void UdpManager::WrappedCreated(WrappedLogicalPacket *wp) { wp->mCreatedNext = mWrappedCreatedRoot; - if (mWrappedCreatedRoot != NULL) + if (mWrappedCreatedRoot != nullptr) mWrappedCreatedRoot->mCreatedPrev = wp; mWrappedCreatedRoot = wp; mWrappedCreated++; @@ -1132,11 +1132,11 @@ void UdpManager::WrappedCreated(WrappedLogicalPacket *wp) void UdpManager::WrappedDestroyed(WrappedLogicalPacket *wp) { - if (wp->mCreatedNext != NULL) + if (wp->mCreatedNext != nullptr) { wp->mCreatedNext->mCreatedPrev = wp->mCreatedPrev; } - if (wp->mCreatedPrev != NULL) + if (wp->mCreatedPrev != nullptr) { wp->mCreatedPrev->mCreatedNext = wp->mCreatedNext; } @@ -1146,9 +1146,9 @@ void UdpManager::WrappedDestroyed(WrappedLogicalPacket *wp) mWrappedCreatedRoot = wp->mCreatedNext; } - wp->mCreatedPrev = NULL; - wp->mCreatedNext = NULL; - wp->mUdpManager = NULL; + wp->mCreatedPrev = nullptr; + wp->mCreatedNext = nullptr; + wp->mUdpManager = nullptr; mWrappedCreated--; } @@ -1183,7 +1183,7 @@ LogicalPacket *UdpManager::CreatePacket(const void *data, int dataLen, const voi void UdpManager::PoolCreated(PooledLogicalPacket *packet) { packet->mCreatedNext = mPoolCreatedRoot; - if (mPoolCreatedRoot != NULL) + if (mPoolCreatedRoot != nullptr) mPoolCreatedRoot->mCreatedPrev = packet; mPoolCreatedRoot = packet; mPoolCreated++; @@ -1191,11 +1191,11 @@ void UdpManager::PoolCreated(PooledLogicalPacket *packet) void UdpManager::PoolDestroyed(PooledLogicalPacket *packet) { - if (packet->mCreatedNext != NULL) + if (packet->mCreatedNext != nullptr) { packet->mCreatedNext->mCreatedPrev = packet->mCreatedPrev; } - if (packet->mCreatedPrev != NULL) + if (packet->mCreatedPrev != nullptr) { packet->mCreatedPrev->mCreatedNext = packet->mCreatedNext; } @@ -1205,9 +1205,9 @@ void UdpManager::PoolDestroyed(PooledLogicalPacket *packet) mPoolCreatedRoot = packet->mCreatedNext; } - packet->mCreatedPrev = NULL; - packet->mCreatedNext = NULL; - packet->mUdpManager = NULL; + packet->mCreatedPrev = nullptr; + packet->mCreatedNext = nullptr; + packet->mUdpManager = nullptr; mPoolCreated--; } @@ -1282,7 +1282,7 @@ void UdpConnection::Init(UdpManager *udpManager, UdpIpAddress destIp, int destPo mLastClockSyncTime = 0; mDataHoldTime = 0; mGettingTime = false; - mHandler = NULL; + mHandler = nullptr; mNoDataTimeout = mUdpManager->mParams.noDataTimeout; mKeepAliveDelay = mUdpManager->mParams.keepAliveDelay; @@ -1290,13 +1290,13 @@ void UdpConnection::Init(UdpManager *udpManager, UdpIpAddress destIp, int destPo mMultiBufferData = new uchar[mUdpManager->mParams.maxRawPacketSize]; mMultiBufferPtr = mMultiBufferData; - mDisconnectPendingNextConnection = NULL; - mNextConnection = NULL; - mPrevConnection = NULL; + mDisconnectPendingNextConnection = nullptr; + mNextConnection = nullptr; + mPrevConnection = nullptr; mIcmpErrorRetryStartStamp = 0; // when the timer started for ICMP error retry delay (gets reset on a successful packet receive) mPortRemapRequestStartStamp = 0; - mEncryptXorBuffer = NULL; + mEncryptXorBuffer = nullptr; mEncryptExpansionBytes = 0; mOrderedCountOutgoing = 0; mOrderedCountOutgoing2 = 0; @@ -1307,7 +1307,7 @@ void UdpConnection::Init(UdpManager *udpManager, UdpIpAddress destIp, int destPo mConnectionCreateTime = UdpMisc::Clock(); mSimulateQueueBytes = 0; - mPassThroughData = NULL; + mPassThroughData = nullptr; mSilentDisconnect = false; mLastSendBin = 0; @@ -1325,7 +1325,7 @@ void UdpConnection::Init(UdpManager *udpManager, UdpIpAddress destIp, int destPo UdpConnection::~UdpConnection() { - if (mUdpManager != NULL) + if (mUdpManager != nullptr) InternalDisconnect(0, mDisconnectReason); for (int i = 0; i < UdpManager::cReliableChannelCount; i++) @@ -1372,7 +1372,7 @@ void UdpConnection::InternalDisconnect(int flushTimeout, DisconnectReason reason if (mStatus == cStatusNegotiating) flushTimeout = 0; - if (mUdpManager != NULL) + if (mUdpManager != nullptr) { if (flushTimeout > 0) { @@ -1402,13 +1402,13 @@ void UdpConnection::InternalDisconnect(int flushTimeout, DisconnectReason reason } mUdpManager->RemoveConnection(this); - mUdpManager = NULL; + mUdpManager = nullptr; } mStatus = cStatusDisconnected; - if (startStatus != cStatusDisconnected && startUdpManager != NULL) + if (startStatus != cStatusDisconnected && startUdpManager != nullptr) { - if (mHandler != NULL) + if (mHandler != nullptr) mHandler->OnTerminated(this); } } @@ -1442,7 +1442,7 @@ bool UdpConnection::Send(UdpChannel channel, const void *data, int dataLen) if (dataLen == 0) // zero length packets are ignored return(false); - assert(data != NULL); // can't send a null packet + assert(data != nullptr); // can't send a nullptr packet mUdpManager->mManagerStats.applicationPacketsSent++; mConnectionStats.applicationPacketsSent++; @@ -1459,7 +1459,7 @@ bool UdpConnection::Send(UdpChannel channel, const void *data, int dataLen) bool UdpConnection::Send(UdpChannel channel, const LogicalPacket *packet) { - assert(packet != NULL); // can't send a null packet + assert(packet != nullptr); // can't send a nullptr packet assert(channel >= 0 && channel < cUdpChannelCount); assert(mStatus != cStatusNegotiating); // you are not allowed to start sending data on a connection that is still in the process of negotiating (only applicable client-side obviously since servers never have connections in this state) @@ -1505,7 +1505,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const uchar *data, int data { uchar *bufPtr = tempBuffer; memcpy(bufPtr, data, dataLen); - if (data2 != NULL) + if (data2 != nullptr) memcpy(bufPtr + dataLen, data2, dataLen2); PhysicalSend(bufPtr, totalDataLen, true); return(true); @@ -1518,9 +1518,9 @@ bool UdpConnection::InternalSend(UdpChannel channel, const uchar *data, int data bufPtr[1] = cUdpPacketOrdered2; UdpMisc::PutValue16(bufPtr + 2, (ushort)(++mOrderedCountOutgoing2 & 0xffff)); memcpy(bufPtr + 4, data, dataLen); - if (data2 != NULL) + if (data2 != nullptr) memcpy(bufPtr + 4 + dataLen, data2, dataLen2); - BufferedSend(bufPtr, totalDataLen + 4, NULL, 0, true); + BufferedSend(bufPtr, totalDataLen + 4, nullptr, 0, true); return(true); break; } @@ -1531,7 +1531,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const uchar *data, int data bufPtr[1] = cUdpPacketOrdered2; UdpMisc::PutValue16(bufPtr + 2, (ushort)(++mOrderedCountOutgoing2 & 0xffff)); memcpy(bufPtr + 4, data, dataLen); - if (data2 != NULL) + if (data2 != nullptr) memcpy(bufPtr + 4 + dataLen, data2, dataLen2); PhysicalSend(bufPtr, totalDataLen + 4, true); return(true); @@ -1543,7 +1543,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const uchar *data, int data case cUdpChannelReliable4: { int num = channel - cUdpChannelReliable1; - if (mChannel[num] == NULL) + if (mChannel[num] == nullptr) mChannel[num] = new UdpReliableChannel(num, this, &mUdpManager->mParams.reliable[num]); mChannel[num]->Send(data, dataLen, data2, dataLen2); return(true); @@ -1565,7 +1565,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const LogicalPacket *packet case cUdpChannelReliable4: { int num = channel - cUdpChannelReliable1; - if (mChannel[num] == NULL) + if (mChannel[num] == nullptr) mChannel[num] = new UdpReliableChannel(num, this, &mUdpManager->mParams.reliable[num]); mChannel[num]->Send(packet); return(true); @@ -1605,9 +1605,9 @@ void UdpConnection::PingStatReset() void UdpConnection::GetStats(UdpConnectionStatistics *cs) const { - assert(cs != NULL); + assert(cs != nullptr); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; *cs = mConnectionStats; @@ -1623,13 +1623,13 @@ void UdpConnection::GetStats(UdpConnectionStatistics *cs) const if (cs->syncTheirSent > 0) cs->percentReceivedSuccess = (float)cs->syncOurReceived / (float)cs->syncTheirSent; cs->reliableAveragePing = 0; - if (mChannel[0] != NULL) + if (mChannel[0] != nullptr) cs->reliableAveragePing = mChannel[0]->GetAveragePing(); } void UdpConnection::ProcessRawPacket(const UdpManager::PacketHistoryEntry *e) { - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; if (e->mBuffer[0] != 0 || e->mBuffer[1] != cUdpPacketUnreachableConnection) @@ -1731,7 +1731,7 @@ void UdpConnection::ProcessRawPacket(const UdpManager::PacketHistoryEntry *e) { mConnectionStats.crcRejectedPackets++; mUdpManager->mManagerStats.crcRejectedPackets++; - if (mHandler != NULL) + if (mHandler != nullptr) mHandler->OnCrcReject(this, e->mBuffer, e->mLen); return; } @@ -1792,7 +1792,7 @@ void UdpConnection::CallbackRoutePacket(const uchar *data, int dataLen) mUdpManager->mManagerStats.applicationPacketsReceived++; mConnectionStats.applicationPacketsReceived++; - if (mHandler != NULL) + if (mHandler != nullptr) mHandler->OnRoutePacket(this, data, dataLen); } } @@ -1801,7 +1801,7 @@ void UdpConnection::CallbackCorruptPacket(const uchar *data, int dataLen, UdpCor { mConnectionStats.corruptPacketErrors++; mUdpManager->mManagerStats.corruptPacketErrors++; - if (mHandler != NULL) + if (mHandler != nullptr) mHandler->OnPacketCorrupt(this, data, dataLen, reason); } @@ -1809,7 +1809,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) { uchar buf[256]; uchar *bufPtr; - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; if (data[0] == 0 && dataLen > 1) @@ -1882,7 +1882,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) mConnectionConfig = config; SetupEncryptModel(); mStatus = cStatusConnected; - if (mHandler != NULL) + if (mHandler != nullptr) mHandler->OnConnectComplete(this); } break; @@ -2112,7 +2112,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) case cUdpPacketFragment4: { int num = (data[1] - cUdpPacketReliable1) % UdpManager::cReliableChannelCount; - if (mChannel[num] == NULL) + if (mChannel[num] == nullptr) mChannel[num] = new UdpReliableChannel(num, this, &mUdpManager->mParams.reliable[num]); mChannel[num]->ReliablePacket(data, dataLen); break; @@ -2123,7 +2123,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) case cUdpPacketAck4: { int num = data[1] - cUdpPacketAck1; - if (mChannel[num] != NULL) + if (mChannel[num] != nullptr) mChannel[num]->AckPacket(data, dataLen); break; } @@ -2133,7 +2133,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) case cUdpPacketAckAll4: { int num = data[1] - cUdpPacketAckAll1; - if (mChannel[num] != NULL) + if (mChannel[num] != nullptr) mChannel[num]->AckAllPacket(data, dataLen); break; } @@ -2173,7 +2173,7 @@ void UdpConnection::FlagPortUnreachable() void UdpConnection::GiveTime() { - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; UdpManager *myManager = mUdpManager; @@ -2266,11 +2266,11 @@ void UdpConnection::InternalGiveTime() int totalPendingBytes = 0; for (int i = 0; i < UdpManager::cReliableChannelCount; i++) { - if (mChannel[i] != NULL) + if (mChannel[i] != nullptr) { totalPendingBytes += mChannel[i]->TotalPendingBytes(); int myNext = mChannel[i]->GiveTime(); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; // giving the reliable channel time caused it to callback the application which may disconnect us nextSchedule = udpMin(nextSchedule, myNext); } @@ -2359,7 +2359,7 @@ void UdpConnection::InternalGiveTime() break; } - if (mUdpManager != NULL) + if (mUdpManager != nullptr) { // safety to prevent us for scheduling ourselves for a time period that has already passed, // as doing so could result in infinite looping in the priority queue processing. @@ -2376,7 +2376,7 @@ int UdpConnection::TotalPendingBytes() const int total = 0; for (int i = 0; i < UdpManager::cReliableChannelCount; i++) { - if (mChannel[i] != NULL) + if (mChannel[i] != nullptr) total += mChannel[i]->TotalPendingBytes(); } return(total); @@ -2442,7 +2442,7 @@ int UdpConnection::ExpireReceiveBin() void UdpConnection::PhysicalSend(const uchar *data, int dataLen, bool appendAllowed) { - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; // if we attempt to do a physical send (ie. encrypt/compress/crc a packet) while we are not connected @@ -2540,8 +2540,8 @@ void UdpConnection::PhysicalSend(const uchar *data, int dataLen, bool appendAllo // function can do its job uchar *UdpConnection::BufferedSend(const uchar *data, int dataLen, const uchar *data2, int dataLen2, bool appendAllowed) { - if (mUdpManager == NULL) - return(NULL); + if (mUdpManager == nullptr) + return(nullptr); int used = mMultiBufferPtr - mMultiBufferData; int actualMaxDataHoldSize = udpMin(mUdpManager->mParams.maxDataHoldSize, mConnectionConfig.maxRawPacketSize); @@ -2556,7 +2556,7 @@ uchar *UdpConnection::BufferedSend(const uchar *data, int dataLen, const uchar * FlushMultiBuffer(); // now send it (the multi-buffer is empty if you need to use it temporarily to concatenate two data chunks -- it is large enough to hold the largest raw packet) - if (data2 != NULL) + if (data2 != nullptr) { memcpy(mMultiBufferData, data, dataLen); memcpy(mMultiBufferData + dataLen, data2, dataLen2); @@ -2564,7 +2564,7 @@ uchar *UdpConnection::BufferedSend(const uchar *data, int dataLen, const uchar * } else PhysicalSend(data, dataLen, appendAllowed); - return(NULL); + return(nullptr); } // if this data will not fit into buffer @@ -2592,7 +2592,7 @@ uchar *UdpConnection::BufferedSend(const uchar *data, int dataLen, const uchar * uchar *placementPtr = mMultiBufferPtr; memcpy(mMultiBufferPtr, data, dataLen); mMultiBufferPtr += dataLen; - if (data2 != NULL) + if (data2 != nullptr) { memcpy(mMultiBufferPtr, data2, dataLen2); mMultiBufferPtr += dataLen2; @@ -2601,21 +2601,21 @@ uchar *UdpConnection::BufferedSend(const uchar *data, int dataLen, const uchar * if ((mMultiBufferPtr - mMultiBufferData) >= actualMaxDataHoldSize) { FlushMultiBuffer(); - placementPtr = NULL; // it got flushed + placementPtr = nullptr; // it got flushed } return(placementPtr); } uchar *UdpConnection::InternalAckSend(uchar *bufferedAckPtr, const uchar *ackPtr, int ackLen) { - if (bufferedAckPtr != NULL) + if (bufferedAckPtr != nullptr) { memcpy(bufferedAckPtr, ackPtr, ackLen); return(bufferedAckPtr); } - BufferedSend(ackPtr, ackLen, NULL, 0, false); - return(NULL); // FIX THIS + BufferedSend(ackPtr, ackLen, nullptr, 0, false); + return(nullptr); // FIX THIS } void UdpConnection::FlushMultiBuffer() @@ -2631,7 +2631,7 @@ void UdpConnection::FlushMultiBuffer() // notify all the reliable channels to clear their buffered acks for (int i = 0; i < UdpManager::cReliableChannelCount; i++) { - if (mChannel[i] != NULL) + if (mChannel[i] != nullptr) { mChannel[i]->ClearBufferedAck(); } @@ -2656,7 +2656,7 @@ int UdpConnection::DecryptNone(uchar *destData, const uchar *sourceData, int sou int UdpConnection::EncryptUserSupplied(uchar *destData, const uchar *sourceData, int sourceLen) { UdpManagerHandler *manHandler = mUdpManager->GetHandler(); - if (manHandler != NULL) + if (manHandler != nullptr) return(manHandler->OnUserSuppliedEncrypt(this, destData, sourceData, sourceLen)); assert(0); // if user-supplied encryption is specified, then you must have a manager handler installed to provide the routines return(0); @@ -2665,7 +2665,7 @@ int UdpConnection::EncryptUserSupplied(uchar *destData, const uchar *sourceData, int UdpConnection::DecryptUserSupplied(uchar *destData, const uchar *sourceData, int sourceLen) { UdpManagerHandler *manHandler = mUdpManager->GetHandler(); - if (manHandler != NULL) + if (manHandler != nullptr) return(manHandler->OnUserSuppliedDecrypt(this, destData, sourceData, sourceLen)); assert(0); // if user-supplied encryption is specified, then you must have a manager handler installed to provide the routines return(0); @@ -2674,7 +2674,7 @@ int UdpConnection::DecryptUserSupplied(uchar *destData, const uchar *sourceData, int UdpConnection::EncryptUserSupplied2(uchar *destData, const uchar *sourceData, int sourceLen) { UdpManagerHandler *manHandler = mUdpManager->GetHandler(); - if (manHandler != NULL) + if (manHandler != nullptr) return(manHandler->OnUserSuppliedEncrypt2(this, destData, sourceData, sourceLen)); assert(0); // if user-supplied encryption is specified, then you must have a manager handler installed to provide the routines return(0); @@ -2683,7 +2683,7 @@ int UdpConnection::EncryptUserSupplied2(uchar *destData, const uchar *sourceData int UdpConnection::DecryptUserSupplied2(uchar *destData, const uchar *sourceData, int sourceLen) { UdpManagerHandler *manHandler = mUdpManager->GetHandler(); - if (manHandler != NULL) + if (manHandler != nullptr) return(manHandler->OnUserSuppliedDecrypt2(this, destData, sourceData, sourceLen)); assert(0); // if user-supplied encryption is specified, then you must have a manager handler installed to provide the routines return(0); @@ -2833,7 +2833,7 @@ void UdpConnection::SetupEncryptModel() mEncryptExpansionBytes += 0; // set up encrypt buffer (random numbers generated based on seed) - if (mEncryptXorBuffer == NULL) + if (mEncryptXorBuffer == nullptr) { int len = ((mUdpManager->mParams.maxRawPacketSize + 1) / 4) * 4; mEncryptXorBuffer = new uchar[len]; @@ -2865,7 +2865,7 @@ void UdpConnection::GetChannelStatus(UdpChannel channel, ChannelStatus *channelS case cUdpChannelReliable2: case cUdpChannelReliable3: case cUdpChannelReliable4: - if (mChannel[channel - cUdpChannelReliable1] != NULL) + if (mChannel[channel - cUdpChannelReliable1] != nullptr) { mChannel[channel - cUdpChannelReliable1]->GetChannelStatus(channelStatus); } @@ -2941,12 +2941,12 @@ UdpReliableChannel::UdpReliableChannel(int channelNumber, UdpConnection *con, Ud mLogicalPacketsQueued = 0; mLogicalBytesQueued = 0; - mCoalescePacket = NULL; - mCoalesceStartPtr = NULL; - mCoalesceEndPtr = NULL; + mCoalescePacket = nullptr; + mCoalesceStartPtr = nullptr; + mCoalesceEndPtr = nullptr; mCoalesceCount = 0; - mBufferedAckPtr = NULL; + mBufferedAckPtr = nullptr; mStatDuplicatePacketsReceived = 0; mStatResentPacketsAccelerated = 0; @@ -2960,7 +2960,7 @@ UdpReliableChannel::UdpReliableChannel(int channelNumber, UdpConnection *con, Ud mBigDataLen = 0; mBigDataTargetLen = 0; - mBigDataPtr = NULL; + mBigDataPtr = nullptr; mFragmentNextPos = 0; mLastTimeStampAcknowledged = 0; mMaxxedOutCurrentWindow = false; @@ -2969,23 +2969,23 @@ UdpReliableChannel::UdpReliableChannel(int channelNumber, UdpConnection *con, Ud mPhysicalPackets = new PhysicalPacket[mConfig.maxOutstandingPackets]; mReliableIncoming = new IncomingQueueEntry[mConfig.maxInstandingPackets]; - mLogicalRoot = NULL; - mLogicalEnd = NULL; + mLogicalRoot = nullptr; + mLogicalEnd = nullptr; } UdpReliableChannel::~UdpReliableChannel() { - if (mCoalescePacket != NULL) + if (mCoalescePacket != nullptr) { mCoalescePacket->Release(); - mCoalescePacket = NULL; + mCoalescePacket = nullptr; } const LogicalPacket *cur = mLogicalRoot; - while (cur != NULL) + while (cur != nullptr) { const LogicalPacket *next = cur->mReliableQueueNext; - cur->mReliableQueueNext = NULL; // make sure and mark it available so others could possibly use it (if it is a shared logical packet) + cur->mReliableQueueNext = nullptr; // make sure and mark it available so others could possibly use it (if it is a shared logical packet) cur->Release(); if (cur == next) // pointing to self, so this is end of list break; @@ -3052,7 +3052,7 @@ void UdpReliableChannel::Send(const LogicalPacket *packet) void UdpReliableChannel::FlushCoalesce() { - if (mCoalescePacket != NULL) + if (mCoalescePacket != nullptr) { if (mCoalesceCount == 1) { @@ -3069,16 +3069,16 @@ void UdpReliableChannel::FlushCoalesce() } mCoalescePacket->Release(); - mCoalescePacket = NULL; + mCoalescePacket = nullptr; } } void UdpReliableChannel::SendCoalesce(const uchar *data, int dataLen, const uchar *data2, int dataLen2) { int totalLen = dataLen + dataLen2; - if (mCoalescePacket == NULL) + if (mCoalescePacket == nullptr) { - mCoalescePacket = mUdpConnection->mUdpManager->CreatePacket(NULL, mMaxDataBytes); + mCoalescePacket = mUdpConnection->mUdpManager->CreatePacket(nullptr, mMaxDataBytes); mCoalesceEndPtr = mCoalesceStartPtr = (uchar *)mCoalescePacket->GetDataPtr(); *mCoalesceEndPtr++ = 0; *mCoalesceEndPtr++ = UdpConnection::cUdpPacketGroup; @@ -3098,10 +3098,10 @@ void UdpReliableChannel::SendCoalesce(const uchar *data, int dataLen, const ucha // append on end of coalesce mCoalesceCount++; mCoalesceEndPtr += UdpMisc::PutVariableValue(mCoalesceEndPtr, totalLen); - if (data != NULL) + if (data != nullptr) memcpy(mCoalesceEndPtr, data, dataLen); mCoalesceEndPtr += dataLen; - if (data2 != NULL) + if (data2 != nullptr) memcpy(mCoalesceEndPtr, data2, dataLen2); mCoalesceEndPtr += dataLen2; } @@ -3111,7 +3111,7 @@ void UdpReliableChannel::QueueLogicalPacket(const LogicalPacket *packet) mLogicalPacketsQueued++; mLogicalBytesQueued += packet->GetDataLen(); - if (packet->mReliableQueueNext != NULL) + if (packet->mReliableQueueNext != nullptr) { packet = mUdpConnection->mUdpManager->WrappedBorrow(packet); } @@ -3121,13 +3121,13 @@ void UdpReliableChannel::QueueLogicalPacket(const LogicalPacket *packet) } packet->mReliableQueueNext = packet; // have it point to itself to signify that the mNext pointer is taken (ie. reserve it), yet still represents the end of the list - if (mLogicalEnd != NULL) + if (mLogicalEnd != nullptr) { mLogicalEnd->mReliableQueueNext = packet; } mLogicalEnd = packet; - if (mLogicalRoot == NULL) + if (mLogicalRoot == nullptr) { mLogicalRoot = packet; } @@ -3148,10 +3148,10 @@ bool UdpReliableChannel::PullDown(int windowSpaceLeft) int physicalCount = (int)(mReliableOutgoingId - mReliableOutgoingPendingId); while (windowSpaceLeft > 0 && physicalCount < mConfig.maxOutstandingPackets) { - if (mLogicalRoot == NULL) + if (mLogicalRoot == nullptr) { FlushCoalesce(); // this is guaranteed to stick - if (mLogicalRoot == NULL) + if (mLogicalRoot == nullptr) break; // nothing flushed, so we are done } @@ -3191,10 +3191,10 @@ bool UdpReliableChannel::PullDown(int windowSpaceLeft) mLogicalRoot = mLogicalRoot->mReliableQueueNext; if (mLogicalRoot == lp) // ie, we were pointing to ourself, meaning we were the end of the list { - mLogicalRoot = NULL; - mLogicalEnd = NULL; + mLogicalRoot = nullptr; + mLogicalEnd = nullptr; } - lp->mReliableQueueNext = NULL; // clear our next link since we are no longer using it (so somebody else can use it potentially) + lp->mReliableQueueNext = nullptr; // clear our next link since we are no longer using it (so somebody else can use it potentially) lp->Release(); // release from logical queue } else @@ -3249,9 +3249,9 @@ int UdpReliableChannel::GiveTime() // this next branch was replaced by JeffP in the latest UdpLibrary drop. Please integrate // that. If something catestrophic happens with reliable channels, uncomment this next line to // replace the existing branch - //if (mReliableOutgoingId < mReliableOutgoingPendingId || mLogicalRoot != NULL || mCoalescePacket != NULL) + //if (mReliableOutgoingId < mReliableOutgoingPendingId || mLogicalRoot != nullptr || mCoalescePacket != nullptr) - if (mReliableOutgoingPendingId < mReliableOutgoingId || mLogicalRoot != NULL || mCoalescePacket != NULL) + if (mReliableOutgoingPendingId < mReliableOutgoingId || mLogicalRoot != nullptr || mCoalescePacket != nullptr) { // first, let's calculate how many bytes we figure is outstanding based on who is still waiting for an ack-packet UdpMisc::ClockStamp oldestResendTime = udpMax(hotClock - optimalResendDelay, mLastTimeStampAcknowledged); // anything older than this, we need to resend @@ -3276,7 +3276,7 @@ int UdpReliableChannel::GiveTime() // if this packet has not been acked and it is NOT ready to be sent (was recently sent) then we consider it outstanding // note: packets needing re-sending probably got lost and are therefore not outstanding PhysicalPacket *entry = &mPhysicalPackets[i % mConfig.maxOutstandingPackets]; - if (entry->mDataPtr != NULL) // acked packets set the dataPtr to NULL + if (entry->mDataPtr != nullptr) // acked packets set the dataPtr to nullptr { // if this packet is ready to be sent (ie: needs time now, or some later packet has already been ack'ed) windowSpaceLeft -= entry->mDataLen; // window-space is effectively taken whether we have sent it yet or not @@ -3436,7 +3436,7 @@ int UdpReliableChannel::GiveTime() void UdpReliableChannel::GetChannelStatus(UdpConnection::ChannelStatus *channelStatus) const { int coalesceBytes = 0; - if (mCoalescePacket != NULL) + if (mCoalescePacket != nullptr) coalesceBytes = mCoalesceEndPtr - mCoalesceStartPtr; channelStatus->totalPendingBytes = mLogicalBytesQueued + mReliableOutgoingBytes + coalesceBytes; @@ -3497,7 +3497,7 @@ void UdpReliableChannel::ReliablePacket(const uchar *data, int dataLen) mReliableIncomingId++; // process other packets that have arrived - while (mReliableIncoming[mReliableIncomingId % mConfig.maxInstandingPackets].mPacket != NULL) + while (mReliableIncoming[mReliableIncomingId % mConfig.maxInstandingPackets].mPacket != nullptr) { int spot = (int)(mReliableIncomingId % mConfig.maxInstandingPackets); if (mReliableIncoming[spot].mMode != cReliablePacketModeDelivered) @@ -3506,7 +3506,7 @@ void UdpReliableChannel::ReliablePacket(const uchar *data, int dataLen) } mReliableIncoming[spot].mPacket->Release(); - mReliableIncoming[spot].mPacket = NULL; + mReliableIncoming[spot].mPacket = nullptr; mReliableIncomingId++; } } @@ -3514,7 +3514,7 @@ void UdpReliableChannel::ReliablePacket(const uchar *data, int dataLen) { // not the one we need next, but it is later than the one we need , so store it in our buffer until it's turn comes up int spot = (int)(reliableId % mConfig.maxInstandingPackets); - if (mReliableIncoming[spot].mPacket == NULL) // only make the copy of it if we don't already have it in our buffer (in cases where it was sent twice, there would be no harm in the copy again since it must be the same packet, it's just inefficient) + if (mReliableIncoming[spot].mPacket == nullptr) // only make the copy of it if we don't already have it in our buffer (in cases where it was sent twice, there would be no harm in the copy again since it must be the same packet, it's just inefficient) { mReliableIncoming[spot].mMode = mode; mReliableIncoming[spot].mPacket = mUdpConnection->mUdpManager->CreatePacket(data + UdpConnection::cUdpPacketReliableSize, dataLen - UdpConnection::cUdpPacketReliableSize); @@ -3556,16 +3556,16 @@ void UdpReliableChannel::ReliablePacket(const uchar *data, int dataLen) // a simple ack for us only *bufPtr++ = (uchar)(UdpConnection::cUdpPacketAck1 + mChannelNumber); bufPtr += UdpMisc::PutValue16(bufPtr, (ushort)(reliableId & 0xffff)); - mBufferedAckPtr = NULL; // not allowed to replace an old one with a selective-ack + mBufferedAckPtr = nullptr; // not allowed to replace an old one with a selective-ack } - if (mBufferedAckPtr != NULL && mConfig.ackDeduping) + if (mBufferedAckPtr != nullptr && mConfig.ackDeduping) { memcpy(mBufferedAckPtr, buf, bufPtr - buf); } else { - mBufferedAckPtr = mUdpConnection->BufferedSend(buf, bufPtr - buf, NULL, 0, true); // safe to append on our data, it is stack data + mBufferedAckPtr = mUdpConnection->BufferedSend(buf, bufPtr - buf, nullptr, 0, true); // safe to append on our data, it is stack data } } @@ -3582,7 +3582,7 @@ void UdpReliableChannel::ProcessPacket(ReliablePacketMode mode, const uchar *dat else if (mode == cReliablePacketModeFragment) { // append onto end of big packet (or create new big packet if not existing already) - if (mBigDataPtr == NULL) + if (mBigDataPtr == nullptr) { mBigDataTargetLen = UdpMisc::GetValue32(data); // first fragment has a total-length int header on it. mBigDataPtr = new uchar[mBigDataTargetLen]; @@ -3611,7 +3611,7 @@ void UdpReliableChannel::ProcessPacket(ReliablePacketMode mode, const uchar *dat delete[] mBigDataPtr; mBigDataLen = 0; mBigDataTargetLen = 0; - mBigDataPtr = NULL; + mBigDataPtr = nullptr; } } } @@ -3641,7 +3641,7 @@ void UdpReliableChannel::Ack(udp_int64 reliableId) int pos = (int)(reliableId % mConfig.maxOutstandingPackets); PhysicalPacket *entry = &mPhysicalPackets[pos]; - if (entry->mDataPtr != NULL) // if this packet has not been acknowledged yet (sometimes we get back two acks for the same packet) + if (entry->mDataPtr != nullptr) // if this packet has not been acknowledged yet (sometimes we get back two acks for the same packet) { mNextNeedTime = 0; // something got acked, so we actually need to take the time next time it is offered @@ -3699,14 +3699,14 @@ void UdpReliableChannel::Ack(udp_int64 reliableId) // this packet we have queued has been acknowledged, so delete it from queue mReliableOutgoingBytes -= entry->mDataLen; entry->mDataLen = 0; - entry->mDataPtr = NULL; + entry->mDataPtr = nullptr; entry->mParent->Release(); - entry->mParent = NULL; + entry->mParent = nullptr; // advance the pending ptr until it reaches outgoingId or an entry that has yet to acknowledged while (mReliableOutgoingPendingId < mReliableOutgoingId) { - if (mPhysicalPackets[mReliableOutgoingPendingId % mConfig.maxOutstandingPackets].mDataPtr != NULL) + if (mPhysicalPackets[mReliableOutgoingPendingId % mConfig.maxOutstandingPackets].mDataPtr != nullptr) break; mReliableOutgoingPendingId++; } @@ -3728,25 +3728,25 @@ void UdpReliableChannel::Ack(udp_int64 reliableId) UdpReliableChannel::IncomingQueueEntry::IncomingQueueEntry() { - mPacket = NULL; + mPacket = nullptr; mMode = UdpReliableChannel::cReliablePacketModeReliable; } UdpReliableChannel::IncomingQueueEntry::~IncomingQueueEntry() { - if (mPacket != NULL) + if (mPacket != nullptr) mPacket->Release(); } UdpReliableChannel::PhysicalPacket::PhysicalPacket() { - mParent = NULL; + mParent = nullptr; } UdpReliableChannel::PhysicalPacket::~PhysicalPacket() { - if (mParent != NULL) + if (mParent != nullptr) mParent->Release(); } @@ -3758,7 +3758,7 @@ UdpReliableChannel::PhysicalPacket::~PhysicalPacket() LogicalPacket::LogicalPacket() { mRefCount = 1; - mReliableQueueNext = NULL; + mReliableQueueNext = nullptr; } LogicalPacket::~LogicalPacket() @@ -3793,7 +3793,7 @@ SimpleLogicalPacket::SimpleLogicalPacket(const void *data, int dataLen) { mDataLen = dataLen; mData = new uchar[mDataLen]; - if (data != NULL) + if (data != nullptr) memcpy(mData, data, mDataLen); } @@ -3828,7 +3828,7 @@ void SimpleLogicalPacket::SetDataLen(int len) GroupLogicalPacket::GroupLogicalPacket() : LogicalPacket() { mDataLen = 0; - mData = NULL; + mData = nullptr; } GroupLogicalPacket::~GroupLogicalPacket() @@ -3838,13 +3838,13 @@ GroupLogicalPacket::~GroupLogicalPacket() void GroupLogicalPacket::AddPacket(const LogicalPacket *packet) { - assert(packet != NULL); + assert(packet != nullptr); AddPacketInternal(packet->GetDataPtr(), packet->GetDataLen(), packet->IsInternalPacket()); } void GroupLogicalPacket::AddPacket(const void *data, int dataLen) { - assert(data != NULL); + assert(data != nullptr); assert(dataLen >= 0); AddPacketInternal(data, dataLen, false); } @@ -3910,16 +3910,16 @@ PooledLogicalPacket::PooledLogicalPacket(UdpManager *manager, int len) mDataLen = 0; mUdpManager = manager; - mAvailableNext = NULL; - mCreatedNext = NULL; - mCreatedPrev = NULL; + mAvailableNext = nullptr; + mCreatedNext = nullptr; + mCreatedPrev = nullptr; mUdpManager->PoolCreated(this); } PooledLogicalPacket::~PooledLogicalPacket() { - if (mUdpManager != NULL) + if (mUdpManager != nullptr) { mUdpManager->PoolDestroyed(this); } @@ -3934,7 +3934,7 @@ void PooledLogicalPacket::AddRef() const void PooledLogicalPacket::Release() const { - if (mRefCount == 1 && mUdpManager != NULL) + if (mRefCount == 1 && mUdpManager != nullptr) mUdpManager->PoolReturn(const_cast(this)); // if pool wants to keep us, it will inc our ref count, preventing our destruction // we cast off our const, as when we are added back to the pool, we can be modified LogicalPacket::Release(); @@ -3964,9 +3964,9 @@ void PooledLogicalPacket::SetDataLen(int len) void PooledLogicalPacket::SetData(const void *data, int dataLen, const void *data2, int dataLen2) { mDataLen = dataLen + dataLen2; - if (data != NULL) + if (data != nullptr) memcpy(mData, data, dataLen); - if (data2 != NULL) + if (data2 != nullptr) memcpy(mData + dataLen, data2, dataLen2); } @@ -3977,23 +3977,23 @@ void PooledLogicalPacket::SetData(const void *data, int dataLen, const void *dat /////////////////////////////////////////////////////////////////////////////////////////// WrappedLogicalPacket::WrappedLogicalPacket(UdpManager *udpManager) { - mPacket = NULL; + mPacket = nullptr; mUdpManager = udpManager; - mAvailableNext = NULL; - mCreatedNext = NULL; - mCreatedPrev = NULL; + mAvailableNext = nullptr; + mCreatedNext = nullptr; + mCreatedPrev = nullptr; mUdpManager->WrappedCreated(this); } WrappedLogicalPacket::~WrappedLogicalPacket() { - if (mUdpManager != NULL) + if (mUdpManager != nullptr) { mUdpManager->WrappedDestroyed(this); } - if (mPacket != NULL) + if (mPacket != nullptr) { mPacket->Release(); } @@ -4006,7 +4006,7 @@ void WrappedLogicalPacket::AddRef() const void WrappedLogicalPacket::Release() const { - if (mRefCount == 1 && mUdpManager != NULL) + if (mRefCount == 1 && mUdpManager != nullptr) mUdpManager->WrappedReturn(const_cast(this)); // if pool wants to keep us, it will inc our ref count, preventing our destruction // we cast off our const, as when we are added back to the pool, we can be modified LogicalPacket::Release(); @@ -4014,10 +4014,10 @@ void WrappedLogicalPacket::Release() const void WrappedLogicalPacket::SetLogicalPacket(const LogicalPacket *packet) { - if (mPacket != NULL) + if (mPacket != nullptr) mPacket->Release(); mPacket = packet; - if (mPacket != NULL) + if (mPacket != nullptr) mPacket->AddRef(); } @@ -4053,7 +4053,7 @@ UdpManager::SimulateQueueEntry::SimulateQueueEntry(const uchar *data, int dataLe memcpy(mData, data, dataLen); mIp = ip; mPort = port; - mNext = NULL; + mNext = nullptr; } UdpManager::SimulateQueueEntry::~SimulateQueueEntry() @@ -4088,7 +4088,7 @@ UdpMisc::ClockStamp UdpMisc::Clock() static ClockStamp sLastStamp = 0; static ClockStamp sCurrentCorrection = 0; struct timeval tv; - gettimeofday(&tv, NULL); + gettimeofday(&tv, nullptr); UdpMisc::ClockStamp cs = static_cast(tv.tv_sec) * 1000 + static_cast(tv.tv_usec / 1000); cs += sCurrentCorrection; if (cs < sLastStamp) @@ -4204,19 +4204,19 @@ void *UdpMisc::SmartResize(void *ptr, int bytes, int round) if (bytes == 0) { - if (ptr != NULL) + if (ptr != nullptr) { free((uchar *)ptr - cAlignment); } - return(NULL); + return(nullptr); } uchar *ptr2; - if (ptr == NULL) + if (ptr == nullptr) { ptr2 = (uchar *)malloc(bytes + cAlignment); - if (ptr2 == NULL) - return(NULL); + if (ptr2 == nullptr) + return(nullptr); *(int *)ptr2 = bytes; return(ptr2 + cAlignment); } @@ -4226,8 +4226,8 @@ void *UdpMisc::SmartResize(void *ptr, int bytes, int round) return(ptr); ptr2 = (uchar *)realloc((uchar *)ptr - cAlignment, bytes + cAlignment); - if (ptr2 == NULL) - return(NULL); + if (ptr2 == nullptr) + return(nullptr); *(int *)ptr2 = bytes; return(ptr2 + cAlignment); @@ -4290,30 +4290,30 @@ LogicalPacket *UdpMisc::CreateQuickLogicalPacket(const void *data, int dataLen, switch(q) { case 0: - tlp = new FixedLogicalPacket(NULL, totalDataLen); + tlp = new FixedLogicalPacket(nullptr, totalDataLen); break; case 1: - tlp = new FixedLogicalPacket(NULL, totalDataLen); + tlp = new FixedLogicalPacket(nullptr, totalDataLen); break; case 2: case 3: - tlp = new FixedLogicalPacket(NULL, totalDataLen); + tlp = new FixedLogicalPacket(nullptr, totalDataLen); break; case 4: case 5: case 6: case 7: - tlp = new FixedLogicalPacket(NULL, totalDataLen); + tlp = new FixedLogicalPacket(nullptr, totalDataLen); break; default: - tlp = new SimpleLogicalPacket(NULL, totalDataLen); + tlp = new SimpleLogicalPacket(nullptr, totalDataLen); break; } uchar *dest = (uchar *)tlp->GetDataPtr(); - if (data != NULL) + if (data != nullptr) memcpy(dest, data, dataLen); - if (data2 != NULL) + if (data2 != nullptr) memcpy(dest + dataLen, data2, dataLen2); return(tlp); } @@ -4327,7 +4327,7 @@ UdpIpAddress UdpMisc::GetHostByName(const char *hostName) { struct hostent * lphp; lphp = gethostbyname(hostName); - if (lphp == NULL) + if (lphp == nullptr) { address = 0; } diff --git a/external/3rd/library/udplibrary/UdpLibrary.hpp b/external/3rd/library/udplibrary/UdpLibrary.hpp index 43a20328..39f05a43 100644 --- a/external/3rd/library/udplibrary/UdpLibrary.hpp +++ b/external/3rd/library/udplibrary/UdpLibrary.hpp @@ -148,7 +148,7 @@ class UdpMisc // memory manager does a little bit of this, but if you know you have an allocation that is likely // to grow quite a bit, you can set the round'ing size up to a fairly large number and avoid // unnecessary reallocs at the cost of a little potentially wasted space - // initial allocations are done by passing in ptr==NULL, freeing is done by passing in bytes==0 + // initial allocations are done by passing in ptr==nullptr, freeing is done by passing in bytes==0 static void *SmartResize(void *ptr, int bytes, int round = 1); // the following two functions store values in the buffer as a variable length (B1, 0xffB2B1, 0xffffffB4B3B2B1) @@ -168,7 +168,7 @@ class UdpMisc static uint GetValue24(const void *buffer); // gets a 24-bit value from the buffer in big-endian format static ushort GetValue16(const void *buffer); // gets a 16-bit value from the buffer in big-endian format - static LogicalPacket *CreateQuickLogicalPacket(const void *data, int dataLen, const void *data2 = NULL, int dataLen2 = 0); + static LogicalPacket *CreateQuickLogicalPacket(const void *data, int dataLen, const void *data2 = nullptr, int dataLen2 = 0); // looks up the specified name and translates it to an IP address // this is a blocking call that can at times take a significant amount of time, but will generally be fast (less than 300ms) @@ -241,7 +241,7 @@ class LogicalPacket protected: friend class UdpReliableChannel; mutable const LogicalPacket *mReliableQueueNext; // owned/managed by the reliable channel object as an optimizations, do not touch - // NULL = unclaimed, point-to-self = claimed, but end of list + // nullptr = unclaimed, point-to-self = claimed, but end of list }; class SimpleLogicalPacket : public LogicalPacket @@ -250,7 +250,7 @@ class SimpleLogicalPacket : public LogicalPacket // it was originally created to allow the internal code to handle reliable data that was sent // via the Send(char *, int) api call. public: - SimpleLogicalPacket(const void *data, int dataLen); // data can be NULL if you want to populate it after it is allocated (get the pointer and write to it) + SimpleLogicalPacket(const void *data, int dataLen); // data can be nullptr if you want to populate it after it is allocated (get the pointer and write to it) virtual void *GetDataPtr(); virtual const void *GetDataPtr() const; virtual int GetDataLen() const; @@ -321,7 +321,7 @@ template class StructLogicalPacket : public LogicalPacket // with virtual functions) via this method as they may contain hidden data-members (such as pointers // to vtables). public: - StructLogicalPacket(T *initData = NULL); + StructLogicalPacket(T *initData = nullptr); virtual void *GetDataPtr(); virtual const void *GetDataPtr() const; virtual int GetDataLen() const; @@ -394,7 +394,7 @@ class PooledLogicalPacket : public LogicalPacket int mMaxDataLen; protected: friend class UdpManager; - void SetData(const void *data, int dataLen, const void *data2 = NULL, int dataLen2 = 0); + void SetData(const void *data, int dataLen, const void *data2 = nullptr, int dataLen2 = 0); UdpManager *mUdpManager; PooledLogicalPacket *mAvailableNext; PooledLogicalPacket *mCreatedNext; @@ -474,7 +474,7 @@ class UdpManager // pointer equal to your object and the UdpManager will call it as appropriate. The UdpConnection object // also has a handler mechanism that replaces the other callback functions below, see UdpConnection::SetHandler // if a handler is specified, the callback function is ignored, even if specified. - // default = NULL (not used) + // default = nullptr (not used) UdpManagerHandler *handler; // this is the maximum number of connections that can be established by this manager, any incoming/outgoing connections @@ -883,7 +883,7 @@ class UdpManager // will call EstablishConnection, then sit in a loop calling UdpManager::GiveTime and checking to see // if the status of the returned UdpConnection object is changed from cStatusNegotiating. This allows // the application to look for the ESC key or timeout an attempted connection. - // This function will return NULL if the manager object has exceeded its maximum number of connections + // This function will return nullptr if the manager object has exceeded its maximum number of connections // or if the serverAddress cannot be resolved to an IP address // as is noted in the declaration, it is the responsibility of the application establishing the connection to delete it // setting the timeout value (in milliseconds) to something greater than 0 will cause the UdpConnection object to change @@ -915,13 +915,13 @@ class UdpManager // manually forces all live connections to flush their multi buffers immediately void FlushAllMultiBuffer(); - // creates a logical packet and populates it with data. data can be NULL, in which case it gives you logical packet + // creates a logical packet and populates it with data. data can be nullptr, in which case it gives you logical packet // of the size specified, but copies no data into it. If you are using pool management (see Params::poolPacketMax), // it will give you a packet out of the pool if possible, otherwise it will create a packet for you. When logical // are packets are needed internally for various things (like reliable channel sends that use the (void *, int) interface) // they are gotten from this function, so your application can likely take advantage of pooling, even if it never bothers // to explicitly call this function. - LogicalPacket *CreatePacket(const void *data, int dataLen, const void *data2 = NULL, int dataLen2 = 0); + LogicalPacket *CreatePacket(const void *data, int dataLen, const void *data2 = nullptr, int dataLen2 = 0); protected: friend class PooledLogicalPacket; @@ -1147,7 +1147,7 @@ class UdpConnection : public PriorityQueueMember, public AddressHashTableMember, int ConnectionAge() const; // returns the UdpManager object that is managing this connection - // will return NULL if the connection has been disconnected for some reason (because disconnecting severes the link to UdpManager) + // will return nullptr if the connection has been disconnected for some reason (because disconnecting severes the link to UdpManager) UdpManager *GetUdpManager() const; // returns the 32-bit encryption-code that was negotiated as part of the connection-establishment process. @@ -1227,9 +1227,9 @@ class UdpConnection : public PriorityQueueMember, public AddressHashTableMember, friend class UdpManager; friend class UdpReliableChannel; - // note: if connectPacket is NULL, that means this connection object is being created to establish + // note: if connectPacket is nullptr, that means this connection object is being created to establish // a new connection to the specified ip/port (ie. the connection starts out in cStatusNegotiating mode) - // if connectPacket is non-NULL, that menas this connection object is being created to handle an + // if connectPacket is non-nullptr, that menas this connection object is being created to handle an // incoming connect request and it will start out in cStatusConnected mode. UdpConnection(UdpManager *udpManager, UdpIpAddress destIp, int destPort, int timeout); // starts connection-establishment protocol UdpConnection(UdpManager *udpManager, const UdpManager::PacketHistoryEntry *e); // starts already connected, replying to connection request @@ -1264,7 +1264,7 @@ class UdpConnection : public PriorityQueueMember, public AddressHashTableMember, void PhysicalSend(const uchar *data, int dataLen, bool appendAllowed); // sends a physical packet (encrypts and adds crc bytes) uchar *BufferedSend(const uchar *data, int dataLen, const uchar *data2, int dataLen2, bool appendAllowed); // buffers logical packets waiting til we have more data (makes multi-packets) bool InternalSend(UdpChannel channel, const LogicalPacket *packet); - bool InternalSend(UdpChannel channel, const uchar *data, int dataLen, const uchar *data2 = NULL, int dataLen2 = 0); + bool InternalSend(UdpChannel channel, const uchar *data, int dataLen, const uchar *data2 = nullptr, int dataLen2 = 0); uchar *InternalAckSend(uchar *bufferedAckPtr, const uchar *ackPtr, int ackLen); // used by reliable channel to send acks (special send that allows for deduping ack feature) @@ -1555,7 +1555,7 @@ class UdpReliableChannel void ProcessPacket(ReliablePacketMode mode, const uchar *data, int dataLen); bool PullDown(int windowSpaceLeft); void FlushCoalesce(); - void SendCoalesce(const uchar *data, int dataLen, const uchar *data2 = NULL, int dataLen2 = 0); + void SendCoalesce(const uchar *data, int dataLen, const uchar *data2 = nullptr, int dataLen2 = 0); void QueueLogicalPacket(const LogicalPacket *packet); UdpManager::ReliableConfig mConfig; @@ -1609,7 +1609,7 @@ class UdpReliableChannel template FixedLogicalPacket::FixedLogicalPacket(const void *data, int dataLen) { mDataLen = dataLen; - if (data != NULL) + if (data != nullptr) memcpy(mData, data, mDataLen); } @@ -1639,7 +1639,7 @@ template void FixedLogicalPacket::SetDataLen(int l ///////////////////////////////////////////////////////////////////////// template StructLogicalPacket::StructLogicalPacket(T *initData) { - if (initData != NULL) + if (initData != nullptr) mStruct = *initData; } @@ -1784,7 +1784,7 @@ inline void UdpManager::SetPriority(UdpConnection *con, UdpMisc::ClockStamp stam if (stamp < mMinimumScheduledStamp) stamp = mMinimumScheduledStamp; - if (mPriorityQueue != NULL) + if (mPriorityQueue != nullptr) mPriorityQueue->Add(con, stamp); } @@ -1811,7 +1811,7 @@ inline void UdpManager::PoolReturn(PooledLogicalPacket *packet) inline void UdpManager::WrappedReturn(WrappedLogicalPacket *wp) { - wp->SetLogicalPacket(NULL); + wp->SetLogicalPacket(nullptr); if (mWrappedAvailable < mParams.wrappedPoolMax) { @@ -1859,7 +1859,7 @@ inline void UdpConnection::ScheduleTimeNow() // prevents us from reprioritizing to 0, only to shortly thereafter be reprioritized to where we actually belong. if (!mGettingTime) { - if (mUdpManager != NULL) + if (mUdpManager != nullptr) mUdpManager->SetPriority(this, 0); } } @@ -2048,7 +2048,7 @@ inline int UdpReliableChannel::TotalPendingBytes() const inline void UdpReliableChannel::ClearBufferedAck() { - mBufferedAckPtr = NULL; + mBufferedAckPtr = nullptr; } inline udp_int64 UdpReliableChannel::GetReliableOutgoingId(int reliableStamp) const diff --git a/external/3rd/library/udplibrary/hashtable.hpp b/external/3rd/library/udplibrary/hashtable.hpp index 8c7340bc..f37a40e1 100644 --- a/external/3rd/library/udplibrary/hashtable.hpp +++ b/external/3rd/library/udplibrary/hashtable.hpp @@ -175,11 +175,11 @@ template class HashTable bool Remove(T& obj, int hashValue); void Reset(); // removes all entries from the table - T *FindFirst(int hashValue) const; // returns NULL if not found - T *FindNext(T *prevResult) const; // returns NULL if not found + T *FindFirst(int hashValue) const; // returns nullptr if not found + T *FindNext(T *prevResult) const; // returns nullptr if not found - T *WalkFirst() const; // returns NULL if not found - T *WalkNext(T *prevResult) const; // returns NULL if not found + T *WalkFirst() const; // returns nullptr if not found + T *WalkNext(T *prevResult) const; // returns nullptr if not found void Resize(int hashSize); // the actual hash size will be rounded up to the next larger prime number (very slow, not recommended) void GetStatistics(HashTableStatistics *stats) const; @@ -201,7 +201,7 @@ template class HashTable template HashTable::HashTable(int hashSize) { - mTable = NULL; + mTable = nullptr; mTableSize = 0; mEntryCount = 0; mStatUsedSlots = 0; @@ -221,9 +221,9 @@ template void HashTable::Insert(T& obj, int hashValue) entry->hashValue = hashValue; int spot = ((unsigned)hashValue) % mTableSize; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) { - entry->nextEntry = NULL; + entry->nextEntry = nullptr; mTable[spot] = entry; mStatUsedSlots++; } @@ -240,14 +240,14 @@ template bool HashTable::Remove(T& obj, int hashValue) int spot = ((unsigned)hashValue) % mTableSize; HashEntry* next = mTable[spot]; HashEntry** prev = &mTable[spot]; - while (next != NULL) + while (next != nullptr) { if (next->obj == obj && next->hashValue == hashValue) { *prev = next->nextEntry; delete next; mEntryCount--; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) mStatUsedSlots--; return(true); break; @@ -264,17 +264,17 @@ template void HashTable::Reset() for (int spot = 0; spot < mTableSize; spot++) { HashEntry *curr = mTable[spot]; - if (curr != NULL) + if (curr != nullptr) { mStatUsedSlots--; - while (curr != NULL) + while (curr != nullptr) { HashEntry *next = curr->nextEntry; delete curr; mEntryCount--; curr = next; } - mTable[spot] = NULL; + mTable[spot] = nullptr; } } } @@ -282,13 +282,13 @@ template void HashTable::Reset() template T *HashTable::FindFirst(int hashValue) const { HashEntry *entry = mTable[((unsigned)hashValue) % mTableSize]; - while (entry != NULL) + while (entry != nullptr) { if (entry->hashValue == hashValue) return(&entry->obj); entry = entry->nextEntry; } - return(NULL); + return(nullptr); } template T *HashTable::FindNext(T *prevResult) const @@ -296,13 +296,13 @@ template T *HashTable::FindNext(T *prevResult) const HashEntry *entry = (HashEntry *)(((char *)prevResult) - offsetof(HashEntry, obj)); int hashValue = entry->hashValue; entry = entry->nextEntry; - while (entry != NULL) + while (entry != nullptr) { if (entry->hashValue == hashValue) return(&entry->obj); entry = entry->nextEntry; } - return(NULL); + return(nullptr); } template T *HashTable::WalkFirst() const @@ -310,10 +310,10 @@ template T *HashTable::WalkFirst() const for (int bucket = 0; bucket < mTableSize; bucket++) { HashEntry *entry = mTable[bucket]; - if (entry != NULL) + if (entry != nullptr) return(&entry->obj); } - return(NULL); + return(nullptr); } template T *HashTable::WalkNext(T *prevResult) const @@ -322,17 +322,17 @@ template T *HashTable::WalkNext(T *prevResult) const int bucket = ((unsigned)entry->hashValue) % mTableSize; entry = entry->nextEntry; - if (entry != NULL) + if (entry != nullptr) return(&entry->obj); bucket++; // go onto next bucket for (; bucket < mTableSize; bucket++) { HashEntry *entry = mTable[bucket]; - if (entry != NULL) + if (entry != nullptr) return(&entry->obj); } - return(NULL); + return(nullptr); } template void HashTable::Resize(int hashSize) @@ -352,16 +352,16 @@ template void HashTable::Resize(int hashSize) for (int i = 0; i < oldSize; i++) { HashEntry* next = oldTable[i]; - while (next != NULL) + while (next != nullptr) { HashEntry* hold = next; next = next->nextEntry; // insert hold into new table int spot = ((unsigned)hold->hashValue) % mTableSize; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) { - hold->nextEntry = NULL; + hold->nextEntry = nullptr; mTable[spot] = hold; mStatUsedSlots++; } @@ -415,11 +415,11 @@ template class ObjectHashTable bool Remove(T obj, int hashValue); void Reset(); // removes all entries from the table - T FindFirst(int hashValue) const; // returns NULL if not found - T FindNext(T prevResult) const; // returns NULL if not found + T FindFirst(int hashValue) const; // returns nullptr if not found + T FindNext(T prevResult) const; // returns nullptr if not found - T WalkFirst() const; // returns NULL if not found - T WalkNext(T prevResult) const; // returns NULL if not found + T WalkFirst() const; // returns nullptr if not found + T WalkNext(T prevResult) const; // returns nullptr if not found void Resize(int hashSize); // the actual hash size will be rounded up to the next larger prime number (very slow, not recommended) void GetStatistics(HashTableStatistics *stats) const; @@ -434,7 +434,7 @@ template class ObjectHashTable template ObjectHashTable::ObjectHashTable(int hashSize) { - mTable = NULL; + mTable = nullptr; mTableSize = 0; mEntryCount = 0; mStatUsedSlots = 0; @@ -452,9 +452,9 @@ template void ObjectHashTable::Insert(T obj, int hashValue) obj->mHashValue = hashValue; int spot = ((unsigned)hashValue) % mTableSize; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) { - obj->mHashNextEntry = NULL; + obj->mHashNextEntry = nullptr; mTable[spot] = obj; mStatUsedSlots++; } @@ -471,14 +471,14 @@ template bool ObjectHashTable::Remove(T obj, int hashValue) int spot = ((unsigned)hashValue) % mTableSize; T next = mTable[spot]; T *prev = &mTable[spot]; - while (next != NULL) + while (next != nullptr) { if (next == obj) { *prev = (T)next->mHashNextEntry; - next->mHashNextEntry = NULL; + next->mHashNextEntry = nullptr; mEntryCount--; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) mStatUsedSlots--; return(true); break; @@ -495,16 +495,16 @@ template void ObjectHashTable::Reset() for (int spot = 0; spot < mTableSize; spot++) { T curr = mTable[spot]; - if (curr != NULL) + if (curr != nullptr) { - while (curr != NULL) + while (curr != nullptr) { T next = (T)curr->mHashNextEntry; - curr->mHashNextEntry = NULL; + curr->mHashNextEntry = nullptr; mEntryCount--; curr = next; } - mTable[spot] = NULL; + mTable[spot] = nullptr; mStatUsedSlots--; } } @@ -513,13 +513,13 @@ template void ObjectHashTable::Reset() template T ObjectHashTable::FindFirst(int hashValue) const { T entry = mTable[((unsigned)hashValue) % mTableSize]; - while (entry != NULL) + while (entry != nullptr) { if (entry->mHashValue == hashValue) return(entry); entry = (T)entry->mHashNextEntry; } - return(NULL); + return(nullptr); } template T ObjectHashTable::FindNext(T prevResult) const @@ -527,13 +527,13 @@ template T ObjectHashTable::FindNext(T prevResult) const T entry = prevResult; int hashValue = entry->mHashValue; entry = (T)entry->mHashNextEntry; - while (entry != NULL) + while (entry != nullptr) { if (entry->mHashValue == hashValue) return(entry); entry = (T)entry->mHashNextEntry; } - return(NULL); + return(nullptr); } template T ObjectHashTable::WalkFirst() const @@ -541,10 +541,10 @@ template T ObjectHashTable::WalkFirst() const for (int bucket = 0; bucket < mTableSize; bucket++) { T entry = mTable[bucket]; - if (entry != NULL) + if (entry != nullptr) return(entry); } - return(NULL); + return(nullptr); } template T ObjectHashTable::WalkNext(T prevResult) const @@ -553,17 +553,17 @@ template T ObjectHashTable::WalkNext(T prevResult) const int bucket = ((unsigned)entry->mHashValue) % mTableSize; entry = (T)entry->mHashNextEntry; - if (entry != NULL) + if (entry != nullptr) return(entry); bucket++; // go onto next bucket for (; bucket < mTableSize; bucket++) { entry = mTable[bucket]; - if (entry != NULL) + if (entry != nullptr) return(entry); } - return(NULL); + return(nullptr); } template void ObjectHashTable::Resize(int hashSize) @@ -583,16 +583,16 @@ template void ObjectHashTable::Resize(int hashSize) for (int i = 0; i < oldSize; i++) { T next = oldTable[i]; - while (next != NULL) + while (next != nullptr) { T hold = next; next = (T)next->mHashNextEntry; // insert hold into new table int spot = ((unsigned)hold->mHashValue) % mTableSize; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) { - hold->mHashNextEntry = NULL; + hold->mHashNextEntry = nullptr; mTable[spot] = hold; mStatUsedSlots++; } diff --git a/external/3rd/library/udplibrary/priority.hpp b/external/3rd/library/udplibrary/priority.hpp index 19f34ab3..516619db 100644 --- a/external/3rd/library/udplibrary/priority.hpp +++ b/external/3rd/library/udplibrary/priority.hpp @@ -37,12 +37,12 @@ template class PriorityQueue PriorityQueue(int queueSize); ~PriorityQueue(); - T* Top(); // returns NULL if queue is empty - T* TopRemove(); // returns NULL if queue is empty - T* TopRemove(P priority); // removes item from queue if it has a lower priority value, otherwise return NULL + T* Top(); // returns nullptr if queue is empty + T* TopRemove(); // returns nullptr if queue is empty + T* TopRemove(P priority); // removes item from queue if it has a lower priority value, otherwise return nullptr T* Add(T* entry, P priority); // reprioritizes if already in queue, returns entry always T* Remove(T* entry); // returns entry always (even if it was not in the queue) - P *GetPriority(T* entry); // returns NULL if entry is not in the queue + P *GetPriority(T* entry); // returns nullptr if entry is not in the queue int QueueUsed(); // returns how many entries are in the queue protected: struct QueueEntry @@ -88,14 +88,14 @@ template PriorityQueue::~PriorityQueue() template T* PriorityQueue::Top() { if (mQueueEnd == 0) - return(NULL); + return(nullptr); return(mQueue[0].entry); } template T* PriorityQueue::TopRemove() { if (mQueueEnd == 0) - return(NULL); + return(nullptr); T* top = mQueue[0].entry; Remove(top); return(top); @@ -105,14 +105,14 @@ template T* PriorityQueue::TopRemove(P priority) { if (mQueueEnd > 0 && mQueue[0].priority <= priority) return(Remove(mQueue[0].entry)); - return(NULL); + return(nullptr); } template P* PriorityQueue::GetPriority(T* entry) { if (entry->mPriorityQueuePosition >= 0) return(&mQueue[entry->mPriorityQueuePosition].priority); - return(NULL); + return(nullptr); } template T* PriorityQueue::Add(T* entry, P priority) @@ -121,7 +121,7 @@ template T* PriorityQueue::Add(T* entry, P priorit { // not in queue, so add it to the bottom if (mQueueEnd >= mQueueSize) - return(NULL); + return(nullptr); mQueue[mQueueEnd].entry = entry; mQueue[mQueueEnd].priority = priority; mQueue[mQueueEnd].entry->mPriorityQueuePosition = mQueueEnd; diff --git a/external/3rd/library/udplibrary/udpclient.cpp b/external/3rd/library/udplibrary/udpclient.cpp index 9debac0e..9ed52d3e 100755 --- a/external/3rd/library/udplibrary/udpclient.cpp +++ b/external/3rd/library/udplibrary/udpclient.cpp @@ -106,7 +106,7 @@ int main(int argc, char **argv) printf("Connecting to: %s,%d.", connectIp, connectPort); UdpConnection *myConnection = myUdpManager->EstablishConnection(connectIp, connectPort); myConnection->SetHandler(&myConnectionHandler); - assert(myConnection != NULL); + assert(myConnection != nullptr); int count = 0; while (myConnection->GetStatus() == UdpConnection::cStatusNegotiating) { @@ -181,7 +181,7 @@ int main(int argc, char **argv) if (myConnection->TotalPendingBytes() == 0) { // send another packet - SimpleLogicalPacket *lp = new SimpleLogicalPacket(NULL, 30000000); + SimpleLogicalPacket *lp = new SimpleLogicalPacket(nullptr, 30000000); int dlen = lp->GetDataLen(); char *ptr = (char *)lp->GetDataPtr(); diff --git a/external/3rd/library/udplibrary/udpserver.cpp b/external/3rd/library/udplibrary/udpserver.cpp index c523a05b..c8641671 100755 --- a/external/3rd/library/udplibrary/udpserver.cpp +++ b/external/3rd/library/udplibrary/udpserver.cpp @@ -182,7 +182,7 @@ Player::~Player() { char hold[256]; printf("TERMINATE %s,%d \n", mConnection->GetDestinationIp().GetAddress(hold), mConnection->GetDestinationPort()); - mConnection->SetHandler(NULL); + mConnection->SetHandler(nullptr); mConnection->Disconnect(); mConnection->Release(); } diff --git a/external/ours/library/archive/src/shared/AutoDeltaVariableCallback.h b/external/ours/library/archive/src/shared/AutoDeltaVariableCallback.h index ef0cc7fa..34373722 100755 --- a/external/ours/library/archive/src/shared/AutoDeltaVariableCallback.h +++ b/external/ours/library/archive/src/shared/AutoDeltaVariableCallback.h @@ -186,7 +186,7 @@ inline void AutoDeltaVariableCallback::se ValueType const tmp = this->get(); AutoDeltaVariable::set(source); - if (sourceObject != NULL && tmp != source) + if (sourceObject != nullptr && tmp != source) callback.modified(*sourceObject, tmp, source, true); } diff --git a/external/ours/library/archive/src/shared/ByteStream.cpp b/external/ours/library/archive/src/shared/ByteStream.cpp index 2e19cb81..4965bc8c 100755 --- a/external/ours/library/archive/src/shared/ByteStream.cpp +++ b/external/ours/library/archive/src/shared/ByteStream.cpp @@ -20,7 +20,7 @@ namespace Archive { @brief ReadIterator ctor Initializes the read position to zero, and the ByteStream member value - is NULL + is nullptr */ ReadIterator::ReadIterator() : readPtr(0), diff --git a/external/ours/library/archive/src/shared/ByteStream.h b/external/ours/library/archive/src/shared/ByteStream.h index eda154d5..a94aeb36 100755 --- a/external/ours/library/archive/src/shared/ByteStream.h +++ b/external/ours/library/archive/src/shared/ByteStream.h @@ -261,7 +261,7 @@ inline void ReadIterator::get(void * target, const unsigned long int readSize) } else { - static const char * const desc = "Archive::ReadIterator::get - read operation on null stream object"; + static const char * const desc = "Archive::ReadIterator::get - read operation on nullptr stream object"; ReadException ex(desc); throw (ex); } diff --git a/external/ours/library/crypto/src/shared/original/cryptlib.h b/external/ours/library/crypto/src/shared/original/cryptlib.h index dbbc7fa7..fd258706 100755 --- a/external/ours/library/crypto/src/shared/original/cryptlib.h +++ b/external/ours/library/crypto/src/shared/original/cryptlib.h @@ -440,7 +440,7 @@ public: //@{ //! returns whether this object allows attachment virtual bool Attachable() {return false;} - //! returns the object immediately attached to this object or NULL for no attachment + //! returns the object immediately attached to this object or nullptr for no attachment virtual BufferedTransformation *AttachedTransformation() {return 0;} //! virtual const BufferedTransformation *AttachedTransformation() const diff --git a/external/ours/library/crypto/src/shared/original/filters.cpp b/external/ours/library/crypto/src/shared/original/filters.cpp index 7caaf21d..852a7b7f 100755 --- a/external/ours/library/crypto/src/shared/original/filters.cpp +++ b/external/ours/library/crypto/src/shared/original/filters.cpp @@ -55,7 +55,7 @@ const byte *FilterWithBufferedInput::BlockQueue::GetBlock() return ptr; } else - return NULL; + return nullptr; } const byte *FilterWithBufferedInput::BlockQueue::GetContigousBlocks(unsigned int &numberOfBlocks) @@ -175,7 +175,7 @@ void FilterWithBufferedInput::Put(const byte *inString, unsigned int length) void FilterWithBufferedInput::MessageEnd(int propagation) { if (!m_firstInputDone && m_firstSize==0) - FirstPut(NULL); + FirstPut(nullptr); SecByteBlock temp(m_queue.CurrentSize()); m_queue.GetAll(temp); @@ -200,7 +200,7 @@ void FilterWithBufferedInput::ForceNextPut() // ************************************************************* ProxyFilter::ProxyFilter(Filter *filter, unsigned int firstSize, unsigned int lastSize, BufferedTransformation *outQ) - : FilterWithBufferedInput(firstSize, 1, lastSize, outQ), m_filter(filter), m_proxy(NULL) + : FilterWithBufferedInput(firstSize, 1, lastSize, outQ), m_filter(filter), m_proxy(nullptr) { if (m_filter.get()) m_filter->Attach(m_proxy = new OutputProxy(*this, false)); @@ -229,7 +229,7 @@ void ProxyFilter::SetFilter(Filter *filter) m_filter->Attach(temp.release()); } else - m_proxy=NULL; + m_proxy=nullptr; } void ProxyFilter::NextPut(const byte *s, unsigned int len) diff --git a/external/ours/library/crypto/src/shared/original/filters.h b/external/ours/library/crypto/src/shared/original/filters.h index 6a2f0389..b80c518a 100755 --- a/external/ours/library/crypto/src/shared/original/filters.h +++ b/external/ours/library/crypto/src/shared/original/filters.h @@ -17,7 +17,7 @@ public: bool Attachable() {return true;} BufferedTransformation *AttachedTransformation() {return m_outQueue.get();} const BufferedTransformation *AttachedTransformation() const {return m_outQueue.get();} - void Detach(BufferedTransformation *newOut = NULL); + void Detach(BufferedTransformation *newOut = nullptr); protected: virtual void NotifyAttachmentChange() {} @@ -33,7 +33,7 @@ private: class TransparentFilter : public Filter { public: - TransparentFilter(BufferedTransformation *outQ=NULL) : Filter(outQ) {} + TransparentFilter(BufferedTransformation *outQ=nullptr) : Filter(outQ) {} void Put(byte inByte) {AttachedTransformation()->Put(inByte);} void Put(const byte *inString, unsigned int length) {AttachedTransformation()->Put(inString, length);} }; @@ -42,7 +42,7 @@ public: class OpaqueFilter : public Filter { public: - OpaqueFilter(BufferedTransformation *outQ=NULL) : Filter(outQ) {} + OpaqueFilter(BufferedTransformation *outQ=nullptr) : Filter(outQ) {} void Put(byte inByte) {} void Put(const byte *inString, unsigned int length) {} }; @@ -122,7 +122,7 @@ class StreamCipherFilter : public Filter { public: StreamCipherFilter(StreamCipher &c, - BufferedTransformation *outQueue = NULL) + BufferedTransformation *outQueue = nullptr) : cipher(c), Filter(outQueue) {} void Put(byte inByte) @@ -138,7 +138,7 @@ private: class HashFilter : public Filter { public: - HashFilter(HashModule &hm, BufferedTransformation *outQueue = NULL, bool putMessage=false) + HashFilter(HashModule &hm, BufferedTransformation *outQueue = nullptr, bool putMessage=false) : Filter(outQueue), m_hashModule(hm), m_putMessage(putMessage) {} void MessageEnd(int propagation=-1); @@ -163,7 +163,7 @@ public: }; enum Flags {HASH_AT_BEGIN=1, PUT_MESSAGE=2, PUT_HASH=4, PUT_RESULT=8, THROW_EXCEPTION=16}; - HashVerifier(HashModule &hm, BufferedTransformation *outQueue = NULL, word32 flags = HASH_AT_BEGIN | PUT_RESULT); + HashVerifier(HashModule &hm, BufferedTransformation *outQueue = nullptr, word32 flags = HASH_AT_BEGIN | PUT_RESULT); bool GetLastResult() const {return m_verified;} @@ -183,7 +183,7 @@ private: class SignerFilter : public Filter { public: - SignerFilter(RandomNumberGenerator &rng, const PK_Signer &signer, BufferedTransformation *outQueue = NULL) + SignerFilter(RandomNumberGenerator &rng, const PK_Signer &signer, BufferedTransformation *outQueue = nullptr) : m_rng(rng), m_signer(signer), m_messageAccumulator(signer.NewMessageAccumulator()), Filter(outQueue) {} void MessageEnd(int propagation); @@ -204,7 +204,7 @@ private: class VerifierFilter : public Filter { public: - VerifierFilter(const PK_Verifier &verifier, BufferedTransformation *outQueue = NULL) + VerifierFilter(const PK_Verifier &verifier, BufferedTransformation *outQueue = nullptr) : m_verifier(verifier), m_messageAccumulator(verifier.NewMessageAccumulator()) , m_signature(verifier.SignatureLength()), Filter(outQueue) {} @@ -244,11 +244,11 @@ extern BitBucket g_bitBucket; class Redirector : public Sink { public: - Redirector() : m_target(NULL), m_passSignal(true) {} + Redirector() : m_target(nullptr), m_passSignal(true) {} Redirector(BufferedTransformation &target, bool passSignal=true) : m_target(&target), m_passSignal(passSignal) {} void Redirect(BufferedTransformation &target) {m_target = ⌖} - void StopRedirect() {m_target = NULL;} + void StopRedirect() {m_target = nullptr;} bool GetPassSignal() const {return m_passSignal;} void SetPassSignal(bool passSignal) {m_passSignal = passSignal;} @@ -498,7 +498,7 @@ public: class GeneralSource : public Source { public: - GeneralSource(BufferedTransformation &store, bool pumpAll, BufferedTransformation *outQueue = NULL) + GeneralSource(BufferedTransformation &store, bool pumpAll, BufferedTransformation *outQueue = nullptr) : Source(outQueue), m_store(store) { if (pumpAll) PumpAll(); @@ -517,13 +517,13 @@ private: class StringSource : public Source { public: - StringSource(const char *string, bool pumpAll, BufferedTransformation *outQueue = NULL); - StringSource(const byte *string, unsigned int length, bool pumpAll, BufferedTransformation *outQueue = NULL); + StringSource(const char *string, bool pumpAll, BufferedTransformation *outQueue = nullptr); + StringSource(const byte *string, unsigned int length, bool pumpAll, BufferedTransformation *outQueue = nullptr); #ifdef __MWERKS__ // CW60 workaround - StringSource(const std::string &string, bool pumpAll, BufferedTransformation *outQueue = NULL) + StringSource(const std::string &string, bool pumpAll, BufferedTransformation *outQueue = nullptr) #else - template StringSource(const T &string, bool pumpAll, BufferedTransformation *outQueue = NULL) + template StringSource(const T &string, bool pumpAll, BufferedTransformation *outQueue = nullptr) #endif : Source(outQueue), m_store(string) { @@ -544,7 +544,7 @@ private: class RandomNumberSource : public Source { public: - RandomNumberSource(RandomNumberGenerator &rng, unsigned int length, bool pumpAll, BufferedTransformation *outQueue = NULL); + RandomNumberSource(RandomNumberGenerator &rng, unsigned int length, bool pumpAll, BufferedTransformation *outQueue = nullptr); unsigned long Pump(unsigned long pumpMax=ULONG_MAX) {return m_store.TransferTo(*AttachedTransformation(), pumpMax);} diff --git a/external/ours/library/crypto/src/shared/original/queue.cpp b/external/ours/library/crypto/src/shared/original/queue.cpp index b18c2b4a..2fb3250a 100755 --- a/external/ours/library/crypto/src/shared/original/queue.cpp +++ b/external/ours/library/crypto/src/shared/original/queue.cpp @@ -152,7 +152,7 @@ void ByteQueue::CopyFrom(const ByteQueue ©) m_tail = m_tail->next; } - m_tail->next = NULL; + m_tail->next = nullptr; Put(copy.m_lazyString, copy.m_lazyLength); } diff --git a/external/ours/library/crypto/src/shared/original/smartptr.h b/external/ours/library/crypto/src/shared/original/smartptr.h index 6a0595a1..f5c0b41b 100755 --- a/external/ours/library/crypto/src/shared/original/smartptr.h +++ b/external/ours/library/crypto/src/shared/original/smartptr.h @@ -9,7 +9,7 @@ NAMESPACE_BEGIN(CryptoPP) template class member_ptr { public: - explicit member_ptr(T *p = NULL) : m_p(p) {} + explicit member_ptr(T *p = nullptr) : m_p(p) {} ~member_ptr(); @@ -47,9 +47,9 @@ template class value_ptr : public member_ptr { public: value_ptr(const T &obj) : member_ptr(new T(obj)) {} - value_ptr(T *p = NULL) : member_ptr(p) {} + value_ptr(T *p = nullptr) : member_ptr(p) {} value_ptr(const value_ptr& rhs) - : member_ptr(rhs.m_p ? new T(*rhs.m_p) : NULL) {} + : member_ptr(rhs.m_p ? new T(*rhs.m_p) : nullptr) {} value_ptr& operator=(const value_ptr& rhs); bool operator==(const value_ptr& rhs) @@ -61,7 +61,7 @@ public: template value_ptr& value_ptr::operator=(const value_ptr& rhs) { T *old_p = this->m_p; - this->m_p = rhs.m_p ? new T(*rhs.m_p) : NULL; + this->m_p = rhs.m_p ? new T(*rhs.m_p) : nullptr; delete old_p; return *this; } @@ -72,9 +72,9 @@ template class clonable_ptr : public member_ptr { public: clonable_ptr(const T &obj) : member_ptr(obj.Clone()) {} - clonable_ptr(T *p = NULL) : member_ptr(p) {} + clonable_ptr(T *p = nullptr) : member_ptr(p) {} clonable_ptr(const clonable_ptr& rhs) - : member_ptr(rhs.m_p ? rhs.m_p->Clone() : NULL) {} + : member_ptr(rhs.m_p ? rhs.m_p->Clone() : nullptr) {} clonable_ptr& operator=(const clonable_ptr& rhs); }; @@ -82,7 +82,7 @@ public: template clonable_ptr& clonable_ptr::operator=(const clonable_ptr& rhs) { T *old_p = this->m_p; - this->m_p = rhs.m_p ? rhs.m_p->Clone() : NULL; + this->m_p = rhs.m_p ? rhs.m_p->Clone() : nullptr; delete old_p; return *this; } @@ -184,8 +184,8 @@ template class ConstructorTemp { protected: - ConstructorTemp(const ConstructorTemp ©) : m_temp(NULL) {} - ConstructorTemp(T *t = NULL) : m_temp(t) {} + ConstructorTemp(const ConstructorTemp ©) : m_temp(nullptr) {} + ConstructorTemp(T *t = nullptr) : m_temp(t) {} ConstructorTemp(const T &t) : m_temp(new T(t)) {} member_ptr m_temp; }; diff --git a/external/ours/library/crypto/src/shared/wrapper/TwofishCrypt.cpp b/external/ours/library/crypto/src/shared/wrapper/TwofishCrypt.cpp index 0a88c460..9a272ae3 100755 --- a/external/ours/library/crypto/src/shared/wrapper/TwofishCrypt.cpp +++ b/external/ours/library/crypto/src/shared/wrapper/TwofishCrypt.cpp @@ -84,7 +84,7 @@ void TwofishCrypt::process(const unsigned char * const inputBuffer, unsigned cha } assert( r == 0 ); // size must be a 16 byte block for Twofish to do it's job! } - assert(cipher != NULL); // can't process data without a twofish encryptor or decryptor! + assert(cipher != nullptr); // can't process data without a twofish encryptor or decryptor! } //----------------------------------------------------------------------- diff --git a/external/ours/library/fileInterface/src/shared/AbstractFile.cpp b/external/ours/library/fileInterface/src/shared/AbstractFile.cpp index dd575c36..ef76c7cf 100755 --- a/external/ours/library/fileInterface/src/shared/AbstractFile.cpp +++ b/external/ours/library/fileInterface/src/shared/AbstractFile.cpp @@ -15,7 +15,7 @@ namespace AbstractFileNamespace { - AbstractFile::AudioServeFunction s_audioServeFunction = NULL; + AbstractFile::AudioServeFunction s_audioServeFunction = nullptr; } using namespace AbstractFileNamespace; @@ -51,7 +51,7 @@ void AbstractFile::flush() byte *AbstractFile::readEntireFileAndClose() { - if (s_audioServeFunction != NULL) + if (s_audioServeFunction != nullptr) (*s_audioServeFunction)(); seek(SeekBegin, 0); @@ -84,7 +84,7 @@ int AbstractFile::getZlibCompressedLength() const void AbstractFile::getZlibCompressedDataAndClose(byte *& compressedBuffer, int & compressedBufferLength) { - compressedBuffer = NULL; + compressedBuffer = nullptr; compressedBufferLength = -1; } diff --git a/external/ours/library/fileInterface/src/shared/AbstractFile.h b/external/ours/library/fileInterface/src/shared/AbstractFile.h index 0f649d1e..62c4f804 100755 --- a/external/ours/library/fileInterface/src/shared/AbstractFile.h +++ b/external/ours/library/fileInterface/src/shared/AbstractFile.h @@ -110,7 +110,7 @@ public: * Read the entire file into a memory buffer. The client is responsible for deleting the buffer * using operator delete(). The file will be closed after the read completes. * - * @return null if an error occured + * @return nullptr if an error occured */ virtual unsigned char *readEntireFileAndClose(); diff --git a/external/ours/library/fileInterface/src/shared/StdioFile.cpp b/external/ours/library/fileInterface/src/shared/StdioFile.cpp index 1e7225ed..bb890dfa 100755 --- a/external/ours/library/fileInterface/src/shared/StdioFile.cpp +++ b/external/ours/library/fileInterface/src/shared/StdioFile.cpp @@ -35,7 +35,7 @@ void StdioFile::close() if(m_file) { fclose(m_file); - m_file = NULL; + m_file = nullptr; } } @@ -43,7 +43,7 @@ void StdioFile::close() bool StdioFile::isOpen() const { - return m_file != NULL; + return m_file != nullptr; } // ---------------------------------------------------------------------- @@ -71,7 +71,7 @@ int StdioFile::tell() const bool StdioFile::seek(SeekType seekType, int offset) { - assert(m_file != NULL); + assert(m_file != nullptr); m_justWrote = false; int result = 0; @@ -97,7 +97,7 @@ bool StdioFile::seek(SeekType seekType, int offset) int StdioFile::read(void* dest_buffer, int num_bytes) { - assert(m_file != NULL); + assert(m_file != nullptr); resyncStream(); return static_cast(fread(dest_buffer, 1, static_cast(num_bytes), m_file)); } @@ -106,7 +106,7 @@ int StdioFile::read(void* dest_buffer, int num_bytes) int StdioFile::write(int num_bytes, const void* source_buffer) { - assert(m_file != NULL); + assert(m_file != nullptr); m_justWrote = true; return static_cast(fwrite(source_buffer, 1, static_cast(num_bytes), m_file)); } @@ -115,7 +115,7 @@ int StdioFile::write(int num_bytes, const void* source_buffer) void StdioFile::flush() { - assert(m_file != NULL); + assert(m_file != nullptr); fflush(m_file); m_justWrote = false; } @@ -136,9 +136,9 @@ void StdioFile::resyncStream() AbstractFile* StdioFileFactory::createFile(const char *fileName, const char *openType) { if(!fileName || !openType) - return NULL; + return nullptr; else if (fileName[0] == '\0' || openType[0] == '\0') - return NULL; + return nullptr; else return new StdioFile(fileName, openType); } diff --git a/external/ours/library/localization/src/shared/LocalizationManager.cpp b/external/ours/library/localization/src/shared/LocalizationManager.cpp index 518bf42b..e7b106ca 100755 --- a/external/ours/library/localization/src/shared/LocalizationManager.cpp +++ b/external/ours/library/localization/src/shared/LocalizationManager.cpp @@ -77,8 +77,8 @@ using namespace LocalizationManagerNamespace; //---------------------------------------------------------------------- bool LocalizationManager::ms_installed = 0; -LocalizationManager::LocalizationManagerHashMap * LocalizationManager::ms_singletonHashMap = NULL; -Unicode::NarrowString * LocalizationManager::ms_firstLocaleLoaded = NULL; +LocalizationManager::LocalizationManagerHashMap * LocalizationManager::ms_singletonHashMap = nullptr; +Unicode::NarrowString * LocalizationManager::ms_firstLocaleLoaded = nullptr; //----------------------------------------------------------------- @@ -103,7 +103,7 @@ m_displayBadStringIds (displayBadStringIds) m_usingEnglishLocale = false; } - assert (m_fileFactory != NULL);//lint !e1924 // c-style cast. MSVC bug + assert (m_fileFactory != nullptr);//lint !e1924 // c-style cast. MSVC bug } //----------------------------------------------------------------- @@ -181,23 +181,23 @@ void LocalizationManager::install (AbstractFileFactory * fileFactory, Unicode::U void LocalizationManager::remove () { assert (ms_installed);//lint !e1924 // c-style cast. MSVC bug - assert (ms_singletonHashMap != NULL);//lint !e1924 // c-style cast. MSVC bug - assert (ms_firstLocaleLoaded != NULL); + assert (ms_singletonHashMap != nullptr);//lint !e1924 // c-style cast. MSVC bug + assert (ms_firstLocaleLoaded != nullptr); LocalizationManagerHashMap::iterator end = ms_singletonHashMap->end(); for (LocalizationManagerHashMap::iterator it = ms_singletonHashMap->begin(); it != end; ++it) { LocalizationManager * current = (*it).second; - (*it).second = NULL; + (*it).second = nullptr; delete current; } ms_singletonHashMap->clear(); delete ms_singletonHashMap; - ms_singletonHashMap = NULL; + ms_singletonHashMap = nullptr; delete ms_firstLocaleLoaded; - ms_firstLocaleLoaded = NULL; + ms_firstLocaleLoaded = nullptr; ms_installed = false; } @@ -277,7 +277,7 @@ LocalizedStringTable * LocalizationManager::fetchStringTable(const Unicode::Narr if(find_iter != stmap.end ()) { TimedStringTable & tst = (*find_iter).second; - //-- this can be null + //-- this can be nullptr table = tst.second; tst.first = time(0); } diff --git a/external/ours/library/localization/src/shared/LocalizedString.cpp b/external/ours/library/localization/src/shared/LocalizedString.cpp index 88817b83..de996f95 100755 --- a/external/ours/library/localization/src/shared/LocalizedString.cpp +++ b/external/ours/library/localization/src/shared/LocalizedString.cpp @@ -193,10 +193,10 @@ LocalizedString * LocalizedString::load_0000 (AbstractFile & fl) if (!fl.read (&buflen, sizeof (id_type))) return 0; - // buflen does not include null terminator + // buflen does not include nullptr terminator Unicode::unicode_char_t * buf = new Unicode::unicode_char_t [buflen+1]; - assert (buf != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (buf != nullptr); //lint !e1924 // c-style cast. MSVC bug buf [buflen] = 0; @@ -214,7 +214,7 @@ LocalizedString * LocalizedString::load_0000 (AbstractFile & fl) // TODO: Localized strings are stored little endian! loc_str = new LocalizedString(id, buf); - assert (loc_str != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (loc_str != nullptr); //lint !e1924 // c-style cast. MSVC bug loc_str->resetLineCounts (); @@ -247,10 +247,10 @@ LocalizedString * LocalizedString::load_0001 (AbstractFile & fl) if (!fl.read (&buflen, sizeof (id_type))) return 0; - // buflen does not include null terminator + // buflen does not include nullptr terminator Unicode::unicode_char_t * buf = new Unicode::unicode_char_t [buflen+1]; - assert (buf != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (buf != nullptr); //lint !e1924 // c-style cast. MSVC bug buf [buflen] = 0; @@ -268,7 +268,7 @@ LocalizedString * LocalizedString::load_0001 (AbstractFile & fl) // TODO: Localized strings are stored little endian! loc_str = new LocalizedString(id, crcSource, buf); - assert (loc_str != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (loc_str != nullptr); //lint !e1924 // c-style cast. MSVC bug loc_str->resetLineCounts (); diff --git a/external/ours/library/localization/src/shared/LocalizedStringTable.cpp b/external/ours/library/localization/src/shared/LocalizedStringTable.cpp index 10ab6c60..e0519d6e 100755 --- a/external/ours/library/localization/src/shared/LocalizedStringTable.cpp +++ b/external/ours/library/localization/src/shared/LocalizedStringTable.cpp @@ -187,10 +187,10 @@ bool LocalizedStringTable::load_0000 (AbstractFile & fl) if (!fl.read (&buflen, sizeof (LocalizedString::id_type))) return false; - // buflen does not include null terminator + // buflen does not include nullptr terminator char * buf = new char [buflen+1]; - assert (buf != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (buf != nullptr); //lint !e1924 // c-style cast. MSVC bug buf [buflen] = 0; @@ -276,10 +276,10 @@ bool LocalizedStringTable::load_0001(AbstractFile & fl) if (!fl.read (&buflen, sizeof (LocalizedString::id_type))) return false; - // buflen does not include null terminator + // buflen does not include nullptr terminator char * buf = new char [buflen+1]; - assert (buf != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (buf != nullptr); //lint !e1924 // c-style cast. MSVC bug buf [buflen] = 0; @@ -333,7 +333,7 @@ LocalizedStringTable *LocalizedStringTable::load (AbstractFileFactory & fileFact { case 0: table = new LocalizedStringTable (filename); - assert (table != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (table != nullptr); //lint !e1924 // c-style cast. MSVC bug if (table->load_0000 (*fl) == false) { @@ -344,7 +344,7 @@ LocalizedStringTable *LocalizedStringTable::load (AbstractFileFactory & fileFact case 1: table = new LocalizedStringTable (filename); - assert (table != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (table != nullptr); //lint !e1924 // c-style cast. MSVC bug if (table->load_0001 (*fl) == false) { diff --git a/external/ours/library/localization/src/shared/LocalizedStringTableReaderWriter.cpp b/external/ours/library/localization/src/shared/LocalizedStringTableReaderWriter.cpp index 19e95784..e7dfbf27 100755 --- a/external/ours/library/localization/src/shared/LocalizedStringTableReaderWriter.cpp +++ b/external/ours/library/localization/src/shared/LocalizedStringTableReaderWriter.cpp @@ -126,7 +126,7 @@ bool LocalizedStringTableRW::str_write(AbstractFile & fl, LocalizedString & locs // TODO: swab this buffer Unicode::unicode_char_t * buf = new Unicode::unicode_char_t [buflen+1]; - assert (buf != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (buf != nullptr); //lint !e1924 // c-style cast. MSVC bug buf [buflen] = 0; memcpy (buf, locstr.m_str.c_str (), sizeof (Unicode::unicode_char_t) * buflen); @@ -183,7 +183,7 @@ bool LocalizedStringTableRW::write(AbstractFile & fl) const char * buf = new char [buflen + 1]; - assert (buf != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (buf != nullptr); //lint !e1924 // c-style cast. MSVC bug buf [buflen] = 0; @@ -230,7 +230,7 @@ LocalizedStringTableRW *LocalizedStringTableRW::loadRW (AbstractFileFactory & fi { case 0: table = new LocalizedStringTableRW (filename); - assert (table != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (table != nullptr); //lint !e1924 // c-style cast. MSVC bug if (table->load_0000 (*fl) == false) { @@ -241,7 +241,7 @@ LocalizedStringTableRW *LocalizedStringTableRW::loadRW (AbstractFileFactory & fi case 1: table = new LocalizedStringTableRW (filename); - assert (table != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (table != nullptr); //lint !e1924 // c-style cast. MSVC bug if (table->load_0001 (*fl) == false) { @@ -336,7 +336,7 @@ LocalizedString * LocalizedStringTableRW::addString (const Unicode::String & st { LocalizedString * const locstr = (m_map [m_nextUniqueId] = new LocalizedString (m_nextUniqueId, int(time(0)), str)); - assert (locstr != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (locstr != nullptr); //lint !e1924 // c-style cast. MSVC bug char buf[64]; sprintf (buf, "%03ld_default", m_nextUniqueId); @@ -538,7 +538,7 @@ void LocalizedStringTableRW::prepareTable (const LocalizedStringTableRW & rhs) LocalizedString * locstr = new LocalizedString (rhs_locstr->m_id, 0, rhs_locstr->m_str); - assert (locstr != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (locstr != nullptr); //lint !e1924 // c-style cast. MSVC bug m_map.insert (Map_t::value_type (locstr->getId (), locstr )); } } diff --git a/external/ours/library/singleton/src/shared/Singleton2.h b/external/ours/library/singleton/src/shared/Singleton2.h index 130d0cd7..1b42905d 100755 --- a/external/ours/library/singleton/src/shared/Singleton2.h +++ b/external/ours/library/singleton/src/shared/Singleton2.h @@ -138,7 +138,7 @@ inline Singleton2::Singleton2() template inline Singleton2::~Singleton2() { - assert(instance != NULL); + assert(instance != nullptr); instance = 0; } @@ -165,7 +165,7 @@ inline Singleton2::~Singleton2() template inline ValueType & Singleton2::getInstance() { - assert(instance != NULL); + assert(instance != nullptr); return *instance; } diff --git a/external/ours/library/unicode/src/shared/UnicodeCharacterDataMap.cpp b/external/ours/library/unicode/src/shared/UnicodeCharacterDataMap.cpp index 3f67e74a..6206b680 100755 --- a/external/ours/library/unicode/src/shared/UnicodeCharacterDataMap.cpp +++ b/external/ours/library/unicode/src/shared/UnicodeCharacterDataMap.cpp @@ -218,7 +218,7 @@ CharDataMap::ErrorCode CharDataMap::generateMapFromBuffer (const Unicode::Blocks { CharData * data = new CharData; - assert (data != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (data != nullptr); //lint !e1924 // c-style cast. MSVC bug data->m_reverseCase = 0; @@ -244,7 +244,7 @@ CharDataMap::ErrorCode CharDataMap::generateMapFromBuffer (const Unicode::Blocks m_contiguousData = new CharData [validChars]; - assert (m_contiguousData != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (m_contiguousData != nullptr); //lint !e1924 // c-style cast. MSVC bug size_t dataIndex = 0; @@ -288,7 +288,7 @@ CharDataMap::ErrorCode CharDataMap::generateMap (const Unicode::Blocks::Mapping char * buffer = new char [fileLen + 1]; buffer [fileLen] = 0; - assert (buffer != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (buffer != nullptr); //lint !e1924 // c-style cast. MSVC bug if (fread (buffer, fileLen, 1, fl) != 1) { diff --git a/external/ours/library/unicode/src/shared/UnicodeCharacterDataMap.h b/external/ours/library/unicode/src/shared/UnicodeCharacterDataMap.h index ba84cac2..7659b543 100755 --- a/external/ours/library/unicode/src/shared/UnicodeCharacterDataMap.h +++ b/external/ours/library/unicode/src/shared/UnicodeCharacterDataMap.h @@ -117,7 +117,7 @@ namespace Unicode /** * Find a CharData for the given code point. - * @return null if no CharData exists for this code point + * @return nullptr if no CharData exists for this code point */ inline const CharData * CharDataMap::findCharData (const unicode_char_t code) const diff --git a/external/ours/library/unicode/src/shared/UnicodeUtils.cpp b/external/ours/library/unicode/src/shared/UnicodeUtils.cpp index 4417fc0c..7bf90e7d 100755 --- a/external/ours/library/unicode/src/shared/UnicodeUtils.cpp +++ b/external/ours/library/unicode/src/shared/UnicodeUtils.cpp @@ -103,7 +103,7 @@ namespace Unicode } else if (*from == 0x0000) { - // null character + // nullptr character str += static_cast(0x0000); } else if (*from >= 0x0800) diff --git a/external/ours/library/unicode/src/shared/UnicodeUtils.h b/external/ours/library/unicode/src/shared/UnicodeUtils.h index f2a722ae..348bb64f 100755 --- a/external/ours/library/unicode/src/shared/UnicodeUtils.h +++ b/external/ours/library/unicode/src/shared/UnicodeUtils.h @@ -79,8 +79,8 @@ namespace Unicode bool getNthToken (const Unicode::NarrowString & str, const size_t n, size_t & pos, size_t & endpos, Unicode::NarrowString & token, const char * sepChars = ascii_whitespace); size_t skipWhitespace (const Unicode::NarrowString & str, size_t pos, const char * white = ascii_whitespace); - bool tokenize (const Unicode::String & theStr, UnicodeStringVector & result, Unicode::String const * const delimiters = NULL, Unicode::String const * const separators = NULL); - bool tokenize (const Unicode::String & theStr, UnicodeStringVector & result, const size_t tokenPos, size_t & whichToken, size_t & token_start, size_t & token_end, Unicode::String const * const delimiters = NULL, Unicode::String const * const separators = NULL); + bool tokenize (const Unicode::String & theStr, UnicodeStringVector & result, Unicode::String const * const delimiters = nullptr, Unicode::String const * const separators = nullptr); + bool tokenize (const Unicode::String & theStr, UnicodeStringVector & result, const size_t tokenPos, size_t & whichToken, size_t & token_start, size_t & token_end, Unicode::String const * const delimiters = nullptr, Unicode::String const * const separators = nullptr); bool isUnicode (const Unicode::String & theStr); diff --git a/external/ours/library/unicode/src/shared/utf8.cpp b/external/ours/library/unicode/src/shared/utf8.cpp index 75901043..3a19d82a 100755 --- a/external/ours/library/unicode/src/shared/utf8.cpp +++ b/external/ours/library/unicode/src/shared/utf8.cpp @@ -96,7 +96,7 @@ int UTF8_convertCharToUTF16( char * ptr , UTF16 * ret ) int UTF8_convertToUTF16( char * ptr , UTF16 * ret, int limit ) { int len = 0; - while (( *ptr != 0 ) && ( len < ( limit - 1 ) ))//we use limit -1 to leave room for the null terminator + while (( *ptr != 0 ) && ( len < ( limit - 1 ) ))//we use limit -1 to leave room for the nullptr terminator { int clen = UTF8_convertCharToUTF16( ptr, ret ); if (clen == 0) diff --git a/game/server/application/SwgDatabaseServer/src/linux/main.cpp b/game/server/application/SwgDatabaseServer/src/linux/main.cpp index 9878eed1..71cc11b2 100755 --- a/game/server/application/SwgDatabaseServer/src/linux/main.cpp +++ b/game/server/application/SwgDatabaseServer/src/linux/main.cpp @@ -43,7 +43,7 @@ int main(int argc, char ** argv) SetupSharedFoundation::install (setupFoundationData); SetupSharedFile::install(false); - SetupSharedRandom::install(time(NULL)); + SetupSharedRandom::install(time(nullptr)); SetupSharedNetwork::SetupData networkSetupData; SetupSharedNetwork::getDefaultServerSetupData(networkSetupData); SetupSharedNetwork::install(networkSetupData); diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/AuctionLocationsBuffer.cpp b/game/server/application/SwgDatabaseServer/src/shared/buffers/AuctionLocationsBuffer.cpp index c0baa227..ec5603db 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/AuctionLocationsBuffer.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/buffers/AuctionLocationsBuffer.cpp @@ -30,7 +30,7 @@ AuctionLocationsBuffer::~AuctionLocationsBuffer(void) for (IndexType::iterator i=m_rows.begin(); i!=m_rows.end(); ++i) { delete i->second; - i->second=NULL; + i->second=nullptr; } } @@ -56,7 +56,7 @@ void AuctionLocationsBuffer::removeAuctionLocations(const NetworkId &locationId) if (i!=m_rows.end()) { delete i->second; - i->second=NULL; + i->second=nullptr; m_rows.erase(i); } } diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/BattlefieldParticipantBuffer.cpp b/game/server/application/SwgDatabaseServer/src/shared/buffers/BattlefieldParticipantBuffer.cpp index 7abc8164..41038e8a 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/BattlefieldParticipantBuffer.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/buffers/BattlefieldParticipantBuffer.cpp @@ -30,7 +30,7 @@ BattlefieldParticipantBuffer::~BattlefieldParticipantBuffer(void) for (IndexType::iterator i=m_rows.begin(); i!=m_rows.end(); ++i) { delete i->second; - i->second=NULL; + i->second=nullptr; } } @@ -156,7 +156,7 @@ void BattlefieldParticipantBuffer::removeObject(const NetworkId &object) IndexType::iterator next=i; ++next; delete i->second; - i->second=NULL; + i->second=nullptr; m_rows.erase(i); i=next; } diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/BountyHunterTargetBuffer.cpp b/game/server/application/SwgDatabaseServer/src/shared/buffers/BountyHunterTargetBuffer.cpp index 4098e2c3..16d361fe 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/BountyHunterTargetBuffer.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/buffers/BountyHunterTargetBuffer.cpp @@ -31,7 +31,7 @@ BountyHunterTargetBuffer::~BountyHunterTargetBuffer() for (DataType::iterator i=m_data.begin(); i!=m_data.end(); ++i) { delete i->second; - i->second=NULL; + i->second=nullptr; } } diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/CreatureObjectBuffer.cpp b/game/server/application/SwgDatabaseServer/src/shared/buffers/CreatureObjectBuffer.cpp index 10556590..92dcbbfd 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/CreatureObjectBuffer.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/buffers/CreatureObjectBuffer.cpp @@ -238,7 +238,7 @@ void CreatureObjectBuffer::getAttributesForObject(const NetworkId &objectId, std } if (value == -999) { - WARNING(true,("Object %s had null attribute %i, defaulting to 100",objectId.getValueString().c_str(), position)); + WARNING(true,("Object %s had nullptr attribute %i, defaulting to 100",objectId.getValueString().c_str(), position)); value = 100; } diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/ExperienceBuffer.cpp b/game/server/application/SwgDatabaseServer/src/shared/buffers/ExperienceBuffer.cpp index 5c361b16..ffd4068f 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/ExperienceBuffer.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/buffers/ExperienceBuffer.cpp @@ -31,7 +31,7 @@ ExperienceBuffer::~ExperienceBuffer(void) for (IndexType::iterator i=m_rows.begin(); i!=m_rows.end(); ++i) { delete i->second; - i->second=NULL; + i->second=nullptr; } } @@ -157,7 +157,7 @@ void ExperienceBuffer::removeObject(const NetworkId &object) IndexType::iterator next=i; ++next; delete i->second; - i->second=NULL; + i->second=nullptr; m_rows.erase(i); i=next; } diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/IndexedNetworkTableBuffer.h b/game/server/application/SwgDatabaseServer/src/shared/buffers/IndexedNetworkTableBuffer.h index 5180b92a..65ba2205 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/IndexedNetworkTableBuffer.h +++ b/game/server/application/SwgDatabaseServer/src/shared/buffers/IndexedNetworkTableBuffer.h @@ -103,7 +103,7 @@ IndexedNetworkTableBuffer::~IndexedNetworkTable { delete i->second; ++m_sRowsDeleted; - i->second=NULL; + i->second=nullptr; } } @@ -161,7 +161,7 @@ void IndexedNetworkTableBuffer::removeObject(co { delete i->second; ++m_sRowsDeleted; - i->second=NULL; + i->second=nullptr; m_rows.erase(i); } } diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/ManufactureSchematicAttributeBuffer.cpp b/game/server/application/SwgDatabaseServer/src/shared/buffers/ManufactureSchematicAttributeBuffer.cpp index 12c4e790..487169ef 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/ManufactureSchematicAttributeBuffer.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/buffers/ManufactureSchematicAttributeBuffer.cpp @@ -31,7 +31,7 @@ ManufactureSchematicAttributeBuffer::~ManufactureSchematicAttributeBuffer(void) for (IndexType::iterator i=m_rows.begin(); i!=m_rows.end(); ++i) { delete i->second; - i->second=NULL; + i->second=nullptr; } } @@ -174,7 +174,7 @@ void ManufactureSchematicAttributeBuffer::removeObject(const NetworkId &object) IndexType::iterator next=i; ++next; delete i->second; - i->second=NULL; + i->second=nullptr; m_rows.erase(i); i=next; } diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/MarketAuctionBidsBuffer.cpp b/game/server/application/SwgDatabaseServer/src/shared/buffers/MarketAuctionBidsBuffer.cpp index 3a024651..65d95c48 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/MarketAuctionBidsBuffer.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/buffers/MarketAuctionBidsBuffer.cpp @@ -31,7 +31,7 @@ MarketAuctionBidsBuffer::~MarketAuctionBidsBuffer(void) for (IndexType::iterator i=m_rows.begin(); i!=m_rows.end(); ++i) { delete i->second; - i->second=NULL; + i->second=nullptr; } } @@ -57,7 +57,7 @@ void MarketAuctionBidsBuffer::removeMarketAuctionBids(const NetworkId &itemId) if (i!=m_rows.end()) { delete i->second; - i->second=NULL; + i->second=nullptr; m_rows.erase(i); } } diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/MarketAuctionsBuffer.cpp b/game/server/application/SwgDatabaseServer/src/shared/buffers/MarketAuctionsBuffer.cpp index 8663d1ef..b8529107 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/MarketAuctionsBuffer.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/buffers/MarketAuctionsBuffer.cpp @@ -31,7 +31,7 @@ MarketAuctionsBufferCreate::~MarketAuctionsBufferCreate(void) for (IndexType::iterator i=m_rows.begin(); i!=m_rows.end(); ++i) { delete i->second; - i->second=NULL; + i->second=nullptr; } } @@ -217,7 +217,7 @@ MarketAuctionsBufferDelete::~MarketAuctionsBufferDelete(void) for (IndexType::iterator i=m_rows.begin(); i!=m_rows.end(); ++i) { delete i->second; - i->second=NULL; + i->second=nullptr; } } @@ -330,7 +330,7 @@ MarketAuctionsBufferUpdate::~MarketAuctionsBufferUpdate(void) for (IndexType::iterator i=m_rows.begin(); i!=m_rows.end(); ++i) { delete i->second; - i->second=NULL; + i->second=nullptr; } } diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/ObjectTableBuffer.cpp b/game/server/application/SwgDatabaseServer/src/shared/buffers/ObjectTableBuffer.cpp index 4491b654..b3d787d0 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/ObjectTableBuffer.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/buffers/ObjectTableBuffer.cpp @@ -265,11 +265,11 @@ bool ObjectTableBuffer::save(DB::Session *session) #if 0 // Enable this to debug load_with problems DEBUG_REPORT_LOG(true,("Save object %s ",i->second->object_id.getValue().getValueString().c_str())); if (i->second->contained_by.isNull()) - DEBUG_REPORT_LOG(true, ("contained_by NULL ")); + DEBUG_REPORT_LOG(true, ("contained_by nullptr ")); else DEBUG_REPORT_LOG(true, ("contained_by %s ",i->second->contained_by.getValue().getValueString().c_str())); if (i->second->load_with.isNull()) - DEBUG_REPORT_LOG(true,("load_with NULL\n")); + DEBUG_REPORT_LOG(true,("load_with nullptr\n")); else DEBUG_REPORT_LOG(true,("load_with %s\n",i->second->load_with.getValue().getValueString().c_str())); #endif @@ -671,7 +671,7 @@ void ObjectTableBuffer::getObjvarsForObject(const NetworkId &objectId, std::vect int ObjectTableBuffer::encodeObjVarFreeFlags(const NetworkId & objectId) const { const DBSchema::ObjectBufferRow *row=findConstRowByIndex(objectId); - WARNING_STRICT_FATAL(row==NULL,("Loading object %s, no ObjectRow in the buffer\n",objectId.getValueString().c_str())); + WARNING_STRICT_FATAL(row==nullptr,("Loading object %s, no ObjectRow in the buffer\n",objectId.getValueString().c_str())); if (!row) return 0; diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/ResourceTypeBuffer.cpp b/game/server/application/SwgDatabaseServer/src/shared/buffers/ResourceTypeBuffer.cpp index 0784be9b..fe6cca4f 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/ResourceTypeBuffer.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/buffers/ResourceTypeBuffer.cpp @@ -31,7 +31,7 @@ ResourceTypeBuffer::~ResourceTypeBuffer() for (DataType::iterator i=m_data.begin(); i!=m_data.end(); ++i) { delete i->second; - i->second=NULL; + i->second=nullptr; } } @@ -41,7 +41,7 @@ void ResourceTypeBuffer::handleAddResourceTypeMessage(AddResourceTypeMessage con { for (std::vector::const_iterator typeData = message.getData().begin(); typeData != message.getData().end(); ++typeData) { - DBSchema::ResourceTypeRow * row = NULL; + DBSchema::ResourceTypeRow * row = nullptr; DataType::iterator rowIter = m_data.find(typeData->m_networkId); if (rowIter == m_data.end()) { diff --git a/game/server/application/SwgDatabaseServer/src/shared/cleanup/TaskObjectTemplateListUpdater.cpp b/game/server/application/SwgDatabaseServer/src/shared/cleanup/TaskObjectTemplateListUpdater.cpp index 7b73fc9b..f4653cd9 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/cleanup/TaskObjectTemplateListUpdater.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/cleanup/TaskObjectTemplateListUpdater.cpp @@ -45,7 +45,7 @@ bool TaskObjectTemplateListUpdater::process(DB::Session *session) strcpy(s_sql,"commit"); else if ( i_retval == 2 ) // got ID & Name { - s_name[256]=0; // null term to make sure it fits + s_name[256]=0; // nullptr term to make sure it fits sprintf(s_sql,"insert into object_templates values (%d,'%s')",i_id,s_name); } else diff --git a/game/server/application/SwgDatabaseServer/src/shared/core/CMLoader.cpp b/game/server/application/SwgDatabaseServer/src/shared/core/CMLoader.cpp index 405d6a80..56ac35e8 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/core/CMLoader.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/core/CMLoader.cpp @@ -25,7 +25,7 @@ #include "TaskGetLocationList.h" #include "TaskGetBidList.h" -CMLoader *CMLoader::ms_instance = NULL; +CMLoader *CMLoader::ms_instance = nullptr; // ====================================================================== @@ -42,7 +42,7 @@ void CMLoader::remove() { NOT_NULL(ms_instance); delete ms_instance; - ms_instance = NULL; + ms_instance = nullptr; } // ---------------------------------------------------------------------- diff --git a/game/server/application/SwgDatabaseServer/src/shared/core/ObjvarNameManager.cpp b/game/server/application/SwgDatabaseServer/src/shared/core/ObjvarNameManager.cpp index d5955036..e442f568 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/core/ObjvarNameManager.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/core/ObjvarNameManager.cpp @@ -17,8 +17,8 @@ // ====================================================================== -ObjvarNameManager * ObjvarNameManager::ms_instance = NULL; -ObjvarNameManager * ObjvarNameManager::ms_goldInstance = NULL; +ObjvarNameManager * ObjvarNameManager::ms_instance = nullptr; +ObjvarNameManager * ObjvarNameManager::ms_goldInstance = nullptr; // ====================================================================== @@ -37,11 +37,11 @@ void ObjvarNameManager::remove() { NOT_NULL(ms_instance); delete ms_instance; - ms_instance = NULL; + ms_instance = nullptr; NOT_NULL(ms_goldInstance); delete ms_goldInstance; - ms_goldInstance = NULL; + ms_goldInstance = nullptr; } // ---------------------------------------------------------------------- @@ -64,9 +64,9 @@ ObjvarNameManager::~ObjvarNameManager() delete m_nameToIdMap; delete m_idToNameMap; delete m_newNames; - m_nameToIdMap=NULL; - m_idToNameMap=NULL; - m_newNames=NULL; + m_nameToIdMap=nullptr; + m_idToNameMap=nullptr; + m_newNames=nullptr; } // ---------------------------------------------------------------------- @@ -169,7 +169,7 @@ DB::TaskRequest *ObjvarNameManager::saveNewNames() return task; } else - return NULL; + return nullptr; } // ====================================================================== diff --git a/game/server/application/SwgDatabaseServer/src/shared/core/SwgLoader.cpp b/game/server/application/SwgDatabaseServer/src/shared/core/SwgLoader.cpp index 206cd1ee..99d689d9 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/core/SwgLoader.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/core/SwgLoader.cpp @@ -29,9 +29,9 @@ void SwgLoader::install() SwgLoader::SwgLoader() : Loader(), - m_pendingTaskVerifyCharacter(NULL), - m_loadingTaskVerifyCharacter(NULL), - m_verifyCharacterTaskQ(NULL) + m_pendingTaskVerifyCharacter(nullptr), + m_loadingTaskVerifyCharacter(nullptr), + m_verifyCharacterTaskQ(nullptr) { m_verifyCharacterTaskQ = new DB::TaskQueue(1,DatabaseProcess::getInstance().getDBServer(),4); } @@ -95,7 +95,7 @@ void SwgLoader::update(real updateTime) if (m_pendingTaskVerifyCharacter && !m_loadingTaskVerifyCharacter) { m_loadingTaskVerifyCharacter = m_pendingTaskVerifyCharacter; - m_pendingTaskVerifyCharacter = NULL; + m_pendingTaskVerifyCharacter = nullptr; m_verifyCharacterTaskQ->asyncRequest(m_loadingTaskVerifyCharacter); } @@ -109,7 +109,7 @@ void SwgLoader::verifyCharacterFinished (TaskVerifyCharacter *task) { UNREF(task); DEBUG_FATAL(task!=m_loadingTaskVerifyCharacter,("Programmer bug: wrong TaskVerifyCharacter finished.\n")); - m_loadingTaskVerifyCharacter = NULL; + m_loadingTaskVerifyCharacter = nullptr; } // ---------------------------------------------------------------------- diff --git a/game/server/application/SwgDatabaseServer/src/shared/core/SwgPersister.cpp b/game/server/application/SwgDatabaseServer/src/shared/core/SwgPersister.cpp index 216a6aec..a792d1b5 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/core/SwgPersister.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/core/SwgPersister.cpp @@ -110,7 +110,7 @@ void SwgPersister::moveToPlayer(const NetworkId &oid, const NetworkId &player, c void SwgPersister::getMoneyFromOfflineObject(uint32 replyServer, NetworkId const & sourceObject, int amount, NetworkId const & replyTo, std::string const & successCallback, std::string const & failCallback, stdvector::fwd const & packedDictionary) { - SwgSnapshot * snapshot=NULL; + SwgSnapshot * snapshot=nullptr; if (hasDataForObject(sourceObject)) snapshot=safe_cast(&getSnapshotForObject(sourceObject, 0)); diff --git a/game/server/application/SwgDatabaseServer/src/shared/core/SwgSnapshot.cpp b/game/server/application/SwgDatabaseServer/src/shared/core/SwgSnapshot.cpp index b5e7e461..ccb9ccad 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/core/SwgSnapshot.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/core/SwgSnapshot.cpp @@ -96,8 +96,8 @@ SwgSnapshot::SwgSnapshot(DB::ModeQuery::Mode mode, bool useGoldDatabase) : m_vehicleObjectBuffer(mode), m_waypointBuffer(mode), m_weaponObjectBuffer(mode), - m_immediateDeleteStep(NULL), - m_offlineMoneyCustomPersistStep(NULL) + m_immediateDeleteStep(nullptr), + m_offlineMoneyCustomPersistStep(nullptr) { m_bufferList.push_back(&m_battlefieldMarkerObjectBuffer); m_bufferList.push_back(&m_battlefieldParticipantBuffer); @@ -290,10 +290,10 @@ void SwgSnapshot::decodeScriptObject(NetworkId const & objectId, Archive::ReadIt Archive::get(data,packedScriptList); if (packedScriptList.length()==0) - packedScriptList=' '; // avoid confusing an empty list with NULL + packedScriptList=' '; // avoid confusing an empty list with nullptr DBSchema::ObjectBufferRow *row=m_objectTableBuffer.findRowByIndex(objectId); - if (row==NULL) + if (row==nullptr) row=m_objectTableBuffer.addEmptyRow(objectId); row->script_list=packedScriptList; diff --git a/game/server/application/SwgDatabaseServer/src/shared/queries/CommoditiesQuery.cpp b/game/server/application/SwgDatabaseServer/src/shared/queries/CommoditiesQuery.cpp index 9a245c47..f5ae1da4 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/queries/CommoditiesQuery.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/queries/CommoditiesQuery.cpp @@ -90,7 +90,7 @@ bool AuctionLocationsQuery::setupData(DB::Session *session) bool AuctionLocationsQuery::addData(const DB::Row *_data) { const AuctionLocationsRow *myData=dynamic_cast(_data); - FATAL(myData == NULL, ("Adding NULL data into AuctionLocations")); + FATAL(myData == nullptr, ("Adding nullptr data into AuctionLocations")); switch(mode) { case mode_UPDATE: @@ -413,7 +413,7 @@ bool MarketAuctionsQuery::addData(const DB::Row *_data) case mode_UPDATE: { const MarketAuctionsRowUpdate *myData=dynamic_cast(_data); - FATAL(myData == NULL, ("Adding NULL data into MarketAuctions for mode_UPDATE")); + FATAL(myData == nullptr, ("Adding nullptr data into MarketAuctions for mode_UPDATE")); if (!m_item_ids.push_back(myData->item_id.getValueASCII())) return false; if (!m_owner_ids.push_back(myData->owner_id.getValueASCII())) return false; @@ -424,7 +424,7 @@ bool MarketAuctionsQuery::addData(const DB::Row *_data) case mode_INSERT: { const MarketAuctionsRow *myData=dynamic_cast(_data); - FATAL(myData == NULL, ("Adding NULL data into MarketAuctions for mode_INSERT")); + FATAL(myData == nullptr, ("Adding nullptr data into MarketAuctions for mode_INSERT")); if (!m_item_ids.push_back(myData->item_id.getValueASCII())) return false; if (!m_owner_ids.push_back(myData->owner_id.getValueASCII())) return false; @@ -450,7 +450,7 @@ bool MarketAuctionsQuery::addData(const DB::Row *_data) case mode_DELETE: { const MarketAuctionsRowDelete *myData=dynamic_cast(_data); - FATAL(myData == NULL, ("Adding NULL data into MarketAuctions for mode_DELETE")); + FATAL(myData == nullptr, ("Adding nullptr data into MarketAuctions for mode_DELETE")); if (!m_item_ids.push_back(myData->item_id.getValueASCII())) return false; break; @@ -716,7 +716,7 @@ bool MarketAuctionBidsQuery::addData(const DB::Row *_data) { const MarketAuctionBidsRow *myData=dynamic_cast(_data); - FATAL(myData == NULL, ("Adding NULL data into MarketAuctionBids")); + FATAL(myData == nullptr, ("Adding nullptr data into MarketAuctionBids")); switch(mode) { diff --git a/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskSaveObjvarNames.cpp b/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskSaveObjvarNames.cpp index f30e0962..d809771f 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskSaveObjvarNames.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskSaveObjvarNames.cpp @@ -24,7 +24,7 @@ TaskSaveObjvarNames::TaskSaveObjvarNames(const NameList &names) : TaskSaveObjvarNames::~TaskSaveObjvarNames() { delete m_objvarNames; - m_objvarNames=NULL; + m_objvarNames=nullptr; } // ---------------------------------------------------------------------- diff --git a/game/server/application/SwgGameServer/src/shared/combat/CombatEngine.cpp b/game/server/application/SwgGameServer/src/shared/combat/CombatEngine.cpp index 50a12bbb..4f4269cd 100755 --- a/game/server/application/SwgGameServer/src/shared/combat/CombatEngine.cpp +++ b/game/server/application/SwgGameServer/src/shared/combat/CombatEngine.cpp @@ -102,7 +102,7 @@ void CombatEngine::aim(const Command &, const NetworkId & actor, const NetworkId CachedNetworkId attackerId(actor); TangibleObject * attacker = dynamic_cast(attackerId.getObject()); - if (attacker != NULL) + if (attacker != nullptr) { attacker->addAim(); } @@ -121,7 +121,7 @@ bool CombatEngine::addTargetAction(TangibleObject & attacker, { // @todo: support tangible attacks CreatureObject * const creatureAttacker = attacker.asCreatureObject (); - if (creatureAttacker == NULL) + if (creatureAttacker == nullptr) { WARNING_STRICT_FATAL(true, ("Tangible attackers not supported yet")); return false; @@ -146,7 +146,7 @@ bool CombatEngine::addAttackAction(TangibleObject & attacker, { // @todo: support tangible attacks CreatureObject * const creatureAttacker = attacker.asCreatureObject (); - if (creatureAttacker == NULL) + if (creatureAttacker == nullptr) { WARNING_STRICT_FATAL(true, ("Tangible attackers not supported yet")); return false; @@ -176,7 +176,7 @@ bool CombatEngine::addAimAction(TangibleObject & attacker) // @todo: support tangible attacks CreatureObject * const creatureAttacker = attacker.asCreatureObject (); - if (creatureAttacker == NULL) + if (creatureAttacker == nullptr) { WARNING_STRICT_FATAL(true, ("Tangible attackers not supported yet")); return false; @@ -203,7 +203,7 @@ bool CombatEngine::onSuccessfulAttack(const TangibleObject & attacker, TangibleObject & defender, const WeaponObject & weapon, int damageAmount, int hitLocation) { - const bool creatureDefender = defender.asCreatureObject() != NULL; + const bool creatureDefender = defender.asCreatureObject() != nullptr; const bool isVehicle = GameObjectTypes::isTypeOf (defender.getGameObjectType (), SharedObjectTemplate::GOT_vehicle); // if attacking an object, always hit location 0 @@ -262,9 +262,9 @@ bool CombatEngine::onSuccessfulAttack(const TangibleObject & attacker, } else { - TangibleController * const tangibleController = (defender.getController() != NULL) ? defender.getController()->asTangibleController() : NULL; + TangibleController * const tangibleController = (defender.getController() != nullptr) ? defender.getController()->asTangibleController() : nullptr; - if (tangibleController == NULL) + if (tangibleController == nullptr) { WARNING_STRICT_FATAL(true, ("CombatEngine::onSuccessfulAttack non-auth " "defender %s doesn't have a TangibleController!", @@ -311,7 +311,7 @@ bool CombatEngine::onSuccessfulAttack(const TangibleObject & attacker, TangibleObject & defender, int damageAmount, int hitLocation) { - const bool creatureDefender = defender.asCreatureObject() != NULL; + const bool creatureDefender = defender.asCreatureObject() != nullptr; const bool isVehicle = GameObjectTypes::isTypeOf (defender.getGameObjectType (), SharedObjectTemplate::GOT_vehicle); // if attacking an object, always hit location 0 @@ -359,9 +359,9 @@ bool CombatEngine::onSuccessfulAttack(const TangibleObject & attacker, } else { - TangibleController * const tangibleController = (defender.getController() != NULL) ? defender.getController()->asTangibleController() : NULL; + TangibleController * const tangibleController = (defender.getController() != nullptr) ? defender.getController()->asTangibleController() : nullptr; - if (tangibleController == NULL) + if (tangibleController == nullptr) { WARNING_STRICT_FATAL(true, ("CombatEngine::onSuccessfulAttack non-auth " "defender %s doesn't have a TangibleController!", @@ -411,7 +411,7 @@ bool CombatEngine::damage(TangibleObject & defender, const WeaponObject & weapon const bool isVehicle = GameObjectTypes::isTypeOf (defender.getGameObjectType (), SharedObjectTemplate::GOT_vehicle); // if attacking an object, always hit location 0 - if (critter == NULL || isVehicle) + if (critter == nullptr || isVehicle) hitLocation = 0; // get the damage profile for the hit location @@ -425,7 +425,7 @@ bool CombatEngine::damage(TangibleObject & defender, const WeaponObject & weapon // put a attribMod structure on the defender's damage list for each type of // damage received DamageList damageList; - if (critter != NULL && !isVehicle) + if (critter != nullptr && !isVehicle) { computeCreatureDamage(&hitLocationData, damageAmount, damageList); } @@ -456,7 +456,7 @@ bool CombatEngine::damage(TangibleObject & defender, const WeaponObject & weapon damageData.damage.insert(damageData.damage.end(), damageList.begin(), damageList.end()); damageData.wounded = isWounded; - if (critter != NULL || !defender.isDisabled()) + if (critter != nullptr || !defender.isDisabled()) { // update the object's hit points or attributes for the damage defender.applyDamage(damageData); @@ -485,7 +485,7 @@ void CombatEngine::damage(TangibleObject & defender, const bool isVehicle = GameObjectTypes::isTypeOf (defender.getGameObjectType (), SharedObjectTemplate::GOT_vehicle); // if attacking an object, always hit location 0 - if (critter == NULL || isVehicle) + if (critter == nullptr || isVehicle) hitLocation = 0; // get the damage profile for the hit location @@ -514,7 +514,7 @@ void CombatEngine::damage(TangibleObject & defender, damageData.hitLocationIndex = hitLocation; damageData.damage.insert(damageData.damage.end(), damageList.begin(), damageList.end()); - if (critter != NULL || !defender.isDisabled()) + if (critter != nullptr || !defender.isDisabled()) { // update the object's hit points or attributes for the damage defender.applyDamage(damageData); @@ -668,7 +668,7 @@ void CombatEngine::alter(TangibleObject & object) { NOT_NULL(object.getController()); - if ( (object.getCombatData() == NULL) + if ( (object.getCombatData() == nullptr) || object.getCombatData()->defenseData.damage.empty()) { return; @@ -682,7 +682,7 @@ void CombatEngine::alter(TangibleObject & object) // if the object is a creature, get it's attributes Attributes::Value currentAttribs[Attributes::NumberOfAttributes]; CreatureObject * const critter = object.asCreatureObject (); - if (critter != NULL) + if (critter != nullptr) { for (int i = 0; i < Attributes::NumberOfAttributes; ++i) currentAttribs[i] = critter->getAttribute(i); @@ -710,7 +710,7 @@ void CombatEngine::alter(TangibleObject & object) { TangibleController * const tangibleController = object.getController()->asTangibleController(); - if (tangibleController == NULL) + if (tangibleController == nullptr) { WARNING_STRICT_FATAL(true, ("CombatEngine::alter non-auth " "object %s doesn't have a TangibleController!", diff --git a/game/server/application/SwgGameServer/src/shared/controller/JediManagerController.cpp b/game/server/application/SwgGameServer/src/shared/controller/JediManagerController.cpp index 80099996..defcc868 100755 --- a/game/server/application/SwgGameServer/src/shared/controller/JediManagerController.cpp +++ b/game/server/application/SwgGameServer/src/shared/controller/JediManagerController.cpp @@ -40,7 +40,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_removeJedi: { const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if (msg != NULL) + if (msg != nullptr) { owner->removeJedi(msg->getValue()); } @@ -49,7 +49,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_addJedi: { const MessageQueueJediData * const msg = safe_cast(data); - if (msg != NULL) + if (msg != nullptr) { owner->addJedi(msg->getId(), msg->getName(), @@ -69,7 +69,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_updateJedi: { const MessageQueueJediData * const msg = safe_cast(data); - if (msg != NULL) + if (msg != nullptr) { owner->updateJedi(msg->getId(), msg->getVisibility(), @@ -83,7 +83,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_updateJediState: { const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); - if (msg != NULL) + if (msg != nullptr) { owner->updateJedi(msg->getValue().first, static_cast(msg->getValue().second) @@ -95,7 +95,7 @@ void JediManagerController::handleMessage (const int message, const float value, { /* const MessageQueueGenericValueType > > * const msg = safe_cast > > *>(data); - if (msg != NULL) + if (msg != nullptr) { owner->updateJedi(msg->getValue().first, msg->getValue().second @@ -107,7 +107,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_updateJediLocation: { const MessageQueueJediLocation * const msg = safe_cast(data); - if (msg != NULL) + if (msg != nullptr) { owner->updateJediLocation(msg->getId(), msg->getLocation(), @@ -119,7 +119,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_setJediOffline: { const MessageQueueJediLocation * const msg = safe_cast(data); - if (msg != NULL) + if (msg != nullptr) { owner->setJediOffline(msg->getId(), msg->getLocation(), @@ -131,7 +131,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_requestJediBounty: { const MessageQueueRequestJediBounty * const msg = safe_cast(data); - if (msg != NULL) + if (msg != nullptr) { owner->requestJediBounty(msg->getTargetId(), msg->getHunterId(), @@ -145,7 +145,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_removeJediBounty: { const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); - if (msg != NULL) + if (msg != nullptr) { owner->removeJediBounty(msg->getValue().first, msg->getValue().second); } @@ -154,7 +154,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_removeAllJediBounties: { const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if (msg != NULL) + if (msg != nullptr) { owner->removeAllJediBounties(msg->getValue()); } @@ -163,7 +163,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_updateJediSpentJediSkillPoints: { const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); - if (msg != NULL) + if (msg != nullptr) { owner->updateJediSpentJediSkillPoints(msg->getValue().first, msg->getValue().second); } @@ -172,7 +172,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_updateJediFaction: { const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); - if (msg != NULL) + if (msg != nullptr) { owner->updateJediFaction(msg->getValue().first, msg->getValue().second); } @@ -181,7 +181,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_updateJediScriptData: { const MessageQueueGenericValueType > > * const msg = safe_cast > > *>(data); - if (msg != NULL) + if (msg != nullptr) { owner->updateJediScriptData(msg->getValue().first, msg->getValue().second.first, msg->getValue().second.second); } @@ -190,7 +190,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_removeJediScriptData: { const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); - if (msg != NULL) + if (msg != nullptr) { owner->removeJediScriptData(msg->getValue().first, msg->getValue().second); } diff --git a/game/server/application/SwgGameServer/src/shared/controller/SwgPlayerCreatureController.cpp b/game/server/application/SwgGameServer/src/shared/controller/SwgPlayerCreatureController.cpp index dea874be..1e417386 100755 --- a/game/server/application/SwgGameServer/src/shared/controller/SwgPlayerCreatureController.cpp +++ b/game/server/application/SwgGameServer/src/shared/controller/SwgPlayerCreatureController.cpp @@ -40,7 +40,7 @@ void SwgPlayerCreatureController::handleMessage (const int message, const float case CM_setJediState: { const MessageQueueGenericValueType * const msg = dynamic_cast *>(data); - if (msg != NULL) + if (msg != nullptr) playerOwner->setJediState(static_cast(msg->getValue())); } break; diff --git a/game/server/application/SwgGameServer/src/shared/core/CSHandler.cpp b/game/server/application/SwgGameServer/src/shared/core/CSHandler.cpp index 5bb0356e..869755e9 100755 --- a/game/server/application/SwgGameServer/src/shared/core/CSHandler.cpp +++ b/game/server/application/SwgGameServer/src/shared/core/CSHandler.cpp @@ -767,7 +767,7 @@ CS_CMD( create_crafted_object ) if( !( target && target->isAuthoritative() ) ) return; ServerObject *inventory = target->getInventory(); - if( inventory == NULL ) + if( inventory == nullptr ) return; DEBUG_REPORT_LOG( true, ( "Trying to make %s\n", args[ 1 ].c_str())); GameScriptObject * script = target->getScriptObject(); @@ -1116,7 +1116,7 @@ CS_CMD( delete_object ) const NetworkId oid (args[0]); ServerObject *object = ServerObject::getServerObject( oid ); - if (object == NULL) + if (object == nullptr) { return; } @@ -1174,7 +1174,7 @@ CS_CMD( rename_player ) } if( player_id.isValid() ) { - // null id to pass to the playercreationmanager. + // nullptr id to pass to the playercreationmanager. NetworkId source( "0" ); DEBUG_REPORT_LOG( true, ( "Attempting to rename %s.", args[ 0 ].c_str() ) ); @@ -1213,7 +1213,7 @@ CS_CMD( set_bank_credits ) CreatureObject* creatureActor = CreatureObject::getCreatureObject(player_id); PlayerObject const * const player = PlayerCreatureController::getPlayerObject(creatureActor); - if( ( player != NULL ) && ( player->isAuthoritative() ) ) + if( ( player != nullptr ) && ( player->isAuthoritative() ) ) { amount -= creatureActor->getBankBalance(); DEBUG_REPORT_LOG( true, ( "Amount to modify by: %d (%d current balance)\n", amount, creatureActor->getBankBalance() ) ); @@ -1270,7 +1270,7 @@ CS_CMD( get_pc_info ) if(bindId != NetworkId::cms_invalid) { const ServerObject* const bindObject = ServerObject::getServerObject(bindId); - if (bindObject != NULL) + if (bindObject != nullptr) { bindLoc = bindObject->getPosition_w(); snprintf( stringbuffer, sizeof( stringbuffer ) -1, "%02f %02f %02f", bindLoc.x, bindLoc.y, bindLoc.z ); @@ -1380,11 +1380,11 @@ CS_CMD( get_pc_info ) // residence info PlayerObject const * const player = PlayerCreatureController::getPlayerObject(creatureActor); - if (player != NULL) + if (player != nullptr) { NetworkId houseNetworkId = creatureActor->getHouse(); const ServerObject* const resObject = ServerObject::getServerObject(houseNetworkId); - if (resObject != NULL) + if (resObject != nullptr) { resLoc = resObject->getPosition_w(); snprintf( stringbuffer, sizeof( stringbuffer ) - 1 , "%02f %02f %02f", resLoc.x, resLoc.y, resLoc.z ); diff --git a/game/server/application/SwgGameServer/src/shared/core/SwgGameServer.cpp b/game/server/application/SwgGameServer/src/shared/core/SwgGameServer.cpp index 1b310ffd..1bf01f55 100755 --- a/game/server/application/SwgGameServer/src/shared/core/SwgGameServer.cpp +++ b/game/server/application/SwgGameServer/src/shared/core/SwgGameServer.cpp @@ -55,7 +55,7 @@ SwgGameServer::~SwgGameServer() void SwgGameServer::install() { - DEBUG_FATAL (ms_instance != NULL, ("already installed")); + DEBUG_FATAL (ms_instance != nullptr, ("already installed")); ms_instance = new SwgGameServer; SwgServerUniverse::install(); @@ -110,7 +110,7 @@ void SwgGameServer::receiveMessage(const MessageDispatch::Emitter & source, cons JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager != NULL && jediManager->isAuthoritative()) + if (jediManager != nullptr && jediManager->isAuthoritative()) { jediManager->addJediBounties(*msg); delete msg; @@ -129,7 +129,7 @@ void SwgGameServer::receiveMessage(const MessageDispatch::Emitter & source, cons JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager != NULL) + if (jediManager != nullptr) { jediManager->characterBeingDeleted(msg.getValue()); } diff --git a/game/server/application/SwgGameServer/src/shared/core/SwgServerUniverse.cpp b/game/server/application/SwgGameServer/src/shared/core/SwgServerUniverse.cpp index 3d743c93..98bccf40 100755 --- a/game/server/application/SwgGameServer/src/shared/core/SwgServerUniverse.cpp +++ b/game/server/application/SwgGameServer/src/shared/core/SwgServerUniverse.cpp @@ -26,7 +26,7 @@ void SwgServerUniverse::install() SwgServerUniverse::SwgServerUniverse() : ServerUniverse (), - m_jediManager (NULL) + m_jediManager (nullptr) { } @@ -51,7 +51,7 @@ void SwgServerUniverse::updateAndValidateData() "only be called on the process that is authoritative for UniverseObjects.\n")); // create Jedi manager - if (m_jediManager == NULL) + if (m_jediManager == nullptr) { const ServerObjectTemplate * objTemplate = safe_cast(ObjectTemplateList::fetch(ConfigServerGame::getJediManagerTemplate())); m_jediManager = safe_cast(ServerWorld::createNewObject(*objTemplate, Transform::identity, 0, false)); diff --git a/game/server/application/SwgGameServer/src/shared/object/JediManagerObject.cpp b/game/server/application/SwgGameServer/src/shared/object/JediManagerObject.cpp index f4aa0944..89c24610 100755 --- a/game/server/application/SwgGameServer/src/shared/object/JediManagerObject.cpp +++ b/game/server/application/SwgGameServer/src/shared/object/JediManagerObject.cpp @@ -43,7 +43,7 @@ namespace JediManagerObjectNamespace // the bounty hunter target list loaded from the DB; we store it here // and wait until the JediManagerObject object is created, and then // read it into the JediManagerObject object - const BountyHunterTargetListMessage * s_queuedBountyHunterTargetListFromDB = NULL; + const BountyHunterTargetListMessage * s_queuedBountyHunterTargetListFromDB = nullptr; } using namespace JediManagerObjectNamespace; @@ -151,7 +151,7 @@ void JediManagerObject::onServerUniverseGainedAuthority() addJediBounties(*s_queuedBountyHunterTargetListFromDB); delete s_queuedBountyHunterTargetListFromDB; - s_queuedBountyHunterTargetListFromDB = NULL; + s_queuedBountyHunterTargetListFromDB = nullptr; } } @@ -450,7 +450,7 @@ void JediManagerObject::characterBeingDeleted(const NetworkId & id) ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); @@ -1252,7 +1252,7 @@ void JediManagerObject::requestJediBounty(const NetworkId & targetId, ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); if (success) diff --git a/game/server/application/SwgGameServer/src/shared/object/SwgCreatureObject.cpp b/game/server/application/SwgGameServer/src/shared/object/SwgCreatureObject.cpp index e1ab4b18..18cd7b6e 100755 --- a/game/server/application/SwgGameServer/src/shared/object/SwgCreatureObject.cpp +++ b/game/server/application/SwgGameServer/src/shared/object/SwgCreatureObject.cpp @@ -96,7 +96,7 @@ void SwgCreatureObject::onRemovingFromWorld() if (isAuthoritative() && isPlayerControlled() && (getBountyValue() > 0)) { JediManagerObject * const jediManager = static_cast(ServerUniverse::getInstance()).getJediManager(); - if (jediManager != NULL) + if (jediManager != nullptr) { jediManager->setJediOffline(getNetworkId(), getPosition_w(), getSceneId()); } @@ -116,7 +116,7 @@ void SwgCreatureObject::onPermanentlyDestroyed() if (isAuthoritative() && isPlayerControlled() && (getBountyValue() > 0)) { JediManagerObject * const jediManager = static_cast(ServerUniverse::getInstance()).getJediManager(); - if (jediManager != NULL) + if (jediManager != nullptr) { jediManager->removeJedi(getNetworkId()); } @@ -178,7 +178,7 @@ const int SwgCreatureObject::getSpentJediSkillPoints() const } else { - WARNING(true, ("Creature %s had a null in their skill list", getNetworkId().getValueString().c_str())); + WARNING(true, ("Creature %s had a nullptr in their skill list", getNetworkId().getValueString().c_str())); } } */ @@ -198,7 +198,7 @@ bool SwgCreatureObject::hasBounty(const CreatureObject & target) const { const SwgCreatureObject * swgTarget = dynamic_cast( &target); - if (swgTarget == NULL) + if (swgTarget == nullptr) return false; JediManagerObject * jediManager = static_cast( @@ -296,7 +296,7 @@ void SwgCreatureObject::onAddedToWorld() if (isAuthoritative() && isPlayerControlled() && (getBountyValue() > 0)) { JediManagerObject * jediManager = static_cast(ServerUniverse::getInstance()).getJediManager(); - if (jediManager != NULL) + if (jediManager != nullptr) { jediManager->updateJediLocation(getNetworkId(), getPosition_w(), getSceneId()); } @@ -330,7 +330,7 @@ void SwgCreatureObject::setPvpFaction(Pvp::FactionId factionId) if ((oldId != newId) && isAuthoritative() && isPlayerControlled() && (getBountyValue() > 0)) { JediManagerObject * jediManager = static_cast(ServerUniverse::getInstance()).getJediManager(); - if (jediManager != NULL) + if (jediManager != nullptr) { jediManager->updateJediFaction(getNetworkId(), newId); } diff --git a/game/server/application/SwgGameServer/src/shared/object/SwgPlayerObject.cpp b/game/server/application/SwgGameServer/src/shared/object/SwgPlayerObject.cpp index ef587054..c8c838ec 100755 --- a/game/server/application/SwgGameServer/src/shared/object/SwgPlayerObject.cpp +++ b/game/server/application/SwgGameServer/src/shared/object/SwgPlayerObject.cpp @@ -92,12 +92,12 @@ void SwgPlayerObject::virtualOnSetAuthority() PlayerObject::virtualOnSetAuthority(); const SwgCreatureObject * owner = safe_cast(getCreatureObject()); - if ((owner != NULL) && owner->isPlayerControlled() && (owner->getBountyValue() > 0)) + if ((owner != nullptr) && owner->isPlayerControlled() && (owner->getBountyValue() > 0)) { // tell the Jedi manager our position JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager != NULL) + if (jediManager != nullptr) { jediManager->updateJediLocation(owner->getNetworkId(), owner->getPosition_w(), owner->getSceneId()); @@ -192,7 +192,7 @@ void SwgPlayerObject::updateJediLocationTime(float time) // tell the Jedi manager our position JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager != NULL) + if (jediManager != nullptr) { const CreatureObject * owner = getCreatureObject(); if (owner->isInWorld()) @@ -324,7 +324,7 @@ void SwgPlayerObject::setJediBounties(const std::vector & bounties) // update the Jedi manager JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager != NULL) + if (jediManager != nullptr) { const CreatureObject * owner = getCreatureObject(); jediManager->updateJedi(owner->getNetworkId(), bounties); @@ -351,7 +351,7 @@ bool SwgPlayerObject::getJediBounties(std::vector & bounties) bounties.clear(); SwgCreatureObject * owner = safe_cast(getCreatureObject()); - if (owner != NULL) + if (owner != nullptr) { if (owner->getObjVars().getItem(OBJVAR_JEDI_BOUNTIES, bounties)) { diff --git a/game/server/application/SwgGameServer/src/shared/objectTemplate/ServerJediManagerObjectTemplate.cpp b/game/server/application/SwgGameServer/src/shared/objectTemplate/ServerJediManagerObjectTemplate.cpp index 90edb0a3..aaf9f5a9 100755 --- a/game/server/application/SwgGameServer/src/shared/objectTemplate/ServerJediManagerObjectTemplate.cpp +++ b/game/server/application/SwgGameServer/src/shared/objectTemplate/ServerJediManagerObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag ServerJediManagerObjectTemplate::getTemplateVersion(void) const */ Tag ServerJediManagerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerJediManagerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerJediManagerObjectTemplate::getHighestTemplateVersion @@ -150,12 +150,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/game/server/library/swgServerNetworkMessages/src/shared/core/SetupSwgServerNetworkMessages.cpp b/game/server/library/swgServerNetworkMessages/src/shared/core/SetupSwgServerNetworkMessages.cpp index d93e323f..864e2645 100755 --- a/game/server/library/swgServerNetworkMessages/src/shared/core/SetupSwgServerNetworkMessages.cpp +++ b/game/server/library/swgServerNetworkMessages/src/shared/core/SetupSwgServerNetworkMessages.cpp @@ -235,7 +235,7 @@ namespace SetupSwgServerNetworkMessagesNamespace } MessageQueue::Data* unpackNothing(Archive::ReadIterator &) { - return NULL; + return nullptr; } void packVectorNetworkIdVector(const MessageQueue::Data * data, Archive::ByteStream & target) diff --git a/game/shared/library/swgSharedNetworkMessages/src/shared/combat/MessageQueueCombatAction.cpp b/game/shared/library/swgSharedNetworkMessages/src/shared/combat/MessageQueueCombatAction.cpp index e0c98b96..44559bc5 100755 --- a/game/shared/library/swgSharedNetworkMessages/src/shared/combat/MessageQueueCombatAction.cpp +++ b/game/shared/library/swgSharedNetworkMessages/src/shared/combat/MessageQueueCombatAction.cpp @@ -297,7 +297,7 @@ void MessageQueueCombatAction::debugDump() const bool hasActionName; char actionName[256]; - if (s_actionNameLookupFunction != NULL) + if (s_actionNameLookupFunction != nullptr) { hasActionName = true; (*s_actionNameLookupFunction)(m_actionId, actionName, sizeof(actionName)); @@ -316,9 +316,9 @@ void MessageQueueCombatAction::debugDump() const // Print attacker info. DEBUG_REPORT_LOG(true, ("MQCA: attacker: id =[%s].\n", m_attacker.id.getValueString().c_str())); - DEBUG_REPORT_LOG(true, ("MQCA: attacker: template =[%s].\n", attackerObject ? attackerObject->getObjectTemplateName() : "")); + DEBUG_REPORT_LOG(true, ("MQCA: attacker: template =[%s].\n", attackerObject ? attackerObject->getObjectTemplateName() : "")); DEBUG_REPORT_LOG(true, ("MQCA: attacker: weapon =[%s].\n", m_attacker.weapon.getValueString().c_str())); - DEBUG_REPORT_LOG(true, ("MQCA: attacker: weapon template =[%s].\n", weaponObject ? weaponObject->getObjectTemplateName() : "")); + DEBUG_REPORT_LOG(true, ("MQCA: attacker: weapon template =[%s].\n", weaponObject ? weaponObject->getObjectTemplateName() : "")); DEBUG_REPORT_LOG(true, ("MQCA: attacker: end posture =[%s].\n", Postures::getPostureName(m_attacker.endPosture))); DEBUG_REPORT_LOG(true, ("MQCA: attacker: trailBits =[0x%02x].\n", m_attacker.trailBits)); DEBUG_REPORT_LOG(true, ("MQCA: attacker: client effect id=[%d].\n", m_attacker.clientEffectId)); @@ -341,7 +341,7 @@ void MessageQueueCombatAction::debugDump() const UNREF(defenderObject); DEBUG_REPORT_LOG(true, ("MQCA: defender #%d: id =[%s].\n", i + 1, data.id.getValueString().c_str())); - DEBUG_REPORT_LOG(true, ("MQCA: defender #%d: template =[%s].\n", i + 1, defenderObject ? defenderObject->getObjectTemplateName() : "")); + DEBUG_REPORT_LOG(true, ("MQCA: defender #%d: template =[%s].\n", i + 1, defenderObject ? defenderObject->getObjectTemplateName() : "")); DEBUG_REPORT_LOG(true, ("MQCA: defender #%d: end posture =[%s].\n", i + 1, Postures::getPostureName(data.endPosture))); DEBUG_REPORT_LOG(true, ("MQCA: defender #%d: defense =[%s].\n", i + 1, CombatEngineData::getCombatDefenseName(data.defense))); DEBUG_REPORT_LOG(true, ("MQCA: defender #%d: client effect id=[%d].\n", i + 1, data.clientEffectId)); diff --git a/game/shared/library/swgSharedNetworkMessages/src/shared/core/SetupSwgSharedNetworkMessages.cpp b/game/shared/library/swgSharedNetworkMessages/src/shared/core/SetupSwgSharedNetworkMessages.cpp index fb9785c0..399a513c 100755 --- a/game/shared/library/swgSharedNetworkMessages/src/shared/core/SetupSwgSharedNetworkMessages.cpp +++ b/game/shared/library/swgSharedNetworkMessages/src/shared/core/SetupSwgSharedNetworkMessages.cpp @@ -482,7 +482,7 @@ namespace SetupSwgSharedNetworkMessagesNamespace MessageQueue::Data* unpackNothing(Archive::ReadIterator &) { - return NULL; + return nullptr; } //---------------------------------------------------------------------- diff --git a/game/shared/library/swgSharedUtility/src/shared/CombatEngineData.h b/game/shared/library/swgSharedUtility/src/shared/CombatEngineData.h index 0a86c6ee..118e2167 100755 --- a/game/shared/library/swgSharedUtility/src/shared/CombatEngineData.h +++ b/game/shared/library/swgSharedUtility/src/shared/CombatEngineData.h @@ -139,7 +139,7 @@ namespace CombatEngineData std::vector damage;// list of attribute modifiers this damage // caused, pre armor effectiveness - CachedNetworkId attackerId; // who caused the damage (null for + CachedNetworkId attackerId; // who caused the damage (nullptr for // environmental effects, etc) NetworkId weaponId; // id of the weapon used DamageType damageType; @@ -175,10 +175,10 @@ namespace CombatEngineData inline ActionItem::~ActionItem(void) { - if (type == target && actionData.targetData.targets != NULL) + if (type == target && actionData.targetData.targets != nullptr) { delete[] actionData.targetData.targets; - actionData.targetData.targets = NULL; + actionData.targetData.targets = nullptr; } } // ActionItem::~ActionItem @@ -195,7 +195,7 @@ namespace CombatEngineData actionId(0), wounded(false), ignoreInvulnerable(false) -// combatActionMessage(NULL) +// combatActionMessage(nullptr) { } From f70229a1782feaf1106b071122c1e55ae0751709 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sun, 14 Feb 2016 12:27:12 -0600 Subject: [PATCH 013/302] set metaspace size properly for java 8 and above - otherwise you'll run out of ram and crash --- .../server/library/serverScript/src/shared/JavaLibrary.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp index 0cbc73ac..e6c87680 100755 --- a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp +++ b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp @@ -1258,12 +1258,17 @@ void JavaLibrary::initializeJavaThread() // the below is ok but could use the dynamic function call too if we want someday #ifdef JNI_VERSION_1_9 vm_args.version = JNI_VERSION_1_9; + + tempOption.optionString = "-XX:MetaspaceSize=128m"; + options.push_back(tempOption); #define JAVAVERSET = 1 #endif #ifndef JAVAVERSET #ifdef JNI_VERSION_1_8 vm_args.version = JNI_VERSION_1_8; + tempOption.optionString = "-XX:MetaspaceSize=128m"; + options.push_back(tempOption); #define JAVAVERSET = 1 #endif #endif From c22a458c9f49b75d1776f8bea57dc8023fdea4e1 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sun, 14 Feb 2016 23:51:10 -0600 Subject: [PATCH 014/302] set mem manager upper limit to more sane value --- .../library/sharedMemoryManager/src/shared/MemoryManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp b/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp index a188f56f..b6e10567 100755 --- a/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp +++ b/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp @@ -256,7 +256,7 @@ namespace MemoryManagerNamespace bool ms_installed; bool ms_limitSet; bool ms_hardLimit; - int ms_limitMegabytes = 4095; + int ms_limitMegabytes = 3071; SystemAllocation * ms_firstSystemAllocation; int ms_numberOfSystemAllocations; int ms_systemMemoryAllocatedMegabytes; From 6bb5137dc4b348888d3aa8cf6a787aca4b821120 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sun, 14 Feb 2016 23:51:10 -0600 Subject: [PATCH 015/302] set mem manager upper limit to more sane value --- .../library/sharedMemoryManager/src/shared/MemoryManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp b/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp index 9c9ab336..411b5f3c 100755 --- a/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp +++ b/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp @@ -256,7 +256,7 @@ namespace MemoryManagerNamespace bool ms_installed; bool ms_limitSet; bool ms_hardLimit; - int ms_limitMegabytes = 4095; + int ms_limitMegabytes = 3071; SystemAllocation * ms_firstSystemAllocation; int ms_numberOfSystemAllocations; int ms_systemMemoryAllocatedMegabytes; From 03dc62efba9c4ae2402fe42042bd50cbd80f589a Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Thu, 11 Feb 2016 15:16:14 -0600 Subject: [PATCH 016/302] newer standards prefer nullptr over NULL - this is most of them but there are others too --- .../Miff/src/linux/InputFileHandler.cpp | 2 +- .../Miff/src/linux/OutputFileHandler.cpp | 4 +- .../application/Miff/src/linux/miff.cpp | 12 +- .../src/shared/AuctionTransferClient.cpp | 2 +- .../ATGenericAPI/GenericApiCore.cpp | 16 +- .../ATGenericAPI/GenericConnection.cpp | 20 +- .../AuctionTransferAPI.cpp | 10 +- .../AuctionTransferGameAPI/Base/Archive.cpp | 4 +- .../shared/AuctionTransferGameAPI/Request.cpp | 6 +- .../TcpLibrary/IPAddress.h | 2 +- .../TcpLibrary/TcpBlockAllocator.cpp | 6 +- .../TcpLibrary/TcpConnection.cpp | 64 +- .../TcpLibrary/TcpConnection.h | 2 +- .../TcpLibrary/TcpManager.cpp | 106 +- .../TcpLibrary/TcpManager.h | 4 +- .../AuctionTransferGameAPI/zip/GZipHelper.h | 4 +- .../AuctionTransferGameAPI/zip/Zip/zlib.h | 38 +- .../AuctionTransferGameAPI/zip/Zip/zutil.h | 4 +- .../src/shared/CentralCSHandler.h | 2 +- .../src/shared/CentralServer.cpp | 64 +- .../CentralServer/src/shared/CentralServer.h | 2 +- .../src/shared/CentralServerMetricsData.cpp | 10 +- .../src/shared/CharacterCreationTracker.cpp | 8 +- .../src/shared/ConsoleCommandParserGame.cpp | 6 +- .../src/shared/ConsoleManager.cpp | 2 +- .../src/shared/PlanetManager.cpp | 2 +- .../application/ChatServer/src/linux/main.cpp | 2 +- .../src/shared/CentralServerConnection.cpp | 2 +- .../ChatServer/src/shared/ChatInterface.cpp | 144 +-- .../ChatServer/src/shared/ChatServer.cpp | 104 +- .../src/shared/ChatServerRoomOwner.cpp | 2 +- .../ChatServer/src/shared/VChatInterface.cpp | 12 +- .../CommoditiesServer/src/linux/main.cpp | 2 +- .../CommoditiesServer/src/shared/Auction.cpp | 54 +- .../src/shared/AuctionLocation.cpp | 6 +- .../src/shared/AuctionMarket.cpp | 30 +- .../src/shared/CommodityServer.cpp | 10 +- .../src/shared/CommodityServerMetricsData.cpp | 2 +- .../ConnectionServer/src/linux/main.cpp | 2 +- .../src/shared/ClientConnection.cpp | 32 +- .../src/shared/ConnectionServer.cpp | 24 +- .../src/shared/GameConnection.cpp | 4 +- .../src/shared/PseudoClientConnection.cpp | 4 +- .../src/shared/SessionApiClient.cpp | 18 +- .../CustomerServiceServer/src/linux/main.cpp | 2 +- .../src/shared/CentralServerConnection.cpp | 8 +- .../src/shared/ChatServerConnection.cpp | 4 +- .../shared/ConfigCustomerServiceServer.cpp | 12 +- .../src/shared/CustomerServiceInterface.cpp | 104 +- .../src/shared/CustomerServiceServer.cpp | 28 +- .../LogServer/src/shared/LoggingServerApi.cpp | 52 +- .../LoginServer/src/linux/main.cpp | 2 +- .../src/shared/CSToolConnection.cpp | 4 +- .../src/shared/CentralServerConnection.cpp | 4 +- .../src/shared/ClientConnection.cpp | 4 +- .../LoginServer/src/shared/ConsoleManager.cpp | 2 +- .../LoginServer/src/shared/LoginServer.cpp | 30 +- .../LoginServer/src/shared/LoginServer.h | 2 +- .../src/shared/SessionApiClient.cpp | 2 +- .../src/shared/TaskCreateCharacter.cpp | 2 +- .../src/shared/TaskGetCharactersForDelete.cpp | 2 +- .../MetricsServer/src/linux/main.cpp | 2 +- .../src/shared/MetricsGatheringConnection.cpp | 20 +- .../src/shared/MetricsServer.cpp | 4 +- .../PlanetServer/src/linux/main.cpp | 2 +- .../src/shared/ConsoleCommandParser.cpp | 2 +- .../src/shared/ConsoleManager.cpp | 2 +- .../src/shared/GameServerData.cpp | 6 +- .../src/shared/PlanetProxyObject.cpp | 8 +- .../PlanetServer/src/shared/PlanetServer.cpp | 32 +- .../PlanetServer/src/shared/PlanetServer.h | 2 +- .../src/shared/PreloadManager.cpp | 2 +- .../PlanetServer/src/shared/Scene.cpp | 10 +- .../src/linux/main.cpp | 2 +- .../TaskManager/src/linux/ConsoleInput.cpp | 2 +- .../TaskManager/src/linux/ProcessSpawner.cpp | 2 +- .../TaskManager/src/linux/main.cpp | 2 +- .../TaskManager/src/shared/GameConnection.cpp | 2 +- .../TaskManager/src/shared/Locator.cpp | 6 +- .../src/shared/ManagerConnection.cpp | 4 +- .../TaskManager/src/shared/TaskManager.cpp | 10 +- .../src/shared/CTSAPIClient.cpp | 16 +- .../src/shared/ConsoleManager.cpp | 2 +- .../src/shared/TransferServer.cpp | 34 +- .../src/shared/ConsoleManager.cpp | 2 +- .../serverDatabase/src/shared/DataLookup.cpp | 4 +- .../src/shared/DatabaseProcess.cpp | 4 +- .../ImmediateDeleteCustomPersistStep.cpp | 2 +- .../serverDatabase/src/shared/LazyDeleter.cpp | 16 +- .../serverDatabase/src/shared/Loader.cpp | 18 +- .../src/shared/MessageToManager.cpp | 10 +- .../serverDatabase/src/shared/Persister.cpp | 34 +- .../src/shared/TaskGetBiography.cpp | 6 +- .../src/shared/TaskSetBiography.cpp | 2 +- .../src/shared/ai/AggroListProperty.cpp | 16 +- .../src/shared/ai/AiCombatPulseQueue.cpp | 6 +- .../src/shared/ai/AiCreatureCombatProfile.cpp | 10 +- .../src/shared/ai/AiCreatureData.cpp | 12 +- .../src/shared/ai/AiCreatureWeaponActions.cpp | 8 +- .../src/shared/ai/AiMovementArchive.cpp | 6 +- .../src/shared/ai/AiMovementBase.cpp | 26 +- .../src/shared/ai/AiMovementLoiter.cpp | 18 +- .../src/shared/ai/AiMovementMove.cpp | 4 +- .../src/shared/ai/AiMovementPathFollow.cpp | 8 +- .../src/shared/ai/AiMovementPatrol.cpp | 30 +- .../src/shared/ai/AiMovementSwarm.cpp | 28 +- .../src/shared/ai/AiMovementTarget.cpp | 10 +- .../shared/ai/AiMovementWanderInterior.cpp | 16 +- .../src/shared/ai/AiMovementWaypoint.cpp | 4 +- .../src/shared/ai/AiTargetingSystem.cpp | 2 +- .../serverGame/src/shared/ai/Formation.cpp | 4 +- .../serverGame/src/shared/ai/HateList.cpp | 46 +- .../serverGame/src/shared/ai/HateList.h | 2 +- .../serverGame/src/shared/ai/Squad.cpp | 6 +- .../behavior/AiCreatureStateArchive.cpp | 6 +- .../src/shared/behavior/AiLocation.cpp | 44 +- .../behavior/AiShipAttackTargetList.cpp | 22 +- .../behavior/AiShipBehaviorAttackBomber.cpp | 6 +- .../AiShipBehaviorAttackCapitalShip.cpp | 2 +- .../behavior/AiShipBehaviorAttackFighter.cpp | 28 +- .../AiShipBehaviorAttackFighter_Maneuver.cpp | 16 +- .../shared/behavior/AiShipBehaviorDock.cpp | 30 +- .../shared/behavior/AiShipBehaviorFollow.cpp | 18 +- .../shared/behavior/AiShipBehaviorIdle.cpp | 2 +- .../shared/behavior/AiShipBehaviorTrack.cpp | 4 +- .../behavior/AiShipBehaviorWaypoint.cpp | 14 +- .../behavior/ShipTurretTargetingSystem.cpp | 4 +- .../shared/collision/CollisionCallbacks.cpp | 12 +- .../src/shared/command/CommandCppFuncs.cpp | 414 ++++---- .../src/shared/command/CommandQueue.cpp | 38 +- .../src/shared/command/CommandQueue.h | 2 +- .../commoditiesMarket/CommoditiesMarket.cpp | 46 +- .../CommoditiesServerConnection.cpp | 2 +- .../shared/console/ConsoleCommandParserAi.cpp | 78 +- .../console/ConsoleCommandParserCity.cpp | 2 +- .../ConsoleCommandParserCollection.cpp | 56 +- .../console/ConsoleCommandParserCraft.cpp | 4 +- .../ConsoleCommandParserCraftStation.cpp | 30 +- .../console/ConsoleCommandParserGuild.cpp | 10 +- .../ConsoleCommandParserManufacture.cpp | 56 +- .../console/ConsoleCommandParserMoney.cpp | 12 +- .../console/ConsoleCommandParserNpc.cpp | 8 +- .../console/ConsoleCommandParserObject.cpp | 288 ++--- .../console/ConsoleCommandParserObjvar.cpp | 16 +- .../console/ConsoleCommandParserPvp.cpp | 140 +-- .../console/ConsoleCommandParserResource.cpp | 18 +- .../console/ConsoleCommandParserScript.cpp | 12 +- .../console/ConsoleCommandParserServer.cpp | 154 +-- .../console/ConsoleCommandParserShip.cpp | 42 +- .../console/ConsoleCommandParserSkill.cpp | 32 +- .../console/ConsoleCommandParserSpaceAi.cpp | 46 +- .../console/ConsoleCommandParserVeteran.cpp | 6 +- .../src/shared/console/ConsoleManager.cpp | 10 +- .../src/shared/console/ConsoleManager.h | 6 +- .../controller/AiCreatureController.cpp | 204 ++-- .../shared/controller/AiShipController.cpp | 176 ++-- .../controller/AiShipControllerInterface.cpp | 18 +- .../shared/controller/CreatureController.cpp | 48 +- .../shared/controller/PlanetController.cpp | 6 +- .../controller/PlayerCreatureController.cpp | 84 +- .../controller/PlayerShipController.cpp | 18 +- .../shared/controller/ServerController.cpp | 24 +- .../src/shared/controller/ShipController.cpp | 66 +- .../shared/controller/TangibleController.cpp | 22 +- .../src/shared/core/AttribModNameManager.cpp | 20 +- .../src/shared/core/BiographyManager.cpp | 2 +- .../src/shared/core/CharacterMatchManager.cpp | 28 +- .../serverGame/src/shared/core/Client.cpp | 22 +- .../src/shared/core/ClusterWideDataClient.cpp | 2 +- .../src/shared/core/CombatTracker.cpp | 14 +- .../src/shared/core/CommunityManager.cpp | 22 +- .../src/shared/core/ConfigServerGame.cpp | 8 +- .../src/shared/core/ConfigServerGame.h | 2 +- .../src/shared/core/ContainerInterface.cpp | 52 +- .../src/shared/core/FormManagerServer.cpp | 16 +- .../serverGame/src/shared/core/GameServer.cpp | 94 +- .../serverGame/src/shared/core/GameServer.h | 8 +- .../src/shared/core/InstantDeleteList.cpp | 4 +- .../src/shared/core/LogoutTracker.cpp | 4 +- .../src/shared/core/MessageToQueue.cpp | 4 +- .../src/shared/core/NameManager.cpp | 24 +- .../src/shared/core/NewbieTutorial.cpp | 6 +- .../src/shared/core/NpcConversation.cpp | 14 +- .../src/shared/core/ObserveTracker.cpp | 4 +- .../core/PlayerCreationManagerServer.cpp | 4 +- .../src/shared/core/PositionUpdateTracker.cpp | 4 +- .../serverGame/src/shared/core/RegexList.cpp | 6 +- .../src/shared/core/ReportManager.cpp | 6 +- .../src/shared/core/SceneGlobalData.cpp | 2 +- .../shared/core/ServerBuffBuilderManager.cpp | 28 +- .../src/shared/core/ServerBuildoutManager.cpp | 24 +- .../core/ServerImageDesignerManager.cpp | 50 +- .../src/shared/core/ServerUIManager.cpp | 36 +- .../src/shared/core/ServerUIPage.cpp | 12 +- .../src/shared/core/ServerUniverse.cpp | 36 +- .../src/shared/core/ServerWorld.cpp | 84 +- .../src/shared/core/SetupServerGame.cpp | 4 +- .../src/shared/core/StaticLootItemManager.cpp | 8 +- .../src/shared/core/VeteranRewardManager.cpp | 40 +- .../src/shared/guild/GuildInterface.cpp | 20 +- .../shared/metrics/GameServerMetricsData.cpp | 2 +- .../serverGame/src/shared/network/Chat.cpp | 2 +- .../network/ConnectionServerConnection.cpp | 14 +- .../CustomerServiceServerConnection.cpp | 4 +- .../network/GameServerMessageArchive.cpp | 2 +- .../src/shared/object/BuildingObject.cpp | 16 +- .../src/shared/object/CellObject.cpp | 42 +- .../src/shared/object/CityObject.cpp | 20 +- .../src/shared/object/CreatureObject.cpp | 356 +++---- .../src/shared/object/CreatureObject.h | 6 +- .../shared/object/CreatureObject_Mounts.cpp | 42 +- .../shared/object/CreatureObject_Ships.cpp | 8 +- .../shared/object/DraftSchematicObject.cpp | 52 +- .../src/shared/object/FactoryObject.cpp | 146 +-- .../src/shared/object/GroupIdObserver.cpp | 4 +- .../src/shared/object/GroupObject.cpp | 2 +- .../src/shared/object/GuildObject.cpp | 42 +- .../object/HarvesterInstallationObject.cpp | 12 +- .../object/HarvesterInstallationObject.h | 2 +- .../src/shared/object/InstallationObject.cpp | 12 +- .../src/shared/object/IntangibleObject.cpp | 52 +- .../src/shared/object/LineOfSightCache.cpp | 8 +- .../object/ManufactureInstallationObject.cpp | 142 +-- .../object/ManufactureSchematicObject.cpp | 180 ++-- .../src/shared/object/MissionObject.cpp | 22 +- .../src/shared/object/ObjectFactory.cpp | 6 +- .../src/shared/object/ObjectTracker.cpp | 2 +- .../shared/object/PatrolPathNodeProperty.cpp | 2 +- .../src/shared/object/PlanetObject.cpp | 26 +- .../src/shared/object/PlayerObject.cpp | 324 +++--- .../src/shared/object/PlayerObject.h | 18 +- .../src/shared/object/PlayerQuestObject.cpp | 4 +- .../shared/object/ResourceContainerObject.cpp | 22 +- .../src/shared/object/ResourcePoolObject.cpp | 4 +- .../src/shared/object/ResourceTypeObject.cpp | 10 +- .../src/shared/object/ServerObject.cpp | 202 ++-- .../src/shared/object/ServerObject.h | 8 +- .../object/ServerObject_AuthTransfer.cpp | 4 +- .../object/ServerResourceClassObject.cpp | 2 +- .../src/shared/object/ShipObject.cpp | 64 +- .../shared/object/ShipObject_Components.cpp | 50 +- .../src/shared/object/StaticObject.cpp | 14 +- .../object/TangibleConditionObserver.cpp | 8 +- .../src/shared/object/TangibleObject.cpp | 256 ++--- .../src/shared/object/TangibleObject.h | 2 +- .../object/TangibleObject_Conversation.cpp | 34 +- .../src/shared/object/UniverseObject.cpp | 12 +- .../src/shared/object/WeaponObject.cpp | 14 +- .../objectTemplate/ServerArmorTemplate.cpp | 304 +++--- .../ServerBattlefieldMarkerObjectTemplate.cpp | 10 +- .../ServerBuildingObjectTemplate.cpp | 70 +- .../ServerCellObjectTemplate.cpp | 10 +- .../ServerCityObjectTemplate.cpp | 10 +- ...rverConstructionContractObjectTemplate.cpp | 10 +- .../ServerCreatureObjectTemplate.cpp | 558 +++++----- .../ServerDraftSchematicObjectTemplate.cpp | 428 ++++---- .../ServerFactoryObjectTemplate.cpp | 10 +- .../ServerGroupObjectTemplate.cpp | 10 +- .../ServerGuildObjectTemplate.cpp | 10 +- ...verHarvesterInstallationObjectTemplate.cpp | 166 +-- .../ServerInstallationObjectTemplate.cpp | 10 +- .../ServerIntangibleObjectTemplate.cpp | 304 +++--- ...rManufactureInstallationObjectTemplate.cpp | 10 +- ...rverManufactureSchematicObjectTemplate.cpp | 210 ++-- .../ServerMissionObjectTemplate.cpp | 10 +- .../objectTemplate/ServerObjectTemplate.cpp | 992 +++++++++--------- .../ServerPlanetObjectTemplate.cpp | 22 +- .../ServerPlayerObjectTemplate.cpp | 10 +- .../ServerPlayerQuestObjectTemplate.cpp | 10 +- .../ServerResourceContainerObjectTemplate.cpp | 58 +- .../ServerShipObjectTemplate.cpp | 22 +- .../ServerStaticObjectTemplate.cpp | 22 +- .../ServerTangibleObjectTemplate.cpp | 262 ++--- .../ServerUniverseObjectTemplate.cpp | 10 +- .../ServerVehicleObjectTemplate.cpp | 166 +-- .../ServerWeaponObjectTemplate.cpp | 586 +++++------ .../ServerXpManagerObjectTemplate.cpp | 12 +- .../library/serverGame/src/shared/pvp/Pvp.cpp | 6 +- .../src/shared/pvp/PvpRuleSetBase.cpp | 4 +- .../src/shared/pvp/PvpUpdateObserver.cpp | 8 +- .../serverGame/src/shared/region/Region.cpp | 6 +- .../src/shared/region/RegionMaster.cpp | 106 +- .../src/shared/resource/SurveySystem.cpp | 2 +- .../serverGame/src/shared/space/Missile.cpp | 4 +- .../src/shared/space/MissileManager.cpp | 14 +- .../src/shared/space/NebulaManagerServer.cpp | 8 +- .../src/shared/space/ProjectileManager.cpp | 12 +- .../shared/space/ServerAsteroidManager.cpp | 12 +- .../shared/space/ServerShipComponentData.cpp | 10 +- .../shared/space/ShipAiEnemySearchManager.cpp | 6 +- .../space/ShipComponentDataCargoHold.cpp | 2 +- .../shared/space/ShipComponentDataManager.cpp | 10 +- .../space/ShipInternalDamageOverTime.cpp | 10 +- .../ShipInternalDamageOverTimeManager.cpp | 14 +- .../src/shared/space/SpaceAttackSquad.cpp | 28 +- .../src/shared/space/SpaceDockingManager.cpp | 6 +- .../serverGame/src/shared/space/SpacePath.cpp | 8 +- .../src/shared/space/SpacePathManager.cpp | 6 +- .../src/shared/space/SpaceSquad.cpp | 50 +- .../src/shared/space/SpaceSquadManager.cpp | 4 +- .../shared/space/SpaceVisibilityManager.cpp | 12 +- .../InstallationSynchronizedUi.cpp | 4 +- .../src/shared/trading/ServerSecureTrade.cpp | 20 +- .../src/shared/TaskConnectionIdMessage.cpp | 2 +- .../AccountFeatureIdResponse.cpp | 2 +- .../AccountFeatureIdResponse.h | 2 +- .../AdjustAccountFeatureIdResponse.cpp | 2 +- .../AdjustAccountFeatureIdResponse.h | 6 +- .../SceneTransferMessages.cpp | 4 +- .../centralGameServer/SceneTransferMessages.h | 4 +- .../core/SetupServerNetworkMessages.cpp | 2 +- .../gameGameServer/AiCreatureStateMessage.cpp | 6 +- .../gameGameServer/AiMovementMessage.cpp | 4 +- .../GameServerMessageInterface.cpp | 6 +- .../gameGameServer/RenameCharacterMessage.cpp | 4 +- .../src/shared/CityPathGraph.cpp | 74 +- .../src/shared/CityPathGraphManager.cpp | 98 +- .../src/shared/CityPathNode.cpp | 28 +- .../src/shared/PathAutoGenerator.cpp | 14 +- .../src/shared/ServerPathBuilder.cpp | 150 +-- .../src/shared/ServerPathfindingMessaging.cpp | 50 +- .../shared/ServerPathfindingNotification.cpp | 8 +- .../src/shared/GameScriptObject.cpp | 116 +- .../serverScript/src/shared/JNIWrappers.cpp | 28 +- .../serverScript/src/shared/JavaLibrary.cpp | 902 ++++++++-------- .../src/shared/ScriptFunctionTable.cpp | 6 +- .../src/shared/ScriptListEntry.cpp | 8 +- .../serverScript/src/shared/ScriptListEntry.h | 2 +- .../src/shared/ScriptMethodsAi.cpp | 100 +- .../src/shared/ScriptMethodsAnimation.cpp | 14 +- .../src/shared/ScriptMethodsAttributes.cpp | 46 +- .../src/shared/ScriptMethodsAuction.cpp | 22 +- .../src/shared/ScriptMethodsBroadcasting.cpp | 6 +- .../src/shared/ScriptMethodsBuffBuilder.cpp | 6 +- .../src/shared/ScriptMethodsChat.cpp | 12 +- .../src/shared/ScriptMethodsCity.cpp | 2 +- .../src/shared/ScriptMethodsClientEffect.cpp | 90 +- .../shared/ScriptMethodsClusterWideData.cpp | 4 +- .../src/shared/ScriptMethodsCombat.cpp | 158 +-- .../src/shared/ScriptMethodsCommandQueue.cpp | 28 +- .../src/shared/ScriptMethodsConsole.cpp | 4 +- .../src/shared/ScriptMethodsContainers.cpp | 112 +- .../src/shared/ScriptMethodsCrafting.cpp | 230 ++-- .../src/shared/ScriptMethodsDebug.cpp | 12 +- .../shared/ScriptMethodsDynamicVariable.cpp | 110 +- .../src/shared/ScriptMethodsForm.cpp | 4 +- .../src/shared/ScriptMethodsHateList.cpp | 32 +- .../src/shared/ScriptMethodsHolocube.cpp | 4 +- .../src/shared/ScriptMethodsHyperspace.cpp | 36 +- .../src/shared/ScriptMethodsImageDesign.cpp | 10 +- .../src/shared/ScriptMethodsInstallation.cpp | 12 +- .../src/shared/ScriptMethodsInteriors.cpp | 56 +- .../src/shared/ScriptMethodsJedi.cpp | 96 +- .../src/shared/ScriptMethodsMap.cpp | 16 +- .../src/shared/ScriptMethodsMentalStates.cpp | 4 +- .../src/shared/ScriptMethodsMission.cpp | 104 +- .../src/shared/ScriptMethodsMoney.cpp | 18 +- .../src/shared/ScriptMethodsMount.cpp | 6 +- .../shared/ScriptMethodsNewbieTutorial.cpp | 2 +- .../src/shared/ScriptMethodsNotification.cpp | 6 +- .../src/shared/ScriptMethodsNpc.cpp | 30 +- .../src/shared/ScriptMethodsObjectCreate.cpp | 124 +-- .../src/shared/ScriptMethodsObjectInfo.cpp | 434 ++++---- .../src/shared/ScriptMethodsObjectMove.cpp | 64 +- .../src/shared/ScriptMethodsPermissions.cpp | 8 +- .../src/shared/ScriptMethodsPilot.cpp | 74 +- .../src/shared/ScriptMethodsPlayerAccount.cpp | 42 +- .../src/shared/ScriptMethodsPlayerQuest.cpp | 30 +- .../src/shared/ScriptMethodsPvp.cpp | 16 +- .../src/shared/ScriptMethodsQuest.cpp | 28 +- .../src/shared/ScriptMethodsRegion.cpp | 140 +-- .../src/shared/ScriptMethodsRegion3d.cpp | 2 +- .../src/shared/ScriptMethodsResource.cpp | 74 +- .../src/shared/ScriptMethodsScript.cpp | 26 +- .../src/shared/ScriptMethodsServerUI.cpp | 18 +- .../src/shared/ScriptMethodsShip.cpp | 102 +- .../src/shared/ScriptMethodsSkill.cpp | 92 +- .../src/shared/ScriptMethodsString.cpp | 6 +- .../src/shared/ScriptMethodsSystem.cpp | 10 +- .../src/shared/ScriptMethodsTerrain.cpp | 70 +- .../src/shared/ScriptMethodsVeteran.cpp | 38 +- .../src/shared/ScriptMethodsWaypoint.cpp | 2 +- .../src/shared/ScriptMethodsWorldInfo.cpp | 86 +- .../src/shared/ScriptParamArchive.cpp | 2 +- .../src/shared/ScriptParameters.cpp | 4 +- .../src/shared/ScriptParameters.h | 2 +- .../src/shared/AdminAccountManager.cpp | 4 +- .../src/shared/ChatLogManager.cpp | 2 +- .../src/shared/ClusterWideDataManagerList.cpp | 6 +- .../src/shared/FreeCtsDataTable.cpp | 32 +- .../src/shared/DataTableTool.cpp | 2 +- .../src/shared/TemplateCompiler.cpp | 30 +- .../core/TemplateDefinitionCompiler.cpp | 26 +- .../src/shared/core/BarrierObject.cpp | 6 +- .../src/shared/core/BoxTree.cpp | 50 +- .../sharedCollision/src/shared/core/BoxTree.h | 2 +- .../src/shared/core/CollisionBuckets.cpp | 2 +- .../src/shared/core/CollisionMesh.cpp | 12 +- .../src/shared/core/CollisionNotification.cpp | 2 +- .../src/shared/core/CollisionProperty.cpp | 92 +- .../src/shared/core/CollisionResolve.cpp | 24 +- .../src/shared/core/CollisionResolve.h | 10 +- .../src/shared/core/CollisionUtils.cpp | 52 +- .../src/shared/core/CollisionWorld.cpp | 110 +- .../src/shared/core/ConfigSharedCollision.cpp | 4 +- .../src/shared/core/Contact3d.h | 6 +- .../src/shared/core/ContactPoint.cpp | 6 +- .../src/shared/core/DoorObject.cpp | 26 +- .../sharedCollision/src/shared/core/Floor.cpp | 26 +- .../src/shared/core/FloorLocator.cpp | 24 +- .../src/shared/core/FloorManager.cpp | 8 +- .../src/shared/core/FloorMesh.cpp | 78 +- .../src/shared/core/Footprint.cpp | 42 +- .../core/FootprintForceReattachManager.cpp | 2 +- .../src/shared/core/MultiList.cpp | 72 +- .../src/shared/core/MultiList.h | 20 +- .../src/shared/core/NeighborObject.cpp | 2 +- .../src/shared/core/SimpleCollisionMesh.cpp | 4 +- .../src/shared/core/SpatialDatabase.cpp | 68 +- .../src/shared/extent/BoxExtent.cpp | 2 +- .../src/shared/extent/CollisionDetect.cpp | 38 +- .../src/shared/extent/CollisionDetect.h | 8 +- .../src/shared/extent/CompositeExtent.cpp | 6 +- .../src/shared/extent/CylinderExtent.cpp | 2 +- .../src/shared/extent/DetailExtent.cpp | 4 +- .../src/shared/extent/Extent.cpp | 2 +- .../src/shared/extent/ExtentList.cpp | 10 +- .../src/shared/extent/MeshExtent.cpp | 10 +- .../shared/extent/OrientedCylinderExtent.cpp | 2 +- .../src/shared/extent/SimpleExtent.cpp | 2 +- .../src/shared/BitStream.cpp | 44 +- .../sharedCompression/src/shared/Lz77.cpp | 10 +- .../src/shared/ZlibCompressor.cpp | 16 +- .../src/shared/core/Bindable.h | 10 +- .../src/shared/core/DbBindableBase.h | 2 +- .../src/shared/core/DbBindableBool.h | 2 +- .../src/shared/core/DbBindableString.h | 10 +- .../src/shared/core/DbBindableUnicode.h | 2 +- .../src/shared/core/DbBufferRow.h | 4 +- .../src/shared/core/DbServer.cpp | 8 +- .../shared/core/NullEncodedStandardString.h | 2 +- .../shared/core/NullEncodedUnicodeString.h | 2 +- .../src_oci/DbBindableVarray.cpp | 30 +- .../src_oci/OciQueryImplementation.cpp | 18 +- .../src_oci/OciServer.cpp | 2 +- .../src_oci/OciSession.cpp | 20 +- .../sharedDebug/src/linux/DebugMonitor.cpp | 2 +- .../src/linux/PerformanceTimer.cpp | 10 +- .../sharedDebug/src/shared/DataLint.cpp | 64 +- .../sharedDebug/src/shared/DebugFlags.cpp | 18 +- .../sharedDebug/src/shared/DebugKey.cpp | 2 +- .../sharedDebug/src/shared/InstallTimer.cpp | 2 +- .../sharedDebug/src/shared/PixCounter.cpp | 12 +- .../sharedDebug/src/shared/Profiler.cpp | 32 +- .../sharedDebug/src/shared/RemoteDebug.cpp | 16 +- .../sharedDebug/src/shared/RemoteDebug.h | 4 +- .../src/shared/RemoteDebug_inner.cpp | 26 +- .../src/shared/RemoteDebug_inner.h | 4 +- .../library/sharedDebug/src/shared/Report.cpp | 4 +- .../src/shared/AsynchronousLoader.cpp | 38 +- .../sharedFile/src/shared/FileManifest.cpp | 10 +- .../sharedFile/src/shared/FileNameUtils.cpp | 8 +- .../sharedFile/src/shared/FileStreamer.cpp | 10 +- .../src/shared/FileStreamerFile.cpp | 4 +- .../src/shared/FileStreamerThread.cpp | 38 +- .../library/sharedFile/src/shared/Iff.cpp | 34 +- .../library/sharedFile/src/shared/Iff.h | 4 +- .../src/shared/IndentedFileWriter.cpp | 14 +- .../sharedFile/src/shared/MemoryFile.cpp | 8 +- .../sharedFile/src/shared/TreeFile.cpp | 40 +- .../src/shared/TreeFile_SearchNode.cpp | 42 +- .../sharedFile/src/shared/ZlibFile.cpp | 8 +- .../library/sharedFoundation/src/linux/Os.cpp | 12 +- .../src/linux/PerThreadData.cpp | 8 +- .../src/linux/PerThreadData.h | 8 +- .../src/linux/PlatformGlue.cpp | 6 +- .../sharedFoundation/src/linux/PlatformGlue.h | 6 +- .../src/linux/SetupSharedFoundation.cpp | 12 +- .../sharedFoundation/src/linux/vsnprintf.cpp | 2 +- .../sharedFoundation/src/shared/BitArray.cpp | 4 +- .../sharedFoundation/src/shared/BitArray.h | 2 +- .../src/shared/CalendarTime.cpp | 18 +- .../src/shared/CommandLine.cpp | 78 +- .../sharedFoundation/src/shared/CommandLine.h | 2 +- .../src/shared/ConfigFile.cpp | 50 +- .../sharedFoundation/src/shared/ConfigFile.h | 2 +- .../src/shared/CrashReportInformation.cpp | 2 +- .../sharedFoundation/src/shared/Crc.cpp | 2 +- .../src/shared/CrcStringTable.cpp | 14 +- .../src/shared/DataResourceList.h | 30 +- .../sharedFoundation/src/shared/ExitChain.cpp | 12 +- .../sharedFoundation/src/shared/Fatal.cpp | 6 +- .../sharedFoundation/src/shared/Fatal.h | 8 +- .../src/shared/FormattedString.h | 4 +- .../sharedFoundation/src/shared/LabelHash.cpp | 4 +- .../src/shared/MemoryBlockManager.cpp | 16 +- .../src/shared/MessageQueue.cpp | 4 +- .../sharedFoundation/src/shared/Misc.h | 20 +- .../src/shared/PersistentCrcString.cpp | 38 +- .../library/sharedFoundation/src/shared/Tag.h | 4 +- .../sharedFoundation/src/shared/Watcher.cpp | 4 +- .../sharedFoundation/src/shared/Watcher.h | 14 +- .../dynamicVariable/DynamicVariable.cpp | 96 +- .../shared/dynamicVariable/DynamicVariable.h | 4 +- .../appearance/WearableAppearanceMap.cpp | 12 +- .../collision/CollisionCallbackManager.cpp | 10 +- .../src/shared/core/AiDebugString.cpp | 2 +- .../shared/core/AssetCustomizationManager.cpp | 26 +- .../src/shared/core/CitizenRankDataTable.cpp | 6 +- .../src/shared/core/CollectionsDataTable.cpp | 38 +- .../CommoditiesAdvancedSearchAttribute.cpp | 6 +- .../src/shared/core/CustomizationManager.cpp | 6 +- .../src/shared/core/FormManager.cpp | 32 +- .../src/shared/core/GameScheduler.cpp | 2 +- .../src/shared/core/GroundZoneManager.cpp | 6 +- .../src/shared/core/GuildRankDataTable.cpp | 8 +- .../src/shared/core/LfgCharacterData.cpp | 2 +- .../src/shared/core/LfgDataTable.cpp | 24 +- .../sharedGame/src/shared/core/LfgDataTable.h | 2 +- .../src/shared/core/PlayerCreationManager.cpp | 4 +- .../shared/core/SharedBuffBuilderManager.cpp | 2 +- .../shared/core/SharedBuildoutAreaManager.cpp | 16 +- .../core/SharedImageDesignerManager.cpp | 2 +- .../sharedGame/src/shared/core/Universe.cpp | 6 +- .../src/shared/core/WearableEntry.cpp | 2 +- .../mount/MountValidScaleRangeTable.cpp | 4 +- .../src/shared/mount/SharedSaddleManager.cpp | 2 +- .../src/shared/object/ResourceClassObject.cpp | 34 +- .../src/shared/object/ResourceClassObject.h | 2 +- .../sharedGame/src/shared/object/Waypoint.cpp | 2 +- .../SharedBattlefieldMarkerObjectTemplate.cpp | 106 +- .../SharedBuildingObjectTemplate.cpp | 34 +- .../SharedCellObjectTemplate.cpp | 10 +- ...aredConstructionContractObjectTemplate.cpp | 10 +- .../SharedCreatureObjectTemplate.cpp | 774 +++++++------- .../SharedDraftSchematicObjectTemplate.cpp | 202 ++-- .../SharedFactoryObjectTemplate.cpp | 10 +- .../SharedGroupObjectTemplate.cpp | 10 +- .../SharedGuildObjectTemplate.cpp | 10 +- .../SharedInstallationObjectTemplate.cpp | 10 +- .../SharedIntangibleObjectTemplate.cpp | 10 +- .../SharedJediManagerObjectTemplate.cpp | 10 +- ...aredManufactureSchematicObjectTemplate.cpp | 10 +- .../SharedMissionObjectTemplate.cpp | 10 +- .../objectTemplate/SharedObjectTemplate.cpp | 494 ++++----- .../SharedPlayerObjectTemplate.cpp | 10 +- .../SharedPlayerQuestObjectTemplate.cpp | 10 +- .../SharedResourceContainerObjectTemplate.cpp | 10 +- .../SharedShipObjectTemplate.cpp | 58 +- .../SharedStaticObjectTemplate.cpp | 10 +- .../SharedTangibleObjectTemplate.cpp | 546 +++++----- .../SharedTerrainSurfaceObjectTemplate.cpp | 70 +- .../SharedUniverseObjectTemplate.cpp | 10 +- .../SharedVehicleObjectTemplate.cpp | 334 +++--- .../SharedWaypointObjectTemplate.cpp | 10 +- .../SharedWeaponObjectTemplate.cpp | 82 +- .../sharedGame/src/shared/quest/Quest.cpp | 2 +- .../src/shared/quest/QuestManager.cpp | 8 +- .../space/AsteroidGenerationManager.cpp | 12 +- .../src/shared/space/NebulaManager.cpp | 16 +- .../src/shared/space/ShipChassis.cpp | 16 +- .../src/shared/space/ShipChassisSlot.cpp | 4 +- .../src/shared/space/ShipChassisWritable.cpp | 4 +- .../space/ShipComponentAttachmentManager.cpp | 14 +- .../src/shared/space/ShipComponentData.cpp | 2 +- .../shared/space/ShipComponentDescriptor.cpp | 26 +- .../space/ShipComponentDescriptorWritable.cpp | 2 +- .../space/ShipComponentWeaponManager.cpp | 4 +- .../sharedGame/src/shared/sui/SuiPageData.cpp | 10 +- .../sharedImage/src/shared/TargaFormat.cpp | 4 +- .../library/sharedIoWin/src/shared/IoWin.cpp | 6 +- .../sharedIoWin/src/shared/IoWinManager.cpp | 44 +- .../sharedIoWin/src/shared/IoWinManager.h | 2 +- .../sharedMath/src/shared/MxCifQuadTree.cpp | 42 +- .../src/shared/MxCifQuadTreeBounds.h | 4 +- .../library/sharedMath/src/shared/Plane.cpp | 22 +- .../sharedMath/src/shared/Quaternion.cpp | 2 +- .../sharedMath/src/shared/SphereTreeNode.h | 6 +- .../sharedMath/src/shared/Transform.cpp | 18 +- .../library/sharedMath/src/shared/Vector.cpp | 4 +- .../src/shared/debug/DebugShapeRenderer.cpp | 6 +- .../src/shared/MemoryManager.cpp | 42 +- .../src/shared/Emitter.cpp | 2 +- .../src/shared/Receiver.cpp | 2 +- .../sharedNetwork/src/linux/TcpClient.cpp | 4 +- .../sharedNetwork/src/shared/Service.cpp | 4 +- .../core/SetupSharedNetworkMessages.cpp | 2 +- .../src/shared/ObjectWatcherList.cpp | 12 +- .../src/shared/appearance/Appearance.cpp | 38 +- .../src/shared/appearance/Appearance.h | 2 +- .../shared/appearance/AppearanceTemplate.cpp | 16 +- .../appearance/AppearanceTemplateList.cpp | 16 +- .../container/ArrangementDescriptorList.cpp | 2 +- .../shared/container/ContainedByProperty.cpp | 2 +- .../src/shared/container/Container.cpp | 12 +- .../src/shared/container/SlotIdManager.cpp | 6 +- .../src/shared/container/SlottedContainer.cpp | 2 +- .../src/shared/container/VolumeContainer.cpp | 4 +- .../src/shared/container/VolumeContainer.h | 4 +- .../src/shared/controller/Controller.cpp | 14 +- .../src/shared/core/SetupSharedObject.cpp | 2 +- .../src/shared/core/SetupSharedObject.h | 2 +- .../customization/CustomizationData.cpp | 8 +- .../CustomizationData_LocalDirectory.cpp | 26 +- .../customization/CustomizationIdManager.cpp | 2 +- .../ObjectTemplateCustomizationDataWriter.cpp | 2 +- .../src/shared/lot/LotManager.cpp | 8 +- .../src/shared/object/AlterScheduler.cpp | 54 +- .../src/shared/object/CachedNetworkId.cpp | 12 +- .../sharedObject/src/shared/object/Object.cpp | 196 ++-- .../sharedObject/src/shared/object/Object.h | 18 +- .../src/shared/object/ObjectList.cpp | 10 +- .../src/shared/object/ObjectTemplate.cpp | 8 +- .../src/shared/object/ObjectTemplateList.cpp | 4 +- .../src/shared/object/ScheduleData.cpp | 12 +- .../src/shared/portal/CellProperty.cpp | 100 +- .../sharedObject/src/shared/portal/Portal.cpp | 20 +- .../src/shared/portal/PortalProperty.cpp | 14 +- .../shared/portal/PortalPropertyTemplate.cpp | 32 +- .../src/shared/portal/SphereGrid.h | 6 +- .../src/shared/property/LayerProperty.cpp | 6 +- .../sharedObject/src/shared/world/World.cpp | 4 +- .../src/shared/DynamicPathGraph.cpp | 36 +- .../src/shared/DynamicPathGraph.h | 2 +- .../src/shared/DynamicPathNode.cpp | 6 +- .../src/shared/PathGraph.cpp | 10 +- .../src/shared/PathGraphIterator.cpp | 10 +- .../sharedPathfinding/src/shared/PathNode.cpp | 4 +- .../src/shared/PathSearch.cpp | 42 +- .../src/shared/Pathfinding.cpp | 2 +- .../src/shared/SetupSharedPathfinding.cpp | 6 +- .../src/shared/SimplePathGraph.cpp | 26 +- .../src/shared/SharedRemoteDebugServer.cpp | 8 +- .../SharedRemoteDebugServerConnection.cpp | 4 +- .../src/shared/ExpertiseManager.cpp | 2 +- .../src/shared/LevelManager.cpp | 4 +- .../src/shared/SkillManager.cpp | 10 +- .../shared/template/ServerArmorTemplate.cpp | 48 +- .../ServerBattlefieldMarkerObjectTemplate.cpp | 10 +- .../template/ServerBuildingObjectTemplate.cpp | 22 +- .../template/ServerCellObjectTemplate.cpp | 10 +- .../template/ServerCityObjectTemplate.cpp | 10 +- ...rverConstructionContractObjectTemplate.cpp | 10 +- .../template/ServerCreatureObjectTemplate.cpp | 80 +- .../ServerDraftSchematicObjectTemplate.cpp | 94 +- .../template/ServerFactoryObjectTemplate.cpp | 10 +- .../template/ServerGroupObjectTemplate.cpp | 10 +- .../template/ServerGuildObjectTemplate.cpp | 10 +- ...verHarvesterInstallationObjectTemplate.cpp | 30 +- .../ServerInstallationObjectTemplate.cpp | 10 +- .../ServerIntangibleObjectTemplate.cpp | 70 +- .../ServerJediManagerObjectTemplate.cpp | 10 +- ...rManufactureInstallationObjectTemplate.cpp | 10 +- ...rverManufactureSchematicObjectTemplate.cpp | 48 +- .../template/ServerMissionObjectTemplate.cpp | 10 +- .../shared/template/ServerObjectTemplate.cpp | 160 +-- .../template/ServerPlanetObjectTemplate.cpp | 16 +- .../template/ServerPlayerObjectTemplate.cpp | 10 +- .../ServerPlayerQuestObjectTemplate.cpp | 10 +- .../ServerResourceClassObjectTemplate.cpp | 34 +- .../ServerResourceContainerObjectTemplate.cpp | 16 +- .../ServerResourcePoolObjectTemplate.cpp | 20 +- .../ServerResourceTypeObjectTemplate.cpp | 16 +- .../template/ServerShipObjectTemplate.cpp | 16 +- .../template/ServerStaticObjectTemplate.cpp | 16 +- .../template/ServerTangibleObjectTemplate.cpp | 50 +- .../template/ServerTokenObjectTemplate.cpp | 10 +- .../template/ServerUberObjectTemplate.cpp | 390 +++---- .../template/ServerUniverseObjectTemplate.cpp | 10 +- .../template/ServerVehicleObjectTemplate.cpp | 30 +- .../template/ServerWaypointObjectTemplate.cpp | 10 +- .../template/ServerWeaponObjectTemplate.cpp | 74 +- .../ServerXpManagerObjectTemplate.cpp | 10 +- .../SharedBattlefieldMarkerObjectTemplate.cpp | 22 +- .../template/SharedBuildingObjectTemplate.cpp | 20 +- .../template/SharedCellObjectTemplate.cpp | 10 +- ...aredConstructionContractObjectTemplate.cpp | 10 +- .../template/SharedCreatureObjectTemplate.cpp | 106 +- .../SharedDraftSchematicObjectTemplate.cpp | 54 +- .../template/SharedFactoryObjectTemplate.cpp | 10 +- .../template/SharedGroupObjectTemplate.cpp | 10 +- .../template/SharedGuildObjectTemplate.cpp | 10 +- .../SharedInstallationObjectTemplate.cpp | 10 +- .../SharedIntangibleObjectTemplate.cpp | 10 +- .../SharedJediManagerObjectTemplate.cpp | 10 +- ...aredManufactureSchematicObjectTemplate.cpp | 10 +- .../template/SharedMissionObjectTemplate.cpp | 10 +- .../shared/template/SharedObjectTemplate.cpp | 108 +- .../template/SharedPlayerObjectTemplate.cpp | 10 +- .../SharedPlayerQuestObjectTemplate.cpp | 10 +- .../SharedResourceContainerObjectTemplate.cpp | 10 +- .../template/SharedShipObjectTemplate.cpp | 30 +- .../template/SharedStaticObjectTemplate.cpp | 10 +- .../template/SharedTangibleObjectTemplate.cpp | 114 +- .../SharedTerrainSurfaceObjectTemplate.cpp | 22 +- .../template/SharedTokenObjectTemplate.cpp | 10 +- .../template/SharedUniverseObjectTemplate.cpp | 10 +- .../template/SharedVehicleObjectTemplate.cpp | 40 +- .../template/SharedWaypointObjectTemplate.cpp | 10 +- .../template/SharedWeaponObjectTemplate.cpp | 26 +- .../src/shared/core/File.cpp | 12 +- .../src/shared/core/File.h | 14 +- .../src/shared/core/Filename.cpp | 44 +- .../src/shared/core/Filename.h | 10 +- .../src/shared/core/ObjectTemplate.cpp | 12 +- .../src/shared/core/TemplateData.cpp | 356 +++---- .../src/shared/core/TemplateData.h | 6 +- .../src/shared/core/TemplateDataIterator.cpp | 18 +- .../shared/core/TemplateDefinitionFile.cpp | 40 +- .../src/shared/core/TemplateDefinitionFile.h | 2 +- .../src/shared/core/TemplateGlobals.cpp | 32 +- .../src/shared/core/TpfFile.cpp | 164 +-- .../src/shared/core/TpfTemplate.cpp | 64 +- .../ProceduralTerrainAppearance.cpp | 18 +- .../SamplerProceduralTerrainAppearance.cpp | 2 +- .../ServerProceduralTerrainAppearance.cpp | 2 +- .../src/shared/appearance/TerrainQuadTree.cpp | 12 +- .../src/shared/appearance/TerrainQuadTree.h | 2 +- .../src/shared/core/WaterTypeManager.cpp | 8 +- .../src/shared/generator/BitmapGroup.cpp | 2 +- .../src/shared/generator/ShaderGroup.cpp | 2 +- .../src/shared/object/TerrainObject.cpp | 2 +- .../src/shared/CachedFileManager.cpp | 10 +- .../src/shared/CurrentUserOptionManager.cpp | 4 +- .../sharedUtility/src/shared/DataTable.cpp | 14 +- .../src/shared/DataTableColumnType.cpp | 6 +- .../src/shared/DataTableManager.cpp | 8 +- .../src/shared/DataTableWriter.cpp | 4 +- .../sharedUtility/src/shared/FileName.cpp | 4 +- .../sharedUtility/src/shared/RotaryCache.cpp | 10 +- .../src/shared/SetupSharedUtility.cpp | 2 +- .../src/shared/TemplateParameter.cpp | 12 +- .../src/shared/TemplateParameter.h | 28 +- .../src/shared/ValueDictionary.cpp | 2 +- .../src/shared/ValueDictionaryArchive.cpp | 4 +- .../src/shared/tree/XmlTreeDocument.cpp | 10 +- .../src/shared/tree/XmlTreeDocumentList.cpp | 8 +- .../sharedXml/src/shared/tree/XmlTreeNode.cpp | 48 +- .../platform/projects/MonAPI2/MonitorAPI.cpp | 30 +- .../platform/projects/MonAPI2/MonitorAPI.h | 10 +- .../platform/projects/MonAPI2/MonitorData.cpp | 18 +- .../platform/projects/MonAPI2/MonitorData.h | 8 +- .../Session/CommonAPI/CommonClient.cpp | 4 +- .../projects/Session/LoginAPI/ClientCore.cpp | 8 +- .../library/platform/utils/Base/Archive.cpp | 4 +- .../library/platform/utils/Base/AutoLog.cpp | 30 +- .../3rd/library/platform/utils/Base/AutoLog.h | 4 +- .../library/platform/utils/Base/Config.cpp | 26 +- .../3rd/library/platform/utils/Base/Config.h | 24 +- .../library/platform/utils/Base/Statistics.h | 4 +- .../utils/Base/TemplateObjectAllocator.h | 4 +- .../utils/Base/linux/BlockAllocator.cpp | 8 +- .../platform/utils/Base/linux/Event.cpp | 6 +- .../platform/utils/Base/linux/Logger.cpp | 18 +- .../platform/utils/Base/linux/Thread.cpp | 12 +- .../CSAssistStressTest/test.cpp | 54 +- .../CSAssistgameapi/CSAssistgameapicore.cpp | 72 +- .../CSAssistgameapi/CSAssistgameapicore.h | 4 +- .../CSAssistgameapi/CSAssistreceiver.cpp | 6 +- .../CSAssistgameapi/CSAssisttest/test.cpp | 12 +- .../CSAssist/CSAssistgameapi/packdata.cpp | 2 +- .../CSAssist/utils/Base/Archive.cpp | 4 +- .../CSAssist/utils/Base/AutoLog.cpp | 30 +- .../soePlatform/CSAssist/utils/Base/AutoLog.h | 4 +- .../CSAssist/utils/Base/Config.cpp | 26 +- .../soePlatform/CSAssist/utils/Base/Config.h | 24 +- .../CSAssist/utils/Base/Logger.cpp | 24 +- .../CSAssist/utils/Base/Statistics.h | 4 +- .../utils/Base/TemplateObjectAllocator.h | 4 +- .../CSAssist/utils/Base/WideString.h | 60 +- .../utils/Base/linux/BlockAllocator.cpp | 8 +- .../CSAssist/utils/Base/linux/Event.cpp | 6 +- .../CSAssist/utils/Base/linux/Thread.cpp | 12 +- .../CSAssist/utils/Base/serialize.h | 6 +- .../CSAssist/utils/TcpLibrary/IPAddress.h | 2 +- .../utils/TcpLibrary/TcpBlockAllocator.cpp | 6 +- .../utils/TcpLibrary/TcpConnection.cpp | 64 +- .../CSAssist/utils/TcpLibrary/TcpConnection.h | 2 +- .../CSAssist/utils/TcpLibrary/TcpManager.cpp | 106 +- .../CSAssist/utils/TcpLibrary/TcpManager.h | 4 +- .../TcpLibrary/TestClient/TestClient.cpp | 10 +- .../utils/Unicode/UnicodeCharacterDataMap.h | 2 +- .../CSAssist/utils/Unicode/utf8.cpp | 2 +- .../CTServiceGameAPI/Base/Archive.cpp | 4 +- .../CTGenericAPI/GenericApiCore.cpp | 16 +- .../CTGenericAPI/GenericConnection.cpp | 20 +- .../CTServiceGameAPI/CTServiceAPI.cpp | 4 +- .../CTServiceGameAPI/TcpLibrary/IPAddress.h | 2 +- .../TcpLibrary/TcpBlockAllocator.cpp | 6 +- .../TcpLibrary/TcpConnection.cpp | 64 +- .../TcpLibrary/TcpConnection.h | 2 +- .../TcpLibrary/TcpManager.cpp | 106 +- .../CTServiceGameAPI/TcpLibrary/TcpManager.h | 4 +- .../CTServiceGameAPI/TestClient/Main.cpp | 2 +- .../Unicode/UnicodeCharacterDataMap.h | 2 +- .../CTServiceGameAPI/test/main.cpp | 2 +- .../projects/ChatAPI/AvatarIteratorCore.cpp | 24 +- .../projects/ChatAPI/AvatarListItemCore.cpp | 4 +- .../ChatAPI/projects/ChatAPI/ChatAPI.cpp | 12 +- .../ChatAPI/projects/ChatAPI/ChatAPI.h | 12 +- .../ChatAPI/projects/ChatAPI/ChatAPICore.cpp | 172 +-- .../ChatAPI/projects/ChatAPI/ChatEnum.cpp | 2 +- .../projects/ChatAPI/ChatFriendStatusCore.cpp | 4 +- .../projects/ChatAPI/ChatIgnoreStatusCore.cpp | 4 +- .../ChatAPI/projects/ChatAPI/ChatRoom.cpp | 2 +- .../ChatAPI/projects/ChatAPI/ChatRoomCore.cpp | 46 +- .../ChatAPI/projects/ChatAPI/Message.cpp | 8 +- .../projects/ChatAPI/PersistentMessage.cpp | 4 +- .../ChatAPI/projects/ChatAPI/Request.cpp | 4 +- .../ChatAPI/projects/ChatAPI/Response.cpp | 72 +- .../ChatAPI/utils/Base/Archive.cpp | 4 +- .../ChatAPI/utils/Base/AutoLog.cpp | 30 +- .../soePlatform/ChatAPI/utils/Base/AutoLog.h | 4 +- .../ChatAPI/utils/Base/CmdLine.cpp | 4 +- .../soePlatform/ChatAPI/utils/Base/Config.cpp | 26 +- .../soePlatform/ChatAPI/utils/Base/Config.h | 24 +- .../soePlatform/ChatAPI/utils/Base/Logger.cpp | 28 +- .../ChatAPI/utils/Base/Statistics.h | 4 +- .../utils/Base/TemplateObjectAllocator.h | 4 +- .../ChatAPI/utils/Base/WideString.h | 60 +- .../utils/Base/linux/BlockAllocator.cpp | 8 +- .../ChatAPI/utils/Base/linux/Event.cpp | 6 +- .../ChatAPI/utils/Base/linux/Thread.cpp | 12 +- .../ChatAPI/utils/Base/serialize.h | 6 +- .../utils/GenericAPI/GenericApiCore.cpp | 16 +- .../utils/GenericAPI/GenericConnection.cpp | 20 +- .../utils/UdpLibrary/UdpConnection.cpp | 90 +- .../ChatAPI/utils/UdpLibrary/UdpConnection.h | 24 +- .../utils/UdpLibrary/UdpDriverLinux.cpp | 16 +- .../utils/UdpLibrary/UdpDriverWindows.cpp | 16 +- .../ChatAPI/utils/UdpLibrary/UdpHashTable.h | 92 +- .../ChatAPI/utils/UdpLibrary/UdpLinkedList.h | 50 +- .../utils/UdpLibrary/UdpLogicalPacket.cpp | 18 +- .../utils/UdpLibrary/UdpLogicalPacket.h | 10 +- .../ChatAPI/utils/UdpLibrary/UdpManager.cpp | 144 +-- .../ChatAPI/utils/UdpLibrary/UdpManager.h | 26 +- .../ChatAPI/utils/UdpLibrary/UdpMisc.cpp | 28 +- .../ChatAPI/utils/UdpLibrary/UdpMisc.h | 4 +- .../ChatAPI/utils/UdpLibrary/UdpPriority.h | 18 +- .../utils/UdpLibrary/UdpReliableChannel.cpp | 72 +- .../utils/UdpLibrary/UdpReliableChannel.h | 4 +- .../utils/Unicode/UnicodeCharacterDataMap.h | 2 +- .../ChatAPI/utils/Unicode/utf8.cpp | 2 +- .../projects/VChat/VChatAPI/common.cpp | 28 +- .../VChat/VChatUnitTest/VChatClient.cpp | 28 +- .../VChatAPI/utils2.0/utils/Api/api.cpp | 16 +- .../VChatAPI/utils2.0/utils/Api/api.h | 2 +- .../utils2.0/utils/Api/apiMessages.cpp | 22 +- .../VChatAPI/utils2.0/utils/Api/apiMessages.h | 6 +- .../VChatAPI/utils2.0/utils/Api/apiPinned.cpp | 4 +- .../VChatAPI/utils2.0/utils/Base/cmdLine.cpp | 4 +- .../VChatAPI/utils2.0/utils/Base/date.cpp | 2 +- .../VChatAPI/utils2.0/utils/Base/dateUtils.h | 4 +- .../utils/Base/genericRateLimitingMechanism.h | 6 +- .../utils2.0/utils/Base/hashtable.hpp | 100 +- .../VChatAPI/utils2.0/utils/Base/log.cpp | 24 +- .../utils2.0/utils/Base/monitorAPI.cpp | 28 +- .../VChatAPI/utils2.0/utils/Base/monitorAPI.h | 4 +- .../utils2.0/utils/Base/monitorData.cpp | 18 +- .../utils2.0/utils/Base/monitorData.h | 6 +- .../VChatAPI/utils2.0/utils/Base/priority.hpp | 18 +- .../utils2.0/utils/Base/stringutils.cpp | 4 +- .../utils2.0/utils/Base/stringutils.h | 2 +- .../utils2.0/utils/Base/substringSearchTree.h | 54 +- .../VChatAPI/utils2.0/utils/Base/thread.cpp | 16 +- .../VChatAPI/utils2.0/utils/Base/utf8.cpp | 2 +- .../utils2.0/utils/TcpLibrary/IPAddress.h | 2 +- .../utils/TcpLibrary/TcpBlockAllocator.cpp | 6 +- .../utils/TcpLibrary/TcpConnection.cpp | 64 +- .../utils2.0/utils/TcpLibrary/TcpConnection.h | 2 +- .../utils2.0/utils/TcpLibrary/TcpManager.cpp | 110 +- .../utils2.0/utils/TcpLibrary/TcpManager.h | 4 +- .../utils2.0/utils/UdpLibrary/UdpLibrary.cpp | 434 ++++---- .../utils2.0/utils/UdpLibrary/UdpLibrary.hpp | 42 +- .../3rd/library/udplibrary/PointerDeque.hpp | 14 +- .../3rd/library/udplibrary/UdpLibrary.cpp | 428 ++++---- .../3rd/library/udplibrary/UdpLibrary.hpp | 42 +- external/3rd/library/udplibrary/hashtable.hpp | 100 +- external/3rd/library/udplibrary/priority.hpp | 18 +- external/3rd/library/udplibrary/udpclient.cpp | 4 +- external/3rd/library/udplibrary/udpserver.cpp | 2 +- .../src/shared/AutoDeltaVariableCallback.h | 2 +- .../library/archive/src/shared/ByteStream.cpp | 2 +- .../library/archive/src/shared/ByteStream.h | 2 +- .../crypto/src/shared/original/cryptlib.h | 2 +- .../crypto/src/shared/original/filters.cpp | 8 +- .../crypto/src/shared/original/filters.h | 32 +- .../crypto/src/shared/original/queue.cpp | 2 +- .../crypto/src/shared/original/smartptr.h | 18 +- .../src/shared/wrapper/TwofishCrypt.cpp | 2 +- .../fileInterface/src/shared/AbstractFile.cpp | 6 +- .../fileInterface/src/shared/AbstractFile.h | 2 +- .../fileInterface/src/shared/StdioFile.cpp | 16 +- .../src/shared/LocalizationManager.cpp | 18 +- .../src/shared/LocalizedString.cpp | 12 +- .../src/shared/LocalizedStringTable.cpp | 12 +- .../LocalizedStringTableReaderWriter.cpp | 12 +- .../library/singleton/src/shared/Singleton2.h | 4 +- .../src/shared/UnicodeCharacterDataMap.cpp | 6 +- .../src/shared/UnicodeCharacterDataMap.h | 2 +- .../unicode/src/shared/UnicodeUtils.cpp | 2 +- .../library/unicode/src/shared/UnicodeUtils.h | 4 +- .../ours/library/unicode/src/shared/utf8.cpp | 2 +- .../SwgDatabaseServer/src/linux/main.cpp | 2 +- .../shared/buffers/AuctionLocationsBuffer.cpp | 4 +- .../buffers/BattlefieldParticipantBuffer.cpp | 4 +- .../buffers/BountyHunterTargetBuffer.cpp | 2 +- .../shared/buffers/CreatureObjectBuffer.cpp | 2 +- .../src/shared/buffers/ExperienceBuffer.cpp | 4 +- .../buffers/IndexedNetworkTableBuffer.h | 4 +- .../ManufactureSchematicAttributeBuffer.cpp | 4 +- .../buffers/MarketAuctionBidsBuffer.cpp | 4 +- .../shared/buffers/MarketAuctionsBuffer.cpp | 6 +- .../src/shared/buffers/ObjectTableBuffer.cpp | 6 +- .../src/shared/buffers/ResourceTypeBuffer.cpp | 4 +- .../cleanup/TaskObjectTemplateListUpdater.cpp | 2 +- .../src/shared/core/CMLoader.cpp | 4 +- .../src/shared/core/ObjvarNameManager.cpp | 16 +- .../src/shared/core/SwgLoader.cpp | 10 +- .../src/shared/core/SwgPersister.cpp | 2 +- .../src/shared/core/SwgSnapshot.cpp | 8 +- .../src/shared/queries/CommoditiesQuery.cpp | 10 +- .../src/shared/tasks/TaskSaveObjvarNames.cpp | 2 +- .../src/shared/combat/CombatEngine.cpp | 36 +- .../controller/JediManagerController.cpp | 28 +- .../SwgPlayerCreatureController.cpp | 2 +- .../src/shared/core/CSHandler.cpp | 14 +- .../src/shared/core/SwgGameServer.cpp | 6 +- .../src/shared/core/SwgServerUniverse.cpp | 4 +- .../src/shared/object/JediManagerObject.cpp | 8 +- .../src/shared/object/SwgCreatureObject.cpp | 12 +- .../src/shared/object/SwgPlayerObject.cpp | 10 +- .../ServerJediManagerObjectTemplate.cpp | 10 +- .../core/SetupSwgServerNetworkMessages.cpp | 2 +- .../combat/MessageQueueCombatAction.cpp | 8 +- .../core/SetupSwgSharedNetworkMessages.cpp | 2 +- .../src/shared/CombatEngineData.h | 8 +- 937 files changed, 14983 insertions(+), 14983 deletions(-) diff --git a/engine/client/application/Miff/src/linux/InputFileHandler.cpp b/engine/client/application/Miff/src/linux/InputFileHandler.cpp index ead23d7c..0cb2d496 100755 --- a/engine/client/application/Miff/src/linux/InputFileHandler.cpp +++ b/engine/client/application/Miff/src/linux/InputFileHandler.cpp @@ -124,7 +124,7 @@ int InputFileHandler::deleteFile( if (deleteHandleFlag && file) { delete file; - file = NULL; + file = nullptr; } return(unlink(filename)); } diff --git a/engine/client/application/Miff/src/linux/OutputFileHandler.cpp b/engine/client/application/Miff/src/linux/OutputFileHandler.cpp index 1c8ffe96..82fa61a9 100755 --- a/engine/client/application/Miff/src/linux/OutputFileHandler.cpp +++ b/engine/client/application/Miff/src/linux/OutputFileHandler.cpp @@ -20,7 +20,7 @@ OutputFileHandler::OutputFileHandler(const char *filename) { outputIFF = new Iff(MAXIFFDATASIZE); - outFilename = NULL; + outFilename = nullptr; setCurrentFilename(filename); } @@ -45,7 +45,7 @@ OutputFileHandler::~OutputFileHandler(void) delete [] outFilename; } - outputIFF = NULL; + outputIFF = nullptr; } diff --git a/engine/client/application/Miff/src/linux/miff.cpp b/engine/client/application/Miff/src/linux/miff.cpp index cd395ab5..5bf4af1b 100755 --- a/engine/client/application/Miff/src/linux/miff.cpp +++ b/engine/client/application/Miff/src/linux/miff.cpp @@ -55,7 +55,7 @@ //================================================= static vars assignment == const int entryPointVersion = 1; // constantly check DataEntryPoint.h to see if this value has changed -OutputFileHandler *outfileHandler = NULL; +OutputFileHandler *outfileHandler = nullptr; const int bufferSize = 16 * 1024 * 1024; const int maxStringSize = 256; const char version[] = "1.3 September 18, 2000"; @@ -242,7 +242,7 @@ int main( int argc, // number of args in commandline // static void callbackFunction(void) { - outfileHandler = NULL; + outfileHandler = nullptr; #ifdef WIN32 @@ -392,13 +392,13 @@ static errorType evaluateArgs(void) // get default values from DOS char currentDir[maxStringSize]; - if (NULL == getcwd(currentDir, maxStringSize)) // get current working directory + if (nullptr == getcwd(currentDir, maxStringSize)) // get current working directory { retVal = ERR_UNKNOWNDIR; return(retVal); } drive[0] = currentDir[0]; // drive letter - drive[1] = 0; // and null terminate it + drive[1] = 0; // and nullptr terminate it strcpy(extension, "IFF"); // default to uppercase .IFF strcpy(directory, ¤tDir[2]); // get everything after the Drive: including the first backslash filename[0] = 0; @@ -619,7 +619,7 @@ static errorType loadInputToBuffer( // we've successfully read the file, now close it... delete inFileHandler; } - else // inFileName is NULL + else // inFileName is nullptr { retVal = ERR_FILENOTFOUND; } @@ -746,7 +746,7 @@ static void handleError(errorType error) // Revisions and History: // 1/07/99 [] - created // -extern "C" void MIFFMessage(char *message, // null terminated string to be displayed +extern "C" void MIFFMessage(char *message, // nullptr terminated string to be displayed int forceOutput) // if non-zero, it will print out even in quiet mode (for ERRORs) { if (forceOutput) diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferClient.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferClient.cpp index eb67f237..c7ddebeb 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferClient.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferClient.cpp @@ -35,7 +35,7 @@ void AuctionTransferClient::addCoinToAuction( const ExchangeListCreditsMessage& // 2bi. if user connected: send VeAuctionCoinReply (with result code) to user's ES // 2bii. if user not connected: send immediate abort back to auction service - const unsigned uTrack = getNewTransactionID( NULL ); + const unsigned uTrack = getNewTransactionID( nullptr ); AuctionAssetDetails &details = m_mPendingRequestDetails[ uTrack ]; details.u8Type = AuctionAssetDetails::TYPE_COIN; diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericApiCore.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericApiCore.cpp index 6c412225..3735217d 100644 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericApiCore.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericApiCore.cpp @@ -119,7 +119,7 @@ unsigned GenericAPICore::submitRequest(GenericRequest *req, GenericResponse *res } req->setTrack(m_currTrack); res->setTrack(m_currTrack); - time_t timeout = time(NULL) + m_requestTimeout; + time_t timeout = time(nullptr) + m_requestTimeout; req->setTimeout(timeout); res->setTimeout(timeout); @@ -138,7 +138,7 @@ void GenericAPICore::process() if (!m_suspended) { // Process timeout on pending requests - while((m_outCount > 0) && ((req = m_outboundQueue.front().first)->getTimeout() <= time(NULL))) + while((m_outCount > 0) && ((req = m_outboundQueue.front().first)->getTimeout() <= time(nullptr))) { --m_outCount; res = m_outboundQueue.front().second; @@ -150,7 +150,7 @@ void GenericAPICore::process() } // Process timeout on pending responses - while((m_pendingCount > 0) && ((res = (*m_pending.begin()).second)->getTimeout() <= time(NULL))) + while((m_pendingCount > 0) && ((res = (*m_pending.begin()).second)->getTimeout() <= time(nullptr))) { --m_pendingCount; m_pending.erase(m_pending.begin()); @@ -163,7 +163,7 @@ void GenericAPICore::process() pair out_pair = m_outboundQueue.front(); req = out_pair.first; res = out_pair.second; - GenericConnection *con = NULL; + GenericConnection *con = nullptr; if (req->getMappedServerTrack() == 0) // request has no originating "owner" server { con = getNextActiveConnection(); // it does not matter which server we send this to @@ -180,7 +180,7 @@ void GenericAPICore::process() } } - if (con != NULL) + if (con != nullptr) { Base::ByteStream msg; req->pack(msg); @@ -215,7 +215,7 @@ GenericConnection *GenericAPICore::getNextActiveConnection() unsigned startIndex = m_nextConnectionIndex; unsigned maxIndex = m_serverConnections.size() - 1; - GenericConnection *con = NULL; + GenericConnection *con = nullptr; //loop until we find an active connection, or until we get back // to where we started @@ -235,7 +235,7 @@ GenericConnection *GenericAPICore::getNextActiveConnection() //went past end of vector, start back at 0 m_nextConnectionIndex = 0; } - }while (con == NULL && m_nextConnectionIndex != startIndex); + }while (con == nullptr && m_nextConnectionIndex != startIndex); return con; } @@ -261,7 +261,7 @@ ServerTrackObject *GenericAPICore::findServer(unsigned server_track) { std::map::iterator iter = m_serverTracks.find(server_track); if (iter == m_serverTracks.end()) - return NULL; + return nullptr; ServerTrackObject *stobj = (*iter).second; m_serverTracks.erase(server_track); return stobj; diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericConnection.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericConnection.cpp index 318f5c20..8abb0dff 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericConnection.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericConnection.cpp @@ -25,7 +25,7 @@ using namespace Base; GenericConnection::GenericConnection(const char *host, short port, GenericAPICore *apiCore, unsigned reconnectTimeout, unsigned noDataTimeoutSecs, unsigned, unsigned incomingBufSizeInKB, unsigned outgoingBufSizeInKB, unsigned keepAlive, unsigned maxRecvMessageSizeInKB) : m_bConnected(CON_NONE), m_apiCore(apiCore), - m_con(NULL), + m_con(nullptr), m_host(host), m_port(port), m_lastTrack(123455), //random choice != 1 @@ -50,8 +50,8 @@ GenericConnection::~GenericConnection() { if(m_con) { - m_con->SetHandler(NULL); - m_con->Disconnect();//don't worry about onterminated being called, we've set it's handler to null, so it wont + m_con->SetHandler(nullptr); + m_con->Disconnect();//don't worry about onterminated being called, we've set it's handler to nullptr, so it wont m_con->Release(); } @@ -64,7 +64,7 @@ void GenericConnection::disconnect() { m_con->Disconnect(); //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); - m_con = NULL; + m_con = nullptr; } m_conState = CON_DISCONNECT; m_bConnected = CON_NONE; @@ -77,7 +77,7 @@ void GenericConnection::OnTerminated(TcpConnection *) if(m_con) { m_con->Release(); - m_con = NULL; + m_con = nullptr; } m_conState = CON_DISCONNECT; m_bConnected = CON_NONE; @@ -93,7 +93,7 @@ void GenericConnection::OnRoutePacket(TcpConnection *, const unsigned char *data get(iter, type); get(iter, track); - GenericResponse *res = NULL; + GenericResponse *res = nullptr; // the following if block is a temporary fix that prevents // a crash with a game team in which they occasionally find @@ -152,7 +152,7 @@ void GenericConnection::process() { m_con->SetHandler(this); m_conState = CON_NEGOTIATE; - m_conTimeout = time(NULL) + m_reconnectTimeout; + m_conTimeout = time(nullptr) + m_reconnectTimeout; } break; case CON_NEGOTIATE: @@ -178,12 +178,12 @@ void GenericConnection::process() put(msg, std::string(m_apiCore->m_gameIdentifiers[index])); Send(msg); } - else if(time(NULL) > m_conTimeout) + else if(time(nullptr) > m_conTimeout) { // we did not connect m_con->Disconnect(); //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); - m_con = NULL; + m_con = nullptr; m_conState = CON_DISCONNECT; m_bConnected = CON_NONE; } @@ -199,7 +199,7 @@ void GenericConnection::process() { m_con->Disconnect(); //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); - m_con = NULL; + m_con = nullptr; } } m_manager->GiveTime(); diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/AuctionTransferAPI.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/AuctionTransferAPI.cpp index 872eff5e..7e716a00 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/AuctionTransferAPI.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/AuctionTransferAPI.cpp @@ -25,9 +25,9 @@ AuctionTransferAPI::AuctionTransferAPI(const char *hostNames, const char *identi std::vector portArray; char hostConfig[4096]; char identifierConfig[4096]; - if (hostNames == NULL) + if (hostNames == nullptr) hostNames = DEFAULT_HOST; - if(identifiers == NULL) + if(identifiers == nullptr) identifiers = DEFAULT_IDENTIFIER; // parse the hosts and ports out : @@ -52,7 +52,7 @@ AuctionTransferAPI::AuctionTransferAPI(const char *hostNames, const char *identi portArray.push_back(port); } } - while ((ptr = strtok(NULL, " ")) != NULL); + while ((ptr = strtok(nullptr, " ")) != nullptr); } strncpy(identifierConfig, identifiers, 4096); identifierConfig[4095] = 0; @@ -67,7 +67,7 @@ AuctionTransferAPI::AuctionTransferAPI(const char *hostNames, const char *identi identifierArray.push_back(identifier); } } - while ((ptr = strtok(NULL, ";")) != NULL); + while ((ptr = strtok(nullptr, ";")) != nullptr); } if (hostArray.empty()) @@ -134,7 +134,7 @@ unsigned AuctionTransferAPI::sendCommitTransaction(long long transactionID, void unsigned AuctionTransferAPI::sendPrepareTransaction(const char *serverIdentifier, long long transactionID, unsigned stationID, unsigned characterID, long long assetID, const char *xmlAsset, void *user, bool compress) { RequestTypes requestEnum = GAME_REQUEST_SEND_PREPARE_TRANSACTION; - GenericRequest *req = NULL; + GenericRequest *req = nullptr; if( compress ) { requestEnum = GAME_REQUEST_SEND_PREPARE_TRANSACTION_COMPRESSED; diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/Archive.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/Archive.cpp index e3400df0..8ad45428 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/Archive.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/Archive.cpp @@ -91,7 +91,7 @@ namespace Base ByteStream::ByteStream() : allocatedSize(0), beginReadIterator(), - data(NULL), + data(nullptr), size(0), lastPutSize(0) { @@ -208,7 +208,7 @@ namespace Base if(data->size < allocatedSize) { unsigned char * tmp = new unsigned char[newSize]; - if(data->buffer != NULL) + if(data->buffer != nullptr) memcpy(tmp, data->buffer, size); delete[] data->buffer; data->buffer = tmp; diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Request.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Request.cpp index 13291373..ed2e0ad3 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Request.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Request.cpp @@ -7,7 +7,7 @@ void put(Base::ByteStream &msg, const Blob &source); ////////////////////////////////////////////////////////////////////////////////////// Blob::Blob(const unsigned char *data, unsigned len) - : m_data(NULL), + : m_data(nullptr), m_len(len) { if (m_len > 0) @@ -20,7 +20,7 @@ void put(Base::ByteStream &msg, const Blob &source); ////////////////////////////////////////////////////////////////////////////////////// Blob::Blob(const Blob &cpy) - : m_data(NULL), + : m_data(nullptr), m_len(cpy.m_len) { if (m_len > 0) @@ -45,7 +45,7 @@ void put(Base::ByteStream &msg, const Blob &source); if (m_data) { delete [] m_data; - m_data = NULL; + m_data = nullptr; } m_len = cpy.m_len; diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/IPAddress.h b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/IPAddress.h index f6d5f886..03b59e8d 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/IPAddress.h +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/IPAddress.h @@ -32,7 +32,7 @@ public: * @brief Used to retreive the the dot-notation represenatatiion of this address. * * @param buffer A pointer to the buffer to place the ip address into. - * Must be at least 17 characters long, will be null terminated. + * Must be at least 17 characters long, will be nullptr terminated. * * @return A pointer to the buffer the address was placed into. */ diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpBlockAllocator.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpBlockAllocator.cpp index 6d476d78..b7da0f27 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpBlockAllocator.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpBlockAllocator.cpp @@ -6,7 +6,7 @@ namespace NAMESPACE #endif TcpBlockAllocator::TcpBlockAllocator(const unsigned initSize, const unsigned initCount) -: m_freeHead(NULL), m_blockCount(initCount), m_blockSize(initSize), m_numAvailBlocks(0) +: m_freeHead(nullptr), m_blockCount(initCount), m_blockSize(initSize), m_numAvailBlocks(0) { realloc(); } @@ -33,7 +33,7 @@ data_block *TcpBlockAllocator::getBlock() tmp = m_freeHead; m_freeHead = m_freeHead->m_next; - tmp->m_next = NULL; + tmp->m_next = nullptr; m_numAvailBlocks--; return(tmp); } @@ -56,7 +56,7 @@ void TcpBlockAllocator::returnBlock(data_block *b) void TcpBlockAllocator::realloc() { - data_block *tmp = NULL, *cursor = NULL; + data_block *tmp = nullptr, *cursor = nullptr; tmp = new data_block; m_numAvailBlocks++; cursor = tmp; diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpConnection.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpConnection.cpp index 41f75157..20fdad78 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpConnection.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpConnection.cpp @@ -11,28 +11,28 @@ namespace NAMESPACE //used when want to open new connection with this socket TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, const IPAddress &destIP, short destPort, unsigned timeout) -: m_nextConnection(NULL), - m_prevConnection(NULL), +: m_nextConnection(nullptr), + m_prevConnection(nullptr), m_socket(INVALID_SOCKET), - m_nextKeepAliveConnection(NULL), - m_prevKeepAliveConnection(NULL), + m_nextKeepAliveConnection(nullptr), + m_prevKeepAliveConnection(nullptr), m_aliveListId(tcpManager->m_aliveList.m_listID), - m_nextRecvDataConnection(NULL), - m_prevRecvDataConnection(NULL), + m_nextRecvDataConnection(nullptr), + m_prevRecvDataConnection(nullptr), m_recvDataListId(tcpManager->m_dataList.m_listID), m_manager(tcpManager), m_status(StatusNegotiating), - m_handler(NULL), + m_handler(nullptr), m_destIP(destIP), m_destPort(destPort), m_refCount(0), m_sendAllocator(sendAlloc), - m_head(NULL), - m_tail(NULL), + m_head(nullptr), + m_tail(nullptr), m_bytesRead(0), m_bytesNeeded(0), m_params(params), - m_recvBuff(NULL), + m_recvBuff(nullptr), m_connectTimeout(timeout), m_connectTimer(), m_wasConRemovedFromMgr(false) @@ -94,28 +94,28 @@ TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAllo //used when server mode creates new connection object representing a connect request TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, SOCKET socket, const IPAddress &destIP, short destPort) -: m_nextConnection(NULL), - m_prevConnection(NULL), +: m_nextConnection(nullptr), + m_prevConnection(nullptr), m_socket(socket), - m_nextKeepAliveConnection(NULL), - m_prevKeepAliveConnection(NULL), + m_nextKeepAliveConnection(nullptr), + m_prevKeepAliveConnection(nullptr), m_aliveListId(tcpManager->m_aliveList.m_listID), - m_nextRecvDataConnection(NULL), - m_prevRecvDataConnection(NULL), + m_nextRecvDataConnection(nullptr), + m_prevRecvDataConnection(nullptr), m_recvDataListId(tcpManager->m_dataList.m_listID), m_manager(tcpManager), m_status(StatusConnected), - m_handler(NULL), + m_handler(nullptr), m_destIP(destIP), m_destPort(destPort), m_refCount(0), m_sendAllocator(sendAlloc), - m_head(NULL), - m_tail(NULL), + m_head(nullptr), + m_tail(nullptr), m_bytesRead(0), m_bytesNeeded(0), m_params(params), - m_recvBuff(NULL), + m_recvBuff(nullptr), m_connectTimeout(0), m_connectTimer(), m_wasConRemovedFromMgr(false) @@ -208,7 +208,7 @@ int TcpConnection::finishConnect() t.tv_sec = 0; t.tv_usec = 0; - int err = select(m_socket + 1, NULL, &wrSet, NULL, &t); + int err = select(m_socket + 1, nullptr, &wrSet, nullptr, &t); if (err == 0) { @@ -303,7 +303,7 @@ TcpConnection::~TcpConnection() { delete [] m_recvBuff; - while(m_head != NULL) + while(m_head != nullptr) { data_block *tmp = m_head; m_head = m_head->m_next; @@ -327,22 +327,22 @@ void TcpConnection::Send(const char *data, unsigned int dataLen) { m_aliveListId = m_manager->m_keepAliveList.m_listID; - if (m_prevKeepAliveConnection != NULL) + if (m_prevKeepAliveConnection != nullptr) m_prevKeepAliveConnection->m_nextKeepAliveConnection = m_nextKeepAliveConnection; - if (m_nextKeepAliveConnection != NULL) + if (m_nextKeepAliveConnection != nullptr) m_nextKeepAliveConnection->m_prevKeepAliveConnection = m_prevKeepAliveConnection; if (m_manager->m_keepAliveList.m_beginList == this) m_manager->m_keepAliveList.m_beginList = m_nextKeepAliveConnection; m_nextKeepAliveConnection = m_manager->m_aliveList.m_beginList; - m_prevKeepAliveConnection = NULL; - if (m_manager->m_aliveList.m_beginList != NULL) + m_prevKeepAliveConnection = nullptr; + if (m_manager->m_aliveList.m_beginList != nullptr) m_manager->m_aliveList.m_beginList->m_prevKeepAliveConnection = this; m_manager->m_aliveList.m_beginList = this; } - data_block *work = NULL; + data_block *work = nullptr; // this connection has no send buffer. Get a block if(!m_tail) @@ -467,16 +467,16 @@ int TcpConnection::processIncoming() { m_recvDataListId = m_manager->m_noDataList.m_listID; - if (m_prevRecvDataConnection != NULL) + if (m_prevRecvDataConnection != nullptr) m_prevRecvDataConnection->m_nextRecvDataConnection = m_nextRecvDataConnection; - if (m_nextRecvDataConnection != NULL) + if (m_nextRecvDataConnection != nullptr) m_nextRecvDataConnection->m_prevRecvDataConnection = m_prevRecvDataConnection; if (m_manager->m_noDataList.m_beginList == this) m_manager->m_noDataList.m_beginList = m_nextRecvDataConnection; m_nextRecvDataConnection = m_manager->m_dataList.m_beginList; - m_prevRecvDataConnection = NULL; - if (m_manager->m_dataList.m_beginList != NULL) + m_prevRecvDataConnection = nullptr; + if (m_manager->m_dataList.m_beginList != nullptr) m_manager->m_dataList.m_beginList->m_prevRecvDataConnection = this; m_manager->m_dataList.m_beginList = this; } @@ -622,7 +622,7 @@ int TcpConnection::processOutgoing() int sendError = 1; - // If m_head is not null, then this connection has something to send + // If m_head is not nullptr, then this connection has something to send if(m_head) diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpConnection.h b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpConnection.h index 07eb4f42..92d631d1 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpConnection.h +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpConnection.h @@ -50,7 +50,7 @@ public: * connection is disconnected, you simply need to derive your class * (multiply if necessary) from TcpConnectionHandler, then you can use * this method to set the object the TcpConnection will call as appropriate. - * default = NULL (no callbacks made) + * default = nullptr (no callbacks made) * * @param handler The object which will be called for notifications. */ diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpManager.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpManager.cpp index a89065a6..7c00d9f6 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpManager.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpManager.cpp @@ -41,14 +41,14 @@ TcpManager::TcpParams::TcpParams(const TcpParams &cpy) } TcpManager::TcpManager(const TcpParams ¶ms) -: m_handler(NULL), - m_keepAliveList(NULL, 1), - m_aliveList(NULL, 2), - m_noDataList(NULL, 1), - m_dataList(NULL, 2), +: m_handler(nullptr), + m_keepAliveList(nullptr, 1), + m_aliveList(nullptr, 2), + m_noDataList(nullptr, 1), + m_dataList(nullptr, 2), m_params(params), m_refCount(1), - m_connectionList(NULL), + m_connectionList(nullptr), m_connectionListCount(0), m_socket(INVALID_SOCKET), m_boundAsServer(false), @@ -86,7 +86,7 @@ TcpManager::~TcpManager() close(m_socket); #endif } - while (m_connectionList != NULL) + while (m_connectionList != nullptr) { TcpConnection *con = m_connectionList; m_connectionList = m_connectionList->m_nextConnection; @@ -166,7 +166,7 @@ bool TcpManager::BindAsServer() { struct hostent * lphp; lphp = gethostbyname(m_params.bindAddress); - if (lphp != NULL) + if (lphp != nullptr) addr_loc.sin_addr.s_addr = ((struct in_addr *)(lphp->h_addr))->s_addr; } else @@ -191,7 +191,7 @@ bool TcpManager::BindAsServer() TcpConnection *TcpManager::acceptClient() { - TcpConnection *newConn = NULL; + TcpConnection *newConn = nullptr; if (m_boundAsServer && m_connectionListCount < m_params.maxConnections) { @@ -205,7 +205,7 @@ TcpConnection *TcpManager::acceptClient() { newConn = new TcpConnection(this, &m_allocator, m_params, sock, IPAddress(addr.sin_addr.s_addr), ntohs(addr.sin_port)); addNewConnection(newConn); - if (m_handler != NULL) + if (m_handler != nullptr) { m_handler->OnConnectRequest(newConn); } @@ -230,8 +230,8 @@ SOCKET TcpManager::getMaxFD() if (m_boundAsServer) maxfd = m_socket+1; - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) { next = con->m_nextConnection; if (con->GetStatus() != TcpConnection::StatusDisconnected && con->m_socket > maxfd) @@ -245,8 +245,8 @@ SOCKET TcpManager::getMaxFD() TcpConnection *TcpManager::getConnection(SOCKET fd) { - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) { next = con->m_nextConnection; if (con->m_socket == fd) @@ -255,7 +255,7 @@ TcpConnection *TcpManager::getConnection(SOCKET fd) } } //if get here ,couldn't find it - return NULL; + return nullptr; } bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendTimePerConnection, unsigned maxRecvTimePerConnection) @@ -277,8 +277,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT { // Send output from last heartbeat - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) { con->AddRef(); if (next) next->Release(); @@ -345,7 +345,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT tmpfds = m_permfds; timeout.tv_sec = 0; timeout.tv_usec = 0; - int cnt = select(maxfd, &tmpfds, NULL, NULL, &timeout); // blocks for timeout + int cnt = select(maxfd, &tmpfds, nullptr, nullptr, &timeout); // blocks for timeout if (cnt > 0) @@ -371,8 +371,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //process incoming client messages if (maxRecvTimePerConnection != 0) { - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) { con->AddRef(); if (next) next->Release(); @@ -437,8 +437,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT pollfds[0].events |= POLLIN; } - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next, idx++) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next, idx++) { next = con->m_nextConnection; pollfds[idx].fd = con->m_socket; @@ -478,7 +478,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT } //process regular msg(s) - if (con == NULL) + if (con == nullptr) { close(pollfds[idx].fd); continue; @@ -510,7 +510,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT }//if(pollfds[... else if (pollfds[idx].revents & POLLHUP) { - if (con == NULL) + if (con == nullptr) { close(pollfds[idx].fd); continue; @@ -528,21 +528,21 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //now process any keepalives, if time to do that if (m_params.keepAliveDelay > 0 && m_keepAliveTimer.isDone(m_params.keepAliveDelay)) { - TcpConnection *next = NULL; - for (TcpConnection *con = m_keepAliveList.m_beginList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_keepAliveList.m_beginList ; con != nullptr ; con = next) { con->AddRef(); if (next) next->Release(); next = con->m_nextKeepAliveConnection; if (next) next->AddRef(); - con->Send(NULL, 0); //note: this request will move the connection from the keepAliveList to the aliveList + con->Send(nullptr, 0); //note: this request will move the connection from the keepAliveList to the aliveList con->Release(); } //now move the complete alive list over to the keepalive list to reset those timers m_keepAliveList.m_beginList = m_aliveList.m_beginList; - m_aliveList.m_beginList = NULL; + m_aliveList.m_beginList = nullptr; //switch id's for those connections that were in the alive list last go - around int tmpID = m_aliveList.m_listID; @@ -556,8 +556,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //now process any noDataCons, if time to do that if (m_params.noDataTimeout > 0 && m_noDataTimer.isDone(m_params.noDataTimeout)) { - TcpConnection *next = NULL; - for (TcpConnection *con = m_noDataList.m_beginList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_noDataList.m_beginList ; con != nullptr ; con = next) { con->AddRef(); if (next) next->Release(); @@ -571,7 +571,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //now move the complete data list over to the nodata list to reset those timers m_noDataList.m_beginList = m_dataList.m_beginList; - m_dataList.m_beginList = NULL; + m_dataList.m_beginList = nullptr; //switch id's for those connections that were in the data list last go - around int tmpID = m_dataList.m_listID; @@ -593,11 +593,11 @@ TcpConnection *TcpManager::EstablishConnection(const char *serverAddress, unsign { //can't open outgoing connections when in server mode // use a different TcpManager to do that - return NULL; + return nullptr; } if (m_connectionListCount >= m_params.maxConnections) - return(NULL); + return(nullptr); // get server address unsigned long address = inet_addr(serverAddress); @@ -605,8 +605,8 @@ TcpConnection *TcpManager::EstablishConnection(const char *serverAddress, unsign { struct hostent * lphp; lphp = gethostbyname(serverAddress); - if (lphp == NULL) - return(NULL); + if (lphp == nullptr) + return(nullptr); address = ((struct in_addr *)(lphp->h_addr))->s_addr; } IPAddress destIP(address); @@ -631,22 +631,22 @@ void TcpManager::addNewConnection(TcpConnection *con) } #endif con->m_nextConnection = m_connectionList; - con->m_prevConnection = NULL; - if (m_connectionList != NULL) + con->m_prevConnection = nullptr; + if (m_connectionList != nullptr) m_connectionList->m_prevConnection = con; m_connectionList = con; m_connectionListCount++; con->m_nextKeepAliveConnection = m_aliveList.m_beginList; - con->m_prevKeepAliveConnection = NULL; - if (m_aliveList.m_beginList != NULL) + con->m_prevKeepAliveConnection = nullptr; + if (m_aliveList.m_beginList != nullptr) m_aliveList.m_beginList->m_prevKeepAliveConnection = con; m_aliveList.m_beginList = con; con->m_aliveListId = m_keepAliveList.m_listID;//start it out thinking it's already in the alive list, since it is con->m_nextRecvDataConnection = m_dataList.m_beginList; - con->m_prevRecvDataConnection = NULL; - if (m_dataList.m_beginList != NULL) + con->m_prevRecvDataConnection = nullptr; + if (m_dataList.m_beginList != nullptr) m_dataList.m_beginList->m_prevRecvDataConnection = con; m_dataList.m_beginList = con; con->m_recvDataListId = m_noDataList.m_listID;//start it out thinking it's already in the data list, since it is @@ -667,40 +667,40 @@ void TcpManager::removeConnection(TcpConnection *con) #pragma warning(pop) } #endif - if (con->m_prevConnection != NULL) + if (con->m_prevConnection != nullptr) con->m_prevConnection->m_nextConnection = con->m_nextConnection; - if (con->m_nextConnection != NULL) + if (con->m_nextConnection != nullptr) con->m_nextConnection->m_prevConnection = con->m_prevConnection; if (m_connectionList == con) m_connectionList = con->m_nextConnection; - con->m_nextConnection = NULL; - con->m_prevConnection = NULL; + con->m_nextConnection = nullptr; + con->m_prevConnection = nullptr; - if (con->m_prevKeepAliveConnection != NULL) + if (con->m_prevKeepAliveConnection != nullptr) con->m_prevKeepAliveConnection->m_nextKeepAliveConnection = con->m_nextKeepAliveConnection; - if (con->m_nextKeepAliveConnection != NULL) + if (con->m_nextKeepAliveConnection != nullptr) con->m_nextKeepAliveConnection->m_prevKeepAliveConnection = con->m_prevKeepAliveConnection; if (m_aliveList.m_beginList == con) m_aliveList.m_beginList = con->m_nextKeepAliveConnection; else if (m_keepAliveList.m_beginList == con) m_keepAliveList.m_beginList = con->m_nextKeepAliveConnection; - con->m_nextKeepAliveConnection = NULL; - con->m_prevKeepAliveConnection = NULL; + con->m_nextKeepAliveConnection = nullptr; + con->m_prevKeepAliveConnection = nullptr; - if (con->m_prevRecvDataConnection != NULL) + if (con->m_prevRecvDataConnection != nullptr) con->m_prevRecvDataConnection->m_nextRecvDataConnection = con->m_nextRecvDataConnection; - if (con->m_nextRecvDataConnection != NULL) + if (con->m_nextRecvDataConnection != nullptr) con->m_nextRecvDataConnection->m_prevRecvDataConnection = con->m_prevRecvDataConnection; if (m_dataList.m_beginList == con) m_dataList.m_beginList = con->m_nextRecvDataConnection; else if (m_noDataList.m_beginList == con) m_noDataList.m_beginList = con->m_nextRecvDataConnection; - con->m_nextRecvDataConnection = NULL; - con->m_prevRecvDataConnection = NULL; + con->m_nextRecvDataConnection = nullptr; + con->m_prevRecvDataConnection = nullptr; diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpManager.h b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpManager.h index 75eb6df4..c4e8b1cf 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpManager.h +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpManager.h @@ -156,7 +156,7 @@ public: * simply need to derive your class (multiply if necessary) from TcpManagerHandler, then you can use * this method to set the object the TcpManager will call as appropriate. The TcpConnection object * also has a handler mechanism that replaces the other callback functions below, see TcpConnection::SetHandler - * default = NULL (no callbacks made) + * default = nullptr (no callbacks made) * * @param handler The object which will be called for manager related notifications. */ @@ -211,7 +211,7 @@ public: * the connect-complete callback to be called if the connection is succesfull. * * @return A pointer to a TcpConnection object. - * NULL if the manager object has exceeded its maximum number of connections + * nullptr if the manager object has exceeded its maximum number of connections * or if the serverAddress cannot be resolved to an IP address. */ TcpConnection *EstablishConnection(const char *serverAddress, unsigned short serverPort, unsigned timeout = 0); diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/GZipHelper.h b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/GZipHelper.h index a01bf682..dab0f9b3 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/GZipHelper.h +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/GZipHelper.h @@ -187,7 +187,7 @@ class CA2GZIPT int destroy() { int err = Z_OK; - if (m_zstream.state != NULL) { + if (m_zstream.state != nullptr) { err = deflateEnd(&(m_zstream)); } if (m_z_err < 0) err = m_z_err; @@ -459,7 +459,7 @@ class CGZIP2AT int destroy() { int err = Z_OK; - if (m_zstream.state != NULL) { + if (m_zstream.state != nullptr) { err = inflateEnd(&(m_zstream)); } if (m_z_err < 0) err = m_z_err; diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/zlib.h b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/zlib.h index 52cb529f..fb425a3b 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/zlib.h +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/zlib.h @@ -74,7 +74,7 @@ typedef struct z_stream_s { uInt avail_out; /* remaining free space at next_out */ uLong total_out; /* total nb of bytes output so far */ - char *msg; /* last error message, NULL if no error */ + char *msg; /* last error message, nullptr if no error */ struct internal_state FAR *state; /* not visible by applications */ alloc_func zalloc; /* used to allocate the internal state */ @@ -193,7 +193,7 @@ ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); enough memory, Z_STREAM_ERROR if level is not a valid compression level, Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible with the version assumed by the caller (ZLIB_VERSION). - msg is set to null if there is no error message. deflateInit does not + msg is set to nullptr if there is no error message. deflateInit does not perform any compression: this will be done by deflate(). */ @@ -271,7 +271,7 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); processed or more output produced), Z_STREAM_END if all input has been consumed and all output has been produced (only when flush is set to Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example - if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible + if next_in or next_out was nullptr), Z_BUF_ERROR if no progress is possible (for example avail_in or avail_out was zero). */ @@ -304,7 +304,7 @@ ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_VERSION_ERROR if the zlib library version is incompatible with the - version assumed by the caller. msg is set to null if there is no error + version assumed by the caller. msg is set to nullptr if there is no error message. inflateInit does not perform any decompression apart from reading the zlib header if present: this will be done by inflate(). (So next_in and avail_in may be modified, but next_out and avail_out are unchanged.) @@ -372,7 +372,7 @@ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); preset dictionary is needed at this point, Z_DATA_ERROR if the input data was corrupted (input stream not conforming to the zlib format or incorrect adler32 checksum), Z_STREAM_ERROR if the stream structure was inconsistent - (for example if next_in or next_out was NULL), Z_MEM_ERROR if there was not + (for example if next_in or next_out was nullptr), Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if no progress is possible or if there was not enough room in the output buffer when Z_FINISH is used. In the Z_DATA_ERROR case, the application may then call inflateSync to look for a good @@ -437,7 +437,7 @@ ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid - method). msg is set to null if there is no error message. deflateInit2 does + method). msg is set to nullptr if there is no error message. deflateInit2 does not perform any compression: this will be done by deflate(). */ @@ -471,7 +471,7 @@ ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, actually used by the compressor.) deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a - parameter is invalid (such as NULL dictionary) or the stream state is + parameter is invalid (such as nullptr dictionary) or the stream state is inconsistent (for example if deflate has already been called for this stream or if the compression method is bsort). deflateSetDictionary does not perform any compression: this will be done by deflate(). @@ -491,7 +491,7 @@ ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if the source stream state was inconsistent - (such as zalloc being NULL). msg is left unchanged in both source and + (such as zalloc being nullptr). msg is left unchanged in both source and destination. */ @@ -503,7 +503,7 @@ ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); that may have been set by deflateInit2. deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being NULL). + stream state was inconsistent (such as zalloc or state being nullptr). */ ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, @@ -544,7 +544,7 @@ ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if a parameter is invalid (such as a negative - memLevel). msg is set to null if there is no error message. inflateInit2 + memLevel). msg is set to nullptr if there is no error message. inflateInit2 does not perform any decompression apart from reading the zlib header if present: this will be done by inflate(). (So next_in and avail_in may be modified, but next_out and avail_out are unchanged.) @@ -562,7 +562,7 @@ ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, dictionary (see deflateSetDictionary). inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a - parameter is invalid (such as NULL dictionary) or the stream state is + parameter is invalid (such as nullptr dictionary) or the stream state is inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the expected one (incorrect Adler32 value). inflateSetDictionary does not perform any decompression: this will be done by subsequent calls of @@ -591,7 +591,7 @@ ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); The stream will keep attributes that may have been set by inflateInit2. inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being NULL). + stream state was inconsistent (such as zalloc or state being nullptr). */ @@ -667,7 +667,7 @@ ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); gzopen can be used to read a file which is not in gzip format; in this case gzread will directly read from the file without decompression. - gzopen returns NULL if the file could not be opened or if there was + gzopen returns nullptr if the file could not be opened or if there was insufficient memory to allocate the (de)compression state; errno can be checked to distinguish the two cases (if errno is zero, the zlib error is Z_MEM_ERROR). */ @@ -681,7 +681,7 @@ ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); The next call of gzclose on the returned gzFile will also close the file descriptor fd, just like fclose(fdopen(fd), mode) closes the file descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode). - gzdopen returns NULL if there was insufficient memory to allocate + gzdopen returns nullptr if there was insufficient memory to allocate the (de)compression state. */ @@ -718,8 +718,8 @@ ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...)); ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); /* - Writes the given null-terminated string to the compressed file, excluding - the terminating null character. + Writes the given nullptr-terminated string to the compressed file, excluding + the terminating nullptr character. gzputs returns the number of characters written, or -1 in case of error. */ @@ -727,7 +727,7 @@ ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); /* Reads bytes from the compressed file until len-1 characters are read, or a newline character is read and transferred to buf, or an end-of-file - condition is encountered. The string is then terminated with a null + condition is encountered. The string is then terminated with a nullptr character. gzgets returns buf, or Z_NULL in case of error. */ @@ -822,7 +822,7 @@ ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); /* Update a running Adler-32 checksum with the bytes buf[0..len-1] and - return the updated checksum. If buf is NULL, this function returns + return the updated checksum. If buf is nullptr, this function returns the required initial value for the checksum. An Adler-32 checksum is almost as reliable as a CRC32 but can be computed much faster. Usage example: @@ -838,7 +838,7 @@ ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); /* Update a running crc with the bytes buf[0..len-1] and return the updated - crc. If buf is NULL, this function returns the required initial value + crc. If buf is nullptr, this function returns the required initial value for the crc. Pre- and post-conditioning (one's complement) is performed within this function so it shouldn't be done by the application. Usage example: diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/zutil.h b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/zutil.h index 718ebc15..fecd535d 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/zutil.h +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/zutil.h @@ -116,7 +116,7 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ # include /* for fdopen */ # else # ifndef fdopen -# define fdopen(fd,mode) NULL /* No fdopen() */ +# define fdopen(fd,mode) nullptr /* No fdopen() */ # endif # endif #endif @@ -130,7 +130,7 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ #endif #if defined(_BEOS_) || defined(RISCOS) -# define fdopen(fd,mode) NULL /* No fdopen() */ +# define fdopen(fd,mode) nullptr /* No fdopen() */ #endif #if (defined(_MSC_VER) && (_MSC_VER > 600)) diff --git a/engine/server/application/CentralServer/src/shared/CentralCSHandler.h b/engine/server/application/CentralServer/src/shared/CentralCSHandler.h index e2b5fd0b..b07690de 100755 --- a/engine/server/application/CentralServer/src/shared/CentralCSHandler.h +++ b/engine/server/application/CentralServer/src/shared/CentralCSHandler.h @@ -69,7 +69,7 @@ protected: std::string name; EntryType type; - CentralCSHandlerFunc func; // will be null unless it's of TYPE_CENTRAL. + CentralCSHandlerFunc func; // will be nullptr unless it's of TYPE_CENTRAL. }; diff --git a/engine/server/application/CentralServer/src/shared/CentralServer.cpp b/engine/server/application/CentralServer/src/shared/CentralServer.cpp index 35d9e51c..3c1578f9 100755 --- a/engine/server/application/CentralServer/src/shared/CentralServer.cpp +++ b/engine/server/application/CentralServer/src/shared/CentralServer.cpp @@ -587,7 +587,7 @@ void CentralServer::getReadyGameServers(std::vector &theList) GameServerConnection * CentralServer::getRandomGameServer(void) { if (m_gameServerConnectionsList.empty()) - return NULL; + return nullptr; // m_gameServerConnectionsList ***DOES NOT*** contain the DB server so // we don't have to worry about checking for and excluding the DB server @@ -611,7 +611,7 @@ GameServerConnection * CentralServer::getRandomGameServer(void) indexNextGameServer = 0; } - return NULL; + return nullptr; } //----------------------------------------------------------------------- @@ -696,7 +696,7 @@ void CentralServer::launchStartingProcesses() const if (!m_taskManager || !m_taskManager->isConnected() || (m_clusterId == 0)) { if (!m_taskManager) - REPORT_LOG(true, ("CentralServer not launching starting processes because m_taskManager is NULL\n")); + REPORT_LOG(true, ("CentralServer not launching starting processes because m_taskManager is nullptr\n")); else if (!m_taskManager->isConnected()) REPORT_LOG(true, ("CentralServer not launching starting processes because m_taskManager->isConnected() is false\n")); @@ -820,7 +820,7 @@ void CentralServer::launchStartingPlanetServers() char const * const p = ConfigCentralServer::getStartPlanet(i); if (p) { - FATAL(!*p, ("CentralServer::launchStartingPlanetServers: ConfigCentralServer::getStartPlanet(%d) specified a non-null but empty planet name", i)); + FATAL(!*p, ("CentralServer::launchStartingPlanetServers: ConfigCentralServer::getStartPlanet(%d) specified a non-nullptr but empty planet name", i)); std::string planetName; std::string hostName; @@ -1495,7 +1495,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons { ConnectionServerConnection * c = (*ci); - if ( (c != NULL) + if ( (c != nullptr) && !c->getChatServiceAddress().empty() && (c->getChatServicePort() != 0)) { @@ -1537,13 +1537,13 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons { ChatServerConnection *connection = (*iterChatServerConnections); - if (connection != NULL) + if (connection != nullptr) { connection->send(address, true); } else { - REPORT_LOG(true, ("Trying to send the customer service server: chat server service address to a NULL chat server\n")); + REPORT_LOG(true, ("Trying to send the customer service server: chat server service address to a nullptr chat server\n")); } } } @@ -1556,7 +1556,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons { ConnectionServerConnection * c = (*ci); - if ( (c != NULL) + if ( (c != nullptr) && !c->getCustomerServiceAddress().empty() && (c->getCustomerServicePort() != 0)) { @@ -1631,7 +1631,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); const RequestGameServerForLoginMessage msg(ri); - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); PlayerSceneMapType::const_iterator i = m_playerSceneMap.find(msg.getCharacterId()); if ((i != m_playerSceneMap.end()) && (i->second.second > timeNow)) { @@ -1892,14 +1892,14 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons } else { - if(getInstance().m_transferServerConnection != NULL) + if(getInstance().m_transferServerConnection != nullptr) { getInstance().m_transferServerConnection->disconnect(); getInstance().m_transferServerConnection = 0; s_retryTransferServerConnection = false; } - if(getInstance().m_stationPlayersCollectorConnection != NULL) + if(getInstance().m_stationPlayersCollectorConnection != nullptr) { getInstance().m_stationPlayersCollectorConnection->disconnect(); getInstance().m_stationPlayersCollectorConnection = 0; @@ -1947,11 +1947,11 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons if (iterFind != s_pendingRenameCharacter.end()) { ++(iterFind->second.second); - iterFind->second.first = ::time(NULL) + 3600; // 1 hour timeout + iterFind->second.first = ::time(nullptr) + 3600; // 1 hour timeout } else { - s_pendingRenameCharacter.insert(std::make_pair(msg.getValue().second.first, std::make_pair((::time(NULL) + 3600), 1))); // 1 hour timeout + s_pendingRenameCharacter.insert(std::make_pair(msg.getValue().second.first, std::make_pair((::time(nullptr) + 3600), 1))); // 1 hour timeout } // tell the chat server to destroy any avatar with the new name, but only if the first name changed @@ -2099,11 +2099,11 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons { i->second.first = ssfp.getValue().second.first; if (ssfp.getValue().second.second) - i->second.second = ::time(NULL) + static_cast(ConfigCentralServer::getCtsDenyLoginThresholdSeconds()); + i->second.second = ::time(nullptr) + static_cast(ConfigCentralServer::getCtsDenyLoginThresholdSeconds()); } else { - m_playerSceneMap[ssfp.getValue().first]=std::make_pair(ssfp.getValue().second.first, (ssfp.getValue().second.second ? (::time(NULL) + static_cast(ConfigCentralServer::getCtsDenyLoginThresholdSeconds())) : 0)); + m_playerSceneMap[ssfp.getValue().first]=std::make_pair(ssfp.getValue().second.first, (ssfp.getValue().second.second ? (::time(nullptr) + static_cast(ConfigCentralServer::getCtsDenyLoginThresholdSeconds())) : 0)); } } } @@ -2250,7 +2250,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); GenericValueTypeMessage > const msg(ri); - m_timePopulationStatisticsRefresh = ::time(NULL); + m_timePopulationStatisticsRefresh = ::time(nullptr); m_populationStatistics = msg.getValue(); } else if (message.isType("GcwScoreStatRsp")) @@ -2258,7 +2258,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); GenericValueTypeMessage, std::pair >, std::map > > > > const msg(ri); - m_timeGcwScoreStatisticsRefresh = ::time(NULL); + m_timeGcwScoreStatisticsRefresh = ::time(nullptr); std::string const timeGcwScoreStatisticsRefreshStr = CalendarTime::convertEpochToTimeStringLocal(m_timeGcwScoreStatisticsRefresh); std::map const & gcwImperialScorePercentile = msg.getValue().first; @@ -2330,7 +2330,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); GenericValueTypeMessage >, std::map > > > const msg(ri); - m_timeLastLoginTimeStatisticsRefresh = ::time(NULL); + m_timeLastLoginTimeStatisticsRefresh = ::time(nullptr); m_lastLoginTimeStatistics = msg.getValue().first; m_createTimeStatistics = msg.getValue().second; } @@ -2606,7 +2606,7 @@ void CentralServer::removeGameServer(GameServerConnection const *gameServer) } else { - DEBUG_WARNING(true, ("A game server crashed but our process ID ptr is null.")); + DEBUG_WARNING(true, ("A game server crashed but our process ID ptr is nullptr.")); } } @@ -2828,7 +2828,7 @@ void CentralServer::update() if ( ConfigCentralServer::getAuctionEnabled() ) // allow auctions? { - if ( m_pAuctionTransferClient == NULL ) + if ( m_pAuctionTransferClient == nullptr ) { const char* hostName[1] = { ConfigCentralServer::getAuctionServer() }; const short port[1] = { (short)ConfigCentralServer::getAuctionPort() }; @@ -2975,7 +2975,7 @@ void CentralServer::sendToPlanetServer(const std::string &sceneId, const GameNet // ---------------------------------------------------------------------- -void CentralServer::sendToAllConnectionServers(const GameNetworkMessage & message, const bool reliable, Connection const * exclude /*= NULL*/) +void CentralServer::sendToAllConnectionServers(const GameNetworkMessage & message, const bool reliable, Connection const * exclude /*= nullptr*/) { // send to all connection servers for (ConnectionServerConnectionList::const_iterator i = m_connectionServerConnections.begin(); i != m_connectionServerConnections.end(); ++i) @@ -3005,7 +3005,7 @@ void CentralServer::sendToDBProcess(const GameNetworkMessage & message, const bo bool CentralServer::hasDBConnection() const { const GameServerConnection * g = getGameServer(getDbProcessServerProcessId()); - return (g != NULL); + return (g != nullptr); } //----------------------------------------------------------------------- @@ -3110,7 +3110,7 @@ void CentralServer::startPlanetServer(const std::string & host, const std::strin TaskSpawnProcess spawn(host.empty() ? std::string("any") : host, "PlanetServer", options, spawnDelay); CentralServer::getInstance().sendTaskMessage(spawn); - m_pendingPlanetServers[sceneId] = std::make_pair(std::make_pair(host, options), ::time(NULL)); + m_pendingPlanetServers[sceneId] = std::make_pair(std::make_pair(host, options), ::time(nullptr)); IGNORE_RETURN(m_planetsWaitingForPreload.insert(sceneId)); bool const preloadFinished = isPreloadFinished(); @@ -3119,14 +3119,14 @@ void CentralServer::startPlanetServer(const std::string & host, const std::strin else if (m_timeClusterWentIntoLoadingState <= 0) m_timeClusterWentIntoLoadingState = time(0); - if(getInstance().m_transferServerConnection != NULL && !preloadFinished) + if(getInstance().m_transferServerConnection != nullptr && !preloadFinished) { getInstance().m_transferServerConnection->disconnect(); getInstance().m_transferServerConnection = 0; s_retryTransferServerConnection = false; } - if(getInstance().m_stationPlayersCollectorConnection != NULL && ! isPreloadFinished()) + if(getInstance().m_stationPlayersCollectorConnection != nullptr && ! isPreloadFinished()) { getInstance().m_stationPlayersCollectorConnection->disconnect(); getInstance().m_stationPlayersCollectorConnection = 0; @@ -3263,7 +3263,7 @@ void CentralServer::handleGameServerForLoginMessage(const GameServerForLoginMess void CentralServer::handleExchangeListCreditsMessage(const ExchangeListCreditsMessage &msg) { LOG("Exchange", ("Central Server got exchange list credits %d.",msg.getCredits())); - if ( m_pAuctionTransferClient == NULL ) + if ( m_pAuctionTransferClient == nullptr ) { // send failure packet } @@ -3299,7 +3299,7 @@ ConnectionServerConnection * CentralServer::getAnyConnectionServer() ConnectionServerConnection * CentralServer::getConnectionServerForAccount(StationId suid) { - ConnectionServerConnection * result = NULL; + ConnectionServerConnection * result = nullptr; ConnectionServerSUIDMap::iterator i=m_accountConnectionMap.find(suid); if (i!=m_accountConnectionMap.end()) { @@ -3707,7 +3707,7 @@ void CentralServer::checkShutdownProcess() { // if it's been "awhile" since we requested to restart the PlanetServer, // then assume that something has gone wrong, and try the restart again - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); if ((iterPendingPlanetServer->second.second + static_cast(ConfigCentralServer::getMaxTimeToWaitForPlanetServerStartSeconds())) < timeNow) { @@ -3982,7 +3982,7 @@ int CentralServer::getSecondsClusterHasBeenInLoadingState() const const std::map & CentralServer::getPopulationStatistics(time_t & refreshTime) { // periodically request updated statistics from the game server - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); if (m_timePopulationStatisticsNextRefresh <= timeNow) { GameServerConnection * universeGameServerConnection = getGameServer(UniverseManager::getInstance().getUniverseProcess()); @@ -4004,7 +4004,7 @@ const std::map & CentralServer::getPopulationStatistics(time_t const std::map > > & CentralServer::getGcwScoreStatistics(time_t & refreshTime) { // periodically request updated statistics from the game server - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); if (m_timeGcwScoreStatisticsNextRefresh <= timeNow) { GameServerConnection * universeGameServerConnection = getGameServer(UniverseManager::getInstance().getUniverseProcess()); @@ -4026,7 +4026,7 @@ const std::map > std::pair > const *, std::map > const *> CentralServer::getLastLoginTimeStatistics(time_t & refreshTime) { // periodically request updated statistics from the game server - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); if (m_timeLastLoginTimeStatisticsNextRefresh <= timeNow) { GameServerConnection * universeGameServerConnection = getGameServer(UniverseManager::getInstance().getUniverseProcess()); @@ -4049,7 +4049,7 @@ std::pair > const *, std::map characterMatchStatisticsRequest("LfgStatReq", 0); diff --git a/engine/server/application/CentralServer/src/shared/CentralServer.h b/engine/server/application/CentralServer/src/shared/CentralServer.h index d628b2fa..262552b0 100755 --- a/engine/server/application/CentralServer/src/shared/CentralServer.h +++ b/engine/server/application/CentralServer/src/shared/CentralServer.h @@ -121,7 +121,7 @@ public: void sendToAllGameServersExceptDBProcess(const GameNetworkMessage & message, const bool reliable); void sendToAllPlanetServers(const GameNetworkMessage & message, const bool reliable); void sendToPlanetServer(const std::string &sceneId, const GameNetworkMessage & message, const bool reliable); - void sendToAllConnectionServers(const GameNetworkMessage & message, const bool reliable, Connection const * exclude = NULL); + void sendToAllConnectionServers(const GameNetworkMessage & message, const bool reliable, Connection const * exclude = nullptr); void sendToConnectionServerForAccount(StationId account, const GameNetworkMessage & message, const bool reliable); void sendToDBProcess(const GameNetworkMessage & message, const bool reliable) const; void sendToLoginServer(uint32 loginServerId, const GameNetworkMessage &message); diff --git a/engine/server/application/CentralServer/src/shared/CentralServerMetricsData.cpp b/engine/server/application/CentralServer/src/shared/CentralServerMetricsData.cpp index 19307914..b34c0174 100755 --- a/engine/server/application/CentralServer/src/shared/CentralServerMetricsData.cpp +++ b/engine/server/application/CentralServer/src/shared/CentralServerMetricsData.cpp @@ -148,7 +148,7 @@ void CentralServerMetricsData::updateData() // appear yellow to draw attention) for some amount of time // after detecting a system time mismatch issue #ifndef WIN32 - if ((lastTimeSystemTimeMismatchNotification + ConfigCentralServer::getSystemTimeMismatchAlertIntervalSeconds()) > ::time(NULL)) + if ((lastTimeSystemTimeMismatchNotification + ConfigCentralServer::getSystemTimeMismatchAlertIntervalSeconds()) > ::time(nullptr)) m_data[m_systemTimeMismatch].m_value = STATUS_LOADING; else m_data[m_systemTimeMismatch].m_value = 1; @@ -202,7 +202,7 @@ void CentralServerMetricsData::updateData() std::string label("population."); label += iter->first; - m_mapPopulationStatisticsIndex[iter->first] = addMetric(label.c_str(), 0, NULL, false, false); + m_mapPopulationStatisticsIndex[iter->first] = addMetric(label.c_str(), 0, nullptr, false, false); } } } @@ -235,7 +235,7 @@ void CentralServerMetricsData::updateData() } else { - gcwScoreStatisticsIndex = addMetric(iter->first.c_str(), 0, NULL, false, false); + gcwScoreStatisticsIndex = addMetric(iter->first.c_str(), 0, nullptr, false, false); IGNORE_RETURN(m_mapGcwScoreStatisticsIndex.insert(std::make_pair(iter->first, gcwScoreStatisticsIndex))); } @@ -263,7 +263,7 @@ void CentralServerMetricsData::updateData() std::string label("population."); label += secondIter.first; - m_mapLastLoginTimeStatisticsIndex[secondIter.first] = addMetric(label.c_str(), 0, NULL, false, false); + m_mapLastLoginTimeStatisticsIndex[secondIter.first] = addMetric(label.c_str(), 0, nullptr, false, false); } } } @@ -288,7 +288,7 @@ void CentralServerMetricsData::updateData() std::string label("population."); label += iter->second.first; - m_mapCreateTimeStatisticsIndex[iter->second.first] = addMetric(label.c_str(), 0, NULL, false, false); + m_mapCreateTimeStatisticsIndex[iter->second.first] = addMetric(label.c_str(), 0, nullptr, false, false); } } } diff --git a/engine/server/application/CentralServer/src/shared/CharacterCreationTracker.cpp b/engine/server/application/CentralServer/src/shared/CharacterCreationTracker.cpp index 5cbdb5c9..b56ee398 100755 --- a/engine/server/application/CentralServer/src/shared/CharacterCreationTracker.cpp +++ b/engine/server/application/CentralServer/src/shared/CharacterCreationTracker.cpp @@ -26,13 +26,13 @@ // ====================================================================== -CharacterCreationTracker * CharacterCreationTracker::ms_instance = NULL; +CharacterCreationTracker * CharacterCreationTracker::ms_instance = nullptr; // ====================================================================== void CharacterCreationTracker::install() { - DEBUG_FATAL(ms_instance != NULL,("Called install() twice.\n")); + DEBUG_FATAL(ms_instance != nullptr,("Called install() twice.\n")); ms_instance = new CharacterCreationTracker; ExitChain::add(CharacterCreationTracker::remove,"CharacterCreationTracker::remove"); } @@ -354,8 +354,8 @@ void CharacterCreationTracker::setFastCreationLock(StationId account) CharacterCreationTracker::CreationRecord::CreationRecord() : m_stage(S_queuedForGameServer), - m_gameCreationRequest(NULL), - m_loginCreationRequest(NULL), + m_gameCreationRequest(nullptr), + m_loginCreationRequest(nullptr), m_creationTime(ServerClock::getInstance().getGameTimeSeconds()), m_gameServerId(0), m_loginServerId(0), diff --git a/engine/server/application/CentralServer/src/shared/ConsoleCommandParserGame.cpp b/engine/server/application/CentralServer/src/shared/ConsoleCommandParserGame.cpp index 3231ecff..5c5f351d 100755 --- a/engine/server/application/CentralServer/src/shared/ConsoleCommandParserGame.cpp +++ b/engine/server/application/CentralServer/src/shared/ConsoleCommandParserGame.cpp @@ -117,8 +117,8 @@ bool ConsoleCommandParserGame::performParsing(const NetworkId & track, const Str if( argv.size() > 4 ) { LOG("ServerConsole", ("Received command to shutdown the cluster.")); - uint32 timeToShutdown = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), NULL, 10); - uint32 maxTime = strtoul(Unicode::wideToNarrow(argv[3]).c_str(), NULL, 10); + uint32 timeToShutdown = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), nullptr, 10); + uint32 maxTime = strtoul(Unicode::wideToNarrow(argv[3]).c_str(), nullptr, 10); Unicode::String systemMessage = Unicode::narrowToWide(""); for(unsigned int i = 4; i < argv.size(); ++i) { @@ -141,7 +141,7 @@ bool ConsoleCommandParserGame::performParsing(const NetworkId & track, const Str { if(argv.size() > 1) { - unsigned int stationId = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), NULL, 10); + unsigned int stationId = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), nullptr, 10); if(stationId > 0) { GenericValueTypeMessage auth("AuthorizeDownload", stationId); diff --git a/engine/server/application/CentralServer/src/shared/ConsoleManager.cpp b/engine/server/application/CentralServer/src/shared/ConsoleManager.cpp index d162fbb3..6535d3db 100755 --- a/engine/server/application/CentralServer/src/shared/ConsoleManager.cpp +++ b/engine/server/application/CentralServer/src/shared/ConsoleManager.cpp @@ -16,7 +16,7 @@ namespace ConsoleManagerNamespace { - ConsoleCommandParser * s_consoleCommandParserRoot = NULL; + ConsoleCommandParser * s_consoleCommandParserRoot = nullptr; } using namespace ConsoleManagerNamespace; diff --git a/engine/server/application/CentralServer/src/shared/PlanetManager.cpp b/engine/server/application/CentralServer/src/shared/PlanetManager.cpp index f9912dde..33d47cbd 100755 --- a/engine/server/application/CentralServer/src/shared/PlanetManager.cpp +++ b/engine/server/application/CentralServer/src/shared/PlanetManager.cpp @@ -138,7 +138,7 @@ PlanetServerConnection *PlanetManager::getPlanetServerForScene(const std::string if (i!=instance().m_servers.end()) return (*i).second.m_connection; else - return NULL; + return nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/application/ChatServer/src/linux/main.cpp b/engine/server/application/ChatServer/src/linux/main.cpp index eecd0c24..295c53f2 100755 --- a/engine/server/application/ChatServer/src/linux/main.cpp +++ b/engine/server/application/ChatServer/src/linux/main.cpp @@ -29,7 +29,7 @@ int main(int argc, char ** argv) SetupSharedFile::install(false); SetupSharedNetworkMessages::install(); - SetupSharedRandom::install(static_cast(time(NULL))); //lint !e1924 !e64 // NULL is a C-Style cast? + SetupSharedRandom::install(static_cast(time(nullptr))); //lint !e1924 !e64 // nullptr is a C-Style cast? Os::setProgramName("ChatServer"); //setup the server diff --git a/engine/server/application/ChatServer/src/shared/CentralServerConnection.cpp b/engine/server/application/ChatServer/src/shared/CentralServerConnection.cpp index b9fa2835..decda6cf 100755 --- a/engine/server/application/ChatServer/src/shared/CentralServerConnection.cpp +++ b/engine/server/application/ChatServer/src/shared/CentralServerConnection.cpp @@ -98,7 +98,7 @@ void CentralServerConnection::onReceive(const Archive::ByteStream & message) std::string const newNameNormalized(newName, 0, newName.find(' ')); ChatAvatarId const newAvatar("SWG", ConfigChatServer::getClusterName(), newNameNormalized); - IGNORE_RETURN(ChatServer::getChatInterface()->RequestTransferAvatar(msg.getStationId(), oldAvatar.getName(), oldAvatar.getAPIAddress(), msg.getStationId(), newAvatar.getName(), newAvatar.getAPIAddress(), true, NULL)); + IGNORE_RETURN(ChatServer::getChatInterface()->RequestTransferAvatar(msg.getStationId(), oldAvatar.getName(), oldAvatar.getAPIAddress(), msg.getStationId(), newAvatar.getName(), newAvatar.getAPIAddress(), true, nullptr)); } } else if (m.isType("ChatDestroyAvatar")) diff --git a/engine/server/application/ChatServer/src/shared/ChatInterface.cpp b/engine/server/application/ChatServer/src/shared/ChatInterface.cpp index 1ad72571..75aeae1b 100755 --- a/engine/server/application/ChatServer/src/shared/ChatInterface.cpp +++ b/engine/server/application/ChatServer/src/shared/ChatInterface.cpp @@ -350,7 +350,7 @@ void ChatInterface::OnGetRoom(unsigned track, unsigned result, const ChatRoom *r if (room) makeRoomName(room, roomName); //printf("!!!!!!!!!!!!got room %s\n", roomName.c_str()); - if (strstr(roomName.c_str(), "group") == NULL) + if (strstr(roomName.c_str(), "group") == nullptr) { ChatServer::putSystemAvatarInRoom(roomName); } @@ -373,7 +373,7 @@ void ChatInterface::OnGetRoom(unsigned track, unsigned result, const ChatRoom *r } } - ChatServerRoomOwner *owner = NULL; + ChatServerRoomOwner *owner = nullptr; if (room) owner = getRoomOwner(room->getRoomID()); @@ -709,12 +709,12 @@ std::string makeCanonicalName(const std::string &characterName) { retVal = toUpper(tmp); } - tmp = strtok(NULL, "."); + tmp = strtok(nullptr, "."); if (tmp) { retVal += (dot + tmp); } - tmp = strtok(NULL, "."); + tmp = strtok(nullptr, "."); if (tmp) { retVal += (dot + tmp); @@ -796,7 +796,7 @@ void ChatInterface::DestroyAvatar(const std::string & characterName) // track how many times we have called RequestGetAnyAvatar() for this particular DestroyAvatar // operation, so that we can stop if we somehow get stuck in an infinite loop - unsigned const trackID = RequestGetAnyAvatar(ChatUnicodeString(avatar.getName()), ChatUnicodeString(avatar.getAPIAddress()), NULL); + unsigned const trackID = RequestGetAnyAvatar(ChatUnicodeString(avatar.getName()), ChatUnicodeString(avatar.getAPIAddress()), nullptr); trackingRequestGetAnyAvatarForDestroy[trackID] = std::make_pair(std::make_pair(ChatUnicodeString(avatar.getName()), ChatUnicodeString(avatar.getAPIAddress())), 1); } @@ -848,7 +848,7 @@ void ChatInterface::sendQueuedHeadersToClient() const unsigned long queuedHeadersSendTime = currentTime + static_cast(s_intervalToSendHeadersToClientSeconds); int numberHeadersSent = 0; - const ChatPersistentMessageToClient * header = NULL; + const ChatPersistentMessageToClient * header = nullptr; for (std::map > >::iterator iter = queuedHeaders.begin(); iter != queuedHeaders.end();) { @@ -900,7 +900,7 @@ void ChatInterface::clearQueuedHeadersForAvatar(const ChatAvatarId & avatarId) void ChatInterface::addQueuedHeaderForAvatar(const ChatAvatarId & avatarId, const ChatPersistentMessageToClient * header, unsigned long sendTime) { - if (header == NULL) + if (header == nullptr) return; std::pair > & queuedHeader = queuedHeaders[avatarId]; @@ -923,7 +923,7 @@ ChatServerAvatarOwner *ChatInterface::getAvatarOwner(const ChatAvatar *avatar) return (*f).second; } } - return NULL; + return nullptr; } //----------------------------------------------------------------------- @@ -944,7 +944,7 @@ void ChatInterface::OnAddModerator(unsigned track, unsigned result, const ChatAv sequence = pair->sequence; delete pair; - pair = NULL; + pair = nullptr; } ChatAvatarId srcId; @@ -1057,7 +1057,7 @@ void ChatInterface::OnRemoveModerator(unsigned track, unsigned result, const Cha sequence = pair->sequence; delete pair; - pair = NULL; + pair = nullptr; } ChatAvatarId srcId; @@ -1178,7 +1178,7 @@ void ChatInterface::OnAddFriend(unsigned track, unsigned result, const ChatAvata ChatAvatarId d; makeAvatarId(destName, destAddress, d); - ChatServerAvatarOwner * mo = NULL; + ChatServerAvatarOwner * mo = nullptr; if (srcAvatar) mo = getAvatarOwner(srcAvatar); @@ -1206,7 +1206,7 @@ void ChatInterface::OnRemoveFriend(unsigned track, unsigned result, const ChatAv ChatAvatarId d; makeAvatarId(destName, destAddress, d); - ChatServerAvatarOwner * mo = NULL; + ChatServerAvatarOwner * mo = nullptr; if (srcAvatar) mo = getAvatarOwner(srcAvatar); @@ -1245,7 +1245,7 @@ void ChatInterface::OnIgnoreStatus(unsigned track, unsigned result, const ChatAv } } - ChatServerAvatarOwner * mo = NULL; + ChatServerAvatarOwner * mo = nullptr; if (srcAvatar) mo = getAvatarOwner(srcAvatar); if(mo) @@ -1281,7 +1281,7 @@ void ChatInterface::OnFriendStatus(unsigned track, unsigned result, const ChatAv idList.push_back(id); } } - ChatServerAvatarOwner * mo = NULL; + ChatServerAvatarOwner * mo = nullptr; if (srcAvatar) mo = getAvatarOwner(srcAvatar); if(mo) @@ -1304,7 +1304,7 @@ void ChatInterface::OnReceiveFriendLogin(const ChatAvatar *srcAvatar, const Chat PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnReceiveFriendLogin"); UNREF(srcAddress); - ChatServerAvatarOwner * owner = NULL; + ChatServerAvatarOwner * owner = nullptr; if (destAvatar) owner = getAvatarOwner(destAvatar); if(owner) @@ -1332,7 +1332,7 @@ void ChatInterface::OnReceiveFriendLogout(const ChatAvatar *srcAvatar, const Cha PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnReceiveFriendLogout"); UNREF(srcAddress); - ChatServerAvatarOwner * owner = NULL; + ChatServerAvatarOwner * owner = nullptr; if (destAvatar) owner = getAvatarOwner(destAvatar); if(owner) @@ -1395,7 +1395,7 @@ void ChatInterface::OnRemoveIgnore(unsigned track, unsigned result, const ChatAv ChatAvatarId d; makeAvatarId(destName, destAddress, d); - ChatServerAvatarOwner * mo = NULL; + ChatServerAvatarOwner * mo = nullptr; if (srcAvatar) mo = getAvatarOwner(srcAvatar); if(mo) @@ -1435,7 +1435,7 @@ void ChatInterface::OnLoginAvatar(unsigned track, unsigned result, const ChatAva if ((result == CHATRESULT_SUCCESS) && newAvatar) { // destroy chat avatar - unsigned const trackID = RequestDestroyAvatar(newAvatar, NULL); + unsigned const trackID = RequestDestroyAvatar(newAvatar, nullptr); trackingRequestGetAnyAvatarForDestroy[trackID] = iterFind->second; } @@ -1504,7 +1504,7 @@ void ChatInterface::OnLoginAvatar(unsigned track, unsigned result, const ChatAva static Unicode::String wideFilter = Unicode::narrowToWide(""); static ChatUnicodeString swgNode(wideSWG.data(), wideSWG.size()); static ChatUnicodeString filter(wideFilter.data(), wideFilter.size()); - IGNORE_RETURN(RequestGetRoomSummaries(swgNode, filter, NULL)); + IGNORE_RETURN(RequestGetRoomSummaries(swgNode, filter, nullptr)); } } else @@ -1525,11 +1525,11 @@ void ChatInterface::OnLoginAvatar(unsigned track, unsigned result, const ChatAva if(ChatServer::isGod(f->second)) { - RequestSetAvatarAttributes(newAvatar, AVATARATTR_GM, NULL); + RequestSetAvatarAttributes(newAvatar, AVATARATTR_GM, nullptr); } else { - RequestSetAvatarAttributes(newAvatar, 0, NULL); + RequestSetAvatarAttributes(newAvatar, 0, nullptr); } ChatServer::chatConnectedAvatar((*f).second, *newAvatar); @@ -1549,7 +1549,7 @@ void ChatInterface::OnLoginAvatar(unsigned track, unsigned result, const ChatAva //ChatServer::getFriendsList(id); clearQueuedHeadersForAvatar(avId); - IGNORE_RETURN(RequestGetPersistentHeaders(newAvatar, NULL)); + IGNORE_RETURN(RequestGetPersistentHeaders(newAvatar, nullptr)); //REPORT_LOG(true, ("Connection to chat system for %s.%s.%s confirmed\n", avatar.GetGameCode().c_str(), avatar.GetGameServerName().c_str(), avatar.GetCharacterName().c_str())); }//lint !e429 Custodial pointer 'owner' has not been freed or returned // jrandall avatar owns it pendingAvatars.erase(f); @@ -1560,7 +1560,7 @@ void ChatInterface::OnLoginAvatar(unsigned track, unsigned result, const ChatAva // the time they connected to the connection server and the time // this message arrived from the chat backend. if (newAvatar) - IGNORE_RETURN(RequestLogoutAvatar(newAvatar, NULL)); + IGNORE_RETURN(RequestLogoutAvatar(newAvatar, nullptr)); } } ChatOnConnectAvatar const connect; @@ -1585,7 +1585,7 @@ void ChatInterface::OnCreateRoom(unsigned track,unsigned result, const ChatRoom static ChatUnicodeString swgNode(wideSWG.data(), wideSWG.size()); static ChatUnicodeString filter(wideFilter.data(), wideFilter.size()); //printf("!!!!Calling GetRoomSummaries from OnCreateRoom\n"); - //IGNORE_RETURN(RequestGetRoomSummaries(swgNode, filter, NULL)); + //IGNORE_RETURN(RequestGetRoomSummaries(swgNode, filter, nullptr)); ChatRoomData roomData; @@ -1598,7 +1598,7 @@ void ChatInterface::OnCreateRoom(unsigned track,unsigned result, const ChatRoom //Unicode::String wideRoomName(newRoom->getRoomName().string_data, newRoom->getRoomName().string_length); std::string roomName; makeRoomName(newRoom, roomName); - if (strstr(roomName.c_str(), "group") == NULL) + if (strstr(roomName.c_str(), "group") == nullptr) { ChatServer::putSystemAvatarInRoom(roomName); } @@ -1644,7 +1644,7 @@ void ChatInterface::OnGetRoomSummaries(unsigned track, unsigned result, unsigned std::unordered_map::const_iterator f = roomList.find(lowerRoomName); if(f == roomList.end()) { - RequestGetRoom(foundRooms[i].getRoomAddress(), NULL); + RequestGetRoom(foundRooms[i].getRoomAddress(), nullptr); //ChatServerRoomOwner * o = new ChatServerRoomOwner((*i)); //(*i)->SetRoomOwnerPtr(o); //IGNORE_RETURN(roomList.insert(std::make_pair(lowerRoomName, *o))); @@ -1664,7 +1664,7 @@ const ChatServerRoomOwner *ChatInterface::getRoomOwner(const std::string & roomN { return &((*f).second); } - return NULL; + return nullptr; } //----------------------------------------------------------------------- @@ -1680,7 +1680,7 @@ ChatServerRoomOwner *ChatInterface::getRoomOwner(unsigned roomId) } ++f; } - return NULL; + return nullptr; } //----------------------------------------------------------------------- @@ -1727,13 +1727,13 @@ void ChatInterface::OnDestroyRoom(unsigned track, unsigned result, void *user) static Unicode::String wideFilter = Unicode::narrowToWide(""); static ChatUnicodeString swgNode(wideSWG.data(), wideSWG.size()); static ChatUnicodeString filter(wideFilter.data(), wideFilter.size()); - //IGNORE_RETURN(RequestGetRoomSummaries(swgNode, filter, NULL)); + //IGNORE_RETURN(RequestGetRoomSummaries(swgNode, filter, nullptr)); ChatAvatarId destroyer; RoomOwnerSequencePair *pair = (RoomOwnerSequencePair *)user; - const ChatServerRoomOwner * owner = NULL; + const ChatServerRoomOwner * owner = nullptr; unsigned sequence = 0; if (pair) { @@ -1805,7 +1805,7 @@ void ChatInterface::OnDestroyAvatar(unsigned track, unsigned result, const ChatA // stop if it looks like we're in an infinite loop if (iterFind->second.second <= 25) { - unsigned const trackID = RequestGetAnyAvatar(iterFind->second.first.first, iterFind->second.first.second, NULL); + unsigned const trackID = RequestGetAnyAvatar(iterFind->second.first.first, iterFind->second.first.second, nullptr); trackingRequestGetAnyAvatarForDestroy[trackID] = std::make_pair(iterFind->second.first, (iterFind->second.second + 1)); } } @@ -1828,13 +1828,13 @@ void ChatInterface::OnGetAnyAvatar(unsigned track, unsigned result, const ChatAv // can only destroy the avatar if he is logged in if (loggedIn) { - unsigned const trackID = RequestDestroyAvatar(foundAvatar, NULL); + unsigned const trackID = RequestDestroyAvatar(foundAvatar, nullptr); trackingRequestGetAnyAvatarForDestroy[trackID] = iterFind->second; } // log in the chat avatar so we can destroy him else { - unsigned const trackID = RequestLoginAvatar(foundAvatar->getUserID(), foundAvatar->getName(), foundAvatar->getAddress(), NULL); + unsigned const trackID = RequestLoginAvatar(foundAvatar->getUserID(), foundAvatar->getName(), foundAvatar->getAddress(), nullptr); trackingRequestGetAnyAvatarForDestroy[trackID] = iterFind->second; } } @@ -1850,9 +1850,9 @@ void ChatInterface::OnReceiveForcedLogout(const ChatAvatar *oldAvatar) ChatServer::fileLog(false, "ChatInterface", "OnReceiveForcedLogout() oldAvatar(%s)", ChatServer::getFullChatAvatarName(oldAvatar).c_str()); PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnReceiveForcedLogout"); - if (oldAvatar == NULL) + if (oldAvatar == nullptr) { - DEBUG_WARNING(true, ("We received an OnReceiveForcedLogout with a success result code but NULL data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnReceiveForcedLogout with a success result code but nullptr data. This is an error that the API should never give.")); return; } ChatAvatarId id; @@ -1876,9 +1876,9 @@ void ChatInterface::OnEnterRoom(unsigned track, unsigned result, const ChatAvata PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnEnterRoom"); - if (result == CHATRESULT_SUCCESS && (srcAvatar == NULL || destRoom == NULL)) + if (result == CHATRESULT_SUCCESS && (srcAvatar == nullptr || destRoom == nullptr)) { - DEBUG_WARNING(true, ("We received an OnEnterRoom with a success result code but NULL data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnEnterRoom with a success result code but nullptr data. This is an error that the API should never give.")); return; } @@ -2097,9 +2097,9 @@ void ChatInterface::OnAddBan(unsigned track, unsigned result, const ChatAvatar * PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnAddBan"); - if (result == CHATRESULT_SUCCESS && (srcAvatar == NULL || destRoom == NULL)) + if (result == CHATRESULT_SUCCESS && (srcAvatar == nullptr || destRoom == nullptr)) { - DEBUG_WARNING(true, ("We received an OnAddBan with a success result code but NULL data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnAddBan with a success result code but nullptr data. This is an error that the API should never give.")); return; } @@ -2113,7 +2113,7 @@ void ChatInterface::OnAddBan(unsigned track, unsigned result, const ChatAvatar * sequence = pair->sequence; delete pair; - pair = NULL; + pair = nullptr; } ChatAvatarId srcId; @@ -2218,9 +2218,9 @@ void ChatInterface::OnRemoveBan(unsigned track, unsigned result, const ChatAvata PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnRemoveBan"); - if (result == CHATRESULT_SUCCESS && (srcAvatar == NULL || destRoom == NULL)) + if (result == CHATRESULT_SUCCESS && (srcAvatar == nullptr || destRoom == nullptr)) { - DEBUG_WARNING(true, ("We received an OnRemoveBan with a success result code but NULL data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnRemoveBan with a success result code but nullptr data. This is an error that the API should never give.")); return; } @@ -2234,7 +2234,7 @@ void ChatInterface::OnRemoveBan(unsigned track, unsigned result, const ChatAvata sequence = pair->sequence; delete pair; - pair = NULL; + pair = nullptr; } ChatAvatarId srcId; @@ -2337,9 +2337,9 @@ void ChatInterface::OnAddInvite(unsigned track, unsigned result, const ChatAvata PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnAddInvite"); - if (result == CHATRESULT_SUCCESS && (srcAvatar == NULL || destRoom == NULL)) + if (result == CHATRESULT_SUCCESS && (srcAvatar == nullptr || destRoom == nullptr)) { - DEBUG_WARNING(true, ("We received an OnAddInvite with a success result code but NULL data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnAddInvite with a success result code but nullptr data. This is an error that the API should never give.")); return; } @@ -2353,7 +2353,7 @@ void ChatInterface::OnAddInvite(unsigned track, unsigned result, const ChatAvata sequence = pair->sequence; delete pair; - pair = NULL; + pair = nullptr; } ChatAvatarId srcId; @@ -2378,7 +2378,7 @@ void ChatInterface::OnAddInvite(unsigned track, unsigned result, const ChatAvata { // Calling this on a room will cause the API to cache the room // and to receive room updates for the room. - RequestGetRoom(destRoom->getAddress(), NULL); + RequestGetRoom(destRoom->getAddress(), nullptr); // Send the room data for the room the avatar was invited to join // since the room may be private and may be unknown to the player @@ -2455,9 +2455,9 @@ void ChatInterface::OnRemoveInvite(unsigned track, unsigned result, const ChatAv PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnRemoveInvite"); - if (result == CHATRESULT_SUCCESS && (srcAvatar == NULL || destRoom == NULL)) + if (result == CHATRESULT_SUCCESS && (srcAvatar == nullptr || destRoom == nullptr)) { - DEBUG_WARNING(true, ("We received an OnRemoveInvite with a success result code but NULL data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnRemoveInvite with a success result code but nullptr data. This is an error that the API should never give.")); return; } @@ -2471,7 +2471,7 @@ void ChatInterface::OnRemoveInvite(unsigned track, unsigned result, const ChatAv sequence = pair->sequence; delete pair; - pair = NULL; + pair = nullptr; } std::string roomName; @@ -2555,9 +2555,9 @@ void ChatInterface::OnLeaveRoom(unsigned track, unsigned result, const ChatAvata PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnLeaveRoom"); - if (result == CHATRESULT_SUCCESS && (srcAvatar == NULL || destRoom == NULL)) + if (result == CHATRESULT_SUCCESS && (srcAvatar == nullptr || destRoom == nullptr)) { - DEBUG_WARNING(true, ("We received an OnLeaveRoom with a success result code but NULL data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnLeaveRoom with a success result code but nullptr data. This is an error that the API should never give.")); return; } @@ -2653,7 +2653,7 @@ void ChatInterface::OnKickAvatar(unsigned track, unsigned result, const ChatAvat sequence = pair->sequence; delete pair; - pair = NULL; + pair = nullptr; } std::string roomName; @@ -2755,9 +2755,9 @@ void ChatInterface::OnGetPersistentMessage(unsigned track, unsigned result, Chat ChatServer::fileLog(false, "ChatInterface", "OnGetPersistentMessage() track(%u) result(%u) destAvatar(%s)", track, result, ChatServer::getFullChatAvatarName(destAvatar).c_str()); PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnGetPersistentMessage"); - if (result == CHATRESULT_SUCCESS && (destAvatar == NULL)) + if (result == CHATRESULT_SUCCESS && (destAvatar == nullptr)) { - DEBUG_WARNING(true, ("We received an OnGetPersistentMessage with a success result code but NULL data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnGetPersistentMessage with a success result code but nullptr data. This is an error that the API should never give.")); return; } UNREF(user); @@ -2807,9 +2807,9 @@ void ChatInterface::OnGetPersistentHeaders(unsigned track, unsigned result, Chat ChatServer::fileLog(false, "ChatInterface", "OnGetPersistentHeaders() track(%u) result(%u) destAvatar(%s)", track, result, ChatServer::getFullChatAvatarName(destAvatar).c_str(), listLength); PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnGetPersistentHeaders"); - if (result == CHATRESULT_SUCCESS && (destAvatar == NULL)) + if (result == CHATRESULT_SUCCESS && (destAvatar == nullptr)) { - DEBUG_WARNING(true, ("We received an OnGetPersistentHeaders with a success result code but NULL data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnGetPersistentHeaders with a success result code but nullptr data. This is an error that the API should never give.")); return; } UNREF(track); @@ -2876,9 +2876,9 @@ void ChatInterface::OnReceivePersistentMessage(const ChatAvatar *destAvatar, con ChatServer::fileLog(false, "ChatInterface", "OnReceivePersistentMessage() destAvatar(%s)", ChatServer::getFullChatAvatarName(destAvatar).c_str()); PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnReceivePersistentMessage"); - if (destAvatar == NULL) + if (destAvatar == nullptr) { - DEBUG_WARNING(true, ("We received an OnREceivePersistentMessage with a success result code but NULL data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnREceivePersistentMessage with a success result code but nullptr data. This is an error that the API should never give.")); return; } if (!header) @@ -2910,9 +2910,9 @@ void ChatInterface::OnSendRoomMessage(unsigned track, unsigned result, const Cha ChatServer::fileLog(false, "ChatInterface", "OnSendRoomMessage() track(%u) result(%u) srcAvatar(%s) destRoom(%s)", track, result, ChatServer::getFullChatAvatarName(srcAvatar).c_str(), ChatServer::getChatRoomNameNarrow(destRoom).c_str()); PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnSendRoomMessage"); - if (result == CHATRESULT_SUCCESS && (srcAvatar == NULL || destRoom == NULL)) + if (result == CHATRESULT_SUCCESS && (srcAvatar == nullptr || destRoom == nullptr)) { - DEBUG_WARNING(true, ("We received an OnsendRoomMessage with a success result code but NULL data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnsendRoomMessage with a success result code but nullptr data. This is an error that the API should never give.")); return; } UNREF(srcAvatar); @@ -2931,7 +2931,7 @@ void ChatInterface::OnReceiveRoomMessage(const ChatAvatar *srcAvatar, const Chat PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnReceiveRoomMessage"); if(! srcAvatar || ! destAvatar || ! destRoom) { - DEBUG_WARNING(true, ("We received an OnREceiveRoomMessage with a success result code but NULL data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnREceiveRoomMessage with a success result code but nullptr data. This is an error that the API should never give.")); return; } @@ -2995,9 +2995,9 @@ void ChatInterface::OnSendInstantMessage(unsigned track, unsigned result, const PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnSendInstantMessage"); - if (result == CHATRESULT_SUCCESS && (srcAvatar == NULL)) + if (result == CHATRESULT_SUCCESS && (srcAvatar == nullptr)) { - DEBUG_WARNING(true, ("We received an OnSendInstantMessage with a success result code but NULL data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnSendInstantMessage with a success result code but nullptr data. This is an error that the API should never give.")); return; } UNREF(srcAvatar); @@ -3015,9 +3015,9 @@ void ChatInterface::OnReceiveInstantMessage(const ChatAvatar *srcAvatar, const C ChatServer::fileLog(false, "ChatInterface", "OnReceiveInstantMessage() srcAvatar(%s) destAvatar(%s)", ChatServer::getFullChatAvatarName(srcAvatar).c_str(), ChatServer::getFullChatAvatarName(destAvatar).c_str()); PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnReceiveInstantMessage"); - if ((srcAvatar == NULL || destAvatar == NULL)) + if ((srcAvatar == nullptr || destAvatar == nullptr)) { - DEBUG_WARNING(true, ("We received an OnReceiveInstantMessage with a success result code but NULL data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnReceiveInstantMessage with a success result code but nullptr data. This is an error that the API should never give.")); return; } ChatAvatarId fromId; @@ -3052,9 +3052,9 @@ void ChatInterface::OnSendPersistentMessage(unsigned track, unsigned result, con ChatServer::fileLog(false, "ChatInterface", "OnSendPersistentMessage() track(%u) result(%u) srcAvatar(%s)", track, result, ChatServer::getFullChatAvatarName(srcAvatar).c_str()); PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnSendPersistentMessage"); - if (result == CHATRESULT_SUCCESS && (srcAvatar == NULL)) + if (result == CHATRESULT_SUCCESS && (srcAvatar == nullptr)) { - DEBUG_WARNING(true, ("We received an OnSendPersistentMessage with a success result code but NULL data. This is an error that the API should never give.")); + DEBUG_WARNING(true, ("We received an OnSendPersistentMessage with a success result code but nullptr data. This is an error that the API should never give.")); return; } unsigned sequence = (unsigned)user; @@ -3120,7 +3120,7 @@ void ChatInterface::OnUpdatePersistentMessages(unsigned track, unsigned result, ChatAvatarId targetChatAvatarId; - if (targetAvatar != NULL) + if (targetAvatar != nullptr) { makeAvatarId(*targetAvatar, targetChatAvatarId); } @@ -3130,17 +3130,17 @@ void ChatInterface::OnUpdatePersistentMessages(unsigned track, unsigned result, ChatAvatarId sourceChatAvatarId; NetworkId const *tmpNetworkId = reinterpret_cast(user); - if (tmpNetworkId != NULL) + if (tmpNetworkId != nullptr) { ChatAvatar const *sourceAvatar = ChatServer::getAvatarByNetworkId(*tmpNetworkId); - if (sourceAvatar != NULL) + if (sourceAvatar != nullptr) { makeAvatarId(*sourceAvatar, sourceChatAvatarId); } delete tmpNetworkId; - tmpNetworkId = NULL; + tmpNetworkId = nullptr; } ChatServer::fileLog(false, "ChatInterface", "OnUpdatePersistentMessage() track(%u) result(%u) sourceAvatar(%s) targetAvatar(%s)", track, result, sourceChatAvatarId.getFullName().c_str(), targetChatAvatarId.getFullName().c_str()); diff --git a/engine/server/application/ChatServer/src/shared/ChatServer.cpp b/engine/server/application/ChatServer/src/shared/ChatServer.cpp index 76d47a9c..c8e12a6d 100755 --- a/engine/server/application/ChatServer/src/shared/ChatServer.cpp +++ b/engine/server/application/ChatServer/src/shared/ChatServer.cpp @@ -162,7 +162,7 @@ void ChatServerNamespace::cleanChatLog() //----------------------------------------------------------------------- -ChatServer *ChatServer::m_instance = NULL; +ChatServer *ChatServer::m_instance = nullptr; #include @@ -250,7 +250,7 @@ if ((t3 - t2) > (1000 * 5)) static Unicode::String wideFilter = Unicode::narrowToWide(""); static ChatUnicodeString swgNode(wideSWG.data(), wideSWG.size()); static ChatUnicodeString filter(wideFilter.data(), wideFilter.size()); - instance().chatInterface->RequestGetRoomSummaries(swgNode, filter, NULL); + instance().chatInterface->RequestGetRoomSummaries(swgNode, filter, nullptr); } ++i; @@ -286,7 +286,7 @@ gameService(0), planetService(), ownerSystem(0), systemAvatarId("SWG", ConfigChatServer::getClusterName(), "SYSTEM"), -customerServiceServerConnection(NULL), +customerServiceServerConnection(nullptr), m_gameServerConnectionRegistry(), m_voiceChatIdMap() { @@ -452,7 +452,7 @@ void ChatServer::setOwnerSystem(const ChatAvatar * o) Connection *connection = safe_cast(instance().centralServerConnection); - if (connection != NULL) + if (connection != nullptr) { connection->send(bs, true); } @@ -618,7 +618,7 @@ const ChatAvatar * ChatServer::getAvatarByNetworkId(const NetworkId & id) { if (id.getValue() == 0) { - return NULL; + return nullptr; } const ChatAvatar * result = 0; ChatAvatarList::const_iterator f = instance().chatAvatars.find(id); @@ -635,7 +635,7 @@ ChatServer::AvatarExtendedData * ChatServer::getAvatarExtendedDataByNetworkId(co { if (id.getValue() == 0) { - return NULL; + return nullptr; } ChatServer::AvatarExtendedData * result = 0; ChatAvatarList::iterator f = instance().chatAvatars.find(id); @@ -783,7 +783,7 @@ void ChatServer::addFriend(const NetworkId & id, const unsigned int sequence, co unsigned track = instance().chatInterface->RequestAddFriend(from, ChatUnicodeString(friendName.data(), friendName.length()), ChatUnicodeString(friendAddress.data(), friendAddress.length()), - false, NULL); + false, nullptr); instance().pendingRequests[track] = id; } else @@ -810,7 +810,7 @@ void ChatServer::removeFriend(const NetworkId & id, const unsigned int sequence, splitChatAvatarId(friendId, friendName, friendAddress); unsigned track = instance().chatInterface->RequestRemoveFriend(from, ChatUnicodeString(friendName.data(), friendName.length()), - ChatUnicodeString(friendAddress.data(), friendAddress.length()), NULL); + ChatUnicodeString(friendAddress.data(), friendAddress.length()), nullptr); instance().pendingRequests[track] = id; } else @@ -829,7 +829,7 @@ void ChatServer::getFriendsList(const ChatAvatarId &characterName) const ChatAvatar *avatar = getAvatarByNetworkId(id); if (avatar) { - unsigned track = instance().chatInterface->RequestFriendStatus(avatar, NULL); + unsigned track = instance().chatInterface->RequestFriendStatus(avatar, nullptr); instance().pendingRequests[track] = id; } else @@ -857,7 +857,7 @@ void ChatServer::addIgnore(const NetworkId & id, const unsigned int sequence, co unsigned track = instance().chatInterface->RequestAddIgnore(from, ChatUnicodeString(ignoreName.data(), ignoreName.length()), ChatUnicodeString(ignoreAddress.data(), ignoreAddress.length()), - NULL); + nullptr); instance().pendingRequests[track] = id; } else @@ -884,7 +884,7 @@ void ChatServer::removeIgnore(const NetworkId & id, const unsigned int sequence, splitChatAvatarId(ignoreId, ignoreName, ignoreAddress); unsigned track = instance().chatInterface->RequestRemoveIgnore(from, ChatUnicodeString(ignoreName.data(), ignoreName.length()), - ChatUnicodeString(ignoreAddress.data(), ignoreAddress.length()), NULL); + ChatUnicodeString(ignoreAddress.data(), ignoreAddress.length()), nullptr); instance().pendingRequests[track] = id; } else @@ -905,7 +905,7 @@ void ChatServer::getIgnoreList(const ChatAvatarId &characterName) if (avatar) { - unsigned track = instance().chatInterface->RequestIgnoreStatus(avatar, NULL); + unsigned track = instance().chatInterface->RequestIgnoreStatus(avatar, nullptr); instance().pendingRequests[track] = id; } else @@ -1160,7 +1160,7 @@ void ChatServer::createRoom(const NetworkId & id, const unsigned int sequence, c { roomAttr |= ROOMATTR_PRIVATE; } - if (isSystemOwner && (strstr(roomName.c_str(), "system") != NULL)) + if (isSystemOwner && (strstr(roomName.c_str(), "system") != nullptr)) { roomAttr |= ROOMATTR_PERSISTENT; } @@ -1193,7 +1193,7 @@ void ChatServer::deleteAllPersistentMessages(const NetworkId &sourceNetworkId, c ChatAvatar const *avatar = getAvatarByNetworkId(targetNetworkId); - if (avatar != NULL) + if (avatar != nullptr) { { NetworkId *tmpNetworkId = new NetworkId(sourceNetworkId); @@ -1225,7 +1225,7 @@ void ChatServer::deletePersistentMessage(const NetworkId &id, const unsigned int const ChatAvatar *avatar = getAvatarByNetworkId(id); if (avatar) { - instance().chatInterface->RequestUpdatePersistentMessage(avatar, messageId, PERSISTENT_DELETED, NULL); + instance().chatInterface->RequestUpdatePersistentMessage(avatar, messageId, PERSISTENT_DELETED, nullptr); } } @@ -1290,10 +1290,10 @@ void ChatServer::destroyRoom(const std::string & roomName) { ChatServer::fileLog(s_enableChatRoomLogs, "ChatServer", "destroyRoom() roomName(%s)", roomName.c_str()); - if ((strstr(roomName.c_str(), ConfigChatServer::getClusterName()) != NULL) || + if ((strstr(roomName.c_str(), ConfigChatServer::getClusterName()) != nullptr) || (strstr(roomName.c_str(), toLower(std::string(ConfigChatServer::getClusterName() ) ).c_str() ) )) { - if ((strstr(roomName.c_str(), "GroupChat") != NULL) || (strstr(roomName.c_str(), "groupchat") != NULL)) + if ((strstr(roomName.c_str(), "GroupChat") != nullptr) || (strstr(roomName.c_str(), "groupchat") != nullptr)) { size_t pos = roomName.rfind("."); if (pos != roomName.npos) @@ -1311,7 +1311,7 @@ void ChatServer::destroyRoom(const std::string & roomName) const ChatServerRoomOwner *owner = instance().chatInterface->getRoomOwner(roomName); if (!instance().ownerSystem) { - DEBUG_WARNING(true, ("Chat ownerSystem is NULL")); + DEBUG_WARNING(true, ("Chat ownerSystem is nullptr")); return; } if (owner) @@ -1331,7 +1331,7 @@ void ChatServer::disconnectAvatar(const ChatAvatar & avatar) if (&avatar == instance().ownerSystem) { - instance().ownerSystem = NULL; + instance().ownerSystem = nullptr; } ChatAvatarList::iterator i; for(i = instance().chatAvatars.begin(); i != instance().chatAvatars.end(); ++i) @@ -1423,7 +1423,7 @@ void ChatServer::enterRoom(const ChatAvatarId & id, const std::string & roomName const ChatAvatar *avatar = getAvatarByNetworkId(getNetworkIdByAvatarId(id)); if (room && avatar) { - instance().chatInterface->RequestEnterRoom(avatar, room->getAddress(), NULL); + instance().chatInterface->RequestEnterRoom(avatar, room->getAddress(), nullptr); } else { @@ -1450,7 +1450,7 @@ void ChatServer::putSystemAvatarInRoom(const std::string & roomName) const ChatServerRoomOwner *room = instance().chatInterface->getRoomOwner(roomName); if (room && instance().ownerSystem) { - instance().chatInterface->RequestEnterRoom(instance().ownerSystem, room->getAddress(), NULL); + instance().chatInterface->RequestEnterRoom(instance().ownerSystem, room->getAddress(), nullptr); } } @@ -1619,7 +1619,7 @@ void ChatServer::invite(const NetworkId & id, const ChatAvatarId & avatarId, con ChatServer::fileLog(s_enableChatRoomLogs, "ChatServer", "invite() id(%s) avatar(%s) roomName(%s)", id.getValueString().c_str(), avatarId.getFullName().c_str(), roomName.c_str()); // Try to get an invitor - ChatAvatar const * invitor = NULL; + ChatAvatar const * invitor = nullptr; if (id != NetworkId::cms_invalid) { invitor = getAvatarByNetworkId(id); @@ -1738,7 +1738,7 @@ void ChatServer::inviteGroupMembers(const NetworkId & id, const ChatAvatarId & a void ChatServer::removeSystemAvatarFromRoom(const ChatRoom *room) { - ChatServer::fileLog(s_enableChatRoomLogs, "ChatServer", "removeSystemAvatarFromRoom() room(%s)", (room != NULL) ? toNarrowString(room->getRoomName()).c_str() : "NULL"); + ChatServer::fileLog(s_enableChatRoomLogs, "ChatServer", "removeSystemAvatarFromRoom() room(%s)", (room != nullptr) ? toNarrowString(room->getRoomName()).c_str() : "nullptr"); if (!room || !instance().ownerSystem) { @@ -1754,7 +1754,7 @@ void ChatServer::removeSystemAvatarFromRoom(const ChatRoom *room) } } - instance().chatInterface->RequestLeaveRoom(instance().ownerSystem, room->getAddress(), NULL); + instance().chatInterface->RequestLeaveRoom(instance().ownerSystem, room->getAddress(), nullptr); } //----------------------------------------------------------------------- @@ -1991,7 +1991,7 @@ void ChatServer::sendInstantMessage(const ChatAvatarId & from, const ChatAvatarI const NetworkId &toNetworkId = getNetworkIdByAvatarId(to); const ChatAvatar * toAvatar = getAvatarByNetworkId(toNetworkId); - if (toAvatar != NULL) + if (toAvatar != nullptr) { ChatServer::fileLog(false, "ChatServer", "sendInstantMessage() resolved tell locally"); @@ -2022,7 +2022,7 @@ void ChatServer::sendInstantMessage(const ChatAvatarId & from, const ChatAvatarI IGNORE_RETURN(instance().chatInterface->RequestSendInstantMessage(fromAvatar, ChatUnicodeString(friendName.data(), friendName.size()), ChatUnicodeString(friendAddress.data(), friendAddress.size()), - ChatUnicodeString(message.data(), message.size()), ChatUnicodeString(outOfBand.data(), outOfBand.size()), NULL)); + ChatUnicodeString(message.data(), message.size()), ChatUnicodeString(outOfBand.data(), outOfBand.size()), nullptr)); } } } @@ -2054,7 +2054,7 @@ void ChatServer::sendInstantMessage(const NetworkId & fromId, const unsigned int { return; } - else if (::time(NULL) < aed->unsquelchTime) // still in squelch period + else if (::time(nullptr) < aed->unsquelchTime) // still in squelch period { return; } @@ -2076,14 +2076,14 @@ void ChatServer::sendInstantMessage(const NetworkId & fromId, const unsigned int Unicode::String wideFrom; Unicode::String wideTo; - if (from != NULL) + if (from != nullptr) { makeAvatarId(*from, fromAvatarId); wideFrom = (Unicode::narrowToWide(fromAvatarId.getFullName())); } ChatAvatarId toAvatarId; - if (toAvatar != NULL) + if (toAvatar != nullptr) { ChatServer::fileLog(false, "ChatServer", "sendInstantMessage() resolved tell locally"); @@ -2158,7 +2158,7 @@ void ChatServer::sendPersistentMessage(const ChatAvatarId & from, const ChatAvat ChatUnicodeString(subject.data(), subject.size()), ChatUnicodeString(message.data(), message.size()), ChatUnicodeString(oob.data(), oob.size()), - NULL + nullptr ); Unicode::String log; @@ -2187,7 +2187,7 @@ void ChatServer::sendPersistentMessage(const NetworkId & fromId, const unsigned // to.cluster.c_str(), to.name.c_str()); UNREF(sequenceId); ChatServer::AvatarExtendedData * aed = getAvatarExtendedDataByNetworkId(fromId); - const ChatAvatar * from = (aed ? &(aed->chatAvatar) : NULL); + const ChatAvatar * from = (aed ? &(aed->chatAvatar) : nullptr); if(from) { // see if player is squelched @@ -2197,7 +2197,7 @@ void ChatServer::sendPersistentMessage(const NetworkId & fromId, const unsigned { return; } - else if (::time(NULL) < aed->unsquelchTime) // still in squelch period + else if (::time(nullptr) < aed->unsquelchTime) // still in squelch period { return; } @@ -2225,7 +2225,7 @@ void ChatServer::sendPersistentMessage(const NetworkId & fromId, const unsigned ChatAvatarId fromAvatarId; - if (from != NULL) + if (from != nullptr) { makeAvatarId(*from, fromAvatarId); } @@ -2255,7 +2255,7 @@ void ChatServer::sendRoomMessage(const ChatAvatarId &id, const std::string & roo if (!instance().ownerSystem) { - DEBUG_WARNING(true, ("Chat ownerSystem is NULL")); + DEBUG_WARNING(true, ("Chat ownerSystem is nullptr")); return; } // get room id @@ -2265,7 +2265,7 @@ void ChatServer::sendRoomMessage(const ChatAvatarId &id, const std::string & roo { const ChatAvatar *sender = instance().ownerSystem; - IGNORE_RETURN(instance().chatInterface->RequestSendRoomMessage(sender, (*f).second.getAddress(), ChatUnicodeString(msg.data(), msg.size()), ChatUnicodeString(oob.data(), oob.size()), NULL)); + IGNORE_RETURN(instance().chatInterface->RequestSendRoomMessage(sender, (*f).second.getAddress(), ChatUnicodeString(msg.data(), msg.size()), ChatUnicodeString(oob.data(), oob.size()), nullptr)); } } } @@ -2280,7 +2280,7 @@ void ChatServer::sendRoomMessage(const NetworkId & id, const unsigned int sequen UNREF(sequence); ChatServer::AvatarExtendedData * aed = getAvatarExtendedDataByNetworkId(id); - const ChatAvatar * sender = (aed ? &(aed->chatAvatar) : NULL); + const ChatAvatar * sender = (aed ? &(aed->chatAvatar) : nullptr); const ChatServerRoomOwner *room = instance().chatInterface->getRoomOwner(roomId); if(sender && room) { @@ -2296,7 +2296,7 @@ void ChatServer::sendRoomMessage(const NetworkId & id, const unsigned int sequen aed->nonSpatialCharCount += msg.size(); // sync chat character count with game server - timeNow = ::time(NULL); + timeNow = ::time(nullptr); if ((timeNow > aed->chatSpamNextTimeToSyncWithGameServer) || (timeNow > aed->chatSpamTimeEndInterval)) { GenericValueTypeMessage, std::pair > > chatStatistics("ChatStatisticsCS", std::make_pair(std::make_pair(id, static_cast(aed->chatSpamTimeEndInterval)), std::make_pair(aed->spatialCharCount, aed->nonSpatialCharCount))); @@ -2322,7 +2322,7 @@ void ChatServer::sendRoomMessage(const NetworkId & id, const unsigned int sequen allowToSpeak = false; squelched = true; } - else if (::time(NULL) < aed->unsquelchTime) // still in squelch period + else if (::time(nullptr) < aed->unsquelchTime) // still in squelch period { allowToSpeak = false; squelched = true; @@ -2393,7 +2393,7 @@ void ChatServer::sendStandardRoomMessage(const ChatAvatarId &senderId, const std } if (sender) { - IGNORE_RETURN(instance().chatInterface->RequestSendRoomMessage(sender, (*f).second.getAddress(), ChatUnicodeString(msg.data(), msg.size()), ChatUnicodeString(oob.data(), oob.size()), NULL)); + IGNORE_RETURN(instance().chatInterface->RequestSendRoomMessage(sender, (*f).second.getAddress(), ChatUnicodeString(msg.data(), msg.size()), ChatUnicodeString(oob.data(), oob.size()), nullptr)); } } } @@ -2505,7 +2505,7 @@ std::string ChatServer::getFullChatAvatarName(ChatAvatar const *chatAvatar) { std::string result; - if (chatAvatar != NULL) + if (chatAvatar != nullptr) { result += toNarrowString(chatAvatar->getName()); result += '.'; @@ -2513,7 +2513,7 @@ std::string ChatServer::getFullChatAvatarName(ChatAvatar const *chatAvatar) } else { - result = "NULL"; + result = "nullptr"; } return result; @@ -2539,7 +2539,7 @@ std::string ChatServer::getConnectionAddress(Connection const *connection) { std::string result; - if (connection != NULL) + if (connection != nullptr) { char text[256]; snprintf(text, sizeof(text), "%s:%d", connection->getRemoteAddress().c_str(), connection->getRemotePort()); @@ -2547,7 +2547,7 @@ std::string ChatServer::getConnectionAddress(Connection const *connection) } else { - result = "NULL"; + result = "nullptr"; } return result; @@ -2566,13 +2566,13 @@ Unicode::String ChatServer::getChatRoomName(ChatRoom const *chatRoom) { Unicode::String result; - if (chatRoom != NULL) + if (chatRoom != nullptr) { result = toUnicodeString(chatRoom->getRoomName()); } else { - result = Unicode::narrowToWide("NULL"); + result = Unicode::narrowToWide("nullptr"); } return result; @@ -2582,12 +2582,12 @@ Unicode::String ChatServer::getChatRoomName(ChatRoom const *chatRoom) void ChatServer::clearCustomerServiceServerConnection() { - if (instance().customerServiceServerConnection != NULL) + if (instance().customerServiceServerConnection != nullptr) { instance().customerServiceServerConnection->disconnect(); } - instance().customerServiceServerConnection = NULL; + instance().customerServiceServerConnection = nullptr; } // ---------------------------------------------------------------------- @@ -2596,7 +2596,7 @@ void ChatServer::connectToCustomerServiceServer(const std::string &address, cons { //DEBUG_REPORT_LOG(true, ("***ChatServer::connectToCustomerServiceServer() address(%s) port(%d)\n", address.c_str(), port)); - if (instance().customerServiceServerConnection != NULL) + if (instance().customerServiceServerConnection != nullptr) { instance().customerServiceServerConnection->disconnect(); } @@ -2670,7 +2670,7 @@ bool ChatServer::isValidChatAvatarName(Unicode::String const &chatAvatarName) void ChatServer::logChatMessage(Unicode::String const &logPlayer, Unicode::String const &fromPlayer, Unicode::String const &toPlayer, Unicode::String const &text, Unicode::String const &channel) { - DEBUG_WARNING(toPlayer.empty(), ("toPlayer is NULL")); + DEBUG_WARNING(toPlayer.empty(), ("toPlayer is nullptr")); Unicode::String lowerLogPlayer(Unicode::toLower(logPlayer)); Unicode::String lowerFromPlayer(Unicode::toLower(fromPlayer)); @@ -2760,7 +2760,7 @@ void ChatServer::requestTransferAvatar(const TransferCharacterData & request) ChatAvatarId destinationAvatar("SWG", destination, request.getDestinationCharacterName()); - instance().chatInterface->RequestTransferAvatar(request.getSourceStationId(), makeChatUnicodeString(sourceAvatar.getName()), makeChatUnicodeString(sourceAvatar.getAPIAddress()), request.getDestinationStationId(), makeChatUnicodeString(destinationAvatar.getName()), makeChatUnicodeString(destinationAvatar.getAPIAddress()), true, NULL); + instance().chatInterface->RequestTransferAvatar(request.getSourceStationId(), makeChatUnicodeString(sourceAvatar.getName()), makeChatUnicodeString(sourceAvatar.getAPIAddress()), request.getDestinationStationId(), makeChatUnicodeString(destinationAvatar.getName()), makeChatUnicodeString(destinationAvatar.getAPIAddress()), true, nullptr); } } @@ -2845,7 +2845,7 @@ void ChatServer::handleChatStatisticsFromGameServer(NetworkId const & character, // non-spatial chat to report to the game server else if (aed->nonSpatialCharCount != nonSpatialNumCharacters) { - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); if (timeNow > aed->chatSpamNextTimeToSyncWithGameServer) { GenericValueTypeMessage, std::pair > > chatStatistics("ChatStatisticsCS", std::make_pair(std::make_pair(character, static_cast(aed->chatSpamTimeEndInterval)), std::make_pair(aed->spatialCharCount, aed->nonSpatialCharCount))); @@ -2904,7 +2904,7 @@ void ChatServer::sendToGameServerById(unsigned const connectionId, GameNetworkMe GameServerConnection *ChatServer::getGameServerConnectionFromId(unsigned int sequence) { - GameServerConnection * result = NULL; + GameServerConnection * result = nullptr; std::unordered_map::iterator f = m_gameServerConnectionRegistry.find(sequence); if(f != m_gameServerConnectionRegistry.end()) { diff --git a/engine/server/application/ChatServer/src/shared/ChatServerRoomOwner.cpp b/engine/server/application/ChatServer/src/shared/ChatServerRoomOwner.cpp index 091a78ac..dc8cd1a3 100755 --- a/engine/server/application/ChatServer/src/shared/ChatServerRoomOwner.cpp +++ b/engine/server/application/ChatServer/src/shared/ChatServerRoomOwner.cpp @@ -86,7 +86,7 @@ const ChatRoom * ChatServerRoomOwner::getRoom() const if (chatInterface) return chatInterface->getRoom(roomID); - return NULL; + return nullptr; } //----------------------------------------------------------------------- diff --git a/engine/server/application/ChatServer/src/shared/VChatInterface.cpp b/engine/server/application/ChatServer/src/shared/VChatInterface.cpp index 6e7e257c..b98704bc 100755 --- a/engine/server/application/ChatServer/src/shared/VChatInterface.cpp +++ b/engine/server/application/ChatServer/src/shared/VChatInterface.cpp @@ -435,7 +435,7 @@ void VChatInterface::OnConnectionOpened( const char * address ) ChatServer::fileLog(ms_voiceLoggingEnabled, ms_logLable, "OnConnectionOpened: %s", address); - uint32 track = VChatAPI::GetAccount(ms_systemAvatarName, ConfigChatServer::getGameCode(), ConfigChatServer::getClusterName(), 0, 0, NULL); + uint32 track = VChatAPI::GetAccount(ms_systemAvatarName, ConfigChatServer::getGameCode(), ConfigChatServer::getClusterName(), 0, 0, nullptr); ChatServer::fileLog(ms_voiceLoggingEnabled, ms_logLable, "Creating system avatar: %s track(%u)", getSystemLoginName().c_str(), track); } @@ -477,7 +477,7 @@ void VChatInterface::OnGetAccount(unsigned track, unsigned result, unsigned user { requestConnectPlayer(info->suid,info->avatarName,info->id, info->failedAttempts+1); delete info; - info = NULL; + info = nullptr; return; } } @@ -501,7 +501,7 @@ void VChatInterface::OnGetAccount(unsigned track, unsigned result, unsigned user } delete info; - info = NULL; + info = nullptr; } void VChatInterface::OnGetChannelV2(unsigned track, unsigned result, @@ -639,7 +639,7 @@ void VChatInterface::OnGetAllChannels(unsigned track, unsigned result, const VCh if(shouldRetry) { - GetAllChannels(NULL); + GetAllChannels(nullptr); } } @@ -832,7 +832,7 @@ void VChatInterface::checkForCharacterChannelAdd(std::string const & name, std:: data.m_channelPassword, data.m_channelURI, "en_US", - NULL); + nullptr); (*iter).second.push_back(playerOID); @@ -877,7 +877,7 @@ void VChatInterface::checkForCharacterChannelRemove(std::string const & name, st parseWorldName(std::string(avatar->getServer().c_str())), "SWG", "guild", - NULL); + nullptr); } iter = (*chanIter).second.erase(iter); diff --git a/engine/server/application/CommoditiesServer/src/linux/main.cpp b/engine/server/application/CommoditiesServer/src/linux/main.cpp index b93208f5..ce3735d1 100755 --- a/engine/server/application/CommoditiesServer/src/linux/main.cpp +++ b/engine/server/application/CommoditiesServer/src/linux/main.cpp @@ -61,7 +61,7 @@ int main(int argc, char ** argv) Unicode::UnicodeNarrowStringVector localeVector; localeVector.push_back(defaultLocale); - LocalizationManager::install (new TreeFile::TreeFileFactory, localeVector, debugStringIds, NULL, displayBadStringIds); + LocalizationManager::install (new TreeFile::TreeFileFactory, localeVector, debugStringIds, nullptr, displayBadStringIds); ExitChain::add(LocalizationManager::remove, "LocalizationManager::remove"); DataTableManager::install(); diff --git a/engine/server/application/CommoditiesServer/src/shared/Auction.cpp b/engine/server/application/CommoditiesServer/src/shared/Auction.cpp index 0d1edd7f..63f43523 100755 --- a/engine/server/application/CommoditiesServer/src/shared/Auction.cpp +++ b/engine/server/application/CommoditiesServer/src/shared/Auction.cpp @@ -208,7 +208,7 @@ namespace AuctionNamespace if (iterAttr != searchableAttributeString->end()) { applicableSearchCondition = true; - return (NULL != strstr(iterAttr->second.c_str(), searchCondition.stringValue.c_str())); // lowercase is assumed (and required) + return (nullptr != strstr(iterAttr->second.c_str(), searchCondition.stringValue.c_str())); // lowercase is assumed (and required) } } @@ -242,7 +242,7 @@ namespace AuctionNamespace if (iterAttr != searchableAttributeString->end()) { applicableSearchCondition = true; - return (NULL == strstr(iterAttr->second.c_str(), searchCondition.stringValue.c_str())); // lowercase is assumed (and required) + return (nullptr == strstr(iterAttr->second.c_str(), searchCondition.stringValue.c_str())); // lowercase is assumed (and required) } } @@ -293,10 +293,10 @@ m_userDescription(userDescription), m_oobLength(oobLength), m_oobData(oobData), m_attributes(), -m_searchableAttributeInt(NULL), -m_searchableAttributeFloat(NULL), -m_searchableAttributeString(NULL), -m_highBid(NULL), +m_searchableAttributeInt(nullptr), +m_searchableAttributeFloat(nullptr), +m_searchableAttributeString(nullptr), +m_highBid(nullptr), m_item(new AuctionItem(itemId, itemType, itemTemplateId, itemTimer, itemNameLength, itemName, creatorId, itemSize)), m_sold(false), m_active(true), @@ -395,10 +395,10 @@ m_userDescription(userDescription), m_oobLength(oobLength), m_oobData(oobData), m_attributes(), -m_searchableAttributeInt(NULL), -m_searchableAttributeFloat(NULL), -m_searchableAttributeString(NULL), -m_highBid(NULL), +m_searchableAttributeInt(nullptr), +m_searchableAttributeFloat(nullptr), +m_searchableAttributeString(nullptr), +m_highBid(nullptr), m_item(new AuctionItem(itemId, itemType, itemTemplateId, itemTimer, itemNameLength, itemName, creatorId, itemSize)), m_sold(isSold), m_active(isActive), @@ -488,7 +488,7 @@ void Auction::Initialization() #ifdef _DEBUG for (int i = 0; i < static_cast(AuctionQueryHeadersMessage::SCC_LAST); ++i) { - s_searchConditionComparisonFn[i] = NULL; + s_searchConditionComparisonFn[i] = nullptr; } #endif @@ -502,7 +502,7 @@ void Auction::Initialization() #ifdef _DEBUG for (int j = 0; j < static_cast(AuctionQueryHeadersMessage::SCC_LAST); ++j) { - DEBUG_FATAL((s_searchConditionComparisonFn[j] == NULL), ("s_searchConditionComparisonFn array is NULL at index (%d)", j)); + DEBUG_FATAL((s_searchConditionComparisonFn[j] == nullptr), ("s_searchConditionComparisonFn array is nullptr at index (%d)", j)); } #endif @@ -659,7 +659,7 @@ const AuctionBid *Auction::GetPreviousBid() const { if (m_bids.size() <= 1) { - return NULL; + return nullptr; } else { @@ -677,9 +677,9 @@ const AuctionBid *Auction::GetPreviousBid() const */ int Auction::GetActualBid(AuctionBid *bid) { - assert(bid != NULL); + assert(bid != nullptr); int bidNeeded = std::max(m_minBid, bid->GetBid()); - if (m_highBid != NULL) + if (m_highBid != nullptr) { bidNeeded = m_highBid->GetBid(); if (*bid > *m_highBid) @@ -765,7 +765,7 @@ AuctionResultCode Auction::AddBid( AuctionBid *auctionBid = new AuctionBid(bidderId, bid, maxProxyBid); int newBidForHighBidder = GetActualBid(auctionBid); - if (m_highBid != NULL) + if (m_highBid != nullptr) { if (*auctionBid <= *m_highBid) { @@ -810,7 +810,7 @@ const AuctionBid *Auction::GetPlayerBid(const NetworkId & playerId) const } ++iter; } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -826,7 +826,7 @@ bool Auction::Update(int gameTime) //immediate sale DEBUG_REPORT_LOG(true, ("[Commodities Server Auction::Update] : Expiring immediate sale - Auction is active and sold.\n")); - if ((m_trackId != -1) && (CommodityServer::getInstance().getGameServer(m_trackId) != NULL)) + if ((m_trackId != -1) && (CommodityServer::getInstance().getGameServer(m_trackId) != nullptr)) { Expire(true, false, m_trackId); m_trackId = -1; @@ -840,14 +840,14 @@ bool Auction::Update(int gameTime) { DEBUG_REPORT_LOG(true, ("[Commodities Server Auction::Update] : Auction expiring based on timer.\n")); - if ((m_trackId != -1) && (CommodityServer::getInstance().getGameServer(m_trackId) != NULL)) + if ((m_trackId != -1) && (CommodityServer::getInstance().getGameServer(m_trackId) != nullptr)) { - Expire(m_highBid != NULL, true, m_trackId); + Expire(m_highBid != nullptr, true, m_trackId); m_trackId = -1; } else { - Expire(m_highBid != NULL, true); + Expire(m_highBid != nullptr, true); } } @@ -862,7 +862,7 @@ void Auction::Expire(bool sold, bool expiredBasedOnTimer, int track_id) m_auctionTimer = 0; m_active = false; - if (sold && m_highBid != NULL) + if (sold && m_highBid != nullptr) { m_sold = true; } @@ -934,7 +934,7 @@ void Auction::Expire(bool sold, bool expiredBasedOnTimer, int track_id) m_location.SetVendorFirstTimerExpiredAuctionDate(time(0)); } - DEBUG_REPORT_LOG(true, ("[Commodities Server Auction::Expire] : Sending OnAuctionExpired for non-sold auction and null high bid obj .\n")); + DEBUG_REPORT_LOG(true, ("[Commodities Server Auction::Expire] : Sending OnAuctionExpired for non-sold auction and nullptr high bid obj .\n")); AuctionMarket::getInstance().OnAuctionExpired( GetCreatorId(), m_sold, m_flags, NetworkId::cms_invalid, 0, m_item->GetItemId(), 0, @@ -1107,8 +1107,8 @@ void Auction::BuildSearchableAttributeList() std::map const & saAlias = CommoditiesAdvancedSearchAttribute::getSearchAttributeNameAliasesForGameObjectType(m_item->GetCategory()); // for factory crates, also include the attributes of the item inside the crate - std::map const * saItemInsideFactoryCrate = NULL; - std::map const * saAliasItemInsideFactoryCrate = NULL; + std::map const * saItemInsideFactoryCrate = nullptr; + std::map const * saAliasItemInsideFactoryCrate = nullptr; int gotItemInsideFactoryCrate = 0; if (m_item->GetCategory() == SharedObjectTemplate::GOT_misc_factory_crate) @@ -1134,10 +1134,10 @@ void Auction::BuildSearchableAttributeList() saAliasItemInsideFactoryCrate = &(CommoditiesAdvancedSearchAttribute::getSearchAttributeNameAliasesForGameObjectType(gotItemInsideFactoryCrate)); if (saItemInsideFactoryCrate->empty()) - saItemInsideFactoryCrate = NULL; + saItemInsideFactoryCrate = nullptr; if (saAliasItemInsideFactoryCrate->empty()) - saAliasItemInsideFactoryCrate = NULL; + saAliasItemInsideFactoryCrate = nullptr; } } diff --git a/engine/server/application/CommoditiesServer/src/shared/AuctionLocation.cpp b/engine/server/application/CommoditiesServer/src/shared/AuctionLocation.cpp index df458ef0..d692840d 100755 --- a/engine/server/application/CommoditiesServer/src/shared/AuctionLocation.cpp +++ b/engine/server/application/CommoditiesServer/src/shared/AuctionLocation.cpp @@ -137,7 +137,7 @@ AuctionLocation::~AuctionLocation() bool AuctionLocation::AddAuction(Auction *auction) { - assert(auction != NULL); + assert(auction != nullptr); if (IsVendorMarket() && (!auction->IsActive() || !IsOwner(auction->GetCreatorId()))) { @@ -189,7 +189,7 @@ void AuctionLocation::CancelVendorSale(Auction *auction) bool AuctionLocation::RemoveAuction(Auction *auction) { - assert(auction != NULL); + assert(auction != nullptr); return RemoveAuction(auction->GetItem().GetItemId()); } @@ -265,7 +265,7 @@ Auction *AuctionLocation::GetAuction(const NetworkId & itemId) return((*i).second); } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/application/CommoditiesServer/src/shared/AuctionMarket.cpp b/engine/server/application/CommoditiesServer/src/shared/AuctionMarket.cpp index a07b0864..328f189e 100644 --- a/engine/server/application/CommoditiesServer/src/shared/AuctionMarket.cpp +++ b/engine/server/application/CommoditiesServer/src/shared/AuctionMarket.cpp @@ -121,7 +121,7 @@ namespace AuctionMarketNamespace Auction const * const auction, int const type, int const entranceCharge, - AuctionBid const * const playerBid = NULL + AuctionBid const * const playerBid = nullptr ) { AuctionDataHeader *header = new AuctionDataHeader; @@ -301,7 +301,7 @@ namespace AuctionMarketNamespace std::map attributeValue; }; - GetItemAttributeDataRequest * getItemAttributeDataRequest = NULL; + GetItemAttributeDataRequest * getItemAttributeDataRequest = nullptr; void processItemAttributeData(std::map const & auctions); @@ -394,8 +394,8 @@ void AuctionMarketNamespace::processItemAttributeData(std::map const * skipAttribute = NULL; - std::map const * skipAttributeAlias = NULL; + std::map const * skipAttribute = nullptr; + std::map const * skipAttributeAlias = nullptr; if (getItemAttributeDataRequest->ignoreSearchableAttribute) { std::map const & sa = CommoditiesAdvancedSearchAttribute::getSearchAttributeForGameObjectType(iterAuction->second->GetItem().GetCategory()); @@ -590,7 +590,7 @@ void AuctionMarketNamespace::processItemAttributeData(std::mapGetLocation(); if (!location.IsOwner(auction->GetItem().GetOwnerId())) @@ -1979,7 +1979,7 @@ void AuctionMarket::AcceptHighBid(const AcceptHighBidMessage &message) DEBUG_REPORT_LOG(m_showAllDebugInfo, ("[Commodities Server AcceptHighBidMessage] : ResponseId : %d.\n", message.GetResponseId())); DEBUG_REPORT_LOG(m_showAllDebugInfo, ("[Commodities Server AcceptHighBidMessage] : TrackId : %d.\n", message.GetTrackId())); - Auction *auction = NULL; + Auction *auction = nullptr; AuctionResultCode result = ARC_Success; std::map::iterator iter = m_auctions.find( message.GetAuctionId()); @@ -1994,7 +1994,7 @@ void AuctionMarket::AcceptHighBid(const AcceptHighBidMessage &message) { result = ARC_NotItemOwner; } - else if (auction->GetHighBid() == NULL) + else if (auction->GetHighBid() == nullptr) { result = ARC_NoBids; } @@ -2525,19 +2525,19 @@ void AuctionMarket::QueryAuctionHeaders( int debugNumberLocationsMatched = 0; int debugNumberAuctionsTested = 0; - std::map *auctionsPtr = NULL; + std::map *auctionsPtr = nullptr; int entranceCharge = 0; - AuctionLocation *locationPtr = NULL; - Auction *auctionPtr = NULL; + AuctionLocation *locationPtr = nullptr; + Auction *auctionPtr = nullptr; std::map::const_iterator auctionIterator; - AuctionDataHeader *header = NULL; + AuctionDataHeader *header = nullptr; bool checkItemTemplate; while (locationIter != locationIterEnd) { ++debugNumberLocationsTested; checkItemTemplate = false; - auctionsPtr = NULL; + auctionsPtr = nullptr; entranceCharge = 0; locationPtr = (*locationIter).second; @@ -2606,7 +2606,7 @@ void AuctionMarket::QueryAuctionHeaders( auctionPtr = (*auctionIterator).second; const AuctionItem &item = auctionPtr->GetItem(); - header = NULL; + header = nullptr; // Check to see if the item template matches if (searchForResourceContainer && (itemTemplateId != 0)) @@ -4977,7 +4977,7 @@ void AuctionMarket::getAuctionLocationPriorityQueue(int requestingGameServerId, { std::string output; char buffer[2048]; - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); for (std::set >::const_iterator iterPQ = m_priorityQueueAuctionLocation.begin(); iterPQ != m_priorityQueueAuctionLocation.end(); ++iterPQ) { if (count <= 0) diff --git a/engine/server/application/CommoditiesServer/src/shared/CommodityServer.cpp b/engine/server/application/CommoditiesServer/src/shared/CommodityServer.cpp index 1e2671be..3c2019cd 100755 --- a/engine/server/application/CommoditiesServer/src/shared/CommodityServer.cpp +++ b/engine/server/application/CommoditiesServer/src/shared/CommodityServer.cpp @@ -191,7 +191,7 @@ void CommodityServer::run() s_commodityServerMetricsData = new CommodityServerMetricsData; MetricsManager::install(s_commodityServerMetricsData, false, "CommoditiesServer", "", 0); - time_t timePrevious = ::time(NULL); + time_t timePrevious = ::time(nullptr); time_t timeCurrent = timePrevious; while (true) @@ -202,7 +202,7 @@ void CommodityServer::run() break; NetworkHandler::update(); - timeCurrent = ::time(NULL); + timeCurrent = ::time(nullptr); MetricsManager::update(static_cast((timeCurrent - timePrevious) * 1000)); timePrevious = timeCurrent; @@ -229,18 +229,18 @@ void CommodityServer::run() // this is not a high priority thing, so wait until // the cluster has started and "stabilized" before // doing this; 3 hours should be adequate - time_t timeToRequestExcludedType = ::time(NULL) + 10800; + time_t timeToRequestExcludedType = ::time(nullptr) + 10800; // one time request from the game server (any game server) // to receive the resource tree hierarchy to support // searching for resource container - time_t timeToRequestResourceTree = ::time(NULL); + time_t timeToRequestResourceTree = ::time(nullptr); while(true) { NetworkHandler::update(); - timeCurrent = ::time(NULL); + timeCurrent = ::time(nullptr); MetricsManager::update(static_cast((timeCurrent - timePrevious) * 1000)); timePrevious = timeCurrent; diff --git a/engine/server/application/CommoditiesServer/src/shared/CommodityServerMetricsData.cpp b/engine/server/application/CommoditiesServer/src/shared/CommodityServerMetricsData.cpp index 4b1ff37e..90594e07 100755 --- a/engine/server/application/CommoditiesServer/src/shared/CommodityServerMetricsData.cpp +++ b/engine/server/application/CommoditiesServer/src/shared/CommodityServerMetricsData.cpp @@ -74,7 +74,7 @@ void CommodityServerMetricsData::updateData() buffer[sizeof(buffer)-1] = '\0'; } - m_mapAuctionsCountByGameObjectTypeIndex[iterGameObjectType->first] = addMetric(buffer, 0, NULL, false, false); + m_mapAuctionsCountByGameObjectTypeIndex[iterGameObjectType->first] = addMetric(buffer, 0, nullptr, false, false); } } } diff --git a/engine/server/application/ConnectionServer/src/linux/main.cpp b/engine/server/application/ConnectionServer/src/linux/main.cpp index 24c76421..5984dd4c 100755 --- a/engine/server/application/ConnectionServer/src/linux/main.cpp +++ b/engine/server/application/ConnectionServer/src/linux/main.cpp @@ -37,7 +37,7 @@ int main(int argc, char ** argv) SetupSharedFile::install(false); SetupSharedNetworkMessages::install(); - SetupSharedRandom::install(time(NULL)); + SetupSharedRandom::install(time(nullptr)); //setup the server NetworkHandler::install(); diff --git a/engine/server/application/ConnectionServer/src/shared/ClientConnection.cpp b/engine/server/application/ConnectionServer/src/shared/ClientConnection.cpp index f7b3020b..32b3811c 100755 --- a/engine/server/application/ConnectionServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/ConnectionServer/src/shared/ClientConnection.cpp @@ -82,7 +82,7 @@ m_canCreateRegularCharacter(false), m_canCreateJediCharacter(false), m_hasRequestedCharacterCreate(false), m_hasCreatedCharacter(false), -m_pendingCharacterCreate(NULL), +m_pendingCharacterCreate(nullptr), m_canSkipTutorial(false), m_characterId(NetworkId::cms_invalid), m_characterName(), @@ -144,7 +144,7 @@ ClientConnection::~ClientConnection() { hasBeenKicked = m_client->hasBeenKicked(); delete m_client; - m_client = NULL; + m_client = nullptr; } // tell Session to stop recording play time for the character @@ -177,7 +177,7 @@ ClientConnection::~ClientConnection() m_pendingChatQueryRoomRequests.clear(); delete m_pendingCharacterCreate; - m_pendingCharacterCreate = NULL; + m_pendingCharacterCreate = nullptr; } @@ -202,7 +202,7 @@ std::string ClientConnection::getPlayTimeDuration() const int playTimeDuration = 0; if (m_startPlayTime > 0) - playTimeDuration = static_cast(::time(NULL) - m_startPlayTime); + playTimeDuration = static_cast(::time(nullptr) - m_startPlayTime); return CalendarTime::convertSecondsToHMS(static_cast(playTimeDuration)); } @@ -214,7 +214,7 @@ std::string ClientConnection::getActivePlayTimeDuration() const int activePlayTimeDuration = static_cast(m_activePlayTimeDuration); if (m_lastActiveTime > 0) - activePlayTimeDuration += static_cast(::time(NULL) - m_lastActiveTime); + activePlayTimeDuration += static_cast(::time(nullptr) - m_lastActiveTime); return CalendarTime::convertSecondsToHMS(static_cast(activePlayTimeDuration)); } @@ -226,7 +226,7 @@ std::string ClientConnection::getCurrentActivePlayTimeDuration() const int activePlayTimeDuration = 0; if (m_lastActiveTime > 0) - activePlayTimeDuration = static_cast(::time(NULL) - m_lastActiveTime); + activePlayTimeDuration = static_cast(::time(nullptr) - m_lastActiveTime); return CalendarTime::convertSecondsToHMS(static_cast(activePlayTimeDuration)); } @@ -400,7 +400,7 @@ void ClientConnection::handleClientIdMessage(const ClientIdMsg& msg) std::hash h; m_suid = h(m_accountName.c_str()); } - onValidateClient(m_suid, m_accountName, m_isSecure, NULL, ConfigConnectionServer::getDefaultGameFeatures(), ConfigConnectionServer::getDefaultSubscriptionFeatures(), 0, 0, 0, 0, ConfigConnectionServer::getFakeBuddyPoints()); + onValidateClient(m_suid, m_accountName, m_isSecure, nullptr, ConfigConnectionServer::getDefaultGameFeatures(), ConfigConnectionServer::getDefaultSubscriptionFeatures(), 0, 0, 0, 0, ConfigConnectionServer::getFakeBuddyPoints()); } } else @@ -452,7 +452,7 @@ void ClientConnection::onIdValidated(bool canLogin, bool canCreateRegularCharact } delete m_pendingCharacterCreate; - m_pendingCharacterCreate = NULL; + m_pendingCharacterCreate = nullptr; return; } @@ -683,7 +683,7 @@ void ClientConnection::onReceive(const Archive::ByteStream & message) } else { - ConnectionServer::dropClient(this, "m_client is null while receiving a message!"); + ConnectionServer::dropClient(this, "m_client is nullptr while receiving a message!"); disconnect(); } } @@ -796,7 +796,7 @@ void ClientConnection::onReceive(const Archive::ByteStream & message) } else { - ConnectionServer::dropClient(this, "m_client is null while receiving a message!"); + ConnectionServer::dropClient(this, "m_client is nullptr while receiving a message!"); disconnect(); } } @@ -839,7 +839,7 @@ void ClientConnection::onReceive(const Archive::ByteStream & message) } else { - ConnectionServer::dropClient(this, "m_client is null while receiving a message!"); + ConnectionServer::dropClient(this, "m_client is nullptr while receiving a message!"); disconnect(); } } @@ -865,7 +865,7 @@ void ClientConnection::onReceive(const Archive::ByteStream & message) //DEBUG_REPORT_LOG(true, ("CONSRV::CS - suid: %i\n", getSUID())); - if (customerServiceConnection != NULL) + if (customerServiceConnection != nullptr) { static std::vector v; v.clear(); @@ -935,7 +935,7 @@ void ClientConnection::onReceive(const Archive::ByteStream & message) } else { - ConnectionServer::dropClient(this, "m_client is null while receiving a message!"); + ConnectionServer::dropClient(this, "m_client is nullptr while receiving a message!"); disconnect(); } } @@ -951,7 +951,7 @@ void ClientConnection::onReceive(const Archive::ByteStream & message) if (m_lastActiveTime > 0) { // record the amount of active time - m_activePlayTimeDuration += static_cast(::time(NULL) - m_lastActiveTime); + m_activePlayTimeDuration += static_cast(::time(nullptr) - m_lastActiveTime); // tell Session to stop recording play time for the character if (ConnectionServer::getSessionApiClient() && ConfigConnectionServer::getSessionRecordPlayTime()) @@ -988,7 +988,7 @@ void ClientConnection::onReceive(const Archive::ByteStream & message) if (m_lastActiveTime == 0) { // record the time client went active - m_lastActiveTime = ::time(NULL); + m_lastActiveTime = ::time(nullptr); // tell Session to start recording play time for the character if (ConnectionServer::getSessionApiClient() && ConfigConnectionServer::getSessionRecordPlayTime()) @@ -1616,7 +1616,7 @@ void ClientConnection::onValidateClient (uint32 suid, const std::string & userna } // tell client the server-side game and subscription feature bits and which ConnectionServer we are and the current server Epoch time - GenericValueTypeMessage, std::pair > > const msgFeatureBits("AccountFeatureBits", std::make_pair(std::make_pair(gameFeatures, subscriptionFeatures), std::make_pair(ConfigConnectionServer::getConnectionServerNumber(), static_cast(::time(NULL))))); + GenericValueTypeMessage, std::pair > > const msgFeatureBits("AccountFeatureBits", std::make_pair(std::make_pair(gameFeatures, subscriptionFeatures), std::make_pair(ConfigConnectionServer::getConnectionServerNumber(), static_cast(::time(nullptr))))); send(msgFeatureBits, true); std::string const gameFeaturesDescription = ClientGameFeature::getDescription(gameFeatures); diff --git a/engine/server/application/ConnectionServer/src/shared/ConnectionServer.cpp b/engine/server/application/ConnectionServer/src/shared/ConnectionServer.cpp index b698ecb6..10d0c99f 100755 --- a/engine/server/application/ConnectionServer/src/shared/ConnectionServer.cpp +++ b/engine/server/application/ConnectionServer/src/shared/ConnectionServer.cpp @@ -163,7 +163,7 @@ const CustomerServiceConnection * ConnectionServer::getCustomerServiceConnection { return (*(instance().customerServiceServers.begin())); } - return NULL; + return nullptr; } //----------------------------------------------------------------------- @@ -366,7 +366,7 @@ void ConnectionServer::addNewClient(ClientConnection* cconn, const NetworkId &oi //send the game server a message about this client. static const std::string loginTrace("TRACE_LOGIN"); LOG(loginTrace, ("NewClient(%d, %s, %s)", cconn->getSUID(), oid.getValueString().c_str(), cconn->getAccountName().c_str())); - NewClient m(oid, cconn->getAccountName(), cconn->getRemoteAddress(), cconn->getIsSecure(), false, cconn->getSUID(), NULL, cconn->getGameFeatures(), cconn->getSubscriptionFeatures(), cconn->getEntitlementTotalTime(), cconn->getEntitlementEntitledTime(), cconn->getEntitlementTotalTimeSinceLastLogin(), cconn->getEntitlementEntitledTimeSinceLastLogin(), cconn->getBuddyPoints(), cconn->getConsumedRewardEvents(), cconn->getClaimedRewardItems(), cconn->isUsingAdminLogin(), cconn->getCanSkipTutorial(), sendToStarport ); + NewClient m(oid, cconn->getAccountName(), cconn->getRemoteAddress(), cconn->getIsSecure(), false, cconn->getSUID(), nullptr, cconn->getGameFeatures(), cconn->getSubscriptionFeatures(), cconn->getEntitlementTotalTime(), cconn->getEntitlementEntitledTime(), cconn->getEntitlementTotalTimeSinceLastLogin(), cconn->getEntitlementEntitledTimeSinceLastLogin(), cconn->getBuddyPoints(), cconn->getConsumedRewardEvents(), cconn->getClaimedRewardItems(), cconn->isUsingAdminLogin(), cconn->getCanSkipTutorial(), sendToStarport ); gconn->send(m, true); //@todo move this to ClientConnection.cpp } @@ -375,7 +375,7 @@ void ConnectionServer::addNewClient(ClientConnection* cconn, const NetworkId &oi void ConnectionServer::dropClient(ClientConnection * conn, const std::string& description) { - DEBUG_FATAL(!conn, ("Cannot call dropClient with NULL connection")); + DEBUG_FATAL(!conn, ("Cannot call dropClient with nullptr connection")); if (!conn) //lint !e774 // boolean within 'if' always evaluates to False //suppresed because this is only relevant in DEBUG builds return; @@ -466,7 +466,7 @@ GameConnection* ConnectionServer::getGameConnection(const std::string &sceneName return (*i).second; } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -477,15 +477,15 @@ void ConnectionServer::handleConnectionServerIdMessage(const ConnectionServerId const Service * const servicePrivate = getClientServicePrivate(); const Service * const servicePublic = getClientServicePublic(); - FATAL(servicePrivate == NULL && servicePublic == NULL, ("No client service is active!")); + FATAL(servicePrivate == nullptr && servicePublic == nullptr, ("No client service is active!")); const Service * const g = getGameService(); - FATAL(g == NULL, ("No game service is active!")); + FATAL(g == nullptr, ("No game service is active!")); const Service * const c = getChatService(); const Service * const cs = getCustomerService(); const uint16 pingPort = getPingPort (); - if((servicePrivate != NULL || servicePublic != NULL) && g != NULL) //lint !e774 // always evaluates to false // suppresed because the FATAL macro triggers this lint warning + if((servicePrivate != nullptr || servicePublic != nullptr) && g != nullptr) //lint !e774 // always evaluates to false // suppresed because the FATAL macro triggers this lint warning { uint16 chatPort = 0; uint16 csPort = 0; @@ -739,7 +739,7 @@ void ConnectionServer::receiveMessage(const MessageDispatch::Emitter & source, c std::set::const_iterator i; for(i = clients.begin(); i != clients.end(); ++ i) { - (*i)->setChatConnection(NULL); + (*i)->setChatConnection(nullptr); } } } @@ -782,7 +782,7 @@ void ConnectionServer::receiveMessage(const MessageDispatch::Emitter & source, c std::set::const_iterator i; for(i = clients.begin(); i != clients.end(); ++ i) { - (*i)->setCustomerServiceConnection(NULL); + (*i)->setCustomerServiceConnection(nullptr); } } @@ -960,7 +960,7 @@ void ConnectionServer::remove() // explicitly delete all connections that were setup from setupConnections rather than letting // Connection::remove do it. There are connections that require a valid s_connectionServer which is deleted - // and set to NULL. + // and set to nullptr. s_connectionServer->unsetupConnections(); SetupSharedLog::remove(); @@ -1316,7 +1316,7 @@ GameConnection* ConnectionServer::getGameConnection(uint32 gameServerId) if (i != cs.gameServerMap.end()) return (*i).second; - return NULL; + return nullptr; } //----------------------------------------------------------------------- @@ -1327,7 +1327,7 @@ GameConnection* ConnectionServer::getAnyGameConnection() if (!cs.gameServerMap.empty()) return cs.gameServerMap.begin()->second; - return NULL; + return nullptr; } //----------------------------------------------------------------------- diff --git a/engine/server/application/ConnectionServer/src/shared/GameConnection.cpp b/engine/server/application/ConnectionServer/src/shared/GameConnection.cpp index ddf0fe38..ecfede1e 100755 --- a/engine/server/application/ConnectionServer/src/shared/GameConnection.cpp +++ b/engine/server/application/ConnectionServer/src/shared/GameConnection.cpp @@ -157,7 +157,7 @@ void GameConnection::onReceive(const Archive::ByteStream & message) ca.getStartYaw(), ca.getTemplateName(), ca.getTimeSeconds(), - static_cast(::time(NULL)), + static_cast(::time(nullptr)), ConfigConnectionServer::getDisableWorldSnapshot()); client->getClientConnection()->send(startScene, true); } @@ -166,7 +166,7 @@ void GameConnection::onReceive(const Archive::ByteStream & message) // record the time when play started for the character if (client->getClientConnection()->getStartPlayTime() == 0) { - client->getClientConnection()->setStartPlayTime(::time(NULL)); + client->getClientConnection()->setStartPlayTime(::time(nullptr)); } // update the play time info on the game server diff --git a/engine/server/application/ConnectionServer/src/shared/PseudoClientConnection.cpp b/engine/server/application/ConnectionServer/src/shared/PseudoClientConnection.cpp index 49553a04..9caa85e9 100755 --- a/engine/server/application/ConnectionServer/src/shared/PseudoClientConnection.cpp +++ b/engine/server/application/ConnectionServer/src/shared/PseudoClientConnection.cpp @@ -246,9 +246,9 @@ void PseudoClientConnection::receiveMessage(const Archive::ByteStream & message) characterId = m_transferCharacterData.getDestinationCharacterId(); } std::vector > static const emptyStringVector; - NewClient m(characterId, "TransferServer", NetworkHandler::getHostName(), true, false, stationId, NULL, 0, 0, 0, 0, 0, 0, 0, emptyStringVector, emptyStringVector, m_transferCharacterData.getCSToolId() != 0, true); + NewClient m(characterId, "TransferServer", NetworkHandler::getHostName(), true, false, stationId, nullptr, 0, 0, 0, 0, 0, 0, 0, emptyStringVector, emptyStringVector, m_transferCharacterData.getCSToolId() != 0, true); m_gameConnection->send(m, true); - LOG("CustomerService", ("CharacterTransfer: Sent NewClient(%s, \"TransferServer\", \"%s\", true, false, %d, NULL, 0, 0)\n", characterId.getValueString().c_str(), NetworkHandler::getHostName().c_str(), stationId)); + LOG("CustomerService", ("CharacterTransfer: Sent NewClient(%s, \"TransferServer\", \"%s\", true, false, %d, nullptr, 0, 0)\n", characterId.getValueString().c_str(), NetworkHandler::getHostName().c_str(), stationId)); } } else if(msg.isType("TransferLoginCharacterToSourceServer")) diff --git a/engine/server/application/ConnectionServer/src/shared/SessionApiClient.cpp b/engine/server/application/ConnectionServer/src/shared/SessionApiClient.cpp index dba551e9..67598bb4 100755 --- a/engine/server/application/ConnectionServer/src/shared/SessionApiClient.cpp +++ b/engine/server/application/ConnectionServer/src/shared/SessionApiClient.cpp @@ -303,10 +303,10 @@ void SessionApiClient::OnGetFeatures(const apiTrackingNumber trackingNumber, if (i != ms_getFeaturesTrackingNumberMap.end()) { bool reuseMessage = false; - AccountFeatureIdRequest const * accountFeatureIdRequest = NULL; - AdjustAccountFeatureIdRequest const * adjustAccountFeatureIdRequest = NULL; - AdjustAccountFeatureIdResponse * adjustAccountFeatureIdResponse = NULL; - ClaimRewardsMessage * claimRewardsMessage = NULL; + AccountFeatureIdRequest const * accountFeatureIdRequest = nullptr; + AdjustAccountFeatureIdRequest const * adjustAccountFeatureIdRequest = nullptr; + AdjustAccountFeatureIdResponse * adjustAccountFeatureIdResponse = nullptr; + ClaimRewardsMessage * claimRewardsMessage = nullptr; if (i->second->isType("AccountFeatureIdRequest")) accountFeatureIdRequest = dynamic_cast(i->second); @@ -319,7 +319,7 @@ void SessionApiClient::OnGetFeatures(const apiTrackingNumber trackingNumber, if (result == RESULT_SUCCESS) { - ClientConnection * clientConnection = NULL; + ClientConnection * clientConnection = nullptr; if (accountFeatureIdRequest) clientConnection = ConnectionServer::getClientConnection(accountFeatureIdRequest->getTargetStationId()); else if (adjustAccountFeatureIdRequest) @@ -391,7 +391,7 @@ void SessionApiClient::OnGetFeatures(const apiTrackingNumber trackingNumber, else { // if account already has the feature, adjust it, otherwise add the feature - LoginAPI::Feature const * existingFeature = NULL; + LoginAPI::Feature const * existingFeature = nullptr; for (unsigned k = 0; k < featureCount; ++k) { @@ -444,7 +444,7 @@ void SessionApiClient::OnGetFeatures(const apiTrackingNumber trackingNumber, } else { - LoginAPI::Feature const * newlyAddedFeature = NULL; + LoginAPI::Feature const * newlyAddedFeature = nullptr; for (unsigned k = 0; k < featureCount; ++k) { @@ -506,7 +506,7 @@ void SessionApiClient::OnGetFeatures(const apiTrackingNumber trackingNumber, else { // see if account already has the required feature - LoginAPI::Feature const * existingFeature = NULL; + LoginAPI::Feature const * existingFeature = nullptr; for (unsigned k = 0; k < featureCount; ++k) { @@ -904,7 +904,7 @@ void SessionApiClient::validateClient (ClientConnection* client, const std::stri void SessionApiClient::startPlay(const ClientConnection& client) { - IGNORE_RETURN(SessionStartPlay(client.getSessionId().c_str(), ConfigConnectionServer::getClusterName(), client.getCharacterName().c_str(), NULL)); + IGNORE_RETURN(SessionStartPlay(client.getSessionId().c_str(), ConfigConnectionServer::getClusterName(), client.getCharacterName().c_str(), nullptr)); } //------------------------------------------------------------ diff --git a/engine/server/application/CustomerServiceServer/src/linux/main.cpp b/engine/server/application/CustomerServiceServer/src/linux/main.cpp index 7cdc4016..35924a2c 100755 --- a/engine/server/application/CustomerServiceServer/src/linux/main.cpp +++ b/engine/server/application/CustomerServiceServer/src/linux/main.cpp @@ -30,7 +30,7 @@ int main(int argc, char *argv[]) SetupSharedFile::install(false); SetupSharedNetworkMessages::install(); - SetupSharedRandom::install(static_cast(time(NULL))); + SetupSharedRandom::install(static_cast(time(nullptr))); Os::setProgramName("CustomerServiceServer"); ConfigCustomerServiceServer::install(); NetworkHandler::install(); diff --git a/engine/server/application/CustomerServiceServer/src/shared/CentralServerConnection.cpp b/engine/server/application/CustomerServiceServer/src/shared/CentralServerConnection.cpp index 68a2ded3..8e74a876 100755 --- a/engine/server/application/CustomerServiceServer/src/shared/CentralServerConnection.cpp +++ b/engine/server/application/CustomerServiceServer/src/shared/CentralServerConnection.cpp @@ -49,7 +49,7 @@ void CentralServerConnection::onConnectionOpened() Service *chatServerService = CustomerServiceServer::getInstance().getChatServerService(); - if (chatServerService != NULL) + if (chatServerService != nullptr) { const std::string address(chatServerService->getBindAddress()); const int port = chatServerService->getBindPort(); @@ -62,7 +62,7 @@ void CentralServerConnection::onConnectionOpened() } else { - LOG("CentralServerConnection", ("onConnectionOpened() ERROR: ChatServerService is NULL")); + LOG("CentralServerConnection", ("onConnectionOpened() ERROR: ChatServerService is nullptr")); } } @@ -71,7 +71,7 @@ void CentralServerConnection::onConnectionOpened() Service *gameServerService = CustomerServiceServer::getInstance().getGameServerService(); - if (gameServerService != NULL) + if (gameServerService != nullptr) { const std::string address(gameServerService->getBindAddress()); const int port = gameServerService->getBindPort(); @@ -84,7 +84,7 @@ void CentralServerConnection::onConnectionOpened() } else { - LOG("CentralServerConnection", ("onConnectionOpened() ERROR: GameServerService is NULL")); + LOG("CentralServerConnection", ("onConnectionOpened() ERROR: GameServerService is nullptr")); } } } diff --git a/engine/server/application/CustomerServiceServer/src/shared/ChatServerConnection.cpp b/engine/server/application/CustomerServiceServer/src/shared/ChatServerConnection.cpp index 239a4630..30a167b1 100755 --- a/engine/server/application/CustomerServiceServer/src/shared/ChatServerConnection.cpp +++ b/engine/server/application/CustomerServiceServer/src/shared/ChatServerConnection.cpp @@ -64,13 +64,13 @@ void ChatServerConnection::sendTo(GameNetworkMessage const &message) { LOG("ChatServerConnection", ("sendTo() message(%s)", message.getCmdName().c_str())); - if (s_connection != NULL) + if (s_connection != nullptr) { s_connection->send(message, true); } else { - LOG("ChatServerConnection", ("sendTo() Unable to send, NULL ChatServerConnection")); + LOG("ChatServerConnection", ("sendTo() Unable to send, nullptr ChatServerConnection")); } } diff --git a/engine/server/application/CustomerServiceServer/src/shared/ConfigCustomerServiceServer.cpp b/engine/server/application/CustomerServiceServer/src/shared/ConfigCustomerServiceServer.cpp index eff05cf2..d0e93110 100755 --- a/engine/server/application/CustomerServiceServer/src/shared/ConfigCustomerServiceServer.cpp +++ b/engine/server/application/CustomerServiceServer/src/shared/ConfigCustomerServiceServer.cpp @@ -12,19 +12,19 @@ namespace ConfigCustomerServiceServerNamespace { - const char * s_clusterName = NULL; - const char * s_centralServerAddress = NULL; + const char * s_clusterName = nullptr; + const char * s_centralServerAddress = nullptr; int s_centralServerPort = 0; - const char * s_gameCode = NULL; - const char * s_csServerAddress = NULL; + const char * s_gameCode = nullptr; + const char * s_csServerAddress = nullptr; int s_csServerPort = 0; int s_maxPacketsPerSecond = 50; int s_requestTimeoutSeconds = 300; int s_maxAllowedNumberOfTickets = 1; int s_gameServicePort = 0; int s_chatServicePort = 0; - const char* s_chatServiceBindInterface = NULL; - const char* s_gameServiceBindInterface = NULL; + const char* s_chatServiceBindInterface = nullptr; + const char* s_gameServiceBindInterface = nullptr; bool s_writeTicketToBugLog = false; }; diff --git a/engine/server/application/CustomerServiceServer/src/shared/CustomerServiceInterface.cpp b/engine/server/application/CustomerServiceServer/src/shared/CustomerServiceInterface.cpp index e1e93c31..333117be 100755 --- a/engine/server/application/CustomerServiceServer/src/shared/CustomerServiceInterface.cpp +++ b/engine/server/application/CustomerServiceServer/src/shared/CustomerServiceInterface.cpp @@ -38,7 +38,7 @@ using namespace CSAssist; /////////////////////////////////////////////////////////////////////////////// CustomerServiceInterface::ClientInfo::ClientInfo() - : m_connection(NULL) + : m_connection(nullptr) , m_stationUserId(0) , m_ticketCount(-1) , m_pendingTicketCount(0) @@ -71,10 +71,10 @@ CustomerServiceInterface::~CustomerServiceInterface() delete m_japaneseCategoryList; delete m_clientConnectionMap; - m_clientConnectionMap = NULL; + m_clientConnectionMap = nullptr; delete m_suidToNetworkIdMap; - m_suidToNetworkIdMap = NULL; + m_suidToNetworkIdMap = nullptr; } //----------------------------------------------------------------------- @@ -97,8 +97,8 @@ void CustomerServiceInterface::OnConnectCSAssist( } m_connectionToBackEndEstablised = true; - m_englishCategoryTrack = requestGetIssueHierarchy(NULL, Unicode::narrowToWide("Default").data(), Unicode::narrowToWide("en").data());; - m_japaneseCategoryTrack = requestGetIssueHierarchy(NULL, Unicode::narrowToWide("Default").data(), Unicode::narrowToWide("ja").data());; + m_englishCategoryTrack = requestGetIssueHierarchy(nullptr, Unicode::narrowToWide("Default").data(), Unicode::narrowToWide("en").data());; + m_japaneseCategoryTrack = requestGetIssueHierarchy(nullptr, Unicode::narrowToWide("Default").data(), Unicode::narrowToWide("ja").data());; } } @@ -117,7 +117,7 @@ void CustomerServiceInterface::OnConnectRejectedCSAssist(const CSAssistGameAPITr void CustomerServiceInterface::parseIssueChild(CategoryList & categoryList, xmlNodePtr childPtr) { - static CustomerServiceCategory *currentCategory = NULL; + static CustomerServiceCategory *currentCategory = nullptr; xmlNodePtr child = childPtr->children; //start element @@ -142,19 +142,19 @@ void CustomerServiceInterface::parseIssueChild(CategoryList & categoryList, xmlN val = reinterpret_cast(xmlGetProp(childPtr, (const unsigned char *)"isBugType")); - bool const isBugType = (val != NULL) && (strcmp(val, "true") == 0); + bool const isBugType = (val != nullptr) && (strcmp(val, "true") == 0); // Check for service type val = reinterpret_cast(xmlGetProp(childPtr, (const unsigned char *)"isServiceType")); - bool const isServiceType = (val != NULL) && (strcmp(val, "true") == 0); + bool const isServiceType = (val != nullptr) && (strcmp(val, "true") == 0); // Check if valid val = reinterpret_cast(xmlGetProp(childPtr, (const unsigned char *)"invalid")); - bool const invalid = (val != NULL) && (strcmp(val, "true") == 0); + bool const invalid = (val != nullptr) && (strcmp(val, "true") == 0); if (!invalid) { @@ -187,9 +187,9 @@ void CustomerServiceInterface::parseIssueChild(CategoryList & categoryList, xmlN } } - while (child != NULL) + while (child != nullptr) { - if (child->name != NULL) + if (child->name != nullptr) { parseIssueChild(categoryList, child); } @@ -204,7 +204,7 @@ void CustomerServiceInterface::parseIssueChild(CategoryList & categoryList, xmlN if (currentCategory) { delete currentCategory; - currentCategory = NULL; + currentCategory = nullptr; } } @@ -215,13 +215,13 @@ void CustomerServiceInterface::parseIssueChild(CategoryList & categoryList, xmlN void CustomerServiceInterface::parseIssueHierarchy(CategoryList & categoryList, Unicode::String const & xmlData) { - xmlDocPtr xmlInfo = NULL; + xmlDocPtr xmlInfo = nullptr; Unicode::UTF8String xmlDataUtf8(Unicode::wideToUTF8(xmlData)); - if ((xmlInfo = xmlParseMemory(xmlDataUtf8.c_str(), xmlDataUtf8.length())) != NULL) + if ((xmlInfo = xmlParseMemory(xmlDataUtf8.c_str(), xmlDataUtf8.length())) != nullptr) { xmlNodePtr xmlCurrent = xmlDocGetRootElement(xmlInfo); - if (xmlCurrent != NULL) + if (xmlCurrent != nullptr) { parseIssueChild(categoryList, xmlCurrent); } @@ -247,7 +247,7 @@ void CustomerServiceInterface::OnGetIssueHierarchy( return; } - if (hierarchyBody != NULL) + if (hierarchyBody != nullptr) { if (track == m_englishCategoryTrack) { @@ -266,7 +266,7 @@ void CustomerServiceInterface::OnGetIssueHierarchy( } else { - LOG("CSServer", ("ERROR: NULL hierarchy returned from platform...why did this happen?", track, modifyData, result, getErrorString(result))); + LOG("CSServer", ("ERROR: nullptr hierarchy returned from platform...why did this happen?", track, modifyData, result, getErrorString(result))); } } @@ -282,9 +282,9 @@ void CustomerServiceInterface::OnCreateTicket( CreateTicketResponseMessage message(result, ticket); const NetworkId *tmpNetworkId = reinterpret_cast(userData); - LOG("CSServer", ("OnCreateTicket() track(%i) result(%i) (%s) networkId(%s) ticketId(%i)", track, result, getErrorString(result), (tmpNetworkId != NULL) ? tmpNetworkId->getValueString().c_str() : "NA", ticket)); + LOG("CSServer", ("OnCreateTicket() track(%i) result(%i) (%s) networkId(%s) ticketId(%i)", track, result, getErrorString(result), (tmpNetworkId != nullptr) ? tmpNetworkId->getValueString().c_str() : "NA", ticket)); - if (tmpNetworkId != NULL) + if (tmpNetworkId != nullptr) { if (result == CSASSIST_RESULT_SUCCESS) { @@ -296,7 +296,7 @@ void CustomerServiceInterface::OnCreateTicket( sendToClient(*tmpNetworkId, message); delete tmpNetworkId; - tmpNetworkId = NULL; + tmpNetworkId = nullptr; } } @@ -312,14 +312,14 @@ void CustomerServiceInterface::OnAppendTicketComment( AppendCommentResponseMessage message(result, ticket); const NetworkId *tmpNetworkId = reinterpret_cast(userData); - LOG("CSServer", ("OnAppendTicketComment() track(%i) result(%i) (%s) networkId(%s) ticketId(%i)", track, result, getErrorString(result), (tmpNetworkId != NULL) ? tmpNetworkId->getValueString().c_str() : "NA", ticket)); + LOG("CSServer", ("OnAppendTicketComment() track(%i) result(%i) (%s) networkId(%s) ticketId(%i)", track, result, getErrorString(result), (tmpNetworkId != nullptr) ? tmpNetworkId->getValueString().c_str() : "NA", ticket)); - if (tmpNetworkId != NULL) + if (tmpNetworkId != nullptr) { sendToClient(*tmpNetworkId, message); delete tmpNetworkId; - tmpNetworkId = NULL; + tmpNetworkId = nullptr; } } @@ -335,9 +335,9 @@ void CustomerServiceInterface::OnCancelTicket( CancelTicketResponseMessage message(result, ticket); const NetworkId *tmpNetworkId = reinterpret_cast(userData); - LOG("CSServer", ("OnCancelTicket() track(%i) result(%i) (%s) networkId(%s) ticketId(%i)", track, result, getErrorString(result), (tmpNetworkId != NULL) ? tmpNetworkId->getValueString().c_str() : "NA", ticket)); + LOG("CSServer", ("OnCancelTicket() track(%i) result(%i) (%s) networkId(%s) ticketId(%i)", track, result, getErrorString(result), (tmpNetworkId != nullptr) ? tmpNetworkId->getValueString().c_str() : "NA", ticket)); - if (tmpNetworkId != NULL) + if (tmpNetworkId != nullptr) { if (result == CSASSIST_RESULT_SUCCESS) { @@ -347,7 +347,7 @@ void CustomerServiceInterface::OnCancelTicket( sendToClient(*tmpNetworkId, message); delete tmpNetworkId; - tmpNetworkId = NULL; + tmpNetworkId = nullptr; } } @@ -378,9 +378,9 @@ void CustomerServiceInterface::OnGetTicketByCharacter( GetTicketsResponseMessage message(result, totalNumber, tickets); const NetworkId *tmpNetworkId = reinterpret_cast(userData); - LOG("CSServer", ("OnGetTicketByCharacter() track(%i) result(%i) (%s) networkId(%s) totalNumber(%i) numberReturned(%i)", track, result, getErrorString(result), (tmpNetworkId != NULL) ? tmpNetworkId->getValueString().c_str() : "NA", totalNumber, numberReturned)); + LOG("CSServer", ("OnGetTicketByCharacter() track(%i) result(%i) (%s) networkId(%s) totalNumber(%i) numberReturned(%i)", track, result, getErrorString(result), (tmpNetworkId != nullptr) ? tmpNetworkId->getValueString().c_str() : "NA", totalNumber, numberReturned)); - if (tmpNetworkId != NULL) + if (tmpNetworkId != nullptr) { // Save the number of tickets this player has @@ -396,7 +396,7 @@ void CustomerServiceInterface::OnGetTicketByCharacter( sendToClient(*tmpNetworkId, message); delete tmpNetworkId; - tmpNetworkId = NULL; + tmpNetworkId = nullptr; } } @@ -423,14 +423,14 @@ void CustomerServiceInterface::OnGetTicketComments( const NetworkId *tmpNetworkId = reinterpret_cast(userData); - LOG("CSServer", ("OnGetTicketComments() track(%i) result(%i) (%s) networkId(%s) numberRead(%i)", track, result, getErrorString(result), (tmpNetworkId != NULL) ? tmpNetworkId->getValueString().c_str() : "NA", numberRead)); + LOG("CSServer", ("OnGetTicketComments() track(%i) result(%i) (%s) networkId(%s) numberRead(%i)", track, result, getErrorString(result), (tmpNetworkId != nullptr) ? tmpNetworkId->getValueString().c_str() : "NA", numberRead)); - if (tmpNetworkId != NULL) + if (tmpNetworkId != nullptr) { sendToClient(*tmpNetworkId, message); delete tmpNetworkId; - tmpNetworkId = NULL; + tmpNetworkId = nullptr; } } @@ -455,14 +455,14 @@ void CustomerServiceInterface::OnSearchKB( SearchKnowledgeBaseResponseMessage message(result, searchResultsVector); const NetworkId *tmpNetworkId = reinterpret_cast(userData); - LOG("CSServer", ("OnSearchKB() track(%i) result(%i) (%s) networkId(%s) numberRead(%i)", track, result, getErrorString(result), (tmpNetworkId != NULL) ? tmpNetworkId->getValueString().c_str() : "NA", numberRead)); + LOG("CSServer", ("OnSearchKB() track(%i) result(%i) (%s) networkId(%s) numberRead(%i)", track, result, getErrorString(result), (tmpNetworkId != nullptr) ? tmpNetworkId->getValueString().c_str() : "NA", numberRead)); - if (tmpNetworkId != NULL) + if (tmpNetworkId != nullptr) { sendToClient(*tmpNetworkId, message); delete tmpNetworkId; - tmpNetworkId = NULL; + tmpNetworkId = nullptr; } } @@ -482,12 +482,12 @@ void CustomerServiceInterface::OnGetKBArticle( { GetArticleResponseMessage message(result, Unicode::String(articleBody)); const NetworkId *tmpNetworkId = reinterpret_cast(userData); - if (tmpNetworkId != NULL) + if (tmpNetworkId != nullptr) { sendToClient(*tmpNetworkId, message); delete tmpNetworkId; - tmpNetworkId = NULL; + tmpNetworkId = nullptr; } } } @@ -501,7 +501,7 @@ void CustomerServiceInterface::OnIssueHierarchyChanged( { LOG("CSServer", ("OnIssueHierarchyChanged()")); - requestGetIssueHierarchy(NULL, version, language); + requestGetIssueHierarchy(nullptr, version, language); } //----------------------------------------------------------------------- @@ -512,9 +512,9 @@ void CustomerServiceInterface::OnNewTicketActivity(const CSAssistGameAPITrack tr const NetworkId *tmpNetworkId = reinterpret_cast(userData); - LOG("CSServer", ("OnNewTicketActivity() track(%i) result(%i) (%s) networkId(%s) activity(%s) ticket count(%i)", track, result, getErrorString(result), (tmpNetworkId != NULL) ? tmpNetworkId->getValueString().c_str() : "NA", NewActivityFlag ? "yes" : "no", HasTickets)); + LOG("CSServer", ("OnNewTicketActivity() track(%i) result(%i) (%s) networkId(%s) activity(%s) ticket count(%i)", track, result, getErrorString(result), (tmpNetworkId != nullptr) ? tmpNetworkId->getValueString().c_str() : "NA", NewActivityFlag ? "yes" : "no", HasTickets)); - if (tmpNetworkId != NULL) + if (tmpNetworkId != nullptr) { // Save the number of tickets this player has @@ -530,7 +530,7 @@ void CustomerServiceInterface::OnNewTicketActivity(const CSAssistGameAPITrack tr sendToClient(*tmpNetworkId, message); delete tmpNetworkId; - tmpNetworkId = NULL; + tmpNetworkId = nullptr; } } @@ -540,12 +540,12 @@ void CustomerServiceInterface::OnMarkTicketRead(const CSAssistGameAPITrack track { const NetworkId *tmpNetworkId = reinterpret_cast(userData); - LOG("CSServer", ("OnMarkTicketRead() track(%i) result(%i) (%s) networkId(%s)", track, result, getErrorString(result), (tmpNetworkId != NULL) ? tmpNetworkId->getValueString().c_str() : "NA")); + LOG("CSServer", ("OnMarkTicketRead() track(%i) result(%i) (%s) networkId(%s)", track, result, getErrorString(result), (tmpNetworkId != nullptr) ? tmpNetworkId->getValueString().c_str() : "NA")); - if (tmpNetworkId != NULL) + if (tmpNetworkId != nullptr) { delete tmpNetworkId; - tmpNetworkId = NULL; + tmpNetworkId = nullptr; } } @@ -575,16 +575,16 @@ void CustomerServiceInterface::OnRegisterCharacter(const CSAssistGameAPITrack tr { const NetworkId *tmpNetworkId = reinterpret_cast(userData); - LOG("CSServer", ("OnRegisterCharacter() track(%i) result(%i) (%s) networkId(%s)", track, result, getErrorString(result), (tmpNetworkId != NULL) ? tmpNetworkId->getValueString().c_str() : "NA")); + LOG("CSServer", ("OnRegisterCharacter() track(%i) result(%i) (%s) networkId(%s)", track, result, getErrorString(result), (tmpNetworkId != nullptr) ? tmpNetworkId->getValueString().c_str() : "NA")); - if (tmpNetworkId != NULL) + if (tmpNetworkId != nullptr) { ConnectPlayerResponseMessage message(result); sendToClient(*tmpNetworkId, message); delete tmpNetworkId; - tmpNetworkId = NULL; + tmpNetworkId = nullptr; } } @@ -594,9 +594,9 @@ void CustomerServiceInterface::OnUnRegisterCharacter(const CSAssistGameAPITrack { const NetworkId *tmpNetworkId = reinterpret_cast(userData); - LOG("CSServer", ("OnUnRegisterCharacter() track(%i) result(%i) (%s) networkId(%s)", track, result, getErrorString(result), (tmpNetworkId != NULL) ? tmpNetworkId->getValueString().c_str() : "NA")); + LOG("CSServer", ("OnUnRegisterCharacter() track(%i) result(%i) (%s) networkId(%s)", track, result, getErrorString(result), (tmpNetworkId != nullptr) ? tmpNetworkId->getValueString().c_str() : "NA")); - if (tmpNetworkId != NULL) + if (tmpNetworkId != nullptr) { // If the player was successfully unregistered, remove the local cached reference @@ -606,7 +606,7 @@ void CustomerServiceInterface::OnUnRegisterCharacter(const CSAssistGameAPITrack } delete tmpNetworkId; - tmpNetworkId = NULL; + tmpNetworkId = nullptr; } } @@ -708,7 +708,7 @@ void CustomerServiceInterface::sendToClient(const NetworkId &player, const GameN } else { - LOG("CSServer", ("sendToClient() Connection is NULL: networkId(%s) cmdName(%s)", player.getValueString().c_str(), message.getCmdName().c_str())); + LOG("CSServer", ("sendToClient() Connection is nullptr: networkId(%s) cmdName(%s)", player.getValueString().c_str(), message.getCmdName().c_str())); } } else @@ -779,7 +779,7 @@ void CustomerServiceInterface::requestUnRegisterCharacter(const NetworkId &reque LOG("CSServer", ("requestUnRegisterCharacter() networkId(%s) suid(%i)", requester.getValueString().c_str(), suid)); NetworkId *tmpNetworkId = new NetworkId(requester); - CSAssistGameAPI::requestUnRegisterCharacter(reinterpret_cast(tmpNetworkId), suid, NULL); + CSAssistGameAPI::requestUnRegisterCharacter(reinterpret_cast(tmpNetworkId), suid, nullptr); } else { diff --git a/engine/server/application/CustomerServiceServer/src/shared/CustomerServiceServer.cpp b/engine/server/application/CustomerServiceServer/src/shared/CustomerServiceServer.cpp index 7beaacc5..fb4e7abe 100755 --- a/engine/server/application/CustomerServiceServer/src/shared/CustomerServiceServer.cpp +++ b/engine/server/application/CustomerServiceServer/src/shared/CustomerServiceServer.cpp @@ -49,7 +49,7 @@ namespace CustomerServiceServerNamespace using namespace CustomerServiceServerNamespace; -CustomerServiceServer *CustomerServiceServer::m_instance = NULL; +CustomerServiceServer *CustomerServiceServer::m_instance = nullptr; /////////////////////////////////////////////////////////////////////////////// // @@ -83,12 +83,12 @@ CustomerServiceServer::PendingTicket::PendingTicket() CustomerServiceServer::CustomerServiceServer() : m_callback(new MessageDispatch::Callback), -m_centralServerConnection(NULL), +m_centralServerConnection(nullptr), m_connectionServerSet(new ConnectionServerSet), m_done(false), m_csInterface(ConfigCustomerServiceServer::getCustomerServiceServerAddress(), ConfigCustomerServiceServer::getCustomerServiceServerPort(), ConfigCustomerServiceServer::getRequestTimeoutSeconds()), -m_gameServerService(NULL), -m_chatServerService(NULL), +m_gameServerService(nullptr), +m_chatServerService(nullptr), m_nextSequenceId(0), m_pendingTicketList(new PendingTicketList) { @@ -113,7 +113,7 @@ m_pendingTicketList(new PendingTicketList) m_csInterface.setMaxPacketsPerSecond(ConfigCustomerServiceServer::getMaxPacketsPerSecond()); - m_csInterface.connectCSAssist(NULL, + m_csInterface.connectCSAssist(nullptr, Unicode::narrowToWide(ConfigCustomerServiceServer::getGameCode()).data(), Unicode::narrowToWide(ConfigCustomerServiceServer::getClusterName()).data()); @@ -148,19 +148,19 @@ CustomerServiceServer::~CustomerServiceServer() m_centralServerConnection->disconnect(); delete m_callback; - m_callback = NULL; + m_callback = nullptr; delete m_connectionServerSet; - m_connectionServerSet = NULL; + m_connectionServerSet = nullptr; delete m_gameServerService; - m_gameServerService = NULL; + m_gameServerService = nullptr; delete m_chatServerService; - m_chatServerService = NULL; + m_chatServerService = nullptr; delete m_pendingTicketList; - m_pendingTicketList = NULL; + m_pendingTicketList = nullptr; MetricsManager::remove(); delete s_customerServiceServerMetricsData; @@ -233,7 +233,7 @@ void CustomerServiceServer::update() CustomerServiceServer &CustomerServiceServer::getInstance() { - if (m_instance == NULL) + if (m_instance == nullptr) { m_instance = new CustomerServiceServer; } @@ -405,7 +405,7 @@ void CustomerServiceServer::getTickets( NetworkId *tmpNetworkId = new NetworkId(requester); m_csInterface.requestGetTicketByCharacter( - reinterpret_cast(tmpNetworkId), suid, NULL, + reinterpret_cast(tmpNetworkId), suid, nullptr, start, count, markAsRead); } @@ -475,7 +475,7 @@ void CustomerServiceServer::requestNewTicketActivity(const NetworkId &requester, NetworkId *tmpNetworkId = new NetworkId(requester); - m_csInterface.requestNewTicketActivity(reinterpret_cast(tmpNetworkId), suid, NULL); + m_csInterface.requestNewTicketActivity(reinterpret_cast(tmpNetworkId), suid, nullptr); } //----------------------------------------------------------------------- @@ -497,7 +497,7 @@ void CustomerServiceServer::requestRegisterCharacter(const NetworkId &requester, LOG("CSServer", ("CustomerServiceInterface::requestRegisterCharacter() - networkId(%s) suid(%i)", requester.getValueString().c_str(), suid)); NetworkId *tmpNetworkId = new NetworkId(requester); - m_csInterface.requestRegisterCharacter(reinterpret_cast(tmpNetworkId), suid, NULL, 0); + m_csInterface.requestRegisterCharacter(reinterpret_cast(tmpNetworkId), suid, nullptr, 0); } } diff --git a/engine/server/application/LogServer/src/shared/LoggingServerApi.cpp b/engine/server/application/LogServer/src/shared/LoggingServerApi.cpp index 89591848..a6b9920f 100755 --- a/engine/server/application/LogServer/src/shared/LoggingServerApi.cpp +++ b/engine/server/application/LogServer/src/shared/LoggingServerApi.cpp @@ -23,16 +23,16 @@ LoggingServerApi::LoggingServerApi(LoggingServerHandler *handler, int queueSize) mLoginName[0] = 0; mPassword[0] = 0; mDefaultDirectory[0] = 0; - mConnection = NULL; - mUdpManager = NULL; - mTransaction = NULL; - mSessionId = int(time(NULL)); + mConnection = nullptr; + mUdpManager = nullptr; + mTransaction = nullptr; + mSessionId = int(time(nullptr)); mSessionSequence = 1; } LoggingServerApi::~LoggingServerApi() { - if (mTransaction != NULL) + if (mTransaction != nullptr) StopTransaction(); for (int i = 0; i < mQueueCount; i++) @@ -77,7 +77,7 @@ void LoggingServerApi::Connect(const char *address, int port, const char *loginN mUdpManager = new UdpManager(¶ms); mConnection = mUdpManager->EstablishConnection(address, port, 30000); - if (mConnection != NULL) + if (mConnection != nullptr) mConnection->SetHandler(this); mLoginSent = false; } @@ -89,17 +89,17 @@ void LoggingServerApi::Disconnect() mPassword[0] = 0; mDefaultDirectory[0] = 0; - if (mConnection != NULL) + if (mConnection != nullptr) { mConnection->Disconnect(); mConnection->Release(); - mConnection = NULL; + mConnection = nullptr; } - if (mUdpManager != NULL) + if (mUdpManager != nullptr) { mUdpManager->Release(); - mUdpManager = NULL; + mUdpManager = nullptr; } } @@ -119,7 +119,7 @@ void LoggingServerApi::Flush(int timeout) LoggingServerApi::Status LoggingServerApi::GetStatus() const { - if (mConnection != NULL) + if (mConnection != nullptr) { switch (mConnection->GetStatus()) { @@ -153,7 +153,7 @@ void LoggingServerApi::OnRoutePacket(UdpConnection *, const uchar *data, int) FlushQueue(); } - if (mHandler != NULL) + if (mHandler != nullptr) mHandler->LshOnLoginConfirm(mAuthenticated); break; } @@ -171,13 +171,13 @@ void LoggingServerApi::OnRoutePacket(UdpConnection *, const uchar *data, int) char *filename = ptr; ptr += strlen(ptr) + 1; char *message = ptr; - if (mHandler != NULL) + if (mHandler != nullptr) mHandler->LshOnMonitor(sessionId, sequenceNumber, name, filename, typeCode, message); break; } case cS2CPacketFileList: { - if (mHandler != NULL) + if (mHandler != nullptr) mHandler->LshOnFileList((char *)(data + 1)); break; } @@ -188,7 +188,7 @@ void LoggingServerApi::OnRoutePacket(UdpConnection *, const uchar *data, int) void LoggingServerApi::OnTerminated(UdpConnection *con) { - if(mHandler != NULL) + if(mHandler != nullptr) { mHandler->LshOnTerminated( con->GetDisconnectReason() ); } @@ -196,7 +196,7 @@ void LoggingServerApi::OnTerminated(UdpConnection *con) void LoggingServerApi::GiveTime() { - if (mConnection != NULL && mConnection->GetStatus() == UdpConnection::cStatusConnected) + if (mConnection != nullptr && mConnection->GetStatus() == UdpConnection::cStatusConnected) { if (!mLoginSent) { @@ -225,7 +225,7 @@ void LoggingServerApi::GiveTime() if (mQueue[spot].sentTime != 0 && UdpMisc::ClockElapsed(mQueue[spot].sentTime) > cSafetyQueueTime) { mQueue[spot].packet->Release(); - mQueue[spot].packet = NULL; + mQueue[spot].packet = nullptr; mQueuePosition++; mQueueCount--; } @@ -235,7 +235,7 @@ void LoggingServerApi::GiveTime() } } - if (mUdpManager != NULL) + if (mUdpManager != nullptr) { mUdpManager->GiveTime(); } @@ -243,17 +243,17 @@ void LoggingServerApi::GiveTime() void LoggingServerApi::StartTransaction() { - if (mTransaction == NULL) + if (mTransaction == nullptr) mTransaction = new GroupLogicalPacket(); } void LoggingServerApi::StopTransaction() { - if (mTransaction != NULL) + if (mTransaction != nullptr) { PacketSend(mTransaction); mTransaction->Release(); - mTransaction = NULL; + mTransaction = nullptr; } } @@ -264,7 +264,7 @@ void LoggingServerApi::PacketSend(LogicalPacket *lp) { int spot = mQueuePosition % mQueueSize; mQueue[spot].packet->Release(); - mQueue[spot].packet = NULL; + mQueue[spot].packet = nullptr; mQueuePosition++; mQueueCount--; } @@ -374,7 +374,7 @@ void LoggingServerApi::Log(const char *filename, int typeCode, const char *messa void LoggingServerApi::LogPacket(char *data, int len) { - if (mTransaction != NULL) + if (mTransaction != nullptr) { // add it to the transaction mTransaction->AddPacket(data, len); @@ -389,7 +389,7 @@ void LoggingServerApi::LogPacket(char *data, int len) LogicalPacket *LoggingServerApi::CreatePacket(char *data, int dataLen) { - if (mUdpManager != NULL) + if (mUdpManager != nullptr) { return(mUdpManager->CreatePacket(data, dataLen)); } @@ -440,7 +440,7 @@ void LoggingServerApi::GetStatistics(LoggingServerApiStatistics *stats) memset( stats, 0, sizeof( *stats) ); UdpConnectionStatistics udpConnectionStats; memset( &udpConnectionStats, 0, sizeof( udpConnectionStats ) ); - if( mConnection != NULL ) + if( mConnection != nullptr ) { mConnection->GetStats( &udpConnectionStats ); stats->applicationPacketsReceived = udpConnectionStats.applicationPacketsReceived; @@ -454,7 +454,7 @@ void LoggingServerApi::GetStatistics(LoggingServerApiStatistics *stats) } UdpManagerStatistics managerStats; - if( mUdpManager != NULL ) + if( mUdpManager != nullptr ) { mUdpManager->GetStats( &managerStats ); udp_int64 iterations = managerStats.iterations; diff --git a/engine/server/application/LoginServer/src/linux/main.cpp b/engine/server/application/LoginServer/src/linux/main.cpp index 7b4d7c1b..e08cb606 100755 --- a/engine/server/application/LoginServer/src/linux/main.cpp +++ b/engine/server/application/LoginServer/src/linux/main.cpp @@ -35,7 +35,7 @@ int main(int argc, char ** argv) SetupSharedFile::install(false); SetupSharedNetworkMessages::install(); - SetupSharedRandom::install(static_cast(time(NULL))); //lint !e1924 !e64 // NULL is a C-Style cast? + SetupSharedRandom::install(static_cast(time(nullptr))); //lint !e1924 !e64 // nullptr is a C-Style cast? Os::setProgramName("LoginServer"); //setup the server diff --git a/engine/server/application/LoginServer/src/shared/CSToolConnection.cpp b/engine/server/application/LoginServer/src/shared/CSToolConnection.cpp index 3da0b98b..7e10c623 100755 --- a/engine/server/application/LoginServer/src/shared/CSToolConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/CSToolConnection.cpp @@ -51,7 +51,7 @@ void CSToolConnection::validateCSTool(uint32 toolId, apiResult result, const api p_connection->m_bSecure = true; } - // if we have a null session type, then we aren't connected to the + // if we have a nullptr session type, then we aren't connected to the // Session Server and are in debug mode. // // if we *do* have a good session, then check the admin table for access level. @@ -71,7 +71,7 @@ void CSToolConnection::validateCSTool(uint32 toolId, apiResult result, const api bool canLogin = isInternal; // we always have to be internal. if (sessionNull) { - // null session means we can skip everything else. + // nullptr session means we can skip everything else. canLogin = canLogin && true; accessLevel = 100; } diff --git a/engine/server/application/LoginServer/src/shared/CentralServerConnection.cpp b/engine/server/application/LoginServer/src/shared/CentralServerConnection.cpp index 6b803038..2f096fce 100755 --- a/engine/server/application/LoginServer/src/shared/CentralServerConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/CentralServerConnection.cpp @@ -282,13 +282,13 @@ void CentralServerConnection::onReceive(const Archive::ByteStream & message) else if(m.isType("GcwScoreStatRaw")) { GenericValueTypeMessage >, std::map > > > > const msg(ri); - LoginServer::getInstance().sendToAllClusters(msg, NULL, 0, msg.getValue().first.c_str()); + LoginServer::getInstance().sendToAllClusters(msg, nullptr, 0, msg.getValue().first.c_str()); } else if(m.isType("GcwScoreStatPct")) { GenericValueTypeMessage, std::map > > > const msg(ri); - LoginServer::getInstance().sendToAllClusters(msg, NULL, 0, msg.getValue().first.c_str()); + LoginServer::getInstance().sendToAllClusters(msg, nullptr, 0, msg.getValue().first.c_str()); } } diff --git a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp index 087796db..6fe81a51 100755 --- a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp @@ -100,7 +100,7 @@ void ClientConnection::onReceive(const Archive::ByteStream & message) // client has an idea of how much difference there is between // the client's Epoch time and the server Epoch time GenericValueTypeMessage const serverNowEpochTime( - "ServerNowEpochTime", static_cast(::time(NULL))); + "ServerNowEpochTime", static_cast(::time(nullptr))); send(serverNowEpochTime, true); LoginClientId id(ri); @@ -202,7 +202,7 @@ void ClientConnection::validateClient(const std::string & id, const std::string LOG("LoginClientConnection", ("validateClient() for stationId (%lu) at IP (%s), id (%s) key (%s), skipping validating session", m_stationId, getRemoteAddress().c_str(), id.c_str(), key.c_str())); - LoginServer::getInstance().onValidateClient(suid, id, this, true, NULL, 0xFFFFFFFF, 0xFFFFFFFF); + LoginServer::getInstance().onValidateClient(suid, id, this, true, nullptr, 0xFFFFFFFF, 0xFFFFFFFF); } } diff --git a/engine/server/application/LoginServer/src/shared/ConsoleManager.cpp b/engine/server/application/LoginServer/src/shared/ConsoleManager.cpp index ecaaa8fa..8721d5c6 100755 --- a/engine/server/application/LoginServer/src/shared/ConsoleManager.cpp +++ b/engine/server/application/LoginServer/src/shared/ConsoleManager.cpp @@ -14,7 +14,7 @@ namespace ConsoleManagerNamespace { - ConsoleCommandParser * s_consoleCommandParserRoot = NULL; + ConsoleCommandParser * s_consoleCommandParserRoot = nullptr; } using namespace ConsoleManagerNamespace; diff --git a/engine/server/application/LoginServer/src/shared/LoginServer.cpp b/engine/server/application/LoginServer/src/shared/LoginServer.cpp index a38d3725..759331b4 100755 --- a/engine/server/application/LoginServer/src/shared/LoginServer.cpp +++ b/engine/server/application/LoginServer/src/shared/LoginServer.cpp @@ -130,7 +130,7 @@ LoginServer::LoginServer() : Singleton(), MessageDispatch::Receiver(), done(false), -m_centralService(NULL), +m_centralService(nullptr), clientService(0), pingService(0), keyServer(0), @@ -391,7 +391,7 @@ void LoginServer::receiveMessage(const MessageDispatch::Emitter & source, const { CentralServerConnection * connection = const_cast(safe_cast(&source)); DEBUG_REPORT_LOG(true, ("Cluster connection %s opened\n", msg.getClusterName().c_str())); - ClusterListEntry *cle=NULL; + ClusterListEntry *cle=nullptr; if (ConfigLoginServer::getDevelopmentMode()) { // in this mode, we trust the name sent by the cluster and we dynamically add clusters we don't know about @@ -410,7 +410,7 @@ void LoginServer::receiveMessage(const MessageDispatch::Emitter & source, const { WARNING(true,("Server %i is named \"%s\" in the database. The server at the specified address (%s:%hu) reports its name as \"%s\". It will not be allowed in the service. Either the name in the database or the name in Central's config file should be corrected.\n",cle->m_clusterId, cle->m_clusterName.c_str(), connection->getRemoteAddress().c_str(), connection->getRemotePort(), msg.getClusterName().c_str())); disconnectCluster(*cle,true,false); - cle=NULL; + cle=nullptr; } } @@ -589,7 +589,7 @@ void LoginServer::receiveMessage(const MessageDispatch::Emitter & source, const // for testing purpose when not using session authentication, store // the account feature Ids locally in memory, which will get cleared // (obviously) when the LoginServer is restarted - std::map > * nonSessionTestingAccountFeatureIds = NULL; + std::map > * nonSessionTestingAccountFeatureIds = nullptr; if (msg.getGameCode() == PlatformGameCode::SWG) nonSessionTestingAccountFeatureIds = &s_nonSessionTestingAccountSwgFeatureIds; else if (msg.getGameCode() == PlatformGameCode::SWGTCG) @@ -648,7 +648,7 @@ void LoginServer::receiveMessage(const MessageDispatch::Emitter & source, const // for testing purpose when not using session authentication, store // the account feature Ids locally in memory, which will get cleared // (obviously) when the LoginServer is restarted - std::map > * nonSessionTestingAccountFeatureIds = NULL; + std::map > * nonSessionTestingAccountFeatureIds = nullptr; if (msg.getGameCode() == PlatformGameCode::SWG) nonSessionTestingAccountFeatureIds = &s_nonSessionTestingAccountSwgFeatureIds; else if (msg.getGameCode() == PlatformGameCode::SWGTCG) @@ -826,7 +826,7 @@ void LoginServer::receiveMessage(const MessageDispatch::Emitter & source, const const CentralServerConnection *conn = dynamic_cast(&source); if (conn) - DatabaseConnection::getInstance().renameCharacter(conn->getClusterId(), msg.getCharacterId(), msg.getNewName(), NULL); + DatabaseConnection::getInstance().renameCharacter(conn->getClusterId(), msg.getCharacterId(), msg.getNewName(), nullptr); else WARNING_STRICT_FATAL(true,("Got RenameCharacterMessage from something other than CentralServerConnection.\n")); } @@ -1461,11 +1461,11 @@ LoginServer::ClusterListEntry *LoginServer::findClusterByName(const std::string ClusterListType::iterator i; for (i=m_clusterList.begin(); i!=m_clusterList.end(); ++i) { - NOT_NULL(*i); // not legal to push null pointers on the vector + NOT_NULL(*i); // not legal to push nullptr pointers on the vector if ((*i)->m_clusterName == clusterName) return *i; } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -1555,7 +1555,7 @@ void LoginServer::sendClusterStatus(ClientConnection &conn) const // 5) Cluster has told us its ready for players if (cle && cle->m_clusterId!=0 && cle->m_connected && !cle->m_connectionServers.empty() && (clientIsPrivate || !cle->m_secret)) { - DEBUG_FATAL(!cle->m_centralServerConnection,("Programmer bug: m_connected was true but m_centralServerConnection was NULL\n")); + DEBUG_FATAL(!cle->m_centralServerConnection,("Programmer bug: m_connected was true but m_centralServerConnection was nullptr\n")); LoginClusterStatus::ClusterData item; item.m_clusterId = cle->m_clusterId; item.m_timeZone = cle->m_timeZone; @@ -1840,12 +1840,12 @@ LoginServer::ClusterListEntry * LoginServer::findClusterById(uint32 clusterId) ClusterListType::const_iterator i; for (i=m_clusterList.begin(); i!=m_clusterList.end(); ++i) { - NOT_NULL(*i); // not legal to push null pointers on the vector + NOT_NULL(*i); // not legal to push nullptr pointers on the vector if ((*i)->m_clusterId == clusterId) return *i; } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -1859,12 +1859,12 @@ LoginServer::ClusterListEntry * LoginServer::findClusterByConnection(const Centr ClusterListType::const_iterator i; for (i=m_clusterList.begin(); i!=m_clusterList.end(); ++i) { - NOT_NULL(*i); // not legal to push null pointers on the vector + NOT_NULL(*i); // not legal to push nullptr pointers on the vector if ((*i)->m_centralServerConnection == connection) return *i; } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -1908,12 +1908,12 @@ void LoginServer::setDone(const bool isDone) // ---------------------------------------------------------------------- -void LoginServer::sendToAllClusters(GameNetworkMessage const & message, Connection const * excludeCentralConnection /*= NULL*/, uint32 excludeClusterId /*= 0*/, char const * excludeClusterName /*= NULL*/) +void LoginServer::sendToAllClusters(GameNetworkMessage const & message, Connection const * excludeCentralConnection /*= nullptr*/, uint32 excludeClusterId /*= 0*/, char const * excludeClusterName /*= nullptr*/) { ClusterListType::const_iterator i; for (i=m_clusterList.begin(); i!=m_clusterList.end(); ++i) { - if (NON_NULL(*i)->m_connected && (*i)->m_centralServerConnection && ((*i)->m_centralServerConnection != excludeCentralConnection) && ((*i)->m_clusterId != excludeClusterId) && ((excludeClusterName == NULL) || _stricmp(excludeClusterName, (*i)->m_centralServerConnection->getClusterName().c_str()))) + if (NON_NULL(*i)->m_connected && (*i)->m_centralServerConnection && ((*i)->m_centralServerConnection != excludeCentralConnection) && ((*i)->m_clusterId != excludeClusterId) && ((excludeClusterName == nullptr) || _stricmp(excludeClusterName, (*i)->m_centralServerConnection->getClusterName().c_str()))) (*i)->m_centralServerConnection->send(message,true); } } diff --git a/engine/server/application/LoginServer/src/shared/LoginServer.h b/engine/server/application/LoginServer/src/shared/LoginServer.h index a284068e..f1d4de5b 100755 --- a/engine/server/application/LoginServer/src/shared/LoginServer.h +++ b/engine/server/application/LoginServer/src/shared/LoginServer.h @@ -64,7 +64,7 @@ public: void validateAccount (const StationId& stationId, uint32 clusterId, uint32 subscriptionBits, bool canCreateRegular, bool canCreateJedi, bool canSkipTutorial, unsigned int track, std::vector > const & consumedRewardEvents, std::vector > const & claimedRewardItems); void validateAccountForTransfer(const TransferRequestMoveValidation & request, uint32 clusterId, uint32 sourceCharacterTemplateId, bool canCreateRegular, bool canCreateJedi); void sendToCluster (uint32 clusterId, const GameNetworkMessage &message); - void sendToAllClusters (GameNetworkMessage const & message, Connection const * excludeCentralConnection = NULL, uint32 excludeClusterId = 0, char const * excludeClusterName = NULL); + void sendToAllClusters (GameNetworkMessage const & message, Connection const * excludeCentralConnection = nullptr, uint32 excludeClusterId = 0, char const * excludeClusterName = nullptr); bool areAllClustersUp () const; void getClusterIds (stdvector::fwd result); void performAccountTransfer (const AvatarList &avatars, TransferAccountData * transferAccountData); diff --git a/engine/server/application/LoginServer/src/shared/SessionApiClient.cpp b/engine/server/application/LoginServer/src/shared/SessionApiClient.cpp index f130d691..73ff91ae 100755 --- a/engine/server/application/LoginServer/src/shared/SessionApiClient.cpp +++ b/engine/server/application/LoginServer/src/shared/SessionApiClient.cpp @@ -435,7 +435,7 @@ void SessionApiClient::NotifySessionKick(const char ** sessionList, void SessionApiClient::checkStatusForPurge(StationId account) { - GetAccountSubscription(account, PlatformGameCode::SWG, NULL); + GetAccountSubscription(account, PlatformGameCode::SWG, nullptr); } //------------------------------------------------------------------------------------------ diff --git a/engine/server/application/LoginServer/src/shared/TaskCreateCharacter.cpp b/engine/server/application/LoginServer/src/shared/TaskCreateCharacter.cpp index 6e8ed6d4..243f3c71 100755 --- a/engine/server/application/LoginServer/src/shared/TaskCreateCharacter.cpp +++ b/engine/server/application/LoginServer/src/shared/TaskCreateCharacter.cpp @@ -58,7 +58,7 @@ void TaskCreateCharacter::onComplete() // let all other galaxies know that a new character has been created for the station account GenericValueTypeMessage const ncc("NewCharacterCreated", m_stationId); - LoginServer::getInstance().sendToAllClusters(ncc, NULL, m_clusterId); + LoginServer::getInstance().sendToAllClusters(ncc, nullptr, m_clusterId); } // ====================================================================== diff --git a/engine/server/application/LoginServer/src/shared/TaskGetCharactersForDelete.cpp b/engine/server/application/LoginServer/src/shared/TaskGetCharactersForDelete.cpp index 5259daf4..3cc49cef 100755 --- a/engine/server/application/LoginServer/src/shared/TaskGetCharactersForDelete.cpp +++ b/engine/server/application/LoginServer/src/shared/TaskGetCharactersForDelete.cpp @@ -14,7 +14,7 @@ // ====================================================================== TaskGetCharactersForDelete::TaskGetCharactersForDelete (StationId stationId, int clusterGroupId) : - TaskGetAvatarList(stationId, clusterGroupId, NULL) + TaskGetAvatarList(stationId, clusterGroupId, nullptr) { } diff --git a/engine/server/application/MetricsServer/src/linux/main.cpp b/engine/server/application/MetricsServer/src/linux/main.cpp index 2287e9de..d4a429d8 100755 --- a/engine/server/application/MetricsServer/src/linux/main.cpp +++ b/engine/server/application/MetricsServer/src/linux/main.cpp @@ -40,7 +40,7 @@ int main(int argc, char ** argv) SetupSharedNetwork::getDefaultServerSetupData(networkSetupData); SetupSharedNetwork::install(networkSetupData); - SetupSharedRandom::install(static_cast(time(NULL))); //lint !e1924 !e64 // NULL is a C-Style cast? + SetupSharedRandom::install(static_cast(time(nullptr))); //lint !e1924 !e64 // nullptr is a C-Style cast? Os::setProgramName("MetricsServer"); //setup the server diff --git a/engine/server/application/MetricsServer/src/shared/MetricsGatheringConnection.cpp b/engine/server/application/MetricsServer/src/shared/MetricsGatheringConnection.cpp index 4cab5ae6..dd398ff2 100755 --- a/engine/server/application/MetricsServer/src/shared/MetricsGatheringConnection.cpp +++ b/engine/server/application/MetricsServer/src/shared/MetricsGatheringConnection.cpp @@ -169,19 +169,19 @@ void MetricsGatheringConnection::update(const std::vector & data) //note: we know that the "isSecret", and "isLocked" nodes will come after the "population" node in the list // we are iterating over, so they will override the population setting - if (strstr((*dataIter).m_label.c_str(), "population") != NULL) + if (strstr((*dataIter).m_label.c_str(), "population") != nullptr) { // there are nodes under the population node, so don't interpret them as the population - if (strstr((*dataIter).m_label.c_str(), "population.") == NULL) + if (strstr((*dataIter).m_label.c_str(), "population.") == nullptr) mon->set(MetricsServer::getWorldCountChannel(), std::max((*dataIter).m_value, 0)); } - else if (strstr((*dataIter).m_label.c_str(), "isSecret") != NULL - || strstr((*dataIter).m_label.c_str(), "isLocked") != NULL) + else if (strstr((*dataIter).m_label.c_str(), "isSecret") != nullptr + || strstr((*dataIter).m_label.c_str(), "isLocked") != nullptr) { if ((*dataIter).m_value == 1) mon->set(MetricsServer::getWorldCountChannel(), STATUS_LOCKED); } - else if (strstr((*dataIter).m_label.c_str(), "isLoading") != NULL) + else if (strstr((*dataIter).m_label.c_str(), "isLoading") != nullptr) { // include in the root node description how // long the cluster has been loading @@ -226,19 +226,19 @@ void MetricsGatheringConnection::update(const std::vector & data) //note: we know that the "isSecret", and "isLocked" nodes will come after the "population" node in the list // we are iterating over, so they will override the population setting - if (strstr((*dataIter).m_label.c_str(), "population") != NULL) + if (strstr((*dataIter).m_label.c_str(), "population") != nullptr) { // there are nodes under the population node, so don't interpret them as the population - if (strstr((*dataIter).m_label.c_str(), "population.") == NULL) + if (strstr((*dataIter).m_label.c_str(), "population.") == nullptr) mon->set(MetricsServer::getWorldCountChannel(), std::max((*dataIter).m_value, 0)); } - else if (strstr((*dataIter).m_label.c_str(), "isSecret") != NULL - || strstr((*dataIter).m_label.c_str(), "isLocked") != NULL) + else if (strstr((*dataIter).m_label.c_str(), "isSecret") != nullptr + || strstr((*dataIter).m_label.c_str(), "isLocked") != nullptr) { if ((*dataIter).m_value == 1) mon->set(MetricsServer::getWorldCountChannel(), STATUS_LOCKED); } - else if (strstr((*dataIter).m_label.c_str(), "isLoading") != NULL) + else if (strstr((*dataIter).m_label.c_str(), "isLoading") != nullptr) { // include in the root node description how // long the cluster has been loading diff --git a/engine/server/application/MetricsServer/src/shared/MetricsServer.cpp b/engine/server/application/MetricsServer/src/shared/MetricsServer.cpp index 9754caca..aab52220 100755 --- a/engine/server/application/MetricsServer/src/shared/MetricsServer.cpp +++ b/engine/server/application/MetricsServer/src/shared/MetricsServer.cpp @@ -29,8 +29,8 @@ std::string MetricsServer::m_worldCountChannelDescription; bool MetricsServer::m_done = false; Service* MetricsServer::m_metricsService; CMonitorAPI * MetricsServer::m_soeMonitor; -Service * MetricsServer::ms_service = NULL; -TaskConnection * MetricsServer::ms_taskConnection = NULL; +Service * MetricsServer::ms_service = nullptr; +TaskConnection * MetricsServer::ms_taskConnection = nullptr; //---------------------------------------------------------------- diff --git a/engine/server/application/PlanetServer/src/linux/main.cpp b/engine/server/application/PlanetServer/src/linux/main.cpp index d77747cf..7d8b5908 100755 --- a/engine/server/application/PlanetServer/src/linux/main.cpp +++ b/engine/server/application/PlanetServer/src/linux/main.cpp @@ -46,7 +46,7 @@ int main(int argc, char ** argv) SetupSharedNetworkMessages::install(); - SetupSharedRandom::install(time(NULL)); //lint !e732 loss of sign (of 0!) + SetupSharedRandom::install(time(nullptr)); //lint !e732 loss of sign (of 0!) SetupSharedUtility::Data sharedUtilityData; SetupSharedUtility::setupGameData (sharedUtilityData); diff --git a/engine/server/application/PlanetServer/src/shared/ConsoleCommandParser.cpp b/engine/server/application/PlanetServer/src/shared/ConsoleCommandParser.cpp index b5839b87..4a3fec7d 100755 --- a/engine/server/application/PlanetServer/src/shared/ConsoleCommandParser.cpp +++ b/engine/server/application/PlanetServer/src/shared/ConsoleCommandParser.cpp @@ -31,7 +31,7 @@ const CommandParser::CmdInfo cmds[] = //----------------------------------------------------------------------- ConsoleCommandParser::ConsoleCommandParser() : -CommandParser ("", 0, "...", "console commands", NULL) +CommandParser ("", 0, "...", "console commands", nullptr) { createDelegateCommands(cmds); } diff --git a/engine/server/application/PlanetServer/src/shared/ConsoleManager.cpp b/engine/server/application/PlanetServer/src/shared/ConsoleManager.cpp index 2326cbf2..4a94be0c 100755 --- a/engine/server/application/PlanetServer/src/shared/ConsoleManager.cpp +++ b/engine/server/application/PlanetServer/src/shared/ConsoleManager.cpp @@ -14,7 +14,7 @@ namespace ConsoleManagerNamespace { - ConsoleCommandParser * s_consoleCommandParserRoot = NULL; + ConsoleCommandParser * s_consoleCommandParserRoot = nullptr; } using namespace ConsoleManagerNamespace; diff --git a/engine/server/application/PlanetServer/src/shared/GameServerData.cpp b/engine/server/application/PlanetServer/src/shared/GameServerData.cpp index 58a57f31..e7e91d59 100755 --- a/engine/server/application/PlanetServer/src/shared/GameServerData.cpp +++ b/engine/server/application/PlanetServer/src/shared/GameServerData.cpp @@ -27,7 +27,7 @@ GameServerData::GameServerData(GameServerConnection *connection) : // ---------------------------------------------------------------------- GameServerData::GameServerData(const GameServerData &rhs) : - m_connection(NULL), // connection pointer is not copied when we copy GameServerDatas + m_connection(nullptr), // connection pointer is not copied when we copy GameServerDatas m_objectCount(rhs.m_objectCount), m_interestObjectCount(rhs.m_interestObjectCount), m_interestCreatureObjectCount(rhs.m_interestCreatureObjectCount), @@ -38,7 +38,7 @@ GameServerData::GameServerData(const GameServerData &rhs) : // ---------------------------------------------------------------------- GameServerData::GameServerData() : - m_connection(NULL), + m_connection(nullptr), m_objectCount(0), m_interestObjectCount(0), m_interestCreatureObjectCount(0), @@ -53,7 +53,7 @@ GameServerData &GameServerData::operator=(const GameServerData &rhs) if (&rhs == this) return *this; - m_connection=NULL; // connection pointer is not copied when we copy GameServerDatas + m_connection=nullptr; // connection pointer is not copied when we copy GameServerDatas m_objectCount=rhs.m_objectCount; m_interestObjectCount=rhs.m_interestObjectCount; m_interestCreatureObjectCount=rhs.m_interestCreatureObjectCount; diff --git a/engine/server/application/PlanetServer/src/shared/PlanetProxyObject.cpp b/engine/server/application/PlanetServer/src/shared/PlanetProxyObject.cpp index 0fff2eb7..b2d9cf79 100755 --- a/engine/server/application/PlanetServer/src/shared/PlanetProxyObject.cpp +++ b/engine/server/application/PlanetServer/src/shared/PlanetProxyObject.cpp @@ -41,9 +41,9 @@ PlanetProxyObject::PlanetProxyObject (const NetworkId &objectId) : m_authoritativeServer(0), m_lastReportedServer(0), m_interestRadius(0), - m_quadtreeNode(NULL), + m_quadtreeNode(nullptr), m_authTransferTimeMs(Clock::timeMs()), - m_contents(NULL), + m_contents(nullptr), m_level(0), m_hibernating(false), m_templateCrc(0), @@ -137,9 +137,9 @@ void PlanetProxyObject::update(int x, int y, int z, NetworkId containedBy, uint3 if (ConfigPlanetServer::getEnableContentsChecking() && (m_containedBy!=containedBy)) updateContentsTracking(containedBy); - bool const firstUpdate = (m_quadtreeNode == NULL); + bool const firstUpdate = (m_quadtreeNode == nullptr); - if (m_quadtreeNode!=NULL) // if this is the first update for this object, m_quadtreeNode will be NULL because it hasn't been placed anywhere yet + if (m_quadtreeNode!=nullptr) // if this is the first update for this object, m_quadtreeNode will be nullptr because it hasn't been placed anywhere yet { removeServerStatistics(); diff --git a/engine/server/application/PlanetServer/src/shared/PlanetServer.cpp b/engine/server/application/PlanetServer/src/shared/PlanetServer.cpp index d69a029c..a76929ce 100755 --- a/engine/server/application/PlanetServer/src/shared/PlanetServer.cpp +++ b/engine/server/application/PlanetServer/src/shared/PlanetServer.cpp @@ -102,12 +102,12 @@ using namespace PlanetServerNamespace; PlanetServer::PlanetServer() : Singleton(), MessageDispatch::Receiver(), - m_pendingCentralServerConnection(NULL), - m_centralServerConnection(NULL), - m_gameService(NULL), - m_watcherService(NULL), + m_pendingCentralServerConnection(nullptr), + m_centralServerConnection(nullptr), + m_gameService(nullptr), + m_watcherService(nullptr), m_gameServers(), - m_taskConnection(NULL), + m_taskConnection(nullptr), m_done(false), m_roundRobinGameServer(0), m_pendingServerStarts(new std::map()), @@ -117,7 +117,7 @@ PlanetServer::PlanetServer() : m_spaceMode(false), m_messagesWaitingForGameServer(), m_metricsData(0), - m_taskManagerConnection(NULL), + m_taskManagerConnection(nullptr), m_sceneTransferChunkLoads(new std::list), m_pendingCharacterSaves(new std::map), m_watchers(), @@ -433,7 +433,7 @@ void PlanetServer::receiveMessage(const MessageDispatch::Emitter & source, const GameServerConnection *gameServer=const_cast(dynamic_cast(&source)); std::set::iterator f = m_pendingGameServerDisconnects.find(gameServer); - WARNING_DEBUG_FATAL(gameServer==0,("Source was NULL or source was not a GameServerConnection.")); + WARNING_DEBUG_FATAL(gameServer==0,("Source was nullptr or source was not a GameServerConnection.")); DEBUG_REPORT_LOG(true, ("removing crashed gameserver\n")); uint32 id = gameServer->getProcessId(); GameServerMapType::iterator i=m_gameServers.find(id); @@ -688,7 +688,7 @@ void PlanetServer::receiveMessage(const MessageDispatch::Emitter & source, const UnloadedPlayerMessage msg(ri); GameServerConnection *gameServer=const_cast(dynamic_cast(&source)); - WARNING_DEBUG_FATAL(gameServer==0,("Source was NULL or source was not a GameServerConnection.")); + WARNING_DEBUG_FATAL(gameServer==0,("Source was nullptr or source was not a GameServerConnection.")); uint32 gameServerId = gameServer->getProcessId(); (*m_pendingCharacterSaves)[msg.getPlayerId()]=gameServerId; @@ -766,19 +766,19 @@ void PlanetServer::receiveMessage(const MessageDispatch::Emitter & source, const GameServerData * fromServer = PlanetServer::getGameServerData(msg.getFromProcess()); GameServerData * toServer = PlanetServer::getGameServerData(msg.getToProcess()); PlanetProxyObject * object = Scene::getInstance().findObjectByID(msg.getId()); - if (fromServer == NULL || toServer == NULL || object == NULL) + if (fromServer == nullptr || toServer == nullptr || object == nullptr) { - if (fromServer == NULL) + if (fromServer == nullptr) { WARNING(true, ("Message GameServerForceChangeAuthorityMessage: no " "from server %lu", msg.getFromProcess())); } - if (toServer == NULL) + if (toServer == nullptr) { WARNING(true, ("Message GameServerForceChangeAuthorityMessage: no " "to server %lu", msg.getToProcess())); } - if (object == NULL) + if (object == nullptr) { WARNING(true, ("Message GameServerForceChangeAuthorityMessage: no " "object for id %s", msg.getId().getValueString().c_str())); @@ -914,7 +914,7 @@ void PlanetServer::receiveMessage(const MessageDispatch::Emitter & source, const { // if it's been "awhile" since we requested to restart the GameServer, // then assume that something has gone wrong, and try the restart again - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); for (std::map >::iterator iter = m_startingGameServers->begin(); iter != m_startingGameServers->end(); ++iter) { @@ -1005,7 +1005,7 @@ GameServerConnection *PlanetServer::getGameServerConnection(uint32 serverId) if (i!=m_gameServers.end()) return (*i).second->getConnection(); else - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -1290,7 +1290,7 @@ void PlanetServer::startGameServer(const std::set & preloadServ TaskSpawnProcess spawn("any", "SwgGameServer", options, i->second); if (m_centralServerConnection) { - (*m_startingGameServers)[cookie] = std::make_pair(options, ::time(NULL)); + (*m_startingGameServers)[cookie] = std::make_pair(options, ::time(nullptr)); ++cookie; m_centralServerConnection->send(spawn,true); DEBUG_REPORT_LOG(true, ("Sent start gameserver request for scene %s\n", ConfigPlanetServer::getSceneID())); @@ -1321,7 +1321,7 @@ GameServerData *PlanetServer::getGameServerData(uint32 serverId) const if (i!=m_gameServers.end()) return i->second; else - return NULL; + return nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/application/PlanetServer/src/shared/PlanetServer.h b/engine/server/application/PlanetServer/src/shared/PlanetServer.h index cf457544..7a75e4fc 100755 --- a/engine/server/application/PlanetServer/src/shared/PlanetServer.h +++ b/engine/server/application/PlanetServer/src/shared/PlanetServer.h @@ -146,7 +146,7 @@ inline int PlanetServer::getNumberOfGameServers() const inline void PlanetServer::onCentralConnected(CentralServerConnection *connection) { - m_pendingCentralServerConnection=NULL; + m_pendingCentralServerConnection=nullptr; m_centralServerConnection=connection; } diff --git a/engine/server/application/PlanetServer/src/shared/PreloadManager.cpp b/engine/server/application/PlanetServer/src/shared/PreloadManager.cpp index 37371536..15811eeb 100755 --- a/engine/server/application/PlanetServer/src/shared/PreloadManager.cpp +++ b/engine/server/application/PlanetServer/src/shared/PreloadManager.cpp @@ -119,7 +119,7 @@ void PreloadManager::handlePreloadList() if (PlanetServer::getInstance().getEnablePreload()) { DataTable * data = DataTableManager::getTable(ConfigPlanetServer::getPreloadDataTableName(),true); - FATAL(data==NULL,("Could not find data table %s, needed for preload",ConfigPlanetServer::getPreloadDataTableName())); + FATAL(data==nullptr,("Could not find data table %s, needed for preload",ConfigPlanetServer::getPreloadDataTableName())); int numRows = data->getNumRows(); for (int row=0; row(&source); - WARNING_DEBUG_FATAL(gameServer==0,("Source was NULL or source was not a GameServerConnection.")); + WARNING_DEBUG_FATAL(gameServer==0,("Source was nullptr or source was not a GameServerConnection.")); if (message.isType("GameConnectionClosed")) { @@ -216,7 +216,7 @@ Node *Scene::findNodeByPosition(int x, int z) /** * Given coordinates, return a const pointer to the node that encloses - * those coordinates. Will not create new nodes, so it may return NULL. + * those coordinates. Will not create new nodes, so it may return nullptr. */ const Node *Scene::findNodeByPositionConst(int x, int z) const { @@ -245,7 +245,7 @@ Node *Scene::findNodeByRoundedPosition(int x, int z) /** * Given coordinates that are known to be a node boundary, return a const pointer - * to the node. Does not create new nodes, so may return NULL. + * to the node. Does not create new nodes, so may return nullptr. */ const Node *Scene::findNodeByRoundedPositionConst(int x, int z) const { @@ -254,7 +254,7 @@ const Node *Scene::findNodeByRoundedPositionConst(int x, int z) const if (i!=m_nodeMap.end()) return (*i).second; else - return NULL; + return nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/application/StationPlayersCollector/src/linux/main.cpp b/engine/server/application/StationPlayersCollector/src/linux/main.cpp index 7112ccde..d2abdabf 100755 --- a/engine/server/application/StationPlayersCollector/src/linux/main.cpp +++ b/engine/server/application/StationPlayersCollector/src/linux/main.cpp @@ -35,7 +35,7 @@ int main(int argc, char ** argv) SetupSharedFile::install(false); SetupSharedNetworkMessages::install(); - SetupSharedRandom::install(static_cast(time(NULL))); //lint !e1924 !e64 // NULL is a C-Style cast? + SetupSharedRandom::install(static_cast(time(nullptr))); //lint !e1924 !e64 // nullptr is a C-Style cast? Os::setProgramName("StationPlayersCollector"); diff --git a/engine/server/application/TaskManager/src/linux/ConsoleInput.cpp b/engine/server/application/TaskManager/src/linux/ConsoleInput.cpp index a0d4580c..756bd237 100755 --- a/engine/server/application/TaskManager/src/linux/ConsoleInput.cpp +++ b/engine/server/application/TaskManager/src/linux/ConsoleInput.cpp @@ -22,7 +22,7 @@ struct SetBufferMode SetBufferMode::SetBufferMode() { - setvbuf(stdin, NULL, _IONBF, 0); + setvbuf(stdin, nullptr, _IONBF, 0); } //----------------------------------------------------------------------- diff --git a/engine/server/application/TaskManager/src/linux/ProcessSpawner.cpp b/engine/server/application/TaskManager/src/linux/ProcessSpawner.cpp index 3996480b..e63ffd6b 100755 --- a/engine/server/application/TaskManager/src/linux/ProcessSpawner.cpp +++ b/engine/server/application/TaskManager/src/linux/ProcessSpawner.cpp @@ -92,7 +92,7 @@ void makeParameters(const std::vector & parameters, std::vector(time(NULL))); //lint !e1924 !e64 // NULL is a C-Style cast? + SetupSharedRandom::install(static_cast(time(nullptr))); //lint !e1924 !e64 // nullptr is a C-Style cast? Os::setProgramName("TaskManager"); //setup the server diff --git a/engine/server/application/TaskManager/src/shared/GameConnection.cpp b/engine/server/application/TaskManager/src/shared/GameConnection.cpp index d297a6dd..baa6adfb 100755 --- a/engine/server/application/TaskManager/src/shared/GameConnection.cpp +++ b/engine/server/application/TaskManager/src/shared/GameConnection.cpp @@ -89,7 +89,7 @@ void GameConnection::receive(const Archive::ByteStream & message) char filename[30]; snprintf(filename, sizeof(filename)-1, "/proc/%lu/cmdline", m_pid); - // format of the cmdline file is a NULL separates every + // format of the cmdline file is a nullptr separates every // parameter, so we'll have to replace the NULLs with spaces FILE *inFile = fopen(filename,"rb"); if (inFile) diff --git a/engine/server/application/TaskManager/src/shared/Locator.cpp b/engine/server/application/TaskManager/src/shared/Locator.cpp index 994d2184..2dac97f8 100755 --- a/engine/server/application/TaskManager/src/shared/Locator.cpp +++ b/engine/server/application/TaskManager/src/shared/Locator.cpp @@ -25,11 +25,11 @@ namespace LocatorNamespace float getConfigSetting(const char *section, const char *key, const float defaultValue) { const ConfigFile::Section * sec = ConfigFile::getSection(section); - if (sec == NULL) + if (sec == nullptr) return defaultValue; const ConfigFile::Key * ky = sec->findKey(key); - if (ky == NULL) + if (ky == nullptr) return defaultValue; return ky->getAsFloat(ky->getCount()-1, defaultValue); @@ -364,7 +364,7 @@ void Locator::opened(std::string const &label, ManagerConnection *newConnection) TaskManager::runSpawnRequestQueue(); } else - WARNING_STRICT_FATAL(true, ("Passed null connection to Locator::opened")); + WARNING_STRICT_FATAL(true, ("Passed nullptr connection to Locator::opened")); } // ---------------------------------------------------------------------- diff --git a/engine/server/application/TaskManager/src/shared/ManagerConnection.cpp b/engine/server/application/TaskManager/src/shared/ManagerConnection.cpp index 3720de92..08807765 100755 --- a/engine/server/application/TaskManager/src/shared/ManagerConnection.cpp +++ b/engine/server/application/TaskManager/src/shared/ManagerConnection.cpp @@ -98,7 +98,7 @@ void ManagerConnection::onReceive(const Archive::ByteStream & message) r = message.begin(); if (m.isType("SystemTimeCheck")) { - long const currentTime = static_cast(::time(NULL)); + long const currentTime = static_cast(::time(nullptr)); GenericValueTypeMessage > msg(r); if (TaskManager::getNodeLabel() == "node0") @@ -117,7 +117,7 @@ void ManagerConnection::onReceive(const Archive::ByteStream & message) else if (m.isType("TaskConnectionIdMessage")) { static long const clockDriftFatalTimePeriod = static_cast(TaskManager::getStartTime()) + ConfigTaskManager::getClockDriftFatalIntervalSeconds(); - long const currentTime = static_cast(::time(NULL)); + long const currentTime = static_cast(::time(nullptr)); TaskConnectionIdMessage t(r); WARNING_STRICT_FATAL(t.getServerType() != TaskConnectionIdMessage::TaskManager, ("ManagerConnection received wrong type identifier")); diff --git a/engine/server/application/TaskManager/src/shared/TaskManager.cpp b/engine/server/application/TaskManager/src/shared/TaskManager.cpp index 192ab1a3..04550a81 100755 --- a/engine/server/application/TaskManager/src/shared/TaskManager.cpp +++ b/engine/server/application/TaskManager/src/shared/TaskManager.cpp @@ -161,7 +161,7 @@ m_processEntries(), m_localServers(), m_remoteServers(), m_nodeLabel(), -m_startTime(::time(NULL)), +m_startTime(::time(nullptr)), m_nodeList(), m_nodeNumber(-1), m_nodeToConnectToList(), @@ -362,7 +362,7 @@ void TaskManager::processRcFile() void TaskManager::setupNodeList() { char buffer[64]; - const char* result = NULL; + const char* result = nullptr; int nodeIndex = 0; bool found = true; @@ -375,7 +375,7 @@ void TaskManager::setupNodeList() { found = false; sprintf(buffer, "node%d", nodeIndex); - result = ConfigFile::getKeyString("TaskManager", buffer, NULL); + result = ConfigFile::getKeyString("TaskManager", buffer, nullptr); if (result) { NodeEntry n(result, buffer, nodeIndex); @@ -967,8 +967,8 @@ void TaskManager::update() // of slave TaskManager that has disconnected but has not reconnected, // so that an alert can be made in SOEMon so ops can see it and restart // the disconnected TaskManager - static time_t timeSystemTimeCheck = ::time(NULL) + ConfigTaskManager::getSystemTimeCheckIntervalSeconds(); - time_t const timeNow = ::time(NULL); + static time_t timeSystemTimeCheck = ::time(nullptr) + ConfigTaskManager::getSystemTimeCheckIntervalSeconds(); + time_t const timeNow = ::time(nullptr); if (timeSystemTimeCheck <= timeNow) { if (getNodeLabel() != "node0") diff --git a/engine/server/application/TransferServer/src/shared/CTSAPIClient.cpp b/engine/server/application/TransferServer/src/shared/CTSAPIClient.cpp index 6d456516..ca5d0845 100755 --- a/engine/server/application/TransferServer/src/shared/CTSAPIClient.cpp +++ b/engine/server/application/TransferServer/src/shared/CTSAPIClient.cpp @@ -147,7 +147,7 @@ void CTSAPIClient::onRequestMove(const unsigned server_track, const char *langua { LOG("CTSAPI", ("Received a transfer request for station ID %d, but a transfer for that id is already in progress", uid)); const unsigned int result = static_cast(CTService::CT_GAMERESULT_SOFTERROR); - IGNORE_RETURN(replyMove(server_track, result, NULL, NULL)); + IGNORE_RETURN(replyMove(server_track, result, nullptr, nullptr)); } } @@ -165,7 +165,7 @@ void CTSAPIClient::onRequestTransferAccount(const unsigned server_track, const u { LOG("CTSAPI", ("Received a transfer request for station ID %d, but a transfer for that id is already in progress", uid)); const unsigned int result = static_cast(CTService::CT_GAMERESULT_SOFTERROR); - IGNORE_RETURN(replyTransferAccount(server_track, result, NULL, NULL)); + IGNORE_RETURN(replyTransferAccount(server_track, result, nullptr, nullptr)); } } @@ -197,12 +197,12 @@ void CTSAPIClient::onRequestServerList(const unsigned server_track, const char * if(! servers.empty()) { const unsigned int result = static_cast(CTService::CT_RESULT_SUCCESS); - IGNORE_RETURN(replyServerList(server_track, result, servers.size(), &servers[0], NULL)); + IGNORE_RETURN(replyServerList(server_track, result, servers.size(), &servers[0], nullptr)); } else { const unsigned int result = static_cast(CTService::CT_RESULT_FAILURE); - IGNORE_RETURN(replyServerList(server_track, result, servers.size(), NULL, NULL)); + IGNORE_RETURN(replyServerList(server_track, result, servers.size(), nullptr, nullptr)); } } @@ -226,12 +226,12 @@ void CTSAPIClient::onRequestDestinationServerList(const unsigned server_track, c if(! servers.empty()) { const unsigned int result = static_cast(CTService::CT_RESULT_SUCCESS); - IGNORE_RETURN(replyDestinationServerList(server_track, result, servers.size(), &servers[0], NULL)); + IGNORE_RETURN(replyDestinationServerList(server_track, result, servers.size(), &servers[0], nullptr)); } else { const unsigned int result = static_cast(CTService::CT_RESULT_FAILURE); - IGNORE_RETURN(replyDestinationServerList(server_track, result, servers.size(), NULL, NULL)); + IGNORE_RETURN(replyDestinationServerList(server_track, result, servers.size(), nullptr, nullptr)); } } @@ -260,7 +260,7 @@ void CTSAPIClient::moveStart(unsigned int stationId, unsigned int track, const C std::map::iterator f = s_completedTransfers.find(track); if(f != s_completedTransfers.end()) { - IGNORE_RETURN(replyMove(track, f->second, NULL, NULL)); + IGNORE_RETURN(replyMove(track, f->second, nullptr, nullptr)); } else { @@ -284,7 +284,7 @@ void CTSAPIClient::lostCentralServerConnection(const CentralServerConnection * c { if(i->second.m_sourceCentralServerConnection == centralServerConnection || i->second.m_destinationCentralServerConnection == centralServerConnection) { - IGNORE_RETURN(replyMove(i->second.m_track, result, NULL, NULL)); + IGNORE_RETURN(replyMove(i->second.m_track, result, nullptr, nullptr)); s_activeTransfers.erase(i++); } else diff --git a/engine/server/application/TransferServer/src/shared/ConsoleManager.cpp b/engine/server/application/TransferServer/src/shared/ConsoleManager.cpp index c0208e0d..1a04dc38 100755 --- a/engine/server/application/TransferServer/src/shared/ConsoleManager.cpp +++ b/engine/server/application/TransferServer/src/shared/ConsoleManager.cpp @@ -14,7 +14,7 @@ namespace ConsoleManagerNamespace { - ConsoleCommandParser * s_consoleCommandParserRoot = NULL; + ConsoleCommandParser * s_consoleCommandParserRoot = nullptr; } using namespace ConsoleManagerNamespace; diff --git a/engine/server/application/TransferServer/src/shared/TransferServer.cpp b/engine/server/application/TransferServer/src/shared/TransferServer.cpp index 07334ab4..6533fd3e 100755 --- a/engine/server/application/TransferServer/src/shared/TransferServer.cpp +++ b/engine/server/application/TransferServer/src/shared/TransferServer.cpp @@ -150,10 +150,10 @@ namespace TransferServerNamespace if(s_apiClient) { const std::string resultString = resultToString(resultCode); - LOG("CustomerService", ("CharacterTransfer: transactionId=%u replyMove(%u, %s, NULL, NULL)", reply.getTransactionId(), reply.getTrack(), resultString.c_str())); + LOG("CustomerService", ("CharacterTransfer: transactionId=%u replyMove(%u, %s, nullptr, nullptr)", reply.getTransactionId(), reply.getTrack(), resultString.c_str())); const unsigned int result = static_cast(resultCode); s_apiClient->moveComplete(reply.getSourceStationId(), reply.getTrack(), result); - IGNORE_RETURN(s_apiClient->replyMove(reply.getTrack(), result, Unicode::narrowToWide(resultString).c_str(), NULL)); + IGNORE_RETURN(s_apiClient->replyMove(reply.getTrack(), result, Unicode::narrowToWide(resultString).c_str(), nullptr)); } } @@ -282,7 +282,7 @@ void TransferServer::requestCharacterList(unsigned int track, unsigned int stati { const unsigned int result = static_cast(CTService::CT_RESULT_FAILURE); - IGNORE_RETURN(s_apiClient->replyCharacterList(track, result, 0, NULL, NULL)); + IGNORE_RETURN(s_apiClient->replyCharacterList(track, result, 0, nullptr, nullptr)); s_apiClient->moveComplete(stationId, track, result); } } @@ -410,7 +410,7 @@ void TransferServer::requestTransferAccount(unsigned int track, unsigned int sou if(s_apiClient) { const unsigned int result = static_cast(CTService::CT_GAMERESULT_HARDERROR); - IGNORE_RETURN(s_apiClient->replyValidateMove(track, result, NULL, NULL, NULL)); + IGNORE_RETURN(s_apiClient->replyValidateMove(track, result, nullptr, nullptr, nullptr)); s_apiClient->moveComplete(sourceStationId, track, result); } @@ -430,7 +430,7 @@ void TransferServer::requestTransferAccount(unsigned int track, unsigned int sou if(s_apiClient) { const unsigned int result = static_cast(CTService::CT_GAMERESULT_SERVER_IS_DOWN); - IGNORE_RETURN(s_apiClient->replyTransferAccount(track, result, NULL, NULL)); + IGNORE_RETURN(s_apiClient->replyTransferAccount(track, result, nullptr, nullptr)); s_apiClient->moveComplete(sourceStationId, track, result); } @@ -442,12 +442,12 @@ void TransferServer::requestTransferAccount(unsigned int track, unsigned int sou if(destinationStationId == 0 || sourceStationId == 0) { - LOG("CustomerService", ("CharacterTransfer: Account move request made with a null destination station id: or source station id: %lu\n", sourceStationId)); + LOG("CustomerService", ("CharacterTransfer: Account move request made with a nullptr destination station id: or source station id: %lu\n", sourceStationId)); if(s_apiClient) { const unsigned int result = static_cast(CTService::CT_GAMERESULT_HARDERROR); - IGNORE_RETURN(s_apiClient->replyTransferAccount(track, result, NULL, NULL)); + IGNORE_RETURN(s_apiClient->replyTransferAccount(track, result, nullptr, nullptr)); s_apiClient->moveComplete(sourceStationId, track, result); } @@ -488,7 +488,7 @@ void TransferServer::requestMoveValidation(unsigned int track, unsigned int sour if(s_apiClient) { const unsigned int result = static_cast(CTService::CT_GAMERESULT_HARDERROR); - IGNORE_RETURN(s_apiClient->replyValidateMove(track, result, NULL, NULL, NULL)); + IGNORE_RETURN(s_apiClient->replyValidateMove(track, result, nullptr, nullptr, nullptr)); s_apiClient->moveComplete(sourceStationId, track, result); } } @@ -516,7 +516,7 @@ void TransferServer::requestMoveValidation(unsigned int track, unsigned int sour if(s_apiClient) { const unsigned int result = static_cast(CTService::CT_GAMERESULT_SERVER_IS_DOWN); - IGNORE_RETURN(s_apiClient->replyValidateMove(track, result, NULL, NULL, NULL)); + IGNORE_RETURN(s_apiClient->replyValidateMove(track, result, nullptr, nullptr, nullptr)); s_apiClient->moveComplete(sourceStationId, track, result); } } @@ -651,8 +651,8 @@ void TransferServer::replyCharacterList(const TransferReplyCharacterList & reply result = static_cast(CTService::CT_RESULT_FAILURE); s_apiClient->moveComplete(reply.getStationId(), reply.getTrack(), result); } - LOG("CTSAPI", ("invoking CTServiceAPI::replyCharacterList(%d, %d, %d, characters, NULL)", reply.getTrack(), result, chars.size())); - IGNORE_RETURN(s_apiClient->replyCharacterList(reply.getTrack(), result, reply.getAvatarList().size(), characters, NULL)); + LOG("CTSAPI", ("invoking CTServiceAPI::replyCharacterList(%d, %d, %d, characters, nullptr)", reply.getTrack(), result, chars.size())); + IGNORE_RETURN(s_apiClient->replyCharacterList(reply.getTrack(), result, reply.getAvatarList().size(), characters, nullptr)); } // else use another interface if available } @@ -675,7 +675,7 @@ void TransferServer::replyValidateMove(const TransferCharacterData & reply) { LOG("CustomerService", ("CharacterTransfer: replyValidateMove passed name validation for %s", reply.toString().c_str())); } - IGNORE_RETURN(s_apiClient->replyValidateMove(reply.getTrack(), result, NULL, NULL, NULL)); + IGNORE_RETURN(s_apiClient->replyValidateMove(reply.getTrack(), result, nullptr, nullptr, nullptr)); s_apiClient->moveComplete(reply.getSourceStationId(), reply.getTrack(), result); } } @@ -736,7 +736,7 @@ void TransferServer::replyTransferAccountSuccess(const TransferAccountData & rep LOG("CustomerService", ("CharacterTransfer: Could not transfer chat avatars for character %s on cluster %s from %lu to %lu: central connection does not exist in transferserver", i->second.c_str(), i->first.c_str(), reply.getSourceStationId(), reply.getDestinationStationId())); const unsigned int result = static_cast(CTService::CT_GAMERESULT_HARDERROR); s_apiClient->moveComplete(reply.getSourceStationId(), reply.getTrack(), result); - IGNORE_RETURN(s_apiClient->replyTransferAccount(reply.getTrack(), result, NULL, NULL)); + IGNORE_RETURN(s_apiClient->replyTransferAccount(reply.getTrack(), result, nullptr, nullptr)); } } } @@ -748,7 +748,7 @@ void TransferServer::replyTransferAccountSuccess(const TransferAccountData & rep if(s_apiClient) { const unsigned int result = static_cast(CTService::CT_GAMERESULT_SUCCESS); - IGNORE_RETURN(s_apiClient->replyTransferAccount(reply.getTrack(), result, NULL, NULL)); + IGNORE_RETURN(s_apiClient->replyTransferAccount(reply.getTrack(), result, nullptr, nullptr)); s_apiClient->moveComplete(reply.getSourceStationId(), reply.getTrack(), result); } } @@ -808,7 +808,7 @@ void TransferServer::failedToTransferAccountNoCentralConnection(const TransferAc LOG("CustomerService", ("CharacterTransfer: Transfer failed: Could not connect to central server to update game database. Sending HARD ERROR to CTS API. %s", failed.toString().c_str())); const unsigned int result = static_cast(CTService::CT_GAMERESULT_HARDERROR); s_apiClient->moveComplete(failed.getSourceStationId(), failed.getTrack(), result); - IGNORE_RETURN(s_apiClient->replyTransferAccount(failed.getTrack(), result, NULL, NULL)); + IGNORE_RETURN(s_apiClient->replyTransferAccount(failed.getTrack(), result, nullptr, nullptr)); } } @@ -821,7 +821,7 @@ void TransferServer::failedToTransferAccountDestinationNotEmpty (const TransferA LOG("CustomerService", ("CharacterTransfer: Transfer failed: Destination stationId has avatars. Sending HARD ERROR to CTS API. %s", failed.toString().c_str())); const unsigned int result = static_cast(CTService::CT_GAMERESULT_HARDERROR); s_apiClient->moveComplete(failed.getSourceStationId(), failed.getTrack(), result); - IGNORE_RETURN(s_apiClient->replyTransferAccount(failed.getTrack(), result, NULL, NULL)); + IGNORE_RETURN(s_apiClient->replyTransferAccount(failed.getTrack(), result, nullptr, nullptr)); } } @@ -860,7 +860,7 @@ void TransferServer::failedToValidateTransfer(const TransferReplyMoveValidation { const unsigned int result = ((reply.getResult() == TransferReplyMoveValidation::TRMVR_cannot_create_regular_character) ? static_cast(CTService::CT_GAMERESULT_MAX_CHAR_ON_DEST_SERVER) : static_cast(CTService::CT_GAMERESULT_SERVER_IS_DOWN)); - IGNORE_RETURN(s_apiClient->replyValidateMove(reply.getTrack(), result, NULL, NULL, NULL)); + IGNORE_RETURN(s_apiClient->replyValidateMove(reply.getTrack(), result, nullptr, nullptr, nullptr)); s_apiClient->moveComplete(reply.getSourceStationId(), reply.getTrack(), result); // close pseudoclientconnections diff --git a/engine/server/library/serverDatabase/src/shared/ConsoleManager.cpp b/engine/server/library/serverDatabase/src/shared/ConsoleManager.cpp index 4e24a67e..70f8342d 100755 --- a/engine/server/library/serverDatabase/src/shared/ConsoleManager.cpp +++ b/engine/server/library/serverDatabase/src/shared/ConsoleManager.cpp @@ -14,7 +14,7 @@ namespace ConsoleManagerNamespace { - ConsoleCommandParser * s_consoleCommandParserRoot = NULL; + ConsoleCommandParser * s_consoleCommandParserRoot = nullptr; } using namespace ConsoleManagerNamespace; diff --git a/engine/server/library/serverDatabase/src/shared/DataLookup.cpp b/engine/server/library/serverDatabase/src/shared/DataLookup.cpp index dd42952a..33fef53a 100755 --- a/engine/server/library/serverDatabase/src/shared/DataLookup.cpp +++ b/engine/server/library/serverDatabase/src/shared/DataLookup.cpp @@ -30,7 +30,7 @@ //----------------------------------------------------------------------- -DataLookup *DataLookup::ms_theInstance = NULL; +DataLookup *DataLookup::ms_theInstance = nullptr; //----------------------------------------------------------------------- @@ -524,7 +524,7 @@ void DataLookup::deleteReservationList(uint32 stationId) reservationList * rl = rlIter->second; if (!rl) { - WARNING_STRICT_FATAL(true, ("Reservation list for stationID %lu is NULL", stationId)); + WARNING_STRICT_FATAL(true, ("Reservation list for stationID %lu is nullptr", stationId)); return; } reservationList::iterator i; diff --git a/engine/server/library/serverDatabase/src/shared/DatabaseProcess.cpp b/engine/server/library/serverDatabase/src/shared/DatabaseProcess.cpp index 1c0eca40..fb5a56fe 100755 --- a/engine/server/library/serverDatabase/src/shared/DatabaseProcess.cpp +++ b/engine/server/library/serverDatabase/src/shared/DatabaseProcess.cpp @@ -46,7 +46,7 @@ // ---------------------------------------------------------------------- -DatabaseProcess *DatabaseProcess::ms_theInstance = NULL; +DatabaseProcess *DatabaseProcess::ms_theInstance = nullptr; // ---------------------------------------------------------------------- @@ -627,7 +627,7 @@ void DatabaseProcess::sendToCommoditiesServer(GameNetworkMessage const &message, commoditiesConnection->send(message,reliable); } else - DEBUG_REPORT_LOG(true, ("commoditiesConnection is NULL\n")); + DEBUG_REPORT_LOG(true, ("commoditiesConnection is nullptr\n")); } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverDatabase/src/shared/ImmediateDeleteCustomPersistStep.cpp b/engine/server/library/serverDatabase/src/shared/ImmediateDeleteCustomPersistStep.cpp index e1c3d149..c205c79d 100755 --- a/engine/server/library/serverDatabase/src/shared/ImmediateDeleteCustomPersistStep.cpp +++ b/engine/server/library/serverDatabase/src/shared/ImmediateDeleteCustomPersistStep.cpp @@ -23,7 +23,7 @@ ImmediateDeleteCustomPersistStep::ImmediateDeleteCustomPersistStep() : ImmediateDeleteCustomPersistStep::~ImmediateDeleteCustomPersistStep() { delete m_objects; - m_objects = NULL; + m_objects = nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverDatabase/src/shared/LazyDeleter.cpp b/engine/server/library/serverDatabase/src/shared/LazyDeleter.cpp index 16baa713..ecdc4260 100755 --- a/engine/server/library/serverDatabase/src/shared/LazyDeleter.cpp +++ b/engine/server/library/serverDatabase/src/shared/LazyDeleter.cpp @@ -27,7 +27,7 @@ // ====================================================================== -LazyDeleter * LazyDeleter::ms_instance=NULL; +LazyDeleter * LazyDeleter::ms_instance=nullptr; // ====================================================================== @@ -80,13 +80,13 @@ void LazyDeleter::remove() { NOT_NULL(ms_instance); delete ms_instance; - ms_instance = NULL; + ms_instance = nullptr; } // ---------------------------------------------------------------------- LazyDeleter::LazyDeleter() : - m_workerThread(NULL), // Avoid starting the worker thread until the other member variables are initialized + m_workerThread(nullptr), // Avoid starting the worker thread until the other member variables are initialized m_incomingObjects(new std::vector), m_objectsToDelete(new std::deque), m_objectListLock(new Mutex), @@ -113,11 +113,11 @@ LazyDeleter::~LazyDeleter() delete m_objectsToDelete; delete m_objectListLock; - m_workerThread = NULL; - m_incomingObjects = NULL; - m_objectsToDelete = NULL; - m_objectListLock = NULL; - m_session = NULL; + m_workerThread = nullptr; + m_incomingObjects = nullptr; + m_objectsToDelete = nullptr; + m_objectListLock = nullptr; + m_session = nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverDatabase/src/shared/Loader.cpp b/engine/server/library/serverDatabase/src/shared/Loader.cpp index fb4b5a6c..3f863d80 100755 --- a/engine/server/library/serverDatabase/src/shared/Loader.cpp +++ b/engine/server/library/serverDatabase/src/shared/Loader.cpp @@ -55,7 +55,7 @@ // ====================================================================== -Loader *Loader::ms_instance = NULL; +Loader *Loader::ms_instance = nullptr; // ====================================================================== @@ -72,7 +72,7 @@ void Loader::remove() { NOT_NULL(ms_instance); delete ms_instance; - ms_instance = NULL; + ms_instance = nullptr; } // ---------------------------------------------------------------------- @@ -442,7 +442,7 @@ void Loader::receiveMessage(const MessageDispatch::Emitter & source, const Messa { Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); ValidateCharacterForLoginMessage msg(ri); - verifyCharacter(msg.getSuid(), msg.getCharacterId(), NULL); + verifyCharacter(msg.getSuid(), msg.getCharacterId(), nullptr); } else if(message.isType("TransferGetLoginLocationData")) { @@ -647,7 +647,7 @@ void Loader::checkVersionNumber(int expectedVersion, bool fatalOnMismatch) void Loader::requestChunk(uint32 processId,int nodeX, int nodeZ, const std::string &sceneId) { ObjectLocator * const regularLocator=new ChunkLocator(nodeX, nodeZ, sceneId, processId, true); - ObjectLocator * goldLocator=NULL; + ObjectLocator * goldLocator=nullptr; if (ConfigServerDatabase::getEnableGoldDatabase()) goldLocator = new ChunkLocator(nodeX, nodeZ, sceneId, processId, false); addLocatorsForServer(processId, regularLocator, goldLocator); @@ -671,7 +671,7 @@ void Loader::requestCharacter(const NetworkId &characterId, uint32 gameServerId) i=m_multipleLoginLock.find(characterId); if (i==m_multipleLoginLock.end()) { - addLocatorsForServer(gameServerId, new CharacterLocator(characterId), NULL); + addLocatorsForServer(gameServerId, new CharacterLocator(characterId), nullptr); DEBUG_REPORT_LOG(true,("Adding multipleLoginLock for %s\n",characterId.getValueString().c_str())); m_multipleLoginLock[characterId] = gameServerId; @@ -684,7 +684,7 @@ void Loader::requestCharacter(const NetworkId &characterId, uint32 gameServerId) } } else - addLocatorsForServer(gameServerId, new CharacterLocator(characterId), NULL); + addLocatorsForServer(gameServerId, new CharacterLocator(characterId), nullptr); } // ---------------------------------------------------------------------- @@ -692,7 +692,7 @@ void Loader::requestCharacter(const NetworkId &characterId, uint32 gameServerId) void Loader::loadContainedObject(const NetworkId &containerId, const NetworkId &objectId, uint32 gameServerId) { LOG("AuctionRetrieval", ("Loader::received loadContainedObject for loading object %s for retrieval", objectId.getValueString().c_str())); - addLocatorsForServer(gameServerId, new ContainedObjectLocator(containerId,objectId), NULL); + addLocatorsForServer(gameServerId, new ContainedObjectLocator(containerId,objectId), nullptr); } @@ -700,7 +700,7 @@ void Loader::loadContainedObject(const NetworkId &containerId, const NetworkId & void Loader::loadContents(const NetworkId &containerId, uint32 gameServerId) { - addLocatorsForServer(gameServerId, new ContentsLocator(containerId), NULL); + addLocatorsForServer(gameServerId, new ContentsLocator(containerId), nullptr); } // ---------------------------------------------------------------------- @@ -820,7 +820,7 @@ void Loader::removeLoadLock(const NetworkId &characterId) if (i->second!=0) { DEBUG_REPORT_LOG(true,("Now handling delayed login request for character %s\n",characterId.getValueString().c_str())); - addLocatorsForServer(i->second, new CharacterLocator(characterId), NULL); + addLocatorsForServer(i->second, new CharacterLocator(characterId), nullptr); } m_loadLock.erase(i); diff --git a/engine/server/library/serverDatabase/src/shared/MessageToManager.cpp b/engine/server/library/serverDatabase/src/shared/MessageToManager.cpp index 6773ccca..d47dc773 100755 --- a/engine/server/library/serverDatabase/src/shared/MessageToManager.cpp +++ b/engine/server/library/serverDatabase/src/shared/MessageToManager.cpp @@ -16,7 +16,7 @@ // ====================================================================== -MessageToManager *MessageToManager::ms_instance=NULL; +MessageToManager *MessageToManager::ms_instance=nullptr; // ====================================================================== @@ -34,7 +34,7 @@ void MessageToManager::remove() { NOT_NULL(ms_instance); delete ms_instance; - ms_instance = NULL; + ms_instance = nullptr; } // ---------------------------------------------------------------------- @@ -51,7 +51,7 @@ MessageToManager::~MessageToManager() for (MessagesByObjectType::iterator i=m_messagesByObject.begin(); i!=m_messagesByObject.end(); ++i) { delete i->second; - i->second=NULL; + i->second=nullptr; } } @@ -71,7 +71,7 @@ void MessageToManager::handleMessageTo(const MessageToPayload &data) { DEBUG_WARNING(true,("Received message %s twice.",data.getMessageId().getValueString().c_str())); delete i->second; - i->second = NULL; + i->second = nullptr; } m_messagesByObject[theKey]=new MessageToPayload(data); @@ -127,7 +127,7 @@ void MessageToManager::removeMessage(const MessageToId &messageId) if (j!=m_messagesByObject.end()) { delete j->second; - j->second=NULL; + j->second=nullptr; m_messagesByObject.erase(j); } m_messageToObjectMap.erase(i); diff --git a/engine/server/library/serverDatabase/src/shared/Persister.cpp b/engine/server/library/serverDatabase/src/shared/Persister.cpp index 89c299ff..bf178daa 100755 --- a/engine/server/library/serverDatabase/src/shared/Persister.cpp +++ b/engine/server/library/serverDatabase/src/shared/Persister.cpp @@ -70,7 +70,7 @@ // ====================================================================== -Persister *Persister::ms_instance=NULL; +Persister *Persister::ms_instance=nullptr; // ====================================================================== @@ -88,7 +88,7 @@ void Persister::remove() { NOT_NULL(ms_instance); delete ms_instance; - ms_instance = NULL; + ms_instance = nullptr; } //----------------------------------------------------------------------- @@ -108,9 +108,9 @@ Persister::Persister() : m_charactersToDeleteThisSaveCycle(new CharactersToDeleteType), m_charactersToDeleteNextSaveCycle(new CharactersToDeleteType), m_timeSinceLastSave(0), - m_messageSnapshot(NULL), - m_commoditiesSnapshot(NULL), - m_arbitraryGameDataSnapshot(NULL), + m_messageSnapshot(nullptr), + m_commoditiesSnapshot(nullptr), + m_arbitraryGameDataSnapshot(nullptr), m_saveStartTime(0), m_totalSaveTime(0), m_maxSaveTime(0), @@ -181,15 +181,15 @@ Persister::~Persister() m_currentSnapshots.clear(); m_newObjectSnapshots.clear(); m_objectSnapshotMap.clear(); - m_messageSnapshot = NULL; - m_commoditiesSnapshot = NULL; - m_arbitraryGameDataSnapshot = NULL; + m_messageSnapshot = nullptr; + m_commoditiesSnapshot = nullptr; + m_arbitraryGameDataSnapshot = nullptr; delete m_charactersToDeleteThisSaveCycle; - m_charactersToDeleteThisSaveCycle = NULL; + m_charactersToDeleteThisSaveCycle = nullptr; delete m_charactersToDeleteNextSaveCycle; - m_charactersToDeleteNextSaveCycle = NULL; + m_charactersToDeleteNextSaveCycle = nullptr; } // ---------------------------------------------------------------------- @@ -283,7 +283,7 @@ void Persister::onFrameBarrierReached() /** * Moves the current & new object snapshots onto the queue to be saved. * - * Does nothing if these snapshots are null. + * Does nothing if these snapshots are nullptr. */ void Persister::startSave(void) @@ -351,9 +351,9 @@ void Persister::startSave(void) m_currentSnapshots.clear(); m_newObjectSnapshots.clear(); m_objectSnapshotMap.clear(); - m_messageSnapshot = NULL; - m_commoditiesSnapshot = NULL; - m_arbitraryGameDataSnapshot = NULL; + m_messageSnapshot = nullptr; + m_commoditiesSnapshot = nullptr; + m_arbitraryGameDataSnapshot = nullptr; // prepare the list of characters to delete during the next save cycle if (m_charactersToDeleteNextSaveCycle && m_charactersToDeleteThisSaveCycle) @@ -515,7 +515,7 @@ void Persister::newObject(uint32 serverId, const NetworkId &objectId, int templa return; } - Snapshot *snap=NULL; + Snapshot *snap=nullptr; PendingCharactersType::iterator chardata=m_pendingCharacters.find(objectId); if (chardata!=m_pendingCharacters.end()) @@ -543,7 +543,7 @@ void Persister::newObject(uint32 serverId, const NetworkId &objectId, int templa else { // Add the object to the appropriate snapshot - snap=NULL; + snap=nullptr; { ObjectSnapshotMap::const_iterator j=m_objectSnapshotMap.find(container); if (j!=m_objectSnapshotMap.end() && j->second->getMode() == DB::ModeQuery::mode_INSERT) @@ -728,7 +728,7 @@ void Persister::receiveMessage(const MessageDispatch::Emitter & source, const Me Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); RenameCharacterMessageEx msg(ri); - renameCharacter(sourceGameServer, static_cast(msg.getRenameCharacterMessageSource()), msg.getStationId(), msg.getCharacterId(), msg.getNewName(), msg.getOldName(), msg.getLastNameChangeOnly(), msg.getRequestedBy(), NULL); + renameCharacter(sourceGameServer, static_cast(msg.getRenameCharacterMessageSource()), msg.getStationId(), msg.getCharacterId(), msg.getNewName(), msg.getOldName(), msg.getLastNameChangeOnly(), msg.getRequestedBy(), nullptr); } else if (message.isType("UnloadedPlayerMessage")) { diff --git a/engine/server/library/serverDatabase/src/shared/TaskGetBiography.cpp b/engine/server/library/serverDatabase/src/shared/TaskGetBiography.cpp index 9c6cb243..96b976fb 100755 --- a/engine/server/library/serverDatabase/src/shared/TaskGetBiography.cpp +++ b/engine/server/library/serverDatabase/src/shared/TaskGetBiography.cpp @@ -19,7 +19,7 @@ TaskGetBiography::TaskGetBiography(const NetworkId &owner, uint32 requestingProcess) : m_owner(owner), m_requestingProcess(requestingProcess), - m_bio(NULL) + m_bio(nullptr) { } @@ -28,7 +28,7 @@ TaskGetBiography::TaskGetBiography(const NetworkId &owner, uint32 requestingProc TaskGetBiography::~TaskGetBiography() { delete m_bio; - m_bio=NULL; + m_bio=nullptr; } // ---------------------------------------------------------------------- @@ -53,7 +53,7 @@ bool TaskGetBiography::process(DB::Session *session) void TaskGetBiography::onComplete() { - WARNING_STRICT_FATAL(!m_bio,("In TaskGetBiography::onComplete, but m_bio is NULL\n")); + WARNING_STRICT_FATAL(!m_bio,("In TaskGetBiography::onComplete, but m_bio is nullptr\n")); if (m_bio) { BiographyMessage msg(m_owner, *m_bio); diff --git a/engine/server/library/serverDatabase/src/shared/TaskSetBiography.cpp b/engine/server/library/serverDatabase/src/shared/TaskSetBiography.cpp index d8a98958..501cfe48 100755 --- a/engine/server/library/serverDatabase/src/shared/TaskSetBiography.cpp +++ b/engine/server/library/serverDatabase/src/shared/TaskSetBiography.cpp @@ -24,7 +24,7 @@ TaskSetBiography::TaskSetBiography(const NetworkId &owner, const Unicode::String TaskSetBiography::~TaskSetBiography() { delete m_bio; - m_bio=NULL; + m_bio=nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/ai/AggroListProperty.cpp b/engine/server/library/serverGame/src/shared/ai/AggroListProperty.cpp index 0b0a552d..e06b0d40 100755 --- a/engine/server/library/serverGame/src/shared/ai/AggroListProperty.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AggroListProperty.cpp @@ -106,7 +106,7 @@ bool AggroListPropertyNamespace::isIncapacitated(TangibleObject const & target) { CreatureObject const * const targetCreatureObject = target.asCreatureObject(); - return (targetCreatureObject != NULL) ? targetCreatureObject->isIncapacitated() : false; + return (targetCreatureObject != nullptr) ? targetCreatureObject->isIncapacitated() : false; } // ---------------------------------------------------------------------- @@ -114,7 +114,7 @@ bool AggroListPropertyNamespace::isDead(TangibleObject const & target) { CreatureObject const * const targetCreatureObject = target.asCreatureObject(); - return (targetCreatureObject != NULL) ? targetCreatureObject->isDead() : false; + return (targetCreatureObject != nullptr) ? targetCreatureObject->isDead() : false; } // ---------------------------------------------------------------------- @@ -122,7 +122,7 @@ bool AggroListPropertyNamespace::isInvulnerable(TangibleObject const & target) { CreatureObject const * const targetCreatureObject = target.asCreatureObject(); - return (targetCreatureObject != NULL) ? targetCreatureObject->isInvulnerable() : false; + return (targetCreatureObject != nullptr) ? targetCreatureObject->isInvulnerable() : false; } // ---------------------------------------------------------------------- @@ -138,7 +138,7 @@ bool AggroListPropertyNamespace::isFeigningDeath(TangibleObject const & target) { CreatureObject const * const targetCreatureObject = target.asCreatureObject(); - return (targetCreatureObject != NULL) ? targetCreatureObject->getState(States::FeignDeath) : false; + return (targetCreatureObject != nullptr) ? targetCreatureObject->getState(States::FeignDeath) : false; } // ---------------------------------------------------------------------- @@ -146,7 +146,7 @@ bool AggroListPropertyNamespace::isInPlayerBuilding(TangibleObject const & targe { ServerObject const * const topMostServerObject = ServerObject::asServerObject(ContainerInterface::getTopmostContainer(target)); - return (topMostServerObject != NULL) ? (topMostServerObject->getGameObjectType() == SharedObjectTemplate::GOT_building_player) : false; + return (topMostServerObject != nullptr) ? (topMostServerObject->getGameObjectType() == SharedObjectTemplate::GOT_building_player) : false; } // ---------------------------------------------------------------------- @@ -154,7 +154,7 @@ bool AggroListPropertyNamespace::isAggroImmune(TangibleObject const & target) { PlayerObject const * const playerObject = PlayerCreatureController::getPlayerObject(target.asCreatureObject()); - return (playerObject != NULL) ? playerObject->isAggroImmune() : false; + return (playerObject != nullptr) ? playerObject->isAggroImmune() : false; } // ====================================================================== @@ -212,7 +212,7 @@ void AggroListProperty::alter() // First, list things that invalidate this target in the aggro list // Second, list the things that promote the target to the hate list - if (target.getObject() == NULL) + if (target.getObject() == nullptr) { purgeList.push_back(iterTargetList); } @@ -315,7 +315,7 @@ TangibleObject & AggroListProperty::getTangibleOwner() AggroListProperty * AggroListProperty::getAggroListProperty(Object & object) { Property * const property = object.getProperty(getClassPropertyId()); - AggroListProperty * const aggroProperty = (property != NULL) ? static_cast(property) : NULL; + AggroListProperty * const aggroProperty = (property != nullptr) ? static_cast(property) : nullptr; return aggroProperty; } diff --git a/engine/server/library/serverGame/src/shared/ai/AiCombatPulseQueue.cpp b/engine/server/library/serverGame/src/shared/ai/AiCombatPulseQueue.cpp index c3e95004..328d9540 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiCombatPulseQueue.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiCombatPulseQueue.cpp @@ -45,7 +45,7 @@ void AiCombatPulseQueue::remove() void AiCombatPulseQueue::schedule(TangibleObject * const object, int waitTimeMs, unsigned long currentFrameTimeMs) { - if (object == NULL) + if (object == nullptr) return; unsigned long desiredTime = Clock::getFrameStartTimeMs() + currentFrameTimeMs + waitTimeMs; @@ -97,7 +97,7 @@ void AiCombatPulseQueue::alter(real time) TangibleObject * const object = (j->second)->first; - if (object != NULL && object->isInCombat()) + if (object != nullptr && object->isInCombat()) { NetworkId const & id = object->getNetworkId(); @@ -107,7 +107,7 @@ void AiCombatPulseQueue::alter(real time) GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(object); - if (gameScriptObject != NULL) + if (gameScriptObject != nullptr) { ScriptParams scriptParams; IGNORE_RETURN(gameScriptObject->trigAllScripts(Scripting::TRIG_AI_COMBAT_FRAME, scriptParams)); diff --git a/engine/server/library/serverGame/src/shared/ai/AiCreatureCombatProfile.cpp b/engine/server/library/serverGame/src/shared/ai/AiCreatureCombatProfile.cpp index cf2cb505..c27828d6 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiCreatureCombatProfile.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiCreatureCombatProfile.cpp @@ -136,9 +136,9 @@ void AiCreatureCombatProfileNamespace::loadCombatProfileTable(DataTable const & for (int i = 0; i < serverObjectCount; ++i) { ServerObject * const serverObject = ServerWorld::getObject(i); - CreatureObject * const creatureObject = (serverObject != NULL) ? serverObject->asCreatureObject() : NULL; + CreatureObject * const creatureObject = (serverObject != nullptr) ? serverObject->asCreatureObject() : nullptr; - if ( (creatureObject != NULL) + if ( (creatureObject != nullptr) && !creatureObject->isPlayerControlled()) { creatureObject->makeDead(NetworkId::cms_invalid, NetworkId::cms_invalid); @@ -228,7 +228,7 @@ void AiCreatureCombatProfileNamespace::grantActions(CreatureObject & owner, AiCr // ---------------------------------------------------------------------- AiCreatureCombatProfile::AiCreatureCombatProfile() - : m_profileId(NULL) + : m_profileId(nullptr) , m_singleUseActionList() , m_delayRepeatActionList() , m_instantRepeatActionList() @@ -247,7 +247,7 @@ void AiCreatureCombatProfile::install() bool const openIfNotFound = true; DataTable * const dataTable = DataTableManager::getTable(s_combatProfileTable, openIfNotFound); - if (dataTable != NULL) + if (dataTable != nullptr) { #ifdef _DEBUG DataTableManager::addReloadCallback(s_combatProfileTable, &loadCombatProfileTable); @@ -267,7 +267,7 @@ void AiCreatureCombatProfile::install() // ---------------------------------------------------------------------- AiCreatureCombatProfile const * AiCreatureCombatProfile::getCombatProfile(CrcString const & profileName) { - AiCreatureCombatProfile const * result = NULL; + AiCreatureCombatProfile const * result = nullptr; CombatProfileMap::const_iterator iterCombatProfileMap = s_combatProfileMap.find(PersistentCrcString(profileName)); if (iterCombatProfileMap != s_combatProfileMap.end()) diff --git a/engine/server/library/serverGame/src/shared/ai/AiCreatureData.cpp b/engine/server/library/serverGame/src/shared/ai/AiCreatureData.cpp index 034f9980..3d90a5f7 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiCreatureData.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiCreatureData.cpp @@ -46,7 +46,7 @@ namespace AiCreatureDataNamespace CreatureDataMap s_creatureDataMap; WeaponDataMap s_weaponDataMap; - AiCreatureData const * s_defaultCreatureData = NULL; + AiCreatureData const * s_defaultCreatureData = nullptr; int s_creatureErrorCount = 0; int s_weaponErrorCount = 0; @@ -154,7 +154,7 @@ void AiCreatureDataNamespace::verifySecondaryWeapon(CrcString const & creatureNa void AiCreatureDataNamespace::verifyPrimarySpecials(CrcString const & creatureName, CrcString & primarySpecials) { if ( !primarySpecials.isEmpty() - && (AiCreatureCombatProfile::getCombatProfile(primarySpecials) == NULL)) + && (AiCreatureCombatProfile::getCombatProfile(primarySpecials) == nullptr)) { ++s_creatureErrorCount; WARNING(true, ("AiCreatureData::verifyPrimarySpecials() Creature(%s) has invalid primary_weapon_specials(%s)", creatureName.getString(), primarySpecials.getString())); @@ -165,7 +165,7 @@ void AiCreatureDataNamespace::verifyPrimarySpecials(CrcString const & creatureNa void AiCreatureDataNamespace::verifySecondarySpecials(CrcString const & creatureName, CrcString & secondarySpecials) { if ( !secondarySpecials.isEmpty() - && (AiCreatureCombatProfile::getCombatProfile(secondarySpecials) == NULL)) + && (AiCreatureCombatProfile::getCombatProfile(secondarySpecials) == nullptr)) { ++s_creatureErrorCount; WARNING(true, ("AiCreatureData::verifySecondarySpecials() Creature(%s) has invalid secondary_weapon_specials(%s)", creatureName.getString(), secondarySpecials.getString())); @@ -320,7 +320,7 @@ void AiCreatureDataNamespace::loadWeaponColumn(WeaponList & weaponList, std::str // ---------------------------------------------------------------------- AiCreatureData::AiCreatureData() - : m_name(NULL) + : m_name(nullptr) , m_movementSpeedPercent(1.0f) , m_primaryWeapon() , m_secondaryWeapon() @@ -348,7 +348,7 @@ void AiCreatureData::install() bool const openIfNotFound = true; DataTable * const dataTable = DataTableManager::getTable(s_weaponDataTable, openIfNotFound); - if (dataTable != NULL) + if (dataTable != nullptr) { DataTableManager::addReloadCallback(s_weaponDataTable, &loadWeaponData); loadWeaponData(*dataTable); @@ -366,7 +366,7 @@ void AiCreatureData::install() bool const openIfNotFound = true; DataTable * const dataTable = DataTableManager::getTable(s_creaureDataTable, openIfNotFound); - if (dataTable != NULL) + if (dataTable != nullptr) { DataTableManager::addReloadCallback(s_creaureDataTable, &loadCreatureData); loadCreatureData(*dataTable); diff --git a/engine/server/library/serverGame/src/shared/ai/AiCreatureWeaponActions.cpp b/engine/server/library/serverGame/src/shared/ai/AiCreatureWeaponActions.cpp index 781bc2f1..4d5498f8 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiCreatureWeaponActions.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiCreatureWeaponActions.cpp @@ -58,7 +58,7 @@ AiCreatureWeaponActions::AiCreatureWeaponActions() : m_singleUseActionList() , m_delayRepeatActionList() , m_instantRepeatActionList() - , m_combatProfile(NULL) + , m_combatProfile(nullptr) { } @@ -81,7 +81,7 @@ void AiCreatureWeaponActions::setCombatProfile(CreatureObject & owner, AiCreatur // ---------------------------------------------------------------------- void AiCreatureWeaponActions::reset() { - if (m_combatProfile != NULL) + if (m_combatProfile != nullptr) { resetActionTimers(m_singleUseActionList, m_combatProfile->m_singleUseActionList); resetActionTimers(m_delayRepeatActionList, m_combatProfile->m_delayRepeatActionList); @@ -92,9 +92,9 @@ void AiCreatureWeaponActions::reset() // ---------------------------------------------------------------------- PersistentCrcString const & AiCreatureWeaponActions::getCombatAction() { - // If the combat profile is NULL, then the AI has no special actions assigned + // If the combat profile is nullptr, then the AI has no special actions assigned - if (m_combatProfile != NULL) + if (m_combatProfile != nullptr) { time_t const osTime = Os::getRealSystemTime(); diff --git a/engine/server/library/serverGame/src/shared/ai/AiMovementArchive.cpp b/engine/server/library/serverGame/src/shared/ai/AiMovementArchive.cpp index 723b8c7e..e1508bf4 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiMovementArchive.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiMovementArchive.cpp @@ -34,12 +34,12 @@ namespace Archive get(source, target.m_objectId); get(source, movementType); - AICreatureController * controller = NULL; + AICreatureController * controller = nullptr; Object * object = NetworkIdManager::getObjectById(target.getObjectId()); - if (object != NULL) + if (object != nullptr) controller = dynamic_cast(object->getController()); - if (controller == NULL) + if (controller == nullptr) { WARNING(true, ("AiMovementMessage Archive::get, got message to object %s that doesn't have an AICreatureController", target.getObjectId().getValueString().c_str())); target.m_movement = AiMovementBaseNullPtr; diff --git a/engine/server/library/serverGame/src/shared/ai/AiMovementBase.cpp b/engine/server/library/serverGame/src/shared/ai/AiMovementBase.cpp index dde28a05..79f1e119 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiMovementBase.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiMovementBase.cpp @@ -30,9 +30,9 @@ AiMovementBase::AiMovementBase( AICreatureController * controller ) : m_controller( controller ), - m_stateFunction( NULL ), + m_stateFunction( nullptr ), m_stateName(), - m_pendingFunction( NULL ), + m_pendingFunction( nullptr ), m_pendingName() { } @@ -41,9 +41,9 @@ AiMovementBase::AiMovementBase( AICreatureController * controller ) AiMovementBase::AiMovementBase( AICreatureController * controller, Archive::ReadIterator & source ) : m_controller( controller ), - m_stateFunction( NULL ), + m_stateFunction( nullptr ), m_stateName(), - m_pendingFunction( NULL ), + m_pendingFunction( nullptr ), m_pendingName() { // !!! @@ -177,7 +177,7 @@ void AiMovementBase::applyStateChange ( void ) m_stateFunction = m_pendingFunction; m_stateName = m_pendingName; - m_pendingFunction = NULL; + m_pendingFunction = nullptr; m_pendingName.clear(); } } @@ -249,49 +249,49 @@ char const * AiMovementBase::getMovementString(AiMovementType const aiMovementTy // ---------------------------------------------------------------------- AiMovementSwarm * AiMovementBase::asAiMovementSwarm() { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- AiMovementFace * AiMovementBase::asAiMovementFace() { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- AiMovementFlee * AiMovementBase::asAiMovementFlee() { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- AiMovementFollow * AiMovementBase::asAiMovementFollow() { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- AiMovementLoiter * AiMovementBase::asAiMovementLoiter() { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- AiMovementMove * AiMovementBase::asAiMovementMove() { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- AiMovementPatrol * AiMovementBase::asAiMovementPatrol() { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- AiMovementWander * AiMovementBase::asAiMovementWander() { - return NULL; + return nullptr; } // ====================================================================== diff --git a/engine/server/library/serverGame/src/shared/ai/AiMovementLoiter.cpp b/engine/server/library/serverGame/src/shared/ai/AiMovementLoiter.cpp index 8e4e5a2d..e8e0f5c4 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiMovementLoiter.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiMovementLoiter.cpp @@ -67,9 +67,9 @@ Vector AiMovementLoiterNamespace::getRandomLoiterPosition_p(Vector const anchorP bool AiMovementLoiterNamespace::isPositionOnFloor(Floor const * const floor, Vector const & position_p, float const radius, Vector & floorPosition_p) { bool result = false; - FloorMesh const * const floorMesh = (floor != NULL) ? floor->getFloorMesh() : NULL; + FloorMesh const * const floorMesh = (floor != nullptr) ? floor->getFloorMesh() : nullptr; - if (floorMesh != NULL) + if (floorMesh != nullptr) { // See if the circle fits entirely on the floor { @@ -199,7 +199,7 @@ AiMovementLoiter::AiMovementLoiter( AICreatureController * controller, Archive:: AiMovementLoiter::~AiMovementLoiter() { delete m_cachedAiLocations; - m_cachedAiLocations = NULL; + m_cachedAiLocations = nullptr; } // ---------------------------------------------------------------------- @@ -420,7 +420,7 @@ bool AiMovementLoiter::generateWaypoint() Floor const * const ownerFloor = CollisionWorld::getFloorStandingOn(*creatureOwner); - if (ownerFloor != NULL) + if (ownerFloor != nullptr) { // The owner is standing on a floor @@ -476,7 +476,7 @@ bool AiMovementLoiter::generateWaypoint() TerrainObject const * const terrainObject = TerrainObject::getConstInstance(); - if ( (terrainObject != NULL) + if ( (terrainObject != nullptr) && terrainObject->isPassable(randomPosition_p)) { // Snap the random position to the terrain @@ -518,7 +518,7 @@ bool AiMovementLoiter::generateWaypoint() { BaseExtent const * const extent = collisionProperty->getExtent_l(); - if (extent != NULL) + if (extent != nullptr) { Vector const begin_o(object.rotateTranslate_w2o(m_anchor.getPosition_p())); Vector const end_o(object.rotateTranslate_w2o(randomPosition_p)); @@ -580,7 +580,7 @@ void AiMovementLoiter::addDebug(AiDebugString & aiDebugString) AiMovementWaypoint::addDebug(aiDebugString); FormattedString<512> fs; - aiDebugString.addText(fs.sprintf("LOITER %s\n%s\ndist[%.0f...%.0f]\ndelay[%.1f...%.1f]\n", (m_anchor.getObject() != NULL) ? "TARGET" : "POSITION", m_stateName.c_str(), m_minDistance, m_maxDistance, m_minDelay, m_maxDelay), PackedRgb::solidCyan); + aiDebugString.addText(fs.sprintf("LOITER %s\n%s\ndist[%.0f...%.0f]\ndelay[%.1f...%.1f]\n", (m_anchor.getObject() != nullptr) ? "TARGET" : "POSITION", m_stateName.c_str(), m_minDistance, m_maxDistance, m_minDelay, m_maxDelay), PackedRgb::solidCyan); //if (m_bubbleCheckResult == BCR_invalid) //{ @@ -599,7 +599,7 @@ void AiMovementLoiter::addDebug(AiDebugString & aiDebugString) { Object const * const anchorObject = m_anchor.getObject(); - if (anchorObject != NULL) + if (anchorObject != nullptr) { // We are anchored to a moving target @@ -659,7 +659,7 @@ bool AiMovementLoiter::isAnchorValid() const { TangibleObject const * const tangibleObject = TangibleObject::asTangibleObject(m_anchor.getObject()); - if (tangibleObject != NULL) + if (tangibleObject != nullptr) { if (tangibleObject->isInCombat()) { diff --git a/engine/server/library/serverGame/src/shared/ai/AiMovementMove.cpp b/engine/server/library/serverGame/src/shared/ai/AiMovementMove.cpp index 9641e7e3..71b6b193 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiMovementMove.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiMovementMove.cpp @@ -85,7 +85,7 @@ AiMovementMove::AiMovementMove( AICreatureController * controller, Archive::Read AiMovementMove::~AiMovementMove() { delete m_pathBuilder; - m_pathBuilder = NULL; + m_pathBuilder = nullptr; } // ---------------------------------------------------------------------- @@ -151,7 +151,7 @@ void AiMovementMove::refresh( void ) m_target = target; m_targetName = targetName; - if (m_controller != NULL) + if (m_controller != nullptr) m_start = AiLocation(m_controller->getCreatureCell(), m_controller->getCreaturePosition_p()); CHANGE_STATE( AiMovementMove::stateWaiting ); } diff --git a/engine/server/library/serverGame/src/shared/ai/AiMovementPathFollow.cpp b/engine/server/library/serverGame/src/shared/ai/AiMovementPathFollow.cpp index 2105c898..34ab1e1f 100644 --- a/engine/server/library/serverGame/src/shared/ai/AiMovementPathFollow.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiMovementPathFollow.cpp @@ -73,7 +73,7 @@ AiMovementPathFollow::AiMovementPathFollow( AICreatureController * controller, A : AiMovementWaypoint( controller, source ), m_path( new AiPath() ) { - if (m_path != NULL) + if (m_path != nullptr) Archive::get(source, *m_path); } @@ -84,7 +84,7 @@ AiMovementPathFollow::~AiMovementPathFollow() clearPath(); delete m_path; - m_path = NULL; + m_path = nullptr; } // ---------------------------------------------------------------------- @@ -92,7 +92,7 @@ AiMovementPathFollow::~AiMovementPathFollow() void AiMovementPathFollow::pack( Archive::ByteStream & target ) const { AiMovementWaypoint::pack(target); - if (m_path != NULL) + if (m_path != nullptr) Archive::put(target, *m_path); else Archive::put(target, static_cast(0)); @@ -288,7 +288,7 @@ AiPath const * AiMovementPathFollow::getPath ( void ) const void AiMovementPathFollow::swapPath ( AiPath * newPath ) { - if(newPath == NULL) return; + if(newPath == nullptr) return; AiPath::iterator it; diff --git a/engine/server/library/serverGame/src/shared/ai/AiMovementPatrol.cpp b/engine/server/library/serverGame/src/shared/ai/AiMovementPatrol.cpp index 4ea6a593..c4c73b88 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiMovementPatrol.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiMovementPatrol.cpp @@ -60,7 +60,7 @@ AiMovementPatrol::AiMovementPatrol( AICreatureController * controller, std::vect m_patrolPointIndex(startPoint) { ServerObject * owner = safe_cast(controller->getOwner()); - if (owner != NULL) + if (owner != nullptr) { DEBUG_REPORT_LOG(ConfigServerGame::isAiLoggingEnabled(), ("AiMovementPatrol creating named path for %s\n", owner->getNetworkId().getValueString().c_str())); @@ -98,7 +98,7 @@ AiMovementPatrol::AiMovementPatrol( AICreatureController * controller, std::vect { const Unicode::String & pointName = *i; const CityPathNode * node = CityPathGraphManager::getNamedNodeFor(*owner, pointName); - if (node != NULL) + if (node != nullptr) { m_patrolPath.push_back(AiLocation(node->getSourceId())); } @@ -118,16 +118,16 @@ AiMovementPatrol::AiMovementPatrol( AICreatureController * controller, std::vect // try an find a node on the path that is a previous root node, or isn't // being used in any other path std::vector::iterator i; - const ServerObject * node = NULL; - const ServerObject * root = NULL; + const ServerObject * node = nullptr; + const ServerObject * root = nullptr; for (i = m_patrolPath.begin(); i != m_patrolPath.end(); ++i) { node = safe_cast(i->getObject()); - if (node != NULL) + if (node != nullptr) { if (node->isPatrolPathRoot()) { - if (root == NULL || !root->isPatrolPathRoot()) + if (root == nullptr || !root->isPatrolPathRoot()) { // if we already have a set up root node, use that root = node; @@ -135,18 +135,18 @@ AiMovementPatrol::AiMovementPatrol( AICreatureController * controller, std::vect else { // we've got two previous root nodes, we can't connect them - root = NULL; + root = nullptr; break; } } - else if (!node->isPatrolPathNode() && root == NULL) + else if (!node->isPatrolPathNode() && root == nullptr) { // found a free node root = node; } } } - if (root != NULL) + if (root != nullptr) { // set up the root node if (!root->isPatrolPathRoot()) @@ -156,7 +156,7 @@ AiMovementPatrol::AiMovementPatrol( AICreatureController * controller, std::vect for (i = m_patrolPath.begin(); i != m_patrolPath.end(); ++i) { node = safe_cast(i->getObject()); - if (node != NULL && node != root) + if (node != nullptr && node != root) const_cast(node)->setPatrolPathRoot(*root); } const_cast(root)->addPatrolPathingObject(*owner); @@ -167,7 +167,7 @@ AiMovementPatrol::AiMovementPatrol( AICreatureController * controller, std::vect for (i = m_patrolPath.begin(); i != m_patrolPath.end(); ++i) { node = safe_cast(i->getObject()); - if (node != NULL) + if (node != nullptr) nodes += node->getNetworkId().getValueString() + " "; } WARNING(true, ("AiMovementPatrol unable to find root node for path: %s", nodes.c_str())); @@ -266,15 +266,15 @@ void AiMovementPatrol::getDebugInfo ( std::string & outString ) const void AiMovementPatrol::endBehavior() { - if (!m_patrolPath.empty() && m_controller != NULL) + if (!m_patrolPath.empty() && m_controller != nullptr) { const ServerObject * owner = safe_cast(m_controller->getOwner()); - if (owner != NULL) + if (owner != nullptr) { for (std::vector::iterator i = m_patrolPath.begin(); i != m_patrolPath.end(); ++i) { const ServerObject * node = safe_cast(i->getObject()); - if (node != NULL && node->isPatrolPathRoot()) + if (node != nullptr && node->isPatrolPathRoot()) { const_cast(node)->removePatrolPathingObject(*owner); break; @@ -304,7 +304,7 @@ bool AiMovementPatrol::getHibernateOk() const if (!m_patrolPath.empty()) { const ServerObject * node = safe_cast(m_patrolPath.front().getObject()); - if (node != NULL) + if (node != nullptr) { return node->getPatrolPathObservers() == 0; } diff --git a/engine/server/library/serverGame/src/shared/ai/AiMovementSwarm.cpp b/engine/server/library/serverGame/src/shared/ai/AiMovementSwarm.cpp index 52a3e701..f9593a06 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiMovementSwarm.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiMovementSwarm.cpp @@ -104,10 +104,10 @@ void AiMovementSwarm::alter ( float time ) } // update the offset from our target we want to go to - if (m_target.getObject() != NULL) + if (m_target.getObject() != nullptr) { const CreatureObject * owner = m_controller->getCreature(); - if (owner != NULL) + if (owner != nullptr) { offsetMap::const_iterator found = s_offsetMap.find(CachedNetworkId(*owner)); if (found != s_offsetMap.end()) @@ -179,7 +179,7 @@ AiStateResult AiMovementSwarm::triggerWaiting() { // note: don't use the m_target position function, because it includes the offset position const Object * target = m_target.getObject(); - if (target != NULL) + if (target != nullptr) m_controller->turnToward(target->getParentCell(), target->getPosition_p()); return AiMovementFollow::triggerWaiting(); } @@ -196,7 +196,7 @@ void AiMovementSwarm::init() const CreatureObject * creatureOwner = m_controller->getCreature(); const CreatureObject * creatureTarget = CreatureObject::asCreatureObject(m_target.getObject()); - if (creatureOwner != NULL && creatureTarget != NULL) + if (creatureOwner != nullptr && creatureTarget != nullptr) { CreatureWatcher watchedCreature(creatureOwner); targetMap::iterator found = s_swarmMap.find(CachedNetworkId(*creatureTarget)); @@ -226,7 +226,7 @@ void AiMovementSwarm::cleanup() // note: using static_cast instead of safe_cast because the owner may be in the process of being destructed const CreatureObject * owner = static_cast(m_controller->getOwner()); const CreatureObject * target = static_cast(m_target.getObject()); - if (owner != NULL && target != NULL) + if (owner != nullptr && target != nullptr) { targetMap::iterator found = s_swarmMap.find(CachedNetworkId(*target)); if (found != s_swarmMap.end()) @@ -258,7 +258,7 @@ void AiMovementSwarm::computeGoals() for (targetMap::iterator i = s_swarmMap.begin(); i != s_swarmMap.end();) { const CreatureObject * target = CreatureObject::asCreatureObject((*i).first.getObject()); - if (target != NULL && !target->isDead()) + if (target != nullptr && !target->isDead()) { computeGoals(*target, (*i).second); if ((*i).second.empty()) @@ -294,16 +294,16 @@ void AiMovementSwarm::computeGoals(const CreatureObject & target, std::vectorgetController()); - if (controller != NULL) + if (controller != nullptr) swarmMovement = dynamic_cast(controller->getCurrentMovement()); } - if (mover == NULL || mover->isDead()) + if (mover == nullptr || mover->isDead()) { // dump the mover from our list --count; @@ -314,7 +314,7 @@ void AiMovementSwarm::computeGoals(const CreatureObject & target, std::vectorisDead()) + if (blocker == nullptr || blocker->isDead()) { continue; } @@ -361,7 +361,7 @@ void AiMovementSwarm::computeGoals(const CreatureObject & target, std::vectorasServerObject() != NULL) + if (o != nullptr && o->asServerObject() != nullptr) { // if the target is a player, don't hibernate if (o->asServerObject()->isPlayerControlled()) hibernate = false; // hibernate if who we're following is hibernating - else if (o->asServerObject()->asCreatureObject() != NULL) + else if (o->asServerObject()->asCreatureObject() != nullptr) hibernate = (safe_cast(o->getController()))->getHibernate(); } else @@ -114,7 +114,7 @@ static const AiMovementTarget * preventRecurse = NULL; // clean up recusion checkers if (preventRecurse == this) - preventRecurse = NULL; + preventRecurse = nullptr; --recursionCount; return hibernate; } diff --git a/engine/server/library/serverGame/src/shared/ai/AiMovementWanderInterior.cpp b/engine/server/library/serverGame/src/shared/ai/AiMovementWanderInterior.cpp index 24a4c66a..a5fe327d 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiMovementWanderInterior.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiMovementWanderInterior.cpp @@ -82,23 +82,23 @@ bool AiMovementWanderInterior::updateWaypoint ( void ) { CreatureObject const * creature = m_controller->getCreature(); - if(creature == NULL) return false; + if(creature == nullptr) return false; CellProperty const * cell = creature->getParentCell(); - if(cell == NULL) return false; + if(cell == nullptr) return false; Floor const * floor = cell->getFloor(); - if(floor == NULL) return false; + if(floor == nullptr) return false; FloorMesh const * floorMesh = floor->getFloorMesh(); - if(floorMesh == NULL) return false; + if(floorMesh == nullptr) return false; PathGraph const * graph = safe_cast(floorMesh->getPathGraph()); - if(graph == NULL) return false; + if(graph == nullptr) return false; // ---------- @@ -107,11 +107,11 @@ bool AiMovementWanderInterior::updateWaypoint ( void ) if(closestIndex == -2) { const CellObject *cellObject = dynamic_cast(&cell->getOwner()); - const BuildingObject *building = (cellObject ? cellObject->getOwnerBuilding() : NULL); + const BuildingObject *building = (cellObject ? cellObject->getOwnerBuilding() : nullptr); Vector creaturePosition = creature->getPosition_w(); LOG("building-data-error",("Building id=%s has no path data but creature id=%s at (x=%.2f,y=%.2f,z=%.2f) requires it for wandering, stopping behavior.", - (building ? building->getNetworkId().getValueString().c_str() : ""), + (building ? building->getNetworkId().getValueString().c_str() : ""), creature->getNetworkId().getValueString().c_str(), creaturePosition.x, creaturePosition.y, @@ -132,7 +132,7 @@ bool AiMovementWanderInterior::updateWaypoint ( void ) { PathNode const * closestNode = graph->getNode(closestIndex); - if(closestNode != NULL) + if(closestNode != nullptr) { m_target = AiLocation(m_controller->getCreatureCell(),closestNode->getPosition_p()); diff --git a/engine/server/library/serverGame/src/shared/ai/AiMovementWaypoint.cpp b/engine/server/library/serverGame/src/shared/ai/AiMovementWaypoint.cpp index 3b2b123e..c92d3100 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiMovementWaypoint.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiMovementWaypoint.cpp @@ -34,7 +34,7 @@ float computeMovementModifier (CreatureObject * const object) { if (!object) { - DEBUG_FATAL(true, ("object is NULL.")); + DEBUG_FATAL(true, ("object is nullptr.")); return 0.0f; } @@ -81,7 +81,7 @@ float computeMovementModifier (CreatureObject * const object) // if the creature has a slope effect property, see if it has a greater // (more negative) effect on the creature than the terrain const Property * property = object->getProperty(SlopeEffectProperty::getClassPropertyId()); - if (property != NULL) + if (property != nullptr) { // note we use the creature's base speed modifier, not the one modified by skills // (although for ai they're probably the same) diff --git a/engine/server/library/serverGame/src/shared/ai/AiTargetingSystem.cpp b/engine/server/library/serverGame/src/shared/ai/AiTargetingSystem.cpp index 2afac7bc..050263d3 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiTargetingSystem.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiTargetingSystem.cpp @@ -94,7 +94,7 @@ bool AiTargetingSystem::canAttackTarget(TangibleObject const * target) { bool result = false; - if (target != NULL) + if (target != nullptr) { if ( (m_owner.getDistanceBetweenCollisionSpheres_w(*target) <= ConfigServerGame::getMaxCombatRange()) && m_owner.checkLOSTo(*target)) diff --git a/engine/server/library/serverGame/src/shared/ai/Formation.cpp b/engine/server/library/serverGame/src/shared/ai/Formation.cpp index 713d9b00..415989a2 100755 --- a/engine/server/library/serverGame/src/shared/ai/Formation.cpp +++ b/engine/server/library/serverGame/src/shared/ai/Formation.cpp @@ -128,8 +128,8 @@ void Formation::build(Squad & squad) DEBUG_FATAL(squad.isEmpty(), ("Building a formation on an empty squad.")); Object const * const leaderObject = squad.getLeader().getObject(); - CollisionProperty const * const leaderCollisionProperty = (leaderObject != NULL) ? leaderObject->getCollisionProperty() : NULL; - float const leaderRadius = (leaderCollisionProperty != NULL) ? (leaderCollisionProperty->getBoundingSphere_l().getRadius() * 2.0f) : 1.0f; + CollisionProperty const * const leaderCollisionProperty = (leaderObject != nullptr) ? leaderObject->getCollisionProperty() : nullptr; + float const leaderRadius = (leaderCollisionProperty != nullptr) ? (leaderCollisionProperty->getBoundingSphere_l().getRadius() * 2.0f) : 1.0f; int slotIndex = 0; Squad::UnitMap const & unitSet = squad.getUnitMap(); diff --git a/engine/server/library/serverGame/src/shared/ai/HateList.cpp b/engine/server/library/serverGame/src/shared/ai/HateList.cpp index d57fc5cb..496fb2b9 100755 --- a/engine/server/library/serverGame/src/shared/ai/HateList.cpp +++ b/engine/server/library/serverGame/src/shared/ai/HateList.cpp @@ -41,8 +41,8 @@ // ---------------------------------------------------------------------- HateList::HateList() - : m_owner(NULL) - , m_playerObject(NULL) + : m_owner(nullptr) + , m_playerObject(nullptr) , m_hateList() , m_target(CachedNetworkId::cms_cachedInvalid) , m_maxHate(0.0f) @@ -56,8 +56,8 @@ HateList::HateList() HateList::~HateList() { clear(); - m_owner = NULL; - m_playerObject = NULL; + m_owner = nullptr; + m_playerObject = nullptr; } // ---------------------------------------------------------------------- @@ -119,7 +119,7 @@ bool HateList::addHate(NetworkId const & target, float const hate) // If a target AI has a master, the target and the master needs to be added to the hate list (ie. pets should cause their master to gain hate) { CreatureObject const * const targetCreatureObject = CreatureObject::asCreatureObject(targetObject); - NetworkId const & masterId = (targetCreatureObject != NULL) ? targetCreatureObject->getMasterId() : NetworkId::cms_invalid; + NetworkId const & masterId = (targetCreatureObject != nullptr) ? targetCreatureObject->getMasterId() : NetworkId::cms_invalid; if (masterId != NetworkId::cms_invalid) { @@ -274,7 +274,7 @@ bool HateList::removeTarget(NetworkId const & target) { AggroListProperty * const aggroList = AggroListProperty::getAggroListProperty(*m_owner); - if (aggroList != NULL) + if (aggroList != nullptr) { aggroList->addTarget(target); } @@ -301,7 +301,7 @@ bool HateList::isValidTarget(Object * const target) bool valid = true; TangibleObject * const targetTangibleObject = TangibleObject::asTangibleObject(target); - if (targetTangibleObject == NULL) + if (targetTangibleObject == nullptr) { LOGC(AiLogManager::isLogging(m_owner->getNetworkId()), "debug_ai", ("HateList::isValidTarget() owner(%s:%s) TARGET IS NOT A TANGIBLEOBJECT", m_owner->getNetworkId().getValueString().c_str(), FileNameUtils::get(m_owner->getDebugName(), FileNameUtils::fileName).c_str())); valid = false; @@ -334,7 +334,7 @@ bool HateList::isValidTarget(Object * const target) { CreatureObject const * const targetCreatureObject = targetTangibleObject->asCreatureObject(); - if (targetCreatureObject != NULL) + if (targetCreatureObject != nullptr) { if (targetTangibleObject->isDisabled()) { @@ -355,7 +355,7 @@ bool HateList::isValidTarget(Object * const target) { AICreatureController const * const targetAiCreatureController = AICreatureController::asAiCreatureController(targetCreatureObject->getController()); - if ( (targetAiCreatureController != NULL) + if ( (targetAiCreatureController != nullptr) && targetAiCreatureController->isRetreating()) { LOGC(AiLogManager::isLogging(m_owner->getNetworkId()), "debug_ai", ("HateList::isValidTarget() owner(%s:%s) TARGET IS RETREATING", m_owner->getNetworkId().getValueString().c_str(), FileNameUtils::get(m_owner->getDebugName(), FileNameUtils::fileName).c_str())); @@ -370,7 +370,7 @@ bool HateList::isValidTarget(Object * const target) // themselves towards the player so that they and the player // enter combat correctly. { - if ( (m_owner->asCreatureObject() != NULL) + if ( (m_owner->asCreatureObject() != nullptr) && !Pvp::canAttack(*m_owner, *targetTangibleObject)) { LOGC(AiLogManager::isLogging(m_owner->getNetworkId()), "debug_ai", ("HateList::isValidTarget() owner(%s:%s) PVP CAN'T ATTACK", m_owner->getNetworkId().getValueString().c_str(), FileNameUtils::get(m_owner->getDebugName(), FileNameUtils::fileName).c_str())); @@ -393,7 +393,7 @@ CachedNetworkId const & HateList::getTarget() const if ( (m_target.get() == CachedNetworkId::cms_cachedInvalid) && !isEmpty()) { - WARNING(true, ("HateList::getTarget() owner(%s) m_hateList.size(%u) m_target is NULL but the HateList is not empty.", m_owner->getDebugInformation().c_str(), m_hateList.size())); + WARNING(true, ("HateList::getTarget() owner(%s) m_hateList.size(%u) m_target is nullptr but the HateList is not empty.", m_owner->getDebugInformation().c_str(), m_hateList.size())); } #endif // _DEBUG @@ -458,7 +458,7 @@ void HateList::findNewTarget() for (; iterHateList != m_hateList.end(); ++iterHateList) { - if (iterHateList->first.getObject() == NULL) + if (iterHateList->first.getObject() == nullptr) { // This target will be removed in the next alter call continue; @@ -510,11 +510,11 @@ void HateList::setTarget(CachedNetworkId const & target, float const hate) #ifdef _DEBUG // We should only have tangible objects in our target list - if (m_target.get().getObject() != NULL) + if (m_target.get().getObject() != nullptr) { TangibleObject const * const targetTangibleObject = TangibleObject::asTangibleObject(m_target.get().getObject()->asServerObject()); - if (targetTangibleObject == NULL) + if (targetTangibleObject == nullptr) { WARNING(true, ("HateList::setTarget() owner(%s) How did we get a target(%s) that is not a TangibleObject", m_owner->getDebugInformation().c_str(), m_target.get().getObject()->getDebugInformation().c_str())); } @@ -559,7 +559,7 @@ void HateList::triggerTargetChanged(NetworkId const & target) { GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(m_owner); - if (gameScriptObject != NULL) + if (gameScriptObject != nullptr) { LOGC(AiLogManager::isLogging(m_owner->getNetworkId()), "debug_ai", ("HateList::triggerTargetChanged() owner(%s:%s) target(%s)", m_owner->getNetworkId().getValueString().c_str(), FileNameUtils::get(m_owner->getDebugName(), FileNameUtils::fileName).c_str(), target.getValueString().c_str())); @@ -578,7 +578,7 @@ void HateList::triggerTargetAdded(NetworkId const & target) { GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(m_owner); - if (gameScriptObject != NULL) + if (gameScriptObject != nullptr) { LOGC(AiLogManager::isLogging(m_owner->getNetworkId()), "debug_ai", ("HateList::triggerTargetAdded() owner(%s:%s) target(%s)", m_owner->getNetworkId().getValueString().c_str(), FileNameUtils::get(m_owner->getDebugName(), FileNameUtils::fileName).c_str(), target.getValueString().c_str())); @@ -597,7 +597,7 @@ void HateList::triggerTargetRemoved(NetworkId const & target) { GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(m_owner); - if (gameScriptObject != NULL) + if (gameScriptObject != nullptr) { LOGC(AiLogManager::isLogging(m_owner->getNetworkId()), "debug_ai", ("HateList::triggerTargetRemoved() owner(%s:%s) target(%s)", m_owner->getNetworkId().getValueString().c_str(), FileNameUtils::get(m_owner->getDebugName(), FileNameUtils::fileName).c_str(), target.getValueString().c_str())); @@ -628,7 +628,7 @@ int HateList::getAutoExpireTargetDuration() const bool HateList::isOwnerValid() const { CreatureObject const * const ownerCreature = CreatureObject::asCreatureObject(m_owner); - bool const ownerIncapacitated = (ownerCreature != NULL) ? ownerCreature->isIncapacitated() : false; + bool const ownerIncapacitated = (ownerCreature != nullptr) ? ownerCreature->isIncapacitated() : false; if (ownerIncapacitated) { @@ -636,7 +636,7 @@ bool HateList::isOwnerValid() const return false; } - bool const ownerDead = (ownerCreature != NULL) ? ownerCreature->isDead() : false; + bool const ownerDead = (ownerCreature != nullptr) ? ownerCreature->isDead() : false; if (ownerDead) { @@ -644,7 +644,7 @@ bool HateList::isOwnerValid() const return false; } - bool const ownerDisabled = (ownerCreature != NULL) ? ownerCreature->isDisabled() : false; + bool const ownerDisabled = (ownerCreature != nullptr) ? ownerCreature->isDisabled() : false; if (ownerDisabled) { @@ -653,7 +653,7 @@ bool HateList::isOwnerValid() const } AICreatureController const * const ownerAiCreatureController = AICreatureController::asAiCreatureController(m_owner->getController()); - const bool ownerRetreating = (ownerAiCreatureController != NULL) ? ownerAiCreatureController->isRetreating() : false; + const bool ownerRetreating = (ownerAiCreatureController != nullptr) ? ownerAiCreatureController->isRetreating() : false; if (ownerRetreating) { @@ -752,11 +752,11 @@ void HateList::forceHateTarget(const NetworkId &target) #ifdef _DEBUG // We should only have tangible objects in our target list - if (m_target.get().getObject() != NULL) + if (m_target.get().getObject() != nullptr) { TangibleObject const * const targetTangibleObject = TangibleObject::asTangibleObject(m_target.get().getObject()->asServerObject()); - if (targetTangibleObject == NULL) + if (targetTangibleObject == nullptr) { WARNING(true, ("HateList::setTarget() owner(%s) How did we get a target(%s) that is not a TangibleObject", m_owner->getDebugInformation().c_str(), m_target.get().getObject()->getDebugInformation().c_str())); } diff --git a/engine/server/library/serverGame/src/shared/ai/HateList.h b/engine/server/library/serverGame/src/shared/ai/HateList.h index c4f1b761..38a3a685 100755 --- a/engine/server/library/serverGame/src/shared/ai/HateList.h +++ b/engine/server/library/serverGame/src/shared/ai/HateList.h @@ -99,7 +99,7 @@ private: inline bool HateList::isOwnerPlayer() const { - return (m_playerObject != NULL); + return (m_playerObject != nullptr); } // ====================================================================== diff --git a/engine/server/library/serverGame/src/shared/ai/Squad.cpp b/engine/server/library/serverGame/src/shared/ai/Squad.cpp index caced74f..b4a23b20 100755 --- a/engine/server/library/serverGame/src/shared/ai/Squad.cpp +++ b/engine/server/library/serverGame/src/shared/ai/Squad.cpp @@ -380,7 +380,7 @@ void Squad::buildFormation() { NetworkId const & unit = iterUnitMap->first; PersistentCrcString const * unitName = iterUnitMap->second; - DEBUG_FATAL((unitName == NULL), ("The unit should have a non-null name.")); + DEBUG_FATAL((unitName == nullptr), ("The unit should have a non-nullptr name.")); if (unit == m_leader) { @@ -401,7 +401,7 @@ void Squad::buildFormation() #ifdef DEBUG Object * const unitObject = NetworkIdManager::getObjectById(unit); DEBUG_WARNING(true, ("className(%s) Unable to find the ship(%s) [%s] in the formation priority list.", - getClassName(), unitName->getString(), unitObject ? unitObject->getDebugInformation().c_str() : "NULL")); + getClassName(), unitName->getString(), unitObject ? unitObject->getDebugInformation().c_str() : "nullptr")); #endif } @@ -463,7 +463,7 @@ void Squad::calculateSquadPosition_w() Object * const object = NetworkIdManager::getObjectById(unit); - if (object != NULL) + if (object != nullptr) { m_squadPosition_w += object->getPosition_w(); } diff --git a/engine/server/library/serverGame/src/shared/behavior/AiCreatureStateArchive.cpp b/engine/server/library/serverGame/src/shared/behavior/AiCreatureStateArchive.cpp index 08bba97e..b6c5690b 100755 --- a/engine/server/library/serverGame/src/shared/behavior/AiCreatureStateArchive.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/AiCreatureStateArchive.cpp @@ -28,15 +28,15 @@ namespace Archive #ifdef _DEBUG Object * const object = NetworkIdManager::getObjectById(target.m_networkId); - if (object == NULL) + if (object == nullptr) { WARNING(true, ("AiCreatureStateArchive::get() Unable to resolve networkId(%s) to an Object", target.m_networkId.getValueString().c_str())); return; } - AICreatureController * const controller = (object != NULL) ? AICreatureController::asAiCreatureController(object->getController()) : NULL; + AICreatureController * const controller = (object != nullptr) ? AICreatureController::asAiCreatureController(object->getController()) : nullptr; - if (controller == NULL) + if (controller == nullptr) { WARNING(true, ("AiCreatureStateArchive::get() Message to object(%s) that does not have an AICreatureController", object->getDebugInformation().c_str())); return; diff --git a/engine/server/library/serverGame/src/shared/behavior/AiLocation.cpp b/engine/server/library/serverGame/src/shared/behavior/AiLocation.cpp index 885657b9..d73f1f43 100755 --- a/engine/server/library/serverGame/src/shared/behavior/AiLocation.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/AiLocation.cpp @@ -43,9 +43,9 @@ namespace AiLocationArchive AiLocation::AiLocation ( void ) : m_valid(false), m_attached(false), - m_object(NULL), + m_object(nullptr), m_objectId(), - m_cellObject(NULL), + m_cellObject(nullptr), m_position_p(Vector::zero), m_position_w(Vector::zero), m_radius(0.0f), @@ -60,9 +60,9 @@ AiLocation::AiLocation ( void ) AiLocation::AiLocation ( CellProperty const * cell, Vector const & position, float radius ) : m_valid(true), m_attached(false), - m_object(NULL), + m_object(nullptr), m_objectId(), - m_cellObject(cell ? &cell->getOwner() : NULL), + m_cellObject(cell ? &cell->getOwner() : nullptr), m_position_p(position), m_position_w(CollisionUtils::transformToWorld(cell,position)), m_radius(radius), @@ -78,9 +78,9 @@ AiLocation::AiLocation ( CellProperty const * cell, Vector const & position, flo AiLocation::AiLocation ( NetworkId const & cellId, Vector const & position, float radius ) : m_valid(true), m_attached(false), - m_object(NULL), + m_object(nullptr), m_objectId(), - m_cellObject(NULL), + m_cellObject(nullptr), m_position_p(position), m_position_w(position), m_radius(radius), @@ -110,9 +110,9 @@ AiLocation::AiLocation ( NetworkId const & cellId, Vector const & position, floa AiLocation::AiLocation ( Object const * object ) : m_valid(true), m_attached(true), - m_object(NULL), + m_object(nullptr), m_objectId(), - m_cellObject(NULL), + m_cellObject(nullptr), m_position_p(Vector::zero), m_position_w(Vector::zero), m_radius(0.0f), @@ -129,9 +129,9 @@ AiLocation::AiLocation ( Object const * object ) AiLocation::AiLocation ( NetworkId const & objectId ) : m_valid(true), m_attached(true), - m_object(NULL), + m_object(nullptr), m_objectId(), - m_cellObject(NULL), + m_cellObject(nullptr), m_position_p(Vector::zero), m_position_w(Vector::zero), m_radius(0.0f), @@ -148,9 +148,9 @@ AiLocation::AiLocation ( NetworkId const & objectId ) AiLocation::AiLocation ( Object const * object, Vector const & offset, bool relativeOffset ) : m_valid(true), m_attached(true), - m_object(NULL), + m_object(nullptr), m_objectId(), - m_cellObject(NULL), + m_cellObject(nullptr), m_position_p(Vector::zero), m_position_w(Vector::zero), m_radius(0.0f), @@ -167,9 +167,9 @@ AiLocation::AiLocation ( Object const * object, Vector const & offset, bool rela AiLocation::AiLocation ( NetworkId const & objectId, Vector const & offset, bool relativeOffset ) : m_valid(true), m_attached(true), - m_object(NULL), + m_object(nullptr), m_objectId(), - m_cellObject(NULL), + m_cellObject(nullptr), m_position_p(Vector::zero), m_position_w(Vector::zero), m_radius(0.0f), @@ -365,7 +365,7 @@ void AiLocation::setObject ( Object const * object ) { if(m_attached) { - if (object == NULL) + if (object == nullptr) { clear(); return; @@ -385,7 +385,7 @@ void AiLocation::setObject ( Object const * object ) void AiLocation::detach ( void ) { - m_object = NULL; + m_object = nullptr; m_objectId = NetworkId::cms_invalid; m_attached = false; } @@ -394,7 +394,7 @@ void AiLocation::detach ( void ) CellProperty const * AiLocation::getCell ( void ) const { - return m_cellObject ? m_cellObject->getCellProperty() : NULL; + return m_cellObject ? m_cellObject->getCellProperty() : nullptr; } // ---------- @@ -424,7 +424,7 @@ bool AiLocation::hasChanged ( void ) const Vector AiLocation::getPosition_p ( void ) const { - if(m_cellObject.getPointer() == NULL) + if(m_cellObject.getPointer() == nullptr) { WARNING(ConfigServerGame::getReportAiWarnings(),("AiLocation::getPosition_p - Locations's parent cell has disappeared\n")); @@ -572,8 +572,8 @@ void AiLocation::clear ( void ) m_valid = false; m_attached = false; - m_object = NULL; - m_cellObject = NULL; + m_object = nullptr; + m_cellObject = nullptr; m_position_p = Vector::zero; m_radius = 0.0f; m_offset_p = Vector::zero; @@ -585,7 +585,7 @@ void AiLocation::clear ( void ) bool AiLocation::isInWorldCell ( void ) const { - return isValid() && ( (getCell() == NULL) || (getCell() == CellProperty::getWorldCellProperty()) ); + return isValid() && ( (getCell() == nullptr) || (getCell() == CellProperty::getWorldCellProperty()) ); } @@ -599,7 +599,7 @@ bool AiLocation::validate ( void ) const TerrainObject * terrain = TerrainObject::getInstance(); - if(terrain == NULL) return true; + if(terrain == nullptr) return true; float w = terrain->getMapWidthInMeters() / 2.0f; diff --git a/engine/server/library/serverGame/src/shared/behavior/AiShipAttackTargetList.cpp b/engine/server/library/serverGame/src/shared/behavior/AiShipAttackTargetList.cpp index 08958488..9af5e0c8 100755 --- a/engine/server/library/serverGame/src/shared/behavior/AiShipAttackTargetList.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/AiShipAttackTargetList.cpp @@ -159,7 +159,7 @@ void AiShipAttackTargetList::add(ShipObject & unit, float const damage) AiShipController * const ownerAiShipController = AiShipController::asAiShipController(m_owner->getController()); - if (ownerAiShipController != NULL) + if (ownerAiShipController != nullptr) { if (!ownerAiShipController->isValidTarget(unit)) { @@ -204,7 +204,7 @@ void AiShipAttackTargetList::add(ShipObject & unit, float const damage) ShipController * const attackingUnitShipController = unit.getController()->asShipController(); - if (attackingUnitShipController != NULL) + if (attackingUnitShipController != nullptr) { attackingUnitShipController->addAiTargetingMe(m_owner->getNetworkId()); } @@ -217,7 +217,7 @@ void AiShipAttackTargetList::add(ShipObject & unit, float const damage) // ---------------------------------------------------------------------- bool AiShipAttackTargetList::remove(NetworkId const & unit, bool const inDestructorHack) { - DEBUG_FATAL((unit == NetworkId::cms_invalid), ("Removing a NULL unit")); + DEBUG_FATAL((unit == NetworkId::cms_invalid), ("Removing a nullptr unit")); bool result = false; @@ -238,11 +238,11 @@ bool AiShipAttackTargetList::remove(NetworkId const & unit, bool const inDestruc // Tell this unit that we are no longer targeting it - if (object != NULL) + if (object != nullptr) { ShipController * const shipController = object->getController()->asShipController(); - if (shipController != NULL) + if (shipController != nullptr) { shipController->removeAiTargetingMe(m_owner->getNetworkId()); } @@ -398,12 +398,12 @@ void AiShipAttackTargetList::findNewPrimaryTarget() // We should only have ship objects in our target list - if (m_primaryTarget.getObject() != NULL) + if (m_primaryTarget.getObject() != nullptr) { ServerObject * const targetServerObject = m_primaryTarget.getObject()->asServerObject(); - ShipObject * const targetShipObject = (targetServerObject != NULL) ? targetServerObject->asShipObject() : NULL; + ShipObject * const targetShipObject = (targetServerObject != nullptr) ? targetServerObject->asShipObject() : nullptr; - if (targetShipObject == NULL) + if (targetShipObject == nullptr) { DEBUG_WARNING(true, ("debug_ai: AiShipAttackTargetList::findNewPrimaryTarget() ERROR: How did we get a target that is not a ShipObject (%s)", m_primaryTarget.getObject()->getDebugInformation().c_str())); } @@ -444,7 +444,7 @@ void AiShipAttackTargetList::verify() AiShipController * const ownerAiShipController = AiShipController::asAiShipController(m_owner->getController()); - if (ownerAiShipController != NULL) + if (ownerAiShipController != nullptr) { if (ownerAiShipController->hasExclusiveAggros()) { @@ -457,9 +457,9 @@ void AiShipAttackTargetList::verify() for (; iterTargetList != m_targetList->end(); ++iterTargetList) { ShipObject * const unitShipObject = ShipObject::asShipObject(iterTargetList->first.getObject()); - CreatureObject const * const unitPilot = (unitShipObject != NULL) ? unitShipObject->getPilot() : NULL; + CreatureObject const * const unitPilot = (unitShipObject != nullptr) ? unitShipObject->getPilot() : nullptr; - if ( (unitPilot == NULL) + if ( (unitPilot == nullptr) || !ownerAiShipController->isExclusiveAggro(*unitPilot)) { s_purgeList.push_back(unitShipObject->getNetworkId()); diff --git a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackBomber.cpp b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackBomber.cpp index 239342d3..58e90c58 100755 --- a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackBomber.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackBomber.cpp @@ -56,7 +56,7 @@ AiShipBehaviorAttackBomber::AiShipBehaviorAttackBomber(AiShipController & aiShip m_evadeChangeDirectionTimer(0.5f), m_missilesFired(0) { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackBomber::AiShipBehaviorAttackBomber() unit(%s)", (aiShipController.getOwner() != NULL) ? aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner")); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackBomber::AiShipBehaviorAttackBomber() unit(%s)", (aiShipController.getOwner() != nullptr) ? aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner")); } // ---------------------------------------------------------------------- @@ -73,7 +73,7 @@ AiShipBehaviorAttackBomber::AiShipBehaviorAttackBomber(AiShipBehaviorAttack cons m_evadeChangeDirectionTimer(0.5f), m_missilesFired(0) { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackBomber::AiShipBehaviorAttackBomber(AiShipBehaviorAttack &) unit(%s)", (m_aiShipController.getOwner() != NULL) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner")); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackBomber::AiShipBehaviorAttackBomber(AiShipBehaviorAttack &) unit(%s)", (m_aiShipController.getOwner() != nullptr) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner")); } // ---------------------------------------------------------------------- @@ -293,7 +293,7 @@ ShipObject const * AiShipBehaviorAttackBomber::getTargetCapitalShip() const return targetShipObject; } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackCapitalShip.cpp b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackCapitalShip.cpp index d771b837..a1fe30da 100755 --- a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackCapitalShip.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackCapitalShip.cpp @@ -19,7 +19,7 @@ AiShipBehaviorAttackCapitalShip::AiShipBehaviorAttackCapitalShip(AiShipController & aiShipController) : AiShipBehaviorAttack(aiShipController) { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackCapitalShip::AiShipBehaviorAttackCapitalShip() unit(%s)", (m_aiShipController.getOwner() != NULL) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner")); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackCapitalShip::AiShipBehaviorAttackCapitalShip() unit(%s)", (m_aiShipController.getOwner() != nullptr) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner")); } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackFighter.cpp b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackFighter.cpp index 166eda11..d43510a4 100755 --- a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackFighter.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackFighter.cpp @@ -145,7 +145,7 @@ Vector const AiShipBehaviorAttackFighter::calculateEvadePositionWithinLeashDista AiShipBehaviorAttackFighter::AiShipBehaviorAttackFighter(AiShipController & aiShipController) : AiShipBehaviorAttack(aiShipController) - , m_currentManeuver(NULL) + , m_currentManeuver(nullptr) , m_timeDelta(0.0f) , m_projectileTimer() , m_missileLockOnTimer() @@ -165,7 +165,7 @@ AiShipBehaviorAttackFighter::AiShipBehaviorAttackFighter(AiShipController & aiSh , m_shotErrorPosition_l() , m_nextShotPosition_w() { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackFighter::AiShipBehaviorAttackFighter() unit(%s)", (aiShipController.getOwner() != NULL) ? aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner")); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackFighter::AiShipBehaviorAttackFighter() unit(%s)", (aiShipController.getOwner() != nullptr) ? aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner")); initializeTimers(); calculateEvadeHealthPercent(); calculateNextProjectileShotPerfect(); @@ -178,7 +178,7 @@ AiShipBehaviorAttackFighter::AiShipBehaviorAttackFighter(AiShipController & aiSh AiShipBehaviorAttackFighter::AiShipBehaviorAttackFighter(AiShipBehaviorAttack const & sourceBehavior) : AiShipBehaviorAttack(sourceBehavior) - , m_currentManeuver(NULL) + , m_currentManeuver(nullptr) , m_timeDelta(0.0f) , m_projectileTimer() , m_missileLockOnTimer() @@ -198,7 +198,7 @@ AiShipBehaviorAttackFighter::AiShipBehaviorAttackFighter(AiShipBehaviorAttack co , m_shotErrorPosition_l() , m_nextShotPosition_w() { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackFighter::AiShipBehaviorAttackFighter() unit(%s)", (getAiShipController().getOwner() != NULL) ? getAiShipController().getOwner()->getNetworkId().getValueString().c_str() : "NULL owner")); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackFighter::AiShipBehaviorAttackFighter() unit(%s)", (getAiShipController().getOwner() != nullptr) ? getAiShipController().getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner")); initializeTimers(); calculateEvadeHealthPercent(); calculateNextProjectileShotPerfect(); @@ -214,7 +214,7 @@ AiShipBehaviorAttackFighter::~AiShipBehaviorAttackFighter() delete m_targetInfo; delete m_currentManeuver; - m_currentManeuver = NULL; + m_currentManeuver = nullptr; } // ---------------------------------------------------------------------- @@ -265,7 +265,7 @@ void AiShipBehaviorAttackFighter::alterManeuver() } else { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackFighter::alterManeuver() owner(%s) Why does this ship in the attack state with a NULL attack target?", getAiShipController().getOwner()->getNetworkId().getValueString().c_str())); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorAttackFighter::alterManeuver() owner(%s) Why does this ship in the attack state with a nullptr attack target?", getAiShipController().getOwner()->getNetworkId().getValueString().c_str())); } if (overallHealthPercent > m_lastEvadeHealthPercent) @@ -347,7 +347,7 @@ void AiShipBehaviorAttackFighter::alterWeapons() if (!targetShipObject) { - DEBUG_WARNING(true, ("debug_ai: unit(%s) ERROR: Why is the primary attack target NULL?", getAiShipController().getShipOwner()->getDebugInformation().c_str())); + DEBUG_WARNING(true, ("debug_ai: unit(%s) ERROR: Why is the primary attack target nullptr?", getAiShipController().getShipOwner()->getDebugInformation().c_str())); return; } @@ -584,7 +584,7 @@ void AiShipBehaviorAttackFighter::alterTargetInformation() ShipObject & ownerShipObject = *NON_NULL(getAiShipController().getShipOwner()); ShipObject const * const targetShipObject = getAiShipController().getPrimaryAttackTargetShipObject(); - if (targetShipObject != NULL) + if (targetShipObject != nullptr) { //-- Set pilot data here. AiShipPilotData const * pilotData = NON_NULL(getAiShipController().getPilotData()); @@ -600,7 +600,7 @@ void AiShipBehaviorAttackFighter::alterTargetInformation() CreatureObject const * const targetPilot = targetShipObject->getPilot(); - m_targetInfo->m_playerControlled = (targetPilot != NULL) ? targetPilot->isPlayerControlled() : false; + m_targetInfo->m_playerControlled = (targetPilot != nullptr) ? targetPilot->isPlayerControlled() : false; // Cached target info. bool const includeMissiles = true; @@ -707,7 +707,7 @@ void AiShipBehaviorAttackFighter::alterTargetInformation() } else { - DEBUG_WARNING(true, ("debug_ai: unit(%s) ERROR: The primary attack target is NULL.", ownerShipObject.getDebugInformation().c_str())); + DEBUG_WARNING(true, ("debug_ai: unit(%s) ERROR: The primary attack target is nullptr.", ownerShipObject.getDebugInformation().c_str())); } } @@ -956,7 +956,7 @@ void AiShipBehaviorAttackFighter::calculateNextShotPosition_w() if (!targetShipObject) { - DEBUG_WARNING(true, ("debug_ai: unit(%s) ERROR: Why is the primary attack target NULL?", getAiShipController().getShipOwner()->getDebugInformation().c_str())); + DEBUG_WARNING(true, ("debug_ai: unit(%s) ERROR: Why is the primary attack target nullptr?", getAiShipController().getShipOwner()->getDebugInformation().c_str())); return; } @@ -1014,7 +1014,7 @@ void AiShipBehaviorAttackFighter::addDebug(AiDebugString & aiDebugString) AiShipBehaviorAttackFighter::Maneuver::Path const * path = m_currentManeuver->getCurrentPath(); char pathSizeText[256]; - if (path != NULL) + if (path != nullptr) { snprintf(pathSizeText, sizeof(pathSizeText) - 1, "PATH(%d)", path->getLength()); } @@ -1027,7 +1027,7 @@ void AiShipBehaviorAttackFighter::addDebug(AiDebugString & aiDebugString) // Show the current maneuver { - char const * const text = FormattedString<512>().sprintf("attack[%s%s%s] %d %s\n", AiDebugString::getColorCode(PackedRgb::solidWhite).c_str(), (m_currentManeuver != NULL) ? m_currentManeuver->getFighterManeuverString() : "NULL", AiDebugString::getResetColorCode(), (m_currentManeuver != NULL) ? m_currentManeuver->getSequenceId() : -1, pathSizeText); + char const * const text = FormattedString<512>().sprintf("attack[%s%s%s] %d %s\n", AiDebugString::getColorCode(PackedRgb::solidWhite).c_str(), (m_currentManeuver != nullptr) ? m_currentManeuver->getFighterManeuverString() : "nullptr", AiDebugString::getResetColorCode(), (m_currentManeuver != nullptr) ? m_currentManeuver->getSequenceId() : -1, pathSizeText); aiDebugString.addText(text, PackedRgb::solidCyan); } @@ -1060,7 +1060,7 @@ void AiShipBehaviorAttackFighter::addDebug(AiDebugString & aiDebugString) // Show the maneuver path - if ( (path != NULL) + if ( (path != nullptr) && !path->isEmpty()) { AiDebugString::TransformList transformList; diff --git a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackFighter_Maneuver.cpp b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackFighter_Maneuver.cpp index 17fa39ea..c3b9d975 100755 --- a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackFighter_Maneuver.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorAttackFighter_Maneuver.cpp @@ -72,7 +72,7 @@ AiShipBehaviorAttackFighter::Maneuver::~Maneuver() delete m_pathList; - //m_currentPath = NULL; + //m_currentPath = nullptr; } // ---------------------------------------------------------------------- @@ -128,7 +128,7 @@ void AiShipBehaviorAttackFighter::Maneuver::addPath(Path * const path) AiShipBehaviorAttackFighter::Maneuver::Path * AiShipBehaviorAttackFighter::Maneuver::getCurrentPath() { - Path * currentPath = NULL; + Path * currentPath = nullptr; if (!m_pathList->empty() && m_currentPath != m_pathList->end()) { @@ -230,7 +230,7 @@ void AiShipBehaviorAttackFighter::Maneuver::alterThrottle(float const /*timeDelt AiShipBehaviorAttackFighter::Maneuver * AiShipBehaviorAttackFighter::Maneuver::createManeuver(FighterManeuver const manueverType, AiShipBehaviorAttackFighter & aiShipBehaviorAttack, AiAttackTargetInformation const & targetInfo) { - Maneuver * aiManeuver = NULL; + Maneuver * aiManeuver = nullptr; switch(manueverType) { @@ -298,7 +298,7 @@ public: ShipObject const * const primaryTargetShipObject = getAiShipController().getPrimaryAttackTargetShipObject(); - if (primaryTargetShipObject != NULL) + if (primaryTargetShipObject != nullptr) { float const ownerShipRadius = getAiShipController().getShipOwner()->getRadius(); float const ownerTurnRadius = getAiShipController().getLargestTurnRadius(); @@ -337,7 +337,7 @@ protected: ShipObject const * const primaryTargetShipObject = getAiShipController().getPrimaryAttackTargetShipObject(); - if (primaryTargetShipObject != NULL) + if (primaryTargetShipObject != nullptr) { bool const facingTarget = m_aiShipBehaviorAttack.isFacingTarget(); @@ -450,7 +450,7 @@ private: { ShipObject const * const primaryTargetShipObject = getAiShipController().getPrimaryAttackTargetShipObject(); - if (primaryTargetShipObject != NULL) + if (primaryTargetShipObject != nullptr) { AiShipPilotData const & pilotData = *NON_NULL(getAiShipController().getPilotData()); float const currentSpeed = getAiShipController().getShipOwner()->getCurrentSpeed(); @@ -665,11 +665,11 @@ private: { ShipObject const * const primaryTargetShipObject = getAiShipController().getPrimaryAttackTargetShipObject(); - if (primaryTargetShipObject!= NULL) + if (primaryTargetShipObject!= nullptr) { ShipController const * const targetShipController = primaryTargetShipObject->getController()->asShipController(); - if (targetShipController != NULL) + if (targetShipController != nullptr) { Transform transform; Vector velocity; diff --git a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorDock.cpp b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorDock.cpp index e8c1aede..f023331c 100755 --- a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorDock.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorDock.cpp @@ -66,7 +66,7 @@ AiShipBehaviorDock::AiShipBehaviorDock(ShipController & shipController, ShipObje , m_goalPosition_w() , m_wingsOpenedBeforeDock(m_shipController.getShipOwner()->hasWings() && m_shipController.getShipOwner()->wingsOpened()) { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipBehaviorDock: [1/6] unit(%s) dockTarget(%s) secondsAtDock(%.2f) landingHardPoint(%s)", (shipController.getOwner() != NULL) ? shipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner", dockTarget.getNetworkId().getValueString().c_str(), secondsAtDock, m_hasLandingHardPoint ? "yes" : "no")); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipBehaviorDock: [1/6] unit(%s) dockTarget(%s) secondsAtDock(%.2f) landingHardPoint(%s)", (shipController.getOwner() != nullptr) ? shipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner", dockTarget.getNetworkId().getValueString().c_str(), secondsAtDock, m_hasLandingHardPoint ? "yes" : "no")); if (m_shipController.isBeingDocked()) { @@ -119,7 +119,7 @@ AiShipBehaviorDock::AiShipBehaviorDock(ShipController & shipController, ShipObje ShipController * const dockTargetShipController = dockTarget.getController()->asShipController(); - if (dockTargetShipController != NULL) + if (dockTargetShipController != nullptr) { dockTargetShipController->addDockedBy(*shipController.getOwner()); } @@ -146,7 +146,7 @@ AiShipBehaviorDock::AiShipBehaviorDock(ShipController & shipController, ShipObje m_initialApproachHardPointCount = static_cast(m_approachHardPointList->size()); - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipBehaviorDock() unit(%s) dockTarget(%s) approachHardPointCount(%u) exitHardPointCount(%u)", (shipController.getOwner() != NULL) ? shipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner", dockTarget.getNetworkId().getValueString().c_str(), m_approachHardPointList->size(), m_exitHardPointList->size())); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipBehaviorDock() unit(%s) dockTarget(%s) approachHardPointCount(%u) exitHardPointCount(%u)", (shipController.getOwner() != nullptr) ? shipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner", dockTarget.getNetworkId().getValueString().c_str(), m_approachHardPointList->size(), m_exitHardPointList->size())); } // ---------------------------------------------------------------------- @@ -156,7 +156,7 @@ AiShipBehaviorDock::~AiShipBehaviorDock() // Open the wings - if ( (ownerShipObject != NULL) + if ( (ownerShipObject != nullptr) && m_wingsOpenedBeforeDock) { m_shipController.getShipOwner()->openWings(); @@ -168,7 +168,7 @@ AiShipBehaviorDock::~AiShipBehaviorDock() { CollisionCallbackManager::removeIgnoreIntersect(m_shipController.getOwner()->getNetworkId(), m_dockTarget); - if ( (ownerShipObject != NULL) + if ( (ownerShipObject != nullptr) && ownerShipObject->isPlayerShip()) { m_shipController.appendMessage(CM_removeIgnoreIntersect, 0.0f, new MessageQueueGenericValueType(m_dockTarget), GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_CLIENT); @@ -179,11 +179,11 @@ AiShipBehaviorDock::~AiShipBehaviorDock() Object * const dockTarget = m_dockTarget.getObject(); - if (dockTarget != NULL) + if (dockTarget != nullptr) { ShipController * const dockTargetShipController = dockTarget->getController()->asShipController(); - if (dockTargetShipController != NULL) + if (dockTargetShipController != nullptr) { dockTargetShipController->removeDockedBy(*m_shipController.getOwner()); } @@ -200,7 +200,7 @@ void AiShipBehaviorDock::alter(float deltaSeconds) bool abortDocking = false; - if (m_dockTarget.getObject() == NULL) + if (m_dockTarget.getObject() == nullptr) { // If we lose the dock target, fail the docking procedure. @@ -213,7 +213,7 @@ void AiShipBehaviorDock::alter(float deltaSeconds) AiShipController * const dockTargetAiShipController = AiShipController::asAiShipController(m_dockTarget.getObject()->getController()); - if ( (dockTargetAiShipController != NULL) + if ( (dockTargetAiShipController != nullptr) && dockTargetAiShipController->isAttacking()) { LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipBehaviorDock::alter() unit(%s) dockTarget(%s) DOCK TARGET IS ATTACKING...UNDOCKING", m_shipController.getOwner()->getDebugInformation().c_str(), m_dockTarget.getValueString().c_str())); @@ -478,7 +478,7 @@ void AiShipBehaviorDock::triggerDocked() GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(m_shipController.getOwner()); - if(gameScriptObject != NULL) + if(gameScriptObject != nullptr) { ScriptParams scriptParams; scriptParams.addParam(m_dockTarget); @@ -499,7 +499,7 @@ void AiShipBehaviorDock::triggerStartUnDock() GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(m_shipController.getOwner()); - if(gameScriptObject != NULL) + if(gameScriptObject != nullptr) { ScriptParams scriptParams; scriptParams.addParam(m_dockTarget); @@ -520,7 +520,7 @@ void AiShipBehaviorDock::triggerUnDockWithSuccess() GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(m_shipController.getOwner()); - if(gameScriptObject != NULL) + if(gameScriptObject != nullptr) { ScriptParams scriptParams; scriptParams.addParam(m_dockTarget); @@ -542,7 +542,7 @@ void AiShipBehaviorDock::triggerUnDockWithFailure() GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(m_shipController.getOwner()); - if(gameScriptObject != NULL) + if(gameScriptObject != nullptr) { ScriptParams scriptParams; scriptParams.addParam(m_dockTarget); @@ -622,7 +622,7 @@ float AiShipBehaviorDock::getMaxTractorBeamSpeed() const float const shipActualSpeedMaximum = m_shipController.getShipOwner()->getShipActualSpeedMaximum(); AiShipController * const aiShipController = m_shipController.asAiShipController(); - return (aiShipController != NULL) ? (shipActualSpeedMaximum * aiShipController->getPilotData()->m_nonCombatMaxSpeedPercent) : shipActualSpeedMaximum; + return (aiShipController != nullptr) ? (shipActualSpeedMaximum * aiShipController->getPilotData()->m_nonCombatMaxSpeedPercent) : shipActualSpeedMaximum; } // ---------------------------------------------------------------------- @@ -676,7 +676,7 @@ void AiShipBehaviorDock::addDebug(AiDebugString & aiDebugString) aiDebugString.addLineToPosition(m_goalPosition_w, PackedRgb::solidCyan); - if (m_dockTarget.getObject() != NULL) + if (m_dockTarget.getObject() != nullptr) { Transform transform; transform.multiply(m_dockTarget.getObject()->getTransform_o2w(), m_dockHardPoint); diff --git a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorFollow.cpp b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorFollow.cpp index dedc3fda..e8ca1bd5 100755 --- a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorFollow.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorFollow.cpp @@ -45,9 +45,9 @@ AiShipBehaviorFollow::AiShipBehaviorFollow(AiShipController & aiShipController, , m_followedUnit(followedUnit) , m_followedUnitLost(false) { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorFollow::AiShipBehaviorFollow() unit(%s) followedUnit(%s)", (m_aiShipController.getOwner() != NULL) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner", followedUnit.getValueString().c_str())); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorFollow::AiShipBehaviorFollow() unit(%s) followedUnit(%s)", (m_aiShipController.getOwner() != nullptr) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner", followedUnit.getValueString().c_str())); - DEBUG_WARNING((m_followedUnit.getObject() == NULL), ("Trying to follow a NULL object.")); + DEBUG_WARNING((m_followedUnit.getObject() == nullptr), ("Trying to follow a nullptr object.")); } // ---------------------------------------------------------------------- @@ -60,7 +60,7 @@ void AiShipBehaviorFollow::alter(float const deltaSeconds) Object * const followedUnitObject = m_followedUnit.getObject(); Vector goalPosition_w; - if (followedUnitObject != NULL) + if (followedUnitObject != nullptr) { goalPosition_w = Formation::getPosition_w(followedUnitObject->getTransform_o2w(), m_aiShipController.getFormationPosition_l()); @@ -69,9 +69,9 @@ void AiShipBehaviorFollow::alter(float const deltaSeconds) if (m_aiShipController.getOwner()->getPosition_w().magnitudeBetweenSquared(goalPosition_w) > sqr(m_aiShipController.getLargestTurnRadius() * slowDownRequestRadiusGain)) { ShipController * const shipController = followedUnitObject->getController()->asShipController(); - AiShipController * const aiShipController = (shipController != NULL) ? shipController->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipController != nullptr) ? shipController->asAiShipController() : nullptr; - if (aiShipController != NULL) + if (aiShipController != nullptr) { aiShipController->requestSlowDown(); } @@ -90,7 +90,7 @@ void AiShipBehaviorFollow::alter(float const deltaSeconds) Object const * const object = m_aiShipController.getOwner(); - if (object != NULL) + if (object != nullptr) { goalPosition_w = object->getPosition_w(); } @@ -109,10 +109,10 @@ void AiShipBehaviorFollow::alter(float const deltaSeconds) void AiShipBehaviorFollow::triggerFollowedUnitLost() { Object * object = m_aiShipController.getOwner(); - ServerObject *serverObject = (object != NULL) ? object->asServerObject() : NULL; - GameScriptObject * gameScriptObject = (serverObject != NULL) ? serverObject->getScriptObject() : NULL; + ServerObject *serverObject = (object != nullptr) ? object->asServerObject() : nullptr; + GameScriptObject * gameScriptObject = (serverObject != nullptr) ? serverObject->getScriptObject() : nullptr; - if(gameScriptObject != NULL) + if(gameScriptObject != nullptr) { ScriptParams scriptParams; scriptParams.addParam(m_followedUnit); diff --git a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorIdle.cpp b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorIdle.cpp index 14d8253c..1654e5c8 100755 --- a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorIdle.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorIdle.cpp @@ -25,7 +25,7 @@ AiShipBehaviorIdle::AiShipBehaviorIdle(AiShipController & aiShipController) : AiShipBehaviorBase(aiShipController) { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorIdle() unit(%s)", (m_aiShipController.getOwner() != NULL) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner")); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorIdle() unit(%s)", (m_aiShipController.getOwner() != nullptr) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner")); } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorTrack.cpp b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorTrack.cpp index 68a47863..c1aa8506 100755 --- a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorTrack.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorTrack.cpp @@ -27,7 +27,7 @@ AiShipBehaviorTrack::AiShipBehaviorTrack(AiShipController & aiShipController, Ob : AiShipBehaviorBase(aiShipController) , m_target(&target) { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorTrack() unit(%s) target(%s)", (m_aiShipController.getOwner() != NULL) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner", target.getNetworkId().getValueString().c_str())); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorTrack() unit(%s) target(%s)", (m_aiShipController.getOwner() != nullptr) ? m_aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner", target.getNetworkId().getValueString().c_str())); } // ---------------------------------------------------------------------- @@ -36,7 +36,7 @@ void AiShipBehaviorTrack::alter(float deltaSeconds) { PROFILER_AUTO_BLOCK_DEFINE("AiShipBehaviorTrack::alter"); - if (m_target != NULL) + if (m_target != nullptr) { IGNORE_RETURN(m_aiShipController.face(m_target->getPosition_w(), deltaSeconds)); } diff --git a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorWaypoint.cpp b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorWaypoint.cpp index f68335b9..6302a8f9 100755 --- a/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorWaypoint.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/AiShipBehaviorWaypoint.cpp @@ -35,7 +35,7 @@ AiShipBehaviorWaypoint::AiShipBehaviorWaypoint(AiShipController & aiShipControll , m_cyclic(cyclic) , m_moveToCompleteTriggerSent(false) { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorWaypoint::AiShipBehaviorWaypoint() unit(%s) cyclic(%s)", (aiShipController.getOwner() != NULL) ? aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "NULL owner", cyclic ? "yes" : "no")); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("AiShipBehaviorWaypoint::AiShipBehaviorWaypoint() unit(%s) cyclic(%s)", (aiShipController.getOwner() != nullptr) ? aiShipController.getOwner()->getNetworkId().getValueString().c_str() : "nullptr owner", cyclic ? "yes" : "no")); } // ---------------------------------------------------------------------- @@ -61,7 +61,7 @@ void AiShipBehaviorWaypoint::alter(float deltaSeconds) { SpacePath const * const path = m_aiShipController.getPath(); - if ( (path != NULL) + if ( (path != nullptr) && !m_cyclic && (m_aiShipController.getCurrentPathIndex() == (path->getTransformList().size() - 1))) { @@ -76,7 +76,7 @@ void AiShipBehaviorWaypoint::alter(float deltaSeconds) GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(m_aiShipController.getOwner()); - if(gameScriptObject != NULL) + if(gameScriptObject != nullptr) { ScriptParams scriptParams; IGNORE_RETURN(gameScriptObject->trigAllScripts(Scripting::TRIG_SPACE_UNIT_MOVE_TO_COMPLETE, scriptParams)); @@ -104,13 +104,13 @@ bool AiShipBehaviorWaypoint::getNextPosition_w(Vector & position_w) SpacePath * const path = m_aiShipController.getPath(); - if ( (path != NULL) + if ( (path != nullptr) && !path->isEmpty() && (m_aiShipController.getCurrentPathIndex() < path->getTransformList().size())) { ShipObject const * const shipObject = m_aiShipController.getShipOwner(); - if (shipObject != NULL) + if (shipObject != nullptr) { SpacePath::TransformList const & transformList = path->getTransformList(); Vector const & nextPosition = getGoalPosition_w(); @@ -166,7 +166,7 @@ Vector AiShipBehaviorWaypoint::getGoalPosition_w() const SpacePath * const path = m_aiShipController.getPath(); - if ( (path != NULL) + if ( (path != nullptr) && !path->isEmpty()) { SpacePath::TransformList const & transformList = path->getTransformList(); @@ -245,7 +245,7 @@ void AiShipBehaviorWaypoint::addDebug(AiDebugString & aiDebugString) { SpacePath const * const path = m_aiShipController.getPath(); - if (path != NULL) + if (path != nullptr) { aiDebugString.addLineToPosition(m_aiShipController.getMoveToGoalPosition_w(), PackedRgb::solidGreen); aiDebugString.addCircle(m_aiShipController.getMoveToGoalPosition_w(), m_aiShipController.getLargestTurnRadius(), PackedRgb::solidGreen); diff --git a/engine/server/library/serverGame/src/shared/behavior/ShipTurretTargetingSystem.cpp b/engine/server/library/serverGame/src/shared/behavior/ShipTurretTargetingSystem.cpp index 23cbc81f..cf1af6f8 100755 --- a/engine/server/library/serverGame/src/shared/behavior/ShipTurretTargetingSystem.cpp +++ b/engine/server/library/serverGame/src/shared/behavior/ShipTurretTargetingSystem.cpp @@ -124,7 +124,7 @@ void ShipTurretTargetingSystem::onTargetLost(NetworkId const & target) ShipObject * const shipObject = NON_NULL(NON_NULL(NON_NULL(m_shipController.getOwner())->asServerObject())->asShipObject()); if (!shipObject) // for release builds { - WARNING(true,("Programmer bug: got a NULL ShipObject in ShipTurretTargetingSystem::onTargetLost(). May indicate that the ShipObject has already been partially deconstructed.")); + WARNING(true,("Programmer bug: got a nullptr ShipObject in ShipTurretTargetingSystem::onTargetLost(). May indicate that the ShipObject has already been partially deconstructed.")); return; } @@ -168,7 +168,7 @@ bool ShipTurretTargetingSystem::buildTargetList() bool result = false; m_targetList->clear(); - if (ownerShipController != NULL) + if (ownerShipController != nullptr) { if (!ownerShipController->getAttackTargetList().isEmpty()) { diff --git a/engine/server/library/serverGame/src/shared/collision/CollisionCallbacks.cpp b/engine/server/library/serverGame/src/shared/collision/CollisionCallbacks.cpp index 99c4f3cb..9bce1404 100755 --- a/engine/server/library/serverGame/src/shared/collision/CollisionCallbacks.cpp +++ b/engine/server/library/serverGame/src/shared/collision/CollisionCallbacks.cpp @@ -86,7 +86,7 @@ void CollisionCallbacksNamespace::remove() int CollisionCallbacksNamespace::convertObjectToIndex(Object * const object) { - FATAL(!object, ("CollisionCallbacksNamespace::convertObjectToIndex: object == NULL.")); + FATAL(!object, ("CollisionCallbacksNamespace::convertObjectToIndex: object == nullptr.")); ServerObject const * serverObject = object->asServerObject(); if (serverObject) @@ -99,11 +99,11 @@ int CollisionCallbacksNamespace::convertObjectToIndex(Object * const object) bool CollisionCallbacksNamespace::onHitDoCollisionWith(Object * const object, Object * const wasHitByThisObject) { - DEBUG_WARNING(!object, ("CollisionCallbacksNamespace::onHitDoCollisionWith: Object == NULL")); - DEBUG_WARNING(!wasHitByThisObject, ("CollisionCallbacksNamespace::onHitDoCollisionWith: wasHitByThisObject == NULL")); + DEBUG_WARNING(!object, ("CollisionCallbacksNamespace::onHitDoCollisionWith: Object == nullptr")); + DEBUG_WARNING(!wasHitByThisObject, ("CollisionCallbacksNamespace::onHitDoCollisionWith: wasHitByThisObject == nullptr")); ShipObject * shipObject = safe_cast(object); - DEBUG_WARNING(!shipObject, ("CollisionCallbacksNamespace::onHitDoCollisionWith: shipObject == NULL")); + DEBUG_WARNING(!shipObject, ("CollisionCallbacksNamespace::onHitDoCollisionWith: shipObject == nullptr")); CollisionCallbackManager::Result result; if (CollisionCallbackManager::intersectAndReflect(object, wasHitByThisObject, result)) @@ -123,10 +123,10 @@ bool CollisionCallbacksNamespace::onHitDoCollisionWith(Object * const object, Ob bool CollisionCallbacksNamespace::onDoCollisionWithTerrain(Object * const object) { - DEBUG_FATAL (!object, ("CollisionCallbacksNamespace::onDoCollisionWithTerrain: Object == NULL")); + DEBUG_FATAL (!object, ("CollisionCallbacksNamespace::onDoCollisionWithTerrain: Object == nullptr")); ShipObject * shipObject = safe_cast(object); - DEBUG_FATAL (!shipObject, ("CollisionCallbacksNamespace::onDoCollisionWithTerrain: shipObject == NULL")); + DEBUG_FATAL (!shipObject, ("CollisionCallbacksNamespace::onDoCollisionWithTerrain: shipObject == nullptr")); CollisionCallbackManager::Result result; if (CollisionCallbackManager::intersectAndReflectWithTerrain(object, result)) diff --git a/engine/server/library/serverGame/src/shared/command/CommandCppFuncs.cpp b/engine/server/library/serverGame/src/shared/command/CommandCppFuncs.cpp index ff3f058c..f39fcae2 100755 --- a/engine/server/library/serverGame/src/shared/command/CommandCppFuncs.cpp +++ b/engine/server/library/serverGame/src/shared/command/CommandCppFuncs.cpp @@ -145,13 +145,13 @@ namespace CommandCppFuncsNamespace void internalSetBoosterOnOff(NetworkId const & actor, bool onOff) { ServerObject * const actorServerObj = safe_cast(NetworkIdManager::getObjectById(actor)); - CreatureObject * const actorCreature = actorServerObj != NULL ? actorServerObj->asCreatureObject() : NULL; + CreatureObject * const actorCreature = actorServerObj != nullptr ? actorServerObj->asCreatureObject() : nullptr; - if (actorCreature == NULL) + if (actorCreature == nullptr) return; ShipObject * const shipObject = actorCreature->getPilotedShip(); - if (shipObject == NULL) + if (shipObject == nullptr) return; if (!shipObject->isSlotInstalled(ShipChassisSlotType::SCST_booster)) @@ -212,22 +212,22 @@ namespace CommandCppFuncsNamespace CreatureObject * findAndResolveCreatureByNetworkId(NetworkId const & targetId) { - CreatureObject * targetCreatureObject = NULL; + CreatureObject * targetCreatureObject = nullptr; { // find the target. the target could be either a creature or ship ServerObject * const serverObject = ServerWorld::findObjectByNetworkId(targetId); - targetCreatureObject = (serverObject != NULL) ? serverObject->asCreatureObject() : NULL; + targetCreatureObject = (serverObject != nullptr) ? serverObject->asCreatureObject() : nullptr; - if (targetCreatureObject == NULL) + if (targetCreatureObject == nullptr) { - ShipObject * const shipObject = (serverObject != NULL) ? serverObject->asShipObject() : NULL; + ShipObject * const shipObject = (serverObject != nullptr) ? serverObject->asShipObject() : nullptr; - if (shipObject != NULL) + if (shipObject != nullptr) { targetCreatureObject = shipObject->getPilot(); - if (targetCreatureObject == NULL) + if (targetCreatureObject == nullptr) { // this means that it is a POB ship that doesn't have a pilot // in this case we find the owner @@ -237,7 +237,7 @@ namespace CommandCppFuncsNamespace std::vector::const_iterator ii = passengers.begin(); std::vector::const_iterator iiEnd = passengers.end(); - for (; ii != iiEnd && targetCreatureObject == NULL; ++ii) + for (; ii != iiEnd && targetCreatureObject == nullptr; ++ii) { if ((*ii)->getNetworkId() == shipObject->getOwnerId()) { @@ -290,7 +290,7 @@ namespace CommandCppFuncsNamespace Container::ContainerErrorCode errorCode = Container::CEC_Success; for (std::vector >::const_iterator i = oldItems.begin(); i != oldItems.end(); ++i) { - IGNORE_RETURN(ContainerInterface::transferItemToSlottedContainer(destination, *((*i).first), (*i).second, NULL, errorCode)); + IGNORE_RETURN(ContainerInterface::transferItemToSlottedContainer(destination, *((*i).first), (*i).second, nullptr, errorCode)); } } @@ -411,7 +411,7 @@ void CommandCppFuncsNamespace::triggerSpaceEjectPlayerFromShip(CreatureObject * { if (creatureObject == 0) { - WARNING(true, ("CommandCppFuncsNamespace::triggerSpaceEjectPlayerFromShip: NULL CreatureObject.")); + WARNING(true, ("CommandCppFuncsNamespace::triggerSpaceEjectPlayerFromShip: nullptr CreatureObject.")); return; } @@ -424,7 +424,7 @@ void CommandCppFuncsNamespace::triggerSpaceEjectPlayerFromShip(CreatureObject * } else { - WARNING(true, ("CommandCppFuncsNamespace::triggerSpaceEjectPlayerFromShip: NULL ScriptObject.")); + WARNING(true, ("CommandCppFuncsNamespace::triggerSpaceEjectPlayerFromShip: nullptr ScriptObject.")); } } @@ -432,7 +432,7 @@ void CommandCppFuncsNamespace::triggerSpaceEjectPlayerFromShip(CreatureObject * TravelPoint const * CommandCppFuncsNamespace::GroupHelpers::getNearestTravelPoint(std::string const & planetName, Vector const & location, std::vector const & cityBanList, uint32 faction, bool starPortAndShuttleportOnly) { - TravelPoint const * nearestTravelPoint = NULL; + TravelPoint const * nearestTravelPoint = nullptr; PlanetObject const * const planetObject = ServerUniverse::getInstance().getPlanetByName(planetName); if (planetObject) { @@ -537,7 +537,7 @@ static NetworkId nextOidParm(Unicode::String const &str, size_t &curpos) static float nextFloatParm(Unicode::String const &str, size_t &curpos) { - return static_cast(strtod(nextStringParm(str, curpos).c_str(), NULL)); + return static_cast(strtod(nextStringParm(str, curpos).c_str(), nullptr)); } @@ -821,7 +821,7 @@ static void commandFuncLocateStructure(Command const &, NetworkId const &actor, ownerId = actor; } - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); if (!isGod && actorObj->getObjVars().hasItem("timeNextLocateStructureCommandAllowed") && (actorObj->getObjVars().getType("timeNextLocateStructureCommandAllowed") == DynamicVariable::INT)) { int timeNextLocateStructureCommandAllowed = 0; @@ -889,7 +889,7 @@ static void commandFuncLocateVendor(Command const &, NetworkId const &actor, Net ownerId = actor; } - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); if (!isGod && actorObj->getObjVars().hasItem("timeNextLocateVendorCommandAllowed") && (actorObj->getObjVars().getType("timeNextLocateVendorCommandAllowed") == DynamicVariable::INT)) { int timeNextLocateVendorCommandAllowed = 0; @@ -956,7 +956,7 @@ static void commandFuncShowCtsHistory(Command const &, NetworkId const &actor, N if (target != actor) { targetObj = dynamic_cast(ServerWorld::findObjectByNetworkId(target)); - targetPlayerObj = (targetObj ? PlayerCreatureController::getPlayerObject(targetObj) : NULL); + targetPlayerObj = (targetObj ? PlayerCreatureController::getPlayerObject(targetObj) : nullptr); if (!targetPlayerObj) { ConsoleMgr::broadcastString(FormattedString<1024>().sprintf("%s is not a valid or nearby player character.", target.getValueString().c_str()), clientObj); @@ -980,7 +980,7 @@ static void commandFuncShowCtsHistory(Command const &, NetworkId const &actor, N if (i.getValue(ctsTransactionDetail)) { Unicode::UnicodeStringVector tokens; - if (Unicode::tokenize(ctsTransactionDetail, tokens, NULL, NULL) && (tokens.size() >= 4)) + if (Unicode::tokenize(ctsTransactionDetail, tokens, nullptr, nullptr) && (tokens.size() >= 4)) { Unicode::String characterName; for (size_t i = 3, j = tokens.size(); i < j; ++i) @@ -1196,7 +1196,7 @@ static void commandFuncAdminEditBank(Command const &cmd, NetworkId const &actor, CreatureObject * targetCreature = safe_cast(ServerWorld::findObjectByNetworkId(target)); if (!targetCreature || !actorCreature) { - DEBUG_REPORT_LOG(true, ("Received open command for null player or target.\n")); + DEBUG_REPORT_LOG(true, ("Received open command for nullptr player or target.\n")); return; } @@ -1241,14 +1241,14 @@ static void commandFuncAdminEditStats(Command const &, NetworkId const &actor, N CreatureObject* const creatureActor = dynamic_cast(NetworkIdManager::getObjectById (actor)); if (!creatureActor) { - WARNING (true, ("commandFuncAdminEditStats: null actor")); + WARNING (true, ("commandFuncAdminEditStats: nullptr actor")); return; } CreatureObject* const creatureTarget = dynamic_cast(NetworkIdManager::getObjectById (target)); if (!creatureTarget) { - WARNING (true, ("commandFuncAdminEditStats: null target")); + WARNING (true, ("commandFuncAdminEditStats: nullptr target")); return; } @@ -1265,14 +1265,14 @@ static void commandFuncAdminEditAppearance(Command const &, NetworkId const &act CreatureObject* const creatureActor = dynamic_cast(NetworkIdManager::getObjectById (actor)); if (!creatureActor) { - WARNING (true, ("commandFuncAdminEditAppearance: null actor")); + WARNING (true, ("commandFuncAdminEditAppearance: nullptr actor")); return; } CreatureObject* const creatureTarget = dynamic_cast(NetworkIdManager::getObjectById (target)); if (!creatureTarget) { - WARNING (true, ("commandFuncAdminEditAppearance: null target")); + WARNING (true, ("commandFuncAdminEditAppearance: nullptr target")); return; } @@ -1819,7 +1819,7 @@ static void commandFuncSpatialChatInternal(Command const &, NetworkId const &act else if (!squelched && (ConfigServerGame::getChatSpamNotifyPlayerWhenLimitedIntervalSeconds() > 0) && obj->getClient()) { // send message telling character he can no longer talk - const int timeNow = static_cast(::time(NULL)); + const int timeNow = static_cast(::time(nullptr)); const int chatSpamTimeEndInterval = playerObject->getChatSpamTimeEndInterval(); if ((chatSpamTimeEndInterval > timeNow) && (timeNow >= playerObject->getChatSpamNextTimeToNotifyPlayerWhenLimited())) { @@ -1837,7 +1837,7 @@ static void commandFuncSpatialChatInternal(Command const &, NetworkId const &act // ---------------------------------------------------------------------- /** -* Parameters: [null terminator + oob] +* Parameters: [nullptr terminator + oob] * All parameters are strings */ @@ -1957,7 +1957,7 @@ static void commandFuncSpatialChat(Command const &, NetworkId const &actor, Netw else if (!squelched && (ConfigServerGame::getChatSpamNotifyPlayerWhenLimitedIntervalSeconds() > 0) && obj->getClient()) { // send message telling character he can no longer talk - const int timeNow = static_cast(::time(NULL)); + const int timeNow = static_cast(::time(nullptr)); const int chatSpamTimeEndInterval = playerObject->getChatSpamTimeEndInterval(); if ((chatSpamTimeEndInterval > timeNow) && (timeNow >= playerObject->getChatSpamNextTimeToNotifyPlayerWhenLimited())) { @@ -1992,7 +1992,7 @@ static void commandFuncCombatSpam (Command const &, NetworkId const &actor, Netw ServerObject * const obj = safe_cast(actorId.getObject ()); if (!obj) { - WARNING (true, ("null actor in commandFuncCombatSpam")); + WARNING (true, ("nullptr actor in commandFuncCombatSpam")); return; } @@ -2213,10 +2213,10 @@ static void commandFuncSetWaypointName(Command const &, NetworkId const & actor, static void commandSetPosture(Command const &command, NetworkId const &actor, NetworkId const &, Unicode::String const &) { CachedNetworkId actorId(actor); - if (actorId.getObject() != NULL) + if (actorId.getObject() != nullptr) { CreatureController * const controller = dynamic_cast(actorId.getObject()->getController()); - if (controller != NULL) + if (controller != nullptr) { CreatureObject * const creature = safe_cast(actorId.getObject()); NOT_NULL (creature); @@ -2247,15 +2247,15 @@ static void commandSetPosture(Command const &command, NetworkId const &actor, Ne static void commandFuncJumpServer(Command const &command, NetworkId const &actor, NetworkId const &, Unicode::String const &) { CachedNetworkId actorId(actor); - if (actorId.getObject() != NULL) + if (actorId.getObject() != nullptr) { CreatureController * const controller = dynamic_cast(actorId.getObject()->getController()); - if (controller != NULL) + if (controller != nullptr) { controller->appendMessage( CM_jump, 0.0f, - NULL, + nullptr, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_ALL_CLIENT @@ -2621,7 +2621,7 @@ static void commandFuncEndDuel(Command const &, NetworkId const &actor, NetworkI params.addParam(targetObj->getNetworkId(), "target"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(actorFlagObj->getNetworkId(), @@ -2634,7 +2634,7 @@ static void commandFuncEndDuel(Command const &, NetworkId const &actor, NetworkI params.addParam(actorFlagObj->getNetworkId(), "target"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(targetObj->getNetworkId(), @@ -2867,7 +2867,7 @@ static void commandFuncFactoryCrateSplit(Command const &, NetworkId const &actor const int amount = nextIntParm(params,pos); const CachedNetworkId destContainerId (nextOidParm(params,pos)); ServerObject * destContainer = safe_cast(destContainerId.getObject()); - if (destContainer == NULL || ContainerInterface::getVolumeContainer(*destContainer) == NULL) + if (destContainer == nullptr || ContainerInterface::getVolumeContainer(*destContainer) == nullptr) { ContainerInterface::sendContainerMessageToClient(*player, Container::CEC_NotFound); return; @@ -2878,7 +2878,7 @@ static void commandFuncFactoryCrateSplit(Command const &, NetworkId const &actor { ContainerInterface::sendContainerMessageToClient(*player, error, sourceObj); } - else if (sourceObj->makeCopy(*destContainer, amount) == NULL) + else if (sourceObj->makeCopy(*destContainer, amount) == nullptr) { ContainerInterface::sendContainerMessageToClient(*player, Container::CEC_Full, destContainer); @@ -2952,7 +2952,7 @@ static void commandFuncTransferItem(Command const &, NetworkId const &actor, Net if (!playerSo || !item) { - DEBUG_REPORT_LOG(true, ("Received transfer item command for null player or target.\n")); + DEBUG_REPORT_LOG(true, ("Received transfer item command for nullptr player or target.\n")); return; } @@ -3185,7 +3185,7 @@ static void commandFuncTransferItem(Command const &, NetworkId const &actor, Net retval = false; } - else if (destination == player->getAppearanceInventory() && ContainerInterface::getContainer(*item) != NULL) + else if (destination == player->getAppearanceInventory() && ContainerInterface::getContainer(*item) != nullptr) { const Container * itemContainer = ContainerInterface::getContainer(*item); if(itemContainer && itemContainer->getNumberOfItems() == 0) @@ -3215,7 +3215,7 @@ static void commandFuncTransferItem(Command const &, NetworkId const &actor, Net const SlottedContainer * equipment = ContainerInterface::getSlottedContainer(*player); const SlottedContainmentProperty * itemContainmentProperty = ContainerInterface::getSlottedContainmentProperty(*item); - if (inventory != NULL && equipment != NULL && itemContainmentProperty != NULL) + if (inventory != nullptr && equipment != nullptr && itemContainmentProperty != nullptr) { std::vector > oldItems; retval = true; @@ -3225,7 +3225,7 @@ static void commandFuncTransferItem(Command const &, NetworkId const &actor, Net SlotId slot = itemContainmentProperty->getSlotId(arrangement, i); const Container::ContainedItem & currentWeaponId = equipment->getObjectInSlot(slot, errorCode); ServerObject * oldItem = safe_cast(currentWeaponId.getObject()); - if (oldItem != NULL) + if (oldItem != nullptr) { if (ContainerInterface::transferItemToVolumeContainer(*inventory, *oldItem, player, errorCode, true)) { @@ -3280,7 +3280,7 @@ static void commandFuncTransferItem(Command const &, NetworkId const &actor, Net SlotId slot = itemContainmentProperty->getSlotId(arrangement, i); const Container::ContainedItem & currentWeaponId = equipment->getObjectInSlot(slot, errorCode); ServerObject * oldItem = safe_cast(currentWeaponId.getObject()); - if (oldItem != NULL) + if (oldItem != nullptr) { if( std::find(objectsToSend.begin(), objectsToSend.end(), oldItem) == objectsToSend.end() ) objectsToSend.push_back(oldItem); @@ -3291,7 +3291,7 @@ static void commandFuncTransferItem(Command const &, NetworkId const &actor, Net for(; iter != objectsToSend.end(); ++iter) { // No idea how this could happen, but just incase. - if((*iter) == NULL) + if((*iter) == nullptr) continue; StringId const code("container_error_message", "container32_prose"); @@ -3411,7 +3411,7 @@ static void commandFuncOpenContainer(Command const & cmd, NetworkId const &actor CreatureObject * player = safe_cast(ServerWorld::findObjectByNetworkId(actor)); if (!container || !player) { - DEBUG_REPORT_LOG(true, ("Received open command for null player or target.\n")); + DEBUG_REPORT_LOG(true, ("Received open command for nullptr player or target.\n")); return; } //@todo check permissions @@ -3428,14 +3428,14 @@ static void commandFuncOpenContainer(Command const & cmd, NetworkId const &actor //-- if they are opening a crafting station, what they really want is the hopper //-- but only if the object is not a volume container if (container->getGameObjectType () == SharedObjectTemplate::GOT_misc_crafting_station - && (NULL == ContainerInterface::getVolumeContainer (*container))) + && (nullptr == ContainerInterface::getVolumeContainer (*container))) { static const SlotId inputHopperId(SlotIdManager::findSlotId(CrcLowerString("ingredient_hopper"))); ServerObject const * const station = container; - ServerObject * hopper = NULL; + ServerObject * hopper = nullptr; const SlottedContainer * stationContainer = ContainerInterface::getSlottedContainer (*station); - if (stationContainer != NULL) + if (stationContainer != nullptr) { Container::ContainerErrorCode tmp = Container::CEC_Success; Object* tmpHopperObj = (stationContainer->getObjectInSlot (inputHopperId, tmp)).getObject(); @@ -3526,7 +3526,7 @@ static void commandFuncCloseContainer(Command const &, NetworkId const &actor, N ServerObject * const player = ServerWorld::findObjectByNetworkId(actor); if (!container || !player) { - DEBUG_REPORT_LOG(true, ("Received close command for null player or target.\n")); + DEBUG_REPORT_LOG(true, ("Received close command for nullptr player or target.\n")); return; } @@ -3615,7 +3615,7 @@ static void commandFuncGiveItem(Command const &, NetworkId const &actor, Network ServerObject * const player = ServerWorld::findObjectByNetworkId(actor); if (!player || !item) { - DEBUG_REPORT_LOG(true, ("Received give item command for null player or target.\n")); + DEBUG_REPORT_LOG(true, ("Received give item command for nullptr player or target.\n")); return; } size_t curpos = 0; @@ -3669,10 +3669,10 @@ static void commandFuncGiveItem(Command const &, NetworkId const &actor, Network // check and see if this is a gem->socket operation, which is handled by our code TangibleObject * const socket = dynamic_cast(destination); - if (socket != NULL) + if (socket != nullptr) { TangibleObject * const gem = dynamic_cast(item); - if (gem != NULL) + if (gem != nullptr) { const int destGot = socket->getGameObjectType(); const SharedTangibleObjectTemplate * const gemTemplate = safe_cast(gem->getSharedTemplate()); @@ -3692,13 +3692,13 @@ static void commandFuncGiveItem(Command const &, NetworkId const &actor, Network } // if the socketed item is equipped, unequip it temporarily - CreatureObject * owner = NULL; + CreatureObject * owner = nullptr; Object * container = ContainerInterface::getContainedByObject(*socket); - if (container != NULL && container->asServerObject()->asCreatureObject() != NULL) + if (container != nullptr && container->asServerObject()->asCreatureObject() != nullptr) { owner = container->asServerObject()->asCreatureObject(); // fake unequipping the item - owner->onContainerLostItem(NULL, *socket, NULL); + owner->onContainerLostItem(nullptr, *socket, nullptr); } std::vector > skillModBonuses; @@ -3713,10 +3713,10 @@ static void commandFuncGiveItem(Command const &, NetworkId const &actor, Network // tell the player they can't use the gem Chat::sendSystemMessage(*player, SharedStringIds::gem_not_inserted, Unicode::emptyString); } - if (owner != NULL) + if (owner != nullptr) { // "re-equip" the item - owner->onContainerGainItem(*socket, NULL, NULL); + owner->onContainerGainItem(*socket, nullptr, nullptr); } return; } @@ -4138,7 +4138,7 @@ static void commandFuncGroupDisband(Command const &, NetworkId const &actor, Net { GroupMemberParam const & leader = *ii; - // create the new POB groups. notice NULL is passed in for the + // create the new POB groups. notice nullptr is passed in for the // groupToRemoveFrom because the original group has already had // all of the members removed @@ -4389,7 +4389,7 @@ static void commandFuncCreateGroupPickup(Command const &, NetworkId const &actor } // create the group pickup point - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); groupObj->setGroupPickupTimer(timeNow, timeNow + static_cast(ConfigServerGame::getGroupPickupPointTimeLimitSeconds())); groupObj->setGroupPickupLocation(currentScene, currentWorldLocation); @@ -4682,7 +4682,7 @@ static void commandFuncGroupPickRandomGroupMember(Command const &, NetworkId con if (!client) return; - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); if (!client->isGod() && targetObj->getObjVars().hasItem("timeNextGroupPickRandomGroupMemberCommandAllowed") && (targetObj->getObjVars().getType("timeNextGroupPickRandomGroupMemberCommandAllowed") == DynamicVariable::INT)) { int timeNextGroupPickRandomGroupMemberCommandAllowed = 0; @@ -4703,7 +4703,7 @@ static void commandFuncGroupPickRandomGroupMember(Command const &, NetworkId con if (!params.empty()) { Unicode::UnicodeStringVector tokens; - if (Unicode::tokenize(Unicode::toLower(params), tokens, NULL, NULL) && !tokens.empty()) + if (Unicode::tokenize(Unicode::toLower(params), tokens, nullptr, nullptr) && !tokens.empty()) { static Unicode::String const paramsPoint1 = Unicode::narrowToWide("-point"); static Unicode::String const paramsPoint2 = Unicode::narrowToWide("point"); @@ -4805,7 +4805,7 @@ static void commandFuncGroupTextChatRoomRejoin(Command const &, NetworkId const if (!client) return; - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); if (!client->isGod() && targetObj->getObjVars().hasItem("timeNextGroupTextChatRoomRejoinCommandAllowed") && (targetObj->getObjVars().getType("timeNextGroupTextChatRoomRejoinCommandAllowed") == DynamicVariable::INT)) { int timeNextGroupTextChatRoomRejoinCommandAllowed = 0; @@ -4868,7 +4868,7 @@ static void commandFuncGuildTextChatRoomRejoin(Command const &, NetworkId const if (!client) return; - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); if (!client->isGod() && targetObj->getObjVars().hasItem("timeNextGuildTextChatRoomRejoinCommandAllowed") && (targetObj->getObjVars().getType("timeNextGuildTextChatRoomRejoinCommandAllowed") == DynamicVariable::INT)) { int timeNextGuildTextChatRoomRejoinCommandAllowed = 0; @@ -4913,7 +4913,7 @@ static void commandFuncGuildPickRandomGuildMember(Command const &, NetworkId con if (!client) return; - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); if (!client->isGod() && targetObj->getObjVars().hasItem("timeNextGuildPickRandomGuildMemberCommandAllowed") && (targetObj->getObjVars().getType("timeNextGuildPickRandomGuildMemberCommandAllowed") == DynamicVariable::INT)) { int timeNextGuildPickRandomGuildMemberCommandAllowed = 0; @@ -4935,7 +4935,7 @@ static void commandFuncGuildPickRandomGuildMember(Command const &, NetworkId con if (!params.empty()) { Unicode::UnicodeStringVector tokens; - if (Unicode::tokenize(Unicode::toLower(params), tokens, NULL, NULL) && !tokens.empty()) + if (Unicode::tokenize(Unicode::toLower(params), tokens, nullptr, nullptr) && !tokens.empty()) { static Unicode::String const paramsOnline1 = Unicode::narrowToWide("-online"); static Unicode::String const paramsOnline2 = Unicode::narrowToWide("online"); @@ -5074,7 +5074,7 @@ static void commandFuncCityTextChatRoomRejoin(Command const &, NetworkId const & if (!client) return; - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); if (!client->isGod() && targetObj->getObjVars().hasItem("timeNextCityTextChatRoomRejoinCommandAllowed") && (targetObj->getObjVars().getType("timeNextCityTextChatRoomRejoinCommandAllowed") == DynamicVariable::INT)) { int timeNextCityTextChatRoomRejoinCommandAllowed = 0; @@ -5120,7 +5120,7 @@ static void commandFuncCityPickRandomCitizen(Command const &, NetworkId const &a if (!client) return; - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); if (!client->isGod() && targetObj->getObjVars().hasItem("timeNextCityPickRandomCitizenCommandAllowed") && (targetObj->getObjVars().getType("timeNextCityPickRandomCitizenCommandAllowed") == DynamicVariable::INT)) { int timeNextCityPickRandomCitizenCommandAllowed = 0; @@ -5142,7 +5142,7 @@ static void commandFuncCityPickRandomCitizen(Command const &, NetworkId const &a if (!params.empty()) { Unicode::UnicodeStringVector tokens; - if (Unicode::tokenize(Unicode::toLower(params), tokens, NULL, NULL) && !tokens.empty()) + if (Unicode::tokenize(Unicode::toLower(params), tokens, nullptr, nullptr) && !tokens.empty()) { static Unicode::String const paramsOnline1 = Unicode::narrowToWide("-online"); static Unicode::String const paramsOnline2 = Unicode::narrowToWide("online"); @@ -5272,7 +5272,7 @@ static void commandFuncPlaceStructure (const Command& /*command*/, const Network Object* const object = NetworkIdManager::getObjectById (actor); if (!object) { - DEBUG_WARNING (true, ("commandFuncPlaceStructure: PB null actor\n")); + DEBUG_WARNING (true, ("commandFuncPlaceStructure: PB nullptr actor\n")); return; } @@ -5478,9 +5478,9 @@ static void commandFuncPurchaseTicket (const Command& /*command*/, const Network static void commandFuncRequestResourceWeights(const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == NULL) + if (creature == nullptr) { - WARNING (true, ("commandFuncRequestResourceWeights: PB null actor")); + WARNING (true, ("commandFuncRequestResourceWeights: PB nullptr actor")); return; } @@ -5494,9 +5494,9 @@ static void commandFuncRequestResourceWeights(const Command& , const NetworkId& static void commandFuncRequestResourceWeightsBatch(const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) { CreatureObject* const creature = dynamic_cast(NetworkIdManager::getObjectById (actor)); - if (creature == NULL) + if (creature == nullptr) { - WARNING (true, ("commandFuncRequestResourceWeightsBatch: PB null actor")); + WARNING (true, ("commandFuncRequestResourceWeightsBatch: PB nullptr actor")); return; } @@ -5516,14 +5516,14 @@ static void commandFuncRequestResourceWeightsBatch(const Command& , const Networ static void commandFuncRequestDraftSlots (const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == NULL) + if (creature == nullptr) { - WARNING (true, ("commandFuncRequestDraftSlots: PB null actor")); + WARNING (true, ("commandFuncRequestDraftSlots: PB nullptr actor")); return; } PlayerObject * const player = PlayerCreatureController::getPlayerObject(creature); - if (player == NULL) + if (player == nullptr) { WARNING (true, ("commandFuncRequestDraftSlots: no player object for actor ""%s", actor.getValueString().c_str())); return; @@ -5533,7 +5533,7 @@ static void commandFuncRequestDraftSlots (const Command& , const NetworkId& acto sscanf(Unicode::wideToNarrow(params).c_str(), "%lu %lu", &serverCrc, &sharedCrc); MessageQueueDraftSlotsQueryResponse * const message = new MessageQueueDraftSlotsQueryResponse(std::make_pair(serverCrc, sharedCrc)); - if (!player->requestDraftSlots(serverCrc, NULL, message)) + if (!player->requestDraftSlots(serverCrc, nullptr, message)) { WARNING (true, ("commandFuncRequestDraftSlots failed to request draft slots for %u", serverCrc)); delete message; @@ -5545,14 +5545,14 @@ static void commandFuncRequestDraftSlots (const Command& , const NetworkId& acto static void commandFuncRequestDraftSlotsBatch (const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == NULL) + if (creature == nullptr) { - WARNING (true, ("commandFuncRequestDraftSlotsBatch: PB null actor")); + WARNING (true, ("commandFuncRequestDraftSlotsBatch: PB nullptr actor")); return; } PlayerObject * const player = PlayerCreatureController::getPlayerObject(creature); - if (player == NULL) + if (player == nullptr) { WARNING (true, ("commandFuncRequestDraftSlotsBatch: no player object for actor ""%s", actor.getValueString().c_str())); return; @@ -5575,7 +5575,7 @@ static void commandFuncRequestDraftSlotsBatch (const Command& , const NetworkId& while(uServerCrc != 0 && uSharedCrc != 0 && !done) { MessageQueueDraftSlotsQueryResponse * const message = new MessageQueueDraftSlotsQueryResponse(std::make_pair(uServerCrc, uSharedCrc)); - if (!player->requestDraftSlots(uServerCrc, NULL, message)) + if (!player->requestDraftSlots(uServerCrc, nullptr, message)) { WARNING (true, ("commandFuncRequestDraftSlotsBatch failed to request draft slots for %lu", uServerCrc)); delete message; @@ -5596,15 +5596,15 @@ static void commandFuncRequestDraftSlotsBatch (const Command& , const NetworkId& static void commandFuncRequestManfSchematicSlots (const Command& , const NetworkId& actor, const NetworkId& target, const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == NULL) + if (creature == nullptr) { - WARNING (true, ("commandFuncRequestDraftSlots: PB null actor")); + WARNING (true, ("commandFuncRequestDraftSlots: PB nullptr actor")); return; } const ManufactureSchematicObject * schematic = dynamic_cast< const ManufactureSchematicObject *>(NetworkIdManager::getObjectById(target)); - if (schematic != NULL) + if (schematic != nullptr) { schematic->requestSlots(*creature); } @@ -5615,14 +5615,14 @@ static void commandFuncRequestManfSchematicSlots (const Command& , const Network static void commandFuncRequestCraftingSession (const Command& , const NetworkId& actor, const NetworkId& target, const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == NULL) + if (creature == nullptr) { - WARNING (true, ("commandFuncRequestCraftingSession: PB null actor")); + WARNING (true, ("commandFuncRequestCraftingSession: PB nullptr actor")); return; } PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); - if (player == NULL) + if (player == nullptr) { WARNING (true, ("commandFuncRequestCraftingSession: no player object for actor " "%s", actor.getValueString().c_str())); @@ -5668,14 +5668,14 @@ static void commandFuncRequestCraftingSessionFail(Command const &, NetworkId con static void commandFuncSelectDraftSchematic (const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == NULL) + if (creature == nullptr) { - WARNING (true, ("commandFuncSelectDraftSchematic: PB null actor")); + WARNING (true, ("commandFuncSelectDraftSchematic: PB nullptr actor")); return; } PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); - if (player == NULL) + if (player == nullptr) { WARNING (true, ("commandFuncSelectDraftSchematic: no player object for actor " "%s", actor.getValueString().c_str())); @@ -5692,14 +5692,14 @@ static void commandFuncSelectDraftSchematic (const Command& , const NetworkId& a static void commandFuncNextCraftingStage(const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == NULL) + if (creature == nullptr) { - WARNING (true, ("commandFuncNextCraftingStage: PB null actor")); + WARNING (true, ("commandFuncNextCraftingStage: PB nullptr actor")); return; } PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); - if (player == NULL) + if (player == nullptr) { WARNING (true, ("commandFuncNextCraftingStage: no player object for actor " "%s", actor.getValueString().c_str())); @@ -5722,14 +5722,14 @@ static void commandFuncNextCraftingStage(const Command& , const NetworkId& actor static void commandFuncCreatePrototype(const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == NULL) + if (creature == nullptr) { - WARNING (true, ("commandFuncCreatePrototype: PB null actor")); + WARNING (true, ("commandFuncCreatePrototype: PB nullptr actor")); return; } PlayerObject * const player = PlayerCreatureController::getPlayerObject(creature); - if (player == NULL) + if (player == nullptr) { WARNING (true, ("commandFuncCreatePrototype: no player object for actor %s", actor.getValueString().c_str())); return; @@ -5756,14 +5756,14 @@ static void commandFuncCreatePrototype(const Command& , const NetworkId& actor, static void commandFuncCreateManfSchematic(const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == NULL) + if (creature == nullptr) { - WARNING (true, ("commandFuncCreateManfSchematic: PB null actor")); + WARNING (true, ("commandFuncCreateManfSchematic: PB nullptr actor")); return; } PlayerObject * const player = PlayerCreatureController::getPlayerObject(creature); - if (player == NULL) + if (player == nullptr) { WARNING (true, ("commandFuncCreateManfSchematic: no player object for actor %s", actor.getValueString().c_str())); return; @@ -5788,14 +5788,14 @@ static void commandFuncCreateManfSchematic(const Command& , const NetworkId& act static void commandFuncCancelCraftingSession(const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == NULL) + if (creature == nullptr) { - WARNING (true, ("commandFuncCancelCraftingSession: PB null actor")); + WARNING (true, ("commandFuncCancelCraftingSession: PB nullptr actor")); return; } PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); - if (player == NULL) + if (player == nullptr) { WARNING (true, ("commandFuncCancelCraftingSession: no player object for actor " "%s", actor.getValueString().c_str())); @@ -5810,14 +5810,14 @@ static void commandFuncCancelCraftingSession(const Command& , const NetworkId& a static void commandFuncStopCraftingSession(const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == NULL) + if (creature == nullptr) { - WARNING (true, ("commandFuncStopCraftingSession: PB null actor")); + WARNING (true, ("commandFuncStopCraftingSession: PB nullptr actor")); return; } PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); - if (player == NULL) + if (player == nullptr) { WARNING (true, ("commandFuncStopCraftingSession: no player object for actor " "%s", actor.getValueString().c_str())); @@ -5832,14 +5832,14 @@ static void commandFuncStopCraftingSession(const Command& , const NetworkId& act static void commandFuncRestartCraftingSession(const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == NULL) + if (creature == nullptr) { - WARNING (true, ("commandFuncRestartCraftingSession: PB null actor")); + WARNING (true, ("commandFuncRestartCraftingSession: PB nullptr actor")); return; } PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); - if (player == NULL) + if (player == nullptr) { WARNING (true, ("commandFuncRestartCraftingSession: no player object for actor " "%s", actor.getValueString().c_str())); @@ -5866,7 +5866,7 @@ static void commandFuncSetMatchMakingPersonalId(Command const &, NetworkId const PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(actor)); - if (playerObject != NULL) + if (playerObject != nullptr) { MatchMakingId matchMakingId; matchMakingId.unPackIntString(Unicode::wideToNarrow(params)); @@ -5885,7 +5885,7 @@ static void commandFuncSetMatchMakingCharacterId(Command const &, NetworkId cons PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(actor)); - if (playerObject != NULL) + if (playerObject != nullptr) { MatchMakingId matchMakingId; matchMakingId.unPackIntString(Unicode::wideToNarrow(params)); @@ -5902,7 +5902,7 @@ static void commandFuncAddFriend(Command const &, NetworkId const &actor, Networ { ServerObject * const serverObject = ServerObject::getServerObject(actor); - if (serverObject != NULL) + if (serverObject != nullptr) { size_t pos = 0; std::string name(nextStringParm(params, pos)); @@ -5924,7 +5924,7 @@ static void commandFuncRemoveFriend(Command const &, NetworkId const &actor, Net { ServerObject * const serverObject = ServerObject::getServerObject(actor); - if (serverObject != NULL) + if (serverObject != nullptr) { size_t pos = 0; std::string name(nextStringParm(params, pos)); @@ -5946,7 +5946,7 @@ static void commandFuncGetFriendList(Command const &, NetworkId const &actor, Ne { ServerObject * const serverObject = ServerObject::getServerObject(actor); - if (serverObject != NULL) + if (serverObject != nullptr) { std::string player(Chat::constructChatAvatarId(*serverObject).getFullName()); @@ -5962,7 +5962,7 @@ static void commandFuncAddIgnore(Command const &, NetworkId const &actor, Networ { ServerObject * const serverObject = ServerObject::getServerObject(actor); - if (serverObject != NULL) + if (serverObject != nullptr) { size_t pos = 0; std::string name(nextStringParm(params, pos)); @@ -5984,7 +5984,7 @@ static void commandFuncRemoveIgnore(Command const &, NetworkId const &actor, Net { ServerObject * const serverObject = ServerObject::getServerObject(actor); - if (serverObject != NULL) + if (serverObject != nullptr) { size_t pos = 0; std::string name(nextStringParm(params, pos)); @@ -6006,7 +6006,7 @@ static void commandFuncGetIgnoreList(Command const &, NetworkId const &actor, Ne { ServerObject * const serverObject = ServerObject::getServerObject(actor); - if (serverObject != NULL) + if (serverObject != nullptr) { std::string player(Chat::constructChatAvatarId(*serverObject).getFullName()); @@ -6022,7 +6022,7 @@ static void commandFuncRequestBiography(Command const &, NetworkId const &actor, { CreatureObject * const creatureObject = CreatureObject::getCreatureObject(actor); - if (creatureObject != NULL) + if (creatureObject != nullptr) { BiographyManager::requestBiography(target, creatureObject); } @@ -6069,9 +6069,9 @@ static void commandFuncSetBiography(Command const &, NetworkId const & actor, Ne static void commandFuncRequestCharacterSheetInfo(Command const &, NetworkId const &actor, NetworkId const &, Unicode::String const &) { const CreatureObject* const creatureActor = CreatureObject::getCreatureObject(actor); - if (creatureActor == NULL) + if (creatureActor == nullptr) { - WARNING (true, ("commandFuncRequestCharacterSheetInfo: null actor")); + WARNING (true, ("commandFuncRequestCharacterSheetInfo: nullptr actor")); return; } @@ -6090,7 +6090,7 @@ static void commandFuncRequestCharacterSheetInfo(Command const &, NetworkId cons if(bindId != NetworkId::cms_invalid) { const ServerObject* const bindObject = ServerObject::getServerObject(bindId); - if (bindObject != NULL) + if (bindObject != nullptr) { bindLoc = bindObject->getPosition_w(); bindPlanet = bindObject->getSceneId(); @@ -6142,7 +6142,7 @@ static void commandFuncRequestCharacterSheetInfo(Command const &, NetworkId cons houseNetworkId = cityHallOfMayorCity; const ServerObject* const resObject = ServerObject::getServerObject(houseNetworkId); - if (resObject != NULL) + if (resObject != nullptr) { resLoc = resObject->getPosition_w(); resPlanet = ServerWorld::getSceneId(); @@ -6201,13 +6201,13 @@ static void commandFuncRequestCharacterMatch(Command const &, NetworkId const &a static void commandFuncExtractObject(Command const &, NetworkId const &actor, NetworkId const & target, Unicode::String const ¶ms) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); - if (creature == NULL) + if (creature == nullptr) { - WARNING (true, ("commandFuncExtractObject: PB null actor")); + WARNING (true, ("commandFuncExtractObject: PB nullptr actor")); return; } - if (creature->getInventory() == NULL) + if (creature->getInventory() == nullptr) { WARNING (true, ("commandFuncExtractObject: actor %s has no inventory", actor.getValueString().c_str())); @@ -6215,9 +6215,9 @@ static void commandFuncExtractObject(Command const &, NetworkId const &actor, Ne } FactoryObject* const factory = dynamic_cast(NetworkIdManager::getObjectById (target)); - if (factory == NULL) + if (factory == nullptr) { - WARNING (true, ("commandFuncExtractObject: PB null target")); + WARNING (true, ("commandFuncExtractObject: PB nullptr target")); return; } @@ -6233,16 +6233,16 @@ static void commandFuncExtractObject(Command const &, NetworkId const &actor, Ne static void commandFuncRevokeSkill(Command const &, NetworkId const &actor, NetworkId const & target, Unicode::String const ¶ms) { CreatureObject * const creature = CreatureObject::getCreatureObject(actor); - if (creature == NULL) + if (creature == nullptr) { - WARNING (true, ("commandFuncRevokeSkill: PB null actor")); + WARNING (true, ("commandFuncRevokeSkill: PB nullptr actor")); return; } size_t pos = 0; std::string skillName = nextStringParm(params, pos); const SkillObject * skill = SkillManager::getInstance ().getSkill (skillName); - if (skill == NULL) + if (skill == nullptr) { WARNING (true, ("commandFuncRevokeSkill: can't revoke bad skill")); } @@ -6261,7 +6261,7 @@ static void commandFuncSetCurrentSkillTitle(Command const &, NetworkId const &ac CreatureObject * const creatureObject = CreatureObject::getCreatureObject(actor); PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(creatureObject); - if (playerObject != NULL) + if (playerObject != nullptr) { size_t pos = 0; std::string const &title = nextStringParm(params, pos); @@ -6378,7 +6378,7 @@ static void commandFuncSetCurrentSkillTitle(Command const &, NetworkId const &ac { SkillObject const *skillObject = (*iterSkillList); - if ( (skillObject != NULL) + if ( (skillObject != nullptr) && skillObject->isTitle() && (skillObject->getSkillName() == title)) { @@ -6402,16 +6402,16 @@ static void commandFuncSetCurrentSkillTitle(Command const &, NetworkId const &ac static void commandFuncRepair(Command const &, NetworkId const &actor, NetworkId const & target, Unicode::String const ¶ms) { CreatureObject* const creature = dynamic_cast(NetworkIdManager::getObjectById (actor)); - if (creature == NULL) + if (creature == nullptr) { - WARNING (true, ("commandFuncRepair: PB null actor")); + WARNING (true, ("commandFuncRepair: PB nullptr actor")); return; } TangibleObject* const object = dynamic_cast(NetworkIdManager::getObjectById (target)); - if (object == NULL) + if (object == nullptr) { - WARNING (true, ("commandFuncRepair: PB null target")); + WARNING (true, ("commandFuncRepair: PB nullptr target")); return; } } @@ -6424,7 +6424,7 @@ static void commandFuncToggleSearchableByCtsSourceGalaxy(Command const &, Networ PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(actor)); - if (playerObject != NULL) + if (playerObject != nullptr) { playerObject->toggleSearchableByCtsSourceGalaxy(); } @@ -6438,7 +6438,7 @@ static void commandFuncToggleDisplayLocationInSearchResults(Command const &, Net PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(actor)); - if (playerObject != NULL) + if (playerObject != nullptr) { playerObject->toggleDisplayLocationInSearchResults(); } @@ -6452,7 +6452,7 @@ static void commandFuncToggleAnonymous(Command const &, NetworkId const &actor, PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(actor)); - if (playerObject != NULL) + if (playerObject != nullptr) { playerObject->toggleAnonymous(); } @@ -6466,7 +6466,7 @@ static void commandFuncToggleHelper(Command const &, NetworkId const &actor, Net PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(actor)); - if (playerObject != NULL) + if (playerObject != nullptr) { playerObject->toggleHelper(); } @@ -6480,7 +6480,7 @@ static void commandFuncToggleRolePlay(Command const &, NetworkId const &actor, N PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(actor)); - if (playerObject != NULL) + if (playerObject != nullptr) { playerObject->toggleRolePlay(); } @@ -6493,7 +6493,7 @@ static void commandFuncToggleOutOfCharacter(Command const &, NetworkId const &ac { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(actor)); - if (playerObject != NULL) + if (playerObject != nullptr) { playerObject->toggleOutOfCharacter(); } @@ -6505,7 +6505,7 @@ static void commandFuncToggleLookingForWork(Command const &, NetworkId const &ac { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(actor)); - if (playerObject != NULL) + if (playerObject != nullptr) { playerObject->toggleLookingForWork(); } @@ -6520,7 +6520,7 @@ static void commandFuncToggleLookingForGroup(Command const &, NetworkId const &a PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(actor)); - if (playerObject != NULL) + if (playerObject != nullptr) { playerObject->toggleLookingForGroup(); } @@ -6534,7 +6534,7 @@ static void commandFuncToggleAwayFromKeyBoard(Command const &, NetworkId const & PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(actor)); - if (playerObject != NULL) + if (playerObject != nullptr) { playerObject->toggleAwayFromKeyBoard(); } @@ -6546,7 +6546,7 @@ static void commandFuncToggleDisplayingFactionRank(Command const &, NetworkId co { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(actor)); - if (playerObject != NULL) + if (playerObject != nullptr) { playerObject->toggleDisplayingFactionRank(); } @@ -6558,7 +6558,7 @@ static void commandFuncReport(Command const &, NetworkId const &actor, NetworkId { CreatureObject const * const reportingCreatureObject = CreatureObject::getCreatureObject(actor); - if (reportingCreatureObject != NULL) + if (reportingCreatureObject != nullptr) { if (ReportManager::isThrottled(actor)) { @@ -6635,16 +6635,16 @@ static void commandFuncReport(Command const &, NetworkId const &actor, NetworkId static void commandFuncNpcConversationStart(Command const &, NetworkId const &actor, NetworkId const & target, Unicode::String const ¶ms) { ServerObject * const actorObject = safe_cast(NetworkIdManager::getObjectById(actor)); - CreatureObject * const player = actorObject != NULL ? actorObject->asCreatureObject() : NULL; - if (player == NULL) + CreatureObject * const player = actorObject != nullptr ? actorObject->asCreatureObject() : nullptr; + if (player == nullptr) { DEBUG_WARNING(true, ("commandFuncNpcConversationStart: couldn't find actor")); return; } ServerObject * const npcObject = safe_cast(NetworkIdManager::getObjectById(target)); - TangibleObject * const npc = npcObject != NULL ? npcObject->asTangibleObject() : NULL; - if (npc == NULL) + TangibleObject * const npc = npcObject != nullptr ? npcObject->asTangibleObject() : nullptr; + if (npc == nullptr) { DEBUG_WARNING(true, ("commandFuncNpcConversationStart: Couldn't find npc to converse with")); return; @@ -6678,8 +6678,8 @@ static void commandFuncNpcConversationStart(Command const &, NetworkId const &ac static void commandFuncNpcConversationStop(Command const &, NetworkId const &actor, NetworkId const & target, Unicode::String const ¶ms) { ServerObject * const actorObject = safe_cast(NetworkIdManager::getObjectById(actor)); - TangibleObject * const player = actorObject != NULL ? actorObject->asTangibleObject(): NULL; - if (player == NULL) + TangibleObject * const player = actorObject != nullptr ? actorObject->asTangibleObject(): nullptr; + if (player == nullptr) { DEBUG_WARNING(true, ("commandFuncNpcConversationStop: couldn't find actor")); return; @@ -6693,7 +6693,7 @@ static void commandFuncNpcConversationSelect(Command const &, NetworkId const &a { Object * const actorObject = NetworkIdManager::getObjectById(actor); CreatureObject * const player = dynamic_cast(actorObject); - if (player == NULL) + if (player == nullptr) { DEBUG_WARNING(true, ("commandFuncNpcConversationStop: couldn't find actor")); return; @@ -6709,7 +6709,7 @@ static void commandFuncNpcConversationSelect(Command const &, NetworkId const &a static void commandFuncServerDestroyObject (Command const &, NetworkId const & actor, NetworkId const & target, Unicode::String const & params) { CreatureObject * const player = dynamic_cast (NetworkIdManager::getObjectById (actor)); - if (player == NULL) + if (player == nullptr) { DEBUG_WARNING (true, ("commandFuncServerDestroyObject: couldn't find actor")); return; @@ -6792,11 +6792,11 @@ static void commandFuncSetSpokenLanguage(Command const &, NetworkId const &actor Object * const object = NetworkIdManager::getObjectById(actor); CreatureObject * const creatureObject = dynamic_cast(object); - if (creatureObject != NULL) + if (creatureObject != nullptr) { PlayerObject *playerObject = PlayerCreatureController::getPlayerObject(creatureObject); - if (playerObject != NULL) + if (playerObject != nullptr) { size_t pos = 0; int const languageId = nextIntParm(params, pos); @@ -6831,14 +6831,14 @@ static void commandFuncUnstick(Command const &, NetworkId const &actor, NetworkI { Object * const object = NetworkIdManager::getObjectById(actor); CreatureObject * const creatureObject = dynamic_cast(object); - if (creatureObject != NULL) + if (creatureObject != nullptr) { if (!ShipObject::getContainingShipObject(creatureObject)) // no unsticking in ships { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(creatureObject); if (playerObject) { - Chat::sendSystemMessageSimple(*creatureObject, SharedStringIds::unstick_in_progress, NULL); + Chat::sendSystemMessageSimple(*creatureObject, SharedStringIds::unstick_in_progress, nullptr); if (!playerObject->getIsUnsticking()) { Vector position = creatureObject->getPosition_p(); @@ -7324,8 +7324,8 @@ static void commandFuncInstallShipComponents(Command const &, NetworkId const & //params for installShipComponent are " " Object const * const actorObj = NetworkIdManager::getObjectById(actor); - ServerObject const * const actorServerObj = actorObj ? actorObj->asServerObject() : NULL; - CreatureObject const * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : NULL; + ServerObject const * const actorServerObj = actorObj ? actorObj->asServerObject() : nullptr; + CreatureObject const * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : nullptr; if(!actorCreature) { return; @@ -7338,7 +7338,7 @@ static void commandFuncInstallShipComponents(Command const &, NetworkId const & if(!client->isGod()) { Object * const targetObj = NetworkIdManager::getObjectById(target); - ServerObject * const targetServerObj = targetObj ? targetObj->asServerObject() : NULL; + ServerObject * const targetServerObj = targetObj ? targetObj->asServerObject() : nullptr; if( !targetServerObj || ((targetServerObj->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space) && (targetServerObj->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space_npe)) ) return; @@ -7351,16 +7351,16 @@ static void commandFuncInstallShipComponents(Command const &, NetworkId const & size_t pos = 0; NetworkId const & shipId = nextOidParm(params, pos); Object * const shipObj = NetworkIdManager::getObjectById(shipId); - ServerObject * const shipServerObj = shipObj ? shipObj->asServerObject() : NULL; - ShipObject * const ship = shipServerObj ? shipServerObj->asShipObject() : NULL; + ServerObject * const shipServerObj = shipObj ? shipObj->asServerObject() : nullptr; + ShipObject * const ship = shipServerObj ? shipServerObj->asShipObject() : nullptr; if(!ship) return; ShipChassisSlotType::Type const slotType = static_cast(nextIntParm(params, pos)); NetworkId const & componentId = nextOidParm(params, pos); Object * const componentObj = NetworkIdManager::getObjectById(componentId); - ServerObject * const componentServerObj = componentObj ? componentObj->asServerObject() : NULL; - TangibleObject * const component = componentServerObj ? componentServerObj->asTangibleObject() : NULL; + ServerObject * const componentServerObj = componentObj ? componentObj->asServerObject() : nullptr; + TangibleObject * const component = componentServerObj ? componentServerObj->asTangibleObject() : nullptr; if(!component) { return; @@ -7409,8 +7409,8 @@ static void commandFuncUninstallShipComponents(Command const &, NetworkId const //params for uninstallShipComponent are " " Object * const actorObj = NetworkIdManager::getObjectById(actor); - ServerObject * const actorServerObj = actorObj ? actorObj->asServerObject() : NULL; - CreatureObject * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : NULL; + ServerObject * const actorServerObj = actorObj ? actorObj->asServerObject() : nullptr; + CreatureObject * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : nullptr; if(!actorCreature) return; ServerObject * const actorInv = actorCreature->getInventory(); @@ -7424,7 +7424,7 @@ static void commandFuncUninstallShipComponents(Command const &, NetworkId const if(!client->isGod()) { Object * const targetObj = NetworkIdManager::getObjectById(target); - ServerObject * const targetServerObj = targetObj ? targetObj->asServerObject() : NULL; + ServerObject * const targetServerObj = targetObj ? targetObj->asServerObject() : nullptr; if(!targetServerObj || ((targetServerObj->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space) && (targetServerObj->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space_npe)) ) @@ -7456,8 +7456,8 @@ static void commandFuncUninstallShipComponents(Command const &, NetworkId const size_t pos = 0; NetworkId const & shipId = nextOidParm(params, pos); Object * const shipObj = NetworkIdManager::getObjectById(shipId); - ServerObject * const shipServerObj = shipObj ? shipObj->asServerObject() : NULL; - ShipObject * const ship = shipServerObj ? shipServerObj->asShipObject() : NULL; + ServerObject * const shipServerObj = shipObj ? shipObj->asServerObject() : nullptr; + ShipObject * const ship = shipServerObj ? shipServerObj->asShipObject() : nullptr; if(!ship) return; @@ -7474,8 +7474,8 @@ static void commandFuncInsertItemIntoShipComponentSlot(Command const &, NetworkI //params for insertItemIntoShipComponentSlot are " " Object * const actorObj = NetworkIdManager::getObjectById(actor); - ServerObject * const actorServerObj = actorObj ? actorObj->asServerObject() : NULL; - CreatureObject * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : NULL; + ServerObject * const actorServerObj = actorObj ? actorObj->asServerObject() : nullptr; + CreatureObject * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : nullptr; if(!actorCreature) return; @@ -7486,7 +7486,7 @@ static void commandFuncInsertItemIntoShipComponentSlot(Command const &, NetworkI if(!client->isGod()) { Object * const targetObj = NetworkIdManager::getObjectById(target); - ServerObject * const targetServerObj = targetObj ? targetObj->asServerObject() : NULL; + ServerObject * const targetServerObj = targetObj ? targetObj->asServerObject() : nullptr; if(!targetServerObj || ((targetServerObj->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space) && (targetServerObj->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space_npe)) ) return; @@ -7499,8 +7499,8 @@ static void commandFuncInsertItemIntoShipComponentSlot(Command const &, NetworkI size_t pos = 0; NetworkId const & shipId = nextOidParm(params, pos); Object * const shipObj = NetworkIdManager::getObjectById(shipId); - ServerObject * const shipServerObj = shipObj ? shipObj->asServerObject() : NULL; - ShipObject * const ship = shipServerObj ? shipServerObj->asShipObject() : NULL; + ServerObject * const shipServerObj = shipObj ? shipObj->asServerObject() : nullptr; + ShipObject * const ship = shipServerObj ? shipServerObj->asShipObject() : nullptr; if(!ship) return; @@ -7527,8 +7527,8 @@ static void commandFuncAssociateDroidControlDeviceWithShip(Command const &, Netw //params for associateDroidControlDeviceWithShip are " " Object const * const actorObj = NetworkIdManager::getObjectById(actor); - ServerObject const * const actorServerObj = actorObj ? actorObj->asServerObject() : NULL; - CreatureObject const * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : NULL; + ServerObject const * const actorServerObj = actorObj ? actorObj->asServerObject() : nullptr; + CreatureObject const * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : nullptr; if (!actorCreature) return; @@ -7539,7 +7539,7 @@ static void commandFuncAssociateDroidControlDeviceWithShip(Command const &, Netw if(!client->isGod()) { Object * const targetObj = NetworkIdManager::getObjectById(target); - ServerObject * const targetServerObj = targetObj ? targetObj->asServerObject() : NULL; + ServerObject * const targetServerObj = targetObj ? targetObj->asServerObject() : nullptr; if(!targetServerObj || ((targetServerObj->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space) && (targetServerObj->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space_npe)) ) return; @@ -7552,8 +7552,8 @@ static void commandFuncAssociateDroidControlDeviceWithShip(Command const &, Netw size_t pos = 0; NetworkId const & shipId = nextOidParm(params, pos); Object * const shipObj = NetworkIdManager::getObjectById(shipId); - ServerObject * const shipServerObj = shipObj ? shipObj->asServerObject() : NULL; - ShipObject * const ship = shipServerObj ? shipServerObj->asShipObject() : NULL; + ServerObject * const shipServerObj = shipObj ? shipObj->asServerObject() : nullptr; + ShipObject * const ship = shipServerObj ? shipServerObj->asShipObject() : nullptr; if(!ship) return; @@ -7581,8 +7581,8 @@ static void commandFuncAssociateDroidControlDeviceWithShip(Command const &, Netw static void commandFuncServerAsteroidDataListen(Command const &, NetworkId const & actor, NetworkId const & , Unicode::String const & ) { Object const * const actorObj = NetworkIdManager::getObjectById(actor); - ServerObject const * const actorServerObj = actorObj ? actorObj->asServerObject() : NULL; - CreatureObject const * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : NULL; + ServerObject const * const actorServerObj = actorObj ? actorObj->asServerObject() : nullptr; + CreatureObject const * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : nullptr; if(!actorCreature) return; @@ -7594,8 +7594,8 @@ static void commandFuncServerAsteroidDataListen(Command const &, NetworkId const static void commandFuncServerAsteroidDataStopListening(Command const &, NetworkId const & actor, NetworkId const & , Unicode::String const & ) { Object const * const actorObj = NetworkIdManager::getObjectById(actor); - ServerObject const * const actorServerObj = actorObj ? actorObj->asServerObject() : NULL; - CreatureObject const * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : NULL; + ServerObject const * const actorServerObj = actorObj ? actorObj->asServerObject() : nullptr; + CreatureObject const * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : nullptr; if(!actorCreature) return; @@ -7621,8 +7621,8 @@ static void commandFuncBoosterOff(Command const &, NetworkId const & actor, Netw static void commandFuncSetFormation(Command const &, NetworkId const & actor, NetworkId const &, Unicode::String const & params) { Object * const o = NetworkIdManager::getObjectById(actor); - ServerObject * const so = o ? o->asServerObject() : NULL; - CreatureObject * const actorCreature = so ? so->asCreatureObject() : NULL; + ServerObject * const so = o ? o->asServerObject() : nullptr; + CreatureObject * const actorCreature = so ? so->asCreatureObject() : nullptr; if(actorCreature) { GroupObject * const group = actorCreature->getGroup(); @@ -7676,15 +7676,15 @@ static void commandFuncUnDock(Command const &, NetworkId const & actor, NetworkI { Object * const object = NetworkIdManager::getObjectById(actor); - if (object != NULL) + if (object != nullptr) { ShipObject * const shipObject = ShipObject::getContainingShipObject(object->asServerObject()); - if (shipObject != NULL) + if (shipObject != nullptr) { ShipController * const shipController = dynamic_cast(shipObject->getController()); - if (shipController != NULL) + if (shipController != nullptr) { shipController->unDock(); } @@ -7695,12 +7695,12 @@ static void commandFuncUnDock(Command const &, NetworkId const & actor, NetworkI } else { - WARNING(true, ("commandFuncUnDock() Undock requested on an object(%s) contained by a NULL ShipObject.", object->getDebugInformation().c_str())); + WARNING(true, ("commandFuncUnDock() Undock requested on an object(%s) contained by a nullptr ShipObject.", object->getDebugInformation().c_str())); } } else { - WARNING(true, ("commandFuncUnDock() Undock requested on a NULL object(%s).", actor.getValueString().c_str())); + WARNING(true, ("commandFuncUnDock() Undock requested on a nullptr object(%s).", actor.getValueString().c_str())); } } @@ -7709,7 +7709,7 @@ static void commandFuncUnDock(Command const &, NetworkId const & actor, NetworkI static void commandFuncLaunchIntoSpace(Command const &, NetworkId const & actor, NetworkId const & target, Unicode::String const & params) { ServerObject * const actorServerObj = safe_cast(NetworkIdManager::getObjectById(actor)); - CreatureObject * const actorCreature = actorServerObj != NULL ? actorServerObj->asCreatureObject() : NULL; + CreatureObject * const actorCreature = actorServerObj != nullptr ? actorServerObj->asCreatureObject() : nullptr; if(!actorCreature) { WARNING(true, ("No actorCreature in commandFuncLaunchIntoSpace")); @@ -7725,7 +7725,7 @@ static void commandFuncLaunchIntoSpace(Command const &, NetworkId const & actor, //target must be a space terminal Object const * const o = NetworkIdManager::getObjectById(target); - ServerObject const * const so = o ? o->asServerObject() : NULL; + ServerObject const * const so = o ? o->asServerObject() : nullptr; if(!so) { StringId invalidTargetId("player_utility", "target_not_server_object"); @@ -7759,7 +7759,7 @@ static void commandFuncLaunchIntoSpace(Command const &, NetworkId const & actor, return; } Object * const terminalO = NetworkIdManager::getObjectById(target); - ServerObject * const terminalSO = terminalO ? terminalO->asServerObject() : NULL; + ServerObject * const terminalSO = terminalO ? terminalO->asServerObject() : nullptr; if(terminalSO) { std::vector networkIds; @@ -7824,7 +7824,7 @@ static void commandFuncLaunchIntoSpace(Command const &, NetworkId const & actor, static void commandFuncAcceptQuest(Command const &, NetworkId const & actor, NetworkId const & target, Unicode::String const & params) { ServerObject * const actorServerObj = safe_cast(NetworkIdManager::getObjectById(actor)); - CreatureObject * const actorCreature = actorServerObj != NULL ? actorServerObj->asCreatureObject() : NULL; + CreatureObject * const actorCreature = actorServerObj != nullptr ? actorServerObj->asCreatureObject() : nullptr; if(!actorCreature) { WARNING(true, ("No actorCreature in commandFuncAcceptQuest")); @@ -7851,7 +7851,7 @@ static void commandFuncAcceptQuest(Command const &, NetworkId const & actor, Net static void commandFuncReceiveReward(Command const &, NetworkId const & actor, NetworkId const & target, Unicode::String const & params) { ServerObject * const actorServerObj = safe_cast(NetworkIdManager::getObjectById(actor)); - CreatureObject * const actorCreature = actorServerObj != NULL ? actorServerObj->asCreatureObject() : NULL; + CreatureObject * const actorCreature = actorServerObj != nullptr ? actorServerObj->asCreatureObject() : nullptr; if(!actorCreature) { WARNING(true, ("No actorCreature in commandFuncReceiveReward")); @@ -7895,7 +7895,7 @@ static void commandFuncAbandonQuest(Command const &, NetworkId const & actor, Ne if(QuestManager::isQuestAbandonable(questName)) { ServerObject * const actorServerObj = safe_cast(NetworkIdManager::getObjectById(actor)); - CreatureObject * const actorCreature = actorServerObj != NULL ? actorServerObj->asCreatureObject() : NULL; + CreatureObject * const actorCreature = actorServerObj != nullptr ? actorServerObj->asCreatureObject() : nullptr; if(actorCreature) { PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(actorCreature); @@ -7922,7 +7922,7 @@ static void commandFuncAbandonQuest(Command const &, NetworkId const & actor, Ne static void commandFuncExchangeListCredits(Command const &, NetworkId const &actor, NetworkId const &target, Unicode::String const ¶ms) { ServerObject * const actorServerObj = safe_cast(NetworkIdManager::getObjectById(actor)); - CreatureObject * const actorCreature = actorServerObj != NULL ? actorServerObj->asCreatureObject() : NULL; + CreatureObject * const actorCreature = actorServerObj != nullptr ? actorServerObj->asCreatureObject() : nullptr; if(!actorCreature) { WARNING(true, ("No actorCreature in commandFuncReceiveReward")); @@ -8680,7 +8680,7 @@ static void commandFuncOccupyUnlockedSlot(Command const &, NetworkId const &acto } // check to see if there is a cooldown is in effect for the command - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); if (!gmClient->isGod() && gm->getObjVars().hasItem("timeNextOccupyVacateUnlockedSlotCommandAllowed") && (gm->getObjVars().getType("timeNextOccupyVacateUnlockedSlotCommandAllowed") == DynamicVariable::INT)) { int timeNextOccupyVacateUnlockedSlotCommandAllowed = 0; @@ -8746,7 +8746,7 @@ static void commandFuncVacateUnlockedSlot(Command const &, NetworkId const &acto } // check to see if there is a cooldown is in effect for the command - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); if (!gmClient->isGod() && gm->getObjVars().hasItem("timeNextOccupyVacateUnlockedSlotCommandAllowed") && (gm->getObjVars().getType("timeNextOccupyVacateUnlockedSlotCommandAllowed") == DynamicVariable::INT)) { int timeNextOccupyVacateUnlockedSlotCommandAllowed = 0; @@ -8834,7 +8834,7 @@ static void commandFuncSwapUnlockedSlot(Command const &, NetworkId const &actor, } // check to see if there is a cooldown is in effect for the command - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); if (!gmClient->isGod() && gm->getObjVars().hasItem("timeNextOccupyVacateUnlockedSlotCommandAllowed") && (gm->getObjVars().getType("timeNextOccupyVacateUnlockedSlotCommandAllowed") == DynamicVariable::INT)) { int timeNextOccupyVacateUnlockedSlotCommandAllowed = 0; @@ -8902,7 +8902,7 @@ static void commandFuncPickupAllRoomItemsIntoInventory(Command const &, NetworkI return; // don't allow multiple /pickupAllRoomItemsIntoInventory and/or /dropAllInventoryItemsIntoRoom - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); int pickupDropAllItemsOperationTimeout = 0; if (targetObj->getObjVars().getItem("pickupDropAllItemsOperation.timeout", pickupDropAllItemsOperationTimeout) && (pickupDropAllItemsOperationTimeout > timeNow)) { @@ -9051,7 +9051,7 @@ static void commandFuncDropAllInventoryItemsIntoRoom(Command const &, NetworkId return; // don't allow multiple /pickupAllRoomItemsIntoInventory and/or /dropAllInventoryItemsIntoRoom - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); int pickupDropAllItemsOperationTimeout = 0; if (targetObj->getObjVars().getItem("pickupDropAllItemsOperation.timeout", pickupDropAllItemsOperationTimeout) && (pickupDropAllItemsOperationTimeout > timeNow)) { @@ -9255,7 +9255,7 @@ static void commandFuncRestoreDecorationLayout(Command const &, NetworkId const } // don't allow another restore on the pob while one is still in progress - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); int restoreDecorationOperationTimeout = 0; if (targetObj->getObjVars().getItem("restoreDecorationOperation.timeout", restoreDecorationOperationTimeout) && (restoreDecorationOperationTimeout > timeNow)) { @@ -9330,7 +9330,7 @@ static void commandFuncAreaPickRandomPlayer(Command const &, NetworkId const &ac if (!client) return; - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); if (!client->isGod() && targetObj->getObjVars().hasItem("timeNextAreaPickRandomPlayerCommandAllowed") && (targetObj->getObjVars().getType("timeNextAreaPickRandomPlayerCommandAllowed") == DynamicVariable::INT)) { int timeNextAreaPickRandomPlayerCommandAllowed = 0; @@ -9352,7 +9352,7 @@ static void commandFuncAreaPickRandomPlayer(Command const &, NetworkId const &ac if (!params.empty()) { Unicode::UnicodeStringVector tokens; - if (Unicode::tokenize(Unicode::toLower(params), tokens, NULL, NULL) && !tokens.empty()) + if (Unicode::tokenize(Unicode::toLower(params), tokens, nullptr, nullptr) && !tokens.empty()) { static Unicode::String const paramsPoint1 = Unicode::narrowToWide("-point"); static Unicode::String const paramsPoint2 = Unicode::narrowToWide("point"); @@ -9477,7 +9477,7 @@ static void commandFuncRoomPickRandomPlayer(Command const &, NetworkId const &ac if (!client) return; - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); if (!client->isGod() && targetObj->getObjVars().hasItem("timeNextRoomPickRandomPlayerCommandAllowed") && (targetObj->getObjVars().getType("timeNextRoomPickRandomPlayerCommandAllowed") == DynamicVariable::INT)) { int timeNextRoomPickRandomPlayerCommandAllowed = 0; @@ -9498,7 +9498,7 @@ static void commandFuncRoomPickRandomPlayer(Command const &, NetworkId const &ac if (!params.empty()) { Unicode::UnicodeStringVector tokens; - if (Unicode::tokenize(Unicode::toLower(params), tokens, NULL, NULL) && !tokens.empty()) + if (Unicode::tokenize(Unicode::toLower(params), tokens, nullptr, nullptr) && !tokens.empty()) { static Unicode::String const paramsPoint1 = Unicode::narrowToWide("-point"); static Unicode::String const paramsPoint2 = Unicode::narrowToWide("point"); diff --git a/engine/server/library/serverGame/src/shared/command/CommandQueue.cpp b/engine/server/library/serverGame/src/shared/command/CommandQueue.cpp index d581b8ae..913fa7e0 100755 --- a/engine/server/library/serverGame/src/shared/command/CommandQueue.cpp +++ b/engine/server/library/serverGame/src/shared/command/CommandQueue.cpp @@ -309,11 +309,11 @@ void CommandQueue::executeCommandQueue() { CommandQueueEntry &entry = *(m_queue.begin()); - // try to recover from having a null command + // try to recover from having a nullptr command // maybe this should result in a fatal error? if ( entry.m_command == 0 ) { - WARNING( true, ( "executeCommandQueue: entry.m_command was NULL! WTF?\n" ) ); + WARNING( true, ( "executeCommandQueue: entry.m_command was nullptr! WTF?\n" ) ); m_queue.pop(); m_state = State_Waiting; m_nextEventTime = 0.f; @@ -387,7 +387,7 @@ void CommandQueue::executeCommandQueue() // switch state might have removed elements from the queue and invalidated entry // so we can't assume that we're still safe - if(!m_queue.empty() && (&(*(m_queue.begin())) == &entry) && m_queue.begin()->m_command != NULL) + if(!m_queue.empty() && (&(*(m_queue.begin())) == &entry) && m_queue.begin()->m_command != nullptr) { handleEntryRemoved(*(m_queue.begin()), true); m_queue.pop(); @@ -458,7 +458,7 @@ void CommandQueue::updateClient(TimerClass timerClass ) { CreatureObject * const creatureOwner = getServerOwner().asCreatureObject(); - if ( (creatureOwner == NULL) + if ( (creatureOwner == nullptr) || !creatureOwner->getClient()) { return; @@ -475,7 +475,7 @@ void CommandQueue::updateClient(TimerClass timerClass ) if ( entry.m_command == 0 ) // woah that's bad news! { - WARNING( true, ( "CommandQueue::updateClient(): command was NULL!\n" ) ); + WARNING( true, ( "CommandQueue::updateClient(): command was nullptr!\n" ) ); return; } @@ -539,7 +539,7 @@ void CommandQueue::notifyClient() { CreatureObject * const creatureOwner = getServerOwner().asCreatureObject(); - if ( (creatureOwner == NULL) + if ( (creatureOwner == nullptr) || !creatureOwner->getClient()) { return; @@ -555,7 +555,7 @@ void CommandQueue::notifyClient() if ( entry.m_command == 0 ) { - WARNING( true, ( "CommandQueue::notifyClient(): command was NULL!\n" ) ); + WARNING( true, ( "CommandQueue::notifyClient(): command was nullptr!\n" ) ); return; } @@ -612,7 +612,7 @@ bool CommandQueue::doWarmupTrigger(const CommandQueueEntry &entry ) CreatureObject * const creatureOwner = getServerOwner().asCreatureObject(); - if (creatureOwner != NULL) + if (creatureOwner != nullptr) { creatureOwner->doWarmupChecks( *entry.m_command, entry.m_targetId, entry.m_params, m_status, m_statusDetail ); @@ -620,7 +620,7 @@ bool CommandQueue::doWarmupTrigger(const CommandQueueEntry &entry ) if ( m_status == Command::CEC_Success ) { - FATAL( entry.m_command == 0, ( "entry had a null command\n" ) ); + FATAL( entry.m_command == 0, ( "entry had a nullptr command\n" ) ); std::vector timeValues; timeValues.push_back( entry.m_command->m_warmTime ); @@ -659,7 +659,7 @@ uint32 CommandQueue::getCurrentCommand() const if ( entry.m_command == 0 ) { - WARNING( true, ( "CommandQueue::getCurrentCommand(): command was NULL!\n" ) ); + WARNING( true, ( "CommandQueue::getCurrentCommand(): command was nullptr!\n" ) ); return 0; } @@ -680,7 +680,7 @@ void CommandQueue::switchState() if ( entry.m_command == 0 ) { - WARNING( true, ( "CommandQueue::switchState(): command was NULL!\n" ) ); + WARNING( true, ( "CommandQueue::switchState(): command was nullptr!\n" ) ); return; } @@ -726,7 +726,7 @@ void CommandQueue::switchState() bool const targetIsAuthoritative = target && target->isAuthoritative(); REPORT_LOG(true, ("CommandQueue::switchState():QUEUE_ENTRY_COMMAND: commandName=[%s] commandHash=[%lu] owner=[%s][%s][%s] target=[%s][%s][%s] sequenceId=[%lu] params=[%s] clearable=[%s] priority=[%d]\n", - entryCopy.m_command ? entryCopy.m_command->m_commandName.c_str() : "NULL", + entryCopy.m_command ? entryCopy.m_command->m_commandName.c_str() : "nullptr", entryCopy.m_command ? entryCopy.m_command->m_commandHash : 0, NameManager::getInstance().getPlayerName(getOwner().getNetworkId()).c_str(), getOwner().getNetworkId().getValueString().c_str(), @@ -746,7 +746,7 @@ void CommandQueue::switchState() for (; itEntry != m_queue.end(); ++itEntry) { - REPORT_LOG(true, ("CommandQueue::switchState():QUEUE_ENTRY_QUEUE: commandName=[%s]\n", itEntry->m_command ? itEntry->m_command->m_commandName.c_str() : "NULL")); + REPORT_LOG(true, ("CommandQueue::switchState():QUEUE_ENTRY_QUEUE: commandName=[%s]\n", itEntry->m_command ? itEntry->m_command->m_commandName.c_str() : "nullptr")); } } #endif @@ -838,7 +838,7 @@ void CommandQueue::switchState() bool const targetIsAuthoritative = target && target->isAuthoritative(); REPORT_LOG(true, ("CommandQueue::switchState():QUEUE_ENTRY_COMMAND: commandName=[%s] commandHash=[%lu] owner=[%s][%s][%s] target=[%s][%s][%s] sequenceId=[%lu] params=[%s] clearable=[%s] priority=[%d]\n", - entryCopy.m_command ? entryCopy.m_command->m_commandName.c_str() : "NULL", + entryCopy.m_command ? entryCopy.m_command->m_commandName.c_str() : "nullptr", entryCopy.m_command ? entryCopy.m_command->m_commandHash : 0, NameManager::getInstance().getPlayerName(getOwner().getNetworkId()).c_str(), getOwner().getNetworkId().getValueString().c_str(), @@ -858,7 +858,7 @@ void CommandQueue::switchState() for (; itEntry != m_queue.end(); ++itEntry) { - REPORT_LOG(true, ("CommandQueue::switchState():QUEUE_ENTRY_QUEUE: commandName=[%s]\n", itEntry->m_command ? itEntry->m_command->m_commandName.c_str() : "NULL")); + REPORT_LOG(true, ("CommandQueue::switchState():QUEUE_ENTRY_QUEUE: commandName=[%s]\n", itEntry->m_command ? itEntry->m_command->m_commandName.c_str() : "nullptr")); } } #endif @@ -1160,7 +1160,7 @@ void CommandQueue::notifyClientOfCommandRemoval(uint32 sequenceId, float waitTim CreatureObject * const creatureOwner = getServerOwner().asCreatureObject(); - if ( (creatureOwner != NULL) + if ( (creatureOwner != nullptr) && creatureOwner->getClient() && (sequenceId != 0)) { @@ -1359,7 +1359,7 @@ void CommandQueue::executeCommand(Command const &command, NetworkId const &targe CreatureObject * const creatureOwner = getServerOwner().asCreatureObject(); - if (creatureOwner != NULL) + if (creatureOwner != nullptr) { CreatureController * const creatureController = creatureOwner->getCreatureController(); if (creatureController && creatureController->getSecureTrade()) @@ -1399,7 +1399,7 @@ void CommandQueue::executeCommand(Command const &command, NetworkId const &targe TangibleObject * const tangibleOwner = getServerOwner().asTangibleObject(); - if (tangibleOwner != NULL) + if (tangibleOwner != nullptr) { // Really execute the command - swap targets if necessary, and call // forceExecuteCommand (which will handle messaging if not authoritative) @@ -1440,7 +1440,7 @@ CommandQueue * CommandQueue::getCommandQueue(Object & object) { Property * const property = object.getProperty(getClassPropertyId()); - return (property != NULL) ? (static_cast(property)) : NULL; + return (property != nullptr) ? (static_cast(property)) : nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/command/CommandQueue.h b/engine/server/library/serverGame/src/shared/command/CommandQueue.h index bedf3717..03c861e0 100755 --- a/engine/server/library/serverGame/src/shared/command/CommandQueue.h +++ b/engine/server/library/serverGame/src/shared/command/CommandQueue.h @@ -218,7 +218,7 @@ public: void resetCooldowns(); // debug diagnostic - void spew(std::string * output = NULL); + void spew(std::string * output = nullptr); private: CommandQueue(CommandQueue const &); diff --git a/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesMarket.cpp b/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesMarket.cpp index d2d55dfd..7529726f 100755 --- a/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesMarket.cpp +++ b/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesMarket.cpp @@ -201,7 +201,7 @@ namespace CommoditiesMarketNamespace Container::ContainerErrorCode tmp = Container::CEC_Success; ServerObject *bazaarContainer = auctionContainer.getBazaarContainer(); - if (!bazaarContainer || !ContainerInterface::canTransferTo(bazaarContainer, item, NULL, tmp)) + if (!bazaarContainer || !ContainerInterface::canTransferTo(bazaarContainer, item, nullptr, tmp)) { errorCode = ar_INVALID_ITEM_ID; } @@ -326,7 +326,7 @@ bool CommoditiesMarketNamespace::isVendorItemRestriction(ServerObject const & it return false; } - ItemRestriction const * itemRestriction = NULL; + ItemRestriction const * itemRestriction = nullptr; std::map::const_iterator const iterFind = itemRestrictionList.find(itemRestrictionFile); if (iterFind != itemRestrictionList.end()) @@ -1068,7 +1068,7 @@ void CommoditiesMarket::getCommoditiesServerConnection() if (ObjectIdManager::hasAvailableObjectId()) { s_market = new CommoditiesServerConnection(ConfigServerGame::getCommoditiesServerServiceBindInterface(), static_cast(ConfigServerGame::getCommoditiesServerServiceBindPort())); - s_timeMarketConnectionCreated = ::time(NULL); + s_timeMarketConnectionCreated = ::time(nullptr); } } @@ -1082,10 +1082,10 @@ int CommoditiesMarket::getCommoditiesServerConnectionAgeSeconds() if (s_timeMarketConnectionCreated <= 0) return 0; - if (s_market == NULL) + if (s_market == nullptr) return 0; - return static_cast(::time(NULL) - s_timeMarketConnectionCreated); + return static_cast(::time(nullptr) - s_timeMarketConnectionCreated); } // ---------------------------------------------------------------------- @@ -1295,7 +1295,7 @@ void CommoditiesMarket::onAddAuction(int sequence, int32 result, const NetworkId CreatureObject * const auctionCreator = dynamic_cast(NetworkIdManager::getObjectById(auctionOwnerId)); ServerObject * const item = dynamic_cast(NetworkIdManager::getObjectById(itemId)); - Client *client = NULL; + Client *client = nullptr; if (auctionCreator) client = auctionCreator->getClient(); @@ -1347,7 +1347,7 @@ void CommoditiesMarket::onAddAuction(int sequence, int32 result, const NetworkId if (container) { Container::ContainerErrorCode tmp = Container::CEC_Success; - bool result = ContainerInterface::transferItemToVolumeContainer(*container,*item, NULL, tmp); + bool result = ContainerInterface::transferItemToVolumeContainer(*container,*item, nullptr, tmp); if (!result) { LOG("CustomerService", ("Auction: Player %s transfer of item (%Ld) to auction container (%Ld) failed with code %d", @@ -2536,7 +2536,7 @@ void CommoditiesMarket::checkPendingLoads(const NetworkId &itemId) bool transferAllowed = true; Container::ContainerErrorCode error = Container::CEC_Success; - transferAllowed = ContainerInterface::canTransferTo(targetContainer, *item, NULL, error); + transferAllowed = ContainerInterface::canTransferTo(targetContainer, *item, nullptr, error); if (!transferAllowed) { @@ -2603,11 +2603,11 @@ void CommoditiesMarket::onGetItemReply(int32 result, int32 requestId, NetworkId LOG("AuctionRetrieval", ("CommoditiesMarket::received onGetItemReply for loading object %s for retrieval", itemId.getValueString().c_str())); AuctionResult auctionResult = ar_OK; CreatureObject *player = dynamic_cast(NetworkIdManager::getObjectById(itemOwnerId)); - Client *client = player ? player->getClient() : NULL; + Client *client = player ? player->getClient() : nullptr; bool transactionFailed = false; - ServerObject* vendor = NULL; - ServerObject* item = NULL; + ServerObject* vendor = nullptr; + ServerObject* item = nullptr; if (result == ARC_AuctionDoesNotExist) { @@ -2637,7 +2637,7 @@ void CommoditiesMarket::onGetItemReply(int32 result, int32 requestId, NetworkId vendor = safe_cast(ContainerInterface::getContainedByObject(*item)); if (vendor && vendor->getNetworkId() == location) { - bool retval = ContainerInterface::transferItemToVolumeContainer(*inventory, *item, NULL, tmp, false); + bool retval = ContainerInterface::transferItemToVolumeContainer(*inventory, *item, nullptr, tmp, false); if (retval) { @@ -2779,7 +2779,7 @@ void CommoditiesMarket::onIsVendorOwner(const NetworkId & requesterId, const Net ServerObject * const auctionContainer = safe_cast(NetworkIdManager::getObjectById(container)); NetworkId resultContainer = container; - const TangibleObject * resultContainerObject = auctionContainer ? auctionContainer->asTangibleObject() : NULL; + const TangibleObject * resultContainerObject = auctionContainer ? auctionContainer->asTangibleObject() : nullptr; if (auctionContainer) { marketName = getLocationString(*auctionContainer); @@ -2952,7 +2952,7 @@ void CommoditiesMarket::onGetItemDetailsReply(int32 result, int32 requestId, Net OutOfBandBase *base = *it; if (!base) { - WARNING(true, ("NULL OOB Base for Auction Data")); + WARNING(true, ("nullptr OOB Base for Auction Data")); return; } if (base->getTypeId() == OutOfBandPackager::OT_auctionToken) @@ -2979,7 +2979,7 @@ void CommoditiesMarket::onGetItemDetailsReply(int32 result, int32 requestId, Net base = *it; if (!base) { - WARNING(true, ("NULL OOB Base for Auction Data")); + WARNING(true, ("nullptr OOB Base for Auction Data")); return; } if (base->getTypeId() == OutOfBandPackager::OT_objectAttributes) @@ -3624,22 +3624,22 @@ void CommoditiesMarket::updateItemTypeMap(int itemTypeMapVersionNumber, int item // get the server template const ObjectTemplate * ot = ObjectTemplateList::fetch(static_cast(itemTemplateId)); - if (ot != NULL) + if (ot != nullptr) { objectName = StringId(std::string(ot->getName())); // get the shared template const ServerObjectTemplate * serverOt = ot->asServerObjectTemplate(); - if (serverOt != NULL) + if (serverOt != nullptr) { const std::string sharedTemplateName(serverOt->getSharedTemplate()); serverOt->releaseReference(); - serverOt = NULL; + serverOt = nullptr; ot = ObjectTemplateList::fetch(sharedTemplateName); - if (ot != NULL) + if (ot != nullptr) { const SharedObjectTemplate * sharedOt = ot->asSharedObjectTemplate(); - if (sharedOt != NULL) + if (sharedOt != nullptr) { gameObjectType = static_cast(sharedOt->getGameObjectType()); StringId const tempObjectName(objectName); @@ -3649,19 +3649,19 @@ void CommoditiesMarket::updateItemTypeMap(int itemTypeMapVersionNumber, int item objectName = tempObjectName; } sharedOt->releaseReference(); - sharedOt = NULL; + sharedOt = nullptr; } else { ot->releaseReference(); - ot = NULL; + ot = nullptr; } } } else { ot->releaseReference(); - ot = NULL; + ot = nullptr; } } else diff --git a/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesServerConnection.cpp b/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesServerConnection.cpp index 1b7b95c9..ad3ff41c 100755 --- a/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesServerConnection.cpp +++ b/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesServerConnection.cpp @@ -576,7 +576,7 @@ void CommoditiesServerConnection::onReceive(const Archive::ByteStream & message) ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(response.getValue().first.first, diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserAi.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserAi.cpp index 65298e93..994b695b 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserAi.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserAi.cpp @@ -74,7 +74,7 @@ CreatureObject * const ConsoleCommandParserAiNamespace::getAiCreatureObject(Crea CreatureObject * const aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId); - if ( (aiCreatureObject == NULL) + if ( (aiCreatureObject == nullptr) || aiCreatureObject->isPlayerControlled()) { Chat::sendSystemMessage(user, Unicode::narrowToWide(FormattedString<1024>().sprintf("[FAILURE] Unable to resolve %s to an AI", aiNetworkId.getValueString().c_str())), Unicode::emptyString); @@ -113,7 +113,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { CreatureObject * const userCreatureObject = CreatureObject::getCreatureObject(userId); - if (userCreatureObject == NULL) + if (userCreatureObject == nullptr) { result += getErrorMessage(argv[0], ERR_FAIL); } @@ -121,7 +121,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { CreatureObject * const aiCreatureObject = getAiCreatureObject(*userCreatureObject, argv); - if (aiCreatureObject == NULL) + if (aiCreatureObject == nullptr) { result += getErrorMessage(argv[0], ERR_FAIL); } @@ -129,7 +129,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(aiCreatureObject->getController()); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { Chat::sendSystemMessage(*userCreatureObject, Unicode::narrowToWide(fs.sprintf("[FAILURE] Unable to resolve %s to an AI", aiCreatureObject->getNetworkId().getValueString().c_str())), Unicode::emptyString); result += getErrorMessage(argv[0], ERR_FAIL); @@ -148,7 +148,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { CreatureObject * const userCreatureObject = CreatureObject::getCreatureObject(userId); - if (userCreatureObject == NULL) + if (userCreatureObject == nullptr) { result += getErrorMessage(argv[0], ERR_FAIL); } @@ -167,7 +167,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri AICreatureController * const aiCreatureController = AICreatureController::getAiCreatureController(targetNetworkId); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { result = Unicode::narrowToWide(fs.sprintf("[FAILURE] Unable to resolve %s to an AI\n", targetNetworkId.getValueString().c_str())); result += getErrorMessage(argv[0], ERR_FAIL); @@ -190,7 +190,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { CellProperty const * const cellProperty = creatureOwner->getParentCell(); - if (cellProperty != NULL) + if (cellProperty != nullptr) { Vector const & position_p = creatureOwner->getPosition_p(); @@ -245,13 +245,13 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri TangibleObject const * const hateTargetTangibleObject = TangibleObject::asTangibleObject(hateTarget.getObject()); float const hate = iterHateList->second; std::string hateTargetName; - if (hateTargetTangibleObject != NULL) + if (hateTargetTangibleObject != nullptr) { hateTargetName = Unicode::wideToNarrow(hateTargetTangibleObject->getEncodedObjectName()).c_str(); } else { - hateTargetName = "NULL"; + hateTargetName = "nullptr"; } result += Unicode::narrowToWide(fs.sprintf("%s:%s(%.1f)\n", hateTargetName.c_str(), hateTarget.getValueString().c_str(), hate)); @@ -271,13 +271,13 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri CachedNetworkId const hateTarget(iter->first); TangibleObject const * const hateTargetTangibleObject = TangibleObject::asTangibleObject(hateTarget.getObject()); std::string hateTargetName; - if (hateTargetTangibleObject != NULL) + if (hateTargetTangibleObject != nullptr) { hateTargetName = Unicode::wideToNarrow(hateTargetTangibleObject->getEncodedObjectName()).c_str(); } else { - hateTargetName = "NULL"; + hateTargetName = "nullptr"; } result += Unicode::narrowToWide(fs.sprintf("%s:%s (%.2f, %lu, %lu)\n", hateTargetName.c_str(), hateTarget.getValueString().c_str(), iter->second.first, iter->second.second.first, iter->second.second.second)); @@ -295,7 +295,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { CreatureObject * const userCreatureObject = CreatureObject::getCreatureObject(userId); - if (userCreatureObject == NULL) + if (userCreatureObject == nullptr) { result += getErrorMessage(argv[0], ERR_FAIL); } @@ -313,7 +313,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri } TangibleObject const * const to = TangibleObject::asTangibleObject(NetworkIdManager::getObjectById(targetNetworkId)); - if (to == NULL) + if (to == nullptr) { result += Unicode::narrowToWide(fs.sprintf("Target %s not found or not TangibleObject\n", targetNetworkId.getValueString().c_str())); } @@ -342,13 +342,13 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri TangibleObject const * const hateTargetTangibleObject = TangibleObject::asTangibleObject(hateTarget.getObject()); float const hate = iterHateList->second; std::string hateTargetName; - if (hateTargetTangibleObject != NULL) + if (hateTargetTangibleObject != nullptr) { hateTargetName = Unicode::wideToNarrow(hateTargetTangibleObject->getEncodedObjectName()).c_str(); } else { - hateTargetName = "NULL"; + hateTargetName = "nullptr"; } result += Unicode::narrowToWide(fs.sprintf("%s:%s(%.1f)\n", hateTargetName.c_str(), hateTarget.getValueString().c_str(), hate)); @@ -368,13 +368,13 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri CachedNetworkId const hateTarget(iter->first); TangibleObject const * const hateTargetTangibleObject = TangibleObject::asTangibleObject(hateTarget.getObject()); std::string hateTargetName; - if (hateTargetTangibleObject != NULL) + if (hateTargetTangibleObject != nullptr) { hateTargetName = Unicode::wideToNarrow(hateTargetTangibleObject->getEncodedObjectName()).c_str(); } else { - hateTargetName = "NULL"; + hateTargetName = "nullptr"; } result += Unicode::narrowToWide(fs.sprintf("%s:%s (%.2f, %lu, %lu)\n", hateTargetName.c_str(), hateTarget.getValueString().c_str(), iter->second.first, iter->second.second.first, iter->second.second.second)); @@ -390,7 +390,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { CreatureObject * const userCreatureObject = CreatureObject::getCreatureObject(userId); - if (userCreatureObject == NULL) + if (userCreatureObject == nullptr) { result += getErrorMessage(argv[0], ERR_FAIL); } @@ -398,7 +398,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { CreatureObject * const aiCreatureObject = getAiCreatureObject(*userCreatureObject, argv); - if (aiCreatureObject == NULL) + if (aiCreatureObject == nullptr) { result += getErrorMessage(argv[0], ERR_FAIL); } @@ -416,7 +416,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { CreatureObject * const userCreatureObject = CreatureObject::getCreatureObject(userId); - if (userCreatureObject == NULL) + if (userCreatureObject == nullptr) { result += getErrorMessage(argv[0], ERR_FAIL); } @@ -424,7 +424,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { CreatureObject * const aiCreatureObject = getAiCreatureObject(*userCreatureObject, argv); - if (aiCreatureObject == NULL) + if (aiCreatureObject == nullptr) { result += getErrorMessage(argv[0], ERR_FAIL); } @@ -442,14 +442,14 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { CreatureObject * const userCreatureObject = CreatureObject::getCreatureObject(userId); - if (userCreatureObject == NULL) + if (userCreatureObject == nullptr) { result += getErrorMessage(argv[0], ERR_FAIL); } else { NetworkId aiNetworkId; - CreatureObject * aiCreatureObject = NULL; + CreatureObject * aiCreatureObject = nullptr; if (argv.size() > 2) { @@ -458,7 +458,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri aiNetworkId = NetworkId(Unicode::wideToNarrow(argv[1])); aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId); - if ( (aiCreatureObject != NULL) + if ( (aiCreatureObject != nullptr) && !aiCreatureObject->isPlayerControlled()) { aiCreatureObject->setBaseWalkSpeed(Unicode::toFloat(argv[2])); @@ -471,14 +471,14 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri aiNetworkId = userCreatureObject->getLookAtTarget(); aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId); - if ( (aiCreatureObject != NULL) + if ( (aiCreatureObject != nullptr) && !aiCreatureObject->isPlayerControlled()) { aiCreatureObject->setBaseWalkSpeed(Unicode::toFloat(argv[1])); } } - if ( (aiCreatureObject == NULL) + if ( (aiCreatureObject == nullptr) || aiCreatureObject->isPlayerControlled()) { Chat::sendSystemMessage(*userCreatureObject, Unicode::narrowToWide(fs.sprintf("[FAILURE] Unable to resolve %s to an AI", aiNetworkId.getValueString().c_str())), Unicode::emptyString); @@ -495,14 +495,14 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { CreatureObject * const userCreatureObject = CreatureObject::getCreatureObject(userId); - if (userCreatureObject == NULL) + if (userCreatureObject == nullptr) { result += getErrorMessage(argv[0], ERR_FAIL); } else { NetworkId aiNetworkId; - CreatureObject * aiCreatureObject = NULL; + CreatureObject * aiCreatureObject = nullptr; if (argv.size() > 2) { @@ -511,7 +511,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri aiNetworkId = NetworkId(Unicode::wideToNarrow(argv[1])); aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId); - if ( (aiCreatureObject != NULL) + if ( (aiCreatureObject != nullptr) && !aiCreatureObject->isPlayerControlled()) { aiCreatureObject->setBaseRunSpeed(Unicode::toFloat(argv[2])); @@ -524,14 +524,14 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri aiNetworkId = userCreatureObject->getLookAtTarget(); aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId); - if ( (aiCreatureObject != NULL) + if ( (aiCreatureObject != nullptr) && !aiCreatureObject->isPlayerControlled()) { aiCreatureObject->setBaseRunSpeed(Unicode::toFloat(argv[1])); } } - if ( (aiCreatureObject == NULL) + if ( (aiCreatureObject == nullptr) || aiCreatureObject->isPlayerControlled()) { Chat::sendSystemMessage(*userCreatureObject, Unicode::narrowToWide(fs.sprintf("[FAILURE] Unable to resolve %s to an AI", aiNetworkId.getValueString().c_str())), Unicode::emptyString); @@ -549,7 +549,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri { CreatureObject * const userCreatureObject = CreatureObject::getCreatureObject(userId); - if (userCreatureObject != NULL) + if (userCreatureObject != nullptr) { NetworkId sparedAiNetworkId; @@ -573,9 +573,9 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri for (int i = 0; i < serverObjectCount; ++i) { ServerObject * const serverObject = ServerWorld::getObject(i); - CreatureObject * const creatureObject = (serverObject != NULL) ? serverObject->asCreatureObject() : NULL; + CreatureObject * const creatureObject = (serverObject != nullptr) ? serverObject->asCreatureObject() : nullptr; - if ( (creatureObject != NULL) + if ( (creatureObject != nullptr) && !creatureObject->isDead() && !creatureObject->isPlayerControlled() && (creatureObject->getNetworkId() != sparedAiNetworkId)) @@ -597,10 +597,10 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri else if (isAbbrev(argv[0], "debug")) { Object * const object = NetworkIdManager::getObjectById(userId); - ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; int temp; - if (serverObject != NULL) + if (serverObject != nullptr) { if ( serverObject->getObjVars().getItem("ai_debug_string", temp) && (temp > 0)) @@ -621,7 +621,7 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri Client * const client = serverObject->getClient(); - if (client != NULL) + if (client != nullptr) { AiDebugString aiDebugString; aiDebugString.enableClearClientFlag(); @@ -650,9 +650,9 @@ bool ConsoleCommandParserAi::performParsing(const NetworkId & userId, const Stri else if (isAbbrev(argv[0], "debugText")) { Object * const object = NetworkIdManager::getObjectById(userId); - ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - if (serverObject != NULL) + if (serverObject != nullptr) { AiDebugString::setTextEnabled(!AiDebugString::isTextEnabled()); diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCity.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCity.cpp index 7b4af2ef..5a89f47e 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCity.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCity.cpp @@ -415,7 +415,7 @@ bool ConsoleCommandParserCity::performParsing (const NetworkId & userId, const S } else { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[3]).c_str()) - 1; diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCollection.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCollection.cpp index 442bc622..7397c1e8 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCollection.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCollection.cpp @@ -63,21 +63,21 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -172,21 +172,21 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -249,21 +249,21 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -326,21 +326,21 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -403,21 +403,21 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -466,21 +466,21 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -529,21 +529,21 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -592,21 +592,21 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -719,21 +719,21 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -776,7 +776,7 @@ bool ConsoleCommandParserCollection::performParsing (const NetworkId & userId, c else if (isCommand (argv [0], "setServerFirstTime")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[3]).c_str()) - 1; diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCraft.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCraft.cpp index 6a28b3eb..51b45c94 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCraft.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCraft.cpp @@ -151,7 +151,7 @@ bool ConsoleCommandParserCraft::performParsing (const NetworkId & userId, const else if (isAbbrev( argv [0], "enableSchematicFilter")) { - if (creatureObject->getClient() == NULL || !creatureObject->getClient()->isGod()) + if (creatureObject->getClient() == nullptr || !creatureObject->getClient()->isGod()) result += getErrorMessage (argv[0], ERR_FAIL); else { @@ -164,7 +164,7 @@ bool ConsoleCommandParserCraft::performParsing (const NetworkId & userId, const else if (isAbbrev( argv [0], "disableSchematicFilter")) { - if (creatureObject->getClient() == NULL || !creatureObject->getClient()->isGod()) + if (creatureObject->getClient() == nullptr || !creatureObject->getClient()->isGod()) result += getErrorMessage (argv[0], ERR_FAIL); else { diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCraftStation.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCraftStation.cpp index cc9bebd7..e3a443db 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCraftStation.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserCraftStation.cpp @@ -53,19 +53,19 @@ bool ConsoleCommandParserCraftStation::performParsing (const NetworkId & userId, { /* // get the station TangibleObject * station = getStation(argv, result); - if (station == NULL) + if (station == nullptr) return true; // get the ingredient NetworkId ingredientId(Unicode::wideToNarrow (argv[2])); ServerObject * object = ServerWorld::findObjectByNetworkId(ingredientId); - if (object == NULL) + if (object == nullptr) { result += getErrorMessage (argv [0], ERR_INVALID_INGREDIENT); return true; } TangibleObject * ingredient = dynamic_cast(object); - if (ingredient == NULL) + if (ingredient == nullptr) { result += getErrorMessage (argv [0], ERR_INVALID_INGREDIENT); return true; @@ -82,19 +82,19 @@ bool ConsoleCommandParserCraftStation::performParsing (const NetworkId & userId, { /* // get the station TangibleObject * station = getStation(argv, result); - if (station == NULL) + if (station == nullptr) return true; // get the ingredient NetworkId ingredientId(Unicode::wideToNarrow (argv[2])); ServerObject * object = ServerWorld::findObjectByNetworkId(ingredientId); - if (object == NULL) + if (object == nullptr) { result += getErrorMessage (argv [0], ERR_INVALID_INGREDIENT); return true; } TangibleObject * ingredient = dynamic_cast(object); - if (ingredient == NULL) + if (ingredient == nullptr) { result += getErrorMessage (argv [0], ERR_INVALID_INGREDIENT); return true; @@ -112,13 +112,13 @@ bool ConsoleCommandParserCraftStation::performParsing (const NetworkId & userId, /* // get the station NetworkId id(Unicode::wideToNarrow (argv[1])); ServerObject * object = ServerWorld::findObjectByNetworkId(id); - if (object == NULL) + if (object == nullptr) { result += getErrorMessage (argv [0], ERR_INVALID_OBJECT); return true; } TangibleObject * station = dynamic_cast(object); - if (station == NULL) + if (station == nullptr) { result += getErrorMessage (argv [0], ERR_INVALID_OBJECT); return true; @@ -144,33 +144,33 @@ bool ConsoleCommandParserCraftStation::performParsing (const NetworkId & userId, /** * Finds the crafting station for a given id. * - * @return the station or NULL on error + * @return the station or nullptr on error */ TangibleObject * ConsoleCommandParserCraftStation::getStation(const StringVector_t & argv, String_t & result) { NetworkId id(Unicode::wideToNarrow (argv[1])); ServerObject * object = ServerWorld::findObjectByNetworkId(id); - if (object == NULL) + if (object == nullptr) { result += getErrorMessage (argv [0], ERR_INVALID_OBJECT); - return NULL; + return nullptr; } TangibleObject * station = dynamic_cast(object); - if (station == NULL) + if (station == nullptr) { result += getErrorMessage (argv [0], ERR_INVALID_OBJECT); - return NULL; + return nullptr; } // make sure the station is a atation and that it isn't in use if (!station->getObjVars().hasItem("crafting.station")) { result += getErrorMessage (argv [0], ERR_INVALID_STATION); - return NULL; + return nullptr; } if (station->getObjVars().hasItem("crafting.crafter")) { result += getErrorMessage (argv [0], ERR_STATION_IN_USE); - return NULL; + return nullptr; } return station; } // ConsoleCommandParserCraftStation::getStation diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserGuild.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserGuild.cpp index f2ca6349..3484d6c2 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserGuild.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserGuild.cpp @@ -1218,17 +1218,17 @@ bool ConsoleCommandParserGuild::performParsing (const NetworkId & userId, const { // new guild leader is not a guild member, so make a guild member first, then make guild leader ServerObject const* o = dynamic_cast(ServerWorld::findObjectByNetworkId(leaderOid)); - CreatureObject const* c = (o ? o->asCreatureObject() : NULL); - PlayerObject const* p = (c ? PlayerCreatureController::getPlayerObject(c) : NULL); - if (o == NULL) + CreatureObject const* c = (o ? o->asCreatureObject() : nullptr); + PlayerObject const* p = (c ? PlayerCreatureController::getPlayerObject(c) : nullptr); + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); } - else if (c == NULL) + else if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); } - else if (p == NULL) + else if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); } diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserManufacture.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserManufacture.cpp index 1b405dd1..d8af83e3 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserManufacture.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserManufacture.cpp @@ -64,7 +64,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, ManufactureInstallationObject * station = dynamic_cast(stationId.getObject()); ServerObject * ingredient = safe_cast(ingredientId.getObject()); - if (station == NULL || ingredient == NULL) + if (station == nullptr || ingredient == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -77,7 +77,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, } ServerObject * hopper = station->getInputHopper(); - if (hopper == NULL) + if (hopper == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -99,7 +99,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, ManufactureInstallationObject * station = dynamic_cast(stationId.getObject()); ServerObject * ingredient = safe_cast(ingredientId.getObject()); - if (station == NULL || ingredient == NULL) + if (station == nullptr || ingredient == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -112,7 +112,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, } ServerObject * hopper = station->getInputHopper(); - if (hopper == NULL) + if (hopper == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -124,7 +124,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, return true; } - if (playerObject->getInventory() == NULL) + if (playerObject->getInventory() == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -144,7 +144,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, ManufactureInstallationObject * station = dynamic_cast(stationId.getObject()); - if (station == NULL) + if (station == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -157,14 +157,14 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, } ServerObject * hopper = station->getInputHopper(); - if (hopper == NULL) + if (hopper == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } VolumeContainer * container = ContainerInterface::getVolumeContainer(*hopper); - if (container == NULL) + if (container == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -174,7 +174,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, while (iter != container->end()) { const Container::ContainedItem & itemId = *iter; - if (itemId.getObject() != NULL) + if (itemId.getObject() != nullptr) { const ServerObject * item = safe_cast(itemId.getObject()); result += Unicode::narrowToWide("("); @@ -182,7 +182,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, result += Unicode::narrowToWide(") - "); const ResourceContainerObject * crate = dynamic_cast< const ResourceContainerObject *>(item); - if (crate != NULL) + if (crate != nullptr) { char buffer[32]; _itoa(crate->getQuantity(), buffer, 10); @@ -226,7 +226,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, ManufactureInstallationObject * station = dynamic_cast(stationId.getObject()); ManufactureSchematicObject * schematic = dynamic_cast(schematicId.getObject()); - if (station == NULL || schematic == NULL) + if (station == nullptr || schematic == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -239,7 +239,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, } // if (station->addSchematic(*schematic, playerObject)) - if (station->addSchematic(*schematic, NULL)) + if (station->addSchematic(*schematic, nullptr)) result += getErrorMessage(argv[0], ERR_SUCCESS); else result += getErrorMessage(argv[0], ERR_INVALID_CONTAINER_TRANSFER); @@ -253,7 +253,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, ManufactureInstallationObject * station = dynamic_cast(stationId.getObject()); - if (station == NULL) + if (station == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -266,9 +266,9 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, } ManufactureSchematicObject * schematic = station->getSchematic(); - if (schematic != NULL) + if (schematic != nullptr) { - if (playerObject->getDatapad() == NULL) + if (playerObject->getDatapad() == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -291,7 +291,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, ManufactureInstallationObject * station = dynamic_cast(stationId.getObject()); - if (station == NULL) + if (station == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -304,7 +304,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, } ManufactureSchematicObject * schematic = station->getSchematic(); - if (schematic != NULL) + if (schematic != nullptr) { result += Unicode::narrowToWide("("); result += Unicode::narrowToWide(schematic->getNetworkId().getValueString()); @@ -325,7 +325,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, ManufactureInstallationObject * station = dynamic_cast(stationId.getObject()); - if (station == NULL) + if (station == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); } @@ -344,7 +344,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, ManufactureInstallationObject * station = dynamic_cast(stationId.getObject()); - if (station == NULL) + if (station == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); } @@ -360,7 +360,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, else if (isAbbrev( argv [0], "getObjects")) { ServerObject * myInventory = playerObject->getInventory(); - if (myInventory == NULL) + if (myInventory == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -370,21 +370,21 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, ManufactureInstallationObject * station = dynamic_cast(stationId.getObject()); - if (station == NULL) + if (station == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } ServerObject * hopper = station->getOutputHopper(); - if (hopper == NULL) + if (hopper == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } VolumeContainer * container = ContainerInterface::getVolumeContainer(*hopper); - if (container == NULL) + if (container == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -394,7 +394,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, while (iter != container->end()) { const Container::ContainedItem & itemId = *iter; - if (itemId.getObject() != NULL) + if (itemId.getObject() != nullptr) { ContainerInterface::transferItemToVolumeContainer (*myInventory, *safe_cast(itemId.getObject()), playerObject, tmp); } @@ -419,21 +419,21 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, ManufactureInstallationObject * station = dynamic_cast(stationId.getObject()); - if (station == NULL) + if (station == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } ServerObject * hopper = station->getOutputHopper(); - if (hopper == NULL) + if (hopper == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } VolumeContainer * container = ContainerInterface::getVolumeContainer(*hopper); - if (container == NULL) + if (container == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -443,7 +443,7 @@ bool ConsoleCommandParserManufacture::performParsing (const NetworkId & userId, while (iter != container->end()) { const Container::ContainedItem & itemId = *iter; - if (itemId.getObject() != NULL) + if (itemId.getObject() != nullptr) { const ServerObject * item = safe_cast(itemId.getObject()); result += Unicode::narrowToWide("("); diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserMoney.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserMoney.cpp index 33801387..feff5d1e 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserMoney.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserMoney.cpp @@ -58,7 +58,7 @@ bool ConsoleCommandParserMoney::performParsing (const NetworkId & userId, const { NetworkId sourceId(Unicode::wideToNarrow (argv[1])); NetworkId targetId(Unicode::wideToNarrow (argv[2])); - int amount(strtoul(Unicode::wideToNarrow (argv[3]).c_str (), NULL, 10)); + int amount(strtoul(Unicode::wideToNarrow (argv[3]).c_str (), nullptr, 10)); ServerObject* source = dynamic_cast(NetworkIdManager::getObjectById(sourceId)); if (!source) @@ -75,7 +75,7 @@ bool ConsoleCommandParserMoney::performParsing (const NetworkId & userId, const { NetworkId sourceId(Unicode::wideToNarrow (argv[1])); NetworkId targetId(Unicode::wideToNarrow (argv[2])); - int amount(strtoul(Unicode::wideToNarrow (argv[3]).c_str (), NULL, 10)); + int amount(strtoul(Unicode::wideToNarrow (argv[3]).c_str (), nullptr, 10)); ServerObject* source = dynamic_cast(NetworkIdManager::getObjectById(sourceId)); if (!source) @@ -91,7 +91,7 @@ bool ConsoleCommandParserMoney::performParsing (const NetworkId & userId, const else if (isAbbrev( argv [0], "namedTransfer")) { NetworkId sourceId(Unicode::wideToNarrow (argv[1])); - int amount(strtol(Unicode::wideToNarrow (argv[3]).c_str (), NULL, 10)); + int amount(strtol(Unicode::wideToNarrow (argv[3]).c_str (), nullptr, 10)); ServerObject* source = dynamic_cast(NetworkIdManager::getObjectById(sourceId)); if (!source) @@ -117,7 +117,7 @@ bool ConsoleCommandParserMoney::performParsing (const NetworkId & userId, const else if (isAbbrev( argv [0], "withdraw")) { NetworkId sourceId(Unicode::wideToNarrow (argv[1])); - int amount(strtoul(Unicode::wideToNarrow (argv[2]).c_str (), NULL, 10)); + int amount(strtoul(Unicode::wideToNarrow (argv[2]).c_str (), nullptr, 10)); ServerObject* source = dynamic_cast(NetworkIdManager::getObjectById(sourceId)); if (!source) @@ -133,7 +133,7 @@ bool ConsoleCommandParserMoney::performParsing (const NetworkId & userId, const else if (isAbbrev( argv [0], "deposit")) { NetworkId sourceId(Unicode::wideToNarrow (argv[1])); - int amount(strtoul(Unicode::wideToNarrow (argv[2]).c_str (), NULL, 10)); + int amount(strtoul(Unicode::wideToNarrow (argv[2]).c_str (), nullptr, 10)); ServerObject* source = dynamic_cast(NetworkIdManager::getObjectById(sourceId)); if (!source) @@ -175,7 +175,7 @@ bool ConsoleCommandParserMoney::performParsing (const NetworkId & userId, const } else if (isAbbrev( argv [0], "setGalacticReserve")) { - int const newGalacticReserve(strtoul(Unicode::wideToNarrow (argv[2]).c_str (), NULL, 10)); + int const newGalacticReserve(strtoul(Unicode::wideToNarrow (argv[2]).c_str (), nullptr, 10)); if ((newGalacticReserve < 0) || (newGalacticReserve > ConfigServerGame::getMaxGalacticReserveDepositBillion())) { result += Unicode::narrowToWide(FormattedString<1024>().sprintf("specified galactic reserve balance (%d) must be in the (inclusive) range (0, %d)\n", newGalacticReserve, ConfigServerGame::getMaxGalacticReserveDepositBillion())); diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserNpc.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserNpc.cpp index 929f6413..71f81106 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserNpc.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserNpc.cpp @@ -52,19 +52,19 @@ bool ConsoleCommandParserNpc::performParsing (const NetworkId & userId, const St NetworkId const oid(Unicode::wideToNarrow(argv[1])); ServerObject * const object = ServerWorld::findObjectByNetworkId(oid); - if (object == NULL) + if (object == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } TangibleObject * const npc = object->asTangibleObject(); - if (npc == NULL) + if (npc == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - playerObject->startNpcConversation(*npc, NULL, NpcConversationData::CS_Player, 0); + playerObject->startNpcConversation(*npc, nullptr, NpcConversationData::CS_Player, 0); result += getErrorMessage (argv[0], ERR_SUCCESS); } @@ -82,7 +82,7 @@ bool ConsoleCommandParserNpc::performParsing (const NetworkId & userId, const St else if (isAbbrev( argv [0], "respond")) { TangibleObject * const playerObject = safe_cast(ServerWorld::findObjectByNetworkId(userId)); - int const response = strtol(Unicode::wideToNarrow(argv[1]).c_str (), NULL, 10); + int const response = strtol(Unicode::wideToNarrow(argv[1]).c_str (), nullptr, 10); playerObject->respondToNpc(response); result += getErrorMessage (argv[0], ERR_SUCCESS); } diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserObject.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserObject.cpp index ed626f69..a092fc3a 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserObject.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserObject.cpp @@ -119,23 +119,23 @@ namespace ConsoleCommandParserObjectNamespace { WARNING(true, ("ConsoleCommandParserObject invalid object template [%s]", templateName.c_str())); ot->releaseReference(); - return NULL; + return nullptr; } if (sot->getId() == ServerShipObjectTemplate::ServerShipObjectTemplate_tag) { SharedObjectTemplate const * const sharedTemplate = safe_cast(ObjectTemplateList::fetch(sot->getSharedTemplate())); - if (NULL == sharedTemplate || + if (nullptr == sharedTemplate || (sharedTemplate->getGameObjectType() != SharedObjectTemplate::GOT_ship_mining_asteroid_dynamic && sharedTemplate->getGameObjectType() != SharedObjectTemplate::GOT_ship_mining_asteroid_static)) { ot->releaseReference(); - return NULL; + return nullptr; } } return sot; } - return NULL; + return nullptr; } void checkBadBuildClusterObject(ServerObject *& o) @@ -523,7 +523,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject const * const obj = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (obj == NULL) + if (obj == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -531,7 +531,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const Client const * const client = obj->getClient(); - if(client == NULL) + if(client == nullptr) { result += Unicode::narrowToWide("specified object is not a client object\n"); return true; @@ -561,7 +561,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const } const char *objectTemplateName = obj->getObjectTemplateName(); - result += Unicode::narrowToWide(FormattedString<512>().sprintf("object %s (%s) has %d total opened objects\n", obj->getNetworkId().getValueString().c_str(), (objectTemplateName ? objectTemplateName : "NULL object template"), opened.size())); + result += Unicode::narrowToWide(FormattedString<512>().sprintf("object %s (%s) has %d total opened objects\n", obj->getNetworkId().getValueString().c_str(), (objectTemplateName ? objectTemplateName : "nullptr object template"), opened.size())); if(!text.empty()) { @@ -615,7 +615,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const ServerObject * const object = dynamic_cast(NetworkIdManager::getObjectById(oid)); if (object) { - uint32 const pid = (strtoul(Unicode::wideToNarrow(argv[2]).c_str (), NULL, 10)); + uint32 const pid = (strtoul(Unicode::wideToNarrow(argv[2]).c_str (), nullptr, 10)); GenericValueTypeMessage > const msg( "RequestAuthTransfer", std::make_pair( @@ -646,9 +646,9 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const } real x,y,z; - x = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), NULL)); - y = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL)); - z = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), NULL)); + x = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), nullptr)); + y = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr)); + z = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), nullptr)); ServerObject *newObject = 0; ServerObjectTemplate const * const ot = getObjectTemplateForCreation(tmpString); @@ -706,9 +706,9 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const } real x,y,z; - x = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), NULL)); - y = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL)); - z = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), NULL)); + x = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), nullptr)); + y = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr)); + z = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), nullptr)); // check to see if we're in a region we shouldn't be building in if ( ConfigServerGame::getBlockBuildRegionPlacement() ) @@ -726,10 +726,10 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const } real quatW,quatX,quatY,quatZ; - quatW = static_cast(strtod(Unicode::wideToNarrow(argv[5]).c_str(), NULL)); - quatX = static_cast(strtod(Unicode::wideToNarrow(argv[6]).c_str(), NULL)); - quatY = static_cast(strtod(Unicode::wideToNarrow(argv[7]).c_str(), NULL)); - quatZ = static_cast(strtod(Unicode::wideToNarrow(argv[8]).c_str(), NULL)); + quatW = static_cast(strtod(Unicode::wideToNarrow(argv[5]).c_str(), nullptr)); + quatX = static_cast(strtod(Unicode::wideToNarrow(argv[6]).c_str(), nullptr)); + quatY = static_cast(strtod(Unicode::wideToNarrow(argv[7]).c_str(), nullptr)); + quatZ = static_cast(strtod(Unicode::wideToNarrow(argv[8]).c_str(), nullptr)); ServerObject * const cell = safe_cast(ContainerInterface::getContainingCellObject(*playerObject)); @@ -934,7 +934,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const NetworkId oid(Unicode::wideToNarrow(argv[2])); ServerObject* object = dynamic_cast(NetworkIdManager::getObjectById(oid)); - if (object == NULL) + if (object == nullptr) { //container does not exist result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); @@ -994,7 +994,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId cellId(Unicode::wideToNarrow(argv[2])); ServerObject* cell = dynamic_cast(NetworkIdManager::getObjectById(cellId)); - if (cell == NULL && cellId != NetworkId::cms_invalid) + if (cell == nullptr && cellId != NetworkId::cms_invalid) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1011,9 +1011,9 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const } real x,y,z; - x = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL)); - y = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), NULL)); - z = static_cast(strtod(Unicode::wideToNarrow(argv[5]).c_str(), NULL)); + x = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr)); + y = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), nullptr)); + z = static_cast(strtod(Unicode::wideToNarrow(argv[5]).c_str(), nullptr)); ServerObject *newObject = 0; ServerObjectTemplate const * const ot = getObjectTemplateForCreation(tmpString); @@ -1070,22 +1070,22 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const NetworkId cellId(Unicode::wideToNarrow(argv[2])); ServerObject * const cell = safe_cast(NetworkIdManager::getObjectById(cellId)); - if (cell == NULL && cellId != NetworkId::cms_invalid) + if (cell == nullptr && cellId != NetworkId::cms_invalid) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } real x,y,z; - x = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL)); - y = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), NULL)); - z = static_cast(strtod(Unicode::wideToNarrow(argv[5]).c_str(), NULL)); + x = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr)); + y = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), nullptr)); + z = static_cast(strtod(Unicode::wideToNarrow(argv[5]).c_str(), nullptr)); real quatW,quatX,quatY,quatZ; - quatW = static_cast(strtod(Unicode::wideToNarrow(argv[6]).c_str(), NULL)); - quatX = static_cast(strtod(Unicode::wideToNarrow(argv[7]).c_str(), NULL)); - quatY = static_cast(strtod(Unicode::wideToNarrow(argv[8]).c_str(), NULL)); - quatZ = static_cast(strtod(Unicode::wideToNarrow(argv[9]).c_str(), NULL)); + quatW = static_cast(strtod(Unicode::wideToNarrow(argv[6]).c_str(), nullptr)); + quatX = static_cast(strtod(Unicode::wideToNarrow(argv[7]).c_str(), nullptr)); + quatY = static_cast(strtod(Unicode::wideToNarrow(argv[8]).c_str(), nullptr)); + quatZ = static_cast(strtod(Unicode::wideToNarrow(argv[9]).c_str(), nullptr)); ServerObject *newObject = 0; ServerObjectTemplate const * const ot = getObjectTemplateForCreation(tmpString); @@ -1165,7 +1165,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject* object = dynamic_cast(NetworkIdManager::getObjectById(oid)); - if (object == NULL) + if (object == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1200,7 +1200,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject* object = dynamic_cast(NetworkIdManager::getObjectById(oid)); - if (object == NULL) + if (object == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1236,7 +1236,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const const NetworkId oid (Unicode::wideToNarrow(argv[1])); ServerObject* const object = safe_cast(NetworkIdManager::getObjectById(oid)); - if (object == NULL) + if (object == nullptr) result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); else if (object->getClient()) result += getErrorMessage(argv[0], ERR_INVALID_USER); @@ -1268,7 +1268,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const ServerObject* const object = safe_cast(NetworkIdManager::getObjectById(oid)); - if (object == NULL) + if (object == nullptr) result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); // ---------- @@ -1279,11 +1279,11 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { ServerObject * object = ServerWorld::getObject(i); - if(object == NULL) continue; + if(object == nullptr) continue; CreatureObject * creature = object->asCreatureObject(); - if(creature == NULL) continue; + if(creature == nullptr) continue; if(creature->getNetworkId() == oid) continue; @@ -1307,11 +1307,11 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { ServerObject * object = ServerWorld::getObject(i); - if(object == NULL) continue; + if(object == nullptr) continue; CreatureObject * creature = object->asCreatureObject(); - if(creature == NULL) continue; + if(creature == nullptr) continue; if(creature->getParentCell() != CellProperty::getWorldCellProperty()) continue; @@ -1331,9 +1331,9 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); Vector pos; - pos.x = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), NULL)); - pos.y = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL)); - pos.z = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), NULL)); + pos.x = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), nullptr)); + pos.y = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr)); + pos.z = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), nullptr)); // disallow certain object types from being "move" bool allowMove = true; @@ -1418,7 +1418,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject* o = ServerWorld::findObjectByNetworkId(oid); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1433,9 +1433,9 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); real r,p,y; - r = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), NULL)); - p = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL)); - y = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), NULL)); + r = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), nullptr)); + p = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr)); + y = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), nullptr)); if (rotateObject(oid, r, p, y)) { result += getErrorMessage(argv[0], ERR_SUCCESS); @@ -1450,7 +1450,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject* o = ServerWorld::findObjectByNetworkId(oid); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1479,7 +1479,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const // erase keys assigned to this player. s_playerCreatureNameMap.erase(userId); - if (dataTable != NULL) + if (dataTable != nullptr) { StringVector creatureStrings; { @@ -1548,7 +1548,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId const oid(Unicode::wideToNarrow(argv[1])); ServerObject* const o = ServerWorld::findObjectByNetworkId(oid); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1580,7 +1580,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - o->deletePobPersistedContents(NULL, DeleteReasons::God); + o->deletePobPersistedContents(nullptr, DeleteReasons::God); result += getErrorMessage(argv[0], ERR_SUCCESS); } else if (isCommand( argv[0], "moveItemInHouseToMe")) @@ -1607,7 +1607,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); TangibleObject* vendor = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (vendor == NULL) + if (vendor == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1621,7 +1621,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); TangibleObject* vendor = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (vendor == NULL) + if (vendor == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1699,13 +1699,13 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); CreatureObject* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } real scale; - scale = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), NULL)); + scale = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), nullptr)); o->setMovementScale(scale); result += getErrorMessage(argv[0], ERR_SUCCESS); } @@ -1716,13 +1716,13 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); CreatureObject* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } real scale; - scale = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), NULL)); + scale = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), nullptr)); o->setScaleFactor(scale); result += getErrorMessage(argv[0], ERR_SUCCESS); } @@ -1765,7 +1765,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject* o = ServerWorld::findObjectByNetworkId(oid); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1788,13 +1788,13 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { CachedNetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(oid.getObject()); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } Container const * const container = ContainerInterface::getContainer(*o); - if (container == NULL) + if (container == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1811,7 +1811,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = ServerWorld::findObjectByNetworkId(oid); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1846,7 +1846,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = ServerWorld::findObjectByNetworkId(oid); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1881,7 +1881,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = ServerWorld::findObjectByNetworkId(oid); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1914,7 +1914,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); TangibleObject* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1940,7 +1940,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); const ServerObject* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1976,7 +1976,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const ServerMessageForwarding::end(); - if (ObjectTemplateList::reload(templateFile) == NULL) + if (ObjectTemplateList::reload(templateFile) == nullptr) { result += getErrorMessage(argv[0], ERR_TEMPLATE_NOT_LOADED); return true; @@ -1991,7 +1991,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); CreatureObject * creature = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (creature == NULL || !creature->isIncapacitated()) + if (creature == nullptr || !creature->isIncapacitated()) result += Unicode::narrowToWide("no"); else if (creature->isDead()) result += Unicode::narrowToWide("dead"); @@ -2011,11 +2011,11 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const LocationData d; d.name = argv[2]; Vector pos; - pos.x = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL)); - pos.y = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), NULL)); - pos.z = static_cast(strtod(Unicode::wideToNarrow(argv[5]).c_str(), NULL)); + pos.x = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr)); + pos.y = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), nullptr)); + pos.z = static_cast(strtod(Unicode::wideToNarrow(argv[5]).c_str(), nullptr)); d.location.setCenter(pos); - float radius = static_cast(strtod(Unicode::wideToNarrow(argv[6]).c_str(), NULL)); + float radius = static_cast(strtod(Unicode::wideToNarrow(argv[6]).c_str(), nullptr)); d.location.setRadius(radius); o->addLocationTarget(d); } @@ -2079,7 +2079,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const oid.getObject()); const CreatureObject * creature = dynamic_cast( tangible); - if (creature != NULL) + if (creature != nullptr) { char buffer[1024]; sprintf(buffer, "he:%d, co=%d, ac=%d, st=%d, mi=%d, wi=%d", @@ -2091,7 +2091,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const creature->getAttribute(Attributes::Willpower)); result += Unicode::narrowToWide(buffer); } - else if (tangible != NULL) + else if (tangible != nullptr) { char buffer[1024]; sprintf(buffer, "max hp = %d, damage taken = %d", @@ -2156,13 +2156,13 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const bool value = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), 0, 10) != 0; ServerObject * const o = dynamic_cast(ServerWorld::findObjectByNetworkId(actorId)); - CreatureObject * const c = (o ? o->asCreatureObject() : NULL); - if (o == NULL) + CreatureObject * const c = (o ? o->asCreatureObject() : nullptr); + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; @@ -2261,7 +2261,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const const char *objectTemplateName = obj->getObjectTemplateName(); - result += Unicode::narrowToWide(FormattedString<512>().sprintf("object %s (%s) has %d total observers (%d observers on this game server)\n", obj->getNetworkId().getValueString().c_str(), (objectTemplateName ? objectTemplateName : "NULL object template"), obj->getObserversCount(), observerList.size())); + result += Unicode::narrowToWide(FormattedString<512>().sprintf("object %s (%s) has %d total observers (%d observers on this game server)\n", obj->getNetworkId().getValueString().c_str(), (objectTemplateName ? objectTemplateName : "nullptr object template"), obj->getObserversCount(), observerList.size())); if (!observers.empty()) { @@ -2560,7 +2560,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const else if(isCommand(argv[0], "setPathLinkDistance")) { - float dist = static_cast(strtod(Unicode::wideToNarrow(argv[1]).c_str(), NULL)); + float dist = static_cast(strtod(Unicode::wideToNarrow(argv[1]).c_str(), nullptr)); CityPathGraphManager::setLinkDistance(dist); @@ -2601,7 +2601,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { CachedNetworkId const oid(Unicode::wideToNarrow(argv[1])); TangibleObject * object = dynamic_cast(oid.getObject()); - if (object == NULL) + if (object == nullptr) result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); else { @@ -2619,7 +2619,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { CachedNetworkId const oid(Unicode::wideToNarrow(argv[1])); TangibleObject * object = dynamic_cast(oid.getObject()); - if (object == NULL) + if (object == nullptr) result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); else { @@ -2653,7 +2653,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const ServerObject * object = dynamic_cast(oid.getObject()); CreatureObject * creature = dynamic_cast(object); - if (object == NULL) + if (object == nullptr) result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); else { @@ -2694,7 +2694,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const NetworkId oid(Unicode::wideToNarrow(argv[1])); CreatureObject *creature = dynamic_cast(NetworkIdManager::getObjectById(oid)); - PlayerObject *player = NULL; + PlayerObject *player = nullptr; if (creature) player = PlayerCreatureController::getPlayerObject(creature); if (player) @@ -2739,7 +2739,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const NetworkId oid(Unicode::wideToNarrow(argv[1])); CreatureObject *creature = dynamic_cast(NetworkIdManager::getObjectById(oid)); - PlayerObject *player = NULL; + PlayerObject *player = nullptr; if (creature) player = PlayerCreatureController::getPlayerObject(creature); if (player) @@ -2864,7 +2864,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); const InstallationObject* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -2888,7 +2888,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const NetworkId oid(Unicode::wideToNarrow(argv[1])); InstallationObject* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -2904,7 +2904,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); const InstallationObject* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -2928,7 +2928,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const NetworkId oid(Unicode::wideToNarrow(argv[1])); InstallationObject* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -3056,7 +3056,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject *o = safe_cast(NetworkIdManager::getObjectById(oid)); - if (o != NULL && o->asCreatureObject() != NULL && o->isPlayerControlled()) + if (o != nullptr && o->asCreatureObject() != nullptr && o->isPlayerControlled()) { CreatureObject * creatureTarget = o->asCreatureObject(); @@ -3068,7 +3068,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const for (CreatureObject::SkillList::const_iterator i = skills.begin(); i != skills.end(); ++i) { const SkillObject * profession = (*i)->findProfessionForSkill(); - if (profession != NULL) + if (profession != nullptr) professionName = profession->getSkillName(); } } @@ -3317,7 +3317,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const NetworkId oid (Unicode::wideToNarrow(argv[1])); ServerObject* const object = safe_cast(NetworkIdManager::getObjectById(oid)); - if (object == NULL) + if (object == nullptr) result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); else if (!object->getClient()) result += getErrorMessage(argv[0], ERR_INVALID_USER); @@ -3346,7 +3346,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const NetworkId ownerId (Unicode::wideToNarrow(argv[2])); ServerObject * const object = safe_cast(NetworkIdManager::getObjectById(houseId)); - TangibleObject * const tangible = object ? object->asTangibleObject() : NULL; + TangibleObject * const tangible = object ? object->asTangibleObject() : nullptr; if (!tangible) result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); else @@ -3359,7 +3359,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { ServerObject * object = safe_cast(NetworkIdManager::getObjectById(playerObject->getLookAtTarget())); - if (NULL == object) + if (nullptr == object) object = playerObject; RegionMaster::RegionVector rv; @@ -3373,7 +3373,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const for (RegionMaster::RegionVector::const_iterator it = rv.begin(); it != rv.end(); ++it) { Region const * const r = *it; - if (NULL != r) + if (nullptr != r) { _itoa(r->getGeography(), buf, 10); result += Unicode::narrowToWide(buf); @@ -3390,7 +3390,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { ServerObject * const target = safe_cast(NetworkIdManager::getObjectById(playerObject->getLookAtTarget())); - if (NULL == target) + if (nullptr == target) { result += Unicode::narrowToWide("Invalid target"); return true; @@ -3434,7 +3434,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const ServerObject * object = safe_cast(NetworkIdManager::getObjectById(playerObject->getLookAtTarget())); - if (NULL == object) + if (nullptr == object) object = playerObject; Vector const & pos_w = object->getPosition_w(); @@ -3449,7 +3449,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { ServerObject * object = safe_cast(NetworkIdManager::getObjectById(playerObject->getLookAtTarget())); - if (NULL == object) + if (nullptr == object) object = playerObject; Vector const & pos_w = object->getPosition_w(); @@ -3463,7 +3463,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { ServerObject * object = safe_cast(NetworkIdManager::getObjectById(playerObject->getLookAtTarget())); - if (NULL == object) + if (nullptr == object) object = playerObject; Vector const & pos_w = object->getPosition_w(); @@ -3477,7 +3477,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); const ServerObject* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -3503,7 +3503,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); const ServerObject* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -3576,13 +3576,13 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject const* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - CreatureObject const* c = (o ? o->asCreatureObject() : NULL); - if (o == NULL) + CreatureObject const* c = (o ? o->asCreatureObject() : nullptr); + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - else if (c == NULL) + else if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; @@ -3590,7 +3590,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const else { PlayerObject const* p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -3612,8 +3612,8 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - CreatureObject* c = (o ? o->asCreatureObject() : NULL); - if (o == NULL) + CreatureObject* c = (o ? o->asCreatureObject() : nullptr); + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -3623,7 +3623,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const result += Unicode::narrowToWide("specified object is not authoritative on this game server\n"); return true; } - else if (c == NULL) + else if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; @@ -3631,7 +3631,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const else { PlayerObject* p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -3668,20 +3668,20 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - CreatureObject * c = (o ? o->asCreatureObject() : NULL); - if (o == NULL) + CreatureObject * c = (o ? o->asCreatureObject() : nullptr); + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - else if (c == NULL) + else if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -3755,14 +3755,14 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject const* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } TangibleObject const* t = o->asTangibleObject(); - if (t == NULL) + if (t == nullptr) { result += Unicode::narrowToWide("specified object is not a tangible object\n"); return true; @@ -3797,14 +3797,14 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId sourceOid(Unicode::wideToNarrow(argv[1])); ServerObject * sourceSo = dynamic_cast(ServerWorld::findObjectByNetworkId(sourceOid)); - if (sourceSo == NULL) + if (sourceSo == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is an invalid object\n", sourceOid.getValueString().c_str())); return true; } TangibleObject * sourceTo = sourceSo->asTangibleObject(); - if (sourceTo == NULL) + if (sourceTo == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is not a tangible object\n", sourceOid.getValueString().c_str())); return true; @@ -3812,14 +3812,14 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const NetworkId targetOid(Unicode::wideToNarrow(argv[2])); ServerObject * targetSo = dynamic_cast(ServerWorld::findObjectByNetworkId(targetOid)); - if (targetSo == NULL) + if (targetSo == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is an invalid object\n", targetOid.getValueString().c_str())); return true; } TangibleObject * targetTo = targetSo->asTangibleObject(); - if (targetTo == NULL) + if (targetTo == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is not a tangible object\n", targetOid.getValueString().c_str())); return true; @@ -3839,14 +3839,14 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId sourceOid(Unicode::wideToNarrow(argv[1])); ServerObject * sourceSo = dynamic_cast(ServerWorld::findObjectByNetworkId(sourceOid)); - if (sourceSo == NULL) + if (sourceSo == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is an invalid object\n", sourceOid.getValueString().c_str())); return true; } TangibleObject * sourceTo = sourceSo->asTangibleObject(); - if (sourceTo == NULL) + if (sourceTo == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is not a tangible object\n", sourceOid.getValueString().c_str())); return true; @@ -3866,14 +3866,14 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId sourceOid(Unicode::wideToNarrow(argv[1])); ServerObject * sourceSo = dynamic_cast(ServerWorld::findObjectByNetworkId(sourceOid)); - if (sourceSo == NULL) + if (sourceSo == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is an invalid object\n", sourceOid.getValueString().c_str())); return true; } TangibleObject * sourceTo = sourceSo->asTangibleObject(); - if (sourceTo == NULL) + if (sourceTo == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is not a tangible object\n", sourceOid.getValueString().c_str())); return true; @@ -3891,14 +3891,14 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId sourceOid(Unicode::wideToNarrow(argv[1])); ServerObject const * sourceSo = dynamic_cast(ServerWorld::findObjectByNetworkId(sourceOid)); - if (sourceSo == NULL) + if (sourceSo == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is an invalid object\n", sourceOid.getValueString().c_str())); return true; } CreatureObject const * sourceCo = sourceSo->asCreatureObject(); - if (sourceCo == NULL) + if (sourceCo == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is not a creature object\n", sourceOid.getValueString().c_str())); return true; @@ -3915,14 +3915,14 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId sourceOid(Unicode::wideToNarrow(argv[1])); ServerObject * sourceSo = dynamic_cast(ServerWorld::findObjectByNetworkId(sourceOid)); - if (sourceSo == NULL) + if (sourceSo == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is an invalid object\n", sourceOid.getValueString().c_str())); return true; } CreatureObject * sourceCo = sourceSo->asCreatureObject(); - if (sourceCo == NULL) + if (sourceCo == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("%s is not a creature object\n", sourceOid.getValueString().c_str())); return true; @@ -3931,7 +3931,7 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const result += Unicode::narrowToWide(FormattedString<512>().sprintf("dumping %s's command queue contents\n", sourceCo->getNetworkId().getValueString().c_str())); CommandQueue * queue = sourceCo->getCommandQueue(); - if (queue != NULL) + if (queue != nullptr) { std::string output; queue->spew(&output); @@ -3947,26 +3947,26 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - CreatureObject * c = (o ? o->asCreatureObject() : NULL); - if (o == NULL) + CreatureObject * c = (o ? o->asCreatureObject() : nullptr); + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - else if (c == NULL) + else if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; } - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); time_t const timeStartInterval = ((p->getChatSpamTimeEndInterval() > 0) ? static_cast(p->getChatSpamTimeEndInterval() - (ConfigServerGame::getChatSpamLimiterIntervalMinutes() * 60)) : 0); if ((timeStartInterval <= 0) || (timeNow < timeStartInterval)) @@ -3986,28 +3986,28 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject const * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject const * c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject const * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; } Client * client = o->getClient(); - if (client == NULL) + if (client == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("specified character object %s (%s) doesn't have a Client object (possible causes are may not be authoritative, or may not be connected)\n", o->getNetworkId().getValueString().c_str(), Unicode::wideToNarrow(o->getAssignedObjectName()).c_str())); return true; @@ -4042,28 +4042,28 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject const * c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject const * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; } Client * client = o->getClient(); - if (client == NULL) + if (client == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("specified character object %s (%s) doesn't have a Client object (possible causes are may not be authoritative, or may not be connected)\n", o->getNetworkId().getValueString().c_str(), Unicode::wideToNarrow(o->getAssignedObjectName()).c_str())); return true; @@ -4083,28 +4083,28 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject const * c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject const * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; } Client * client = o->getClient(); - if (client == NULL) + if (client == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("specified character object %s (%s) doesn't have a Client object (possible causes are may not be authoritative, or may not be connected)\n", o->getNetworkId().getValueString().c_str(), Unicode::wideToNarrow(o->getAssignedObjectName()).c_str())); return true; @@ -4180,12 +4180,12 @@ bool ConsoleCommandParserObject::performParsing2(const NetworkId & userId, const } else { - result += Unicode::narrowToWide(FormattedString<1024>().sprintf("object (%s) getFootprint() returns NULL.\n", oid.getValueString().c_str())); + result += Unicode::narrowToWide(FormattedString<1024>().sprintf("object (%s) getFootprint() returns nullptr.\n", oid.getValueString().c_str())); } } else { - result += Unicode::narrowToWide(FormattedString<1024>().sprintf("object (%s) getCollisionProperty() returns NULL.\n", oid.getValueString().c_str())); + result += Unicode::narrowToWide(FormattedString<1024>().sprintf("object (%s) getCollisionProperty() returns nullptr.\n", oid.getValueString().c_str())); } } else diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserObjvar.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserObjvar.cpp index e4a928c5..77063e84 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserObjvar.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserObjvar.cpp @@ -100,7 +100,7 @@ bool ConsoleCommandParserObjvar::performParsing (const NetworkId & userId, const { NetworkId oid (Unicode::wideToNarrow (argv[1])); ServerObject* object = ServerWorld::findObjectByNetworkId(oid); - if (object == NULL) + if (object == nullptr) { result += getErrorMessage (argv [0], ERR_INVALID_OBJECT); return true; @@ -224,7 +224,7 @@ bool ConsoleCommandParserObjvar::performParsing (const NetworkId & userId, const // This is now a no-op, but left in to avoid breaking the god client // NetworkId oid (Unicode::wideToNarrow (argv[1])); // ServerObject* object = ServerWorld::findObjectByNetworkId(oid); -// if (object == NULL) +// if (object == nullptr) // { // result += getErrorMessage (argv [0], ERR_INVALID_OBJECT); // return true; @@ -241,7 +241,7 @@ bool ConsoleCommandParserObjvar::performParsing (const NetworkId & userId, const { NetworkId oid (Unicode::wideToNarrow(argv[1])); ServerObject* object = ServerWorld::findObjectByNetworkId(oid); - if (object == NULL) + if (object == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -317,7 +317,7 @@ bool ConsoleCommandParserObjvar::performParsing (const NetworkId & userId, const { ServerObject * const userServerObject = ServerWorld::findObjectByNetworkId(userId); - if (userServerObject != NULL) + if (userServerObject != nullptr) { NetworkId specifiedNetworkId; @@ -329,7 +329,7 @@ bool ConsoleCommandParserObjvar::performParsing (const NetworkId & userId, const { CreatureObject * const userCreatureObject = CreatureObject::asCreatureObject(userServerObject); - if (userCreatureObject != NULL) + if (userCreatureObject != nullptr) { specifiedNetworkId = userCreatureObject->getLookAtTarget(); } @@ -337,7 +337,7 @@ bool ConsoleCommandParserObjvar::performParsing (const NetworkId & userId, const ServerObject * const specifiedServerObject = ServerWorld::findObjectByNetworkId(specifiedNetworkId); - if (specifiedServerObject != NULL) + if (specifiedServerObject != nullptr) { DynamicVariableList const & objVarList = specifiedServerObject->getObjVars(); FormattedString<1024> fs; @@ -357,7 +357,7 @@ bool ConsoleCommandParserObjvar::performParsing (const NetworkId & userId, const { NetworkId oid = NetworkId(Unicode::wideToNarrow(argv[1])); ServerObject* object = ServerWorld::findObjectByNetworkId(oid); - if (object == NULL) + if (object == nullptr) { result += getErrorMessage (argv [0], ERR_INVALID_OBJECT); return true; @@ -376,7 +376,7 @@ bool ConsoleCommandParserObjvar::performParsing (const NetworkId & userId, const { NetworkId oid = NetworkId(Unicode::wideToNarrow(argv[1])); ServerObject* object = ServerWorld::findObjectByNetworkId(oid); - if (object == NULL) + if (object == nullptr) { result += getErrorMessage (argv [0], ERR_INVALID_OBJECT); return true; diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserPvp.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserPvp.cpp index d212d0ca..a9f691b6 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserPvp.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserPvp.cpp @@ -103,13 +103,13 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject const* o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - CreatureObject const* c = (o ? o->asCreatureObject() : NULL); - if (o == NULL) + CreatureObject const* c = (o ? o->asCreatureObject() : nullptr); + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - else if (c == NULL) + else if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; @@ -117,7 +117,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St else { PlayerObject const* p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -185,7 +185,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St result += Unicode::narrowToWide(FormattedString<512>().sprintf("lifetime PvP kills: %ld\n",p->getLifetimePvpKills())); result += Unicode::narrowToWide(FormattedString<512>().sprintf("next GCW rating calculation time: %ld",p->getNextGcwRatingCalcTime())); - int32 const now = static_cast(::time(NULL)); + int32 const now = static_cast(::time(nullptr)); if (p->getNextGcwRatingCalcTime() > 0) { if (p->getNextGcwRatingCalcTime() >= now) @@ -223,13 +223,13 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - CreatureObject * c = (o ? o->asCreatureObject() : NULL); - if (o == NULL) + CreatureObject * c = (o ? o->asCreatureObject() : nullptr); + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - else if (c == NULL) + else if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; @@ -237,7 +237,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St else { PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -259,13 +259,13 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - CreatureObject * c = (o ? o->asCreatureObject() : NULL); - if (o == NULL) + CreatureObject * c = (o ? o->asCreatureObject() : nullptr); + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - else if (c == NULL) + else if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; @@ -273,7 +273,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St else { PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -295,13 +295,13 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - CreatureObject * c = (o ? o->asCreatureObject() : NULL); - if (o == NULL) + CreatureObject * c = (o ? o->asCreatureObject() : nullptr); + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - else if (c == NULL) + else if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; @@ -309,7 +309,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St else { PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -331,13 +331,13 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - CreatureObject * c = (o ? o->asCreatureObject() : NULL); - if (o == NULL) + CreatureObject * c = (o ? o->asCreatureObject() : nullptr); + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - else if (c == NULL) + else if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; @@ -345,7 +345,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St else { PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -369,13 +369,13 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - CreatureObject * c = (o ? o->asCreatureObject() : NULL); - if (o == NULL) + CreatureObject * c = (o ? o->asCreatureObject() : nullptr); + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - else if (c == NULL) + else if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; @@ -383,7 +383,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St else { PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -405,13 +405,13 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - CreatureObject * c = (o ? o->asCreatureObject() : NULL); - if (o == NULL) + CreatureObject * c = (o ? o->asCreatureObject() : nullptr); + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - else if (c == NULL) + else if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; @@ -419,7 +419,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St else { PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -441,13 +441,13 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - CreatureObject * c = (o ? o->asCreatureObject() : NULL); - if (o == NULL) + CreatureObject * c = (o ? o->asCreatureObject() : nullptr); + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } - else if (c == NULL) + else if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; @@ -455,7 +455,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St else { PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -477,21 +477,21 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -585,7 +585,7 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -612,21 +612,21 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * const o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * const c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * const p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -660,21 +660,21 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * const o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * const c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * const p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -708,21 +708,21 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * const o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * const c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * const p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -756,21 +756,21 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * const o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * const c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * const p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -804,21 +804,21 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject * const o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject * const c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject * const p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -852,14 +852,14 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId const oid(Unicode::wideToNarrow(argv[1])); ServerObject const * const o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject const * const c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; @@ -874,14 +874,14 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId const actorOid(Unicode::wideToNarrow(argv[1])); ServerObject const * const actorSo = dynamic_cast(ServerWorld::findObjectByNetworkId(actorOid)); - if (actorSo == NULL) + if (actorSo == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } TangibleObject const * const actorTo = actorSo->asTangibleObject(); - if (actorTo == NULL) + if (actorTo == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("(%s) is not a TangibleObject\n", actorOid.getValueString().c_str())); return true; @@ -889,14 +889,14 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St NetworkId const targetOid(Unicode::wideToNarrow(argv[2])); ServerObject const * const targetSo = dynamic_cast(ServerWorld::findObjectByNetworkId(targetOid)); - if (targetSo == NULL) + if (targetSo == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } TangibleObject const * const targetTo = targetSo->asTangibleObject(); - if (targetTo == NULL) + if (targetTo == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("(%s) is not a TangibleObject\n", targetOid.getValueString().c_str())); return true; @@ -924,14 +924,14 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St { NetworkId const actorOid(Unicode::wideToNarrow(argv[1])); ServerObject * const actorSo = dynamic_cast(ServerWorld::findObjectByNetworkId(actorOid)); - if (actorSo == NULL) + if (actorSo == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } TangibleObject * const actorTo = actorSo->asTangibleObject(); - if (actorTo == NULL) + if (actorTo == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("(%s) is not a TangibleObject\n", actorOid.getValueString().c_str())); return true; @@ -939,14 +939,14 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St NetworkId const targetOid(Unicode::wideToNarrow(argv[2])); ServerObject * const targetSo = dynamic_cast(ServerWorld::findObjectByNetworkId(targetOid)); - if (targetSo == NULL) + if (targetSo == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } TangibleObject * const targetTo = targetSo->asTangibleObject(); - if (targetTo == NULL) + if (targetTo == nullptr) { result += Unicode::narrowToWide(FormattedString<512>().sprintf("(%s) is not a TangibleObject\n", targetOid.getValueString().c_str())); return true; @@ -968,28 +968,28 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St NetworkId const oid(Unicode::wideToNarrow(argv[1])); ServerObject const * const o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject const * const c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject const * const p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; } ShipObject const * const ship = ShipObject::getContainingShipObject(c); - if (ship == NULL) + if (ship == nullptr) { result += Unicode::narrowToWide("specified character object is not in a ship\n"); return true; @@ -1042,28 +1042,28 @@ bool ConsoleCommandParserPvp::performParsing (const NetworkId & userId, const St NetworkId const oid(Unicode::wideToNarrow(argv[1])); ServerObject const * const o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject const * const c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject const * const p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; } ShipObject const * const ship = ShipObject::getContainingShipObject(c); - if (ship == NULL) + if (ship == nullptr) { result += Unicode::narrowToWide("specified character object is not in a ship\n"); return true; diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserResource.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserResource.cpp index 2d22864d..cde60a8e 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserResource.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserResource.cpp @@ -73,7 +73,7 @@ bool ConsoleCommandParserResource::performParsing (const NetworkId & userId, con CachedNetworkId harvester(Unicode::wideToNarrow (argv[1])); ServerObject* harvesterObject = safe_cast(harvester.getObject()); - if (harvesterObject == NULL) + if (harvesterObject == nullptr) { result += getErrorMessage (argv [0], ERR_INVALID_OBJECT); return true; @@ -90,7 +90,7 @@ bool ConsoleCommandParserResource::performParsing (const NetworkId & userId, con CachedNetworkId harvester(Unicode::wideToNarrow (argv[1])); ServerObject* harvesterObject = safe_cast(harvester.getObject()); - if (harvesterObject == NULL) + if (harvesterObject == nullptr) { result += getErrorMessage (argv [0], ERR_INVALID_OBJECT); return true; @@ -123,7 +123,7 @@ bool ConsoleCommandParserResource::performParsing (const NetworkId & userId, con CachedNetworkId harvester(Unicode::wideToNarrow (argv[1])); ServerObject* harvesterObject = safe_cast(harvester.getObject()); - if (harvesterObject == NULL) + if (harvesterObject == nullptr) { result += getErrorMessage (argv [0], ERR_INVALID_OBJECT); return true; @@ -208,7 +208,7 @@ bool ConsoleCommandParserResource::performParsing (const NetworkId & userId, con ResourceContainerObject * const container = dynamic_cast(NetworkIdManager::getObjectById(contId)); std::string const & resourcePath = Unicode::wideToNarrow(argv[2]); ResourceTypeObject * const resType = ServerUniverse::getInstance().getResourceTypeByName(resourcePath); - int const amount = strtol(Unicode::wideToNarrow (argv[3]).c_str (), NULL, 10); + int const amount = strtol(Unicode::wideToNarrow (argv[3]).c_str (), nullptr, 10); NetworkId const source(Unicode::wideToNarrow (argv[4])); if (container && resType) @@ -228,7 +228,7 @@ bool ConsoleCommandParserResource::performParsing (const NetworkId & userId, con { NetworkId contId (Unicode::wideToNarrow (argv[1])); ResourceContainerObject* container=dynamic_cast(NetworkIdManager::getObjectById(contId)); - if (container != NULL) + if (container != nullptr) { NetworkId sourceId; if (argv.size() >= 3) @@ -251,7 +251,7 @@ bool ConsoleCommandParserResource::performParsing (const NetworkId & userId, con { NetworkId contId (Unicode::wideToNarrow (argv[1])); ResourceContainerObject* container=dynamic_cast(NetworkIdManager::getObjectById(contId)); - if (container != NULL) + if (container != nullptr) { if (container->debugRecycle()) result += getErrorMessage(argv[0], ERR_SUCCESS); @@ -267,7 +267,7 @@ bool ConsoleCommandParserResource::performParsing (const NetworkId & userId, con CachedNetworkId contId (Unicode::wideToNarrow (argv[1])); ResourceContainerObject* container=dynamic_cast(contId.getObject()); ResourceTypeObject *resType=ServerUniverse::getInstance().getResourceTypeByName(Unicode::wideToNarrow(argv[2])); - int amount=strtol(Unicode::wideToNarrow (argv[3]).c_str (), NULL, 10); + int amount=strtol(Unicode::wideToNarrow (argv[3]).c_str (), nullptr, 10); if (container && resType) { @@ -307,8 +307,8 @@ bool ConsoleCommandParserResource::performParsing (const NetworkId & userId, con { const std::string parentResourceClassName (Unicode::wideToNarrow(argv[1])); const std::string resourceTypeName (Unicode::wideToNarrow(argv[2])); - const int surveyRange = strtol(Unicode::wideToNarrow(argv[3]).c_str(),NULL,10); - const int numPoints = strtol(Unicode::wideToNarrow(argv[4]).c_str(),NULL,10); + const int surveyRange = strtol(Unicode::wideToNarrow(argv[3]).c_str(),nullptr,10); + const int numPoints = strtol(Unicode::wideToNarrow(argv[4]).c_str(),nullptr,10); const Object * player = NetworkIdManager::getObjectById(userId); if (player) diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserScript.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserScript.cpp index a2703595..99f1f236 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserScript.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserScript.cpp @@ -62,7 +62,7 @@ bool ConsoleCommandParserScript::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow (argv[2])); ServerObject* object = ServerWorld::findObjectByNetworkId(oid); - if (object == NULL) + if (object == nullptr) { result += getErrorMessage (argv [0], ERR_INVALID_OBJECT); return true; @@ -81,7 +81,7 @@ bool ConsoleCommandParserScript::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[2])); ServerObject* object = ServerWorld::findObjectByNetworkId(oid); - if (object == NULL) + if (object == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -100,7 +100,7 @@ bool ConsoleCommandParserScript::performParsing (const NetworkId & userId, const { ServerObject * const userServerObject = ServerWorld::findObjectByNetworkId(userId); - if (userServerObject != NULL) + if (userServerObject != nullptr) { NetworkId specifiedNetworkId; @@ -112,7 +112,7 @@ bool ConsoleCommandParserScript::performParsing (const NetworkId & userId, const { CreatureObject * const userCreatureObject = CreatureObject::asCreatureObject(userServerObject); - if (userCreatureObject != NULL) + if (userCreatureObject != nullptr) { specifiedNetworkId = userCreatureObject->getLookAtTarget(); } @@ -120,7 +120,7 @@ bool ConsoleCommandParserScript::performParsing (const NetworkId & userId, const ServerObject * const specifiedServerObject = ServerObject::getServerObject(specifiedNetworkId); - if (specifiedServerObject != NULL) + if (specifiedServerObject != nullptr) { ScriptList const & scripts = specifiedServerObject->getScriptObject()->getScripts(); FormattedString<1024> fs; @@ -226,7 +226,7 @@ bool ConsoleCommandParserScript::performParsing (const NetworkId & userId, const // get the object id NetworkId oid(Unicode::wideToNarrow(argv[oidIndex])); ServerObject* object = ServerWorld::findObjectByNetworkId(oid); - if (object == NULL) + if (object == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserServer.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserServer.cpp index f789d127..c81f8966 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserServer.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserServer.cpp @@ -301,7 +301,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const return true; } - unsigned long val = strtoul(Unicode::wideToNarrow(argv[1]).c_str(), NULL, 10); + unsigned long val = strtoul(Unicode::wideToNarrow(argv[1]).c_str(), nullptr, 10); const bool isPublic = (val != 0); SetConnectionServerPublic const p(isPublic); @@ -354,8 +354,8 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const return true; } - unsigned long secsToWait = strtoul(Unicode::wideToNarrow(argv[1]).c_str(), NULL, 10); - unsigned long maxSecs = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), NULL, 10); + unsigned long secsToWait = strtoul(Unicode::wideToNarrow(argv[1]).c_str(), nullptr, 10); + unsigned long maxSecs = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), nullptr, 10); Unicode::String systemMessage; for( size_t i=3; i< argv.size(); ++i) { @@ -386,7 +386,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const return true; } - unsigned long val = strtoul(Unicode::wideToNarrow(argv[1]).c_str (), NULL, 10); + unsigned long val = strtoul(Unicode::wideToNarrow(argv[1]).c_str (), nullptr, 10); switch (val) { case 1: @@ -482,7 +482,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject* object = ServerWorld::findObjectByNetworkId(oid); - if (object == NULL) + if (object == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -574,7 +574,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const } else if (isAbbrev (argv[0], "getSceneId")) { - if (user == NULL) + if (user == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -596,7 +596,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const return true; } - unsigned long val = strtoul(Unicode::wideToNarrow(argv[1]).c_str (), NULL, 10); + unsigned long val = strtoul(Unicode::wideToNarrow(argv[1]).c_str (), nullptr, 10); if (user->getClient()->setGodMode(val != 0)) result += getErrorMessage (argv[0], ERR_SUCCESS); else @@ -637,7 +637,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const { std::string tableName; tableName = Unicode::wideToNarrow(argv[1]); - if (DataTableManager::reload(tableName) != NULL) + if (DataTableManager::reload(tableName) != nullptr) { ServerMessageForwarding::beginBroadcast(); @@ -694,7 +694,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const else { PlanetObject * planet = ServerUniverse::getInstance().getCurrentPlanet(); - if (planet == NULL) + if (planet == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -708,7 +708,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const for (std::vector::const_iterator i = regions.begin(); i != regions.end(); ++i) { const RegionRectangle * ro = dynamic_cast(*i); - if (ro != NULL) + if (ro != nullptr) { float minX, minY, maxX, maxY; ro->getExtent(minX, minY, maxX, maxY); @@ -717,7 +717,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const client->send(mrgrr, true); } const RegionCircle* co = dynamic_cast(*i); - if (co != NULL) + if (co != nullptr) { float centerX, centerY, radius; co->getExtent(centerX, centerY, radius); @@ -743,7 +743,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const { uint32 processId = GameServer::getInstance().getProcessId(); if (argv.size() > 3) - processId = strtoul(Unicode::wideToNarrow(argv[3]).c_str(), NULL, 10); + processId = strtoul(Unicode::wideToNarrow(argv[3]).c_str(), nullptr, 10); std::string op = Unicode::wideToNarrow(argv[1]) + " " + Unicode::wideToNarrow(argv[2]); @@ -760,7 +760,7 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const { uint32 processId = GameServer::getInstance().getProcessId(); if (argv.size() > 2) - processId = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), NULL, 10); + processId = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), nullptr, 10); std::string op(Unicode::wideToNarrow(argv[1])); if (processId == GameServer::getInstance().getProcessId()) @@ -840,8 +840,8 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const } else if (isAbbrev(argv[0], "getRegionsAt")) { - float x = static_cast(strtod(Unicode::wideToNarrow(argv[1]).c_str(), NULL)); - float z = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), NULL)); + float x = static_cast(strtod(Unicode::wideToNarrow(argv[1]).c_str(), nullptr)); + float z = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), nullptr)); std::vector results; @@ -990,10 +990,10 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const //" ", "Save out an area for buildout datatables" std::string const &serverFilename = Unicode::wideToNarrow(argv[1]); std::string const &clientFilename = Unicode::wideToNarrow(argv[2]); - float x1 = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL)); - float z1 = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), NULL)); - float x2 = static_cast(strtod(Unicode::wideToNarrow(argv[5]).c_str(), NULL)); - float z2 = static_cast(strtod(Unicode::wideToNarrow(argv[6]).c_str(), NULL)); + float x1 = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr)); + float z1 = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), nullptr)); + float x2 = static_cast(strtod(Unicode::wideToNarrow(argv[5]).c_str(), nullptr)); + float z2 = static_cast(strtod(Unicode::wideToNarrow(argv[6]).c_str(), nullptr)); ServerBuildoutManager::saveArea(serverFilename, clientFilename, x1, z1, x2, z2); } else if (isAbbrev(argv[0], "clientSaveBuildoutArea")) @@ -1001,10 +1001,10 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const //" " std::string const &scene = Unicode::wideToNarrow(argv[1]); std::string const &areaName = Unicode::wideToNarrow(argv[2]); - float x1 = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL)); - float z1 = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), NULL)); - float x2 = static_cast(strtod(Unicode::wideToNarrow(argv[5]).c_str(), NULL)); - float z2 = static_cast(strtod(Unicode::wideToNarrow(argv[6]).c_str(), NULL)); + float x1 = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr)); + float z1 = static_cast(strtod(Unicode::wideToNarrow(argv[4]).c_str(), nullptr)); + float x2 = static_cast(strtod(Unicode::wideToNarrow(argv[5]).c_str(), nullptr)); + float z2 = static_cast(strtod(Unicode::wideToNarrow(argv[6]).c_str(), nullptr)); if (scene == ConfigServerGame::getSceneID() && user->getClient()) ServerBuildoutManager::clientSaveArea(*user->getClient(), areaName, x1, z1, x2, z2); } @@ -1044,7 +1044,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const if (argv.size() == 2) { // specify server by process id - uint32 serverId = strtoul(Unicode::wideToNarrow(argv[1]).c_str(), NULL, 10); + uint32 serverId = strtoul(Unicode::wideToNarrow(argv[1]).c_str(), nullptr, 10); if (serverId != 0) { ExcommunicateGameServerMessage exmsg(serverId, 0, ""); @@ -1058,7 +1058,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const { // specify server by scene & preload role number std::string const &scene = Unicode::wideToNarrow(argv[1]); - uint32 preloadRole = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), NULL, 10); + uint32 preloadRole = strtoul(Unicode::wideToNarrow(argv[2]).c_str(), nullptr, 10); GenericValueTypeMessage > msg("RestartServerByRoleMessage", std::make_pair(scene, preloadRole)); if (scene == ConfigServerGame::getSceneID()) @@ -1072,8 +1072,8 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const { // specify server by geographic location std::string const &scene = Unicode::wideToNarrow(argv[1]); - int x = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), NULL)); - int z = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), NULL)); + int x = static_cast(strtod(Unicode::wideToNarrow(argv[2]).c_str(), nullptr)); + int z = static_cast(strtod(Unicode::wideToNarrow(argv[3]).c_str(), nullptr)); RestartServerMessage msg(scene, x, z); if (scene == ConfigServerGame::getSceneID()) @@ -1322,14 +1322,14 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const NetworkId oid2(Unicode::wideToNarrow(argv[2])); ServerObject const * const object1 = ServerWorld::findObjectByNetworkId(oid1); - if (object1 == NULL) + if (object1 == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } ServerObject const * const object2 = ServerWorld::findObjectByNetworkId(oid2); - if (object2 == NULL) + if (object2 == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; @@ -1366,7 +1366,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const TerrainObject const * terrain = TerrainObject::getConstInstance(); if (!terrain) { - result += Unicode::narrowToWide("terrain object is NULL\n"); + result += Unicode::narrowToWide("terrain object is nullptr\n"); return true; } @@ -1443,7 +1443,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const TerrainObject const * terrain = TerrainObject::getConstInstance(); if (!terrain) { - result += Unicode::narrowToWide("terrain object is NULL\n"); + result += Unicode::narrowToWide("terrain object is nullptr\n"); return true; } @@ -1491,7 +1491,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const TerrainObject * terrain = TerrainObject::getInstance(); if (!terrain) { - result += Unicode::narrowToWide("terrain object is NULL\n"); + result += Unicode::narrowToWide("terrain object is nullptr\n"); return true; } @@ -1557,8 +1557,8 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const { result += Unicode::narrowToWide(iterFind->second.getDebugString()); - ServerObject const * const soGroupObject = (iterFind->second.groupId.isValid() ? safe_cast(NetworkIdManager::getObjectById(iterFind->second.groupId)) : NULL); - GroupObject const * const groupObject = (soGroupObject ? soGroupObject->asGroupObject() : NULL); + ServerObject const * const soGroupObject = (iterFind->second.groupId.isValid() ? safe_cast(NetworkIdManager::getObjectById(iterFind->second.groupId)) : nullptr); + GroupObject const * const groupObject = (soGroupObject ? soGroupObject->asGroupObject() : nullptr); if (groupObject) { unsigned int const secondsLeftOnGroupPickup = groupObject->getSecondsLeftOnGroupPickup(); @@ -1717,7 +1717,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const else if (isAbbrev(argv[0], "listCharacterLastLoginTimeBrief")) { int const days = atoi(Unicode::wideToNarrow(argv[1]).c_str()); - time_t const cutoff = std::max(static_cast(0), static_cast(::time(NULL) - (60 * 60 * 24 * days))); + time_t const cutoff = std::max(static_cast(0), static_cast(::time(nullptr) - (60 * 60 * 24 * days))); std::multimap, std::string> > resultList; NameManager::getInstance().getPlayerWithLastLoginTimeAfter(cutoff, resultList); @@ -1726,7 +1726,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "listCharacterLastLoginTimeAfterBrief")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -1749,7 +1749,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "listCharacterLastLoginTimeBeforeBrief")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -1772,7 +1772,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "listCharacterLastLoginTimeBetweenBrief")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -1817,7 +1817,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const else if (isAbbrev(argv[0], "listCharacterLastLoginTimeDetailed")) { int const days = atoi(Unicode::wideToNarrow(argv[1]).c_str()); - time_t const cutoff = std::max(static_cast(0), static_cast(::time(NULL) - (60 * 60 * 24 * days))); + time_t const cutoff = std::max(static_cast(0), static_cast(::time(nullptr) - (60 * 60 * 24 * days))); std::multimap, std::string> > resultList; NameManager::getInstance().getPlayerWithLastLoginTimeAfter(cutoff, resultList); @@ -1829,7 +1829,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "listCharacterLastLoginTimeAfterDetailed")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -1855,7 +1855,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "listCharacterLastLoginTimeBeforeDetailed")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -1881,7 +1881,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "listCharacterLastLoginTimeBetweenDetailed")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -1929,7 +1929,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const else if (isAbbrev(argv[0], "sendMailToCharacterLastLoginTime")) { int const days = atoi(Unicode::wideToNarrow(argv[1]).c_str()); - time_t const cutoff = std::max(static_cast(0), static_cast(::time(NULL) - (60 * 60 * 24 * days))); + time_t const cutoff = std::max(static_cast(0), static_cast(::time(nullptr) - (60 * 60 * 24 * days))); int const argc = argv.size(); Unicode::String mailBody; @@ -1952,7 +1952,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const static Unicode::String s_mailBody; static time_t s_confirmationTimeout = 0; - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); if ((s_days == days) && (s_confirmationTimeout > timeNow) && (s_fromName == Unicode::wideToNarrow(argv[2])) && (s_mailSubject == argv[3]) && (s_mailBody == mailBody)) { @@ -1991,7 +1991,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "sendMailToCharacterLastLoginTimeAfter")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -2028,7 +2028,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const static Unicode::String s_mailBody; static time_t s_confirmationTimeout = 0; - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); if ((s_cutoff == cutoff) && (s_confirmationTimeout > timeNow) && (s_fromName == Unicode::wideToNarrow(argv[7])) && (s_mailSubject == argv[8]) && (s_mailBody == mailBody)) { @@ -2067,7 +2067,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "sendMailToCharacterLastLoginTimeBefore")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -2104,7 +2104,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const static Unicode::String s_mailBody; static time_t s_confirmationTimeout = 0; - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); if ((s_cutoff == cutoff) && (s_confirmationTimeout > timeNow) && (s_fromName == Unicode::wideToNarrow(argv[7])) && (s_mailSubject == argv[8]) && (s_mailBody == mailBody)) { @@ -2143,7 +2143,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "sendMailToCharacterLastLoginTimeBetween")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -2202,7 +2202,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const static Unicode::String s_mailBody; static time_t s_confirmationTimeout = 0; - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); if ((s_cutoffLower == cutoffLower) && (s_cutoffUpper == cutoffUpper) && (s_confirmationTimeout > timeNow) && (s_fromName == Unicode::wideToNarrow(argv[13])) && (s_mailSubject == argv[14]) && (s_mailBody == mailBody)) { @@ -2244,7 +2244,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const else if (isAbbrev(argv[0], "listCharacterCreateTimeBrief")) { int const days = atoi(Unicode::wideToNarrow(argv[1]).c_str()); - time_t const cutoff = std::max(static_cast(0), static_cast(::time(NULL) - (60 * 60 * 24 * days))); + time_t const cutoff = std::max(static_cast(0), static_cast(::time(nullptr) - (60 * 60 * 24 * days))); std::multimap, std::string> > resultList; NameManager::getInstance().getPlayerWithCreateTimeAfter(cutoff, resultList); @@ -2253,7 +2253,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "listCharacterCreateTimeAfterBrief")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -2276,7 +2276,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "listCharacterCreateTimeBeforeBrief")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -2299,7 +2299,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "listCharacterCreateTimeBetweenBrief")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -2344,7 +2344,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const else if (isAbbrev(argv[0], "listCharacterCreateTimeDetailed")) { int const days = atoi(Unicode::wideToNarrow(argv[1]).c_str()); - time_t const cutoff = std::max(static_cast(0), static_cast(::time(NULL) - (60 * 60 * 24 * days))); + time_t const cutoff = std::max(static_cast(0), static_cast(::time(nullptr) - (60 * 60 * 24 * days))); std::multimap, std::string> > resultList; NameManager::getInstance().getPlayerWithCreateTimeAfter(cutoff, resultList); @@ -2356,7 +2356,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "listCharacterCreateTimeAfterDetailed")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -2382,7 +2382,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "listCharacterCreateTimeBeforeDetailed")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -2408,7 +2408,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "listCharacterCreateTimeBetweenDetailed")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -2456,7 +2456,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const else if (isAbbrev(argv[0], "sendMailToCharacterCreateTime")) { int const days = atoi(Unicode::wideToNarrow(argv[1]).c_str()); - time_t const cutoff = std::max(static_cast(0), static_cast(::time(NULL) - (60 * 60 * 24 * days))); + time_t const cutoff = std::max(static_cast(0), static_cast(::time(nullptr) - (60 * 60 * 24 * days))); int const argc = argv.size(); Unicode::String mailBody; @@ -2479,7 +2479,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const static Unicode::String s_mailBody; static time_t s_confirmationTimeout = 0; - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); if ((s_days == days) && (s_confirmationTimeout > timeNow) && (s_fromName == Unicode::wideToNarrow(argv[2])) && (s_mailSubject == argv[3]) && (s_mailBody == mailBody)) { @@ -2518,7 +2518,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "sendMailToCharacterCreateTimeAfter")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -2555,7 +2555,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const static Unicode::String s_mailBody; static time_t s_confirmationTimeout = 0; - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); if ((s_cutoff == cutoff) && (s_confirmationTimeout > timeNow) && (s_fromName == Unicode::wideToNarrow(argv[7])) && (s_mailSubject == argv[8]) && (s_mailBody == mailBody)) { @@ -2594,7 +2594,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "sendMailToCharacterCreateTimeBefore")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -2631,7 +2631,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const static Unicode::String s_mailBody; static time_t s_confirmationTimeout = 0; - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); if ((s_cutoff == cutoff) && (s_confirmationTimeout > timeNow) && (s_fromName == Unicode::wideToNarrow(argv[7])) && (s_mailSubject == argv[8]) && (s_mailBody == mailBody)) { @@ -2670,7 +2670,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const } else if (isAbbrev(argv[0], "sendMailToCharacterCreateTimeBetween")) { - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); timeinfo->tm_year = atoi(Unicode::wideToNarrow(argv[1]).c_str()) - 1900; timeinfo->tm_mon = atoi(Unicode::wideToNarrow(argv[2]).c_str()) - 1; @@ -2729,7 +2729,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const static Unicode::String s_mailBody; static time_t s_confirmationTimeout = 0; - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); if ((s_cutoffLower == cutoffLower) && (s_cutoffUpper == cutoffUpper) && (s_confirmationTimeout > timeNow) && (s_fromName == Unicode::wideToNarrow(argv[13])) && (s_mailSubject == argv[14]) && (s_mailBody == mailBody)) { @@ -2776,7 +2776,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const uint32 const targetStationId = static_cast(atoi(Unicode::wideToNarrow(argv[4]).c_str())); std::string const targetCluster = Unicode::wideToNarrow(argv[5]); - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); result += Unicode::narrowToWide(FormattedString<512>().sprintf(" currentTime: %ld, %s\n", timeNow, CalendarTime::convertEpochToTimeStringLocal(timeNow).c_str())); result += Unicode::narrowToWide(FormattedString<512>().sprintf("\n characterCreateTime: %ld\n", sourceCharacterCreateTime)); @@ -2837,7 +2837,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const { std::string const sourceCluster = Unicode::wideToNarrow(argv[1]); - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); result += Unicode::narrowToWide(FormattedString<512>().sprintf(" currentTime: %ld, %s\n", timeNow, CalendarTime::convertEpochToTimeStringLocal(timeNow).c_str())); result += Unicode::narrowToWide(FormattedString<512>().sprintf(" sourceCluster: %s\n", sourceCluster.c_str())); @@ -2893,7 +2893,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const { result += Unicode::narrowToWide(FormattedString<512>().sprintf(" free CTS info file: %s\n", FreeCtsDataTable::getFreeCtsFileName().c_str())); - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); result += Unicode::narrowToWide(FormattedString<512>().sprintf(" currentTime: %ld, %s\n", timeNow, CalendarTime::convertEpochToTimeStringLocal(timeNow).c_str())); } @@ -3125,7 +3125,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const else { result += Unicode::narrowToWide(FormattedString<1024>().sprintf("Requesting adjustment of imperial score for GCW score category (%s) by (%d). It can take up to 1 minute for the adjustment request to be completed.\n", category.c_str(), adjustment)); - ServerUniverse::getInstance().adjustGcwImperialScore("remote server adjustGcwImperialScore", NULL, category, adjustment); + ServerUniverse::getInstance().adjustGcwImperialScore("remote server adjustGcwImperialScore", nullptr, category, adjustment); } } else if (isAbbrev(argv[0], "adjustGcwRebelScore")) @@ -3148,7 +3148,7 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const else { result += Unicode::narrowToWide(FormattedString<1024>().sprintf("Requesting adjustment of rebel score for GCW score category (%s) by (%d). It can take up to 1 minute for the adjustment request to be completed.\n", category.c_str(), adjustment)); - ServerUniverse::getInstance().adjustGcwRebelScore("remote server adjustGcwRebelScore", NULL, category, adjustment); + ServerUniverse::getInstance().adjustGcwRebelScore("remote server adjustGcwRebelScore", nullptr, category, adjustment); } } else if (isAbbrev(argv[0], "decayGcwScore")) @@ -3202,20 +3202,20 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject const * const o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject const * const c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } - if (PlayerCreatureController::getPlayerObject(c) == NULL) + if (PlayerCreatureController::getPlayerObject(c) == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; @@ -3240,21 +3240,21 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const { NetworkId oid(Unicode::wideToNarrow(argv[1])); ServerObject const * const o = dynamic_cast(ServerWorld::findObjectByNetworkId(oid)); - if (o == NULL) + if (o == nullptr) { result += getErrorMessage(argv[0], ERR_INVALID_OBJECT); return true; } CreatureObject const * const c = o->asCreatureObject(); - if (c == NULL) + if (c == nullptr) { result += Unicode::narrowToWide("specified object is not a creature object\n"); return true; } PlayerObject const * const p = PlayerCreatureController::getPlayerObject(c); - if (p == NULL) + if (p == nullptr) { result += Unicode::narrowToWide("specified object is not a character object\n"); return true; diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserShip.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserShip.cpp index 38efa02a..3fc8ad7d 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserShip.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserShip.cpp @@ -116,7 +116,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S slotNameToken.clear (); } - if (ship == NULL) + if (ship == nullptr) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); return true; @@ -126,7 +126,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S ShipChassis const * const shipChassis = ShipChassis::findShipChassisByCrc (chassisType); - if (shipChassis == NULL) + if (shipChassis == nullptr) { result += Unicode::narrowToWide ("No chassis"); return true; @@ -178,7 +178,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S if (ship->isSlotInstalled(chassisSlot)) shipComponentData = ship->createShipComponentData(chassisSlot); - if (shipComponentData == NULL) + if (shipComponentData == nullptr) { result += Unicode::narrowToWide (" Loaded NONE\n"); } @@ -223,7 +223,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S { TangibleObject * const component = findTangible (user->getLookAtTarget (), argv, 1); - if (component == NULL) + if (component == nullptr) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); return true; @@ -231,7 +231,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S ShipComponentData * const shipComponentData = ShipComponentDataManager::create (*component); - if (shipComponentData == NULL) + if (shipComponentData == nullptr) { result += Unicode::narrowToWide ("Not a ship component"); return true; @@ -252,13 +252,13 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S TangibleObject * const component = findTangible (NetworkId::cms_invalid, argv, 1); std::string const & slotName = Unicode::wideToNarrow (argv [2]); - if (ship == NULL) + if (ship == nullptr) { result += Unicode::narrowToWide ("no ship"); return true; } - if (component == NULL) + if (component == nullptr) { result += Unicode::narrowToWide ("no component"); return true; @@ -279,14 +279,14 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S } ShipChassis const * const shipChassis = ShipChassis::findShipChassisByCrc (ship->getChassisType ()); - if (shipChassis == NULL) + if (shipChassis == nullptr) { result += Unicode::narrowToWide ("Ship chassis invalid"); return true; } ShipChassisSlot const * const slot = shipChassis->getSlot (shipChassisSlotType); - if (slot == NULL) + if (slot == nullptr) { result += Unicode::narrowToWide ("Ship chassis does not support that slot"); return true; @@ -294,7 +294,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S ShipComponentData * const shipComponentData = ShipComponentDataManager::create (*component); - if (shipComponentData == NULL) + if (shipComponentData == nullptr) { result += Unicode::narrowToWide ("Not a ship component"); return true; @@ -325,7 +325,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S std::string const & componentName = Unicode::wideToNarrow (argv [1]); std::string const & slotName = Unicode::wideToNarrow (argv [2]); - if (ship == NULL) + if (ship == nullptr) { result += Unicode::narrowToWide ("no ship"); return true; @@ -334,7 +334,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S uint32 const componentCrc = Crc::normalizeAndCalculate (componentName.c_str ()); ShipComponentDescriptor const * const shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByCrc (componentCrc); - if (shipComponentDescriptor == NULL) + if (shipComponentDescriptor == nullptr) { result += Unicode::narrowToWide ("Invalid component name"); return true; @@ -364,13 +364,13 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S TangibleObject * const targetContainer = findTangible (user->getInventory ()->getNetworkId (), argv, 2); std::string const & slotName = Unicode::wideToNarrow (argv [1]); - if (ship == NULL) + if (ship == nullptr) { result += Unicode::narrowToWide ("no ship"); return true; } - if (targetContainer == NULL) + if (targetContainer == nullptr) { result += Unicode::narrowToWide ("no target container"); return true; @@ -405,7 +405,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S ShipObject * const ship = dynamic_cast(findTangible (user->getLookAtTarget (), argv, 2)); std::string const & slotName = Unicode::wideToNarrow (argv [1]); - if (ship == NULL) + if (ship == nullptr) { result += Unicode::narrowToWide ("no ship"); return true; @@ -436,14 +436,14 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S else if (isCommand (argv[0], CommandNames::pseudoDamageShip)) { ShipObject const * const victimShipObject = user->getPilotedShip(); - if (victimShipObject == NULL) + if (victimShipObject == nullptr) { result += Unicode::narrowToWide ("You are not piloting a ship."); return true; } ShipObject const * const attackerShipObject = dynamic_cast(findTangible (user->getLookAtTarget (), argv, 2)); - if (attackerShipObject == NULL) + if (attackerShipObject == nullptr) { result += Unicode::narrowToWide ("You don't have attacker ship targeted."); return true; @@ -486,12 +486,12 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S ShipObject const * const idotShip = idot.getShipObject(); - if (ship != NULL && ship != idotShip) + if (ship != nullptr && ship != idotShip) continue; uint32 const chassisType = idotShip->getChassisType(); ShipChassis const * const chassis = ShipChassis::findShipChassisByCrc(chassisType); - std::string const chassisTypeName = (chassis != NULL) ? chassis->getName().getString() : ""; + std::string const chassisTypeName = (chassis != nullptr) ? chassis->getName().getString() : ""; float hpCur = 0.0f; float hpMax = 0.0f; @@ -522,7 +522,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S { ShipObject * const ship = dynamic_cast(findTangible (user->getLookAtTarget (), argv, 4)); - if (ship == NULL) + if (ship == nullptr) { result += Unicode::narrowToWide ("no ship"); return true; @@ -546,7 +546,7 @@ bool ConsoleCommandParserShip::performParsing (const NetworkId & userId, const S { ShipObject * const ship = dynamic_cast(findTangible (user->getLookAtTarget (), argv, 4)); - if (ship == NULL) + if (ship == nullptr) { result += Unicode::narrowToWide ("no ship"); return true; diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserSkill.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserSkill.cpp index fc1a1a49..3b356f42 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserSkill.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserSkill.cpp @@ -99,7 +99,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 2); - if (creature == NULL) + if (creature == nullptr) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -107,7 +107,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { const std::string skillName = Unicode::wideToNarrow (argv[1]); const SkillObject * const skill = SkillManager::getInstance ().getSkill (skillName); - if (skill == NULL) + if (skill == nullptr) { result += Unicode::narrowToWide ("unknown skill"); } @@ -126,7 +126,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 3); - if (creature == NULL) + if (creature == nullptr) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -146,7 +146,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 2); - if (creature == NULL) + if (creature == nullptr) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -198,7 +198,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 1); - if (creature == NULL) + if (creature == nullptr) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -233,7 +233,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 1); - if (creature == NULL) + if (creature == nullptr) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -262,7 +262,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 1); - if (creature == NULL) + if (creature == nullptr) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -288,7 +288,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 2); - if (creature == NULL) + if (creature == nullptr) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -296,7 +296,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { std::string skillName = Unicode::wideToNarrow (argv[1]); const SkillObject * skill = SkillManager::getInstance ().getSkill (skillName); - if (skill == NULL) + if (skill == nullptr) { result += Unicode::narrowToWide ("unknown skill"); } @@ -317,7 +317,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 2); - if (creature == NULL) + if (creature == nullptr) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -336,7 +336,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 1); - if (creature == NULL) + if (creature == nullptr) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -367,7 +367,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 2); - if (creature == NULL) + if (creature == nullptr) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -384,7 +384,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 2); - if (creature == NULL) + if (creature == nullptr) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -401,7 +401,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 2); - if (creature == NULL) + if (creature == nullptr) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -418,7 +418,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 2); - if (creature == NULL) + if (creature == nullptr) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } @@ -435,7 +435,7 @@ bool ConsoleCommandParserSkill::performParsing (const NetworkId & userId, const { CreatureObject * const creature = findCreature (userId, argv, 1); - if (creature == NULL) + if (creature == nullptr) { result += getErrorMessage (argv[0], ERR_INVALID_OBJECT); } diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserSpaceAi.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserSpaceAi.cpp index 9972dcf5..0964cdac 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserSpaceAi.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserSpaceAi.cpp @@ -66,9 +66,9 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const AiShipController::setAttackingEnabled(true); Object * const object = NetworkIdManager::getObjectById(userId); - ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - if (serverObject != NULL) + if (serverObject != nullptr) { Chat::sendSystemMessage(*serverObject, Unicode::narrowToWide("[WAR] AI will now attack."), Unicode::emptyString); } @@ -80,9 +80,9 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const AiShipController::setAttackingEnabled(false); Object * const object = NetworkIdManager::getObjectById(userId); - ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - if (serverObject != NULL) + if (serverObject != nullptr) { Chat::sendSystemMessage(*serverObject, Unicode::narrowToWide("[PEACE] AI will no longer attack."), Unicode::emptyString); } @@ -92,20 +92,20 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const else if (isAbbrev(argv[0], "path")) { Object * const object = NetworkIdManager::getObjectById(userId); - ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - if ( (serverObject != NULL) + if ( (serverObject != nullptr) && (argv.size () > 1)) { NetworkId networkId(Unicode::wideToNarrow(argv[1])); AiShipController * const aiShipController = AiShipController::getAiShipController(networkId); - if (aiShipController != NULL) + if (aiShipController != nullptr) { SpacePath * const spacePath = aiShipController->getPath(); - if (spacePath != NULL) + if (spacePath != nullptr) { SpacePath::TransformList const & transformList = spacePath->getTransformList(); SpacePath::TransformList::const_iterator iterTransformList = transformList.begin(); @@ -127,7 +127,7 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const } else { - Chat::sendSystemMessage(*serverObject, Unicode::narrowToWide("NULL path"), Unicode::emptyString); + Chat::sendSystemMessage(*serverObject, Unicode::narrowToWide("nullptr path"), Unicode::emptyString); } } else @@ -141,9 +141,9 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const else if (isAbbrev(argv[0], "reloaddata")) { Object * const object = NetworkIdManager::getObjectById(userId); - ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - if (serverObject != NULL) + if (serverObject != nullptr) { AiShipPilotData::reload(); @@ -156,10 +156,10 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const else if (isAbbrev(argv[0], "clientDebug")) { Object * const object = NetworkIdManager::getObjectById(userId); - ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; int temp; - if (serverObject != NULL) + if (serverObject != nullptr) { if ( serverObject->getObjVars().getItem("ai_debug_string", temp) && (temp > 0)) @@ -180,7 +180,7 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const Client * const client = serverObject->getClient(); - if (client != NULL) + if (client != nullptr) { AiDebugString aiDebugString; aiDebugString.enableClearClientFlag(); @@ -209,9 +209,9 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const else if (isAbbrev(argv[0], "serverDebug")) { Object * const object = NetworkIdManager::getObjectById(userId); - ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - if (serverObject != NULL) + if (serverObject != nullptr) { AiShipController::setClientDebugEnabled(!AiShipController::isClientDebugEnabled()); @@ -225,9 +225,9 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const else if (isAbbrev(argv[0], "clientDebugText")) { Object * const object = NetworkIdManager::getObjectById(userId); - ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - if (serverObject != NULL) + if (serverObject != nullptr) { AiDebugString::setTextEnabled(!AiDebugString::isTextEnabled()); @@ -241,12 +241,12 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const else if (isAbbrev(argv[0], "maneuver")) { Object * const object = NetworkIdManager::getObjectById(userId); - ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; - CreatureObject const * const creatureObject = serverObject ? serverObject->asCreatureObject() : NULL; + ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; + CreatureObject const * const creatureObject = serverObject ? serverObject->asCreatureObject() : nullptr; if (serverObject) { - if ((creatureObject != NULL) && (argv.size () > 1)) + if ((creatureObject != nullptr) && (argv.size () > 1)) { AiShipController const * const lookAtAiShipController = AiShipController::getAiShipController(creatureObject->getLookAtTarget()); @@ -295,9 +295,9 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const else if (isAbbrev(argv[0], "fastAxis")) { Object * const object = NetworkIdManager::getObjectById(userId); - ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - if (serverObject != NULL) + if (serverObject != nullptr) { Unicode::String systemMessage; diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserVeteran.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserVeteran.cpp index 0152e24d..3b91f7f0 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserVeteran.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserVeteran.cpp @@ -42,7 +42,7 @@ bool ConsoleCommandParserVeteran::performParsing (const NetworkId & userId, cons { NetworkId targetPlayer(Unicode::wideToNarrow (argv[1])); ServerObject const * const so = safe_cast(NetworkIdManager::getObjectById(targetPlayer)); - Client const * const client = so ? so->getClient() : NULL; + Client const * const client = so ? so->getClient() : nullptr; if (client) { std::string output; @@ -107,7 +107,7 @@ bool ConsoleCommandParserVeteran::performParsing (const NetworkId & userId, cons { NetworkId targetPlayer(Unicode::wideToNarrow(argv[1])); ServerObject const * const so = safe_cast(NetworkIdManager::getObjectById(targetPlayer)); - CreatureObject const * const playerCreature = so ? so->asCreatureObject() : NULL; + CreatureObject const * const playerCreature = so ? so->asCreatureObject() : nullptr; if (!playerCreature) result += getErrorMessage(argv[0],ERR_INVALID_OBJECT); else @@ -126,7 +126,7 @@ bool ConsoleCommandParserVeteran::performParsing (const NetworkId & userId, cons { std::string url(Unicode::wideToNarrow(argv[1])); ServerObject const * const so = safe_cast(NetworkIdManager::getObjectById(userId)); - Client const * const client = so ? so->getClient() : NULL; + Client const * const client = so ? so->getClient() : nullptr; if (client) { client->launchWebBrowser(url); diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleManager.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleManager.cpp index 46e4a6fd..f31601df 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleManager.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleManager.cpp @@ -41,14 +41,14 @@ #include "sharedCommandParser/CommandParser.h" #include "sharedNetworkMessages/ConsoleChannelMessages.h" -CommandParser * ConsoleMgr::ms_parser = NULL; +CommandParser * ConsoleMgr::ms_parser = nullptr; //----------------------------------------------------------------------- void ConsoleMgr::install() { - if (ms_parser == NULL) + if (ms_parser == nullptr) { ms_parser = new ConsoleCommandParserDefault(); ms_parser->addSubCommand(new ConsoleCommandParserCombatEngine ()); @@ -80,10 +80,10 @@ void ConsoleMgr::install() void ConsoleMgr::remove() { - if (ms_parser != NULL) + if (ms_parser != nullptr) { delete ms_parser; - ms_parser = NULL; + ms_parser = nullptr; } } // ConsoleMgr::remove @@ -93,7 +93,7 @@ void ConsoleMgr::processString(const std::string & msg, Client *from, uint32 msg { DEBUG_REPORT_LOG_PRINT(true, ("Console Message Received: %s\n",(msg.c_str()))); - if (ms_parser == NULL) + if (ms_parser == nullptr) { DEBUG_WARNING(true, ("Console command parser has not been created!")); return; diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleManager.h b/engine/server/library/serverGame/src/shared/console/ConsoleManager.h index f32ac0a3..8f71dbd6 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleManager.h +++ b/engine/server/library/serverGame/src/shared/console/ConsoleManager.h @@ -17,9 +17,9 @@ public: static void install(); static void remove(); - static void processString(const std::string & msg, Client *from = NULL,uint32 msgId = 0); - static void broadcastString(const std::string & msg, Client *to = NULL, uint32 msgId = 0); - static void broadcastString(const CommandParser::String_t & msg, Client *to = NULL, uint32 msgId = 0); + static void processString(const std::string & msg, Client *from = nullptr,uint32 msgId = 0); + static void broadcastString(const std::string & msg, Client *to = nullptr, uint32 msgId = 0); + static void broadcastString(const CommandParser::String_t & msg, Client *to = nullptr, uint32 msgId = 0); static void broadcastString(const std::string & msg, NetworkId to, uint32 msgId = 0); private: diff --git a/engine/server/library/serverGame/src/shared/controller/AiCreatureController.cpp b/engine/server/library/serverGame/src/shared/controller/AiCreatureController.cpp index 040d0a9c..14425612 100755 --- a/engine/server/library/serverGame/src/shared/controller/AiCreatureController.cpp +++ b/engine/server/library/serverGame/src/shared/controller/AiCreatureController.cpp @@ -83,7 +83,7 @@ namespace AiCreatureControllerNamespace bool s_installed = false; typedef std::set ObserverList; - PersistentCrcString * s_defaultCreatureName = NULL; + PersistentCrcString * s_defaultCreatureName = nullptr; void remove(); Location getLocation(ServerObject const & serverObject); @@ -97,7 +97,7 @@ void AiCreatureControllerNamespace::remove() DEBUG_FATAL(!s_installed, ("Not installed.")); delete s_defaultCreatureName; - s_defaultCreatureName = NULL; + s_defaultCreatureName = nullptr; s_installed = false; } @@ -106,9 +106,9 @@ void AiCreatureControllerNamespace::remove() Location AiCreatureControllerNamespace::getLocation(ServerObject const & serverObject) { CellProperty const * const cellProperty = serverObject.getParentCell(); - Object const * const cellObject = (cellProperty != NULL) ? &cellProperty->getOwner() : NULL; - Vector const & positionRelativeToCellOrWorld = (cellObject != NULL) ? serverObject.getPosition_c() : serverObject.getPosition_w(); - NetworkId const & networkIdForCellOrWorld = (cellObject != NULL) ? cellObject->getNetworkId() : NetworkId::cms_invalid; + Object const * const cellObject = (cellProperty != nullptr) ? &cellProperty->getOwner() : nullptr; + Vector const & positionRelativeToCellOrWorld = (cellObject != nullptr) ? serverObject.getPosition_c() : serverObject.getPosition_w(); + NetworkId const & networkIdForCellOrWorld = (cellObject != nullptr) ? cellObject->getNetworkId() : NetworkId::cms_invalid; return Location(positionRelativeToCellOrWorld, networkIdForCellOrWorld, Location::getCrcBySceneName(serverObject.getSceneId())); } @@ -164,10 +164,10 @@ AICreatureController::~AICreatureController() Object * const owner = getOwner(); - if (owner != NULL && owner->isAuthoritative() && !getHibernate() && m_hibernationDelay.get() > 0 && m_hibernationTimer.get() > 0) + if (owner != nullptr && owner->isAuthoritative() && !getHibernate() && m_hibernationDelay.get() > 0 && m_hibernationTimer.get() > 0) ObjectTracker::removeDelayedHibernatingAI(); - if ( (owner != NULL) + if ( (owner != nullptr) && AiLogManager::isLogging(owner->getNetworkId())) { AiLogManager::setLogging(owner->getNetworkId(), false); @@ -205,9 +205,9 @@ void AICreatureController::CreatureNameChangedCallback::modified(AICreatureContr void AICreatureController::handleMessage (int message, float value, const MessageQueue::Data* const data, uint32 flags) { CreatureObject * const owner = static_cast(getOwner()); - if (owner == NULL) + if (owner == nullptr) { - DEBUG_FATAL(true, ("Owner is NULL in AiCreatureController::handleMessage\n")); + DEBUG_FATAL(true, ("Owner is nullptr in AiCreatureController::handleMessage\n")); return; } @@ -219,7 +219,7 @@ void AICreatureController::handleMessage (int message, float value, const Messag AiMovementMessage const * const msg = safe_cast(data); - if (msg != NULL) + if (msg != nullptr) { if (owner->isAuthoritative()) { @@ -256,7 +256,7 @@ void AICreatureController::handleMessage (int message, float value, const Messag LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::handleMessage(CM_aiSetCreatureName) owner(%s)", getDebugInformation().c_str())); MessageQueueGenericValueType const * const msg = safe_cast const *>(data); - if (msg != NULL) + if (msg != nullptr) { setCreatureName(msg->getValue()); } @@ -267,7 +267,7 @@ void AICreatureController::handleMessage (int message, float value, const Messag LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::handleMessage(CM_aiSetHomeLocation) owner(%s)", getDebugInformation().c_str())); MessageQueueGenericValueType const * const msg = safe_cast const *>(data); - if (msg != NULL) + if (msg != nullptr) { setHomeLocation(msg->getValue()); } @@ -278,7 +278,7 @@ void AICreatureController::handleMessage (int message, float value, const Messag LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::handleMessage(CM_aiSetFrozen) owner(%s)", getDebugInformation().c_str())); MessageQueueGenericValueType const * const msg = safe_cast const *>(data); - if (msg != NULL) + if (msg != nullptr) { setFrozen(msg->getValue()); } @@ -289,7 +289,7 @@ void AICreatureController::handleMessage (int message, float value, const Messag LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::handleMessage(CM_aiSetRetreating) owner(%s)", getDebugInformation().c_str())); MessageQueueGenericValueType const * const msg = safe_cast const *>(data); - if (msg != NULL) + if (msg != nullptr) { setRetreating(msg->getValue()); } @@ -300,7 +300,7 @@ void AICreatureController::handleMessage (int message, float value, const Messag LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::handleMessage(CM_aiSetLogging) owner(%s)", getDebugInformation().c_str())); MessageQueueGenericValueType const * const msg = safe_cast const *>(data); - if (msg != NULL) + if (msg != nullptr) { setLogging(msg->getValue()); } @@ -333,7 +333,7 @@ void AICreatureController::handleMessage (int message, float value, const Messag case CM_setHibernationDelay: { MessageQueueGenericValueType const * const msg = safe_cast const *>(data); - if (msg != NULL) + if (msg != nullptr) setHibernationDelay(msg->getValue()); } break; @@ -469,7 +469,7 @@ float AICreatureController::realAlter(float time) CreatureObject * const creatureOwner = getCreature(); #ifdef _DEBUG - AiDebugString * aiDebugString = NULL; + AiDebugString * aiDebugString = nullptr; if (!creatureOwner->getObservers().empty()) { aiDebugString = new AiDebugString; @@ -508,7 +508,7 @@ float AICreatureController::realAlter(float time) if (!creatureOwner->isInWorld() || getHibernate()) { #ifdef _DEBUG - if (aiDebugString != NULL) + if (aiDebugString != nullptr) { sendDebugAiToClients(*aiDebugString); delete aiDebugString; @@ -522,8 +522,8 @@ float AICreatureController::realAlter(float time) // check floating { CollisionProperty const * const collision = creatureOwner->getCollisionProperty(); - Footprint const * const foot = (collision != NULL) ? collision->getFootprint() : NULL; - bool floating = (foot != NULL) ? foot->isFloating() : false; + Footprint const * const foot = (collision != nullptr) ? collision->getFootprint() : nullptr; + bool floating = (foot != nullptr) ? foot->isFloating() : false; if (floating) { @@ -547,7 +547,7 @@ float AICreatureController::realAlter(float time) // Update our inPathfindingRegion flag whenever the behavior changes CityPathGraph const * graph = CityPathGraphManager::getCityGraphFor(creatureOwner); - m_inPathfindingRegion = (graph != NULL); + m_inPathfindingRegion = (graph != nullptr); applyMovementChange(); } @@ -589,10 +589,10 @@ float AICreatureController::realAlter(float time) bool resetHateTimer = false; CachedNetworkId const & hateTarget = creatureOwner->getHateTarget(); CreatureObject * const hateTargetCreatureObject = CreatureObject::asCreatureObject(hateTarget.getObject()); - CreatureController const * const hateTargetCreatureController = (hateTargetCreatureObject != NULL) ? CreatureController::asCreatureController(hateTargetCreatureObject->getController()) : NULL; + CreatureController const * const hateTargetCreatureController = (hateTargetCreatureObject != nullptr) ? CreatureController::asCreatureController(hateTargetCreatureObject->getController()) : nullptr; - if ( (hateTargetCreatureObject != NULL) - && (hateTargetCreatureController != NULL)) + if ( (hateTargetCreatureObject != nullptr) + && (hateTargetCreatureController != nullptr)) { float const hateTargetMovementSpeedSquared = hateTargetCreatureController->getCurrentVelocity().magnitudeSquared(); float const hateTargetWalkSpeedSquared = sqr(hateTargetCreatureObject->getWalkSpeed()); @@ -605,7 +605,7 @@ float AICreatureController::realAlter(float time) { Object * const combatStartLocationCell = NetworkIdManager::getObjectById(m_combatStartLocation.get().getCell()); Vector const & combatStartPosition_c = m_combatStartLocation.get().getCoordinates(); - Vector const & combatStartPosition_w = (combatStartLocationCell != NULL) ? combatStartLocationCell->rotateTranslate_o2w(combatStartPosition_c) : combatStartPosition_c; + Vector const & combatStartPosition_w = (combatStartLocationCell != nullptr) ? combatStartLocationCell->rotateTranslate_o2w(combatStartPosition_c) : combatStartPosition_c; float const distanceToCombatStartLocationSquared = creatureOwner->getPosition_w().magnitudeBetweenSquared(combatStartPosition_w); float const aggroRadius = getAggroRadius(); @@ -621,7 +621,7 @@ float AICreatureController::realAlter(float time) hateTargetCreatureObject->resetHateTimer(); } } - else if (hateTarget.getObject() != NULL) + else if (hateTarget.getObject() != nullptr) { // AI don't need to lose interest in stationary AI @@ -662,7 +662,7 @@ float AICreatureController::realAlter(float time) } #ifdef _DEBUG - if (aiDebugString != NULL) + if (aiDebugString != nullptr) { m_movement->addDebug(*aiDebugString); } @@ -697,7 +697,7 @@ float AICreatureController::realAlter(float time) updateMovementType(); #ifdef _DEBUG - if (aiDebugString != NULL) + if (aiDebugString != nullptr) { sendDebugAiToClients(*aiDebugString); delete aiDebugString; @@ -711,7 +711,7 @@ float AICreatureController::realAlter(float time) //---------------------------------------------------------------------- void AICreatureController::changeMovement(AiMovementBasePtr newMovement) { - LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::changeMovement() movement(%s)", (newMovement != AiMovementBaseNullPtr) ? AiMovementBase::getMovementString(newMovement->getType()) : "NULL")); + LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::changeMovement() movement(%s)", (newMovement != AiMovementBaseNullPtr) ? AiMovementBase::getMovementString(newMovement->getType()) : "nullptr")); if (getOwner()->isAuthoritative()) { @@ -876,11 +876,11 @@ void AICreatureController::loiter(CellProperty const * homeCell, Vector const & { if (isRetreating()) { - WARNING(true, ("AICreatureController::loiter() owner(%s) cell(%s) home(%.0f, %.0f, %.0f) distance[%.2f...%.2f] delay[%.0f...%.0f] Trying to loiter while retreating, failing request.", getDebugInformation().c_str(), ((homeCell != NULL) ? homeCell->getCellName() : "NULL"), home_p.x, home_p.y, home_p.z, minDistance, maxDistance, minDelay, maxDelay)); + WARNING(true, ("AICreatureController::loiter() owner(%s) cell(%s) home(%.0f, %.0f, %.0f) distance[%.2f...%.2f] delay[%.0f...%.0f] Trying to loiter while retreating, failing request.", getDebugInformation().c_str(), ((homeCell != nullptr) ? homeCell->getCellName() : "nullptr"), home_p.x, home_p.y, home_p.z, minDistance, maxDistance, minDelay, maxDelay)); return; } - LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::loiter() owner(%s) cell(%s) home(%.0f, %.0f, %.0f) distance[%.2f...%.2f] delay[%.0f...%.0f]", getDebugInformation().c_str(), ((homeCell != NULL) ? homeCell->getCellName() : "NULL"), home_p.x, home_p.y, home_p.z, minDistance, maxDistance, minDelay, maxDelay)); + LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::loiter() owner(%s) cell(%s) home(%.0f, %.0f, %.0f) distance[%.2f...%.2f] delay[%.0f...%.0f]", getDebugInformation().c_str(), ((homeCell != nullptr) ? homeCell->getCellName() : "nullptr"), home_p.x, home_p.y, home_p.z, minDistance, maxDistance, minDelay, maxDelay)); AiMovementBasePtr movement(new AiMovementLoiter(this, homeCell, home_p, minDistance, maxDistance, minDelay, maxDelay)); @@ -910,7 +910,7 @@ void AICreatureController::moveTo(CellProperty const * cell, Vector const & targ { if (isRetreating()) { - WARNING(true, ("AICreatureController::moveTo() owner(%s) cell(%s) position(%.0f, %.0f, %.0f) radius(%.2f) Trying to moveTo while retreating, failing request.", getDebugInformation().c_str(), ((cell != NULL) ? cell->getCellName() : "NULL"), target_p.x, target_p.y, target_p.z, radius)); + WARNING(true, ("AICreatureController::moveTo() owner(%s) cell(%s) position(%.0f, %.0f, %.0f) radius(%.2f) Trying to moveTo while retreating, failing request.", getDebugInformation().c_str(), ((cell != nullptr) ? cell->getCellName() : "nullptr"), target_p.x, target_p.y, target_p.z, radius)); return; } @@ -918,9 +918,9 @@ void AICreatureController::moveTo(CellProperty const * cell, Vector const & targ if (getMovementType() == AMT_move) { - AiMovementMove * const aiMovementMove = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementMove() : NULL; + AiMovementMove * const aiMovementMove = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementMove() : nullptr; - if (aiMovementMove != NULL) + if (aiMovementMove != nullptr) { AiLocation const & target = aiMovementMove->getTarget(); @@ -935,7 +935,7 @@ void AICreatureController::moveTo(CellProperty const * cell, Vector const & targ if (!duplicateMovement) { - LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::moveTo() owner(%s) cell(%s) position(%.0f, %.0f, %.0f) radius(%.2f)", getDebugInformation().c_str(), ((cell != NULL) ? cell->getCellName() : "NULL"), target_p.x, target_p.y, target_p.z, radius)); + LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::moveTo() owner(%s) cell(%s) position(%.0f, %.0f, %.0f) radius(%.2f)", getDebugInformation().c_str(), ((cell != nullptr) ? cell->getCellName() : "nullptr"), target_p.x, target_p.y, target_p.z, radius)); AiMovementBasePtr movement(new AiMovementMove(this, cell, target_p, radius)); @@ -957,9 +957,9 @@ void AICreatureController::moveTo(Unicode::String const & targetName) if (getMovementType() == AMT_move) { - AiMovementMove * const aiMovementMove = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementMove() : NULL; + AiMovementMove * const aiMovementMove = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementMove() : nullptr; - if (aiMovementMove != NULL) + if (aiMovementMove != nullptr) { if (aiMovementMove->getTargetName() == targetName) { @@ -992,8 +992,8 @@ void AICreatureController::patrol( std::vector const & locations, bool if (getMovementType() == AMT_patrol) { - AiMovementPatrol * const aiMovementPatrol = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementPatrol() : NULL; - if (aiMovementPatrol != NULL) + AiMovementPatrol * const aiMovementPatrol = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementPatrol() : nullptr; + if (aiMovementPatrol != nullptr) { // if () // { @@ -1026,8 +1026,8 @@ void AICreatureController::patrol( std::vector const & location if (getMovementType() == AMT_patrol) { - AiMovementPatrol * const aiMovementPatrol = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementPatrol() : NULL; - if (aiMovementPatrol != NULL) + AiMovementPatrol * const aiMovementPatrol = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementPatrol() : nullptr; + if (aiMovementPatrol != nullptr) { // if () // { @@ -1071,7 +1071,7 @@ bool AICreatureController::faceTo(CellProperty const * targetCell, Vector const { if (isRetreating()) { - WARNING(true, ("AICreatureController::faceTo() owner(%s) cell(%s) position(%.0f, %.0f, %.0f) Trying to faceTo while retreating, failing faceTo request.", getDebugInformation().c_str(), ((targetCell != NULL) ? targetCell->getCellName() : "NULL"), target_p.x, target_p.y, target_p.z)); + WARNING(true, ("AICreatureController::faceTo() owner(%s) cell(%s) position(%.0f, %.0f, %.0f) Trying to faceTo while retreating, failing faceTo request.", getDebugInformation().c_str(), ((targetCell != nullptr) ? targetCell->getCellName() : "nullptr"), target_p.x, target_p.y, target_p.z)); return false; } @@ -1079,9 +1079,9 @@ bool AICreatureController::faceTo(CellProperty const * targetCell, Vector const if (getMovementType() == AMT_face) { - AiMovementFace * const aiMovementFace = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementFace() : NULL; + AiMovementFace * const aiMovementFace = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementFace() : nullptr; - if (aiMovementFace != NULL) + if (aiMovementFace != nullptr) { AiLocation const & target = aiMovementFace->getTarget(); @@ -1095,7 +1095,7 @@ bool AICreatureController::faceTo(CellProperty const * targetCell, Vector const if (!duplicateMovement) { - LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::faceTo() owner(%s) cell(%s) position(%.0f, %.0f, %.0f)", getDebugInformation().c_str(), ((targetCell != NULL) ? targetCell->getCellName() : "NULL"), target_p.x, target_p.y, target_p.z)); + LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::faceTo() owner(%s) cell(%s) position(%.0f, %.0f, %.0f)", getDebugInformation().c_str(), ((targetCell != nullptr) ? targetCell->getCellName() : "nullptr"), target_p.x, target_p.y, target_p.z)); AiMovementBasePtr behavior(new AiMovementFace(this, targetCell, target_p)); @@ -1126,9 +1126,9 @@ bool AICreatureController::faceTo( NetworkId const & targetId ) if (getMovementType() == AMT_face) { - AiMovementFace * const aiMovementFace = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementFace() : NULL; + AiMovementFace * const aiMovementFace = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementFace() : nullptr; - if (aiMovementFace != NULL) + if (aiMovementFace != nullptr) { AiLocation const & target = aiMovementFace->getTarget(); @@ -1171,9 +1171,9 @@ bool AICreatureController::follow( NetworkId const & targetId, float minDistance if (getMovementType() == AMT_follow) { - AiMovementFollow * const aiMovementFollow = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementFollow() : NULL; + AiMovementFollow * const aiMovementFollow = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementFollow() : nullptr; - if (aiMovementFollow != NULL) + if (aiMovementFollow != nullptr) { AiLocation const & target = aiMovementFollow->getTarget(); @@ -1219,9 +1219,9 @@ bool AICreatureController::follow( NetworkId const & targetId, Vector const & of if (getMovementType() == AMT_follow) { - AiMovementFollow * const aiMovementFollow = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementFollow() : NULL; + AiMovementFollow * const aiMovementFollow = (m_movement != AiMovementBaseNullPtr) ? m_movement->asAiMovementFollow() : nullptr; - if (aiMovementFollow != NULL) + if (aiMovementFollow != nullptr) { AiLocation const & offsetTarget = aiMovementFollow->getOffsetTarget(); @@ -1403,9 +1403,9 @@ void AICreatureController::moveCreature( CellProperty const * newCell, Vector co CellProperty * currentCell = getOwner()->getParentCell(); - CellObject * newCellObject = NULL; + CellObject * newCellObject = nullptr; - if( (newCell != NULL) && (newCell != CellProperty::getWorldCellProperty()) ) + if( (newCell != nullptr) && (newCell != CellProperty::getWorldCellProperty()) ) { newCellObject = const_cast(safe_cast(&newCell->getOwner())); } @@ -1422,12 +1422,12 @@ void AICreatureController::moveCreature( CellProperty const * newCell, Vector co CellProperty const * destCell = getCreatureCell()->getDestinationCell(oldPosition+offset,newPosition+offset,dummy); - if((destCell != NULL) && (destCell != newCell)) + if((destCell != nullptr) && (destCell != newCell)) { newPosition = CollisionUtils::transformToCell(newCell,newPosition,destCell); newCell = destCell; - newCellObject = NULL; + newCellObject = nullptr; if(newCell != CellProperty::getWorldCellProperty()) { @@ -1820,15 +1820,15 @@ AICreatureController * AICreatureController::getAiCreatureController(NetworkId c { Object * const object = NetworkIdManager::getObjectById(networkId); - return (object != NULL) ? AICreatureController::asAiCreatureController(object->getController()) : NULL; + return (object != nullptr) ? AICreatureController::asAiCreatureController(object->getController()) : nullptr; } // ---------------------------------------------------------------------- AICreatureController * AICreatureController::asAiCreatureController(Controller * controller) { - CreatureController * const creatureController = (controller != NULL) ? controller->asCreatureController() : NULL; - AICreatureController * const aiCreatureController = (creatureController != NULL) ? creatureController->asAiCreatureController() : NULL; + CreatureController * const creatureController = (controller != nullptr) ? controller->asCreatureController() : nullptr; + AICreatureController * const aiCreatureController = (creatureController != nullptr) ? creatureController->asAiCreatureController() : nullptr; return aiCreatureController; } @@ -1837,8 +1837,8 @@ AICreatureController * AICreatureController::asAiCreatureController(Controller * AICreatureController const * AICreatureController::asAiCreatureController(Controller const * controller) { - CreatureController const * const creatureController = (controller != NULL) ? controller->asCreatureController() : NULL; - AICreatureController const * const aiCreatureController = (creatureController != NULL) ? creatureController->asAiCreatureController() : NULL; + CreatureController const * const creatureController = (controller != nullptr) ? controller->asCreatureController() : nullptr; + AICreatureController const * const aiCreatureController = (creatureController != nullptr) ? creatureController->asAiCreatureController() : nullptr; return aiCreatureController; } @@ -1880,7 +1880,7 @@ float AICreatureController::getRespectRadius(NetworkId const & target) const CreatureObject const * respectCreatureObject = CreatureObject::getCreatureObject(target); - if (respectCreatureObject != NULL) + if (respectCreatureObject != nullptr) { // If the target has a master, then use the master's level for the respect calculation @@ -1893,7 +1893,7 @@ float AICreatureController::getRespectRadius(NetworkId const & target) const // Respect is only towards players - if ( (respectCreatureObject != NULL) + if ( (respectCreatureObject != nullptr) && respectCreatureObject->isPlayerControlled()) { CreatureObject const * const creatureOwner = getCreature(); @@ -1906,7 +1906,7 @@ float AICreatureController::getRespectRadius(NetworkId const & target) const } else { - WARNING(true, ("AICreatureController::getRespectRadius() owner(%s) master(%s) The owner has a master who is not a player. Why does this happen?", getDebugInformation().c_str(), (respectCreatureObject != NULL) ? respectCreatureObject->getDebugInformation().c_str() : masterId.getValueString().c_str())); + WARNING(true, ("AICreatureController::getRespectRadius() owner(%s) master(%s) The owner has a master who is not a player. Why does this happen?", getDebugInformation().c_str(), (respectCreatureObject != nullptr) ? respectCreatureObject->getDebugInformation().c_str() : masterId.getValueString().c_str())); } } @@ -1942,7 +1942,7 @@ void AICreatureController::sendDebugAiToClients(AiDebugString & aiDebugString) // Display the name and level { - aiDebugString.addText(fs.sprintf("%d %s\n", creatureOwner->getLevel(), (getCreatureName().isEmpty() ? "NULL" : getCreatureName().getString())), PackedRgb::solidWhite); + aiDebugString.addText(fs.sprintf("%d %s\n", creatureOwner->getLevel(), (getCreatureName().isEmpty() ? "nullptr" : getCreatureName().getString())), PackedRgb::solidWhite); } // Display the look at target @@ -1990,7 +1990,7 @@ void AICreatureController::sendDebugAiToClients(AiDebugString & aiDebugString) { Floor const * const floor = CollisionWorld::getFloorStandingOn(*creatureOwner); - aiDebugString.addText(fs.sprintf("floor (%s)\n", (floor == NULL) ? "none" : floor->getId().getValueString().c_str()), PackedRgb::solidWhite); + aiDebugString.addText(fs.sprintf("floor (%s)\n", (floor == nullptr) ? "none" : floor->getId().getValueString().c_str()), PackedRgb::solidWhite); } // Display the AI movement speed @@ -2008,15 +2008,15 @@ void AICreatureController::sendDebugAiToClients(AiDebugString & aiDebugString) // Primary Weapon { ServerObject const * const primaryServerObject = ServerObject::getServerObject(getPrimaryWeapon()); - WeaponObject const * const primaryWeaponObject = (primaryServerObject != NULL) ? primaryServerObject->asWeaponObject() : NULL; + WeaponObject const * const primaryWeaponObject = (primaryServerObject != nullptr) ? primaryServerObject->asWeaponObject() : nullptr; - if (primaryWeaponObject != NULL) + if (primaryWeaponObject != nullptr) { aiDebugString.addText(fs.sprintf("%s pri(%s) [%.0f...%.0f] sp(%s)\n", (usingPrimaryWeapon() ? "->" : ""), FileNameUtils::get(primaryWeaponObject->getObjectTemplateName(), FileNameUtils::fileName).c_str(), primaryWeaponObject->getMinRange(), primaryWeaponObject->getMaxRange(), m_aiCreatureData->m_primarySpecials.isEmpty() ? "none" : m_aiCreatureData->m_primarySpecials.getString()), PackedRgb::solidWhite); } else { - aiDebugString.addText(fs.sprintf("pri(NULL:ERROR)\n"), PackedRgb::solidWhite); + aiDebugString.addText(fs.sprintf("pri(nullptr:ERROR)\n"), PackedRgb::solidWhite); } //if (usingPrimaryWeapon()) @@ -2040,9 +2040,9 @@ void AICreatureController::sendDebugAiToClients(AiDebugString & aiDebugString) // Secondary Weapon { ServerObject const * const secondaryServerObject = ServerObject::getServerObject(getSecondaryWeapon()); - WeaponObject const * const secondaryWeaponObject = (secondaryServerObject != NULL) ? secondaryServerObject->asWeaponObject() : NULL; + WeaponObject const * const secondaryWeaponObject = (secondaryServerObject != nullptr) ? secondaryServerObject->asWeaponObject() : nullptr; - if (secondaryWeaponObject != NULL) + if (secondaryWeaponObject != nullptr) { aiDebugString.addText(fs.sprintf("%s sec (%s) [%.0f...%.0f] sp(%s)\n", (usingSecondaryWeapon() ? "->" : ""), FileNameUtils::get(secondaryWeaponObject->getObjectTemplateName(), FileNameUtils::fileName).c_str(), secondaryWeaponObject->getMinRange(), secondaryWeaponObject->getMaxRange(), m_aiCreatureData->m_secondarySpecials.isEmpty() ? "none" : m_aiCreatureData->m_secondarySpecials.getString()), PackedRgb::solidWhite); } @@ -2113,13 +2113,13 @@ void AICreatureController::sendDebugAiToClients(AiDebugString & aiDebugString) TangibleObject const * const hateTargetTangibleObject = TangibleObject::asTangibleObject(hateTarget.getObject()); float const hate = iterHateList->second; std::string hateTargetName; - if (hateTargetTangibleObject != NULL) + if (hateTargetTangibleObject != nullptr) { hateTargetName = Unicode::wideToNarrow(hateTargetTangibleObject->getEncodedObjectName()).c_str(); } else { - hateTargetName = "NULL"; + hateTargetName = "nullptr"; } aiDebugString.addText(fs.sprintf("%s:%s(%.1f)\n", hateTargetName.c_str(), hateTarget.getValueString().c_str(), hate), (iterHateList == hateList.begin()) ? PackedRgb::solidGreen : PackedRgb::solidRed); @@ -2174,7 +2174,7 @@ void AICreatureController::sendDebugAiToClients(AiDebugString & aiDebugString) // Only send to the client if the objvar is set int temp = 0; - if ( (characterObject != NULL) + if ( (characterObject != nullptr) && characterObject->getObjVars().getItem("ai_debug_string", temp)) { if (temp > 0) @@ -2196,7 +2196,7 @@ void AICreatureController::setHomeLocation(Location const & location) { if (getOwner()->isAuthoritative()) { - LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::setHomeLocation() owner(%s) sceneId(%u:%s) cell(%s) coordinates(%.2f, %.2f, %.2f)", getDebugInformation().c_str(), location.getSceneIdCrc(), (location.getSceneId() != NULL) ? location.getSceneId() : "NULL", location.getCell().getValueString().c_str(), location.getCoordinates().x, location.getCoordinates().y, location.getCoordinates().z)); + LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::setHomeLocation() owner(%s) sceneId(%u:%s) cell(%s) coordinates(%.2f, %.2f, %.2f)", getDebugInformation().c_str(), location.getSceneIdCrc(), (location.getSceneId() != nullptr) ? location.getSceneId() : "nullptr", location.getCell().getValueString().c_str(), location.getCoordinates().x, location.getCoordinates().y, location.getCoordinates().z)); m_homeLocation = location; } @@ -2221,7 +2221,7 @@ void AICreatureController::markCombatStartLocation() { m_combatStartLocation = getLocation(*creatureOwner); - LOGC(AiLogManager::isLogging(creatureOwner->getNetworkId()), "debug_ai", ("AICreatureController::markCombatStartLocation() owner(%s) sceneId(%u:%s) cell(%s) coordinates(%.2f, %.2f, %.2f)", getDebugInformation().c_str(), m_combatStartLocation.get().getSceneIdCrc(), (m_combatStartLocation.get().getSceneId() != NULL) ? m_combatStartLocation.get().getSceneId() : "NULL", m_combatStartLocation.get().getCell().getValueString().c_str(), m_combatStartLocation.get().getCoordinates().x, m_combatStartLocation.get().getCoordinates().y, m_combatStartLocation.get().getCoordinates().z)); + LOGC(AiLogManager::isLogging(creatureOwner->getNetworkId()), "debug_ai", ("AICreatureController::markCombatStartLocation() owner(%s) sceneId(%u:%s) cell(%s) coordinates(%.2f, %.2f, %.2f)", getDebugInformation().c_str(), m_combatStartLocation.get().getSceneIdCrc(), (m_combatStartLocation.get().getSceneId() != nullptr) ? m_combatStartLocation.get().getSceneId() : "nullptr", m_combatStartLocation.get().getCell().getValueString().c_str(), m_combatStartLocation.get().getCoordinates().x, m_combatStartLocation.get().getCoordinates().y, m_combatStartLocation.get().getCoordinates().z)); m_primaryWeaponActions.reset(); m_secondaryWeaponActions.reset(); @@ -2279,14 +2279,14 @@ void AICreatureController::onCreatureNameChanged(std::string const & creatureNam AiCreatureCombatProfile const * const primaryWeaponCombatProfile = AiCreatureCombatProfile::getCombatProfile(m_aiCreatureData->m_primarySpecials); - if (primaryWeaponCombatProfile != NULL) + if (primaryWeaponCombatProfile != nullptr) { m_primaryWeaponActions.setCombatProfile(*creatureOwner, *primaryWeaponCombatProfile); } AiCreatureCombatProfile const * const secondaryWeaponCombatProfile = AiCreatureCombatProfile::getCombatProfile(m_aiCreatureData->m_secondarySpecials); - if (secondaryWeaponCombatProfile != NULL) + if (secondaryWeaponCombatProfile != nullptr) { m_secondaryWeaponActions.setCombatProfile(*creatureOwner, *secondaryWeaponCombatProfile); } @@ -2326,7 +2326,7 @@ void AICreatureController::destroyPrimaryWeapon() { WeaponObject * const primaryWeapon = WeaponObject::getWeaponObject(getPrimaryWeapon()); - if (primaryWeapon != NULL) + if (primaryWeapon != nullptr) { unEquipWeapons(); primaryWeapon->permanentlyDestroy(DeleteReasons::God); @@ -2361,7 +2361,7 @@ void AICreatureController::destroySecondaryWeapon() { WeaponObject * const secondaryWeapon = WeaponObject::getWeaponObject(getSecondaryWeapon()); - if (secondaryWeapon != NULL) + if (secondaryWeapon != nullptr) { unEquipWeapons(); secondaryWeapon->permanentlyDestroy(DeleteReasons::God); @@ -2372,7 +2372,7 @@ void AICreatureController::destroySecondaryWeapon() PersistentCrcString const & AICreatureController::getCreatureName() const { - if (m_aiCreatureData->m_name == NULL) + if (m_aiCreatureData->m_name == nullptr) { return *s_defaultCreatureName; } @@ -2401,7 +2401,7 @@ NetworkId AICreatureController::createWeapon(char const * const functionName, Cr CreatureObject * const creatureOwner = getCreature(); ServerObject * const inventory = creatureOwner->getInventory(); - if (inventory == NULL) + if (inventory == nullptr) { WARNING(true, ("AICreatureController::%s() Unable to find inventory for (%s) to place a weapon(%s)", functionName, getDebugInformation().c_str(), weaponName.getString())); } @@ -2440,7 +2440,7 @@ NetworkId AICreatureController::createWeapon(char const * const functionName, Cr bool const persisted = false; ServerObject * const newObject = ServerWorld::createNewObject(weaponCrcName.getCrc(), *inventory, persisted); - if (newObject != NULL) + if (newObject != nullptr) { result = newObject->getNetworkId(); } @@ -2464,7 +2464,7 @@ NetworkId AICreatureController::getUnarmedWeapon() CreatureObject * const creatureOwner = getCreature(); WeaponObject * const defaultWeapon = creatureOwner->getDefaultWeapon(); - if (defaultWeapon != NULL) + if (defaultWeapon != nullptr) { result = defaultWeapon->getNetworkId(); } @@ -2492,9 +2492,9 @@ void AICreatureController::equipPrimaryWeapon() if (!usingPrimaryWeapon()) { ServerObject * const primaryWeaponServerObject = ServerObject::getServerObject(getPrimaryWeapon()); - WeaponObject * const primaryWeaponObject = (primaryWeaponServerObject != NULL) ? primaryWeaponServerObject->asWeaponObject() : NULL; + WeaponObject * const primaryWeaponObject = (primaryWeaponServerObject != nullptr) ? primaryWeaponServerObject->asWeaponObject() : nullptr; - if (primaryWeaponObject != NULL) + if (primaryWeaponObject != nullptr) { unEquipWeapons(); @@ -2508,7 +2508,7 @@ void AICreatureController::equipPrimaryWeapon() { Container::ContainerErrorCode errorCode; - if (ContainerInterface::transferItemToGeneralContainer(*creatureOwner, *primaryWeaponServerObject, NULL, errorCode)) + if (ContainerInterface::transferItemToGeneralContainer(*creatureOwner, *primaryWeaponServerObject, nullptr, errorCode)) { LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::equipPrimaryWeapon() owner(%s) primaryWeapon(%s)\n", getDebugInformation().c_str(), primaryWeaponServerObject->getDebugInformation().c_str())); @@ -2516,7 +2516,7 @@ void AICreatureController::equipPrimaryWeapon() GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(creatureOwner); - if (gameScriptObject != NULL) + if (gameScriptObject != nullptr) { ScriptParams scriptParams; scriptParams.addParam(primaryWeaponObject->getNetworkId()); @@ -2557,9 +2557,9 @@ void AICreatureController::equipSecondaryWeapon() if (!usingSecondaryWeapon()) { ServerObject * const secondaryWeaponServerObject = ServerObject::getServerObject(getSecondaryWeapon()); - WeaponObject * const secondaryWeaponObject = (secondaryWeaponServerObject != NULL) ? secondaryWeaponServerObject->asWeaponObject() : NULL; + WeaponObject * const secondaryWeaponObject = (secondaryWeaponServerObject != nullptr) ? secondaryWeaponServerObject->asWeaponObject() : nullptr; - if (secondaryWeaponObject != NULL) + if (secondaryWeaponObject != nullptr) { unEquipWeapons(); @@ -2573,7 +2573,7 @@ void AICreatureController::equipSecondaryWeapon() { Container::ContainerErrorCode errorCode; - if (ContainerInterface::transferItemToGeneralContainer(*creatureOwner, *secondaryWeaponServerObject, NULL, errorCode)) + if (ContainerInterface::transferItemToGeneralContainer(*creatureOwner, *secondaryWeaponServerObject, nullptr, errorCode)) { LOGC(AiLogManager::isLogging(getOwner()->getNetworkId()), "debug_ai", ("AICreatureController::equipSecondaryWeapon() owner(%s) secondaryWeapon(%s) errorCode(%d)\n", getDebugInformation().c_str(), secondaryWeaponServerObject->getDebugInformation().c_str())); @@ -2581,7 +2581,7 @@ void AICreatureController::equipSecondaryWeapon() GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(creatureOwner); - if (gameScriptObject != NULL) + if (gameScriptObject != nullptr) { ScriptParams scriptParams; scriptParams.addParam(secondaryWeaponObject->getNetworkId()); @@ -2631,7 +2631,7 @@ void AICreatureController::unEquipWeapons() { ServerObject * const inventory = creatureOwner->getInventory(); - if (inventory != NULL) + if (inventory != nullptr) { Container::ContainerErrorCode error; @@ -2648,13 +2648,13 @@ void AICreatureController::unEquipWeapons() // Equip the default weapon { - if (defaultWeapon != NULL) + if (defaultWeapon != nullptr) { creatureOwner->setCurrentWeapon(*defaultWeapon); } else { - WARNING(true, ("AICreatureController::unEquipWeapons() owner(%s) NULL default weapon", getDebugInformation().c_str())); + WARNING(true, ("AICreatureController::unEquipWeapons() owner(%s) nullptr default weapon", getDebugInformation().c_str())); } } } @@ -2690,7 +2690,7 @@ bool AICreatureController::usingPrimaryWeapon() { WeaponObject const * const currentWeaponObject = getCreature()->getCurrentWeapon(); - if (currentWeaponObject != NULL) + if (currentWeaponObject != nullptr) { result = (getPrimaryWeapon() == currentWeaponObject->getNetworkId()); } @@ -2708,7 +2708,7 @@ bool AICreatureController::usingSecondaryWeapon() { WeaponObject const * const currentWeaponObject = getCreature()->getCurrentWeapon(); - if (currentWeaponObject != NULL) + if (currentWeaponObject != nullptr) { result = (getSecondaryWeapon() == currentWeaponObject->getNetworkId()); } @@ -2815,7 +2815,7 @@ void AICreatureController::setRetreating(bool const retreating) { CellObject const * const cellObject = CellObject::getCellObject(cellId); - if (cellObject != NULL) + if (cellObject != nullptr) { CellProperty const * const cellProperty = cellObject->getCellProperty(); @@ -2965,7 +2965,7 @@ time_t AICreatureController::getKnockDownRecoveryTime() const { AiCreatureCombatProfile const * const combatProfile = AiCreatureCombatProfile::getCombatProfile(m_aiCreatureData->m_primarySpecials); - return (combatProfile != NULL) ? combatProfile->m_knockDownRecoveryTime : 0; + return (combatProfile != nullptr) ? combatProfile->m_knockDownRecoveryTime : 0; } //----------------------------------------------------------------------- std::string const AICreatureController::getCombatActionsString() @@ -2979,7 +2979,7 @@ std::string const AICreatureController::getCombatActionsString() { WeaponObject const * const primaryWeaponObject = WeaponObject::getWeaponObject(getPrimaryWeapon()); - if (primaryWeaponObject != NULL) + if (primaryWeaponObject != nullptr) { result += fs.sprintf("PRIMARY WEAPON >>> %s range[%.0f...%.0f] %s\n", FileNameUtils::get(primaryWeaponObject->getObjectTemplateName(), FileNameUtils::fileName).c_str(), primaryWeaponObject->getMinRange(), primaryWeaponObject->getMaxRange(), usingPrimaryWeapon() ? "(active)" : ""); } @@ -2989,7 +2989,7 @@ std::string const AICreatureController::getCombatActionsString() } AiCreatureCombatProfile const * const primaryWeaponCombatProfile = AiCreatureCombatProfile::getCombatProfile(m_aiCreatureData->m_primarySpecials); - if (primaryWeaponCombatProfile != NULL) + if (primaryWeaponCombatProfile != nullptr) { result += primaryWeaponCombatProfile->toString(); } @@ -3003,7 +3003,7 @@ std::string const AICreatureController::getCombatActionsString() { WeaponObject const * const secondaryWeaponObject = WeaponObject::getWeaponObject(getSecondaryWeapon()); - if (secondaryWeaponObject != NULL) + if (secondaryWeaponObject != nullptr) { result += fs.sprintf("SECONDARY WEAPON >>> %s range[%.0f...%.0f] %s\n", FileNameUtils::get(secondaryWeaponObject->getObjectTemplateName(), FileNameUtils::fileName).c_str(), secondaryWeaponObject->getMinRange(), secondaryWeaponObject->getMaxRange(), usingSecondaryWeapon() ? "(active)" : ""); } @@ -3014,7 +3014,7 @@ std::string const AICreatureController::getCombatActionsString() AiCreatureCombatProfile const * const secondaryWeaponCombatProfile = AiCreatureCombatProfile::getCombatProfile(m_aiCreatureData->m_secondarySpecials); - if (secondaryWeaponCombatProfile != NULL) + if (secondaryWeaponCombatProfile != nullptr) { result += secondaryWeaponCombatProfile->toString(); } diff --git a/engine/server/library/serverGame/src/shared/controller/AiShipController.cpp b/engine/server/library/serverGame/src/shared/controller/AiShipController.cpp index d2bf69f7..3fe9a88f 100755 --- a/engine/server/library/serverGame/src/shared/controller/AiShipController.cpp +++ b/engine/server/library/serverGame/src/shared/controller/AiShipController.cpp @@ -127,15 +127,15 @@ AiShipController * AiShipController::getAiShipController(NetworkId const & unit) { Object * const object = NetworkIdManager::getObjectById(unit); - return (object != NULL) ? AiShipController::asAiShipController(object->getController()) : NULL; + return (object != nullptr) ? AiShipController::asAiShipController(object->getController()) : nullptr; } // ---------------------------------------------------------------------- AiShipController * AiShipController::asAiShipController(Controller * const controller) { - ShipController * const shipController = (controller != NULL) ? controller->asShipController() : NULL; - AiShipController * const aiShipController = (shipController != NULL) ? shipController->asAiShipController() : NULL; + ShipController * const shipController = (controller != nullptr) ? controller->asShipController() : nullptr; + AiShipController * const aiShipController = (shipController != nullptr) ? shipController->asAiShipController() : nullptr; return aiShipController; } @@ -144,8 +144,8 @@ AiShipController * AiShipController::asAiShipController(Controller * const contr AiShipController const * AiShipController::asAiShipController(Controller const * const controller) { - ShipController const * const shipController = (controller != NULL) ? controller->asShipController() : NULL; - AiShipController const * const aiShipController = (shipController != NULL) ? shipController->asAiShipController() : NULL; + ShipController const * const shipController = (controller != nullptr) ? controller->asShipController() : nullptr; + AiShipController const * const aiShipController = (shipController != nullptr) ? shipController->asAiShipController() : nullptr; return aiShipController; } @@ -155,18 +155,18 @@ AiShipController const * AiShipController::asAiShipController(Controller const * AiShipController::AiShipController(ShipObject * const owner) : ShipController(owner), m_pilotData(&AiShipPilotData::getDefaultPilotData()), - m_pendingNonAttackBehavior(NULL), - m_nonAttackBehavior(NULL), - m_pendingAttackBehavior(NULL), - m_attackBehavior(NULL), + m_pendingNonAttackBehavior(nullptr), + m_nonAttackBehavior(nullptr), + m_pendingAttackBehavior(nullptr), + m_attackBehavior(nullptr), m_shipName(), m_shipClass(ShipAiReactionManager::SC_invalid), m_requestedSlowDown(false), - m_squad(NULL), - m_attackSquad(NULL), + m_squad(nullptr), + m_attackSquad(nullptr), m_formationPosition_l(), m_attackFormationPosition_l(), - m_path(NULL), + m_path(nullptr), m_currentPathIndex(0), m_aggroRadius(200.0f), m_countermeasureState(CS_none), @@ -190,22 +190,22 @@ AiShipController::~AiShipController() // Remove this unit from its squad - if (m_squad != NULL) + if (m_squad != nullptr) { // The owner of the squad is SpaceSquadManager getSquad().removeUnit(getOwner()->getNetworkId()); - m_squad = NULL; + m_squad = nullptr; } // Remove this unit from its attack squad - if (m_attackSquad != NULL) + if (m_attackSquad != nullptr) { // The owner of the attack squad is SpaceSquad m_attackSquad->removeUnit(getOwner()->getNetworkId()); - m_attackSquad = NULL; + m_attackSquad = nullptr; } else { @@ -215,17 +215,17 @@ AiShipController::~AiShipController() // Remove path here. SpacePathManager::release(m_path, getOwner()); - m_path = NULL; - m_pilotData = NULL; + m_path = nullptr; + m_pilotData = nullptr; delete m_nonAttackBehavior; - m_nonAttackBehavior = NULL; + m_nonAttackBehavior = nullptr; delete m_pendingNonAttackBehavior; - m_pendingNonAttackBehavior = NULL; + m_pendingNonAttackBehavior = nullptr; delete m_pendingAttackBehavior; - m_pendingAttackBehavior = NULL; + m_pendingAttackBehavior = nullptr; delete m_attackBehavior; - m_attackBehavior = NULL; + m_attackBehavior = nullptr; delete m_reactToMissileTimer; delete m_pilotManagerInfo; delete m_exclusiveAggroSet; @@ -234,7 +234,7 @@ AiShipController::~AiShipController() // ---------------------------------------------------------------------- void AiShipController::endBaselines() { - DEBUG_FATAL((m_squad != NULL), ("m_squad should be NULL")); + DEBUG_FATAL((m_squad != nullptr), ("m_squad should be nullptr")); m_squad = SpaceSquadManager::createSquad(); getSquad().addUnit(getOwner()->getNetworkId()); @@ -252,7 +252,7 @@ float AiShipController::realAlter(float const elapsedTime) #ifdef _DEBUG - AiDebugString * aiDebugString = NULL; + AiDebugString * aiDebugString = nullptr; if ( s_spaceAiClientDebugEnabled && !getShipOwner()->getObservers().empty()) { @@ -263,25 +263,25 @@ float AiShipController::realAlter(float const elapsedTime) // We have to have a pending behavior because while in a behavior a trigger can get called which can then kill that behavior, so we have to wait until the next frame to switch behaviors so they don't stomp each other from triggers. - if (m_pendingNonAttackBehavior != NULL) + if (m_pendingNonAttackBehavior != nullptr) { delete m_nonAttackBehavior; m_nonAttackBehavior = m_pendingNonAttackBehavior; - m_pendingNonAttackBehavior = NULL; + m_pendingNonAttackBehavior = nullptr; } - if (m_pendingDockingBehavior != NULL) + if (m_pendingDockingBehavior != nullptr) { delete m_dockingBehavior; m_dockingBehavior = m_pendingDockingBehavior; - m_pendingDockingBehavior = NULL; + m_pendingDockingBehavior = nullptr; } - if ( (m_dockingBehavior != NULL) + if ( (m_dockingBehavior != nullptr) && (m_dockingBehavior->isDockFinished())) { delete m_dockingBehavior; - m_dockingBehavior = NULL; + m_dockingBehavior = nullptr; } m_yawPosition = 0.f; @@ -292,7 +292,7 @@ float AiShipController::realAlter(float const elapsedTime) ShipObject * const shipOwner = NON_NULL(getShipOwner()); PROFILER_AUTO_BLOCK_DEFINE("behaviors"); - if (m_attackBehavior != NULL) // This was added for ships that are contructed for AI but not fully contructed proper using the space_mobile.tab + if (m_attackBehavior != nullptr) // This was added for ships that are contructed for AI but not fully contructed proper using the space_mobile.tab { if (isAttacking()) // Capital ships never go into attack mode as such, always follow their non-attacking behavior (although they may fire turrets as they go) { @@ -314,7 +314,7 @@ float AiShipController::realAlter(float const elapsedTime) shipOwner->openWings(); } - if (m_dockingBehavior != NULL) + if (m_dockingBehavior != nullptr) { m_dockingBehavior->unDock(); } @@ -325,7 +325,7 @@ float AiShipController::realAlter(float const elapsedTime) m_attackBehavior->alter(elapsedTime); #ifdef _DEBUG - if (aiDebugString != NULL) + if (aiDebugString != nullptr) { m_attackBehavior->addDebug(*aiDebugString); } @@ -337,9 +337,9 @@ float AiShipController::realAlter(float const elapsedTime) Object * const leaderObject = getAttackSquad().getLeader().getObject(); ShipController * const leaderShipController = leaderObject->getController()->asShipController(); - AiShipController * const leaderAiShipController = (leaderShipController != NULL) ? leaderShipController->asAiShipController() : NULL; + AiShipController * const leaderAiShipController = (leaderShipController != nullptr) ? leaderShipController->asAiShipController() : nullptr; - if (leaderAiShipController != NULL) + if (leaderAiShipController != nullptr) { Transform transform(leaderObject->getTransform_o2w()); transform.setPosition_p(leaderAiShipController->getMoveToGoalPosition_w()); @@ -361,7 +361,7 @@ float AiShipController::realAlter(float const elapsedTime) { delete m_attackBehavior; m_attackBehavior = m_pendingAttackBehavior; - m_pendingAttackBehavior = NULL; + m_pendingAttackBehavior = nullptr; } } else if (isBeingDocked()) @@ -370,18 +370,18 @@ float AiShipController::realAlter(float const elapsedTime) setThrottle(0.0f); } - else if (m_dockingBehavior != NULL) + else if (m_dockingBehavior != nullptr) { m_dockingBehavior->alter(elapsedTime); #ifdef _DEBUG - if (aiDebugString != NULL) + if (aiDebugString != nullptr) { m_dockingBehavior->addDebug(*aiDebugString); } #endif // _DEBUG } - else if (m_nonAttackBehavior != NULL) + else if (m_nonAttackBehavior != nullptr) { PROFILER_AUTO_BLOCK_DEFINE("non-attack behaviors"); @@ -413,7 +413,7 @@ float AiShipController::realAlter(float const elapsedTime) m_nonAttackBehavior->alter(elapsedTime); #ifdef _DEBUG - if (aiDebugString != NULL) + if (aiDebugString != nullptr) { m_nonAttackBehavior->addDebug(*aiDebugString); } @@ -425,7 +425,7 @@ float AiShipController::realAlter(float const elapsedTime) Object * const squadLeader = getSquad().getLeader().getObject(); - if (squadLeader != NULL) + if (squadLeader != nullptr) { Vector goalPosition_w(Formation::getPosition_w(squadLeader->getTransform_o2w(), getFormationPosition_l())); @@ -434,9 +434,9 @@ float AiShipController::realAlter(float const elapsedTime) if (getOwner()->getPosition_w().magnitudeBetweenSquared(goalPosition_w) > sqr(getLargestTurnRadius() * s_slowDownTurnRadiusGain)) { ShipController * const followedUnitShipController = squadLeader->getController()->asShipController(); - AiShipController * const followedUnitAiShipController = (followedUnitShipController != NULL) ? followedUnitShipController->asAiShipController() : NULL; + AiShipController * const followedUnitAiShipController = (followedUnitShipController != nullptr) ? followedUnitShipController->asAiShipController() : nullptr; - if (followedUnitAiShipController != NULL) + if (followedUnitAiShipController != nullptr) { followedUnitAiShipController->requestSlowDown(); } @@ -462,7 +462,7 @@ float AiShipController::realAlter(float const elapsedTime) } #ifdef _DEBUG - if (aiDebugString != NULL) + if (aiDebugString != nullptr) { m_nonAttackBehavior->addDebug(*aiDebugString); } @@ -476,7 +476,7 @@ float AiShipController::realAlter(float const elapsedTime) } else { - DEBUG_WARNING(true, ("debug_ai: There should never be a NULL non-attacking behavior %s", getOwner()->getDebugInformation().c_str())); + DEBUG_WARNING(true, ("debug_ai: There should never be a nullptr non-attacking behavior %s", getOwner()->getDebugInformation().c_str())); } } @@ -551,8 +551,8 @@ float AiShipController::realAlter(float const elapsedTime) } #ifdef _DEBUG - if ( (m_attackBehavior != NULL) - && (aiDebugString != NULL)) + if ( (m_attackBehavior != nullptr) + && (aiDebugString != nullptr)) { PROFILER_AUTO_BLOCK_DEFINE("sendDebugAiToClients"); sendDebugAiToClients(*aiDebugString); @@ -574,7 +574,7 @@ void AiShipController::moveTo(Vector const & position_w, float const throttle, f // If we are not following a unit, see if we need to slow down for someone - if ( (m_nonAttackBehavior != NULL) + if ( (m_nonAttackBehavior != nullptr) && (m_nonAttackBehavior->getBehaviorType() != ASBT_follow) && m_requestedSlowDown && !isAttacking()) @@ -645,16 +645,16 @@ bool AiShipController::addDamageTaken(NetworkId const & attackingUnit, float con { ShipObject const * const attackingShipObject = ShipObject::asShipObject(NetworkIdManager::getObjectById(attackingUnit)); - if (attackingShipObject != NULL) + if (attackingShipObject != nullptr) { CreatureObject const * const attackingPilotCreatureObject = attackingShipObject->getPilot(); - if ( (attackingPilotCreatureObject != NULL) + if ( (attackingPilotCreatureObject != nullptr) && attackingPilotCreatureObject->isPlayerControlled()) { GroupObject * const groupObject = attackingPilotCreatureObject->getGroup(); - if (groupObject != NULL) + if (groupObject != nullptr) { GroupObject::GroupMemberVector const & groupMembers = groupObject->getGroupMembers(); GroupObject::GroupMemberVector::const_iterator iterGroupMembers = groupMembers.begin(); @@ -665,11 +665,11 @@ bool AiShipController::addDamageTaken(NetworkId const & attackingUnit, float con NetworkId const & groupMemberPilotNetworkId = groupMember.first; CreatureObject const * const groupMemberPilotCreatureObject = CreatureObject::asCreatureObject(NetworkIdManager::getObjectById(groupMemberPilotNetworkId)); - if (groupMemberPilotCreatureObject != NULL) + if (groupMemberPilotCreatureObject != nullptr) { ShipObject const * const groupMemberShipObject = groupMemberPilotCreatureObject->getPilotedShip(); - if (groupMemberShipObject != NULL) + if (groupMemberShipObject != nullptr) { if (groupMemberShipObject != attackingShipObject) { @@ -749,24 +749,24 @@ void AiShipController::follow(NetworkId const & followedUnit, Vector const & dir LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipController::follow() owner(%s) followedUnit(%s) direction_o(%.1f, %.1f, %.1f) offset(%.1f)", getOwner()->getNetworkId().getValueString().c_str(), followedUnit.getValueString().c_str(), direction_l.x, direction_l.y, direction_l.z, distance)); SpacePathManager::release(m_path, getOwner()); - m_path = NULL; + m_path = nullptr; float appearanceRadius = 0.0f; Object const * const followedObject = NetworkIdManager::getObjectById(followedUnit); - if (followedObject != NULL) + if (followedObject != nullptr) { //-- This needs to be improved to cast a ray from this position back towards the ship and get the actual collision position CollisionProperty const * const ownerCollisionProperty = getOwner()->getCollisionProperty(); CollisionProperty const * const followedObjectCollisionProperty = followedObject->getCollisionProperty(); - if (ownerCollisionProperty != NULL) + if (ownerCollisionProperty != nullptr) { appearanceRadius += ownerCollisionProperty->getBoundingSphere_l().getRadius(); } - if (followedObjectCollisionProperty != NULL) + if (followedObjectCollisionProperty != nullptr) { appearanceRadius += followedObjectCollisionProperty ->getBoundingSphere_l().getRadius(); } @@ -786,7 +786,7 @@ int AiShipController::getBehaviorType() const { AiShipBehaviorType result = ASBT_idle; - if (m_nonAttackBehavior != NULL) + if (m_nonAttackBehavior != nullptr) { result = m_nonAttackBehavior->getBehaviorType(); } @@ -803,7 +803,7 @@ void AiShipController::idle() LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipController::idle() owner(%s)", getOwner()->getNetworkId().getValueString().c_str())); SpacePathManager::release(m_path, getOwner()); - m_path = NULL; + m_path = nullptr; delete m_pendingNonAttackBehavior; m_pendingNonAttackBehavior = new AiShipBehaviorIdle(*this);; @@ -818,7 +818,7 @@ void AiShipController::track(Object const & target) LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipController::track() owner(%s) target(%s)", getOwner()->getNetworkId().getValueString().c_str(), target.getNetworkId().getValueString().c_str())); SpacePathManager::release(m_path, getOwner()); - m_path = NULL; + m_path = nullptr; delete m_pendingNonAttackBehavior; m_pendingNonAttackBehavior = new AiShipBehaviorTrack(*this, target); @@ -871,7 +871,7 @@ void AiShipController::clearPatrolPath() { LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipController::clearPatrolPath() owner(%s)", getOwner()->getNetworkId().getValueString().c_str())); - if (m_path != NULL) + if (m_path != nullptr) { m_path->clear(); } @@ -896,15 +896,15 @@ void AiShipController::triggerBehaviorChanged(AiShipBehaviorType const newBehavi { // Only send the trigger if the new behavior is different from the old behavior - AiShipBehaviorType const oldBehavior = (m_nonAttackBehavior != NULL) ? m_nonAttackBehavior->getBehaviorType() : ASBT_idle; + AiShipBehaviorType const oldBehavior = (m_nonAttackBehavior != nullptr) ? m_nonAttackBehavior->getBehaviorType() : ASBT_idle; if (oldBehavior != newBehavior) { Object * const object = getOwner(); - ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; - GameScriptObject * const gameScriptObject = (serverObject != NULL) ? serverObject->getScriptObject() : NULL; + ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; + GameScriptObject * const gameScriptObject = (serverObject != nullptr) ? serverObject->getScriptObject() : nullptr; - if (gameScriptObject != NULL) + if (gameScriptObject != nullptr) { LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipController::triggerBehaviorChanged() unit(%s) old(%s) new(%s)", getOwner()->getNetworkId().getValueString().c_str(), AiShipBehaviorBase::getBehaviorString(oldBehavior), AiShipBehaviorBase::getBehaviorString(newBehavior))); @@ -925,10 +925,10 @@ void AiShipController::triggerBehaviorChanged(AiShipBehaviorType const newBehavi void AiShipController::triggerEnterCombat(NetworkId const & attackTarget) { Object * const object = getOwner(); - ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; - GameScriptObject * const gameScriptObject = (serverObject != NULL) ? serverObject->getScriptObject() : NULL; + ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; + GameScriptObject * const gameScriptObject = (serverObject != nullptr) ? serverObject->getScriptObject() : nullptr; - if (gameScriptObject != NULL) + if (gameScriptObject != nullptr) { LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipController::triggerEnterCombat() unit(%s) attackTarget(%s)", getOwner()->getNetworkId().getValueString().c_str(), attackTarget.getValueString().c_str())); @@ -968,7 +968,7 @@ void AiShipController::setPilotType(std::string const & pilotType) AiPilotManager::getPilotData(*m_pilotData, *m_pilotManagerInfo); // Make sure the ship name is set - if (shipObject != NULL) + if (shipObject != nullptr) { std::string shipName; @@ -986,7 +986,7 @@ void AiShipController::setPilotType(std::string const & pilotType) // Create the attack behavior based on the ship class delete m_attackBehavior; - m_attackBehavior = NULL; + m_attackBehavior = nullptr; m_shipClass = ShipAiReactionManager::getShipClass(m_shipName); @@ -1009,7 +1009,7 @@ void AiShipController::setPilotType(std::string const & pilotType) setAggroRadius(m_pilotData->m_aggroRadius); - FATAL((m_attackBehavior == NULL), ("The attack behavior can not be NULL.")); + FATAL((m_attackBehavior == nullptr), ("The attack behavior can not be nullptr.")); } // ---------------------------------------------------------------------- @@ -1029,8 +1029,8 @@ CachedNetworkId const & AiShipController::getPrimaryAttackTarget() const ShipObject const * AiShipController::getPrimaryAttackTargetShipObject() const { Object const * const targetObject = getPrimaryAttackTarget().getObject(); - ServerObject const * const targetServerObject = (targetObject != NULL) ? targetObject->asServerObject() : NULL; - ShipObject const * const targetShipObject = (targetServerObject != NULL) ? targetServerObject->asShipObject() : NULL; + ServerObject const * const targetServerObject = (targetObject != nullptr) ? targetObject->asServerObject() : nullptr; + ShipObject const * const targetShipObject = (targetServerObject != nullptr) ? targetServerObject->asShipObject() : nullptr; return targetShipObject; } @@ -1097,7 +1097,7 @@ void AiShipController::setSquad(SpaceSquad * const squad) { // Remove the unit from its previous squad - if ( (m_squad != NULL) + if ( (m_squad != nullptr) && !m_squad->isEmpty()) { m_squad->removeUnit(getOwner()->getNetworkId()); @@ -1170,7 +1170,7 @@ void AiShipController::setAttackSquad(SpaceAttackSquad * const attackSquad) { // Remove the unit from its pervious attack squad - if (m_attackSquad != NULL) + if (m_attackSquad != nullptr) { m_attackSquad->removeUnit(getOwner()->getNetworkId()); } @@ -1210,7 +1210,7 @@ float AiShipController::getShipRadius() const ShipObject const * const shipObject = getShipOwner(); CollisionProperty const * const shipCollision = shipObject->getCollisionProperty(); - if (shipCollision != NULL) + if (shipCollision != nullptr) { result = shipCollision->getBoundingSphere_l().getRadius(); } @@ -1288,9 +1288,9 @@ bool AiShipController::shouldCheckForEnemies() const void AiShipController::setCurrentPathIndex(unsigned int const index) { - //LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipController::setCurrentPathIndex() unit(%s) pathIndex(%u) pathSize(%u)", getOwner()->getNetworkId().getValueString().c_str(), index, (m_path != NULL) ? m_path->getTransformList().size() : 0)); + //LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipController::setCurrentPathIndex() unit(%s) pathIndex(%u) pathSize(%u)", getOwner()->getNetworkId().getValueString().c_str(), index, (m_path != nullptr) ? m_path->getTransformList().size() : 0)); - if ( (m_path != NULL) + if ( (m_path != nullptr) && !m_path->isEmpty()) { m_currentPathIndex = index; @@ -1298,7 +1298,7 @@ void AiShipController::setCurrentPathIndex(unsigned int const index) else { m_currentPathIndex = 0; - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled() && (m_currentPathIndex > 0), "debug_ai", ("AiShipController::setCurrentPathIndex() Setting a non-zero path index(%d) on a NULL or empty path", index)); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled() && (m_currentPathIndex > 0), "debug_ai", ("AiShipController::setCurrentPathIndex() Setting a non-zero path index(%d) on a nullptr or empty path", index)); } } @@ -1317,7 +1317,7 @@ float AiShipController::calculateThrottleToPosition_w(Vector const & position_w, Object const * const object = getOwner(); - if (object != NULL) + if (object != nullptr) { float const distanceToGoalSquared = object->getPosition_w().magnitudeBetweenSquared(position_w); @@ -1420,7 +1420,7 @@ void AiShipController::switchToBomberAttack() bool AiShipController::removeAttackTarget(NetworkId const & unit) { LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipController::removeAttackTarget() owner(%s) unit(%s)", getOwner()->getNetworkId().getValueString().c_str(), unit.getValueString().c_str())); - DEBUG_WARNING((unit == NetworkId::cms_invalid), ("debug_ai: owner(%s) ERROR: Trying to remove a NULL unit(%s) from the attack target list.", getOwner()->getNetworkId().getValueString().c_str(), unit.getValueString().c_str())); + DEBUG_WARNING((unit == NetworkId::cms_invalid), ("debug_ai: owner(%s) ERROR: Trying to remove a nullptr unit(%s) from the attack target list.", getOwner()->getNetworkId().getValueString().c_str(), unit.getValueString().c_str())); return ShipController::removeAttackTarget(unit); } @@ -1637,7 +1637,7 @@ void AiShipController::sendDebugAiToClients(AiDebugString & aiDebugString) bool const checkForEnemies = shouldCheckForEnemies(); float const leashRadius = m_attackBehavior->getLeashRadius(); - aiDebugString.addText(formattedString.sprintf("%s agg(%.0f) lsh(%.0f) %s\n", AiShipController::getAttackOrdersString(getAttackOrders()), m_aggroRadius, leashRadius, (m_attackBehavior == NULL) ? " [NO ATTACK BEHAVIOR]" : (checkForEnemies ? " [LFE]" : ""))); + aiDebugString.addText(formattedString.sprintf("%s agg(%.0f) lsh(%.0f) %s\n", AiShipController::getAttackOrdersString(getAttackOrders()), m_aggroRadius, leashRadius, (m_attackBehavior == nullptr) ? " [NO ATTACK BEHAVIOR]" : (checkForEnemies ? " [LFE]" : ""))); } } @@ -1687,7 +1687,7 @@ void AiShipController::sendDebugAiToClients(AiDebugString & aiDebugString) // Only send to the client if the objvar is set int temp = 0; - if ( (characterObject != NULL) + if ( (characterObject != nullptr) && characterObject->getObjVars().getItem("ai_debug_string", temp)) { if (temp > 0) @@ -1768,8 +1768,8 @@ void AiShipController::addExclusiveAggro(NetworkId const & unit) // Make sure this is a player Object * const unitObject = NetworkIdManager::getObjectById(unit); - ServerObject * const unitServerObject = (unitObject != NULL) ? unitObject->asServerObject() : NULL; - CreatureObject * const unitCreatureObject = (unitServerObject != NULL) ? unitServerObject->asCreatureObject() : NULL; + ServerObject * const unitServerObject = (unitObject != nullptr) ? unitObject->asServerObject() : nullptr; + CreatureObject * const unitCreatureObject = (unitServerObject != nullptr) ? unitServerObject->asCreatureObject() : nullptr; if ( !unitCreatureObject || !unitCreatureObject->isPlayerControlled()) @@ -1829,11 +1829,11 @@ bool AiShipController::isExclusiveAggro(CreatureObject const & pilot) const CreatureObject const * const aggroCreatureObject = CreatureObject::asCreatureObject(aggroCachedNetworkId.getObject()); - if (aggroCreatureObject != NULL) + if (aggroCreatureObject != nullptr) { GroupObject * const groupObject = aggroCreatureObject->getGroup(); - if (groupObject != NULL) + if (groupObject != nullptr) { GroupObject::GroupMemberVector const & groupMembers = groupObject->getGroupMembers(); GroupObject::GroupMemberVector::const_iterator iterGroupMembers = groupMembers.begin(); @@ -1871,7 +1871,7 @@ bool AiShipController::isValidTarget(ShipObject const & unit) const CreatureObject const * const pilotCreatureObject = unit.getPilot(); - if (pilotCreatureObject != NULL) + if (pilotCreatureObject != nullptr) { if (pilotCreatureObject->isPlayerControlled()) { diff --git a/engine/server/library/serverGame/src/shared/controller/AiShipControllerInterface.cpp b/engine/server/library/serverGame/src/shared/controller/AiShipControllerInterface.cpp index 3e4549aa..21fef53d 100755 --- a/engine/server/library/serverGame/src/shared/controller/AiShipControllerInterface.cpp +++ b/engine/server/library/serverGame/src/shared/controller/AiShipControllerInterface.cpp @@ -25,7 +25,7 @@ bool AiShipControllerInterface::addDamageTaken(NetworkId const & unit, NetworkId bool result = false; AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != NULL) + if (aiShipController != nullptr) { bool const verifyAttacker = false; @@ -45,7 +45,7 @@ bool AiShipControllerInterface::setAttackOrders(NetworkId const & unit, AiShipCo bool result = false; AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != NULL) + if (aiShipController != nullptr) { result = true; aiShipController->setAttackOrders(attackOrders); @@ -64,7 +64,7 @@ bool AiShipControllerInterface::idle(NetworkId const & unit) bool result = false; AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != NULL) + if (aiShipController != nullptr) { result = true; aiShipController->idle(); @@ -83,7 +83,7 @@ bool AiShipControllerInterface::track(NetworkId const & unit, Object const & tar bool result = false; AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != NULL) + if (aiShipController != nullptr) { result = true; aiShipController->track(target); @@ -102,7 +102,7 @@ bool AiShipControllerInterface::setLeashRadius(NetworkId const & unit, float con bool result = false; AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != NULL) + if (aiShipController != nullptr) { result = true; aiShipController->setLeashRadius(radius); @@ -121,7 +121,7 @@ bool AiShipControllerInterface::follow(NetworkId const & unit, NetworkId const & bool result = false; AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != NULL) + if (aiShipController != nullptr) { result = true; aiShipController->follow(followedUnit, direction_o, direction); @@ -140,7 +140,7 @@ bool AiShipControllerInterface::addPatrolPath(NetworkId const & unit, SpacePath bool result = false; AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != NULL) + if (aiShipController != nullptr) { result = true; aiShipController->addPatrolPath(path); @@ -159,7 +159,7 @@ bool AiShipControllerInterface::clearPatrolPath(NetworkId const & unit) bool result = false; AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != NULL) + if (aiShipController != nullptr) { result = true; aiShipController->clearPatrolPath(); @@ -178,7 +178,7 @@ bool AiShipControllerInterface::moveTo(NetworkId const & unit, SpacePath * const bool result = false; AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != NULL) + if (aiShipController != nullptr) { result = true; aiShipController->moveTo(path); diff --git a/engine/server/library/serverGame/src/shared/controller/CreatureController.cpp b/engine/server/library/serverGame/src/shared/controller/CreatureController.cpp index 067da019..f25d0fb1 100755 --- a/engine/server/library/serverGame/src/shared/controller/CreatureController.cpp +++ b/engine/server/library/serverGame/src/shared/controller/CreatureController.cpp @@ -122,7 +122,7 @@ CreatureController::~CreatureController() void CreatureController::handleMessage (const int message, const float value, const MessageQueue::Data* const data, const uint32 flags) { CreatureObject * const owner = static_cast(getOwner()); - DEBUG_FATAL(!owner, ("Owner is NULL in CreatureController::handleMessage\n")); + DEBUG_FATAL(!owner, ("Owner is nullptr in CreatureController::handleMessage\n")); switch(message) { @@ -629,7 +629,7 @@ void CreatureController::handleMessage (const int message, const float value, co case CM_setIncapacitated: { const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); - if (msg != NULL) + if (msg != nullptr) owner->setIncapacitated(msg->getValue().first, msg->getValue().second); } break; @@ -853,7 +853,7 @@ void CreatureController::handleMessage (const int message, const float value, co if (owner && msg) owner->setAlternateAppearance(msg->getValue()); else - WARNING(true, ("CreatureController: received CM_setAppearanceFromObjectTemplate but owner or message was NULL.")); + WARNING(true, ("CreatureController: received CM_setAppearanceFromObjectTemplate but owner or message was nullptr.")); } break; @@ -873,9 +873,9 @@ void CreatureController::handleMessage (const int message, const float value, co if (msg) { ServerObject * defender = safe_cast(NetworkIdManager::getObjectById(msg->getDefender())); - if (defender != NULL) + if (defender != nullptr) { - if (defender->asCreatureObject() != NULL) + if (defender->asCreatureObject() != nullptr) { defender->asCreatureObject()->pushedMe(msg->getAttacker(), msg->getAttackerPos(), msg->getDefenderPos(), msg->getDistance()); } @@ -894,7 +894,7 @@ void CreatureController::handleMessage (const int message, const float value, co if (msg) { ServerObject * target = safe_cast(NetworkIdManager::getObjectById(msg->getTarget())); - if (target != NULL && target->asTangibleObject() != NULL) + if (target != nullptr && target->asTangibleObject() != nullptr) { if (owner->isAuthoritative()) owner->addSlowDownEffect(*(target->asTangibleObject()), msg->getConeLength(), msg->getConeAngle(), msg->getSlopeAngle(), msg->getExpireTime()); @@ -964,7 +964,7 @@ void CreatureController::handleMessage (const int message, const float value, co { MessageQueueCyberneticsChangeRequest const * const msg = safe_cast(data); NOT_NULL(msg); - if (msg != NULL) + if (msg != nullptr) { NetworkId const & playerId = msg->getTarget(); GameScriptObject * const scriptObject = owner->getScriptObject(); @@ -984,10 +984,10 @@ void CreatureController::handleMessage (const int message, const float value, co case CM_setCurrentQuest: { MessageQueueGenericValueType const * const msg = safe_cast const *>(data); - if (msg != NULL) + if (msg != nullptr) { PlayerObject * player = PlayerCreatureController::getPlayerObject(owner); - if (player != NULL) + if (player != nullptr) { player->setCurrentQuest(msg->getValue()); } @@ -1003,7 +1003,7 @@ void CreatureController::handleMessage (const int message, const float value, co case CM_setRegenRate: { MessageQueueGenericValueType > const * const msg = safe_cast > const *>(data); - if (msg != NULL) + if (msg != nullptr) { owner->setRegenRate(static_cast(msg->getValue().first), msg->getValue().second); } @@ -1516,7 +1516,7 @@ void CreatureController::conclude() // combatants must be adjusted to reflect the server's idea of the post-alter end posture. // This information was not known at the time the message was constructed. MessageQueueCombatAction * combatMessage = safe_cast(data); - if (combatMessage != NULL) + if (combatMessage != nullptr) { //-- Fix up end postures in messages. @@ -1527,7 +1527,7 @@ void CreatureController::conclude() combatMessage->getAttacker()); const CreatureObject * attacker = dynamic_cast( NetworkIdManager::getObjectById(attackerData.id)); - attackerData.endPosture = (attacker != NULL) ? attacker->getPosture() : static_cast(0); + attackerData.endPosture = (attacker != nullptr) ? attacker->getPosture() : static_cast(0); // set the defenders' posture const MessageQueueCombatAction::DefenderDataVector & defenderData = @@ -1539,7 +1539,7 @@ void CreatureController::conclude() const_cast(*iter); const CreatureObject * defender = dynamic_cast( NetworkIdManager::getObjectById(defenderData.id)); - defenderData.endPosture = (defender != NULL) ? defender->getPosture() : static_cast(0); + defenderData.endPosture = (defender != nullptr) ? defender->getPosture() : static_cast(0); } } } @@ -1667,7 +1667,7 @@ void CreatureController::handleSecureTradeMessage(const MessageQueueSecureTrade )); } } - else if (recipient->getClient() == NULL) + else if (recipient->getClient() == nullptr) { // GameServer::getInstance().sendToPlanetServer( // GenericValueTypeMessage >( @@ -1862,7 +1862,7 @@ void CreatureController::setAppearanceFromObjectTemplate(std::string const &serv CreatureObject * owner = dynamic_cast(getOwner()); if (!owner) { - WARNING(true, ("setAppearanceFromObjectTemplate(): owner is NULL or not a CreatureObject.")); + WARNING(true, ("setAppearanceFromObjectTemplate(): owner is nullptr or not a CreatureObject.")); return; } @@ -2007,7 +2007,7 @@ void CreatureController::calculateWaterState(bool& isSwimming, bool &isBurning, if (ownerCreature->getState(States::RidingMount)) { CreatureObject const *const mountCreature = ownerCreature->getMountedCreature(); - CreatureController const *const mountCreatureController = mountCreature ? safe_cast(mountCreature->getController()) : NULL; + CreatureController const *const mountCreatureController = mountCreature ? safe_cast(mountCreature->getController()) : nullptr; if (mountCreatureController) { // Note: we do the real computation for the mount here because the rider gets @@ -2135,28 +2135,28 @@ CreatureController const * CreatureController::asCreatureController() const PlayerCreatureController * CreatureController::asPlayerCreatureController() { - return NULL; + return nullptr; } //---------------------------------------------------------------------- PlayerCreatureController const * CreatureController::asPlayerCreatureController() const { - return NULL; + return nullptr; } //---------------------------------------------------------------------- AICreatureController * CreatureController::asAiCreatureController() { - return NULL; + return nullptr; } //---------------------------------------------------------------------- AICreatureController const * CreatureController::asAiCreatureController() const { - return NULL; + return nullptr; } //----------------------------------------------------------------------- @@ -2170,23 +2170,23 @@ CreatureController * CreatureController::getCreatureController(NetworkId const & CreatureController * CreatureController::getCreatureController(Object * object) { - Controller * controller = (object != NULL) ? object->getController() : NULL; + Controller * controller = (object != nullptr) ? object->getController() : nullptr; - return (controller != NULL) ? controller->asCreatureController() : NULL; + return (controller != nullptr) ? controller->asCreatureController() : nullptr; } // ---------------------------------------------------------------------- CreatureController * CreatureController::asCreatureController(Controller * controller) { - return (controller != NULL) ? controller->asCreatureController() : NULL; + return (controller != nullptr) ? controller->asCreatureController() : nullptr; } // ---------------------------------------------------------------------- CreatureController const * CreatureController::asCreatureController(Controller const * controller) { - return (controller != NULL) ? controller->asCreatureController() : NULL; + return (controller != nullptr) ? controller->asCreatureController() : nullptr; } // ====================================================================== diff --git a/engine/server/library/serverGame/src/shared/controller/PlanetController.cpp b/engine/server/library/serverGame/src/shared/controller/PlanetController.cpp index 97a826ba..465bb3d5 100755 --- a/engine/server/library/serverGame/src/shared/controller/PlanetController.cpp +++ b/engine/server/library/serverGame/src/shared/controller/PlanetController.cpp @@ -61,7 +61,7 @@ void PlanetController::handleMessage (const int message, const float value, cons case CM_setWeather: { const MessageQueueGenericValueType >* const message = safe_cast >*> (data); - if (message != NULL) + if (message != nullptr) { owner->setWeather( message->getValue().first, @@ -280,7 +280,7 @@ void PlanetController::handleMessage (const int message, const float value, cons const std::map & data = message->getValue(); for (std::map::const_iterator iter = data.begin(); iter != data.end(); ++iter) - owner->adjustGcwImperialScore("CM_adjustGcwImperialScore", NULL, iter->first, iter->second); + owner->adjustGcwImperialScore("CM_adjustGcwImperialScore", nullptr, iter->first, iter->second); } } break; @@ -293,7 +293,7 @@ void PlanetController::handleMessage (const int message, const float value, cons const std::map & data = message->getValue(); for (std::map::const_iterator iter = data.begin(); iter != data.end(); ++iter) - owner->adjustGcwRebelScore("CM_adjustGcwRebelScore", NULL, iter->first, iter->second); + owner->adjustGcwRebelScore("CM_adjustGcwRebelScore", nullptr, iter->first, iter->second); } } break; diff --git a/engine/server/library/serverGame/src/shared/controller/PlayerCreatureController.cpp b/engine/server/library/serverGame/src/shared/controller/PlayerCreatureController.cpp index df4260bc..1097566c 100755 --- a/engine/server/library/serverGame/src/shared/controller/PlayerCreatureController.cpp +++ b/engine/server/library/serverGame/src/shared/controller/PlayerCreatureController.cpp @@ -164,7 +164,7 @@ namespace PlayerCreatureControllerNamespace if(!mount) { - LOG("mounts-bug", ("PlayerCreatureControllerNamespace::isCreaturePassenger(): server id=[%d],object id=[%s] creature has state RidingMount but getMountedCreature() returns NULL.", static_cast(GameServer::getInstance().getProcessId()), creature.getNetworkId().getValueString().c_str())); + LOG("mounts-bug", ("PlayerCreatureControllerNamespace::isCreaturePassenger(): server id=[%d],object id=[%s] creature has state RidingMount but getMountedCreature() returns nullptr.", static_cast(GameServer::getInstance().getProcessId()), creature.getNetworkId().getValueString().c_str())); return false; } @@ -172,7 +172,7 @@ namespace PlayerCreatureControllerNamespace if(!primaryRider) { - LOG("mounts-bug", ("PlayerCreatureControllerNamespace::isCreaturePassenger(): server id=[%d],object id=[%s] creature has state RidingMount but mount->getPrimaryMountingRider() returns NULL.", static_cast(GameServer::getInstance().getProcessId()), creature.getNetworkId().getValueString().c_str())); + LOG("mounts-bug", ("PlayerCreatureControllerNamespace::isCreaturePassenger(): server id=[%d],object id=[%s] creature has state RidingMount but mount->getPrimaryMountingRider() returns nullptr.", static_cast(GameServer::getInstance().getProcessId()), creature.getNetworkId().getValueString().c_str())); return false; } @@ -411,7 +411,7 @@ void PlayerCreatureController::logMoveFailed(char const *reason) "movement", ( "move fail - object %s stationId %u - %s", - creature ? creature->getNetworkId().getValueString().c_str() : "", + creature ? creature->getNetworkId().getValueString().c_str() : "", stationId, reason)); } @@ -425,7 +425,7 @@ bool PlayerCreatureController::isLocationValid(Vector const &position_w, CellObj return false; TerrainObject const *const terrainObject = TerrainObject::getConstInstance(); - if (NULL != terrainObject && (NULL == cell || cell->getCellProperty()->isWorldCell())) + if (nullptr != terrainObject && (nullptr == cell || cell->getCellProperty()->isWorldCell())) { if (!terrainObject->isPassableForceChunkCreation(position_w)) return false; @@ -445,7 +445,7 @@ bool PlayerCreatureController::isLocationValid(Vector const &position_w, CellObj Sphere testSphere(position_w + localSphere.getCenter(), localSphere.getRadius()); - if (CollisionWorld::query(testSphere, NULL)) + if (CollisionWorld::query(testSphere, nullptr)) return false; } return true; @@ -464,7 +464,7 @@ bool PlayerCreatureController::checkValidMove(MoveSnapshot const &m, float const CreatureObject * const creature = NON_NULL(getCreature()); // update the velocity in the serverController - if (creature != NULL) + if (creature != nullptr) { Vector moveDistance = m.getPosition_w() - creature->getPosition_w(); moveDistance.y = 0.0f; @@ -495,8 +495,8 @@ bool PlayerCreatureController::checkValidMove(MoveSnapshot const &m, float const if (!m.isValid()) return handleInvalidMove("invalid destination"); - if (creature == NULL) - return handleInvalidMove("creature is null"); + if (creature == nullptr) + return handleInvalidMove("creature is nullptr"); if (!m.isAllowed(*creature)) return handleInvalidMove("not allowed in dest cell"); @@ -513,7 +513,7 @@ bool PlayerCreatureController::checkValidMove(MoveSnapshot const &m, float const PortalProperty const *destPortalProperty = destCell ? ContainerInterface::getContainedByObject(*destCell)->getPortalProperty() : 0; if (sourcePortalProperty != destPortalProperty) { - // Moving between pobs. This is only valid if one of these is null, since pobs only connect to the world + // Moving between pobs. This is only valid if one of these is nullptr, since pobs only connect to the world if (sourcePortalProperty && destPortalProperty) return handleInvalidMove("tried to move from one pob to another without passing through the world cell"); if (sourcePortalProperty && !sourcePortalProperty->hasPassablePortalToParentCell()) @@ -548,7 +548,7 @@ bool PlayerCreatureController::checkValidMove(MoveSnapshot const &m, float const Client * const client = creature->getClient(); if (!client) - return handleInvalidMove("Creature's client is NULL"); + return handleInvalidMove("Creature's client is nullptr"); uint32 const currentServerSyncStamp = client->getServerSyncStampLong(); @@ -741,7 +741,7 @@ bool PlayerCreatureController::checkValidMove(MoveSnapshot const &m, float const } - m_lastSpeedCheckFailureTime = ::time(NULL); + m_lastSpeedCheckFailureTime = ::time(nullptr); ++m_speedCheckConsecutiveFailureCount; // if this is the first validation failure "in a while", let it pass, because it may be a false positive @@ -1153,11 +1153,11 @@ void PlayerCreatureController::handleMessage (const int message, const float val NetworkId const & designerId = inMsg->getDesignerId(); NetworkId const & recipientId = inMsg->getRecipientId(); Object const * const designerObj = NetworkIdManager::getObjectById(designerId); - ServerObject const * const designerServer = designerObj ? designerObj->asServerObject() : NULL; - CreatureObject const * const designer = designerServer ? designerServer->asCreatureObject() : NULL; + ServerObject const * const designerServer = designerObj ? designerObj->asServerObject() : nullptr; + CreatureObject const * const designer = designerServer ? designerServer->asCreatureObject() : nullptr; Object * const recipientObj = NetworkIdManager::getObjectById(recipientId); - ServerObject * const recipientServer = recipientObj ? recipientObj->asServerObject() : NULL; - CreatureObject * const recipient = recipientServer ? recipientServer->asCreatureObject() : NULL; + ServerObject * const recipientServer = recipientObj ? recipientObj->asServerObject() : nullptr; + CreatureObject * const recipient = recipientServer ? recipientServer->asCreatureObject() : nullptr; if(designer && recipient) { //designer-sent message, either data to sync to the recipient, or committed data to check and apply @@ -1167,7 +1167,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val { //designer hasn't accepted yet, send change to the client so they can see it before agreeing Object * const recipientObject = NetworkIdManager::getObjectById(inMsg->getRecipientId()); - Controller * const recipientController = recipientObject ? recipientObject->getController() : NULL; + Controller * const recipientController = recipientObject ? recipientObject->getController() : nullptr; if(recipientController) { ImageDesignChangeMessage * outMsg = new ImageDesignChangeMessage(); @@ -1182,7 +1182,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val { //check and apply this data once the recipient also accepts Object * const recipientObject = NetworkIdManager::getObjectById(inMsg->getRecipientId()); - Controller * const recipientController = recipientObject ? recipientObject->getController() : NULL; + Controller * const recipientController = recipientObject ? recipientObject->getController() : nullptr; if(recipientController) { ImageDesignChangeMessage * outMsg = new ImageDesignChangeMessage(); @@ -1201,7 +1201,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val //recipient hasn't accepted yet, send the data to the designer to update the recipient-sent amount of money //designer hasn't accepted yet, send change to the client so they can see it before agreeing Object * const designerObject = NetworkIdManager::getObjectById(inMsg->getDesignerId()); - Controller * const designerController = designerObject ? designerObject->getController() : NULL; + Controller * const designerController = designerObject ? designerObject->getController() : nullptr; if(designerController) { ImageDesignChangeMessage * outMsg = new ImageDesignChangeMessage(); @@ -1232,8 +1232,8 @@ void PlayerCreatureController::handleMessage (const int message, const float val std::string const recipientSpeciesGender = CustomizationManager::getServerSpeciesGender(*recipient); CustomizationData * const customizationData = recipient->fetchCustomizationData(); ServerObject * const hair = recipient->getHair(); - TangibleObject * const tangibleHair = hair ? hair->asTangibleObject() : NULL; - CustomizationData * customizationDataHair = NULL; + TangibleObject * const tangibleHair = hair ? hair->asTangibleObject() : nullptr; + CustomizationData * customizationDataHair = nullptr; if(tangibleHair) customizationDataHair = tangibleHair->fetchCustomizationData(); if(customizationData) @@ -1285,7 +1285,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val { //if the recipient canceled the session, tell the designer Object const * const designerObject = NetworkIdManager::getObjectById(session.designerId); - ServerObject const * const designer = designerObject ? designerObject->asServerObject() : NULL; + ServerObject const * const designer = designerObject ? designerObject->asServerObject() : nullptr; if(designer && (owner->getNetworkId() != session.designerId)) Chat::sendSystemMessage(*designer, SharedStringIds::imagedesigner_canceled_by_recip, Unicode::emptyString); @@ -1304,11 +1304,11 @@ void PlayerCreatureController::handleMessage (const int message, const float val NetworkId const & bufferId = inMsg->getBufferId(); NetworkId const & recipientId = inMsg->getRecipientId(); Object const * const bufferObj = NetworkIdManager::getObjectById(bufferId); - ServerObject const * const bufferServer = bufferObj ? bufferObj->asServerObject() : NULL; - CreatureObject const * const buffer = bufferServer ? bufferServer->asCreatureObject() : NULL; + ServerObject const * const bufferServer = bufferObj ? bufferObj->asServerObject() : nullptr; + CreatureObject const * const buffer = bufferServer ? bufferServer->asCreatureObject() : nullptr; Object * const recipientObj = NetworkIdManager::getObjectById(recipientId); - ServerObject * const recipientServer = recipientObj ? recipientObj->asServerObject() : NULL; - CreatureObject * const recipient = recipientServer ? recipientServer->asCreatureObject() : NULL; + ServerObject * const recipientServer = recipientObj ? recipientObj->asServerObject() : nullptr; + CreatureObject * const recipient = recipientServer ? recipientServer->asCreatureObject() : nullptr; if(buffer && recipient) { //buffer-sent message, either data to sync to the recipient, or committed data to check and apply @@ -1318,7 +1318,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val { //buffer hasn't accepted yet, send change to the client so they can see it before agreeing Object * const recipientObject = NetworkIdManager::getObjectById(inMsg->getRecipientId()); - Controller * const recipientController = recipientObject ? recipientObject->getController() : NULL; + Controller * const recipientController = recipientObject ? recipientObject->getController() : nullptr; if(recipientController) { BuffBuilderChangeMessage * outMsg = new BuffBuilderChangeMessage(); @@ -1333,7 +1333,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val { //check and apply this data once the recipient also accepts Object * const recipientObject = NetworkIdManager::getObjectById(inMsg->getRecipientId()); - Controller * const recipientController = recipientObject ? recipientObject->getController() : NULL; + Controller * const recipientController = recipientObject ? recipientObject->getController() : nullptr; if(recipientController) { BuffBuilderChangeMessage * outMsg = new BuffBuilderChangeMessage(); @@ -1351,7 +1351,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val //recipient hasn't accepted yet, send the data to the buffer to update the recipient-sent amount of money //buffer hasn't accepted yet, send change to the client so they can see it before agreeing Object * const bufferObject = NetworkIdManager::getObjectById(inMsg->getBufferId()); - Controller * const bufferController = bufferObject ? bufferObject->getController() : NULL; + Controller * const bufferController = bufferObject ? bufferObject->getController() : nullptr; if(bufferController) { BuffBuilderChangeMessage * outMsg = new BuffBuilderChangeMessage(); @@ -1425,7 +1425,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val { //if the recipient canceled the session, tell the designer Object const * const bufferObject = NetworkIdManager::getObjectById(session.bufferId); - ServerObject const * const buffer = bufferObject ? bufferObject->asServerObject() : NULL; + ServerObject const * const buffer = bufferObject ? bufferObject->asServerObject() : nullptr; if(buffer && (owner->getNetworkId() != session.bufferId)) { @@ -1447,7 +1447,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val if(msg) { Object const * const terminalO = NetworkIdManager::getObjectById(msg->getValue()); - ServerObject const * const terminal = terminalO ? terminalO->asServerObject() : NULL; + ServerObject const * const terminal = terminalO ? terminalO->asServerObject() : nullptr; if(terminal) { Client const * const client = owner->getClient(); @@ -1461,7 +1461,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val if(!client->isGod()) { Object const * const buildingO = ContainerInterface::getTopmostContainer(*terminal); - ServerObject const * const building = buildingO ? buildingO->asServerObject() : NULL; + ServerObject const * const building = buildingO ? buildingO->asServerObject() : nullptr; if(building) { DynamicVariableList const & buildingObjVars = building->getObjVars(); @@ -1478,13 +1478,13 @@ void PlayerCreatureController::handleMessage (const int message, const float val for(std::vector::const_iterator i = ships.begin(); i != ships.end(); ++i) { Object const * const shipO = NetworkIdManager::getObjectById(*i); - ServerObject const * const shipSO = shipO ? shipO->asServerObject() : NULL; - ShipObject const * const ship = shipSO ? shipSO->asShipObject() : NULL; + ServerObject const * const shipSO = shipO ? shipO->asServerObject() : nullptr; + ShipObject const * const ship = shipSO ? shipSO->asShipObject() : nullptr; if(ship) { ContainedByProperty const * const contained = ship->getContainedByProperty(); - Object const * const containerO = contained ? contained->getContainedBy() : NULL; - ServerObject const * const container = containerO ? containerO->asServerObject() : NULL; + Object const * const containerO = contained ? contained->getContainedBy() : nullptr; + ServerObject const * const container = containerO ? containerO->asServerObject() : nullptr; if(container) { DynamicVariableList const & shipControlDeviceObjVars = container->getObjVars(); @@ -1665,14 +1665,14 @@ void PlayerCreatureController::handleMessage (const int message, const float val { MessageQueueCyberneticsChangeRequest const * const msg = dynamic_cast(data); NOT_NULL(msg); - if (msg != NULL) + if (msg != nullptr) { CreatureObject * const owner = NON_NULL(getCreature()); if(owner) { NetworkId const & npcId = msg->getTarget(); Object * const o = NetworkIdManager::getObjectById(npcId); - ServerObject * const so = o ? o->asServerObject() : NULL; + ServerObject * const so = o ? o->asServerObject() : nullptr; if(so) { Controller * const npcController = so->getController(); @@ -1696,10 +1696,10 @@ void PlayerCreatureController::handleMessage (const int message, const float val case CM_spaceMiningSaleSellResource: { MessageQueueSpaceMiningSellResource const * const msg = dynamic_cast(data); - if (msg != NULL) + if (msg != nullptr) { ServerObject * const spaceStation = safe_cast(NetworkIdManager::getObjectById(msg->m_spaceStationId)); - if (NULL == spaceStation) + if (nullptr == spaceStation) { WARNING(true, ("PlayerCreatureController CM_spaceMiningSaleSellResource invalid station [%s]", msg->m_spaceStationId.getValueString().c_str())); } @@ -1784,7 +1784,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val DictionaryValueMap::const_iterator itr = valueMap.find(minigameResultTargetName); - if(itr != valueMap.end() && itr->second != NULL) + if(itr != valueMap.end() && itr->second != nullptr) { if(itr->second->getType() == ValueTypeObjId::ms_type) { @@ -1798,7 +1798,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(tableOid, @@ -1859,7 +1859,7 @@ void PlayerCreatureController::handleMessage (const int message, const float val params.addParam(paramsDict, "taskDictionary"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(owner->getNetworkId(), diff --git a/engine/server/library/serverGame/src/shared/controller/PlayerShipController.cpp b/engine/server/library/serverGame/src/shared/controller/PlayerShipController.cpp index 6350d91b..921e3980 100755 --- a/engine/server/library/serverGame/src/shared/controller/PlayerShipController.cpp +++ b/engine/server/library/serverGame/src/shared/controller/PlayerShipController.cpp @@ -295,10 +295,10 @@ void PlayerShipController::handleMessage(int const message, float const value, M case CM_spaceMiningSaleSellResource: { MessageQueueSpaceMiningSellResource const * const msg = dynamic_cast(data); - if (msg != NULL) + if (msg != nullptr) { ServerObject * const spaceStation = safe_cast(NetworkIdManager::getObjectById(msg->m_spaceStationId)); - if (NULL == spaceStation) + if (nullptr == spaceStation) { WARNING(true, ("PlayerCreatureController CM_spaceMiningSaleSellResource invalid station [%s]", msg->m_spaceStationId.getValueString().c_str())); } @@ -376,16 +376,16 @@ float PlayerShipController::realAlter(float const elapsedTime) if (owner && owner->isInitialized()) { - if (m_pendingDockingBehavior != NULL) + if (m_pendingDockingBehavior != nullptr) { delete m_dockingBehavior; m_dockingBehavior = m_pendingDockingBehavior; - m_pendingDockingBehavior = NULL; + m_pendingDockingBehavior = nullptr; getShipOwner()->setCondition(static_cast(TangibleObject::C_docking)); Client * const client = owner->getClient(); - if (client != NULL) + if (client != nullptr) { ShipClientUpdateTracker::queueForUpdate(*client, *owner); } @@ -395,16 +395,16 @@ float PlayerShipController::realAlter(float const elapsedTime) } } - if ( (m_dockingBehavior != NULL) + if ( (m_dockingBehavior != nullptr) && m_dockingBehavior->isDockFinished()) { delete m_dockingBehavior; - m_dockingBehavior = NULL; + m_dockingBehavior = nullptr; getShipOwner()->clearCondition(static_cast(TangibleObject::C_docking)); } - if (m_dockingBehavior != NULL) + if (m_dockingBehavior != nullptr) { //-- The docking behavior will calculate new values for m_yaw/m_pitch/m_roll/m_throttle[Position] implicitly through calling ShipController members m_dockingBehavior->alter(elapsedTime); @@ -806,7 +806,7 @@ void PlayerShipController::setWeaponIndexPlayerControlled(int const weaponIndex, { DEBUG_FATAL((weaponIndex < 0), ("Invalid weaponIndex(%d)", weaponIndex)); - if (m_turretTargetingSystem != NULL) + if (m_turretTargetingSystem != nullptr) { safe_cast(m_turretTargetingSystem)->setWeaponIndexPlayerControlled(weaponIndex, playerControlled); } diff --git a/engine/server/library/serverGame/src/shared/controller/ServerController.cpp b/engine/server/library/serverGame/src/shared/controller/ServerController.cpp index bd5ffc3f..535341e6 100755 --- a/engine/server/library/serverGame/src/shared/controller/ServerController.cpp +++ b/engine/server/library/serverGame/src/shared/controller/ServerController.cpp @@ -55,7 +55,7 @@ CellProperty const * getCell(Object const * obj) { - if(obj == NULL) return NULL; + if(obj == nullptr) return nullptr; return obj->getCellProperty(); } @@ -74,7 +74,7 @@ Vector movePointBetweenCells ( Object const * oldCellObject, Object const * new Transform toWorld = Transform::identity; Transform toCell = Transform::identity; - if(oldCellObject != NULL) + if(oldCellObject != nullptr) { CellProperty const * oldCell = getCell(oldCellObject); @@ -84,7 +84,7 @@ Vector movePointBetweenCells ( Object const * oldCellObject, Object const * new } } - if(newCellObject != NULL) + if(newCellObject != nullptr) { CellProperty const * newCell = getCell(newCellObject); @@ -115,7 +115,7 @@ Transform moveTransformBetweenCells ( Object const * oldCellObject, Object const Transform toWorld = Transform::identity; Transform toCell = Transform::identity; - if(oldCellObject != NULL) + if(oldCellObject != nullptr) { CellProperty const * oldCell = getCell(oldCellObject); @@ -125,7 +125,7 @@ Transform moveTransformBetweenCells ( Object const * oldCellObject, Object const } } - if(newCellObject != NULL) + if(newCellObject != nullptr) { CellProperty const * newCell = getCell(newCellObject); @@ -220,7 +220,7 @@ void ServerController::setAuthoritative(bool newAuthoritative) { if (!newAuthoritative && m_bHasGoal && m_goalCellObject) { - m_goalCellObject = NULL; + m_goalCellObject = nullptr; m_bHasGoal = false; m_bAtGoal = true; } @@ -420,7 +420,7 @@ bool changeCells(ServerObject &object, ServerObject *newCellObject) // ---------- - if (newCellObject == NULL) + if (newCellObject == nullptr) { // Object was in a cell and is moving to the world, transfer from cell container to world @@ -428,7 +428,7 @@ bool changeCells(ServerObject &object, ServerObject *newCellObject) Transform const &newTransform = oldCellObject->getTransform_o2w().rotateTranslate_l2p(objectTransform); Container::ContainerErrorCode tmp = Container::CEC_Success; - result = ContainerInterface::transferItemToWorld(object, newTransform, NULL, tmp); + result = ContainerInterface::transferItemToWorld(object, newTransform, nullptr, tmp); if (!result) { @@ -444,13 +444,13 @@ bool changeCells(ServerObject &object, ServerObject *newCellObject) CellProperty * const pCell = ContainerInterface::getCell(*newCellObject); - DEBUG_REPORT_LOG(pCell == NULL, ("changeCells - Received transform with parent to a non-cell object. This should only happen from the DB\n")); + DEBUG_REPORT_LOG(pCell == nullptr, ("changeCells - Received transform with parent to a non-cell object. This should only happen from the DB\n")); if (pCell) { Transform objectTransform = object.getTransform_o2p(); Container::ContainerErrorCode tmp = Container::CEC_Success; - result = ContainerInterface::transferItemToCell(*newCellObject, object, NULL, tmp); + result = ContainerInterface::transferItemToCell(*newCellObject, object, nullptr, tmp); if (!result) { @@ -537,7 +537,7 @@ void ServerController::handleNetUpdateTransform(const MessageQueueDataTransform& return; } - setGoal( message.getTransform(), NULL ); + setGoal( message.getTransform(), nullptr ); } //----------------------------------------------------------------------- @@ -566,7 +566,7 @@ void ServerController::handleNetUpdateTransformWithParent(const MessageQueueData #if 1 Transform start = Transform::identity; start.setPosition_p(ConfigServerGame::getStartingPosition()); - setGoal( start, NULL ); + setGoal( start, nullptr ); #endif return; } diff --git a/engine/server/library/serverGame/src/shared/controller/ShipController.cpp b/engine/server/library/serverGame/src/shared/controller/ShipController.cpp index 3367476d..312131a9 100755 --- a/engine/server/library/serverGame/src/shared/controller/ShipController.cpp +++ b/engine/server/library/serverGame/src/shared/controller/ShipController.cpp @@ -58,12 +58,12 @@ ShipController::ShipController(ShipObject * newOwner) : m_pitchPosition(0.0f), m_rollPosition(0.0f), m_throttlePosition(0.0f), - m_pendingDockingBehavior(NULL), - m_dockingBehavior(NULL), + m_pendingDockingBehavior(nullptr), + m_dockingBehavior(nullptr), m_attackTargetList(new AiShipAttackTargetList(newOwner)), m_attackTargetDecayTimer(new Timer(static_cast(s_maxTargetAge))), m_enemyCheckQueued(false), - m_turretTargetingSystem(NULL), + m_turretTargetingSystem(nullptr), m_dockedByList(new DockedByList), m_aiTargetingMeList(new CachedNetworkIdList) { @@ -77,7 +77,7 @@ ShipController::~ShipController() // The turret targeting system must be deleted before clearAiTargetingMeList(), because // otherwise it will try to acquire new targets as the list is being cleared delete m_turretTargetingSystem; - m_turretTargetingSystem = NULL; + m_turretTargetingSystem = nullptr; clearAiTargetingMeList(); @@ -85,9 +85,9 @@ ShipController::~ShipController() delete m_dockedByList; delete m_aiTargetingMeList; delete m_pendingDockingBehavior; - m_pendingDockingBehavior = NULL; + m_pendingDockingBehavior = nullptr; delete m_dockingBehavior; - m_dockingBehavior = NULL; + m_dockingBehavior = nullptr; delete m_attackTargetList; delete m_attackTargetDecayTimer; } @@ -226,7 +226,7 @@ void ShipController::handleMessage (const int message, const float value, const UNREF(flags); UNREF(value); ShipObject * const owner = getShipOwner(); - DEBUG_FATAL(!owner, ("Owner is NULL in ShipController::handleMessage\n")); + DEBUG_FATAL(!owner, ("Owner is nullptr in ShipController::handleMessage\n")); switch(message) { case CM_clientLookAtTarget: @@ -265,7 +265,7 @@ void ShipController::addTurretTargetingSystem(ShipTurretTargetingSystem * newSys void ShipController::removeTurretTargetingSystem() { delete m_turretTargetingSystem; - m_turretTargetingSystem = NULL; + m_turretTargetingSystem = nullptr; } // ---------------------------------------------------------------------- @@ -281,7 +281,7 @@ void ShipController::addDockedBy(Object const & unit) { IGNORE_RETURN(m_dockedByList->insert(CachedNetworkId(unit))); - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("ShipController::addDockedBy() owner(%s) dockedBy(%s) dockedByListSize(%u)", (getOwner() != NULL) ? getOwner()->getNetworkId().getValueString().c_str() : "NULL", unit.getNetworkId().getValueString().c_str(), m_dockedByList->size())); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("ShipController::addDockedBy() owner(%s) dockedBy(%s) dockedByListSize(%u)", (getOwner() != nullptr) ? getOwner()->getNetworkId().getValueString().c_str() : "nullptr", unit.getNetworkId().getValueString().c_str(), m_dockedByList->size())); } // ---------------------------------------------------------------------- @@ -294,7 +294,7 @@ void ShipController::removeDockedBy(Object const & unit) { m_dockedByList->erase(iterDockedByList); - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("ShipController::removeDockedBy() owner(%s) dockedBy(%s) dockedByListSize(%u)", (getOwner() != NULL) ? getOwner()->getNetworkId().getValueString().c_str() : "NULL", unit.getNetworkId().getValueString().c_str(), m_dockedByList->size())); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("ShipController::removeDockedBy() owner(%s) dockedBy(%s) dockedByListSize(%u)", (getOwner() != nullptr) ? getOwner()->getNetworkId().getValueString().c_str() : "nullptr", unit.getNetworkId().getValueString().c_str(), m_dockedByList->size())); } else { @@ -314,7 +314,7 @@ ShipController::DockedByList const & ShipController::getDockedByList() const void ShipController::addAiTargetingMe(NetworkId const & unit) { //LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("ShipController::addAiTargetingMe() owner(%s) unit(%s) m_aiTargetingMeList->size(%u+1)", getOwner()->getNetworkId().getValueString().c_str(), unit.getValueString().c_str(), m_aiTargetingMeList->size())); - DEBUG_FATAL((NetworkIdManager::getObjectById(unit) == NULL), ("ShipController::addAiTargetingMe() owner(%s) unit(%s) ERROR: The Ai who is targeting you is not a valid networkId", getOwner()->getNetworkId().getValueString().c_str(), unit.getValueString().c_str())); + DEBUG_FATAL((NetworkIdManager::getObjectById(unit) == nullptr), ("ShipController::addAiTargetingMe() owner(%s) unit(%s) ERROR: The Ai who is targeting you is not a valid networkId", getOwner()->getNetworkId().getValueString().c_str(), unit.getValueString().c_str())); // Make sure this is a valid networkId of an alive object @@ -346,11 +346,11 @@ void ShipController::removeAiTargetingMe(NetworkId const & unit) { ShipObject * const shipOwner = getShipOwner(); - if (shipOwner != NULL) + if (shipOwner != nullptr) { CreatureObject * const pilotOwner = CreatureObject::asCreatureObject(shipOwner->getPilot()); - if ( (pilotOwner != NULL) + if ( (pilotOwner != nullptr) && pilotOwner->isPlayerControlled()) { shipOwner->clearCondition(static_cast(TangibleObject::C_spaceCombatMusic)); @@ -442,7 +442,7 @@ bool ShipController::face(Vector const & goalPosition_w, float elapsedTime) bool useFastAxis = true; AiShipController const * const aiShipController = asAiShipController(); - if (aiShipController != NULL) + if (aiShipController != nullptr) { if ( (aiShipController->getShipClass() == ShipAiReactionManager::SC_capitalShip) || (aiShipController->getShipClass() == ShipAiReactionManager::SC_transport) @@ -620,7 +620,7 @@ float ShipController::getLargestTurnRadius() const ShipObject const * const shipObject = getShipOwner(); - if (shipObject != NULL) + if (shipObject != nullptr) { float const maxYawRate = shipObject->getShipActualYawRateMaximum(); float const maxPitchRate = shipObject->getShipActualPitchRateMaximum(); @@ -650,11 +650,11 @@ void ShipController::dock(ShipObject & dockTarget, float const secondsAtDock) void ShipController::unDock() { - if (m_pendingDockingBehavior != NULL) + if (m_pendingDockingBehavior != nullptr) { m_pendingDockingBehavior->unDock(); } - else if (m_dockingBehavior != NULL) + else if (m_dockingBehavior != nullptr) { m_dockingBehavior->unDock(); } @@ -664,14 +664,14 @@ void ShipController::unDock() bool ShipController::isDocking() const { - return (m_dockingBehavior != NULL) || (m_pendingDockingBehavior != NULL); + return (m_dockingBehavior != nullptr) || (m_pendingDockingBehavior != nullptr); } // ---------------------------------------------------------------------- bool ShipController::isDocked() const { - return ((m_dockingBehavior != NULL) && m_dockingBehavior->isDocked()); + return ((m_dockingBehavior != nullptr) && m_dockingBehavior->isDocked()); } // ---------------------------------------------------------------------- @@ -698,28 +698,28 @@ ShipController const * ShipController::asShipController() const PlayerShipController * ShipController::asPlayerShipController() { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- PlayerShipController const * ShipController::asPlayerShipController() const { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- AiShipController * ShipController::asAiShipController() { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- AiShipController const * ShipController::asAiShipController() const { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -736,7 +736,7 @@ bool ShipController::addDamageTaken(NetworkId const & attackingUnit, float const bool result = false; ShipObject * const attackingUnitShipObject = ShipObject::asShipObject(NetworkIdManager::getObjectById(attackingUnit)); - if ( (attackingUnitShipObject != NULL) + if ( (attackingUnitShipObject != nullptr) && !attackingUnitShipObject->isDamageAggroImmune()) { result = verifyAttacker ? Pvp::canAttack(*attackingUnitShipObject, *NON_NULL(getShipOwner())) : true; @@ -754,7 +754,7 @@ bool ShipController::addDamageTaken(NetworkId const & attackingUnit, float const bool ShipController::hasTurretTargetingSystem() const { - return (m_turretTargetingSystem != NULL); + return (m_turretTargetingSystem != nullptr); } // ---------------------------------------------------------------------- @@ -792,7 +792,7 @@ bool ShipController::removeAttackTarget(NetworkId const & unit) void ShipController::onAttackTargetChanged(NetworkId const & target) { - if (m_turretTargetingSystem != NULL) + if (m_turretTargetingSystem != nullptr) { m_turretTargetingSystem->onTargetChanged(target); } @@ -802,7 +802,7 @@ void ShipController::onAttackTargetChanged(NetworkId const & target) void ShipController::onAttackTargetLost(NetworkId const & target) { - if (m_turretTargetingSystem != NULL) + if (m_turretTargetingSystem != nullptr) { m_turretTargetingSystem->onTargetLost(target); } @@ -834,12 +834,12 @@ int ShipController::getNumberOfAiUnitsAttackingMe() const CachedNetworkId const & ai = (*iterAiTargetingMeList); Object const * const aiObject = ai.getObject(); - if (aiObject != NULL) + if (aiObject != nullptr) { ShipController const * const shipController = aiObject->getController()->asShipController(); - AiShipController const * const aiShipController = (shipController != NULL) ? shipController->asAiShipController() : NULL; + AiShipController const * const aiShipController = (shipController != nullptr) ? shipController->asAiShipController() : nullptr; - if (aiShipController != NULL) + if (aiShipController != nullptr) { if (aiShipController->getPrimaryAttackTarget() == getOwner()->getNetworkId()) { @@ -849,7 +849,7 @@ int ShipController::getNumberOfAiUnitsAttackingMe() const } else { - DEBUG_WARNING(true, ("ShipController::getNumberOfAiShipAttackingMe() ERROR: Why am I(%s) being targeted by a NULL object(%s)?", getOwner()->getDebugInformation().c_str(), ai.getValueString().c_str())); + DEBUG_WARNING(true, ("ShipController::getNumberOfAiShipAttackingMe() ERROR: Why am I(%s) being targeted by a nullptr object(%s)?", getOwner()->getDebugInformation().c_str(), ai.getValueString().c_str())); } } @@ -910,11 +910,11 @@ void ShipController::clearAiTargetingMeList() { CachedNetworkId const & id = (*iterPurgeList); - if (id.getObject() != NULL) + if (id.getObject() != nullptr) { ShipController * const shipController = id.getObject()->getController()->asShipController(); - if (shipController != NULL) + if (shipController != nullptr) { IGNORE_RETURN(shipController->removeAttackTarget(getOwner()->getNetworkId())); } diff --git a/engine/server/library/serverGame/src/shared/controller/TangibleController.cpp b/engine/server/library/serverGame/src/shared/controller/TangibleController.cpp index d4e90806..ee670607 100755 --- a/engine/server/library/serverGame/src/shared/controller/TangibleController.cpp +++ b/engine/server/library/serverGame/src/shared/controller/TangibleController.cpp @@ -222,7 +222,7 @@ void TangibleController::handleMessage (const int message, const float value, co case CM_addHate: { const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); - WARNING((msg == NULL), ("TangibleController::handleMessage(CM_addHate) The message data should never be NULL")); + WARNING((msg == nullptr), ("TangibleController::handleMessage(CM_addHate) The message data should never be nullptr")); if(msg) { @@ -233,7 +233,7 @@ void TangibleController::handleMessage (const int message, const float value, co case CM_setHate: { const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); - WARNING((msg == NULL), ("TangibleController::handleMessage(CM_setHate) The message data should never be NULL")); + WARNING((msg == nullptr), ("TangibleController::handleMessage(CM_setHate) The message data should never be nullptr")); if(msg) { @@ -244,7 +244,7 @@ void TangibleController::handleMessage (const int message, const float value, co case CM_removeHateTarget: { const MessageQueueGenericValueType * const msg = safe_cast *>(data); - WARNING((msg == NULL), ("TangibleController::handleMessage(CM_removeHateTarget) The message data should never be NULL")); + WARNING((msg == nullptr), ("TangibleController::handleMessage(CM_removeHateTarget) The message data should never be nullptr")); if(msg) { @@ -265,7 +265,7 @@ void TangibleController::handleMessage (const int message, const float value, co case CM_forceHateTarget: { const MessageQueueGenericValueType * const msg = safe_cast *>(data); - WARNING((msg == NULL), ("TangibleController::handleMessage(CM_removeHateTarget) The message data should never be NULL")); + WARNING((msg == nullptr), ("TangibleController::handleMessage(CM_removeHateTarget) The message data should never be nullptr")); if(msg) { @@ -276,9 +276,9 @@ void TangibleController::handleMessage (const int message, const float value, co case CM_autoExpireHateListTargetEnabled: { const MessageQueueGenericValueType * const msg = safe_cast *>(data); - WARNING((msg == NULL), ("TangibleController::handleMessage(CM_setHateListExpireTargetEnabled) The message data should never be NULL")); + WARNING((msg == nullptr), ("TangibleController::handleMessage(CM_setHateListExpireTargetEnabled) The message data should never be nullptr")); - if (msg != NULL) + if (msg != nullptr) { owner->setHateListAutoExpireTargetEnabled(msg->getValue()); } @@ -315,7 +315,7 @@ void TangibleController::handleMessage (const int message, const float value, co if(object) { ServerObject * transferer = safe_cast(NetworkIdManager::getObjectById(msg->getValue().second)); - // transferer is allowed to be null + // transferer is allowed to be nullptr owner->addObjectToOutputSlot(*object, transferer); } } @@ -576,7 +576,7 @@ void TangibleController::handleMessage (const int message, const float value, co case CM_addUserToAccessList: { MessageQueueGenericValueType > const *msg = safe_cast > const *>(data); - WARNING((msg == NULL), ("TangibleController::handleMessage(CM_addUserToAccessList) The message data should never be NULL")); + WARNING((msg == nullptr), ("TangibleController::handleMessage(CM_addUserToAccessList) The message data should never be nullptr")); if(msg) { @@ -590,7 +590,7 @@ void TangibleController::handleMessage (const int message, const float value, co case CM_removeUserFromAccessList: { MessageQueueGenericValueType > const *msg = safe_cast > const *>(data); - WARNING((msg == NULL), ("TangibleController::handleMessage(CM_removeUserFromAccessList) The message data should never be NULL")); + WARNING((msg == nullptr), ("TangibleController::handleMessage(CM_removeUserFromAccessList) The message data should never be nullptr")); if(msg) { @@ -722,14 +722,14 @@ TangibleController const * TangibleController::asTangibleController() const AiTurretController * TangibleController::asAiTurretController() { - return NULL; + return nullptr; } //---------------------------------------------------------------------- AiTurretController const * TangibleController::asAiTurretController() const { - return NULL; + return nullptr; } //======================================================================== diff --git a/engine/server/library/serverGame/src/shared/core/AttribModNameManager.cpp b/engine/server/library/serverGame/src/shared/core/AttribModNameManager.cpp index 8cf03ed4..f2104fad 100755 --- a/engine/server/library/serverGame/src/shared/core/AttribModNameManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/AttribModNameManager.cpp @@ -24,7 +24,7 @@ namespace AttribModNameManagerNamespace std::set unknownCrcs; } -AttribModNameManager * AttribModNameManager::ms_attribModNameManager = NULL; +AttribModNameManager * AttribModNameManager::ms_attribModNameManager = nullptr; //======================================================================== @@ -65,8 +65,8 @@ AttribModNameManager::~AttribModNameManager() { delete m_names; delete m_crcMap; - m_names = NULL; - m_crcMap = NULL; + m_names = nullptr; + m_crcMap = nullptr; } // AttribModNameManager::~AttribModNameManager // ---------------------------------------------------------------------- @@ -76,7 +76,7 @@ AttribModNameManager::~AttribModNameManager() */ void AttribModNameManager::install() { - if (ms_attribModNameManager == NULL) + if (ms_attribModNameManager == nullptr) { ms_attribModNameManager = new AttribModNameManager; ExitChain::add(AttribModNameManager::remove, "AttribModNameManager::remove"); @@ -90,10 +90,10 @@ void AttribModNameManager::install() */ void AttribModNameManager::remove() { - if (ms_attribModNameManager != NULL) + if (ms_attribModNameManager != nullptr) { delete ms_attribModNameManager; - ms_attribModNameManager = NULL; + ms_attribModNameManager = nullptr; } } // AttribModNameManager::remove @@ -263,7 +263,7 @@ void AttribModNameManager::sendAllNamesToServer(std::vector const & serv * * @param crc the crc value to look up * - * @return the attrib mod name, or NULL if there was no name for the crc + * @return the attrib mod name, or nullptr if there was no name for the crc */ const char * AttribModNameManager::getAttribModName(uint32 crc) const { @@ -277,7 +277,7 @@ const char * AttribModNameManager::getAttribModName(uint32 crc) const ServerClock::getInstance().getServerFrame())); AttribModNameManagerNamespace::unknownCrcs.insert(crc); } - return NULL; + return nullptr; } // AttribModNameManager::getAttribModName // ---------------------------------------------------------------------- @@ -350,7 +350,7 @@ void AttribModNameManager::getAttribModNamesFromBase(uint32 base, std::vector & names) const { const char * baseName = getAttribModName(base); - if (baseName != NULL) + if (baseName != nullptr) getAttribModNamesFromBase(baseName, names); } // AttribModNameManager::getAttribModNamesFromBase @@ -366,7 +366,7 @@ void AttribModNameManager::getAttribModCrcsFromBase(uint32 base, std::vector & crcs) const { const char * baseName = getAttribModName(base); - if (baseName != NULL) + if (baseName != nullptr) getAttribModCrcsFromBase(baseName, crcs); } // AttribModNameManager::getAttribModCrcsFromBase diff --git a/engine/server/library/serverGame/src/shared/core/BiographyManager.cpp b/engine/server/library/serverGame/src/shared/core/BiographyManager.cpp index 6febe92c..6996f5fc 100755 --- a/engine/server/library/serverGame/src/shared/core/BiographyManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/BiographyManager.cpp @@ -133,7 +133,7 @@ void BiographyManager::deleteBiography(const NetworkId &owner) DEBUG_FATAL(!m_installed, ("BioManager not installed")); - BiographyMessage const msg(owner,NULL); + BiographyMessage const msg(owner,nullptr); GameServer::getInstance().sendToDatabaseServer(msg); // Save off the bio for viewing by other players diff --git a/engine/server/library/serverGame/src/shared/core/CharacterMatchManager.cpp b/engine/server/library/serverGame/src/shared/core/CharacterMatchManager.cpp index ce305b38..89668966 100755 --- a/engine/server/library/serverGame/src/shared/core/CharacterMatchManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/CharacterMatchManager.cpp @@ -55,7 +55,7 @@ namespace CharacterMatchManagerNamespace // used when invoking LfgDataTable::LfgNode::internalAttributeMatchFunction struct LfgInternalAttributeMatchFunctionParams { - LfgInternalAttributeMatchFunctionParams() : param1(NULL), param2(NULL), param3(NULL), param4(NULL), param5(NULL) {} + LfgInternalAttributeMatchFunctionParams() : param1(nullptr), param2(nullptr), param3(nullptr), param4(nullptr), param5(nullptr) {} void const * param1; void const * param2; @@ -151,8 +151,8 @@ bool CharacterMatchManagerNamespace::isMatch(std::map(NetworkIdManager::getObjectById(networkId)); - Client * const requestClient = (requestServerObject ? requestServerObject->getClient() : NULL); - CreatureObject * const requestCreatureObject = (requestServerObject ? requestServerObject->asCreatureObject() : NULL); - PlayerObject * const requestPlayerObject = (requestCreatureObject ? PlayerCreatureController::getPlayerObject(requestCreatureObject) : NULL); + Client * const requestClient = (requestServerObject ? requestServerObject->getClient() : nullptr); + CreatureObject * const requestCreatureObject = (requestServerObject ? requestServerObject->asCreatureObject() : nullptr); + PlayerObject * const requestPlayerObject = (requestCreatureObject ? PlayerCreatureController::getPlayerObject(requestCreatureObject) : nullptr); if (requestCreatureObject && requestPlayerObject && requestClient) { @@ -210,10 +210,10 @@ void CharacterMatchManager::requestMatch(NetworkId const &networkId, MatchMaking } // if "friend" is one of the search criteria, this will contain the requester's friends list - PlayerObject::StringVector const * requestPlayerObjectSortedLowercaseFriendList = NULL; + PlayerObject::StringVector const * requestPlayerObjectSortedLowercaseFriendList = nullptr; // if "cts_source_galaxy" is one of the search criteria, this will contain the requester's CTS source galaxy list - std::set const * requestPlayerObjectCtsSourceGalaxy = NULL; + std::set const * requestPlayerObjectCtsSourceGalaxy = nullptr; // if "in_same_guild" is one of the search criteria, this will contain the requester's guild abbrev bool inSameGuildSearch = false; @@ -224,7 +224,7 @@ void CharacterMatchManager::requestMatch(NetworkId const &networkId, MatchMaking std::string requestPlayerObjectCitizenOfCity; // if "cts_source_galaxy" is one of the search criteria, this will contain the list of matching CTS source galaxy - std::vector * matchingCtsSourceGalaxy = NULL; + std::vector * matchingCtsSourceGalaxy = nullptr; // allows search of characters marked anonymous bool bypassAnonymous = false; @@ -271,7 +271,7 @@ void CharacterMatchManager::requestMatch(NetworkId const &networkId, MatchMaking // special handling for "friend" search attribute if (iterLeafNode->second->name == "friend") { - if (requestPlayerObjectSortedLowercaseFriendList == NULL) + if (requestPlayerObjectSortedLowercaseFriendList == nullptr) { requestPlayerObjectSortedLowercaseFriendList = &(requestPlayerObject->getSortedLowercaseFriendList()); } @@ -284,7 +284,7 @@ void CharacterMatchManager::requestMatch(NetworkId const &networkId, MatchMaking // special handling for "cts_source_galaxy" search attribute else if (iterLeafNode->second->name == "cts_source_galaxy") { - if (requestPlayerObjectCtsSourceGalaxy == NULL) + if (requestPlayerObjectCtsSourceGalaxy == nullptr) { std::map const & connectedCharacterLfgData = ServerUniverse::getConnectedCharacterLfgData(); std::map::const_iterator iterFindLfg = connectedCharacterLfgData.find(networkId); @@ -292,7 +292,7 @@ void CharacterMatchManager::requestMatch(NetworkId const &networkId, MatchMaking requestPlayerObjectCtsSourceGalaxy = &(iterFindLfg->second.ctsSourceGalaxy); } - if (matchingCtsSourceGalaxy == NULL) + if (matchingCtsSourceGalaxy == nullptr) matchingCtsSourceGalaxy = new std::vector; LfgInternalAttributeMatchFunctionParams params; @@ -421,7 +421,7 @@ void CharacterMatchManager::requestMatch(NetworkId const &networkId, MatchMaking } else { - ConsoleMgr::broadcastString("(NULL) (All)", requestClient); + ConsoleMgr::broadcastString("(nullptr) (All)", requestClient); } for (std::vector >::const_iterator iterSearchAttribute = iterAnyAllParentNode->second.begin(); iterSearchAttribute != iterAnyAllParentNode->second.end(); ++iterSearchAttribute) @@ -544,7 +544,7 @@ void CharacterMatchManager::requestMatch(NetworkId const &networkId, MatchMaking if (lfgCharacterData.groupId.isValid() && (mmcr.m_matchingCharacterGroup.count(lfgCharacterData.groupId) == 0)) { ServerObject const * const soGroupObject = safe_cast(NetworkIdManager::getObjectById(lfgCharacterData.groupId)); - GroupObject const * const groupObject = (soGroupObject ? soGroupObject->asGroupObject() : NULL); + GroupObject const * const groupObject = (soGroupObject ? soGroupObject->asGroupObject() : nullptr); if (groupObject) { std::vector & groupInfo = mmcr.m_matchingCharacterGroup[lfgCharacterData.groupId]; diff --git a/engine/server/library/serverGame/src/shared/core/Client.cpp b/engine/server/library/serverGame/src/shared/core/Client.cpp index ab4e4e97..cdef65db 100755 --- a/engine/server/library/serverGame/src/shared/core/Client.cpp +++ b/engine/server/library/serverGame/src/shared/core/Client.cpp @@ -263,8 +263,8 @@ Client::Client(ConnectionServerConnection & connection, const NetworkId & charac { // Don't ever put the character into a packed house ServerObject * const serverObject = containerObject->asServerObject(); - CellObject * const cellObject = (serverObject ? serverObject->asCellObject() : NULL); - BuildingObject * const buildingObject = (cellObject ? cellObject->getOwnerBuilding() : NULL); + CellObject * const cellObject = (serverObject ? serverObject->asCellObject() : nullptr); + BuildingObject * const buildingObject = (cellObject ? cellObject->getOwnerBuilding() : nullptr); if ((buildingObject) && (!buildingObject->isInWorld())) { @@ -713,8 +713,8 @@ void Client::receiveClientMessage(const GameNetworkMessage & message) SlottedContainer const * const slottedContainer = ContainerInterface::getSlottedContainer(*containedBy); ShipObject * const shipObject = ShipObject::getContainingShipObject(containedBy); - if ( (shipObject != NULL) - && (slottedContainer != NULL) + if ( (shipObject != nullptr) + && (slottedContainer != nullptr) && !shipObject->hasCondition(TangibleObject::C_docking)) { bool shotOk = false; @@ -958,7 +958,7 @@ void Client::receiveClientMessage(const GameNetworkMessage & message) const ObjectMenuSelectMessage m (ri); ServerObject * const target = safe_cast(NetworkIdManager::getObjectById (m.getNetworkId())); GameScriptObject * const scriptObject = target ? target->getScriptObject() : 0; - Object * const targetContainedBy = target ? ContainerInterface::getContainedByObject(*target) : NULL; + Object * const targetContainedBy = target ? ContainerInterface::getContainedByObject(*target) : nullptr; const int menuType = m.getSelectedItemId(); static int examineMenuType = RadialMenuManager::getMenuTypeByName("EXAMINE"); @@ -1080,7 +1080,7 @@ void Client::receiveClientMessage(const GameNetworkMessage & message) { // apply the controller message ServerController * controller = dynamic_cast(target->getController()); - if (controller != NULL) + if (controller != nullptr) { uint32 flags = o.getFlags(); flags &= ~GameControllerMessageFlags::SOURCE_REMOTE; @@ -1096,7 +1096,7 @@ void Client::receiveClientMessage(const GameNetworkMessage & message) if (target) { ServerController * controller = dynamic_cast(target->getController()); - if (controller != NULL) + if (controller != nullptr) { uint32 flags = o.getFlags(); flags &= ~GameControllerMessageFlags::SOURCE_REMOTE; @@ -1315,11 +1315,11 @@ void Client::receiveClientMessage(const GameNetworkMessage & message) { CreatureObject *creatureObject = dynamic_cast(getCharacterObject()); - if (creatureObject != NULL) + if (creatureObject != nullptr) { GameScriptObject *gameScriptObject = creatureObject->getScriptObject(); - if(gameScriptObject != NULL) + if(gameScriptObject != nullptr) { ScriptParams scriptParams; IGNORE_RETURN(gameScriptObject->trigAllScripts(Scripting::TRIG_STOMACH_UPDATE, scriptParams)); @@ -1964,7 +1964,7 @@ void Client::receiveClientMessage(const GameNetworkMessage & message) GenericValueTypeMessage > > const msgPlayTimeInfo(readIterator); PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(safe_cast(getCharacterObject())); - if (playerObject != NULL) + if (playerObject != nullptr) { playerObject->setSessionPlayTimeInfo(msgPlayTimeInfo.getValue().first, msgPlayTimeInfo.getValue().second.first, msgPlayTimeInfo.getValue().second.second); } @@ -2222,7 +2222,7 @@ void Client::addObserving(ServerObject* o) { IGNORE_RETURN(m_observing.insert(o)); TangibleObject *to = o->asTangibleObject(); - if (to && PvpUpdateObserver::satisfyPvpSyncCondition(to->isNonPvpObject(), to->hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (o->asCreatureObject() != NULL), to->getPvpFaction())) + if (to && PvpUpdateObserver::satisfyPvpSyncCondition(to->isNonPvpObject(), to->hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (o->asCreatureObject() != nullptr), to->getPvpFaction())) addObservingPvpSync(to); } } diff --git a/engine/server/library/serverGame/src/shared/core/ClusterWideDataClient.cpp b/engine/server/library/serverGame/src/shared/core/ClusterWideDataClient.cpp index a0c10d82..ddf92605 100755 --- a/engine/server/library/serverGame/src/shared/core/ClusterWideDataClient.cpp +++ b/engine/server/library/serverGame/src/shared/core/ClusterWideDataClient.cpp @@ -115,7 +115,7 @@ bool ClusterWideDataClient::handleMessage(const MessageDispatch::Emitter &, cons // locate the callback object ClusterWideDataClientNamespace::CallbackObjectIdList::iterator iter = ClusterWideDataClientNamespace::callbackObjectIdList.find(msg.getRequestId()); - ServerObject * object = NULL; + ServerObject * object = nullptr; if (iter != ClusterWideDataClientNamespace::callbackObjectIdList.end()) object = dynamic_cast(NetworkIdManager::getObjectById(iter->second)); diff --git a/engine/server/library/serverGame/src/shared/core/CombatTracker.cpp b/engine/server/library/serverGame/src/shared/core/CombatTracker.cpp index 3c0882b9..ed0b1ffd 100755 --- a/engine/server/library/serverGame/src/shared/core/CombatTracker.cpp +++ b/engine/server/library/serverGame/src/shared/core/CombatTracker.cpp @@ -45,7 +45,7 @@ void CombatTracker::getInterestedViewers(TangibleObject const *defender, std::ve AICreatureController const * const defenderAiCreatureController = AICreatureController::asAiCreatureController(defender->getController()); bool const defenderIsInWorldCell = defender->isInWorldCell(); - if (defenderAiCreatureController != NULL) + if (defenderAiCreatureController != nullptr) { ServerWorld::findObjectsInRange(defender->getPosition_w(), defenderAiCreatureController->getAssistRadius(), unfilteredViewers); @@ -54,7 +54,7 @@ void CombatTracker::getInterestedViewers(TangibleObject const *defender, std::ve bool interested = true; ServerObject const * const serverObject = *i; - if ( (serverObject == NULL) + if ( (serverObject == nullptr) || (serverObject == defender) || serverObject->isPlayerControlled() || !serverObject->wantSawAttackTriggers()) @@ -65,7 +65,7 @@ void CombatTracker::getInterestedViewers(TangibleObject const *defender, std::ve { TangibleObject const * const tangibleObject = serverObject->asTangibleObject(); - if (tangibleObject != NULL) + if (tangibleObject != nullptr) { if ( tangibleObject->isInCombat() || tangibleObject->isDisabled() @@ -77,7 +77,7 @@ void CombatTracker::getInterestedViewers(TangibleObject const *defender, std::ve { CreatureObject const * const creatureObject = tangibleObject->asCreatureObject(); - if (creatureObject != NULL) + if (creatureObject != nullptr) { if ( creatureObject->isIncapacitated() || creatureObject->isDead()) @@ -88,7 +88,7 @@ void CombatTracker::getInterestedViewers(TangibleObject const *defender, std::ve { AICreatureController const * const aiCreatureController = AICreatureController::asAiCreatureController(creatureObject->getController()); - if (aiCreatureController != NULL) + if (aiCreatureController != nullptr) { if (aiCreatureController->isRetreating()) { @@ -138,7 +138,7 @@ void CombatTracker::update() { TangibleObject const * const attackerTangibleObject = TangibleObject::asTangibleObject(iterAttackers->getObject()); - if (attackerTangibleObject != NULL) + if (attackerTangibleObject != nullptr) { localAttackers.push_back(attackerTangibleObject->getNetworkId()); } @@ -158,7 +158,7 @@ void CombatTracker::update() ServerObject * const combatViewer = *iterCombatViewers; GameScriptObject * const gameScriptObject = GameScriptObject::asGameScriptObject(combatViewer); - if (gameScriptObject != NULL) + if (gameScriptObject != nullptr) { ScriptParams scriptParams; scriptParams.addParam(defender->getNetworkId()); diff --git a/engine/server/library/serverGame/src/shared/core/CommunityManager.cpp b/engine/server/library/serverGame/src/shared/core/CommunityManager.cpp index dc479216..cc7f46e5 100755 --- a/engine/server/library/serverGame/src/shared/core/CommunityManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/CommunityManager.cpp @@ -42,14 +42,14 @@ using namespace CommunityManagerNameSpace; //----------------------------------------------------------------------------- PlayerObject *CommunityManagerNameSpace::getPlayerObject(NetworkId const &networkId) { - PlayerObject *result = NULL; + PlayerObject *result = nullptr; Object *object = NetworkIdManager::getObjectById(networkId); - if (object != NULL) + if (object != nullptr) { CreatureObject *creatureObject = dynamic_cast(object); - if (creatureObject != NULL) + if (creatureObject != nullptr) { result = PlayerCreatureController::getPlayerObject(creatureObject); } @@ -61,10 +61,10 @@ PlayerObject *CommunityManagerNameSpace::getPlayerObject(NetworkId const &networ //----------------------------------------------------------------------------- ServerObject *CommunityManagerNameSpace::getServerObject(NetworkId const &networkId) { - ServerObject *result = NULL; + ServerObject *result = nullptr; Object *object = NetworkIdManager::getObjectById(networkId); - if (object != NULL) + if (object != nullptr) { result = dynamic_cast(object); } @@ -77,11 +77,11 @@ void CommunityManagerNameSpace::sendProseChatMessage(NetworkId const &networkId, { Object *object = NetworkIdManager::getObjectById(networkId); - if (object != NULL) + if (object != nullptr) { ServerObject *serverObject = dynamic_cast(object); - if (serverObject != NULL) + if (serverObject != nullptr) { ProsePackage prosePackage; prosePackage.stringId = stringId; @@ -117,7 +117,7 @@ void CommunityManager::handleMessage(ChatOnChangeFriendStatus const &message) PlayerObject *playerObject = getPlayerObject(message.getCharacter()); - if (playerObject != NULL) + if (playerObject != nullptr) { if (message.getAdd()) { @@ -170,7 +170,7 @@ void CommunityManager::handleMessage(ChatOnGetFriendsList const &message) PlayerObject *playerObject = getPlayerObject(message.getCharacter()); - if (playerObject != NULL) + if (playerObject != nullptr) { typedef std::vector StringVector; StringVector friendList; @@ -231,7 +231,7 @@ void CommunityManager::handleMessage(ChatOnChangeIgnoreStatus const &message) PlayerObject *playerObject = getPlayerObject(message.getCharacter()); - if (playerObject != NULL) + if (playerObject != nullptr) { if (message.getIgnore()) { @@ -284,7 +284,7 @@ void CommunityManager::handleMessage(ChatOnGetIgnoreList const &message) PlayerObject *playerObject = getPlayerObject(message.getCharacter()); - if (playerObject != NULL) + if (playerObject != nullptr) { typedef std::vector StringVector; StringVector ignoreList; diff --git a/engine/server/library/serverGame/src/shared/core/ConfigServerGame.cpp b/engine/server/library/serverGame/src/shared/core/ConfigServerGame.cpp index cc5f64d9..03a9061f 100755 --- a/engine/server/library/serverGame/src/shared/core/ConfigServerGame.cpp +++ b/engine/server/library/serverGame/src/shared/core/ConfigServerGame.cpp @@ -528,10 +528,10 @@ void ConfigServerGame::install(void) // GCW score decay time(s) data->gcwScoreDecayTime.clear(); int index = 0; - char const * dayOfWeek = NULL; - char const * hour = NULL; - char const * minute = NULL; - char const * second = NULL; + char const * dayOfWeek = nullptr; + char const * hour = nullptr; + char const * minute = nullptr; + char const * second = nullptr; do { dayOfWeek = ConfigFile::getKeyString("GameServer", "gcwScoreDecayTimeDayOfWeek", index, 0); diff --git a/engine/server/library/serverGame/src/shared/core/ConfigServerGame.h b/engine/server/library/serverGame/src/shared/core/ConfigServerGame.h index 20465d94..0426f519 100755 --- a/engine/server/library/serverGame/src/shared/core/ConfigServerGame.h +++ b/engine/server/library/serverGame/src/shared/core/ConfigServerGame.h @@ -87,7 +87,7 @@ class ConfigServerGame int scriptWatcherInterruptTime; // time in ms (after scriptWatcherWarnTime) before we abort a script int scriptStackErrorLimit; // depth of stack error we assume to be a legit error int scriptStackErrorLevel; // how we handle a stack error: 0=recover, 1=javacore, 2=fatal - bool disableObjvarNullCheck; // flag to disable the check for a null object when get/setting objvars + bool disableObjvarNullCheck; // flag to disable the check for a nullptr object when get/setting objvars // throttle to limit how universe data is sent from // the universe game server to the other game servers; diff --git a/engine/server/library/serverGame/src/shared/core/ContainerInterface.cpp b/engine/server/library/serverGame/src/shared/core/ContainerInterface.cpp index 2fa62423..fdd5c6f2 100755 --- a/engine/server/library/serverGame/src/shared/core/ContainerInterface.cpp +++ b/engine/server/library/serverGame/src/shared/core/ContainerInterface.cpp @@ -68,7 +68,7 @@ namespace ContainerInterfaceNamespace if (creature->getBank() == lastContainer) { - //-- if player is passed in non-null, the found creature must match it + //-- if player is passed in non-nullptr, the found creature must match it if (player && player != creature) return false; @@ -340,8 +340,8 @@ namespace ContainerInterfaceNamespace { // This item is not contained by anything! // This means it is in the world! - // Return null for the source container, but succeed. - sourceContainer = NULL; + // Return nullptr for the source container, but succeed. + sourceContainer = nullptr; return true; } @@ -550,7 +550,7 @@ bool ContainerInterface::canTransferTo(ServerObject *destination, ServerObject & if (transfererCreatureObject->getObjVars().getItem("lotOverlimit.structure_id", lotOverlimitStructure) && lotOverlimitStructure.isValid()) { // determine the destination type - ServerObject const * topmostDestinationParent = NULL; + ServerObject const * topmostDestinationParent = nullptr; ServerObject const * destinationParent = destination; while (destinationParent) { @@ -734,8 +734,8 @@ bool ContainerInterface::transferItemToSlottedContainer(ServerObject &destinatio } } - ServerObject *sourceObject = NULL; - Container *sourceContainer = NULL; + ServerObject *sourceObject = nullptr; + Container *sourceContainer = nullptr; if (!sharedTransferBegin(item, sourceObject, sourceContainer, error)) return false; @@ -829,8 +829,8 @@ bool ContainerInterface::transferItemToVolumeContainer(ServerObject &destination { error = Container::CEC_Success; - ServerObject *sourceObject = NULL; - Container *sourceContainer = NULL; + ServerObject *sourceObject = nullptr; + Container *sourceContainer = nullptr; if (!sharedTransferBegin(item, sourceObject, sourceContainer, error)) return false; @@ -898,8 +898,8 @@ bool ContainerInterface::transferItemToCell(ServerObject &destination, ServerObj { error = Container::CEC_Success; - ServerObject *sourceObject = NULL; - Container *sourceContainer = NULL; + ServerObject *sourceObject = nullptr; + Container *sourceContainer = nullptr; //check source & item if (!sharedTransferBegin(item, sourceObject, sourceContainer, error)) @@ -980,13 +980,13 @@ bool ContainerInterface::transferItemToWorld(ServerObject &item, Transform const return false; } - if (!canTransferTo(NULL, item, transferer, error)) + if (!canTransferTo(nullptr, item, transferer, error)) { return false; } - ServerObject *sourceObject = NULL; - Container *sourceContainer = NULL; + ServerObject *sourceObject = nullptr; + Container *sourceContainer = nullptr; if (!sharedTransferBegin(item, sourceObject, sourceContainer, error)) { @@ -1009,8 +1009,8 @@ bool ContainerInterface::transferItemToWorld(ServerObject &item, Transform const item.setTransform_o2p(pos); - item.onContainerTransferComplete(sourceObject, NULL); - handleTransferScripts(item, sourceObject, NULL, transferer, error); + item.onContainerTransferComplete(sourceObject, nullptr); + handleTransferScripts(item, sourceObject, nullptr, transferer, error); return true; } @@ -1084,7 +1084,7 @@ Object *ContainerInterface::getContainedByObject(Object &obj) ContainedByProperty * const containedBy = getContainedByProperty(obj); if (containedBy) return containedBy->getContainedBy(); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -1094,7 +1094,7 @@ Object const *ContainerInterface::getContainedByObject(Object const &obj) ContainedByProperty const * const containedBy = getContainedByProperty(obj); if (containedBy) return containedBy->getContainedBy(); - return NULL; + return nullptr; } // ----------------------------------------------------------------------- @@ -1180,7 +1180,7 @@ Object const *ContainerInterface::getTopmostContainer(Object const &obj) // ----------------------------------------------------------------------- // Returns the object if it is in the world, or the first parent of the object -// that is in the world. This returns null, if the none of the parents of the object are in the world. +// that is in the world. This returns nullptr, if the none of the parents of the object are in the world. Object *ContainerInterface::getFirstParentInWorld(Object &obj) { @@ -1193,20 +1193,20 @@ Object *ContainerInterface::getFirstParentInWorld(Object &obj) if (!containedBy) { WARNING_STRICT_FATAL(true, ("All objects should have a containedby property")); - return NULL; + return nullptr; } // Is my containedBy property empty? If so I am topmost but am not in the world Object *currentContainer = containedBy->getContainedBy(); if (!currentContainer) { - return NULL; + return nullptr; } - // Does my parent expose contents? If it does, then return NULL since I have been removed from the world. + // Does my parent expose contents? If it does, then return nullptr since I have been removed from the world. if (!getContainer(*currentContainer) || getContainer(*currentContainer)->isContentItemExposedWith(*currentContainer)) { - return NULL; + return nullptr; } // Is my parent in the world? If so, he is topmost @@ -1218,7 +1218,7 @@ Object *ContainerInterface::getFirstParentInWorld(Object &obj) if (!containedBy) { WARNING_STRICT_FATAL(true, ("All objects should have a containedby property")); - return (currentContainer->isInWorld()) ? currentContainer : NULL; + return (currentContainer->isInWorld()) ? currentContainer : nullptr; } // Iterate from here. @@ -1236,12 +1236,12 @@ Object *ContainerInterface::getFirstParentInWorld(Object &obj) if (!containedBy) { WARNING_STRICT_FATAL(true, ("All objects should have a containedby property")); - return NULL; + return nullptr; } nextContainer = containedBy->getContainedBy(); } - return currentContainer->isInWorld() ? currentContainer : NULL; + return currentContainer->isInWorld() ? currentContainer : nullptr; } // ----------------------------------------------------------------------- @@ -1388,7 +1388,7 @@ bool ContainerInterface::onObjectDestroy(ServerObject& item) // currently only c return false; } - handleTransferScripts(item, parentObject, NULL, NULL, error); + handleTransferScripts(item, parentObject, nullptr, nullptr, error); } } return true; diff --git a/engine/server/library/serverGame/src/shared/core/FormManagerServer.cpp b/engine/server/library/serverGame/src/shared/core/FormManagerServer.cpp index 5a1c4b15..7fc312fa 100755 --- a/engine/server/library/serverGame/src/shared/core/FormManagerServer.cpp +++ b/engine/server/library/serverGame/src/shared/core/FormManagerServer.cpp @@ -101,7 +101,7 @@ void FormManagerServer::handleCreateObjectData(NetworkId const & actor, std::str Transform tr; tr.setPosition_p(position); ServerObject * const newObject = ServerWorld::createNewObject(crc, tr, cell, false); - if (newObject == NULL) + if (newObject == nullptr) return; if (cellId == NetworkId::cms_invalid) @@ -114,7 +114,7 @@ void FormManagerServer::handleCreateObjectData(NetworkId const & actor, std::str { //tell script to create the object in it's own special manner (since the datatable requests that) Object * const obj = NetworkIdManager::getObjectById(actor); - ServerObject * const serverObj = obj ? obj->asServerObject() : NULL; + ServerObject * const serverObj = obj ? obj->asServerObject() : nullptr; if(serverObj) { std::vector keys; @@ -151,11 +151,11 @@ void FormManagerServer::handleEditObjectData(NetworkId const & actor, NetworkId return; Object * const actorObj = NetworkIdManager::getObjectById(actor); - ServerObject * const actorServerObj = actorObj ? actorObj->asServerObject() : NULL; + ServerObject * const actorServerObj = actorObj ? actorObj->asServerObject() : nullptr; if(actorServerObj) { Object * const objectToEditObj = NetworkIdManager::getObjectById(objectToEdit); - ServerObject * const objectToEditServerObj = objectToEditObj ? objectToEditObj->asServerObject() : NULL; + ServerObject * const objectToEditServerObj = objectToEditObj ? objectToEditObj->asServerObject() : nullptr; if(objectToEditServerObj) { //get matching form @@ -207,11 +207,11 @@ void FormManagerServer::handleEditObjectData(NetworkId const & actor, NetworkId void FormManagerServer::requestEditObjectDataForClient(NetworkId const & actor, NetworkId const & objectToEdit) { Object * const actorObj = NetworkIdManager::getObjectById(actor); - ServerObject * const actorServerObj = actorObj ? actorObj->asServerObject() : NULL; + ServerObject * const actorServerObj = actorObj ? actorObj->asServerObject() : nullptr; if(actorServerObj) { Object * const objectToEditObj = NetworkIdManager::getObjectById(objectToEdit); - ServerObject * const objectToEditServerObj = objectToEditObj ? objectToEditObj->asServerObject() : NULL; + ServerObject * const objectToEditServerObj = objectToEditObj ? objectToEditObj->asServerObject() : nullptr; if(objectToEditServerObj) { //get matching form @@ -277,8 +277,8 @@ void FormManagerServer::sendEditObjectDataToClient(NetworkId const & client, Net return; Object * const playerObject = NetworkIdManager::getObjectById(client); - ServerObject * const playerServer = playerObject ? playerObject->asServerObject() : NULL; - CreatureObject * const playerCreature = playerServer ? playerServer->asCreatureObject() : NULL; + ServerObject * const playerServer = playerObject ? playerObject->asServerObject() : nullptr; + CreatureObject * const playerCreature = playerServer ? playerServer->asCreatureObject() : nullptr; if(playerCreature) { diff --git a/engine/server/library/serverGame/src/shared/core/GameServer.cpp b/engine/server/library/serverGame/src/shared/core/GameServer.cpp index 865b1078..30af19ef 100755 --- a/engine/server/library/serverGame/src/shared/core/GameServer.cpp +++ b/engine/server/library/serverGame/src/shared/core/GameServer.cpp @@ -317,11 +317,11 @@ namespace GameServerNamespace bool getConfigSetting(const char *section, const char *key, int & value) { const ConfigFile::Section * sec = ConfigFile::getSection(section); - if (sec == NULL) + if (sec == nullptr) return false; const ConfigFile::Key * ky = sec->findKey(key); - if (ky == NULL) + if (ky == nullptr) return false; value = ky->getAsInt(ky->getCount()-1, value); @@ -753,7 +753,7 @@ Client * GameServer::getClient(const NetworkId& networkId) { return i->second; } - return NULL; + return nullptr; } //----------------------------------------------------------------------- @@ -837,7 +837,7 @@ void GameServer::loadTerrain () terrainObject->setDebugName("terrain"); Appearance * const appearance = AppearanceTemplateList::createAppearance(terrainFileName); - if (appearance != NULL) { + if (appearance != nullptr) { terrainObject->setAppearance(appearance); } else { DEBUG_WARNING(true, ("FIX ME: Appearance template for GameServer::loadTerrain missing for %s.", terrainFileName)); @@ -866,7 +866,7 @@ void GameServer::shutdown() m_centralService = 0; m_planetServerConnection = 0; - if (m_customerServiceServerConnection != NULL) + if (m_customerServiceServerConnection != nullptr) { m_customerServiceServerConnection->disconnect(); } @@ -909,7 +909,7 @@ void GameServer::receiveMessage(const MessageDispatch::Emitter & source, const M DEBUG_REPORT_LOG(true, ("GameServer: Creating customer service server connection @ (%s:%d)\n", address.getValue().first.c_str(), address.getValue().second)); - if (m_customerServiceServerConnection != NULL) + if (m_customerServiceServerConnection != nullptr) { m_customerServiceServerConnection->disconnect(); } @@ -949,7 +949,7 @@ void GameServer::receiveMessage(const MessageDispatch::Emitter & source, const M std::vector const & baselines = m.getData(); - ServerObject * lastObject = NULL; + ServerObject * lastObject = nullptr; for (std::vector::const_iterator i=baselines.begin(); i!=baselines.end(); ++i) { @@ -1286,7 +1286,7 @@ void GameServer::receiveMessage(const MessageDispatch::Emitter & source, const M if (topmostContainer != object) { - WARNING(true, ("Denying authority transfer for (%s) from game server (%lu) to game server (%lu) because it is contained by (%s)", object->getDebugInformation().c_str(), GameServer::getInstance().getProcessId(), t.getProcess(), (topmostContainer ? topmostContainer->getDebugInformation().c_str() : "NULL"))); + WARNING(true, ("Denying authority transfer for (%s) from game server (%lu) to game server (%lu) because it is contained by (%s)", object->getDebugInformation().c_str(), GameServer::getInstance().getProcessId(), t.getProcess(), (topmostContainer ? topmostContainer->getDebugInformation().c_str() : "nullptr"))); allowed = false; @@ -1425,11 +1425,11 @@ void GameServer::receiveMessage(const MessageDispatch::Emitter & source, const M bool appended = false; ServerObject * const target = safe_cast(NetworkIdManager::getObjectById(c.getNetworkId())); - if (target != NULL) + if (target != nullptr) { // valid target, get its controller ServerController * const controller = safe_cast(target->getController()); - if (controller != NULL) + if (controller != nullptr) { uint32 flags = c.getFlags(); if(flags & GameControllerMessageFlags::DEST_AUTH_SERVER) @@ -1473,7 +1473,7 @@ void GameServer::receiveMessage(const MessageDispatch::Emitter & source, const M ri = static_cast(message).getByteStream().begin(); EndBaselinesMessage const t(ri); ServerObject * const object = ServerWorld::findUninitializedObjectByNetworkId(t.getId()); - if (object != NULL) + if (object != nullptr) { DEBUG_REPORT_LOG(ConfigServerGame::getLogObjectLoading(), ("Received EndBaselinesMessage for %s\n", t.getId().getValueString().c_str())); ServerController * const controller = dynamic_cast(object->getController()); @@ -1778,7 +1778,7 @@ void GameServer::receiveMessage(const MessageDispatch::Emitter & source, const M } else { - LOG("mounts-bug", ("GS::SceneTransferMessage: server id=[%d],rider id=[%s] has RidingMount state but getMountedCreature() returns NULL.", static_cast(getProcessId()), obj->getNetworkId().getValueString().c_str())); + LOG("mounts-bug", ("GS::SceneTransferMessage: server id=[%d],rider id=[%s] has RidingMount state but getMountedCreature() returns nullptr.", static_cast(getProcessId()), obj->getNetworkId().getValueString().c_str())); objAsCreature->emergencyDismountForRider(); } } @@ -2297,7 +2297,7 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const if (creatureObj->isAuthoritative()) { AICreatureController const * const aiCreatureController = AICreatureController::asAiCreatureController(creatureObj->getController()); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { continue; } @@ -2359,7 +2359,7 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const #endif std::string time = FormattedString<1024>().sprintf("(%3d,%5dms) %30s.%-2lu (%3lu) on %35s:%-7d (%lu) ", ObjectTracker::getNumPlayers(), static_cast(Clock::frameTime()*1000), ServerWorld::getSceneId().c_str(), m_preloadAreaId, m_processId, hostName.c_str(), Os::getProcessId(), ServerClock::getInstance().getGameTimeSeconds()); - time += CalendarTime::convertEpochToTimeStringGMT(::time(NULL)); + time += CalendarTime::convertEpochToTimeStringGMT(::time(nullptr)); GenericValueTypeMessage > > rsctr( "ReportSystemClockTimeResponse", std::make_pair(msg.getValue().first, std::make_pair(time, msg.getValue().second))); @@ -2378,7 +2378,7 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const ri = static_cast(message).getByteStream().begin(); GenericValueTypeMessage > const msg(ri); - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); std::string time = FormattedString<1024>().sprintf("%30s.%-2lu (%3lu) (%lu) (%ld, ", ServerWorld::getSceneId().c_str(), m_preloadAreaId, m_processId, ServerClock::getInstance().getGameTimeSeconds(), timeNow); time += CalendarTime::convertEpochToTimeStringGMT(timeNow); time += ")"; @@ -2404,7 +2404,7 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const } else { - time += " (terrainObject is NULL)"; + time += " (terrainObject is nullptr)"; } GenericValueTypeMessage > > rptr( @@ -2596,7 +2596,7 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const bool removeCurrentCitizenDeleted; bool removeCurrentCitizenInactive; bool hasDeclaredResidence; - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); bool const citizenInactivePackupActive = (ConfigServerGame::getCityCitizenshipInactivePackupStartTimeEpoch() <= timeNow); std::map, CitizenInfo> const & allCitizens = CityInterface::getAllCitizensInfo(); for (std::map >::iterator iterCityId = s_clusterStartupResidenceStructureListByCity.begin(); iterCityId != s_clusterStartupResidenceStructureListByCity.end(); ++iterCityId) @@ -2614,7 +2614,7 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const if (currentCityMayor.isValid()) currentCityMayorCitizenInfo = CityInterface::getCitizenInfo(iterCityId->first, currentCityMayor); else - currentCityMayorCitizenInfo = NULL; + currentCityMayorCitizenInfo = nullptr; if (currentCityMayorCitizenInfo) currentCityMayorName = currentCityMayorCitizenInfo->m_citizenName; @@ -2958,7 +2958,7 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const ScriptDictionaryPtr dictionary; responseObject->getScriptObject()->makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(responseObject->getNetworkId(), "foundObject", dictionary->getSerializedData(), 0, false); @@ -3140,11 +3140,11 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const CreatureObject * const creatureObject = CreatureObject::getCreatureObject(networkId); - if (creatureObject != NULL) + if (creatureObject != nullptr) { Controller * const controller = creatureObject->getController(); - if (controller != NULL) + if (controller != nullptr) { DEBUG_LOG("debug_ai", ("GameServer::receiveMessage() Received AiCreatureStateMessage for networkId(%s) movementType(%s)", networkId.getValueString().c_str(), AiMovementBase::getMovementString(movement.getMovementType()))); @@ -3211,7 +3211,7 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); PlayedTimeAccumMessage const ptam(ri); Object * obj = NetworkIdManager::getObjectById(ptam.getNetworkId()); - if (obj != NULL && obj->asServerObject() != NULL && obj->asServerObject()->asCreatureObject() != NULL) + if (obj != nullptr && obj->asServerObject() != nullptr && obj->asServerObject()->asCreatureObject() != nullptr) { CreatureObject * target = obj->asServerObject()->asCreatureObject(); PlayerObject *targetPlayer = target->asPlayerObject(); @@ -3260,13 +3260,13 @@ void GameServer::receiveMessage2(const MessageDispatch::Emitter & source, const // get the attacker Object * obj = NetworkIdManager::getObjectById(msg.getSource()); - if (obj != NULL && obj->asServerObject() != NULL && obj->asServerObject()->asCreatureObject() != NULL) + if (obj != nullptr && obj->asServerObject() != nullptr && obj->asServerObject()->asCreatureObject() != nullptr) { CreatureObject * attacker = obj->asServerObject()->asCreatureObject(); // get the target obj = NetworkIdManager::getObjectById(msg.getTarget()); - if (obj != NULL && obj->asServerObject() != NULL && obj->asServerObject()->asTangibleObject() != NULL) + if (obj != nullptr && obj->asServerObject() != nullptr && obj->asServerObject()->asTangibleObject() != nullptr) { TangibleObject * defender = obj->asServerObject()->asTangibleObject(); if (attacker->isAuthoritative()) @@ -3597,7 +3597,7 @@ bool GameServer::isPlanetEnabledForCluster(std::string const &sceneName) const void GameServerNamespace::broadCastHyperspaceOnWarp(ServerObject const * const owner) { - // warpingClient can be NULL if the owner is AI + // warpingClient can be nullptr if the owner is AI Client const * const warpingClient = owner->getClient(); typedef std::map > DistributionList; @@ -4098,13 +4098,13 @@ void GameServer::sendToConnectionServers(GameNetworkMessage const &message) void GameServer::sendToCustomerServiceServer(GameNetworkMessage const &message) { - if (m_customerServiceServerConnection != NULL) + if (m_customerServiceServerConnection != nullptr) { m_customerServiceServerConnection->send(message, true); } else { - REPORT_LOG(true, ("GameServer::sendToCustomerServiceServer() ERROR: Unable to send to NULL customer service server connection\n")); + REPORT_LOG(true, ("GameServer::sendToCustomerServiceServer() ERROR: Unable to send to nullptr customer service server connection\n")); } } @@ -4112,12 +4112,12 @@ void GameServer::sendToCustomerServiceServer(GameNetworkMessage const &message) void GameServer::clearCustomerServiceServerConnection() { - if (m_customerServiceServerConnection != NULL) + if (m_customerServiceServerConnection != nullptr) { m_customerServiceServerConnection->disconnect(); } - m_customerServiceServerConnection = NULL; + m_customerServiceServerConnection = nullptr; } // ---------------------------------------------------------------------- @@ -4600,7 +4600,7 @@ void GameServer::handleCharacterCreateNameVerification(const VerifyNameResponse { Container::ContainedItem itemId = container->getObjectInSlot(slot, tmp); Object* appearanceInventory = itemId.getObject(); - if(appearanceInventory == NULL) + if(appearanceInventory == nullptr) { WARNING(true, ("Player %s has lost their appearance inventory", newCharacterObject->getNetworkId().getValueString().c_str())); appearanceInventory = ServerWorld::createNewObject(s_appearanceTemplate, *newCharacterObject, slot, false); @@ -4663,7 +4663,7 @@ void GameServer::handleVerifyAndLockNameVerification(const VerifyNameResponse &v params.addParam(errorText.c_str(), "reason"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(vrn.getCharacterId(), "renameCharacterNameValidationFail", dictionary->getSerializedData(), 0, false); @@ -4943,7 +4943,7 @@ bool GameServer::addPendingLoadRequest(NetworkId const & id) if (s_pendingLoadRequests.find(id) != s_pendingLoadRequests.end()) return false; - s_pendingLoadRequests[id] = (unsigned int)::time(NULL); + s_pendingLoadRequests[id] = (unsigned int)::time(nullptr); return true; } @@ -5113,11 +5113,11 @@ void GameServerNamespace::loadRetroactiveCtsHistory() { int index = 0; - char const * pszCtsDataFromConfig = NULL; + char const * pszCtsDataFromConfig = nullptr; do { - pszCtsDataFromConfig = ConfigFile::getKeyString("GameServer", "retroactiveCtsHistory", index++, NULL); - if (pszCtsDataFromConfig != NULL) + pszCtsDataFromConfig = ConfigFile::getKeyString("GameServer", "retroactiveCtsHistory", index++, nullptr); + if (pszCtsDataFromConfig != nullptr) { ctsDataFromConfig.push_back(pszCtsDataFromConfig); } @@ -5196,7 +5196,7 @@ void GameServerNamespace::loadRetroactiveCtsHistory() else { ctsDataFromConfigTokens.clear(); - if ((Unicode::tokenize(Unicode::narrowToWide(*iterCtsDataFromConfig), ctsDataFromConfigTokens, &ctsDataFromConfigDelimiter, NULL)) && (ctsDataFromConfigTokens.size() == 7)) + if ((Unicode::tokenize(Unicode::narrowToWide(*iterCtsDataFromConfig), ctsDataFromConfigTokens, &ctsDataFromConfigDelimiter, nullptr)) && (ctsDataFromConfigTokens.size() == 7)) { // sanity check ctsDataFromConfigParsedData = FormattedString<2048>().sprintf("%s|%s|%s|%s|%s|%s|%s", Unicode::wideToNarrow(ctsDataFromConfigTokens[0]).c_str(), Unicode::wideToNarrow(ctsDataFromConfigTokens[1]).c_str(), Unicode::wideToNarrow(ctsDataFromConfigTokens[2]).c_str(), Unicode::wideToNarrow(ctsDataFromConfigTokens[3]).c_str(), Unicode::wideToNarrow(ctsDataFromConfigTokens[4]).c_str(), Unicode::wideToNarrow(ctsDataFromConfigTokens[5]).c_str(), Unicode::wideToNarrow(ctsDataFromConfigTokens[6]).c_str()); @@ -5225,7 +5225,7 @@ void GameServerNamespace::loadRetroactiveCtsHistory() FATAL(((sourceCharacterInfo.sourceCharacterBornDate > 0) && (sourceCharacterInfo.sourceCharacterBornDate < 907)), ("source character (%s, %s) has born date (%d) < 907", sourceCharacterInfo.sourceCluster.c_str(), sourceCharacterInfo.sourceCharacterId.getValueString().c_str(), sourceCharacterInfo.sourceCharacterBornDate)); FATAL((sourceCharacterInfo.sourceCharacterBornDate > currentBornDate), ("source character (%s, %s) has born date (%d) > current born date (%d)", sourceCharacterInfo.sourceCluster.c_str(), sourceCharacterInfo.sourceCharacterId.getValueString().c_str(), sourceCharacterInfo.sourceCharacterBornDate, currentBornDate)); - std::map > * clusterCtsHistory = NULL; + std::map > * clusterCtsHistory = nullptr; #ifdef _DEBUG IGNORE_RETURN(allCtsSourceCluster.insert(sourceCharacterInfo.sourceCluster)); clusterCtsHistory = &(s_retroactiveCtsHistoryList[targetCluster]); @@ -5381,11 +5381,11 @@ void GameServerNamespace::loadRetroactivePlayerCityCreationTime() { int index = 0; - char const * pszPlayerCityCreationTimeDataFromConfig = NULL; + char const * pszPlayerCityCreationTimeDataFromConfig = nullptr; do { - pszPlayerCityCreationTimeDataFromConfig = ConfigFile::getKeyString("GameServer", "retroactivePlayerCityCreationTime", index++, NULL); - if (pszPlayerCityCreationTimeDataFromConfig != NULL) + pszPlayerCityCreationTimeDataFromConfig = ConfigFile::getKeyString("GameServer", "retroactivePlayerCityCreationTime", index++, nullptr); + if (pszPlayerCityCreationTimeDataFromConfig != nullptr) { playerCityCreationTimeDataFromConfig.push_back(pszPlayerCityCreationTimeDataFromConfig); } @@ -5427,7 +5427,7 @@ void GameServerNamespace::loadRetroactivePlayerCityCreationTime() else { playerCityCreationTimeDataFromConfigTokens.clear(); - if ((Unicode::tokenize(Unicode::narrowToWide(*iterPlayerCityCreationTimeDataFromConfig), playerCityCreationTimeDataFromConfigTokens, &playerCityCreationTimeDataFromConfigDelimiter, NULL)) && (playerCityCreationTimeDataFromConfigTokens.size() == 3)) + if ((Unicode::tokenize(Unicode::narrowToWide(*iterPlayerCityCreationTimeDataFromConfig), playerCityCreationTimeDataFromConfigTokens, &playerCityCreationTimeDataFromConfigDelimiter, nullptr)) && (playerCityCreationTimeDataFromConfigTokens.size() == 3)) { // sanity check playerCityCreationTimeDataFromConfigParsedData = FormattedString<2048>().sprintf("%s|%s|%s", Unicode::wideToNarrow(playerCityCreationTimeDataFromConfigTokens[0]).c_str(), Unicode::wideToNarrow(playerCityCreationTimeDataFromConfigTokens[1]).c_str(), Unicode::wideToNarrow(playerCityCreationTimeDataFromConfigTokens[2]).c_str()); @@ -5449,7 +5449,7 @@ void GameServerNamespace::loadRetroactivePlayerCityCreationTime() ++iterPlayerCityCreationTimeDataFromConfig; } - std::map * clusterPlayerCityCreationTimeHistory = NULL; + std::map * clusterPlayerCityCreationTimeHistory = nullptr; #ifdef _DEBUG clusterPlayerCityCreationTimeHistory = &(s_retroactivePlayerCityCreationTime[cluster]); #else @@ -5475,7 +5475,7 @@ void GameServerNamespace::loadRetroactivePlayerCityCreationTime() bool GameServerNamespace::checkAndSetOutstandingRequestSceneTransfer(ServerObject & object) { - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); // don't send multiple RequestSceneTransfer message if (object.getObjVars().hasItem(OBJVAR_HAS_OUTSTANDING_REQUEST_SCENE_TRANSFER) && (object.getObjVars().getType(OBJVAR_HAS_OUTSTANDING_REQUEST_SCENE_TRANSFER) == DynamicVariable::INT)) @@ -5846,7 +5846,7 @@ void GameServerNamespace::handleAccountFeatureIdResponse(AccountFeatureIdRespons std::string GameServer::getRetroactiveCtsHistory(std::string const & clusterName, NetworkId const & characterId) { std::string result; - std::map > const * clusterCtsHistory = NULL; + std::map > const * clusterCtsHistory = nullptr; #ifdef _DEBUG std::map > >::const_iterator const iterFindCluster = s_retroactiveCtsHistoryList.find(clusterName); @@ -5901,7 +5901,7 @@ void GameServer::setRetroactiveCtsHistory(CreatureObject & player) if (!playerObject->isAuthoritative()) return; - std::map > const * clusterCtsHistory = NULL; + std::map > const * clusterCtsHistory = nullptr; #ifdef _DEBUG std::map > >::const_iterator const iterFindCluster = s_retroactiveCtsHistoryList.find(GameServer::getInstance().getClusterName()); @@ -5990,7 +5990,7 @@ std::vector > const *> const static std::vector > const *> returnValue; returnValue.clear(); - std::map > const * clusterCtsHistory = NULL; + std::map > const * clusterCtsHistory = nullptr; #ifdef _DEBUG std::map > >::const_iterator const iterFindCluster = s_retroactiveCtsHistoryList.find(GameServer::getInstance().getClusterName()); @@ -6028,7 +6028,7 @@ std::vector > const *> const time_t GameServer::getRetroactivePlayerCityCreationTime(std::string const & clusterName, int cityId) { - std::map const * clusterPlayerCityCreationTimeHistory = NULL; + std::map const * clusterPlayerCityCreationTimeHistory = nullptr; #ifdef _DEBUG std::map >::const_iterator const iterFindCluster = s_retroactivePlayerCityCreationTime.find(clusterName); diff --git a/engine/server/library/serverGame/src/shared/core/GameServer.h b/engine/server/library/serverGame/src/shared/core/GameServer.h index c3036761..2723090a 100755 --- a/engine/server/library/serverGame/src/shared/core/GameServer.h +++ b/engine/server/library/serverGame/src/shared/core/GameServer.h @@ -92,10 +92,10 @@ public: uint32 getProcessId () const; uint32 getPreloadAreaId () const; virtual void receiveMessage (const MessageDispatch::Emitter & source, const MessageDispatch::MessageBase & message); - bool requestSceneWarp (const CachedNetworkId &objectId, const std::string &sceneName, const Vector &newPosition_w, const NetworkId &newContainer, const Vector &newPosition_p, const char * scriptCallback = NULL, bool forceLoadScreen = false); - bool requestSceneWarp (const CachedNetworkId &objectId, const std::string &sceneName, const Vector &newPosition_w, const NetworkId &newBuilding, const std::string &newCellName, const Vector &newPosition_p, const char * scriptCallback = NULL, bool forceLoadScreen = false); - bool requestSceneWarpDelayed (const CachedNetworkId &objectId, const std::string &sceneName, const Vector &newPosition_w, const NetworkId &newContainer, const Vector &newPosition_p, float delayTime, const char * scriptCallback = NULL, bool forceLoadScreen = false); - bool requestSceneWarpDelayed (const CachedNetworkId &objectId, const std::string &sceneName, const Vector &newPosition_w, const NetworkId &newBuilding, const std::string &newCellName, const Vector &newPosition_p, float delayTime, const char * scriptCallback = NULL, bool forceLoadScreen = false); + bool requestSceneWarp (const CachedNetworkId &objectId, const std::string &sceneName, const Vector &newPosition_w, const NetworkId &newContainer, const Vector &newPosition_p, const char * scriptCallback = nullptr, bool forceLoadScreen = false); + bool requestSceneWarp (const CachedNetworkId &objectId, const std::string &sceneName, const Vector &newPosition_w, const NetworkId &newBuilding, const std::string &newCellName, const Vector &newPosition_p, const char * scriptCallback = nullptr, bool forceLoadScreen = false); + bool requestSceneWarpDelayed (const CachedNetworkId &objectId, const std::string &sceneName, const Vector &newPosition_w, const NetworkId &newContainer, const Vector &newPosition_p, float delayTime, const char * scriptCallback = nullptr, bool forceLoadScreen = false); + bool requestSceneWarpDelayed (const CachedNetworkId &objectId, const std::string &sceneName, const Vector &newPosition_w, const NetworkId &newBuilding, const std::string &newCellName, const Vector &newPosition_p, float delayTime, const char * scriptCallback = nullptr, bool forceLoadScreen = false); static void run (); void sendToCentralServer (GameNetworkMessage const &message); diff --git a/engine/server/library/serverGame/src/shared/core/InstantDeleteList.cpp b/engine/server/library/serverGame/src/shared/core/InstantDeleteList.cpp index a96e6cfa..4e645492 100755 --- a/engine/server/library/serverGame/src/shared/core/InstantDeleteList.cpp +++ b/engine/server/library/serverGame/src/shared/core/InstantDeleteList.cpp @@ -20,7 +20,7 @@ // ====================================================================== -InstantDeleteList::ListType *InstantDeleteList::ms_theList = NULL; +InstantDeleteList::ListType *InstantDeleteList::ms_theList = nullptr; // ====================================================================== @@ -47,7 +47,7 @@ void InstantDeleteList::install() void InstantDeleteList::remove() { delete ms_theList; - ms_theList = NULL; + ms_theList = nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/core/LogoutTracker.cpp b/engine/server/library/serverGame/src/shared/core/LogoutTracker.cpp index 77454c88..5d49ac3a 100755 --- a/engine/server/library/serverGame/src/shared/core/LogoutTracker.cpp +++ b/engine/server/library/serverGame/src/shared/core/LogoutTracker.cpp @@ -87,7 +87,7 @@ void LogoutTracker::add(NetworkId const &networkId) } // set the callback - getScheduler().setCallback(handleLogoutCallback, NULL, ConfigServerGame::getUnsafeLogoutTimeMs()); + getScheduler().setCallback(handleLogoutCallback, nullptr, ConfigServerGame::getUnsafeLogoutTimeMs()); } // ---------------------------------------------------------------------- @@ -223,7 +223,7 @@ ServerObject *LogoutTracker::findPendingCharacterSave(const NetworkId &character return obj; } else - return NULL; + return nullptr; } // ====================================================================== diff --git a/engine/server/library/serverGame/src/shared/core/MessageToQueue.cpp b/engine/server/library/serverGame/src/shared/core/MessageToQueue.cpp index 005a6260..847b6ff6 100755 --- a/engine/server/library/serverGame/src/shared/core/MessageToQueue.cpp +++ b/engine/server/library/serverGame/src/shared/core/MessageToQueue.cpp @@ -88,7 +88,7 @@ namespace MessageToQueueNamespace typedef std::set SchedulerItemsType; typedef std::vector FrameMessagesType; - MessageToQueue * ms_instance=NULL; + MessageToQueue * ms_instance=nullptr; LastKnownLocationsType ms_lastKnownLocations; ObjectLocatorsType ms_objectLocators; SchedulerItemsType ms_schedulerItems; @@ -134,7 +134,7 @@ void MessageToQueue::install() void MessageToQueue::remove() { delete ms_instance; - ms_instance = NULL; + ms_instance = nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/core/NameManager.cpp b/engine/server/library/serverGame/src/shared/core/NameManager.cpp index 6366130f..65453d39 100755 --- a/engine/server/library/serverGame/src/shared/core/NameManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/NameManager.cpp @@ -27,7 +27,7 @@ // ====================================================================== -NameManager *NameManager::ms_instance = NULL; +NameManager *NameManager::ms_instance = nullptr; // ====================================================================== @@ -45,14 +45,14 @@ void NameManager::remove() { NOT_NULL(ms_instance); delete ms_instance; - ms_instance = NULL; + ms_instance = nullptr; } // ---------------------------------------------------------------------- NameManager::NameManager() : m_nameGenerators (new NameGeneratorMapType), - m_reservedNames (NULL), + m_reservedNames (nullptr), m_nameToIdMap (new NameToIdMapType), m_idToCharacterDataMap(new IdToCharacterDataMapType) { @@ -72,20 +72,20 @@ NameManager::~NameManager() delete i->second; } delete m_nameGenerators; - m_nameGenerators = NULL; + m_nameGenerators = nullptr; delete m_reservedNames; - m_reservedNames = NULL; + m_reservedNames = nullptr; delete m_nameToIdMap; - m_nameToIdMap = NULL; + m_nameToIdMap = nullptr; delete m_idToCharacterDataMap; - m_idToCharacterDataMap = NULL; + m_idToCharacterDataMap = nullptr; } // ---------------------------------------------------------------------- const NameGenerator & NameManager::getNameGenerator(const std::string &directory, const std::string &nameTable) const { - NameGenerator *generator=NULL; + NameGenerator *generator=nullptr; NOT_NULL(m_nameGenerators); NameGeneratorMapType::const_iterator i=m_nameGenerators->find(NameTableIdentifier(directory,nameTable)); if (i==m_nameGenerators->end()) @@ -204,7 +204,7 @@ void NameManager::addPlayer(const NetworkId &id, uint32 stationId, const std::st { createTime = static_cast(getPlayerCreateTime(id)); if (createTime <= 0) - createTime = ::time(NULL); + createTime = ::time(nullptr); } characterData.createTime = createTime; @@ -212,7 +212,7 @@ void NameManager::addPlayer(const NetworkId &id, uint32 stationId, const std::st { lastLoginTime = static_cast(getPlayerLastLoginTime(id)); if (lastLoginTime <= 0) - lastLoginTime = ::time(NULL); + lastLoginTime = ::time(nullptr); } characterData.lastLoginTime = lastLoginTime; @@ -382,7 +382,7 @@ void NameManager::getPlayerWithLastLoginTimeAfterDistribution(std::map >::iterator iter = result.begin(); iter != result.end(); ++iter) iter->second.second = 0; - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); for (IdToCharacterDataMapType::const_iterator i = m_idToCharacterDataMap->begin(); i != m_idToCharacterDataMap->end(); ++i) { int const lastLoginTimeSecondsAgo = std::max(static_cast(0), static_cast(timeNow - static_cast(i->second.lastLoginTime))); @@ -439,7 +439,7 @@ void NameManager::getPlayerWithCreateTimeAfterDistribution(std::map >::iterator iter = result.begin(); iter != result.end(); ++iter) iter->second.second = 0; - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); for (IdToCharacterDataMapType::const_iterator i = m_idToCharacterDataMap->begin(); i != m_idToCharacterDataMap->end(); ++i) { int const createTimeSecondsAgo = std::max(static_cast(0), static_cast(timeNow - static_cast(i->second.createTime))); diff --git a/engine/server/library/serverGame/src/shared/core/NewbieTutorial.cpp b/engine/server/library/serverGame/src/shared/core/NewbieTutorial.cpp index 4388ad2a..98fdebc8 100755 --- a/engine/server/library/serverGame/src/shared/core/NewbieTutorial.cpp +++ b/engine/server/library/serverGame/src/shared/core/NewbieTutorial.cpp @@ -257,10 +257,10 @@ void NewbieTutorial::getNonFreeObjectsForDeletion(const Container* const contain { const CachedNetworkId & itemId = *i; ServerObject * item = safe_cast(itemId.getObject()); - if (item != NULL) + if (item != nullptr) { TangibleObject *itemTangible = item->asTangibleObject(); - if (itemTangible != NULL) + if (itemTangible != nullptr) { const char *templateName = itemTangible->getSharedTemplateName(); if (!FileManifest::contains(templateName)) @@ -273,7 +273,7 @@ void NewbieTutorial::getNonFreeObjectsForDeletion(const Container* const contain { // see if the item is a container and go through its contents const Container * const itemContainer = ContainerInterface::getContainer(*item); - if (itemContainer != NULL) + if (itemContainer != nullptr) getNonFreeObjectsForDeletion(itemContainer, objectsToDelete, character); } } diff --git a/engine/server/library/serverGame/src/shared/core/NpcConversation.cpp b/engine/server/library/serverGame/src/shared/core/NpcConversation.cpp index bc457bbd..e3c56b3e 100755 --- a/engine/server/library/serverGame/src/shared/core/NpcConversation.cpp +++ b/engine/server/library/serverGame/src/shared/core/NpcConversation.cpp @@ -81,7 +81,7 @@ NpcConversation::NpcConversation(TangibleObject & player, TangibleObject & npc, NpcConversation::~NpcConversation() { TangibleObject * const player = safe_cast(m_player.getObject()); - if (player != NULL) + if (player != nullptr) { MessageQueueStopNpcConversation * const message = new MessageQueueStopNpcConversation; @@ -110,13 +110,13 @@ void NpcConversation::sendMessage(const Response & npcMessage, const Unicode::St TangibleObject * const player = safe_cast(m_player.getObject()); TangibleObject * const npc = safe_cast(m_npc.getObject()); - if (player == NULL) + if (player == nullptr) { - if (npc != NULL) + if (npc != nullptr) npc->removeConversation(m_player); return; } - if (npc == NULL) + if (npc == nullptr) { player->endNpcConversation(); return; @@ -216,13 +216,13 @@ void NpcConversation::sendResponses() const int count = static_cast(m_responses->size()); - if (player == NULL) + if (player == nullptr) { - if (npc != NULL) + if (npc != nullptr) npc->removeConversation(m_player); return; } - if (npc == NULL) + if (npc == nullptr) { player->endNpcConversation(); return; diff --git a/engine/server/library/serverGame/src/shared/core/ObserveTracker.cpp b/engine/server/library/serverGame/src/shared/core/ObserveTracker.cpp index 78fe2d74..95bc6594 100755 --- a/engine/server/library/serverGame/src/shared/core/ObserveTracker.cpp +++ b/engine/server/library/serverGame/src/shared/core/ObserveTracker.cpp @@ -353,14 +353,14 @@ void ObserveTracker::onObjectContainerChanged(ServerObject &obj) bool isObservedWith = (newContainer->getContainerProperty() ? newContainer->getContainerProperty()->isContentItemObservedWith(obj) : false); CellProperty * newContainerCell = newContainer->getCellProperty(); ServerObject const * newContainerContainer = safe_cast(ContainerInterface::getContainedByObject(*newContainer)); - if (newContainerCell == NULL || newContainerContainer != NULL) + if (newContainerCell == nullptr || newContainerContainer != nullptr) { std::set const &newObservers = newContainer->getObservers(); for (std::set::const_iterator i = newObservers.begin(); i != newObservers.end(); ++i) { if (isObservedWith || (*i)->getOpenedContainers().count(newContainer) || - (newContainerCell != NULL && shouldObserveCellContentsDueToClientContainmentChain(**i, *newContainerContainer))) + (newContainerCell != nullptr && shouldObserveCellContentsDueToClientContainmentChain(**i, *newContainerContainer))) { IGNORE_RETURN(observe(**i, obj)); } diff --git a/engine/server/library/serverGame/src/shared/core/PlayerCreationManagerServer.cpp b/engine/server/library/serverGame/src/shared/core/PlayerCreationManagerServer.cpp index 9b2d5d2e..62cc2fb3 100755 --- a/engine/server/library/serverGame/src/shared/core/PlayerCreationManagerServer.cpp +++ b/engine/server/library/serverGame/src/shared/core/PlayerCreationManagerServer.cpp @@ -122,7 +122,7 @@ bool PlayerCreationManagerServer::setupPlayer(CreatureObject & obj, const std::s else { //Attach insurance variables here: - if (item->asTangibleObject() != NULL) + if (item->asTangibleObject() != nullptr) item->asTangibleObject()->setUninsurable(true); } } @@ -204,7 +204,7 @@ bool PlayerCreationManagerServer::setupPlayer(CreatureObject & obj, const std::s for (size_t i = 0; i < numSkills; ++i) { const SkillObject * skill = SkillManager::getInstance().getSkill(bounty_skills[i]); - if (skill != NULL) + if (skill != nullptr) obj.grantSkill(*skill); } } diff --git a/engine/server/library/serverGame/src/shared/core/PositionUpdateTracker.cpp b/engine/server/library/serverGame/src/shared/core/PositionUpdateTracker.cpp index 5d95b59b..a28ee96b 100755 --- a/engine/server/library/serverGame/src/shared/core/PositionUpdateTracker.cpp +++ b/engine/server/library/serverGame/src/shared/core/PositionUpdateTracker.cpp @@ -122,7 +122,7 @@ bool PositionUpdateTracker::shouldSendPositionUpdate(ServerObject const &obj) return false; ServerObject const *containedByObj = safe_cast(ContainerInterface::getContainedByObject(obj)); - CreatureObject const *creatureContainer = (containedByObj ? containedByObj->asCreatureObject() : NULL); + CreatureObject const *creatureContainer = (containedByObj ? containedByObj->asCreatureObject() : nullptr); bool const objectIsRidingMount = (creatureContainer && creatureContainer->isMountable()); if (containedByObj && !isContainerConsideredPersisted(obj, *containedByObj) && !objectIsRidingMount) @@ -204,7 +204,7 @@ void PositionUpdateTracker::sendPositionUpdate(ServerObject &obj) else { ServerObject const * const container = safe_cast(ContainerInterface::getContainedByObject(obj)); - CreatureObject const * const creatureContainer = (container ? container->asCreatureObject() : NULL); + CreatureObject const * const creatureContainer = (container ? container->asCreatureObject() : nullptr); if (creatureContainer && creatureContainer->isMountable()) { // Riders of mounts persist at the location of the mount diff --git a/engine/server/library/serverGame/src/shared/core/RegexList.cpp b/engine/server/library/serverGame/src/shared/core/RegexList.cpp index 5244818e..29c7ae32 100755 --- a/engine/server/library/serverGame/src/shared/core/RegexList.cpp +++ b/engine/server/library/serverGame/src/shared/core/RegexList.cpp @@ -55,7 +55,7 @@ RegexList::Entry::Entry(char const *pattern, bool matchWords, char const *reason char const *errorString = 0; int errorOffset = 0; - m_pcre = pcre_compile(pattern, 0, &errorString, &errorOffset, NULL); + m_pcre = pcre_compile(pattern, 0, &errorString, &errorOffset, nullptr); WARNING(!m_pcre, ("failed to compile regex pattern [%s] into a pcre regex.", pattern)); } @@ -175,7 +175,7 @@ bool RegexList::doesStringMatch(const Unicode::String &name, std::string &ruleDe std::vector::iterator nameIter; for (nameIter = names.begin(); nameIter != names.end(); ++nameIter) { - int const returnCode = pcre_exec(compiledRegex, NULL, nameIter->c_str(), nameIter->length(), 0, 0, captureData, dataElementCount); + int const returnCode = pcre_exec(compiledRegex, nullptr, nameIter->c_str(), nameIter->length(), 0, 0, captureData, dataElementCount); if (returnCode >= 0) { ruleDescription = entry->getReason(); @@ -187,7 +187,7 @@ bool RegexList::doesStringMatch(const Unicode::String &name, std::string &ruleDe } else { - int const returnCode = pcre_exec(compiledRegex, NULL, testName.c_str(), testName.length(), 0, 0, captureData, dataElementCount); + int const returnCode = pcre_exec(compiledRegex, nullptr, testName.c_str(), testName.length(), 0, 0, captureData, dataElementCount); if (returnCode >= 0) { ruleDescription = entry->getReason(); diff --git a/engine/server/library/serverGame/src/shared/core/ReportManager.cpp b/engine/server/library/serverGame/src/shared/core/ReportManager.cpp index 4bac637e..b73e89ff 100755 --- a/engine/server/library/serverGame/src/shared/core/ReportManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/ReportManager.cpp @@ -247,7 +247,7 @@ void ReportManager::handleMessage(ChatOnRequestLog const &chatOnRequestLog) CreatureObject * const reportingCreatureObject = CreatureObject::asCreatureObject(NetworkIdManager::getObjectById(reportData.m_reportingNetworkId)); PlayerObject * const reportingPlayerObject = PlayerCreatureController::getPlayerObject(reportingCreatureObject); - if (reportingPlayerObject != NULL) + if (reportingPlayerObject != nullptr) { // Make sure the chat log does not have any extra data in it @@ -297,7 +297,7 @@ void ReportManager::handleMessage(ChatOnRequestLog const &chatOnRequestLog) } if ( !foundHarassingPlayer - && (reportingCreatureObject != NULL)) + && (reportingCreatureObject != nullptr)) { // No harassing player match @@ -345,7 +345,7 @@ void ReportManager::handleMessage(ChatOnRequestLog const &chatOnRequestLog) target.str = reportData.m_harassingName; prosePackage.target = target; - if (reportingCreatureObject != NULL) + if (reportingCreatureObject != nullptr) { Chat::sendSystemMessage(*reportingCreatureObject, prosePackage); } diff --git a/engine/server/library/serverGame/src/shared/core/SceneGlobalData.cpp b/engine/server/library/serverGame/src/shared/core/SceneGlobalData.cpp index 5a7c12b8..5c25017b 100755 --- a/engine/server/library/serverGame/src/shared/core/SceneGlobalData.cpp +++ b/engine/server/library/serverGame/src/shared/core/SceneGlobalData.cpp @@ -113,7 +113,7 @@ SceneData * SceneGlobalDataNamespace::getSceneDataByName(std::string const & sce if (i!=ms_SceneDataItems.end()) return i->second; else - return NULL; + return nullptr; } // ====================================================================== diff --git a/engine/server/library/serverGame/src/shared/core/ServerBuffBuilderManager.cpp b/engine/server/library/serverGame/src/shared/core/ServerBuffBuilderManager.cpp index 829055b8..fcf18e02 100755 --- a/engine/server/library/serverGame/src/shared/core/ServerBuffBuilderManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/ServerBuffBuilderManager.cpp @@ -58,7 +58,7 @@ void ServerBuffBuilderManager::remove() ms_installed = false; delete ms_callback; - ms_callback = NULL; + ms_callback = nullptr; } //----------------------------------------------------------------------------- @@ -73,12 +73,12 @@ bool ServerBuffBuilderManager::makeChanges(SharedBuffBuilderManager::Session con NetworkId const & recipientId = session.recipientId; Object * const recipientObj = NetworkIdManager::getObjectById(recipientId); - ServerObject * const recipientServerObj = recipientObj ? recipientObj->asServerObject() : NULL; - CreatureObject * const recipient = recipientServerObj ? recipientServerObj->asCreatureObject() : NULL; + ServerObject * const recipientServerObj = recipientObj ? recipientObj->asServerObject() : nullptr; + CreatureObject * const recipient = recipientServerObj ? recipientServerObj->asCreatureObject() : nullptr; NetworkId const & bufferId = session.bufferId; Object * const bufferObj = NetworkIdManager::getObjectById(bufferId); - ServerObject * const bufferServerObj = bufferObj ? bufferObj->asServerObject() : NULL; - CreatureObject * const buffer = bufferServerObj ? bufferServerObj->asCreatureObject() : NULL; + ServerObject * const bufferServerObj = bufferObj ? bufferObj->asServerObject() : nullptr; + CreatureObject * const buffer = bufferServerObj ? bufferServerObj->asCreatureObject() : nullptr; if(buffer && recipient) { sendSessionToScript(session, session.bufferId, static_cast(Scripting::TRIG_BUFF_BUILDER_COMPLETED)); @@ -93,11 +93,11 @@ void ServerBuffBuilderManager::sendSessionToScriptForValidation(SharedBuffBuilde NetworkId const & bufferId = session.bufferId; NetworkId const & recipientId = session.recipientId; Object const * const bufferObj = NetworkIdManager::getObjectById(bufferId); - ServerObject const * const bufferServer = bufferObj ? bufferObj->asServerObject() : NULL; - CreatureObject const * const buffer = bufferServer ? bufferServer->asCreatureObject() : NULL; + ServerObject const * const bufferServer = bufferObj ? bufferObj->asServerObject() : nullptr; + CreatureObject const * const buffer = bufferServer ? bufferServer->asCreatureObject() : nullptr; Object * const recipientObj = NetworkIdManager::getObjectById(recipientId); - ServerObject * const recipientServer = recipientObj ? recipientObj->asServerObject() : NULL; - CreatureObject * const recipient = recipientServer ? recipientServer->asCreatureObject() : NULL; + ServerObject * const recipientServer = recipientObj ? recipientObj->asServerObject() : nullptr; + CreatureObject * const recipient = recipientServer ? recipientServer->asCreatureObject() : nullptr; if(buffer && recipient) { sendSessionToScript(session, session.bufferId, static_cast(Scripting::TRIG_BUFF_BUILDER_VALIDATE)); @@ -109,7 +109,7 @@ void ServerBuffBuilderManager::sendSessionToScriptForValidation(SharedBuffBuilde void ServerBuffBuilderManager::sendSessionToScript(SharedBuffBuilderManager::Session const & session, NetworkId const & objectToTriggerId, int const trigger) { Object * const objectToTrigger = NetworkIdManager::getObjectById(objectToTriggerId); - ServerObject * const serverObjectToTrigger = objectToTrigger ? objectToTrigger->asServerObject() : NULL; + ServerObject * const serverObjectToTrigger = objectToTrigger ? objectToTrigger->asServerObject() : nullptr; if(serverObjectToTrigger) { GameScriptObject * const scriptObject = serverObjectToTrigger->getScriptObject(); @@ -144,7 +144,7 @@ void ServerBuffBuilderManager::cancelSession(NetworkId const & bufferId, Network { //send the cancel message to the buffer Object * const bufferObject = NetworkIdManager::getObjectById(bufferId); - Controller * const bufferController = bufferObject ? bufferObject->getController() : NULL; + Controller * const bufferController = bufferObject ? bufferObject->getController() : nullptr; if(bufferController) { BuffBuilderChangeMessage * outMsg = new BuffBuilderChangeMessage(); @@ -157,7 +157,7 @@ void ServerBuffBuilderManager::cancelSession(NetworkId const & bufferId, Network //send the cancel message to the recipient Object * const recipientObject = NetworkIdManager::getObjectById(recipientId); - Controller * const recipientController = recipientObject ? recipientObject->getController() : NULL; + Controller * const recipientController = recipientObject ? recipientObject->getController() : nullptr; if(recipientController && bufferController != recipientController) { BuffBuilderChangeMessage * outMsg = new BuffBuilderChangeMessage(); @@ -169,7 +169,7 @@ void ServerBuffBuilderManager::cancelSession(NetworkId const & bufferId, Network } //send cancel trigger to buffer player - ServerObject * const bufferServerObject = bufferObject ? bufferObject->asServerObject() : NULL; + ServerObject * const bufferServerObject = bufferObject ? bufferObject->asServerObject() : nullptr; if(bufferServerObject) { GameScriptObject * const scriptObject = bufferServerObject->getScriptObject(); @@ -181,7 +181,7 @@ void ServerBuffBuilderManager::cancelSession(NetworkId const & bufferId, Network } //send cancel trigger to recipient player - ServerObject * const recipientServerObject = recipientObject ? recipientObject->asServerObject() : NULL; + ServerObject * const recipientServerObject = recipientObject ? recipientObject->asServerObject() : nullptr; if(recipientServerObject && recipientServerObject != bufferServerObject) { GameScriptObject * const scriptObject = recipientServerObject->getScriptObject(); diff --git a/engine/server/library/serverGame/src/shared/core/ServerBuildoutManager.cpp b/engine/server/library/serverGame/src/shared/core/ServerBuildoutManager.cpp index f371ee83..e38943e1 100755 --- a/engine/server/library/serverGame/src/shared/core/ServerBuildoutManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/ServerBuildoutManager.cpp @@ -81,8 +81,8 @@ namespace ServerBuildoutManagerNamespace struct ServerEventAreaInfo { ServerEventAreaInfo(): - buildOut(NULL), - loadedObject(NULL) + buildOut(nullptr), + loadedObject(nullptr) { } @@ -892,7 +892,7 @@ void ServerBuildoutManagerNamespace::instantiateAreaNode(AreaInfo const &areaInf ServerEventMap::iterator searchIter = s_eventObjects.find(buildoutRow.m_eventRequired); if(searchIter != s_eventObjects.end()) { - ServerEventAreaInfo newEventObj(&buildoutRow, NULL); + ServerEventAreaInfo newEventObj(&buildoutRow, nullptr); (*searchIter).second.push_back(newEventObj); } else @@ -947,7 +947,7 @@ void ServerBuildoutManagerNamespace::instantiateAreaNode(AreaInfo const &areaInf newObject->setAuthority(); - if (newObject->asTangibleObject() != NULL) + if (newObject->asTangibleObject() != nullptr) newObject->asTangibleObject()->initializeVisibility(); // @@ -1033,7 +1033,7 @@ void ServerBuildoutManagerNamespace::instantiateAreaNode(AreaInfo const &areaInf { GameScriptObject * const gso = newObject->getScriptObject(); - if (NULL != gso) + if (nullptr != gso) { std::string const &scripts = buildoutRow.m_scripts; unsigned int pos = 0; @@ -1077,7 +1077,7 @@ void ServerBuildoutManagerNamespace::instantiateAreaNode(AreaInfo const &areaInf if ( controllerObjectId.isValid() ) { ServerObject * const controllerObject = safe_cast(NetworkIdManager::getObjectById(controllerObjectId)); - if (NULL != controllerObject) + if (nullptr != controllerObject) { GameScriptObject * const script = controllerObject->getScriptObject(); @@ -1092,7 +1092,7 @@ void ServerBuildoutManagerNamespace::instantiateAreaNode(AreaInfo const &areaInf { if (registerWithController) { - if (NULL != script) + if (nullptr != script) { ScriptParams p; p.addParam(obj->getNetworkId()); @@ -1279,7 +1279,7 @@ void ServerBuildoutManager::onEventStarted(std::string const & eventName) newObject->setAuthority(); - if (newObject->asTangibleObject() != NULL) + if (newObject->asTangibleObject() != nullptr) newObject->asTangibleObject()->initializeVisibility(); // @@ -1369,7 +1369,7 @@ void ServerBuildoutManager::onEventStarted(std::string const & eventName) { GameScriptObject * const gso = newObject->getScriptObject(); - if (NULL != gso) + if (nullptr != gso) { std::string const &scripts = buildoutRow.m_scripts; unsigned int pos = 0; @@ -1407,7 +1407,7 @@ void ServerBuildoutManager::onEventStarted(std::string const & eventName) if ( controllerObjectId.isValid() ) { ServerObject * const controllerObject = safe_cast(NetworkIdManager::getObjectById(controllerObjectId)); - if (NULL != controllerObject) + if (nullptr != controllerObject) { GameScriptObject * const script = controllerObject->getScriptObject(); @@ -1422,7 +1422,7 @@ void ServerBuildoutManager::onEventStarted(std::string const & eventName) { if (registerWithController) { - if (NULL != script) + if (nullptr != script) { ScriptParams p; p.addParam(obj->getNetworkId()); @@ -1483,7 +1483,7 @@ void ServerBuildoutManager::onEventStopped(std::string const & eventName) object->unload(); - (*objIter).loadedObject = NULL; + (*objIter).loadedObject = nullptr; } } } diff --git a/engine/server/library/serverGame/src/shared/core/ServerImageDesignerManager.cpp b/engine/server/library/serverGame/src/shared/core/ServerImageDesignerManager.cpp index fe976e69..2fd9b849 100755 --- a/engine/server/library/serverGame/src/shared/core/ServerImageDesignerManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/ServerImageDesignerManager.cpp @@ -56,8 +56,8 @@ namespace ServerImageDesignerManagerNamespace { NetworkId const & nid = payload.first; Object * const o = NetworkIdManager::getObjectById(nid); - ServerObject * const so = o ? o->asServerObject() : NULL; - CreatureObject * const creature = so ? so->asCreatureObject() : NULL; + ServerObject * const so = o ? o->asServerObject() : nullptr; + CreatureObject * const creature = so ? so->asCreatureObject() : nullptr; if (creature) { ObjectTemplate const * const tmp = creature->getSharedTemplate(); @@ -157,7 +157,7 @@ void ServerImageDesignerManager::remove() ms_genderSpeciesToAllowBald.clear(); delete ms_callback; - ms_callback = NULL; + ms_callback = nullptr; } //----------------------------------------------------------------------------- @@ -172,12 +172,12 @@ bool ServerImageDesignerManager::makeChanges(SharedImageDesignerManager::Session NetworkId const & recipientId = session.recipientId; Object * const recipientObj = NetworkIdManager::getObjectById(recipientId); - ServerObject * const recipientServerObj = recipientObj ? recipientObj->asServerObject() : NULL; - CreatureObject * const recipient = recipientServerObj ? recipientServerObj->asCreatureObject() : NULL; + ServerObject * const recipientServerObj = recipientObj ? recipientObj->asServerObject() : nullptr; + CreatureObject * const recipient = recipientServerObj ? recipientServerObj->asCreatureObject() : nullptr; NetworkId const & designerId = session.designerId; Object * const designerObj = NetworkIdManager::getObjectById(designerId); - ServerObject * const designerServerObj = designerObj ? designerObj->asServerObject() : NULL; - CreatureObject * const designer = designerServerObj ? designerServerObj->asCreatureObject() : NULL; + ServerObject * const designerServerObj = designerObj ? designerObj->asServerObject() : nullptr; + CreatureObject * const designer = designerServerObj ? designerServerObj->asCreatureObject() : nullptr; if(designer && recipient) { @@ -332,8 +332,8 @@ bool ServerImageDesignerManager::makeChanges(SharedImageDesignerManager::Session SlotId const slot = SlotIdManager::findSlotId (ConstCharCrcLowerString (cms_hairSlotName)); Container::ContainerErrorCode tmp = Container::CEC_Success; Object * const originalHairObject = slotted->getObjectInSlot(slot, tmp).getObject(); - ServerObject * const originalHairServerObject = originalHairObject ? originalHairObject->asServerObject() : NULL; - TangibleObject * const orignalHair = originalHairServerObject ? originalHairServerObject->asTangibleObject() : NULL; + ServerObject * const originalHairServerObject = originalHairObject ? originalHairObject->asServerObject() : nullptr; + TangibleObject * const orignalHair = originalHairServerObject ? originalHairServerObject->asTangibleObject() : nullptr; std::string originalHairCustomizationData; if(orignalHair) { @@ -434,8 +434,8 @@ SharedImageDesignerManager::SkillMods ServerImageDesignerManager::getSkillModsFo } Object const * const o = NetworkIdManager::getObjectById(designerId); - ServerObject const * const so = o ? o->asServerObject() : NULL; - CreatureObject const * const designer = so ? so->asCreatureObject() : NULL; + ServerObject const * const so = o ? o->asServerObject() : nullptr; + CreatureObject const * const designer = so ? so->asCreatureObject() : nullptr; if(designer) { skillMods.bodySkillMod = designer->getModValue(SharedImageDesignerManager::cms_bodySkillModName); @@ -466,7 +466,7 @@ void ServerImageDesignerManager::updateGradualCustomizations(CreatureObject * ta //do this one immediately SlotId const slot = SlotIdManager::findSlotId (ConstCharCrcLowerString (cms_hairCustomizationName.c_str())); ServerObject * const hair = ServerWorld::createNewObject(i->second.templateName, *target, slot, true); - TangibleObject * const tangibleHair = hair ? hair->asTangibleObject() : NULL; + TangibleObject * const tangibleHair = hair ? hair->asTangibleObject() : nullptr; if(tangibleHair) { //first set hair color to colors from old hair (if any) @@ -503,11 +503,11 @@ void ServerImageDesignerManager::sendSessionToScriptForValidation(SharedImageDes NetworkId const & designerId = session.designerId; NetworkId const & recipientId = session.recipientId; Object const * const designerObj = NetworkIdManager::getObjectById(designerId); - ServerObject const * const designerServer = designerObj ? designerObj->asServerObject() : NULL; - CreatureObject const * const designer = designerServer ? designerServer->asCreatureObject() : NULL; + ServerObject const * const designerServer = designerObj ? designerObj->asServerObject() : nullptr; + CreatureObject const * const designer = designerServer ? designerServer->asCreatureObject() : nullptr; Object * const recipientObj = NetworkIdManager::getObjectById(recipientId); - ServerObject * const recipientServer = recipientObj ? recipientObj->asServerObject() : NULL; - CreatureObject * const recipient = recipientServer ? recipientServer->asCreatureObject() : NULL; + ServerObject * const recipientServer = recipientObj ? recipientObj->asServerObject() : nullptr; + CreatureObject * const recipient = recipientServer ? recipientServer->asCreatureObject() : nullptr; if(designer && recipient) { sendSessionToScript(session, session.designerId, static_cast(Scripting::TRIG_IMAGE_DESIGN_VALIDATE)); @@ -519,7 +519,7 @@ void ServerImageDesignerManager::sendSessionToScriptForValidation(SharedImageDes void ServerImageDesignerManager::sendSessionToScript(SharedImageDesignerManager::Session const & session, NetworkId const & objectToTriggerId, int const trigger) { Object * const objectToTrigger = NetworkIdManager::getObjectById(objectToTriggerId); - ServerObject * const serverObjectToTrigger = objectToTrigger ? objectToTrigger->asServerObject() : NULL; + ServerObject * const serverObjectToTrigger = objectToTrigger ? objectToTrigger->asServerObject() : nullptr; if(serverObjectToTrigger) { GameScriptObject * const scriptObject = serverObjectToTrigger->getScriptObject(); @@ -571,11 +571,11 @@ CustomizationData * ServerImageDesignerManager::fetchCustomizationDataForCustomi if(customization.isVarHairColor) { ServerObject * const hair = creature.getHair(); - TangibleObject * const tangibleHair = hair ? hair->asTangibleObject() : NULL; + TangibleObject * const tangibleHair = hair ? hair->asTangibleObject() : nullptr; if(tangibleHair) objectToQuery = tangibleHair; else - return NULL; + return nullptr; } return objectToQuery->fetchCustomizationData(); } @@ -586,7 +586,7 @@ void ServerImageDesignerManager::cancelSession(NetworkId const & designerId, Net { //send the cancel message to the designer Object * const designerObject = NetworkIdManager::getObjectById(designerId); - Controller * const designerController = designerObject ? designerObject->getController() : NULL; + Controller * const designerController = designerObject ? designerObject->getController() : nullptr; if(designerController) { ImageDesignChangeMessage * outMsg = new ImageDesignChangeMessage(); @@ -599,7 +599,7 @@ void ServerImageDesignerManager::cancelSession(NetworkId const & designerId, Net //send the cancel message to the recipient Object * const recipientObject = NetworkIdManager::getObjectById(recipientId); - Controller * const recipientController = recipientObject ? recipientObject->getController() : NULL; + Controller * const recipientController = recipientObject ? recipientObject->getController() : nullptr; if(recipientController && designerController != recipientController) { ImageDesignChangeMessage * outMsg = new ImageDesignChangeMessage(); @@ -611,7 +611,7 @@ void ServerImageDesignerManager::cancelSession(NetworkId const & designerId, Net } //send cancel trigger to designer player - ServerObject * const designerServerObject = designerObject ? designerObject->asServerObject() : NULL; + ServerObject * const designerServerObject = designerObject ? designerObject->asServerObject() : nullptr; if(designerServerObject) { GameScriptObject * const scriptObject = designerServerObject->getScriptObject(); @@ -623,7 +623,7 @@ void ServerImageDesignerManager::cancelSession(NetworkId const & designerId, Net } //send cancel trigger to recipient player - ServerObject * const recipientServerObject = recipientObject ? recipientObject->asServerObject() : NULL; + ServerObject * const recipientServerObject = recipientObject ? recipientObject->asServerObject() : nullptr; if(recipientServerObject && recipientServerObject != designerServerObject) { GameScriptObject * const scriptObject = recipientServerObject->getScriptObject(); @@ -644,8 +644,8 @@ void ServerImageDesignerManager::cancelSession(NetworkId const & designerId, Net std::map ServerImageDesignerManager::getHairCustomizations(SharedImageDesignerManager::Session const & session) { Object * const o = NetworkIdManager::getObjectById(session.recipientId); - ServerObject * const so = o ? o->asServerObject() : NULL; - CreatureObject * const recipient = so ? so->asCreatureObject() : NULL; + ServerObject * const so = o ? o->asServerObject() : nullptr; + CreatureObject * const recipient = so ? so->asCreatureObject() : nullptr; CustomizationManager::Customization customization; bool result = false; std::map hairCustomizations; diff --git a/engine/server/library/serverGame/src/shared/core/ServerUIManager.cpp b/engine/server/library/serverGame/src/shared/core/ServerUIManager.cpp index f94b1eee..be9ccc62 100755 --- a/engine/server/library/serverGame/src/shared/core/ServerUIManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/ServerUIManager.cpp @@ -105,7 +105,7 @@ int ServerUIManager::createPage(const std::string& pageName, const ServerObject& return pageId; ServerUIPage * const serverUIPage = ServerUIManager::getPage(pageId); - if (serverUIPage != NULL) + if (serverUIPage != nullptr) { serverUIPage->setCallback(callbackFunction); return pageId; @@ -153,7 +153,7 @@ ServerUIPage* ServerUIManager::getPage(int pageId) { std::map::const_iterator iterFind = m_pages.find(pageId); if (iterFind == m_pages.end()) - return NULL; + return nullptr; else return iterFind->second; } @@ -163,7 +163,7 @@ ServerUIPage* ServerUIManager::getPage(int pageId) bool ServerUIManager::showPage(int pageId) { ServerUIPage * const page = getPage(pageId); - if (page != NULL) + if (page != nullptr) return showPage(*page); WARNING(true, ("ServerUIManager::showPage(%d) invalid page", pageId)); @@ -175,14 +175,14 @@ bool ServerUIManager::showPage(int pageId) bool ServerUIManager::showPage(ServerUIPage & page) { Client * const client = page.getClient(); - if (client == NULL) + if (client == nullptr) { -// WARNING(true, ("ServerUIManager::showPage attempt to show page on null client")); +// WARNING(true, ("ServerUIManager::showPage attempt to show page on nullptr client")); return false; } ServerObject const * const characterObject = client->getCharacterObject(); - if (characterObject == NULL) + if (characterObject == nullptr) { WARNING(true, ("ServerUIManager::showPage attempt to show page to client with no character object")); return false; @@ -219,11 +219,11 @@ bool ServerUIManager::closePage(int pageId) { //send close_page message const ServerUIPage * const page = getPage(pageId); - if(page == NULL) + if(page == nullptr) return false; Client * const client = page->getClient(); - if(client == NULL) + if(client == nullptr) return false; SuiForceClosePage msg; @@ -239,7 +239,7 @@ bool ServerUIManager::removePage(int pageId) { //send close_page message const ServerUIPage * const page = getPage(pageId); - if(page == NULL) + if(page == nullptr) return false; NetworkId const & primaryControlledObject = page->getPrimaryControlledObject(); @@ -275,11 +275,11 @@ void ServerUIManager::receiveMessage(const MessageDispatch::MessageBase& message int const pageId = suiEventNotification.getPageId(); ServerUIPage const * const page = getPage(pageId); - if (page == NULL) + if (page == nullptr) return; Client * const client = page->getClient(); - if (client == NULL) + if (client == nullptr) { removePage(pageId); return; @@ -287,9 +287,9 @@ void ServerUIManager::receiveMessage(const MessageDispatch::MessageBase& message ServerObject * const characterObject = client->getCharacterObject(); - if (characterObject == NULL) + if (characterObject == nullptr) { - WARNING(true, ("ServerUIManager::recieveMessage got SuiEventNotification for null character object")); + WARNING(true, ("ServerUIManager::recieveMessage got SuiEventNotification for nullptr character object")); removePage(pageId); return; } @@ -300,15 +300,15 @@ void ServerUIManager::receiveMessage(const MessageDispatch::MessageBase& message ServerObject * const ownerObject = ServerWorld::findObjectByNetworkId(suiPageDataServer.getOwnerId()); - if (ownerObject == NULL) + if (ownerObject == nullptr) { - WARNING(true, ("ServerUIManager::recieveMessage got SuiEventNotification for null owner object")); + WARNING(true, ("ServerUIManager::recieveMessage got SuiEventNotification for nullptr owner object")); removePage(pageId); return; } GameScriptObject * const gso = ownerObject->getScriptObject(); - if (gso == NULL) + if (gso == nullptr) { WARNING(true, ("ServerUIManager::recieveMessage got SuiEventNotification for owner object with no scripts")); removePage(pageId); @@ -318,7 +318,7 @@ void ServerUIManager::receiveMessage(const MessageDispatch::MessageBase& message int const eventIndex = suiEventNotification.getSubscribedEventIndex(); SuiCommand const * const command = suiPageData.findSubscribeToEventCommandByIndex(eventIndex); - if (command == NULL) + if (command == nullptr) { WARNING(true, ("ServerUIManager::recieveMessage got SuiEventNotification invalid notification index [%d]", eventIndex)); return; @@ -385,7 +385,7 @@ void ServerUIManager::receiveMessage(const MessageDispatch::MessageBase& message ScriptDictionaryPtr sd; //it allocates sd, we have to clean it up later gso->makeScriptDictionary(sp, sd); - if(sd.get() == NULL) + if(sd.get() == nullptr) return; //call the script callback function diff --git a/engine/server/library/serverGame/src/shared/core/ServerUIPage.cpp b/engine/server/library/serverGame/src/shared/core/ServerUIPage.cpp index 289f1ada..1fc5e64a 100755 --- a/engine/server/library/serverGame/src/shared/core/ServerUIPage.cpp +++ b/engine/server/library/serverGame/src/shared/core/ServerUIPage.cpp @@ -36,7 +36,7 @@ m_pageDataServer(pageDataServer) ServerUIPage::~ServerUIPage() { delete m_pageDataServer; - m_pageDataServer = NULL; + m_pageDataServer = nullptr; } //----------------------------------------------------------------------- @@ -52,19 +52,19 @@ Client* ServerUIPage::getClient() const if(!object) { WARNING(true, ("ServerUIPage PrimaryControlledObject doesn't exist")); - return NULL; + return nullptr; } ServerObject *const serverObject = object->asServerObject(); if(!serverObject) { WARNING(true, ("ServerUIPage PrimaryControlledObject isn't a server object")); - return NULL; + return nullptr; } Client * const result = serverObject->getClient(); if(!result) { WARNING(true, ("ServerUIPage PrimaryControlledObject has no client yet")); - return NULL; + return nullptr; } return result; } @@ -74,9 +74,9 @@ Client* ServerUIPage::getClient() const ServerObject* ServerUIPage::getOwner() const { Object * const object = NetworkIdManager::getObjectById(getPageDataServer().getOwnerId()); - if (object != NULL) + if (object != nullptr) return object->asServerObject(); - return NULL; + return nullptr; } //----------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/core/ServerUniverse.cpp b/engine/server/library/serverGame/src/shared/core/ServerUniverse.cpp index 9729c039..29f8e60e 100755 --- a/engine/server/library/serverGame/src/shared/core/ServerUniverse.cpp +++ b/engine/server/library/serverGame/src/shared/core/ServerUniverse.cpp @@ -65,15 +65,15 @@ ServerUniverse::ServerUniverse() : m_universeProcess (0), m_nextCheckTimer (static_cast(ConfigServerGame::getUniverseCheckFrequencySeconds())), m_doImmediateCheck (false), - m_thisPlanet (NULL), - m_tatooinePlanet (NULL), + m_thisPlanet (nullptr), + m_tatooinePlanet (nullptr), m_planetNameMap (new PlanetNameMap), m_resourceTypeNameMap (new ResourceTypeNameMap), m_resourceTypeIdMap (new ResourceTypeIdMap), m_importedResourceTypeIdMap(new ResourceTypeIdMap), m_resourcesToSend (new ResourcesToSendType), - m_masterGuildObject (NULL), - m_masterCityObject (NULL), + m_masterGuildObject (nullptr), + m_masterCityObject (nullptr), m_theaterNameIdMap (new TheaterNameIdMap), m_theaterIdNameMap (new TheaterIdNameMap), m_populationList (new PopulationList), @@ -152,7 +152,7 @@ ResourceTypeObject *ServerUniverse::getResourceTypeByName(std::string const & na ResourceTypeObject * ServerUniverse::getResourceTypeById(NetworkId const & id) const { if (id==NetworkId::cms_invalid) - return NULL; + return nullptr; if (id.getValue() <= NetworkId::cms_maxNetworkIdWithoutClusterId) { @@ -160,7 +160,7 @@ ResourceTypeObject * ServerUniverse::getResourceTypeById(NetworkId const & id) c if (i!=m_resourceTypeIdMap->end()) return (*i).second; else - return NULL; + return nullptr; } else { @@ -168,7 +168,7 @@ ResourceTypeObject * ServerUniverse::getResourceTypeById(NetworkId const & id) c if (i!=m_importedResourceTypeIdMap->end()) return (*i).second; else - return NULL; + return nullptr; } } @@ -177,13 +177,13 @@ ResourceTypeObject * ServerUniverse::getResourceTypeById(NetworkId const & id) c ResourceTypeObject * ServerUniverse::getImportedResourceTypeById(NetworkId const & id) const { if (id==NetworkId::cms_invalid) - return NULL; + return nullptr; ResourceTypeIdMap::const_iterator i=m_importedResourceTypeIdMap->find(id); if (i!=m_importedResourceTypeIdMap->end()) return (*i).second; else - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -329,7 +329,7 @@ void ServerUniverse::createProxiesOnServer(std::vector const & remotePro LOG("UniverseLoading", ("Game Server %lu sent UniverseComplete to Game Servers %s.", GameServer::getInstance().getProcessId(), serverListAsString.c_str())); if (ConfigServerGame::getTimeoutToAckUniverseDataReceived() > 0) - m_timeUniverseDataSent = ::time(NULL); + m_timeUniverseDataSent = ::time(nullptr); } } else @@ -519,7 +519,7 @@ std::string ServerUniverse::generateRandomResourceName(const std::string &nameTa std::string newName(Unicode::wideToNarrow(NameManager::getInstance().generateRandomName("name_resource",nameTable))); // name generator always builds ASCII names, although it returns a Unicode string int failCount = 0; UNREF(failCount); // because of Windows release build - for(; getResourceTypeByName(newName) != NULL; newName = Unicode::wideToNarrow(NameManager::getInstance().generateRandomName("name_resource",nameTable))) // generate names until we find an unused one + for(; getResourceTypeByName(newName) != nullptr; newName = Unicode::wideToNarrow(NameManager::getInstance().generateRandomName("name_resource",nameTable))) // generate names until we find an unused one DEBUG_FATAL(++failCount > 100,("Failed to generate an unused resource name in 100 tries.\n")); return newName; @@ -725,7 +725,7 @@ void ServerUniverse::update(float frameTime) { if (!m_pendingUniverseLoadedAckList.empty()) { - time_t const nowTime = ::time(NULL); + time_t const nowTime = ::time(nullptr); int const secondsSinceUniverseDataSent = (int)(nowTime - m_timeUniverseDataSent); // don't wait forever for ack from another game server @@ -866,7 +866,7 @@ void ServerUniverse::handleAddResourceTypeMessage(AddResourceTypeMessage const & const NetworkId & ServerUniverse::findTheaterId(const std::string & name) { - if (m_theaterNameIdMap == NULL) + if (m_theaterNameIdMap == nullptr) return NetworkId::cms_invalid; TheaterNameIdMap::const_iterator result = m_theaterNameIdMap->find(name); @@ -882,7 +882,7 @@ const std::string & ServerUniverse::findTheaterName(const NetworkId & id) { static const std::string emptyString; - if (m_theaterIdNameMap == NULL) + if (m_theaterIdNameMap == nullptr) return emptyString; TheaterIdNameMap::const_iterator result = m_theaterIdNameMap->find(id); @@ -924,9 +924,9 @@ bool ServerUniverse::remoteSetTheater(const std::string & name, const NetworkId return false; } - if (m_theaterNameIdMap != NULL) + if (m_theaterNameIdMap != nullptr) m_theaterNameIdMap->insert(std::make_pair(name, id)); - if (m_theaterIdNameMap != NULL) + if (m_theaterIdNameMap != nullptr) m_theaterIdNameMap->insert(std::make_pair(id, name)); return true; } @@ -953,9 +953,9 @@ void ServerUniverse::remoteClearTheater(const std::string & name) { const NetworkId & id = findTheaterId(name); - if (m_theaterNameIdMap != NULL) + if (m_theaterNameIdMap != nullptr) m_theaterNameIdMap->erase(name); - if (m_theaterIdNameMap != NULL) + if (m_theaterIdNameMap != nullptr) m_theaterIdNameMap->erase(id); } diff --git a/engine/server/library/serverGame/src/shared/core/ServerWorld.cpp b/engine/server/library/serverGame/src/shared/core/ServerWorld.cpp index fefa1117..3b76b5db 100755 --- a/engine/server/library/serverGame/src/shared/core/ServerWorld.cpp +++ b/engine/server/library/serverGame/src/shared/core/ServerWorld.cpp @@ -415,7 +415,7 @@ class AuthoritativeNonPlayerCreatureFilter: public SpatialSubdivisionFilterisAuthoritative() && object->asCreatureObject() != NULL && !object->isPlayerControlled()); } + return (object->isAuthoritative() && object->asCreatureObject() != nullptr && !object->isPlayerControlled()); } }; class TriggerVolumeFilter: public SpatialSubdivisionFilter @@ -905,26 +905,26 @@ ManufactureSchematicObject* ServerWorld::createNewManufacturingSchematic ( bool persisted) { CreatureObject * const creature = dynamic_cast(creator.getObject()); - if (creature == NULL) - return NULL; + if (creature == nullptr) + return nullptr; PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); - if (player == NULL) - return NULL; + if (player == nullptr) + return nullptr; const DraftSchematicObject * const draftSchematic = player->getCurrentDraftSchematic(); - if (draftSchematic == NULL) - return NULL; + if (draftSchematic == nullptr) + return nullptr; ManufactureSchematicObject * const manfSchematic = draftSchematic->createManufactureSchematic(creator); - if (manfSchematic == NULL) - return NULL; + if (manfSchematic == nullptr) + return nullptr; if (createNewObjectIntermediate(manfSchematic, container, slotId, - persisted) == NULL) + persisted) == nullptr) { delete manfSchematic; - return NULL; + return nullptr; } return manfSchematic; @@ -948,15 +948,15 @@ ManufactureSchematicObject* ServerWorld::createNewManufacturingSchematic ( { ManufactureSchematicObject * const manfSchematic = source.createManufactureSchematic(CachedNetworkId::cms_cachedInvalid); - if (manfSchematic == NULL) - return NULL; + if (manfSchematic == nullptr) + return nullptr; Transform transform; transform.setPosition_p(position); - if (createNewObjectIntermediate(manfSchematic, transform, 0, persisted) == NULL) + if (createNewObjectIntermediate(manfSchematic, transform, 0, persisted) == nullptr) { delete manfSchematic; - return NULL; + return nullptr; } return manfSchematic; @@ -980,11 +980,11 @@ ManufactureSchematicObject* ServerWorld::createNewManufacturingSchematic ( { ManufactureSchematicObject * const manfSchematic = source.createManufactureSchematic(CachedNetworkId::cms_cachedInvalid); - if (manfSchematic == NULL) - return NULL; + if (manfSchematic == nullptr) + return nullptr; - if (createNewObjectIntermediate(manfSchematic, container, persisted, false) == NULL) - return NULL; + if (createNewObjectIntermediate(manfSchematic, container, persisted, false) == nullptr) + return nullptr; return manfSchematic; } // ServerWorld::createNewManufacturingSchematic @@ -1008,11 +1008,11 @@ ServerObject* ServerWorld::createNewObjectIntermediate(ServerObject *newObject, if (newObject->getNetworkId() == NetworkId::cms_invalid) { WARNING_STRICT_FATAL(true, ("Tried to create an object with network id 0.")); - return NULL; + return nullptr; } NetworkController *objectController = dynamic_cast(newObject->getController()); - if (objectController == NULL) + if (objectController == nullptr) objectController = dynamic_cast(newObject->createDefaultController()); NOT_NULL(objectController); @@ -1022,7 +1022,7 @@ ServerObject* ServerWorld::createNewObjectIntermediate(ServerObject *newObject, if (!newObject->serverObjectInitializeFirstTimeObject(cell, transform)) { delete newObject; - return NULL; + return nullptr; } // prevent initial object data from being re-sent as deltas @@ -1057,11 +1057,11 @@ ServerObject* ServerWorld::createNewObjectIntermediate(ServerObject* newObject, if (newObject->getNetworkId() == NetworkId::cms_invalid) { WARNING_STRICT_FATAL(true, ("Tried to create an object with network id 0.")); - return NULL; + return nullptr; } NetworkController *objectController = dynamic_cast(newObject->getController()); - if (objectController == NULL) + if (objectController == nullptr) objectController = dynamic_cast(newObject->createDefaultController()); NOT_NULL(objectController); @@ -1073,10 +1073,10 @@ ServerObject* ServerWorld::createNewObjectIntermediate(ServerObject* newObject, // prevent initial object data from being re-sent as deltas newObject->clearDeltas(); Container::ContainerErrorCode tmp = Container::CEC_Success; - if (!ContainerInterface::transferItemToGeneralContainer(container, *newObject, NULL, tmp, allowOverload)) + if (!ContainerInterface::transferItemToGeneralContainer(container, *newObject, nullptr, tmp, allowOverload)) { IGNORE_RETURN(newObject->permanentlyDestroy(DeleteReasons::BadContainerTransfer)); - newObject = NULL; + newObject = nullptr; } else { @@ -1101,13 +1101,13 @@ ServerObject* ServerWorld::createNewObjectIntermediate(ServerObject* newObject, if (newObject->getNetworkId() == NetworkId::cms_invalid) { WARNING_STRICT_FATAL(true, ("Tried to create an object with network id 0.")); - return NULL; + return nullptr; } { PROFILER_AUTO_BLOCK_DEFINE("createNewObjectIntermedate,getController"); NetworkController *objectController = dynamic_cast(newObject->getController()); - if (objectController == NULL) + if (objectController == nullptr) objectController = dynamic_cast(newObject->createDefaultController()); NOT_NULL(objectController); } @@ -1130,11 +1130,11 @@ ServerObject* ServerWorld::createNewObjectIntermediate(ServerObject* newObject, { PROFILER_AUTO_BLOCK_DEFINE("transferItem"); Container::ContainerErrorCode tmp = Container::CEC_Success; - if (!ContainerInterface::transferItemToSlottedContainer(container, *newObject, slotId, NULL, tmp)) + if (!ContainerInterface::transferItemToSlottedContainer(container, *newObject, slotId, nullptr, tmp)) { PROFILER_AUTO_BLOCK_DEFINE("failedTransfer"); IGNORE_RETURN(newObject->permanentlyDestroy(DeleteReasons::BadContainerTransfer)); - newObject = NULL; + newObject = nullptr; } else { @@ -1189,7 +1189,7 @@ ServerObject* ServerWorld::createProxyObject(uint32 templateCrc, const NetworkId if(newObject) { ServerController *objectController = dynamic_cast(newObject->getController()); - if (objectController == NULL) + if (objectController == nullptr) objectController = dynamic_cast(newObject->createDefaultController()); NOT_NULL(objectController); @@ -1455,10 +1455,10 @@ static void _isObjectInConeLoopSetup(const Object & coneCenterObject, const Loca // NOTE: all calculations are made within the object space of coneCenterObject. //-- Compute cone axis vector. - const ServerObject * cell = NULL; + const ServerObject * cell = nullptr; if (coneDirection.getCell() != NetworkId::cms_invalid) cell = safe_cast(NetworkIdManager::getObjectById(coneDirection.getCell())); - if (cell == NULL) + if (cell == nullptr) coneAxisVector = coneCenterObject.rotateTranslate_w2o(coneDirection.getCoordinates()); else { @@ -1984,7 +1984,7 @@ CellProperty const * ServerWorld::findCellAtLocation(const Vector & location_w) */ ServerObject *ServerWorld::findClosestObjectInList(const Vector &location, const std::vector &candidates) { - if (candidates.empty()) return NULL; + if (candidates.empty()) return nullptr; typedef std::vector CandidatesType; @@ -2097,7 +2097,7 @@ void ServerWorld::install() data.installExtents = true; data.installCollisionWorld = true; - data.playEffect = NULL; + data.playEffect = nullptr; data.isPlayerHouse = &isPlayerHouseHook; data.serverSide = true; @@ -2187,7 +2187,7 @@ void ServerWorld::install() m_sceneId = new std::string(ConfigServerGame::getSceneID()); - Pvp::getScheduler().setCallback(Pvp::updateTimedFlags, NULL, ConfigServerGame::getPvpUpdateTimeMs()); + Pvp::getScheduler().setCallback(Pvp::updateTimedFlags, nullptr, ConfigServerGame::getPvpUpdateTimeMs()); NebulaManagerServer::loadScene(*m_sceneId); @@ -2420,7 +2420,7 @@ void ServerWorld::triggerMovingTriggers(ServerObject &movingObject, Vector const clcount++; } - if (object != NULL) + if (object != nullptr) t->moveTriggerVolume(*object, start, end); } DEBUG_REPORT_LOG(ms_logTriggerStats, (" Creature count: %d Client count: %d\n", crcount, clcount)); @@ -2559,8 +2559,8 @@ void ServerWorld::remove() gs_pendingConcludeVector.clear(); - CollisionWorld::setNearWarpWarningCallback(NULL); - CollisionWorld::setFarWarpWarningCallback(NULL); + CollisionWorld::setNearWarpWarningCallback(nullptr); + CollisionWorld::setFarWarpWarningCallback(nullptr); Pvp::remove(); @@ -2629,7 +2629,7 @@ void ServerWorld::removeObjectFromGame(const ServerObject& object) void ServerWorld::removeTangibleObject(ServerObject *object) { PROFILER_AUTO_BLOCK_DEFINE("ServerWorld::removeTangibleObject"); - DEBUG_WARNING(!object, ("removeTangibleObject() was called with a NULL object parameter, this is probably not what the program intended to do")); + DEBUG_WARNING(!object, ("removeTangibleObject() was called with a nullptr object parameter, this is probably not what the program intended to do")); if (!object) return; @@ -2643,7 +2643,7 @@ void ServerWorld::removeTangibleObject(ServerObject *object) // if the object is being destroyed, the trigger has already gone off // player creatures aren't destroyed before being removed, so it's safe to invoke // the trigger here - if (object->isAuthoritative() && (object->getScriptObject() != NULL) && !object->isBeingDestroyed()) + if (object->isAuthoritative() && (object->getScriptObject() != nullptr) && !object->isBeingDestroyed()) { ScriptParams params; IGNORE_RETURN(object->getScriptObject()->trigAllScripts(Scripting::TRIG_REMOVING_FROM_WORLD, params)); @@ -2897,7 +2897,7 @@ void ServerWorld::update(real time) for(concludeIter = gs_pendingConcludeVector.begin(); concludeIter != gs_pendingConcludeVector.end(); ++concludeIter) { ServerObject *o = (*concludeIter)->asServerObject(); - WARNING_STRICT_FATAL(!o, ("NULL object in conclude list!")); + WARNING_STRICT_FATAL(!o, ("nullptr object in conclude list!")); if (o) { if (o->isInitialized()) diff --git a/engine/server/library/serverGame/src/shared/core/SetupServerGame.cpp b/engine/server/library/serverGame/src/shared/core/SetupServerGame.cpp index a8dadf30..7a047ac5 100755 --- a/engine/server/library/serverGame/src/shared/core/SetupServerGame.cpp +++ b/engine/server/library/serverGame/src/shared/core/SetupServerGame.cpp @@ -65,8 +65,8 @@ void SetupServerGame::install() PositionUpdateTracker::install(); LogoutTracker::install(); AuthTransferTracker::install(); - NonCriticalTaskQueue::install(static_cast(NULL)); - SurveySystem::install(static_cast(NULL)); + NonCriticalTaskQueue::install(static_cast(nullptr)); + SurveySystem::install(static_cast(nullptr)); CreatureObject::install(); NameManager::install(); MessageToQueue::install(); diff --git a/engine/server/library/serverGame/src/shared/core/StaticLootItemManager.cpp b/engine/server/library/serverGame/src/shared/core/StaticLootItemManager.cpp index 8202f8d1..9da3852f 100755 --- a/engine/server/library/serverGame/src/shared/core/StaticLootItemManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/StaticLootItemManager.cpp @@ -26,8 +26,8 @@ int const MAX_ATTRIBS = 2000; void StaticLootItemManager::sendDataToClient(NetworkId const & playerId, std::string const & staticItemName) { Object * const o = NetworkIdManager::getObjectById(playerId); - ServerObject * const so = o ? o->asServerObject() : NULL; - CreatureObject * const co = so ? so->asCreatureObject() : NULL; + ServerObject * const so = o ? o->asServerObject() : nullptr; + CreatureObject * const co = so ? so->asCreatureObject() : nullptr; if(co) { @@ -45,8 +45,8 @@ void StaticLootItemManager::sendDataToClient(NetworkId const & playerId, std::st void StaticLootItemManager::getAttributes(NetworkId const & playerId, std::string const & staticItemName, AttributeVector & data) { Object * const o = NetworkIdManager::getObjectById(playerId); - ServerObject * const so = o ? o->asServerObject() : NULL; - CreatureObject * const co = so ? so->asCreatureObject() : NULL; + ServerObject * const so = o ? o->asServerObject() : nullptr; + CreatureObject * const co = so ? so->asCreatureObject() : nullptr; if(co) { GameScriptObject * const gso = const_cast(co->getScriptObject()); diff --git a/engine/server/library/serverGame/src/shared/core/VeteranRewardManager.cpp b/engine/server/library/serverGame/src/shared/core/VeteranRewardManager.cpp index c9bb11a0..fcc97af2 100755 --- a/engine/server/library/serverGame/src/shared/core/VeteranRewardManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/VeteranRewardManager.cpp @@ -312,7 +312,7 @@ RewardEvent * VeteranRewardManagerNamespace::getRewardEventByName(std::string co if (i!=ms_rewardEvents.end()) return i->second; else - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -323,7 +323,7 @@ RewardItem * VeteranRewardManagerNamespace::getRewardItemByName(std::string cons if (i!=ms_rewardItems.end()) return i->second; else - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -389,7 +389,7 @@ void VeteranRewardManager::getTriggeredEventsIds(CreatureObject const & playerCr if (((*i)->getAccountFeatureId() > 0) && (*i)->getConsumeAccountFeatureId()) { std::vector rewardItems; - getAvailableRewardItemsForEvent(playerCreature, (*i)->getId(), rewardItems, NULL); + getAvailableRewardItemsForEvent(playerCreature, (*i)->getId(), rewardItems, nullptr); if (rewardItems.empty()) continue; @@ -512,7 +512,7 @@ bool VeteranRewardManager::claimRewards(CreatureObject const & playerCreature, s } std::vector possibleRewardItems; - getAvailableRewardItemsForEvent(playerCreature, rewardEventName, possibleRewardItems, NULL); + getAvailableRewardItemsForEvent(playerCreature, rewardEventName, possibleRewardItems, nullptr); if (possibleRewardItems.empty()) { if (debugMessage) @@ -589,7 +589,7 @@ void VeteranRewardManager::handleClaimRewardsReply(StationId stationId, NetworkI static std::vector const emptyMessageData; ServerObject * const so = safe_cast(NetworkIdManager::getObjectById(player)); - CreatureObject * const playerCreature = so ? so->asCreatureObject() : NULL; + CreatureObject * const playerCreature = so ? so->asCreatureObject() : nullptr; if (!playerCreature) return; // player has vanished -- reward claim will be handled by the recovery code at the next login if (!playerCreature->isAuthoritative()) @@ -628,7 +628,7 @@ void VeteranRewardManager::handleClaimRewardsReply(StationId stationId, NetworkI // Check that the requested item can be claimed with this event std::vector possibleRewardItems; - getAvailableRewardItemsForEvent(*playerCreature, rewardEvent, possibleRewardItems, NULL); + getAvailableRewardItemsForEvent(*playerCreature, rewardEvent, possibleRewardItems, nullptr); bool found = false; for (std::vector::const_iterator j=possibleRewardItems.begin(); j!=possibleRewardItems.end(); ++j) @@ -704,7 +704,7 @@ void VeteranRewardManager::handleClaimRewardsReply(StationId stationId, NetworkI params.addParam(item->getCanTradeIn(), "canTradeIn"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(player, "veteranItemGrantSucceeded",dictionary->getSerializedData(),0,false); @@ -808,11 +808,11 @@ time_t VeteranRewardManagerNamespace::yyyymmddToTime(int const yyyy, int const m FATAL(((mm < 1) || (mm > 12)),("Data bug: Reward event date (%d / %d / %d) - month %d specified for a reward event must be between 1 - 12.",mm,dd,yyyy,mm)); FATAL(((dd < 1) || (dd > 31)),("Data bug: Reward event date (%d / %d / %d) - day %d specified for a reward event must be between 1 - 31.",mm,dd,yyyy,dd)); - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * const timeinfo = ::localtime(&rawtime); if (!timeinfo) { - FATAL(true,(":localtime() returns NULL")); + FATAL(true,(":localtime() returns nullptr")); return 0; } @@ -848,7 +848,7 @@ void VeteranRewardManager::getRewardChoicesTags(CreatureObject const & playerCre std::vector rewardItems; - getAvailableRewardItemsForEvent(playerCreature, eventName, rewardItems, NULL); + getAvailableRewardItemsForEvent(playerCreature, eventName, rewardItems, nullptr); for (std::vector::const_iterator i=rewardItems.begin(); i!=rewardItems.end(); ++i) { rewardTagsUnicode.push_back(Unicode::narrowToWide(*i)); @@ -866,7 +866,7 @@ StringId const * VeteranRewardManager::getEventAnnouncement(std::string const & { return &(event->getAnnouncement()); } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -880,7 +880,7 @@ StringId const * VeteranRewardManager::getEventDescription(std::string const & e { return &(event->getDescription()); } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -894,7 +894,7 @@ std::string const * VeteranRewardManager::getEventUrl(std::string const & eventN { return &(event->getUrl()); } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -1147,7 +1147,7 @@ void VeteranRewardManager::tcgRedemption(CreatureObject const & playerCreature, // the redemption int const redemptionTimeout = 300; // 5 minutes; item.removeObjVarItem(ms_tcgRedemptionInProgressObjvar); - item.setObjVarItem(ms_tcgRedemptionInProgressObjvar, static_cast(::time(NULL) + redemptionTimeout)); // 5 minutes + item.setObjVarItem(ms_tcgRedemptionInProgressObjvar, static_cast(::time(nullptr) + redemptionTimeout)); // 5 minutes // send off request to adjust the account feature Id AdjustAccountFeatureIdRequest const msg(NetworkId::cms_invalid, GameServer::getInstance().getProcessId(), playerCreature.getNetworkId(), PlayerObject::getAccountDescription(&playerCreature), playerPlayer->getStationId(), item.getNetworkId(), ServerObject::getLogDescription(&item), PlatformGameCode::SWGTCG, static_cast(featureId), adjustment); @@ -1169,7 +1169,7 @@ bool VeteranRewardManager::checkForTcgRedemptionInProgress(ServerObject const & int redemptionTimeout; IGNORE_RETURN(item.getObjVars().getItem(ms_tcgRedemptionInProgressObjvar, redemptionTimeout)); - time_t const currentTime = ::time(NULL); + time_t const currentTime = ::time(nullptr); if (redemptionTimeout > currentTime) { // item should be in top level inventory; get the player object the item is in @@ -1308,7 +1308,7 @@ bool VeteranRewardManager::tradeInReward(CreatureObject const & playerCreature, if (itemClaimTime > 0) { time_t timeRedeem = itemClaimTime + static_cast(ConfigServerGame::getVeteranRewardTradeInWaitPeriodSeconds()); - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); // see if the item has its own trade-in wait period if (itemObjvar.hasItem("rewardTradeInWaitPeriod") && (itemObjvar.getType("rewardTradeInWaitPeriod") == DynamicVariable::INT)) @@ -1337,7 +1337,7 @@ bool VeteranRewardManager::tradeInReward(CreatureObject const & playerCreature, // the trade in int const redemptionTimeout = 300; // 5 minutes; item.removeObjVarItem(ms_tradeInInProgressObjvar); - item.setObjVarItem(ms_tradeInInProgressObjvar, static_cast(::time(NULL) + redemptionTimeout)); // 5 minutes + item.setObjVarItem(ms_tradeInInProgressObjvar, static_cast(::time(nullptr) + redemptionTimeout)); // 5 minutes // send off request to adjust the account feature Id AdjustAccountFeatureIdRequest const msg(NetworkId::cms_invalid, GameServer::getInstance().getProcessId(), playerCreature.getNetworkId(), PlayerObject::getAccountDescription(&playerCreature), playerPlayer->getStationId(), item.getNetworkId(), ServerObject::getLogDescription(&item), PlatformGameCode::SWG, static_cast(featureId), 1); @@ -1361,7 +1361,7 @@ bool VeteranRewardManager::checkForTradeInInProgress(ServerObject const & item) int redemptionTimeout; IGNORE_RETURN(item.getObjVars().getItem(ms_tradeInInProgressObjvar, redemptionTimeout)); - time_t const currentTime = ::time(NULL); + time_t const currentTime = ::time(nullptr); if (redemptionTimeout > currentTime) { // item should be in top level inventory; get the player object the item is in @@ -1742,7 +1742,7 @@ RewardEvent::RewardEvent(DataTable const & dataTable, int row) : m_id(dataTable.getStringValue("id",row)), m_specificItems(buildVectorFromString(dataTable.getStringValue("Items",row))), m_includeItemsFrom(buildVectorFromString(dataTable.getStringValue("Include Items From",row))), - m_allItems(NULL), + m_allItems(nullptr), m_category(dataTable.getIntValue("Category", row)), m_featureBitRewardExclusionMask(dataTable.getIntValue("Feature Bit Reward Exclusion Mask", row)), m_accountFlags(static_cast(dataTable.getIntValue("Account Flags",row))), @@ -1839,7 +1839,7 @@ bool RewardEvent::hasPlayerTriggered(CreatureObject const & playerCreature) cons if (m_startDate != 0 || m_endDate != 0) { - time_t currentTime = time(NULL); + time_t currentTime = time(nullptr); if ((m_startDate != 0 && currentTime < m_startDate) || (m_endDate != 0 && currentTime > m_endDate)) return false; diff --git a/engine/server/library/serverGame/src/shared/guild/GuildInterface.cpp b/engine/server/library/serverGame/src/shared/guild/GuildInterface.cpp index f30669aa..7f8f07c8 100755 --- a/engine/server/library/serverGame/src/shared/guild/GuildInterface.cpp +++ b/engine/server/library/serverGame/src/shared/guild/GuildInterface.cpp @@ -43,11 +43,11 @@ namespace GuildInterfaceNamespace bool s_needEnemiesRebuild; // dictionary containing the table showing all active guild wars with at least 1 kill - ScriptParams * s_activeGuildWars = NULL; + ScriptParams * s_activeGuildWars = nullptr; bool s_activeGuildWarsNeedRebuild = true; // dictionary containing the table showing the 100 most recently ended guild wars with at least 1 kill - ScriptParams * s_inactiveGuildWars = NULL; + ScriptParams * s_inactiveGuildWars = nullptr; int s_inactiveGuildWarsMostRecentUpdateIndex = 0; typedef std::map PendingChannelAddList; //using a map to make it easier to prevent redundant entries @@ -99,7 +99,7 @@ namespace GuildInterfaceNamespace const char * makeCopyOfString(const char * rhs) { - char * lhs = NULL; + char * lhs = nullptr; if (rhs) { lhs = new char[strlen(rhs) + 1]; @@ -245,7 +245,7 @@ std::pair const *GuildInterface::hasDeclaredWarAgainst(int actorGui } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -662,7 +662,7 @@ ScriptParams const *GuildInterface::getMasterGuildWarTableDictionary() } delete s_activeGuildWars; - s_activeGuildWars = NULL; + s_activeGuildWars = nullptr; // build the table if (!guildMutuallyAtWarWithKillSummary.empty()) @@ -810,9 +810,9 @@ void GuildInterface::updateInactiveGuildWarTrackingInfo(GuildObject &masterGuild // guild with higher kill count appears first if (guildAKillCount > guildBKillCount) - IGNORE_RETURN(masterGuildObject.setObjVarItem(FormattedString<32>().sprintf("%s.%d", s_objvarInactiveGuildWarsPrefix.c_str(), nextIndex), FormattedString<512>().sprintf("%s~%s~%d~%s~%s~%d~%ld", giA->m_name.c_str(), giA->m_abbrev.c_str(), guildAKillCount, giB->m_name.c_str(), giB->m_abbrev.c_str(), guildBKillCount, ::time(NULL)))); + IGNORE_RETURN(masterGuildObject.setObjVarItem(FormattedString<32>().sprintf("%s.%d", s_objvarInactiveGuildWarsPrefix.c_str(), nextIndex), FormattedString<512>().sprintf("%s~%s~%d~%s~%s~%d~%ld", giA->m_name.c_str(), giA->m_abbrev.c_str(), guildAKillCount, giB->m_name.c_str(), giB->m_abbrev.c_str(), guildBKillCount, ::time(nullptr)))); else - IGNORE_RETURN(masterGuildObject.setObjVarItem(FormattedString<32>().sprintf("%s.%d", s_objvarInactiveGuildWarsPrefix.c_str(), nextIndex), FormattedString<512>().sprintf("%s~%s~%d~%s~%s~%d~%ld", giB->m_name.c_str(), giB->m_abbrev.c_str(), guildBKillCount, giA->m_name.c_str(), giA->m_abbrev.c_str(), guildAKillCount, ::time(NULL)))); + IGNORE_RETURN(masterGuildObject.setObjVarItem(FormattedString<32>().sprintf("%s.%d", s_objvarInactiveGuildWarsPrefix.c_str(), nextIndex), FormattedString<512>().sprintf("%s~%s~%d~%s~%s~%d~%ld", giB->m_name.c_str(), giB->m_abbrev.c_str(), guildBKillCount, giA->m_name.c_str(), giA->m_abbrev.c_str(), guildAKillCount, ::time(nullptr)))); IGNORE_RETURN(masterGuildObject.setObjVarItem(s_objvarInactiveGuildWarsMostRecentIndex, nextIndex)); } @@ -869,7 +869,7 @@ ScriptParams const *GuildInterface::getInactiveGuildWarTableDictionary() if (!objVars.getItem(FormattedString<32>().sprintf("%s.%d", s_objvarInactiveGuildWarsPrefix.c_str(), currentIndex), guildWarData)) break; - if (!Unicode::tokenize(guildWarData, tokens, &delimiters, NULL) || (tokens.size() != 7)) + if (!Unicode::tokenize(guildWarData, tokens, &delimiters, nullptr) || (tokens.size() != 7)) break; scriptParamsGuildAName->push_back(new Unicode::String(tokens[0])); @@ -891,7 +891,7 @@ ScriptParams const *GuildInterface::getInactiveGuildWarTableDictionary() } delete s_inactiveGuildWars; - s_inactiveGuildWars = NULL; + s_inactiveGuildWars = nullptr; if (!scriptParamsGuildAName->empty()) { @@ -1120,7 +1120,7 @@ void GuildInterface::updateGuildWarKillTracking(CreatureObject const &killer, Cr && hasDeclaredWarAgainst(killer.getGuildId(), victim.getGuildId()) && hasDeclaredWarAgainst(victim.getGuildId(), killer.getGuildId())) { - ServerUniverse::getInstance().getMasterGuildObject()->modifyGuildWarKillTracking(killer.getGuildId(), victim.getGuildId(), 1, static_cast(::time(NULL))); + ServerUniverse::getInstance().getMasterGuildObject()->modifyGuildWarKillTracking(killer.getGuildId(), victim.getGuildId(), 1, static_cast(::time(nullptr))); } } diff --git a/engine/server/library/serverGame/src/shared/metrics/GameServerMetricsData.cpp b/engine/server/library/serverGame/src/shared/metrics/GameServerMetricsData.cpp index 96c0d19b..170181d6 100755 --- a/engine/server/library/serverGame/src/shared/metrics/GameServerMetricsData.cpp +++ b/engine/server/library/serverGame/src/shared/metrics/GameServerMetricsData.cpp @@ -239,7 +239,7 @@ void GameServerMetricsData::updateData() "Max: %s requested load on %s which has been pending for %s. Limit = %d.", id.getValueString().c_str(), CalendarTime::convertEpochToTimeStringLocal(oldestPendingLoadRequestTime).c_str(), - CalendarTime::convertSecondsToMS((int)::time(NULL) - oldestPendingLoadRequestTime).c_str(), + CalendarTime::convertSecondsToMS((int)::time(nullptr) - oldestPendingLoadRequestTime).c_str(), GameServer::getPendingLoadRequestLimit() ); else diff --git a/engine/server/library/serverGame/src/shared/network/Chat.cpp b/engine/server/library/serverGame/src/shared/network/Chat.cpp index 209ee89d..fede9920 100755 --- a/engine/server/library/serverGame/src/shared/network/Chat.cpp +++ b/engine/server/library/serverGame/src/shared/network/Chat.cpp @@ -64,7 +64,7 @@ using namespace ChatNamespace; //----------------------------------------------------------------------- -Chat *Chat::m_instance = NULL; +Chat *Chat::m_instance = nullptr; Chat::Chat () : diff --git a/engine/server/library/serverGame/src/shared/network/ConnectionServerConnection.cpp b/engine/server/library/serverGame/src/shared/network/ConnectionServerConnection.cpp index b6af7d42..f47cfe43 100755 --- a/engine/server/library/serverGame/src/shared/network/ConnectionServerConnection.cpp +++ b/engine/server/library/serverGame/src/shared/network/ConnectionServerConnection.cpp @@ -194,7 +194,7 @@ void ConnectionServerConnection::onReceive (const Archive::ByteStream & message) } } else - LOG("CustomerService", ("CharacterTransfer: character object was NULL so unable to check if bank is loaded")); + LOG("CustomerService", ("CharacterTransfer: character object was nullptr so unable to check if bank is loaded")); } @@ -224,10 +224,10 @@ void ConnectionServerConnection::onReceive (const Archive::ByteStream & message) } } else - LOG("CustomerService", ("CharacterTransfer: bank container object was NULL for getBankContainer call")); + LOG("CustomerService", ("CharacterTransfer: bank container object was nullptr for getBankContainer call")); } else - LOG("CustomerService", ("CharacterTransfer: character object was NULL so unable to check if bank is loaded")); + LOG("CustomerService", ("CharacterTransfer: character object was nullptr so unable to check if bank is loaded")); } else if (m.isType("RequestTransferData")) { @@ -237,7 +237,7 @@ void ConnectionServerConnection::onReceive (const Archive::ByteStream & message) CreatureObject * const character = dynamic_cast(NetworkIdManager::getObjectById(requestTransferData.getValue().getCharacterId())); PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(character); time_t characterCreateTime = -1; - FreeCtsDataTable::FreeCtsInfo const * freeCtsInfo = NULL; + FreeCtsDataTable::FreeCtsInfo const * freeCtsInfo = nullptr; bool freeCtsBypassTimeRestriction = false; if (character && playerObject) { @@ -292,7 +292,7 @@ void ConnectionServerConnection::onReceive (const Archive::ByteStream & message) for (CreatureObject::SkillList::const_iterator i = skills.begin(); i != skills.end(); ++i) { const SkillObject * profession = (*i)->findProfessionForSkill(); - if (profession != NULL) + if (profession != nullptr) professionName = profession->getSkillName(); } } @@ -414,7 +414,7 @@ void ConnectionServerConnection::onReceive (const Archive::ByteStream & message) unsigned int result = CHATRESULT_SUCCESS; ServerObject const * const o = ServerWorld::findObjectByNetworkId(cervreq.getValue().first.first); - CreatureObject const * const co = (o ? o->asCreatureObject() : NULL); + CreatureObject const * const co = (o ? o->asCreatureObject() : nullptr); if (co) { result = Chat::isAllowedToEnterRoom(*co, cervreq.getValue().first.second); @@ -440,7 +440,7 @@ void ConnectionServerConnection::onReceive (const Archive::ByteStream & message) bool success = false; ServerObject const * const o = ServerWorld::findObjectByNetworkId(cqrvreq.getValue().first.first); - CreatureObject const * const co = (o ? o->asCreatureObject() : NULL); + CreatureObject const * const co = (o ? o->asCreatureObject() : nullptr); if (co) { success = (CHATRESULT_SUCCESS == Chat::isAllowedToEnterRoom(*co, cqrvreq.getValue().first.second)); diff --git a/engine/server/library/serverGame/src/shared/network/CustomerServiceServerConnection.cpp b/engine/server/library/serverGame/src/shared/network/CustomerServiceServerConnection.cpp index 456ec031..cb1df8fd 100755 --- a/engine/server/library/serverGame/src/shared/network/CustomerServiceServerConnection.cpp +++ b/engine/server/library/serverGame/src/shared/network/CustomerServiceServerConnection.cpp @@ -58,12 +58,12 @@ void CustomerServiceServerConnection::onReceive(const Archive::ByteStream & mess ChatRequestLog chatRequestLog(ri); Object * const reportingObject = NetworkIdManager::getObjectById(NetworkId(Unicode::wideToNarrow(chatRequestLog.getPlayer()))); - if ( (reportingObject != NULL) + if ( (reportingObject != nullptr) && reportingObject->isAuthoritative()) { PlayerObject const * const reportingPlayerObject = PlayerCreatureController::getPlayerObject(CreatureObject::asCreatureObject(reportingObject)); - if (reportingPlayerObject != NULL) + if (reportingPlayerObject != nullptr) { PlayerObject::ChatLog const &reportingPlayerChatLog = reportingPlayerObject->getChatLog(); PlayerObject::ChatLog::const_iterator iterReportingPlayerChatLog = reportingPlayerChatLog.begin(); diff --git a/engine/server/library/serverGame/src/shared/network/GameServerMessageArchive.cpp b/engine/server/library/serverGame/src/shared/network/GameServerMessageArchive.cpp index bf76972f..d66d70fb 100755 --- a/engine/server/library/serverGame/src/shared/network/GameServerMessageArchive.cpp +++ b/engine/server/library/serverGame/src/shared/network/GameServerMessageArchive.cpp @@ -31,7 +31,7 @@ GameServerMessageArchive::~GameServerMessageArchive() void GameServerMessageArchive::install() { - if (getInstance() == NULL) + if (getInstance() == nullptr) { setInstance(new GameServerMessageArchive); ExitChain::add(GameServerMessageArchive::remove, "GameServerMessageArchive::remove"); diff --git a/engine/server/library/serverGame/src/shared/object/BuildingObject.cpp b/engine/server/library/serverGame/src/shared/object/BuildingObject.cpp index ed2eb7de..cdc6289f 100755 --- a/engine/server/library/serverGame/src/shared/object/BuildingObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/BuildingObject.cpp @@ -140,7 +140,7 @@ using namespace BuildingObjectNamespace; // ====================================================================== -const SharedObjectTemplate * BuildingObject::m_defaultSharedTemplate = NULL; +const SharedObjectTemplate * BuildingObject::m_defaultSharedTemplate = nullptr; // ====================================================================== @@ -380,13 +380,13 @@ const SharedObjectTemplate * BuildingObject::getDefaultSharedTemplate(void) cons { static const ConstCharCrcLowerString templateName("object/building/base/shared_building_default.iff"); - if (m_defaultSharedTemplate == NULL) + if (m_defaultSharedTemplate == nullptr) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create " + WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create " "default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) ExitChain::add (removeDefaultTemplate, "BuildingObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -399,10 +399,10 @@ static const ConstCharCrcLowerString templateName("object/building/base/shared_b */ void BuildingObject::removeDefaultTemplate(void) { - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } // BuildingObject::removeDefaultTemplate @@ -432,7 +432,7 @@ void BuildingObject::expelObject(ServerObject &who) if (controller) { CellProperty *parentCell = getParentCell(); - ServerObject *destinationCellObject = NULL; + ServerObject *destinationCellObject = nullptr; if (!parentCell->isWorldCell()) destinationCellObject = safe_cast(&parentCell->getOwner()); @@ -902,7 +902,7 @@ void BuildingObject::changeTeleportDestination(Vector & position, float & yaw) c { DataTable * respawnTable = DataTableManager::getTable(CLONE_RESPAWN_TABLE, true); - if (respawnTable != NULL) + if (respawnTable != nullptr) { int row = respawnTable->searchColumnString(0, getTemplateName()); if (row >= 0) diff --git a/engine/server/library/serverGame/src/shared/object/CellObject.cpp b/engine/server/library/serverGame/src/shared/object/CellObject.cpp index b2c6f994..e0211aa5 100755 --- a/engine/server/library/serverGame/src/shared/object/CellObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/CellObject.cpp @@ -39,7 +39,7 @@ #include -const SharedObjectTemplate * CellObject::m_defaultSharedTemplate = NULL; +const SharedObjectTemplate * CellObject::m_defaultSharedTemplate = nullptr; // ====================================================================== @@ -99,13 +99,13 @@ const SharedObjectTemplate * CellObject::getDefaultSharedTemplate(void) const { static const ConstCharCrcLowerString templateName("object/cell/base/shared_cell_default.iff"); - if (m_defaultSharedTemplate == NULL) + if (m_defaultSharedTemplate == nullptr) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create " + WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create " "default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) ExitChain::add (removeDefaultTemplate, "CellObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -118,10 +118,10 @@ static const ConstCharCrcLowerString templateName("object/cell/base/shared_cell_ */ void CellObject::removeDefaultTemplate(void) { - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } // CellObject::removeDefaultTemplate @@ -161,7 +161,7 @@ void CellObject::endBaselines() } Object *container = ContainerInterface::getContainedByObject(*this); - PortalProperty *portalProperty = NULL; + PortalProperty *portalProperty = nullptr; if (container) { portalProperty = container->getPortalProperty(); @@ -531,31 +531,31 @@ bool CellObject::isAllowed(CreatureObject const &who) const bool CellObject::getClosestPathNodePos( const ServerObject & object, Vector & outPos ) const { - const PathNode * closestNode = NULL; + const PathNode * closestNode = nullptr; float closestDistance = 0; const Vector objectPos = object.getPosition_w(); const CellProperty * cell = ContainerInterface::getCell(*this); - if (cell != NULL) + if (cell != nullptr) { const Floor * floor = cell->getFloor(); - if (floor != NULL) + if (floor != nullptr) { const FloorMesh * mesh = floor->getFloorMesh(); - if (mesh != NULL) + if (mesh != nullptr) { const PathGraph * path = safe_cast(mesh->getPathGraph()); - if (path != NULL) + if (path != nullptr) { int nodeCount = path->getNodeCount(); for (int i = 0; i < nodeCount; ++i) { const PathNode * node = path->getNode(i); - if (node != NULL) + if (node != nullptr) { float distance = objectPos.magnitudeBetweenSquared( rotateTranslate_p2w(node->getPosition_p())); - if (closestNode == NULL || distance < closestDistance) + if (closestNode == nullptr || distance < closestDistance) { closestNode = node; closestDistance = distance; @@ -567,9 +567,9 @@ bool CellObject::getClosestPathNodePos( const ServerObject & object, Vector & ou } } - if (closestNode != NULL) + if (closestNode != nullptr) outPos = closestNode->getPosition_p(); - return closestNode != NULL; + return closestNode != nullptr; } // ---------------------------------------------------------------------- @@ -648,7 +648,7 @@ void CellObject::onContainerLostItem(ServerObject * destination, ServerObject& i obj->getScriptObject()->trigAllScripts(Scripting::TRIG_LOST_ITEM, params); BuildingObject * const b_obj = getOwnerBuilding(); - if (b_obj && item.isPlayerControlled() && destination == NULL) + if (b_obj && item.isPlayerControlled() && destination == nullptr) { b_obj->lostPlayer(item); } @@ -772,8 +772,8 @@ CellObject * CellObject::getCellObject(NetworkId const & networkId) CellObject * CellObject::asCellObject(Object * object) { - ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; - CellObject * const cellObject = (serverObject != NULL) ? serverObject->asCellObject() : NULL; + ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; + CellObject * const cellObject = (serverObject != nullptr) ? serverObject->asCellObject() : nullptr; return cellObject; } @@ -782,8 +782,8 @@ CellObject * CellObject::asCellObject(Object * object) CellObject const * CellObject::asCellObject(Object const * object) { - ServerObject const * const serverObject = (object != NULL) ? object->asServerObject() : NULL; - CellObject const * const cellObject = (serverObject != NULL) ? serverObject->asCellObject() : NULL; + ServerObject const * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; + CellObject const * const cellObject = (serverObject != nullptr) ? serverObject->asCellObject() : nullptr; return cellObject; } diff --git a/engine/server/library/serverGame/src/shared/object/CityObject.cpp b/engine/server/library/serverGame/src/shared/object/CityObject.cpp index f8fd1778..da741dbf 100755 --- a/engine/server/library/serverGame/src/shared/object/CityObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/CityObject.cpp @@ -130,9 +130,9 @@ void CityObject::setupUniverse() // build the city info from data read in from DB // disable notification while building the initial list - m_citizensInfo.setOnErase(NULL, NULL); - m_citizensInfo.setOnInsert(NULL, NULL); - m_citizensInfo.setOnSet(NULL, NULL); + m_citizensInfo.setOnErase(nullptr, nullptr); + m_citizensInfo.setOnInsert(nullptr, nullptr); + m_citizensInfo.setOnSet(nullptr, nullptr); // build cities std::map tempCities; @@ -462,7 +462,7 @@ int CityObject::createCity(std::string const &cityName, NetworkId const &cityHal incomeTax, propertyTax, salesTax, travelLoc, travelCost, travelInterplanetary, cloneLoc, cloneRespawn, cloneRespawnCell, cloneId); - ci.setCityCreationTime(static_cast(::time(NULL))); + ci.setCityCreationTime(static_cast(::time(nullptr))); m_citiesInfo.set(cityId, ci); std::string citySpec; @@ -1724,7 +1724,7 @@ CitizenInfo const * CityObject::getCitizenSpec(int cityId, NetworkId const &citi } result.clear(); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -1739,7 +1739,7 @@ CityStructureInfo const * CityObject::getCityStructureSpec(int cityId, NetworkId } result.clear(); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -1975,7 +1975,7 @@ CitizenInfo const *CityObject::getCitizenInfo(int cityId, NetworkId const &citiz if (iterFind != m_citizensInfo.end()) return &(iterFind->second); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -2008,7 +2008,7 @@ CityStructureInfo const *CityObject::getCityStructureInfo(int cityId, NetworkId if (iterFind != m_structuresInfo.end()) return &(iterFind->second); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -2071,7 +2071,7 @@ PgcRatingInfo const * CityObject::getPgcRating(NetworkId const &chroniclerId) co if (iterFind != m_pgcRatingInfo.end()) return &(iterFind->second); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -2141,7 +2141,7 @@ void CityObject::adjustPgcRating(NetworkId const &chroniclerId, std::string cons m_pgcRatingChroniclerId.insert(std::make_pair(NameManager::normalizeName(updatedPgcRating.m_chroniclerName), chroniclerId)); } - updatedPgcRating.m_lastRatingTime = static_cast(::time(NULL)); + updatedPgcRating.m_lastRatingTime = static_cast(::time(nullptr)); std::string updatedPgcRatingSpec; CityStringParser::buildPgcRatingSpec(chroniclerId, updatedPgcRating, updatedPgcRatingSpec); diff --git a/engine/server/library/serverGame/src/shared/object/CreatureObject.cpp b/engine/server/library/serverGame/src/shared/object/CreatureObject.cpp index 336f2058..73803c0a 100755 --- a/engine/server/library/serverGame/src/shared/object/CreatureObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/CreatureObject.cpp @@ -189,7 +189,7 @@ //---------------------------------------------------------------------- // static CreatureObject vars -const SharedObjectTemplate * CreatureObject::m_defaultSharedTemplate = NULL; +const SharedObjectTemplate * CreatureObject::m_defaultSharedTemplate = nullptr; //---------------------------------------------------------------------- @@ -661,9 +661,9 @@ float MonitoredCreatureMovement::operator-(MonitoredCreatureMovement const &othe CreatureObject::CreatureObject(const ServerCreatureObjectTemplate* newTemplate) : TangibleObject(newTemplate), - m_commandQueue(NULL), + m_commandQueue(nullptr), m_isStatic(false), - m_shield(NULL), + m_shield(nullptr), m_regenerationTime(0), m_attributes(Attributes::NumberOfAttributes), m_maxAttributes(Attributes::NumberOfAttributes), @@ -942,7 +942,7 @@ CreatureObject::~CreatureObject() trade->cancelTrade(*this); } // AICreatureController * aiController = AICreatureController::asAiCreatureController(controller); -// if (aiController != NULL) +// if (aiController != nullptr) // { // aiController->stop(); // } @@ -1083,15 +1083,15 @@ const SharedObjectTemplate * CreatureObject::getDefaultSharedTemplate() const { static const ConstCharCrcLowerString templateName("object/creature/base/shared_creature_default.iff"); - if (m_defaultSharedTemplate == NULL) + if (m_defaultSharedTemplate == nullptr) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - DEBUG_WARNING(m_defaultSharedTemplate == NULL, ("Cannot create " + DEBUG_WARNING(m_defaultSharedTemplate == nullptr, ("Cannot create " "default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) ExitChain::add (removeDefaultTemplate, "CreatureObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -1104,10 +1104,10 @@ static const ConstCharCrcLowerString templateName("object/creature/base/shared_c */ void CreatureObject::removeDefaultTemplate() { - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } // CreatureObject::removeDefaultTemplate @@ -1192,7 +1192,7 @@ void CreatureObject::runSpawnQueue() ScriptParams params; ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(id, "spawn_Trigger", dictionary->getSerializedData(), 0, false); @@ -1263,7 +1263,7 @@ bool CreatureObject::assignMission(MissionObject * missionObject) } Container::ContainerErrorCode tmp = Container::CEC_Success; - result = ContainerInterface::transferItemToGeneralContainer(*datapad, *missionObject, NULL, tmp); + result = ContainerInterface::transferItemToGeneralContainer(*datapad, *missionObject, nullptr, tmp); if(result) { missionObject->setMissionHolderId(getNetworkId()); @@ -1725,7 +1725,7 @@ void CreatureObject::forwardServerObjectSpecificBaselines() const TangibleObject::forwardServerObjectSpecificBaselines(); Property const * const property = getProperty(SlowDownProperty::getClassPropertyId()); - if (property != NULL) + if (property != nullptr) { SlowDownProperty const * const slowdownProperty = safe_cast(property); @@ -1736,7 +1736,7 @@ void CreatureObject::forwardServerObjectSpecificBaselines() const // if we are an ai creature, have our controller send our current ai state AICreatureController const * const aiCreatureController = AICreatureController::asAiCreatureController(getController()); - if (aiCreatureController != NULL) + if (aiCreatureController != nullptr) { aiCreatureController->forwardServerObjectSpecificBaselines(); } @@ -1749,7 +1749,7 @@ void CreatureObject::sendObjectSpecificBaselinesToClient(Client const &client) c TangibleObject::sendObjectSpecificBaselinesToClient(client); Property const * const property = getProperty(SlowDownProperty::getClassPropertyId()); - if (property != NULL) + if (property != nullptr) { SlowDownProperty const * const slowdownProperty = safe_cast(property); @@ -1778,7 +1778,7 @@ void CreatureObject::initializeFirstTimeObject() // set the current weapon WeaponObject * weapon = getReadiedWeapon(); - if (weapon != NULL) + if (weapon != nullptr) setCurrentWeapon(*weapon); #ifdef _DEBUG @@ -1835,7 +1835,7 @@ void CreatureObject::onLoadedFromDatabase() { Container::ContainedItem itemId = container->getObjectInSlot(slot, tmp); Object* appearanceInventory = itemId.getObject(); - if(appearanceInventory == NULL) + if(appearanceInventory == nullptr) { WARNING(true, ("Player %s has lost their appearance inventory", getNetworkId().getValueString().c_str())); appearanceInventory = ServerWorld::createNewObject(s_appearanceTemplate, *this, slot, false); @@ -1941,7 +1941,7 @@ void CreatureObject::onLoadedFromDatabase() if (i.getValue(ctsTransactionDetail)) { Unicode::UnicodeStringVector tokens; - if (Unicode::tokenize(ctsTransactionDetail, tokens, NULL, NULL) && (tokens.size() >= 4)) + if (Unicode::tokenize(ctsTransactionDetail, tokens, nullptr, nullptr) && (tokens.size() >= 4)) { int const transferTime = atoi(Unicode::wideToNarrow(tokens[0]).c_str()); if ((earliestTransferTime == -1) || (transferTime < earliestTransferTime)) @@ -1978,7 +1978,7 @@ void CreatureObject::onLoadedFromDatabase() } // set "born on " collection slot and clear all the other "born on " collection slots; - // this still needs to be run even if collectionSlot is NULL in order to forcefully clear all of the + // this still needs to be run even if collectionSlot is nullptr in order to forcefully clear all of the // other "born on " collection slots, since we are reusing deleted/no longer used collection // slot bits, and those bits may be left in a set state at the time they were deleted/no longer used std::vector const & slots = CollectionsDataTable::getSlotsInCollection("born_on_collection"); @@ -2064,7 +2064,7 @@ void CreatureObject::onLoadedFromDatabase() std::vector > skillModBonuses; std::vector > attribBonuses; Container const * const equipment = ContainerInterface::getContainer(*this); - if (equipment != NULL) + if (equipment != nullptr) { for (ContainerConstIterator i(equipment->begin()); i != equipment->end(); ++i) { @@ -2072,7 +2072,7 @@ void CreatureObject::onLoadedFromDatabase() if (so) { TangibleObject const * const equippedItem = so->asTangibleObject(); - if (equippedItem != NULL) + if (equippedItem != nullptr) { equippedItem->getSkillModBonuses(skillModBonuses); int bonusCount = skillModBonuses.size(); @@ -2110,7 +2110,7 @@ void CreatureObject::onLoadedFromDatabase() setDefaultAlterTime(defaultAlterTime); CreatureController * controller = getCreatureController(); - if (controller != NULL) + if (controller != nullptr) controller->updateHibernate(); } } @@ -2379,7 +2379,7 @@ void CreatureObject::endBaselines() void CreatureObject::checkAndRestoreRequiredSlots() { SlottedContainer * const container = ContainerInterface::getSlottedContainer(*this); - if (container == NULL) + if (container == nullptr) { WARNING_STRICT_FATAL(true, ("This creature is not slotted!")); return; @@ -2422,7 +2422,7 @@ void CreatureObject::checkAndRestoreRequiredSlots() { Container::ContainedItem itemId = container->getObjectInSlot(slot, tmp); Object* inventory = itemId.getObject(); - if (inventory == NULL) + if (inventory == nullptr) { WARNING(true, ("Player %s has lost their inventory", getNetworkId().getValueString().c_str())); inventory = ServerWorld::createNewObject(s_inventoryTemplate, *this, slot, false); @@ -2438,7 +2438,7 @@ void CreatureObject::checkAndRestoreRequiredSlots() { Container::ContainedItem itemId = container->getObjectInSlot(slot, tmp); Object* datapad = itemId.getObject(); - if (datapad == NULL) + if (datapad == nullptr) { WARNING(true, ("Player %s has lost their datapad", getNetworkId().getValueString().c_str())); datapad = ServerWorld::createNewObject(s_datapadTemplate, *this, slot, false); @@ -2454,7 +2454,7 @@ void CreatureObject::checkAndRestoreRequiredSlots() { Container::ContainedItem itemId = container->getObjectInSlot(slot, tmp); ServerObject* missionBag = safe_cast(itemId.getObject()); - if (missionBag == NULL) + if (missionBag == nullptr) { WARNING(true, ("Player %s has lost their mission bag", getNetworkId().getValueString().c_str())); missionBag = ServerWorld::createNewObject(s_missionBagTemplate, *this, slot, false); @@ -2472,7 +2472,7 @@ void CreatureObject::checkAndRestoreRequiredSlots() { Container::ContainedItem itemId = container->getObjectInSlot(slot, tmp); ServerObject* bank = safe_cast(itemId.getObject()); - if (bank == NULL) + if (bank == nullptr) { WARNING(true, ("Player %s has lost their bank", getNetworkId().getValueString().c_str())); bank = ServerWorld::createNewObject(s_bankTemplate, *this, slot, false); @@ -2502,7 +2502,7 @@ void CreatureObject::onRemovingFromWorld() { // if we are crafting, end the crafting session PlayerObject * const player = PlayerCreatureController::getPlayerObject(this); - if (player != NULL && player->isCrafting()) + if (player != nullptr && player->isCrafting()) player->stopCrafting(false); // exit all notify regions @@ -2541,7 +2541,7 @@ void CreatureObject::addToWorld() Object::addToWorld(); updateTriggerVolumes(); - if (getScriptObject() != NULL) + if (getScriptObject() != nullptr) getScriptObject()->setOwnerIsLoaded(); ContainedByProperty * const containedByProperty = getContainedByProperty(); @@ -2607,7 +2607,7 @@ void CreatureObject::setupSkillData() clearCommands(); PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if (playerObject != NULL) + if (playerObject != nullptr) { playerObject->clearSchematics(); } @@ -2679,7 +2679,7 @@ void CreatureObject::setupSkillData() DynamicVariableList::NestedList::const_iterator i(schematics.begin()); for (; i != schematics.end(); ++i) { - grantSchematic(strtoul(i.getName().c_str(), NULL, 10), true); + grantSchematic(strtoul(i.getName().c_str(), nullptr, 10), true); } } @@ -2711,7 +2711,7 @@ Controller* CreatureObject::createDefaultController () AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(controller); - if (aiCreatureController != NULL) + if (aiCreatureController != nullptr) { aiCreatureController->addServerNpAutoDeltaVariables(m_serverPackage_np); } @@ -2758,7 +2758,7 @@ void CreatureObject::setAuthServerProcessId(uint32 processId) if (oldProcess != getAuthServerProcessId()) { // we can't trade if we are on different servers, so cancel it - if (getCreatureController()->getSecureTrade() != NULL) + if (getCreatureController()->getSecureTrade() != nullptr) { getCreatureController()->getSecureTrade()->cancelTrade(*this); } @@ -2786,7 +2786,7 @@ float CreatureObject::alter(float time) // If the player is trading, cancel the trade. // We need to force the issue to catch edge cases. ServerSecureTrade * const secureTradeObject = getCreatureController()->getSecureTrade(); - if (secureTradeObject != NULL) + if (secureTradeObject != nullptr) { secureTradeObject->cancelTrade(*this); } @@ -2854,7 +2854,7 @@ float CreatureObject::alter(float time) if (playerObject->getIsUnsticking() && getPositionChanged()) { - Chat::sendSystemMessageSimple(*this, SharedStringIds::unstick_request_cancelled, NULL); + Chat::sendSystemMessageSimple(*this, SharedStringIds::unstick_request_cancelled, nullptr); playerObject->setIsUnsticking(false); } } @@ -2862,13 +2862,13 @@ float CreatureObject::alter(float time) if (!ServerWorld::isSpaceScene()) { // if we're in a conversation, end it if we move too far from the npc - if (m_npcConversation != NULL) + if (m_npcConversation != nullptr) { PROFILER_AUTO_BLOCK_DEFINE("CreatureObject::alter::npcConvCheck"); bool endConversation = false; // check the distance to the npc ServerObject const * const npc = safe_cast(m_npcConversation->getNPC().getObject()); - if (npc != NULL) + if (npc != nullptr) { float distance = findPosition_w().magnitudeBetween(npc->findPosition_w()); distance -= getRadius(); @@ -2894,7 +2894,7 @@ float CreatureObject::alter(float time) // see if we are performing a slow down effect Property * property = getProperty(SlowDownProperty::getClassPropertyId()); - if (property != NULL) + if (property != nullptr) { // has it expired? SlowDownProperty * slowdown = safe_cast(property); @@ -2909,7 +2909,7 @@ float CreatureObject::alter(float time) // area, and and tell them they are moving on our effect "hill" during their next alter // (player creatures are handled on the player's client) Object * target = slowdown->getTarget().getObject(); - if (target != NULL) + if (target != nullptr) { std::vector found; ServerWorld::findAuthoritativeNonPlayerCreaturesInCone(*this, *target, slowdown->getConeLength(), slowdown->getConeAngle(), found); @@ -2974,14 +2974,14 @@ bool CreatureObject::canDestroy() const // turn off our default weapon so it won't prevent us from getting // destroyed WeaponObject * defaultWeapon = getDefaultWeapon(); - if (defaultWeapon != NULL) + if (defaultWeapon != nullptr) defaultWeapon->setAsDefaultWeapon(false); bool result = TangibleObject::canDestroy(); if (!result) { // we're not being destroyed, turn our default weapon back on - if (defaultWeapon != NULL) + if (defaultWeapon != nullptr) defaultWeapon->setAsDefaultWeapon(true); } @@ -3007,22 +3007,22 @@ void CreatureObject::initializeDefaultWeapon() FATAL(!isAuthoritative(), ("CreatureObject::initializeDefaultWeapon: obj %s, while nonauth", getDebugInformation().c_str())); ServerCreatureObjectTemplate const * const myTemplate = safe_cast(getObjectTemplate()); - if (myTemplate != NULL) + if (myTemplate != nullptr) { ServerWeaponObjectTemplate const *weaponTemplate = myTemplate->getDefaultWeapon(); - if (weaponTemplate == NULL) + if (weaponTemplate == nullptr) { WARNING(true, ("Creature template %s has no valid default weapon!", getTemplateName())); // try to use the fallback weapon weaponTemplate = dynamic_cast(ObjectTemplateList::fetch(ConfigServerGame::getFallbackDefaultWeapon())); - FATAL(weaponTemplate == NULL, ("CreatureObject::initializeFirstTimeObject fallback weapon template %s is bad!", ConfigServerGame::getFallbackDefaultWeapon())); + FATAL(weaponTemplate == nullptr, ("CreatureObject::initializeFirstTimeObject fallback weapon template %s is bad!", ConfigServerGame::getFallbackDefaultWeapon())); } WeaponObject * const weapon = safe_cast(ServerWorld::createNewObject(*weaponTemplate, *this, s_defaultWeaponSlotId, false)); - if (weapon != NULL) + if (weapon != nullptr) { weapon->setAsDefaultWeapon(true); } @@ -3044,7 +3044,7 @@ bool CreatureObject::swapDefaultWeapons(WeaponObject &newDefaultWeapon, ServerOb FATAL(!newDefaultWeapon.isAuthoritative(), ("CreatureObject::swapDefaultWeapons: obj %s, weapon %s, weaponContainer %s, while newDefaultWeapon nonauth", getDebugInformation().c_str(), newDefaultWeapon.getDebugInformation().c_str(), weaponContainer.getDebugInformation().c_str())); FATAL(!weaponContainer.isAuthoritative(), ("CreatureObject::swapDefaultWeapons: obj %s, weapon %s, weaponContainer %s, while weaponContainer nonauth", getDebugInformation().c_str(), newDefaultWeapon.getDebugInformation().c_str(), weaponContainer.getDebugInformation().c_str())); - // There is a window here where the default weapon can be null, so we + // There is a window here where the default weapon can be nullptr, so we // set a flag that it's ok until we've finished the transfer. FATAL(s_allowNullDefaultWeapon, ("CreatureObject::swapDefaultWeapons has been recursively called!")); @@ -3080,12 +3080,12 @@ bool CreatureObject::swapDefaultWeapons(WeaponObject &newDefaultWeapon, ServerOb WeaponObject *CreatureObject::getDefaultWeapon() const { SlottedContainer const * const container = ContainerInterface::getSlottedContainer(*this); - if (container == NULL) + if (container == nullptr) { - return NULL; + return nullptr; } - WeaponObject * defaultWeapon = NULL; + WeaponObject * defaultWeapon = nullptr; Container::ContainerErrorCode error; Container::ContainedItem itemId = container->getObjectInSlot(s_defaultWeaponSlotId, error); if (error == Container::CEC_Success) @@ -3097,7 +3097,7 @@ WeaponObject *CreatureObject::getDefaultWeapon() const if (so) defaultWeapon = so->asWeaponObject(); } - FATAL(!s_allowNullDefaultWeapon && defaultWeapon == NULL, ("CreatureObject::getDefaultWeapon, weapon is NULL! Object in default slot is %s", itemId.getValueString().c_str())); + FATAL(!s_allowNullDefaultWeapon && defaultWeapon == nullptr, ("CreatureObject::getDefaultWeapon, weapon is nullptr! Object in default slot is %s", itemId.getValueString().c_str())); } return defaultWeapon; } @@ -3376,7 +3376,7 @@ void CreatureObject::updateSlopeMovement(const std::string & modName) recomputeSlopeModPercent(); // if I'm modifiying the group slope mod and I'm a group leader, // update my group's speed - else if (modName == GROUP_SLOPE_MOD && getGroup() != NULL && + else if (modName == GROUP_SLOPE_MOD && getGroup() != nullptr && getGroup()->getGroupLeaderId() == getNetworkId()) { const GroupObject::GroupMemberVector & members = getGroup()->getGroupMembers(); @@ -3385,7 +3385,7 @@ void CreatureObject::updateSlopeMovement(const std::string & modName) { CreatureObject * member = safe_cast( NetworkIdManager::getObjectById((*iter).first)); - if (member != NULL) + if (member != nullptr) member->recomputeSlopeModPercent(); } } @@ -3581,7 +3581,7 @@ int CreatureObject::getExperiencePoints(const std::string & experienceType) cons if (isPlayerControlled()) { const PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if (playerObject != NULL) + if (playerObject != nullptr) return playerObject->getExperiencePoints(experienceType); } return 0; @@ -3595,7 +3595,7 @@ const std::map & CreatureObject::getExperiencePoints() const if(isPlayerControlled()) { const PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if(playerObject != NULL) + if(playerObject != nullptr) { return playerObject->getExperiencePoints(); } @@ -3617,7 +3617,7 @@ const int CreatureObject::grantExperiencePoints(const std::string & experienceTy if (isPlayerControlled()) { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if (playerObject != NULL) + if (playerObject != nullptr) { int const amountGranted = playerObject->grantExperiencePoints(experienceType, amount); @@ -3770,7 +3770,7 @@ void CreatureObject::revokeSkill(const SkillObject & oldSkill, bool silent) PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if ((playerObject != NULL) && + if ((playerObject != nullptr) && (oldSkill.getSkillName() == playerObject->getTitle())) { StringId message("shared", "skill_title_removed"); @@ -3809,7 +3809,7 @@ const bool CreatureObject::grantSchematicGroup(const std::string & groupNameWith if (isPlayerControlled()) { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if (playerObject != NULL) + if (playerObject != nullptr) return playerObject->grantSchematicGroup(groupNameWithModifier, fromSkill); } return false; @@ -3829,7 +3829,7 @@ const bool CreatureObject::grantSchematic(uint32 schematicCrc, bool fromSkill) if (isPlayerControlled()) { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if (playerObject != NULL) + if (playerObject != nullptr) return playerObject->grantSchematic(schematicCrc, fromSkill); } return false; @@ -3849,7 +3849,7 @@ const bool CreatureObject::revokeSchematic(uint32 schematicCrc, bool fromSkill) if (isPlayerControlled()) { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if (playerObject != NULL) + if (playerObject != nullptr) return playerObject->revokeSchematic(schematicCrc, fromSkill); } return false; @@ -3869,7 +3869,7 @@ const bool CreatureObject::hasSchematic(uint32 schematicCrc) if (isPlayerControlled()) { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if (playerObject != NULL) + if (playerObject != nullptr) return playerObject->hasSchematic(schematicCrc); } return false; @@ -3909,7 +3909,7 @@ void CreatureObject::setInCombat(bool inCombat) PlayerObject * const player = PlayerCreatureController::getPlayerObject(this); - if (player != NULL && player->isCrafting()) + if (player != nullptr && player->isCrafting()) { player->stopCrafting(false); } @@ -4274,10 +4274,10 @@ static const int internalTagBufLen = strlen(internalTagBuf); mod.value, m_attributes[mod.attrib] + mod.value); DEBUG_REPORT_LOG (true, ("%s", debugBuffer)); - if (attacker != NULL) + if (attacker != nullptr) { Client *client = attacker->getClient(); - if (client != NULL) + if (client != nullptr) ConsoleMgr::broadcastString(debugBuffer, client); } } @@ -4359,8 +4359,8 @@ static const int internalTagBufLen = strlen(internalTagBuf); else { const char * modName = AttribModNameManager::getInstance().getAttribModName(mod.tag); - if (modName == NULL) - modName = ""; + if (modName == nullptr) + modName = ""; WARNING(true, ("Creature %s received a mod %s with invalid " "attack(%.2f) or duration(%.2f)", getNetworkId().getValueString().c_str(), modName, mod.attack, @@ -4438,7 +4438,7 @@ void CreatureObject::removeAttributeModifier (const std::string & modName) if (AttribMod::isSkillMod(m.mod)) { const char * skillModName = AttribModNameManager::getInstance().getAttribModName(m.mod.skill); - if (skillModName != NULL) + if (skillModName != nullptr) addModValue(skillModName, -m.maxVal, true); else { @@ -4569,7 +4569,7 @@ void CreatureObject::removeAllAttributeAndSkillmodMods () if (AttribMod::isSkillMod(m.mod)) { const char * skillModName = AttribModNameManager::getInstance().getAttribModName(m.mod.skill); - if (skillModName != NULL) + if (skillModName != nullptr) addModValue(skillModName, -m.maxVal, true); } // if the mod is visible, we need to tell the player it's being @@ -4582,7 +4582,7 @@ void CreatureObject::removeAllAttributeAndSkillmodMods () if (m.mod.flags & AttribMod::AMF_triggerOnDone) { const char * modName = AttribModNameManager::getInstance().getAttribModName(m.mod.tag); - if (modName != NULL) + if (modName != nullptr) { ScriptParams params; params.addParam(modName); @@ -4624,7 +4624,7 @@ void CreatureObject::removeAllAttributeAndSkillmodMods () * * @param modName the mod to look for * - * @return the mod, or NULL if there is no mod with that name attached to us + * @return the mod, or nullptr if there is no mod with that name attached to us */ const AttribMod::AttribMod * CreatureObject::getAttributeModifier( const std::string & modName) const @@ -4642,7 +4642,7 @@ const AttribMod::AttribMod * CreatureObject::getAttributeModifier( if (found != m_attributeModList.end()) return &((*found).second.mod); } - return NULL; + return nullptr; } // CreatureObject::getAttributeModifier //----------------------------------------------------------------------- @@ -4666,7 +4666,7 @@ const std::map & CreatureObject::getAttributeModifiers() co */ void CreatureObject::sendTimedModData(uint32 id, float time, bool updateCache/* = true*/) { - if (isPlayerControlled() && getController() != NULL && id != 0) + if (isPlayerControlled() && getController() != nullptr && id != 0) { MessageQueueGenericValueType > * const msg = new MessageQueueGenericValueType >( @@ -4707,7 +4707,7 @@ void CreatureObject::sendTimedModData(uint32 id, float time, bool updateCache/* */ void CreatureObject::sendCancelTimedMod(uint32 id) { - if (isPlayerControlled() && getController() != NULL && id != 0) + if (isPlayerControlled() && getController() != nullptr && id != 0) { MessageQueueGenericValueType * const msg = new MessageQueueGenericValueType(id); @@ -4764,7 +4764,7 @@ void CreatureObject::applyDamage(const CombatEngineData::DamageData &damageData) // if the attacker is a player and we are not, and we are incapped/dead, // don't allow additional damage - if (attacker != NULL && attacker->isPlayerControlled() && !isPlayerControlled() && + if (attacker != nullptr && attacker->isPlayerControlled() && !isPlayerControlled() && (isIncapacitated() || isDead())) { return; @@ -5018,7 +5018,7 @@ void CreatureObject::decayAttributes(float time) if (AttribMod::isSkillMod(m.mod)) { const char * skillModName = AttribModNameManager::getInstance().getAttribModName(m.mod.skill); - if (skillModName != NULL) + if (skillModName != nullptr) { addModValue(skillModName, -m.maxVal, true); @@ -5051,7 +5051,7 @@ void CreatureObject::decayAttributes(float time) { // tell scripts the mod has ended const char * modName = AttribModNameManager::getInstance().getAttribModName(m.mod.tag); - if (modName != NULL) + if (modName != nullptr) { ScriptParams params; params.addParam(modName); @@ -5112,7 +5112,7 @@ void CreatureObject::decayAttributes(float time) // add the skillmod mod as if it were from a skill, // which makes it temporary const char * skillModName = AttribModNameManager::getInstance().getAttribModName(m.mod.skill); - if (skillModName != NULL) + if (skillModName != nullptr) addModValue(skillModName, delta, true); else { @@ -6014,7 +6014,7 @@ static const std::map,int> npcSchematics; if (isPlayerControlled()) { PlayerObject const * const playerObject = PlayerCreatureController::getPlayerObject(this); - if (playerObject != NULL) + if (playerObject != nullptr) return playerObject->getDraftSchematics(); } return npcSchematics; @@ -6032,11 +6032,11 @@ static const std::map,int> npcSchematics; bool CreatureObject::isIngredientInInventory(const Object & ingredient) const { const ServerObject * inventory = getInventory(); - if (inventory == NULL) + if (inventory == nullptr) return false; const Object * container = ContainerInterface::getContainedByObject(ingredient); - while (container != NULL) + while (container != nullptr) { if (inventory->getNetworkId() == container->getNetworkId() || getNetworkId() == container->getNetworkId()) @@ -6057,7 +6057,7 @@ bool CreatureObject::isIngredientInInventory(const Object & ingredient) const */ void CreatureObject::disableSchematicFiltering() { - if (getClient() == NULL || !getClient()->isGod()) + if (getClient() == nullptr || !getClient()->isGod()) return; setObjVarItem(OBJVAR_DISABLE_SCHEMATIC_FILTER, 1); @@ -6071,7 +6071,7 @@ void CreatureObject::disableSchematicFiltering() */ void CreatureObject::enableSchematicFiltering() { - if (getClient() == NULL || !getClient()->isGod()) + if (getClient() == nullptr || !getClient()->isGod()) return; removeObjVarItem(OBJVAR_DISABLE_SCHEMATIC_FILTER); @@ -6087,7 +6087,7 @@ void CreatureObject::enableSchematicFiltering() */ bool CreatureObject::isSchematicFilteringEnabled() { - if (getClient() == NULL || !getClient()->isGod()) + if (getClient() == nullptr || !getClient()->isGod()) return true; return (!getObjVars().hasItem(OBJVAR_DISABLE_SCHEMATIC_FILTER)); @@ -6103,17 +6103,17 @@ bool CreatureObject::isSchematicFilteringEnabled() void CreatureObject::getManufactureSchematics(std::vector & schematics) { const ServerObject * datapad = getDatapad(); - if (datapad == NULL) + if (datapad == nullptr) return; const VolumeContainer * container = ContainerInterface::getVolumeContainer(*datapad); - if (container == NULL) + if (container == nullptr) return; for (ContainerConstIterator iter = container->begin(); iter != container->end(); ++iter) { const ManufactureSchematicObject * schematic = dynamic_cast((*iter).getObject()); - if (schematic != NULL) + if (schematic != nullptr) schematics.push_back(schematic); } } // CreatureObject::getManufactureSchematics(unfiltered) @@ -6130,17 +6130,17 @@ void CreatureObject::getManufactureSchematics(std::vector & schematics, uint32 craftingTypes) { const ServerObject * datapad = getDatapad(); - if (datapad == NULL) + if (datapad == nullptr) return; const VolumeContainer * container = ContainerInterface::getVolumeContainer(*datapad); - if (container == NULL) + if (container == nullptr) return; for (ContainerConstIterator iter = container->begin(); iter != container->end(); ++iter) { const ManufactureSchematicObject * schematic = dynamic_cast((*iter).getObject()); - if (schematic != NULL && ((schematic->getCategory() & craftingTypes) != 0)) + if (schematic != nullptr && ((schematic->getCategory() & craftingTypes) != 0)) schematics.push_back(schematic); } } // CreatureObject::getManufactureSchematics(filtered) @@ -6278,7 +6278,7 @@ void CreatureObject::setIncapacitated(bool flag, const NetworkId & attackerId) // if we are crafting, end the crafting session PlayerObject * const player = PlayerCreatureController::getPlayerObject(this); - if (player != NULL && player->isCrafting()) + if (player != nullptr && player->isCrafting()) player->stopCrafting(false); if (isInNpcConversation()) @@ -6299,7 +6299,7 @@ void CreatureObject::setIncapacitated(bool flag, const NetworkId & attackerId) // invoke incapacitation script on who incapacitated us ServerObject * attacker = safe_cast( NetworkIdManager::getObjectById(attackerId)); - if (attacker != NULL) + if (attacker != nullptr) { params.clear(); params.addParam(getNetworkId()); @@ -6308,7 +6308,7 @@ void CreatureObject::setIncapacitated(bool flag, const NetworkId & attackerId) TangibleObject * const tangibleAttacker = attacker->asTangibleObject(); - if (tangibleAttacker != NULL) + if (tangibleAttacker != nullptr) { tangibleAttacker->verifyHateList(); } @@ -6335,7 +6335,7 @@ void CreatureObject::setIncapacitated(bool flag, const NetworkId & attackerId) setPosture(Postures::Upright); } // if we are a player, send us our new posture - if ((getController() != NULL) && !isInCombat()) + if ((getController() != nullptr) && !isInCombat()) { getController()->appendMessage( CM_setPosture, @@ -6466,7 +6466,7 @@ void CreatureObject::updateMovementInfo() rider->requestMovementInfoUpdate(); else { - LOG("mounts-bug", ("CreatureObject::updateMovementInfo(): server id=[%d],mount id=[%s],has MountedCreature state but getMountingRider() returns null.", static_cast(GameServer::getInstance().getProcessId()), getNetworkId().getValueString().c_str())); + LOG("mounts-bug", ("CreatureObject::updateMovementInfo(): server id=[%d],mount id=[%s],has MountedCreature state but getMountingRider() returns nullptr.", static_cast(GameServer::getInstance().getProcessId()), getNetworkId().getValueString().c_str())); detachAllRiders(); } } @@ -6538,7 +6538,7 @@ void CreatureObject::setPosture(Postures::Enumerator newPosture, bool isClientIm // guaranteed to be the authoritative object, this is an invalid thing to do. requestMovementInfoUpdate(); - if (getScriptObject() != NULL) + if (getScriptObject() != nullptr) { ScriptParams params; params.addParam(oldPosture); @@ -6950,13 +6950,13 @@ bool CreatureObject::onContainerAboutToTransfer(ServerObject * destination, Serv int CreatureObject::onContainerAboutToGainItem(ServerObject& item, ServerObject* transferer) { TangibleObject const * const object = item.asTangibleObject(); - if (object != NULL) + if (object != nullptr) { // See if this item is equippable const char *sharedTemplateName = item.getSharedTemplateName(); if (!isAppearanceEquippable(sharedTemplateName)) { - if (getClient() != NULL) + if (getClient() != nullptr) { StringId message("shared", "item_not_equippable"); Unicode::String outOfBand; @@ -6984,7 +6984,7 @@ int CreatureObject::onContainerAboutToGainItem(ServerObject& item, ServerObject* void CreatureObject::onContainerLostItem(ServerObject *destination, ServerObject &item, ServerObject *transferer) { TangibleObject const * const tangibleObject = item.asTangibleObject(); - if (tangibleObject == NULL) + if (tangibleObject == nullptr) return; // check if the object applies skill mod bonuses when equipped @@ -7026,12 +7026,12 @@ void CreatureObject::onContainerLostItem(ServerObject *destination, ServerObject // if the item is a weapon, make our current weapon our default weapon WeaponObject const * const weaponObject = tangibleObject->asWeaponObject(); - if (weaponObject != NULL && getDefaultWeapon() != NULL) + if (weaponObject != nullptr && getDefaultWeapon() != nullptr) setCurrentWeapon(*getDefaultWeapon()); // check if the object is our shield if (tangibleObject == m_shield) - m_shield = NULL; + m_shield = nullptr; //Update wearbles data SlottedContainmentProperty* scp = ContainerInterface::getSlottedContainmentProperty(item); @@ -7060,7 +7060,7 @@ void CreatureObject::onContainerLostItem(ServerObject *destination, ServerObject void CreatureObject::onContainerGainItem(ServerObject& item, ServerObject* source, ServerObject* transferer) { TangibleObject * const tangibleObject = item.asTangibleObject(); - if (tangibleObject == NULL) + if (tangibleObject == nullptr) return; // check if the object applies skill mod bonuses when equipped @@ -7100,7 +7100,7 @@ void CreatureObject::onContainerGainItem(ServerObject& item, ServerObject* sourc // if the item is a weapon, make it our current weapon WeaponObject * const weaponObject = tangibleObject->asWeaponObject(); - if (weaponObject != NULL) + if (weaponObject != nullptr) setCurrentWeapon(*weaponObject); //Update wearables data @@ -7141,7 +7141,7 @@ void CreatureObject::onContainerGainItem(ServerObject& item, ServerObject* sourc ConstCharCrcString clientSharedTemplateNameCrcString = ObjectTemplateList::lookUp(tangibleObject->getClientSharedTemplateName()); if (clientSharedTemplateNameCrcString.isEmpty()) WARNING(true, ("Could not find crc for %s. Wearable will not be streamed to client", tangibleObject->getClientSharedTemplateName())); - else if (tangibleObject->asWeaponObject() != NULL) + else if (tangibleObject->asWeaponObject() != nullptr) { addPackedWearable(tangibleObject->getAppearanceData(), scp->getCurrentArrangement(), tangibleObject->getNetworkId(), clientSharedTemplateNameCrcString.getCrc(), tangibleObject->createSharedBaselinesMessage(), tangibleObject->createSharedNpBaselinesMessage()); @@ -7591,7 +7591,7 @@ void CreatureObject::onClientReady(Client *c) { time_t timeUnsquelch = static_cast(player->getSecondsUntilUnsquelched()); if (timeUnsquelch > 0) - timeUnsquelch += ::time(NULL); + timeUnsquelch += ::time(nullptr); GenericValueTypeMessage, int>, std::pair > > chatStatistics("ChatStatisticsGS", std::make_pair(std::make_pair(std::make_pair(getNetworkId(), static_cast(timeUnsquelch)), player->getChatSpamTimeEndInterval()), std::make_pair(player->getChatSpamSpatialNumCharacters(), player->getChatSpamNonSpatialNumCharacters()))); Chat::sendToChatServer(chatStatistics); @@ -7926,7 +7926,7 @@ bool CreatureObject::makeDead(const NetworkId & killer, const NetworkId & corpse // if we are crafting, end the crafting session PlayerObject * const player = PlayerCreatureController::getPlayerObject(this); - if (player != NULL && player->isCrafting()) + if (player != nullptr && player->isCrafting()) player->stopCrafting(false); // if we are in a conversation, end it @@ -7991,7 +7991,7 @@ bool CreatureObject::makeDead(const NetworkId & killer, const NetworkId & corpse if (AttribMod::isSkillMod(m.mod)) { const char * skillModName = AttribModNameManager::getInstance().getAttribModName(m.mod.skill); - if (skillModName != NULL) + if (skillModName != nullptr) addModValue(skillModName, -m.maxVal, true); } // if the mod is visible, we need to tell the player it's being @@ -8004,7 +8004,7 @@ bool CreatureObject::makeDead(const NetworkId & killer, const NetworkId & corpse if (m.mod.flags & AttribMod::AMF_triggerOnDone) { const char * modName = AttribModNameManager::getInstance().getAttribModName(m.mod.tag); - if (modName != NULL) + if (modName != nullptr) { ScriptParams params; params.addParam(modName); @@ -8149,7 +8149,7 @@ Object const * CreatureObject::getStandingOn() const } else { - return NULL; + return nullptr; } } @@ -8302,7 +8302,7 @@ bool CreatureObject::setSlopeModPercent(float percent) // get my skill mod int movementMod = getEnhancedModValue(SLOPE_MOD); - if (getGroup() != NULL) + if (getGroup() != nullptr) { // get my group leader skill mod const NetworkId & leaderId = getGroup()->getGroupLeaderId(); @@ -8310,7 +8310,7 @@ bool CreatureObject::setSlopeModPercent(float percent) { const CreatureObject * leader = safe_cast( NetworkIdManager::getObjectById(leaderId)); - if (leader != NULL) + if (leader != nullptr) { movementMod += leader->getEnhancedModValue(GROUP_SLOPE_MOD); } @@ -8519,7 +8519,7 @@ void CreatureObject::onBiographyRetrieved(const NetworkId &owner, const Unicode: CreatureController *creatureController = getCreatureController(); - if (creatureController != NULL) + if (creatureController != nullptr) { typedef std::pair Payload; @@ -8535,7 +8535,7 @@ void CreatureObject::onCharacterMatchRetrieved(MatchMakingCharacterResult const { CreatureController *creatureController = getCreatureController(); - if (creatureController != NULL) + if (creatureController != nullptr) { MessageQueueGenericValueType * const msg = new MessageQueueGenericValueType(results); @@ -8939,7 +8939,7 @@ bool CreatureObject::isAppearanceEquippable(const char *appearanceTemplateName) // Make sure this object has a valid appearance - if (appearanceTemplateName == NULL) + if (appearanceTemplateName == nullptr) { result = false; } @@ -9063,7 +9063,7 @@ void CreatureObject::updatePlanetServerInternal(const bool forceUpdate) const AICreatureController const * const aiCreatureController = dynamic_cast(getCreatureController()); Object const * const topmostContainer = ContainerInterface::getTopmostContainer(*this); - FATAL(!topmostContainer, ("Object %s was contained by something, but getTopmostContainer() returned NULL", getNetworkId().getValueString().c_str())); + FATAL(!topmostContainer, ("Object %s was contained by something, but getTopmostContainer() returned nullptr", getNetworkId().getValueString().c_str())); Vector const &position = topmostContainer->getPosition_p(); UpdateObjectOnPlanetMessage const msg( getNetworkId(), @@ -9265,7 +9265,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) // set objvar to indicate there's a pending rename request for this character, // and the time of the rename request, to enforce the 90 days wait between rename if (!getClient() || !getClient()->isGod()) - setObjVarItem("renameCharacterRequest.requestTime", static_cast(::time(NULL))); + setObjVarItem("renameCharacterRequest.requestTime", static_cast(::time(nullptr))); std::string const newName(message.getDataAsString()); if (getObjVars().hasItem("renameCharacterRequest.requestTime") && !newName.empty()) @@ -9306,7 +9306,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) if (!getObjVars().hasItem(OBJVAR_ADD_JEDI_ACK)) { PlayerObject * const player = PlayerCreatureController::getPlayerObject(this); - if (player != NULL) + if (player != nullptr) { player->addJediToAccount(); MessageToQueue::getInstance().sendMessageToC(getNetworkId(), @@ -9461,7 +9461,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) MessageToQueue::cancelRecurringMessageTo(getNetworkId(), "C++WaitForPatrolPreload"); AICreatureController * const aiCreatureController = safe_cast(getController()); - if (aiCreatureController != NULL) + if (aiCreatureController != nullptr) { const std::string data = message.getDataAsString(); std::string::size_type locationStart = 0; @@ -9797,7 +9797,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) Unicode::String const delimiters(Unicode::narrowToWide("|")); Unicode::UnicodeStringVector tokens; - if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, NULL)) && (tokens.size() == 2)) + if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, nullptr)) && (tokens.size() == 2)) { existingWarden = NetworkId(Unicode::wideToNarrow(tokens[0])); @@ -9874,7 +9874,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) Unicode::String const delimiters(Unicode::narrowToWide("|")); Unicode::UnicodeStringVector tokens; - if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, NULL)) && (tokens.size() == 2)) + if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, nullptr)) && (tokens.size() == 2)) { existingWarden = NetworkId(Unicode::wideToNarrow(tokens[0])); @@ -9970,12 +9970,12 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) bool success = false; NetworkId actor, actorShip, group; std::string actorName; - GroupObject const * groupObject = NULL; + GroupObject const * groupObject = nullptr; StringId responseSid; Unicode::String const delimiters(Unicode::narrowToWide("|")); Unicode::UnicodeStringVector tokens; - if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, NULL)) && (tokens.size() == 4)) + if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, nullptr)) && (tokens.size() == 4)) { success = true; actor = NetworkId(Unicode::wideToNarrow(tokens[0])); @@ -9983,8 +9983,8 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) group = NetworkId(Unicode::wideToNarrow(tokens[2])); actorName = Unicode::wideToNarrow(tokens[3]); - ServerObject const * so = (group.isValid() ? safe_cast(NetworkIdManager::getObjectById(group)) : NULL); - groupObject = (so ? so->asGroupObject() : NULL); + ServerObject const * so = (group.isValid() ? safe_cast(NetworkIdManager::getObjectById(group)) : nullptr); + groupObject = (so ? so->asGroupObject() : nullptr); } if (success) @@ -10011,7 +10011,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) if (success) { GameScriptObject* const gso = getScriptObject(); - if (gso != NULL && gso->hasScript("ai.beast")) + if (gso != nullptr && gso->hasScript("ai.beast")) { responseSid = GroupStringId::SID_GROUP_BEASTS_CANT_JOIN; success = false; @@ -10092,7 +10092,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) } else if (message.getMethod() == "C++InviteToGroupRspTargetNotFound") { - Chat::sendSystemMessageSimple(*this, GroupStringId::SID_GROUP_INVITE_NO_TARGET_SELF, NULL); + Chat::sendSystemMessageSimple(*this, GroupStringId::SID_GROUP_INVITE_NO_TARGET_SELF, nullptr); } else if (message.getMethod() == "C++GroupOperationGenericRsp") { @@ -10101,7 +10101,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) std::string const result(message.getPackedDataVector().begin(), message.getPackedDataVector().end()); Unicode::String const delimiters(Unicode::narrowToWide("|")); Unicode::UnicodeStringVector tokens; - if ((Unicode::tokenize(Unicode::narrowToWide(result), tokens, &delimiters, NULL)) && (tokens.size() == 3)) + if ((Unicode::tokenize(Unicode::narrowToWide(result), tokens, &delimiters, nullptr)) && (tokens.size() == 3)) { std::string const response(Unicode::wideToNarrow(tokens[0])); std::string const responseParmType(Unicode::wideToNarrow(tokens[1])); @@ -10138,7 +10138,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) Unicode::String const delimiters(Unicode::narrowToWide("|")); Unicode::UnicodeStringVector tokens; - if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, NULL)) && (tokens.size() == 2)) + if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, nullptr)) && (tokens.size() == 2)) { success = true; actor = NetworkId(Unicode::wideToNarrow(tokens[0])); @@ -10194,7 +10194,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) } else if (message.getMethod() == "C++UninviteFromGroupRspTargetNotFound") { - Chat::sendSystemMessageSimple(*this, GroupStringId::SID_GROUP_UNINVITE_NO_TARGET_SELF, NULL); + Chat::sendSystemMessageSimple(*this, GroupStringId::SID_GROUP_UNINVITE_NO_TARGET_SELF, nullptr); } else if (message.getMethod() == "C++GroupJoinInviterInfoReq") { @@ -10250,7 +10250,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) Unicode::String const delimiters(Unicode::narrowToWide("|")); Unicode::UnicodeStringVector tokens; - if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, NULL)) && (tokens.size() == 10)) + if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, nullptr)) && (tokens.size() == 10)) { success = true; existingGroupId = NetworkId(Unicode::wideToNarrow(tokens[0])); @@ -10265,17 +10265,17 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) inviterInCombat = (atoi(Unicode::wideToNarrow(tokens[9]).c_str()) != 0); } - GroupObject * existingGroup = NULL; + GroupObject * existingGroup = nullptr; if (success) { if (existingGroupId.isValid()) { ServerObject * so = safe_cast(NetworkIdManager::getObjectById(existingGroupId)); - existingGroup = (so ? so->asGroupObject() : NULL); + existingGroup = (so ? so->asGroupObject() : nullptr); if (!existingGroup) { success = false; - Chat::sendSystemMessageSimple(*this, GroupStringId::SID_GROUP_EXISTING_GROUP_NOT_FOUND, NULL); + Chat::sendSystemMessageSimple(*this, GroupStringId::SID_GROUP_EXISTING_GROUP_NOT_FOUND, nullptr); } } } @@ -10318,7 +10318,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) if (existingGroup && !GroupHelpers::roomInGroup(existingGroup, targets.size())) { success = false; - Chat::sendSystemMessageSimple(*this, GroupStringId::SID_GROUP_JOIN_FULL, NULL); + Chat::sendSystemMessageSimple(*this, GroupStringId::SID_GROUP_JOIN_FULL, nullptr); } } @@ -10390,7 +10390,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) } else if (message.getMethod() == "C++GroupJoinInviterInfoReqInviterNotFound") { - Chat::sendSystemMessageSimple(*this, GroupStringId::SID_GROUP_MUST_BE_INVITED, NULL); + Chat::sendSystemMessageSimple(*this, GroupStringId::SID_GROUP_MUST_BE_INVITED, nullptr); } else if (message.getMethod() == "C++LeaveGroupReq") { @@ -10417,7 +10417,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) Unicode::String const delimiters(Unicode::narrowToWide("|")); Unicode::UnicodeStringVector tokens; - if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, NULL)) && (tokens.size() == 5)) + if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, nullptr)) && (tokens.size() == 5)) { // tell group member that the group pickup point has been created if (getClient()) @@ -10767,7 +10767,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) params.addParam(msg.getDestinationGalaxy().c_str(), "destinationGalaxy"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(getNetworkId(), "handleFreeCtsValidateFailCannotCreateCharacter", dictionary->getSerializedData(), 0, false); @@ -10781,7 +10781,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) params.addParam(msg.getDestinationGalaxy().c_str(), "destinationGalaxy"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(getNetworkId(), "handleFreeCtsValidateFailDestGalaxyUnavailable", dictionary->getSerializedData(), 0, false); @@ -10801,7 +10801,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) params.addParam(msg.getDestinationGalaxy().c_str(), "destinationGalaxy"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(getNetworkId(), "handleCtsValidateFailCannotCreateCharacter", dictionary->getSerializedData(), 0, false); @@ -10815,7 +10815,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) params.addParam(msg.getDestinationGalaxy().c_str(), "destinationGalaxy"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(getNetworkId(), "handleCtsValidateFailDestGalaxyUnavailable", dictionary->getSerializedData(), 0, false); @@ -10854,7 +10854,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) params.addParam(msg.getValue().first.c_str(), "reason"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(getNetworkId(), "handleFreeCtsValidateFailNameValidation", dictionary->getSerializedData(), 0, false); @@ -10868,7 +10868,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) params.addParam(msg.getValue().first.c_str(), "reason"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(getNetworkId(), "handleCtsValidateFailNameValidation", dictionary->getSerializedData(), 0, false); @@ -10882,7 +10882,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) params.addParam(msg.getValue().second.getDestinationCharacterName().c_str(), "destinationCharacterName"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(getNetworkId(), "handleFreeCtsValidateSuccess", dictionary->getSerializedData(), 0, false); @@ -10895,7 +10895,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) params.addParam(msg.getValue().second.getDestinationCharacterName().c_str(), "destinationCharacterName"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(getNetworkId(), "handleCtsValidateSuccess", dictionary->getSerializedData(), 0, false); @@ -10906,7 +10906,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) else if (message.getMethod() == "C++PickupAllRoomItemsIntoInventory") { // use while(true) loop to use break to discontinue processing and go to the end of loop to run cleanup code - PlayerObject * playerObject = NULL; + PlayerObject * playerObject = nullptr; while (true) { playerObject = PlayerCreatureController::getPlayerObject(this); @@ -11148,7 +11148,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) else if (message.getMethod() == "C++DropAllInventoryItemsIntoRoom") { // use while(true) loop to use break to discontinue processing and go to the end of loop to run cleanup code - PlayerObject * playerObject = NULL; + PlayerObject * playerObject = nullptr; while (true) { playerObject = PlayerCreatureController::getPlayerObject(this); @@ -11355,7 +11355,7 @@ void CreatureObject::handleCMessageTo(MessageToPayload const &message) else if (message.getMethod() == "C++RestoreDecorationLayout") { // use while(true) loop to use break to discontinue processing and go to the end of loop to run cleanup code - PlayerObject * playerObject = NULL; + PlayerObject * playerObject = nullptr; while (true) { playerObject = PlayerCreatureController::getPlayerObject(this); @@ -11681,7 +11681,7 @@ void CreatureObject::virtualOnReleaseAuthority() if(controller) { - if (getProperty(SlopeEffectProperty::getClassPropertyId()) != NULL) + if (getProperty(SlopeEffectProperty::getClassPropertyId()) != nullptr) removeProperty(SlopeEffectProperty::getClassPropertyId()); controller->setAuthority(false); } @@ -11693,7 +11693,7 @@ void CreatureObject::virtualOnLogout() { TangibleObject::virtualOnLogout(); PlayerObject * const player = PlayerCreatureController::getPlayerObject(this); - if (player != NULL) + if (player != nullptr) player->virtualOnLogout(); } @@ -11789,7 +11789,7 @@ void CreatureObject::packWearables() ConstCharCrcString clientSharedTemplateNameCrcString = ObjectTemplateList::lookUp(tang->getClientSharedTemplateName()); if (clientSharedTemplateNameCrcString.isEmpty()) WARNING(true, ("Could not find crc for [%s]. Wearable will not be streamed to client", tang->getClientSharedTemplateName())); - else if (so->asWeaponObject() != NULL) + else if (so->asWeaponObject() != nullptr) { addPackedWearable(tang->getAppearanceData(), scp->getCurrentArrangement(), tang->getNetworkId(), clientSharedTemplateNameCrcString.getCrc(), tang->createSharedBaselinesMessage(), tang->createSharedNpBaselinesMessage()); @@ -12048,7 +12048,7 @@ int CreatureObject::loadPackedHouses() ++hcdIter) { Object * const houseId = (*hcdIter).getObject(); - BuildingObject * const house = (houseId ? houseId->asServerObject()->asBuildingObject() : NULL); + BuildingObject * const house = (houseId ? houseId->asServerObject()->asBuildingObject() : nullptr); if (house && !house->getContentsLoaded()) { LOG("CustomerService", ("CharacterTransfer: starting packed house load (%s) for CTS character %s", house->getNetworkId().getValueString().c_str(), PlayerObject::getAccountDescription(this).c_str())); @@ -12612,7 +12612,7 @@ void CreatureObject::unequipAllItems() Container::ContainerErrorCode errorCode = Container::CEC_Success; Container::ContainedItem inventoryContainedItem = equipmentContainer->getObjectInSlot(s_inventorySlotId, errorCode); Object *const inventoryObjectBase = inventoryContainedItem.getObject(); - ServerObject *const inventoryObject = inventoryObjectBase ? inventoryObjectBase->asServerObject() : NULL; + ServerObject *const inventoryObject = inventoryObjectBase ? inventoryObjectBase->asServerObject() : nullptr; if (!inventoryObject || (errorCode != Container::CEC_Success)) { WARNING(true, @@ -12629,7 +12629,7 @@ void CreatureObject::unequipAllItems() if (!inventoryContainer) { WARNING(true, - ("unequipAllItems() called on object id=[%s], template=[%s] on server id=[%d]: inventory object is NULL.", + ("unequipAllItems() called on object id=[%s], template=[%s] on server id=[%d]: inventory object is nullptr.", getNetworkId().getValueString().c_str(), getObjectTemplateName(), static_cast(GameServer::getInstance().getProcessId()) @@ -12648,11 +12648,11 @@ void CreatureObject::unequipAllItems() // Get the equipment item. Container::ContainedItem containedItem = *it; Object *const objectBase = containedItem.getObject(); - ServerObject *const object = objectBase ? objectBase->asServerObject() : NULL; + ServerObject *const object = objectBase ? objectBase->asServerObject() : nullptr; if (!object) { WARNING(true, - ("null object in equipment container for object id=[%s]: equipment item id=[%s].", + ("nullptr object in equipment container for object id=[%s]: equipment item id=[%s].", getNetworkId().getValueString().c_str(), containedItem.getValueString().c_str() )); @@ -12686,7 +12686,7 @@ void CreatureObject::unequipAllItems() if (!object) continue; - ContainerInterface::transferItemToVolumeContainer(*inventoryObject, *object, NULL, errorCode); + ContainerInterface::transferItemToVolumeContainer(*inventoryObject, *object, nullptr, errorCode); WARNING(errorCode != Container::CEC_Success, ("unequipAllItems(): CreatureObject id=[%s] failed to transfer item id=[%s], template=[%s] from equipment to inventory container, container error code [%d].", getNetworkId().getValueString().c_str(), @@ -13322,18 +13322,18 @@ CreatureObject * CreatureObject::getCreatureObject(NetworkId const & networkId) CreatureObject const * CreatureObject::asCreatureObject(Object const * object) { - ServerObject const * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + ServerObject const * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - return (serverObject != NULL) ? serverObject->asCreatureObject() : NULL; + return (serverObject != nullptr) ? serverObject->asCreatureObject() : nullptr; } // ---------------------------------------------------------------------- CreatureObject * CreatureObject::asCreatureObject(Object * object) { - ServerObject * serverObject = (object != NULL) ? object->asServerObject() : NULL; + ServerObject * serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - return (serverObject != NULL) ? serverObject->asCreatureObject() : NULL; + return (serverObject != nullptr) ? serverObject->asCreatureObject() : nullptr; } // ---------------------------------------------------------------------- @@ -13474,7 +13474,7 @@ void CreatureObject::pushedMe(const NetworkId & attackerId, UNREF(defenderPos); Vector offset(getPosition_w()); - if (attacker != NULL) + if (attacker != nullptr) offset -= attacker->getPosition_w(); else offset -= attackerPos; @@ -13489,14 +13489,14 @@ void CreatureObject::pushedMe(const NetworkId & attackerId, move_p(rotate_w2p(offset)); AICreatureController *controller = dynamic_cast(getController()); - if (controller != NULL) + if (controller != nullptr) { // we only need to do this for npcs, because we'll use the update from a player's client for players // we need to do this for npcs to prevent the ai from moving them back to their previous position const Vector newPos(getPosition_p()); float closestPortalT = 0.0f; const CellProperty * destinationCell = getParentCell()->getDestinationCell(oldPos, newPos, closestPortalT); - if (destinationCell == NULL || destinationCell == getParentCell()) + if (destinationCell == nullptr || destinationCell == getParentCell()) { // no cell change controller->warpTo(getParentCell(), newPos); @@ -13576,7 +13576,7 @@ bool CreatureObject::addSlowDownEffectProxy(const TangibleObject & defender, flo { // if we already are doing a slowdown, don't do another Property * property = getProperty(SlowDownProperty::getClassPropertyId()); - if (property != NULL) + if (property != nullptr) return false; property = new SlowDownProperty(*this, CachedNetworkId(defender), coneLength, coneAngle, slopeAngle, expireTime); @@ -13598,11 +13598,11 @@ void CreatureObject::removeSlowDownEffect() // tell all my proxies (client and server) to remove the effect Controller * const controller = getController(); if (controller) - controller->appendMessage(CM_removeSlowDownEffectProxy, 0, NULL, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_ALL_CLIENT | GameControllerMessageFlags::DEST_PROXY_SERVER); + controller->appendMessage(CM_removeSlowDownEffectProxy, 0, nullptr, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_ALL_CLIENT | GameControllerMessageFlags::DEST_PROXY_SERVER); } else { - sendControllerMessageToAuthServer(CM_removeSlowDownEffect, NULL); + sendControllerMessageToAuthServer(CM_removeSlowDownEffect, nullptr); } } @@ -13613,7 +13613,7 @@ void CreatureObject::removeSlowDownEffect() */ void CreatureObject::removeSlowDownEffectProxy() { - if (getProperty(SlowDownProperty::getClassPropertyId()) != NULL) + if (getProperty(SlowDownProperty::getClassPropertyId()) != nullptr) removeProperty(SlowDownProperty::getClassPropertyId()); } @@ -13631,7 +13631,7 @@ void CreatureObject::addTerrainSlopeEffect(const Vector & normal) if (isAuthoritative() && !isPlayerControlled()) { Property * property = getProperty(SlopeEffectProperty::getClassPropertyId()); - if (property == NULL) + if (property == nullptr) { property = new SlopeEffectProperty(*this); addProperty(*property, true); @@ -13994,7 +13994,7 @@ void CreatureObject::setLevel(int level) else { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if (playerObject == NULL) + if (playerObject == nullptr) { // this is an ai, so just set the level m_level = (int16) level; @@ -14014,7 +14014,7 @@ void CreatureObject::setLevel(int level) void CreatureObject::recalculateLevel() { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if (playerObject != NULL) + if (playerObject != nullptr) { if (!isAuthoritative()) { @@ -14044,7 +14044,7 @@ void CreatureObject::recalculateLevel() void CreatureObject::setLevelData(int16 level, int levelXp, int health) { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if (playerObject != NULL) + if (playerObject != nullptr) { m_totalLevelXp = levelXp; @@ -14278,7 +14278,7 @@ bool CreatureObject::doesLocomotionInvalidateCommand(Command const &cmd) const CommandQueue * CreatureObject::getCommandQueue() const { - if (m_commandQueue == NULL) + if (m_commandQueue == nullptr) { m_commandQueue = CommandQueue::getCommandQueue(*const_cast(this)); } @@ -14667,7 +14667,7 @@ void CreatureObject::incrementKillMeter(int amount) if (isPlayerControlled()) { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(this); - if (playerObject != NULL) + if (playerObject != nullptr) { playerObject->incrementKillMeter(amount); } @@ -14812,7 +14812,7 @@ void CreatureObject::getLfgCharacterData(LfgCharacterData & lfgCharacterData) co Vector const creaturePosition = findPosition_w(); Region const * const region = RegionMaster::getSmallestVisibleRegionAtPoint(planetObject->getName(), creaturePosition.x, creaturePosition.z); - if (region != NULL) + if (region != nullptr) lfgCharacterData.locationRegion = Unicode::wideToNarrow(region->getName()); // handle factional presence @@ -14853,7 +14853,7 @@ void CreatureObject::getLfgCharacterData(LfgCharacterData & lfgCharacterData) co { // is factional presence allowed while mounted? if (ConfigServerGame::getGcwFactionalPresenceMountedPct() <= 0) - playerOrMount = NULL; + playerOrMount = nullptr; } else { @@ -14863,7 +14863,7 @@ void CreatureObject::getLfgCharacterData(LfgCharacterData & lfgCharacterData) co if (playerOrMount) { CollisionProperty const * const collisionProperty = playerOrMount->getCollisionProperty(); - Footprint const * const footprint = (collisionProperty ? collisionProperty->getFootprint() : NULL); + Footprint const * const footprint = (collisionProperty ? collisionProperty->getFootprint() : nullptr); bool isOnSolidFloor = (footprint && footprint->isOnSolidFloor()); if (isOnSolidFloor) { @@ -14939,7 +14939,7 @@ void CreatureObject::getLfgCharacterData(LfgCharacterData & lfgCharacterData) co if (i.getValue(ctsTransactionDetail)) { Unicode::UnicodeStringVector tokens; - if (Unicode::tokenize(ctsTransactionDetail, tokens, NULL, NULL) && (tokens.size() >= 4)) + if (Unicode::tokenize(ctsTransactionDetail, tokens, nullptr, nullptr) && (tokens.size() >= 4)) { IGNORE_RETURN(lfgCharacterData.ctsSourceGalaxy.insert(Unicode::wideToNarrow(tokens[1]))); } @@ -15094,7 +15094,7 @@ void CreatureObjectNamespace::restoreItemDecorationLayout(CreatureObject & decor // item is not currently in the target room, need to move it bool needToMoveItem = false; bool needToRotateItem = false; - Transform const * itemCurrentTransform = NULL; + Transform const * itemCurrentTransform = nullptr; if (itemContainingCell->getNetworkId() != cellSo->getNetworkId()) { needToMoveItem = true; @@ -15344,7 +15344,7 @@ void CreatureObject::addPackedAppearanceWearable(std::string const &appearanceDa } } //-- Add the new entry. - m_wearableAppearanceData.push_back(WearableEntry(appearanceData, arrangementIndex, networkId, sharedTemplateCrcValue, NULL, NULL)); + m_wearableAppearanceData.push_back(WearableEntry(appearanceData, arrangementIndex, networkId, sharedTemplateCrcValue, nullptr, nullptr)); } // ---------------------------------------------------------------------- @@ -15511,7 +15511,7 @@ void CreatureObject::saveDecorationLayout(ServerObject const & pobSourceObject, } snprintf(buffer1, sizeof(buffer1)-1, "savedDecoration%d.saveTime", saveSlotNumber); - playerObj->setObjVarItem(buffer1, static_cast(::time(NULL))); + playerObj->setObjVarItem(buffer1, static_cast(::time(nullptr))); snprintf(buffer1, sizeof(buffer1)-1, "savedDecoration%d.pobName", saveSlotNumber); playerObj->setObjVarItem(buffer1, containingPOB->getObjectNameStringId().localize()); @@ -15607,7 +15607,7 @@ void CreatureObject::restoreDecorationLayout(ServerObject const & pobTargetObjec } // don't allow another restore on the pob while one is still in progress - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); int restoreDecorationOperationTimeout = 0; if (getObjVars().getItem("restoreDecorationOperation.timeout", restoreDecorationOperationTimeout) && (restoreDecorationOperationTimeout > timeNow)) { diff --git a/engine/server/library/serverGame/src/shared/object/CreatureObject.h b/engine/server/library/serverGame/src/shared/object/CreatureObject.h index f2fb0607..a1fab43b 100755 --- a/engine/server/library/serverGame/src/shared/object/CreatureObject.h +++ b/engine/server/library/serverGame/src/shared/object/CreatureObject.h @@ -194,7 +194,7 @@ public: virtual void onClientReady (Client *c); virtual void onClientAboutToLoad(); virtual void onLoadingScreenComplete(); - virtual bool canManipulateObject(ServerObject const &target, bool movingObject, bool doPermissionCheckOnItem, bool doPermissionCheckOnParent, float maxDistance, Container::ContainerErrorCode&, bool skipNoTradeCheck = false, bool * allowedByGodMode = NULL) const; + virtual bool canManipulateObject(ServerObject const &target, bool movingObject, bool doPermissionCheckOnItem, bool doPermissionCheckOnParent, float maxDistance, Container::ContainerErrorCode&, bool skipNoTradeCheck = false, bool * allowedByGodMode = nullptr) const; virtual void onRemovingFromWorld(); void addMembersToPackages(); @@ -330,7 +330,7 @@ public: void addAttributeModifier(const std::string & name, Attributes::Enumerator attrib, int value, float duration, float attackRate, float decayRate, int flags); void addSkillmodModifier(const std::string & name, const std::string & skill, int value, float duration, int flags); - int addAttributeModifier(const AttribMod::AttribMod & mod, ServerObject * attacker = NULL); + int addAttributeModifier(const AttribMod::AttribMod & mod, ServerObject * attacker = nullptr); bool hasAttribModifier(const std::string & modName) const; void removeAttributeModifier(const std::string & modName); void removeAttributeModifiers(Attributes::Enumerator attribute); @@ -747,7 +747,7 @@ private: void testIncapacitation(const NetworkId & attackerId); void initializeNewPlayer (); - void addPackedWearable(std::string const &appearanceData, int arrangementIndex, NetworkId const &networkId, uint32 sharedTemplateCrcValue, const BaselinesMessage * weaponSharedBaselines = NULL, const BaselinesMessage * weaponSharedNpBaselines = NULL); + void addPackedWearable(std::string const &appearanceData, int arrangementIndex, NetworkId const &networkId, uint32 sharedTemplateCrcValue, const BaselinesMessage * weaponSharedBaselines = nullptr, const BaselinesMessage * weaponSharedNpBaselines = nullptr); void addPackedAppearanceWearable(std::string const &appearanceData, int arrangementIndex, NetworkId const &networkId, uint32 sharedTemplateCrcValue); void packWearables(); void computeTotalAttributes (); diff --git a/engine/server/library/serverGame/src/shared/object/CreatureObject_Mounts.cpp b/engine/server/library/serverGame/src/shared/object/CreatureObject_Mounts.cpp index 1b164c1e..a0367619 100755 --- a/engine/server/library/serverGame/src/shared/object/CreatureObject_Mounts.cpp +++ b/engine/server/library/serverGame/src/shared/object/CreatureObject_Mounts.cpp @@ -77,18 +77,18 @@ CreatureObject * CreatureObjectNamespace::realGetMountingRider(CreatureObject co { //-- Ensure mounts are enabled. if (!ConfigServerGame::getMountsEnabled()) - return NULL; + return nullptr; //-- Get the rider element from the slotted container. SlottedContainer const * const slottedContainer = ContainerInterface::getSlottedContainer(*mount); if (!slottedContainer) - return NULL; + return nullptr; //-- Check for a rider. Container::ContainerErrorCode errorCode = Container::CEC_Success; CachedNetworkId riderId = slottedContainer->getObjectInSlot(slot, errorCode); if (errorCode != Container::CEC_Success) - return NULL; + return nullptr; Object * const riderObject = riderId.getObject(); @@ -236,7 +236,7 @@ bool CreatureObjectNamespace::realDetachRider(CreatureObject * const mount, Slot { // Transfer rider to world. // @todo: -TRF- transfer to mount's cell if we allow mounts inside cells. - IGNORE_RETURN(ContainerInterface::transferItemToWorld(*rider, mount->getTransform_o2w(), NULL, errorCode)); + IGNORE_RETURN(ContainerInterface::transferItemToWorld(*rider, mount->getTransform_o2w(), nullptr, errorCode)); if (errorCode == Container::CEC_Success) { detachedRider = true; @@ -318,7 +318,7 @@ void CreatureObject::transferRiderPositionToMount() CreatureObject *const mountObject = getMountedCreature(); if (!mountObject) { - LOG("mounts-bug", ("CreatureObject::transferRiderPositionToMount(): server id=[%d],object id=[%s] has state RidingMount but getMountedCreature() returns NULL.", static_cast(GameServer::getInstance().getProcessId()), getNetworkId().getValueString().c_str())); + LOG("mounts-bug", ("CreatureObject::transferRiderPositionToMount(): server id=[%d],object id=[%s] has state RidingMount but getMountedCreature() returns nullptr.", static_cast(GameServer::getInstance().getProcessId()), getNetworkId().getValueString().c_str())); emergencyDismountForRider(); return; } @@ -397,7 +397,7 @@ void CreatureObject::alterAuthoritativeForMounts() } } else - LOG(cs_mountErrorChannelName, ("unexpected: rider object id=[%s],template=[%s] is reporting state States::RidingMount turned on but getMountedCreature() returned NULL.", getNetworkId().getValueString().c_str(), getObjectTemplateName())); + LOG(cs_mountErrorChannelName, ("unexpected: rider object id=[%s],template=[%s] is reporting state States::RidingMount turned on but getMountedCreature() returned nullptr.", getNetworkId().getValueString().c_str(), getObjectTemplateName())); } else if (getState(States::MountedCreature)) { @@ -484,7 +484,7 @@ void CreatureObject::alterAnyForMounts() if (isAuthoritative() && !getState(States::MountedCreature)) { WARNING(true, - ("mounts sanity check failure: game server id=[%d], mount id=[%s,%s], rider id=[%s,%s]: authoritative mount does not have MountedCreature state set but getMountingRider returned a non-NULL value.", + ("mounts sanity check failure: game server id=[%d], mount id=[%s,%s], rider id=[%s,%s]: authoritative mount does not have MountedCreature state set but getMountingRider returned a non-nullptr value.", static_cast(GameServer::getInstance().getProcessId()), getNetworkId().getValueString().c_str(), isAuthoritative() ? "authoritative" : "proxy", @@ -511,7 +511,7 @@ void CreatureObject::alterAnyForMounts() // Ensure we don't have the mounted creature state set (only do check on authoritative mount). WARNING(isAuthoritative() && getState(States::MountedCreature), - ("mounts sanity check failure: game server id=[%d], mount id=[%s,%s]: authoritative mount does have MountedCreature state set but getMountingRider() returned a NULL value.", + ("mounts sanity check failure: game server id=[%d], mount id=[%s,%s]: authoritative mount does have MountedCreature state set but getMountingRider() returned a nullptr value.", static_cast(GameServer::getInstance().getProcessId()), getNetworkId().getValueString().c_str(), isAuthoritative() ? "authoritative" : "proxy" @@ -550,7 +550,7 @@ void CreatureObject::alterAnyForMounts() if (isAuthoritative() && !getState(States::RidingMount)) { WARNING(true, - ("mounts sanity check failure: game server id=[%d], rider id=[%s,%s], mount id=[%s,%s]: authoritative rider does not have RidingMount state set but getMountedCreature() returned a non-NULL value.", + ("mounts sanity check failure: game server id=[%d], rider id=[%s,%s], mount id=[%s,%s]: authoritative rider does not have RidingMount state set but getMountedCreature() returned a non-nullptr value.", static_cast(GameServer::getInstance().getProcessId()), getNetworkId().getValueString().c_str(), isAuthoritative() ? "authoritative" : "proxy", @@ -576,7 +576,7 @@ void CreatureObject::alterAnyForMounts() { // Ensure we don't have the RidingMount state set (only do check on authoritative rider). WARNING(isAuthoritative() && getState(States::RidingMount), - ("mounts sanity check failure: game server id=[%d], rider id=[%s,%s]: authoritative rider does have RidingMount state set but getMountedCreature() returned a NULL value.", + ("mounts sanity check failure: game server id=[%d], rider id=[%s,%s]: authoritative rider does have RidingMount state set but getMountedCreature() returned a nullptr value.", static_cast(GameServer::getInstance().getProcessId()), getNetworkId().getValueString().c_str(), isAuthoritative() ? "authoritative" : "proxy" @@ -599,13 +599,13 @@ bool CreatureObject::onContainerAboutToTransferForMounts(ServerObject const * de // (i.e. the container creature has not yet been set.) We must clear the RidingMount // state on a rider prior to intentionally dismounting the rider (see and use detachRider() // on the mount object. - bool const canChangeContainerNow = (getMountedCreature() == NULL); + bool const canChangeContainerNow = (getMountedCreature() == nullptr); if (!canChangeContainerNow) { LOG("mounts-bug", ("CO::onContainerAboutToTransferForMounts():server id=[%d],rider id=[%s] erroneously tried to transfer the player into object id=[%s].", static_cast(GameServer::getInstance().getProcessId()), getNetworkId().getValueString().c_str(), - (destination == NULL) ? "" : destination->getNetworkId().getValueString().c_str())); + (destination == nullptr) ? "" : destination->getNetworkId().getValueString().c_str())); } return canChangeContainerNow; } @@ -839,7 +839,7 @@ bool CreatureObject::detachAllRiders() if (!isAuthoritative()) { // add a plural message - sendControllerMessageToAuthServer(CM_detachAllRidersForMount, NULL); + sendControllerMessageToAuthServer(CM_detachAllRidersForMount, nullptr); return true; } @@ -988,9 +988,9 @@ bool CreatureObject::mountCreature(CreatureObject &mountObject) for (int i = 0; i < maxSlots; ++i) { - if (ContainerInterface::canTransferToSlot(mountObject, *this, s_riderSlotId[i], NULL, errorCode)) + if (ContainerInterface::canTransferToSlot(mountObject, *this, s_riderSlotId[i], nullptr, errorCode)) { - transferSuccess = ContainerInterface::transferItemToSlottedContainer(mountObject, *this, s_riderSlotId[i], NULL, errorCode); + transferSuccess = ContainerInterface::transferItemToSlottedContainer(mountObject, *this, s_riderSlotId[i], nullptr, errorCode); if ((transferSuccess) && (errorCode == Container::CEC_Success)) { @@ -1051,20 +1051,20 @@ CreatureObject *CreatureObject::getMountedCreature() { //-- Ensure mounts are enabled. if (!ConfigServerGame::getMountsEnabled()) - return NULL; + return nullptr; //-- Check this creature's container object. ServerObject *const container = safe_cast(ContainerInterface::getContainedByObject(*this)); if (!container) - return NULL; + return nullptr; //-- Check if the container is a creature. CreatureObject *const creatureContainer = container->asCreatureObject(); if (!creatureContainer) - return NULL; + return nullptr; //-- Ignore non-mountable creature objects. - CreatureObject *const mount = creatureContainer->isMountable() ? creatureContainer : NULL; + CreatureObject *const mount = creatureContainer->isMountable() ? creatureContainer : nullptr; return mount; } @@ -1096,7 +1096,7 @@ void CreatureObject::emergencyDismountForRider() //-- Pass request along to authoritative server if we're not it. if (!isAuthoritative()) { - sendControllerMessageToAuthServer(CM_emergencyDismountForRider, NULL); + sendControllerMessageToAuthServer(CM_emergencyDismountForRider, nullptr); return; } @@ -1116,7 +1116,7 @@ void CreatureObject::emergencyDismountForRider() //-- Transfer the rider to the world cell. Container::ContainerErrorCode errorCode = Container::CEC_Success; - bool const transferSucceeded = ContainerInterface::transferItemToWorld (*this, this->getTransform_o2w(), NULL, errorCode); + bool const transferSucceeded = ContainerInterface::transferItemToWorld (*this, this->getTransform_o2w(), nullptr, errorCode); WARNING(!transferSucceeded || (errorCode != Container::CEC_Success), ("Transfer to world failed, return value=[%s], error code=[%d].", transferSucceeded ? "true" : "false", static_cast(errorCode))); } diff --git a/engine/server/library/serverGame/src/shared/object/CreatureObject_Ships.cpp b/engine/server/library/serverGame/src/shared/object/CreatureObject_Ships.cpp index 3f9de076..a72020be 100755 --- a/engine/server/library/serverGame/src/shared/object/CreatureObject_Ships.cpp +++ b/engine/server/library/serverGame/src/shared/object/CreatureObject_Ships.cpp @@ -71,7 +71,7 @@ bool CreatureObject::pilotShip(ServerObject &pilotSlotObject) SlotId const pilotSlotId = pilotSlotObject.asShipObject() ? ShipSlotIdManager::getShipPilotSlotId() : ShipSlotIdManager::getPobShipPilotSlotId(); Container::ContainerErrorCode errorCode = Container::CEC_Success; - bool const transferSuccess = ContainerInterface::transferItemToSlottedContainer(pilotSlotObject, *this, pilotSlotId, NULL, errorCode); + bool const transferSuccess = ContainerInterface::transferItemToSlottedContainer(pilotSlotObject, *this, pilotSlotId, nullptr, errorCode); DEBUG_FATAL(transferSuccess && (errorCode != Container::CEC_Success), ("pilotShip(): transferItemToSlottedContainer() returned success but container error code returned error %d.", static_cast(errorCode))); if (transferSuccess) @@ -199,7 +199,7 @@ void CreatureObject::getAllShipsInDatapad(std::vector & result) const for(ContainerConstIterator iter = datapadContainer->begin(); iter != datapadContainer->end(); ++iter) { Object const * const itemO = (*iter).getObject(); - ServerObject const * const itemSO = itemO ? itemO->asServerObject() : NULL; + ServerObject const * const itemSO = itemO ? itemO->asServerObject() : nullptr; if(itemSO && (itemSO->getGameObjectType() == SharedObjectTemplate::GOT_data_ship_control_device)) { Container const * const itemContainer = ContainerInterface::getContainer(*itemSO); @@ -211,8 +211,8 @@ void CreatureObject::getAllShipsInDatapad(std::vector & result) const for(ContainerConstIterator iter2 = itemContainer->begin(); iter2 != itemContainer->end(); ++iter2) { Object const * const o = (*iter2).getObject(); - ServerObject const * const so = o ? o->asServerObject() : NULL; - ShipObject const * const ship = so ? so->asShipObject() : NULL; + ServerObject const * const so = o ? o->asServerObject() : nullptr; + ShipObject const * const ship = so ? so->asShipObject() : nullptr; if(ship) { result.push_back(ship->getNetworkId()); diff --git a/engine/server/library/serverGame/src/shared/object/DraftSchematicObject.cpp b/engine/server/library/serverGame/src/shared/object/DraftSchematicObject.cpp index 37ea045c..b0ec57ba 100755 --- a/engine/server/library/serverGame/src/shared/object/DraftSchematicObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/DraftSchematicObject.cpp @@ -36,8 +36,8 @@ static const std::string REQUEST_RESOURCE_WEIGHTS_SCRIPT_METHOD("OnRequestResour // ====================================================================== // static members -DraftSchematicObject::SchematicMap * DraftSchematicObject::m_schematics = NULL; -const SharedObjectTemplate * DraftSchematicObject::m_defaultSharedTemplate = NULL; +DraftSchematicObject::SchematicMap * DraftSchematicObject::m_schematics = nullptr; +const SharedObjectTemplate * DraftSchematicObject::m_defaultSharedTemplate = nullptr; // ====================================================================== @@ -105,13 +105,13 @@ const SharedObjectTemplate * DraftSchematicObject::getDefaultSharedTemplate(void { static const ConstCharCrcLowerString templateName("object/draft_schematic/base/shared_draft_schematic_default.iff"); - if (m_defaultSharedTemplate == NULL) + if (m_defaultSharedTemplate == nullptr) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create " + WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create " "default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) ExitChain::add (removeDefaultTemplate, "DraftSchematicObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -124,10 +124,10 @@ static const ConstCharCrcLowerString templateName("object/draft_schematic/base/s */ void DraftSchematicObject::removeDefaultTemplate(void) { - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } // DraftSchematicObject::removeDefaultTemplate @@ -141,21 +141,21 @@ void DraftSchematicObject::removeDefaultTemplate(void) */ void DraftSchematicObject::requestResourceWeights(ServerObject & requester, uint32 draftSchematicCrc) { - if (requester.getClient() == NULL) + if (requester.getClient() == nullptr) { WARNING (true, ("DraftSchematicObject::requestResourceWeights invalid client for [%s]", requester.getNetworkId ().getValueString ().c_str ())); return; } const DraftSchematicObject * const schematic = getSchematic(draftSchematicCrc); - if (schematic == NULL) + if (schematic == nullptr) { WARNING (true, ("DraftSchematicObject::requestResourceWeights invalid schematic [%lu] for [%s]", draftSchematicCrc, requester.getNetworkId ().getValueString ().c_str ())); return; } const ServerDraftSchematicObjectTemplate * const schematicTemplate = safe_cast(schematic->getObjectTemplate()); - if (schematicTemplate == NULL) + if (schematicTemplate == nullptr) { WARNING (true, ("DraftSchematicObject::requestResourceWeights invalid schematic template [%lu] for [%s]", draftSchematicCrc, requester.getNetworkId ().getValueString ().c_str ())); return; @@ -167,7 +167,7 @@ void DraftSchematicObject::requestResourceWeights(ServerObject & requester, uint desiredAttribs.push_back((*i).first.getText().c_str()); } - std::vector attributes(MAX_ATTRIBUTES * 2, static_cast(NULL)); + std::vector attributes(MAX_ATTRIBUTES * 2, static_cast(nullptr)); std::vector slots(MAX_ATTRIBUTES * 2, 0); std::vector counts(MAX_ATTRIBUTES * 2, 0); std::vector weights(MAX_ATTRIBUTES * 2 * Crafting::RA_numResourceAttributes * 2, 0); @@ -198,7 +198,7 @@ void DraftSchematicObject::requestResourceWeights(ServerObject & requester, uint for (std::vector::const_iterator i(newAttributes.begin()); i != newAttributes.end(); ++i, ++attribCount) { - if (*i == NULL) + if (*i == nullptr) break; } } @@ -257,8 +257,8 @@ ManufactureSchematicObject * DraftSchematicObject::createManufactureSchematic( { Object * object = ServerManufactureSchematicObjectTemplate::createObject( "object/manufacture_schematic/generic_schematic.iff", *this); - if (object == NULL) - return NULL; + if (object == nullptr) + return nullptr; ManufactureSchematicObject * schematic = safe_cast(object); schematic->init(*this, creator); schematic->setNetworkId(ObjectIdManager::getInstance().getNewObjectId()); @@ -478,8 +478,8 @@ const DraftSchematicObject * DraftSchematicObject::getSchematic( const DraftSchematicObject * DraftSchematicObject::getSchematic(uint32 crc) { NOT_NULL(m_schematics); - if (m_schematics == NULL || crc == 0) - return NULL; + if (m_schematics == nullptr || crc == 0) + return nullptr; // see if the schematic is already loaded SchematicMap::iterator result = m_schematics->find(crc); @@ -491,30 +491,30 @@ const DraftSchematicObject * DraftSchematicObject::getSchematic(uint32 crc) if (name.isEmpty()) { WARNING(true, ("Unable to find template name for crc %u", crc)); - return NULL; + return nullptr; } // create a new schematic if (!TreeFile::exists(name.getString())) { WARNING(true, ("Draft schematic template %s file not found", name.getString())); - return NULL; + return nullptr; } const ObjectTemplate * objTemplate = ObjectTemplateList::fetch(name); - if (objTemplate == NULL) + if (objTemplate == nullptr) { WARNING(true, ("Can't create object template %s", name.getString())); - return NULL; + return nullptr; } const ServerDraftSchematicObjectTemplate * schematicTemplate = dynamic_cast(objTemplate); - if (schematicTemplate == NULL) + if (schematicTemplate == nullptr) { WARNING(true, ("Template %s is not a draft schematic", name.getString())); objTemplate->releaseReference(); - return NULL; + return nullptr; } const DraftSchematicObject * schematic = new DraftSchematicObject(schematicTemplate); @@ -531,7 +531,7 @@ const DraftSchematicObject * DraftSchematicObject::getSchematic(uint32 crc) */ void DraftSchematicObject::install() { - if (m_schematics == NULL) + if (m_schematics == nullptr) m_schematics = new SchematicMap(); } // DraftSchematicObject::install @@ -542,16 +542,16 @@ void DraftSchematicObject::install() */ void DraftSchematicObject::remove() { - if (m_schematics != NULL) + if (m_schematics != nullptr) { SchematicMap::iterator iter; for (iter = m_schematics->begin(); iter != m_schematics->end(); ++iter) { delete (*iter).second; - (*iter).second = NULL; + (*iter).second = nullptr; } delete m_schematics; - m_schematics = NULL; + m_schematics = nullptr; } } // DraftSchematicObject::remove diff --git a/engine/server/library/serverGame/src/shared/object/FactoryObject.cpp b/engine/server/library/serverGame/src/shared/object/FactoryObject.cpp index 77e6780b..66481dad 100755 --- a/engine/server/library/serverGame/src/shared/object/FactoryObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/FactoryObject.cpp @@ -58,7 +58,7 @@ static const StringId STRING_ID_CANT_SPLIT("system_msg", "cant_split_crate"); //---------------------------------------------------------------------- -const SharedObjectTemplate * FactoryObject::m_defaultSharedTemplate = NULL; +const SharedObjectTemplate * FactoryObject::m_defaultSharedTemplate = nullptr; //----------------------------------------------------------------------- @@ -176,7 +176,7 @@ void FactoryObject::onLoadedFromDatabase() if (getLoadContents() && getCount() > 0) { // verify that we have a contained object - if (getContainedObject() == NULL) + if (getContainedObject() == nullptr) { WARNING_STRICT_FATAL(true, ("Factory object %s has a count of %d, " "but no contained object! We are setting the count to 0.", @@ -197,11 +197,11 @@ const SharedObjectTemplate * FactoryObject::getDefaultSharedTemplate() const { static const ConstCharCrcLowerString templateName("object/factory/base/shared_factory_default.iff"); - if (m_defaultSharedTemplate == NULL) + if (m_defaultSharedTemplate == nullptr) { m_defaultSharedTemplate = safe_cast(ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != NULL) + WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create default shared object template %s", templateName.getString())); + if (m_defaultSharedTemplate != nullptr) ExitChain::add (removeDefaultTemplate, "FactoryObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -214,10 +214,10 @@ const SharedObjectTemplate * FactoryObject::getDefaultSharedTemplate() const */ void FactoryObject::removeDefaultTemplate() { - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } // FactoryObject::removeDefaultTemplate @@ -288,10 +288,10 @@ bool FactoryObject::isFactoryOk() const char errBuffer[BUFSIZE]; const DraftSchematicObject * draft = DraftSchematicObject::getSchematic( getDraftSchematic()); - if (draft != NULL) + if (draft != nullptr) { // make sure we have an object instance defined - if (getCount() > 0 && getContainedObject() == NULL) + if (getCount() > 0 && getContainedObject() == nullptr) { sprintf(errBuffer, "not having a contained object instance"); factoryOk = false; @@ -307,16 +307,16 @@ bool FactoryObject::isFactoryOk() const { // send out logs/emails m_badFactoryLogged = true; - const ServerObject * owner = NULL; + const ServerObject * owner = nullptr; const Object * object = NetworkIdManager::getObjectById(getOwnerId()); - if (object != NULL) + if (object != nullptr) owner = object->asServerObject(); // log that the schematic can't be used LOG("CustomerService", ("Crafting: factory crate object %s " "owned by %s is unuseable due to %s", getNetworkId().getValueString().c_str(), PlayerObject::getAccountDescription(owner).c_str(), errBuffer)); - if (owner != NULL) + if (owner != nullptr) { // send mail to the owner telling them their schematic can't be used const static StringId message("system_msg", "crate_unuseable"); @@ -351,7 +351,7 @@ bool FactoryObject::canDestroy() const OutOfBandPackager::pack(pp, -1, oob); } const Object * const owner = NetworkIdManager::getObjectById(getOwnerId()); - if (owner != NULL) + if (owner != nullptr) { Chat::sendSystemMessage(*(owner->asServerObject()), Unicode::emptyString, oob); } @@ -367,14 +367,14 @@ bool FactoryObject::canDestroy() const void FactoryObject::onContainerTransfer(ServerObject * destination, ServerObject* transferer) { - if (inCraftingSession() && destination != NULL && + if (inCraftingSession() && destination != nullptr && destination->getNetworkId() != m_craftingSchematic.get()) { if (!isFactoryOk()) return; Object * schematic = m_craftingSchematic.get().getObject(); - if (schematic == NULL) + if (schematic == nullptr) { WARNING(true, ("FactoryObject::onContainerTransfer: could not get the schematic for factory %s", getNetworkId().getValueString().c_str())); return; @@ -387,13 +387,13 @@ void FactoryObject::onContainerTransfer(ServerObject * destination, // our components to reference if (m_craftingCount.get() != 0) { - FactoryObject * newFactory = NULL; + FactoryObject * newFactory = nullptr; if (getCount() > 1) { // make a new factory in the manf schematic newFactory = makeCopy(*(m_craftingSchematic.get().getObject()-> asServerObject()), 1); - if (newFactory != NULL) + if (newFactory != nullptr) { // NOTE: potential dupe here, but the player shouldn't be able to // remove the new factory without decreasing the component count @@ -403,26 +403,26 @@ void FactoryObject::onContainerTransfer(ServerObject * destination, // swap the contained item instances so that any current references // will point to a local object TangibleObject * myObject = const_cast(getContainedObject()); - if (myObject == NULL) + if (myObject == nullptr) { - WARNING(true, ("FactoryObject::onContainerTransfer: getContainedObject for %s returned NULL", getNetworkId().getValueString().c_str())); + WARNING(true, ("FactoryObject::onContainerTransfer: getContainedObject for %s returned nullptr", getNetworkId().getValueString().c_str())); return; } TangibleObject * newObject = const_cast(newFactory->getContainedObject()); - if (newObject == NULL) + if (newObject == nullptr) { - WARNING(true, ("FactoryObject::onContainerTransfer: getContainedObject for %s returned NULL", newFactory->getNetworkId().getValueString().c_str())); + WARNING(true, ("FactoryObject::onContainerTransfer: getContainedObject for %s returned nullptr", newFactory->getNetworkId().getValueString().c_str())); newFactory->permanentlyDestroy(DeleteReasons::SetupFailed); return; } Container::ContainerErrorCode error; - if (!ContainerInterface::transferItemToVolumeContainer (*newFactory, *myObject, NULL, error)) + if (!ContainerInterface::transferItemToVolumeContainer (*newFactory, *myObject, nullptr, error)) { WARNING(true, ("FactoryObject::onContainerTransfer: could not transfer factory %s to container %s", newFactory->getNetworkId().getValueString().c_str(), myObject->getNetworkId().getValueString().c_str())); newFactory->permanentlyDestroy(DeleteReasons::SetupFailed); return; } - if (!ContainerInterface::transferItemToVolumeContainer (*this, *newObject, NULL, error)) + if (!ContainerInterface::transferItemToVolumeContainer (*this, *newObject, nullptr, error)) { WARNING(true, ("FactoryObject::onContainerTransfer: could not transfer factory %s to container %s", getNetworkId().getValueString().c_str(), newObject->getNetworkId().getValueString().c_str())); return; @@ -434,7 +434,7 @@ void FactoryObject::onContainerTransfer(ServerObject * destination, // make a new factory with one item, but don't destroy ourself newFactory = makeCopy(*(m_craftingSchematic.get().getObject()-> asServerObject()), 1, false); - if (newFactory == NULL) + if (newFactory == nullptr) { WARNING(true, ("FactoryObject::onContainerTransfer: could not make a copy of factory %s", getNetworkId().getValueString().c_str())); return; @@ -448,9 +448,9 @@ void FactoryObject::onContainerTransfer(ServerObject * destination, // update the crafting status of ourself and the new factory ManufactureSchematicObject * schematic = safe_cast( m_craftingSchematic.get().getObject()); - if (schematic != NULL) + if (schematic != nullptr) { - if (newFactory != NULL) + if (newFactory != nullptr) { // set up the new factory to have the same crafting info // that we do @@ -525,7 +525,7 @@ bool FactoryObject::inCraftingSession() const return false; // make sure the crafting schematic id is a valid object - if (m_craftingSchematic.get().getObject() == NULL) + if (m_craftingSchematic.get().getObject() == nullptr) { WARNING_STRICT_FATAL(true, ("FactoryObject %s has a schematic id of %s " "that isn't a valid object!!!", getNetworkId().getValueString().c_str(), @@ -598,7 +598,7 @@ bool FactoryObject::addObject() if (getCount() == 0) { TangibleObject * object = manufactureObject(); - if (object != NULL) + if (object != nullptr) { setObjectName(object->getObjectName()); setComplexity(object->getComplexity()); @@ -615,7 +615,7 @@ bool FactoryObject::addObject() } const ServerObject * parent = safe_cast(ContainerInterface::getFirstParentInWorld(*this)); - if (parent != NULL) + if (parent != nullptr) LOG("CustomerService", ("Crafting:incrementing count of crate %s (owner %s) to %d", getNetworkId().getValueString().c_str(), PlayerObject::getAccountDescription(parent->getOwnerId()).c_str(), getCount())); else LOG("CustomerService", ("Crafting:incrementing count of crate %s to %d", getNetworkId().getValueString().c_str(), getCount())); @@ -645,7 +645,7 @@ bool FactoryObject::removeObject(ServerObject & destination) if (!isFactoryOk()) return false; - if (getCount() > 0 && ContainerInterface::getVolumeContainer(destination) != NULL) + if (getCount() > 0 && ContainerInterface::getVolumeContainer(destination) != nullptr) { if (!getLoadContents()) { @@ -665,7 +665,7 @@ bool FactoryObject::removeObject(ServerObject & destination) else { // new style factory - TangibleObject * object = NULL; + TangibleObject * object = nullptr; if (getCount() > 1) { object = manufactureObject(); @@ -686,7 +686,7 @@ bool FactoryObject::removeObject(ServerObject & destination) } const CachedNetworkId & id = *(container->begin()); Object * obj = id.getObject(); - if (obj != NULL && obj->asServerObject()->asTangibleObject() != NULL) + if (obj != nullptr && obj->asServerObject()->asTangibleObject() != nullptr) { object = obj->asServerObject()->asTangibleObject(); } @@ -706,15 +706,15 @@ bool FactoryObject::removeObject(ServerObject & destination) object = manufactureObject(); } } - if (object != NULL) + if (object != nullptr) { Container::ContainerErrorCode error; - if (ContainerInterface::transferItemToVolumeContainer(destination, *object, NULL, error)) + if (ContainerInterface::transferItemToVolumeContainer(destination, *object, nullptr, error)) { incrementCount(-1); const ServerObject * parent = safe_cast(ContainerInterface::getFirstParentInWorld(destination)); - if (parent != NULL) + if (parent != nullptr) LOG("CustomerService", ("Crafting:removed object %s from crate %s to container %s of player %s. Crate count = %d", object->getNetworkId().getValueString().c_str(), getNetworkId().getValueString().c_str(), destination.getNetworkId().getValueString().c_str(), PlayerObject::getAccountDescription(parent->getNetworkId()).c_str(), getCount())); else LOG("CustomerService", ("Crafting:removed object %s from crate %s to container %s. Crate count = %d", object->getNetworkId().getValueString().c_str(), getNetworkId().getValueString().c_str(), destination.getNetworkId().getValueString().c_str(), getCount())); @@ -828,14 +828,14 @@ void FactoryObject::onContainedObjectLoaded(const NetworkId &oid) // check if the object is on our pending list ServerObject * destination = removeIdFromPendingList(oid); - if (destination != NULL) + if (destination != nullptr) { TangibleObject * item = safe_cast(NetworkIdManager::getObjectById( oid)); - if (item != NULL) + if (item != nullptr) { Container::ContainerErrorCode error = Container::CEC_Success; - if (ContainerInterface::transferItemToVolumeContainer(*destination, *item, NULL, error)) + if (ContainerInterface::transferItemToVolumeContainer(*destination, *item, nullptr, error)) { // if that was the last item of ours, delete ourself if (getCount() == 0 && getPendingListCount() == 0) @@ -849,7 +849,7 @@ void FactoryObject::onContainedObjectLoaded(const NetworkId &oid) item->unload(); // tell the owner something went wrong Object * owner = NetworkIdManager::getObjectById(getOwnerId()); - if (owner != NULL) + if (owner != nullptr) { ContainerInterface::sendContainerMessageToClient(*safe_cast(owner), error); } @@ -873,35 +873,35 @@ void FactoryObject::onContainedObjectLoaded(const NetworkId &oid) * functionality of ManufactureSchematicObject::manufactureObject; if that * function changes, this one should too. * - * @return the new object, or NULL on error + * @return the new object, or nullptr on error */ TangibleObject * FactoryObject::manufactureObject() { if (!isFactoryOk()) - return NULL; + return nullptr; const DraftSchematicObject * draftSchematic = DraftSchematicObject::getSchematic(getDraftSchematic()); - if (draftSchematic == NULL) + if (draftSchematic == nullptr) { - return NULL; + return nullptr; } - if (draftSchematic->getCraftedObjectTemplate() == NULL) + if (draftSchematic->getCraftedObjectTemplate() == nullptr) { DEBUG_WARNING(true, ("Draft schematic %s does not have a craftable object template!\n", draftSchematic->getTemplateName())); - return NULL; + return nullptr; } // create the item TangibleObject * const object = dynamic_cast( ServerWorld::createNewObject(*draftSchematic->getCraftedObjectTemplate(), *this, false)); - if (object == NULL) + if (object == nullptr) { DEBUG_WARNING(true, ("Player %s failed to create object for template " "%s.\n", getOwnerId().getValueString().c_str(), draftSchematic->getCraftedObjectTemplate()->getName())); - return NULL; + return nullptr; } if (!getAssignedObjectName().empty()) @@ -928,7 +928,7 @@ TangibleObject * FactoryObject::manufactureObject() // set the creator xp type from the schematic template const ServerObjectTemplate * schematicTemplate = safe_cast(draftSchematic->getObjectTemplate()); - if (schematicTemplate != NULL && schematicTemplate->getXpPointsCount() > 0) + if (schematicTemplate != nullptr && schematicTemplate->getXpPointsCount() > 0) { ServerObjectTemplate::Xp xpData; schematicTemplate->getXpPoints(xpData, 0); @@ -948,7 +948,7 @@ TangibleObject * FactoryObject::manufactureObject() if (result == SCRIPT_OVERRIDE) { object->permanentlyDestroy(DeleteReasons::Script); - return NULL; + return nullptr; } return object; @@ -968,10 +968,10 @@ const char * FactoryObject::getContainedTemplateName() const const VolumeContainer * container = ContainerInterface::getVolumeContainer(*this); const CachedNetworkId & id = *(container->begin()); const Object * obj = id.getObject(); - if (obj != NULL && obj->asServerObject() != NULL) + if (obj != nullptr && obj->asServerObject() != nullptr) return obj->asServerObject()->getTemplateName(); } - return NULL; + return nullptr; } // FactoryObject::getContainedTemplateName // ---------------------------------------------------------------------- @@ -997,10 +997,10 @@ static std::string sharedTemplateName; const VolumeContainer * container = ContainerInterface::getVolumeContainer(*this); const CachedNetworkId & id = *(container->begin()); const Object * obj = id.getObject(); - if (obj != NULL && obj->asServerObject() != NULL) + if (obj != nullptr && obj->asServerObject() != nullptr) return obj->asServerObject()->getSharedTemplateName(); } - return NULL; + return nullptr; } // FactoryObject::getContainedSharedTemplateName // ---------------------------------------------------------------------- @@ -1017,10 +1017,10 @@ const ObjectTemplate * FactoryObject::getContainedObjectTemplate() const const VolumeContainer * container = ContainerInterface::getVolumeContainer(*this); const CachedNetworkId & id = *(container->begin()); const Object * obj = id.getObject(); - if (obj != NULL && obj->asServerObject() != NULL) + if (obj != nullptr && obj->asServerObject() != nullptr) return obj->asServerObject()->getObjectTemplate(); } - return NULL; + return nullptr; } // FactoryObject::getContainedObjectTemplate // ---------------------------------------------------------------------- @@ -1037,12 +1037,12 @@ const TangibleObject * FactoryObject::getContainedObject() const const VolumeContainer * container = ContainerInterface::getVolumeContainer(*this); const CachedNetworkId & id = *(container->begin()); const Object * obj = id.getObject(); - if (obj != NULL && obj->asServerObject() != NULL) + if (obj != nullptr && obj->asServerObject() != nullptr) { return obj->asServerObject()->asTangibleObject(); } } - return NULL; + return nullptr; } // FactoryObject::getContainedObject // ---------------------------------------------------------------------- @@ -1109,7 +1109,7 @@ ServerObject * FactoryObject::removeIdFromPendingList(const NetworkId & id) NetworkId objectId; if (!pendingList.getItem(idString,objectId)) - return NULL; + return nullptr; ServerObject * const object = safe_cast(NetworkIdManager::getObjectById(objectId)); removeObjVarItem(pendingList.getContextName() + idString); @@ -1415,7 +1415,7 @@ FactoryObject * FactoryObject::makeCopy(ServerObject & destination, int count, bool destroySource) { if (!isFactoryOk()) - return NULL; + return nullptr; // don't allow making a copy if we are an old crate if (!getLoadContents()) @@ -1428,52 +1428,52 @@ FactoryObject * FactoryObject::makeCopy(ServerObject & destination, int count, OutOfBandPackager::pack(pp, -1, oob); } const Object * const owner = NetworkIdManager::getObjectById(getOwnerId()); - if (owner != NULL) + if (owner != nullptr) { Chat::sendSystemMessage(*(owner->asServerObject()), Unicode::emptyString, oob); } - return NULL; + return nullptr; } if (count <= 0) { WARNING_STRICT_FATAL(true, ("FactoryObject::makeCopy %s passed invalid " "count %d", getNetworkId().getValueString().c_str(), count)); - return NULL; + return nullptr; } if (count > getCount()) { WARNING_STRICT_FATAL(true, ("FactoryObject::makeCopy %s given count %d " "that is > than our count %d", getNetworkId().getValueString().c_str(), count, getCount())); - return NULL; + return nullptr; } VolumeContainer *destVolumeContainer = ContainerInterface::getVolumeContainer(destination); - if (destVolumeContainer == NULL) + if (destVolumeContainer == nullptr) { WARNING_STRICT_FATAL(true, ("FactoryObject::makeCopy %s passed " "destination %s that is not a volume container", getNetworkId().getValueString().c_str(), destination.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } // create the new factory - if (safe_cast(getObjectTemplate()) == NULL) + if (safe_cast(getObjectTemplate()) == nullptr) { WARNING_STRICT_FATAL(true, ("FactoryObject::makeCopy: %s has no object template!", getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } FactoryObject * newFactory = safe_cast(ServerWorld::createNewObject( *safe_cast(getObjectTemplate()), destination, false)); - if (newFactory == NULL) + if (newFactory == nullptr) { WARNING_STRICT_FATAL(true, ("FactoryObject::makeCopy %s could not create " "the new factory", getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } // copy our objvars and scripts to the new factory @@ -1523,11 +1523,11 @@ FactoryObject * FactoryObject::makeCopy(ServerObject & destination, int count, // move our contained object to the new factory, and delete ourself if // we aren't already being deleted const TangibleObject * object = FactoryObject::getContainedObject(); - if (object != NULL) + if (object != nullptr) { Container::ContainerErrorCode error; ContainerInterface::transferItemToVolumeContainer(*newFactory, - *const_cast(object), NULL, error); + *const_cast(object), nullptr, error); newFactory->setCount(count); setCount(0); if (destroySource && !isBeingDestroyed()) @@ -1545,7 +1545,7 @@ FactoryObject * FactoryObject::makeCopy(ServerObject & destination, int count, else { newFactory->permanentlyDestroy(DeleteReasons::SetupFailed); - newFactory = NULL; + newFactory = nullptr; } } return newFactory; @@ -1575,7 +1575,7 @@ void FactoryObject::getAttributes(AttributeVector & data) const { // new-style crate const ServerObject * const storedObject = getContainedObject(); - if (storedObject != NULL) + if (storedObject != nullptr) { data.reserve (data.size () + 2); diff --git a/engine/server/library/serverGame/src/shared/object/GroupIdObserver.cpp b/engine/server/library/serverGame/src/shared/object/GroupIdObserver.cpp index 50373712..60b827ca 100755 --- a/engine/server/library/serverGame/src/shared/object/GroupIdObserver.cpp +++ b/engine/server/library/serverGame/src/shared/object/GroupIdObserver.cpp @@ -31,11 +31,11 @@ GroupIdObserver::~GroupIdObserver() if (m_group && m_creature->getGroup() != m_group) m_group->removeGroupMember(m_creature->getNetworkId()); - if (m_creature->getGroup() != NULL) + if (m_creature->getGroup() != nullptr) { PlayerObject *playerObject = PlayerCreatureController::getPlayerObject(m_creature); - if ((playerObject != NULL) && + if ((playerObject != nullptr) && playerObject->isLookingForGroup()) { playerObject->setLookingForGroup(false); diff --git a/engine/server/library/serverGame/src/shared/object/GroupObject.cpp b/engine/server/library/serverGame/src/shared/object/GroupObject.cpp index 76390349..4c8d69e4 100755 --- a/engine/server/library/serverGame/src/shared/object/GroupObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/GroupObject.cpp @@ -1412,7 +1412,7 @@ unsigned int GroupObject::getSecondsLeftOnGroupPickup() const std::pair const & groupPickupTimer = m_groupPickupTimer.get(); if ((groupPickupTimer.first > 0) && (groupPickupTimer.second > 0)) { - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); if (groupPickupTimer.second > timeNow) return (groupPickupTimer.second - (int)timeNow); } diff --git a/engine/server/library/serverGame/src/shared/object/GuildObject.cpp b/engine/server/library/serverGame/src/shared/object/GuildObject.cpp index f0215358..0ee903a1 100755 --- a/engine/server/library/serverGame/src/shared/object/GuildObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/GuildObject.cpp @@ -140,9 +140,9 @@ void GuildObject::setupUniverse() // build the guild and guild member info from data read in from DB // disable notification while building the initial list - m_membersInfo.setOnErase(NULL, NULL); - m_membersInfo.setOnInsert(NULL, NULL); - m_membersInfo.setOnSet(NULL, NULL); + m_membersInfo.setOnErase(nullptr, nullptr); + m_membersInfo.setOnInsert(nullptr, nullptr); + m_membersInfo.setOnSet(nullptr, nullptr); // build names { @@ -238,7 +238,7 @@ void GuildObject::setupUniverse() // update guild info members count GuildInfo & gi = guildInfoMembersCount[guildId]; GuildMemberInfo const * const existingGmi = getGuildMemberInfo(guildId, memberId); - updateGuildInfoMembersCount(gi, (existingGmi ? ((existingGmi->m_permissions == -1) ? &allAdministrativePermissions : &(existingGmi->m_permissions)) : NULL), ((permissions == -1) ? &allAdministrativePermissions : &permissions)); + updateGuildInfoMembersCount(gi, (existingGmi ? ((existingGmi->m_permissions == -1) ? &allAdministrativePermissions : &(existingGmi->m_permissions)) : nullptr), ((permissions == -1) ? &allAdministrativePermissions : &permissions)); if (existingGmi) { @@ -391,7 +391,7 @@ GuildInfo const * GuildObject::getGuildInfo(int guildId) const if (iterFind != m_guildsInfo.end()) return &(iterFind->second); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -402,7 +402,7 @@ GuildMemberInfo const * GuildObject::getGuildMemberInfo(int guildId, NetworkId c if (iterFind != m_membersInfo.end()) return &(iterFind->second); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -738,7 +738,7 @@ void GuildObject::removeGuildMember(int guildId, NetworkId const &memberId) m_members.erase(memberSpec); GuildInfo updatedGi(gi); - updateGuildInfoMembersCount(updatedGi, &(gmi->m_permissions), NULL); + updateGuildInfoMembersCount(updatedGi, &(gmi->m_permissions), nullptr); m_guildsInfo.set(guildId, updatedGi); std::map::const_iterator iterFind = m_fullMembers.find(memberId); @@ -771,7 +771,7 @@ void GuildObject::addGuildCreatorMember(int guildId, NetworkId const &memberId, if (realMemberName.empty() && existingGmi) realMemberName = existingGmi->m_name; - ServerObject const *so = NULL; + ServerObject const *so = nullptr; if (realMemberName.empty()) { so = ServerWorld::findObjectByNetworkId(memberId); @@ -848,7 +848,7 @@ void GuildObject::addGuildCreatorMember(int guildId, NetworkId const &memberId, m_members.insert(memberSpec); GuildInfo updatedGi(gi); - updateGuildInfoMembersCount(updatedGi, (existingGmi ? &(existingGmi->m_permissions) : NULL), &permissions); + updateGuildInfoMembersCount(updatedGi, (existingGmi ? &(existingGmi->m_permissions) : nullptr), &permissions); m_guildsInfo.set(guildId, updatedGi); if (existingGmi) @@ -883,7 +883,7 @@ void GuildObject::addGuildSponsorMember(int guildId, NetworkId const &memberId, if (realMemberName.empty() && existingGmi) realMemberName = existingGmi->m_name; - ServerObject const *so = NULL; + ServerObject const *so = nullptr; if (realMemberName.empty()) { so = ServerWorld::findObjectByNetworkId(memberId); @@ -958,7 +958,7 @@ void GuildObject::addGuildSponsorMember(int guildId, NetworkId const &memberId, m_members.insert(memberSpec); GuildInfo updatedGi(gi); - updateGuildInfoMembersCount(updatedGi, (existingGmi ? &(existingGmi->m_permissions) : NULL), &permissions); + updateGuildInfoMembersCount(updatedGi, (existingGmi ? &(existingGmi->m_permissions) : nullptr), &permissions); m_guildsInfo.set(guildId, updatedGi); if (existingGmi) @@ -1465,7 +1465,7 @@ void GuildObject::modifyGuildWarKillTracking(int killerGuildId, int victimGuildI } if (updateTime <= 0) - updateTime = static_cast(::time(NULL)); + updateTime = static_cast(::time(nullptr)); // queue up adjustments and periodically update the data std::pair, std::pair >::iterator, bool> result = m_guildWarKillTrackingAdjustment.insert(std::make_pair(std::make_pair(killerGuildId, victimGuildId), std::make_pair(adjustment, updateTime))); @@ -1635,7 +1635,7 @@ void GuildObject::setGuildFaction(int guildId, uint32 guildFaction) if (factionChange) { - int const timeLeftGuildFaction = static_cast(::time(NULL)); + int const timeLeftGuildFaction = static_cast(::time(nullptr)); std::string oldNameSpec, newNameSpec; GuildStringParser::buildNameSpec(guildId, gi->m_name, gi->m_guildElectionPreviousEndTime, gi->m_guildElectionNextEndTime, gi->m_guildFaction, gi->m_timeLeftGuildFaction, gi->m_guildGcwDefenderRegion, gi->m_timeJoinedGuildGcwDefenderRegion, gi->m_timeLeftGuildGcwDefenderRegion, oldNameSpec); @@ -1723,7 +1723,7 @@ void GuildObject::setGuildGcwDefenderRegion(int guildId, std::string const &guil if ((gi->m_guildGcwDefenderRegion == guildGcwDefenderRegion) && (gi->m_timeJoinedGuildGcwDefenderRegion > 0)) timeJoinedGuildGcwDefenderRegion = gi->m_timeJoinedGuildGcwDefenderRegion; else - timeJoinedGuildGcwDefenderRegion = static_cast(::time(NULL)); + timeJoinedGuildGcwDefenderRegion = static_cast(::time(nullptr)); } } else if (gi->m_guildGcwDefenderRegion != guildGcwDefenderRegion) @@ -1732,13 +1732,13 @@ void GuildObject::setGuildGcwDefenderRegion(int guildId, std::string const &guil if (!guildGcwDefenderRegion.empty()) { - timeJoinedGuildGcwDefenderRegion = static_cast(::time(NULL)); + timeJoinedGuildGcwDefenderRegion = static_cast(::time(nullptr)); } else { // stop defending timeJoinedGuildGcwDefenderRegion = gi->m_timeJoinedGuildGcwDefenderRegion; - timeLeftGuildGcwDefenderRegion = static_cast(::time(NULL)); + timeLeftGuildGcwDefenderRegion = static_cast(::time(nullptr)); } } @@ -2052,7 +2052,7 @@ void GuildObject::depersistGcwImperialScorePercentile() // GCW category { - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); int gcwImperialScorePercentile; std::map const & allGcwScoreCategory = Pvp::getAllGcwScoreCategory(); for (std::map::const_iterator iter = allGcwScoreCategory.begin(); iter != allGcwScoreCategory.end(); ++iter) @@ -2154,7 +2154,7 @@ void GuildObject::updateGcwImperialScorePercentile(std::set const & if (m_gcwImperialScorePercentileThisGalaxy.empty()) depersistGcwImperialScorePercentile(); - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); GameScriptObject * const gameScriptObject = tatooine->getScriptObject(); int currentScorePercentile, newScorePercentile, newGroupCategoryScoreRaw, scoreCategoryGroupTotalPoints, deltaGroupCategoryScoreRaw; std::map, int>::const_iterator iterGroupCategoryScoreRaw; @@ -2515,8 +2515,8 @@ void GuildObjectNamespace::replaceSetIfNeeded(char const *label, Archive::AutoDe } // ---------------------------------------------------------------------- -// NULL oldPermissions means wasn't an existing guild member -// NULL newPermissions means will not be a guild member +// nullptr oldPermissions means wasn't an existing guild member +// nullptr newPermissions means will not be a guild member void GuildObjectNamespace::updateGuildInfoMembersCount(GuildInfo & gi, int const * const oldPermissions, int const * const newPermissions) { bool existingMember = false; @@ -2596,7 +2596,7 @@ void GuildObjectNamespace::updateGcwPercentileHistory(Archive::AutoDeltaMap(::time(NULL))), score); + history.set(std::make_pair(scoreName, static_cast(::time(nullptr))), score); int newCount = 1; Archive::AutoDeltaMap::const_iterator const iterHistoryCount = historyCount.find(scoreName); diff --git a/engine/server/library/serverGame/src/shared/object/HarvesterInstallationObject.cpp b/engine/server/library/serverGame/src/shared/object/HarvesterInstallationObject.cpp index c8c7ad75..92f77f36 100755 --- a/engine/server/library/serverGame/src/shared/object/HarvesterInstallationObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/HarvesterInstallationObject.cpp @@ -67,7 +67,7 @@ HarvesterInstallationObject::HarvesterInstallationObject(const ServerHarvesterIn m_maxHopperAmount(newTemplate->getMaxHopperSize()), m_hopperResource(NetworkId::cms_invalid), m_hopperAmount(0.0f), - m_survey(NULL), + m_survey(nullptr), m_surveyTime(0) { //Installation objects have real time updated UI @@ -79,7 +79,7 @@ HarvesterInstallationObject::HarvesterInstallationObject(const ServerHarvesterIn HarvesterInstallationObject::~HarvesterInstallationObject() { delete m_survey; - m_survey = NULL; + m_survey = nullptr; // m_synchronizedUi deleted by superclass } @@ -397,7 +397,7 @@ std::vector const & HarvesterInstallationObject::get if (!m_survey || ServerClock::getInstance().getGameTimeSeconds() - m_surveyTime > (60*60)) { delete m_survey; - m_survey = NULL; + m_survey = nullptr; takeSurvey(); } @@ -728,7 +728,7 @@ void HarvesterInstallationObject::handleCMessageTo (const MessageToPayload &mess ResourceClassObject *HarvesterInstallationObject::getMasterClass() const { - ResourceClassObject *obj = NULL; + ResourceClassObject *obj = nullptr; const ServerHarvesterInstallationObjectTemplate *harvesterTemplate = dynamic_cast(getObjectTemplate()); if (harvesterTemplate) obj=ServerUniverse::getInstance().getResourceClassByName(harvesterTemplate->getMasterClassName()); @@ -855,7 +855,7 @@ NetworkId const &HarvesterInstallationObject::getSelectedResourceTypeId() const ResourcePoolObject const * HarvesterInstallationObject::getSelectedResourcePool() const { if (getSelectedResourceTypeId() == NetworkId::cms_invalid) - return NULL; + return nullptr; ResourceTypeObject const * const typeObject = ServerUniverse::getInstance().getResourceTypeById(getSelectedResourceTypeId()); if (typeObject) @@ -863,7 +863,7 @@ ResourcePoolObject const * HarvesterInstallationObject::getSelectedResourcePool( return typeObject->getPoolForCurrentPlanet(); } else - return NULL; + return nullptr; } // ====================================================================== diff --git a/engine/server/library/serverGame/src/shared/object/HarvesterInstallationObject.h b/engine/server/library/serverGame/src/shared/object/HarvesterInstallationObject.h index 7616aba5..1ea65df3 100755 --- a/engine/server/library/serverGame/src/shared/object/HarvesterInstallationObject.h +++ b/engine/server/library/serverGame/src/shared/object/HarvesterInstallationObject.h @@ -52,7 +52,7 @@ public: typedef std::pair HopperContentElement; typedef stdvector::fwd HopperContentsVector; - float getHopperContents(HopperContentsVector * data=NULL) const; + float getHopperContents(HopperContentsVector * data=nullptr) const; void getResourceData(ResourceDataVector & data); std::vector const & getSurveyTypes(); int getMaxExtractionRate() const; diff --git a/engine/server/library/serverGame/src/shared/object/InstallationObject.cpp b/engine/server/library/serverGame/src/shared/object/InstallationObject.cpp index 2f5b622b..97ddeef9 100755 --- a/engine/server/library/serverGame/src/shared/object/InstallationObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/InstallationObject.cpp @@ -45,7 +45,7 @@ static const std::string OBJVAR_ACCUMULATED_TIME("_installation.acclTime"); -const SharedObjectTemplate * InstallationObject::m_defaultSharedTemplate = NULL; +const SharedObjectTemplate * InstallationObject::m_defaultSharedTemplate = nullptr; namespace InstallationObjectNamespace { @@ -93,13 +93,13 @@ const SharedObjectTemplate * InstallationObject::getDefaultSharedTemplate(void) { static const ConstCharCrcLowerString templateName("object/installation/base/shared_installation_default.iff"); - if (m_defaultSharedTemplate == NULL) + if (m_defaultSharedTemplate == nullptr) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create " + WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create " "default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) ExitChain::add (removeDefaultTemplate, "InstallationObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -112,10 +112,10 @@ static const ConstCharCrcLowerString templateName("object/installation/base/shar */ void InstallationObject::removeDefaultTemplate(void) { - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } // InstallationObject::removeDefaultTemplate diff --git a/engine/server/library/serverGame/src/shared/object/IntangibleObject.cpp b/engine/server/library/serverGame/src/shared/object/IntangibleObject.cpp index 6d7b57c4..5d32403f 100755 --- a/engine/server/library/serverGame/src/shared/object/IntangibleObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/IntangibleObject.cpp @@ -43,7 +43,7 @@ // ====================================================================== -const SharedObjectTemplate * IntangibleObject::m_defaultSharedTemplate = NULL; +const SharedObjectTemplate * IntangibleObject::m_defaultSharedTemplate = nullptr; uint32 IntangibleObject::ms_lastFrame = 0; uint32 IntangibleObject::ms_theaterTime = 0; @@ -82,7 +82,7 @@ IntangibleObject::IntangibleObject(const ServerIntangibleObjectTemplate* newTemp #endif { - WARNING_STRICT_FATAL(!getSharedTemplate(), ("Shared template for %s is NULL", getTemplateName())); + WARNING_STRICT_FATAL(!getSharedTemplate(), ("Shared template for %s is nullptr", getTemplateName())); addMembersToPackages(); ObjectTracker::addIntangible(); } @@ -105,13 +105,13 @@ const SharedObjectTemplate * IntangibleObject::getDefaultSharedTemplate(void) co { static const ConstCharCrcLowerString templateName("object/intangible/base/shared_intangible_default.iff"); - if (m_defaultSharedTemplate == NULL) + if (m_defaultSharedTemplate == nullptr) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create " + WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create " "default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) ExitChain::add (removeDefaultTemplate, "IntangibleObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -124,10 +124,10 @@ static const ConstCharCrcLowerString templateName("object/intangible/base/shared */ void IntangibleObject::removeDefaultTemplate(void) { - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } // IntangibleObject::removeDefaultTemplate @@ -161,7 +161,7 @@ void IntangibleObject::onLoadedFromDatabase() if (flatten != 0) { TerrainGenerator::Layer * layer = TerrainModificationHelper::importLayer(THEATER_FLATTEN_LAYER.c_str()); - if (layer != NULL) + if (layer != nullptr) { setLayer(layer); } @@ -192,7 +192,7 @@ void IntangibleObject::onLoadedFromDatabase() void IntangibleObject::sendObjectSpecificBaselinesToClient(Client const &client) const { ServerObject::sendObjectSpecificBaselinesToClient(client); - if (getLayer() != NULL) + if (getLayer() != nullptr) { client.send(GenericValueTypeMessage >( "IsFlattenedTheaterMessage", std::make_pair(getNetworkId(), true)), true); @@ -235,9 +235,9 @@ size_t i; Transform tr; tr.setPosition_p(myPos+m_positions[i]); ServerObject * newObject = ServerWorld::createNewObject(m_crcs[i], tr, 0, false); - if (newObject != NULL) + if (newObject != nullptr) { - if (newObject->asTangibleObject() != NULL) + if (newObject->asTangibleObject() != nullptr) newObject->asTangibleObject()->setVisible(false); newObject->addToWorld(); m_objects.push_back(CachedNetworkId(*newObject)); @@ -300,7 +300,7 @@ size_t i; for (i = 0; i < count; ++i) { ServerObject * object = safe_cast(m_objects[i].getObject()); - if (object != NULL && object->asTangibleObject() != NULL) + if (object != nullptr && object->asTangibleObject() != nullptr) { const ServerObjectTemplate * objTemplate = safe_cast(object->getObjectTemplate()); for (size_t j = 0; j < objTemplate->getVisibleFlagsCount(); ++j) @@ -360,7 +360,7 @@ bool IntangibleObject::isVisibleOnClient (const Client & client) const { if (isTheater()) { - return getLayer() != NULL; + return getLayer() != nullptr; } return true; } @@ -388,7 +388,7 @@ void IntangibleObject::onPermanentlyDestroyed() for (size_t i = 0; i < count; ++i) { ServerObject * object = safe_cast(m_objects[i].getObject()); - if (object != NULL) + if (object != nullptr) object->permanentlyDestroy(DeleteReasons::Consumed); } if (!m_theaterName.get().empty()) @@ -439,7 +439,7 @@ bool IntangibleObject::persist() splitCount = 0; } ServerObject * o = safe_cast((*i).getObject()); - if (o != NULL) + if (o != nullptr) { o->persist(); splitObjects.back().push_back(*i); @@ -452,7 +452,7 @@ bool IntangibleObject::persist() if (m_player.get() != CachedNetworkId::cms_cachedInvalid) setObjVarItem(OBJVAR_THEATER_PLAYER, m_player.get()); setObjVarItem(OBJVAR_THEATER_NAME, m_theaterName.get()); - if (getLayer() != NULL) + if (getLayer() != nullptr) setObjVarItem(OBJVAR_THEATER_FLATTEN, 1); char buffer[32]; @@ -551,7 +551,7 @@ int IntangibleObject::getObjectsCreatedPerFrame() int IntangibleObject::getNumObjects(const std::string & datatable) { DataTable * dt = DataTableManager::getTable(datatable, true); - if (dt == NULL) + if (dt == nullptr) { WARNING(true, ("IntangibleObject::getNumObjects could not open " "datatable %s", datatable.c_str())); @@ -586,7 +586,7 @@ int IntangibleObject::getNumObjects(const std::string & datatable) float IntangibleObject::getRadius(const std::string & datatable) { DataTable * dt = DataTableManager::getTable(datatable, true); - if (dt == NULL) + if (dt == nullptr) { WARNING(true, ("IntangibleObject::getRadius could not open " "datatable %s", datatable.c_str())); @@ -648,18 +648,18 @@ IntangibleObject * IntangibleObject::spawnTheater(const std::string & datatable, const Vector & position, const std::string & script, TheaterLocationType locationType) { DataTable * dt = DataTableManager::getTable(datatable, true); - if (dt == NULL) + if (dt == nullptr) { WARNING(true, ("IntangibleObject::spawnTheater could not open " "datatable %s", datatable.c_str())); - return NULL; + return nullptr; } int rows = dt->getNumRows(); if (rows <= 0) { WARNING(true, ("IntangibleObject::spawnTheater datatable %s has no " "rows", datatable.c_str())); - return NULL; + return nullptr; } int templateColumn = dt->findColumnNumber("template"); @@ -684,7 +684,7 @@ IntangibleObject * IntangibleObject::spawnTheater(const std::string & datatable, { WARNING(true, ("IntangibleObject::spawnTheater datatable %s has no " "objects", datatable.c_str())); - return NULL; + return nullptr; } skipFirstRow = true; objectCrcs.erase(objectCrcs.begin()); @@ -737,11 +737,11 @@ IntangibleObject * IntangibleObject::spawnTheater(const std::string & datatable, float centerX = minx + dx / 2.0f + position.x; float centerZ = minz + dz / 2.0f + position.z; - TerrainGenerator::Layer * layer = NULL; + TerrainGenerator::Layer * layer = nullptr; if (locationType == TLT_flatten) { layer = TerrainModificationHelper::importLayer(THEATER_FLATTEN_LAYER.c_str()); - if (layer == NULL) + if (layer == nullptr) { WARNING (true, ("Layer %s not found for theater %s, using getGoodLocation " "instead", THEATER_FLATTEN_LAYER.c_str(), datatable.c_str())); @@ -770,7 +770,7 @@ IntangibleObject * IntangibleObject::spawnTheater(const std::string & datatable, iter != regions.end(); ++iter) { const Region * region = *iter; - if (region != NULL) + if (region != nullptr) { if (region->getPvp() == RegionNamespace::RP_pvpBattlefield || region->getPvp() == RegionNamespace::RP_pveBattlefield || @@ -796,7 +796,7 @@ IntangibleObject * IntangibleObject::spawnTheater(const std::string & datatable, IntangibleObject * theater = safe_cast(ServerWorld::createNewObject(THEATER_TEMPLATE, tr, 0, false)); NOT_NULL(theater); - if (layer != NULL) + if (layer != nullptr) { theater->setLayer(layer); } diff --git a/engine/server/library/serverGame/src/shared/object/LineOfSightCache.cpp b/engine/server/library/serverGame/src/shared/object/LineOfSightCache.cpp index a7de4055..3d3c72ff 100755 --- a/engine/server/library/serverGame/src/shared/object/LineOfSightCache.cpp +++ b/engine/server/library/serverGame/src/shared/object/LineOfSightCache.cpp @@ -308,14 +308,14 @@ bool LineOfSightCache::checkLOS(Object const &a, Location const &b) Clock::getFrameStartTimeMs() + ConfigServerGame::getLineOfSightCacheDurationMs())); CellProperty const * const sourceCell = source->getParentCell(); - CellProperty const * targetCell = NULL; + CellProperty const * targetCell = nullptr; if (b.getCell() != NetworkId::cms_invalid) { Object const * cellObject = NetworkIdManager::getObjectById(b.getCell()); - if (cellObject != NULL) + if (cellObject != nullptr) targetCell = ContainerInterface::getCell(*cellObject); } - if (targetCell == NULL) + if (targetCell == nullptr) targetCell = CellProperty::getWorldCellProperty(); // if source and target are in the same cell in a player structure, skip LOS check; @@ -418,7 +418,7 @@ bool LineOfSightCache::checkLOS(Object const &a, Location const &b) qirResult = CollisionWorld::queryInteraction( targetCell, b.getCoordinates(), sourceCell, sourceTop, - NULL, + nullptr, (!ConfigSharedCollision::getIgnoreTerrainLos() && !ConfigSharedCollision::getGenerateTerrainLos()), false, ConfigSharedCollision::getTerrainLOSMinDistance(), diff --git a/engine/server/library/serverGame/src/shared/object/ManufactureInstallationObject.cpp b/engine/server/library/serverGame/src/shared/object/ManufactureInstallationObject.cpp index c199bd84..50fec4c8 100755 --- a/engine/server/library/serverGame/src/shared/object/ManufactureInstallationObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/ManufactureInstallationObject.cpp @@ -99,11 +99,11 @@ namespace ManufactureInstallationObjectNamespace bool isOutputHopperFull(ManufactureInstallationObject const & mio) { ServerObject const * const outputHopper = mio.getOutputHopper(); - if (outputHopper == NULL) + if (outputHopper == nullptr) return false; VolumeContainer const * const hopperContainer = ContainerInterface::getVolumeContainer(*outputHopper); - if (hopperContainer == NULL) + if (hopperContainer == nullptr) return false; return (hopperContainer->getCurrentVolume() >= hopperContainer->getTotalVolume()); @@ -170,7 +170,7 @@ void ManufactureInstallationObject::endBaselines() // if we are active, make sure we have the right data if (isAuthoritative() && isActive()) { - if (getSchematic() == NULL) + if (getSchematic() == nullptr) { WARNING(true, ("Manufacture installation %s is set to active but has not schematic available!", getNetworkId().getValueString().c_str())); @@ -302,17 +302,17 @@ void ManufactureInstallationObject::setOwnerId(const NetworkId &id) InstallationObject::setOwnerId(id); const Object * const object = NetworkIdManager::getObjectById(id); - if (object != NULL) + if (object != nullptr) { const ServerObject * const owner = safe_cast(object); setObjVarItem(OBJVAR_OWNER_NAME, Unicode::wideToNarrow(owner->getObjectName())); // we need to store the owner's Station id for logging purposes const CreatureObject * const creatureOwner = owner->asCreatureObject(); - if (creatureOwner != NULL) + if (creatureOwner != nullptr) { const PlayerObject * const player = PlayerCreatureController::getPlayerObject(creatureOwner); - if (player != NULL) + if (player != nullptr) { setObjVarItem(OBJVAR_OWNER_STATION_ID, static_cast(player->getStationId())); } @@ -331,10 +331,10 @@ ServerObject * ManufactureInstallationObject::getInputHopper() const { SlottedContainer const * const container = ContainerInterface::getSlottedContainer(*this); - if (container == NULL) + if (container == nullptr) { DEBUG_WARNING(true, ("Manufacture installation %s does not have a container!", getDebugInformation().c_str())); - return NULL; + return nullptr; } Container::ContainerErrorCode tmp = Container::CEC_Success; @@ -342,7 +342,7 @@ ServerObject * ManufactureInstallationObject::getInputHopper() const if (hopperId == NetworkId::cms_invalid) { DEBUG_WARNING(true, ("Manufacture installation %s does not have an input hopper!", getDebugInformation().c_str())); - return NULL; + return nullptr; } return safe_cast(hopperId.getObject()); @@ -359,10 +359,10 @@ ServerObject * ManufactureInstallationObject::getOutputHopper() const { SlottedContainer const * const container = ContainerInterface::getSlottedContainer(*this); - if (container == NULL) + if (container == nullptr) { DEBUG_WARNING(true, ("Manufacture installation %s does not have a container!", getDebugInformation().c_str())); - return NULL; + return nullptr; } Container::ContainerErrorCode tmp = Container::CEC_Success; @@ -370,7 +370,7 @@ ServerObject * ManufactureInstallationObject::getOutputHopper() const if (hopperId == NetworkId::cms_invalid) { DEBUG_WARNING(true, ("Manufacture installation %s does not have an output hopper!", getDebugInformation().c_str())); - return NULL; + return nullptr; } return safe_cast(hopperId.getObject()); @@ -399,7 +399,7 @@ bool ManufactureInstallationObject::addSchematic(ManufactureSchematicObject & sc SlottedContainer const * const container = ContainerInterface::getSlottedContainer(*this); - if (container == NULL) + if (container == nullptr) { DEBUG_WARNING(true, ("Manufacture installation %s does not have a container!", getDebugInformation().c_str())); return false; @@ -433,7 +433,7 @@ bool ManufactureInstallationObject::onContainerAboutToLoseItem(ServerObject * de { bool isSchematic = false; const ManufactureSchematicObject * const schematic = getSchematic(); - if (schematic != NULL && schematic->getNetworkId() == item.getNetworkId()) + if (schematic != nullptr && schematic->getNetworkId() == item.getNetworkId()) { isSchematic = true; if (isActive()) @@ -465,10 +465,10 @@ ManufactureSchematicObject * ManufactureInstallationObject::getSchematic() const // get our manufacturing schematic SlottedContainer const * const container = ContainerInterface::getSlottedContainer(*this); - if (container == NULL) + if (container == nullptr) { DEBUG_WARNING(true, ("Manufacture installation %s does not have a container!", getDebugInformation().c_str())); - return NULL; + return nullptr; } Container::ContainerErrorCode tmp = Container::CEC_Success; @@ -486,7 +486,7 @@ ManufactureSchematicObject * ManufactureInstallationObject::getSchematic() const float ManufactureInstallationObject::getTimePerObject() const { ManufactureSchematicObject * const schematic = getSchematic(); - if (schematic == NULL) + if (schematic == nullptr) return 0; #ifdef _DEBUG @@ -516,7 +516,7 @@ float ManufactureInstallationObject::getTimePerObject() const getObjVars().getItem(OBJVAR_OWNER_SKILL,ownerSkill); int skill = 0; - if (owner != NULL) + if (owner != nullptr) { skill = owner->getEnhancedModValue(FACTORY_SKILL_MOD); @@ -551,7 +551,7 @@ void ManufactureInstallationObject::activate(const NetworkId &actorId) { if (isAuthoritative() && !isActive()) { - if (getSchematic() == NULL) + if (getSchematic() == nullptr) { WARNING(true, ("Manufacture installation %s tried to activate with " "no schematic available!", getNetworkId().getValueString().c_str())); @@ -588,7 +588,7 @@ void ManufactureInstallationObject::activate(const NetworkId &actorId) OutOfBandPackager::pack(pp, -1, oob); } const Object * const owner = NetworkIdManager::getObjectById(getOwnerId()); - if (owner != NULL) + if (owner != nullptr) { Chat::sendSystemMessage(getOwnerName(), Unicode::emptyString, oob); } @@ -615,7 +615,7 @@ void ManufactureInstallationObject::deactivate() OutOfBandPackager::pack(pp, -1, oob); } const Object * const owner = NetworkIdManager::getObjectById(getOwnerId()); - if (owner != NULL) + if (owner != nullptr) { Chat::sendSystemMessage(getOwnerName(), Unicode::emptyString, oob); } @@ -645,13 +645,13 @@ void ManufactureInstallationObject::harvest() maxItemCount = schematic->getCount(); } - if (schematic == NULL || maxItemCount <= 0) + if (schematic == nullptr || maxItemCount <= 0) { setTickCount(0); // to avoid recursion deactivate(); - if (schematic == NULL) + if (schematic == nullptr) { - WARNING(true, ("ManufactureInstallationObject::harvest called on object %s with a NULL schematic", + WARNING(true, ("ManufactureInstallationObject::harvest called on object %s with a nullptr schematic", getNetworkId().getValueString().c_str())); Chat::sendPersistentMessage(*this, getOwnerName(), StringIds::manf_error, StringIds::manf_error_1, Unicode::emptyString); @@ -694,7 +694,7 @@ void ManufactureInstallationObject::harvest() OutOfBandPackager::pack(pp, -1, oob); } const Object * owner = NetworkIdManager::getObjectById(getOwnerId()); - if (owner != NULL) + if (owner != nullptr) { Chat::sendSystemMessage(getOwnerName(), Unicode::emptyString, oob); } @@ -748,7 +748,7 @@ bool ManufactureInstallationObject::createObject(bool testOnly) int i; ManufactureSchematicObject * schematic = getSchematic(); - if (schematic == NULL) + if (schematic == nullptr) { WARNING(true, ("ManufactureInstallationObject::createObject can't find schematic for station %s", getNetworkId().getValueString().c_str())); @@ -771,7 +771,7 @@ bool ManufactureInstallationObject::createObject(bool testOnly) } ServerObject * inputHopper = getInputHopper(); - if (inputHopper == NULL) + if (inputHopper == nullptr) { WARNING_STRICT_FATAL(true, ("ManufactureInstallationObject::createObject can't find input hopper for station %s", getNetworkId().getValueString().c_str())); @@ -782,7 +782,7 @@ bool ManufactureInstallationObject::createObject(bool testOnly) } ServerObject * outputHopper = getOutputHopper(); - if (outputHopper == NULL) + if (outputHopper == nullptr) { WARNING_STRICT_FATAL(true, ("ManufactureInstallationObject::createObject can't find output hopper for station %s", getNetworkId().getValueString().c_str())); @@ -803,7 +803,7 @@ bool ManufactureInstallationObject::createObject(bool testOnly) { // is there a current crate in the output hopper put we can stuff objects into FactoryObject * crate = getCurrentCrate(*schematic); - if (crate == NULL) + if (crate == nullptr) { // is there room in the output hopper for a new crate outputHopperFull = isOutputHopperFull(*this); @@ -819,7 +819,7 @@ bool ManufactureInstallationObject::createObject(bool testOnly) OutOfBandPackager::pack(pp, -1, oob); } const Object * const owner = NetworkIdManager::getObjectById(getOwnerId()); - if (owner != NULL) + if (owner != nullptr) { Chat::sendSystemMessage(getOwnerName(), Unicode::emptyString, oob); } @@ -894,7 +894,7 @@ bool ManufactureInstallationObject::createObject(bool testOnly) // the ingredient needs to be made with the same template const ObjectTemplate * componentTemplate = ObjectTemplateList::fetch( componentInfo->templateName); - if (componentTemplate != NULL) + if (componentTemplate != nullptr) { for (j = 0; j < ingredientCount; ++j) { @@ -945,7 +945,7 @@ bool ManufactureInstallationObject::createObject(bool testOnly) ProsePackage pp; ProsePackageManagerServer::createSimpleProsePackageParticipant (*this, pp.target); - if (resource != NULL) + if (resource != nullptr) { pp.stringId = StringIds::manf_no_named_resource; pp.other.str = Unicode::narrowToWide(resource->getResourceName()); @@ -957,7 +957,7 @@ bool ManufactureInstallationObject::createObject(bool testOnly) } const Object * const owner = NetworkIdManager::getObjectById(getOwnerId()); - if (owner != NULL) + if (owner != nullptr) Chat::sendSystemMessage(getOwnerName(), Unicode::emptyString, oob); Chat::sendPersistentMessage(*this, getOwnerName(), StringIds::no_ingredients, Unicode::emptyString, oob); @@ -1000,7 +1000,7 @@ bool ManufactureInstallationObject::createObject(bool testOnly) { TangibleObject * object = safe_cast(schematic-> manufactureObject(getOwnerId(), *this, newObjectSlotId, false)); - if (object == NULL) + if (object == nullptr) { WARNING_STRICT_FATAL(true, ("ManufactureInstallationObject::createObject, Unable to create object for station %s", getNetworkId().getValueString().c_str())); @@ -1009,7 +1009,7 @@ bool ManufactureInstallationObject::createObject(bool testOnly) return false; } - if (!ContainerInterface::transferItemToVolumeContainer(*outputHopper, *object, NULL, tmp)) + if (!ContainerInterface::transferItemToVolumeContainer(*outputHopper, *object, nullptr, tmp)) { object->permanentlyDestroy(DeleteReasons::BadContainerTransfer); WARNING_STRICT_FATAL(true, ("ManufactureInstallationObject::createObject, Unable to transfer new object for station %s, error code = %d", @@ -1024,12 +1024,12 @@ bool ManufactureInstallationObject::createObject(bool testOnly) { // put the object in a box of objects FactoryObject * crate = getCurrentCrate(*schematic); - if (crate == NULL) + if (crate == nullptr) { // make a new crate to put the object in crate = makeNewCrate(*schematic); } - if (crate == NULL) + if (crate == nullptr) { WARNING_STRICT_FATAL(true, ("ManufactureInstallationObject::createObject, Unable to create factory crate for station %s", getNetworkId().getValueString().c_str())); @@ -1082,7 +1082,7 @@ void ManufactureInstallationObject::restoreIngredients(IngredientVector const &i if (count != 0) { FactoryObject * crate = dynamic_cast(itemId.getObject()); - if (crate != NULL) + if (crate != nullptr) crate->incrementCount(count); } } @@ -1109,7 +1109,7 @@ void ManufactureInstallationObject::destroyIngredients(IngredientVector const &i else { FactoryObject * crate = dynamic_cast(itemId.getObject()); - if (crate != NULL) + if (crate != nullptr) { LOG("CustomerService", ("Crafting:destroying %d ingredients from crate %s in manf station %s owned by %s", count, itemId.getValueString().c_str(), getNetworkId().getValueString().c_str(), PlayerObject::getAccountDescription(getOwnerId()).c_str())); if (crate->getCount() == 0) @@ -1149,7 +1149,7 @@ bool ManufactureInstallationObject::transferCraftedIngredientToSchematic( // crafted id as the component wanted VolumeContainer * container = ContainerInterface::getVolumeContainer(inputHopper); - if (container == NULL) + if (container == nullptr) return false; // stuff to keep track of crates that don't have enough ingredients @@ -1160,11 +1160,11 @@ bool ManufactureInstallationObject::transferCraftedIngredientToSchematic( { const Container::ContainedItem & itemId = *iter; TangibleObject * object = safe_cast(itemId.getObject()); - if (object != NULL && object->getCraftedId() == craftedId) + if (object != nullptr && object->getCraftedId() == craftedId) { // see if the object is a factory or not FactoryObject * crate = dynamic_cast(object); - if (crate != NULL) + if (crate != nullptr) { // see if the crate has enough objects or not int crateCount = crate->getCount(); @@ -1247,18 +1247,18 @@ const NetworkId & ManufactureInstallationObject::transferTemplateIngredientToSch VolumeContainer * container = ContainerInterface::getVolumeContainer( inputHopper); - if (container == NULL) + if (container == nullptr) return NetworkId::cms_invalid; for (ContainerIterator iter = container->begin(); iter != container->end(); ++iter) { const Container::ContainedItem & itemId = *iter; TangibleObject * object = safe_cast(itemId.getObject()); - if (object != NULL) + if (object != nullptr) { // see if the object is a factory or not FactoryObject * crate = dynamic_cast(object); - if (crate != NULL && crate->getCount() > 0) + if (crate != nullptr && crate->getCount() > 0) { if (crate->getContainedObjectTemplate() == &componentTemplate) { @@ -1300,7 +1300,7 @@ const NetworkId & ManufactureInstallationObject::transferResourceTypeToSchematic const NetworkId & resourceTypeId, int resourceCount) { VolumeContainer * const container = ContainerInterface::getVolumeContainer(inputHopper); - if (container == NULL) + if (container == nullptr) return NetworkId::cms_invalid; // keep a map of the sources that are providing the resources @@ -1317,7 +1317,7 @@ const NetworkId & ManufactureInstallationObject::transferResourceTypeToSchematic const Container::ContainedItem & itemId = *iter; ResourceContainerObject * object = dynamic_cast( itemId.getObject()); - if (object != NULL && object->getResourceTypeId() == resourceTypeId) + if (object != nullptr && object->getResourceTypeId() == resourceTypeId) { // see if this crate fills our requirements if (object->getQuantity() >= resourceCount) @@ -1346,7 +1346,7 @@ const NetworkId & ManufactureInstallationObject::transferResourceTypeToSchematic if (!smallCrate->removeResource(resourceTypeId, smallCrate->getQuantity(), &sources)) return NetworkId::cms_invalid; // small crate has been deleted by the resource system - *crateIter = NULL; + *crateIter = nullptr; ++crateIter; } else @@ -1390,41 +1390,41 @@ const NetworkId & ManufactureInstallationObject::transferResourceTypeToSchematic * * @param contents an object we want to put in the crate * - * @return the crate, or NULL if we have no crate + * @return the crate, or nullptr if we have no crate */ FactoryObject * ManufactureInstallationObject::getCurrentCrate(const ManufactureSchematicObject & source) { - FactoryObject * crate = NULL; + FactoryObject * crate = nullptr; ServerObject * outputHopper = getOutputHopper(); - if (outputHopper == NULL) - return NULL; + if (outputHopper == nullptr) + return nullptr; - if (m_currentCrate.getObject() != NULL) + if (m_currentCrate.getObject() != nullptr) { crate = safe_cast(m_currentCrate.getObject()); // make sure the crate is still in our hopper and is not full - if (crate != NULL && ContainerInterface::getContainedByObject(*crate) == outputHopper && + if (crate != nullptr && ContainerInterface::getContainedByObject(*crate) == outputHopper && crate->getCraftedId() == source.getOriginalId()) { if (crate->getCount() < source.getItemsPerContainer()) return crate; else - return NULL; + return nullptr; } } // see if there is another non-full crate in the output hopper we could use const VolumeContainer * hopperContainer = ContainerInterface::getVolumeContainer( *outputHopper); - if (hopperContainer != NULL) + if (hopperContainer != nullptr) { for (ContainerConstIterator iter = hopperContainer->begin(); iter != hopperContainer->end(); ++iter) { crate = dynamic_cast((*iter).getObject()); - if (crate != NULL && crate->getCraftedId() == source.getOriginalId() && crate->getCount() < source.getItemsPerContainer()) + if (crate != nullptr && crate->getCraftedId() == source.getOriginalId() && crate->getCount() < source.getItemsPerContainer()) { // change our current crate to the one we found m_currentCrate = CachedNetworkId(*crate); @@ -1433,7 +1433,7 @@ FactoryObject * ManufactureInstallationObject::getCurrentCrate(const Manufacture } } - return NULL; + return nullptr; } // ManufactureInstallationObject::getCurrentCrate // ---------------------------------------------------------------------- @@ -1449,21 +1449,21 @@ FactoryObject * ManufactureInstallationObject::getCurrentCrate(const Manufacture FactoryObject * ManufactureInstallationObject::makeNewCrate(const ManufactureSchematicObject & source) { ServerObject * outputHopper = getOutputHopper(); - if (outputHopper == NULL) - return NULL; + if (outputHopper == nullptr) + return nullptr; // get the correct factory object template from the draft schematic const ManufactureSchematicObject * manfSchematic = getSchematic(); - if (manfSchematic == NULL) - return NULL; + if (manfSchematic == nullptr) + return nullptr; const DraftSchematicObject * draftSchematic = DraftSchematicObject::getSchematic( manfSchematic->getDraftSchematic()); - if (draftSchematic == NULL) - return NULL; + if (draftSchematic == nullptr) + return nullptr; - ServerObject * object = NULL; + ServerObject * object = nullptr; const ServerFactoryObjectTemplate * crateTemplate = draftSchematic->getCrateObjectTemplate(); - if (crateTemplate != NULL) + if (crateTemplate != nullptr) { object = ServerWorld::createNewObject(*crateTemplate, *outputHopper, false); } @@ -1472,11 +1472,11 @@ FactoryObject * ManufactureInstallationObject::makeNewCrate(const ManufactureSch object = ServerWorld::createNewObject(DEFAULT_FACTORY_OBJECT_TEMPLATE, *outputHopper, false); } - if (object == NULL) - return NULL; + if (object == nullptr) + return nullptr; FactoryObject * crate = dynamic_cast(object); - if (crate == NULL) + if (crate == nullptr) object->permanentlyDestroy(DeleteReasons::SetupFailed); else { @@ -1526,7 +1526,7 @@ bool ManufactureInstallationObject::TaskManufactureObject::run() { ManufactureInstallationObject * manfInst = safe_cast (m_manfInstallation.getObject()); - if (manfInst == NULL || !manfInst->isActive()) + if (manfInst == nullptr || !manfInst->isActive()) return true; if (!manfInst->createObject()) @@ -1545,7 +1545,7 @@ void ManufactureInstallationObject::getAttributes(AttributeVector & data) const InstallationObject::getAttributes(data); ManufactureSchematicObject * schematic = getSchematic(); - if (schematic != NULL) + if (schematic != nullptr) { char valueBuffer[32]; const size_t valueBuffer_size = sizeof (valueBuffer); diff --git a/engine/server/library/serverGame/src/shared/object/ManufactureSchematicObject.cpp b/engine/server/library/serverGame/src/shared/object/ManufactureSchematicObject.cpp index 00b51fc1..e4646395 100755 --- a/engine/server/library/serverGame/src/shared/object/ManufactureSchematicObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/ManufactureSchematicObject.cpp @@ -96,7 +96,7 @@ using namespace ManufactureSchematicObjectNamespace; //---------------------------------------------------------------------- -const SharedObjectTemplate * ManufactureSchematicObject::m_defaultSharedTemplate = NULL; +const SharedObjectTemplate * ManufactureSchematicObject::m_defaultSharedTemplate = nullptr; //======================================================================== @@ -170,11 +170,11 @@ const SharedObjectTemplate * ManufactureSchematicObject::getDefaultSharedTemplat { static const ConstCharCrcLowerString templateName("object/manufacture_schematic/base/shared_manufacture_schematic_default.iff"); - if (m_defaultSharedTemplate == NULL) + if (m_defaultSharedTemplate == nullptr) { m_defaultSharedTemplate = safe_cast(ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != NULL) + WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create default shared object template %s", templateName.getString())); + if (m_defaultSharedTemplate != nullptr) ExitChain::add (removeDefaultTemplate, "ManufactureSchematicObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -187,10 +187,10 @@ const SharedObjectTemplate * ManufactureSchematicObject::getDefaultSharedTemplat */ void ManufactureSchematicObject::removeDefaultTemplate() { - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } // ManufactureSchematicObject::removeDefaultTemplate @@ -209,7 +209,7 @@ void ManufactureSchematicObject::init(const DraftSchematicObject & schematic, co m_draftSchematicSharedTemplate = schematic.getSharedTemplate()->getCrcName().getCrc(); m_creatorId = creator; - if (creator.getObject() != NULL) + if (creator.getObject() != nullptr) { m_creatorName = safe_cast(creator.getObject())-> getObjectName(); @@ -481,7 +481,7 @@ ServerIntangibleObjectTemplate::CraftingType ManufactureSchematicObject::getCate { schematicOk = false; } - else if (draft != NULL) + else if (draft != nullptr) { // test the ingredients Crafting::IngredientSlot sourceSlot; @@ -520,11 +520,11 @@ ServerIntangibleObjectTemplate::CraftingType ManufactureSchematicObject::getCate return draft->getCategory(); // this schematic can't be used, inform the player - const CreatureObject * owner = NULL; + const CreatureObject * owner = nullptr; const Object * object = ContainerInterface::getContainedByObject(*this); - while (owner == NULL && object != NULL && object->asServerObject() != NULL) + while (owner == nullptr && object != nullptr && object->asServerObject() != nullptr) { - if (object->asServerObject()->asCreatureObject() != NULL) + if (object->asServerObject()->asCreatureObject() != nullptr) owner = object->asServerObject()->asCreatureObject(); else object = ContainerInterface::getContainedByObject(*object); @@ -534,7 +534,7 @@ ServerIntangibleObjectTemplate::CraftingType ManufactureSchematicObject::getCate LOG("CustomerService", ("Crafting:Manufacturing schematic %s " "owned by %s is unuseable due to %s", getNetworkId().getValueString().c_str(), PlayerObject::getAccountDescription(owner).c_str(), errBuffer)); - if (owner != NULL) + if (owner != nullptr) { // send mail to the owner telling them their schematic can't be used const static StringId message("system_msg", "manf_schematic_unuseable"); @@ -562,7 +562,7 @@ bool ManufactureSchematicObject::mustDestroyIngredients() const const DraftSchematicObject * draft = DraftSchematicObject::getSchematic( m_draftSchematic.get()); NOT_NULL(draft); - if (draft != NULL) + if (draft != nullptr) return draft->mustDestroyIngredients(); return false; } // ManufactureSchematicObject::mustDestroyIngredients @@ -701,12 +701,12 @@ bool ManufactureSchematicObject::getSlot(int index, Crafting::IngredientSlot & d // get the xp type based on the resource container int xpType = 0; const ResourceTypeObject * const resourceType = ServerUniverse::getInstance().getResourceTypeById(ingredientId); - if (resourceType != NULL) + if (resourceType != nullptr) { std::string crateTemplateName; resourceType->getCrateTemplate(crateTemplateName); const ServerObjectTemplate * crateTemplate = safe_cast(ObjectTemplateList::fetch(crateTemplateName)); - if (crateTemplate != NULL && crateTemplate->getXpPointsCount() > 0) + if (crateTemplate != nullptr && crateTemplate->getXpPointsCount() > 0) { ServerObjectTemplate::Xp xpData; crateTemplate->getXpPoints(xpData, 0); @@ -1024,10 +1024,10 @@ void ManufactureSchematicObject::addSlotComponent(const StringId & name, // Check if the object being added is a factory const TangibleObject * componentPtr = &component; const FactoryObject * factory = dynamic_cast(&component); - if (factory != NULL) + if (factory != nullptr) { componentPtr = factory->getContainedObject(); - if (componentPtr == NULL) + if (componentPtr == nullptr) { WARNING(true, ("ManufactureSchematicObject::addSlotComponent passed " "FactoryObject %s with no contained object", @@ -1112,11 +1112,11 @@ TangibleObject * ManufactureSchematicObject::getComponent( const Crafting::ComponentIngredient & info) const { const VolumeContainer * volumeContainer = ContainerInterface::getVolumeContainer(*this); - if (volumeContainer == NULL) + if (volumeContainer == nullptr) { DEBUG_WARNING(true, ("Manf schematic %s does not have a volume container!", getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } // check if the component is in a FactoryObject; if it is, return the factory, @@ -1124,10 +1124,10 @@ TangibleObject * ManufactureSchematicObject::getComponent( if (info.ingredient != NetworkId::cms_invalid) { ServerObject * object = ServerWorld::findObjectByNetworkId(info.ingredient); - if (object != NULL) + if (object != nullptr) { Object * container = ContainerInterface::getContainedByObject(*object); - if (container != NULL && dynamic_cast(container) != NULL) + if (container != nullptr && dynamic_cast(container) != nullptr) return safe_cast(container); } } @@ -1137,7 +1137,7 @@ TangibleObject * ManufactureSchematicObject::getComponent( { const Container::ContainedItem & item = *iter; TangibleObject * object = safe_cast(item.getObject()); - if (object != NULL) + if (object != nullptr) { if (info.ingredient != NetworkId::cms_invalid) { @@ -1154,7 +1154,7 @@ TangibleObject * ManufactureSchematicObject::getComponent( } } } - return NULL; + return nullptr; } // ManufactureSchematicObject::getComponent //----------------------------------------------------------------------- @@ -1295,7 +1295,7 @@ void ManufactureSchematicObject::clearSlotSources() m_factories.begin(); iter != m_factories.end(); ++iter) { FactoryObject * factory = safe_cast((*iter).getObject()); - if (factory != NULL) + if (factory != nullptr) { factory->endCraftingSession(); } @@ -1305,23 +1305,23 @@ void ManufactureSchematicObject::clearSlotSources() // get rid of all our held ingredients VolumeContainer * volumeContainer = ContainerInterface::getVolumeContainer(*this); - if (volumeContainer != NULL && volumeContainer->getNumberOfItems() > 0) + if (volumeContainer != nullptr && volumeContainer->getNumberOfItems() > 0) { // for a stacked ingredient, if there are still more than one items in the stack, // "consume" 1 item from the stack, and return it to the player's inventory std::set itemsToReturnToInventory; - ServerObject* inventory = NULL; + ServerObject* inventory = nullptr; for (ContainerIterator iter = volumeContainer->begin(); iter != volumeContainer->end(); ++iter) { - if ((*iter).getObject() != NULL) + if ((*iter).getObject() != nullptr) { bool destroyItem = true; TangibleObject* to = safe_cast((*iter).getObject())->asTangibleObject(); - if (to && (to->getCount() > 1) && (dynamic_cast(to) == NULL)) + if (to && (to->getCount() > 1) && (dynamic_cast(to) == nullptr)) { - if (inventory == NULL) + if (inventory == nullptr) { ServerObject * o = safe_cast(ContainerInterface::getContainedByObject(*to)); while (o) @@ -1357,7 +1357,7 @@ void ManufactureSchematicObject::clearSlotSources() Container::ContainerErrorCode errCode; for (std::set::const_iterator iter = itemsToReturnToInventory.begin(); iter != itemsToReturnToInventory.end(); ++iter) { - if (!ContainerInterface::transferItemToVolumeContainer(*inventory, **iter, NULL, errCode)) + if (!ContainerInterface::transferItemToVolumeContainer(*inventory, **iter, nullptr, errCode)) { (*iter)->permanentlyDestroy(DeleteReasons::Replaced); } @@ -1741,11 +1741,11 @@ bool ManufactureSchematicObject::getCustomization(const std::string & name, const DynamicVariableList * objvars = getObjVars(); NOT_NULL(objvars); const DynamicVariableList * customs = safe_cast(objvars->getItemByName("cust")); - if (customs == NULL) + if (customs == nullptr) return false; const DynamicVariableList * custom = safe_cast(customs->getItemByName(name)); - if (custom == NULL) + if (custom == nullptr) return false; data.name = name; @@ -1771,7 +1771,7 @@ bool ManufactureSchematicObject::getCustomization(int index, const DynamicVariableList * objvars = getObjVars(); NOT_NULL(objvars); const DynamicVariableList * customs = safe_cast(objvars->getItemByName("cust")); - if (customs == NULL) + if (customs == nullptr) return false; int count = customs->getCount(); @@ -1799,7 +1799,7 @@ int ManufactureSchematicObject::getCustomizationsCount() const const DynamicVariableList * objvars = getObjVars(); NOT_NULL(objvars); const DynamicVariableList * customs = safe_cast(objvars->getItemByName("cust")); - if (customs == NULL) + if (customs == nullptr) return 0; return customs->getCount(); @@ -1838,7 +1838,7 @@ bool ManufactureSchematicObject::setCustomization(int index, int value, ServerObject & prototype) { ManufactureSchematicSynchronizedUi * sync = safe_cast(getSynchronizedUi ()); - if (sync == NULL) + if (sync == nullptr) return false; const std::string & customName = sync->getCustomizationName(index); @@ -1863,7 +1863,7 @@ bool ManufactureSchematicObject::setCustomization(const std::string & name, int value, ServerObject & prototype) { ManufactureSchematicSynchronizedUi * sync = safe_cast(getSynchronizedUi ()); - if (sync == NULL) + if (sync == nullptr) return false; // make sure the value is within range @@ -1878,10 +1878,10 @@ bool ManufactureSchematicObject::setCustomization(const std::string & name, // save the customization string CustomizationDataProperty * const cdProperty = safe_cast(prototype.getProperty(CustomizationDataProperty::getClassPropertyId())); - if (cdProperty != NULL) + if (cdProperty != nullptr) { CustomizationData *const customizationData = cdProperty->fetchCustomizationData(); - if (customizationData != NULL) + if (customizationData != nullptr) { m_appearanceData = customizationData->writeLocalDataToString(); setObjVarItem("customization_data", m_appearanceData.get()); @@ -1993,7 +1993,7 @@ void ManufactureSchematicObject::removeCraftingFactory(const FactoryObject & fac bool ManufactureSchematicObject::addIngredient(ServerObject & component) { Container::ContainerErrorCode tmp = Container::CEC_Success; - return ContainerInterface::transferItemToVolumeContainer(*this, component, NULL, tmp); + return ContainerInterface::transferItemToVolumeContainer(*this, component, nullptr, tmp); } // ManufactureSchematicObject::addIngredient //----------------------------------------------------------------------- @@ -2037,7 +2037,7 @@ bool ManufactureSchematicObject::removeIngredient(ServerObject & component, { // if the component is a factory, treat is differently FactoryObject * factory = dynamic_cast(&component); - if (factory != NULL) + if (factory != nullptr) { // if the factory is contained by us, move it to the destination, // making sure that its count is 1; if it is not contained by us, @@ -2050,7 +2050,7 @@ bool ManufactureSchematicObject::removeIngredient(ServerObject & component, factory->removeCraftingReferences(factory->getCount() - 1); Container::ContainerErrorCode errCode; return ContainerInterface::transferItemToVolumeContainer(destination, - *factory, NULL, errCode); + *factory, nullptr, errCode); } else { @@ -2064,17 +2064,17 @@ bool ManufactureSchematicObject::removeIngredient(ServerObject & component, { // make sure the component is in our container Object * container = ContainerInterface::getContainedByObject(component); - if (container == NULL || container->getNetworkId() != getNetworkId()) + if (container == nullptr || container->getNetworkId() != getNetworkId()) { FactoryObject * factory = dynamic_cast(container); - if (factory != NULL) + if (factory != nullptr) return removeIngredient(*factory, destination); return false; } Container::ContainerErrorCode errCode; return ContainerInterface::transferItemToVolumeContainer(destination, component, - NULL, errCode); + nullptr, errCode); } } // ManufactureSchematicObject::removeIngredient @@ -2169,7 +2169,7 @@ void ManufactureSchematicObject::destroyAllIngredients() m_factories.begin(); iter != m_factories.end(); ++iter) { FactoryObject * factory = safe_cast((*iter).getObject()); - if (factory != NULL) + if (factory != nullptr) { factory->endCraftingSession(); } @@ -2179,24 +2179,24 @@ void ManufactureSchematicObject::destroyAllIngredients() // empty our volume container VolumeContainer * const container = ContainerInterface::getVolumeContainer(*this); - if (container != NULL) + if (container != nullptr) { // for a stacked ingredient, if there are still more than one items in the stack, // "consume" 1 item from the stack, and return it to the player's inventory std::set itemsToReturnToInventory; - ServerObject* inventory = NULL; + ServerObject* inventory = nullptr; ContainerIterator iter; for (iter = container->begin(); iter != container->end(); ++iter) { CachedNetworkId & itemId = *iter; - if (itemId.getObject() != NULL) + if (itemId.getObject() != nullptr) { bool destroyItem = true; TangibleObject* to = safe_cast(itemId.getObject())->asTangibleObject(); - if (to && (to->getCount() > 1) && (dynamic_cast(to) == NULL)) + if (to && (to->getCount() > 1) && (dynamic_cast(to) == nullptr)) { - if (inventory == NULL) + if (inventory == nullptr) { ServerObject * o = safe_cast(ContainerInterface::getContainedByObject(*to)); while (o) @@ -2235,7 +2235,7 @@ void ManufactureSchematicObject::destroyAllIngredients() Container::ContainerErrorCode errCode; for (std::set::const_iterator iter = itemsToReturnToInventory.begin(); iter != itemsToReturnToInventory.end(); ++iter) { - if (!ContainerInterface::transferItemToVolumeContainer(*inventory, **iter, NULL, errCode)) + if (!ContainerInterface::transferItemToVolumeContainer(*inventory, **iter, nullptr, errCode)) { (*iter)->permanentlyDestroy(DeleteReasons::Consumed); } @@ -2281,29 +2281,29 @@ void ManufactureSchematicObject::destroyAllIngredients() ServerObject * ManufactureSchematicObject::manufactureObject(const NetworkId & creatorId, ServerObject & container, const SlotId & containerSlotId, bool prototype) { if (getCount() <= 0) - return NULL; + return nullptr; const DraftSchematicObject * draftSchematic = DraftSchematicObject::getSchematic(m_draftSchematic.get()); - if (draftSchematic == NULL) + if (draftSchematic == nullptr) { - return NULL; + return nullptr; } - if (draftSchematic->getCraftedObjectTemplate() == NULL) + if (draftSchematic->getCraftedObjectTemplate() == nullptr) { DEBUG_WARNING(true, ("Draft schematic %s does not have a craftable object template!\n", draftSchematic->getTemplateName())); - return NULL; + return nullptr; } // create the item TangibleObject * const object = dynamic_cast(ServerWorld::createNewObject(*draftSchematic->getCraftedObjectTemplate(), container, containerSlotId, false)); - if (object == NULL) + if (object == nullptr) { DEBUG_WARNING(true, ("Player %s failed to create object for template " "%s.\n", creatorId.getValueString().c_str(), draftSchematic->getCraftedObjectTemplate()->getName())); - return NULL; + return nullptr; } if (!getAssignedObjectName().empty()) @@ -2327,7 +2327,7 @@ ServerObject * ManufactureSchematicObject::manufactureObject(const NetworkId & c // set the creator xp type from the schematic template const ServerObjectTemplate * schematicTemplate = safe_cast(draftSchematic->getObjectTemplate()); - if (schematicTemplate != NULL && schematicTemplate->getXpPointsCount() > 0) + if (schematicTemplate != nullptr && schematicTemplate->getXpPointsCount() > 0) { ServerObjectTemplate::Xp xpData; schematicTemplate->getXpPoints(xpData, 0); @@ -2339,7 +2339,7 @@ ServerObject * ManufactureSchematicObject::manufactureObject(const NetworkId & c if (!setObjectComponents(object, true)) { object->permanentlyDestroy(DeleteReasons::BadContainerTransfer); - return NULL; + return nullptr; } // allow the schematic scripts to modify the object @@ -2356,7 +2356,7 @@ ServerObject * ManufactureSchematicObject::manufactureObject(const NetworkId & c if (result == SCRIPT_OVERRIDE) { object->permanentlyDestroy(DeleteReasons::Script); - return NULL; + return nullptr; } incrementCount(-1); @@ -2392,15 +2392,15 @@ ServerObject * ManufactureSchematicObject::manufactureObject(const Vector & posi { const DraftSchematicObject * draftSchematic = DraftSchematicObject::getSchematic( m_draftSchematic.get()); - if (draftSchematic == NULL) + if (draftSchematic == nullptr) { - return NULL; + return nullptr; } - if (draftSchematic->getCraftedObjectTemplate() == NULL) + if (draftSchematic->getCraftedObjectTemplate() == nullptr) { DEBUG_WARNING(true, ("Draft schematic %s does not have a craftable " "object template!\n", draftSchematic->getTemplateName())); - return NULL; + return nullptr; } Transform tr; @@ -2409,11 +2409,11 @@ ServerObject * ManufactureSchematicObject::manufactureObject(const Vector & posi TangibleObject * object = dynamic_cast(ServerWorld::createNewObject( *draftSchematic->getCraftedObjectTemplate(), tr, 0, false)); - if (object == NULL) + if (object == nullptr) { DEBUG_WARNING(true, ("Failed to create object for template " "%s.\n", draftSchematic->getCraftedObjectTemplate()->getName())); - return NULL; + return nullptr; } if (!getAssignedObjectName().empty()) @@ -2468,7 +2468,7 @@ bool ManufactureSchematicObject::setObjectComponents(TangibleObject * object, bo // check the objects in the schematic volume container to make sure they match VolumeContainer * volumeContainer = ContainerInterface::getVolumeContainer(*this); - if (volumeContainer == NULL) + if (volumeContainer == nullptr) { DEBUG_WARNING(true, ("Manf schematic %s does not have a volume container!", getNetworkId().getValueString().c_str())); @@ -2478,7 +2478,7 @@ bool ManufactureSchematicObject::setObjectComponents(TangibleObject * object, bo // for a stacked ingredient, if there are still more than one items in the stack, // "consume" 1 item from the stack, and return it to the player's inventory std::set itemsToReturnToInventory; - ServerObject* inventory = NULL; + ServerObject* inventory = nullptr; DynamicVariableList::NestedList slots(getObjVars(),OBJVAR_SLOTS); @@ -2533,11 +2533,11 @@ bool ManufactureSchematicObject::setObjectComponents(TangibleObject * object, bo { Container::ContainedItem & item = *iter; TangibleObject * const testComponent = dynamic_cast(item.getObject()); - if (testComponent == NULL) + if (testComponent == nullptr) continue; if (itemsToReturnToInventory.count(testComponent) > 0) continue; - FactoryObject * crate = NULL; + FactoryObject * crate = nullptr; bool found = false; bool foundCrate = false; if (component->ingredient != NetworkId::cms_invalid) @@ -2548,7 +2548,7 @@ bool ManufactureSchematicObject::setObjectComponents(TangibleObject * object, bo // see if the test component is a crate crate = dynamic_cast(testComponent); - if (crate != NULL && crate->getCount() == ingredientCount) + if (crate != nullptr && crate->getCount() == ingredientCount) { foundCrate = true; } @@ -2598,7 +2598,7 @@ bool ManufactureSchematicObject::setObjectComponents(TangibleObject * object, bo if (!componentTableName.empty()) { DataTable * componentTable = DataTableManager::getTable(componentTableName, true); - if (componentTable != NULL) + if (componentTable != nullptr) { uint32 value = INVALID_CRC; if (draftSlot.appearance == "component") @@ -2645,9 +2645,9 @@ bool ManufactureSchematicObject::setObjectComponents(TangibleObject * object, bo } bool destroyItem = true; - if ((testComponent->getCount() > 1) && (dynamic_cast(testComponent) == NULL)) + if ((testComponent->getCount() > 1) && (dynamic_cast(testComponent) == nullptr)) { - if (inventory == NULL) + if (inventory == nullptr) { ServerObject * o = safe_cast(ContainerInterface::getContainedByObject(*testComponent)); while (o) @@ -2701,7 +2701,7 @@ bool ManufactureSchematicObject::setObjectComponents(TangibleObject * object, bo Container::ContainerErrorCode errCode; for (std::set::const_iterator iter = itemsToReturnToInventory.begin(); iter != itemsToReturnToInventory.end(); ++iter) { - if (!ContainerInterface::transferItemToVolumeContainer(*inventory, **iter, NULL, errCode)) + if (!ContainerInterface::transferItemToVolumeContainer(*inventory, **iter, nullptr, errCode)) { (*iter)->permanentlyDestroy(DeleteReasons::Consumed); } @@ -2723,15 +2723,15 @@ bool ManufactureSchematicObject::setObjectComponents(TangibleObject * object, bo for (iter = volumeContainer->begin(); iter != volumeContainer->end(); ++iter) { - if ((*iter).getObject() != NULL) + if ((*iter).getObject() != nullptr) { ServerObject * temp = safe_cast((*iter).getObject()); bool destroyItem = true; TangibleObject* to = temp->asTangibleObject(); - if (to && (to->getCount() > 1) && (dynamic_cast(to) == NULL)) + if (to && (to->getCount() > 1) && (dynamic_cast(to) == nullptr)) { - if (inventory == NULL) + if (inventory == nullptr) { ServerObject * o = safe_cast(ContainerInterface::getContainedByObject(*to)); while (o) @@ -2787,7 +2787,7 @@ bool ManufactureSchematicObject::setObjectComponents(TangibleObject * object, bo Container::ContainerErrorCode errCode; for (std::set::const_iterator iter = itemsToReturnToInventory.begin(); iter != itemsToReturnToInventory.end(); ++iter) { - if (!ContainerInterface::transferItemToVolumeContainer(*inventory, **iter, NULL, errCode)) + if (!ContainerInterface::transferItemToVolumeContainer(*inventory, **iter, nullptr, errCode)) { (*iter)->permanentlyDestroy(DeleteReasons::Replaced); } @@ -2847,7 +2847,7 @@ void ManufactureSchematicObject::requestSlots(ServerObject & player) const case Crafting::IT_schematicGeneric: { const TangibleObject * const ingredient = dynamic_cast(NetworkIdManager::getObjectById(ingredientId)); - if (ingredient != NULL) + if (ingredient != nullptr) { optionInfo.ingredient = ingredient->getEncodedObjectName(); // since names can be duplicated, concatinate the id of @@ -2870,7 +2870,7 @@ void ManufactureSchematicObject::requestSlots(ServerObject & player) const case Crafting::IT_resourceClass: { ResourceTypeObject const * const ingredient = ServerUniverse::getInstance().getResourceTypeById(ingredientId); - if (ingredient != NULL) + if (ingredient != nullptr) optionInfo.ingredient = Unicode::narrowToWide(ingredient->getResourceName()); else optionInfo.ingredient = Unicode::narrowToWide("unknown"); @@ -2942,7 +2942,7 @@ void ManufactureSchematicObject::getIngredientInfo (IngredientInfoVector & iiv) // the manf schematic to the name if (component->ingredient != NetworkId::cms_invalid) { - //-- null-separate the string if needed + //-- nullptr-separate the string if needed if (!ingredientName.empty () && ingredientName [0] == '@') ingredientName.push_back ('\0'); @@ -2990,7 +2990,7 @@ void ManufactureSchematicObject::getIngredientInfo (IngredientInfoVector & iiv) case Crafting::IT_resourceClass: { ResourceTypeObject const * const ingredient = ServerUniverse::getInstance().getResourceTypeById(ingredientId); - if (ingredient != NULL) + if (ingredient != nullptr) ingredientName = Unicode::narrowToWide(ingredient->getResourceName ()); } break; @@ -3125,7 +3125,7 @@ const std::map & ManufactureSchematicObject::getAttributes() co int ManufactureSchematicObject::getVolume() const { const DraftSchematicObject * const schematic = DraftSchematicObject::getSchematic(getDraftSchematic()); - if (schematic != NULL) + if (schematic != nullptr) return schematic->getObjectTemplate()->asServerObjectTemplate()->getVolume(); return IntangibleObject::getVolume(); } // ManufactureSchematicObject::getVolume @@ -3212,7 +3212,7 @@ void ManufactureSchematicObject::recalculateData() else { const DraftSchematicObject * const missingSchematic = DraftSchematicObject::getSchematic(MISSING_SCHEMATIC_SUBSTITUTE); - if (missingSchematic != NULL) + if (missingSchematic != nullptr) m_draftSchematicSharedTemplate = missingSchematic->getSharedTemplate()->getCrcName().getCrc(); else WARNING_STRICT_FATAL(true, ("Cannot find draft schematic %s! This must always exist!", MISSING_SCHEMATIC_SUBSTITUTE.c_str())); @@ -3262,7 +3262,7 @@ void ManufactureSchematicObject::getByteStreamFromAutoVariable(const std::string if (name == "msoCtsPackUnpack") { // creator Id/Name - CreatureObject const * containingPlayer = NULL; + CreatureObject const * containingPlayer = nullptr; ServerObject const * parent = safe_cast(ContainerInterface::getContainedByObject(*this)); while (parent) @@ -3271,7 +3271,7 @@ void ManufactureSchematicObject::getByteStreamFromAutoVariable(const std::string if (containingPlayer && PlayerCreatureController::getPlayerObject(containingPlayer)) break; - containingPlayer = NULL; + containingPlayer = nullptr; parent = safe_cast(ContainerInterface::getContainedByObject(*parent)); } @@ -3329,7 +3329,7 @@ void ManufactureSchematicObject::setAutoVariableFromByteStream(const std::string Archive::AutoDeltaVariable creatorIsOwner; creatorIsOwner.unpackDelta(ri); - CreatureObject const * containingPlayer = NULL; + CreatureObject const * containingPlayer = nullptr; if (creatorIsOwner.get()) { @@ -3340,7 +3340,7 @@ void ManufactureSchematicObject::setAutoVariableFromByteStream(const std::string if (containingPlayer && PlayerCreatureController::getPlayerObject(containingPlayer)) break; - containingPlayer = NULL; + containingPlayer = nullptr; parent = safe_cast(ContainerInterface::getContainedByObject(*parent)); } } diff --git a/engine/server/library/serverGame/src/shared/object/MissionObject.cpp b/engine/server/library/serverGame/src/shared/object/MissionObject.cpp index 9aa5873a..fb7504f0 100755 --- a/engine/server/library/serverGame/src/shared/object/MissionObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/MissionObject.cpp @@ -32,7 +32,7 @@ //----------------------------------------------------------------------- -const SharedObjectTemplate * MissionObject::m_defaultSharedTemplate = NULL; +const SharedObjectTemplate * MissionObject::m_defaultSharedTemplate = nullptr; const char * const s_missionObjectTemplateName = "object/mission/base_mission_object.iff"; //----------------------------------------------------------------------- @@ -125,13 +125,13 @@ const SharedObjectTemplate * MissionObject::getDefaultSharedTemplate(void) const { static const ConstCharCrcLowerString templateName("object/mission/base/shared_mission_default.iff"); - if (m_defaultSharedTemplate == NULL) + if (m_defaultSharedTemplate == nullptr) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create " + WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create " "default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) ExitChain::add (removeDefaultTemplate, "MissionObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -144,10 +144,10 @@ static const ConstCharCrcLowerString templateName("object/mission/base/shared_mi */ void MissionObject::removeDefaultTemplate(void) { - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } // MissionObject::removeDefaultTemplate @@ -158,7 +158,7 @@ void MissionObject::abortMission() ScriptParams params; ScriptDictionaryPtr dictionary; getScriptObject()->makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(getNetworkId(), @@ -710,7 +710,7 @@ void MissionObject::getByteStreamFromAutoVariable(const std::string & name, Arch Archive::put(target, m_waypoint.get().getWaypointDataBase()); // mission location target - CreatureObject const * containingPlayer = NULL; + CreatureObject const * containingPlayer = nullptr; ServerObject const * parent = safe_cast(ContainerInterface::getContainedByObject(*this)); while (parent) { @@ -718,7 +718,7 @@ void MissionObject::getByteStreamFromAutoVariable(const std::string & name, Arch if (containingPlayer && PlayerCreatureController::getPlayerObject(containingPlayer)) break; - containingPlayer = NULL; + containingPlayer = nullptr; parent = safe_cast(ContainerInterface::getContainedByObject(*parent)); } @@ -785,7 +785,7 @@ void MissionObject::setAutoVariableFromByteStream(const std::string & name, cons m_title.unpackDelta(ri); // mission holder id - CreatureObject * containingPlayer = NULL; + CreatureObject * containingPlayer = nullptr; ServerObject * parent = safe_cast(ContainerInterface::getContainedByObject(*this)); while (parent) { @@ -793,7 +793,7 @@ void MissionObject::setAutoVariableFromByteStream(const std::string & name, cons if (containingPlayer && PlayerCreatureController::getPlayerObject(containingPlayer)) break; - containingPlayer = NULL; + containingPlayer = nullptr; parent = safe_cast(ContainerInterface::getContainedByObject(*parent)); } diff --git a/engine/server/library/serverGame/src/shared/object/ObjectFactory.cpp b/engine/server/library/serverGame/src/shared/object/ObjectFactory.cpp index bcba1d72..e23c7d1d 100755 --- a/engine/server/library/serverGame/src/shared/object/ObjectFactory.cpp +++ b/engine/server/library/serverGame/src/shared/object/ObjectFactory.cpp @@ -53,14 +53,14 @@ ServerObject * ServerWorld::createObjectFromTemplate(uint32 templateCrc, const N WARNING(!objectTemplate, ("Missing Template! Can't create object from " "template crc %lu(%s), file not found", templateCrc, ObjectTemplateList::lookUp(templateCrc).getString())); - Object *object = NULL; + Object *object = nullptr; if (objectTemplate) { ServerObjectTemplate const * serverObjectTemplate = objectTemplate->asServerObjectTemplate(); - if ( (serverObjectTemplate == NULL) - || ((serverObjectTemplate != NULL) && (ObjectTemplateList::lookUp(serverObjectTemplate->getSharedTemplate().c_str()).getCrc() != 0))) + if ( (serverObjectTemplate == nullptr) + || ((serverObjectTemplate != nullptr) && (ObjectTemplateList::lookUp(serverObjectTemplate->getSharedTemplate().c_str()).getCrc() != 0))) { PROFILER_AUTO_BLOCK_DEFINE("ObjectTemplate::createObject"); object = objectTemplate->createObject(); diff --git a/engine/server/library/serverGame/src/shared/object/ObjectTracker.cpp b/engine/server/library/serverGame/src/shared/object/ObjectTracker.cpp index 888b5d77..23b38bfe 100755 --- a/engine/server/library/serverGame/src/shared/object/ObjectTracker.cpp +++ b/engine/server/library/serverGame/src/shared/object/ObjectTracker.cpp @@ -81,7 +81,7 @@ int ObjectTracker::getNumPlayers() void ObjectTracker::getNumPlayersByFaction(int & imperial, int & rebel, int & neutral) { - time_t const now = ::time(NULL); + time_t const now = ::time(nullptr); if ((now - m_lastTimeCalculateFactionalPlayersCount) > 60) { m_numPlayersImperial = 0; diff --git a/engine/server/library/serverGame/src/shared/object/PatrolPathNodeProperty.cpp b/engine/server/library/serverGame/src/shared/object/PatrolPathNodeProperty.cpp index c17b6ca6..4731fcd7 100755 --- a/engine/server/library/serverGame/src/shared/object/PatrolPathNodeProperty.cpp +++ b/engine/server/library/serverGame/src/shared/object/PatrolPathNodeProperty.cpp @@ -36,7 +36,7 @@ m_roots(new std::set) PatrolPathNodeProperty::~PatrolPathNodeProperty() { delete m_roots; - m_roots = NULL; + m_roots = nullptr; } //------------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/object/PlanetObject.cpp b/engine/server/library/serverGame/src/shared/object/PlanetObject.cpp index f6a57df4..0ecbb8d6 100755 --- a/engine/server/library/serverGame/src/shared/object/PlanetObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/PlanetObject.cpp @@ -126,7 +126,7 @@ namespace PlanetObjectNamespace const char * makeCopyOfString(const char * rhs) { - char * lhs = NULL; + char * lhs = nullptr; if (rhs) { lhs = new char[strlen(rhs) + 1]; @@ -144,7 +144,7 @@ namespace PlanetObjectNamespace int getNextGcwScoreDecayTime(int base); // dictionary containing the table showing factional presence activity - ScriptParams * s_factionalPresenceSuiTable = NULL; + ScriptParams * s_factionalPresenceSuiTable = nullptr; bool s_factionalPresenceSuiTableNeedRebuild = true; void decrementConnectedCharacterLfgDataFactionalPresenceCount(Archive::AutoDeltaMap, PlanetObject> & connectedCharacterLfgDataFactionalPresence, const LfgCharacterData & lfgCharacterData); @@ -914,7 +914,7 @@ void PlanetObject::onLoadedFromDatabase() // "server first" information and manually create the CollectionServerFirstObserver // object, so that there will only be 1 call to the CollectionServerFirstObserver // object when it goes out of scope at the end of the function - m_collectionServerFirst.setSourceObject(NULL); + m_collectionServerFirst.setSourceObject(nullptr); CollectionServerFirstObserver observer(this, Archive::ADOO_set); const DynamicVariableList & objvars = getObjVars(); @@ -1004,7 +1004,7 @@ void PlanetObject::setCollectionServerFirst(const CollectionsDataTable::Collecti if (objvars.hasItem(objvar) && (DynamicVariable::STRING_ARRAY == objvars.getType(objvar))) return; - const time_t timeNow = ::time(NULL); + const time_t timeNow = ::time(nullptr); char buffer[64]; snprintf(buffer, sizeof(buffer)-1, "%ld", timeNow); buffer[sizeof(buffer)-1] = '\0'; @@ -1131,7 +1131,7 @@ void PlanetObject::handleCMessageTo(MessageToPayload const &message) std::string const params(message.getPackedDataVector().begin(), message.getPackedDataVector().end()); Unicode::String const delimiters(Unicode::narrowToWide("|")); Unicode::UnicodeStringVector tokens; - if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, NULL)) && (tokens.size() == 2)) + if ((Unicode::tokenize(Unicode::narrowToWide(params), tokens, &delimiters, nullptr)) && (tokens.size() == 2)) { CollectionsDataTable::CollectionInfoCollection const * const collectionInfo = CollectionsDataTable::getCollectionByName(Unicode::wideToNarrow(tokens[0])); if (collectionInfo && collectionInfo->trackServerFirst && (collectionInfo->serverFirstClaimTime > 0)) @@ -1193,7 +1193,7 @@ void PlanetObject::handleCMessageTo(MessageToPayload const &message) else if (message.getMethod() == "C++DoGcwDecay") { // start decay handling loop - int const now = static_cast(::time(NULL)); + int const now = static_cast(::time(nullptr)); int timeNextGcwScoreDecay; if (!getObjVars().getItem("gcwScore.nextDecayTime", timeNextGcwScoreDecay) || (timeNextGcwScoreDecay <= 0)) { @@ -1397,7 +1397,7 @@ void PlanetObject::endBaselines() } // start decay handling loop - int const now = static_cast(::time(NULL)); + int const now = static_cast(::time(nullptr)); int timeNextGcwScoreDecay; if (!getObjVars().getItem("gcwScore.nextDecayTime", timeNextGcwScoreDecay) || (timeNextGcwScoreDecay <= 0)) { @@ -1481,7 +1481,7 @@ ScriptParams const *PlanetObject::getConnectedCharacterLfgDataFactionalPresenceT if (s_factionalPresenceSuiTableNeedRebuild) { delete s_factionalPresenceSuiTable; - s_factionalPresenceSuiTable = NULL; + s_factionalPresenceSuiTable = nullptr; PlanetObject const * const tatooine = ServerUniverse::getInstance().getTatooinePlanet(); if (tatooine) @@ -2156,8 +2156,8 @@ void PlanetObject::updateGcwTrackingData() // send our GCW score to the other clusters and process GCW scores we received from other clusters if (isAuthoritative() && (ConfigServerGame::getBroadcastGcwScoreToOtherGalaxies() || ConfigServerGame::getReceiveGcwScoreFromOtherGalaxies())) { - static time_t timeNextBroadcast = ::time(NULL) + ConfigServerGame::getBroadcastGcwScoreToOtherGalaxiesIntervalSeconds(); - time_t const timeNow = ::time(NULL); + static time_t timeNextBroadcast = ::time(nullptr) + ConfigServerGame::getBroadcastGcwScoreToOtherGalaxiesIntervalSeconds(); + time_t const timeNow = ::time(nullptr); if (timeNextBroadcast < timeNow) { if (ConfigServerGame::getBroadcastGcwScoreToOtherGalaxies()) @@ -2342,7 +2342,7 @@ void PlanetObject::adjustGcwImperialScore(std::string const & source, CreatureOb PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(sourceObject); if (playerObject) { - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); IGNORE_RETURN(playerObject->setObjVarItem(std::string("gcwContributionTracking.") + gcwCategory, timeNow)); IGNORE_RETURN(playerObject->setObjVarItem(std::string("gcwContributionTrackingLastUpdated"), timeNow)); @@ -2387,7 +2387,7 @@ void PlanetObject::adjustGcwRebelScore(std::string const & source, CreatureObjec PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(sourceObject); if (playerObject) { - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); IGNORE_RETURN(playerObject->setObjVarItem(std::string("gcwContributionTracking.") + gcwCategory, timeNow)); IGNORE_RETURN(playerObject->setObjVarItem(std::string("gcwContributionTrackingLastUpdated"), timeNow)); @@ -2441,7 +2441,7 @@ int PlanetObjectNamespace::getNextGcwScoreDecayTime(int base) } if (nextTime < 0) - nextTime = static_cast(::time(NULL)) + (60 * 60 * 24 * 7); + nextTime = static_cast(::time(nullptr)) + (60 * 60 * 24 * 7); return nextTime; } diff --git a/engine/server/library/serverGame/src/shared/object/PlayerObject.cpp b/engine/server/library/serverGame/src/shared/object/PlayerObject.cpp index 1e574c40..5a481653 100755 --- a/engine/server/library/serverGame/src/shared/object/PlayerObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/PlayerObject.cpp @@ -95,7 +95,7 @@ #include #include -const SharedObjectTemplate * PlayerObject::m_defaultSharedTemplate = NULL; +const SharedObjectTemplate * PlayerObject::m_defaultSharedTemplate = nullptr; bool PlayerObject::m_allowEmptySlot = false; @@ -317,7 +317,7 @@ PlayerObject::PlayerObject(const ServerPlayerObjectTemplate* newTemplate) : m_craftingStation(), m_craftingComponentBioLink(), m_useableDraftSchematics(), - m_draftSchematic(NULL), + m_draftSchematic(nullptr), m_matchMakingPersonalProfileId(), m_matchMakingCharacterProfileId(), m_friendList(), @@ -451,13 +451,13 @@ const SharedObjectTemplate * PlayerObject::getDefaultSharedTemplate() const { static const ConstCharCrcLowerString templateName("object/player/base/shared_player_default.iff"); - if (m_defaultSharedTemplate == NULL) + if (m_defaultSharedTemplate == nullptr) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create " + WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create " "default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) ExitChain::add (removeDefaultTemplate, "PlayerObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -470,10 +470,10 @@ static const ConstCharCrcLowerString templateName("object/player/base/shared_pla */ void PlayerObject::removeDefaultTemplate() { - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } // PlayerObject::removeDefaultTemplate @@ -514,7 +514,7 @@ int PlayerObject::getCurrentBornDate() time_t baseTime = mktime(&baseTimeData); // get the current time and compute the birth date - time_t currentTime = time(NULL); + time_t currentTime = time(nullptr); time_t delta = (currentTime - baseTime) / (60 * 60 * 24); delta += ((currentTime - baseTime) % (60 * 60 * 24) != 0 ? 1 : 0); return int(delta); @@ -631,14 +631,14 @@ void PlayerObject::virtualOnSetAuthority() if (isCrafting()) { const TangibleObject * tool = safe_cast(getCraftingTool().getObject()); - if (tool != NULL) + if (tool != nullptr) { const ManufactureSchematicObject * manfSchematic = tool->getCraftingManufactureSchematic(); - if (manfSchematic != NULL) + if (manfSchematic != nullptr) { m_draftSchematic = DraftSchematicObject::getSchematic( manfSchematic->getDraftSchematic()); - if (m_draftSchematic.getPointer() == NULL) + if (m_draftSchematic.getPointer() == nullptr) { WARNING(true, ("PlayerObject::virtualOnSetAuthority object " "%s is flagged as crafting, but has bad manf schematic %lu", @@ -749,7 +749,7 @@ int PlayerObject::getExperienceLimit(const std::string & experienceType) const if((*iter)) { const SkillObject::ExperiencePair * xpInfo = (*iter)->getPrerequisiteExperience(); - if (xpInfo != NULL && experienceType == xpInfo->first && xpInfo->second.second > 0) + if (xpInfo != nullptr && experienceType == xpInfo->first && xpInfo->second.second > 0) { if (limit == static_cast(-1) || limit < static_cast(xpInfo->second.second)) @@ -797,9 +797,9 @@ int PlayerObject::grantExperiencePoints(const std::string & experienceType, int // adjust the xp based on what faction is doing best // NOTE: HACK HACK HACK! const PlanetObject * tatooine = ServerUniverse::getInstance().getTatooinePlanet(); - if (tatooine == NULL) + if (tatooine == nullptr) tatooine = ServerUniverse::getInstance().getPlanetByName("Tatooine"); - if (tatooine == NULL) + if (tatooine == nullptr) { WARNING(true, ("Can't find planet tatooine from ServerUniverse")); } @@ -932,7 +932,7 @@ bool PlayerObject::grantSchematic(uint32 schematicCrc, bool fromSkill) const DraftSchematicObject * schematic = DraftSchematicObject::getSchematic( schematicCrc); - if (schematic != NULL) + if (schematic != nullptr) { // add the schematic to the player's draft schematic list Archive::AutoDeltaMap, int>::const_iterator found = m_draftSchematics.find(schematic->getCombinedCrc()); @@ -982,7 +982,7 @@ bool PlayerObject::revokeSchematic(uint32 schematicCrc, bool fromSkill) stopCrafting(false); const DraftSchematicObject * schematic = DraftSchematicObject::getSchematic(schematicCrc); - if (schematic != NULL) + if (schematic != nullptr) { // remove the schematic from the player's draft schematic list Archive::AutoDeltaMap, int>::const_iterator found = m_draftSchematics.find(schematic->getCombinedCrc()); @@ -1028,7 +1028,7 @@ bool PlayerObject::revokeSchematic(uint32 schematicCrc, bool fromSkill) bool PlayerObject::hasSchematic(uint32 schematicCrc) { const DraftSchematicObject * schematic = DraftSchematicObject::getSchematic(schematicCrc); - if (schematic != NULL) + if (schematic != nullptr) { std::map,int>::const_iterator found = m_draftSchematics.find(schematic->getCombinedCrc()); if (found != m_draftSchematics.end()) @@ -1065,7 +1065,7 @@ void PlayerObject::setCraftingTool(const TangibleObject & tool) */ void PlayerObject::setCraftingStation(const TangibleObject * station) { - if (station != NULL) + if (station != nullptr) { // verify the crafting station is valid if (station->getObjVars().hasItem(OBJVAR_CRAFTING_STATION)) @@ -1075,7 +1075,7 @@ void PlayerObject::setCraftingStation(const TangibleObject * station) // if we are private, make sure we have an ingredient hopper int privateStation = 0; station->getObjVars().getItem(OBJVAR_PRIVATE_STATION, privateStation); - if (privateStation == 1 && getCraftingLevel() == 3 && station->getIngredientHopper() == NULL) + if (privateStation == 1 && getCraftingLevel() == 3 && station->getIngredientHopper() == nullptr) { CreatureObject * const owner = getCreatureObject(); NOT_NULL(owner); @@ -1105,7 +1105,7 @@ void PlayerObject::setCraftingStation(const TangibleObject * station) bool PlayerObject::requestCraftingSession(const NetworkId & toolId) { CreatureObject * const owner = getCreatureObject(); - if (owner == NULL) + if (owner == nullptr) return false; const std::string myId = getNetworkId().getValueString(); @@ -1133,7 +1133,7 @@ bool PlayerObject::requestCraftingSession(const NetworkId & toolId) } TangibleObject * const tool = dynamic_cast(CachedNetworkId(toolId).getObject()); - if (tool == NULL) + if (tool == nullptr) { DEBUG_WARNING(true, ("Player %s requesting crafting session with invalid " "object %s", myIdString, toolIdString)); @@ -1155,7 +1155,7 @@ bool PlayerObject::requestCraftingSession(const NetworkId & toolId) { CachedNetworkId const & objId = (*iter); TangibleObject * const obj = safe_cast(objId.getObject()); - if ((obj != NULL) && obj->isCraftingTool() && (toolType & obj->getCraftingType())) + if ((obj != nullptr) && obj->isCraftingTool() && (toolType & obj->getCraftingType())) { return requestCraftingSession(objId) ; } @@ -1182,7 +1182,7 @@ bool PlayerObject::requestCraftingSession(const NetworkId & toolId) void PlayerObject::sendUseableDraftSchematics(std::vector & schematicNames) { CreatureObject * const owner = getCreatureObject(); - if (owner == NULL) + if (owner == nullptr) return; // keep around the names since we are just going to get an index back from @@ -1198,7 +1198,7 @@ void PlayerObject::sendUseableDraftSchematics(std::vector & schematicNam if (*iter != 0) { const DraftSchematicObject * const schematic = DraftSchematicObject::getSchematic(*iter); - if (schematic != NULL) + if (schematic != nullptr) { message->addSchematic(schematic->getCombinedCrc(), static_cast(schematic->getCategory())); @@ -1248,37 +1248,37 @@ void PlayerObject::sendUseableDraftSchematics(std::vector & schematicNam */ bool PlayerObject::requestDraftSlots(uint32 draftSchematicCrc, MessageQueueDraftSlots * message, MessageQueueDraftSlotsQueryResponse * queryMessage) { - ManufactureSchematicObject * manfSchematic = NULL; + ManufactureSchematicObject * manfSchematic = nullptr; MessageQueueDraftSlots::Slot slotInfo; MessageQueueDraftSlots::Option optionInfo; - if ((message == NULL && queryMessage == NULL) || - (message != NULL && queryMessage != NULL)) + if ((message == nullptr && queryMessage == nullptr) || + (message != nullptr && queryMessage != nullptr)) { return false; } CreatureObject * const owner = getCreatureObject(); - if (owner == NULL) + if (owner == nullptr) return false; const ConstCharCrcString & schematicName = ObjectTemplateList::lookUp(draftSchematicCrc); UNREF(schematicName); const DraftSchematicObject * const draftSchematic = DraftSchematicObject::getSchematic(draftSchematicCrc); - if (draftSchematic == NULL) + if (draftSchematic == nullptr) { DEBUG_WARNING(true, ("Player %s requested invalid draft schematic %s", owner->getNetworkId().getValueString().c_str(), schematicName.getString())); return false; } - if (message != NULL) + if (message != nullptr) { m_draftSchematic = draftSchematic; TangibleObject * const tool = safe_cast(getCraftingTool().getObject()); NOT_NULL(tool); - if (tool == NULL) + if (tool == nullptr) return false; tool->clearCraftingManufactureSchematic(); @@ -1287,7 +1287,7 @@ bool PlayerObject::requestDraftSlots(uint32 draftSchematicCrc, MessageQueueDraft // make a temporary manufacturing schematic based on the draft scematic manfSchematic = ServerWorld::createNewManufacturingSchematic(CachedNetworkId( *owner), *tool, tool->getCraftingManufactureSchematicSlotId(), false); - if (manfSchematic == NULL) + if (manfSchematic == nullptr) { DEBUG_WARNING(true, ("Error creating manufacturing schematic!")); return false; @@ -1305,7 +1305,7 @@ bool PlayerObject::requestDraftSlots(uint32 draftSchematicCrc, MessageQueueDraft // being made ServerObject * prototype = manfSchematic->manufactureObject(owner->getNetworkId(), *tool, tool->getCraftingPrototypeSlotId(), true); - if (prototype == NULL) + if (prototype == nullptr) { DEBUG_WARNING(true, ("Error creating temp prototype!")); return false; @@ -1322,7 +1322,7 @@ bool PlayerObject::requestDraftSlots(uint32 draftSchematicCrc, MessageQueueDraft getAccountDescription().c_str())); } - if (queryMessage != NULL) + if (queryMessage != nullptr) { queryMessage->setComplexity(static_cast(draftSchematic->getComplexity())); queryMessage->setVolume(draftSchematic->getVolume()); @@ -1343,7 +1343,7 @@ bool PlayerObject::requestDraftSlots(uint32 draftSchematicCrc, MessageQueueDraft if (!slot.optional || slot.optionalSkillCommand.empty() || owner->hasCommand(slot.optionalSkillCommand)) { - if (manfSchematic != NULL) + if (manfSchematic != nullptr) { // create the slot IGNORE_RETURN(manfSchematic->getSlot(slot.name, manfSlot)); @@ -1370,13 +1370,13 @@ bool PlayerObject::requestDraftSlots(uint32 draftSchematicCrc, MessageQueueDraft { // get the default object name from the shared template const ObjectTemplate *const ingredientTemplate = ObjectTemplateList::fetch(simple.ingredient); - if (ingredientTemplate == NULL) + if (ingredientTemplate == nullptr) { DEBUG_WARNING(true, ("draft schematic component ingredient %s not found!", simple.ingredient.c_str())); continue; } const SharedObjectTemplate * const sharedTemplate = safe_cast(ObjectTemplateList::fetch((safe_cast(ingredientTemplate))->getSharedTemplate())); - if (sharedTemplate == NULL) + if (sharedTemplate == nullptr) { DEBUG_WARNING(true, ("draft schematic component ingredient %s shared template not found!", simple.ingredient.c_str())); continue; @@ -1391,19 +1391,19 @@ bool PlayerObject::requestDraftSlots(uint32 draftSchematicCrc, MessageQueueDraft { // get the default object name from the shared template of the crafted object const ObjectTemplate * const ingredientTemplate = ObjectTemplateList::fetch(simple.ingredient); - if (ingredientTemplate == NULL) + if (ingredientTemplate == nullptr) { DEBUG_WARNING(true, ("draft schematic schematic ingredient %s not found!", simple.ingredient.c_str())); continue; } const ServerObjectTemplate * const craftedTemplate = safe_cast(ingredientTemplate)->getCraftedObjectTemplate(); - if (craftedTemplate == NULL) + if (craftedTemplate == nullptr) { DEBUG_WARNING(true, ("draft schematic schematic ingredient %s not found!", simple.ingredient.c_str())); continue; } const SharedObjectTemplate * const sharedTemplate = safe_cast(ObjectTemplateList::fetch((safe_cast(craftedTemplate))->getSharedTemplate())); - if (sharedTemplate == NULL) + if (sharedTemplate == nullptr) { DEBUG_WARNING(true, ("draft schematic component ingredient %s shared template not found!", simple.ingredient.c_str())); continue; @@ -1434,7 +1434,7 @@ bool PlayerObject::requestDraftSlots(uint32 draftSchematicCrc, MessageQueueDraft } // for (int j = 0; j < optionsCount; ++j) if (componentSlot) slotInfo.hardpoint = slot.appearance; - if (message != NULL) + if (message != nullptr) message->addSlot(slotInfo); else queryMessage->addSlot(slotInfo); @@ -1443,7 +1443,7 @@ bool PlayerObject::requestDraftSlots(uint32 draftSchematicCrc, MessageQueueDraft } // for (int i = 0; i < slotCount; ++i) // send the slot info to the player - if (message != NULL) + if (message != nullptr) { (safe_cast(owner->getController()))->appendMessage( static_cast(CM_draftSlotsMessage), 0.0f, message, @@ -1475,7 +1475,7 @@ bool PlayerObject::requestDraftSlots(uint32 draftSchematicCrc, MessageQueueDraft void PlayerObject::selectDraftSchematic(int index) { CreatureObject * const owner = getCreatureObject(); - if (owner == NULL) + if (owner == nullptr) return; const std::string myId = getNetworkId().getValueString(); @@ -1510,7 +1510,7 @@ void PlayerObject::selectDraftSchematic(int index) MessageQueueDraftSlots * message = new MessageQueueDraftSlots( getCraftingTool(), NetworkId::cms_invalid); - if (requestDraftSlots(m_useableDraftSchematics[static_cast(index)], message, NULL)) + if (requestDraftSlots(m_useableDraftSchematics[static_cast(index)], message, nullptr)) { m_craftingStage = static_cast(Crafting::CS_assembly); m_craftingComponentBioLink = NetworkId::cms_invalid; @@ -1540,11 +1540,11 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde UNREF(myIdString); // needed for release mode CreatureObject * const owner = getCreatureObject(); - if (owner == NULL) + if (owner == nullptr) return Crafting::CE_noOwner; // check the draft schematic - if (m_draftSchematic.getPointer() == NULL) + if (m_draftSchematic.getPointer() == nullptr) { WARNING(true, ("Player %s trying to fill slot with no draft schematic!", myIdString)); return Crafting::CE_noDraftSchematic; @@ -1572,9 +1572,9 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde } TangibleObject * const tool = safe_cast(getCraftingTool().getObject()); - if (tool == NULL) + if (tool == nullptr) { - WARNING(true, ("Player %s trying to fill slot with crafting tool %s, but tool is NULL!", myIdString, getCraftingTool().getValueString().c_str())); + WARNING(true, ("Player %s trying to fill slot with crafting tool %s, but tool is nullptr!", myIdString, getCraftingTool().getValueString().c_str())); return Crafting::CE_noCraftingTool; } @@ -1583,7 +1583,7 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde // check the manufacturing schematic ManufactureSchematicObject * const manfSchematic = tool->getCraftingManufactureSchematic(); - if (manfSchematic == NULL) + if (manfSchematic == nullptr) { WARNING(true, ("Player %s trying to fill slot with no manufacturing schematic!", myIdString)); return Crafting::CE_noManfSchematic; @@ -1614,7 +1614,7 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde // get the draft schematic option, convert the passed-in option index to the // unfiltered index int i, j; - const ServerIntangibleObjectTemplate::Ingredient * slotOption = NULL; + const ServerIntangibleObjectTemplate::Ingredient * slotOption = nullptr; const int optionsCount = static_cast(draftSlot.options.size()); for (i = 0, j = 0; i < optionsCount; ++i) { @@ -1637,9 +1637,9 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde } slotOptionIndex = i; - if (slotOption == NULL || slotOption->ingredients.size() != 1) + if (slotOption == nullptr || slotOption->ingredients.size() != 1) { - WARNING(true, ("slotOption is NULL or ingredient %d for draft schematic %s, slot %s, has ingredient count != 1", + WARNING(true, ("slotOption is nullptr or ingredient %d for draft schematic %s, slot %s, has ingredient count != 1", slotOptionIndex, m_draftSchematic->getTemplateName(), draftSlot.name.getText().c_str())); return Crafting::CE_invalidIngredientSize; } @@ -1671,7 +1671,7 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde int numIngredientsToAdd = neededIngredientCount - currentIngredientCount; TangibleObject * const ingredient = dynamic_cast(NetworkIdManager::getObjectById(ingredientId)); - if (ingredient == NULL) + if (ingredient == nullptr) { WARNING(true, ("No object for ingredient id %s", ingredientId.getValueString().c_str())); return Crafting::CE_invalidIngredient; @@ -1698,7 +1698,7 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde if (!owner->isIngredientInInventory(*ingredient)) { // if we are crafting level 3, also check the crafting station's hopper - if (getCraftingLevel() != 3 || (station != NULL && + if (getCraftingLevel() != 3 || (station != nullptr && !station->isIngredientInHopper(ingredientId))) { DEBUG_WARNING(true, ("Player %s chose invalid ingredient %s", myIdString, ingredientId.getValueString().c_str())); @@ -1709,7 +1709,7 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde // see if the ingredient is a resource or component ResourceContainerObject * const crate = dynamic_cast(ingredient); - if (crate != NULL) + if (crate != nullptr) { // get the resource type name and class name ResourceTypeObject const * const resource = crate->getResourceType(); @@ -1731,7 +1731,7 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde else if (slotOption->ingredientType == ServerIntangibleObjectTemplate::IT_resourceClass) { ResourceClassObject const * resourceClass = &(resource->getParentClass()); - while (resourceClass != NULL) + while (resourceClass != nullptr) { const std::string className (resourceClass->getResourceClassName()); if (className == slotIngredient.ingredient) @@ -1805,11 +1805,11 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde FactoryObject * factory = dynamic_cast(ingredient); // if this is an old-style factory, we can't use it directly in crafting - if (factory != NULL && !factory->getLoadContents()) - factory = NULL; + if (factory != nullptr && !factory->getLoadContents()) + factory = nullptr; // make sure the component isn't damaged - if (factory == NULL && ingredient->getDamageTaken() != 0 && + if (factory == nullptr && ingredient->getDamageTaken() != 0 && !ingredient->getObjVars().hasItem(OBJVAR_CRAFTING_COMPONENT_CAN_BE_DAMAGED)) { DEBUG_WARNING(true, ("Tried to use damaged component %s for draft schematic %s, slot %s, option %d", @@ -1853,27 +1853,27 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde // check the ingredient template name for every template in it's // heirarchy - const ObjectTemplate * testTemplate = NULL; + const ObjectTemplate * testTemplate = nullptr; if (slotOption->ingredientType == ServerIntangibleObjectTemplate::IT_template || slotOption->ingredientType == ServerIntangibleObjectTemplate::IT_templateGeneric) { - if (factory == NULL) + if (factory == nullptr) testTemplate = ingredient->getObjectTemplate(); else testTemplate = factory->getContainedObjectTemplate(); } else { - const DraftSchematicObject * itemSchematic = NULL; - if (factory == NULL) + const DraftSchematicObject * itemSchematic = nullptr; + if (factory == nullptr) itemSchematic = DraftSchematicObject::getSchematic(ingredient->getSourceDraftSchematic()); else itemSchematic = DraftSchematicObject::getSchematic(factory->getDraftSchematic()); - if (itemSchematic != NULL) + if (itemSchematic != nullptr) testTemplate = itemSchematic->getObjectTemplate(); } - while (testTemplate != NULL) + while (testTemplate != nullptr) { const std::string ingredientName(testTemplate->getName()); if (ingredientName == requiredIngredientName) @@ -1896,7 +1896,7 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde // this is a configureable setting const Crafting::ComponentIngredient * testComponent = dynamic_cast< const Crafting::ComponentIngredient *>(manfSlot.ingredients.front().get()); - if (testComponent != NULL) + if (testComponent != nullptr) { if (ConfigServerGame::getCraftingComponentStrict() && (slotOption->ingredientType != ServerIntangibleObjectTemplate::IT_templateGeneric && @@ -1909,15 +1909,15 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde else { // component from same template - if (factory == NULL) + if (factory == nullptr) { - if (ingredient->getObjectTemplateName() != NULL && + if (ingredient->getObjectTemplateName() != nullptr && ingredient->getObjectTemplateName() == testComponent->templateName) { slotOk = true; } } - else if (factory->getContainedTemplateName() != NULL && + else if (factory->getContainedTemplateName() != nullptr && factory->getContainedTemplateName() == testComponent->templateName) { slotOk = true; @@ -1927,7 +1927,7 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde } if (slotOk) { - if (factory == NULL || factory->getCount() <= numIngredientsToAdd) + if (factory == nullptr || factory->getCount() <= numIngredientsToAdd) { // adding normal component or a complete factory object if (manfSchematic->addIngredient(*ingredient)) @@ -1938,7 +1938,7 @@ Crafting::CraftingError PlayerObject::fillSlot(int slotIndex, int slotOptionInde manfSchematic->setSlotOption(manfSlot.name, slotOptionIndex); manfSchematic->modifySlotComplexity(manfSlot.name, slotOption->complexity); } - if (factory == NULL) + if (factory == nullptr) { manfSchematic->addSlotComponent(manfSlot.name, *ingredient, slotOption->ingredientType); @@ -2014,7 +2014,7 @@ Crafting::CraftingError PlayerObject::emptySlot(int slotIndex, const NetworkId & UNREF(myIdString); // needed for release mode CreatureObject * const owner = getCreatureObject(); - if (owner == NULL) + if (owner == nullptr) return Crafting::CE_noOwner; if (getCraftingStage() != Crafting::CS_assembly && !m_allowEmptySlot) @@ -2024,7 +2024,7 @@ Crafting::CraftingError PlayerObject::emptySlot(int slotIndex, const NetworkId & } // check the draft schematic - if (m_draftSchematic.getPointer() == NULL) + if (m_draftSchematic.getPointer() == nullptr) { WARNING(true, ("Player %s trying to empty slot with no draft schematic!", myIdString)); return Crafting::CE_noDraftSchematic; @@ -2037,15 +2037,15 @@ Crafting::CraftingError PlayerObject::emptySlot(int slotIndex, const NetworkId & return Crafting::CE_noCraftingTool; } TangibleObject * const tool = safe_cast(getCraftingTool().getObject()); - if (tool == NULL) + if (tool == nullptr) { - WARNING(true, ("Player %s trying to empty slot with crafting tool %s, but tool is NULL!", myIdString, getCraftingTool().getValueString().c_str())); + WARNING(true, ("Player %s trying to empty slot with crafting tool %s, but tool is nullptr!", myIdString, getCraftingTool().getValueString().c_str())); return Crafting::CE_noCraftingTool; } // get the crafting station (if any) TangibleObject * station = dynamic_cast(getCraftingStation().getObject()); - if (station != NULL && getCraftingLevel() == 3 && station->getIngredientHopper() == NULL) + if (station != nullptr && getCraftingLevel() == 3 && station->getIngredientHopper() == nullptr) { WARNING_STRICT_FATAL(true, ("Player %s trying to empty crafting slot near " "a crafting station %s that has no ingredient hopper!", @@ -2055,7 +2055,7 @@ Crafting::CraftingError PlayerObject::emptySlot(int slotIndex, const NetworkId & } ServerObject * const inventory = owner->getInventory(); - if (inventory == NULL) + if (inventory == nullptr) { WARNING (true, ("Player %s has no inventory.", myIdString)); return Crafting::CE_noInventory; @@ -2077,7 +2077,7 @@ Crafting::CraftingError PlayerObject::emptySlot(int slotIndex, const NetworkId & // if we are crafting level 3, also check the crafting station's hopper if (!containerIsWorn && - (getCraftingLevel() != 3 || (station != NULL && + (getCraftingLevel() != 3 || (station != nullptr && !isNestedInContainer (targetContainerId, station->getIngredientHopper()->getNetworkId())))) { WARNING (true, ("Player %s attempted to empty slot into invalid container [%s].", myIdString, targetContainerId.getValueString().c_str())); @@ -2087,7 +2087,7 @@ Crafting::CraftingError PlayerObject::emptySlot(int slotIndex, const NetworkId & targetContainer = safe_cast(NetworkIdManager::getObjectById (targetContainerId)); - if (targetContainer == NULL) + if (targetContainer == nullptr) { WARNING (true, ("Player %s attempted to empty slot into non-existant container [%s].", myIdString, targetContainerId.getValueString ().c_str ())); return Crafting::CE_badTargetContainer; @@ -2102,7 +2102,7 @@ Crafting::CraftingError PlayerObject::emptySlot(int slotIndex, const NetworkId & // check the manufacturing schematic ManufactureSchematicObject * const manfSchematic = tool->getCraftingManufactureSchematic(); - if (manfSchematic == NULL) + if (manfSchematic == nullptr) { WARNING(true, ("Player %s trying to empty slot with no manufacturing schematic!", myIdString)); return Crafting::CE_noManfSchematic; @@ -2154,7 +2154,7 @@ Crafting::CraftingError PlayerObject::emptySlot(int slotIndex, const NetworkId & const Crafting::ComponentIngredient * const componentInfo = dynamic_cast((*iter).get()); NOT_NULL(componentInfo); TangibleObject * const component = manfSchematic->getComponent(*componentInfo); - if (component != NULL) + if (component != nullptr) { // move the component from the schematic to the player if (!manfSchematic->removeIngredient(*component, *targetContainer)) @@ -2180,7 +2180,7 @@ Crafting::CraftingError PlayerObject::emptySlot(int slotIndex, const NetworkId & { // ingredient is a resource VolumeContainer * const targetVolumeContainer = ContainerInterface::getVolumeContainer(*targetContainer); - if (targetVolumeContainer == NULL) + if (targetVolumeContainer == nullptr) { DEBUG_WARNING(true, ("PlayerObject::emptySlot: targetContainer %s does not have a volume container", targetContainer->getNetworkId().getValueString().c_str())); @@ -2203,7 +2203,7 @@ Crafting::CraftingError PlayerObject::emptySlot(int slotIndex, const NetworkId & { ResourceContainerObject * crate = dynamic_cast< ResourceContainerObject *>(NetworkIdManager::getObjectById((*iter2))); - if (crate != NULL && crate->getResourceTypeId() == resourceId) + if (crate != nullptr && crate->getResourceTypeId() == resourceId) { int emptySpace = crate->getMaxQuantity() - crate->getQuantity(); if (emptySpace > 0) @@ -2236,7 +2236,7 @@ Crafting::CraftingError PlayerObject::emptySlot(int slotIndex, const NetworkId & { ServerObject * crateObject = ServerWorld::createNewObject( crateTemplateName, *targetContainer, true); - if (crateObject == NULL) + if (crateObject == nullptr) { // @todo: inform the player DEBUG_WARNING(true, ("PlayerObject::emptySlot tried to " @@ -2322,14 +2322,14 @@ int PlayerObject::startCraftingExperiment () int i; CreatureObject * const owner = getCreatureObject(); - if (owner == NULL) + if (owner == nullptr) return -Crafting::CE_noOwner; std::string myId = getNetworkId().getValueString(); const char * myIdString = myId.c_str(); UNREF(myIdString); // needed for release mode - if (m_draftSchematic.getPointer() == NULL) + if (m_draftSchematic.getPointer() == nullptr) { DEBUG_WARNING(true, ("Player %s tried to start crafting experimentation with invalid schematic.", myIdString)); return -Crafting::CE_noDraftSchematic; @@ -2350,13 +2350,13 @@ int PlayerObject::startCraftingExperiment () if (!tool) { - DEBUG_WARNING(true, ("Player %s tried to start crafting experimentation with null crafting tool [%s].", myIdString, getCraftingTool().getValueString().c_str())); + DEBUG_WARNING(true, ("Player %s tried to start crafting experimentation with nullptr crafting tool [%s].", myIdString, getCraftingTool().getValueString().c_str())); return -Crafting::CE_noCraftingTool; } // check the manufacturing schematic ManufactureSchematicObject * const manfSchematic = tool->getCraftingManufactureSchematic(); - if (manfSchematic == NULL) + if (manfSchematic == nullptr) { DEBUG_WARNING(true, ("Player %s tried to start crafting experimentation with invalid manufacture schematic.", myIdString)); return -Crafting::CE_noManfSchematic; @@ -2425,7 +2425,7 @@ int PlayerObject::startCraftingExperiment () } ServerObject * prototype = tool->getCraftingPrototype(); - if (prototype == NULL) + if (prototype == nullptr) { DEBUG_WARNING(true, ("PlayerObject::startCraftingExperiment crafting " "tool %s has no prototype object!", @@ -2530,7 +2530,7 @@ int PlayerObject::startCraftingExperiment () Crafting::CraftingResult PlayerObject::experiment(const std::vector & experiments, int totalPoints, int corelevel) { CreatureObject * const owner = getCreatureObject(); - if (owner == NULL) + if (owner == nullptr) return Crafting::CR_internalFailure; std::string myId = getNetworkId().getValueString(); @@ -2554,7 +2554,7 @@ Crafting::CraftingResult PlayerObject::experiment(const std::vectorgetCraftingManufactureSchematic(); - if (manfSchematic == NULL) + if (manfSchematic == nullptr) { DEBUG_WARNING(true, ("Player %s tried to experiment with invalid " "manufacture schematic.", myIdString)); @@ -2577,7 +2577,7 @@ Crafting::CraftingResult PlayerObject::experiment(const std::vectorgetCraftingPrototype(); - if (prototype == NULL) + if (prototype == nullptr) { DEBUG_WARNING(true, ("Player %s tried to experiment with invalid test " "prototype.", myIdString)); @@ -2680,7 +2680,7 @@ bool PlayerObject::customize(int property, int value) const return false; } - if (m_draftSchematic.getPointer() == NULL || getCraftingTool() == NetworkId::cms_invalid) + if (m_draftSchematic.getPointer() == nullptr || getCraftingTool() == NetworkId::cms_invalid) { DEBUG_WARNING(true, ("Player %s tried to customize with invalid " "schematic or crafting tool.", myIdString)); @@ -2732,7 +2732,7 @@ int PlayerObject::setCustomizationData(const Unicode::String & name, return Crafting::CE_notCustomizeStage; } - if (m_draftSchematic.getPointer() == NULL) + if (m_draftSchematic.getPointer() == nullptr) { DEBUG_WARNING(true, ("Player %s tried to customize with invalid schematic.", myIdString)); return Crafting::CE_noDraftSchematic; @@ -2804,7 +2804,7 @@ int PlayerObject::setCustomizationData(const Unicode::String & name, bool PlayerObject::createPrototype(bool keepPrototype) { CreatureObject * const owner = getCreatureObject(); - if (owner == NULL) + if (owner == nullptr) return false; std::string myId = getNetworkId().getValueString(); @@ -2821,7 +2821,7 @@ bool PlayerObject::createPrototype(bool keepPrototype) return false; } - if (m_draftSchematic.getPointer() == NULL || getCraftingTool() == NetworkId::cms_invalid) + if (m_draftSchematic.getPointer() == nullptr || getCraftingTool() == NetworkId::cms_invalid) { DEBUG_WARNING(true, ("Player %s tried to create prototype with invalid " "schematic or crafting tool.", myIdString)); @@ -2842,7 +2842,7 @@ bool PlayerObject::createPrototype(bool keepPrototype) } ManufactureSchematicObject * const manfSchematic = tool->getCraftingManufactureSchematic(); - if (manfSchematic == NULL) + if (manfSchematic == nullptr) { WARNING_STRICT_FATAL(true, ("No manf schematic in crafting tool %s", tool->getNetworkId().getValueString().c_str())); @@ -2961,7 +2961,7 @@ bool PlayerObject::createPrototype(bool keepPrototype) params.addParam(prototype->getNetworkId(), "prototype"); ScriptDictionaryPtr dictionary; getScriptObject()->makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); @@ -2969,7 +2969,7 @@ bool PlayerObject::createPrototype(bool keepPrototype) { Client * client = owner->getClient(); - if (client != NULL && client->isGod()) + if (client != nullptr && client->isGod()) { Chat::sendSystemMessage(*owner, Unicode::narrowToWide("Crafting time changed due to god mode and crafting_qa objvar."), Unicode::emptyString); prototypeTime = 1; @@ -3022,7 +3022,7 @@ bool PlayerObject::createManufacturingSchematic() return false; CreatureObject * const owner = getCreatureObject(); - if (owner == NULL) + if (owner == nullptr) return false; // @todo: need to filter the name @@ -3034,7 +3034,7 @@ bool PlayerObject::createManufacturingSchematic() return false; } - if (m_draftSchematic.getPointer() == NULL || getCraftingTool() == NetworkId::cms_invalid) + if (m_draftSchematic.getPointer() == nullptr || getCraftingTool() == NetworkId::cms_invalid) { WARNING(true, ("Player %s tried to create manf schematic with invalid schematic or crafting tool.", getNetworkId().getValueString().c_str ())); return false; @@ -3048,19 +3048,19 @@ bool PlayerObject::createManufacturingSchematic() } TangibleObject * const tool = safe_cast(getCraftingTool().getObject()); - if (tool == NULL) + if (tool == nullptr) { WARNING_STRICT_FATAL(true, ("Could not find crafting tool during create manf schematic phase.")); return false; } ManufactureSchematicObject * const manfSchematic = tool->removeCraftingManufactureSchematic(); - if (manfSchematic == NULL) + if (manfSchematic == nullptr) { WARNING_STRICT_FATAL(true, ("Could not find manf schematic during create manf schematic phase.")); return false; } TangibleObject * const prototype = safe_cast(tool->getCraftingPrototype()); - if (prototype == NULL) + if (prototype == nullptr) { WARNING_STRICT_FATAL(true, ("Could not find prototype during create manf schematic phase.")); return false; @@ -3141,14 +3141,14 @@ bool PlayerObject::createManufacturingSchematic() manfSchematic->persist(); ServerObject * const datapad = owner->getDatapad (); - if (datapad == NULL) + if (datapad == nullptr) { DEBUG_WARNING(true, ("Can't find datapad for player %s", getAccountDescription().c_str())); return false; } Container::ContainerErrorCode tmp = Container::CEC_Success; - if (!ContainerInterface::transferItemToVolumeContainer(*datapad, *manfSchematic, NULL, tmp)) + if (!ContainerInterface::transferItemToVolumeContainer(*datapad, *manfSchematic, nullptr, tmp)) { return false; } @@ -3173,7 +3173,7 @@ bool PlayerObject::createManufacturingSchematic() bool PlayerObject::restartCrafting () { CreatureObject * const owner = getCreatureObject(); - if (owner == NULL) + if (owner == nullptr) return false; std::string myId = getNetworkId().getValueString(); @@ -3195,7 +3195,7 @@ bool PlayerObject::restartCrafting () } // verify the tool - if (m_draftSchematic.getPointer() == NULL || getCraftingTool() == NetworkId::cms_invalid) + if (m_draftSchematic.getPointer() == nullptr || getCraftingTool() == NetworkId::cms_invalid) { DEBUG_WARNING(true, ("Player %s tried to start crafting experimentation " "with invalid schematic or crafting tool.", myIdString)); @@ -3208,7 +3208,7 @@ bool PlayerObject::restartCrafting () // reset the manf schematic ManufactureSchematicObject * manfSchematic = tool->getCraftingManufactureSchematic(); - if (manfSchematic == NULL) + if (manfSchematic == nullptr) { DEBUG_WARNING(true, ("Player %s has no manufacturing schematic!", myIdString)); return false; @@ -3262,21 +3262,21 @@ void PlayerObject::stopCrafting (bool normalExit) { CreatureObject * const owner = getCreatureObject(); - if (getCraftingTool().getObject() != NULL) + if (getCraftingTool().getObject() != nullptr) { TangibleObject * tool = dynamic_cast(getCraftingTool().getObject()); - if (tool != NULL) + if (tool != nullptr) { IGNORE_RETURN(tool->stopCraftingSession()); } // tell scripts that the session has ended ScriptParams params; - if (owner != NULL) + if (owner != nullptr) params.addParam(owner->getNetworkId()); else params.addParam(getNetworkId()); - if (getCurrentDraftSchematic() != NULL) + if (getCurrentDraftSchematic() != nullptr) params.addParam(getCurrentDraftSchematic()->getTemplateName()); else params.addParam(""); @@ -3292,7 +3292,7 @@ void PlayerObject::stopCrafting (bool normalExit) m_craftingComponentBioLink = NetworkId::cms_invalid; // tell the player crafting has ended - if (owner != NULL && owner->getController() != NULL) + if (owner != nullptr && owner->getController() != nullptr) { (safe_cast(owner->getController()))->appendMessage( static_cast(CM_craftingSessionEnded), 0.0f, @@ -3348,7 +3348,7 @@ void PlayerObject::requestFriendList() const { CreatureObject const *owner = safe_cast(ContainerInterface::getContainedByObject(*this)); - if (owner != NULL) + if (owner != nullptr) { ChatAvatarId chatAvatarId(Chat::constructChatAvatarId(*owner)); @@ -3410,7 +3410,7 @@ void PlayerObject::requestIgnoreList() const { CreatureObject const *owner = safe_cast(ContainerInterface::getContainedByObject(*this)); - if (owner != NULL) + if (owner != nullptr) { ChatAvatarId chatAvatarId(Chat::constructChatAvatarId(*owner)); @@ -3767,7 +3767,7 @@ void PlayerObject::setTitle(std::string const &title) m_skillTitle = title; } } - else if (title.empty() || (title == "citizenship") || (SkillManager::getInstance().getSkill(title) != NULL) || (CollectionsDataTable::isASlotTitle(title) != NULL) || (CollectionsDataTable::isACollectionTitle(title) != NULL) || (CollectionsDataTable::isAPageTitle(title) != NULL) || (GuildRankDataTable::isARankTitle(title) != NULL) || (CitizenRankDataTable::isARankTitle(title) != NULL)) + else if (title.empty() || (title == "citizenship") || (SkillManager::getInstance().getSkill(title) != nullptr) || (CollectionsDataTable::isASlotTitle(title) != nullptr) || (CollectionsDataTable::isACollectionTitle(title) != nullptr) || (CollectionsDataTable::isAPageTitle(title) != nullptr) || (GuildRankDataTable::isARankTitle(title) != nullptr) || (CitizenRankDataTable::isARankTitle(title) != nullptr)) { if (title != m_skillTitle.get()) m_skillTitle = title; @@ -4075,7 +4075,7 @@ void PlayerObject::handleCMessageTo(const MessageToPayload &message) } { - BiographyManager::requestBiography(owner->getNetworkId(), NULL); + BiographyManager::requestBiography(owner->getNetworkId(), nullptr); } bool needsTitleCheck = false; @@ -4139,7 +4139,7 @@ void PlayerObject::handleCMessageTo(const MessageToPayload &message) // also check to see if the citizen rank has changed, and if so, update the citizen rank information { std::vector const & cityIds = CityInterface::getCitizenOfCityId(owner->getNetworkId()); - CitizenInfo const * const citizenInfo = (!cityIds.empty() ? CityInterface::getCitizenInfo(cityIds.front(), owner->getNetworkId()) : NULL); + CitizenInfo const * const citizenInfo = (!cityIds.empty() ? CityInterface::getCitizenInfo(cityIds.front(), owner->getNetworkId()) : nullptr); if (!citizenInfo) { // not a citizen, so make sure the citizen rank is empty @@ -4265,12 +4265,12 @@ void PlayerObject::endBaselines() const CreatureObject * owner = safe_cast(ContainerInterface::getContainedByObject(*this)); - if (owner != NULL) + if (owner != nullptr) { SharedCreatureObjectTemplate::Species const species = owner->getSpecies(); setSpokenLanguage(GameLanguageManager::getStartingLanguage(species)); -// if (owner->isAuthoritative() && ServerUniverse::getInstance().getXpManager() != NULL) +// if (owner->isAuthoritative() && ServerUniverse::getInstance().getXpManager() != nullptr) // { // // get any xp we earned while offline // ServerUniverse::getInstance().getXpManager()->requestXp(*this); @@ -4326,7 +4326,7 @@ void PlayerObject::endBaselines() } else { - m_chatSpamTimeEndInterval = static_cast(::time(NULL)) + (ConfigServerGame::getChatSpamLimiterIntervalMinutes() * 60); + m_chatSpamTimeEndInterval = static_cast(::time(nullptr)) + (ConfigServerGame::getChatSpamLimiterIntervalMinutes() * 60); m_chatSpamSpatialNumCharacters = 0; m_chatSpamNonSpatialNumCharacters = 0; m_chatSpamNextTimeToSyncWithChatServer = 0; @@ -4362,7 +4362,7 @@ void PlayerObject::endBaselines() { m_squelchedById = tempNetworkId; m_squelchedByName = tempString; - m_squelchExpireTime = static_cast(::time(NULL)) + (temp - gameTimeNow); + m_squelchExpireTime = static_cast(::time(nullptr)) + (temp - gameTimeNow); } } } @@ -4373,7 +4373,7 @@ void PlayerObject::endBaselines() DynamicVariableList::NestedList const gcwContribution(getObjVars(), "gcwContributionTracking"); if (!gcwContribution.empty()) { - int const timeExpired = static_cast(::time(NULL)) - (60 * 60 * 24 * 30); // 30 days + int const timeExpired = static_cast(::time(nullptr)) - (60 * 60 * 24 * 30); // 30 days std::list gcwContributionToRemove; int timeLastContributed; for (DynamicVariableList::NestedList::const_iterator i = gcwContribution.begin(); i != gcwContribution.end(); ++i) @@ -4724,12 +4724,12 @@ std::string PlayerObject::getAccountDescription() const { const ServerObject * owner = safe_cast( ContainerInterface::getContainedByObject(*this)); - if (owner == NULL) + if (owner == nullptr) return "UNKNOWN"; bool isGod = false; bool isSecure = false; - Client * client = NULL; + Client * client = nullptr; if (owner && owner->getClient()) { client = owner->getClient(); @@ -4768,7 +4768,7 @@ std::string PlayerObject::getAccountDescription() const void PlayerObject::logChat(int const logIndex) { - if (m_chatLog != NULL) + if (m_chatLog != nullptr) { time_t const logTime = Os::getRealSystemTime(); @@ -5276,10 +5276,10 @@ void PlayerObject::checkTheater(const Vector & pos, const std::string & scene, IntangibleObject * theater = IntangibleObject::spawnTheater(m_theaterDatatable.get(), m_theaterPosition.get(), m_theaterScript.get(), static_cast(m_theaterLocationType.get())); - if (theater != NULL) + if (theater != nullptr) { const CreatureObject * owner = getCreatureObject(); - if (owner != NULL) + if (owner != nullptr) theater->setPlayer(*owner); theater->setTheaterCreator(m_theaterCreator.get()); if (!theater->setTheaterName(m_theaterName.get())) @@ -5287,10 +5287,10 @@ void PlayerObject::checkTheater(const Vector & pos, const std::string & scene, WARNING(true, ("PlayerObject::checkTheater could not create " "theater with name %s", m_theaterName.get().c_str())); theater->permanentlyDestroy(DeleteReasons::SetupFailed); - theater = NULL; + theater = nullptr; } } - if (theater == NULL) + if (theater == nullptr) { CreatureObject * creatureObject = getCreatureObject(); if (creatureObject) @@ -5357,7 +5357,7 @@ bool PlayerObject::setTheater(const std::string & datatable, const Vector & posi return false; } - if (ServerUniverse::getInstance().getPlanetByName(scene) == NULL) + if (ServerUniverse::getInstance().getPlanetByName(scene) == nullptr) { WARNING(true, ("PlayerObject::setTheater called with invalid scene %s", scene.c_str())); @@ -6342,7 +6342,7 @@ unsigned long PlayerObject::getSessionPlayTimeDuration() const time_t const sessionStartPlayTime = static_cast(m_sessionStartPlayTime.get()); if (sessionStartPlayTime > 0) { - time_t const now = ::time(NULL); + time_t const now = ::time(nullptr); if (now > sessionStartPlayTime) return static_cast(now - sessionStartPlayTime); } @@ -6359,7 +6359,7 @@ unsigned long PlayerObject::getSessionActivePlayTimeDuration() const time_t const sessionLastActiveTime = static_cast(m_sessionLastActiveTime.get()); if (sessionLastActiveTime > 0) { - time_t const now = ::time(NULL); + time_t const now = ::time(nullptr); if (now > sessionLastActiveTime) activePlayTimeDuration += static_cast(now - sessionLastActiveTime); } @@ -6393,7 +6393,7 @@ void PlayerObject::setSessionPlayTimeInfo(int32 sessionStartPlayTime, int32 sess ServerUniverse::setConnectedCharacterLfgData(owner->getNetworkId(), lfgCharacterData); - BiographyManager::requestBiography(owner->getNetworkId(), NULL); + BiographyManager::requestBiography(owner->getNetworkId(), nullptr); // check/set "account age" title checkAndSetAccountAgeTitle(*this); @@ -7040,7 +7040,7 @@ void PlayerObject::modifyNextGcwRatingCalcTime(int const weekCount) return; static int32 const max = std::numeric_limits::max(); - int32 const now = static_cast(::time(NULL)); + int32 const now = static_cast(::time(nullptr)); // m_nextGcwRatingCalcTime should always be >= 0 int32 const currentValue = std::max(static_cast(0), m_nextGcwRatingCalcTime.get()); @@ -7176,7 +7176,7 @@ void PlayerObject::setNextGcwRatingCalcTime(bool const alwaysSendMessageToForRec return; bool needToSendMessageTo = alwaysSendMessageToForRecalc; - int32 const now = static_cast(::time(NULL)); + int32 const now = static_cast(::time(nullptr)); // if the player needs a rating recalculation, // make sure that m_nextGcwRatingCalcTime is set so that the @@ -7232,7 +7232,7 @@ void PlayerObject::handleRecalculateGcwRating() return; // is it time to recalculate? - int32 const now = static_cast(::time(NULL)); + int32 const now = static_cast(::time(nullptr)); if ((m_nextGcwRatingCalcTime.get() > 0) && (m_nextGcwRatingCalcTime.get() <= now)) { // is recalculation required? @@ -7367,7 +7367,7 @@ void PlayerObject::sendRecalculateGcwRatingMessageTo(int delay) // send new messageTo int const adjustedDelay = std::max(5, delay); MessageToQueue::getInstance().sendMessageToC(getNetworkId(), "C++RecalculateGcwRating", "", adjustedDelay, false); - m_gcwRatingActualCalcTime = static_cast(::time(NULL) + adjustedDelay); + m_gcwRatingActualCalcTime = static_cast(::time(nullptr) + adjustedDelay); } // ---------------------------------------------------------------------- @@ -7728,7 +7728,7 @@ bool PlayerObject::getCollectionSlotValue(CollectionsDataTable::CollectionInfoSl // ---------------------------------------------------------------------- -bool PlayerObject::hasCompletedCollectionSlotPrereq(std::string const & slotName, std::vector * collectionInfo /*= NULL*/) const +bool PlayerObject::hasCompletedCollectionSlotPrereq(std::string const & slotName, std::vector * collectionInfo /*= nullptr*/) const { CollectionsDataTable::CollectionInfoSlot const * slotInfo = CollectionsDataTable::getSlotByName(slotName); if (!slotInfo) @@ -7742,7 +7742,7 @@ bool PlayerObject::hasCompletedCollectionSlotPrereq(std::string const & slotName // ---------------------------------------------------------------------- -bool PlayerObject::hasCompletedCollectionSlotPrereq(CollectionsDataTable::CollectionInfoSlot const & slotInfo, std::vector * collectionInfo /*= NULL*/) const +bool PlayerObject::hasCompletedCollectionSlotPrereq(CollectionsDataTable::CollectionInfoSlot const & slotInfo, std::vector * collectionInfo /*= nullptr*/) const { if (collectionInfo) collectionInfo->clear(); @@ -7862,7 +7862,7 @@ bool PlayerObject::hasCompletedCollectionBook(std::string const & bookName) cons // ---------------------------------------------------------------------- -int PlayerObject::getCompletedCollectionSlotCountInCollection(std::string const & collectionName, stdvector::fwd * collectionInfo /*= NULL*/) const +int PlayerObject::getCompletedCollectionSlotCountInCollection(std::string const & collectionName, stdvector::fwd * collectionInfo /*= nullptr*/) const { if (collectionInfo) collectionInfo->clear(); @@ -7885,7 +7885,7 @@ int PlayerObject::getCompletedCollectionSlotCountInCollection(std::string const // ---------------------------------------------------------------------- -int PlayerObject::getCompletedCollectionSlotCountInPage(std::string const & pageName, std::vector * collectionInfo /*= NULL*/) const +int PlayerObject::getCompletedCollectionSlotCountInPage(std::string const & pageName, std::vector * collectionInfo /*= nullptr*/) const { if (collectionInfo) collectionInfo->clear(); @@ -7908,7 +7908,7 @@ int PlayerObject::getCompletedCollectionSlotCountInPage(std::string const & page // ---------------------------------------------------------------------- -int PlayerObject::getCompletedCollectionCountInPage(std::string const & pageName, std::vector * collectionInfo /*= NULL*/) const +int PlayerObject::getCompletedCollectionCountInPage(std::string const & pageName, std::vector * collectionInfo /*= nullptr*/) const { if (collectionInfo) collectionInfo->clear(); @@ -7931,7 +7931,7 @@ int PlayerObject::getCompletedCollectionCountInPage(std::string const & pageName // ---------------------------------------------------------------------- -int PlayerObject::getCompletedCollectionSlotCountInBook(std::string const & bookName, std::vector * collectionInfo /*= NULL*/) const +int PlayerObject::getCompletedCollectionSlotCountInBook(std::string const & bookName, std::vector * collectionInfo /*= nullptr*/) const { if (collectionInfo) collectionInfo->clear(); @@ -7954,7 +7954,7 @@ int PlayerObject::getCompletedCollectionSlotCountInBook(std::string const & book // ---------------------------------------------------------------------- -int PlayerObject::getCompletedCollectionCountInBook(std::string const & bookName, std::vector * collectionInfo /*= NULL*/) const +int PlayerObject::getCompletedCollectionCountInBook(std::string const & bookName, std::vector * collectionInfo /*= nullptr*/) const { if (collectionInfo) collectionInfo->clear(); @@ -7977,7 +7977,7 @@ int PlayerObject::getCompletedCollectionCountInBook(std::string const & bookName // ---------------------------------------------------------------------- -int PlayerObject::getCompletedCollectionPageCountInBook(std::string const & bookName, std::vector * collectionInfo /*= NULL*/) const +int PlayerObject::getCompletedCollectionPageCountInBook(std::string const & bookName, std::vector * collectionInfo /*= nullptr*/) const { if (collectionInfo) collectionInfo->clear(); @@ -8000,7 +8000,7 @@ int PlayerObject::getCompletedCollectionPageCountInBook(std::string const & book // ---------------------------------------------------------------------- -int PlayerObject::getCompletedCollectionBookCount(std::vector * collectionInfo /*= NULL*/) const +int PlayerObject::getCompletedCollectionBookCount(std::vector * collectionInfo /*= nullptr*/) const { if (collectionInfo) collectionInfo->clear(); @@ -8103,7 +8103,7 @@ void PlayerObject::updateChatSpamSpatialNumCharacters(NetworkId const & characte if (!isAuthoritative()) return; - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); bool syncChatServer = false; // new interval, reset @@ -8125,7 +8125,7 @@ void PlayerObject::updateChatSpamSpatialNumCharacters(NetworkId const & characte { time_t timeUnsquelch = static_cast(getSecondsUntilUnsquelched()); if (timeUnsquelch > 0) - timeUnsquelch += ::time(NULL); + timeUnsquelch += ::time(nullptr); GenericValueTypeMessage, int>, std::pair > > chatStatistics("ChatStatisticsGS", std::make_pair(std::make_pair(std::make_pair(character, static_cast(timeUnsquelch)), m_chatSpamTimeEndInterval.get()), std::make_pair(m_chatSpamSpatialNumCharacters.get(), m_chatSpamNonSpatialNumCharacters.get()))); Chat::sendToChatServer(chatStatistics); @@ -8140,7 +8140,7 @@ void PlayerObject::handleChatStatisticsFromChatServer(NetworkId const & characte if (!isAuthoritative()) return; - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); bool syncChatServer = false; // new interval, reset @@ -8168,7 +8168,7 @@ void PlayerObject::handleChatStatisticsFromChatServer(NetworkId const & characte { time_t timeUnsquelch = static_cast(getSecondsUntilUnsquelched()); if (timeUnsquelch > 0) - timeUnsquelch += ::time(NULL); + timeUnsquelch += ::time(nullptr); GenericValueTypeMessage, int>, std::pair > > chatStatistics("ChatStatisticsGS", std::make_pair(std::make_pair(std::make_pair(character, static_cast(timeUnsquelch)), m_chatSpamTimeEndInterval.get()), std::make_pair(m_chatSpamSpatialNumCharacters.get(), m_chatSpamNonSpatialNumCharacters.get()))); Chat::sendToChatServer(chatStatistics); @@ -8274,7 +8274,7 @@ void PlayerObject::updateGcwDefenderRegionInfo() cityGcwDefenderRegion = gcwDefenderRegion; int const timeJoinedGcwDefenderRegion = cityInfo.getTimeJoinedGcwDefenderRegion(); - timeQualifyForBonus = static_cast(::time(NULL)) - (ConfigServerGame::getGcwDaysRequiredForGcwRegionDefenderBonus() * 86400); + timeQualifyForBonus = static_cast(::time(nullptr)) - (ConfigServerGame::getGcwDaysRequiredForGcwRegionDefenderBonus() * 86400); if (!PvpData::isNeutralFactionId(cityFaction) && (cityFaction == owner->getPvpFaction()) && (timeJoinedGcwDefenderRegion < timeQualifyForBonus)) { cityGcwDefenderRegionHasBonus = true; @@ -8316,7 +8316,7 @@ void PlayerObject::updateGcwDefenderRegionInfo() int const timeJoinedGcwDefenderRegion = GuildInterface::getTimeJoinedGuildCurrentGcwDefenderRegion(*gi); if (timeQualifyForBonus < 0) - timeQualifyForBonus = static_cast(::time(NULL)) - (ConfigServerGame::getGcwDaysRequiredForGcwRegionDefenderBonus() * 86400); + timeQualifyForBonus = static_cast(::time(nullptr)) - (ConfigServerGame::getGcwDaysRequiredForGcwRegionDefenderBonus() * 86400); if (!PvpData::isNeutralFactionId(guildFaction) && (guildFaction == owner->getPvpFaction()) && (timeJoinedGcwDefenderRegion < timeQualifyForBonus)) { @@ -8417,7 +8417,7 @@ void PlayerObject::squelch(NetworkId const & squelchedById, std::string const & } else { - m_squelchExpireTime = static_cast(::time(NULL)) + squelchDurationSeconds; + m_squelchExpireTime = static_cast(::time(nullptr)) + squelchDurationSeconds; // persist squelch info setObjVarItem(OBJVAR_SQUELCH_EXPIRE, static_cast(ServerClock::getInstance().getGameTimeSeconds()) + squelchDurationSeconds); @@ -8466,7 +8466,7 @@ void PlayerObject::unsquelch() { CreatureObject * const owner = getCreatureObject(); if (owner) - owner->sendControllerMessageToAuthServer(CM_unsquelch, NULL); + owner->sendControllerMessageToAuthServer(CM_unsquelch, nullptr); } } @@ -8482,7 +8482,7 @@ int PlayerObject::getSecondsUntilUnsquelched() if (m_squelchExpireTime.get() < 0) // squelched indefinitely return -1; - int32 const timeNow = static_cast(::time(NULL)); + int32 const timeNow = static_cast(::time(nullptr)); if (timeNow < m_squelchExpireTime.get()) // still in squelch period return (m_squelchExpireTime.get() - timeNow); @@ -8570,7 +8570,7 @@ void PlayerObject::setAccountNumLotsOverLimitSpam() { m_accountNumLotsOverLimitSpam = m_accountNumLots.get() - owner->getMaxNumberOfLots(); - int const timeNow = static_cast(::time(NULL)); + int const timeNow = static_cast(::time(nullptr)); int violationTime = 0; if (!owner->getObjVars().getItem("lotOverlimit.violation_time", violationTime)) { @@ -9010,7 +9010,7 @@ void PlayerObjectNamespace::grantGcwFactionalPresenceScore(std::string const & g // // for space, give bonus if the player's citizenship city is on the // corresponding ground planet and is the same faction as the player - CityInfo const * ci = NULL; + CityInfo const * ci = nullptr; if (!ServerWorld::isSpaceScene()) { Vector const creaturePosition = co.findPosition_w(); @@ -9132,7 +9132,7 @@ void PlayerObjectNamespace::grantGcwFactionalPresenceScore(std::string const & g playerCitySpaceZone = std::string("space_") + playerCityPlanet; if (playerCitySpaceZone != ServerWorld::getSceneId()) - ci = NULL; + ci = nullptr; } } @@ -9155,7 +9155,7 @@ void PlayerObjectNamespace::grantGcwFactionalPresenceScore(std::string const & g bonus += (cityRank * ConfigServerGame::getGcwFactionalPresenceAlignedCityRankBonusPct()); if (ci->getCreationTime() > 0) - bonus += std::max(0, (static_cast(::time(NULL)) - std::max(1041408000, ci->getCreationTime())) / 31536000 * ConfigServerGame::getGcwFactionalPresenceAlignedCityAgeBonusPct()); + bonus += std::max(0, (static_cast(::time(nullptr)) - std::max(1041408000, ci->getCreationTime())) / 31536000 * ConfigServerGame::getGcwFactionalPresenceAlignedCityAgeBonusPct()); } } diff --git a/engine/server/library/serverGame/src/shared/object/PlayerObject.h b/engine/server/library/serverGame/src/shared/object/PlayerObject.h index 2298e6bd..da5386d8 100755 --- a/engine/server/library/serverGame/src/shared/object/PlayerObject.h +++ b/engine/server/library/serverGame/src/shared/object/PlayerObject.h @@ -361,8 +361,8 @@ public: bool getCollectionSlotValue(std::string const & slotName, unsigned long & value) const; bool getCollectionSlotValue(CollectionsDataTable::CollectionInfoSlot const & slotInfo, unsigned long & value) const; - bool hasCompletedCollectionSlotPrereq(std::string const & slotName, stdvector::fwd * collectionInfo = NULL) const; - bool hasCompletedCollectionSlotPrereq(CollectionsDataTable::CollectionInfoSlot const & slotInfo, stdvector::fwd * collectionInfo = NULL) const; + bool hasCompletedCollectionSlotPrereq(std::string const & slotName, stdvector::fwd * collectionInfo = nullptr) const; + bool hasCompletedCollectionSlotPrereq(CollectionsDataTable::CollectionInfoSlot const & slotInfo, stdvector::fwd * collectionInfo = nullptr) const; bool hasCompletedCollectionSlot(std::string const & slotName) const; bool hasCompletedCollectionSlot(CollectionsDataTable::CollectionInfoSlot const & slotInfo) const; @@ -374,15 +374,15 @@ public: bool hasCompletedCollectionBook(std::string const & bookName) const; - int getCompletedCollectionSlotCountInCollection(std::string const & collectionName, stdvector::fwd * collectionInfo = NULL) const; + int getCompletedCollectionSlotCountInCollection(std::string const & collectionName, stdvector::fwd * collectionInfo = nullptr) const; - int getCompletedCollectionSlotCountInPage(std::string const & pageName, stdvector::fwd * collectionInfo = NULL) const; - int getCompletedCollectionCountInPage(std::string const & pageName, stdvector::fwd * collectionInfo = NULL) const; + int getCompletedCollectionSlotCountInPage(std::string const & pageName, stdvector::fwd * collectionInfo = nullptr) const; + int getCompletedCollectionCountInPage(std::string const & pageName, stdvector::fwd * collectionInfo = nullptr) const; - int getCompletedCollectionSlotCountInBook(std::string const & bookName, stdvector::fwd * collectionInfo = NULL) const; - int getCompletedCollectionCountInBook(std::string const & bookName, stdvector::fwd * collectionInfo = NULL) const; - int getCompletedCollectionPageCountInBook(std::string const & bookName, stdvector::fwd * collectionInfo = NULL) const; - int getCompletedCollectionBookCount(stdvector::fwd * collectionInfo = NULL) const; + int getCompletedCollectionSlotCountInBook(std::string const & bookName, stdvector::fwd * collectionInfo = nullptr) const; + int getCompletedCollectionCountInBook(std::string const & bookName, stdvector::fwd * collectionInfo = nullptr) const; + int getCompletedCollectionPageCountInBook(std::string const & bookName, stdvector::fwd * collectionInfo = nullptr) const; + int getCompletedCollectionBookCount(stdvector::fwd * collectionInfo = nullptr) const; void migrateLegacyBadgesToCollection(stdvector::fwd const & badges); diff --git a/engine/server/library/serverGame/src/shared/object/PlayerQuestObject.cpp b/engine/server/library/serverGame/src/shared/object/PlayerQuestObject.cpp index 54e63df9..dca33824 100755 --- a/engine/server/library/serverGame/src/shared/object/PlayerQuestObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/PlayerQuestObject.cpp @@ -27,7 +27,7 @@ //----------------------------------------------------------------------- -const SharedObjectTemplate * PlayerQuestObject::m_defaultSharedTemplate = NULL; +const SharedObjectTemplate * PlayerQuestObject::m_defaultSharedTemplate = nullptr; namespace PlayerQuestObjectNamespace { @@ -156,7 +156,7 @@ void PlayerQuestObject::removeDefaultTemplate() if(m_defaultSharedTemplate) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } diff --git a/engine/server/library/serverGame/src/shared/object/ResourceContainerObject.cpp b/engine/server/library/serverGame/src/shared/object/ResourceContainerObject.cpp index 9b47248b..398adf07 100755 --- a/engine/server/library/serverGame/src/shared/object/ResourceContainerObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/ResourceContainerObject.cpp @@ -27,7 +27,7 @@ // ====================================================================== -const SharedObjectTemplate * ResourceContainerObject::m_defaultSharedTemplate = NULL; +const SharedObjectTemplate * ResourceContainerObject::m_defaultSharedTemplate = nullptr; namespace ResourceContainerObjectNamespace { @@ -66,11 +66,11 @@ const SharedObjectTemplate * ResourceContainerObject::getDefaultSharedTemplate(v { static const ConstCharCrcLowerString templateName("object/resource_container/base/shared_resource_container_default.iff"); - if (m_defaultSharedTemplate == NULL) + if (m_defaultSharedTemplate == nullptr) { m_defaultSharedTemplate = safe_cast(ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != NULL) + WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create default shared object template %s", templateName.getString())); + if (m_defaultSharedTemplate != nullptr) ExitChain::add (removeDefaultTemplate, "ResourceContainerObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -83,10 +83,10 @@ const SharedObjectTemplate * ResourceContainerObject::getDefaultSharedTemplate(v */ void ResourceContainerObject::removeDefaultTemplate(void) { - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } // ResourceContainerObject::removeDefaultTemplate @@ -398,7 +398,7 @@ bool ResourceContainerObject::transferTo(ResourceContainerObject &destination, i * @param destContainer The container into which the new ResourceContainer should be placed, or cms_Invalid if no container * @param arrangementId -1 If destContainer is not slotted, otherwise the ID of the arrangement to use * @param newLocation The coordinates at which to place the new ResourceContainer. (Ignored if it is going into a non-positional container.) - * @param actor The player making the split, or NULL + * @param actor The player making the split, or nullptr */ bool ResourceContainerObject::splitContainer(int amount, const CachedNetworkId &destContainer, int arrangementId, const Vector &newLocation, ServerObject *actor) @@ -407,7 +407,7 @@ bool ResourceContainerObject::splitContainer(int amount, const CachedNetworkId & bool result = false; - ResourceContainerObject *newCrate = NULL; + ResourceContainerObject *newCrate = nullptr; if (destContainer == CachedNetworkId::cms_cachedInvalid) { @@ -420,7 +420,7 @@ bool ResourceContainerObject::splitContainer(int amount, const CachedNetworkId & { // create in volume container ServerObject * destObject = safe_cast(destContainer.getObject()); - if (destObject == NULL) + if (destObject == nullptr) return false; newCrate = dynamic_cast(ServerWorld::createNewObject(getObjectTemplateName(), *destObject, isPersisted())); } @@ -428,10 +428,10 @@ bool ResourceContainerObject::splitContainer(int amount, const CachedNetworkId & { // create in slotted container ServerObject * destObject = safe_cast(destContainer.getObject()); - if (destObject == NULL) + if (destObject == nullptr) return false; const SlottedContainmentProperty* containmentProperty = ContainerInterface::getSlottedContainmentProperty(*destObject); - if (containmentProperty == NULL) + if (containmentProperty == nullptr) return false; const SlottedContainmentProperty::SlotArrangement & slots = containmentProperty->getSlotArrangement(arrangementId); if (slots.empty()) diff --git a/engine/server/library/serverGame/src/shared/object/ResourcePoolObject.cpp b/engine/server/library/serverGame/src/shared/object/ResourcePoolObject.cpp index c5efc41b..82e2a710 100755 --- a/engine/server/library/serverGame/src/shared/object/ResourcePoolObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/ResourcePoolObject.cpp @@ -30,7 +30,7 @@ ResourcePoolObject::ResourcePoolObject(ResourceTypeObject const & resourceType, m_fractalData(resourceType.getFractalData()), m_fractalSeed(fractalSeed), m_depletedTimestamp(resourceType.getDepletedTimestamp()), - m_efficiencyMap(NULL) + m_efficiencyMap(nullptr) { } @@ -39,7 +39,7 @@ ResourcePoolObject::ResourcePoolObject(ResourceTypeObject const & resourceType, ResourcePoolObject::~ResourcePoolObject() { delete m_efficiencyMap; - m_efficiencyMap=NULL; + m_efficiencyMap=nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/object/ResourceTypeObject.cpp b/engine/server/library/serverGame/src/shared/object/ResourceTypeObject.cpp index 536c4e4f..d0b9123a 100755 --- a/engine/server/library/serverGame/src/shared/object/ResourceTypeObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/ResourceTypeObject.cpp @@ -146,7 +146,7 @@ void ResourceTypeObject::setName(const std::string &newName) ResourcePoolObject *ResourceTypeObject::getPoolForPlanet(PlanetObject const &planetObject) const { if (isRecycled()) - return NULL; + return nullptr; std::map::const_iterator i=m_pools.find(planetObject.getNetworkId()); if (i==m_pools.end()) @@ -167,7 +167,7 @@ ResourcePoolObject *ResourceTypeObject::getPoolForPlanet(PlanetObject const &pla m_pools[planetObject.getNetworkId()]=obj; return obj; } - return NULL; // no pool for this planet + return nullptr; // no pool for this planet } } else @@ -377,7 +377,7 @@ ResourceTypeObject const * ResourceTypeObject::getRecycledVersion() const return result; } else - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -437,7 +437,7 @@ NetworkId ResourceTypeObject::addImportedResourceType(std::string const & resour static Unicode::String const attributeDelimiters(Unicode::narrowToWide(" ")); Unicode::UnicodeStringVector tokens; static size_t const resourceAttributeIndex = 5; - if ((Unicode::tokenize(Unicode::narrowToWide(resourceData), tokens, &delimiters, NULL)) && (tokens.size() > resourceAttributeIndex)) + if ((Unicode::tokenize(Unicode::narrowToWide(resourceData), tokens, &delimiters, nullptr)) && (tokens.size() > resourceAttributeIndex)) { AddResourceTypeMessageNamespace::ResourceTypeData rtd; rtd.m_depletedTimestamp = 1; @@ -453,7 +453,7 @@ NetworkId ResourceTypeObject::addImportedResourceType(std::string const & resour for (size_t i = resourceAttributeIndex; i < tokens.size(); ++i) { attributeTokens.clear(); - if ((Unicode::tokenize(tokens[i], attributeTokens, &attributeDelimiters, NULL)) && (attributeTokens.size() == 2)) + if ((Unicode::tokenize(tokens[i], attributeTokens, &attributeDelimiters, nullptr)) && (attributeTokens.size() == 2)) { rtd.m_attributes.push_back(std::make_pair(Unicode::wideToNarrow(attributeTokens[0]), ::atoi(Unicode::wideToNarrow(attributeTokens[1]).c_str()))); } diff --git a/engine/server/library/serverGame/src/shared/object/ServerObject.cpp b/engine/server/library/serverGame/src/shared/object/ServerObject.cpp index d2598408..e96fc5b1 100755 --- a/engine/server/library/serverGame/src/shared/object/ServerObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/ServerObject.cpp @@ -507,7 +507,7 @@ using namespace ServerObjectNamespace; // ====================================================================== -const SharedObjectTemplate * ServerObject::m_defaultSharedTemplate = NULL; +const SharedObjectTemplate * ServerObject::m_defaultSharedTemplate = nullptr; float ServerObject::ms_buildingUpdateRadiusMultiplier = 0; // ====================================================================== @@ -691,7 +691,7 @@ void ServerObject::ObserversCountCallback::modified(ServerObject &target, int ol ServerObject::ServerObject(const ServerObjectTemplate* newTemplate, const ObjectNotification ¬ification, bool const hyperspaceOnCreate) : Object (newTemplate, NetworkId::cms_invalid), m_oldPosition (), -m_sharedTemplate (NULL), +m_sharedTemplate (nullptr), m_client (0), m_observers (), m_localFlags (0), @@ -732,7 +732,7 @@ m_serverPackage (), m_serverPackage_np (), m_sharedPackage (), m_sharedPackage_np (), -m_networkUpdateFar (NULL), +m_networkUpdateFar (nullptr), m_triggerVolumes (), m_attributesAttained (), m_attributesInterested (), @@ -765,13 +765,13 @@ m_loadCTSPackedHouses(false) const std::string & sharedTemplateName = newTemplate->getSharedTemplate(); m_sharedTemplate = dynamic_cast(ObjectTemplateList::fetch(sharedTemplateName)); - if (m_sharedTemplate == NULL) + if (m_sharedTemplate == nullptr) { WARNING_STRICT_FATAL(!sharedTemplateName.empty(), ("Template %s has an invalid shared template %s. We will use the default shared template for now.", newTemplate->getName(), sharedTemplateName.c_str())); } - if (getSharedTemplate() != NULL) + if (getSharedTemplate() != nullptr) { m_nameStringId = getSharedTemplate()->getObjectName(); m_descriptionStringId = getSharedTemplate()->getDetailedDescription(); @@ -779,7 +779,7 @@ m_loadCTSPackedHouses(false) m_scriptObject->setOwner(this); - ContainedByProperty *containedBy = new ContainedByProperty(*this, NULL); + ContainedByProperty *containedBy = new ContainedByProperty(*this, nullptr); addProperty(*containedBy); //-- create the SlottedContainment property @@ -787,7 +787,7 @@ m_loadCTSPackedHouses(false) addProperty(*slottedProperty); //-- get ArrangementDescriptor if specified - if (getSharedTemplate() != NULL) + if (getSharedTemplate() != nullptr) { const ArrangementDescriptor *const arrangementDescriptor = getSharedTemplate()->getArrangementDescriptor(); if (arrangementDescriptor) @@ -801,7 +801,7 @@ m_loadCTSPackedHouses(false) } //set up containers on this object if it has any - if (getSharedTemplate() != NULL) + if (getSharedTemplate() != nullptr) { SharedObjectTemplate::ContainerType const containerType = getSharedTemplate()->getContainerType(); @@ -883,7 +883,7 @@ m_loadCTSPackedHouses(false) // add the portal property if one is requested - if (getSharedTemplate() != NULL) + if (getSharedTemplate() != nullptr) { const std::string &portalLayoutFileName = getSharedTemplate()->getPortalLayoutFilename(); if (!portalLayoutFileName.empty()) @@ -952,10 +952,10 @@ ServerObject::~ServerObject() destroyTriggerVolumes(); } - if (m_sharedTemplate != NULL) + if (m_sharedTemplate != nullptr) { m_sharedTemplate->releaseReference(); - m_sharedTemplate = NULL; + m_sharedTemplate = nullptr; } if (getClient()) @@ -982,7 +982,7 @@ ServerObject::~ServerObject() PROFILER_AUTO_BLOCK_DEFINE("ServerObject::~ServerObject delete script object"); delete m_scriptObject; } - m_scriptObject = NULL; + m_scriptObject = nullptr; gs_objectCount--; @@ -1038,14 +1038,14 @@ ServerObject * ServerObject::getServerObject(NetworkId const & networkId) ServerObject * ServerObject::asServerObject(Object * const object) { - return (object != NULL) ? object->asServerObject() : NULL; + return (object != nullptr) ? object->asServerObject() : nullptr; } //----------------------------------------------------------------------- ServerObject const * ServerObject::asServerObject(Object const * const object) { - return (object != NULL) ? object->asServerObject() : NULL; + return (object != nullptr) ? object->asServerObject() : nullptr; } //----------------------------------------------------------------------- @@ -1255,12 +1255,12 @@ const SharedObjectTemplate * ServerObject::getDefaultSharedTemplate(void) const { static const ConstCharCrcLowerString templateName("object/object/base/shared_object_default.iff"); - if (m_defaultSharedTemplate == NULL) + if (m_defaultSharedTemplate == nullptr) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != NULL) + WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create default shared object template %s", templateName.getString())); + if (m_defaultSharedTemplate != nullptr) ExitChain::add (removeDefaultTemplate, "ServerObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -1280,10 +1280,10 @@ const unsigned long ServerObject::getObjectCount() */ void ServerObject::removeDefaultTemplate(void) { - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } // ServerObject::removeDefaultTemplate @@ -1570,7 +1570,7 @@ bool ServerObject::isInBazaarOrVendor() const { bool inBazaarOrVendor = false; const ServerObject *parent = safe_cast(ContainerInterface::getFirstParentInWorld(*this)); - const ServerObject *grandParent = NULL; + const ServerObject *grandParent = nullptr; if( parent ) { grandParent = safe_cast(ContainerInterface::getFirstParentInWorld(*parent)); @@ -1821,7 +1821,7 @@ void ServerObject::addTriggerVolume(TriggerVolume * t) { if (!t) { - WARNING_STRICT_FATAL(true, ("Cannot add null volume")); + WARNING_STRICT_FATAL(true, ("Cannot add nullptr volume")); return; } m_triggerVolumes.insert(std::make_pair(t->getName(), t)); @@ -1917,7 +1917,7 @@ void ServerObject::serverObjectEndBaselines(bool fromDatabase) onLoadedFromDatabase(); updateWorldSphere(); - if (getScriptObject() != NULL) + if (getScriptObject() != nullptr) { endBaselinesInitializeScript(*this, true); // If the object was created authoritative, trigger if needed @@ -2059,7 +2059,7 @@ void ServerObject::endBaselines() // and that buildout id got changed to some other object, like a rock if (isPlayerControlled() && isAuthoritative() && (immediateContainer->getNetworkId().getValue() < static_cast(0))) { - if (immediateContainer->asCellObject() != NULL || ContainerInterface::getCell(*immediateContainer) != NULL) + if (immediateContainer->asCellObject() != nullptr || ContainerInterface::getCell(*immediateContainer) != nullptr) ObserveTracker::onObjectContainerChanged(*this); else { @@ -2149,7 +2149,7 @@ bool ServerObject::handlePlayerInInteriorSetup(ContainedByProperty *containedBy) containedBy->setContainedBy(NetworkId::cms_invalid); fixOk = portal->fixupObject(*this, saveTransform); - containerHandleUpdateProxies(NULL, safe_cast(ContainerInterface::getContainedByObject(*this))); + containerHandleUpdateProxies(nullptr, safe_cast(ContainerInterface::getContainedByObject(*this))); if (building) building->gainedPlayer(*this); @@ -2306,8 +2306,8 @@ const int ServerObject::getCacheVersion() const const char * ServerObject::getSharedTemplateName() const { - if (getSharedTemplate() == NULL) - return NULL; + if (getSharedTemplate() == nullptr) + return nullptr; return getSharedTemplate()->ObjectTemplate::getName(); } @@ -2535,7 +2535,7 @@ bool ServerObject::serverObjectInitializeFirstTimeObject(ServerObject *cell, Tra if (cell) { Container::ContainerErrorCode tmp = Container::CEC_Success; - if (!ContainerInterface::transferItemToCell(*cell, *this, transform, NULL, tmp)) + if (!ContainerInterface::transferItemToCell(*cell, *this, transform, nullptr, tmp)) { WARNING(true, ("ServerWorld::createNewObjectIntermediate tried to create a new object in a cell, but it failed.")); return false; @@ -2587,7 +2587,7 @@ void ServerObject::initializeFirstTimeObject() //Don't move this declaration of contents out of the loop or you will leak a ref. ServerObjectTemplate::Contents contents; newTemplate->getContents(contents, i); - if (contents.content == NULL) + if (contents.content == nullptr) { DEBUG_WARNING(true, ("No template for contents item %d", i)); continue; @@ -2600,7 +2600,7 @@ void ServerObject::initializeFirstTimeObject() { //We'll persist the contents automatically if the parent object is persisted. ServerObject * newObject = ServerWorld::createNewObject(*(safe_cast(contents.content)), *this,slotId, false); - if (newObject == NULL) + if (newObject == nullptr) { DEBUG_WARNING(true, ("Can't create object from template %s",contents.content->getName())); } @@ -2615,7 +2615,7 @@ void ServerObject::initializeFirstTimeObject() // get the object (which we assume is a volume container) in the // desired slot SlottedContainer * const container = ContainerInterface::getSlottedContainer(*this); - if (container != NULL) + if (container != nullptr) { Container::ContainerErrorCode tmp = Container::CEC_Success; CachedNetworkId equippedObjectId = container->getObjectInSlot(SlotIdManager::findSlotId(CrcLowerString(contents.slotName.c_str())), tmp); @@ -2623,12 +2623,12 @@ void ServerObject::initializeFirstTimeObject() { // put the contents in the volume container ServerObject * equippedObject = safe_cast(equippedObjectId.getObject()); - if (equippedObject != NULL) + if (equippedObject != nullptr) { //We'll persist the contents automatically if the parent object is persisted. ServerObject * newObject = ServerWorld::createNewObject(*(safe_cast(contents.content)), *equippedObject,false); - if (newObject == NULL) + if (newObject == nullptr) { DEBUG_WARNING(true, ("Can't create object from template %s", contents.content->getName())); } @@ -2714,7 +2714,7 @@ void ServerObject::addToWorld() Object::addToWorld(); updateTriggerVolumes(); - if (getScriptObject() != NULL) + if (getScriptObject() != nullptr) getScriptObject()->setOwnerIsLoaded(); onAddedToWorld(); @@ -3012,8 +3012,8 @@ void ServerObject::onContainerTransferComplete(ServerObject *oldContainer, Serve void ServerObject::containerDepersistContents(ServerObject * oldParent, ServerObject * newParent) { - Container * const oldContainer = oldParent ? ContainerInterface::getContainer(*oldParent) : NULL; - Container * const newContainer = newParent ? ContainerInterface::getContainer(*newParent) : NULL; + Container * const oldContainer = oldParent ? ContainerInterface::getContainer(*oldParent) : nullptr; + Container * const newContainer = newParent ? ContainerInterface::getContainer(*newParent) : nullptr; if (oldContainer) oldContainer->internalItemRemoved(*this); @@ -3410,7 +3410,7 @@ void ServerObject::sendToClientsInUpdateRange(const GameNetworkMessage & message ServerObject * const obj = c->getCharacterObject(); - if (obj != NULL) + if (obj != nullptr) { if ( (ConfigServerGame::getSkipUnreliableTransformsForOtherCells() && obj->getAttachedTo() != getAttachedTo()) || (obj->getPosition_w().magnitudeBetweenSquared(getPosition_w()) > minDistanceSquared) @@ -3447,7 +3447,7 @@ void ServerObject::sendToSpecifiedClients(const GameNetworkMessage & message, bo for (std::vector::const_iterator i = clients.begin(); i != clients.end(); ++i) { ServerObject * o = safe_cast(NetworkIdManager::getObjectById(*i)); - if (o != NULL && o->getClient() != NULL) + if (o != nullptr && o->getClient() != nullptr) o->getClient()->send(message, reliable); } } @@ -3685,8 +3685,8 @@ void ServerObject::setParentCell(CellProperty * newCell) CellProperty * oldCell = getParentCell(); - if(oldCell == NULL) oldCell = CellProperty::getWorldCellProperty(); - if(newCell == NULL) newCell = CellProperty::getWorldCellProperty(); + if(oldCell == nullptr) oldCell = CellProperty::getWorldCellProperty(); + if(newCell == nullptr) newCell = CellProperty::getWorldCellProperty(); // ---------- @@ -3707,7 +3707,7 @@ void ServerObject::setParentCell(CellProperty * newCell) newTransform.multiply(oldCellTransform,oldTransform); Container::ContainerErrorCode tmp = Container::CEC_Success; - result = ContainerInterface::transferItemToWorld(*this, newTransform, NULL, tmp); + result = ContainerInterface::transferItemToWorld(*this, newTransform, nullptr, tmp); DEBUG_REPORT_LOG(!result, ("Object %s (id=%s) transfer to world was denied via ContainerInterface::transferItemToWorld()\n", getObjectTemplateName(), getNetworkId().getValueString().c_str())); } @@ -3720,7 +3720,7 @@ void ServerObject::setParentCell(CellProperty * newCell) ServerObject * newCellServerObject = safe_cast(newCellObject); Container::ContainerErrorCode tmp = Container::CEC_Success; - result = ContainerInterface::transferItemToCell(*newCellServerObject, *this, NULL, tmp); + result = ContainerInterface::transferItemToCell(*newCellServerObject, *this, nullptr, tmp); DEBUG_REPORT_LOG(!result, ("Object %s (id=%s) transfer to cell (id=%s) was denied via ContainerInterface::transferItemToCell()\n", getObjectTemplateName(), getNetworkId().getValueString().c_str(), newCellObject->getNetworkId().getValueString().c_str())); } @@ -4024,11 +4024,11 @@ void ServerObject::hearText(ServerObject const &source, MessageQueueSpatialChat CreatureObject * const creatureObject = asCreatureObject(); - if (creatureObject != NULL) + if (creatureObject != nullptr) { PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(creatureObject); - if (playerObject != NULL) + if (playerObject != nullptr) { ChatAvatarId playerChatAvatarId(Chat::constructChatAvatarId(source)); Unicode::String playerName(Unicode::narrowToWide(playerChatAvatarId.getFullName())); @@ -4104,7 +4104,7 @@ void ServerObject::performSocial (const MessageQueueSocial & socialMsg) // allow scripts to prevent the player from performing the emote ScriptParams params; - if (getScriptObject() != NULL) + if (getScriptObject() != nullptr) { params.addParam(unicodeSocialTypeName); if (getScriptObject()->trigAllScripts(Scripting::TRIG_PERFORM_EMOTE, params) != SCRIPT_CONTINUE) @@ -4159,7 +4159,7 @@ void ServerObject::performCombatSpam (const MessageQueueCombatSpam & spamMsg, bo target->seeCombatSpam (spamMsg); } } else { - WARNING_STRICT_FATAL (!sendToSelf && !sendToBystanders, ("null target_obj in commandFuncCombatSpam, when sendToTarget was set true")); + WARNING_STRICT_FATAL (!sendToSelf && !sendToBystanders, ("nullptr target_obj in commandFuncCombatSpam, when sendToTarget was set true")); } } @@ -4217,10 +4217,10 @@ void ServerObject::teleportObject(Vector const &position_w, NetworkId const &tar { PortalProperty *portalProp = targetContainerObject->getPortalProperty(); targetContainerObject = 0; // clear in case we have a building that doesn't have the cell - if (portalProp != NULL) + if (portalProp != nullptr) { CellProperty *cellProp = portalProp->getCell(targetCellName.c_str()); - if (cellProp != NULL) + if (cellProp != nullptr) targetContainerObject = safe_cast(&(cellProp->getOwner())); } if (!targetContainerObject) @@ -4312,7 +4312,7 @@ void ServerObject::teleportObject(Vector const &position_w, NetworkId const &tar // Moves the object. If the new area is on a different server, the PlanetServer will change our authority. // What we really want to check here is whether we want to use the ServerController's teleport - // if a player has logged out, but we still have them loaded in game, their client will be null, + // if a player has logged out, but we still have them loaded in game, their client will be nullptr, // but we still want to use the ServerController's teleport method // so, we check against the player creature controller and player ship controller as well ServerController * controller = safe_cast(getController()); @@ -4383,7 +4383,7 @@ void ServerObject::updatePlanetServerInternal(bool) const /** * Attempts to create a synchronized ui object. If the synchronized ui object * does not exist, its creation is attempted via createSynchronizedUi. The default implementation -* of createSynchronizedUi returns null, and renders this method a no-op. +* of createSynchronizedUi returns nullptr, and renders this method a no-op. */ void ServerObject::addSynchronizedUi(const std::vector & clients) { @@ -4396,9 +4396,9 @@ void ServerObject::addSynchronizedUi(const std::vector & clients) { ServerObject * client = safe_cast( NetworkIdManager::getObjectById(*i)); - if (client != NULL) + if (client != nullptr) { - if (client->getClient() != NULL) + if (client->getClient() != nullptr) m_synchronizedUi->addClientObject (*client); else { @@ -4420,7 +4420,7 @@ void ServerObject::addSynchronizedUi(const std::vector & clients) /** * Attempts to add a client to the synchronized ui object. If the synchronized ui object * does not exist, its creation is attempted via createSynchronizedUi. The default implementation -* of createSynchronizedUi returns null, and renders this method a no-op. +* of createSynchronizedUi returns nullptr, and renders this method a no-op. * */ void ServerObject::addSynchronizedUiClient(ServerObject & client) @@ -4466,7 +4466,7 @@ void ServerObject::removeSynchronizedUiClient(const NetworkId & clientId) /** * Subclasses implement this if they have an appropriate synchronized ui object. -* Base class implementation returns null. +* Base class implementation returns nullptr. */ ServerSynchronizedUi * ServerObject::createSynchronizedUi () { @@ -4483,13 +4483,13 @@ ServerSynchronizedUi * ServerObject::createSynchronizedUi () */ void ServerObject::addPendingSynchronizedUi(const ServerObject & uiObject) { - if (getClient() != NULL) + if (getClient() != nullptr) { WARNING(true, ("ServerObject::addPendingSynchronizedUi called on object %s that already has a client", getNetworkId().getValueString().c_str())); return; } - if (m_pendingSyncUi == NULL) + if (m_pendingSyncUi == nullptr) m_pendingSyncUi = new std::vector; m_pendingSyncUi->push_back(uiObject.getNetworkId()); } @@ -5057,7 +5057,7 @@ std::string ServerObject::debugGetMessageToList() const { unsigned long const now = ServerClock::getInstance().getGameTimeSeconds(); std::string result; - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); for (Archive::AutoDeltaMap, MessageToId>, MessageToPayload>::const_iterator i=m_messageTos.begin(); i!=m_messageTos.end(); ++i) { char temp[256]; @@ -5126,7 +5126,7 @@ unsigned long ServerObject::processQueuedMessageTos(unsigned long effectiveMessa // if the message is going to be recurring, create a // new messageTo to reschedule the recurring message - MessageToPayload * copyOfRecurringMessage = NULL; + MessageToPayload * copyOfRecurringMessage = nullptr; if (message->second.getRecurringTime() > 0) { copyOfRecurringMessage = new MessageToPayload( @@ -5331,7 +5331,7 @@ void ServerObject::handleCMessageTo(const MessageToPayload &message) { //handle unstick static MessageDispatch::Emitter e; - Chat::sendSystemMessageSimple(*this, SharedStringIds::unstick_request_complete, NULL); + Chat::sendSystemMessageSimple(*this, SharedStringIds::unstick_request_complete, nullptr); RequestUnstick r; r.setClientId(getNetworkId()); e.emitMessage(r); @@ -5587,7 +5587,7 @@ bool ServerObject::handleTeleportFixup(bool force) } else if (destContainer != NetworkId::cms_invalid && !force) { - LOG("TeleportFixup", ("Failing teleport fixup because object %s is in a null dest container and force was passed in\n", getNetworkId().getValueString().c_str())); + LOG("TeleportFixup", ("Failing teleport fixup because object %s is in a nullptr dest container and force was passed in\n", getNetworkId().getValueString().c_str())); return false; // going to a container and it wasn't loaded, defer } } @@ -5626,15 +5626,15 @@ void ServerObject::customize(const std::string & customName, int value) if(isAuthoritative()) { CustomizationDataProperty *const cdProperty = safe_cast(getProperty(CustomizationDataProperty::getClassPropertyId())); - if (cdProperty != NULL) + if (cdProperty != nullptr) { CustomizationData *const customizationData = cdProperty->fetchCustomizationData(); - if (customizationData != NULL) + if (customizationData != nullptr) { RangedIntCustomizationVariable * variable = dynamic_cast< RangedIntCustomizationVariable*>(customizationData->findVariable( customName)); - if (variable != NULL) + if (variable != nullptr) variable->setValue(value); else { @@ -5646,7 +5646,7 @@ void ServerObject::customize(const std::string & customName, int value) else { // this shouldn't happen - DEBUG_WARNING(true, ("CustomizationDataProperty returned NULL CustomizationData on fetch.")); + DEBUG_WARNING(true, ("CustomizationDataProperty returned nullptr CustomizationData on fetch.")); } } else @@ -5725,7 +5725,7 @@ bool ServerObject::permanentlyDestroy(DeleteReasons::Enumerator reason) const bool houseDestroyedByScript = (reason == DeleteReasons::Script && buildingObject && buildingObject->isPlayerPlaced()); // tell scripts we want to destroy the object - if (getScriptObject() != NULL && !m_calledTriggerDestroy) + if (getScriptObject() != nullptr && !m_calledTriggerDestroy) { m_calledTriggerDestroy = true; ScriptParams params; @@ -5739,7 +5739,7 @@ bool ServerObject::permanentlyDestroy(DeleteReasons::Enumerator reason) } } - if (isAuthoritative() && (getScriptObject() != NULL) && !m_calledTriggerRemovingFromWorld) + if (isAuthoritative() && (getScriptObject() != nullptr) && !m_calledTriggerRemovingFromWorld) { ScriptParams params; m_calledTriggerRemovingFromWorld = true; @@ -6517,8 +6517,8 @@ void ServerObject::onAllContentsLoaded() if (isAuthoritative()) { - ServerObject *player = NULL; - if ((player = getServerObject(playerId)) != NULL) + ServerObject *player = nullptr; + if ((player = getServerObject(playerId)) != nullptr) { //Tell scripts we are loaded ScriptParams params; @@ -6588,7 +6588,7 @@ void ServerObject::handleDisconnect(bool immediate) { // client has disconnected, log pertinent information about the play session CreatureObject * const creatureObject = asCreatureObject(); - PlayerObject * playerObject = NULL; + PlayerObject * playerObject = nullptr; if (creatureObject) { playerObject = PlayerCreatureController::getPlayerObject(creatureObject); @@ -6927,13 +6927,13 @@ ServerObject * ServerObject::combineResourceContainers(ServerObject &item) { ResourceContainerObject *resourceContainerObject = safe_cast(&item); - if (resourceContainerObject != NULL) + if (resourceContainerObject != nullptr) { // If this is a container, see if it contains another resource container of the same type Container *container = ContainerInterface::getContainer(*this); - if (container != NULL) + if (container != nullptr) { ContainerIterator iterContainer = container->begin(); @@ -6945,12 +6945,12 @@ ServerObject * ServerObject::combineResourceContainers(ServerObject &item) // the item is a resource container if ((containedObject != &item) && - (containedObject != NULL) && + (containedObject != nullptr) && (containedObject->getObjectType() == ServerResourceContainerObjectTemplate::ServerResourceContainerObjectTemplate_tag)) { ResourceContainerObject *containedResourceContainerObject = safe_cast(containedObject); - if ((containedResourceContainerObject != NULL) && + if ((containedResourceContainerObject != nullptr) && (resourceContainerObject->getResourceType() == containedResourceContainerObject->getResourceType())) { // This is a container of similar type, if it is not full, save it to the list @@ -7064,7 +7064,7 @@ bool ServerObject::isContainedBy(const ServerObject & container, bool includeCon // our container is the desired container return true; } - else if (test != NULL && test != this && includeContents) + else if (test != nullptr && test != this && includeContents) { // our container isn't the desired container, see if it is contained return safe_cast(test)->isContainedBy(container, true); @@ -7564,7 +7564,7 @@ void ServerObject::sendDirtyObjectMenuNotification() Controller * const controller = getController(); if (controller) - controller->appendMessage(CM_objectMenuDirty, 0, NULL, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_ALL_CLIENT); + controller->appendMessage(CM_objectMenuDirty, 0, nullptr, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_ALL_CLIENT); } // ---------------------------------------------------------------------- @@ -7577,7 +7577,7 @@ void ServerObject::sendDirtyAttributesNotification() Controller * const controller = getController(); if (controller) - controller->appendMessage(CM_attributesDirty, 0, NULL, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_ALL_CLIENT); + controller->appendMessage(CM_attributesDirty, 0, nullptr, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_ALL_CLIENT); } //------------------------------------------------------------------------------------------ @@ -7615,15 +7615,15 @@ void ServerObject::triggerMadeAuthoritative() void ServerObject::setLayer(TerrainGenerator::Layer* layer) { - LayerProperty * layerProperty = NULL; + LayerProperty * layerProperty = nullptr; Property * property = getProperty(LayerProperty::getClassPropertyId()); - if (property != NULL) + if (property != nullptr) layerProperty = safe_cast(property); else layerProperty = new LayerProperty(*this); layerProperty->setLayer(layer); - if (property == NULL) + if (property == nullptr) { addProperty(*layerProperty, true); ObjectTracker::addRunTimeRule(); @@ -7636,12 +7636,12 @@ void ServerObject::setLayer(TerrainGenerator::Layer* layer) TerrainGenerator::Layer* ServerObject::getLayer() const { const Property * property = getProperty(LayerProperty::getClassPropertyId()); - if (property != NULL) + if (property != nullptr) { const LayerProperty * layerProperty = safe_cast(property); return layerProperty->getLayer(); } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------ @@ -7853,7 +7853,7 @@ void ServerObject::setPatrolPathRoot(const ServerObject & root) // make sure we aren't already a root node Property * p = getProperty(PatrolPathRootProperty::getClassPropertyId()); - if (p != NULL) + if (p != nullptr) { if (root.getNetworkId() != getNetworkId()) { @@ -7873,7 +7873,7 @@ void ServerObject::setPatrolPathRoot(const ServerObject & root) { // add the root node to our node list p = getProperty(PatrolPathNodeProperty::getClassPropertyId()); - if (p == NULL) + if (p == nullptr) { p = new PatrolPathNodeProperty(*this); addProperty(*p, true); @@ -7893,15 +7893,15 @@ void ServerObject::setPatrolPathRoot(const ServerObject & root) // we need to add any players in range to our path observer count TriggerVolume * triggerVolume = getNetworkTriggerVolume(); - if (triggerVolume != NULL) + if (triggerVolume != nullptr) { TriggerVolume::ContentsSet const & contents = triggerVolume->getContents(); for (TriggerVolume::ContentsSet::const_iterator i = contents.begin(); i != contents.end(); ++i) { - if (*i != NULL) + if (*i != nullptr) { Client * client = (*i)->getClient(); - if (client != NULL) + if (client != nullptr) { if (!ObserveTracker::isObserving(*client, *this)) ObserveTracker::onClientEnteredNetworkTriggerVolume(*client, *triggerVolume); @@ -7922,14 +7922,14 @@ void ServerObject::setPatrolPathRoot(const ServerObject & root) /** * Returns the root node for a patrol path node. * - * @return the root node, or NULL if this isn't a patrol path node + * @return the root node, or nullptr if this isn't a patrol path node */ const std::set & ServerObject::getPatrolPathRoots() const { static const std::set noRoots; const Property * p = getProperty(PatrolPathNodeProperty::getClassPropertyId()); - if (p != NULL) + if (p != nullptr) { return safe_cast(p)->getRoots(); } @@ -7957,7 +7957,7 @@ void ServerObject::addPatrolPathingObject(const ServerObject & ai) } Property * p = getProperty(PatrolPathRootProperty::getClassPropertyId()); - if (p != NULL) + if (p != nullptr) { safe_cast(p)->addPatrollingObject(ai); DEBUG_REPORT_LOG(true, ("[patrolpath] add patrol ai %s to root %s\n", @@ -7974,7 +7974,7 @@ void ServerObject::addPatrolPathingObject(const ServerObject & ai) if (roots.size() == 1) { ServerObject * root = safe_cast(roots.begin()->getObject()); - if (root != NULL) + if (root != nullptr) root->addPatrolPathingObject(ai); } else @@ -8004,7 +8004,7 @@ void ServerObject::removePatrolPathingObject(const ServerObject & ai) } Property * p = getProperty(PatrolPathRootProperty::getClassPropertyId()); - if (p != NULL) + if (p != nullptr) { safe_cast(p)->removePatrollingObject(ai); DEBUG_REPORT_LOG(true, ("[patrolpath] remove patrol ai %s from root %s\n", @@ -8019,7 +8019,7 @@ void ServerObject::removePatrolPathingObject(const ServerObject & ai) if (roots.size() == 1) { ServerObject * root = safe_cast(roots.begin()->getObject()); - if (root != NULL) + if (root != nullptr) root->removePatrolPathingObject(ai); } else @@ -8049,7 +8049,7 @@ void ServerObject::addPatrolPathObserver() // if we are a root node, increment our observer count Property * p = getProperty(PatrolPathRootProperty::getClassPropertyId()); - if (p != NULL) + if (p != nullptr) { PatrolPathRootProperty * pprp = safe_cast(p); pprp->incrementObserverCount(); @@ -8061,10 +8061,10 @@ void ServerObject::addPatrolPathObserver() const std::set > & ai = pprp->getPatrollingObjects(); for (std::set >::const_iterator i = ai.begin(); i != ai.end(); ++i) { - if (*i != NULL) + if (*i != nullptr) { const ServerObject * ai = *i; - if (ai->getController()->asCreatureController() != NULL) + if (ai->getController()->asCreatureController() != nullptr) { const CreatureController * controller = ai->getController()->asCreatureController(); if (controller->getHibernate()) @@ -8086,7 +8086,7 @@ void ServerObject::addPatrolPathObserver() for (std::set::const_iterator i = roots.begin(); i != roots.end(); ++i) { ServerObject * root = safe_cast(i->getObject()); - if (root != NULL) + if (root != nullptr) { root->addPatrolPathObserver(); } @@ -8112,7 +8112,7 @@ void ServerObject::removePatrolPathObserver() // if we are a root node, decrement our observer count Property * p = getProperty(PatrolPathRootProperty::getClassPropertyId()); - if (p != NULL) + if (p != nullptr) { PatrolPathRootProperty * pprp = safe_cast(p); pprp->decrementObserverCount(); @@ -8131,7 +8131,7 @@ void ServerObject::removePatrolPathObserver() for (std::set::const_iterator i = roots.begin(); i != roots.end(); ++i) { ServerObject * root = safe_cast(i->getObject()); - if (root != NULL) + if (root != nullptr) { root->removePatrolPathObserver(); } @@ -8152,7 +8152,7 @@ int ServerObject::getPatrolPathObservers() const int observers = 0; const Property * p = getProperty(PatrolPathRootProperty::getClassPropertyId()); - if (p != NULL) + if (p != nullptr) { observers = safe_cast(p)->getObserverCount(); } @@ -8162,7 +8162,7 @@ int ServerObject::getPatrolPathObservers() const for (std::set::const_iterator i = roots.begin(); i != roots.end(); ++i) { const ServerObject * root = safe_cast(i->getObject()); - if (root != NULL && root->isPatrolPathRoot()) + if (root != nullptr && root->isPatrolPathRoot()) { observers += root->getPatrolPathObservers(); } @@ -8175,14 +8175,14 @@ int ServerObject::getPatrolPathObservers() const bool ServerObject::isPatrolPathNode() const { - return (getProperty(PatrolPathNodeProperty::getClassPropertyId()) != NULL) || isPatrolPathRoot(); + return (getProperty(PatrolPathNodeProperty::getClassPropertyId()) != nullptr) || isPatrolPathRoot(); } // ---------------------------------------------------------------------- bool ServerObject::isPatrolPathRoot() const { - return getProperty(PatrolPathRootProperty::getClassPropertyId()) != NULL; + return getProperty(PatrolPathRootProperty::getClassPropertyId()) != nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/object/ServerObject.h b/engine/server/library/serverGame/src/shared/object/ServerObject.h index 32192ce3..5cdaed82 100755 --- a/engine/server/library/serverGame/src/shared/object/ServerObject.h +++ b/engine/server/library/serverGame/src/shared/object/ServerObject.h @@ -317,7 +317,7 @@ public: // Can this object manipulate other objects. CreatureObject overrides. Base class returns false. // generally an object is allowed to manipulate another object if it is container or "nearby". public: - virtual bool canManipulateObject(ServerObject const &target, bool movingObject, bool checkPermission, bool checkPermissionOnParent, float maxDistance, Container::ContainerErrorCode&, bool skipNoTradeCheck = false, bool * allowedByGodMode = NULL) const; + virtual bool canManipulateObject(ServerObject const &target, bool movingObject, bool checkPermission, bool checkPermissionOnParent, float maxDistance, Container::ContainerErrorCode&, bool skipNoTradeCheck = false, bool * allowedByGodMode = nullptr) const; //----------------------------------------------------------------------- // container support @@ -738,7 +738,7 @@ private: static float ms_buildingUpdateRadiusMultiplier; static void setBuildingUpdateRadiusMultiplier(float m); - /** If this object is being controlled by a client, this pointer will be set. NULL otherwise + /** If this object is being controlled by a client, this pointer will be set. nullptr otherwise */ Client * m_client; std::set m_observers; @@ -871,7 +871,7 @@ inline Client * ServerObject::getClient(void) const inline const SharedObjectTemplate * ServerObject::getSharedTemplate() const { - if (m_sharedTemplate != NULL) + if (m_sharedTemplate != nullptr) return m_sharedTemplate; return getDefaultSharedTemplate(); } @@ -936,7 +936,7 @@ inline ServerObject::TriggerVolumeMap & ServerObject::getTriggerVolumeMap() inline const std::set * ServerObject::getTriggerVolumeEntered() const { - return NULL; + return nullptr; } //----------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/object/ServerObject_AuthTransfer.cpp b/engine/server/library/serverGame/src/shared/object/ServerObject_AuthTransfer.cpp index 65655198..b7075ece 100755 --- a/engine/server/library/serverGame/src/shared/object/ServerObject_AuthTransfer.cpp +++ b/engine/server/library/serverGame/src/shared/object/ServerObject_AuthTransfer.cpp @@ -162,7 +162,7 @@ void ServerObject::transferAuthoritySceneChange(uint32 pid) client->getIpAddress(), client->isSecure(), client->getStationId(), - NULL, + nullptr, client->getGameFeatures(), client->getSubscriptionFeatures(), client->getAccountFeatureIds(), @@ -265,7 +265,7 @@ void ServerObject::transferAuthorityNoSceneChange(uint32 pid, bool skipLoadScree client->getIpAddress(), client->isSecure(), client->getStationId(), - (observeListIds.empty() ? NULL : &observeListIds), + (observeListIds.empty() ? nullptr : &observeListIds), client->getGameFeatures(), client->getSubscriptionFeatures(), client->getAccountFeatureIds(), diff --git a/engine/server/library/serverGame/src/shared/object/ServerResourceClassObject.cpp b/engine/server/library/serverGame/src/shared/object/ServerResourceClassObject.cpp index 5bb2df2f..49c6bd09 100755 --- a/engine/server/library/serverGame/src/shared/object/ServerResourceClassObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/ServerResourceClassObject.cpp @@ -577,7 +577,7 @@ ResourceTypeObject const * ServerResourceClassObject::getAResourceType() const if (!m_types.empty()) return m_types.front(); else - return NULL; + return nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/object/ShipObject.cpp b/engine/server/library/serverGame/src/shared/object/ShipObject.cpp index badd8030..2408018b 100755 --- a/engine/server/library/serverGame/src/shared/object/ShipObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/ShipObject.cpp @@ -110,9 +110,9 @@ namespace ShipObjectNamespace typedef std::map ShipTypeShipDataMap; ShipTypeShipDataMap ms_shipTypeShipDataMap; - ShipData const * ms_defaultShipData = NULL; + ShipData const * ms_defaultShipData = nullptr; - ShipComponentDataEngine * ms_defaultEngine = NULL; + ShipComponentDataEngine * ms_defaultEngine = nullptr; unsigned int s_lastShipId = 0; unsigned int const s_maxShipId = 4096; @@ -180,7 +180,7 @@ void ShipObject::install() DataTableManager::addReloadCallback(cs_shipTypeFileName, loadShipTypeDataTable); ShipComponentDescriptor const * const genericEngineDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByName(ConstCharCrcString("eng_generic")); - FATAL(genericEngineDescriptor == NULL, ("ShipObject genericEngineDescriptor [eng_generic] not found")); + FATAL(genericEngineDescriptor == nullptr, ("ShipObject genericEngineDescriptor [eng_generic] not found")); ms_defaultEngine = new ShipComponentDataEngine(*genericEngineDescriptor); // mark shipId 0 as used @@ -243,10 +243,10 @@ ShipObject * ShipObject::getContainingShipObject(ServerObject * serverObject) void ShipObjectNamespace::remove() { - ms_defaultShipData = NULL; + ms_defaultShipData = nullptr; delete ms_defaultEngine; - ms_defaultEngine = NULL; + ms_defaultEngine = nullptr; //-- Delete the ship type to ship data map std::for_each(ms_shipTypeShipDataMap.begin(), ms_shipTypeShipDataMap.end(), PointerDeleterPairSecond()); @@ -270,7 +270,7 @@ ShipObject::ShipObject(ServerShipObjectTemplate const *newTemplate) : m_currentRoll(0.f), m_currentChassisHitPoints(0.f), m_maximumChassisHitPoints(0.f), - m_weaponRefireTimers(NULL), + m_weaponRefireTimers(nullptr), m_numberOfHits(0), m_chassisType (0), m_chassisComponentMassMaximum(0.0f), @@ -406,19 +406,19 @@ ShipObject::~ShipObject() nullWatchers(); delete m_boosterAvailableTimer; - m_boosterAvailableTimer = NULL; + m_boosterAvailableTimer = nullptr; if (getLocalFlag(LocalObjectFlags::ShipObject_ShipIdAssigned)) freeShipId(m_shipId.get()); delete m_fireShotQueue; - m_fireShotQueue = NULL; + m_fireShotQueue = nullptr; delete[] m_weaponRefireTimers; - m_weaponRefireTimers = NULL; + m_weaponRefireTimers = nullptr; delete m_nebulas; - m_nebulas = NULL; + m_nebulas = nullptr; delete m_autoAggroImmuneTimer; delete m_turretWeaponIndices; @@ -465,7 +465,7 @@ void ShipObject::endBaselines() NetworkId const & resourceTypeId = (*it).first; ResourceTypeObject const * const resourceTypeObject = ServerUniverse::getInstance().getResourceTypeById(resourceTypeId); - if (NULL == ServerUniverse::getInstance().getResourceTypeById(resourceTypeId)) + if (nullptr == ServerUniverse::getInstance().getResourceTypeById(resourceTypeId)) { WARNING(true, ("ShipObject::endBaselines invalid resource type [%s]", resourceTypeId.getValueString().c_str())); continue; @@ -946,7 +946,7 @@ Controller *ShipObject::createDefaultController() /** * Get the ship's pilot, if any. * - * @return the pilot if there is one, otherwise NULL + * @return the pilot if there is one, otherwise nullptr */ CreatureObject *ShipObject::getPilot() { @@ -1180,7 +1180,7 @@ void ShipObject::internalHandleFireShot(Client const *gunnerClient, int const we { if (!gunnerCreature) { - WARNING(true, ("ShipObject::internalHandleFireShot cannot fire missile with a null gunner")); + WARNING(true, ("ShipObject::internalHandleFireShot cannot fire missile with a nullptr gunner")); return; } @@ -1284,14 +1284,14 @@ void ShipObject::fireShotTurretServer(int const weaponIndex, NetworkId const & t Object const * const targetObject = NetworkIdManager::getObjectById(targetId); - if (targetObject == NULL) + if (targetObject == nullptr) { WARNING(true, ("ERROR: The targetId(%s) could not be resolved to an Object. A turret shot will NOT be fired.", targetId.getValueString().c_str())); return; } ServerObject const * const targetServerObject = targetObject->asServerObject(); - ShipObject const * const targetShipObject = (targetServerObject != NULL) ? targetServerObject->asShipObject() : NULL; + ShipObject const * const targetShipObject = (targetServerObject != nullptr) ? targetServerObject->asShipObject() : nullptr; if ( !targetShipObject && goodShot) @@ -1299,7 +1299,7 @@ void ShipObject::fireShotTurretServer(int const weaponIndex, NetworkId const & t WARNING(true, ("ERROR: The targetId(%s) could not be resolved to a ShipObject. Perfect shot requested, but there is no way to lead with a perfect shot.", targetId.getValueString().c_str())); } - if ( (targetShipObject != NULL) + if ( (targetShipObject != nullptr) && goodShot) { // If its a good shot, lead perfectly @@ -1335,8 +1335,8 @@ void ShipObject::fireShotTurretServer(int const weaponIndex, NetworkId const & t ShipController const * const ownerShipController = getController()->asShipController(); DEBUG_WARNING(!ownerShipController, ("ERROR: Controller could not be resolved to a ShipController(%s)", getDebugInformation().c_str())); - float const missHalfAngle = (ownerShipController != NULL) ? (ownerShipController->getTurretMissAngle() / 2.0f) : 0.0f; - float const targetRadius = (targetServerObject != NULL) ? targetServerObject->getRadius() : 0.0f; + float const missHalfAngle = (ownerShipController != nullptr) ? (ownerShipController->getTurretMissAngle() / 2.0f) : 0.0f; + float const targetRadius = (targetServerObject != nullptr) ? targetServerObject->getRadius() : 0.0f; Transform transform; transform.roll_l(Random::randomReal() * PI_TIMES_2); @@ -1442,13 +1442,13 @@ void ShipObject::constructFromTemplate() //-- setup ship chassis ShipChassis const * shipChassis = ShipChassis::findShipChassisByName (TemporaryCrcString (shipType.c_str (), true)); - if (shipChassis == NULL) + if (shipChassis == nullptr) { WARNING (true, ("ShipObject::constructFromTemplate failed to find a valid ship chassis for [%s], trying generic", shipType.c_str ())); shipChassis = ShipChassis::findShipChassisByName (TemporaryCrcString ("generic", true)); } - if (shipChassis != NULL) + if (shipChassis != nullptr) m_chassisType = shipChassis->getCrc (); else { @@ -1456,7 +1456,7 @@ void ShipObject::constructFromTemplate() } //set initial slot targetability from the chassis setttings. Code or script can change these at runtime - if(shipChassis != NULL) + if(shipChassis != nullptr) { for (int slot = 0; slot < static_cast(ShipChassisSlotType::SCST_num_types); ++slot) { @@ -1473,7 +1473,7 @@ void ShipObject::constructFromTemplate() { ShipComponentData * const shipComponentData = shipData->m_components[i]; - if (shipComponentData != NULL) + if (shipComponentData != nullptr) { if (!installComponentFromData(i, *shipComponentData)) { std::string chassis = shipChassis->getName().getString(); @@ -1732,7 +1732,7 @@ ShipComponentDataEngine const & ShipObject::getShipDataEngine() const ShipComponentDataEngine const * const engine = safe_cast(shipData->m_components[static_cast(ShipChassisSlotType::SCST_engine)]); - if (engine == NULL) + if (engine == nullptr) return *ms_defaultEngine; return *engine; @@ -1761,9 +1761,9 @@ void ShipObject::handleGunnerChange(ServerObject const &player) } ShipController * const shipController = getController()->asShipController(); - PlayerShipController * const playerShipController = (shipController != NULL) ? shipController->asPlayerShipController() : NULL; + PlayerShipController * const playerShipController = (shipController != nullptr) ? shipController->asPlayerShipController() : nullptr; - if (playerShipController != NULL) + if (playerShipController != nullptr) { playerShipController->updateGunnerWeaponIndex(player.getNetworkId(), gunnerWeaponIndex); } @@ -2152,7 +2152,7 @@ void ShipObjectNamespace::loadShipTypeDataTable(DataTable const &dataTable) //-- find components for (int i = 0; i < static_cast(ShipChassisSlotType::SCST_num_types); ++i) { - shipData->m_components [i] = NULL; + shipData->m_components [i] = nullptr; std::string const & slotName = ShipChassisSlotType::getNameFromType (static_cast(i)); if (!dataTable.doesColumnExist (slotName)) continue; @@ -2164,14 +2164,14 @@ void ShipObjectNamespace::loadShipTypeDataTable(DataTable const &dataTable) uint32 const componentCrc = Crc::normalizeAndCalculate (componentName.c_str ()); ShipComponentDescriptor const * const shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByCrc (componentCrc); - if (shipComponentDescriptor == NULL) + if (shipComponentDescriptor == nullptr) WARNING (true, ("ShipObject ship type [%s] specified invalid [%s] component [%s]", name.c_str (), slotName.c_str (), componentName.c_str ())); else shipData->m_components[i] = ShipComponentDataManager::create(*shipComponentDescriptor); ShipComponentData * const shipComponentData = shipData->m_components[i]; - if (shipComponentData == NULL) + if (shipComponentData == nullptr) continue; //-- get common data @@ -2532,18 +2532,18 @@ void ShipObjectNamespace::freeShipId(uint16 shipId) ShipObject const * ShipObject::asShipObject(Object const * object) { - ServerObject const * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + ServerObject const * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - return (serverObject != NULL) ? serverObject->asShipObject() : NULL; + return (serverObject != nullptr) ? serverObject->asShipObject() : nullptr; } // ---------------------------------------------------------------------- ShipObject * ShipObject::asShipObject(Object * object) { - ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - return (serverObject != NULL) ? serverObject->asShipObject() : NULL; + return (serverObject != nullptr) ? serverObject->asShipObject() : nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/object/ShipObject_Components.cpp b/engine/server/library/serverGame/src/shared/object/ShipObject_Components.cpp index e6f4cb22..667c9ae7 100755 --- a/engine/server/library/serverGame/src/shared/object/ShipObject_Components.cpp +++ b/engine/server/library/serverGame/src/shared/object/ShipObject_Components.cpp @@ -1638,7 +1638,7 @@ bool ShipObject::canInstallComponent (int chassisSlot, TangibleObject const ShipChassisSlot const * const slot = shipChassis->getSlot (static_cast(effectiveCompatibilitySlot)); - if (slot != NULL) + if (slot != nullptr) { if (slot->canAcceptComponent (shipComponentData->getDescriptor ())) { @@ -1721,7 +1721,7 @@ bool ShipObject::installComponent (NetworkId const & installerId, int chassisS void ShipObject::purgeComponent (int chassisSlot) { - IGNORE_RETURN (internalUninstallComponent (NetworkId::cms_invalid, chassisSlot, NULL)); + IGNORE_RETURN (internalUninstallComponent (NetworkId::cms_invalid, chassisSlot, nullptr)); } //---------------------------------------------------------------------- @@ -1731,16 +1731,16 @@ TangibleObject * ShipObject::internalUninstallComponent (NetworkId const if (!isSlotInstalled (chassisSlot)) { WARNING (true, ("ShipObject::internalUninstallComponent failed... no component installed in slot")); - return NULL; + return nullptr; } ShipComponentData * const shipComponentData = createShipComponentData (chassisSlot); - if (shipComponentData == NULL) + if (shipComponentData == nullptr) { - WARNING (true, ("ShipObject::internalUninstallComponent failed null data")); + WARNING (true, ("ShipObject::internalUninstallComponent failed nullptr data")); delete shipComponentData; - return NULL; + return nullptr; } if(getScriptObject()) @@ -1751,7 +1751,7 @@ TangibleObject * ShipObject::internalUninstallComponent (NetworkId const p.addParam (containerTarget ? containerTarget->getNetworkId () : NetworkId::cms_invalid); if (getScriptObject()->trigAllScripts(Scripting::TRIG_SHIP_COMPONENT_UNINSTALLING, p) == SCRIPT_OVERRIDE) - return NULL; + return nullptr; } TangibleObject * tangible = 0; @@ -1765,7 +1765,7 @@ TangibleObject * ShipObject::internalUninstallComponent (NetworkId const { VolumeContainer * volContainer = ContainerInterface::getVolumeContainer(*containerTarget); - if (volContainer == NULL) + if (volContainer == nullptr) return 0; int oldCapacity = volContainer->debugDoNotUseSetCapacity(-1); @@ -1780,21 +1780,21 @@ TangibleObject * ShipObject::internalUninstallComponent (NetworkId const obj = safe_cast(ServerWorld::createNewObject (objectTemplateCrc, *containerTarget, true)); } - if (obj == NULL) + if (obj == nullptr) { WARNING (true, ("ShipObject::internalUninstallComponent failed for slot [%d] because ServerWorld could not create an object for [%d], or container is full", chassisSlot, objectTemplateCrc)); delete shipComponentData; - return NULL; + return nullptr; } tangible = obj->asTangibleObject (); - if (tangible == NULL) + if (tangible == nullptr) { WARNING (true, ("ShipObject::internalUninstallComponent failed for slot [%d] because object template [%d] is not tangible", chassisSlot, objectTemplateCrc)); delete shipComponentData; IGNORE_RETURN (obj->permanentlyDestroy (DeleteReasons::SetupFailed)); - return NULL; + return nullptr; } shipComponentData->writeDataToComponent (*tangible); @@ -1897,7 +1897,7 @@ TangibleObject * ShipObject::uninstallComponent (NetworkId const & uninstallerId bool ShipObject::installComponentFromData(int chassisSlot, ShipComponentData const & shipComponentData) { ShipChassis const * const shipChassis = ShipChassis::findShipChassisByCrc (getChassisType ()); - if (shipChassis == NULL) + if (shipChassis == nullptr) { DEBUG_WARNING (true, ("Ship [%s] chassis [%d] is invalid for installing component [%s]", getNetworkId().getValueString().c_str(), @@ -1922,7 +1922,7 @@ bool ShipObject::installComponentFromData(int chassisSlot, ShipComponentData con effectiveCompatibilitySlot = ShipChassisSlotType::SCST_weapon_first+((chassisSlot-ShipChassisSlotType::SCST_weapon_first)&7); ShipChassisSlot const * const slot = shipChassis->getSlot (static_cast(effectiveCompatibilitySlot)); - if (slot == NULL) + if (slot == nullptr) { DEBUG_WARNING (true, ("Ship [%s] chassis [%s] does not support slot [%s] for installing component [%s]", getNetworkId().getValueString().c_str(), @@ -1957,7 +1957,7 @@ bool ShipObject::installComponentFromData(int chassisSlot, ShipComponentData con bool ShipObject::pseudoInstallComponent(int chassisSlot, uint32 componentCrc) { ShipComponentDescriptor const * const shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByCrc (componentCrc); - if (shipComponentDescriptor == NULL) + if (shipComponentDescriptor == nullptr) { WARNING (true, ("Invalid component name")); return false; @@ -1965,7 +1965,7 @@ bool ShipObject::pseudoInstallComponent(int chassisSlot, uint32 componentCrc) ShipComponentData * const shipComponentData = ShipComponentDataManager::create (*shipComponentDescriptor); - if (shipComponentData == NULL) + if (shipComponentData == nullptr) { WARNING(true, ("ShipObject::pseudoInstallComponent invalid descriptor")); return false; @@ -1982,27 +1982,27 @@ bool ShipObject::pseudoInstallComponent(int chassisSlot, uint32 componentCrc) ShipComponentData * ShipObject::createShipComponentData (int chassisSlot) const { - ShipComponentDescriptor const * shipComponentDescriptor = NULL; + ShipComponentDescriptor const * shipComponentDescriptor = nullptr; uint32 const componentCrc = getComponentCrc (chassisSlot); if (componentCrc) { shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByCrc (componentCrc); - if (shipComponentDescriptor == NULL) + if (shipComponentDescriptor == nullptr) { WARNING (true, ("ShipObject::createShipComponentData failed for slot [%d] because component crc [%d] could not map to a component descriptor", chassisSlot, componentCrc)); - return NULL; + return nullptr; } } else - return NULL; + return nullptr; ShipComponentData * const shipComponentData = ShipComponentDataManager::create (*shipComponentDescriptor); - if (shipComponentData == NULL) + if (shipComponentData == nullptr) { WARNING (true, ("ShipObject::createShipComponentData failed for slot [%d] ship Component data could not be constructed", chassisSlot)); delete(shipComponentData); - return NULL; + return nullptr; } if (!shipComponentData->readDataFromShip (chassisSlot, *this)) @@ -2334,7 +2334,7 @@ float ShipObject::computeShipActualSpeedMaximum () const if (hasWings() && hasCondition(TangibleObject::C_wingsOpened)) { ShipChassis const * const shipChassis = ShipChassis::findShipChassisByCrc(getChassisType()); - if (NULL != shipChassis) + if (nullptr != shipChassis) { float const wingOpenSpeedFactor = shipChassis->getWingOpenSpeedFactor(); rate *= wingOpenSpeedFactor; @@ -2673,7 +2673,7 @@ void ShipObject::handlePowerPulse (float timeElapsedSecs) if (boosterEnergyCurrent <= 0.0f) { IGNORE_RETURN(setComponentActive(ShipChassisSlotType::SCST_booster, false)); - if (pilot != NULL) + if (pilot != nullptr) Chat::sendSystemMessage(*pilot, SharedStringIds::booster_energy_depleted, Unicode::emptyString); restartBoosterTimer(); @@ -3368,7 +3368,7 @@ void ShipObject::setCargoHoldContent(NetworkId const & resourceTypeId, int amoun else { ResourceTypeObject const * const resourceTypeObject = ServerUniverse::getInstance().getResourceTypeById(resourceTypeId); - if (NULL == ServerUniverse::getInstance().getResourceTypeById(resourceTypeId)) + if (nullptr == ServerUniverse::getInstance().getResourceTypeById(resourceTypeId)) { WARNING(true, ("ShipObject::setCargoHoldContent invalid resource type [%s]", resourceTypeId.getValueString().c_str())); return; diff --git a/engine/server/library/serverGame/src/shared/object/StaticObject.cpp b/engine/server/library/serverGame/src/shared/object/StaticObject.cpp index 8a9dfc3f..35366239 100755 --- a/engine/server/library/serverGame/src/shared/object/StaticObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/StaticObject.cpp @@ -21,7 +21,7 @@ #include "sharedObject/AppearanceTemplateList.h" #include "sharedObject/ObjectTemplateList.h" -const SharedObjectTemplate * StaticObject::m_defaultSharedTemplate = NULL; +const SharedObjectTemplate * StaticObject::m_defaultSharedTemplate = nullptr; //----------------------------------------------------------------------- @@ -39,7 +39,7 @@ StaticObject::StaticObject(const ServerStaticObjectTemplate* newTemplate) : { Appearance * newAppearance = AppearanceTemplateList::createAppearance(appearanceString.c_str()); - if(newAppearance != NULL) + if(newAppearance != nullptr) { setAppearance(newAppearance); } else { @@ -82,13 +82,13 @@ const SharedObjectTemplate * StaticObject::getDefaultSharedTemplate(void) const { static const ConstCharCrcLowerString templateName("object/static/base/shared_static_default.iff"); - if (m_defaultSharedTemplate == NULL) + if (m_defaultSharedTemplate == nullptr) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create " + WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create " "default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) ExitChain::add (removeDefaultTemplate, "StaticObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -101,10 +101,10 @@ static const ConstCharCrcLowerString templateName("object/static/base/shared_sta */ void StaticObject::removeDefaultTemplate(void) { - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } // StaticObject::removeDefaultTemplate diff --git a/engine/server/library/serverGame/src/shared/object/TangibleConditionObserver.cpp b/engine/server/library/serverGame/src/shared/object/TangibleConditionObserver.cpp index ab9526b4..b9f4cad8 100755 --- a/engine/server/library/serverGame/src/shared/object/TangibleConditionObserver.cpp +++ b/engine/server/library/serverGame/src/shared/object/TangibleConditionObserver.cpp @@ -27,10 +27,10 @@ TangibleConditionObserver::TangibleConditionObserver(TangibleObject const *who, TangibleConditionObserver::~TangibleConditionObserver() { - if (m_tangibleObject != NULL) + if (m_tangibleObject != nullptr) { const CreatureObject * creature = m_tangibleObject->asCreatureObject(); - if (creature != NULL) + if (creature != nullptr) { int currentCondition = creature->getCondition(); if ((m_oldCondition & TangibleObject::C_hibernating) != 0 && (currentCondition & TangibleObject::C_hibernating) == 0) @@ -50,8 +50,8 @@ TangibleConditionObserver::~TangibleConditionObserver() if ((wasInvulnerable != isInvulnerable) && !m_tangibleObject->getObservers().empty()) { // did the object's "pvp sync" status change because of the invulnerability change? - bool const wasPvpSync = PvpUpdateObserver::satisfyPvpSyncCondition(m_tangibleObject->isNonPvpObject(), wasInvulnerable, (m_tangibleObject->asCreatureObject() != NULL), m_tangibleObject->getPvpFaction()); - bool const isPvpSync = PvpUpdateObserver::satisfyPvpSyncCondition(m_tangibleObject->isNonPvpObject(), isInvulnerable, (m_tangibleObject->asCreatureObject() != NULL), m_tangibleObject->getPvpFaction()); + bool const wasPvpSync = PvpUpdateObserver::satisfyPvpSyncCondition(m_tangibleObject->isNonPvpObject(), wasInvulnerable, (m_tangibleObject->asCreatureObject() != nullptr), m_tangibleObject->getPvpFaction()); + bool const isPvpSync = PvpUpdateObserver::satisfyPvpSyncCondition(m_tangibleObject->isNonPvpObject(), isInvulnerable, (m_tangibleObject->asCreatureObject() != nullptr), m_tangibleObject->getPvpFaction()); if (wasPvpSync != isPvpSync) { diff --git a/engine/server/library/serverGame/src/shared/object/TangibleObject.cpp b/engine/server/library/serverGame/src/shared/object/TangibleObject.cpp index 196f9ce9..3602f9a6 100755 --- a/engine/server/library/serverGame/src/shared/object/TangibleObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/TangibleObject.cpp @@ -354,13 +354,13 @@ static const std::string NOMOVE_SCRIPT = "item.special.nomove"; static const std::string OBJVAR_DECLINE_DUEL = "decline_duel"; -const SharedObjectTemplate * TangibleObject::m_defaultSharedTemplate = NULL; +const SharedObjectTemplate * TangibleObject::m_defaultSharedTemplate = nullptr; //----------------------------------------------------------------------- TangibleObject::TangibleObject(const ServerTangibleObjectTemplate* newTemplate) : ServerObject(newTemplate), - m_combatData(NULL), + m_combatData(nullptr), m_pvpType(), m_pvpMercenaryType(PvpType_Neutral), m_pvpFutureType(-1), @@ -392,7 +392,7 @@ TangibleObject::TangibleObject(const ServerTangibleObjectTemplate* newTemplate) m_accessList(), m_guildAccessList(), m_effectsMap(), - m_npcConversation(NULL), + m_npcConversation(nullptr), m_conversations() { WARNING_STRICT_FATAL(!getSharedTemplate(), ("Tried to create a TANGIBLE %s object without a shared template!\n", newTemplate->DataResource::getName())); @@ -469,7 +469,7 @@ TangibleObject::TangibleObject(const ServerTangibleObjectTemplate* newTemplate) { Appearance * newAppearance = AppearanceTemplateList::createAppearance(appearanceString.c_str()); - if(newAppearance != NULL) + if(newAppearance != nullptr) { setAppearance(newAppearance); } else { @@ -522,11 +522,11 @@ TangibleObject::~TangibleObject() //-- This must be the first line in the destructor to invalidate any watchers watching this object nullWatchers(); - if (getSynchronizedUi() != NULL) + if (getSynchronizedUi() != nullptr) { CraftingToolSyncUi * sync = dynamic_cast( getSynchronizedUi()); - if (sync != NULL) + if (sync != nullptr) { if (isAuthoritative() && isCraftingTool()) { @@ -561,7 +561,7 @@ TangibleObject::~TangibleObject() CombatTracker::removeDefender(this); - if (m_combatData != NULL) + if (m_combatData != nullptr) { if (isAuthoritative()) { @@ -598,16 +598,16 @@ TangibleObject::~TangibleObject() } delete m_combatData; - m_combatData = NULL; + m_combatData = nullptr; if (!isPlayerControlled()) ObjectTracker::removeCombatAI(); } - if (m_npcConversation != NULL) + if (m_npcConversation != nullptr) { delete m_npcConversation; - m_npcConversation = NULL; + m_npcConversation = nullptr; } ObjectTracker::removeTangible(); @@ -625,7 +625,7 @@ void TangibleObject::initializeFirstTimeObject() // set up armor from the template const ServerTangibleObjectTemplate * newTemplate = safe_cast< const ServerTangibleObjectTemplate *>(getObjectTemplate()); - if (newTemplate != NULL) + if (newTemplate != nullptr) { setInvulnerable(newTemplate->getInvulnerable()); @@ -634,7 +634,7 @@ void TangibleObject::initializeFirstTimeObject() initializeVisibility(); const ServerArmorTemplate * armorTemplate = newTemplate->getArmor(); - if (armorTemplate != NULL) + if (armorTemplate != nullptr) { int const rating = static_cast(armorTemplate->getRating()); if ( rating < static_cast(ServerArmorTemplate::AR_armorNone) @@ -729,7 +729,7 @@ void TangibleObject::endBaselines() // check for existence of objvar to enable/disable m_logCommandEnqueue CommandQueue * const queue = getCommandQueue(); - if (queue != NULL) + if (queue != nullptr) { queue->setLogCommandEnqueue(getObjVars().hasItem("debuggingLogCommandEnqueue")); } @@ -781,7 +781,7 @@ void TangibleObject::onLoadedFromDatabase() params.addParam(prototypeId, "prototype"); ScriptDictionaryPtr dictionary; getScriptObject()->makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(getNetworkId(), @@ -973,16 +973,16 @@ TangibleObject * TangibleObject::getTangibleObject(NetworkId const & networkId) TangibleObject * TangibleObject::asTangibleObject(Object * object) { - ServerObject * serverObject = (object != NULL) ? object->asServerObject() : NULL; - return (serverObject != NULL) ? serverObject->asTangibleObject() : NULL; + ServerObject * serverObject = (object != nullptr) ? object->asServerObject() : nullptr; + return (serverObject != nullptr) ? serverObject->asTangibleObject() : nullptr; } //----------------------------------------------------------------------- TangibleObject const * TangibleObject::asTangibleObject(Object const * object) { - ServerObject const * serverObject = (object != NULL) ? object->asServerObject() : NULL; - return (serverObject != NULL) ? serverObject->asTangibleObject() : NULL; + ServerObject const * serverObject = (object != nullptr) ? object->asServerObject() : nullptr; + return (serverObject != nullptr) ? serverObject->asTangibleObject() : nullptr; } //----------------------------------------------------------------------- @@ -1010,13 +1010,13 @@ const SharedObjectTemplate * TangibleObject::getDefaultSharedTemplate(void) cons { static const ConstCharCrcLowerString templateName("object/tangible/base/shared_tangible_default.iff"); - if (m_defaultSharedTemplate == NULL) + if (m_defaultSharedTemplate == nullptr) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create " + WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create " "default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) ExitChain::add (removeDefaultTemplate, "TangibleObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -1029,10 +1029,10 @@ static const ConstCharCrcLowerString templateName("object/tangible/base/shared_t */ void TangibleObject::removeDefaultTemplate(void) { - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } // TangibleObject::removeDefaultTemplate @@ -1184,7 +1184,7 @@ void TangibleObject::appearanceDataModified(const std::string& value) void TangibleObject::getEquippedItems(uint32 combatBone, std::vector &items) const { SlottedContainer const * const container = ContainerInterface::getSlottedContainer(*this); - if (container == NULL) + if (container == nullptr) return; std::vector itemIds; @@ -1194,10 +1194,10 @@ void TangibleObject::getEquippedItems(uint32 combatBone, std::vector(object); - if (item != NULL) + if (item != nullptr) items.push_back(item); } } @@ -1219,7 +1219,7 @@ TangibleObject * TangibleObject::getRandomEquippedItem(uint32 combatBone) const if (items.empty()) { - return NULL; + return nullptr; } int index = Random::random(0, items.size() - 1); @@ -1401,17 +1401,17 @@ void TangibleObject::conclude() PROFILER_AUTO_BLOCK_DEFINE("TangibleObject::conclude"); // if we are a crafting tool, conclude our prototype and manf schematic - if (getSynchronizedUi() != NULL) + if (getSynchronizedUi() != nullptr) { const CraftingToolSyncUi * sync = dynamic_cast( getSynchronizedUi()); - if (sync != NULL) + if (sync != nullptr) { Object * object = sync->getPrototype().getObject(); - if (object != NULL) + if (object != nullptr) object->conclude(); object = sync->getManfSchematic().getObject(); - if (object != NULL) + if (object != nullptr) object->conclude(); } } @@ -1683,12 +1683,12 @@ void TangibleObject::setPvpMercenaryFaction(Pvp::FactionId factionId, Pvp::PvpTy { if (PvpData::isImperialFactionId(m_pvpMercenaryFaction.get())) { - IGNORE_RETURN(setObjVarItem("factionalHelper.timeStopHelpingImperial", static_cast(::time(NULL)))); + IGNORE_RETURN(setObjVarItem("factionalHelper.timeStopHelpingImperial", static_cast(::time(nullptr)))); removeObjVarItem("factionalHelper.timeStopHelpingRebel"); } else if (PvpData::isRebelFactionId(m_pvpMercenaryFaction.get())) { - IGNORE_RETURN(setObjVarItem("factionalHelper.timeStopHelpingRebel", static_cast(::time(NULL)))); + IGNORE_RETURN(setObjVarItem("factionalHelper.timeStopHelpingRebel", static_cast(::time(nullptr)))); removeObjVarItem("factionalHelper.timeStopHelpingImperial"); } } @@ -1821,11 +1821,11 @@ void TangibleObject::onPermanentlyDestroyed() if (isCraftingTool()) { ServerObject * owner = ServerWorld::findObjectByNetworkId(getOwnerId()); - if (owner != NULL && owner->asCreatureObject() != NULL) + if (owner != nullptr && owner->asCreatureObject() != nullptr) { PlayerObject * player = PlayerCreatureController::getPlayerObject( owner->asCreatureObject()); - if (player != NULL && player->isCrafting() && player->getCraftingTool() == getNetworkId()) + if (player != nullptr && player->isCrafting() && player->getCraftingTool() == getNetworkId()) player->stopCrafting(false); } } @@ -1942,11 +1942,11 @@ bool TangibleObject::onContainerAboutToTransfer(ServerObject * destination, Serv } } } - if (destination != NULL && getObjVars().hasItem(OBJVAR_BIO_LINK_ID)) + if (destination != nullptr && getObjVars().hasItem(OBJVAR_BIO_LINK_ID)) { // if this item is bio-linked and a player is trying to equip it, make // sure the link id matches the player's id - if (destination->asCreatureObject() != NULL) + if (destination->asCreatureObject() != nullptr) { // allow holograms to have biolinked items transferred to them int hologramVal = 0; @@ -2058,7 +2058,7 @@ Footprint *TangibleObject::getFootprint() if (property) return property->getFootprint(); else - return NULL; + return nullptr; } //----------------------------------------------------------------------- @@ -2069,7 +2069,7 @@ Footprint const *TangibleObject::getFootprint() const if (property) return property->getFootprint(); else - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -2151,9 +2151,9 @@ int TangibleObject::alterHitPoints(int delta, bool ignoreInvulnerable, #ifdef _DEBUG char debugBuffer[1024]; const char * craftedString = ""; - Client *client = NULL; + Client *client = nullptr; ServerObject * sourceObject = safe_cast(NetworkIdManager::getObjectById(source)); - if (source != NetworkId::cms_invalid && sourceObject != NULL) + if (source != NetworkId::cms_invalid && sourceObject != nullptr) client = sourceObject->getClient(); #endif @@ -2171,7 +2171,7 @@ int TangibleObject::alterHitPoints(int delta, bool ignoreInvulnerable, "from %d to %d\n", craftedString, getNetworkId().getValueString().c_str(), totalHitPoints, m_damageTaken.get(), totalDamageTaken); DEBUG_REPORT_LOG (true, ("%s", debugBuffer)); - if (source != NetworkId::cms_invalid && client != NULL) + if (source != NetworkId::cms_invalid && client != nullptr) ConsoleMgr::broadcastString(debugBuffer, client); } #endif @@ -2200,7 +2200,7 @@ int TangibleObject::alterHitPoints(int delta, bool ignoreInvulnerable, snprintf(debugBuffer, sizeof(debugBuffer), "%s object %s has been " "disabled\n", craftedString, getNetworkId().getValueString().c_str()); DEBUG_REPORT_LOG (true, ("%s", debugBuffer)); - if (source != NetworkId::cms_invalid && client != NULL) + if (source != NetworkId::cms_invalid && client != nullptr) ConsoleMgr::broadcastString(debugBuffer, client); } #endif @@ -2283,7 +2283,7 @@ void TangibleObject::updatePlanetServerInternal(const bool forceUpdate) const if ((forceUpdate || getPositionChanged()) && (!ContainerInterface::getContainedByObject(*this) || getInterestRadius() > 0)) { Object const * const topmostContainer = ContainerInterface::getTopmostContainer(*this); - FATAL(!topmostContainer, ("Object %s was contained by something, but getTopmostContainer() returned NULL\n",getNetworkId().getValueString().c_str())); + FATAL(!topmostContainer, ("Object %s was contained by something, but getTopmostContainer() returned nullptr\n",getNetworkId().getValueString().c_str())); Vector const &position = topmostContainer->getPosition_p(); UpdateObjectOnPlanetMessage const msg( @@ -2313,7 +2313,7 @@ void TangibleObject::updatePlanetServerInternal(const bool forceUpdate) const */ void TangibleObject::clearDamageList(void) { - if (m_combatData != NULL) + if (m_combatData != nullptr) { m_combatData->defenseData.damage.clear(); } @@ -2442,7 +2442,7 @@ void TangibleObject::clearHateList() } else { - sendControllerMessageToAuthServer(CM_clearHateList, NULL); + sendControllerMessageToAuthServer(CM_clearHateList, nullptr); } } @@ -2476,7 +2476,7 @@ bool TangibleObject::isHatedBy(Object * const object) bool result = false; TangibleObject * const hatedByTangibleObject = TangibleObject::asTangibleObject(object); - if (hatedByTangibleObject != NULL) + if (hatedByTangibleObject != nullptr) { HateList::UnSortedList const & hateList = hatedByTangibleObject->getUnSortedHateList(); @@ -2534,7 +2534,7 @@ void TangibleObject::resetHateTimer() } else { - sendControllerMessageToAuthServer(CM_resetHateTimer, NULL); + sendControllerMessageToAuthServer(CM_resetHateTimer, nullptr); } } @@ -2625,11 +2625,11 @@ void TangibleObject::setCraftedId(const NetworkId & id) IGNORE_RETURN(setObjVarItem(OBJVAR_CRAFTING_SCHEMATIC, id)); setCondition(C_crafted); const Object * object = NetworkIdManager::getObjectById(id); - if (object != NULL) + if (object != nullptr) { const ManufactureSchematicObject * schematic = dynamic_cast< const ManufactureSchematicObject *>(object); - if (schematic != NULL) + if (schematic != nullptr) m_sourceDraftSchematic = schematic->getDraftSchematic(); } } @@ -2869,7 +2869,7 @@ bool TangibleObject::startCraftingSession(CreatureObject & crafter) UNREF(myIdString); // needed for release mode PlayerObject * crafterPlayer = PlayerCreatureController::getPlayerObject(&crafter); - if (crafterPlayer == NULL) + if (crafterPlayer == nullptr) return false; // make sure we are a crafting tool @@ -2909,7 +2909,7 @@ bool TangibleObject::startCraftingSession(CreatureObject & crafter) // make sure the output slot is empty SlottedContainer const * const slotContainer = ContainerInterface::getSlottedContainer(*this); - if (slotContainer == NULL) + if (slotContainer == nullptr) { DEBUG_WARNING(true, ("Crafting tool %s does not have a container!", myIdString)); return false; @@ -2938,7 +2938,7 @@ bool TangibleObject::startCraftingSession(CreatureObject & crafter) for (iter = schematics.begin(); iter != schematics.end(); ++iter) { const DraftSchematicObject * schematic = DraftSchematicObject::getSchematic((*iter).first.first); - if (schematic != NULL && ((myType & ServerObjectTemplate::CT_genericItem) != 0 || + if (schematic != nullptr && ((myType & ServerObjectTemplate::CT_genericItem) != 0 || ((schematic->getCategory() & myType) != 0))) { // make sure the player has all the skill commands needed for the @@ -3068,11 +3068,11 @@ bool TangibleObject::stopCraftingSession(void) bool TangibleObject::isIngredientInHopper(const NetworkId & ingredientId) const { ServerObject const * const hopper = getIngredientHopper(); - if (hopper == NULL) + if (hopper == nullptr) return false; Object const * const ingredient = CachedNetworkId(ingredientId).getObject(); - if (ingredient == NULL) + if (ingredient == nullptr) return false; return ContainerInterface::isNestedWithin(*ingredient, getNetworkId()); @@ -3098,15 +3098,15 @@ static const SlotId hopperSlotId(SlotIdManager::findSlotId(INGREDIENT_HOPPER_SLO { DEBUG_WARNING(true, ("Tried to get input hopper for non-crafting station " "object %s", myIdString)); - return NULL; + return nullptr; } // get the ingredient hopper SlottedContainer const * const container = ContainerInterface::getSlottedContainer(*this); - if (container == NULL) + if (container == nullptr) { DEBUG_WARNING(true, ("Crafting tool %s does not have a container!", myIdString)); - return NULL; + return nullptr; } Container::ContainerErrorCode tmp = Container::CEC_Success; Container::ContainedItem hopperId = container->getObjectInSlot(hopperSlotId, tmp); @@ -3114,14 +3114,14 @@ static const SlotId hopperSlotId(SlotIdManager::findSlotId(INGREDIENT_HOPPER_SLO { DEBUG_WARNING(true, ("Crafting tool %s does not have a ingredient " "hopper!", myIdString)); - return NULL; + return nullptr; } ServerObject * hopper = safe_cast(hopperId.getObject()); - if (hopper == NULL) + if (hopper == nullptr) { DEBUG_WARNING(true, ("Can't find object for ingredient hopper id %s", hopperId.getValueString().c_str())); - return NULL; + return nullptr; } return hopper; @@ -3150,16 +3150,16 @@ static const SlotId outputSlotId(SlotIdManager::findSlotId(MANF_OUTPUT_SLOT_NAME // get output slot SlottedContainer const * const slotContainer = ContainerInterface::getSlottedContainer(*this); - if (slotContainer == NULL) + if (slotContainer == nullptr) { DEBUG_WARNING(true, ("Crafting tool %s does not have a container!", myIdString)); return false; } // make sure the transferer is in the final stage of crafting - if (transferer == NULL) + if (transferer == nullptr) { - DEBUG_WARNING(true, ("addObjectToOutputSlot, NULL transferer")); + DEBUG_WARNING(true, ("addObjectToOutputSlot, nullptr transferer")); return false; } NetworkId crafterVarId(NetworkId::cms_invalid); @@ -3178,14 +3178,14 @@ static const SlotId outputSlotId(SlotIdManager::findSlotId(MANF_OUTPUT_SLOT_NAME return false; } CreatureObject const * const creatureTransferer = transferer->asCreatureObject(); - if (creatureTransferer == NULL) + if (creatureTransferer == nullptr) { DEBUG_WARNING(true, ("addObjectToOutputSlot, transferer %s is not a " "creature", transferer->getNetworkId().getValueString().c_str())); return false; } PlayerObject const * const creaturePlayer = PlayerCreatureController::getPlayerObject(creatureTransferer); - if (creaturePlayer == NULL) + if (creaturePlayer == nullptr) return false; if (creaturePlayer->getCraftingStage() != Crafting::CS_finish) @@ -3197,11 +3197,11 @@ static const SlotId outputSlotId(SlotIdManager::findSlotId(MANF_OUTPUT_SLOT_NAME } // if the object is our prototype, clear the prototype - if (getSynchronizedUi() != NULL) + if (getSynchronizedUi() != nullptr) { CraftingToolSyncUi * sync = dynamic_cast( getSynchronizedUi()); - if (sync != NULL) + if (sync != nullptr) { if (sync->getPrototype() == object.getNetworkId()) { @@ -3212,7 +3212,7 @@ static const SlotId outputSlotId(SlotIdManager::findSlotId(MANF_OUTPUT_SLOT_NAME // put the object in the slot Container::ContainerErrorCode tmp = Container::CEC_Success; - if (!ContainerInterface::transferItemToSlottedContainer(*this, object, outputSlotId, NULL, tmp)) + if (!ContainerInterface::transferItemToSlottedContainer(*this, object, outputSlotId, nullptr, tmp)) { DEBUG_WARNING(true, ("Failed to transfer object %s to crafting " "tool %s", object.getNetworkId().getValueString().c_str(), @@ -3250,7 +3250,7 @@ ManufactureSchematicObject * TangibleObject::getCraftingManufactureSchematic(voi { DEBUG_WARNING(true, ("Tried to get non-crafting tool " "object %s", myIdString)); - return NULL; + return nullptr; } SlottedContainer const * const container = ContainerInterface::getSlottedContainer(*this); @@ -3264,7 +3264,7 @@ ManufactureSchematicObject * TangibleObject::getCraftingManufactureSchematic(voi else { DEBUG_WARNING(true, ("ManufactureSchematicObject doesn't have a slotted container.")); - return NULL; + return nullptr; } } // TangibleObject::getCraftingManufactureSchematic @@ -3282,17 +3282,17 @@ ManufactureSchematicObject * TangibleObject::removeCraftingManufactureSchematic( UNREF(myIdString); // needed for release mode // make sure we are a crafting tool - if (!isCraftingTool() || getSynchronizedUi() == NULL) + if (!isCraftingTool() || getSynchronizedUi() == nullptr) { DEBUG_WARNING(true, ("Tried to get non-crafting tool " "object %s", myIdString)); - return NULL; + return nullptr; } CraftingToolSyncUi * sync = dynamic_cast( getSynchronizedUi()); - if (sync == NULL) - return NULL; + if (sync == nullptr) + return nullptr; ManufactureSchematicObject * schematic = safe_cast( sync->getManfSchematic().getObject()); @@ -3320,7 +3320,7 @@ void TangibleObject::setCraftingManufactureSchematic(ManufactureSchematicObject UNREF(myIdString); // needed for release mode // make sure we are a crafting tool - if (!isCraftingTool() || getSynchronizedUi() == NULL) + if (!isCraftingTool() || getSynchronizedUi() == nullptr) { DEBUG_WARNING(true, ("Tried to get non-crafting tool " "object %s", myIdString)); @@ -3329,7 +3329,7 @@ void TangibleObject::setCraftingManufactureSchematic(ManufactureSchematicObject CraftingToolSyncUi * sync = dynamic_cast( getSynchronizedUi()); - if (sync == NULL) + if (sync == nullptr) return; // see if there is already a schematic object set @@ -3339,7 +3339,7 @@ void TangibleObject::setCraftingManufactureSchematic(ManufactureSchematicObject // remove the old schematic ServerObject * object = safe_cast(schematicId.getObject()); - if (object == NULL) + if (object == nullptr) { if (schematicId != NetworkId::cms_invalid) { @@ -3358,13 +3358,13 @@ void TangibleObject::setCraftingManufactureSchematic(ManufactureSchematicObject // the schematic isn't in the world or in a container, so we need to // tell the client about it int stationBonus = 0; - ServerObject * crafter = NULL; + ServerObject * crafter = nullptr; NetworkId crafterId; if (getObjVars().getItem(OBJVAR_CRAFTING_CRAFTER,crafterId)) { crafter = safe_cast(NetworkIdManager::getObjectById(crafterId)); } - if (crafter != NULL) + if (crafter != nullptr) { sync->setManfSchematic(CachedNetworkId(schematic), CachedNetworkId(*crafter), true); @@ -3373,7 +3373,7 @@ void TangibleObject::setCraftingManufactureSchematic(ManufactureSchematicObject // it has const PlayerObject * player = PlayerCreatureController::getPlayerObject( crafter->asCreatureObject()); - if (player != NULL && player->getCraftingStation().getObject() != NULL) + if (player != nullptr && player->getCraftingStation().getObject() != nullptr) { player->getCraftingStation().getObject()->asServerObject()-> getObjVars().getItem(OBJVAR_CRAFTING_STATIONMOD, stationBonus); @@ -3436,11 +3436,11 @@ void TangibleObject::clearCraftingManufactureSchematic(void) } // get our ui - CraftingToolSyncUi * sync = NULL; - if (getSynchronizedUi() != NULL) + CraftingToolSyncUi * sync = nullptr; + if (getSynchronizedUi() != nullptr) sync = dynamic_cast(getSynchronizedUi()); - if (schematicId == CachedNetworkId::cms_cachedInvalid && sync == NULL) + if (schematicId == CachedNetworkId::cms_cachedInvalid && sync == nullptr) { // no schematic return; @@ -3448,7 +3448,7 @@ void TangibleObject::clearCraftingManufactureSchematic(void) if (schematicId == CachedNetworkId::cms_invalid) schematicId = sync->getManfSchematic(); - else if (sync != NULL && sync->getManfSchematic() != CachedNetworkId::cms_invalid && + else if (sync != nullptr && sync->getManfSchematic() != CachedNetworkId::cms_invalid && schematicId != sync->getManfSchematic()) { WARNING(true, ("TangibleObject::clearCraftingManufactureSchematic " @@ -3456,7 +3456,7 @@ void TangibleObject::clearCraftingManufactureSchematic(void) "in its ui!!!", getNetworkId().getValueString().c_str(), schematicId.getValueString().c_str(), sync->getManfSchematic().getValueString().c_str())); - if (schematicId.getObject() != NULL) + if (schematicId.getObject() != nullptr) { schematicId.getObject()->asServerObject()->permanentlyDestroy( DeleteReasons::Consumed); @@ -3472,9 +3472,9 @@ void TangibleObject::clearCraftingManufactureSchematic(void) } // get the schematic - ManufactureSchematicObject * manfSchematic = NULL; + ManufactureSchematicObject * manfSchematic = nullptr; ServerObject * object = safe_cast(schematicId.getObject()); - if (object == NULL && schematicId != CachedNetworkId::cms_invalid) + if (object == nullptr && schematicId != CachedNetworkId::cms_invalid) { WARNING_STRICT_FATAL(true, ("Can't find object for manufactring schematic " "id %s", schematicId.getValueString().c_str())); @@ -3482,7 +3482,7 @@ void TangibleObject::clearCraftingManufactureSchematic(void) else manfSchematic = safe_cast(object); - if (manfSchematic != NULL) + if (manfSchematic != nullptr) { NetworkId crafterId; if (getObjVars().getItem(OBJVAR_CRAFTING_CRAFTER,crafterId)) @@ -3492,7 +3492,7 @@ void TangibleObject::clearCraftingManufactureSchematic(void) // in the tool CreatureObject * const crafter = dynamic_cast(NetworkIdManager::getObjectById(crafterId)); PlayerObject * const crafterPlayer = PlayerCreatureController::getPlayerObject(crafter); - if (!manfSchematic->mustDestroyIngredients() || (crafterPlayer != NULL && + if (!manfSchematic->mustDestroyIngredients() || (crafterPlayer != nullptr && crafterPlayer->getCraftingStage() == Crafting::CS_assembly)) { crafterPlayer->setAllowEmptySlot(true); @@ -3526,9 +3526,9 @@ void TangibleObject::clearCraftingManufactureSchematic(void) } } - if (sync != NULL) + if (sync != nullptr) sync->setManfSchematic(CachedNetworkId::cms_cachedInvalid, CachedNetworkId::cms_cachedInvalid, true); - if (object != NULL) + if (object != nullptr) { object->permanentlyDestroy(DeleteReasons::Consumed); } @@ -3554,17 +3554,17 @@ ServerObject * TangibleObject::getCraftingPrototype(void) const UNREF(myIdString); // needed for release mode // make sure we are a crafting tool - if (!isCraftingTool() || getSynchronizedUi() == NULL) + if (!isCraftingTool() || getSynchronizedUi() == nullptr) { DEBUG_WARNING(true, ("Tried to get non-crafting tool " "object %s", myIdString)); - return NULL; + return nullptr; } const CraftingToolSyncUi * sync = dynamic_cast( getSynchronizedUi()); - if (sync == NULL) - return NULL; + if (sync == nullptr) + return nullptr; return safe_cast(sync->getPrototype().getObject()); } // TangibleObject::getCraftingPrototype @@ -3586,7 +3586,7 @@ void TangibleObject::setCraftingPrototype(ServerObject & prototype) UNREF(myIdString); // needed for release mode // make sure we are a crafting tool - if (!isCraftingTool() || getSynchronizedUi() == NULL) + if (!isCraftingTool() || getSynchronizedUi() == nullptr) { DEBUG_WARNING(true, ("Tried to get non-crafting tool " "object %s", myIdString)); @@ -3595,7 +3595,7 @@ void TangibleObject::setCraftingPrototype(ServerObject & prototype) CraftingToolSyncUi * sync = dynamic_cast( getSynchronizedUi()); - if (sync == NULL) + if (sync == nullptr) return; // see if there is already a prototype object set @@ -3605,7 +3605,7 @@ void TangibleObject::setCraftingPrototype(ServerObject & prototype) // remove the old prototype ServerObject * object = safe_cast(prototypeId.getObject()); - if (object == NULL) + if (object == nullptr) { if (prototypeId != NetworkId::cms_invalid) { @@ -3624,7 +3624,7 @@ void TangibleObject::setCraftingPrototype(ServerObject & prototype) // about it Container::ContainerErrorCode tmp = Container::CEC_Success; if (!ContainerInterface::transferItemToSlottedContainer(*this, prototype, - getCraftingPrototypeSlotId(), NULL, tmp)) + getCraftingPrototypeSlotId(), nullptr, tmp)) { // see if there is something in the slot, and delete it if there is bool failed = true; @@ -3634,13 +3634,13 @@ void TangibleObject::setCraftingPrototype(ServerObject & prototype) getCraftingPrototypeSlotId(), tmp); if (oldItem != prototype.getNetworkId()) { - if (oldItem.getObject() != NULL) + if (oldItem.getObject() != nullptr) { safe_cast(oldItem.getObject())->permanentlyDestroy( DeleteReasons::Consumed); // try the transfer again if (ContainerInterface::transferItemToSlottedContainer(*this, - prototype, getCraftingPrototypeSlotId(), NULL, tmp)) + prototype, getCraftingPrototypeSlotId(), nullptr, tmp)) { failed = false; } @@ -3678,7 +3678,7 @@ void TangibleObject::clearCraftingPrototype(void) UNREF(myIdString); // needed for release mode // make sure we are a crafting tool - if (!isCraftingTool() || getSynchronizedUi() == NULL) + if (!isCraftingTool() || getSynchronizedUi() == nullptr) { DEBUG_WARNING(true, ("Tried to get non-crafting tool " "object %s", myIdString)); @@ -3687,12 +3687,12 @@ void TangibleObject::clearCraftingPrototype(void) CraftingToolSyncUi * sync = dynamic_cast( getSynchronizedUi()); - if (sync == NULL) + if (sync == nullptr) return; const CachedNetworkId & prototypeId = sync->getPrototype(); ServerObject * object = safe_cast(prototypeId.getObject()); - if (object != NULL) + if (object != nullptr) { object->permanentlyDestroy(DeleteReasons::Consumed); } @@ -3704,7 +3704,7 @@ void TangibleObject::clearCraftingPrototype(void) Container::ContainerErrorCode error; const Container::ContainedItem & contents = container->getObjectInSlot( getCraftingPrototypeSlotId(), error); - if (contents.getObject() != NULL) + if (contents.getObject() != nullptr) { safe_cast(contents.getObject())->permanentlyDestroy( DeleteReasons::Consumed); @@ -3856,7 +3856,7 @@ void TangibleObject::forceExecuteCommand(Command const &command, NetworkId const { CommandQueue * const queue = getCommandQueue(); - if (queue != NULL) + if (queue != nullptr) { queue->cancelCurrentCommand(); } @@ -3948,7 +3948,7 @@ void TangibleObject::initializeVisibility() { const ServerTangibleObjectTemplate * myTemplate = safe_cast< const ServerTangibleObjectTemplate *>(getObjectTemplate()); - if (myTemplate != NULL) + if (myTemplate != nullptr) { bool visible = false; for (size_t i = 0; i < myTemplate->getVisibleFlagsCount(); ++i) @@ -3999,7 +3999,7 @@ void TangibleObject::visibilityDataModified() { // show the object const TriggerVolume * triggerVolume = getTriggerVolume(NetworkTriggerVolumeNamespace::NetworkTriggerVolumeName); - if (triggerVolume != NULL) + if (triggerVolume != nullptr) { std::vector observers; ServerWorld::findPlayerCreaturesInRange(getPosition_w(), triggerVolume->getRadius(), observers); @@ -4017,7 +4017,7 @@ void TangibleObject::visibilityDataModified() if (isVisible() && isHidden() && !m_passiveRevealPlayerCharacter.empty()) { const TriggerVolume * triggerVolume = getTriggerVolume(NetworkTriggerVolumeNamespace::NetworkTriggerVolumeName); - if (triggerVolume != NULL) + if (triggerVolume != nullptr) { std::vector possibleObservers; ServerWorld::findPlayerCreaturesInRange(getPosition_w(), triggerVolume->getRadius(), possibleObservers); @@ -4077,10 +4077,10 @@ bool TangibleObject::isVisibleOnClient(Client const &client) const // if the client's character is grouped with the the owner, then he can see it. const CreatureObject * owner = safe_cast(ownerId.getObject()); - if (owner != NULL) + if (owner != nullptr) { const GroupObject * group = owner->getGroup(); - if (group != NULL) + if (group != nullptr) { if (group->isGroupMember(characterObject->getNetworkId())) return true; @@ -4129,7 +4129,7 @@ static int datatable_max_encumbrance_col = -1; encumbrances.clear(); DataTable * dt = DataTableManager::getTable(DATATABLE_ARMOR, true); - if (dt == NULL) + if (dt == nullptr) return false; else if (datatable_type_col == -1) { @@ -4690,7 +4690,7 @@ void TangibleObject::getAttributesForCraftingTool (AttributeVector & data) const // see if there is an object in the output hopper bool hasPrototype = false; SlottedContainer const * const slotContainer = ContainerInterface::getSlottedContainer(*this); - if (slotContainer != NULL) + if (slotContainer != nullptr) { Container::ContainerErrorCode tmp = Container::CEC_Success; if (slotContainer->getObjectInSlot(outputSlotId, tmp) != Container::ContainedItem::cms_invalid) @@ -5121,7 +5121,7 @@ void TangibleObject::handleCMessageTo(const MessageToPayload &message) std::string const & sceneId = ServerWorld::getSceneId(); Vector const &position = findPosition_w(); Region const * const region = RegionMaster::getSmallestVisibleRegionAtPoint(sceneId, position.x, position.z); - if (region != NULL) + if (region != nullptr) regionName = Unicode::wideToNarrow(region->getName()); int const cityId = CityInterface::getCityAtLocation(sceneId, static_cast(position.x), static_cast(position.z), 0); @@ -5248,7 +5248,7 @@ void TangibleObject::setInvulnerable(bool invulnerable) GameScriptObject * const gameScriptObject = getScriptObject(); - if (gameScriptObject != NULL) + if (gameScriptObject != nullptr) { ScriptParams scriptParams; scriptParams.addParam(hasCondition(ServerTangibleObjectTemplate::C_invulnerable)); @@ -5451,8 +5451,8 @@ void TangibleObject::setPvpable(bool pvpable) if ((oldPvpable != pvpable) && !getObservers().empty()) { // did the object's "pvp sync" status change because of the Pvpable change? - bool const wasPvpSync = PvpUpdateObserver::satisfyPvpSyncCondition(!oldPvpable, hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (asCreatureObject() != NULL), getPvpFaction()); - bool const isPvpSync = PvpUpdateObserver::satisfyPvpSyncCondition(!pvpable, hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (asCreatureObject() != NULL), getPvpFaction()); + bool const wasPvpSync = PvpUpdateObserver::satisfyPvpSyncCondition(!oldPvpable, hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (asCreatureObject() != nullptr), getPvpFaction()); + bool const isPvpSync = PvpUpdateObserver::satisfyPvpSyncCondition(!pvpable, hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (asCreatureObject() != nullptr), getPvpFaction()); if (wasPvpSync != isPvpSync) { @@ -5557,8 +5557,8 @@ void TangibleObject::AppearanceDataCallback::modified(TangibleObject &target, co target.appearanceDataModified(value); Object * const objectContainer = ContainerInterface::getContainedByObject(target); - ServerObject * const serverContainer = objectContainer ? objectContainer->asServerObject() : NULL; - TangibleObject * const tangibleContainer = serverContainer ? serverContainer->asTangibleObject() : NULL; + ServerObject * const serverContainer = objectContainer ? objectContainer->asServerObject() : nullptr; + TangibleObject * const tangibleContainer = serverContainer ? serverContainer->asTangibleObject() : nullptr; if(tangibleContainer) tangibleContainer->onContainedItemAppearanceDataModified(target, oldValue, value); } @@ -5802,7 +5802,7 @@ void TangibleObject::commandQueueEnqueue(Command const &command, NetworkId const else { CommandQueue * const queue = getCommandQueue(); - if (queue != NULL) + if (queue != nullptr) { queue->enqueue(command, targetId, params, sequenceId, clearable, priority); } @@ -5820,7 +5820,7 @@ void TangibleObject::commandQueueRemove(uint32 const sequenceId) else { CommandQueue * const queue = getCommandQueue(); - if (queue != NULL) + if (queue != nullptr) { queue->remove(sequenceId); } @@ -5840,7 +5840,7 @@ void TangibleObject::commandQueueClear() bool TangibleObject::commandQueueHasCommandFromGroup(uint32 groupHash) const { CommandQueue * const queue = getCommandQueue(); - if (queue != NULL) + if (queue != nullptr) { return queue->hasCommandFromGroup(groupHash); } @@ -5852,7 +5852,7 @@ bool TangibleObject::commandQueueHasCommandFromGroup(uint32 groupHash) const void TangibleObject::commandQueueClearCommandsFromGroup(uint32 groupHash, bool force) { CommandQueue * const queue = getCommandQueue(); - if (queue != NULL) + if (queue != nullptr) { queue->clearCommandsFromGroup(groupHash, force); } @@ -5895,12 +5895,12 @@ void TangibleObject::CombatStateChangedCallback::modified(TangibleObject & targe AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(target.getController()); - if (aiCreatureController != NULL) + if (aiCreatureController != nullptr) { aiCreatureController->markCombatStartLocation(); } - if (target.getScriptObject() != NULL) + if (target.getScriptObject() != nullptr) { ScriptParams params; IGNORE_RETURN(target.getScriptObject()->trigAllScripts(Scripting::TRIG_ENTERED_COMBAT, params)); @@ -5926,7 +5926,7 @@ void TangibleObject::CombatStateChangedCallback::modified(TangibleObject & targe target.commandQueueClearCommandsFromGroup(COMMAND_GROUP_COMBAT.getCrc()); - if (target.getScriptObject() != NULL) + if (target.getScriptObject() != nullptr) { ScriptParams params; IGNORE_RETURN(target.getScriptObject()->trigAllScripts(Scripting::TRIG_EXITED_COMBAT, params)); @@ -5985,7 +5985,7 @@ int TangibleObject::getPassiveRevealRange(NetworkId const & target) const void TangibleObject::addPassiveReveal(TangibleObject const & target, int range) { - addPassiveReveal(target.getNetworkId(), range, (NULL != PlayerCreatureController::getPlayerObject(target.asCreatureObject()))); + addPassiveReveal(target.getNetworkId(), range, (nullptr != PlayerCreatureController::getPlayerObject(target.asCreatureObject()))); } //---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/object/TangibleObject.h b/engine/server/library/serverGame/src/shared/object/TangibleObject.h index c05f93bf..f4b80817 100755 --- a/engine/server/library/serverGame/src/shared/object/TangibleObject.h +++ b/engine/server/library/serverGame/src/shared/object/TangibleObject.h @@ -777,7 +777,7 @@ inline uint32 TangibleObject::getSourceDraftSchematic() const inline void TangibleObject::createCombatData() { - if (m_combatData == NULL) + if (m_combatData == nullptr) { m_combatData = new CombatEngineData::CombatData; } diff --git a/engine/server/library/serverGame/src/shared/object/TangibleObject_Conversation.cpp b/engine/server/library/serverGame/src/shared/object/TangibleObject_Conversation.cpp index 7f7aafe5..fbf7881e 100755 --- a/engine/server/library/serverGame/src/shared/object/TangibleObject_Conversation.cpp +++ b/engine/server/library/serverGame/src/shared/object/TangibleObject_Conversation.cpp @@ -47,7 +47,7 @@ bool TangibleObject::startNpcConversation(TangibleObject & npc, const std::strin return false; // test if already in a conversation - if (m_npcConversation != NULL) + if (m_npcConversation != nullptr) return false; if (starter == NpcConversationData::CS_Player) @@ -120,7 +120,7 @@ void TangibleObject::endNpcConversation() { if (isAuthoritative()) { - if (m_npcConversation != NULL) + if (m_npcConversation != nullptr) { // I am a player, end my conversation @@ -128,7 +128,7 @@ void TangibleObject::endNpcConversation() if (isPlayerControlled()) { TangibleObject * const npc = safe_cast(m_npcConversation->getNPC().getObject()); - if (npc != NULL) + if (npc != nullptr) { // trigger OnEndNpcConversation ScriptParams params; @@ -157,13 +157,13 @@ void TangibleObject::endNpcConversation() } else { - WARNING(true,("TangibleObject::endNpcConversation: creature %s has a non-null m_npcConversation pointer %p but is not a player-controlled object!", + WARNING(true,("TangibleObject::endNpcConversation: creature %s has a non-nullptr m_npcConversation pointer %p but is not a player-controlled object!", getNetworkId().getValueString().c_str(), m_npcConversation)); m_conversations.clear(); } delete m_npcConversation; - m_npcConversation = NULL; + m_npcConversation = nullptr; } else { @@ -182,14 +182,14 @@ void TangibleObject::endNpcConversation() { NetworkId const & networkId = *it; TangibleObject * const player = dynamic_cast(NetworkIdManager::getObjectById(networkId)); - if (player != NULL) + if (player != nullptr) player->endNpcConversation(); } } } else { - WARNING(true,("TangibleObject::endNpcConversation: creature %s has a null m_npcConversation pointer but is a player-controlled object!", + WARNING(true,("TangibleObject::endNpcConversation: creature %s has a nullptr m_npcConversation pointer but is a player-controlled object!", getNetworkId().getValueString().c_str())); m_conversations.clear(); } @@ -217,7 +217,7 @@ void TangibleObject::endNpcConversation() */ void TangibleObject::clearNpcConversation() { - if (m_npcConversation != NULL) + if (m_npcConversation != nullptr) { m_npcConversation->clearResponses(); } @@ -234,7 +234,7 @@ void TangibleObject::sendNpcConversationMessage(const StringId & stringId, const { if (isAuthoritative()) { - if (m_npcConversation != NULL) + if (m_npcConversation != nullptr) { NpcConversation::Response response; response.stringId = stringId; @@ -262,7 +262,7 @@ bool TangibleObject::addNpcConversationResponse(const StringId & stringId, const { if (isAuthoritative()) { - if (m_npcConversation != NULL) + if (m_npcConversation != nullptr) { NpcConversation::Response response; response.stringId = stringId; @@ -293,7 +293,7 @@ bool TangibleObject::removeNpcConversationResponse(const StringId & stringId, co bool result = false; if (isAuthoritative()) { - if (m_npcConversation != NULL) + if (m_npcConversation != nullptr) { NpcConversation::Response response; response.stringId = stringId; @@ -319,7 +319,7 @@ void TangibleObject::sendNpcConversationResponses() { if (isAuthoritative()) { - if (m_npcConversation != NULL) + if (m_npcConversation != nullptr) { m_npcConversation->sendResponses(); } @@ -327,7 +327,7 @@ void TangibleObject::sendNpcConversationResponses() else { Controller * const controller = NON_NULL(getController()); - controller->appendMessage(CM_sendNpcConversationResponses, 0.0f, NULL, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_SERVER); + controller->appendMessage(CM_sendNpcConversationResponses, 0.0f, nullptr, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_SERVER); } } @@ -342,10 +342,10 @@ void TangibleObject::respondToNpc(int responseIndex) { if (isAuthoritative()) { - if (m_npcConversation != NULL) + if (m_npcConversation != nullptr) { TangibleObject * const npc = safe_cast(m_npcConversation->getNPC().getObject()); - if (npc == NULL) + if (npc == nullptr) { endNpcConversation(); return; @@ -363,7 +363,7 @@ void TangibleObject::respondToNpc(int responseIndex) { Controller * const controller = getController(); if (controller) - controller->appendMessage(CM_npcConversationSelect, static_cast(responseIndex), NULL, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_SERVER); + controller->appendMessage(CM_npcConversationSelect, static_cast(responseIndex), nullptr, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_SERVER); } } @@ -374,7 +374,7 @@ void TangibleObject::handlePlayerResponseToNpcConversation(const std::string & c if (isAuthoritative()) { TangibleObject * const playerObject = safe_cast(NetworkIdManager::getObjectById(player)); - if (playerObject != NULL) + if (playerObject != nullptr) { // trigger OnNpcConversationResponse ScriptParams params; diff --git a/engine/server/library/serverGame/src/shared/object/UniverseObject.cpp b/engine/server/library/serverGame/src/shared/object/UniverseObject.cpp index 6b283f5e..6e6b8d6c 100755 --- a/engine/server/library/serverGame/src/shared/object/UniverseObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/UniverseObject.cpp @@ -20,7 +20,7 @@ // objvars for dynamic regions const static std::string OBJVAR_DYNAMIC_REGION("dynamic_region"); -const SharedObjectTemplate * UniverseObject::m_defaultSharedTemplate = NULL; +const SharedObjectTemplate * UniverseObject::m_defaultSharedTemplate = nullptr; // ====================================================================== @@ -56,13 +56,13 @@ const SharedObjectTemplate * UniverseObject::getDefaultSharedTemplate(void) cons { static const ConstCharCrcLowerString templateName("object/universe/base/shared_universe_default.iff"); - if (m_defaultSharedTemplate == NULL) + if (m_defaultSharedTemplate == nullptr) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create " + WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create " "default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) ExitChain::add (removeDefaultTemplate, "UniverseObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -75,10 +75,10 @@ static const ConstCharCrcLowerString templateName("object/universe/base/shared_u */ void UniverseObject::removeDefaultTemplate(void) { - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } // UniverseObject::removeDefaultTemplate diff --git a/engine/server/library/serverGame/src/shared/object/WeaponObject.cpp b/engine/server/library/serverGame/src/shared/object/WeaponObject.cpp index 320d0c0b..b19b7cfb 100755 --- a/engine/server/library/serverGame/src/shared/object/WeaponObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/WeaponObject.cpp @@ -25,7 +25,7 @@ //---------------------------------------------------------------------- -const SharedObjectTemplate * WeaponObject::m_defaultSharedTemplate = NULL; +const SharedObjectTemplate * WeaponObject::m_defaultSharedTemplate = nullptr; static const std::string OBJVAR_CERTIFICATION = "weapon.strCertUsed"; @@ -68,13 +68,13 @@ const SharedObjectTemplate * WeaponObject::getDefaultSharedTemplate(void) const { static const ConstCharCrcLowerString templateName("object/weapon/base/shared_weapon_default.iff"); - if (m_defaultSharedTemplate == NULL) + if (m_defaultSharedTemplate == nullptr) { m_defaultSharedTemplate = safe_cast( ObjectTemplateList::fetch(templateName)); - WARNING_STRICT_FATAL(m_defaultSharedTemplate == NULL, ("Cannot create " + WARNING_STRICT_FATAL(m_defaultSharedTemplate == nullptr, ("Cannot create " "default shared object template %s", templateName.getString())); - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) ExitChain::add (removeDefaultTemplate, "WeaponObject::removeDefaultTemplate"); } return m_defaultSharedTemplate; @@ -87,10 +87,10 @@ static const ConstCharCrcLowerString templateName("object/weapon/base/shared_wea */ void WeaponObject::removeDefaultTemplate(void) { - if (m_defaultSharedTemplate != NULL) + if (m_defaultSharedTemplate != nullptr) { m_defaultSharedTemplate->releaseReference(); - m_defaultSharedTemplate = NULL; + m_defaultSharedTemplate = nullptr; } } // WeaponObject::removeDefaultTemplate @@ -323,7 +323,7 @@ WeaponObject * WeaponObject::getWeaponObject(NetworkId const & networkId) { ServerObject * serverObject = ServerObject::getServerObject(networkId); - return (serverObject != NULL) ? serverObject->asWeaponObject() : NULL; + return (serverObject != nullptr) ? serverObject->asWeaponObject() : nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerArmorTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerArmorTemplate.cpp index a387b645..2e429325 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerArmorTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerArmorTemplate.cpp @@ -53,7 +53,7 @@ ServerArmorTemplate::~ServerArmorTemplate() for (iter = m_specialProtection.begin(); iter != m_specialProtection.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_specialProtection.clear(); } @@ -105,10 +105,10 @@ Tag ServerArmorTemplate::getTemplateVersion(void) const */ Tag ServerArmorTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerArmorTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerArmorTemplate::getHighestTemplateVersion @@ -122,33 +122,33 @@ ServerArmorTemplate::ArmorRating testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getRating(true); #endif } if (!m_rating.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter rating in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter rating has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter rating has not been defined in template %s!", DataResource::getName())); return base->getRating(); } } ArmorRating value = static_cast(m_rating.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -164,26 +164,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerArmorTemplate * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getIntegrity(true); #endif } if (!m_integrity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter integrity in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter integrity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter integrity has not been defined in template %s!", DataResource::getName())); return base->getIntegrity(); } } @@ -193,9 +193,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getIntegrity(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -212,7 +212,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -228,26 +228,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerArmorTemplate * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getIntegrityMin(true); #endif } if (!m_integrity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter integrity in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter integrity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter integrity has not been defined in template %s!", DataResource::getName())); return base->getIntegrityMin(); } } @@ -257,9 +257,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getIntegrityMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -276,7 +276,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -292,26 +292,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerArmorTemplate * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getIntegrityMax(true); #endif } if (!m_integrity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter integrity in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter integrity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter integrity has not been defined in template %s!", DataResource::getName())); return base->getIntegrityMax(); } } @@ -321,9 +321,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getIntegrityMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -340,7 +340,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -356,26 +356,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerArmorTemplate * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getEffectiveness(true); #endif } if (!m_effectiveness.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter effectiveness in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter effectiveness has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter effectiveness has not been defined in template %s!", DataResource::getName())); return base->getEffectiveness(); } } @@ -385,9 +385,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getEffectiveness(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -404,7 +404,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -420,26 +420,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerArmorTemplate * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getEffectivenessMin(true); #endif } if (!m_effectiveness.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter effectiveness in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter effectiveness has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter effectiveness has not been defined in template %s!", DataResource::getName())); return base->getEffectivenessMin(); } } @@ -449,9 +449,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getEffectivenessMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -468,7 +468,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -484,26 +484,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerArmorTemplate * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getEffectivenessMax(true); #endif } if (!m_effectiveness.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter effectiveness in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter effectiveness has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter effectiveness has not been defined in template %s!", DataResource::getName())); return base->getEffectivenessMax(); } } @@ -513,9 +513,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getEffectivenessMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -532,7 +532,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -542,28 +542,28 @@ UNREF(testData); void ServerArmorTemplate::getSpecialProtection(SpecialProtection &data, int index) const { - const ServerArmorTemplate * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_specialProtectionLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter specialProtection in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter specialProtection has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter specialProtection has not been defined in template %s!", DataResource::getName())); base->getSpecialProtection(data, index); return; } } - if (m_specialProtectionAppend && base != NULL) + if (m_specialProtectionAppend && base != nullptr) { int baseCount = base->getSpecialProtectionCount(); if (index < baseCount) @@ -585,28 +585,28 @@ void ServerArmorTemplate::getSpecialProtection(SpecialProtection &data, int inde void ServerArmorTemplate::getSpecialProtectionMin(SpecialProtection &data, int index) const { - const ServerArmorTemplate * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_specialProtectionLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter specialProtection in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter specialProtection has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter specialProtection has not been defined in template %s!", DataResource::getName())); base->getSpecialProtectionMin(data, index); return; } } - if (m_specialProtectionAppend && base != NULL) + if (m_specialProtectionAppend && base != nullptr) { int baseCount = base->getSpecialProtectionCount(); if (index < baseCount) @@ -628,28 +628,28 @@ void ServerArmorTemplate::getSpecialProtectionMin(SpecialProtection &data, int i void ServerArmorTemplate::getSpecialProtectionMax(SpecialProtection &data, int index) const { - const ServerArmorTemplate * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_specialProtectionLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter specialProtection in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter specialProtection has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter specialProtection has not been defined in template %s!", DataResource::getName())); base->getSpecialProtectionMax(data, index); return; } } - if (m_specialProtectionAppend && base != NULL) + if (m_specialProtectionAppend && base != nullptr) { int baseCount = base->getSpecialProtectionCount(); if (index < baseCount) @@ -673,20 +673,20 @@ size_t ServerArmorTemplate::getSpecialProtectionCount(void) const { if (!m_specialProtectionLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const ServerArmorTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getSpecialProtectionCount(); } size_t count = m_specialProtection.size(); // if we are extending our base template, add it's count - if (m_specialProtectionAppend && m_baseData != NULL) + if (m_specialProtectionAppend && m_baseData != nullptr) { const ServerArmorTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getSpecialProtectionCount(); } @@ -701,26 +701,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerArmorTemplate * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getVulnerability(true); #endif } if (!m_vulnerability.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter vulnerability in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter vulnerability has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter vulnerability has not been defined in template %s!", DataResource::getName())); return base->getVulnerability(); } } @@ -730,9 +730,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getVulnerability(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -749,7 +749,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -765,26 +765,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerArmorTemplate * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getVulnerabilityMin(true); #endif } if (!m_vulnerability.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter vulnerability in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter vulnerability has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter vulnerability has not been defined in template %s!", DataResource::getName())); return base->getVulnerabilityMin(); } } @@ -794,9 +794,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getVulnerabilityMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -813,7 +813,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -829,26 +829,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerArmorTemplate * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getVulnerabilityMax(true); #endif } if (!m_vulnerability.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter vulnerability in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter vulnerability has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter vulnerability has not been defined in template %s!", DataResource::getName())); return base->getVulnerabilityMax(); } } @@ -858,9 +858,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getVulnerabilityMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -877,7 +877,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -887,8 +887,8 @@ UNREF(testData); int ServerArmorTemplate::getEncumbrance(int index) const { - const ServerArmorTemplate * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -896,14 +896,14 @@ int ServerArmorTemplate::getEncumbrance(int index) const DEBUG_FATAL(index < 0 || index >= 3, ("template param index out of range")); if (!m_encumbrance[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter encumbrance in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter encumbrance has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter encumbrance has not been defined in template %s!", DataResource::getName())); return base->getEncumbrance(index); } } @@ -913,9 +913,9 @@ int ServerArmorTemplate::getEncumbrance(int index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getEncumbrance(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -936,8 +936,8 @@ int ServerArmorTemplate::getEncumbrance(int index) const int ServerArmorTemplate::getEncumbranceMin(int index) const { - const ServerArmorTemplate * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -945,14 +945,14 @@ int ServerArmorTemplate::getEncumbranceMin(int index) const DEBUG_FATAL(index < 0 || index >= 3, ("template param index out of range")); if (!m_encumbrance[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter encumbrance in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter encumbrance has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter encumbrance has not been defined in template %s!", DataResource::getName())); return base->getEncumbranceMin(index); } } @@ -962,9 +962,9 @@ int ServerArmorTemplate::getEncumbranceMin(int index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getEncumbranceMin(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -985,8 +985,8 @@ int ServerArmorTemplate::getEncumbranceMin(int index) const int ServerArmorTemplate::getEncumbranceMax(int index) const { - const ServerArmorTemplate * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -994,14 +994,14 @@ int ServerArmorTemplate::getEncumbranceMax(int index) const DEBUG_FATAL(index < 0 || index >= 3, ("template param index out of range")); if (!m_encumbrance[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter encumbrance in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter encumbrance has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter encumbrance has not been defined in template %s!", DataResource::getName())); return base->getEncumbranceMax(index); } } @@ -1011,9 +1011,9 @@ int ServerArmorTemplate::getEncumbranceMax(int index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getEncumbranceMax(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1074,12 +1074,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -1114,7 +1114,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_specialProtection.begin(); iter != m_specialProtection.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_specialProtection.clear(); m_specialProtectionAppend = file.read_bool8(); @@ -1205,33 +1205,33 @@ ServerArmorTemplate::DamageType testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getType(true); #endif } if (!m_type.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter type in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter type has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter type has not been defined in template %s!", DataResource::getName())); return base->getType(versionOk); } } DamageType value = static_cast(m_type.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1247,26 +1247,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerArmorTemplate::_SpecialProtection * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate::_SpecialProtection * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getEffectiveness(true); #endif } if (!m_effectiveness.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter effectiveness in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter effectiveness has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter effectiveness has not been defined in template %s!", DataResource::getName())); return base->getEffectiveness(versionOk); } } @@ -1276,9 +1276,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getEffectiveness(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1295,7 +1295,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1311,26 +1311,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerArmorTemplate::_SpecialProtection * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate::_SpecialProtection * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getEffectivenessMin(true); #endif } if (!m_effectiveness.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter effectiveness in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter effectiveness has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter effectiveness has not been defined in template %s!", DataResource::getName())); return base->getEffectivenessMin(versionOk); } } @@ -1340,9 +1340,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getEffectivenessMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1359,7 +1359,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1375,26 +1375,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerArmorTemplate::_SpecialProtection * base = NULL; - if (m_baseData != NULL) + const ServerArmorTemplate::_SpecialProtection * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getEffectivenessMax(true); #endif } if (!m_effectiveness.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter effectiveness in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter effectiveness has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter effectiveness has not been defined in template %s!", DataResource::getName())); return base->getEffectivenessMax(versionOk); } } @@ -1404,9 +1404,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getEffectivenessMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1423,7 +1423,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerBattlefieldMarkerObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerBattlefieldMarkerObjectTemplate.cpp index 98360e9b..0a63ff2d 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerBattlefieldMarkerObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerBattlefieldMarkerObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag ServerBattlefieldMarkerObjectTemplate::getTemplateVersion(void) const */ Tag ServerBattlefieldMarkerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerBattlefieldMarkerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerBattlefieldMarkerObjectTemplate::getHighestTemplateVersion @@ -150,12 +150,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerBuildingObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerBuildingObjectTemplate.cpp index 57086652..57d3ab90 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerBuildingObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerBuildingObjectTemplate.cpp @@ -93,10 +93,10 @@ Tag ServerBuildingObjectTemplate::getTemplateVersion(void) const */ Tag ServerBuildingObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerBuildingObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerBuildingObjectTemplate::getHighestTemplateVersion @@ -120,26 +120,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerBuildingObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerBuildingObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaintenanceCost(true); #endif } if (!m_maintenanceCost.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maintenanceCost in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maintenanceCost has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maintenanceCost has not been defined in template %s!", DataResource::getName())); return base->getMaintenanceCost(); } } @@ -149,9 +149,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaintenanceCost(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -168,7 +168,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -184,26 +184,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerBuildingObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerBuildingObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaintenanceCostMin(true); #endif } if (!m_maintenanceCost.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maintenanceCost in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maintenanceCost has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maintenanceCost has not been defined in template %s!", DataResource::getName())); return base->getMaintenanceCostMin(); } } @@ -213,9 +213,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaintenanceCostMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -232,7 +232,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -248,26 +248,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerBuildingObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerBuildingObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaintenanceCostMax(true); #endif } if (!m_maintenanceCost.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maintenanceCost in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maintenanceCost has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maintenanceCost has not been defined in template %s!", DataResource::getName())); return base->getMaintenanceCostMax(); } } @@ -277,9 +277,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaintenanceCostMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -296,7 +296,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -312,33 +312,33 @@ bool testDataValue = false; UNREF(testData); #endif - const ServerBuildingObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerBuildingObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getIsPublic(true); #endif } if (!m_isPublic.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter isPublic in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter isPublic has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter isPublic has not been defined in template %s!", DataResource::getName())); return base->getIsPublic(); } } bool value = m_isPublic.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -386,12 +386,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerCellObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerCellObjectTemplate.cpp index 5a35a6f9..0c39dc7c 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerCellObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerCellObjectTemplate.cpp @@ -99,10 +99,10 @@ Tag ServerCellObjectTemplate::getTemplateVersion(void) const */ Tag ServerCellObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerCellObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerCellObjectTemplate::getHighestTemplateVersion @@ -155,12 +155,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerCityObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerCityObjectTemplate.cpp index 0b59a960..0f328d56 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerCityObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerCityObjectTemplate.cpp @@ -95,10 +95,10 @@ Tag ServerCityObjectTemplate::getTemplateVersion(void) const */ Tag ServerCityObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerCityObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerCityObjectTemplate::getHighestTemplateVersion @@ -151,12 +151,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerConstructionContractObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerConstructionContractObjectTemplate.cpp index 6daeee45..ba882146 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerConstructionContractObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerConstructionContractObjectTemplate.cpp @@ -84,10 +84,10 @@ Tag ServerConstructionContractObjectTemplate::getTemplateVersion(void) const */ Tag ServerConstructionContractObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerConstructionContractObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerConstructionContractObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerCreatureObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerCreatureObjectTemplate.cpp index babf8d0a..f1be807d 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerCreatureObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerCreatureObjectTemplate.cpp @@ -56,7 +56,7 @@ ServerCreatureObjectTemplate::~ServerCreatureObjectTemplate() for (iter = m_attribMods.begin(); iter != m_attribMods.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_attribMods.clear(); } @@ -108,10 +108,10 @@ Tag ServerCreatureObjectTemplate::getTemplateVersion(void) const */ Tag ServerCreatureObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerCreatureObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerCreatureObjectTemplate::getHighestTemplateVersion @@ -129,32 +129,32 @@ Object * ServerCreatureObjectTemplate::createObject(void) const //@BEGIN TFD const ServerWeaponObjectTemplate * ServerCreatureObjectTemplate::getDefaultWeapon() const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_defaultWeapon.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter defaultWeapon in template %s", DataResource::getName())); - return NULL; + return nullptr; } else { - DEBUG_FATAL(base == NULL, ("Template parameter defaultWeapon has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter defaultWeapon has not been defined in template %s!", DataResource::getName())); return base->getDefaultWeapon(); } } - const ServerWeaponObjectTemplate * returnValue = NULL; + const ServerWeaponObjectTemplate * returnValue = nullptr; const std::string & templateName = m_defaultWeapon.getValue(); if (!templateName.empty()) { returnValue = dynamic_cast(ObjectTemplateList::fetch(templateName)); - if (returnValue == NULL) + if (returnValue == nullptr) WARNING_STRICT_FATAL(true, ("Error loading template %s",templateName.c_str())); } return returnValue; @@ -162,8 +162,8 @@ const ServerWeaponObjectTemplate * ServerCreatureObjectTemplate::getDefaultWeapo int ServerCreatureObjectTemplate::getAttributes(Attributes index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -171,14 +171,14 @@ int ServerCreatureObjectTemplate::getAttributes(Attributes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 6, ("template param static_cast(index) getAttributes(index); } } @@ -188,9 +188,9 @@ int ServerCreatureObjectTemplate::getAttributes(Attributes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAttributes(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -211,8 +211,8 @@ int ServerCreatureObjectTemplate::getAttributes(Attributes index) const int ServerCreatureObjectTemplate::getAttributesMin(Attributes index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -220,14 +220,14 @@ int ServerCreatureObjectTemplate::getAttributesMin(Attributes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 6, ("template param static_cast(index) getAttributesMin(index); } } @@ -237,9 +237,9 @@ int ServerCreatureObjectTemplate::getAttributesMin(Attributes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAttributesMin(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -260,8 +260,8 @@ int ServerCreatureObjectTemplate::getAttributesMin(Attributes index) const int ServerCreatureObjectTemplate::getAttributesMax(Attributes index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -269,14 +269,14 @@ int ServerCreatureObjectTemplate::getAttributesMax(Attributes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 6, ("template param static_cast(index) getAttributesMax(index); } } @@ -286,9 +286,9 @@ int ServerCreatureObjectTemplate::getAttributesMax(Attributes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAttributesMax(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -309,8 +309,8 @@ int ServerCreatureObjectTemplate::getAttributesMax(Attributes index) const int ServerCreatureObjectTemplate::getMinAttributes(Attributes index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -318,14 +318,14 @@ int ServerCreatureObjectTemplate::getMinAttributes(Attributes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 6, ("template param static_cast(index) getMinAttributes(index); } } @@ -335,9 +335,9 @@ int ServerCreatureObjectTemplate::getMinAttributes(Attributes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinAttributes(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -358,8 +358,8 @@ int ServerCreatureObjectTemplate::getMinAttributes(Attributes index) const int ServerCreatureObjectTemplate::getMinAttributesMin(Attributes index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -367,14 +367,14 @@ int ServerCreatureObjectTemplate::getMinAttributesMin(Attributes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 6, ("template param static_cast(index) getMinAttributesMin(index); } } @@ -384,9 +384,9 @@ int ServerCreatureObjectTemplate::getMinAttributesMin(Attributes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinAttributesMin(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -407,8 +407,8 @@ int ServerCreatureObjectTemplate::getMinAttributesMin(Attributes index) const int ServerCreatureObjectTemplate::getMinAttributesMax(Attributes index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -416,14 +416,14 @@ int ServerCreatureObjectTemplate::getMinAttributesMax(Attributes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 6, ("template param static_cast(index) getMinAttributesMax(index); } } @@ -433,9 +433,9 @@ int ServerCreatureObjectTemplate::getMinAttributesMax(Attributes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinAttributesMax(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -456,8 +456,8 @@ int ServerCreatureObjectTemplate::getMinAttributesMax(Attributes index) const int ServerCreatureObjectTemplate::getMaxAttributes(Attributes index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -465,14 +465,14 @@ int ServerCreatureObjectTemplate::getMaxAttributes(Attributes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 6, ("template param static_cast(index) getMaxAttributes(index); } } @@ -482,9 +482,9 @@ int ServerCreatureObjectTemplate::getMaxAttributes(Attributes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxAttributes(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -505,8 +505,8 @@ int ServerCreatureObjectTemplate::getMaxAttributes(Attributes index) const int ServerCreatureObjectTemplate::getMaxAttributesMin(Attributes index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -514,14 +514,14 @@ int ServerCreatureObjectTemplate::getMaxAttributesMin(Attributes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 6, ("template param static_cast(index) getMaxAttributesMin(index); } } @@ -531,9 +531,9 @@ int ServerCreatureObjectTemplate::getMaxAttributesMin(Attributes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxAttributesMin(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -554,8 +554,8 @@ int ServerCreatureObjectTemplate::getMaxAttributesMin(Attributes index) const int ServerCreatureObjectTemplate::getMaxAttributesMax(Attributes index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -563,14 +563,14 @@ int ServerCreatureObjectTemplate::getMaxAttributesMax(Attributes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 6, ("template param static_cast(index) getMaxAttributesMax(index); } } @@ -580,9 +580,9 @@ int ServerCreatureObjectTemplate::getMaxAttributesMax(Attributes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxAttributesMax(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -609,26 +609,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMinDrainModifier(true); #endif } if (!m_minDrainModifier.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter minDrainModifier in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter minDrainModifier has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter minDrainModifier has not been defined in template %s!", DataResource::getName())); return base->getMinDrainModifier(); } } @@ -638,9 +638,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinDrainModifier(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -657,7 +657,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -673,26 +673,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMinDrainModifierMin(true); #endif } if (!m_minDrainModifier.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter minDrainModifier in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter minDrainModifier has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter minDrainModifier has not been defined in template %s!", DataResource::getName())); return base->getMinDrainModifierMin(); } } @@ -702,9 +702,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinDrainModifierMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -721,7 +721,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -737,26 +737,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMinDrainModifierMax(true); #endif } if (!m_minDrainModifier.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter minDrainModifier in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter minDrainModifier has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter minDrainModifier has not been defined in template %s!", DataResource::getName())); return base->getMinDrainModifierMax(); } } @@ -766,9 +766,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinDrainModifierMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -785,7 +785,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -801,26 +801,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxDrainModifier(true); #endif } if (!m_maxDrainModifier.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxDrainModifier in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxDrainModifier has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxDrainModifier has not been defined in template %s!", DataResource::getName())); return base->getMaxDrainModifier(); } } @@ -830,9 +830,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxDrainModifier(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -849,7 +849,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -865,26 +865,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxDrainModifierMin(true); #endif } if (!m_maxDrainModifier.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxDrainModifier in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxDrainModifier has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxDrainModifier has not been defined in template %s!", DataResource::getName())); return base->getMaxDrainModifierMin(); } } @@ -894,9 +894,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxDrainModifierMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -913,7 +913,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -929,26 +929,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxDrainModifierMax(true); #endif } if (!m_maxDrainModifier.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxDrainModifier in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxDrainModifier has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxDrainModifier has not been defined in template %s!", DataResource::getName())); return base->getMaxDrainModifierMax(); } } @@ -958,9 +958,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxDrainModifierMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -977,7 +977,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -993,26 +993,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMinFaucetModifier(true); #endif } if (!m_minFaucetModifier.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter minFaucetModifier in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter minFaucetModifier has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter minFaucetModifier has not been defined in template %s!", DataResource::getName())); return base->getMinFaucetModifier(); } } @@ -1022,9 +1022,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinFaucetModifier(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1041,7 +1041,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1057,26 +1057,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMinFaucetModifierMin(true); #endif } if (!m_minFaucetModifier.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter minFaucetModifier in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter minFaucetModifier has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter minFaucetModifier has not been defined in template %s!", DataResource::getName())); return base->getMinFaucetModifierMin(); } } @@ -1086,9 +1086,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinFaucetModifierMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1105,7 +1105,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1121,26 +1121,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMinFaucetModifierMax(true); #endif } if (!m_minFaucetModifier.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter minFaucetModifier in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter minFaucetModifier has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter minFaucetModifier has not been defined in template %s!", DataResource::getName())); return base->getMinFaucetModifierMax(); } } @@ -1150,9 +1150,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinFaucetModifierMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1169,7 +1169,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1185,26 +1185,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxFaucetModifier(true); #endif } if (!m_maxFaucetModifier.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxFaucetModifier in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxFaucetModifier has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxFaucetModifier has not been defined in template %s!", DataResource::getName())); return base->getMaxFaucetModifier(); } } @@ -1214,9 +1214,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxFaucetModifier(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1233,7 +1233,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1249,26 +1249,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxFaucetModifierMin(true); #endif } if (!m_maxFaucetModifier.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxFaucetModifier in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxFaucetModifier has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxFaucetModifier has not been defined in template %s!", DataResource::getName())); return base->getMaxFaucetModifierMin(); } } @@ -1278,9 +1278,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxFaucetModifierMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1297,7 +1297,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1313,26 +1313,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxFaucetModifierMax(true); #endif } if (!m_maxFaucetModifier.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxFaucetModifier in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxFaucetModifier has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxFaucetModifier has not been defined in template %s!", DataResource::getName())); return base->getMaxFaucetModifierMax(); } } @@ -1342,9 +1342,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxFaucetModifierMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1361,7 +1361,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1371,28 +1371,28 @@ UNREF(testData); void ServerCreatureObjectTemplate::getAttribMods(AttribMod &data, int index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_attribModsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attribMods in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter attribMods has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attribMods has not been defined in template %s!", DataResource::getName())); base->getAttribMods(data, index); return; } } - if (m_attribModsAppend && base != NULL) + if (m_attribModsAppend && base != nullptr) { int baseCount = base->getAttribModsCount(); if (static_cast(index) < baseCount) @@ -1417,28 +1417,28 @@ void ServerCreatureObjectTemplate::getAttribMods(AttribMod &data, int index) con void ServerCreatureObjectTemplate::getAttribModsMin(AttribMod &data, int index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_attribModsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attribMods in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter attribMods has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attribMods has not been defined in template %s!", DataResource::getName())); base->getAttribModsMin(data, index); return; } } - if (m_attribModsAppend && base != NULL) + if (m_attribModsAppend && base != nullptr) { int baseCount = base->getAttribModsCount(); if (static_cast(index) < baseCount) @@ -1463,28 +1463,28 @@ void ServerCreatureObjectTemplate::getAttribModsMin(AttribMod &data, int index) void ServerCreatureObjectTemplate::getAttribModsMax(AttribMod &data, int index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_attribModsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attribMods in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter attribMods has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attribMods has not been defined in template %s!", DataResource::getName())); base->getAttribModsMax(data, index); return; } } - if (m_attribModsAppend && base != NULL) + if (m_attribModsAppend && base != nullptr) { int baseCount = base->getAttribModsCount(); if (static_cast(index) < baseCount) @@ -1511,20 +1511,20 @@ size_t ServerCreatureObjectTemplate::getAttribModsCount(void) const { if (!m_attribModsLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const ServerCreatureObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getAttribModsCount(); } size_t count = m_attribMods.size(); // if we are extending our base template, add it's count - if (m_attribModsAppend && m_baseData != NULL) + if (m_attribModsAppend && m_baseData != nullptr) { const ServerCreatureObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getAttribModsCount(); } @@ -1539,26 +1539,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getShockWounds(true); #endif } if (!m_shockWounds.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter shockWounds in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter shockWounds has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter shockWounds has not been defined in template %s!", DataResource::getName())); return base->getShockWounds(); } } @@ -1568,9 +1568,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getShockWounds(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1587,7 +1587,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1603,26 +1603,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getShockWoundsMin(true); #endif } if (!m_shockWounds.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter shockWounds in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter shockWounds has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter shockWounds has not been defined in template %s!", DataResource::getName())); return base->getShockWoundsMin(); } } @@ -1632,9 +1632,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getShockWoundsMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1651,7 +1651,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1667,26 +1667,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getShockWoundsMax(true); #endif } if (!m_shockWounds.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter shockWounds in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter shockWounds has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter shockWounds has not been defined in template %s!", DataResource::getName())); return base->getShockWoundsMax(); } } @@ -1696,9 +1696,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getShockWoundsMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1715,7 +1715,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1731,33 +1731,33 @@ bool testDataValue = false; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCanCreateAvatar(true); #endif } if (!m_canCreateAvatar.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter canCreateAvatar in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter canCreateAvatar has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter canCreateAvatar has not been defined in template %s!", DataResource::getName())); return base->getCanCreateAvatar(); } } bool value = m_canCreateAvatar.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1773,33 +1773,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getNameGeneratorType(true); #endif } if (!m_nameGeneratorType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter nameGeneratorType in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter nameGeneratorType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter nameGeneratorType has not been defined in template %s!", DataResource::getName())); return base->getNameGeneratorType(); } } const std::string & value = m_nameGeneratorType.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1815,26 +1815,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getApproachTriggerRange(true); #endif } if (!m_approachTriggerRange.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter approachTriggerRange in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter approachTriggerRange has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter approachTriggerRange has not been defined in template %s!", DataResource::getName())); return base->getApproachTriggerRange(); } } @@ -1844,9 +1844,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getApproachTriggerRange(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1863,7 +1863,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1879,26 +1879,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getApproachTriggerRangeMin(true); #endif } if (!m_approachTriggerRange.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter approachTriggerRange in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter approachTriggerRange has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter approachTriggerRange has not been defined in template %s!", DataResource::getName())); return base->getApproachTriggerRangeMin(); } } @@ -1908,9 +1908,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getApproachTriggerRangeMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1927,7 +1927,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1943,26 +1943,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getApproachTriggerRangeMax(true); #endif } if (!m_approachTriggerRange.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter approachTriggerRange in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter approachTriggerRange has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter approachTriggerRange has not been defined in template %s!", DataResource::getName())); return base->getApproachTriggerRangeMax(); } } @@ -1972,9 +1972,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getApproachTriggerRangeMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1991,7 +1991,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2001,8 +2001,8 @@ UNREF(testData); float ServerCreatureObjectTemplate::getMaxMentalStates(MentalStates index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -2010,14 +2010,14 @@ float ServerCreatureObjectTemplate::getMaxMentalStates(MentalStates index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 4, ("template param static_cast(index) getMaxMentalStates(index); } } @@ -2027,9 +2027,9 @@ float ServerCreatureObjectTemplate::getMaxMentalStates(MentalStates index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxMentalStates(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2050,8 +2050,8 @@ float ServerCreatureObjectTemplate::getMaxMentalStates(MentalStates index) const float ServerCreatureObjectTemplate::getMaxMentalStatesMin(MentalStates index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -2059,14 +2059,14 @@ float ServerCreatureObjectTemplate::getMaxMentalStatesMin(MentalStates index) co DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 4, ("template param static_cast(index) getMaxMentalStatesMin(index); } } @@ -2076,9 +2076,9 @@ float ServerCreatureObjectTemplate::getMaxMentalStatesMin(MentalStates index) co if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxMentalStatesMin(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2099,8 +2099,8 @@ float ServerCreatureObjectTemplate::getMaxMentalStatesMin(MentalStates index) co float ServerCreatureObjectTemplate::getMaxMentalStatesMax(MentalStates index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -2108,14 +2108,14 @@ float ServerCreatureObjectTemplate::getMaxMentalStatesMax(MentalStates index) co DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 4, ("template param static_cast(index) getMaxMentalStatesMax(index); } } @@ -2125,9 +2125,9 @@ float ServerCreatureObjectTemplate::getMaxMentalStatesMax(MentalStates index) co if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxMentalStatesMax(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2148,8 +2148,8 @@ float ServerCreatureObjectTemplate::getMaxMentalStatesMax(MentalStates index) co float ServerCreatureObjectTemplate::getMentalStatesDecay(MentalStates index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -2157,14 +2157,14 @@ float ServerCreatureObjectTemplate::getMentalStatesDecay(MentalStates index) con DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 4, ("template param static_cast(index) getMentalStatesDecay(index); } } @@ -2174,9 +2174,9 @@ float ServerCreatureObjectTemplate::getMentalStatesDecay(MentalStates index) con if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMentalStatesDecay(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2197,8 +2197,8 @@ float ServerCreatureObjectTemplate::getMentalStatesDecay(MentalStates index) con float ServerCreatureObjectTemplate::getMentalStatesDecayMin(MentalStates index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -2206,14 +2206,14 @@ float ServerCreatureObjectTemplate::getMentalStatesDecayMin(MentalStates index) DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 4, ("template param static_cast(index) getMentalStatesDecayMin(index); } } @@ -2223,9 +2223,9 @@ float ServerCreatureObjectTemplate::getMentalStatesDecayMin(MentalStates index) if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMentalStatesDecayMin(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2246,8 +2246,8 @@ float ServerCreatureObjectTemplate::getMentalStatesDecayMin(MentalStates index) float ServerCreatureObjectTemplate::getMentalStatesDecayMax(MentalStates index) const { - const ServerCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -2255,14 +2255,14 @@ float ServerCreatureObjectTemplate::getMentalStatesDecayMax(MentalStates index) DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 4, ("template param static_cast(index) getMentalStatesDecayMax(index); } } @@ -2272,9 +2272,9 @@ float ServerCreatureObjectTemplate::getMentalStatesDecayMax(MentalStates index) if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMentalStatesDecayMax(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2344,12 +2344,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -2430,7 +2430,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_attribMods.begin(); iter != m_attribMods.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_attribMods.clear(); m_attribModsAppend = file.read_bool8(); diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerDraftSchematicObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerDraftSchematicObjectTemplate.cpp index 6ed8a518..5cfd4169 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerDraftSchematicObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerDraftSchematicObjectTemplate.cpp @@ -58,7 +58,7 @@ ServerDraftSchematicObjectTemplate::~ServerDraftSchematicObjectTemplate() for (iter = m_slots.begin(); iter != m_slots.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_slots.clear(); } @@ -67,7 +67,7 @@ ServerDraftSchematicObjectTemplate::~ServerDraftSchematicObjectTemplate() for (iter = m_skillCommands.begin(); iter != m_skillCommands.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_skillCommands.clear(); } @@ -76,7 +76,7 @@ ServerDraftSchematicObjectTemplate::~ServerDraftSchematicObjectTemplate() for (iter = m_manufactureScripts.begin(); iter != m_manufactureScripts.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_manufactureScripts.clear(); } @@ -128,10 +128,10 @@ Tag ServerDraftSchematicObjectTemplate::getTemplateVersion(void) const */ Tag ServerDraftSchematicObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerDraftSchematicObjectTemplate::getHighestTemplateVersion @@ -152,7 +152,7 @@ Object * ServerDraftSchematicObjectTemplate::createObject(void) const WARNING(true, ("Trying to create a draft schematic %s outside the draft " "schematic factory!\n", getName())); - return NULL; + return nullptr; } // ServerDraftSchematicObjectTemplate::createObject /** @@ -188,33 +188,33 @@ ServerDraftSchematicObjectTemplate::CraftingType testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCategory(true); #endif } if (!m_category.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter category in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter category has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter category has not been defined in template %s!", DataResource::getName())); return base->getCategory(); } } CraftingType value = static_cast(m_category.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -224,86 +224,86 @@ UNREF(testData); const ServerObjectTemplate * ServerDraftSchematicObjectTemplate::getCraftedObjectTemplate() const { - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_craftedObjectTemplate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter craftedObjectTemplate in template %s", DataResource::getName())); - return NULL; + return nullptr; } else { - DEBUG_FATAL(base == NULL, ("Template parameter craftedObjectTemplate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter craftedObjectTemplate has not been defined in template %s!", DataResource::getName())); return base->getCraftedObjectTemplate(); } } const std::string & templateName = m_craftedObjectTemplate.getValue(); const ServerObjectTemplate * returnValue = dynamic_cast(ObjectTemplateList::fetch(templateName)); - if (returnValue == NULL) + if (returnValue == nullptr) WARNING_STRICT_FATAL(true, ("Error loading template %s",templateName.c_str())); return returnValue; } // ServerDraftSchematicObjectTemplate::getCraftedObjectTemplate const ServerFactoryObjectTemplate * ServerDraftSchematicObjectTemplate::getCrateObjectTemplate() const { - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_crateObjectTemplate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter crateObjectTemplate in template %s", DataResource::getName())); - return NULL; + return nullptr; } else { - DEBUG_FATAL(base == NULL, ("Template parameter crateObjectTemplate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter crateObjectTemplate has not been defined in template %s!", DataResource::getName())); return base->getCrateObjectTemplate(); } } const std::string & templateName = m_crateObjectTemplate.getValue(); const ServerFactoryObjectTemplate * returnValue = dynamic_cast(ObjectTemplateList::fetch(templateName)); - if (returnValue == NULL) + if (returnValue == nullptr) WARNING_STRICT_FATAL(true, ("Error loading template %s",templateName.c_str())); return returnValue; } // ServerDraftSchematicObjectTemplate::getCrateObjectTemplate void ServerDraftSchematicObjectTemplate::getSlots(IngredientSlot &data, int index) const { - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_slotsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slots in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slots has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slots has not been defined in template %s!", DataResource::getName())); base->getSlots(data, index); return; } } - if (m_slotsAppend && base != NULL) + if (m_slotsAppend && base != nullptr) { int baseCount = base->getSlotsCount(); if (index < baseCount) @@ -335,28 +335,28 @@ void ServerDraftSchematicObjectTemplate::getSlots(IngredientSlot &data, int inde void ServerDraftSchematicObjectTemplate::getSlotsMin(IngredientSlot &data, int index) const { - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_slotsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slots in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slots has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slots has not been defined in template %s!", DataResource::getName())); base->getSlotsMin(data, index); return; } } - if (m_slotsAppend && base != NULL) + if (m_slotsAppend && base != nullptr) { int baseCount = base->getSlotsCount(); if (index < baseCount) @@ -388,28 +388,28 @@ void ServerDraftSchematicObjectTemplate::getSlotsMin(IngredientSlot &data, int i void ServerDraftSchematicObjectTemplate::getSlotsMax(IngredientSlot &data, int index) const { - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_slotsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slots in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slots has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slots has not been defined in template %s!", DataResource::getName())); base->getSlotsMax(data, index); return; } } - if (m_slotsAppend && base != NULL) + if (m_slotsAppend && base != nullptr) { int baseCount = base->getSlotsCount(); if (index < baseCount) @@ -443,20 +443,20 @@ size_t ServerDraftSchematicObjectTemplate::getSlotsCount(void) const { if (!m_slotsLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const ServerDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getSlotsCount(); } size_t count = m_slots.size(); // if we are extending our base template, add it's count - if (m_slotsAppend && m_baseData != NULL) + if (m_slotsAppend && m_baseData != nullptr) { const ServerDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getSlotsCount(); } @@ -465,27 +465,27 @@ size_t ServerDraftSchematicObjectTemplate::getSlotsCount(void) const const std::string & ServerDraftSchematicObjectTemplate::getSkillCommands(int index) const { - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_skillCommandsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter skillCommands in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter skillCommands has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter skillCommands has not been defined in template %s!", DataResource::getName())); return base->getSkillCommands(index); } } - if (m_skillCommandsAppend && base != NULL) + if (m_skillCommandsAppend && base != nullptr) { int baseCount = base->getSkillCommandsCount(); if (index < baseCount) @@ -502,20 +502,20 @@ size_t ServerDraftSchematicObjectTemplate::getSkillCommandsCount(void) const { if (!m_skillCommandsLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const ServerDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getSkillCommandsCount(); } size_t count = m_skillCommands.size(); // if we are extending our base template, add it's count - if (m_skillCommandsAppend && m_baseData != NULL) + if (m_skillCommandsAppend && m_baseData != nullptr) { const ServerDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getSkillCommandsCount(); } @@ -530,33 +530,33 @@ bool testDataValue = false; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDestroyIngredients(true); #endif } if (!m_destroyIngredients.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter destroyIngredients in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter destroyIngredients has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter destroyIngredients has not been defined in template %s!", DataResource::getName())); return base->getDestroyIngredients(); } } bool value = m_destroyIngredients.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -566,27 +566,27 @@ UNREF(testData); const std::string & ServerDraftSchematicObjectTemplate::getManufactureScripts(int index) const { - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_manufactureScriptsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter manufactureScripts in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter manufactureScripts has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter manufactureScripts has not been defined in template %s!", DataResource::getName())); return base->getManufactureScripts(index); } } - if (m_manufactureScriptsAppend && base != NULL) + if (m_manufactureScriptsAppend && base != nullptr) { int baseCount = base->getManufactureScriptsCount(); if (index < baseCount) @@ -603,20 +603,20 @@ size_t ServerDraftSchematicObjectTemplate::getManufactureScriptsCount(void) cons { if (!m_manufactureScriptsLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const ServerDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getManufactureScriptsCount(); } size_t count = m_manufactureScripts.size(); // if we are extending our base template, add it's count - if (m_manufactureScriptsAppend && m_baseData != NULL) + if (m_manufactureScriptsAppend && m_baseData != nullptr) { const ServerDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getManufactureScriptsCount(); } @@ -631,26 +631,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getItemsPerContainer(true); #endif } if (!m_itemsPerContainer.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter itemsPerContainer in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter itemsPerContainer has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter itemsPerContainer has not been defined in template %s!", DataResource::getName())); return base->getItemsPerContainer(); } } @@ -660,9 +660,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getItemsPerContainer(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -679,7 +679,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -695,26 +695,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getItemsPerContainerMin(true); #endif } if (!m_itemsPerContainer.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter itemsPerContainer in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter itemsPerContainer has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter itemsPerContainer has not been defined in template %s!", DataResource::getName())); return base->getItemsPerContainerMin(); } } @@ -724,9 +724,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getItemsPerContainerMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -743,7 +743,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -759,26 +759,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getItemsPerContainerMax(true); #endif } if (!m_itemsPerContainer.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter itemsPerContainer in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter itemsPerContainer has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter itemsPerContainer has not been defined in template %s!", DataResource::getName())); return base->getItemsPerContainerMax(); } } @@ -788,9 +788,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getItemsPerContainerMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -807,7 +807,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -823,26 +823,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getManufactureTime(true); #endif } if (!m_manufactureTime.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter manufactureTime in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter manufactureTime has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter manufactureTime has not been defined in template %s!", DataResource::getName())); return base->getManufactureTime(); } } @@ -852,9 +852,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getManufactureTime(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -871,7 +871,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -887,26 +887,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getManufactureTimeMin(true); #endif } if (!m_manufactureTime.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter manufactureTime in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter manufactureTime has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter manufactureTime has not been defined in template %s!", DataResource::getName())); return base->getManufactureTimeMin(); } } @@ -916,9 +916,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getManufactureTimeMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -935,7 +935,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -951,26 +951,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getManufactureTimeMax(true); #endif } if (!m_manufactureTime.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter manufactureTime in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter manufactureTime has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter manufactureTime has not been defined in template %s!", DataResource::getName())); return base->getManufactureTimeMax(); } } @@ -980,9 +980,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getManufactureTimeMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -999,7 +999,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1015,26 +1015,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getPrototypeTime(true); #endif } if (!m_prototypeTime.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter prototypeTime in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter prototypeTime has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter prototypeTime has not been defined in template %s!", DataResource::getName())); return base->getPrototypeTime(); } } @@ -1044,9 +1044,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getPrototypeTime(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1063,7 +1063,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1079,26 +1079,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getPrototypeTimeMin(true); #endif } if (!m_prototypeTime.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter prototypeTime in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter prototypeTime has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter prototypeTime has not been defined in template %s!", DataResource::getName())); return base->getPrototypeTimeMin(); } } @@ -1108,9 +1108,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getPrototypeTimeMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1127,7 +1127,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1143,26 +1143,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getPrototypeTimeMax(true); #endif } if (!m_prototypeTime.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter prototypeTime in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter prototypeTime has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter prototypeTime has not been defined in template %s!", DataResource::getName())); return base->getPrototypeTimeMax(); } } @@ -1172,9 +1172,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getPrototypeTimeMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1191,7 +1191,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1244,12 +1244,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -1284,7 +1284,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_slots.begin(); iter != m_slots.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_slots.clear(); m_slotsAppend = file.read_bool8(); @@ -1303,7 +1303,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_skillCommands.begin(); iter != m_skillCommands.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_skillCommands.clear(); m_skillCommandsAppend = file.read_bool8(); @@ -1324,7 +1324,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_manufactureScripts.begin(); iter != m_manufactureScripts.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_manufactureScripts.clear(); m_manufactureScriptsAppend = file.read_bool8(); @@ -1376,7 +1376,7 @@ ServerDraftSchematicObjectTemplate::_IngredientSlot::~_IngredientSlot() for (iter = m_options.begin(); iter != m_options.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_options.clear(); } @@ -1418,33 +1418,33 @@ bool testDataValue = false; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getOptional(true); #endif } if (!m_optional.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter optional in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter optional has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter optional has not been defined in template %s!", DataResource::getName())); return base->getOptional(versionOk); } } bool value = m_optional.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1460,33 +1460,33 @@ StringId testDataValue = DefaultStringId; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getName(true); #endif } if (!m_name.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter name in template %s", DataResource::getName())); return DefaultStringId; } else { - DEBUG_FATAL(base == NULL, ("Template parameter name has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter name has not been defined in template %s!", DataResource::getName())); return base->getName(versionOk); } } const StringId value = m_name.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1496,28 +1496,28 @@ UNREF(testData); void ServerDraftSchematicObjectTemplate::_IngredientSlot::getOptions(Ingredient &data, int index, bool versionOk) const { - const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_optionsLoaded) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter options in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter options has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter options has not been defined in template %s!", DataResource::getName())); base->getOptions(data, index, versionOk); return; } } - if (m_optionsAppend && base != NULL) + if (m_optionsAppend && base != nullptr) { int baseCount = base->getOptionsCount(); if (index < baseCount) @@ -1547,28 +1547,28 @@ void ServerDraftSchematicObjectTemplate::_IngredientSlot::getOptions(Ingredient void ServerDraftSchematicObjectTemplate::_IngredientSlot::getOptionsMin(Ingredient &data, int index, bool versionOk) const { - const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_optionsLoaded) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter options in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter options has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter options has not been defined in template %s!", DataResource::getName())); base->getOptionsMin(data, index, versionOk); return; } } - if (m_optionsAppend && base != NULL) + if (m_optionsAppend && base != nullptr) { int baseCount = base->getOptionsCount(); if (index < baseCount) @@ -1598,28 +1598,28 @@ void ServerDraftSchematicObjectTemplate::_IngredientSlot::getOptionsMin(Ingredie void ServerDraftSchematicObjectTemplate::_IngredientSlot::getOptionsMax(Ingredient &data, int index, bool versionOk) const { - const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_optionsLoaded) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter options in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter options has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter options has not been defined in template %s!", DataResource::getName())); base->getOptionsMax(data, index, versionOk); return; } } - if (m_optionsAppend && base != NULL) + if (m_optionsAppend && base != nullptr) { int baseCount = base->getOptionsCount(); if (index < baseCount) @@ -1651,20 +1651,20 @@ size_t ServerDraftSchematicObjectTemplate::_IngredientSlot::getOptionsCount(void { if (!m_optionsLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getOptionsCount(); } size_t count = m_options.size(); // if we are extending our base template, add it's count - if (m_optionsAppend && m_baseData != NULL) + if (m_optionsAppend && m_baseData != nullptr) { const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getOptionsCount(); } @@ -1679,33 +1679,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getOptionalSkillCommand(true); #endif } if (!m_optionalSkillCommand.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter optionalSkillCommand in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter optionalSkillCommand has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter optionalSkillCommand has not been defined in template %s!", DataResource::getName())); return base->getOptionalSkillCommand(versionOk); } } const std::string & value = m_optionalSkillCommand.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1721,26 +1721,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getComplexity(true); #endif } if (!m_complexity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter complexity in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); return base->getComplexity(versionOk); } } @@ -1750,9 +1750,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getComplexity(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1769,7 +1769,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1785,26 +1785,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getComplexityMin(true); #endif } if (!m_complexity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter complexity in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); return base->getComplexityMin(versionOk); } } @@ -1814,9 +1814,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getComplexityMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1833,7 +1833,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1849,26 +1849,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getComplexityMax(true); #endif } if (!m_complexity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter complexity in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); return base->getComplexityMax(versionOk); } } @@ -1878,9 +1878,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getComplexityMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1897,7 +1897,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1913,33 +1913,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = NULL; - if (m_baseData != NULL) + const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAppearance(true); #endif } if (!m_appearance.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter appearance in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter appearance has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter appearance has not been defined in template %s!", DataResource::getName())); return base->getAppearance(versionOk); } } const std::string & value = m_appearance.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1992,7 +1992,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_options.begin(); iter != m_options.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_options.clear(); m_optionsAppend = file.read_bool8(); diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerFactoryObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerFactoryObjectTemplate.cpp index 413f930b..21075a19 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerFactoryObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerFactoryObjectTemplate.cpp @@ -93,10 +93,10 @@ Tag ServerFactoryObjectTemplate::getTemplateVersion(void) const */ Tag ServerFactoryObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerFactoryObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerFactoryObjectTemplate::getHighestTemplateVersion @@ -149,12 +149,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerGroupObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerGroupObjectTemplate.cpp index 9f63f2db..d026ef4f 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerGroupObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerGroupObjectTemplate.cpp @@ -95,10 +95,10 @@ Tag ServerGroupObjectTemplate::getTemplateVersion(void) const */ Tag ServerGroupObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerGroupObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerGroupObjectTemplate::getHighestTemplateVersion @@ -151,12 +151,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerGuildObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerGuildObjectTemplate.cpp index 00d26b3f..d7a9bcef 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerGuildObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerGuildObjectTemplate.cpp @@ -95,10 +95,10 @@ Tag ServerGuildObjectTemplate::getTemplateVersion(void) const */ Tag ServerGuildObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerGuildObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerGuildObjectTemplate::getHighestTemplateVersion @@ -151,12 +151,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerHarvesterInstallationObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerHarvesterInstallationObjectTemplate.cpp index a226afb3..16bf4a31 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerHarvesterInstallationObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerHarvesterInstallationObjectTemplate.cpp @@ -93,10 +93,10 @@ Tag ServerHarvesterInstallationObjectTemplate::getTemplateVersion(void) const */ Tag ServerHarvesterInstallationObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerHarvesterInstallationObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerHarvesterInstallationObjectTemplate::getHighestTemplateVersion @@ -120,26 +120,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerHarvesterInstallationObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerHarvesterInstallationObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxExtractionRate(true); #endif } if (!m_maxExtractionRate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxExtractionRate in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxExtractionRate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxExtractionRate has not been defined in template %s!", DataResource::getName())); return base->getMaxExtractionRate(); } } @@ -149,9 +149,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxExtractionRate(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -168,7 +168,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -184,26 +184,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerHarvesterInstallationObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerHarvesterInstallationObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxExtractionRateMin(true); #endif } if (!m_maxExtractionRate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxExtractionRate in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxExtractionRate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxExtractionRate has not been defined in template %s!", DataResource::getName())); return base->getMaxExtractionRateMin(); } } @@ -213,9 +213,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxExtractionRateMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -232,7 +232,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -248,26 +248,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerHarvesterInstallationObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerHarvesterInstallationObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxExtractionRateMax(true); #endif } if (!m_maxExtractionRate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxExtractionRate in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxExtractionRate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxExtractionRate has not been defined in template %s!", DataResource::getName())); return base->getMaxExtractionRateMax(); } } @@ -277,9 +277,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxExtractionRateMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -296,7 +296,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -312,26 +312,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerHarvesterInstallationObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerHarvesterInstallationObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCurrentExtractionRate(true); #endif } if (!m_currentExtractionRate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter currentExtractionRate in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter currentExtractionRate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter currentExtractionRate has not been defined in template %s!", DataResource::getName())); return base->getCurrentExtractionRate(); } } @@ -341,9 +341,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCurrentExtractionRate(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -360,7 +360,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -376,26 +376,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerHarvesterInstallationObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerHarvesterInstallationObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCurrentExtractionRateMin(true); #endif } if (!m_currentExtractionRate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter currentExtractionRate in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter currentExtractionRate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter currentExtractionRate has not been defined in template %s!", DataResource::getName())); return base->getCurrentExtractionRateMin(); } } @@ -405,9 +405,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCurrentExtractionRateMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -424,7 +424,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -440,26 +440,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerHarvesterInstallationObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerHarvesterInstallationObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCurrentExtractionRateMax(true); #endif } if (!m_currentExtractionRate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter currentExtractionRate in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter currentExtractionRate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter currentExtractionRate has not been defined in template %s!", DataResource::getName())); return base->getCurrentExtractionRateMax(); } } @@ -469,9 +469,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCurrentExtractionRateMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -488,7 +488,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -504,26 +504,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerHarvesterInstallationObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerHarvesterInstallationObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxHopperSize(true); #endif } if (!m_maxHopperSize.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxHopperSize in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxHopperSize has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxHopperSize has not been defined in template %s!", DataResource::getName())); return base->getMaxHopperSize(); } } @@ -533,9 +533,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxHopperSize(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -552,7 +552,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -568,26 +568,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerHarvesterInstallationObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerHarvesterInstallationObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxHopperSizeMin(true); #endif } if (!m_maxHopperSize.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxHopperSize in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxHopperSize has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxHopperSize has not been defined in template %s!", DataResource::getName())); return base->getMaxHopperSizeMin(); } } @@ -597,9 +597,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxHopperSizeMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -616,7 +616,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -632,26 +632,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerHarvesterInstallationObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerHarvesterInstallationObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxHopperSizeMax(true); #endif } if (!m_maxHopperSize.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxHopperSize in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxHopperSize has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxHopperSize has not been defined in template %s!", DataResource::getName())); return base->getMaxHopperSizeMax(); } } @@ -661,9 +661,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxHopperSizeMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -680,7 +680,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -696,33 +696,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerHarvesterInstallationObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerHarvesterInstallationObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMasterClassName(true); #endif } if (!m_masterClassName.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter masterClassName in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter masterClassName has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter masterClassName has not been defined in template %s!", DataResource::getName())); return base->getMasterClassName(); } } const std::string & value = m_masterClassName.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -774,12 +774,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerInstallationObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerInstallationObjectTemplate.cpp index ad1661bb..8bb94ce5 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerInstallationObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerInstallationObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag ServerInstallationObjectTemplate::getTemplateVersion(void) const */ Tag ServerInstallationObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerInstallationObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerInstallationObjectTemplate::getHighestTemplateVersion @@ -150,12 +150,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerIntangibleObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerIntangibleObjectTemplate.cpp index 992bf06d..18cce6b3 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerIntangibleObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerIntangibleObjectTemplate.cpp @@ -93,10 +93,10 @@ Tag ServerIntangibleObjectTemplate::getTemplateVersion(void) const */ Tag ServerIntangibleObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerIntangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerIntangibleObjectTemplate::getHighestTemplateVersion @@ -120,26 +120,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerIntangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCount(true); #endif } if (!m_count.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter count in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter count has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter count has not been defined in template %s!", DataResource::getName())); return base->getCount(); } } @@ -149,9 +149,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCount(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -168,7 +168,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -184,26 +184,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerIntangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCountMin(true); #endif } if (!m_count.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter count in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter count has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter count has not been defined in template %s!", DataResource::getName())); return base->getCountMin(); } } @@ -213,9 +213,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCountMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -232,7 +232,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -248,26 +248,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerIntangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCountMax(true); #endif } if (!m_count.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter count in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter count has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter count has not been defined in template %s!", DataResource::getName())); return base->getCountMax(); } } @@ -277,9 +277,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCountMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -296,7 +296,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -343,12 +343,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -406,7 +406,7 @@ ServerIntangibleObjectTemplate::_Ingredient::~_Ingredient() for (iter = m_ingredients.begin(); iter != m_ingredients.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_ingredients.clear(); } @@ -448,33 +448,33 @@ ServerIntangibleObjectTemplate::IngredientType testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getIngredientType(true); #endif } if (!m_ingredientType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredientType in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter ingredientType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter ingredientType has not been defined in template %s!", DataResource::getName())); return base->getIngredientType(versionOk); } } IngredientType value = static_cast(m_ingredientType.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -484,28 +484,28 @@ UNREF(testData); void ServerIntangibleObjectTemplate::_Ingredient::getIngredients(SimpleIngredient &data, int index, bool versionOk) const { - const ServerIntangibleObjectTemplate::_Ingredient * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate::_Ingredient * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_ingredientsLoaded) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredients in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter ingredients has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter ingredients has not been defined in template %s!", DataResource::getName())); base->getIngredients(data, index, versionOk); return; } } - if (m_ingredientsAppend && base != NULL) + if (m_ingredientsAppend && base != nullptr) { int baseCount = base->getIngredientsCount(); if (index < baseCount) @@ -528,28 +528,28 @@ void ServerIntangibleObjectTemplate::_Ingredient::getIngredients(SimpleIngredien void ServerIntangibleObjectTemplate::_Ingredient::getIngredientsMin(SimpleIngredient &data, int index, bool versionOk) const { - const ServerIntangibleObjectTemplate::_Ingredient * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate::_Ingredient * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_ingredientsLoaded) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredients in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter ingredients has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter ingredients has not been defined in template %s!", DataResource::getName())); base->getIngredientsMin(data, index, versionOk); return; } } - if (m_ingredientsAppend && base != NULL) + if (m_ingredientsAppend && base != nullptr) { int baseCount = base->getIngredientsCount(); if (index < baseCount) @@ -572,28 +572,28 @@ void ServerIntangibleObjectTemplate::_Ingredient::getIngredientsMin(SimpleIngred void ServerIntangibleObjectTemplate::_Ingredient::getIngredientsMax(SimpleIngredient &data, int index, bool versionOk) const { - const ServerIntangibleObjectTemplate::_Ingredient * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate::_Ingredient * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_ingredientsLoaded) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredients in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter ingredients has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter ingredients has not been defined in template %s!", DataResource::getName())); base->getIngredientsMax(data, index, versionOk); return; } } - if (m_ingredientsAppend && base != NULL) + if (m_ingredientsAppend && base != nullptr) { int baseCount = base->getIngredientsCount(); if (index < baseCount) @@ -618,20 +618,20 @@ size_t ServerIntangibleObjectTemplate::_Ingredient::getIngredientsCount(void) co { if (!m_ingredientsLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const ServerIntangibleObjectTemplate::_Ingredient * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getIngredientsCount(); } size_t count = m_ingredients.size(); // if we are extending our base template, add it's count - if (m_ingredientsAppend && m_baseData != NULL) + if (m_ingredientsAppend && m_baseData != nullptr) { const ServerIntangibleObjectTemplate::_Ingredient * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getIngredientsCount(); } @@ -646,26 +646,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_Ingredient * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate::_Ingredient * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getComplexity(true); #endif } if (!m_complexity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter complexity in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); return base->getComplexity(versionOk); } } @@ -675,9 +675,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getComplexity(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -694,7 +694,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -710,26 +710,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_Ingredient * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate::_Ingredient * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getComplexityMin(true); #endif } if (!m_complexity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter complexity in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); return base->getComplexityMin(versionOk); } } @@ -739,9 +739,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getComplexityMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -758,7 +758,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -774,26 +774,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_Ingredient * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate::_Ingredient * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getComplexityMax(true); #endif } if (!m_complexity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter complexity in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); return base->getComplexityMax(versionOk); } } @@ -803,9 +803,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getComplexityMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -822,7 +822,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -838,33 +838,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_Ingredient * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate::_Ingredient * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSkillCommand(true); #endif } if (!m_skillCommand.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter skillCommand in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter skillCommand has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter skillCommand has not been defined in template %s!", DataResource::getName())); return base->getSkillCommand(versionOk); } } const std::string & value = m_skillCommand.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -913,7 +913,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_ingredients.begin(); iter != m_ingredients.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_ingredients.clear(); m_ingredientsAppend = file.read_bool8(); @@ -992,33 +992,33 @@ StringId testDataValue = DefaultStringId; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_SchematicAttribute * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate::_SchematicAttribute * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getName(true); #endif } if (!m_name.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter name in template %s", DataResource::getName())); return DefaultStringId; } else { - DEBUG_FATAL(base == NULL, ("Template parameter name has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter name has not been defined in template %s!", DataResource::getName())); return base->getName(versionOk); } } const StringId value = m_name.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1034,26 +1034,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_SchematicAttribute * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate::_SchematicAttribute * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getValue(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValue(versionOk); } } @@ -1063,9 +1063,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getValue(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1082,7 +1082,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1098,26 +1098,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_SchematicAttribute * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate::_SchematicAttribute * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getValueMin(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValueMin(versionOk); } } @@ -1127,9 +1127,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getValueMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1146,7 +1146,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1162,26 +1162,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_SchematicAttribute * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate::_SchematicAttribute * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getValueMax(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValueMax(versionOk); } } @@ -1191,9 +1191,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getValueMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1210,7 +1210,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1316,33 +1316,33 @@ StringId testDataValue = DefaultStringId; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_SimpleIngredient * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate::_SimpleIngredient * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getName(true); #endif } if (!m_name.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter name in template %s", DataResource::getName())); return DefaultStringId; } else { - DEBUG_FATAL(base == NULL, ("Template parameter name has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter name has not been defined in template %s!", DataResource::getName())); return base->getName(versionOk); } } const StringId value = m_name.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1358,33 +1358,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_SimpleIngredient * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate::_SimpleIngredient * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getIngredient(true); #endif } if (!m_ingredient.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredient in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter ingredient has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter ingredient has not been defined in template %s!", DataResource::getName())); return base->getIngredient(versionOk); } } const std::string & value = m_ingredient.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1400,26 +1400,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_SimpleIngredient * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate::_SimpleIngredient * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCount(true); #endif } if (!m_count.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter count in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter count has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter count has not been defined in template %s!", DataResource::getName())); return base->getCount(versionOk); } } @@ -1429,9 +1429,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCount(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1448,7 +1448,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1464,26 +1464,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_SimpleIngredient * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate::_SimpleIngredient * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCountMin(true); #endif } if (!m_count.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter count in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter count has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter count has not been defined in template %s!", DataResource::getName())); return base->getCountMin(versionOk); } } @@ -1493,9 +1493,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCountMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1512,7 +1512,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1528,26 +1528,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerIntangibleObjectTemplate::_SimpleIngredient * base = NULL; - if (m_baseData != NULL) + const ServerIntangibleObjectTemplate::_SimpleIngredient * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCountMax(true); #endif } if (!m_count.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter count in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter count has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter count has not been defined in template %s!", DataResource::getName())); return base->getCountMax(versionOk); } } @@ -1557,9 +1557,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCountMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1576,7 +1576,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureInstallationObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureInstallationObjectTemplate.cpp index 373a81f7..57b4db42 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureInstallationObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureInstallationObjectTemplate.cpp @@ -93,10 +93,10 @@ Tag ServerManufactureInstallationObjectTemplate::getTemplateVersion(void) const */ Tag ServerManufactureInstallationObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerManufactureInstallationObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerManufactureInstallationObjectTemplate::getHighestTemplateVersion @@ -149,12 +149,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureSchematicObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureSchematicObjectTemplate.cpp index 0f00a74b..3aee1103 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureSchematicObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureSchematicObjectTemplate.cpp @@ -54,7 +54,7 @@ ServerManufactureSchematicObjectTemplate::~ServerManufactureSchematicObjectTempl for (iter = m_ingredients.begin(); iter != m_ingredients.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_ingredients.clear(); } @@ -63,7 +63,7 @@ ServerManufactureSchematicObjectTemplate::~ServerManufactureSchematicObjectTempl for (iter = m_attributes.begin(); iter != m_attributes.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_attributes.clear(); } @@ -115,17 +115,17 @@ Tag ServerManufactureSchematicObjectTemplate::getTemplateVersion(void) const */ Tag ServerManufactureSchematicObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerManufactureSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerManufactureSchematicObjectTemplate::getHighestTemplateVersion /** * Called when the game tries to create a manf schematic via the default method. - * Manf must be created via a draft schematic, so we always return NULL; + * Manf must be created via a draft schematic, so we always return nullptr; * * @return the object */ @@ -146,17 +146,17 @@ Object * ServerManufactureSchematicObjectTemplate::createObject(const char *cons const ObjectTemplate *const objectTemplate = ObjectTemplateList::fetch(fileName); if (objectTemplate) { - Object * object = NULL; + Object * object = nullptr; const ServerManufactureSchematicObjectTemplate * const manfTemplate = dynamic_cast( objectTemplate); - if (manfTemplate != NULL) + if (manfTemplate != nullptr) object = manfTemplate->createObject(schematic); objectTemplate->releaseReference (); return object; } - return NULL; + return nullptr; } // ServerManufactureSchematicObjectTemplate::createObject /** @@ -178,33 +178,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerManufactureSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerManufactureSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDraftSchematic(true); #endif } if (!m_draftSchematic.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter draftSchematic in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter draftSchematic has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter draftSchematic has not been defined in template %s!", DataResource::getName())); return base->getDraftSchematic(); } } const std::string & value = m_draftSchematic.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -220,33 +220,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerManufactureSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerManufactureSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCreator(true); #endif } if (!m_creator.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter creator in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter creator has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter creator has not been defined in template %s!", DataResource::getName())); return base->getCreator(); } } const std::string & value = m_creator.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -256,28 +256,28 @@ UNREF(testData); void ServerManufactureSchematicObjectTemplate::getIngredients(IngredientSlot &data, int index) const { - const ServerManufactureSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerManufactureSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_ingredientsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredients in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter ingredients has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter ingredients has not been defined in template %s!", DataResource::getName())); base->getIngredients(data, index); return; } } - if (m_ingredientsAppend && base != NULL) + if (m_ingredientsAppend && base != nullptr) { int baseCount = base->getIngredientsCount(); if (index < baseCount) @@ -299,28 +299,28 @@ void ServerManufactureSchematicObjectTemplate::getIngredients(IngredientSlot &da void ServerManufactureSchematicObjectTemplate::getIngredientsMin(IngredientSlot &data, int index) const { - const ServerManufactureSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerManufactureSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_ingredientsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredients in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter ingredients has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter ingredients has not been defined in template %s!", DataResource::getName())); base->getIngredientsMin(data, index); return; } } - if (m_ingredientsAppend && base != NULL) + if (m_ingredientsAppend && base != nullptr) { int baseCount = base->getIngredientsCount(); if (index < baseCount) @@ -342,28 +342,28 @@ void ServerManufactureSchematicObjectTemplate::getIngredientsMin(IngredientSlot void ServerManufactureSchematicObjectTemplate::getIngredientsMax(IngredientSlot &data, int index) const { - const ServerManufactureSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerManufactureSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_ingredientsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredients in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter ingredients has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter ingredients has not been defined in template %s!", DataResource::getName())); base->getIngredientsMax(data, index); return; } } - if (m_ingredientsAppend && base != NULL) + if (m_ingredientsAppend && base != nullptr) { int baseCount = base->getIngredientsCount(); if (index < baseCount) @@ -387,20 +387,20 @@ size_t ServerManufactureSchematicObjectTemplate::getIngredientsCount(void) const { if (!m_ingredientsLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const ServerManufactureSchematicObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getIngredientsCount(); } size_t count = m_ingredients.size(); // if we are extending our base template, add it's count - if (m_ingredientsAppend && m_baseData != NULL) + if (m_ingredientsAppend && m_baseData != nullptr) { const ServerManufactureSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getIngredientsCount(); } @@ -415,26 +415,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerManufactureSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerManufactureSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getItemCount(true); #endif } if (!m_itemCount.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter itemCount in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter itemCount has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter itemCount has not been defined in template %s!", DataResource::getName())); return base->getItemCount(); } } @@ -444,9 +444,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getItemCount(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -463,7 +463,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -479,26 +479,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerManufactureSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerManufactureSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getItemCountMin(true); #endif } if (!m_itemCount.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter itemCount in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter itemCount has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter itemCount has not been defined in template %s!", DataResource::getName())); return base->getItemCountMin(); } } @@ -508,9 +508,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getItemCountMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -527,7 +527,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -543,26 +543,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerManufactureSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerManufactureSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getItemCountMax(true); #endif } if (!m_itemCount.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter itemCount in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter itemCount has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter itemCount has not been defined in template %s!", DataResource::getName())); return base->getItemCountMax(); } } @@ -572,9 +572,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getItemCountMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -591,7 +591,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -601,28 +601,28 @@ UNREF(testData); void ServerManufactureSchematicObjectTemplate::getAttributes(SchematicAttribute &data, int index) const { - const ServerManufactureSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerManufactureSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_attributesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attributes in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter attributes has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attributes has not been defined in template %s!", DataResource::getName())); base->getAttributes(data, index); return; } } - if (m_attributesAppend && base != NULL) + if (m_attributesAppend && base != nullptr) { int baseCount = base->getAttributesCount(); if (index < baseCount) @@ -644,28 +644,28 @@ void ServerManufactureSchematicObjectTemplate::getAttributes(SchematicAttribute void ServerManufactureSchematicObjectTemplate::getAttributesMin(SchematicAttribute &data, int index) const { - const ServerManufactureSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerManufactureSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_attributesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attributes in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter attributes has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attributes has not been defined in template %s!", DataResource::getName())); base->getAttributesMin(data, index); return; } } - if (m_attributesAppend && base != NULL) + if (m_attributesAppend && base != nullptr) { int baseCount = base->getAttributesCount(); if (index < baseCount) @@ -687,28 +687,28 @@ void ServerManufactureSchematicObjectTemplate::getAttributesMin(SchematicAttribu void ServerManufactureSchematicObjectTemplate::getAttributesMax(SchematicAttribute &data, int index) const { - const ServerManufactureSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerManufactureSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_attributesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attributes in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter attributes has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attributes has not been defined in template %s!", DataResource::getName())); base->getAttributesMax(data, index); return; } } - if (m_attributesAppend && base != NULL) + if (m_attributesAppend && base != nullptr) { int baseCount = base->getAttributesCount(); if (index < baseCount) @@ -732,20 +732,20 @@ size_t ServerManufactureSchematicObjectTemplate::getAttributesCount(void) const { if (!m_attributesLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const ServerManufactureSchematicObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getAttributesCount(); } size_t count = m_attributes.size(); // if we are extending our base template, add it's count - if (m_attributesAppend && m_baseData != NULL) + if (m_attributesAppend && m_baseData != nullptr) { const ServerManufactureSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getAttributesCount(); } @@ -793,12 +793,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -831,7 +831,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_ingredients.begin(); iter != m_ingredients.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_ingredients.clear(); m_ingredientsAppend = file.read_bool8(); @@ -852,7 +852,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_attributes.begin(); iter != m_attributes.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_attributes.clear(); m_attributesAppend = file.read_bool8(); @@ -929,33 +929,33 @@ StringId testDataValue = DefaultStringId; UNREF(testData); #endif - const ServerManufactureSchematicObjectTemplate::_IngredientSlot * base = NULL; - if (m_baseData != NULL) + const ServerManufactureSchematicObjectTemplate::_IngredientSlot * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getName(true); #endif } if (!m_name.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter name in template %s", DataResource::getName())); return DefaultStringId; } else { - DEBUG_FATAL(base == NULL, ("Template parameter name has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter name has not been defined in template %s!", DataResource::getName())); return base->getName(versionOk); } } const StringId value = m_name.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -965,22 +965,22 @@ UNREF(testData); void ServerManufactureSchematicObjectTemplate::_IngredientSlot::getIngredient(Ingredient &data, bool versionOk) const { - const ServerManufactureSchematicObjectTemplate::_IngredientSlot * base = NULL; - if (m_baseData != NULL) + const ServerManufactureSchematicObjectTemplate::_IngredientSlot * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_ingredient.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredient in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter ingredient has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter ingredient has not been defined in template %s!", DataResource::getName())); base->getIngredient(data, versionOk); return; } @@ -1004,22 +1004,22 @@ void ServerManufactureSchematicObjectTemplate::_IngredientSlot::getIngredient(In void ServerManufactureSchematicObjectTemplate::_IngredientSlot::getIngredientMin(Ingredient &data, bool versionOk) const { - const ServerManufactureSchematicObjectTemplate::_IngredientSlot * base = NULL; - if (m_baseData != NULL) + const ServerManufactureSchematicObjectTemplate::_IngredientSlot * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_ingredient.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredient in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter ingredient has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter ingredient has not been defined in template %s!", DataResource::getName())); base->getIngredientMin(data, versionOk); return; } @@ -1043,22 +1043,22 @@ void ServerManufactureSchematicObjectTemplate::_IngredientSlot::getIngredientMin void ServerManufactureSchematicObjectTemplate::_IngredientSlot::getIngredientMax(Ingredient &data, bool versionOk) const { - const ServerManufactureSchematicObjectTemplate::_IngredientSlot * base = NULL; - if (m_baseData != NULL) + const ServerManufactureSchematicObjectTemplate::_IngredientSlot * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_ingredient.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredient in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter ingredient has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter ingredient has not been defined in template %s!", DataResource::getName())); base->getIngredientMax(data, versionOk); return; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerMissionObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerMissionObjectTemplate.cpp index 66ee2754..9417be44 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerMissionObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerMissionObjectTemplate.cpp @@ -93,10 +93,10 @@ Tag ServerMissionObjectTemplate::getTemplateVersion(void) const */ Tag ServerMissionObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerMissionObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerMissionObjectTemplate::getHighestTemplateVersion @@ -149,12 +149,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerObjectTemplate.cpp index 78810b18..5e11c2e7 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerObjectTemplate.cpp @@ -32,7 +32,7 @@ const TriggerVolumeData DefaultTriggerVolumeData; bool ServerObjectTemplate::ms_allowDefaultTemplateParams = true; typedef std::unordered_map > XP_MAP; -static XP_MAP * XpMap = NULL; +static XP_MAP * XpMap = nullptr; /** @@ -74,7 +74,7 @@ ServerObjectTemplate::~ServerObjectTemplate() for (iter = m_scripts.begin(); iter != m_scripts.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_scripts.clear(); } @@ -83,7 +83,7 @@ ServerObjectTemplate::~ServerObjectTemplate() for (iter = m_visibleFlags.begin(); iter != m_visibleFlags.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_visibleFlags.clear(); } @@ -92,7 +92,7 @@ ServerObjectTemplate::~ServerObjectTemplate() for (iter = m_deleteFlags.begin(); iter != m_deleteFlags.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_deleteFlags.clear(); } @@ -101,7 +101,7 @@ ServerObjectTemplate::~ServerObjectTemplate() for (iter = m_moveFlags.begin(); iter != m_moveFlags.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_moveFlags.clear(); } @@ -110,7 +110,7 @@ ServerObjectTemplate::~ServerObjectTemplate() for (iter = m_contents.begin(); iter != m_contents.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_contents.clear(); } @@ -119,7 +119,7 @@ ServerObjectTemplate::~ServerObjectTemplate() for (iter = m_xpPoints.begin(); iter != m_xpPoints.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_xpPoints.clear(); } @@ -133,7 +133,7 @@ void ServerObjectTemplate::registerMe(void) { ObjectTemplateList::registerTemplate(ServerObjectTemplate_tag, create); - if (XpMap == NULL) + if (XpMap == nullptr) { XpMap = new XP_MAP(); ExitChain::add(exit, "ServerObjectTemplate"); @@ -208,10 +208,10 @@ void ServerObjectTemplate::registerMe(void) */ void ServerObjectTemplate::exit() { - if (XpMap != NULL) + if (XpMap != nullptr) { delete XpMap; - XpMap = NULL; + XpMap = nullptr; } } // ServerObjectTemplate::exit @@ -252,10 +252,10 @@ Tag ServerObjectTemplate::getTemplateVersion(void) const */ Tag ServerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerObjectTemplate::getHighestTemplateVersion @@ -287,7 +287,7 @@ const std::string & ServerObjectTemplate::getXpString(XpTypes type) { static const std::string emptyString; - if (XpMap != NULL) + if (XpMap != nullptr) { XP_MAP::const_iterator result = XpMap->find(type); if (result != XpMap->end()) @@ -371,33 +371,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSharedTemplate(true); #endif } if (!m_sharedTemplate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter sharedTemplate in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter sharedTemplate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter sharedTemplate has not been defined in template %s!", DataResource::getName())); return base->getSharedTemplate(); } } const std::string & value = m_sharedTemplate.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -407,27 +407,27 @@ UNREF(testData); const std::string & ServerObjectTemplate::getScripts(int index) const { - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_scriptsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter scripts in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter scripts has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter scripts has not been defined in template %s!", DataResource::getName())); return base->getScripts(index); } } - if (m_scriptsAppend && base != NULL) + if (m_scriptsAppend && base != nullptr) { int baseCount = base->getScriptsCount(); if (index < baseCount) @@ -444,20 +444,20 @@ size_t ServerObjectTemplate::getScriptsCount(void) const { if (!m_scriptsLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const ServerObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getScriptsCount(); } size_t count = m_scripts.size(); // if we are extending our base template, add it's count - if (m_scriptsAppend && m_baseData != NULL) + if (m_scriptsAppend && m_baseData != nullptr) { const ServerObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getScriptsCount(); } @@ -466,28 +466,28 @@ size_t ServerObjectTemplate::getScriptsCount(void) const void ServerObjectTemplate::getObjvars(DynamicVariableList &list) const { - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_objvars.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter objvars in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter objvars has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter objvars has not been defined in template %s!", DataResource::getName())); base->getObjvars(list); return; } } - if (m_objvars.isExtendingBaseList() && base != NULL) + if (m_objvars.isExtendingBaseList() && base != nullptr) base->getObjvars(list); m_objvars.getDynamicVariableList(list); } // ServerObjectTemplate::getObjvars @@ -500,26 +500,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getVolume(true); #endif } if (!m_volume.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter volume in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter volume has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter volume has not been defined in template %s!", DataResource::getName())); return base->getVolume(); } } @@ -529,9 +529,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getVolume(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -548,7 +548,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -564,26 +564,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getVolumeMin(true); #endif } if (!m_volume.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter volume in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter volume has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter volume has not been defined in template %s!", DataResource::getName())); return base->getVolumeMin(); } } @@ -593,9 +593,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getVolumeMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -612,7 +612,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -628,26 +628,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getVolumeMax(true); #endif } if (!m_volume.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter volume in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter volume has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter volume has not been defined in template %s!", DataResource::getName())); return base->getVolumeMax(); } } @@ -657,9 +657,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getVolumeMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -676,7 +676,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -686,27 +686,27 @@ UNREF(testData); ServerObjectTemplate::VisibleFlags ServerObjectTemplate::getVisibleFlags(int index) const { - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_visibleFlagsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter visibleFlags in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter visibleFlags has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter visibleFlags has not been defined in template %s!", DataResource::getName())); return base->getVisibleFlags(index); } } - if (m_visibleFlagsAppend && base != NULL) + if (m_visibleFlagsAppend && base != nullptr) { int baseCount = base->getVisibleFlagsCount(); if (index < baseCount) @@ -722,20 +722,20 @@ size_t ServerObjectTemplate::getVisibleFlagsCount(void) const { if (!m_visibleFlagsLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const ServerObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getVisibleFlagsCount(); } size_t count = m_visibleFlags.size(); // if we are extending our base template, add it's count - if (m_visibleFlagsAppend && m_baseData != NULL) + if (m_visibleFlagsAppend && m_baseData != nullptr) { const ServerObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getVisibleFlagsCount(); } @@ -744,27 +744,27 @@ size_t ServerObjectTemplate::getVisibleFlagsCount(void) const ServerObjectTemplate::DeleteFlags ServerObjectTemplate::getDeleteFlags(int index) const { - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_deleteFlagsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter deleteFlags in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter deleteFlags has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter deleteFlags has not been defined in template %s!", DataResource::getName())); return base->getDeleteFlags(index); } } - if (m_deleteFlagsAppend && base != NULL) + if (m_deleteFlagsAppend && base != nullptr) { int baseCount = base->getDeleteFlagsCount(); if (index < baseCount) @@ -780,20 +780,20 @@ size_t ServerObjectTemplate::getDeleteFlagsCount(void) const { if (!m_deleteFlagsLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const ServerObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getDeleteFlagsCount(); } size_t count = m_deleteFlags.size(); // if we are extending our base template, add it's count - if (m_deleteFlagsAppend && m_baseData != NULL) + if (m_deleteFlagsAppend && m_baseData != nullptr) { const ServerObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getDeleteFlagsCount(); } @@ -802,27 +802,27 @@ size_t ServerObjectTemplate::getDeleteFlagsCount(void) const ServerObjectTemplate::MoveFlags ServerObjectTemplate::getMoveFlags(int index) const { - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_moveFlagsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter moveFlags in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter moveFlags has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter moveFlags has not been defined in template %s!", DataResource::getName())); return base->getMoveFlags(index); } } - if (m_moveFlagsAppend && base != NULL) + if (m_moveFlagsAppend && base != nullptr) { int baseCount = base->getMoveFlagsCount(); if (index < baseCount) @@ -838,20 +838,20 @@ size_t ServerObjectTemplate::getMoveFlagsCount(void) const { if (!m_moveFlagsLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const ServerObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getMoveFlagsCount(); } size_t count = m_moveFlags.size(); // if we are extending our base template, add it's count - if (m_moveFlagsAppend && m_baseData != NULL) + if (m_moveFlagsAppend && m_baseData != nullptr) { const ServerObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getMoveFlagsCount(); } @@ -866,33 +866,33 @@ bool testDataValue = false; UNREF(testData); #endif - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getInvulnerable(true); #endif } if (!m_invulnerable.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter invulnerable in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter invulnerable has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter invulnerable has not been defined in template %s!", DataResource::getName())); return base->getInvulnerable(); } } bool value = m_invulnerable.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -908,26 +908,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getComplexity(true); #endif } if (!m_complexity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter complexity in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); return base->getComplexity(); } } @@ -937,9 +937,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getComplexity(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -956,7 +956,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -972,26 +972,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getComplexityMin(true); #endif } if (!m_complexity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter complexity in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); return base->getComplexityMin(); } } @@ -1001,9 +1001,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getComplexityMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1020,7 +1020,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1036,26 +1036,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getComplexityMax(true); #endif } if (!m_complexity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter complexity in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter complexity has not been defined in template %s!", DataResource::getName())); return base->getComplexityMax(); } } @@ -1065,9 +1065,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getComplexityMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1084,7 +1084,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1100,26 +1100,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTintIndex(true); #endif } if (!m_tintIndex.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter tintIndex in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter tintIndex has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter tintIndex has not been defined in template %s!", DataResource::getName())); return base->getTintIndex(); } } @@ -1129,9 +1129,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTintIndex(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1148,7 +1148,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1164,26 +1164,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTintIndexMin(true); #endif } if (!m_tintIndex.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter tintIndex in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter tintIndex has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter tintIndex has not been defined in template %s!", DataResource::getName())); return base->getTintIndexMin(); } } @@ -1193,9 +1193,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTintIndexMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1212,7 +1212,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1228,26 +1228,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTintIndexMax(true); #endif } if (!m_tintIndex.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter tintIndex in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter tintIndex has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter tintIndex has not been defined in template %s!", DataResource::getName())); return base->getTintIndexMax(); } } @@ -1257,9 +1257,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTintIndexMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1276,7 +1276,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1286,8 +1286,8 @@ UNREF(testData); float ServerObjectTemplate::getUpdateRanges(UpdateRanges index) const { - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -1295,14 +1295,14 @@ float ServerObjectTemplate::getUpdateRanges(UpdateRanges index) const DEBUG_FATAL(index < 0 || index >= 3, ("template param index out of range")); if (!m_updateRanges[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter updateRanges in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter updateRanges has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter updateRanges has not been defined in template %s!", DataResource::getName())); return base->getUpdateRanges(index); } } @@ -1312,9 +1312,9 @@ float ServerObjectTemplate::getUpdateRanges(UpdateRanges index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getUpdateRanges(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1335,8 +1335,8 @@ float ServerObjectTemplate::getUpdateRanges(UpdateRanges index) const float ServerObjectTemplate::getUpdateRangesMin(UpdateRanges index) const { - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -1344,14 +1344,14 @@ float ServerObjectTemplate::getUpdateRangesMin(UpdateRanges index) const DEBUG_FATAL(index < 0 || index >= 3, ("template param index out of range")); if (!m_updateRanges[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter updateRanges in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter updateRanges has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter updateRanges has not been defined in template %s!", DataResource::getName())); return base->getUpdateRangesMin(index); } } @@ -1361,9 +1361,9 @@ float ServerObjectTemplate::getUpdateRangesMin(UpdateRanges index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getUpdateRangesMin(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1384,8 +1384,8 @@ float ServerObjectTemplate::getUpdateRangesMin(UpdateRanges index) const float ServerObjectTemplate::getUpdateRangesMax(UpdateRanges index) const { - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -1393,14 +1393,14 @@ float ServerObjectTemplate::getUpdateRangesMax(UpdateRanges index) const DEBUG_FATAL(index < 0 || index >= 3, ("template param index out of range")); if (!m_updateRanges[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter updateRanges in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter updateRanges has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter updateRanges has not been defined in template %s!", DataResource::getName())); return base->getUpdateRangesMax(index); } } @@ -1410,9 +1410,9 @@ float ServerObjectTemplate::getUpdateRangesMax(UpdateRanges index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getUpdateRangesMax(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1433,28 +1433,28 @@ float ServerObjectTemplate::getUpdateRangesMax(UpdateRanges index) const void ServerObjectTemplate::getContents(Contents &data, int index) const { - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_contentsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter contents in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter contents has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter contents has not been defined in template %s!", DataResource::getName())); base->getContents(data, index); return; } } - if (m_contentsAppend && base != NULL) + if (m_contentsAppend && base != nullptr) { int baseCount = base->getContentsCount(); if (index < baseCount) @@ -1477,28 +1477,28 @@ void ServerObjectTemplate::getContents(Contents &data, int index) const void ServerObjectTemplate::getContentsMin(Contents &data, int index) const { - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_contentsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter contents in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter contents has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter contents has not been defined in template %s!", DataResource::getName())); base->getContentsMin(data, index); return; } } - if (m_contentsAppend && base != NULL) + if (m_contentsAppend && base != nullptr) { int baseCount = base->getContentsCount(); if (index < baseCount) @@ -1521,28 +1521,28 @@ void ServerObjectTemplate::getContentsMin(Contents &data, int index) const void ServerObjectTemplate::getContentsMax(Contents &data, int index) const { - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_contentsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter contents in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter contents has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter contents has not been defined in template %s!", DataResource::getName())); base->getContentsMax(data, index); return; } } - if (m_contentsAppend && base != NULL) + if (m_contentsAppend && base != nullptr) { int baseCount = base->getContentsCount(); if (index < baseCount) @@ -1567,20 +1567,20 @@ size_t ServerObjectTemplate::getContentsCount(void) const { if (!m_contentsLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const ServerObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getContentsCount(); } size_t count = m_contents.size(); // if we are extending our base template, add it's count - if (m_contentsAppend && m_baseData != NULL) + if (m_contentsAppend && m_baseData != nullptr) { const ServerObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getContentsCount(); } @@ -1589,28 +1589,28 @@ size_t ServerObjectTemplate::getContentsCount(void) const void ServerObjectTemplate::getXpPoints(Xp &data, int index) const { - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_xpPointsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter xpPoints in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter xpPoints has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter xpPoints has not been defined in template %s!", DataResource::getName())); base->getXpPoints(data, index); return; } } - if (m_xpPointsAppend && base != NULL) + if (m_xpPointsAppend && base != nullptr) { int baseCount = base->getXpPointsCount(); if (index < baseCount) @@ -1633,28 +1633,28 @@ void ServerObjectTemplate::getXpPoints(Xp &data, int index) const void ServerObjectTemplate::getXpPointsMin(Xp &data, int index) const { - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_xpPointsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter xpPoints in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter xpPoints has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter xpPoints has not been defined in template %s!", DataResource::getName())); base->getXpPointsMin(data, index); return; } } - if (m_xpPointsAppend && base != NULL) + if (m_xpPointsAppend && base != nullptr) { int baseCount = base->getXpPointsCount(); if (index < baseCount) @@ -1677,28 +1677,28 @@ void ServerObjectTemplate::getXpPointsMin(Xp &data, int index) const void ServerObjectTemplate::getXpPointsMax(Xp &data, int index) const { - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_xpPointsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter xpPoints in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter xpPoints has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter xpPoints has not been defined in template %s!", DataResource::getName())); base->getXpPointsMax(data, index); return; } } - if (m_xpPointsAppend && base != NULL) + if (m_xpPointsAppend && base != nullptr) { int baseCount = base->getXpPointsCount(); if (index < baseCount) @@ -1723,20 +1723,20 @@ size_t ServerObjectTemplate::getXpPointsCount(void) const { if (!m_xpPointsLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const ServerObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getXpPointsCount(); } size_t count = m_xpPoints.size(); // if we are extending our base template, add it's count - if (m_xpPointsAppend && m_baseData != NULL) + if (m_xpPointsAppend && m_baseData != nullptr) { const ServerObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getXpPointsCount(); } @@ -1751,33 +1751,33 @@ bool testDataValue = false; UNREF(testData); #endif - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getPersistByDefault(true); #endif } if (!m_persistByDefault.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter persistByDefault in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter persistByDefault has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter persistByDefault has not been defined in template %s!", DataResource::getName())); return base->getPersistByDefault(); } } bool value = m_persistByDefault.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1793,33 +1793,33 @@ bool testDataValue = false; UNREF(testData); #endif - const ServerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getPersistContents(true); #endif } if (!m_persistContents.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter persistContents in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter persistContents has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter persistContents has not been defined in template %s!", DataResource::getName())); return base->getPersistContents(); } } bool value = m_persistContents.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1872,12 +1872,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -1908,7 +1908,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_scripts.begin(); iter != m_scripts.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_scripts.clear(); m_scriptsAppend = file.read_bool8(); @@ -1931,7 +1931,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_visibleFlags.begin(); iter != m_visibleFlags.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_visibleFlags.clear(); m_visibleFlagsAppend = file.read_bool8(); @@ -1950,7 +1950,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_deleteFlags.begin(); iter != m_deleteFlags.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_deleteFlags.clear(); m_deleteFlagsAppend = file.read_bool8(); @@ -1969,7 +1969,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_moveFlags.begin(); iter != m_moveFlags.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_moveFlags.clear(); m_moveFlagsAppend = file.read_bool8(); @@ -2008,7 +2008,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_contents.begin(); iter != m_contents.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_contents.clear(); m_contentsAppend = file.read_bool8(); @@ -2027,7 +2027,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_xpPoints.begin(); iter != m_xpPoints.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_xpPoints.clear(); m_xpPointsAppend = file.read_bool8(); @@ -2106,33 +2106,33 @@ ServerObjectTemplate::Attributes testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTarget(true); #endif } if (!m_target.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter target in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter target has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter target has not been defined in template %s!", DataResource::getName())); return base->getTarget(versionOk); } } Attributes value = static_cast(m_target.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2148,26 +2148,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate::_AttribMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_AttribMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getValue(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValue(versionOk); } } @@ -2177,9 +2177,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getValue(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2196,7 +2196,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2212,26 +2212,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate::_AttribMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_AttribMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getValueMin(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValueMin(versionOk); } } @@ -2241,9 +2241,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getValueMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2260,7 +2260,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2276,26 +2276,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate::_AttribMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_AttribMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getValueMax(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValueMax(versionOk); } } @@ -2305,9 +2305,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getValueMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2324,7 +2324,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2340,26 +2340,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_AttribMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_AttribMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTime(true); #endif } if (!m_time.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter time in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter time has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter time has not been defined in template %s!", DataResource::getName())); return base->getTime(versionOk); } } @@ -2369,9 +2369,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTime(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2388,7 +2388,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2404,26 +2404,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_AttribMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_AttribMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTimeMin(true); #endif } if (!m_time.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter time in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter time has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter time has not been defined in template %s!", DataResource::getName())); return base->getTimeMin(versionOk); } } @@ -2433,9 +2433,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTimeMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2452,7 +2452,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2468,26 +2468,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_AttribMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_AttribMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTimeMax(true); #endif } if (!m_time.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter time in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter time has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter time has not been defined in template %s!", DataResource::getName())); return base->getTimeMax(versionOk); } } @@ -2497,9 +2497,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTimeMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2516,7 +2516,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2532,26 +2532,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_AttribMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_AttribMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTimeAtValue(true); #endif } if (!m_timeAtValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter timeAtValue in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter timeAtValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter timeAtValue has not been defined in template %s!", DataResource::getName())); return base->getTimeAtValue(versionOk); } } @@ -2561,9 +2561,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTimeAtValue(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2580,7 +2580,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2596,26 +2596,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_AttribMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_AttribMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTimeAtValueMin(true); #endif } if (!m_timeAtValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter timeAtValue in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter timeAtValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter timeAtValue has not been defined in template %s!", DataResource::getName())); return base->getTimeAtValueMin(versionOk); } } @@ -2625,9 +2625,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTimeAtValueMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2644,7 +2644,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2660,26 +2660,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_AttribMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_AttribMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTimeAtValueMax(true); #endif } if (!m_timeAtValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter timeAtValue in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter timeAtValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter timeAtValue has not been defined in template %s!", DataResource::getName())); return base->getTimeAtValueMax(versionOk); } } @@ -2689,9 +2689,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTimeAtValueMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2708,7 +2708,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2724,26 +2724,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_AttribMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_AttribMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDecay(true); #endif } if (!m_decay.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter decay in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter decay has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter decay has not been defined in template %s!", DataResource::getName())); return base->getDecay(versionOk); } } @@ -2753,9 +2753,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getDecay(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2772,7 +2772,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2788,26 +2788,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_AttribMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_AttribMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDecayMin(true); #endif } if (!m_decay.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter decay in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter decay has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter decay has not been defined in template %s!", DataResource::getName())); return base->getDecayMin(versionOk); } } @@ -2817,9 +2817,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getDecayMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2836,7 +2836,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2852,26 +2852,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_AttribMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_AttribMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDecayMax(true); #endif } if (!m_decay.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter decay in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter decay has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter decay has not been defined in template %s!", DataResource::getName())); return base->getDecayMax(versionOk); } } @@ -2881,9 +2881,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getDecayMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2900,7 +2900,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2972,7 +2972,7 @@ char paramName[MAX_NAME_SIZE]; */ ServerObjectTemplate::Contents::Contents(void) { - content = NULL; + content = nullptr; } // ServerObjectTemplate::Contents::Contents() /** @@ -2983,7 +2983,7 @@ ServerObjectTemplate::Contents::Contents(const ServerObjectTemplate::Contents & equipObject(source.equipObject), content(source.content) { - if (content != NULL) + if (content != nullptr) const_cast(content)->addReference(); } // ServerObjectTemplate::Contents::Contents(const ServerObjectTemplate::Contents &) @@ -2992,10 +2992,10 @@ ServerObjectTemplate::Contents::Contents(const ServerObjectTemplate::Contents & */ ServerObjectTemplate::Contents::~Contents() { - if (content != NULL) + if (content != nullptr) { content->releaseReference(); - content = NULL; + content = nullptr; } } // ServerObjectTemplate::Contents::~Contents @@ -3065,33 +3065,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerObjectTemplate::_Contents * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_Contents * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSlotName(true); #endif } if (!m_slotName.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slotName in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slotName has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slotName has not been defined in template %s!", DataResource::getName())); return base->getSlotName(versionOk); } } const std::string & value = m_slotName.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3107,33 +3107,33 @@ bool testDataValue = false; UNREF(testData); #endif - const ServerObjectTemplate::_Contents * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_Contents * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getEquipObject(true); #endif } if (!m_equipObject.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter equipObject in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter equipObject has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter equipObject has not been defined in template %s!", DataResource::getName())); return base->getEquipObject(versionOk); } } bool value = m_equipObject.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3143,32 +3143,32 @@ UNREF(testData); const ServerObjectTemplate * ServerObjectTemplate::_Contents::getContent(bool versionOk) const { - const ServerObjectTemplate::_Contents * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_Contents * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_content.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter content in template %s", DataResource::getName())); - return NULL; + return nullptr; } else { - DEBUG_FATAL(base == NULL, ("Template parameter content has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter content has not been defined in template %s!", DataResource::getName())); return base->getContent(versionOk); } } - const ServerObjectTemplate * returnValue = NULL; + const ServerObjectTemplate * returnValue = nullptr; const std::string & templateName = m_content.getValue(); if (!templateName.empty()) { returnValue = dynamic_cast(ObjectTemplateList::fetch(templateName)); - if (returnValue == NULL) + if (returnValue == nullptr) WARNING_STRICT_FATAL(true, ("Error loading template %s",templateName.c_str())); } return returnValue; @@ -3273,33 +3273,33 @@ ServerObjectTemplate::MentalStates testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTarget(true); #endif } if (!m_target.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter target in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter target has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter target has not been defined in template %s!", DataResource::getName())); return base->getTarget(versionOk); } } MentalStates value = static_cast(m_target.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3315,26 +3315,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_MentalStateMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_MentalStateMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getValue(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValue(versionOk); } } @@ -3344,9 +3344,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getValue(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3363,7 +3363,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3379,26 +3379,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_MentalStateMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_MentalStateMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getValueMin(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValueMin(versionOk); } } @@ -3408,9 +3408,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getValueMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3427,7 +3427,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3443,26 +3443,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_MentalStateMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_MentalStateMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getValueMax(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValueMax(versionOk); } } @@ -3472,9 +3472,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getValueMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3491,7 +3491,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3507,26 +3507,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_MentalStateMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_MentalStateMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTime(true); #endif } if (!m_time.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter time in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter time has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter time has not been defined in template %s!", DataResource::getName())); return base->getTime(versionOk); } } @@ -3536,9 +3536,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTime(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3555,7 +3555,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3571,26 +3571,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_MentalStateMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_MentalStateMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTimeMin(true); #endif } if (!m_time.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter time in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter time has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter time has not been defined in template %s!", DataResource::getName())); return base->getTimeMin(versionOk); } } @@ -3600,9 +3600,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTimeMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3619,7 +3619,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3635,26 +3635,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_MentalStateMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_MentalStateMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTimeMax(true); #endif } if (!m_time.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter time in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter time has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter time has not been defined in template %s!", DataResource::getName())); return base->getTimeMax(versionOk); } } @@ -3664,9 +3664,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTimeMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3683,7 +3683,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3699,26 +3699,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_MentalStateMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_MentalStateMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTimeAtValue(true); #endif } if (!m_timeAtValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter timeAtValue in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter timeAtValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter timeAtValue has not been defined in template %s!", DataResource::getName())); return base->getTimeAtValue(versionOk); } } @@ -3728,9 +3728,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTimeAtValue(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3747,7 +3747,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3763,26 +3763,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_MentalStateMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_MentalStateMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTimeAtValueMin(true); #endif } if (!m_timeAtValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter timeAtValue in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter timeAtValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter timeAtValue has not been defined in template %s!", DataResource::getName())); return base->getTimeAtValueMin(versionOk); } } @@ -3792,9 +3792,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTimeAtValueMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3811,7 +3811,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3827,26 +3827,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_MentalStateMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_MentalStateMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTimeAtValueMax(true); #endif } if (!m_timeAtValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter timeAtValue in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter timeAtValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter timeAtValue has not been defined in template %s!", DataResource::getName())); return base->getTimeAtValueMax(versionOk); } } @@ -3856,9 +3856,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTimeAtValueMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3875,7 +3875,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3891,26 +3891,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_MentalStateMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_MentalStateMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDecay(true); #endif } if (!m_decay.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter decay in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter decay has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter decay has not been defined in template %s!", DataResource::getName())); return base->getDecay(versionOk); } } @@ -3920,9 +3920,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getDecay(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3939,7 +3939,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3955,26 +3955,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_MentalStateMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_MentalStateMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDecayMin(true); #endif } if (!m_decay.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter decay in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter decay has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter decay has not been defined in template %s!", DataResource::getName())); return base->getDecayMin(versionOk); } } @@ -3984,9 +3984,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getDecayMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -4003,7 +4003,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -4019,26 +4019,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerObjectTemplate::_MentalStateMod * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_MentalStateMod * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDecayMax(true); #endif } if (!m_decay.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter decay in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter decay has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter decay has not been defined in template %s!", DataResource::getName())); return base->getDecayMax(versionOk); } } @@ -4048,9 +4048,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getDecayMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -4067,7 +4067,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -4185,33 +4185,33 @@ ServerObjectTemplate::XpTypes testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getType(true); #endif } if (!m_type.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter type in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter type has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter type has not been defined in template %s!", DataResource::getName())); return base->getType(versionOk); } } XpTypes value = static_cast(m_type.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -4227,26 +4227,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate::_Xp * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_Xp * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getLevel(true); #endif } if (!m_level.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter level in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter level has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter level has not been defined in template %s!", DataResource::getName())); return base->getLevel(versionOk); } } @@ -4256,9 +4256,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getLevel(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -4275,7 +4275,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -4291,26 +4291,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate::_Xp * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_Xp * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getLevelMin(true); #endif } if (!m_level.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter level in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter level has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter level has not been defined in template %s!", DataResource::getName())); return base->getLevelMin(versionOk); } } @@ -4320,9 +4320,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getLevelMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -4339,7 +4339,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -4355,26 +4355,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate::_Xp * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_Xp * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getLevelMax(true); #endif } if (!m_level.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter level in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter level has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter level has not been defined in template %s!", DataResource::getName())); return base->getLevelMax(versionOk); } } @@ -4384,9 +4384,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getLevelMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -4403,7 +4403,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -4419,26 +4419,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate::_Xp * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_Xp * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getValue(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValue(versionOk); } } @@ -4448,9 +4448,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getValue(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -4467,7 +4467,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -4483,26 +4483,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate::_Xp * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_Xp * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getValueMin(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValueMin(versionOk); } } @@ -4512,9 +4512,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getValueMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -4531,7 +4531,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -4547,26 +4547,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerObjectTemplate::_Xp * base = NULL; - if (m_baseData != NULL) + const ServerObjectTemplate::_Xp * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getValueMax(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValueMax(versionOk); } } @@ -4576,9 +4576,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getValueMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -4595,7 +4595,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlanetObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlanetObjectTemplate.cpp index 985007c1..3c4e1053 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlanetObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlanetObjectTemplate.cpp @@ -93,10 +93,10 @@ Tag ServerPlanetObjectTemplate::getTemplateVersion(void) const */ Tag ServerPlanetObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerPlanetObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerPlanetObjectTemplate::getHighestTemplateVersion @@ -120,33 +120,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerPlanetObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerPlanetObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getPlanetName(true); #endif } if (!m_planetName.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter planetName in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter planetName has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter planetName has not been defined in template %s!", DataResource::getName())); return base->getPlanetName(); } } const std::string & value = m_planetName.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -192,12 +192,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerObjectTemplate.cpp index 9051a1f9..effe5904 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerObjectTemplate.cpp @@ -95,10 +95,10 @@ Tag ServerPlayerObjectTemplate::getTemplateVersion(void) const */ Tag ServerPlayerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerPlayerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerPlayerObjectTemplate::getHighestTemplateVersion @@ -151,12 +151,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerQuestObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerQuestObjectTemplate.cpp index ea316d04..5949f691 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerQuestObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerQuestObjectTemplate.cpp @@ -95,10 +95,10 @@ Tag ServerPlayerQuestObjectTemplate::getTemplateVersion(void) const */ Tag ServerPlayerQuestObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerPlayerQuestObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerPlayerQuestObjectTemplate::getHighestTemplateVersion @@ -152,12 +152,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerResourceContainerObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerResourceContainerObjectTemplate.cpp index bdd03637..a5512489 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerResourceContainerObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerResourceContainerObjectTemplate.cpp @@ -93,10 +93,10 @@ Tag ServerResourceContainerObjectTemplate::getTemplateVersion(void) const */ Tag ServerResourceContainerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerResourceContainerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerResourceContainerObjectTemplate::getHighestTemplateVersion @@ -120,26 +120,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerResourceContainerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerResourceContainerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxResources(true); #endif } if (!m_maxResources.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxResources in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxResources has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxResources has not been defined in template %s!", DataResource::getName())); return base->getMaxResources(); } } @@ -149,9 +149,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxResources(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -168,7 +168,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -184,26 +184,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerResourceContainerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerResourceContainerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxResourcesMin(true); #endif } if (!m_maxResources.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxResources in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxResources has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxResources has not been defined in template %s!", DataResource::getName())); return base->getMaxResourcesMin(); } } @@ -213,9 +213,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxResourcesMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -232,7 +232,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -248,26 +248,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerResourceContainerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerResourceContainerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxResourcesMax(true); #endif } if (!m_maxResources.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxResources in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxResources has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxResources has not been defined in template %s!", DataResource::getName())); return base->getMaxResourcesMax(); } } @@ -277,9 +277,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxResourcesMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -296,7 +296,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -343,12 +343,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerShipObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerShipObjectTemplate.cpp index 1acde7a0..a2d12972 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerShipObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerShipObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag ServerShipObjectTemplate::getTemplateVersion(void) const */ Tag ServerShipObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerShipObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerShipObjectTemplate::getHighestTemplateVersion @@ -121,33 +121,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerShipObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerShipObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getShipType(true); #endif } if (!m_shipType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter shipType in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter shipType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter shipType has not been defined in template %s!", DataResource::getName())); return base->getShipType(); } } const std::string & value = m_shipType.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -193,12 +193,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerStaticObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerStaticObjectTemplate.cpp index 767901e7..f2e49fba 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerStaticObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerStaticObjectTemplate.cpp @@ -93,10 +93,10 @@ Tag ServerStaticObjectTemplate::getTemplateVersion(void) const */ Tag ServerStaticObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerStaticObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerStaticObjectTemplate::getHighestTemplateVersion @@ -120,33 +120,33 @@ bool testDataValue = false; UNREF(testData); #endif - const ServerStaticObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerStaticObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getClientOnlyBuildout(true); #endif } if (!m_clientOnlyBuildout.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter clientOnlyBuildout in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter clientOnlyBuildout has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter clientOnlyBuildout has not been defined in template %s!", DataResource::getName())); return base->getClientOnlyBuildout(); } } bool value = m_clientOnlyBuildout.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -192,12 +192,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerTangibleObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerTangibleObjectTemplate.cpp index 39d5e817..3bdb728d 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerTangibleObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerTangibleObjectTemplate.cpp @@ -53,7 +53,7 @@ ServerTangibleObjectTemplate::~ServerTangibleObjectTemplate() for (iter = m_triggerVolumes.begin(); iter != m_triggerVolumes.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_triggerVolumes.clear(); } @@ -105,10 +105,10 @@ Tag ServerTangibleObjectTemplate::getTemplateVersion(void) const */ Tag ServerTangibleObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerTangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerTangibleObjectTemplate::getHighestTemplateVersion @@ -126,27 +126,27 @@ Object * ServerTangibleObjectTemplate::createObject(void) const //@BEGIN TFD const TriggerVolumeData ServerTangibleObjectTemplate::getTriggerVolumes(int index) const { - const ServerTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_triggerVolumesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter triggerVolumes in template %s", DataResource::getName())); return DefaultTriggerVolumeData; } else { - DEBUG_FATAL(base == NULL, ("Template parameter triggerVolumes has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter triggerVolumes has not been defined in template %s!", DataResource::getName())); return base->getTriggerVolumes(index); } } - if (m_triggerVolumesAppend && base != NULL) + if (m_triggerVolumesAppend && base != nullptr) { int baseCount = base->getTriggerVolumesCount(); if (index < baseCount) @@ -164,20 +164,20 @@ size_t ServerTangibleObjectTemplate::getTriggerVolumesCount(void) const { if (!m_triggerVolumesLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const ServerTangibleObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getTriggerVolumesCount(); } size_t count = m_triggerVolumes.size(); // if we are extending our base template, add it's count - if (m_triggerVolumesAppend && m_baseData != NULL) + if (m_triggerVolumesAppend && m_baseData != nullptr) { const ServerTangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getTriggerVolumesCount(); } @@ -192,33 +192,33 @@ ServerTangibleObjectTemplate::CombatSkeleton testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCombatSkeleton(true); #endif } if (!m_combatSkeleton.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter combatSkeleton in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter combatSkeleton has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter combatSkeleton has not been defined in template %s!", DataResource::getName())); return base->getCombatSkeleton(); } } CombatSkeleton value = static_cast(m_combatSkeleton.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -234,26 +234,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxHitPoints(true); #endif } if (!m_maxHitPoints.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxHitPoints in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxHitPoints has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxHitPoints has not been defined in template %s!", DataResource::getName())); return base->getMaxHitPoints(); } } @@ -263,9 +263,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxHitPoints(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -282,7 +282,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -298,26 +298,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxHitPointsMin(true); #endif } if (!m_maxHitPoints.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxHitPoints in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxHitPoints has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxHitPoints has not been defined in template %s!", DataResource::getName())); return base->getMaxHitPointsMin(); } } @@ -327,9 +327,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxHitPointsMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -346,7 +346,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -362,26 +362,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxHitPointsMax(true); #endif } if (!m_maxHitPoints.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxHitPoints in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxHitPoints has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxHitPoints has not been defined in template %s!", DataResource::getName())); return base->getMaxHitPointsMax(); } } @@ -391,9 +391,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxHitPointsMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -410,7 +410,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -420,32 +420,32 @@ UNREF(testData); const ServerArmorTemplate * ServerTangibleObjectTemplate::getArmor() const { - const ServerTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_armor.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter armor in template %s", DataResource::getName())); - return NULL; + return nullptr; } else { - DEBUG_FATAL(base == NULL, ("Template parameter armor has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter armor has not been defined in template %s!", DataResource::getName())); return base->getArmor(); } } - const ServerArmorTemplate * returnValue = NULL; + const ServerArmorTemplate * returnValue = nullptr; const std::string & templateName = m_armor.getValue(); if (!templateName.empty()) { returnValue = dynamic_cast(ObjectTemplateList::fetch(templateName)); - if (returnValue == NULL) + if (returnValue == nullptr) WARNING_STRICT_FATAL(true, ("Error loading template %s",templateName.c_str())); } return returnValue; @@ -459,26 +459,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getInterestRadius(true); #endif } if (!m_interestRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter interestRadius in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter interestRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter interestRadius has not been defined in template %s!", DataResource::getName())); return base->getInterestRadius(); } } @@ -488,9 +488,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getInterestRadius(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -507,7 +507,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -523,26 +523,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getInterestRadiusMin(true); #endif } if (!m_interestRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter interestRadius in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter interestRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter interestRadius has not been defined in template %s!", DataResource::getName())); return base->getInterestRadiusMin(); } } @@ -552,9 +552,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getInterestRadiusMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -571,7 +571,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -587,26 +587,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getInterestRadiusMax(true); #endif } if (!m_interestRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter interestRadius in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter interestRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter interestRadius has not been defined in template %s!", DataResource::getName())); return base->getInterestRadiusMax(); } } @@ -616,9 +616,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getInterestRadiusMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -635,7 +635,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -651,26 +651,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCount(true); #endif } if (!m_count.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter count in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter count has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter count has not been defined in template %s!", DataResource::getName())); return base->getCount(); } } @@ -680,9 +680,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCount(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -699,7 +699,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -715,26 +715,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCountMin(true); #endif } if (!m_count.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter count in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter count has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter count has not been defined in template %s!", DataResource::getName())); return base->getCountMin(); } } @@ -744,9 +744,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCountMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -763,7 +763,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -779,26 +779,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCountMax(true); #endif } if (!m_count.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter count in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter count has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter count has not been defined in template %s!", DataResource::getName())); return base->getCountMax(); } } @@ -808,9 +808,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCountMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -827,7 +827,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -843,26 +843,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCondition(true); #endif } if (!m_condition.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter condition in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter condition has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter condition has not been defined in template %s!", DataResource::getName())); return base->getCondition(); } } @@ -872,9 +872,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCondition(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -891,7 +891,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -907,26 +907,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getConditionMin(true); #endif } if (!m_condition.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter condition in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter condition has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter condition has not been defined in template %s!", DataResource::getName())); return base->getConditionMin(); } } @@ -936,9 +936,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getConditionMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -955,7 +955,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -971,26 +971,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getConditionMax(true); #endif } if (!m_condition.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter condition in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter condition has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter condition has not been defined in template %s!", DataResource::getName())); return base->getConditionMax(); } } @@ -1000,9 +1000,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getConditionMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1019,7 +1019,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1035,33 +1035,33 @@ bool testDataValue = false; UNREF(testData); #endif - const ServerTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getWantSawAttackTriggers(true); #endif } if (!m_wantSawAttackTriggers.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter wantSawAttackTriggers in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter wantSawAttackTriggers has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter wantSawAttackTriggers has not been defined in template %s!", DataResource::getName())); return base->getWantSawAttackTriggers(); } } bool value = m_wantSawAttackTriggers.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1116,12 +1116,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -1150,7 +1150,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_triggerVolumes.begin(); iter != m_triggerVolumes.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_triggerVolumes.clear(); m_triggerVolumesAppend = file.read_bool8(); diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerUniverseObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerUniverseObjectTemplate.cpp index 03a16459..9bba2b4b 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerUniverseObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerUniverseObjectTemplate.cpp @@ -93,10 +93,10 @@ Tag ServerUniverseObjectTemplate::getTemplateVersion(void) const */ Tag ServerUniverseObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerUniverseObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerUniverseObjectTemplate::getHighestTemplateVersion @@ -149,12 +149,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerVehicleObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerVehicleObjectTemplate.cpp index 501b241a..838e7107 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerVehicleObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerVehicleObjectTemplate.cpp @@ -93,10 +93,10 @@ Tag ServerVehicleObjectTemplate::getTemplateVersion(void) const */ Tag ServerVehicleObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerVehicleObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerVehicleObjectTemplate::getHighestTemplateVersion @@ -120,33 +120,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const ServerVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getFuelType(true); #endif } if (!m_fuelType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter fuelType in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter fuelType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter fuelType has not been defined in template %s!", DataResource::getName())); return base->getFuelType(); } } const std::string & value = m_fuelType.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -162,26 +162,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCurrentFuel(true); #endif } if (!m_currentFuel.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter currentFuel in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter currentFuel has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter currentFuel has not been defined in template %s!", DataResource::getName())); return base->getCurrentFuel(); } } @@ -191,9 +191,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCurrentFuel(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -210,7 +210,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -226,26 +226,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCurrentFuelMin(true); #endif } if (!m_currentFuel.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter currentFuel in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter currentFuel has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter currentFuel has not been defined in template %s!", DataResource::getName())); return base->getCurrentFuelMin(); } } @@ -255,9 +255,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCurrentFuelMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -274,7 +274,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -290,26 +290,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCurrentFuelMax(true); #endif } if (!m_currentFuel.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter currentFuel in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter currentFuel has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter currentFuel has not been defined in template %s!", DataResource::getName())); return base->getCurrentFuelMax(); } } @@ -319,9 +319,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCurrentFuelMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -338,7 +338,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -354,26 +354,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxFuel(true); #endif } if (!m_maxFuel.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxFuel in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxFuel has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxFuel has not been defined in template %s!", DataResource::getName())); return base->getMaxFuel(); } } @@ -383,9 +383,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxFuel(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -402,7 +402,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -418,26 +418,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxFuelMin(true); #endif } if (!m_maxFuel.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxFuel in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxFuel has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxFuel has not been defined in template %s!", DataResource::getName())); return base->getMaxFuelMin(); } } @@ -447,9 +447,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxFuelMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -466,7 +466,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -482,26 +482,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxFuelMax(true); #endif } if (!m_maxFuel.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxFuel in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxFuel has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxFuel has not been defined in template %s!", DataResource::getName())); return base->getMaxFuelMax(); } } @@ -511,9 +511,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxFuelMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -530,7 +530,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -546,26 +546,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getConsumpsion(true); #endif } if (!m_consumpsion.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter consumpsion in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter consumpsion has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter consumpsion has not been defined in template %s!", DataResource::getName())); return base->getConsumpsion(); } } @@ -575,9 +575,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getConsumpsion(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -594,7 +594,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -610,26 +610,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getConsumpsionMin(true); #endif } if (!m_consumpsion.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter consumpsion in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter consumpsion has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter consumpsion has not been defined in template %s!", DataResource::getName())); return base->getConsumpsionMin(); } } @@ -639,9 +639,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getConsumpsionMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -658,7 +658,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -674,26 +674,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getConsumpsionMax(true); #endif } if (!m_consumpsion.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter consumpsion in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter consumpsion has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter consumpsion has not been defined in template %s!", DataResource::getName())); return base->getConsumpsionMax(); } } @@ -703,9 +703,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getConsumpsionMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -722,7 +722,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -774,12 +774,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerWeaponObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerWeaponObjectTemplate.cpp index 8d4bbfa0..bf2ee2cb 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerWeaponObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerWeaponObjectTemplate.cpp @@ -93,10 +93,10 @@ Tag ServerWeaponObjectTemplate::getTemplateVersion(void) const */ Tag ServerWeaponObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerWeaponObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerWeaponObjectTemplate::getHighestTemplateVersion @@ -120,33 +120,33 @@ ServerWeaponObjectTemplate::WeaponType testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getWeaponType(true); #endif } if (!m_weaponType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter weaponType in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter weaponType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter weaponType has not been defined in template %s!", DataResource::getName())); return base->getWeaponType(); } } WeaponType value = static_cast(m_weaponType.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -162,33 +162,33 @@ ServerWeaponObjectTemplate::AttackType testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAttackType(true); #endif } if (!m_attackType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attackType in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter attackType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attackType has not been defined in template %s!", DataResource::getName())); return base->getAttackType(); } } AttackType value = static_cast(m_attackType.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -204,33 +204,33 @@ ServerWeaponObjectTemplate::DamageType testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDamageType(true); #endif } if (!m_damageType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter damageType in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter damageType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter damageType has not been defined in template %s!", DataResource::getName())); return base->getDamageType(); } } DamageType value = static_cast(m_damageType.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -246,33 +246,33 @@ ServerWeaponObjectTemplate::DamageType testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getElementalType(true); #endif } if (!m_elementalType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter elementalType in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter elementalType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter elementalType has not been defined in template %s!", DataResource::getName())); return base->getElementalType(); } } DamageType value = static_cast(m_elementalType.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -288,26 +288,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getElementalValue(true); #endif } if (!m_elementalValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter elementalValue in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter elementalValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter elementalValue has not been defined in template %s!", DataResource::getName())); return base->getElementalValue(); } } @@ -317,9 +317,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getElementalValue(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -336,7 +336,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -352,26 +352,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getElementalValueMin(true); #endif } if (!m_elementalValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter elementalValue in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter elementalValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter elementalValue has not been defined in template %s!", DataResource::getName())); return base->getElementalValueMin(); } } @@ -381,9 +381,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getElementalValueMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -400,7 +400,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -416,26 +416,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getElementalValueMax(true); #endif } if (!m_elementalValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter elementalValue in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter elementalValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter elementalValue has not been defined in template %s!", DataResource::getName())); return base->getElementalValueMax(); } } @@ -445,9 +445,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getElementalValueMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -464,7 +464,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -480,26 +480,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMinDamageAmount(true); #endif } if (!m_minDamageAmount.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter minDamageAmount in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter minDamageAmount has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter minDamageAmount has not been defined in template %s!", DataResource::getName())); return base->getMinDamageAmount(); } } @@ -509,9 +509,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinDamageAmount(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -528,7 +528,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -544,26 +544,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMinDamageAmountMin(true); #endif } if (!m_minDamageAmount.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter minDamageAmount in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter minDamageAmount has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter minDamageAmount has not been defined in template %s!", DataResource::getName())); return base->getMinDamageAmountMin(); } } @@ -573,9 +573,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinDamageAmountMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -592,7 +592,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -608,26 +608,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMinDamageAmountMax(true); #endif } if (!m_minDamageAmount.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter minDamageAmount in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter minDamageAmount has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter minDamageAmount has not been defined in template %s!", DataResource::getName())); return base->getMinDamageAmountMax(); } } @@ -637,9 +637,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinDamageAmountMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -656,7 +656,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -672,26 +672,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxDamageAmount(true); #endif } if (!m_maxDamageAmount.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxDamageAmount in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxDamageAmount has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxDamageAmount has not been defined in template %s!", DataResource::getName())); return base->getMaxDamageAmount(); } } @@ -701,9 +701,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxDamageAmount(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -720,7 +720,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -736,26 +736,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxDamageAmountMin(true); #endif } if (!m_maxDamageAmount.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxDamageAmount in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxDamageAmount has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxDamageAmount has not been defined in template %s!", DataResource::getName())); return base->getMaxDamageAmountMin(); } } @@ -765,9 +765,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxDamageAmountMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -784,7 +784,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -800,26 +800,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxDamageAmountMax(true); #endif } if (!m_maxDamageAmount.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxDamageAmount in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxDamageAmount has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxDamageAmount has not been defined in template %s!", DataResource::getName())); return base->getMaxDamageAmountMax(); } } @@ -829,9 +829,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxDamageAmountMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -848,7 +848,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -864,26 +864,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAttackSpeed(true); #endif } if (!m_attackSpeed.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attackSpeed in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter attackSpeed has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attackSpeed has not been defined in template %s!", DataResource::getName())); return base->getAttackSpeed(); } } @@ -893,9 +893,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAttackSpeed(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -912,7 +912,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -928,26 +928,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAttackSpeedMin(true); #endif } if (!m_attackSpeed.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attackSpeed in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter attackSpeed has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attackSpeed has not been defined in template %s!", DataResource::getName())); return base->getAttackSpeedMin(); } } @@ -957,9 +957,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAttackSpeedMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -976,7 +976,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -992,26 +992,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAttackSpeedMax(true); #endif } if (!m_attackSpeed.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attackSpeed in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter attackSpeed has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attackSpeed has not been defined in template %s!", DataResource::getName())); return base->getAttackSpeedMax(); } } @@ -1021,9 +1021,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAttackSpeedMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1040,7 +1040,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1056,26 +1056,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAudibleRange(true); #endif } if (!m_audibleRange.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter audibleRange in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter audibleRange has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter audibleRange has not been defined in template %s!", DataResource::getName())); return base->getAudibleRange(); } } @@ -1085,9 +1085,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAudibleRange(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1104,7 +1104,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1120,26 +1120,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAudibleRangeMin(true); #endif } if (!m_audibleRange.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter audibleRange in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter audibleRange has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter audibleRange has not been defined in template %s!", DataResource::getName())); return base->getAudibleRangeMin(); } } @@ -1149,9 +1149,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAudibleRangeMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1168,7 +1168,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1184,26 +1184,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAudibleRangeMax(true); #endif } if (!m_audibleRange.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter audibleRange in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter audibleRange has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter audibleRange has not been defined in template %s!", DataResource::getName())); return base->getAudibleRangeMax(); } } @@ -1213,9 +1213,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAudibleRangeMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1232,7 +1232,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1248,26 +1248,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMinRange(true); #endif } if (!m_minRange.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter minRange in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter minRange has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter minRange has not been defined in template %s!", DataResource::getName())); return base->getMinRange(); } } @@ -1277,9 +1277,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinRange(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1296,7 +1296,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1312,26 +1312,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMinRangeMin(true); #endif } if (!m_minRange.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter minRange in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter minRange has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter minRange has not been defined in template %s!", DataResource::getName())); return base->getMinRangeMin(); } } @@ -1341,9 +1341,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinRangeMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1360,7 +1360,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1376,26 +1376,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMinRangeMax(true); #endif } if (!m_minRange.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter minRange in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter minRange has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter minRange has not been defined in template %s!", DataResource::getName())); return base->getMinRangeMax(); } } @@ -1405,9 +1405,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinRangeMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1424,7 +1424,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1440,26 +1440,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxRange(true); #endif } if (!m_maxRange.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxRange in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxRange has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxRange has not been defined in template %s!", DataResource::getName())); return base->getMaxRange(); } } @@ -1469,9 +1469,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxRange(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1488,7 +1488,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1504,26 +1504,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxRangeMin(true); #endif } if (!m_maxRange.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxRange in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxRange has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxRange has not been defined in template %s!", DataResource::getName())); return base->getMaxRangeMin(); } } @@ -1533,9 +1533,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxRangeMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1552,7 +1552,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1568,26 +1568,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxRangeMax(true); #endif } if (!m_maxRange.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxRange in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxRange has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxRange has not been defined in template %s!", DataResource::getName())); return base->getMaxRangeMax(); } } @@ -1597,9 +1597,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxRangeMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1616,7 +1616,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1632,26 +1632,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDamageRadius(true); #endif } if (!m_damageRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter damageRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter damageRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter damageRadius has not been defined in template %s!", DataResource::getName())); return base->getDamageRadius(); } } @@ -1661,9 +1661,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getDamageRadius(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1680,7 +1680,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1696,26 +1696,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDamageRadiusMin(true); #endif } if (!m_damageRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter damageRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter damageRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter damageRadius has not been defined in template %s!", DataResource::getName())); return base->getDamageRadiusMin(); } } @@ -1725,9 +1725,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getDamageRadiusMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1744,7 +1744,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1760,26 +1760,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDamageRadiusMax(true); #endif } if (!m_damageRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter damageRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter damageRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter damageRadius has not been defined in template %s!", DataResource::getName())); return base->getDamageRadiusMax(); } } @@ -1789,9 +1789,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getDamageRadiusMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1808,7 +1808,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1824,26 +1824,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getWoundChance(true); #endif } if (!m_woundChance.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter woundChance in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter woundChance has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter woundChance has not been defined in template %s!", DataResource::getName())); return base->getWoundChance(); } } @@ -1853,9 +1853,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getWoundChance(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1872,7 +1872,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1888,26 +1888,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getWoundChanceMin(true); #endif } if (!m_woundChance.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter woundChance in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter woundChance has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter woundChance has not been defined in template %s!", DataResource::getName())); return base->getWoundChanceMin(); } } @@ -1917,9 +1917,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getWoundChanceMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1936,7 +1936,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1952,26 +1952,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getWoundChanceMax(true); #endif } if (!m_woundChance.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter woundChance in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter woundChance has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter woundChance has not been defined in template %s!", DataResource::getName())); return base->getWoundChanceMax(); } } @@ -1981,9 +1981,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getWoundChanceMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2000,7 +2000,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2016,26 +2016,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAttackCost(true); #endif } if (!m_attackCost.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attackCost in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter attackCost has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attackCost has not been defined in template %s!", DataResource::getName())); return base->getAttackCost(); } } @@ -2045,9 +2045,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAttackCost(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2064,7 +2064,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2080,26 +2080,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAttackCostMin(true); #endif } if (!m_attackCost.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attackCost in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter attackCost has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attackCost has not been defined in template %s!", DataResource::getName())); return base->getAttackCostMin(); } } @@ -2109,9 +2109,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAttackCostMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2128,7 +2128,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2144,26 +2144,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAttackCostMax(true); #endif } if (!m_attackCost.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attackCost in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter attackCost has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attackCost has not been defined in template %s!", DataResource::getName())); return base->getAttackCostMax(); } } @@ -2173,9 +2173,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAttackCostMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2192,7 +2192,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2208,26 +2208,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAccuracy(true); #endif } if (!m_accuracy.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter accuracy in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter accuracy has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter accuracy has not been defined in template %s!", DataResource::getName())); return base->getAccuracy(); } } @@ -2237,9 +2237,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAccuracy(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2256,7 +2256,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2272,26 +2272,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAccuracyMin(true); #endif } if (!m_accuracy.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter accuracy in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter accuracy has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter accuracy has not been defined in template %s!", DataResource::getName())); return base->getAccuracyMin(); } } @@ -2301,9 +2301,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAccuracyMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2320,7 +2320,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2336,26 +2336,26 @@ int testDataValue = 0; UNREF(testData); #endif - const ServerWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const ServerWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAccuracyMax(true); #endif } if (!m_accuracy.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter accuracy in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter accuracy has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter accuracy has not been defined in template %s!", DataResource::getName())); return base->getAccuracyMax(); } } @@ -2365,9 +2365,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAccuracyMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2384,7 +2384,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2455,12 +2455,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerXpManagerObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerXpManagerObjectTemplate.cpp index 4ee70d19..0fc6ff30 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerXpManagerObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerXpManagerObjectTemplate.cpp @@ -95,10 +95,10 @@ Tag ServerXpManagerObjectTemplate::getTemplateVersion(void) const */ Tag ServerXpManagerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerXpManagerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerXpManagerObjectTemplate::getHighestTemplateVersion @@ -111,7 +111,7 @@ Tag ServerXpManagerObjectTemplate::getHighestTemplateVersion(void) const Object * ServerXpManagerObjectTemplate::createObject(void) const { // return new XpManagerObject(this); - return NULL; + return nullptr; } // ServerXpManagerObjectTemplate::createObject //@BEGIN TFD @@ -152,12 +152,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/server/library/serverGame/src/shared/pvp/Pvp.cpp b/engine/server/library/serverGame/src/shared/pvp/Pvp.cpp index 4de849cd..d6e291ae 100755 --- a/engine/server/library/serverGame/src/shared/pvp/Pvp.cpp +++ b/engine/server/library/serverGame/src/shared/pvp/Pvp.cpp @@ -613,7 +613,7 @@ void Pvp::updateTimedFlags(const void *context) unsigned long const updateTimeMs = static_cast(ConfigServerGame::getPvpUpdateTimeMs()); PvpInternal::updateTimedFlags(updateTimeMs); - getScheduler().setCallback(Pvp::updateTimedFlags, NULL, updateTimeMs); + getScheduler().setCallback(Pvp::updateTimedFlags, nullptr, updateTimeMs); } // ---------------------------------------------------------------------- @@ -754,7 +754,7 @@ Pvp::GcwScoreCategory const * Pvp::getGcwScoreCategory(std::string const & score if (iterFind != s_gcwScoreCategory.end()) return iterFind->second; - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -765,7 +765,7 @@ Pvp::GcwScoreCategory const * Pvp::getGcwScoreDefaultCategoryForPlanet(std::stri if (iterFind != s_gcwScoreDefaultCategoryForPlanet.end()) return iterFind->second; - return NULL; + return nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/pvp/PvpRuleSetBase.cpp b/engine/server/library/serverGame/src/shared/pvp/PvpRuleSetBase.cpp index 440b0ed7..d0c4212f 100755 --- a/engine/server/library/serverGame/src/shared/pvp/PvpRuleSetBase.cpp +++ b/engine/server/library/serverGame/src/shared/pvp/PvpRuleSetBase.cpp @@ -27,8 +27,8 @@ namespace PvpRuleSetBaseNamespace // if object is authoritative, then apply repercussions immediately; // otherwise, forward repercussions over to the authoritative server - PvpUpdateObserver * o = NULL; - MessageQueuePvpCommand * messageQueuePvpCommand = NULL; + PvpUpdateObserver * o = nullptr; + MessageQueuePvpCommand * messageQueuePvpCommand = nullptr; if (actor.isAuthoritative()) o = new PvpUpdateObserver(&actor, Archive::ADOO_generic); diff --git a/engine/server/library/serverGame/src/shared/pvp/PvpUpdateObserver.cpp b/engine/server/library/serverGame/src/shared/pvp/PvpUpdateObserver.cpp index 70f55095..d333bbb0 100755 --- a/engine/server/library/serverGame/src/shared/pvp/PvpUpdateObserver.cpp +++ b/engine/server/library/serverGame/src/shared/pvp/PvpUpdateObserver.cpp @@ -81,7 +81,7 @@ PvpUpdateObserver::PvpUpdateObserver(TangibleObject const *who, Archive::AutoDel m_pvpFaction = who->getPvpFaction(); // get client visible status for everyone observing this object (including itself) - if ((s_objectsProcessedThisFrame.count(who->getNetworkId()) == 0) && satisfyPvpSyncCondition(who->isNonPvpObject(), who->hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (who->asCreatureObject() != NULL), who->getPvpFaction())) + if ((s_objectsProcessedThisFrame.count(who->getNetworkId()) == 0) && satisfyPvpSyncCondition(who->isNonPvpObject(), who->hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (who->asCreatureObject() != nullptr), who->getPvpFaction())) { std::set const &clients = who->getObservers(); for (std::set::const_iterator i = clients.begin(); i != clients.end(); ++i) @@ -146,8 +146,8 @@ PvpUpdateObserver::~PvpUpdateObserver() PvpData::isRebelFactionId(m_obj->getPvpFaction())) { // did the object's "pvp sync" status change because of the faction change? - bool const wasPvpSync = PvpUpdateObserver::satisfyPvpSyncCondition(m_obj->isNonPvpObject(), m_obj->hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (m_obj->asCreatureObject() != NULL), m_pvpFaction); - bool const isPvpSync = PvpUpdateObserver::satisfyPvpSyncCondition(m_obj->isNonPvpObject(), m_obj->hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (m_obj->asCreatureObject() != NULL), m_obj->getPvpFaction()); + bool const wasPvpSync = PvpUpdateObserver::satisfyPvpSyncCondition(m_obj->isNonPvpObject(), m_obj->hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (m_obj->asCreatureObject() != nullptr), m_pvpFaction); + bool const isPvpSync = PvpUpdateObserver::satisfyPvpSyncCondition(m_obj->isNonPvpObject(), m_obj->hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (m_obj->asCreatureObject() != nullptr), m_obj->getPvpFaction()); if (wasPvpSync != isPvpSync) { @@ -173,7 +173,7 @@ PvpUpdateObserver::~PvpUpdateObserver() void PvpUpdateObserver::updatePvpStatusCache(Client const *client, TangibleObject const &who, uint32 flags, uint32 factionId) { - if (!client || !who.getNetworkId().isValid() || !PvpUpdateObserver::satisfyPvpSyncCondition(who.isNonPvpObject(), who.hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (who.asCreatureObject() != NULL), who.getPvpFaction())) + if (!client || !who.getNetworkId().isValid() || !PvpUpdateObserver::satisfyPvpSyncCondition(who.isNonPvpObject(), who.hasCondition(ServerTangibleObjectTemplate::C_invulnerable), (who.asCreatureObject() != nullptr), who.getPvpFaction())) return; s_pvpUpdateObserverCache[client][who.getNetworkId()] = std::make_pair(flags, factionId); diff --git a/engine/server/library/serverGame/src/shared/region/Region.cpp b/engine/server/library/serverGame/src/shared/region/Region.cpp index fc74229a..c24a3500 100755 --- a/engine/server/library/serverGame/src/shared/region/Region.cpp +++ b/engine/server/library/serverGame/src/shared/region/Region.cpp @@ -22,7 +22,7 @@ static std::map s_nameCrcRegionMap; * Class constructor for a static region. */ Region::Region() : - m_bounds(NULL), + m_bounds(nullptr), m_dynamicRegionId(), m_name(), m_nameCrc(0), @@ -49,7 +49,7 @@ Region::Region() : * @param dynamicRegionId the id of the dynamic region object */ Region::Region(const CachedNetworkId & dynamicRegionId) : - m_bounds(NULL), + m_bounds(nullptr), m_dynamicRegionId(dynamicRegionId), m_name(), m_nameCrc(0), @@ -83,7 +83,7 @@ Region::~Region() } delete const_cast(m_bounds); - m_bounds = NULL; + m_bounds = nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/region/RegionMaster.cpp b/engine/server/library/serverGame/src/shared/region/RegionMaster.cpp index 6cbb7710..d8f734a6 100755 --- a/engine/server/library/serverGame/src/shared/region/RegionMaster.cpp +++ b/engine/server/library/serverGame/src/shared/region/RegionMaster.cpp @@ -82,7 +82,7 @@ struct RegionMaster::RegionData MxCifQuadTree * tree; RegionsMappedByName nameMap; - RegionData() : tree(NULL), nameMap() {} + RegionData() : tree(nullptr), nameMap() {} }; namespace RegionMasterNamspace @@ -133,7 +133,7 @@ void RegionMaster::exit() i1 != ms_planetRegions.end(); ++i1) { delete (*i1).second.tree; - (*i1).second.tree = NULL; + (*i1).second.tree = nullptr; } ms_planetRegions.clear(); } @@ -143,7 +143,7 @@ void RegionMaster::exit() i2 != ms_staticRegions.end(); ++i2) { delete const_cast(*i2); - *i2 = NULL; + *i2 = nullptr; } ms_staticRegions.clear(); } @@ -153,7 +153,7 @@ void RegionMaster::exit() i2 != ms_dynamicRegions.end(); ++i2) { delete const_cast(*i2); - *i2 = NULL; + *i2 = nullptr; } ms_dynamicRegions.clear(); } @@ -178,7 +178,7 @@ void RegionMaster::readRegionDataTables() const char * regionFilesName = ConfigServerGame::getRegionFilesName(); DataTable * const regionFilesTable = DataTableManager::getTable(regionFilesName, true); - if (regionFilesTable == NULL) + if (regionFilesTable == nullptr) { WARNING(true, ("RegionMaster::readRegionDataTables could not open file %s, static regions will not be read!", regionFilesName)); return; @@ -197,14 +197,14 @@ void RegionMaster::readRegionDataTables() float regionMaxY = regionFilesTable->getFloatValue (5, i); DataTable * const regionTable = DataTableManager::getTable(regionFileName, true); - if (regionTable == NULL) + if (regionTable == nullptr) { WARNING(true, ("RegionMaster::readRegionDataTables could not open region file %s.", regionFileName.c_str())); continue; } RegionData & regionData = ms_planetRegions[planetName]; - if (regionData.tree == NULL) + if (regionData.tree == nullptr) { regionData.tree = new MxCifQuadTree(regionMinX, regionMinY, regionMaxX, regionMaxY, ConfigServerGame::getRegionTreeDepth()); } @@ -246,7 +246,7 @@ void RegionMaster::readRegionDataTables() } // create a rectangular or circular region and add it to the region tree - Region * region = NULL; + Region * region = nullptr; switch (geometry) { case RG_rectagle: @@ -284,7 +284,7 @@ void RegionMaster::readRegionDataTables() continue; } // set the rest of the region's data - if (region != NULL) + if (region != nullptr) { region->setName(name); region->setPlanet(planetName); @@ -400,7 +400,7 @@ void RegionMaster::createNewDynamicRegion(float minX, float minZ, * @param visible visible flag * @param notify notify flag * - * @return the new region, or NULL on error + * @return the new region, or nullptr on error */ void RegionMaster::createNewDynamicRegion(float centerX, float centerZ, float radius, const Unicode::String & name, const std::string & planet, int pvp, @@ -512,7 +512,7 @@ const Region * RegionMaster::addDynamicRegion(const UniverseObject & source) if (!ms_installed) { WARNING(true, ("RegionMaster::addDynamicRegion, not installed")); - return NULL; + return nullptr; } DynamicVariableList::NestedList regionObjvars(source.getObjVars(),OBJVAR_DYNAMIC_REGION); @@ -521,124 +521,124 @@ const Region * RegionMaster::addDynamicRegion(const UniverseObject & source) if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_PLANET,planet)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no planet data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } Unicode::String name; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_NAME,name)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no name data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } if (name.empty()) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has empty " "name data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } int geometry = 0; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_GEOMETRY,geometry)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "geometry data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } float minX; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_MINX,minX)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "minX data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } float minY; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_MINY,minY)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "minY data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } float maxX; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_MAXX,maxX)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "maxX data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } float maxY; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_MAXY,maxY)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "maxY data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } int pvp=0; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_PVP,pvp)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "pvp data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } int geography=0; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_GEOGRAPHY,geography)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "geography data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } int minDifficulty = 0; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_MIN_DIFFICULTY, minDifficulty)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "min difficulty data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } int maxDifficulty = 0; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_MAX_DIFFICULTY, maxDifficulty)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "max difficulty data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } int spawn = 0; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_SPAWN,spawn)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "spawn data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } int mission = 0; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_MISSION,mission)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "mission data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } int buildable = 0; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_BUILDABLE,buildable)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "buildable data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } int municipal = 0; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_MUNICIPAL,municipal)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "municipal data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } int visible = 0; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_VISIBLE,visible)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "visible data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } int notify = 0; if (!regionObjvars.getItem(OBJVAR_DYNAMIC_REGION_NOTIFY,notify)) { DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has no " "notify data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } // find the appropriate region data for the planet @@ -650,14 +650,14 @@ const Region * RegionMaster::addDynamicRegion(const UniverseObject & source) WARNING(true, ("RegionMaster::addDynamicRegion object %s gave unknown " "planet %s for its region", source.getNetworkId().getValueString().c_str(), Unicode::wideToNarrow(planet).c_str())); - return NULL; + return nullptr; } RegionData & regionData = (*result).second; - if (regionData.tree == NULL) + if (regionData.tree == nullptr) { WARNING_STRICT_FATAL(true, ("RegionMaster::addDynamicRegion planet %s " "has no tree defined!", Unicode::wideToNarrow(planet).c_str())); - return NULL; + return nullptr; } // make sure the region name is unique @@ -666,11 +666,11 @@ const Region * RegionMaster::addDynamicRegion(const UniverseObject & source) WARNING(true, ("RegionMaster::addDynamicRegion object %s is trying " "to add duplicate region %s", source.getNetworkId().getValueString().c_str(), Unicode::wideToNarrow(name).c_str())); - return NULL; + return nullptr; } // create a rectangular or circular region and add it to the region tree - Region * region = NULL; + Region * region = nullptr; switch (geometry) { case RG_rectagle: @@ -706,14 +706,14 @@ const Region * RegionMaster::addDynamicRegion(const UniverseObject & source) DEBUG_WARNING(true, ("RegionMaster::addDynamicRegion object %s has unknown " "geometry type", source.getNetworkId().getValueString().c_str(), geometry)); - return NULL; + return nullptr; } - if (region == NULL) + if (region == nullptr) { WARNING(true, ("RegionMaster::readRegionDataTables could " "not add region defined by object %s to region tree", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } // set the rest of the region's data @@ -803,7 +803,7 @@ void RegionMaster::removeDynamicRegion(const UniverseObject & source) return; } RegionData & regionData = (*dataResult).second; - if (regionData.tree == NULL) + if (regionData.tree == nullptr) { WARNING_STRICT_FATAL(true, ("RegionMaster::addDynamicRegion planet %s " "has no tree defined!", Unicode::wideToNarrow(planet).c_str())); @@ -888,7 +888,7 @@ const Region * RegionMaster::getDynamicRegionFromObject(const UniverseObject & s if (!ms_installed) { WARNING(true, ("RegionMaster::getDynamicRegionFromObject, not installed")); - return NULL; + return nullptr; } DynamicVariableList::NestedList regionObjVars(source.getObjVars(),OBJVAR_DYNAMIC_REGION); @@ -898,14 +898,14 @@ const Region * RegionMaster::getDynamicRegionFromObject(const UniverseObject & s { DEBUG_WARNING(true, ("RegionMaster::getDynamicRegionFromObject object %s has no " "planet data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } Unicode::String name; if (!regionObjVars.getItem(OBJVAR_DYNAMIC_REGION_NAME,name)) { DEBUG_WARNING(true, ("RegionMaster::getDynamicRegionFromObject object %s has no " "name data", source.getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } return getRegionByName(Unicode::wideToNarrow(planet), name); @@ -921,17 +921,17 @@ Region * RegionMaster::getRegionByName(const std::string & planetName, const Uni if (!ms_installed) { WARNING(true, ("RegionMaster::getRegionByName, not installed")); - return NULL; + return nullptr; } const RegionData & regionData = ms_planetRegions[planetName]; - if (regionData.tree != NULL) + if (regionData.tree != nullptr) { RegionsMappedByName::const_iterator result = regionData.nameMap.find(regionName); if (result != regionData.nameMap.end()) return (*result).second; } - return NULL; + return nullptr; } // RegionMaster::getRegionByName //---------------------------------------------------------------------- @@ -944,18 +944,18 @@ const Region * RegionMaster::getSmallestRegionAtPoint(const std::string & planet if (!ms_installed) { WARNING(true, ("RegionMaster::getSmallestRegionAtPoint, not installed")); - return NULL; + return nullptr; } std::vector regions; getRegionsAtPoint(planet, x, z, regions); float area = 0; - const Region * region = NULL; + const Region * region = nullptr; for (std::vector::const_iterator iter = regions.begin(); iter != regions.end(); ++iter) { - if (region == NULL) + if (region == nullptr) { region = *iter; area = region->getArea(); @@ -983,19 +983,19 @@ const Region * RegionMaster::getSmallestVisibleRegionAtPoint(const std::string & if (!ms_installed) { WARNING(true, ("RegionMaster::getSmallestRegionAtPoint, not installed")); - return NULL; + return nullptr; } std::vector regions; getRegionsAtPoint(planet, x, z, regions); float area = 0; - const Region * region = NULL; + const Region * region = nullptr; for (std::vector::const_iterator iter = regions.begin(); iter != regions.end(); ++iter) { if ((*iter)->isVisible()) { - if (region == NULL) + if (region == nullptr) { region = *iter; area = region->getArea(); @@ -1036,7 +1036,7 @@ void RegionMaster::getRegionsAtPoint(const std::string & planet, float x, float } const RegionData & regionData = ms_planetRegions[planet]; - if (regionData.tree != NULL) + if (regionData.tree != nullptr) { std::vector objects; regionData.tree->getObjectsAt(x, z, objects); @@ -1065,7 +1065,7 @@ void RegionMaster::getRegionsForPlanet(const std::string & planetName, } const RegionData & regionData = ms_planetRegions[planetName]; - if (regionData.tree != NULL) + if (regionData.tree != nullptr) { std::vector objects; regionData.tree->getAllObjects(objects); @@ -1222,7 +1222,7 @@ bool RegionMaster::setDynamicSpawnRegionObjectData(UniverseObject & object, int municipal, int geography, int minDifficulty, int maxDifficulty, int spawnable, int mission, bool visible, bool notify, std::string spawntable, int duration) { - time_t const birthEpoch = ::time(NULL); + time_t const birthEpoch = ::time(nullptr); time_t const endEpoch = birthEpoch + (duration * 60); // Duration is in minutes. object.setObjVarItem(OBJVAR_DYNAMIC_REGION + "." + OBJVAR_DYNAMIC_REGION_NAME, name); diff --git a/engine/server/library/serverGame/src/shared/resource/SurveySystem.cpp b/engine/server/library/serverGame/src/shared/resource/SurveySystem.cpp index cac26554..93c8f549 100755 --- a/engine/server/library/serverGame/src/shared/resource/SurveySystem.cpp +++ b/engine/server/library/serverGame/src/shared/resource/SurveySystem.cpp @@ -132,7 +132,7 @@ bool SurveySystem::TaskSurvey::run() Client const * client = GameServer::getInstance().getClient(m_playerId); ResourceTypeObject const * typeObj = ServerUniverse::getInstance().getResourceTypeByName(*m_resourceTypeName); ResourceClassObject const * parentClass = ServerUniverse::getInstance().getResourceClassByName(*m_parentResourceClassName); - ResourcePoolObject const * pool = typeObj ? typeObj->getPoolForCurrentPlanet() : NULL; + ResourcePoolObject const * pool = typeObj ? typeObj->getPoolForCurrentPlanet() : nullptr; int distBetweenPoints = m_surveyRange / (m_numPoints - 1); // -1 is so that we get points at both ends int radius = m_surveyRange / 2; diff --git a/engine/server/library/serverGame/src/shared/space/Missile.cpp b/engine/server/library/serverGame/src/shared/space/Missile.cpp index bd4400a5..67582022 100755 --- a/engine/server/library/serverGame/src/shared/space/Missile.cpp +++ b/engine/server/library/serverGame/src/shared/space/Missile.cpp @@ -304,7 +304,7 @@ ServerObject * Missile::getSourceServerObject() const if (sourceObject) return sourceObject->asServerObject(); else - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -315,7 +315,7 @@ ServerObject * Missile::getTargetServerObject() const if (targetObject) return targetObject->asServerObject(); else - return NULL; + return nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/space/MissileManager.cpp b/engine/server/library/serverGame/src/shared/space/MissileManager.cpp index ab30ae81..512696ff 100755 --- a/engine/server/library/serverGame/src/shared/space/MissileManager.cpp +++ b/engine/server/library/serverGame/src/shared/space/MissileManager.cpp @@ -21,7 +21,7 @@ // ====================================================================== -MissileManager * MissileManager::ms_instance = NULL; +MissileManager * MissileManager::ms_instance = nullptr; // ====================================================================== @@ -37,7 +37,7 @@ void MissileManager::install() void MissileManager::remove() { delete ms_instance; - ms_instance = NULL; + ms_instance = nullptr; } // ---------------------------------------------------------------------- @@ -217,7 +217,7 @@ Missile * MissileManager::getMissile(int missileId) if (i!=m_missiles.end()) return i->second; else - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -228,7 +228,7 @@ const Missile * MissileManager::getConstMissile(int missileId) const if (i!=m_missiles.end()) return i->second; else - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -241,13 +241,13 @@ int MissileManager::getNearestUnlockedMissileForTarget(const NetworkId &target) { const std::pair range=m_missilesForTarget.equal_range(target); - const Missile *targetedMissile=NULL; + const Missile *targetedMissile=nullptr; for (MissilesForTargetType::const_iterator i=range.first; i!=range.second; ++i) { const Missile * const missile=getConstMissile(i->second); DEBUG_FATAL(!missile,("Programmer bug: Missile %i was in m_missilesForTarget, but was not in m_missiles",i->second)); if (missile && missile->getState() == Missile::MS_Launched && - (!targetedMissile || (missile->getImpactTime() < targetedMissile->getImpactTime()))) //lint !e774: missile is non-null in debug mode + (!targetedMissile || (missile->getImpactTime() < targetedMissile->getImpactTime()))) //lint !e774: missile is non-nullptr in debug mode targetedMissile = missile; } @@ -315,7 +315,7 @@ const MissileManager::MissileTypeDataRecord * MissileManager::getMissileTypeData if (i!=m_missileTypeData.end()) return &(i->second); else - return NULL; + return nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/space/NebulaManagerServer.cpp b/engine/server/library/serverGame/src/shared/space/NebulaManagerServer.cpp index 432d57f6..910cbcc3 100755 --- a/engine/server/library/serverGame/src/shared/space/NebulaManagerServer.cpp +++ b/engine/server/library/serverGame/src/shared/space/NebulaManagerServer.cpp @@ -89,7 +89,7 @@ void NebulaManagerServer::update(float elapsedTime) void NebulaManagerServer::enqueueLightning(NebulaLightningData const & nebulaLightningData) { Nebula const * const nebula = NebulaManager::getNebulaById(nebulaLightningData.nebulaId); - if (nebula == NULL) + if (nebula == nullptr) { WARNING(true, ("NebulaManagerServer::enqueueLightning invalid nebula [%d]", nebulaLightningData.nebulaId)); return; @@ -164,7 +164,7 @@ void NebulaManagerServer::handleEnqueuedLightningEvents() NebulaLightningData const & nebulaLightningData = (*it); Nebula const * const nebula = NebulaManager::getNebulaById(nebulaLightningData.nebulaId); - if (nebula == NULL) + if (nebula == nullptr) { it = s_lightningDataVector.erase(it); continue; @@ -203,7 +203,7 @@ void NebulaManagerServer::handleEnqueuedLightningEvents() ServerObject const * const serverHitObject = hitObject->asServerObject(); ShipObject const * const shipHitObject = serverHitObject->asShipObject(); - if (shipHitObject != NULL) + if (shipHitObject != nullptr) { NetworkIdTimeMap::const_iterator const oit = s_objectsRecentlyHitByLightning.find(CachedNetworkId(*hitObject)); if (oit == s_objectsRecentlyHitByLightning.end() || (*oit).second < clockTimeMs) @@ -304,7 +304,7 @@ void NebulaManagerServer::generateLightningEvents(float elapsedTime) void NebulaManagerServer::handleEnvironmentalDamage(ServerObject & victim, int nebulaId) { Nebula const * const nebula = NebulaManager::getNebulaById(nebulaId); - if (nebula == NULL) + if (nebula == nullptr) return; float const environmentalDamageFrequency = nebula->getEnvironmentalDamageFrequency(); diff --git a/engine/server/library/serverGame/src/shared/space/ProjectileManager.cpp b/engine/server/library/serverGame/src/shared/space/ProjectileManager.cpp index 61ff31b3..2354ae60 100755 --- a/engine/server/library/serverGame/src/shared/space/ProjectileManager.cpp +++ b/engine/server/library/serverGame/src/shared/space/ProjectileManager.cpp @@ -85,7 +85,7 @@ namespace ProjectileManagerNamespace //---------------------------------------------------------------------- Projectile() : - m_owner(NULL), + m_owner(nullptr), m_weaponIndex(0), m_projectileIndex(0), m_targetedComponent(0), @@ -155,7 +155,7 @@ namespace ProjectileManagerNamespace ColliderList collidedWith; CollisionWorld::getDatabase()->queryFor(static_cast(SpatialDatabase::Q_Physicals), CellProperty::getWorldCellProperty(), true, projectileCapsule_w, collidedWith); - Object * closestObject = NULL; + Object * closestObject = nullptr; float smallestTime = 0.0f; Vector collisionPosition_o; @@ -166,14 +166,14 @@ namespace ProjectileManagerNamespace { // find which object it collided with first, and when BaseExtent const * const extent_l = (*i)->getExtent_l(); - if (extent_l == NULL) - WARNING(true, ("ProjectileManager collided with object with null extent. [%s], appearance=[%s]", collider.getDebugName(), collider.getAppearanceTemplateName())); + if (extent_l == nullptr) + WARNING(true, ("ProjectileManager collided with object with nullptr extent. [%s], appearance=[%s]", collider.getDebugName(), collider.getAppearanceTemplateName())); else { Vector const start_o = collider.rotateTranslate_w2o(projectilePosition_w); Vector const end_o = collider.rotateTranslate_w2o(projectilePosition_w + projectilePath); float time; - if (extent_l->intersect(start_o, end_o, NULL, &time)) + if (extent_l->intersect(start_o, end_o, nullptr, &time)) { if (!closestObject || time < smallestTime) { @@ -415,7 +415,7 @@ void ProjectileManager::update(float timePassed) // static ShipObject * const shipObject = projectile.getOwner(); - if (NULL == shipObject) + if (nullptr == shipObject) { WARNING(true, ("ProjectileManager beam weapon [%d] for ship id [%s], ship object no longer exists.", weaponIndex, shipId.getValueString().c_str())); } diff --git a/engine/server/library/serverGame/src/shared/space/ServerAsteroidManager.cpp b/engine/server/library/serverGame/src/shared/space/ServerAsteroidManager.cpp index 1a0cfa50..09fb57d0 100755 --- a/engine/server/library/serverGame/src/shared/space/ServerAsteroidManager.cpp +++ b/engine/server/library/serverGame/src/shared/space/ServerAsteroidManager.cpp @@ -116,10 +116,10 @@ ServerAsteroidManager::FieldHandle ServerAsteroidManager::generateField(Asteroid return BAD_HANDLE; } - ServerObject * newAsteroid = NULL; + ServerObject * newAsteroid = nullptr; //TODO disable server-rotation for now, it apparently spams the client horribly -// RotationDynamics * rotationDynamics = NULL; +// RotationDynamics * rotationDynamics = nullptr; for(std::vector::iterator i = asteroidDatas.begin(); i != asteroidDatas.end(); ++i) { @@ -274,7 +274,7 @@ void ServerAsteroidManager::getServerAsteroidData(std::vector & /*OUT*/ for(std::vector::iterator i = ms_asteroids.begin(); i != ms_asteroids.end(); ++i) { Object const * const o = NetworkIdManager::getObjectById(*i); - ServerObject const * const so = o ? o->asServerObject() : NULL; + ServerObject const * const so = o ? o->asServerObject() : nullptr; if(so) { spheres.push_back(so->getSphereExtent()); @@ -297,9 +297,9 @@ void ServerAsteroidManager::sendServerAsteroidDataToPlayer(NetworkId const & pla MessageQueueGenericValueType > * const msg = new MessageQueueGenericValueType >(spheres); Object * const o = NetworkIdManager::getObjectById(player); - ServerObject * const so = o ? o->asServerObject() : NULL; - CreatureObject * const co = so ? so->asCreatureObject() : NULL; - Client const * const client = co ? co->getClient() : NULL; + ServerObject * const so = o ? o->asServerObject() : nullptr; + CreatureObject * const co = so ? so->asCreatureObject() : nullptr; + Client const * const client = co ? co->getClient() : nullptr; if(client && co && co->isAuthoritative()) { co->getController()->appendMessage(static_cast(CM_serverAsteroidDebugData), 0.0f, msg, diff --git a/engine/server/library/serverGame/src/shared/space/ServerShipComponentData.cpp b/engine/server/library/serverGame/src/shared/space/ServerShipComponentData.cpp index b0817411..0fc6e7a6 100755 --- a/engine/server/library/serverGame/src/shared/space/ServerShipComponentData.cpp +++ b/engine/server/library/serverGame/src/shared/space/ServerShipComponentData.cpp @@ -89,7 +89,7 @@ void ServerShipComponentData::writeDataToShip (int const chassisSlot, Ship bool ServerShipComponentData::readDataFromComponent (TangibleObject const & component) { - if (component.getObjectTemplate () == NULL) + if (component.getObjectTemplate () == nullptr) { WARNING (true, ("ShipComponentData [%s] has no object template", component.getNetworkId ().getValueString ().c_str ())); return false; @@ -137,13 +137,13 @@ bool ServerShipComponentData::readDataFromComponent (TangibleObject const & comp void ServerShipComponentData::writeDataToComponent (TangibleObject & component) const { - if (m_descriptor == NULL) + if (m_descriptor == nullptr) { - WARNING (true, ("ShipComponentData::writeDataToComponent [%s] null descriptor", component.getNetworkId ().getValueString ().c_str ())); + WARNING (true, ("ShipComponentData::writeDataToComponent [%s] nullptr descriptor", component.getNetworkId ().getValueString ().c_str ())); return; } - if (component.getObjectTemplate () == NULL) + if (component.getObjectTemplate () == nullptr) { WARNING (true, ("ShipComponentData::writeDataToComponent [%s] has no object template", component.getNetworkId ().getValueString ().c_str ())); return; @@ -180,7 +180,7 @@ void ServerShipComponentData::writeDataToComponent (TangibleObject & component) void ServerShipComponentData::printDebugString (Unicode::String & result, Unicode::String const & padding) const { - if (m_descriptor == NULL) + if (m_descriptor == nullptr) return; char buf [2048]; diff --git a/engine/server/library/serverGame/src/shared/space/ShipAiEnemySearchManager.cpp b/engine/server/library/serverGame/src/shared/space/ShipAiEnemySearchManager.cpp index aca06580..81586895 100755 --- a/engine/server/library/serverGame/src/shared/space/ShipAiEnemySearchManager.cpp +++ b/engine/server/library/serverGame/src/shared/space/ShipAiEnemySearchManager.cpp @@ -60,8 +60,8 @@ void ShipAiEnemySearchManagerNamespace::checkForEnemies(ShipObject &ship) if (shipController) { - AiShipController * const aiShipController = (shipController != NULL) ? shipController->asAiShipController() : NULL; - float const aggroRadiusSquared = sqr((aiShipController != NULL) ? aiShipController->getAggroRadius() : 512.0f); // 512.0f is the distance at which turrets on player ships start getting targets + AiShipController * const aiShipController = (shipController != nullptr) ? shipController->asAiShipController() : nullptr; + float const aggroRadiusSquared = sqr((aiShipController != nullptr) ? aiShipController->getAggroRadius() : 512.0f); // 512.0f is the distance at which turrets on player ships start getting targets Vector const shipPosition_w = ship.getPosition_w(); static std::vector s_visibilityList; @@ -117,7 +117,7 @@ void ShipAiEnemySearchManagerNamespace::checkForEnemies(ShipObject &ship) ShipObject * const enemy = s_enemyList[randomIndex]; ShipController * const enemyShipController = enemy->getController()->asShipController(); - if (enemyShipController != NULL) + if (enemyShipController != nullptr) { // Limit the number of ships that can attack a single enemy diff --git a/engine/server/library/serverGame/src/shared/space/ShipComponentDataCargoHold.cpp b/engine/server/library/serverGame/src/shared/space/ShipComponentDataCargoHold.cpp index ba495697..bf76572c 100755 --- a/engine/server/library/serverGame/src/shared/space/ShipComponentDataCargoHold.cpp +++ b/engine/server/library/serverGame/src/shared/space/ShipComponentDataCargoHold.cpp @@ -165,7 +165,7 @@ void ShipComponentDataCargoHold::printDebugString (Unicode::String & result int const amount = (*it).second; ResourceTypeObject const * const resourceType = ServerUniverse::getInstance().getResourceTypeById(id); - std::string const resourceName = resourceType ? resourceType->getResourceName() : "NULL RESOURCE"; + std::string const resourceName = resourceType ? resourceType->getResourceName() : "nullptr RESOURCE"; snprintf(buf, buf_size, "%s %15s (%s): %3d\n", nPad.c_str (), id.getValueString().c_str(), resourceName.c_str(), amount); result += Unicode::narrowToWide(buf); diff --git a/engine/server/library/serverGame/src/shared/space/ShipComponentDataManager.cpp b/engine/server/library/serverGame/src/shared/space/ShipComponentDataManager.cpp index 60053125..74e9e4f6 100755 --- a/engine/server/library/serverGame/src/shared/space/ShipComponentDataManager.cpp +++ b/engine/server/library/serverGame/src/shared/space/ShipComponentDataManager.cpp @@ -42,16 +42,16 @@ ShipComponentData * ShipComponentDataManager::create (TangibleObject const & com ShipComponentDescriptor const * const shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByObjectTemplate (component.getObjectTemplate ()->getCrcName ().getCrc ()); - if (shipComponentDescriptor == NULL) + if (shipComponentDescriptor == nullptr) { WARNING (true, ("ShipComponentDataManager [%s] [%s] is not a component", component.getNetworkId ().getValueString ().c_str (), component.getObjectTemplateName())); - return NULL; + return nullptr; } ShipComponentData * const shipComponent = create (*shipComponentDescriptor); if (!shipComponent) - return NULL; + return nullptr; shipComponent->readDataFromComponent (component); return shipComponent; @@ -61,7 +61,7 @@ ShipComponentData * ShipComponentDataManager::create (TangibleObject const & com ShipComponentData * ShipComponentDataManager::create (ShipComponentDescriptor const & shipComponentDescriptor) { - ShipComponentData * shipComponent = NULL; + ShipComponentData * shipComponent = nullptr; switch (shipComponentDescriptor.getComponentType ()) { @@ -106,7 +106,7 @@ ShipComponentData * ShipComponentDataManager::create (ShipComponentDescriptor co break; default: WARNING (true, ("ShipComponentDataManager::create descriptor has type [%d] invalid", shipComponentDescriptor.getComponentType ())); - return NULL; + return nullptr; } return shipComponent; diff --git a/engine/server/library/serverGame/src/shared/space/ShipInternalDamageOverTime.cpp b/engine/server/library/serverGame/src/shared/space/ShipInternalDamageOverTime.cpp index 9411fb1b..98f76860 100755 --- a/engine/server/library/serverGame/src/shared/space/ShipInternalDamageOverTime.cpp +++ b/engine/server/library/serverGame/src/shared/space/ShipInternalDamageOverTime.cpp @@ -41,14 +41,14 @@ void ShipInternalDamageOverTime::setDamageThreshold(float damageThreshold) ShipObject * const ShipInternalDamageOverTime::getShipObject() const { Object * const object = m_shipId.getObject(); - if (object != NULL && object->isAuthoritative()) + if (object != nullptr && object->isAuthoritative()) { ServerObject * const serverObject = object->asServerObject(); - if (serverObject != NULL) + if (serverObject != nullptr) return serverObject->asShipObject(); } - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -56,7 +56,7 @@ ShipObject * const ShipInternalDamageOverTime::getShipObject() const bool ShipInternalDamageOverTime::checkValidity(float & hpCurrent, float & hpMaximum) const { ShipObject * const ship = getShipObject(); - if (ship == NULL) + if (ship == nullptr) return false; if (m_chassisSlot < 0 || m_chassisSlot > ShipChassisSlotType::SCST_num_types) @@ -91,7 +91,7 @@ bool ShipInternalDamageOverTime::checkValidity(float & hpCurrent, float & hpMaxi bool ShipInternalDamageOverTime::applyDamage(float elapsedTime, float & damageApplied) const { ShipObject * const ship = getShipObject(); - if (ship == NULL) + if (ship == nullptr) return false; float hpCurrent = 0.0f; diff --git a/engine/server/library/serverGame/src/shared/space/ShipInternalDamageOverTimeManager.cpp b/engine/server/library/serverGame/src/shared/space/ShipInternalDamageOverTimeManager.cpp index 3cc0f54f..475b2504 100755 --- a/engine/server/library/serverGame/src/shared/space/ShipInternalDamageOverTimeManager.cpp +++ b/engine/server/library/serverGame/src/shared/space/ShipInternalDamageOverTimeManager.cpp @@ -39,7 +39,7 @@ namespace ShipInternalDamageOverTimeManagerNamespace { GameScriptObject * const gameScriptObject = ship.getScriptObject(); - if (gameScriptObject != NULL) + if (gameScriptObject != nullptr) { ScriptParams p; p.addParam(idot.getChassisSlot()); @@ -56,7 +56,7 @@ namespace ShipInternalDamageOverTimeManagerNamespace { GameScriptObject * const gameScriptObject = ship.getScriptObject(); - if (gameScriptObject != NULL) + if (gameScriptObject != nullptr) { ScriptParams p; p.addParam(idot.getChassisSlot()); @@ -128,7 +128,7 @@ void ShipInternalDamageOverTimeManager::update(float elapsedTime) ShipObject * const shipObject = idot.getShipObject(); - if (NULL != shipObject) + if (nullptr != shipObject) notifyIdotDamage(*shipObject, idot, damageApplied); } } @@ -150,7 +150,7 @@ void ShipInternalDamageOverTimeManager::update(float elapsedTime) ShipInternalDamageOverTime const & expiredIdot = *it; ShipObject * const shipObject = expiredIdot.getShipObject(); - if (shipObject != NULL) + if (shipObject != nullptr) notifyIdotRemoval(*shipObject, expiredIdot); } } @@ -219,7 +219,7 @@ bool ShipInternalDamageOverTimeManager::removeEntry(ShipObject const & ship, int IGNORE_RETURN(s_idotVector.erase(lowerBound)); ShipObject * const shipObject = lowerBoundIdot.getShipObject(); - if (shipObject != NULL) + if (shipObject != nullptr) notifyIdotRemoval(*shipObject, lowerBoundIdot); return true; @@ -235,13 +235,13 @@ ShipInternalDamageOverTime const * const ShipInternalDamageOverTimeManager::find //-- there is no lower bound, the idot is not in the vector if (lowerBound == s_idotVector.end()) - return NULL; + return nullptr; ShipInternalDamageOverTime & lowerBoundIdot = *lowerBound; //-- the lower bound sorts greater than the new idot, therefore this is a new insertion if (idot < lowerBoundIdot) - return NULL; + return nullptr; return &lowerBoundIdot; } diff --git a/engine/server/library/serverGame/src/shared/space/SpaceAttackSquad.cpp b/engine/server/library/serverGame/src/shared/space/SpaceAttackSquad.cpp index de7693e5..d344d963 100755 --- a/engine/server/library/serverGame/src/shared/space/SpaceAttackSquad.cpp +++ b/engine/server/library/serverGame/src/shared/space/SpaceAttackSquad.cpp @@ -68,7 +68,7 @@ void SpaceAttackSquad::onAddUnit(NetworkId const & unit) { AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != NULL) + if (aiShipController != nullptr) { aiShipController->setAttackSquad(this); } @@ -96,7 +96,7 @@ void SpaceAttackSquad::onNewLeader(NetworkId const & /*oldLeader*/) { AiShipController * const newLeaderAiShipController = AiShipController::getAiShipController(getLeader()); - if (newLeaderAiShipController != NULL) + if (newLeaderAiShipController != nullptr) { m_leaderOffsetPosition_l = -newLeaderAiShipController->getFormationPosition_l(); } @@ -116,7 +116,7 @@ void SpaceAttackSquad::onSetUnitFormationPosition_l(NetworkId const & unit, Vect { AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != NULL) + if (aiShipController != nullptr) { aiShipController->setAttackFormationPosition_l(position_l); } @@ -154,7 +154,7 @@ CachedNetworkId const & SpaceAttackSquad::getPrimaryAttackTarget() const { Object * const leaderObject = getLeader().getObject(); - if (leaderObject != NULL) + if (leaderObject != nullptr) { AiShipController * const leaderAiShipController = AiShipController::asAiShipController(leaderObject->getController()); @@ -163,7 +163,7 @@ CachedNetworkId const & SpaceAttackSquad::getPrimaryAttackTarget() const #ifdef _DEBUG FormattedString<1024> fs; - char const * const text = fs.sprintf("SpaceAttackSquad::getPrimaryAttackTarget() ERROR: Why is the attack squad leader(%s) object NULL?", getLeader().getValueString().c_str()); + char const * const text = fs.sprintf("SpaceAttackSquad::getPrimaryAttackTarget() ERROR: Why is the attack squad leader(%s) object nullptr?", getLeader().getValueString().c_str()); DEBUG_WARNING(true, (text)); LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", (text)); #endif // _DEBUG @@ -176,7 +176,7 @@ bool SpaceAttackSquad::isAttacking() const { Object * const leaderObject = getLeader().getObject(); - if (leaderObject != NULL) + if (leaderObject != nullptr) { AiShipController * const leaderAiShipController = AiShipController::asAiShipController(leaderObject->getController()); @@ -185,7 +185,7 @@ bool SpaceAttackSquad::isAttacking() const #ifdef _DEBUG FormattedString<1024> fs; - char const * const text = fs.sprintf("SpaceAttackSquad::isAttacking() ERROR: Why is the attack squad leader(%s) object NULL?", getLeader().getValueString().c_str()); + char const * const text = fs.sprintf("SpaceAttackSquad::isAttacking() ERROR: Why is the attack squad leader(%s) object nullptr?", getLeader().getValueString().c_str()); DEBUG_WARNING(true, (text)); LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", (text)); #endif // _DEBUG @@ -231,7 +231,7 @@ int SpaceAttackSquad::getMaxNumberOfUnits() const NetworkId const & unit = unitMap.begin()->first; AiShipController * const unitAiShipController = AiShipController::getAiShipController(unit); - if (unitAiShipController != NULL) + if (unitAiShipController != nullptr) { if (unitAiShipController->getAttackOrders() == AiShipController::AO_holdFire) { @@ -282,10 +282,10 @@ void SpaceAttackSquad::calculateAttackRanges() { CachedNetworkId const & unit = iterUnitMap->first; Object * const unitObject = unit.getObject(); - ServerObject * const unitServerObject = (unitObject != NULL) ? unitObject->asServerObject() : NULL; - ShipObject * const unitShipObject = (unitServerObject != NULL) ? unitServerObject->asShipObject() : NULL; + ServerObject * const unitServerObject = (unitObject != nullptr) ? unitObject->asServerObject() : nullptr; + ShipObject * const unitShipObject = (unitServerObject != nullptr) ? unitServerObject->asShipObject() : nullptr; - if (unitShipObject != NULL) + if (unitShipObject != nullptr) { m_projectileAttackRange = std::min(m_projectileAttackRange, unitShipObject->getApproximateAttackRange()); @@ -328,10 +328,10 @@ void SpaceAttackSquad::assignNewLeader() { CachedNetworkId const & unit = iterUnitMap->first; Object * const unitObject = unit.getObject(); - ServerObject * const unitServerObject = (unitObject != NULL) ? unitObject->asServerObject() : NULL; - ShipObject * const unitShipObject = (unitServerObject != NULL) ? unitServerObject->asShipObject() : NULL; + ServerObject * const unitServerObject = (unitObject != nullptr) ? unitObject->asServerObject() : nullptr; + ShipObject * const unitShipObject = (unitServerObject != nullptr) ? unitServerObject->asShipObject() : nullptr; - if (unitShipObject != NULL) + if (unitShipObject != nullptr) { if (unitShipObject->isComponentFunctional(ShipChassisSlotType::SCST_engine)) { diff --git a/engine/server/library/serverGame/src/shared/space/SpaceDockingManager.cpp b/engine/server/library/serverGame/src/shared/space/SpaceDockingManager.cpp index c836be74..4e4a9821 100755 --- a/engine/server/library/serverGame/src/shared/space/SpaceDockingManager.cpp +++ b/engine/server/library/serverGame/src/shared/space/SpaceDockingManager.cpp @@ -78,7 +78,7 @@ namespace SpaceDockingManagerNamespace explicit DockableShip(Object const & object) : m_dockPadList() { - if (object.getAppearance() != NULL) + if (object.getAppearance() != nullptr) { // What dock pads do we have, and what are their radii @@ -176,7 +176,7 @@ float SpaceDockingManagerNamespace::getCollisionRadius(Object const & object) CollisionProperty const * const collisionProperty = object.getCollisionProperty(); float radius = 0.0f; - if (collisionProperty != NULL) + if (collisionProperty != nullptr) { radius = collisionProperty->getBoundingSphere_l().getRadius(); } @@ -257,7 +257,7 @@ bool SpaceDockingManagerNamespace::getHardPoints(Object const & object, char con hardPointList.clear(); - if (object.getAppearance() != NULL) + if (object.getAppearance() != nullptr) { int hardPointIndex = 1; bool done = false; diff --git a/engine/server/library/serverGame/src/shared/space/SpacePath.cpp b/engine/server/library/serverGame/src/shared/space/SpacePath.cpp index 6c50cee8..9834532b 100755 --- a/engine/server/library/serverGame/src/shared/space/SpacePath.cpp +++ b/engine/server/library/serverGame/src/shared/space/SpacePath.cpp @@ -96,7 +96,7 @@ bool SpacePath::isEmpty() const // ---------------------------------------------------------------------- void SpacePath::addReference(void const * const object, float const objectSize) { - DEBUG_FATAL(object == NULL, ("Passing a NULL object into path 0x%p.", this)); + DEBUG_FATAL(object == nullptr, ("Passing a nullptr object into path 0x%p.", this)); ++m_referenceCount; @@ -112,7 +112,7 @@ void SpacePath::addReference(void const * const object, float const objectSize) // ---------------------------------------------------------------------- void SpacePath::releaseReference(void const * const object) { - DEBUG_FATAL(object == NULL, ("Passing a NULL object into path 0x%p.", this)); + DEBUG_FATAL(object == nullptr, ("Passing a nullptr object into path 0x%p.", this)); if (--m_referenceCount < 0) { @@ -178,7 +178,7 @@ bool SpacePath::refine(int & pathRefinementsAvailable) Vector avoidancePosition_w; - bool const pathAdjusted = SpaceAvoidanceManager::getAvoidancePosition(currentTransform, collisionRadius, sweepVector, nextPosition_w, avoidancePosition_w, NULL); + bool const pathAdjusted = SpaceAvoidanceManager::getAvoidancePosition(currentTransform, collisionRadius, sweepVector, nextPosition_w, avoidancePosition_w, nullptr); if (pathAdjusted) { newTransform.setPosition_p(avoidancePosition_w); @@ -278,7 +278,7 @@ void SpacePath::requestPathResize() // ---------------------------------------------------------------------- bool SpacePath::updateCollisionRadius(void const * const object, float const objectSize) { - DEBUG_FATAL(object == NULL, ("Passing a NULL object into path(0x%p) updateCollisionRadius.", this)); + DEBUG_FATAL(object == nullptr, ("Passing a nullptr object into path(0x%p) updateCollisionRadius.", this)); bool requiresPathUpdate = false; diff --git a/engine/server/library/serverGame/src/shared/space/SpacePathManager.cpp b/engine/server/library/serverGame/src/shared/space/SpacePathManager.cpp index 79256ad5..2d9d088c 100755 --- a/engine/server/library/serverGame/src/shared/space/SpacePathManager.cpp +++ b/engine/server/library/serverGame/src/shared/space/SpacePathManager.cpp @@ -59,9 +59,9 @@ void SpacePathManager::remove() // ---------------------------------------------------------------------- SpacePath * SpacePathManager::fetch(SpacePath * const path, void const * const object, float const objectRadius) { - SpacePath * result = NULL; + SpacePath * result = nullptr; - if (path == NULL) + if (path == nullptr) { // This is a new path, add it to the list @@ -105,7 +105,7 @@ SpacePath * SpacePathManager::fetch(SpacePath * const path, void const * const o // ---------------------------------------------------------------------- void SpacePathManager::release(SpacePath * const path, void const * const object) { - if (path == NULL) + if (path == nullptr) { return; } diff --git a/engine/server/library/serverGame/src/shared/space/SpaceSquad.cpp b/engine/server/library/serverGame/src/shared/space/SpaceSquad.cpp index 332188c6..9b998274 100755 --- a/engine/server/library/serverGame/src/shared/space/SpaceSquad.cpp +++ b/engine/server/library/serverGame/src/shared/space/SpaceSquad.cpp @@ -95,7 +95,7 @@ void SpaceSquad::remove() // ---------------------------------------------------------------------- SpaceSquad::SpaceSquad() : Squad() - , m_guardTarget(NULL) + , m_guardTarget(nullptr) , m_guardedByList(new SpaceSquadList) , m_attackSquadList(new AttackSquadList) , m_guarding(false) @@ -109,10 +109,10 @@ SpaceSquad::~SpaceSquad() { // The the squad that I am guarding that I am no longer guarding it - if (m_guardTarget != NULL) + if (m_guardTarget != nullptr) { removeGuardTarget(); - m_guardTarget = NULL; + m_guardTarget = nullptr; } // Tell all the squads guarding me that I am not longer guardable @@ -156,7 +156,7 @@ SpacePath * SpaceSquad::getPath() const AiShipController * const aiShipController = AiShipController::getAiShipController(getLeader()); - return NULL != aiShipController ? aiShipController->getPath() : NULL; + return nullptr != aiShipController ? aiShipController->getPath() : nullptr; } // ---------------------------------------------------------------------- @@ -194,7 +194,7 @@ void SpaceSquad::track(Object const & target) const // ---------------------------------------------------------------------- void SpaceSquad::moveTo(SpacePath * const path) const { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("SpaceSquad::moveTo() squadId(%d) path(0x%p) pathSize(%u)", getId(), path, (path != NULL) ? path->getTransformList().size() : 0)); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("SpaceSquad::moveTo() squadId(%d) path(0x%p) pathSize(%u)", getId(), path, (path != nullptr) ? path->getTransformList().size() : 0)); UnitMap const & unitMap = getUnitMap(); UnitMap::const_iterator iterUnitMap = unitMap.begin(); @@ -210,7 +210,7 @@ void SpaceSquad::moveTo(SpacePath * const path) const // ---------------------------------------------------------------------- void SpaceSquad::addPatrolPath(SpacePath * const path) const { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("SpaceSquad::addPatrolPath() squadId(%d) squadSize(%u) path(0x%p) pathSize(%u)", getId(), getUnitMap().size(), path, (path != NULL) ? path->getTransformList().size() : 0)); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("SpaceSquad::addPatrolPath() squadId(%d) squadSize(%u) path(0x%p) pathSize(%u)", getId(), getUnitMap().size(), path, (path != nullptr) ? path->getTransformList().size() : 0)); UnitMap const & unitMap = getUnitMap(); UnitMap::const_iterator iterUnitMap = unitMap.begin(); @@ -293,7 +293,7 @@ bool SpaceSquad::setGuardTarget(int const squadId) #endif // _DEBUG } - return (m_guardTarget != NULL); + return (m_guardTarget != nullptr); } // ---------------------------------------------------------------------- @@ -305,14 +305,14 @@ SpaceSquad * SpaceSquad::getGuardTarget() // ---------------------------------------------------------------------- void SpaceSquad::removeGuardTarget() { - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("SpaceSquad::removeGuardTarget() squadId(%d) guardedBySquad(%d)", getId(), (m_guardTarget != NULL) ? m_guardTarget->getId() : 0)); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", ("SpaceSquad::removeGuardTarget() squadId(%d) guardedBySquad(%d)", getId(), (m_guardTarget != nullptr) ? m_guardTarget->getId() : 0)); //-- Tell the guard target it's no longer being guarded - if (m_guardTarget != NULL) + if (m_guardTarget != nullptr) { m_guardTarget->removeGuardedBy(*this); - m_guardTarget = NULL; + m_guardTarget = nullptr; } } @@ -360,7 +360,7 @@ void SpaceSquad::onAddUnit(NetworkId const & unit) { AiShipController * unitAiShipController = AiShipController::getAiShipController(unit); - if (unitAiShipController != NULL) + if (unitAiShipController != nullptr) { unitAiShipController->setSquad(this); @@ -391,12 +391,12 @@ void SpaceSquad::onNewLeader(NetworkId const & oldLeader) { AiShipController * const newLeaderAiShipController = AiShipController::getAiShipController(getLeader()); - if (newLeaderAiShipController != NULL) + if (newLeaderAiShipController != nullptr) { AiShipController * const oldLeaderAiShipController = AiShipController::getAiShipController(oldLeader); - LOGC(ConfigServerGame::isSpaceAiLoggingEnabled() && (oldLeaderAiShipController == NULL) && (getUnitCount() > 1), "space_debug_ai", ("Squad::onNewLeader() ERROR: The old leader(%s) could not resolve to an AiShipController.", oldLeader.getValueString().c_str())); + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled() && (oldLeaderAiShipController == nullptr) && (getUnitCount() > 1), "space_debug_ai", ("Squad::onNewLeader() ERROR: The old leader(%s) could not resolve to an AiShipController.", oldLeader.getValueString().c_str())); - if (oldLeaderAiShipController != NULL) + if (oldLeaderAiShipController != nullptr) { newLeaderAiShipController->setCurrentPathIndex(oldLeaderAiShipController->getCurrentPathIndex()); } @@ -420,7 +420,7 @@ void SpaceSquad::onSetUnitFormationPosition_l(NetworkId const & unit, Vector con { AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != NULL) + if (aiShipController != nullptr) { aiShipController->setFormationPosition_l(position_l); } @@ -457,13 +457,13 @@ void SpaceSquad::alter(float const deltaSeconds) AiShipController const * const leaderAiShipController = AiShipController::getAiShipController(getLeader()); - if (leaderAiShipController != NULL) + if (leaderAiShipController != nullptr) { if (isGuarding()) { SpaceSquad * const guardTarget = getGuardTarget(); - if (guardTarget != NULL) + if (guardTarget != nullptr) { m_leashAnchorPosition_w = guardTarget->getSquadPosition_w(); } @@ -499,7 +499,7 @@ void SpaceSquad::assignNewLeader() CachedNetworkId const & unit = iterUnitMap->first; AiShipController const * const unitAiShipController = AiShipController::getAiShipController(unit); - if (unitAiShipController != NULL) + if (unitAiShipController != nullptr) { if ( unitAiShipController->getShipOwner()->isComponentFunctional(ShipChassisSlotType::SCST_engine) && !unitAiShipController->isAttacking() @@ -550,7 +550,7 @@ bool SpaceSquad::isGuarding() const && !m_guardTarget) { FormattedString<1024> fs; - char const * const text = fs.sprintf("SpaceSquad::isGuarding() squadId(%d) ERROR: Why are we guarding a NULL guard target?", getId()); + char const * const text = fs.sprintf("SpaceSquad::isGuarding() squadId(%d) ERROR: Why are we guarding a nullptr guard target?", getId()); DEBUG_WARNING(true, (text)); LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "space_debug_ai", (text)); } @@ -572,7 +572,7 @@ bool SpaceSquad::isAttackTargetListEmpty() const NetworkId const & unit = iterUnitMap->first; AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if ( (aiShipController != NULL) + if ( (aiShipController != nullptr) && !aiShipController->getAttackTargetList().isEmpty()) { result = false; @@ -623,10 +623,10 @@ Vector SpaceSquad::getAvoidanceVector(ShipObject const & unit) const } Object * const squadUnitObject = squadUnit.getObject(); - ServerObject * const squadUnitServerObject = (squadUnitObject != NULL) ? squadUnitObject->asServerObject() : NULL; - ShipObject * const squadUnitShipObject = (squadUnitServerObject != NULL) ? squadUnitServerObject->asShipObject() : NULL; + ServerObject * const squadUnitServerObject = (squadUnitObject != nullptr) ? squadUnitObject->asServerObject() : nullptr; + ShipObject * const squadUnitShipObject = (squadUnitServerObject != nullptr) ? squadUnitServerObject->asShipObject() : nullptr; - if (squadUnitShipObject != NULL) + if (squadUnitShipObject != nullptr) { Vector const & unitPosition_w = unit.getPosition_w(); Vector const & squadUnitPosition_w = squadUnitShipObject->getPosition_w(); @@ -760,7 +760,7 @@ float SpaceSquad::getLargestShipRadius() const { CachedNetworkId const & unit = iterUnitMap->first; Object const * const unitObject = unit.getObject(); - ServerObject const * const unitServerObject = unitObject ? unitObject->asServerObject() : NULL; + ServerObject const * const unitServerObject = unitObject ? unitObject->asServerObject() : nullptr; if (unitServerObject) { @@ -787,7 +787,7 @@ void SpaceSquad::refreshPathInfo() const { CachedNetworkId const & unit = iterUnitMap->first; Object const * const unitObject = unit.getObject(); - ServerObject const * const unitServerObject = unitObject ? unitObject->asServerObject() : NULL; + ServerObject const * const unitServerObject = unitObject ? unitObject->asServerObject() : nullptr; if (unitObject && unitServerObject) { IGNORE_RETURN(path->updateCollisionRadius(unitObject, unitServerObject->getRadius())); diff --git a/engine/server/library/serverGame/src/shared/space/SpaceSquadManager.cpp b/engine/server/library/serverGame/src/shared/space/SpaceSquadManager.cpp index 3a93d451..f2dc3552 100755 --- a/engine/server/library/serverGame/src/shared/space/SpaceSquadManager.cpp +++ b/engine/server/library/serverGame/src/shared/space/SpaceSquadManager.cpp @@ -194,7 +194,7 @@ bool SpaceSquadManager::setSquadId(NetworkId const & unit, int const newSquadId) bool result = false; AiShipController * const aiShipController = AiShipController::getAiShipController(unit); - if (aiShipController != NULL) + if (aiShipController != nullptr) { result = true; @@ -239,7 +239,7 @@ bool SpaceSquadManager::setSquadId(NetworkId const & unit, int const newSquadId) // ---------------------------------------------------------------------- SpaceSquad * SpaceSquadManager::getSquad(int const squadId) { - SpaceSquad * result = NULL; + SpaceSquad * result = nullptr; SquadList::const_iterator iterSpaceSquadList = s_squadList.find(squadId); if (iterSpaceSquadList != s_squadList.end()) diff --git a/engine/server/library/serverGame/src/shared/space/SpaceVisibilityManager.cpp b/engine/server/library/serverGame/src/shared/space/SpaceVisibilityManager.cpp index 9113d33f..70f5bbef 100755 --- a/engine/server/library/serverGame/src/shared/space/SpaceVisibilityManager.cpp +++ b/engine/server/library/serverGame/src/shared/space/SpaceVisibilityManager.cpp @@ -141,7 +141,7 @@ void SpaceVisibilityManager::addClient(Client & client, ServerObject & observing DEBUG_REPORT_LOG(ConfigServerGame::getDebugSpaceVisibilityManager(),("SpaceVisibilityManager::addClient(Client & client, %s);\n",observingObject.getNetworkId().getValueString().c_str())); TrackedObjectsType::iterator i=ms_trackedObjects.find(observingObject.getNetworkId()); - TrackedObject *to=NULL; + TrackedObject *to=nullptr; if (i!=ms_trackedObjects.end()) { to=i->second; @@ -244,7 +244,7 @@ void SpaceVisibilityManager::removeObject(ServerObject & object) if (!vis) //lint !e774 //always false (in debug build only) return; delete vis; - vis=NULL; + vis=nullptr; object.removeNotification(VisibleObjectNotification::getInstance(),true); } @@ -534,7 +534,7 @@ TrackedObject::TrackedObject(const ServerObject &object, int updateRadius) : m_object(object), m_updateRadius(updateRadius), m_currentLocation(NodeId(object.getPosition_w())), - m_clients(NULL) + m_clients(nullptr) { ms_trackedObjects[object.getNetworkId()]=this; addToNodesInRange(*this, m_currentLocation, updateRadius); @@ -554,7 +554,7 @@ TrackedObject::~TrackedObject() } delete m_clients; - m_clients=NULL; + m_clients=nullptr; } removeFromNodesInRange(*this, m_currentLocation, m_updateRadius); @@ -572,7 +572,7 @@ const CachedNetworkId & TrackedObject::getNetworkId() const bool TrackedObject::hasClients() const { - return (m_clients != NULL); + return (m_clients != nullptr); } // ---------------------------------------------------------------------- @@ -594,7 +594,7 @@ void TrackedObject::removeClient(Client &client) if (m_clients->empty()) { delete m_clients; - m_clients=NULL; + m_clients=nullptr; getNode(m_currentLocation).removeObservingObject(*this); } diff --git a/engine/server/library/serverGame/src/shared/synchronizedUi/InstallationSynchronizedUi.cpp b/engine/server/library/serverGame/src/shared/synchronizedUi/InstallationSynchronizedUi.cpp index ca2e7048..b074a95d 100755 --- a/engine/server/library/serverGame/src/shared/synchronizedUi/InstallationSynchronizedUi.cpp +++ b/engine/server/library/serverGame/src/shared/synchronizedUi/InstallationSynchronizedUi.cpp @@ -87,7 +87,7 @@ namespace InstallationSynchronizedUiNamespace InstallationResourceData makeInstallationResourceData (const NetworkId & id, const Vector & position) { ResourceTypeObject const * const rto = ServerUniverse::getInstance().getResourceTypeById(id); - ResourcePoolObject const * const pool = rto ? rto->getPoolForCurrentPlanet() : NULL; + ResourcePoolObject const * const pool = rto ? rto->getPoolForCurrentPlanet() : nullptr; if (rto && pool) { std::string const & resourceTypeParent = rto->getParentClass().getResourceClassName(); @@ -219,7 +219,7 @@ void InstallationSynchronizedUi::resetResourcePools () HarvesterInstallationObject * const harvester = dynamic_cast(getOwner ()); NOT_NULL (harvester); - if (harvester) //lint !e774 // harvester is not NULL in debug + if (harvester) //lint !e774 // harvester is not nullptr in debug { std::vector const & pools = harvester->getSurveyTypes(); for (std::vector::const_iterator i=pools.begin(); i!=pools.end(); ++i) diff --git a/engine/server/library/serverGame/src/shared/trading/ServerSecureTrade.cpp b/engine/server/library/serverGame/src/shared/trading/ServerSecureTrade.cpp index a0b2f63b..c486c67f 100755 --- a/engine/server/library/serverGame/src/shared/trading/ServerSecureTrade.cpp +++ b/engine/server/library/serverGame/src/shared/trading/ServerSecureTrade.cpp @@ -385,7 +385,7 @@ void ServerSecureTrade::completeTrade() } if (dynamic_cast(item)) { - if (!ContainerInterface::canTransferTo(recipientInventory, *item, NULL, errorCode)) + if (!ContainerInterface::canTransferTo(recipientInventory, *item, nullptr, errorCode)) { ContainerInterface::sendContainerMessageToClient(*m_initiator, errorCode); ContainerInterface::sendContainerMessageToClient(*m_recipient, errorCode); @@ -397,7 +397,7 @@ void ServerSecureTrade::completeTrade() } else { - if (!ContainerInterface::canTransferTo(recipientDatapad, *item, NULL, errorCode)) + if (!ContainerInterface::canTransferTo(recipientDatapad, *item, nullptr, errorCode)) { ContainerInterface::sendContainerMessageToClient(*m_initiator, errorCode); ContainerInterface::sendContainerMessageToClient(*m_recipient, errorCode); @@ -423,7 +423,7 @@ void ServerSecureTrade::completeTrade() } if (dynamic_cast(item)) { - if (!ContainerInterface::canTransferTo(initiatorInventory, *item, NULL, errorCode)) + if (!ContainerInterface::canTransferTo(initiatorInventory, *item, nullptr, errorCode)) { ContainerInterface::sendContainerMessageToClient(*m_initiator, errorCode); ContainerInterface::sendContainerMessageToClient(*m_recipient, errorCode); @@ -434,7 +434,7 @@ void ServerSecureTrade::completeTrade() } else { - if (!ContainerInterface::canTransferTo(initiatorDatapad, *item, NULL, errorCode)) + if (!ContainerInterface::canTransferTo(initiatorDatapad, *item, nullptr, errorCode)) { ContainerInterface::sendContainerMessageToClient(*m_initiator, errorCode); ContainerInterface::sendContainerMessageToClient(*m_recipient, errorCode); @@ -516,7 +516,7 @@ void ServerSecureTrade::completeTrade() NOT_NULL(item); if (dynamic_cast(item)) { - if (!ContainerInterface::transferItemToVolumeContainer(*recipientInventory, *item, NULL, errorCode)) + if (!ContainerInterface::transferItemToVolumeContainer(*recipientInventory, *item, nullptr, errorCode)) { DEBUG_FATAL(true, ("Secure trade transfer failure in initiator transfer!!\n")); LOG("CustomerService", ("Trade:%s FAILED TO receive %s from %s", PlayerObject::getAccountDescription(m_recipient->getNetworkId()).c_str(), ServerObject::getLogDescription(item).c_str(), PlayerObject::getAccountDescription(m_initiator->getNetworkId()).c_str())); @@ -529,7 +529,7 @@ void ServerSecureTrade::completeTrade() } else { - if (!ContainerInterface::transferItemToVolumeContainer(*recipientDatapad, *item, NULL, errorCode)) + if (!ContainerInterface::transferItemToVolumeContainer(*recipientDatapad, *item, nullptr, errorCode)) { DEBUG_FATAL(true, ("Secure trade transfer failure in initiator transfer!!\n")); LOG("CustomerService", ("Trade:%s FAILED TO receive %s from %s", PlayerObject::getAccountDescription(m_recipient->getNetworkId()).c_str(), ServerObject::getLogDescription(item).c_str(), PlayerObject::getAccountDescription(m_initiator->getNetworkId()).c_str())); @@ -550,7 +550,7 @@ void ServerSecureTrade::completeTrade() NOT_NULL(item); if (dynamic_cast(item)) { - if (!ContainerInterface::transferItemToVolumeContainer(*initiatorInventory, *item, NULL, errorCode)) + if (!ContainerInterface::transferItemToVolumeContainer(*initiatorInventory, *item, nullptr, errorCode)) { DEBUG_FATAL(true, ("Secure trade transfer failure in recipient transfer!!\n")); LOG("CustomerService", ("Trade:%s FAILED TO receive %s from %s", PlayerObject::getAccountDescription(m_initiator->getNetworkId()).c_str(), ServerObject::getLogDescription(item).c_str(), PlayerObject::getAccountDescription(m_recipient->getNetworkId()).c_str())); @@ -564,7 +564,7 @@ void ServerSecureTrade::completeTrade() } else { - if (!ContainerInterface::transferItemToVolumeContainer(*initiatorDatapad, *item, NULL, errorCode)) + if (!ContainerInterface::transferItemToVolumeContainer(*initiatorDatapad, *item, nullptr, errorCode)) { DEBUG_FATAL(true, ("Secure trade transfer failure in recipient transfer!!\n")); LOG("CustomerService", ("Trade:%s FAILED TO receive %s from %s", PlayerObject::getAccountDescription(m_initiator->getNetworkId()).c_str(), ServerObject::getLogDescription(item).c_str(), PlayerObject::getAccountDescription(m_recipient->getNetworkId()).c_str())); @@ -602,12 +602,12 @@ void ServerSecureTrade::logTradeitemContents(const CreatureObject & to, const ServerObject & item, const CreatureObject & from) const { const Container * container = ContainerInterface::getContainer(item); - if (container != NULL) + if (container != nullptr) { for (ContainerConstIterator i = container->begin(); i != container->end(); ++i) { const Object * o = (*i).getObject(); - if (o != NULL) + if (o != nullptr) { const ServerObject * content = safe_cast(o); LOG("CustomerService", ("Trade:%s received %s contained in %s from %s", diff --git a/engine/server/library/serverNetworkMessages/src/shared/TaskConnectionIdMessage.cpp b/engine/server/library/serverNetworkMessages/src/shared/TaskConnectionIdMessage.cpp index 525fc1b6..2f314ed8 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/TaskConnectionIdMessage.cpp +++ b/engine/server/library/serverNetworkMessages/src/shared/TaskConnectionIdMessage.cpp @@ -14,7 +14,7 @@ GameNetworkMessage("TaskConnectionIdMessage"), serverType(static_cast(id)), commandLine(pCommandLine), clusterName(pClusterName), -currentEpochTime(static_cast(::time(NULL))) +currentEpochTime(static_cast(::time(nullptr))) { addVariable(serverType); addVariable(commandLine); diff --git a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AccountFeatureIdResponse.cpp b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AccountFeatureIdResponse.cpp index b7417e7b..f51e9f06 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AccountFeatureIdResponse.cpp +++ b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AccountFeatureIdResponse.cpp @@ -10,7 +10,7 @@ // ====================================================================== -AccountFeatureIdResponse::AccountFeatureIdResponse(NetworkId const & requester, uint32 gameServer, NetworkId const & target, StationId targetStationId, uint32 gameCode, AccountFeatureIdRequest::RequestReason requestReason, unsigned int resultCode, bool resultCameFromSession, std::map const & featureIds, std::map const & sessionFeatureIdsData, const char * sessionResultString /*= NULL*/, const char * sessionResultText /*= NULL*/) : +AccountFeatureIdResponse::AccountFeatureIdResponse(NetworkId const & requester, uint32 gameServer, NetworkId const & target, StationId targetStationId, uint32 gameCode, AccountFeatureIdRequest::RequestReason requestReason, unsigned int resultCode, bool resultCameFromSession, std::map const & featureIds, std::map const & sessionFeatureIdsData, const char * sessionResultString /*= nullptr*/, const char * sessionResultText /*= nullptr*/) : GameNetworkMessage("AccountFeatureIdResponse"), m_requester(requester), m_gameServer(gameServer), diff --git a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AccountFeatureIdResponse.h b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AccountFeatureIdResponse.h index 3bf69cd3..356d75e6 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AccountFeatureIdResponse.h +++ b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AccountFeatureIdResponse.h @@ -19,7 +19,7 @@ class AccountFeatureIdResponse : public GameNetworkMessage { public: - AccountFeatureIdResponse (NetworkId const & requester, uint32 gameServer, NetworkId const & target, StationId targetStationId, uint32 gameCode, AccountFeatureIdRequest::RequestReason requestReason, unsigned int resultCode, bool resultCameFromSession, std::map const & featureIds, std::map const & sessionFeatureIdsData, const char * sessionResultString = NULL, const char * sessionResultText = NULL); + AccountFeatureIdResponse (NetworkId const & requester, uint32 gameServer, NetworkId const & target, StationId targetStationId, uint32 gameCode, AccountFeatureIdRequest::RequestReason requestReason, unsigned int resultCode, bool resultCameFromSession, std::map const & featureIds, std::map const & sessionFeatureIdsData, const char * sessionResultString = nullptr, const char * sessionResultText = nullptr); AccountFeatureIdResponse (Archive::ReadIterator & source); virtual ~AccountFeatureIdResponse (); diff --git a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AdjustAccountFeatureIdResponse.cpp b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AdjustAccountFeatureIdResponse.cpp index 55ec5da9..5a118fce 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AdjustAccountFeatureIdResponse.cpp +++ b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AdjustAccountFeatureIdResponse.cpp @@ -10,7 +10,7 @@ // ====================================================================== -AdjustAccountFeatureIdResponse::AdjustAccountFeatureIdResponse(NetworkId const & requestingPlayer, uint32 gameServer, NetworkId const & targetPlayer, std::string const & targetPlayerDescription, StationId targetStationId, NetworkId const & targetItem, std::string const & targetItemDescription, uint32 gameCode, uint32 featureId, int oldValue, int newValue, unsigned int resultCode, bool resultCameFromSession, const char * sessionResultString /*= NULL*/, const char * sessionResultText /*= NULL*/) : +AdjustAccountFeatureIdResponse::AdjustAccountFeatureIdResponse(NetworkId const & requestingPlayer, uint32 gameServer, NetworkId const & targetPlayer, std::string const & targetPlayerDescription, StationId targetStationId, NetworkId const & targetItem, std::string const & targetItemDescription, uint32 gameCode, uint32 featureId, int oldValue, int newValue, unsigned int resultCode, bool resultCameFromSession, const char * sessionResultString /*= nullptr*/, const char * sessionResultText /*= nullptr*/) : GameNetworkMessage("AdjustAccountFeatureIdResponse"), m_requestingPlayer(requestingPlayer), m_gameServer(gameServer), diff --git a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AdjustAccountFeatureIdResponse.h b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AdjustAccountFeatureIdResponse.h index 940937ac..cecf0530 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AdjustAccountFeatureIdResponse.h +++ b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/AdjustAccountFeatureIdResponse.h @@ -18,7 +18,7 @@ class AdjustAccountFeatureIdResponse : public GameNetworkMessage { public: - AdjustAccountFeatureIdResponse (NetworkId const & requestingPlayer, uint32 gameServer, NetworkId const & targetPlayer, std::string const & targetPlayerDescription, StationId targetStationId, NetworkId const & targetItem, std::string const & targetItemDescription, uint32 gameCode, uint32 featureId, int oldValue, int newValue, unsigned int resultCode, bool resultCameFromSession, const char * sessionResultString = NULL, const char * sessionResultText = NULL); + AdjustAccountFeatureIdResponse (NetworkId const & requestingPlayer, uint32 gameServer, NetworkId const & targetPlayer, std::string const & targetPlayerDescription, StationId targetStationId, NetworkId const & targetItem, std::string const & targetItemDescription, uint32 gameCode, uint32 featureId, int oldValue, int newValue, unsigned int resultCode, bool resultCameFromSession, const char * sessionResultString = nullptr, const char * sessionResultText = nullptr); AdjustAccountFeatureIdResponse (Archive::ReadIterator & source); virtual ~AdjustAccountFeatureIdResponse (); @@ -37,7 +37,7 @@ public: bool getResultCameFromSession() const; std::string const & getSessionResultString() const; std::string const & getSessionResultText() const; - void setSessionResultCode(unsigned int resultCode, const char * sessionResultString = NULL, const char * sessionResultText = NULL); + void setSessionResultCode(unsigned int resultCode, const char * sessionResultString = nullptr, const char * sessionResultText = nullptr); private: Archive::AutoVariable m_requestingPlayer; @@ -169,7 +169,7 @@ inline std::string const & AdjustAccountFeatureIdResponse::getSessionResultText( // ---------------------------------------------------------------------- -inline void AdjustAccountFeatureIdResponse::setSessionResultCode(unsigned int resultCode, const char * sessionResultString /*= NULL*/, const char * sessionResultText /*= NULL*/) +inline void AdjustAccountFeatureIdResponse::setSessionResultCode(unsigned int resultCode, const char * sessionResultString /*= nullptr*/, const char * sessionResultText /*= nullptr*/) { m_resultCode.set(resultCode); diff --git a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/SceneTransferMessages.cpp b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/SceneTransferMessages.cpp index 92b86d2c..34c3de3f 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/SceneTransferMessages.cpp +++ b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/SceneTransferMessages.cpp @@ -19,7 +19,7 @@ RequestSceneTransfer::RequestSceneTransfer(const NetworkId &oid, const std::stri m_containerName(), m_scriptCallback() { - if (scriptCallback != NULL) + if (scriptCallback != nullptr) m_scriptCallback.set(scriptCallback); addVariable(m_oid); @@ -45,7 +45,7 @@ RequestSceneTransfer::RequestSceneTransfer(const NetworkId &oid, const std::stri m_containerName(containerName), m_scriptCallback() { - if (scriptCallback != NULL) + if (scriptCallback != nullptr) m_scriptCallback.set(scriptCallback); addVariable(m_oid); diff --git a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/SceneTransferMessages.h b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/SceneTransferMessages.h index e7780d16..0fc2e843 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/SceneTransferMessages.h +++ b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/SceneTransferMessages.h @@ -21,8 +21,8 @@ class RequestSceneTransfer : public GameNetworkMessage { public: - RequestSceneTransfer(const NetworkId &oid, const std::string & sceneName, uint32 sourceGameServer, const Vector &position_p, const Vector &position_w, const NetworkId &containerId, const char * scriptCallback = NULL); - RequestSceneTransfer(const NetworkId &oid, const std::string & sceneName, uint32 sourceGameServer, const Vector &position_p, const Vector &position_w, const NetworkId &buildingId, const std::string &containerName, const char * scriptCallback = NULL); + RequestSceneTransfer(const NetworkId &oid, const std::string & sceneName, uint32 sourceGameServer, const Vector &position_p, const Vector &position_w, const NetworkId &containerId, const char * scriptCallback = nullptr); + RequestSceneTransfer(const NetworkId &oid, const std::string & sceneName, uint32 sourceGameServer, const Vector &position_p, const Vector &position_w, const NetworkId &buildingId, const std::string &containerName, const char * scriptCallback = nullptr); RequestSceneTransfer(Archive::ReadIterator & source); ~RequestSceneTransfer(); diff --git a/engine/server/library/serverNetworkMessages/src/shared/core/SetupServerNetworkMessages.cpp b/engine/server/library/serverNetworkMessages/src/shared/core/SetupServerNetworkMessages.cpp index d976dd62..007706a8 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/core/SetupServerNetworkMessages.cpp +++ b/engine/server/library/serverNetworkMessages/src/shared/core/SetupServerNetworkMessages.cpp @@ -254,7 +254,7 @@ namespace SetupServerNetworkMessagesNamespace } MessageQueue::Data* unpackNothing(Archive::ReadIterator &) { - return NULL; + return nullptr; } void packVectorNetworkIdVector(const MessageQueue::Data * data, Archive::ByteStream & target) diff --git a/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/AiCreatureStateMessage.cpp b/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/AiCreatureStateMessage.cpp index 95dc3fd7..74213208 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/AiCreatureStateMessage.cpp +++ b/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/AiCreatureStateMessage.cpp @@ -37,9 +37,9 @@ void AiCreatureStateMessage::pack(MessageQueue::Data const * const data, Archive { AiCreatureStateMessage const * const msg = safe_cast(data); - if (msg != NULL) + if (msg != nullptr) { - if (GameServerMessageInterface::getInstance() != NULL) + if (GameServerMessageInterface::getInstance() != nullptr) { GameServerMessageInterface::getInstance()->pack(target, *msg); } @@ -52,7 +52,7 @@ MessageQueue::Data * AiCreatureStateMessage::unpack(Archive::ReadIterator & sour { AiCreatureStateMessage * msg = new AiCreatureStateMessage(); - if (GameServerMessageInterface::getInstance() != NULL) + if (GameServerMessageInterface::getInstance() != nullptr) { GameServerMessageInterface::getInstance()->unpack(source, *msg); } diff --git a/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/AiMovementMessage.cpp b/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/AiMovementMessage.cpp index fde8e298..c87b7c66 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/AiMovementMessage.cpp +++ b/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/AiMovementMessage.cpp @@ -61,7 +61,7 @@ void AiMovementMessage::pack(const MessageQueue::Data* const data, Archive::Byte const AiMovementMessage * const msg = safe_cast (data); if (msg) { - if (GameServerMessageInterface::getInstance() != NULL) + if (GameServerMessageInterface::getInstance() != nullptr) GameServerMessageInterface::getInstance()->pack(target, *msg); } } @@ -72,7 +72,7 @@ MessageQueue::Data* AiMovementMessage::unpack(Archive::ReadIterator & source) { AiMovementMessage * msg = new AiMovementMessage(); - if (GameServerMessageInterface::getInstance() != NULL) + if (GameServerMessageInterface::getInstance() != nullptr) GameServerMessageInterface::getInstance()->unpack(source, *msg); return msg; diff --git a/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/GameServerMessageInterface.cpp b/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/GameServerMessageInterface.cpp index 5872a21e..e898606f 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/GameServerMessageInterface.cpp +++ b/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/GameServerMessageInterface.cpp @@ -13,7 +13,7 @@ //----------------------------------------------------------------------- -GameServerMessageInterface * GameServerMessageInterface::ms_instance = NULL; +GameServerMessageInterface * GameServerMessageInterface::ms_instance = nullptr; //======================================================================= @@ -27,14 +27,14 @@ GameServerMessageInterface::GameServerMessageInterface() GameServerMessageInterface::~GameServerMessageInterface() { if (ms_instance == this) - ms_instance = NULL; + ms_instance = nullptr; } //----------------------------------------------------------------------- void GameServerMessageInterface::setInstance(GameServerMessageInterface * instance) { - if (ms_instance == NULL) + if (ms_instance == nullptr) ms_instance = instance; else if (ms_instance != instance) { diff --git a/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/RenameCharacterMessage.cpp b/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/RenameCharacterMessage.cpp index bd4cae1a..8aa0309a 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/RenameCharacterMessage.cpp +++ b/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/RenameCharacterMessage.cpp @@ -64,11 +64,11 @@ RenameCharacterMessageEx::RenameCharacterMessageEx(RenameCharacterMessageSource static Unicode::String const delimiters(Unicode::narrowToWide(" ")); Unicode::UnicodeStringVector newNameTokens; - if (!Unicode::tokenize(newName, newNameTokens, &delimiters, NULL)) + if (!Unicode::tokenize(newName, newNameTokens, &delimiters, nullptr)) newNameTokens.clear(); Unicode::UnicodeStringVector oldNameTokens; - if (!Unicode::tokenize(oldName, oldNameTokens, &delimiters, NULL)) + if (!Unicode::tokenize(oldName, oldNameTokens, &delimiters, nullptr)) oldNameTokens.clear(); m_lastNameChangeOnly.set(((newNameTokens.size() >= 1) && (oldNameTokens.size() >= 1) && Unicode::caseInsensitiveCompare(newNameTokens[0], oldNameTokens[0]))); diff --git a/engine/server/library/serverPathfinding/src/shared/CityPathGraph.cpp b/engine/server/library/serverPathfinding/src/shared/CityPathGraph.cpp index 2f14d0ac..8ec08af5 100755 --- a/engine/server/library/serverPathfinding/src/shared/CityPathGraph.cpp +++ b/engine/server/library/serverPathfinding/src/shared/CityPathGraph.cpp @@ -72,13 +72,13 @@ CityPathGraph::CityPathGraph ( int cityToken ) CityPathGraph::~CityPathGraph() { delete m_namedNodes; - m_namedNodes = NULL; + m_namedNodes = nullptr; delete m_nodeTree; - m_nodeTree = NULL; + m_nodeTree = nullptr; delete m_dirtyBoxes; - m_dirtyBoxes = NULL; + m_dirtyBoxes = nullptr; } // ---------------------------------------------------------------------- @@ -92,7 +92,7 @@ int CityPathGraph::addNode ( DynamicPathNode * newNode ) int index = DynamicPathGraph::addNode(newNode); SpatialHandle * handle = m_nodeTree->addObject( cityNode ); - if (handle != NULL) + if (handle != nullptr) { if (cityNode->getName() != Unicode::emptyString) { @@ -134,7 +134,7 @@ void CityPathGraph::removeNode ( int nodeIndex ) SpatialHandle * handle = cityNode->getSpatialHandle(); - if (m_namedNodes != NULL) + if (m_namedNodes != nullptr) { std::map >::iterator found = m_namedNodes->find(cityNode->getName()); if (found != m_namedNodes->end()) @@ -146,7 +146,7 @@ void CityPathGraph::removeNode ( int nodeIndex ) } m_nodeTree->removeObject( handle ); - cityNode->setSpatialHandle(NULL); + cityNode->setSpatialHandle(nullptr); DynamicPathGraph::removeNode(nodeIndex); } @@ -160,7 +160,7 @@ void CityPathGraph::destroyNode ( int nodeIndex ) { CityPathNode * cityNode = _getNode(nodeIndex); - if(cityNode == NULL) return; + if(cityNode == nullptr) return; // ---------- // Remember which nodes were adjacent to the node we're removing @@ -185,7 +185,7 @@ void CityPathGraph::destroyNode ( int nodeIndex ) m_nodeTree->removeObject( handle ); - cityNode->setSpatialHandle(NULL); + cityNode->setSpatialHandle(nullptr); // ---------- // Remove the node @@ -217,7 +217,7 @@ void CityPathGraph::moveNode ( int nodeIndex, Vector const & newPosition ) { CityPathNode * cityNode = _getNode(nodeIndex); - if(cityNode == NULL) return; + if(cityNode == nullptr) return; // ---------- // Remember which nodes were adjacent to the node we're removing @@ -272,7 +272,7 @@ void CityPathGraph::relinkNode ( int nodeIndex ) { CityPathNode * nodeA = _getNode(nodeIndex); - if(nodeA == NULL) return; + if(nodeA == nullptr) return; // ---------- @@ -293,16 +293,16 @@ void CityPathGraph::relinkNode ( int nodeIndex ) { CityPathNode * nodeB = _getNode(i); - if(nodeB == NULL) continue; + if(nodeB == nullptr) continue; if(nodeA == nodeB) continue; PathNodeType typeB = nodeB->getType(); if(typeB != PNT_CityBuildingEntrance) continue; - if(nodeA->getCreatorObject() == NULL) continue; + if(nodeA->getCreatorObject() == nullptr) continue; - if(nodeB->getCreatorObject() == NULL) continue; + if(nodeB->getCreatorObject() == nullptr) continue; if(nodeA->getCreatorObject() != nodeB->getCreatorObject()) continue; @@ -330,16 +330,16 @@ void CityPathGraph::relinkNode ( int nodeIndex ) { CityPathNode * nodeB = _getNode(i); - if(nodeB == NULL) continue; + if(nodeB == nullptr) continue; if(nodeA == nodeB) continue; PathNodeType typeB = nodeB->getType(); if(typeB != PNT_CityBuilding) continue; - if(nodeA->getCreatorObject() == NULL) continue; + if(nodeA->getCreatorObject() == nullptr) continue; - if(nodeB->getCreatorObject() == NULL) continue; + if(nodeB->getCreatorObject() == nullptr) continue; if(nodeA->getCreatorObject() != nodeB->getCreatorObject()) continue; @@ -367,7 +367,7 @@ void CityPathGraph::relinkNode ( int nodeIndex ) { CityPathNode * nodeB = static_cast(results[i]); - if(nodeB == NULL) continue; + if(nodeB == nullptr) continue; if(nodeA == nodeB) continue; PathNodeType typeB = nodeB->getType(); @@ -420,7 +420,7 @@ void CityPathGraph::relinkNode ( int nodeIndex ) { CityPathNode * neighborNode = _getNode(neighborList[i]); - if(neighborNode != NULL) + if(neighborNode != nullptr) { neighborNode->markRedundantEdges(); neighborNode->removeMarkedEdges(); @@ -467,11 +467,11 @@ CityPathNode * CityPathGraph::findNodeForObject ( ServerObject const & object ) { CityPathNode * node = _getNode(i); - if(node == NULL) continue; + if(node == nullptr) continue; ServerObject const * source = node->getSourceObject(); - if(source == NULL) continue; + if(source == nullptr) continue; if(source == &object) { @@ -479,7 +479,7 @@ CityPathNode * CityPathGraph::findNodeForObject ( ServerObject const & object ) } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -492,11 +492,11 @@ CityPathNode const * CityPathGraph::findNodeForObject ( ServerObject const & obj { CityPathNode const * node = _getNode(i); - if(node == NULL) continue; + if(node == nullptr) continue; ServerObject const * source = node->getSourceObject(); - if(source == NULL) continue; + if(source == nullptr) continue; if(source == &object) { @@ -504,15 +504,15 @@ CityPathNode const * CityPathGraph::findNodeForObject ( ServerObject const & obj } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- CityPathNode * CityPathGraph::findNearestNodeForName( Unicode::String const & nodeName, Vector const & pos ) { - if (m_namedNodes == NULL) - return NULL; + if (m_namedNodes == nullptr) + return nullptr; std::map >::iterator found = m_namedNodes->find(nodeName); if (found != m_namedNodes->end() && !found->second.empty()) @@ -521,12 +521,12 @@ CityPathNode * CityPathGraph::findNearestNodeForName( Unicode::String const & no if (nodes.size() == 1) return *(nodes.begin()); - CityPathNode * node = NULL; + CityPathNode * node = nullptr; float distance = FLT_MAX; for (std::set::iterator i = nodes.begin(); i != nodes.end(); ++i) { float testDistance = pos.magnitudeBetweenSquared((*i)->getPosition_w()); - if (node == NULL || testDistance < distance) + if (node == nullptr || testDistance < distance) { distance = testDistance; node = *i; @@ -535,15 +535,15 @@ CityPathNode * CityPathGraph::findNearestNodeForName( Unicode::String const & no return node; } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- CityPathNode const * CityPathGraph::findNearestNodeForName( Unicode::String const & nodeName, Vector const & pos ) const { - if (m_namedNodes == NULL) - return NULL; + if (m_namedNodes == nullptr) + return nullptr; std::map >::const_iterator found = m_namedNodes->find(nodeName); if (found != m_namedNodes->end() && !found->second.empty()) @@ -552,12 +552,12 @@ CityPathNode const * CityPathGraph::findNearestNodeForName( Unicode::String cons if (nodes.size() == 1) return *(nodes.begin()); - CityPathNode const * node = NULL; + CityPathNode const * node = nullptr; float distance = FLT_MAX; for (std::set::const_iterator i = nodes.begin(); i != nodes.end(); ++i) { float testDistance = pos.magnitudeBetweenSquared((*i)->getPosition_w()); - if (node == NULL || testDistance < distance) + if (node == nullptr || testDistance < distance) { distance = testDistance; node = *i; @@ -566,14 +566,14 @@ CityPathNode const * CityPathGraph::findNearestNodeForName( Unicode::String cons return node; } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- int CityPathGraph::findNearestNode ( Vector const & position ) const { - PathNode * temp = NULL; + PathNode * temp = nullptr; float dummy1 = REAL_MAX; float dummy2 = REAL_MAX; @@ -713,7 +713,7 @@ int CityPathGraph::getNeighborCode ( int whichNode ) const { CityPathNode const * node = _getNode(whichNode); - if(node == NULL) return 0; + if(node == nullptr) return 0; int edgeCount = node->getEdgeCount(); @@ -725,7 +725,7 @@ int CityPathGraph::getNeighborCode ( int whichNode ) const CityPathNode const * neighbor = _getNode(neighborId); - if(neighbor == NULL) continue; + if(neighbor == nullptr) continue; int neighborInt = reinterpret_cast(neighbor); diff --git a/engine/server/library/serverPathfinding/src/shared/CityPathGraphManager.cpp b/engine/server/library/serverPathfinding/src/shared/CityPathGraphManager.cpp index 3e511c3c..9194452e 100755 --- a/engine/server/library/serverPathfinding/src/shared/CityPathGraphManager.cpp +++ b/engine/server/library/serverPathfinding/src/shared/CityPathGraphManager.cpp @@ -58,7 +58,7 @@ struct RegionCacheEntry { RegionCacheEntry ( void ) - : m_shape(), m_graph(NULL) + : m_shape(), m_graph(nullptr) { } @@ -143,7 +143,7 @@ void CityPathGraphManager::update ( float time ) CityPathGraph * graph = g_regionCache[g_scrubberGraphIndex].m_graph; - if(graph == NULL) return; + if(graph == nullptr) return; if(g_scrubberNodeIndex >= graph->getNodeCount()) { @@ -156,7 +156,7 @@ void CityPathGraphManager::update ( float time ) g_scrubberNodeIndex++; - if(node == NULL) return; + if(node == nullptr) return; if(!node->sanityCheck(false)) { @@ -233,14 +233,14 @@ Region const * getCityRegionFor( Vector const & position ) return results[0]; } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- int getCityTokenFor ( Region const * region ) { - if(region == NULL) return -1; + if(region == nullptr) return -1; Unicode::String const & name = region->getName(); @@ -294,7 +294,7 @@ bool checkRegionCache ( Vector const & position, CityPathGraph * & outGraph ) bool addToRegionCache ( MultiShape const & shape, CityPathGraph * graph ) { - if(graph == NULL) return false; + if(graph == nullptr) return false; RegionCacheEntry entry(shape,graph); @@ -325,12 +325,12 @@ bool addToRegionCache ( AxialBox const & box, CityPathGraph * graph ) bool addToRegionCache ( Region const * region, CityPathGraph * graph ) { - if(region == NULL) return false; - if(graph == NULL) return false; + if(region == nullptr) return false; + if(graph == nullptr) return false; MxCifQuadTreeBounds const * bounds = ®ion->getBounds(); - if(bounds == NULL) return false; + if(bounds == nullptr) return false; MxCifQuadTreeCircleBounds const * circleBounds = dynamic_cast(bounds); @@ -390,7 +390,7 @@ CityPathGraph * createCityGraphFor ( Region const * region ) { int token = getCityTokenFor(region); - if(token == -1) return NULL; + if(token == -1) return nullptr; CityPathGraph * graph = new CityPathGraph(token); @@ -401,7 +401,7 @@ CityPathGraph * createCityGraphFor ( Region const * region ) CityPathGraph * createCityGraphFor ( ServerObject const * creator, MultiShape const & shape ) { - if(creator == NULL) return NULL; + if(creator == nullptr) return nullptr; CityPathGraph * newGraph = new CityPathGraph(-1); @@ -416,7 +416,7 @@ CityPathGraph * createCityGraphFor ( ServerObject const * creator, MultiShape co CityPathGraph * _getCityGraphFor ( Vector const & position ) { - CityPathGraph * graph = NULL; + CityPathGraph * graph = nullptr; if(checkRegionCache(position,graph)) { @@ -436,9 +436,9 @@ CityPathGraph * _getCityGraphFor ( Vector const & position ) CityPathGraph * _getCityGraphFor ( ServerObject const * object ) { - if(object == NULL) + if(object == nullptr) { - return NULL; + return nullptr; } else { @@ -450,8 +450,8 @@ CityPathGraph * _getCityGraphFor ( ServerObject const * object ) CityPathNode * _getCityNodeFor ( ServerObject const * object, CityPathGraph * graph ) { - if(object == NULL) return NULL; - if(graph == NULL) return NULL; + if(object == nullptr) return nullptr; + if(graph == nullptr) return nullptr; return graph->findNodeForObject(*object); } @@ -462,7 +462,7 @@ CityPathNode * _getCityNodeFor ( ServerObject const * object ) { CityPathGraph * graph = _getCityGraphFor(object); - if(graph == NULL) return NULL; + if(graph == nullptr) return nullptr; return _getCityNodeFor(object,graph); } @@ -471,19 +471,19 @@ CityPathNode * _getCityNodeFor ( ServerObject const * object ) PathGraph const * _getExteriorGraph ( ServerObject const * object ) { - if(object == NULL) return NULL; + if(object == nullptr) return nullptr; CollisionProperty const * collision = object->getCollisionProperty(); - if(collision == NULL) return NULL; + if(collision == nullptr) return nullptr; Floor const * floor = collision->getFloor(); - if(floor == NULL) return NULL; + if(floor == nullptr) return nullptr; FloorMesh const * floorMesh = floor->getFloorMesh(); - if(floorMesh == NULL) return NULL; + if(floorMesh == nullptr) return nullptr; PathGraph const * pathGraph = safe_cast(floorMesh->getPathGraph()); @@ -507,8 +507,8 @@ CityPathGraph const * CityPathGraphManager::getCityGraphFor ( Vector const & pos CityPathNode const * CityPathGraphManager::getNamedNodeFor( ServerObject const & object, Unicode::String const & nodeName ) { CityPathGraph const * cityGraph = getCityGraphFor(&object); - if (cityGraph == NULL) - return NULL; + if (cityGraph == nullptr) + return nullptr; return cityGraph->findNearestNodeForName(nodeName, object.getPosition_w()); } @@ -517,7 +517,7 @@ CityPathNode const * CityPathGraphManager::getNamedNodeFor( ServerObject const & bool CityPathGraphManager::getClosestPathNodePos ( ServerObject const * object, Vector & outPos ) { - if(object == NULL) return false; + if(object == nullptr) return false; if(object->getParentCell() == CellProperty::getWorldCellProperty()) { @@ -548,11 +548,11 @@ bool CityPathGraphManager::getClosestPathNodePos ( ServerObject const * object, void CityPathGraphManager::addWaypoint ( ServerObject * sourceObject ) { - if(sourceObject == NULL) return; + if(sourceObject == nullptr) return; CityPathGraph * graph = _getCityGraphFor(sourceObject); - if(graph == NULL) + if(graph == nullptr) { return; } @@ -561,7 +561,7 @@ void CityPathGraphManager::addWaypoint ( ServerObject * sourceObject ) DynamicVariableList const & objvars = sourceObject->getObjVars(); - CityPathNode * newNode = NULL; + CityPathNode * newNode = nullptr; Vector sourcePos_w = sourceObject->getPosition_w(); @@ -626,11 +626,11 @@ void CityPathGraphManager::removeWaypoint ( ServerObject * sourceObject ) { CityPathGraph * graph = _getCityGraphFor(sourceObject); - if(graph == NULL) return; + if(graph == nullptr) return; CityPathNode * unloadingNode = _getCityNodeFor(sourceObject,graph); - if(unloadingNode == NULL) return; + if(unloadingNode == nullptr) return; // ---------- @@ -679,15 +679,15 @@ void CityPathGraphManager::moveWaypoint ( ServerObject * sourceObject, Vector co { UNREF(oldPosition); - if(sourceObject == NULL) return; + if(sourceObject == nullptr) return; CityPathGraph * graph = _getCityGraphFor(sourceObject); - if(graph == NULL) return; + if(graph == nullptr) return; CityPathNode * node = _getCityNodeFor(sourceObject,graph); - if(node == NULL) return; + if(node == nullptr) return; // ---------- @@ -719,11 +719,11 @@ void CityPathGraphManager::moveWaypoint ( ServerObject * sourceObject, Vector co void CityPathGraphManager::addBuilding ( BuildingObject * building ) { - if(building == NULL) return; + if(building == nullptr) return; CityPathGraph * graph = _getCityGraphFor(building); - if(graph == NULL) + if(graph == nullptr) { return; } @@ -752,11 +752,11 @@ void CityPathGraphManager::addBuilding ( BuildingObject * building ) { ServerObject * serverObject = ServerWorld::findObjectByNetworkId(ids[i]); - if(serverObject == NULL) continue; + if(serverObject == nullptr) continue; CityPathNode * node = _getCityNodeFor(serverObject,graph); - if(node == NULL) continue; + if(node == nullptr) continue; node->setCreator(building->getNetworkId()); } @@ -783,11 +783,11 @@ void CityPathGraphManager::destroyBuilding ( BuildingObject * building ) void CityPathGraphManager::moveBuilding ( BuildingObject * building, Vector const & oldPosition ) { - if(building == NULL) return; + if(building == nullptr) return; CityPathGraph * graph = _getCityGraphFor(building); - if(graph == NULL) return; + if(graph == nullptr) return; UNREF(oldPosition); @@ -800,11 +800,11 @@ void CityPathGraphManager::moveBuilding ( BuildingObject * building, Vector cons { ServerObject * serverObject = ServerWorld::findObjectByNetworkId(ids[i]); - if(serverObject == NULL) continue; + if(serverObject == nullptr) continue; CityPathNode * node = _getCityNodeFor(serverObject,graph); - if(node == NULL) continue; + if(node == nullptr) continue; Vector relativePos_o = node->getRelativePosition_o(); @@ -851,7 +851,7 @@ bool CityPathGraphManager::destroyPathGraph ( ServerObject const * creator ) bool CityPathGraphManager::createPathNodes ( ServerObject * building ) { - if(building == NULL) return false; + if(building == nullptr) return false; // Destroy any old path nodes for the building @@ -862,7 +862,7 @@ bool CityPathGraphManager::createPathNodes ( ServerObject * building ) PathGraph const * pathGraph = _getExteriorGraph(building); - if(pathGraph == NULL) return false; + if(pathGraph == nullptr) return false; // ---------- // Go through all the nodes in the building's graph and create city @@ -878,7 +878,7 @@ bool CityPathGraphManager::createPathNodes ( ServerObject * building ) { PathNode const * node = pathGraph->getNode(i); - if(node == NULL) continue; + if(node == nullptr) continue; // ---------- @@ -975,11 +975,11 @@ void CityPathGraphManager::destroyWaypoint ( ServerObject * object ) { CityPathGraph * graph = _getCityGraphFor(object); - if(graph == NULL) return; + if(graph == nullptr) return; CityPathNode * deadNode = _getCityNodeFor(object,graph); - if(deadNode == NULL) return; + if(deadNode == nullptr) return; // ---------- @@ -1025,11 +1025,11 @@ void CityPathGraphManager::destroyWaypoint ( ServerObject * object ) bool CityPathGraphManager::destroyPathNodes ( ServerObject * object ) { - if(object == NULL) return false; + if(object == nullptr) return false; BuildingObject * building = dynamic_cast(object); - if(building == NULL) return false; + if(building == nullptr) return false; NetworkIdList ids; if (!building->getObjVars().getItem(OBJVAR_PATHFINDING_BUILDING_WAYPOINTS,ids)) return false; @@ -1044,7 +1044,7 @@ bool CityPathGraphManager::destroyPathNodes ( ServerObject * object ) ServerObject * serverObject = ServerWorld::findObjectByNetworkId(id); - if(serverObject == NULL) continue; + if(serverObject == nullptr) continue; serverObject->permanentlyDestroy(DeleteReasons::Replaced); } @@ -1156,7 +1156,7 @@ void CityPathGraphManager::setLinkDistance ( float dist ) void CityPathGraphManager::relinkGraph ( CityPathGraph const * constGraph ) { - if(constGraph == NULL) return; + if(constGraph == nullptr) return; CityPathGraph * graph = const_cast(constGraph); diff --git a/engine/server/library/serverPathfinding/src/shared/CityPathNode.cpp b/engine/server/library/serverPathfinding/src/shared/CityPathNode.cpp index 8e4df130..11000b37 100755 --- a/engine/server/library/serverPathfinding/src/shared/CityPathNode.cpp +++ b/engine/server/library/serverPathfinding/src/shared/CityPathNode.cpp @@ -46,7 +46,7 @@ CityPathNode::CityPathNode ( Vector const & position_w, NetworkId const & source m_source(sourceId), m_creator(), m_relativePosition_o(Vector::zero), - m_spatialHandle(NULL), + m_spatialHandle(nullptr), m_debugId( gs_debugIdCounter++ ) { snapToTerrain(); @@ -59,7 +59,7 @@ CityPathNode::CityPathNode ( Vector const & position_w, NetworkId const & source m_source(sourceId), m_creator(creatorId), m_relativePosition_o(Vector::zero), - m_spatialHandle(NULL), + m_spatialHandle(nullptr), m_debugId( gs_debugIdCounter++ ) { updateRelativePosition(); @@ -158,7 +158,7 @@ void CityPathNode::loadInfoFromObjvars ( void ) { ServerObject const * sourceObject = getSourceObject(); - if(sourceObject == NULL) return; + if(sourceObject == nullptr) return; const DynamicVariableList & objvars = sourceObject->getObjVars(); @@ -188,7 +188,7 @@ void CityPathNode::loadEdgesFromObjvars ( void ) { ServerObject const * sourceObject = getSourceObject(); - if(sourceObject == NULL) return; + if(sourceObject == nullptr) return; DynamicVariableList const & objvars = sourceObject->getObjVars(); @@ -203,11 +203,11 @@ void CityPathNode::loadEdgesFromObjvars ( void ) { ServerObject * serverObject = ServerWorld::findObjectByNetworkId( idList[i] ); - if(serverObject == NULL) continue; + if(serverObject == nullptr) continue; CityPathNode * otherNode = _getGraph()->findNodeForObject(*serverObject); - if(otherNode == NULL) continue; + if(otherNode == nullptr) continue; addEdge(otherNode->getIndex()); otherNode->addEdge(getIndex()); @@ -233,7 +233,7 @@ void CityPathNode::saveInfoToObjvars ( void ) { ServerObject * sourceObject = getSourceObject(); - if(sourceObject == NULL) return; + if(sourceObject == nullptr) return; // ---------- @@ -294,7 +294,7 @@ void CityPathNode::saveEdgesToObjvars ( void ) CityPathNode * neighborNode = _getGraph()->_getNode(neighborIndex); - if(neighborNode == NULL) continue; + if(neighborNode == nullptr) continue; NetworkId const & neighborSourceId = neighborNode->getSourceId(); @@ -327,7 +327,7 @@ void CityPathNode::saveNeighbors ( void ) CityPathNode * neighborNode = _getGraph()->_getNode(neighborIndex); - if(neighborNode == NULL) continue; + if(neighborNode == nullptr) continue; neighborNode->saveToObjvars(); } @@ -420,7 +420,7 @@ bool CityPathNode::sanityCheck ( bool doWarnings ) const CityPathNode const * neighborNode = _getGraph()->_getNode(neighborIndex); - if(neighborNode == NULL) + if(neighborNode == nullptr) { DEBUG_WARNING(doWarnings,("CityPathNode::sanityCheck - Node has an edge to a non-existent node\n")); insaneCount++; @@ -458,7 +458,7 @@ bool CityPathNode::sanityCheck ( bool doWarnings ) const CityPathNode const * nodeA = this; CityPathNode const * nodeB = _getGraph()->_getNode(getNeighbor(i)); - if(nodeB == NULL) continue; + if(nodeB == nullptr) continue; if(nodeB->getType() == PNT_CityBuilding) continue; @@ -493,7 +493,7 @@ void CityPathNode::reload ( void ) { ServerObject const * sourceObject = getSourceObject(); - if(sourceObject == NULL) return; + if(sourceObject == nullptr) return; // ---------- @@ -521,7 +521,7 @@ bool CityPathNode::hasEdgeTo ( NetworkId const & neighborId ) const CityPathNode const * neighborNode = _getGraph()->_getNode(neighborIndex); - if(neighborNode == NULL) continue; + if(neighborNode == nullptr) continue; if(neighborNode->getSourceId() == neighborId) return true; } @@ -535,7 +535,7 @@ void CityPathNode::snapToTerrain ( void ) { CellProperty const * cell = getCell(); - if((cell == NULL) || (cell == CellProperty::getWorldCellProperty())) + if((cell == nullptr) || (cell == CellProperty::getWorldCellProperty())) { Vector pos_w = getPosition_w(); diff --git a/engine/server/library/serverPathfinding/src/shared/PathAutoGenerator.cpp b/engine/server/library/serverPathfinding/src/shared/PathAutoGenerator.cpp index d5f6cd8e..328a52aa 100755 --- a/engine/server/library/serverPathfinding/src/shared/PathAutoGenerator.cpp +++ b/engine/server/library/serverPathfinding/src/shared/PathAutoGenerator.cpp @@ -48,14 +48,14 @@ Region const * PathAutoGenerator::findPathRegion(Vector const & pos_w) for (RegionMaster::RegionVector::const_iterator it = rv.begin(); it != rv.end(); ++it) { Region const * const r = *it; - if (NULL != r) + if (nullptr != r) { if (r->getGeography() == RegionNamespace::RG_pathfind) return r; } } - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -63,7 +63,7 @@ Region const * PathAutoGenerator::findPathRegion(Vector const & pos_w) void PathAutoGenerator::pathAutoGenerate(Vector const & pos_w, float nodeDistance, float obstacleDistance, Unicode::String & result) { Region const * region = findPathRegion(pos_w); - if (NULL == region) + if (nullptr == region) { result += Unicode::narrowToWide("No pathfinding region at position"); return; @@ -144,7 +144,7 @@ void PathAutoGenerator::pathAutoGenerate(Vector const & pos_w, float nodeDistanc ++obstacleNearbySkipped; #if USE_OBSTACLE_TEMPLATE - if (NULL != PathAutoGeneratorNamespace::s_pathObstacleTemplate) + if (nullptr != PathAutoGeneratorNamespace::s_pathObstacleTemplate) { Transform transform_w; transform_w.setPosition_p(testPos_w); @@ -164,7 +164,7 @@ void PathAutoGenerator::pathAutoGenerate(Vector const & pos_w, float nodeDistanc transform_w.setPosition_p(testPos_w); ServerObject * newObject = ServerWorld::createNewObject(s_pathWaypointTemplate, transform_w, 0, false); - if (NULL != newObject) + if (nullptr != newObject) { newObject->addToWorld(); newObject->persist(); @@ -189,7 +189,7 @@ void PathAutoGenerator::pathAutoGenerate(Vector const & pos_w, float nodeDistanc void PathAutoGenerator::pathAutoCleanup(Vector const & pos_w, Unicode::String & result) { Region const * region = findPathRegion(pos_w); - if (NULL == region) + if (nullptr == region) { result += Unicode::narrowToWide("No pathfinding region at position"); return; @@ -236,7 +236,7 @@ void PathAutoGenerator::pathAutoCleanup(Vector const & pos_w, Unicode::String & } #if USE_OBSTACLE_TEMPLATE - if (NULL != s_pathObstacleTemplate && !strcmp(so->getTemplateName(), s_pathObstacleTemplate)) + if (nullptr != s_pathObstacleTemplate && !strcmp(so->getTemplateName(), s_pathObstacleTemplate)) { so->permanentlyDestroy(DeleteReasons::Script); ++obstacleDestroyCount; diff --git a/engine/server/library/serverPathfinding/src/shared/ServerPathBuilder.cpp b/engine/server/library/serverPathfinding/src/shared/ServerPathBuilder.cpp index 4ffdd288..109ba9c4 100755 --- a/engine/server/library/serverPathfinding/src/shared/ServerPathBuilder.cpp +++ b/engine/server/library/serverPathfinding/src/shared/ServerPathBuilder.cpp @@ -41,7 +41,7 @@ const float gs_maxCanMoveDistance2 = (64.0f * 64.0f); int findClosestReachablePathNode_slow( CreatureObject const * creature, PathGraph const * graph ) { - if(graph == NULL) return -1; + if(graph == nullptr) return -1; Vector creaturePos = creature->getPosition_p(); @@ -53,7 +53,7 @@ int findClosestReachablePathNode_slow( CreatureObject const * creature, PathGrap int resultCount = results.size(); - PathNode const * reachableNode = NULL; + PathNode const * reachableNode = nullptr; float reachableDist2 = gs_maxCanMoveDistance2; for(int i = 0; i < resultCount; i++) @@ -81,7 +81,7 @@ int findClosestReachablePathNode_slow( CreatureObject const * creature, PathGrap int findClosestReachablePathNode( CreatureObject const * creature, PathGraph const * graph ) { - if(graph == NULL) return -1; + if(graph == nullptr) return -1; Vector creaturePos = creature->getPosition_p(); @@ -98,7 +98,7 @@ int findClosestReachablePathNode( CreatureObject const * creature, PathGraph con PathNode const * node = graph->getNode(closestIndex); - if(node == NULL) return -2; + if(node == nullptr) return -2; Vector nodePos = node->getPosition_p(); float dist2 = nodePos.magnitudeBetweenSquared(creaturePos); @@ -135,7 +135,7 @@ int findClosestReachablePathNode_slow ( CellProperty const * cell, Vector const int resultCount = results.size(); - PathNode const * reachableNode = NULL; + PathNode const * reachableNode = nullptr; float reachableDist2 = gs_maxCanMoveDistance2; for(int i = 0; i < resultCount; i++) @@ -173,7 +173,7 @@ int findClosestReachablePathNode ( CellProperty const * cell, Vector const & goa PathNode const * node = graph->getNode(closestIndex); - if(node == NULL) return -2; + if(node == nullptr) return -2; Vector nodePos = node->getPosition_p(); float dist2 = nodePos.magnitudeBetweenSquared(goal); @@ -199,7 +199,7 @@ PathGraph const * getGraph ( CellProperty const * cell ) if(cell) return safe_cast(cell->getPathGraph()); else - return NULL; + return nullptr; } PathGraph const * getGraph ( PortalProperty const * building ) @@ -207,7 +207,7 @@ PathGraph const * getGraph ( PortalProperty const * building ) if(building) return safe_cast(building->getPortalPropertyTemplate().getBuildingPathGraph()); else - return NULL; + return nullptr; } // ---------- @@ -237,19 +237,19 @@ PortalProperty const * getBuilding ( BuildingObject const * buildingObject ) if(buildingObject) return buildingObject->getPortalProperty(); else - return NULL; + return nullptr; } PortalProperty const * getBuilding ( CreatureObject const * creature ) { - if(creature == NULL) return NULL; + if(creature == nullptr) return nullptr; CellProperty const * cell = creature->getParentCell(); if(cell) return cell->getPortalProperty(); else - return NULL; + return nullptr; } PortalProperty const * getBuilding ( AiLocation const & loc ) @@ -259,7 +259,7 @@ PortalProperty const * getBuilding ( AiLocation const & loc ) if(cell) return cell->getPortalProperty(); else - return NULL; + return nullptr; } // ---------- @@ -388,26 +388,26 @@ int getIndexFor ( CellProperty const * cell, PathGraph const * graph, AiLocation // ---------------------------------------------------------------------- ServerPathBuilder::ServerPathBuilder() -: m_creatureCell(NULL), - m_creatureCellGraph(NULL), +: m_creatureCell(nullptr), + m_creatureCellGraph(nullptr), m_creatureCellKey(-1), m_creatureCellNodeIndex(-1), m_creatureCellPart(-1), - m_creatureBuilding(NULL), - m_creatureBuildingGraph(NULL), + m_creatureBuilding(nullptr), + m_creatureBuildingGraph(nullptr), m_creatureBuildingKey(-1), m_creatureBuildingNodeIndex(-1), m_creaturePosition(), - m_goalCell(NULL), - m_goalCellGraph(NULL), + m_goalCell(nullptr), + m_goalCellGraph(nullptr), m_goalCellKey(-1), m_goalCellNodeIndex(-1), m_goalCellPart(-1), - m_goalBuilding(NULL), - m_goalBuildingGraph(NULL), + m_goalBuilding(nullptr), + m_goalBuildingGraph(nullptr), m_goalBuildingKey(-1), m_goalBuildingNodeIndex(-1), - m_goalCityGraph(NULL), + m_goalCityGraph(nullptr), m_goalCityNodeIndex(-1), m_path(new AiPath()), m_async(false), @@ -427,16 +427,16 @@ ServerPathBuilder::~ServerPathBuilder() ServerPathBuildManager::unqueue(this); delete m_path; - m_path = NULL; + m_path = nullptr; delete m_cellSearch; - m_cellSearch = NULL; + m_cellSearch = nullptr; delete m_buildingSearch; - m_buildingSearch = NULL; + m_buildingSearch = nullptr; delete m_citySearch; - m_citySearch = NULL; + m_citySearch = nullptr; } @@ -462,7 +462,7 @@ bool ServerPathBuilder::buildPathInternal( CellProperty const * cell, PathGraph PathNode const * node = graph->getNode(nodeIndex); - if(node == NULL) return false; + if(node == nullptr) return false; addPathNode( cell, node ); } @@ -484,9 +484,9 @@ bool ServerPathBuilder::buildPathInternal ( PortalProperty const * building, Pat // ---------- - PathNode const * nodeA = NULL; - PathNode const * nodeB = NULL; - PathNode const * nodeC = NULL; + PathNode const * nodeA = nullptr; + PathNode const * nodeB = nullptr; + PathNode const * nodeC = nullptr; int pathLength = path.size(); @@ -496,7 +496,7 @@ bool ServerPathBuilder::buildPathInternal ( PortalProperty const * building, Pat { PathNode const * nextNode = graph->getNode(path[i]); - if(nextNode == NULL) continue; + if(nextNode == nullptr) continue; nodeA = nodeB; nodeB = nodeC; @@ -506,10 +506,10 @@ bool ServerPathBuilder::buildPathInternal ( PortalProperty const * building, Pat { nodeA = nodeB; nodeB = nodeC; - nodeC = NULL; + nodeC = nullptr; } - if( nodeB == NULL ) continue; + if( nodeB == nullptr ) continue; // ---------- @@ -519,11 +519,11 @@ bool ServerPathBuilder::buildPathInternal ( PortalProperty const * building, Pat CellProperty const * subobject = building->getCell(cellIndex); - if(subobject == NULL) return false; + if(subobject == nullptr) return false; PathGraph const * subgraph = getGraph(subobject); - if(subgraph == NULL) return false; + if(subgraph == nullptr) return false; // ---------- @@ -576,9 +576,9 @@ bool ServerPathBuilder::buildPathInternal ( CityPathGraph const * graph, int ind bool ServerPathBuilder::expandPath ( CityPathGraph const * graph, IndexList const & path ) { - PathNode const * nodeA = NULL; - PathNode const * nodeB = NULL; - PathNode const * nodeC = NULL; + PathNode const * nodeA = nullptr; + PathNode const * nodeB = nullptr; + PathNode const * nodeC = nullptr; int pathLength = path.size(); @@ -588,7 +588,7 @@ bool ServerPathBuilder::expandPath ( CityPathGraph const * graph, IndexList cons { PathNode const * nextNode = graph->getNode(path[i]); - if(nextNode == NULL) continue; + if(nextNode == nullptr) continue; nodeA = nodeB; nodeB = nodeC; @@ -598,10 +598,10 @@ bool ServerPathBuilder::expandPath ( CityPathGraph const * graph, IndexList cons { nodeA = nodeB; nodeB = nodeC; - nodeC = NULL; + nodeC = nullptr; } - if( nodeB == NULL ) continue; + if( nodeB == nullptr ) continue; // ---------- @@ -609,19 +609,19 @@ bool ServerPathBuilder::expandPath ( CityPathGraph const * graph, IndexList cons { CityPathNode const * cityNode = safe_cast(nodeB); - if(cityNode == NULL) return false; + if(cityNode == nullptr) return false; BuildingObject const * buildingObject = safe_cast(cityNode->getCreatorObject()); - if(buildingObject == NULL) return false; + if(buildingObject == nullptr) return false; PortalProperty const * subobject = getBuilding(buildingObject); - if(subobject == NULL) return false; + if(subobject == nullptr) return false; PathGraph const * subgraph = getGraph(subobject); - if(subgraph == NULL) return false; + if(subgraph == nullptr) return false; // ---------- @@ -652,7 +652,7 @@ bool ServerPathBuilder::buildPath_World ( void ) { Vector exitPoint(m_creature ? m_creature->getPosition_w() : m_creaturePosition); - if((m_creatureCityGraph != NULL) && (m_creatureCityNodeIndex >= 0)) + if((m_creatureCityGraph != nullptr) && (m_creatureCityNodeIndex >= 0)) { int indexA = m_creatureCityNodeIndex; int indexB = m_creatureCityGraph->findNearestNode(m_goal.getPosition_w()); @@ -670,7 +670,7 @@ bool ServerPathBuilder::buildPath_World ( void ) } } - if((m_goalCityGraph != NULL) && (m_goalCityNodeIndex >= 0)) + if((m_goalCityGraph != nullptr) && (m_goalCityNodeIndex >= 0)) { int indexA = m_goalCityGraph->findNearestNode(exitPoint); int indexB = m_goalCityNodeIndex; @@ -701,8 +701,8 @@ bool ServerPathBuilder::buildPath_ToGoal ( void ) m_creatureCell = m_creature->getParentCell(); m_goalCell = m_goal.getCell(); - if(m_creatureCell == NULL) m_creatureCell = worldCell; - if(m_goalCell == NULL) m_goalCell = worldCell; + if(m_creatureCell == nullptr) m_creatureCell = worldCell; + if(m_goalCell == nullptr) m_goalCell = worldCell; { Vector goalPos_p = m_goal.getPosition_p(m_creatureCell); @@ -724,23 +724,23 @@ bool ServerPathBuilder::buildPath_ToGoal ( void ) // we can skip some work with looking up their cell and building // info. - m_creatureCellGraph = NULL; + m_creatureCellGraph = nullptr; m_creatureCellKey = -1; m_creatureCellNodeIndex = -1; m_creatureCellPart = -1; - m_goalCellGraph = NULL; + m_goalCellGraph = nullptr; m_goalCellKey = -1; m_goalCellNodeIndex = -1; m_goalCellPart = -1; - m_creatureBuilding = NULL; - m_creatureBuildingGraph = NULL; + m_creatureBuilding = nullptr; + m_creatureBuildingGraph = nullptr; m_creatureBuildingKey = -1; m_creatureBuildingNodeIndex = -1; - m_goalBuilding = NULL; - m_goalBuildingGraph = NULL; + m_goalBuilding = nullptr; + m_goalBuildingGraph = nullptr; m_goalBuildingKey = -1; m_goalBuildingNodeIndex = -1; } @@ -776,7 +776,7 @@ bool ServerPathBuilder::buildPath_ToGoal ( void ) // If they're in the same cell, start the search in the cell - if((m_creatureCell == m_goalCell) && (m_creatureCell != NULL) && (m_creatureCell != CellProperty::getWorldCellProperty()) && (m_creatureCellPart == m_goalCellPart)) + if((m_creatureCell == m_goalCell) && (m_creatureCell != nullptr) && (m_creatureCell != CellProperty::getWorldCellProperty()) && (m_creatureCellPart == m_goalCellPart)) { return buildPathInternal(m_creatureCell,m_creatureCellGraph,m_creatureCellNodeIndex,m_goalCellNodeIndex); } @@ -795,7 +795,7 @@ bool ServerPathBuilder::buildPath_ToGoal ( void ) // If they're in the same building, start the search in the building - if((m_creatureBuilding == m_goalBuilding) && (m_creatureBuilding != NULL)) + if((m_creatureBuilding == m_goalBuilding) && (m_creatureBuilding != nullptr)) { return buildPathInternal(m_creatureBuilding,m_creatureBuildingGraph,m_creatureBuildingNodeIndex,m_goalBuildingNodeIndex); } @@ -810,7 +810,7 @@ bool ServerPathBuilder::buildPath_ToGoal ( void ) m_goalCityGraph = CityPathGraphManager::getCityGraphFor(m_goal.getPosition_w()); m_goalCityNodeIndex = getIndexFor(m_goalCityGraph,m_goalBuilding,m_goal); - if((m_creatureCityGraph == m_goalCityGraph) && (m_creatureCityGraph != NULL)) + if((m_creatureCityGraph == m_goalCityGraph) && (m_creatureCityGraph != nullptr)) { // hack - If a creature in a city region tries to path search but it's not near a path node, // make its path search succeed @@ -875,7 +875,7 @@ bool ServerPathBuilder::buildPath_Named ( void ) // ---------- - if(m_creatureCityGraph != NULL) + if(m_creatureCityGraph != nullptr) { IndexList goalList; @@ -885,7 +885,7 @@ bool ServerPathBuilder::buildPath_Named ( void ) { CityPathNode const * node = m_creatureCityGraph->_getNode(i); - if(node == NULL) continue; + if(node == nullptr) continue; if(node->getName() == m_goalName) { @@ -954,7 +954,7 @@ void ServerPathBuilder::update ( void ) bool ServerPathBuilder::setupBuildPath ( CreatureObject const * creature, AiLocation const & goal ) { - if(creature == NULL) return false; + if(creature == nullptr) return false; if(!goal.isValid()) return false; m_creature = creature; @@ -971,7 +971,7 @@ bool ServerPathBuilder::setupBuildPath ( CreatureObject const * creature, AiLoca bool ServerPathBuilder::setupBuildPath ( CreatureObject const * creature, Unicode::String const & goalName ) { - if(creature == NULL) return false; + if(creature == nullptr) return false; if(goalName.empty()) return false; m_creature = creature; @@ -1058,23 +1058,23 @@ bool ServerPathBuilder::buildWorldPath(AiLocation const &startLocation, AiLocati // we can skip some work with looking up their cell and building // info. - m_creatureCellGraph = NULL; + m_creatureCellGraph = nullptr; m_creatureCellKey = -1; m_creatureCellNodeIndex = -1; m_creatureCellPart = -1; - m_goalCellGraph = NULL; + m_goalCellGraph = nullptr; m_goalCellKey = -1; m_goalCellNodeIndex = -1; m_goalCellPart = -1; - m_creatureBuilding = NULL; - m_creatureBuildingGraph = NULL; + m_creatureBuilding = nullptr; + m_creatureBuildingGraph = nullptr; m_creatureBuildingKey = -1; m_creatureBuildingNodeIndex = -1; - m_goalBuilding = NULL; - m_goalBuildingGraph = NULL; + m_goalBuilding = nullptr; + m_goalBuildingGraph = nullptr; m_goalBuildingKey = -1; m_goalBuildingNodeIndex = -1; @@ -1134,8 +1134,8 @@ bool ServerPathBuilder::buildWorldPath(AiLocation const &startLocation, AiLocati void ServerPathBuilder::addPathNode ( CellProperty const * cell, PathNode const * node ) { - if(node == NULL) return; - if(cell == NULL) cell = CellProperty::getWorldCellProperty(); + if(node == nullptr) return; + if(cell == nullptr) cell = CellProperty::getWorldCellProperty(); AiLocation loc(cell,node->getPosition_p()); @@ -1173,7 +1173,7 @@ void ServerPathBuilder::addPathNode ( CellProperty const * cell, PathNode const bool ServerPathBuilder::buildPathImmediate(AiLocation const & creature, AiLocation const & goal) { - m_creature = NULL; + m_creature = nullptr; m_goal = goal; m_buildDone = false; m_buildFailed = false; @@ -1190,9 +1190,9 @@ bool ServerPathBuilder::buildPathImmediate(AiLocation const & creature, AiLocati // ---------- CellProperty const * worldCell = CellProperty::getWorldCellProperty(); - if(m_creatureCell == NULL) + if(m_creatureCell == nullptr) m_creatureCell = worldCell; - if(m_goalCell == NULL) + if(m_goalCell == nullptr) m_goalCell = worldCell; @@ -1236,14 +1236,14 @@ bool ServerPathBuilder::buildPathImmediate(AiLocation const & creature, AiLocati m_goalBuildingNodeIndex = getIndexFor(m_goalBuilding, m_goalBuildingGraph, m_goal, m_goalCellPart); // If they're in the same building, start the search in the building - if((m_creatureBuilding == m_goalBuilding) && (m_creatureBuilding != NULL)) + if((m_creatureBuilding == m_goalBuilding) && (m_creatureBuilding != nullptr)) { if (buildPathInternal(m_creatureBuilding, m_creatureBuildingGraph, m_creatureBuildingNodeIndex, m_goalBuildingNodeIndex)) return true; } // If they're in the same cell, start the search in the cell - if((m_creatureCell == m_goalCell) && (m_creatureCell != NULL) && (m_creatureCell != CellProperty::getWorldCellProperty()) && (m_creatureCellPart == m_goalCellPart)) + if((m_creatureCell == m_goalCell) && (m_creatureCell != nullptr) && (m_creatureCell != CellProperty::getWorldCellProperty()) && (m_creatureCellPart == m_goalCellPart)) { if (buildPathInternal(m_creatureCell, m_creatureCellGraph, m_creatureCellNodeIndex, m_goalCellNodeIndex)) return true; @@ -1257,7 +1257,7 @@ bool ServerPathBuilder::buildPathImmediate(AiLocation const & creature, AiLocati m_goalCityGraph = CityPathGraphManager::getCityGraphFor(m_goal.getPosition_w()); m_goalCityNodeIndex = getIndexFor(m_goalCityGraph,m_goalBuilding,m_goal); - if((m_creatureCityGraph == m_goalCityGraph) && (m_creatureCityGraph != NULL)) + if((m_creatureCityGraph == m_goalCityGraph) && (m_creatureCityGraph != nullptr)) { // hack - If a creature in a city region tries to path search but it's not near a path node, // make its path search succeed diff --git a/engine/server/library/serverPathfinding/src/shared/ServerPathfindingMessaging.cpp b/engine/server/library/serverPathfinding/src/shared/ServerPathfindingMessaging.cpp index 068f9d3a..e71513d5 100755 --- a/engine/server/library/serverPathfinding/src/shared/ServerPathfindingMessaging.cpp +++ b/engine/server/library/serverPathfinding/src/shared/ServerPathfindingMessaging.cpp @@ -31,7 +31,7 @@ #include #include -ServerPathfindingMessaging * g_messaging = NULL; +ServerPathfindingMessaging * g_messaging = nullptr; // ====================================================================== @@ -51,7 +51,7 @@ void ServerPathfindingMessaging::remove ( void ) g_messaging->disconnectFromMessage(RequestUnstick::MESSAGE_TYPE); delete g_messaging; - g_messaging = NULL; + g_messaging = nullptr; } ServerPathfindingMessaging & ServerPathfindingMessaging::getInstance ( void ) @@ -75,10 +75,10 @@ ServerPathfindingMessaging::~ServerPathfindingMessaging() } delete m_clientList; - m_clientList = NULL; + m_clientList = nullptr; delete m_callback; - m_callback = NULL; + m_callback = nullptr; } // ---------- @@ -178,7 +178,7 @@ void ServerPathfindingMessaging::receiveMessage(const MessageDispatch::Emitter & { Transform newTransform = Transform::identity; newTransform.setPosition_p(unstickPoint); - controller->teleport(newTransform, NULL); + controller->teleport(newTransform, nullptr); } return; @@ -188,7 +188,7 @@ void ServerPathfindingMessaging::receiveMessage(const MessageDispatch::Emitter & Vector unstickPoint; CellObject * cell = ContainerInterface::getContainingCellObject(*s); - if (cell != NULL && s->asCreatureObject() != NULL) + if (cell != nullptr && s->asCreatureObject() != nullptr) { // try finding a waypoint in the cell first if (!cell->getClosestPathNodePos(*s, unstickPoint)) @@ -266,7 +266,7 @@ void ServerPathfindingMessaging::ignoreObjectPath(Client * client, const Network void ServerPathfindingMessaging::watchPathMap(Client * client) { - if(client == NULL) return; + if(client == nullptr) return; // Add the client to our client list @@ -290,7 +290,7 @@ void ServerPathfindingMessaging::watchPathMap(Client * client) void ServerPathfindingMessaging::ignorePathMap(Client * client) { - if(client == NULL) return; + if(client == nullptr) return; m_clientList->erase(client); @@ -319,7 +319,7 @@ void ServerPathfindingMessaging::onClientDestroy(ClientDestroy & d) void ServerPathfindingMessaging::sendGraphInfo ( CityPathGraph const * graph ) { - if(graph == NULL) return; + if(graph == nullptr) return; for(ClientList::iterator it = m_clientList->begin(); it != m_clientList->end(); ++it) { @@ -331,8 +331,8 @@ void ServerPathfindingMessaging::sendGraphInfo ( CityPathGraph const * graph ) void ServerPathfindingMessaging::sendGraphInfo ( CityPathGraph const * graph, Client * client ) { - if(client == NULL) return; - if(graph == NULL) return; + if(client == nullptr) return; + if(graph == nullptr) return; int nodeCount = graph->getNodeCount(); @@ -348,7 +348,7 @@ void ServerPathfindingMessaging::sendGraphInfo ( CityPathGraph const * graph, Cl void ServerPathfindingMessaging::sendEraseGraph ( CityPathGraph const * graph ) { - if(graph == NULL) return; + if(graph == nullptr) return; for(ClientList::iterator it = m_clientList->begin(); it != m_clientList->end(); ++it) { @@ -360,8 +360,8 @@ void ServerPathfindingMessaging::sendEraseGraph ( CityPathGraph const * graph ) void ServerPathfindingMessaging::sendEraseGraph ( CityPathGraph const * graph, Client * client ) { - if(client == NULL) return; - if(graph == NULL) return; + if(client == nullptr) return; + if(graph == nullptr) return; int nodeCount = graph->getNodeCount(); @@ -377,7 +377,7 @@ void ServerPathfindingMessaging::sendEraseGraph ( CityPathGraph const * graph, C void ServerPathfindingMessaging::sendNodeInfo ( CityPathNode const * node ) { - if(node == NULL) return; + if(node == nullptr) return; for(ClientList::iterator it = m_clientList->begin(); it != m_clientList->end(); ++it) { @@ -389,8 +389,8 @@ void ServerPathfindingMessaging::sendNodeInfo ( CityPathNode const * node ) void ServerPathfindingMessaging::sendNodeInfo ( CityPathNode const * node, Client * client ) { - if(node == NULL) return; - if(client == NULL) return; + if(node == nullptr) return; + if(client == nullptr) return; AINodeInfo m; @@ -428,7 +428,7 @@ void ServerPathfindingMessaging::sendNodeInfo ( CityPathNode const * node, Clien void ServerPathfindingMessaging::sendNeighborInfo ( CityPathNode const * node ) { - if(node == NULL) return; + if(node == nullptr) return; for(ClientList::iterator it = m_clientList->begin(); it != m_clientList->end(); ++it) { @@ -440,8 +440,8 @@ void ServerPathfindingMessaging::sendNeighborInfo ( CityPathNode const * node ) void ServerPathfindingMessaging::sendNeighborInfo ( CityPathNode const * node, Client * client ) { - if(node == NULL) return; - if(client == NULL) return; + if(node == nullptr) return; + if(client == nullptr) return; int edgeCount = node->getEdgeCount(); @@ -459,7 +459,7 @@ void ServerPathfindingMessaging::sendNeighborInfo ( CityPathNode const * node, C void ServerPathfindingMessaging::sendEraseNode ( CityPathNode const * node ) { - if(node == NULL) return; + if(node == nullptr) return; for(ClientList::iterator it = m_clientList->begin(); it != m_clientList->end(); ++it) { @@ -471,8 +471,8 @@ void ServerPathfindingMessaging::sendEraseNode ( CityPathNode const * node ) void ServerPathfindingMessaging::sendEraseNode ( CityPathNode const * node, Client * client ) { - if(node == NULL) return; - if(client == NULL) return; + if(node == nullptr) return; + if(client == nullptr) return; AINodeInfo m; @@ -497,7 +497,7 @@ void ServerPathfindingMessaging::sendWaypointInfo ( AiLocation const & loc ) void ServerPathfindingMessaging::sendWaypointInfo ( AiLocation const & loc, Client * client ) { - if(client == NULL) return; + if(client == nullptr) return; AINodeInfo m; @@ -531,7 +531,7 @@ void ServerPathfindingMessaging::sendEraseWaypoint ( AiLocation const & loc ) void ServerPathfindingMessaging::sendEraseWaypoint ( AiLocation const & loc, Client * client ) { - if(client == NULL) return; + if(client == nullptr) return; AINodeInfo m; diff --git a/engine/server/library/serverPathfinding/src/shared/ServerPathfindingNotification.cpp b/engine/server/library/serverPathfinding/src/shared/ServerPathfindingNotification.cpp index d524776c..25f8a676 100755 --- a/engine/server/library/serverPathfinding/src/shared/ServerPathfindingNotification.cpp +++ b/engine/server/library/serverPathfinding/src/shared/ServerPathfindingNotification.cpp @@ -44,7 +44,7 @@ void ServerPathfindingNotification::addToWorld ( Object & object ) const { CityPathGraphManager::addBuilding( building ); } - else if(object.asServerObject() != NULL && object.asServerObject()->isWaypoint()) + else if(object.asServerObject() != nullptr && object.asServerObject()->isWaypoint()) { CityPathGraphManager::addWaypoint( object.asServerObject() ); } @@ -61,7 +61,7 @@ void ServerPathfindingNotification::removeFromWorld ( Object & object ) const { CityPathGraphManager::removeBuilding( building ); } - else if(object.asServerObject() != NULL && object.asServerObject()->isWaypoint()) + else if(object.asServerObject() != nullptr && object.asServerObject()->isWaypoint()) { CityPathGraphManager::removeWaypoint( object.asServerObject() ); } @@ -79,7 +79,7 @@ bool ServerPathfindingNotification::positionChanged ( Object & object, bool /*du { CityPathGraphManager::moveBuilding( building, oldPosition ); } - else if(object.asServerObject() != NULL && object.asServerObject()->isWaypoint()) + else if(object.asServerObject() != nullptr && object.asServerObject()->isWaypoint()) { CityPathGraphManager::moveWaypoint( object.asServerObject(), oldPosition ); } @@ -95,7 +95,7 @@ bool ServerPathfindingNotification::positionAndRotationChanged ( Object & object { CityPathGraphManager::moveBuilding( building, oldPosition ); } - else if(object.asServerObject() != NULL && object.asServerObject()->isWaypoint()) + else if(object.asServerObject() != nullptr && object.asServerObject()->isWaypoint()) { CityPathGraphManager::moveWaypoint( object.asServerObject(), oldPosition ); } diff --git a/engine/server/library/serverScript/src/shared/GameScriptObject.cpp b/engine/server/library/serverScript/src/shared/GameScriptObject.cpp index c93ebbf4..3e8e9396 100755 --- a/engine/server/library/serverScript/src/shared/GameScriptObject.cpp +++ b/engine/server/library/serverScript/src/shared/GameScriptObject.cpp @@ -40,7 +40,7 @@ // class GameScriptObject static members //======================================================================== -GameScriptObject::ScriptDataMap * GameScriptObject::ms_scriptDataMap = NULL; +GameScriptObject::ScriptDataMap * GameScriptObject::ms_scriptDataMap = nullptr; bool GameScriptObject::m_pauseScripting = false; @@ -52,7 +52,7 @@ bool GameScriptObject::m_pauseScripting = false; * Class constructor. */ GameScriptObject::GameScriptObject(void) : - m_owner(NULL), + m_owner(nullptr), m_scriptList(), m_scriptListInitialized(false), m_scriptListValid(false), @@ -69,11 +69,11 @@ GameScriptObject::~GameScriptObject() { { PROFILER_AUTO_BLOCK_DEFINE("GameScriptObject::~GameScriptObject removeJavaId\n"); - if (JavaLibrary::instance() != NULL /*&& m_javaId != NULL*/) + if (JavaLibrary::instance() != nullptr /*&& m_javaId != nullptr*/) { NOT_NULL(m_owner); JavaLibrary::removeJavaId(m_owner->getNetworkId()); -// m_javaId = NULL; +// m_javaId = nullptr; } } @@ -82,7 +82,7 @@ GameScriptObject::~GameScriptObject() removeAll(); } m_scriptList.clear(); - m_owner = NULL; + m_owner = nullptr; } // GameScriptObject::~GameScriptObject /** @@ -92,7 +92,7 @@ GameScriptObject::~GameScriptObject() */ bool GameScriptObject::installScriptEngine(void) { - if (JavaLibrary::instance() != NULL) + if (JavaLibrary::instance() != nullptr) { DEBUG_WARNING(true, ("Trying to install script engine more than once")); return true; @@ -101,7 +101,7 @@ bool GameScriptObject::installScriptEngine(void) ms_scriptDataMap = new GameScriptObject::ScriptDataMap; Scripting::InitScriptFuncHashMap(); JavaLibrary::install(); - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return false; enableNewJediTracking(ConfigServerGame::getEnableNewJedi()); return true; @@ -114,7 +114,7 @@ void GameScriptObject::removeScriptEngine(void) { JavaLibrary::remove(); delete ms_scriptDataMap; - ms_scriptDataMap = NULL; + ms_scriptDataMap = nullptr; Scripting::RemoveScriptFuncHashMap(); } // GameScriptObject::removeScriptEngine @@ -145,10 +145,10 @@ void GameScriptObject::alter(real time) */ void GameScriptObject::setOwnerIsAuthoritative(bool authoritative, uint32 pid) { - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return; - if (m_owner != NULL && m_owner->getNetworkId() != NetworkId::cms_invalid) + if (m_owner != nullptr && m_owner->getNetworkId() != NetworkId::cms_invalid) { JavaLibrary::instance()->setObjIdAuthoritative(m_owner->getNetworkId(), authoritative, pid); @@ -171,9 +171,9 @@ void GameScriptObject::setOwnerIsAuthoritative(bool authoritative, uint32 pid) */ void GameScriptObject::setOwnerIsLoaded(void) { - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return; - if (m_owner != NULL && m_owner->getNetworkId() != NetworkId::cms_invalid) + if (m_owner != nullptr && m_owner->getNetworkId() != NetworkId::cms_invalid) { JavaLibrary::instance()->setObjIdLoaded(m_owner->getNetworkId()); } @@ -189,9 +189,9 @@ void GameScriptObject::setOwnerIsLoaded(void) */ void GameScriptObject::setOwnerIsInitialized(void) { - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return; - if (m_owner != NULL && m_owner->getNetworkId() != NetworkId::cms_invalid) + if (m_owner != nullptr && m_owner->getNetworkId() != NetworkId::cms_invalid) { JavaLibrary::instance()->setObjIdInitialized(m_owner->getNetworkId()); if (m_owner->isAuthoritative()) @@ -211,10 +211,10 @@ void GameScriptObject::setOwnerIsInitialized(void) */ void GameScriptObject::setOwnerDestroyed(void) { - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return; - if (m_owner != NULL && m_owner->getNetworkId() != NetworkId::cms_invalid && m_owner->isAuthoritative()) + if (m_owner != nullptr && m_owner->getNetworkId() != NetworkId::cms_invalid && m_owner->isAuthoritative()) JavaLibrary::flagDestroyed(m_owner->getNetworkId()); } //lint !e1762 Do not make const @@ -283,7 +283,7 @@ int GameScriptObject::attachScript(const std::string& scriptName, bool runTrigge } else { - if (ms_scriptDataMap == NULL || JavaLibrary::instance() == NULL) + if (ms_scriptDataMap == nullptr || JavaLibrary::instance() == nullptr) return SCRIPT_CONTINUE; if (ms_scriptDataMap->find(scriptName) == ms_scriptDataMap->end()) @@ -379,7 +379,7 @@ int GameScriptObject::detachScript(const std::string& scriptName) else { - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return SCRIPT_CONTINUE; // Make sure to call the detach trigger on this one script if one exists. @@ -420,12 +420,12 @@ void GameScriptObject::initScriptInstances() { m_scriptListInitialized = true; - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return; if (!m_owner) { - WARNING_STRICT_FATAL(true, ("Use of null m_owner in ::initScriptInstances()")); + WARNING_STRICT_FATAL(true, ("Use of nullptr m_owner in ::initScriptInstances()")); return; } @@ -454,7 +454,7 @@ void GameScriptObject::initScriptInstances() */ void GameScriptObject::removeAll(void) { - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return; // removeAll() cannot be overriden by scripts @@ -483,12 +483,12 @@ int GameScriptObject::trigAllScripts(Scripting::TrigId trigId, ScriptParams &par { NOT_NULL(m_owner); - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return SCRIPT_CONTINUE; -// if (m_javaId == NULL && m_owner != NULL && m_owner->getNetworkId().getValue() != 0) +// if (m_javaId == nullptr && m_owner != nullptr && m_owner->getNetworkId().getValue() != 0) // { -// if (JavaLibrary::instance() != NULL) +// if (JavaLibrary::instance() != nullptr) // m_javaId = JavaLibrary::getObjId(m_owner->getNetworkId()); // } @@ -497,7 +497,7 @@ int GameScriptObject::trigAllScripts(Scripting::TrigId trigId, ScriptParams &par //Authoritative check temporarily removed because some triggers aren't being called //because the setAuth message hasn't come in yet from Central on load. - if (m_owner == NULL) //@todo FIX THIS HACK || !m_owner->isAuthoritative()) + if (m_owner == nullptr) //@todo FIX THIS HACK || !m_owner->isAuthoritative()) return SCRIPT_CONTINUE; if(!m_owner->isAuthoritative()) @@ -506,7 +506,7 @@ int GameScriptObject::trigAllScripts(Scripting::TrigId trigId, ScriptParams &par Archive::put(paramArchive, params); MessageQueueScriptTrigger * data = new MessageQueueScriptTrigger(static_cast(trigId), paramArchive); ServerController * controller = dynamic_cast(m_owner->getController()); - if(controller != NULL) + if(controller != nullptr) { controller->appendMessage( CM_scriptTrigger, @@ -557,13 +557,13 @@ int GameScriptObject::trigAllScripts(Scripting::TrigId trigId, ScriptParams &par */ int GameScriptObject::trigOneScript(const std::string& scriptName, Scripting::TrigId trigId, ScriptParams ¶ms) const { - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return SCRIPT_CONTINUE; if (m_pauseScripting) return SCRIPT_CONTINUE; - if (m_owner == NULL /*|| !m_owner->isAuthoritative()*/) + if (m_owner == nullptr /*|| !m_owner->isAuthoritative()*/) return SCRIPT_OVERRIDE; if (!m_owner->isAuthoritative() && (trigId != Scripting::TRIG_ATTACH && @@ -607,7 +607,7 @@ int GameScriptObject::trigOneScript(const std::string& scriptName, Scripting::Tr int GameScriptObject::trigScriptFromConsole(const Scripting::TrigId trigId, const std::string &scriptName, const StringVector_t &args) const { - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) { LOG("ScriptInvestigation", ("Returning script continue from console trigger request because there is no JavaLibrary instance\n")); return SCRIPT_CONTINUE; @@ -619,9 +619,9 @@ int GameScriptObject::trigScriptFromConsole(const Scripting::TrigId trigId, return SCRIPT_CONTINUE; } - if (m_owner == NULL ) + if (m_owner == nullptr ) { - LOG("ScriptInvestigation", ("Returning script override from console trigger request becuase m_owner is null\n")); + LOG("ScriptInvestigation", ("Returning script override from console trigger request becuase m_owner is nullptr\n")); return SCRIPT_OVERRIDE; } @@ -660,14 +660,14 @@ int GameScriptObject::trigScriptFromConsole(const Scripting::TrigId trigId, bool GameScriptObject::handleMessage(const std::string &messageName, const ScriptDictionaryPtr & data) { - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) { WARNING_STRICT_FATAL(true, ("(messageToFailure) GameScriptObject::handleMessage got message " "when Java not running")); return true; } - if (getOwner() == NULL) + if (getOwner() == nullptr) { WARNING_STRICT_FATAL(true, ("(messageToFailure) GameScriptObject::handleMessage got message " "with no owner")); @@ -703,7 +703,7 @@ bool GameScriptObject::handleMessage(const std::string &messageName, const std:: { ScriptDictionaryPtr dictionary; - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return true; if (m_pauseScripting) @@ -733,7 +733,7 @@ bool GameScriptObject::handleMessage(const std::string &messageName, const std:: */ int GameScriptObject::callScriptCommandHandler(std::string const &funcName, ScriptParams ¶ms) const { - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return SCRIPT_CONTINUE; if (m_pauseScripting) @@ -757,7 +757,7 @@ int GameScriptObject::callScriptCommandHandler(std::string const &funcName, Scri */ int GameScriptObject::callScriptBuffHandler(std::string const &funcName, ScriptParams ¶ms) const { - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return SCRIPT_CONTINUE; if (m_pauseScripting) @@ -825,7 +825,7 @@ void GameScriptObject::enumerateScripts(std::vector &scriptNames) c */ void GameScriptObject::makeScriptDictionary(const ScriptParams & params, ScriptDictionaryPtr & dictionary) { - if (JavaLibrary::instance() != NULL) + if (JavaLibrary::instance() != nullptr) { JavaDictionaryPtr jdp; JavaLibrary::instance()->convert(params, jdp); @@ -840,7 +840,7 @@ void GameScriptObject::makeScriptDictionary(const ScriptParams & params, ScriptD */ bool GameScriptObject::isScriptingEnabled(void) { - if (JavaLibrary::instance() != NULL) + if (JavaLibrary::instance() != nullptr) return true; return false; } // GameScriptObject::isScriptingEnabled @@ -854,7 +854,7 @@ bool GameScriptObject::isScriptingEnabled(void) */ bool GameScriptObject::reloadScript(const std::string& scriptName) { - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return false; @@ -904,7 +904,7 @@ bool GameScriptObject::reloadScript(const std::string& scriptName) */ void GameScriptObject::enableLogging(bool enable) { - if (JavaLibrary::instance() != NULL) + if (JavaLibrary::instance() != nullptr) JavaLibrary::instance()->enableLogging(enable); } // GameScriptObject::enableLogging @@ -917,7 +917,7 @@ void GameScriptObject::enableLogging(bool enable) */ void GameScriptObject::enableNewJediTracking(bool enableTracking) { - if (JavaLibrary::instance() != NULL) + if (JavaLibrary::instance() != nullptr) JavaLibrary::instance()->enableNewJediTracking(enableTracking); } // GameScriptObject::enableNewJediTracking @@ -946,7 +946,7 @@ Scheduler & GameScriptObject::getScriptScheduler() void GameScriptObject::onStopWatching(ServerObject & subject) { - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return; if (m_owner) @@ -959,7 +959,7 @@ void GameScriptObject::onStopWatching(ServerObject & subject) void GameScriptObject::onWatching(ServerObject & subject) { - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return; if (m_owner) @@ -972,7 +972,7 @@ void GameScriptObject::onWatching(ServerObject & subject) void GameScriptObject::runOneScript(const std::string & scriptName, const std::string & methodName, const std::string & argTypes, ScriptParams & args) { - if (JavaLibrary::instance() != NULL) + if (JavaLibrary::instance() != nullptr) IGNORE_RETURN( JavaLibrary::instance()->runScript(NetworkId(), scriptName, methodName, argTypes, args) ); } @@ -994,7 +994,7 @@ std::string GameScriptObject::callScriptConsoleHandler(const std::string & scrip { static const std::string errorReturnString; - if (JavaLibrary::instance() != NULL) + if (JavaLibrary::instance() != nullptr) { return JavaLibrary::instance()->callScriptConsoleHandler(scriptName, methodName, argTypes, args); } @@ -1019,7 +1019,7 @@ void GameScriptObject::callSpaceClearOvert(const NetworkId &ship) std::string GameScriptObject::callDumpTargetInfo( NetworkId &id ) { - if( JavaLibrary::instance() != NULL ) + if( JavaLibrary::instance() != nullptr ) { return JavaLibrary::instance()->getObjectDumpInfo( id ); } @@ -1030,7 +1030,7 @@ std::string GameScriptObject::callDumpTargetInfo( NetworkId &id ) void GameScriptObject::setScriptVar(const std::string & name, int value) { - if (JavaLibrary::instance() == NULL || m_owner == NULL) + if (JavaLibrary::instance() == nullptr || m_owner == nullptr) return; JavaLibrary::setScriptVar(*m_owner, name, value); @@ -1040,7 +1040,7 @@ void GameScriptObject::setScriptVar(const std::string & name, int value) void GameScriptObject::setScriptVar(const std::string & name, float value) { - if (JavaLibrary::instance() == NULL || m_owner == NULL) + if (JavaLibrary::instance() == nullptr || m_owner == nullptr) return; JavaLibrary::setScriptVar(*m_owner, name, value); @@ -1050,7 +1050,7 @@ void GameScriptObject::setScriptVar(const std::string & name, float value) void GameScriptObject::setScriptVar(const std::string & name, const std::string & value) { - if (JavaLibrary::instance() == NULL || m_owner == NULL) + if (JavaLibrary::instance() == nullptr || m_owner == nullptr) return; JavaLibrary::setScriptVar(*m_owner, name, value); @@ -1060,7 +1060,7 @@ void GameScriptObject::setScriptVar(const std::string & name, const std::string void GameScriptObject::packAllScriptVarDeltas() { - if (JavaLibrary::instance() == NULL) + if (JavaLibrary::instance() == nullptr) return; JavaLibrary::packAllDeltaScriptVars(); @@ -1070,7 +1070,7 @@ void GameScriptObject::packAllScriptVarDeltas() void GameScriptObject::clearScriptVars() { - if (JavaLibrary::instance() == NULL || m_owner == NULL) + if (JavaLibrary::instance() == nullptr || m_owner == nullptr) return; JavaLibrary::clearScriptVars(*m_owner); @@ -1080,7 +1080,7 @@ void GameScriptObject::clearScriptVars() void GameScriptObject::packScriptVars(std::vector & target) const { - if (JavaLibrary::instance() == NULL || m_owner == NULL) + if (JavaLibrary::instance() == nullptr || m_owner == nullptr) return; JavaLibrary::packScriptVars(*m_owner, target); @@ -1090,7 +1090,7 @@ void GameScriptObject::packScriptVars(std::vector & target) const void GameScriptObject::unpackScriptVars(const std::vector & source) const { - if (JavaLibrary::instance() == NULL || m_owner == NULL) + if (JavaLibrary::instance() == nullptr || m_owner == nullptr) return; JavaLibrary::unpackScriptVars(*m_owner, source); @@ -1100,7 +1100,7 @@ void GameScriptObject::unpackScriptVars(const std::vector & source) const void GameScriptObject::unpackDeltaScriptVars(const std::vector & data) const { - if (JavaLibrary::instance() == NULL || m_owner == NULL) + if (JavaLibrary::instance() == nullptr || m_owner == nullptr) return; DEBUG_REPORT_LOG(! m_owner, ("A game script object received a request to unpack script var synchronization data, but it has no owner object!!! All GameScriptObjects MUST have owners!\n")); @@ -1238,18 +1238,18 @@ namespace Archive GameScriptObject * GameScriptObject::asGameScriptObject(Object * const object) { - ServerObject * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + ServerObject * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - return (serverObject != NULL) ? serverObject->getScriptObject() : NULL; + return (serverObject != nullptr) ? serverObject->getScriptObject() : nullptr; } // ---------------------------------------------------------------------- GameScriptObject const * GameScriptObject::asGameScriptObject(Object const * const object) { - ServerObject const * const serverObject = (object != NULL) ? object->asServerObject() : NULL; + ServerObject const * const serverObject = (object != nullptr) ? object->asServerObject() : nullptr; - return (serverObject != NULL) ? serverObject->getScriptObject() : NULL; + return (serverObject != nullptr) ? serverObject->getScriptObject() : nullptr; } // ====================================================================== diff --git a/engine/server/library/serverScript/src/shared/JNIWrappers.cpp b/engine/server/library/serverScript/src/shared/JNIWrappers.cpp index d4746415..d958183a 100755 --- a/engine/server/library/serverScript/src/shared/JNIWrappers.cpp +++ b/engine/server/library/serverScript/src/shared/JNIWrappers.cpp @@ -90,7 +90,7 @@ LocalRefPtr createNewObject(jclass clazz, jmethodID constructorID, ...) JavaStringPtr createNewString(const char * bytes) { - if (bytes != NULL) + if (bytes != nullptr) { JavaStringPtr result(new JavaString(JavaLibrary::getEnv()->NewStringUTF(bytes))); if (result->getValue() != 0) @@ -103,7 +103,7 @@ JavaStringPtr createNewString(const char * bytes) JavaStringPtr createNewString(const jchar * unicodeChars, jsize len) { - if (unicodeChars != NULL && len >= 0) + if (unicodeChars != nullptr && len >= 0) { JavaStringPtr result(new JavaString(JavaLibrary::getEnv()->NewString(unicodeChars, len))); if (result->getValue() != 0) @@ -902,7 +902,7 @@ LocalRef::LocalRef(jobject src) : LocalRef::~LocalRef() { - if (m_ref != 0 && JavaLibrary::getEnv() != NULL) + if (m_ref != 0 && JavaLibrary::getEnv() != nullptr) JavaLibrary::getEnv()->DeleteLocalRef(m_ref); m_ref = 0; } @@ -917,7 +917,7 @@ LocalArrayRef::LocalArrayRef(jarray src) : LocalArrayRef::~LocalArrayRef() { - if (m_ref != 0 && JavaLibrary::getEnv() != NULL) + if (m_ref != 0 && JavaLibrary::getEnv() != nullptr) JavaLibrary::getEnv()->DeleteLocalRef(m_ref); m_ref = 0; } @@ -932,7 +932,7 @@ LocalObjectArrayRef::LocalObjectArrayRef(jobjectArray src) : LocalObjectArrayRef::~LocalObjectArrayRef() { - if (m_ref != 0 && JavaLibrary::getEnv() != NULL) + if (m_ref != 0 && JavaLibrary::getEnv() != nullptr) JavaLibrary::getEnv()->DeleteLocalRef(m_ref); m_ref = 0; } @@ -1002,13 +1002,13 @@ LocalLongArrayRef::~LocalLongArrayRef() GlobalRef::GlobalRef(const LocalRefParam & src) : LocalRefParam(static_cast(0)) { - if (src.getValue() != 0 && JavaLibrary::getEnv() != NULL) + if (src.getValue() != 0 && JavaLibrary::getEnv() != nullptr) m_ref = JavaLibrary::getEnv()->NewGlobalRef(src.getValue()); } GlobalRef::~GlobalRef() { - if (m_ref != 0 && JavaLibrary::getEnv() != NULL) + if (m_ref != 0 && JavaLibrary::getEnv() != nullptr) JavaLibrary::getEnv()->DeleteGlobalRef(m_ref); m_ref = 0; } @@ -1019,13 +1019,13 @@ GlobalRef::~GlobalRef() GlobalArrayRef::GlobalArrayRef(const LocalObjectArrayRefParam & src) : LocalObjectArrayRefParam(static_cast(0)) { - if (src.getValue() != 0 && JavaLibrary::getEnv() != NULL) + if (src.getValue() != 0 && JavaLibrary::getEnv() != nullptr) m_ref = JavaLibrary::getEnv()->NewGlobalRef(src.getValue()); } GlobalArrayRef::~GlobalArrayRef() { - if (m_ref != 0 && JavaLibrary::getEnv() != NULL) + if (m_ref != 0 && JavaLibrary::getEnv() != nullptr) JavaLibrary::getEnv()->DeleteGlobalRef(m_ref); m_ref = 0; } @@ -1048,10 +1048,10 @@ JavaStringParam::~JavaStringParam() int JavaStringParam::fillBuffer(char * buffer, int size) const { - if (m_ref != 0 && buffer != NULL && JavaLibrary::getEnv() != NULL) + if (m_ref != 0 && buffer != nullptr && JavaLibrary::getEnv() != nullptr) { // Get the number of storage bytes required to convert this Java string into a UTF-8 string. - // Include the terminating null byte in the required buffer size. + // Include the terminating nullptr byte in the required buffer size. int requiredBufferSize = JavaLibrary::getEnv()->GetStringUTFLength(static_cast(m_ref)) + 1; if (requiredBufferSize <= size) { @@ -1059,7 +1059,7 @@ int JavaStringParam::fillBuffer(char * buffer, int size) const JavaLibrary::getEnv()->GetStringUTFRegion(static_cast(m_ref), 0, stringLength, buffer); - // Null terminate the string. requiredBufferSize already includes the byte count for the null terminator. + // Null terminate the string. requiredBufferSize already includes the byte count for the nullptr terminator. buffer[requiredBufferSize - 1] = '\0'; return requiredBufferSize; @@ -1077,7 +1077,7 @@ JavaString::JavaString(jstring src) : } JavaString::JavaString(const char * src) : - JavaStringParam(JavaLibrary::getEnv()->NewStringUTF(src != NULL ? src : "")) + JavaStringParam(JavaLibrary::getEnv()->NewStringUTF(src != nullptr ? src : "")) { } @@ -1093,7 +1093,7 @@ JavaString::JavaString(const Unicode::String & src) : JavaString::~JavaString() { - if (m_ref != 0 && JavaLibrary::getEnv() != NULL) + if (m_ref != 0 && JavaLibrary::getEnv() != nullptr) JavaLibrary::getEnv()->DeleteLocalRef(m_ref); m_ref = 0; } diff --git a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp index 5802a20d..750c1f40 100755 --- a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp +++ b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp @@ -83,7 +83,7 @@ using namespace JNIWrappersNamespace; #define GET_METHOD(var, clazz, name, sig) var = ms_env->GetMethodID(clazz, name, sig); if (ms_env->ExceptionCheck()) { ms_env->ExceptionDescribe(); WARNING(true, ("Unable to find Java method "#name" for class "#clazz)); return false; } #define GET_STATIC_METHOD(var, clazz, name, sig) var = ms_env->GetStaticMethodID(clazz, name, sig); if (ms_env->ExceptionCheck()) { ms_env->ExceptionDescribe(); WARNING(true, ("Unable to find Java static method "#name" for class "#clazz)); return false; } -#define FREE_CLASS(var) if (ms_env != NULL && var != NULL) { ms_env->DeleteGlobalRef(var); var = NULL; } +#define FREE_CLASS(var) if (ms_env != nullptr && var != nullptr) { ms_env->DeleteGlobalRef(var); var = nullptr; } //======================================================================== // local constants @@ -390,203 +390,203 @@ namespace ScriptMethodsWorldInfoNamespace // class JavaLibrary static members //======================================================================== -JavaLibrary* JavaLibrary::ms_instance = NULL; +JavaLibrary* JavaLibrary::ms_instance = nullptr; int JavaLibrary::ms_javaVmType = JV_none; -//void* JavaLibrary::ms_libHandle = NULL; -JavaVM* JavaLibrary::ms_jvm = NULL; -JNIEnv* JavaLibrary::ms_env = NULL; -Thread * JavaLibrary::m_initializerThread = NULL; +//void* JavaLibrary::ms_libHandle = nullptr; +JavaVM* JavaLibrary::ms_jvm = nullptr; +JNIEnv* JavaLibrary::ms_env = nullptr; +Thread * JavaLibrary::m_initializerThread = nullptr; int JavaLibrary::ms_envCount = 0; int JavaLibrary::ms_currentRecursionCount = 0; bool JavaLibrary::ms_resetJava = false; -jclass JavaLibrary::ms_clsScriptEntry = NULL; -jobject JavaLibrary::ms_scriptEntry = NULL; -jmethodID JavaLibrary::ms_midScriptEntryGetOwnerContext = NULL; -jmethodID JavaLibrary::ms_midScriptEntryEnableLogging = NULL; -jmethodID JavaLibrary::ms_midScriptEntryEnableNewJediTracking = NULL; -jmethodID JavaLibrary::ms_midScriptEntryGetFreeMem = NULL; -jclass JavaLibrary::ms_clsObject = NULL; -jclass JavaLibrary::ms_clsClass = NULL; -jmethodID JavaLibrary::ms_midClassGetName = NULL; -jmethodID JavaLibrary::ms_midClassGetMethods = NULL; -jclass JavaLibrary::ms_clsMethod = NULL; -jmethodID JavaLibrary::ms_midMethodGetName = NULL; -jclass JavaLibrary::ms_clsBoolean = NULL; -jclass JavaLibrary::ms_clsBooleanArray = NULL; -jmethodID JavaLibrary::ms_midBoolean = NULL; -jmethodID JavaLibrary::ms_midBooleanBooleanValue = NULL; -jclass JavaLibrary::ms_clsInteger = NULL; -jclass JavaLibrary::ms_clsIntegerArray = NULL; -jmethodID JavaLibrary::ms_midInteger = NULL; -jmethodID JavaLibrary::ms_midIntegerIntValue = NULL; -jclass JavaLibrary::ms_clsModifiableInt = NULL; -jmethodID JavaLibrary::ms_midModifiableInt = NULL; -jfieldID JavaLibrary::ms_fidModifiableIntData = NULL; -jclass JavaLibrary::ms_clsFloat = NULL; -jclass JavaLibrary::ms_clsFloatArray = NULL; -jmethodID JavaLibrary::ms_midFloat = NULL; -jmethodID JavaLibrary::ms_midFloatFloatValue = NULL; -jclass JavaLibrary::ms_clsModifiableFloat = NULL; -jmethodID JavaLibrary::ms_midModifiableFloat = NULL; -jfieldID JavaLibrary::ms_fidModifiableFloatData = NULL; -jclass JavaLibrary::ms_clsString = NULL; -jclass JavaLibrary::ms_clsStringArray = NULL; -jclass JavaLibrary::ms_clsMap = NULL; -jmethodID JavaLibrary::ms_midMapPut = NULL; -jmethodID JavaLibrary::ms_midMapGet = NULL; -jclass JavaLibrary::ms_clsHashtable = NULL; -jmethodID JavaLibrary::ms_midHashtable = NULL; -jclass JavaLibrary::ms_clsThrowable = NULL; -jclass JavaLibrary::ms_clsError = NULL; -jclass JavaLibrary::ms_clsStackOverflowError = NULL; -jmethodID JavaLibrary::ms_midThrowableGetMessage = NULL; -jclass JavaLibrary::ms_clsThread = NULL; -jmethodID JavaLibrary::ms_midThreadDumpStack = NULL; -jclass JavaLibrary::ms_clsInternalScriptError = NULL; -jclass JavaLibrary::ms_clsInternalScriptSeriousError = NULL; -jfieldID JavaLibrary::ms_fidInternalScriptSeriousErrorError = NULL; -jclass JavaLibrary::ms_clsDictionary = NULL; -jmethodID JavaLibrary::ms_midDictionary = NULL; -jmethodID JavaLibrary::ms_midDictionaryPack = NULL; -jmethodID JavaLibrary::ms_midDictionaryUnpack = NULL; -jmethodID JavaLibrary::ms_midDictionaryKeys = NULL; -jmethodID JavaLibrary::ms_midDictionaryValues = NULL; -jmethodID JavaLibrary::ms_midDictionaryPut = NULL; -jmethodID JavaLibrary::ms_midDictionaryPutInt = NULL; -jmethodID JavaLibrary::ms_midDictionaryPutFloat = NULL; -jmethodID JavaLibrary::ms_midDictionaryPutBool = NULL; -jmethodID JavaLibrary::ms_midDictionaryGet = NULL; -jclass JavaLibrary::ms_clsCollection = NULL; -jmethodID JavaLibrary::ms_midCollectionToArray = NULL; -jclass JavaLibrary::ms_clsEnumeration = NULL; -jmethodID JavaLibrary::ms_midEnumerationHasMoreElements = NULL; -jmethodID JavaLibrary::ms_midEnumerationNextElement = NULL; -jclass JavaLibrary::ms_clsBaseClassRangeInfo = NULL; -jfieldID JavaLibrary::ms_fidBaseClassRangeInfoMinRange = NULL; -jfieldID JavaLibrary::ms_fidBaseClassRangeInfoMaxRange = NULL; -jclass JavaLibrary::ms_clsBaseClassAttackerResults = NULL; -jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsId = NULL; -jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsWeapon = NULL; -jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsPosture = NULL; -jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsTrailBits = NULL; -jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsClientEffectId = NULL; -jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsActionName = NULL; -jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsUseLocation = NULL; -jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsTargetLocation = NULL; -jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsTargetCell = NULL; -jclass JavaLibrary::ms_clsBaseClassDefenderResults = NULL; -jfieldID JavaLibrary::ms_fidBaseClassDefenderResultsId = NULL; -jfieldID JavaLibrary::ms_fidBaseClassDefenderResultsPosture = NULL; -jfieldID JavaLibrary::ms_fidBaseClassDefenderResultsResult = NULL; -jfieldID JavaLibrary::ms_fidBaseClassDefenderResultsClientEffectId = NULL; -jfieldID JavaLibrary::ms_fidBaseClassDefenderResultsHitLocation = NULL; -jfieldID JavaLibrary::ms_fidBaseClassDefenderDamageAmount = NULL; -jclass JavaLibrary::ms_clsDynamicVariable = NULL; -jfieldID JavaLibrary::ms_fidDynamicVariableName = NULL; -jfieldID JavaLibrary::ms_fidDynamicVariableData = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableInt = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableIntArray = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableFloat = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableFloatArray = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableString = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableStringArray = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableObjId = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableObjIdArray = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableLocation = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableLocationArray = NULL; -jclass JavaLibrary::ms_clsDynamicVariableList = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableList = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSet = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSetInt = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSetIntArray = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSetFloat = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSetFloatArray = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSetString = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSetStringArray = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSetObjId = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSetObjIdArray = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSetLocation = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSetLocationArray = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSetStringId = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSetStringIdArray = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSetTransform = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSetTransformArray = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSetVector = NULL; -jmethodID JavaLibrary::ms_midDynamicVariableListSetVectorArray = NULL; -jclass JavaLibrary::ms_clsObjId = NULL; -jclass JavaLibrary::ms_clsObjIdArray = NULL; -jmethodID JavaLibrary::ms_midObjIdGetValue = NULL; -jmethodID JavaLibrary::ms_midObjIdGetObjId = NULL; -jmethodID JavaLibrary::ms_midObjIdClearObjId = NULL; -jmethodID JavaLibrary::ms_midObjIdFlagDestroyed = NULL; -jmethodID JavaLibrary::ms_midObjIdSetAuthoritative = NULL; -jmethodID JavaLibrary::ms_midObjIdSetLoaded = NULL; -jmethodID JavaLibrary::ms_midObjIdSetInitialized = NULL; -jmethodID JavaLibrary::ms_midObjIdSetLoggedIn = NULL; -jmethodID JavaLibrary::ms_midObjIdPackAllDeltaScriptVars = NULL; -jmethodID JavaLibrary::ms_midObjIdSetScriptVarInt = NULL; -jmethodID JavaLibrary::ms_midObjIdSetScriptVarFloat = NULL; -jmethodID JavaLibrary::ms_midObjIdSetScriptVarString = NULL; -jmethodID JavaLibrary::ms_midObjIdClearScriptVars = NULL; -jmethodID JavaLibrary::ms_midObjIdPackScriptVars = NULL; -jmethodID JavaLibrary::ms_midObjIdUnpackDeltaScriptVars = NULL; -jmethodID JavaLibrary::ms_midObjIdUnpackScriptVars = NULL; -jmethodID JavaLibrary::ms_midObjIdAttachScript = NULL; -jmethodID JavaLibrary::ms_midObjIdAttachScripts = NULL; -jmethodID JavaLibrary::ms_midObjIdDetachScript = NULL; -jmethodID JavaLibrary::ms_midObjIdDetachAllScripts = NULL; -jclass JavaLibrary::ms_clsStringId = NULL; -jmethodID JavaLibrary::ms_midStringId = NULL; -jclass JavaLibrary::ms_clsStringIdArray = NULL; -jfieldID JavaLibrary::ms_fidStringIdTable = NULL; -jfieldID JavaLibrary::ms_fidStringIdAsciiId = NULL; -jfieldID JavaLibrary::ms_fidStringIdIndexId = NULL; -jclass JavaLibrary::ms_clsModifiableStringId = NULL; -jclass JavaLibrary::ms_clsAttribute = NULL; -jmethodID JavaLibrary::ms_midAttribute = NULL; -jfieldID JavaLibrary::ms_fidAttributeType = NULL; -jfieldID JavaLibrary::ms_fidAttributeValue = NULL; -jclass JavaLibrary::ms_clsAttribMod = NULL; -jmethodID JavaLibrary::ms_midAttribMod = NULL; -jfieldID JavaLibrary::ms_fidAttribModName = NULL; -jfieldID JavaLibrary::ms_fidAttribModSkill = NULL; -jfieldID JavaLibrary::ms_fidAttribModType = NULL; -jfieldID JavaLibrary::ms_fidAttribModValue = NULL; -jfieldID JavaLibrary::ms_fidAttribModTime = NULL; -jfieldID JavaLibrary::ms_fidAttribModAttack = NULL; -jfieldID JavaLibrary::ms_fidAttribModDecay = NULL; -jfieldID JavaLibrary::ms_fidAttribModFlags = NULL; -jclass JavaLibrary::ms_clsMentalState = NULL; -jmethodID JavaLibrary::ms_midMentalState = NULL; -jfieldID JavaLibrary::ms_fidMentalStateType = NULL; -jfieldID JavaLibrary::ms_fidMentalStateValue = NULL; -jclass JavaLibrary::ms_clsMentalStateMod = NULL; -jmethodID JavaLibrary::ms_midMentalStateMod = NULL; -jfieldID JavaLibrary::ms_fidMentalStateModType = NULL; -jfieldID JavaLibrary::ms_fidMentalStateModValue = NULL; -jfieldID JavaLibrary::ms_fidMentalStateModTime = NULL; -jfieldID JavaLibrary::ms_fidMentalStateModAttack = NULL; -jfieldID JavaLibrary::ms_fidMentalStateModDecay = NULL; -jclass JavaLibrary::ms_clsLocation = NULL; -jclass JavaLibrary::ms_clsLocationArray = NULL; -jfieldID JavaLibrary::ms_fidLocationX = NULL; -jfieldID JavaLibrary::ms_fidLocationY = NULL; -jfieldID JavaLibrary::ms_fidLocationZ = NULL; -jfieldID JavaLibrary::ms_fidLocationArea = NULL; -jfieldID JavaLibrary::ms_fidLocationCell = NULL; -jmethodID JavaLibrary::ms_midRunOne = NULL; -jmethodID JavaLibrary::ms_midRunAll = NULL; -jmethodID JavaLibrary::ms_midCallMessages = NULL; -jmethodID JavaLibrary::ms_midRunConsoleHandler = NULL; -jmethodID JavaLibrary::ms_midUnload = NULL; -jmethodID JavaLibrary::ms_midGetClass = NULL; -jmethodID JavaLibrary::ms_midGetScriptFunctions = NULL; -jclass JavaLibrary::ms_clsMenuInfo = NULL; -jmethodID JavaLibrary::ms_midMenuInfo = NULL; -jmethodID JavaLibrary::ms_midMenuInfoSetMenuItemsInternal = NULL; -jmethodID JavaLibrary::ms_midMenuInfoGetMenuItemsInternal = NULL; -jclass JavaLibrary::ms_clsMenuInfoData = NULL; -jmethodID JavaLibrary::ms_midMenuInfoData = NULL; +jclass JavaLibrary::ms_clsScriptEntry = nullptr; +jobject JavaLibrary::ms_scriptEntry = nullptr; +jmethodID JavaLibrary::ms_midScriptEntryGetOwnerContext = nullptr; +jmethodID JavaLibrary::ms_midScriptEntryEnableLogging = nullptr; +jmethodID JavaLibrary::ms_midScriptEntryEnableNewJediTracking = nullptr; +jmethodID JavaLibrary::ms_midScriptEntryGetFreeMem = nullptr; +jclass JavaLibrary::ms_clsObject = nullptr; +jclass JavaLibrary::ms_clsClass = nullptr; +jmethodID JavaLibrary::ms_midClassGetName = nullptr; +jmethodID JavaLibrary::ms_midClassGetMethods = nullptr; +jclass JavaLibrary::ms_clsMethod = nullptr; +jmethodID JavaLibrary::ms_midMethodGetName = nullptr; +jclass JavaLibrary::ms_clsBoolean = nullptr; +jclass JavaLibrary::ms_clsBooleanArray = nullptr; +jmethodID JavaLibrary::ms_midBoolean = nullptr; +jmethodID JavaLibrary::ms_midBooleanBooleanValue = nullptr; +jclass JavaLibrary::ms_clsInteger = nullptr; +jclass JavaLibrary::ms_clsIntegerArray = nullptr; +jmethodID JavaLibrary::ms_midInteger = nullptr; +jmethodID JavaLibrary::ms_midIntegerIntValue = nullptr; +jclass JavaLibrary::ms_clsModifiableInt = nullptr; +jmethodID JavaLibrary::ms_midModifiableInt = nullptr; +jfieldID JavaLibrary::ms_fidModifiableIntData = nullptr; +jclass JavaLibrary::ms_clsFloat = nullptr; +jclass JavaLibrary::ms_clsFloatArray = nullptr; +jmethodID JavaLibrary::ms_midFloat = nullptr; +jmethodID JavaLibrary::ms_midFloatFloatValue = nullptr; +jclass JavaLibrary::ms_clsModifiableFloat = nullptr; +jmethodID JavaLibrary::ms_midModifiableFloat = nullptr; +jfieldID JavaLibrary::ms_fidModifiableFloatData = nullptr; +jclass JavaLibrary::ms_clsString = nullptr; +jclass JavaLibrary::ms_clsStringArray = nullptr; +jclass JavaLibrary::ms_clsMap = nullptr; +jmethodID JavaLibrary::ms_midMapPut = nullptr; +jmethodID JavaLibrary::ms_midMapGet = nullptr; +jclass JavaLibrary::ms_clsHashtable = nullptr; +jmethodID JavaLibrary::ms_midHashtable = nullptr; +jclass JavaLibrary::ms_clsThrowable = nullptr; +jclass JavaLibrary::ms_clsError = nullptr; +jclass JavaLibrary::ms_clsStackOverflowError = nullptr; +jmethodID JavaLibrary::ms_midThrowableGetMessage = nullptr; +jclass JavaLibrary::ms_clsThread = nullptr; +jmethodID JavaLibrary::ms_midThreadDumpStack = nullptr; +jclass JavaLibrary::ms_clsInternalScriptError = nullptr; +jclass JavaLibrary::ms_clsInternalScriptSeriousError = nullptr; +jfieldID JavaLibrary::ms_fidInternalScriptSeriousErrorError = nullptr; +jclass JavaLibrary::ms_clsDictionary = nullptr; +jmethodID JavaLibrary::ms_midDictionary = nullptr; +jmethodID JavaLibrary::ms_midDictionaryPack = nullptr; +jmethodID JavaLibrary::ms_midDictionaryUnpack = nullptr; +jmethodID JavaLibrary::ms_midDictionaryKeys = nullptr; +jmethodID JavaLibrary::ms_midDictionaryValues = nullptr; +jmethodID JavaLibrary::ms_midDictionaryPut = nullptr; +jmethodID JavaLibrary::ms_midDictionaryPutInt = nullptr; +jmethodID JavaLibrary::ms_midDictionaryPutFloat = nullptr; +jmethodID JavaLibrary::ms_midDictionaryPutBool = nullptr; +jmethodID JavaLibrary::ms_midDictionaryGet = nullptr; +jclass JavaLibrary::ms_clsCollection = nullptr; +jmethodID JavaLibrary::ms_midCollectionToArray = nullptr; +jclass JavaLibrary::ms_clsEnumeration = nullptr; +jmethodID JavaLibrary::ms_midEnumerationHasMoreElements = nullptr; +jmethodID JavaLibrary::ms_midEnumerationNextElement = nullptr; +jclass JavaLibrary::ms_clsBaseClassRangeInfo = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassRangeInfoMinRange = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassRangeInfoMaxRange = nullptr; +jclass JavaLibrary::ms_clsBaseClassAttackerResults = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsId = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsWeapon = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsPosture = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsTrailBits = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsClientEffectId = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsActionName = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsUseLocation = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsTargetLocation = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassAttackerResultsTargetCell = nullptr; +jclass JavaLibrary::ms_clsBaseClassDefenderResults = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassDefenderResultsId = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassDefenderResultsPosture = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassDefenderResultsResult = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassDefenderResultsClientEffectId = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassDefenderResultsHitLocation = nullptr; +jfieldID JavaLibrary::ms_fidBaseClassDefenderDamageAmount = nullptr; +jclass JavaLibrary::ms_clsDynamicVariable = nullptr; +jfieldID JavaLibrary::ms_fidDynamicVariableName = nullptr; +jfieldID JavaLibrary::ms_fidDynamicVariableData = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableInt = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableIntArray = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableFloat = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableFloatArray = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableString = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableStringArray = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableObjId = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableObjIdArray = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableLocation = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableLocationArray = nullptr; +jclass JavaLibrary::ms_clsDynamicVariableList = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableList = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSet = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSetInt = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSetIntArray = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSetFloat = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSetFloatArray = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSetString = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSetStringArray = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSetObjId = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSetObjIdArray = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSetLocation = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSetLocationArray = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSetStringId = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSetStringIdArray = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSetTransform = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSetTransformArray = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSetVector = nullptr; +jmethodID JavaLibrary::ms_midDynamicVariableListSetVectorArray = nullptr; +jclass JavaLibrary::ms_clsObjId = nullptr; +jclass JavaLibrary::ms_clsObjIdArray = nullptr; +jmethodID JavaLibrary::ms_midObjIdGetValue = nullptr; +jmethodID JavaLibrary::ms_midObjIdGetObjId = nullptr; +jmethodID JavaLibrary::ms_midObjIdClearObjId = nullptr; +jmethodID JavaLibrary::ms_midObjIdFlagDestroyed = nullptr; +jmethodID JavaLibrary::ms_midObjIdSetAuthoritative = nullptr; +jmethodID JavaLibrary::ms_midObjIdSetLoaded = nullptr; +jmethodID JavaLibrary::ms_midObjIdSetInitialized = nullptr; +jmethodID JavaLibrary::ms_midObjIdSetLoggedIn = nullptr; +jmethodID JavaLibrary::ms_midObjIdPackAllDeltaScriptVars = nullptr; +jmethodID JavaLibrary::ms_midObjIdSetScriptVarInt = nullptr; +jmethodID JavaLibrary::ms_midObjIdSetScriptVarFloat = nullptr; +jmethodID JavaLibrary::ms_midObjIdSetScriptVarString = nullptr; +jmethodID JavaLibrary::ms_midObjIdClearScriptVars = nullptr; +jmethodID JavaLibrary::ms_midObjIdPackScriptVars = nullptr; +jmethodID JavaLibrary::ms_midObjIdUnpackDeltaScriptVars = nullptr; +jmethodID JavaLibrary::ms_midObjIdUnpackScriptVars = nullptr; +jmethodID JavaLibrary::ms_midObjIdAttachScript = nullptr; +jmethodID JavaLibrary::ms_midObjIdAttachScripts = nullptr; +jmethodID JavaLibrary::ms_midObjIdDetachScript = nullptr; +jmethodID JavaLibrary::ms_midObjIdDetachAllScripts = nullptr; +jclass JavaLibrary::ms_clsStringId = nullptr; +jmethodID JavaLibrary::ms_midStringId = nullptr; +jclass JavaLibrary::ms_clsStringIdArray = nullptr; +jfieldID JavaLibrary::ms_fidStringIdTable = nullptr; +jfieldID JavaLibrary::ms_fidStringIdAsciiId = nullptr; +jfieldID JavaLibrary::ms_fidStringIdIndexId = nullptr; +jclass JavaLibrary::ms_clsModifiableStringId = nullptr; +jclass JavaLibrary::ms_clsAttribute = nullptr; +jmethodID JavaLibrary::ms_midAttribute = nullptr; +jfieldID JavaLibrary::ms_fidAttributeType = nullptr; +jfieldID JavaLibrary::ms_fidAttributeValue = nullptr; +jclass JavaLibrary::ms_clsAttribMod = nullptr; +jmethodID JavaLibrary::ms_midAttribMod = nullptr; +jfieldID JavaLibrary::ms_fidAttribModName = nullptr; +jfieldID JavaLibrary::ms_fidAttribModSkill = nullptr; +jfieldID JavaLibrary::ms_fidAttribModType = nullptr; +jfieldID JavaLibrary::ms_fidAttribModValue = nullptr; +jfieldID JavaLibrary::ms_fidAttribModTime = nullptr; +jfieldID JavaLibrary::ms_fidAttribModAttack = nullptr; +jfieldID JavaLibrary::ms_fidAttribModDecay = nullptr; +jfieldID JavaLibrary::ms_fidAttribModFlags = nullptr; +jclass JavaLibrary::ms_clsMentalState = nullptr; +jmethodID JavaLibrary::ms_midMentalState = nullptr; +jfieldID JavaLibrary::ms_fidMentalStateType = nullptr; +jfieldID JavaLibrary::ms_fidMentalStateValue = nullptr; +jclass JavaLibrary::ms_clsMentalStateMod = nullptr; +jmethodID JavaLibrary::ms_midMentalStateMod = nullptr; +jfieldID JavaLibrary::ms_fidMentalStateModType = nullptr; +jfieldID JavaLibrary::ms_fidMentalStateModValue = nullptr; +jfieldID JavaLibrary::ms_fidMentalStateModTime = nullptr; +jfieldID JavaLibrary::ms_fidMentalStateModAttack = nullptr; +jfieldID JavaLibrary::ms_fidMentalStateModDecay = nullptr; +jclass JavaLibrary::ms_clsLocation = nullptr; +jclass JavaLibrary::ms_clsLocationArray = nullptr; +jfieldID JavaLibrary::ms_fidLocationX = nullptr; +jfieldID JavaLibrary::ms_fidLocationY = nullptr; +jfieldID JavaLibrary::ms_fidLocationZ = nullptr; +jfieldID JavaLibrary::ms_fidLocationArea = nullptr; +jfieldID JavaLibrary::ms_fidLocationCell = nullptr; +jmethodID JavaLibrary::ms_midRunOne = nullptr; +jmethodID JavaLibrary::ms_midRunAll = nullptr; +jmethodID JavaLibrary::ms_midCallMessages = nullptr; +jmethodID JavaLibrary::ms_midRunConsoleHandler = nullptr; +jmethodID JavaLibrary::ms_midUnload = nullptr; +jmethodID JavaLibrary::ms_midGetClass = nullptr; +jmethodID JavaLibrary::ms_midGetScriptFunctions = nullptr; +jclass JavaLibrary::ms_clsMenuInfo = nullptr; +jmethodID JavaLibrary::ms_midMenuInfo = nullptr; +jmethodID JavaLibrary::ms_midMenuInfoSetMenuItemsInternal = nullptr; +jmethodID JavaLibrary::ms_midMenuInfoGetMenuItemsInternal = nullptr; +jclass JavaLibrary::ms_clsMenuInfoData = nullptr; +jmethodID JavaLibrary::ms_midMenuInfoData = nullptr; jfieldID JavaLibrary::ms_fidMenuInfoDataId; jfieldID JavaLibrary::ms_fidMenuInfoDataParent; jfieldID JavaLibrary::ms_fidMenuInfoDataType; @@ -601,82 +601,82 @@ jclass JavaLibrary::ms_clsPalcolorCustomVar; jmethodID JavaLibrary::ms_midPalcolorCustomVar; jclass JavaLibrary::ms_clsColor; jmethodID JavaLibrary::ms_midColor; -jclass JavaLibrary::ms_clsDraftSchematic = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicCategory = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicComplexity = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicSlots = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicAttribs = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicExperimentalAttribs = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicCustomizations = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicAttribMap = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicObjectTemplateCreated = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicScripts = NULL; -jclass JavaLibrary::ms_clsDraftSchematicSlot = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicSlotName = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicSlotOption = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicSlotIngredientType = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicSlotIngredientName = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicSlotIngredients = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicSlotComplexity = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicSlotAmountRequired = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicSlotAppearance = NULL; -jclass JavaLibrary::ms_clsDraftSchematicAttrib = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicAttribName = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicAttribMinValue = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicAttribMaxValue = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicAttribResourceMaxValue = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicAttribCurrentValue = NULL; -jclass JavaLibrary::ms_clsDraftSchematicSimpleIngredient = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicSimpleIngredientIngredient = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicSimpleIngredientCount = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicSimpleIngredientSource = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicSimpleIngredientXpType = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicSimpleIngredientXpAmount = NULL; -jclass JavaLibrary::ms_clsDraftSchematicCustom = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicCustomName = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicCustomValue = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicCustomMinValue = NULL; -jfieldID JavaLibrary::ms_fidDraftSchematicCustomMaxValue = NULL; -//jfieldID JavaLibrary::ms_fidDraftSchematicCustomLocked = NULL; -jclass JavaLibrary::ms_clsMapLocation = NULL; -jmethodID JavaLibrary::ms_midMapLocation = NULL; -jclass JavaLibrary::ms_clsRegion = NULL; -jmethodID JavaLibrary::ms_midRegion = NULL; -jfieldID JavaLibrary::ms_fidRegionName = NULL; -jfieldID JavaLibrary::ms_fidRegionPlanet = NULL; -jclass JavaLibrary::ms_clsCombatEngine = NULL; -jclass JavaLibrary::ms_clsCombatEngineCombatantData = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataPos = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataWorldPos = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataRadius = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataIsCreature = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataPosture = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataLocomotion = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataScriptMod = NULL; -jclass JavaLibrary::ms_clsCombatEngineAttackerData = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineAttackerDataWeaponSkill = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineAttackerDataAims = NULL; -jclass JavaLibrary::ms_clsCombatEngineDefenderData = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineDefenderDataCombatSkeleton = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineDefenderDataCover = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineDefenderDataHitLocationChances = NULL; -jclass JavaLibrary::ms_clsCombatEngineWeaponData = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataId = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataMinDamage = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataMaxDamage = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataWeaponType = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataAttackType = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataDamageType = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataElementalType = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataElementalValue = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataAttackSpeed = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataWoundChance = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataAccuracy = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataMinRange = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataMaxRange = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataDamageRadius = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataAttackCost = NULL; -jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataIsDisabled = NULL; +jclass JavaLibrary::ms_clsDraftSchematic = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicCategory = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicComplexity = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicSlots = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicAttribs = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicExperimentalAttribs = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicCustomizations = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicAttribMap = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicObjectTemplateCreated = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicScripts = nullptr; +jclass JavaLibrary::ms_clsDraftSchematicSlot = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicSlotName = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicSlotOption = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicSlotIngredientType = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicSlotIngredientName = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicSlotIngredients = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicSlotComplexity = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicSlotAmountRequired = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicSlotAppearance = nullptr; +jclass JavaLibrary::ms_clsDraftSchematicAttrib = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicAttribName = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicAttribMinValue = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicAttribMaxValue = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicAttribResourceMaxValue = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicAttribCurrentValue = nullptr; +jclass JavaLibrary::ms_clsDraftSchematicSimpleIngredient = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicSimpleIngredientIngredient = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicSimpleIngredientCount = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicSimpleIngredientSource = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicSimpleIngredientXpType = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicSimpleIngredientXpAmount = nullptr; +jclass JavaLibrary::ms_clsDraftSchematicCustom = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicCustomName = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicCustomValue = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicCustomMinValue = nullptr; +jfieldID JavaLibrary::ms_fidDraftSchematicCustomMaxValue = nullptr; +//jfieldID JavaLibrary::ms_fidDraftSchematicCustomLocked = nullptr; +jclass JavaLibrary::ms_clsMapLocation = nullptr; +jmethodID JavaLibrary::ms_midMapLocation = nullptr; +jclass JavaLibrary::ms_clsRegion = nullptr; +jmethodID JavaLibrary::ms_midRegion = nullptr; +jfieldID JavaLibrary::ms_fidRegionName = nullptr; +jfieldID JavaLibrary::ms_fidRegionPlanet = nullptr; +jclass JavaLibrary::ms_clsCombatEngine = nullptr; +jclass JavaLibrary::ms_clsCombatEngineCombatantData = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataPos = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataWorldPos = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataRadius = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataIsCreature = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataPosture = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataLocomotion = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineCombatantDataScriptMod = nullptr; +jclass JavaLibrary::ms_clsCombatEngineAttackerData = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineAttackerDataWeaponSkill = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineAttackerDataAims = nullptr; +jclass JavaLibrary::ms_clsCombatEngineDefenderData = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineDefenderDataCombatSkeleton = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineDefenderDataCover = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineDefenderDataHitLocationChances = nullptr; +jclass JavaLibrary::ms_clsCombatEngineWeaponData = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataId = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataMinDamage = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataMaxDamage = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataWeaponType = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataAttackType = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataDamageType = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataElementalType = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataElementalValue = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataAttackSpeed = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataWoundChance = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataAccuracy = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataMinRange = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataMaxRange = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataDamageRadius = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataAttackCost = nullptr; +jfieldID JavaLibrary::ms_fidCombatEngineWeaponDataIsDisabled = nullptr; jclass JavaLibrary::ms_clsCombatEngineHitResult; jfieldID JavaLibrary::ms_fidCombatEngineHitResultSuccess; jfieldID JavaLibrary::ms_fidCombatEngineHitResultCritical; @@ -706,40 +706,40 @@ jfieldID JavaLibrary::ms_fidCombatEngineHitResultCritDamage; jfieldID JavaLibrary::ms_fidCombatEngineHitResultBlockedDamage; jfieldID JavaLibrary::ms_fidCombatEngineHitResultBlockingArmor; jfieldID JavaLibrary::ms_fidCombatEngineHitResultBleedingChance; -jclass JavaLibrary::ms_clsTransform = NULL; -jclass JavaLibrary::ms_clsTransformArray = NULL; -jmethodID JavaLibrary::ms_midTransform = NULL; -jfieldID JavaLibrary::ms_fidTransformMatrix = NULL; -jclass JavaLibrary::ms_clsVector = NULL; -jclass JavaLibrary::ms_clsVectorArray = NULL; -jfieldID JavaLibrary::ms_fidVectorX = NULL; -jfieldID JavaLibrary::ms_fidVectorY = NULL; -jfieldID JavaLibrary::ms_fidVectorZ = NULL; -jclass JavaLibrary::ms_clsResourceDensity = NULL; -jfieldID JavaLibrary::ms_fidResourceDensityResourceType = NULL; -jfieldID JavaLibrary::ms_fidResourceDensityDensity = NULL; -jclass JavaLibrary::ms_clsResourceAttribute = NULL; -jfieldID JavaLibrary::ms_fidResourceAttributeName = NULL; -jfieldID JavaLibrary::ms_fidResourceAttributeValue = NULL; -jclass JavaLibrary::ms_clsLibrarySpaceTransition = NULL; -jmethodID JavaLibrary::ms_midLibrarySpaceTransitionSetPlayerOvert = NULL; -jmethodID JavaLibrary::ms_midLibrarySpaceTransitionClearOvertStatus = NULL; +jclass JavaLibrary::ms_clsTransform = nullptr; +jclass JavaLibrary::ms_clsTransformArray = nullptr; +jmethodID JavaLibrary::ms_midTransform = nullptr; +jfieldID JavaLibrary::ms_fidTransformMatrix = nullptr; +jclass JavaLibrary::ms_clsVector = nullptr; +jclass JavaLibrary::ms_clsVectorArray = nullptr; +jfieldID JavaLibrary::ms_fidVectorX = nullptr; +jfieldID JavaLibrary::ms_fidVectorY = nullptr; +jfieldID JavaLibrary::ms_fidVectorZ = nullptr; +jclass JavaLibrary::ms_clsResourceDensity = nullptr; +jfieldID JavaLibrary::ms_fidResourceDensityResourceType = nullptr; +jfieldID JavaLibrary::ms_fidResourceDensityDensity = nullptr; +jclass JavaLibrary::ms_clsResourceAttribute = nullptr; +jfieldID JavaLibrary::ms_fidResourceAttributeName = nullptr; +jfieldID JavaLibrary::ms_fidResourceAttributeValue = nullptr; +jclass JavaLibrary::ms_clsLibrarySpaceTransition = nullptr; +jmethodID JavaLibrary::ms_midLibrarySpaceTransitionSetPlayerOvert = nullptr; +jmethodID JavaLibrary::ms_midLibrarySpaceTransitionClearOvertStatus = nullptr; ////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// // CS handlers -jclass JavaLibrary::ms_clsLibraryDump = NULL; -jmethodID JavaLibrary::ms_midLibraryDumpDumpTargetInfo = NULL; +jclass JavaLibrary::ms_clsLibraryDump = nullptr; +jmethodID JavaLibrary::ms_midLibraryDumpDumpTargetInfo = nullptr; -jclass JavaLibrary::ms_clsLibraryGMLib = NULL; -jmethodID JavaLibrary::ms_midLibraryGMLibFreeze = NULL; -jmethodID JavaLibrary::ms_midLibraryGMLibUnfreeze = NULL; +jclass JavaLibrary::ms_clsLibraryGMLib = nullptr; +jmethodID JavaLibrary::ms_midLibraryGMLibFreeze = nullptr; +jmethodID JavaLibrary::ms_midLibraryGMLibUnfreeze = nullptr; ////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// int JavaLibrary::ms_loaded = 0; -Semaphore * JavaLibrary::ms_shutdownJava = NULL; +Semaphore * JavaLibrary::ms_shutdownJava = nullptr; int JavaLibrary::GlobalInstances::ms_stringIdIndex = 0; int JavaLibrary::GlobalInstances::ms_attribModIndex = 0; @@ -778,7 +778,7 @@ void JavaLibrary::throwScriptException(char const * const format, ...) void JavaLibrary::throwScriptException(char const * const format, va_list va) { - DEBUG_FATAL(!ms_env, ("JavaLibrary::throwScriptException: ms_env is NULL")); + DEBUG_FATAL(!ms_env, ("JavaLibrary::throwScriptException: ms_env is nullptr")); if (ms_env) { char buffer[1024]; @@ -818,28 +818,28 @@ void JavaLibrary::fatalHandler(int signum) // it turns out that in some java crashes we don't even have 2 return // addresses, so check 0 and 1 just to make sure bool result2 = false; - void *crashAddress2a = NULL; - void *crashAddress2b = NULL; - void *crashAddress2c = NULL; - void *frameAddressA = NULL; - void *frameAddressB = NULL; + void *crashAddress2a = nullptr; + void *crashAddress2b = nullptr; + void *crashAddress2c = nullptr; + void *frameAddressA = nullptr; + void *frameAddressB = nullptr; uint32 frameAddressHigh = (reinterpret_cast(frameAddress) >> 16); crashAddress2a = __builtin_return_address(0); - if (crashAddress2a != NULL) + if (crashAddress2a != nullptr) { frameAddressA = __builtin_frame_address(1); - if (frameAddressA != NULL && + if (frameAddressA != nullptr && (reinterpret_cast(frameAddressA) >> 16 == frameAddressHigh)) { crashAddress2b = __builtin_return_address(1); - if (crashAddress2b != NULL) + if (crashAddress2b != nullptr) { frameAddressB = __builtin_frame_address(2); - if (frameAddressB != NULL && + if (frameAddressB != nullptr && (reinterpret_cast(frameAddressB) >> 16 == frameAddressHigh)) { crashAddress2c = __builtin_return_address(2); - if (crashAddress2c != NULL) + if (crashAddress2c != nullptr) { result2 = DebugHelp::lookupAddress(reinterpret_cast( crashAddress2c), lib2, file2, BUFLEN, line2); @@ -850,7 +850,7 @@ void JavaLibrary::fatalHandler(int signum) } bool javaCrash = true; - if ((result1 || result2) && strstr(lib1, "libjvm.so") == NULL && strstr(lib2, "libjvm.so") == NULL) + if ((result1 || result2) && strstr(lib1, "libjvm.so") == nullptr && strstr(lib2, "libjvm.so") == nullptr) { if (result1 && result2) { @@ -873,7 +873,7 @@ void JavaLibrary::fatalHandler(int signum) if (javaCrash) { fprintf(stderr, "I think I crashed in Java, calling the Java segfault hanlder.\n"); - IGNORE_RETURN(sigaction(SIGSEGV, &JavaSa, NULL)); + IGNORE_RETURN(sigaction(SIGSEGV, &JavaSa, nullptr)); IGNORE_RETURN(pthread_kill(pthread_self(), SIGSEGV)); } else @@ -881,11 +881,11 @@ void JavaLibrary::fatalHandler(int signum) // destroy Java threads // @note apathy - this pthread method is not in later versions of glibc //pthread_kill_other_threads_np(); - ms_instance = NULL; - ms_env = NULL; - ms_jvm = NULL; + ms_instance = nullptr; + ms_env = nullptr; + ms_jvm = nullptr; // restore original signal handler and rethrow signal - IGNORE_RETURN(sigaction(SIGSEGV, &OrgSa, NULL)); + IGNORE_RETURN(sigaction(SIGSEGV, &OrgSa, nullptr)); IGNORE_RETURN(pthread_kill(pthread_self(), SIGSEGV)); } } @@ -901,7 +901,7 @@ JavaLibrary::JavaLibrary(void) { int i; - if (ms_instance != NULL || ms_loaded != 0) + if (ms_instance != nullptr || ms_loaded != 0) return; ms_shutdownJava = new Semaphore(); @@ -951,7 +951,7 @@ JavaLibrary::~JavaLibrary() { disconnectFromJava(); - if (ms_shutdownJava != NULL) + if (ms_shutdownJava != nullptr) { // tell the initialize thread to shut down if (ms_loaded > 0) @@ -961,10 +961,10 @@ JavaLibrary::~JavaLibrary() Os::sleep(100); } delete ms_shutdownJava; - ms_shutdownJava = NULL; + ms_shutdownJava = nullptr; } - ms_instance = NULL; + ms_instance = nullptr; } // JavaLibrary::~JavaLibrary //---------------------------------------------------------------------- @@ -974,12 +974,12 @@ JavaLibrary::~JavaLibrary() */ void JavaLibrary::install(void) { - if (ms_instance == NULL) + if (ms_instance == nullptr) { JavaLibrary *lib = new JavaLibrary; if (lib != ms_instance) { - if (ms_instance == NULL) + if (ms_instance == nullptr) { delete lib; if (ms_javaVmType != JV_none) @@ -998,10 +998,10 @@ void JavaLibrary::install(void) */ void JavaLibrary::remove(void) { - if (ms_instance != NULL) + if (ms_instance != nullptr) { JavaLibrary * temp = ms_instance; - ms_instance = NULL; + ms_instance = nullptr; delete temp; s_profileSections.clear(); } @@ -1023,7 +1023,7 @@ void JavaLibrary::initializeJavaThread() } const char *javaVMName = ConfigServerGame::getJavaVMName(); - if (javaVMName == NULL || ( + if (javaVMName == nullptr || ( strcmp(javaVMName, "none") != 0 && strcmp(javaVMName, "ibm") != 0 && strcmp(javaVMName, "sun") != 0)) @@ -1050,21 +1050,21 @@ void JavaLibrary::initializeJavaThread() #ifdef linux // get the default signal handler - IGNORE_RETURN(sigaction(SIGSEGV, NULL, &OrgSa)); + IGNORE_RETURN(sigaction(SIGSEGV, nullptr, &OrgSa)); if (ms_javaVmType == JV_ibm) { // check PATH to make sure that it has /usr/bin/java const char * env = getenv("PATH"); - const char * bin = NULL; + const char * bin = nullptr; int envlen = 0; - if (env != NULL) + if (env != nullptr) { bin = strstr(env, "/usr/java/bin"); envlen = strlen(env); } - if (bin == NULL) + if (bin == nullptr) { WARNING(true, ("/usr/java/bin not found in PATH which is needed for IBM Java VM. Adding it now")); char * tmpbuffer = new char[envlen + 128]; @@ -1077,18 +1077,18 @@ void JavaLibrary::initializeJavaThread() // check LD_LIBRARY_PATH for /usr/java/jre/bin and /usr/java/jre/bin/classic env = getenv("LD_LIBRARY_PATH"); - bin = NULL; + bin = nullptr; envlen = 0; - const char * classic = NULL; - if (env != NULL) + const char * classic = nullptr; + if (env != nullptr) { bin = strstr(env, "/usr/java/jre/bin"); classic = strstr(env, "/usr/java/jre/bin/classic"); - if (bin == classic && bin != NULL) + if (bin == classic && bin != nullptr) bin = strstr(classic + 1, "/usr/java/jre/bin"); envlen = strlen(env); } - if (bin == NULL || classic == NULL) + if (bin == nullptr || classic == nullptr) { WARNING(true, ("/usr/java/jre/bin or /usr/java/jre/bin/classic not found " "in LD_LIBRARY_PATH, needed for IBM Java VM. Adding them both now.")); @@ -1105,12 +1105,12 @@ void JavaLibrary::initializeJavaThread() #endif // linux // dynamically load the jni dll and JNI_CreateJavaVM - void * libHandle = NULL; + void * libHandle = nullptr; JNI_CREATEJAVAVMPROC JNI_CreateJavaVMProc; #if defined(WIN32) std::string dllPath = ConfigServerGame::getJavaLibPath(); HINSTANCE hVm = LoadLibrary(dllPath.c_str()); - if (hVm == NULL) + if (hVm == nullptr) { FATAL(true, ("jvm open fail error: could not open %s", dllPath.c_str())); ms_loaded = -1; @@ -1120,10 +1120,10 @@ void JavaLibrary::initializeJavaThread() JNI_CreateJavaVMProc = (JNI_CREATEJAVAVMPROC)GetProcAddress(hVm, "JNI_CreateJavaVM"); //lint !e1924 C-style cast #else - void *libVM = NULL; + void *libVM = nullptr; std::string dllPath = ConfigServerGame::getJavaLibPath(); libVM = dlopen(dllPath.c_str(), RTLD_LAZY); - if (libVM == NULL) + if (libVM == nullptr) { FATAL(true, ("jvm open fail! error: %s", dlerror())); ms_loaded = -1; @@ -1133,7 +1133,7 @@ void JavaLibrary::initializeJavaThread() JNI_CreateJavaVMProc = (JNI_CREATEJAVAVMPROC)dlsym(libVM, "JNI_CreateJavaVM"); #endif - if (JNI_CreateJavaVMProc == NULL) + if (JNI_CreateJavaVMProc == nullptr) { FATAL(true, ("Error getting JNI_CreateJavaVM from jvm shared library")); ms_loaded = -1; @@ -1152,9 +1152,9 @@ void JavaLibrary::initializeJavaThread() // DEBUG_REPORT_LOG(true, ("Java class path = %s\n", classPath.c_str())); JavaVMInitArgs vm_args; - JavaVMOption tempOption = {NULL, NULL}; + JavaVMOption tempOption = {nullptr, nullptr}; std::vector options; - char *jdwpBuffer = NULL; + char *jdwpBuffer = nullptr; UNREF(jdwpBuffer); @@ -1241,7 +1241,7 @@ void JavaLibrary::initializeJavaThread() #endif #ifdef REMOTE_DEBUG_ON - char *jdwpBuffer = NULL; + char *jdwpBuffer = nullptr; if (ConfigServerGame::getUseRemoteDebugJava()) { if (ms_javaVmType == JV_ibm) @@ -1298,14 +1298,14 @@ void JavaLibrary::initializeJavaThread() vm_args.ignoreUnrecognized = JNI_FALSE; // create the JVM - JNIEnv * env = NULL; + JNIEnv * env = nullptr; jint result = (*JNI_CreateJavaVMProc)(&ms_jvm, reinterpret_cast(&env), &vm_args); #ifdef REMOTE_DEBUG_ON - if (jdwpBuffer != NULL) + if (jdwpBuffer != nullptr) { delete[] jdwpBuffer; - jdwpBuffer = NULL; + jdwpBuffer = nullptr; } #endif @@ -1333,7 +1333,7 @@ void JavaLibrary::initializeJavaThread() // clean up IGNORE_RETURN(ms_jvm->DestroyJavaVM()); - ms_jvm = NULL; + ms_jvm = nullptr; #ifdef linux if (ConfigServerGame::getTrapScriptCrashes()) @@ -1367,7 +1367,7 @@ bool JavaLibrary::connectToJava() return false; // attach our thread to the VM - jint result = ms_jvm->AttachCurrentThread(reinterpret_cast(&ms_env), NULL); + jint result = ms_jvm->AttachCurrentThread(reinterpret_cast(&ms_env), nullptr); if (result != 0) { FATAL(true, ("Failed to attach to the Java VM! Error code returned = %d", result)); @@ -1938,7 +1938,7 @@ bool JavaLibrary::connectToJava() for (i = 0; i < MAX_STRING_ID_PARAMS; ++i) { - localInstance = createNewObject(ms_clsStringId, ms_midStringId, NULL, -1); + localInstance = createNewObject(ms_clsStringId, ms_midStringId, nullptr, -1); if (ms_env->ExceptionCheck()) { ms_env->ExceptionDescribe(); @@ -1956,7 +1956,7 @@ bool JavaLibrary::connectToJava() for (i = 0; i < MAX_MODIFIABLE_STRING_ID_PARAMS; ++i) { localInstance = createNewObject(ms_clsModifiableStringId, constructor, - NULL, -1); + nullptr, -1); if (ms_env->ExceptionCheck()) { ms_env->ExceptionDescribe(); @@ -2111,7 +2111,7 @@ bool JavaLibrary::registerNatives(const JNINativeMethod natives[], int count) { if (!natives[i].signature) { - DEBUG_REPORT_LOG(true, ("RegisterNatives failed: %s - NULL signature\n", natives[i].name)); + DEBUG_REPORT_LOG(true, ("RegisterNatives failed: %s - nullptr signature\n", natives[i].name)); result = 1; continue; } @@ -2219,11 +2219,11 @@ int i; FREE_CLASS(ms_clsLibraryDump); FREE_CLASS(ms_clsLibraryGMLib); - if (ms_scriptEntry != NULL) + if (ms_scriptEntry != nullptr) { if (ms_env) ms_env->DeleteGlobalRef(ms_scriptEntry); - ms_scriptEntry = NULL; + ms_scriptEntry = nullptr; } for (i = 0; i < MAX_RECURSION_COUNT; ++i) @@ -2246,7 +2246,7 @@ int i; GlobalInstances::ms_menuInfo = GlobalRef::cms_nullPtr; IGNORE_RETURN(ms_jvm->DetachCurrentThread()); - ms_env = NULL; + ms_env = nullptr; } // JavaLibrary::disconnectFromJava //---------------------------------------------------------------------- @@ -2283,7 +2283,7 @@ void JavaLibrary::resetJavaConnection() */ bool JavaLibrary::queryScriptFunctions(const std::string & scriptName) { - if (ms_instance == NULL) + if (ms_instance == nullptr) return false; JavaString scriptClassName(("script." + scriptName).c_str()); @@ -2337,7 +2337,7 @@ bool JavaLibrary::queryScriptFunctions(const std::string & scriptName) */ jlong JavaLibrary::getFreeJavaMemory() { - if (ms_instance == NULL || ms_env == NULL) + if (ms_instance == nullptr || ms_env == nullptr) return 0; return ms_env->CallStaticLongMethod(ms_clsScriptEntry, ms_midScriptEntryGetFreeMem); @@ -2358,7 +2358,7 @@ void JavaLibrary::printJavaStack() */ void JavaLibrary::enableLogging(bool enable) const { - if (ms_instance == NULL || ms_env == NULL) + if (ms_instance == nullptr || ms_env == nullptr) return; ms_env->CallStaticVoidMethod(ms_clsScriptEntry, @@ -2372,7 +2372,7 @@ void JavaLibrary::enableLogging(bool enable) const */ void JavaLibrary::enableNewJediTracking(bool enableTracking) { - if (ms_instance == NULL || ms_env == NULL) + if (ms_instance == nullptr || ms_env == nullptr) return; ms_env->CallStaticVoidMethod(ms_clsScriptEntry, @@ -2412,7 +2412,7 @@ LocalRefPtr JavaLibrary::getObjId(const NetworkId::NetworkIdType & id) */ LocalRefPtr JavaLibrary::getObjId(const NetworkId & id) { - if (ms_env != NULL && ms_instance != NULL) + if (ms_env != nullptr && ms_instance != nullptr) return callStaticObjectMethod(ms_clsObjId, ms_midObjIdGetObjId, id.getValue()); return LocalRef::cms_nullPtr; } // JavaLibrary::getObjId(const CachedNetworkId &) @@ -2501,7 +2501,7 @@ LocalRefPtr JavaLibrary::getVector(Vector const & vector) */ void JavaLibrary::removeJavaId(const NetworkId & id) { - if (ms_env == NULL || ms_clsObjId == NULL || ms_midObjIdClearObjId == NULL) + if (ms_env == nullptr || ms_clsObjId == nullptr || ms_midObjIdClearObjId == nullptr) { return; } @@ -2519,7 +2519,7 @@ void JavaLibrary::removeJavaId(const NetworkId & id) */ void JavaLibrary::flagDestroyed(const NetworkId & id) { - if (ms_env == NULL || ms_clsObjId == NULL || ms_midObjIdFlagDestroyed == NULL) + if (ms_env == nullptr || ms_clsObjId == nullptr || ms_midObjIdFlagDestroyed == nullptr) { return; } @@ -2538,7 +2538,7 @@ void JavaLibrary::flagDestroyed(const NetworkId & id) */ void JavaLibrary::setObjIdAuthoritative(const NetworkId & object, bool authoritative, uint32 pid) { - if (ms_env == NULL || ms_midObjIdSetAuthoritative == NULL) + if (ms_env == nullptr || ms_midObjIdSetAuthoritative == nullptr) { return; } @@ -2561,7 +2561,7 @@ void JavaLibrary::setObjIdAuthoritative(const NetworkId & object, bool authorita */ void JavaLibrary::setObjIdLoaded(const NetworkId &object) { - if (ms_env == NULL || ms_midObjIdSetLoaded == NULL) + if (ms_env == nullptr || ms_midObjIdSetLoaded == nullptr) { return; } @@ -2583,7 +2583,7 @@ void JavaLibrary::setObjIdLoaded(const NetworkId &object) */ void JavaLibrary::setObjIdInitialized(const NetworkId &object) { - if (ms_env == NULL || ms_midObjIdSetInitialized == NULL) + if (ms_env == nullptr || ms_midObjIdSetInitialized == nullptr) { return; } @@ -2605,7 +2605,7 @@ void JavaLibrary::setObjIdInitialized(const NetworkId &object) */ void JavaLibrary::setObjIdLoggedIn(const NetworkId & object, bool loggedIn) { - if (ms_env == NULL || ms_midObjIdSetLoggedIn == NULL) + if (ms_env == nullptr || ms_midObjIdSetLoggedIn == nullptr) { return; } @@ -2628,7 +2628,7 @@ void JavaLibrary::setObjIdLoggedIn(const NetworkId & object, bool loggedIn) void JavaLibrary::attachScriptToObjId(const NetworkId &object, const std::string & script) { - if (ms_env != NULL) + if (ms_env != nullptr) { LocalRefPtr obj_id = getObjId(object); if (obj_id == LocalRef::cms_nullPtr) @@ -2649,7 +2649,7 @@ void JavaLibrary::attachScriptToObjId(const NetworkId &object, void JavaLibrary::attachScriptsToObjId(const NetworkId &object, const ScriptList & scripts) { - if (scripts.size() == 0 || ms_env == NULL) + if (scripts.size() == 0 || ms_env == nullptr) return; LocalRefPtr obj_id = getObjId(object); @@ -2695,7 +2695,7 @@ void JavaLibrary::attachScriptsToObjId(const NetworkId &object, void JavaLibrary::detachScriptFromObjId(const NetworkId &object, const std::string & script) { - if (ms_env != NULL) + if (ms_env != nullptr) { LocalRefPtr obj_id = getObjId(object); if (obj_id == LocalRef::cms_nullPtr) @@ -2714,7 +2714,7 @@ void JavaLibrary::detachScriptFromObjId(const NetworkId &object, */ void JavaLibrary::detachAllScriptsFromObjId(const NetworkId &object) { - if (ms_env != NULL) + if (ms_env != nullptr) { LocalRefPtr obj_id = getObjId(object); if (obj_id == LocalRef::cms_nullPtr) @@ -2777,7 +2777,7 @@ jint JavaLibrary::handleScriptEntryCleanup(jint result) if (ConfigServerGame::getTrapScriptCrashes()) { // the script threw an error or exception, restore our segfault handler - IGNORE_RETURN(sigaction(SIGSEGV, &OurSa, NULL)); + IGNORE_RETURN(sigaction(SIGSEGV, &OurSa, nullptr)); } #endif } @@ -2797,20 +2797,20 @@ jint JavaLibrary::handleScriptEntryCleanup(jint result) jint JavaLibrary::callScriptEntry(const JavaStringParam & script, const JavaStringParam & method, jobjectArray params) { - if (ms_env == NULL || ms_clsScriptEntry == NULL || ms_midRunOne == NULL) + if (ms_env == nullptr || ms_clsScriptEntry == nullptr || ms_midRunOne == nullptr) { - LOG("ScriptInvestigation", ("callScriptEntry failed because something was null")); + LOG("ScriptInvestigation", ("callScriptEntry failed because something was nullptr")); if (!ms_env) { - LOG("ScriptInvestigation", ("callScriptEntry failed because ms_env was null")); + LOG("ScriptInvestigation", ("callScriptEntry failed because ms_env was nullptr")); } if (!ms_clsScriptEntry) { - LOG("ScriptInvestigation", ("callScriptEntry failed because scriptEntry was null")); + LOG("ScriptInvestigation", ("callScriptEntry failed because scriptEntry was nullptr")); } if (!ms_midRunOne) { - LOG("ScriptInvestigation", ("callScriptEntry failed because runOne was null")); + LOG("ScriptInvestigation", ("callScriptEntry failed because runOne was nullptr")); } return SCRIPT_OVERRIDE; @@ -2848,20 +2848,20 @@ jint JavaLibrary::callScriptEntry(const JavaStringParam & script, */ jint JavaLibrary::callScriptEntry(const JavaStringParam & method, jobjectArray params) { - if (ms_env == NULL || ms_clsScriptEntry == NULL || ms_midRunAll == NULL) + if (ms_env == nullptr || ms_clsScriptEntry == nullptr || ms_midRunAll == nullptr) { - LOG("ScriptInvestigation", ("callScriptEntry2 failed because something was null")); + LOG("ScriptInvestigation", ("callScriptEntry2 failed because something was nullptr")); if (!ms_env) { - LOG("ScriptInvestigation", ("callScriptEntry2 failed because ms_env was null")); + LOG("ScriptInvestigation", ("callScriptEntry2 failed because ms_env was nullptr")); } if (!ms_clsScriptEntry) { - LOG("ScriptInvestigation", ("callScriptEntry2 failed because scriptEntry was null")); + LOG("ScriptInvestigation", ("callScriptEntry2 failed because scriptEntry was nullptr")); } if (!ms_midRunOne) { - LOG("ScriptInvestigation", ("callScriptEntry2 failed because runOne was null")); + LOG("ScriptInvestigation", ("callScriptEntry2 failed because runOne was nullptr")); } return SCRIPT_OVERRIDE; } @@ -2897,20 +2897,20 @@ jint JavaLibrary::callScriptEntry(const JavaStringParam & method, jobjectArray p */ jstring JavaLibrary::callScriptConsoleHandlerEntry(const JavaStringParam & script, const JavaStringParam & method, jobjectArray params) { - if (ms_env == NULL || ms_clsScriptEntry == NULL || ms_midRunConsoleHandler == NULL) + if (ms_env == nullptr || ms_clsScriptEntry == nullptr || ms_midRunConsoleHandler == nullptr) { - LOG("ScriptInvestigation", ("callScriptConsoleHandlerEntry failed because something was null")); + LOG("ScriptInvestigation", ("callScriptConsoleHandlerEntry failed because something was nullptr")); if (!ms_env) { - LOG("ScriptInvestigation", ("callScriptConsoleHandlerEntry failed because ms_env was null")); + LOG("ScriptInvestigation", ("callScriptConsoleHandlerEntry failed because ms_env was nullptr")); } if (!ms_clsScriptEntry) { - LOG("ScriptInvestigation", ("callScriptConsoleHandlerEntry failed because scriptEntry was null")); + LOG("ScriptInvestigation", ("callScriptConsoleHandlerEntry failed because scriptEntry was nullptr")); } if (!ms_midRunConsoleHandler) { - LOG("ScriptInvestigation", ("callScriptConsoleHandlerEntry failed because runConsoleHandler was null")); + LOG("ScriptInvestigation", ("callScriptConsoleHandlerEntry failed because runConsoleHandler was nullptr")); } return 0; @@ -2949,7 +2949,7 @@ void JavaLibrary::convert(const ScriptParams & params, JavaDictionaryPtr & dicti { dictionary.reset(); - if (ms_env == NULL) + if (ms_env == nullptr) return; // create the dictionary @@ -3143,7 +3143,7 @@ void JavaLibrary::convert(const ScriptParams & params, JavaDictionaryPtr & dicti for (int j = 0; j < count; ++j) { const std::vector * inner = objIds[j]; - if (inner != NULL) + if (inner != nullptr) { LocalObjectArrayRefPtr innerArray = createNewObjectArray(inner->size(), ms_clsObjId); if (innerArray != LocalObjectArrayRef::cms_nullPtr) @@ -3246,7 +3246,7 @@ void JavaLibrary::convert(const ScriptParams & params, JavaDictionaryPtr & dicti */ LocalObjectArrayRefPtr JavaLibrary::convert(const NetworkId & self, const std::string& argList, const ScriptParams &args) { - if (ms_env == NULL) + if (ms_env == nullptr) return LocalObjectArrayRef::cms_nullPtr; // convert the params to jobjects @@ -3283,7 +3283,7 @@ LocalObjectArrayRefPtr JavaLibrary::convert(const NetworkId & self, const std::s */ LocalObjectArrayRefPtr JavaLibrary::convert(const std::string& argList, const ScriptParams &args) { - if (ms_env == NULL) + if (ms_env == nullptr) return LocalObjectArrayRef::cms_nullPtr; // convert the params to jobjects @@ -3312,7 +3312,7 @@ LocalObjectArrayRefPtr JavaLibrary::convert(const std::string& argList, const Sc */ bool JavaLibrary::convert(LocalObjectArrayRefPtr & javaParams, int startIndex, const std::string& argList, const ScriptParams &args) { - if (ms_env == NULL) + if (ms_env == nullptr) return 0; GlobalInstances globals; @@ -3547,7 +3547,7 @@ bool JavaLibrary::convert(LocalObjectArrayRefPtr & javaParams, int startIndex, c for (i = 0, iter = strings.begin(); iter != strings.end(); ++i, ++iter) { - if (*iter != NULL) + if (*iter != nullptr) { JavaString newString(**iter); setObjectArrayElement(*localInstance, i, newString); @@ -3778,7 +3778,7 @@ bool JavaLibrary::convert(LocalObjectArrayRefPtr & javaParams, int startIndex, c ++paramCount; } } - // fill in the rest of ms_attribModList with null + // fill in the rest of ms_attribModList with nullptr for (; paramCount < MAX_ATTRIB_MOD_PARAMS; ++paramCount) { setObjectArrayElement(*ms_attribModList[ms_currentRecursionCount], static_cast(paramCount), *LocalRefParam::cms_nullPtr); @@ -3857,7 +3857,7 @@ bool JavaLibrary::convert(LocalObjectArrayRefPtr & javaParams, int startIndex, c ++paramCount; } } - // fill in the rest of ms_mentalStateModList with null + // fill in the rest of ms_mentalStateModList with nullptr for (; paramCount < MAX_MENTAL_STATE_MOD_PARAMS; ++paramCount) { setObjectArrayElement( @@ -3943,7 +3943,7 @@ bool JavaLibrary::convert(LocalObjectArrayRefPtr & javaParams, int startIndex, c static_cast(argType))); //lint !e571 suspicious cast return 0; } - if (arg.get() == NULL || arg == LocalRef::cms_nullPtr) + if (arg.get() == nullptr || arg == LocalRef::cms_nullPtr) { DEBUG_REPORT_LOG(true, ("bad parameter, %c%s%d%s\n", argType, modifiable ? "*" : "", @@ -3978,7 +3978,7 @@ bool JavaLibrary::convert(LocalObjectArrayRefPtr & javaParams, int startIndex, c void JavaLibrary::alterScriptParams(jobjectArray jparams, const std::string& argList, ScriptParams &args) { - if (ms_env == NULL) + if (ms_env == nullptr) return; PROFILER_AUTO_BLOCK_CHECK_DEFINE("JavaLibrary::alterScriptParams"); @@ -4014,7 +4014,7 @@ void JavaLibrary::alterScriptParams(jobjectArray jparams, const std::string& arg { int count = getArrayLength(*arg); std::vector * values = new std::vector(count, 0); - jint * jvalues = static_cast(ms_env->GetPrimitiveArrayCritical(static_cast(arg->getValue()), NULL)); + jint * jvalues = static_cast(ms_env->GetPrimitiveArrayCritical(static_cast(arg->getValue()), nullptr)); for (int j = 0; j < count; ++j) { values->at(j) = static_cast(jvalues[j]); @@ -4046,7 +4046,7 @@ void JavaLibrary::alterScriptParams(jobjectArray jparams, const std::string& arg { int count = getArrayLength(*arg); std::vector * values = new std::vector(count, 0); - jbyte * jvalues = static_cast(ms_env->GetPrimitiveArrayCritical(static_cast(arg->getValue()), NULL)); + jbyte * jvalues = static_cast(ms_env->GetPrimitiveArrayCritical(static_cast(arg->getValue()), nullptr)); for (int j = 0; j < count; ++j) { values->at(j) = static_cast(jvalues[j]); @@ -4132,7 +4132,7 @@ void JavaLibrary::alterScriptParams(jobjectArray jparams, const std::string& arg std::string localString; convert(*table, localString); value->setTable(localString); - // get the string id text, if it is not NULL/empty, use it + // get the string id text, if it is not nullptr/empty, use it localString.clear(); JavaStringPtr text = getStringField(*arg, ms_fidStringIdAsciiId); if (text != JavaString::cms_nullPtr) @@ -4208,18 +4208,18 @@ int JavaLibrary::runScripts(const NetworkId & caller, "JavaLibrary::runScripts enter, self = %s, method = %s\n", caller.getValueString().c_str(), method.c_str())); - if (ms_env == NULL || ms_clsObject == NULL) + if (ms_env == nullptr || ms_clsObject == nullptr) { DEBUG_REPORT_LOG(ConfigServerGame::getJavaConsoleDebugMessages(), ( "JavaLibrary::runScripts exit, self = %s, method = %s\n", caller.getValueString().c_str(), method.c_str())); if (!ms_env) { - LOG("ScriptInvestigation", ("runSCripts failed because env was null")); + LOG("ScriptInvestigation", ("runSCripts failed because env was nullptr")); } else { - LOG("ScriptInvestigation", ("runSCripts failed because clsObject was null")); + LOG("ScriptInvestigation", ("runSCripts failed because clsObject was nullptr")); } return SCRIPT_OVERRIDE; } @@ -4346,19 +4346,19 @@ int JavaLibrary::runScript(const NetworkId & caller, const std::string& script, "JavaLibrary::runScript %s enter, self = %s, method = %s\n", script.c_str(), caller.getValueString().c_str(), method.c_str())); - if (ms_env == NULL || ms_midRunOne == NULL || ms_clsObject == NULL) + if (ms_env == nullptr || ms_midRunOne == nullptr || ms_clsObject == nullptr) { if (!ms_env) { - LOG("ScriptInvestigation", ("runSCripts2 failed because env was null")); + LOG("ScriptInvestigation", ("runSCripts2 failed because env was nullptr")); } else if (!ms_midRunOne) { - LOG("ScriptInvestigation", ("runSCripts2 failed because midRunOne was null")); + LOG("ScriptInvestigation", ("runSCripts2 failed because midRunOne was nullptr")); } else { - LOG("ScriptInvestigation", ("runSCripts2 failed because clsObject was null")); + LOG("ScriptInvestigation", ("runSCripts2 failed because clsObject was nullptr")); } return SCRIPT_OVERRIDE; @@ -4466,19 +4466,19 @@ int JavaLibrary::runScript(const NetworkId & caller, const std::string& script, DEBUG_REPORT_LOG(true, ("JavaLibrary::runScript %s enter, method = %s\n", script.c_str(), method.c_str())); - if (ms_env == NULL || ms_midRunOne == NULL || ms_clsObject == NULL) + if (ms_env == nullptr || ms_midRunOne == nullptr || ms_clsObject == nullptr) { if (!ms_env) { - LOG("ScriptInvestigation", ("runSCripts3 failed because env was null")); + LOG("ScriptInvestigation", ("runSCripts3 failed because env was nullptr")); } else if (!ms_midRunOne) { - LOG("ScriptInvestigation", ("runSCripts3 failed because midRunOne was null")); + LOG("ScriptInvestigation", ("runSCripts3 failed because midRunOne was nullptr")); } else { - LOG("ScriptInvestigation", ("runSCripts3 failed because clsObject was null")); + LOG("ScriptInvestigation", ("runSCripts3 failed because clsObject was nullptr")); } return SCRIPT_OVERRIDE; } @@ -4593,19 +4593,19 @@ int JavaLibrary::runScript(const NetworkId & caller, const std::string& script, DEBUG_REPORT_LOG(true, ("JavaLibrary::runScript %s enter, method = %s\n", script.c_str(), method.c_str())); - if (ms_env == NULL || ms_midRunOne == NULL || ms_clsObject == NULL) + if (ms_env == nullptr || ms_midRunOne == nullptr || ms_clsObject == nullptr) { if (!ms_env) { - LOG("ScriptInvestigation", ("runSCripts4 failed because env was null")); + LOG("ScriptInvestigation", ("runSCripts4 failed because env was nullptr")); } else if (!ms_midRunOne) { - LOG("ScriptInvestigation", ("runSCripts4 failed because midRunOne was null")); + LOG("ScriptInvestigation", ("runSCripts4 failed because midRunOne was nullptr")); } else { - LOG("ScriptInvestigation", ("runSCripts4 failed because clsObject was null")); + LOG("ScriptInvestigation", ("runSCripts4 failed because clsObject was nullptr")); } return SCRIPT_OVERRIDE; @@ -4786,19 +4786,19 @@ static const std::string errorReturnString; "JavaLibrary::runScript %s enter, method = %s\n", script.c_str(), method.c_str())); - if (ms_env == NULL || ms_midRunConsoleHandler == NULL || ms_clsObject == NULL) + if (ms_env == nullptr || ms_midRunConsoleHandler == nullptr || ms_clsObject == nullptr) { if (!ms_env) { - LOG("ScriptInvestigation", ("runSCripts2 failed because env was null")); + LOG("ScriptInvestigation", ("runSCripts2 failed because env was nullptr")); } else if (!ms_midRunConsoleHandler) { - LOG("ScriptInvestigation", ("runSCripts2 failed because midRunConsoleHandler was null")); + LOG("ScriptInvestigation", ("runSCripts2 failed because midRunConsoleHandler was nullptr")); } else { - LOG("ScriptInvestigation", ("runSCripts2 failed because clsObject was null")); + LOG("ScriptInvestigation", ("runSCripts2 failed because clsObject was nullptr")); } return errorReturnString; @@ -4888,7 +4888,7 @@ static const std::string errorReturnString; */ bool JavaLibrary::reloadScript(const std::string& scriptName) { - if (ms_env == NULL || ms_clsScriptEntry == NULL || ms_midUnload == NULL) + if (ms_env == nullptr || ms_clsScriptEntry == nullptr || ms_midUnload == nullptr) return false; // convert the script name to jstring @@ -4930,22 +4930,22 @@ int JavaLibrary::callMessages(const NetworkId & caller, const std::string & meth int result = SCRIPT_CONTINUE; - if (ms_env == NULL || ms_midRunOne == NULL || ms_clsObject == NULL) + if (ms_env == nullptr || ms_midRunOne == nullptr || ms_clsObject == nullptr) { DEBUG_REPORT_LOG(ConfigServerGame::getJavaConsoleDebugMessages(), ( "JavaLibrary::callMessages exit, self = %s, method = %s\n", caller.getValueString().c_str(), method.c_str())); if (!ms_env) { - LOG("ScriptInvestigation", ("callMessages failed because env was null")); + LOG("ScriptInvestigation", ("callMessages failed because env was nullptr")); } else if (!ms_midRunOne) { - LOG("ScriptInvestigation", ("callMessages failed because midRunOne was null")); + LOG("ScriptInvestigation", ("callMessages failed because midRunOne was nullptr")); } else { - LOG("ScriptInvestigation", ("callMessages failed because clsObject was null")); + LOG("ScriptInvestigation", ("callMessages failed because clsObject was nullptr")); } return SCRIPT_OVERRIDE; @@ -4962,7 +4962,7 @@ int JavaLibrary::callMessages(const NetworkId & caller, const std::string & meth const JavaDictionary * dictionary = safe_cast(data.get()); jobject jdictionary = 0; - if (dictionary != NULL) + if (dictionary != nullptr) jdictionary = dictionary->getValue(); // convert the method string to jstrings @@ -5024,22 +5024,22 @@ int JavaLibrary::callMessage(const NetworkId & caller, const std::string & scrip "JavaLibrary::callMessage %s enter, self = %s, method = %s\n", script.c_str(), caller.getValueString().c_str(), method.c_str())); - if (ms_env == NULL || ms_midRunOne == NULL || ms_clsObject == NULL) + if (ms_env == nullptr || ms_midRunOne == nullptr || ms_clsObject == nullptr) { DEBUG_REPORT_LOG(ConfigServerGame::getJavaConsoleDebugMessages(), ( "JavaLibrary::callMessage %s exit, self = %s, method = %s\n", script.c_str(), caller.getValueString().c_str(), method.c_str())); if (!ms_env) { - LOG("ScriptInvestigation", ("callMessage failed because env was null")); + LOG("ScriptInvestigation", ("callMessage failed because env was nullptr")); } else if (!ms_midRunOne) { - LOG("ScriptInvestigation", ("callMessage failed because midRunOne was null")); + LOG("ScriptInvestigation", ("callMessage failed because midRunOne was nullptr")); } else { - LOG("ScriptInvestigation", ("callMessage failed because clsObject was null")); + LOG("ScriptInvestigation", ("callMessage failed because clsObject was nullptr")); } return SCRIPT_OVERRIDE; @@ -5055,7 +5055,7 @@ int JavaLibrary::callMessage(const NetworkId & caller, const std::string & scrip } const JavaDictionary * dictionary = dynamic_cast(&data); - if (dictionary == NULL) + if (dictionary == nullptr) { DEBUG_REPORT_LOG(ConfigServerGame::getJavaConsoleDebugMessages(), ( "JavaLibrary::callMessage %s exit, self = %s, method = %s\n", @@ -5229,7 +5229,7 @@ void JavaLibrary::packDictionary(const ScriptDictionary & dictionary, bool JavaLibrary::unpackDictionary(const std::vector & packedData, ScriptDictionaryPtr & dictionary) { - if (ms_env == NULL) + if (ms_env == nullptr) return false; dictionary = JavaDictionary::cms_nullPtr; @@ -5270,7 +5270,7 @@ bool JavaLibrary::unpackDictionary(const std::vector & packedData, } } */ - if (data != NULL && *data != '\0') + if (data != nullptr && *data != '\0') { LocalByteArrayRefPtr jdata = createNewByteArray(dataLen); if (jdata != LocalByteArrayRef::cms_nullPtr) @@ -5346,7 +5346,7 @@ const bool JavaLibrary::convert(const JavaStringParam & source, Unicode::String const bool JavaLibrary::convert(const JavaDictionary & source, std::vector & target) { bool result = false; - if (ms_env != NULL) + if (ms_env != nullptr) { if (source.getValue() != 0) { @@ -5474,7 +5474,7 @@ const bool convert(const std::vector & source, LocalObj result = true; for (int i = 0; i < count; ++i) { - if (source[i] != NULL) + if (source[i] != nullptr) { JavaString targetElement(*source[i]); setObjectArrayElement(*target, i, targetElement); @@ -6171,7 +6171,7 @@ const bool convert(const LocalRefParam & source, const Region * & target) const bool convert(const jobject & source, const Region * &target) { JNIEnv * env = JavaLibrary::getEnv(); - if (env == NULL || source == NULL) + if (env == nullptr || source == nullptr) return false; if (!env->IsInstanceOf(source, JavaLibrary::ms_clsRegion)) return false; @@ -6395,7 +6395,7 @@ const bool convert(const LocalRefParam & sourceVector, Vector & target) const bool convert(const AttribMod::AttribMod & source, LocalRefPtr & target) { JNIEnv * env = JavaLibrary::getEnv(); - if (env == NULL) + if (env == nullptr) return false; target = allocObject(JavaLibrary::ms_clsAttribMod); @@ -6429,7 +6429,7 @@ const bool convert(const AttribMod::AttribMod & source, LocalRefPtr & target) const bool convert(const jobject & source, AttribMod::AttribMod & target) { JNIEnv * env = JavaLibrary::getEnv(); - if (env == NULL) + if (env == nullptr) return false; if (source == 0 || env->IsInstanceOf(source, JavaLibrary::ms_clsAttribMod) == JNI_FALSE) @@ -6488,7 +6488,7 @@ const bool convert(const LocalRefParam & source, AttribMod::AttribMod & target) const bool convert(const std::vector & source, LocalObjectArrayRefPtr & target) { JNIEnv * env = JavaLibrary::getEnv(); - if (env == NULL) + if (env == nullptr) return false; int count = source.size(); @@ -6515,7 +6515,7 @@ const bool convert(const std::vector & source, LocalObject const bool convert(const jobjectArray & source, std::vector & target) { JNIEnv * env = JavaLibrary::getEnv(); - if (env == NULL) + if (env == nullptr) return false; if (source == 0) @@ -6540,7 +6540,7 @@ const bool convert(const jobjectArray & source, std::vector & target) { JNIEnv * env = JavaLibrary::getEnv(); - if (env == NULL) + if (env == nullptr) return false; if (source == 0) @@ -6556,7 +6556,7 @@ const bool convert(const jbyteArray & source, std::vector & target) const bool convert(const LocalByteArrayRef & source, std::vector & target) { JNIEnv * env = JavaLibrary::getEnv(); - if (env == NULL) + if (env == nullptr) return false; if (source.getValue() == 0) @@ -6572,7 +6572,7 @@ const bool convert(const LocalByteArrayRef & source, std::vector & target) const bool convert(const std::vector & source, LocalByteArrayRefPtr & target) { JNIEnv * env = JavaLibrary::getEnv(); - if (env == NULL) + if (env == nullptr) return false; int count = source.size(); @@ -6604,10 +6604,10 @@ CreatureObject *JavaLibrary::getCreatureThrow(JNIEnv *env, jlong objId, char con if (!objId) { - IGNORE_RETURN(snprintf(buffer, sizeof(buffer) - 1, "%s: null object id from script.", errorDescription)); + IGNORE_RETURN(snprintf(buffer, sizeof(buffer) - 1, "%s: nullptr object id from script.", errorDescription)); buffer[sizeof(buffer) - 1] = '\0'; throwInternalScriptError(buffer); - return NULL; + return nullptr; } else { @@ -6617,7 +6617,7 @@ CreatureObject *JavaLibrary::getCreatureThrow(JNIEnv *env, jlong objId, char con IGNORE_RETURN(snprintf(buffer, sizeof(buffer) - 1, "%s: invalid or non-convertable network id [%s].", errorDescription, networkId.getValueString().c_str())); buffer[sizeof(buffer) - 1] = '\0'; throwInternalScriptError(buffer); - return NULL; + return nullptr; } else { @@ -6627,19 +6627,19 @@ CreatureObject *JavaLibrary::getCreatureThrow(JNIEnv *env, jlong objId, char con if (!throwIfNotOnServer) { // The specified object is not on this server. It might not even be a real object. - // Since the caller does not want this to throw, simply return NULL. - return NULL; + // Since the caller does not want this to throw, simply return nullptr. + return nullptr; } IGNORE_RETURN(snprintf(buffer, sizeof(buffer) - 1, "%s: object for network id [%s] not on this server.", errorDescription, networkId.getValueString().c_str())); buffer[sizeof(buffer) - 1] = '\0'; throwInternalScriptError(buffer); - return NULL; + return nullptr; } else { ServerObject *const serverObject = object->asServerObject(); - CreatureObject *const creatureObject = serverObject ? serverObject->asCreatureObject() : NULL; + CreatureObject *const creatureObject = serverObject ? serverObject->asCreatureObject() : nullptr; if (creatureObject) return creatureObject; @@ -6648,7 +6648,7 @@ CreatureObject *JavaLibrary::getCreatureThrow(JNIEnv *env, jlong objId, char con IGNORE_RETURN(snprintf(buffer, sizeof(buffer) - 1, "%s: object id=[%s], template=[%s] is not a CreatureObject.", errorDescription, networkId.getValueString().c_str(), object->getObjectTemplateName())); buffer[sizeof(buffer) - 1] = '\0'; throwInternalScriptError(buffer); - return NULL; + return nullptr; } } } @@ -6665,10 +6665,10 @@ ShipObject *JavaLibrary::getShipThrow(JNIEnv *env, jlong objId, char const *erro if (objId == 0) { - IGNORE_RETURN(snprintf(buffer, sizeof(buffer) - 1, "%s: null object id from script.", errorDescription)); + IGNORE_RETURN(snprintf(buffer, sizeof(buffer) - 1, "%s: nullptr object id from script.", errorDescription)); buffer[sizeof(buffer) - 1] = '\0'; throwInternalScriptError(buffer); - return NULL; + return nullptr; } else { @@ -6678,7 +6678,7 @@ ShipObject *JavaLibrary::getShipThrow(JNIEnv *env, jlong objId, char const *erro IGNORE_RETURN(snprintf(buffer, sizeof(buffer) - 1, "%s: invalid or non-convertable network id [%s].", errorDescription, networkId.getValueString().c_str())); buffer[sizeof(buffer) - 1] = '\0'; throwInternalScriptError(buffer); - return NULL; + return nullptr; } else { @@ -6688,19 +6688,19 @@ ShipObject *JavaLibrary::getShipThrow(JNIEnv *env, jlong objId, char const *erro if (!throwIfNotOnServer) { // The specified object is not on this server. It might not even be a real object. - // Since the caller does not want this to throw, simply return NULL. - return NULL; + // Since the caller does not want this to throw, simply return nullptr. + return nullptr; } IGNORE_RETURN(snprintf(buffer, sizeof(buffer) - 1, "%s: object for network id [%s] not on this server.", errorDescription, networkId.getValueString().c_str())); buffer[sizeof(buffer) - 1] = '\0'; throwInternalScriptError(buffer); - return NULL; + return nullptr; } else { ServerObject *const serverObject = object->asServerObject(); - ShipObject *const shipObject = serverObject ? serverObject->asShipObject() : NULL; + ShipObject *const shipObject = serverObject ? serverObject->asShipObject() : nullptr; if (shipObject) return shipObject; @@ -6709,7 +6709,7 @@ ShipObject *JavaLibrary::getShipThrow(JNIEnv *env, jlong objId, char const *erro IGNORE_RETURN(snprintf(buffer, sizeof(buffer) - 1, "%s: object id=[%s], template=[%s] is not a ShipObject.", errorDescription, networkId.getValueString().c_str(), object->getObjectTemplateName())); buffer[sizeof(buffer) - 1] = '\0'; throwInternalScriptError(buffer); - return NULL; + return nullptr; } } } @@ -6725,7 +6725,7 @@ ShipObject *JavaLibrary::getShipThrow(JNIEnv *env, jlong objId, char const *erro */ void JavaLibrary::throwInternalScriptError(const char * message) { - if (ms_env != NULL && message != NULL) + if (ms_env != nullptr && message != nullptr) { ms_env->ThrowNew(ms_clsInternalScriptError, message); } diff --git a/engine/server/library/serverScript/src/shared/ScriptFunctionTable.cpp b/engine/server/library/serverScript/src/shared/ScriptFunctionTable.cpp index 976743ee..e9f4e88c 100755 --- a/engine/server/library/serverScript/src/shared/ScriptFunctionTable.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptFunctionTable.cpp @@ -434,7 +434,7 @@ static const Scripting::ScriptFuncTable ScriptFuncList[] = //-- finish it up - {Scripting::TRIG_LAST_TRIGGER, NULL, NULL} + {Scripting::TRIG_LAST_TRIGGER, nullptr, nullptr} }; const int NUM_SCRIPT_FUNCTIONS = sizeof(ScriptFuncList) / sizeof(ScriptFuncList[0]) - 1; @@ -444,7 +444,7 @@ const int NUM_SCRIPT_FUNCTIONS = sizeof(ScriptFuncList) / sizeof(ScriptFuncList[ // globals //======================================================================== -Scripting::_ScriptFuncHashMap *Scripting::ScriptFuncHashMap = NULL; +Scripting::_ScriptFuncHashMap *Scripting::ScriptFuncHashMap = nullptr; //======================================================================== @@ -468,6 +468,6 @@ void Scripting::InitScriptFuncHashMap(void) void Scripting::RemoveScriptFuncHashMap(void) { delete Scripting::ScriptFuncHashMap; - Scripting::ScriptFuncHashMap = NULL; + Scripting::ScriptFuncHashMap = nullptr; } diff --git a/engine/server/library/serverScript/src/shared/ScriptListEntry.cpp b/engine/server/library/serverScript/src/shared/ScriptListEntry.cpp index 1f55096a..8725947c 100755 --- a/engine/server/library/serverScript/src/shared/ScriptListEntry.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptListEntry.cpp @@ -16,9 +16,9 @@ std::string const &ScriptListEntry::getScriptName() const { static const std::string emptyString; - if (m_data != NULL) + if (m_data != nullptr) return m_data->first; - WARNING_STRICT_FATAL(true, ("ScriptListEntry::getScriptName called with m_data = NULL")); + WARNING_STRICT_FATAL(true, ("ScriptListEntry::getScriptName called with m_data = nullptr")); return emptyString; } @@ -28,9 +28,9 @@ ScriptData &ScriptListEntry::getScriptData() const { static ScriptData emptyData; - if (m_data != NULL) + if (m_data != nullptr) return m_data->second; - WARNING_STRICT_FATAL(true, ("ScriptListEntry::getScriptData called with m_data = NULL")); + WARNING_STRICT_FATAL(true, ("ScriptListEntry::getScriptData called with m_data = nullptr")); return emptyData; } diff --git a/engine/server/library/serverScript/src/shared/ScriptListEntry.h b/engine/server/library/serverScript/src/shared/ScriptListEntry.h index 1d5e8f66..37349274 100755 --- a/engine/server/library/serverScript/src/shared/ScriptListEntry.h +++ b/engine/server/library/serverScript/src/shared/ScriptListEntry.h @@ -53,7 +53,7 @@ inline bool ScriptListEntry::operator==(ScriptListEntry const &rhs) const inline bool ScriptListEntry::isValid() const { - return m_data != NULL; + return m_data != nullptr; } // ====================================================================== diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsAi.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsAi.cpp index eab60dd9..1d12a09a 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsAi.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsAi.cpp @@ -126,18 +126,18 @@ AICreatureController * const ScriptMethodsAiNamespace::getAiCreatureController(j NetworkId const aiNetworkId(ai); CreatureObject * const aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId); - if (aiCreatureObject == NULL) + if (aiCreatureObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("Unable to resolve the ai(%s) to a CreatureObject.", aiNetworkId.getValueString().c_str())); - return NULL; + return nullptr; } AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(aiCreatureObject->getController()); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("Unable to get the ai's(%s) AiCreatureController.", aiCreatureObject->getDebugInformation().c_str())); - return NULL; + return nullptr; } return aiCreatureController; @@ -155,14 +155,14 @@ jint JNICALL ScriptMethodsAiNamespace::aiGetMovementState(JNIEnv * /*env*/, jobj NetworkId const aiNetworkId(ai); CreatureObject * const aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId); - if (aiCreatureObject == NULL) + if (aiCreatureObject == nullptr) { return AMT_invalid; } AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(aiCreatureObject->getController()); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return AMT_invalid; } @@ -187,14 +187,14 @@ jboolean JNICALL ScriptMethodsAiNamespace::aiLoggingEnabled(JNIEnv * /*env*/, jo NetworkId const aiNetworkId(ai); CreatureObject * const aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId); - if (aiCreatureObject == NULL) + if (aiCreatureObject == nullptr) { return JNI_FALSE; } AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(aiCreatureObject->getController()); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return JNI_FALSE; } @@ -212,7 +212,7 @@ jboolean JNICALL ScriptMethodsAiNamespace::aiIsFrozen(JNIEnv * /*env*/, jobject { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return JNI_FALSE; } @@ -226,14 +226,14 @@ jboolean JNICALL ScriptMethodsAiNamespace::aiIsAggressive(JNIEnv * /*env*/, jobj NetworkId const aiNetworkId(ai); CreatureObject * const aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId); - if (aiCreatureObject == NULL) + if (aiCreatureObject == nullptr) { return JNI_FALSE; } AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(aiCreatureObject->getController()); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return JNI_FALSE; } @@ -247,14 +247,14 @@ jboolean JNICALL ScriptMethodsAiNamespace::aiIsAssist(JNIEnv * /*env*/, jobject NetworkId const aiNetworkId(ai); CreatureObject * const aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId); - if (aiCreatureObject == NULL) + if (aiCreatureObject == nullptr) { return JNI_FALSE; } AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(aiCreatureObject->getController()); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return JNI_FALSE; } @@ -267,7 +267,7 @@ jboolean JNICALL ScriptMethodsAiNamespace::aiIsStalker(JNIEnv * /*env*/, jobject { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return JNI_FALSE; } @@ -282,14 +282,14 @@ jboolean JNICALL ScriptMethodsAiNamespace::aiIsKiller(JNIEnv * /*env*/, jobject NetworkId const aiNetworkId(ai); CreatureObject * const aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId); - if (aiCreatureObject == NULL) + if (aiCreatureObject == nullptr) { return JNI_FALSE; } AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(aiCreatureObject->getController()); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return JNI_FALSE; } @@ -302,7 +302,7 @@ void JNICALL ScriptMethodsAiNamespace::aiTether(JNIEnv * /*env*/, jobject /*self { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return; } @@ -316,14 +316,14 @@ jboolean JNICALL ScriptMethodsAiNamespace::aiIsTethered(JNIEnv * /*env*/, jobjec NetworkId const aiNetworkId(ai); CreatureObject * const aiCreatureObject = CreatureObject::getCreatureObject(aiNetworkId); - if (aiCreatureObject == NULL) + if (aiCreatureObject == nullptr) { return JNI_FALSE; } AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(aiCreatureObject->getController()); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return JNI_FALSE; } @@ -336,7 +336,7 @@ void JNICALL ScriptMethodsAiNamespace::aiSetHomeLocation(JNIEnv * /*env*/, jobje { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return; } @@ -356,7 +356,7 @@ jobject JNICALL ScriptMethodsAiNamespace::aiGetHomeLocation(JNIEnv * /*env*/, jo { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return JavaLibrary::getVector(Vector::zero)->getReturnValue(); } @@ -373,7 +373,7 @@ jobject JNICALL ScriptMethodsAiNamespace::aiGetLeashAnchorLocation(JNIEnv * /*en { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return JavaLibrary::getVector(Vector::zero)->getReturnValue(); } @@ -396,7 +396,7 @@ jfloat JNICALL ScriptMethodsAiNamespace::aiGetRespectRadius(JNIEnv * /*env*/, jo { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return 0.0f; } @@ -411,7 +411,7 @@ jfloat JNICALL ScriptMethodsAiNamespace::aiGetAggroRadius(JNIEnv * /*env*/, jobj { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return 0.0f; } @@ -424,7 +424,7 @@ void JNICALL ScriptMethodsAiNamespace::aiEquipPrimaryWeapon(JNIEnv * /*env*/, jo { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return; } @@ -437,7 +437,7 @@ void JNICALL ScriptMethodsAiNamespace::aiEquipSecondaryWeapon(JNIEnv * /*env*/, { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return; } @@ -450,7 +450,7 @@ void JNICALL ScriptMethodsAiNamespace::aiUnEquipWeapons(JNIEnv * /*env*/, jobjec { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return; } @@ -463,7 +463,7 @@ jboolean JNICALL ScriptMethodsAiNamespace::aiHasPrimaryWeapon(JNIEnv * /*env*/, { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return JNI_FALSE; } @@ -476,7 +476,7 @@ jboolean JNICALL ScriptMethodsAiNamespace::aiHasSecondaryWeapon(JNIEnv * /*env*/ { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return JNI_FALSE; } @@ -489,7 +489,7 @@ jboolean JNICALL ScriptMethodsAiNamespace::aiUsingPrimaryWeapon(JNIEnv * /*env*/ { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return JNI_FALSE; } @@ -502,7 +502,7 @@ jboolean JNICALL ScriptMethodsAiNamespace::aiUsingSecondaryWeapon(JNIEnv * /*env { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return JNI_FALSE; } @@ -515,7 +515,7 @@ jlong JNICALL ScriptMethodsAiNamespace::aiGetPrimaryWeapon(JNIEnv * /*env*/, job { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return 0; } @@ -528,7 +528,7 @@ jlong JNICALL ScriptMethodsAiNamespace::aiGetSecondaryWeapon(JNIEnv * /*env*/, j { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return 0; } @@ -541,7 +541,7 @@ jfloat JNICALL ScriptMethodsAiNamespace::aiGetMovementSpeedPercent(JNIEnv * /*en { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return 0.0f; } @@ -554,7 +554,7 @@ void JNICALL ScriptMethodsAiNamespace::loiterLocation(JNIEnv * /*env*/, jobject { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return; } @@ -585,7 +585,7 @@ void JNICALL ScriptMethodsAiNamespace::loiterLocation(JNIEnv * /*env*/, jobject CellObject const * const cellObject = CellObject::getCellObject(cellId); - if (cellObject != NULL) + if (cellObject != nullptr) { CellProperty const * const cellProperty = cellObject->getCellProperty(); @@ -608,7 +608,7 @@ void JNICALL ScriptMethodsAiNamespace::loiterTarget(JNIEnv * /*env*/, jobject /* { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return; } @@ -623,7 +623,7 @@ void JNICALL ScriptMethodsAiNamespace::loiterTarget(JNIEnv * /*env*/, jobject /* NetworkId const targetNetworkId(static_cast(target)); Object * const targetObject = NetworkIdManager::getObjectById(targetNetworkId); - if (targetObject == NULL) + if (targetObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsAi::loiterTarget() ai(%s) Unable to resolve the target(%s) to a Object", aiCreatureController->getCreature()->getDebugInformation().c_str(), targetNetworkId.getValueString().c_str())); return; @@ -643,7 +643,7 @@ void JNICALL ScriptMethodsAiNamespace::pathToLocation(JNIEnv * /*env*/, jobject { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return; } @@ -664,7 +664,7 @@ void JNICALL ScriptMethodsAiNamespace::pathToLocation(JNIEnv * /*env*/, jobject { CellObject const * const cellObject = CellObject::getCellObject(cellId); - if (cellObject != NULL) + if (cellObject != nullptr) { CellProperty const * const cellProperty = cellObject->getCellProperty(); @@ -697,7 +697,7 @@ void JNICALL ScriptMethodsAiNamespace::pathToName(JNIEnv * /*env*/, jobject /*se { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return; } @@ -731,7 +731,7 @@ void JNICALL ScriptMethodsAiNamespace::pathToName(JNIEnv * /*env*/, jobject /*se void JNICALL ScriptMethodsAiNamespace::patrolToLocation(JNIEnv *, jobject, jlong ai, jobjectArray targets, jboolean random, jboolean flip, jboolean repeat, jint startPoint) { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) return; std::vector locations; @@ -755,7 +755,7 @@ void JNICALL ScriptMethodsAiNamespace::patrolToLocation(JNIEnv *, jobject, jlong void JNICALL ScriptMethodsAiNamespace::patrolToName(JNIEnv *, jobject, jlong ai, jobjectArray targetNames, jboolean random, jboolean flip, jboolean repeat, jint startPoint) { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) return; std::vector locations; @@ -768,11 +768,11 @@ void JNICALL ScriptMethodsAiNamespace::patrolToName(JNIEnv *, jobject, jlong ai, for (int i = 0; i < count; ++i) { const Unicode::String * location = locations[i]; - if (location != NULL) + if (location != nullptr) { realLocations.push_back(*location); delete location; - locations[i] = NULL; + locations[i] = nullptr; } } aiCreatureController->patrol(realLocations, random, flip, repeat, startPoint); @@ -783,16 +783,16 @@ jstring JNICALL ScriptMethodsAiNamespace::aiGetCombatAction(JNIEnv * /*env*/, jo { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { - return NULL; + return nullptr; } PersistentCrcString const & result = aiCreatureController->getCombatAction(); if (result.isEmpty()) { - return NULL; + return nullptr; } JavaString javaString(result.getString()); @@ -805,7 +805,7 @@ jint JNICALL ScriptMethodsAiNamespace::aiGetKnockDownRecoveryTime(JNIEnv * /*env { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(ai); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return 0; } @@ -819,7 +819,7 @@ jboolean JNICALL ScriptMethodsAiNamespace::setHibernationDelay(JNIEnv *env, jobj { AICreatureController * const aiCreatureController = ScriptMethodsAiNamespace::getAiCreatureController(creature); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) return JNI_FALSE; aiCreatureController->setHibernationDelay(delay); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsAnimation.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsAnimation.cpp index d41f22ca..9c2ec894 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsAnimation.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsAnimation.cpp @@ -97,7 +97,7 @@ void JNICALL ScriptMethodsAnimationNamespace::setAnimationMood (JNIEnv *env, job JavaStringParam localMoodName(moodName); - ServerObject * targetObject = NULL; + ServerObject * targetObject = nullptr; if (!JavaLibrary::getObject(target, targetObject)) return; @@ -114,7 +114,7 @@ void JNICALL ScriptMethodsAnimationNamespace::setAnimationMood (JNIEnv *env, job jstring JNICALL ScriptMethodsAnimationNamespace::getAnimationMood (JNIEnv *env, jobject self, jlong target) { - ServerObject * targetObject = NULL; + ServerObject * targetObject = nullptr; if (!JavaLibrary::getObject(target, targetObject)) return 0; @@ -143,7 +143,7 @@ jboolean JNICALL ScriptMethodsAnimationNamespace::sitOnObject (JNIEnv *env, jobj CreatureObject *sitterObject = 0; if (!JavaLibrary::getObject (sitterId, sitterObject) || !sitterObject) { - DEBUG_WARNING (true, ("sitOnObject(): Sitter object is NULL.")); + DEBUG_WARNING (true, ("sitOnObject(): Sitter object is nullptr.")); return JNI_FALSE; } @@ -175,11 +175,11 @@ void JNICALL ScriptMethodsAnimationNamespace::setObjectAppearance(JNIEnv *env, j UNREF(env); UNREF(self); - CreatureObject* creature = NULL; + CreatureObject* creature = nullptr; if(!JavaLibrary::getObject(target, creature) || !creature) { - DEBUG_WARNING(true, ("SetObjectAppearance() : Creature object was NULL.\n")); + DEBUG_WARNING(true, ("SetObjectAppearance() : Creature object was nullptr.\n")); return; } @@ -209,11 +209,11 @@ void JNICALL ScriptMethodsAnimationNamespace::revertObjectAppearance(JNIEnv *env UNREF(env); UNREF(self); - CreatureObject* creature = NULL; + CreatureObject* creature = nullptr; if(!JavaLibrary::getObject(target, creature) || !creature) { - DEBUG_WARNING(true, ("RevertObjectAppearance() : Creature object was NULL.\n")); + DEBUG_WARNING(true, ("RevertObjectAppearance() : Creature object was nullptr.\n")); return; } diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsAttributes.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsAttributes.cpp index 266b10f8..42c47200 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsAttributes.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsAttributes.cpp @@ -549,12 +549,12 @@ jboolean JNICALL ScriptMethodsAttributesNamespace::hasAttribModifier(JNIEnv *env if (!JavaLibrary::convert(jmodName, name)) return JNI_FALSE; - const CreatureObject * creature = NULL; + const CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; const AttribMod::AttribMod * mod = creature->getAttributeModifier(name); - if (mod != NULL && AttribMod::isAttribMod(*mod)) + if (mod != nullptr && AttribMod::isAttribMod(*mod)) return JNI_TRUE; return JNI_FALSE; @@ -582,12 +582,12 @@ jboolean JNICALL ScriptMethodsAttributesNamespace::hasSkillModModifier(JNIEnv *e if (!JavaLibrary::convert(jmodName, name)) return JNI_FALSE; - const CreatureObject * creature = NULL; + const CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; const AttribMod::AttribMod * mod = creature->getAttributeModifier(name); - if (mod != NULL && AttribMod::isSkillMod(*mod)) + if (mod != nullptr && AttribMod::isSkillMod(*mod)) return JNI_TRUE; return JNI_FALSE; @@ -601,7 +601,7 @@ jboolean JNICALL ScriptMethodsAttributesNamespace::hasSkillModModifier(JNIEnv *e * @param target id of creature to access * @param attrib attribute we are interested in * - * @return the attribute modifiers for the creature, or null if it has none + * @return the attribute modifiers for the creature, or nullptr if it has none */ jobjectArray JNICALL ScriptMethodsAttributesNamespace::getAttribModifiers(JNIEnv *env, jobject self, jlong target, jint attrib) { @@ -642,7 +642,7 @@ jobjectArray JNICALL ScriptMethodsAttributesNamespace::getAttribModifiers(JNIEnv * @param self class calling this function * @param target id of creature to access * - * @return the attribute modifiers for the creature, or null if it has none + * @return the attribute modifiers for the creature, or nullptr if it has none */ jobjectArray JNICALL ScriptMethodsAttributesNamespace::getAllAttribModifiers(JNIEnv *env, jobject self, jlong target) { @@ -692,7 +692,7 @@ jboolean JNICALL ScriptMethodsAttributesNamespace::removeAttribModifier(JNIEnv * if (!JavaLibrary::convert(jmodName, name)) return JNI_FALSE; - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -1084,12 +1084,12 @@ jint JNICALL ScriptMethodsAttributesNamespace::getHitpoints(JNIEnv *env, jobject { UNREF(self); - const TangibleObject * object = NULL; + const TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return ATTRIB_ERROR; // make sure the object isn't a creature or is a vehicle - if (object->asCreatureObject () != NULL && + if (object->asCreatureObject () != nullptr && !GameObjectTypes::isTypeOf (object->getGameObjectType (), SharedObjectTemplate::GOT_vehicle)) return ATTRIB_ERROR; @@ -1111,12 +1111,12 @@ jint JNICALL ScriptMethodsAttributesNamespace::getMaxHitpoints(JNIEnv *env, jobj { UNREF(self); - const TangibleObject * object = NULL; + const TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return ATTRIB_ERROR; // make sure the object isn't a creature or is a vehicle - if (object->asCreatureObject () != NULL && + if (object->asCreatureObject () != nullptr && !GameObjectTypes::isTypeOf (object->getGameObjectType (), SharedObjectTemplate::GOT_vehicle)) return ATTRIB_ERROR; @@ -1136,13 +1136,13 @@ jint JNICALL ScriptMethodsAttributesNamespace::getTotalHitpoints(JNIEnv *env, jo { UNREF(self); - const TangibleObject * object = NULL; + const TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return ATTRIB_ERROR; // make sure the object isn't a creature // make sure the object isn't a creature or is a vehicle - if (object->asCreatureObject () != NULL && + if (object->asCreatureObject () != nullptr && !GameObjectTypes::isTypeOf (object->getGameObjectType (), SharedObjectTemplate::GOT_vehicle)) return ATTRIB_ERROR; @@ -1164,12 +1164,12 @@ jboolean JNICALL ScriptMethodsAttributesNamespace::setHitpoints(JNIEnv *env, job { UNREF(self); - TangibleObject * object = NULL; + TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; // make sure the object isn't a creature or is a vehicle - if (object->asCreatureObject () != NULL && + if (object->asCreatureObject () != nullptr && !GameObjectTypes::isTypeOf (object->getGameObjectType (), SharedObjectTemplate::GOT_vehicle)) return JNI_FALSE; @@ -1209,12 +1209,12 @@ jboolean JNICALL ScriptMethodsAttributesNamespace::setMaxHitpoints(JNIEnv *env, { UNREF(self); - TangibleObject * object = NULL; + TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; // make sure the object isn't a creature or is a vehicle - if (object->asCreatureObject () != NULL && + if (object->asCreatureObject () != nullptr && !GameObjectTypes::isTypeOf (object->getGameObjectType (), SharedObjectTemplate::GOT_vehicle)) return JNI_FALSE; @@ -1237,12 +1237,12 @@ jboolean JNICALL ScriptMethodsAttributesNamespace::setInvulnerableHitpoints(JNIE { UNREF(self); - TangibleObject * object = NULL; + TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; // make sure the object isn't a creature or is a vehicle - if (object->asCreatureObject () != NULL && + if (object->asCreatureObject () != nullptr && !GameObjectTypes::isTypeOf (object->getGameObjectType (), SharedObjectTemplate::GOT_vehicle)) return JNI_FALSE; @@ -1280,7 +1280,7 @@ jboolean JNICALL ScriptMethodsAttributesNamespace::setInvulnerableHitpoints(JNIE */ jint JNICALL ScriptMethodsAttributesNamespace::getShockWound(JNIEnv *env, jobject self, jlong target) { - const CreatureObject * creature = NULL; + const CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return ATTRIB_ERROR; @@ -1299,7 +1299,7 @@ jint JNICALL ScriptMethodsAttributesNamespace::getShockWound(JNIEnv *env, jobjec */ jboolean JNICALL ScriptMethodsAttributesNamespace::setShockWound(JNIEnv *env, jobject self, jlong target, jint wound) { - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -1319,7 +1319,7 @@ jboolean JNICALL ScriptMethodsAttributesNamespace::setShockWound(JNIEnv *env, jo */ jboolean JNICALL ScriptMethodsAttributesNamespace::addShockWound(JNIEnv *env, jobject self, jlong target, jint wound) { - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -1339,7 +1339,7 @@ jboolean JNICALL ScriptMethodsAttributesNamespace::addShockWound(JNIEnv *env, jo */ jboolean JNICALL ScriptMethodsAttributesNamespace::healShockWound(JNIEnv *env, jobject self, jlong target, jint value) { - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsAuction.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsAuction.cpp index 0a76643b..e288480b 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsAuction.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsAuction.cpp @@ -110,8 +110,8 @@ void JNICALL ScriptMethodsAuctionNamespace::createVendorMarket(JNIEnv *env, jobj void JNICALL ScriptMethodsAuctionNamespace::auctionCreatePermanent(JNIEnv *env, jobject script, jstring jownerName, jlong jitem, jlong jauctionContainer, jint jprice, jstring juserDescription) { - TangibleObject *itemObject = NULL; - ServerObject *containerObj = NULL; + TangibleObject *itemObject = nullptr; + ServerObject *containerObj = nullptr; if (!JavaLibrary::getObject(jitem, itemObject)) { @@ -194,7 +194,7 @@ void JNICALL ScriptMethodsAuctionNamespace::setSalesTax(JNIEnv *env, jobject scr void JNICALL ScriptMethodsAuctionNamespace::requestVendorItemCount(JNIEnv *env, jobject script, jlong vendor) { - ServerObject* vendorObject = NULL; + ServerObject* vendorObject = nullptr; if( !JavaLibrary::getObject(vendor, vendorObject) ) { WARNING(true, ("[designer bug] requestVendorItemLimit() vendor is invalid.")); @@ -206,7 +206,7 @@ void JNICALL ScriptMethodsAuctionNamespace::requestVendorItemCount(JNIEnv *env, void JNICALL ScriptMethodsAuctionNamespace::requestPlayerVendorCount(JNIEnv *env, jobject script, jlong player) { - ServerObject* playerObject = NULL; + ServerObject* playerObject = nullptr; if( !JavaLibrary::getObject(player, playerObject) ) { WARNING(true, ("[designer bug] requestPlayerVendorCount() player is invalid.")); @@ -218,7 +218,7 @@ void JNICALL ScriptMethodsAuctionNamespace::requestPlayerVendorCount(JNIEnv *env void JNICALL ScriptMethodsAuctionNamespace::updateVendorSearchOption(JNIEnv *env, jobject script, jlong vendor, jboolean enable) { - ServerObject* vendorObject = NULL; + ServerObject* vendorObject = nullptr; bool enabled; if( !JavaLibrary::getObject(vendor, vendorObject) ) { @@ -235,7 +235,7 @@ void JNICALL ScriptMethodsAuctionNamespace::updateVendorSearchOption(JNIEnv *env void JNICALL ScriptMethodsAuctionNamespace::setEntranceCharge(JNIEnv *env, jobject script, jlong vendor, jint entranceCharge) { - ServerObject* vendorObject = NULL; + ServerObject* vendorObject = nullptr; if( !JavaLibrary::getObject(vendor, vendorObject) ) { WARNING(true, ("[designer bug] setEntranceCharge() vendor is invalid.")); @@ -247,7 +247,7 @@ void JNICALL ScriptMethodsAuctionNamespace::setEntranceCharge(JNIEnv *env, jobje void JNICALL ScriptMethodsAuctionNamespace::removeAllAuctions(JNIEnv *env, jobject script, jlong jvendor) { - ServerObject* vendorObject = NULL; + ServerObject* vendorObject = nullptr; if( !JavaLibrary::getObject(jvendor, vendorObject) ) { WARNING(true, ("[designer bug] removeAllAuctions() vendor is invalid.")); @@ -259,21 +259,21 @@ void JNICALL ScriptMethodsAuctionNamespace::removeAllAuctions(JNIEnv *env, jobje void JNICALL ScriptMethodsAuctionNamespace::reinitializeVendor(JNIEnv *env, jobject script, jlong vendor, jlong player) { - ServerObject* vendorObject = NULL; + ServerObject* vendorObject = nullptr; if( !JavaLibrary::getObject(vendor, vendorObject) ) { WARNING(true, ("[designer bug] reinitializeVendor() vendor is invalid.")); return; } ServerObject* auctionContainer = vendorObject->getBazaarContainer(); - if ( auctionContainer == NULL ) + if ( auctionContainer == nullptr ) { WARNING(true, ("[designer bug] reinitializeVendor() vendor doesn't have an auction container.")); return; } - ServerObject* playerObject = NULL; + ServerObject* playerObject = nullptr; if ( !JavaLibrary::getObject(player, playerObject) ) { WARNING(true, ("[designer bug] reinitializeVendor() player is invalid.")); @@ -292,7 +292,7 @@ void JNICALL ScriptMethodsAuctionNamespace::reinitializeVendor(JNIEnv *env, jobj void JNICALL ScriptMethodsAuctionNamespace::updateVendorStatus(JNIEnv *env, jobject script, jlong vendor, jint status) { - ServerObject const * vendorObject = NULL; + ServerObject const * vendorObject = nullptr; if (!JavaLibrary::getObject(vendor, vendorObject)) { diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsBroadcasting.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsBroadcasting.cpp index aaea9f3c..2ee028b5 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsBroadcasting.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsBroadcasting.cpp @@ -63,7 +63,7 @@ void JNICALL ScriptMethodsBroadcastingNamespace::listenToMessage(JNIEnv *env, jo CachedNetworkId emitterId(emitter); ServerObject* listenerObject = dynamic_cast(listenerId.getObject()); - if (listenerObject == NULL) + if (listenerObject == nullptr) return; std::string messageHandlerNameString; @@ -88,7 +88,7 @@ void JNICALL ScriptMethodsBroadcastingNamespace::stopListeningToMessage(JNIEnv * CachedNetworkId emitterId(emitter); ServerObject* listenerObject = dynamic_cast(listenerId.getObject()); - if (listenerObject == NULL) + if (listenerObject == nullptr) return; std::string messageHandlerNameString; @@ -112,7 +112,7 @@ jlongArray JNICALL ScriptMethodsBroadcastingNamespace::getMessageListeners(JNIEn CachedNetworkId emitterId(emitter); ServerObject* emitterObject = dynamic_cast(emitterId.getObject()); - if (emitterObject == NULL) + if (emitterObject == nullptr) return 0; std::string messageHandlerNameString; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsBuffBuilder.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsBuffBuilder.cpp index 9eaabd1f..24289140 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsBuffBuilder.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsBuffBuilder.cpp @@ -162,8 +162,8 @@ jboolean JNICALL ScriptMethodsBuffBuilderNamespace::buffBuilderValidated(JNIEnv WARNING(true, ("index keys and values arrays are of diffent sizes")); return JNI_FALSE; } - jint * const buffComponentsValuesArray = env->GetIntArrayElements(jbuffComponentValues, NULL); - if (buffComponentsValuesArray == NULL) + jint * const buffComponentsValuesArray = env->GetIntArrayElements(jbuffComponentValues, nullptr); + if (buffComponentsValuesArray == nullptr) { return JNI_FALSE; } @@ -194,7 +194,7 @@ jboolean JNICALL ScriptMethodsBuffBuilderNamespace::buffBuilderValidated(JNIEnv { //send the final change message to the buffer to indicate acceptance - Controller * const bufferController = bufferObj ? bufferObj->getController() : NULL; + Controller * const bufferController = bufferObj ? bufferObj->getController() : nullptr; if(bufferController) { BuffBuilderChangeMessage * outMsg = new BuffBuilderChangeMessage(); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsChat.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsChat.cpp index 8e36a847..39fbf062 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsChat.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsChat.cpp @@ -218,7 +218,7 @@ jstring JNICALL ScriptMethodsChatNamespace::chatPackOutOfBandWaypointData(JNIEnv Unicode::String n; //name StringId nid; //nameId - //-- target may be null, we'll just start a new string + //-- target may be nullptr, we'll just start a new string if (target) { const JavaStringParam jtarget(target); @@ -229,7 +229,7 @@ jstring JNICALL ScriptMethodsChatNamespace::chatPackOutOfBandWaypointData(JNIEnv } } - //-- if planet is null, just use the current sceneId + //-- if planet is nullptr, just use the current sceneId if (planet) { const JavaStringParam jplanet(planet); @@ -304,7 +304,7 @@ jstring JNICALL ScriptMethodsChatNamespace::chatPackOutOfBandWaypoint(JNIEnv * e if (!source) { - DEBUG_WARNING (true, ("ScriptMethodsChat JavaLibrary::chatPackOutOfBandWaypoint failed null source")); + DEBUG_WARNING (true, ("ScriptMethodsChat JavaLibrary::chatPackOutOfBandWaypoint failed nullptr source")); return 0; } @@ -340,7 +340,7 @@ jstring JNICALL ScriptMethodsChatNamespace::packOutOfBandProsePackage(JNIEnv * e if (!stringId) { - DEBUG_WARNING (true, ("JavaLibrary::packOutOfBandProsePackage attempt to pack prose package with null stringId")); + DEBUG_WARNING (true, ("JavaLibrary::packOutOfBandProsePackage attempt to pack prose package with nullptr stringId")); return 0; } @@ -644,10 +644,10 @@ void JNICALL ScriptMethodsChatNamespace::chatSendSystemMessageObjId(JNIEnv * env if(!JavaLibrary::getObject(_to, player)) { - DEBUG_WARNING (true, ("ScriptMethodsChat JavaLibrary::chatSendSystemMessageObjId failed bad source object (not null)")); + DEBUG_WARNING (true, ("ScriptMethodsChat JavaLibrary::chatSendSystemMessageObjId failed bad source object (not nullptr)")); if (ConfigServerScript::allowDebugConsoleMessages()) { - fprintf(stderr, "WARNING: JavaLibrary::chatSendSystemMessageObjId: failed bad source object (not null)\n"); + fprintf(stderr, "WARNING: JavaLibrary::chatSendSystemMessageObjId: failed bad source object (not nullptr)\n"); JavaLibrary::printJavaStack(); } return; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsCity.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsCity.cpp index 6843dc85..db7499c7 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsCity.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsCity.cpp @@ -920,7 +920,7 @@ void JNICALL ScriptMethodsCityNamespace::cityRemoveStructure(JNIEnv *env, jobjec jboolean JNICALL ScriptMethodsCityNamespace::cityIsInactivePackupActive(JNIEnv *env, jobject self) { - return (ConfigServerGame::getCityCitizenshipInactivePackupStartTimeEpoch() <= static_cast(::time(NULL))); + return (ConfigServerGame::getCityCitizenshipInactivePackupStartTimeEpoch() <= static_cast(::time(nullptr))); } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsClientEffect.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsClientEffect.cpp index 28cb48e9..b3af259f 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsClientEffect.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsClientEffect.cpp @@ -91,7 +91,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEventObj(JNIEnv * { JavaStringParam localEventType(eventType); - ServerObject* so = NULL; + ServerObject* so = nullptr; if(!JavaLibrary::getObject(client, so)) return JNI_FALSE; Client* c = so->getClient(); @@ -100,7 +100,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEventObj(JNIEnv * if (!objectToPlayEventOn) return JNI_FALSE; - ServerObject* target = NULL; + ServerObject* target = nullptr; if(!JavaLibrary::getObject(objectToPlayEventOn, target)) return JNI_FALSE; if(!target) @@ -114,7 +114,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEventObj(JNIEnv * //get the hardpoint std::string hp; - if (NULL != jHardpoint) + if (nullptr != jHardpoint) { JavaStringParam localHardpoint(jHardpoint); JavaLibrary::convert(localHardpoint, hp); @@ -122,7 +122,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEventObj(JNIEnv * //get the transform Transform transform; - if (NULL != jTransform) + if (nullptr != jTransform) { ScriptConversion::convert(jTransform, transform); } @@ -158,7 +158,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEventObjLimited(J if (!objectToPlayEventOn) return JNI_FALSE; - ServerObject* target = NULL; + ServerObject* target = nullptr; if(!JavaLibrary::getObject(objectToPlayEventOn, target)) return JNI_FALSE; if(!target) @@ -172,7 +172,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEventObjLimited(J //get the hardpoint std::string hp; - if (NULL != jHardpoint) + if (nullptr != jHardpoint) { JavaStringParam localHardpoint(jHardpoint); JavaLibrary::convert(localHardpoint, hp); @@ -180,7 +180,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEventObjLimited(J //get the transform Transform transform; - if (NULL != jTransform) + if (nullptr != jTransform) { ScriptConversion::convert(jTransform, transform); } @@ -210,7 +210,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEventLoc(JNIEnv * JavaStringParam localEventSourceType(eventSourceType); JavaStringParam localEventDestType(eventDestType); - ServerObject* so = NULL; + ServerObject* so = nullptr; if(!JavaLibrary::getObject(client, so)) return JNI_FALSE; Client* c = so->getClient(); @@ -281,7 +281,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEffectObj(JNIEnv { JavaStringParam localEffectName(effectName); - ServerObject* so = NULL; + ServerObject* so = nullptr; if(!JavaLibrary::getObject(objectToPlayEffectOn, so)) return JNI_FALSE; /* TPERRY - This isn't used @@ -293,7 +293,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEffectObj(JNIEnv if (!objectToPlayEffectOn) return JNI_FALSE; - ServerObject* target = NULL; + ServerObject* target = nullptr; if(!JavaLibrary::getObject(objectToPlayEffectOn, target)) return JNI_FALSE; if(!target) @@ -307,7 +307,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEffectObj(JNIEnv //get the hardpoint std::string hp; - if (NULL != jHardpoint) + if (nullptr != jHardpoint) { JavaStringParam localHardpoint(jHardpoint); JavaLibrary::convert(localHardpoint, hp); @@ -315,14 +315,14 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEffectObj(JNIEnv //get the transform Transform transform; - if (NULL != jTransform) + if (nullptr != jTransform) { ScriptConversion::convert(jTransform, transform); } //get the optional labelName std::string strLabelName; - if (NULL != labelName) + if (nullptr != labelName) { JavaStringParam localLabel(labelName); JavaLibrary::convert(localLabel, strLabelName); @@ -360,7 +360,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEffectObjLimited( if (!objectToPlayEffectOn) return JNI_FALSE; - ServerObject* target = NULL; + ServerObject* target = nullptr; if(!JavaLibrary::getObject(objectToPlayEffectOn, target)) return JNI_FALSE; if(!target) @@ -374,7 +374,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEffectObjLimited( //get the hardpoint std::string hp; - if (NULL != jHardpoint) + if (nullptr != jHardpoint) { JavaStringParam localHardpoint(jHardpoint); JavaLibrary::convert(localHardpoint, hp); @@ -382,14 +382,14 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEffectObjLimited( //get the transform Transform transform; - if (NULL != jTransform) + if (nullptr != jTransform) { ScriptConversion::convert(jTransform, transform); } //get the optional labelName std::string strLabelName; - if (NULL != labelName) + if (nullptr != labelName) { JavaStringParam localLabel(labelName); JavaLibrary::convert(localLabel, strLabelName); @@ -419,7 +419,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEffectLoc(JNIEnv { JavaStringParam localEffectName(effectName); - ServerObject* so = NULL; + ServerObject* so = nullptr; if(!JavaLibrary::getObject(client, so)) return JNI_FALSE; @@ -444,7 +444,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEffectLoc(JNIEnv //get the optional labelName std::string strLabelName; - if (NULL != labelName) + if (nullptr != labelName) { JavaStringParam localLabel(labelName); JavaLibrary::convert(localLabel, strLabelName); @@ -482,7 +482,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playClientEffectLocLimited( //get the optional labelName std::string strLabelName; - if (NULL != labelName) + if (nullptr != labelName) { JavaStringParam localLabel(labelName); JavaLibrary::convert(localLabel, strLabelName); @@ -501,7 +501,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playUiEffect(JNIEnv * /*env { JavaStringParam localUiEffectString(uiEffectString); - ServerObject* so = NULL; + ServerObject* so = nullptr; if(!JavaLibrary::getObject(client, so)) { NetworkId const networkId(client); @@ -531,7 +531,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::stopClientEffectObjByLabel( { JavaStringParam localLabel(labelName); - ServerObject* so = NULL; + ServerObject* so = nullptr; if(!JavaLibrary::getObject(objectEffectIsOn, so)) return JNI_FALSE; @@ -545,7 +545,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::stopClientEffectObjByLabel( if (!objectEffectIsOn) return JNI_FALSE; - ServerObject* target = NULL; + ServerObject* target = nullptr; if(!JavaLibrary::getObject(objectEffectIsOn, target)) return JNI_FALSE; if(!target) @@ -578,7 +578,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::stopClientEffectObjByLabelL if (!objectEffectIsOn) return JNI_FALSE; - ServerObject* target = NULL; + ServerObject* target = nullptr; if(!JavaLibrary::getObject(objectEffectIsOn, target)) return JNI_FALSE; if(!target) @@ -604,7 +604,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::play2dNonLoopingMusic(JNIEn { JavaStringParam localMusicName(musicName); - ServerObject* so = NULL; + ServerObject* so = nullptr; if (!JavaLibrary::getObject(client, so)) return JNI_FALSE; Client* c = so->getClient(); @@ -628,7 +628,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::play2dNonLoopingSound(JNIEn { JavaStringParam localMusicName(musicName); - ServerObject* so = NULL; + ServerObject* so = nullptr; if (!JavaLibrary::getObject(client, so)) return JNI_FALSE; Client* c = so->getClient(); @@ -652,7 +652,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::playMusicWithParms(JNIEnv * { JavaStringParam localMusicName(musicName); - ServerObject* so = NULL; + ServerObject* so = nullptr; if (!JavaLibrary::getObject(client, so)) return JNI_FALSE; Client* c = so->getClient(); @@ -676,7 +676,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::createClientProjectile(JNIE { JavaStringParam localWeaponObjectTemplateName(weaponObjectTemplateName); - ServerObject* so = NULL; + ServerObject* so = nullptr; if (!JavaLibrary::getObject(client, so)) return JNI_FALSE; @@ -718,7 +718,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::createClientProjectileObjec { JavaStringParam localWeaponObjectTemplateName(weaponObjectTemplateName); - ServerObject* so = NULL; + ServerObject* so = nullptr; if (!JavaLibrary::getObject(client, so)) return JNI_FALSE; @@ -734,14 +734,14 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::createClientProjectileObjec return JNI_FALSE; // Get our source object - ServerObject* sourceObject = NULL; + ServerObject* sourceObject = nullptr; if (!JavaLibrary::getObject(source, sourceObject)) return JNI_FALSE; NetworkId sourceId = sourceObject->getNetworkId(); // The target of our effect - ServerObject* targetObject = NULL; + ServerObject* targetObject = nullptr; if (!JavaLibrary::getObject(target, targetObject)) return JNI_FALSE; @@ -759,8 +759,8 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::createClientProjectileObjec // Source's Cell ID CellProperty const * const cellProperty = sourceObject->getParentCell(); - Object const * const cellObject = (cellProperty != NULL) ? &cellProperty->getOwner() : NULL; - NetworkId const & networkIdForCellOrWorld = (cellObject != NULL) ? cellObject->getNetworkId() : NetworkId::cms_invalid; + Object const * const cellObject = (cellProperty != nullptr) ? &cellProperty->getOwner() : nullptr; + NetworkId const & networkIdForCellOrWorld = (cellObject != nullptr) ? cellObject->getNetworkId() : NetworkId::cms_invalid; CreateClientProjectileObjectToObjectMessage const ccpmoto(weaponObjectTemplateNameString, sourceId, sourceHardpointString, networkIdForCellOrWorld, targetId, targetHardpointString, speed, expiration, trail, PackedArgb(static_cast(a), static_cast(r), static_cast(g), static_cast(b)).getArgb()); @@ -776,7 +776,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::createClientProjectileObje { JavaStringParam localWeaponObjectTemplateName(weaponObjectTemplateName); - ServerObject* so = NULL; + ServerObject* so = nullptr; if (!JavaLibrary::getObject(client, so)) return JNI_FALSE; @@ -792,7 +792,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::createClientProjectileObje return JNI_FALSE; // Get our source object - ServerObject* sourceObject = NULL; + ServerObject* sourceObject = nullptr; if (!JavaLibrary::getObject(source, sourceObject)) return JNI_FALSE; @@ -812,8 +812,8 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::createClientProjectileObje // Source's Cell ID CellProperty const * const cellProperty = sourceObject->getParentCell(); - Object const * const cellObject = (cellProperty != NULL) ? &cellProperty->getOwner() : NULL; - NetworkId const & networkIdForCellOrWorld = (cellObject != NULL) ? cellObject->getNetworkId() : NetworkId::cms_invalid; + Object const * const cellObject = (cellProperty != nullptr) ? &cellProperty->getOwner() : nullptr; + NetworkId const & networkIdForCellOrWorld = (cellObject != nullptr) ? cellObject->getNetworkId() : NetworkId::cms_invalid; CreateClientProjectileObjectToLocationMessage const ccpmotl(weaponObjectTemplateNameString, sourceId, sourceHardpointString, networkIdForCellOrWorld, targetLocationVec, speed, expiration, trail, PackedArgb(static_cast(a), static_cast(r), static_cast(g), static_cast(b)).getArgb()); @@ -829,7 +829,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::createClientProjectileLocat { JavaStringParam localWeaponObjectTemplateName(weaponObjectTemplateName); - ServerObject* so = NULL; + ServerObject* so = nullptr; if (!JavaLibrary::getObject(client, so)) return JNI_FALSE; @@ -845,7 +845,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::createClientProjectileLocat return JNI_FALSE; // Get our target object - ServerObject* targetObject = NULL; + ServerObject* targetObject = nullptr; if (!JavaLibrary::getObject(target, targetObject)) return JNI_FALSE; @@ -865,8 +865,8 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::createClientProjectileLocat // Target's Cell ID CellProperty const * const cellProperty = targetObject->getParentCell(); - Object const * const cellObject = (cellProperty != NULL) ? &cellProperty->getOwner() : NULL; - NetworkId const & networkIdForCellOrWorld = (cellObject != NULL) ? cellObject->getNetworkId() : NetworkId::cms_invalid; + Object const * const cellObject = (cellProperty != nullptr) ? &cellProperty->getOwner() : nullptr; + NetworkId const & networkIdForCellOrWorld = (cellObject != nullptr) ? cellObject->getNetworkId() : NetworkId::cms_invalid; CreateClientProjectileLocationToObjectMessage const ccpmlto(weaponObjectTemplateNameString, sourceLocationVec, networkIdForCellOrWorld, targetId, targetHardpointString, speed, expiration, trail, PackedArgb(static_cast(a), static_cast(r), static_cast(g), static_cast(b)).getArgb()); @@ -878,7 +878,7 @@ jboolean JNICALL ScriptMethodsClientEffectNamespace::createClientProjectileLocat void JNICALL ScriptMethodsClientEffectNamespace::addObjectEffect(JNIEnv * env, jobject self, jlong obj, jstring filename, jstring hardpoint, jobject offset, jfloat scale, jstring label) { - ServerObject* so = NULL; + ServerObject* so = nullptr; if (!JavaLibrary::getObject(obj, so)) return; @@ -909,7 +909,7 @@ void JNICALL ScriptMethodsClientEffectNamespace::addObjectEffect(JNIEnv * env, j } void JNICALL ScriptMethodsClientEffectNamespace::removeObjectEffect(JNIEnv * env, jobject self, jlong obj, jstring label) { - ServerObject* so = NULL; + ServerObject* so = nullptr; if (!JavaLibrary::getObject(obj, so)) return; @@ -929,7 +929,7 @@ void JNICALL ScriptMethodsClientEffectNamespace::removeObjectEffect(JNIEnv * env void JNICALL ScriptMethodsClientEffectNamespace::removeAllObjectEffects(JNIEnv * env, jobject self, jlong obj) { - ServerObject* so = NULL; + ServerObject* so = nullptr; if (!JavaLibrary::getObject(obj, so)) return; @@ -942,7 +942,7 @@ void JNICALL ScriptMethodsClientEffectNamespace::removeAllObjectEffects(JNIEnv * jboolean JNICALL ScriptMethodsClientEffectNamespace::hasObjectEffect(JNIEnv * env, jobject self, jlong obj, jstring label) { - ServerObject* so = NULL; + ServerObject* so = nullptr; if (!JavaLibrary::getObject(obj, so)) return JNI_FALSE; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsClusterWideData.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsClusterWideData.cpp index 19df09ef..a93b72ae 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsClusterWideData.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsClusterWideData.cpp @@ -69,7 +69,7 @@ const JNINativeMethod NATIVES[] = { */ LocalRefPtr JavaLibrary::convert(const ValueDictionary & source) { - if (ms_env == NULL) + if (ms_env == nullptr) return LocalRef::cms_nullPtr; // create the dictionary @@ -150,7 +150,7 @@ void JavaLibrary::convert(const jobject & source, ValueDictionary & target) target.clear(); JNIEnv * env = getEnv(); - if (env == NULL) + if (env == nullptr) return; if (!env->IsInstanceOf(source, ms_clsDictionary)) diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsCombat.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsCombat.cpp index a12763bb..fdb842bc 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsCombat.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsCombat.cpp @@ -211,12 +211,12 @@ const JNINativeMethod NATIVES[] = { void JavaLibrary::setupWeaponCombatData(JNIEnv *env, const WeaponObject * weapon, jobject weaponData) { - if (env == NULL || weaponData == NULL) + if (env == nullptr || weaponData == nullptr) return; - if (weapon == NULL) + if (weapon == nullptr) { - env->SetObjectField(weaponData, ms_fidCombatEngineWeaponDataId, NULL); + env->SetObjectField(weaponData, ms_fidCombatEngineWeaponDataId, nullptr); return; } @@ -252,7 +252,7 @@ jint JNICALL ScriptMethodsCombatNamespace::getCombatDuration(JNIEnv * /*env*/, j NetworkId const networkId(object); TangibleObject const * const tangibleObject = TangibleObject::getTangibleObject(networkId); - if (tangibleObject == NULL) + if (tangibleObject == nullptr) { return 0; } @@ -267,7 +267,7 @@ jint JNICALL ScriptMethodsCombatNamespace::getCombatDuration(JNIEnv * /*env*/, j * @param self class calling this function * @param target id of the creature * - * @return the object id of the weapon, or NULL on error + * @return the object id of the weapon, or nullptr on error */ jlong JNICALL ScriptMethodsCombatNamespace::getCurrentWeapon(JNIEnv *env, jobject self, jlong target) { @@ -278,7 +278,7 @@ jlong JNICALL ScriptMethodsCombatNamespace::getCurrentWeapon(JNIEnv *env, jobjec return 0; const WeaponObject * weapon = creature->getCurrentWeapon(); - if (weapon == NULL) + if (weapon == nullptr) return 0; return (weapon->getNetworkId()).getValue(); @@ -313,7 +313,7 @@ jboolean JNICALL ScriptMethodsCombatNamespace::setCurrentWeapon(JNIEnv *env, job * @param self class calling this function * @param target id of the creature * - * @return the object id of the weapon, or NULL on error + * @return the object id of the weapon, or nullptr on error */ jlong JNICALL ScriptMethodsCombatNamespace::getHeldWeapon(JNIEnv *env, jobject self, jlong target) { @@ -324,7 +324,7 @@ jlong JNICALL ScriptMethodsCombatNamespace::getHeldWeapon(JNIEnv *env, jobject s return 0; const WeaponObject * weapon = creature->getReadiedWeapon(); - if (weapon == NULL) + if (weapon == nullptr) return 0; return (weapon->getNetworkId()).getValue(); @@ -337,7 +337,7 @@ jlong JNICALL ScriptMethodsCombatNamespace::getHeldWeapon(JNIEnv *env, jobject s * @param self class calling this function * @param target id of the creature * - * @return the object id of the default weapon, or NULL on error + * @return the object id of the default weapon, or nullptr on error */ jlong JNICALL ScriptMethodsCombatNamespace::getDefaultWeapon(JNIEnv *env, jobject self, jlong target) { @@ -348,7 +348,7 @@ UNREF(self); return 0; const WeaponObject * weapon = creature->getDefaultWeapon(); - if (weapon == NULL) + if (weapon == nullptr) return 0; return (weapon->getNetworkId()).getValue(); @@ -422,7 +422,7 @@ jboolean JNICALL ScriptMethodsCombatNamespace::isDefaultWeapon(JNIEnv *env, jobj return JNI_FALSE; const CreatureObject * owner = dynamic_cast(ContainerInterface::getContainedByObject(*weapon)); - if (owner == NULL || owner->getDefaultWeapon() != weapon) + if (owner == nullptr || owner->getDefaultWeapon() != weapon) return JNI_FALSE; return JNI_TRUE; @@ -441,7 +441,7 @@ jfloat JNICALL ScriptMethodsCombatNamespace::getMinRange(JNIEnv *env, jobject se { UNREF(self); - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return -1.0f; @@ -462,7 +462,7 @@ jfloat JNICALL ScriptMethodsCombatNamespace::getMaxRange(JNIEnv *env, jobject se { UNREF(self); - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return -1.0f; @@ -483,7 +483,7 @@ jfloat JNICALL ScriptMethodsCombatNamespace::getAverageDamage(JNIEnv *env, jobje { UNREF(self); - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return 0; @@ -506,7 +506,7 @@ jint JNICALL ScriptMethodsCombatNamespace::getWeaponType(JNIEnv *env, jobject se { UNREF(self); - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return -1; @@ -527,7 +527,7 @@ jint JNICALL ScriptMethodsCombatNamespace::getWeaponAttackType(JNIEnv *env, jobj { UNREF(self); - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return -1; @@ -546,7 +546,7 @@ jint JNICALL ScriptMethodsCombatNamespace::getWeaponDamageType(JNIEnv *env, jobj { UNREF(self); - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return -1; @@ -590,7 +590,7 @@ jint JNICALL ScriptMethodsCombatNamespace::getWeaponMinDamage(JNIEnv *env, jobje { UNREF(self); - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return -1; @@ -636,7 +636,7 @@ jint JNICALL ScriptMethodsCombatNamespace::getWeaponMaxDamage(JNIEnv *env, jobje { UNREF(self); - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return -1; @@ -682,7 +682,7 @@ jfloat JNICALL ScriptMethodsCombatNamespace::getWeaponAttackSpeed(JNIEnv *env, j { UNREF(self); - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return -1.0f; @@ -728,7 +728,7 @@ jfloat JNICALL ScriptMethodsCombatNamespace::getWeaponWoundChance(JNIEnv *env, j { UNREF(self); - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return -1.0f; @@ -743,13 +743,13 @@ jfloat JNICALL ScriptMethodsCombatNamespace::getWeaponWoundChance(JNIEnv *env, j * @param self class calling this function * @param weaponId the id of the weapon * - * @return the range info, or null on error + * @return the range info, or nullptr on error */ jobject JNICALL ScriptMethodsCombatNamespace::getWeaponRangeInfo(JNIEnv *env, jobject self, jlong weaponId) { UNREF(self); - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return 0; @@ -827,7 +827,7 @@ jfloat JNICALL ScriptMethodsCombatNamespace::getWeaponDamageRadius(JNIEnv *env, { UNREF(self); - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return -1.0f; @@ -865,7 +865,7 @@ jboolean JNICALL ScriptMethodsCombatNamespace::setWeaponDamageRadius(JNIEnv *env */ jfloat JNICALL ScriptMethodsCombatNamespace::getAudibleRange(JNIEnv *env, jobject self, jlong weaponId) { - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return -1; @@ -887,7 +887,7 @@ jint JNICALL ScriptMethodsCombatNamespace::getWeaponAttackCost(JNIEnv *env, jobj { UNREF(self); - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return 0; @@ -932,7 +932,7 @@ jint JNICALL ScriptMethodsCombatNamespace::getWeaponAccuracy(JNIEnv *env, jobjec { UNREF(self); - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return 0; @@ -977,7 +977,7 @@ jint JNICALL ScriptMethodsCombatNamespace::getWeaponElementalType(JNIEnv *env, j { UNREF(self); - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return 0; @@ -1022,7 +1022,7 @@ jint JNICALL ScriptMethodsCombatNamespace::getWeaponElementalValue(JNIEnv *env, { UNREF(self); - const WeaponObject *weapon = NULL; + const WeaponObject *weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return 0; @@ -1218,7 +1218,7 @@ void _startCombat(char const * const functionName, jlong attacker, jlong defende NetworkId const attackerId(attacker); TangibleObject * const attackerTangibleObject = TangibleObject::getTangibleObject(attackerId); - if (attackerTangibleObject == NULL) + if (attackerTangibleObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsCombat::%s() Unable to resolve the attacker(%s) to a TangibleObject.", functionName, attackerId.getValueString().c_str())); return; @@ -1227,7 +1227,7 @@ void _startCombat(char const * const functionName, jlong attacker, jlong defende NetworkId const defenderId(defender); TangibleObject * const defenderTangibleObject = TangibleObject::getTangibleObject(defenderId); - if (defenderTangibleObject == NULL) + if (defenderTangibleObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsCombat::%s() attacker(%s) Unable to resolve the defender(%s) to a TangibleObject.", functionName, attackerId.getValueString().c_str(), defenderId.getValueString().c_str())); return; @@ -1302,7 +1302,7 @@ void JNICALL ScriptMethodsCombatNamespace::stopCombat(JNIEnv * /*env*/, jobject NetworkId const objectId(object); TangibleObject * const tangibleObject = TangibleObject::getTangibleObject(objectId); - if (tangibleObject == NULL) + if (tangibleObject == nullptr) { return; } @@ -1334,9 +1334,9 @@ int i; int attackerCount = 0; int defenderCount = 0; - if (attackers != NULL) + if (attackers != nullptr) attackerCount = env->GetArrayLength(attackers); - if (defenders != NULL) + if (defenders != nullptr) defenderCount = env->GetArrayLength(defenders); // get the attacker and weapon data @@ -1348,22 +1348,22 @@ int i; LocalRefPtr weaponData = getObjectArrayElement(LocalObjectArrayRefParam(weaponsData), i); if (!attackerId) { - WARNING(true, ("JavaLibrary::getCombatData got null attacker id")); + WARNING(true, ("JavaLibrary::getCombatData got nullptr attacker id")); return JNI_FALSE; } if (attackerData == LocalRef::cms_nullPtr) { - WARNING(true, ("JavaLibrary::getCombatData got null attacker data")); + WARNING(true, ("JavaLibrary::getCombatData got nullptr attacker data")); return JNI_FALSE; } if (weaponData == LocalRef::cms_nullPtr) { - WARNING(true, ("JavaLibrary::getCombatData got null weapon data")); + WARNING(true, ("JavaLibrary::getCombatData got nullptr weapon data")); return JNI_FALSE; } // set up the attacker data - const TangibleObject * attacker = NULL; + const TangibleObject * attacker = nullptr; if (!JavaLibrary::getObject(attackerId, attacker)) { WARNING(true, ("JavaLibrary::getCombatData cannot get attacker object")); @@ -1377,7 +1377,7 @@ int i; ScriptConversion::convert(attacker->getPosition_p(), attacker->getSceneId(), attackerCell ? attackerCell->getNetworkId() : NetworkId::cms_invalid, location); - if (location.get() == NULL || location == LocalRef::cms_nullPtr) + if (location.get() == nullptr || location == LocalRef::cms_nullPtr) { WARNING(true, ("JavaLibrary::getCombatData cannot convert local position " "of attacker %s to Java", attacker->getNetworkId().getValueString().c_str())); @@ -1390,7 +1390,7 @@ int i; ScriptConversion::convert(attacker->getPosition_w(), attacker->getSceneId(), CellProperty::getWorldCellProperty()->getOwner().getNetworkId(), worldLocation); - if (worldLocation.get() == NULL || worldLocation == LocalRef::cms_nullPtr) + if (worldLocation.get() == nullptr || worldLocation == LocalRef::cms_nullPtr) { WARNING(true, ("JavaLibrary::getCombatData cannot convert world position " "of attacker %s to Java", attacker->getNetworkId().getValueString().c_str())); @@ -1398,14 +1398,14 @@ int i; } } - const WeaponObject * weapon = NULL; + const WeaponObject * weapon = nullptr; bool isCreature = false; int posture = 0; int locomotion = 0; int weaponSkill = 0; int aims = 0; const CreatureObject * creature = dynamic_cast(attacker); - if (creature != NULL) + if (creature != nullptr) { isCreature = true; posture = creature->getPosture(); @@ -1419,7 +1419,7 @@ int i; CombatEngineData::CombatData const * combatData = attacker->getCombatData(); - if (combatData != NULL) + if (combatData != nullptr) { aims = combatData->attackData.aims; } @@ -1446,17 +1446,17 @@ int i; LocalRefPtr defenderData = getObjectArrayElement(LocalObjectArrayRefParam(defendersData), i); if (!defenderId) { - WARNING(true, ("JavaLibrary::getCombatData got null defender id")); + WARNING(true, ("JavaLibrary::getCombatData got nullptr defender id")); return JNI_FALSE; } if (defenderData == LocalRef::cms_nullPtr) { - WARNING(true, ("JavaLibrary::getCombatData got null defender data")); + WARNING(true, ("JavaLibrary::getCombatData got nullptr defender data")); return JNI_FALSE; } // set up the defender data - const TangibleObject * defender = NULL; + const TangibleObject * defender = nullptr; if (!JavaLibrary::getObject(defenderId, defender)) { WARNING(true, ("JavaLibrary::getCombatData cannot get defender object")); @@ -1470,7 +1470,7 @@ int i; ScriptConversion::convert(defender->getPosition_p(), defender->getSceneId(), defenderCell ? defenderCell->getNetworkId() : NetworkId::cms_invalid, location); - if (location.get() == NULL || location == LocalRef::cms_nullPtr) + if (location.get() == nullptr || location == LocalRef::cms_nullPtr) { WARNING(true, ("JavaLibrary::getCombatData cannot convert local position " "of defender %s to Java", defender->getNetworkId().getValueString().c_str())); @@ -1483,7 +1483,7 @@ int i; ScriptConversion::convert(defender->getPosition_w(), defender->getSceneId(), CellProperty::getWorldCellProperty()->getOwner().getNetworkId(), worldLocation); - if (worldLocation.get() == NULL || worldLocation == LocalRef::cms_nullPtr) + if (worldLocation.get() == nullptr || worldLocation == LocalRef::cms_nullPtr) { WARNING(true, ("JavaLibrary::getCombatData cannot convert world position " "of defender %s to Java", defender->getNetworkId().getValueString().c_str())); @@ -1497,7 +1497,7 @@ int i; int combatSkeleton = defender->getCombatSkeleton(); int cover = 0; const CreatureObject * creature = dynamic_cast(defender); - if (creature != NULL) + if (creature != nullptr) { isCreature = true; posture = creature->getPosture(); @@ -1557,7 +1557,7 @@ jboolean JNICALL ScriptMethodsCombatNamespace::getWeaponData(JNIEnv *env, jobjec if (weapon == 0 || weaponData == 0) return JNI_FALSE; - const WeaponObject * localWeapon = NULL; + const WeaponObject * localWeapon = nullptr; if (!JavaLibrary::getObject(weapon, localWeapon)) return JNI_FALSE; @@ -1587,15 +1587,15 @@ jboolean JNICALL ScriptMethodsCombatNamespace::doDamage(JNIEnv *env, jobject sel if (damage <= 0) return JNI_TRUE; - TangibleObject * attacker = NULL; + TangibleObject * attacker = nullptr; if (!JavaLibrary::getObject(attackerId, attacker)) return JNI_FALSE; - TangibleObject * defender = NULL; + TangibleObject * defender = nullptr; if (!JavaLibrary::getObject(defenderId, defender)) return JNI_FALSE; - WeaponObject * weapon = NULL; + WeaponObject * weapon = nullptr; if (!JavaLibrary::getObject(weaponId, weapon)) return JNI_FALSE; @@ -1627,11 +1627,11 @@ jboolean JNICALL ScriptMethodsCombatNamespace::doDamageNoWeapon(JNIEnv *env, job if (damage <= 0) return JNI_TRUE; - TangibleObject * attacker = NULL; + TangibleObject * attacker = nullptr; if (!JavaLibrary::getObject(attackerId, attacker)) return JNI_FALSE; - TangibleObject * defender = NULL; + TangibleObject * defender = nullptr; if (!JavaLibrary::getObject(defenderId, defender)) return JNI_FALSE; @@ -1699,7 +1699,7 @@ jboolean JNICALL ScriptMethodsCombatNamespace::doCombatResults(JNIEnv *env, jobj { message->setAttacker(attacker, weapon); CreatureObject * creature = dynamic_cast(attacker.getObject()); - if (creature != NULL) + if (creature != nullptr) { Postures::Enumerator posture = static_cast( env->GetIntField(attackerResult, JavaLibrary::getFidBaseClassAttackerResultsPosture())); @@ -1816,7 +1816,7 @@ jboolean JNICALL ScriptMethodsCombatNamespace::doCombatResults(JNIEnv *env, jobj // send the message Controller *const controller = attacker.getObject()->getController(); - if (controller != NULL) + if (controller != nullptr) { float f_hold_ms = ConfigServerGame::getCombatDamageDelaySeconds() * 1000.0f; if ( f_hold_ms < 1.0 ) // 0 hold time (allowing for rounding error) @@ -1834,7 +1834,7 @@ jboolean JNICALL ScriptMethodsCombatNamespace::doCombatResults(JNIEnv *env, jobj { MessageQueueCombatAction *held = (MessageQueueCombatAction*)controller->peekHeldMessage( CM_combatAction ); bool b_merge = true; - if ( held == NULL ) + if ( held == nullptr ) b_merge = false; else if ( held->getComparisonChecksum() != message->getComparisonChecksum() ) b_merge = false; @@ -1900,24 +1900,24 @@ jboolean JNICALL ScriptMethodsCombatNamespace::callDefenderCombatAction(JNIEnv * { // use the attacker's current weapon CreatureObject * creatureAttacker = dynamic_cast(attackerId.getObject()); - if (creatureAttacker != NULL) + if (creatureAttacker != nullptr) { const WeaponObject * weaponObject = creatureAttacker->getCurrentWeapon(); - if (weaponObject != NULL) + if (weaponObject != nullptr) weaponId = weaponObject->getNetworkId(); } else { const WeaponObject * weaponAttacker = dynamic_cast( attackerId.getObject()); - if (weaponAttacker != NULL) + if (weaponAttacker != nullptr) weaponId = weaponAttacker->getNetworkId(); } } // call the trigger for each defender - jint * resultsArray = env->GetIntArrayElements(results, NULL); - if (resultsArray == NULL) + jint * resultsArray = env->GetIntArrayElements(results, nullptr); + if (resultsArray == nullptr) return JNI_FALSE; for (jsize i = 0; i < defenderCount; ++i) @@ -1927,11 +1927,11 @@ jboolean JNICALL ScriptMethodsCombatNamespace::callDefenderCombatAction(JNIEnv * if (defender) { CachedNetworkId defenderId(defender); - if (defenderId.getObject() != NULL) + if (defenderId.getObject() != nullptr) { ServerObject * defenderObject = safe_cast( defenderId.getObject()); - if (defenderObject->getScriptObject() != NULL) + if (defenderObject->getScriptObject() != nullptr) { ScriptParams params; params.addParam(attackerId); @@ -1961,7 +1961,7 @@ jboolean JNICALL ScriptMethodsCombatNamespace::callDefenderCombatAction(JNIEnv * */ void JNICALL ScriptMethodsCombatNamespace::setWantSawAttackTriggers(JNIEnv *env, jobject self, jlong obj, jboolean enable) { - TangibleObject * tangible = NULL; + TangibleObject * tangible = nullptr; if (!JavaLibrary::getObject(obj, tangible)) { @@ -2021,7 +2021,7 @@ jboolean JNICALL ScriptMethodsCombatNamespace::addSlowDownEffect(JNIEnv *env, jo return JNI_FALSE; } - CreatureObject * attackerObject = NULL; + CreatureObject * attackerObject = nullptr; if (!JavaLibrary::getObject(attacker, attackerObject)) { WARNING(true, ("[script bug] JavaLibrary::addSlowDownEffect called " @@ -2029,7 +2029,7 @@ jboolean JNICALL ScriptMethodsCombatNamespace::addSlowDownEffect(JNIEnv *env, jo return JNI_FALSE; } - const TangibleObject * defenderObject = NULL; + const TangibleObject * defenderObject = nullptr; if (!JavaLibrary::getObject(defender, defenderObject)) { WARNING(true, ("[script bug] JavaLibrary::addSlowDownEffect called " @@ -2057,7 +2057,7 @@ jboolean JNICALL ScriptMethodsCombatNamespace::addSlowDownEffect(JNIEnv *env, jo */ jboolean JNICALL ScriptMethodsCombatNamespace::removeSlowDownEffect(JNIEnv *env, jobject self, jlong attacker) { - CreatureObject * attackerObject = NULL; + CreatureObject * attackerObject = nullptr; if (!JavaLibrary::getObject(attacker, attackerObject)) { WARNING(true, ("[script bug] JavaLibrary::removeSlowDownEffect called " @@ -2090,14 +2090,14 @@ void JNICALL ScriptMethodsCombatNamespace::sendCombatSpam(JNIEnv *env, jobject s { NetworkId attackerId(attacker); ServerObject * attackerObj = safe_cast(NetworkIdManager::getObjectById(attackerId)); - if (attackerObj == NULL) + if (attackerObj == nullptr) { WARNING(true, ("WARNING: JavaLibrary::sendCombatSpam could not find attacker for id %s", attackerId.getValueString().c_str())); return; } NetworkId defenderId(defender); - Object const * const defenderObj = (defenderId.isValid() ? NetworkIdManager::getObjectById(defenderId) : NULL); + Object const * const defenderObj = (defenderId.isValid() ? NetworkIdManager::getObjectById(defenderId) : nullptr); NetworkId weaponId(weapon); StringId attackNameSid; @@ -2189,14 +2189,14 @@ void JNICALL ScriptMethodsCombatNamespace::sendCombatSpamWeaponString(JNIEnv *en { NetworkId attackerId(attacker); ServerObject * attackerObj = safe_cast(NetworkIdManager::getObjectById(attackerId)); - if (attackerObj == NULL) + if (attackerObj == nullptr) { WARNING(true, ("WARNING: JavaLibrary::sendCombatSpam could not find attacker for id %s", attackerId.getValueString().c_str())); return; } NetworkId defenderId(defender); - Object const * const defenderObj = (defenderId.isValid() ? NetworkIdManager::getObjectById(defenderId) : NULL); + Object const * const defenderObj = (defenderId.isValid() ? NetworkIdManager::getObjectById(defenderId) : nullptr); StringId weaponNameSid; if (!ScriptConversion::convert(weaponName, weaponNameSid)) @@ -2287,12 +2287,12 @@ void JNICALL ScriptMethodsCombatNamespace::sendCombatSpamWeaponString(JNIEnv *en */ void JNICALL ScriptMethodsCombatNamespace::sendCombatSpamMessage(JNIEnv *env, jobject self, jlong attacker, jlong defender, jobject message, jboolean sendToAttacker, jboolean sendToDefender, jboolean sendToBystanders, jint spamType) { - ServerObject * attackerObj = NULL; + ServerObject * attackerObj = nullptr; if (!JavaLibrary::getObject(attacker, attackerObj)) return; NetworkId defenderId(defender); - Object const * const defenderObj = (defenderId.isValid() ? NetworkIdManager::getObjectById(defenderId) : NULL); + Object const * const defenderObj = (defenderId.isValid() ? NetworkIdManager::getObjectById(defenderId) : nullptr); StringId messageSid; if (!ScriptConversion::convert(message, messageSid)) @@ -2322,12 +2322,12 @@ void JNICALL ScriptMethodsCombatNamespace::sendCombatSpamMessage(JNIEnv *env, jo */ void JNICALL ScriptMethodsCombatNamespace::sendCombatSpamMessageCGP(JNIEnv *env, jobject self, jlong attacker, jlong defender, jobject message, jboolean sendToAttacker, jboolean sendToDefender, jboolean sendToBystanders, jboolean critical, jboolean glancing, jboolean proc, jint spamType) { - ServerObject * attackerObj = NULL; + ServerObject * attackerObj = nullptr; if (!JavaLibrary::getObject(attacker, attackerObj)) return; NetworkId defenderId(defender); - Object const * const defenderObj = (defenderId.isValid() ? NetworkIdManager::getObjectById(defenderId) : NULL); + Object const * const defenderObj = (defenderId.isValid() ? NetworkIdManager::getObjectById(defenderId) : nullptr); StringId messageSid; if (!ScriptConversion::convert(message, messageSid)) @@ -2353,12 +2353,12 @@ void JNICALL ScriptMethodsCombatNamespace::sendCombatSpamMessageCGP(JNIEnv *env, */ void JNICALL ScriptMethodsCombatNamespace::sendCombatSpamMessageOob(JNIEnv *env, jobject self, jlong attacker, jlong defender, jstring oob, jboolean sendToAttacker, jboolean sendToDefender, jboolean sendToBystanders, jint spamType) { - ServerObject * attackerObj = NULL; + ServerObject * attackerObj = nullptr; if (!JavaLibrary::getObject(attacker, attackerObj)) return; NetworkId defenderId(defender); - Object const * const defenderObj = (defenderId.isValid() ? NetworkIdManager::getObjectById(defenderId) : NULL); + Object const * const defenderObj = (defenderId.isValid() ? NetworkIdManager::getObjectById(defenderId) : nullptr); Unicode::String oobString; if (!JavaLibrary::convert(JavaStringParam(oob), oobString)) diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsCommandQueue.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsCommandQueue.cpp index 2e400a0b..c95a74cb 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsCommandQueue.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsCommandQueue.cpp @@ -97,7 +97,7 @@ jboolean JNICALL ScriptMethodsCommandQueueNamespace::queueCommand(JNIEnv *env, j NetworkId actorId(actor); TangibleObject * const actorTangibleObject = TangibleObject::getTangibleObject(actorId); - if (actorTangibleObject == NULL) + if (actorTangibleObject == nullptr) { WARNING(true, ("JavaLibrary::queueCommand() Unable to resolve actor(%s) to a TangibleObject", actorId.getValueString().c_str())); return JNI_FALSE; @@ -142,7 +142,7 @@ jboolean JNICALL ScriptMethodsCommandQueueNamespace::queueClear(JNIEnv *env, job NetworkId actorId(actor); TangibleObject * const actorTangibleObject = TangibleObject::getTangibleObject(actorId); - if (actorTangibleObject == NULL) + if (actorTangibleObject == nullptr) { WARNING(true, ("JavaLibrary::queueClear() Unable to resolve actor(%s) to a TangibleObject", actorId.getValueString().c_str())); return JNI_FALSE; @@ -170,7 +170,7 @@ jboolean JNICALL ScriptMethodsCommandQueueNamespace::queueHasCommandFromGroup(JN NetworkId actorId(actor); TangibleObject * const actorTangibleObject = TangibleObject::getTangibleObject(actorId); - if (actorTangibleObject == NULL) + if (actorTangibleObject == nullptr) { WARNING(true, ("JavaLibrary::queueHasCommandFromGroup() Unable to resolve actor(%s) to a TangibleObject", actorId.getValueString().c_str())); return JNI_FALSE; @@ -196,7 +196,7 @@ jboolean JNICALL ScriptMethodsCommandQueueNamespace::queueClearCommandsFromGroup NetworkId actorId(actor); TangibleObject * const actorTangibleObject = TangibleObject::getTangibleObject(actorId); - if (actorTangibleObject == NULL) + if (actorTangibleObject == nullptr) { WARNING(true, ("JavaLibrary::queueClearCommandsFromGroup() Unable to resolve actor(%s) to a TangibleObject", actorId.getValueString().c_str())); return JNI_FALSE; @@ -239,14 +239,14 @@ jboolean JNICALL ScriptMethodsCommandQueueNamespace::setCommandTimerValue( JNIEn NetworkId actorId(actor); TangibleObject * const actorTangibleObject = TangibleObject::getTangibleObject(actorId); - if (actorTangibleObject == NULL) + if (actorTangibleObject == nullptr) { WARNING(true, ("JavaLibrary::setCommandTimerValue() Unable to resolve actor(%s) to a TangibleObject", actorId.getValueString().c_str())); return JNI_FALSE; } CommandQueue * const queue = actorTangibleObject->getCommandQueue(); - if (queue == NULL) + if (queue == nullptr) { WARNING(true, ("JavaLibrary::setCommandTimerValue() object(%s) does not have a CommandQueue", actorTangibleObject->getDebugInformation().c_str())); return JNI_FALSE; @@ -267,7 +267,7 @@ jint JNICALL ScriptMethodsCommandQueueNamespace::getCurrentCommand( JNIEnv *env, NetworkId actorId(actor); TangibleObject * const actorTangibleObject = TangibleObject::getTangibleObject(actorId); - if (actorTangibleObject == NULL) + if (actorTangibleObject == nullptr) { WARNING(true, ("JavaLibrary::getCurrentCommand() Unable to resolve actor(%s) to a TangibleObject", actorId.getValueString().c_str())); return 0; @@ -275,7 +275,7 @@ jint JNICALL ScriptMethodsCommandQueueNamespace::getCurrentCommand( JNIEnv *env, CommandQueue const * const queue = actorTangibleObject->getCommandQueue(); - if (queue == NULL) + if (queue == nullptr) { WARNING(true, ("JavaLibrary::getCurrentCommand() object(%s) does not have a CommandQueue", actorTangibleObject->getDebugInformation().c_str())); return 0; @@ -298,7 +298,7 @@ jfloat JNICALL ScriptMethodsCommandQueueNamespace::getCooldownTimeLeft( JNIEnv * NetworkId actorId(actor); TangibleObject * const actorTangibleObject = TangibleObject::getTangibleObject(actorId); - if (actorTangibleObject == NULL) + if (actorTangibleObject == nullptr) { WARNING(true, ("JavaLibrary::getCooldownTimeLeft() Unable to resolve actor(%s) to a TangibleObject", actorId.getValueString().c_str())); return 0.0f; @@ -306,7 +306,7 @@ jfloat JNICALL ScriptMethodsCommandQueueNamespace::getCooldownTimeLeft( JNIEnv * CommandQueue const * const queue = actorTangibleObject->getCommandQueue(); - if (queue == NULL) + if (queue == nullptr) { WARNING(true, ("JavaLibrary::getCooldownTimeLeft() object(%s) does not have a CommandQueue", actorTangibleObject->getDebugInformation().c_str())); return 0.0f; @@ -329,7 +329,7 @@ jfloat JNICALL ScriptMethodsCommandQueueNamespace::getCooldownTimeLeftString( JN NetworkId actorId(actor); TangibleObject * const actorTangibleObject = TangibleObject::getTangibleObject(actorId); - if (actorTangibleObject == NULL) + if (actorTangibleObject == nullptr) { WARNING(true, ("JavaLibrary::getCooldownTimeLeftString() Unable to resolve actor(%s) to a TangibleObject", actorId.getValueString().c_str())); return 0.0f; @@ -347,13 +347,13 @@ jfloat JNICALL ScriptMethodsCommandQueueNamespace::getCooldownTimeLeftString( JN CommandQueue const * const queue = actorTangibleObject->getCommandQueue(); float value = 0.0f; - if (queue == NULL) + if (queue == nullptr) { WARNING(true, ("JavaLibrary::getCooldownTimeLeftString() object(%s) does not have a CommandQueue", actorTangibleObject->getDebugInformation().c_str())); return 0.0f; } - if (queue != NULL) + if (queue != nullptr) { value = queue->getCooldownTimeLeft( out ); } @@ -369,7 +369,7 @@ void JNICALL ScriptMethodsCommandQueueNamespace::sendCooldownGroupTimingOnly(JNI NetworkId actorId(actor); CreatureObject * const actorCreatureObject = CreatureObject::getCreatureObject(actorId); - if (actorCreatureObject == NULL) + if (actorCreatureObject == nullptr) { WARNING(true, ("JavaLibrary::sendCooldownGroupTimingOnly() Unable to resolve actor(%s) to a CreatureObject", actorId.getValueString().c_str())); return; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsConsole.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsConsole.cpp index 9392677f..0355fb72 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsConsole.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsConsole.cpp @@ -52,10 +52,10 @@ void JNICALL ScriptMethodsConsoleNamespace::consoleSendMessageObjId(JNIEnv * env const ServerObject* player = 0; if(!JavaLibrary::getObject(_to, player)) { - DEBUG_WARNING (true, ("ScriptMethodsConsole JavaLibrary::consoleSendMessageObjId failed bad source object (not null)")); + DEBUG_WARNING (true, ("ScriptMethodsConsole JavaLibrary::consoleSendMessageObjId failed bad source object (not nullptr)")); if (ConfigServerScript::allowDebugConsoleMessages()) { - fprintf(stderr, "WARNING: ScriptMethodsConsole JavaLibrary::consoleSendMessageObjId: failed bad source object (not null)\n"); + fprintf(stderr, "WARNING: ScriptMethodsConsole JavaLibrary::consoleSendMessageObjId: failed bad source object (not nullptr)\n"); JavaLibrary::printJavaStack(); } return; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsContainers.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsContainers.cpp index 12a63612..acb9aba9 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsContainers.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsContainers.cpp @@ -136,7 +136,7 @@ const JNINativeMethod NATIVES[] = { jint JNICALL ScriptMethodsContainersNamespace::getContainerType(JNIEnv *env, jobject self, jlong container) { //@todo use enum - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) return 0; @@ -151,7 +151,7 @@ jint JNICALL ScriptMethodsContainersNamespace::getContainerType(JNIEnv *env, job jlongArray JNICALL ScriptMethodsContainersNamespace::getContents(JNIEnv *env, jobject self, jlong containerObj) { - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(containerObj, containerOwner)) return 0; @@ -190,7 +190,7 @@ jlongArray JNICALL ScriptMethodsContainersNamespace::getContents(JNIEnv *env, jo jlong JNICALL ScriptMethodsContainersNamespace::getContainedBy(JNIEnv *env, jobject self, jlong item) { - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(item, itemObj)) return 0; @@ -211,7 +211,7 @@ jboolean JNICALL ScriptMethodsContainersNamespace::contains(JNIEnv *env, jobject if (container_id.getValue() == 0) return JNI_FALSE; - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(item, itemObj)) return JNI_FALSE; @@ -226,11 +226,11 @@ jboolean JNICALL ScriptMethodsContainersNamespace::contains(JNIEnv *env, jobject jint JNICALL ScriptMethodsContainersNamespace::canPutIn(JNIEnv *env, jobject self, jlong target, jlong jcontainer) { const int unknownError = static_cast(Container::CEC_Unknown); - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(jcontainer, containerOwner)) return unknownError; - ServerObject * item = NULL; + ServerObject * item = nullptr; if (!JavaLibrary::getObject(target, item)) return unknownError; @@ -248,11 +248,11 @@ jint JNICALL ScriptMethodsContainersNamespace::canPutIn(JNIEnv *env, jobject sel jint JNICALL ScriptMethodsContainersNamespace::canPutInSlot(JNIEnv *env, jobject self, jlong target, jlong jcontainer, jstring slot) { const int unknownError = static_cast(Container::CEC_Unknown); - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(jcontainer, containerOwner)) return unknownError; - ServerObject * item = NULL; + ServerObject * item = nullptr; if (!JavaLibrary::getObject(target, item)) return unknownError; @@ -268,7 +268,7 @@ jint JNICALL ScriptMethodsContainersNamespace::canPutInSlot(JNIEnv *env, jobject if (slotId == SlotId::invalid) return static_cast(Container::CEC_NoSlot); - IGNORE_RETURN(ContainerInterface::canTransferToSlot(*containerOwner, *item, slotId, NULL, tmp)); + IGNORE_RETURN(ContainerInterface::canTransferToSlot(*containerOwner, *item, slotId, nullptr, tmp)); return static_cast(tmp); } @@ -279,7 +279,7 @@ jlong JNICALL ScriptMethodsContainersNamespace::getObjectInSlot(JNIEnv *env, job { JavaStringParam localSlot(slot); - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) return 0; @@ -301,7 +301,7 @@ jlong JNICALL ScriptMethodsContainersNamespace::getObjectInSlot(JNIEnv *env, job jlong JNICALL ScriptMethodsContainersNamespace::getFirstParentInWorld(JNIEnv *env, jobject self, jlong item) { - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(item, itemObj)) return 0; @@ -316,7 +316,7 @@ jlong JNICALL ScriptMethodsContainersNamespace::getFirstParentInWorld(JNIEnv *en jlong JNICALL ScriptMethodsContainersNamespace::getTopMostContainer(JNIEnv *env, jobject self, jlong item) { - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(item, itemObj)) return 0; @@ -331,7 +331,7 @@ jlong JNICALL ScriptMethodsContainersNamespace::getTopMostContainer(JNIEnv *env, jint JNICALL ScriptMethodsContainersNamespace::getNumItemsIn(JNIEnv *env, jobject self, jlong container) { - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) return 0; @@ -347,7 +347,7 @@ jint JNICALL ScriptMethodsContainersNamespace::getNumItemsIn(JNIEnv *env, jobjec void JNICALL ScriptMethodsContainersNamespace::destroyContents(JNIEnv *env, jobject self, jlong container) { #if 0 //@todo implement - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) return; @@ -359,11 +359,11 @@ void JNICALL ScriptMethodsContainersNamespace::destroyContents(JNIEnv *env, jobj jint JNICALL ScriptMethodsContainersNamespace::moveContents(JNIEnv *env, jobject self, jlong containerA, jlong containerB) { - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(containerA, containerOwner)) return 0; - ServerObject * targetContainer = NULL; + ServerObject * targetContainer = nullptr; if (!JavaLibrary::getObject(containerB, targetContainer)) return 0; @@ -377,7 +377,7 @@ jint JNICALL ScriptMethodsContainersNamespace::moveContents(JNIEnv *env, jobject for (; iter != container->end(); ++iter) { ServerObject* item = safe_cast((*iter).getObject()); - if (item && ContainerInterface::transferItemToGeneralContainer(*targetContainer, *item, NULL, tmp)) + if (item && ContainerInterface::transferItemToGeneralContainer(*targetContainer, *item, nullptr, tmp)) { ++count; } @@ -389,20 +389,20 @@ jint JNICALL ScriptMethodsContainersNamespace::moveContents(JNIEnv *env, jobject jint JNICALL ScriptMethodsContainersNamespace::moveObjects(JNIEnv *env, jobject self, jlongArray targets, jlong container) { - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) return 0; int count = 0; for (int i = 0; i < env->GetArrayLength(targets); ++i) { - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; jlong jlongTmp; env->GetLongArrayRegion(targets, i, 1, &jlongTmp); if (JavaLibrary::getObject(jlongTmp, itemObj)) { Container::ContainerErrorCode tmp = Container::CEC_Success; - if (ContainerInterface::transferItemToGeneralContainer(*containerOwner, *itemObj, NULL, tmp)) + if (ContainerInterface::transferItemToGeneralContainer(*containerOwner, *itemObj, nullptr, tmp)) { ++count; } @@ -417,15 +417,15 @@ jint JNICALL ScriptMethodsContainersNamespace::moveObjects(JNIEnv *env, jobject jboolean JNICALL ScriptMethodsContainersNamespace::putIn(JNIEnv *env, jobject self, jlong item, jlong container) { - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) return JNI_FALSE; - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(item, itemObj)) return JNI_FALSE; Container::ContainerErrorCode tmp = Container::CEC_Success; - return ContainerInterface::transferItemToGeneralContainer(*containerOwner, *itemObj, NULL, tmp); + return ContainerInterface::transferItemToGeneralContainer(*containerOwner, *itemObj, nullptr, tmp); } @@ -434,11 +434,11 @@ jboolean JNICALL ScriptMethodsContainersNamespace::putIn(JNIEnv *env, jobject se jboolean JNICALL ScriptMethodsContainersNamespace::putInPosition(JNIEnv *env, jobject self, jlong item, jlong container, jobject pos) { - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) return JNI_FALSE; - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(item, itemObj)) return JNI_FALSE; @@ -451,7 +451,7 @@ jboolean JNICALL ScriptMethodsContainersNamespace::putInPosition(JNIEnv *env, jo tr.setPosition_p(newPos); Container::ContainerErrorCode tmp = Container::CEC_Success; - return ContainerInterface::transferItemToCell(*containerOwner, *itemObj, tr, NULL, tmp); + return ContainerInterface::transferItemToCell(*containerOwner, *itemObj, tr, nullptr, tmp); } //-------------------------------------------------------------------------------------- @@ -459,20 +459,20 @@ jboolean JNICALL ScriptMethodsContainersNamespace::putInPosition(JNIEnv *env, jo jboolean JNICALL ScriptMethodsContainersNamespace::putInAndSendError(JNIEnv *env, jobject self, jlong item, jlong container, jlong player) { - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) return JNI_FALSE; - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(item, itemObj)) return JNI_FALSE; Container::ContainerErrorCode tmp = Container::CEC_Success; - bool retval = ContainerInterface::transferItemToGeneralContainer(*containerOwner, *itemObj, NULL, tmp); + bool retval = ContainerInterface::transferItemToGeneralContainer(*containerOwner, *itemObj, nullptr, tmp); if (!retval) { - ServerObject * playerObj = NULL; + ServerObject * playerObj = nullptr; if (!JavaLibrary::getObject(player, playerObj)) return JNI_FALSE; ContainerInterface::sendContainerMessageToClient(*playerObj, tmp); @@ -483,11 +483,11 @@ jboolean JNICALL ScriptMethodsContainersNamespace::putInAndSendError(JNIEnv *env //-------------------------------------------------------------------------------------- jboolean JNICALL ScriptMethodsContainersNamespace::putInOverloaded(JNIEnv *env, jobject self, jlong item, jlong container) { - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) return JNI_FALSE; - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(item, itemObj)) return JNI_FALSE; @@ -500,7 +500,7 @@ jboolean JNICALL ScriptMethodsContainersNamespace::putInOverloaded(JNIEnv *env, } else { - retval = ContainerInterface::transferItemToVolumeContainer(*containerOwner, *itemObj, NULL, tmp, true); + retval = ContainerInterface::transferItemToVolumeContainer(*containerOwner, *itemObj, nullptr, tmp, true); } return retval; @@ -509,11 +509,11 @@ jboolean JNICALL ScriptMethodsContainersNamespace::putInOverloaded(JNIEnv *env, //-------------------------------------------------------------------------------------- jboolean JNICALL ScriptMethodsContainersNamespace::equip(JNIEnv *env, jobject self, jlong item, jlong container) { - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) return JNI_FALSE; - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(item, itemObj)) return JNI_FALSE; @@ -521,7 +521,7 @@ jboolean JNICALL ScriptMethodsContainersNamespace::equip(JNIEnv *env, jobject se if (!test) return JNI_FALSE; Container::ContainerErrorCode tmp = Container::CEC_Success; - return ContainerInterface::transferItemToGeneralContainer(*containerOwner, *itemObj, NULL, tmp); + return ContainerInterface::transferItemToGeneralContainer(*containerOwner, *itemObj, nullptr, tmp); } @@ -532,11 +532,11 @@ jboolean JNICALL ScriptMethodsContainersNamespace::equipIn(JNIEnv *env, jobject JavaStringParam localSlot(slot); //@todo better error checking for invalid slot name. Do it above too. - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) return JNI_FALSE; - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(item, itemObj)) return JNI_FALSE; @@ -554,7 +554,7 @@ jboolean JNICALL ScriptMethodsContainersNamespace::equipIn(JNIEnv *env, jobject Container::ContainerErrorCode tmp = Container::CEC_Success; int arrangement = slotted ? slotted->getBestArrangementForSlot(slotName) : -1; - return ContainerInterface::transferItemToSlottedContainer(*containerOwner, *itemObj, arrangement, NULL, tmp); + return ContainerInterface::transferItemToSlottedContainer(*containerOwner, *itemObj, arrangement, nullptr, tmp); } @@ -565,14 +565,14 @@ jboolean JNICALL ScriptMethodsContainersNamespace::equipOverride(JNIEnv *env, j //This function will equip and object into the first valid arrangement, deleting objects if necessary. //Before it deletes things, it looks for a valid unoccupied arrangement. - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) { DEBUG_WARNING(true, ("JNI: EquipOverride param container could not be found")); return JNI_FALSE; } - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(item, itemObj)) { DEBUG_WARNING(true, ("JNI: EquipOverride param item could not be found")); @@ -592,7 +592,7 @@ jboolean JNICALL ScriptMethodsContainersNamespace::equipOverride(JNIEnv *env, j if (slotContainer->getFirstUnoccupiedArrangement(*itemObj, arrangement, tmp)) { //Found one - return ContainerInterface::transferItemToSlottedContainer(*containerOwner, *itemObj, arrangement, NULL, tmp); + return ContainerInterface::transferItemToSlottedContainer(*containerOwner, *itemObj, arrangement, nullptr, tmp); } //Couldn't find an unoccupied arrangement, so it's time to delete objects to make room for this one @@ -634,14 +634,14 @@ jboolean JNICALL ScriptMethodsContainersNamespace::equipOverride(JNIEnv *env, j } } - return ContainerInterface::transferItemToSlottedContainer(*containerOwner, *itemObj, arrangement, NULL, tmp); + return ContainerInterface::transferItemToSlottedContainer(*containerOwner, *itemObj, arrangement, nullptr, tmp); } //-------------------------------------------------------------------------------------- jint JNICALL ScriptMethodsContainersNamespace::getFilledVolume(JNIEnv *env, jobject self, jlong container) { - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) return 0; @@ -656,7 +656,7 @@ jint JNICALL ScriptMethodsContainersNamespace::getFilledVolume(JNIEnv *env, jobj jint JNICALL ScriptMethodsContainersNamespace::getTotalVolume(JNIEnv *env, jobject self, jlong container) { - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) return 0; @@ -672,7 +672,7 @@ jint JNICALL ScriptMethodsContainersNamespace::getTotalVolume(JNIEnv *env, jobje jint JNICALL ScriptMethodsContainersNamespace::getVolumeFree(JNIEnv *env, jobject self, jlong container) { - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) return 0; @@ -691,7 +691,7 @@ void JNICALL ScriptMethodsContainersNamespace::sendContainerErrorToClient(JNIEnv if (errorCode == 0) return; - ServerObject * playerObject = NULL; + ServerObject * playerObject = nullptr; if (!JavaLibrary::getObject(player, playerObject)) { DEBUG_WARNING(true, ("Player object not found in sendContainerErrorToClient")); @@ -767,7 +767,7 @@ void JNICALL ScriptMethodsContainersNamespace::moveToOfflinePlayerDatapadAndUnlo jboolean JNICALL ScriptMethodsContainersNamespace::isInSecureTrade(JNIEnv *env, jobject self, jlong item) { - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(item, itemObj)) return JNI_FALSE; @@ -807,7 +807,7 @@ void JNICALL ScriptMethodsContainersNamespace::fixLoadWith(JNIEnv *env, jobject jboolean JNICALL ScriptMethodsContainersNamespace::addUserToAccessList(JNIEnv *env, jobject self, jlong object, jlong user) { - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(object, itemObj)) return JNI_FALSE; @@ -829,7 +829,7 @@ jboolean JNICALL ScriptMethodsContainersNamespace::addUserToAccessList(JNIEnv *e jboolean JNICALL ScriptMethodsContainersNamespace::removeUserFromAccessList(JNIEnv * env, jobject self, jlong object, jlong user) { - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(object, itemObj)) return JNI_FALSE; @@ -851,7 +851,7 @@ jboolean JNICALL ScriptMethodsContainersNamespace::removeUserFromAccessList(JNIE jboolean JNICALL ScriptMethodsContainersNamespace::clearUserAccessList(JNIEnv * env, jobject self, jlong object) { - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(object, itemObj)) return JNI_FALSE; @@ -871,7 +871,7 @@ jboolean JNICALL ScriptMethodsContainersNamespace::clearUserAccessList(JNIEnv * jboolean JNICALL ScriptMethodsContainersNamespace::addGuildToAccessList(JNIEnv *env, jobject self, jlong object, jint guild) { - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(object, itemObj)) return JNI_FALSE; @@ -891,7 +891,7 @@ jboolean JNICALL ScriptMethodsContainersNamespace::addGuildToAccessList(JNIEnv * jboolean JNICALL ScriptMethodsContainersNamespace::removeGuildFromAccessList(JNIEnv * env, jobject self, jlong object, jint guild) { - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(object, itemObj)) return JNI_FALSE; @@ -911,7 +911,7 @@ jboolean JNICALL ScriptMethodsContainersNamespace::removeGuildFromAccessList(JNI jboolean JNICALL ScriptMethodsContainersNamespace::clearGuildAccessList(JNIEnv * env, jobject self, jlong object) { - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(object, itemObj)) return JNI_FALSE; @@ -931,7 +931,7 @@ jboolean JNICALL ScriptMethodsContainersNamespace::clearGuildAccessList(JNIEnv * jlongArray JNICALL ScriptMethodsContainersNamespace::getUserAccessList(JNIEnv * env, jobject self, jlong object) { - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(object, itemObj)) return JNI_FALSE; @@ -970,7 +970,7 @@ jlongArray JNICALL ScriptMethodsContainersNamespace::getUserAccessList(JNIEnv * jintArray JNICALL ScriptMethodsContainersNamespace::getGuildAccessList(JNIEnv * env, jobject self, jlong object) { - ServerObject * itemObj = NULL; + ServerObject * itemObj = nullptr; if (!JavaLibrary::getObject(object, itemObj)) return JNI_FALSE; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsCrafting.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsCrafting.cpp index b5d325eb..735a0d23 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsCrafting.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsCrafting.cpp @@ -232,7 +232,7 @@ void ScriptMethodsCraftingNamespace::collectRangedIntVariableCallback(const std: * @param draftSchematic draft schematic the attribute belongs to * @param attribIndex index of the attribute * - * @return the attribute instance, or NULL on error + * @return the attribute instance, or nullptr on error */ LocalRefPtr JavaLibrary::createObjectAttribute(const ManufactureObjectInterface & manfSchematic, const DraftSchematicObject & draftSchematic, int attribIndex) @@ -291,7 +291,7 @@ LocalRefPtr JavaLibrary::createObjectAttribute(const ManufactureObjectInterface * @param manfSchematic manufacture schematic the attribute belongs to * @param attribName name of the attribute * - * @return the attribute instance, or NULL on error + * @return the attribute instance, or nullptr on error */ LocalRefPtr JavaLibrary::createExperimentAttribute(const ManufactureObjectInterface & manfSchematic, const StringId & attribName) @@ -341,7 +341,7 @@ int i; const DraftSchematicObject * draft = DraftSchematicObject::getSchematic( source.getDraftSchematic()); - if (draft == NULL) + if (draft == nullptr) return LocalRef::cms_nullPtr; LocalRefPtr target = allocObject(ms_clsDraftSchematic); @@ -501,7 +501,7 @@ int i; // set the customization info from the shared object template const ServerObjectTemplate * objectTemplate = draft->getCraftedObjectTemplate(); - if (objectTemplate == NULL) + if (objectTemplate == nullptr) { return LocalRef::cms_nullPtr; } @@ -509,7 +509,7 @@ int i; ObjectTemplateList::fetch(objectTemplate->getSharedTemplate())); const SharedTangibleObjectTemplate * sharedTangibleTemplate = dynamic_cast< const SharedTangibleObjectTemplate *>(sharedTemplate); - if (sharedTangibleTemplate != NULL) + if (sharedTangibleTemplate != nullptr) { // New method using the AssetCustomizationManager mechanism. @@ -818,9 +818,9 @@ int i; // set the created item template crc value const ServerObjectTemplate * craftedTemplate = source.getCraftedObjectTemplate(); - if (craftedTemplate == NULL) + if (craftedTemplate == nullptr) { - WARNING(true, ("JavaLibrary::convert DraftSchematicObject got null crafted " + WARNING(true, ("JavaLibrary::convert DraftSchematicObject got nullptr crafted " "template for draft schematic %s", source.getObjectTemplateName())); return 0; } @@ -830,7 +830,7 @@ int i; const ServerDraftSchematicObjectTemplate * const sourceSchematicTemplate = safe_cast(source.getObjectTemplate()); NOT_NULL(sourceSchematicTemplate); - if (sourceSchematicTemplate == NULL) + if (sourceSchematicTemplate == nullptr) { // emergency case for release mode return 0; @@ -873,11 +873,11 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::startCraftingSession(JNIEnv *en UNREF(env); UNREF(self); - CreatureObject* playerObj = NULL; + CreatureObject* playerObj = nullptr; if (!JavaLibrary::getObject(player, playerObj)) return JNI_FALSE; - TangibleObject* stationObj = NULL; + TangibleObject* stationObj = nullptr; if (!JavaLibrary::getObject(station, stationObj)) return JNI_FALSE; @@ -894,7 +894,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::startCraftingSession(JNIEnv *en * @param self class calling this function * @param crafter the player that was crafting * @param tool the crafting tool that was being used - * @param prototype the prototype that was created (may be null) + * @param prototype the prototype that was created (may be nullptr) * * @return true on success, false on fail */ @@ -908,11 +908,11 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::endCraftingSession(JNIEnv *env, if (prototype == 0) return JNI_TRUE; - CreatureObject * crafterObj = NULL; + CreatureObject * crafterObj = nullptr; if (!JavaLibrary::getObject(crafter, crafterObj)) return JNI_FALSE; - TangibleObject * prototypeObj = NULL; + TangibleObject * prototypeObj = nullptr; if (!JavaLibrary::getObject(prototype, prototypeObj)) return JNI_FALSE; @@ -937,11 +937,11 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setCraftingLevelAndStation(JNIE { UNREF(self); - CreatureObject* creatureObject = NULL; + CreatureObject* creatureObject = nullptr; if (!JavaLibrary::getObject(player, creatureObject)) return JNI_FALSE; PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(creatureObject); - if (playerObject == NULL) + if (playerObject == nullptr) return JNI_FALSE; if (craftingLevel >= 0 && craftingLevel <= Crafting::MAX_CRAFTING_LEVEL) @@ -949,12 +949,12 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setCraftingLevelAndStation(JNIE if (station != 0) { - const TangibleObject * stationObject = NULL; + const TangibleObject * stationObject = nullptr; const NetworkId stationId(station); if (stationId != NetworkId::cms_invalid) { stationObject = dynamic_cast(ServerWorld::findObjectByNetworkId(stationId)); - if (stationObject == NULL) + if (stationObject == nullptr) return JNI_FALSE; } playerObject->setCraftingStation(stationObject); @@ -976,11 +976,11 @@ jint JNICALL ScriptMethodsCraftingNamespace::getCraftingLevel(JNIEnv *env, jobje { UNREF(self); - const CreatureObject* creatureObject = NULL; + const CreatureObject* creatureObject = nullptr; if (!JavaLibrary::getObject(player, creatureObject)) return -1; const PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(creatureObject); - if (playerObject == NULL) + if (playerObject == nullptr) return -1; return playerObject->getCraftingLevel(); @@ -999,11 +999,11 @@ jlong JNICALL ScriptMethodsCraftingNamespace::getCraftingStation(JNIEnv *env, jo { UNREF(self); - const CreatureObject* creatureObject = NULL; + const CreatureObject* creatureObject = nullptr; if (!JavaLibrary::getObject(player, creatureObject)) return 0; const PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(creatureObject); - if (playerObject == NULL) + if (playerObject == nullptr) return 0; return (playerObject->getCraftingStation()).getValue(); @@ -1023,11 +1023,11 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::sendUseableDraftSchematics(JNIE { UNREF(self); - CreatureObject* creatureObject = NULL; + CreatureObject* creatureObject = nullptr; if (!JavaLibrary::getObject(player, creatureObject)) return JNI_FALSE; PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(creatureObject); - if (playerObject == NULL) + if (playerObject == nullptr) { DEBUG_WARNING(true, ("JavaLibrary::sendUseableDraftSchematics non-player " "object %s\n", creatureObject->getNetworkId().getValueString().c_str())); @@ -1038,8 +1038,8 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::sendUseableDraftSchematics(JNIE if (count == 0) return JNI_FALSE; - jint * schematicsArray = env->GetIntArrayElements(schematics, NULL); - if (schematicsArray != NULL) + jint * schematicsArray = env->GetIntArrayElements(schematics, nullptr); + if (schematicsArray != nullptr) { std::vector schematicCrcs(schematicsArray, &schematicsArray[count]); playerObject->sendUseableDraftSchematics(schematicCrcs); @@ -1072,7 +1072,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSchematicAttribute(JNIEnv *e if (manufacturingSchematic == 0 || attribute == 0) return JNI_FALSE; - ManufactureObjectInterface * schematic = NULL; + ManufactureObjectInterface * schematic = nullptr; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return JNI_FALSE; @@ -1120,7 +1120,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSchematicAttributes(JNIEnv * if (manufacturingSchematic == 0 || attributes == 0) return JNI_FALSE; - ManufactureObjectInterface * schematic = NULL; + ManufactureObjectInterface * schematic = nullptr; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return JNI_FALSE; @@ -1169,7 +1169,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSchematicAttributes(JNIEnv * * @param name name of the attribute to get * @param experiment flag that these are experimental attributes * - * @return the attribute, or null on error + * @return the attribute, or nullptr on error */ jobject JNICALL ScriptMethodsCraftingNamespace::getSchematicAttribute(JNIEnv *env, jobject self, jlong manufacturingSchematic, jobject name, jboolean experiment) { @@ -1178,13 +1178,13 @@ jobject JNICALL ScriptMethodsCraftingNamespace::getSchematicAttribute(JNIEnv *en if (manufacturingSchematic == 0 || name == 0) return 0; - ManufactureObjectInterface * schematic = NULL; + ManufactureObjectInterface * schematic = nullptr; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return 0; const DraftSchematicObject * draft = DraftSchematicObject::getSchematic( schematic->getDraftSchematic()); - if (draft == NULL) + if (draft == nullptr) return 0; StringId nameId; @@ -1210,7 +1210,7 @@ jobject JNICALL ScriptMethodsCraftingNamespace::getSchematicAttribute(JNIEnv *en * @param names names of the attributes to get * @param experiment flag that these are experimental attributes * - * @return the attributes, or null on error + * @return the attributes, or nullptr on error */ jobjectArray JNICALL ScriptMethodsCraftingNamespace::getSchematicAttributes(JNIEnv *env, jobject self, jlong manufacturingSchematic, jobjectArray names, jboolean experiment) { @@ -1219,13 +1219,13 @@ jobjectArray JNICALL ScriptMethodsCraftingNamespace::getSchematicAttributes(JNIE if (manufacturingSchematic == 0) return 0; - ManufactureObjectInterface * schematic = NULL; + ManufactureObjectInterface * schematic = nullptr; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return 0; const DraftSchematicObject * draft = DraftSchematicObject::getSchematic( schematic->getDraftSchematic()); - if (draft == NULL) + if (draft == nullptr) return 0; int numAttribs = env->GetArrayLength(names); @@ -1276,7 +1276,7 @@ jobjectArray JNICALL ScriptMethodsCraftingNamespace::getSchematicAttributes(JNIE * @param manufacturingSchematic the schematic * @param experiment flag that these are experimental attributes * - * @return the attributes, or null on error + * @return the attributes, or nullptr on error */ jobjectArray JNICALL ScriptMethodsCraftingNamespace::getAllSchematicAttributes(JNIEnv *env, jobject self, jlong manufacturingSchematic, jboolean experiment) { @@ -1286,13 +1286,13 @@ jobjectArray JNICALL ScriptMethodsCraftingNamespace::getAllSchematicAttributes(J if (manufacturingSchematic == 0) return 0; - ManufactureObjectInterface * schematic = NULL; + ManufactureObjectInterface * schematic = nullptr; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return 0; const DraftSchematicObject * draft = DraftSchematicObject::getSchematic( schematic->getDraftSchematic()); - if (draft == NULL) + if (draft == nullptr) return 0; // set the attributes @@ -1337,7 +1337,7 @@ jobjectArray JNICALL ScriptMethodsCraftingNamespace::getAllSchematicAttributes(J * @param manufacturingSchematic the schematic to get the data from * @param attributeNames the experimental attributes we're interested about * - * @return the draft_schematic object, or null on error + * @return the draft_schematic object, or nullptr on error */ jobject JNICALL ScriptMethodsCraftingNamespace::getSchematicForExperimentalAttributes(JNIEnv *env, jobject self, jlong manufacturingSchematic, jobjectArray attributeNames) { @@ -1348,13 +1348,13 @@ int i; if (manufacturingSchematic == 0 || attributeNames == 0) return 0; - const ManufactureObjectInterface * manfSchematic = NULL; + const ManufactureObjectInterface * manfSchematic = nullptr; if (!JavaLibrary::getObject(manufacturingSchematic, manfSchematic)) return 0; const DraftSchematicObject * draftSchematic = DraftSchematicObject::getSchematic( manfSchematic->getDraftSchematic()); - if (draftSchematic == NULL) + if (draftSchematic == nullptr) return 0; // create a draft_schematic object to return @@ -1481,7 +1481,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSchematicExperimentMod(JNIEn { UNREF(self); - ManufactureSchematicObject * schematic = NULL; + ManufactureSchematicObject * schematic = nullptr; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return JNI_FALSE; @@ -1510,7 +1510,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSchematicAppearances(JNIEnv if (manufacturingSchematic == 0 || appearances == 0) return JNI_FALSE; - ManufactureSchematicObject * schematic = NULL; + ManufactureSchematicObject * schematic = nullptr; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return JNI_FALSE; @@ -1550,7 +1550,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSchematicCustomizations(JNIE if (manufacturingSchematic == 0 || customizations == 0) return JNI_FALSE; - ManufactureSchematicObject * schematic = NULL; + ManufactureSchematicObject * schematic = nullptr; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return JNI_FALSE; @@ -1596,7 +1596,7 @@ jint JNICALL ScriptMethodsCraftingNamespace::getSchematicItemCount(JNIEnv *env, if (manufacturingSchematic == 0) return -1; - const ManufactureSchematicObject * schematic = NULL; + const ManufactureSchematicObject * schematic = nullptr; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return -1; @@ -1622,7 +1622,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSchematicItemCount(JNIEnv *e if (manufacturingSchematic == 0) return JNI_FALSE; - ManufactureSchematicObject * schematic = NULL; + ManufactureSchematicObject * schematic = nullptr; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return JNI_FALSE; @@ -1649,7 +1649,7 @@ jint JNICALL ScriptMethodsCraftingNamespace::getSchematicItemsPerContainer(JNIEn if (manufacturingSchematic == 0) return -1; - const ManufactureSchematicObject * schematic = NULL; + const ManufactureSchematicObject * schematic = nullptr; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return -1; @@ -1676,7 +1676,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSchematicItemsPerContainer(J if (manufacturingSchematic == 0) return JNI_FALSE; - ManufactureSchematicObject * schematic = NULL; + ManufactureSchematicObject * schematic = nullptr; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return JNI_FALSE; @@ -1703,7 +1703,7 @@ jfloat JNICALL ScriptMethodsCraftingNamespace::getSchematicManufactureTime(JNIEn if (manufacturingSchematic == 0) return -1.0f; - const ManufactureSchematicObject * schematic = NULL; + const ManufactureSchematicObject * schematic = nullptr; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return -1.0f; @@ -1730,7 +1730,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSchematicManufactureTime(JNI if (manufacturingSchematic == 0) return JNI_FALSE; - ManufactureSchematicObject * schematic = NULL; + ManufactureSchematicObject * schematic = nullptr; if (!JavaLibrary::getObject(manufacturingSchematic, schematic)) return JNI_FALSE; @@ -1754,7 +1754,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setCreatorXp(JNIEnv *env, jobje { UNREF(self); - TangibleObject * target = NULL; + TangibleObject * target = nullptr; if (!JavaLibrary::getObject(object, target)) return JNI_FALSE; @@ -1778,7 +1778,7 @@ void JNICALL ScriptMethodsCraftingNamespace::getIngredientsForManufactureStation if (station == 0 || ingredients == 0) return; - const ManufactureInstallationObject * manfStation = NULL; + const ManufactureInstallationObject * manfStation = nullptr; if (!JavaLibrary::getObject(station, manfStation)) return; @@ -1786,7 +1786,7 @@ void JNICALL ScriptMethodsCraftingNamespace::getIngredientsForManufactureStation return; const ManufactureSchematicObject * const schematic = manfStation->getSchematic(); - if (schematic == NULL) + if (schematic == nullptr) return; static ManufactureSchematicObject::IngredientInfoVector iiv; @@ -1841,7 +1841,7 @@ void JNICALL ScriptMethodsCraftingNamespace::getIngredientsForManufactureStation * @param self class calling this function * @param station the station id * - * @return the hopper id, or null on error + * @return the hopper id, or nullptr on error */ jlong JNICALL ScriptMethodsCraftingNamespace::getManufactureStationInputHopper(JNIEnv *env, jobject self, jlong station) { @@ -1850,12 +1850,12 @@ jlong JNICALL ScriptMethodsCraftingNamespace::getManufactureStationInputHopper(J if (station == 0) return 0; - const ManufactureInstallationObject * manfStation = NULL; + const ManufactureInstallationObject * manfStation = nullptr; if (!JavaLibrary::getObject(station, manfStation)) return 0; ServerObject * hopper = manfStation->getInputHopper(); - if (hopper == NULL) + if (hopper == nullptr) return 0; return (hopper->getNetworkId()).getValue(); @@ -1870,7 +1870,7 @@ jlong JNICALL ScriptMethodsCraftingNamespace::getManufactureStationInputHopper(J * @param self class calling this function * @param station the station id * - * @return the hopper id, or null on error + * @return the hopper id, or nullptr on error */ jlong JNICALL ScriptMethodsCraftingNamespace::getManufactureStationOutputHopper(JNIEnv *env, jobject self, jlong station) { @@ -1879,12 +1879,12 @@ jlong JNICALL ScriptMethodsCraftingNamespace::getManufactureStationOutputHopper( if (station == 0) return 0; - const ManufactureInstallationObject * manfStation = NULL; + const ManufactureInstallationObject * manfStation = nullptr; if (!JavaLibrary::getObject(station, manfStation)) return 0; ServerObject * hopper = manfStation->getOutputHopper(); - if (hopper == NULL) + if (hopper == nullptr) return 0; return (hopper->getNetworkId()).getValue(); @@ -1899,7 +1899,7 @@ jlong JNICALL ScriptMethodsCraftingNamespace::getManufactureStationOutputHopper( * @param self class calling this function * @param station the station id * - * @return a string of the form "*" , or null if the station has no schematic + * @return a string of the form "*" , or nullptr if the station has no schematic */ jstring JNICALL ScriptMethodsCraftingNamespace::getManufactureStationSchematic(JNIEnv *env, jobject self, jlong station) { @@ -1907,12 +1907,12 @@ jstring JNICALL ScriptMethodsCraftingNamespace::getManufactureStationSchematic(J UNREF(self); - const ManufactureInstallationObject * manfStation = NULL; + const ManufactureInstallationObject * manfStation = nullptr; if (!JavaLibrary::getObject(station, manfStation)) return 0; const ManufactureSchematicObject * manfSchematic = manfStation->getSchematic(); - if (manfSchematic == NULL) + if (manfSchematic == nullptr) return 0; return JavaString( @@ -1943,11 +1943,11 @@ void JNICALL ScriptMethodsCraftingNamespace::getValidManufactureSchematicsForSta if (player == 0 || station == 0 || schematics == 0) return; - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature)) return; - const ManufactureInstallationObject * manfStation = NULL; + const ManufactureInstallationObject * manfStation = nullptr; if (!JavaLibrary::getObject(station, manfStation)) return; @@ -1997,11 +1997,11 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::hasValidManufactureSchematicsFo if (player == 0 || station == 0) return JNI_FALSE; - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature)) return JNI_FALSE; - const ManufactureInstallationObject * manfStation = NULL; + const ManufactureInstallationObject * manfStation = nullptr; if (!JavaLibrary::getObject(station, manfStation)) return JNI_FALSE; @@ -2030,24 +2030,24 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::transferManufactureSchematicToP { UNREF(self); - const ManufactureInstallationObject * manfStation = NULL; + const ManufactureInstallationObject * manfStation = nullptr; if (!JavaLibrary::getObject(station, manfStation)) return JNI_FALSE; ManufactureSchematicObject * schematic = manfStation->getSchematic(); - if (schematic == NULL) + if (schematic == nullptr) return JNI_TRUE; - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature)) return JNI_FALSE; ServerObject * datapad = playerCreature->getDatapad(); - if (datapad == NULL) + if (datapad == nullptr) return JNI_FALSE; Container::ContainerErrorCode tmp = Container::CEC_Success; - if (ContainerInterface::transferItemToVolumeContainer(*datapad, *schematic, NULL, tmp)) + if (ContainerInterface::transferItemToVolumeContainer(*datapad, *schematic, nullptr, tmp)) return JNI_TRUE; return JNI_FALSE; } // JavaLibrary::transferManufactureSchematicToPlayer @@ -2068,15 +2068,15 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::transferManufactureSchematicToS { UNREF(self); - ManufactureSchematicObject * manfSchematic = NULL; + ManufactureSchematicObject * manfSchematic = nullptr; if (!JavaLibrary::getObject(schematic, manfSchematic)) return JNI_FALSE; - ManufactureInstallationObject * manfStation = NULL; + ManufactureInstallationObject * manfStation = nullptr; if (!JavaLibrary::getObject(station, manfStation)) return JNI_FALSE; - if (manfStation->addSchematic(*manfSchematic, NULL)) + if (manfStation->addSchematic(*manfSchematic, nullptr)) return JNI_TRUE; return JNI_FALSE; } // JavaLibrary::transferManufactureSchematicToStation @@ -2099,11 +2099,11 @@ void JNICALL ScriptMethodsCraftingNamespace::getRepairableObjectsForTool(JNIEnv if (player == 0 || tool == 0 || objects == 0) return; - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature)) return; - const TangibleObject * toolObject = NULL; + const TangibleObject * toolObject = nullptr; if (!JavaLibrary::getObject(tool, toolObject)) return; if (!toolObject->isRepairTool()) @@ -2123,11 +2123,11 @@ void JNICALL ScriptMethodsCraftingNamespace::getRepairableObjectsForTool(JNIEnv // objects const ServerObject * inventory = playerCreature->getInventory(); - if (inventory == NULL) + if (inventory == nullptr) return; const VolumeContainer * inventoryContainer = ContainerInterface::getVolumeContainer(*inventory); - if (inventoryContainer == NULL) + if (inventoryContainer == nullptr) return; std::vector objList; @@ -2136,7 +2136,7 @@ void JNICALL ScriptMethodsCraftingNamespace::getRepairableObjectsForTool(JNIEnv { const CachedNetworkId & objId = (*iter); const TangibleObject * obj = safe_cast(objId.getObject()); - if (obj != NULL && !obj->isCraftingTool() && !obj->isRepairTool() && + if (obj != nullptr && !obj->isCraftingTool() && !obj->isRepairTool() && obj->getDamageTaken() > 0) { if ((genericTool && (toolType & obj->getGameObjectType()) != 0) || @@ -2172,22 +2172,22 @@ void JNICALL ScriptMethodsCraftingNamespace::getRepairableObjectsForTool(JNIEnv * @param self class calling this function * @param target the object * - * @return an array with the bonus for each attribute, or null on error + * @return an array with the bonus for each attribute, or nullptr on error */ jintArray JNICALL ScriptMethodsCraftingNamespace::getAttributeBonuses(JNIEnv *env, jobject self, jlong target) { UNREF(self); - const ServerObject * object = NULL; + const ServerObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return 0; std::vector > bonuses; - if (object->asTangibleObject() != NULL) + if (object->asTangibleObject() != nullptr) { object->asTangibleObject()->getAttribBonuses(bonuses); } - else if (object->asManufactureSchematicObject() != NULL) + else if (object->asManufactureSchematicObject() != nullptr) { object->asManufactureSchematicObject()->getAttribBonuses(bonuses); } @@ -2235,16 +2235,16 @@ jint JNICALL ScriptMethodsCraftingNamespace::getAttributeBonus(JNIEnv *env, jobj if (attribute < 0 || attribute >= Attributes::NumberOfAttributes) return 0; - const ServerObject * object = NULL; + const ServerObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return 0; jint bonus = 0; - if (object->asTangibleObject() != NULL) + if (object->asTangibleObject() != nullptr) { bonus = object->asTangibleObject()->getAttribBonus(attribute); } - else if (object->asManufactureSchematicObject() != NULL) + else if (object->asManufactureSchematicObject() != nullptr) { bonus = object->asManufactureSchematicObject()->getAttribBonus(attribute); } @@ -2271,15 +2271,15 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setAttributeBonus(JNIEnv *env, if (attribute < 0 || attribute >= Attributes::NumberOfAttributes) return JNI_FALSE; - ServerObject * object = NULL; + ServerObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; - if (object->asTangibleObject() != NULL) + if (object->asTangibleObject() != nullptr) { object->asTangibleObject()->setAttribBonus(attribute, bonus); } - else if (object->asManufactureSchematicObject() != NULL) + else if (object->asManufactureSchematicObject() != nullptr) { object->asManufactureSchematicObject()->setAttribBonus(attribute, bonus); } @@ -2307,7 +2307,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setAttributeBonuses(JNIEnv *env if (bonuses == 0) return JNI_FALSE; - ServerObject * object = NULL; + ServerObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -2322,13 +2322,13 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setAttributeBonuses(JNIEnv *env jint buffer[Attributes::NumberOfAttributes]; env->GetIntArrayRegion(bonuses, 0, count, buffer); - if (object->asTangibleObject() != NULL) + if (object->asTangibleObject() != nullptr) { TangibleObject * tangibleObject = object->asTangibleObject(); for (jsize i = 0; i < count; ++i) tangibleObject->setAttribBonus(i, buffer[i]); } - else if (object->asManufactureSchematicObject() != NULL) + else if (object->asManufactureSchematicObject() != nullptr) { ManufactureSchematicObject * manufactureSchematicObject = object->asManufactureSchematicObject(); for (jsize i = 0; i < count; ++i) @@ -2349,13 +2349,13 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setAttributeBonuses(JNIEnv *env * @param self class calling this function * @param target the object * - * @return a dictionary of skill mod names -> mod values, or null on error + * @return a dictionary of skill mod names -> mod values, or nullptr on error */ jobject JNICALL ScriptMethodsCraftingNamespace::getSkillModBonuses(JNIEnv *env, jobject self, jlong target) { UNREF(self); - const TangibleObject * object = NULL; + const TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return 0; @@ -2393,7 +2393,7 @@ jint JNICALL ScriptMethodsCraftingNamespace::getSkillModBonus(JNIEnv *env, jobje JavaStringParam jskillMod(skillMod); - const TangibleObject * object = NULL; + const TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return 0; @@ -2423,7 +2423,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSkillModBonus(JNIEnv *env, j JavaStringParam jskillMod(skillMod); - TangibleObject * object = NULL; + TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -2452,7 +2452,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSkillModBonuses(JNIEnv *env, { UNREF(self); - TangibleObject * object = NULL; + TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -2469,7 +2469,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSkillModBonuses(JNIEnv *env, } std::string skillName; - const jint * bonusArray = env->GetIntArrayElements(bonus, NULL); + const jint * bonusArray = env->GetIntArrayElements(bonus, nullptr); for (int i = 0; i < skillModCount; ++i) { JavaStringParam jskillName(static_cast(env->GetObjectArrayElement(skillMod, i))); @@ -2505,7 +2505,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setCategorizedSkillModBonus(JNI JavaStringParam jcategory(category); JavaStringParam jskillMod(skillMod); - TangibleObject * object = NULL; + TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -2540,7 +2540,7 @@ void JNICALL ScriptMethodsCraftingNamespace::removeCategorizedSkillModBonuses(JN JavaStringParam jcategory(category); - TangibleObject * object = NULL; + TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return; @@ -2566,7 +2566,7 @@ jint JNICALL ScriptMethodsCraftingNamespace::getSkillModSockets(JNIEnv *env, job { UNREF(self); - const TangibleObject * object = NULL; + const TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return 0; @@ -2589,7 +2589,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSkillModSockets(JNIEnv *env, { UNREF(self); - TangibleObject * object = NULL; + TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -2610,7 +2610,7 @@ jboolean JNICALL ScriptMethodsCraftingNamespace::setSkillModSockets(JNIEnv *env, * @param qualityPercent % stat adjustment * @param container the container to create the item in * - * @return the item, or null on error + * @return the item, or nullptr on error */ jlong JNICALL ScriptMethodsCraftingNamespace::makeCraftedItem(JNIEnv *env, jobject self, jstring draftSchematic, jfloat qualityPercent, jlong container) { @@ -2618,7 +2618,7 @@ jlong JNICALL ScriptMethodsCraftingNamespace::makeCraftedItem(JNIEnv *env, jobje if (draftSchematic == 0 || container == 0) { - WARNING(true, ("[script bug] null schematic or container passed to " + WARNING(true, ("[script bug] nullptr schematic or container passed to " "makeCraftedItem")); return 0; } @@ -2634,21 +2634,21 @@ jlong JNICALL ScriptMethodsCraftingNamespace::makeCraftedItem(JNIEnv *env, jobje const DraftSchematicObject * schematic = DraftSchematicObject::getSchematic( draftSchematicName); - if (schematic == NULL) + if (schematic == nullptr) { WARNING(true, ("[script bug] bad schematic name %s passed to " "makeCraftedItem", draftSchematicName.c_str())); return 0; } - ServerObject * target = NULL; + ServerObject * target = nullptr; if (!JavaLibrary::getObject(container, target)) { WARNING(true, ("[script bug] bad container id passed to makeCraftedItem")); return 0; } Object * targetParent = ContainerInterface::getFirstParentInWorld(*target); - if (targetParent == NULL) + if (targetParent == nullptr) { WARNING(true, ("JavaLibrary::makeCraftedItem can't find parent in world " "for container %s", target->getNetworkId().getValueString().c_str())); @@ -2660,14 +2660,14 @@ jlong JNICALL ScriptMethodsCraftingNamespace::makeCraftedItem(JNIEnv *env, jobje // create a manf schematic and prototype ManufactureSchematicObject * manfSchematic = ServerWorld::createNewManufacturingSchematic( *schematic, createPos, false); - if (manfSchematic == NULL) + if (manfSchematic == nullptr) { WARNING(true, ("JavaLibrary::makeCraftedItem: error creating manf " "schematic!")); return 0; } ServerObject * prototype = manfSchematic->manufactureObject(createPos); - if (prototype == NULL) + if (prototype == nullptr) { WARNING(true, ("JavaLibrary::makeCraftedItem: error creating " "prototype!")); @@ -2690,7 +2690,7 @@ jlong JNICALL ScriptMethodsCraftingNamespace::makeCraftedItem(JNIEnv *env, jobje manfSchematic->permanentlyDestroy(DeleteReasons::Consumed); Container::ContainerErrorCode error; if (!ContainerInterface::transferItemToVolumeContainer (*target, *prototype, - NULL, error, true)) + nullptr, error, true)) { WARNING(true, ("JavaLibrary::makeCraftedItem: error can't store prototype " "in container, error = %d", error)); @@ -2711,14 +2711,14 @@ jlong JNICALL ScriptMethodsCraftingNamespace::makeCraftedItem(JNIEnv *env, jobje * @param self class calling this function * @param manufacturingSchematic the schematic to get the data from * - * @return the draft_schematic object, or null on error + * @return the draft_schematic object, or nullptr on error */ jobject JNICALL ScriptMethodsCraftingNamespace::getSchematicData(JNIEnv *env, jobject self, jlong manufacturingSchematic) { if (manufacturingSchematic == 0) return 0; - const ManufactureSchematicObject * schematicObject = NULL; + const ManufactureSchematicObject * schematicObject = nullptr; if (!JavaLibrary::getObject(manufacturingSchematic, schematicObject)) return 0; @@ -2735,7 +2735,7 @@ jobject JNICALL ScriptMethodsCraftingNamespace::getSchematicData(JNIEnv *env, jo * @param self class calling this function * @param draftSchematic the schematic to get the data from * - * @return the draft_schematic object, or null on error + * @return the draft_schematic object, or nullptr on error */ jobject JNICALL ScriptMethodsCraftingNamespace::getDraftSchematicData(JNIEnv *env, jobject self, jstring draftSchematic) @@ -2749,7 +2749,7 @@ jobject JNICALL ScriptMethodsCraftingNamespace::getDraftSchematicData(JNIEnv *en return 0; const DraftSchematicObject * schematicObject = DraftSchematicObject::getSchematic(schematicName); - if (schematicObject == NULL) + if (schematicObject == nullptr) return 0; return JavaLibrary::convert(*schematicObject); @@ -2765,7 +2765,7 @@ jobject JNICALL ScriptMethodsCraftingNamespace::getDraftSchematicData(JNIEnv *en * @param self class calling this function * @param draftSchematicCrc the schematic to get the data from * - * @return the draft_schematic object, or null on error + * @return the draft_schematic object, or nullptr on error */ jobject JNICALL ScriptMethodsCraftingNamespace::getDraftSchematicDataCrc(JNIEnv *env, jobject self, jint draftSchematicCrc) @@ -2774,7 +2774,7 @@ jobject JNICALL ScriptMethodsCraftingNamespace::getDraftSchematicDataCrc(JNIEnv return 0; const DraftSchematicObject * schematicObject = DraftSchematicObject::getSchematic(draftSchematicCrc); - if (schematicObject == NULL) + if (schematicObject == nullptr) return 0; return JavaLibrary::convert(*schematicObject); @@ -2794,7 +2794,7 @@ jobject JNICALL ScriptMethodsCraftingNamespace::getDraftSchematicDataCrc(JNIEnv */ void JNICALL ScriptMethodsCraftingNamespace::recomputeCrateAttributes(JNIEnv *env, jobject self, jlong crate) { - FactoryObject * factory = NULL; + FactoryObject * factory = nullptr; if (!JavaLibrary::getObject(crate, factory)) return; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsDebug.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsDebug.cpp index 9946fc28..6769ff57 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsDebug.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsDebug.cpp @@ -188,7 +188,7 @@ void JNICALL ScriptMethodsDebugNamespace::debugServerConsoleMsg(JNIEnv *env, job ServerObject * object = 0; JavaLibrary::getObject(objId, object); - if (object == NULL) + if (object == nullptr) { DEBUG_REPORT_LOG(true, ("debugServerConsoleMsg from : %s\n", msgString.c_str())); @@ -212,8 +212,8 @@ void JNICALL ScriptMethodsDebugNamespace::debugServerConsoleMsg(JNIEnv *env, job * @param channel the channel to log to * @param msg the message to log * @param logger id of the object where the log is coming from - * @param player1 the 1st player for the message (may be null) - * @param player2 the 2nd player for the message (may be null) + * @param player1 the 1st player for the message (may be nullptr) + * @param player2 the 2nd player for the message (may be nullptr) * @param alwaysLog flag to ignore the disableScriptLogs flag and always log this message */ void JNICALL ScriptMethodsDebugNamespace::log(JNIEnv *env, jobject self, jstring channel, jstring msg, jlong logger, jlong player1, jlong player2, jboolean alwaysLog) @@ -222,7 +222,7 @@ void JNICALL ScriptMethodsDebugNamespace::log(JNIEnv *env, jobject self, jstring if (channel == 0 || msg == 0) { - JavaLibrary::throwInternalScriptError("[designer bug] JavaLibrary::log called with null channel or message"); + JavaLibrary::throwInternalScriptError("[designer bug] JavaLibrary::log called with nullptr channel or message"); return; } @@ -248,7 +248,7 @@ void JNICALL ScriptMethodsDebugNamespace::log(JNIEnv *env, jobject self, jstring if (player1 != 0) { - const ServerObject * playerObject = NULL; + const ServerObject * playerObject = nullptr; if (JavaLibrary::getObject(player1, playerObject)) { std::string::size_type p = msgStr.find("%TU"); @@ -264,7 +264,7 @@ void JNICALL ScriptMethodsDebugNamespace::log(JNIEnv *env, jobject self, jstring if (player2 != 0) { - const ServerObject * playerObject = NULL; + const ServerObject * playerObject = nullptr; if (JavaLibrary::getObject(player2, playerObject)) { std::string::size_type p = msgStr.find("%TT"); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsDynamicVariable.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsDynamicVariable.cpp index dbf13ac0..effd5bed 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsDynamicVariable.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsDynamicVariable.cpp @@ -39,7 +39,7 @@ namespace NonAuthObjvarNamespace if (!ConfigServerGame::getTrackNonAuthoritativeObjvarSets()) return; - if (name == NULL || *name == '\0') + if (name == nullptr || *name == '\0') return; if (obj.isAuthoritative()) return; @@ -504,13 +504,13 @@ LocalRefPtr ScriptMethodsDynamicVariableNamespace::convertDynamicVariableListToO * @param buffer a buffer to be filled in with the converted C name * @param bufferSize the length of buffer * - * @return the ServerObject * for the obj_id, or null on error + * @return the ServerObject * for the obj_id, or nullptr on error */ ServerObject * ScriptMethodsDynamicVariableNamespace::getObjectAndName(JNIEnv *env, jlong objId, jstring name, char * buffer, size_t bufferSize) { NOT_NULL(buffer); - ServerObject * object = NULL; + ServerObject * object = nullptr; JavaStringParam localName(name); if (localName.fillBuffer(buffer, bufferSize) > 1) { @@ -523,7 +523,7 @@ ServerObject * ScriptMethodsDynamicVariableNamespace::getObjectAndName(JNIEnv *e { fprintf(stderr, "WARNING: Could not get objvar name\n"); } - if (object == NULL && !ConfigServerGame::getDisableObjvarNullCheck()) + if (object == nullptr && !ConfigServerGame::getDisableObjvarNullCheck()) JavaLibrary::printJavaStack(); return object; @@ -540,15 +540,15 @@ ServerObject * ScriptMethodsDynamicVariableNamespace::getObjectAndName(JNIEnv *e * @param buffer a buffer to be filled in with the converted C name * @param bufferSize the length of buffer * - * @return the DynamicVariableList * for the obj_id, or null on error + * @return the DynamicVariableList * for the obj_id, or nullptr on error */ const DynamicVariableList * ScriptMethodsDynamicVariableNamespace::getObjvarsAndName(JNIEnv *env, jlong objId, jstring name, char * buffer, size_t bufferSize) { NOT_NULL(buffer); - const DynamicVariableList * objvars = NULL; + const DynamicVariableList * objvars = nullptr; const ServerObject * object = getObjectAndName(env, objId, name, buffer, bufferSize); - if (object != NULL) + if (object != nullptr) { testIsSafeToReadObjvar(*object, buffer); objvars = &object->getObjVars(); @@ -582,7 +582,7 @@ jobject JNICALL ScriptMethodsDynamicVariableNamespace::getDynamicVariable(JNIEnv char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvars = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvars == NULL) + if (objvars == nullptr) return 0; const std::string objvarName(buffer); @@ -751,7 +751,7 @@ jint JNICALL ScriptMethodsDynamicVariableNamespace::getIntDynamicVariable(JNIEnv char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == NULL) + if (objvarList == nullptr) return 0; int localValue=0; @@ -781,7 +781,7 @@ jintArray JNICALL ScriptMethodsDynamicVariableNamespace::getIntArrayDynamicVaria char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == NULL) + if (objvarList == nullptr) return 0; std::vector value; @@ -816,7 +816,7 @@ jfloat JNICALL ScriptMethodsDynamicVariableNamespace::getFloatDynamicVariable(JN char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == NULL) + if (objvarList == nullptr) return 0; float localValue = 0; @@ -846,7 +846,7 @@ jfloatArray JNICALL ScriptMethodsDynamicVariableNamespace::getFloatArrayDynamicV char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == NULL) + if (objvarList == nullptr) return 0; std::vector value; @@ -878,7 +878,7 @@ jstring JNICALL ScriptMethodsDynamicVariableNamespace::getStringDynamicVariable( char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == NULL) + if (objvarList == nullptr) return 0; Unicode::String value; @@ -908,7 +908,7 @@ jobjectArray JNICALL ScriptMethodsDynamicVariableNamespace::getStringArrayDynami char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == NULL) + if (objvarList == nullptr) return 0; std::vector value; @@ -944,7 +944,7 @@ jlong JNICALL ScriptMethodsDynamicVariableNamespace::getObjIdDynamicVariable(JNI char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == NULL) + if (objvarList == nullptr) return 0; NetworkId localValue; @@ -972,7 +972,7 @@ jlongArray JNICALL ScriptMethodsDynamicVariableNamespace::getObjIdArrayDynamicVa char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList *objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == NULL) + if (objvarList == nullptr) return 0; std::vector value; @@ -1013,7 +1013,7 @@ jobject JNICALL ScriptMethodsDynamicVariableNamespace::getLocationDynamicVariabl char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == NULL) + if (objvarList == nullptr) return 0; DynamicVariableLocationData value; @@ -1046,7 +1046,7 @@ jobjectArray JNICALL ScriptMethodsDynamicVariableNamespace::getLocationArrayDyna char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == NULL) + if (objvarList == nullptr) return 0; std::vector value; @@ -1092,7 +1092,7 @@ jobject JNICALL ScriptMethodsDynamicVariableNamespace::getStringIdDynamicVariabl char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == NULL) + if (objvarList == nullptr) return 0; StringId value; @@ -1125,7 +1125,7 @@ jobjectArray JNICALL ScriptMethodsDynamicVariableNamespace::getStringIdArrayDyna char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == NULL) + if (objvarList == nullptr) return 0; std::vector value; @@ -1168,7 +1168,7 @@ jobject JNICALL ScriptMethodsDynamicVariableNamespace::getTransformDynamicVariab char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == NULL) + if (objvarList == nullptr) return 0; Transform value; @@ -1201,7 +1201,7 @@ jobjectArray JNICALL ScriptMethodsDynamicVariableNamespace::getTransformArrayDyn char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == NULL) + if (objvarList == nullptr) return 0; std::vector value; @@ -1244,7 +1244,7 @@ jobject JNICALL ScriptMethodsDynamicVariableNamespace::getVectorDynamicVariable( char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == NULL) + if (objvarList == nullptr) return 0; Vector value; @@ -1277,7 +1277,7 @@ jobjectArray JNICALL ScriptMethodsDynamicVariableNamespace::getVectorArrayDynami char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const DynamicVariableList * objvarList = getObjvarsAndName(env, objId, name, buffer, sizeof(buffer)); - if (objvarList == NULL) + if (objvarList == nullptr) return 0; std::vector value; @@ -1320,7 +1320,7 @@ jobject JNICALL ScriptMethodsDynamicVariableNamespace::getDynamicVariableList(JN JavaStringParam localName(name); - const ServerObject* object = NULL; + const ServerObject* object = nullptr; if (!JavaLibrary::getObject(objId, object)) return 0; @@ -1342,7 +1342,7 @@ jobject JNICALL ScriptMethodsDynamicVariableNamespace::getDynamicVariableList(JN } } - if (result.get() == NULL) + if (result.get() == nullptr) return 0; return result->getReturnValue(); } // JavaLibrary::getDynamicVariableList @@ -1364,7 +1364,7 @@ void JNICALL ScriptMethodsDynamicVariableNamespace::removeDynamicVariable(JNIEnv char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return; object->removeObjVarItem(buffer); @@ -1384,7 +1384,7 @@ void JNICALL ScriptMethodsDynamicVariableNamespace::removeAllDynamicVariables(JN if (objId == 0) return; - ServerObject* object = NULL; + ServerObject* object = nullptr; if (!JavaLibrary::getObject(objId, object)) return; @@ -1410,7 +1410,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::hasDynamicVariable(JNIEn char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; const ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return 0; const DynamicVariableList &objvarList = object->getObjVars(); @@ -1441,11 +1441,11 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setDynamicVariable(JNIEn char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; const DynamicVariableList *objvarList = &(object->getObjVars()); - if (objvarList == NULL) + if (objvarList == nullptr) return JNI_FALSE; // determine what type the data is @@ -1454,9 +1454,9 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setDynamicVariable(JNIEn { // name is the name of an objvar list we will add data to DynamicVariable *objvar = objvarList->getItemByName(localName); - if (objvar == NULL) + if (objvar == nullptr) objvar = objvarList->addNestedList(localName); - if (objvar != NULL && objvar->getType() == DynamicVariable::LIST) + if (objvar != nullptr && objvar->getType() == DynamicVariable::LIST) return updateDynamicVariableList(env, *dynamic_cast(objvar), data); return JNI_FALSE; } @@ -1474,7 +1474,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setDynamicVariable(JNIEn } else if (env->IsInstanceOf(data, ms_clsString) == JNI_TRUE) { - if (objvarList->setItem(localName, Unicode::String(env->GetStringChars(static_cast(data), NULL)))) + if (objvarList->setItem(localName, Unicode::String(env->GetStringChars(static_cast(data), nullptr)))) #error must release characters return JNI_TRUE; return JNI_FALSE; @@ -1503,7 +1503,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setIntDynamicVariable(JN char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; addSetObjvar(*object, buffer); @@ -1531,7 +1531,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setIntArrayDynamicVariab char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; size_t size = env->GetArrayLength(value); @@ -1574,7 +1574,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setFloatDynamicVariable( char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; addSetObjvar(*object, buffer); @@ -1602,7 +1602,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setFloatArrayDynamicVari char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; size_t size = env->GetArrayLength(value); @@ -1645,7 +1645,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setStringDynamicVariable if (name == 0) { - DEBUG_WARNING(true, ("NULL name passed from script to JavaLibrary::setStringDynamicValue")); + DEBUG_WARNING(true, ("nullptr name passed from script to JavaLibrary::setStringDynamicValue")); return JNI_FALSE; } @@ -1653,17 +1653,17 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setStringDynamicVariable char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; if (value == 0) { - DEBUG_WARNING(true, ("NULL string passed from script to JavaLibrary::setStringDynamicValue (%s)",buffer)); + DEBUG_WARNING(true, ("nullptr string passed from script to JavaLibrary::setStringDynamicValue (%s)",buffer)); return JNI_FALSE; } const DynamicVariableList *objvarList = &(object->getObjVars()); - if (objvarList == NULL) + if (objvarList == nullptr) return JNI_FALSE; Unicode::String valueString; @@ -1698,7 +1698,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setStringArrayDynamicVar char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; std::vector valueArray; @@ -1754,7 +1754,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setObjIdDynamicVariable( char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; NetworkId oidValue(static_cast @@ -1785,7 +1785,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setObjIdArrayDynamicVari char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; std::vector valueArray; @@ -1838,7 +1838,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setLocationDynamicVariab char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; DynamicVariableLocationData locValue; @@ -1878,7 +1878,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setLocationArrayDynamicV char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; std::vector valueArray; @@ -1942,7 +1942,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setStringIdDynamicVariab char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; StringId locValue; @@ -1977,7 +1977,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setStringIdArrayDynamicV char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; std::vector valueArray; @@ -2033,7 +2033,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setTransformDynamicVaria char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; Transform locValue; @@ -2068,7 +2068,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setTransformArrayDynamic char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; std::vector valueArray; @@ -2120,7 +2120,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setVectorDynamicVariable char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; Vector locValue; @@ -2155,7 +2155,7 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::setVectorArrayDynamicVar char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; ServerObject * object = getObjectAndName(env, objId, name, buffer, sizeof(buffer)); - if (object == NULL) + if (object == nullptr) return JNI_FALSE; std::vector valueArray; @@ -2227,10 +2227,10 @@ jboolean JNICALL ScriptMethodsDynamicVariableNamespace::copyDynamicVariable(JNIE return JNI_TRUE; ServerObject* fromObject = dynamic_cast(from.getObject()); - if (fromObject == NULL) + if (fromObject == nullptr) return JNI_FALSE; ServerObject* toObject = dynamic_cast(to.getObject()); - if (toObject == NULL) + if (toObject == nullptr) return JNI_FALSE; char buffer[DynamicVariable::MAX_DYNAMIC_VARIABLE_NAME_LEN]; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsForm.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsForm.cpp index 3ca7c226..3247b76e 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsForm.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsForm.cpp @@ -48,7 +48,7 @@ const JNINativeMethod NATIVES[] = { jboolean JNICALL ScriptMethodsFormNamespace::editFormData(JNIEnv * env, jobject self, jlong player, jlong jObjectToEdit, jobjectArray jKeys, jobjectArray jValues) { UNREF(self); - ServerObject * playerServerObject = NULL; + ServerObject * playerServerObject = nullptr; if (!JavaLibrary::getObject(player, playerServerObject) || !playerServerObject) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("[script bug] can't get player in editFormData")); @@ -62,7 +62,7 @@ jboolean JNICALL ScriptMethodsFormNamespace::editFormData(JNIEnv * env, jobject return JNI_FALSE; } - ServerObject * objectToEditServerObject = NULL; + ServerObject * objectToEditServerObject = nullptr; if (!JavaLibrary::getObject(jObjectToEdit, objectToEditServerObject) || !objectToEditServerObject) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("[script bug] objectToEdit is not a ServerObject in editFormData")); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsHateList.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsHateList.cpp index 324d719e..758d57e9 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsHateList.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsHateList.cpp @@ -90,7 +90,7 @@ void JNICALL ScriptMethodsHateListNamespace::setAggroImmuneDuration(JNIEnv * /*e NetworkId const playerNetworkId(player); PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(playerNetworkId)); - if (playerObject == NULL) + if (playerObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsHateList::setAggroImmuneDuration() player(%s) Unable to resolve the object to a PlayerObject.", playerNetworkId.getValueString().c_str())); return; @@ -105,7 +105,7 @@ jboolean JNICALL ScriptMethodsHateListNamespace::isAggroImmune(JNIEnv * /*env*/, NetworkId const playerNetworkId(player); PlayerObject * const playerObject = PlayerCreatureController::getPlayerObject(CreatureObject::getCreatureObject(playerNetworkId)); - if (playerObject == NULL) + if (playerObject == nullptr) { return JNI_FALSE; } @@ -120,7 +120,7 @@ void JNICALL ScriptMethodsHateListNamespace::addHate(JNIEnv * /*env*/, jobject / NetworkId const hateTargetNetworkId(hateTarget); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == NULL) + if (objectTangibleObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsHateList::addHate() object(%s) hateTarget(%s) hate(%.2f) Unable to resolve the object to a TangibleObject.", networkId.getValueString().c_str(), hateTargetNetworkId.getValueString().c_str(), hate)); return; @@ -148,7 +148,7 @@ void JNICALL ScriptMethodsHateListNamespace::addHateDot(JNIEnv * /*env*/, jobjec NetworkId const hateTargetNetworkId(hateTarget); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == NULL) + if (objectTangibleObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsHateList::addHateDot() object(%s) hateTarget(%s) hate(%.2f) seconds(%d) Unable to resolve the object to a TangibleObject.", networkId.getValueString().c_str(), hateTargetNetworkId.getValueString().c_str(), hate, seconds)); return; @@ -178,7 +178,7 @@ void JNICALL ScriptMethodsHateListNamespace::setHate(JNIEnv * /*env*/, jobject / NetworkId const hateTargetNetworkId(hateTarget); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == NULL) + if (objectTangibleObject == nullptr) { WARNING(true, ("ScriptMethodsHateList::setHate() object(%s) hateTarget(%s) hate(%.2f) Unable to resolve the object to a TangibleObject.", networkId.getValueString().c_str(), hateTargetNetworkId.getValueString().c_str(), hate)); return; @@ -208,7 +208,7 @@ void JNICALL ScriptMethodsHateListNamespace::removeHateTarget(JNIEnv * /*env*/, NetworkId const hateTargetNetworkId(hateTarget); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == NULL) + if (objectTangibleObject == nullptr) { WARNING(true, ("ScriptMethodsHateList::removeHateTarget() object(%s) hateTarget(%s) Unable to resolve the object to a TangibleObject.", networkId.getValueString().c_str(), hateTargetNetworkId.getValueString().c_str())); return; @@ -238,7 +238,7 @@ jfloat JNICALL ScriptMethodsHateListNamespace::getHate(JNIEnv * /*env*/, jobject NetworkId const hateTargetNetworkId(hateTarget); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == NULL) + if (objectTangibleObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsHateList::getHate() object(%s) hateTarget(%s) Unable to resolve the object to a TangibleObject.", networkId.getValueString().c_str(), hateTargetNetworkId.getValueString().c_str())); return 0.0f; @@ -264,7 +264,7 @@ jfloat JNICALL ScriptMethodsHateListNamespace::getMaxHate(JNIEnv * /*env*/, jobj NetworkId const networkId(object); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == NULL) + if (objectTangibleObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsHateList::getMaxHate() object(%s) Unable to resolve the object to a TangibleObject.", networkId.getValueString().c_str())); return 0.0f; @@ -281,7 +281,7 @@ void JNICALL ScriptMethodsHateListNamespace::clearHateList(JNIEnv * /*env*/, job NetworkId const networkId(object); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == NULL) + if (objectTangibleObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsHateList::clearHateList() Unable to resolve the object(%s) to a TangibleObject.", networkId.getValueString().c_str())); return; @@ -298,7 +298,7 @@ jlong JNICALL ScriptMethodsHateListNamespace::getHateTarget(JNIEnv * /*env*/, jo NetworkId const networkId(object); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == NULL) + if (objectTangibleObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsHateList::getHateTarget() Unable to resolve the object(%s) to a TangibleObject.", networkId.getValueString().c_str())); return 0; @@ -317,7 +317,7 @@ jlongArray JNICALL ScriptMethodsHateListNamespace::getHateList(JNIEnv * /*env*/, LOGC(AiLogManager::isLogging(networkId), "debug_ai", ("ScriptMethodsHateList::getHateList() object(%s)", networkId.getValueString().c_str())); - if (objectTangibleObject == NULL) + if (objectTangibleObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsHateList::getHateList() Unable to resolve the object(%s) to a TangibleObject.", networkId.getValueString().c_str())); return 0; @@ -348,7 +348,7 @@ jboolean JNICALL ScriptMethodsHateListNamespace::isOnHateList(JNIEnv * /*env*/, NetworkId const targetNetworkId(target); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == NULL) + if (objectTangibleObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsHateList::isOnHateList() object(%s) target(%s) Unable to resolve the object to a TangibleObject.", networkId.getValueString().c_str(), targetNetworkId.getValueString().c_str())); return JNI_FALSE; @@ -369,7 +369,7 @@ void JNICALL ScriptMethodsHateListNamespace::resetHateTimer(JNIEnv * /*env*/, jo NetworkId const networkId(object); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == NULL) + if (objectTangibleObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsHateList::resetHateTimer() object(%s) Unable to resolve the object to a TangibleObject.", networkId.getValueString().c_str())); return; @@ -385,7 +385,7 @@ void JNICALL ScriptMethodsHateListNamespace::setAILeashTime(JNIEnv * /*env*/, jo NetworkId const networkId(object); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == NULL) + if (objectTangibleObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsHateList::setAILeashTime() object(%s) time(%.2f) Unable to resolve the object to a TangibleObject.", networkId.getValueString().c_str(), time)); return; @@ -408,7 +408,7 @@ jfloat JNICALL ScriptMethodsHateListNamespace::getAILeashTime(JNIEnv * /*env*/, NetworkId const networkId(object); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == NULL) + if (objectTangibleObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsHateList::setAILeashTime() object(%s) time(%.2f) Unable to resolve the object to a TangibleObject.", networkId.getValueString().c_str(), time)); return 0.0; @@ -434,7 +434,7 @@ void JNICALL ScriptMethodsHateListNamespace::forceHateTarget(JNIEnv * env, jobje NetworkId const hateTargetNetworkId(target); TangibleObject * const objectTangibleObject = TangibleObject::getTangibleObject(networkId); - if (objectTangibleObject == NULL) + if (objectTangibleObject == nullptr) { WARNING(true, ("ScriptMethodsHateList::forceHateTarget() object(%s) hateTarget(%s) Unable to resolve the object to a TangibleObject.", networkId.getValueString().c_str(), hateTargetNetworkId.getValueString().c_str())); return; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsHolocube.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsHolocube.cpp index 51088b13..31a83e7c 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsHolocube.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsHolocube.cpp @@ -47,7 +47,7 @@ jboolean JNICALL ScriptMethodsHolocubeNamespace::openHolocronToPage(JNIEnv *env, { JavaStringParam localPage(jpage); - ServerObject* so = NULL; + ServerObject* so = nullptr; if(!JavaLibrary::getObject(client, so)) { WARNING (true, ("[Script bug] Could not get ServerObject for value passed in for paramter:client in JavaLibrary::openHolocronToPage")); @@ -76,7 +76,7 @@ jboolean JNICALL ScriptMethodsHolocubeNamespace::openHolocronToPage(JNIEnv *env, jboolean JNICALL ScriptMethodsHolocubeNamespace::closeHolocron(JNIEnv *env, jobject self, jlong client) { - ServerObject* so = NULL; + ServerObject* so = nullptr; if(!JavaLibrary::getObject(client, so)) { WARNING (true, ("[Script bug] Could not get ServerObject for value passed in for paramter:client in JavaLibrary::closeHolocron")); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsHyperspace.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsHyperspace.cpp index 665f9460..784a2717 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsHyperspace.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsHyperspace.cpp @@ -131,10 +131,10 @@ void JNICALL ScriptMethodsHyperspaceNamespace::hyperspacePlayerToLocation(JNIEnv // Make sure the ship is not docking - Controller const * const controller = (shipObject != NULL) ? shipObject->getController() : NULL; - ShipController const * const shipController = (controller != NULL) ? controller->asShipController() : NULL; + Controller const * const controller = (shipObject != nullptr) ? shipObject->getController() : nullptr; + ShipController const * const shipController = (controller != nullptr) ? controller->asShipController() : nullptr; - if ( (shipController != NULL) + if ( (shipController != nullptr) && shipController->isDocking()) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("hyperspacePlayerToLocation - Hyperspacing is not allowed on ships that are currently docking: %s", shipObject->getDebugInformation().c_str())); @@ -211,10 +211,10 @@ void JNICALL ScriptMethodsHyperspaceNamespace::hyperspacePlayerToLocationCellNam // Make sure the ship is not docking - Controller const * const controller = (shipObject != NULL) ? shipObject->getController() : NULL; - ShipController const * const shipController = (controller != NULL) ? controller->asShipController() : NULL; + Controller const * const controller = (shipObject != nullptr) ? shipObject->getController() : nullptr; + ShipController const * const shipController = (controller != nullptr) ? controller->asShipController() : nullptr; - if ( (shipController != NULL) + if ( (shipController != nullptr) && shipController->isDocking()) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("hyperspacePlayerToLocation - Hyperspacing is not allowed on ships that are currently docking: %s", shipObject->getDebugInformation().c_str())); @@ -272,7 +272,7 @@ void JNICALL ScriptMethodsHyperspaceNamespace::hyperspacePlayerToHyperspacePoint return; } - CreatureObject * const playerCreature = playerObject ? playerObject->asCreatureObject() : NULL; + CreatureObject * const playerCreature = playerObject ? playerObject->asCreatureObject() : nullptr; if(!playerCreature) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("hyperspacePlayerToHyperspacePoint - player is not a creature")); @@ -309,10 +309,10 @@ void JNICALL ScriptMethodsHyperspaceNamespace::hyperspacePlayerToHyperspacePoint // Make sure the ship is not docking - Controller const * const controller = (shipObject != NULL) ? shipObject->getController() : NULL; - ShipController const * const shipController = (controller != NULL) ? controller->asShipController() : NULL; + Controller const * const controller = (shipObject != nullptr) ? shipObject->getController() : nullptr; + ShipController const * const shipController = (controller != nullptr) ? controller->asShipController() : nullptr; - if ( (shipController != NULL) + if ( (shipController != nullptr) && shipController->isDocking()) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("hyperspacePlayerToHyperspacePoint - Hyperspacing is not allowed on ships that are currently docking: %s", shipObject->getDebugInformation().c_str())); @@ -395,7 +395,7 @@ void JNICALL ScriptMethodsHyperspaceNamespace::hyperspacePrepareShipOnClient(JNI return; } - CreatureObject * const playerCreature = playerObject ? playerObject->asCreatureObject() : NULL; + CreatureObject * const playerCreature = playerObject ? playerObject->asCreatureObject() : nullptr; if(playerCreature == 0) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("hyperspacePlayerToHyperspacePoint - player is not a creature")); @@ -425,8 +425,8 @@ void JNICALL ScriptMethodsHyperspaceNamespace::hyperspacePrepareShipOnClient(JNI if (HyperspaceManager::getHyperspacePoint(hyperspacePoint, location)) { - Controller const * const controller = (shipObject != NULL) ? shipObject->getController() : NULL; - ShipController const * const shipController = (controller != NULL) ? controller->asShipController() : NULL; + Controller const * const controller = (shipObject != nullptr) ? shipObject->getController() : nullptr; + ShipController const * const shipController = (controller != nullptr) ? controller->asShipController() : nullptr; if (shipController != 0) { @@ -467,7 +467,7 @@ void JNICALL ScriptMethodsHyperspaceNamespace::hyperspaceRestoreShipOnClientFrom return; } - CreatureObject * const playerCreature = playerObject ? playerObject->asCreatureObject() : NULL; + CreatureObject * const playerCreature = playerObject ? playerObject->asCreatureObject() : nullptr; if(playerCreature == 0) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("hyperspacePlayerToHyperspacePoint - player is not a creature")); @@ -482,8 +482,8 @@ void JNICALL ScriptMethodsHyperspaceNamespace::hyperspaceRestoreShipOnClientFrom return; } - Controller const * const controller = (shipObject != NULL) ? shipObject->getController() : NULL; - ShipController const * const shipController = (controller != NULL) ? controller->asShipController() : NULL; + Controller const * const controller = (shipObject != nullptr) ? shipObject->getController() : nullptr; + ShipController const * const shipController = (controller != nullptr) ? controller->asShipController() : nullptr; if (shipController != 0) { @@ -514,7 +514,7 @@ jstring JNICALL ScriptMethodsHyperspaceNamespace::getSceneForHyperspacePoint(JNI if (!JavaLibrary::convert(localHyperspacePoint, hyperspacePoint)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("getSceneForHyperspacePoint - could not get hyperspace point name")); - return NULL; + return nullptr; } if(HyperspaceManager::isValidHyperspacePoint(hyperspacePoint)) @@ -528,7 +528,7 @@ jstring JNICALL ScriptMethodsHyperspaceNamespace::getSceneForHyperspacePoint(JNI return str.getReturnValue(); } } - return NULL; + return nullptr; } //------------------------------------------------------------------------------------------------ diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsImageDesign.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsImageDesign.cpp index b85f1516..4866318b 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsImageDesign.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsImageDesign.cpp @@ -70,7 +70,7 @@ void JNICALL ScriptMethodsImageDesignNamespace::imagedesignStart(JNIEnv *env, jo return; } - //the terminal can be NULL (that means no ID terminal is being used, which is fine) + //the terminal can be nullptr (that means no ID terminal is being used, which is fine) ServerObject * terminalObj = 0; JavaLibrary::getObject(jterminalId, terminalObj); @@ -185,8 +185,8 @@ jboolean JNICALL ScriptMethodsImageDesignNamespace::imagedesignValidated(JNIEnv WARNING(true, ("morph keys and values arrays are of diffent sizes")); return JNI_FALSE; } - jfloat * const morphChangesValuesArray = env->GetFloatArrayElements(jmorphChangesValues, NULL); - if (morphChangesValuesArray == NULL) + jfloat * const morphChangesValuesArray = env->GetFloatArrayElements(jmorphChangesValues, nullptr); + if (morphChangesValuesArray == nullptr) { return JNI_FALSE; } @@ -211,8 +211,8 @@ jboolean JNICALL ScriptMethodsImageDesignNamespace::imagedesignValidated(JNIEnv WARNING(true, ("index keys and values arrays are of diffent sizes")); return JNI_FALSE; } - jint * const indexChangesValuesArray = env->GetIntArrayElements(jindexChangesValues, NULL); - if (indexChangesValuesArray == NULL) + jint * const indexChangesValuesArray = env->GetIntArrayElements(jindexChangesValues, nullptr); + if (indexChangesValuesArray == nullptr) { return JNI_FALSE; } diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsInstallation.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsInstallation.cpp index b96b27d2..5c159849 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsInstallation.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsInstallation.cpp @@ -224,7 +224,7 @@ void JNICALL ScriptMethodsInstallationNamespace::displayStructurePermissionData( UNREF(self); //get the player id from player - CreatureObject* creatureObject = NULL; + CreatureObject* creatureObject = nullptr; if (!JavaLibrary::getObject(player, creatureObject)) return; @@ -290,7 +290,7 @@ jfloat JNICALL ScriptMethodsInstallationNamespace::getPowerValue(JNIEnv *env, jo UNREF(self); //get the player id from player - const InstallationObject * installation = NULL; + const InstallationObject * installation = nullptr; if (!JavaLibrary::getObject(target, installation)) return 0; @@ -314,7 +314,7 @@ jboolean JNICALL ScriptMethodsInstallationNamespace::setPowerValue(JNIEnv *env, UNREF(self); //get the player id from player - InstallationObject * installation = NULL; + InstallationObject * installation = nullptr; if (!JavaLibrary::getObject(target, installation)) return JNI_FALSE; @@ -340,7 +340,7 @@ jboolean JNICALL ScriptMethodsInstallationNamespace::incrementPowerValue(JNIEnv UNREF(self); //get the player id from player - InstallationObject * installation = NULL; + InstallationObject * installation = nullptr; if (!JavaLibrary::getObject(target, installation)) return JNI_FALSE; @@ -365,7 +365,7 @@ jfloat JNICALL ScriptMethodsInstallationNamespace::getPowerRate(JNIEnv *env, job UNREF(self); //get the player id from player - const InstallationObject * installation = NULL; + const InstallationObject * installation = nullptr; if (!JavaLibrary::getObject(target, installation)) return 0; @@ -389,7 +389,7 @@ jboolean JNICALL ScriptMethodsInstallationNamespace::setPowerRate(JNIEnv *env, j UNREF(self); //get the player id from player - InstallationObject * installation = NULL; + InstallationObject * installation = nullptr; if (!JavaLibrary::getObject(target, installation)) return JNI_FALSE; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsInteriors.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsInteriors.cpp index fb6c3557..da0c833b 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsInteriors.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsInteriors.cpp @@ -137,7 +137,7 @@ jlong JNICALL ScriptMethodsInteriorsNamespace::createObjectInCell(JNIEnv *env, j return 0; std::string templateName; - ServerObject* sourceObject = NULL; + ServerObject* sourceObject = nullptr; if (!JavaLibrary::getObject(source, sourceObject)) return 0; templateName = sourceObject->getTemplateName(); @@ -149,7 +149,7 @@ jlong JNICALL ScriptMethodsInteriorsNamespace::_createObjectInCellInternal(JNIEn { JavaStringParam localCellName(cellName); - ServerObject * portallizedObject = NULL; + ServerObject * portallizedObject = nullptr; if (!JavaLibrary::getObject(building, portallizedObject)) return 0; @@ -183,7 +183,7 @@ jlong JNICALL ScriptMethodsInteriorsNamespace::_createObjectInCellInternal(JNIEn Transform tr; tr.setPosition_p(newPos); ServerObject *newObject = ServerWorld::createNewObject(templateName, tr, cellObject, false); - if (newObject == NULL) + if (newObject == nullptr) return 0; //@todo do we need to snap to floor or something? @@ -226,7 +226,7 @@ jlong JNICALL ScriptMethodsInteriorsNamespace::createObjectInCellAnywhere(JNIEnv return 0; std::string templateName; - ServerObject* sourceObject = NULL; + ServerObject* sourceObject = nullptr; if (!JavaLibrary::getObject(source, sourceObject)) return 0; templateName = sourceObject->getTemplateName(); @@ -261,7 +261,7 @@ jlong JNICALL ScriptMethodsInteriorsNamespace::_createObjectInCellAnywhereIntern //@todo need to find a way to get a good location in a cell. For now just use the coordinates of the cell? JavaStringParam localCellName(cellName); - ServerObject *portallizedObject = NULL; + ServerObject *portallizedObject = nullptr; if (!JavaLibrary::getObject(building, portallizedObject)) return 0; @@ -289,7 +289,7 @@ jlong JNICALL ScriptMethodsInteriorsNamespace::_createObjectInCellAnywhereIntern Transform tr; tr.setPosition_p(createPosition); ServerObject *newObject = ServerWorld::createNewObject(templateName, tr, cellObject, false); - if (newObject == NULL) + if (newObject == nullptr) return 0; // create an networkId to return @@ -306,7 +306,7 @@ jlong JNICALL ScriptMethodsInteriorsNamespace::_createObjectInCellAnywhereIntern jobjectArray JNICALL ScriptMethodsInteriorsNamespace::getCellNames(JNIEnv *env, jobject self, jlong target) { - ServerObject const *portallizedObject = NULL; + ServerObject const *portallizedObject = nullptr; if (!JavaLibrary::getObject(target, portallizedObject)) return 0; @@ -329,7 +329,7 @@ jobjectArray JNICALL ScriptMethodsInteriorsNamespace::getCellNames(JNIEnv *env, jstring JNICALL ScriptMethodsInteriorsNamespace::getCellName(JNIEnv *env, jobject self, jlong target) { - CellObject const *cellObject = NULL; + CellObject const *cellObject = nullptr; if (!JavaLibrary::getObject(target, cellObject)) return 0; @@ -342,7 +342,7 @@ jstring JNICALL ScriptMethodsInteriorsNamespace::getCellName(JNIEnv *env, jobjec } ServerObject const * const portallizedObject = safe_cast(ContainerInterface::getContainedByObject(*cellObject)); - if (portallizedObject == NULL) + if (portallizedObject == nullptr) return 0; PortalProperty const * const cellProp = portallizedObject->getPortalProperty(); @@ -370,7 +370,7 @@ jstring JNICALL ScriptMethodsInteriorsNamespace::getCellName(JNIEnv *env, jobjec jlongArray JNICALL ScriptMethodsInteriorsNamespace::getCellIds(JNIEnv *env, jobject self, jlong target) { - ServerObject const *portallizedObject = NULL; + ServerObject const *portallizedObject = nullptr; if (!JavaLibrary::getObject(target, portallizedObject)) return 0; @@ -387,11 +387,11 @@ jlongArray JNICALL ScriptMethodsInteriorsNamespace::getCellIds(JNIEnv *env, jobj cellIds.reserve(count); for (int i = 0; i < count; ++i) { - ServerObject const * cellObject = NULL; + ServerObject const * cellObject = nullptr; CellProperty const * const cellProp = portalProp->getCell(nameList[i]); - if (cellProp != NULL) + if (cellProp != nullptr) cellObject = cellProp->getOwner().asServerObject(); - if (cellObject != NULL) + if (cellObject != nullptr) { cellIds.push_back(cellObject->getNetworkId()); } @@ -412,7 +412,7 @@ jboolean JNICALL ScriptMethodsInteriorsNamespace::hasCell(JNIEnv *env, jobject s { JavaStringParam localCellName(cellName); - ServerObject const * serverObject = NULL; + ServerObject const * serverObject = nullptr; if (!JavaLibrary::getObject(portallizedObject, serverObject)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("JavaLibrary::hasCell passed invalid object")); @@ -448,7 +448,7 @@ jlong JNICALL ScriptMethodsInteriorsNamespace::getCellId(JNIEnv *env, jobject se { JavaStringParam localCellName(cellName); - ServerObject const * serverObject = NULL; + ServerObject const * serverObject = nullptr; if (!JavaLibrary::getObject(portallizedObject, serverObject)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("[script bug] JavaLibrary::getCellId passed invalid object")); @@ -571,7 +571,7 @@ jobject JNICALL ScriptMethodsInteriorsNamespace::getBuildingEjectLocation(JNIEnv if (building == 0) { - DEBUG_WARNING(true, ("[designer bug] getBuildingEjectLocation was passed a NULL building objid")); + DEBUG_WARNING(true, ("[designer bug] getBuildingEjectLocation was passed a nullptr building objid")); return 0; } @@ -598,7 +598,7 @@ jobject JNICALL ScriptMethodsInteriorsNamespace::getBuildingEjectLocation(JNIEnv CellProperty const *worldCell = CellProperty::getWorldCellProperty(); if (!worldCell) { - DEBUG_WARNING(true, ("getBuildingEjectLocation get a NULL worldCell back from CellProperty::getWorldCellProperty()")); + DEBUG_WARNING(true, ("getBuildingEjectLocation get a nullptr worldCell back from CellProperty::getWorldCellProperty()")); return 0; } @@ -666,7 +666,7 @@ jlong JNICALL ScriptMethodsInteriorsNamespace::moveHouseItemToPlayer(JNIEnv * /* { if (building == 0) { - DEBUG_WARNING(true, ("[designer bug] moveHouseItemToPlayer was passed a NULL building objid")); + DEBUG_WARNING(true, ("[designer bug] moveHouseItemToPlayer was passed a nullptr building objid")); return 0; } @@ -693,7 +693,7 @@ jlong JNICALL ScriptMethodsInteriorsNamespace::moveHouseItemToPlayer2(JNIEnv * / { if (building == 0) { - DEBUG_WARNING(true, ("[designer bug] moveHouseItemToPlayer2 was passed a NULL building objid")); + DEBUG_WARNING(true, ("[designer bug] moveHouseItemToPlayer2 was passed a nullptr building objid")); return 0; } @@ -721,7 +721,7 @@ void JNICALL ScriptMethodsInteriorsNamespace::deleteAllHouseItems(JNIEnv * /*env { if (building == 0) { - DEBUG_WARNING(true, ("[designer bug] deleteAllHouseItems was passed a NULL building objid")); + DEBUG_WARNING(true, ("[designer bug] deleteAllHouseItems was passed a nullptr building objid")); return ; } @@ -747,11 +747,11 @@ jboolean JNICALL ScriptMethodsInteriorsNamespace::areAllContentsLoaded(JNIEnv * { if (building == 0) { - DEBUG_WARNING(true, ("[designer bug] areAllContentsLoaded was passed a NULL building objid")); + DEBUG_WARNING(true, ("[designer bug] areAllContentsLoaded was passed a nullptr building objid")); return JNI_FALSE; } - const BuildingObject * buildingObject = NULL; + const BuildingObject * buildingObject = nullptr; if (!JavaLibrary::getObject(building, buildingObject)) { DEBUG_WARNING(true, ("[designer bug] areAllContentsLoaded was passed a non-ServerObject objid")); @@ -767,11 +767,11 @@ void JNICALL ScriptMethodsInteriorsNamespace::loadBuildingContents(JNIEnv * /*en { if (building == 0) { - DEBUG_WARNING(true, ("[designer bug] loadBuildingContents was passed a NULL building objid")); + DEBUG_WARNING(true, ("[designer bug] loadBuildingContents was passed a nullptr building objid")); return; } - BuildingObject * buildingObject = NULL; + BuildingObject * buildingObject = nullptr; if (!JavaLibrary::getObject(building, buildingObject)) { DEBUG_WARNING(true, ("[designer bug] loadBuildingContents was passed a non-ServerObject objid")); @@ -815,9 +815,9 @@ jboolean JNICALL ScriptMethodsInteriorsNamespace::isAtPendingLoadRequestLimit(JN jstring JNICALL ScriptMethodsInteriorsNamespace::getCellLabel(JNIEnv * env, jobject self, jlong target) { - CellObject const *cellObject = NULL; + CellObject const *cellObject = nullptr; if (!JavaLibrary::getObject(target, cellObject)) - return NULL; + return nullptr; JavaString cellLabel(cellObject->getCellLabel()); return cellLabel.getReturnValue(); @@ -833,7 +833,7 @@ jboolean JNICALL ScriptMethodsInteriorsNamespace::setCellLabel(JNIEnv * env, job if (!JavaLibrary::convert(localCellLabel, cellLabelString)) return JNI_FALSE; - CellObject * cellObject = NULL; + CellObject * cellObject = nullptr; if (!JavaLibrary::getObject(target, cellObject)) return JNI_FALSE; @@ -846,7 +846,7 @@ jboolean JNICALL ScriptMethodsInteriorsNamespace::setCellLabel(JNIEnv * env, job jboolean JNICALL ScriptMethodsInteriorsNamespace::setCellLabelOffset(JNIEnv * env, jobject self, jlong target, jfloat x, jfloat y, jfloat z) { - CellObject * cellObject = NULL; + CellObject * cellObject = nullptr; if (!JavaLibrary::getObject(target, cellObject)) return JNI_FALSE; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsJedi.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsJedi.cpp index 1afeec06..188193c7 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsJedi.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsJedi.cpp @@ -120,7 +120,7 @@ jint JNICALL ScriptMethodsJediNamespace::getMaxForcePower(JNIEnv *env, jobject s { UNREF(self); - const CreatureObject * creature = NULL; + const CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return 0; @@ -128,7 +128,7 @@ jint JNICALL ScriptMethodsJediNamespace::getMaxForcePower(JNIEnv *env, jobject s return 0; PlayerObject const * const playerObject = PlayerCreatureController::getPlayerObject(creature); - if (playerObject == NULL) + if (playerObject == nullptr) return 0; return playerObject->getMaxForcePower(); @@ -148,7 +148,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::setMaxForcePower(JNIEnv *env, jobje { UNREF(self); - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -159,7 +159,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::setMaxForcePower(JNIEnv *env, jobje } PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(creature); - if (playerObject == NULL) + if (playerObject == nullptr) return JNI_FALSE; playerObject->setMaxForcePower(value); @@ -180,7 +180,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::alterMaxForcePower(JNIEnv *env, job { UNREF(self); - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -191,7 +191,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::alterMaxForcePower(JNIEnv *env, job } PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(creature); - if (playerObject == NULL) + if (playerObject == nullptr) return JNI_FALSE; playerObject->setMaxForcePower(playerObject->getMaxForcePower() + delta); @@ -211,7 +211,7 @@ jint JNICALL ScriptMethodsJediNamespace::getForcePower(JNIEnv *env, jobject self { UNREF(self); - const CreatureObject * creature = NULL; + const CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return 0; @@ -219,7 +219,7 @@ jint JNICALL ScriptMethodsJediNamespace::getForcePower(JNIEnv *env, jobject self return 0; PlayerObject const * const playerObject = PlayerCreatureController::getPlayerObject(creature); - if (playerObject == NULL) + if (playerObject == nullptr) return 0; return playerObject->getForcePower(); @@ -239,7 +239,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::setForcePower(JNIEnv *env, jobject { UNREF(self); - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -250,7 +250,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::setForcePower(JNIEnv *env, jobject } PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(creature); - if (playerObject == NULL) + if (playerObject == nullptr) return JNI_FALSE; playerObject->setForcePower(value); @@ -271,7 +271,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::alterForcePower(JNIEnv *env, jobjec { UNREF(self); - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -282,7 +282,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::alterForcePower(JNIEnv *env, jobjec } PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(creature); - if (playerObject == NULL) + if (playerObject == nullptr) return JNI_FALSE; playerObject->setForcePower(playerObject->getForcePower() + delta); @@ -302,7 +302,7 @@ jfloat JNICALL ScriptMethodsJediNamespace::getForcePowerRegenRate(JNIEnv *env, j { UNREF(self); - const CreatureObject * creature = NULL; + const CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return 0; @@ -310,7 +310,7 @@ jfloat JNICALL ScriptMethodsJediNamespace::getForcePowerRegenRate(JNIEnv *env, j return 0; PlayerObject const * const playerObject = PlayerCreatureController::getPlayerObject(creature); - if (playerObject == NULL) + if (playerObject == nullptr) return 0; return playerObject->getForcePowerRegenRate(); @@ -330,7 +330,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::setForcePowerRegenRate(JNIEnv *env, { UNREF(self); - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -341,7 +341,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::setForcePowerRegenRate(JNIEnv *env, } PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(creature); - if (playerObject == NULL) + if (playerObject == nullptr) return JNI_FALSE; playerObject->setForcePowerRegenRate(rate); @@ -359,7 +359,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::setForcePowerRegenRate(JNIEnv *env, */ jint JNICALL ScriptMethodsJediNamespace::getJediState(JNIEnv *env, jobject self, jlong jedi) { - const CreatureObject * object = NULL; + const CreatureObject * object = nullptr; if (!JavaLibrary::getObject(jedi, object)) { WARNING(true, ("JavaLibrary::getJediState did not find creature for id passed in")); @@ -367,7 +367,7 @@ jint JNICALL ScriptMethodsJediNamespace::getJediState(JNIEnv *env, jobject self, } const SwgPlayerObject * player = safe_cast(PlayerCreatureController::getPlayerObject(object)); - if (player == NULL) + if (player == nullptr) { WARNING(true, ("JavaLibrary::getJediState did not find player for creature " "%s", object->getNetworkId().getValueString().c_str())); @@ -389,12 +389,12 @@ jint JNICALL ScriptMethodsJediNamespace::getJediState(JNIEnv *env, jobject self, */ jboolean JNICALL ScriptMethodsJediNamespace::setJediState(JNIEnv *env, jobject self, jlong jedi, jint state) { - CreatureObject * object = NULL; + CreatureObject * object = nullptr; if (!JavaLibrary::getObject(jedi, object)) return JNI_FALSE; SwgPlayerObject * const player = safe_cast(PlayerCreatureController::getPlayerObject(object)); - if (player == NULL) + if (player == nullptr) return JNI_FALSE; if (state == JS_none || @@ -424,7 +424,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::setJediState(JNIEnv *env, jobject s */ jboolean JNICALL ScriptMethodsJediNamespace::hasJediSlot(JNIEnv * env, jobject self, jlong target) { - const ServerObject * player = NULL; + const ServerObject * player = nullptr; if (!JavaLibrary::getObject(target, player)) return JNI_FALSE; @@ -444,12 +444,12 @@ jboolean JNICALL ScriptMethodsJediNamespace::hasJediSlot(JNIEnv * env, jobject s */ jboolean JNICALL ScriptMethodsJediNamespace::addJediSlot(JNIEnv * env, jobject self, jlong target) { - const CreatureObject * object = NULL; + const CreatureObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; PlayerObject const * const player = PlayerCreatureController::getPlayerObject(object); - if (player == NULL) + if (player == nullptr) return JNI_FALSE; player->addJediToAccount(); @@ -475,12 +475,12 @@ jboolean JNICALL ScriptMethodsJediNamespace::isJedi(JNIEnv * env, jobject self, { UNREF(self); - const CreatureObject * creature = NULL; + const CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; const PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); - if (player == NULL) + if (player == nullptr) return JNI_FALSE; const SwgPlayerObject * jedi = safe_cast(player); @@ -502,12 +502,12 @@ jint JNICALL ScriptMethodsJediNamespace::getJediVisibility(JNIEnv * env, jobject { UNREF(self); - const CreatureObject * creature = NULL; + const CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return -1; const PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); - if (player == NULL) + if (player == nullptr) return JNI_FALSE; const SwgPlayerObject * jedi = safe_cast(player); @@ -531,12 +531,12 @@ jboolean JNICALL ScriptMethodsJediNamespace::setJediVisibility(JNIEnv * env, job { UNREF(self); - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); - if (player == NULL) + if (player == nullptr) return JNI_FALSE; SwgPlayerObject * jedi = safe_cast(player); @@ -561,12 +561,12 @@ jboolean JNICALL ScriptMethodsJediNamespace::changeJediVisibility(JNIEnv * env, { UNREF(self); - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); - if (player == NULL) + if (player == nullptr) return JNI_FALSE; SwgPlayerObject * jedi = safe_cast(player); @@ -591,19 +591,19 @@ jboolean JNICALL ScriptMethodsJediNamespace::setJediBountyValue(JNIEnv * env, jo { UNREF(self); - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; SwgCreatureObject const * jediCreature = safe_cast(creature); PlayerObject const * player = PlayerCreatureController::getPlayerObject(creature); - if (player == NULL) + if (player == nullptr) return JNI_FALSE; SwgPlayerObject const * jediPlayer = safe_cast(player); JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager == NULL) + if (jediManager == nullptr) return JNI_FALSE; jediManager->addJedi(creature->getNetworkId(), creature->getObjectName(), @@ -631,7 +631,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::setJediBountyValue(JNIEnv * env, jo * @param bounties limit for number of bounties on the Jedi statistic * @param state what state(s) the Jedi should have * - * @return a dictionary with the Jedi data on success, null on error + * @return a dictionary with the Jedi data on success, nullptr on error */ jobject JNICALL ScriptMethodsJediNamespace::requestJedi(JNIEnv * env, jobject self, jint visibility, jint bountyValue, jint minLevel, jint maxLevel, jint hoursAlive, jint bounties, jint state) @@ -640,7 +640,7 @@ jobject JNICALL ScriptMethodsJediNamespace::requestJedi(JNIEnv * env, jobject se JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager == NULL) + if (jediManager == nullptr) return 0; ScriptParams params; @@ -658,7 +658,7 @@ jobject JNICALL ScriptMethodsJediNamespace::requestJedi(JNIEnv * env, jobject se * @param self class calling this function * @param target the id of the Jedi * - * @return a dictionary with the Jedi data on success, null on error + * @return a dictionary with the Jedi data on success, nullptr on error */ jobject JNICALL ScriptMethodsJediNamespace::requestOneJedi(JNIEnv * env, jobject self, jlong target) { @@ -666,7 +666,7 @@ jobject JNICALL ScriptMethodsJediNamespace::requestOneJedi(JNIEnv * env, jobject JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager == NULL) + if (jediManager == nullptr) return 0; const NetworkId id(target); @@ -704,7 +704,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::requestJediBounty(JNIEnv * env, job JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager == NULL) + if (jediManager == nullptr) return JNI_FALSE; const NetworkId targetId(target); @@ -751,7 +751,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::removeJediBounty(JNIEnv * env, jobj JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager == NULL) + if (jediManager == nullptr) return JNI_FALSE; const NetworkId targetId(target); @@ -781,7 +781,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::removeAllJediBounties(JNIEnv * env, JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager == NULL) + if (jediManager == nullptr) return JNI_FALSE; const NetworkId targetId(target); @@ -799,7 +799,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::removeAllJediBounties(JNIEnv * env, * @param self class calling this function * @param target the Jedi * - * @return an array of hunter ids, or null on error + * @return an array of hunter ids, or nullptr on error */ jlongArray JNICALL ScriptMethodsJediNamespace::getJediBounties(JNIEnv * env, jobject self, jlong target) { @@ -807,7 +807,7 @@ jlongArray JNICALL ScriptMethodsJediNamespace::getJediBounties(JNIEnv * env, job JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager == NULL) + if (jediManager == nullptr) return 0; const NetworkId targetId(target); @@ -837,7 +837,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::isBeingHuntedByBountyHunter(JNIEnv JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager == NULL) + if (jediManager == nullptr) return JNI_FALSE; const NetworkId targetId(target); @@ -861,7 +861,7 @@ jboolean JNICALL ScriptMethodsJediNamespace::isBeingHuntedByBountyHunter(JNIEnv * @param self class calling this function * @param hunter the bounty hunter * - * @return an array of jedi ids, or null on error + * @return an array of jedi ids, or nullptr on error */ jlongArray JNICALL ScriptMethodsJediNamespace::getBountyHunterBounties(JNIEnv * env, jobject self, jlong hunter) { @@ -869,7 +869,7 @@ jlongArray JNICALL ScriptMethodsJediNamespace::getBountyHunterBounties(JNIEnv * JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager == NULL) + if (jediManager == nullptr) return 0; const NetworkId hunterId(hunter); @@ -899,7 +899,7 @@ void JNICALL ScriptMethodsJediNamespace::updateJediScriptData(JNIEnv * env, jobj { JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager == NULL) + if (jediManager == nullptr) return; const NetworkId targetId(target); @@ -926,7 +926,7 @@ void JNICALL ScriptMethodsJediNamespace::removeJediScriptData(JNIEnv * env, jobj { JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager == NULL) + if (jediManager == nullptr) return; const NetworkId targetId(target); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsMap.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsMap.cpp index 9bcaa8d8..9d7f4dc1 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsMap.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsMap.cpp @@ -253,7 +253,7 @@ jobjectArray JNICALL ScriptMethodsMapNamespace::getPlanetaryMapLocations( if(!JavaLibrary::convert(localCategory, categoryName)) { DEBUG_WARNING(true, ("[script bug] invalid category passed to getPlanetaryMapLocations")); - return NULL; + return nullptr; } } @@ -264,7 +264,7 @@ jobjectArray JNICALL ScriptMethodsMapNamespace::getPlanetaryMapLocations( if(!JavaLibrary::convert(localSubCategory, subCategoryName)) { DEBUG_WARNING(true, ("[script bug] invalid SubCategory passed to getPlanetaryMapLocations")); - return NULL; + return nullptr; } } @@ -282,12 +282,12 @@ jobjectArray JNICALL ScriptMethodsMapNamespace::getPlanetaryMapLocations( jlong jLocationId = mapLocation.getLocationId().getValue(); if (!jLocationId) - return NULL; + return nullptr; JavaString jNameString(mapLocation.getLocationName()); if (jNameString.getValue() == 0) - return NULL; + return nullptr; LocalRefPtr jMapLocation = createNewObject(JavaLibrary::getClsMapLocation(), JavaLibrary::getMidMapLocation(), @@ -299,7 +299,7 @@ jobjectArray JNICALL ScriptMethodsMapNamespace::getPlanetaryMapLocations( static_cast (mapLocation.getFlags())); if (jMapLocation == LocalRef::cms_nullPtr) - return NULL; + return nullptr; setObjectArrayElement(*jlocs, index, *jMapLocation); } @@ -318,7 +318,7 @@ jobjectArray JNICALL ScriptMethodsMapNamespace::getPlanetaryMapCategories (JNI if(!JavaLibrary::convert(localCategory, categoryName)) { DEBUG_WARNING(true, ("[script bug] invalid category passed to getPlanetaryMapCategories")); - return NULL; + return nullptr; } } @@ -350,14 +350,14 @@ jobject JNICALL ScriptMethodsMapNamespace::getPlanetaryMapLocation (JNI if (id == NetworkId::cms_invalid) { DEBUG_WARNING(true, ("[script bug] invalid locationId passed to getPlanetaryMapCategories")); - return NULL; + return nullptr; } int mlt = 0; const MapLocation * const mapLocation = PlanetMapManagerServer::getLocation (id, mlt); if (!mapLocation) - return NULL; + return nullptr; const JavaString jLocName (mapLocation->m_locationName); const JavaString jLocCategoryName (PlanetMapManager::findCategoryName (mapLocation->m_category)); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsMentalStates.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsMentalStates.cpp index c4dd20c1..fc11623f 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsMentalStates.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsMentalStates.cpp @@ -310,7 +310,7 @@ jboolean JNICALL ScriptMethodsMentalStatesNamespace::addMentalStateModifier(JNIE * @param mob id of creature to access * @param mentalState mental state we are interested in * - * @return the mental state modifiers for the creature, or null if it has none + * @return the mental state modifiers for the creature, or nullptr if it has none */ jobjectArray JNICALL ScriptMethodsMentalStatesNamespace::getMentalStateModifiers(JNIEnv *env, jobject self, jlong mob, jint mentalState) { @@ -697,7 +697,7 @@ jboolean JNICALL ScriptMethodsMentalStatesNamespace::addMentalStateModifierTowar * @param mob id of creature to access * @param mentalState mental state we are interested in * - * @return the mental state modifiers for the creature, or null if it has none + * @return the mental state modifiers for the creature, or nullptr if it has none */ jobjectArray JNICALL ScriptMethodsMentalStatesNamespace::getMentalStateModifiersToward(JNIEnv *env, jobject self, jlong mob, jlong target, jint mentalState) { diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsMission.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsMission.cpp index 815bb35a..13e82707 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsMission.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsMission.cpp @@ -170,17 +170,17 @@ void JNICALL ScriptMethodsMissionNamespace::abortMission(JNIEnv * env, jobject s } else { - DEBUG_WARNING(true, ("[designer bug] abortMission() missionObject is NULL")); + DEBUG_WARNING(true, ("[designer bug] abortMission() missionObject is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] abortMission() self is NULL")); + DEBUG_WARNING(true, ("[programmer bug] abortMission() self is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] abortMission() JNIEnv is NULL")); + DEBUG_WARNING(true, ("[programmer bug] abortMission() JNIEnv is nullptr")); } } @@ -283,17 +283,17 @@ jstring JNICALL ScriptMethodsMissionNamespace::getMissionCreator(JNIEnv * env, j } else { - DEBUG_WARNING(true, ("[designer bug] getMissionCreator() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] getMissionCreator() missionObject (parameter 1) is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] getMissionCreator() self is NULL")); + DEBUG_WARNING(true, ("[programmer bug] getMissionCreator() self is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] getMissionCreator() JNIEnv is NULL")); + DEBUG_WARNING(true, ("[programmer bug] getMissionCreator() JNIEnv is nullptr")); } return result; } @@ -304,13 +304,13 @@ jobject JNICALL ScriptMethodsMissionNamespace::getMissionDescription(JNIEnv * en { if(! env) { - DEBUG_WARNING(true, ("[programmer bug] getMissionDescription() JNIEnv is NULL")); + DEBUG_WARNING(true, ("[programmer bug] getMissionDescription() JNIEnv is nullptr")); return 0; } if(! missionObject) { - DEBUG_WARNING(true, ("[designer bug] getMissionDescription() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] getMissionDescription() missionObject (parameter 1) is nullptr")); return 0; } @@ -352,17 +352,17 @@ jint JNICALL ScriptMethodsMissionNamespace::getMissionDifficulty(JNIEnv * env, j } else { - DEBUG_WARNING(true, ("[designer bug] getMissionDifficulty() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] getMissionDifficulty() missionObject (parameter 1) is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] getMissionDifficulty() self is NULL")); + DEBUG_WARNING(true, ("[programmer bug] getMissionDifficulty() self is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] getMissionDifficulty() JNIEnv is NULL")); + DEBUG_WARNING(true, ("[programmer bug] getMissionDifficulty() JNIEnv is nullptr")); } return result; } @@ -390,7 +390,7 @@ jobject JNICALL ScriptMethodsMissionNamespace::getMissionEndLocation(JNIEnv * en } else { - DEBUG_WARNING(true, ("[designer bug] getMissionEndLocation() missionObject (parameter1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] getMissionEndLocation() missionObject (parameter1) is nullptr")); } return 0; } @@ -418,17 +418,17 @@ jint JNICALL ScriptMethodsMissionNamespace::getMissionReward(JNIEnv * env, jobje } else { - DEBUG_WARNING(true, ("[designer bug] getMissionReward() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] getMissionReward() missionObject (parameter 1) is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] getMissionReward() self is NULL")); + DEBUG_WARNING(true, ("[programmer bug] getMissionReward() self is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] getMissionReward() JNIEnv is NULL")); + DEBUG_WARNING(true, ("[programmer bug] getMissionReward() JNIEnv is nullptr")); } return result; } @@ -454,7 +454,7 @@ jobject JNICALL ScriptMethodsMissionNamespace::getMissionStartLocation(JNIEnv * } else { - DEBUG_WARNING(true, ("[designer bug] getMissionStartLocation() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] getMissionStartLocation() missionObject (parameter 1) is nullptr")); } return 0; } @@ -483,7 +483,7 @@ jstring JNICALL ScriptMethodsMissionNamespace::getMissionTargetName(JNIEnv * env } else { - DEBUG_WARNING(true, ("[designer bug] getMissionTargetName() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] getMissionTargetName() missionObject (parameter 1) is nullptr")); } return 0; } @@ -494,7 +494,7 @@ jobject JNICALL ScriptMethodsMissionNamespace::getMissionTitle(JNIEnv * env, job { if(! missionObject) { - DEBUG_WARNING(true, ("[designer bug] getMissionTitle() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] getMissionTitle() missionObject (parameter 1) is nullptr")); return 0; } @@ -537,7 +537,7 @@ jstring JNICALL ScriptMethodsMissionNamespace::getMissionType(JNIEnv * env, jobj } else { - DEBUG_WARNING(true, ("[designer bug] getMissionType() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] getMissionType() missionObject (parameter 1) is nullptr")); } return 0; } @@ -556,7 +556,7 @@ jlong JNICALL ScriptMethodsMissionNamespace::getMissionHolder(JNIEnv * env, jobj MissionObject * mo = 0; if(JavaLibrary::getObject(missionObject, mo)) { - if (mo != NULL && mo->getMissionHolderId() != NetworkId::cms_invalid) + if (mo != nullptr && mo->getMissionHolderId() != NetworkId::cms_invalid) { result = (mo->getMissionHolderId()).getValue(); } @@ -572,17 +572,17 @@ jlong JNICALL ScriptMethodsMissionNamespace::getMissionHolder(JNIEnv * env, jobj } else { - DEBUG_WARNING(true, ("[designer bug] getMissionHolder() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] getMissionHolder() missionObject (parameter 1) is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] getMissionHolder() self is NULL")); + DEBUG_WARNING(true, ("[programmer bug] getMissionHolder() self is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] getMissionHolder() JNIEnv is NULL")); + DEBUG_WARNING(true, ("[programmer bug] getMissionHolder() JNIEnv is nullptr")); } return result; } @@ -609,7 +609,7 @@ jstring JNICALL ScriptMethodsMissionNamespace::getMissionRootScriptName(JNIEnv * } else { - DEBUG_WARNING(true, ("[designer bug] getMissionRootScriptName() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] getMissionRootScriptName() missionObject (parameter 1) is nullptr")); } return 0; } @@ -641,22 +641,22 @@ void JNICALL ScriptMethodsMissionNamespace::setMissionCreator(JNIEnv *env, jobje } else { - DEBUG_WARNING(true, ("[designer bug] setMissionCreator() creator (parameter 2) is NULL")); + DEBUG_WARNING(true, ("[designer bug] setMissionCreator() creator (parameter 2) is nullptr")); } } else { - DEBUG_WARNING(true, ("[designer bug] setMissionCreator() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] setMissionCreator() missionObject (parameter 1) is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionCreator() self is NULL")); + DEBUG_WARNING(true, ("[programmer bug] setMissionCreator() self is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionCreator() JNIEnv is NULL")); + DEBUG_WARNING(true, ("[programmer bug] setMissionCreator() JNIEnv is nullptr")); } } @@ -686,7 +686,7 @@ void JNICALL ScriptMethodsMissionNamespace::setMissionDescription(JNIEnv * env, } else { - DEBUG_WARNING(true, ("[designer bug] setMissionDescription() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] setMissionDescription() missionObject (parameter 1) is nullptr")); } } @@ -708,7 +708,7 @@ void JNICALL ScriptMethodsMissionNamespace::setMissionDifficulty(JNIEnv * env, j } else { - DEBUG_WARNING(true, ("[designer bug] setMissionDifficulty() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] setMissionDifficulty() missionObject (parameter 1) is nullptr")); } } @@ -764,17 +764,17 @@ void JNICALL ScriptMethodsMissionNamespace::setMissionReward(JNIEnv * env, jobje } else { - DEBUG_WARNING(true, ("[designer bug] setMissionProfessionRank() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] setMissionProfessionRank() missionObject (parameter 1) is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionProfessionRank() self is NULL")); + DEBUG_WARNING(true, ("[programmer bug] setMissionProfessionRank() self is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionProfessionRank() JNIEnv is NULL")); + DEBUG_WARNING(true, ("[programmer bug] setMissionProfessionRank() JNIEnv is nullptr")); } } @@ -806,7 +806,7 @@ void JNICALL ScriptMethodsMissionNamespace::setMissionStartLocation(JNIEnv * env } else { - DEBUG_WARNING(true, ("[designer bug] setMissionStartLocation() location (parameter 2) is NULL")); + DEBUG_WARNING(true, ("[designer bug] setMissionStartLocation() location (parameter 2) is nullptr")); } } else @@ -816,17 +816,17 @@ void JNICALL ScriptMethodsMissionNamespace::setMissionStartLocation(JNIEnv * env } else { - DEBUG_WARNING(true, ("[designer bug] setMissionStartLocation() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] setMissionStartLocation() missionObject (parameter 1) is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionStartLocation() self is NULL")); + DEBUG_WARNING(true, ("[programmer bug] setMissionStartLocation() self is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionStartLocation() JNIEnv is NULL")); + DEBUG_WARNING(true, ("[programmer bug] setMissionStartLocation() JNIEnv is nullptr")); } } @@ -856,17 +856,17 @@ void JNICALL ScriptMethodsMissionNamespace::setMissionTargetAppearance(JNIEnv * } else { - DEBUG_WARNING(true, ("[designer bug] setMissionTarget() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] setMissionTarget() missionObject (parameter 1) is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionTarget() self is NULL")); + DEBUG_WARNING(true, ("[programmer bug] setMissionTarget() self is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionTarget() JNIEnv is NULL")); + DEBUG_WARNING(true, ("[programmer bug] setMissionTarget() JNIEnv is nullptr")); } } @@ -896,17 +896,17 @@ void JNICALL ScriptMethodsMissionNamespace::setMissionTargetName(JNIEnv * env, j } else { - DEBUG_WARNING(true, ("[designer bug] setMissionTarget() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] setMissionTarget() missionObject (parameter 1) is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionTarget() self is NULL")); + DEBUG_WARNING(true, ("[programmer bug] setMissionTarget() self is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionTarget() JNIEnv is NULL")); + DEBUG_WARNING(true, ("[programmer bug] setMissionTarget() JNIEnv is nullptr")); } } @@ -936,7 +936,7 @@ void JNICALL ScriptMethodsMissionNamespace::setMissionTitle(JNIEnv * env, jobjec } else { - DEBUG_WARNING(true, ("[designer bug] setMissionTitle() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] setMissionTitle() missionObject (parameter 1) is nullptr")); } } @@ -969,22 +969,22 @@ void JNICALL ScriptMethodsMissionNamespace::setMissionType(JNIEnv *env, jobject } else { - DEBUG_WARNING(true, ("[designer bug] setMissionType() typeName (parameter 2) is NULL")); + DEBUG_WARNING(true, ("[designer bug] setMissionType() typeName (parameter 2) is nullptr")); } } else { - DEBUG_WARNING(true, ("[designer bug] setMissionType() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] setMissionType() missionObject (parameter 1) is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionType() self is NULL")); + DEBUG_WARNING(true, ("[programmer bug] setMissionType() self is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionType() JNIEnv is NULL")); + DEBUG_WARNING(true, ("[programmer bug] setMissionType() JNIEnv is nullptr")); } } @@ -1022,22 +1022,22 @@ void JNICALL ScriptMethodsMissionNamespace::setMissionRootScriptName(JNIEnv *env } else { - DEBUG_WARNING(true, ("[designer bug] setMissionRootScriptName() rootScriptName (parameter 2) is NULL")); + DEBUG_WARNING(true, ("[designer bug] setMissionRootScriptName() rootScriptName (parameter 2) is nullptr")); } } else { - DEBUG_WARNING(true, ("[designer bug] setMissionRootScriptName() missionObject (parameter 1) is NULL")); + DEBUG_WARNING(true, ("[designer bug] setMissionRootScriptName() missionObject (parameter 1) is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionRootScriptName() self is NULL")); + DEBUG_WARNING(true, ("[programmer bug] setMissionRootScriptName() self is nullptr")); } } else { - DEBUG_WARNING(true, ("[programmer bug] setMissionRootScriptName() JNIEnv is NULL")); + DEBUG_WARNING(true, ("[programmer bug] setMissionRootScriptName() JNIEnv is nullptr")); } } diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsMoney.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsMoney.cpp index 542b801e..d0afcd98 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsMoney.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsMoney.cpp @@ -110,7 +110,7 @@ jboolean JNICALL ScriptMethodsMoneyNamespace::transferCashTo(JNIEnv *env, jobjec return JNI_FALSE; ServerObject *sourceObj = ServerWorld::findObjectByNetworkId(sourceObjId); - if (sourceObj == NULL || targetObjId == NetworkId::cms_invalid || ownerOID == NetworkId::cms_invalid) + if (sourceObj == nullptr || targetObjId == NetworkId::cms_invalid || ownerOID == NetworkId::cms_invalid) return JNI_FALSE; // Do money transfer (will be forwarded if object is not authoritative) @@ -157,7 +157,7 @@ jboolean JNICALL ScriptMethodsMoneyNamespace::transferBankCreditsTo(JNIEnv *env, return JNI_FALSE; ServerObject *sourceObj = ServerWorld::findObjectByNetworkId(sourceObjId); - if (sourceObj == NULL || targetObjId == NetworkId::cms_invalid || ownerOID == NetworkId::cms_invalid) + if (sourceObj == nullptr || targetObjId == NetworkId::cms_invalid || ownerOID == NetworkId::cms_invalid) return JNI_FALSE; // Do money transfer (will be forwarded if object is not authoritative) @@ -203,7 +203,7 @@ jboolean JNICALL ScriptMethodsMoneyNamespace::withdrawCashFromBank (JNIEnv *env, return JNI_FALSE; ServerObject *sourceObj = ServerWorld::findObjectByNetworkId(sourceObjId); - if (sourceObj == NULL || ownerOID == NetworkId::cms_invalid) + if (sourceObj == nullptr || ownerOID == NetworkId::cms_invalid) return JNI_FALSE; // Do money transfer (will be forwarded if object is not authoritative) @@ -243,7 +243,7 @@ jboolean JNICALL ScriptMethodsMoneyNamespace::depositCashToBank(JNIEnv *env, job if (failCallbackFunction != 0 && !JavaLibrary::convert(JavaStringParam(failCallbackFunction), failCallback)) return JNI_FALSE; - ServerObject *sourceObj = NULL; + ServerObject *sourceObj = nullptr; if (!JavaLibrary::getObject(source, sourceObj)) return JNI_FALSE; @@ -260,7 +260,7 @@ jboolean JNICALL ScriptMethodsMoneyNamespace::depositCashToBank(JNIEnv *env, job void JNICALL ScriptMethodsMoneyNamespace::depositToGalacticReserve(JNIEnv *env, jobject self, jlong player) { - CreatureObject * objPlayer = NULL; + CreatureObject * objPlayer = nullptr; if (!JavaLibrary::getObject(player, objPlayer) || !objPlayer) return; @@ -275,7 +275,7 @@ void JNICALL ScriptMethodsMoneyNamespace::depositToGalacticReserve(JNIEnv *env, void JNICALL ScriptMethodsMoneyNamespace::withdrawFromGalacticReserve(JNIEnv *env, jobject self, jlong player) { - CreatureObject * objPlayer = NULL; + CreatureObject * objPlayer = nullptr; if (!JavaLibrary::getObject(player, objPlayer) || !objPlayer) return; @@ -290,7 +290,7 @@ void JNICALL ScriptMethodsMoneyNamespace::withdrawFromGalacticReserve(JNIEnv *en jboolean JNICALL ScriptMethodsMoneyNamespace::canAccessGalacticReserve(JNIEnv *env, jobject self, jlong player) { - CreatureObject * objPlayer = NULL; + CreatureObject * objPlayer = nullptr; if (!JavaLibrary::getObject(player, objPlayer) || !objPlayer) return JNI_FALSE; @@ -376,7 +376,7 @@ jboolean JNICALL ScriptMethodsMoneyNamespace::transferBankCreditsToNamedAccount( return JNI_FALSE; ServerObject *sourceObj = ServerWorld::findObjectByNetworkId(sourceObjId); - if (sourceObj == NULL || targetString.size() == 0 || ownerOID == NetworkId::cms_invalid) + if (sourceObj == nullptr || targetString.size() == 0 || ownerOID == NetworkId::cms_invalid) return JNI_FALSE; // Do money transfer (will be forwarded if object is not authoritative) @@ -426,7 +426,7 @@ jboolean JNICALL ScriptMethodsMoneyNamespace::transferBankCreditsFromNamedAccoun return JNI_FALSE; ServerObject *targetObj = ServerWorld::findObjectByNetworkId(targetObjId); - if (targetObj == NULL || sourceString.size() == 0 || ownerOID == NetworkId::cms_invalid) + if (targetObj == nullptr || sourceString.size() == 0 || ownerOID == NetworkId::cms_invalid) return JNI_FALSE; // Do money transfer (will be forwarded if object is not authoritative) diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsMount.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsMount.cpp index 4f0e9c9f..2779be7b 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsMount.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsMount.cpp @@ -235,7 +235,7 @@ void JNICALL ScriptMethodsMountNamespace::dismountCreature(JNIEnv *env, jobject CreatureObject *const mountObject = riderObject->getMountedCreature(); if (!mountObject) { - LOG(LOCAL_LOG_CHANNEL, ("JavaLibrary::dismountCreature(): server id=[%d],rider id=[%s] has RidingMount state but CreatureObject::getMountedCreature() returns NULL, skipping dismount.", GameServer::getInstance().getProcessId(), riderObject->getNetworkId().getValueString().c_str())); + LOG(LOCAL_LOG_CHANNEL, ("JavaLibrary::dismountCreature(): server id=[%d],rider id=[%s] has RidingMount state but CreatureObject::getMountedCreature() returns nullptr, skipping dismount.", GameServer::getInstance().getProcessId(), riderObject->getNetworkId().getValueString().c_str())); return; } @@ -393,7 +393,7 @@ void JNICALL JNICALL ScriptMethodsMountNamespace::makeContainerStateInconsistent //-- Get the ServerObject from the object id. if (!containedObjectId) { - LOG("script-bug", ("makeContainerStateInconsistentTestOnly(): containedObjectId is NULL")); + LOG("script-bug", ("makeContainerStateInconsistentTestOnly(): containedObjectId is nullptr")); return; } @@ -428,7 +428,7 @@ void JNICALL JNICALL ScriptMethodsMountNamespace::makeContainerStateInconsistent Container* container = ContainerInterface::getContainer(*containerObject); if (!container) { - LOG("script-bug", ("makeContainerStateInconsistentTestOnly(): containerObject [%s] returned a NULL container", containerObject->getNetworkId().getValueString().c_str())); + LOG("script-bug", ("makeContainerStateInconsistentTestOnly(): containerObject [%s] returned a nullptr container", containerObject->getNetworkId().getValueString().c_str())); return; } diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsNewbieTutorial.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsNewbieTutorial.cpp index b94f7349..037b7ff5 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsNewbieTutorial.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsNewbieTutorial.cpp @@ -439,7 +439,7 @@ jobject JNICALL ScriptMethodsNewbieTutorialNamespace::getStartingLocationInf if (!jName) { - WARNING (true, ("getStartingLocationInfo null name")); + WARNING (true, ("getStartingLocationInfo nullptr name")); return JNI_FALSE; } diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsNotification.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsNotification.cpp index 8c8cff43..06d6b672 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsNotification.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsNotification.cpp @@ -52,7 +52,7 @@ const JNINativeMethod NATIVES[] = { jint JNICALL ScriptMethodsNotificationNamespace::addNotification(JNIEnv *env, jobject self, jlong player, jstring contents, jboolean useNotificationIcon, jint iconStyle, jfloat timeout, jint channel, jstring sound) { - CreatureObject const * playerObject = NULL; + CreatureObject const * playerObject = nullptr; if (!JavaLibrary::getObject(player, playerObject)) return 0; @@ -79,7 +79,7 @@ jint JNICALL ScriptMethodsNotificationNamespace::addNotification(JNIEnv *env, jo void JNICALL ScriptMethodsNotificationNamespace::cancelNotification(JNIEnv *env, jobject self, jlong player, jint notification) { - CreatureObject const * playerObject = NULL; + CreatureObject const * playerObject = nullptr; if (!JavaLibrary::getObject(player, playerObject)) return; ClientNotificationBoxMessage cnbm(notification, playerObject->getNetworkId(), Unicode::emptyString, FALSE, 0, 0.0f, ClientNotificationBoxMessage::NC_SPECIAL_CANCEL, std::string("")); @@ -94,7 +94,7 @@ void JNICALL ScriptMethodsNotificationNamespace::cancelNotification(JNIEnv *env, void JNICALL ScriptMethodsNotificationNamespace::cancelAllNotifications(JNIEnv *env, jobject self, jlong player) { - CreatureObject const * playerObject = NULL; + CreatureObject const * playerObject = nullptr; if (!JavaLibrary::getObject(player, playerObject)) return; ClientNotificationBoxMessage cnbm(0, playerObject->getNetworkId(), Unicode::emptyString, FALSE, 0, 0.0f, ClientNotificationBoxMessage::NC_SPECIAL_CANCEL_ALL, std::string("")); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsNpc.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsNpc.cpp index a617593b..f9c5e4ed 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsNpc.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsNpc.cpp @@ -190,14 +190,14 @@ jboolean JNICALL ScriptMethodsNpcNamespace::_npcStartConversation(JNIEnv *env, j if (!JavaLibrary::convert (localConvoName, convoNameStr)) return JNI_FALSE; - TangibleObject * playerObject = NULL; + TangibleObject * playerObject = nullptr; if (!JavaLibrary::getObject(player, playerObject)) return JNI_FALSE; if (playerObject->isInNpcConversation()) return JNI_FALSE; - TangibleObject * npcObject = NULL; + TangibleObject * npcObject = nullptr; if (!JavaLibrary::getObject(npc, npcObject)) return JNI_FALSE; @@ -234,7 +234,7 @@ jboolean JNICALL ScriptMethodsNpcNamespace::_npcStartConversation(JNIEnv *env, j jboolean JNICALL ScriptMethodsNpcNamespace::npcStartConversation(JNIEnv *env, jobject self, jlong player, jlong npc, jstring convoName, jobject greeting, jstring greetingOob, jobjectArray responses) { - TangibleObject * speakerObject = NULL; + TangibleObject * speakerObject = nullptr; if (!JavaLibrary::getObject(npc, speakerObject) || !speakerObject) return JNI_FALSE; @@ -243,7 +243,7 @@ jboolean JNICALL ScriptMethodsNpcNamespace::npcStartConversation(JNIEnv *env, jo uint32 crc = Crc::crcNull; ObjectTemplate const * const ot = ObjectTemplateList::fetch(conversationAppearanceOverride); - ServerObjectTemplate const * const sot = ot ? ot->asServerObjectTemplate() : NULL; + ServerObjectTemplate const * const sot = ot ? ot->asServerObjectTemplate() : nullptr; if(sot) { std::string const & sharedTemplateName = sot->getSharedTemplate(); @@ -263,7 +263,7 @@ jboolean JNICALL ScriptMethodsNpcNamespace::npcStartConversationAppearanceOverri return JNI_FALSE; ObjectTemplate const * const ot = ObjectTemplateList::fetch(appearanceOverrideSharedTemplateNameStr); - ServerObjectTemplate const * const sot = ot ? ot->asServerObjectTemplate() : NULL; + ServerObjectTemplate const * const sot = ot ? ot->asServerObjectTemplate() : nullptr; if(!sot) { return JNI_FALSE; @@ -290,7 +290,7 @@ jboolean JNICALL ScriptMethodsNpcNamespace::npcEndConversation(JNIEnv *env, jobj { UNREF(self); - TangibleObject * playerObject = NULL; + TangibleObject * playerObject = nullptr; if (!JavaLibrary::getObject(player, playerObject)) return JNI_FALSE; @@ -318,7 +318,7 @@ jboolean JNICALL ScriptMethodsNpcNamespace::npcSpeak(JNIEnv *env, jobject self, { UNREF(self); - TangibleObject * playerObject = NULL; + TangibleObject * playerObject = nullptr; if (!JavaLibrary::getObject(player, playerObject)) return JNI_FALSE; @@ -367,7 +367,7 @@ jboolean JNICALL ScriptMethodsNpcNamespace::npcSetConversationResponses(JNIEnv * { UNREF(self); - TangibleObject * playerObject = NULL; + TangibleObject * playerObject = nullptr; if (!JavaLibrary::getObject(player, playerObject)) return JNI_FALSE; @@ -396,7 +396,7 @@ jboolean JNICALL ScriptMethodsNpcNamespace::npcAddConversationResponse(JNIEnv *e { UNREF(self); - TangibleObject * playerObject = NULL; + TangibleObject * playerObject = nullptr; if (!JavaLibrary::getObject(player, playerObject)) return JNI_FALSE; @@ -455,7 +455,7 @@ jboolean JNICALL ScriptMethodsNpcNamespace::npcRemoveConversationResponse(JNIEnv { UNREF(self); - TangibleObject * playerObject = NULL; + TangibleObject * playerObject = nullptr; if (!JavaLibrary::getObject(player, playerObject)) return JNI_FALSE; @@ -488,7 +488,7 @@ jboolean JNICALL ScriptMethodsNpcNamespace::isInNpcConversation(JNIEnv *env, job { UNREF(self); - TangibleObject * tangibleObject = NULL; + TangibleObject * tangibleObject = nullptr; if (!JavaLibrary::getObject(creature, tangibleObject)) return JNI_FALSE; @@ -506,13 +506,13 @@ jboolean JNICALL ScriptMethodsNpcNamespace::isInNpcConversation(JNIEnv *env, job * @param self class calling this function * @param creature creature being asked about * - * @return an array of obj_ids the creature is in conversation with, or null on error + * @return an array of obj_ids the creature is in conversation with, or nullptr on error */ jlongArray JNICALL ScriptMethodsNpcNamespace::getNpcConversants(JNIEnv *env, jobject self, jlong creature) { UNREF(self); - TangibleObject * tangibleObject = NULL; + TangibleObject * tangibleObject = nullptr; if (!JavaLibrary::getObject(creature, tangibleObject)) return 0; @@ -621,7 +621,7 @@ jboolean JNICALL ScriptMethodsNpcNamespace::isNameReservedIgnoreRules(JNIEnv *en jboolean JNICALL ScriptMethodsNpcNamespace::npcEndConversationWithMessage(JNIEnv * /*env*/, jobject /*self*/, jlong player, jobject response, jstring responseOob) { - TangibleObject * playerObject = NULL; + TangibleObject * playerObject = nullptr; if(!JavaLibrary::getObject(player, playerObject)) return JNI_FALSE; @@ -658,7 +658,7 @@ jboolean JNICALL ScriptMethodsNpcNamespace::npcEndConversationWithMessage(JNIEnv jboolean JNICALL ScriptMethodsNpcNamespace::setNpcDifficulty(JNIEnv *env, jobject self, jlong npc, jlong difficulty) { - TangibleObject * npcObject = NULL; + TangibleObject * npcObject = nullptr; if (!JavaLibrary::getObject(npc, npcObject)) return JNI_FALSE; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsObjectCreate.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsObjectCreate.cpp index 37ab2bac..2f967f59 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsObjectCreate.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsObjectCreate.cpp @@ -257,11 +257,11 @@ jlong ScriptMethodsObjectCreateNamespace::createTheater(const std::vector float centerX = minx + dx / 2.0f + center.x; float centerZ = minz + dz / 2.0f + center.z; - TerrainGenerator::Layer * layer = NULL; + TerrainGenerator::Layer * layer = nullptr; if (locationType == IntangibleObject::TLT_flatten) { layer = TerrainModificationHelper::importLayer(THEATER_FLATTEN_LAYER.c_str()); - if (layer == NULL) + if (layer == nullptr) { WARNING (true, ("Layer %s not found for theater, using getGoodLocation " "instead", THEATER_FLATTEN_LAYER.c_str())); @@ -292,7 +292,7 @@ jlong ScriptMethodsObjectCreateNamespace::createTheater(const std::vector IntangibleObject * theater = safe_cast(ServerWorld::createNewObject(THEATER_TEMPLATE, tr, 0, false)); NOT_NULL(theater); theater->setTheater(); - if (layer != NULL) + if (layer != nullptr) { theater->setLayer(layer); } @@ -328,7 +328,7 @@ jlong ScriptMethodsObjectCreateNamespace::createTheater(const std::vector * @param source the template id or the object id to create the object with * @param location where to put the object * - * @return the new object, or null on error + * @return the new object, or nullptr on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInWorld(JNIEnv *env, jobject self, jlong source, jobject location) { @@ -340,7 +340,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInWorld(JNIEnv // determine what source is and create the object std::string localName; - ServerObject* object = NULL; + ServerObject* object = nullptr; if (!JavaLibrary::getObject(source, object)) return 0; localName = object->getTemplateName(); @@ -366,7 +366,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInWorld(JNIEnv * @param source the template id or the object id to create the object with * @param location where to put the object * - * @return the new object, or null on error + * @return the new object, or nullptr on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInWorldString(JNIEnv *env, jobject self, jobject source, jobject location) { @@ -445,7 +445,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectAt(JNIEnv *env, * @param container the object we want to put our new object into * @param slot the container slot we want to put the object in * - * @return the new object, or null on error + * @return the new object, or nullptr on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInContainer(JNIEnv *env, jobject self, jlong source, jlong container, jstring slot) { @@ -457,7 +457,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInContainer(JNI // determine what source is and create the object std::string templateName; - const ServerObject* object = NULL; + const ServerObject* object = nullptr; if (!JavaLibrary::getObject(source, object)) return 0; templateName = object->getTemplateName(); @@ -536,7 +536,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInContainerOver // determine what source is and create the object std::string templateName; - const ServerObject* object = NULL; + const ServerObject* object = nullptr; if (!JavaLibrary::getObject(source, object)) return 0; templateName = object->getTemplateName(); @@ -598,7 +598,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInContainerOver * @param sourceName the template name used to create the object * @param target the creature to create the object in * - * @return the obj_id of the created object, or null on error + * @return the obj_id of the created object, or nullptr on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInInventoryOverloaded(JNIEnv *env, jobject self, jstring sourceName, jlong target) { @@ -624,7 +624,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInInventoryOver * @param sourceCrc the template crc to create the object with * @param location where to put the object * - * @return the new object, or null on error + * @return the new object, or nullptr on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectCrc(JNIEnv *env, jobject self, int sourceCrc, jobject location) { @@ -656,7 +656,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectCrc(JNIEnv *env Transform tr; tr.setPosition_p(newPos); ServerObject *newObject = ServerWorld::createNewObject(sourceCrc, tr, cell, false); - if (newObject != NULL) + if (newObject != nullptr) { // get the networkId to return NetworkId netId = newObject->getNetworkId(); @@ -693,7 +693,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectCrc(JNIEnv *env * @param container the object we want to put our new object into * @param slot the container slot we want to put the object in * - * @return the new object, or null on error + * @return the new object, or nullptr on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInContainerCrc(JNIEnv *env, jobject self, int sourceCrc, jlong container, jstring slot) { @@ -707,10 +707,10 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInContainerCrc( return 0; // make sure the container exists - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) return 0; - if (ContainerInterface::getContainer(*containerOwner) == NULL) + if (ContainerInterface::getContainer(*containerOwner) == nullptr) return 0; //Create the object @@ -773,10 +773,10 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInContainerOver return 0; // make sure the container exists - ServerObject * containerOwner = NULL; + ServerObject * containerOwner = nullptr; if (!JavaLibrary::getObject(container, containerOwner)) return 0; - if (ContainerInterface::getVolumeContainer(*containerOwner) == NULL) + if (ContainerInterface::getVolumeContainer(*containerOwner) == nullptr) { DEBUG_WARNING(true, ("createObjectin an overloaded container only works on volume containers")); return 0; @@ -811,7 +811,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInContainerOver * @param sourceCrc the template crc used to create the object * @param target the creature to create the object in * - * @return the obj_id of the created object, or null on error + * @return the obj_id of the created object, or nullptr on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInInventoryOverloadedCrc( JNIEnv *env, jobject self, int sourceCrc, jlong target) @@ -819,16 +819,16 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInInventoryOver if (sourceCrc == 0 || target == 0) return 0; - CreatureObject * targetObject = NULL; + CreatureObject * targetObject = nullptr; if (!JavaLibrary::getObject(target, targetObject)) return 0; ServerObject * inventory = targetObject->getInventory(); - if (inventory == NULL) + if (inventory == nullptr) return 0; VolumeContainer * volContainer = ContainerInterface::getVolumeContainer(*inventory); - if (volContainer == NULL) + if (volContainer == nullptr) return 0; int oldCapacity = volContainer->debugDoNotUseSetCapacity(-1); @@ -838,7 +838,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInInventoryOver volContainer->debugDoNotUseSetCapacity(oldCapacity); volContainer->recalculateVolume(); - if (newObject == NULL) + if (newObject == nullptr) return 0; return (newObject->getNetworkId()).getValue(); @@ -852,7 +852,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectInInventoryOver * @param self class calling this function * @param sourceCrc the template crc of the new object to create * @param target an object whose location and container/cell will be used to create the object. - * @return the obj_id of the created object, or null on error + * @return the obj_id of the created object, or nullptr on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectAtCrc(JNIEnv *env, jobject self, int sourceCrc, jlong target) { @@ -863,7 +863,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectAtCrc(JNIEnv *e if (target == 0) return 0; - ServerObject *sourceObject = NULL; + ServerObject *sourceObject = nullptr; if (!JavaLibrary::getObject(target, sourceObject)) return 0; @@ -878,7 +878,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectAtCrc(JNIEnv *e Transform tr; tr.setPosition_p(sourceObject->getPosition_p()); ServerObject *newObject = ServerWorld::createNewObject(sourceCrc, tr, cell, false); - if (newObject == NULL) + if (newObject == nullptr) { fprintf(stderr, "WARNING: Could not create object from crc %d\n", sourceCrc); JavaLibrary::printJavaStack(); @@ -911,7 +911,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectAtCrc(JNIEnv *e * @param source the template id or the object id to create the object with * @param location where to put the object * - * @return the new object, or null on error + * @return the new object, or nullptr on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectSimulator(JNIEnv *env, jobject self, jstring source, jobject location) { @@ -963,7 +963,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectSimulator(JNIEn Transform tr; tr.setPosition_p(newPos); ServerObject *newObject = ServerWorld::createNewObject(sourceCrc, tr, cell, false); - if (newObject != NULL) + if (newObject != nullptr) { // add on the player object CreatureObject * creature = dynamic_cast(newObject); @@ -1007,7 +1007,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectSimulator(JNIEn */ jboolean JNICALL ScriptMethodsObjectCreateNamespace::destroyObjectSimulator(JNIEnv *env, jobject self, jlong target) { - CreatureObject *playerObject = NULL; + CreatureObject *playerObject = nullptr; // get the object if (!JavaLibrary::getObject(target, playerObject)) { @@ -1046,7 +1046,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::destroyObject(JNIEnv *env, if (targetId == NetworkId::cms_invalid) return JNI_FALSE; - ServerObject* object = NULL; + ServerObject* object = nullptr; bool retval = JavaLibrary::getObject(target, object); if (!retval || !object) // || object->isPersisted()) will be done in permanently destroy @@ -1060,7 +1060,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::destroyObject(JNIEnv *env, { // check if the object is in a FactoryObject crate Object * container = ContainerInterface::getContainedByObject(*object); - if (container != NULL && dynamic_cast(container) != NULL) + if (container != nullptr && dynamic_cast(container) != nullptr) { // destroy an object in the factory; if it is the last object, // the factory will destroy itself @@ -1093,7 +1093,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::destroyObjectHyperspace(JNI if (targetId == NetworkId::cms_invalid) return JNI_FALSE; - ServerObject * object = NULL; + ServerObject * object = nullptr; bool retval = JavaLibrary::getObject(target, object); if(retval && object) { @@ -1120,7 +1120,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::persistObject(JNIEnv *env, UNREF(self); NOT_NULL(env); - ServerObject* object = NULL; + ServerObject* object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; if (object->persist()) { @@ -1144,7 +1144,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::isObjectPersisted(JNIEnv *e UNREF(self); NOT_NULL(env); - ServerObject* object = NULL; + ServerObject* object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -1320,7 +1320,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createNewObjectTransformCrcInt * @param name the name of the theater * @param locationType how to create the theater * - * @return the id of the master theater object, or null on error (bad datatable name or position) + * @return the id of the master theater object, or nullptr on error (bad datatable name or position) */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createTheaterDatatableOnly(JNIEnv *env, jobject self, jstring datatable, jlong caller, jstring name, jint locationType) { @@ -1347,7 +1347,7 @@ int i; // read the object data from the datatable DataTable * dt = DataTableManager::getTable(datatableName, true); - if (dt == NULL) + if (dt == nullptr) { WARNING(true, ("JavaLibrary::createTheaterDatatable could not open " "datatable %s", datatableName.c_str())); @@ -1429,7 +1429,7 @@ int i; * @param name the name of the theater * @param locationType how to create the theater * - * @return the id of the master theater object, or null on error (bad datatable name or position) + * @return the id of the master theater object, or nullptr on error (bad datatable name or position) */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createTheaterDatatable(JNIEnv *env, jobject self, jstring datatable, jobject basePosition, jstring script, jlong caller, jstring name, jint locationType) { @@ -1466,7 +1466,7 @@ int i; // read the object data from the datatable DataTable * dt = DataTableManager::getTable(datatableName, true); - if (dt == NULL) + if (dt == nullptr) { WARNING(true, ("JavaLibrary::createTheaterDatatable could not open " "datatable %s", datatableName.c_str())); @@ -1567,7 +1567,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::createRemoteTheaterDatatabl // read the object data from the datatable DataTable * dt = DataTableManager::getTable(datatableName, true); - if (dt == NULL) + if (dt == nullptr) { WARNING(true, ("JavaLibrary::createRemoteTheaterDatatable could not open " "datatable %s", datatableName.c_str())); @@ -1613,7 +1613,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::createRemoteTheaterDatatabl params.addParam(locationType, "locationType"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() == NULL) + if (dictionary.get() == nullptr) { WARNING(true, ("JavaLibrary::createRemoteTheaterDatatable could not " "create dictionary for theater datatable %s", datatableName.c_str())); @@ -1624,7 +1624,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::createRemoteTheaterDatatabl Transform tr; tr.setPosition_p(location); ServerObject * spawner = ServerWorld::createNewObject("object/tangible/spawning/remote_theater_spawner.iff", tr, 0, false); - if (spawner == NULL) + if (spawner == nullptr) { WARNING(true, ("JavaLibrary::createRemoteTheaterDatatable unable to " "create remote theater spawner for datatable %s", datatableName.c_str())); @@ -1704,7 +1704,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::createRemoteTheaterDatatabl // read the object data from the datatable DataTable * dt = DataTableManager::getTable(datatableName, true); - if (dt == NULL) + if (dt == nullptr) { WARNING(true, ("JavaLibrary::createRemoteTheaterDatatable could not open " "datatable %s", datatableName.c_str())); @@ -1734,7 +1734,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::createRemoteTheaterDatatabl params.addParam(locationType, "locationType"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() == NULL) + if (dictionary.get() == nullptr) { WARNING(true, ("JavaLibrary::createRemoteTheaterDatatable could not " "create dictionary for theater datatable %s", datatableName.c_str())); @@ -1747,7 +1747,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::createRemoteTheaterDatatabl Transform tr; tr.setPosition_p(theaterCenter); ServerObject * spawner = ServerWorld::createNewObject("object/tangible/spawning/remote_theater_spawner.iff", tr, 0, false); - if (spawner == NULL) + if (spawner == nullptr) { WARNING(true, ("JavaLibrary::createRemoteTheaterDatatable unable to " "create remote theater spawner for datatable %s", datatableName.c_str())); @@ -1778,7 +1778,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::createRemoteTheaterDatatabl * theater objects have been created * @param caller who's creating the theater * - * @return the id of the master theater object, or null on error + * @return the id of the master theater object, or nullptr on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createTheaterCrc(JNIEnv *env, jobject self, jintArray crcs, jobjectArray positions, jobject basePosition, jstring script, jlong caller) { @@ -1843,7 +1843,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createTheaterCrc(JNIEnv *env, * theater objects have been created * @param caller who's creating the theater * - * @return the id of the master theater object, or null on error + * @return the id of the master theater object, or nullptr on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createTheaterString(JNIEnv *env, jobject self, jobjectArray templates, jobjectArray positions, jobject basePosition, jstring script, jlong caller) { @@ -1922,13 +1922,13 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::assignTheaterToPlayer(JNIEn JavaStringParam jdatatable(datatable); - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(playerId, playerCreature)) return JNI_FALSE; PlayerObject * const player = PlayerCreatureController::getPlayerObject( playerCreature); - if (player == NULL) + if (player == nullptr) return JNI_FALSE; if (player->hasTheater()) @@ -1962,7 +1962,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::assignTheaterToPlayer(JNIEn // read the object data from the datatable DataTable * dt = DataTableManager::getTable(datatableName, true); - if (dt == NULL) + if (dt == nullptr) { WARNING(true, ("JavaLibrary::assignTheaterToPlayer could not open " "datatable %s", datatableName.c_str())); @@ -2026,13 +2026,13 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::assignTheaterToPlayerLocati JavaStringParam jdatatable(datatable); JavaStringParam jscript(script); - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(playerId, playerCreature)) return JNI_FALSE; PlayerObject * const player = PlayerCreatureController::getPlayerObject( playerCreature); - if (player == NULL) + if (player == nullptr) return JNI_FALSE; std::string datatableName; @@ -2094,13 +2094,13 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::unassignTheaterFromPlayer(J if (playerId == 0) return JNI_FALSE; - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(playerId, playerCreature)) return JNI_FALSE; PlayerObject * const player = PlayerCreatureController::getPlayerObject( playerCreature); - if (player == NULL) + if (player == nullptr) return JNI_FALSE; player->clearTheater(); @@ -2123,13 +2123,13 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::hasTheaterAssigned(JNIEnv * if (playerId == 0) return JNI_FALSE; - const CreatureObject * playerCreature = NULL; + const CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(playerId, playerCreature)) return JNI_FALSE; const PlayerObject * player = PlayerCreatureController::getPlayerObject( playerCreature); - if (player == NULL) + if (player == nullptr) return JNI_FALSE; return player->hasTheater(); @@ -2142,7 +2142,7 @@ jboolean JNICALL ScriptMethodsObjectCreateNamespace::hasTheaterAssigned(JNIEnv * * * @param theater the theater id * - * @return the theater's name, or null if it doesn't have one + * @return the theater's name, or nullptr if it doesn't have one */ jstring JNICALL ScriptMethodsObjectCreateNamespace::getTheaterName(JNIEnv *env, jobject self, jlong theater) { @@ -2167,7 +2167,7 @@ jstring JNICALL ScriptMethodsObjectCreateNamespace::getTheaterName(JNIEnv *env, * * @param name the theater name to look for * - * @return the theater's id, or null if the theater doesn't exist + * @return the theater's id, or nullptr if the theater doesn't exist */ jlong JNICALL ScriptMethodsObjectCreateNamespace::findTheater(JNIEnv *env, jobject self, jstring name) { @@ -2196,7 +2196,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::findTheater(JNIEnv *env, jobje * @param draftSchematic the draft schematic template to create the manufacturing schematic from * @param container the container to put the manufacturing schematic in * - * @return the id of the manufacturing schematic, or null on error + * @return the id of the manufacturing schematic, or nullptr on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createSchematicString(JNIEnv *env, jobject self, jstring draftSchematic, jlong container) { @@ -2222,25 +2222,25 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createSchematicString(JNIEnv * * @param draftSchematicCrc the draft schematic template crc value to create the manufacturing schematic from * @param container the container to put the manufacturing schematic in * - * @return the id of the manufacturing schematic, or null on error + * @return the id of the manufacturing schematic, or nullptr on error */ jlong JNICALL ScriptMethodsObjectCreateNamespace::createSchematicCrc(JNIEnv *env, jobject self, jint draftSchematicCrc, jlong container) { if (draftSchematicCrc == 0 || container == 0) return 0; - ServerObject * containerObject = NULL; + ServerObject * containerObject = nullptr; if (!JavaLibrary::getObject(container, containerObject)) return 0; const DraftSchematicObject * const draftSchematic = DraftSchematicObject::getSchematic( draftSchematicCrc); - if (draftSchematic == NULL) + if (draftSchematic == nullptr) return 0; ManufactureSchematicObject * manfSchematic = ServerWorld::createNewManufacturingSchematic( *draftSchematic, *containerObject, false); - if (manfSchematic == NULL) + if (manfSchematic == nullptr) return 0; return (manfSchematic->getNetworkId()).getValue(); @@ -2260,7 +2260,7 @@ jlong JNICALL ScriptMethodsObjectCreateNamespace::createSchematicCrc(JNIEnv *env jboolean JNICALL ScriptMethodsObjectCreateNamespace::updateNetworkTriggerVolume(JNIEnv *env, jobject self, jlong target, jfloat radius) { - ServerObject * object = NULL; + ServerObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsObjectInfo.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsObjectInfo.cpp index c50ab576..b285e0be 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsObjectInfo.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsObjectInfo.cpp @@ -561,15 +561,15 @@ void ScriptMethodsObjectInfoNamespace::getGoodItemsFromContainer(const Container { const ServerObject * owner = safe_cast( ContainerInterface::getFirstParentInWorld(container.getOwner())); - const ServerObject * ownerInventory = NULL; - const ServerObject * ownerDatapad = NULL; - const ServerObject * ownerAppearanceInventory = NULL; - const ServerObject * ownerHangar = NULL; + const ServerObject * ownerInventory = nullptr; + const ServerObject * ownerDatapad = nullptr; + const ServerObject * ownerAppearanceInventory = nullptr; + const ServerObject * ownerHangar = nullptr; - if (owner != NULL) + if (owner != nullptr) { const CreatureObject * creature = owner->asCreatureObject(); - if (creature != NULL) + if (creature != nullptr) { ownerInventory = creature->getInventory(); ownerDatapad = creature->getDatapad(); @@ -583,7 +583,7 @@ void ScriptMethodsObjectInfoNamespace::getGoodItemsFromContainer(const Container const CachedNetworkId & itemId = *i; const ServerObject * item = safe_cast( itemId.getObject()); - if (item != NULL && item->asTangibleObject() != NULL && + if (item != nullptr && item->asTangibleObject() != nullptr && item->asTangibleObject()->isVisible()) { // @@ -591,14 +591,14 @@ void ScriptMethodsObjectInfoNamespace::getGoodItemsFromContainer(const Container // // no player inventory - if (ownerInventory != NULL && ownerInventory->getNetworkId() == + if (ownerInventory != nullptr && ownerInventory->getNetworkId() == item->getNetworkId()) { continue; } // no player datapad - if (ownerDatapad != NULL && ownerDatapad->getNetworkId() == + if (ownerDatapad != nullptr && ownerDatapad->getNetworkId() == item->getNetworkId()) { continue; @@ -613,14 +613,14 @@ void ScriptMethodsObjectInfoNamespace::getGoodItemsFromContainer(const Container continue; // no creatures (pets/droids) - if (item->asCreatureObject() != NULL) + if (item->asCreatureObject() != nullptr) continue; // no hair const ServerObjectTemplate * itemTemplate = safe_cast< const ServerObjectTemplate *>(item->getObjectTemplate()); NOT_NULL(itemTemplate); - if (strstr(itemTemplate->getName(), "tangible/hair") != NULL) + if (strstr(itemTemplate->getName(), "tangible/hair") != nullptr) continue; // no Trandoshan feet @@ -631,7 +631,7 @@ void ScriptMethodsObjectInfoNamespace::getGoodItemsFromContainer(const Container // see if the item is a container and go through its contents const Container * itemContainer = ContainerInterface::getContainer(*item); - if (itemContainer != NULL) + if (itemContainer != nullptr) getGoodItemsFromContainer(*itemContainer, goodItems); } } @@ -644,7 +644,7 @@ void ScriptMethodsObjectInfoNamespace::getGoodItemsFromContainer(const Container * @param self class calling this function * @param jtemplateCrcs the template crcs * - * @return the names, or null on error + * @return the names, or nullptr on error */ jobjectArray ScriptMethodsObjectInfoNamespace::getNamesFromCrcs(JNIEnv *env, const std::vector & templateCrcs) @@ -661,7 +661,7 @@ jobjectArray ScriptMethodsObjectInfoNamespace::getNamesFromCrcs(JNIEnv *env, // get the server template const ObjectTemplate * ot = ObjectTemplateList::fetch(templateCrcs[i]); - if (ot == NULL) + if (ot == nullptr) { WARNING(true, ("JavaLibrary::getNamesFromTemplateCrcs: Could not " "find object template for crc %d", templateCrcs[i])); @@ -670,13 +670,13 @@ jobjectArray ScriptMethodsObjectInfoNamespace::getNamesFromCrcs(JNIEnv *env, // get the shared template const ServerObjectTemplate * serverOt = ot->asServerObjectTemplate(); - if (serverOt != NULL) + if (serverOt != nullptr) { const std::string sharedTemplateName(serverOt->getSharedTemplate()); serverOt->releaseReference(); - serverOt = NULL; + serverOt = nullptr; ot = ObjectTemplateList::fetch(sharedTemplateName); - if (ot == NULL) + if (ot == nullptr) { WARNING(true, ("JavaLibrary::getNamesFromTemplateCrcs: Could not " "find shared object template %s", sharedTemplateName.c_str())); @@ -685,18 +685,18 @@ jobjectArray ScriptMethodsObjectInfoNamespace::getNamesFromCrcs(JNIEnv *env, } const SharedObjectTemplate * sharedOt = ot->asSharedObjectTemplate(); - if (sharedOt == NULL) + if (sharedOt == nullptr) { WARNING(true, ("JavaLibrary::getNamesFromTemplateCrcs: template %s " "is not a shared template", ot->getName())); ot->releaseReference(); continue; } - ot = NULL; + ot = nullptr; const StringId objectName(sharedOt->getObjectName()); sharedOt->releaseReference(); - sharedOt = NULL; + sharedOt = nullptr; LocalRefPtr jobjectName; if (ScriptConversion::convert(objectName, jobjectName)) @@ -734,7 +734,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setNameFromString(JNIEnv *env JavaStringParam localName(name); - ServerObject* object = NULL; + ServerObject* object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -813,7 +813,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::setDescriptionStringId(JNIEnv * e * @param self class calling this function * @param target id of object whose name to get * -* @return the description, or null on error +* @return the description, or nullptr on error */ jobject JNICALL ScriptMethodsObjectInfoNamespace::getDescriptionStringId(JNIEnv * env, jobject self, jlong target) { @@ -837,13 +837,13 @@ jobject JNICALL ScriptMethodsObjectInfoNamespace::getDescriptionStringId(JNIEnv * @param self class calling this function * @param target id of object whose name to get * - * @return the name, or null on error + * @return the name, or nullptr on error */ jstring JNICALL ScriptMethodsObjectInfoNamespace::getName(JNIEnv *env, jobject self, jlong target) { UNREF(self); - ServerObject* object = NULL; + ServerObject* object = nullptr; if (!JavaLibrary::getObject(target, object)) return 0; @@ -859,7 +859,7 @@ jstring JNICALL ScriptMethodsObjectInfoNamespace::getName(JNIEnv *env, jobject s * @param self class calling this function * @param player id of the player to get * - * @return the name, or null on error + * @return the name, or nullptr on error */ jstring JNICALL ScriptMethodsObjectInfoNamespace::getPlayerName(JNIEnv *env, jobject self, jlong target) { @@ -894,13 +894,13 @@ jstring JNICALL ScriptMethodsObjectInfoNamespace::getPlayerFullName(JNIEnv *env, * @param self class calling this function * @param target id of object whose name to get * - * @return the name, or null on error + * @return the name, or nullptr on error */ jstring JNICALL ScriptMethodsObjectInfoNamespace::getAssignedName(JNIEnv *env, jobject self, jlong target) { UNREF(self); - ServerObject* object = NULL; + ServerObject* object = nullptr; if (!JavaLibrary::getObject(target, object)) return 0; @@ -915,7 +915,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::setCreatureName(JNIEnv * /*env*/, NetworkId const networkId(creature); CreatureObject * const creatureObject = CreatureObject::getCreatureObject(networkId); - if (creatureObject == NULL) + if (creatureObject == nullptr) { WARNING(true, ("ERROR: ScriptMethodsObjectInfo::setCreatureName() Unable to resolve the object(%s) to a CreatureObject.", networkId.getValueString().c_str())); return; @@ -923,7 +923,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::setCreatureName(JNIEnv * /*env*/, AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(creatureObject->getController()); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { WARNING(true, ("ERROR: ScriptMethodsObjectInfo::setCreatureName() Unable to resolve the object's(%s) controller to an AiCreatureController.", creatureObject->getDebugInformation().c_str())); return; @@ -941,14 +941,14 @@ jstring JNICALL ScriptMethodsObjectInfoNamespace::getCreatureName(JNIEnv * /*env NetworkId const networkId(creature); CreatureObject * const creatureObject = CreatureObject::getCreatureObject(networkId); - if (creatureObject == NULL) + if (creatureObject == nullptr) { return 0; } AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(creatureObject->getController()); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { return 0; } @@ -972,13 +972,13 @@ jstring JNICALL ScriptMethodsObjectInfoNamespace::getCreatureName(JNIEnv * /*env * @param self class calling this function * @param target id of object whose name to get * - * @return the name, or null on error + * @return the name, or nullptr on error */ jobject JNICALL ScriptMethodsObjectInfoNamespace::getNameStringId(JNIEnv *env, jobject self, jlong target) { UNREF(self); - ServerObject* object = NULL; + ServerObject* object = nullptr; if (!JavaLibrary::getObject(target, object)) return 0; @@ -997,7 +997,7 @@ jobject JNICALL ScriptMethodsObjectInfoNamespace::getNameStringId(JNIEnv *env, j * @param self class calling this function * @param jtemplateName the template name * - * @return the name, or null if the template doesn't exist + * @return the name, or nullptr if the template doesn't exist */ jobject JNICALL ScriptMethodsObjectInfoNamespace::getNameFromTemplate(JNIEnv *env, jobject self, jstring jtemplateName) @@ -1020,41 +1020,41 @@ jobject JNICALL ScriptMethodsObjectInfoNamespace::getNameFromTemplate(JNIEnv *en * @param self class calling this function * @param templateCrc the template crc * - * @return the name, or null if the template doesn't exist + * @return the name, or nullptr if the template doesn't exist */ jobject JNICALL ScriptMethodsObjectInfoNamespace::getNameFromTemplateCrc(JNIEnv *env, jobject self, jint templateCrc) { const ObjectTemplate * ot = ObjectTemplateList::fetch(templateCrc); - if (ot == NULL) + if (ot == nullptr) return 0; // the name is stored in the shared template, so if this is a server template, // get the shared one from it - const SharedObjectTemplate * sharedOt = NULL; + const SharedObjectTemplate * sharedOt = nullptr; const ServerObjectTemplate * serverOt = dynamic_cast( ot); - if (serverOt != NULL) + if (serverOt != nullptr) { const std::string sharedTemplateName(serverOt->getSharedTemplate()); serverOt->releaseReference(); - serverOt = NULL; + serverOt = nullptr; ot = ObjectTemplateList::fetch(sharedTemplateName); - if (ot == NULL) + if (ot == nullptr) return 0; } sharedOt = dynamic_cast(ot); - if (sharedOt == NULL) + if (sharedOt == nullptr) { ot->releaseReference(); return 0; } - ot = NULL; + ot = nullptr; const StringId objectName(sharedOt->getObjectName()); sharedOt->releaseReference(); - sharedOt = NULL; + sharedOt = nullptr; LocalRefPtr jobjectName; if (!ScriptConversion::convert(objectName, jobjectName)) @@ -1069,7 +1069,7 @@ jobject JNICALL ScriptMethodsObjectInfoNamespace::getNameFromTemplateCrc(JNIEnv * @param self class calling this function * @param jtemplateNames the template names * - * @return the names, or null on error + * @return the names, or nullptr on error */ jobjectArray JNICALL ScriptMethodsObjectInfoNamespace::getNamesFromTemplates(JNIEnv *env, jobject self, jobjectArray jtemplateNames) @@ -1102,7 +1102,7 @@ jobjectArray JNICALL ScriptMethodsObjectInfoNamespace::getNamesFromTemplates(JNI * @param self class calling this function * @param jtemplateCrcs the template crcs * - * @return the names, or null on error + * @return the names, or nullptr on error */ jobjectArray JNICALL ScriptMethodsObjectInfoNamespace::getNamesFromTemplateCrcs(JNIEnv *env, jobject self, jintArray jtemplateCrcs) @@ -1140,7 +1140,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::internalIsAuthoritative(JNIEn { UNREF(self); - const ServerObject * object = NULL; + const ServerObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -1173,7 +1173,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::hasProxyOrAuthObject(JNIEnv * UNREF(self); - const ServerObject * object = NULL; + const ServerObject * object = nullptr; // if I'm not authoritative, then I must have an authoritative object on another game server // if I'm authoritative, then see if I'm proxied on any other game server @@ -1447,12 +1447,12 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isAwayFromKeyBoard(JNIEnv *en { UNREF(self); - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature)) return JNI_FALSE; PlayerObject * const playerObj = PlayerCreatureController::getPlayerObject(playerCreature); - if (playerObj != NULL && playerObj->isAwayFromKeyBoard()) + if (playerObj != nullptr && playerObj->isAwayFromKeyBoard()) { return JNI_TRUE; } @@ -1473,7 +1473,7 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getObjType(JNIEnv *env, jobject s { UNREF(self); - const Object *object = NULL; + const Object *object = nullptr; if (!JavaLibrary::getObject(target, object)) return -1; @@ -1487,13 +1487,13 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getObjType(JNIEnv *env, jobject s * @param self class calling this function * @param target object we want to check * - * @return the template type, or null on error + * @return the template type, or nullptr on error */ jstring JNICALL ScriptMethodsObjectInfoNamespace::getTemplateId(JNIEnv *env, jobject self, jlong target) { UNREF(self); - const Object *object = NULL; + const Object *object = nullptr; if (!JavaLibrary::getObject(target, object)) return 0; @@ -1507,12 +1507,12 @@ jstring JNICALL ScriptMethodsObjectInfoNamespace::getTemplateId(JNIEnv *env, job * @param self class calling this function * @param target object we want to check * - * @return the template type, or null on error + * @return the template type, or nullptr on error */ jstring JNICALL ScriptMethodsObjectInfoNamespace::getSharedObjectTemplateName(JNIEnv * /*env*/, jobject /*self*/, jlong target) { - Object const * object = NULL; + Object const * object = nullptr; if (!JavaLibrary::getObject(target, object)) return 0; @@ -2039,7 +2039,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isDisabled(JNIEnv *env, jobje return JNI_FALSE; // make sure the object isn't a creature or is a vehicle - if (object->asCreatureObject () != NULL && + if (object->asCreatureObject () != nullptr && !GameObjectTypes::isTypeOf (object->getGameObjectType (), SharedObjectTemplate::GOT_vehicle)) return JNI_FALSE; @@ -2093,7 +2093,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isCrafted(JNIEnv *env, jobjec return JNI_FALSE; // make sure the object isn't a creature - if (dynamic_cast(object) != NULL) + if (dynamic_cast(object) != nullptr) return JNI_FALSE; if (object->isCrafted()) @@ -2110,7 +2110,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isCrafted(JNIEnv *env, jobjec * @param self class calling this function * @param target object we want to know about * - * @return the crafter id, or null on error or if the item was not crafted + * @return the crafter id, or nullptr on error or if the item was not crafted */ jlong JNICALL ScriptMethodsObjectInfoNamespace::getCrafter(JNIEnv *env, jobject self, jlong target) { @@ -2168,7 +2168,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setCrafter(JNIEnv *env, jobje */ jfloat JNICALL ScriptMethodsObjectInfoNamespace::getScale(JNIEnv *env, jobject self, jlong target) { - const CreatureObject * creature = NULL; + const CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return -1.0f; @@ -2190,7 +2190,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setScale(JNIEnv *env, jobject if (scale <= 0) return JNI_FALSE; - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -2375,11 +2375,11 @@ jfloat JNICALL ScriptMethodsObjectInfoNamespace::getLocationDistance(JNIEnv *env // translate local coordinates to world coordinates Object * cell1 = NetworkIdManager::getObjectById(targetCell1); - if (cell1 == NULL) + if (cell1 == nullptr) return -1; const Vector & worldLoc1 = cell1->rotateTranslate_o2w(targetLoc1); Object * cell2 = NetworkIdManager::getObjectById(targetCell2); - if (cell2 == NULL) + if (cell2 == nullptr) return -1; const Vector & worldLoc2 = cell2->rotateTranslate_o2w(targetLoc2); @@ -2433,13 +2433,13 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isLocationInConicalFrustum(JN // translate local coordinates to world coordinates if they are in cells Object * testCell = NetworkIdManager::getObjectById(testCellId); - Vector testWorldLoc = (testCell != NULL) ? testCell->rotateTranslate_o2w(testLoc) : testLoc; + Vector testWorldLoc = (testCell != nullptr) ? testCell->rotateTranslate_o2w(testLoc) : testLoc; Object * startCell = NetworkIdManager::getObjectById(startCellId); - Vector startWorldLoc = (startCell != NULL) ? startCell->rotateTranslate_o2w(startLoc) : startLoc; + Vector startWorldLoc = (startCell != nullptr) ? startCell->rotateTranslate_o2w(startLoc) : startLoc; Object * endCell = NetworkIdManager::getObjectById(endCellId); - Vector endWorldLoc = (endCell != NULL) ? endCell->rotateTranslate_o2w(endLoc) : endLoc; + Vector endWorldLoc = (endCell != nullptr) ? endCell->rotateTranslate_o2w(endLoc) : endLoc; if(use2d) { @@ -2504,13 +2504,13 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isLocationInCone(JNIEnv *env, // translate local coordinates to world coordinates if they are in cells Object * testCell = NetworkIdManager::getObjectById(testCellId); - Vector const& testWorldLoc = (testCell != NULL) ? testCell->rotateTranslate_o2w(testLoc) : testLoc; + Vector const& testWorldLoc = (testCell != nullptr) ? testCell->rotateTranslate_o2w(testLoc) : testLoc; Object * startCell = NetworkIdManager::getObjectById(startCellId); - Vector const & startWorldLoc = (startCell != NULL) ? startCell->rotateTranslate_o2w(startLoc) : startLoc; + Vector const & startWorldLoc = (startCell != nullptr) ? startCell->rotateTranslate_o2w(startLoc) : startLoc; Object * endCell = NetworkIdManager::getObjectById(endCellId); - Vector const & endWorldLoc = (endCell != NULL) ? endCell->rotateTranslate_o2w(endLoc) : endLoc; + Vector const & endWorldLoc = (endCell != nullptr) ? endCell->rotateTranslate_o2w(endLoc) : endLoc; Vector testPointConeSpace = testWorldLoc - startWorldLoc; if(use2d) @@ -2606,7 +2606,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isInWorldCell(JNIEnv *env, jo UNREF(self); NOT_NULL(env); - ServerObject* object = NULL; + ServerObject* object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -2704,7 +2704,7 @@ namespace //-- validate arguments if (!customizationVariable || !context) { - DEBUG_FATAL(true, ("programmer error: callback made with NULL arguments.\n")); + DEBUG_FATAL(true, ("programmer error: callback made with nullptr arguments.\n")); return; } @@ -2736,7 +2736,7 @@ namespace * Java custom_var. * * @return the Java-accessible custom_var instance, the script-side counterpart to - * the given C++-side CustomizationVariable. Will return NULL if + * the given C++-side CustomizationVariable. Will return nullptr if * a Java exception or other error occurs. */ LocalRefPtr ScriptMethodsObjectInfoNamespace::createCustomVar(const jlong &objId, const std::string &variablePathName, CustomizationVariable &variable) @@ -2779,7 +2779,7 @@ LocalRefPtr ScriptMethodsObjectInfoNamespace::createCustomVar(const jlong &objId * Java custom_var. * * @return the Java-accessible ranged_int_custom_var instance, the script-side counterpart to - * the given C++-side CustomizationVariable. Will return NULL if + * the given C++-side CustomizationVariable. Will return nullptr if * a Java exception or other error occurs. */ LocalRefPtr ScriptMethodsObjectInfoNamespace::createRangedIntCustomVar(const jlong &objId, const std::string &variablePathName, RangedIntCustomizationVariable &rangedIntVariable) @@ -2818,7 +2818,7 @@ LocalRefPtr ScriptMethodsObjectInfoNamespace::createRangedIntCustomVar(const jlo * Java custom_var. * * @return the Java-accessible palcolor_custom_var instance, the script-side counterpart to - * the given C++-side CustomizationVariable. Will return NULL if + * the given C++-side CustomizationVariable. Will return nullptr if * a Java exception or other error occurs. */ LocalRefPtr ScriptMethodsObjectInfoNamespace::createPalcolorCustomVar(const jlong &objId, const std::string &variablePathName, PaletteColorCustomizationVariable &variable) @@ -2854,10 +2854,10 @@ LocalRefPtr ScriptMethodsObjectInfoNamespace::createColor(int r, int g, int b, i * Fetch the CustomizationData instance associated with the Object * specified by the given obj_id. * - * This function may return NULL if the specified object doesn't have + * This function may return nullptr if the specified object doesn't have * customization data or if some other error occurs. * - * The caller must call CustomizationData::release() on the non-NULL return + * The caller must call CustomizationData::release() on the non-nullptr return * value when the reference no longer is needed. Failure to do so will cause * a memory leak. * @@ -2865,21 +2865,21 @@ LocalRefPtr ScriptMethodsObjectInfoNamespace::createColor(int r, int g, int b, i * CustomizationData instance should be retrieved. * * @return the CustomizationData instance associated with the specified - * Object. May return NULL if the Object doesn't have customization + * Object. May return nullptr if the Object doesn't have customization * data or if an error occurs. */ CustomizationData *ScriptMethodsObjectInfoNamespace::fetchCustomizationDataFromObjId(jlong objId) { PROFILER_AUTO_BLOCK_DEFINE("JNI::fetchCustomizationDataFromObjId"); if (!objId) - return NULL; + return nullptr; //-- Get the target TangibleObject. TangibleObject *object = 0; if (!JavaLibrary::getObject(objId, object)) { // this Object doesn't exist or isn't derived from TangibleObject - return NULL; + return nullptr; } //-- Fetch the CustomizationData. @@ -2887,15 +2887,15 @@ CustomizationData *ScriptMethodsObjectInfoNamespace::fetchCustomizationDataFromO if (!cdProperty) { // this Object doesn't expose any customization data - return NULL; + return nullptr; } CustomizationData *const customizationData = cdProperty->fetchCustomizationData(); if (!customizationData) { // this shouldn't happen - DEBUG_WARNING(true, ("CustomizationDataProperty returned NULL CustomizationData on fetch().\n")); - return NULL; + DEBUG_WARNING(true, ("CustomizationDataProperty returned nullptr CustomizationData on fetch().\n")); + return nullptr; } //-- return the CustomizationData instance. @@ -2910,7 +2910,7 @@ jobjectArray JNICALL ScriptMethodsObjectInfoNamespace::getAllCustomVars(JNIEnv * //-- get the CustomizationData instance for the target object. CustomizationData *const customizationData = fetchCustomizationDataFromObjId(target); if (!customizationData) - return NULL; + return nullptr; //-- collect all local CustomizationVariable instances. // NOTE: if we allow multithreaded access to this code from script, we cannot use this static @@ -2961,7 +2961,7 @@ jobjectArray JNICALL ScriptMethodsObjectInfoNamespace::getAllCustomVars(JNIEnv * customizationData->release(); //-- return result - if (customVarArray.get() != NULL) + if (customVarArray.get() != nullptr) return customVarArray->getReturnValue(); return 0; } @@ -2975,7 +2975,7 @@ jobject JNICALL ScriptMethodsObjectInfoNamespace::getCustomVarByName(JNIEnv * /* //-- get the CustomizationData instance for the target object. CustomizationData *const customizationData = fetchCustomizationDataFromObjId(target); if (!customizationData) - return NULL; + return nullptr; //-- get the CustomizationVariable for the specified variable name std::string nativeVarPathName; @@ -2983,7 +2983,7 @@ jobject JNICALL ScriptMethodsObjectInfoNamespace::getCustomVarByName(JNIEnv * /* CustomizationVariable *const variable = customizationData->findVariable(nativeVarPathName); if (!variable) - return NULL; + return nullptr; //-- create a Java custom_var based on this CustomizationVariable LocalRefPtr newCustomVar = createCustomVar(target, nativeVarPathName, *variable); @@ -3089,7 +3089,7 @@ jobject JNICALL ScriptMethodsObjectInfoNamespace::getPalcolorCustomVarSelectedCo customizationData->release(); if (error) - return NULL; + return nullptr; //-- return value return createColor(color.getR(), color.getG(), color.getB(), color.getA())->getReturnValue(); @@ -3196,7 +3196,7 @@ jobjectArray JNICALL ScriptMethodsObjectInfoNamespace::getPalcolorCustomVarColor customizationData->release(); //-- return result - if (colorArray.get() != NULL) + if (colorArray.get() != nullptr) return colorArray->getReturnValue(); return 0; } @@ -3205,7 +3205,7 @@ jobjectArray JNICALL ScriptMethodsObjectInfoNamespace::getPalcolorCustomVarColor jobjectArray JNICALL ScriptMethodsObjectInfoNamespace::getCtsDestinationClusters(JNIEnv * /*env*/, jobject /*self*/) { - static std::set * s_ctsDestinationClusters = NULL; + static std::set * s_ctsDestinationClusters = nullptr; if (!s_ctsDestinationClusters) { s_ctsDestinationClusters = new std::set; @@ -3449,15 +3449,15 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::kill(JNIEnv *env, jobject sel * @param env Java environment * @param self class calling this function * @param player the player - * @param killer who killed the player (may be null) + * @param killer who killed the player (may be nullptr) * - * @return the corpse id of the player, or null on error + * @return the corpse id of the player, or nullptr on error */ jobject JNICALL ScriptMethodsObjectInfoNamespace::killPlayer(JNIEnv *env, jobject self, jobject player, jobject killer) { static const std::string corpseTemplateName("object/tangible/container/corpse/player_corpse.iff"); - CreatureObject * playerObject = NULL; + CreatureObject * playerObject = nullptr; if (!JavaLibrary::getObject(player, playerObject)) return 0; @@ -3474,7 +3474,7 @@ jobject JNICALL ScriptMethodsObjectInfoNamespace::killPlayer(JNIEnv *env, jobjec Transform tr; tr.setPosition_p(playerObject->getPosition_p()); ServerObject * corpse = ServerWorld::createNewObject(corpseTemplateName, tr, cell, true); - if (corpse == NULL) + if (corpse == nullptr) return 0; if (playerObject->makeDead(killerId, corpse->getNetworkId())) @@ -3557,7 +3557,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setInvulnerable(JNIEnv *env, { UNREF(self); - TangibleObject * object = NULL; + TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -3580,7 +3580,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isInvulnerable(JNIEnv *env, j { UNREF(self); - TangibleObject * object = NULL; + TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -3602,7 +3602,7 @@ jfloat JNICALL ScriptMethodsObjectInfoNamespace::getComplexity(JNIEnv *env, jobj { UNREF(self); - const ServerObject * object = NULL; + const ServerObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return -1; @@ -3625,7 +3625,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setComplexity(JNIEnv *env, jo { UNREF(self); - ServerObject * object = NULL; + ServerObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -3639,7 +3639,7 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getGameObjectType(JNIEnv *env, jo { UNREF (self); - ServerObject * object = NULL; + ServerObject * object = nullptr; if (!JavaLibrary::getObject(obj, object)) return JNI_FALSE; @@ -3662,13 +3662,13 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getGameObjectTypeFromTemplate(JNI jint JNICALL ScriptMethodsObjectInfoNamespace::getGameObjectTypeFromTemplateCrc(JNIEnv *env, jobject self, jint templateCrc) { const ObjectTemplate * objectTemplate = ObjectTemplateList::fetch(templateCrc); - if (objectTemplate == NULL) + if (objectTemplate == nullptr) return 0; const std::string & sharedTemplateName = safe_cast(objectTemplate)->getSharedTemplate(); const ObjectTemplate * sharedTemplate = ObjectTemplateList::fetch(sharedTemplateName); objectTemplate->releaseReference(); - if (sharedTemplate == NULL) + if (sharedTemplate == nullptr) return 0; jint got = safe_cast(sharedTemplate)->getGameObjectType(); @@ -3710,11 +3710,11 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isGod(JNIEnv *env, jobject se { UNREF (self); - const ServerObject * object = NULL; + const ServerObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; - if (object->getClient() == NULL) + if (object->getClient() == nullptr) return JNI_FALSE; return object->getClient()->isGod(); @@ -3735,11 +3735,11 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getGodLevel(JNIEnv *env, jobject { UNREF (self); - const ServerObject * object = NULL; + const ServerObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return 0; - if (object->getClient() == NULL) + if (object->getClient() == nullptr) return 0; if (object->getClient()->isGod()) @@ -3763,13 +3763,13 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getCount(JNIEnv *env, jobject sel // both Tangible and Intangible have counters, so we have to test for both // cases - const TangibleObject * tangibleObject = NULL; + const TangibleObject * tangibleObject = nullptr; if (JavaLibrary::getObject(target, tangibleObject)) { return tangibleObject->getCount(); } - const IntangibleObject * intangibleObject = NULL; + const IntangibleObject * intangibleObject = nullptr; if (JavaLibrary::getObject(target, intangibleObject)) { return intangibleObject->getCount(); @@ -3795,14 +3795,14 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setCount(JNIEnv *env, jobject // both Tangible and Intangible have counters, so we have to test for both // cases - TangibleObject * tangibleObject = NULL; + TangibleObject * tangibleObject = nullptr; if (JavaLibrary::getObject(target, tangibleObject)) { tangibleObject->setCount(value); return JNI_TRUE; } - IntangibleObject * intangibleObject = NULL; + IntangibleObject * intangibleObject = nullptr; if (JavaLibrary::getObject(target, intangibleObject)) { intangibleObject->setCount(value); @@ -3829,14 +3829,14 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::incrementCount(JNIEnv *env, j // both Tangible and Intangible have counters, so we have to test for both // cases - TangibleObject * tangibleObject = NULL; + TangibleObject * tangibleObject = nullptr; if (JavaLibrary::getObject(target, tangibleObject)) { tangibleObject->incrementCount(delta); return JNI_TRUE; } - IntangibleObject * intangibleObject = NULL; + IntangibleObject * intangibleObject = nullptr; if (JavaLibrary::getObject(target, intangibleObject)) { intangibleObject->incrementCount(delta); @@ -3859,7 +3859,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::incrementCount(JNIEnv *env, j */ jint JNICALL ScriptMethodsObjectInfoNamespace::getCondition(JNIEnv *env, jobject self, jlong target) { - const TangibleObject * object = NULL; + const TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return 0; @@ -3880,7 +3880,7 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getCondition(JNIEnv *env, jobject */ jboolean JNICALL ScriptMethodsObjectInfoNamespace::hasCondition(JNIEnv *env, jobject self, jlong target, jint condition) { - const TangibleObject * object = NULL; + const TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -3901,7 +3901,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::hasCondition(JNIEnv *env, job */ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setCondition(JNIEnv *env, jobject self, jlong target, jint condition) { - TangibleObject * object = NULL; + TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -3923,7 +3923,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setCondition(JNIEnv *env, job */ jboolean JNICALL ScriptMethodsObjectInfoNamespace::clearCondition(JNIEnv *env, jobject self, jlong target, jint condition) { - TangibleObject * object = NULL; + TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -4748,7 +4748,7 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getGroupLevel(JNIEnv *, jobject, { if (!target) { - DEBUG_WARNING (true, ("JavaLibrary::getGroupLevel null target ")); + DEBUG_WARNING (true, ("JavaLibrary::getGroupLevel nullptr target ")); return 0; } @@ -4864,18 +4864,18 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::getVisibleOnMapAndRadar(JNIEn * @param self class calling this function * @param target the object * - * @return the appearance name, or null on error + * @return the appearance name, or nullptr on error */ jstring JNICALL ScriptMethodsObjectInfoNamespace::getAppearance(JNIEnv * env, jobject self, jlong target) { UNREF(self); - const ServerObject * object = NULL; + const ServerObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return 0; const SharedObjectTemplate * sharedTemplate = object->getSharedTemplate(); - if (sharedTemplate == NULL) + if (sharedTemplate == nullptr) return 0; JavaString appearance(sharedTemplate->getAppearanceFilename()); @@ -4897,7 +4897,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isInsured(JNIEnv * env, jobje { UNREF(self); - const TangibleObject * object = NULL; + const TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -4919,7 +4919,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isAutoInsured(JNIEnv * env, j { UNREF(self); - const TangibleObject * object = NULL; + const TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -4941,7 +4941,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isUninsurable(JNIEnv * env, j { UNREF(self); - const TangibleObject * object = NULL; + const TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -4959,13 +4959,13 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isUninsurable(JNIEnv * env, j * @param self class calling this function * @param player the player to get objects from * - * @return an array of objects, or null on error + * @return an array of objects, or nullptr on error */ jlongArray JNICALL ScriptMethodsObjectInfoNamespace::getInventoryAndEquipment(JNIEnv * env, jobject self, jlong player) { UNREF(self); - const CreatureObject * playerCreature = NULL; + const CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature)) return 0; @@ -4973,11 +4973,11 @@ jlongArray JNICALL ScriptMethodsObjectInfoNamespace::getInventoryAndEquipment(JN // go through the player's inventory const ServerObject * inventoryObject = playerCreature->getInventory(); - if (inventoryObject != NULL) + if (inventoryObject != nullptr) { const VolumeContainer * inventoryContainer = ContainerInterface::getVolumeContainer(*inventoryObject); - if (inventoryContainer != NULL) + if (inventoryContainer != nullptr) { getGoodItemsFromContainer(*inventoryContainer, objectIds); } @@ -4998,7 +4998,7 @@ jlongArray JNICALL ScriptMethodsObjectInfoNamespace::getInventoryAndEquipment(JN // go through the player's equipment SlottedContainer const * const equipmentContainer = ContainerInterface::getSlottedContainer(*playerCreature); - if (equipmentContainer != NULL) + if (equipmentContainer != nullptr) getGoodItemsFromContainer(*equipmentContainer, objectIds); else { @@ -5022,12 +5022,12 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setCheaterLevel(JNIEnv * env, { UNREF(self); - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature)) return JNI_FALSE; PlayerObject * const playerObj = PlayerCreatureController::getPlayerObject(playerCreature); - if (playerObj != NULL && playerObj->isAuthoritative()) + if (playerObj != nullptr && playerObj->isAuthoritative()) { playerObj->setCheaterLevel(static_cast(level)); return JNI_TRUE; @@ -5042,12 +5042,12 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getCheaterLevel(JNIEnv * env, job { UNREF(self); - const CreatureObject * playerCreature = NULL; + const CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature)) return 0; PlayerObject const * const playerObj = PlayerCreatureController::getPlayerObject(playerCreature); - if (playerObj != NULL) + if (playerObj != nullptr) { return static_cast(playerObj->getCheaterLevel()); } @@ -5071,7 +5071,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setHouseId(JNIEnv * env, jobj { UNREF(self); - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature)) return JNI_FALSE; @@ -5090,13 +5090,13 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setHouseId(JNIEnv * env, jobj * @param self class calling this function * @param player the player * - * @return the house id, or null on error + * @return the house id, or nullptr on error */ jlong JNICALL ScriptMethodsObjectInfoNamespace::getHouseId(JNIEnv * env, jobject self, jlong player) { UNREF(self); - const CreatureObject * playerCreature = NULL; + const CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature)) return 0; @@ -5113,16 +5113,16 @@ jlong JNICALL ScriptMethodsObjectInfoNamespace::getHouseId(JNIEnv * env, jobject * @param self class calling this function * @param object the manf schematic or factory id * - * @return the draft schematic name, or null on error + * @return the draft schematic name, or nullptr on error */ jstring JNICALL ScriptMethodsObjectInfoNamespace::getDraftSchematic(JNIEnv * env, jobject self, jlong object) { UNREF(self); - const ManufactureObjectInterface * craftable = NULL; + const ManufactureObjectInterface * craftable = nullptr; - const FactoryObject * factoryObject = NULL; - const ManufactureSchematicObject * manfSchematicObject = NULL; + const FactoryObject * factoryObject = nullptr; + const ManufactureSchematicObject * manfSchematicObject = nullptr; if (JavaLibrary::getObject(object, manfSchematicObject)) { craftable = manfSchematicObject; @@ -5136,7 +5136,7 @@ jstring JNICALL ScriptMethodsObjectInfoNamespace::getDraftSchematic(JNIEnv * env const ConstCharCrcString draftSchematic(ObjectTemplateList::lookUp( craftable->getDraftSchematic())); - if (draftSchematic.getString() == NULL) + if (draftSchematic.getString() == nullptr) return 0; return JavaString(draftSchematic.getString()).getReturnValue(); @@ -5152,16 +5152,16 @@ jstring JNICALL ScriptMethodsObjectInfoNamespace::getDraftSchematic(JNIEnv * env * @param self class calling this function * @param object the manf schematic or factory id * - * @return the draft schematic name crc, or null on error + * @return the draft schematic name crc, or nullptr on error */ jint JNICALL ScriptMethodsObjectInfoNamespace::getDraftSchematicCrc(JNIEnv * env, jobject self, jlong object) { UNREF(self); - const ManufactureObjectInterface * craftable = NULL; + const ManufactureObjectInterface * craftable = nullptr; - const FactoryObject * factoryObject = NULL; - const ManufactureSchematicObject * manfSchematicObject = NULL; + const FactoryObject * factoryObject = nullptr; + const ManufactureSchematicObject * manfSchematicObject = nullptr; if (JavaLibrary::getObject(object, manfSchematicObject)) { craftable = manfSchematicObject; @@ -5175,7 +5175,7 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getDraftSchematicCrc(JNIEnv * env const ConstCharCrcString draftSchematic(ObjectTemplateList::lookUp( craftable->getDraftSchematic())); - if (draftSchematic.getString() == NULL) + if (draftSchematic.getString() == nullptr) return 0; return draftSchematic.getCrc(); @@ -5196,7 +5196,7 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getSourceDraftSchematic(JNIEnv * { UNREF(self); - const TangibleObject * object = NULL; + const TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return 0; @@ -5219,13 +5219,13 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getPlayerBirthDate(JNIEnv * env, { UNREF(self); - const CreatureObject * playerCreature = NULL; + const CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(playerId, playerCreature)) return -1; const PlayerObject * player = PlayerCreatureController::getPlayerObject( playerCreature); - if (player == NULL) + if (player == nullptr) return -1; return player->getBornDate(); @@ -5263,13 +5263,13 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getPlayerPlayedTime(JNIEnv * env, { UNREF(self); - const CreatureObject * playerCreature = NULL; + const CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(playerId, playerCreature)) return -1; const PlayerObject * player = PlayerCreatureController::getPlayerObject( playerCreature); - if (player == NULL) + if (player == nullptr) return -1; return player->getPlayedTime(); @@ -5306,7 +5306,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::setBuildingCityId(JNIEnv *env, jo * @param self class calling this function * @param jschematicName the schematic name * - * @return the object name, or null if the schematic doesn't exist + * @return the object name, or nullptr if the schematic doesn't exist */ jobject JNICALL ScriptMethodsObjectInfoNamespace::getProductNameFromSchematic(JNIEnv *env, jobject self, jstring jschematicName) @@ -5319,30 +5319,30 @@ jobject JNICALL ScriptMethodsObjectInfoNamespace::getProductNameFromSchematic(JN const DraftSchematicObject * schematic = DraftSchematicObject::getSchematic( schematicName); - if (schematic == NULL) + if (schematic == nullptr) return 0; const ServerObjectTemplate * serverOt = schematic->getCraftedObjectTemplate(); - if (serverOt == NULL) + if (serverOt == nullptr) return 0; const std::string sharedTemplateName(serverOt->getSharedTemplate()); const ObjectTemplate * ot = ObjectTemplateList::fetch(sharedTemplateName); - if (ot == NULL) + if (ot == nullptr) return 0; const SharedObjectTemplate * sharedOt = dynamic_cast( ot); - if (sharedOt == NULL) + if (sharedOt == nullptr) { ot->releaseReference(); return 0; } - ot = NULL; + ot = nullptr; const StringId objectName(sharedOt->getObjectName()); sharedOt->releaseReference(); - sharedOt = NULL; + sharedOt = nullptr; LocalRefPtr jobjectName; if (!ScriptConversion::convert(objectName, jobjectName)) @@ -5360,37 +5360,37 @@ jobject JNICALL ScriptMethodsObjectInfoNamespace::getProductNameFromSchematic(JN * @param self class calling this function * @param schematicCrc the schematic name crc * - * @return the object name, or null if the schematic doesn't exist + * @return the object name, or nullptr if the schematic doesn't exist */ jobject JNICALL ScriptMethodsObjectInfoNamespace::getProductNameFromSchematicCrc(JNIEnv *env, jobject self, jint schematicCrc) { const DraftSchematicObject * schematic = DraftSchematicObject::getSchematic( schematicCrc); - if (schematic == NULL) + if (schematic == nullptr) return 0; const ServerObjectTemplate * serverOt = schematic->getCraftedObjectTemplate(); - if (serverOt == NULL) + if (serverOt == nullptr) return 0; const std::string sharedTemplateName(serverOt->getSharedTemplate()); const ObjectTemplate * ot = ObjectTemplateList::fetch(sharedTemplateName); - if (ot == NULL) + if (ot == nullptr) return 0; const SharedObjectTemplate * sharedOt = dynamic_cast( ot); - if (sharedOt == NULL) + if (sharedOt == nullptr) { ot->releaseReference(); return 0; } - ot = NULL; + ot = nullptr; const StringId objectName(sharedOt->getObjectName()); sharedOt->releaseReference(); - sharedOt = NULL; + sharedOt = nullptr; LocalRefPtr jobjectName; if (!ScriptConversion::convert(objectName, jobjectName)) @@ -5407,7 +5407,7 @@ jobject JNICALL ScriptMethodsObjectInfoNamespace::getProductNameFromSchematicCrc * @param self class calling this function * @param draftSchematic the draft schematic's template * - * @return the template for the item the schematic creates, or null on error + * @return the template for the item the schematic creates, or nullptr on error */ jstring JNICALL ScriptMethodsObjectInfoNamespace::getTemplateCreatedFromSchematic(JNIEnv *env, jobject self, jstring draftSchematic) @@ -5433,7 +5433,7 @@ jstring JNICALL ScriptMethodsObjectInfoNamespace::getTemplateCreatedFromSchemati * @param self class calling this function * @param draftSchematicCrc the draft schematic's template crc * - * @return the template for the item the schematic creates, or null on error + * @return the template for the item the schematic creates, or nullptr on error */ jstring JNICALL ScriptMethodsObjectInfoNamespace::getTemplateCreatedFromSchematicCrc(JNIEnv *env, jobject self, jint draftSchematicCrc) @@ -5445,11 +5445,11 @@ jstring JNICALL ScriptMethodsObjectInfoNamespace::getTemplateCreatedFromSchemati const DraftSchematicObject * schematic = DraftSchematicObject::getSchematic( draftSchematicCrc); - if (schematic == NULL) + if (schematic == nullptr) return 0; const ServerObjectTemplate * serverOt = schematic->getCraftedObjectTemplate(); - if (serverOt == NULL) + if (serverOt == nullptr) return 0; JavaString templateName(serverOt->getName()); @@ -5503,11 +5503,11 @@ jint JNICALL ScriptMethodsObjectInfoNamespace::getTemplateCrcCreatedFromSchemati const DraftSchematicObject * schematic = DraftSchematicObject::getSchematic( draftSchematicCrc); - if (schematic == NULL) + if (schematic == nullptr) return 0; const ServerObjectTemplate * serverOt = schematic->getCraftedObjectTemplate(); - if (serverOt == NULL) + if (serverOt == nullptr) return 0; return Crc::calculate(serverOt->getName()); @@ -5717,7 +5717,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::requestPreloadCompleteTrigger(JNI void JNICALL ScriptMethodsObjectInfoNamespace::activateQuest(JNIEnv * env, jobject self, jlong target, jint questId) { - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (JavaLibrary::getObject(target, playerCreature)) { PlayerObject * player = PlayerCreatureController::getPlayerObject(playerCreature); @@ -5733,7 +5733,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::activateQuest(JNIEnv * env, jobje void JNICALL ScriptMethodsObjectInfoNamespace::deactivateQuest(JNIEnv * env, jobject self, jlong target, jint questId) { - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (JavaLibrary::getObject(target, playerCreature)) { PlayerObject * player = PlayerCreatureController::getPlayerObject(playerCreature); @@ -5749,7 +5749,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::deactivateQuest(JNIEnv * env, job void JNICALL ScriptMethodsObjectInfoNamespace::completeQuest(JNIEnv * env, jobject self, jlong target, jint questId) { - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (JavaLibrary::getObject(target, playerCreature)) { PlayerObject * player = PlayerCreatureController::getPlayerObject(playerCreature); @@ -5766,7 +5766,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::completeQuest(JNIEnv * env, jobje jboolean JNICALL ScriptMethodsObjectInfoNamespace::isQuestComplete(JNIEnv * env, jobject self, jlong target, jint questId) { jboolean result = false; - const CreatureObject * playerCreature = NULL; + const CreatureObject * playerCreature = nullptr; if (JavaLibrary::getObject(target, playerCreature)) { const PlayerObject * player = PlayerCreatureController::getPlayerObject(playerCreature); @@ -5783,7 +5783,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isQuestComplete(JNIEnv * env, jboolean JNICALL ScriptMethodsObjectInfoNamespace::isQuestActive(JNIEnv * env, jobject self, jlong target, jint questId) { jboolean result = false; - const CreatureObject * playerCreature = NULL; + const CreatureObject * playerCreature = nullptr; if (JavaLibrary::getObject(target, playerCreature)) { const PlayerObject * player = PlayerCreatureController::getPlayerObject(playerCreature); @@ -5801,7 +5801,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::clearCompletedQuest(JNIEnv * env, { if(questId >= 0) { - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (JavaLibrary::getObject(target, playerCreature)) { PlayerObject * player = PlayerCreatureController::getPlayerObject(playerCreature); @@ -5817,7 +5817,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::clearCompletedQuest(JNIEnv * env, jboolean JNICALL ScriptMethodsObjectInfoNamespace::canTrade(JNIEnv *env, jobject self, jlong target) { - const ServerObject * object = NULL; + const ServerObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -5828,7 +5828,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::canTrade(JNIEnv *env, jobject jboolean JNICALL ScriptMethodsObjectInfoNamespace::isNoTradeShared(JNIEnv *env, jobject self, jlong target) { - const ServerObject * object = NULL; + const ServerObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -5845,16 +5845,16 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isNoTradeShared(JNIEnv *env, * @param self class calling this function * @param player the player to check * - * @return the theater id, or null on error + * @return the theater id, or nullptr on error */ jlong JNICALL ScriptMethodsObjectInfoNamespace::getLastSpawnedTheater(JNIEnv *env, jobject self, jlong player) { - const CreatureObject * creature = NULL; + const CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(player, creature)) return 0; const PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(creature); - if (playerObject == NULL) + if (playerObject == nullptr) return 0; return (playerObject->getTheater()).getValue(); @@ -5930,7 +5930,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::setAutoVariableFromByteStream(JNI */ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setBioLink(JNIEnv *env, jobject self, jlong target, jlong link) { - TangibleObject * object = NULL; + TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -5955,7 +5955,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setBioLink(JNIEnv *env, jobje */ jboolean JNICALL ScriptMethodsObjectInfoNamespace::clearBioLink(JNIEnv *env, jobject self, jlong target) { - TangibleObject * object = NULL; + TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -5972,11 +5972,11 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::clearBioLink(JNIEnv *env, job * @param self class calling this function * @param target the item to get the link from * - * @return the bio-link id, null if the item isn't linked + * @return the bio-link id, nullptr if the item isn't linked */ jlong JNICALL ScriptMethodsObjectInfoNamespace::getBioLink(JNIEnv *env, jobject self, jlong target) { - const TangibleObject * object = NULL; + const TangibleObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return 0; @@ -5990,7 +5990,7 @@ jlong JNICALL ScriptMethodsObjectInfoNamespace::getBioLink(JNIEnv *env, jobject float JNICALL ScriptMethodsObjectInfoNamespace::getObjectCollisionRadius(JNIEnv * env, jobject self, jlong jobject_obj) { - const Object * object = NULL; + const Object * object = nullptr; if (!JavaLibrary::getObject(jobject_obj, object)) return 0.0f; @@ -6008,11 +6008,11 @@ float JNICALL ScriptMethodsObjectInfoNamespace::getObjectCollisionRadius(JNIEnv * @param self class calling this function * @param target id of the object * - * @return the name, or null on error + * @return the name, or nullptr on error */ jstring JNICALL ScriptMethodsObjectInfoNamespace::getStaticItemName(JNIEnv * /*env*/, jobject /*self*/, jlong target) { - const ServerObject * o = NULL; + const ServerObject * o = nullptr; if (!JavaLibrary::getObject(target, o)) return 0; @@ -6026,7 +6026,7 @@ jstring JNICALL ScriptMethodsObjectInfoNamespace::getStaticItemName(JNIEnv * /*e jint JNICALL ScriptMethodsObjectInfoNamespace::getStaticItemVersion(JNIEnv *env, jobject /*self*/, jlong target) { - const ServerObject * o = NULL; + const ServerObject * o = nullptr; if (!JavaLibrary::getObject(target, o)) return 0; @@ -6040,7 +6040,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::setStaticItemName(JNIEnv * /*env* NetworkId const networkId(target); ServerObject * const o = ServerObject::getServerObject(networkId); - if (o == NULL) + if (o == nullptr) { WARNING(true, ("ERROR: ScriptMethodsObjectInfo::setStaticItemName() Unable to resolve the object(%s).", networkId.getValueString().c_str())); return; @@ -6058,7 +6058,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::setStaticItemVersion(JNIEnv * /*e NetworkId const networkId(target); ServerObject * const o = ServerObject::getServerObject(networkId); - if (o == NULL) + if (o == nullptr) { WARNING(true, ("ERROR: ScriptMethodsObjectInfo::setStaticItemVersion() Unable to resolve the object(%s).", networkId.getValueString().c_str())); return; @@ -6071,7 +6071,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::setStaticItemVersion(JNIEnv * /*e jint JNICALL ScriptMethodsObjectInfoNamespace::getConversionId(JNIEnv * /*env*/, jobject /*self*/, jlong target) { - const ServerObject * o = NULL; + const ServerObject * o = nullptr; if (!JavaLibrary::getObject(target, o)) return 0; @@ -6085,7 +6085,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::setConversionId(JNIEnv * /*env*/, NetworkId const networkId(target); ServerObject * const o = ServerObject::getServerObject(networkId); - if (o == NULL) + if (o == nullptr) { WARNING(true, ("ERROR: ScriptMethodsObjectInfo::setConversionId() Unable to resolve the object(%s).", networkId.getValueString().c_str())); return; @@ -6098,7 +6098,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::setConversionId(JNIEnv * /*env*/, void JNICALL ScriptMethodsObjectInfoNamespace::openCustomizationWindow(JNIEnv *env, jobject self, jlong player, jlong object, jstring customVarName1, jint minVar1, jint maxVar1, jstring customVarName2, jint minVar2, jint maxVar2, jstring customVarName3, jint minVar3, jint maxVar3, jstring customVarName4, jint minVar4, jint maxVar4) { - CreatureObject * playerObject = NULL; + CreatureObject * playerObject = nullptr; if (!JavaLibrary::getObject(player, playerObject)) return; std::string customVarName1String; @@ -6142,7 +6142,7 @@ void JNICALL ScriptMethodsObjectInfoNamespace::openCustomizationWindow(JNIEnv *e NetworkId const objectId(object); - if (playerObject->isPlayerControlled() && playerObject->getController() != NULL) + if (playerObject->isPlayerControlled() && playerObject->getController() != nullptr) { playerObject->getController()->appendMessage( static_cast(CM_openCustomizationWindow), @@ -6253,7 +6253,7 @@ jfloat JNICALL ScriptMethodsObjectInfoNamespace::getDefaultScaleFromSharedObject jboolean JNICALL ScriptMethodsObjectInfoNamespace::setOverrideMapColor(JNIEnv * env, jobject self, jlong object, jint r, jint g, jint b) { - TangibleObject * tangible = NULL; + TangibleObject * tangible = nullptr; if (!JavaLibrary::getObject(object, tangible)) return JNI_FALSE; @@ -6269,7 +6269,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setOverrideMapColor(JNIEnv * jboolean JNICALL ScriptMethodsObjectInfoNamespace::clearOverrideMapColor(JNIEnv * env, jobject self, jlong object) { - TangibleObject * tangible = NULL; + TangibleObject * tangible = nullptr; if (!JavaLibrary::getObject(object, tangible)) return JNI_FALSE; @@ -6285,14 +6285,14 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::clearOverrideMapColor(JNIEnv jobject JNICALL ScriptMethodsObjectInfoNamespace::getOverrideMapColor(JNIEnv * env, jobject self, jlong object) { - TangibleObject * tangible = NULL; + TangibleObject * tangible = nullptr; if (!JavaLibrary::getObject(object, tangible)) - return NULL; + return nullptr; uint8 r, g, b; if(!tangible->getOverrideMapColor(r,g,b)) { - return NULL; + return nullptr; } return createColor(r, g, b, 255)->getReturnValue(); @@ -6302,7 +6302,7 @@ jobject JNICALL ScriptMethodsObjectInfoNamespace::getOverrideMapColor(JNIEnv * e jboolean JNICALL ScriptMethodsObjectInfoNamespace::setForceShowHam(JNIEnv * env, jobject self, jlong object, jboolean show) { - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(object, creature)) return JNI_FALSE; @@ -6317,8 +6317,8 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setForceShowHam(JNIEnv * env, jboolean JNICALL ScriptMethodsObjectInfoNamespace::isContainedByPlayerAppearanceInventory(JNIEnv *env, jobject self, jlong player, jlong item) { UNREF(self); - ServerObject *itemObj = NULL; - CreatureObject *playerObj = NULL; + ServerObject *itemObj = nullptr; + CreatureObject *playerObj = nullptr; if(!JavaLibrary::getObject(item, itemObj)) { @@ -6348,7 +6348,7 @@ jlongArray JNICALL ScriptMethodsObjectInfoNamespace::getAllItemsFromAppearanceIn { UNREF(self); - const CreatureObject * playerCreature = NULL; + const CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature)) return 0; @@ -6356,11 +6356,11 @@ jlongArray JNICALL ScriptMethodsObjectInfoNamespace::getAllItemsFromAppearanceIn // go through the player's appearance inventory const ServerObject * appearanceInventoryObject = playerCreature->getAppearanceInventory(); - if (appearanceInventoryObject != NULL) + if (appearanceInventoryObject != nullptr) { const SlottedContainer * appearanceInvContainer = ContainerInterface::getSlottedContainer(*appearanceInventoryObject); - if (appearanceInvContainer != NULL) + if (appearanceInvContainer != nullptr) { getGoodItemsFromContainer(*appearanceInvContainer, objectIds); } @@ -6395,7 +6395,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::isAPlayerAppearanceInventoryC { UNREF(self); - const ServerObject * containerObj = NULL; + const ServerObject * containerObj = nullptr; if (!JavaLibrary::getObject(container, containerObj)) return JNI_FALSE; @@ -6412,7 +6412,7 @@ jlongArray JNICALL ScriptMethodsObjectInfoNamespace::getAllWornItems(JNIEnv *env { UNREF(self); - const CreatureObject * playerCreature = NULL; + const CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature)) return 0; @@ -6428,7 +6428,7 @@ jlongArray JNICALL ScriptMethodsObjectInfoNamespace::getAllWornItems(JNIEnv *env DEBUG_WARNING(true, ("JavaLibrary: getAllWornItems - Tried to get all the worn items(INCLUDING appearance items) from player [%s], but this player has no appearance inventory container.", playerCreature->getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } for (ContainerConstIterator i(appearanceInventory->begin()); i != appearanceInventory->end(); ++i) @@ -6436,7 +6436,7 @@ jlongArray JNICALL ScriptMethodsObjectInfoNamespace::getAllWornItems(JNIEnv *env const CachedNetworkId & itemId = *i; const ServerObject * item = safe_cast( itemId.getObject()); - if (item != NULL && item->asTangibleObject() != NULL && + if (item != nullptr && item->asTangibleObject() != nullptr && item->asTangibleObject()->isVisible()) { @@ -6459,7 +6459,7 @@ jlongArray JNICALL ScriptMethodsObjectInfoNamespace::getAllWornItems(JNIEnv *env DEBUG_WARNING(true, ("JavaLibrary: getAllWornItems - Tried to get all the worn items from player [%s], but this player has no creature slot container.", playerCreature->getNetworkId().getValueString().c_str())); - return NULL; + return nullptr; } for (ContainerConstIterator i(inventory->begin()); i != inventory->end(); ++i) @@ -6467,7 +6467,7 @@ jlongArray JNICALL ScriptMethodsObjectInfoNamespace::getAllWornItems(JNIEnv *env const CachedNetworkId & itemId = *i; const ServerObject * item = safe_cast( itemId.getObject()); - if (item != NULL && item->asTangibleObject() != NULL && + if (item != nullptr && item->asTangibleObject() != nullptr && item->asTangibleObject()->isVisible()) { const SlottedContainmentProperty * slottedContainment = ContainerInterface::getSlottedContainmentProperty(*item); // Get the slot property of our item. @@ -6507,7 +6507,7 @@ jlongArray JNICALL ScriptMethodsObjectInfoNamespace::getAllWornItems(JNIEnv *env return returnedIds->getReturnValue(); } - return NULL; + return nullptr; } @@ -6518,7 +6518,7 @@ jlong JNICALL ScriptMethodsObjectInfoNamespace::getAppearanceInventory(JNIEnv *e UNREF(env); UNREF(self); - const CreatureObject * playerCreature = NULL; + const CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature)) return 0; @@ -6536,11 +6536,11 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::setDecoyOrigin(JNIEnv *env, j UNREF(env); UNREF(self); - CreatureObject * decoyCreature = NULL; + CreatureObject * decoyCreature = nullptr; if (!JavaLibrary::getObject(creature, decoyCreature)) return JNI_FALSE; - const CreatureObject * originCreature = NULL; + const CreatureObject * originCreature = nullptr; if (!JavaLibrary::getObject(origin, originCreature)) return JNI_FALSE; @@ -6561,7 +6561,7 @@ jlong JNICALL ScriptMethodsObjectInfoNamespace::getDecoyOrigin(JNIEnv *env, jobj UNREF(env); UNREF(self); - CreatureObject * decoyCreature = NULL; + CreatureObject * decoyCreature = nullptr; if (!JavaLibrary::getObject(creature, decoyCreature)) return JNI_FALSE; @@ -6578,7 +6578,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::openRatingWindow(JNIEnv * env UNREF(env); UNREF(self); - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature)) { DEBUG_WARNING(true, ("OpenRatingWindow: Failed to get valid creature object with OID %d", player)); @@ -6603,7 +6603,7 @@ jboolean JNICALL ScriptMethodsObjectInfoNamespace::openRatingWindow(JNIEnv * env return JNI_FALSE; } - if (playerCreature->isPlayerControlled() && playerCreature->getController() != NULL) + if (playerCreature->isPlayerControlled() && playerCreature->getController() != nullptr) { playerCreature->getController()->appendMessage( static_cast(CM_openRatingWindow), @@ -6626,13 +6626,13 @@ void JNICALL ScriptMethodsObjectInfoNamespace::openExamineWindow(JNIEnv * env, j UNREF(env); UNREF(self); - CreatureObject const * playerCreature = NULL; + CreatureObject const * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature) || !playerCreature || !playerCreature->getClient()) { return; } - ServerObject const * itemObject = NULL; + ServerObject const * itemObject = nullptr; if (!JavaLibrary::getObject(item, itemObject) || !itemObject) { return; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsObjectMove.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsObjectMove.cpp index d345c4f0..2ba2beda 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsObjectMove.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsObjectMove.cpp @@ -215,7 +215,7 @@ const JNINativeMethod NATIVES[] = { */ bool ScriptMethodsObjectMoveNamespace::testInvalidObjectMove(const ServerObject * object) { - if (object->getCacheVersion() > 0 || object->getCellProperty() != NULL) + if (object->getCacheVersion() > 0 || object->getCellProperty() != nullptr) { char buffer[1024]; sprintf(buffer, "A script is trying to move object %s, which is a cached " @@ -323,7 +323,7 @@ jboolean JNICALL ScriptMethodsObjectMoveNamespace::setLocationFromObj(JNIEnv *en * @param self class calling this function * @param objectId object to get * - * @return the object's location, or null on error + * @return the object's location, or nullptr on error */ jobject JNICALL ScriptMethodsObjectMoveNamespace::getLocation(JNIEnv *env, jobject self, jlong objectId) { @@ -337,13 +337,13 @@ jobject JNICALL ScriptMethodsObjectMoveNamespace::getLocation(JNIEnv *env, jobje // (e.g. for mounts, the immediate Container is the mount). NOT_NULL(object); CellProperty const *const cellProperty = object->getParentCell(); - Object const *const cell = (cellProperty != NULL) ? &(cellProperty->getOwner()) : NULL; + Object const *const cell = (cellProperty != nullptr) ? &(cellProperty->getOwner()) : nullptr; // Remember, just because we're not in a cell doesn't mean we're not contained by something else, // particularly in the case of a rider mounted where the mount is in the world cell. - Vector const positionRelativeToCellOrWorld = (cell != NULL) ? object->getPosition_c() : + Vector const positionRelativeToCellOrWorld = (cell != nullptr) ? object->getPosition_c() : object->getPosition_w(); - NetworkId const &networkIdForCellOrWorld = (cell != NULL) ? cell->getNetworkId() : + NetworkId const &networkIdForCellOrWorld = (cell != nullptr) ? cell->getNetworkId() : NetworkId::cms_invalid; LocalRefPtr location; @@ -362,7 +362,7 @@ jobject JNICALL ScriptMethodsObjectMoveNamespace::getLocation(JNIEnv *env, jobje * @param self class calling this function * @param objectId object to get * - * @return the object's world location, or null on error + * @return the object's world location, or nullptr on error */ jobject JNICALL ScriptMethodsObjectMoveNamespace::getWorldLocation(JNIEnv *env, jobject self, jlong objectId) { @@ -387,7 +387,7 @@ jobject JNICALL ScriptMethodsObjectMoveNamespace::getWorldLocation(JNIEnv *env, * @param self class calling this function * @param objectId object to get * - * @return the object's location, or null on error + * @return the object's location, or nullptr on error */ jobject JNICALL ScriptMethodsObjectMoveNamespace::getHeading(JNIEnv *env, jobject self, jlong objectId) { @@ -553,7 +553,7 @@ jboolean JNICALL ScriptMethodsObjectMoveNamespace::faceToBehavior(JNIEnv *env, j jfloat JNICALL ScriptMethodsObjectMoveNamespace::getYaw(JNIEnv *env, jobject self, jlong target) { - const ServerObject * object = NULL; + const ServerObject * object = nullptr; if (!JavaLibrary::getObject(target, object)) return -1.0f; @@ -565,7 +565,7 @@ jfloat JNICALL ScriptMethodsObjectMoveNamespace::getYaw(JNIEnv *env, jobject sel jboolean JNICALL ScriptMethodsObjectMoveNamespace::setYaw(JNIEnv *env, jobject self, jlong target, jfloat yaw) { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::setYaw"); - ServerObject * object = NULL; + ServerObject * object = nullptr; { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::setYaw::getObject"); if (!JavaLibrary::getObject(target, object)) @@ -608,7 +608,7 @@ jboolean JNICALL ScriptMethodsObjectMoveNamespace::setYaw(JNIEnv *env, jobject s void JNICALL ScriptMethodsObjectMoveNamespace::modifyYaw(JNIEnv *env, jobject self, jlong target, jfloat degrees) { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::modifyYaw"); - ServerObject * object = NULL; + ServerObject * object = nullptr; { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::modifyYaw::getObject"); if (!JavaLibrary::getObject(target, object)) @@ -650,7 +650,7 @@ void JNICALL ScriptMethodsObjectMoveNamespace::modifyYaw(JNIEnv *env, jobject se void JNICALL ScriptMethodsObjectMoveNamespace::modifyPitch(JNIEnv *env, jobject self, jlong target, jfloat degrees) { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::modifyPitch"); - ServerObject * object = NULL; + ServerObject * object = nullptr; { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::modifyPitch::getObject"); if (!JavaLibrary::getObject(target, object)) @@ -692,7 +692,7 @@ void JNICALL ScriptMethodsObjectMoveNamespace::modifyPitch(JNIEnv *env, jobject void JNICALL ScriptMethodsObjectMoveNamespace::modifyRoll(JNIEnv *env, jobject self, jlong target, jfloat degrees) { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::modifyRoll"); - ServerObject * object = NULL; + ServerObject * object = nullptr; { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::modifyRoll::getObject"); if (!JavaLibrary::getObject(target, object)) @@ -734,7 +734,7 @@ void JNICALL ScriptMethodsObjectMoveNamespace::modifyRoll(JNIEnv *env, jobject s jfloatArray JNICALL ScriptMethodsObjectMoveNamespace::getQuaternion(JNIEnv *env, jobject self, jlong target) { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::getQuaternion"); - ServerObject * object = NULL; + ServerObject * object = nullptr; { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::getQuaternion::getObject"); if (!JavaLibrary::getObject(target, object)) @@ -771,7 +771,7 @@ jfloatArray JNICALL ScriptMethodsObjectMoveNamespace::getQuaternion(JNIEnv *env, void JNICALL ScriptMethodsObjectMoveNamespace::setQuaternion(JNIEnv *env, jobject self, jlong target, jfloat qw, jfloat qx, jfloat qy, jfloat qz) { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::setQuaternion"); - ServerObject * object = NULL; + ServerObject * object = nullptr; { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::setQuaternion::getObject"); if (!JavaLibrary::getObject(target, object)) @@ -804,7 +804,7 @@ void JNICALL ScriptMethodsObjectMoveNamespace::setQuaternion(JNIEnv *env, jobjec jint JNICALL ScriptMethodsObjectMoveNamespace::getFurnitureRotationDegree(JNIEnv *env, jobject self, jlong player) { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::getFurnitureRotationDegree"); - ServerObject * object = NULL; + ServerObject * object = nullptr; { PROFILER_AUTO_BLOCK_DEFINE("JavaLibrary::getFurnitureRotationDegree::getObject"); if (!JavaLibrary::getObject(player, object)) @@ -823,11 +823,11 @@ jint JNICALL ScriptMethodsObjectMoveNamespace::getFurnitureRotationDegree(JNIEnv void JNICALL ScriptMethodsObjectMoveNamespace::saveDecorationLayout(JNIEnv *env, jobject self, jlong player, jlong pob, jint saveSlotNumber, jstring description) { - CreatureObject * playerObject = NULL; + CreatureObject * playerObject = nullptr; if (!JavaLibrary::getObject(player, playerObject) || !playerObject) return; - ServerObject const * pobObject = NULL; + ServerObject const * pobObject = nullptr; if (!JavaLibrary::getObject(pob, pobObject) || !pobObject) return; @@ -843,11 +843,11 @@ void JNICALL ScriptMethodsObjectMoveNamespace::saveDecorationLayout(JNIEnv *env, void JNICALL ScriptMethodsObjectMoveNamespace::restoreDecorationLayout(JNIEnv *env, jobject self, jlong player, jlong pob, jint saveSlotNumber) { - CreatureObject * playerObject = NULL; + CreatureObject * playerObject = nullptr; if (!JavaLibrary::getObject(player, playerObject) || !playerObject) return; - ServerObject const * pobObject = NULL; + ServerObject const * pobObject = nullptr; if (!JavaLibrary::getObject(pob, pobObject) || !pobObject) return; @@ -1402,11 +1402,11 @@ jobject JNICALL ScriptMethodsObjectMoveNamespace::getConnectedPlayerLocation(JNI std::map const & connectedCharacterLfgData = ServerUniverse::getConnectedCharacterLfgData(); std::map::const_iterator const iterFind = connectedCharacterLfgData.find(NetworkId(static_cast(player))); if (iterFind == connectedCharacterLfgData.end()) - return NULL; + return nullptr; LocalRefPtr dictionary = createNewObject(JavaLibrary::getClsDictionary(), JavaLibrary::getMidDictionary()); if (dictionary == LocalRef::cms_nullPtr) - return NULL; + return nullptr; callObjectMethod(*dictionary, JavaLibrary::getMidDictionaryPut(), JavaString("planet").getValue(), JavaString(iterFind->second.locationPlanet).getValue()); @@ -1457,7 +1457,7 @@ jfloat JNICALL ScriptMethodsObjectMoveNamespace::getMovementSpeed(JNIEnv * /*env NetworkId const networkId(object); CreatureController * const creatureController = CreatureController::getCreatureController(networkId); - return (creatureController != NULL) ? creatureController->getCurrentVelocity().magnitude() : 0.0f; + return (creatureController != nullptr) ? creatureController->getCurrentVelocity().magnitude() : 0.0f; } // ---------------------------------------------------------------------- @@ -1467,7 +1467,7 @@ jfloat JNICALL ScriptMethodsObjectMoveNamespace::getWalkSpeed(JNIEnv * /*env*/, NetworkId const networkId(object); CreatureObject * const creatureObject = CreatureObject::getCreatureObject(networkId); - return (creatureObject != NULL) ? creatureObject->getWalkSpeed() : 0.0f; + return (creatureObject != nullptr) ? creatureObject->getWalkSpeed() : 0.0f; } // ---------------------------------------------------------------------- @@ -1477,7 +1477,7 @@ jfloat JNICALL ScriptMethodsObjectMoveNamespace::getRunSpeed(JNIEnv * /*env*/, j NetworkId const networkId(object); CreatureObject * const creatureObject = CreatureObject::getCreatureObject(networkId); - return (creatureObject != NULL) ? creatureObject->getRunSpeed() : 0.0f; + return (creatureObject != nullptr) ? creatureObject->getRunSpeed() : 0.0f; } // ---------------------------------------------------------------------- @@ -1487,7 +1487,7 @@ void JNICALL ScriptMethodsObjectMoveNamespace::setBaseWalkSpeed(JNIEnv * /*env*/ NetworkId const networkId(object); CreatureObject * const creatureObject = CreatureObject::getCreatureObject(networkId); - if (creatureObject == NULL) + if (creatureObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsObjectMove::setBaseWalkSpeed() Unable to resolve the object(%s) to a CreatureObject.", networkId.getValueString().c_str())); return; @@ -1505,7 +1505,7 @@ jfloat JNICALL ScriptMethodsObjectMoveNamespace::getBaseWalkSpeed(JNIEnv * /*env NetworkId const networkId(object); CreatureObject * const creatureObject = CreatureObject::getCreatureObject(networkId); - return (creatureObject != NULL) ? creatureObject->getBaseWalkSpeed() : 0.0f; + return (creatureObject != nullptr) ? creatureObject->getBaseWalkSpeed() : 0.0f; } // ---------------------------------------------------------------------- @@ -1515,7 +1515,7 @@ void JNICALL ScriptMethodsObjectMoveNamespace::setBaseRunSpeed(JNIEnv * /*env*/, NetworkId const networkId(object); CreatureObject * const creatureObject = CreatureObject::getCreatureObject(networkId); - if (creatureObject == NULL) + if (creatureObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsObjectMove::setBaseRunSpeed() Unable to resolve the object(%s) to a CreatureObject.", networkId.getValueString().c_str())); return; @@ -1533,7 +1533,7 @@ jfloat JNICALL ScriptMethodsObjectMoveNamespace::getBaseRunSpeed(JNIEnv * /*env* NetworkId const networkId(object); CreatureObject * const creatureObject = CreatureObject::getCreatureObject(networkId); - return (creatureObject != NULL) ? creatureObject->getBaseRunSpeed() : 0.0f; + return (creatureObject != nullptr) ? creatureObject->getBaseRunSpeed() : 0.0f; } // ---------------------------------------------------------------------- @@ -1543,7 +1543,7 @@ void JNICALL ScriptMethodsObjectMoveNamespace::setMovementWalk(JNIEnv * /*env*/, NetworkId const networkId(object); CreatureObject * const creatureObject = CreatureObject::getCreatureObject(networkId); - if (creatureObject == NULL) + if (creatureObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsObjectMove::setMovementWalk() Unable to resolve the object(%s) to a CreatureObject.", networkId.getValueString().c_str())); return; @@ -1551,7 +1551,7 @@ void JNICALL ScriptMethodsObjectMoveNamespace::setMovementWalk(JNIEnv * /*env*/, AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(creatureObject->getController()); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsObjectMove::setMovementWalk() Unable to resolve the object's(%s) controller to an AiCreatureController.", creatureObject->getDebugInformation().c_str())); return; @@ -1569,7 +1569,7 @@ void JNICALL ScriptMethodsObjectMoveNamespace::setMovementRun(JNIEnv * /*env*/, NetworkId const networkId(object); CreatureObject * const creatureObject = CreatureObject::getCreatureObject(networkId); - if (creatureObject == NULL) + if (creatureObject == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsObjectMove::setMovementRun() Unable to resolve the object(%s) to a CreatureObject.", networkId.getValueString().c_str())); return; @@ -1577,7 +1577,7 @@ void JNICALL ScriptMethodsObjectMoveNamespace::setMovementRun(JNIEnv * /*env*/, AICreatureController * const aiCreatureController = AICreatureController::asAiCreatureController(creatureObject->getController()); - if (aiCreatureController == NULL) + if (aiCreatureController == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsObjectMove::setMovementRun() Unable to resolve the object's(%s) controller to an AiCreatureController.", creatureObject->getDebugInformation().c_str())); return; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsPermissions.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsPermissions.cpp index 732a9f6d..82bf242b 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsPermissions.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsPermissions.cpp @@ -85,7 +85,7 @@ jobjectArray JNICALL ScriptMethodsPermissionsNamespace::permissionsGetBanned(JNI { ServerObject *serverObj = 0; if (!JavaLibrary::getObject(target, serverObj)) - return NULL; + return nullptr; LocalObjectArrayRefPtr strArray; BuildingObject *buildingObj = dynamic_cast(serverObj); @@ -96,7 +96,7 @@ jobjectArray JNICALL ScriptMethodsPermissionsNamespace::permissionsGetBanned(JNI if (cellObj) if (ScriptConversion::convert(cellObj->getBanned(), strArray)) return strArray->getReturnValue(); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -114,7 +114,7 @@ jobjectArray JNICALL ScriptMethodsPermissionsNamespace::permissionsGetAllowed(JN { ServerObject *serverObj = 0; if (!JavaLibrary::getObject(target, serverObj)) - return NULL; + return nullptr; LocalObjectArrayRefPtr strArray; BuildingObject *buildingObj = dynamic_cast(serverObj); @@ -125,7 +125,7 @@ jobjectArray JNICALL ScriptMethodsPermissionsNamespace::permissionsGetAllowed(JN if (cellObj) if (ScriptConversion::convert(cellObj->getAllowed(), strArray)) return strArray->getReturnValue(); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsPilot.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsPilot.cpp index 5d216dc2..96bf045b 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsPilot.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsPilot.cpp @@ -177,7 +177,7 @@ jint JNICALL ScriptMethodsPilotNamespace::spaceUnitGetBehavior(JNIEnv * env, job if (!shipObject) return JNI_FALSE; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitGetBehavior() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -200,7 +200,7 @@ jlong JNICALL ScriptMethodsPilotNamespace::spaceUnitGetPrimaryAttackTarget(JNIEn if (!shipObject) return JNI_FALSE; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitGetPrimaryAttackTarget() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -223,7 +223,7 @@ jlongArray JNICALL ScriptMethodsPilotNamespace::spaceUnitGetAttackTargetList(JNI if (!shipObject) return JNI_FALSE; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitGetAttackTargetList() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -311,7 +311,7 @@ jboolean JNICALL ScriptMethodsPilotNamespace::spaceUnitIsAttacking(JNIEnv * env, if (!shipObject) return JNI_FALSE; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitIsAttacking() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -334,7 +334,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitIdle(JNIEnv * env, jobject /* if (!shipObject) return; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitIdle() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -357,14 +357,14 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitTrack(JNIEnv * env, jobject / if (!shipObject) return; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitTrack() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); return; } - Object * target = NULL; + Object * target = nullptr; if (!JavaLibrary::getObject(jobject_target, target)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitTrack() The target did not resolve to an Object")); @@ -387,7 +387,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitMoveTo(JNIEnv * env, jobject if (!shipObject) return; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitMoveTo() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -410,7 +410,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitMoveTo(JNIEnv * env, jobject return; } - SpacePath * const path = SpacePathManager::fetch(NULL, aiShipController->getOwner(), aiShipController->getShipRadius()); + SpacePath * const path = SpacePathManager::fetch(nullptr, aiShipController->getOwner(), aiShipController->getShipRadius()); AiShipController::TransformList::const_iterator iterTransformList = convertedPath.begin(); for (; iterTransformList != convertedPath.end(); ++iterTransformList) @@ -435,7 +435,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitAddPatrolPath(JNIEnv * env, j if (!shipObject) return; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitAddPatrolPath() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -483,7 +483,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitClearPatrolPath(JNIEnv * env, if (!shipObject) return; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitClearPatrolPath() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -506,14 +506,14 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitFollow(JNIEnv * env, jobject if (!shipObject) return; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitFollow() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); return; } - Object * followedUnit = NULL; + Object * followedUnit = nullptr; if (!JavaLibrary::getObject(jobject_followedUnit, followedUnit)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitFollow() followedUnit did not resolve to an Object")); @@ -592,10 +592,10 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitAddDamageTaken(JNIEnv * env, } ShipController * const shipController = shipObject->getController()->asShipController(); - AiShipController * const aiShipController = (shipController != NULL) ? shipController->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipController != nullptr) ? shipController->asAiShipController() : nullptr; bool const verifyAttacker = true; - if (aiShipController != NULL) + if (aiShipController != nullptr) { // This adds damage to an AI unit @@ -607,7 +607,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitAddDamageTaken(JNIEnv * env, LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("ScriptMethodsPilot::spaceUnitAddDamageTaken() targetUnit(%s) is not attackable", targetShipObject->getNetworkId().getValueString().c_str())); } } - else if (shipController != NULL) + else if (shipController != nullptr) { // This adds damage to a player unit @@ -635,7 +635,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitSetAttackOrders(JNIEnv * env, if (!shipObject) return; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitSetAttackOrder() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -665,7 +665,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitSetPilotType(JNIEnv * env, jo if (!shipObject) return; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitSetPilotType() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -697,13 +697,13 @@ jstring JNICALL ScriptMethodsPilotNamespace::spaceUnitGetPilotType(JNIEnv * env, LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("ScriptMethodsPilot::spaceUnitGetPilotType()")); if (!verifyShipsEnabled()) - return NULL; + return nullptr; ShipObject * const shipObject = JavaLibrary::getShipThrow(env, jobject_unit, "ScriptMethodsPilot::spaceUnitGetPilotType() unit did not resolve to a ShipObject"); if (!shipObject) - return NULL; + return nullptr; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitGetPilotType() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -726,7 +726,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitRemoveAttackTarget(JNIEnv * e if (!shipObject) return; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitRemoveAttackTarget() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -765,7 +765,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitSetLeashDistance(JNIEnv * env if (!shipObject) return; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitSetLeashDistance() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -805,7 +805,7 @@ jint JNICALL ScriptMethodsPilotNamespace::spaceUnitGetSquadId(JNIEnv * env, jobj if (!shipObject) return JNI_FALSE; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitGetSquadId() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -849,7 +849,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceSquadMoveTo(JNIEnv * /*env*/, job } float const largestShipRadius = squad->getLargestShipRadius(); - SpacePath * const path = SpacePathManager::fetch(NULL, squad, largestShipRadius); + SpacePath * const path = SpacePathManager::fetch(nullptr, squad, largestShipRadius); AiShipController::TransformList::const_iterator iterTransformList = convertedPath.begin(); for (; iterTransformList != convertedPath.end(); ++iterTransformList) @@ -936,7 +936,7 @@ jint JNICALL ScriptMethodsPilotNamespace::spaceSquadRemoveUnit(JNIEnv * env, job if (!shipObject) return JNI_FALSE; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceSquadRemoveUnit() called on unit(%s) without AiShipController", shipObject->getNetworkId().getValueString().c_str())); @@ -1148,7 +1148,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceSquadTrack(JNIEnv * /*env*/, jobj return; } - Object * target = NULL; + Object * target = nullptr; if (!JavaLibrary::getObject(jobject_target, target)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceSquadTrack() The target did not resolve to an Object")); @@ -1171,7 +1171,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceSquadSetLeader(JNIEnv * env, jobj if (!leaderShipObject) return; - AiShipController * const aiShipController = (leaderShipObject->getController()->asShipController() != NULL) ? leaderShipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (leaderShipObject->getController()->asShipController() != nullptr) ? leaderShipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceSquadSetLeader() called on unit(%s) without AiShipController", leaderShipObject->getNetworkId().getValueString().c_str())); @@ -1251,7 +1251,7 @@ void JNICALL ScriptMethodsPilotNamespace::spaceSquadFollow(JNIEnv * /*env*/, job return; } - Object * followedUnit = NULL; + Object * followedUnit = nullptr; if (!JavaLibrary::getObject(jobject_followedUnit, followedUnit)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceSquadFollow() followedUnit did not resolve to an Object")); @@ -1418,7 +1418,7 @@ jint JNICALL ScriptMethodsPilotNamespace::spaceSquadGetGuardTarget(JNIEnv * /*en return JNI_FALSE; } - if (squad->getGuardTarget() == NULL) + if (squad->getGuardTarget() == nullptr) { return 0; } @@ -1463,7 +1463,7 @@ void JNICALL ScriptMethodsPilotNamespace::setShipAggroDistance(JNIEnv * env, job if (!shipObject) return; - AiShipController * const aiShipController = (shipObject->getController()->asShipController() != NULL) ? shipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const aiShipController = (shipObject->getController()->asShipController() != nullptr) ? shipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!aiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::setShipAggroDistance(): unit(%s) does not have an AiShipController",shipObject->getNetworkId().getValueString().c_str())); @@ -1557,14 +1557,14 @@ jobject JNICALL ScriptMethodsPilotNamespace::spaceUnitGetDockTransform(JNIEnv * if (!verifyShipsEnabled()) return 0; - Object * dockTarget = NULL; + Object * dockTarget = nullptr; if (!JavaLibrary::getObject(jobject_dockTarget, dockTarget)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitGetDockTransform() dockTarget did not resolve to an Object")); return 0; } - Object * dockingUnit = NULL; + Object * dockingUnit = nullptr; if (!JavaLibrary::getObject(jobject_dockingUnit, dockingUnit)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitGetDockTransform() dockingUnit did not resolve to an Object")); @@ -1600,14 +1600,14 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitAddExclusiveAggro(JNIEnv * en return; } - AiShipController * const unitAiShipController = (unitShipObject->getController()->asShipController() != NULL) ? unitShipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const unitAiShipController = (unitShipObject->getController()->asShipController() != nullptr) ? unitShipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!unitAiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitAddExclusiveAggro() called on unit(%s) without AiShipController", unitShipObject->getDebugInformation().c_str())); return; } - Object * pilotObject = NULL; + Object * pilotObject = nullptr; if (!JavaLibrary::getObject(jobject_pilot, pilotObject)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitAddExclusiveAggro() pilot did not resolve to an Object")); @@ -1642,14 +1642,14 @@ void JNICALL ScriptMethodsPilotNamespace::spaceUnitRemoveExclusiveAggro(JNIEnv * return; } - AiShipController * const unitAiShipController = (unitShipObject->getController()->asShipController() != NULL) ? unitShipObject->getController()->asShipController()->asAiShipController() : NULL; + AiShipController * const unitAiShipController = (unitShipObject->getController()->asShipController() != nullptr) ? unitShipObject->getController()->asShipController()->asAiShipController() : nullptr; if (!unitAiShipController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitRemoveExclusiveAggro() called on unit(%s) without AiShipController", unitShipObject->getDebugInformation().c_str())); return; } - Object * pilotObject = NULL; + Object * pilotObject = nullptr; if (!JavaLibrary::getObject(jobject_pilot, pilotObject)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("ScriptMethodsPilot::spaceUnitRemoveExclusiveAggro() pilot did not resolve to an Object")); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsPlayerAccount.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsPlayerAccount.cpp index 00aa9c9d..0234a47c 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsPlayerAccount.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsPlayerAccount.cpp @@ -127,7 +127,7 @@ jlong JNICALL ScriptMethodsPlayerAccountNamespace::getPlayerObject(JNIEnv *env, jlong objId = 0; - ServerObject * creatureServerObject = NULL; + ServerObject * creatureServerObject = nullptr; if (JavaLibrary::getObject(creature,creatureServerObject)) { SlotId slot = SlotIdManager::findSlotId(ConstCharCrcLowerString("ghost")); @@ -258,11 +258,11 @@ jobject JNICALL ScriptMethodsPlayerAccountNamespace::getAccountTimeData(JNIEnv * const PlayerObject * player = PlayerCreatureController::getPlayerObject( creature); - if (player == NULL) + if (player == nullptr) return 0; const Client * client = creature->getClient(); - if (client == NULL) + if (client == nullptr) return 0; // get the values that came from Platform @@ -463,7 +463,7 @@ jboolean JNICALL ScriptMethodsPlayerAccountNamespace::isAccountQualifiedForHouse * @returns a dictionary that contains the following data in paralled arrays * with the oldest CTS transaction first and the newest CTS transaction last * -* @returns null if the character doesn't have any CTS history +* @returns nullptr if the character doesn't have any CTS history * * string[] character_name full name of the source character * string[] cluster_name name of the source cluster @@ -471,7 +471,7 @@ jboolean JNICALL ScriptMethodsPlayerAccountNamespace::isAccountQualifiedForHouse */ jobject JNICALL ScriptMethodsPlayerAccountNamespace::getCharacterCtsHistory(JNIEnv * env, jobject self, jlong player) { - CreatureObject const * playerObject = NULL; + CreatureObject const * playerObject = nullptr; if (!JavaLibrary::getObject(player, playerObject)) { DEBUG_WARNING(true, ("JavaLibrary::getCharacterCtsHistory: bad player object")); @@ -491,7 +491,7 @@ jobject JNICALL ScriptMethodsPlayerAccountNamespace::getCharacterCtsHistory(JNIE if (i.getValue(ctsTransactionDetail)) { Unicode::UnicodeStringVector tokens; - if (Unicode::tokenize(ctsTransactionDetail, tokens, NULL, NULL) && (tokens.size() >= 4)) + if (Unicode::tokenize(ctsTransactionDetail, tokens, nullptr, nullptr) && (tokens.size() >= 4)) { Unicode::String * characterName = new Unicode::String(); for (size_t i = 3, j = tokens.size(); i < j; ++i) @@ -538,13 +538,13 @@ jobject JNICALL ScriptMethodsPlayerAccountNamespace::getCharacterCtsHistory(JNIE * for the particular CTS source character that this character at one time transferred from * with the oldest CTS transaction first and the newest CTS transaction last * -* @returns null if the character doesn't have any retroactive CTS objvars history +* @returns nullptr if the character doesn't have any retroactive CTS objvars history */ jobjectArray JNICALL ScriptMethodsPlayerAccountNamespace::getCharacterRetroactiveCtsObjvars(JNIEnv * env, jobject self, jlong player) { std::vector > const *> const & characterRetroactiveCtsObjvars = GameServer::getRetroactiveCtsHistoryObjvars(NetworkId(static_cast(player))); if (characterRetroactiveCtsObjvars.empty()) - return NULL; + return nullptr; LocalObjectArrayRefPtr results = createNewObjectArray(characterRetroactiveCtsObjvars.size(), JavaLibrary::getClsDictionary()); for (size_t i = 0, size = characterRetroactiveCtsObjvars.size(); i < size; ++i) @@ -603,7 +603,7 @@ jobjectArray JNICALL ScriptMethodsPlayerAccountNamespace::qualifyForFreeCts(JNIE // see if we can/should bypass the free CTS time restriction if (!freeCtsInfo && ConfigServerGame::getAllowIgnoreFreeCtsTimeRestriction()) { - CreatureObject const * playerObject = NULL; + CreatureObject const * playerObject = nullptr; if (JavaLibrary::getObject(player, playerObject) && playerObject && playerObject->getClient() && playerObject->getClient()->isGod()) { freeCtsInfo = FreeCtsDataTable::getFreeCtsInfoForCharacter(characterCreateTime, GameServer::getInstance().getClusterName(), true); @@ -615,7 +615,7 @@ jobjectArray JNICALL ScriptMethodsPlayerAccountNamespace::qualifyForFreeCts(JNIE } if (!freeCtsInfo || freeCtsInfo->targetCluster.empty()) - return NULL; + return nullptr; LocalObjectArrayRefPtr valueArray = createNewObjectArray(freeCtsInfo->targetCluster.size(), JavaLibrary::getClsString()); @@ -634,7 +634,7 @@ jobjectArray JNICALL ScriptMethodsPlayerAccountNamespace::qualifyForFreeCts(JNIE */ void JNICALL ScriptMethodsPlayerAccountNamespace::validateFreeCts(JNIEnv * /*env*/, jobject /*self*/, jlong player, jstring destinationGalaxy, jstring destinationCharacterName) { - CreatureObject const * creatureObject = NULL; + CreatureObject const * creatureObject = nullptr; if (!JavaLibrary::getObject(player, creatureObject) || !creatureObject) { DEBUG_WARNING(true, ("JavaLibrary::validateFreeCts: bad CreatureObject")); @@ -674,7 +674,7 @@ void JNICALL ScriptMethodsPlayerAccountNamespace::validateFreeCts(JNIEnv * /*env */ void JNICALL ScriptMethodsPlayerAccountNamespace::performFreeCts(JNIEnv * /*env*/, jobject /*self*/, jlong player, jstring destinationGalaxy, jstring destinationCharacterName) { - CreatureObject const * creatureObject = NULL; + CreatureObject const * creatureObject = nullptr; if (!JavaLibrary::getObject(player, creatureObject) || !creatureObject) { DEBUG_WARNING(true, ("JavaLibrary::performFreeCts: bad CreatureObject")); @@ -713,7 +713,7 @@ void JNICALL ScriptMethodsPlayerAccountNamespace::performFreeCts(JNIEnv * /*env* */ void JNICALL ScriptMethodsPlayerAccountNamespace::validateCts(JNIEnv * /*env*/, jobject /*self*/, jlong player, jstring destinationGalaxy, jstring destinationCharacterName) { - CreatureObject const * creatureObject = NULL; + CreatureObject const * creatureObject = nullptr; if (!JavaLibrary::getObject(player, creatureObject) || !creatureObject) { DEBUG_WARNING(true, ("JavaLibrary::validateCts: bad CreatureObject")); @@ -753,7 +753,7 @@ void JNICALL ScriptMethodsPlayerAccountNamespace::validateCts(JNIEnv * /*env*/, */ void JNICALL ScriptMethodsPlayerAccountNamespace::performCts(JNIEnv * /*env*/, jobject /*self*/, jlong player, jstring destinationGalaxy, jstring destinationCharacterName) { - CreatureObject const * creatureObject = NULL; + CreatureObject const * creatureObject = nullptr; if (!JavaLibrary::getObject(player, creatureObject) || !creatureObject) { DEBUG_WARNING(true, ("JavaLibrary::performCts: bad CreatureObject")); @@ -792,7 +792,7 @@ void JNICALL ScriptMethodsPlayerAccountNamespace::performCts(JNIEnv * /*env*/, j */ void JNICALL ScriptMethodsPlayerAccountNamespace::validateRenameCharacter(JNIEnv *env, jobject self, jlong player, jstring newName) { - CreatureObject const * creatureObject = NULL; + CreatureObject const * creatureObject = nullptr; if (!JavaLibrary::getObject(player, creatureObject) || !creatureObject) { DEBUG_WARNING(true, ("JavaLibrary::validateRenameCharacter: bad CreatureObject")); @@ -819,7 +819,7 @@ void JNICALL ScriptMethodsPlayerAccountNamespace::validateRenameCharacter(JNIEnv bool lastNameChangeOnly = false; static Unicode::String const delimiters(Unicode::narrowToWide(" ")); Unicode::UnicodeStringVector newNameTokens; - if (!Unicode::tokenize(newNameString, newNameTokens, &delimiters, NULL)) + if (!Unicode::tokenize(newNameString, newNameTokens, &delimiters, nullptr)) newNameTokens.clear(); size_t const newNameTokensCount = newNameTokens.size(); @@ -846,7 +846,7 @@ void JNICALL ScriptMethodsPlayerAccountNamespace::validateRenameCharacter(JNIEnv { Unicode::String const uniqueRandomName = NameManager::getInstance().generateUniqueRandomName(ConfigServerGame::getCharacterNameGeneratorDirectory(), creatureTemplate->getNameGeneratorType()); Unicode::UnicodeStringVector uniqueRandomNameTokens; - if (!Unicode::tokenize(uniqueRandomName, uniqueRandomNameTokens, &delimiters, NULL)) + if (!Unicode::tokenize(uniqueRandomName, uniqueRandomNameTokens, &delimiters, nullptr)) uniqueRandomNameTokens.clear(); newNameString = ((uniqueRandomNameTokens.size() >= 1) ? uniqueRandomNameTokens[0] : delimiters) + delimiters + newNameTokens[1]; @@ -861,7 +861,7 @@ void JNICALL ScriptMethodsPlayerAccountNamespace::validateRenameCharacter(JNIEnv params.addParam("@ui:name_declined_racially_inappropriate", "reason"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(creatureObject->getNetworkId(), "renameCharacterNameValidationFail", dictionary->getSerializedData(), 0, false); @@ -879,7 +879,7 @@ void JNICALL ScriptMethodsPlayerAccountNamespace::validateRenameCharacter(JNIEnv params.addParam(errorText.c_str(), "reason"); ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); MessageToQueue::getInstance().sendMessageToJava(creatureObject->getNetworkId(), "renameCharacterNameValidationFail", dictionary->getSerializedData(), 0, false); @@ -906,7 +906,7 @@ void JNICALL ScriptMethodsPlayerAccountNamespace::validateRenameCharacter(JNIEnv */ void JNICALL ScriptMethodsPlayerAccountNamespace::renameCharacterReleaseNameReservation(JNIEnv *env, jobject self, jlong player) { - CreatureObject const * creatureObject = NULL; + CreatureObject const * creatureObject = nullptr; if (!JavaLibrary::getObject(player, creatureObject) || !creatureObject) { DEBUG_WARNING(true, ("JavaLibrary::renameCharacterReleaseNameReservation: bad CreatureObject")); @@ -929,7 +929,7 @@ void JNICALL ScriptMethodsPlayerAccountNamespace::renameCharacterReleaseNameRese */ void JNICALL ScriptMethodsPlayerAccountNamespace::renameCharacter(JNIEnv *env, jobject self, jlong player, jstring newName) { - CreatureObject const * creatureObject = NULL; + CreatureObject const * creatureObject = nullptr; if (!JavaLibrary::getObject(player, creatureObject) || !creatureObject) { DEBUG_WARNING(true, ("JavaLibrary::renameCharacter: bad CreatureObject")); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsPlayerQuest.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsPlayerQuest.cpp index 2e523419..e72745fe 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsPlayerQuest.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsPlayerQuest.cpp @@ -159,7 +159,7 @@ jboolean ScriptMethodsPlayerQuestNamespace::addPlayerQuestTask(JNIEnv * env, job std::string sceneId; if (!ScriptConversion::convertWorld(waypointLocation, waypointVec, sceneId)) { - // NULL or Invalid Location passed in. That's fine, just means no waypoint. + // nullptr or Invalid Location passed in. That's fine, just means no waypoint. if(questObject) { std::string titleString; @@ -456,7 +456,7 @@ jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestWaypoint(JNIEnv * env, if(!JavaLibrary::getObject(quest, questObject)) { WARNING(true, ("getPlayerQuestWaypoint: Could not get valid Player Quest Object from OID: %d", quest)); - return NULL; + return nullptr; } if(questObject) @@ -465,7 +465,7 @@ jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestWaypoint(JNIEnv * env, return jString.getReturnValue(); } - return NULL; + return nullptr; } @@ -520,7 +520,7 @@ jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestTitle(JNIEnv * env, job if(!JavaLibrary::getObject(quest, questObject)) { WARNING(true, ("getPlayerQuestTitle: Could not get valid Player Quest Object from OID: %d", quest)); - return NULL; + return nullptr; } if(questObject) @@ -529,7 +529,7 @@ jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestTitle(JNIEnv * env, job return returnVal.getReturnValue(); } - return NULL; + return nullptr; } jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestDescription(JNIEnv * env, jobject self, jlong quest) @@ -541,7 +541,7 @@ jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestDescription(JNIEnv * en if(!JavaLibrary::getObject(quest, questObject)) { WARNING(true, ("getPlayerQuestDescription: Could not get valid Player Quest Object from OID: %d", quest)); - return NULL; + return nullptr; } if(questObject) @@ -550,7 +550,7 @@ jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestDescription(JNIEnv * en return returnVal.getReturnValue(); } - return NULL; + return nullptr; } jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestTaskTitle(JNIEnv * env, jobject self, jlong quest, jint index) @@ -562,7 +562,7 @@ jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestTaskTitle(JNIEnv * env, if(!JavaLibrary::getObject(quest, questObject)) { WARNING(true, ("getPlayerQuestTaskTitle: Could not get valid Player Quest Object from OID: %d", quest)); - return NULL; + return nullptr; } if(questObject) @@ -571,7 +571,7 @@ jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestTaskTitle(JNIEnv * env, return returnVal.getReturnValue(); } - return NULL; + return nullptr; } jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestTaskDescription(JNIEnv * env, jobject self, jlong quest, jint index) @@ -583,7 +583,7 @@ jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestTaskDescription(JNIEnv if(!JavaLibrary::getObject(quest, questObject)) { WARNING(true, ("getPlayerQuestTaskDescription: Could not get valid Player Quest Object from OID: %d", quest)); - return NULL; + return nullptr; } if(questObject) @@ -592,7 +592,7 @@ jobject ScriptMethodsPlayerQuestNamespace::getPlayerQuestTaskDescription(JNIEnv return returnVal.getReturnValue(); } - return NULL; + return nullptr; } void ScriptMethodsPlayerQuestNamespace::setPlayerQuestRecipe(JNIEnv * env, jobject self, jlong quest, jboolean recipe) @@ -768,21 +768,21 @@ void ScriptMethodsPlayerQuestNamespace::openPlayerQuestRecipe(JNIEnv * env, jobj UNREF(env); UNREF(self); - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature)) { DEBUG_WARNING(true, ("openPlayerQuestRecipe: Failed to get valid creature object with OID %d", player)); return; } - ServerObject * recipeObj = NULL; + ServerObject * recipeObj = nullptr; if (!JavaLibrary::getObject(recipe, recipeObj)) { DEBUG_WARNING(true, ("openPlayerQuestRecipe: Failed to get valid recipe object with OID %d", player)); return; } - if (playerCreature->isPlayerControlled() && playerCreature->getController() != NULL) + if (playerCreature->isPlayerControlled() && playerCreature->getController() != nullptr) { playerCreature->getController()->appendMessage( static_cast(CM_openRecipe), @@ -801,7 +801,7 @@ void ScriptMethodsPlayerQuestNamespace::resetAllPlayerQuestData(JNIEnv * env, jo UNREF(env); UNREF(self); - PlayerQuestObject * playerQuest = NULL; + PlayerQuestObject * playerQuest = nullptr; if (!JavaLibrary::getObject(quest, playerQuest)) { DEBUG_WARNING(true, ("resetAllPlayerQuestData: Failed to get valid recipe object with OID %d", quest)); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsPvp.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsPvp.cpp index b27444e7..75b7f1ec 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsPvp.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsPvp.cpp @@ -43,7 +43,7 @@ namespace ScriptMethodsPvpNamespace const char * makeCopyOfString(const char * rhs) { - char * lhs = NULL; + char * lhs = nullptr; if (rhs) { lhs = new char[strlen(rhs) + 1]; @@ -668,7 +668,7 @@ jobjectArray JNICALL ScriptMethodsPvpNamespace::pvpGetEnemyFlags(JNIEnv *env, jo if (ScriptConversion::convert(enemyStrings, strArray)) return strArray->getReturnValue(); } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -749,7 +749,7 @@ jboolean JNICALL ScriptMethodsPvpNamespace::pvpHasBattlefieldEnemyFlag(JNIEnv *e * @param actor The actor for the enemy check * @param from The center of the range * @param range The distance to query. - * @return null if there is an error, or an array of enemy objects which are in range. + * @return nullptr if there is an error, or an array of enemy objects which are in range. */ jlongArray JNICALL ScriptMethodsPvpNamespace::pvpGetEnemiesInRange(JNIEnv *env, jobject self, jlong actor, jlong location, jfloat range) { @@ -799,7 +799,7 @@ jlongArray JNICALL ScriptMethodsPvpNamespace::pvpGetEnemiesInRange(JNIEnv *env, * @param angle The cone angle, in degrees, that the cone sweeps out. The * total cone angle is twice this angle; therefore, this angle * represents the angle swept out to each side of the cone axis. - * @return null if there is an error, or an array of enemy objects which are in range. + * @return nullptr if there is an error, or an array of enemy objects which are in range. */ jlongArray JNICALL ScriptMethodsPvpNamespace::pvpGetEnemiesInCone(JNIEnv *env, jobject self, jlong actor, jlong coneCenterObjectId, jlong coneDirectionObjectId, jfloat range, jfloat angle) { @@ -853,7 +853,7 @@ jlongArray JNICALL ScriptMethodsPvpNamespace::pvpGetEnemiesInCone(JNIEnv *env, j * @param angle The cone angle, in degrees, that the cone sweeps out. The * total cone angle is twice this angle; therefore, this angle * represents the angle swept out to each side of the cone axis. - * @return null if there is an error, or an array of enemy objects which are in range. + * @return nullptr if there is an error, or an array of enemy objects which are in range. */ jlongArray JNICALL ScriptMethodsPvpNamespace::pvpGetEnemiesInConeLocation(JNIEnv *env, jobject self, jlong actor, jlong coneCenterObjectId, jobject coneDirectionLocation, jfloat range, jfloat angle) { @@ -900,7 +900,7 @@ jlongArray JNICALL ScriptMethodsPvpNamespace::pvpGetEnemiesInConeLocation(JNIEnv * @param actor The actor for the canAttack check * @param from The center of the range * @param range The distance to query. - * @return null if there is an error, or an array of attackable objects which are in range. + * @return nullptr if there is an error, or an array of attackable objects which are in range. */ jlongArray JNICALL ScriptMethodsPvpNamespace::pvpGetTargetsInRange(JNIEnv *env, jobject self, jlong actor, jlong location, jfloat range) { @@ -951,7 +951,7 @@ jlongArray JNICALL ScriptMethodsPvpNamespace::pvpGetTargetsInRange(JNIEnv *env, * @param angle The cone angle, in degrees, that the cone sweeps out. The * total cone angle is twice this angle; therefore, this angle * represents the angle swept out to each side of the cone axis. - * @return null if there is an error, or an array of attackable objects which are in range. + * @return nullptr if there is an error, or an array of attackable objects which are in range. */ jlongArray JNICALL ScriptMethodsPvpNamespace::pvpGetTargetsInCone(JNIEnv *env, jobject self, jlong actor, jlong coneCenterObjectId, jlong coneDirectionObjectId, jfloat range, jfloat angle) { @@ -1005,7 +1005,7 @@ jlongArray JNICALL ScriptMethodsPvpNamespace::pvpGetTargetsInCone(JNIEnv *env, j * @param angle The cone angle, in degrees, that the cone sweeps out. The * total cone angle is twice this angle; therefore, this angle * represents the angle swept out to each side of the cone axis. - * @return null if there is an error, or an array of attackable objects which are in range. + * @return nullptr if there is an error, or an array of attackable objects which are in range. */ jlongArray JNICALL ScriptMethodsPvpNamespace::pvpGetTargetsInConeLocation(JNIEnv *env, jobject self, jlong actor, jlong coneCenterObjectId, jobject coneDirectionLocation, jfloat range, jfloat angle) { diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsQuest.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsQuest.cpp index 43d65ff7..ea237c93 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsQuest.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsQuest.cpp @@ -35,7 +35,7 @@ namespace ScriptMethodsQuestNamespace { PlayerObject * getPlayerForCharacter(jlong playerCreatureId) { - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (JavaLibrary::getObject(playerCreatureId, playerCreature)) { return PlayerCreatureController::getPlayerObject(playerCreature); @@ -44,7 +44,7 @@ namespace ScriptMethodsQuestNamespace { NetworkId id(playerCreatureId); JAVA_THROW_SCRIPT_EXCEPTION(true, ("Requested player %s, who could not be found.", id.getValueString().c_str())); - return NULL; + return nullptr; } } @@ -397,8 +397,8 @@ void JNICALL ScriptMethodsQuestNamespace::questSetQuestTaskCounter(JNIEnv *env, } PlayerObject * const playerObject = getPlayerForCharacter(playerId); - CreatureObject * const creatureObject = playerObject ? playerObject->getCreatureObject() : NULL; - Controller * const controller = creatureObject ? creatureObject->getController() : NULL; + CreatureObject * const creatureObject = playerObject ? playerObject->getCreatureObject() : nullptr; + Controller * const controller = creatureObject ? creatureObject->getController() : nullptr; if(!controller) return; @@ -427,8 +427,8 @@ void JNICALL ScriptMethodsQuestNamespace::questSetQuestTaskLocation(JNIEnv *env, } PlayerObject * const playerObject = getPlayerForCharacter(playerId); - CreatureObject * const creatureObject = playerObject ? playerObject->getCreatureObject() : NULL; - Controller * const controller = creatureObject ? creatureObject->getController() : NULL; + CreatureObject * const creatureObject = playerObject ? playerObject->getCreatureObject() : nullptr; + Controller * const controller = creatureObject ? creatureObject->getController() : nullptr; if(!controller) return; @@ -456,8 +456,8 @@ void JNICALL ScriptMethodsQuestNamespace::questSetQuestTaskTimer(JNIEnv *env, jo } PlayerObject * const playerObject = getPlayerForCharacter(playerId); - CreatureObject * const creatureObject = playerObject ? playerObject->getCreatureObject() : NULL; - Controller * const controller = creatureObject ? creatureObject->getController() : NULL; + CreatureObject * const creatureObject = playerObject ? playerObject->getCreatureObject() : nullptr; + Controller * const controller = creatureObject ? creatureObject->getController() : nullptr; if(!controller) return; @@ -487,7 +487,7 @@ void JNICALL ScriptMethodsQuestNamespace::requestActivateQuest(JNIEnv * env, job return; } - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (JavaLibrary::getObject(playerId, playerCreature) && playerCreature) { Quest const * const q = QuestManager::getQuest(questCrc); @@ -557,7 +557,7 @@ void JNICALL ScriptMethodsQuestNamespace::requestCompleteQuest(JNIEnv * env, job return; } - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (JavaLibrary::getObject(playerId, playerCreature) && playerCreature) { Quest const * const q = QuestManager::getQuest(questCrc); @@ -576,14 +576,14 @@ void JNICALL ScriptMethodsQuestNamespace::showCyberneticsPage(JNIEnv *env, jobje { MessageQueueCyberneticsOpen::OpenType const type = static_cast(openType); - CreatureObject * npc = NULL; + CreatureObject * npc = nullptr; if (!JavaLibrary::getObject(npcId, npc)) return; if(!npc) return; - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (JavaLibrary::getObject(playerId, playerCreature)) { Controller * const playerController = playerCreature->getController(); @@ -659,7 +659,7 @@ void JNICALL ScriptMethodsQuestNamespace::sendStaticItemDataToPlayer(JNIEnv *env } //send to player - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (JavaLibrary::getObject(playerId, playerCreature)) { Controller * const playerController = playerCreature->getController(); @@ -683,7 +683,7 @@ void JNICALL ScriptMethodsQuestNamespace::showLootBox(JNIEnv *env, jobject self, return; //send to player - CreatureObject * playerCreature = NULL; + CreatureObject * playerCreature = nullptr; if (JavaLibrary::getObject(playerId, playerCreature)) { Controller * const playerController = playerCreature->getController(); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsRegion.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsRegion.cpp index 9a393578..d028ee48 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsRegion.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsRegion.cpp @@ -115,7 +115,7 @@ LocalObjectArrayRefPtr ScriptMethodsRegionNamespace::_getRegionsAtPoint(jobject std::vector result; RegionMaster::getRegionsAtPoint(sceneId, locationVec.x, locationVec.z, result); - //-- return null instead of a zero-length array + //-- return nullptr instead of a zero-length array if (result.empty ()) return LocalObjectArrayRef::cms_nullPtr; @@ -127,7 +127,7 @@ LocalObjectArrayRefPtr ScriptMethodsRegionNamespace::_getRegionsAtPoint(jobject { LocalRefPtr javaRegion; const Region * r = *it; - if (r != NULL) + if (r != nullptr) { if (!ScriptConversion::convert(*r, javaRegion)) return LocalObjectArrayRef::cms_nullPtr; @@ -195,7 +195,7 @@ void JNICALL ScriptMethodsRegionNamespace::createCircleRegion(JNIEnv *env, jobje UNREF(self); // validate scripter's input - if (center == NULL || radius <= 0 || name == 0) + if (center == nullptr || radius <= 0 || name == 0) return; JavaStringParam jname(name); @@ -239,7 +239,7 @@ jobject JNICALL ScriptMethodsRegionNamespace::getRegion(JNIEnv *env, jobject sel return 0; const Region * r = RegionMaster::getRegionByName(planetName, regionName); - if (r == NULL) + if (r == nullptr) return 0; LocalRefPtr jr; @@ -255,7 +255,7 @@ jobject JNICALL ScriptMethodsRegionNamespace::getRegion(JNIEnv *env, jobject sel jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsAtPoint(JNIEnv *env, jobject self, jobject location) { LocalObjectArrayRefPtr regions = _getRegionsAtPoint(location); - if (regions.get() == NULL) + if (regions.get() == nullptr) return 0; return regions->getReturnValue(); } @@ -279,9 +279,9 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegions(JNIEnv *env, jobje std::vector result; RegionMaster::getRegionsForPlanet(sceneId, result); - //-- return null instead of a zero-length array + //-- return nullptr instead of a zero-length array if (result.empty ()) - return NULL; + return nullptr; //put them into the jobjectarray LocalObjectArrayRefPtr regions = createNewObjectArray(result.size(), JavaLibrary::getClsRegion()); @@ -291,11 +291,11 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegions(JNIEnv *env, jobje { LocalRefPtr javaRegion; const Region * r = *i; - if (r != NULL) + if (r != nullptr) { if (!ScriptConversion::convert(*r, javaRegion)) { - return NULL; + return nullptr; } } setObjectArrayElement(*regions, index, *javaRegion); @@ -329,7 +329,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithPvP(JNIEnv *env goodRegions.push_back(*i); } - //-- return null instead of a zero-length array + //-- return nullptr instead of a zero-length array if (goodRegions.empty()) return 0; @@ -342,7 +342,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithPvP(JNIEnv *env LocalRefPtr javaRegion; if (!ScriptConversion::convert(**it, javaRegion)) { - return NULL; + return nullptr; } setObjectArrayElement(*result, index, *javaRegion); } @@ -375,7 +375,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithBuildable(JNIEn goodRegions.push_back(*i); } - //-- return null instead of a zero-length array + //-- return nullptr instead of a zero-length array if (goodRegions.empty()) return 0; @@ -388,7 +388,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithBuildable(JNIEn LocalRefPtr javaRegion; if (!ScriptConversion::convert(**it, javaRegion)) { - return NULL; + return nullptr; } setObjectArrayElement(*result, index, *javaRegion); } @@ -421,7 +421,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithMunicipal(JNIEn goodRegions.push_back(*i); } - //-- return null instead of a zero-length array + //-- return nullptr instead of a zero-length array if (goodRegions.empty()) return 0; @@ -434,7 +434,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithMunicipal(JNIEn LocalRefPtr javaRegion; if (!ScriptConversion::convert(**it, javaRegion)) { - return NULL; + return nullptr; } setObjectArrayElement(*result, index, *javaRegion); } @@ -467,7 +467,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithGeographical(JN goodRegions.push_back(*i); } - //-- return null instead of a zero-length array + //-- return nullptr instead of a zero-length array if (goodRegions.empty()) return 0; @@ -480,7 +480,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithGeographical(JN LocalRefPtr javaRegion; if (!ScriptConversion::convert(**it, javaRegion)) { - return NULL; + return nullptr; } setObjectArrayElement(*result, index, *javaRegion); } @@ -513,7 +513,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithDifficulty(JNIE goodRegions.push_back(*i); } - //-- return null instead of a zero-length array + //-- return nullptr instead of a zero-length array if (goodRegions.empty()) return 0; @@ -526,7 +526,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithDifficulty(JNIE LocalRefPtr javaRegion; if (!ScriptConversion::convert(**it, javaRegion)) { - return NULL; + return nullptr; } setObjectArrayElement(*result, index, *javaRegion); } @@ -559,7 +559,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithSpawnable(JNIEn goodRegions.push_back(*i); } - //-- return null instead of a zero-length array + //-- return nullptr instead of a zero-length array if (goodRegions.empty()) return 0; @@ -572,7 +572,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithSpawnable(JNIEn LocalRefPtr javaRegion; if (!ScriptConversion::convert(**it, javaRegion)) { - return NULL; + return nullptr; } setObjectArrayElement(*result, index, *javaRegion); } @@ -605,7 +605,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithMission(JNIEnv goodRegions.push_back(*i); } - //-- return null instead of a zero-length array + //-- return nullptr instead of a zero-length array if (goodRegions.empty()) return 0; @@ -618,7 +618,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithMission(JNIEnv LocalRefPtr javaRegion; if (!ScriptConversion::convert(**it, javaRegion)) { - return NULL; + return nullptr; } setObjectArrayElement(*result, index, *javaRegion); } @@ -657,7 +657,7 @@ jboolean JNICALL ScriptMethodsRegionNamespace::deleteRegion(JNIEnv *env, jobject return JNI_FALSE; UniverseObject * regionObject = dynamic_cast(r->getDynamicRegionId().getObject()); - if (regionObject == NULL) + if (regionObject == nullptr) return JNI_FALSE; regionObject->permanentlyDestroy(DeleteReasons::Script); return JNI_TRUE; @@ -711,7 +711,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionExtent(JNIEnv *env, //----------------------------------------------------------------------- /** Find a random point in the given region - * @return a script.location inside the region, or a null reference if any problems occur + * @return a script.location inside the region, or a nullptr reference if any problems occur */ jobject JNICALL ScriptMethodsRegionNamespace::findPointInRegion(JNIEnv *env, jobject self, jobject region) { @@ -732,7 +732,7 @@ jobject JNICALL ScriptMethodsRegionNamespace::findPointInRegion(JNIEnv *env, job Vector loc3d(x, 0, z); LocalRefPtr location; if (!ScriptConversion::convert(loc3d, r->getPlanet(), NetworkId::cms_invalid, location)) - return NULL; + return nullptr; return location->getReturnValue(); } @@ -744,7 +744,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithPvPAtPoint(JNIE { //get all the regions at the given point LocalObjectArrayRefPtr regionsAtPoint = _getRegionsAtPoint(location); - if (regionsAtPoint.get() == NULL || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) + if (regionsAtPoint.get() == nullptr || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) return 0; //parse out the ones with the right property @@ -760,9 +760,9 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithPvPAtPoint(JNIE result.push_back(r); } - //-- return null instead of a zero-length array + //-- return nullptr instead of a zero-length array if (result.empty ()) - return NULL; + return nullptr; //put them into the jobjectarray LocalObjectArrayRefPtr regions = createNewObjectArray(result.size(), JavaLibrary::getClsRegion()); @@ -772,10 +772,10 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithPvPAtPoint(JNIE { LocalRefPtr javaRegion; const Region * r = *it; - if (r != NULL) + if (r != nullptr) { if (!ScriptConversion::convert(*r, javaRegion)) - return NULL; + return nullptr; } setObjectArrayElement(*regions, index, *javaRegion); } @@ -790,7 +790,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithBuildableAtPoin { //get all the regions at the given point LocalObjectArrayRefPtr regionsAtPoint = _getRegionsAtPoint(location); - if (regionsAtPoint.get() == NULL || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) + if (regionsAtPoint.get() == nullptr || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) return 0; //parse out the ones with the right property @@ -806,9 +806,9 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithBuildableAtPoin result.push_back(r); } - //-- return null instead of a zero-length array + //-- return nullptr instead of a zero-length array if (result.empty ()) - return NULL; + return nullptr; //put them into the jobjectarray LocalObjectArrayRefPtr regions = createNewObjectArray(result.size(), JavaLibrary::getClsRegion()); @@ -818,10 +818,10 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithBuildableAtPoin { LocalRefPtr javaRegion; const Region * r = *it; - if (r != NULL) + if (r != nullptr) { if(!ScriptConversion::convert(*r, javaRegion)) - return NULL; + return nullptr; } setObjectArrayElement(*regions, index, *javaRegion); } @@ -837,7 +837,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithMunicipalAtPoin PROFILER_AUTO_BLOCK_DEFINE("JNI::getRegionsWithMunicipalAtPoint"); //get all the regions at the given point LocalObjectArrayRefPtr regionsAtPoint = _getRegionsAtPoint(location); - if (regionsAtPoint.get() == NULL || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) + if (regionsAtPoint.get() == nullptr || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) return 0; //parse out the ones with the right property @@ -853,9 +853,9 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithMunicipalAtPoin result.push_back(r); } - //-- return null instead of a zero-length array + //-- return nullptr instead of a zero-length array if (result.empty ()) - return NULL; + return nullptr; //put them into the jobjectarray LocalObjectArrayRefPtr regions = createNewObjectArray(result.size(), JavaLibrary::getClsRegion()); @@ -865,10 +865,10 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithMunicipalAtPoin { LocalRefPtr javaRegion; const Region * r = *it; - if (r != NULL) + if (r != nullptr) { if(!ScriptConversion::convert(*r, javaRegion)) - return NULL; + return nullptr; } setObjectArrayElement(*regions, index, *javaRegion); } @@ -884,7 +884,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithGeographicalAtP PROFILER_AUTO_BLOCK_DEFINE("JNI::getRegionsWithGeographicalAtPoint"); //get all the regions at the given point LocalObjectArrayRefPtr regionsAtPoint = _getRegionsAtPoint(location); - if (regionsAtPoint.get() == NULL || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) + if (regionsAtPoint.get() == nullptr || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) return 0; //parse out the ones with the right property @@ -900,9 +900,9 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithGeographicalAtP result.push_back(r); } - //-- return null instead of a zero-length array + //-- return nullptr instead of a zero-length array if (result.empty ()) - return NULL; + return nullptr; //put them into the jobjectarray LocalObjectArrayRefPtr regions = createNewObjectArray(result.size(), JavaLibrary::getClsRegion()); @@ -912,10 +912,10 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithGeographicalAtP { LocalRefPtr javaRegion; const Region * r = *it; - if (r != NULL) + if (r != nullptr) { if(!ScriptConversion::convert(*r, javaRegion)) - return NULL; + return nullptr; } setObjectArrayElement(*regions, index, *javaRegion); } @@ -930,7 +930,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithDifficultyAtPoi { //get all the regions at the given point LocalObjectArrayRefPtr regionsAtPoint = _getRegionsAtPoint(location); - if (regionsAtPoint.get() == NULL || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) + if (regionsAtPoint.get() == nullptr || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) return 0; //parse out the ones with the right property @@ -946,9 +946,9 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithDifficultyAtPoi result.push_back(r); } - //-- return null instead of a zero-length array + //-- return nullptr instead of a zero-length array if (result.empty ()) - return NULL; + return nullptr; //put them into the jobjectarray LocalObjectArrayRefPtr regions = createNewObjectArray(result.size(), JavaLibrary::getClsRegion()); @@ -958,10 +958,10 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithDifficultyAtPoi { LocalRefPtr javaRegion; const Region * r = *it; - if (r != NULL) + if (r != nullptr) { if(!ScriptConversion::convert(*r, javaRegion)) - return NULL; + return nullptr; } setObjectArrayElement(*regions, index, *javaRegion); } @@ -976,7 +976,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithSpawnableAtPoin { //get all the regions at the given point LocalObjectArrayRefPtr regionsAtPoint = _getRegionsAtPoint(location); - if (regionsAtPoint.get() == NULL || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) + if (regionsAtPoint.get() == nullptr || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) return 0; //parse out the ones with the right property @@ -992,9 +992,9 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithSpawnableAtPoin result.push_back(r); } - //-- return null instead of a zero-length array + //-- return nullptr instead of a zero-length array if (result.empty ()) - return NULL; + return nullptr; //put them into the jobjectarray LocalObjectArrayRefPtr regions = createNewObjectArray(result.size(), JavaLibrary::getClsRegion()); @@ -1004,10 +1004,10 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithSpawnableAtPoin { LocalRefPtr javaRegion; const Region * r = *it; - if (r != NULL) + if (r != nullptr) { if(!ScriptConversion::convert(*r, javaRegion)) - return NULL; + return nullptr; } setObjectArrayElement(*regions, index, *javaRegion); } @@ -1022,7 +1022,7 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithMissionAtPoint( { //get all the regions at the given point LocalObjectArrayRefPtr regionsAtPoint = _getRegionsAtPoint(location); - if (regionsAtPoint.get() == NULL || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) + if (regionsAtPoint.get() == nullptr || regionsAtPoint == LocalObjectArrayRef::cms_nullPtr) return 0; //parse out the ones with the right property @@ -1038,9 +1038,9 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithMissionAtPoint( result.push_back(r); } - //-- return null instead of a zero-length array + //-- return nullptr instead of a zero-length array if (result.empty ()) - return NULL; + return nullptr; //put them into the jobjectarray LocalObjectArrayRefPtr regions = createNewObjectArray(result.size(), JavaLibrary::getClsRegion()); @@ -1050,10 +1050,10 @@ jobjectArray JNICALL ScriptMethodsRegionNamespace::getRegionsWithMissionAtPoint( { LocalRefPtr javaRegion; const Region * r = *it; - if (r != NULL) + if (r != nullptr) { if(!ScriptConversion::convert(*r, javaRegion)) - return NULL; + return nullptr; } setObjectArrayElement(*regions, index, *javaRegion); } @@ -1072,16 +1072,16 @@ jobject JNICALL ScriptMethodsRegionNamespace::getSmallestRegionAtPoint(JNIEnv *e Vector locationVec; std::string sceneId; if(!ScriptConversion::convertWorld(location, locationVec, sceneId)) - return NULL; + return nullptr; const Region * r = RegionMaster::getSmallestRegionAtPoint(sceneId, locationVec.x, locationVec.z); - if (r == NULL) - return NULL; + if (r == nullptr) + return nullptr; LocalRefPtr region; if (!ScriptConversion::convert(*r, region)) - return NULL; + return nullptr; return region->getReturnValue(); } @@ -1095,16 +1095,16 @@ jobject JNICALL ScriptMethodsRegionNamespace::getSmallestVisibleRegionAtPoint(JN Vector locationVec; std::string sceneId; if(!ScriptConversion::convertWorld(location, locationVec, sceneId)) - return NULL; + return nullptr; const Region * r = RegionMaster::getSmallestVisibleRegionAtPoint(sceneId, locationVec.x, locationVec.z); - if (r == NULL) - return NULL; + if (r == nullptr) + return nullptr; LocalRefPtr region; if (!ScriptConversion::convert(*r, region)) - return NULL; + return nullptr; return region->getReturnValue(); } @@ -1140,7 +1140,7 @@ jlong JNICALL ScriptMethodsRegionNamespace::createCircleRegionWithSpawn(JNIEnv * UNREF(self); // validate scripter's input - if (center == NULL || radius <= 0 || name == 0) + if (center == nullptr || radius <= 0 || name == 0) return 0; JavaStringParam jname(name); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsRegion3d.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsRegion3d.cpp index 37c9f942..6e209336 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsRegion3d.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsRegion3d.cpp @@ -87,7 +87,7 @@ struct Region3dPtrVolumeComparator ScriptParams *ScriptMethodsRegion3dNamespace::convertRegionDictionaryToScriptParams(jobject regionDictionary) { - // If we're passed a null dictionary, we just don't have any extra data but + // If we're passed a nullptr dictionary, we just don't have any extra data but // we still want to return a ScriptParams to fill in the standard values. if (!regionDictionary) return new ScriptParams; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsResource.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsResource.cpp index e908612c..04404908 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsResource.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsResource.cpp @@ -459,7 +459,7 @@ jstring JNICALL ScriptMethodsResourceNamespace::getResourceContainerForType(JNIE { ResourceTypeObject const * const typeObj = ServerUniverse::getInstance().getResourceTypeById(NetworkId(resourceType)); if (!typeObj) - return NULL; + return nullptr; std::string templateName; typeObj->getCrateTemplate(templateName); @@ -473,7 +473,7 @@ jstring JNICALL ScriptMethodsResourceNamespace::getResourceName(JNIEnv * /*env*/ { if (resourceType == 0) { - WARNING(true, ("JavaLibrary::getResourceName passed null resource type")); + WARNING(true, ("JavaLibrary::getResourceName passed nullptr resource type")); return 0; } @@ -494,7 +494,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::getResourceNames(JNIEnv *en { if (resourceTypes == 0) { - WARNING(true, ("JavaLibrary::getResourceNames passed null resource types")); + WARNING(true, ("JavaLibrary::getResourceNames passed nullptr resource types")); return 0; } @@ -517,7 +517,7 @@ jstring JNICALL ScriptMethodsResourceNamespace::getResourceClassName(JNIEnv *env { if (resourceClass == 0) { - WARNING(true, ("JavaLibrary::getResourceClassName passed null resource class")); + WARNING(true, ("JavaLibrary::getResourceClassName passed nullptr resource class")); return 0; } @@ -531,7 +531,7 @@ jstring JNICALL ScriptMethodsResourceNamespace::getResourceClassName(JNIEnv *env const ServerResourceClassObject * resClass = safe_cast( ServerUniverse::getInstance().getResourceClassByName(resourceClassName)); - if (resClass == NULL) + if (resClass == nullptr) { WARNING(true, ("JavaLibrary::getResourceClassName cannot find resource class for %s", resourceClassName.c_str())); return 0; @@ -547,7 +547,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::getResourceClassNames(JNIEn { if (resourceClasses == 0) { - WARNING(true, ("JavaLibrary::getResourceClassNames passed null resource classes")); + WARNING(true, ("JavaLibrary::getResourceClassNames passed nullptr resource classes")); return 0; } @@ -569,7 +569,7 @@ jlongArray JNICALL ScriptMethodsResourceNamespace::getResourceTypes(JNIEnv * env { if (resourceClass == 0) { - WARNING(true, ("JavaLibrary::getResourceTypes passed null resource class")); + WARNING(true, ("JavaLibrary::getResourceTypes passed nullptr resource class")); return 0; } @@ -583,7 +583,7 @@ jlongArray JNICALL ScriptMethodsResourceNamespace::getResourceTypes(JNIEnv * env const ServerResourceClassObject * resClass = safe_cast( ServerUniverse::getInstance().getResourceClassByName(resourceClassName)); - if (resClass == NULL) + if (resClass == nullptr) { WARNING(true, ("JavaLibrary::getResourceTypes cannot find resource class for %s", resourceClassName.c_str())); return 0; @@ -604,7 +604,7 @@ jlongArray JNICALL ScriptMethodsResourceNamespace::getResourceTypes(JNIEnv * env jlong jlongTmp; for (size_t i = 0; i < count; ++i) { - if (types[i] != NULL) + if (types[i] != nullptr) { jlongTmp = (types[i]->getNetworkId()).getValue(); setLongArrayRegion(*jtypes, i, 1, &jlongTmp); @@ -619,7 +619,7 @@ jstring JNICALL ScriptMethodsResourceNamespace::getResourceClass(JNIEnv * /*env* { if (resourceType == 0) { - WARNING(true, ("JavaLibrary::getResourceClass passed null resource type")); + WARNING(true, ("JavaLibrary::getResourceClass passed nullptr resource type")); return 0; } @@ -642,7 +642,7 @@ jstring JNICALL ScriptMethodsResourceNamespace::getResourceParentClass(JNIEnv * { if (resourceClass == 0) { - WARNING(true, ("JavaLibrary::getResourceParentClass passed null resource class")); + WARNING(true, ("JavaLibrary::getResourceParentClass passed nullptr resource class")); return 0; } @@ -655,14 +655,14 @@ jstring JNICALL ScriptMethodsResourceNamespace::getResourceParentClass(JNIEnv * } const ResourceClassObject * resClass = ServerUniverse::getInstance().getResourceClassByName(resourceClassName); - if (resClass == NULL) + if (resClass == nullptr) { WARNING(true, ("JavaLibrary::getResourceParentClass cannot find resource class for %s", resourceClassName.c_str())); return 0; } const ResourceClassObject * parentClass = resClass->getParent(); - if (parentClass == NULL) + if (parentClass == nullptr) return 0; JavaString parentClassName(parentClass->getResourceClassName()); @@ -675,7 +675,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::getResourceChildClasses(JNI { if (resourceClass == 0) { - WARNING(true, ("JavaLibrary::getResourceChildClasses passed null resource class")); + WARNING(true, ("JavaLibrary::getResourceChildClasses passed nullptr resource class")); return 0; } @@ -688,7 +688,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::getResourceChildClasses(JNI } const ResourceClassObject * resClass = ServerUniverse::getInstance().getResourceClassByName(resourceClassName); - if (resClass == NULL) + if (resClass == nullptr) { WARNING(true, ("JavaLibrary::getResourceChildClasses cannot find resource class for %s", resourceClassName.c_str())); return 0; @@ -701,7 +701,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::getResourceChildClasses(JNI LocalObjectArrayRefPtr childrenArray = createNewObjectArray(static_cast(count), JavaLibrary::getClsString()); for (size_t i = 0; i < count; ++i) { - if (children[i] != NULL) + if (children[i] != nullptr) { JavaString name(children[i]->getResourceClassName()); setObjectArrayElement(*childrenArray, static_cast(i), name); @@ -716,7 +716,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::getImmediateResourceChildCl { if (resourceClass == 0) { - WARNING(true, ("JavaLibrary::getImmediateResourceChildClasses passed null resource class")); + WARNING(true, ("JavaLibrary::getImmediateResourceChildClasses passed nullptr resource class")); return 0; } @@ -729,7 +729,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::getImmediateResourceChildCl } const ResourceClassObject * resClass = ServerUniverse::getInstance().getResourceClassByName(resourceClassName); - if (resClass == NULL) + if (resClass == nullptr) { WARNING(true, ("JavaLibrary::getImmediateResourceChildClasses cannot find resource class for %s", resourceClassName.c_str())); return 0; @@ -742,7 +742,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::getImmediateResourceChildCl LocalObjectArrayRefPtr childrenArray = createNewObjectArray(count, JavaLibrary::getClsString()); for (int i = 0; i < count; ++i) { - if (children[i] != NULL) + if (children[i] != nullptr) { JavaString name(children[i]->getResourceClassName()); setObjectArrayElement(*childrenArray, i, name); @@ -757,7 +757,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::getLeafResourceChildClasses { if (resourceClass == 0) { - WARNING(true, ("JavaLibrary::getLeafResourceChildClasses passed null resource class")); + WARNING(true, ("JavaLibrary::getLeafResourceChildClasses passed nullptr resource class")); return 0; } @@ -770,7 +770,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::getLeafResourceChildClasses } const ResourceClassObject * resClass = ServerUniverse::getInstance().getResourceClassByName(resourceClassName); - if (resClass == NULL) + if (resClass == nullptr) { WARNING(true, ("JavaLibrary::getLeafResourceChildClasses cannot find resource class for %s", resourceClassName.c_str())); return 0; @@ -783,7 +783,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::getLeafResourceChildClasses LocalObjectArrayRefPtr childrenArray = createNewObjectArray(count, JavaLibrary::getClsString()); for (int i = 0; i < count; ++i) { - if (children[i] != NULL) + if (children[i] != nullptr) { JavaString name(children[i]->getResourceClassName()); setObjectArrayElement(*childrenArray, i, name); @@ -798,7 +798,7 @@ jboolean JNICALL ScriptMethodsResourceNamespace::hasResourceType(JNIEnv *env, jo { if (resourceClass == 0) { - WARNING(true, ("JavaLibrary::hasResourceType passed null resource class")); + WARNING(true, ("JavaLibrary::hasResourceType passed nullptr resource class")); return JNI_FALSE; } @@ -811,7 +811,7 @@ jboolean JNICALL ScriptMethodsResourceNamespace::hasResourceType(JNIEnv *env, jo } ServerResourceClassObject const * const resClass = safe_cast(ServerUniverse::getInstance().getResourceClassByName(resourceClassName)); - if (resClass == NULL) + if (resClass == nullptr) { WARNING(true, ("JavaLibrary::hasResourceType cannot find resource class for %s", resourceClassName.c_str())); return JNI_FALSE; @@ -826,13 +826,13 @@ jlong JNICALL ScriptMethodsResourceNamespace::createResourceCrate(JNIEnv * /*env { if (resourceType == 0) { - WARNING(true, ("JavaLibrary::createResourceCrate passed null resource type")); + WARNING(true, ("JavaLibrary::createResourceCrate passed nullptr resource type")); return 0; } if (destination == 0) { - WARNING(true, ("JavaLibrary::createResourceCrate passed null destination")); + WARNING(true, ("JavaLibrary::createResourceCrate passed nullptr destination")); return 0; } @@ -849,7 +849,7 @@ jlong JNICALL ScriptMethodsResourceNamespace::createResourceCrate(JNIEnv * /*env return 0; } - ServerObject * container = NULL; + ServerObject * container = nullptr; if (!JavaLibrary::getObject(destination, container)) { WARNING(true, ("JavaLibrary::createResourceCrate cannot find destination object")); @@ -860,14 +860,14 @@ jlong JNICALL ScriptMethodsResourceNamespace::createResourceCrate(JNIEnv * /*env rt->getCrateTemplate(crateTemplateName); ServerObject * object = ServerWorld::createNewObject(crateTemplateName, *container, true); - if (object == NULL) + if (object == nullptr) { WARNING(true, ("JavaLibrary::createResourceCrate cannot create crate from template %s", crateTemplateName.c_str())); return 0; } ResourceContainerObject * crate = dynamic_cast(object); - if (crate == NULL) + if (crate == nullptr) { IGNORE_RETURN(object->permanentlyDestroy(DeleteReasons::SetupFailed)); WARNING(true, ("JavaLibrary::createResourceCrate crate %s is not a resource container", crateTemplateName.c_str())); @@ -888,13 +888,13 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::requestResourceList(JNIEnv { if (loc == 0) { - WARNING(true, ("JavaLibrary::requestResourceList passed null location")); + WARNING(true, ("JavaLibrary::requestResourceList passed nullptr location")); return 0; } if (resourceClass == 0) { - WARNING(true, ("JavaLibrary::requestResourceList passed null resource class")); + WARNING(true, ("JavaLibrary::requestResourceList passed nullptr resource class")); return 0; } @@ -921,7 +921,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::requestResourceList(JNIEnv const Vector & locationPos = location.getCoordinates(); const PlanetObject * planet = ServerUniverse::getInstance().getPlanetByName(location.getSceneId()); - if (planet == NULL) + if (planet == nullptr) { WARNING(true, ("JavaLibrary::requestResourceList cannot find planet %s", location.getSceneId())); return 0; @@ -929,7 +929,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::requestResourceList(JNIEnv // get the resource class and all its children ServerResourceClassObject const * const resClass = safe_cast(ServerUniverse::getInstance().getResourceClassByName(resourceClassName)); - if (resClass == NULL) + if (resClass == nullptr) { WARNING(true, ("JavaLibrary::requestResourceList cannot find resource class %s", resourceClassName.c_str())); return 0; @@ -951,7 +951,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::requestResourceList(JNIEnv if (!(*i)->isDepleted()) { ResourcePoolObject const * const pool = (*i)->getPoolForPlanet(*planet); - if (pool != NULL) + if (pool != nullptr) { float density = pool->getEfficiencyAtLocation(locationPos.x, locationPos.z); if (density >= minDensity && density <= maxDensity) @@ -1049,7 +1049,7 @@ jobjectArray JNICALL ScriptMethodsResourceNamespace::getScaledResourceAttributes return 0; } ServerResourceClassObject const * const resClass = safe_cast(ServerUniverse::getInstance().getResourceClassByName(resourceClassName)); - if (resClass == NULL) + if (resClass == nullptr) { WARNING(true, ("JavaLibrary::getScaledResourceAttributes cannot find resource class %s", resourceClassName.c_str())); return 0; @@ -1152,7 +1152,7 @@ jint JNICALL ScriptMethodsResourceNamespace::getResourceAttribute(JNIEnv * /*env if (resourceType == 0) { - WARNING(true, ("JavaLibrary::getResourceAttribute passed null resource type")); + WARNING(true, ("JavaLibrary::getResourceAttribute passed nullptr resource type")); return -1; } @@ -1171,7 +1171,7 @@ jint JNICALL ScriptMethodsResourceNamespace::getResourceAttribute(JNIEnv * /*env jlong JNICALL ScriptMethodsResourceNamespace::getRecycledVersionOfResourceType(JNIEnv * /*env*/, jobject /*self*/, jlong resourceType) { ResourceTypeObject const * const resourceTypeObject = ServerUniverse::getInstance().getResourceTypeById(NetworkId(resourceType)); - ResourceTypeObject const * const recycledTypeObject = resourceTypeObject ? resourceTypeObject->getRecycledVersion() : NULL; + ResourceTypeObject const * const recycledTypeObject = resourceTypeObject ? resourceTypeObject->getRecycledVersion() : nullptr; if (recycledTypeObject) return (recycledTypeObject->getNetworkId()).getValue(); else diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsScript.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsScript.cpp index 7d600707..a7e06d57 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsScript.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsScript.cpp @@ -121,7 +121,7 @@ jint JNICALL ScriptMethodsScriptNamespace::attachScript(JNIEnv *env, jobject sel return SCRIPT_OVERRIDE; GameScriptObject* scripts = object->getScriptObject(); - if (scripts == NULL) + if (scripts == nullptr) return SCRIPT_OVERRIDE; char buffer[MAX_SCRIPT_NAME_LEN]; @@ -162,7 +162,7 @@ jboolean JNICALL ScriptMethodsScriptNamespace::detachScript(JNIEnv *env, jobject return JNI_FALSE; GameScriptObject* scripts = object->getScriptObject(); - if (scripts == NULL) + if (scripts == nullptr) return JNI_FALSE; char buffer[MAX_SCRIPT_NAME_LEN]; @@ -192,7 +192,7 @@ jboolean JNICALL ScriptMethodsScriptNamespace::detachAllScripts(JNIEnv *env, job return JNI_FALSE; GameScriptObject* scriptObject = object->getScriptObject(); - if (scriptObject == NULL) + if (scriptObject == nullptr) return JNI_FALSE; std::vector scriptNames; @@ -230,7 +230,7 @@ jboolean JNICALL ScriptMethodsScriptNamespace::hasScript(JNIEnv *env, jobject se return JNI_FALSE; GameScriptObject* scripts = object->getScriptObject(); - if (scripts == NULL) + if (scripts == nullptr) return JNI_FALSE; char buffer[MAX_SCRIPT_NAME_LEN]; @@ -325,7 +325,7 @@ jboolean JNICALL ScriptMethodsScriptNamespace::localMessageTo(JNIEnv *env, jobje else { GameScriptObject* scripts = object->getScriptObject(); - if (scripts == NULL) + if (scripts == nullptr) return JNI_FALSE; ScriptDictionaryPtr dictionary(new JavaDictionary(params)); @@ -400,7 +400,7 @@ jboolean JNICALL ScriptMethodsScriptNamespace::remoteMessageTo(JNIEnv *env, jobj * "messageTo" for players on the current planet * * If you want everyone on the planet to receive the message, -* specify null for loc and -1.0f for radius; otherwise, specify +* specify nullptr for loc and -1.0f for radius; otherwise, specify * a loc and a radius and only players on the planet within the * specified area will receive the message */ @@ -447,7 +447,7 @@ jint JNICALL ScriptMethodsScriptNamespace::remoteMessageToCalendarTimeDayOfWeek( return -1; // calculate the absolute time when the messageTo should go off - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); time_t const timeTarget = CalendarTime::getNextGMTTimeOcurrence(timeNow, dayOfWeek, hour, minute, second); if ((timeTarget <= 0) || (timeTarget <= timeNow)) @@ -487,7 +487,7 @@ jint JNICALL ScriptMethodsScriptNamespace::remoteMessageToCalendarTimeDayOfMonth return -1; // calculate the absolute time when the messageTo should go off - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); time_t const timeTarget = CalendarTime::getNextGMTTimeOcurrence(timeNow, month, dayOfMonth, hour, minute, second); if ((timeTarget <= 0) || (timeTarget <= timeNow)) @@ -562,7 +562,7 @@ void JNICALL ScriptMethodsScriptNamespace::cancelRecurringMessageTo(JNIEnv *env, // returns -1 if object doesn't have the messageTo jint JNICALL ScriptMethodsScriptNamespace::timeUntilMessageTo(JNIEnv *env, jobject self, jlong object, jstring methodName) { - ServerObject const * so = NULL; + ServerObject const * so = nullptr; if (!JavaLibrary::getObject(object, so)) return -1; @@ -606,7 +606,7 @@ jint JNICALL ScriptMethodsScriptNamespace::getCalendarTimeSeconds(JNIEnv * env, if(env == 0) return 0; - return ::time(NULL); + return ::time(nullptr); } //----------------------------------------------------------------------- @@ -616,7 +616,7 @@ jint JNICALL ScriptMethodsScriptNamespace::getCalendarTimeSeconds2(JNIEnv * env, if(env == 0) return -1; - time_t const rawtime = ::time(NULL); + time_t const rawtime = ::time(nullptr); struct tm * timeinfo = ::localtime(&rawtime); if (!timeinfo) return -1; @@ -678,7 +678,7 @@ jint JNICALL ScriptMethodsScriptNamespace::secondsUntilCalendarTimeDayOfWeek(JNI UNREF(self); // calculate the time between now and the specified time - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); time_t const timeTarget = CalendarTime::getNextGMTTimeOcurrence(timeNow, dayOfWeek, hour, minute, second); if ((timeTarget <= 0) || (timeTarget <= timeNow)) @@ -694,7 +694,7 @@ jint JNICALL ScriptMethodsScriptNamespace::secondsUntilCalendarTimeDayOfMonth(JN UNREF(self); // calculate the time between now and the specified time - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); time_t const timeTarget = CalendarTime::getNextGMTTimeOcurrence(timeNow, month, dayOfMonth, hour, minute, second); if ((timeTarget <= 0) || (timeTarget <= timeNow)) diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsServerUI.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsServerUI.cpp index db36bd13..c925aae3 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsServerUI.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsServerUI.cpp @@ -83,14 +83,14 @@ jint JNICALL ScriptMethodsServerUINamespace::createSuiPage(JNIEnv *env, jobject JavaStringParam localPageName(pageName); jint failureCode = -1; - ServerObject* owner = NULL; + ServerObject* owner = nullptr; if(!JavaLibrary::getObject(ownerobject, owner)) { WARNING(true, ("SUI: couldn't get owner ServerObject*, can't create a page")); return failureCode; } - ServerObject* so = NULL; + ServerObject* so = nullptr; if(!JavaLibrary::getObject(client, so)) return failureCode; @@ -296,7 +296,7 @@ jboolean JNICALL ScriptMethodsServerUINamespace::subscribeToSuiEvent(JNIEnv } std::string ewn; - if (eventWidgetName != NULL) + if (eventWidgetName != nullptr) { JavaStringParam localEventWidgetName(eventWidgetName); JavaLibrary::convert(localEventWidgetName, ewn); @@ -323,7 +323,7 @@ jboolean JNICALL ScriptMethodsServerUINamespace::subscribeToSuiPropertyForEv } std::string ewn; - if (eventWidgetName != NULL) + if (eventWidgetName != nullptr) { JavaStringParam localEventWidgetName(eventWidgetName); JavaLibrary::convert(localEventWidgetName, ewn); @@ -411,7 +411,7 @@ jboolean JNICALL ScriptMethodsServerUINamespace::setSuiAssociatedLocation(JN return JNI_FALSE; } - ServerObject* associatedObject = NULL; + ServerObject* associatedObject = nullptr; if(!JavaLibrary::getObject(j_associatedObjectId, associatedObject)) { DEBUG_WARNING(true, ("could not find object for associatedObjectid")); @@ -441,12 +441,12 @@ jboolean JNICALL ScriptMethodsServerUINamespace::setSuiMaxRangeToObject(JNIE jboolean JNICALL ScriptMethodsServerUINamespace::clientMinigameOpen(JNIEnv *env, jobject self, jlong player, jobject data) { - ServerObject* playerServerObject = NULL; + ServerObject* playerServerObject = nullptr; if(!JavaLibrary::getObject(player, playerServerObject)) return JNI_FALSE; CreatureObject * creatureObject = playerServerObject->asCreatureObject(); - if(creatureObject != NULL) + if(creatureObject != nullptr) { ValueDictionary gameData; JavaLibrary::convert(data, gameData); @@ -462,12 +462,12 @@ jboolean JNICALL ScriptMethodsServerUINamespace::clientMinigameOpen(JNIEnv *env, jboolean JNICALL ScriptMethodsServerUINamespace::clientMinigameClose(JNIEnv *env, jobject self, jlong player, jobject data) { - ServerObject* playerServerObject = NULL; + ServerObject* playerServerObject = nullptr; if(!JavaLibrary::getObject(player, playerServerObject)) return JNI_FALSE; CreatureObject * creatureObject = playerServerObject->asCreatureObject(); - if(creatureObject != NULL) + if(creatureObject != nullptr) { ValueDictionary gameData; JavaLibrary::convert(data, gameData); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsShip.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsShip.cpp index 8c40cd6c..4db4502b 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsShip.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsShip.cpp @@ -83,13 +83,13 @@ namespace ScriptMethodsShipNamespace { //-- Make sure ships are enabled if (!verifyShipsEnabled()) - return NULL; + return nullptr; char buf[256]; snprintf(buf, sizeof(buf), "JavaLibrary::%s: ship obj_id did not resolve to a ShipObject", functionName); ShipObject * const shipObject = JavaLibrary::getShipThrow(env, jobject_shipId, buf, throwIfNotOnServer); if (!shipObject) - return NULL; + return nullptr; if (chassisSlot != ShipChassisSlotType::SCST_num_types && !shipObject->isSlotInstalled(chassisSlot)) JAVA_THROW_SCRIPT_EXCEPTION(true, ("JavaLibrary::%s chassisSlot [%d] not installed", functionName, chassisSlot)); @@ -1115,17 +1115,17 @@ jstring JNICALL ScriptMethodsShipNamespace::getShipChassisType(JNIEnv * env, job { //-- Make sure ships are enabled if (!verifyShipsEnabled()) - return NULL; + return nullptr; ShipObject const * const shipObject = JavaLibrary::getShipThrow(env, jobject_shipId, "getShipChassisType(): shipId obj_id did not resolve to a ShipObject", false); if (!shipObject) - return NULL; + return nullptr; ShipChassis const * const shipChassis = ShipChassis::findShipChassisByCrc (shipObject->getChassisType()); if (shipChassis) return JavaString(shipChassis->getName ().getString ()).getReturnValue(); - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -1339,7 +1339,7 @@ jstring JNICALL ScriptMethodsShipNamespace::getShipComponentName(JNIEnv * env, j { ShipObject const * const shipObject = JavaLibrary::getShipThrow(env, jobject_shipId, "getShipComponentName() invalid ship", false); if (!shipObject) - return NULL; + return nullptr; Unicode::String const & name = shipObject->getComponentName(chassisSlot); if (!name.empty()) @@ -1918,9 +1918,9 @@ void JNICALL ScriptMethodsShipNamespace::setShipComponentName(JNIEnv * env, jobj if (!shipObject) return; - if (componentName == NULL) + if (componentName == nullptr) { - JAVA_THROW_SCRIPT_EXCEPTION(true, ("JavaLibrary::setShipComponentName (): null name")); + JAVA_THROW_SCRIPT_EXCEPTION(true, ("JavaLibrary::setShipComponentName (): nullptr name")); return; } @@ -2442,7 +2442,7 @@ jboolean JNICALL ScriptMethodsShipNamespace::shipCanInstallComponent(JNIEnv * en return false; TangibleObject * tangibleComponent = 0; - if (JavaLibrary::getObject (component, tangibleComponent) && tangibleComponent != NULL) + if (JavaLibrary::getObject (component, tangibleComponent) && tangibleComponent != nullptr) return shipObject->canInstallComponent(chassisSlot, *tangibleComponent); else { @@ -2481,7 +2481,7 @@ jboolean JNICALL ScriptMethodsShipNamespace::shipInstallComponent(JNIEnv * env, NetworkId installerId(jobject_installerId); TangibleObject * tangibleComponent = 0; - if (JavaLibrary::getObject (component, tangibleComponent) && tangibleComponent != NULL) + if (JavaLibrary::getObject (component, tangibleComponent) && tangibleComponent != nullptr) return shipObject->installComponent(installerId, chassisSlot, *tangibleComponent); else { @@ -2546,11 +2546,11 @@ jintArray JNICALL ScriptMethodsShipNamespace::getShipChassisSlots(JNIEnv * env, { //-- Make sure ships are enabled if (!verifyShipsEnabled()) - return NULL; + return nullptr; ShipObject const * const shipObject = JavaLibrary::getShipThrow(env, jobject_shipId, "getShipChassisSlots(): shipId obj_id did not resolve to a ShipObject", false); if (!shipObject) - return NULL; + return nullptr; ShipChassis const * const shipChassis = ShipChassis::findShipChassisByCrc (shipObject->getChassisType()); if (shipChassis) @@ -2571,7 +2571,7 @@ jintArray JNICALL ScriptMethodsShipNamespace::getShipChassisSlots(JNIEnv * env, } } - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -2585,7 +2585,7 @@ jint JNICALL ScriptMethodsShipNamespace::getShipComponentDescriptorType(JNIEnv * TangibleObject * tangibleComponent = 0; if (JavaLibrary::getObject (jobject_component, tangibleComponent)) { - if (tangibleComponent != NULL && tangibleComponent->getObjectTemplate () != NULL) + if (tangibleComponent != nullptr && tangibleComponent->getObjectTemplate () != nullptr) { ShipComponentDescriptor const * const shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByObjectTemplate (tangibleComponent->getObjectTemplate ()->getCrcName ().getCrc ()); @@ -2623,7 +2623,7 @@ jstring JNICALL ScriptMethodsShipNamespace::getShipComponentDescriptorTypeNam { //-- Make sure ships are enabled if (!verifyShipsEnabled()) - return NULL; + return nullptr; std::string const & typeName = ShipComponentType::getNameFromType(static_cast(componentType)); @@ -2641,7 +2641,7 @@ jint JNICALL ScriptMethodsShipNamespace::getShipComponentDescriptorCrc(JNI TangibleObject * tangibleComponent = 0; if (JavaLibrary::getObject (jobject_component, tangibleComponent)) { - if (tangibleComponent != NULL && tangibleComponent->getObjectTemplate () != NULL) + if (tangibleComponent != nullptr && tangibleComponent->getObjectTemplate () != nullptr) { ShipComponentDescriptor const * const shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByObjectTemplate (tangibleComponent->getObjectTemplate ()->getCrcName ().getCrc ()); @@ -2659,11 +2659,11 @@ jstring JNICALL ScriptMethodsShipNamespace::getShipComponentDescriptorCrcName { //-- Make sure ships are enabled if (!verifyShipsEnabled()) - return NULL; + return nullptr; ShipComponentDescriptor const * const shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByCrc(static_cast(componentCrc)); - if (shipComponentDescriptor == NULL) - return NULL; + if (shipComponentDescriptor == nullptr) + return nullptr; return JavaString(shipComponentDescriptor->getName().getString()).getReturnValue(); } @@ -2674,11 +2674,11 @@ jstring JNICALL ScriptMethodsShipNamespace::getShipComponentDescriptorCompati { //-- Make sure ships are enabled if (!verifyShipsEnabled()) - return NULL; + return nullptr; ShipComponentDescriptor const * const shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByCrc(static_cast(componentCrc)); - if (shipComponentDescriptor == NULL) - return NULL; + if (shipComponentDescriptor == nullptr) + return nullptr; return JavaString(shipComponentDescriptor->getCompatibility().getString()).getReturnValue(); } @@ -2776,15 +2776,15 @@ void JNICALL ScriptMethodsShipNamespace::notifyShipDamage(JNIEnv * env, jobject if (victimShipObject->isPlayerShip()) { //-- Get the attacker object. It can be any tangible object. - TangibleObject const * attackerTangibleObject = NULL; + TangibleObject const * attackerTangibleObject = nullptr; if (jobject_attacker) IGNORE_RETURN(JavaLibrary::getObject(jobject_attacker, attackerTangibleObject)); Controller * const victimShipController = victimShipObject->getController(); if (victimShipController) { - ShipDamageMessage shipDamage(attackerTangibleObject != NULL ? attackerTangibleObject->getNetworkId() : NetworkId::cms_invalid, - attackerTangibleObject != NULL ? attackerTangibleObject->getPosition_w() : victimShipObject->getPosition_w(), + ShipDamageMessage shipDamage(attackerTangibleObject != nullptr ? attackerTangibleObject->getNetworkId() : NetworkId::cms_invalid, + attackerTangibleObject != nullptr ? attackerTangibleObject->getPosition_w() : victimShipObject->getPosition_w(), totalDamage ); //lint -esym(429, damageMessage) @@ -3008,7 +3008,7 @@ jlong JNICALL ScriptMethodsShipNamespace::getDroidControlDeviceForShip(JNIEnv * NetworkId const & droidControlDeviceId = shipObject->getInstalledDroidControlDevice(); Object const * const droidControlDevice = NetworkIdManager::getObjectById(droidControlDeviceId); - ServerObject const * const serverDroidControlDevice = droidControlDevice ? droidControlDevice->asServerObject() : NULL; + ServerObject const * const serverDroidControlDevice = droidControlDevice ? droidControlDevice->asServerObject() : nullptr; if(!serverDroidControlDevice) return 0; else @@ -3050,7 +3050,7 @@ void JNICALL ScriptMethodsShipNamespace::commPlayers(JNIEnv *env, jobject /*self uint32 appearanceOverloadSharedTemplateCrc = 0; ObjectTemplate const * const ot = ObjectTemplateList::fetch(Unicode::wideToNarrow(appearanceOverloadServerTemplateWide)); - ServerObjectTemplate const * const sot = ot ? ot->asServerObjectTemplate() : NULL; + ServerObjectTemplate const * const sot = ot ? ot->asServerObjectTemplate() : nullptr; if(sot) { std::string const & sharedTemplateName = sot->getSharedTemplate(); @@ -3197,7 +3197,7 @@ jlong JNICALL ScriptMethodsShipNamespace::launchShipFromHangar(JNIEnv *env, jobj Transform const & finalCreateTransform = launchingShip->getTransform_o2p().rotateTranslate_l2p(finalHangarDelta_o); ServerObject * const newShip = ServerWorld::createNewObject(crcName.getCrc(), finalCreateTransform, cell, false); - if (newShip == NULL) + if (newShip == nullptr) return 0; // create an objId to return @@ -3223,7 +3223,7 @@ void JNICALL ScriptMethodsShipNamespace::handleShipDestruction(JNIEnv * en //convert ship ShipObject * const ship = JavaLibrary::getShipThrow(env, jship, "handleShipDestruction(): shipId obj_id did not resolve to a ShipObject", false); - if (ship == NULL) + if (ship == nullptr) return; DestroyShipMessage const msg(ship->getNetworkId(), severity); @@ -3401,7 +3401,7 @@ jfloat JNICALL ScriptMethodsShipNamespace::getShipInternalDamageOverTimeDamageRa return 0.0f; static ShipInternalDamageOverTime const * const idot = ShipInternalDamageOverTimeManager::findEntry(*ship, chassisSlot); - if (idot == NULL) + if (idot == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("JavaLibrary::getShipInternalDamageOverTimeDamageThreshold idot for [%s] slot [%d] not found", ship->getNetworkId().getValueString().c_str(), chassisSlot)); return 0.0f; @@ -3419,7 +3419,7 @@ jfloat JNICALL ScriptMethodsShipNamespace::getShipInternalDamageOverTimeDamageTh return 0.0f; static ShipInternalDamageOverTime const * const idot = ShipInternalDamageOverTimeManager::findEntry(*ship, chassisSlot); - if (idot == NULL) + if (idot == nullptr) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("JavaLibrary::getShipInternalDamageOverTimeDamageThreshold idot for [%s] slot [%d] not found", ship->getNetworkId().getValueString().c_str(), chassisSlot)); return 0.0f; @@ -3437,11 +3437,11 @@ jboolean JNICALL ScriptMethodsShipNamespace::hasShipInternalDamageOverTime(JNIEn //convert ship ShipObject * const ship = JavaLibrary::getShipThrow(env, jship, "hasShipInternalDamageOverTime(): shipId obj_id did not resolve to a ShipObject", false); - if (ship == NULL) + if (ship == nullptr) return false; static ShipInternalDamageOverTime const * const idot = ShipInternalDamageOverTimeManager::findEntry(*ship, chassisSlot); - return idot != NULL; + return idot != nullptr; } // ---------------------------------------------------------------------- @@ -3576,7 +3576,7 @@ jboolean JNICALL ScriptMethodsShipNamespace::shipIsInNebula(JNIEnv *env, jobject std::string nebulaName; - if (NULL != j_nebulaName) + if (nullptr != j_nebulaName) { JavaStringParam const jsp(j_nebulaName); if (!JavaLibrary::convert(jsp, nebulaName)) @@ -3593,7 +3593,7 @@ jboolean JNICALL ScriptMethodsShipNamespace::shipIsInNebula(JNIEnv *env, jobject { int const id = *it; Nebula const * const nebula = NebulaManager::getNebulaById(id); - if (NULL != nebula) + if (nullptr != nebula) { if (nebula->getName() == nebulaName) return JNI_TRUE; @@ -3637,7 +3637,7 @@ jboolean JNICALL ScriptMethodsShipNamespace::setShipWingName(JNIEnv * /*env*/, j jstring JNICALL ScriptMethodsShipNamespace::getShipWingName(JNIEnv * /*env*/, jobject /*self*/, jlong target) { - ServerObject const * object = NULL; + ServerObject const * object = nullptr; if (!JavaLibrary::getObject(target, object)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("JavaLibrary::getShipWingName (): could not convert the target")); @@ -3686,7 +3686,7 @@ jboolean JNICALL ScriptMethodsShipNamespace::setShipTypeName(JNIEnv * /*env*/, j jstring JNICALL ScriptMethodsShipNamespace::getShipTypeName(JNIEnv * /*env*/, jobject /*self*/, jlong target) { - ServerObject const * object = NULL; + ServerObject const * object = nullptr; if (!JavaLibrary::getObject(target, object)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("JavaLibrary::getShipTypeName (): could not convert the target")); @@ -3735,7 +3735,7 @@ jboolean JNICALL ScriptMethodsShipNamespace::setShipDifficulty(JNIEnv * /*env*/, jstring JNICALL ScriptMethodsShipNamespace::getShipDifficulty(JNIEnv * /*env*/, jobject /*self*/, jlong target) { - ServerObject const * object = NULL; + ServerObject const * object = nullptr; if (!JavaLibrary::getObject(target, object)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("JavaLibrary::getShipDifficulty (): could not convert the target")); @@ -3783,7 +3783,7 @@ jboolean JNICALL ScriptMethodsShipNamespace::setShipFaction(JNIEnv * /*env*/, jo jstring JNICALL ScriptMethodsShipNamespace::getShipFaction(JNIEnv * /*env*/, jobject /*self*/, jlong target) { - ServerObject const * object = NULL; + ServerObject const * object = nullptr; if (!JavaLibrary::getObject(target, object)) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("JavaLibrary::getShipFaction (): could not convert the target")); @@ -3871,7 +3871,7 @@ jboolean JNICALL ScriptMethodsShipNamespace::isMissionCriticalObject(JNIEnv * en if (!ship) { - JAVA_THROW_SCRIPT_EXCEPTION(true, ("isMissionCriticalObject(): playerId ship is null")); + JAVA_THROW_SCRIPT_EXCEPTION(true, ("isMissionCriticalObject(): playerId ship is nullptr")); return JNI_FALSE; } @@ -3973,7 +3973,7 @@ void JNICALL ScriptMethodsShipNamespace::setDynamicMiningAsteroidVelocity(JNIEnv } MiningAsteroidController * const miningAsteroidController = dynamic_cast(shipObject->getController()); - if (NULL == miningAsteroidController) + if (nullptr == miningAsteroidController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("setDynamicMiningAsteroidVelocity(): called on a ship which is not a dynamic mining asteroid")); return; @@ -3988,12 +3988,12 @@ jobject JNICALL ScriptMethodsShipNamespace::getDynamicMiningAsteroidVelocity(JNI { ShipObject * const shipObject = JavaLibrary::getShipThrow(env, jobject_asteroidId, "getDynamicMiningAsteroidVelocity(): shipId did not resolve to a ShipObject", false); if (!shipObject) - return NULL; + return nullptr; MiningAsteroidController * const miningAsteroidController = dynamic_cast(shipObject->getController()); - if (NULL == miningAsteroidController) + if (nullptr == miningAsteroidController) { JAVA_THROW_SCRIPT_EXCEPTION(true, ("setDynamicMiningAsteroidVelocity(): called on a ship which is not a dynamic mining asteroid")); - return NULL; + return nullptr; } Vector const & velocity_w = miningAsteroidController->getVelocity_w(); @@ -4073,7 +4073,7 @@ jlongArray JNICALL ScriptMethodsShipNamespace::getShipCargoHoldContentsResourceT { ShipObject const * const shipObject = getShipThrowTestSlot(env, jobject_shipId, "getShipCargoHoldContents()", false, static_cast(ShipChassisSlotType::SCST_cargo_hold)); if (!shipObject) - return NULL; + return nullptr; ShipObject::NetworkIdIntMap const & contents = shipObject->getCargoHoldContents(); @@ -4090,7 +4090,7 @@ jlongArray JNICALL ScriptMethodsShipNamespace::getShipCargoHoldContentsResourceT return jids->getReturnValue(); } - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -4099,7 +4099,7 @@ jintArray JNICALL ScriptMethodsShipNamespace::getShipCargoHoldContentsAmounts(JN { ShipObject const * const shipObject = getShipThrowTestSlot(env, jobject_shipId, "getShipCargoHoldContents()", false, static_cast(ShipChassisSlotType::SCST_cargo_hold)); if (!shipObject) - return NULL; + return nullptr; ShipObject::NetworkIdIntMap const & contents = shipObject->getCargoHoldContents(); @@ -4115,7 +4115,7 @@ jintArray JNICALL ScriptMethodsShipNamespace::getShipCargoHoldContentsAmounts(JN return jamounts->getReturnValue(); } - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -4125,9 +4125,9 @@ void JNICALL ScriptMethodsShipNamespace::openSpaceMiningUi(JNIEnv * env, jobject NetworkId const & playerId = NetworkId(jobject_player); NetworkId const & spaceStationId = NetworkId(jobject_spaceStation); - if (jstring_spaceStationName == NULL) + if (jstring_spaceStationName == nullptr) { - JAVA_THROW_SCRIPT_EXCEPTION(true, ("JavaLibrary::setShipComponentName (): null name")); + JAVA_THROW_SCRIPT_EXCEPTION(true, ("JavaLibrary::setShipComponentName (): nullptr name")); return; } @@ -4140,7 +4140,7 @@ void JNICALL ScriptMethodsShipNamespace::openSpaceMiningUi(JNIEnv * env, jobject } Object * const player = NetworkIdManager::getObjectById(playerId); - Controller * const controller = player ? player->getController(): NULL; + Controller * const controller = player ? player->getController(): nullptr; if (!controller) { diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsSkill.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsSkill.cpp index ae184f4b..07533c45 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsSkill.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsSkill.cpp @@ -276,7 +276,7 @@ jobjectArray JNICALL ScriptMethodsSkillNamespace::getSkillCommandsProvided(JNIEn const SkillObject * skill = getSkill(localSkillName); if(! skill) - return NULL; + return nullptr; LocalObjectArrayRefPtr strArray; if(! ScriptConversion::convert(skill->getCommandsProvided(), strArray)) @@ -293,7 +293,7 @@ jobject JNICALL ScriptMethodsSkillNamespace::getSkillPrerequisiteExperience(JNIE const SkillObject * skill = getSkill(localSkillName); if(! skill) - return NULL; + return nullptr; JavaDictionaryPtr dict; if (!JavaLibrary::convert(skill->getPrerequisiteExperienceVector(), dict)) @@ -334,7 +334,7 @@ jobjectArray JNICALL ScriptMethodsSkillNamespace::getSkillPrerequisiteSkills(JNI const SkillObject * skill = getSkill(localSkillName); if(! skill) - return NULL; + return nullptr; std::vector skillNames; std::vector::const_iterator i; @@ -358,7 +358,7 @@ jobject JNICALL ScriptMethodsSkillNamespace::getSkillPrerequisiteSpecies(JNIEnv const SkillObject * skill = getSkill(localSkillName); if(! skill) - return NULL; + return nullptr; JavaDictionaryPtr dict; if (!JavaLibrary::convert(skill->getPrerequisiteSpecies(), dict)) @@ -374,14 +374,14 @@ jstring JNICALL ScriptMethodsSkillNamespace::getSkillProfession(JNIEnv *env, job const SkillObject * const skill = getSkill(localSkillName); if(!skill) - return NULL; + return nullptr; const SkillObject * const prof = skill->findProfessionForSkill (); if(prof) { JavaString str(prof->getSkillName().c_str()); return str.getReturnValue(); } - return NULL; + return nullptr; } //----------------------------------------------------------------------- @@ -423,7 +423,7 @@ jobject JNICALL ScriptMethodsSkillNamespace::getSkillStatisticModifiers(JNIEnv * const SkillObject * skill = getSkill(localSkillName); if(! skill) - return NULL; + return nullptr; JavaDictionaryPtr dict; if (!JavaLibrary::convert(skill->getStatisticModifiers(), dict)) @@ -450,7 +450,7 @@ jint JNICALL ScriptMethodsSkillNamespace::getCreatureSkillStatisticModifier(JNIE JavaStringParam jskillStatName(skillStatName); - const CreatureObject * object = NULL; + const CreatureObject * object = nullptr; if (!JavaLibrary::getObject(creature, object)) return 0; @@ -472,7 +472,7 @@ jint JNICALL ScriptMethodsSkillNamespace::getCreatureSkillStatisticModifier(JNIE * @param creature the creature whose stat mod we want * @param skillStatNames array of names of the skill stat mods we want * - * @return the skill stat mod values, or null on error + * @return the skill stat mod values, or nullptr on error */ jintArray JNICALL ScriptMethodsSkillNamespace::getCreatureSkillStatisticModifiers(JNIEnv *env, jobject self, jlong creature, jobjectArray skillStatNames) { @@ -481,7 +481,7 @@ jintArray JNICALL ScriptMethodsSkillNamespace::getCreatureSkillStatisticModifier if (skillStatNames == 0) return 0; - const CreatureObject * object = NULL; + const CreatureObject * object = nullptr; if (!JavaLibrary::getObject(creature, object)) return 0; @@ -555,7 +555,7 @@ jint JNICALL ScriptMethodsSkillNamespace::internalGetCreatureEnhancedSkillStatis JavaStringParam jskillStatName(skillStatName); - const CreatureObject * object = NULL; + const CreatureObject * object = nullptr; if (!JavaLibrary::getObject(creature, object)) return 0; @@ -577,7 +577,7 @@ jint JNICALL ScriptMethodsSkillNamespace::internalGetCreatureEnhancedSkillStatis * @param creature the creature whose stat mod we want * @param skillStatNames array of names of the skill stat mods we want * - * @return the skill stat mod values, or null on error + * @return the skill stat mod values, or nullptr on error */ jintArray JNICALL ScriptMethodsSkillNamespace::internalGetCreatureEnhancedSkillStatisticModifiers(JNIEnv *env, jobject self, jlong creature, jobjectArray skillStatNames, jboolean useBonusCap) { @@ -586,7 +586,7 @@ jintArray JNICALL ScriptMethodsSkillNamespace::internalGetCreatureEnhancedSkillS if (skillStatNames == 0) return 0; - const CreatureObject * object = NULL; + const CreatureObject * object = nullptr; if (!JavaLibrary::getObject(creature, object)) return 0; @@ -621,7 +621,7 @@ jstring JNICALL ScriptMethodsSkillNamespace::getSkillTitleGranted(JNIEnv *env, j const SkillObject * const skill = getSkill(localSkillName); if(! skill) - return NULL; + return nullptr; if (skill->isTitle ()) return JavaString(skill->getSkillName ().c_str()).getReturnValue(); @@ -665,7 +665,7 @@ jint JNICALL ScriptMethodsSkillNamespace::grantExperiencePointsByString(JNIEnv * if(name.empty()) { // throw java exception - JavaLibrary::throwInternalScriptError("JavaLibrary::grantExperiencePoints() was passed an EMPTY or NULL experience name. This is probably not what the script intends to do, and the database cannot save unnamed XP. Change your script to ensure that it is calling grantExperiencePoints with the intended parameters."); + JavaLibrary::throwInternalScriptError("JavaLibrary::grantExperiencePoints() was passed an EMPTY or nullptr experience name. This is probably not what the script intends to do, and the database cannot save unnamed XP. Change your script to ensure that it is calling grantExperiencePoints with the intended parameters."); } else { @@ -675,7 +675,7 @@ jint JNICALL ScriptMethodsSkillNamespace::grantExperiencePointsByString(JNIEnv * WARNING(true, ("JavaLibrary::grantExperiencePointsByString called " "with target id = 0")); } - else if (targetId.getObject() == NULL) + else if (targetId.getObject() == nullptr) { if (NameManager::getInstance().getPlayerName(targetId).empty()) { @@ -683,7 +683,7 @@ jint JNICALL ScriptMethodsSkillNamespace::grantExperiencePointsByString(JNIEnv * "with target id = %s, who is not in the player name map", targetId.getValueString().c_str())); } -// else if (ServerUniverse::getInstance().getXpManager() != NULL) +// else if (ServerUniverse::getInstance().getXpManager() != nullptr) // { // ServerUniverse::getInstance().getXpManager()->grantXp(targetId, // name, amount); @@ -701,7 +701,7 @@ jint JNICALL ScriptMethodsSkillNamespace::grantExperiencePointsByString(JNIEnv * else { CreatureObject * creature = dynamic_cast(targetId.getObject()); - if (creature != NULL) + if (creature != nullptr) { result = creature->grantExperiencePoints(name, static_cast(amount)); } @@ -741,7 +741,7 @@ jint JNICALL ScriptMethodsSkillNamespace::grantExperiencePointsByInt(JNIEnv *env jint result = INT_MIN; CachedNetworkId targetId(target); - if (targetId.getObject() == NULL) + if (targetId.getObject() == nullptr) { if (targetId == CachedNetworkId::cms_cachedInvalid) { @@ -754,7 +754,7 @@ jint JNICALL ScriptMethodsSkillNamespace::grantExperiencePointsByInt(JNIEnv *env "with target id = %s, who is not in the player name map", targetId.getValueString().c_str())); } -// else if (ServerUniverse::getInstance().getXpManager() != NULL) +// else if (ServerUniverse::getInstance().getXpManager() != nullptr) // { // ServerUniverse::getInstance().getXpManager()->grantXp(targetId, // experienceTypeString, amount); @@ -772,7 +772,7 @@ jint JNICALL ScriptMethodsSkillNamespace::grantExperiencePointsByInt(JNIEnv *env else { CreatureObject * creature = dynamic_cast(targetId.getObject()); - if (creature != NULL) + if (creature != nullptr) { result = creature->grantExperiencePoints(experienceTypeString, static_cast(amount)); } @@ -977,7 +977,7 @@ jboolean JNICALL ScriptMethodsSkillNamespace::grantSchematicGroup(JNIEnv *env, j JavaStringParam groupNameParam(groupName); - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -1010,7 +1010,7 @@ jboolean JNICALL ScriptMethodsSkillNamespace::revokeSchematicGroup(JNIEnv *env, JavaStringParam groupNameParam(groupName); - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -1067,7 +1067,7 @@ jboolean JNICALL ScriptMethodsSkillNamespace::grantSchematicCrc(JNIEnv *env, job { UNREF(self); - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -1120,7 +1120,7 @@ jboolean JNICALL ScriptMethodsSkillNamespace::revokeSchematicCrc(JNIEnv *env, jo { UNREF(self); - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -1173,7 +1173,7 @@ jboolean JNICALL ScriptMethodsSkillNamespace::hasSchematicCrc(JNIEnv *env, jobje { UNREF(self); - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -1191,11 +1191,11 @@ jboolean JNICALL ScriptMethodsSkillNamespace::hasSchematicCrc(JNIEnv *env, jobje * @param self class calling this function * @param player the player * - * @return the skill mod names the player has, or null on error + * @return the skill mod names the player has, or nullptr on error */ jobjectArray JNICALL ScriptMethodsSkillNamespace::getSkillStatModListingForPlayer(JNIEnv *env, jobject self, jlong player) { - const CreatureObject * creature = NULL; + const CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(player, creature)) return 0; @@ -1221,11 +1221,11 @@ jobjectArray JNICALL ScriptMethodsSkillNamespace::getSkillStatModListingForPlaye * @param self class calling this function * @param player the player * - * @return the commands the player has, or null on error + * @return the commands the player has, or nullptr on error */ jobjectArray JNICALL ScriptMethodsSkillNamespace::getCommandListingForPlayer(JNIEnv *env, jobject self, jlong player) { - const CreatureObject * creature = NULL; + const CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(player, creature)) return 0; @@ -1261,7 +1261,7 @@ jintArray JNICALL ScriptMethodsSkillNamespace::getSkillSchematicsGranted(JNIEnv return 0; const SkillObject * skill = SkillManager::getInstance().getSkill(name); - if (skill == NULL) + if (skill == nullptr) return 0; // get all the granted schematics from the skill groups for the skill @@ -1304,11 +1304,11 @@ jintArray JNICALL ScriptMethodsSkillNamespace::getSkillSchematicsGranted(JNIEnv * @param self class calling this function * @param player the player * - * @return the schematics' crc, or null on error + * @return the schematics' crc, or nullptr on error */ jintArray JNICALL ScriptMethodsSkillNamespace::getSchematicListingForPlayer(JNIEnv *env, jobject self, jlong player) { - const CreatureObject * creature = NULL; + const CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(player, creature)) return 0; @@ -1335,7 +1335,7 @@ jintArray JNICALL ScriptMethodsSkillNamespace::getSchematicListingForPlayer(JNIE jboolean JNICALL ScriptMethodsSkillNamespace::hasCertificationsForItem(JNIEnv *env, jobject self, jlong player, jlong item) { - const CreatureObject * creatureObject = NULL; + const CreatureObject * creatureObject = nullptr; if (!JavaLibrary::getObject(player, creatureObject) || !creatureObject) return JNI_FALSE; @@ -1349,7 +1349,7 @@ jboolean JNICALL ScriptMethodsSkillNamespace::hasCertificationsForItem(JNIEnv *e } } - const TangibleObject * itemObject = NULL; + const TangibleObject * itemObject = nullptr; if (!JavaLibrary::getObject(item, itemObject) || !itemObject) return JNI_FALSE; @@ -1360,11 +1360,11 @@ jboolean JNICALL ScriptMethodsSkillNamespace::hasCertificationsForItem(JNIEnv *e jobjectArray JNICALL ScriptMethodsSkillNamespace::getRequiredCertifications(JNIEnv *env, jobject self, jlong item) { - const TangibleObject * itemAsTangible = NULL; + const TangibleObject * itemAsTangible = nullptr; if (!JavaLibrary::getObject(item, itemAsTangible) || !itemAsTangible) { JAVA_THROW_SCRIPT_EXCEPTION(true,("getRequiredCertifications called with an object that does not exist")); - return NULL; + return nullptr; } std::vector certs; @@ -1372,7 +1372,7 @@ jobjectArray JNICALL ScriptMethodsSkillNamespace::getRequiredCertifications(JNIE LocalObjectArrayRefPtr results; if (!ScriptConversion::convert(certs, results)) - return NULL; + return nullptr; return results->getReturnValue(); } @@ -1381,7 +1381,7 @@ jobjectArray JNICALL ScriptMethodsSkillNamespace::getRequiredCertifications(JNIE jstring JNICALL ScriptMethodsSkillNamespace::getSkillTemplate(JNIEnv *env, jobject self, jlong player) { - CreatureObject const * creature = NULL; + CreatureObject const * creature = nullptr; if (JavaLibrary::getObject(player, creature)) { @@ -1393,14 +1393,14 @@ jstring JNICALL ScriptMethodsSkillNamespace::getSkillTemplate(JNIEnv *env, jobje } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- void JNICALL ScriptMethodsSkillNamespace::setSkillTemplate(JNIEnv *env, jobject self, jlong player, jstring skillTemplateName) { - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (JavaLibrary::getObject(player, creature)) { @@ -1422,7 +1422,7 @@ void JNICALL ScriptMethodsSkillNamespace::setSkillTemplate(JNIEnv *env, jobject jstring JNICALL ScriptMethodsSkillNamespace::getWorkingSkill(JNIEnv *env, jobject self, jlong player) { - CreatureObject const * creature = NULL; + CreatureObject const * creature = nullptr; if (JavaLibrary::getObject(player, creature)) { @@ -1435,14 +1435,14 @@ jstring JNICALL ScriptMethodsSkillNamespace::getWorkingSkill(JNIEnv *env, jobjec } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- void JNICALL ScriptMethodsSkillNamespace::setWorkingSkill(JNIEnv *env, jobject self, jlong player, jstring workingSkillName) { - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (JavaLibrary::getObject(player, creature)) { @@ -1464,7 +1464,7 @@ void JNICALL ScriptMethodsSkillNamespace::setWorkingSkill(JNIEnv *env, jobject s void JNICALL ScriptMethodsSkillNamespace::recomputeCommandSeries(JNIEnv *env, jobject self, jlong player) { - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (JavaLibrary::getObject(player, creature)) { @@ -1476,7 +1476,7 @@ void JNICALL ScriptMethodsSkillNamespace::recomputeCommandSeries(JNIEnv *env, jo void JNICALL ScriptMethodsSkillNamespace::resetExpertises(JNIEnv *env, jobject self, jlong player) { - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (JavaLibrary::getObject(player, creature)) { diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsString.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsString.cpp index 344f0207..cb7135e7 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsString.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsString.cpp @@ -56,7 +56,7 @@ const JNINativeMethod NATIVES[] = { * @param self class calling this function * @param id the stringId to find * - * @return the string, or null on error + * @return the string, or nullptr on error */ jstring JNICALL ScriptMethodsStringNamespace::getString(JNIEnv *env, jobject self, jobject id) { @@ -64,7 +64,7 @@ jstring JNICALL ScriptMethodsStringNamespace::getString(JNIEnv *env, jobject sel if (id == 0) { - WARNING(true, ("JavaLibrary::log getString is NULL.")); + WARNING(true, ("JavaLibrary::log getString is nullptr.")); return 0; } @@ -116,7 +116,7 @@ jstring JNICALL ScriptMethodsStringNamespace::getString(JNIEnv *env, jobject sel * @param self class calling this function * @param ids array of stringIds to find * - * @return an array of strings, or null on error + * @return an array of strings, or nullptr on error */ jobjectArray JNICALL ScriptMethodsStringNamespace::getStrings(JNIEnv *env, jobject self, jobjectArray ids) { diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsSystem.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsSystem.cpp index 90861085..7dda71ba 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsSystem.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsSystem.cpp @@ -61,7 +61,7 @@ jboolean JNICALL ScriptMethodsSystemNamespace::sendConsoleCommand(JNIEnv * env, { JavaStringParam localCommand(command); - ServerObject* object = NULL; + ServerObject* object = nullptr; if (!JavaLibrary::getObject(target, object)) return JNI_FALSE; @@ -86,7 +86,7 @@ jboolean JNICALL ScriptMethodsSystemNamespace::sendConsoleCommand(JNIEnv * env, * @param section the config file section * @param key the config file key * - * @return the key value, or null if the key doesn't exist + * @return the key value, or nullptr if the key doesn't exist */ jstring JNICALL ScriptMethodsSystemNamespace::getConfigSetting(JNIEnv * env, jobject self, jstring section, jstring key) @@ -108,12 +108,12 @@ jstring JNICALL ScriptMethodsSystemNamespace::getConfigSetting(JNIEnv * env, job return 0; const ConfigFile::Section * sec = ConfigFile::getSection(sectionName.c_str()); - if (sec == NULL) + if (sec == nullptr) return 0; const ConfigFile::Key * ky = sec->findKey(keyName.c_str()); - if (ky == NULL) - return NULL; + if (ky == nullptr) + return nullptr; JavaString jvalue(ky->getAsString(ky->getCount()-1, "")); return jvalue.getReturnValue(); diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsTerrain.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsTerrain.cpp index c56803c1..fabb32f6 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsTerrain.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsTerrain.cpp @@ -165,16 +165,16 @@ jobject JNICALL ScriptMethodsTerrainNamespace::getGoodLocation(JNIEnv * /*env*/, PROFILER_AUTO_BLOCK_DEFINE("JNI::getGoodLocation"); //validate scripter's input - if (searchRectLowerLeftLocation == NULL) + if (searchRectLowerLeftLocation == nullptr) { - DEBUG_WARNING (true, ("getGoodLocation (): DB lower left is NULL")); - return NULL; + DEBUG_WARNING (true, ("getGoodLocation (): DB lower left is nullptr")); + return nullptr; } - if (searchRectUpperRightLocation == NULL) + if (searchRectUpperRightLocation == nullptr) { - DEBUG_WARNING (true, ("getGoodLocation (): DB upper right is NULL")); - return NULL; + DEBUG_WARNING (true, ("getGoodLocation (): DB upper right is nullptr")); + return nullptr; } //pull the data from the java Location objects. sceneid and cell are not checked or used, but sent back in the good location, if one exists @@ -184,14 +184,14 @@ jobject JNICALL ScriptMethodsTerrainNamespace::getGoodLocation(JNIEnv * /*env*/, if (!ScriptConversion::convertWorld(searchRectLowerLeftLocation, srLLLocationVec, sceneId)) { DEBUG_WARNING (true, ("getGoodLocation (): DB could not convert lower left coordinates")); - return NULL; + return nullptr; } Vector srURLocationVec; if (!ScriptConversion::convertWorld(searchRectUpperRightLocation, srURLocationVec, sceneId)) { DEBUG_WARNING (true, ("getGoodLocation (): DB could not convert upper right coordinates")); - return NULL; + return nullptr; } // get the good location from ServerWorld @@ -199,7 +199,7 @@ jobject JNICALL ScriptMethodsTerrainNamespace::getGoodLocation(JNIEnv * /*env*/, if (successLoc3d.x == 0 && successLoc3d.y == 0 && successLoc3d.z == 0) { // no good location available - return NULL; + return nullptr; } //convert it back into scripter lingo (a "location"), using the default scene and cell ids @@ -207,7 +207,7 @@ jobject JNICALL ScriptMethodsTerrainNamespace::getGoodLocation(JNIEnv * /*env*/, if (!ScriptConversion::convert(successLoc3d, sceneId, NetworkId(), goodLocation)) { DEBUG_WARNING (true, ("getGoodLocation (): PB could not convert result back to a location")); - return NULL; + return nullptr; } return goodLocation->getReturnValue(); @@ -218,16 +218,16 @@ jobject JNICALL ScriptMethodsTerrainNamespace::getGoodLocationAvoidCollidables(J PROFILER_AUTO_BLOCK_DEFINE("JNI::getGoodLocationAvoidCollidables"); //validate scripter's input - if (searchRectLowerLeftLocation == NULL) + if (searchRectLowerLeftLocation == nullptr) { - DEBUG_WARNING (true, ("getGoodLocationAvoidCollidables (): DB lower left is NULL")); - return NULL; + DEBUG_WARNING (true, ("getGoodLocationAvoidCollidables (): DB lower left is nullptr")); + return nullptr; } - if (searchRectUpperRightLocation == NULL) + if (searchRectUpperRightLocation == nullptr) { - DEBUG_WARNING (true, ("getGoodLocationAvoidCollidables (): DB upper right is NULL")); - return NULL; + DEBUG_WARNING (true, ("getGoodLocationAvoidCollidables (): DB upper right is nullptr")); + return nullptr; } //pull the data from the java Location objects. sceneid and cell are not checked or used, but sent back in the good location, if one exists @@ -237,14 +237,14 @@ jobject JNICALL ScriptMethodsTerrainNamespace::getGoodLocationAvoidCollidables(J if (!ScriptConversion::convertWorld(searchRectLowerLeftLocation, srLLLocationVec, sceneId)) { DEBUG_WARNING (true, ("getGoodLocationAvoidCollidables (): DB could not convert lower left coordinates")); - return NULL; + return nullptr; } Vector srURLocationVec; if (!ScriptConversion::convertWorld(searchRectUpperRightLocation, srURLocationVec, sceneId)) { DEBUG_WARNING (true, ("getGoodLocationAvoidCollidables (): DB could not convert upper right coordinates")); - return NULL; + return nullptr; } // get the good location from ServerWorld @@ -252,7 +252,7 @@ jobject JNICALL ScriptMethodsTerrainNamespace::getGoodLocationAvoidCollidables(J if (successLoc3d.x == 0 && successLoc3d.y == 0 && successLoc3d.z == 0) { // no good location available - return NULL; + return nullptr; } //convert it back into scripter lingo (a "location"), using the default scene and cell ids @@ -260,7 +260,7 @@ jobject JNICALL ScriptMethodsTerrainNamespace::getGoodLocationAvoidCollidables(J if (!ScriptConversion::convert(successLoc3d, sceneId, NetworkId(), goodLocation)) { DEBUG_WARNING (true, ("getGoodLocationAvoidCollidables (): PB could not convert result back to a location")); - return NULL; + return nullptr; } return goodLocation->getReturnValue(); @@ -587,7 +587,7 @@ jboolean JNICALL ScriptMethodsTerrainNamespace::setWeatherData (JNIEnv* env, job UNREF(self); PlanetObject * planet = ServerUniverse::getInstance().getCurrentPlanet(); - if (planet != NULL) + if (planet != nullptr) { planet->setWeather(index, windVelocityX, 0.f, windVelocityZ); return JNI_TRUE; @@ -603,9 +603,9 @@ jboolean JNICALL ScriptMethodsTerrainNamespace::setWeatherData (JNIEnv* env, job jboolean JNICALL ScriptMethodsTerrainNamespace::isBelowWater (JNIEnv* /*env*/, jobject /*self*/, jobject location) { - if (location == NULL) + if (location == nullptr) { - DEBUG_WARNING(true, ("[designer bug] isBelowWater script hook was passed a NULL location reference")); + DEBUG_WARNING(true, ("[designer bug] isBelowWater script hook was passed a nullptr location reference")); return JNI_FALSE; } @@ -621,7 +621,7 @@ jboolean JNICALL ScriptMethodsTerrainNamespace::isBelowWater (JNIEnv* /*env*/, j const CellProperty* worldCell = CellProperty::getWorldCellProperty(); if(!worldCell) { - DEBUG_WARNING(true, ("isBelowWater got a NULL worldCell back from CellProperty::getWorldCellProperty()")); + DEBUG_WARNING(true, ("isBelowWater got a nullptr worldCell back from CellProperty::getWorldCellProperty()")); return JNI_FALSE; } const NetworkId& worldCellId = worldCell->getOwner().getNetworkId(); @@ -758,9 +758,9 @@ jfloat JNICALL ScriptMethodsTerrainNamespace::getWaterTableHeight (JNIEnv* /*env { float zero = 0.0f; - if (location == NULL) + if (location == nullptr) { - DEBUG_WARNING(true, ("[designer bug] getWaterTableHeight script hook was passed a NULL location reference")); + DEBUG_WARNING(true, ("[designer bug] getWaterTableHeight script hook was passed a nullptr location reference")); return zero; } @@ -776,7 +776,7 @@ jfloat JNICALL ScriptMethodsTerrainNamespace::getWaterTableHeight (JNIEnv* /*env const CellProperty* worldCell = CellProperty::getWorldCellProperty(); if(!worldCell) { - DEBUG_WARNING(true, ("getWaterTableHeight got a NULL worldCell back from CellProperty::getWorldCellProperty()")); + DEBUG_WARNING(true, ("getWaterTableHeight got a nullptr worldCell back from CellProperty::getWorldCellProperty()")); return zero; } const NetworkId& worldCellId = worldCell->getOwner().getNetworkId(); @@ -862,7 +862,7 @@ jboolean JNICALL ScriptMethodsTerrainNamespace::requestLocation (JNIEnv * /*env* jboolean JNICALL ScriptMethodsTerrainNamespace::isOnAFloor (JNIEnv * env, jobject self, jlong scriptObject) { //-- make sure we have a valid object - ServerObject * theObject = NULL; + ServerObject * theObject = nullptr; if (!JavaLibrary::getObject (scriptObject, theObject)) { DEBUG_WARNING (true, ("isOnAFloor (): could not find scriptObject")); @@ -876,7 +876,7 @@ jboolean JNICALL ScriptMethodsTerrainNamespace::isOnAFloor (JNIEnv * env, jobjec return JNI_FALSE; } - if(objectCollisionProp->getStandingOn() != NULL) + if(objectCollisionProp->getStandingOn() != nullptr) return JNI_TRUE; else return JNI_FALSE; @@ -890,7 +890,7 @@ jboolean JNICALL ScriptMethodsTerrainNamespace::isRelativePointOnSameFloorAsObje return JNI_FALSE; //-- make sure we have a valid object - ServerObject * theObject = NULL; + ServerObject * theObject = nullptr; if (!JavaLibrary::getObject (scriptObject, theObject)) { DEBUG_WARNING (true, ("isRelativePointOnSameFloorAsObject (): could not find scriptObject")); @@ -938,7 +938,7 @@ jfloat JNICALL ScriptMethodsTerrainNamespace::getFloorHeightAtRelativePointOnS return JNI_FALSE; //-- make sure we have a valid object - ServerObject * theObject = NULL; + ServerObject * theObject = nullptr; if (!JavaLibrary::getObject (scriptObject, theObject)) { DEBUG_WARNING (true, ("getFloorHeightAtRelativePointOnSameFloorAsObject (): could not find scriptObject")); @@ -1106,7 +1106,7 @@ jboolean JNICALL ScriptMethodsTerrainNamespace::createClientPathAdvanced(JNIEnv */ jboolean JNICALL ScriptMethodsTerrainNamespace::setCreatureCoverDefault(JNIEnv *env, jobject self, jlong target) { - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -1137,7 +1137,7 @@ jboolean JNICALL ScriptMethodsTerrainNamespace::setCreatureCover(JNIEnv *env, jo { UNREF(self); - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if (!JavaLibrary::getObject(target, creature)) return JNI_FALSE; @@ -1149,7 +1149,7 @@ jboolean JNICALL ScriptMethodsTerrainNamespace::setCreatureCover(JNIEnv *env, jo void JNICALL ScriptMethodsTerrainNamespace::setCreatureCoverVisibility(JNIEnv * env, jobject self, jlong target, jboolean isVisible) { - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if(!JavaLibrary::getObject(target, creature)) return; @@ -1160,7 +1160,7 @@ void JNICALL ScriptMethodsTerrainNamespace::setCreatureCoverVisibility(JNIEnv * jboolean JNICALL ScriptMethodsTerrainNamespace::getCreatureCoverVisibility(JNIEnv * env, jobject self, jlong target) { - CreatureObject * creature = NULL; + CreatureObject * creature = nullptr; if(!JavaLibrary::getObject(target, creature)) return JNI_FALSE; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsVeteran.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsVeteran.cpp index d751acee..ed5f2322 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsVeteran.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsVeteran.cpp @@ -81,7 +81,7 @@ const JNINativeMethod NATIVES[] = { jobjectArray JNICALL ScriptMethodsVeteranNamespace::veteranGetTriggeredEvents(JNIEnv * /*env*/, jobject /*self*/, jlong player) { ServerObject const * const so = safe_cast(NetworkIdManager::getObjectById(NetworkId(player))); - CreatureObject const * const playerCreature = so ? so->asCreatureObject() : NULL; + CreatureObject const * const playerCreature = so ? so->asCreatureObject() : nullptr; if (playerCreature) { @@ -89,7 +89,7 @@ jobjectArray JNICALL ScriptMethodsVeteranNamespace::veteranGetTriggeredEvents(JN VeteranRewardManager::getTriggeredEventsIds(*playerCreature, eventsIds); if (eventsIds.empty()) - return NULL; + return nullptr; int i = 0; LocalObjectArrayRefPtr valueArray = createNewObjectArray(eventsIds.size(), JavaLibrary::getClsString()); @@ -102,7 +102,7 @@ jobjectArray JNICALL ScriptMethodsVeteranNamespace::veteranGetTriggeredEvents(JN return valueArray->getReturnValue(); } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -110,7 +110,7 @@ jobjectArray JNICALL ScriptMethodsVeteranNamespace::veteranGetTriggeredEvents(JN jboolean JNICALL ScriptMethodsVeteranNamespace::veteranAccountFeatureIdRequest(JNIEnv * /*env*/, jobject /*self*/, jlong player) { ServerObject * const so = safe_cast(NetworkIdManager::getObjectById(NetworkId(player))); - CreatureObject * const playerCreature = so ? so->asCreatureObject() : NULL; + CreatureObject * const playerCreature = so ? so->asCreatureObject() : nullptr; if (playerCreature) { @@ -131,7 +131,7 @@ jboolean JNICALL ScriptMethodsVeteranNamespace::veteranAccountFeatureIdRequest(J jobjectArray JNICALL ScriptMethodsVeteranNamespace::veteranGetRewardChoicesDescriptions(JNIEnv * /*env*/, jobject /*self*/, jlong player, jstring event) { ServerObject const * const so = safe_cast(NetworkIdManager::getObjectById(NetworkId(player))); - CreatureObject const * const playerCreature = so ? so->asCreatureObject() : NULL; + CreatureObject const * const playerCreature = so ? so->asCreatureObject() : nullptr; if (playerCreature) { @@ -152,7 +152,7 @@ jobjectArray JNICALL ScriptMethodsVeteranNamespace::veteranGetRewardChoicesDescr } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -160,7 +160,7 @@ jobjectArray JNICALL ScriptMethodsVeteranNamespace::veteranGetRewardChoicesDescr jobjectArray JNICALL ScriptMethodsVeteranNamespace::veteranGetRewardChoicesTags(JNIEnv * /*env*/, jobject /*self*/, jlong player, jstring event) { ServerObject const * const so = safe_cast(NetworkIdManager::getObjectById(NetworkId(player))); - CreatureObject const * const playerCreature = so ? so->asCreatureObject() : NULL; + CreatureObject const * const playerCreature = so ? so->asCreatureObject() : nullptr; if (playerCreature) { @@ -181,7 +181,7 @@ jobjectArray JNICALL ScriptMethodsVeteranNamespace::veteranGetRewardChoicesTags( } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -189,7 +189,7 @@ jobjectArray JNICALL ScriptMethodsVeteranNamespace::veteranGetRewardChoicesTags( jboolean JNICALL ScriptMethodsVeteranNamespace::veteranClaimReward(JNIEnv * /*env*/, jobject /*self*/, jlong player, jstring event, jstring rewardTag) { ServerObject const * const so = safe_cast(NetworkIdManager::getObjectById(NetworkId(player))); - CreatureObject const * const playerCreature = so ? so->asCreatureObject() : NULL; + CreatureObject const * const playerCreature = so ? so->asCreatureObject() : nullptr; if (playerCreature) { @@ -227,7 +227,7 @@ jstring JNICALL ScriptMethodsVeteranNamespace::veteranGetEventAnnouncement(JNIEn return eventAnnouncement.getReturnValue(); } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -245,7 +245,7 @@ jstring JNICALL ScriptMethodsVeteranNamespace::veteranGetEventDescription(JNIEnv return eventDescription.getReturnValue(); } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -263,7 +263,7 @@ jstring JNICALL ScriptMethodsVeteranNamespace::veteranGetEventUrl(JNIEnv * /*env return temp2.getReturnValue(); } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -313,7 +313,7 @@ jboolean JNICALL ScriptMethodsVeteranNamespace::veteranIsItemAccountUniqueFeatur void JNICALL ScriptMethodsVeteranNamespace::veteranWriteAccountDataToObjvars(JNIEnv * /*env*/, jobject /*self*/, jlong player) { ServerObject * const so = safe_cast(NetworkIdManager::getObjectById(NetworkId(player))); - CreatureObject * const playerCreature = so ? so->asCreatureObject() : NULL; + CreatureObject * const playerCreature = so ? so->asCreatureObject() : nullptr; if (playerCreature) VeteranRewardManager::writeAccountDataToObjvars(*playerCreature); @@ -323,11 +323,11 @@ void JNICALL ScriptMethodsVeteranNamespace::veteranWriteAccountDataToObjvars(JNI jboolean JNICALL ScriptMethodsVeteranNamespace::veteranCanTradeInReward(JNIEnv *env, jobject self, jlong player, jlong item) { - CreatureObject const * playerCreature = NULL; + CreatureObject const * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature) || !playerCreature) return JNI_FALSE; - ServerObject * itemObject = NULL; + ServerObject * itemObject = nullptr; if (!JavaLibrary::getObject(item, itemObject) || !itemObject) return JNI_FALSE; @@ -339,11 +339,11 @@ jboolean JNICALL ScriptMethodsVeteranNamespace::veteranCanTradeInReward(JNIEnv * void JNICALL ScriptMethodsVeteranNamespace::veteranTradeInReward(JNIEnv *env, jobject self, jlong player, jlong item) { - CreatureObject const * playerCreature = NULL; + CreatureObject const * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature) || !playerCreature) return; - ServerObject * itemObject = NULL; + ServerObject * itemObject = nullptr; if (!JavaLibrary::getObject(item, itemObject) || !itemObject) return; @@ -355,11 +355,11 @@ void JNICALL ScriptMethodsVeteranNamespace::veteranTradeInReward(JNIEnv *env, jo void JNICALL ScriptMethodsVeteranNamespace::adjustSwgTcgAccountFeatureId(JNIEnv *env, jobject self, jlong player, jlong item, jint featureId, jint adjustment) { - CreatureObject const * playerCreature = NULL; + CreatureObject const * playerCreature = nullptr; if (!JavaLibrary::getObject(player, playerCreature) || !playerCreature) return; - ServerObject * itemObject = NULL; + ServerObject * itemObject = nullptr; if (!JavaLibrary::getObject(item, itemObject) || !itemObject) return; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsWaypoint.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsWaypoint.cpp index e9b3c546..18241735 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsWaypoint.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsWaypoint.cpp @@ -306,7 +306,7 @@ jobject JNICALL ScriptMethodsWaypointNamespace::getWaypointRegion(JNIEnv * env, if(w.isValid()) { const Region * region = RegionMaster::getSmallestVisibleRegionAtPoint(w.getLocation().getSceneId(), w.getLocation().getCoordinates().x, w.getLocation().getCoordinates().z); - if (region != NULL) + if (region != nullptr) { LocalRefPtr result; if (ScriptConversion::convert(*region, result)) diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsWorldInfo.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsWorldInfo.cpp index 3cc7c024..ca3d5b8d 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsWorldInfo.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsWorldInfo.cpp @@ -182,7 +182,7 @@ const JNINativeMethod NATIVES[] = { * @param location location that is the center of the search area * @param range radius of search area * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getObjectsInRangeLocation(JNIEnv *env, jobject self, jobject location, jfloat range) { @@ -212,7 +212,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getObjectsInRangeLocation(JN * @param location object that is the center of the search area * @param range radius of search area * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getObjectsInRangeObject(JNIEnv *env, jobject self, jlong object, jfloat range) { @@ -242,7 +242,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getObjectsInRangeObject(JNIE * @param location location that is the center of the search area * @param range radius of search area * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesInRangeLocation(JNIEnv *env, jobject self, jobject location, jfloat range) { @@ -271,7 +271,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesInRangeLocation( * @param location object that is the center of the search area * @param range radius of search area * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesInRangeObject(JNIEnv *env, jobject self, jlong object, jfloat range) { @@ -302,7 +302,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesInRangeObject(JN * @param type * @param mask * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfNicheInRangeLocation(JNIEnv *env, jobject self, jobject location, jfloat range, jint type, jint mask) { @@ -333,7 +333,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfNicheInRangeLo * @param type * @param mask * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfNicheInRangeObject(JNIEnv *env, jobject self, jlong object, jfloat range, jint type, jint mask) { @@ -363,7 +363,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfNicheInRangeOb * @param range radius of search area * @param species * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfSpeciesInRangeLocation(JNIEnv *env, jobject self, jobject location, jfloat range, jint species) { @@ -393,7 +393,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfSpeciesInRange * @param range radius of search area * @param species * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfSpeciesInRangeObject(JNIEnv *env, jobject self, jlong object, jfloat range, jint species) { @@ -424,7 +424,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfSpeciesInRange * @param species * @param race * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfRaceInRangeLocation(JNIEnv *env, jobject self, jobject location, jfloat range, jint species, jint race) { @@ -455,7 +455,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfRaceInRangeLoc * @param species * @param race * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfRaceInRangeObject(JNIEnv *env, jobject self, jlong object, jfloat range, jint species, jint race) { @@ -484,7 +484,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfRaceInRangeObj * @param location location that is the center of the search area * @param range radius of search area * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getNonCreaturesInRangeLocation(JNIEnv *env, jobject self, jobject location, jfloat range) { @@ -513,7 +513,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getNonCreaturesInRangeLocati * @param location object that is the center of the search area * @param range radius of search area * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getNonCreaturesInRangeObject(JNIEnv *env, jobject self, jlong object, jfloat range) { @@ -542,7 +542,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getNonCreaturesInRangeObject * @param location location that is the center of the search area * @param range radius of search area * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getNPCsInRangeLocation(JNIEnv *env, jobject self, jobject location, jfloat range) { @@ -571,7 +571,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getNPCsInRangeLocation(JNIEn * @param location object that is the center of the search area * @param range radius of search area * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getNPCsInRangeObject(JNIEnv *env, jobject self, jlong object, jfloat range) { @@ -600,7 +600,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getNPCsInRangeObject(JNIEnv * @param location location that is the center of the search area * @param range radius of search area * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getPlayerCreaturesInRangeLocation(JNIEnv *env, jobject self, jobject location, jfloat range) { @@ -629,7 +629,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getPlayerCreaturesInRangeLoc * @param location object that is the center of the search area * @param range radius of search area * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getPlayerCreaturesInRangeObject(JNIEnv *env, jobject self, jlong object, jfloat range) { @@ -658,7 +658,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getPlayerCreaturesInRangeObj * @param env Java environment * @param self class calling this function * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getObjectsInCone(JNIEnv *env, jobject self, jlong coneCenterObjectId, jlong coneDirectionObjectId, jfloat range, jfloat angle) { @@ -698,7 +698,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getObjectsInCone(JNIEnv *env * @param env Java environment * @param self class calling this function * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getObjectsInConeLocation(JNIEnv *env, jobject self, jlong coneCenterObjectId, jobject coneDirectionLocation, jfloat range, jfloat angle) { @@ -738,7 +738,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getObjectsInConeLocation(JNI * @param env Java environment * @param self class calling this function * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesInCone(JNIEnv *env, jobject self, jlong coneCenterObjectId, jlong coneDirectionObjectId, jfloat range, jfloat angle) { @@ -779,7 +779,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesInCone(JNIEnv *e * @param env Java environment * @param self class calling this function * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesInConeLocation(JNIEnv *env, jobject self, jlong coneCenterObjectId, jobject coneDirectionLocation, jfloat range, jfloat angle) { @@ -820,7 +820,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesInConeLocation(J * @param env Java environment * @param self class calling this function * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfNicheInCone(JNIEnv *env, jobject self, jlong coneCenterObjectId, jlong coneDirectionObjectId, jfloat range, jfloat angle, jint niche, jint mask) { @@ -860,7 +860,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfNicheInCone(JN * @param env Java environment * @param self class calling this function * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfSpeciesInCone(JNIEnv *env, jobject self, jlong coneCenterObjectId, jlong coneDirectionObjectId, jfloat range, jfloat angle, jint species) { @@ -900,7 +900,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfSpeciesInCone( * @param env Java environment * @param self class calling this function * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfRaceInCone(JNIEnv *env, jobject self, jlong coneCenterObjectId, jlong coneDirectionObjectId, jfloat range, jfloat angle, jint species, jint race) { @@ -940,7 +940,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getCreaturesOfRaceInCone(JNI * @param env Java environment * @param self class calling this function * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getNonCreaturesInCone(JNIEnv *env, jobject self, jlong coneCenterObjectId, jlong coneDirectionObjectId, jfloat range, jfloat angle) { @@ -980,7 +980,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getNonCreaturesInCone(JNIEnv * @param env Java environment * @param self class calling this function * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getNPCsInCone(JNIEnv *env, jobject self, jlong coneCenterObjectId, jlong coneDirectionObjectId, jfloat range, jfloat angle) { @@ -1020,7 +1020,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getNPCsInCone(JNIEnv *env, j * @param env Java environment * @param self class calling this function * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getPlayerCreaturesInCone(JNIEnv *env, jobject self, jlong coneCenterObjectId, jlong coneDirectionObjectId, jfloat range, jfloat angle) { @@ -1169,7 +1169,7 @@ jlong JNICALL ScriptMethodsWorldInfoNamespace::getClosestMobile(JNIEnv *env, job return 0; ServerObject * npc = ServerWorld::findClosestNPC(target, radius); - if (npc == NULL) + if (npc == nullptr) return 0; return (npc->getNetworkId()).getValue(); } @@ -1184,7 +1184,7 @@ jlong JNICALL ScriptMethodsWorldInfoNamespace::getClosestPlayer(JNIEnv *env, job return 0; ServerObject * player = ServerWorld::findClosestPlayer(target, radius); - if (player == NULL) + if (player == nullptr) return 0; return (player->getNetworkId()).getValue(); } @@ -1209,7 +1209,7 @@ jlong JNICALL ScriptMethodsWorldInfoNamespace::getFirstObjectWithScript(JNIEnv * for (ResultsType::iterator i=results.begin(); i!=results.end(); ++i) { - if (*i != NULL && (*i)->getScriptObject()->hasScript(scriptName)) + if (*i != nullptr && (*i)->getScriptObject()->hasScript(scriptName)) return ((*i)->getNetworkId()).getValue(); } @@ -1237,7 +1237,7 @@ jlong JNICALL ScriptMethodsWorldInfoNamespace::getFirstObjectWithObjVar(JNIEnv * for (ResultsType::iterator i=results.begin(); i!=results.end(); ++i) { - if (*i != NULL && (*i)->getObjVars().hasItem(objvarName)) + if (*i != nullptr && (*i)->getObjVars().hasItem(objvarName)) return ((*i)->getNetworkId()).getValue(); } @@ -1265,7 +1265,7 @@ jlong JNICALL ScriptMethodsWorldInfoNamespace::getFirstObjectWithTemplate(JNIEnv for (ResultsType::iterator i=results.begin(); i!=results.end(); ++i) { - if (*i != NULL && templateStr == (*i)->getTemplateName()) + if (*i != nullptr && templateStr == (*i)->getTemplateName()) return ((*i)->getNetworkId()).getValue(); } @@ -1434,7 +1434,7 @@ jstring JNICALL ScriptMethodsWorldInfoNamespace::getNameForPlanetObject(JNIEnv * } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -1499,7 +1499,7 @@ jobject JNICALL ScriptMethodsWorldInfoNamespace::getValidLocation(JNIEnv *env, j // Determine if it's a valid point, and if not search for another one. - bool isValid = !CollisionWorld::query( Sphere(corralPoint,objectRadius),NULL); + bool isValid = !CollisionWorld::query( Sphere(corralPoint,objectRadius),nullptr); // ---------- @@ -1517,14 +1517,14 @@ jobject JNICALL ScriptMethodsWorldInfoNamespace::getValidLocation(JNIEnv *env, j // We failed to find a valid location - return NULL; + return nullptr; } // ---------------------------------------------------------------------- jboolean JNICALL ScriptMethodsWorldInfoNamespace::getCollidesWithObject(JNIEnv * env, jobject self, jobject jlocation, jfloat jradius) { - if (jlocation == NULL) + if (jlocation == nullptr) return JNI_FALSE; float const radius = jradius; @@ -1532,7 +1532,7 @@ jboolean JNICALL ScriptMethodsWorldInfoNamespace::getCollidesWithObject(JNIEnv * if (!ScriptConversion::convertWorld(jlocation, location)) return JNI_FALSE; - bool const result = CollisionWorld::query(Sphere(location, radius), NULL); + bool const result = CollisionWorld::query(Sphere(location, radius), nullptr); if(result) return JNI_TRUE; @@ -1556,7 +1556,7 @@ jboolean JNICALL ScriptMethodsWorldInfoNamespace::canSee(JNIEnv *env, jobject se { UNREF(self); - const ServerObject * sourceObject = NULL; + const ServerObject * sourceObject = nullptr; if (!JavaLibrary::getObject(source, sourceObject)) { NetworkId id(source); @@ -1572,7 +1572,7 @@ jboolean JNICALL ScriptMethodsWorldInfoNamespace::canSee(JNIEnv *env, jobject se return JNI_TRUE; } - const ServerObject * targetObject = NULL; + const ServerObject * targetObject = nullptr; if (!JavaLibrary::getObject(target, targetObject)) { NetworkId id(target); @@ -1608,7 +1608,7 @@ jboolean JNICALL ScriptMethodsWorldInfoNamespace::canSeeLocation(JNIEnv *env, jo { UNREF(self); - const ServerObject * sourceObject = NULL; + const ServerObject * sourceObject = nullptr; if (!JavaLibrary::getObject(source, sourceObject)) { NetworkId id(source); @@ -1640,11 +1640,11 @@ jboolean JNICALL ScriptMethodsWorldInfoNamespace::canManipulate(JNIEnv *env, job { UNREF(self); - const CreatureObject * sourceObject = NULL; + const CreatureObject * sourceObject = nullptr; if (!JavaLibrary::getObject(player, sourceObject)) return JNI_FALSE; - const ServerObject * targetObject = NULL; + const ServerObject * targetObject = nullptr; if (!JavaLibrary::getObject(target, targetObject)) return JNI_FALSE; @@ -1663,7 +1663,7 @@ jboolean JNICALL ScriptMethodsWorldInfoNamespace::canManipulate(JNIEnv *env, job * @param performer performer we are looking for listeners of * @param range radius of search area * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getPerformanceListenersInRange(JNIEnv *env, jobject self, jlong performer, jfloat range) { @@ -1697,7 +1697,7 @@ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getPerformanceListenersInRan * @param performer performer we are looking for watchers of * @param range radius of search area * - * @return array of obj_ids of the objects in range, or null on error + * @return array of obj_ids of the objects in range, or nullptr on error */ jlongArray JNICALL ScriptMethodsWorldInfoNamespace::getPerformanceWatchersInRange(JNIEnv *env, jobject self, jlong performer, jfloat range) { diff --git a/engine/server/library/serverScript/src/shared/ScriptParamArchive.cpp b/engine/server/library/serverScript/src/shared/ScriptParamArchive.cpp index 967939fb..46799842 100755 --- a/engine/server/library/serverScript/src/shared/ScriptParamArchive.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptParamArchive.cpp @@ -56,7 +56,7 @@ void put(ByteStream & target, const std::vector *> { const std::vector * inner = source[i]; signed int innerLength = 0; - if (inner != NULL) + if (inner != nullptr) innerLength = inner->size(); put(target, innerLength); for (int j = 0; j < innerLength; ++j) diff --git a/engine/server/library/serverScript/src/shared/ScriptParameters.cpp b/engine/server/library/serverScript/src/shared/ScriptParameters.cpp index 78c5fde4..3ea2df78 100755 --- a/engine/server/library/serverScript/src/shared/ScriptParameters.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptParameters.cpp @@ -207,7 +207,7 @@ void ScriptParams::addParam(bool param, const std::string & paramName, bool owne * This call occurs because of a conversion of a datatype passing through this function from std::string to Unicode::String. * Basically, most times it is called with std::string the c_str() function is called. Since this is still valid when the * type is changed to Unicode::String and the const Unicode::unicode_char_t * is successfully auto-converted to const char * - * you wind up having a NULL string when it get explicitly converted to const char * on the other side. So, this should never + * you wind up having a nullptr string when it get explicitly converted to const char * on the other side. So, this should never * be called except in error. * void ScriptParams::addParam(const Unicode::unicode_char_t * param, const std::string & paramName, bool owned) @@ -659,7 +659,7 @@ bool ScriptParams::changeParam(int index, const StringId & param, bool owned) if (p.m_type != Param::STRING_ID) return false; - if (p.m_param.sidParam == NULL) + if (p.m_param.sidParam == nullptr) return false; if (p.m_owned) diff --git a/engine/server/library/serverScript/src/shared/ScriptParameters.h b/engine/server/library/serverScript/src/shared/ScriptParameters.h index 98aa0870..ab7468f2 100755 --- a/engine/server/library/serverScript/src/shared/ScriptParameters.h +++ b/engine/server/library/serverScript/src/shared/ScriptParameters.h @@ -311,7 +311,7 @@ inline const stdvector::fwd & ScriptParams::getLocationArrayPara inline const NetworkId & ScriptParams::getObjIdParam(int index) const { - if (m_params[index].m_param.oidParam != NULL) + if (m_params[index].m_param.oidParam != nullptr) return *m_params[index].m_param.oidParam; return NetworkId::cms_invalid; } // ScriptParams::getObjIdParam diff --git a/engine/server/library/serverUtility/src/shared/AdminAccountManager.cpp b/engine/server/library/serverUtility/src/shared/AdminAccountManager.cpp index 85656cb2..e4075721 100755 --- a/engine/server/library/serverUtility/src/shared/AdminAccountManager.cpp +++ b/engine/server/library/serverUtility/src/shared/AdminAccountManager.cpp @@ -16,7 +16,7 @@ DataTable * AdminAccountManager::ms_adminTable = 0; bool AdminAccountManager::ms_installed = false; -std::string *AdminAccountManager::ms_dataTableName = NULL; +std::string *AdminAccountManager::ms_dataTableName = nullptr; //----------------------------------------------------------------------- @@ -42,7 +42,7 @@ void AdminAccountManager::remove() DataTableManager::close(*ms_dataTableName); ms_installed = false; delete ms_dataTableName; - ms_dataTableName = NULL; + ms_dataTableName = nullptr; } //----------------------------------------------------------------------- diff --git a/engine/server/library/serverUtility/src/shared/ChatLogManager.cpp b/engine/server/library/serverUtility/src/shared/ChatLogManager.cpp index 5f3cd77c..e5283c05 100755 --- a/engine/server/library/serverUtility/src/shared/ChatLogManager.cpp +++ b/engine/server/library/serverUtility/src/shared/ChatLogManager.cpp @@ -135,7 +135,7 @@ void ChatLogManagerNamespace::addChatLogEntry(Unicode::String const &fromPlayer, } else { - Unicode::String const *finalMessage = NULL; + Unicode::String const *finalMessage = nullptr; // Add the new string to the master message list, or if it already exists, just increase the reference count diff --git a/engine/server/library/serverUtility/src/shared/ClusterWideDataManagerList.cpp b/engine/server/library/serverUtility/src/shared/ClusterWideDataManagerList.cpp index 659f1c61..cfda04ff 100755 --- a/engine/server/library/serverUtility/src/shared/ClusterWideDataManagerList.cpp +++ b/engine/server/library/serverUtility/src/shared/ClusterWideDataManagerList.cpp @@ -36,7 +36,7 @@ namespace ClusterWideDataManagerListNamespace struct QueuedRequestInfo { - QueuedRequestInfo() : processId(0), requestTime(0.0), request(NULL), server(NULL) {}; + QueuedRequestInfo() : processId(0), requestTime(0.0), request(nullptr), server(nullptr) {}; unsigned long processId; float requestTime; @@ -272,7 +272,7 @@ void ClusterWideDataManagerList::onGameServerDisconnect(unsigned long const proc ClusterWideDataManagerListNamespace::ServerLockListConstRange range = ClusterWideDataManagerListNamespace::s_serverLockList.equal_range(processId); - ClusterWideDataManager * manager = NULL; + ClusterWideDataManager * manager = nullptr; for (ClusterWideDataManagerListNamespace::ServerLockList::const_iterator iter2 = range.first; iter2 != range.second; ++iter2) { manager = ClusterWideDataManagerListNamespace::getClusterWideDataManager((iter2->second).managerName, false); @@ -327,7 +327,7 @@ ClusterWideDataManager * ClusterWideDataManagerListNamespace::getClusterWideData return manager; } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverUtility/src/shared/FreeCtsDataTable.cpp b/engine/server/library/serverUtility/src/shared/FreeCtsDataTable.cpp index 3be9fe88..9f802549 100755 --- a/engine/server/library/serverUtility/src/shared/FreeCtsDataTable.cpp +++ b/engine/server/library/serverUtility/src/shared/FreeCtsDataTable.cpp @@ -205,7 +205,7 @@ void FreeCtsDataTableNamespace::loadData() tokensSourceClusterList.clear(); tokensTargetClusterList.clear(); - if (Unicode::tokenize(Unicode::narrowToWide(sourceClusterList), tokensSourceClusterList, &clusterListDelimiters, NULL) && (tokensSourceClusterList.size() > 0) && Unicode::tokenize(Unicode::narrowToWide(targetClusterList), tokensTargetClusterList, &clusterListDelimiters, NULL) && (tokensTargetClusterList.size() > 0)) + if (Unicode::tokenize(Unicode::narrowToWide(sourceClusterList), tokensSourceClusterList, &clusterListDelimiters, nullptr) && (tokensSourceClusterList.size() > 0) && Unicode::tokenize(Unicode::narrowToWide(targetClusterList), tokensTargetClusterList, &clusterListDelimiters, nullptr) && (tokensTargetClusterList.size() > 0)) { for (tokensIter = tokensTargetClusterList.begin(); tokensIter != tokensTargetClusterList.end(); ++tokensIter) freeCtsInfo.targetCluster[Unicode::wideToNarrow(Unicode::toLower(*tokensIter))] = Unicode::wideToNarrow(*tokensIter); @@ -258,9 +258,9 @@ void FreeCtsDataTableNamespace::loadData() time_t FreeCtsDataTableNamespace::convertToEpoch(int const year, int const month, int const day, int const hour, int const minute, int const second) { - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); struct tm * timeinfo = ::localtime(&timeNow); - FATAL(!timeinfo, ("::localtime() returns NULL")); + FATAL(!timeinfo, ("::localtime() returns nullptr")); // greater than zero if Daylight Saving Time is in effect, // zero if Daylight Saving Time is not in effect, @@ -288,7 +288,7 @@ time_t FreeCtsDataTableNamespace::convertToEpoch(int const year, int const month // "opposite" standard/daylight period than the current time, // and it should be OK timeinfo = ::localtime(&convertedTime); - FATAL(!timeinfo, ("::localtime() returns NULL")); + FATAL(!timeinfo, ("::localtime() returns nullptr")); if ((timeinfo->tm_year != (year - 1900)) || (timeinfo->tm_mon != (month - 1)) || @@ -342,9 +342,9 @@ FreeCtsDataTable::FreeCtsInfo const * FreeCtsDataTable::isFreeCtsSourceCluster(s loadData(); if (s_freeCtsList.empty()) - return NULL; + return nullptr; - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); std::pair::const_iterator, std::multimap::const_iterator> range = s_freeCtsList.equal_range(Unicode::toLower(sourceCluster)); for (std::multimap::const_iterator iter = range.first; iter != range.second; ++iter) { @@ -355,7 +355,7 @@ FreeCtsDataTable::FreeCtsInfo const * FreeCtsDataTable::isFreeCtsSourceCluster(s return &(iter->second); } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -366,15 +366,15 @@ FreeCtsDataTable::FreeCtsInfo const * FreeCtsDataTable::wouldCharacterTransferBe loadData(); if (s_freeCtsList.empty()) - return NULL; + return nullptr; if ((sourceCharacterCreateTime <= 0) && !ignoreTimeRestriction) - return NULL; + return nullptr; if (sourceStationId != targetStationId) - return NULL; + return nullptr; - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); std::string const lowerTargetCluster(Unicode::toLower(targetCluster)); std::pair::const_iterator, std::multimap::const_iterator> range = s_freeCtsList.equal_range(Unicode::toLower(sourceCluster)); @@ -396,7 +396,7 @@ FreeCtsDataTable::FreeCtsInfo const * FreeCtsDataTable::wouldCharacterTransferBe } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -407,12 +407,12 @@ FreeCtsDataTable::FreeCtsInfo const * FreeCtsDataTable::getFreeCtsInfoForCharact loadData(); if (s_freeCtsList.empty()) - return NULL; + return nullptr; if ((sourceCharacterCreateTime <= 0) && !ignoreTimeRestriction) - return NULL; + return nullptr; - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); std::pair::const_iterator, std::multimap::const_iterator> range = s_freeCtsList.equal_range(Unicode::toLower(sourceCluster)); for (std::multimap::const_iterator iter = range.first; iter != range.second; ++iter) { @@ -429,5 +429,5 @@ FreeCtsDataTable::FreeCtsInfo const * FreeCtsDataTable::getFreeCtsInfoForCharact return &(iter->second); } - return NULL; + return nullptr; } diff --git a/engine/shared/application/DataTableTool/src/shared/DataTableTool.cpp b/engine/shared/application/DataTableTool/src/shared/DataTableTool.cpp index 29d396da..c3dcaf32 100755 --- a/engine/shared/application/DataTableTool/src/shared/DataTableTool.cpp +++ b/engine/shared/application/DataTableTool/src/shared/DataTableTool.cpp @@ -245,7 +245,7 @@ void DataTableTool::createOutputDirectoryForFile(const std::string & fileName) std::string directoryName(fileName, 0, slashPos); #if defined(PLATFORM_WIN32) - int result = CreateDirectory(directoryName.c_str(), NULL); + int result = CreateDirectory(directoryName.c_str(), nullptr); #elif defined(PLATFORM_LINUX) // make sure slashes are forward { diff --git a/engine/shared/application/TemplateCompiler/src/shared/TemplateCompiler.cpp b/engine/shared/application/TemplateCompiler/src/shared/TemplateCompiler.cpp index 8611bb0b..2a3658bb 100755 --- a/engine/shared/application/TemplateCompiler/src/shared/TemplateCompiler.cpp +++ b/engine/shared/application/TemplateCompiler/src/shared/TemplateCompiler.cpp @@ -46,7 +46,7 @@ static const int SUBMIT_NO_FILE_ERR = 17; // need to add file before submitting // virtual ~MyPerforceUser() {} // virtual void HandleError( Error *err ) // { -// if (err != NULL && err->Test()) +// if (err != nullptr && err->Test()) // { // m_errorOccurred = true; // m_lastError = err->GetGeneric(); @@ -154,7 +154,7 @@ int generateTemplate(File &definitionFp, File &templateFp) // we now need to move down the template definition heiarchy and write the // parameters of the base class - Filename basename(NULL, definitionFp.getFilename().getPath().c_str(), + Filename basename(nullptr, definitionFp.getFilename().getPath().c_str(), TemplateDefinitionFile.getBaseFilename().c_str(), TEMPLATE_DEFINITION_EXTENSION); if (basename.getName().size() == 0) return 0; @@ -185,8 +185,8 @@ int generateTemplate(File &definitionFp, File &templateFp) int generateTemplate(const char *definitionFile, const char *templateFile) { // check filename extensions - Filename defFile(NULL, NULL, definitionFile, TEMPLATE_DEFINITION_EXTENSION); - Filename temFile(NULL, NULL, templateFile, TEMPLATE_EXTENSION); + Filename defFile(nullptr, nullptr, definitionFile, TEMPLATE_DEFINITION_EXTENSION); + Filename temFile(nullptr, nullptr, templateFile, TEMPLATE_EXTENSION); File definitionFp; int i = 0; @@ -231,8 +231,8 @@ int generateTemplate(const char *definitionFile, const char *templateFile) int deriveTemplate(const char *baseFile, const char *templateFile) { // check filename extensions - Filename basFile(NULL, NULL, baseFile, TEMPLATE_EXTENSION); - Filename temFile(NULL, NULL, templateFile, TEMPLATE_EXTENSION); + Filename basFile(nullptr, nullptr, baseFile, TEMPLATE_EXTENSION); + Filename temFile(nullptr, nullptr, templateFile, TEMPLATE_EXTENSION); File basFp; if (!basFp.open(basFile, "rt")) @@ -263,7 +263,7 @@ int compileTemplate(const char *filename) { TpfFile templateFile; - Filename templateFileName(NULL, NULL, filename, TEMPLATE_EXTENSION); + Filename templateFileName(nullptr, nullptr, filename, TEMPLATE_EXTENSION); return templateFile.makeIffFiles(templateFileName); } // compileTemplate @@ -279,7 +279,7 @@ int verifyTemplate(const char *filename) TpfFile templateFile; printf("Verifying %s: ", filename); - Filename templateFileName(NULL, NULL, filename, TEMPLATE_EXTENSION); + Filename templateFileName(nullptr, nullptr, filename, TEMPLATE_EXTENSION); int result = templateFile.loadTemplate(templateFileName); if (result == 0) printf("file ok"); @@ -299,7 +299,7 @@ int updateTemplate(const char *filename) { TpfFile templateFile; - Filename templateFileName(NULL, NULL, filename, TEMPLATE_EXTENSION); + Filename templateFileName(nullptr, nullptr, filename, TEMPLATE_EXTENSION); return templateFile.updateTemplate(templateFileName); } // updateTemplate */ @@ -317,7 +317,7 @@ TpfFile templateFile; //Error e; // // // check filename extensions -// Filename templateFileName(NULL, NULL, filename, TEMPLATE_EXTENSION); +// Filename templateFileName(nullptr, nullptr, filename, TEMPLATE_EXTENSION); // Filename iffFileName = templateFileName; // iffFileName.setExtension(IFF_EXTENSION); // @@ -345,7 +345,7 @@ TpfFile templateFile; // IGNORE_RETURN(templateFile.loadTemplate(templateFileName)); // // // check out the client template iff file -// Filename iffName(NULL, templateFile.getIffPath().c_str(), iffFileName, IFF_EXTENSION); +// Filename iffName(nullptr, templateFile.getIffPath().c_str(), iffFileName, IFF_EXTENSION); // commands[1] = iffName; // client.SetArgv( 1, const_cast(&commands[1]) ); // client.Run( commands[0], &ui ); @@ -370,7 +370,7 @@ TpfFile templateFile; //Error e; // // // check filename extensions -// Filename templateFileName(NULL, NULL, filename, TEMPLATE_EXTENSION); +// Filename templateFileName(nullptr, nullptr, filename, TEMPLATE_EXTENSION); // Filename iffFileName = templateFileName; // iffFileName.setExtension(IFF_EXTENSION); // @@ -424,7 +424,7 @@ TpfFile templateFile; // return -1; // // // add the client iff file -// Filename iffName(NULL, templateFile.getIffPath().c_str(), iffFileName, NULL); +// Filename iffName(nullptr, templateFile.getIffPath().c_str(), iffFileName, nullptr); // commands[1] = iffName; // client.SetArgv( 1, const_cast(&commands[1]) ); // client.Run( commands[0], &ui ); @@ -591,7 +591,7 @@ int main(int argc, char *argv[ ]) SetupSharedFoundation::Data data(SetupSharedFoundation::Data::D_console); #ifdef WIN32 char buffer[1024]; - GetModuleFileName(GetModuleHandle(NULL), buffer, 1024); + GetModuleFileName(GetModuleHandle(nullptr), buffer, 1024); Filename configName; configName.setName(buffer); configName.setName("templateCompiler.cfg"); @@ -607,7 +607,7 @@ int main(int argc, char *argv[ ]) // setup the random number generator // @todo need a better seed - SetupSharedRandom::install(static_cast(time(NULL))); + SetupSharedRandom::install(static_cast(time(nullptr))); // install templates SetupSharedTemplate::install(); diff --git a/engine/shared/application/TemplateDefinitionCompiler/src/shared/core/TemplateDefinitionCompiler.cpp b/engine/shared/application/TemplateDefinitionCompiler/src/shared/core/TemplateDefinitionCompiler.cpp index f95e5c6c..a9af01dd 100755 --- a/engine/shared/application/TemplateDefinitionCompiler/src/shared/core/TemplateDefinitionCompiler.cpp +++ b/engine/shared/application/TemplateDefinitionCompiler/src/shared/core/TemplateDefinitionCompiler.cpp @@ -30,7 +30,7 @@ //============================================================================== // file variables -const TemplateData *currentTemplateData = NULL; +const TemplateData *currentTemplateData = nullptr; //============================================================================== @@ -118,7 +118,7 @@ File fp; return; File temp_fp; - if (!temp_fp.open(tmpnam(NULL), "wt")) + if (!temp_fp.open(tmpnam(nullptr), "wt")) { fprintf(stderr, "error opening temp file for template header " "replacement [%s]\n", temp_fp.getFilename().getFullFilename().c_str()); @@ -244,7 +244,7 @@ int result; } File temp_fp; - if (!temp_fp.open(tmpnam(NULL), "wt")) + if (!temp_fp.open(tmpnam(nullptr), "wt")) { fprintf(stderr, "error opening temp file for template source " "replacement [%s]\n", temp_fp.getFilename().getFullFilename().c_str()); @@ -337,8 +337,8 @@ int result; // std::string oldTemplateName = tdfFile.getTemplateName(); // std::string oldBaseName = tdfFile.getBaseName(); - Filename fullName(NULL, path.getPath().c_str(), tdfFile.getTemplateName().c_str(), - NULL); + Filename fullName(nullptr, path.getPath().c_str(), tdfFile.getTemplateName().c_str(), + nullptr); writeTemplateHeader(tdfFile, fullName); result = writeTemplateSource(tdfFile, fullName); @@ -397,7 +397,7 @@ TemplateDefinitionFile tdfFile; //Error e; // // // check filename extensions -// Filename templateFileName(NULL, NULL, filename, TEMPLATE_DEFINITION_EXTENSION); +// Filename templateFileName(nullptr, nullptr, filename, TEMPLATE_DEFINITION_EXTENSION); // // // Connect to Perforce server // client.Init( &e ); @@ -433,7 +433,7 @@ TemplateDefinitionFile tdfFile; // if (tdfFile.getPath().getFullFilename().size() != 0) // { // // check out the source files -// Filename sourceName(NULL, tdfFile.getPath().getPath().c_str(), +// Filename sourceName(nullptr, tdfFile.getPath().getPath().c_str(), // tdfFile.getTemplateName().c_str(), "cpp"); // commands[1] = sourceName; // client.SetArgv( 1, const_cast(&commands[1]) ); @@ -453,7 +453,7 @@ TemplateDefinitionFile tdfFile; // std::string compilerFilename; // compilerFilename = EnumLocationTypes[tdfFile.getTemplateLocation()] + // filenameLowerToUpper(templateFileName.getName()); -// Filename compilerName(NULL, tdfFile.getCompilerPath().getPath().c_str(), +// Filename compilerName(nullptr, tdfFile.getCompilerPath().getPath().c_str(), // tdfFile.getTemplateName().c_str(), "cpp"); // commands[1] = compilerName; // client.SetArgv( 1, const_cast(&commands[1]) ); @@ -485,7 +485,7 @@ TemplateDefinitionFile tdfFile; //Error e; // // // check filename extensions -// Filename templateFileName(NULL, NULL, filename, TEMPLATE_DEFINITION_EXTENSION); +// Filename templateFileName(nullptr, nullptr, filename, TEMPLATE_DEFINITION_EXTENSION); // // // find the client and server paths // File fp(templateFileName, "rt"); @@ -546,7 +546,7 @@ TemplateDefinitionFile tdfFile; // if (tdfFile.getPath().getFullFilename().size() != 0) // { // // check in the source files -// Filename sourceName(NULL, tdfFile.getPath().getPath().c_str(), +// Filename sourceName(nullptr, tdfFile.getPath().getPath().c_str(), // tdfFile.getTemplateName().c_str(), "cpp"); // commands[1] = sourceName; // client.SetArgv( 1, const_cast(&commands[1]) ); @@ -563,7 +563,7 @@ TemplateDefinitionFile tdfFile; // if (tdfFile.getCompilerPath().getFullFilename().size() != 0) // { // // check in the compiler source files -// Filename compilerName(NULL, tdfFile.getCompilerPath().getPath().c_str(), +// Filename compilerName(nullptr, tdfFile.getCompilerPath().getPath().c_str(), // tdfFile.getTemplateName().c_str(), "cpp"); // commands[1] = compilerName; // client.SetArgv( 1, const_cast(&commands[1]) ); @@ -669,7 +669,7 @@ int main(int argc, char *argv[ ]) SetupSharedFoundation::Data data(SetupSharedFoundation::Data::D_console); #ifdef WIN32 char buffer[1024]; - GetModuleFileName(GetModuleHandle(NULL), buffer, 1024); + GetModuleFileName(GetModuleHandle(nullptr), buffer, 1024); Filename configName; configName.setName(buffer); configName.setName("templateCompiler.cfg"); @@ -685,7 +685,7 @@ int main(int argc, char *argv[ ]) // setup the random number generator // @todo need a better seed - SetupSharedRandom::install(static_cast(time(NULL))); + SetupSharedRandom::install(static_cast(time(nullptr))); int result = processArgs(argc, argv); diff --git a/engine/shared/library/sharedCollision/src/shared/core/BarrierObject.cpp b/engine/shared/library/sharedCollision/src/shared/core/BarrierObject.cpp index 204984ad..1c853c1b 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/BarrierObject.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/BarrierObject.cpp @@ -38,14 +38,14 @@ public: virtual bool canCollideWith ( CollisionProperty const * otherCollision ) const { - if(otherCollision == NULL) + if(otherCollision == nullptr) { return false; } BarrierObject const * barrier = safe_cast(&getOwner()); - if(barrier == NULL) + if(barrier == nullptr) { return false; } @@ -180,7 +180,7 @@ void BarrierObject::createAppearance ( void ) Appearance * appearance = CellProperty::createPortalBarrier(verts,gs_barrierColor); - if(appearance != NULL) + if(appearance != nullptr) { setAppearance( appearance ); diff --git a/engine/shared/library/sharedCollision/src/shared/core/BoxTree.cpp b/engine/shared/library/sharedCollision/src/shared/core/BoxTree.cpp index 1f046513..7e2c011b 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/BoxTree.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/BoxTree.cpp @@ -156,8 +156,8 @@ BoxTreeNode::BoxTreeNode() : m_box(), m_index(-1), m_userId(-1), - m_childA(NULL), - m_childB(NULL) + m_childA(nullptr), + m_childB(nullptr) { } @@ -165,8 +165,8 @@ BoxTreeNode::BoxTreeNode ( AxialBox const & box, int userId ) : m_box(box), m_index(-1), m_userId(userId), - m_childA(NULL), - m_childB(NULL) + m_childA(nullptr), + m_childB(nullptr) { } @@ -195,10 +195,10 @@ void BoxTreeNode::drawDebugShapes ( DebugShapeRenderer * renderer, VectorArgb co #ifdef _DEBUG - if(m_childA == NULL) return; - if(m_childB == NULL) return; + if(m_childA == nullptr) return; + if(m_childB == nullptr) return; - if(renderer == NULL) return; + if(renderer == nullptr) return; VectorArgb newColor( color.a, color.r * 0.9f, color.g * 0.9f, color.b * 0.9f ); @@ -227,7 +227,7 @@ int BoxTreeNode::getNodeCount ( void ) const float BoxTreeNode::calcWeight ( void ) const { - if((m_childA == NULL) && (m_childB == NULL)) return 1.0f; + if((m_childA == nullptr) && (m_childB == nullptr)) return 1.0f; float accum = 0.0f; @@ -241,9 +241,9 @@ float BoxTreeNode::calcWeight ( void ) const float BoxTreeNode::calcBalance ( void ) const { - if((m_childA == NULL) && (m_childB == NULL)) return 1.0f; + if((m_childA == nullptr) && (m_childB == nullptr)) return 1.0f; - if((m_childA != NULL) && (m_childB != NULL)) + if((m_childA != nullptr) && (m_childB != nullptr)) { return m_childA->calcWeight() / m_childB->calcWeight(); } @@ -288,8 +288,8 @@ void BoxTreeNode::packInto ( BoxTreeNode * node, BoxTreeNode * base ) const node->m_box = m_box; node->m_index = m_index; - node->m_childA = m_childA ? (base + m_childA->m_index) : NULL; - node->m_childB = m_childB ? (base + m_childB->m_index) : NULL; + node->m_childA = m_childA ? (base + m_childA->m_index) : nullptr; + node->m_childB = m_childB ? (base + m_childB->m_index) : nullptr; node->m_userId = m_userId; } @@ -302,10 +302,10 @@ void BoxTreeNode::deleteChildren ( void ) if(m_childB) m_childB->deleteChildren(); delete m_childA; - m_childA = NULL; + m_childA = nullptr; delete m_childB; - m_childB = NULL; + m_childB = nullptr; } // ---------------------------------------------------------------------- @@ -341,8 +341,8 @@ void BoxTreeNode::read ( Iff & iff, BoxTreeNode * base ) int indexA = iff.read_int32(); int indexB = iff.read_int32(); - m_childA = ( indexA != -1 ? base + indexA : NULL ); - m_childB = ( indexB != -1 ? base + indexB : NULL ); + m_childA = ( indexA != -1 ? base + indexA : nullptr ); + m_childB = ( indexB != -1 ? base + indexB : nullptr ); } // ---------------------------------------------------------------------- @@ -361,7 +361,7 @@ bool BoxTreeNode::findClosest ( Vector const & V, float maxDistance, float & out // ---------- // Leaf node case - this leaf node is closer - if((m_childA == NULL) && (m_childB == NULL)) + if((m_childA == nullptr) && (m_childB == nullptr)) { outDistance = dist; outIndex = m_userId; @@ -417,8 +417,8 @@ void BoxTree::install() // ---------------------------------------------------------------------- BoxTree::BoxTree() -: m_flatNodes(NULL), - m_root(NULL), +: m_flatNodes(nullptr), + m_root(nullptr), m_testCounter(0) { } @@ -443,7 +443,7 @@ void BoxTree::build ( BoxVec const & boxes ) // ---------- - BoxTreeNodePVec nodes(boxes.size(),NULL); + BoxTreeNodePVec nodes(boxes.size(),nullptr); int boxcount = boxes.size(); @@ -488,7 +488,7 @@ void BoxTree::drawDebugShapes ( DebugShapeRenderer * renderer ) const #ifdef _DEBUG - if(renderer == NULL) return; + if(renderer == nullptr) return; if(m_root) m_root->drawDebugShapes( renderer, VectorArgb::solidWhite, 0 ); @@ -546,7 +546,7 @@ static inline void templateTestOverlapRecurse( BoxTreeNode const * node, TestSha template< class TestShape > static inline bool templateTestOverlap( BoxTree const & tree, TestShape const & testShape, IdVec & outIds ) { - if(tree.getRoot() == NULL) return false; + if(tree.getRoot() == nullptr) return false; int oldSize = outIds.size(); @@ -580,7 +580,7 @@ static inline void templateTestOverlapRecurse2( BoxTreeNode const * node, TestSh template< class TestShape > static inline bool templateTestOverlap2( BoxTree const & tree, TestShape const & testShape, IdVec & outIds ) { - if(tree.getRoot() == NULL) return false; + if(tree.getRoot() == nullptr) return false; int oldSize = outIds.size(); @@ -701,11 +701,11 @@ void BoxTree::clear ( void ) m_root->deleteChildren(); delete m_root; - m_root = NULL; + m_root = nullptr; } delete m_flatNodes; - m_flatNodes = NULL; + m_flatNodes = nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedCollision/src/shared/core/BoxTree.h b/engine/shared/library/sharedCollision/src/shared/core/BoxTree.h index 9a2d6545..d32e2fea 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/BoxTree.h +++ b/engine/shared/library/sharedCollision/src/shared/core/BoxTree.h @@ -108,7 +108,7 @@ inline int BoxTree::getTestCounter ( void ) const inline bool BoxTree::isFlat ( void ) const { - return m_flatNodes != NULL; + return m_flatNodes != nullptr; } // ====================================================================== diff --git a/engine/shared/library/sharedCollision/src/shared/core/CollisionBuckets.cpp b/engine/shared/library/sharedCollision/src/shared/core/CollisionBuckets.cpp index af528e5f..c3c6c5c0 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/CollisionBuckets.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/CollisionBuckets.cpp @@ -162,7 +162,7 @@ void CollisionBuckets::build(Vector const & minimumBounds, Vector const & maximu (*m_nodeMatrix)[xx].resize(m_bucketsAlongY); for (unsigned int yy = 0; yy < m_bucketsAlongY; ++yy) { - // note that nodes are initialized to NULL + // note that nodes are initialized to nullptr (*m_nodeMatrix)[xx][yy].resize(m_bucketsAlongZ, 0); } } diff --git a/engine/shared/library/sharedCollision/src/shared/core/CollisionMesh.cpp b/engine/shared/library/sharedCollision/src/shared/core/CollisionMesh.cpp index 80a0e930..cca52f64 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/CollisionMesh.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/CollisionMesh.cpp @@ -106,8 +106,8 @@ CollisionMesh::CollisionMesh() : CollisionSurface(), m_id(0), m_version(1), - m_boxTree(NULL), - m_extent(NULL), + m_boxTree(nullptr), + m_extent(nullptr), m_boundsDirty(true) { m_extent = new SimpleExtent( MultiShape(AxialBox()) ); @@ -116,10 +116,10 @@ CollisionMesh::CollisionMesh() CollisionMesh::~CollisionMesh() { delete m_boxTree; - m_boxTree = NULL; + m_boxTree = nullptr; delete m_extent; - m_extent = NULL; + m_extent = nullptr; } // ---------------------------------------------------------------------- @@ -154,7 +154,7 @@ BaseExtent const * CollisionMesh::getExtent_p ( void ) const void CollisionMesh::clear ( void ) { delete m_boxTree; - m_boxTree = NULL; + m_boxTree = nullptr; } // ---------------------------------------------------------------------- @@ -1010,7 +1010,7 @@ void CollisionMesh::transform( CollisionMesh const * sourceMesh, Transform const bool CollisionMesh::hasBoxTree ( void ) const { - return m_boxTree != NULL; + return m_boxTree != nullptr; } // ---------- diff --git a/engine/shared/library/sharedCollision/src/shared/core/CollisionNotification.cpp b/engine/shared/library/sharedCollision/src/shared/core/CollisionNotification.cpp index 6fba343e..2c5d349d 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/CollisionNotification.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/CollisionNotification.cpp @@ -75,7 +75,7 @@ void CollisionNotification::purgeQueue ( void ) Object * object = entry.m_object; - if(object == NULL) continue; + if(object == nullptr) continue; if(entry.m_added) { diff --git a/engine/shared/library/sharedCollision/src/shared/core/CollisionProperty.cpp b/engine/shared/library/sharedCollision/src/shared/core/CollisionProperty.cpp index 5e22c064..b8cc9332 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/CollisionProperty.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/CollisionProperty.cpp @@ -44,7 +44,7 @@ namespace CollisionPropertyNamespace { - CollisionProperty * ms_activeListHead = NULL; + CollisionProperty * ms_activeListHead = nullptr; }; using namespace CollisionPropertyNamespace; @@ -64,8 +64,8 @@ void CollisionProperty::detachList ( void ) ms_activeListHead = m_next; } - m_prev = NULL; - m_next = NULL; + m_prev = nullptr; + m_next = nullptr; } // ---------- @@ -76,7 +76,7 @@ void CollisionProperty::attachList ( CollisionProperty * & head ) if(head) head->m_prev = this; - m_prev = NULL; + m_prev = nullptr; m_next = head; head = this; @@ -129,7 +129,7 @@ CollisionProperty * CollisionProperty::getActiveHead ( void ) Transform getTransform_o2c( Object const * object ) { - if(object == NULL) return Transform::identity; + if(object == nullptr) return Transform::identity; // If this object is a cell, its o2c transform is the identity transform @@ -164,23 +164,23 @@ CollisionProperty::CollisionProperty( Object & owner ) : Property( CollisionProperty::getClassPropertyId(), owner ), m_lastTransform_w(Transform::identity), m_lastTransform_p(Transform::identity), - m_lastCellObject(NULL), + m_lastCellObject(nullptr), m_stepHeight(0.0f), m_defaultRadius(0.0f), m_offsetX(0.0f), m_offsetZ(0.0f), m_extentsDirty(true), - m_extent_l(NULL), - m_extent_p(NULL), + m_extent_l(nullptr), + m_extent_p(nullptr), m_sphere_l(), m_sphere_w(), m_scale(owner.getScale().x), - m_spatialSubdivisionHandle(NULL), - m_floor(NULL), - m_footprint(NULL), + m_spatialSubdivisionHandle(nullptr), + m_floor(nullptr), + m_footprint(nullptr), m_idleCounter(3), - m_next(NULL), - m_prev(NULL), + m_next(nullptr), + m_prev(nullptr), m_flags(F_collidable), m_spatialDatabaseStorageType(SpatialDatabase::Q_None) { @@ -200,7 +200,7 @@ CollisionProperty::CollisionProperty( Object & owner ) { char const * const found = strstr(templateName,"lair"); - if(found != NULL) + if(found != nullptr) { setCollidable(false); } @@ -214,23 +214,23 @@ CollisionProperty::CollisionProperty( Object & owner, SharedObjectTemplate const : Property( CollisionProperty::getClassPropertyId(), owner ), m_lastTransform_w(Transform::identity), m_lastTransform_p(Transform::identity), - m_lastCellObject(NULL), + m_lastCellObject(nullptr), m_stepHeight(0.0f), m_defaultRadius(0.0f), m_offsetX(0.0f), m_offsetZ(0.0f), m_extentsDirty(true), - m_extent_l(NULL), - m_extent_p(NULL), + m_extent_l(nullptr), + m_extent_p(nullptr), m_sphere_l(), m_sphere_w(), m_scale(owner.getScale().x), - m_spatialSubdivisionHandle(NULL), - m_floor(NULL), - m_footprint(NULL), + m_spatialSubdivisionHandle(nullptr), + m_floor(nullptr), + m_footprint(nullptr), m_idleCounter(3), - m_next(NULL), - m_prev(NULL), + m_next(nullptr), + m_prev(nullptr), m_flags(F_collidable), m_spatialDatabaseStorageType(SpatialDatabase::Q_None) { @@ -248,7 +248,7 @@ CollisionProperty::CollisionProperty( Object & owner, SharedObjectTemplate const { char const * const found = strstr(templateName,"lair"); - if(found != NULL) + if(found != nullptr) { setCollidable(false); } @@ -373,7 +373,7 @@ CollisionProperty::~CollisionProperty() static_cast::NodeHandle *>(m_spatialSubdivisionHandle)->removeObject(); - m_spatialSubdivisionHandle = NULL; + m_spatialSubdivisionHandle = nullptr; } FATAL(CollisionWorld::isUpdating(),("CollisionProperty::~CollisionProperty - Trying to destroy a collision property while the collision world is updating. This is baaaad\n")); @@ -382,16 +382,16 @@ CollisionProperty::~CollisionProperty() detachList(); delete m_extent_l; - m_extent_l = NULL; + m_extent_l = nullptr; delete m_extent_p; - m_extent_p = NULL; + m_extent_p = nullptr; delete m_floor; - m_floor = NULL; + m_floor = nullptr; delete m_footprint; - m_footprint = NULL; + m_footprint = nullptr; } @@ -405,7 +405,7 @@ void CollisionProperty::attachSourceExtent ( BaseExtent * newSourceExtent ) cons m_extent_l = newSourceExtent; delete m_extent_p; - m_extent_p = NULL; + m_extent_p = nullptr; m_extentsDirty = true; } @@ -437,12 +437,12 @@ void CollisionProperty::initFloor ( void ) if (isMobile()) return; - if(m_floor != NULL) + if(m_floor != nullptr) return; // ---------- - char const *floorName = NULL; + char const *floorName = nullptr; Appearance * appearance = getOwner().getAppearance(); if(appearance) @@ -487,7 +487,7 @@ void CollisionProperty::addToCollisionWorld ( void ) if (getOwner().getNetworkId() < NetworkId::cms_invalid) { delete m_footprint; - m_footprint = NULL; + m_footprint = nullptr; } if (m_footprint) @@ -534,7 +534,7 @@ Transform CollisionProperty::getTransform_o2c ( void ) const BaseExtent * convertToSimpleExtent ( BaseExtent const * sourceExtent ) { - if(!sourceExtent) return NULL; + if(!sourceExtent) return nullptr; switch(sourceExtent->getType()) { @@ -549,7 +549,7 @@ BaseExtent * convertToSimpleExtent ( BaseExtent const * sourceExtent ) { Extent const * extent = safe_cast(sourceExtent); - if(!extent) return NULL; + if(!extent) return nullptr; return new SimpleExtent( MultiShape( extent->getShape() ) ); } @@ -558,7 +558,7 @@ BaseExtent * convertToSimpleExtent ( BaseExtent const * sourceExtent ) { CylinderExtent const * extent = safe_cast(sourceExtent); - if(!extent) return NULL; + if(!extent) return nullptr; return new SimpleExtent( MultiShape( extent->getShape() ) ); } @@ -567,7 +567,7 @@ BaseExtent * convertToSimpleExtent ( BaseExtent const * sourceExtent ) { BoxExtent const * extent = safe_cast(sourceExtent); - if(!extent) return NULL; + if(!extent) return nullptr; return new SimpleExtent( MultiShape( extent->getShape() ) ); } @@ -576,7 +576,7 @@ BaseExtent * convertToSimpleExtent ( BaseExtent const * sourceExtent ) { MeshExtent const * extent = safe_cast(sourceExtent); - if(!extent) return NULL; + if(!extent) return nullptr; return extent->clone(); } @@ -585,7 +585,7 @@ BaseExtent * convertToSimpleExtent ( BaseExtent const * sourceExtent ) { DetailExtent const * extent = safe_cast(sourceExtent); - if(!extent) return NULL; + if(!extent) return nullptr; DetailExtent * newExtent = new DetailExtent(); @@ -603,7 +603,7 @@ BaseExtent * convertToSimpleExtent ( BaseExtent const * sourceExtent ) { ComponentExtent const * extent = safe_cast(sourceExtent); - if(!extent) return NULL; + if(!extent) return nullptr; ComponentExtent * newExtent = new ComponentExtent(); @@ -623,7 +623,7 @@ BaseExtent * convertToSimpleExtent ( BaseExtent const * sourceExtent ) case ET_Null: case ET_ExtentTypeCount: default: - return NULL; + return nullptr; } } @@ -653,10 +653,10 @@ void CollisionProperty::updateExtents ( void ) const if(m_scale != newScale) { delete m_extent_l; - m_extent_l = NULL; + m_extent_l = nullptr; delete m_extent_p; - m_extent_p = NULL; + m_extent_p = nullptr; m_scale = newScale; } @@ -960,7 +960,7 @@ void CollisionProperty::drawDebugShapes ( DebugShapeRenderer * renderer ) const #ifdef _DEBUG - if(renderer == NULL) return; + if(renderer == nullptr) return; if(ConfigSharedCollision::getDrawExtents()) { @@ -1274,9 +1274,9 @@ void CollisionProperty::setLastPos ( CellProperty * cell, Transform const & tran { NAN_CHECK(transform_p); - if(cell == NULL) + if(cell == nullptr) { - m_lastCellObject = NULL; + m_lastCellObject = nullptr; m_lastTransform_p = transform_p; m_lastTransform_w = transform_p; } @@ -1298,7 +1298,7 @@ Object const * CollisionProperty::getStandingOn ( void ) const } else { - return NULL; + return nullptr; } } diff --git a/engine/shared/library/sharedCollision/src/shared/core/CollisionResolve.cpp b/engine/shared/library/sharedCollision/src/shared/core/CollisionResolve.cpp index 0638c13c..759a5f30 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/CollisionResolve.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/CollisionResolve.cpp @@ -87,7 +87,7 @@ namespace CollisionResolveNamespace FloorContactList ms_floorContactList; - Floor const * ms_ignoreFloor = NULL; + Floor const * ms_ignoreFloor = nullptr; int ms_ignoreTriId = -1; int ms_ignoreEdge = -1; Vector ms_ignoreNormal = Vector::zero; @@ -312,7 +312,7 @@ ResolutionResult CollisionResolve::resolveCollisions(CollisionProperty * collide if(result == RR_Resolved) { - colliderA->hitBy(NULL); + colliderA->hitBy(nullptr); colliderA->setExtentsDirty(true); Vector resetPos = moveSeg.getBegin(moveSeg.m_cellB); @@ -339,7 +339,7 @@ ResolutionResult CollisionResolve::resolveCollisions ( CellProperty const * cell const int iterationCount = 8; - ms_ignoreFloor = NULL; + ms_ignoreFloor = nullptr; ms_ignoreTriId = -1; ms_ignoreEdge = -1; ms_ignoreTime = REAL_MAX; @@ -484,12 +484,12 @@ ResolutionResult CollisionResolve::resolveCollisions ( CellProperty const * cell // ---------- // Remove the hit obstacle from the extent list - if(obstacleList->at(minIndex).m_extent != NULL) + if(obstacleList->at(minIndex).m_extent != nullptr) { obstacleList->at(minIndex) = obstacleList->back(); obstacleList->resize(obstacleList->size()-1); - ms_ignoreFloor = NULL; + ms_ignoreFloor = nullptr; ms_ignoreTriId = -1; ms_ignoreEdge = -1; ms_ignoreTime = REAL_MAX; @@ -561,13 +561,13 @@ void CollisionResolve::explodeExtent ( CellProperty const * cell, BaseExtent con void CollisionResolve::explodeFootprint ( Footprint * foot, ObstacleList & obstacleList, FloorContactList & floorContacts ) { - if(foot == NULL) return; + if(foot == nullptr) return; for(ContactIterator it(foot->getFloorList()); it; ++it) { FloorContactShape * contact = (*it); - if(contact == NULL) + if(contact == nullptr) continue; obstacleList.push_back( ObstacleInfo(contact->m_contact.getCell(),contact) ); @@ -594,7 +594,7 @@ void CollisionResolve::explodeCollider(CollisionProperty * colliderA, ColliderLi { CollisionProperty const * const colliderB = *ii; - if(colliderB == NULL) continue; + if(colliderB == nullptr) continue; BaseExtent const * const extentB = colliderB->getExtent_p(); @@ -613,7 +613,7 @@ void CollisionResolve::explodeCollider(CollisionProperty * colliderA, ColliderLi { FloorContactShape * const contact = (*it); - if(contact == NULL) continue; + if(contact == nullptr) continue; ms_floorContactList.push_back(contact); } @@ -713,7 +713,7 @@ Contact CollisionResolve::findContactWithFloor ( FloorContactShape * floorContac Floor const * floor = loc.getFloor(); - if(floor == NULL) return Contact::noContact; + if(floor == nullptr) return Contact::noContact; CellProperty const * floorCell = loc.getCell(); @@ -740,7 +740,7 @@ Contact CollisionResolve::findContactWithFloor ( FloorContactShape * floorContac return Contact::noContact; } - if((ms_ignoreFloor == NULL) || (floor != ms_ignoreFloor)) + if((ms_ignoreFloor == nullptr) || (floor != ms_ignoreFloor)) { walkResult = floor->canMove(loc,delta,-1,-1,result); } @@ -776,7 +776,7 @@ Contact CollisionResolve::findContactWithFloor ( FloorContactShape * floorContac tempContact.m_surfaceId2 = result.getHitEdgeId(); tempContact.m_cell = floorCell; - tempContact.m_extent = NULL; + tempContact.m_extent = nullptr; tempContact.m_surface = result.getFloor(); } } diff --git a/engine/shared/library/sharedCollision/src/shared/core/CollisionResolve.h b/engine/shared/library/sharedCollision/src/shared/core/CollisionResolve.h index 7e4b9e44..77bf73b0 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/CollisionResolve.h +++ b/engine/shared/library/sharedCollision/src/shared/core/CollisionResolve.h @@ -27,22 +27,22 @@ class Floor; struct ObstacleInfo { ObstacleInfo() - : m_cell(NULL), - m_extent(NULL), - m_floorContact(NULL) + : m_cell(nullptr), + m_extent(nullptr), + m_floorContact(nullptr) { } ObstacleInfo ( CellProperty const * cell, SimpleExtent const * extent ) : m_cell(cell), m_extent(extent), - m_floorContact(NULL) + m_floorContact(nullptr) { } ObstacleInfo ( CellProperty const * cell, FloorContactShape * contact ) : m_cell(cell), - m_extent(NULL), + m_extent(nullptr), m_floorContact(contact) { } diff --git a/engine/shared/library/sharedCollision/src/shared/core/CollisionUtils.cpp b/engine/shared/library/sharedCollision/src/shared/core/CollisionUtils.cpp index 4c994abf..5d8192b5 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/CollisionUtils.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/CollisionUtils.cpp @@ -881,7 +881,7 @@ void MergePolyPoly ( VertexList & polyA, VertexList & polyB, VertexList & outPol void BuildConvexHull ( Vector const * sortedVerts, int vertCount, VertexList & outPoly ) { - if(sortedVerts == NULL) return; + if(sortedVerts == nullptr) return; if(vertCount <= 0) return; if(vertCount == 1) { outPoly.push_back(sortedVerts[0]); return; } @@ -1104,7 +1104,7 @@ RangeLoop CalcAvoidanceThetas ( Sphere const & S, BaseExtent const * extent ); RangeLoop CalcAvoidanceThetas ( Sphere const & S, SimpleExtent const * extent ) { - if(extent == NULL) return RangeLoop::empty; + if(extent == nullptr) return RangeLoop::empty; return CalcAvoidanceThetas(S,extent->getShape()); } @@ -1113,7 +1113,7 @@ RangeLoop CalcAvoidanceThetas ( Sphere const & S, SimpleExtent const * extent ) RangeLoop CalcAvoidanceThetas ( Sphere const & S, ComponentExtent const * extent ) { - if(extent == NULL) return RangeLoop::empty; + if(extent == nullptr) return RangeLoop::empty; RangeLoop range = RangeLoop::empty; @@ -1123,7 +1123,7 @@ RangeLoop CalcAvoidanceThetas ( Sphere const & S, ComponentExtent const * extent { BaseExtent const * child = extent->getExtent(i); - if(child == NULL) continue; + if(child == nullptr) continue; RangeLoop temp = CalcAvoidanceThetas(S,child); @@ -1137,13 +1137,13 @@ RangeLoop CalcAvoidanceThetas ( Sphere const & S, ComponentExtent const * extent RangeLoop CalcAvoidanceThetas ( Sphere const & S, DetailExtent const * extent ) { - if(extent == NULL) return RangeLoop::empty; + if(extent == nullptr) return RangeLoop::empty; int count = extent->getExtentCount(); BaseExtent const * child = extent->getExtent(count - 1); - if(child == NULL) return RangeLoop::empty; + if(child == nullptr) return RangeLoop::empty; return CalcAvoidanceThetas(S,child); } @@ -1152,7 +1152,7 @@ RangeLoop CalcAvoidanceThetas ( Sphere const & S, DetailExtent const * extent ) RangeLoop CalcAvoidanceThetas ( Sphere const & S, BaseExtent const * extent ) { - if(extent == NULL) return RangeLoop::empty; + if(extent == nullptr) return RangeLoop::empty; ExtentType type = extent->getType(); @@ -1176,7 +1176,7 @@ RangeLoop CalcAvoidanceThetas ( Sphere const & S, ExtentVec const & extents ) { BaseExtent const * child = extents[i]; - if(child == NULL) continue; + if(child == nullptr) continue; RangeLoop temp = CalcAvoidanceThetas(S,child); @@ -1367,7 +1367,7 @@ void explodeObstacle ( Sphere const & sphere, Vector const & delta, SimpleExtent void explodeObstacle ( Sphere const & sphere, Vector const & delta, DetailExtent const * extent, ExtentVec & outList ) { - if(extent == NULL) return; + if(extent == nullptr) return; int count = extent->getExtentCount(); @@ -1376,7 +1376,7 @@ void explodeObstacle ( Sphere const & sphere, Vector const & delta, DetailExtent void explodeObstacle ( Sphere const & sphere, Vector const & delta, ComponentExtent const * extent, ExtentVec & outList ) { - if(extent == NULL) return; + if(extent == nullptr) return; int count = extent->getExtentCount(); @@ -1388,7 +1388,7 @@ void explodeObstacle ( Sphere const & sphere, Vector const & delta, ComponentExt void explodeObstacle ( Sphere const & sphere, Vector const & delta, BaseExtent const * extent, ExtentVec & outList ) { - if(extent == NULL) return; + if(extent == nullptr) return; ExtentType type = extent->getType(); @@ -1411,7 +1411,7 @@ void explodeObstacle ( Sphere const & sphere, Vector const & delta, ExtentVec co bool CalcAvoidancePoint ( Sphere const & sphere, Transform const & sphereTransform_p2w, Vector const & delta, CollisionProperty const * obstacle, Vector & out ) { - if(obstacle == NULL) return false; + if(obstacle == nullptr) return false; static ExtentVec tempExtents; @@ -1455,12 +1455,12 @@ bool CalcAvoidancePoint ( Sphere const & sphere, Transform const & sphereTransfo bool CalcAvoidancePoint ( CollisionProperty const * mob, Vector const & delta, CollisionProperty const * obstacle, Vector & out ) { - if(mob == NULL) return false; - if(obstacle == NULL) return false; + if(mob == nullptr) return false; + if(obstacle == nullptr) return false; BaseExtent const * mobExtent = mob->getExtent_p(); - if(mobExtent == NULL) return false; + if(mobExtent == nullptr) return false; Sphere mobSphere = mobExtent->getBoundingSphere(); @@ -1471,8 +1471,8 @@ bool CalcAvoidancePoint ( CollisionProperty const * mob, Vector const & delta, C bool CalcAvoidancePoint ( Object const * mob, Vector const & delta, Object const * obstacle, Vector & out ) { - if(mob == NULL) return false; - if(obstacle == NULL) return false; + if(mob == nullptr) return false; + if(obstacle == nullptr) return false; CollisionProperty const * mobCollision = mob->getCollisionProperty(); CollisionProperty const * obstacleCollision = obstacle->getCollisionProperty(); @@ -1601,8 +1601,8 @@ Vector transformToCell ( CellProperty const * cellA, Vector const & point_A, Cel { CellProperty const * worldCell = CellProperty::getWorldCellProperty(); - if(cellA == NULL) cellA = worldCell; - if(cellB == NULL) cellB = worldCell; + if(cellA == nullptr) cellA = worldCell; + if(cellB == nullptr) cellB = worldCell; if(cellA == cellB) return point_A; @@ -1627,8 +1627,8 @@ Vector rotateToCell ( CellProperty const * cellA, Vector const & point_A, CellPr { CellProperty const * worldCell = CellProperty::getWorldCellProperty(); - if(cellA == NULL) cellA = worldCell; - if(cellB == NULL) cellB = worldCell; + if(cellA == nullptr) cellA = worldCell; + if(cellB == nullptr) cellB = worldCell; if(cellA == cellB) return point_A; @@ -1655,8 +1655,8 @@ Transform transformToCell ( CellProperty const * cellA, Transform const & transf { CellProperty const * worldCell = CellProperty::getWorldCellProperty(); - if(cellA == NULL) cellA = worldCell; - if(cellB == NULL) cellB = worldCell; + if(cellA == nullptr) cellA = worldCell; + if(cellB == nullptr) cellB = worldCell; if(cellA == cellB) return transform_A; @@ -1743,8 +1743,8 @@ MultiShape transformToCell ( CellProperty const * cellA, MultiShape const & shap bool testPortalVis ( CellProperty const * cellA, Vector const & pointA, CellProperty const * cellB, Vector const & pointB ) { - if(cellA == NULL) return false; - if(cellB == NULL) return false; + if(cellA == nullptr) return false; + if(cellB == nullptr) return false; float hitTime = 0.0f; @@ -1753,7 +1753,7 @@ bool testPortalVis ( CellProperty const * cellA, Vector const & pointA, CellProp if(cellA == cellB) { - return cellA->getDestinationCell(pointA,pointB,hitTime) == NULL; + return cellA->getDestinationCell(pointA,pointB,hitTime) == nullptr; } // ---------- diff --git a/engine/shared/library/sharedCollision/src/shared/core/CollisionWorld.cpp b/engine/shared/library/sharedCollision/src/shared/core/CollisionWorld.cpp index 29d98133..61b199f9 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/CollisionWorld.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/CollisionWorld.cpp @@ -71,7 +71,7 @@ namespace CollisionWorldNamespace // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SpatialDatabase * ms_database = NULL; + SpatialDatabase * ms_database = nullptr; bool ms_updating = false; bool ms_serverSide = false; @@ -94,7 +94,7 @@ namespace CollisionWorldNamespace bool testPassableTerrain(Vector const & startPos, Vector const & delta, float & collisionTime) { TerrainObject const *const terrainObject = TerrainObject::getConstInstance(); - if (NULL != terrainObject) + if (nullptr != terrainObject) { float totalDistance = delta.magnitude(); float distanceTraversed = 0.0f; @@ -134,7 +134,7 @@ namespace CollisionWorldNamespace return; TerrainObject const *const terrainObject = TerrainObject::getConstInstance(); - if (NULL != terrainObject && terrainObject->hasPassableAffectors()) + if (nullptr != terrainObject && terrainObject->hasPassableAffectors()) { // pointA_w is *not* the previous world position, but actually the world @@ -289,7 +289,7 @@ bool CollisionWorldNamespace::testFloorCollision(FloorLocator const &startFloorL if (!floor) { // For some reason this solid floor does not have an attached floor. No collision. - WARNING(true, ("testFloorCollision(): attempted to test floor with a starting floor locator that had a NULL floor, unexpected. Check calling code's assumptions.")); + WARNING(true, ("testFloorCollision(): attempted to test floor with a starting floor locator that had a nullptr floor, unexpected. Check calling code's assumptions.")); return true; } @@ -319,7 +319,7 @@ bool CollisionWorldNamespace::testFloorCollision(FloorLocator const &startFloorL // if statement above. WARNING(true, ("testFloorCollision(): floor collision occurred while checking for floor collisions for floor of object id [%s] but collision floor location has no associated floor. Calling this a non-collision. PathWalkResult was [%d].", - floor->getOwner() ? floor->getOwner()->getNetworkId().getValueString().c_str() : "", + floor->getOwner() ? floor->getOwner()->getNetworkId().getValueString().c_str() : "", static_cast(pathWalkResult) )); return false; @@ -328,8 +328,8 @@ bool CollisionWorldNamespace::testFloorCollision(FloorLocator const &startFloorL collisionObject = destinationFloor->getOwner(); if (!collisionObject) { - // We had a collision on a floor, but the floor had a NULL owner. Consider this a non-collision. - WARNING(true, ("testFloorCollision(): floor collision occurred, destination collision floor location had a floor but floor reported a NULL owner. Calling this a non-collision.")); + // We had a collision on a floor, but the floor had a nullptr owner. Consider this a non-collision. + WARNING(true, ("testFloorCollision(): floor collision occurred, destination collision floor location had a floor but floor reported a nullptr owner. Calling this a non-collision.")); return false; } @@ -447,11 +447,11 @@ void CollisionWorld::remove ( void ) CollisionResolve::remove(); FloorMesh::remove(); - s_nearWarpWarningCallback = NULL; - s_farWarpWarningCallback = NULL; + s_nearWarpWarningCallback = nullptr; + s_farWarpWarningCallback = nullptr; delete ms_database; - ms_database = NULL; + ms_database = nullptr; } // ---------------------------------------------------------------------- @@ -595,7 +595,7 @@ bool CollisionWorld::spatialSweepAndResolve(CollisionProperty * collider) void CollisionWorld::update(CollisionProperty * collider, float time) { - FATAL(!collider, ("CollisionWorld::update(): collider is NULL.")); + FATAL(!collider, ("CollisionWorld::update(): collider is nullptr.")); PROFILER_AUTO_BLOCK_DEFINE("CollisionWorld::update"); @@ -603,9 +603,9 @@ void CollisionWorld::update(CollisionProperty * collider, float time) Footprint * foot = collider->getFootprint(); - if(foot == NULL) + if(foot == nullptr) { - PROFILER_AUTO_BLOCK_DEFINE("CollisionWorld::update: foot == NULL"); + PROFILER_AUTO_BLOCK_DEFINE("CollisionWorld::update: foot == nullptr"); IGNORE_RETURN (CollisionWorld::spatialSweepAndResolve(collider)); collider->storePosition(); @@ -1076,11 +1076,11 @@ void CollisionWorld::setFarWarpWarningCallback(WarpWarningCallback callback) void CollisionWorld::addObject ( Object * object ) { - if(object == NULL) return; + if(object == nullptr) return; CollisionProperty * collision = object->getCollisionProperty(); - if((collision == NULL) || collision->getDisableCollisionWorldAddRemove()) return; + if((collision == nullptr) || collision->getDisableCollisionWorldAddRemove()) return; if(collision->isInCollisionWorld()) return; @@ -1125,7 +1125,7 @@ void CollisionWorld::addObject ( Object * object ) { char const * name = object->getObjectTemplateName(); - if(name == NULL) + if(name == nullptr) { Appearance const * appearance = object->getAppearance(); @@ -1162,11 +1162,11 @@ void CollisionWorld::addObject ( Object * object ) void CollisionWorld::removeObject ( Object * object ) { - if(object == NULL) return; + if(object == nullptr) return; CollisionProperty * collision = object->getCollisionProperty(); - if((collision == NULL) || collision->getDisableCollisionWorldAddRemove()) return; + if((collision == nullptr) || collision->getDisableCollisionWorldAddRemove()) return; if(!collision->isInCollisionWorld()) return; @@ -1218,11 +1218,11 @@ void CollisionWorld::removeObject ( Object * object ) void CollisionWorld::moveObject (Object * object) { - if(object == NULL) return; + if(object == nullptr) return; CollisionProperty * collision = object->getCollisionProperty(); - if(collision == NULL) return; + if(collision == nullptr) return; if(!collision->isInCollisionWorld()) return; @@ -1248,11 +1248,11 @@ void CollisionWorld::moveObject (Object * object) void CollisionWorld::cellChanged ( Object * object ) { - if(object == NULL) return; + if(object == nullptr) return; CollisionProperty * collision = object->getCollisionProperty(); - if(collision == NULL) return; + if(collision == nullptr) return; if(!collision->isInCollisionWorld()) return; @@ -1266,11 +1266,11 @@ void CollisionWorld::cellChanged ( Object * object ) void CollisionWorld::appearanceChanged ( Object * object ) { - if(object == NULL) return; + if(object == nullptr) return; CollisionProperty * collision = object->getCollisionProperty(); - if(collision == NULL) return; + if(collision == nullptr) return; if(!collision->isInCollisionWorld()) return; @@ -1333,12 +1333,12 @@ SpatialDatabase * CollisionWorld::getDatabase ( void ) void CollisionWorld::objectWarped ( Object * object ) { - if(object == NULL) return; + if(object == nullptr) return; CollisionProperty * collision = object->getCollisionProperty(); // object does not have a CollisionProperty - if(collision == NULL) return; + if(collision == nullptr) return; // object is not in CollisionWorld if (!collision->isInCollisionWorld()) return; @@ -1458,7 +1458,7 @@ QueryInteractionResult CollisionWorld::queryInteraction ( CellProperty const * c if(hitTime < hitPortalTime) { outHitTime = hitTime; - outHitObject = NULL; + outHitObject = nullptr; return QIR_HitTerrain; } @@ -1472,12 +1472,12 @@ QueryInteractionResult CollisionWorld::queryInteraction ( CellProperty const * c // If we did not hit a portal, the query ends in this cell. // If this cell is not the goal cell, then the query fails. - if(nextCell == NULL) + if(nextCell == nullptr) { if(cellA != cellB) { outHitTime = 1.0f; - outHitObject = NULL; + outHitObject = nullptr; return QIR_MissedTarget; } @@ -1702,7 +1702,7 @@ CanMoveResult CollisionWorld::canMove ( CellProperty const * startCell, FloorLocator dummy; - return canMove( NULL, startCell, startLoc, goalPos, checkY, checkFlora, checkFauna, dummy ); + return canMove( nullptr, startCell, startLoc, goalPos, checkY, checkFlora, checkFauna, dummy ); } // ---------- @@ -1714,7 +1714,7 @@ CanMoveResult CollisionWorld::canMove ( Object const * object, bool checkFlora, bool checkFauna ) { - if(object == NULL) + if(object == nullptr) { return CMR_Error; } @@ -1766,7 +1766,7 @@ CanMoveResult CollisionWorld::canMove ( Object const * object, bool checkFauna, FloorLocator & endLoc ) { - if(startCell == NULL) + if(startCell == nullptr) { startCell = CellProperty::getWorldCellProperty(); } @@ -1858,7 +1858,7 @@ CanMoveResult CollisionWorld::canMove ( Object const * object, } // ---------- -// A NULL goal cell means we don't care what cell we end up in as long as we make it to the goal +// A nullptr goal cell means we don't care what cell we end up in as long as we make it to the goal CanMoveResult CollisionWorld::canMove ( Object const * object, CellProperty const * startCell, @@ -1871,12 +1871,12 @@ CanMoveResult CollisionWorld::canMove ( Object const * object, { // ---------- - if(startCell == NULL) + if(startCell == nullptr) { startCell = CellProperty::getWorldCellProperty(); } - if(goalCell == NULL) + if(goalCell == nullptr) { FloorLocator dummy; @@ -2233,17 +2233,17 @@ bool CollisionWorld::findFirstObstacle ( Object const * creature, float creature Vector delta = testPos - startPos; - if(creature == NULL) return false; + if(creature == nullptr) return false; CollisionProperty const * collision = creature->getCollisionProperty(); - if(collision == NULL) return false; + if(collision == nullptr) return false; BaseExtent const * baseExtent = collision->getExtent_p(); SimpleExtent const * simpleExtent = dynamic_cast(baseExtent); - if(simpleExtent == NULL) return false; + if(simpleExtent == nullptr) return false; MultiShape const & shape = simpleExtent->getShape(); @@ -2253,7 +2253,7 @@ bool CollisionWorld::findFirstObstacle ( Object const * creature, float creature // Test collision extents DetectResult minResult; - Object const * minObject = NULL; + Object const * minObject = nullptr; typedef std::vector ObjectVector; static ObjectVector statics; @@ -2262,7 +2262,7 @@ bool CollisionWorld::findFirstObstacle ( Object const * creature, float creature statics.clear(); creatures.clear(); - if(ms_database->queryObjects(creature->getParentCell(), shape, delta, (testStatics ? &statics : NULL), (testCreatures ? &creatures : NULL))) + if(ms_database->queryObjects(creature->getParentCell(), shape, delta, (testStatics ? &statics : nullptr), (testCreatures ? &creatures : nullptr))) { ObjectVector::size_type const nStatics = statics.size(); ObjectVector::size_type i; @@ -2271,7 +2271,7 @@ bool CollisionWorld::findFirstObstacle ( Object const * creature, float creature { Object const * obstacle = statics[i]; - if(obstacle == NULL) continue; + if(obstacle == nullptr) continue; if(obstacle == creature) continue; @@ -2292,7 +2292,7 @@ bool CollisionWorld::findFirstObstacle ( Object const * creature, float creature { Object const * obstacle = creatures[i]; - if(obstacle == NULL) continue; + if(obstacle == nullptr) continue; if(obstacle == creature) continue; @@ -2310,10 +2310,10 @@ bool CollisionWorld::findFirstObstacle ( Object const * creature, float creature //-- Check for floor collisions. Footprint const *const footprint = collision->getFootprint(); - FloorLocator const *const floorLocator = (footprint ? footprint->getAnyContact() : NULL); + FloorLocator const *const floorLocator = (footprint ? footprint->getAnyContact() : nullptr); if (floorLocator) { - Object const *floorCollisionObject = NULL; + Object const *floorCollisionObject = nullptr; Vector collisionLocation_w; // Do the floor check. @@ -2372,7 +2372,7 @@ bool CollisionWorld::findFirstObstacle ( Sphere const & sphere, Vector const & g // Test collision extents DetectResult minResult; - Object const * minObject = NULL; + Object const * minObject = nullptr; static std::vector statics; static std::vector creatures; @@ -2380,7 +2380,7 @@ bool CollisionWorld::findFirstObstacle ( Sphere const & sphere, Vector const & g statics.clear(); creatures.clear(); - if(ms_database->queryObjects(CellProperty::getWorldCellProperty(), shape, delta, (testStatics ? &statics : NULL), (testCreatures ? &creatures : NULL))) + if(ms_database->queryObjects(CellProperty::getWorldCellProperty(), shape, delta, (testStatics ? &statics : nullptr), (testCreatures ? &creatures : nullptr))) { size_t const nStatics = statics.size(); size_t i; @@ -2389,7 +2389,7 @@ bool CollisionWorld::findFirstObstacle ( Sphere const & sphere, Vector const & g { Object const * obstacle = statics[i]; - if(obstacle == NULL) continue; + if(obstacle == nullptr) continue; DetectResult result = CollisionDetect::testSphereObject(sphere,delta,obstacle); @@ -2406,7 +2406,7 @@ bool CollisionWorld::findFirstObstacle ( Sphere const & sphere, Vector const & g { Object const * obstacle = creatures[i]; - if(obstacle == NULL) continue; + if(obstacle == nullptr) continue; if(Distance2d::Distance2(obstacle->getPosition_w(),goalPos) < 0.000001) continue; @@ -2437,7 +2437,7 @@ bool CollisionWorld::findFirstObstacle ( Sphere const & sphere, Vector const & g bool CollisionWorld::calcBubble ( CellProperty const * cell, Vector const & point_p, float maxDistance, float & outRadius ) { - return calcBubble(cell,point_p,NULL,maxDistance,outRadius); + return calcBubble(cell,point_p,nullptr,maxDistance,outRadius); } bool CollisionWorld::calcBubble ( CellProperty const * cell, Vector const & point_p, Object const * ignoreObject, float maxDistance, float & outRadius ) @@ -2698,16 +2698,16 @@ void CollisionWorld::handleSceneChange(std::string const & sceneId) Floor const * CollisionWorld::getFloorStandingOn(Object const & object) { CollisionProperty const * const objectCollisionProperty = object.getCollisionProperty(); - Footprint const * const objectFootprint = (objectCollisionProperty != NULL) ? objectCollisionProperty->getFootprint() : NULL; + Footprint const * const objectFootprint = (objectCollisionProperty != nullptr) ? objectCollisionProperty->getFootprint() : nullptr; - if (objectFootprint == NULL) + if (objectFootprint == nullptr) { - return NULL; + return nullptr; } MultiListHandle const & floorList = objectFootprint->getFloorList(); float const objectHeight = object.getPosition_w().y; - Floor const * resultFloor = NULL; + Floor const * resultFloor = nullptr; float resultDistanceBelowObject = 0.0f; float dropTestHeight = std::numeric_limits::min(); @@ -2750,7 +2750,7 @@ Floor const * CollisionWorld::getFloorStandingOn(Object const & object) { TerrainObject const * const terrainObject = TerrainObject::getConstInstance(); - if (terrainObject != NULL) + if (terrainObject != nullptr) { CellProperty const * const parentCell = object.getParentCell(); @@ -2775,7 +2775,7 @@ Floor const * CollisionWorld::getFloorStandingOn(Object const & object) { if (dropTestHeight < terrainHeight) { - resultFloor = NULL; + resultFloor = nullptr; } } } diff --git a/engine/shared/library/sharedCollision/src/shared/core/ConfigSharedCollision.cpp b/engine/shared/library/sharedCollision/src/shared/core/ConfigSharedCollision.cpp index 0b3d4164..b9811896 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/ConfigSharedCollision.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/ConfigSharedCollision.cpp @@ -68,8 +68,8 @@ float ms_terrainLOSMaxDistance = 64.0f; float ms_losUprightScale = 1.5f; float ms_losProneScale = 1.0f; -PlayEffectHook ms_playEffectHook = NULL; -IsPlayerHouseHook ms_isPlayerHouseHook = NULL; +PlayEffectHook ms_playEffectHook = nullptr; +IsPlayerHouseHook ms_isPlayerHouseHook = nullptr; int ms_spatialSweepAndResolveDefaultMask = static_cast(SpatialDatabase::Q_Static); diff --git a/engine/shared/library/sharedCollision/src/shared/core/Contact3d.h b/engine/shared/library/sharedCollision/src/shared/core/Contact3d.h index 2d4d7236..551822e2 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/Contact3d.h +++ b/engine/shared/library/sharedCollision/src/shared/core/Contact3d.h @@ -52,9 +52,9 @@ public: m_normal(newNormal), m_surfaceId1(-1), m_surfaceId2(-1), - m_cell(NULL), - m_extent(NULL), - m_surface(NULL) + m_cell(nullptr), + m_extent(nullptr), + m_surface(nullptr) { } diff --git a/engine/shared/library/sharedCollision/src/shared/core/ContactPoint.cpp b/engine/shared/library/sharedCollision/src/shared/core/ContactPoint.cpp index 304a14b7..be31ca04 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/ContactPoint.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/ContactPoint.cpp @@ -18,7 +18,7 @@ // ---------------------------------------------------------------------- ContactPoint::ContactPoint() -: m_pSurface( NULL ), +: m_pSurface( nullptr ), m_position( Vector::zero ), m_offset( 0.0f ), m_hitId( -1 ) @@ -45,7 +45,7 @@ ContactPoint::ContactPoint ( ContactPoint const & locCopy ) bool ContactPoint::isAttached ( void ) const { - return (m_hitId != -1) && (m_pSurface != NULL); + return (m_hitId != -1) && (m_pSurface != nullptr); } // ---------------------------------------------------------------------- @@ -115,7 +115,7 @@ void ContactPoint::read_0000 ( Iff & iff ) { m_position = iff.read_floatVector(); m_offset = iff.read_float(); - m_pSurface = NULL; + m_pSurface = nullptr; m_hitId = iff.read_int32(); NAN_CHECK(m_position); diff --git a/engine/shared/library/sharedCollision/src/shared/core/DoorObject.cpp b/engine/shared/library/sharedCollision/src/shared/core/DoorObject.cpp index a14c9980..68b421e8 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/DoorObject.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/DoorObject.cpp @@ -99,11 +99,11 @@ DoorObject::DoorObject ( DoorInfo const & info, Portal * portal ) m_doorHelper2 ( info ), m_delta ( info.m_delta ), m_portal ( portal ), - m_neighbor ( NULL ), + m_neighbor ( nullptr ), m_spring ( info.m_spring ), m_smoothness ( info.m_smoothness ), m_draw ( true ), - m_barrier ( NULL ), + m_barrier ( nullptr ), m_oldDoorPos ( Vector::maxXYZ ), m_wasOpen(false), m_isForceField( false ), @@ -119,7 +119,7 @@ DoorObject::DoorObject ( DoorInfo const & info, Portal * portal ) setDebugName("Door object"); for (int i = 0; i < MAX_DRAWN_DOORS; ++i) - m_drawnDoor[i] = NULL; + m_drawnDoor[i] = nullptr; createAppearance(info); createTrigger(info); @@ -131,7 +131,7 @@ DoorObject::DoorObject ( DoorInfo const & info, Portal * portal ) DoorObject::~DoorObject() { m_hitByObjects.clear(); - m_portal = NULL; + m_portal = nullptr; } // ---------------------------------------------------------------------- @@ -181,7 +181,7 @@ DoorObject const * DoorObject::getNeighbor ( void ) const int DoorObject::getNumberOfDrawnDoors ( void ) { for (int i = 0; i < MAX_DRAWN_DOORS; ++i) - if (m_drawnDoor[i] == NULL) + if (m_drawnDoor[i] == nullptr) return i; return MAX_DRAWN_DOORS; @@ -210,7 +210,7 @@ void DoorObject::createAppearance ( DoorInfo const & info ) { Appearance * const appearance = AppearanceTemplateList::createAppearance(info.m_frameAppearance); - if (appearance != NULL) { + if (appearance != nullptr) { setAppearance(appearance); } else { DEBUG_WARNING(true, ("FIX ME: Appearance template for DoorObject::createAppearance missing, first stanza.")); @@ -233,7 +233,7 @@ void DoorObject::createAppearance ( DoorInfo const & info ) Collision3d::MovePolyOnto(verts,Vector::zero); Appearance * appearance = CellProperty::createForceField(verts,gs_forceFieldColor); - if(appearance != NULL) + if(appearance != nullptr) { m_drawnDoor[0]->setAppearance( appearance ); Extent * appearanceExtent = new Extent( Containment3d::EncloseSphere(verts) ); @@ -249,7 +249,7 @@ void DoorObject::createAppearance ( DoorInfo const & info ) { Appearance * const appearance = AppearanceTemplateList::createAppearance(info.m_doorAppearance); - if (appearance != NULL) { + if (appearance != nullptr) { m_drawnDoor[0]->setAppearance(appearance); } else { DEBUG_WARNING(true, ("FIX ME: Appearance template for DoorObject::createAppearance missing, third stanza.")); @@ -263,7 +263,7 @@ void DoorObject::createAppearance ( DoorInfo const & info ) Appearance * const appearance = AppearanceTemplateList::createAppearance(info.m_doorAppearance2); - if (appearance != NULL) { + if (appearance != nullptr) { m_drawnDoor[1]->setAppearance(appearance); } else { DEBUG_WARNING(true, ("FIX ME: Appearance template for DoorObject::createAppearance missing, fourth stanza.")); @@ -476,7 +476,7 @@ float DoorObject::tween ( float t ) const void DoorObject::hitBy( CollisionProperty const * collision ) { - if(collision == NULL) return; + if(collision == nullptr) return; CellProperty const * doorCell = getParentCell(); CellProperty const * doorNeighborCell = m_neighbor ? m_neighbor->getParentCell() : doorCell; @@ -533,7 +533,7 @@ void DoorObject::setNeighbor ( DoorObject * newNeighbor ) if (newNeighbor) m_barrier->setNeighbor( newNeighbor->m_barrier ); else - m_barrier->setNeighbor( NULL ); + m_barrier->setNeighbor( nullptr ); } } @@ -587,7 +587,7 @@ void DoorObject::trackHitByObject(Object const &hitByObject) if (static_cast(m_hitByObjects.size()) >= cs_maxHitByObjectsToTrack) return; - // NOTE: This can't be a set because the key's value can change when a watcher's value changes from non-NULL to NULL. + // NOTE: This can't be a set because the key's value can change when a watcher's value changes from non-nullptr to nullptr. // Check if the object already exists in the list. if (std::find(m_hitByObjects.begin(), m_hitByObjects.end(), ConstWatcher(&hitByObject)) != m_hitByObjects.end()) return; @@ -607,7 +607,7 @@ void DoorObject::maintainHitByObjectVector() // Remove any objects that no longer exist or no longer are within the trigger radius. for (WatcherObjectVector::iterator it = m_hitByObjects.begin(); it != m_hitByObjects.end(); ) { - if (it->getPointer() == NULL) + if (it->getPointer() == nullptr) { // This hit-by object has been deleted so clear it out of the tracking list. it = m_hitByObjects.erase(it); diff --git a/engine/shared/library/sharedCollision/src/shared/core/Floor.cpp b/engine/shared/library/sharedCollision/src/shared/core/Floor.cpp index 4d08d7df..8d23bff3 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/Floor.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/Floor.cpp @@ -49,8 +49,8 @@ Floor::Floor( FloorMesh const * pMesh, Object const * owner, Appearance const * m_mesh(pMesh), m_footList(this,1), m_databaseList(this,1), - m_spatialSubdivisionHandle(NULL), - m_extent(NULL), + m_spatialSubdivisionHandle(nullptr), + m_extent(nullptr), m_extentDirty(true), m_sphere_l(), m_sphere_w() @@ -104,15 +104,15 @@ Floor::~Floor() } const_cast(m_mesh)->releaseReference(); - m_mesh = NULL; + m_mesh = nullptr; - m_owner = NULL; - m_appearance = NULL; + m_owner = nullptr; + m_appearance = nullptr; - m_spatialSubdivisionHandle = NULL; + m_spatialSubdivisionHandle = nullptr; delete m_extent; - m_extent = NULL; + m_extent = nullptr; } // ---------------------------------------------------------------------- @@ -255,7 +255,7 @@ bool Floor::segTestBounds ( Vector const & begin, Vector const & end ) const Object const * Floor::getOwner ( void ) const { - if(m_owner != NULL) + if(m_owner != nullptr) { return m_owner; } @@ -265,7 +265,7 @@ Object const * Floor::getOwner ( void ) const } else { - return NULL; + return nullptr; } } @@ -273,7 +273,7 @@ Object const * Floor::getOwner ( void ) const Appearance const * Floor::getAppearance ( void ) const { - if(m_appearance != NULL) + if(m_appearance != nullptr) { return m_appearance; } @@ -283,7 +283,7 @@ Appearance const * Floor::getAppearance ( void ) const } else { - return NULL; + return nullptr; } } @@ -301,7 +301,7 @@ CellProperty const * Floor::getCell ( void ) const } else { - return NULL; + return nullptr; } } @@ -657,7 +657,7 @@ NetworkId const & Floor::getId() const { CellProperty const * const cellProperty = getCell(); - return (cellProperty != NULL) ? cellProperty->getOwner().getNetworkId() : NetworkId::cms_invalid; + return (cellProperty != nullptr) ? cellProperty->getOwner().getNetworkId() : NetworkId::cms_invalid; } // ====================================================================== diff --git a/engine/shared/library/sharedCollision/src/shared/core/FloorLocator.cpp b/engine/shared/library/sharedCollision/src/shared/core/FloorLocator.cpp index f595384a..5b728aee 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/FloorLocator.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/FloorLocator.cpp @@ -34,7 +34,7 @@ FloorTri gs_dummyFloorTri; FloorLocator::FloorLocator() : ContactPoint(), m_valid(false), - m_floor(NULL), + m_floor(nullptr), m_radius(0.0f), m_time(0.0f), m_edgeId(-1), @@ -47,7 +47,7 @@ FloorLocator::FloorLocator() // ---------- FloorLocator::FloorLocator( Floor const * floor, Vector const & localPoint, int triId, float dist, float radius ) -: ContactPoint((floor ? floor->getFloorMesh() : NULL),localPoint,triId,dist), +: ContactPoint((floor ? floor->getFloorMesh() : nullptr),localPoint,triId,dist), m_valid(true), m_floor(floor), m_radius(radius), @@ -64,7 +64,7 @@ FloorLocator::FloorLocator( Floor const * floor, Vector const & localPoint, int FloorLocator::FloorLocator( CollisionSurface const * mesh, Vector const & point, int triId, float dist, float radius ) : ContactPoint(mesh,point,triId,dist), m_valid(true), - m_floor(NULL), + m_floor(nullptr), m_radius(radius), m_time(0.0f), m_edgeId(-1), @@ -78,7 +78,7 @@ FloorLocator::FloorLocator( CollisionSurface const * mesh, Vector const & point, // ---------- FloorLocator::FloorLocator( Floor const * floor, Vector const & localPoint ) -: ContactPoint((floor ? floor->getFloorMesh() : NULL),localPoint,-1,0.0f), +: ContactPoint((floor ? floor->getFloorMesh() : nullptr),localPoint,-1,0.0f), m_valid(true), m_floor(floor), m_radius(0.0f), @@ -95,7 +95,7 @@ FloorLocator::FloorLocator( Floor const * floor, Vector const & localPoint ) FloorLocator::FloorLocator( CollisionSurface const * mesh, Vector const & point ) : ContactPoint(mesh,point,-1,0.0f), m_valid(true), - m_floor(NULL), + m_floor(nullptr), m_radius(0.0f), m_time(0.0f), m_edgeId(-1), @@ -109,9 +109,9 @@ FloorLocator::FloorLocator( CollisionSurface const * mesh, Vector const & point // ---------- FloorLocator::FloorLocator( Vector const & point, float radius ) -: ContactPoint(NULL,point,-1,0.0f), +: ContactPoint(nullptr,point,-1,0.0f), m_valid(true), - m_floor(NULL), + m_floor(nullptr), m_radius(radius), m_time(0.0f), m_edgeId(-1), @@ -226,7 +226,7 @@ void FloorLocator::setFloor ( Floor const * newFloor ) } else { - if(getFloorMesh() == NULL) + if(getFloorMesh() == nullptr) { Vector oldPos = getPosition_p(); @@ -239,7 +239,7 @@ void FloorLocator::setFloor ( Floor const * newFloor ) } else { - m_floor = NULL; + m_floor = nullptr; } } @@ -289,7 +289,7 @@ CellProperty const * FloorLocator::getCell ( void ) const { if(getFloorMesh()) { - return NULL; + return nullptr; } else { @@ -312,7 +312,7 @@ CellProperty * FloorLocator::getCell ( void ) { if(getFloorMesh()) { - return NULL; + return nullptr; } else { @@ -417,7 +417,7 @@ void FloorLocator::write ( Iff & iff ) const void FloorLocator::detach ( void ) { - setFloor(NULL); + setFloor(nullptr); setId(-1); } diff --git a/engine/shared/library/sharedCollision/src/shared/core/FloorManager.cpp b/engine/shared/library/sharedCollision/src/shared/core/FloorManager.cpp index 677849e7..1ea799b9 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/FloorManager.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/FloorManager.cpp @@ -19,9 +19,9 @@ namespace FloorManagerNamespace { -ObjectFactory ms_pathGraphFactory = NULL; -ObjectWriter ms_pathGraphWriter = NULL; -ObjectRenderer ms_pathGraphRenderer = NULL; +ObjectFactory ms_pathGraphFactory = nullptr; +ObjectWriter ms_pathGraphWriter = nullptr; +ObjectRenderer ms_pathGraphRenderer = nullptr; }; @@ -72,7 +72,7 @@ Floor * FloorManager::createFloor ( const char * floorMeshFilename, Object const if(!pMesh) { WARNING(true, ("Could not find floor mesh %s", floorMeshFilename)); - return NULL; + return nullptr; } // ---------- diff --git a/engine/shared/library/sharedCollision/src/shared/core/FloorMesh.cpp b/engine/shared/library/sharedCollision/src/shared/core/FloorMesh.cpp index 370f13b7..ae508f4a 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/FloorMesh.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/FloorMesh.cpp @@ -78,8 +78,8 @@ const Tag TAG_BTRE = TAG(B,T,R,E); const Tag TAG_BEDG = TAG(B,E,D,G); const Tag TAG_PGRF = TAG(P,G,R,F); -template <> FloorMeshList::CreateDataResourceMap *FloorMeshList::ms_bindings = NULL; -template <> FloorMeshList::LoadedDataResourceMap *FloorMeshList::ms_loaded = NULL; +template <> FloorMeshList::CreateDataResourceMap *FloorMeshList::ms_bindings = nullptr; +template <> FloorMeshList::LoadedDataResourceMap *FloorMeshList::ms_loaded = nullptr; // ---------------------------------------------------------------------- @@ -92,20 +92,20 @@ FloorMesh::FloorMesh(const std::string & filename) m_uncrossableEdges( new FloorEdgeIdVec() ), m_wallBaseEdges( new FloorEdgeIdVec() ), m_wallTopEdges( new FloorEdgeIdVec() ), - m_pathGraph(NULL), - m_appearance(NULL), + m_pathGraph(nullptr), + m_appearance(nullptr), m_triMarkCounter(1000), // just some random number m_objectFloor(false) { #ifdef _DEBUG - m_crossableLines = NULL; - m_uncrossableLines = NULL; - m_interiorLines = NULL; - m_portalLines = NULL; - m_rampLines = NULL; - m_fallthroughTriLines = NULL; - m_solidTriLines = NULL; + m_crossableLines = nullptr; + m_uncrossableLines = nullptr; + m_interiorLines = nullptr; + m_portalLines = nullptr; + m_rampLines = nullptr; + m_fallthroughTriLines = nullptr; + m_solidTriLines = nullptr; #endif } @@ -121,8 +121,8 @@ FloorMesh::FloorMesh( VectorVector const & vertices, IntVector const & indices ) m_uncrossableEdges( new FloorEdgeIdVec() ), m_wallBaseEdges( new FloorEdgeIdVec() ), m_wallTopEdges( new FloorEdgeIdVec() ), - m_pathGraph(NULL), - m_appearance(NULL), + m_pathGraph(nullptr), + m_appearance(nullptr), m_triMarkCounter(1000), m_objectFloor(false) { @@ -130,13 +130,13 @@ FloorMesh::FloorMesh( VectorVector const & vertices, IntVector const & indices ) #ifdef _DEBUG - m_crossableLines = NULL; - m_uncrossableLines = NULL; - m_interiorLines = NULL; - m_portalLines = NULL; - m_rampLines = NULL; - m_fallthroughTriLines = NULL; - m_solidTriLines = NULL; + m_crossableLines = nullptr; + m_uncrossableLines = nullptr; + m_interiorLines = nullptr; + m_portalLines = nullptr; + m_rampLines = nullptr; + m_fallthroughTriLines = nullptr; + m_solidTriLines = nullptr; #endif } @@ -146,50 +146,50 @@ FloorMesh::FloorMesh( VectorVector const & vertices, IntVector const & indices ) FloorMesh::~FloorMesh() { delete m_vertices; - m_vertices = NULL; + m_vertices = nullptr; delete m_floorTris; - m_floorTris = NULL; + m_floorTris = nullptr; delete m_crossableEdges; - m_crossableEdges = NULL; + m_crossableEdges = nullptr; delete m_uncrossableEdges; - m_crossableEdges = NULL; + m_crossableEdges = nullptr; delete m_wallBaseEdges; - m_wallBaseEdges = NULL; + m_wallBaseEdges = nullptr; delete m_wallTopEdges; - m_wallTopEdges = NULL; + m_wallTopEdges = nullptr; delete m_pathGraph; - m_pathGraph = NULL; + m_pathGraph = nullptr; - m_appearance = NULL; + m_appearance = nullptr; #ifdef _DEBUG delete m_crossableLines; - m_crossableLines = NULL; + m_crossableLines = nullptr; delete m_uncrossableLines; - m_uncrossableLines = NULL; + m_uncrossableLines = nullptr; delete m_interiorLines; - m_interiorLines = NULL; + m_interiorLines = nullptr; delete m_portalLines; - m_portalLines = NULL; + m_portalLines = nullptr; delete m_rampLines; - m_rampLines = NULL; + m_rampLines = nullptr; delete m_fallthroughTriLines; - m_fallthroughTriLines = NULL; + m_fallthroughTriLines = nullptr; delete m_solidTriLines; - m_solidTriLines = NULL; + m_solidTriLines = nullptr; #endif } @@ -833,7 +833,7 @@ void FloorMesh::write ( Iff & iff ) // ---------- - if(m_boxTree != NULL) + if(m_boxTree != nullptr) { m_boxTree->write(iff); } @@ -1772,7 +1772,7 @@ bool FloorMesh::canEnterEdge ( FloorLocator const & enterLoc ) const { if(enterLoc.getEdgeId() == -1) return false; if(enterLoc.getTriId() == -1) return false; - if(enterLoc.getFloorMesh() == NULL) return false; + if(enterLoc.getFloorMesh() == nullptr) return false; // Can't enter the tri if it's facing down @@ -1837,7 +1837,7 @@ bool FloorMesh::canExitEdge ( FloorLocator const & exitLoc, Vector const & delta { if(exitLoc.getTriId() == -1) return false; if(exitLoc.getEdgeId() == -1) return false; - if(exitLoc.getFloorMesh() == NULL) return false; + if(exitLoc.getFloorMesh() == nullptr) return false; FloorEdgeType edgeType = exitLoc.getFloorTri().getEdgeType(exitLoc.getEdgeId()); @@ -3808,7 +3808,7 @@ void FloorMesh::drawDebugShapes ( DebugShapeRenderer * renderer, bool drawExtent #ifdef _DEBUG - if(renderer == NULL) return; + if(renderer == nullptr) return; if(ConfigSharedCollision::getDrawFloors()) { diff --git a/engine/shared/library/sharedCollision/src/shared/core/Footprint.cpp b/engine/shared/library/sharedCollision/src/shared/core/Footprint.cpp index 00bec3b3..58471e36 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/Footprint.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/Footprint.cpp @@ -92,7 +92,7 @@ static bool epsilonEqual( float value, float target, float epsilon ) Footprint::Footprint ( Vector const & position, float radius, CollisionProperty * parent, const float swimHeight ) : BaseClass(), m_parent(parent), - m_cellObject(NULL), + m_cellObject(nullptr), m_position_p(Vector::zero), m_position_w(Vector::zero), m_radius(radius), @@ -112,9 +112,9 @@ Footprint::Footprint ( Vector const & position, float radius, CollisionProperty #ifdef _DEBUG , m_backupPosition_p(position), - m_backupCell(NULL), + m_backupCell(nullptr), m_backupObjectPosition_p(position), - m_backupObjectCell(NULL), + m_backupObjectCell(nullptr), m_lineHitTime( -1.0f ), m_lineOrigin( Vector(0.0f,1.5f,0.0f) ), m_lineDelta( Vector(0.0f,0.0f,10.0f) ), @@ -137,8 +137,8 @@ Footprint::~Footprint() { detach(); - m_parent = NULL; - m_cellObject = NULL; + m_parent = nullptr; + m_cellObject = nullptr; } // ====================================================================== @@ -334,7 +334,7 @@ Object * Footprint::getOwner ( void ) void Footprint::addContact ( FloorLocator const & loc ) { - if(loc.getFloor() == NULL) + if(loc.getFloor() == nullptr) { FLOOR_LOG("Footprint::addContact - loc isn't attached to a floor\n"); } @@ -445,7 +445,7 @@ void Footprint::setSwimHeight ( float swimHeight ) Vector const & Footprint::getPosition_p ( void ) const { - if(m_cellObject.getPointer() == NULL) + if(m_cellObject.getPointer() == nullptr) { WARNING(true,("Footprint::getPosition_p - Footprint's parent cell has disappeared")); @@ -525,7 +525,7 @@ void Footprint::setPosition ( CellProperty * pNewCell, Vector const & pos ) { NAN_CHECK(pos); - if(pNewCell == NULL) pNewCell = CellProperty::getWorldCellProperty(); + if(pNewCell == nullptr) pNewCell = CellProperty::getWorldCellProperty(); m_cellObject = &(pNewCell->getOwner()); m_position_p = pos; @@ -808,13 +808,13 @@ void Footprint::runDebugTests ( void ) IGNORE_RETURN(CollisionWorld::calcBubble(getCell(),getPosition_p(),20.0f,m_bubbleSize)); */ - Object const * hitObject = NULL; + Object const * hitObject = nullptr; QueryInteractionResult result = CollisionWorld::queryInteraction(objCell, objPos + m_lineOrigin, objCell, objPos + m_lineOrigin + delta, - NULL, + nullptr, !ConfigSharedCollision::getIgnoreTerrainLos(), ConfigSharedCollision::getGenerateTerrainLos(), ConfigSharedCollision::getTerrainLOSMinDistance(), @@ -843,14 +843,14 @@ FloorLocator const * Footprint::getAnyContact ( void ) const if(contact->m_contact.isAttached()) return &contact->m_contact; } - return NULL; + return nullptr; } // ---------- FloorLocator const * Footprint::getSolidContact ( void ) const { - FloorLocator const * temp = NULL; + FloorLocator const * temp = nullptr; float maxHeight = -REAL_MAX; @@ -883,11 +883,11 @@ Object const * Footprint::getStandingOn ( void ) const { FloorLocator const * contact = getSolidContact(); - if(contact == NULL) return NULL; + if(contact == nullptr) return nullptr; Floor const * floor = contact->getFloor(); - if(floor == NULL) return NULL; + if(floor == nullptr) return nullptr; return floor->getOwner(); } @@ -921,9 +921,9 @@ bool Footprint::snapToCellFloor ( void ) bool Footprint::isAttachedTo ( Floor const * floor ) const { - if(floor == NULL) return false; + if(floor == nullptr) return false; - return getFloorList().find( floor->getFootList() ) != NULL; + return getFloorList().find( floor->getFootList() ) != nullptr; } // ---------------------------------------------------------------------- @@ -1114,7 +1114,7 @@ void Footprint::updateOffsets ( void ) bool Footprint::attachTo ( Floor const * floor, bool fromObject ) { - if(floor == NULL) return false; + if(floor == nullptr) return false; if(isAttachedTo(floor)) return false; @@ -1240,7 +1240,7 @@ int Footprint::elevatorMove ( int nFloors, Transform & outTransform ) // ---------- // Find the contact that's on the cell's floor - FloorContactShape const * cellContact = NULL; + FloorContactShape const * cellContact = nullptr; for(ConstContactIterator it(getFloorList()); it; ++it) { @@ -1261,7 +1261,7 @@ int Footprint::elevatorMove ( int nFloors, Transform & outTransform ) } } - if(cellContact == NULL) + if(cellContact == nullptr) { return 0; } @@ -1328,7 +1328,7 @@ void Footprint::drawDebugShapes ( DebugShapeRenderer * renderer ) const #ifdef _DEBUG - if(renderer == NULL) return; + if(renderer == nullptr) return; if(ConfigSharedCollision::getDrawFootprints()) { @@ -1525,7 +1525,7 @@ void Footprint::alignToGroundNoFloat ( void ) if (owner) DEBUG_WARNING(true, ("Footprint::alignToGroundNoFloat(): called on object id=[%s],template=[%s] when no ground could be found.", owner->getNetworkId().getValueString().c_str(), owner->getObjectTemplateName())); else - DEBUG_WARNING(true, ("Footprint::alignToGroundNoFloat(): called on object id=[],template=[] when no ground could be found.")); + DEBUG_WARNING(true, ("Footprint::alignToGroundNoFloat(): called on object id=[],template=[] when no ground could be found.")); } #endif } diff --git a/engine/shared/library/sharedCollision/src/shared/core/FootprintForceReattachManager.cpp b/engine/shared/library/sharedCollision/src/shared/core/FootprintForceReattachManager.cpp index d0671160..680ff016 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/FootprintForceReattachManager.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/FootprintForceReattachManager.cpp @@ -31,7 +31,7 @@ namespace FootprintForceReattachManagerNamespace DataTable const * const dt = DataTableManager::getTable(ms_datatableName, true); - if (NULL == dt) + if (nullptr == dt) WARNING(true, ("FootprintForceReattachManager unable to find [%s]", ms_datatableName)); else { diff --git a/engine/shared/library/sharedCollision/src/shared/core/MultiList.cpp b/engine/shared/library/sharedCollision/src/shared/core/MultiList.cpp index 3917cd4d..af288bad 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/MultiList.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/MultiList.cpp @@ -14,8 +14,8 @@ MultiListHandle::MultiListHandle( BaseClass * object, int color ) : m_color(color), m_object(object), - m_head(NULL), - m_tail(NULL) + m_head(nullptr), + m_tail(nullptr) { } @@ -23,9 +23,9 @@ MultiListHandle::~MultiListHandle() { IGNORE_RETURN( detach() ); - m_object = NULL; - m_head = NULL; - m_tail = NULL; + m_object = nullptr; + m_head = nullptr; + m_tail = nullptr; } // ---------------------------------------------------------------------- @@ -55,7 +55,7 @@ MultiListNode * MultiListHandle::detachHead ( void ) } else { - return NULL; + return nullptr; } } @@ -72,7 +72,7 @@ MultiListHandle * MultiListHandle::detach ( void ) bool MultiListHandle::isConnected ( void ) const { - return m_head != NULL; + return m_head != nullptr; } // ---------- @@ -97,7 +97,7 @@ void MultiListHandle::erase ( MultiListNode * node ) bool MultiListHandle::isEmpty ( void ) const { - return m_head == NULL; + return m_head == nullptr; } // ---------- @@ -109,8 +109,8 @@ void MultiListHandle::insert( MultiListNode * node, MultiListNode * prev, MultiL DEBUG_FATAL( next == node, ("MultiListHandle::insert - Next and node are the same ")); DEBUG_FATAL( (prev || next) && (prev == next), ("MultiListHandle::insert - Prev and Next are the same")); - // verify that the node to insert is not null - DEBUG_FATAL( node == NULL, ("MultiListHandle::insert - Cannot insert null node")); + // verify that the node to insert is not nullptr + DEBUG_FATAL( node == nullptr, ("MultiListHandle::insert - Cannot insert nullptr node")); // verify that the nodes we're inserting between are adjacent DEBUG_FATAL( prev && (prev->m_next[m_color] != next), ("MultiListHandle::insert - Prev and Next are not adjacent")); @@ -155,7 +155,7 @@ void MultiListHandle::connectTo( MultiListHandle & handle, BaseClass * data ) void MultiListHandle::insert( MultiListNode * node ) { - insert( node, NULL, m_head ); + insert( node, nullptr, m_head ); } // ---------- @@ -175,9 +175,9 @@ MultiListNode * MultiListHandle::detach ( MultiListNode * node ) // ---------- - node->m_next[m_color] = NULL; - node->m_prev[m_color] = NULL; - node->m_list[m_color] = NULL; + node->m_next[m_color] = nullptr; + node->m_prev[m_color] = nullptr; + node->m_list[m_color] = nullptr; } return node; @@ -221,7 +221,7 @@ MultiListNode * MultiListHandle::find ( MultiListHandle & testHandle ) cursor = cursor->m_next[m_color]; } - return NULL; + return nullptr; } //lint !e1764 // testHandle could be made const ref MultiListNode const * MultiListHandle::find ( MultiListHandle const & testHandle ) const @@ -240,7 +240,7 @@ MultiListNode const * MultiListHandle::find ( MultiListHandle const & testHandle cursor = cursor->m_next[m_color]; } - return NULL; + return nullptr; } // ---------- @@ -288,13 +288,13 @@ void MultiListHandle::destroyNodes ( void ) // ====================================================================== MultiListNode::MultiListNode() -: m_data(NULL) +: m_data(nullptr) { for(int i = 0; i < nColors; i++) { - m_next[i] = NULL; - m_prev[i] = NULL; - m_list[i] = NULL; + m_next[i] = nullptr; + m_prev[i] = nullptr; + m_list[i] = nullptr; } } @@ -303,7 +303,7 @@ MultiListNode::~MultiListNode() IGNORE_RETURN( detach() ); BaseClass * data = m_data; - m_data = NULL; + m_data = nullptr; delete data; } @@ -346,7 +346,7 @@ BaseClass * MultiListNode::getObject ( int color ) if(m_list[color]) return m_list[color]->getObject(); else - return NULL; + return nullptr; } //lint !e1762 // function could be const @@ -355,7 +355,7 @@ BaseClass const * MultiListNode::getObject ( int color ) const if(m_list[color]) return m_list[color]->getObject(); else - return NULL; + return nullptr; } // ---------- @@ -375,7 +375,7 @@ void MultiListNode::setData( BaseClass * data ) if(m_data == data) return; BaseClass * deadData = m_data; - m_data = NULL; + m_data = nullptr; delete deadData; m_data = data; } @@ -403,7 +403,7 @@ void MultiListNode::swapNext ( int color ) /* MultiList::MultiList() -: m_free(0,NULL) +: m_free(0,nullptr) { } @@ -411,7 +411,7 @@ MultiList::MultiList() bool MultiList::connect ( MultiListHandle * red, MultiListHandle * blue ) { - return connect(red,blue,NULL); + return connect(red,blue,nullptr); } // ---------- @@ -436,7 +436,7 @@ bool MultiList::connect ( MultiListHandle & red, MultiListHandle & blue, BaseCla bool MultiList::connected( MultiListHandle & red, MultiListHandle & blue ) { - return red.find(blue) != NULL; + return red.find(blue) != nullptr; } // ---------- @@ -450,7 +450,7 @@ bool MultiList::disconnect( MultiListHandle & red, MultiListHandle & blue ) MultiListNode * MultiList::getFreeNode ( void ) { - if(m_free.m_head == NULL) + if(m_free.m_head == nullptr) { return new MultiListNode(); } @@ -502,8 +502,8 @@ void MultiList::insert( MultiListHandle * node, MultiListHandle * prev, MultiLis DEBUG_FATAL( next == node, ("MultiList::insert - Next and Node are the same")); DEBUG_FATAL( prev == next, ("MultiList::insert - Prev and Next are the same")); - // verify that the node to insert is not null - DEBUG_FATAL( node == NULL, ("MultiList::insert - Cannot insert a null node")); + // verify that the node to insert is not nullptr + DEBUG_FATAL( node == nullptr, ("MultiList::insert - Cannot insert a nullptr node")); // verify that the two nodes are adjacent DEBUG_FATAL( prev && (prev->m_next != next), ("MultiList::insert - Prev and Next are not adjacent")); @@ -539,7 +539,7 @@ void MultiList::insert( MultiListHandle * node, MultiListHandle * prev, MultiLis MultiListHandle * MultiList::detach( MultiListHandle * node ) { - DEBUG_FATAL( node == NULL, ("MultiList::detach - Cannot detach null node")); + DEBUG_FATAL( node == nullptr, ("MultiList::detach - Cannot detach nullptr node")); DEBUG_FATAL( node->m_list != this, ("MultiList::detach - Node is not part of this list")); // ---------- @@ -555,9 +555,9 @@ MultiListHandle * MultiList::detach( MultiListHandle * node ) if(m_head[color] == node) m_head[color] = node->m_next; if(m_tail[color] == node) m_tail[color] = node->m_prev; - node->m_prev = NULL; - node->m_next = NULL; - node->m_list = NULL; + node->m_prev = nullptr; + node->m_next = nullptr; + node->m_list = nullptr; return node; } @@ -566,13 +566,13 @@ MultiListHandle * MultiList::detach( MultiListHandle * node ) void MultiList::insert( MultiListHandle * node ) { - DEBUG_FATAL(node == NULL, ("MultiList::insert - Cannot insert NULL node")); + DEBUG_FATAL(node == nullptr, ("MultiList::insert - Cannot insert nullptr node")); // ---------- int color = node->m_color; - insert(node,NULL,m_head[color]); + insert(node,nullptr,m_head[color]); } */ diff --git a/engine/shared/library/sharedCollision/src/shared/core/MultiList.h b/engine/shared/library/sharedCollision/src/shared/core/MultiList.h index 48c5e92d..09d7a4ec 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/MultiList.h +++ b/engine/shared/library/sharedCollision/src/shared/core/MultiList.h @@ -168,12 +168,12 @@ public: if(m_node) return safe_cast(m_node->getObject(m_valueColor)); else - return NULL; + return nullptr; } operator bool ( void ) const { - return m_node != NULL; + return m_node != nullptr; } void operator ++ ( void ) @@ -212,12 +212,12 @@ public: if(m_node) return safe_cast(m_node->getObject(m_valueColor)); else - return NULL; + return nullptr; } operator bool ( void ) const { - return m_node != NULL; + return m_node != nullptr; } void operator ++ ( void ) @@ -246,7 +246,7 @@ public: MultiListConstDataIterator( void ) { - m_node = NULL; + m_node = nullptr; m_color = -1; } @@ -281,12 +281,12 @@ public: if(m_node) return safe_cast(m_node->getData()); else - return NULL; + return nullptr; } operator bool ( void ) const { - return m_node != NULL; + return m_node != nullptr; } void operator ++ ( void ) @@ -310,7 +310,7 @@ public: MultiListDataIterator( void ) { - m_node = NULL; + m_node = nullptr; m_color = -1; } @@ -345,12 +345,12 @@ public: if(m_node) return safe_cast(m_node->getData()); else - return NULL; + return nullptr; } operator bool ( void ) const { - return m_node != NULL; + return m_node != nullptr; } void operator ++ ( void ) diff --git a/engine/shared/library/sharedCollision/src/shared/core/NeighborObject.cpp b/engine/shared/library/sharedCollision/src/shared/core/NeighborObject.cpp index a5a0f37d..006db662 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/NeighborObject.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/NeighborObject.cpp @@ -12,7 +12,7 @@ // ---------------------------------------------------------------------- NeighborObject::NeighborObject() -: m_neighbor(NULL) +: m_neighbor(nullptr) { } diff --git a/engine/shared/library/sharedCollision/src/shared/core/SimpleCollisionMesh.cpp b/engine/shared/library/sharedCollision/src/shared/core/SimpleCollisionMesh.cpp index 3fa962f9..439f6c95 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/SimpleCollisionMesh.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/SimpleCollisionMesh.cpp @@ -48,7 +48,7 @@ SimpleCollisionMesh::SimpleCollisionMesh( IndexedTriangleList * tris ) SimpleCollisionMesh::~SimpleCollisionMesh() { delete m_tris; - m_tris = NULL; + m_tris = nullptr; delete m_bucket; } @@ -178,7 +178,7 @@ void SimpleCollisionMesh::drawDebugShapes ( DebugShapeRenderer * renderer ) cons UNREF(renderer); #ifdef _DEBUG - if(renderer == NULL) return; + if(renderer == nullptr) return; if (s_renderCollisionBuckets) { diff --git a/engine/shared/library/sharedCollision/src/shared/core/SpatialDatabase.cpp b/engine/shared/library/sharedCollision/src/shared/core/SpatialDatabase.cpp index 05abd3be..f2d68e94 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/SpatialDatabase.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/SpatialDatabase.cpp @@ -115,7 +115,7 @@ public: * This functionality is used on the client to prevent a door from visually opening for * a mounted creature or a rider. The actual stop logic for movement is on the server. * - * @param callback If NULL, no check is made. If non-NULL, the callback is called + * @param callback If nullptr, no check is made. If non-nullptr, the callback is called * any time a mobile is detected to have collided with a DoorObject. * The return value of the callback dictates whether the hit() and hitBy() * logic is called on the mobile and door. If the return value of callback @@ -152,29 +152,29 @@ SpatialDatabase::SpatialDatabase() SpatialDatabase::~SpatialDatabase ( void ) { delete m_staticTree; - m_staticTree = NULL; + m_staticTree = nullptr; delete m_dynamicTree; - m_dynamicTree = NULL; + m_dynamicTree = nullptr; delete m_doorTree; - m_doorTree = NULL; + m_doorTree = nullptr; delete m_barrierTree; - m_barrierTree = NULL; + m_barrierTree = nullptr; delete m_floorTree; - m_floorTree = NULL; + m_floorTree = nullptr; delete m_ignoreStack; - m_ignoreStack = NULL; + m_ignoreStack = nullptr; } // ---------------------------------------------------------------------- bool SpatialDatabase::canCollideWithStatics ( CollisionProperty * collision ) const { - if(collision == NULL) return false; + if(collision == nullptr) return false; // On the client, remote creatures and players don't collide with statics @@ -207,10 +207,10 @@ bool SpatialDatabase::canCollideWithStatics ( CollisionProperty * collision ) co bool SpatialDatabase::canCollideWithStatic ( Object const * mobObject, Object * staticObject ) const { - // Objects can't collide with NULL + // Objects can't collide with nullptr - if(mobObject == NULL) return false; - if(staticObject == NULL) return false; + if(mobObject == nullptr) return false; + if(staticObject == nullptr) return false; // Objects can't collide with themselves @@ -223,7 +223,7 @@ bool SpatialDatabase::canCollideWithStatic ( Object const * mobObject, Object * bool SpatialDatabase::canCollideWithCreatures ( CollisionProperty const * collision ) const { - if(collision == NULL) return false; + if(collision == nullptr) return false; if(collision->isPlayerControlled() && collision->isServerSide()) { @@ -253,9 +253,9 @@ bool SpatialDatabase::canCollideWithCreature ( Object * player, Object * creatur bool SpatialDatabase::canWalkOnFloor ( CollisionProperty * collision ) const { - if(collision == NULL) return false; + if(collision == nullptr) return false; - if(collision->getFootprint() == NULL) return false; + if(collision->getFootprint() == nullptr) return false; return true; } @@ -470,12 +470,12 @@ void SpatialDatabase::updateCreatureCollision(CollisionProperty * playerCollisio bool SpatialDatabase::addObject(Query const query, Object * const object) { - if(object == NULL) + if(object == nullptr) return false; CollisionProperty * collision = object->getCollisionProperty(); - if(collision == NULL) + if(collision == nullptr) return false; if(collision->getSpatialSubdivisionHandle()) @@ -511,15 +511,15 @@ bool SpatialDatabase::addObject(Query const query, Object * const object) bool SpatialDatabase::removeObject(Query const query, Object * const object) { - if(object == NULL) + if(object == nullptr) return false; CollisionProperty * collision = object->getCollisionProperty(); - if(collision == NULL) + if(collision == nullptr) return false; - if(collision->getSpatialSubdivisionHandle() == NULL) + if(collision->getSpatialSubdivisionHandle() == nullptr) return false; switch (query) @@ -548,7 +548,7 @@ bool SpatialDatabase::removeObject(Query const query, Object * const object) break; } - collision->setSpatialSubdivisionHandle(NULL); + collision->setSpatialSubdivisionHandle(nullptr); return true; } @@ -645,7 +645,7 @@ bool SpatialDatabase::checkIgnoreObject ( Object const * object ) const bool SpatialDatabase::addFloor ( Floor * floor ) { - if(floor == NULL) return false; + if(floor == nullptr) return false; if(floor->getSpatialSubdivisionHandle()) return false; @@ -660,15 +660,15 @@ bool SpatialDatabase::addFloor ( Floor * floor ) bool SpatialDatabase::removeFloor ( Floor * floor ) { - if(floor == NULL) return false; + if(floor == nullptr) return false; - if(floor->getSpatialSubdivisionHandle() == NULL) return false; + if(floor->getSpatialSubdivisionHandle() == nullptr) return false; // ---------- m_floorTree->removeObject( floor->getSpatialSubdivisionHandle() ); - floor->setSpatialSubdivisionHandle(NULL); + floor->setSpatialSubdivisionHandle(nullptr); return true; } @@ -684,11 +684,11 @@ int SpatialDatabase::getFloorCount ( void ) const bool SpatialDatabase::moveObject ( CollisionProperty * collision ) { - if(collision == NULL) return false; + if(collision == nullptr) return false; SpatialSubdivisionHandle * handle = collision->getSpatialSubdivisionHandle(); - if(handle == NULL) return false; + if(handle == nullptr) return false; // ---------- @@ -729,7 +729,7 @@ bool SpatialDatabase::queryStatics ( AxialBox const & box, ObjectVec * outList ) bool SpatialDatabase::queryStatics ( MultiShape const & shape, ObjectVec * outList ) const { - return queryStatics( NULL, shape, outList ); + return queryStatics( nullptr, shape, outList ); } // ---------- @@ -779,21 +779,21 @@ bool SpatialDatabase::queryStatics ( Line3d const & line, ObjectVec * outList ) bool SpatialDatabase::queryStatics ( CellProperty const * cell, MultiShape const & shape, ObjectVec * outList ) const { - return queryObjects(cell,shape,outList,NULL); + return queryObjects(cell,shape,outList,nullptr); } // ---------------------------------------------------------------------- bool SpatialDatabase::queryDynamics ( Sphere const & sphere, ObjectVec * outList ) const { - return queryObjects( NULL, MultiShape(sphere), NULL, outList ); + return queryObjects( nullptr, MultiShape(sphere), nullptr, outList ); } // ---------- bool SpatialDatabase::queryDynamics ( MultiShape const & shape, ObjectVec * outList ) const { - return queryObjects( NULL, shape, NULL, outList ); + return queryObjects( nullptr, shape, nullptr, outList ); } // ---------------------------------------------------------------------- @@ -982,7 +982,7 @@ bool SpatialDatabase::queryCloseStatics ( Vector const & point_w, float maxDista float minClose; float maxClose; - CollisionProperty * dummy = NULL; + CollisionProperty * dummy = nullptr; if(m_staticTree->findClosest(point_w,maxDistance,dummy,minClose,maxClose)) { @@ -1001,7 +1001,7 @@ bool SpatialDatabase::queryCloseFloors ( Vector const & point_w, float maxDistan float minClose; float maxClose; - Floor * dummy = NULL; + Floor * dummy = nullptr; if(m_floorTree->findClosest(point_w,maxDistance,dummy,minClose,maxClose)) { @@ -1163,7 +1163,7 @@ bool SpatialDatabase::queryMaterial ( CellProperty const * cell, // TODO: why are we skipping out on the tests when the extent is a MeshExtent??? MeshExtent const * mesh = dynamic_cast(extent); - if(mesh != NULL) continue; + if(mesh != nullptr) continue; Range hitRange = extent->rangedIntersect(seg_p); @@ -1244,7 +1244,7 @@ bool SpatialDatabase::queryMaterial ( CellProperty const * cellA, CollisionProperty * collisionB = results[i]; NOT_NULL(collisionB); - if (collisionB == NULL) + if (collisionB == nullptr) continue; // ---------- diff --git a/engine/shared/library/sharedCollision/src/shared/extent/BoxExtent.cpp b/engine/shared/library/sharedCollision/src/shared/extent/BoxExtent.cpp index 3adb1a61..96ce5e4c 100755 --- a/engine/shared/library/sharedCollision/src/shared/extent/BoxExtent.cpp +++ b/engine/shared/library/sharedCollision/src/shared/extent/BoxExtent.cpp @@ -394,7 +394,7 @@ void BoxExtent::drawDebugShapes ( DebugShapeRenderer * renderer ) const #ifdef _DEBUG - if(renderer == NULL) return; + if(renderer == nullptr) return; renderer->setColor( VectorArgb::solidBlue ); renderer->drawBox(m_box); diff --git a/engine/shared/library/sharedCollision/src/shared/extent/CollisionDetect.cpp b/engine/shared/library/sharedCollision/src/shared/extent/CollisionDetect.cpp index 1602025b..6f1dce72 100755 --- a/engine/shared/library/sharedCollision/src/shared/extent/CollisionDetect.cpp +++ b/engine/shared/library/sharedCollision/src/shared/extent/CollisionDetect.cpp @@ -49,11 +49,11 @@ int CollisionDetect::getTestCounter ( void ) BaseExtent const * getCollisionExtent_p ( Object const * obj ) { - if(obj == NULL) return NULL; + if(obj == nullptr) return nullptr; CollisionProperty const * collision = obj->getCollisionProperty(); - if(!collision) return NULL; + if(!collision) return nullptr; return collision->getExtent_p(); } @@ -62,8 +62,8 @@ BaseExtent const * getCollisionExtent_p ( Object const * obj ) DetectResult CollisionDetect::testObjects ( Object const * objA, Object const * objB ) { - if(objA == NULL) return false; - if(objB == NULL) return false; + if(objA == nullptr) return false; + if(objB == nullptr) return false; // ---------- @@ -85,8 +85,8 @@ DetectResult CollisionDetect::testObjects ( Object const * objA, Object const * DetectResult CollisionDetect::testObjects ( Object const * objA, Vector const & velocity, Object const * objB ) { - if(objA == NULL) return false; - if(objB == NULL) return false; + if(objA == nullptr) return false; + if(objB == nullptr) return false; // ---------- @@ -108,8 +108,8 @@ DetectResult CollisionDetect::testObjects ( Object const * objA, Vector const & DetectResult CollisionDetect::testObjectsAsCylinders ( Object const * objA, Object const * objB ) { - if(objA == NULL) return false; - if(objB == NULL) return false; + if(objA == nullptr) return false; + if(objB == nullptr) return false; // ---------- @@ -133,7 +133,7 @@ DetectResult CollisionDetect::testObjectsAsCylinders ( Object const * objA, Obje DetectResult CollisionDetect::testObjectExtent ( Object const * objA, BaseExtent const * extentB ) { - if(objA == NULL) return false; + if(objA == nullptr) return false; CollisionProperty const * collA = objA->getCollisionProperty(); @@ -158,7 +158,7 @@ DetectResult CollisionDetect::testSphereExtent ( Sphere const & sphereA, BaseExt // don't return a DetectResult that contains a pointer to a temporary - result.extentA = NULL; + result.extentA = nullptr; return result; } @@ -175,7 +175,7 @@ DetectResult CollisionDetect::testSphereExtent ( Sphere const & sphereA, Vector // don't return a DetectResult that contains a pointer to a temporary - result.extentA = NULL; + result.extentA = nullptr; return result; } @@ -184,7 +184,7 @@ DetectResult CollisionDetect::testSphereExtent ( Sphere const & sphereA, Vector DetectResult CollisionDetect::testSphereObject ( Sphere const & sphereA, Object const * objB ) { - if(objB == NULL) return false; + if(objB == nullptr) return false; CollisionProperty const * collB = objB->getCollisionProperty(); @@ -201,7 +201,7 @@ DetectResult CollisionDetect::testSphereObject ( Sphere const & sphereA, Object DetectResult CollisionDetect::testSphereObject ( Sphere const & sphereA, Vector const & velocity, Object const * objB ) { - if(objB == NULL) return false; + if(objB == nullptr) return false; CollisionProperty const * collB = objB->getCollisionProperty(); @@ -332,8 +332,8 @@ DetectResult CollisionDetect::testCapsuleObjectAgainstAllTypes(Capsule const & c DetectResult CollisionDetect::testExtents ( BaseExtent const * extentA, BaseExtent const * extentB ) { - if(extentA == NULL) return false; - if(extentB == NULL) return false; + if(extentA == nullptr) return false; + if(extentB == nullptr) return false; ExtentType typeA = extentA->getType(); ExtentType typeB = extentB->getType(); @@ -352,8 +352,8 @@ DetectResult CollisionDetect::testExtents ( BaseExtent const * extentA, BaseExte DetectResult CollisionDetect::testExtents ( BaseExtent const * extentA, Vector const & velocity, BaseExtent const * extentB ) { - if(extentA == NULL) return false; - if(extentB == NULL) return false; + if(extentA == nullptr) return false; + if(extentB == nullptr) return false; ExtentType typeA = extentA->getType(); ExtentType typeB = extentB->getType(); @@ -372,8 +372,8 @@ DetectResult CollisionDetect::testExtents ( BaseExtent const * extentA, Vector c DetectResult CollisionDetect::testExtentsAsCylinders ( BaseExtent const * extentA, BaseExtent const * extentB ) { - if(extentA == NULL) return false; - if(extentB == NULL) return false; + if(extentA == nullptr) return false; + if(extentB == nullptr) return false; SimpleExtent const * simpleExtentA = safe_cast(extentA); SimpleExtent const * simpleExtentB = safe_cast(extentB); diff --git a/engine/shared/library/sharedCollision/src/shared/extent/CollisionDetect.h b/engine/shared/library/sharedCollision/src/shared/extent/CollisionDetect.h index 8bc78848..0974a602 100755 --- a/engine/shared/library/sharedCollision/src/shared/extent/CollisionDetect.h +++ b/engine/shared/library/sharedCollision/src/shared/extent/CollisionDetect.h @@ -25,16 +25,16 @@ public: DetectResult() : collided(false), collisionTime(Range::empty), - extentA(NULL), - extentB(NULL) + extentA(nullptr), + extentB(nullptr) { } DetectResult ( bool result ) : collided(result), collisionTime( result ? Range::inf : Range::empty ), - extentA(NULL), - extentB(NULL) + extentA(nullptr), + extentB(nullptr) { } diff --git a/engine/shared/library/sharedCollision/src/shared/extent/CompositeExtent.cpp b/engine/shared/library/sharedCollision/src/shared/extent/CompositeExtent.cpp index d7a6d91a..e005e711 100755 --- a/engine/shared/library/sharedCollision/src/shared/extent/CompositeExtent.cpp +++ b/engine/shared/library/sharedCollision/src/shared/extent/CompositeExtent.cpp @@ -31,11 +31,11 @@ CompositeExtent::~CompositeExtent() { delete m_extents->at(i); - m_extents->at(i) = NULL; + m_extents->at(i) = nullptr; } delete m_extents; - m_extents = NULL; + m_extents = nullptr; } @@ -116,7 +116,7 @@ void CompositeExtent::drawDebugShapes ( DebugShapeRenderer * renderer ) const #ifdef _DEBUG - if(renderer == NULL) return; + if(renderer == nullptr) return; for(int i = 0; i < getExtentCount(); i++) { diff --git a/engine/shared/library/sharedCollision/src/shared/extent/CylinderExtent.cpp b/engine/shared/library/sharedCollision/src/shared/extent/CylinderExtent.cpp index 04d069c9..26cf80c5 100755 --- a/engine/shared/library/sharedCollision/src/shared/extent/CylinderExtent.cpp +++ b/engine/shared/library/sharedCollision/src/shared/extent/CylinderExtent.cpp @@ -146,7 +146,7 @@ void CylinderExtent::drawDebugShapes ( DebugShapeRenderer * renderer ) const #ifdef _DEBUG - if(renderer == NULL) return; + if(renderer == nullptr) return; renderer->setColor( VectorArgb::solidGreen ); renderer->drawCylinder(m_cylinder); diff --git a/engine/shared/library/sharedCollision/src/shared/extent/DetailExtent.cpp b/engine/shared/library/sharedCollision/src/shared/extent/DetailExtent.cpp index 8ceea23a..1648d2c2 100755 --- a/engine/shared/library/sharedCollision/src/shared/extent/DetailExtent.cpp +++ b/engine/shared/library/sharedCollision/src/shared/extent/DetailExtent.cpp @@ -232,11 +232,11 @@ void DetailExtent::updateBounds ( void ) int countExtents ( BaseExtent const * extent ) { - if(extent == NULL) return 0; + if(extent == nullptr) return 0; CompositeExtent const * composite = dynamic_cast(extent); - if(composite == NULL) return 1; + if(composite == nullptr) return 1; int accum = 0; diff --git a/engine/shared/library/sharedCollision/src/shared/extent/Extent.cpp b/engine/shared/library/sharedCollision/src/shared/extent/Extent.cpp index 24768bf9..248e54f1 100755 --- a/engine/shared/library/sharedCollision/src/shared/extent/Extent.cpp +++ b/engine/shared/library/sharedCollision/src/shared/extent/Extent.cpp @@ -369,7 +369,7 @@ void Extent::drawDebugShapes ( DebugShapeRenderer * renderer ) const #ifdef _DEBUG - if(renderer == NULL) return; + if(renderer == nullptr) return; renderer->setColor( VectorArgb::solidYellow ); renderer->drawSphere(m_sphere); diff --git a/engine/shared/library/sharedCollision/src/shared/extent/ExtentList.cpp b/engine/shared/library/sharedCollision/src/shared/extent/ExtentList.cpp index e77715a1..954aac1a 100755 --- a/engine/shared/library/sharedCollision/src/shared/extent/ExtentList.cpp +++ b/engine/shared/library/sharedCollision/src/shared/extent/ExtentList.cpp @@ -44,7 +44,7 @@ Extent * ExtentList::nullFactory ( Iff & iff ) IGNORE_RETURN( iff.goForward() ); - return NULL; + return nullptr; } // ====================================================================== @@ -110,7 +110,7 @@ void ExtentList::remove(void) void ExtentList::assignBinding(Tag tag, CreateFunction createFunction) { - DEBUG_FATAL(!createFunction, ("createFunction may not be NULL")); + DEBUG_FATAL(!createFunction, ("createFunction may not be nullptr")); (*ms_bindImpl.m_map) [tag] = createFunction; } @@ -133,7 +133,7 @@ void ExtentList::removeBinding(Tag tag) /** * Fetch an Extent. * - * This routine may be passed NULL. + * This routine may be passed nullptr. * * This routine will increase the reference count of the specified extent. * @@ -165,7 +165,7 @@ Extent * ExtentList::create(Iff & iff) // handle no extents if (iff.atEndOfForm()) - return NULL; + return nullptr; const Tag tag = iff.getCurrentName(); @@ -201,7 +201,7 @@ const Extent *ExtentList::fetch(Iff & iff) /** * Release an Extent. * - * This routine may be passed NULL. + * This routine may be passed nullptr. * * This routine will decrement the reference count of the Extent. When * the reference count becomes 0, the Extent will be deleted. diff --git a/engine/shared/library/sharedCollision/src/shared/extent/MeshExtent.cpp b/engine/shared/library/sharedCollision/src/shared/extent/MeshExtent.cpp index 2384b251..c32e7857 100755 --- a/engine/shared/library/sharedCollision/src/shared/extent/MeshExtent.cpp +++ b/engine/shared/library/sharedCollision/src/shared/extent/MeshExtent.cpp @@ -62,15 +62,15 @@ SimpleCollisionMesh * MeshExtent::createMesh( IndexedTriangleList * tris ) MeshExtent::MeshExtent() : Extent(ET_Mesh), - m_mesh(NULL), + m_mesh(nullptr), m_box() { - m_mesh = createMesh(NULL); + m_mesh = createMesh(nullptr); } MeshExtent::MeshExtent( IndexedTriangleList * tris ) : Extent(ET_Mesh), - m_mesh(NULL), + m_mesh(nullptr), m_box() { m_mesh = createMesh(tris); @@ -86,7 +86,7 @@ MeshExtent::MeshExtent( SimpleCollisionMesh * mesh ) MeshExtent::~MeshExtent() { delete m_mesh; - m_mesh = NULL; + m_mesh = nullptr; } // ---------------------------------------------------------------------- @@ -168,7 +168,7 @@ void MeshExtent::drawDebugShapes ( DebugShapeRenderer * renderer ) const #ifdef _DEBUG - if(renderer == NULL) return; + if(renderer == nullptr) return; renderer->setColor( VectorArgb::solidWhite ); m_mesh->drawDebugShapes(renderer); diff --git a/engine/shared/library/sharedCollision/src/shared/extent/OrientedCylinderExtent.cpp b/engine/shared/library/sharedCollision/src/shared/extent/OrientedCylinderExtent.cpp index 234db209..113784a6 100755 --- a/engine/shared/library/sharedCollision/src/shared/extent/OrientedCylinderExtent.cpp +++ b/engine/shared/library/sharedCollision/src/shared/extent/OrientedCylinderExtent.cpp @@ -106,7 +106,7 @@ void OrientedCylinderExtent::drawDebugShapes ( DebugShapeRenderer * renderer ) c #ifdef _DEBUG - if(renderer == NULL) return; + if(renderer == nullptr) return; renderer->setColor( VectorArgb::solidGreen ); renderer->draw(m_cylinder); diff --git a/engine/shared/library/sharedCollision/src/shared/extent/SimpleExtent.cpp b/engine/shared/library/sharedCollision/src/shared/extent/SimpleExtent.cpp index 5e744c37..bc8a27e6 100755 --- a/engine/shared/library/sharedCollision/src/shared/extent/SimpleExtent.cpp +++ b/engine/shared/library/sharedCollision/src/shared/extent/SimpleExtent.cpp @@ -146,7 +146,7 @@ void SimpleExtent::drawDebugShapes ( DebugShapeRenderer * renderer ) const #ifdef _DEBUG - if(renderer == NULL) return; + if(renderer == nullptr) return; switch( getShape().getShapeType() ) { diff --git a/engine/shared/library/sharedCompression/src/shared/BitStream.cpp b/engine/shared/library/sharedCompression/src/shared/BitStream.cpp index 7cc5876c..54d2a244 100755 --- a/engine/shared/library/sharedCompression/src/shared/BitStream.cpp +++ b/engine/shared/library/sharedCompression/src/shared/BitStream.cpp @@ -48,8 +48,8 @@ BitBuffer::BitBuffer(void *buffer, int size, bool inputStream) current(base), bufSize(size) { - DEBUG_FATAL(!buffer, ("buffer null")); - DEBUG_FATAL(!current, ("buffer null")); + DEBUG_FATAL(!buffer, ("buffer nullptr")); + DEBUG_FATAL(!current, ("buffer nullptr")); } // ---------------------------------------------------------------------- @@ -59,8 +59,8 @@ BitBuffer::BitBuffer(void *buffer, int size, bool inputStream) BitBuffer::~BitBuffer(void) { - base = NULL; - current = NULL; + base = nullptr; + current = nullptr; } // ---------------------------------------------------------------------- @@ -181,17 +181,17 @@ BitFile::BitFile(const char *fileName, bool inputStream) { if (isInput) { - hFile = CreateFile(fileName, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + hFile = CreateFile(fileName, GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); } else { // try to truncate it first - hFile = CreateFile(fileName, GENERIC_READ | GENERIC_WRITE, 0, NULL, TRUNCATE_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + hFile = CreateFile(fileName, GENERIC_READ | GENERIC_WRITE, 0, nullptr, TRUNCATE_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); if (hFile == INVALID_HANDLE_VALUE) { //if that fails, create it - hFile = CreateFile(fileName, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + hFile = CreateFile(fileName, GENERIC_READ | GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); } } @@ -215,7 +215,7 @@ BitFile::~BitFile(void) } } - hFile = NULL; + hFile = nullptr; delete [] name; } @@ -224,7 +224,7 @@ BitFile::~BitFile(void) int BitFile::getOffset(void) const { - return static_cast(SetFilePointer(hFile, 0, NULL, FILE_CURRENT)); + return static_cast(SetFilePointer(hFile, 0, nullptr, FILE_CURRENT)); } // ---------------------------------------------------------------------- @@ -254,7 +254,7 @@ void BitFile::outputBits(uint32 code, uint32 count) if (!mask) { uint32 bytesWritten; - if (!WriteFile(hFile, &rack, sizeof(rack), &bytesWritten, NULL)) + if (!WriteFile(hFile, &rack, sizeof(rack), &bytesWritten, nullptr)) { DEBUG_FATAL(true,("BitFile::outputBits error %d.", GetLastError())); } @@ -280,7 +280,7 @@ void BitFile::outputRack(void) if (mask != INITIAL_MASK_VALUE) { - if (!WriteFile(hFile, &rack, sizeof(rack), &bytesWritten, NULL)) + if (!WriteFile(hFile, &rack, sizeof(rack), &bytesWritten, nullptr)) { DEBUG_FATAL(true,("BitFile::outputRack writing error %d.", GetLastError())); } @@ -312,7 +312,7 @@ uint32 BitFile::inputBits(uint32 count) { uint32 bytesRead; - const BOOL result = ReadFile(hFile, &rack, sizeof(rack), &bytesRead, NULL); + const BOOL result = ReadFile(hFile, &rack, sizeof(rack), &bytesRead, nullptr); UNREF(result); DEBUG_FATAL(result && !bytesRead,("BitFile::inputBits hit EOF")); @@ -383,8 +383,8 @@ ByteBuffer::ByteBuffer(void *buffer, int size, bool inputStream) ByteBuffer::~ByteBuffer(void) { - base = NULL; - current = NULL; + base = nullptr; + current = nullptr; } // ---------------------------------------------------------------------- @@ -422,7 +422,7 @@ void ByteBuffer::output(byte b) bool ByteBuffer::input(byte *b) { - DEBUG_FATAL(!b, ("null pointer")); + DEBUG_FATAL(!b, ("nullptr pointer")); DEBUG_FATAL(!isInput,("ByteBuffer::input called on output stream")); if ((current - base) >= bufSize) @@ -446,15 +446,15 @@ ByteFile::ByteFile(const char *fileName, bool inputStream) { if (isInput) { - hFile = CreateFile(fileName, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + hFile = CreateFile(fileName, GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); } else { - hFile = CreateFile(fileName, GENERIC_READ | GENERIC_WRITE, 0, NULL, TRUNCATE_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + hFile = CreateFile(fileName, GENERIC_READ | GENERIC_WRITE, 0, nullptr, TRUNCATE_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); if (hFile == INVALID_HANDLE_VALUE) { - hFile = CreateFile(fileName, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + hFile = CreateFile(fileName, GENERIC_READ | GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); } } @@ -473,7 +473,7 @@ ByteFile::~ByteFile(void) if (hFile != INVALID_HANDLE_VALUE && !CloseHandle(hFile)) DEBUG_FATAL(true,("ByteFile::~ByteFile - Unable to close HANDLE for file %s - Error %d", name, GetLastError())); - hFile = NULL; + hFile = nullptr; delete [] name; } @@ -482,7 +482,7 @@ ByteFile::~ByteFile(void) int ByteFile::getOffset(void) const { - return static_cast(SetFilePointer(hFile, 0, NULL, FILE_CURRENT)); + return static_cast(SetFilePointer(hFile, 0, nullptr, FILE_CURRENT)); } // ---------------------------------------------------------------------- @@ -497,7 +497,7 @@ void ByteFile::output(byte b) byte out = b; uint32 bytesWritten; - if (!WriteFile(hFile, &out, sizeof(byte), &bytesWritten, NULL)) + if (!WriteFile(hFile, &out, sizeof(byte), &bytesWritten, nullptr)) { DEBUG_FATAL(true,("ByteFile::output error %d.", GetLastError())); } @@ -518,7 +518,7 @@ bool ByteFile::input(byte *b) DEBUG_FATAL(!isInput,("ByteFile::input called on output stream.")); uint32 bytesRead; - BOOL result = ReadFile(hFile, b, sizeof(byte), &bytesRead, NULL); + BOOL result = ReadFile(hFile, b, sizeof(byte), &bytesRead, nullptr); // check for EOS return (result && !bytesRead); diff --git a/engine/shared/library/sharedCompression/src/shared/Lz77.cpp b/engine/shared/library/sharedCompression/src/shared/Lz77.cpp index cb18232f..1f630cb8 100755 --- a/engine/shared/library/sharedCompression/src/shared/Lz77.cpp +++ b/engine/shared/library/sharedCompression/src/shared/Lz77.cpp @@ -47,7 +47,7 @@ Lz77::Lz77(uint32 _indexBitCount, uint32 _lengthBitCount) lookAheadSize(rawLookAheadSize + breakEven), treeRoot(windowSize), window(new byte[windowSize]), - tree(NULL) + tree(nullptr) { } @@ -232,10 +232,10 @@ uint32 Lz77::findNextNode(uint32 node) * Delete a string from the tree. * * This routine performs the classic binary tree deletion algorithm. - * If the node to be deleted has a null link in either direction, we - * just pull the non-null link up one to replace the existing link. + * If the node to be deleted has a nullptr link in either direction, we + * just pull the non-nullptr link up one to replace the existing link. * If both links exist, we instead delete the next link in order, which - * is guaranteed to have a null link, then replace the node to be deleted + * is guaranteed to have a nullptr link, then replace the node to be deleted * with the next link. */ @@ -286,7 +286,7 @@ uint32 Lz77::addString(uint32 newNode, uint32 *matchPosition) uint32 *child; int delta = 0; - DEBUG_FATAL(!matchPosition, ("matchPosition is NULL")); + DEBUG_FATAL(!matchPosition, ("matchPosition is nullptr")); if (newNode == endOfStream) return 0; diff --git a/engine/shared/library/sharedCompression/src/shared/ZlibCompressor.cpp b/engine/shared/library/sharedCompression/src/shared/ZlibCompressor.cpp index aedbda00..7f3aed3d 100755 --- a/engine/shared/library/sharedCompression/src/shared/ZlibCompressor.cpp +++ b/engine/shared/library/sharedCompression/src/shared/ZlibCompressor.cpp @@ -121,8 +121,8 @@ void ZlibCompressorNamespace::remove() DEBUG_FATAL(static_cast(ms_memoryPool.size()) != ms_poolElementCount, ("ZLibCompressor memory pool entries not all released")); operator delete(ms_memoryBottom); - ms_memoryBottom = NULL; - ms_memoryTop = NULL; + ms_memoryBottom = nullptr; + ms_memoryTop = nullptr; ms_memoryPool.clear(); ms_mutex.leave(); @@ -155,12 +155,12 @@ int ZlibCompressor::compress(const void *inputBuffer, int inputSize, void *outpu z.avail_out = outputSize; z.total_out = 0; - z.msg = NULL; - z.state = NULL; + z.msg = nullptr; + z.state = nullptr; z.zalloc = allocateWrapper; z.zfree = freeWrapper; - z.opaque = NULL; + z.opaque = nullptr; z.data_type = Z_BINARY; z.adler = 0; @@ -196,12 +196,12 @@ int ZlibCompressor::expand(const void *inputBuffer, int inputSize, void *outputB z.avail_out = outputSize; z.total_out = 0; - z.msg = NULL; - z.state = NULL; + z.msg = nullptr; + z.state = nullptr; z.zalloc = allocateWrapper; z.zfree = freeWrapper; - z.opaque = NULL; + z.opaque = nullptr; z.data_type = Z_BINARY; z.adler = 0; diff --git a/engine/shared/library/sharedDatabaseInterface/src/shared/core/Bindable.h b/engine/shared/library/sharedDatabaseInterface/src/shared/core/Bindable.h index 22617057..03c2d7dc 100755 --- a/engine/shared/library/sharedDatabaseInterface/src/shared/core/Bindable.h +++ b/engine/shared/library/sharedDatabaseInterface/src/shared/core/Bindable.h @@ -1,13 +1,13 @@ /* Bindable.h * * Defines classes based on built-in simple types that know how to bind themselves to - * database queries and support null values. + * database queries and support nullptr values. * * Each class supports the following functions: - * bool isNull -- test whether the value is null - * void setToNull -- set the value to null - * getValue -- return the value (make sure you test for null before calling this. The results - * are undefined if the Bindable is null.) + * bool isNull -- test whether the value is nullptr + * void setToNull -- set the value to nullptr + * getValue -- return the value (make sure you test for nullptr before calling this. The results + * are undefined if the Bindable is nullptr.) * setValue -- set the value * * ODBC version diff --git a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableBase.h b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableBase.h index 51008166..2aa7e5b8 100755 --- a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableBase.h +++ b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableBase.h @@ -31,7 +31,7 @@ namespace DB { explicit Bindable(int _indicator); /** - * The size of the data, or -1 for NULL. + * The size of the data, or -1 for nullptr. */ int indicator; }; diff --git a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableBool.h b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableBool.h index 36929d60..044371fe 100755 --- a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableBool.h +++ b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableBool.h @@ -18,7 +18,7 @@ namespace DB { /** Represents a bool in C++, bound to a CHAR(1) column. The column can have the values 'Y' or 'N'. - * TODO: use a boolean type in the database, if we can find one that allows NULL's and is fairly + * TODO: use a boolean type in the database, if we can find one that allows nullptr's and is fairly * portable. (May not exist -- according to the docs, Oracle does not have a boolean datatype.) */ class BindableBool : public Bindable diff --git a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableString.h b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableString.h index 103b2ada..2548990e 100755 --- a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableString.h +++ b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableString.h @@ -133,11 +133,11 @@ namespace DB std::string getValueASCII() const; /** Allocate a new string and copy the buffer to it. The caller takes responsibility - for delete[]ing it later. (If the string is NULL, this returns a null pointer.) + for delete[]ing it later. (If the string is nullptr, this returns a nullptr pointer.) */ char *makeCopyOfValue() const; -/** Set the value of the bindable string from another (null-terminated) string +/** Set the value of the bindable string from another (nullptr-terminated) string If the source buffer is too big, it FATAL's. Another alternative would be to have it truncate the string. Right now, it's better to FATAL to avoid hard-to-find bugs @@ -168,7 +168,7 @@ namespace DB private: - char m_value[S+1]; // column of size S, plus one byte for a trailing null + char m_value[S+1]; // column of size S, plus one byte for a trailing nullptr }; // ====================================================================== @@ -206,7 +206,7 @@ namespace DB { if (isNull()) { - return strncpy(buffer,"\0",1); // in the database, a zero-length string and a NULL aren't really + return strncpy(buffer,"\0",1); // in the database, a zero-length string and a nullptr aren't really // the same thing, but this is the closest we can do here. } return strncpy(buffer,m_value,(bufsize>(S+1))?(S+1):bufsize); @@ -259,7 +259,7 @@ namespace DB } FATAL((i==S+1) && (m_value[S]!='\0'),("Attempt to save string \"%s\" to the database. It is too long for the column.",buffer)); indicator=i; // set indicator to actual length of string -// m_value[S]='\0'; // guarantee null terminator -- uncomment if you remove the above FATAL +// m_value[S]='\0'; // guarantee nullptr terminator -- uncomment if you remove the above FATAL } template diff --git a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableUnicode.h b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableUnicode.h index 9c85e6d4..544ead4c 100755 --- a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableUnicode.h +++ b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableUnicode.h @@ -143,7 +143,7 @@ namespace DB private: - char m_value[S+1]; // column of size S, plus one byte for a trailing null + char m_value[S+1]; // column of size S, plus one byte for a trailing nullptr }; // ====================================================================== diff --git a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBufferRow.h b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBufferRow.h index 0d1b70d0..550f2896 100755 --- a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBufferRow.h +++ b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBufferRow.h @@ -33,9 +33,9 @@ namespace DB * Combines the values in this row with the values in newRow. * * For each column: - * If the column is null in newRow, do nothing. (Leave the value + * If the column is nullptr in newRow, do nothing. (Leave the value * in this row unchanged.) - * If the column is not null in newRow, replace the value in this + * If the column is not nullptr in newRow, replace the value in this * row with the value in newRow. */ virtual void combine(const DB::Row &newRow) =0; diff --git a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbServer.cpp b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbServer.cpp index 13f7460e..83015b31 100755 --- a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbServer.cpp +++ b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbServer.cpp @@ -29,7 +29,7 @@ using namespace DB; Mutex Server::ms_profileMutex; bool Server::ms_enableProfiling = false; bool Server::ms_enableVerboseMode = false; -DB::Profiler *Server::ms_profiler = NULL; +DB::Profiler *Server::ms_profiler = nullptr; int Server::ms_reconnectTime=0; int Server::ms_maxErrorCountBeforeDisconnect=5; int Server::ms_maxErrorCountBeforeBailout=10; @@ -51,7 +51,7 @@ Server::SesListElem::SesListElem (Session *_ses, SesListElem *_next) : ses (_ses // ---------------------------------------------------------------------- Server::Server(const char *_dsn, const char *_uid, const char *_pwd, bool useMemoryManager) : - sessionList (NULL), + sessionList (nullptr), sessionListLock(), m_useMemoryManager(useMemoryManager) { @@ -194,7 +194,7 @@ Session *Server::popSession() else { sessionListLock.leave(); - return NULL; + return nullptr; } } @@ -294,7 +294,7 @@ void Server::endProfiling() { ms_profileMutex.enter(); delete ms_profiler; - ms_profiler = NULL; + ms_profiler = nullptr; ms_enableProfiling = false; ms_profileMutex.leave(); } diff --git a/engine/shared/library/sharedDatabaseInterface/src/shared/core/NullEncodedStandardString.h b/engine/shared/library/sharedDatabaseInterface/src/shared/core/NullEncodedStandardString.h index ff154c7c..57a4395e 100755 --- a/engine/shared/library/sharedDatabaseInterface/src/shared/core/NullEncodedStandardString.h +++ b/engine/shared/library/sharedDatabaseInterface/src/shared/core/NullEncodedStandardString.h @@ -15,7 +15,7 @@ // ====================================================================== /** - * A unicode-string-compatible class that encodes a null value as a single space + * A unicode-string-compatible class that encodes a nullptr value as a single space */ class NullEncodedStandardString { diff --git a/engine/shared/library/sharedDatabaseInterface/src/shared/core/NullEncodedUnicodeString.h b/engine/shared/library/sharedDatabaseInterface/src/shared/core/NullEncodedUnicodeString.h index b28de588..45a2c521 100755 --- a/engine/shared/library/sharedDatabaseInterface/src/shared/core/NullEncodedUnicodeString.h +++ b/engine/shared/library/sharedDatabaseInterface/src/shared/core/NullEncodedUnicodeString.h @@ -15,7 +15,7 @@ // ====================================================================== /** - * A unicode-string-compatible class that encodes a null value as a single space + * A unicode-string-compatible class that encodes a nullptr value as a single space */ class NullEncodedUnicodeString { diff --git a/engine/shared/library/sharedDatabaseInterface/src_oci/DbBindableVarray.cpp b/engine/shared/library/sharedDatabaseInterface/src_oci/DbBindableVarray.cpp index 7fff3387..b0cec73d 100755 --- a/engine/shared/library/sharedDatabaseInterface/src_oci/DbBindableVarray.cpp +++ b/engine/shared/library/sharedDatabaseInterface/src_oci/DbBindableVarray.cpp @@ -22,9 +22,9 @@ using namespace DB; BindableVarray::BindableVarray() : m_initialized(false), - m_tdo (NULL), - m_data (NULL), - m_session (NULL) + m_tdo (nullptr), + m_data (nullptr), + m_session (nullptr) { } @@ -52,7 +52,7 @@ bool BindableVarray::create(DB::Session *session, const std::string &name, const schema.length(), reinterpret_cast(const_cast(name.c_str())), name.length(), - NULL, + nullptr, 0, OCI_DURATION_SESSION, OCI_TYPEGET_HEADER, @@ -64,7 +64,7 @@ bool BindableVarray::create(DB::Session *session, const std::string &name, const localSession->errhp, localSession->svchp, OCI_TYPECODE_VARRAY, - m_tdo, NULL, + m_tdo, nullptr, OCI_DURATION_DEFAULT, true, reinterpret_cast(&m_data))))) @@ -86,9 +86,9 @@ void BindableVarray::free() OCIObjectFree (localSession->envhp, localSession->errhp, m_data, 0))); m_initialized = false; - m_tdo=NULL; - m_data=NULL; - m_session=NULL; + m_tdo=nullptr; + m_data=nullptr; + m_session=nullptr; } // ---------------------------------------------------------------------- @@ -354,7 +354,7 @@ std::string BindableVarrayNumber::outputValue() const if (exists) { if (*indicator == OCI_IND_NULL) - result += "NULL"; + result += "nullptr"; else { double value; @@ -400,7 +400,7 @@ bool BindableVarrayString::push_back(const Unicode::String &value) bool BindableVarrayString::push_back(const std::string &value) { - OCIString *buffer = NULL; + OCIString *buffer = nullptr; OCIInd buffer_indicator (OCI_IND_NOTNULL); OCISession *localSession = safe_cast(m_session); @@ -437,7 +437,7 @@ bool BindableVarrayString::push_back(bool bvalue) else value = "N"; - OCIString *buffer = NULL; + OCIString *buffer = nullptr; OCIInd buffer_indicator (OCI_IND_NOTNULL); OCISession *localSession = safe_cast(m_session); @@ -469,7 +469,7 @@ bool BindableVarrayString::push_back(bool IsNULL, const Unicode::String &value) bool BindableVarrayString::push_back(bool IsNULL, const std::string &value) { - OCIString *buffer = NULL; + OCIString *buffer = nullptr; OCIInd buffer_indicator; if ( IsNULL ) { @@ -515,7 +515,7 @@ bool BindableVarrayString::push_back(bool IsNULL, bool bvalue) else value = "N"; - OCIString *buffer = NULL; + OCIString *buffer = nullptr; OCIInd buffer_indicator; if ( IsNULL ) { @@ -568,14 +568,14 @@ std::string BindableVarrayString::outputValue() const if (exists) { if (*indicator == OCI_IND_NULL) - result += "NULL"; + result += "nullptr"; else { OraText * text = OCIStringPtr(localSession->envhp, *element); if (text) result += '"' + std::string(reinterpret_cast(text)) + '"'; else - result += "NULL"; + result += "nullptr"; } } else diff --git a/engine/shared/library/sharedDatabaseInterface/src_oci/OciQueryImplementation.cpp b/engine/shared/library/sharedDatabaseInterface/src_oci/OciQueryImplementation.cpp index ab311290..b4486dc8 100755 --- a/engine/shared/library/sharedDatabaseInterface/src_oci/OciQueryImplementation.cpp +++ b/engine/shared/library/sharedDatabaseInterface/src_oci/OciQueryImplementation.cpp @@ -49,13 +49,13 @@ bool DB::OCIQueryImpl::setup(Session *session) { // setSession(session); - DEBUG_FATAL(m_session!=0,("m_session was not NULL")); - DEBUG_FATAL(m_server!=0,("m_server was not NULL")); + DEBUG_FATAL(m_session!=0,("m_session was not nullptr")); + DEBUG_FATAL(m_server!=0,("m_server was not nullptr")); DEBUG_FATAL(m_stmthp!=0,("m_stmthp was not 0")); DEBUG_FATAL(m_cursorhp!=0,("m_cursorhp was not 0")); m_session=dynamic_cast(session); - FATAL((m_session==0),("Must pass a non-NULL OCISession to setup().")); + FATAL((m_session==0),("Must pass a non-nullptr OCISession to setup().")); m_server=m_session->m_server; NOT_NULL(m_server); @@ -180,7 +180,7 @@ bool DB::OCIQueryImpl::exec() m_session->setOkToFetch(); m_session->setLastQueryStatement(m_sql); sword status=OCIStmtExecute(m_session->svchp, m_stmthp, m_session->errhp, 1, 0, - NULL, NULL, OCI_DEFAULT); + nullptr, nullptr, OCI_DEFAULT); if (status == OCI_NO_DATA) { @@ -393,8 +393,8 @@ DB::OCIQueryImpl::BindRec::BindRec(size_t numElements) : length(0), stringAdjust(false), m_numElements(numElements), - m_indicatorArray(NULL), - m_lengthArray(NULL) + m_indicatorArray(nullptr), + m_lengthArray(nullptr) { // This is ugly, but it avoids having to create two different kinds of bindrecs that inherit from an abstract base class if (m_numElements > 1) @@ -714,11 +714,11 @@ bool DB::OCIQueryImpl::bindParameter(BindableVarray &buffer) &(br->bindp), m_session->errhp, nextParameter++, - NULL, + nullptr, 0, SQLT_NTY, - NULL, - NULL, + nullptr, + nullptr, 0, 0, 0, diff --git a/engine/shared/library/sharedDatabaseInterface/src_oci/OciServer.cpp b/engine/shared/library/sharedDatabaseInterface/src_oci/OciServer.cpp index ead0cb9c..7c40e0ae 100755 --- a/engine/shared/library/sharedDatabaseInterface/src_oci/OciServer.cpp +++ b/engine/shared/library/sharedDatabaseInterface/src_oci/OciServer.cpp @@ -63,7 +63,7 @@ bool DB::OCIServer::checkerr(OCISession const & session, int status) text errbuf[512]; sb4 errcode = 0; - OCIErrorGet((dvoid *)(session.errhp), (ub4) 1, (text *) NULL, &errcode, + OCIErrorGet((dvoid *)(session.errhp), (ub4) 1, (text *) nullptr, &errcode, errbuf, (ub4) sizeof(errbuf), OCI_HTYPE_ERROR); WARNING(true,("Database error: %.*s",512,errbuf)); diff --git a/engine/shared/library/sharedDatabaseInterface/src_oci/OciSession.cpp b/engine/shared/library/sharedDatabaseInterface/src_oci/OciSession.cpp index 124998bc..e7e7bc66 100755 --- a/engine/shared/library/sharedDatabaseInterface/src_oci/OciSession.cpp +++ b/engine/shared/library/sharedDatabaseInterface/src_oci/OciSession.cpp @@ -56,11 +56,11 @@ static void freeHook(dvoid *, dvoid *memptr) DB::OCISession::OCISession(DB::OCIServer *server) : m_server(server), - envhp(NULL), - errhp(NULL), - srvhp(NULL), - sesp(NULL), - svchp(NULL), + envhp(nullptr), + errhp(nullptr), + srvhp(nullptr), + sesp(nullptr), + svchp(nullptr), autoCommitMode(true), m_resetTime(server->getReconnectTime()==0 ? 0 : time(0) + server->getReconnectTime()), m_okToFetch(true) @@ -235,11 +235,11 @@ bool DB::OCISession::disconnect() success = false; } - svchp = NULL; - sesp = NULL; - srvhp = NULL; - errhp = NULL; - envhp = NULL; + svchp = nullptr; + sesp = nullptr; + srvhp = nullptr; + errhp = nullptr; + envhp = nullptr; connectLock.leave(); return success; diff --git a/engine/shared/library/sharedDebug/src/linux/DebugMonitor.cpp b/engine/shared/library/sharedDebug/src/linux/DebugMonitor.cpp index 3dff8883..95dfef41 100755 --- a/engine/shared/library/sharedDebug/src/linux/DebugMonitor.cpp +++ b/engine/shared/library/sharedDebug/src/linux/DebugMonitor.cpp @@ -160,7 +160,7 @@ void DebugMonitor::install(void) // handle input from the output terminal, particularly to // handle profiler modifications when the output window // is active. - s_outputScreen = newterm(NULL, s_ttyOutputFile, stdin); + s_outputScreen = newterm(nullptr, s_ttyOutputFile, stdin); if (!s_outputScreen) { DEBUG_WARNING(true, ("DebugMonitor: newterm() failed [%s].", strerror(errno))); diff --git a/engine/shared/library/sharedDebug/src/linux/PerformanceTimer.cpp b/engine/shared/library/sharedDebug/src/linux/PerformanceTimer.cpp index 68c36d8c..f7bd1037 100755 --- a/engine/shared/library/sharedDebug/src/linux/PerformanceTimer.cpp +++ b/engine/shared/library/sharedDebug/src/linux/PerformanceTimer.cpp @@ -39,7 +39,7 @@ PerformanceTimer::~PerformanceTimer() void PerformanceTimer::start() { - int const result = gettimeofday(&startTime, NULL); + int const result = gettimeofday(&startTime, nullptr); FATAL(result != 0,("PerformanceTimer::start failed")); } @@ -55,7 +55,7 @@ void PerformanceTimer::resume() usec += 1000000; } - int const result = gettimeofday(&startTime, NULL); + int const result = gettimeofday(&startTime, nullptr); FATAL(result != 0,("PerformanceTimer::resume failed")); startTime.tv_sec -= sec; @@ -71,7 +71,7 @@ void PerformanceTimer::resume() void PerformanceTimer::stop() { - int result = gettimeofday(&stopTime, NULL); + int result = gettimeofday(&stopTime, nullptr); FATAL(result != 0,("PerformanceTimer::start failed")); } @@ -95,7 +95,7 @@ float PerformanceTimer::getSplitTime() const { timeval currentTime; - int const result = gettimeofday(¤tTime, NULL); + int const result = gettimeofday(¤tTime, nullptr); FATAL(result != 0,("PerformanceTimer::getSplitTime failed")); long sec = currentTime.tv_sec - startTime.tv_sec; @@ -117,7 +117,7 @@ void PerformanceTimer::logElapsedTime(const char* string) const #ifdef _DEBUG static char buffer [1000]; - sprintf(buffer, "%s : %1.5f seconds\n", string ? string : "null", getElapsedTime()); + sprintf(buffer, "%s : %1.5f seconds\n", string ? string : "nullptr", getElapsedTime()); DEBUG_REPORT_LOG_PRINT(true, ("%s", buffer)); #endif } diff --git a/engine/shared/library/sharedDebug/src/shared/DataLint.cpp b/engine/shared/library/sharedDebug/src/shared/DataLint.cpp index 5190728f..8f96856d 100755 --- a/engine/shared/library/sharedDebug/src/shared/DataLint.cpp +++ b/engine/shared/library/sharedDebug/src/shared/DataLint.cpp @@ -35,9 +35,9 @@ namespace DataLintNamespace bool ms_installed = false; DataLint::AssetType m_currentAssetType = DataLint::AT_invalid; bool m_enabled = false; - WarningList * m_warningList = NULL; - StringList * m_assetStack = NULL; - DataLint::StringPairList * m_assetList = NULL; + WarningList * m_warningList = nullptr; + StringList * m_assetStack = nullptr; + DataLint::StringPairList * m_assetList = nullptr; std::string m_dataLintCategorizedAssetsFile("DataLint_CategorizedAssets.txt"); std::string m_dataLintUnSupportedAssetsFile("DataLint_UnSupportedAssets.txt"); Mode m_mode = M_client; @@ -123,17 +123,17 @@ void DataLint::report() // Client only - FILE *assetErrorFileAppearance = NULL; - FILE *assetErrorFileArrangementDescriptor = NULL; - FILE *assetErrorFileLocalizedStringTable = NULL; - FILE *assetErrorFilePortalProperty = NULL; - FILE *assetErrorFileShaderTemplate = NULL; - FILE *assetErrorFileSkyBox = NULL; - FILE *assetErrorFileSlotDescriptor = NULL; - FILE *assetErrorFileSoundTemplate = NULL; - FILE *assetErrorFileTerrain = NULL; - FILE *assetErrorFileTexture = NULL; - FILE *assetErrorFileTextureRenderer = NULL; + FILE *assetErrorFileAppearance = nullptr; + FILE *assetErrorFileArrangementDescriptor = nullptr; + FILE *assetErrorFileLocalizedStringTable = nullptr; + FILE *assetErrorFilePortalProperty = nullptr; + FILE *assetErrorFileShaderTemplate = nullptr; + FILE *assetErrorFileSkyBox = nullptr; + FILE *assetErrorFileSlotDescriptor = nullptr; + FILE *assetErrorFileSoundTemplate = nullptr; + FILE *assetErrorFileTerrain = nullptr; + FILE *assetErrorFileTexture = nullptr; + FILE *assetErrorFileTextureRenderer = nullptr; if (m_mode == M_client) { @@ -450,7 +450,7 @@ std::string DataLintNamespace::formatErrorMessage(WarningPair &warningPair, int char *assetError = strstr(text, " : "); - if (assetError != NULL) + if (assetError != nullptr) { ++assetError; ++assetError; @@ -567,12 +567,12 @@ void DataLint::clearAssetStack() //----------------------------------------------------------------------------- void DataLint::addFilePath(char const *filePath) { - if (filePath == NULL || (strlen(filePath) <= 0)) + if (filePath == nullptr || (strlen(filePath) <= 0)) { return; } - if (m_assetList != NULL) + if (m_assetList != nullptr) { char text[4096]; sprintf(text, "%s", filePath); @@ -592,7 +592,7 @@ void DataLint::addFilePath(char const *filePath) //----------------------------------------------------------------------------- void DataLint::removeFilePath(char const *filePath) { - if (m_assetList != NULL) + if (m_assetList != nullptr) { StringPairList::iterator stringPairListIter = m_assetList->begin(); @@ -611,8 +611,8 @@ void DataLint::removeFilePath(char const *filePath) //----------------------------------------------------------------------------- bool DataLintNamespace::isAnAppearanceAsset(char const *text) { - bool const appearanceAsset = (strstr(text, "appearance/") != NULL); - bool const portalPropertyAsset = (strstr(text, ".pob") != NULL); + bool const appearanceAsset = (strstr(text, "appearance/") != nullptr); + bool const portalPropertyAsset = (strstr(text, ".pob") != nullptr); return (appearanceAsset && !portalPropertyAsset); } @@ -620,7 +620,7 @@ bool DataLintNamespace::isAnAppearanceAsset(char const *text) //----------------------------------------------------------------------------- bool DataLintNamespace::isAnArrangementDescriptorAsset(char const *text) { - bool const arrangementDescriptorAsset = (strstr(text, "slot/arrangement/") != NULL); + bool const arrangementDescriptorAsset = (strstr(text, "slot/arrangement/") != nullptr); return arrangementDescriptorAsset; } @@ -628,7 +628,7 @@ bool DataLintNamespace::isAnArrangementDescriptorAsset(char const *text) //----------------------------------------------------------------------------- bool DataLintNamespace::isALocalizedStringAsset(char const *text) { - bool const localizedStringAsset = (strstr(text, ".stf") != NULL); + bool const localizedStringAsset = (strstr(text, ".stf") != nullptr); return localizedStringAsset; } @@ -638,8 +638,8 @@ bool DataLintNamespace::isAnObjectTemplateAsset(char const *text) { bool result = false; UNREF(text); - bool const isInTheObjectDirectory = (strstr(text, "object/") != NULL); - bool const isInTheAbstractDirectory = (strstr(text, "abstract/") != NULL); + bool const isInTheObjectDirectory = (strstr(text, "object/") != nullptr); + bool const isInTheAbstractDirectory = (strstr(text, "abstract/") != nullptr); if (isInTheObjectDirectory || isInTheAbstractDirectory) { @@ -655,7 +655,7 @@ bool DataLintNamespace::isAnObjectTemplateAsset(char const *text) //----------------------------------------------------------------------------- bool DataLintNamespace::isAPortalProprtyAsset(char const *text) { - bool const portalPropertyAsset = (strstr(text, ".pob") != NULL); + bool const portalPropertyAsset = (strstr(text, ".pob") != nullptr); return portalPropertyAsset; } @@ -663,7 +663,7 @@ bool DataLintNamespace::isAPortalProprtyAsset(char const *text) //----------------------------------------------------------------------------- bool DataLintNamespace::isAShaderTemplateAsset(char const *text) { - bool const shaderTemplateAsset = (strstr(text, "shader/") != NULL); + bool const shaderTemplateAsset = (strstr(text, "shader/") != nullptr); return shaderTemplateAsset; } @@ -671,7 +671,7 @@ bool DataLintNamespace::isAShaderTemplateAsset(char const *text) //----------------------------------------------------------------------------- bool DataLintNamespace::isASkyBoxAsset(char const *text) { - bool const skyBoxAsset = (strstr(text, "skybox/") != NULL); + bool const skyBoxAsset = (strstr(text, "skybox/") != nullptr); return skyBoxAsset; } @@ -679,7 +679,7 @@ bool DataLintNamespace::isASkyBoxAsset(char const *text) //----------------------------------------------------------------------------- bool DataLintNamespace::isASlotDescriptorAsset(char const *text) { - bool const slotDescriptorAsset = (strstr(text, "slot/descriptor/") != NULL); + bool const slotDescriptorAsset = (strstr(text, "slot/descriptor/") != nullptr); return slotDescriptorAsset; } @@ -687,7 +687,7 @@ bool DataLintNamespace::isASlotDescriptorAsset(char const *text) //----------------------------------------------------------------------------- bool DataLintNamespace::isASoundAsset(char const *text) { - bool const soundAsset = (strstr(text, "sound/") != NULL); + bool const soundAsset = (strstr(text, "sound/") != nullptr); return soundAsset; } @@ -701,7 +701,7 @@ bool DataLintNamespace::isATerrainAsset(char const *text) //----------------------------------------------------------------------------- bool DataLintNamespace::isATextureAsset(char const *text) { - bool const textureAsset = (strstr(text, ".dds") != NULL); + bool const textureAsset = (strstr(text, ".dds") != nullptr); return textureAsset; } @@ -709,7 +709,7 @@ bool DataLintNamespace::isATextureAsset(char const *text) //----------------------------------------------------------------------------- bool DataLintNamespace::isATextureRendererTemplateAsset(char const *text) { - bool const textureRendererAsset = (strstr(text, ".trt") != NULL); + bool const textureRendererAsset = (strstr(text, ".trt") != nullptr); return textureRendererAsset; } @@ -749,7 +749,7 @@ bool DataLintNamespace::isAnUnSupportedAsset(char const *text) //----------------------------------------------------------------------------- DataLint::StringPairList DataLintNamespace::getList(int const reserveCount, AssetFunction assetTypeFunction) { - DEBUG_FATAL(!m_assetList, ("DataLint::getList() - m_assetList is NULL")); + DEBUG_FATAL(!m_assetList, ("DataLint::getList() - m_assetList is nullptr")); // Create the list of terrains diff --git a/engine/shared/library/sharedDebug/src/shared/DebugFlags.cpp b/engine/shared/library/sharedDebug/src/shared/DebugFlags.cpp index c676ddeb..c82795d4 100755 --- a/engine/shared/library/sharedDebug/src/shared/DebugFlags.cpp +++ b/engine/shared/library/sharedDebug/src/shared/DebugFlags.cpp @@ -25,8 +25,8 @@ std::vector DebugFlags::ms_flagsSortedByReportPriority; void DebugFlags::config(bool &variable, const char *configSection, const char *configName) { - DEBUG_FATAL(strchr(configSection, ' ') != NULL, ("no spaces are allowed in debug flag section names: %s", configSection)); - DEBUG_FATAL(strchr(configName, ' ') != NULL, ("no spaces are allowed in debug flag names: %s", configName)); + DEBUG_FATAL(strchr(configSection, ' ') != nullptr, ("no spaces are allowed in debug flag section names: %s", configSection)); + DEBUG_FATAL(strchr(configName, ' ') != nullptr, ("no spaces are allowed in debug flag names: %s", configName)); if (configSection && configName && ConfigFile::isInstalled()) { @@ -102,9 +102,9 @@ void DebugFlags::registerFlag(bool &variable, const char *section, const char *n f.section = section; f.name = name; f.reportPriority = 0; - f.reportRoutine1 = NULL; - f.reportRoutine2 = NULL; - f.context = NULL; + f.reportRoutine1 = nullptr; + f.reportRoutine2 = nullptr; + f.context = nullptr; #ifdef _DEBUG f.m_callStack.sample(); #endif @@ -127,8 +127,8 @@ void DebugFlags::registerFlag(bool &variable, const char *section, const char *n f.name = name; f.reportPriority = reportPriority; f.reportRoutine1 = reportRoutine; - f.reportRoutine2 = NULL; - f.context = NULL; + f.reportRoutine2 = nullptr; + f.context = nullptr; #ifdef _DEBUG f.m_callStack.sample(); #endif @@ -150,7 +150,7 @@ void DebugFlags::registerFlag(bool &variable, const char *section, const char *n f.section = section; f.name = name; f.reportPriority = reportPriority; - f.reportRoutine1 = NULL; + f.reportRoutine1 = nullptr; f.reportRoutine2 = reportRoutine; f.context = context; #ifdef _DEBUG @@ -230,7 +230,7 @@ DebugFlags::Flag const * DebugFlags::getFlag(char const * const section, char co return &f; } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedDebug/src/shared/DebugKey.cpp b/engine/shared/library/sharedDebug/src/shared/DebugKey.cpp index 1fb1eefe..3fd2a330 100755 --- a/engine/shared/library/sharedDebug/src/shared/DebugKey.cpp +++ b/engine/shared/library/sharedDebug/src/shared/DebugKey.cpp @@ -108,7 +108,7 @@ bool DebugKey::isDown(int i) bool DebugKey::isActive() { #if PRODUCTION == 0 - return ms_currentFlag != NULL; + return ms_currentFlag != nullptr; #else return false; #endif diff --git a/engine/shared/library/sharedDebug/src/shared/InstallTimer.cpp b/engine/shared/library/sharedDebug/src/shared/InstallTimer.cpp index 5fe48326..80e21bc9 100755 --- a/engine/shared/library/sharedDebug/src/shared/InstallTimer.cpp +++ b/engine/shared/library/sharedDebug/src/shared/InstallTimer.cpp @@ -64,7 +64,7 @@ void InstallTimer::manualExit() unsigned long const endingNumberOfBytesAllocated = MemoryManager::getCurrentNumberOfBytesAllocated(); --ms_indent; REPORT_LOG_PRINT(ms_enabled, ("InstallTimer:%*c%6.4f %d %s\n", ms_indent * 2, ' ', m_performanceTimer.getElapsedTime(), static_cast(endingNumberOfBytesAllocated - m_startingNumberOfBytesAllocated), m_description)); - m_description = NULL; + m_description = nullptr; } } diff --git a/engine/shared/library/sharedDebug/src/shared/PixCounter.cpp b/engine/shared/library/sharedDebug/src/shared/PixCounter.cpp index dcb14966..b0a63e6d 100755 --- a/engine/shared/library/sharedDebug/src/shared/PixCounter.cpp +++ b/engine/shared/library/sharedDebug/src/shared/PixCounter.cpp @@ -83,13 +83,13 @@ void PixCounterNamespace::remove() { #ifdef _WIN32 FreeLibrary(ms_pixDll); - ms_pixDll = NULL; + ms_pixDll = nullptr; #endif - ms_setCounterFloat = NULL; - ms_setCounterInt = NULL; - ms_setCounterInt64 = NULL; - ms_setCounterString = NULL; + ms_setCounterFloat = nullptr; + ms_setCounterInt = nullptr; + ms_setCounterInt64 = nullptr; + ms_setCounterString = nullptr; // Make sure the counter memory gets freed at this point Counters().swap(ms_counters); @@ -379,7 +379,7 @@ PixCounter::String::String() : Counter(), m_enabled(false), m_lastFrameValue(), - m_lastFrameValuePointer(NULL), + m_lastFrameValuePointer(nullptr), m_currentValue() { } diff --git a/engine/shared/library/sharedDebug/src/shared/Profiler.cpp b/engine/shared/library/sharedDebug/src/shared/Profiler.cpp index eb484451..59e92811 100755 --- a/engine/shared/library/sharedDebug/src/shared/Profiler.cpp +++ b/engine/shared/library/sharedDebug/src/shared/Profiler.cpp @@ -238,7 +238,7 @@ void Profiler::install() ms_profilerEntriesCurrent = &ms_profilerEntries1; ms_profilerEntriesLast = &ms_profilerEntries2; - ms_rootVisibleExpandableEntry = new VisibleExpandableEntry(NULL); + ms_rootVisibleExpandableEntry = new VisibleExpandableEntry(nullptr); ms_rootVisibleExpandableEntry->setExpanded(true); ms_selectedVisibleExpandableEntry = ms_rootVisibleExpandableEntry; } @@ -248,13 +248,13 @@ void Profiler::install() void Profiler::remove() { delete ms_rootVisibleExpandableEntry; - ms_rootVisibleExpandableEntry = NULL; - ms_beforeSelectedVisibleExpandableEntry = NULL; - ms_selectedVisibleExpandableEntry = NULL; - ms_afterSelectedVisibleExpandableEntry = NULL; - ms_previousVisibleExpandableEntry = NULL; - ms_profilerEntriesCurrent = NULL; - ms_profilerEntriesLast = NULL; + ms_rootVisibleExpandableEntry = nullptr; + ms_beforeSelectedVisibleExpandableEntry = nullptr; + ms_selectedVisibleExpandableEntry = nullptr; + ms_afterSelectedVisibleExpandableEntry = nullptr; + ms_previousVisibleExpandableEntry = nullptr; + ms_profilerEntriesCurrent = nullptr; + ms_profilerEntriesLast = nullptr; } // ---------------------------------------------------------------------- @@ -374,11 +374,11 @@ bool ProfilerNamespace::formatEntry(int indent, ProfilerTimer::Type totalTime, i void ProfilerNamespace::processEntry(char const *rootName, int indent, ProfilerEntry const & entry, VisibleExpandableEntry * visibleExpandableEntry) { if (rootName == entry.name) - rootName = NULL; + rootName = nullptr; if (!rootName) { - if (!formatEntry(indent, entry.totalTime, entry.totalCalls, visibleExpandableEntry != NULL, visibleExpandableEntry && visibleExpandableEntry->isExpanded(), visibleExpandableEntry == ms_selectedVisibleExpandableEntry, entry.name)) + if (!formatEntry(indent, entry.totalTime, entry.totalCalls, visibleExpandableEntry != nullptr, visibleExpandableEntry && visibleExpandableEntry->isExpanded(), visibleExpandableEntry == ms_selectedVisibleExpandableEntry, entry.name)) return; } @@ -410,7 +410,7 @@ void ProfilerNamespace::processEntry(char const *rootName, int indent, ProfilerE if (child.children.empty()) { - processEntry(rootName, indent, child, NULL); + processEntry(rootName, indent, child, nullptr); } else { @@ -483,9 +483,9 @@ void ProfilerNamespace::generateReport() ms_rootVisibleExpandableEntry->markAllChildrenInvisible(); ms_rootVisibleExpandableEntry->findOrAddExpandableChild(rootEntry.name); - ms_previousVisibleExpandableEntry = NULL; - ms_beforeSelectedVisibleExpandableEntry = NULL; - ms_afterSelectedVisibleExpandableEntry = NULL; + ms_previousVisibleExpandableEntry = nullptr; + ms_beforeSelectedVisibleExpandableEntry = nullptr; + ms_afterSelectedVisibleExpandableEntry = nullptr; processEntry(ms_rootProfilerName, 0, rootEntry, ms_rootVisibleExpandableEntry); if (ms_rootVisibleExpandableEntry->pruneInvisibleChildren()) @@ -494,7 +494,7 @@ void ProfilerNamespace::generateReport() if (ms_setRoot) { if (ms_rootProfilerName) - ms_rootProfilerName = NULL; + ms_rootProfilerName = nullptr; else ms_rootProfilerName = ms_selectedVisibleExpandableEntry->getName(); ms_setRoot = false; @@ -720,7 +720,7 @@ void ProfilerNamespace::enterWithTime(char const *name, ProfilerTimer::Type time // search for another call to this block from the parent int entryIndex = -1; - ProfilerEntry *entry = NULL; + ProfilerEntry *entry = nullptr; if (!ms_profilerEntryStack.empty()) { ProfilerEntry &parent = (*ms_profilerEntriesCurrent)[ms_profilerEntryStack.back()]; diff --git a/engine/shared/library/sharedDebug/src/shared/RemoteDebug.cpp b/engine/shared/library/sharedDebug/src/shared/RemoteDebug.cpp index c9e832b9..e6b40c19 100755 --- a/engine/shared/library/sharedDebug/src/shared/RemoteDebug.cpp +++ b/engine/shared/library/sharedDebug/src/shared/RemoteDebug.cpp @@ -92,10 +92,10 @@ void RemoteDebug::remove(void) return; } - ms_removeFunction = NULL; - ms_openFunction = NULL; - ms_closeFunction = NULL; - ms_sendFunction = NULL; + ms_removeFunction = nullptr; + ms_openFunction = nullptr; + ms_closeFunction = nullptr; + ms_sendFunction = nullptr; //empty out session-level data for (StreamMap::iterator it = ms_streams->begin(); it != ms_streams->end(); ++it) @@ -147,7 +147,7 @@ uint32 RemoteDebug::registerStream(const std::string& streamName) DEBUG_FATAL(!ms_installed, ("remoteDebug not installed")); uint32 streamNum = 0; - Channel *parent = NULL; + Channel *parent = nullptr; std::string base; std::string rest = streamName; //look for subchannels with a double backslash @@ -203,7 +203,7 @@ uint32 RemoteDebug::registerStaticView(const std::string& channelName) { DEBUG_FATAL(!ms_installed, ("remoteDebug not installed")); uint32 staticViewNum = 0; - Channel *parent = NULL; + Channel *parent = nullptr; std::string base; std::string rest = channelName; //look for subchannels with a double backslash @@ -356,7 +356,7 @@ uint32 RemoteDebug::registerVariable(const char* variableName, void *memLoc, VAR std::string variable = variableName; uint32 variableNum = 0; - Channel *parent = NULL; + Channel *parent = nullptr; std::string base; std::string rest = variable; //look for subchannels with a double backslash @@ -375,7 +375,7 @@ uint32 RemoteDebug::registerVariable(const char* variableName, void *memLoc, VAR //only add the variable if we don't have it yet if (variableNumber == -1) { - registerVariable(newBase.c_str(), NULL, BOOL, sendToClients); + registerVariable(newBase.c_str(), nullptr, BOOL, sendToClients); } //look for any other subChannel uint32 oldRestIndex = restIndex; diff --git a/engine/shared/library/sharedDebug/src/shared/RemoteDebug.h b/engine/shared/library/sharedDebug/src/shared/RemoteDebug.h index 8f24d6af..f2b7070c 100755 --- a/engine/shared/library/sharedDebug/src/shared/RemoteDebug.h +++ b/engine/shared/library/sharedDebug/src/shared/RemoteDebug.h @@ -62,7 +62,7 @@ public: { INT, //32 bit signed int FLOAT, //32 bit signed float - CSTRING, //null terminated char[] + CSTRING, //nullptr terminated char[] BOOL //0 or 1 (could use an int, but useful for tools) }; @@ -92,7 +92,7 @@ public: static void install(RemoveFunction, OpenFunction, CloseFunction, SendFunction, IsReadyFunction); ///open a session - static void open(const char *server = NULL, uint16 port = 0); + static void open(const char *server = nullptr, uint16 port = 0); ///packs the data into a packet, and sends it using the client-defined SendFunction static void send(MESSAGE_TYPE type, const char* name = ""); diff --git a/engine/shared/library/sharedDebug/src/shared/RemoteDebug_inner.cpp b/engine/shared/library/sharedDebug/src/shared/RemoteDebug_inner.cpp index da1f9878..e945d875 100755 --- a/engine/shared/library/sharedDebug/src/shared/RemoteDebug_inner.cpp +++ b/engine/shared/library/sharedDebug/src/shared/RemoteDebug_inner.cpp @@ -30,7 +30,7 @@ uint32 RemoteDebugServer::ms_inputTarget; // ====================================================================== RemoteDebug::Channel::Channel(const std::string& name, Channel *parent) -: m_name(NULL), +: m_name(nullptr), m_parent(parent) { m_name = new std::string(name); @@ -41,16 +41,16 @@ RemoteDebug::Channel::Channel(const std::string& name, Channel *parent) RemoteDebug::Channel::~Channel() { - m_parent = NULL; + m_parent = nullptr; if(m_name) { delete m_name; - m_name = NULL; + m_name = nullptr; } if (m_children) { delete m_children; - m_children = NULL; + m_children = nullptr; } } @@ -72,7 +72,7 @@ const std::string& RemoteDebug::Channel::name() RemoteDebug::Variable::Variable(const std::string& name, void *memLoc, VARIABLE_TYPES type) : m_memLoc(memLoc), - m_name(NULL), + m_name(nullptr), m_type(type) { m_name = new std::string(name); @@ -111,7 +111,7 @@ RemoteDebug::Variable::~Variable() if(m_name) { delete m_name; - m_name = NULL; + m_name = nullptr; } } @@ -307,7 +307,7 @@ void RemoteDebugClient::receive(const unsigned char * const message, const uint3 if (channelNumber < ms_nextVariable) return; //do not send value back to server (hence the "false") - registerVariable(ms_buffer, NULL, BOOL, false); + registerVariable(ms_buffer, nullptr, BOOL, false); if (ms_newVariableFunction) ms_newVariableFunction(channelNumber, const_cast(ms_buffer)); break; @@ -477,7 +477,7 @@ void RemoteDebugServer::receive(const unsigned char * const message, const uint3 memcpy(ms_buffer, charMessage + sizeOfMessageType + sizeOfChannelNumber + sizeOfSizeofPayload, sizeOfPayload); } - Variable* v = NULL; + Variable* v = nullptr; switch(type) { case STREAM: @@ -524,27 +524,27 @@ void RemoteDebugServer::receive(const unsigned char * const message, const uint3 break; case STATIC_UP: - if ((*ms_upFunctionMap)[ms_inputTarget] != NULL) + if ((*ms_upFunctionMap)[ms_inputTarget] != nullptr) (*ms_upFunctionMap)[ms_inputTarget](); //lint !e10, !e522 ("expecting a function" and "expected void assignment) break; case STATIC_DOWN: - if ((*ms_downFunctionMap)[ms_inputTarget] != NULL) + if ((*ms_downFunctionMap)[ms_inputTarget] != nullptr) (*ms_downFunctionMap)[ms_inputTarget](); //lint !e10, !e522 ("expecting a function" and "expected void assignment) break; case STATIC_LEFT: - if ((*ms_leftFunctionMap)[ms_inputTarget] != NULL) + if ((*ms_leftFunctionMap)[ms_inputTarget] != nullptr) (*ms_leftFunctionMap)[ms_inputTarget](); //lint !e10, !e522 ("expecting a function" and "expected void assignment) break; case STATIC_RIGHT: - if ((*ms_rightFunctionMap)[ms_inputTarget] != NULL) + if ((*ms_rightFunctionMap)[ms_inputTarget] != nullptr) (*ms_rightFunctionMap)[ms_inputTarget](); //lint !e10, !e522 ("expecting a function" and "expected void assignment) break; case STATIC_ENTER: - if ((*ms_enterFunctionMap)[ms_inputTarget] != NULL) + if ((*ms_enterFunctionMap)[ms_inputTarget] != nullptr) (*ms_enterFunctionMap)[ms_inputTarget](); //lint !e10, !e522 ("expecting a function" and "expected void assignment) break; diff --git a/engine/shared/library/sharedDebug/src/shared/RemoteDebug_inner.h b/engine/shared/library/sharedDebug/src/shared/RemoteDebug_inner.h index d3dd088a..8daccef3 100755 --- a/engine/shared/library/sharedDebug/src/shared/RemoteDebug_inner.h +++ b/engine/shared/library/sharedDebug/src/shared/RemoteDebug_inner.h @@ -29,13 +29,13 @@ class RemoteDebug::Channel NodeList* m_children; ///the fully qualified name of the channel std::string* m_name; - ///its parent (which is NULL for top-level nodes + ///its parent (which is nullptr for top-level nodes Channel *m_parent; }; /** This class stores data about a variable channel, both on the server (where the variable actually * resides), and the client (which just displays it). The client simply creates Variable's with - * NULL'd out memLoc's, since it doesn't have direct access to the memory. + * nullptr'd out memLoc's, since it doesn't have direct access to the memory. */ class RemoteDebug::Variable { diff --git a/engine/shared/library/sharedDebug/src/shared/Report.cpp b/engine/shared/library/sharedDebug/src/shared/Report.cpp index 69de29bd..5f7f8082 100755 --- a/engine/shared/library/sharedDebug/src/shared/Report.cpp +++ b/engine/shared/library/sharedDebug/src/shared/Report.cpp @@ -175,7 +175,7 @@ void Report::puts(const char *buffer) // if (flags & RF_fatal) // title = "Fatal Report"; - // MessageBox(NULL, buffer, title, MB_OK | MB_ICONEXCLAMATION); + // MessageBox(nullptr, buffer, title, MB_OK | MB_ICONEXCLAMATION); //} } @@ -198,7 +198,7 @@ void Report::vprintf(const char *format, va_list va) { char buffer[8 * 1024]; - // make sure the buffer is always NULL terminated + // make sure the buffer is always nullptr terminated buffer[sizeof(buffer)-1] = '\0'; // format the string diff --git a/engine/shared/library/sharedFile/src/shared/AsynchronousLoader.cpp b/engine/shared/library/sharedFile/src/shared/AsynchronousLoader.cpp index be918f39..b810a0b8 100755 --- a/engine/shared/library/sharedFile/src/shared/AsynchronousLoader.cpp +++ b/engine/shared/library/sharedFile/src/shared/AsynchronousLoader.cpp @@ -169,9 +169,9 @@ void AsynchronousLoader::install(const char *fileName) const int numberOfExtensions = iff.getChunkLengthTotal(sizeof(int32)); ms_extensionFunctionsList.reserve(numberOfExtensions); ExtensionFunctions extensionFunctions; - extensionFunctions.extension = NULL; - extensionFunctions.fetchFunction = NULL; - extensionFunctions.releaseFunction = NULL; + extensionFunctions.extension = nullptr; + extensionFunctions.fetchFunction = nullptr; + extensionFunctions.releaseFunction = nullptr; for (int i = 0; i < numberOfExtensions; ++i) { extensionFunctions.extension = ms_fileData + iff.read_int32(); @@ -235,10 +235,10 @@ void AsynchronousLoaderNamespace::remove() { DEBUG_FATAL(!ms_installed, ("not installed")); Request *request = reinterpret_cast(ms_requestMemoryBlockManager->allocate()); - request->fileRecordList = NULL; - request->callback = NULL; - request->data = NULL; - request->cachedFiles = NULL; + request->fileRecordList = nullptr; + request->callback = nullptr; + request->data = nullptr; + request->cachedFiles = nullptr; submitRequest(request); @@ -270,7 +270,7 @@ void AsynchronousLoaderNamespace::remove() ms_cachedFilesPool.clear(); delete ms_requestMemoryBlockManager; - ms_requestMemoryBlockManager = NULL; + ms_requestMemoryBlockManager = nullptr; } // ---------------------------------------------------------------------- @@ -369,7 +369,7 @@ void AsynchronousLoader::add(const char *fileName, Callback callback, void *data request->fileRecordList = i->second; request->callback = callback; request->data = data; - request->cachedFiles = NULL; + request->cachedFiles = nullptr; submitRequest(request); } else @@ -390,8 +390,8 @@ void AsynchronousLoader::remove(Callback callback, void *data) for (Requests::iterator i = ms_pendingRequests.begin(); i != iEnd; ++i) if ((*i)->callback == callback && (*i)->data == data) { - (*i)->callback = NULL; - (*i)->data = NULL; + (*i)->callback = nullptr; + (*i)->data = nullptr; } } @@ -400,8 +400,8 @@ void AsynchronousLoader::remove(Callback callback, void *data) for (Requests::iterator i = ms_completedRequests.begin(); i != iEnd; ++i) if ((*i)->callback == callback && (*i)->data == data) { - (*i)->callback = NULL; - (*i)->data = NULL; + (*i)->callback = nullptr; + (*i)->data = nullptr; } } @@ -466,8 +466,8 @@ void AsynchronousLoaderNamespace::threadRoutine() CachedFile cachedFile; cachedFile.fileRecord = fileRecord; - cachedFile.file = NULL; - cachedFile.resource = NULL; + cachedFile.file = nullptr; + cachedFile.resource = nullptr; // check if the resource is already loaded if (!fileRecord->alreadyCached) @@ -622,7 +622,7 @@ void AsynchronousLoader::processCallbacks() else bytes += cachedFile.file->length(); TreeFile::addCachedFile(cachedFile.fileRecord->fileName, cachedFile.file); - cachedFile.file = NULL; + cachedFile.file = nullptr; } } } @@ -653,13 +653,13 @@ void AsynchronousLoader::processCallbacks() else bytes += cachedFile.file->length(); delete cachedFile.file; - cachedFile.file = NULL; + cachedFile.file = nullptr; } if (cachedFile.resource) { ms_extensionFunctionsList[cachedFile.fileRecord->extensionFunctionsIndex].releaseFunction(cachedFile.resource); - cachedFile.resource = NULL; + cachedFile.resource = nullptr; } } request->cachedFiles->clear(); @@ -667,7 +667,7 @@ void AsynchronousLoader::processCallbacks() ms_mutex.enter(); ms_cachedFilesPool.push_back(request->cachedFiles); - request->cachedFiles = NULL; + request->cachedFiles = nullptr; ms_mutex.leave(); } diff --git a/engine/shared/library/sharedFile/src/shared/FileManifest.cpp b/engine/shared/library/sharedFile/src/shared/FileManifest.cpp index ecf1becf..c5552775 100755 --- a/engine/shared/library/sharedFile/src/shared/FileManifest.cpp +++ b/engine/shared/library/sharedFile/src/shared/FileManifest.cpp @@ -73,8 +73,8 @@ void FileManifest::install() s_accessThreshold = ConfigFile::getKeyInt("SharedFile", "fileManifestAccessThreshold", -1, s_accessThreshold); // if we are developing, and want to update the manifest, read in the tab file as well - const char * manifestFile = ConfigFile::getKeyString("SharedFile", "updateFileManifest", 0, NULL); - if (manifestFile != NULL) + const char * manifestFile = ConfigFile::getKeyString("SharedFile", "updateFileManifest", 0, nullptr); + if (manifestFile != nullptr) { s_updateManifest = true; @@ -183,8 +183,8 @@ void FileManifest::remove() #if PRODUCTION == 0 // dump out the new manifest if requested - const char * manifestFile = ConfigFile::getKeyString("SharedFile", "updateFileManifest", 0, NULL); - if (manifestFile != NULL) + const char * manifestFile = ConfigFile::getKeyString("SharedFile", "updateFileManifest", 0, nullptr); + if (manifestFile != nullptr) { StdioFile outputFile(manifestFile,"w"); DEBUG_FATAL(!outputFile.isOpen(), ("FileManifest::remove(): Could not open %s for writing.", manifestFile)); @@ -201,7 +201,7 @@ void FileManifest::remove() { if (!i->second) { - DEBUG_WARNING(true, ("FileManifest::remove(): Found a null pointer in the fileManifest map!\n")); + DEBUG_WARNING(true, ("FileManifest::remove(): Found a nullptr pointer in the fileManifest map!\n")); continue; } diff --git a/engine/shared/library/sharedFile/src/shared/FileNameUtils.cpp b/engine/shared/library/sharedFile/src/shared/FileNameUtils.cpp index 01ac3c98..58912176 100755 --- a/engine/shared/library/sharedFile/src/shared/FileNameUtils.cpp +++ b/engine/shared/library/sharedFile/src/shared/FileNameUtils.cpp @@ -59,9 +59,9 @@ bool FileNameUtils::isReadable(std::string const &path) { FILE *fp = fopen(path.c_str(), "r"); - result = (fp != NULL); + result = (fp != nullptr); - if (fp != NULL) + if (fp != nullptr) { fclose(fp); } @@ -79,9 +79,9 @@ bool FileNameUtils::isWritable(std::string const &path) { FILE *fp = fopen(path.c_str(), "w"); - result = (fp != NULL); + result = (fp != nullptr); - if (fp != NULL) + if (fp != nullptr) { fclose(fp); } diff --git a/engine/shared/library/sharedFile/src/shared/FileStreamer.cpp b/engine/shared/library/sharedFile/src/shared/FileStreamer.cpp index 6c47b26c..ff5eec8d 100755 --- a/engine/shared/library/sharedFile/src/shared/FileStreamer.cpp +++ b/engine/shared/library/sharedFile/src/shared/FileStreamer.cpp @@ -109,11 +109,11 @@ int FileStreamer::getFileSize(const char *fileName) FileStreamer::File *FileStreamer::open(const char *fileName, bool randomAccess) { DEBUG_FATAL(!ms_installed, ("not installed")); - DEBUG_FATAL(!fileName, ("file name null")); + DEBUG_FATAL(!fileName, ("file name nullptr")); OsFile *osFile = OsFile::open(fileName, randomAccess); if (!osFile) - return NULL; + return nullptr; #if PRODUCTION // Stop checking the fileName if one of these returns true @@ -150,7 +150,7 @@ void FileStreamer::File::install(bool useThread) void FileStreamer::File::remove() { delete ms_memoryBlockManager; - ms_memoryBlockManager = NULL; + ms_memoryBlockManager = nullptr; } // ---------------------------------------------------------------------- @@ -192,7 +192,7 @@ FileStreamer::File::~File() bool FileStreamer::File::isOpen() const { - return m_osFile != NULL; + return m_osFile != nullptr; } // ---------------------------------------------------------------------- @@ -249,7 +249,7 @@ void FileStreamer::File::close() if (isOpen()) { delete m_osFile; - m_osFile = NULL; + m_osFile = nullptr; } } diff --git a/engine/shared/library/sharedFile/src/shared/FileStreamerFile.cpp b/engine/shared/library/sharedFile/src/shared/FileStreamerFile.cpp index d6a798d5..e579ab9e 100755 --- a/engine/shared/library/sharedFile/src/shared/FileStreamerFile.cpp +++ b/engine/shared/library/sharedFile/src/shared/FileStreamerFile.cpp @@ -93,7 +93,7 @@ FileStreamerFile::~FileStreamerFile() bool FileStreamerFile::isOpen() const { - return m_file != NULL; + return m_file != nullptr; } // ---------------------------------------------------------------------- @@ -174,7 +174,7 @@ void FileStreamerFile::close() { if (m_owner) delete m_file; - m_file = NULL; + m_file = nullptr; } // ====================================================================== diff --git a/engine/shared/library/sharedFile/src/shared/FileStreamerThread.cpp b/engine/shared/library/sharedFile/src/shared/FileStreamerThread.cpp index 1d3c0b8c..a0789e5b 100755 --- a/engine/shared/library/sharedFile/src/shared/FileStreamerThread.cpp +++ b/engine/shared/library/sharedFile/src/shared/FileStreamerThread.cpp @@ -294,34 +294,34 @@ void FileStreamerThread::threadRoutine() //get the request to service ms_queueCriticalSection.enter(); - request = NULL; + request = nullptr; //if there is an AudioVideo request, service it first (interrupting any current data request) if (ms_firstAudioVideoRequest) { request = ms_firstAudioVideoRequest; ms_firstAudioVideoRequest = ms_firstAudioVideoRequest->next; - if (ms_firstAudioVideoRequest == NULL) - ms_lastAudioVideoRequest = NULL; - request->next = NULL; + if (ms_firstAudioVideoRequest == nullptr) + ms_lastAudioVideoRequest = nullptr; + request->next = nullptr; } else if (ms_firstDataRequest) { request = ms_firstDataRequest; ms_firstDataRequest = ms_firstDataRequest->next; - if (ms_firstDataRequest == NULL) - ms_lastDataRequest = NULL; - request->next = NULL; + if (ms_firstDataRequest == nullptr) + ms_lastDataRequest = nullptr; + request->next = nullptr; } else if (ms_firstLowRequest) { request = ms_firstLowRequest; ms_firstLowRequest = ms_firstLowRequest->next; - if (ms_firstLowRequest == NULL) - ms_lastLowRequest = NULL; - request->next = NULL; + if (ms_firstLowRequest == nullptr) + ms_lastLowRequest = nullptr; + request->next = nullptr; } else { @@ -369,7 +369,7 @@ void FileStreamerThread::Request::install() void FileStreamerThread::Request::remove() { delete ms_memoryBlockManager; - ms_memoryBlockManager = NULL; + ms_memoryBlockManager = nullptr; } // ---------------------------------------------------------------------- @@ -395,15 +395,15 @@ void FileStreamerThread::Request::operator delete(void *pointer) // ---------------------------------------------------------------------- FileStreamerThread::Request::Request() -: next(NULL), +: next(nullptr), type(Request::Unknown), - osFile(NULL), + osFile(nullptr), buffer(0), bytesToBeRead(0), bytesRead(0), - gate(NULL), + gate(nullptr), priority(AbstractFile::PriorityData), - returnValue(NULL) + returnValue(nullptr) { } @@ -412,10 +412,10 @@ FileStreamerThread::Request::Request() FileStreamerThread::Request::~Request() { #ifdef _DEBUG - next = NULL; - buffer = NULL; - gate = NULL; - returnValue = NULL; + next = nullptr; + buffer = nullptr; + gate = nullptr; + returnValue = nullptr; #endif } diff --git a/engine/shared/library/sharedFile/src/shared/Iff.cpp b/engine/shared/library/sharedFile/src/shared/Iff.cpp index 212ef576..48eaeed1 100755 --- a/engine/shared/library/sharedFile/src/shared/Iff.cpp +++ b/engine/shared/library/sharedFile/src/shared/Iff.cpp @@ -146,11 +146,11 @@ bool Iff::isValid(char const * fileName) int const fileLength = file->length(); byte *data = file->readEntireFileAndClose(); delete file; - file = NULL; + file = nullptr; bool const result = IffNamespace::isValid(data, fileLength); delete [] data; - data = NULL; + data = nullptr; return result; } @@ -167,12 +167,12 @@ bool Iff::isValid(char const * fileName) // Iff::open() Iff::Iff(void) -: fileName(NULL), +: fileName(nullptr), maxStackDepth(DEFAULT_STACK_DEPTH), stackDepth(0), stack(new Stack[DEFAULT_STACK_DEPTH]), length(0), - data(NULL), + data(nullptr), inChunk(false), growable(false), nonlinear(false), @@ -207,7 +207,7 @@ Iff::Iff(void) */ Iff::Iff(int newDataSize, const byte *newData, bool iffOwnsData) : - fileName(NULL), + fileName(nullptr), maxStackDepth(DEFAULT_STACK_DEPTH), stackDepth(0), stack(new Stack[DEFAULT_STACK_DEPTH]), @@ -242,12 +242,12 @@ Iff::Iff(int newDataSize, const byte *newData, bool iffOwnsData) : */ Iff::Iff(const char *newFileName, bool optional) -: fileName(NULL), +: fileName(nullptr), maxStackDepth(DEFAULT_STACK_DEPTH), stackDepth(0), stack(new Stack[DEFAULT_STACK_DEPTH]), length(0), - data(NULL), + data(nullptr), inChunk(false), growable(false), nonlinear(false), @@ -270,7 +270,7 @@ Iff::Iff(const char *newFileName, bool optional) */ Iff::Iff(int initialSize, bool isGrowable, bool clearDataBuffer) -: fileName(NULL), +: fileName(nullptr), maxStackDepth(DEFAULT_STACK_DEPTH), stackDepth(0), stack(new Stack[DEFAULT_STACK_DEPTH]), @@ -384,7 +384,7 @@ void Iff::open(AbstractFile & file, char const * const newFileName) DEBUG_FATAL(data, ("causing memory leak")); data = file.readEntireFileAndClose(); - FATAL(ConfigSharedFile::getValidateIff() && !IffNamespace::isValid(data, length), ("File corruption detected! Iff::isValid failed for %s (size=%d, crc=%08X). Please try a \"Full Scan\" from the LaunchPad.", newFileName ? newFileName : "null", length, Crc::calculate(data, length))); + FATAL(ConfigSharedFile::getValidateIff() && !IffNamespace::isValid(data, length), ("File corruption detected! Iff::isValid failed for %s (size=%d, crc=%08X). Please try a \"Full Scan\" from the LaunchPad.", newFileName ? newFileName : "nullptr", length, Crc::calculate(data, length))); // setup the stack data to know about the data stack[0].start = 0; @@ -406,11 +406,11 @@ void Iff::open(AbstractFile & file, char const * const newFileName) void Iff::close(void) { delete [] fileName; - fileName = NULL; + fileName = nullptr; if (ownsData) delete [] data; - data = NULL; //lint !e672 // possible memory leak in assignment to Iff::data // no, we only delete when we own it + data = nullptr; //lint !e672 // possible memory leak in assignment to Iff::data // no, we only delete when we own it stackDepth = 0; } @@ -886,7 +886,7 @@ void Iff::insertChunkFloatQuaternion(const Quaternion &quaternion) * Insert a string into the current chunk at the current location. * * This routine will call insertChunkData(const void *, int length) - * with the string using its string length (plus one for the null + * with the string using its string length (plus one for the nullptr * terminator). */ @@ -1555,10 +1555,10 @@ void Iff::read_string(char *string, int maxLength) *string = *source; } - // step over the null terminator on the input + // step over the nullptr terminator on the input ++s.used; - // null terminate the output string + // nullptr terminate the output string DEBUG_FATAL(maxLength <= 0, ("destination string too short")); *string = '\0'; } @@ -1594,7 +1594,7 @@ char *Iff::read_string(void) for ( ; sourceLength < maxLength && source[sourceLength]; ++sourceLength) ; - // verify that we found the null terminator + // verify that we found the nullptr terminator DEBUG_FATAL(sourceLength >= maxLength, ("hit end of chunk before string terminator")); // create and copy the string @@ -1634,10 +1634,10 @@ void Iff::read_string(std::string &string) for ( ; sourceLength < maxLength && source[sourceLength]; ++sourceLength) ; - // verify that we found the null terminator + // verify that we found the nullptr terminator DEBUG_FATAL(sourceLength >= maxLength, ("hit end of chunk before string terminator")); - // account for the null terminator + // account for the nullptr terminator ++sourceLength; s.used += sourceLength; diff --git a/engine/shared/library/sharedFile/src/shared/Iff.h b/engine/shared/library/sharedFile/src/shared/Iff.h index 71e07c44..1fe0660a 100755 --- a/engine/shared/library/sharedFile/src/shared/Iff.h +++ b/engine/shared/library/sharedFile/src/shared/Iff.h @@ -250,7 +250,7 @@ public: Unicode::String read_unicodeString(); #if 0 - real *read_float (int count, real *array=NULL); + real *read_float (int count, real *array=nullptr); #endif }; @@ -294,7 +294,7 @@ inline int Iff::getRawDataSize(void) const * to store raw iff data via a mechanism other than Iff::write(). * * @return A read-only pointer to the data buffer containing the raw Iff data - * managed by this Iff object. It may be NULL if no data is currently + * managed by this Iff object. It may be nullptr if no data is currently * managed by the Iff. * @see Iff::getRawDataSize(), Iff::write() */ diff --git a/engine/shared/library/sharedFile/src/shared/IndentedFileWriter.cpp b/engine/shared/library/sharedFile/src/shared/IndentedFileWriter.cpp index 2c5eb7f2..013c7204 100755 --- a/engine/shared/library/sharedFile/src/shared/IndentedFileWriter.cpp +++ b/engine/shared/library/sharedFile/src/shared/IndentedFileWriter.cpp @@ -23,7 +23,7 @@ IndentedFileWriter *IndentedFileWriter::createWriter(char const *filename) { // Kill the new writer since we weren't able to open the file for writing. delete newWriter; - return NULL; + return nullptr; } } @@ -36,7 +36,7 @@ IndentedFileWriter::~IndentedFileWriter() if (m_file) { fclose(m_file); - m_file = NULL; + m_file = nullptr; } } @@ -63,8 +63,8 @@ void IndentedFileWriter::unindent() void IndentedFileWriter::writeLine(char const *line) const { - FATAL(!m_file, ("writeLine(): m_file is NULL, programmer error.")); - FATAL(!line, ("writeLine(): line argument is NULL.")); + FATAL(!m_file, ("writeLine(): m_file is nullptr, programmer error.")); + FATAL(!line, ("writeLine(): line argument is nullptr.")); //-- Write one tab for each indentation level. for (int i = 0; i < m_indentCount; ++i) @@ -92,7 +92,7 @@ void IndentedFileWriter::writeLineFormat(char const *format, ...) const int const formatCount = vsnprintf(buffer, sizeof(buffer), format, varArgList); UNREF(formatCount); - //-- Ensure it's null terminated. + //-- Ensure it's nullptr terminated. buffer[sizeof(buffer) - 1] = '\0'; //-- Do the real print. @@ -108,7 +108,7 @@ void IndentedFileWriter::writeLineFormat(char const *format, ...) const IndentedFileWriter::IndentedFileWriter() : m_indentCount(0), - m_file(NULL) + m_file(nullptr) { } @@ -123,7 +123,7 @@ bool IndentedFileWriter::createFile(char const *filename) } m_file = fopen(filename, "w"); - return (m_file != NULL); + return (m_file != nullptr); } // ====================================================================== diff --git a/engine/shared/library/sharedFile/src/shared/MemoryFile.cpp b/engine/shared/library/sharedFile/src/shared/MemoryFile.cpp index 4c023f8c..d09b3c99 100755 --- a/engine/shared/library/sharedFile/src/shared/MemoryFile.cpp +++ b/engine/shared/library/sharedFile/src/shared/MemoryFile.cpp @@ -70,7 +70,7 @@ MemoryFile::MemoryFile(byte *buffer, int length) MemoryFile::MemoryFile(AbstractFile *file) : AbstractFile(PriorityData), - m_buffer(NULL), + m_buffer(nullptr), m_length(file->length()), m_offset(0) { @@ -88,7 +88,7 @@ MemoryFile::~MemoryFile() bool MemoryFile::isOpen() const { - return m_buffer != NULL; + return m_buffer != nullptr; } // ---------------------------------------------------------------------- @@ -162,7 +162,7 @@ int MemoryFile::write(int, const void *) void MemoryFile::close() { delete [] m_buffer; - m_buffer = NULL; + m_buffer = nullptr; } // ---------------------------------------------------------------------- @@ -170,7 +170,7 @@ void MemoryFile::close() byte *MemoryFile::readEntireFileAndClose() { byte *result = m_buffer; - m_buffer = NULL; + m_buffer = nullptr; return result; } diff --git a/engine/shared/library/sharedFile/src/shared/TreeFile.cpp b/engine/shared/library/sharedFile/src/shared/TreeFile.cpp index 09acf384..6c53bff5 100755 --- a/engine/shared/library/sharedFile/src/shared/TreeFile.cpp +++ b/engine/shared/library/sharedFile/src/shared/TreeFile.cpp @@ -123,7 +123,7 @@ void TreeFile::install(uint32 skuBits) sprintf(buffer, "searchPath%s%d", skuText, priority); char const * result; - for (int index = 0; (result = ConfigFile::getKeyString("SharedFile", buffer, index, NULL)) != NULL; ++index) + for (int index = 0; (result = ConfigFile::getKeyString("SharedFile", buffer, index, nullptr)) != nullptr; ++index) TreeFile::addSearchPath(result, priority); } @@ -133,7 +133,7 @@ void TreeFile::install(uint32 skuBits) sprintf(buffer, "searchTree%s%d", skuText, priority); char const * result; - for (int index = 0; (result = ConfigFile::getKeyString("SharedFile", buffer, index, NULL)) != NULL; ++index) + for (int index = 0; (result = ConfigFile::getKeyString("SharedFile", buffer, index, nullptr)) != nullptr; ++index) TreeFile::addSearchTree(result, priority); } @@ -143,7 +143,7 @@ void TreeFile::install(uint32 skuBits) sprintf(buffer, "searchTOC%s%d", skuText, priority); char const * result; - for (int index = 0; (result = ConfigFile::getKeyString("SharedFile", buffer, index, NULL)) != NULL; ++index) + for (int index = 0; (result = ConfigFile::getKeyString("SharedFile", buffer, index, nullptr)) != nullptr; ++index) TreeFile::addSearchTOC(result, priority); } } @@ -430,7 +430,7 @@ void TreeFile::removeAllSearches(void) * Find the node (if any) the requested file is in. * * @return Pointer to the highest priority node containing the file. If the - * file is not found, NULL is returned. If checking for filename collisions is + * file is not found, nullptr is returned. If checking for filename collisions is * set on, then this function DEBUG_FATALS if multiple files match */ @@ -440,14 +440,14 @@ TreeFile::SearchNode *TreeFile::find(const char *fileName) if (!fileName) { - DEBUG_WARNING(true, ("TreeFile::find() Cannot find a null filename")); - return NULL; + DEBUG_WARNING(true, ("TreeFile::find() Cannot find a nullptr filename")); + return nullptr; } if (fileName[0] == '\0') { DEBUG_WARNING(true, ("TreeFile::find() Cannot find an empty filename")); - return NULL; + return nullptr; } // search the list of nodes looking to see if the specified file exists @@ -457,7 +457,7 @@ TreeFile::SearchNode *TreeFile::find(const char *fileName) if ((*i)->exists(fileName, deleted)) return *i; - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -479,7 +479,7 @@ bool TreeFile::exists(const char *fileName) FileManifest::addNewManifestEntry(fixedFileName, 0); #endif - return (find(fixedFileName) != NULL); + return (find(fixedFileName) != nullptr); } // ---------------------------------------------------------------------- @@ -621,7 +621,7 @@ void TreeFile::fixUpFileName(const char *fileName, char *outName) * Find the node (if any) the requested file is in. * * @return Pointer to the highest priority node containing the file. If the - * file is not found, NULL is returned. + * file is not found, nullptr is returned. */ bool TreeFile::getPathName(const char *fileName, char *pathName, int pathNameLength) @@ -655,12 +655,12 @@ bool TreeFile::getPathName(const char *fileName, char *pathName, int pathNameLen * * @param fileName File name to open * @param allowFail True to return false on failure, otherwise Fatal - * @return pointer to a newly allocated AbstractFile-derived class (caller must delete), NULL if failure. + * @return pointer to a newly allocated AbstractFile-derived class (caller must delete), nullptr if failure. */ AbstractFile* TreeFile::open(const char *fileName, AbstractFile::PriorityType priority, bool allowFail) { - AbstractFile *file = NULL; + AbstractFile *file = nullptr; char fixedFileName[Os::MAX_PATH_LENGTH]; fixUpFileName(fixedFileName, fileName, true); @@ -678,7 +678,7 @@ AbstractFile* TreeFile::open(const char *fileName, AbstractFile::PriorityType pr if (cachedIterator != cachedFilesMap.end()) { file = cachedIterator->second; - cachedIterator->second = NULL; + cachedIterator->second = nullptr; } ms_criticalSection.leave(); @@ -747,7 +747,7 @@ AbstractFile* TreeFile::open(const char *fileName, AbstractFile::PriorityType pr FileManifest::addNewManifestEntry(fixedFileName, 0); #endif - return NULL; + return nullptr; } const int length = file->length(); @@ -787,7 +787,7 @@ const char *TreeFile::getSearchPath(int index) for (SearchNodes::iterator i = ms_searchNodes.begin(); i != iEnd; ++i) { const SearchPath *searchPath = dynamic_cast(*i); - if (searchPath != NULL) + if (searchPath != nullptr) { if (count == index) return searchPath->getPathName(); @@ -795,14 +795,14 @@ const char *TreeFile::getSearchPath(int index) } } - return NULL; + return nullptr; } //----------------------------------------------------------------- /** * This function will return the shortest trailing path of its input that * can be loaded by the TreeFile. If no files can be loaded, this routine - * will return NULL. + * will return nullptr. */ const char *TreeFile::getShortestExistingPath(const char *path) @@ -810,9 +810,9 @@ const char *TreeFile::getShortestExistingPath(const char *path) NOT_NULL(path); if (!*path) - return NULL; + return nullptr; - const char *result = NULL; + const char *result = nullptr; do { // check if this one exists @@ -866,7 +866,7 @@ bool TreeFile::stripTreeFileSearchPathFromFile(const char *inputPath, char *outp { // make sure it's a relative search path const SearchPath *searchPath = dynamic_cast(*i); - if (searchPath != NULL) + if (searchPath != nullptr) { // check to see if the the search path is a prefix for the requested path const char *path = searchPath->getPathName(); diff --git a/engine/shared/library/sharedFile/src/shared/TreeFile_SearchNode.cpp b/engine/shared/library/sharedFile/src/shared/TreeFile_SearchNode.cpp index 9c63e47d..11c7d2e3 100755 --- a/engine/shared/library/sharedFile/src/shared/TreeFile_SearchNode.cpp +++ b/engine/shared/library/sharedFile/src/shared/TreeFile_SearchNode.cpp @@ -53,7 +53,7 @@ TreeFile::SearchNode::~SearchNode(void) TreeFile::SearchPath::SearchPath(int priority, const char *path) : SearchNode(priority), - m_pathName(NULL), + m_pathName(nullptr), m_pathNameLength(0) { NOT_NULL(path); @@ -145,7 +145,7 @@ AbstractFile *TreeFile::SearchPath::open(const char *fileName, AbstractFile::Pri makeAbsolutePath(fileName, buffer); FileStreamer::File *file = FileStreamer::open(buffer); if (!file) - return NULL; + return nullptr; return new FileStreamerFile(priority, *file); } @@ -209,7 +209,7 @@ AbstractFile *TreeFile::SearchAbsolute::open(const char *fileName, AbstractFile: FileStreamer::File *file = FileStreamer::open(fileName); if (!file) - return NULL; + return nullptr; return new FileStreamerFile(priority, *file); } @@ -248,12 +248,12 @@ bool TreeFile::SearchTree::validate(const char *fileName) TreeFile::SearchTree::SearchTree(int priority, const char *fileName) : SearchNode(priority), - m_treeFileName(NULL), - m_treeFile(NULL), + m_treeFileName(nullptr), + m_treeFile(nullptr), m_version(0), m_numberOfFiles(0), - m_fileNames(NULL), - m_tableOfContents(NULL) + m_fileNames(nullptr), + m_tableOfContents(nullptr) { NOT_NULL(fileName); @@ -435,7 +435,7 @@ void TreeFile::SearchTree::debugPrint(void) bool TreeFile::SearchTree::exists(const char *fileName, bool &deleted) const { NOT_NULL(fileName); - return localExists(fileName, NULL, deleted); + return localExists(fileName, nullptr, deleted); } // ---------------------------------------------------------------------- @@ -497,7 +497,7 @@ AbstractFile *TreeFile::SearchTree::open(const char *fileName, AbstractFile::Pri return new ZlibFile(entry.length, compressedBuffer, entry.compressedLength, true); } - return NULL; + return nullptr; } // ====================================================================== @@ -535,14 +535,14 @@ bool TreeFile::SearchTOC::validate(const char *fileName) TreeFile::SearchTOC::SearchTOC(int priority, const char *fileName) : SearchNode(priority), - m_TOCFileName(NULL), - m_TOCFile(NULL), - m_treeFiles(NULL), + m_TOCFileName(nullptr), + m_TOCFile(nullptr), + m_treeFiles(nullptr), m_numberOfFiles(0), - m_treeFileNames(NULL), - m_treeFileNamePointers(NULL), - m_tableOfContents(NULL), - m_fileNames(NULL) + m_treeFileNames(nullptr), + m_treeFileNamePointers(nullptr), + m_tableOfContents(nullptr), + m_fileNames(nullptr) { NOT_NULL(fileName); @@ -587,7 +587,7 @@ TreeFile::SearchTOC::SearchTOC(int priority, const char *fileName) // add on all paths in config file const char * result; - for (int index = 0; (result = ConfigFile::getKeyString("SharedFile", "TOCTreePath", index, NULL)) != NULL; ++index) + for (int index = 0; (result = ConfigFile::getKeyString("SharedFile", "TOCTreePath", index, nullptr)) != nullptr; ++index) treePaths.push_back(result); // read in the tree file names and open the files @@ -598,7 +598,7 @@ TreeFile::SearchTOC::SearchTOC(int priority, const char *fileName) for (int treeFileNameIndex = 0, treeFileNameReadPosition = 0; treeFileNameIndex < static_cast(header.numberOfTreeFiles); treeFileNameIndex++) { m_treeFileNamePointers[treeFileNameIndex] = (m_treeFileNames + treeFileNameReadPosition); - m_treeFiles[treeFileNameIndex] = NULL; + m_treeFiles[treeFileNameIndex] = nullptr; // try to open the tree file in each of the relative paths for (std::vector::const_iterator pathIter = treePaths.begin(); pathIter != treePaths.end(); ++pathIter) @@ -656,7 +656,7 @@ TreeFile::SearchTOC::SearchTOC(int priority, const char *fileName) { currentFileNameLength = m_tableOfContents[i].fileNameOffset; m_tableOfContents[i].fileNameOffset = currentFileNameOffset; - // + 1 for the null termination + // + 1 for the nullptr termination currentFileNameOffset += (currentFileNameLength + 1); } } @@ -792,7 +792,7 @@ bool TreeFile::SearchTOC::exists(const char *fileName, bool &deleted) const { NOT_NULL(fileName); deleted = false; - return localExists(fileName, NULL); + return localExists(fileName, nullptr); } // ---------------------------------------------------------------------- @@ -862,7 +862,7 @@ AbstractFile *TreeFile::SearchTOC::open(const char *fileName, AbstractFile::Prio return new ZlibFile(entry.length, compressedBuffer, entry.compressedLength, true); } - return NULL; + return nullptr; } // ====================================================================== diff --git a/engine/shared/library/sharedFile/src/shared/ZlibFile.cpp b/engine/shared/library/sharedFile/src/shared/ZlibFile.cpp index 7c3778c7..9a498a87 100755 --- a/engine/shared/library/sharedFile/src/shared/ZlibFile.cpp +++ b/engine/shared/library/sharedFile/src/shared/ZlibFile.cpp @@ -66,7 +66,7 @@ ZlibFile::ZlibFile(int uncompressedLength, byte *compressedBuffer, int compresse m_compressedBuffer(compressedBuffer), m_compressedBufferLength(compressedBufferLength), m_ownsCompressedBuffer(ownsCompressedBuffer), - m_decompressedMemoryFile(NULL) + m_decompressedMemoryFile(nullptr) { } @@ -137,10 +137,10 @@ void ZlibFile::close() { if (m_ownsCompressedBuffer) delete [] m_compressedBuffer; - m_compressedBuffer = NULL; + m_compressedBuffer = nullptr; delete m_decompressedMemoryFile; - m_decompressedMemoryFile = NULL; + m_decompressedMemoryFile = nullptr; } // ---------------------------------------------------------------------- @@ -197,7 +197,7 @@ void ZlibFile::getZlibCompressedDataAndClose(byte *& compressedBuffer, int & com if (m_ownsCompressedBuffer) { compressedBuffer = m_compressedBuffer; - m_compressedBuffer = NULL; + m_compressedBuffer = nullptr; compressedBufferLength = m_compressedBufferLength; } else diff --git a/engine/shared/library/sharedFoundation/src/linux/Os.cpp b/engine/shared/library/sharedFoundation/src/linux/Os.cpp index 2ddccf74..b1e26987 100755 --- a/engine/shared/library/sharedFoundation/src/linux/Os.cpp +++ b/engine/shared/library/sharedFoundation/src/linux/Os.cpp @@ -97,7 +97,7 @@ void Os::installCommon(void) mainThreadId = pthread_self(); // get the name of the executable -//Can't find UNIX call for this: DWORD result = GetModuleFileName(NULL, programName, sizeof(programName)); +//Can't find UNIX call for this: DWORD result = GetModuleFileName(nullptr, programName, sizeof(programName)); strcpy(programName, "TempName"); DWORD result = 1; @@ -119,7 +119,7 @@ void Os::installCommon(void) char buffer[512]; while (!feof(f)) { - if (fgets(buffer, 512, f) != NULL) { + if (fgets(buffer, 512, f) != nullptr) { if (strncmp(buffer, "processor\t: ", 12)==0) { processorCount = atoi(buffer+12)+1; @@ -165,13 +165,13 @@ void Os::abort(void) if (!isMainThread()) { threadDied = true; - pthread_exit(NULL); + pthread_exit(nullptr); } if (!shouldReturnFromAbort) { // let the C runtime deal with the abnormal termination - int * dummy = NULL; + int * dummy = nullptr; int forceCrash = *dummy; UNREF(forceCrash); for (;;) @@ -256,14 +256,14 @@ bool Os::writeFile(const char *fileName, const void *data, int length) // Le DWORD written; // open the file for writing - handle = CreateFile(fileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + handle = CreateFile(fileName, GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); // check if it was opened if (handle == INVALID_HANDLE_VALUE) return false; // attempt to write the data - result = WriteFile(handle, data, static_cast(length), &written, NULL); + result = WriteFile(handle, data, static_cast(length), &written, nullptr); // make sure the data was written okay if (!result || written != static_cast(length)) diff --git a/engine/shared/library/sharedFoundation/src/linux/PerThreadData.cpp b/engine/shared/library/sharedFoundation/src/linux/PerThreadData.cpp index 3d7f8584..18bee813 100755 --- a/engine/shared/library/sharedFoundation/src/linux/PerThreadData.cpp +++ b/engine/shared/library/sharedFoundation/src/linux/PerThreadData.cpp @@ -81,7 +81,7 @@ PerThreadData::Data *PerThreadData::getData(bool allowReturnNull) if (!slotCreated) { DEBUG_FATAL(true && !allowReturnNull, ("not installed")); - return NULL; + return nullptr; } Data * const data = reinterpret_cast(pthread_getspecific(slot)); @@ -97,7 +97,7 @@ PerThreadData::Data *PerThreadData::getData(bool allowReturnNull) * * If the client is calling this function on a thread that existed before the engine was * installed, the client should set isNewThread to false. Setting isNewThread to false - * prevents the function from validating that the thread's TLS is NULL. For threads existing + * prevents the function from validating that the thread's TLS is nullptr. For threads existing * before the engine is installed, the TLS data for the thread is undefined. * * @param isNewThread [IN] true if the thread was created after the engine was installed, false otherwise @@ -147,10 +147,10 @@ void PerThreadData::threadRemove(void) //close the event used for file streaming reads delete data->readGate; - data->readGate = NULL; + data->readGate = nullptr; // wipe the data in the thread slot - const BOOL result2 = pthread_setspecific(slot, NULL); + const BOOL result2 = pthread_setspecific(slot, nullptr); UNREF(result2); DEBUG_FATAL(result2, ("TlsSetValue failed")); //NB: unlike Windows, returns 0 on success. diff --git a/engine/shared/library/sharedFoundation/src/linux/PerThreadData.h b/engine/shared/library/sharedFoundation/src/linux/PerThreadData.h index df4fd5f6..86adef53 100755 --- a/engine/shared/library/sharedFoundation/src/linux/PerThreadData.h +++ b/engine/shared/library/sharedFoundation/src/linux/PerThreadData.h @@ -93,7 +93,7 @@ public: * threads existing at the time of slot creation. Thus, if you build a * plugin that only initializes the engine the first time it is * used, and other threads already exist in the app, those threads - * will contain bogus non-null data in the TLS slot. If the plugin really + * will contain bogus non-nullptr data in the TLS slot. If the plugin really * wants to do lazy initialization of the engine, it will need * to handle calling PerThreadData::threadInstall() for all existing threads * (except the thread that initialized the engine, which already @@ -102,7 +102,7 @@ public: inline bool PerThreadData::isThreadInstalled(void) { - return (getData(true) != NULL); + return (getData(true) != nullptr); } // ---------------------------------------------------------------------- @@ -168,7 +168,7 @@ inline void PerThreadData::setExitChainFataling(bool newValue) * Get the first entry for the exit chain. * * This routine is not intended for general use; it should only be used by the ExitChain class. - * This routine may return NULL. + * This routine may return nullptr. * * @return Pointer to the first entry on the exit chain * @see ExitChain::isFataling() @@ -184,7 +184,7 @@ inline ExitChain::Entry *PerThreadData::getExitChainFirstEntry(void) * Set the exit chain fataling flag value. * * This routine is not intended for general use; it should only be used by the ExitChain class. - * The parameter to this routine may be NULL. + * The parameter to this routine may be nullptr. * * @param newValue New value for the exit chain first entry */ diff --git a/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.cpp b/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.cpp index 21668a79..822a4ee5 100755 --- a/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.cpp +++ b/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.cpp @@ -33,7 +33,7 @@ char* _itoa(int value, char* stringOut, int radix) bool QueryPerformanceCounter(__int64* time) { struct timeval tv; - gettimeofday(&tv, NULL); + gettimeofday(&tv, nullptr); *time = static_cast(tv.tv_sec); *time = (*time * 1000000) + static_cast(tv.tv_usec); @@ -107,7 +107,7 @@ FILE* CreateFile(const char* fileName, DWORD access, DWORD shareMode, void* unsu FILE* retval = 0; DEBUG_FATAL(flagsAndAttributes != FILE_ATTRIBUTE_NORMAL, ("Unsupported File mode call to CreateFile()")); - DEBUG_FATAL(unsupB != NULL, ("Unsupported File mode call to CreateFile()")); + DEBUG_FATAL(unsupB != nullptr, ("Unsupported File mode call to CreateFile()")); //DEBUG_FATAL(shareMode != 0, ("Unsupported File mode call to CreateFile()")); DEBUG_FATAL(unsupA != 0, ("Unsupported File mode call to CreateFile()")); @@ -118,7 +118,7 @@ FILE* CreateFile(const char* fileName, DWORD access, DWORD shareMode, void* unsu if (retval) { fclose(retval); - retval = NULL; + retval = nullptr; } else { diff --git a/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.h b/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.h index 5e92921c..0cab423f 100755 --- a/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.h +++ b/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.h @@ -46,7 +46,7 @@ void OutputDebugString(const char* stringOut); typedef FILE* HANDLE; -#define INVALID_HANDLE_VALUE NULL //Have to use a #define because this may be a FILE* +#define INVALID_HANDLE_VALUE nullptr //Have to use a #define because this may be a FILE* const int GENERIC_READ = 1 << 0; @@ -66,8 +66,8 @@ const int FILE_END = SEEK_END; const int FILE_SHARE_READ = 1; -BOOL WriteFile(FILE* hFile, const void* lpBuffer, DWORD numBytesToWrite, DWORD* numBytesWritten, void* unsup=NULL); -BOOL ReadFile(FILE* hFile, void* lpBuffer, DWORD numBytesToWrite, DWORD* numBytesRead, void* unsup=NULL); +BOOL WriteFile(FILE* hFile, const void* lpBuffer, DWORD numBytesToWrite, DWORD* numBytesWritten, void* unsup=nullptr); +BOOL ReadFile(FILE* hFile, void* lpBuffer, DWORD numBytesToWrite, DWORD* numBytesRead, void* unsup=nullptr); DWORD SetFilePointer(FILE* hFile, long lDistanceToMove, long* lpDistanceToMoveHigh, DWORD dwMoveMethod); FILE* CreateFile(const char* fileName, DWORD access, DWORD shareMode, void* unsupA, DWORD creationDisposition, DWORD flagsAndAttributes, FILE* unsup2); BOOL CloseHandle(FILE* hFile); diff --git a/engine/shared/library/sharedFoundation/src/linux/SetupSharedFoundation.cpp b/engine/shared/library/sharedFoundation/src/linux/SetupSharedFoundation.cpp index 07dec783..e54017fc 100755 --- a/engine/shared/library/sharedFoundation/src/linux/SetupSharedFoundation.cpp +++ b/engine/shared/library/sharedFoundation/src/linux/SetupSharedFoundation.cpp @@ -150,11 +150,11 @@ SetupSharedFoundation::Data::Data(Defaults defaults) case D_game: runInBackground = true; - lpCmdLine = NULL; + lpCmdLine = nullptr; argc = 0; - argv = NULL; + argv = nullptr; - configFile = NULL; + configFile = nullptr; frameRateLimit = CONST_REAL(0); break; @@ -162,11 +162,11 @@ SetupSharedFoundation::Data::Data(Defaults defaults) case D_console: runInBackground = true; - lpCmdLine = NULL; + lpCmdLine = nullptr; argc = 0; - argv = NULL; + argv = nullptr; - configFile = NULL; + configFile = nullptr; frameRateLimit = CONST_REAL(0); break; diff --git a/engine/shared/library/sharedFoundation/src/linux/vsnprintf.cpp b/engine/shared/library/sharedFoundation/src/linux/vsnprintf.cpp index 6b4c5647..069dcb48 100755 --- a/engine/shared/library/sharedFoundation/src/linux/vsnprintf.cpp +++ b/engine/shared/library/sharedFoundation/src/linux/vsnprintf.cpp @@ -21,7 +21,7 @@ // // Remarks: // -// If the buffer would overflow, the null terminating character is not written and -1 +// If the buffer would overflow, the nullptr terminating character is not written and -1 // will be returned. #ifdef _MSC_VER diff --git a/engine/shared/library/sharedFoundation/src/shared/BitArray.cpp b/engine/shared/library/sharedFoundation/src/shared/BitArray.cpp index f094d140..502b31a7 100755 --- a/engine/shared/library/sharedFoundation/src/shared/BitArray.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/BitArray.cpp @@ -35,7 +35,7 @@ m_numInUseBits(0) { if (numBits > (m_numAllocatedBytes << 3)) { - m_arrayData = NULL; + m_arrayData = nullptr; m_numAllocatedBytes = 0; reserve(numBits); m_numInUseBytes = 0; @@ -294,7 +294,7 @@ void BitArray::reserve(int const numBits) { signed char * tmp = new signed char[static_cast(m_numInUseBytes)]; memset(&(tmp[oldNumInUseBytes]), 0, static_cast(m_numInUseBytes - oldNumInUseBytes)); - if ((oldNumInUseBytes > 0) && (m_arrayData != NULL)) + if ((oldNumInUseBytes > 0) && (m_arrayData != nullptr)) memcpy(tmp, m_arrayData, static_cast(oldNumInUseBytes)); //lint !e671 !e670 logically, you can't enter this code block unless oldNumInUseBytes is smaller. m_numAllocatedBytes = m_numInUseBytes; diff --git a/engine/shared/library/sharedFoundation/src/shared/BitArray.h b/engine/shared/library/sharedFoundation/src/shared/BitArray.h index 70b04b41..082fa6b4 100755 --- a/engine/shared/library/sharedFoundation/src/shared/BitArray.h +++ b/engine/shared/library/sharedFoundation/src/shared/BitArray.h @@ -58,7 +58,7 @@ public: // for DB persistence purpose, returns the BitArray as a // std::string where each 4 bits are printed as a hex nibble; - // and the converse that takes the null-terminated string + // and the converse that takes the nullptr-terminated string // and converts it back into the BitArray void getAsDbTextString(std::string &result, int maxNibbleCount = 32767) const; void setFromDbTextString(const char * text); diff --git a/engine/shared/library/sharedFoundation/src/shared/CalendarTime.cpp b/engine/shared/library/sharedFoundation/src/shared/CalendarTime.cpp index 64595534..c73395af 100755 --- a/engine/shared/library/sharedFoundation/src/shared/CalendarTime.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/CalendarTime.cpp @@ -17,11 +17,11 @@ std::string CalendarTime::convertEpochToTimeStringGMT(time_t epoch) std::string result; struct tm * timeinfo = ::gmtime(&epoch); - if (timeinfo == NULL) + if (timeinfo == nullptr) return result; char * asciiTime = ::asctime(timeinfo); - if (asciiTime == NULL) + if (asciiTime == nullptr) return result; static char resultBuffer[512]; @@ -48,7 +48,7 @@ std::string CalendarTime::convertEpochToTimeStringGMT_YYYYMMDDHHMMSS(time_t epoc std::string result; struct tm * timeinfo = ::gmtime(&epoch); - if (timeinfo == NULL) + if (timeinfo == nullptr) return result; static char resultBuffer[512]; @@ -64,11 +64,11 @@ std::string CalendarTime::convertEpochToTimeStringLocal(time_t epoch) std::string result; struct tm * timeinfo = ::localtime(&epoch); - if (timeinfo == NULL) + if (timeinfo == nullptr) return result; char * asciiTime = ::asctime(timeinfo); - if (asciiTime == NULL) + if (asciiTime == nullptr) return result; static char resultBuffer[512]; @@ -105,7 +105,7 @@ std::string CalendarTime::convertEpochToTimeStringLocal_YYYYMMDDHHMMSS(time_t ep std::string result; struct tm * timeinfo = ::localtime(&epoch); - if (timeinfo == NULL) + if (timeinfo == nullptr) return result; static char resultBuffer[512]; @@ -218,7 +218,7 @@ time_t CalendarTime::getNextGMTTimeOcurrence(time_t const startTime, int const d // the year, month, day, day of week, hour, minute, second // in GMT time struct tm * timeinfo = ::gmtime(&startTime); - if (timeinfo == NULL) + if (timeinfo == nullptr) return -1; // get number of days until the specified day of week to search for @@ -333,7 +333,7 @@ time_t CalendarTime::getNextGMTTimeOcurrence(time_t const startTime, int const m // the year, month, day, day of week, hour, minute, second // in GMT time struct tm * timeinfo = ::gmtime(&startTime); - if (timeinfo == NULL) + if (timeinfo == nullptr) return -1; // calculate the Epoch GMT time for the specified start time @@ -358,7 +358,7 @@ time_t CalendarTime::getNextGMTTimeOcurrence(time_t const startTime, int const m startTimeAtSpecifiedHourMinuteSecond += (60 * 60 * 24); timeinfo = ::gmtime(&startTimeAtSpecifiedHourMinuteSecond); - if (timeinfo == NULL) + if (timeinfo == nullptr) return -1; if (++sentinel > maxIterations) diff --git a/engine/shared/library/sharedFoundation/src/shared/CommandLine.cpp b/engine/shared/library/sharedFoundation/src/shared/CommandLine.cpp index 1198c252..5209d788 100755 --- a/engine/shared/library/sharedFoundation/src/shared/CommandLine.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/CommandLine.cpp @@ -63,7 +63,7 @@ bool CommandLine::Option::isOptionNext( int optionSpecCount ) { - DEBUG_FATAL(!optionSpec, ("null optionSpec arg")); + DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg")); if (!optionSpecCount) return false; else @@ -77,8 +77,8 @@ CommandLine::Option *CommandLine::Option::createOption( int *optionCount ) { - DEBUG_FATAL(!optionSpec, ("null optionSpec arg")); - DEBUG_FATAL(!optionCount, ("null optionCount arg")); + DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg")); + DEBUG_FATAL(!optionCount, ("nullptr optionCount arg")); DEBUG_FATAL(!isOptionNext(*optionSpec, *optionCount), ("attempted to create option with non-option data")); const char newShortName = (*optionSpec)->char1; @@ -129,7 +129,7 @@ CommandLine::MatchCode CommandLine::Option::match(void) // matching this short or long name. If the arg specs don't match, we've // got an argument matching error. - DEBUG_FATAL(!optionTable, ("internal error: null option table")); + DEBUG_FATAL(!optionTable, ("internal error: nullptr option table")); OptionTable::Record *record = 0; @@ -145,7 +145,7 @@ CommandLine::MatchCode CommandLine::Option::match(void) DEBUG_FATAL(!record, ("failed to find option info record for option --%s", longName)); } else - DEBUG_FATAL(true, ("corrupted option? both short and long name are null")); + DEBUG_FATAL(true, ("corrupted option? both short and long name are nullptr")); // attempt to match against this option against commandline-specified options @@ -200,7 +200,7 @@ bool CommandLine::Collection::isCollectionNext( int optionSpecCount ) { - DEBUG_FATAL(!optionSpec, ("null optionSpec arg")); + DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg")); if (!optionSpecCount) return false; else @@ -214,8 +214,8 @@ CommandLine::Collection *CommandLine::Collection::createCollection( int *optionSpecCount ) { - DEBUG_FATAL(!optionSpec, ("null optionSpec arg")); - DEBUG_FATAL(!optionSpecCount, ("null optionSpecCount arg")); + DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg")); + DEBUG_FATAL(!optionSpecCount, ("nullptr optionSpecCount arg")); DEBUG_FATAL(!isCollectionNext(*optionSpec, *optionSpecCount), ("tried to create collection from non-collection optionSpec")); if ((*optionSpec)->optionType == OST_BeginList) @@ -289,7 +289,7 @@ bool CommandLine::List::Node::isNode( int optionCount ) { - DEBUG_FATAL(!optionSpec, ("null optionSpec arg")); + DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg")); if (!optionCount) return false; else @@ -303,8 +303,8 @@ CommandLine::List::Node *CommandLine::List::Node::createNode( int *optionCount ) { - DEBUG_FATAL(!optionSpec, ("null optionSpec arg")); - DEBUG_FATAL(!optionCount, ("null optionCount arg")); + DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg")); + DEBUG_FATAL(!optionCount, ("nullptr optionCount arg")); DEBUG_FATAL(!isNode(*optionSpec, *optionCount), ("attempted to create list node with non-list-node data")); Option *newOption = 0; @@ -350,7 +350,7 @@ CommandLine::List::List( listType(newListType), minimumNodeCount(0) { - DEBUG_FATAL(!newFirstNode, ("null newFirstNode arg")); + DEBUG_FATAL(!newFirstNode, ("nullptr newFirstNode arg")); DEBUG_FATAL(newListType != OPLT_Normal, ("constructor only good for OPLT_Normal lists, caller passed %d", newListType)); } @@ -366,7 +366,7 @@ CommandLine::List::List( listType(newListType), minimumNodeCount(newMinimumNodeCount) { - DEBUG_FATAL(!newFirstNode, ("null newFirstNode arg")); + DEBUG_FATAL(!newFirstNode, ("nullptr newFirstNode arg")); DEBUG_FATAL(newListType != OPLT_MinimumMatch, ("constructor only good for OPLT_MinimumMatch lists, caller passed %d", newListType)); } @@ -391,7 +391,7 @@ bool CommandLine::List::isListNext( int optionCount ) { - DEBUG_FATAL(!optionSpec, ("null optionSpec arg")); + DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg")); if (!optionCount) return false; else @@ -405,8 +405,8 @@ CommandLine::List *CommandLine::List::createList( int *optionCount ) { - DEBUG_FATAL(!optionSpec, ("null optionSpec arg")); - DEBUG_FATAL(!optionCount, ("null optionCount arg")); + DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg")); + DEBUG_FATAL(!optionCount, ("nullptr optionCount arg")); DEBUG_FATAL(!isListNext(*optionSpec, *optionCount), ("tried to create list from non-list optionSpec")); Node *newFirstNode = 0; @@ -582,7 +582,7 @@ bool CommandLine::Switch::Node::isNode( const OptionSpec *optionSpec, int optionCount) { - DEBUG_FATAL(!optionSpec, ("null optionSpec arg")); + DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg")); if (!optionCount) return false; else @@ -596,8 +596,8 @@ CommandLine::Switch::Node *CommandLine::Switch::Node::createNode( int *optionCount ) { - DEBUG_FATAL(!optionSpec, ("null optionSpec arg")); - DEBUG_FATAL(!optionCount, ("null optionCount arg")); + DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg")); + DEBUG_FATAL(!optionCount, ("nullptr optionCount arg")); DEBUG_FATAL(!isNode(*optionSpec, *optionCount), ("attempted to create list node with non-list-node data")); Option *newOption = 0; @@ -664,7 +664,7 @@ bool CommandLine::Switch::isSwitchNext( int optionCount ) { - DEBUG_FATAL(!optionSpec, ("null optionSpec arg")); + DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg")); if (!optionCount) return false; else @@ -678,8 +678,8 @@ CommandLine::Switch *CommandLine::Switch::createSwitch( int *optionCount ) { - DEBUG_FATAL(!optionSpec, ("null optionSpec arg")); - DEBUG_FATAL(!optionCount, ("null optionCount arg")); + DEBUG_FATAL(!optionSpec, ("nullptr optionSpec arg")); + DEBUG_FATAL(!optionCount, ("nullptr optionCount arg")); DEBUG_FATAL(!isSwitchNext(*optionSpec, *optionCount), ("tried to create switch from non-switch option spec")); const bool newOneNodeIsRequired = ((*optionSpec)->int1 != 0); @@ -886,7 +886,7 @@ CommandLine::OptionTable::Record *CommandLine::OptionTable::findOptionRecord( char shortName ) const { - DEBUG_FATAL(!shortName, ("null shortName arg")); + DEBUG_FATAL(!shortName, ("nullptr shortName arg")); // walk the list for (Record *record = firstRecord; record; record = record->getNext()) @@ -960,7 +960,7 @@ CommandLine::Lexer::Lexer( ) : nextCharacter(newBuffer) { - DEBUG_FATAL(!newBuffer, ("null newBuffer arg")); + DEBUG_FATAL(!newBuffer, ("nullptr newBuffer arg")); } // ---------------------------------------------------------------------- @@ -994,10 +994,10 @@ CommandLine::Lexer::~Lexer(void) bool CommandLine::Lexer::gobbleString(bool isRequired, char *stringBuffer, int stringSize) { - DEBUG_FATAL(!stringBuffer, ("null stringStart arg")); + DEBUG_FATAL(!stringBuffer, ("nullptr stringStart arg")); DEBUG_FATAL(!stringSize, ("stringSize is zero")); - DEBUG_FATAL(!nextCharacter, ("null nextChar")); + DEBUG_FATAL(!nextCharacter, ("nullptr nextChar")); int stringLength = 0; @@ -1069,7 +1069,7 @@ bool CommandLine::Lexer::gobbleString(bool isRequired, char *stringBuffer, int s if (isRequired && (stringLength == 0)) return false; - // null-terminate the string + // nullptr-terminate the string *stringBuffer = 0; return true; } @@ -1078,8 +1078,8 @@ bool CommandLine::Lexer::gobbleString(bool isRequired, char *stringBuffer, int s bool CommandLine::Lexer::getNextToken(Token *token) { - DEBUG_FATAL(!token, ("null token arg")); - DEBUG_FATAL(!nextCharacter, ("null nextCharacter")); + DEBUG_FATAL(!token, ("nullptr token arg")); + DEBUG_FATAL(!nextCharacter, ("nullptr nextCharacter")); // clear out the token memset(token, 0, sizeof(*token)); @@ -1204,7 +1204,7 @@ void CommandLine::remove(void) void CommandLine::buildOptionTree(const OptionSpec *specList, int specCount) { - DEBUG_FATAL(!specList, ("null specList arg")); + DEBUG_FATAL(!specList, ("nullptr specList arg")); if (!specCount) { @@ -1247,7 +1247,7 @@ CommandLine::MatchCode CommandLine::parseCommandLineBuffer(void) case Lexer::TT_ShortOption: // we've found a short option, make sure specified short option exists { - DEBUG_FATAL(!optionTable, ("internal error: null optionTable")); + DEBUG_FATAL(!optionTable, ("internal error: nullptr optionTable")); OptionTable::Record *record = optionTable->findOptionRecord(token.getShortName()); if (!record) { @@ -1279,7 +1279,7 @@ CommandLine::MatchCode CommandLine::parseCommandLineBuffer(void) case Lexer::TT_LongOption: // we've found a long option, make sure specified long option exists { - DEBUG_FATAL(!optionTable, ("internal error: null optionTable")); + DEBUG_FATAL(!optionTable, ("internal error: nullptr optionTable")); OptionTable::Record *record = optionTable->findOptionRecord(token.getLongName()); if (!record) { @@ -1322,7 +1322,7 @@ CommandLine::MatchCode CommandLine::parseCommandLineBuffer(void) case Lexer::TT_Argument: { - DEBUG_FATAL(!optionTable, ("internal error: null optionTable")); + DEBUG_FATAL(!optionTable, ("internal error: nullptr optionTable")); OptionTable::Record *record = optionTable->findOptionRecord(OP_SNAME_UNTAGGED); if (!record) { @@ -1382,7 +1382,7 @@ CommandLine::MatchCode CommandLine::parseCommandLineBuffer(void) void CommandLine::absorbString(const char *newString) { DEBUG_FATAL(!installed, ("CommandLine not installed")); - DEBUG_FATAL(!newString, ("null newString arg")); + DEBUG_FATAL(!newString, ("nullptr newString arg")); const int stringLength = static_cast(strlen(newString)); int requiredBufferSpace; @@ -1398,7 +1398,7 @@ void CommandLine::absorbString(const char *newString) buffer[bufferSize++] = ' '; } - // copy contents of buffer, including null + // copy contents of buffer, including nullptr memcpy(buffer + bufferSize, newString, stringLength + 1); bufferSize += stringLength; @@ -1437,7 +1437,7 @@ void CommandLine::absorbString(const char *newString) void CommandLine::absorbStrings(const char **stringArray, int stringCount) { DEBUG_FATAL(!installed, ("CommandLine not installed")); - DEBUG_FATAL(!stringArray, ("null string array")); + DEBUG_FATAL(!stringArray, ("nullptr string array")); for (int i = 0; i < stringCount; ++i) absorbString(stringArray[i]); @@ -1452,7 +1452,7 @@ void CommandLine::absorbStrings(const char **stringArray, int stringCount) * (i.e. "-- ") will be considered part of the post command line string. * * @return A read-only pointer to the portion of the command line not meant - * for CommandLine parsing. May be NULL if the entire command line + * for CommandLine parsing. May be nullptr if the entire command line * was meant for CommandLine or if no command line was specified. */ @@ -1704,7 +1704,7 @@ int CommandLine::getOccurrenceCount(const char *longName) * @param shortName [IN] short name of the option * @param occurrenceIndex [IN] zero-based occurrence number * @return The read-only argument string associated with the specified option occurrence. - * May be NULL if no argument was associated with the specified option. + * May be nullptr if no argument was associated with the specified option. */ const char *CommandLine::getOptionString(char shortName, int occurrenceIndex) @@ -1730,7 +1730,7 @@ const char *CommandLine::getOptionString(char shortName, int occurrenceIndex) * @param longName [IN] long name of the option * @param occurrenceIndex [IN] zero-based occurrence number * @return The read-only argument string associated with the specified option occurrence. - * May be NULL if no argument was associated with the specified option. + * May be nullptr if no argument was associated with the specified option. */ const char *CommandLine::getOptionString(const char *longName, int occurrenceIndex) diff --git a/engine/shared/library/sharedFoundation/src/shared/CommandLine.h b/engine/shared/library/sharedFoundation/src/shared/CommandLine.h index 358b2e40..d4eab6a0 100755 --- a/engine/shared/library/sharedFoundation/src/shared/CommandLine.h +++ b/engine/shared/library/sharedFoundation/src/shared/CommandLine.h @@ -755,7 +755,7 @@ inline const char *CommandLine::Lexer::getNextCharacter(void) inline void CommandLine::Lexer::gobbleWhitespace(void) { - DEBUG_FATAL(!nextCharacter, ("null nextCharacter")); + DEBUG_FATAL(!nextCharacter, ("nullptr nextCharacter")); while (isspace(*nextCharacter)) ++nextCharacter; } diff --git a/engine/shared/library/sharedFoundation/src/shared/ConfigFile.cpp b/engine/shared/library/sharedFoundation/src/shared/ConfigFile.cpp index 341f83e3..07c04692 100755 --- a/engine/shared/library/sharedFoundation/src/shared/ConfigFile.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/ConfigFile.cpp @@ -30,7 +30,7 @@ static char tagBuffer[6]; #define CONFIG_FILE_TEMPLATE_CREATE_INT(section, key, def) DEBUG_REPORT_LOG(true, ("cfg: [%s] %s=%d\n", section, key, def)) #define CONFIG_FILE_TEMPLATE_CREATE_BOOL(section, key, def) DEBUG_REPORT_LOG(true, ("cfg: [%s] %s=%s\n", section, key, def ? "true" : "false")) #define CONFIG_FILE_TEMPLATE_CREATE_FLOAT(section, key, def) DEBUG_REPORT_LOG(true, ("cfg: [%s] %s=%3.1f\n", section, key, def)) -#define CONFIG_FILE_TEMPLATE_CREATE_STRING(section, key, def) DEBUG_REPORT_LOG(true, ("cfg: [%s] %s=%s\n", section, key, def ? def : "NULL")) +#define CONFIG_FILE_TEMPLATE_CREATE_STRING(section, key, def) DEBUG_REPORT_LOG(true, ("cfg: [%s] %s=%s\n", section, key, def ? def : "nullptr")) #define CONFIG_FILE_TEMPLATE_CREATE_TAG(section, key, def) ConvertTagToString(def, tagBuffer), DEBUG_REPORT_LOG(true, ("cfg: [%s] %s=%d\n", section, key, tagBuffer)) #else @@ -43,8 +43,8 @@ static char tagBuffer[6]; #endif -#define NO_SPACE_SECTION(a) DEBUG_FATAL(strchr(a, ' ') != NULL, ("No spaces are allowed in config file section names: %s", a)) -#define NO_SPACE_KEY(a) DEBUG_FATAL(strchr(a, ' ') != NULL, ("No spaces are allowed in config file key names: %s", a)) +#define NO_SPACE_SECTION(a) DEBUG_FATAL(strchr(a, ' ') != nullptr, ("No spaces are allowed in config file section names: %s", a)) +#define NO_SPACE_KEY(a) DEBUG_FATAL(strchr(a, ' ') != nullptr, ("No spaces are allowed in config file key names: %s", a)) // ====================================================================== @@ -81,7 +81,7 @@ void ConfigFile::install(void) #endif ms_sections = new ConfigFile::SectionMap; - ms_currentSection = NULL; + ms_currentSection = nullptr; ExitChain::add(ConfigFile::remove, "ConfigFile::remove"); ms_installed = true; } @@ -110,7 +110,7 @@ void ConfigFile::remove(void) for (std::map::iterator it = ms_sections->begin(); it != ms_sections->end(); ++it) delete it->second; delete ms_sections; - ms_sections = NULL; + ms_sections = nullptr; ms_installed = false; } @@ -142,7 +142,7 @@ bool ConfigFile::loadFromCommandLine(const char *buffer) while (isspace(*buffer)) { ++buffer; - // advancing buffer, check for null (trailing white space on command line) + // advancing buffer, check for nullptr (trailing white space on command line) if(! *buffer) break; } @@ -196,7 +196,7 @@ bool ConfigFile::loadFromCommandLine(const char *buffer) //allocate a new section and set it as the current one Section *newSection = createSection(sectionName); //note that newSection is memory owned by the created Section object - //while sectionName is memory allocated to create a null terminated string + //while sectionName is memory allocated to create a nullptr terminated string ms_currentSection = newSection; } delete[] sectionName; @@ -292,7 +292,7 @@ bool ConfigFile::loadFromBuffer(char const * const buffer, int const length) processLine(currentLine); delete[] currentLine; bufferPosition += lineLength+1; - //trim ending whitespace. Remember that this string is not guaranteed to be NULL terminated. + //trim ending whitespace. Remember that this string is not guaranteed to be nullptr terminated. while (*bufferPosition && (bufferPosition < buffer + length) && isspace(static_cast(*bufferPosition))) ++bufferPosition; } @@ -311,26 +311,26 @@ bool ConfigFile::loadFile(const char *file) { DEBUG_FATAL(!ms_installed, ("ConfigFile not installed")); NOT_NULL(file); - ms_currentSection = NULL; - HANDLE handle = CreateFile(file, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + ms_currentSection = nullptr; + HANDLE handle = CreateFile(file, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); if (handle != INVALID_HANDLE_VALUE) { // get the length of the config file - const DWORD length = GetFileSize(handle, NULL); + const DWORD length = GetFileSize(handle, nullptr); if (length != 0xffffffff) { // create a buffer to load the config file into char * const buffer = new char[length+2]; - // make sure the buffer is null terminated + // make sure the buffer is nullptr terminated buffer[length] = '\n'; buffer[length+1] = '\0'; // read the config file in DWORD readResult; - const BOOL result = ReadFile(handle, buffer, length, &readResult, NULL); + const BOOL result = ReadFile(handle, buffer, length, &readResult, nullptr); // make sure we read all the correct stuff if (result && readResult == length) @@ -360,7 +360,7 @@ void ConfigFile::processLine(const char *line) { DEBUG_FATAL(!ms_installed, ("ConfigFile not installed")); // validate argument - DEBUG_FATAL(!line, ("ConfigFile::processLine NULL")); + DEBUG_FATAL(!line, ("ConfigFile::processLine nullptr")); // check for a full line comment if (*line == '#' || *line == ';') @@ -418,7 +418,7 @@ void ConfigFile::processLine(const char *line) //allocate a new section and set it as the current one Section *newSection = createSection(sectionName); //note that newSection is memory owned by the created Section object - //while sectionName is memory allocated to create a null terminated string + //while sectionName is memory allocated to create a nullptr terminated string ms_currentSection = newSection; } delete[] sectionName; @@ -468,7 +468,7 @@ void ConfigFile::processKeys(const char *line) while (*endValue) { //build the value - char *value = NULL; + char *value = nullptr; while(isspace(*beginValue)) ++beginValue; if (*beginValue != '"') @@ -542,7 +542,7 @@ void ConfigFile::processKeys(const char *line) /** Get a Section pointer from a string * * @param section the name of the section - * @return the pointer if valid, otherwise NULL + * @return the pointer if valid, otherwise nullptr */ ConfigFile::Section *ConfigFile::getSection(const char *section) { @@ -550,7 +550,7 @@ ConfigFile::Section *ConfigFile::getSection(const char *section) if (it != ms_sections->end()) return it->second; - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -581,7 +581,7 @@ void ConfigFile::removeSection(const char *name) if (iter != ms_sections->end()) { delete iter->second; - iter->second = NULL; + iter->second = nullptr; ms_sections->erase(iter); } } @@ -991,7 +991,7 @@ Tag ConfigFile::getKeyTag(const char *section, const char *key, Tag defaultValue ConfigFile::Element::Element(void) : - m_entry(NULL) + m_entry(nullptr) {} // ---------------------------------------------------------------------- @@ -1105,8 +1105,8 @@ Tag ConfigFile::Element::getAsTag(void) const ConfigFile::Key::Key(const char *name, const char *value, bool lazyAdd) : - m_elements(NULL), - m_name(NULL), + m_elements(nullptr), + m_name(nullptr), m_lazyAdd(lazyAdd) { m_name = new char[strlen(name)+1]; @@ -1248,8 +1248,8 @@ void ConfigFile::Key::dump(const char *keyName) const ConfigFile::Section::Section(const char *name) : - m_keys(NULL), - m_name(NULL) + m_keys(nullptr), + m_name(nullptr) { m_name = new char[strlen(name)+1]; strcpy(m_name, name); @@ -1284,7 +1284,7 @@ ConfigFile::Key *ConfigFile::Section::findKey(const char *key) const if (it != m_keys->end()) return it->second; - return NULL; + return nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedFoundation/src/shared/ConfigFile.h b/engine/shared/library/sharedFoundation/src/shared/ConfigFile.h index a4c034ed..09a78599 100755 --- a/engine/shared/library/sharedFoundation/src/shared/ConfigFile.h +++ b/engine/shared/library/sharedFoundation/src/shared/ConfigFile.h @@ -99,7 +99,7 @@ public: int getKeyInt (const char *key, int index, int defaultValue = 0) const; bool getKeyBool (const char *key, int index, bool defaultValue = false) const; float getKeyFloat (const char *key, int index, float defaultValue = 0.f) const; - const char *getKeyString(const char *key, int index, const char *defaultValue = NULL) const; + const char *getKeyString(const char *key, int index, const char *defaultValue = nullptr) const; Tag getKeyTag (const char *key, int index, Tag defaultValue = 0) const; int getKeyCount(const char *key) const; void addKey(const char *keyName, const char *value, bool lazyAdd = false); diff --git a/engine/shared/library/sharedFoundation/src/shared/CrashReportInformation.cpp b/engine/shared/library/sharedFoundation/src/shared/CrashReportInformation.cpp index 920f1ffa..983fd7ff 100755 --- a/engine/shared/library/sharedFoundation/src/shared/CrashReportInformation.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/CrashReportInformation.cpp @@ -87,7 +87,7 @@ char const * CrashReportInformation::getEntry(int index) if (index < static_cast(ms_dynamicText.size())) return ms_dynamicText[index]; - return NULL; + return nullptr; } // ====================================================================== diff --git a/engine/shared/library/sharedFoundation/src/shared/Crc.cpp b/engine/shared/library/sharedFoundation/src/shared/Crc.cpp index 4fddb3b8..28ef3514 100755 --- a/engine/shared/library/sharedFoundation/src/shared/Crc.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/Crc.cpp @@ -99,7 +99,7 @@ uint32 Crc::calculateWithToLower(const char *string) uint32 Crc::calculate(const void *data, int length, uint32 initCrc) { - DEBUG_FATAL(!data, ("null data arg")); + DEBUG_FATAL(!data, ("nullptr data arg")); uint32 crc; const byte *d = reinterpret_cast(data); diff --git a/engine/shared/library/sharedFoundation/src/shared/CrcStringTable.cpp b/engine/shared/library/sharedFoundation/src/shared/CrcStringTable.cpp index 206f0dea..9e8ca2b6 100755 --- a/engine/shared/library/sharedFoundation/src/shared/CrcStringTable.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/CrcStringTable.cpp @@ -31,9 +31,9 @@ using namespace CrcStringTableNamespace; CrcStringTable::CrcStringTable() : m_numberOfEntries(0), - m_crcTable(NULL), - m_stringsOffsetTable(NULL), - m_strings(NULL) + m_crcTable(nullptr), + m_stringsOffsetTable(nullptr), + m_strings(nullptr) { } @@ -42,9 +42,9 @@ CrcStringTable::CrcStringTable() CrcStringTable::CrcStringTable(char const * fileName) : m_numberOfEntries(0), - m_crcTable(NULL), - m_stringsOffsetTable(NULL), - m_strings(NULL) + m_crcTable(nullptr), + m_stringsOffsetTable(nullptr), + m_strings(nullptr) { load(fileName); } @@ -69,7 +69,7 @@ void CrcStringTable::load(char const * fileName) if(fileName) DEBUG_WARNING(true, ("Could not load CrcStringTable %s", fileName)); else - DEBUG_WARNING(true, ("Could not load CrcStringTable, NULL file given")); + DEBUG_WARNING(true, ("Could not load CrcStringTable, nullptr file given")); return; } diff --git a/engine/shared/library/sharedFoundation/src/shared/DataResourceList.h b/engine/shared/library/sharedFoundation/src/shared/DataResourceList.h index c5574f7f..a86629e5 100755 --- a/engine/shared/library/sharedFoundation/src/shared/DataResourceList.h +++ b/engine/shared/library/sharedFoundation/src/shared/DataResourceList.h @@ -82,7 +82,7 @@ private: template inline void DataResourceList::install() { - if (ms_bindings == NULL) + if (ms_bindings == nullptr) { ms_bindings = new CreateDataResourceMap(); ms_loaded = new LoadedDataResourceMap(); @@ -100,7 +100,7 @@ inline void DataResourceList::install() template inline void DataResourceList::remove(void) { - if (ms_loaded != NULL) + if (ms_loaded != nullptr) { #ifdef _DEBUG if (!ms_loaded->empty()) @@ -122,13 +122,13 @@ inline void DataResourceList::remove(void) #endif // _DEBUG delete ms_loaded; - ms_loaded = NULL; + ms_loaded = nullptr; } - if (ms_bindings != NULL) + if (ms_bindings != nullptr) { delete ms_bindings; - ms_bindings = NULL; + ms_bindings = nullptr; } } // DataResourceList::remove @@ -144,7 +144,7 @@ template inline void DataResourceList::registerTemplate(Tag id, CreateDataResourceFunc createFunc) { - if (ms_bindings == NULL) + if (ms_bindings == nullptr) install(); #ifdef _DEBUG @@ -237,7 +237,7 @@ inline T * DataResourceList::fetch(Tag id) typename CreateDataResourceMap::iterator iter = ms_bindings->find(id); if (iter == ms_bindings->end()) - return NULL; + return nullptr; return (*(*iter).second)(""); } // DataResourceList::fetch(Tag) @@ -268,11 +268,11 @@ inline const T * DataResourceList::fetch(Iff &source) char buffer[5]; ConvertTagToString(id, buffer); DEBUG_WARNING(true, ("DataResourceList::fetch Iff: trying to fetch resource for unknown tag %s!", buffer)); - return NULL; + return nullptr; } T *newDataResource = (*(*createIter).second)(source.getFileName()); - if (newDataResource != NULL) + if (newDataResource != nullptr) { // initialize the data resource newDataResource->loadFromIff(source); @@ -310,11 +310,11 @@ inline const T * DataResourceList::fetch(const CrcString &filename) // load the template Iff iff; if (!iff.open(filename.getString(), true)) - return NULL; + return nullptr; // put the template in the loaded list const T * const newDataResource = fetch(iff); - if (newDataResource != NULL) + if (newDataResource != nullptr) { newDataResource->addReference(); ms_loaded->insert(std::make_pair(&newDataResource->getCrcName (), newDataResource)); @@ -337,13 +337,13 @@ inline void DataResourceList::release(const T & dataResource) { NOT_NULL(ms_loaded); - if (ms_loaded != NULL && dataResource.getReferenceCount() == 0) + if (ms_loaded != nullptr && dataResource.getReferenceCount() == 0) { typename LoadedDataResourceMap::iterator iter = ms_loaded->find(&dataResource.getCrcName()); if (iter != ms_loaded->end()) { const T * const temp = (*iter).second; - (*iter).second = NULL; + (*iter).second = nullptr; ms_loaded->erase(iter); delete temp; } @@ -369,11 +369,11 @@ inline T * DataResourceList::reload(Iff &source) if (iter == ms_loaded->end()) { DEBUG_WARNING(true, ("DataResourceList::reload: trying to reload unloaded resource %s!", source.getFileName())); - return NULL; + return nullptr; } T * const dataResource = const_cast((*iter).second); - if (dataResource != NULL) + if (dataResource != nullptr) { // initialize the data resource dataResource->loadFromIff(source); diff --git a/engine/shared/library/sharedFoundation/src/shared/ExitChain.cpp b/engine/shared/library/sharedFoundation/src/shared/ExitChain.cpp index 3b1fb1bf..af70c5a0 100755 --- a/engine/shared/library/sharedFoundation/src/shared/ExitChain.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/ExitChain.cpp @@ -115,7 +115,7 @@ void ExitChain::add(Function function, const char *debugName, int priority, bool #endif // linked list traversal with a back pointer - for (back = NULL, front = PerThreadData::getExitChainFirstEntry(); front && front->priority > priority; back = front, front = front->next) + for (back = nullptr, front = PerThreadData::getExitChainFirstEntry(); front && front->priority > priority; back = front, front = front->next) ; // hook it into the linked list @@ -133,7 +133,7 @@ void ExitChain::add(Function function, const char *debugName, int priority, bool * The ExitChain will automatically remove a function from the ExitChain when it calls the function, so an * exit function should not attempt to remove itself from the ExitChain. * - * Calling this routine with a NULL pointer will cause this routine to call Fatal in debug compilations. + * Calling this routine with a nullptr pointer will cause this routine to call Fatal in debug compilations. * * Calling this routine with a function that is not on the ExitChain will cause this routine to call * Fatal in debug compilations. @@ -145,14 +145,14 @@ void ExitChain::remove(Function function) { Entry *back, *front; - if (function == NULL) + if (function == nullptr) { - DEBUG_FATAL(true, ("ExitChain::remove NULL function")); + DEBUG_FATAL(true, ("ExitChain::remove nullptr function")); return; //lint !e527 // Warning -- Unreachable } // linked list traversal with a back pointer - for (back = NULL, front = PerThreadData::getExitChainFirstEntry(); front && front->function != function; back = front, front = front->next) + for (back = nullptr, front = PerThreadData::getExitChainFirstEntry(); front && front->function != function; back = front, front = front->next) ; // make sure it was found @@ -191,7 +191,7 @@ void ExitChain::run(void) PerThreadData::setExitChainRunning(true); - while ((entry = PerThreadData::getExitChainFirstEntry()) != NULL) + while ((entry = PerThreadData::getExitChainFirstEntry()) != nullptr) { // remove the first entry off the ExitChain PerThreadData::setExitChainFirstEntry(entry->next); diff --git a/engine/shared/library/sharedFoundation/src/shared/Fatal.cpp b/engine/shared/library/sharedFoundation/src/shared/Fatal.cpp index 5d2c7327..37a3884f 100755 --- a/engine/shared/library/sharedFoundation/src/shared/Fatal.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/Fatal.cpp @@ -33,7 +33,7 @@ namespace FatalNamespace int ms_numberOfWarnings = 0; bool ms_strict = false; - WarningCallback s_warningCallback = NULL; + WarningCallback s_warningCallback = nullptr; #if PRODUCTION == 0 PixCounter::ResetInteger ms_numberOfWarningsThisFrame; @@ -70,7 +70,7 @@ static void formatMessage(char *buffer, int bufferLength, int stackDepth, const else DebugHelp::getCallStack(callStack, callStackOffset + stackDepth); - // make sure the buffer is always null terminated + // make sure the buffer is always nullptr terminated buffer[--bufferLength] = '\0'; // look up the caller's file and line @@ -191,7 +191,7 @@ static void InternalWarning(const char *format, int extraFlags, va_list va, int char buffer[4 * 1024]; - if (NULL != s_warningCallback) + if (nullptr != s_warningCallback) { strcpy(buffer, "WARNING: "); vsnprintf(buffer + 9, sizeof(buffer) - 9, format, va); diff --git a/engine/shared/library/sharedFoundation/src/shared/Fatal.h b/engine/shared/library/sharedFoundation/src/shared/Fatal.h index f33eb5ac..14215b90 100755 --- a/engine/shared/library/sharedFoundation/src/shared/Fatal.h +++ b/engine/shared/library/sharedFoundation/src/shared/Fatal.h @@ -68,15 +68,15 @@ void SetWarningCallback(WarningCallback); template inline T *NonNull(T *pointer, const char *name) { - WARNING(!pointer, ("%s pointer is null", name)); + WARNING(!pointer, ("%s pointer is nullptr", name)); return pointer; } #define NON_NULL(a) NonNull(a, #a) - #define NOT_NULL(a) FATAL(!a, ("%s pointer is null", #a)) + #define NOT_NULL(a) FATAL(!a, ("%s pointer is nullptr", #a)) - // FATAL if the specified pointer is not NULL (i.e. assert that the pointer is null, the opposite of NOT_NULL). - #define IS_NULL(a) FATAL(a, ("%s pointer is not null, unexpected.", #a)) + // FATAL if the specified pointer is not nullptr (i.e. assert that the pointer is nullptr, the opposite of NOT_NULL). + #define IS_NULL(a) FATAL(a, ("%s pointer is not nullptr, unexpected.", #a)) #else diff --git a/engine/shared/library/sharedFoundation/src/shared/FormattedString.h b/engine/shared/library/sharedFoundation/src/shared/FormattedString.h index b4e1f6de..d778be27 100755 --- a/engine/shared/library/sharedFoundation/src/shared/FormattedString.h +++ b/engine/shared/library/sharedFoundation/src/shared/FormattedString.h @@ -42,7 +42,7 @@ inline FormattedString::FormattedString() template inline char const * FormattedString::sprintf(char const * const format, ...) { - char const * result = NULL; + char const * result = nullptr; va_list va; va_start(va, format); @@ -64,7 +64,7 @@ inline char const * FormattedString::vsprintf(char const * const for int const charactersWritten = vsnprintf(m_text, lastIndex, format, va); // vsnprintf returns the number of characters written, not including - // the terminating null character, or a negative value if an output error occurs. + // the terminating nullptr character, or a negative value if an output error occurs. // If the number of characters to write exceeds count, then count characters are // written and -1 is returned. diff --git a/engine/shared/library/sharedFoundation/src/shared/LabelHash.cpp b/engine/shared/library/sharedFoundation/src/shared/LabelHash.cpp index 26848b94..2f28a3ca 100755 --- a/engine/shared/library/sharedFoundation/src/shared/LabelHash.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/LabelHash.cpp @@ -109,7 +109,7 @@ const char * LabelHash::findLabel( char const * const domain, uint32 hashValue ) { // Domain not found - return NULL; + return nullptr; } // ---------- @@ -127,6 +127,6 @@ const char * LabelHash::findLabel( char const * const domain, uint32 hashValue ) // ---------- // String not found - return NULL; + return nullptr; } diff --git a/engine/shared/library/sharedFoundation/src/shared/MemoryBlockManager.cpp b/engine/shared/library/sharedFoundation/src/shared/MemoryBlockManager.cpp index c5c86efd..c8067046 100755 --- a/engine/shared/library/sharedFoundation/src/shared/MemoryBlockManager.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/MemoryBlockManager.cpp @@ -138,8 +138,8 @@ using namespace MemoryBlockManagerNamespace; MemoryBlockManager::Allocator::Allocator(const int elementSize) : m_referenceCount(0), - m_firstBlock(NULL), - m_firstFreeElement(NULL), + m_firstBlock(nullptr), + m_firstFreeElement(nullptr), m_elementSize(elementSize), m_elementsPerBlock(64), m_currentNumberOfBlocks(0), @@ -157,8 +157,8 @@ MemoryBlockManager::Allocator::Allocator(const int elementSize) MemoryBlockManager::Allocator::Allocator(int elementSize, int elementsPerBlock, int minimumBlocks, int maximumNumberOfBlocks) : m_referenceCount(0), - m_firstBlock(NULL), - m_firstFreeElement(NULL), + m_firstBlock(nullptr), + m_firstFreeElement(nullptr), m_elementSize(elementSize), m_elementsPerBlock(elementsPerBlock), m_currentNumberOfBlocks(0), @@ -188,8 +188,8 @@ MemoryBlockManager::Allocator::~Allocator() delete block; } - m_firstBlock = NULL; - m_firstFreeElement = NULL; + m_firstBlock = nullptr; + m_firstFreeElement = nullptr; } // ---------------------------------------------------------------------- @@ -427,7 +427,7 @@ MemoryBlockManager::MemoryBlockManager(char const * name, bool shared, int eleme : m_name(name), m_shared(shared), m_currentNumberOfElements(0), - m_allocator(NULL) + m_allocator(nullptr) { //-- Handle config option where we force all MemoryBlockManagers to be non-shared. if (shared && ms_forceAllNonShared) @@ -598,7 +598,7 @@ void *MemoryBlockManager::allocate(bool returnNullOnFailure) { ms_globalCriticalSection.leave(); DEBUG_FATAL(!returnNullOnFailure, ("MBM %s is full %d", m_name, m_currentNumberOfElements)); - return NULL; + return nullptr; } ++m_currentNumberOfElements; diff --git a/engine/shared/library/sharedFoundation/src/shared/MessageQueue.cpp b/engine/shared/library/sharedFoundation/src/shared/MessageQueue.cpp index 5af0285d..4b77315c 100755 --- a/engine/shared/library/sharedFoundation/src/shared/MessageQueue.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/MessageQueue.cpp @@ -105,7 +105,7 @@ void MessageQueue::clearDataFromMessageList(MessageList &messageList, bool destr { DEBUG_WARNING(!destructor, ("clearing message data from beginFrame")); delete message.m_data; - message.m_data = NULL; + message.m_data = nullptr; } } } @@ -199,7 +199,7 @@ void MessageQueue::clearMessage(const int index) VALIDATE_RANGE_INCLUSIVE_EXCLUSIVE(0, index, getNumberOfMessages()); Message& message = (*m_messageQueueRead)[static_cast(index)]; - DEBUG_WARNING(message.m_data, ("MessageQueue::clearMessage - clearing message with non-null data")); + DEBUG_WARNING(message.m_data, ("MessageQueue::clearMessage - clearing message with non-nullptr data")); message.m_message = 0; } diff --git a/engine/shared/library/sharedFoundation/src/shared/Misc.h b/engine/shared/library/sharedFoundation/src/shared/Misc.h index 326d3341..1c29b6ed 100755 --- a/engine/shared/library/sharedFoundation/src/shared/Misc.h +++ b/engine/shared/library/sharedFoundation/src/shared/Misc.h @@ -135,7 +135,7 @@ templateinline void Zero(T &t) * the source string into the new memory, and then returns a pointer to * the new memory. * - * This routine will return NULL if called with NULL. + * This routine will return nullptr if called with nullptr. * * @param source The string to copy * @return A pointer to a copy of the source argument @@ -144,7 +144,7 @@ templateinline void Zero(T &t) inline char *DuplicateString(const char *source) { if (!source) - return NULL; + return nullptr; const uint length = strlen(source)+1; char *result = NON_NULL (new char[length]); @@ -160,7 +160,7 @@ inline char *DuplicateString(const char *source) * the source string into the new memory, and then returns a pointer to * the new memory. * - * This routine will return NULL if called with NULL. + * This routine will return nullptr if called with nullptr. * * @param source The string to copy * @return A pointer to a copy of the source argument @@ -169,7 +169,7 @@ inline char *DuplicateString(const char *source) inline char *DuplicateStringWithToLower(const char *source) { if (!source) - return NULL; + return nullptr; const uint length = strlen(source)+1; char *result = NON_NULL (new char[length]); @@ -193,7 +193,7 @@ inline char *DuplicateStringWithToLower(const char *source) inline void imemset(void *data, int value, int length) { - DEBUG_FATAL(!data, ("null data arg")); + DEBUG_FATAL(!data, ("nullptr data arg")); memset(data, value, static_cast(length)); } @@ -210,8 +210,8 @@ inline void imemset(void *data, int value, int length) inline void imemcpy(void *destination, const void *source, int length) { - DEBUG_FATAL(!destination, ("null destination arg")); - DEBUG_FATAL(!source, ("null source arg")); + DEBUG_FATAL(!destination, ("nullptr destination arg")); + DEBUG_FATAL(!source, ("nullptr source arg")); memcpy(destination, source, static_cast(length)); } @@ -228,8 +228,8 @@ inline void imemcpy(void *destination, const void *source, int length) inline void *memmove(void *destination, const void *source, int length) { - DEBUG_FATAL(!destination, ("null destination arg")); - DEBUG_FATAL(!source, ("null source arg")); + DEBUG_FATAL(!destination, ("nullptr destination arg")); + DEBUG_FATAL(!source, ("nullptr source arg")); return memmove(destination, source, static_cast(length)); } @@ -243,7 +243,7 @@ inline void *memmove(void *destination, const void *source, int length) inline int istrlen(const char *string) { - DEBUG_FATAL(!string, ("null string arg")); + DEBUG_FATAL(!string, ("nullptr string arg")); return static_cast(strlen(string)); } diff --git a/engine/shared/library/sharedFoundation/src/shared/PersistentCrcString.cpp b/engine/shared/library/sharedFoundation/src/shared/PersistentCrcString.cpp index 7de5a7d3..dae8108f 100755 --- a/engine/shared/library/sharedFoundation/src/shared/PersistentCrcString.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/PersistentCrcString.cpp @@ -50,23 +50,23 @@ void PersistentCrcString::install() void PersistentCrcStringNamespace::remove() { delete ms_memoryBlockManager8; - ms_memoryBlockManager8 = NULL; + ms_memoryBlockManager8 = nullptr; delete ms_memoryBlockManager16; - ms_memoryBlockManager16 = NULL; + ms_memoryBlockManager16 = nullptr; delete ms_memoryBlockManager32; - ms_memoryBlockManager32 = NULL; + ms_memoryBlockManager32 = nullptr; delete ms_memoryBlockManager48; - ms_memoryBlockManager48 = NULL; + ms_memoryBlockManager48 = nullptr; delete ms_memoryBlockManager64; - ms_memoryBlockManager64 = NULL; + ms_memoryBlockManager64 = nullptr; } // ====================================================================== PersistentCrcString::PersistentCrcString() : CrcString(), - m_memoryBlockManager(NULL), - m_buffer(NULL) + m_memoryBlockManager(nullptr), + m_buffer(nullptr) { DEBUG_FATAL(!ms_memoryBlockManager8, ("Constructing a PersistentCrcString before the class is installed")); } @@ -75,8 +75,8 @@ PersistentCrcString::PersistentCrcString() PersistentCrcString::PersistentCrcString(CrcString const &rhs) : CrcString(), - m_memoryBlockManager(NULL), - m_buffer(NULL) + m_memoryBlockManager(nullptr), + m_buffer(nullptr) { DEBUG_FATAL(!ms_memoryBlockManager8, ("Constructing a PersistentCrcString before the class is installed")); @@ -88,8 +88,8 @@ PersistentCrcString::PersistentCrcString(CrcString const &rhs) PersistentCrcString::PersistentCrcString(PersistentCrcString const &rhs) : CrcString(), //lint !e1738 // non copy constructor used to initialize base class // this appears to be intentional. - m_memoryBlockManager(NULL), - m_buffer(NULL) + m_memoryBlockManager(nullptr), + m_buffer(nullptr) { DEBUG_FATAL(!ms_memoryBlockManager8, ("Constructing a PersistentCrcString before the class is installed")); @@ -101,8 +101,8 @@ PersistentCrcString::PersistentCrcString(PersistentCrcString const &rhs) PersistentCrcString::PersistentCrcString(char const * string, bool applyNormalize) : CrcString(), - m_memoryBlockManager(NULL), - m_buffer(NULL) + m_memoryBlockManager(nullptr), + m_buffer(nullptr) { DEBUG_FATAL(!ms_memoryBlockManager8, ("Constructing a PersistentCrcString before the class is installed")); @@ -114,8 +114,8 @@ PersistentCrcString::PersistentCrcString(char const * string, bool applyNormaliz PersistentCrcString::PersistentCrcString(char const * string, uint32 crc) : CrcString(), - m_memoryBlockManager(NULL), - m_buffer(NULL) + m_memoryBlockManager(nullptr), + m_buffer(nullptr) { DEBUG_FATAL(!ms_memoryBlockManager8, ("Constructing a PersistentCrcString before the class is installed")); @@ -169,18 +169,18 @@ void PersistentCrcString::internalFree() { if (m_memoryBlockManager == ms_fakeConstCharMemoryBlockManager) { - m_memoryBlockManager = NULL; + m_memoryBlockManager = nullptr; } else { m_memoryBlockManager->free(m_buffer); - m_memoryBlockManager = NULL; + m_memoryBlockManager = nullptr; } } else delete [] m_buffer; - m_buffer = NULL; + m_buffer = nullptr; } } @@ -201,7 +201,7 @@ void PersistentCrcString::internalSet(char const * string, bool applyNormalize) const int stringLength = istrlen(string) + 1; DEBUG_FATAL(stringLength > Os::MAX_PATH_LENGTH, ("string too long for a filename")); - m_memoryBlockManager = NULL; + m_memoryBlockManager = nullptr; if (stringLength <= 8) m_memoryBlockManager = ms_memoryBlockManager8; else diff --git a/engine/shared/library/sharedFoundation/src/shared/Tag.h b/engine/shared/library/sharedFoundation/src/shared/Tag.h index 82a4f393..261b474e 100755 --- a/engine/shared/library/sharedFoundation/src/shared/Tag.h +++ b/engine/shared/library/sharedFoundation/src/shared/Tag.h @@ -158,7 +158,7 @@ inline Tag ConvertIntToTag(int value) * array with the name of the specified tag. If a character of the tag * is not printable, it will be replaced with a question mark. * - * A null-character will be appended to the output buffer. + * A nullptr-character will be appended to the output buffer. * * This routine assumes the specified character buffer is at least 5 characters * in length. @@ -171,7 +171,7 @@ inline void ConvertTagToString(Tag tag, char *buffer) { int i, j, ch; - DEBUG_FATAL(!buffer, ("buffer is null")); + DEBUG_FATAL(!buffer, ("buffer is nullptr")); for (i = 0, j = 24; i < 4; ++i, j -= 8) { diff --git a/engine/shared/library/sharedFoundation/src/shared/Watcher.cpp b/engine/shared/library/sharedFoundation/src/shared/Watcher.cpp index 3ca86728..c56201a6 100755 --- a/engine/shared/library/sharedFoundation/src/shared/Watcher.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/Watcher.cpp @@ -82,7 +82,7 @@ void WatchedByList::install() /** * Destroy a WatchedByList. * - * All watchers currently watching the owner of this object will be reset to NULL. + * All watchers currently watching the owner of this object will be reset to nullptr. */ WatchedByList::~WatchedByList() @@ -92,7 +92,7 @@ WatchedByList::~WatchedByList() if (m_list) { deleteList(m_list); - m_list = NULL; + m_list = nullptr; } } diff --git a/engine/shared/library/sharedFoundation/src/shared/Watcher.h b/engine/shared/library/sharedFoundation/src/shared/Watcher.h index ca637a79..921b91d5 100755 --- a/engine/shared/library/sharedFoundation/src/shared/Watcher.h +++ b/engine/shared/library/sharedFoundation/src/shared/Watcher.h @@ -8,7 +8,7 @@ // @todo How do I get this into doxygen? It's information that really spans multiple classes // // The Watcher system allows pointers to objects to be automatically -// reset to NULL when the object watching them is destoyed. +// reset to nullptr when the object watching them is destoyed. // // For something to be watchable, it must provide a routine of the form: // @@ -66,7 +66,7 @@ class Watcher : public BaseWatcher { public: - explicit Watcher(T *data=NULL); + explicit Watcher(T *data=nullptr); Watcher(const Watcher &newValue); ~Watcher(); //lint !e1509 // Warning -- base class destructor for class is not virtual @@ -96,7 +96,7 @@ class ConstWatcher : public BaseWatcher { public: - explicit ConstWatcher(const T *data=NULL); + explicit ConstWatcher(const T *data=nullptr); ConstWatcher(const ConstWatcher &newValue); ~ConstWatcher(); //lint !e1509 // Warning -- base class destructor for class is not virtual @@ -177,7 +177,7 @@ inline BaseWatcher::BaseWatcher(void *data) inline void BaseWatcher::reset() { - m_data = NULL; + m_data = nullptr; } // ---------------------------------------------------------------------- @@ -190,7 +190,7 @@ inline void BaseWatcher::reset() inline BaseWatcher::~BaseWatcher() { - m_data = NULL; + m_data = nullptr; } // ---------------------------------------------------------------------- @@ -593,11 +593,11 @@ inline const T *ConstWatcher::operator ->() const /** * Construct a WatchedByList. * - * This list of watchers remains NULL until someone first watches the object. + * This list of watchers remains nullptr until someone first watches the object. */ inline WatchedByList::WatchedByList() -: m_list(NULL) +: m_list(nullptr) { } diff --git a/engine/shared/library/sharedFoundation/src/shared/dynamicVariable/DynamicVariable.cpp b/engine/shared/library/sharedFoundation/src/shared/dynamicVariable/DynamicVariable.cpp index f11c603e..ada9369f 100755 --- a/engine/shared/library/sharedFoundation/src/shared/dynamicVariable/DynamicVariable.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/dynamicVariable/DynamicVariable.cpp @@ -106,8 +106,8 @@ m_value(), m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; } // ---------------------------------------------------------------------- @@ -131,8 +131,8 @@ DynamicVariable::DynamicVariable(const DynamicVariable &rhs) : m_position(rhs.m_position), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; } // ---------------------------------------------------------------------- @@ -158,8 +158,8 @@ DynamicVariable& DynamicVariable::operator=(const DynamicVariable &rhs) (*f)(m_cachedValue[0]); } - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; } } @@ -201,8 +201,8 @@ void DynamicVariable::load(int position, int typeId, const Unicode::String &pack (*f)(m_cachedValue[0]); } - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; } } @@ -235,8 +235,8 @@ DynamicVariable::DynamicVariable(int value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; pack(value, m_value); } @@ -249,8 +249,8 @@ DynamicVariable::DynamicVariable(const std::vector & value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; pack(value, m_value); } @@ -263,8 +263,8 @@ DynamicVariable::DynamicVariable(float value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; pack(value, m_value); } @@ -277,8 +277,8 @@ DynamicVariable::DynamicVariable(const std::vector & value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; pack(value, m_value); } @@ -291,8 +291,8 @@ DynamicVariable::DynamicVariable(const Unicode::String &value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; } // ---------------------------------------------------------------------- @@ -303,8 +303,8 @@ DynamicVariable::DynamicVariable(const std::string &value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; } // ---------------------------------------------------------------------- @@ -315,8 +315,8 @@ DynamicVariable::DynamicVariable(const std::vector & value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; pack(value, m_value); } @@ -329,8 +329,8 @@ DynamicVariable::DynamicVariable(const NetworkId & value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; } // ---------------------------------------------------------------------- @@ -341,8 +341,8 @@ DynamicVariable::DynamicVariable(const std::vector & value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; pack(value, m_value); } @@ -355,8 +355,8 @@ DynamicVariable::DynamicVariable(const DynamicVariableLocationData & value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; pack(value, m_value); } @@ -369,8 +369,8 @@ DynamicVariable::DynamicVariable(const std::vector m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; pack(value, m_value); } @@ -383,8 +383,8 @@ DynamicVariable::DynamicVariable(const StringId &value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; } // ---------------------------------------------------------------------- @@ -395,8 +395,8 @@ DynamicVariable::DynamicVariable(const std::vector &value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; pack(value, m_value); } @@ -409,8 +409,8 @@ DynamicVariable::DynamicVariable(const Transform &value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; pack(value, m_value); } @@ -423,8 +423,8 @@ DynamicVariable::DynamicVariable(const std::vector &value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; pack(value, m_value); } @@ -437,8 +437,8 @@ DynamicVariable::DynamicVariable(const Vector &value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; pack(value, m_value); } @@ -451,8 +451,8 @@ DynamicVariable::DynamicVariable(const std::vector &value) : m_position(-1), m_cachedValueDirty(true) { - m_cachedValue[0] = NULL; - m_cachedValue[1] = NULL; + m_cachedValue[0] = nullptr; + m_cachedValue[1] = nullptr; pack(value, m_value); } @@ -786,7 +786,7 @@ bool DynamicVariable::get(DynamicVariableLocationData & value) const char tempCell[BUFSIZE]; std::string data(Unicode::wideToNarrow(m_value)); const char * bufptrStart = data.c_str(); - char * bufptrEnd = NULL; + char * bufptrEnd = nullptr; cachedValue.pos.x = static_cast(strtod(bufptrStart, &bufptrEnd)); bufptrStart = bufptrEnd; while (*bufptrStart != '\0' && isspace(*bufptrStart)) @@ -811,7 +811,7 @@ bool DynamicVariable::get(DynamicVariableLocationData & value) const while (*bufptrStart != '\0' && isspace(*bufptrStart)) ++bufptrStart; bufptrEnd = const_cast(strchr(bufptrStart, ' ')); - if (bufptrEnd == NULL || bufptrEnd - bufptrStart >= BUFSIZE) + if (bufptrEnd == nullptr || bufptrEnd - bufptrStart >= BUFSIZE) { WARNING_STRICT_FATAL(true, ("DynamicVariable::get location buffer overflow in scene")); return false; @@ -875,7 +875,7 @@ bool DynamicVariable::get(std::vector & value) cons char tempCell[BUFSIZE]; const char * bufptrStart = buffer; - char * bufptrEnd = NULL; + char * bufptrEnd = nullptr; temp.pos.x = static_cast(strtod(bufptrStart, &bufptrEnd)); bufptrStart = bufptrEnd; while (*bufptrStart != '\0' && isspace(*bufptrStart)) @@ -900,7 +900,7 @@ bool DynamicVariable::get(std::vector & value) cons while (*bufptrStart != '\0' && isspace(*bufptrStart)) ++bufptrStart; bufptrEnd = const_cast(strchr(bufptrStart, ' ')); - if (bufptrEnd == NULL || bufptrEnd - bufptrStart >= BUFSIZE) + if (bufptrEnd == nullptr || bufptrEnd - bufptrStart >= BUFSIZE) { WARNING_STRICT_FATAL(true, ("DynamicVariable::get location array buffer overflow in scene")); return false; @@ -1430,8 +1430,8 @@ namespace Archive (*f)(target.m_cachedValue[0]); } - target.m_cachedValue[0] = NULL; - target.m_cachedValue[1] = NULL; + target.m_cachedValue[0] = nullptr; + target.m_cachedValue[1] = nullptr; } } diff --git a/engine/shared/library/sharedFoundation/src/shared/dynamicVariable/DynamicVariable.h b/engine/shared/library/sharedFoundation/src/shared/dynamicVariable/DynamicVariable.h index 004de6fc..c69588ba 100755 --- a/engine/shared/library/sharedFoundation/src/shared/dynamicVariable/DynamicVariable.h +++ b/engine/shared/library/sharedFoundation/src/shared/dynamicVariable/DynamicVariable.h @@ -150,8 +150,8 @@ private: // caching the value so we don't constantly convert them from the string representation // // if the value can fit in m_cachedValue, we directly store it there - // int uses m_cachedValue[0], m_cachedValue[1] = NULL - // float uses m_cachedValue[0], m_cachedValue[1] = NULL + // int uses m_cachedValue[0], m_cachedValue[1] = nullptr + // float uses m_cachedValue[0], m_cachedValue[1] = nullptr // NetworkId uses both m_cachedValue[0] and m_cachedValue[1] // // if not, we allocate storage for the value and store the pointer to it diff --git a/engine/shared/library/sharedGame/src/shared/appearance/WearableAppearanceMap.cpp b/engine/shared/library/sharedGame/src/shared/appearance/WearableAppearanceMap.cpp index 63d98b04..5b7e478f 100755 --- a/engine/shared/library/sharedGame/src/shared/appearance/WearableAppearanceMap.cpp +++ b/engine/shared/library/sharedGame/src/shared/appearance/WearableAppearanceMap.cpp @@ -155,9 +155,9 @@ WearableAppearanceMapNamespace::PersistentMapEntry::PersistentMapEntry(char cons MapEntry(), m_sourceWearableAppearanceName(sourceWearableAppearanceName, true), m_wearerAppearanceName(wearerAppearanceName, true), - m_mappedWearableAppearanceName(NULL) + m_mappedWearableAppearanceName(nullptr) { - if (mappedWearableAppearanceName != NULL) + if (mappedWearableAppearanceName != nullptr) m_mappedWearableAppearanceName = new PersistentCrcString(mappedWearableAppearanceName, true); } @@ -218,7 +218,7 @@ CrcString const &WearableAppearanceMapNamespace::TemporaryMapEntry::getWearerApp CrcString const *WearableAppearanceMapNamespace::TemporaryMapEntry::getMappedWearableAppearanceName() const { - return NULL; + return nullptr; } // ====================================================================== @@ -297,7 +297,7 @@ void WearableAppearanceMapNamespace::loadTableData(char const *filename) std::string const &mappedWearableAppearanceName = table->getStringValue(mappedWearableAppearanceNameColumnNumber, rowIndex); //-- Create map entry, add to vector. - s_mapEntries.push_back(new PersistentMapEntry(sourceWearableAppearanceName.c_str(), wearerAppearanceName.c_str(), (mappedWearableAppearanceName == cs_forbiddenWearableCellContents) ? NULL : mappedWearableAppearanceName.c_str())); + s_mapEntries.push_back(new PersistentMapEntry(sourceWearableAppearanceName.c_str(), wearerAppearanceName.c_str(), (mappedWearableAppearanceName == cs_forbiddenWearableCellContents) ? nullptr : mappedWearableAppearanceName.c_str())); } DataTableManager::close(filename); @@ -388,7 +388,7 @@ WearableAppearanceMap::MapResult WearableAppearanceMap::getMapResultForWearableA if (findResult.first == findResult.second) { // We have no mapping for this entry. That implies the source wearable appearance name can be used as is. - return MapResult(false, false, NULL); + return MapResult(false, false, nullptr); } else { @@ -398,7 +398,7 @@ WearableAppearanceMap::MapResult WearableAppearanceMap::getMapResultForWearableA // We have a mapping. Return it. CrcString const *const mappedWearableAppearanceName = mapEntry->getMappedWearableAppearanceName(); - return MapResult(true, mappedWearableAppearanceName == NULL, mappedWearableAppearanceName); + return MapResult(true, mappedWearableAppearanceName == nullptr, mappedWearableAppearanceName); } } diff --git a/engine/shared/library/sharedGame/src/shared/collision/CollisionCallbackManager.cpp b/engine/shared/library/sharedGame/src/shared/collision/CollisionCallbackManager.cpp index fc8d7b13..89f58b9a 100755 --- a/engine/shared/library/sharedGame/src/shared/collision/CollisionCallbackManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/collision/CollisionCallbackManager.cpp @@ -279,8 +279,8 @@ bool CollisionCallbackManager::intersectAndReflectWithTerrain(Object * const obj void CollisionCallbackManagerNamespace::noCollisionDetectionThisFrame(Object * const object) { - FATAL(!ms_convertObjectToIndex, ("CollisionCallbackManagerNamespace::noCollisionDetectionThisFrame: ms_convertObjectToIndex == NULL.")); - FATAL(!object, ("CollisionCallbackManagerNamespace::noCollisionDetectionThisFrame: object == NULL.")); + FATAL(!ms_convertObjectToIndex, ("CollisionCallbackManagerNamespace::noCollisionDetectionThisFrame: ms_convertObjectToIndex == nullptr.")); + FATAL(!object, ("CollisionCallbackManagerNamespace::noCollisionDetectionThisFrame: object == nullptr.")); int const index = ms_convertObjectToIndex(object); @@ -298,9 +298,9 @@ void CollisionCallbackManagerNamespace::noCollisionDetectionThisFrame(Object * c bool CollisionCallbackManagerNamespace::collisionDetectionOnHit(Object * const object, Object * const wasHitByThisObject) { - FATAL(!ms_convertObjectToIndex, ("CollisionCallbackManagerNamespace::collisionDetectionOnHit: ms_convertObjectToIndex == NULL.")); - FATAL(!object, ("CollisionCallbackManagerNamespace::collisionDetectionOnHit: object == NULL.")); - FATAL(!wasHitByThisObject, ("CollisionCallbackManagerNamespace::collisionDetectionOnHit: wasHitByThisObject == NULL.")); + FATAL(!ms_convertObjectToIndex, ("CollisionCallbackManagerNamespace::collisionDetectionOnHit: ms_convertObjectToIndex == nullptr.")); + FATAL(!object, ("CollisionCallbackManagerNamespace::collisionDetectionOnHit: object == nullptr.")); + FATAL(!wasHitByThisObject, ("CollisionCallbackManagerNamespace::collisionDetectionOnHit: wasHitByThisObject == nullptr.")); CollisionCallbackManager::OnHitByObjectFunction function = 0; diff --git a/engine/shared/library/sharedGame/src/shared/core/AiDebugString.cpp b/engine/shared/library/sharedGame/src/shared/core/AiDebugString.cpp index 544cf1af..af8d3ef1 100755 --- a/engine/shared/library/sharedGame/src/shared/core/AiDebugString.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/AiDebugString.cpp @@ -69,7 +69,7 @@ AiDebugString::AiDebugString(std::string const & text) Unicode::String const delimiters(Unicode::narrowToWide("`")); Unicode::UnicodeStringVector result; - if (Unicode::tokenize(Unicode::narrowToWide(text), result, &delimiters, NULL)) + if (Unicode::tokenize(Unicode::narrowToWide(text), result, &delimiters, nullptr)) { Unicode::UnicodeStringVector::const_iterator iterStringVector = result.begin(); diff --git a/engine/shared/library/sharedGame/src/shared/core/AssetCustomizationManager.cpp b/engine/shared/library/sharedGame/src/shared/core/AssetCustomizationManager.cpp index 34acdca1..88432113 100755 --- a/engine/shared/library/sharedGame/src/shared/core/AssetCustomizationManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/AssetCustomizationManager.cpp @@ -192,31 +192,31 @@ void AssetCustomizationManagerNamespace::remove() s_installed = false; delete [] s_nameDataBlock; - s_nameDataBlock = NULL; + s_nameDataBlock = nullptr; s_nameDataBlockSize = 0; delete [] s_paletteIdNameOffsetMap; - s_paletteIdNameOffsetMap = NULL; + s_paletteIdNameOffsetMap = nullptr; s_maxValidPaletteId = 0; delete [] s_variableIdNameOffsetMap; - s_variableIdNameOffsetMap = NULL; + s_variableIdNameOffsetMap = nullptr; s_maxValidVariableId = 0; delete [] s_defaultValueMap; - s_defaultValueMap = NULL; + s_defaultValueMap = nullptr; s_maxValidDefaultId = 0; delete [] s_intRangeMap; - s_intRangeMap = NULL; + s_intRangeMap = nullptr; s_maxValidIntRangeId = 0; delete [] s_rangeTypeMap; - s_rangeTypeMap = NULL; + s_rangeTypeMap = nullptr; s_maxValidRangeId = 0; delete [] s_variableUsageMap; - s_variableUsageMap = NULL; + s_variableUsageMap = nullptr; s_maxValidVariableUsageId = 0; delete [] s_variableUsageList; @@ -224,19 +224,19 @@ void AssetCustomizationManagerNamespace::remove() s_variableUsageListEntryCount = 0; delete [] s_usageIndex; - s_usageIndex = NULL; + s_usageIndex = nullptr; s_usageIndexEntryCount = 0; delete [] s_linkList; - s_linkList = NULL; + s_linkList = nullptr; s_linkListEntryCount = 0; delete [] s_linkIndex; - s_linkIndex = NULL; + s_linkIndex = nullptr; s_linkIndexEntryCount = 0; delete [] s_crcLookupTable; - s_crcLookupTable = NULL; + s_crcLookupTable = nullptr; s_crcLookupEntryCount = 0; } @@ -488,7 +488,7 @@ int AssetCustomizationManagerNamespace::lookupAssetId(CrcString const &assetName uint32 const key = assetName.getCrc(); CrcLookupEntry const *entry = static_cast(bsearch(&key, s_crcLookupTable, static_cast(s_crcLookupEntryCount), sizeof(CrcLookupEntry), compare_uint32)); - return (entry != NULL) ? entry->assetId : 0; + return (entry != nullptr) ? entry->assetId : 0; } // ---------------------------------------------------------------------- @@ -584,7 +584,7 @@ void AssetCustomizationManagerNamespace::addVariablesForAssetAndLinks(int assetI getRangeTypeInfoFromRangeId(variableUsage->rangeId, isPalette, idForRealType); //-- Create variable based on type. - CustomizationVariable *variable = NULL; + CustomizationVariable *variable = nullptr; if (isPalette) { //-- Get palette. diff --git a/engine/shared/library/sharedGame/src/shared/core/CitizenRankDataTable.cpp b/engine/shared/library/sharedGame/src/shared/core/CitizenRankDataTable.cpp index 2edf349d..a5f37664 100755 --- a/engine/shared/library/sharedGame/src/shared/core/CitizenRankDataTable.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/CitizenRankDataTable.cpp @@ -63,7 +63,7 @@ void CitizenRankDataTable::install() FATAL((columnRankSlotId < 0), ("column \"rankSlotId\" not found in %s", cs_citizenRankDataTableName)); FATAL((columnTitle < 0), ("column \"title\" not found in %s", cs_citizenRankDataTableName)); - CitizenRankDataTable::CitizenRank const * currentRank = NULL; + CitizenRankDataTable::CitizenRank const * currentRank = nullptr; int const numRows = table->getNumRows(); std::string rankName, alternateTitle; @@ -199,7 +199,7 @@ CitizenRankDataTable::CitizenRank const * CitizenRankDataTable::getRank(std::str if (iterFind != s_allCitizenRanksByName.end()) return iterFind->second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -210,7 +210,7 @@ CitizenRankDataTable::CitizenRank const * CitizenRankDataTable::isARankTitle(std if (iterFind != s_allCitizenRanksByTitle.end()) return iterFind->second; - return NULL; + return nullptr; } // ====================================================================== diff --git a/engine/shared/library/sharedGame/src/shared/core/CollectionsDataTable.cpp b/engine/shared/library/sharedGame/src/shared/core/CollectionsDataTable.cpp index 74cc78cc..f7402fdb 100755 --- a/engine/shared/library/sharedGame/src/shared/core/CollectionsDataTable.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/CollectionsDataTable.cpp @@ -34,7 +34,7 @@ namespace CollectionsDataTableNamespace // for quick lookup of a slot by begin slot id, we use a vector because // slot id are guaranteed to start at 0 and be contiguous; for counter-type // slot, only the begin slot id index points to the slot; the other slot - // id indices point to NULL + // id indices point to nullptr std::vector s_allSlotsById; // all title(able) slots @@ -232,10 +232,10 @@ void CollectionsDataTable::install() FATAL((columnNoReward < 0), ("column \"noReward\" not found in %s", cs_collectionsDataTableName)); FATAL((columnTrackServerFirst < 0), ("column \"trackServerFirst\" not found in %s", cs_collectionsDataTableName)); - CollectionsDataTable::CollectionInfoBook const * currentBook = NULL; - CollectionsDataTable::CollectionInfoPage const * currentPage = NULL; - CollectionsDataTable::CollectionInfoCollection const * currentCollection = NULL; - CollectionsDataTable::CollectionInfoSlot const * currentSlot = NULL; + CollectionsDataTable::CollectionInfoBook const * currentBook = nullptr; + CollectionsDataTable::CollectionInfoPage const * currentPage = nullptr; + CollectionsDataTable::CollectionInfoCollection const * currentCollection = nullptr; + CollectionsDataTable::CollectionInfoSlot const * currentSlot = nullptr; int const numRows = table->getNumRows(); std::string bookName, pageName, collectionName, slotName, category, prereq, alternateTitle, icon, music; @@ -350,8 +350,8 @@ void CollectionsDataTable::install() FATAL(title, ("%s: book %s cannot be \"titleable\")", cs_collectionsDataTableName, bookName.c_str())); FATAL(!titles.empty(), ("%s: book %s cannot have any alternate titles (books are not \"titleable\")", cs_collectionsDataTableName, bookName.c_str())); currentBook = new CollectionInfoBook(bookName, icon, showIfNotYetEarned, hidden); - currentPage = NULL; - currentCollection = NULL; + currentPage = nullptr; + currentCollection = nullptr; s_allBooks.push_back(currentBook); s_allBooksByName[bookName] = currentBook; } @@ -376,7 +376,7 @@ void CollectionsDataTable::install() // start new page FATAL((!titles.empty() && !title), ("%s: page %s cannot have any alternate titles unless it is defined as \"titleable\")", cs_collectionsDataTableName, pageName.c_str())); currentPage = new CollectionInfoPage(pageName, icon, showIfNotYetEarned, hidden, titles, *currentBook); - currentCollection = NULL; + currentCollection = nullptr; s_pagesInBook[currentBook->name].push_back(currentPage); s_allPagesByName[pageName] = currentPage; @@ -549,7 +549,7 @@ void CollectionsDataTable::install() IGNORE_RETURN(s_slotCategoriesByCollection[currentCollection->name].insert(*iterCategories)); } - currentSlot = NULL; + currentSlot = nullptr; categories.clear(); prereqs.clear(); } @@ -575,7 +575,7 @@ void CollectionsDataTable::install() } // save off all slots ordered by slot ids - s_allSlotsById.resize(allSlotsById.size(), NULL); + s_allSlotsById.resize(allSlotsById.size(), nullptr); beginSlotId = -1; for (std::map::const_iterator iterSlotId = allSlotsById.begin(); iterSlotId != allSlotsById.end(); ++iterSlotId) { @@ -612,7 +612,7 @@ void CollectionsDataTable::install() } else { - s_allSlotsById[iterSlotId->first] = NULL; + s_allSlotsById[iterSlotId->first] = nullptr; } } @@ -733,7 +733,7 @@ CollectionsDataTable::CollectionInfoSlot const * CollectionsDataTable::getSlotBy if (iterFind != s_allSlotsByName.end()) return iterFind->second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -743,7 +743,7 @@ CollectionsDataTable::CollectionInfoSlot const * CollectionsDataTable::getSlotBy CollectionsDataTable::CollectionInfoSlot const * CollectionsDataTable::getSlotByBeginSlotId(int slotId) { if ((slotId < 0) || (slotId >= static_cast(s_allSlotsById.size()))) - return NULL; + return nullptr; return s_allSlotsById[slotId]; } @@ -763,7 +763,7 @@ CollectionsDataTable::CollectionInfoSlot const * CollectionsDataTable::isASlotTi if (iterFind != s_allSlotTitles.end()) return iterFind->second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -796,7 +796,7 @@ CollectionsDataTable::CollectionInfoCollection const * CollectionsDataTable::isA if (iterFind != s_allCollectionTitles.end()) return iterFind->second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -818,7 +818,7 @@ CollectionsDataTable::CollectionInfoCollection const * CollectionsDataTable::get if (iterFind != s_allCollectionsByName.end()) return iterFind->second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -866,7 +866,7 @@ CollectionsDataTable::CollectionInfoPage const * CollectionsDataTable::isAPageTi if (iterFind != s_allPageTitles.end()) return iterFind->second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -879,7 +879,7 @@ CollectionsDataTable::CollectionInfoPage const * CollectionsDataTable::getPageBy if (iterFind != s_allPagesByName.end()) return iterFind->second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -946,7 +946,7 @@ CollectionsDataTable::CollectionInfoBook const * CollectionsDataTable::getBookBy if (iterFind != s_allBooksByName.end()) return iterFind->second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedGame/src/shared/core/CommoditiesAdvancedSearchAttribute.cpp b/engine/shared/library/sharedGame/src/shared/core/CommoditiesAdvancedSearchAttribute.cpp index 585dbd1d..8c896b4f 100755 --- a/engine/shared/library/sharedGame/src/shared/core/CommoditiesAdvancedSearchAttribute.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/CommoditiesAdvancedSearchAttribute.cpp @@ -125,7 +125,7 @@ void CommoditiesAdvancedSearchAttribute::install() { // handle search attribute name alias tokens.clear(); - if (Unicode::tokenize(Unicode::narrowToWide(searchAttributeName), tokens, NULL, NULL) && (tokens.size() > 1)) + if (Unicode::tokenize(Unicode::narrowToWide(searchAttributeName), tokens, nullptr, nullptr) && (tokens.size() > 1)) { // the first value is the search attribute name to display searchAttributeName = Unicode::wideToNarrow(tokens[0]); @@ -177,7 +177,7 @@ void CommoditiesAdvancedSearchAttribute::install() { // for enum, parse out the aliases (if any) for the enum value tokens.clear(); - if (Unicode::tokenize(Unicode::narrowToWide(defaultSearchValue), tokens, NULL, NULL) && !tokens.empty()) + if (Unicode::tokenize(Unicode::narrowToWide(defaultSearchValue), tokens, nullptr, nullptr) && !tokens.empty()) { #ifdef _WIN32 #ifdef _DEBUG @@ -340,7 +340,7 @@ CommoditiesAdvancedSearchAttribute::SearchAttribute const * CommoditiesAdvancedS return iterFindAttribute->second; } - return NULL; + return nullptr; } //---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedGame/src/shared/core/CustomizationManager.cpp b/engine/shared/library/sharedGame/src/shared/core/CustomizationManager.cpp index 051bb14e..77dc02eb 100755 --- a/engine/shared/library/sharedGame/src/shared/core/CustomizationManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/CustomizationManager.cpp @@ -441,7 +441,7 @@ CustomizationVariable * CustomizationManager::findVariable (CustomizationData & if(!ms_installed) { DEBUG_FATAL(true, ("CustomizationManager not installed")); - return NULL; //lint !e527 unreachable (reachable in release) + return nullptr; //lint !e527 unreachable (reachable in release) } PathType type = PT_none; @@ -455,7 +455,7 @@ CustomizationVariable * CustomizationManager::findVariable (CustomizationData & if(!ms_installed) { DEBUG_FATAL(true, ("CustomizationManager not installed")); - return NULL; //lint !e527 unreachable (reachable in release) + return nullptr; //lint !e527 unreachable (reachable in release) } type = PT_none; @@ -467,7 +467,7 @@ CustomizationVariable * CustomizationManager::findVariable (CustomizationData & { //if we have the ranged customization variable is a dependent variable, ignore it (there will be another that controls it) if(rangedCV->getIsDependentVariable()) - cv = NULL; + cv = nullptr; } if (!cv) diff --git a/engine/shared/library/sharedGame/src/shared/core/FormManager.cpp b/engine/shared/library/sharedGame/src/shared/core/FormManager.cpp index 7074ff4c..789c118a 100755 --- a/engine/shared/library/sharedGame/src/shared/core/FormManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/FormManager.cpp @@ -81,10 +81,10 @@ FormManager::Field::Field(Form const * const parent) FormManager::Field::~Field() { delete m_choices; - m_choices = NULL; + m_choices = nullptr; delete m_otherValidationRules; - m_otherValidationRules = NULL; - m_parentForm = NULL; + m_otherValidationRules = nullptr; + m_parentForm = nullptr; } //---------------------------------------------------------------------- @@ -453,12 +453,12 @@ FormManager::Form::~Form() { //this vector does NOT own the pointers delete m_orderedFieldList; - m_orderedFieldList = NULL; + m_orderedFieldList = nullptr; //this list owns the pointers, so release it std::for_each(m_fields->begin(), m_fields->end(), PointerDeleterPairSecond()); delete m_fields; - m_fields = NULL; + m_fields = nullptr; } //---------------------------------------------------------------------- @@ -477,7 +477,7 @@ FormManager::Field const * FormManager::Form::getField(std::string const & field if(i != m_fields->end()) return i->second; else - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -531,13 +531,13 @@ void FormManager::remove () clearData(); delete ms_forms; - ms_forms = NULL; + ms_forms = nullptr; delete ms_serverObjectTemplateToForms; - ms_serverObjectTemplateToForms = NULL; + ms_serverObjectTemplateToForms = nullptr; delete ms_sharedObjectTemplateToForms; - ms_sharedObjectTemplateToForms = NULL; + ms_sharedObjectTemplateToForms = nullptr; delete ms_automaticallyCreateObjectForServerObjectTemplate; - ms_automaticallyCreateObjectForServerObjectTemplate = NULL; + ms_automaticallyCreateObjectForServerObjectTemplate = nullptr; s_tablesLoaded = false; s_installed = false; @@ -764,13 +764,13 @@ FormManager::Form const * FormManager::getFormByName(std::string const & formNam { DEBUG_FATAL (!s_installed, ("not installed")); if(!s_installed) - return NULL; + return nullptr; std::map::iterator i = ms_forms->find(formName); if(i != ms_forms->end()) return i->second; else - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -779,13 +779,13 @@ FormManager::Form const * FormManager::getFormForServerObjectTemplate(std::strin { DEBUG_FATAL (!s_installed, ("not installed")); if(!s_installed) - return NULL; + return nullptr; std::map::iterator i = ms_serverObjectTemplateToForms->find(serverTemplateName); if(i != ms_serverObjectTemplateToForms->end()) return i->second; else - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -794,13 +794,13 @@ FormManager::Form const * FormManager::getFormForSharedObjectTemplate(std::strin { DEBUG_FATAL (!s_installed, ("not installed")); if(!s_installed) - return NULL; + return nullptr; std::map::iterator i = ms_sharedObjectTemplateToForms->find(sharedTemplateName); if(i != ms_sharedObjectTemplateToForms->end()) return i->second; else - return NULL; + return nullptr; } //---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedGame/src/shared/core/GameScheduler.cpp b/engine/shared/library/sharedGame/src/shared/core/GameScheduler.cpp index e0b848ba..9ec51701 100755 --- a/engine/shared/library/sharedGame/src/shared/core/GameScheduler.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/GameScheduler.cpp @@ -74,7 +74,7 @@ void GameScheduler::remove() DEBUG_FATAL(!s_installed, ("GameScheduler not installed.")); delete s_scheduler; - s_scheduler = NULL; + s_scheduler = nullptr; s_installed = false; } diff --git a/engine/shared/library/sharedGame/src/shared/core/GroundZoneManager.cpp b/engine/shared/library/sharedGame/src/shared/core/GroundZoneManager.cpp index bc38d3e0..ddf2992d 100755 --- a/engine/shared/library/sharedGame/src/shared/core/GroundZoneManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/GroundZoneManager.cpp @@ -103,12 +103,12 @@ BuildoutArea const * GroundZoneManager::getZoneName(std::string const & sceneNam if(!SharedBuildoutAreaManager::isBuildoutScene(sceneName)) { - return NULL; + return nullptr; } else { BuildoutArea const * const ba = SharedBuildoutAreaManager::findBuildoutAreaAtPosition(sceneName, location_w.x, location_w.z, true); - if (NULL != ba) + if (nullptr != ba) { if (!ba->compositeName.empty()) zoneName = ba->compositeName; @@ -126,7 +126,7 @@ Vector GroundZoneManager::transformWorldLocationToZoneLocation(std::string const Vector pos_w = location_w; std::string zoneName; BuildoutArea const * const ba = GroundZoneManager::getZoneName(sceneName, location_w, zoneName); - if (NULL != ba) + if (nullptr != ba) { pos_w = ba->getRelativePosition(location_w, true); } diff --git a/engine/shared/library/sharedGame/src/shared/core/GuildRankDataTable.cpp b/engine/shared/library/sharedGame/src/shared/core/GuildRankDataTable.cpp index 2bd66b99..b5f2c62a 100755 --- a/engine/shared/library/sharedGame/src/shared/core/GuildRankDataTable.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/GuildRankDataTable.cpp @@ -65,7 +65,7 @@ void GuildRankDataTable::install() FATAL((columnRankSlotId < 0), ("column \"rankSlotId\" not found in %s", cs_guildRankDataTableName)); FATAL((columnTitle < 0), ("column \"title\" not found in %s", cs_guildRankDataTableName)); - GuildRankDataTable::GuildRank const * currentRank = NULL; + GuildRankDataTable::GuildRank const * currentRank = nullptr; int const numRows = table->getNumRows(); std::string rankName, alternateTitle; @@ -207,7 +207,7 @@ GuildRankDataTable::GuildRank const * GuildRankDataTable::getRank(std::string co if (iterFind != s_allGuildRanksByName.end()) return iterFind->second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -218,7 +218,7 @@ GuildRankDataTable::GuildRank const * GuildRankDataTable::getRankForDisplayRankN if (iterFind != s_allGuildRanksByDisplayName.end()) return iterFind->second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -229,7 +229,7 @@ GuildRankDataTable::GuildRank const * GuildRankDataTable::isARankTitle(std::stri if (iterFind != s_allGuildRanksByTitle.end()) return iterFind->second; - return NULL; + return nullptr; } // ====================================================================== diff --git a/engine/shared/library/sharedGame/src/shared/core/LfgCharacterData.cpp b/engine/shared/library/sharedGame/src/shared/core/LfgCharacterData.cpp index 31a0e655..3f26cadd 100755 --- a/engine/shared/library/sharedGame/src/shared/core/LfgCharacterData.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/LfgCharacterData.cpp @@ -1127,7 +1127,7 @@ std::map const & LfgCharacterData::calculateStatistics(std::ma } } - int32 const timeNow = static_cast(::time(NULL)); + int32 const timeNow = static_cast(::time(nullptr)); for (std::map::const_iterator iterLfgData = connectedCharacterLfgData.begin(); iterLfgData != connectedCharacterLfgData.end(); ++iterLfgData) { // searchable/anonymous diff --git a/engine/shared/library/sharedGame/src/shared/core/LfgDataTable.cpp b/engine/shared/library/sharedGame/src/shared/core/LfgDataTable.cpp index 6acce604..f7cfb688 100755 --- a/engine/shared/library/sharedGame/src/shared/core/LfgDataTable.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/LfgDataTable.cpp @@ -379,10 +379,10 @@ void LfgDataTable::install() unsigned long maxValueForNumBits; std::map names; std::map allSlotsById; - LfgNode * lfgNode = NULL; - LfgNode * currentTier1Node = NULL; - LfgNode * currentTier2Node = NULL; - LfgNode * currentTier3Node = NULL; + LfgNode * lfgNode = nullptr; + LfgNode * currentTier1Node = nullptr; + LfgNode * currentTier2Node = nullptr; + LfgNode * currentTier3Node = nullptr; for (int i = 0; i < numRows; ++i) { @@ -472,15 +472,15 @@ void LfgDataTable::install() FATAL(((minValue > 0) && (maxValueBeginSlotId < 0)), ("%s, row %d: minValueBeginSlotId/minValueEndSlotId/maxValueBeginSlotId/maxValueEndSlotId must be specified if minValue/maxValue is specified", cs_lfgDataTableName, (i+3))); // create a new node - lfgNode = NULL; + lfgNode = nullptr; if (!tier1.empty()) { - lfgNode = new LfgNode(tier1, internalAttribute, minValueBeginSlotId, minValueEndSlotId, maxValueBeginSlotId, maxValueEndSlotId, minValue, maxValue, defaultMatchCondition, NULL); + lfgNode = new LfgNode(tier1, internalAttribute, minValueBeginSlotId, minValueEndSlotId, maxValueBeginSlotId, maxValueEndSlotId, minValue, maxValue, defaultMatchCondition, nullptr); s_topLevelNodes.push_back(lfgNode); currentTier1Node = lfgNode; - currentTier2Node = NULL; - currentTier3Node = NULL; + currentTier2Node = nullptr; + currentTier3Node = nullptr; } else if (!tier2.empty()) { @@ -490,7 +490,7 @@ void LfgDataTable::install() currentTier1Node->children.push_back(lfgNode); currentTier2Node = lfgNode; - currentTier3Node = NULL; + currentTier3Node = nullptr; } else if (!tier3.empty()) { @@ -580,7 +580,7 @@ void LfgDataTable::install() // find out the leaf node's ancestor, if any, that has the Any/All option LfgNode const * parentNode = node.parent; - bool const hasParent = (parentNode != NULL); + bool const hasParent = (parentNode != nullptr); int countParentWithNonNaDefaultMatchCondition = 0; std::string stringParentWithNonNaDefaultMatchCondition; while (parentNode) @@ -670,7 +670,7 @@ LfgDataTable::LfgNode const * LfgDataTable::getLfgNodeByName(std::string const & { std::map::const_iterator iterNode = s_allNodesByName.find(lfgNodeName); if (iterNode == s_allNodesByName.end()) - return NULL; + return nullptr; return iterNode->second; } @@ -681,7 +681,7 @@ LfgDataTable::LfgNode const * LfgDataTable::getLfgLeafNodeByName(std::string con { std::map::const_iterator iterNode = s_allLeafNodesByName.find(lfgNodeName); if (iterNode == s_allLeafNodesByName.end()) - return NULL; + return nullptr; return iterNode->second; } diff --git a/engine/shared/library/sharedGame/src/shared/core/LfgDataTable.h b/engine/shared/library/sharedGame/src/shared/core/LfgDataTable.h index e95f1e85..5ffc3e70 100755 --- a/engine/shared/library/sharedGame/src/shared/core/LfgDataTable.h +++ b/engine/shared/library/sharedGame/src/shared/core/LfgDataTable.h @@ -47,7 +47,7 @@ public: { public: LfgNode(std::string const & pName, bool pInternalAttribute, int pMinValueBeginSlotId, int pMinValueEndSlotId, int pMaxValueBeginSlotId, int pMaxValueEndSlotId, int pMinValue, int pMaxValue, DefaultMatchConditionType pDefaultMatchCondition, LfgNode const * pParent) : - name(pName), internalAttribute(pInternalAttribute), minValueBeginSlotId(pMinValueBeginSlotId), minValueEndSlotId(pMinValueEndSlotId), maxValueBeginSlotId(pMaxValueBeginSlotId), maxValueEndSlotId(pMaxValueEndSlotId), minValue(pMinValue), maxValue(pMaxValue), defaultMatchCondition(pDefaultMatchCondition), actualMatchCondition(DMCT_NA), parent(pParent), anyAllGroupingParent(NULL), children(), hasAnyInternalAttributeLeafNodeDescendants(false), hasAnyExternalAttributeLeafNodeDescendants(false), internalAttributeMatchFunction(NULL) {}; + name(pName), internalAttribute(pInternalAttribute), minValueBeginSlotId(pMinValueBeginSlotId), minValueEndSlotId(pMinValueEndSlotId), maxValueBeginSlotId(pMaxValueBeginSlotId), maxValueEndSlotId(pMaxValueEndSlotId), minValue(pMinValue), maxValue(pMaxValue), defaultMatchCondition(pDefaultMatchCondition), actualMatchCondition(DMCT_NA), parent(pParent), anyAllGroupingParent(nullptr), children(), hasAnyInternalAttributeLeafNodeDescendants(false), hasAnyExternalAttributeLeafNodeDescendants(false), internalAttributeMatchFunction(nullptr) {}; std::string const name; bool const internalAttribute; diff --git a/engine/shared/library/sharedGame/src/shared/core/PlayerCreationManager.cpp b/engine/shared/library/sharedGame/src/shared/core/PlayerCreationManager.cpp index 24efe09a..d089cc2c 100755 --- a/engine/shared/library/sharedGame/src/shared/core/PlayerCreationManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/PlayerCreationManager.cpp @@ -530,9 +530,9 @@ void PlayerCreationManager::buildRacialMinsMaxes() const DataTable * dt = DataTableManager::getTable( "datatables/creation/attribute_limits.iff", true); - WARNING_STRICT_FATAL(dt == NULL, ("Unable to read the " + WARNING_STRICT_FATAL(dt == nullptr, ("Unable to read the " "attribute_limits datatable")); - if (dt == NULL) + if (dt == nullptr) return; int numAttribs = dt->getNumColumns() - 1; diff --git a/engine/shared/library/sharedGame/src/shared/core/SharedBuffBuilderManager.cpp b/engine/shared/library/sharedGame/src/shared/core/SharedBuffBuilderManager.cpp index 40e7ffb8..a9edcafd 100755 --- a/engine/shared/library/sharedGame/src/shared/core/SharedBuffBuilderManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/SharedBuffBuilderManager.cpp @@ -29,7 +29,7 @@ namespace SharedBuffBuilderManagerNamespace const std::string ms_reactiveSecondChanceComponentName = "reactive_second_chance"; } -SharedBuffBuilderManager::BuffBuilderDataType * SharedBuffBuilderManager::ms_buffBuilderData=NULL; +SharedBuffBuilderManager::BuffBuilderDataType * SharedBuffBuilderManager::ms_buffBuilderData=nullptr; using namespace SharedBuffBuilderManagerNamespace; // ====================================================================== diff --git a/engine/shared/library/sharedGame/src/shared/core/SharedBuildoutAreaManager.cpp b/engine/shared/library/sharedGame/src/shared/core/SharedBuildoutAreaManager.cpp index cec5ff33..5786d3e6 100755 --- a/engine/shared/library/sharedGame/src/shared/core/SharedBuildoutAreaManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/SharedBuildoutAreaManager.cpp @@ -321,7 +321,7 @@ std::string SharedBuildoutAreaManager::getBuildoutNameForPosition(std::string co { BuildoutArea const * const ba = findBuildoutAreaAtPosition(sceneName, location_w.x, location_w.z, ignoreInternal, ignoreNonActiveEvents); - if (NULL != ba) + if (nullptr != ba) return sceneName + cms_sceneAndAreaDelimeter + ba->areaName; return sceneName; @@ -537,7 +537,7 @@ SharedBuildoutAreaManager::BuildoutAreaVector const * SharedBuildoutAreaManager: { return &it->second; } - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -546,8 +546,8 @@ BuildoutArea const * SharedBuildoutAreaManager::findBuildoutAreaAtPosition(std:: { BuildoutAreaVector const * const bav = findBuildoutAreasForScene(sceneId); - if (NULL == bav) - return NULL; + if (nullptr == bav) + return nullptr; for (BuildoutAreaVector::const_iterator it = bav->begin(); it != bav->end(); ++it) { @@ -567,7 +567,7 @@ BuildoutArea const * SharedBuildoutAreaManager::findBuildoutAreaAtPosition(std:: } } - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -579,11 +579,11 @@ BuildoutArea const * SharedBuildoutAreaManager::findBuildoutAreaAtPosition(float if (ignoreInternal && buildoutArea.internalBuildoutArea) { - return NULL; + return nullptr; } if(ignoreNonActiveEvents && !buildoutArea.requiredEventName.empty()) - return NULL; + return nullptr; if (buildoutArea.isLocationInside(x, z)) { @@ -591,7 +591,7 @@ BuildoutArea const * SharedBuildoutAreaManager::findBuildoutAreaAtPosition(float } } - return NULL; + return nullptr; } //---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedGame/src/shared/core/SharedImageDesignerManager.cpp b/engine/shared/library/sharedGame/src/shared/core/SharedImageDesignerManager.cpp index 62e46247..c0ee57fa 100755 --- a/engine/shared/library/sharedGame/src/shared/core/SharedImageDesignerManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/SharedImageDesignerManager.cpp @@ -358,7 +358,7 @@ bool SharedImageDesignerManager::isSessionValid(SharedImageDesignerManager::Sess if(customizationDataHair) customizationDataForThisCustomization = customizationDataHair; else - customizationDataForThisCustomization = NULL; + customizationDataForThisCustomization = nullptr; } if(customizationDataForThisCustomization) diff --git a/engine/shared/library/sharedGame/src/shared/core/Universe.cpp b/engine/shared/library/sharedGame/src/shared/core/Universe.cpp index 5d5186d4..60eeba1e 100755 --- a/engine/shared/library/sharedGame/src/shared/core/Universe.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/Universe.cpp @@ -17,14 +17,14 @@ // ====================================================================== -Universe * Universe::ms_theInstance = NULL; +Universe * Universe::ms_theInstance = nullptr; bool Universe::ms_installed = false; //=================================================================== void Universe::installDerived(Universe *derivedInstance) { - DEBUG_FATAL(ms_installed || ms_theInstance!=NULL,("Installed Universe twice.\n")); + DEBUG_FATAL(ms_installed || ms_theInstance!=nullptr,("Installed Universe twice.\n")); ms_theInstance = derivedInstance; ms_installed = true; @@ -43,7 +43,7 @@ void Universe::remove() Universe::Universe() : m_resourceClassNameMap (new ResourceClassNameMap), m_resourceClassNameCrcMap (new ResourceClassNameCrcMap), - m_resourceTreeRoot (NULL) + m_resourceTreeRoot (nullptr) { ResourceClassObject::install(); // sets up some static strings used by the import process } diff --git a/engine/shared/library/sharedGame/src/shared/core/WearableEntry.cpp b/engine/shared/library/sharedGame/src/shared/core/WearableEntry.cpp index 767c20f4..f0c9912a 100755 --- a/engine/shared/library/sharedGame/src/shared/core/WearableEntry.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/WearableEntry.cpp @@ -103,7 +103,7 @@ namespace Archive put(target, source.m_networkId); put(target, source.m_objectTemplate); - bool isWeapon = (source.m_weaponSharedBaselines.get() != NULL); + bool isWeapon = (source.m_weaponSharedBaselines.get() != nullptr); put(target, isWeapon); if (isWeapon) { diff --git a/engine/shared/library/sharedGame/src/shared/mount/MountValidScaleRangeTable.cpp b/engine/shared/library/sharedGame/src/shared/mount/MountValidScaleRangeTable.cpp index 775c8119..4a4139a9 100755 --- a/engine/shared/library/sharedGame/src/shared/mount/MountValidScaleRangeTable.cpp +++ b/engine/shared/library/sharedGame/src/shared/mount/MountValidScaleRangeTable.cpp @@ -248,7 +248,7 @@ void MountValidScaleRangeTableNamespace::loadTableData(char const *filename) TemporaryCrcString const mountableCreatureAppearanceNameCrc(mountableCreatureAppearanceName.c_str(), true); //-- Find or create new MountableCreature instance for this creature name. - MountableCreature *mountableCreature = NULL; + MountableCreature *mountableCreature = nullptr; MountableCreatureTable::iterator lowerBoundIt = s_mountableCreatureTable.lower_bound((const CrcString*)&mountableCreatureAppearanceNameCrc); bool const mountableCreatureEntryExists = ((lowerBoundIt != s_mountableCreatureTable.end()) && !s_mountableCreatureTable.key_comp()(static_cast(&mountableCreatureAppearanceNameCrc), lowerBoundIt->first)); @@ -289,7 +289,7 @@ MountValidScaleRangeTableNamespace::MountableCreature const *MountValidScaleRang else { DEBUG_WARNING(true, ("'datatables/mount/valid_scale_range.iff' missing entry for creature appearance name '%s'", creatureAppearanceName.getString())); - return NULL; + return nullptr; } } diff --git a/engine/shared/library/sharedGame/src/shared/mount/SharedSaddleManager.cpp b/engine/shared/library/sharedGame/src/shared/mount/SharedSaddleManager.cpp index 5c2de639..083ed7c5 100755 --- a/engine/shared/library/sharedGame/src/shared/mount/SharedSaddleManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/mount/SharedSaddleManager.cpp @@ -433,7 +433,7 @@ int SharedSaddleManagerNamespace::TemporaryRiderPoseMapEntry::getRiderSeatIndex( CrcString const *SharedSaddleManagerNamespace::TemporaryRiderPoseMapEntry::getRiderPoseName() const { - return NULL; + return nullptr; } // ====================================================================== diff --git a/engine/shared/library/sharedGame/src/shared/object/ResourceClassObject.cpp b/engine/shared/library/sharedGame/src/shared/object/ResourceClassObject.cpp index 71d3696c..46293784 100755 --- a/engine/shared/library/sharedGame/src/shared/object/ResourceClassObject.cpp +++ b/engine/shared/library/sharedGame/src/shared/object/ResourceClassObject.cpp @@ -39,8 +39,8 @@ using namespace ResourceClassObjectNamespace; ResourceClassObject::ResourceClassObject() : m_resourceClassName(), - m_parentClass(NULL), - m_friendlyName(NULL), + m_parentClass(nullptr), + m_friendlyName(nullptr), m_minTypes(0), m_maxTypes(0), m_minPools(0), @@ -49,7 +49,7 @@ ResourceClassObject::ResourceClassObject() : m_nameTable(), m_recycled(false), m_permanent(false), - m_recycledVersion(NULL), + m_recycledVersion(nullptr), m_resourceAttributeRanges(new ResourceAttributeRangesType()), m_children(new ClassList) { @@ -60,18 +60,18 @@ ResourceClassObject::ResourceClassObject() : ResourceClassObject::~ResourceClassObject() { delete m_children; - m_children = NULL; + m_children = nullptr; delete m_resourceAttributeRanges; - m_resourceAttributeRanges = NULL; + m_resourceAttributeRanges = nullptr; - m_parentClass = NULL; - m_recycledVersion = NULL; + m_parentClass = nullptr; + m_recycledVersion = nullptr; - if (m_friendlyName != NULL) + if (m_friendlyName != nullptr) { delete m_friendlyName; - m_friendlyName = NULL; + m_friendlyName = nullptr; } } @@ -254,7 +254,7 @@ ResourceClassObject::ResourceAttributeRangesType const & ResourceClassObject::ge { static const ResourceAttributeRangesType emptyRanges; - if (m_resourceAttributeRanges != NULL) + if (m_resourceAttributeRanges != nullptr) return *m_resourceAttributeRanges; return emptyRanges; } @@ -304,7 +304,7 @@ void ResourceClassObject::loadTreeFromIff() int numRows = resourceDataTable->getNumRows(); ResourceClassObject * parents[8]; for (int i=0; i<8; ++i) - parents[i]=NULL; + parents[i]=nullptr; static const std::string colName_resourceClassName = "ENUM"; static const std::string colName_maxTypes = "Maximum # types"; @@ -334,7 +334,7 @@ void ResourceClassObject::loadTreeFromIff() if (possibleName.size()!=0) { if (wheresTheName==0) - newClass->m_parentClass = NULL; + newClass->m_parentClass = nullptr; else { newClass->m_parentClass = parents[wheresTheName-1]; @@ -438,12 +438,12 @@ bool ResourceClassObject::isLeaf() const void ResourceClassObject::getChildren(std::vector & children, bool recurse) const { - if (m_children == NULL) + if (m_children == nullptr) return; for (ClassList::const_iterator i = m_children->begin(); i != m_children->end(); ++i) { - if (*i != NULL) + if (*i != nullptr) { children.push_back(*i); if (recurse) @@ -456,12 +456,12 @@ void ResourceClassObject::getChildren(std::vector & void ResourceClassObject::getLeafChildren(std::vector & children) const { - if (m_children == NULL) + if (m_children == nullptr) return; for (ClassList::const_iterator i = m_children->begin(); i != m_children->end(); ++i) { - if (*i != NULL) + if (*i != nullptr) { if ((*i)->isLeaf()) children.push_back(*i); @@ -493,7 +493,7 @@ ResourceClassObject const * ResourceClassObject::getRecycledVersion() const return m_recycledVersion; else if (m_parentClass) return m_parentClass->getRecycledVersion(); - else return NULL; + else return nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedGame/src/shared/object/ResourceClassObject.h b/engine/shared/library/sharedGame/src/shared/object/ResourceClassObject.h index 16de81e8..1361de6e 100755 --- a/engine/shared/library/sharedGame/src/shared/object/ResourceClassObject.h +++ b/engine/shared/library/sharedGame/src/shared/object/ResourceClassObject.h @@ -118,7 +118,7 @@ inline const StringId & ResourceClassObject::getFriendlyName () const inline bool ResourceClassObject::isRoot() const { - return (m_parentClass == NULL); + return (m_parentClass == nullptr); } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedGame/src/shared/object/Waypoint.cpp b/engine/shared/library/sharedGame/src/shared/object/Waypoint.cpp index 08cc4479..74f3f8ba 100755 --- a/engine/shared/library/sharedGame/src/shared/object/Waypoint.cpp +++ b/engine/shared/library/sharedGame/src/shared/object/Waypoint.cpp @@ -160,7 +160,7 @@ WaypointDataBase::WaypointDataBase() : void WaypointDataBase::setName(Unicode::String const &name) { //This magical number (250) is chosen because the waypoint datatable has VARCHAR2(512) in this column, - //and we're assuming 2 bytes per char (which is not quite true actually) plus an extra one for null plus + //and we're assuming 2 bytes per char (which is not quite true actually) plus an extra one for nullptr plus //a few extra for good measure and because nobody needs 251-character waypoint names. if (name.length() > 250) { diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBattlefieldMarkerObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBattlefieldMarkerObjectTemplate.cpp index 9e973c36..a83d8b7f 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBattlefieldMarkerObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBattlefieldMarkerObjectTemplate.cpp @@ -95,10 +95,10 @@ Tag SharedBattlefieldMarkerObjectTemplate::getTemplateVersion(void) const */ Tag SharedBattlefieldMarkerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedBattlefieldMarkerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedBattlefieldMarkerObjectTemplate::getHighestTemplateVersion @@ -112,26 +112,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedBattlefieldMarkerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedBattlefieldMarkerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getNumberOfPoles(true); #endif } if (!m_numberOfPoles.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter numberOfPoles in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter numberOfPoles has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter numberOfPoles has not been defined in template %s!", DataResource::getName())); return base->getNumberOfPoles(); } } @@ -141,9 +141,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getNumberOfPoles(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -160,7 +160,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -176,26 +176,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedBattlefieldMarkerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedBattlefieldMarkerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getNumberOfPolesMin(true); #endif } if (!m_numberOfPoles.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter numberOfPoles in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter numberOfPoles has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter numberOfPoles has not been defined in template %s!", DataResource::getName())); return base->getNumberOfPolesMin(); } } @@ -205,9 +205,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getNumberOfPolesMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -224,7 +224,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -240,26 +240,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedBattlefieldMarkerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedBattlefieldMarkerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getNumberOfPolesMax(true); #endif } if (!m_numberOfPoles.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter numberOfPoles in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter numberOfPoles has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter numberOfPoles has not been defined in template %s!", DataResource::getName())); return base->getNumberOfPolesMax(); } } @@ -269,9 +269,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getNumberOfPolesMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -288,7 +288,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -304,26 +304,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedBattlefieldMarkerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedBattlefieldMarkerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getRadius(true); #endif } if (!m_radius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter radius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter radius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter radius has not been defined in template %s!", DataResource::getName())); return base->getRadius(); } } @@ -333,9 +333,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getRadius(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -352,7 +352,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -368,26 +368,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedBattlefieldMarkerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedBattlefieldMarkerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getRadiusMin(true); #endif } if (!m_radius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter radius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter radius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter radius has not been defined in template %s!", DataResource::getName())); return base->getRadiusMin(); } } @@ -397,9 +397,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getRadiusMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -416,7 +416,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -432,26 +432,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedBattlefieldMarkerObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedBattlefieldMarkerObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getRadiusMax(true); #endif } if (!m_radius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter radius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter radius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter radius has not been defined in template %s!", DataResource::getName())); return base->getRadiusMax(); } } @@ -461,9 +461,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getRadiusMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -480,7 +480,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -529,12 +529,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBuildingObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBuildingObjectTemplate.cpp index 793143b0..89b64952 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBuildingObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBuildingObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedBuildingObjectTemplate::getTemplateVersion(void) const */ Tag SharedBuildingObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedBuildingObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedBuildingObjectTemplate::getHighestTemplateVersion @@ -111,33 +111,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedBuildingObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedBuildingObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTerrainModificationFileName(true); #endif } if (!m_terrainModificationFileName.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter terrainModificationFileName in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter terrainModificationFileName has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter terrainModificationFileName has not been defined in template %s!", DataResource::getName())); return base->getTerrainModificationFileName(); } } const std::string & value = m_terrainModificationFileName.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -153,33 +153,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedBuildingObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedBuildingObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getInteriorLayoutFileName(true); #endif } if (!m_interiorLayoutFileName.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter interiorLayoutFileName in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter interiorLayoutFileName has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter interiorLayoutFileName has not been defined in template %s!", DataResource::getName())); return base->getInteriorLayoutFileName(); } } const std::string & value = m_interiorLayoutFileName.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -226,12 +226,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCellObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCellObjectTemplate.cpp index 1cdcca72..0c319760 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCellObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCellObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedCellObjectTemplate::getTemplateVersion(void) const */ Tag SharedCellObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedCellObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedCellObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedConstructionContractObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedConstructionContractObjectTemplate.cpp index ba6ece47..ab455e20 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedConstructionContractObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedConstructionContractObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedConstructionContractObjectTemplate::getTemplateVersion(void) const */ Tag SharedConstructionContractObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedConstructionContractObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedConstructionContractObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCreatureObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCreatureObjectTemplate.cpp index 5254f31c..6c5c3db1 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCreatureObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCreatureObjectTemplate.cpp @@ -104,10 +104,10 @@ Tag SharedCreatureObjectTemplate::getTemplateVersion(void) const */ Tag SharedCreatureObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedCreatureObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedCreatureObjectTemplate::getHighestTemplateVersion @@ -175,33 +175,33 @@ SharedCreatureObjectTemplate::Gender testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getGender(true); #endif } if (!m_gender.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter gender in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter gender has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter gender has not been defined in template %s!", DataResource::getName())); return base->getGender(); } } Gender value = static_cast(m_gender.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -217,33 +217,33 @@ SharedCreatureObjectTemplate::Niche testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getNiche(true); #endif } if (!m_niche.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter niche in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter niche has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter niche has not been defined in template %s!", DataResource::getName())); return base->getNiche(); } } Niche value = static_cast(m_niche.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -259,33 +259,33 @@ SharedCreatureObjectTemplate::Species testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSpecies(true); #endif } if (!m_species.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter species in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter species has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter species has not been defined in template %s!", DataResource::getName())); return base->getSpecies(); } } Species value = static_cast(m_species.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -301,33 +301,33 @@ SharedCreatureObjectTemplate::Race testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getRace(true); #endif } if (!m_race.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter race in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter race has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter race has not been defined in template %s!", DataResource::getName())); return base->getRace(); } } Race value = static_cast(m_race.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -337,8 +337,8 @@ UNREF(testData); float SharedCreatureObjectTemplate::getAcceleration(MovementTypes index) const { - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -346,14 +346,14 @@ float SharedCreatureObjectTemplate::getAcceleration(MovementTypes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 2, ("template param index out of range")); if (!m_acceleration[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter acceleration in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter acceleration has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter acceleration has not been defined in template %s!", DataResource::getName())); return base->getAcceleration(index); } } @@ -363,9 +363,9 @@ float SharedCreatureObjectTemplate::getAcceleration(MovementTypes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAcceleration(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -386,8 +386,8 @@ float SharedCreatureObjectTemplate::getAcceleration(MovementTypes index) const float SharedCreatureObjectTemplate::getAccelerationMin(MovementTypes index) const { - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -395,14 +395,14 @@ float SharedCreatureObjectTemplate::getAccelerationMin(MovementTypes index) cons DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 2, ("template param index out of range")); if (!m_acceleration[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter acceleration in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter acceleration has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter acceleration has not been defined in template %s!", DataResource::getName())); return base->getAccelerationMin(index); } } @@ -412,9 +412,9 @@ float SharedCreatureObjectTemplate::getAccelerationMin(MovementTypes index) cons if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAccelerationMin(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -435,8 +435,8 @@ float SharedCreatureObjectTemplate::getAccelerationMin(MovementTypes index) cons float SharedCreatureObjectTemplate::getAccelerationMax(MovementTypes index) const { - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -444,14 +444,14 @@ float SharedCreatureObjectTemplate::getAccelerationMax(MovementTypes index) cons DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 2, ("template param index out of range")); if (!m_acceleration[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter acceleration in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter acceleration has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter acceleration has not been defined in template %s!", DataResource::getName())); return base->getAccelerationMax(index); } } @@ -461,9 +461,9 @@ float SharedCreatureObjectTemplate::getAccelerationMax(MovementTypes index) cons if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAccelerationMax(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -484,8 +484,8 @@ float SharedCreatureObjectTemplate::getAccelerationMax(MovementTypes index) cons float SharedCreatureObjectTemplate::getSpeed(MovementTypes index) const { - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -493,14 +493,14 @@ float SharedCreatureObjectTemplate::getSpeed(MovementTypes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 2, ("template param index out of range")); if (!m_speed[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter speed in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter speed has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter speed has not been defined in template %s!", DataResource::getName())); return base->getSpeed(index); } } @@ -510,9 +510,9 @@ float SharedCreatureObjectTemplate::getSpeed(MovementTypes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSpeed(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -533,8 +533,8 @@ float SharedCreatureObjectTemplate::getSpeed(MovementTypes index) const float SharedCreatureObjectTemplate::getSpeedMin(MovementTypes index) const { - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -542,14 +542,14 @@ float SharedCreatureObjectTemplate::getSpeedMin(MovementTypes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 2, ("template param index out of range")); if (!m_speed[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter speed in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter speed has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter speed has not been defined in template %s!", DataResource::getName())); return base->getSpeedMin(index); } } @@ -559,9 +559,9 @@ float SharedCreatureObjectTemplate::getSpeedMin(MovementTypes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSpeedMin(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -582,8 +582,8 @@ float SharedCreatureObjectTemplate::getSpeedMin(MovementTypes index) const float SharedCreatureObjectTemplate::getSpeedMax(MovementTypes index) const { - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -591,14 +591,14 @@ float SharedCreatureObjectTemplate::getSpeedMax(MovementTypes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 2, ("template param index out of range")); if (!m_speed[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter speed in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter speed has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter speed has not been defined in template %s!", DataResource::getName())); return base->getSpeedMax(index); } } @@ -608,9 +608,9 @@ float SharedCreatureObjectTemplate::getSpeedMax(MovementTypes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSpeedMax(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -631,8 +631,8 @@ float SharedCreatureObjectTemplate::getSpeedMax(MovementTypes index) const float SharedCreatureObjectTemplate::getTurnRate(MovementTypes index) const { - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -640,14 +640,14 @@ float SharedCreatureObjectTemplate::getTurnRate(MovementTypes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 2, ("template param index out of range")); if (!m_turnRate[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter turnRate in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter turnRate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter turnRate has not been defined in template %s!", DataResource::getName())); return base->getTurnRate(index); } } @@ -657,9 +657,9 @@ float SharedCreatureObjectTemplate::getTurnRate(MovementTypes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTurnRate(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -680,8 +680,8 @@ float SharedCreatureObjectTemplate::getTurnRate(MovementTypes index) const float SharedCreatureObjectTemplate::getTurnRateMin(MovementTypes index) const { - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -689,14 +689,14 @@ float SharedCreatureObjectTemplate::getTurnRateMin(MovementTypes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 2, ("template param index out of range")); if (!m_turnRate[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter turnRate in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter turnRate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter turnRate has not been defined in template %s!", DataResource::getName())); return base->getTurnRateMin(index); } } @@ -706,9 +706,9 @@ float SharedCreatureObjectTemplate::getTurnRateMin(MovementTypes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTurnRateMin(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -729,8 +729,8 @@ float SharedCreatureObjectTemplate::getTurnRateMin(MovementTypes index) const float SharedCreatureObjectTemplate::getTurnRateMax(MovementTypes index) const { - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -738,14 +738,14 @@ float SharedCreatureObjectTemplate::getTurnRateMax(MovementTypes index) const DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 2, ("template param index out of range")); if (!m_turnRate[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter turnRate in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter turnRate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter turnRate has not been defined in template %s!", DataResource::getName())); return base->getTurnRateMax(index); } } @@ -755,9 +755,9 @@ float SharedCreatureObjectTemplate::getTurnRateMax(MovementTypes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTurnRateMax(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -784,33 +784,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAnimationMapFilename(true); #endif } if (!m_animationMapFilename.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter animationMapFilename in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter animationMapFilename has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter animationMapFilename has not been defined in template %s!", DataResource::getName())); return base->getAnimationMapFilename(); } } const std::string & value = m_animationMapFilename.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -826,26 +826,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSlopeModAngle(true); #endif } if (!m_slopeModAngle.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slopeModAngle in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slopeModAngle has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slopeModAngle has not been defined in template %s!", DataResource::getName())); return base->getSlopeModAngle(); } } @@ -855,9 +855,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSlopeModAngle(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -874,7 +874,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -890,26 +890,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSlopeModAngleMin(true); #endif } if (!m_slopeModAngle.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slopeModAngle in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slopeModAngle has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slopeModAngle has not been defined in template %s!", DataResource::getName())); return base->getSlopeModAngleMin(); } } @@ -919,9 +919,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSlopeModAngleMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -938,7 +938,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -954,26 +954,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSlopeModAngleMax(true); #endif } if (!m_slopeModAngle.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slopeModAngle in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slopeModAngle has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slopeModAngle has not been defined in template %s!", DataResource::getName())); return base->getSlopeModAngleMax(); } } @@ -983,9 +983,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSlopeModAngleMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1002,7 +1002,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1018,26 +1018,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSlopeModPercent(true); #endif } if (!m_slopeModPercent.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slopeModPercent in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slopeModPercent has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slopeModPercent has not been defined in template %s!", DataResource::getName())); return base->getSlopeModPercent(); } } @@ -1047,9 +1047,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSlopeModPercent(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1066,7 +1066,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1082,26 +1082,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSlopeModPercentMin(true); #endif } if (!m_slopeModPercent.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slopeModPercent in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slopeModPercent has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slopeModPercent has not been defined in template %s!", DataResource::getName())); return base->getSlopeModPercentMin(); } } @@ -1111,9 +1111,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSlopeModPercentMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1130,7 +1130,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1146,26 +1146,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSlopeModPercentMax(true); #endif } if (!m_slopeModPercent.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slopeModPercent in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slopeModPercent has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slopeModPercent has not been defined in template %s!", DataResource::getName())); return base->getSlopeModPercentMax(); } } @@ -1175,9 +1175,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSlopeModPercentMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1194,7 +1194,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1210,26 +1210,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getWaterModPercent(true); #endif } if (!m_waterModPercent.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter waterModPercent in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter waterModPercent has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter waterModPercent has not been defined in template %s!", DataResource::getName())); return base->getWaterModPercent(); } } @@ -1239,9 +1239,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getWaterModPercent(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1258,7 +1258,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1274,26 +1274,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getWaterModPercentMin(true); #endif } if (!m_waterModPercent.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter waterModPercent in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter waterModPercent has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter waterModPercent has not been defined in template %s!", DataResource::getName())); return base->getWaterModPercentMin(); } } @@ -1303,9 +1303,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getWaterModPercentMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1322,7 +1322,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1338,26 +1338,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getWaterModPercentMax(true); #endif } if (!m_waterModPercent.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter waterModPercent in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter waterModPercent has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter waterModPercent has not been defined in template %s!", DataResource::getName())); return base->getWaterModPercentMax(); } } @@ -1367,9 +1367,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getWaterModPercentMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1386,7 +1386,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1402,26 +1402,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getStepHeight(true); #endif } if (!m_stepHeight.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter stepHeight in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter stepHeight has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter stepHeight has not been defined in template %s!", DataResource::getName())); return base->getStepHeight(); } } @@ -1431,9 +1431,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getStepHeight(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1450,7 +1450,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1466,26 +1466,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getStepHeightMin(true); #endif } if (!m_stepHeight.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter stepHeight in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter stepHeight has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter stepHeight has not been defined in template %s!", DataResource::getName())); return base->getStepHeightMin(); } } @@ -1495,9 +1495,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getStepHeightMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1514,7 +1514,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1530,26 +1530,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getStepHeightMax(true); #endif } if (!m_stepHeight.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter stepHeight in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter stepHeight has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter stepHeight has not been defined in template %s!", DataResource::getName())); return base->getStepHeightMax(); } } @@ -1559,9 +1559,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getStepHeightMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1578,7 +1578,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1594,26 +1594,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCollisionHeight(true); #endif } if (!m_collisionHeight.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionHeight in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter collisionHeight has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter collisionHeight has not been defined in template %s!", DataResource::getName())); return base->getCollisionHeight(); } } @@ -1623,9 +1623,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCollisionHeight(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1642,7 +1642,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1658,26 +1658,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCollisionHeightMin(true); #endif } if (!m_collisionHeight.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionHeight in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter collisionHeight has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter collisionHeight has not been defined in template %s!", DataResource::getName())); return base->getCollisionHeightMin(); } } @@ -1687,9 +1687,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCollisionHeightMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1706,7 +1706,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1722,26 +1722,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCollisionHeightMax(true); #endif } if (!m_collisionHeight.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionHeight in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter collisionHeight has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter collisionHeight has not been defined in template %s!", DataResource::getName())); return base->getCollisionHeightMax(); } } @@ -1751,9 +1751,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCollisionHeightMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1770,7 +1770,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1786,26 +1786,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCollisionRadius(true); #endif } if (!m_collisionRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter collisionRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter collisionRadius has not been defined in template %s!", DataResource::getName())); return base->getCollisionRadius(); } } @@ -1815,9 +1815,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCollisionRadius(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1834,7 +1834,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1850,26 +1850,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCollisionRadiusMin(true); #endif } if (!m_collisionRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter collisionRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter collisionRadius has not been defined in template %s!", DataResource::getName())); return base->getCollisionRadiusMin(); } } @@ -1879,9 +1879,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCollisionRadiusMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1898,7 +1898,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1914,26 +1914,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCollisionRadiusMax(true); #endif } if (!m_collisionRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter collisionRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter collisionRadius has not been defined in template %s!", DataResource::getName())); return base->getCollisionRadiusMax(); } } @@ -1943,9 +1943,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCollisionRadiusMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1962,7 +1962,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1978,33 +1978,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMovementDatatable(true); #endif } if (!m_movementDatatable.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter movementDatatable in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter movementDatatable has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter movementDatatable has not been defined in template %s!", DataResource::getName())); return base->getMovementDatatable(); } } const std::string & value = m_movementDatatable.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2014,8 +2014,8 @@ UNREF(testData); bool SharedCreatureObjectTemplate::getPostureAlignToTerrain(Postures index) const { - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -2023,14 +2023,14 @@ bool SharedCreatureObjectTemplate::getPostureAlignToTerrain(Postures index) cons DEBUG_FATAL(index < 0 || index >= 15, ("template param index out of range")); if (!m_postureAlignToTerrain[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter postureAlignToTerrain in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter postureAlignToTerrain has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter postureAlignToTerrain has not been defined in template %s!", DataResource::getName())); return base->getPostureAlignToTerrain(index); } } @@ -2047,26 +2047,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSwimHeight(true); #endif } if (!m_swimHeight.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter swimHeight in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter swimHeight has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter swimHeight has not been defined in template %s!", DataResource::getName())); return base->getSwimHeight(); } } @@ -2076,9 +2076,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSwimHeight(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2095,7 +2095,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2111,26 +2111,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSwimHeightMin(true); #endif } if (!m_swimHeight.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter swimHeight in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter swimHeight has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter swimHeight has not been defined in template %s!", DataResource::getName())); return base->getSwimHeightMin(); } } @@ -2140,9 +2140,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSwimHeightMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2159,7 +2159,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2175,26 +2175,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSwimHeightMax(true); #endif } if (!m_swimHeight.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter swimHeight in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter swimHeight has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter swimHeight has not been defined in template %s!", DataResource::getName())); return base->getSwimHeightMax(); } } @@ -2204,9 +2204,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSwimHeightMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2223,7 +2223,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2239,26 +2239,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getWarpTolerance(true); #endif } if (!m_warpTolerance.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter warpTolerance in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter warpTolerance has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter warpTolerance has not been defined in template %s!", DataResource::getName())); return base->getWarpTolerance(); } } @@ -2268,9 +2268,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getWarpTolerance(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2287,7 +2287,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2303,26 +2303,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getWarpToleranceMin(true); #endif } if (!m_warpTolerance.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter warpTolerance in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter warpTolerance has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter warpTolerance has not been defined in template %s!", DataResource::getName())); return base->getWarpToleranceMin(); } } @@ -2332,9 +2332,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getWarpToleranceMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2351,7 +2351,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2367,26 +2367,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getWarpToleranceMax(true); #endif } if (!m_warpTolerance.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter warpTolerance in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter warpTolerance has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter warpTolerance has not been defined in template %s!", DataResource::getName())); return base->getWarpToleranceMax(); } } @@ -2396,9 +2396,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getWarpToleranceMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2415,7 +2415,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2431,26 +2431,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCollisionOffsetX(true); #endif } if (!m_collisionOffsetX.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionOffsetX in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter collisionOffsetX has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter collisionOffsetX has not been defined in template %s!", DataResource::getName())); return base->getCollisionOffsetX(); } } @@ -2460,9 +2460,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCollisionOffsetX(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2479,7 +2479,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2495,26 +2495,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCollisionOffsetXMin(true); #endif } if (!m_collisionOffsetX.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionOffsetX in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter collisionOffsetX has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter collisionOffsetX has not been defined in template %s!", DataResource::getName())); return base->getCollisionOffsetXMin(); } } @@ -2524,9 +2524,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCollisionOffsetXMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2543,7 +2543,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2559,26 +2559,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCollisionOffsetXMax(true); #endif } if (!m_collisionOffsetX.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionOffsetX in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter collisionOffsetX has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter collisionOffsetX has not been defined in template %s!", DataResource::getName())); return base->getCollisionOffsetXMax(); } } @@ -2588,9 +2588,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCollisionOffsetXMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2607,7 +2607,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2623,26 +2623,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCollisionOffsetZ(true); #endif } if (!m_collisionOffsetZ.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionOffsetZ in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter collisionOffsetZ has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter collisionOffsetZ has not been defined in template %s!", DataResource::getName())); return base->getCollisionOffsetZ(); } } @@ -2652,9 +2652,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCollisionOffsetZ(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2671,7 +2671,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2687,26 +2687,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCollisionOffsetZMin(true); #endif } if (!m_collisionOffsetZ.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionOffsetZ in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter collisionOffsetZ has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter collisionOffsetZ has not been defined in template %s!", DataResource::getName())); return base->getCollisionOffsetZMin(); } } @@ -2716,9 +2716,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCollisionOffsetZMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2735,7 +2735,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2751,26 +2751,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCollisionOffsetZMax(true); #endif } if (!m_collisionOffsetZ.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionOffsetZ in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter collisionOffsetZ has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter collisionOffsetZ has not been defined in template %s!", DataResource::getName())); return base->getCollisionOffsetZMax(); } } @@ -2780,9 +2780,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCollisionOffsetZMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2799,7 +2799,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2815,26 +2815,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCollisionLength(true); #endif } if (!m_collisionLength.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionLength in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter collisionLength has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter collisionLength has not been defined in template %s!", DataResource::getName())); return base->getCollisionLength(); } } @@ -2844,9 +2844,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCollisionLength(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2863,7 +2863,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2879,26 +2879,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCollisionLengthMin(true); #endif } if (!m_collisionLength.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionLength in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter collisionLength has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter collisionLength has not been defined in template %s!", DataResource::getName())); return base->getCollisionLengthMin(); } } @@ -2908,9 +2908,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCollisionLengthMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2927,7 +2927,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2943,26 +2943,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCollisionLengthMax(true); #endif } if (!m_collisionLength.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter collisionLength in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter collisionLength has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter collisionLength has not been defined in template %s!", DataResource::getName())); return base->getCollisionLengthMax(); } } @@ -2972,9 +2972,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCollisionLengthMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2991,7 +2991,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3007,26 +3007,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCameraHeight(true); #endif } if (!m_cameraHeight.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter cameraHeight in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter cameraHeight has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter cameraHeight has not been defined in template %s!", DataResource::getName())); return base->getCameraHeight(); } } @@ -3036,9 +3036,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCameraHeight(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3055,7 +3055,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3071,26 +3071,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCameraHeightMin(true); #endif } if (!m_cameraHeight.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter cameraHeight in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter cameraHeight has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter cameraHeight has not been defined in template %s!", DataResource::getName())); return base->getCameraHeightMin(); } } @@ -3100,9 +3100,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCameraHeightMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3119,7 +3119,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3135,26 +3135,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedCreatureObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedCreatureObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCameraHeightMax(true); #endif } if (!m_cameraHeight.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter cameraHeight in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter cameraHeight has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter cameraHeight has not been defined in template %s!", DataResource::getName())); return base->getCameraHeightMax(); } } @@ -3164,9 +3164,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCameraHeightMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -3183,7 +3183,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -3258,12 +3258,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedDraftSchematicObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedDraftSchematicObjectTemplate.cpp index fe3956f4..961cebca 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedDraftSchematicObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedDraftSchematicObjectTemplate.cpp @@ -55,7 +55,7 @@ SharedDraftSchematicObjectTemplate::~SharedDraftSchematicObjectTemplate() for (iter = m_slots.begin(); iter != m_slots.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_slots.clear(); } @@ -64,7 +64,7 @@ SharedDraftSchematicObjectTemplate::~SharedDraftSchematicObjectTemplate() for (iter = m_attributes.begin(); iter != m_attributes.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_attributes.clear(); } @@ -116,10 +116,10 @@ Tag SharedDraftSchematicObjectTemplate::getTemplateVersion(void) const */ Tag SharedDraftSchematicObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedDraftSchematicObjectTemplate::getHighestTemplateVersion @@ -127,28 +127,28 @@ Tag SharedDraftSchematicObjectTemplate::getHighestTemplateVersion(void) const //@BEGIN TFD void SharedDraftSchematicObjectTemplate::getSlots(IngredientSlot &data, int index) const { - const SharedDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_slotsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slots in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slots has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slots has not been defined in template %s!", DataResource::getName())); base->getSlots(data, index); return; } } - if (m_slotsAppend && base != NULL) + if (m_slotsAppend && base != nullptr) { int baseCount = base->getSlotsCount(); if (index < baseCount) @@ -170,28 +170,28 @@ void SharedDraftSchematicObjectTemplate::getSlots(IngredientSlot &data, int inde void SharedDraftSchematicObjectTemplate::getSlotsMin(IngredientSlot &data, int index) const { - const SharedDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_slotsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slots in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slots has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slots has not been defined in template %s!", DataResource::getName())); base->getSlotsMin(data, index); return; } } - if (m_slotsAppend && base != NULL) + if (m_slotsAppend && base != nullptr) { int baseCount = base->getSlotsCount(); if (index < baseCount) @@ -213,28 +213,28 @@ void SharedDraftSchematicObjectTemplate::getSlotsMin(IngredientSlot &data, int i void SharedDraftSchematicObjectTemplate::getSlotsMax(IngredientSlot &data, int index) const { - const SharedDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_slotsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slots in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slots has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slots has not been defined in template %s!", DataResource::getName())); base->getSlotsMax(data, index); return; } } - if (m_slotsAppend && base != NULL) + if (m_slotsAppend && base != nullptr) { int baseCount = base->getSlotsCount(); if (index < baseCount) @@ -258,20 +258,20 @@ size_t SharedDraftSchematicObjectTemplate::getSlotsCount(void) const { if (!m_slotsLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const SharedDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getSlotsCount(); } size_t count = m_slots.size(); // if we are extending our base template, add it's count - if (m_slotsAppend && m_baseData != NULL) + if (m_slotsAppend && m_baseData != nullptr) { const SharedDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getSlotsCount(); } @@ -280,28 +280,28 @@ size_t SharedDraftSchematicObjectTemplate::getSlotsCount(void) const void SharedDraftSchematicObjectTemplate::getAttributes(SchematicAttribute &data, int index) const { - const SharedDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_attributesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attributes in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter attributes has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attributes has not been defined in template %s!", DataResource::getName())); base->getAttributes(data, index); return; } } - if (m_attributesAppend && base != NULL) + if (m_attributesAppend && base != nullptr) { int baseCount = base->getAttributesCount(); if (index < baseCount) @@ -324,28 +324,28 @@ void SharedDraftSchematicObjectTemplate::getAttributes(SchematicAttribute &data, void SharedDraftSchematicObjectTemplate::getAttributesMin(SchematicAttribute &data, int index) const { - const SharedDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_attributesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attributes in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter attributes has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attributes has not been defined in template %s!", DataResource::getName())); base->getAttributesMin(data, index); return; } } - if (m_attributesAppend && base != NULL) + if (m_attributesAppend && base != nullptr) { int baseCount = base->getAttributesCount(); if (index < baseCount) @@ -368,28 +368,28 @@ void SharedDraftSchematicObjectTemplate::getAttributesMin(SchematicAttribute &da void SharedDraftSchematicObjectTemplate::getAttributesMax(SchematicAttribute &data, int index) const { - const SharedDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_attributesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attributes in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter attributes has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attributes has not been defined in template %s!", DataResource::getName())); base->getAttributesMax(data, index); return; } } - if (m_attributesAppend && base != NULL) + if (m_attributesAppend && base != nullptr) { int baseCount = base->getAttributesCount(); if (index < baseCount) @@ -414,20 +414,20 @@ size_t SharedDraftSchematicObjectTemplate::getAttributesCount(void) const { if (!m_attributesLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const SharedDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getAttributesCount(); } size_t count = m_attributes.size(); // if we are extending our base template, add it's count - if (m_attributesAppend && m_baseData != NULL) + if (m_attributesAppend && m_baseData != nullptr) { const SharedDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getAttributesCount(); } @@ -442,33 +442,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedDraftSchematicObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedDraftSchematicObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCraftedSharedTemplate(true); #endif } if (!m_craftedSharedTemplate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter craftedSharedTemplate in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter craftedSharedTemplate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter craftedSharedTemplate has not been defined in template %s!", DataResource::getName())); return base->getCraftedSharedTemplate(); } } const std::string & value = m_craftedSharedTemplate.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -514,12 +514,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -548,7 +548,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_slots.begin(); iter != m_slots.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_slots.clear(); m_slotsAppend = file.read_bool8(); @@ -567,7 +567,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_attributes.begin(); iter != m_attributes.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_attributes.clear(); m_attributesAppend = file.read_bool8(); @@ -646,33 +646,33 @@ StringId testDataValue = DefaultStringId; UNREF(testData); #endif - const SharedDraftSchematicObjectTemplate::_IngredientSlot * base = NULL; - if (m_baseData != NULL) + const SharedDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getName(true); #endif } if (!m_name.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter name in template %s", DataResource::getName())); return DefaultStringId; } else { - DEBUG_FATAL(base == NULL, ("Template parameter name has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter name has not been defined in template %s!", DataResource::getName())); return base->getName(versionOk); } } const StringId value = m_name.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -688,33 +688,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedDraftSchematicObjectTemplate::_IngredientSlot * base = NULL; - if (m_baseData != NULL) + const SharedDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getHardpoint(true); #endif } if (!m_hardpoint.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter hardpoint in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter hardpoint has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter hardpoint has not been defined in template %s!", DataResource::getName())); return base->getHardpoint(versionOk); } } const std::string & value = m_hardpoint.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -819,33 +819,33 @@ StringId testDataValue = DefaultStringId; UNREF(testData); #endif - const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = NULL; - if (m_baseData != NULL) + const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getName(true); #endif } if (!m_name.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter name in template %s", DataResource::getName())); return DefaultStringId; } else { - DEBUG_FATAL(base == NULL, ("Template parameter name has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter name has not been defined in template %s!", DataResource::getName())); return base->getName(versionOk); } } const StringId value = m_name.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -861,33 +861,33 @@ StringId testDataValue = DefaultStringId; UNREF(testData); #endif - const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = NULL; - if (m_baseData != NULL) + const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getExperiment(true); #endif } if (!m_experiment.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter experiment in template %s", DataResource::getName())); return DefaultStringId; } else { - DEBUG_FATAL(base == NULL, ("Template parameter experiment has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter experiment has not been defined in template %s!", DataResource::getName())); return base->getExperiment(versionOk); } } const StringId value = m_experiment.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -903,26 +903,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = NULL; - if (m_baseData != NULL) + const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getValue(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValue(versionOk); } } @@ -932,9 +932,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getValue(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -951,7 +951,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -967,26 +967,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = NULL; - if (m_baseData != NULL) + const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getValueMin(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValueMin(versionOk); } } @@ -996,9 +996,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getValueMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1015,7 +1015,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1031,26 +1031,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = NULL; - if (m_baseData != NULL) + const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getValueMax(true); #endif } if (!m_value.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter value in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter value has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter value has not been defined in template %s!", DataResource::getName())); return base->getValueMax(versionOk); } } @@ -1060,9 +1060,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getValueMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1079,7 +1079,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedFactoryObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedFactoryObjectTemplate.cpp index 5a07a293..4a7e73fa 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedFactoryObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedFactoryObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedFactoryObjectTemplate::getTemplateVersion(void) const */ Tag SharedFactoryObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedFactoryObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedFactoryObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGroupObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGroupObjectTemplate.cpp index 1c30083d..d3c1d6d0 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGroupObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGroupObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedGroupObjectTemplate::getTemplateVersion(void) const */ Tag SharedGroupObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedGroupObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedGroupObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGuildObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGuildObjectTemplate.cpp index 4243b93c..e57241db 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGuildObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGuildObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedGuildObjectTemplate::getTemplateVersion(void) const */ Tag SharedGuildObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedGuildObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedGuildObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedInstallationObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedInstallationObjectTemplate.cpp index 08158117..5e66bbf1 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedInstallationObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedInstallationObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedInstallationObjectTemplate::getTemplateVersion(void) const */ Tag SharedInstallationObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedInstallationObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedInstallationObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedIntangibleObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedIntangibleObjectTemplate.cpp index 0e9edb7c..4934dd40 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedIntangibleObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedIntangibleObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedIntangibleObjectTemplate::getTemplateVersion(void) const */ Tag SharedIntangibleObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedIntangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedIntangibleObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedJediManagerObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedJediManagerObjectTemplate.cpp index c4840885..3c8ad274 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedJediManagerObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedJediManagerObjectTemplate.cpp @@ -95,10 +95,10 @@ Tag SharedJediManagerObjectTemplate::getTemplateVersion(void) const */ Tag SharedJediManagerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedJediManagerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedJediManagerObjectTemplate::getHighestTemplateVersion @@ -141,12 +141,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedManufactureSchematicObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedManufactureSchematicObjectTemplate.cpp index 8b5e0965..de9c8b4d 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedManufactureSchematicObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedManufactureSchematicObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedManufactureSchematicObjectTemplate::getTemplateVersion(void) const */ Tag SharedManufactureSchematicObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedManufactureSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedManufactureSchematicObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedMissionObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedMissionObjectTemplate.cpp index b2745f8e..10eaba74 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedMissionObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedMissionObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedMissionObjectTemplate::getTemplateVersion(void) const */ Tag SharedMissionObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedMissionObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedMissionObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedObjectTemplate.cpp index 034adea5..dc0fe57a 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedObjectTemplate.cpp @@ -109,8 +109,8 @@ SharedObjectTemplate::SharedObjectTemplate(const std::string & filename) : ObjectTemplate(filename) ,m_versionOk(true) //@END TFD INIT - , m_slotDescriptor(NULL) - , m_arrangementDescriptor(NULL) + , m_slotDescriptor(nullptr) + , m_arrangementDescriptor(nullptr) , m_clientData (0) , m_preloadManager (0) { @@ -232,10 +232,10 @@ Tag SharedObjectTemplate::getTemplateVersion(void) const */ Tag SharedObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedObjectTemplate::getHighestTemplateVersion @@ -274,33 +274,33 @@ StringId testDataValue = DefaultStringId; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getObjectName(true); #endif } if (!m_objectName.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter objectName in template %s", DataResource::getName())); return DefaultStringId; } else { - DEBUG_FATAL(base == NULL, ("Template parameter objectName has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter objectName has not been defined in template %s!", DataResource::getName())); return base->getObjectName(); } } const StringId value = m_objectName.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -316,33 +316,33 @@ StringId testDataValue = DefaultStringId; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDetailedDescription(true); #endif } if (!m_detailedDescription.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter detailedDescription in template %s", DataResource::getName())); return DefaultStringId; } else { - DEBUG_FATAL(base == NULL, ("Template parameter detailedDescription has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter detailedDescription has not been defined in template %s!", DataResource::getName())); return base->getDetailedDescription(); } } const StringId value = m_detailedDescription.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -358,33 +358,33 @@ StringId testDataValue = DefaultStringId; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getLookAtText(true); #endif } if (!m_lookAtText.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter lookAtText in template %s", DataResource::getName())); return DefaultStringId; } else { - DEBUG_FATAL(base == NULL, ("Template parameter lookAtText has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter lookAtText has not been defined in template %s!", DataResource::getName())); return base->getLookAtText(); } } const StringId value = m_lookAtText.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -400,33 +400,33 @@ bool testDataValue = false; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSnapToTerrain(true); #endif } if (!m_snapToTerrain.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter snapToTerrain in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter snapToTerrain has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter snapToTerrain has not been defined in template %s!", DataResource::getName())); return base->getSnapToTerrain(); } } bool value = m_snapToTerrain.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -442,33 +442,33 @@ SharedObjectTemplate::ContainerType testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getContainerType(true); #endif } if (!m_containerType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter containerType in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter containerType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter containerType has not been defined in template %s!", DataResource::getName())); return base->getContainerType(); } } ContainerType value = static_cast(m_containerType.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -484,26 +484,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getContainerVolumeLimit(true); #endif } if (!m_containerVolumeLimit.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter containerVolumeLimit in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter containerVolumeLimit has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter containerVolumeLimit has not been defined in template %s!", DataResource::getName())); return base->getContainerVolumeLimit(); } } @@ -513,9 +513,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getContainerVolumeLimit(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -532,7 +532,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -548,26 +548,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getContainerVolumeLimitMin(true); #endif } if (!m_containerVolumeLimit.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter containerVolumeLimit in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter containerVolumeLimit has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter containerVolumeLimit has not been defined in template %s!", DataResource::getName())); return base->getContainerVolumeLimitMin(); } } @@ -577,9 +577,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getContainerVolumeLimitMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -596,7 +596,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -612,26 +612,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getContainerVolumeLimitMax(true); #endif } if (!m_containerVolumeLimit.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter containerVolumeLimit in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter containerVolumeLimit has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter containerVolumeLimit has not been defined in template %s!", DataResource::getName())); return base->getContainerVolumeLimitMax(); } } @@ -641,9 +641,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getContainerVolumeLimitMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -660,7 +660,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -676,33 +676,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTintPalette(true); #endif } if (!m_tintPalette.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter tintPalette in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter tintPalette has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter tintPalette has not been defined in template %s!", DataResource::getName())); return base->getTintPalette(); } } const std::string & value = m_tintPalette.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -718,33 +718,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSlotDescriptorFilename(true); #endif } if (!m_slotDescriptorFilename.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slotDescriptorFilename in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slotDescriptorFilename has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slotDescriptorFilename has not been defined in template %s!", DataResource::getName())); return base->getSlotDescriptorFilename(); } } const std::string & value = m_slotDescriptorFilename.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -760,33 +760,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getArrangementDescriptorFilename(true); #endif } if (!m_arrangementDescriptorFilename.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter arrangementDescriptorFilename in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter arrangementDescriptorFilename has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter arrangementDescriptorFilename has not been defined in template %s!", DataResource::getName())); return base->getArrangementDescriptorFilename(); } } const std::string & value = m_arrangementDescriptorFilename.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -802,33 +802,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAppearanceFilename(true); #endif } if (!m_appearanceFilename.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter appearanceFilename in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter appearanceFilename has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter appearanceFilename has not been defined in template %s!", DataResource::getName())); return base->getAppearanceFilename(); } } const std::string & value = m_appearanceFilename.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -844,33 +844,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getPortalLayoutFilename(true); #endif } if (!m_portalLayoutFilename.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter portalLayoutFilename in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter portalLayoutFilename has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter portalLayoutFilename has not been defined in template %s!", DataResource::getName())); return base->getPortalLayoutFilename(); } } const std::string & value = m_portalLayoutFilename.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -886,33 +886,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getClientDataFile(true); #endif } if (!m_clientDataFile.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter clientDataFile in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter clientDataFile has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter clientDataFile has not been defined in template %s!", DataResource::getName())); return base->getClientDataFile(); } } const std::string & value = m_clientDataFile.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -928,26 +928,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getScale(true); #endif } if (!m_scale.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter scale in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter scale has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter scale has not been defined in template %s!", DataResource::getName())); return base->getScale(); } } @@ -957,9 +957,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getScale(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -976,7 +976,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -992,26 +992,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getScaleMin(true); #endif } if (!m_scale.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter scale in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter scale has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter scale has not been defined in template %s!", DataResource::getName())); return base->getScaleMin(); } } @@ -1021,9 +1021,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getScaleMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1040,7 +1040,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1056,26 +1056,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getScaleMax(true); #endif } if (!m_scale.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter scale in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter scale has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter scale has not been defined in template %s!", DataResource::getName())); return base->getScaleMax(); } } @@ -1085,9 +1085,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getScaleMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1104,7 +1104,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1120,33 +1120,33 @@ SharedObjectTemplate::GameObjectType testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getGameObjectType(true); #endif } if (!m_gameObjectType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter gameObjectType in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter gameObjectType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter gameObjectType has not been defined in template %s!", DataResource::getName())); return base->getGameObjectType(); } } GameObjectType value = static_cast(m_gameObjectType.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1162,33 +1162,33 @@ bool testDataValue = false; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSendToClient(true); #endif } if (!m_sendToClient.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter sendToClient in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter sendToClient has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter sendToClient has not been defined in template %s!", DataResource::getName())); return base->getSendToClient(); } } bool value = m_sendToClient.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1204,26 +1204,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getScaleThresholdBeforeExtentTest(true); #endif } if (!m_scaleThresholdBeforeExtentTest.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter scaleThresholdBeforeExtentTest in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter scaleThresholdBeforeExtentTest has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter scaleThresholdBeforeExtentTest has not been defined in template %s!", DataResource::getName())); return base->getScaleThresholdBeforeExtentTest(); } } @@ -1233,9 +1233,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getScaleThresholdBeforeExtentTest(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1252,7 +1252,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1268,26 +1268,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getScaleThresholdBeforeExtentTestMin(true); #endif } if (!m_scaleThresholdBeforeExtentTest.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter scaleThresholdBeforeExtentTest in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter scaleThresholdBeforeExtentTest has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter scaleThresholdBeforeExtentTest has not been defined in template %s!", DataResource::getName())); return base->getScaleThresholdBeforeExtentTestMin(); } } @@ -1297,9 +1297,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getScaleThresholdBeforeExtentTestMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1316,7 +1316,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1332,26 +1332,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getScaleThresholdBeforeExtentTestMax(true); #endif } if (!m_scaleThresholdBeforeExtentTest.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter scaleThresholdBeforeExtentTest in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter scaleThresholdBeforeExtentTest has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter scaleThresholdBeforeExtentTest has not been defined in template %s!", DataResource::getName())); return base->getScaleThresholdBeforeExtentTestMax(); } } @@ -1361,9 +1361,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getScaleThresholdBeforeExtentTestMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1380,7 +1380,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1396,26 +1396,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getClearFloraRadius(true); #endif } if (!m_clearFloraRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter clearFloraRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter clearFloraRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter clearFloraRadius has not been defined in template %s!", DataResource::getName())); return base->getClearFloraRadius(); } } @@ -1425,9 +1425,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getClearFloraRadius(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1444,7 +1444,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1460,26 +1460,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getClearFloraRadiusMin(true); #endif } if (!m_clearFloraRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter clearFloraRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter clearFloraRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter clearFloraRadius has not been defined in template %s!", DataResource::getName())); return base->getClearFloraRadiusMin(); } } @@ -1489,9 +1489,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getClearFloraRadiusMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1508,7 +1508,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1524,26 +1524,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getClearFloraRadiusMax(true); #endif } if (!m_clearFloraRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter clearFloraRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter clearFloraRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter clearFloraRadius has not been defined in template %s!", DataResource::getName())); return base->getClearFloraRadiusMax(); } } @@ -1553,9 +1553,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getClearFloraRadiusMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1572,7 +1572,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1588,33 +1588,33 @@ SharedObjectTemplate::SurfaceType testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSurfaceType(true); #endif } if (!m_surfaceType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter surfaceType in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter surfaceType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter surfaceType has not been defined in template %s!", DataResource::getName())); return base->getSurfaceType(); } } SurfaceType value = static_cast(m_surfaceType.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1630,26 +1630,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getNoBuildRadius(true); #endif } if (!m_noBuildRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter noBuildRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter noBuildRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter noBuildRadius has not been defined in template %s!", DataResource::getName())); return base->getNoBuildRadius(); } } @@ -1659,9 +1659,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getNoBuildRadius(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1678,7 +1678,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1694,26 +1694,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getNoBuildRadiusMin(true); #endif } if (!m_noBuildRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter noBuildRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter noBuildRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter noBuildRadius has not been defined in template %s!", DataResource::getName())); return base->getNoBuildRadiusMin(); } } @@ -1723,9 +1723,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getNoBuildRadiusMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1742,7 +1742,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1758,26 +1758,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getNoBuildRadiusMax(true); #endif } if (!m_noBuildRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter noBuildRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter noBuildRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter noBuildRadius has not been defined in template %s!", DataResource::getName())); return base->getNoBuildRadiusMax(); } } @@ -1787,9 +1787,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getNoBuildRadiusMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1806,7 +1806,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1822,33 +1822,33 @@ bool testDataValue = false; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getOnlyVisibleInTools(true); #endif } if (!m_onlyVisibleInTools.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter onlyVisibleInTools in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter onlyVisibleInTools has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter onlyVisibleInTools has not been defined in template %s!", DataResource::getName())); return base->getOnlyVisibleInTools(); } } bool value = m_onlyVisibleInTools.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1864,26 +1864,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getLocationReservationRadius(true); #endif } if (!m_locationReservationRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter locationReservationRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter locationReservationRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter locationReservationRadius has not been defined in template %s!", DataResource::getName())); return base->getLocationReservationRadius(); } } @@ -1893,9 +1893,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getLocationReservationRadius(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1912,7 +1912,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1928,26 +1928,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getLocationReservationRadiusMin(true); #endif } if (!m_locationReservationRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter locationReservationRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter locationReservationRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter locationReservationRadius has not been defined in template %s!", DataResource::getName())); return base->getLocationReservationRadiusMin(); } } @@ -1957,9 +1957,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getLocationReservationRadiusMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1976,7 +1976,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1992,26 +1992,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getLocationReservationRadiusMax(true); #endif } if (!m_locationReservationRadius.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter locationReservationRadius in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter locationReservationRadius has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter locationReservationRadius has not been defined in template %s!", DataResource::getName())); return base->getLocationReservationRadiusMax(); } } @@ -2021,9 +2021,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getLocationReservationRadiusMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2040,7 +2040,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2056,33 +2056,33 @@ bool testDataValue = false; UNREF(testData); #endif - const SharedObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getForceNoCollision(true); #endif } if (!m_forceNoCollision.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter forceNoCollision in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter forceNoCollision has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter forceNoCollision has not been defined in template %s!", DataResource::getName())); return base->getForceNoCollision(); } } bool value = m_forceNoCollision.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2153,12 +2153,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerObjectTemplate.cpp index 03213f9f..7d020a59 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerObjectTemplate.cpp @@ -95,10 +95,10 @@ Tag SharedPlayerObjectTemplate::getTemplateVersion(void) const */ Tag SharedPlayerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedPlayerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedPlayerObjectTemplate::getHighestTemplateVersion @@ -141,12 +141,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerQuestObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerQuestObjectTemplate.cpp index c475f753..26380963 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerQuestObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerQuestObjectTemplate.cpp @@ -95,10 +95,10 @@ Tag SharedPlayerQuestObjectTemplate::getTemplateVersion(void) const */ Tag SharedPlayerQuestObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedPlayerQuestObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedPlayerQuestObjectTemplate::getHighestTemplateVersion @@ -141,12 +141,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedResourceContainerObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedResourceContainerObjectTemplate.cpp index 9eb6e580..dbb0635d 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedResourceContainerObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedResourceContainerObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedResourceContainerObjectTemplate::getTemplateVersion(void) const */ Tag SharedResourceContainerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedResourceContainerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedResourceContainerObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedShipObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedShipObjectTemplate.cpp index 8dce0c07..e374302c 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedShipObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedShipObjectTemplate.cpp @@ -101,10 +101,10 @@ Tag SharedShipObjectTemplate::getTemplateVersion(void) const */ Tag SharedShipObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedShipObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedShipObjectTemplate::getHighestTemplateVersion @@ -155,33 +155,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedShipObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedShipObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCockpitFilename(true); #endif } if (!m_cockpitFilename.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter cockpitFilename in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter cockpitFilename has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter cockpitFilename has not been defined in template %s!", DataResource::getName())); return base->getCockpitFilename(); } } const std::string & value = m_cockpitFilename.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -197,33 +197,33 @@ bool testDataValue = false; UNREF(testData); #endif - const SharedShipObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedShipObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getHasWings(true); #endif } if (!m_hasWings.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter hasWings in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter hasWings has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter hasWings has not been defined in template %s!", DataResource::getName())); return base->getHasWings(); } } bool value = m_hasWings.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -239,33 +239,33 @@ bool testDataValue = false; UNREF(testData); #endif - const SharedShipObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedShipObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getPlayerControlled(true); #endif } if (!m_playerControlled.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter playerControlled in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter playerControlled has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter playerControlled has not been defined in template %s!", DataResource::getName())); return base->getPlayerControlled(); } } bool value = m_playerControlled.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -281,33 +281,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedShipObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedShipObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getInteriorLayoutFileName(true); #endif } if (!m_interiorLayoutFileName.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter interiorLayoutFileName in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter interiorLayoutFileName has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter interiorLayoutFileName has not been defined in template %s!", DataResource::getName())); return base->getInteriorLayoutFileName(); } } const std::string & value = m_interiorLayoutFileName.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -356,12 +356,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedStaticObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedStaticObjectTemplate.cpp index 597d379a..3de71cf2 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedStaticObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedStaticObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedStaticObjectTemplate::getTemplateVersion(void) const */ Tag SharedStaticObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedStaticObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedStaticObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTangibleObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTangibleObjectTemplate.cpp index 57f841e2..95742f60 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTangibleObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTangibleObjectTemplate.cpp @@ -73,7 +73,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() for (iter = m_paletteColorCustomizationVariables.begin(); iter != m_paletteColorCustomizationVariables.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_paletteColorCustomizationVariables.clear(); } @@ -82,7 +82,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() for (iter = m_rangedIntCustomizationVariables.begin(); iter != m_rangedIntCustomizationVariables.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_rangedIntCustomizationVariables.clear(); } @@ -91,7 +91,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() for (iter = m_constStringCustomizationVariables.begin(); iter != m_constStringCustomizationVariables.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_constStringCustomizationVariables.clear(); } @@ -100,7 +100,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() for (iter = m_socketDestinations.begin(); iter != m_socketDestinations.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_socketDestinations.clear(); } @@ -109,7 +109,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() for (iter = m_certificationsRequired.begin(); iter != m_certificationsRequired.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_certificationsRequired.clear(); } @@ -118,7 +118,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() for (iter = m_customizationVariableMapping.begin(); iter != m_customizationVariableMapping.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_customizationVariableMapping.clear(); } @@ -176,10 +176,10 @@ Tag SharedTangibleObjectTemplate::getTemplateVersion(void) const */ Tag SharedTangibleObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedTangibleObjectTemplate::getHighestTemplateVersion @@ -355,28 +355,28 @@ void SharedTangibleObjectTemplate::createCustomizationDataPropertyAsNeeded(Objec //@BEGIN TFD void SharedTangibleObjectTemplate::getPaletteColorCustomizationVariables(PaletteColorCustomizationVariable &data, int index) const { - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_paletteColorCustomizationVariablesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter paletteColorCustomizationVariables in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter paletteColorCustomizationVariables has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter paletteColorCustomizationVariables has not been defined in template %s!", DataResource::getName())); base->getPaletteColorCustomizationVariables(data, index); return; } } - if (m_paletteColorCustomizationVariablesAppend && base != NULL) + if (m_paletteColorCustomizationVariablesAppend && base != nullptr) { int baseCount = base->getPaletteColorCustomizationVariablesCount(); if (index < baseCount) @@ -399,28 +399,28 @@ void SharedTangibleObjectTemplate::getPaletteColorCustomizationVariables(Palette void SharedTangibleObjectTemplate::getPaletteColorCustomizationVariablesMin(PaletteColorCustomizationVariable &data, int index) const { - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_paletteColorCustomizationVariablesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter paletteColorCustomizationVariables in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter paletteColorCustomizationVariables has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter paletteColorCustomizationVariables has not been defined in template %s!", DataResource::getName())); base->getPaletteColorCustomizationVariablesMin(data, index); return; } } - if (m_paletteColorCustomizationVariablesAppend && base != NULL) + if (m_paletteColorCustomizationVariablesAppend && base != nullptr) { int baseCount = base->getPaletteColorCustomizationVariablesCount(); if (index < baseCount) @@ -443,28 +443,28 @@ void SharedTangibleObjectTemplate::getPaletteColorCustomizationVariablesMin(Pale void SharedTangibleObjectTemplate::getPaletteColorCustomizationVariablesMax(PaletteColorCustomizationVariable &data, int index) const { - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_paletteColorCustomizationVariablesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter paletteColorCustomizationVariables in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter paletteColorCustomizationVariables has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter paletteColorCustomizationVariables has not been defined in template %s!", DataResource::getName())); base->getPaletteColorCustomizationVariablesMax(data, index); return; } } - if (m_paletteColorCustomizationVariablesAppend && base != NULL) + if (m_paletteColorCustomizationVariablesAppend && base != nullptr) { int baseCount = base->getPaletteColorCustomizationVariablesCount(); if (index < baseCount) @@ -489,20 +489,20 @@ size_t SharedTangibleObjectTemplate::getPaletteColorCustomizationVariablesCount( { if (!m_paletteColorCustomizationVariablesLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getPaletteColorCustomizationVariablesCount(); } size_t count = m_paletteColorCustomizationVariables.size(); // if we are extending our base template, add it's count - if (m_paletteColorCustomizationVariablesAppend && m_baseData != NULL) + if (m_paletteColorCustomizationVariablesAppend && m_baseData != nullptr) { const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getPaletteColorCustomizationVariablesCount(); } @@ -511,28 +511,28 @@ size_t SharedTangibleObjectTemplate::getPaletteColorCustomizationVariablesCount( void SharedTangibleObjectTemplate::getRangedIntCustomizationVariables(RangedIntCustomizationVariable &data, int index) const { - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_rangedIntCustomizationVariablesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter rangedIntCustomizationVariables in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter rangedIntCustomizationVariables has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter rangedIntCustomizationVariables has not been defined in template %s!", DataResource::getName())); base->getRangedIntCustomizationVariables(data, index); return; } } - if (m_rangedIntCustomizationVariablesAppend && base != NULL) + if (m_rangedIntCustomizationVariablesAppend && base != nullptr) { int baseCount = base->getRangedIntCustomizationVariablesCount(); if (index < baseCount) @@ -556,28 +556,28 @@ void SharedTangibleObjectTemplate::getRangedIntCustomizationVariables(RangedIntC void SharedTangibleObjectTemplate::getRangedIntCustomizationVariablesMin(RangedIntCustomizationVariable &data, int index) const { - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_rangedIntCustomizationVariablesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter rangedIntCustomizationVariables in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter rangedIntCustomizationVariables has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter rangedIntCustomizationVariables has not been defined in template %s!", DataResource::getName())); base->getRangedIntCustomizationVariablesMin(data, index); return; } } - if (m_rangedIntCustomizationVariablesAppend && base != NULL) + if (m_rangedIntCustomizationVariablesAppend && base != nullptr) { int baseCount = base->getRangedIntCustomizationVariablesCount(); if (index < baseCount) @@ -601,28 +601,28 @@ void SharedTangibleObjectTemplate::getRangedIntCustomizationVariablesMin(RangedI void SharedTangibleObjectTemplate::getRangedIntCustomizationVariablesMax(RangedIntCustomizationVariable &data, int index) const { - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_rangedIntCustomizationVariablesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter rangedIntCustomizationVariables in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter rangedIntCustomizationVariables has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter rangedIntCustomizationVariables has not been defined in template %s!", DataResource::getName())); base->getRangedIntCustomizationVariablesMax(data, index); return; } } - if (m_rangedIntCustomizationVariablesAppend && base != NULL) + if (m_rangedIntCustomizationVariablesAppend && base != nullptr) { int baseCount = base->getRangedIntCustomizationVariablesCount(); if (index < baseCount) @@ -648,20 +648,20 @@ size_t SharedTangibleObjectTemplate::getRangedIntCustomizationVariablesCount(voi { if (!m_rangedIntCustomizationVariablesLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getRangedIntCustomizationVariablesCount(); } size_t count = m_rangedIntCustomizationVariables.size(); // if we are extending our base template, add it's count - if (m_rangedIntCustomizationVariablesAppend && m_baseData != NULL) + if (m_rangedIntCustomizationVariablesAppend && m_baseData != nullptr) { const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getRangedIntCustomizationVariablesCount(); } @@ -670,28 +670,28 @@ size_t SharedTangibleObjectTemplate::getRangedIntCustomizationVariablesCount(voi void SharedTangibleObjectTemplate::getConstStringCustomizationVariables(ConstStringCustomizationVariable &data, int index) const { - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_constStringCustomizationVariablesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter constStringCustomizationVariables in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter constStringCustomizationVariables has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter constStringCustomizationVariables has not been defined in template %s!", DataResource::getName())); base->getConstStringCustomizationVariables(data, index); return; } } - if (m_constStringCustomizationVariablesAppend && base != NULL) + if (m_constStringCustomizationVariablesAppend && base != nullptr) { int baseCount = base->getConstStringCustomizationVariablesCount(); if (index < baseCount) @@ -713,28 +713,28 @@ void SharedTangibleObjectTemplate::getConstStringCustomizationVariables(ConstStr void SharedTangibleObjectTemplate::getConstStringCustomizationVariablesMin(ConstStringCustomizationVariable &data, int index) const { - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_constStringCustomizationVariablesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter constStringCustomizationVariables in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter constStringCustomizationVariables has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter constStringCustomizationVariables has not been defined in template %s!", DataResource::getName())); base->getConstStringCustomizationVariablesMin(data, index); return; } } - if (m_constStringCustomizationVariablesAppend && base != NULL) + if (m_constStringCustomizationVariablesAppend && base != nullptr) { int baseCount = base->getConstStringCustomizationVariablesCount(); if (index < baseCount) @@ -756,28 +756,28 @@ void SharedTangibleObjectTemplate::getConstStringCustomizationVariablesMin(Const void SharedTangibleObjectTemplate::getConstStringCustomizationVariablesMax(ConstStringCustomizationVariable &data, int index) const { - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_constStringCustomizationVariablesLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter constStringCustomizationVariables in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter constStringCustomizationVariables has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter constStringCustomizationVariables has not been defined in template %s!", DataResource::getName())); base->getConstStringCustomizationVariablesMax(data, index); return; } } - if (m_constStringCustomizationVariablesAppend && base != NULL) + if (m_constStringCustomizationVariablesAppend && base != nullptr) { int baseCount = base->getConstStringCustomizationVariablesCount(); if (index < baseCount) @@ -801,20 +801,20 @@ size_t SharedTangibleObjectTemplate::getConstStringCustomizationVariablesCount(v { if (!m_constStringCustomizationVariablesLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getConstStringCustomizationVariablesCount(); } size_t count = m_constStringCustomizationVariables.size(); // if we are extending our base template, add it's count - if (m_constStringCustomizationVariablesAppend && m_baseData != NULL) + if (m_constStringCustomizationVariablesAppend && m_baseData != nullptr) { const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getConstStringCustomizationVariablesCount(); } @@ -823,27 +823,27 @@ size_t SharedTangibleObjectTemplate::getConstStringCustomizationVariablesCount(v SharedTangibleObjectTemplate::GameObjectType SharedTangibleObjectTemplate::getSocketDestinations(int index) const { - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_socketDestinationsLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter socketDestinations in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter socketDestinations has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter socketDestinations has not been defined in template %s!", DataResource::getName())); return base->getSocketDestinations(index); } } - if (m_socketDestinationsAppend && base != NULL) + if (m_socketDestinationsAppend && base != nullptr) { int baseCount = base->getSocketDestinationsCount(); if (index < baseCount) @@ -859,20 +859,20 @@ size_t SharedTangibleObjectTemplate::getSocketDestinationsCount(void) const { if (!m_socketDestinationsLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getSocketDestinationsCount(); } size_t count = m_socketDestinations.size(); // if we are extending our base template, add it's count - if (m_socketDestinationsAppend && m_baseData != NULL) + if (m_socketDestinationsAppend && m_baseData != nullptr) { const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getSocketDestinationsCount(); } @@ -887,33 +887,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getStructureFootprintFileName(true); #endif } if (!m_structureFootprintFileName.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter structureFootprintFileName in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter structureFootprintFileName has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter structureFootprintFileName has not been defined in template %s!", DataResource::getName())); return base->getStructureFootprintFileName(); } } const std::string & value = m_structureFootprintFileName.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -929,33 +929,33 @@ bool testDataValue = false; UNREF(testData); #endif - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getUseStructureFootprintOutline(true); #endif } if (!m_useStructureFootprintOutline.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter useStructureFootprintOutline in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter useStructureFootprintOutline has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter useStructureFootprintOutline has not been defined in template %s!", DataResource::getName())); return base->getUseStructureFootprintOutline(); } } bool value = m_useStructureFootprintOutline.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -971,33 +971,33 @@ bool testDataValue = false; UNREF(testData); #endif - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTargetable(true); #endif } if (!m_targetable.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter targetable in template %s", DataResource::getName())); return false; } else { - DEBUG_FATAL(base == NULL, ("Template parameter targetable has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter targetable has not been defined in template %s!", DataResource::getName())); return base->getTargetable(); } } bool value = m_targetable.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1007,27 +1007,27 @@ UNREF(testData); const std::string & SharedTangibleObjectTemplate::getCertificationsRequired(int index) const { - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_certificationsRequiredLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter certificationsRequired in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter certificationsRequired has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter certificationsRequired has not been defined in template %s!", DataResource::getName())); return base->getCertificationsRequired(index); } } - if (m_certificationsRequiredAppend && base != NULL) + if (m_certificationsRequiredAppend && base != nullptr) { int baseCount = base->getCertificationsRequiredCount(); if (index < baseCount) @@ -1044,20 +1044,20 @@ size_t SharedTangibleObjectTemplate::getCertificationsRequiredCount(void) const { if (!m_certificationsRequiredLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getCertificationsRequiredCount(); } size_t count = m_certificationsRequired.size(); // if we are extending our base template, add it's count - if (m_certificationsRequiredAppend && m_baseData != NULL) + if (m_certificationsRequiredAppend && m_baseData != nullptr) { const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getCertificationsRequiredCount(); } @@ -1066,28 +1066,28 @@ size_t SharedTangibleObjectTemplate::getCertificationsRequiredCount(void) const void SharedTangibleObjectTemplate::getCustomizationVariableMapping(CustomizationVariableMapping &data, int index) const { - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_customizationVariableMappingLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter customizationVariableMapping in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter customizationVariableMapping has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter customizationVariableMapping has not been defined in template %s!", DataResource::getName())); base->getCustomizationVariableMapping(data, index); return; } } - if (m_customizationVariableMappingAppend && base != NULL) + if (m_customizationVariableMappingAppend && base != nullptr) { int baseCount = base->getCustomizationVariableMappingCount(); if (index < baseCount) @@ -1109,28 +1109,28 @@ void SharedTangibleObjectTemplate::getCustomizationVariableMapping(Customization void SharedTangibleObjectTemplate::getCustomizationVariableMappingMin(CustomizationVariableMapping &data, int index) const { - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_customizationVariableMappingLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter customizationVariableMapping in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter customizationVariableMapping has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter customizationVariableMapping has not been defined in template %s!", DataResource::getName())); base->getCustomizationVariableMappingMin(data, index); return; } } - if (m_customizationVariableMappingAppend && base != NULL) + if (m_customizationVariableMappingAppend && base != nullptr) { int baseCount = base->getCustomizationVariableMappingCount(); if (index < baseCount) @@ -1152,28 +1152,28 @@ void SharedTangibleObjectTemplate::getCustomizationVariableMappingMin(Customizat void SharedTangibleObjectTemplate::getCustomizationVariableMappingMax(CustomizationVariableMapping &data, int index) const { - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } if (!m_customizationVariableMappingLoaded) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter customizationVariableMapping in template %s", DataResource::getName())); return ; } else { - DEBUG_FATAL(base == NULL, ("Template parameter customizationVariableMapping has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter customizationVariableMapping has not been defined in template %s!", DataResource::getName())); base->getCustomizationVariableMappingMax(data, index); return; } } - if (m_customizationVariableMappingAppend && base != NULL) + if (m_customizationVariableMappingAppend && base != nullptr) { int baseCount = base->getCustomizationVariableMappingCount(); if (index < baseCount) @@ -1197,20 +1197,20 @@ size_t SharedTangibleObjectTemplate::getCustomizationVariableMappingCount(void) { if (!m_customizationVariableMappingLoaded) { - if (m_baseData == NULL) + if (m_baseData == nullptr) return 0; const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - DEBUG_FATAL(base == NULL, ("base template wrong type")); + DEBUG_FATAL(base == nullptr, ("base template wrong type")); return base->getCustomizationVariableMappingCount(); } size_t count = m_customizationVariableMapping.size(); // if we are extending our base template, add it's count - if (m_customizationVariableMappingAppend && m_baseData != NULL) + if (m_customizationVariableMappingAppend && m_baseData != nullptr) { const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base != NULL) + if (base != nullptr) count += base->getCustomizationVariableMappingCount(); } @@ -1225,33 +1225,33 @@ SharedTangibleObjectTemplate::ClientVisabilityFlags testDataValue = static_cast< UNREF(testData); #endif - const SharedTangibleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getClientVisabilityFlag(true); #endif } if (!m_clientVisabilityFlag.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter clientVisabilityFlag in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter clientVisabilityFlag has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter clientVisabilityFlag has not been defined in template %s!", DataResource::getName())); return base->getClientVisabilityFlag(); } } ClientVisabilityFlags value = static_cast(m_clientVisabilityFlag.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1300,12 +1300,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -1334,7 +1334,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_paletteColorCustomizationVariables.begin(); iter != m_paletteColorCustomizationVariables.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_paletteColorCustomizationVariables.clear(); m_paletteColorCustomizationVariablesAppend = file.read_bool8(); @@ -1353,7 +1353,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_rangedIntCustomizationVariables.begin(); iter != m_rangedIntCustomizationVariables.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_rangedIntCustomizationVariables.clear(); m_rangedIntCustomizationVariablesAppend = file.read_bool8(); @@ -1372,7 +1372,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_constStringCustomizationVariables.begin(); iter != m_constStringCustomizationVariables.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_constStringCustomizationVariables.clear(); m_constStringCustomizationVariablesAppend = file.read_bool8(); @@ -1391,7 +1391,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_socketDestinations.begin(); iter != m_socketDestinations.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_socketDestinations.clear(); m_socketDestinationsAppend = file.read_bool8(); @@ -1416,7 +1416,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_certificationsRequired.begin(); iter != m_certificationsRequired.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_certificationsRequired.clear(); m_certificationsRequiredAppend = file.read_bool8(); @@ -1435,7 +1435,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_customizationVariableMapping.begin(); iter != m_customizationVariableMapping.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_customizationVariableMapping.clear(); m_customizationVariableMappingAppend = file.read_bool8(); @@ -1514,33 +1514,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_ConstStringCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_ConstStringCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getVariableName(true); #endif } if (!m_variableName.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter variableName in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter variableName has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter variableName has not been defined in template %s!", DataResource::getName())); return base->getVariableName(versionOk); } } const std::string & value = m_variableName.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1556,33 +1556,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_ConstStringCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_ConstStringCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getConstValue(true); #endif } if (!m_constValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter constValue in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter constValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter constValue has not been defined in template %s!", DataResource::getName())); return base->getConstValue(versionOk); } } const std::string & value = m_constValue.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1687,33 +1687,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_CustomizationVariableMapping * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_CustomizationVariableMapping * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSourceVariable(true); #endif } if (!m_sourceVariable.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter sourceVariable in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter sourceVariable has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter sourceVariable has not been defined in template %s!", DataResource::getName())); return base->getSourceVariable(versionOk); } } const std::string & value = m_sourceVariable.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1729,33 +1729,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_CustomizationVariableMapping * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_CustomizationVariableMapping * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDependentVariable(true); #endif } if (!m_dependentVariable.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter dependentVariable in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter dependentVariable has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter dependentVariable has not been defined in template %s!", DataResource::getName())); return base->getDependentVariable(versionOk); } } const std::string & value = m_dependentVariable.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1860,33 +1860,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getVariableName(true); #endif } if (!m_variableName.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter variableName in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter variableName has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter variableName has not been defined in template %s!", DataResource::getName())); return base->getVariableName(versionOk); } } const std::string & value = m_variableName.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1902,33 +1902,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getPalettePathName(true); #endif } if (!m_palettePathName.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter palettePathName in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter palettePathName has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter palettePathName has not been defined in template %s!", DataResource::getName())); return base->getPalettePathName(versionOk); } } const std::string & value = m_palettePathName.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1944,26 +1944,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDefaultPaletteIndex(true); #endif } if (!m_defaultPaletteIndex.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter defaultPaletteIndex in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter defaultPaletteIndex has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter defaultPaletteIndex has not been defined in template %s!", DataResource::getName())); return base->getDefaultPaletteIndex(versionOk); } } @@ -1973,9 +1973,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getDefaultPaletteIndex(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1992,7 +1992,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2008,26 +2008,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDefaultPaletteIndexMin(true); #endif } if (!m_defaultPaletteIndex.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter defaultPaletteIndex in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter defaultPaletteIndex has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter defaultPaletteIndex has not been defined in template %s!", DataResource::getName())); return base->getDefaultPaletteIndexMin(versionOk); } } @@ -2037,9 +2037,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getDefaultPaletteIndexMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2056,7 +2056,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2072,26 +2072,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDefaultPaletteIndexMax(true); #endif } if (!m_defaultPaletteIndex.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter defaultPaletteIndex in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter defaultPaletteIndex has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter defaultPaletteIndex has not been defined in template %s!", DataResource::getName())); return base->getDefaultPaletteIndexMax(versionOk); } } @@ -2101,9 +2101,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getDefaultPaletteIndexMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2120,7 +2120,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2229,33 +2229,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getVariableName(true); #endif } if (!m_variableName.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter variableName in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter variableName has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter variableName has not been defined in template %s!", DataResource::getName())); return base->getVariableName(versionOk); } } const std::string & value = m_variableName.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2271,26 +2271,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMinValueInclusive(true); #endif } if (!m_minValueInclusive.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter minValueInclusive in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter minValueInclusive has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter minValueInclusive has not been defined in template %s!", DataResource::getName())); return base->getMinValueInclusive(versionOk); } } @@ -2300,9 +2300,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinValueInclusive(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2319,7 +2319,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2335,26 +2335,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMinValueInclusiveMin(true); #endif } if (!m_minValueInclusive.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter minValueInclusive in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter minValueInclusive has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter minValueInclusive has not been defined in template %s!", DataResource::getName())); return base->getMinValueInclusiveMin(versionOk); } } @@ -2364,9 +2364,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinValueInclusiveMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2383,7 +2383,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2399,26 +2399,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMinValueInclusiveMax(true); #endif } if (!m_minValueInclusive.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter minValueInclusive in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter minValueInclusive has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter minValueInclusive has not been defined in template %s!", DataResource::getName())); return base->getMinValueInclusiveMax(versionOk); } } @@ -2428,9 +2428,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMinValueInclusiveMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2447,7 +2447,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2463,26 +2463,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDefaultValue(true); #endif } if (!m_defaultValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter defaultValue in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter defaultValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter defaultValue has not been defined in template %s!", DataResource::getName())); return base->getDefaultValue(versionOk); } } @@ -2492,9 +2492,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getDefaultValue(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2511,7 +2511,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2527,26 +2527,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDefaultValueMin(true); #endif } if (!m_defaultValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter defaultValue in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter defaultValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter defaultValue has not been defined in template %s!", DataResource::getName())); return base->getDefaultValueMin(versionOk); } } @@ -2556,9 +2556,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getDefaultValueMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2575,7 +2575,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2591,26 +2591,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getDefaultValueMax(true); #endif } if (!m_defaultValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter defaultValue in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter defaultValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter defaultValue has not been defined in template %s!", DataResource::getName())); return base->getDefaultValueMax(versionOk); } } @@ -2620,9 +2620,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getDefaultValueMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2639,7 +2639,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2655,26 +2655,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxValueExclusive(true); #endif } if (!m_maxValueExclusive.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxValueExclusive in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxValueExclusive has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxValueExclusive has not been defined in template %s!", DataResource::getName())); return base->getMaxValueExclusive(versionOk); } } @@ -2684,9 +2684,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxValueExclusive(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2703,7 +2703,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2719,26 +2719,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxValueExclusiveMin(true); #endif } if (!m_maxValueExclusive.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxValueExclusive in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxValueExclusive has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxValueExclusive has not been defined in template %s!", DataResource::getName())); return base->getMaxValueExclusiveMin(versionOk); } } @@ -2748,9 +2748,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxValueExclusiveMin(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2767,7 +2767,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -2783,26 +2783,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = NULL; - if (m_baseData != NULL) + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxValueExclusiveMax(true); #endif } if (!m_maxValueExclusive.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxValueExclusive in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxValueExclusive has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxValueExclusive has not been defined in template %s!", DataResource::getName())); return base->getMaxValueExclusiveMax(versionOk); } } @@ -2812,9 +2812,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxValueExclusiveMax(versionOk); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -2831,7 +2831,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTerrainSurfaceObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTerrainSurfaceObjectTemplate.cpp index cd2c216b..b518a9f7 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTerrainSurfaceObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTerrainSurfaceObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedTerrainSurfaceObjectTemplate::getTemplateVersion(void) const */ Tag SharedTerrainSurfaceObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedTerrainSurfaceObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedTerrainSurfaceObjectTemplate::getHighestTemplateVersion @@ -111,26 +111,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedTerrainSurfaceObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTerrainSurfaceObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCover(true); #endif } if (!m_cover.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter cover in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter cover has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter cover has not been defined in template %s!", DataResource::getName())); return base->getCover(); } } @@ -140,9 +140,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCover(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -159,7 +159,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { if (testDataValue == value) DEBUG_WARNING(true, ("Template %s, parameter cover is returning same value as base template.", DataResource::getName())); @@ -177,26 +177,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedTerrainSurfaceObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTerrainSurfaceObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCoverMin(true); #endif } if (!m_cover.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter cover in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter cover has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter cover has not been defined in template %s!", DataResource::getName())); return base->getCoverMin(); } } @@ -206,9 +206,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCoverMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -225,7 +225,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { if (testDataValue == value) DEBUG_WARNING(true, ("Template %s, parameter cover is returning same value as base template.", DataResource::getName())); @@ -243,26 +243,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedTerrainSurfaceObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTerrainSurfaceObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getCoverMax(true); #endif } if (!m_cover.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter cover in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter cover has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter cover has not been defined in template %s!", DataResource::getName())); return base->getCoverMax(); } } @@ -272,9 +272,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getCoverMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -291,7 +291,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { if (testDataValue == value) DEBUG_WARNING(true, ("Template %s, parameter cover is returning same value as base template.", DataResource::getName())); @@ -309,33 +309,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedTerrainSurfaceObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedTerrainSurfaceObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSurfaceType(true); #endif } if (!m_surfaceType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter surfaceType in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter surfaceType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter surfaceType has not been defined in template %s!", DataResource::getName())); return base->getSurfaceType(); } } const std::string & value = m_surfaceType.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { if (testDataValue == value) DEBUG_WARNING(true, ("Template %s, parameter surfaceType is returning same value as base template.", DataResource::getName())); @@ -383,12 +383,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedUniverseObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedUniverseObjectTemplate.cpp index adf09d85..c6e9b692 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedUniverseObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedUniverseObjectTemplate.cpp @@ -95,10 +95,10 @@ Tag SharedUniverseObjectTemplate::getTemplateVersion(void) const */ Tag SharedUniverseObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedUniverseObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedUniverseObjectTemplate::getHighestTemplateVersion @@ -141,12 +141,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedVehicleObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedVehicleObjectTemplate.cpp index ccc2cb77..7467cf59 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedVehicleObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedVehicleObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedVehicleObjectTemplate::getTemplateVersion(void) const */ Tag SharedVehicleObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedVehicleObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedVehicleObjectTemplate::getHighestTemplateVersion @@ -105,8 +105,8 @@ Tag SharedVehicleObjectTemplate::getHighestTemplateVersion(void) const //@BEGIN TFD float SharedVehicleObjectTemplate::getSpeed(MovementTypes index) const { - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -114,14 +114,14 @@ float SharedVehicleObjectTemplate::getSpeed(MovementTypes index) const DEBUG_FATAL(index < 0 || index >= 5, ("template param index out of range")); if (!m_speed[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter speed in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter speed has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter speed has not been defined in template %s!", DataResource::getName())); return base->getSpeed(index); } } @@ -131,9 +131,9 @@ float SharedVehicleObjectTemplate::getSpeed(MovementTypes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSpeed(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -154,8 +154,8 @@ float SharedVehicleObjectTemplate::getSpeed(MovementTypes index) const float SharedVehicleObjectTemplate::getSpeedMin(MovementTypes index) const { - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -163,14 +163,14 @@ float SharedVehicleObjectTemplate::getSpeedMin(MovementTypes index) const DEBUG_FATAL(index < 0 || index >= 5, ("template param index out of range")); if (!m_speed[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter speed in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter speed has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter speed has not been defined in template %s!", DataResource::getName())); return base->getSpeedMin(index); } } @@ -180,9 +180,9 @@ float SharedVehicleObjectTemplate::getSpeedMin(MovementTypes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSpeedMin(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -203,8 +203,8 @@ float SharedVehicleObjectTemplate::getSpeedMin(MovementTypes index) const float SharedVehicleObjectTemplate::getSpeedMax(MovementTypes index) const { - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); } @@ -212,14 +212,14 @@ float SharedVehicleObjectTemplate::getSpeedMax(MovementTypes index) const DEBUG_FATAL(index < 0 || index >= 5, ("template param index out of range")); if (!m_speed[index].isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter speed in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter speed has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter speed has not been defined in template %s!", DataResource::getName())); return base->getSpeedMax(index); } } @@ -229,9 +229,9 @@ float SharedVehicleObjectTemplate::getSpeedMax(MovementTypes index) const if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSpeedMax(index); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -258,26 +258,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSlopeAversion(true); #endif } if (!m_slopeAversion.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slopeAversion in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slopeAversion has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slopeAversion has not been defined in template %s!", DataResource::getName())); return base->getSlopeAversion(); } } @@ -287,9 +287,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSlopeAversion(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -306,7 +306,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -322,26 +322,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSlopeAversionMin(true); #endif } if (!m_slopeAversion.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slopeAversion in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slopeAversion has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slopeAversion has not been defined in template %s!", DataResource::getName())); return base->getSlopeAversionMin(); } } @@ -351,9 +351,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSlopeAversionMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -370,7 +370,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -386,26 +386,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getSlopeAversionMax(true); #endif } if (!m_slopeAversion.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slopeAversion in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter slopeAversion has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter slopeAversion has not been defined in template %s!", DataResource::getName())); return base->getSlopeAversionMax(); } } @@ -415,9 +415,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getSlopeAversionMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -434,7 +434,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -450,26 +450,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getHoverValue(true); #endif } if (!m_hoverValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter hoverValue in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter hoverValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter hoverValue has not been defined in template %s!", DataResource::getName())); return base->getHoverValue(); } } @@ -479,9 +479,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getHoverValue(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -498,7 +498,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -514,26 +514,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getHoverValueMin(true); #endif } if (!m_hoverValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter hoverValue in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter hoverValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter hoverValue has not been defined in template %s!", DataResource::getName())); return base->getHoverValueMin(); } } @@ -543,9 +543,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getHoverValueMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -562,7 +562,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -578,26 +578,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getHoverValueMax(true); #endif } if (!m_hoverValue.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter hoverValue in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter hoverValue has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter hoverValue has not been defined in template %s!", DataResource::getName())); return base->getHoverValueMax(); } } @@ -607,9 +607,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getHoverValueMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -626,7 +626,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -642,26 +642,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTurnRate(true); #endif } if (!m_turnRate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter turnRate in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter turnRate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter turnRate has not been defined in template %s!", DataResource::getName())); return base->getTurnRate(); } } @@ -671,9 +671,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTurnRate(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -690,7 +690,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -706,26 +706,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTurnRateMin(true); #endif } if (!m_turnRate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter turnRate in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter turnRate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter turnRate has not been defined in template %s!", DataResource::getName())); return base->getTurnRateMin(); } } @@ -735,9 +735,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTurnRateMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -754,7 +754,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -770,26 +770,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getTurnRateMax(true); #endif } if (!m_turnRate.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter turnRate in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter turnRate has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter turnRate has not been defined in template %s!", DataResource::getName())); return base->getTurnRateMax(); } } @@ -799,9 +799,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getTurnRateMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -818,7 +818,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -834,26 +834,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxVelocity(true); #endif } if (!m_maxVelocity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxVelocity in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxVelocity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxVelocity has not been defined in template %s!", DataResource::getName())); return base->getMaxVelocity(); } } @@ -863,9 +863,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxVelocity(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -882,7 +882,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -898,26 +898,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxVelocityMin(true); #endif } if (!m_maxVelocity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxVelocity in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxVelocity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxVelocity has not been defined in template %s!", DataResource::getName())); return base->getMaxVelocityMin(); } } @@ -927,9 +927,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxVelocityMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -946,7 +946,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -962,26 +962,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getMaxVelocityMax(true); #endif } if (!m_maxVelocity.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter maxVelocity in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter maxVelocity has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter maxVelocity has not been defined in template %s!", DataResource::getName())); return base->getMaxVelocityMax(); } } @@ -991,9 +991,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getMaxVelocityMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1010,7 +1010,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1026,26 +1026,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAcceleration(true); #endif } if (!m_acceleration.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter acceleration in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter acceleration has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter acceleration has not been defined in template %s!", DataResource::getName())); return base->getAcceleration(); } } @@ -1055,9 +1055,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAcceleration(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1074,7 +1074,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1090,26 +1090,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAccelerationMin(true); #endif } if (!m_acceleration.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter acceleration in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter acceleration has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter acceleration has not been defined in template %s!", DataResource::getName())); return base->getAccelerationMin(); } } @@ -1119,9 +1119,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAccelerationMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1138,7 +1138,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1154,26 +1154,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAccelerationMax(true); #endif } if (!m_acceleration.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter acceleration in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter acceleration has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter acceleration has not been defined in template %s!", DataResource::getName())); return base->getAccelerationMax(); } } @@ -1183,9 +1183,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getAccelerationMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1202,7 +1202,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1218,26 +1218,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getBraking(true); #endif } if (!m_braking.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter braking in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter braking has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter braking has not been defined in template %s!", DataResource::getName())); return base->getBraking(); } } @@ -1247,9 +1247,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getBraking(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1266,7 +1266,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1282,26 +1282,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getBrakingMin(true); #endif } if (!m_braking.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter braking in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter braking has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter braking has not been defined in template %s!", DataResource::getName())); return base->getBrakingMin(); } } @@ -1311,9 +1311,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getBrakingMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1330,7 +1330,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1346,26 +1346,26 @@ float testDataValue = 0.0f; UNREF(testData); #endif - const SharedVehicleObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedVehicleObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getBrakingMax(true); #endif } if (!m_braking.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter braking in template %s", DataResource::getName())); return 0.0f; } else { - DEBUG_FATAL(base == NULL, ("Template parameter braking has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter braking has not been defined in template %s!", DataResource::getName())); return base->getBrakingMax(); } } @@ -1375,9 +1375,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { float baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getBrakingMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -1394,7 +1394,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -1451,12 +1451,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWaypointObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWaypointObjectTemplate.cpp index 71ef4b39..2d82cd46 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWaypointObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWaypointObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedWaypointObjectTemplate::getTemplateVersion(void) const */ Tag SharedWaypointObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedWaypointObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedWaypointObjectTemplate::getHighestTemplateVersion @@ -140,12 +140,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWeaponObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWeaponObjectTemplate.cpp index 7c9fa977..193d4ac7 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWeaponObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWeaponObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag SharedWeaponObjectTemplate::getTemplateVersion(void) const */ Tag SharedWeaponObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedWeaponObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedWeaponObjectTemplate::getHighestTemplateVersion @@ -111,33 +111,33 @@ std::string testDataValue = DefaultString; UNREF(testData); #endif - const SharedWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getWeaponEffect(true); #endif } if (!m_weaponEffect.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter weaponEffect in template %s", DataResource::getName())); return DefaultString; } else { - DEBUG_FATAL(base == NULL, ("Template parameter weaponEffect has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter weaponEffect has not been defined in template %s!", DataResource::getName())); return base->getWeaponEffect(); } } const std::string & value = m_weaponEffect.getValue(); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -153,26 +153,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getWeaponEffectIndex(true); #endif } if (!m_weaponEffectIndex.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter weaponEffectIndex in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter weaponEffectIndex has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter weaponEffectIndex has not been defined in template %s!", DataResource::getName())); return base->getWeaponEffectIndex(); } } @@ -182,9 +182,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getWeaponEffectIndex(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -201,7 +201,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -217,26 +217,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getWeaponEffectIndexMin(true); #endif } if (!m_weaponEffectIndex.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter weaponEffectIndex in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter weaponEffectIndex has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter weaponEffectIndex has not been defined in template %s!", DataResource::getName())); return base->getWeaponEffectIndexMin(); } } @@ -246,9 +246,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getWeaponEffectIndexMin(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -265,7 +265,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -281,26 +281,26 @@ int testDataValue = 0; UNREF(testData); #endif - const SharedWeaponObjectTemplate * base = NULL; - if (m_baseData != NULL) + const SharedWeaponObjectTemplate * base = nullptr; + if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getWeaponEffectIndexMax(true); #endif } if (!m_weaponEffectIndex.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter weaponEffectIndex in template %s", DataResource::getName())); return 0; } else { - DEBUG_FATAL(base == NULL, ("Template parameter weaponEffectIndex has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter weaponEffectIndex has not been defined in template %s!", DataResource::getName())); return base->getWeaponEffectIndexMax(); } } @@ -310,9 +310,9 @@ UNREF(testData); if (delta == '+' || delta == '-' || delta == '_' || delta == '=') { int baseValue = 0; - if (m_baseData != NULL) + if (m_baseData != nullptr) { - if (base != NULL) + if (base != nullptr) baseValue = base->getWeaponEffectIndexMax(); else if (ms_allowDefaultTemplateParams) DEBUG_WARNING(true, ("No base template for delta, using 0")); @@ -329,7 +329,7 @@ UNREF(testData); value = baseValue - static_cast(baseValue * (value / 100.0f)); } #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -345,33 +345,33 @@ SharedWeaponObjectTemplate::AttackType testDataValue = static_cast(m_baseData); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) testDataValue = base->getAttackType(true); #endif } if (!m_attackType.isLoaded()) { - if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) + if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attackType in template %s", DataResource::getName())); return static_cast(0); } else { - DEBUG_FATAL(base == NULL, ("Template parameter attackType has not been defined in template %s!", DataResource::getName())); + DEBUG_FATAL(base == nullptr, ("Template parameter attackType has not been defined in template %s!", DataResource::getName())); return base->getAttackType(); } } AttackType value = static_cast(m_attackType.getValue()); #ifdef _DEBUG - if (testData && base != NULL) + if (testData && base != nullptr) { } #endif @@ -420,12 +420,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedGame/src/shared/quest/Quest.cpp b/engine/shared/library/sharedGame/src/shared/quest/Quest.cpp index 7cfaccef..14d2fcab 100755 --- a/engine/shared/library/sharedGame/src/shared/quest/Quest.cpp +++ b/engine/shared/library/sharedGame/src/shared/quest/Quest.cpp @@ -358,7 +358,7 @@ int Quest::getNumberOfTasks() const QuestTask const * Quest::getTask(int const taskId) const { if (taskId < 0 || taskId >= getNumberOfTasks()) - return NULL; + return nullptr; return (*m_tasks)[static_cast(taskId)]; } diff --git a/engine/shared/library/sharedGame/src/shared/quest/QuestManager.cpp b/engine/shared/library/sharedGame/src/shared/quest/QuestManager.cpp index ef210b43..3ba36a15 100755 --- a/engine/shared/library/sharedGame/src/shared/quest/QuestManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/quest/QuestManager.cpp @@ -192,7 +192,7 @@ void QuestManager::remove() Quest const * QuestManager::getQuest(CrcString const & fileName) { Quest const * const quest = getQuest(fileName.getCrc()); - DEBUG_WARNING(quest == NULL, ("QuestManager::getQuest(%s): FAILED - testquest not found", fileName.getString())); + DEBUG_WARNING(quest == nullptr, ("QuestManager::getQuest(%s): FAILED - testquest not found", fileName.getString())); return quest; } @@ -200,7 +200,7 @@ Quest const * QuestManager::getQuest(CrcString const & fileName) Quest const * QuestManager::getQuest(uint32 const questCrc) { - Quest * quest = NULL; + Quest * quest = nullptr; //-- Look for the quest in the quest map QuestMap::iterator const iter = s_quests.find(questCrc); @@ -223,7 +223,7 @@ Quest const * QuestManager::getQuest(uint32 const questCrc) } } - DEBUG_WARNING(quest == NULL, ("QuestManager::getQuest: FAILED - testquest not found")); + DEBUG_WARNING(quest == nullptr, ("QuestManager::getQuest: FAILED - testquest not found")); return quest; } @@ -234,7 +234,7 @@ Quest const * QuestManager::getQuest(std::string const & questName) { TemporaryCrcString const fileName(questName.c_str(), true); Quest const * const quest = getQuest(fileName); - DEBUG_WARNING(quest == NULL, ("QuestManager::getQuest(%s): FAILED - testquest not found", questName.c_str())); + DEBUG_WARNING(quest == nullptr, ("QuestManager::getQuest(%s): FAILED - testquest not found", questName.c_str())); return quest; } diff --git a/engine/shared/library/sharedGame/src/shared/space/AsteroidGenerationManager.cpp b/engine/shared/library/sharedGame/src/shared/space/AsteroidGenerationManager.cpp index 26b912b2..2fabba5e 100755 --- a/engine/shared/library/sharedGame/src/shared/space/AsteroidGenerationManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/space/AsteroidGenerationManager.cpp @@ -79,7 +79,7 @@ void AsteroidGenerationManager::install() DEBUG_FATAL(s_installed, ("AsteroidGenerationManager already installed")); s_installed = true; - ms_getRadiusFunction = NULL; + ms_getRadiusFunction = nullptr; ExitChain::add(AsteroidGenerationManager::remove, "AsteroidGenerationManager::remove"); } @@ -88,7 +88,7 @@ void AsteroidGenerationManager::install() void AsteroidGenerationManager::remove() { - ms_getRadiusFunction = NULL; + ms_getRadiusFunction = nullptr; clearStaticFieldData(); clearInstantiatedData(); @@ -381,7 +381,7 @@ bool AsteroidGenerationManager::generateField(AsteroidFieldData const & fieldDat s_randomGenerator.setSeed(fieldData.seed); - WaveForm3D * splineWaveform = NULL; + WaveForm3D * splineWaveform = nullptr; if (fieldData.fieldType == AsteroidFieldData::FT_spline) { splineWaveform = new WaveForm3D; @@ -403,7 +403,7 @@ bool AsteroidGenerationManager::generateField(AsteroidFieldData const & fieldDat { bool valid = false; std::vector collisionResult; - Sphere * s = NULL; + Sphere * s = nullptr; while(!valid) { //create asteroid locations until we find one that doesn't penetrate any existing objects @@ -444,11 +444,11 @@ bool AsteroidGenerationManager::generateField(AsteroidFieldData const & fieldDat { DEBUG_REPORT_LOG_PRINT(ConfigSharedGame::getSpamAsteroidGenerationData(), ("Asteroid creation collision at [%f, %f, %f], radius [%f], trying again...\n", newAsteroid.position.x, newAsteroid.position.y, newAsteroid.position.z, s->getRadius())); delete s; - s = NULL; + s = nullptr; } } - NOT_NULL(s); //lint !e644 // s could be uninitialized (not true -- initialized to NULL above, should be set to a value during the while loop) + NOT_NULL(s); //lint !e644 // s could be uninitialized (not true -- initialized to nullptr above, should be set to a value during the while loop) SpatialSubdivisionHandle* handle = ms_collisionSphereTree.addObject(s); if(handle) diff --git a/engine/shared/library/sharedGame/src/shared/space/NebulaManager.cpp b/engine/shared/library/sharedGame/src/shared/space/NebulaManager.cpp index 803c5a76..e48dc276 100755 --- a/engine/shared/library/sharedGame/src/shared/space/NebulaManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/space/NebulaManager.cpp @@ -52,7 +52,7 @@ namespace NebulaManagerNamespace }; typedef SphereTree NebulaSphereTree; - NebulaSphereTree * s_collisionSphereTree = NULL; + NebulaSphereTree * s_collisionSphereTree = nullptr; enum DatatableColumns { @@ -110,7 +110,7 @@ namespace NebulaManagerNamespace //---------------------------------------------------------------------- - NebulaManager::ImplementationClearFunction s_clearFunction = NULL; + NebulaManager::ImplementationClearFunction s_clearFunction = nullptr; } using namespace NebulaManagerNamespace; @@ -158,10 +158,10 @@ void NebulaManager::clear() s_nebulaMap.clear(); - if (s_collisionSphereTree != NULL) + if (s_collisionSphereTree != nullptr) { delete s_collisionSphereTree; - s_collisionSphereTree = NULL; + s_collisionSphereTree = nullptr; } //-- Remove nebulas for the current scene from the scene map @@ -178,7 +178,7 @@ void NebulaManager::clear() s_currentSceneId.clear(); - if (s_clearFunction != NULL) + if (s_clearFunction != nullptr) s_clearFunction(); } @@ -319,11 +319,11 @@ void NebulaManager::getNebulasInSphere(Vector const & pos, float const radius, N Nebula const * NebulaManager::getClosestNebula(Vector const & pos, float const maxDistance, float & outMinDistance, float & outMaxDistance) { - Nebula const * nebula = NULL; + Nebula const * nebula = nullptr; if (NON_NULL(s_collisionSphereTree)->findClosest(pos, maxDistance, nebula, outMinDistance, outMaxDistance)) return nebula; - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -334,7 +334,7 @@ Nebula const * NebulaManager::getNebulaById(int const id) if (it != s_nebulaMap.end()) return (*it).second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedGame/src/shared/space/ShipChassis.cpp b/engine/shared/library/sharedGame/src/shared/space/ShipChassis.cpp index ab3b0672..6d014f13 100755 --- a/engine/shared/library/sharedGame/src/shared/space/ShipChassis.cpp +++ b/engine/shared/library/sharedGame/src/shared/space/ShipChassis.cpp @@ -211,7 +211,7 @@ bool ShipChassis::save(std::string const & filename) ShipChassisSlot const * const chassisSlot = shipChassis->getSlot(static_cast(chassisSlotType)); - if (NULL == chassisSlot) + if (nullptr == chassisSlot) { tabStr += "\t\t"; continue; @@ -249,7 +249,7 @@ bool ShipChassis::save(std::string const & filename) StdioFileFactory sff; AbstractFile * const af = sff.createFile(filename.c_str(), "wb"); - if (NULL != af && af->isOpen()) + if (nullptr != af && af->isOpen()) { int const bytesWritten = af->write(static_cast(tabStr.size()), tabStr.c_str()); retval = (bytesWritten == static_cast(tabStr.size())); @@ -317,7 +317,7 @@ ShipChassis const * ShipChassis::findShipChassisByName (CrcString const & if (it != s_nameChassisMap->end ()) return (*it).second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -330,7 +330,7 @@ ShipChassis const * ShipChassis::findShipChassisByCrc (uint32 chassis if (it != s_crcChassisMap.end ()) return (*it).second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -365,7 +365,7 @@ void ShipChassis::setSlotTargetable(int const chassisSlotType, bool targetable) { if (targetable) { - if (NULL == getSlot(static_cast(chassisSlotType))) + if (nullptr == getSlot(static_cast(chassisSlotType))) { WARNING(true, ("ShipChassis cannot set non existant slot [%d] targetable", chassisSlotType)); return; @@ -398,7 +398,7 @@ ShipChassisSlot * ShipChassis::getSlot(ShipChassisSlotType::Type shipChassisSlot return &slot; } - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -582,7 +582,7 @@ void ShipChassis::setUseWritableChassis(bool onlyUseThisForTools) bool ShipChassis::addChassis(bool doSort) { - if (doSort && NULL != findShipChassisByCrc(getCrc())) + if (doSort && nullptr != findShipChassisByCrc(getCrc())) { WARNING(true, ("ShipChassis attempt to add multiple [%s] chassis", getName().getString())); return false; @@ -628,7 +628,7 @@ bool ShipChassis::removeChassis() bool ShipChassis::setName(CrcString const & name) { ShipChassis const * const dupeNameShipChassis = findShipChassisByName(name); - if (NULL != dupeNameShipChassis) + if (nullptr != dupeNameShipChassis) { WARNING(true, ("ShipChassis attempt to set name [%s] already exists", name.getString())); return false; diff --git a/engine/shared/library/sharedGame/src/shared/space/ShipChassisSlot.cpp b/engine/shared/library/sharedGame/src/shared/space/ShipChassisSlot.cpp index dec4fd3e..0830d52c 100755 --- a/engine/shared/library/sharedGame/src/shared/space/ShipChassisSlot.cpp +++ b/engine/shared/library/sharedGame/src/shared/space/ShipChassisSlot.cpp @@ -78,7 +78,7 @@ ShipChassisSlot::~ShipChassisSlot () std::for_each(m_compatibilities->begin(), m_compatibilities->end(), PointerDeleter()); m_compatibilities->clear(); delete m_compatibilities; - m_compatibilities = NULL; + m_compatibilities = nullptr; } //---------------------------------------------------------------------- @@ -145,7 +145,7 @@ bool ShipChassisSlot::canAcceptComponentType (int shipComponentType) const bool ShipChassisSlot::canAcceptCompatibility (CrcString const & compatibility) const { - //-- null compatibility components are universally accepted + //-- nullptr compatibility components are universally accepted if (compatibility.isEmpty ()) return true; diff --git a/engine/shared/library/sharedGame/src/shared/space/ShipChassisWritable.cpp b/engine/shared/library/sharedGame/src/shared/space/ShipChassisWritable.cpp index cfc58a90..b4f2c22a 100755 --- a/engine/shared/library/sharedGame/src/shared/space/ShipChassisWritable.cpp +++ b/engine/shared/library/sharedGame/src/shared/space/ShipChassisWritable.cpp @@ -51,7 +51,7 @@ bool ShipChassisWritable::setName(CrcString const & name) { if (ShipChassis::setName(name)) { - if (NULL != findShipChassisByCrc(name.getCrc())) + if (nullptr != findShipChassisByCrc(name.getCrc())) Transceivers::chassisListChanged.emitMessage(true); return true; } @@ -72,7 +72,7 @@ void ShipChassisWritable::setSlotTargetable(int chassisSlotType, bool targetable { ShipChassisSlot * const chassisSlot = getSlot(static_cast(chassisSlotType)); - if (NULL == chassisSlot) + if (nullptr == chassisSlot) { WARNING(true, ("ShipChassisWritable::setSlotTargetable() invalid slot")); } diff --git a/engine/shared/library/sharedGame/src/shared/space/ShipComponentAttachmentManager.cpp b/engine/shared/library/sharedGame/src/shared/space/ShipComponentAttachmentManager.cpp index 14897909..3a8dbd52 100755 --- a/engine/shared/library/sharedGame/src/shared/space/ShipComponentAttachmentManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/space/ShipComponentAttachmentManager.cpp @@ -164,7 +164,7 @@ void ShipComponentAttachmentManager::load() ShipComponentDescriptor const * const shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByName (TemporaryCrcString (componentName.c_str (), true)); - if (shipComponentDescriptor == NULL) + if (shipComponentDescriptor == nullptr) { WARNING (true, ("ShipComponentAttachmentManager chassis [%s] specified invalid component [%s] at row [%d] in file [%s]", name.getString (), componentName.c_str (), row, chassis_filename.c_str())); continue; @@ -266,7 +266,7 @@ bool ShipComponentAttachmentManager::save(std::string const & dsrcPath, std::str bool ShipComponentAttachmentManager::saveChassisInfo(std::string const & chassisName, std::string const & filenameTab, std::string const & filenameIff) { ShipChassis const * const chassis = ShipChassis::findShipChassisByName(ConstCharCrcString(chassisName.c_str())); - if (NULL == chassis) + if (nullptr == chassis) return false; uint32 const chassisCrc = chassis->getCrc(); @@ -283,7 +283,7 @@ bool ShipComponentAttachmentManager::saveChassisInfo(std::string const & chassis std::string const & componentName = *it; ShipComponentDescriptor const * const shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByName(ConstCharCrcString(componentName.c_str())); - if (NULL == shipComponentDescriptor) + if (nullptr == shipComponentDescriptor) return false; uint32 const componentCrc = shipComponentDescriptor->getCrc(); @@ -333,7 +333,7 @@ bool ShipComponentAttachmentManager::saveChassisInfo(std::string const & chassis std::string const & componentName = *it; ShipComponentDescriptor const * const shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByName(ConstCharCrcString(componentName.c_str())); - if (NULL == shipComponentDescriptor) + if (nullptr == shipComponentDescriptor) return false; uint32 const componentCrc = shipComponentDescriptor->getCrc(); @@ -427,7 +427,7 @@ bool ShipComponentAttachmentManager::saveChassisInfo(std::string const & chassis StdioFileFactory sff; AbstractFile * const af = sff.createFile(filenameTab.c_str(), "wb"); - if (NULL != af && af->isOpen()) + if (nullptr != af && af->isOpen()) { int const bytesWritten = af->write(static_cast(tabStr.size()), tabStr.c_str()); retval = (bytesWritten == static_cast(tabStr.size())); @@ -484,7 +484,7 @@ bool ShipComponentAttachmentManager::getAttachmentsForShip(uint32 chassisCrc, ui TemplateHardpointPairVector const & thpv = (*it).second; if (thpv.empty()) { - thpVectors[i] = NULL; + thpVectors[i] = nullptr; } else { @@ -493,7 +493,7 @@ bool ShipComponentAttachmentManager::getAttachmentsForShip(uint32 chassisCrc, ui } } else - thpVectors[i] = NULL; + thpVectors[i] = nullptr; } return found; diff --git a/engine/shared/library/sharedGame/src/shared/space/ShipComponentData.cpp b/engine/shared/library/sharedGame/src/shared/space/ShipComponentData.cpp index 78a26512..ae4882b5 100755 --- a/engine/shared/library/sharedGame/src/shared/space/ShipComponentData.cpp +++ b/engine/shared/library/sharedGame/src/shared/space/ShipComponentData.cpp @@ -53,7 +53,7 @@ ShipComponentData::~ShipComponentData () void ShipComponentData::printDebugString (Unicode::String & result, Unicode::String const & padding) const { - if (m_descriptor == NULL) + if (m_descriptor == nullptr) return; char buf [2048]; diff --git a/engine/shared/library/sharedGame/src/shared/space/ShipComponentDescriptor.cpp b/engine/shared/library/sharedGame/src/shared/space/ShipComponentDescriptor.cpp index 5c3560f0..b9e021b4 100755 --- a/engine/shared/library/sharedGame/src/shared/space/ShipComponentDescriptor.cpp +++ b/engine/shared/library/sharedGame/src/shared/space/ShipComponentDescriptor.cpp @@ -115,7 +115,7 @@ void ShipComponentDescriptor::load() DEBUG_WARNING(!sharedTemplateName.empty() && sharedCrcString.isEmpty(), ("Data error: in ship_components.tab - Component [%s] Shared template [%s] not found for row [%d]", name.c_str(), sharedTemplateName.c_str(), row)); #endif - ShipComponentDescriptor * componentDescriptor = NULL; + ShipComponentDescriptor * componentDescriptor = nullptr; if (s_useWritableComponentDescriptor) componentDescriptor = new ShipComponentDescriptorWritable (TemporaryCrcString (name.c_str (), true), type, TemporaryCrcString (compatibility.c_str (), true), serverObjectTemplateName, sharedTemplateName); @@ -174,7 +174,7 @@ bool ShipComponentDescriptor::save(std::string const & filename) StdioFileFactory sff; AbstractFile * const af = sff.createFile(filename.c_str(), "wb"); - if (NULL != af && af->isOpen()) + if (nullptr != af && af->isOpen()) { int const bytesWritten = af->write(static_cast(tabStr.size()), tabStr.c_str()); retval = (bytesWritten == static_cast(tabStr.size())); @@ -285,7 +285,7 @@ ShipComponentDescriptor const * ShipComponentDescriptor::findShipComponentDescri if (it != s_crcComponentMap.end ()) return (*it).second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -297,7 +297,7 @@ ShipComponentDescriptor const * ShipComponentDescriptor::findShipComponentDescri if (it != s_nameComponentMap->end ()) return (*it).second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -309,7 +309,7 @@ ShipComponentDescriptor const * ShipComponentDescriptor::findShipComponentDescri if (it != s_objectTemplateCrcComponentMap.end ()) return (*it).second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -321,7 +321,7 @@ ShipComponentDescriptor const * ShipComponentDescriptor::findShipComponentDescri if (it != s_sharedObjectTemplateCrcComponentMap.end ()) return (*it).second; - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -348,7 +348,7 @@ ShipComponentDescriptor::StringVector ShipComponentDescriptor::getComponentDescr bool ShipComponentDescriptor::setName(std::string const & name) { ShipComponentDescriptor const * const dupeNameShipComponentDescriptor = findShipComponentDescriptorByName(ConstCharCrcString(name.c_str())); - if (NULL != dupeNameShipComponentDescriptor) + if (nullptr != dupeNameShipComponentDescriptor) { WARNING(true, ("ShipComponentDescriptor attempt to set name [%s] already exists", name.c_str())); return false; @@ -379,14 +379,14 @@ bool ShipComponentDescriptor::setName(std::string const & name) bool ShipComponentDescriptor::setObjectTemplateCrcs(uint32 crc, uint32 sharedCrc) { ShipComponentDescriptor const * const dupeTemplateShipComponentDescriptor = findShipComponentDescriptorByObjectTemplate(crc); - if (NULL != dupeTemplateShipComponentDescriptor && this != dupeTemplateShipComponentDescriptor) + if (nullptr != dupeTemplateShipComponentDescriptor && this != dupeTemplateShipComponentDescriptor) { WARNING(true, ("ShipComponentDescriptor attempt to set ot crc [%s] already exists", dupeTemplateShipComponentDescriptor->getName().getString())); return false; } ShipComponentDescriptor const * const dupeSharedTemplateShipComponentDescriptor = findShipComponentDescriptorBySharedObjectTemplate(crc); - if (NULL != dupeSharedTemplateShipComponentDescriptor && this != dupeSharedTemplateShipComponentDescriptor) + if (nullptr != dupeSharedTemplateShipComponentDescriptor && this != dupeSharedTemplateShipComponentDescriptor) { WARNING(true, ("ShipComponentDescriptor attempt to set shared ot crc [%s] already exists", dupeSharedTemplateShipComponentDescriptor->getName().getString())); return false; @@ -432,7 +432,7 @@ bool ShipComponentDescriptor::addShipComponentDescriptor(bool checkValidity, boo { { ShipComponentDescriptor const * const shipComponentDescriptor = findShipComponentDescriptorByName(m_name); - if (NULL != shipComponentDescriptor) + if (nullptr != shipComponentDescriptor) { WARNING(true, ("ShipComponentDescriptor::addShipComponentDescriptor name [%s] is already in map", m_name.getString())); return false; @@ -441,7 +441,7 @@ bool ShipComponentDescriptor::addShipComponentDescriptor(bool checkValidity, boo { ShipComponentDescriptor const * const shipComponentDescriptor = findShipComponentDescriptorByCrc(getCrc()); - if (NULL != shipComponentDescriptor) + if (nullptr != shipComponentDescriptor) { WARNING(true, ("ShipComponentDescriptor::addShipComponentDescriptor [%s] crc [0x%x] is already in map via [%s]", m_name.getString(), static_cast(getCrc()), shipComponentDescriptor->getName().getString())); return false; @@ -453,7 +453,7 @@ bool ShipComponentDescriptor::addShipComponentDescriptor(bool checkValidity, boo if (0 != objectTemplateCrc) { ShipComponentDescriptor const * const shipComponentDescriptor = findShipComponentDescriptorByObjectTemplate(objectTemplateCrc); - if (NULL != shipComponentDescriptor) + if (nullptr != shipComponentDescriptor) { WARNING(true, ("ShipComponentDescriptor::addShipComponentDescriptor [%s] server template [%s] [0x%x] is already in map via [%s]", m_name.getString(), getObjectTemplateName().c_str(), static_cast(getObjectTemplateCrc()), shipComponentDescriptor->getName().getString())); if (strict) @@ -467,7 +467,7 @@ bool ShipComponentDescriptor::addShipComponentDescriptor(bool checkValidity, boo if (0 != sharedObjectTemplateCrc) { ShipComponentDescriptor const * const shipComponentDescriptor = findShipComponentDescriptorBySharedObjectTemplate(sharedObjectTemplateCrc); - if (NULL != shipComponentDescriptor) + if (nullptr != shipComponentDescriptor) { WARNING(true, ("ShipComponentDescriptor::addShipComponentDescriptor [%s] shared template [%s] [0x%x] is already in map via [%s]", m_name.getString(), getSharedTemplateName().c_str(), static_cast(getSharedObjectTemplateCrc()), shipComponentDescriptor->getName().getString())); if (strict) diff --git a/engine/shared/library/sharedGame/src/shared/space/ShipComponentDescriptorWritable.cpp b/engine/shared/library/sharedGame/src/shared/space/ShipComponentDescriptorWritable.cpp index 8e3cf0fb..aa3e25a3 100755 --- a/engine/shared/library/sharedGame/src/shared/space/ShipComponentDescriptorWritable.cpp +++ b/engine/shared/library/sharedGame/src/shared/space/ShipComponentDescriptorWritable.cpp @@ -85,7 +85,7 @@ bool ShipComponentDescriptorWritable::setName(std::string const & name) { if (ShipComponentDescriptor::setName(name)) { - if (NULL != ShipComponentDescriptor::findShipComponentDescriptorByCrc(Crc::normalizeAndCalculate(name.c_str()))) + if (nullptr != ShipComponentDescriptor::findShipComponentDescriptorByCrc(Crc::normalizeAndCalculate(name.c_str()))) { notifyChanged(); Transceivers::componentListChanged.emitMessage(true); diff --git a/engine/shared/library/sharedGame/src/shared/space/ShipComponentWeaponManager.cpp b/engine/shared/library/sharedGame/src/shared/space/ShipComponentWeaponManager.cpp index 4e6559c7..f929434c 100755 --- a/engine/shared/library/sharedGame/src/shared/space/ShipComponentWeaponManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/space/ShipComponentWeaponManager.cpp @@ -76,7 +76,7 @@ void ShipComponentWeaponManager::install() DataTable * const dt = DataTableManager::getTable(filename, true); - if (dt == NULL) + if (dt == nullptr) { WARNING(true, ("ShipComponentWeaponManager no such datatable [%s]", filename.c_str())); return; @@ -90,7 +90,7 @@ void ShipComponentWeaponManager::install() ShipComponentDescriptor const * const shipComponentDescriptor = ShipComponentDescriptor::findShipComponentDescriptorByName(TemporaryCrcString(componentName.c_str(), true)); - if (shipComponentDescriptor == NULL) + if (shipComponentDescriptor == nullptr) { WARNING(true, ("getComponentType datatable specified invalid component [%s]", componentName.c_str())); continue; diff --git a/engine/shared/library/sharedGame/src/shared/sui/SuiPageData.cpp b/engine/shared/library/sharedGame/src/shared/sui/SuiPageData.cpp index c0941d98..92c8403c 100755 --- a/engine/shared/library/sharedGame/src/shared/sui/SuiPageData.cpp +++ b/engine/shared/library/sharedGame/src/shared/sui/SuiPageData.cpp @@ -93,7 +93,7 @@ bool SuiPageData::addCommand(SuiCommand const & command) SuiCommand const * const oldCommand = findSubscribeToEventCommand(eventType, targetWidget); - if (oldCommand != NULL) + if (oldCommand != nullptr) { WARNING(true, ("SuiPageData::addCommand attempt to add duplicate SCT_subscribeToEvent command. Type=[%d], target=[%s]", eventType, targetWidget.c_str())); return false; @@ -130,7 +130,7 @@ void SuiPageData::subscribeToPropertyForEvent(int eventType, std::string const & { SuiCommand * const command = findSubscribeToEventCommand(eventType, eventWidgetName); - if (command == NULL) + if (command == nullptr) { SuiCommand newCommand(SuiCommand::SCT_subscribeToEvent, eventWidgetName); newCommand.initSubscribeToEvent(eventType, std::string()); @@ -148,7 +148,7 @@ bool SuiPageData::subscribeToEvent(int eventType, std::string const & eventWidge { SuiCommand * const command = findSubscribeToEventCommand(eventType, eventWidgetName); - if (command == NULL) + if (command == nullptr) { SuiCommand newCommand(SuiCommand::SCT_subscribeToEvent, eventWidgetName); newCommand.initSubscribeToEvent(eventType, callback); @@ -182,7 +182,7 @@ SuiCommand * SuiPageData::findSubscribeToEventCommand(int const eventType, std:: } } - return NULL; + return nullptr; } //---------------------------------------------------------------------- @@ -203,7 +203,7 @@ SuiCommand * SuiPageData::findSubscribeToEventCommandByIndex(int const index) } } - return NULL; + return nullptr; } //---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedImage/src/shared/TargaFormat.cpp b/engine/shared/library/sharedImage/src/shared/TargaFormat.cpp index 3957c9ab..e8f6f545 100755 --- a/engine/shared/library/sharedImage/src/shared/TargaFormat.cpp +++ b/engine/shared/library/sharedImage/src/shared/TargaFormat.cpp @@ -224,7 +224,7 @@ bool TargaFormat::loadImage(const char *filename, Image **image) const if (!image) { - REPORT_LOG(true, ("TargaFormat::loadImage(): null image pointer\n")); + REPORT_LOG(true, ("TargaFormat::loadImage(): nullptr image pointer\n")); return false; } *image = 0; @@ -257,7 +257,7 @@ bool TargaFormat::loadImageReformat(const char *filename, Image **image, Image:: if (!image) { - REPORT_LOG(true, ("TargaFormat::loadImage(): null image pointer\n")); + REPORT_LOG(true, ("TargaFormat::loadImage(): nullptr image pointer\n")); return false; } *image = 0; diff --git a/engine/shared/library/sharedIoWin/src/shared/IoWin.cpp b/engine/shared/library/sharedIoWin/src/shared/IoWin.cpp index 2d4eff3e..3cb565b1 100755 --- a/engine/shared/library/sharedIoWin/src/shared/IoWin.cpp +++ b/engine/shared/library/sharedIoWin/src/shared/IoWin.cpp @@ -22,7 +22,7 @@ IoWin::IoWin( const char *debugName // Name used for debugging purposes ) : ioDebugName(DuplicateString(debugName)), - ioNext(NULL) + ioNext(nullptr) { } @@ -37,9 +37,9 @@ IoWin::IoWin( IoWin::~IoWin(void) { delete [] ioDebugName; - ioDebugName = NULL; + ioDebugName = nullptr; - ioNext = NULL; + ioNext = nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedIoWin/src/shared/IoWinManager.cpp b/engine/shared/library/sharedIoWin/src/shared/IoWinManager.cpp index 5fc8ea5e..11da17d5 100755 --- a/engine/shared/library/sharedIoWin/src/shared/IoWinManager.cpp +++ b/engine/shared/library/sharedIoWin/src/shared/IoWinManager.cpp @@ -35,7 +35,7 @@ namespace IoWinManagerNamespace // Inactivity timer. float const s_defaultInactivityTimeSeconds = 15.0f * 60.0f; - IoWinManager::InactivityCallback s_inactivityCallback = NULL; + IoWinManager::InactivityCallback s_inactivityCallback = nullptr; Timer s_inactivityTimer(s_defaultInactivityTimeSeconds); bool s_isInactive = true; @@ -76,7 +76,7 @@ void IoWinManagerNamespace::triggerInactive(bool inactive) { if (!boolEqual(s_isInactive, inactive)) { - if (s_inactivityCallback != NULL) + if (s_inactivityCallback != nullptr) { (*s_inactivityCallback)(inactive); } @@ -105,7 +105,7 @@ IoEvent *IoWinManager::firstEvent; IoEvent *IoWinManager::lastEvent; MemoryBlockManager *IoWinManager::eventBlockManager; -IoWinManager::IMEFunctionPointer IoWinManager::imeFunction = NULL; +IoWinManager::IMEFunctionPointer IoWinManager::imeFunction = nullptr; // ====================================================================== // Install the IoWinManager @@ -122,8 +122,8 @@ IoWinManager::IMEFunctionPointer IoWinManager::imeFunction = NULL; void IoWinManager::install() { DEBUG_FATAL(installed, ("double install")); - top = NULL; - captured = NULL; + top = nullptr; + captured = nullptr; ExitChain::add(IoWinManager::remove, "IoWinManager::remove"); eventBlockManager = new MemoryBlockManager("IoWinManager eventBlockManager", true, sizeof(IoEvent), 0, 0, 0); installed = true; @@ -162,9 +162,9 @@ void IoWinManager::remove(void) IoResult result; IoEvent *event; - Os::setQueueCharacterHookFunction(NULL); - Os::setSetSystemMouseCursorPositionHookFunction(NULL); - Os::setQueueKeyDownHookFunction(NULL); + Os::setQueueCharacterHookFunction(nullptr); + Os::setSetSystemMouseCursorPositionHookFunction(nullptr); + Os::setQueueKeyDownHookFunction(nullptr); DEBUG_FATAL(!installed, ("not installed")); installed = false; @@ -191,7 +191,7 @@ void IoWinManager::remove(void) delete eventBlockManager; // Remove the inactivity timer. - registerInactivityCallback(NULL, 0.0f); + registerInactivityCallback(nullptr, 0.0f); } // ---------------------------------------------------------------------- @@ -229,10 +229,10 @@ void IoWinManager::debugReport() void IoWinManager::processEvents(float elapsedTime) { - IoWin * w = NULL; - IoWin * next = NULL; - IoEvent * queue = NULL; - IoEvent * event = NULL; + IoWin * w = nullptr; + IoWin * next = nullptr; + IoEvent * queue = nullptr; + IoEvent * event = nullptr; IoResult result; @@ -244,8 +244,8 @@ void IoWinManager::processEvents(float elapsedTime) queue->next = firstEvent; // the event list is now empty - firstEvent = NULL; - lastEvent = NULL; + firstEvent = nullptr; + lastEvent = nullptr; // Update the activity timer. if (!s_isInactive) @@ -267,7 +267,7 @@ void IoWinManager::processEvents(float elapsedTime) queue = queue->next; // keep people from peeking ahead in the event queue - event->next = NULL; + event->next = nullptr; // Check to see if the event resets @@ -310,7 +310,7 @@ void IoWinManager::processEvents(float elapsedTime) if (debugReportEvents) { - const char *name = NULL; + const char *name = nullptr; switch (event->type) { @@ -434,7 +434,7 @@ void IoWinManager::open(IoWin *window) // validate the arguments if (!window) { - DEBUG_FATAL(true, ("null window")); + DEBUG_FATAL(true, ("nullptr window")); return; //lint !e527 // Warning -- Unreachable } @@ -511,13 +511,13 @@ void IoWinManager::close(IoWin *window, bool allowDelete) // validate the arguments if (!window) { - DEBUG_FATAL(true, ("null window")); + DEBUG_FATAL(true, ("nullptr window")); return; //lint !e527 // Warning -- Unreachable } // linked list traversal with a back pointer IoWin *back, *front; - for (back = NULL, front = top; front && front != window; back = front, front = front->ioNext) + for (back = nullptr, front = top; front && front != window; back = front, front = front->ioNext) ; // verify the window was found @@ -528,7 +528,7 @@ void IoWinManager::close(IoWin *window, bool allowDelete) } // -qq- lint hack - DEBUG_FATAL(!window, ("null window")); + DEBUG_FATAL(!window, ("nullptr window")); // remove it from the singly linked list if (back) @@ -566,7 +566,7 @@ IoEvent *IoWinManager::newEvent(IoEventType eventType, int arg1, int arg2, real IoEvent * const event = reinterpret_cast(eventBlockManager->allocate()); // fill out the event data - event->next = NULL; + event->next = nullptr; event->type = eventType; event->arg1 = arg1; event->arg2 = arg2; diff --git a/engine/shared/library/sharedIoWin/src/shared/IoWinManager.h b/engine/shared/library/sharedIoWin/src/shared/IoWinManager.h index d0b90b2b..6965393d 100755 --- a/engine/shared/library/sharedIoWin/src/shared/IoWinManager.h +++ b/engine/shared/library/sharedIoWin/src/shared/IoWinManager.h @@ -131,7 +131,7 @@ public: inline bool IoWinManager::haveWindow(void) { - return (top != NULL); + return (top != nullptr); } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedMath/src/shared/MxCifQuadTree.cpp b/engine/shared/library/sharedMath/src/shared/MxCifQuadTree.cpp index 0b77b2ec..92241997 100755 --- a/engine/shared/library/sharedMath/src/shared/MxCifQuadTree.cpp +++ b/engine/shared/library/sharedMath/src/shared/MxCifQuadTree.cpp @@ -32,10 +32,10 @@ MxCifQuadTree::MxCifQuadTree(float minX, float minY, float maxX, float maxY, int m_centerX((m_maxX - m_minX) / 2.0f + m_minX), m_centerY((m_maxY - m_minY) / 2.0f + m_minY), m_maxDepth(maxDepth), - m_urTree(NULL), - m_ulTree(NULL), - m_llTree(NULL), - m_lrTree(NULL), + m_urTree(nullptr), + m_ulTree(nullptr), + m_llTree(nullptr), + m_lrTree(nullptr), m_xAxisTree(minX, maxX, maxDepth), m_yAxisTree(minY, maxY, maxDepth) { @@ -49,13 +49,13 @@ MxCifQuadTree::MxCifQuadTree(float minX, float minY, float maxX, float maxY, int MxCifQuadTree::~MxCifQuadTree() { delete m_urTree; - m_urTree = NULL; + m_urTree = nullptr; delete m_ulTree; - m_ulTree = NULL; + m_ulTree = nullptr; delete m_llTree; - m_llTree = NULL; + m_llTree = nullptr; delete m_lrTree; - m_lrTree = NULL; + m_lrTree = nullptr; } // MxCifQuadTree::~MxCifQuadTree //------------------------------------------------------------------------------ @@ -99,7 +99,7 @@ bool MxCifQuadTree::addObject(const MxCifQuadTreeBounds & object) // try putting the object in a child node if (m_maxDepth > 1) { - if (m_urTree == NULL) + if (m_urTree == nullptr) { if (!split()) return false; @@ -158,7 +158,7 @@ bool MxCifQuadTree::removeObject(const MxCifQuadTreeBounds & object) { if (m_maxDepth > 1) { - if (m_urTree != NULL) + if (m_urTree != nullptr) { // check if the object is in a sub-node if (m_urTree->removeObject(object) || @@ -212,7 +212,7 @@ void MxCifQuadTree::getObjectsAt(float x, float y, y >= m_minY) { // if we have sub-trees, pass the point to the tree that contains it - if (m_urTree != NULL) + if (m_urTree != nullptr) { if (x >= m_centerX && y >= m_centerY) m_urTree->getObjectsAt(x, y, objects); @@ -239,7 +239,7 @@ void MxCifQuadTree::getObjectsAt(float x, float y, void MxCifQuadTree::getAllObjects(std::vector & objects) const { // if we have sub-trees, pass the point to the tree that contains it - if (m_urTree != NULL) + if (m_urTree != nullptr) { m_urTree->getAllObjects(objects); m_ulTree->getAllObjects(objects); @@ -265,8 +265,8 @@ MxCifQuadTree::MxCifBinTree::MxCifBinTree(float min, float max, int maxDepth) : m_max(max), m_center((max - min) / 2.0f + min), m_maxDepth(maxDepth), - m_left(NULL), - m_right(NULL), + m_left(nullptr), + m_right(nullptr), m_objects() { } // MxCifBinTree::MxCifBinTree @@ -277,9 +277,9 @@ MxCifQuadTree::MxCifBinTree::MxCifBinTree(float min, float max, int maxDepth) : MxCifQuadTree::MxCifBinTree::~MxCifBinTree() { delete m_left; - m_left = NULL; + m_left = nullptr; delete m_right; - m_right = NULL; + m_right = nullptr; m_objects.clear(); } // MxCifBinTree::~MxCifBinTree @@ -315,7 +315,7 @@ bool MxCifQuadTree::MxCifBinTree::addObject(const MxCifQuadTreeBounds & object) // try putting the object in a child node if (m_maxDepth > 1) { - if (m_left == NULL) + if (m_left == nullptr) { if (!split()) return false; @@ -348,7 +348,7 @@ bool MxCifQuadTree::MxCifBinTree::removeObject(const MxCifQuadTreeBounds & objec { if (m_maxDepth > 1) { - if (m_left != NULL) + if (m_left != nullptr) { // check if the object is in a sub-node if (m_left->removeObject(object) || @@ -379,7 +379,7 @@ void MxCifQuadTree::MxCifBinTree::getAllObjects( std::vector & objects) const { // if we have sub-trees, pass the point to the tree that contains it - if (m_left != NULL) + if (m_left != nullptr) { m_right->getAllObjects(objects); m_left->getAllObjects(objects); @@ -435,7 +435,7 @@ void MxCifQuadTree::MxCifXBinTree::getObjectsAt(float x, float y, x >= m_min) { // if we have sub-trees, pass the point to the tree that contains it - if (m_left != NULL) + if (m_left != nullptr) { if (x >= m_center) m_right->getObjectsAt(x, y, objects); @@ -498,7 +498,7 @@ void MxCifQuadTree::MxCifYBinTree::getObjectsAt(float x, float y, y >= m_min) { // if we have sub-trees, pass the point to the tree that contains it - if (m_left != NULL) + if (m_left != nullptr) { if (y >= m_center) m_right->getObjectsAt(x, y, objects); diff --git a/engine/shared/library/sharedMath/src/shared/MxCifQuadTreeBounds.h b/engine/shared/library/sharedMath/src/shared/MxCifQuadTreeBounds.h index 27006c07..3362c65a 100755 --- a/engine/shared/library/sharedMath/src/shared/MxCifQuadTreeBounds.h +++ b/engine/shared/library/sharedMath/src/shared/MxCifQuadTreeBounds.h @@ -19,7 +19,7 @@ class MxCifQuadTreeBounds { public: - MxCifQuadTreeBounds(float minX, float minY, float maxX, float maxY, void * data = NULL); + MxCifQuadTreeBounds(float minX, float minY, float maxX, float maxY, void * data = nullptr); virtual ~MxCifQuadTreeBounds(){}; const float getMinX(void) const; @@ -87,7 +87,7 @@ inline void * MxCifQuadTreeBounds::getData(void) const class MxCifQuadTreeCircleBounds : public MxCifQuadTreeBounds { public: - MxCifQuadTreeCircleBounds(float centerX, float centerY, float radius, void * data = NULL); + MxCifQuadTreeCircleBounds(float centerX, float centerY, float radius, void * data = nullptr); float getCenterX() const; float getCenterY() const; diff --git a/engine/shared/library/sharedMath/src/shared/Plane.cpp b/engine/shared/library/sharedMath/src/shared/Plane.cpp index de9e491f..716055b6 100755 --- a/engine/shared/library/sharedMath/src/shared/Plane.cpp +++ b/engine/shared/library/sharedMath/src/shared/Plane.cpp @@ -63,7 +63,7 @@ void Plane::set(const Vector &point0, const Vector &point1, const Vector &point2 * Find the intersection between a line segment and the plane. * * If the line segment does intersect the plane, and the intersection - * pointer is non-NULL, then intersection will be set to the point on + * pointer is non-nullptr, then intersection will be set to the point on * the line segment that crosses the plane. * * @param point0 [IN] Start of the line segment @@ -85,7 +85,7 @@ bool Plane::findIntersection(const Vector &point0, const Vector &point1) const * Find the intersection between a line segment and the plane. * * If the line segment does intersect the plane, and the intersection - * pointer is non-NULL, then intersection will be set to the point on + * pointer is non-nullptr, then intersection will be set to the point on * the line segment that crosses the plane. * * @param point0 [IN] Start of the line segment @@ -120,7 +120,7 @@ bool Plane::findIntersection(const Vector &point0, const Vector &point1, Vector * Find the intersection between a line segment and the plane. * * If the line segment does intersect the plane, and the intersection - * pointer is non-NULL, then intersection will be set to the point on + * pointer is non-nullptr, then intersection will be set to the point on * the line segment that crosses the plane. * * @param point0 [IN] Start of the line segment @@ -159,7 +159,7 @@ bool Plane::findIntersection(const Vector &point0, const Vector &point1, Vector * Find the intersection between a line segment and the plane. * * If the line segment does intersect the plane, and the intersection - * pointer is non-NULL, then intersection will be set to the point on + * pointer is non-nullptr, then intersection will be set to the point on * the line segment that crosses the plane. * * @param point0 [IN] Start of the line segment @@ -198,7 +198,7 @@ bool Plane::findIntersection(const Vector &point0, const Vector &point1, float & * back side of the plane. * * If the line segment does intersect the plane, and the intersection - * pointer is non-NULL, then intersection will be set to the point on + * pointer is non-nullptr, then intersection will be set to the point on * the line segment that crosses the plane. * * @param point0 [IN] Start of the line segment @@ -224,12 +224,12 @@ bool Plane::findDirectedIntersection(const Vector &point0, const Vector &point1) * back side of the plane. * * If the line segment does intersect the plane, and the intersection - * pointer is non-NULL, then intersection will be set to the point on + * pointer is non-nullptr, then intersection will be set to the point on * the line segment that crosses the plane. * * @param point0 [IN] Start of the line segment * @param point1 [IN] End of the line segment - * @param intersection [OUT] Intersection of the point and the plane (may be NULL) + * @param intersection [OUT] Intersection of the point and the plane (may be nullptr) * @param t [OUT] parameterized t from 0..1 * @return True if the line segment intersects the plane from front-to-rear, otherwise false. */ @@ -265,12 +265,12 @@ bool Plane::findDirectedIntersection(const Vector &point0, const Vector &point1, * back side of the plane. * * If the line segment does intersect the plane, and the intersection - * pointer is non-NULL, then intersection will be set to the point on + * pointer is non-nullptr, then intersection will be set to the point on * the line segment that crosses the plane. * * @param point0 [IN] Start of the line segment * @param point1 [IN] End of the line segment - * @param intersection [OUT] Intersection of the point and the plane (may be NULL) + * @param intersection [OUT] Intersection of the point and the plane (may be nullptr) * @param t [OUT] parameterized t from 0..1 * @return True if the line segment intersects the plane from front-to-rear, otherwise false. */ @@ -308,12 +308,12 @@ bool Plane::findDirectedIntersection(const Vector &point0, const Vector &point1, * back side of the plane. * * If the line segment does intersect the plane, and the intersection - * pointer is non-NULL, then intersection will be set to the point on + * pointer is non-nullptr, then intersection will be set to the point on * the line segment that crosses the plane. * * @param point0 [IN] Start of the line segment * @param point1 [IN] End of the line segment - * @param intersection [OUT] Intersection of the point and the plane (may be NULL) + * @param intersection [OUT] Intersection of the point and the plane (may be nullptr) * @param t [OUT] parameterized t from 0..1 * @return True if the line segment intersects the plane from front-to-rear, otherwise false. */ diff --git a/engine/shared/library/sharedMath/src/shared/Quaternion.cpp b/engine/shared/library/sharedMath/src/shared/Quaternion.cpp index 38ce35b6..15b349a5 100755 --- a/engine/shared/library/sharedMath/src/shared/Quaternion.cpp +++ b/engine/shared/library/sharedMath/src/shared/Quaternion.cpp @@ -138,7 +138,7 @@ void Quaternion::getTransform(Transform *transform) const void Quaternion::getTransformPreserveTranslation(Transform *transform) const { - DEBUG_FATAL(!transform, ("null transform arg")); + DEBUG_FATAL(!transform, ("nullptr transform arg")); if ((w + s_quatEqualityEpsilon) < 1.f) { diff --git a/engine/shared/library/sharedMath/src/shared/SphereTreeNode.h b/engine/shared/library/sharedMath/src/shared/SphereTreeNode.h index 706f846d..3d630b82 100755 --- a/engine/shared/library/sharedMath/src/shared/SphereTreeNode.h +++ b/engine/shared/library/sharedMath/src/shared/SphereTreeNode.h @@ -71,7 +71,7 @@ VectorPointerPool::~VectorPointerPool() } delete v; - v = NULL; + v = nullptr; } } @@ -209,7 +209,7 @@ public: node->move(this); else { - WARNING_STRICT_FATAL(true, ("SphereTree::move was invoked for an object, but the real sphere tree node it refers to is null.")); + WARNING_STRICT_FATAL(true, ("SphereTree::move was invoked for an object, but the real sphere tree node it refers to is nullptr.")); } }; @@ -292,7 +292,7 @@ inline SpatialSubdivisionHandle * SphereTreeNode::ad if(!isValidSphere(sphere)) { WARNING_STRICT_FATAL(true, ("SphereTreeNode::addObject - sphere for the object being added is invalid")); - return NULL; + return nullptr; } SphereTreeNode * candidateNode = 0; diff --git a/engine/shared/library/sharedMath/src/shared/Transform.cpp b/engine/shared/library/sharedMath/src/shared/Transform.cpp index 9cc8c181..ef35b3d0 100755 --- a/engine/shared/library/sharedMath/src/shared/Transform.cpp +++ b/engine/shared/library/sharedMath/src/shared/Transform.cpp @@ -493,7 +493,7 @@ void Transform::reorthonormalize(void) /** * Send this transform to the DebugPrint system. * - * The header parameter may be NULL. + * The header parameter may be nullptr. * * @param header Header for the transform */ @@ -524,8 +524,8 @@ void Transform::debugPrint(const char *header) const void Transform::rotate_l2p(const Vector *source, Vector *result, int count) const { - DEBUG_FATAL(!source, ("source array is NULL")); - DEBUG_FATAL(!result, ("result array is NULL")); + DEBUG_FATAL(!source, ("source array is nullptr")); + DEBUG_FATAL(!result, ("result array is nullptr")); DEBUG_FATAL(source == result, ("source and result array can not be the same")); NOT_NULL(source); @@ -559,8 +559,8 @@ void Transform::rotate_l2p(const Vector *source, Vector *result, int count) cons void Transform::rotateTranslate_l2p(const Vector *source, Vector *result, int count) const { - DEBUG_FATAL(!source, ("source array is NULL")); - DEBUG_FATAL(!result, ("result array is NULL")); + DEBUG_FATAL(!source, ("source array is nullptr")); + DEBUG_FATAL(!result, ("result array is nullptr")); NOT_NULL(source); NOT_NULL(result); @@ -594,8 +594,8 @@ void Transform::rotateTranslate_l2p(const Vector *source, Vector *result, int co void Transform::rotate_p2l(const Vector *source, Vector *result, int count) const { - DEBUG_FATAL(!source, ("source array is NULL")); - DEBUG_FATAL(!result, ("result array is NULL")); + DEBUG_FATAL(!source, ("source array is nullptr")); + DEBUG_FATAL(!result, ("result array is nullptr")); NOT_NULL(source); NOT_NULL(result); @@ -629,8 +629,8 @@ void Transform::rotate_p2l(const Vector *source, Vector *result, int count) cons void Transform::rotateTranslate_p2l(const Vector *source, Vector *result, int count) const { - DEBUG_FATAL(!source, ("source array is NULL")); - DEBUG_FATAL(!result, ("result array is NULL")); + DEBUG_FATAL(!source, ("source array is nullptr")); + DEBUG_FATAL(!result, ("result array is nullptr")); NOT_NULL(source); NOT_NULL(result); diff --git a/engine/shared/library/sharedMath/src/shared/Vector.cpp b/engine/shared/library/sharedMath/src/shared/Vector.cpp index 8f3ee55d..a694ccdd 100755 --- a/engine/shared/library/sharedMath/src/shared/Vector.cpp +++ b/engine/shared/library/sharedMath/src/shared/Vector.cpp @@ -115,7 +115,7 @@ bool Vector::isNormalized(void) const const Vector Vector::findClosestPointOnLine(const Vector &line0, const Vector &line1, real *t) const { - DEBUG_FATAL(!t, ("t arg is null")); + DEBUG_FATAL(!t, ("t arg is nullptr")); NOT_NULL(t); @@ -189,7 +189,7 @@ real Vector::distanceToLineSegment(const Vector &line0, const Vector &line1) con /** * Send this vector to the DebugPrint system. * - * The header parameter may be NULL. + * The header parameter may be nullptr. * * @param header Header for the vector */ diff --git a/engine/shared/library/sharedMath/src/shared/debug/DebugShapeRenderer.cpp b/engine/shared/library/sharedMath/src/shared/debug/DebugShapeRenderer.cpp index 3e4c8d34..4b0dc1ac 100755 --- a/engine/shared/library/sharedMath/src/shared/debug/DebugShapeRenderer.cpp +++ b/engine/shared/library/sharedMath/src/shared/debug/DebugShapeRenderer.cpp @@ -10,7 +10,7 @@ #include "sharedMath/Transform.h" -static DebugShapeRenderer::DebugShapeRendererFactory * gs_factory = NULL; +static DebugShapeRenderer::DebugShapeRendererFactory * gs_factory = nullptr; // ---------------------------------------------------------------------- @@ -145,8 +145,8 @@ void DebugShapeRenderer::setFactory ( DebugShapeRenderer::DebugShapeRendererFact DebugShapeRenderer * DebugShapeRenderer::create ( Object const * object ) { - if(gs_factory == NULL) - return NULL; + if(gs_factory == nullptr) + return nullptr; return gs_factory(object); } diff --git a/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp b/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp index 411b5f3c..b6e10567 100755 --- a/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp +++ b/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp @@ -327,7 +327,7 @@ using namespace MemoryManagerNamespace; SystemAllocation::SystemAllocation(int size) : m_size(size), - m_next(NULL), + m_next(nullptr), m_pad1(0), m_pad2(0) { @@ -343,7 +343,7 @@ SystemAllocation::SystemAllocation(int size) Block * lastMemoryBlock = getLastMemoryBlock(); // set up the prefix sentinel block - firstMemoryBlock->setPrevious(NULL); + firstMemoryBlock->setPrevious(nullptr); firstMemoryBlock->setNext(firstFreeBlock); firstMemoryBlock->setFree(false); @@ -353,7 +353,7 @@ SystemAllocation::SystemAllocation(int size) // set up the suffix sentinel block lastMemoryBlock->setPrevious(firstFreeBlock); - lastMemoryBlock->setNext(NULL); + lastMemoryBlock->setNext(nullptr); lastMemoryBlock->setFree(false); // put the first block on the free list @@ -748,7 +748,7 @@ void MemoryManagerNamespace::allocateSystemMemory(int megabytes) ms_systemMemoryAllocatedMegabytes += megabytes; // insert the memory into the sorted linked list of system allocations - SystemAllocation * back = NULL; + SystemAllocation * back = nullptr; SystemAllocation * front = ms_firstSystemAllocation; for ( ; front && front->getFirstMemoryBlock() < systemAllocation->getFirstMemoryBlock(); back = front, front = front->getNext()) {} @@ -967,7 +967,7 @@ void MemoryManagerNamespace::addToFreeList(Block * block) FreeBlock * freeBlock = static_cast(block); int const freeBlockSize = freeBlock->getSize(); - FreeBlock * parent = NULL; + FreeBlock * parent = nullptr; FreeBlock * * next = &ms_firstFreeBlock; FreeBlock * same = 0; @@ -991,7 +991,7 @@ void MemoryManagerNamespace::addToFreeList(Block * block) { freeBlock->m_smallerFreeBlock = same->m_smallerFreeBlock; - same->m_smallerFreeBlock = NULL; + same->m_smallerFreeBlock = nullptr; if (freeBlock->m_smallerFreeBlock) freeBlock->m_smallerFreeBlock->m_parentFreeBlock = freeBlock; @@ -999,7 +999,7 @@ void MemoryManagerNamespace::addToFreeList(Block * block) same->m_parentFreeBlock = freeBlock; freeBlock->m_largerFreeBlock = same->m_largerFreeBlock; - same->m_largerFreeBlock = NULL; + same->m_largerFreeBlock = nullptr; if (freeBlock->m_largerFreeBlock) freeBlock->m_largerFreeBlock->m_parentFreeBlock = freeBlock; @@ -1009,9 +1009,9 @@ void MemoryManagerNamespace::addToFreeList(Block * block) else { *next = freeBlock; - freeBlock->m_smallerFreeBlock = NULL; - freeBlock->m_sameFreeBlock = NULL; - freeBlock->m_largerFreeBlock = NULL; + freeBlock->m_smallerFreeBlock = nullptr; + freeBlock->m_sameFreeBlock = nullptr; + freeBlock->m_largerFreeBlock = nullptr; freeBlock->m_parentFreeBlock = parent; } @@ -1042,7 +1042,7 @@ void MemoryManagerNamespace::removeFromFreeList(FreeBlock * block) NOT_NULL(block); // find the pointer that points to block - FreeBlock * * parentPointer = NULL; + FreeBlock * * parentPointer = nullptr; FreeBlock * parent = block->m_parentFreeBlock; if (parent) { @@ -1088,7 +1088,7 @@ void MemoryManagerNamespace::removeFromFreeList(FreeBlock * block) { // this is the worst case. this free block has smaller and larger children, but not any same sized children // we're going to take the smallest block off the larger list and use that to replace the current node - FreeBlock * back = NULL; + FreeBlock * back = nullptr; FreeBlock * replacement = block->m_largerFreeBlock; while (replacement->m_smallerFreeBlock) { @@ -1133,16 +1133,16 @@ void MemoryManagerNamespace::removeFromFreeList(FreeBlock * block) else { // this block has no children - *parentPointer = NULL; + *parentPointer = nullptr; } } } // remove all the pointers the block may have had - block->m_smallerFreeBlock = NULL; - block->m_sameFreeBlock = NULL; - block->m_largerFreeBlock = NULL; - block->m_parentFreeBlock = NULL; + block->m_smallerFreeBlock = nullptr; + block->m_sameFreeBlock = nullptr; + block->m_largerFreeBlock = nullptr; + block->m_parentFreeBlock = nullptr; --ms_freeBlocks; } @@ -1151,7 +1151,7 @@ void MemoryManagerNamespace::removeFromFreeList(FreeBlock * block) FreeBlock *MemoryManagerNamespace::searchFreeList(int blockSize) { - FreeBlock * result = NULL; + FreeBlock * result = nullptr; FreeBlock * current = ms_firstFreeBlock; while (current) { @@ -1239,7 +1239,7 @@ void * MemoryManager::allocate(size_t size, uint32 owner, bool array, bool leakT // get the size of the allocation int allocSize = (cms_allocatedBlockSize + cms_guardBandSize + (size ? static_cast(size) : 1) + cms_guardBandSize + 15) & ~15; - FreeBlock * bestFreeBlock = NULL; + FreeBlock * bestFreeBlock = nullptr; for (int tries = 0; !bestFreeBlock && tries < 2; ++tries) { bestFreeBlock = searchFreeList(allocSize); @@ -1396,7 +1396,7 @@ void *MemoryManager::reallocate(void *userPointer, size_t newSize) { MemoryManager::free(userPointer, array); -// DEBUG_REPORT_LOG(ms_logEachAlloc, ("MemoryManager::reallocate() new_requested_size=%d, org ptr=%p, new ptr=NULL\n", newSize, userPointer)); +// DEBUG_REPORT_LOG(ms_logEachAlloc, ("MemoryManager::reallocate() new_requested_size=%d, org ptr=%p, new ptr=nullptr\n", newSize, userPointer)); return 0; } @@ -1440,7 +1440,7 @@ void *MemoryManager::reallocate(void *userPointer, size_t newSize) * Users should not call this routine directly. It should only be called * by operator delete. * - * This routine should not be called with the NULL pointer. + * This routine should not be called with the nullptr pointer. * * @param userPointer Pointer to the memory * @param array True if the array form of operator new was used, false if the scalar form was used diff --git a/engine/shared/library/sharedMessageDispatch/src/shared/Emitter.cpp b/engine/shared/library/sharedMessageDispatch/src/shared/Emitter.cpp index 8d161e58..b8c97860 100755 --- a/engine/shared/library/sharedMessageDispatch/src/shared/Emitter.cpp +++ b/engine/shared/library/sharedMessageDispatch/src/shared/Emitter.cpp @@ -31,7 +31,7 @@ struct Emitter::ReceiverList Emitter::Emitter() : receiverList(new ReceiverList) { - assert (receiverList != NULL); + assert (receiverList != nullptr); } //--------------------------------------------------------------------- diff --git a/engine/shared/library/sharedMessageDispatch/src/shared/Receiver.cpp b/engine/shared/library/sharedMessageDispatch/src/shared/Receiver.cpp index ff929dc2..bc8fc3b3 100755 --- a/engine/shared/library/sharedMessageDispatch/src/shared/Receiver.cpp +++ b/engine/shared/library/sharedMessageDispatch/src/shared/Receiver.cpp @@ -33,7 +33,7 @@ Receiver::Receiver() : emitterTargets(new EmitterTargets), hasTargets(false) { - assert(emitterTargets != NULL); + assert(emitterTargets != nullptr); } //--------------------------------------------------------------------- diff --git a/engine/shared/library/sharedNetwork/src/linux/TcpClient.cpp b/engine/shared/library/sharedNetwork/src/linux/TcpClient.cpp index 8dfa1605..8acf1289 100755 --- a/engine/shared/library/sharedNetwork/src/linux/TcpClient.cpp +++ b/engine/shared/library/sharedNetwork/src/linux/TcpClient.cpp @@ -494,7 +494,7 @@ void TcpClient::update() // disconnected so we can handle cleanup. if (pollResult) { - if (m_recvBuffer == NULL) + if (m_recvBuffer == nullptr) { m_recvBufferLength = 1500; m_recvBuffer = new unsigned char [m_recvBufferLength]; @@ -533,7 +533,7 @@ void TcpClient::update() } else { - LOG("Network", ("(null connection object) Read zero bytes on a successful poll (POLLIN|POLLHUP). Closing socket since we think it is closed.")); + LOG("Network", ("(nullptr connection object) Read zero bytes on a successful poll (POLLIN|POLLHUP). Closing socket since we think it is closed.")); } onConnectionClosed(); } diff --git a/engine/shared/library/sharedNetwork/src/shared/Service.cpp b/engine/shared/library/sharedNetwork/src/shared/Service.cpp index 84ec3dd8..9e0f0c8f 100755 --- a/engine/shared/library/sharedNetwork/src/shared/Service.cpp +++ b/engine/shared/library/sharedNetwork/src/shared/Service.cpp @@ -186,8 +186,8 @@ Service::~Service() delete m_callback; connections.clear(); - connectionAllocator = NULL; - m_callback = NULL; + connectionAllocator = nullptr; + m_callback = nullptr; delete m_tcpServer; } diff --git a/engine/shared/library/sharedNetworkMessages/src/shared/core/SetupSharedNetworkMessages.cpp b/engine/shared/library/sharedNetworkMessages/src/shared/core/SetupSharedNetworkMessages.cpp index e92dd770..134b7a9b 100755 --- a/engine/shared/library/sharedNetworkMessages/src/shared/core/SetupSharedNetworkMessages.cpp +++ b/engine/shared/library/sharedNetworkMessages/src/shared/core/SetupSharedNetworkMessages.cpp @@ -137,7 +137,7 @@ namespace SetupSharedNetworkMessagesNamespace MessageQueue::Data* unpackNothing(Archive::ReadIterator &) { - return NULL; + return nullptr; } void packGenericShipDamageMessage(const MessageQueue::Data * data, Archive::ByteStream & target) diff --git a/engine/shared/library/sharedObject/src/shared/ObjectWatcherList.cpp b/engine/shared/library/sharedObject/src/shared/ObjectWatcherList.cpp index a2cb6e67..fdfb4afa 100755 --- a/engine/shared/library/sharedObject/src/shared/ObjectWatcherList.cpp +++ b/engine/shared/library/sharedObject/src/shared/ObjectWatcherList.cpp @@ -23,7 +23,7 @@ namespace ObjectWatcherListNamespace { void setRegionOfInfluenceEnabled(Object const * const object, bool const enabled, bool skipCell) { - if (skipCell && NULL != object->getCellProperty()) + if (skipCell && nullptr != object->getCellProperty()) return; object->setRegionOfInfluenceEnabled(enabled); @@ -67,7 +67,7 @@ ObjectWatcherList::~ObjectWatcherList(void) /** * Add an Object to the ObjectWatcherList. * - * This routine will call Fatal in debug compiles if it is passed a NULL + * This routine will call Fatal in debug compiles if it is passed a nullptr * object. * * This routine will call Fatal in debug compiles if the object list @@ -85,7 +85,7 @@ void ObjectWatcherList::addObject(Object & objectToAdd) /** * Remove an Object from the ObjectWatcherList. * - * This routine will call Fatal in debug compiles if it is passed a NULL + * This routine will call Fatal in debug compiles if it is passed a nullptr * object. * * @param objectToRemove Pointer to the object to remove @@ -112,13 +112,13 @@ void ObjectWatcherList::removeObjectByIndex (const Object & object, int index) // Remove the last item in the vector. m_objectVector->pop_back(); - // NULL the object from the alter-safe object list. + // nullptr the object from the alter-safe object list. uint size = m_alterSafeObjectVector->size(); for (uint i = 0; i < size; ++i) { if ((*m_alterSafeObjectVector)[i] == &object) { - (*m_alterSafeObjectVector)[i] = NULL; + (*m_alterSafeObjectVector)[i] = nullptr; return; } } @@ -232,7 +232,7 @@ void ObjectWatcherList::alter(real time) // Make sure the object is still in the object list before removing it - if ((*m_alterSafeObjectVector)[i] != NULL) + if ((*m_alterSafeObjectVector)[i] != nullptr) { removeObject(*obj); } diff --git a/engine/shared/library/sharedObject/src/shared/appearance/Appearance.cpp b/engine/shared/library/sharedObject/src/shared/appearance/Appearance.cpp index e1acba39..f899e042 100755 --- a/engine/shared/library/sharedObject/src/shared/appearance/Appearance.cpp +++ b/engine/shared/library/sharedObject/src/shared/appearance/Appearance.cpp @@ -80,8 +80,8 @@ void Appearance::setRenderHardpointFunction(RenderHardpointFunction renderHardpo Appearance::Appearance(const AppearanceTemplate *newAppearanceTemplate) : m_appearanceTemplate(AppearanceTemplateList::fetch(newAppearanceTemplate)), - m_extent(m_appearanceTemplate ? ExtentList::fetch(m_appearanceTemplate->getExtent()) : NULL), - m_owner(NULL), + m_extent(m_appearanceTemplate ? ExtentList::fetch(m_appearanceTemplate->getExtent()) : nullptr), + m_owner(nullptr), m_renderedFrameNumber(0), m_scale(Vector::xyz111), m_keepAlive(false), @@ -100,15 +100,15 @@ Appearance::Appearance(const AppearanceTemplate *newAppearanceTemplate) : Appearance::~Appearance() { ExtentList::release(m_extent); - m_extent = NULL; + m_extent = nullptr; if (m_appearanceTemplate) { AppearanceTemplateList::release(m_appearanceTemplate); - m_appearanceTemplate = NULL; + m_appearanceTemplate = nullptr; } - m_owner = NULL; + m_owner = nullptr; } // ---------------------------------------------------------------------- @@ -269,7 +269,7 @@ void Appearance::render() const void Appearance::objectListCameraRenderDescend(Object const & obj) { //-- don't descend through cells - if (NULL != obj.getCellProperty()) + if (nullptr != obj.getCellProperty()) return; int const childCount = obj.getNumberOfChildObjects(); @@ -378,7 +378,7 @@ bool Appearance::implementsCollide() const * CustomizationDataProperty. If there is such a property, this * function will invoke Appearance::setCustomizationData() with the * appropriate value. If the property doesn't exist, this function - * will invoke Appearance::setCustomizationData() with NULL. Note if + * will invoke Appearance::setCustomizationData() with nullptr. Note if * the caller sets the CustomizationDataProperty for an Object after * associating the Object instance with the appearance, the caller is * responsible for calling Appearance::setCustomizationData(). @@ -457,7 +457,7 @@ const char * Appearance::getFloorName () const if (m_appearanceTemplate) return m_appearanceTemplate->getFloorName(); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -607,7 +607,7 @@ const char * Appearance::getAppearanceTemplateName () const DPVS::Object *Appearance::getDpvsObject() const { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -748,14 +748,14 @@ SkeletalAppearance2 const * Appearance::asSkeletalAppearance2() const ComponentAppearance * Appearance::asComponentAppearance() { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- ComponentAppearance const * Appearance::asComponentAppearance() const { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -783,14 +783,14 @@ void Appearance::onEvent(LabelHash::Id /* eventId */) int Appearance::getHardpointCount() const { - return m_appearanceTemplate != NULL ? m_appearanceTemplate->getHardpointCount() : 0; + return m_appearanceTemplate != nullptr ? m_appearanceTemplate->getHardpointCount() : 0; } // ---------------------------------------------------------------------- int Appearance::getHardpointIndex(CrcString const &hardpointName, bool optional) const { - return m_appearanceTemplate != NULL ? m_appearanceTemplate->getHardpointIndex(hardpointName, optional) : -1; + return m_appearanceTemplate != nullptr ? m_appearanceTemplate->getHardpointIndex(hardpointName, optional) : -1; } // ---------------------------------------------------------------------- @@ -855,42 +855,42 @@ bool Appearance::usesRenderEffectsFlag() const ParticleEffectAppearance * Appearance::asParticleEffectAppearance() { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- ParticleEffectAppearance const * Appearance::asParticleEffectAppearance() const { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- SwooshAppearance * Appearance::asSwooshAppearance() { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- SwooshAppearance const * Appearance::asSwooshAppearance() const { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- LightningAppearance * Appearance::asLightningAppearance() { - return NULL; + return nullptr; } // ---------------------------------------------------------------------- LightningAppearance const * Appearance::asLightningAppearance() const { - return NULL; + return nullptr; } // ====================================================================== diff --git a/engine/shared/library/sharedObject/src/shared/appearance/Appearance.h b/engine/shared/library/sharedObject/src/shared/appearance/Appearance.h index 13b49530..4a7bd5cf 100755 --- a/engine/shared/library/sharedObject/src/shared/appearance/Appearance.h +++ b/engine/shared/library/sharedObject/src/shared/appearance/Appearance.h @@ -206,7 +206,7 @@ private: /** * Get the AppearanceTemplate for this Appearance. * - * The AppearanceTemplate may be NULL. + * The AppearanceTemplate may be nullptr. * * AppearanceTemplates may be shared by multiple Appearances. * diff --git a/engine/shared/library/sharedObject/src/shared/appearance/AppearanceTemplate.cpp b/engine/shared/library/sharedObject/src/shared/appearance/AppearanceTemplate.cpp index 89f44831..0975380d 100755 --- a/engine/shared/library/sharedObject/src/shared/appearance/AppearanceTemplate.cpp +++ b/engine/shared/library/sharedObject/src/shared/appearance/AppearanceTemplate.cpp @@ -97,14 +97,14 @@ AppearanceTemplate::PreloadManager::~PreloadManager () AppearanceTemplate::AppearanceTemplate(const char *newName) : m_referenceCount(0), m_crcName(new CrcLowerString(newName)), - m_extent(NULL), - m_collisionExtent(NULL), - m_hardpoints(NULL), - m_floorName(NULL), + m_extent(nullptr), + m_collisionExtent(nullptr), + m_hardpoints(nullptr), + m_floorName(nullptr), m_preloadManager (0) { //-- Save info on most recently constructed appearance template. - IGNORE_RETURN(snprintf(ms_crashReportInfo, sizeof(ms_crashReportInfo) - 1, "AppearanceTemplate: %s\n", newName ? newName : "")); + IGNORE_RETURN(snprintf(ms_crashReportInfo, sizeof(ms_crashReportInfo) - 1, "AppearanceTemplate: %s\n", newName ? newName : "")); ms_crashReportInfo[sizeof(ms_crashReportInfo) - 1] = '\0'; } @@ -118,10 +118,10 @@ AppearanceTemplate::~AppearanceTemplate(void) delete m_crcName; ExtentList::release(m_extent); - m_extent = NULL; + m_extent = nullptr; ExtentList::release(m_collisionExtent); - m_collisionExtent = NULL; + m_collisionExtent = nullptr; if (m_hardpoints) { @@ -482,7 +482,7 @@ const CrcLowerString &AppearanceTemplate::getCrcName() const /** *Get the name of this AppearanceTemplate. * - *This routine may return NULL. + *This routine may return nullptr. */ const char *AppearanceTemplate::getName() const diff --git a/engine/shared/library/sharedObject/src/shared/appearance/AppearanceTemplateList.cpp b/engine/shared/library/sharedObject/src/shared/appearance/AppearanceTemplateList.cpp index 37439f23..d2afe802 100755 --- a/engine/shared/library/sharedObject/src/shared/appearance/AppearanceTemplateList.cpp +++ b/engine/shared/library/sharedObject/src/shared/appearance/AppearanceTemplateList.cpp @@ -219,7 +219,7 @@ const AppearanceTemplate *AppearanceTemplateList::fetch(const char *const fileNa char const * actualFileName = fileName; if (!fileName) { - DEBUG_WARNING(true, ("AppearanceTemplateList::fetch passed NULL fileName, using default")); + DEBUG_WARNING(true, ("AppearanceTemplateList::fetch passed nullptr fileName, using default")); actualFileName = getDefaultAppearanceTemplateName(); } else if (!*fileName) @@ -246,14 +246,14 @@ const AppearanceTemplate *AppearanceTemplateList::fetch(const char *const fileNa DEBUG_WARNING(true, ("AppearanceTemplateList::fetch actualFileName fetch for %s failed.", actualFileName)); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- /** * Add a reference to the specified Appearance. * - * This routine will do nothing if passed in NULL. Otherwise, it will + * This routine will do nothing if passed in nullptr. Otherwise, it will * increase the reference count of the specified AppearanceTemplate * by one. * @@ -297,7 +297,7 @@ const AppearanceTemplate *AppearanceTemplateList::fetch(Iff *const iff) return 0; //lint !e527 // unreachable } - AppearanceTemplate *const appearanceTemplate = (*iter).second(NULL, iff); + AppearanceTemplate *const appearanceTemplate = (*iter).second(nullptr, iff); NOT_NULL(appearanceTemplate); addAnonymousAppearanceTemplate(appearanceTemplate); @@ -351,7 +351,7 @@ const AppearanceTemplate *AppearanceTemplateList::fetchNew(AppearanceTemplate *c /** * Remove a reference to the specified AppearanceTemplate. * - * This routine will do nothing if passed in NULL. + * This routine will do nothing if passed in nullptr. * * If the reference count drops to 0, the AppearanceTemplate will be deleted. * @@ -404,9 +404,9 @@ Appearance *AppearanceTemplateList::createAppearance(const char *const fileName) #endif //probably should modify the macro sometime to just be quiet if this isn't defined - if (appearanceTemplate == NULL){ + if (appearanceTemplate == nullptr){ DEBUG_WARNING(true, ("FIX ME: Appearance template for %s could not be fetched - is it missing?", fileName)); - return NULL; // Cekis: TODO: Figure out why the template can't be fetched. DarthArgus: always is due to a missing file or one of the redirectors having a bad path + return nullptr; // Cekis: TODO: Figure out why the template can't be fetched. DarthArgus: always is due to a missing file or one of the redirectors having a bad path } //-- creating the appearance will increment the reference count @@ -581,7 +581,7 @@ AppearanceTemplate *AppearanceTemplateListNamespace::create(const char *const fi // DEBUG_REPORT_LOG_PRINT(true, ("Loading mesh %s\n", actualFileName.getString())); TagBindingMap::iterator iter = ms_tagBindingMap.find(TAG_MESH); if (iter != ms_tagBindingMap.end()) - appearanceTemplate = iter->second(actualFileName.getString(), NULL); + appearanceTemplate = iter->second(actualFileName.getString(), nullptr); } //-- we now need to create the appearance from disk diff --git a/engine/shared/library/sharedObject/src/shared/container/ArrangementDescriptorList.cpp b/engine/shared/library/sharedObject/src/shared/container/ArrangementDescriptorList.cpp index 31de898d..ddc27d42 100755 --- a/engine/shared/library/sharedObject/src/shared/container/ArrangementDescriptorList.cpp +++ b/engine/shared/library/sharedObject/src/shared/container/ArrangementDescriptorList.cpp @@ -69,7 +69,7 @@ const ArrangementDescriptor *ArrangementDescriptorList::fetch(const CrcLowerStri } else { - WARNING(true, ("default ArrangementDescriptor [%s] could not be loaded, returning NULL ArrangementDescriptor", filename.getString())); + WARNING(true, ("default ArrangementDescriptor [%s] could not be loaded, returning nullptr ArrangementDescriptor", filename.getString())); return 0; } } diff --git a/engine/shared/library/sharedObject/src/shared/container/ContainedByProperty.cpp b/engine/shared/library/sharedObject/src/shared/container/ContainedByProperty.cpp index 1a25f0cd..74494ba9 100755 --- a/engine/shared/library/sharedObject/src/shared/container/ContainedByProperty.cpp +++ b/engine/shared/library/sharedObject/src/shared/container/ContainedByProperty.cpp @@ -49,7 +49,7 @@ ContainedByProperty::~ContainedByProperty() * property. * * @return Pointer to the object that contains the object with this - * ContainedByProperty. Returns NULL if the object isn't + * ContainedByProperty. Returns nullptr if the object isn't * contained by anything at the moment. */ diff --git a/engine/shared/library/sharedObject/src/shared/container/Container.cpp b/engine/shared/library/sharedObject/src/shared/container/Container.cpp index b85e8f1f..66e9e9f4 100755 --- a/engine/shared/library/sharedObject/src/shared/container/Container.cpp +++ b/engine/shared/library/sharedObject/src/shared/container/Container.cpp @@ -21,13 +21,13 @@ // ====================================================================== //Lint suppressions. -//lint -esym(613, ContainerIterator::m_iterator) // (Warning -- Possible use of null pointer 'ContainerIterator::m_iterator' ) // This is an opaque data type to us. We can only check against a container::end(). +//lint -esym(613, ContainerIterator::m_iterator) // (Warning -- Possible use of nullptr pointer 'ContainerIterator::m_iterator' ) // This is an opaque data type to us. We can only check against a container::end(). //lint -esym(1540, ContainerIterator::m_iterator) // (Warning -- Pointer member 'ContainerIterator::m_iterator' neither freed nor zero'ed by destructor -- Effective C++ #6) // It's okay, the iterator type is opaque to us, we have no idea it's a pointer. //lint -esym(1554, ContainerIterator::m_iterator) // (Warning -- Direct copy of pointer 'ContainerIterator::m_iterator'. // It's okay, the iterator type is opaque to us, we have no idea it's a pointer. //lint -esym(1555, ContainerIterator::m_iterator) // (Warning -- Direct pointer copy of member 'ContainerIterator::m_iterator' within copy assignment operator: 'ContainerIterator::operator=(const ContainerIterator &) // Opaque type, we don't know its a pointer. //lint -esym(1555, ContainerIterator::m_owner) // (Warning -- Direct pointer copy of member 'ContainerIterator::m_owner' within copy assignment operator: 'ContainerIterator::operator=(const ContainerIterator &) // We do not own this memory, so it's okay to overwrite the pointer. We can't leak it. -//lint -esym(613, ContainerConstIterator::m_iterator) // (Warning -- Possible use of null pointer 'ContainerConstIterator::m_iterator' ) // This is an opaque data type to us. We can only check against a container::end(). +//lint -esym(613, ContainerConstIterator::m_iterator) // (Warning -- Possible use of nullptr pointer 'ContainerConstIterator::m_iterator' ) // This is an opaque data type to us. We can only check against a container::end(). //lint -esym(1540, ContainerConstIterator::m_iterator) // (Warning -- Pointer member 'ContainerConstIterator::m_iterator' neither freed nor zero'ed by destructor -- Effective C++ #6) // It's okay, the iterator type is opaque to us, we have no idea it's a pointer. //lint -esym(1554, ContainerConstIterator::m_iterator) // (Warning -- Direct copy of pointer 'ContainerConstIterator::m_iterator'. // It's okay, the iterator type is opaque to us, we have no idea it's a pointer. //lint -esym(1555, ContainerConstIterator::m_iterator) // (Warning -- Direct pointer copy of member 'ContainerConstIterator::m_iterator' within copy assignment operator: 'ContainerConstIterator::operator=(const ContainerConstIterator &) // Opaque type, we don't know its a pointer. @@ -108,7 +108,7 @@ ContainerIterator & ContainerIterator::operator= (const ContainerIterator & rhs) CachedNetworkId & ContainerIterator::operator*() { // @todo fix this interface -- it is broken. It is possible to - // construct a ContainerIterator with a NULL m_iterator, but there is + // construct a ContainerIterator with a nullptr m_iterator, but there is // no way to gracefully exit from this function since it requires a non-const // reference. Otherwise I would return CachedNetworkId::cms_cachedIvalid. NOT_NULL(m_owner); @@ -197,7 +197,7 @@ ContainerConstIterator & ContainerConstIterator::operator= (const ContainerConst const CachedNetworkId & ContainerConstIterator::operator*() const { // @todo fix this interface -- it is broken. It is possible to - // construct a ContainerIterator with a NULL m_iterator, but there is + // construct a ContainerIterator with a nullptr m_iterator, but there is // no way to gracefully exit from this function since it requires a non-const // reference. Otherwise I would return CachedNetworkId::cms_cachedIvalid. NOT_NULL(m_owner); @@ -677,7 +677,7 @@ void Container::debugPrint(std::string &buffer) const { Object const *const object = it->getObject(); - sprintf(tempBuffer, "\tindex [%d]: object id [%s], template [%s]\n", index, it->getValueString().c_str(), object ? object->getObjectTemplateName() : ""); + sprintf(tempBuffer, "\tindex [%d]: object id [%s], template [%s]\n", index, it->getValueString().c_str(), object ? object->getObjectTemplateName() : ""); buffer += tempBuffer; } @@ -699,7 +699,7 @@ void Container::debugLog() const for (Contents::const_iterator it = m_contents.begin(); it != endIt; ++it, ++index) { Object const *const object = it->getObject(); - DEBUG_REPORT_LOG(true, ("\tindex [%d]: object id [%s], template [%s]\n", index, it->getValueString().c_str(), object ? object->getObjectTemplateName() : "")); + DEBUG_REPORT_LOG(true, ("\tindex [%d]: object id [%s], template [%s]\n", index, it->getValueString().c_str(), object ? object->getObjectTemplateName() : "")); } DEBUG_REPORT_LOG(true, ("====[END: container]====\n")); diff --git a/engine/shared/library/sharedObject/src/shared/container/SlotIdManager.cpp b/engine/shared/library/sharedObject/src/shared/container/SlotIdManager.cpp index 9aea59ef..70b6b34d 100755 --- a/engine/shared/library/sharedObject/src/shared/container/SlotIdManager.cpp +++ b/engine/shared/library/sharedObject/src/shared/container/SlotIdManager.cpp @@ -351,7 +351,7 @@ bool SlotIdManager::isSlotPlayerModifiable(const SlotId &slotId) * * If the slot can have something put in it that directly affects what you * see on the client, this will return true. If this returns false, - * getSlotHardpointName() will return a NULL string. + * getSlotHardpointName() will return a nullptr string. * * @param slotId a SlotId instance for the slot under question. * @@ -381,9 +381,9 @@ bool SlotIdManager::isSlotAppearanceRelated(const SlotId &slotId) * * The caller should check the result of isSlotAppearanceRelated() before * calling this function. If the slot is not appearance related, this function - * will always return NULL. Also, if the SlotIdManager is installed such that + * will always return nullptr. Also, if the SlotIdManager is installed such that * hardpoint names are not loaded (currently the server is loaded this way), - * the specified hardpoint name will return NULL. + * the specified hardpoint name will return nullptr. * * @param slotId a SlotId instance for the slot under question. * diff --git a/engine/shared/library/sharedObject/src/shared/container/SlottedContainer.cpp b/engine/shared/library/sharedObject/src/shared/container/SlottedContainer.cpp index b97b1a24..98b85e82 100755 --- a/engine/shared/library/sharedObject/src/shared/container/SlottedContainer.cpp +++ b/engine/shared/library/sharedObject/src/shared/container/SlottedContainer.cpp @@ -49,7 +49,7 @@ SlottedContainer::~SlottedContainer() if (m_slotMap) { delete m_slotMap; - m_slotMap = NULL; + m_slotMap = nullptr; } } diff --git a/engine/shared/library/sharedObject/src/shared/container/VolumeContainer.cpp b/engine/shared/library/sharedObject/src/shared/container/VolumeContainer.cpp index 02433163..fe716109 100755 --- a/engine/shared/library/sharedObject/src/shared/container/VolumeContainer.cpp +++ b/engine/shared/library/sharedObject/src/shared/container/VolumeContainer.cpp @@ -36,7 +36,7 @@ namespace VolumeContainerNamespace return parent->getVolumeContainerProperty(); } } - return NULL; + return nullptr; } const VolumeContainer* getVolumeContainerParent(const VolumeContainer& self) @@ -51,7 +51,7 @@ namespace VolumeContainerNamespace return parent->getVolumeContainerProperty(); } } - return NULL; + return nullptr; } const unsigned int serverHolocronCrc = CrcLowerString::calculateCrc("object/player_quest/pgc_quest_holocron.iff"); diff --git a/engine/shared/library/sharedObject/src/shared/container/VolumeContainer.h b/engine/shared/library/sharedObject/src/shared/container/VolumeContainer.h index 922154f7..f99766dc 100755 --- a/engine/shared/library/sharedObject/src/shared/container/VolumeContainer.h +++ b/engine/shared/library/sharedObject/src/shared/container/VolumeContainer.h @@ -69,8 +69,8 @@ public: private: bool checkVolume(const VolumeContainmentProperty &item) const; - bool internalRemove(const Object & item, const VolumeContainmentProperty *itemProp = NULL); - void insertNewItem(const Object & item, const VolumeContainmentProperty *itemProp = NULL); + bool internalRemove(const Object & item, const VolumeContainmentProperty *itemProp = nullptr); + void insertNewItem(const Object & item, const VolumeContainmentProperty *itemProp = nullptr); void childVolumeChanged(int volume, bool updateParent); diff --git a/engine/shared/library/sharedObject/src/shared/controller/Controller.cpp b/engine/shared/library/sharedObject/src/shared/controller/Controller.cpp index 66572a6a..2483e64b 100755 --- a/engine/shared/library/sharedObject/src/shared/controller/Controller.cpp +++ b/engine/shared/library/sharedObject/src/shared/controller/Controller.cpp @@ -88,7 +88,7 @@ MessageQueue::Data* Controller::peekHeldMessage( int message, float *value, uint { HeldMessageMap::iterator iter = m_heldMessages.find( message ); if ( iter == m_heldMessages.end() ) - return NULL; + return nullptr; if ( value ) *value = iter->second.value; if ( flags ) @@ -216,42 +216,42 @@ MessageQueue * Controller::getMessageQueue() TangibleController * Controller::asTangibleController() { - return NULL; + return nullptr; } //---------------------------------------------------------------------- TangibleController const * Controller::asTangibleController() const { - return NULL; + return nullptr; } //---------------------------------------------------------------------- CreatureController * Controller::asCreatureController() { - return NULL; + return nullptr; } //---------------------------------------------------------------------- CreatureController const * Controller::asCreatureController() const { - return NULL; + return nullptr; } //---------------------------------------------------------------------- ShipController * Controller::asShipController() { - return NULL; + return nullptr; } //---------------------------------------------------------------------- ShipController const * Controller::asShipController() const { - return NULL; + return nullptr; } // ====================================================================== diff --git a/engine/shared/library/sharedObject/src/shared/core/SetupSharedObject.cpp b/engine/shared/library/sharedObject/src/shared/core/SetupSharedObject.cpp index 69799beb..d25d9be1 100755 --- a/engine/shared/library/sharedObject/src/shared/core/SetupSharedObject.cpp +++ b/engine/shared/library/sharedObject/src/shared/core/SetupSharedObject.cpp @@ -55,7 +55,7 @@ SetupSharedObject::Data::Data() customizationIdManagerFilename(0), objectsAlterChildrenAndContents(true), loadObjectTemplateCrcStringTable(true), - pobEjectionTransformFilename(NULL) + pobEjectionTransformFilename(nullptr) { } diff --git a/engine/shared/library/sharedObject/src/shared/core/SetupSharedObject.h b/engine/shared/library/sharedObject/src/shared/core/SetupSharedObject.h index dd38e215..ce43740e 100755 --- a/engine/shared/library/sharedObject/src/shared/core/SetupSharedObject.h +++ b/engine/shared/library/sharedObject/src/shared/core/SetupSharedObject.h @@ -70,7 +70,7 @@ public: // Specifies whether or not ObjectTemplateList should load the object template crc table bool loadObjectTemplateCrcStringTable; - // Specifies the name of the POB ejection point transform override filename to use; use NULL (default) if no ejection point support. + // Specifies the name of the POB ejection point transform override filename to use; use nullptr (default) if no ejection point support. char const *pobEjectionTransformFilename; private: diff --git a/engine/shared/library/sharedObject/src/shared/customization/CustomizationData.cpp b/engine/shared/library/sharedObject/src/shared/customization/CustomizationData.cpp index e27808f2..a05ed186 100755 --- a/engine/shared/library/sharedObject/src/shared/customization/CustomizationData.cpp +++ b/engine/shared/library/sharedObject/src/shared/customization/CustomizationData.cpp @@ -277,10 +277,10 @@ CustomizationData::CustomizationData(Object &owner) : void CustomizationData::addVariableTakeOwnership(const std::string &fullVariablePathName, CustomizationVariable *variable) { - //-- check for null variable + //-- check for nullptr variable if (!variable) { - WARNING(true, ("addVariableTakeOwnership() called with null variable.\n")); + WARNING(true, ("addVariableTakeOwnership() called with nullptr variable.\n")); return; } @@ -591,7 +591,7 @@ std::string CustomizationData::writeLocalDataToString() const saveToByteVector(binaryData); - //-- Convert binary data to string. We're escaping the 0 for the database so this is a non-null string. + //-- Convert binary data to string. We're escaping the 0 for the database so this is a non-nullptr string. // We translate 0x00 => 0xff 0x01 // 0xff => 0xff 0x02 std::string returnValue; @@ -1139,7 +1139,7 @@ void CustomizationData::notifyPendingRemoteDestruction(const CustomizationData * //-- validate arg if (!customizationData) { - DEBUG_WARNING(true, ("notifyPendingRemoteDestruction(): customizationData arg is null")); + DEBUG_WARNING(true, ("notifyPendingRemoteDestruction(): customizationData arg is nullptr")); return; } diff --git a/engine/shared/library/sharedObject/src/shared/customization/CustomizationData_LocalDirectory.cpp b/engine/shared/library/sharedObject/src/shared/customization/CustomizationData_LocalDirectory.cpp index 3a8422cb..1a12a2fd 100755 --- a/engine/shared/library/sharedObject/src/shared/customization/CustomizationData_LocalDirectory.cpp +++ b/engine/shared/library/sharedObject/src/shared/customization/CustomizationData_LocalDirectory.cpp @@ -95,7 +95,7 @@ bool CustomizationData::LocalDirectory::resolvePathNameToDirectory(const std::st //-- ensure we've got a directory if (!subdir) { - WARNING(true, ("resolvePathNameToDirectory(): logic failure, subdir is null")); + WARNING(true, ("resolvePathNameToDirectory(): logic failure, subdir is nullptr")); return false; } @@ -110,7 +110,7 @@ bool CustomizationData::LocalDirectory::addVariableTakeOwnership(const std::stri //-- ensure caller passed in valid customizationVariable if (!variable) { - WARNING(true, ("addVariableTakeOwnership(): caller passed in NULL variable")); + WARNING(true, ("addVariableTakeOwnership(): caller passed in nullptr variable")); return false; } @@ -210,10 +210,10 @@ CustomizationData::Directory *CustomizationData::LocalDirectory::findDirectory(c void CustomizationData::LocalDirectory::deleteDirectory(Directory *childDirectory) { - //-- check for null directory + //-- check for nullptr directory if (!childDirectory) { - WARNING(true, ("deleteDirectory(): NULL childDirectory arg")); + WARNING(true, ("deleteDirectory(): nullptr childDirectory arg")); return; } @@ -255,10 +255,10 @@ void CustomizationData::LocalDirectory::iterateOverConstVariables(const std::str const DirectoryMap::const_iterator endIt = m_directories.end(); for (DirectoryMap::const_iterator it = m_directories.begin(); it != endIt; ++it) { - //-- check for null directory pointer (shouldn't happen but shouldn't FATAL) + //-- check for nullptr directory pointer (shouldn't happen but shouldn't FATAL) if (!it->second) { - WARNING(true, ("iterateOverConstVariables(): directory 0x%08x has null child directory for [%s].", this, it->first.getString())); + WARNING(true, ("iterateOverConstVariables(): directory 0x%08x has nullptr child directory for [%s].", this, it->first.getString())); return; } @@ -292,10 +292,10 @@ void CustomizationData::LocalDirectory::iterateOverVariables(const std::string & const DirectoryMap::iterator endIt = m_directories.end(); for (DirectoryMap::iterator it = m_directories.begin(); it != endIt; ++it) { - //-- check for null directory pointer (shouldn't happen but shouldn't FATAL) + //-- check for nullptr directory pointer (shouldn't happen but shouldn't FATAL) if (!it->second) { - WARNING(true, ("iterateOverConstVariables(): directory 0x%08x has null child directory for [%s].", this, it->first.getString())); + WARNING(true, ("iterateOverConstVariables(): directory 0x%08x has nullptr child directory for [%s].", this, it->first.getString())); return; } @@ -314,10 +314,10 @@ void CustomizationData::LocalDirectory::iterateOverVariables(const std::string & void CustomizationData::LocalDirectory::replaceOrAddDirectory(const std::string &directoryPathName, int directoryNameStartIndex, Directory *directory) { - //-- ensure attached directory is not null + //-- ensure attached directory is not nullptr if (!directory) { - WARNING(true, ("replaceOrAddDirectory(): directory arg is NULL")); + WARNING(true, ("replaceOrAddDirectory(): directory arg is nullptr")); return; } @@ -411,7 +411,7 @@ std::string CustomizationData::LocalDirectory::writeLocalDirectoryToString() con const CustomizationVariableMap::const_iterator endIt = m_variables.end(); for (CustomizationVariableMap::const_iterator it = m_variables.begin(); it != endIt; ++it) { - //-- verify it's a non-null variable + //-- verify it's a non-nullptr variable const CustomizationVariable *const variable = it->second; if (variable && variable->doesVariablePersist()) { @@ -430,11 +430,11 @@ std::string CustomizationData::LocalDirectory::writeLocalDirectoryToString() con const CustomizationVariableMap::const_iterator endIt = m_variables.end(); for (CustomizationVariableMap::const_iterator it = m_variables.begin(); it != endIt; ++it) { - //-- verify it's a non-null variable + //-- verify it's a non-nullptr variable const CustomizationVariable *const variable = it->second; if (!variable) { - WARNING(true, ("writeLocalDirectoryToString: NULL variable for [%s], skipping variable writing.")); + WARNING(true, ("writeLocalDirectoryToString: nullptr variable for [%s], skipping variable writing.")); continue; } diff --git a/engine/shared/library/sharedObject/src/shared/customization/CustomizationIdManager.cpp b/engine/shared/library/sharedObject/src/shared/customization/CustomizationIdManager.cpp index 32208e24..b21696d4 100755 --- a/engine/shared/library/sharedObject/src/shared/customization/CustomizationIdManager.cpp +++ b/engine/shared/library/sharedObject/src/shared/customization/CustomizationIdManager.cpp @@ -189,7 +189,7 @@ bool CustomizationIdManager::mapIdToString(int id, char *variableName, int buffe NOT_NULL(variableName); DEBUG_FATAL(bufferLength < 1, ("CustomizationIdManager: bufferLength of [%d] too small to hold anything.", bufferLength)); - //-- Copy variable name to user buffer, ensure it gets NULL terminated. + //-- Copy variable name to user buffer, ensure it gets nullptr terminated. strncpy(variableName, NON_NULL(s_idToVariableName[static_cast(id)])->getString(), static_cast(bufferLength - 1)); variableName[bufferLength - 1] = '\0'; diff --git a/engine/shared/library/sharedObject/src/shared/customization/ObjectTemplateCustomizationDataWriter.cpp b/engine/shared/library/sharedObject/src/shared/customization/ObjectTemplateCustomizationDataWriter.cpp index a02bf9d0..3e18e9a9 100755 --- a/engine/shared/library/sharedObject/src/shared/customization/ObjectTemplateCustomizationDataWriter.cpp +++ b/engine/shared/library/sharedObject/src/shared/customization/ObjectTemplateCustomizationDataWriter.cpp @@ -149,7 +149,7 @@ bool ObjectTemplateCustomizationDataWriter::writeToFile(const std::string &pathN if (!allowOverwrite) { FILE *const testFile = fopen(pathName.c_str(), "r"); - if (testFile != NULL) + if (testFile != nullptr) { fclose(testFile); DEBUG_REPORT_LOG(true, ("writeToFile(): overwrite attempt: skipped writing [%s] because it already exists and allowOverwrite == false.\n", pathName.c_str())); diff --git a/engine/shared/library/sharedObject/src/shared/lot/LotManager.cpp b/engine/shared/library/sharedObject/src/shared/lot/LotManager.cpp index eb5ee6bf..6d379528 100755 --- a/engine/shared/library/sharedObject/src/shared/lot/LotManager.cpp +++ b/engine/shared/library/sharedObject/src/shared/lot/LotManager.cpp @@ -129,7 +129,7 @@ void LotManager::addNoBuildEntry (Object const & object, float const noBuildRadi bool const result = m_noBuildEntryMap->insert (std::make_pair (&object, noBuildEntry)).second; UNREF (result); DEBUG_FATAL (!result, ("LotManager::addNoBuildEntry - entry already exists")); - DEBUG_REPORT_LOG (ms_logEntries, ("LotManager: added no build entry for object %s [%s] at <%1.2f, %1.2f>\n", object.getNetworkId ().getValueString ().c_str (), object.getObjectTemplateName () ? object.getObjectTemplateName () : "null", position_w.x, position_w.z)); + DEBUG_REPORT_LOG (ms_logEntries, ("LotManager: added no build entry for object %s [%s] at <%1.2f, %1.2f>\n", object.getNetworkId ().getValueString ().c_str (), object.getObjectTemplateName () ? object.getObjectTemplateName () : "nullptr", position_w.x, position_w.z)); } //------------------------------------------------------------------- @@ -150,7 +150,7 @@ void LotManager::removeNoBuildEntry (const Object& object) else DEBUG_FATAL (true, ("LotManager::removeNoBuildEntry - entry not found")); - DEBUG_REPORT_LOG (ms_logEntries, ("LotManager: removed no build entry for object %s [%s]\n", object.getNetworkId ().getValueString ().c_str (), object.getObjectTemplateName () ? object.getObjectTemplateName () : "null")); + DEBUG_REPORT_LOG (ms_logEntries, ("LotManager: removed no build entry for object %s [%s]\n", object.getNetworkId ().getValueString ().c_str (), object.getObjectTemplateName () ? object.getObjectTemplateName () : "nullptr")); } //------------------------------------------------------------------- @@ -177,7 +177,7 @@ void LotManager::addStructureFootprintEntry (const Object& object, const Structu UNREF (result); DEBUG_FATAL (!result, ("LotManager::addStructureFootprintEntry - entry already exists")); - DEBUG_REPORT_LOG (ms_logEntries, ("LotManager: added structure footprint entry for object %s [%s] at <%1.2f, %1.2f>\n", object.getNetworkId ().getValueString ().c_str (), object.getObjectTemplateName () ? object.getObjectTemplateName () : "null", x * m_chunkWidthInMeters + m_chunkWidthInMeters * 0.5f, z * m_chunkWidthInMeters + m_chunkWidthInMeters * 0.5f)); + DEBUG_REPORT_LOG (ms_logEntries, ("LotManager: added structure footprint entry for object %s [%s] at <%1.2f, %1.2f>\n", object.getNetworkId ().getValueString ().c_str (), object.getObjectTemplateName () ? object.getObjectTemplateName () : "nullptr", x * m_chunkWidthInMeters + m_chunkWidthInMeters * 0.5f, z * m_chunkWidthInMeters + m_chunkWidthInMeters * 0.5f)); } //------------------------------------------------------------------- @@ -191,7 +191,7 @@ void LotManager::removeStructureFootprintEntry (const Object& object) else DEBUG_FATAL (true, ("LotManager::removeStructureFootprintEntry - entry not found")); - DEBUG_REPORT_LOG (ms_logEntries, ("LotManager: removed structure footprint entry for object %s [%s]\n", object.getNetworkId ().getValueString ().c_str (), object.getObjectTemplateName () ? object.getObjectTemplateName () : "null")); + DEBUG_REPORT_LOG (ms_logEntries, ("LotManager: removed structure footprint entry for object %s [%s]\n", object.getNetworkId ().getValueString ().c_str (), object.getObjectTemplateName () ? object.getObjectTemplateName () : "nullptr")); } //------------------------------------------------------------------- diff --git a/engine/shared/library/sharedObject/src/shared/object/AlterScheduler.cpp b/engine/shared/library/sharedObject/src/shared/object/AlterScheduler.cpp index e09b9c37..dc2a932c 100755 --- a/engine/shared/library/sharedObject/src/shared/object/AlterScheduler.cpp +++ b/engine/shared/library/sharedObject/src/shared/object/AlterScheduler.cpp @@ -277,13 +277,13 @@ void AlterSchedulerNamespace::reportPrint() // ---------------------------------------------------------------------- /** - * NULL objects are not considered valid by this function. Do not call this on a NULL + * nullptr objects are not considered valid by this function. Do not call this on a nullptr * object if that happens to be valid in the context in which this function is used. */ void AlterSchedulerNamespace::validateObject(Object const *object) { - FATAL(!object, ("validateObject(): alter scheduler found NULL object.")); + FATAL(!object, ("validateObject(): alter scheduler found nullptr object.")); DO_ON_VALIDATE_OBJECTS(bool isInvalid = false); @@ -331,7 +331,7 @@ void AlterSchedulerNamespace::validateObject(Object const *object) if (isInvalid) { //-- Print out object info for the invalid object if we have it. - ObjectInfo *objectInfo = NULL; + ObjectInfo *objectInfo = nullptr; if (s_trackObjectInfo) { ObjectInfoMap::iterator findIt = s_objectInfoMap.find(const_cast(object)); @@ -352,7 +352,7 @@ void AlterSchedulerNamespace::validateObject(Object const *object) // ---------------------------------------------------------------------- /** - * Return true if two strings are the same (or are both NULL); otherwise, return false. + * Return true if two strings are the same (or are both nullptr); otherwise, return false. */ static bool SafeStringEqual(char const *string1, char const *string2) @@ -682,7 +682,7 @@ void AlterScheduler::alter(float elapsedTime) DO_ON_DEBUG(if (s_suspendExecution) return); PROFILER_AUTO_BLOCK_DEFINE("AlterScheduler::alter"); - doAlterAndConcludeForAllObjects(elapsedTime, CS_none, NULL); + doAlterAndConcludeForAllObjects(elapsedTime, CS_none, nullptr); } // ---------------------------------------------------------------------- @@ -702,7 +702,7 @@ void AlterScheduler::alterAndConclude(float elapsedTime) DO_ON_DEBUG(if (s_suspendExecution) return); PROFILER_AUTO_BLOCK_DEFINE("AlterScheduler::alterAndConclude"); - doAlterAndConcludeForAllObjects(elapsedTime, CS_all, NULL); + doAlterAndConcludeForAllObjects(elapsedTime, CS_all, nullptr); } // ---------------------------------------------------------------------- @@ -724,7 +724,7 @@ void AlterScheduler::initializeScheduleTimeMapIterator(Object &object) bool AlterScheduler::isIteratorInScheduleTimeMap(void const *iterator) { - DEBUG_FATAL(!iterator, ("AlterScheduler::isIteratorInScheduleTimeMap(): iterator pointer is NULL.")); + DEBUG_FATAL(!iterator, ("AlterScheduler::isIteratorInScheduleTimeMap(): iterator pointer is nullptr.")); return (*static_cast(iterator) != s_scheduleMap.end()); } @@ -734,7 +734,7 @@ bool AlterScheduler::findObjectInAlterNowList(Object const *object) { DO_ON_HARDCORE_VALIDATION(validateAlterNowList()); - for (Object *searchObject = s_alterNowListFirst->getNextFromAlterNowList(); searchObject != NULL; searchObject = searchObject->getNextFromAlterNowList()) + for (Object *searchObject = s_alterNowListFirst->getNextFromAlterNowList(); searchObject != nullptr; searchObject = searchObject->getNextFromAlterNowList()) { if (searchObject == object) return true; @@ -751,7 +751,7 @@ bool AlterScheduler::findObjectInAlterNextFrameLists(Object const *object) for (int phaseIndex = 0; phaseIndex < AS_MAX_SCHEDULE_PHASE_COUNT; ++phaseIndex) { - for (Object *searchObject = s_alterNextFrameListFirst[phaseIndex]->getNextFromAlterNextFrameList(); searchObject != NULL; searchObject = searchObject->getNextFromAlterNextFrameList()) + for (Object *searchObject = s_alterNextFrameListFirst[phaseIndex]->getNextFromAlterNextFrameList(); searchObject != nullptr; searchObject = searchObject->getNextFromAlterNextFrameList()) { if (searchObject == object) return true; @@ -767,7 +767,7 @@ bool AlterScheduler::findObjectInConcludeList(Object const *object) { DO_ON_HARDCORE_VALIDATION(validateConcludeList()); - for (Object *searchObject = s_concludeListFirst->getNextFromConcludeList(); searchObject != NULL; searchObject = searchObject->getNextFromConcludeList()) + for (Object *searchObject = s_concludeListFirst->getNextFromConcludeList(); searchObject != nullptr; searchObject = searchObject->getNextFromConcludeList()) { if (searchObject == object) return true; @@ -817,7 +817,7 @@ void AlterScheduler::validateAlterNowList() //-- Add each object to the set and list. { - for (Object *object = s_alterNowListFirst->getNextFromAlterNowList(); object != NULL; object = object->getNextFromAlterNowList()) + for (Object *object = s_alterNowListFirst->getNextFromAlterNowList(); object != nullptr; object = object->getNextFromAlterNowList()) { DO_ON_VALIDATE_OBJECTS(validateObject(object)); @@ -836,7 +836,7 @@ void AlterScheduler::validateAlterNowList() { ObjectList::iterator const endIt = objectList.end(); Object *object = s_alterNowListFirst->getNextFromAlterNowList(); - for (ObjectList::iterator it = objectList.begin(); (it != endIt) && (object != NULL); object = object->getNextFromAlterNowList(), ++it) + for (ObjectList::iterator it = objectList.begin(); (it != endIt) && (object != nullptr); object = object->getNextFromAlterNowList(), ++it) { lastObject = object; DEBUG_WARNING(object != *it, ("validateAlterNowList(): forward linkage check failed, stl list: pointer=[%p], object id=[%s], object template=[%s].", *it, (*it)->getNetworkId().getValueString().c_str(), (*it)->getObjectTemplateName())); @@ -848,7 +848,7 @@ void AlterScheduler::validateAlterNowList() { ObjectList::reverse_iterator const endIt = objectList.rend(); Object *object = lastObject; - for (ObjectList::reverse_iterator it = objectList.rbegin(); (it != endIt) && (object != NULL); object = object->getPreviousFromAlterNowList(), ++it) + for (ObjectList::reverse_iterator it = objectList.rbegin(); (it != endIt) && (object != nullptr); object = object->getPreviousFromAlterNowList(), ++it) { DEBUG_WARNING(object != *it, ("validateAlterNowList(): reverse linkage check failed, stl list: pointer=[%p], object id=[%s], object template=[%s].", *it, (*it)->getNetworkId().getValueString().c_str(), (*it)->getObjectTemplateName())); DEBUG_FATAL(object != *it, ("validateAlterNowList(): reverse linkage check failed, alter scheduler list: pointer=[%p], object id=[%s], object template=[%s].", object, object->getNetworkId().getValueString().c_str(), object->getObjectTemplateName())); @@ -867,7 +867,7 @@ void AlterScheduler::validateAlterNextFrameLists() { //-- Add each object to the set and list. { - for (Object *object = s_alterNextFrameListFirst[phaseIndex]->getNextFromAlterNextFrameList(); object != NULL; object = object->getNextFromAlterNextFrameList()) + for (Object *object = s_alterNextFrameListFirst[phaseIndex]->getNextFromAlterNextFrameList(); object != nullptr; object = object->getNextFromAlterNextFrameList()) { DO_ON_VALIDATE_OBJECTS(validateObject(object)); @@ -886,7 +886,7 @@ void AlterScheduler::validateAlterNextFrameLists() { ObjectList::iterator const endIt = objectList.end(); Object *object = s_alterNextFrameListFirst[phaseIndex]->getNextFromAlterNextFrameList(); - for (ObjectList::iterator it = objectList.begin(); (it != endIt) && (object != NULL); object = object->getNextFromAlterNextFrameList(), ++it) + for (ObjectList::iterator it = objectList.begin(); (it != endIt) && (object != nullptr); object = object->getNextFromAlterNextFrameList(), ++it) { lastObject = object; DEBUG_WARNING(object != *it, ("validateAlterNextFrameList(): forward linkage check failed, stl list: pointer=[%p], object id=[%s], object template=[%s].", *it, (*it)->getNetworkId().getValueString().c_str(), (*it)->getObjectTemplateName())); @@ -898,7 +898,7 @@ void AlterScheduler::validateAlterNextFrameLists() { ObjectList::reverse_iterator const endIt = objectList.rend(); Object *object = lastObject; - for (ObjectList::reverse_iterator it = objectList.rbegin(); (it != endIt) && (object != NULL); object = object->getPreviousFromAlterNextFrameList(), ++it) + for (ObjectList::reverse_iterator it = objectList.rbegin(); (it != endIt) && (object != nullptr); object = object->getPreviousFromAlterNextFrameList(), ++it) { DEBUG_WARNING(object != *it, ("validateAlterNextFrameList(): reverse linkage check failed, stl list: pointer=[%p], object id=[%s], object template=[%s].", *it, (*it)->getNetworkId().getValueString().c_str(), (*it)->getObjectTemplateName())); DEBUG_FATAL(object != *it, ("validateAlterNextFrameList(): reverse linkage check failed, alter scheduler list: pointer=[%p], object id=[%s], object template=[%s].", object, object->getNetworkId().getValueString().c_str(), object->getObjectTemplateName())); @@ -919,7 +919,7 @@ void AlterScheduler::validateConcludeList() //-- Add each object to the set and list. { - for (Object *object = s_concludeListFirst->getNextFromConcludeList(); object != NULL; object = object->getNextFromConcludeList()) + for (Object *object = s_concludeListFirst->getNextFromConcludeList(); object != nullptr; object = object->getNextFromConcludeList()) { DO_ON_VALIDATE_OBJECTS(validateObject(object)); @@ -938,7 +938,7 @@ void AlterScheduler::validateConcludeList() { ObjectList::iterator const endIt = objectList.end(); Object *object = s_concludeListFirst->getNextFromConcludeList(); - for (ObjectList::iterator it = objectList.begin(); (it != endIt) && (object != NULL); object = object->getNextFromConcludeList(), ++it) + for (ObjectList::iterator it = objectList.begin(); (it != endIt) && (object != nullptr); object = object->getNextFromConcludeList(), ++it) { lastObject = object; DEBUG_WARNING(object != *it, ("validateConcludeList(): forward linkage check failed, stl list: pointer=[%p], object id=[%s], object template=[%s].", *it, (*it)->getNetworkId().getValueString().c_str(), (*it)->getObjectTemplateName())); @@ -950,7 +950,7 @@ void AlterScheduler::validateConcludeList() { ObjectList::reverse_iterator const endIt = objectList.rend(); Object *object = lastObject; - for (ObjectList::reverse_iterator it = objectList.rbegin(); (it != endIt) && (object != NULL); object = object->getPreviousFromConcludeList(), ++it) + for (ObjectList::reverse_iterator it = objectList.rbegin(); (it != endIt) && (object != nullptr); object = object->getPreviousFromConcludeList(), ++it) { DEBUG_WARNING(object != *it, ("validateConcludeList(): reverse linkage check failed, stl list: pointer=[%p], object id=[%s], object template=[%s].", *it, (*it)->getNetworkId().getValueString().c_str(), (*it)->getObjectTemplateName())); DEBUG_FATAL(object != *it, ("validateConcludeList(): reverse linkage check failed, alter scheduler list: pointer=[%p], object id=[%s], object template=[%s].", object, object->getNetworkId().getValueString().c_str(), object->getObjectTemplateName())); @@ -1184,8 +1184,8 @@ void AlterScheduler::moveObjectsFromAlterNextFrameListToAlterNowList(int schedul { PROFILER_AUTO_BLOCK_DEFINE("copy next frame"); - //if (s_alterNextFrameListFirst != NULL) { - for (Object *object = s_alterNextFrameListFirst[schedulePhaseIndex]->getNextFromAlterNextFrameList(); object != NULL; ) + //if (s_alterNextFrameListFirst != nullptr) { + for (Object *object = s_alterNextFrameListFirst[schedulePhaseIndex]->getNextFromAlterNextFrameList(); object != nullptr; ) { //-- Add object to alter now list. This removes the object from the alter next frame list. DO_ON_VALIDATE_OBJECTS(validateObject(object)); @@ -1222,7 +1222,7 @@ void AlterScheduler::alterSingleObject(Object *object, ConcludeStyle concludeSty DO_ON_DEBUG(s_currentlyAlteringObject = object); #if defined(_WIN32) && defined(_DEBUG) - char const * const typeName = s_profileAlterByType ? typeid(*object).name() : NULL; + char const * const typeName = s_profileAlterByType ? typeid(*object).name() : nullptr; PROFILER_BLOCK_DEFINE(profilerBlock, typeName); if (typeName) PROFILER_BLOCK_ENTER(profilerBlock); @@ -1245,7 +1245,7 @@ void AlterScheduler::alterSingleObject(Object *object, ConcludeStyle concludeSty PROFILER_BLOCK_LEAVE(profilerBlock); #endif - DO_ON_DEBUG(s_currentlyAlteringObject = NULL); + DO_ON_DEBUG(s_currentlyAlteringObject = nullptr); DO_ON_VALIDATE_OBJECTS(validateObject(object)); } @@ -1254,7 +1254,7 @@ void AlterScheduler::alterSingleObject(Object *object, ConcludeStyle concludeSty nextObject = object->getNextFromAlterNowList(); #if VALIDATE_OBJECTS - if (nextObject != NULL) + if (nextObject != nullptr) { DO_ON_HARDCORE_VALIDATION(DEBUG_FATAL(!findObjectInAlterNowList(nextObject), ("didn't find object in alter now list, unexpected."))); validateObject(nextObject); @@ -1343,7 +1343,7 @@ void AlterScheduler::alterSingleObject(Object *object, ConcludeStyle concludeSty ScheduleTime const absoluteScheduleTime = s_currentTime + dt; // Add it to the schedule list for the specified scheduler time. - // If this object is NULL, it means it returned an AlterResult that indicated it should still be alive but it somehow got killed. + // If this object is nullptr, it means it returned an AlterResult that indicated it should still be alive but it somehow got killed. //DEBUG_REPORT_LOG(object->getNetworkId() != NetworkId::cms_invalid, ("[aitest] scheduling %s to alter at %lu (%lu + %lu)\n", // object->getNetworkId().getValueString().c_str(), // static_cast(absoluteScheduleTime), @@ -1363,7 +1363,7 @@ void AlterScheduler::concludeAndRemoveAllConcludeEntries() PROFILER_AUTO_BLOCK_DEFINE("conclude"); Object *nextObject; - for (Object *object = s_concludeListFirst->getNextFromConcludeList(); object != NULL; object = nextObject) + for (Object *object = s_concludeListFirst->getNextFromConcludeList(); object != nullptr; object = nextObject) { //-- Conclude the object. DO_ON_VALIDATE_OBJECTS(validateObject(object)); @@ -1400,7 +1400,7 @@ void AlterScheduler::doAlterAndConcludeForAllObjects(float schedulerElapsedTime, DO_ON_HARDCORE_VALIDATION(validateAllContainers()); Object *nextObject; - for (Object *object = s_alterNowListFirst->getNextFromAlterNowList(); object != NULL; object = nextObject) + for (Object *object = s_alterNowListFirst->getNextFromAlterNowList(); object != nullptr; object = nextObject) alterSingleObject(object, concludeStyle, nextObject); } diff --git a/engine/shared/library/sharedObject/src/shared/object/CachedNetworkId.cpp b/engine/shared/library/sharedObject/src/shared/object/CachedNetworkId.cpp index 47c87004..ea766f6e 100755 --- a/engine/shared/library/sharedObject/src/shared/object/CachedNetworkId.cpp +++ b/engine/shared/library/sharedObject/src/shared/object/CachedNetworkId.cpp @@ -32,7 +32,7 @@ void CachedNetworkId::checkValidity() const CachedNetworkId::CachedNetworkId() : m_id(cms_invalid), -m_object(NULL) +m_object(nullptr) { } @@ -40,7 +40,7 @@ m_object(NULL) CachedNetworkId::CachedNetworkId(const NetworkId& id) : m_id(id), -m_object(NULL) +m_object(nullptr) { } @@ -48,7 +48,7 @@ m_object(NULL) CachedNetworkId::CachedNetworkId(NetworkId::NetworkIdType value) : m_id(value), -m_object(NULL) +m_object(nullptr) { } @@ -66,7 +66,7 @@ m_object(const_cast(&object)) CachedNetworkId::CachedNetworkId(const std::string &value) : m_id(value), -m_object(NULL) +m_object(nullptr) { } @@ -98,7 +98,7 @@ CachedNetworkId& CachedNetworkId::operator= (const CachedNetworkId& rhs) CachedNetworkId& CachedNetworkId::operator= (const NetworkId& rhs) { m_id = rhs; - m_object = NULL; + m_object = nullptr; return *this; } // ---------------------------------------------------------- @@ -178,7 +178,7 @@ Object* CachedNetworkId::getObject() const return m_object; } - return NULL; + return nullptr; } // ---------------------------------------------------------- diff --git a/engine/shared/library/sharedObject/src/shared/object/Object.cpp b/engine/shared/library/sharedObject/src/shared/object/Object.cpp index 73273e36..2cad0571 100755 --- a/engine/shared/library/sharedObject/src/shared/object/Object.cpp +++ b/engine/shared/library/sharedObject/src/shared/object/Object.cpp @@ -515,7 +515,7 @@ void ObjectNamespace::remove() #endif delete ms_transformMemoryBlockManager; - ms_transformMemoryBlockManager = NULL; + ms_transformMemoryBlockManager = nullptr; DEBUG_WARNING(static_cast(ms_freeDpvsObjectsList.size()) != ms_allocatedDpvsObjects, ("Leaked %d DpvsObjects lists", ms_allocatedDpvsObjects - static_cast(ms_freeDpvsObjectsList.size()))); while (!ms_systemAllocatedDpvsObjectsList.empty()) @@ -570,11 +570,11 @@ void ObjectNamespace::validatePosition(Object const & object, Vector const & pos object.getNetworkId().getValueString().c_str(), object.getObjectTemplateName(), &object, - object.getAppearance() ? object.getAppearance()->getAppearanceTemplateName() : NULL, - parent ? parent->getNetworkId().getValueString().c_str() : NULL, - parent ? parent->getObjectTemplateName() : NULL, - parent ? parent : NULL, - parent && parent->getAppearance() ? parent->getAppearance()->getAppearanceTemplateName() : NULL)); + object.getAppearance() ? object.getAppearance()->getAppearanceTemplateName() : nullptr, + parent ? parent->getNetworkId().getValueString().c_str() : nullptr, + parent ? parent->getObjectTemplateName() : nullptr, + parent ? parent : nullptr, + parent && parent->getAppearance() ? parent->getAppearance()->getAppearanceTemplateName() : nullptr)); } } @@ -703,30 +703,30 @@ Object::Object(): #if OBJECT_SUPPORTS_IS_ALTERING_FLAG m_isAltering(false), #endif - m_objectTemplate(NULL), + m_objectTemplate(nullptr), m_notificationList(NotificationListManager::getEmptyNotificationList()), - m_debugName(NULL), + m_debugName(nullptr), m_networkId(NetworkId::cms_invalid), - m_appearance(NULL), - m_controller(NULL), - m_dynamics(NULL), - m_attachedToObject(NULL), - m_attachedObjects(NULL), - m_dpvsObjects(NULL), + m_appearance(nullptr), + m_controller(nullptr), + m_dynamics(nullptr), + m_attachedToObject(nullptr), + m_attachedObjects(nullptr), + m_dpvsObjects(nullptr), m_rotations(0), m_scale(Vector::xyz111), m_objectToParent(), - m_objectToWorld(NULL), + m_objectToWorld(nullptr), m_watchedByList(), - m_containerProperty(NULL), - m_collisionProperty(NULL), + m_containerProperty(nullptr), + m_collisionProperty(nullptr), m_spatialSubdivisionHandle (0), m_useAlterScheduler(true), - m_scheduleData(NULL), + m_scheduleData(nullptr), m_shouldBakeIntoMesh(true), - m_defaultAppearance(NULL), - m_alternateAppearance(NULL), - m_containedBy(NULL) + m_defaultAppearance(nullptr), + m_alternateAppearance(nullptr), + m_containedBy(nullptr) { m_defaultAppearance = m_appearance; } @@ -752,25 +752,25 @@ Object::Object(const ObjectTemplate *objectTemplate, const NetworkId &networkId) m_debugName(0), m_networkId(networkId), m_appearance(0), - m_controller(NULL), - m_dynamics(NULL), - m_attachedToObject(NULL), - m_attachedObjects(NULL), - m_dpvsObjects(NULL), + m_controller(nullptr), + m_dynamics(nullptr), + m_attachedToObject(nullptr), + m_attachedObjects(nullptr), + m_dpvsObjects(nullptr), m_rotations(0), m_scale(Vector::xyz111), m_objectToParent(), - m_objectToWorld(NULL), + m_objectToWorld(nullptr), m_watchedByList(), - m_containerProperty(NULL), - m_collisionProperty(NULL), + m_containerProperty(nullptr), + m_collisionProperty(nullptr), m_spatialSubdivisionHandle (0), m_useAlterScheduler(true), - m_scheduleData(NULL), + m_scheduleData(nullptr), m_shouldBakeIntoMesh(true), - m_defaultAppearance(NULL), - m_alternateAppearance(NULL), - m_containedBy(NULL) + m_defaultAppearance(nullptr), + m_alternateAppearance(nullptr), + m_containedBy(nullptr) { objectTemplate->addReference(); NetworkIdManager::addObject(*this); @@ -799,25 +799,25 @@ Object::Object(const ObjectTemplate *objectTemplate, InitializeFlag): m_debugName(0), m_networkId(NetworkId::cms_invalid), m_appearance(0), - m_controller(NULL), - m_dynamics(NULL), - m_attachedToObject(NULL), - m_attachedObjects(NULL), - m_dpvsObjects(NULL), + m_controller(nullptr), + m_dynamics(nullptr), + m_attachedToObject(nullptr), + m_attachedObjects(nullptr), + m_dpvsObjects(nullptr), m_rotations(0), m_scale(Vector::xyz111), m_objectToParent(), - m_objectToWorld(NULL), + m_objectToWorld(nullptr), m_watchedByList(), - m_containerProperty(NULL), - m_collisionProperty(NULL), + m_containerProperty(nullptr), + m_collisionProperty(nullptr), m_spatialSubdivisionHandle (0), m_useAlterScheduler(true), - m_scheduleData(NULL), + m_scheduleData(nullptr), m_shouldBakeIntoMesh(true), - m_defaultAppearance(NULL), - m_alternateAppearance(NULL), - m_containedBy(NULL) + m_defaultAppearance(nullptr), + m_alternateAppearance(nullptr), + m_containedBy(nullptr) { objectTemplate->addReference(); NetworkIdManager::addObject(*this); @@ -836,7 +836,7 @@ Object::~Object(void) IGNORE_RETURN(snprintf(ms_crashReportInfo, sizeof(ms_crashReportInfo) - 1, "~Object: name=[%s] template=[%s]\n", getDebugName(), getObjectTemplateName())); ms_crashReportInfo[sizeof(ms_crashReportInfo) - 1] = '\0'; - DEBUG_REPORT_LOG(ms_logObjectDelete, ("Deleting object id=[%s], template=[%s], pointer=[%p], appearance=[%s], parent id=[%s], template=[%s], pointer=[%p], appearance=[%s]\n", getNetworkId().getValueString().c_str(), getObjectTemplateName(), this, getAppearance() ? getAppearance()->getAppearanceTemplateName() : NULL, m_attachedToObject ? m_attachedToObject->getNetworkId().getValueString().c_str() : NULL, m_attachedToObject ? m_attachedToObject->getObjectTemplateName() : NULL, m_attachedToObject ? m_attachedToObject : NULL, m_attachedToObject && m_attachedToObject->getAppearance() ? m_attachedToObject->getAppearance()->getAppearanceTemplateName() : NULL)); + DEBUG_REPORT_LOG(ms_logObjectDelete, ("Deleting object id=[%s], template=[%s], pointer=[%p], appearance=[%s], parent id=[%s], template=[%s], pointer=[%p], appearance=[%s]\n", getNetworkId().getValueString().c_str(), getObjectTemplateName(), this, getAppearance() ? getAppearance()->getAppearanceTemplateName() : nullptr, m_attachedToObject ? m_attachedToObject->getNetworkId().getValueString().c_str() : nullptr, m_attachedToObject ? m_attachedToObject->getObjectTemplateName() : nullptr, m_attachedToObject ? m_attachedToObject : nullptr, m_attachedToObject && m_attachedToObject->getAppearance() ? m_attachedToObject->getAppearance()->getAppearanceTemplateName() : nullptr)); FATAL(ConfigSharedObject::getAllowDisallowObjectDelete() && ms_disallowObjectDelete, ("Object id=[%s], template=[%s], pointer=[%p] is deleting itself when delete is not allowed", getNetworkId().getValueString().c_str(), getObjectTemplateName(), this)); #if OBJECT_SUPPORTS_IS_ALTERING_FLAG @@ -905,7 +905,7 @@ Object::~Object(void) } deleteAttachedObjects(m_attachedObjects); - m_attachedObjects = NULL; + m_attachedObjects = nullptr; } if (m_objectToWorld) @@ -914,9 +914,9 @@ Object::~Object(void) m_objectToWorld = 0; } - if (m_objectTemplate != NULL) + if (m_objectTemplate != nullptr) m_objectTemplate->releaseReference(); - m_objectTemplate = NULL; + m_objectTemplate = nullptr; m_notificationList = 0; @@ -1139,7 +1139,7 @@ void Object::removeFromWorld() { if (attached->isInWorld()) { - DEBUG_WARNING(true, ("Removing an object [id=%s template=%s] from the world with non-child attached objects [id=%s ptr=0x%08x template=%s name=%s]", getNetworkId ().getValueString ().c_str (), getObjectTemplateName () ? getObjectTemplateName () : "null", attached->getNetworkId ().getValueString ().c_str (), attached, attached->getObjectTemplateName () ? attached->getObjectTemplateName () : "null", attached->getDebugName())); + DEBUG_WARNING(true, ("Removing an object [id=%s template=%s] from the world with non-child attached objects [id=%s ptr=0x%08x template=%s name=%s]", getNetworkId ().getValueString ().c_str (), getObjectTemplateName () ? getObjectTemplateName () : "nullptr", attached->getNetworkId ().getValueString ().c_str (), attached, attached->getObjectTemplateName () ? attached->getObjectTemplateName () : "nullptr", attached->getDebugName())); attached->detachFromObject(DF_parent); } } @@ -1369,7 +1369,7 @@ bool Object::isInWorldCell() const CellProperty *Object::getParentCell() const { - Property *cell = NULL; + Property *cell = nullptr; for (Object *o = const_cast(getAttachedTo()); o && !cell; o = o->getAttachedTo()) cell = o->getCellProperty(); @@ -1580,7 +1580,7 @@ void Object::setAppearance(Appearance *newAppearance) * Steal the Appearance from this object. * * This routine will return the current appearance of this object, and - * then reset its appearance to NULL. + * then reset its appearance to nullptr. * * @return The current appearance of this object */ @@ -1590,18 +1590,18 @@ Appearance *Object::stealAppearance(void) Appearance *oldAppearance = m_appearance; if(m_appearance == m_defaultAppearance) - m_defaultAppearance = NULL; + m_defaultAppearance = nullptr; else if (m_appearance == m_alternateAppearance) - m_alternateAppearance = NULL; + m_alternateAppearance = nullptr; - m_appearance = NULL; + m_appearance = nullptr; if (oldAppearance) { if (isInWorld()) oldAppearance->removeFromWorld(); - oldAppearance->setOwner(NULL); + oldAppearance->setOwner(nullptr); } return oldAppearance; @@ -1999,7 +1999,7 @@ void Object::detachFromObject(DetachFlags const detachFlags) bool const shouldAttach = (!toParentCell || noCell) ? false : m_attachedToObject != &cellProperty->getOwner(); m_objectToParent = shouldAttach ? getTransform_o2c() : getTransform_o2w(); deleteLocalTransform(m_objectToWorld); - m_objectToWorld = NULL; + m_objectToWorld = nullptr; setObjectToWorldDirty(true); // remove from the attached objects list @@ -2010,7 +2010,7 @@ void Object::detachFromObject(DetachFlags const detachFlags) attachedObjects->pop_back(); // set as unattached - m_attachedToObject = NULL; + m_attachedToObject = nullptr; bool const wasChildObject = isChildObject(); bool const wasInWorld = isInWorld(); @@ -2102,7 +2102,7 @@ void Object::removeChildObject(Object * childObjectToRemove, DetachFlags detachF Object *Object::getRootParent(void) { - DEBUG_FATAL(m_childObject && m_attachedToObject == NULL, ("am a child but attached to is NULL")); + DEBUG_FATAL(m_childObject && m_attachedToObject == nullptr, ("am a child but attached to is nullptr")); return m_childObject ? NON_NULL(m_attachedToObject)->getRootParent() : this; } @@ -2116,7 +2116,7 @@ Object *Object::getRootParent(void) const Object *Object::getRootParent(void) const { - DEBUG_FATAL(m_childObject && m_attachedToObject == NULL, ("am a child but attached to is NULL")); + DEBUG_FATAL(m_childObject && m_attachedToObject == nullptr, ("am a child but attached to is nullptr")); return m_childObject ? NON_NULL(m_attachedToObject)->getRootParent() : this; } @@ -2231,7 +2231,7 @@ void Object::setRecursiveScale(Vector const & scale) Controller* Object::stealController(void) { Controller* returnValue = m_controller; - m_controller = NULL; + m_controller = nullptr; return returnValue; } @@ -2362,7 +2362,7 @@ Property const *Object::getProperty(PropertyId const &id) const if ((*i)->getPropertyId() == id) return *i; - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -2376,7 +2376,7 @@ Property *Object::getProperty(PropertyId const &id) if ((*i)->getPropertyId() == id) return *i; - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -2399,13 +2399,13 @@ void Object::removeProperty(PropertyId const &id) } if (id == CellProperty::getClassPropertyId() || id == PortalProperty::getClassPropertyId() || id == SlottedContainer::getClassPropertyId() || id == VolumeContainer::getClassPropertyId()) - m_containerProperty = NULL; + m_containerProperty = nullptr; else if (id == ContainedByProperty::getClassPropertyId()) - m_containedBy = NULL; + m_containedBy = nullptr; else if (id == CollisionProperty::getClassPropertyId()) - m_collisionProperty = NULL; + m_collisionProperty = nullptr; } // ---------------------------------------------------------------------- @@ -2453,7 +2453,7 @@ void Object::lookAt_o (const Vector &position_o, const Vector &j_o) void Object::setAppearanceByName(char const *path) { - if (path != NULL) + if (path != nullptr) { if (TreeFile::exists(path)) { @@ -2461,7 +2461,7 @@ void Object::setAppearanceByName(char const *path) Appearance *appearance = AppearanceTemplateList::createAppearance(path); - if (appearance != NULL) + if (appearance != nullptr) { setAppearance(appearance); } else { @@ -2475,7 +2475,7 @@ void Object::setAppearanceByName(char const *path) } else { - DEBUG_WARNING(true, ("Object::setAppearanceByName() - NULL appearance path specified for object: %s", (getObjectTemplateName() == NULL) ? "" : getObjectTemplateName())); + DEBUG_WARNING(true, ("Object::setAppearanceByName() - nullptr appearance path specified for object: %s", (getObjectTemplateName() == nullptr) ? "" : getObjectTemplateName())); } } @@ -2539,7 +2539,7 @@ SlottedContainer * Object::getSlottedContainerProperty() Container *container = getContainerProperty(); if (container && container->getPropertyId() == SlottedContainer::getClassPropertyId()) return safe_cast(container); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -2549,7 +2549,7 @@ SlottedContainer const * Object::getSlottedContainerProperty() const Container const *container = getContainerProperty(); if (container && container->getPropertyId() == SlottedContainer::getClassPropertyId()) return safe_cast(container); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -2559,7 +2559,7 @@ VolumeContainer * Object::getVolumeContainerProperty() Container *container = getContainerProperty(); if (container && container->getPropertyId() == VolumeContainer::getClassPropertyId()) return safe_cast(container); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -2569,7 +2569,7 @@ VolumeContainer const * Object::getVolumeContainerProperty() const Container const *container = getContainerProperty(); if (container && container->getPropertyId() == VolumeContainer::getClassPropertyId()) return safe_cast(container); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -2579,7 +2579,7 @@ CellProperty * Object::getCellProperty() Container *container = getContainerProperty(); if (container && container->getPropertyId() == CellProperty::getClassPropertyId()) return safe_cast(container); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -2589,7 +2589,7 @@ CellProperty const * Object::getCellProperty() const Container const *container = getContainerProperty(); if (container && container->getPropertyId() == CellProperty::getClassPropertyId()) return safe_cast(container); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -2599,7 +2599,7 @@ PortalProperty * Object::getPortalProperty() Container *container = getContainerProperty(); if (container && container->getPropertyId() == PortalProperty::getClassPropertyId()) return safe_cast(container); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -2609,7 +2609,7 @@ PortalProperty const * Object::getPortalProperty() const Container const *container = getContainerProperty(); if (container && container->getPropertyId() == PortalProperty::getClassPropertyId()) return safe_cast(container); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -2658,7 +2658,7 @@ ServerObject const * Object::asServerObject() const bool Object::hasScheduleData() const { - return (m_scheduleData != NULL); + return (m_scheduleData != nullptr); } // ---------------------------------------------------------------------- @@ -2697,7 +2697,7 @@ void Object::setMostRecentAlterTime(ScheduleTime mostRecentAlterTime) bool Object::isInAlterNextFrameList() const { - return (m_scheduleData == NULL) ? false : (m_scheduleData->getAlterNextFrameNext() != NULL) || (m_scheduleData->getAlterNextFramePrevious() != NULL); + return (m_scheduleData == nullptr) ? false : (m_scheduleData->getAlterNextFrameNext() != nullptr) || (m_scheduleData->getAlterNextFramePrevious() != nullptr); } // ---------------------------------------------------------------------- @@ -2708,7 +2708,7 @@ void Object::insertIntoAlterNextFrameList(Object *afterThisObject) DEBUG_FATAL(isInAlterNextFrameList(), ("insertIntoAlterNextFrameList(): object id=[%s],template=[%s] already in AlterNextFrame list.", getNetworkId().getValueString().c_str(), getObjectTemplateName())); NOT_NULL(afterThisObject); NOT_NULL(afterThisObject->m_scheduleData); - DEBUG_FATAL(afterThisObject->m_scheduleData->getAlterNextFrameNext() && !afterThisObject->m_scheduleData->getAlterNextFrameNext()->m_scheduleData, ("Non-NULL forward link does not have schedule data.")); + DEBUG_FATAL(afterThisObject->m_scheduleData->getAlterNextFrameNext() && !afterThisObject->m_scheduleData->getAlterNextFrameNext()->m_scheduleData, ("Non-nullptr forward link does not have schedule data.")); DEBUG_FATAL(afterThisObject->m_scheduleData->getAlterNextFrameNext() && (afterThisObject->m_scheduleData->getAlterNextFrameNext()->m_scheduleData->getAlterNextFramePrevious() != afterThisObject), ("List corruption: alter next frame.")); //-- Get new next and previous object for the list. @@ -2745,13 +2745,13 @@ void Object::removeFromAlterNextFrameList() DEBUG_FATAL(newNext && !newNext->m_scheduleData, ("Next node missing schedule data.")); //-- Handle previous. - m_scheduleData->setAlterNextFramePrevious(NULL); + m_scheduleData->setAlterNextFramePrevious(nullptr); if (newPrevious) newPrevious->m_scheduleData->setAlterNextFrameNext(newNext); //-- Handle next. - m_scheduleData->setAlterNextFrameNext(NULL); + m_scheduleData->setAlterNextFrameNext(nullptr); if (newNext) newNext->m_scheduleData->setAlterNextFramePrevious(newPrevious); @@ -2766,7 +2766,7 @@ void Object::removeFromAlterNextFrameList() int Object::getAlterSchedulePhase() const { - DEBUG_FATAL(m_scheduleData == NULL, ("calling Object::getAlterSchedulePhase() when Object has no schedule data: id=[%s], template=[%s]", getNetworkId().getValueString().c_str(), getObjectTemplateName())); + DEBUG_FATAL(m_scheduleData == nullptr, ("calling Object::getAlterSchedulePhase() when Object has no schedule data: id=[%s], template=[%s]", getNetworkId().getValueString().c_str(), getObjectTemplateName())); return m_scheduleData->getSchedulePhase(); } @@ -2774,7 +2774,7 @@ int Object::getAlterSchedulePhase() const void Object::setAlterSchedulePhase(int schedulePhaseIndex) { - DEBUG_FATAL(m_scheduleData == NULL, ("calling Object::setAlterSchedulePhase() when Object has no schedule data: id=[%s], template=[%s]", getNetworkId().getValueString().c_str(), getObjectTemplateName())); + DEBUG_FATAL(m_scheduleData == nullptr, ("calling Object::setAlterSchedulePhase() when Object has no schedule data: id=[%s], template=[%s]", getNetworkId().getValueString().c_str(), getObjectTemplateName())); m_scheduleData->setSchedulePhase(schedulePhaseIndex); } @@ -2782,7 +2782,7 @@ void Object::setAlterSchedulePhase(int schedulePhaseIndex) bool Object::isInAlterNowList() const { - return (m_scheduleData == NULL) ? false : (m_scheduleData->getAlterNowNext() != NULL) || (m_scheduleData->getAlterNowPrevious() != NULL); + return (m_scheduleData == nullptr) ? false : (m_scheduleData->getAlterNowNext() != nullptr) || (m_scheduleData->getAlterNowPrevious() != nullptr); } // ---------------------------------------------------------------------- @@ -2793,7 +2793,7 @@ void Object::insertIntoAlterNowList(Object *afterThisObject) DEBUG_FATAL(isInAlterNowList(), ("insertIntoAlterNowList(): object id=[%s],template=[%s] already in AlterNow list.", getNetworkId().getValueString().c_str(), getObjectTemplateName())); NOT_NULL(afterThisObject); NOT_NULL(afterThisObject->m_scheduleData); - DEBUG_FATAL(afterThisObject->m_scheduleData->getAlterNowNext() && !afterThisObject->m_scheduleData->getAlterNowNext()->m_scheduleData, ("Non-NULL forward link does not have schedule data.")); + DEBUG_FATAL(afterThisObject->m_scheduleData->getAlterNowNext() && !afterThisObject->m_scheduleData->getAlterNowNext()->m_scheduleData, ("Non-nullptr forward link does not have schedule data.")); DEBUG_FATAL(afterThisObject->m_scheduleData->getAlterNowNext() && (afterThisObject->m_scheduleData->getAlterNowNext()->m_scheduleData->getAlterNowPrevious() != afterThisObject), ("List corruption: alter now.")); //-- Get new next and previous object for the list. @@ -2830,12 +2830,12 @@ void Object::removeFromAlterNowList() DEBUG_FATAL(newNext && !newNext->m_scheduleData, ("Next node missing schedule data.")); //-- Handle previous. - m_scheduleData->setAlterNowPrevious(NULL); + m_scheduleData->setAlterNowPrevious(nullptr); if (newPrevious) newPrevious->m_scheduleData->setAlterNowNext(newNext); //-- Handle next. - m_scheduleData->setAlterNowNext(NULL); + m_scheduleData->setAlterNowNext(nullptr); if (newNext) newNext->m_scheduleData->setAlterNowPrevious(newPrevious); @@ -2849,7 +2849,7 @@ void Object::removeFromAlterNowList() bool Object::isInConcludeList() const { - return (m_scheduleData == NULL) ? false : (m_scheduleData->getConcludeNext() != NULL) || (m_scheduleData->getConcludePrevious() != NULL); + return (m_scheduleData == nullptr) ? false : (m_scheduleData->getConcludeNext() != nullptr) || (m_scheduleData->getConcludePrevious() != nullptr); } // ---------------------------------------------------------------------- @@ -2860,7 +2860,7 @@ void Object::insertIntoConcludeList(Object *afterThisObject) DEBUG_FATAL(isInConcludeList(), ("insertIntoConcludeList(): object id=[%s],template=[%s] already in Conclude list.", getNetworkId().getValueString().c_str(), getObjectTemplateName())); NOT_NULL(afterThisObject); NOT_NULL(afterThisObject->m_scheduleData); - DEBUG_FATAL(afterThisObject->m_scheduleData->getConcludeNext() && !afterThisObject->m_scheduleData->getConcludeNext()->m_scheduleData, ("Non-NULL forward link does not have schedule data.")); + DEBUG_FATAL(afterThisObject->m_scheduleData->getConcludeNext() && !afterThisObject->m_scheduleData->getConcludeNext()->m_scheduleData, ("Non-nullptr forward link does not have schedule data.")); DEBUG_FATAL(afterThisObject->m_scheduleData->getConcludeNext() && (afterThisObject->m_scheduleData->getConcludeNext()->m_scheduleData->getConcludePrevious() != afterThisObject), ("List corruption: alter now.")); //-- Get new next and previous object for the list. @@ -2897,12 +2897,12 @@ void Object::removeFromConcludeList() DEBUG_FATAL(newNext && !newNext->m_scheduleData, ("Next node missing schedule data.")); //-- Handle previous. - m_scheduleData->setConcludePrevious(NULL); + m_scheduleData->setConcludePrevious(nullptr); if (newPrevious) newPrevious->m_scheduleData->setConcludeNext(newNext); //-- Handle next. - m_scheduleData->setConcludeNext(NULL); + m_scheduleData->setConcludeNext(nullptr); if (newNext) newNext->m_scheduleData->setConcludePrevious(newPrevious); @@ -3015,7 +3015,7 @@ void Object::scheduleForAlter_scheduleTopmostWorldParent() do { //-- Traverse parent links until there is no more parent. - for (Object *parentObject = alterObject->getParent(); parentObject != NULL; parentObject = alterObject->getParent()) + for (Object *parentObject = alterObject->getParent(); parentObject != nullptr; parentObject = alterObject->getParent()) alterObject = parentObject; //-- Traverse container until we're at a container object that is in the world. @@ -3035,7 +3035,7 @@ void Object::scheduleForAlter_scheduleTopmostWorldParent() if (alterObject->isInWorld()) { // We're done searching. - containedByProperty = NULL; + containedByProperty = nullptr; } else { @@ -3052,7 +3052,7 @@ void Object::scheduleForAlter_scheduleTopmostWorldParent() // New container might be a child object, make sure we test for a parent again. // If a parent exists, we need to run through the loop again to find the parent object. - } while (alterObject->getParent() != NULL); + } while (alterObject->getParent() != nullptr); NOT_NULL(alterObject); if (alterObject->isInitialized()) @@ -3270,13 +3270,13 @@ void Object::setAlternateAppearance(const char * path) if(!path) return; - Appearance *alternateAppearance = NULL; + Appearance *alternateAppearance = nullptr; if (TreeFile::exists(path)) { alternateAppearance = AppearanceTemplateList::createAppearance(path); - if (alternateAppearance == NULL) { + if (alternateAppearance == nullptr) { DEBUG_WARNING(true, ("Object::setAlternateAppearance() - Unable to change the object's appearance because the file does not exist: %s", path)); return; } @@ -3313,7 +3313,7 @@ void Object::setAlternateAppearance(const char * path) delete m_alternateAppearance; - m_alternateAppearance = NULL; + m_alternateAppearance = nullptr; } else { diff --git a/engine/shared/library/sharedObject/src/shared/object/Object.h b/engine/shared/library/sharedObject/src/shared/object/Object.h index 7ac8cfe1..9059b52d 100755 --- a/engine/shared/library/sharedObject/src/shared/object/Object.h +++ b/engine/shared/library/sharedObject/src/shared/object/Object.h @@ -495,7 +495,7 @@ inline const ObjectTemplate *Object::getObjectTemplate() const // // Remarks: // -// This return may return NULL. +// This return may return nullptr. inline const char *Object::getDebugName() const { @@ -518,7 +518,7 @@ inline const Vector &Object::getScale() const /** * Get the controller for an object. * - * The return value may be NULL. + * The return value may be nullptr. * * @return Const pointer to the controller */ @@ -532,7 +532,7 @@ inline const Controller *Object::getController() const /** * Get the controller for an object. * - * The return value may be NULL. + * The return value may be nullptr. * * @return Non-const pointer to the controller */ @@ -546,7 +546,7 @@ inline Controller *Object::getController() /** * Get the dynamics for an object. * - * The return value may be NULL. + * The return value may be nullptr. * * @return Const pointer to the dynamics */ @@ -560,7 +560,7 @@ inline const Dynamics *Object::getDynamics() const /** * Get the dynamics for an object. * - * The return value may be NULL. + * The return value may be nullptr. * * @return Non-const pointer to the dynamics */ @@ -598,24 +598,24 @@ inline Appearance *Object::getAppearance() /** * Get the parent object for this object. * - * This routine will return NULL if the object is not a child object. + * This routine will return nullptr if the object is not a child object. */ inline Object *Object::getParent() { - return m_childObject ? m_attachedToObject : NULL; + return m_childObject ? m_attachedToObject : nullptr; } // ---------------------------------------------------------------------- /** * Get the parent object for this object. * - * This routine will return NULL if the object is not a child object. + * This routine will return nullptr if the object is not a child object. */ inline const Object *Object::getParent() const { - return m_childObject ? m_attachedToObject : NULL; + return m_childObject ? m_attachedToObject : nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedObject/src/shared/object/ObjectList.cpp b/engine/shared/library/sharedObject/src/shared/object/ObjectList.cpp index 9e72d27d..e74133f8 100755 --- a/engine/shared/library/sharedObject/src/shared/object/ObjectList.cpp +++ b/engine/shared/library/sharedObject/src/shared/object/ObjectList.cpp @@ -63,7 +63,7 @@ ObjectList::~ObjectList() /** * Add an Object to the ObjectList. * - * This routine will call Fatal in debug compiles if it is passed a NULL + * This routine will call Fatal in debug compiles if it is passed a nullptr * object. * * This routine will call Fatal in debug compiles if the object list @@ -85,7 +85,7 @@ void ObjectList::addObject(Object *objectToAdd) /** * Remove an Object from the ObjectList. * - * This routine will call Fatal in debug compiles if it is passed a NULL + * This routine will call Fatal in debug compiles if it is passed a nullptr * object. * * @param objectToRemove Pointer to the object to remove @@ -113,13 +113,13 @@ void ObjectList::removeObjectByIndex(const Object* object, int index) // Remove the last item in the vector. m_objectVector->pop_back(); - // NULL the object from the alter-safe object list. + // nullptr the object from the alter-safe object list. uint size = m_alterSafeObjectVector->size(); for (uint i = 0; i < size; ++i) { if ((*m_alterSafeObjectVector)[i] == object) { - (*m_alterSafeObjectVector)[i] = NULL; + (*m_alterSafeObjectVector)[i] = nullptr; return; } } @@ -224,7 +224,7 @@ float ObjectList::alter(real time) if (alterResult == AlterResult::cms_kill) //lint !e777 // Testing floats for equality // It's okay, we're using constants. { // Make sure the object is still in the object list before removing it - if ((*m_alterSafeObjectVector)[i] != NULL) + if ((*m_alterSafeObjectVector)[i] != nullptr) removeObject(obj); delete obj; } diff --git a/engine/shared/library/sharedObject/src/shared/object/ObjectTemplate.cpp b/engine/shared/library/sharedObject/src/shared/object/ObjectTemplate.cpp index 5729afef..789b5d12 100755 --- a/engine/shared/library/sharedObject/src/shared/object/ObjectTemplate.cpp +++ b/engine/shared/library/sharedObject/src/shared/object/ObjectTemplate.cpp @@ -66,7 +66,7 @@ ObjectTemplate::ObjectTemplate(const std::string & filename) : { //-- Track name of most recently loading object template name to give us more // data to work with when we receive crash info. - IGNORE_RETURN(snprintf(s_crashReportInfoConstructor, sizeof(s_crashReportInfoConstructor) - 1, "ObjectTemplate_Constructor: %s\n", !filename.empty() ? filename.c_str() : "")); + IGNORE_RETURN(snprintf(s_crashReportInfoConstructor, sizeof(s_crashReportInfoConstructor) - 1, "ObjectTemplate_Constructor: %s\n", !filename.empty() ? filename.c_str() : "")); s_crashReportInfoConstructor[sizeof(s_crashReportInfoConstructor) - 1] = '\0'; } @@ -165,7 +165,7 @@ Object *ObjectTemplate::createObject() const */ void ObjectTemplate::addReference() const { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->addReference(); DataResource::addReference(); @@ -178,7 +178,7 @@ void ObjectTemplate::addReference() const */ void ObjectTemplate::releaseReference() const { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); DataResource::releaseReference(); @@ -199,7 +199,7 @@ void ObjectTemplate::loadFromIff(Iff &iff) //-- Track name of most recently loading object template name to give us more // data to work with when we receive crash info. char const *const filename = iff.getFileName(); - IGNORE_RETURN(snprintf(s_crashReportInfoLoadFromIff, sizeof(s_crashReportInfoLoadFromIff) - 1, "ObjectTemplate_Iff: %s\n", (filename && *filename) ? filename : "")); + IGNORE_RETURN(snprintf(s_crashReportInfoLoadFromIff, sizeof(s_crashReportInfoLoadFromIff) - 1, "ObjectTemplate_Iff: %s\n", (filename && *filename) ? filename : "")); s_crashReportInfoLoadFromIff[sizeof(s_crashReportInfoLoadFromIff) - 1] = '\0'; preLoad(); diff --git a/engine/shared/library/sharedObject/src/shared/object/ObjectTemplateList.cpp b/engine/shared/library/sharedObject/src/shared/object/ObjectTemplateList.cpp index 4e45484b..96663b8a 100755 --- a/engine/shared/library/sharedObject/src/shared/object/ObjectTemplateList.cpp +++ b/engine/shared/library/sharedObject/src/shared/object/ObjectTemplateList.cpp @@ -24,8 +24,8 @@ typedef DataResourceList ObjectTemplateListDataResourceList; -template <> ObjectTemplateListDataResourceList::CreateDataResourceMap *ObjectTemplateListDataResourceList::ms_bindings = NULL; -template <> ObjectTemplateListDataResourceList::LoadedDataResourceMap *ObjectTemplateListDataResourceList::ms_loaded = NULL; +template <> ObjectTemplateListDataResourceList::CreateDataResourceMap *ObjectTemplateListDataResourceList::ms_bindings = nullptr; +template <> ObjectTemplateListDataResourceList::LoadedDataResourceMap *ObjectTemplateListDataResourceList::ms_loaded = nullptr; namespace ObjectTemplateListNamespace { diff --git a/engine/shared/library/sharedObject/src/shared/object/ScheduleData.cpp b/engine/shared/library/sharedObject/src/shared/object/ScheduleData.cpp index 8de48b15..0b323d4d 100755 --- a/engine/shared/library/sharedObject/src/shared/object/ScheduleData.cpp +++ b/engine/shared/library/sharedObject/src/shared/object/ScheduleData.cpp @@ -20,12 +20,12 @@ MEMORY_BLOCK_MANAGER_IMPLEMENTATION_WITH_INSTALL(ScheduleData, true, 0, 0, 0); ScheduleData::ScheduleData(AlterScheduler::ScheduleTime initialMostRecentAlterTime): m_mostRecentAlterTime(initialMostRecentAlterTime), - m_alterNowNext(NULL), - m_alterNowPrevious(NULL), - m_alterNextFrameNext(NULL), - m_alterNextFramePrevious(NULL), - m_concludeNext(NULL), - m_concludePrevious(NULL), + m_alterNowNext(nullptr), + m_alterNowPrevious(nullptr), + m_alterNextFrameNext(nullptr), + m_alterNextFramePrevious(nullptr), + m_concludeNext(nullptr), + m_concludePrevious(nullptr), m_scheduleTimeMapIterator(), m_schedulePhase(0) { diff --git a/engine/shared/library/sharedObject/src/shared/portal/CellProperty.cpp b/engine/shared/library/sharedObject/src/shared/portal/CellProperty.cpp index d6ae066b..95281e88 100755 --- a/engine/shared/library/sharedObject/src/shared/portal/CellProperty.cpp +++ b/engine/shared/library/sharedObject/src/shared/portal/CellProperty.cpp @@ -70,14 +70,14 @@ namespace CellPropertyNamespace Object *ms_worldCellObject; Notification ms_portalCrossingNotification; bool ms_renderPortals; - CellProperty::CreateDpvsCellHookFunction ms_createDpvsCellHookFunction = NULL; - CellProperty::DestroyDpvsCellHookFunction ms_destroyDpvsCellHookFunction = NULL; - CellProperty::AddToRenderWorldHookFunction ms_addToRenderWorldHook = NULL; + CellProperty::CreateDpvsCellHookFunction ms_createDpvsCellHookFunction = nullptr; + CellProperty::DestroyDpvsCellHookFunction ms_destroyDpvsCellHookFunction = nullptr; + CellProperty::AddToRenderWorldHookFunction ms_addToRenderWorldHook = nullptr; - CellProperty::PolyAppearanceFactory ms_portalBarrierFactory = NULL; - CellProperty::PolyAppearanceFactory ms_forceFieldFactory = NULL; + CellProperty::PolyAppearanceFactory ms_portalBarrierFactory = nullptr; + CellProperty::PolyAppearanceFactory ms_forceFieldFactory = nullptr; - CellProperty::AccessAllowedHookFunction ms_accessAllowedHookFunction = NULL; + CellProperty::AccessAllowedHookFunction ms_accessAllowedHookFunction = nullptr; } using namespace CellPropertyNamespace; @@ -86,9 +86,9 @@ using namespace CellPropertyNamespace; bool CellPropertyNamespace::Notification::ms_enabled = true; CellProperty *CellProperty::ms_worldCellProperty; -CellProperty::TextureFetch CellProperty::ms_textureFetch = NULL; -CellProperty::TextureRelease CellProperty::ms_textureRelease = NULL; -CellProperty::DeleteVisibleCellProperty CellProperty::ms_deleteVisibleCellProperty = NULL; +CellProperty::TextureFetch CellProperty::ms_textureFetch = nullptr; +CellProperty::TextureRelease CellProperty::ms_textureRelease = nullptr; +CellProperty::DeleteVisibleCellProperty CellProperty::ms_deleteVisibleCellProperty = nullptr; // ====================================================================== @@ -148,9 +148,9 @@ bool CellPropertyNamespace::Notification::positionChanged(Object &object, bool c start += objUpW; end += objUpW; - CellProperty *targetCell = NULL; + CellProperty *targetCell = nullptr; - CellProperty *lastCell = NULL; + CellProperty *lastCell = nullptr; CellProperty *currentCell = object.getParentCell(); while(currentCell) @@ -163,7 +163,7 @@ bool CellPropertyNamespace::Notification::positionChanged(Object &object, bool c if(time == 1.0f) break; - if(nextCell == NULL) break; + if(nextCell == nullptr) break; if(nextCell == currentCell) break; if(nextCell == lastCell) break; @@ -235,8 +235,8 @@ void CellProperty::install() void CellProperty::remove() { delete ms_worldCellObject; - ms_worldCellObject = NULL; - ms_worldCellProperty = NULL; + ms_worldCellObject = nullptr; + ms_worldCellProperty = nullptr; } // ---------------------------------------------------------------------- @@ -282,7 +282,7 @@ Appearance *CellProperty::createPortalBarrier(VertexList const & verts, const Ve if (ms_portalBarrierFactory) return ms_portalBarrierFactory(verts,color); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -292,7 +292,7 @@ Appearance *CellProperty::createForceField(VertexList const & verts, const Vecto if (ms_forceFieldFactory) return ms_forceFieldFactory(verts,color); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -342,24 +342,24 @@ void CellProperty::setPortalTransitionsEnabled(bool enabled) CellProperty::CellProperty(Object &owner) : Container(getClassPropertyId(), owner), - m_portalProperty(NULL), + m_portalProperty(nullptr), m_cellIndex(-1), - m_appearanceObject(NULL), + m_appearanceObject(nullptr), m_portalObjectList(new PortalObjectList), m_visible(false), - m_floor(NULL), - m_cellName(NULL), + m_floor(nullptr), + m_cellName(nullptr), m_cellNameCrc(0), - m_dpvsCell(NULL), - m_environmentTexture(NULL), + m_dpvsCell(nullptr), + m_environmentTexture(nullptr), m_fogEnabled(false), m_fogColor(0), m_fogDensity(0.f), m_appliedInteriorLayout(false), - m_preVisibilityTraversalRenderHookFunctionList(NULL), - m_enterRenderHookFunctionList(NULL), - m_preDrawRenderHookFunctionList(NULL), - m_exitRenderHookFunctionList(NULL) + m_preVisibilityTraversalRenderHookFunctionList(nullptr), + m_enterRenderHookFunctionList(nullptr), + m_preDrawRenderHookFunctionList(nullptr), + m_exitRenderHookFunctionList(nullptr) { if (ms_createDpvsCellHookFunction) m_dpvsCell = (*ms_createDpvsCellHookFunction)(this); @@ -379,7 +379,7 @@ CellProperty::~CellProperty() { NOT_NULL(ms_textureRelease); ms_textureRelease(m_environmentTexture); - m_environmentTexture = NULL; + m_environmentTexture = nullptr; } if (!m_portalObjectList->empty()) @@ -391,18 +391,18 @@ CellProperty::~CellProperty() delete portalList; } - m_portalProperty = NULL; + m_portalProperty = nullptr; delete m_appearanceObject; delete m_portalObjectList; delete m_floor; - m_cellName = NULL; + m_cellName = nullptr; m_cellNameCrc = 0; if (m_dpvsCell) { NOT_NULL(ms_destroyDpvsCellHookFunction); (*ms_destroyDpvsCellHookFunction)(m_dpvsCell); - m_dpvsCell = NULL; + m_dpvsCell = nullptr; } delete m_preVisibilityTraversalRenderHookFunctionList; @@ -432,7 +432,7 @@ void CellProperty::initialize(const PortalProperty &portalProperty, int cellInde m_appearanceObject->attachToObject_p(&getOwner(), true); Appearance * const appearance = AppearanceTemplateList::createAppearance(cellTemplate.getAppearanceName()); - if (appearance != NULL) { + if (appearance != nullptr) { appearance->setShadowBlobAllowed(); m_appearanceObject->setAppearance(appearance); @@ -448,7 +448,7 @@ void CellProperty::initialize(const PortalProperty &portalProperty, int cellInde if (cellTemplate.getFloorName()) { - m_floor = FloorManager::createFloor(cellTemplate.getFloorName(),&getOwner(),NULL,false); + m_floor = FloorManager::createFloor(cellTemplate.getFloorName(),&getOwner(),nullptr,false); WARNING(!m_floor, ("Cell %s could not load floor %s", cellTemplate.getAppearanceName(), cellTemplate.getFloorName())); } else @@ -622,8 +622,8 @@ bool CellProperty::areAdjacent(const CellProperty *cellProperty1, const CellProp { bool result = false; - if ( (cellProperty1 != NULL) - && (cellProperty2 != NULL)) + if ( (cellProperty1 != nullptr) + && (cellProperty2 != nullptr)) { if (cellProperty1 == cellProperty2) { @@ -640,8 +640,8 @@ bool CellProperty::areAdjacent(const CellProperty *cellProperty1, const CellProp result = false; } - else if ( (cellProperty1->m_portalObjectList != NULL) - && (cellProperty2->m_portalObjectList != NULL)) + else if ( (cellProperty1->m_portalObjectList != nullptr) + && (cellProperty2->m_portalObjectList != nullptr)) { // Pick the list that is not the world cell property, or the // smallest list @@ -657,7 +657,7 @@ bool CellProperty::areAdjacent(const CellProperty *cellProperty1, const CellProp checkCellProperty = cellProperty1; } - if (portalObjectList != NULL) + if (portalObjectList != nullptr) { //DEBUG_REPORT_LOG((portalObjectList->size() > 1), ("Portal Object List > 1 - size: %d", portalObjectList->size())); @@ -714,7 +714,7 @@ void CellProperty::releaseWorldCellPropertyEnvironmentTexture() * * @param startPosition Starting position, in the space of this cell. * @param endPosition Ending position, in the space of this cell. - * @return The CellProperty that an object traversing the object is in. Will return NULL if remaining in this cell. + * @return The CellProperty that an object traversing the object is in. Will return nullptr if remaining in this cell. */ CellProperty *CellProperty::getDestinationCell(const Vector &startPosition, const Vector &endPosition, float &closestPortalT, bool passableOnly) const @@ -773,8 +773,8 @@ CellProperty *CellProperty::getDestinationCell(const Vector &startPosition, cons CellProperty *CellProperty::getDestinationCell(const Object *object, int portalId) const { - if(portalId < 0) return NULL; - if(object == NULL) return NULL; + if(portalId < 0) return nullptr; + if(object == nullptr) return nullptr; const PortalObjectList::const_iterator iEnd = m_portalObjectList->end(); for (PortalObjectList::const_iterator i = m_portalObjectList->begin(); i != iEnd; ++i) @@ -796,13 +796,13 @@ CellProperty *CellProperty::getDestinationCell(const Object *object, int portalI { DEBUG_WARNING(true,("CellProperty::getDestinationCell(portalId) - tried to get an invalid portal\n")); - return NULL; + return nullptr; } return portalList[static_cast(portalId)]->getNeighbor()->getParentCell(); } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -840,7 +840,7 @@ bool CellProperty::getDestinationCells(const Sphere &sphere, std::vectorgetNeighbor(); - WARNING(neighbor == NULL,("CellProperty::getDestinationCells - Cell %s has a portal without a neighbor\n",getOwner().getNetworkId().getValueString().c_str())); + WARNING(neighbor == nullptr,("CellProperty::getDestinationCells - Cell %s has a portal without a neighbor\n",getOwner().getNetworkId().getValueString().c_str())); if(neighbor) { @@ -864,7 +864,7 @@ bool CellProperty::isAdjacentTo(const CellProperty *cell) const { if(this == cell) return true; - if(cell == NULL) return false; + if(cell == nullptr) return false; // ---------- @@ -964,7 +964,7 @@ const BaseExtent *CellProperty::getCollisionExtent() const } else { - return NULL; + return nullptr; } } @@ -982,7 +982,7 @@ const BaseClass *CellProperty::getPathGraph() const } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -1111,7 +1111,7 @@ void CellProperty::drawDebugShapes(DebugShapeRenderer * const renderer) const #ifdef _DEBUG - if (renderer == NULL) + if (renderer == nullptr) return; Floor const * const floor = getFloor(); @@ -1192,7 +1192,7 @@ CellProperty::PortalObjectEntry const &CellProperty::getPortalObject(int index) bool CellProperty::getAccessAllowed() const { - if (ms_accessAllowedHookFunction != NULL) + if (ms_accessAllowedHookFunction != nullptr) return (*ms_accessAllowedHookFunction)(*this); else return true; @@ -1286,7 +1286,7 @@ Vector const CellProperty::getPosition_w(Location const & location) Vector result = location.getCoordinates(); CellProperty const * const worldCellProperty = CellProperty::getWorldCellProperty(); - if (worldCellProperty != NULL) + if (worldCellProperty != nullptr) { if (location.getCell() != worldCellProperty->getOwner().getNetworkId()) { @@ -1295,7 +1295,7 @@ Vector const CellProperty::getPosition_w(Location const & location) Object const * const cell = NetworkIdManager::getObjectById(location.getCell()); - if (cell != NULL) + if (cell != nullptr) { result = cell->rotateTranslate_o2w(location.getCoordinates()); } diff --git a/engine/shared/library/sharedObject/src/shared/portal/Portal.cpp b/engine/shared/library/sharedObject/src/shared/portal/Portal.cpp index 1fcd8d87..c8658b98 100755 --- a/engine/shared/library/sharedObject/src/shared/portal/Portal.cpp +++ b/engine/shared/library/sharedObject/src/shared/portal/Portal.cpp @@ -64,7 +64,7 @@ void Portal::install() void Portal::remove() { delete ms_doorStyleTable; - ms_doorStyleTable = NULL; + ms_doorStyleTable = nullptr; } // ---------------------------------------------------------------------- @@ -105,11 +105,11 @@ Portal::Portal(const PortalPropertyTemplateCellPortal &portalTemplate, CellPrope m_template(portalTemplate), m_relativeToObject(relativeTo), m_closed(false), - m_neighbor(NULL), + m_neighbor(nullptr), m_parentCell(parentCell), - m_dpvsPortal(NULL), - m_door(NULL), - m_appearance(NULL) + m_dpvsPortal(nullptr), + m_door(nullptr), + m_appearance(nullptr) { if(ms_createDoors) { @@ -126,13 +126,13 @@ Portal::~Portal() m_relativeToObject->removeDpvsObject(m_dpvsPortal); NOT_NULL(ms_destroyDpvsPortalHookFunction); (*ms_destroyDpvsPortalHookFunction)(m_dpvsPortal); - m_dpvsPortal = NULL; + m_dpvsPortal = nullptr; } - m_relativeToObject = NULL; - m_neighbor = NULL; - m_parentCell = NULL; - m_door = NULL; + m_relativeToObject = nullptr; + m_neighbor = nullptr; + m_parentCell = nullptr; + m_door = nullptr; delete m_appearance; } diff --git a/engine/shared/library/sharedObject/src/shared/portal/PortalProperty.cpp b/engine/shared/library/sharedObject/src/shared/portal/PortalProperty.cpp index e88349e2..716b488a 100755 --- a/engine/shared/library/sharedObject/src/shared/portal/PortalProperty.cpp +++ b/engine/shared/library/sharedObject/src/shared/portal/PortalProperty.cpp @@ -57,9 +57,9 @@ PropertyId PortalProperty::getClassPropertyId() PortalProperty::PortalProperty(Object &owner, const char *fileName) : Container(getClassPropertyId(), owner), - m_template(NULL), + m_template(nullptr), m_cellList(new CellList), - m_fixupList(NULL), + m_fixupList(nullptr), m_hasPassablePortalToParentCell(false) { #ifdef _DEBUG @@ -67,7 +67,7 @@ PortalProperty::PortalProperty(Object &owner, const char *fileName) #endif // _DEBUG m_template = PortalPropertyTemplateList::fetch(CrcLowerString(fileName)); - m_cellList->resize(static_cast(m_template->getNumberOfCells()), NULL); + m_cellList->resize(static_cast(m_template->getNumberOfCells()), nullptr); #ifdef _DEBUG DataLint::popAsset(); @@ -139,7 +139,7 @@ void PortalProperty::addToWorld() int unloaded = 0; int const numberOfCells = static_cast(m_cellList->size()); for (int i = 1; i < numberOfCells; ++i) - if ((*m_cellList)[static_cast(i)] == NULL) + if ((*m_cellList)[static_cast(i)] == nullptr) { WARNING(true, ("cell %d/%d not loaded", i, numberOfCells)); ++unloaded; @@ -215,7 +215,7 @@ bool PortalProperty::serverEndBaselines(int serverObjectCrc, std::vectorsize(); for (uint i = 1; i < numberOfCells; ++i) { - if ((*m_cellList)[i] == NULL) + if ((*m_cellList)[i] == nullptr) { Object *object = ms_beginCreateObjectFunction(static_cast(i)); IGNORE_RETURN(addToContents(*object, tmp)); @@ -460,7 +460,7 @@ void PortalProperty::debugPrint(std::string &buffer) const void PortalProperty::createAppearance() { Appearance * const appearance = AppearanceTemplateList::createAppearance(m_template->getExteriorAppearanceName()); - if (appearance != NULL) { + if (appearance != nullptr) { appearance->setShadowBlobAllowed(); getOwner().setAppearance(appearance); } else { @@ -563,7 +563,7 @@ CellProperty *PortalProperty::getCell(const char *desiredCellName) return (*m_cellList)[static_cast(i)]; } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedObject/src/shared/portal/PortalPropertyTemplate.cpp b/engine/shared/library/sharedObject/src/shared/portal/PortalPropertyTemplate.cpp index 09d2e9e1..a21c39b5 100755 --- a/engine/shared/library/sharedObject/src/shared/portal/PortalPropertyTemplate.cpp +++ b/engine/shared/library/sharedObject/src/shared/portal/PortalPropertyTemplate.cpp @@ -41,7 +41,7 @@ typedef BaseClass * (*ExpandBuildingGraphHook)( PortalPropertyTemplate * portalTemplate, BaseClass * baseBuildingGraph ); -ExpandBuildingGraphHook g_expandBuildingGraphHook = NULL; +ExpandBuildingGraphHook g_expandBuildingGraphHook = nullptr; // ====================================================================== @@ -257,8 +257,8 @@ PortalPropertyTemplateCellPortal::PortalPropertyTemplateCellPortal(const PortalP m_disabled(false), m_passable(false), m_geometryWindingClockwise(true), - m_portalGeometry(NULL), - m_doorStyle(NULL), + m_portalGeometry(nullptr), + m_doorStyle(nullptr), m_hasDoorHardpoint(false), m_doorHardpoint(), m_plane(), @@ -272,7 +272,7 @@ PortalPropertyTemplateCellPortal::PortalPropertyTemplateCellPortal(const PortalP PortalPropertyTemplateCellPortal::~PortalPropertyTemplateCellPortal() { - m_portalGeometry = NULL; + m_portalGeometry = nullptr; delete [] m_doorStyle; if (m_preloadManager) @@ -524,14 +524,14 @@ PortalPropertyTemplateCell::PreloadManager::~PreloadManager () PortalPropertyTemplateCell::PortalPropertyTemplateCell(const PortalPropertyTemplate &portalPropertyTemplate, int index, Iff &iff) : - m_name(NULL), - m_appearanceName(NULL), - m_floorName(NULL), - m_floorMesh(NULL), + m_name(nullptr), + m_appearanceName(nullptr), + m_floorName(nullptr), + m_floorMesh(nullptr), m_canSeeParentCell(false), - m_lightList(NULL), + m_lightList(nullptr), m_portalList(new PortalPropertyTemplateCellPortalList), - m_collisionExtent(NULL), + m_collisionExtent(nullptr), m_preloadManager (0) { load(portalPropertyTemplate, index, iff); @@ -556,7 +556,7 @@ PortalPropertyTemplateCell::~PortalPropertyTemplateCell() } delete m_collisionExtent; - m_collisionExtent = NULL; + m_collisionExtent = nullptr; if (m_preloadManager) { @@ -567,7 +567,7 @@ PortalPropertyTemplateCell::~PortalPropertyTemplateCell() if (m_floorMesh) { m_floorMesh->releaseReference (); - m_floorMesh = NULL; + m_floorMesh = nullptr; } } @@ -875,7 +875,7 @@ const char *PortalPropertyTemplateCell::getFloorName() const FloorMesh const * PortalPropertyTemplateCell::getFloorMesh() const { - if(m_floorMesh == NULL) + if(m_floorMesh == nullptr) { if(m_floorName) { @@ -885,7 +885,7 @@ FloorMesh const * PortalPropertyTemplateCell::getFloorMesh() const } else { - //-- cell template r0 always has a null floor name for POBs without accessible exteriors (POB ships & POB-only dungeons) + //-- cell template r0 always has a nullptr floor name for POBs without accessible exteriors (POB ships & POB-only dungeons) //-- don't warn for that cell template DEBUG_WARNING(ConfigSharedCollision::getReportWarnings() && strcmp(m_name, "r0"), ("PortalPropertyTemplateCell::getFloorMesh() - Cell template %s on [%s] has no floor name", m_name, m_appearanceName)); @@ -1039,7 +1039,7 @@ PortalPropertyTemplate::PortalPropertyTemplate(const CrcString &name) m_cellList(new CellList), m_cellNameList(new CellNameList), m_crc(0), - m_pathGraph(NULL), + m_pathGraph(nullptr), m_radarPortalGeometry(0) { FileName shortName(name.getString()); @@ -1079,7 +1079,7 @@ PortalPropertyTemplate::~PortalPropertyTemplate() delete m_portalOwnersList; delete m_pathGraph; - m_pathGraph = NULL; + m_pathGraph = nullptr; delete m_radarPortalGeometry; m_radarPortalGeometry = 0; diff --git a/engine/shared/library/sharedObject/src/shared/portal/SphereGrid.h b/engine/shared/library/sharedObject/src/shared/portal/SphereGrid.h index 00a1ea37..e83e48e3 100755 --- a/engine/shared/library/sharedObject/src/shared/portal/SphereGrid.h +++ b/engine/shared/library/sharedObject/src/shared/portal/SphereGrid.h @@ -373,14 +373,14 @@ inline void SphereGrid::findInRangeCapsule( Object c template inline void SphereGrid::findInRange( const Capsule & range, std::set & results) { - findInRangeCapsule( INVALID_POB, range, NULL, results ); + findInRangeCapsule( INVALID_POB, range, nullptr, results ); } template inline void SphereGrid::findInRange( Vector const ¢er_w, float radius, std::set & results) { - findInRangeSphere( INVALID_POB, center_w, radius, NULL, results ); + findInRangeSphere( INVALID_POB, center_w, radius, nullptr, results ); } @@ -401,7 +401,7 @@ inline void SphereGrid::findInRange( Vector const &c template inline void SphereGrid::findInRange( Object const *pob, Vector const ¢er_w, float radius, std::set & results) { - findInRangeSphere( pob, center_w, radius, NULL, results ); + findInRangeSphere( pob, center_w, radius, nullptr, results ); } template diff --git a/engine/shared/library/sharedObject/src/shared/property/LayerProperty.cpp b/engine/shared/library/sharedObject/src/shared/property/LayerProperty.cpp index 63f5cc57..f331b5a4 100755 --- a/engine/shared/library/sharedObject/src/shared/property/LayerProperty.cpp +++ b/engine/shared/library/sharedObject/src/shared/property/LayerProperty.cpp @@ -23,7 +23,7 @@ PropertyId LayerProperty::getClassPropertyId() LayerProperty::LayerProperty(Object& thisObject) : Property(getClassPropertyId(), thisObject), -m_layer(NULL) +m_layer(nullptr) { } @@ -31,10 +31,10 @@ m_layer(NULL) LayerProperty::~LayerProperty() { - if (m_layer != NULL) + if (m_layer != nullptr) { delete m_layer; - m_layer = NULL; + m_layer = nullptr; } } diff --git a/engine/shared/library/sharedObject/src/shared/world/World.cpp b/engine/shared/library/sharedObject/src/shared/world/World.cpp index e0d90fae..ce2ab931 100755 --- a/engine/shared/library/sharedObject/src/shared/world/World.cpp +++ b/engine/shared/library/sharedObject/src/shared/world/World.cpp @@ -305,7 +305,7 @@ bool World::removeObject (const Object* object, int listIndex) { DEBUG_FATAL (!ms_installed, ("not installed")); NOT_NULL (object); - DEBUG_FATAL (!object, ("World::removeObject - object is null")); + DEBUG_FATAL (!object, ("World::removeObject - object is nullptr")); VALIDATE_RANGE_INCLUSIVE_EXCLUSIVE (0, listIndex, static_cast(WOL_Count)); ms_objectSet.erase(object); @@ -349,7 +349,7 @@ bool World::removeObject (const Object* object, int listIndex) void World::queueObject (Object* object) { DEBUG_FATAL (!ms_installed, ("not installed")); - DEBUG_FATAL (!object, ("World::queueObject - object is null")); + DEBUG_FATAL (!object, ("World::queueObject - object is nullptr")); ms_queuedObjectList->addObject (object); } diff --git a/engine/shared/library/sharedPathfinding/src/shared/DynamicPathGraph.cpp b/engine/shared/library/sharedPathfinding/src/shared/DynamicPathGraph.cpp index 532ade02..8b264ebb 100755 --- a/engine/shared/library/sharedPathfinding/src/shared/DynamicPathGraph.cpp +++ b/engine/shared/library/sharedPathfinding/src/shared/DynamicPathGraph.cpp @@ -25,10 +25,10 @@ DynamicPathGraph::~DynamicPathGraph() clear(); delete m_nodeList; - m_nodeList = NULL; + m_nodeList = nullptr; delete m_dirtyNodes; - m_dirtyNodes = NULL; + m_dirtyNodes = nullptr; } // ---------- @@ -72,7 +72,7 @@ int DynamicPathGraph::getEdgeCount ( int nodeIndex ) const { DynamicPathNode const * node = _getNode(nodeIndex); - if(node == NULL) + if(node == nullptr) { return 0; } @@ -86,13 +86,13 @@ PathEdge * DynamicPathGraph::getEdge ( int nodeIndex, int edgeIndex ) { DynamicPathNode * node = _getNode(nodeIndex); - if(node != NULL) + if(node != nullptr) { return node->getEdge(edgeIndex); } else { - return NULL; + return nullptr; } } @@ -100,13 +100,13 @@ PathEdge const * DynamicPathGraph::getEdge ( int nodeIndex, int edgeIndex ) cons { DynamicPathNode const * node = _getNode(nodeIndex); - if(node != NULL) + if(node != nullptr) { return node->getEdge(edgeIndex); } else { - return NULL; + return nullptr; } } @@ -114,7 +114,7 @@ PathEdge const * DynamicPathGraph::getEdge ( int nodeIndex, int edgeIndex ) cons int DynamicPathGraph::addNode ( DynamicPathNode * newNode ) { - if(newNode == NULL) return -1; + if(newNode == nullptr) return -1; int listSize = m_nodeList->size(); @@ -124,7 +124,7 @@ int DynamicPathGraph::addNode ( DynamicPathNode * newNode ) { for(int i = 0; i < listSize; i++) { - if(m_nodeList->at(i) == NULL) + if(m_nodeList->at(i) == nullptr) { nodeIndex = i; break; @@ -155,11 +155,11 @@ void DynamicPathGraph::removeNode ( int nodeIndex ) DynamicPathNode * node = _getNode(nodeIndex); - if(node != NULL) + if(node != nullptr) { unlinkNode(nodeIndex); - m_nodeList->at(nodeIndex) = NULL; + m_nodeList->at(nodeIndex) = nullptr; delete node; @@ -171,7 +171,7 @@ void DynamicPathGraph::moveNode ( int nodeIndex, Vector const & newPosition ) { DynamicPathNode * node = _getNode(nodeIndex); - if(node != NULL) + if(node != nullptr) { node->setPosition_p(newPosition); @@ -230,7 +230,7 @@ void DynamicPathGraph::unlinkNode ( int nodeIndex ) { DynamicPathNode * node = _getNode(nodeIndex); - if(node == NULL) return; + if(node == nullptr) return; // ---------- @@ -254,7 +254,7 @@ void DynamicPathGraph::relinkNode ( int nodeIndex ) { DynamicPathNode * nodeA = _getNode(nodeIndex); - if(nodeA == NULL) return; + if(nodeA == nullptr) return; // ---------- @@ -268,7 +268,7 @@ void DynamicPathGraph::relinkNode ( int nodeIndex ) { DynamicPathNode * nodeB = _getNode(i); - if(nodeB == NULL) continue; + if(nodeB == nullptr) continue; if(nodeA == nodeB) continue; Vector const & posA = nodeA->getPosition_p(); @@ -314,7 +314,7 @@ void DynamicPathGraph::relinkNode ( int nodeIndex ) { DynamicPathNode * neighborNode = _getNode(neighborList[i]); - if(neighborNode != NULL) + if(neighborNode != nullptr) { neighborNode->markRedundantEdges(); neighborNode->removeMarkedEdges(); @@ -326,7 +326,7 @@ void DynamicPathGraph::relinkNode ( int nodeIndex ) DynamicPathNode * DynamicPathGraph::_getNode ( int nodeIndex ) { - if(nodeIndex == -1) return NULL; + if(nodeIndex == -1) return nullptr; return m_nodeList->at(nodeIndex); } @@ -335,7 +335,7 @@ DynamicPathNode * DynamicPathGraph::_getNode ( int nodeIndex ) DynamicPathNode const * DynamicPathGraph::_getNode ( int nodeIndex ) const { - if(nodeIndex == -1) return NULL; + if(nodeIndex == -1) return nullptr; return m_nodeList->at(nodeIndex); } diff --git a/engine/shared/library/sharedPathfinding/src/shared/DynamicPathGraph.h b/engine/shared/library/sharedPathfinding/src/shared/DynamicPathGraph.h index e2baf1f3..b778ac1a 100755 --- a/engine/shared/library/sharedPathfinding/src/shared/DynamicPathGraph.h +++ b/engine/shared/library/sharedPathfinding/src/shared/DynamicPathGraph.h @@ -20,7 +20,7 @@ class DynamicPathNode; // and remove nodes on the fly (such as city graphs) // DynamicPathGraph uses a sparse array to store its nodes. Calling -// getNode with a nodeIndex in [0,nodeCount) may return NULL. If you +// getNode with a nodeIndex in [0,nodeCount) may return nullptr. If you // want to know the number of live nodes in the graph, call getLiveNodeCount. class DynamicPathGraph : public PathGraph diff --git a/engine/shared/library/sharedPathfinding/src/shared/DynamicPathNode.cpp b/engine/shared/library/sharedPathfinding/src/shared/DynamicPathNode.cpp index 8f3798bf..b82efe57 100755 --- a/engine/shared/library/sharedPathfinding/src/shared/DynamicPathNode.cpp +++ b/engine/shared/library/sharedPathfinding/src/shared/DynamicPathNode.cpp @@ -105,7 +105,7 @@ bool DynamicPathNode::removeEdge ( int nodeIndex ) { DynamicPathNode * neighbor = _getGraph()->_getNode(nodeIndex); - if(neighbor == NULL) return false; + if(neighbor == nullptr) return false; if(!_removeEdge(nodeIndex)) return false; @@ -175,8 +175,8 @@ int DynamicPathNode::markRedundantEdges ( void ) const PathEdge const * edgeA = getEdge(i); PathEdge const * edgeB = getEdge(j); - if(edgeA == NULL) continue; - if(edgeB == NULL) continue; + if(edgeA == nullptr) continue; + if(edgeB == nullptr) continue; int iA = edgeA->getIndexA(); int iB = edgeA->getIndexB(); diff --git a/engine/shared/library/sharedPathfinding/src/shared/PathGraph.cpp b/engine/shared/library/sharedPathfinding/src/shared/PathGraph.cpp index a72faa92..0585dc87 100755 --- a/engine/shared/library/sharedPathfinding/src/shared/PathGraph.cpp +++ b/engine/shared/library/sharedPathfinding/src/shared/PathGraph.cpp @@ -69,7 +69,7 @@ int PathGraph::findNode ( PathNodeType type, int key ) const if(getEdgeCount(i) == 0) continue; - if((node != NULL) && (node->getType() == type) && (node->getKey() == key)) + if((node != nullptr) && (node->getType() == type) && (node->getKey() == key)) { return i; } @@ -88,7 +88,7 @@ int PathGraph::findEntrance ( int key ) const { PathNode const * node = getNode(i); - if(node == NULL) continue; + if(node == nullptr) continue; if(getEdgeCount(i) == 0) continue; @@ -119,7 +119,7 @@ int PathGraph::findNearestNode ( Vector const & position_p ) const { PathNode const * node = getNode(i); - if(node == NULL) continue; + if(node == nullptr) continue; if(getEdgeCount(i) == 0) continue; @@ -148,7 +148,7 @@ int PathGraph::findNearestNode ( PathNodeType searchType, Vector const & positio { PathNode const * node = getNode(i); - if(node == NULL) continue; + if(node == nullptr) continue; if(getEdgeCount(i) == 0) continue; @@ -180,7 +180,7 @@ void PathGraph::findNodesInRange ( Vector const & position_p, float range, PathN { PathNode const * node = getNode(i); - if(node == NULL) continue; + if(node == nullptr) continue; if(getEdgeCount(i) == 0) continue; diff --git a/engine/shared/library/sharedPathfinding/src/shared/PathGraphIterator.cpp b/engine/shared/library/sharedPathfinding/src/shared/PathGraphIterator.cpp index 92a4dc10..d22b581c 100755 --- a/engine/shared/library/sharedPathfinding/src/shared/PathGraphIterator.cpp +++ b/engine/shared/library/sharedPathfinding/src/shared/PathGraphIterator.cpp @@ -14,7 +14,7 @@ // ====================================================================== PathGraphIterator::PathGraphIterator () -: m_graph(NULL), +: m_graph(nullptr), m_nodeIndex(-1) { } @@ -29,18 +29,18 @@ PathGraphIterator::PathGraphIterator ( PathGraph const * graph, int nodeIndex ) bool PathGraphIterator::isValid ( void ) const { - return (m_graph != NULL) && (m_nodeIndex != -1) && (m_graph->getNode(m_nodeIndex) != NULL); + return (m_graph != nullptr) && (m_nodeIndex != -1) && (m_graph->getNode(m_nodeIndex) != nullptr); } PathNode const * PathGraphIterator::getNode ( void ) const { - if( (m_graph != NULL) && (m_nodeIndex != -1) ) + if( (m_graph != nullptr) && (m_nodeIndex != -1) ) { return m_graph->getNode( m_nodeIndex ); } else { - return NULL; + return nullptr; } } @@ -53,7 +53,7 @@ int PathGraphIterator::getNeighborCount ( void ) const PathNode const * PathGraphIterator::getNeighbor ( int whichNeighbor ) const { - if(!isValid()) return NULL; + if(!isValid()) return nullptr; return m_graph->getNode( m_graph->getEdge( m_nodeIndex, whichNeighbor )->getIndexB() ); } diff --git a/engine/shared/library/sharedPathfinding/src/shared/PathNode.cpp b/engine/shared/library/sharedPathfinding/src/shared/PathNode.cpp index 6ff18223..1eec246d 100755 --- a/engine/shared/library/sharedPathfinding/src/shared/PathNode.cpp +++ b/engine/shared/library/sharedPathfinding/src/shared/PathNode.cpp @@ -13,7 +13,7 @@ // ====================================================================== PathNode::PathNode() -: m_graph(NULL), +: m_graph(nullptr), m_index(-1), m_id(-1), m_key(-1), @@ -27,7 +27,7 @@ PathNode::PathNode() } PathNode::PathNode ( Vector const & position ) -: m_graph(NULL), +: m_graph(nullptr), m_index(-1), m_id(-1), m_key(-1), diff --git a/engine/shared/library/sharedPathfinding/src/shared/PathSearch.cpp b/engine/shared/library/sharedPathfinding/src/shared/PathSearch.cpp index 42abd9d7..e09a5cab 100755 --- a/engine/shared/library/sharedPathfinding/src/shared/PathSearch.cpp +++ b/engine/shared/library/sharedPathfinding/src/shared/PathSearch.cpp @@ -137,7 +137,7 @@ MEMORY_BLOCK_MANAGER_IMPLEMENTATION_WITH_INSTALL(PathSearchNode, true, 0, 0, 0); PathSearchNode::PathSearchNode ( PathSearch * search, PathGraph const * graph, PathNode const * node ) : m_search(search), - m_parent(NULL), + m_parent(nullptr), m_graph(graph), m_node(node), m_queued(false), @@ -164,13 +164,13 @@ PathSearchNode * PathSearchNode::getNeighbor ( int whichNeighbor ) PathNode const * neighborNode = m_graph->getNode(neighborIndex); - if(neighborNode != NULL) + if(neighborNode != nullptr) { return getSearchNode(neighborNode); } else { - return NULL; + return nullptr; } } @@ -180,7 +180,7 @@ PathSearchNode * PathSearchNode::createSearchNode( PathNode const * node ) { // doing bad voodoo with the node marks - PathSearchNode * oldNode = NULL; + PathSearchNode * oldNode = nullptr; int mark = node->getMark(3); @@ -206,7 +206,7 @@ PathSearchNode * PathSearchNode::getSearchNode( PathNode const * node ) { // doing bad voodoo with the node marks - PathSearchNode * searchNode = NULL; + PathSearchNode * searchNode = nullptr; int mark = node->getMark(3); @@ -215,7 +215,7 @@ PathSearchNode * PathSearchNode::getSearchNode( PathNode const * node ) searchNode = (PathSearchNode*)((void*)mark); } - if(searchNode == NULL) + if(searchNode == nullptr) { return createSearchNode(node); } @@ -305,9 +305,9 @@ void PathSearch::install() // ---------------------------------------------------------------------- PathSearch::PathSearch ( void ) -: m_graph(NULL), - m_start(NULL), - m_goal(NULL), +: m_graph(nullptr), + m_start(nullptr), + m_goal(nullptr), m_multiGoal(false), m_goals(new NodeList()), m_queue(new PathSearchQueue()), @@ -321,16 +321,16 @@ PathSearch::PathSearch ( void ) PathSearch::~PathSearch() { delete m_goals; - m_goals = NULL; + m_goals = nullptr; delete m_queue; - m_queue = NULL; + m_queue = nullptr; delete m_path; - m_path = NULL; + m_path = nullptr; delete m_visitedNodes; - m_visitedNodes = NULL; + m_visitedNodes = nullptr; } // ---------------------------------------------------------------------- @@ -361,7 +361,7 @@ PathSearchNode * PathSearch::search ( void ) { PathSearchNode * neighbor = node->getNeighbor(i); - if(neighbor != NULL) + if(neighbor != nullptr) { float newCost = node->getCost() + costBetween(node->getPathNode(),neighbor->getPathNode()); @@ -377,7 +377,7 @@ PathSearchNode * PathSearch::search ( void ) } } - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -395,8 +395,8 @@ bool PathSearch::search ( PathGraph const * graph, int startIndex, int goalIndex m_goal = graph->getNode(goalIndex); m_multiGoal = false; - if(m_start == NULL) return false; - if(m_goal == NULL) return false; + if(m_start == nullptr) return false; + if(m_goal == nullptr) return false; m_path->clear(); @@ -429,7 +429,7 @@ bool PathSearch::search ( PathGraph const * graph, int startIndex, IndexList con int goalCount = goalIndices.size(); if(goalCount == 0) return false; - if(m_start == NULL) return false; + if(m_start == nullptr) return false; m_goals->resize(goalCount); @@ -455,7 +455,7 @@ bool PathSearch::search ( PathGraph const * graph, int startIndex, IndexList con bool PathSearch::buildPath ( PathSearchNode * endNode ) { - if( endNode == NULL ) + if( endNode == nullptr ) { m_path->clear(); return false; @@ -633,13 +633,13 @@ IndexList const & PathSearch::getPath ( void ) const bool PathSearch::atGoal ( PathSearchNode * searchNode ) const { - if(searchNode == NULL) return false; + if(searchNode == nullptr) return false; if(m_multiGoal) { PathNode const * pathNode = searchNode->getPathNode(); - if(pathNode == NULL) return false; + if(pathNode == nullptr) return false; return std::find( m_goals->begin(), m_goals->end(), pathNode ) != m_goals->end(); } diff --git a/engine/shared/library/sharedPathfinding/src/shared/Pathfinding.cpp b/engine/shared/library/sharedPathfinding/src/shared/Pathfinding.cpp index dc532a9a..67dfa06a 100755 --- a/engine/shared/library/sharedPathfinding/src/shared/Pathfinding.cpp +++ b/engine/shared/library/sharedPathfinding/src/shared/Pathfinding.cpp @@ -69,7 +69,7 @@ BaseClass * Pathfinding::graphFactory ( Iff & iff ) { DEBUG_WARNING(true,("Pathfinding::graphFactory - Don't know how to construct a path graph from the IFF in %s\n",iff.getFileName())); - return NULL; + return nullptr; } } diff --git a/engine/shared/library/sharedPathfinding/src/shared/SetupSharedPathfinding.cpp b/engine/shared/library/sharedPathfinding/src/shared/SetupSharedPathfinding.cpp index 304f3504..230186e9 100755 --- a/engine/shared/library/sharedPathfinding/src/shared/SetupSharedPathfinding.cpp +++ b/engine/shared/library/sharedPathfinding/src/shared/SetupSharedPathfinding.cpp @@ -67,7 +67,7 @@ int findNeighbor ( PathNode * node, PathNodeType neighborType, int neighborKey ) BaseClass * expandBuildingGraph ( PortalPropertyTemplate * portalTemplate, BaseClass * baseBuildingGraph ) { - if(baseBuildingGraph == NULL) return NULL; + if(baseBuildingGraph == nullptr) return nullptr; SimplePathGraph * buildingGraph = safe_cast(baseBuildingGraph); @@ -92,11 +92,11 @@ BaseClass * expandBuildingGraph ( PortalPropertyTemplate * portalTemplate, BaseC FloorMesh const * floorMesh = cell->getFloorMesh(); - if(floorMesh == NULL) continue; + if(floorMesh == nullptr) continue; PathGraph const * cellGraph = safe_cast(floorMesh->getPathGraph()); - if(cellGraph == NULL) continue; + if(cellGraph == nullptr) continue; // ---------- diff --git a/engine/shared/library/sharedPathfinding/src/shared/SimplePathGraph.cpp b/engine/shared/library/sharedPathfinding/src/shared/SimplePathGraph.cpp index d408d035..2673b2e6 100755 --- a/engine/shared/library/sharedPathfinding/src/shared/SimplePathGraph.cpp +++ b/engine/shared/library/sharedPathfinding/src/shared/SimplePathGraph.cpp @@ -39,7 +39,7 @@ void readArray_Class ( Iff & iff, T * & array, Tag tag ) { int count = iff.read_int32(); - if(array == NULL) array = new T(); + if(array == nullptr) array = new T(); array->resize(count); @@ -58,7 +58,7 @@ void readArray_Class ( Iff & iff, T * & array, Tag tag, Reader R ) { int count = iff.read_int32(); - if(array == NULL) array = new T(); + if(array == nullptr) array = new T(); array->resize(count); @@ -77,7 +77,7 @@ void readArray_Struct ( Iff & iff, T * & array, Tag tag ) { int count = iff.read_int32(); - if(array == NULL) array = new T(); + if(array == nullptr) array = new T(); array->resize(count); @@ -157,7 +157,7 @@ SimplePathGraph::SimplePathGraph ( PathGraphType type ) { #ifdef _DEBUG - m_debugLines = NULL; + m_debugLines = nullptr; #endif } @@ -181,7 +181,7 @@ SimplePathGraph::SimplePathGraph( SimplePathGraph::NodeList * nodes, SimplePathG #ifdef _DEBUG - m_debugLines = NULL; + m_debugLines = nullptr; #endif } @@ -189,21 +189,21 @@ SimplePathGraph::SimplePathGraph( SimplePathGraph::NodeList * nodes, SimplePathG SimplePathGraph::~SimplePathGraph() { delete m_nodes; - m_nodes = NULL; + m_nodes = nullptr; delete m_edges; - m_edges = NULL; + m_edges = nullptr; delete m_edgeCounts; - m_edgeCounts = NULL; + m_edgeCounts = nullptr; delete m_edgeStarts; - m_edgeStarts = NULL; + m_edgeStarts = nullptr; #ifdef _DEBUG delete m_debugLines; - m_debugLines = NULL; + m_debugLines = nullptr; #endif } @@ -265,7 +265,7 @@ PathNode * SimplePathGraph::getNode ( int nodeIndex ) if (static_cast(nodeIndex) < m_nodes->size()) return &m_nodes->at(nodeIndex); - return NULL; + return nullptr; } PathNode const * SimplePathGraph::getNode ( int nodeIndex ) const @@ -273,7 +273,7 @@ PathNode const * SimplePathGraph::getNode ( int nodeIndex ) const if (static_cast(nodeIndex) < m_nodes->size()) return &m_nodes->at(nodeIndex); - return NULL; + return nullptr; } // ---------------------------------------------------------------------- @@ -507,7 +507,7 @@ void SimplePathGraph::drawDebugShapes ( DebugShapeRenderer * renderer ) const #ifdef _DEBUG - if(renderer == NULL) return; + if(renderer == nullptr) return; if( m_debugLines ) renderer->drawLineList( *m_debugLines, VectorArgb::solidYellow ); diff --git a/engine/shared/library/sharedRemoteDebugServer/src/shared/SharedRemoteDebugServer.cpp b/engine/shared/library/sharedRemoteDebugServer/src/shared/SharedRemoteDebugServer.cpp index 0e305c96..f33204ef 100755 --- a/engine/shared/library/sharedRemoteDebugServer/src/shared/SharedRemoteDebugServer.cpp +++ b/engine/shared/library/sharedRemoteDebugServer/src/shared/SharedRemoteDebugServer.cpp @@ -27,8 +27,8 @@ unsigned int SharedRemoteDebugServer::ms_remoteDebugToolChanne void SharedRemoteDebugServer::install() { - ms_serviceHandle = NULL; - ms_connection = NULL; + ms_serviceHandle = nullptr; + ms_connection = nullptr; if (!ConfigSharedFoundation::getUseRemoteDebug()) return; @@ -41,7 +41,7 @@ void SharedRemoteDebugServer::install() ms_serviceHandle = new Service(ConnectionAllocator(), setup); //even though this is the game client, this is a remoteDebug *server*, since it sends data to a Qt app for viewing - RemoteDebugServer::install(NULL, open, close, send, NULL); + RemoteDebugServer::install(nullptr, open, close, send, nullptr); //this value needs to be true before the call to RemoteDebugServer::open ms_installed = true; @@ -84,7 +84,7 @@ void SharedRemoteDebugServer::close(void) { DEBUG_FATAL(!ms_installed, ("sharedRemoteDebugServer not installed")); delete ms_connection; - ms_connection = NULL; + ms_connection = nullptr; } //------------------------------------------------------------------- diff --git a/engine/shared/library/sharedRemoteDebugServer/src/shared/SharedRemoteDebugServerConnection.cpp b/engine/shared/library/sharedRemoteDebugServer/src/shared/SharedRemoteDebugServerConnection.cpp index ef51481a..ac6fcd1b 100755 --- a/engine/shared/library/sharedRemoteDebugServer/src/shared/SharedRemoteDebugServerConnection.cpp +++ b/engine/shared/library/sharedRemoteDebugServer/src/shared/SharedRemoteDebugServerConnection.cpp @@ -16,7 +16,7 @@ SharedRemoteDebugServerConnection::SharedRemoteDebugServerConnection(const std::string & a, const unsigned short p) : Connection(a, p, NetworkSetupData()), -m_remotedebugCommandChannel (NULL) +m_remotedebugCommandChannel (nullptr) { } @@ -24,7 +24,7 @@ m_remotedebugCommandChannel (NULL) SharedRemoteDebugServerConnection::SharedRemoteDebugServerConnection(UdpConnectionMT * u, TcpClient * t) : Connection(u, t), -m_remotedebugCommandChannel (NULL) +m_remotedebugCommandChannel (nullptr) { } diff --git a/engine/shared/library/sharedSkillSystem/src/shared/ExpertiseManager.cpp b/engine/shared/library/sharedSkillSystem/src/shared/ExpertiseManager.cpp index 3326d378..17b9bc40 100755 --- a/engine/shared/library/sharedSkillSystem/src/shared/ExpertiseManager.cpp +++ b/engine/shared/library/sharedSkillSystem/src/shared/ExpertiseManager.cpp @@ -298,7 +298,7 @@ int const ExpertiseManager::getNumExpertiseTiers() * exist. * * @return - skill object for expertise at grid location. - * returns NULL if none found + * returns nullptr if none found */ SkillObject const * ExpertiseManager::getExpertiseSkillAt(int tree, int tier, int grid, int rank) { diff --git a/engine/shared/library/sharedSkillSystem/src/shared/LevelManager.cpp b/engine/shared/library/sharedSkillSystem/src/shared/LevelManager.cpp index 12195492..5c81ffea 100755 --- a/engine/shared/library/sharedSkillSystem/src/shared/LevelManager.cpp +++ b/engine/shared/library/sharedSkillSystem/src/shared/LevelManager.cpp @@ -335,7 +335,7 @@ void LevelManager::updateLevelDataWithSkill(LevelData &levelData, std::string co //====================================================================== // Find the level corresponding to the xp value and -// returns null if not found +// returns nullptr if not found LevelRecord const * LevelManagerNamespace::getLevelRecord(int xp) { LevelRecordsIterator itr = ms_levelRecords.begin(); @@ -365,7 +365,7 @@ LevelRecord const * LevelManagerNamespace::getLevelRecord(int xp) WARNING(true, ("getLevelRecord: Couldn't find level for xp value[%d]\n", xp)); - return NULL; + return nullptr; } //====================================================================== diff --git a/engine/shared/library/sharedSkillSystem/src/shared/SkillManager.cpp b/engine/shared/library/sharedSkillSystem/src/shared/SkillManager.cpp index c92f73c4..e0bc3718 100755 --- a/engine/shared/library/sharedSkillSystem/src/shared/SkillManager.cpp +++ b/engine/shared/library/sharedSkillSystem/src/shared/SkillManager.cpp @@ -18,7 +18,7 @@ #include #include -SkillManager *SkillManager::ms_instance = NULL; +SkillManager *SkillManager::ms_instance = nullptr; const std::string &SkillManager::cms_skillsDatatableName = "datatables/skill/skills.iff"; //----------------------------------------------------------------- @@ -92,7 +92,7 @@ void SkillManager::remove() { DEBUG_FATAL (!ms_instance, ("SkillManager not installed")); delete ms_instance; - ms_instance = NULL; + ms_instance = nullptr; } //---------------------------------------------------------------------- @@ -170,7 +170,7 @@ const SkillObject * SkillManager::loadSkill(const std::string & skillName) uint32 SkillManager::getDefaultXpLimit(const std::string & experienceType) { - if (m_xpLimitMap != NULL) + if (m_xpLimitMap != nullptr) { XpLimitMap::const_iterator result = m_xpLimitMap->find(experienceType); if (result != m_xpLimitMap->end()) @@ -183,13 +183,13 @@ uint32 SkillManager::getDefaultXpLimit(const std::string & experienceType) void SkillManager::initXpLimits() { - if (m_xpLimitTable == NULL) + if (m_xpLimitTable == nullptr) { WARNING(true, ("SkillManager::initXpLimits, m_xpLimitTable not initialized")); return; } - if (m_xpLimitMap == NULL) + if (m_xpLimitMap == nullptr) { WARNING(true, ("SkillManager::initXpLimits, m_xpLimitMap not initialized")); return; diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerArmorTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerArmorTemplate.cpp index d6f5b854..c162ae34 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerArmorTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerArmorTemplate.cpp @@ -45,7 +45,7 @@ ServerArmorTemplate::~ServerArmorTemplate() for (iter = m_specialProtection.begin(); iter != m_specialProtection.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_specialProtection.clear(); } @@ -97,10 +97,10 @@ Tag ServerArmorTemplate::getTemplateVersion(void) const */ Tag ServerArmorTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerArmorTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerArmorTemplate::getHighestTemplateVersion @@ -114,9 +114,9 @@ CompilerIntegerParam * ServerArmorTemplate::getCompilerIntegerParam(const char * { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_rating; } @@ -128,9 +128,9 @@ CompilerIntegerParam * ServerArmorTemplate::getCompilerIntegerParam(const char * { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_integrity; } @@ -142,9 +142,9 @@ CompilerIntegerParam * ServerArmorTemplate::getCompilerIntegerParam(const char * { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_effectiveness; } @@ -156,9 +156,9 @@ CompilerIntegerParam * ServerArmorTemplate::getCompilerIntegerParam(const char * { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_vulnerability; } @@ -170,9 +170,9 @@ CompilerIntegerParam * ServerArmorTemplate::getCompilerIntegerParam(const char * { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_encumbrance[index]; } @@ -180,7 +180,7 @@ CompilerIntegerParam * ServerArmorTemplate::getCompilerIntegerParam(const char * } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerArmorTemplate::getCompilerIntegerParam FloatParam * ServerArmorTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -229,7 +229,7 @@ StructParamOT * ServerArmorTemplate::getStructParamOT(const char *name, bool dee } else return TpfTemplate::getStructParamOT(name, deepCheck, index); - return NULL; + return nullptr; } //ServerArmorTemplate::getStructParamOT TriggerVolumeParam * ServerArmorTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index) @@ -316,12 +316,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -355,7 +355,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_specialProtection.begin(); iter != m_specialProtection.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_specialProtection.clear(); m_specialProtectionAppend = file.read_bool8(); @@ -532,9 +532,9 @@ CompilerIntegerParam * ServerArmorTemplate::_SpecialProtection::getCompilerInteg { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_type; } @@ -546,9 +546,9 @@ CompilerIntegerParam * ServerArmorTemplate::_SpecialProtection::getCompilerInteg { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_effectiveness; } @@ -556,7 +556,7 @@ CompilerIntegerParam * ServerArmorTemplate::_SpecialProtection::getCompilerInteg } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerArmorTemplate::_SpecialProtection::getCompilerIntegerParam FloatParam * ServerArmorTemplate::_SpecialProtection::getFloatParam(const char *name, bool deepCheck, int index) diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerBattlefieldMarkerObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerBattlefieldMarkerObjectTemplate.cpp index 4394895d..aa5440ae 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerBattlefieldMarkerObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerBattlefieldMarkerObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerBattlefieldMarkerObjectTemplate::getTemplateVersion(void) const */ Tag ServerBattlefieldMarkerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerBattlefieldMarkerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerBattlefieldMarkerObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerBuildingObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerBuildingObjectTemplate.cpp index ba0b7c07..40cf8c4e 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerBuildingObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerBuildingObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerBuildingObjectTemplate::getTemplateVersion(void) const */ Tag ServerBuildingObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerBuildingObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerBuildingObjectTemplate::getHighestTemplateVersion @@ -103,9 +103,9 @@ CompilerIntegerParam * ServerBuildingObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_maintenanceCost; } @@ -113,7 +113,7 @@ CompilerIntegerParam * ServerBuildingObjectTemplate::getCompilerIntegerParam(con } else return ServerTangibleObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerBuildingObjectTemplate::getCompilerIntegerParam FloatParam * ServerBuildingObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -129,9 +129,9 @@ BoolParam * ServerBuildingObjectTemplate::getBoolParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_isPublic; } @@ -139,7 +139,7 @@ BoolParam * ServerBuildingObjectTemplate::getBoolParam(const char *name, bool de } else return ServerTangibleObjectTemplate::getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerBuildingObjectTemplate::getBoolParam StringParam * ServerBuildingObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) @@ -227,12 +227,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerCellObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerCellObjectTemplate.cpp index 95175f0f..427b3931 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerCellObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerCellObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerCellObjectTemplate::getTemplateVersion(void) const */ Tag ServerCellObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerCellObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerCellObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerCityObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerCityObjectTemplate.cpp index b3f18a79..ac48b340 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerCityObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerCityObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerCityObjectTemplate::getTemplateVersion(void) const */ Tag ServerCityObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerCityObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerCityObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerConstructionContractObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerConstructionContractObjectTemplate.cpp index 9a0f8848..73096b66 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerConstructionContractObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerConstructionContractObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerConstructionContractObjectTemplate::getTemplateVersion(void) const */ Tag ServerConstructionContractObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerConstructionContractObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerConstructionContractObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerCreatureObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerCreatureObjectTemplate.cpp index 7159e108..f63f0d43 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerCreatureObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerCreatureObjectTemplate.cpp @@ -45,7 +45,7 @@ ServerCreatureObjectTemplate::~ServerCreatureObjectTemplate() for (iter = m_attribMods.begin(); iter != m_attribMods.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_attribMods.clear(); } @@ -97,10 +97,10 @@ Tag ServerCreatureObjectTemplate::getTemplateVersion(void) const */ Tag ServerCreatureObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerCreatureObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerCreatureObjectTemplate::getHighestTemplateVersion @@ -114,9 +114,9 @@ CompilerIntegerParam * ServerCreatureObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_attributes[index]; } @@ -128,9 +128,9 @@ CompilerIntegerParam * ServerCreatureObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_minAttributes[index]; } @@ -142,9 +142,9 @@ CompilerIntegerParam * ServerCreatureObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_maxAttributes[index]; } @@ -156,9 +156,9 @@ CompilerIntegerParam * ServerCreatureObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_shockWounds; } @@ -166,7 +166,7 @@ CompilerIntegerParam * ServerCreatureObjectTemplate::getCompilerIntegerParam(con } else return ServerTangibleObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerCreatureObjectTemplate::getCompilerIntegerParam FloatParam * ServerCreatureObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -177,9 +177,9 @@ FloatParam * ServerCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_minDrainModifier; } @@ -191,9 +191,9 @@ FloatParam * ServerCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_maxDrainModifier; } @@ -205,9 +205,9 @@ FloatParam * ServerCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_minFaucetModifier; } @@ -219,9 +219,9 @@ FloatParam * ServerCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_maxFaucetModifier; } @@ -233,9 +233,9 @@ FloatParam * ServerCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_approachTriggerRange; } @@ -247,9 +247,9 @@ FloatParam * ServerCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_maxMentalStates[index]; } @@ -261,9 +261,9 @@ FloatParam * ServerCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_mentalStatesDecay[index]; } @@ -271,7 +271,7 @@ FloatParam * ServerCreatureObjectTemplate::getFloatParam(const char *name, bool } else return ServerTangibleObjectTemplate::getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerCreatureObjectTemplate::getFloatParam BoolParam * ServerCreatureObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) @@ -282,9 +282,9 @@ BoolParam * ServerCreatureObjectTemplate::getBoolParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_canCreateAvatar; } @@ -292,7 +292,7 @@ BoolParam * ServerCreatureObjectTemplate::getBoolParam(const char *name, bool de } else return ServerTangibleObjectTemplate::getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerCreatureObjectTemplate::getBoolParam StringParam * ServerCreatureObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) @@ -303,9 +303,9 @@ StringParam * ServerCreatureObjectTemplate::getStringParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_defaultWeapon; } @@ -317,9 +317,9 @@ StringParam * ServerCreatureObjectTemplate::getStringParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_nameGeneratorType; } @@ -327,7 +327,7 @@ StringParam * ServerCreatureObjectTemplate::getStringParam(const char *name, boo } else return ServerTangibleObjectTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerCreatureObjectTemplate::getStringParam StringIdParam * ServerCreatureObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -361,7 +361,7 @@ StructParamOT * ServerCreatureObjectTemplate::getStructParamOT(const char *name, } else return ServerTangibleObjectTemplate::getStructParamOT(name, deepCheck, index); - return NULL; + return nullptr; } //ServerCreatureObjectTemplate::getStructParamOT TriggerVolumeParam * ServerCreatureObjectTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index) @@ -464,12 +464,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -549,7 +549,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_attribMods.begin(); iter != m_attribMods.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_attribMods.clear(); m_attribModsAppend = file.read_bool8(); diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerDraftSchematicObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerDraftSchematicObjectTemplate.cpp index 0bc765a5..53c05125 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerDraftSchematicObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerDraftSchematicObjectTemplate.cpp @@ -49,7 +49,7 @@ ServerDraftSchematicObjectTemplate::~ServerDraftSchematicObjectTemplate() for (iter = m_slots.begin(); iter != m_slots.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_slots.clear(); } @@ -58,7 +58,7 @@ ServerDraftSchematicObjectTemplate::~ServerDraftSchematicObjectTemplate() for (iter = m_skillCommands.begin(); iter != m_skillCommands.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_skillCommands.clear(); } @@ -67,7 +67,7 @@ ServerDraftSchematicObjectTemplate::~ServerDraftSchematicObjectTemplate() for (iter = m_manufactureScripts.begin(); iter != m_manufactureScripts.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_manufactureScripts.clear(); } @@ -119,10 +119,10 @@ Tag ServerDraftSchematicObjectTemplate::getTemplateVersion(void) const */ Tag ServerDraftSchematicObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerDraftSchematicObjectTemplate::getHighestTemplateVersion @@ -136,9 +136,9 @@ CompilerIntegerParam * ServerDraftSchematicObjectTemplate::getCompilerIntegerPar { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_category; } @@ -150,9 +150,9 @@ CompilerIntegerParam * ServerDraftSchematicObjectTemplate::getCompilerIntegerPar { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_itemsPerContainer; } @@ -160,7 +160,7 @@ CompilerIntegerParam * ServerDraftSchematicObjectTemplate::getCompilerIntegerPar } else return ServerIntangibleObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerDraftSchematicObjectTemplate::getCompilerIntegerParam FloatParam * ServerDraftSchematicObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -171,9 +171,9 @@ FloatParam * ServerDraftSchematicObjectTemplate::getFloatParam(const char *name, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_manufactureTime; } @@ -185,9 +185,9 @@ FloatParam * ServerDraftSchematicObjectTemplate::getFloatParam(const char *name, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_prototypeTime; } @@ -195,7 +195,7 @@ FloatParam * ServerDraftSchematicObjectTemplate::getFloatParam(const char *name, } else return ServerIntangibleObjectTemplate::getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerDraftSchematicObjectTemplate::getFloatParam BoolParam * ServerDraftSchematicObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) @@ -206,9 +206,9 @@ BoolParam * ServerDraftSchematicObjectTemplate::getBoolParam(const char *name, b { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_destroyIngredients; } @@ -216,7 +216,7 @@ BoolParam * ServerDraftSchematicObjectTemplate::getBoolParam(const char *name, b } else return ServerIntangibleObjectTemplate::getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerDraftSchematicObjectTemplate::getBoolParam StringParam * ServerDraftSchematicObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) @@ -227,9 +227,9 @@ StringParam * ServerDraftSchematicObjectTemplate::getStringParam(const char *nam { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_craftedObjectTemplate; } @@ -241,9 +241,9 @@ StringParam * ServerDraftSchematicObjectTemplate::getStringParam(const char *nam { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_crateObjectTemplate; } @@ -275,7 +275,7 @@ StringParam * ServerDraftSchematicObjectTemplate::getStringParam(const char *nam } else return ServerIntangibleObjectTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerDraftSchematicObjectTemplate::getStringParam StringIdParam * ServerDraftSchematicObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -309,7 +309,7 @@ StructParamOT * ServerDraftSchematicObjectTemplate::getStructParamOT(const char } else return ServerIntangibleObjectTemplate::getStructParamOT(name, deepCheck, index); - return NULL; + return nullptr; } //ServerDraftSchematicObjectTemplate::getStructParamOT TriggerVolumeParam * ServerDraftSchematicObjectTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index) @@ -418,12 +418,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -457,7 +457,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_slots.begin(); iter != m_slots.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_slots.clear(); m_slotsAppend = file.read_bool8(); @@ -476,7 +476,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_skillCommands.begin(); iter != m_skillCommands.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_skillCommands.clear(); m_skillCommandsAppend = file.read_bool8(); @@ -497,7 +497,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_manufactureScripts.begin(); iter != m_manufactureScripts.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_manufactureScripts.clear(); m_manufactureScriptsAppend = file.read_bool8(); @@ -672,7 +672,7 @@ ServerDraftSchematicObjectTemplate::_IngredientSlot::~_IngredientSlot() for (iter = m_options.begin(); iter != m_options.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_options.clear(); } @@ -719,9 +719,9 @@ FloatParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getFloatParam( { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_complexity; } @@ -729,7 +729,7 @@ FloatParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getFloatParam( } else return TpfTemplate::getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerDraftSchematicObjectTemplate::_IngredientSlot::getFloatParam BoolParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getBoolParam(const char *name, bool deepCheck, int index) @@ -740,9 +740,9 @@ BoolParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getBoolParam(co { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_optional; } @@ -750,7 +750,7 @@ BoolParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getBoolParam(co } else return TpfTemplate::getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerDraftSchematicObjectTemplate::_IngredientSlot::getBoolParam StringParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getStringParam(const char *name, bool deepCheck, int index) @@ -761,9 +761,9 @@ StringParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getStringPara { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_optionalSkillCommand; } @@ -775,9 +775,9 @@ StringParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getStringPara { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_appearance; } @@ -785,7 +785,7 @@ StringParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getStringPara } else return TpfTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerDraftSchematicObjectTemplate::_IngredientSlot::getStringParam StringIdParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getStringIdParam(const char *name, bool deepCheck, int index) @@ -796,9 +796,9 @@ StringIdParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getStringId { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_name; } @@ -806,7 +806,7 @@ StringIdParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getStringId } else return TpfTemplate::getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerDraftSchematicObjectTemplate::_IngredientSlot::getStringIdParam VectorParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getVectorParam(const char *name, bool deepCheck, int index) @@ -835,7 +835,7 @@ StructParamOT * ServerDraftSchematicObjectTemplate::_IngredientSlot::getStructPa } else return TpfTemplate::getStructParamOT(name, deepCheck, index); - return NULL; + return nullptr; } //ServerDraftSchematicObjectTemplate::_IngredientSlot::getStructParamOT TriggerVolumeParam * ServerDraftSchematicObjectTemplate::_IngredientSlot::getTriggerVolumeParam(const char *name, bool deepCheck, int index) @@ -921,7 +921,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_options.begin(); iter != m_options.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_options.clear(); m_optionsAppend = file.read_bool8(); diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerFactoryObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerFactoryObjectTemplate.cpp index cd7ab927..a4d8ae8d 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerFactoryObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerFactoryObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerFactoryObjectTemplate::getTemplateVersion(void) const */ Tag ServerFactoryObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerFactoryObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerFactoryObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerGroupObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerGroupObjectTemplate.cpp index 647b6606..a4c0367a 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerGroupObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerGroupObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerGroupObjectTemplate::getTemplateVersion(void) const */ Tag ServerGroupObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerGroupObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerGroupObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerGuildObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerGuildObjectTemplate.cpp index 446f3c34..b212df70 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerGuildObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerGuildObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerGuildObjectTemplate::getTemplateVersion(void) const */ Tag ServerGuildObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerGuildObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerGuildObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerHarvesterInstallationObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerHarvesterInstallationObjectTemplate.cpp index 7bfaaf19..6516811d 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerHarvesterInstallationObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerHarvesterInstallationObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerHarvesterInstallationObjectTemplate::getTemplateVersion(void) const */ Tag ServerHarvesterInstallationObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerHarvesterInstallationObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerHarvesterInstallationObjectTemplate::getHighestTemplateVersion @@ -103,9 +103,9 @@ CompilerIntegerParam * ServerHarvesterInstallationObjectTemplate::getCompilerInt { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_maxExtractionRate; } @@ -117,9 +117,9 @@ CompilerIntegerParam * ServerHarvesterInstallationObjectTemplate::getCompilerInt { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_currentExtractionRate; } @@ -131,9 +131,9 @@ CompilerIntegerParam * ServerHarvesterInstallationObjectTemplate::getCompilerInt { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_maxHopperSize; } @@ -141,7 +141,7 @@ CompilerIntegerParam * ServerHarvesterInstallationObjectTemplate::getCompilerInt } else return ServerInstallationObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerHarvesterInstallationObjectTemplate::getCompilerIntegerParam FloatParam * ServerHarvesterInstallationObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -162,9 +162,9 @@ StringParam * ServerHarvesterInstallationObjectTemplate::getStringParam(const ch { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_masterClassName; } @@ -172,7 +172,7 @@ StringParam * ServerHarvesterInstallationObjectTemplate::getStringParam(const ch } else return ServerInstallationObjectTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerHarvesterInstallationObjectTemplate::getStringParam StringIdParam * ServerHarvesterInstallationObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -255,12 +255,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerInstallationObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerInstallationObjectTemplate.cpp index efc11fee..6525ffe2 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerInstallationObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerInstallationObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerInstallationObjectTemplate::getTemplateVersion(void) const */ Tag ServerInstallationObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerInstallationObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerInstallationObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerIntangibleObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerIntangibleObjectTemplate.cpp index efdbfac9..43781914 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerIntangibleObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerIntangibleObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerIntangibleObjectTemplate::getTemplateVersion(void) const */ Tag ServerIntangibleObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerIntangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerIntangibleObjectTemplate::getHighestTemplateVersion @@ -103,9 +103,9 @@ CompilerIntegerParam * ServerIntangibleObjectTemplate::getCompilerIntegerParam(c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_count; } @@ -113,7 +113,7 @@ CompilerIntegerParam * ServerIntangibleObjectTemplate::getCompilerIntegerParam(c } else return ServerObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerIntangibleObjectTemplate::getCompilerIntegerParam FloatParam * ServerIntangibleObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -211,12 +211,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -316,7 +316,7 @@ ServerIntangibleObjectTemplate::_Ingredient::~_Ingredient() for (iter = m_ingredients.begin(); iter != m_ingredients.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_ingredients.clear(); } @@ -358,9 +358,9 @@ CompilerIntegerParam * ServerIntangibleObjectTemplate::_Ingredient::getCompilerI { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_ingredientType; } @@ -368,7 +368,7 @@ CompilerIntegerParam * ServerIntangibleObjectTemplate::_Ingredient::getCompilerI } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerIntangibleObjectTemplate::_Ingredient::getCompilerIntegerParam FloatParam * ServerIntangibleObjectTemplate::_Ingredient::getFloatParam(const char *name, bool deepCheck, int index) @@ -379,9 +379,9 @@ FloatParam * ServerIntangibleObjectTemplate::_Ingredient::getFloatParam(const ch { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_complexity; } @@ -389,7 +389,7 @@ FloatParam * ServerIntangibleObjectTemplate::_Ingredient::getFloatParam(const ch } else return TpfTemplate::getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerIntangibleObjectTemplate::_Ingredient::getFloatParam BoolParam * ServerIntangibleObjectTemplate::_Ingredient::getBoolParam(const char *name, bool deepCheck, int index) @@ -405,9 +405,9 @@ StringParam * ServerIntangibleObjectTemplate::_Ingredient::getStringParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_skillCommand; } @@ -415,7 +415,7 @@ StringParam * ServerIntangibleObjectTemplate::_Ingredient::getStringParam(const } else return TpfTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerIntangibleObjectTemplate::_Ingredient::getStringParam StringIdParam * ServerIntangibleObjectTemplate::_Ingredient::getStringIdParam(const char *name, bool deepCheck, int index) @@ -449,7 +449,7 @@ StructParamOT * ServerIntangibleObjectTemplate::_Ingredient::getStructParamOT(co } else return TpfTemplate::getStructParamOT(name, deepCheck, index); - return NULL; + return nullptr; } //ServerIntangibleObjectTemplate::_Ingredient::getStructParamOT TriggerVolumeParam * ServerIntangibleObjectTemplate::_Ingredient::getTriggerVolumeParam(const char *name, bool deepCheck, int index) @@ -533,7 +533,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_ingredients.begin(); iter != m_ingredients.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_ingredients.clear(); m_ingredientsAppend = file.read_bool8(); @@ -669,9 +669,9 @@ CompilerIntegerParam * ServerIntangibleObjectTemplate::_SchematicAttribute::getC { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_value; } @@ -679,7 +679,7 @@ CompilerIntegerParam * ServerIntangibleObjectTemplate::_SchematicAttribute::getC } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerIntangibleObjectTemplate::_SchematicAttribute::getCompilerIntegerParam FloatParam * ServerIntangibleObjectTemplate::_SchematicAttribute::getFloatParam(const char *name, bool deepCheck, int index) @@ -705,9 +705,9 @@ StringIdParam * ServerIntangibleObjectTemplate::_SchematicAttribute::getStringId { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_name; } @@ -715,7 +715,7 @@ StringIdParam * ServerIntangibleObjectTemplate::_SchematicAttribute::getStringId } else return TpfTemplate::getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerIntangibleObjectTemplate::_SchematicAttribute::getStringIdParam VectorParam * ServerIntangibleObjectTemplate::_SchematicAttribute::getVectorParam(const char *name, bool deepCheck, int index) @@ -889,9 +889,9 @@ CompilerIntegerParam * ServerIntangibleObjectTemplate::_SimpleIngredient::getCom { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_count; } @@ -899,7 +899,7 @@ CompilerIntegerParam * ServerIntangibleObjectTemplate::_SimpleIngredient::getCom } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerIntangibleObjectTemplate::_SimpleIngredient::getCompilerIntegerParam FloatParam * ServerIntangibleObjectTemplate::_SimpleIngredient::getFloatParam(const char *name, bool deepCheck, int index) @@ -920,9 +920,9 @@ StringParam * ServerIntangibleObjectTemplate::_SimpleIngredient::getStringParam( { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_ingredient; } @@ -930,7 +930,7 @@ StringParam * ServerIntangibleObjectTemplate::_SimpleIngredient::getStringParam( } else return TpfTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerIntangibleObjectTemplate::_SimpleIngredient::getStringParam StringIdParam * ServerIntangibleObjectTemplate::_SimpleIngredient::getStringIdParam(const char *name, bool deepCheck, int index) @@ -941,9 +941,9 @@ StringIdParam * ServerIntangibleObjectTemplate::_SimpleIngredient::getStringIdPa { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_name; } @@ -951,7 +951,7 @@ StringIdParam * ServerIntangibleObjectTemplate::_SimpleIngredient::getStringIdPa } else return TpfTemplate::getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerIntangibleObjectTemplate::_SimpleIngredient::getStringIdParam VectorParam * ServerIntangibleObjectTemplate::_SimpleIngredient::getVectorParam(const char *name, bool deepCheck, int index) diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerJediManagerObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerJediManagerObjectTemplate.cpp index 34919f61..acecbef1 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerJediManagerObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerJediManagerObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerJediManagerObjectTemplate::getTemplateVersion(void) const */ Tag ServerJediManagerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerJediManagerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerJediManagerObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerManufactureInstallationObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerManufactureInstallationObjectTemplate.cpp index 82335f44..1747392d 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerManufactureInstallationObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerManufactureInstallationObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerManufactureInstallationObjectTemplate::getTemplateVersion(void) const */ Tag ServerManufactureInstallationObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerManufactureInstallationObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerManufactureInstallationObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerManufactureSchematicObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerManufactureSchematicObjectTemplate.cpp index 54bbda83..73735880 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerManufactureSchematicObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerManufactureSchematicObjectTemplate.cpp @@ -47,7 +47,7 @@ ServerManufactureSchematicObjectTemplate::~ServerManufactureSchematicObjectTempl for (iter = m_ingredients.begin(); iter != m_ingredients.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_ingredients.clear(); } @@ -56,7 +56,7 @@ ServerManufactureSchematicObjectTemplate::~ServerManufactureSchematicObjectTempl for (iter = m_attributes.begin(); iter != m_attributes.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_attributes.clear(); } @@ -108,10 +108,10 @@ Tag ServerManufactureSchematicObjectTemplate::getTemplateVersion(void) const */ Tag ServerManufactureSchematicObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerManufactureSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerManufactureSchematicObjectTemplate::getHighestTemplateVersion @@ -125,9 +125,9 @@ CompilerIntegerParam * ServerManufactureSchematicObjectTemplate::getCompilerInte { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_itemCount; } @@ -135,7 +135,7 @@ CompilerIntegerParam * ServerManufactureSchematicObjectTemplate::getCompilerInte } else return ServerIntangibleObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerManufactureSchematicObjectTemplate::getCompilerIntegerParam FloatParam * ServerManufactureSchematicObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -156,9 +156,9 @@ StringParam * ServerManufactureSchematicObjectTemplate::getStringParam(const cha { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_draftSchematic; } @@ -170,9 +170,9 @@ StringParam * ServerManufactureSchematicObjectTemplate::getStringParam(const cha { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_creator; } @@ -180,7 +180,7 @@ StringParam * ServerManufactureSchematicObjectTemplate::getStringParam(const cha } else return ServerIntangibleObjectTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerManufactureSchematicObjectTemplate::getStringParam StringIdParam * ServerManufactureSchematicObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -226,7 +226,7 @@ StructParamOT * ServerManufactureSchematicObjectTemplate::getStructParamOT(const } else return ServerIntangibleObjectTemplate::getStructParamOT(name, deepCheck, index); - return NULL; + return nullptr; } //ServerManufactureSchematicObjectTemplate::getStructParamOT TriggerVolumeParam * ServerManufactureSchematicObjectTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index) @@ -324,12 +324,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -361,7 +361,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_ingredients.begin(); iter != m_ingredients.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_ingredients.clear(); m_ingredientsAppend = file.read_bool8(); @@ -382,7 +382,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_attributes.begin(); iter != m_attributes.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_attributes.clear(); m_attributesAppend = file.read_bool8(); @@ -563,9 +563,9 @@ StringIdParam * ServerManufactureSchematicObjectTemplate::_IngredientSlot::getSt { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_name; } @@ -573,7 +573,7 @@ StringIdParam * ServerManufactureSchematicObjectTemplate::_IngredientSlot::getSt } else return TpfTemplate::getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerManufactureSchematicObjectTemplate::_IngredientSlot::getStringIdParam VectorParam * ServerManufactureSchematicObjectTemplate::_IngredientSlot::getVectorParam(const char *name, bool deepCheck, int index) @@ -594,9 +594,9 @@ StructParamOT * ServerManufactureSchematicObjectTemplate::_IngredientSlot::getSt { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStructParamOT(name, deepCheck, index); - return NULL; + return nullptr; } return &m_ingredient; } @@ -604,7 +604,7 @@ StructParamOT * ServerManufactureSchematicObjectTemplate::_IngredientSlot::getSt } else return TpfTemplate::getStructParamOT(name, deepCheck, index); - return NULL; + return nullptr; } //ServerManufactureSchematicObjectTemplate::_IngredientSlot::getStructParamOT TriggerVolumeParam * ServerManufactureSchematicObjectTemplate::_IngredientSlot::getTriggerVolumeParam(const char *name, bool deepCheck, int index) diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerMissionObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerMissionObjectTemplate.cpp index 39ab71f1..240882ac 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerMissionObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerMissionObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerMissionObjectTemplate::getTemplateVersion(void) const */ Tag ServerMissionObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerMissionObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerMissionObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerObjectTemplate.cpp index 0307ce8c..5df8660b 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerObjectTemplate.cpp @@ -55,7 +55,7 @@ ServerObjectTemplate::~ServerObjectTemplate() for (iter = m_scripts.begin(); iter != m_scripts.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_scripts.clear(); } @@ -64,7 +64,7 @@ ServerObjectTemplate::~ServerObjectTemplate() for (iter = m_visibleFlags.begin(); iter != m_visibleFlags.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_visibleFlags.clear(); } @@ -73,7 +73,7 @@ ServerObjectTemplate::~ServerObjectTemplate() for (iter = m_deleteFlags.begin(); iter != m_deleteFlags.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_deleteFlags.clear(); } @@ -82,7 +82,7 @@ ServerObjectTemplate::~ServerObjectTemplate() for (iter = m_moveFlags.begin(); iter != m_moveFlags.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_moveFlags.clear(); } @@ -91,7 +91,7 @@ ServerObjectTemplate::~ServerObjectTemplate() for (iter = m_contents.begin(); iter != m_contents.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_contents.clear(); } @@ -100,7 +100,7 @@ ServerObjectTemplate::~ServerObjectTemplate() for (iter = m_xpPoints.begin(); iter != m_xpPoints.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_xpPoints.clear(); } @@ -152,10 +152,10 @@ Tag ServerObjectTemplate::getTemplateVersion(void) const */ Tag ServerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerObjectTemplate::getHighestTemplateVersion @@ -169,9 +169,9 @@ CompilerIntegerParam * ServerObjectTemplate::getCompilerIntegerParam(const char { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_volume; } @@ -219,9 +219,9 @@ CompilerIntegerParam * ServerObjectTemplate::getCompilerIntegerParam(const char { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_tintIndex; } @@ -229,7 +229,7 @@ CompilerIntegerParam * ServerObjectTemplate::getCompilerIntegerParam(const char } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerObjectTemplate::getCompilerIntegerParam FloatParam * ServerObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -240,9 +240,9 @@ FloatParam * ServerObjectTemplate::getFloatParam(const char *name, bool deepChec { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_complexity; } @@ -254,9 +254,9 @@ FloatParam * ServerObjectTemplate::getFloatParam(const char *name, bool deepChec { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_updateRanges[index]; } @@ -264,7 +264,7 @@ FloatParam * ServerObjectTemplate::getFloatParam(const char *name, bool deepChec } else return TpfTemplate::getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerObjectTemplate::getFloatParam BoolParam * ServerObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) @@ -275,9 +275,9 @@ BoolParam * ServerObjectTemplate::getBoolParam(const char *name, bool deepCheck, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_invulnerable; } @@ -289,9 +289,9 @@ BoolParam * ServerObjectTemplate::getBoolParam(const char *name, bool deepCheck, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_persistByDefault; } @@ -303,9 +303,9 @@ BoolParam * ServerObjectTemplate::getBoolParam(const char *name, bool deepCheck, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_persistContents; } @@ -313,7 +313,7 @@ BoolParam * ServerObjectTemplate::getBoolParam(const char *name, bool deepCheck, } else return TpfTemplate::getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerObjectTemplate::getBoolParam StringParam * ServerObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) @@ -324,9 +324,9 @@ StringParam * ServerObjectTemplate::getStringParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_sharedTemplate; } @@ -346,7 +346,7 @@ StringParam * ServerObjectTemplate::getStringParam(const char *name, bool deepCh } else return TpfTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerObjectTemplate::getStringParam StringIdParam * ServerObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -367,9 +367,9 @@ DynamicVariableParam * ServerObjectTemplate::getDynamicVariableParam(const char { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getDynamicVariableParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_objvars; } @@ -377,7 +377,7 @@ DynamicVariableParam * ServerObjectTemplate::getDynamicVariableParam(const char } else return TpfTemplate::getDynamicVariableParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerObjectTemplate::getDynamicVariableParam StructParamOT * ServerObjectTemplate::getStructParamOT(const char *name, bool deepCheck, int index) @@ -408,7 +408,7 @@ StructParamOT * ServerObjectTemplate::getStructParamOT(const char *name, bool de } else return TpfTemplate::getStructParamOT(name, deepCheck, index); - return NULL; + return nullptr; } //ServerObjectTemplate::getStructParamOT TriggerVolumeParam * ServerObjectTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index) @@ -562,12 +562,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -597,7 +597,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_scripts.begin(); iter != m_scripts.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_scripts.clear(); m_scriptsAppend = file.read_bool8(); @@ -620,7 +620,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_visibleFlags.begin(); iter != m_visibleFlags.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_visibleFlags.clear(); m_visibleFlagsAppend = file.read_bool8(); @@ -639,7 +639,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_deleteFlags.begin(); iter != m_deleteFlags.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_deleteFlags.clear(); m_deleteFlagsAppend = file.read_bool8(); @@ -658,7 +658,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_moveFlags.begin(); iter != m_moveFlags.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_moveFlags.clear(); m_moveFlagsAppend = file.read_bool8(); @@ -697,7 +697,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_contents.begin(); iter != m_contents.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_contents.clear(); m_contentsAppend = file.read_bool8(); @@ -716,7 +716,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_xpPoints.begin(); iter != m_xpPoints.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_xpPoints.clear(); m_xpPointsAppend = file.read_bool8(); @@ -980,9 +980,9 @@ CompilerIntegerParam * ServerObjectTemplate::_AttribMod::getCompilerIntegerParam { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_target; } @@ -994,9 +994,9 @@ CompilerIntegerParam * ServerObjectTemplate::_AttribMod::getCompilerIntegerParam { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_value; } @@ -1004,7 +1004,7 @@ CompilerIntegerParam * ServerObjectTemplate::_AttribMod::getCompilerIntegerParam } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerObjectTemplate::_AttribMod::getCompilerIntegerParam FloatParam * ServerObjectTemplate::_AttribMod::getFloatParam(const char *name, bool deepCheck, int index) @@ -1015,9 +1015,9 @@ FloatParam * ServerObjectTemplate::_AttribMod::getFloatParam(const char *name, b { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_time; } @@ -1029,9 +1029,9 @@ FloatParam * ServerObjectTemplate::_AttribMod::getFloatParam(const char *name, b { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_timeAtValue; } @@ -1043,9 +1043,9 @@ FloatParam * ServerObjectTemplate::_AttribMod::getFloatParam(const char *name, b { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_decay; } @@ -1053,7 +1053,7 @@ FloatParam * ServerObjectTemplate::_AttribMod::getFloatParam(const char *name, b } else return TpfTemplate::getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerObjectTemplate::_AttribMod::getFloatParam BoolParam * ServerObjectTemplate::_AttribMod::getBoolParam(const char *name, bool deepCheck, int index) @@ -1276,9 +1276,9 @@ BoolParam * ServerObjectTemplate::_Contents::getBoolParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_equipObject; } @@ -1286,7 +1286,7 @@ BoolParam * ServerObjectTemplate::_Contents::getBoolParam(const char *name, bool } else return TpfTemplate::getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerObjectTemplate::_Contents::getBoolParam StringParam * ServerObjectTemplate::_Contents::getStringParam(const char *name, bool deepCheck, int index) @@ -1297,9 +1297,9 @@ StringParam * ServerObjectTemplate::_Contents::getStringParam(const char *name, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_slotName; } @@ -1311,9 +1311,9 @@ StringParam * ServerObjectTemplate::_Contents::getStringParam(const char *name, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_content; } @@ -1321,7 +1321,7 @@ StringParam * ServerObjectTemplate::_Contents::getStringParam(const char *name, } else return TpfTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerObjectTemplate::_Contents::getStringParam StringIdParam * ServerObjectTemplate::_Contents::getStringIdParam(const char *name, bool deepCheck, int index) @@ -1508,9 +1508,9 @@ CompilerIntegerParam * ServerObjectTemplate::_MentalStateMod::getCompilerInteger { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_target; } @@ -1518,7 +1518,7 @@ CompilerIntegerParam * ServerObjectTemplate::_MentalStateMod::getCompilerInteger } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerObjectTemplate::_MentalStateMod::getCompilerIntegerParam FloatParam * ServerObjectTemplate::_MentalStateMod::getFloatParam(const char *name, bool deepCheck, int index) @@ -1529,9 +1529,9 @@ FloatParam * ServerObjectTemplate::_MentalStateMod::getFloatParam(const char *na { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_value; } @@ -1543,9 +1543,9 @@ FloatParam * ServerObjectTemplate::_MentalStateMod::getFloatParam(const char *na { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_time; } @@ -1557,9 +1557,9 @@ FloatParam * ServerObjectTemplate::_MentalStateMod::getFloatParam(const char *na { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_timeAtValue; } @@ -1571,9 +1571,9 @@ FloatParam * ServerObjectTemplate::_MentalStateMod::getFloatParam(const char *na { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_decay; } @@ -1581,7 +1581,7 @@ FloatParam * ServerObjectTemplate::_MentalStateMod::getFloatParam(const char *na } else return TpfTemplate::getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerObjectTemplate::_MentalStateMod::getFloatParam BoolParam * ServerObjectTemplate::_MentalStateMod::getBoolParam(const char *name, bool deepCheck, int index) @@ -1794,9 +1794,9 @@ CompilerIntegerParam * ServerObjectTemplate::_Xp::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_type; } @@ -1808,9 +1808,9 @@ CompilerIntegerParam * ServerObjectTemplate::_Xp::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_level; } @@ -1822,9 +1822,9 @@ CompilerIntegerParam * ServerObjectTemplate::_Xp::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_value; } @@ -1832,7 +1832,7 @@ CompilerIntegerParam * ServerObjectTemplate::_Xp::getCompilerIntegerParam(const } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerObjectTemplate::_Xp::getCompilerIntegerParam FloatParam * ServerObjectTemplate::_Xp::getFloatParam(const char *name, bool deepCheck, int index) diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerPlanetObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerPlanetObjectTemplate.cpp index 91f52345..fc998c4a 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerPlanetObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerPlanetObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerPlanetObjectTemplate::getTemplateVersion(void) const */ Tag ServerPlanetObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerPlanetObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerPlanetObjectTemplate::getHighestTemplateVersion @@ -118,9 +118,9 @@ StringParam * ServerPlanetObjectTemplate::getStringParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_planetName; } @@ -128,7 +128,7 @@ StringParam * ServerPlanetObjectTemplate::getStringParam(const char *name, bool } else return ServerUniverseObjectTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerPlanetObjectTemplate::getStringParam StringIdParam * ServerPlanetObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -211,12 +211,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerPlayerObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerPlayerObjectTemplate.cpp index 2824f83a..bd678142 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerPlayerObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerPlayerObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerPlayerObjectTemplate::getTemplateVersion(void) const */ Tag ServerPlayerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerPlayerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerPlayerObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerPlayerQuestObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerPlayerQuestObjectTemplate.cpp index 0c05dd79..36c23628 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerPlayerQuestObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerPlayerQuestObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerPlayerQuestObjectTemplate::getTemplateVersion(void) const */ Tag ServerPlayerQuestObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerPlayerQuestObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerPlayerQuestObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerResourceClassObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerResourceClassObjectTemplate.cpp index 2df53960..0a5c1bac 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerResourceClassObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerResourceClassObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerResourceClassObjectTemplate::getTemplateVersion(void) const */ Tag ServerResourceClassObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerResourceClassObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerResourceClassObjectTemplate::getHighestTemplateVersion @@ -103,9 +103,9 @@ CompilerIntegerParam * ServerResourceClassObjectTemplate::getCompilerIntegerPara { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_numTypes; } @@ -117,9 +117,9 @@ CompilerIntegerParam * ServerResourceClassObjectTemplate::getCompilerIntegerPara { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_minTypes; } @@ -131,9 +131,9 @@ CompilerIntegerParam * ServerResourceClassObjectTemplate::getCompilerIntegerPara { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_maxTypes; } @@ -141,7 +141,7 @@ CompilerIntegerParam * ServerResourceClassObjectTemplate::getCompilerIntegerPara } else return ServerUniverseObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerResourceClassObjectTemplate::getCompilerIntegerParam FloatParam * ServerResourceClassObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -162,9 +162,9 @@ StringParam * ServerResourceClassObjectTemplate::getStringParam(const char *name { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_resourceClassName; } @@ -176,9 +176,9 @@ StringParam * ServerResourceClassObjectTemplate::getStringParam(const char *name { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_parentClass; } @@ -186,7 +186,7 @@ StringParam * ServerResourceClassObjectTemplate::getStringParam(const char *name } else return ServerUniverseObjectTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerResourceClassObjectTemplate::getStringParam StringIdParam * ServerResourceClassObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -269,12 +269,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerResourceContainerObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerResourceContainerObjectTemplate.cpp index c5e367cc..c4008c2f 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerResourceContainerObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerResourceContainerObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerResourceContainerObjectTemplate::getTemplateVersion(void) const */ Tag ServerResourceContainerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerResourceContainerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerResourceContainerObjectTemplate::getHighestTemplateVersion @@ -103,9 +103,9 @@ CompilerIntegerParam * ServerResourceContainerObjectTemplate::getCompilerInteger { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_maxResources; } @@ -113,7 +113,7 @@ CompilerIntegerParam * ServerResourceContainerObjectTemplate::getCompilerInteger } else return ServerTangibleObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerResourceContainerObjectTemplate::getCompilerIntegerParam FloatParam * ServerResourceContainerObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -211,12 +211,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerResourcePoolObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerResourcePoolObjectTemplate.cpp index 6aa324d6..15ad8ebc 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerResourcePoolObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerResourcePoolObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerResourcePoolObjectTemplate::getTemplateVersion(void) const */ Tag ServerResourcePoolObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerResourcePoolObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerResourcePoolObjectTemplate::getHighestTemplateVersion @@ -103,9 +103,9 @@ CompilerIntegerParam * ServerResourcePoolObjectTemplate::getCompilerIntegerParam { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_mapSeed; } @@ -117,9 +117,9 @@ CompilerIntegerParam * ServerResourcePoolObjectTemplate::getCompilerIntegerParam { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_amountRemaining; } @@ -127,7 +127,7 @@ CompilerIntegerParam * ServerResourcePoolObjectTemplate::getCompilerIntegerParam } else return ServerUniverseObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerResourcePoolObjectTemplate::getCompilerIntegerParam FloatParam * ServerResourcePoolObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -225,12 +225,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerResourceTypeObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerResourceTypeObjectTemplate.cpp index dd44c902..7ed9954d 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerResourceTypeObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerResourceTypeObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerResourceTypeObjectTemplate::getTemplateVersion(void) const */ Tag ServerResourceTypeObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerResourceTypeObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerResourceTypeObjectTemplate::getHighestTemplateVersion @@ -118,9 +118,9 @@ StringParam * ServerResourceTypeObjectTemplate::getStringParam(const char *name, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_resourceName; } @@ -128,7 +128,7 @@ StringParam * ServerResourceTypeObjectTemplate::getStringParam(const char *name, } else return ServerUniverseObjectTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerResourceTypeObjectTemplate::getStringParam StringIdParam * ServerResourceTypeObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -211,12 +211,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerShipObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerShipObjectTemplate.cpp index 247bda11..c1bb613c 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerShipObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerShipObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerShipObjectTemplate::getTemplateVersion(void) const */ Tag ServerShipObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerShipObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerShipObjectTemplate::getHighestTemplateVersion @@ -118,9 +118,9 @@ StringParam * ServerShipObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_shipType; } @@ -128,7 +128,7 @@ StringParam * ServerShipObjectTemplate::getStringParam(const char *name, bool de } else return ServerTangibleObjectTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerShipObjectTemplate::getStringParam StringIdParam * ServerShipObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -211,12 +211,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerStaticObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerStaticObjectTemplate.cpp index fb078b58..48fe0b50 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerStaticObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerStaticObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerStaticObjectTemplate::getTemplateVersion(void) const */ Tag ServerStaticObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerStaticObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerStaticObjectTemplate::getHighestTemplateVersion @@ -113,9 +113,9 @@ BoolParam * ServerStaticObjectTemplate::getBoolParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_clientOnlyBuildout; } @@ -123,7 +123,7 @@ BoolParam * ServerStaticObjectTemplate::getBoolParam(const char *name, bool deep } else return ServerObjectTemplate::getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerStaticObjectTemplate::getBoolParam StringParam * ServerStaticObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) @@ -211,12 +211,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerTangibleObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerTangibleObjectTemplate.cpp index 5604b102..52fd36b3 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerTangibleObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerTangibleObjectTemplate.cpp @@ -45,7 +45,7 @@ ServerTangibleObjectTemplate::~ServerTangibleObjectTemplate() for (iter = m_triggerVolumes.begin(); iter != m_triggerVolumes.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_triggerVolumes.clear(); } @@ -97,10 +97,10 @@ Tag ServerTangibleObjectTemplate::getTemplateVersion(void) const */ Tag ServerTangibleObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerTangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerTangibleObjectTemplate::getHighestTemplateVersion @@ -114,9 +114,9 @@ CompilerIntegerParam * ServerTangibleObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_combatSkeleton; } @@ -128,9 +128,9 @@ CompilerIntegerParam * ServerTangibleObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_maxHitPoints; } @@ -142,9 +142,9 @@ CompilerIntegerParam * ServerTangibleObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_interestRadius; } @@ -156,9 +156,9 @@ CompilerIntegerParam * ServerTangibleObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_count; } @@ -170,9 +170,9 @@ CompilerIntegerParam * ServerTangibleObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_condition; } @@ -180,7 +180,7 @@ CompilerIntegerParam * ServerTangibleObjectTemplate::getCompilerIntegerParam(con } else return ServerObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerTangibleObjectTemplate::getCompilerIntegerParam FloatParam * ServerTangibleObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -196,9 +196,9 @@ BoolParam * ServerTangibleObjectTemplate::getBoolParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_wantSawAttackTriggers; } @@ -206,7 +206,7 @@ BoolParam * ServerTangibleObjectTemplate::getBoolParam(const char *name, bool de } else return ServerObjectTemplate::getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerTangibleObjectTemplate::getBoolParam StringParam * ServerTangibleObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) @@ -217,9 +217,9 @@ StringParam * ServerTangibleObjectTemplate::getStringParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_armor; } @@ -227,7 +227,7 @@ StringParam * ServerTangibleObjectTemplate::getStringParam(const char *name, boo } else return ServerObjectTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerTangibleObjectTemplate::getStringParam StringIdParam * ServerTangibleObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -266,7 +266,7 @@ TriggerVolumeParam * ServerTangibleObjectTemplate::getTriggerVolumeParam(const c } else return ServerObjectTemplate::getTriggerVolumeParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerTangibleObjectTemplate::getTriggerVolumeParam void ServerTangibleObjectTemplate::initStructParamOT(StructParamOT ¶m, const char *name) @@ -341,12 +341,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -374,7 +374,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_triggerVolumes.begin(); iter != m_triggerVolumes.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_triggerVolumes.clear(); m_triggerVolumesAppend = file.read_bool8(); diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerTokenObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerTokenObjectTemplate.cpp index b63a3f63..a3cac916 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerTokenObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerTokenObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerTokenObjectTemplate::getTemplateVersion(void) const */ Tag ServerTokenObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerTokenObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerTokenObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerUberObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerUberObjectTemplate.cpp index 20c3f1f8..6aba5832 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerUberObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerUberObjectTemplate.cpp @@ -87,7 +87,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_intListSimple.begin(); iter != m_intListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -95,7 +95,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_intListWeightedList.begin(); iter != m_intListWeightedList.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -103,7 +103,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_intListRandomRange.begin(); iter != m_intListRandomRange.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -111,7 +111,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_intListDiceRoll.begin(); iter != m_intListDiceRoll.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -119,7 +119,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_floatListSimple.begin(); iter != m_floatListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -127,7 +127,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_floatListWeightedList.begin(); iter != m_floatListWeightedList.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -135,7 +135,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_floatListRandomRange.begin(); iter != m_floatListRandomRange.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -143,7 +143,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_enumListIndexed.begin(); iter != m_enumListIndexed.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -151,7 +151,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_enumListWeightedList.begin(); iter != m_enumListWeightedList.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -159,7 +159,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_stringIdListSimple.begin(); iter != m_stringIdListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -167,7 +167,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_stringIdListWeightedList.begin(); iter != m_stringIdListWeightedList.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -175,7 +175,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_stringListSimple.begin(); iter != m_stringListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -183,7 +183,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_stringListWeightedList.begin(); iter != m_stringListWeightedList.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -191,7 +191,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_triggerVolumeList.begin(); iter != m_triggerVolumeList.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -199,7 +199,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_triggerVolumesListWeightedList.begin(); iter != m_triggerVolumesListWeightedList.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -207,7 +207,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_boolListDerived.begin(); iter != m_boolListDerived.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -215,7 +215,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_boolListSimple.begin(); iter != m_boolListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -223,7 +223,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_boolListWeightedList.begin(); iter != m_boolListWeightedList.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -231,7 +231,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_vectorListSimple.begin(); iter != m_vectorListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -239,7 +239,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_filenameListSimple.begin(); iter != m_filenameListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -247,7 +247,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_templateListSimple.begin(); iter != m_templateListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } { @@ -255,7 +255,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() for (iter = m_structListSimple.begin(); iter != m_structListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } //@END TFD CLEANUP @@ -306,10 +306,10 @@ Tag ServerUberObjectTemplate::getTemplateVersion(void) const */ Tag ServerUberObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerUberObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerUberObjectTemplate::getHighestTemplateVersion @@ -323,9 +323,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intAtDerived; } @@ -337,9 +337,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intSimple; } @@ -351,9 +351,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intSimpleDeltaPositive; } @@ -365,9 +365,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intSimpleDeltaNegative; } @@ -379,9 +379,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intSimpleDeltaPositivePercent; } @@ -393,9 +393,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intSimpleDeltaNegativePercent; } @@ -407,9 +407,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intWeightedList; } @@ -421,9 +421,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intWeightedListDeltaPositive; } @@ -435,9 +435,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intWeightedListDeltaNegative; } @@ -449,9 +449,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intWeightedListDeltaPositivePercent; } @@ -463,9 +463,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intWeightedListDeltaNegativePercent; } @@ -477,9 +477,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intRandomRange1; } @@ -491,9 +491,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intRandomRange2; } @@ -505,9 +505,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intRandomRange3; } @@ -519,9 +519,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intRandomRange4; } @@ -533,9 +533,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intDiceRoll1; } @@ -547,9 +547,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_intDiceRoll2; } @@ -609,9 +609,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_enumIndexedByEnumSingle[index]; } @@ -623,9 +623,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_enumIndexedByEnumWeightedList[index]; } @@ -661,9 +661,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_integerArray[index]; } @@ -671,7 +671,7 @@ CompilerIntegerParam * ServerUberObjectTemplate::getCompilerIntegerParam(const c } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerUberObjectTemplate::getCompilerIntegerParam FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -682,9 +682,9 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_floatAtDerived; } @@ -696,9 +696,9 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_floatSimple; } @@ -710,9 +710,9 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_floatSimpleDeltaPositive; } @@ -724,9 +724,9 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_floatSimpleDeltaNegative; } @@ -738,9 +738,9 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_floatSimpleDeltaPositivePercent; } @@ -752,9 +752,9 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_floatSimpleDeltaNegativePercent; } @@ -766,9 +766,9 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_floatWeightedList; } @@ -780,9 +780,9 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_floatRandomRange1; } @@ -794,9 +794,9 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_floatRandomRange2; } @@ -808,9 +808,9 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_floatRandomRange3; } @@ -822,9 +822,9 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_floatRandomRange4; } @@ -872,9 +872,9 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_floatArray[index]; } @@ -882,7 +882,7 @@ FloatParam * ServerUberObjectTemplate::getFloatParam(const char *name, bool deep } else return TpfTemplate::getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerUberObjectTemplate::getFloatParam BoolParam * ServerUberObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) @@ -893,9 +893,9 @@ BoolParam * ServerUberObjectTemplate::getBoolParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_boolDerived; } @@ -907,9 +907,9 @@ BoolParam * ServerUberObjectTemplate::getBoolParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_boolSimple; } @@ -921,9 +921,9 @@ BoolParam * ServerUberObjectTemplate::getBoolParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_boolWeightedList; } @@ -971,9 +971,9 @@ BoolParam * ServerUberObjectTemplate::getBoolParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_boolArray[index]; } @@ -981,7 +981,7 @@ BoolParam * ServerUberObjectTemplate::getBoolParam(const char *name, bool deepCh } else return TpfTemplate::getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerUberObjectTemplate::getBoolParam StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) @@ -992,9 +992,9 @@ StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_stringDerived; } @@ -1006,9 +1006,9 @@ StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_stringSimple; } @@ -1020,9 +1020,9 @@ StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_stringWeightedList; } @@ -1058,9 +1058,9 @@ StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_filenameAtDerived; } @@ -1072,9 +1072,9 @@ StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_filenameSimple; } @@ -1086,9 +1086,9 @@ StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_filenameWeightedList; } @@ -1112,9 +1112,9 @@ StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_templateDerived; } @@ -1126,9 +1126,9 @@ StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_templateSimple; } @@ -1140,9 +1140,9 @@ StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_templateWeightedList; } @@ -1166,9 +1166,9 @@ StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_stringArray[index]; } @@ -1180,9 +1180,9 @@ StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_fileNameArray[index]; } @@ -1190,7 +1190,7 @@ StringParam * ServerUberObjectTemplate::getStringParam(const char *name, bool de } else return TpfTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerUberObjectTemplate::getStringParam StringIdParam * ServerUberObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -1201,9 +1201,9 @@ StringIdParam * ServerUberObjectTemplate::getStringIdParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_stringIdDerived; } @@ -1215,9 +1215,9 @@ StringIdParam * ServerUberObjectTemplate::getStringIdParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_stringIdSimple; } @@ -1229,9 +1229,9 @@ StringIdParam * ServerUberObjectTemplate::getStringIdParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_stringIdWeightedList; } @@ -1267,9 +1267,9 @@ StringIdParam * ServerUberObjectTemplate::getStringIdParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_stringIdArray[index]; } @@ -1277,7 +1277,7 @@ StringIdParam * ServerUberObjectTemplate::getStringIdParam(const char *name, boo } else return TpfTemplate::getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerUberObjectTemplate::getStringIdParam VectorParam * ServerUberObjectTemplate::getVectorParam(const char *name, bool deepCheck, int index) @@ -1288,9 +1288,9 @@ VectorParam * ServerUberObjectTemplate::getVectorParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getVectorParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_vectorAtDerived; } @@ -1302,9 +1302,9 @@ VectorParam * ServerUberObjectTemplate::getVectorParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getVectorParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_vectorSimple; } @@ -1328,9 +1328,9 @@ VectorParam * ServerUberObjectTemplate::getVectorParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getVectorParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_vectorArray[index]; } @@ -1338,7 +1338,7 @@ VectorParam * ServerUberObjectTemplate::getVectorParam(const char *name, bool de } else return TpfTemplate::getVectorParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerUberObjectTemplate::getVectorParam DynamicVariableParam * ServerUberObjectTemplate::getDynamicVariableParam(const char *name, bool deepCheck, int index) @@ -1349,9 +1349,9 @@ DynamicVariableParam * ServerUberObjectTemplate::getDynamicVariableParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getDynamicVariableParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_objvarDerived; } @@ -1363,9 +1363,9 @@ DynamicVariableParam * ServerUberObjectTemplate::getDynamicVariableParam(const c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getDynamicVariableParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_objvarSimple; } @@ -1373,7 +1373,7 @@ DynamicVariableParam * ServerUberObjectTemplate::getDynamicVariableParam(const c } else return TpfTemplate::getDynamicVariableParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerUberObjectTemplate::getDynamicVariableParam StructParamOT * ServerUberObjectTemplate::getStructParamOT(const char *name, bool deepCheck, int index) @@ -1384,9 +1384,9 @@ StructParamOT * ServerUberObjectTemplate::getStructParamOT(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStructParamOT(name, deepCheck, index); - return NULL; + return nullptr; } return &m_structAtDerived; } @@ -1398,9 +1398,9 @@ StructParamOT * ServerUberObjectTemplate::getStructParamOT(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStructParamOT(name, deepCheck, index); - return NULL; + return nullptr; } return &m_structSimple; } @@ -1424,9 +1424,9 @@ StructParamOT * ServerUberObjectTemplate::getStructParamOT(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStructParamOT(name, deepCheck, index); - return NULL; + return nullptr; } return &m_structArrayEnum[index]; } @@ -1438,9 +1438,9 @@ StructParamOT * ServerUberObjectTemplate::getStructParamOT(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStructParamOT(name, deepCheck, index); - return NULL; + return nullptr; } return &m_structArrayInteger[index]; } @@ -1448,7 +1448,7 @@ StructParamOT * ServerUberObjectTemplate::getStructParamOT(const char *name, boo } else return TpfTemplate::getStructParamOT(name, deepCheck, index); - return NULL; + return nullptr; } //ServerUberObjectTemplate::getStructParamOT TriggerVolumeParam * ServerUberObjectTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index) @@ -1459,9 +1459,9 @@ TriggerVolumeParam * ServerUberObjectTemplate::getTriggerVolumeParam(const char { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getTriggerVolumeParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_triggerVolumeDerived; } @@ -1473,9 +1473,9 @@ TriggerVolumeParam * ServerUberObjectTemplate::getTriggerVolumeParam(const char { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getTriggerVolumeParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_triggerVolumeSimple; } @@ -1487,9 +1487,9 @@ TriggerVolumeParam * ServerUberObjectTemplate::getTriggerVolumeParam(const char { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getTriggerVolumeParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_triggerVolumeWeightedList; } @@ -1525,9 +1525,9 @@ TriggerVolumeParam * ServerUberObjectTemplate::getTriggerVolumeParam(const char { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getTriggerVolumeParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_triggerArray[index]; } @@ -1535,7 +1535,7 @@ TriggerVolumeParam * ServerUberObjectTemplate::getTriggerVolumeParam(const char } else return TpfTemplate::getTriggerVolumeParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerUberObjectTemplate::getTriggerVolumeParam void ServerUberObjectTemplate::initStructParamOT(StructParamOT ¶m, const char *name) @@ -1942,12 +1942,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -2009,7 +2009,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_intListSimple.begin(); iter != m_intListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_intListSimpleAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2027,7 +2027,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_intListWeightedList.begin(); iter != m_intListWeightedList.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_intListWeightedListAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2045,7 +2045,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_intListRandomRange.begin(); iter != m_intListRandomRange.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_intListRandomRangeAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2063,7 +2063,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_intListDiceRoll.begin(); iter != m_intListDiceRoll.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_intListDiceRollAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2103,7 +2103,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_floatListSimple.begin(); iter != m_floatListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_floatListSimpleAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2121,7 +2121,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_floatListWeightedList.begin(); iter != m_floatListWeightedList.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_floatListWeightedListAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2139,7 +2139,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_floatListRandomRange.begin(); iter != m_floatListRandomRange.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_floatListRandomRangeAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2185,7 +2185,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_enumListIndexed.begin(); iter != m_enumListIndexed.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_enumListIndexedAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2203,7 +2203,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_enumListWeightedList.begin(); iter != m_enumListWeightedList.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_enumListWeightedListAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2227,7 +2227,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_stringIdListSimple.begin(); iter != m_stringIdListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_stringIdListSimpleAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2245,7 +2245,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_stringIdListWeightedList.begin(); iter != m_stringIdListWeightedList.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_stringIdListWeightedListAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2269,7 +2269,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_stringListSimple.begin(); iter != m_stringListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_stringListSimpleAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2287,7 +2287,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_stringListWeightedList.begin(); iter != m_stringListWeightedList.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_stringListWeightedListAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2311,7 +2311,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_triggerVolumeList.begin(); iter != m_triggerVolumeList.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_triggerVolumeListAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2329,7 +2329,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_triggerVolumesListWeightedList.begin(); iter != m_triggerVolumesListWeightedList.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_triggerVolumesListWeightedListAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2353,7 +2353,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_boolListDerived.begin(); iter != m_boolListDerived.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_boolListDerivedAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2371,7 +2371,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_boolListSimple.begin(); iter != m_boolListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_boolListSimpleAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2389,7 +2389,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_boolListWeightedList.begin(); iter != m_boolListWeightedList.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_boolListWeightedListAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2411,7 +2411,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_vectorListSimple.begin(); iter != m_vectorListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_vectorListSimpleAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2435,7 +2435,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_filenameListSimple.begin(); iter != m_filenameListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_filenameListSimpleAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2463,7 +2463,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_templateListSimple.begin(); iter != m_templateListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_templateListSimpleAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -2485,7 +2485,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_structListSimple.begin(); iter != m_structListSimple.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_structListSimpleAppend = file.read_bool8(); int listCount = file.read_int32(); @@ -3487,9 +3487,9 @@ CompilerIntegerParam * ServerUberObjectTemplate::_Foo::getCompilerIntegerParam(c { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_item1; } @@ -3497,7 +3497,7 @@ CompilerIntegerParam * ServerUberObjectTemplate::_Foo::getCompilerIntegerParam(c } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerUberObjectTemplate::_Foo::getCompilerIntegerParam FloatParam * ServerUberObjectTemplate::_Foo::getFloatParam(const char *name, bool deepCheck, int index) @@ -3508,9 +3508,9 @@ FloatParam * ServerUberObjectTemplate::_Foo::getFloatParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_item2; } @@ -3518,7 +3518,7 @@ FloatParam * ServerUberObjectTemplate::_Foo::getFloatParam(const char *name, boo } else return TpfTemplate::getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerUberObjectTemplate::_Foo::getFloatParam BoolParam * ServerUberObjectTemplate::_Foo::getBoolParam(const char *name, bool deepCheck, int index) @@ -3534,9 +3534,9 @@ StringParam * ServerUberObjectTemplate::_Foo::getStringParam(const char *name, b { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_item3; } @@ -3544,7 +3544,7 @@ StringParam * ServerUberObjectTemplate::_Foo::getStringParam(const char *name, b } else return TpfTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerUberObjectTemplate::_Foo::getStringParam StringIdParam * ServerUberObjectTemplate::_Foo::getStringIdParam(const char *name, bool deepCheck, int index) diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerUniverseObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerUniverseObjectTemplate.cpp index 359ddce6..7f4176f1 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerUniverseObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerUniverseObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerUniverseObjectTemplate::getTemplateVersion(void) const */ Tag ServerUniverseObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerUniverseObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerUniverseObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerVehicleObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerVehicleObjectTemplate.cpp index 663fdb2a..e204aa23 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerVehicleObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerVehicleObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerVehicleObjectTemplate::getTemplateVersion(void) const */ Tag ServerVehicleObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerVehicleObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerVehicleObjectTemplate::getHighestTemplateVersion @@ -108,9 +108,9 @@ FloatParam * ServerVehicleObjectTemplate::getFloatParam(const char *name, bool d { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_currentFuel; } @@ -122,9 +122,9 @@ FloatParam * ServerVehicleObjectTemplate::getFloatParam(const char *name, bool d { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_maxFuel; } @@ -136,9 +136,9 @@ FloatParam * ServerVehicleObjectTemplate::getFloatParam(const char *name, bool d { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_consumpsion; } @@ -146,7 +146,7 @@ FloatParam * ServerVehicleObjectTemplate::getFloatParam(const char *name, bool d } else return ServerTangibleObjectTemplate::getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerVehicleObjectTemplate::getFloatParam BoolParam * ServerVehicleObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) @@ -162,9 +162,9 @@ StringParam * ServerVehicleObjectTemplate::getStringParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_fuelType; } @@ -172,7 +172,7 @@ StringParam * ServerVehicleObjectTemplate::getStringParam(const char *name, bool } else return ServerTangibleObjectTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerVehicleObjectTemplate::getStringParam StringIdParam * ServerVehicleObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -255,12 +255,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerWaypointObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerWaypointObjectTemplate.cpp index 0cd323ea..23c83cd5 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerWaypointObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerWaypointObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerWaypointObjectTemplate::getTemplateVersion(void) const */ Tag ServerWaypointObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerWaypointObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerWaypointObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerWeaponObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerWeaponObjectTemplate.cpp index 54aa2726..65775fd0 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerWeaponObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerWeaponObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerWeaponObjectTemplate::getTemplateVersion(void) const */ Tag ServerWeaponObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerWeaponObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerWeaponObjectTemplate::getHighestTemplateVersion @@ -103,9 +103,9 @@ CompilerIntegerParam * ServerWeaponObjectTemplate::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_weaponType; } @@ -117,9 +117,9 @@ CompilerIntegerParam * ServerWeaponObjectTemplate::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_attackType; } @@ -131,9 +131,9 @@ CompilerIntegerParam * ServerWeaponObjectTemplate::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_damageType; } @@ -145,9 +145,9 @@ CompilerIntegerParam * ServerWeaponObjectTemplate::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_elementalType; } @@ -159,9 +159,9 @@ CompilerIntegerParam * ServerWeaponObjectTemplate::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_elementalValue; } @@ -173,9 +173,9 @@ CompilerIntegerParam * ServerWeaponObjectTemplate::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_minDamageAmount; } @@ -187,9 +187,9 @@ CompilerIntegerParam * ServerWeaponObjectTemplate::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_maxDamageAmount; } @@ -201,9 +201,9 @@ CompilerIntegerParam * ServerWeaponObjectTemplate::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_attackCost; } @@ -215,9 +215,9 @@ CompilerIntegerParam * ServerWeaponObjectTemplate::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_accuracy; } @@ -225,7 +225,7 @@ CompilerIntegerParam * ServerWeaponObjectTemplate::getCompilerIntegerParam(const } else return ServerTangibleObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerWeaponObjectTemplate::getCompilerIntegerParam FloatParam * ServerWeaponObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -236,9 +236,9 @@ FloatParam * ServerWeaponObjectTemplate::getFloatParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_attackSpeed; } @@ -250,9 +250,9 @@ FloatParam * ServerWeaponObjectTemplate::getFloatParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_audibleRange; } @@ -264,9 +264,9 @@ FloatParam * ServerWeaponObjectTemplate::getFloatParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_minRange; } @@ -278,9 +278,9 @@ FloatParam * ServerWeaponObjectTemplate::getFloatParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_maxRange; } @@ -292,9 +292,9 @@ FloatParam * ServerWeaponObjectTemplate::getFloatParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_damageRadius; } @@ -306,9 +306,9 @@ FloatParam * ServerWeaponObjectTemplate::getFloatParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_woundChance; } @@ -316,7 +316,7 @@ FloatParam * ServerWeaponObjectTemplate::getFloatParam(const char *name, bool de } else return ServerTangibleObjectTemplate::getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } //ServerWeaponObjectTemplate::getFloatParam BoolParam * ServerWeaponObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) @@ -409,12 +409,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerXpManagerObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerXpManagerObjectTemplate.cpp index b5969702..0725fed2 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerXpManagerObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerXpManagerObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag ServerXpManagerObjectTemplate::getTemplateVersion(void) const */ Tag ServerXpManagerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerXpManagerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerXpManagerObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedBattlefieldMarkerObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedBattlefieldMarkerObjectTemplate.cpp index 21c891e3..a5bd8fe4 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedBattlefieldMarkerObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedBattlefieldMarkerObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedBattlefieldMarkerObjectTemplate::getTemplateVersion(void) const */ Tag SharedBattlefieldMarkerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedBattlefieldMarkerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedBattlefieldMarkerObjectTemplate::getHighestTemplateVersion @@ -103,9 +103,9 @@ CompilerIntegerParam * SharedBattlefieldMarkerObjectTemplate::getCompilerInteger { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_numberOfPoles; } @@ -113,7 +113,7 @@ CompilerIntegerParam * SharedBattlefieldMarkerObjectTemplate::getCompilerInteger } else return SharedTangibleObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedBattlefieldMarkerObjectTemplate::getCompilerIntegerParam FloatParam * SharedBattlefieldMarkerObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -124,9 +124,9 @@ FloatParam * SharedBattlefieldMarkerObjectTemplate::getFloatParam(const char *na { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_radius; } @@ -134,7 +134,7 @@ FloatParam * SharedBattlefieldMarkerObjectTemplate::getFloatParam(const char *na } else return SharedTangibleObjectTemplate::getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedBattlefieldMarkerObjectTemplate::getFloatParam BoolParam * SharedBattlefieldMarkerObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) @@ -227,12 +227,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedBuildingObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedBuildingObjectTemplate.cpp index 3af16bfb..f4bba6f0 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedBuildingObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedBuildingObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedBuildingObjectTemplate::getTemplateVersion(void) const */ Tag SharedBuildingObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedBuildingObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedBuildingObjectTemplate::getHighestTemplateVersion @@ -118,9 +118,9 @@ StringParam * SharedBuildingObjectTemplate::getStringParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_terrainModificationFileName; } @@ -132,9 +132,9 @@ StringParam * SharedBuildingObjectTemplate::getStringParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_interiorLayoutFileName; } @@ -142,7 +142,7 @@ StringParam * SharedBuildingObjectTemplate::getStringParam(const char *name, boo } else return SharedTangibleObjectTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedBuildingObjectTemplate::getStringParam StringIdParam * SharedBuildingObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -225,12 +225,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedCellObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedCellObjectTemplate.cpp index 7e96a950..1a71a06d 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedCellObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedCellObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedCellObjectTemplate::getTemplateVersion(void) const */ Tag SharedCellObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedCellObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedCellObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedConstructionContractObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedConstructionContractObjectTemplate.cpp index 7426b7c1..5c4b79e2 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedConstructionContractObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedConstructionContractObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedConstructionContractObjectTemplate::getTemplateVersion(void) const */ Tag SharedConstructionContractObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedConstructionContractObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedConstructionContractObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedCreatureObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedCreatureObjectTemplate.cpp index 913472e0..e4034d22 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedCreatureObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedCreatureObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedCreatureObjectTemplate::getTemplateVersion(void) const */ Tag SharedCreatureObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedCreatureObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedCreatureObjectTemplate::getHighestTemplateVersion @@ -103,9 +103,9 @@ CompilerIntegerParam * SharedCreatureObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_gender; } @@ -117,9 +117,9 @@ CompilerIntegerParam * SharedCreatureObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_niche; } @@ -131,9 +131,9 @@ CompilerIntegerParam * SharedCreatureObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_species; } @@ -145,9 +145,9 @@ CompilerIntegerParam * SharedCreatureObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_race; } @@ -155,7 +155,7 @@ CompilerIntegerParam * SharedCreatureObjectTemplate::getCompilerIntegerParam(con } else return SharedTangibleObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedCreatureObjectTemplate::getCompilerIntegerParam FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -166,9 +166,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_acceleration[index]; } @@ -180,9 +180,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_speed[index]; } @@ -194,9 +194,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_turnRate[index]; } @@ -208,9 +208,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_slopeModAngle; } @@ -222,9 +222,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_slopeModPercent; } @@ -236,9 +236,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_waterModPercent; } @@ -250,9 +250,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_stepHeight; } @@ -264,9 +264,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_collisionHeight; } @@ -278,9 +278,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_collisionRadius; } @@ -292,9 +292,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_swimHeight; } @@ -306,9 +306,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_warpTolerance; } @@ -320,9 +320,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_collisionOffsetX; } @@ -334,9 +334,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_collisionOffsetZ; } @@ -348,9 +348,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_collisionLength; } @@ -362,9 +362,9 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_cameraHeight; } @@ -372,7 +372,7 @@ FloatParam * SharedCreatureObjectTemplate::getFloatParam(const char *name, bool } else return SharedTangibleObjectTemplate::getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedCreatureObjectTemplate::getFloatParam BoolParam * SharedCreatureObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) @@ -383,9 +383,9 @@ BoolParam * SharedCreatureObjectTemplate::getBoolParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_postureAlignToTerrain[index]; } @@ -393,7 +393,7 @@ BoolParam * SharedCreatureObjectTemplate::getBoolParam(const char *name, bool de } else return SharedTangibleObjectTemplate::getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedCreatureObjectTemplate::getBoolParam StringParam * SharedCreatureObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) @@ -404,9 +404,9 @@ StringParam * SharedCreatureObjectTemplate::getStringParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_animationMapFilename; } @@ -418,9 +418,9 @@ StringParam * SharedCreatureObjectTemplate::getStringParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_movementDatatable; } @@ -428,7 +428,7 @@ StringParam * SharedCreatureObjectTemplate::getStringParam(const char *name, boo } else return SharedTangibleObjectTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedCreatureObjectTemplate::getStringParam StringIdParam * SharedCreatureObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -528,12 +528,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedDraftSchematicObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedDraftSchematicObjectTemplate.cpp index 3f651ac8..9c18023d 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedDraftSchematicObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedDraftSchematicObjectTemplate.cpp @@ -47,7 +47,7 @@ SharedDraftSchematicObjectTemplate::~SharedDraftSchematicObjectTemplate() for (iter = m_slots.begin(); iter != m_slots.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_slots.clear(); } @@ -56,7 +56,7 @@ SharedDraftSchematicObjectTemplate::~SharedDraftSchematicObjectTemplate() for (iter = m_attributes.begin(); iter != m_attributes.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_attributes.clear(); } @@ -108,10 +108,10 @@ Tag SharedDraftSchematicObjectTemplate::getTemplateVersion(void) const */ Tag SharedDraftSchematicObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedDraftSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedDraftSchematicObjectTemplate::getHighestTemplateVersion @@ -140,9 +140,9 @@ StringParam * SharedDraftSchematicObjectTemplate::getStringParam(const char *nam { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_craftedSharedTemplate; } @@ -150,7 +150,7 @@ StringParam * SharedDraftSchematicObjectTemplate::getStringParam(const char *nam } else return SharedIntangibleObjectTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedDraftSchematicObjectTemplate::getStringParam StringIdParam * SharedDraftSchematicObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -196,7 +196,7 @@ StructParamOT * SharedDraftSchematicObjectTemplate::getStructParamOT(const char } else return SharedIntangibleObjectTemplate::getStructParamOT(name, deepCheck, index); - return NULL; + return nullptr; } //SharedDraftSchematicObjectTemplate::getStructParamOT TriggerVolumeParam * SharedDraftSchematicObjectTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index) @@ -294,12 +294,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -327,7 +327,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_slots.begin(); iter != m_slots.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_slots.clear(); m_slotsAppend = file.read_bool8(); @@ -346,7 +346,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_attributes.begin(); iter != m_attributes.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_attributes.clear(); m_attributesAppend = file.read_bool8(); @@ -512,9 +512,9 @@ StringParam * SharedDraftSchematicObjectTemplate::_IngredientSlot::getStringPara { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_hardpoint; } @@ -522,7 +522,7 @@ StringParam * SharedDraftSchematicObjectTemplate::_IngredientSlot::getStringPara } else return TpfTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedDraftSchematicObjectTemplate::_IngredientSlot::getStringParam StringIdParam * SharedDraftSchematicObjectTemplate::_IngredientSlot::getStringIdParam(const char *name, bool deepCheck, int index) @@ -533,9 +533,9 @@ StringIdParam * SharedDraftSchematicObjectTemplate::_IngredientSlot::getStringId { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_name; } @@ -543,7 +543,7 @@ StringIdParam * SharedDraftSchematicObjectTemplate::_IngredientSlot::getStringId } else return TpfTemplate::getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedDraftSchematicObjectTemplate::_IngredientSlot::getStringIdParam VectorParam * SharedDraftSchematicObjectTemplate::_IngredientSlot::getVectorParam(const char *name, bool deepCheck, int index) @@ -717,9 +717,9 @@ CompilerIntegerParam * SharedDraftSchematicObjectTemplate::_SchematicAttribute:: { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_value; } @@ -727,7 +727,7 @@ CompilerIntegerParam * SharedDraftSchematicObjectTemplate::_SchematicAttribute:: } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedDraftSchematicObjectTemplate::_SchematicAttribute::getCompilerIntegerParam FloatParam * SharedDraftSchematicObjectTemplate::_SchematicAttribute::getFloatParam(const char *name, bool deepCheck, int index) @@ -753,9 +753,9 @@ StringIdParam * SharedDraftSchematicObjectTemplate::_SchematicAttribute::getStri { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_name; } @@ -767,9 +767,9 @@ StringIdParam * SharedDraftSchematicObjectTemplate::_SchematicAttribute::getStri { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_experiment; } @@ -777,7 +777,7 @@ StringIdParam * SharedDraftSchematicObjectTemplate::_SchematicAttribute::getStri } else return TpfTemplate::getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedDraftSchematicObjectTemplate::_SchematicAttribute::getStringIdParam VectorParam * SharedDraftSchematicObjectTemplate::_SchematicAttribute::getVectorParam(const char *name, bool deepCheck, int index) diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedFactoryObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedFactoryObjectTemplate.cpp index e917394d..3088f935 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedFactoryObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedFactoryObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedFactoryObjectTemplate::getTemplateVersion(void) const */ Tag SharedFactoryObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedFactoryObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedFactoryObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedGroupObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedGroupObjectTemplate.cpp index a5bb8830..6eecfb9e 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedGroupObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedGroupObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedGroupObjectTemplate::getTemplateVersion(void) const */ Tag SharedGroupObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedGroupObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedGroupObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedGuildObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedGuildObjectTemplate.cpp index 26ba6d9a..be710a73 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedGuildObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedGuildObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedGuildObjectTemplate::getTemplateVersion(void) const */ Tag SharedGuildObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedGuildObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedGuildObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedInstallationObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedInstallationObjectTemplate.cpp index 70ae2f01..3b396c5a 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedInstallationObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedInstallationObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedInstallationObjectTemplate::getTemplateVersion(void) const */ Tag SharedInstallationObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedInstallationObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedInstallationObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedIntangibleObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedIntangibleObjectTemplate.cpp index 67245c19..077b284d 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedIntangibleObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedIntangibleObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedIntangibleObjectTemplate::getTemplateVersion(void) const */ Tag SharedIntangibleObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedIntangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedIntangibleObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedJediManagerObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedJediManagerObjectTemplate.cpp index 0cce8f75..66b0ddfa 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedJediManagerObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedJediManagerObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedJediManagerObjectTemplate::getTemplateVersion(void) const */ Tag SharedJediManagerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedJediManagerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedJediManagerObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedManufactureSchematicObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedManufactureSchematicObjectTemplate.cpp index 3b860316..e1fa62c8 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedManufactureSchematicObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedManufactureSchematicObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedManufactureSchematicObjectTemplate::getTemplateVersion(void) const */ Tag SharedManufactureSchematicObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedManufactureSchematicObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedManufactureSchematicObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedMissionObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedMissionObjectTemplate.cpp index f52ed728..23330fc7 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedMissionObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedMissionObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedMissionObjectTemplate::getTemplateVersion(void) const */ Tag SharedMissionObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedMissionObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedMissionObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedObjectTemplate.cpp index ea1fa149..250ddd5c 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedObjectTemplate::getTemplateVersion(void) const */ Tag SharedObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedObjectTemplate::getHighestTemplateVersion @@ -103,9 +103,9 @@ CompilerIntegerParam * SharedObjectTemplate::getCompilerIntegerParam(const char { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_containerType; } @@ -117,9 +117,9 @@ CompilerIntegerParam * SharedObjectTemplate::getCompilerIntegerParam(const char { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_containerVolumeLimit; } @@ -131,9 +131,9 @@ CompilerIntegerParam * SharedObjectTemplate::getCompilerIntegerParam(const char { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_gameObjectType; } @@ -145,9 +145,9 @@ CompilerIntegerParam * SharedObjectTemplate::getCompilerIntegerParam(const char { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_surfaceType; } @@ -155,7 +155,7 @@ CompilerIntegerParam * SharedObjectTemplate::getCompilerIntegerParam(const char } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedObjectTemplate::getCompilerIntegerParam FloatParam * SharedObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -166,9 +166,9 @@ FloatParam * SharedObjectTemplate::getFloatParam(const char *name, bool deepChec { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_scale; } @@ -180,9 +180,9 @@ FloatParam * SharedObjectTemplate::getFloatParam(const char *name, bool deepChec { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_scaleThresholdBeforeExtentTest; } @@ -194,9 +194,9 @@ FloatParam * SharedObjectTemplate::getFloatParam(const char *name, bool deepChec { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_clearFloraRadius; } @@ -208,9 +208,9 @@ FloatParam * SharedObjectTemplate::getFloatParam(const char *name, bool deepChec { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_noBuildRadius; } @@ -222,9 +222,9 @@ FloatParam * SharedObjectTemplate::getFloatParam(const char *name, bool deepChec { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_locationReservationRadius; } @@ -232,7 +232,7 @@ FloatParam * SharedObjectTemplate::getFloatParam(const char *name, bool deepChec } else return TpfTemplate::getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedObjectTemplate::getFloatParam BoolParam * SharedObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) @@ -243,9 +243,9 @@ BoolParam * SharedObjectTemplate::getBoolParam(const char *name, bool deepCheck, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_snapToTerrain; } @@ -257,9 +257,9 @@ BoolParam * SharedObjectTemplate::getBoolParam(const char *name, bool deepCheck, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_sendToClient; } @@ -271,9 +271,9 @@ BoolParam * SharedObjectTemplate::getBoolParam(const char *name, bool deepCheck, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_onlyVisibleInTools; } @@ -285,9 +285,9 @@ BoolParam * SharedObjectTemplate::getBoolParam(const char *name, bool deepCheck, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_forceNoCollision; } @@ -295,7 +295,7 @@ BoolParam * SharedObjectTemplate::getBoolParam(const char *name, bool deepCheck, } else return TpfTemplate::getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedObjectTemplate::getBoolParam StringParam * SharedObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) @@ -306,9 +306,9 @@ StringParam * SharedObjectTemplate::getStringParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_tintPalette; } @@ -320,9 +320,9 @@ StringParam * SharedObjectTemplate::getStringParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_slotDescriptorFilename; } @@ -334,9 +334,9 @@ StringParam * SharedObjectTemplate::getStringParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_arrangementDescriptorFilename; } @@ -348,9 +348,9 @@ StringParam * SharedObjectTemplate::getStringParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_appearanceFilename; } @@ -362,9 +362,9 @@ StringParam * SharedObjectTemplate::getStringParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_portalLayoutFilename; } @@ -376,9 +376,9 @@ StringParam * SharedObjectTemplate::getStringParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_clientDataFile; } @@ -386,7 +386,7 @@ StringParam * SharedObjectTemplate::getStringParam(const char *name, bool deepCh } else return TpfTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedObjectTemplate::getStringParam StringIdParam * SharedObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -397,9 +397,9 @@ StringIdParam * SharedObjectTemplate::getStringIdParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_objectName; } @@ -411,9 +411,9 @@ StringIdParam * SharedObjectTemplate::getStringIdParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_detailedDescription; } @@ -425,9 +425,9 @@ StringIdParam * SharedObjectTemplate::getStringIdParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_lookAtText; } @@ -435,7 +435,7 @@ StringIdParam * SharedObjectTemplate::getStringIdParam(const char *name, bool de } else return TpfTemplate::getStringIdParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedObjectTemplate::getStringIdParam VectorParam * SharedObjectTemplate::getVectorParam(const char *name, bool deepCheck, int index) @@ -513,12 +513,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedPlayerObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedPlayerObjectTemplate.cpp index b926fbb4..5d99e4c9 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedPlayerObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedPlayerObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedPlayerObjectTemplate::getTemplateVersion(void) const */ Tag SharedPlayerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedPlayerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedPlayerObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedPlayerQuestObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedPlayerQuestObjectTemplate.cpp index b9ed644e..f3b04e88 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedPlayerQuestObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedPlayerQuestObjectTemplate.cpp @@ -87,10 +87,10 @@ Tag SharedPlayerQuestObjectTemplate::getTemplateVersion(void) const */ Tag SharedPlayerQuestObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedPlayerQuestObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedPlayerQuestObjectTemplate::getHighestTemplateVersion @@ -196,12 +196,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedResourceContainerObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedResourceContainerObjectTemplate.cpp index e77a29d6..3ea96d3d 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedResourceContainerObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedResourceContainerObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedResourceContainerObjectTemplate::getTemplateVersion(void) const */ Tag SharedResourceContainerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedResourceContainerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedResourceContainerObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedShipObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedShipObjectTemplate.cpp index 25f8f375..d7705d97 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedShipObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedShipObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedShipObjectTemplate::getTemplateVersion(void) const */ Tag SharedShipObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedShipObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedShipObjectTemplate::getHighestTemplateVersion @@ -113,9 +113,9 @@ BoolParam * SharedShipObjectTemplate::getBoolParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_hasWings; } @@ -127,9 +127,9 @@ BoolParam * SharedShipObjectTemplate::getBoolParam(const char *name, bool deepCh { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_playerControlled; } @@ -137,7 +137,7 @@ BoolParam * SharedShipObjectTemplate::getBoolParam(const char *name, bool deepCh } else return SharedTangibleObjectTemplate::getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedShipObjectTemplate::getBoolParam StringParam * SharedShipObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) @@ -148,9 +148,9 @@ StringParam * SharedShipObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_cockpitFilename; } @@ -162,9 +162,9 @@ StringParam * SharedShipObjectTemplate::getStringParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_interiorLayoutFileName; } @@ -172,7 +172,7 @@ StringParam * SharedShipObjectTemplate::getStringParam(const char *name, bool de } else return SharedTangibleObjectTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedShipObjectTemplate::getStringParam StringIdParam * SharedShipObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -255,12 +255,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedStaticObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedStaticObjectTemplate.cpp index 630e8239..19de68be 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedStaticObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedStaticObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedStaticObjectTemplate::getTemplateVersion(void) const */ Tag SharedStaticObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedStaticObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedStaticObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedTangibleObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedTangibleObjectTemplate.cpp index 3157fb24..10a66071 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedTangibleObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedTangibleObjectTemplate.cpp @@ -55,7 +55,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() for (iter = m_paletteColorCustomizationVariables.begin(); iter != m_paletteColorCustomizationVariables.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_paletteColorCustomizationVariables.clear(); } @@ -64,7 +64,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() for (iter = m_rangedIntCustomizationVariables.begin(); iter != m_rangedIntCustomizationVariables.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_rangedIntCustomizationVariables.clear(); } @@ -73,7 +73,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() for (iter = m_constStringCustomizationVariables.begin(); iter != m_constStringCustomizationVariables.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_constStringCustomizationVariables.clear(); } @@ -82,7 +82,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() for (iter = m_socketDestinations.begin(); iter != m_socketDestinations.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_socketDestinations.clear(); } @@ -91,7 +91,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() for (iter = m_certificationsRequired.begin(); iter != m_certificationsRequired.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_certificationsRequired.clear(); } @@ -100,7 +100,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() for (iter = m_customizationVariableMapping.begin(); iter != m_customizationVariableMapping.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_customizationVariableMapping.clear(); } @@ -152,10 +152,10 @@ Tag SharedTangibleObjectTemplate::getTemplateVersion(void) const */ Tag SharedTangibleObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedTangibleObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedTangibleObjectTemplate::getHighestTemplateVersion @@ -181,9 +181,9 @@ CompilerIntegerParam * SharedTangibleObjectTemplate::getCompilerIntegerParam(con { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_clientVisabilityFlag; } @@ -191,7 +191,7 @@ CompilerIntegerParam * SharedTangibleObjectTemplate::getCompilerIntegerParam(con } else return SharedObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedTangibleObjectTemplate::getCompilerIntegerParam FloatParam * SharedTangibleObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -207,9 +207,9 @@ BoolParam * SharedTangibleObjectTemplate::getBoolParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_useStructureFootprintOutline; } @@ -221,9 +221,9 @@ BoolParam * SharedTangibleObjectTemplate::getBoolParam(const char *name, bool de { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_targetable; } @@ -231,7 +231,7 @@ BoolParam * SharedTangibleObjectTemplate::getBoolParam(const char *name, bool de } else return SharedObjectTemplate::getBoolParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedTangibleObjectTemplate::getBoolParam StringParam * SharedTangibleObjectTemplate::getStringParam(const char *name, bool deepCheck, int index) @@ -242,9 +242,9 @@ StringParam * SharedTangibleObjectTemplate::getStringParam(const char *name, boo { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_structureFootprintFileName; } @@ -264,7 +264,7 @@ StringParam * SharedTangibleObjectTemplate::getStringParam(const char *name, boo } else return SharedObjectTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedTangibleObjectTemplate::getStringParam StringIdParam * SharedTangibleObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -334,7 +334,7 @@ StructParamOT * SharedTangibleObjectTemplate::getStructParamOT(const char *name, } else return SharedObjectTemplate::getStructParamOT(name, deepCheck, index); - return NULL; + return nullptr; } //SharedTangibleObjectTemplate::getStructParamOT TriggerVolumeParam * SharedTangibleObjectTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index) @@ -488,12 +488,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } @@ -521,7 +521,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_paletteColorCustomizationVariables.begin(); iter != m_paletteColorCustomizationVariables.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_paletteColorCustomizationVariables.clear(); m_paletteColorCustomizationVariablesAppend = file.read_bool8(); @@ -540,7 +540,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_rangedIntCustomizationVariables.begin(); iter != m_rangedIntCustomizationVariables.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_rangedIntCustomizationVariables.clear(); m_rangedIntCustomizationVariablesAppend = file.read_bool8(); @@ -559,7 +559,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_constStringCustomizationVariables.begin(); iter != m_constStringCustomizationVariables.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_constStringCustomizationVariables.clear(); m_constStringCustomizationVariablesAppend = file.read_bool8(); @@ -578,7 +578,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_socketDestinations.begin(); iter != m_socketDestinations.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_socketDestinations.clear(); m_socketDestinationsAppend = file.read_bool8(); @@ -603,7 +603,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_certificationsRequired.begin(); iter != m_certificationsRequired.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_certificationsRequired.clear(); m_certificationsRequiredAppend = file.read_bool8(); @@ -622,7 +622,7 @@ char paramName[MAX_NAME_SIZE]; for (iter = m_customizationVariableMapping.begin(); iter != m_customizationVariableMapping.end(); ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } m_customizationVariableMapping.clear(); m_customizationVariableMappingAppend = file.read_bool8(); @@ -866,9 +866,9 @@ StringParam * SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::g { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_variableName; } @@ -880,9 +880,9 @@ StringParam * SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::g { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_constValue; } @@ -890,7 +890,7 @@ StringParam * SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::g } else return TpfTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::getStringParam StringIdParam * SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::getStringIdParam(const char *name, bool deepCheck, int index) @@ -1084,9 +1084,9 @@ StringParam * SharedTangibleObjectTemplate::_CustomizationVariableMapping::getSt { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_sourceVariable; } @@ -1098,9 +1098,9 @@ StringParam * SharedTangibleObjectTemplate::_CustomizationVariableMapping::getSt { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_dependentVariable; } @@ -1108,7 +1108,7 @@ StringParam * SharedTangibleObjectTemplate::_CustomizationVariableMapping::getSt } else return TpfTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedTangibleObjectTemplate::_CustomizationVariableMapping::getStringParam StringIdParam * SharedTangibleObjectTemplate::_CustomizationVariableMapping::getStringIdParam(const char *name, bool deepCheck, int index) @@ -1287,9 +1287,9 @@ CompilerIntegerParam * SharedTangibleObjectTemplate::_PaletteColorCustomizationV { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_defaultPaletteIndex; } @@ -1297,7 +1297,7 @@ CompilerIntegerParam * SharedTangibleObjectTemplate::_PaletteColorCustomizationV } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getCompilerIntegerParam FloatParam * SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getFloatParam(const char *name, bool deepCheck, int index) @@ -1318,9 +1318,9 @@ StringParam * SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable:: { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_variableName; } @@ -1332,9 +1332,9 @@ StringParam * SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable:: { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_palettePathName; } @@ -1342,7 +1342,7 @@ StringParam * SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable:: } else return TpfTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getStringParam StringIdParam * SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getStringIdParam(const char *name, bool deepCheck, int index) @@ -1529,9 +1529,9 @@ CompilerIntegerParam * SharedTangibleObjectTemplate::_RangedIntCustomizationVari { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_minValueInclusive; } @@ -1543,9 +1543,9 @@ CompilerIntegerParam * SharedTangibleObjectTemplate::_RangedIntCustomizationVari { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_defaultValue; } @@ -1557,9 +1557,9 @@ CompilerIntegerParam * SharedTangibleObjectTemplate::_RangedIntCustomizationVari { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_maxValueExclusive; } @@ -1567,7 +1567,7 @@ CompilerIntegerParam * SharedTangibleObjectTemplate::_RangedIntCustomizationVari } else return TpfTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getCompilerIntegerParam FloatParam * SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getFloatParam(const char *name, bool deepCheck, int index) @@ -1588,9 +1588,9 @@ StringParam * SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::get { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_variableName; } @@ -1598,7 +1598,7 @@ StringParam * SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::get } else return TpfTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getStringParam StringIdParam * SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getStringIdParam(const char *name, bool deepCheck, int index) diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedTerrainSurfaceObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedTerrainSurfaceObjectTemplate.cpp index 2eb61bd9..aeaeff99 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedTerrainSurfaceObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedTerrainSurfaceObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedTerrainSurfaceObjectTemplate::getTemplateVersion(void) const */ Tag SharedTerrainSurfaceObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedTerrainSurfaceObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedTerrainSurfaceObjectTemplate::getHighestTemplateVersion @@ -108,9 +108,9 @@ FloatParam * SharedTerrainSurfaceObjectTemplate::getFloatParam(const char *name, { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_cover; } @@ -118,7 +118,7 @@ FloatParam * SharedTerrainSurfaceObjectTemplate::getFloatParam(const char *name, } else return TpfTemplate::getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedTerrainSurfaceObjectTemplate::getFloatParam BoolParam * SharedTerrainSurfaceObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) @@ -134,9 +134,9 @@ StringParam * SharedTerrainSurfaceObjectTemplate::getStringParam(const char *nam { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_surfaceType; } @@ -144,7 +144,7 @@ StringParam * SharedTerrainSurfaceObjectTemplate::getStringParam(const char *nam } else return TpfTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedTerrainSurfaceObjectTemplate::getStringParam StringIdParam * SharedTerrainSurfaceObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -227,12 +227,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedTokenObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedTokenObjectTemplate.cpp index cf352144..03f9ec94 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedTokenObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedTokenObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedTokenObjectTemplate::getTemplateVersion(void) const */ Tag SharedTokenObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedTokenObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedTokenObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedUniverseObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedUniverseObjectTemplate.cpp index 62685a52..d429becf 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedUniverseObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedUniverseObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedUniverseObjectTemplate::getTemplateVersion(void) const */ Tag SharedUniverseObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedUniverseObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedUniverseObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedVehicleObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedVehicleObjectTemplate.cpp index ffa28bfb..b1f83b74 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedVehicleObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedVehicleObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedVehicleObjectTemplate::getTemplateVersion(void) const */ Tag SharedVehicleObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedVehicleObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedVehicleObjectTemplate::getHighestTemplateVersion @@ -108,9 +108,9 @@ FloatParam * SharedVehicleObjectTemplate::getFloatParam(const char *name, bool d { if (deepCheck && !isParamLoaded(name, false, index)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_speed[index]; } @@ -122,9 +122,9 @@ FloatParam * SharedVehicleObjectTemplate::getFloatParam(const char *name, bool d { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_slopeAversion; } @@ -136,9 +136,9 @@ FloatParam * SharedVehicleObjectTemplate::getFloatParam(const char *name, bool d { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_hoverValue; } @@ -150,9 +150,9 @@ FloatParam * SharedVehicleObjectTemplate::getFloatParam(const char *name, bool d { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_turnRate; } @@ -164,9 +164,9 @@ FloatParam * SharedVehicleObjectTemplate::getFloatParam(const char *name, bool d { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_maxVelocity; } @@ -178,9 +178,9 @@ FloatParam * SharedVehicleObjectTemplate::getFloatParam(const char *name, bool d { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_acceleration; } @@ -192,9 +192,9 @@ FloatParam * SharedVehicleObjectTemplate::getFloatParam(const char *name, bool d { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_braking; } @@ -202,7 +202,7 @@ FloatParam * SharedVehicleObjectTemplate::getFloatParam(const char *name, bool d } else return SharedTangibleObjectTemplate::getFloatParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedVehicleObjectTemplate::getFloatParam BoolParam * SharedVehicleObjectTemplate::getBoolParam(const char *name, bool deepCheck, int index) @@ -300,12 +300,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedWaypointObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedWaypointObjectTemplate.cpp index b845d576..69ad3053 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedWaypointObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedWaypointObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedWaypointObjectTemplate::getTemplateVersion(void) const */ Tag SharedWaypointObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedWaypointObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedWaypointObjectTemplate::getHighestTemplateVersion @@ -195,12 +195,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedWeaponObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedWeaponObjectTemplate.cpp index b6bf3e51..690d160e 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedWeaponObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedWeaponObjectTemplate.cpp @@ -86,10 +86,10 @@ Tag SharedWeaponObjectTemplate::getTemplateVersion(void) const */ Tag SharedWeaponObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const SharedWeaponObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // SharedWeaponObjectTemplate::getHighestTemplateVersion @@ -103,9 +103,9 @@ CompilerIntegerParam * SharedWeaponObjectTemplate::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_weaponEffectIndex; } @@ -117,9 +117,9 @@ CompilerIntegerParam * SharedWeaponObjectTemplate::getCompilerIntegerParam(const { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_attackType; } @@ -127,7 +127,7 @@ CompilerIntegerParam * SharedWeaponObjectTemplate::getCompilerIntegerParam(const } else return SharedTangibleObjectTemplate::getCompilerIntegerParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedWeaponObjectTemplate::getCompilerIntegerParam FloatParam * SharedWeaponObjectTemplate::getFloatParam(const char *name, bool deepCheck, int index) @@ -148,9 +148,9 @@ StringParam * SharedWeaponObjectTemplate::getStringParam(const char *name, bool { if (deepCheck && !isParamLoaded(name, false, 0)) { - if (getBaseTemplate() != NULL) + if (getBaseTemplate() != nullptr) return getBaseTemplate()->getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } return &m_weaponEffect; } @@ -158,7 +158,7 @@ StringParam * SharedWeaponObjectTemplate::getStringParam(const char *name, bool } else return SharedTangibleObjectTemplate::getStringParam(name, deepCheck, index); - return NULL; + return nullptr; } //SharedWeaponObjectTemplate::getStringParam StringIdParam * SharedWeaponObjectTemplate::getStringIdParam(const char *name, bool deepCheck, int index) @@ -241,12 +241,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/File.cpp b/engine/shared/library/sharedTemplateDefinition/src/shared/core/File.cpp index d3b0322d..07755d95 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/File.cpp +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/File.cpp @@ -19,7 +19,7 @@ // File static variables Filename File::m_basePath; -File::FunctionPtr File::m_callBack = NULL; +File::FunctionPtr File::m_callBack = nullptr; //======================================================================== // File functions @@ -49,7 +49,7 @@ bool File::open(const char *filename, const char *mode) // @todo: find an equivalent function for Linux m_fp = fopen(m_filename, mode); #endif - if (m_fp != NULL) + if (m_fp != nullptr) { m_currentLine = 0; return true; @@ -57,7 +57,7 @@ bool File::open(const char *filename, const char *mode) else { const char * errstr = strerror(errno); - if (errstr != NULL) + if (errstr != nullptr) { m_filename.clear(); printError(errstr); @@ -75,7 +75,7 @@ bool File::open(const char *filename, const char *mode) */ bool File::exists(const char *filename) { - if (filename == NULL) + if (filename == nullptr) return false; #if defined(WIN32) @@ -110,7 +110,7 @@ int File::readRawLine(char *buffer, int bufferSize) NOT_NULL(buffer); ++m_currentLine; - if (fgets(buffer, bufferSize, m_fp) == NULL) + if (fgets(buffer, bufferSize, m_fp) == nullptr) { if (feof(m_fp)) return -1; @@ -149,7 +149,7 @@ int File::readLine(char *buffer, int bufferSize) for (;;) { ++m_currentLine; - if (fgets(buffer, bufferSize, m_fp) == NULL) + if (fgets(buffer, bufferSize, m_fp) == nullptr) { if (feof(m_fp)) return -1; diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/File.h b/engine/shared/library/sharedTemplateDefinition/src/shared/core/File.h index b8f655e6..c2292615 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/File.h +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/File.h @@ -54,13 +54,13 @@ private: inline File::File(void) : - m_fp(NULL), + m_fp(nullptr), m_currentLine(0) { } // File::File(void) inline File::File(const char *filename, const char *mode) : - m_fp(NULL), + m_fp(nullptr), m_currentLine(0) { open(filename, mode); @@ -83,15 +83,15 @@ inline const Filename & File::getFilename(void) const inline bool File::isOpened(void) const { - return (m_fp != NULL); + return (m_fp != nullptr); } // File::isOpened inline void File::close(void) { - if (m_fp != NULL) + if (m_fp != nullptr) { fclose(m_fp); - m_fp = NULL; + m_fp = nullptr; } } // File::close @@ -110,7 +110,7 @@ inline void File::printWarning(const char *buffer) const fprintf(stderr, "%s", error); - if (m_callBack != NULL) + if (m_callBack != nullptr) { m_callBack(error); } @@ -125,7 +125,7 @@ inline void File::printError(const char *buffer) const fprintf(stderr, "%s", error); - if (m_callBack != NULL) + if (m_callBack != nullptr) { m_callBack(error); } diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/Filename.cpp b/engine/shared/library/sharedTemplateDefinition/src/shared/core/Filename.cpp index 82d85bfa..1f329c77 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/Filename.cpp +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/Filename.cpp @@ -39,7 +39,7 @@ const char PATH_SEPARATOR = LINUX_PATH_SEPARATOR; */ void Filename::setPath(const char *path) { - if (path == NULL || *path == '\0') + if (path == nullptr || *path == '\0') m_path.clear(); else { @@ -69,7 +69,7 @@ void Filename::setPath(const char *path) */ void Filename::setName(const char *name) { - if (name == NULL || *name == '\0') + if (name == nullptr || *name == '\0') m_name.clear(); else { @@ -85,7 +85,7 @@ void Filename::setName(const char *name) const char *dot = strrchr(localname.c_str(), '.'); const char *firstSeparator = strchr(localname.c_str(), PATH_SEPARATOR); const char *lastSeparator = strrchr(localname.c_str(), PATH_SEPARATOR); - if (firstSeparator != NULL) + if (firstSeparator != nullptr) { // name has a path if (firstSeparator == localname) @@ -100,11 +100,11 @@ void Filename::setName(const char *name) localname.c_str() + 1); } } - if (dot != NULL && (lastSeparator == NULL || dot > lastSeparator)) + if (dot != nullptr && (lastSeparator == nullptr || dot > lastSeparator)) { // name has an extension setExtension(dot); - if (lastSeparator == NULL) + if (lastSeparator == nullptr) m_name = std::string(localname.c_str(), dot - localname.c_str()); else m_name = std::string(lastSeparator + 1, dot - (lastSeparator + 1)); @@ -112,7 +112,7 @@ void Filename::setName(const char *name) else { // name doesn't have an extension - if (lastSeparator == NULL) + if (lastSeparator == nullptr) m_name = localname; else m_name = std::string(lastSeparator + 1); @@ -129,7 +129,7 @@ void Filename::setName(const char *name) */ void Filename::setExtension(const char *extension) { - if (extension == NULL || *extension == '\0') + if (extension == nullptr || *extension == '\0') m_extension.clear(); else { @@ -253,7 +253,7 @@ static const std::string PATH_SEPARATOR_STRING(PATH_SEPARATOR_BUFF); */ void Filename::setDrive(const char *drive) { - if (drive != NULL && isalpha(*drive)) + if (drive != nullptr && isalpha(*drive)) m_drive = std::string(drive, 1) + ":"; else m_drive.clear(); @@ -273,7 +273,7 @@ std::string path; #if defined(WIN32) char *pathBuf; - DWORD bufsize = GetFullPathName(getFullFilename().c_str(), 0, NULL, NULL); + DWORD bufsize = GetFullPathName(getFullFilename().c_str(), 0, nullptr, nullptr); if (bufsize != 0) { pathBuf = new char[bufsize + 1]; @@ -285,7 +285,7 @@ std::string path; } #elif defined(linux) char pathBuf[PATH_MAX]; - if (getcwd(pathBuf, PATH_MAX) != NULL) + if (getcwd(pathBuf, PATH_MAX) != nullptr) { strcat(pathBuf, "/"); strcat(pathBuf, getFullFilename().c_str()); @@ -306,19 +306,19 @@ void Filename::verifyAndCreatePath(void) const #if defined(WIN32) if (WindowsUnicode) { - char *buffer = NULL; + char *buffer = nullptr; DWORD buflen; // get our current path - buflen = GetFullPathName(".", 0, buffer, NULL); + buflen = GetFullPathName(".", 0, buffer, nullptr); buffer = new char[buflen + 1]; - buflen = GetFullPathName(".", buflen + 1, buffer, NULL); + buflen = GetFullPathName(".", buflen + 1, buffer, nullptr); Unicode::String srcPath = Unicode::narrowToWide(buffer); delete[] buffer; // get the destination path std::string correctPath(getDrive() + getPath()); - buflen = GetFullPathName(correctPath.c_str(), 0, buffer, NULL); + buflen = GetFullPathName(correctPath.c_str(), 0, buffer, nullptr); buffer = new char[buflen + 1]; - buflen = GetFullPathName(correctPath.c_str(), buflen + 1, buffer, NULL); + buflen = GetFullPathName(correctPath.c_str(), buflen + 1, buffer, nullptr); Unicode::String destPath = Unicode::narrowToWide(buffer); delete[] buffer; @@ -335,7 +335,7 @@ void Filename::verifyAndCreatePath(void) const destPath += splitDestPath[i]; if (SetCurrentDirectoryW((LPCWSTR)destPath.c_str()) == 0) { - if (CreateDirectoryW((LPCWSTR)destPath.c_str(), NULL) == 0) + if (CreateDirectoryW((LPCWSTR)destPath.c_str(), nullptr) == 0) return; if (SetCurrentDirectoryW((LPCWSTR)destPath.c_str()) == 0) return; @@ -347,19 +347,19 @@ void Filename::verifyAndCreatePath(void) const } else { - char *buffer = NULL; + char *buffer = nullptr; DWORD buflen; // get our current path - buflen = GetFullPathName(".", 0, buffer, NULL); + buflen = GetFullPathName(".", 0, buffer, nullptr); buffer = new char[buflen + 1]; - buflen = GetFullPathName(".", buflen + 1, buffer, NULL); + buflen = GetFullPathName(".", buflen + 1, buffer, nullptr); std::string srcPath = buffer; delete[] buffer; // get the destination path std::string correctPath(getDrive() + getPath()); - buflen = GetFullPathName(correctPath.c_str(), 0, buffer, NULL); + buflen = GetFullPathName(correctPath.c_str(), 0, buffer, nullptr); buffer = new char[buflen + 1]; - buflen = GetFullPathName(correctPath.c_str(), buflen + 1, buffer, NULL); + buflen = GetFullPathName(correctPath.c_str(), buflen + 1, buffer, nullptr); std::string destPath = buffer; delete[] buffer; @@ -378,7 +378,7 @@ void Filename::verifyAndCreatePath(void) const destPath += splitDestPath[i]; if (SetCurrentDirectory(destPath.c_str()) == 0) { - if (CreateDirectory(destPath.c_str(), NULL) == 0) + if (CreateDirectory(destPath.c_str(), nullptr) == 0) return; if (SetCurrentDirectory(destPath.c_str()) == 0) return; diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/Filename.h b/engine/shared/library/sharedTemplateDefinition/src/shared/core/Filename.h index 62466a7a..a947e70d 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/Filename.h +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/Filename.h @@ -57,13 +57,13 @@ inline Filename::Filename(void) inline Filename::Filename(const char *drive, const char *path, const char *name, const char *extension) { - if (drive != NULL) + if (drive != nullptr) setDrive(drive); - if (path != NULL) + if (path != nullptr) setPath(path); - if (name != NULL) + if (name != nullptr) setName(name); - if (extension != NULL) + if (extension != nullptr) setExtension(extension); } // Filename::Filename @@ -115,7 +115,7 @@ inline void Filename::makeFullPath(void) //======================================================================== -const Filename NEXT_HIGHER_PATH(NULL, "..", NULL, NULL); +const Filename NEXT_HIGHER_PATH(nullptr, "..", nullptr, nullptr); #endif // _INCLUDED_Filename_H diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/ObjectTemplate.cpp b/engine/shared/library/sharedTemplateDefinition/src/shared/core/ObjectTemplate.cpp index 42def7d2..5492f6ec 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/ObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/ObjectTemplate.cpp @@ -16,8 +16,8 @@ //----------------------------------------------------------------- -template <> ObjectTemplateList::CreateDataResourceMap *ObjectTemplateList::ms_bindings = NULL; -template <> ObjectTemplateList::LoadedDataResourceMap *ObjectTemplateList::ms_loaded = NULL; +template <> ObjectTemplateList::CreateDataResourceMap *ObjectTemplateList::ms_bindings = nullptr; +template <> ObjectTemplateList::LoadedDataResourceMap *ObjectTemplateList::ms_loaded = nullptr; // ====================================================================== @@ -40,10 +40,10 @@ ObjectTemplate::ObjectTemplate(const std::string & filename) : ObjectTemplate::~ObjectTemplate(void) { - if (m_baseData != NULL) + if (m_baseData != nullptr) { m_baseData->releaseReference(); - m_baseData = NULL; + m_baseData = nullptr; } } @@ -63,7 +63,7 @@ void ObjectTemplate::load(Iff &iff) */ void ObjectTemplate::addReference(void) const { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->addReference(); DataResource::addReference(); @@ -76,7 +76,7 @@ void ObjectTemplate::addReference(void) const */ void ObjectTemplate::releaseReference(void) const { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); DataResource::releaseReference(); diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateData.cpp b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateData.cpp index a5974767..335347bc 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateData.cpp +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateData.cpp @@ -52,8 +52,8 @@ static const bool HasMinMax[] = // map enum ParamType to access function return value static const char * const PaddedDataMethodNames[] = { - NULL, - NULL, + nullptr, + nullptr, "int ", "float ", "bool ", @@ -62,25 +62,25 @@ static const char * const PaddedDataMethodNames[] = "const Vector & ", "void ", "const ObjectTemplate *", - NULL, - NULL, + nullptr, + nullptr, "const TriggerVolumeData &", "const std::string & " }; static const char * const UnpaddedDataMethodNames[] = { - NULL, - NULL, + nullptr, + nullptr, "int", "float", "bool", "const std::string &", "const StringId", "const Vector &", - NULL, + nullptr, "const ObjectTemplate *", - NULL, - NULL, + nullptr, + nullptr, "const TriggerVolumeData &", "const std::string &" }; @@ -88,8 +88,8 @@ static const char * const UnpaddedDataMethodNames[] = // map enum ParamType to struct storage type static const char * const PaddedDataStructNames[] = { - NULL, - NULL, + nullptr, + nullptr, "int ", "float ", "bool ", @@ -98,15 +98,15 @@ static const char * const PaddedDataStructNames[] = "Vector ", "DynamicVariableList ", "const ObjectTemplate *", - NULL, - NULL, + nullptr, + nullptr, "TriggerVolumeData ", "std::string " }; static const char * const UnpaddedDataStructNames[] = { - NULL, - NULL, + nullptr, + nullptr, "int", "float", "bool", @@ -115,8 +115,8 @@ static const char * const UnpaddedDataStructNames[] = "Vector", "DynamicVariableList", "const ObjectTemplate *", - NULL, - NULL, + nullptr, + nullptr, "TriggerVolumeData", "std::string" }; @@ -160,8 +160,8 @@ static const char * const CompilerDataVariableNames[] = static const char * const DefaultDataReturnValue[] = { - NULL, - NULL, + nullptr, + nullptr, "0", "0.0f", "false", @@ -169,7 +169,7 @@ static const char * const DefaultDataReturnValue[] = "DefaultStringId", "DefaultVector", "", - "NULL", + "nullptr", "(0)", "", "DefaultTriggerVolumeData", @@ -217,7 +217,7 @@ static const char * const EnumLocationNames[] = */ TemplateData::TemplateData(int version, const TemplateDefinitionFile &parent) : m_fileParent(&parent), - m_templateParent(NULL), + m_templateParent(nullptr), m_hasTemplateParam(false), m_hasDynamicVarParam(false), m_hasList(false), @@ -228,9 +228,9 @@ TemplateData::TemplateData(int version, const TemplateDefinitionFile &parent) : m_parseState(STATE_PARAM), m_parameters(), m_parameterMap(), - m_currentEnumList(NULL), + m_currentEnumList(nullptr), m_enumMap(), - m_currentStruct(NULL), + m_currentStruct(nullptr), m_structMap(), m_structList() { @@ -252,7 +252,7 @@ TemplateData::TemplateData(int version, const TemplateDefinitionFile &parent) : * @param name the structure's name */ TemplateData::TemplateData(const TemplateData *parent, const std::string &name) : - m_fileParent(NULL), + m_fileParent(nullptr), m_templateParent(parent), m_hasTemplateParam(false), m_hasDynamicVarParam(false), @@ -265,9 +265,9 @@ TemplateData::TemplateData(const TemplateData *parent, const std::string &name) m_parseState(STATE_PARAM), m_parameters(), m_parameterMap(), - m_currentEnumList(NULL), + m_currentEnumList(nullptr), m_enumMap(), - m_currentStruct(NULL), + m_currentStruct(nullptr), m_structMap(), m_structList() { @@ -284,15 +284,15 @@ TemplateData::~TemplateData() for (iter = m_structMap.begin(); iter != m_structMap.end(); ++iter) { delete (*iter).second; - (*iter).second = NULL; + (*iter).second = nullptr; } m_parameterMap.clear(); m_parameters.clear(); m_structMap.clear(); m_structList.clear(); - m_currentEnumList = NULL; - m_currentStruct = NULL; + m_currentEnumList = nullptr; + m_currentStruct = nullptr; } // TemplateData::~TemplateData @@ -306,9 +306,9 @@ TemplateData::~TemplateData() */ const std::string TemplateData::getName(void) const { - if (m_fileParent != NULL) + if (m_fileParent != nullptr) return m_fileParent->getTemplateName(); - if (m_templateParent != NULL) + if (m_templateParent != nullptr) return m_templateParent->getName() + "::_" + m_name; return ""; } @@ -320,9 +320,9 @@ const std::string TemplateData::getName(void) const */ const std::string TemplateData::getBaseName(void) const { - if (m_fileParent != NULL && !m_fileParent->getBaseName().empty()) + if (m_fileParent != nullptr && !m_fileParent->getBaseName().empty()) return m_fileParent->getBaseName(); -// if (m_templateParent != NULL) +// if (m_templateParent != nullptr) return m_baseName; // return ""; } @@ -334,9 +334,9 @@ const std::string TemplateData::getBaseName(void) const */ TemplateLocation TemplateData::getTemplateLocation(void) const { - if (m_fileParent != NULL) + if (m_fileParent != nullptr) return m_fileParent->getTemplateLocation(); - if (m_templateParent != NULL) + if (m_templateParent != nullptr) return m_templateParent->getTemplateLocation(); return LOC_NONE; } // TemplateData::getTemplateLocation @@ -359,8 +359,8 @@ const char * TemplateData::parseLine(const File &fp, const char *buffer, { ParamState paramState = STATE_LIST; - if (buffer == NULL || *buffer == '\0') - return NULL; + if (buffer == nullptr || *buffer == '\0') + return nullptr; const char *line = buffer; @@ -413,7 +413,7 @@ ParamState paramState = STATE_LIST; return CHAR_ERROR; } const EnumList * enumList = getEnumList(tokenbuf, true); - if (enumList != NULL) + if (enumList != nullptr) { fp.printError("enum already defined"); return CHAR_ERROR; @@ -421,7 +421,7 @@ ParamState paramState = STATE_LIST; m_currentEnumList = &(*m_enumMap.insert(std::make_pair( std::string(tokenbuf), EnumList())).first).second; m_parseState = STATE_ENUM; - if (line != NULL && *line != '\0') + if (line != nullptr && *line != '\0') return parseEnum(fp, line, tokenbuf); return line; } @@ -455,7 +455,7 @@ ParamState paramState = STATE_LIST; m_structMap.insert(std::make_pair(tokenbuf, m_currentStruct)); m_structList.push_back(m_currentStruct); m_parseState = STATE_STRUCT; - if (line != NULL && *line != '\0') + if (line != nullptr && *line != '\0') return parseStruct(fp, line, tokenbuf); return line; } @@ -463,7 +463,7 @@ ParamState paramState = STATE_LIST; return CHAR_ERROR; } // if we are a structure, the 1st item should be the structure id - else if (strcmp(tokenbuf, "id") == 0 && m_templateParent != NULL && + else if (strcmp(tokenbuf, "id") == 0 && m_templateParent != nullptr && m_structId.tag == NO_TAG) { line = getNextToken(line, tokenbuf); @@ -479,7 +479,7 @@ ParamState paramState = STATE_LIST; } // if we are a structure, the 1st item should be the structure id - if (m_templateParent != NULL && m_structId.tag == NO_TAG) + if (m_templateParent != nullptr && m_structId.tag == NO_TAG) { fp.printError("struct id not defined"); return CHAR_ERROR; @@ -508,7 +508,7 @@ ParamState paramState = STATE_LIST; parameter.list_type = LIST_ENUM_ARRAY; parameter.enum_list_name = &tokenbuf[8]; const EnumList * list = getEnumList(parameter.enum_list_name.c_str(), false); - if (list == NULL) + if (list == nullptr) { fp.printError("enum name not defined!"); return CHAR_ERROR; @@ -592,7 +592,7 @@ ParamState paramState = STATE_LIST; { parameter.type = TYPE_ENUM; parameter.extendedName = &tokenbuf[4]; - if (getEnumList(&tokenbuf[4], false) == NULL) + if (getEnumList(&tokenbuf[4], false) == nullptr) { std::string errbuf = "enum type " + parameter.extendedName + " not defined"; @@ -605,7 +605,7 @@ ParamState paramState = STATE_LIST; { parameter.type = TYPE_STRUCT; parameter.extendedName = &tokenbuf[6]; - if (getStruct(&tokenbuf[6]) == NULL) + if (getStruct(&tokenbuf[6]) == nullptr) { std::string errbuf = "struct " + parameter.extendedName + " not defined"; @@ -640,12 +640,12 @@ ParamState paramState = STATE_LIST; tempToken = getNextToken(tempToken, tempBuf); if (parameter.type == TYPE_INTEGER) { - parameter.min_int_limit = strtol(tempBuf, NULL, 10); + parameter.min_int_limit = strtol(tempBuf, nullptr, 10); } else { parameter.min_float_limit = static_cast( - strtod(tempBuf, NULL)); + strtod(tempBuf, nullptr)); } } if (*tempToken == '.' && *(tempToken + 1) == '.') @@ -682,7 +682,7 @@ ParamState paramState = STATE_LIST; } // anything left over in the line is the parameter description - if (line != NULL) + if (line != nullptr) parameter.description = line; m_parameters.push_back(parameter); @@ -714,12 +714,12 @@ int TemplateData::getEnumValue(const char * enumValue) const } } - if (m_templateParent != NULL) + if (m_templateParent != nullptr) return m_templateParent->getEnumValue(enumValue); - if (m_fileParent != NULL) + if (m_fileParent != nullptr) { const TemplateDefinitionFile * baseFile = m_fileParent->getBaseDefinitionFile(); - if (baseFile != NULL) + if (baseFile != nullptr) { return baseFile->getTemplateData(baseFile->getHighestVersion())-> getEnumValue(enumValue); @@ -742,7 +742,7 @@ int TemplateData::getEnumValue(const std::string & enumType, NOT_NULL(enumValue); const EnumList *elist = getEnumList(enumType.c_str(), false); - if (elist == NULL) + if (elist == nullptr) return INVALID_ENUM_RESULT; EnumList::const_iterator listIter; for (listIter = elist->begin(); listIter != elist->end(); ++listIter) @@ -760,7 +760,7 @@ int TemplateData::getEnumValue(const std::string & enumType, * @param name the enum list name * @param define flag that we are defining templates and should not look in base templates * - * @return the enum list definition, or NULL if not found + * @return the enum list definition, or nullptr if not found */ const TemplateData::EnumList * TemplateData::getEnumList(const std::string & name, bool define) const @@ -768,17 +768,17 @@ const TemplateData::EnumList * TemplateData::getEnumList(const std::string & nam EnumMap::const_iterator iter = m_enumMap.find(name); if (iter != m_enumMap.end()) return &(*iter).second; - if (m_templateParent != NULL) + if (m_templateParent != nullptr) return m_templateParent->getEnumList(name, define); - if (!define && m_fileParent != NULL && m_fileParent->getBaseDefinitionFile() != NULL) + if (!define && m_fileParent != nullptr && m_fileParent->getBaseDefinitionFile() != nullptr) { const TemplateData * baseData = m_fileParent->getBaseDefinitionFile()-> getTemplateData(m_fileParent->getBaseDefinitionFile()-> getHighestVersion()); - if (baseData != NULL) + if (baseData != nullptr) return baseData->getEnumList(name, define); } - return NULL; + return nullptr; } // TemplateData::getEnumList /** @@ -787,7 +787,7 @@ const TemplateData::EnumList * TemplateData::getEnumList(const std::string & nam * * @param name the enum list name * - * @return the struct definition, or NULL if not found + * @return the struct definition, or nullptr if not found */ const TemplateData * TemplateData::getStruct(const char *name) const { @@ -796,23 +796,23 @@ const TemplateData * TemplateData::getStruct(const char *name) const StructMap::const_iterator iter = m_structMap.find(name); if (iter != m_structMap.end()) return (*iter).second; - if (m_templateParent != NULL) + if (m_templateParent != nullptr) return m_templateParent->getStruct(name); - if (m_fileParent != NULL && m_fileParent->getBaseDefinitionFile() != NULL) + if (m_fileParent != nullptr && m_fileParent->getBaseDefinitionFile() != nullptr) { const TemplateData * baseData = m_fileParent->getBaseDefinitionFile()-> getTemplateData(m_fileParent->getBaseDefinitionFile()-> getHighestVersion()); - if (baseData != NULL) + if (baseData != nullptr) return baseData->getStruct(name); } - return NULL; + return nullptr; } // TemplateData::getStruct /** * Returns the tdf file for this TemplateData * - * @return the TemplateDefinitionFile, or NULL if not there + * @return the TemplateDefinitionFile, or nullptr if not there */ const TemplateDefinitionFile * TemplateData::getTdf() const @@ -823,7 +823,7 @@ const TemplateDefinitionFile * TemplateData::getTdf() const /** * Returns the tdf file for this TemplateData's first ancestor * - * @return the TemplateDefinitionFile, or NULL if not there + * @return the TemplateDefinitionFile, or nullptr if not there */ const TemplateDefinitionFile * TemplateData::getTdfParent() const @@ -834,19 +834,19 @@ const TemplateDefinitionFile * TemplateData::getTdfParent() const } else { - return NULL; + return nullptr; } } /** * Returns the tdf file that contains the parameter * - * @return the TemplateDefinitionFile, or NULL if not found + * @return the TemplateDefinitionFile, or nullptr if not found */ const TemplateDefinitionFile * TemplateData::getTdfForParameter(const char *parameterName) const { - if(m_fileParent != NULL) + if(m_fileParent != nullptr) { if(getParameter(parameterName)) { @@ -855,18 +855,18 @@ const TemplateDefinitionFile * TemplateData::getTdfForParameter(const char *para const TemplateDefinitionFile* ancestorTemplateDefinitionFile = m_fileParent->getBaseDefinitionFile(); - if(ancestorTemplateDefinitionFile != NULL) + if(ancestorTemplateDefinitionFile != nullptr) { const TemplateData *ancestorTemplateData = ancestorTemplateDefinitionFile->getTemplateData(ancestorTemplateDefinitionFile->getHighestVersion()); - if(ancestorTemplateData != NULL) + if(ancestorTemplateData != nullptr) { return ancestorTemplateData->getTdfForParameter(parameterName); } } } - return NULL; + return nullptr; } /** @@ -883,7 +883,7 @@ int TemplateData::parseIntValue(const File &fp, const char * line, const char ** char * intbuf) const { NOT_NULL(endLine); - if (line == NULL || *line == '\0' || intbuf == NULL) + if (line == nullptr || *line == '\0' || intbuf == nullptr) { fp.printError("bad value passed to TemplateData::parseIntValue"); *endLine = CHAR_ERROR; @@ -920,7 +920,7 @@ int TemplateData::parseIntValue(const File &fp, const char * line, const char ** *endLine = CHAR_ERROR; return 0; } - if (tempLine != NULL) + if (tempLine != nullptr) line = tempLine; else line += strlen(line); @@ -954,8 +954,8 @@ int TemplateData::parseIntValue(const File &fp, const char * line, const char ** strncpy(intbuf, startLine, line - startLine); intbuf[line - startLine] = '\0'; intbuf += strlen(intbuf); - if (line != NULL && *line == '\0') - *endLine = NULL; + if (line != nullptr && *line == '\0') + *endLine = nullptr; else *endLine = line; @@ -1010,7 +1010,7 @@ const char * TemplateData::parseEnum(const File &fp, const char *buffer, if (m_bracketCount == 1) { m_bracketCount = 0; - m_currentEnumList = NULL; + m_currentEnumList = nullptr; m_parseState = STATE_PARAM; return line; } @@ -1023,7 +1023,7 @@ const char * TemplateData::parseEnum(const File &fp, const char *buffer, EnumData enumData; enumData.name = tokenbuf; - if (line != NULL && *line == '=') + if (line != nullptr && *line == '=') { line = getNextToken(line, tokenbuf); @@ -1054,12 +1054,12 @@ const char * TemplateData::parseEnum(const File &fp, const char *buffer, enumData.value = m_currentEnumList->back().value + 1; } - if (line != NULL && *line == ',') + if (line != nullptr && *line == ',') line = getNextToken(line, tokenbuf); - if (line != NULL) + if (line != nullptr) { enumData.comment = line; - line = NULL; + line = nullptr; } m_currentEnumList->push_back(enumData); @@ -1103,7 +1103,7 @@ const char * TemplateData::parseStruct(const File &fp, const char *buffer, if (m_bracketCount == 1) { m_bracketCount = 0; - m_currentStruct = NULL; + m_currentStruct = nullptr; m_parseState = STATE_PARAM; return line; } @@ -1194,7 +1194,7 @@ char buffer[256]; else if (param.list_type == LIST_ENUM_ARRAY) { const EnumList * enumList = getEnumList(param.enum_list_name, false); - FATAL(enumList == NULL, ("Enum list %s missing", + FATAL(enumList == nullptr, ("Enum list %s missing", param.enum_list_name.c_str())); sprintf(buffer, "missing parameter %s[%s] from section " "@class %s", param.name.c_str(), enumList->at(i).name.c_str(), @@ -1280,10 +1280,10 @@ void TemplateData::setWriteForCompiler(bool flag) */ void TemplateData::writeRegisterTemplate(File &fp, const char * leadInChars) const { - if (m_fileParent != NULL) + if (m_fileParent != nullptr) fp.print("%s\n", TDF_INSTALL_BEGIN); - if (leadInChars != NULL) + if (leadInChars != nullptr) fp.print("%s", leadInChars); fp.print("%s::registerMe();\n", getName().c_str()); @@ -1296,7 +1296,7 @@ void TemplateData::writeRegisterTemplate(File &fp, const char * leadInChars) con subStruct->writeRegisterTemplate(fp, leadInChars); } - if (m_fileParent != NULL) + if (m_fileParent != nullptr) fp.print("%s\n", TDF_INSTALL_END); } // TemplateData::writeRegisterTemplate @@ -1338,7 +1338,7 @@ std::vector paramStrings; paramStrings.push_back(param.enum_list_name + " index"); break; } - if (m_templateParent != NULL) + if (m_templateParent != nullptr) paramStrings.push_back("bool versionOk"); if (param.list_type == LIST_NONE) { @@ -1420,7 +1420,7 @@ void TemplateData::getTemplateNames(std::set &names) const else if (param.type == TYPE_STRUCT) { const TemplateData * structData = getStruct(param.extendedName.c_str()); - if (structData != NULL) + if (structData != nullptr) structData->getTemplateNames(names); } } @@ -1439,7 +1439,7 @@ void TemplateData::writeHeaderParams(File &fp) const return; } - if (m_fileParent != NULL) + if (m_fileParent != nullptr) fp.print("%s\n", TDF_BEGIN); writeHeaderEnums(fp); @@ -1447,7 +1447,7 @@ void TemplateData::writeHeaderParams(File &fp) const writeHeaderMethods(fp); writeHeaderVariables(fp); - if (m_fileParent != NULL) + if (m_fileParent != nullptr) fp.print("%s\n", TDF_END); } // TemplateData::writeHeaderParams @@ -1461,7 +1461,7 @@ void TemplateData::writeCompilerHeaderParams(File &fp) const { DEBUG_FATAL(!m_writeForCompilerFlag, ("write for compiler not enabled")); - if (m_fileParent != NULL) + if (m_fileParent != nullptr) fp.print("%s\n", TDF_BEGIN); writeHeaderEnums(fp); @@ -1469,7 +1469,7 @@ void TemplateData::writeCompilerHeaderParams(File &fp) const writeCompilerHeaderMethods(fp); writeHeaderVariables(fp); - if (m_fileParent != NULL) + if (m_fileParent != nullptr) fp.print("%s\n", TDF_END); } // TemplateData::writeCompilerHeaderParams @@ -1883,7 +1883,7 @@ ParameterList::const_iterator iter; case LIST_NONE: case LIST_INT_ARRAY: case LIST_ENUM_ARRAY: - if (PaddedDataStructNames[param.type] != NULL) + if (PaddedDataStructNames[param.type] != nullptr) { fp.print("\t\t%s %s", PaddedDataStructNames[param.type], param.name.c_str()); @@ -1904,7 +1904,7 @@ ParameterList::const_iterator iter; break; case LIST_LIST: fp.print("\t\tstdvector<"); - if (UnpaddedDataStructNames[param.type] != NULL) + if (UnpaddedDataStructNames[param.type] != nullptr) fp.print("%s", UnpaddedDataStructNames[param.type]); else if (param.type == TYPE_ENUM) fp.print("enum %s", param.extendedName.c_str()); @@ -1953,7 +1953,7 @@ void TemplateData::writeSourceLoadedFlagInit(File &fp) const { ParameterList::const_iterator iter; - if (m_fileParent != NULL) + if (m_fileParent != nullptr) fp.print("%s\n", TDF_INIT_BEGIN); fp.print("\t: %s(filename)\n", getBaseName().c_str()); @@ -1968,13 +1968,13 @@ ParameterList::const_iterator iter; fp.print("m_%sLoaded(false)\n", param.name.c_str()); fp.print("\t,m_%sAppend(false)\n", param.name.c_str()); } - if (m_templateParent == NULL && !isWritingForCompiler()) + if (m_templateParent == nullptr && !isWritingForCompiler()) { fp.print("\t,"); fp.print("m_versionOk(true)\n"); } - if (m_fileParent != NULL) + if (m_fileParent != nullptr) fp.print("%s\n", TDF_INIT_END); } // TemplateData::writeSourceLoadedFlagInit @@ -1985,7 +1985,7 @@ ParameterList::const_iterator iter; */ void TemplateData::writeSourceStructStart(File &fp) const { - if (m_templateParent == NULL) + if (m_templateParent == nullptr) return; const std::string & templateNameString = getName(); @@ -2051,7 +2051,7 @@ void TemplateData::writeSourceStructStart(File &fp, const std::string &name) con { ParameterList::const_iterator iter; - if (m_templateParent == NULL || !m_hasTemplateParam) + if (m_templateParent == nullptr || !m_hasTemplateParam) return; std::string className = m_templateParent->getName() + "::" + name; @@ -2079,18 +2079,18 @@ ParameterList::const_iterator iter; switch (param.list_type) { case LIST_NONE: - fp.print("\t%s = NULL;\n", pname); + fp.print("\t%s = nullptr;\n", pname); break; case LIST_INT_ARRAY: fp.print("\tfor (int i = 0; i < %d; ++i)\n", param.list_size); fp.print("\t{\n"); - fp.print("\t\t%s[i] = NULL;\n", pname); + fp.print("\t\t%s[i] = nullptr;\n", pname); fp.print("\t}\n"); break; case LIST_ENUM_ARRAY: fp.print("\tfor (int i = 0; i < %d; ++i)\n", param.list_size); fp.print("\t{\n"); - fp.print("\t\t%s[static_cast<%s>(i)] = NULL;\n", pname, + fp.print("\t\t%s[static_cast<%s>(i)] = nullptr;\n", pname, param.enum_list_name.c_str()); fp.print("\t}\n"); break; @@ -2134,14 +2134,14 @@ ParameterList::const_iterator iter; switch (param.list_type) { case LIST_NONE: - fp.print("\tif (%s != NULL)\n", pname); + fp.print("\tif (%s != nullptr)\n", pname); fp.print("\t\tconst_cast(%s)->addReference();\n", pname); break; case LIST_INT_ARRAY: fp.print("\tfor (int i = 0; i < %d; ++i)\n", param.list_size); fp.print("\t{\n"); - fp.print("\t\tif (%s[i] != NULL)\n", pname); + fp.print("\t\tif (%s[i] != nullptr)\n", pname); fp.print("\t\t\tconst_cast(%s[i])->addReference" "();\n", pname); fp.print("\t}\n"); @@ -2149,7 +2149,7 @@ ParameterList::const_iterator iter; case LIST_ENUM_ARRAY: fp.print("\tfor (int i = 0; i < %d; ++i)\n", param.list_size); fp.print("\t{\n"); - fp.print("\t\tif (%s[static_cast<%s>(i)] != NULL)\n", pname, + fp.print("\t\tif (%s[static_cast<%s>(i)] != nullptr)\n", pname, param.enum_list_name.c_str()); fp.print("\t\t\tconst_cast(%s[static_cast<%s>" "(i)])->addReference();\n", pname, param.enum_list_name.c_str()); @@ -2182,10 +2182,10 @@ ParameterList::const_iterator iter; switch (param.list_type) { case LIST_NONE: - fp.print("\tif (%s != NULL)\n", pname); + fp.print("\tif (%s != nullptr)\n", pname); fp.print("\t{\n"); fp.print("\t\t%s->releaseReference();\n", pname); - fp.print("\t\t%s = NULL;\n", pname); + fp.print("\t\t%s = nullptr;\n", pname); fp.print("\t}\n"); break; case LIST_LIST: @@ -2198,23 +2198,23 @@ ParameterList::const_iterator iter; else fp.print("\tfor (int i = 0; i < %d; ++i)\n", param.list_size); fp.print("\t{\n"); - fp.print("\t\tif (%s[i] != NULL)\n", pname); + fp.print("\t\tif (%s[i] != nullptr)\n", pname); fp.print("\t\t{\n"); fp.print("\t\t\t%s[i]->releaseReference();\n", pname); - fp.print("\t\t\t%s[i] = NULL;\n", pname); + fp.print("\t\t\t%s[i] = nullptr;\n", pname); fp.print("\t\t}\n"); fp.print("\t}\n"); break; case LIST_ENUM_ARRAY: fp.print("\tfor (int i = 0; i < %d; ++i)\n", param.list_size); fp.print("\t{\n"); - fp.print("\t\tif (%s[static_cast<%s>(i)] != NULL)\n", pname, + fp.print("\t\tif (%s[static_cast<%s>(i)] != nullptr)\n", pname, param.enum_list_name.c_str()); fp.print("\t\t{\n"); fp.print("\t\t\t%s[static_cast<%s>(i)]->releaseReference();\n", pname, param.enum_list_name.c_str()); - fp.print("\t\t\t%s[static_cast<%s>(i)] = NULL;\n", pname, + fp.print("\t\t\t%s[static_cast<%s>(i)] = nullptr;\n", pname, param.enum_list_name.c_str()); fp.print("\t\t}\n"); fp.print("\t}\n"); @@ -2259,7 +2259,7 @@ int result; return 0; } - if (m_fileParent != NULL) + if (m_fileParent != nullptr) fp.print("%s\n", TDF_BEGIN); result = writeSourceGetData(fp); @@ -2282,7 +2282,7 @@ int result; return result; } - if (m_fileParent != NULL) + if (m_fileParent != nullptr) fp.print("%s\n", TDF_END); return 0; } // TemplateData::writeSourceMethods @@ -2297,7 +2297,7 @@ void TemplateData::writeCompilerSourceMethods(File &fp) const { DEBUG_FATAL(!m_writeForCompilerFlag, ("write for compiler not enabled")); - if (m_fileParent != NULL) + if (m_fileParent != nullptr) fp.print("%s\n", TDF_BEGIN); writeCompilerSourceAccessMethods(fp); @@ -2314,7 +2314,7 @@ void TemplateData::writeCompilerSourceMethods(File &fp) const subStruct->writeCompilerSourceMethods(fp); } - if (m_fileParent != NULL) + if (m_fileParent != nullptr) fp.print("%s\n", TDF_END); } // TemplateData::writeCompilerSourceMethods @@ -2355,7 +2355,7 @@ void TemplateData::writeSourceReturnBaseValue(File &fp, const Parameter ¶m, } else if (param.list_type != LIST_NONE) indexString = "index"; - if (m_templateParent != NULL) + if (m_templateParent != nullptr) { if (!indexString.empty()) indexString += ", "; @@ -2372,10 +2372,10 @@ void TemplateData::writeSourceReturnBaseValue(File &fp, const Parameter ¶m, fp.print("\tif (!m_%s[index].isLoaded())\n", param.name.c_str()); fp.print("\t{\n"); - if (DefaultDataReturnValue[param.type] != NULL) + if (DefaultDataReturnValue[param.type] != nullptr) { fp.print("\t\tif (ms_allowDefaultTemplateParams && " - "/*!%s &&*/ base == NULL)\n", m_templateParent == NULL ? "m_versionOk" : + "/*!%s &&*/ base == nullptr)\n", m_templateParent == nullptr ? "m_versionOk" : "versionOk"); fp.print("\t\t{\n"); fp.print("\t\t\tDEBUG_WARNING(true, (\"Returning default value for " @@ -2391,7 +2391,7 @@ void TemplateData::writeSourceReturnBaseValue(File &fp, const Parameter ¶m, fp.print("\t\t}\n"); fp.print("\t\telse\n"); fp.print("\t\t{\n"); - fp.print("\t\t\tDEBUG_FATAL(base == NULL, (\"Template parameter %s has " + fp.print("\t\t\tDEBUG_FATAL(base == nullptr, (\"Template parameter %s has " "not been defined in template %%s!\", DataResource::getName()));\n", param.name.c_str()); if (DefaultDataReturnValue[param.type][0] != '\0') @@ -2419,7 +2419,7 @@ void TemplateData::writeSourceReturnBaseValue(File &fp, const Parameter ¶m, // we need to get the base value instead of ours if (param.list_type == LIST_LIST) { - fp.print("\tif (m_%sAppend && base != NULL)\n", param.name.c_str()); + fp.print("\tif (m_%sAppend && base != nullptr)\n", param.name.c_str()); fp.print("\t{\n"); fp.print("\t\tint baseCount = base->get%sCount();\n", upperName.c_str()); @@ -2505,21 +2505,21 @@ int result; fp.print("{\n"); fp.print("\tif (!m_%sLoaded)\n", pname); fp.print("\t{\n"); - fp.print("\t\tif (m_baseData == NULL)\n"); + fp.print("\t\tif (m_baseData == nullptr)\n"); fp.print("\t\t\treturn 0;\n"); fp.print("\t\tconst %s * base = dynamic_cast" "(m_baseData);\n", templateName, templateName); - fp.print("\t\tDEBUG_FATAL(base == NULL, (\"base template wrong " + fp.print("\t\tDEBUG_FATAL(base == nullptr, (\"base template wrong " "type\"));\n"); fp.print("\t\treturn base->get%sCount();\n", upperName.c_str()); fp.print("\t}\n\n"); fp.print("\tsize_t count = m_%s.size();\n\n", pname); fp.print("\t// if we are extending our base template, add it's count\n"); - fp.print("\tif (m_%sAppend && m_baseData != NULL)\n", pname); + fp.print("\tif (m_%sAppend && m_baseData != nullptr)\n", pname); fp.print("\t{\n"); fp.print("\t\tconst %s * base = dynamic_cast(m_baseData);\n", templateName, templateName); - fp.print("\t\tif (base != NULL)\n"); + fp.print("\t\tif (base != nullptr)\n"); fp.print("\t\t\tcount += base->get%sCount();\n", upperName.c_str()); fp.print("\t}\n\n"); fp.print("\treturn count;\n"); @@ -2582,7 +2582,7 @@ void TemplateData::writeSourceTestData(File &fp) const } } - if (m_fileParent != NULL) + if (m_fileParent != nullptr) { // check the base class if (!getBaseName().empty() && getBaseName() != ROOT_TEMPLATE_NAME) @@ -2631,18 +2631,18 @@ void TemplateData::writeSourceGetGeneric(File &fp, const Parameter ¶m) const fp.print("#endif\n\n"); } - fp.print("\tconst %s * base = NULL;\n", templateName); - fp.print("\tif (m_baseData != NULL)\n"); + fp.print("\tconst %s * base = nullptr;\n", templateName); + fp.print("\tif (m_baseData != nullptr)\n"); fp.print("\t{\n"); fp.print("\t\tbase = dynamic_cast(m_baseData);\n", templateName); -// fp.print("\t\tDEBUG_FATAL(base == NULL, (\"base template wrong type\"));\n"); +// fp.print("\t\tDEBUG_FATAL(base == nullptr, (\"base template wrong type\"));\n"); if (param.list_type == LIST_NONE) { // get the test base value fp.print("#ifdef _DEBUG\n"); - fp.print("\t\tif (testData && base != NULL)\n"); + fp.print("\t\tif (testData && base != nullptr)\n"); fp.print("\t\t\ttestDataValue = base->get%s%s(true);\n", upperName.c_str(), MinMaxNames[i]); fp.print("#endif\n"); @@ -2651,7 +2651,7 @@ void TemplateData::writeSourceGetGeneric(File &fp, const Parameter ¶m) const fp.print("\t}\n\n"); const char *arrayIndex = ""; - std::string indexName = m_templateParent == NULL ? "" : "versionOk"; + std::string indexName = m_templateParent == nullptr ? "" : "versionOk"; const char *access = "."; if (param.list_type == LIST_NONE) { @@ -2689,9 +2689,9 @@ void TemplateData::writeSourceGetGeneric(File &fp, const Parameter ¶m) const fp.print("\tif (delta == '+' || delta == '-' || delta == '_' || delta == '=')\n"); fp.print("\t{\n"); fp.print("\t\t%s baseValue = 0;\n", UnpaddedDataMethodNames[param.type]); - fp.print("\t\tif (m_baseData != NULL)\n"); + fp.print("\t\tif (m_baseData != nullptr)\n"); fp.print("\t\t{\n"); - fp.print("\t\t\tif (base != NULL)\n"); + fp.print("\t\t\tif (base != nullptr)\n"); fp.print("\t\t\t\tbaseValue = base->get%s%s(%s);\n", upperName.c_str(), MinMaxNames[i], indexName.c_str()); fp.print("\t\t\telse if (ms_allowDefaultTemplateParams)\n"); @@ -2716,7 +2716,7 @@ void TemplateData::writeSourceGetGeneric(File &fp, const Parameter ¶m) const { // check the return value vs the base value, and warn if the same fp.print("#ifdef _DEBUG\n"); - fp.print("\tif (testData && base != NULL)\n"); + fp.print("\tif (testData && base != nullptr)\n"); fp.print("\t{\n"); // fp.print("\t\tif (testDataValue == value)\n"); // fp.print("\t\t\tDEBUG_WARNING(true, (\"Template %%s, parameter %s is " @@ -2758,12 +2758,12 @@ void TemplateData::writeSourceGetVector(File &fp, const Parameter ¶m) const fp.print(") const\n"); fp.print("{\n"); - fp.print("\tconst %s * base = NULL;\n", templateName); - fp.print("\tif (m_baseData != NULL)\n"); + fp.print("\tconst %s * base = nullptr;\n", templateName); + fp.print("\tif (m_baseData != nullptr)\n"); fp.print("\t{\n"); fp.print("\t\tbase = dynamic_cast(m_baseData);\n", templateName); -// fp.print("\t\tDEBUG_FATAL(base == NULL, (\"base template wrong type\"));\n"); +// fp.print("\t\tDEBUG_FATAL(base == nullptr, (\"base template wrong type\"));\n"); fp.print("\t}\n\n"); const char *arrayIndex = ""; @@ -2820,18 +2820,18 @@ void TemplateData::writeSourceGetDynamicVariable(File &fp, const Parameter ¶ fp.print(") const\n"); fp.print("{\n"); - fp.print("\tconst %s * base = NULL;\n", templateName); - fp.print("\tif (m_baseData != NULL)\n"); + fp.print("\tconst %s * base = nullptr;\n", templateName); + fp.print("\tif (m_baseData != nullptr)\n"); fp.print("\t{\n"); fp.print("\t\tbase = dynamic_cast(m_baseData);\n", templateName); -// fp.print("\t\tDEBUG_FATAL(base == NULL, (\"base template wrong type\"));\n"); +// fp.print("\t\tDEBUG_FATAL(base == nullptr, (\"base template wrong type\"));\n"); fp.print("\t}\n\n"); if (param.list_type == LIST_NONE) { writeSourceReturnBaseValue(fp, param, ""); - fp.print("\tif (m_%s.isExtendingBaseList() && base != NULL)\n", pname); + fp.print("\tif (m_%s.isExtendingBaseList() && base != nullptr)\n", pname); fp.print("\t\tbase->get%s(list);\n", upperName.c_str()); fp.print("\tm_%s.getDynamicVariableList(list);\n", pname); } @@ -2840,7 +2840,7 @@ void TemplateData::writeSourceGetDynamicVariable(File &fp, const Parameter ¶ fp.print("\tDEBUG_FATAL(index < 0 || index >= %d, (\"" "template param index out of range\"));\n", param.list_size); writeSourceReturnBaseValue(fp, param, ""); - fp.print("\tif (m_%s[index].isExtendingBaseList() && base != NULL)\n", pname); + fp.print("\tif (m_%s[index].isExtendingBaseList() && base != nullptr)\n", pname); fp.print("\t\tbase->get%s(list, index);\n", upperName.c_str()); fp.print("\tm_%s[index].getDynamicVariableList(list);\n", pname); } @@ -2872,19 +2872,19 @@ void TemplateData::writeSourceGetTemplate(File &fp, const Parameter ¶m) cons fp.print(") const\n"); fp.print("{\n"); - fp.print("\tconst %s * base = NULL;\n", templateName); - fp.print("\tif (m_baseData != NULL)\n"); + fp.print("\tconst %s * base = nullptr;\n", templateName); + fp.print("\tif (m_baseData != nullptr)\n"); fp.print("\t{\n"); fp.print("\t\tbase = dynamic_cast(m_baseData);\n", templateName); -// fp.print("\t\tDEBUG_FATAL(base == NULL, (\"base template wrong type\"));\n"); +// fp.print("\t\tDEBUG_FATAL(base == nullptr, (\"base template wrong type\"));\n"); fp.print("\t}\n\n"); if (param.list_type == LIST_NONE) { writeSourceReturnBaseValue(fp, param, ""); - fp.print("\tconst %s%s * returnValue = NULL;\n", + fp.print("\tconst %s%s * returnValue = nullptr;\n", EnumLocationTypes[getTemplateLocation()], filenameLowerToUpper(param.extendedName).c_str()); fp.print("\tconst std::string & templateName = m_%s.getValue();\n", pname); @@ -2894,7 +2894,7 @@ void TemplateData::writeSourceGetTemplate(File &fp, const Parameter ¶m) cons "ObjectTemplateList::fetch(templateName));\n", EnumLocationTypes[getTemplateLocation()], filenameLowerToUpper(param.extendedName).c_str()); - fp.print("\t\tif (returnValue == NULL)\n"); + fp.print("\t\tif (returnValue == nullptr)\n"); fp.print("\t\t\tWARNING_STRICT_FATAL(true, (\"Error loading template %%s\"," "templateName.c_str()));\n"); fp.print("\t}\n"); @@ -2918,7 +2918,7 @@ void TemplateData::writeSourceGetTemplate(File &fp, const Parameter ¶m) cons writeSourceReturnBaseValue(fp, param, ""); } - fp.print("\tconst %s%s * returnValue = NULL;\n", + fp.print("\tconst %s%s * returnValue = nullptr;\n", EnumLocationTypes[getTemplateLocation()], filenameLowerToUpper(param.extendedName).c_str()); fp.print("\tconst std::string & templateName = m_%s[index]%sgetValue();\n", @@ -2929,7 +2929,7 @@ void TemplateData::writeSourceGetTemplate(File &fp, const Parameter ¶m) cons "ObjectTemplateList::fetch(templateName));\n", EnumLocationTypes[getTemplateLocation()], filenameLowerToUpper(param.extendedName).c_str()); - fp.print("\t\tif (returnValue == NULL)\n"); + fp.print("\t\tif (returnValue == nullptr)\n"); fp.print("\t\t\tWARNING_STRICT_FATAL(true, (\"Error loading template %%s\"," "templateName.c_str()));\n"); fp.print("\t}\n"); @@ -2974,17 +2974,17 @@ void TemplateData::writeSourceGetEnum(File &fp, const Parameter ¶m) const fp.print("#endif\n\n"); } - fp.print("\tconst %s * base = NULL;\n", className); - fp.print("\tif (m_baseData != NULL)\n"); + fp.print("\tconst %s * base = nullptr;\n", className); + fp.print("\tif (m_baseData != nullptr)\n"); fp.print("\t{\n"); fp.print("\t\tbase = dynamic_cast(m_baseData);\n", className); -// fp.print("\t\tDEBUG_FATAL(base == NULL, (\"base template wrong type\"));\n"); +// fp.print("\t\tDEBUG_FATAL(base == nullptr, (\"base template wrong type\"));\n"); if (param.list_type == LIST_NONE) { // get the test base value fp.print("#ifdef _DEBUG\n"); - fp.print("\t\tif (testData && base != NULL)\n"); + fp.print("\t\tif (testData && base != nullptr)\n"); fp.print("\t\t\ttestDataValue = base->get%s(true);\n", upperName.c_str()); fp.print("#endif\n"); } @@ -2999,7 +2999,7 @@ void TemplateData::writeSourceGetEnum(File &fp, const Parameter ¶m) const // check the return value vs the base value, and warn if the same fp.print("#ifdef _DEBUG\n"); - fp.print("\tif (testData && base != NULL)\n"); + fp.print("\tif (testData && base != nullptr)\n"); fp.print("\t{\n"); // fp.print("\t\tif (testDataValue == value)\n"); // fp.print("\t\t\tDEBUG_WARNING(true, (\"Template %%s, parameter %s is " @@ -3061,11 +3061,11 @@ std::string upperName; fp.print(") const\n"); fp.print("{\n"); - fp.print("\tconst %s * base = NULL;\n", templateName); - fp.print("\tif (m_baseData != NULL)\n"); + fp.print("\tconst %s * base = nullptr;\n", templateName); + fp.print("\tif (m_baseData != nullptr)\n"); fp.print("\t{\n"); fp.print("\t\tbase = dynamic_cast(m_baseData);\n", templateName); -// fp.print("\t\tDEBUG_FATAL(base == NULL, (\"base template wrong type\"));\n"); +// fp.print("\t\tDEBUG_FATAL(base == nullptr, (\"base template wrong type\"));\n"); fp.print("\t}\n\n"); if (param.list_type == LIST_NONE) @@ -3100,7 +3100,7 @@ std::string upperName; fp.print("\tNOT_NULL(param);\n"); const TemplateData *structData = getStruct(param.extendedName.c_str()); - if (structData == NULL) + if (structData == nullptr) { fprintf(stderr, "unable to find structure %s\n", param.extendedName.c_str()); @@ -3108,7 +3108,7 @@ std::string upperName; } std::string versionString = "versionOk"; - if (m_templateParent == NULL) + if (m_templateParent == nullptr) versionString = "m_" + versionString; structData->writeSourceGetStructAssignments(fp, versionString, MinMaxNames[i]); @@ -3248,7 +3248,7 @@ void TemplateData::writeSourceReadIff(File &fp) const fp.print("char paramName[MAX_NAME_SIZE];\n"); fp.print("\n"); - if (m_fileParent != NULL) + if (m_fileParent != nullptr) { // check that we are in our form fp.print("\tif (file.getCurrentName() != %s_tag)\n", @@ -3277,14 +3277,14 @@ void TemplateData::writeSourceReadIff(File &fp) const // fp.print("\t\t%s * mybase = dynamic_cast<%s *>(base);\n", // templateName, templateName); - // fp.print("\t\tFATAL(mybase == NULL, (\"trying to derive a template from an incompatable template type\"));\n"); - fp.print("\t\tDEBUG_WARNING(base == NULL, (\"was unable to load base template %%s\", baseFilename.c_str()));\n"); - fp.print("\t\tif (m_baseData == base && base != NULL)\n"); + // fp.print("\t\tFATAL(mybase == nullptr, (\"trying to derive a template from an incompatable template type\"));\n"); + fp.print("\t\tDEBUG_WARNING(base == nullptr, (\"was unable to load base template %%s\", baseFilename.c_str()));\n"); + fp.print("\t\tif (m_baseData == base && base != nullptr)\n"); fp.print("\t\t\tbase->releaseReference();\n"); fp.print("\t\telse\n"); fp.print("\t\t{\n"); - fp.print("\t\t\tif (m_baseData != NULL)\n"); + fp.print("\t\t\tif (m_baseData != nullptr)\n"); fp.print("\t\t\t\tm_baseData->releaseReference();\n"); fp.print("\t\t\tm_baseData = base;\n"); @@ -3356,7 +3356,7 @@ void TemplateData::writeSourceReadIff(File &fp) const " ++iter)\n", param.name.c_str(), param.name.c_str()); fp.print("\t\t\t{\n"); fp.print("\t\t\t\tdelete *iter;\n"); - fp.print("\t\t\t\t*iter = NULL;\n"); + fp.print("\t\t\t\t*iter = nullptr;\n"); fp.print("\t\t\t}\n"); fp.print("\t\t\tm_%s.clear();\n", param.name.c_str()); fp.print("\t\t\tm_%sAppend = file.read_bool8();\n", param.name.c_str()); @@ -3408,7 +3408,7 @@ void TemplateData::writeSourceReadIff(File &fp) const fp.print("\n"); fp.print("\tfile.exitForm();\n"); - if (m_fileParent != NULL) + if (m_fileParent != nullptr) { // enter the next form if (!baseNameString.empty() && baseNameString != ROOT_TEMPLATE_NAME) @@ -3450,7 +3450,7 @@ void TemplateData::writeSourceWriteIff(File &fp) const fp.print("int count;\n\n"); // write form enter header stuff - if (m_fileParent != NULL) + if (m_fileParent != nullptr) { fp.print("\tfile.insertForm(%s_tag);\n", m_fileParent->getTemplateName().c_str()); @@ -3552,7 +3552,7 @@ void TemplateData::writeSourceWriteIff(File &fp) const fp.print("\n"); fp.print("\tfile.exitForm(true);\n"); - if (m_fileParent != NULL) + if (m_fileParent != nullptr) { // call base class write iff method if (!getBaseName().empty() && getBaseName() != ROOT_TEMPLATE_NAME) @@ -3576,7 +3576,7 @@ void TemplateData::writeSourceWriteIff(File &fp) const */ void TemplateData::writeSourceCleanup(File &fp) const { - if (m_fileParent != NULL) + if (m_fileParent != nullptr) fp.print("%s\n", TDF_CLEANUP_BEGIN); const char * const * variableNames = DataVariableNames; @@ -3613,7 +3613,7 @@ void TemplateData::writeSourceCleanup(File &fp) const " ++iter)\n", param.name.c_str(), param.name.c_str()); fp.print("\t\t{\n"); fp.print("\t\t\tdelete *iter;\n"); - fp.print("\t\t\t*iter = NULL;\n"); + fp.print("\t\t\t*iter = nullptr;\n"); fp.print("\t\t}\n"); fp.print("\t\tm_%s.clear();\n", param.name.c_str()); fp.print("\t}\n"); @@ -3624,7 +3624,7 @@ void TemplateData::writeSourceCleanup(File &fp) const } } - if (m_fileParent != NULL) + if (m_fileParent != nullptr) fp.print("%s\n", TDF_CLEANUP_END); } // TemplateData::writeSourceCleanup @@ -3719,9 +3719,9 @@ ParameterList::const_iterator iter; fp.print("\t\t{\n"); fp.print("\t\t\tif (deepCheck && !isParamLoaded(name, false, 0))\n"); fp.print("\t\t\t{\n"); - fp.print("\t\t\t\tif (getBaseTemplate() != NULL)\n"); + fp.print("\t\t\t\tif (getBaseTemplate() != nullptr)\n"); fp.print("\t\t\t\t\treturn getBaseTemplate()->get%s(name, deepCheck, index);\n", FUNC_NAMES[i]); - fp.print("\t\t\t\treturn NULL;\n"); + fp.print("\t\t\t\treturn nullptr;\n"); fp.print("\t\t\t}\n"); fp.print("\t\t\treturn &m_%s;\n", pname); fp.print("\t\t}\n"); @@ -3751,9 +3751,9 @@ ParameterList::const_iterator iter; fp.print("\t\t{\n"); fp.print("\t\t\tif (deepCheck && !isParamLoaded(name, false, index))\n"); fp.print("\t\t\t{\n"); - fp.print("\t\t\t\tif (getBaseTemplate() != NULL)\n"); + fp.print("\t\t\t\tif (getBaseTemplate() != nullptr)\n"); fp.print("\t\t\t\t\treturn getBaseTemplate()->get%s(name, deepCheck, index);\n", FUNC_NAMES[i]); - fp.print("\t\t\t\treturn NULL;\n"); + fp.print("\t\t\t\treturn nullptr;\n"); fp.print("\t\t\t}\n"); fp.print("\t\t\treturn &m_%s[index];\n", pname); fp.print("\t\t}\n"); @@ -3774,7 +3774,7 @@ ParameterList::const_iterator iter; fp.print("\treturn %s::get%s(name, deepCheck, index);\n", baseName, FUNC_NAMES[i]); } if (paramCount != 0) - fp.print("\treturn NULL;\n"); + fp.print("\treturn nullptr;\n"); fp.print("}\t//%s::get%s\n", templateName, FUNC_NAMES[i]); fp.print("\n"); } @@ -4227,7 +4227,7 @@ void TemplateData::writeParameterDefault(File &fp, const Parameter ¶m, int i case LIST_ENUM_ARRAY: { const EnumList * enumList = getEnumList(param.enum_list_name, false); - DEBUG_FATAL(enumList == NULL, ("unknown enum name %s", + DEBUG_FATAL(enumList == nullptr, ("unknown enum name %s", param.enum_list_name.c_str())); if (index >= 0 && index < param.list_size) @@ -4288,7 +4288,7 @@ void TemplateData::writeStructParameterDefault(File &fp, const Parameter ¶m, case LIST_ENUM_ARRAY: { const EnumList * enumList = getEnumList(param.enum_list_name, false); - DEBUG_FATAL(enumList == NULL, ("unknown enum name %s", + DEBUG_FATAL(enumList == nullptr, ("unknown enum name %s", param.enum_list_name.c_str())); EnumList::const_iterator listIter; @@ -4357,7 +4357,7 @@ void TemplateData::writeDefaultValue(File &fp, const Parameter ¶m) const case TYPE_ENUM: { const EnumList * enumList = getEnumList(param.extendedName, false); - DEBUG_FATAL(enumList == NULL, ("unknown enum name %s", + DEBUG_FATAL(enumList == nullptr, ("unknown enum name %s", param.extendedName.c_str())); fp.print("%s", enumList->at(0).name.c_str()); } @@ -4398,7 +4398,7 @@ const TemplateData::Parameter *TemplateData::getParameter( { NOT_NULL(name); - TemplateData::Parameter const *result = NULL; + TemplateData::Parameter const *result = nullptr; // Shallow check, just checks this immediate tdf @@ -4414,7 +4414,7 @@ const TemplateData::Parameter *TemplateData::getParameter( const TemplateDefinitionFile *TemplateDefinitionFile = getTdfForParameter(name); - if (TemplateDefinitionFile != NULL) + if (TemplateDefinitionFile != nullptr) { result = TemplateDefinitionFile->getTemplateData(TemplateDefinitionFile->getHighestVersion())->getParameter(name); } diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateData.h b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateData.h index cac38cd7..f7949388 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateData.h +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateData.h @@ -238,11 +238,11 @@ inline bool TemplateData::isWritingForCompiler(void) const inline const TemplateDefinitionFile * TemplateData::getFileParent(void) const { - if (m_fileParent != NULL) + if (m_fileParent != nullptr) return m_fileParent; - if (m_templateParent != NULL) + if (m_templateParent != nullptr) return m_templateParent->getFileParent(); - return NULL; + return nullptr; } // TemplateData::getFileParent diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateDataIterator.cpp b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateDataIterator.cpp index 11b8d2dd..5a5c1c48 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateDataIterator.cpp +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateDataIterator.cpp @@ -25,7 +25,7 @@ //----------------------------------------------------------------------------- TemplateDataIterator::TemplateDataIterator() -: m_templateDataToIterate(NULL), +: m_templateDataToIterate(nullptr), m_numItems(0), m_noMoreData(true) { @@ -34,7 +34,7 @@ TemplateDataIterator::TemplateDataIterator() //----------------------------------------------------------------------------- TemplateDataIterator::TemplateDataIterator(const TemplateData& templateData) -: m_templateDataToIterate(NULL), +: m_templateDataToIterate(nullptr), m_numItems(0), m_noMoreData(true) { @@ -45,7 +45,7 @@ TemplateDataIterator::TemplateDataIterator(const TemplateData& templateData) TemplateDataIterator::~TemplateDataIterator() { - m_templateDataToIterate = NULL; + m_templateDataToIterate = nullptr; } //----------------------------------------------------------------------------- @@ -62,7 +62,7 @@ TemplateDataIterator::setTo(const TemplateData &templateData) // .. end at the child TDF's. const ParameterList* parameterListToAdd; - while(m_templateDataToIterate != NULL) + while(m_templateDataToIterate != nullptr) { parameterListToAdd = &(m_templateDataToIterate->m_parameters); m_numItems += parameterListToAdd->size(); @@ -75,23 +75,23 @@ TemplateDataIterator::setTo(const TemplateData &templateData) } // Get the template data from the parent TDF - if(m_templateDataToIterate->m_fileParent != NULL) + if(m_templateDataToIterate->m_fileParent != nullptr) { const TemplateDefinitionFile* parentFile = m_templateDataToIterate->m_fileParent->getBaseDefinitionFile(); - if(parentFile != NULL) + if(parentFile != nullptr) { m_templateDataToIterate = parentFile->getTemplateData(parentFile->getHighestVersion()); } else { - m_templateDataToIterate = NULL; + m_templateDataToIterate = nullptr; } } else { - m_templateDataToIterate = NULL; + m_templateDataToIterate = nullptr; } } @@ -164,7 +164,7 @@ TemplateDataIterator::operator *() const { if(this->end()) { - return NULL; + return nullptr; } else { diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateDefinitionFile.cpp b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateDefinitionFile.cpp index f191b3fb..4025ab5f 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateDefinitionFile.cpp +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateDefinitionFile.cpp @@ -20,9 +20,9 @@ * Class constructor. */ TemplateDefinitionFile::TemplateDefinitionFile(void) : - m_baseDefinitionFile(NULL), + m_baseDefinitionFile(nullptr), m_writeForCompilerFlag(false), - m_filterCompiledRegex(NULL) + m_filterCompiledRegex(nullptr) { cleanup(); } // TemplateDefinitionFile::TemplateDefinitionFile @@ -51,24 +51,24 @@ void TemplateDefinitionFile::cleanup(void) m_compilerPath.clear(); m_fileComments.clear(); - if (m_baseDefinitionFile != NULL) + if (m_baseDefinitionFile != nullptr) { delete m_baseDefinitionFile; - m_baseDefinitionFile = NULL; + m_baseDefinitionFile = nullptr; } std::map::iterator iter; for (iter = m_templateMap.begin(); iter != m_templateMap.end(); ++iter) { delete (*iter).second; - (*iter).second = NULL; + (*iter).second = nullptr; } m_templateMap.clear(); - if (m_filterCompiledRegex != NULL) + if (m_filterCompiledRegex != nullptr) { RegexServices::freeMemory(m_filterCompiledRegex); - m_filterCompiledRegex = NULL; + m_filterCompiledRegex = nullptr; } } // TemplateDefinitionFile::cleanup @@ -104,7 +104,7 @@ static const std::string wildcard = "*"; if (!m_templateNameFilter.empty()) return m_templateNameFilter; - if (m_baseDefinitionFile != NULL) + if (m_baseDefinitionFile != nullptr) return m_baseDefinitionFile->getTemplateNameFilter(); return wildcard; @@ -121,7 +121,7 @@ bool TemplateDefinitionFile::isValidTemplateName(const Filename & name) const { if (m_templateNameFilter.empty()) { - if (m_baseDefinitionFile != NULL) + if (m_baseDefinitionFile != nullptr) return m_baseDefinitionFile->isValidTemplateName(name); else return true; @@ -131,7 +131,7 @@ bool TemplateDefinitionFile::isValidTemplateName(const Filename & name) const int const matchDataElementCount = maxCaptureCount * 3; int matchData[matchDataElementCount]; - int const matchCode = pcre_exec(m_filterCompiledRegex, NULL, name.getName().c_str(), name.getName().length(), 0, 0, matchData, matchDataElementCount); + int const matchCode = pcre_exec(m_filterCompiledRegex, nullptr, name.getName().c_str(), name.getName().length(), 0, 0, matchData, matchDataElementCount); bool const result = (matchCode >= 0); if (matchCode < -1) @@ -425,10 +425,10 @@ void TemplateDefinitionFile::writeClassSourceBegin(File &fp, const TemplateData fp.print(" */\n"); fp.print("Tag %s::getHighestTemplateVersion(void) const\n", name); fp.print("{\n"); - fp.print("\tif (m_baseData == NULL)\n"); + fp.print("\tif (m_baseData == nullptr)\n"); fp.print("\t\treturn m_templateVersion;\n"); fp.print("\tconst %s * base = dynamic_cast(m_baseData);\n", name, name); - fp.print("\tif (base == NULL)\n"); + fp.print("\tif (base == nullptr)\n"); fp.print("\t\treturn m_templateVersion;\n"); fp.print("\treturn std::max(m_templateVersion, base->getHighestTemplateVersion());\n"); fp.print("} // %s::getHighestTemplateVersion\n", name); @@ -449,7 +449,7 @@ static const int BUFFER_SIZE = 1024; int lineLen; char buffer[BUFFER_SIZE]; char token[BUFFER_SIZE]; -TemplateData *currentTemplate = NULL; +TemplateData *currentTemplate = nullptr; cleanup(); @@ -510,7 +510,7 @@ TemplateData *currentTemplate = NULL; currentTemplate = new TemplateData(version, *this); m_templateMap[version] = currentTemplate; } - else if (currentTemplate != NULL) + else if (currentTemplate != nullptr) { line = currentTemplate->parseLine(fp, buffer, token); if (line == CHAR_ERROR) @@ -540,7 +540,7 @@ TemplateData *currentTemplate = NULL; fp.printError("unable to open base template definition"); return -1; } - if (m_baseDefinitionFile == NULL) + if (m_baseDefinitionFile == nullptr) m_baseDefinitionFile = new TemplateDefinitionFile; else m_baseDefinitionFile->cleanup(); @@ -570,19 +570,19 @@ TemplateData *currentTemplate = NULL; m_templateNameFilter = token; //-- Attempt to compile the regex. - if (m_filterCompiledRegex != NULL) + if (m_filterCompiledRegex != nullptr) { // First free the existing compiled regex. RegexServices::freeMemory(m_filterCompiledRegex); - m_filterCompiledRegex = NULL; + m_filterCompiledRegex = nullptr; } //-- Compile the new regex. - char const *errorString = NULL; + char const *errorString = nullptr; int errorOffset = 0; - m_filterCompiledRegex = pcre_compile(m_templateNameFilter.c_str(), 0, &errorString, &errorOffset, NULL); - WARNING(m_filterCompiledRegex == NULL, ("TemplateDefinitionFile::parse(): pcre_compile() failed, error=[%s], errorOffset=[%d], regex text=[%s].", errorString, errorOffset, m_templateNameFilter.c_str())); + m_filterCompiledRegex = pcre_compile(m_templateNameFilter.c_str(), 0, &errorString, &errorOffset, nullptr); + WARNING(m_filterCompiledRegex == nullptr, ("TemplateDefinitionFile::parse(): pcre_compile() failed, error=[%s], errorOffset=[%d], regex text=[%s].", errorString, errorOffset, m_templateNameFilter.c_str())); } else if (strcmp(token, "clientpath") == 0 || strcmp(token, "serverpath") == 0 || diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateDefinitionFile.h b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateDefinitionFile.h index 82487e67..2ea426fc 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateDefinitionFile.h +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateDefinitionFile.h @@ -111,7 +111,7 @@ inline TemplateData *TemplateDefinitionFile::getTemplateData(int version) const { std::map::const_iterator iter = m_templateMap.find(version); if (iter == m_templateMap.end()) - return NULL; + return nullptr; return (*iter).second; } diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateGlobals.cpp b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateGlobals.cpp index 2b376aa0..b12dc5ef 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateGlobals.cpp +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateGlobals.cpp @@ -57,15 +57,15 @@ int strip(char *buffer) * the size of buffer * * @return the next non-whitespace character in the string after the token, or - * NULL if the end of line has been reached + * nullptr if the end of line has been reached */ const char *getNextWhitespaceToken(const char *buffer, char *token) { NOT_NULL(token); *token = '\0'; - if (buffer == NULL) - return NULL; + if (buffer == nullptr) + return nullptr; const char *from = buffer; char *to = token; @@ -74,7 +74,7 @@ const char *getNextWhitespaceToken(const char *buffer, char *token) while (isspace(*from) && *from != '\0') ++from; if (*from == '\0') - return NULL; + return nullptr; // copy the token while (!isspace(*from) && *from != '\0') @@ -85,7 +85,7 @@ const char *getNextWhitespaceToken(const char *buffer, char *token) while (isspace(*from) && *from != '\0') ++from; if (*from == '\0') - return NULL; + return nullptr; return from; } // getNextWhitespaceToken @@ -97,20 +97,20 @@ const char *getNextWhitespaceToken(const char *buffer, char *token) * the size of buffer * * @return the next token, defined by the 1st non-whitespace character in buffer: - * if it is '/' and the next character is '/', NULL + * if it is '/' and the next character is '/', nullptr * if it is a double-quote, the text until the next double quote (not including \") * if it is a symbol, the symbol * if it is a number, the next characters that make a valid integer or float * if it is a character, the text until the next whitespace or symbol, not including _ - * if it is NULL, NULL + * if it is nullptr, nullptr */ const char *getNextToken(const char *buffer, char *token) { NOT_NULL(token); *token = '\0'; - if (buffer == NULL) - return NULL; + if (buffer == nullptr) + return nullptr; const char *from = buffer; char *to = token; @@ -119,12 +119,12 @@ const char *getNextToken(const char *buffer, char *token) while (isspace(*from) && *from != '\0') ++from; if (*from == '\0') - return NULL; + return nullptr; if (*from == '/' && *(from+1) == '/') { // comment - return NULL; + return nullptr; } else if (isdigit(*from) || ((*from == '+' || *from == '-') && isdigit(*(from + 1))) @@ -173,7 +173,7 @@ const char *getNextToken(const char *buffer, char *token) while (isspace(*from) && *from != '\0') ++from; if (*from == '\0') - return NULL; + return nullptr; return from; } // getNextToken @@ -247,9 +247,9 @@ std::string filenameUpperToLower(const std::string & filename) std::string concatPaths(const char *path1, const char *path2) { // test for missing path - if (path1 == NULL || *path1 == '\0') + if (path1 == nullptr || *path1 == '\0') return path2; - if (path2 == NULL || *path2 == '\0') + if (path2 == nullptr || *path2 == '\0') return path1; #ifdef WIN32 @@ -286,7 +286,7 @@ std::string getNextHighestPath(const char *path) // find the two highest path separators const char *separator1 = strrchr(path, PATH_SEPARATOR); - if (separator1 == NULL) + if (separator1 == nullptr) { #ifdef WIN32 if (isalpha(*path) && *(path + 1) == ':') @@ -304,7 +304,7 @@ std::string getNextHighestPath(const char *path) return std::string(path, 3); #endif const char *separator2 = strrchr(separator1 - 1, PATH_SEPARATOR); - if (separator2 == NULL) + if (separator2 == nullptr) return std::string(path, separator1 - path); return std::string(path, separator2 - path); diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TpfFile.cpp b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TpfFile.cpp index 425bf716..23b456d5 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TpfFile.cpp +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TpfFile.cpp @@ -27,12 +27,12 @@ * Class constructor. */ TpfFile::TpfFile(void) : - m_template(NULL), + m_template(nullptr), m_baseTemplateName(), - m_currTemplateDef(NULL), - m_templateData(NULL), - m_highestTemplateData(NULL), - m_parameter(NULL), + m_currTemplateDef(nullptr), + m_templateData(nullptr), + m_highestTemplateData(nullptr), + m_parameter(nullptr), m_path(), m_iffPath(), m_templateLocation(LOC_NONE) @@ -53,14 +53,14 @@ TpfFile::~TpfFile() */ void TpfFile::cleanup(void) { - m_parameter = NULL; + m_parameter = nullptr; m_fp.close(); - if (m_template != NULL) + if (m_template != nullptr) { delete m_template; - m_template = NULL; + m_template = nullptr; } - m_currTemplateDef = NULL; + m_currTemplateDef = nullptr; IGNORE_RETURN(m_baseTemplateName.erase()); } // TpfFile::cleanup @@ -174,7 +174,7 @@ int TpfFile::loadTemplate(const Filename & filename) if (lineLen == -1) { // if we are a base template, check for missing parameters - if (m_highestTemplateData != NULL && m_template != NULL && + if (m_highestTemplateData != nullptr && m_template != nullptr && !m_highestTemplateData->verifyTemplate(m_template, m_fp)) { result = -1; @@ -190,7 +190,7 @@ int TpfFile::loadTemplate(const Filename & filename) // parse the 1st token: comment, @flag, or variable name const char *line = m_buffer; line = getNextToken(line, m_token); - if (*m_token == '\0' && line == NULL) + if (*m_token == '\0' && line == nullptr) { // empty line or comment continue; @@ -201,7 +201,7 @@ int TpfFile::loadTemplate(const Filename & filename) } else if (isalpha(*m_token)) { - if (m_template == NULL) + if (m_template == nullptr) { m_fp.printError("unable to parse parameters, no template class defined"); return -1; @@ -209,7 +209,7 @@ int TpfFile::loadTemplate(const Filename & filename) line = parseAssignment(line); if (line == CHAR_ERROR) result = -1; - else if (line != NULL) + else if (line != nullptr) { char buffer[1024]; if (getNextToken(line, buffer)) @@ -261,7 +261,7 @@ int TpfFile::makeIffFiles(const Filename & filename) if (result != 0) return result; - Filename iffname(NULL, m_iffPath.c_str(), filename.getName().c_str(), + Filename iffname(nullptr, m_iffPath.c_str(), filename.getName().c_str(), IFF_EXTENSION); Iff iffFile(1024, true, true); m_template->save(iffFile); @@ -291,20 +291,20 @@ int TpfFile::WriteIffFile(Iff & iffData, const Filename & fileName) { // there are problems with long path names in Windows that changing to // the directory seems to fix - char *buffer = NULL; + char *buffer = nullptr; DWORD buflen; // get our current path - buflen = GetFullPathName(".", 0, buffer, NULL); + buflen = GetFullPathName(".", 0, buffer, nullptr); buffer = new char[buflen + 1]; - buflen = GetFullPathName(".", buflen + 1, buffer, NULL); + buflen = GetFullPathName(".", buflen + 1, buffer, nullptr); Unicode::String srcPath = Unicode::narrowToWide(buffer); delete[] buffer; srcPath = L"\\\\?\\" + srcPath; // get the destination path std::string correctPath(fileName.getDrive() + fileName.getPath()); - buflen = GetFullPathName(correctPath.c_str(), 0, buffer, NULL); + buflen = GetFullPathName(correctPath.c_str(), 0, buffer, nullptr); buffer = new char[buflen + 1]; - buflen = GetFullPathName(correctPath.c_str(), buflen + 1, buffer, NULL); + buflen = GetFullPathName(correctPath.c_str(), buflen + 1, buffer, nullptr); Unicode::String destPath = Unicode::narrowToWide(buffer); delete[] buffer; destPath = L"\\\\?\\" + destPath; @@ -323,18 +323,18 @@ int TpfFile::WriteIffFile(Iff & iffData, const Filename & fileName) } else { - char *buffer = NULL; + char *buffer = nullptr; DWORD buflen; // get our current path - buflen = GetFullPathName(".", 0, buffer, NULL); + buflen = GetFullPathName(".", 0, buffer, nullptr); buffer = new char[buflen + 1]; - buflen = GetFullPathName(".", buflen + 1, buffer, NULL); + buflen = GetFullPathName(".", buflen + 1, buffer, nullptr); delete[] buffer; // get the destination path std::string correctPath(fileName.getDrive() + fileName.getPath()); - buflen = GetFullPathName(correctPath.c_str(), 0, buffer, NULL); + buflen = GetFullPathName(correctPath.c_str(), 0, buffer, nullptr); buffer = new char[buflen + 1]; - buflen = GetFullPathName(correctPath.c_str(), buflen + 1, buffer, NULL); + buflen = GetFullPathName(correctPath.c_str(), buflen + 1, buffer, nullptr); std::string destPath = buffer; delete[] buffer; // change to the destination path @@ -389,7 +389,7 @@ int result = 0; cleanup(); File temp_fp; - if (!temp_fp.open(tmpnam(NULL), "wt")) + if (!temp_fp.open(tmpnam(nullptr), "wt")) { fprintf(stderr, "error opening temp file for template replacement\n"); return -1; @@ -419,7 +419,7 @@ int result = 0; // parse the 1st token: comment, @flag, or variable name const char *line = m_buffer; line = getNextToken(line, m_token); - if (*m_token == '\0' && line == NULL) + if (*m_token == '\0' && line == nullptr) { // empty line or comment if (temp_fp.puts(m_buffer) < 0) @@ -432,7 +432,7 @@ int result = 0; { // @base or @class const char *templine = getNextToken(line, m_token); - if (templine == NULL) + if (templine == nullptr) { m_fp.printEolError(); return -1; @@ -452,7 +452,7 @@ int result = 0; else { // if we are a base template, check for missing parameters - if (m_highestTemplateData != NULL && m_template != NULL) + if (m_highestTemplateData != nullptr && m_template != nullptr) { m_highestTemplateData->updateTemplate(m_template, temp_fp); } @@ -462,7 +462,7 @@ int result = 0; else if (isalpha(*m_token)) { m_parameter = m_templateData->getParameter(m_token); - if (m_parameter == NULL) + if (m_parameter == nullptr) { } else @@ -494,14 +494,14 @@ int result = 0; int TpfFile::parseTemplateCommand(const char *line) { line = getNextToken(line, m_token); - if (line == NULL) + if (line == nullptr) { m_fp.printEolError(); return -1; } if (strcmp(m_token, "base") == 0) { - if (m_template != NULL && !m_template->getBaseTemplateName().empty()) + if (m_template != nullptr && !m_template->getBaseTemplateName().empty()) { m_fp.printError("base template already defined"); return -1; @@ -509,7 +509,7 @@ int TpfFile::parseTemplateCommand(const char *line) line = getNextWhitespaceToken(line, m_token); if (isalpha(*m_token)) { - if (m_template != NULL) + if (m_template != nullptr) { if (m_template->setBaseTemplateName(m_token) != 0) { @@ -536,7 +536,7 @@ int TpfFile::parseTemplateCommand(const char *line) { // if we are a base template, check for missing parameters // @todo: fix so we can verify non-base templates - if (m_highestTemplateData != NULL && m_template != NULL && + if (m_highestTemplateData != nullptr && m_template != nullptr && !m_highestTemplateData->verifyTemplate(m_template, m_fp)) { return -1; @@ -564,7 +564,7 @@ int TpfFile::parseTemplateCommand(const char *line) } int result = 0; - if(m_currTemplateDef == NULL) + if(m_currTemplateDef == nullptr) { result = m_templateDef.parse(fp); m_currTemplateDef = &m_templateDef; @@ -579,7 +579,7 @@ int TpfFile::parseTemplateCommand(const char *line) while(lookingForMatchingData) { - if(templateDataChild == NULL) // DHERMAN Check here for template definition names not matching + if(templateDataChild == nullptr) // DHERMAN Check here for template definition names not matching { char errbuf[256]; @@ -618,7 +618,7 @@ int TpfFile::parseTemplateCommand(const char *line) int version = static_cast(atol(m_token)); m_templateData = m_currTemplateDef->getTemplateData(version); - if (m_templateData == NULL) + if (m_templateData == nullptr) { char errbuf[256]; sprintf(errbuf, "can't find version %d in template definition %s", @@ -634,14 +634,14 @@ int TpfFile::parseTemplateCommand(const char *line) return -1; } - if (m_template == NULL) + if (m_template == nullptr) { // this is the highest class level, make a blank template // with it const TagInfo & templateId = m_currTemplateDef->getTemplateId(); m_template = dynamic_cast(TpfTemplate::createTemplate( templateId.tag)); - if (m_template == NULL) + if (m_template == nullptr) { m_fp.printError("Unable to create template class. May not be installed."); return -1; @@ -708,12 +708,12 @@ enum PARSE_ENUM_ASSIGNMENT, PARSE_ENUM_VALUE } parseState = PARSE_ENUM_TOKEN; -TemplateData::EnumList * enumList = NULL; // current list being defined -TemplateData::EnumData * enumData = NULL; // current item being defined +TemplateData::EnumList * enumList = nullptr; // current list being defined +TemplateData::EnumData * enumData = nullptr; // current item being defined int currentEnumValue = 0; File fp; - Filename headerFilename(NULL, NULL, headerName, NULL); + Filename headerFilename(nullptr, nullptr, headerName, nullptr); int i = 0; while (!fp.exists(headerFilename) && i < MAX_DIRECTORY_DEPTH) { @@ -744,7 +744,7 @@ int currentEnumValue = 0; } const char * line = m_buffer; - while (line != NULL) + while (line != nullptr) { const char * templine = getNextToken(line, m_token); switch (parseState) @@ -788,7 +788,7 @@ int currentEnumValue = 0; case PARSE_END_BRACKET : if (*m_token == '}') { - enumList = NULL; + enumList = nullptr; parseState = PARSE_ENUM_TOKEN; } else @@ -798,7 +798,7 @@ int currentEnumValue = 0; } break; case PARSE_ENUM_DEF: - if (isalpha(*m_token) && enumList != NULL) + if (isalpha(*m_token) && enumList != nullptr) { enumList->push_back(TemplateData::EnumData()); enumData = &enumList->back(); @@ -815,7 +815,7 @@ int currentEnumValue = 0; { enumData->value = currentEnumValue++; templine = line; - enumData = NULL; + enumData = nullptr; parseState = PARSE_END_BRACKET; } break; @@ -838,7 +838,7 @@ int currentEnumValue = 0; } currentEnumValue = (*iter).value; enumData->value = currentEnumValue++; - enumData = NULL; + enumData = nullptr; parseState = PARSE_END_BRACKET; } else @@ -895,7 +895,7 @@ const char * TpfFile::parseAssignment(const char *line) // get the parameter type info m_parameter = m_templateData->getParameter(m_token); - if (m_parameter == NULL) + if (m_parameter == nullptr) { std::string errmsg = "cannot find parameter "; errmsg += m_token; @@ -915,7 +915,7 @@ const char * TpfFile::parseAssignment(const char *line) m_fp.printError("non-array parameter being assigned as array"); return CHAR_ERROR; } - if (line == NULL) + if (line == nullptr) { // we need to read the next line to continue parsing line = goToNextLine(); @@ -943,7 +943,7 @@ const char * TpfFile::parseAssignment(const char *line) } // check for the ending ] line = getNextToken(line, m_token); - if (line == NULL) + if (line == nullptr) { m_fp.printEolError(); return CHAR_ERROR; @@ -954,13 +954,13 @@ const char * TpfFile::parseAssignment(const char *line) return CHAR_ERROR; } line = getNextToken(line, m_token); - if (line == NULL) + if (line == nullptr) { m_fp.printEolError(); return CHAR_ERROR; } } - else if (line == NULL) + else if (line == nullptr) { m_fp.printEolError(); return CHAR_ERROR; @@ -1038,7 +1038,7 @@ const char * TpfFile::parseAssignment(const char *line) * @param param template parameter * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or NULL if at eol, or -1 if + * @return character in line where parsing stopped, or nullptr if at eol, or -1 if * error */ const char * TpfFile::parseIntegerParameter(CompilerIntegerParam & param, const char *line) @@ -1064,7 +1064,7 @@ const char * TpfFile::parseIntegerParameter(CompilerIntegerParam & param, const if (line == CHAR_ERROR) return CHAR_ERROR; - if (line != NULL && *line == 'd') + if (line != nullptr && *line == 'd') { // rolling die int base = 0; @@ -1115,7 +1115,7 @@ const char * TpfFile::parseIntegerParameter(CompilerIntegerParam & param, const } param.setValue(num_dice, num_sides, base); } - else if (line != NULL && *line == '.' && *(line+1) == '.') + else if (line != nullptr && *line == '.' && *(line+1) == '.') { // range int min_value = value; @@ -1168,7 +1168,7 @@ const char * TpfFile::parseIntegerParameter(CompilerIntegerParam & param, const tempLine = m_token; char tempBuffer[64]; std::vector enumList; - while (tempLine != NULL) + while (tempLine != nullptr) { tempLine = getNextToken(tempLine, tempBuffer); if (isalpha(*tempBuffer)) @@ -1178,7 +1178,7 @@ const char * TpfFile::parseIntegerParameter(CompilerIntegerParam & param, const } } } - else if (*m_token == '.' && tempLine != NULL && *tempLine == '.') + else if (*m_token == '.' && tempLine != nullptr && *tempLine == '.') { // range with lower bound of INT_MIN line = tempLine + 1; @@ -1232,7 +1232,7 @@ const char * TpfFile::parseIntegerParameter(CompilerIntegerParam & param, const return CHAR_ERROR; } line = parseIntegerParameter(param, line); - if (line != NULL && *line == '%') + if (line != nullptr && *line == '%') { // % offset from base value line = getNextToken(line, m_token); @@ -1257,7 +1257,7 @@ const char * TpfFile::parseIntegerParameter(CompilerIntegerParam & param, const * @param param template parameter * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or NULL if at eol, or -1 if + * @return character in line where parsing stopped, or nullptr if at eol, or -1 if * error */ const char * TpfFile::parseFloatParameter(FloatParam & param, const char *line) @@ -1278,7 +1278,7 @@ const char * TpfFile::parseFloatParameter(FloatParam & param, const char *line) } else if (isfloat(m_token)) { - if (line != NULL && *line == '.' && *(line+1) == '.') + if (line != nullptr && *line == '.' && *(line+1) == '.') { // range float min_value = static_cast(atof(m_token)); @@ -1325,7 +1325,7 @@ const char * TpfFile::parseFloatParameter(FloatParam & param, const char *line) param.setValue(value); } } - else if (*m_token == '.' && line != NULL && *line == '.') + else if (*m_token == '.' && line != nullptr && *line == '.') { // range with lower bound of -FLT_MAX ++line; @@ -1378,7 +1378,7 @@ const char * TpfFile::parseFloatParameter(FloatParam & param, const char *line) return CHAR_ERROR; } line = parseFloatParameter(param, line); - if (line != NULL && *line == '%') + if (line != nullptr && *line == '%') { // % offset from base value line = getNextToken(line, m_token); @@ -1414,7 +1414,7 @@ const char * TpfFile::parseFloatParameter(FloatParam & param, const char *line) * @param param template parameter * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or NULL if at eol, or -1 if + * @return character in line where parsing stopped, or nullptr if at eol, or -1 if * error */ const char * TpfFile::parseBoolParameter(BoolParam & param, const char *line) @@ -1455,7 +1455,7 @@ const char * TpfFile::parseBoolParameter(BoolParam & param, const char *line) * @param param template parameter * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or NULL if at eol, or -1 if + * @return character in line where parsing stopped, or nullptr if at eol, or -1 if * error */ const char * TpfFile::parseStringParameter(StringParam & param, const char *line) @@ -1494,7 +1494,7 @@ const char * TpfFile::parseStringParameter(StringParam & param, const char *line * @param param template parameter * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or NULL if at eol, or -1 if + * @return character in line where parsing stopped, or nullptr if at eol, or -1 if * error */ const char * TpfFile::parseStringIdParameter(StringIdParam & param, const char *line) @@ -1530,7 +1530,7 @@ const char * TpfFile::parseStringIdParameter(StringIdParam & param, const char * * @param param template parameter * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or NULL if at eol, or -1 if + * @return character in line where parsing stopped, or nullptr if at eol, or -1 if * error */ const char * TpfFile::parseFilenameParameter(StringParam & param, const char *line) @@ -1586,7 +1586,7 @@ const char * TpfFile::parseFilenameParameter(StringParam & param, const char *li * @param param template parameter * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or NULL if at eol, or -1 if + * @return character in line where parsing stopped, or nullptr if at eol, or -1 if * error */ const char * TpfFile::parseVectorParameter(VectorParam & param, const char *line) @@ -1648,7 +1648,7 @@ const char * TpfFile::parseVectorParameter(VectorParam & param, const char *line * @param param template parameter * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or NULL if at eol, or -1 if + * @return character in line where parsing stopped, or nullptr if at eol, or -1 if * error */ const char * TpfFile::parseTemplateParameter(StringParam & param, const char *line) @@ -1662,7 +1662,7 @@ const char * TpfFile::parseTemplateParameter(StringParam & param, const char *li * @param param template parameter * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or NULL if at eol, or -1 if + * @return character in line where parsing stopped, or nullptr if at eol, or -1 if * error */ const char * TpfFile::parseEnumParameter(CompilerIntegerParam & param, const char *line) @@ -1707,7 +1707,7 @@ const char * TpfFile::parseEnumParameter(CompilerIntegerParam & param, const cha * @param param template parameter * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or NULL if at eol, or -1 if + * @return character in line where parsing stopped, or nullptr if at eol, or -1 if * error */ const char * TpfFile::parseDynamicVariableParameter(DynamicVariableParam & param, @@ -1731,7 +1731,7 @@ const char * TpfFile::parseDynamicVariableParameter(DynamicVariableParam & param if (*m_token == '+') { // extending an objevar list - if (m_template != NULL && m_template->getBaseTemplateName().empty()) + if (m_template != nullptr && m_template->getBaseTemplateName().empty()) { m_fp.printError("trying to extend an objvar list from a base template"); return CHAR_ERROR; @@ -1746,7 +1746,7 @@ const char * TpfFile::parseDynamicVariableParameter(DynamicVariableParam & param } else { - if (line == NULL) + if (line == nullptr) { // we need to read the next line to continue parsing line = goToNextLine(); @@ -1786,7 +1786,7 @@ const char * TpfFile::parseDynamicVariableParameter(DynamicVariableParam & param * @param param a DynamicVariableParamData containing an empty list * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or NULL if at eol, or -1 if + * @return character in line where parsing stopped, or nullptr if at eol, or -1 if * error */ const char * TpfFile::parseDynamicVariableParameterList( @@ -1797,7 +1797,7 @@ std::string name; NOT_NULL(line); if (data.m_type != DynamicVariableParamData::LIST || - data.m_data.lparam == NULL) + data.m_data.lparam == nullptr) { m_fp.printError("parse objvar list not given a list"); return CHAR_ERROR; @@ -1938,7 +1938,7 @@ std::string name; } else { - if (line == NULL) + if (line == nullptr) { // we need to read the next line to continue parsing line = goToNextLine(); @@ -1984,7 +1984,7 @@ std::string name; * @param param template parameter * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or NULL if at eol, or -1 if + * @return character in line where parsing stopped, or nullptr if at eol, or -1 if * error */ const char * TpfFile::parseStructParameter(StructParamOT & param, const char *line) @@ -2077,7 +2077,7 @@ const char * TpfFile::parseStructParameter(StructParamOT & param, const char *li * @param param template parameter * @param line buffer containing the assignment statement * - * @return character in line where parsing stopped, or NULL if at eol, or -1 if + * @return character in line where parsing stopped, or nullptr if at eol, or -1 if * error */ const char * TpfFile::parseTriggerVolumeParameter(TriggerVolumeParam & param, @@ -2313,7 +2313,7 @@ Q * param; file.m_fp.printError("expected [ at start of list"); return CHAR_ERROR; } - if (line == NULL) + if (line == nullptr) { // we need to read the next line to continue parsing line = file.goToNextLine(); @@ -2339,7 +2339,7 @@ Q * param; // get the next parameters in the list param = (*getParamFunc)(*file.m_template, file.m_parameter->name, index); - if (param == NULL) + if (param == nullptr) { std::string errmsg = "cannot find parameter " + file.m_parameter->name; file.m_fp.printError(errmsg.c_str()); @@ -2385,7 +2385,7 @@ Q * param; arrayIndex = 0; param = (*getParamFunc)(*file.m_template, file.m_parameter->name, arrayIndex); - if (param == NULL) + if (param == nullptr) { // if the tpf version is less than the current version, print a // warning and ignore @@ -2396,7 +2396,7 @@ Q * param; " due to being removed from later version (need to update the " "template to the latest version)"; file.m_fp.printWarning(errmsg.c_str()); - return NULL; + return nullptr; } else { @@ -2434,7 +2434,7 @@ const char *parseWeightedList( for (;;) { VALUE value; - Q *valueParam = NULL; + Q *valueParam = nullptr; value.value = valueParam = new Q; list->push_back(value); VALUE *newValue = &list->back(); @@ -2505,7 +2505,7 @@ std::string TpfFile::getFileName() const const std::string & TpfFile::getBaseTemplateName() const { - if (m_template != NULL) + if (m_template != nullptr) return m_template->getBaseTemplateName(); return m_baseTemplateName; } diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TpfTemplate.cpp b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TpfTemplate.cpp index 3773bcfd..2a0d76c0 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TpfTemplate.cpp +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TpfTemplate.cpp @@ -21,9 +21,9 @@ */ TpfTemplate::TpfTemplate(const std::string & filename) : ObjectTemplate(filename), - m_parentFile(NULL), + m_parentFile(nullptr), m_baseTemplateName(), - m_baseTemplateFile(NULL) + m_baseTemplateFile(nullptr) { } // TpfTemplate::TpfTemplate @@ -32,12 +32,12 @@ TpfTemplate::TpfTemplate(const std::string & filename) : */ TpfTemplate::~TpfTemplate() { - m_parentFile = NULL; + m_parentFile = nullptr; m_baseTemplateName.clear(); - if (m_baseTemplateFile != NULL) + if (m_baseTemplateFile != nullptr) { delete m_baseTemplateFile; - m_baseTemplateFile = NULL; + m_baseTemplateFile = nullptr; } } // TpfTemplate::~TpfTemplate @@ -52,18 +52,18 @@ int TpfTemplate::setBaseTemplateName(const std::string & name) { m_baseTemplateName = name; - if (m_parentFile == NULL) + if (m_parentFile == nullptr) return -1; // load the base template - if (m_baseTemplateFile != NULL) + if (m_baseTemplateFile != nullptr) { delete m_baseTemplateFile; - m_baseTemplateFile = NULL; + m_baseTemplateFile = nullptr; } - Filename baseTemplateFileName(NULL, NULL, name.c_str(), TEMPLATE_EXTENSION); - Filename sourceTpfPath(NULL, m_parentFile->getTpfPath().c_str(), NULL, NULL); + Filename baseTemplateFileName(nullptr, nullptr, name.c_str(), TEMPLATE_EXTENSION); + Filename sourceTpfPath(nullptr, m_parentFile->getTpfPath().c_str(), nullptr, nullptr); Filename tempPath(baseTemplateFileName); tempPath.setPath(sourceTpfPath.getPath().c_str()); @@ -93,9 +93,9 @@ int TpfTemplate::setBaseTemplateName(const std::string & name) */ TpfTemplate * TpfTemplate::getBaseTemplate(void) const { - if (m_baseTemplateFile != NULL) + if (m_baseTemplateFile != nullptr) return m_baseTemplateFile->getTemplate(); - return NULL; + return nullptr; } // TpfTemplate::getBaseTemplate /** @@ -115,14 +115,14 @@ void TpfTemplate::save(Iff &file) * @param deepcheck flag to check base template if the parameter isn't loaded * @param index array index of the parameter * - * @return the parameter, or NULL if not found + * @return the parameter, or nullptr if not found */ CompilerIntegerParam *TpfTemplate::getCompilerIntegerParam(const char *name, bool deepCheck, int index) { UNREF(name); UNREF(deepCheck); UNREF(index); - return NULL; + return nullptr; } // TpfTemplate::getCompilerIntegerParam /** @@ -132,14 +132,14 @@ CompilerIntegerParam *TpfTemplate::getCompilerIntegerParam(const char *name, boo * @param deepcheck flag to check base template if the parameter isn't loaded * @param index array index of the parameter * - * @return the parameter, or NULL if not found + * @return the parameter, or nullptr if not found */ FloatParam *TpfTemplate::getFloatParam(const char *name, bool deepCheck, int index) { UNREF(name); UNREF(deepCheck); UNREF(index); - return NULL; + return nullptr; } // TpfTemplate::getFloatParam /** @@ -149,14 +149,14 @@ FloatParam *TpfTemplate::getFloatParam(const char *name, bool deepCheck, int ind * @param deepcheck flag to check base template if the parameter isn't loaded * @param index array index of the parameter * - * @return the parameter, or NULL if not found + * @return the parameter, or nullptr if not found */ BoolParam *TpfTemplate::getBoolParam(const char *name, bool deepCheck, int index) { UNREF(name); UNREF(deepCheck); UNREF(index); - return NULL; + return nullptr; } // TpfTemplate::getBoolParam /** @@ -166,14 +166,14 @@ BoolParam *TpfTemplate::getBoolParam(const char *name, bool deepCheck, int index * @param deepcheck flag to check base template if the parameter isn't loaded * @param index array index of the parameter * - * @return the parameter, or NULL if not found + * @return the parameter, or nullptr if not found */ StringParam *TpfTemplate::getStringParam(const char *name, bool deepCheck, int index) { UNREF(name); UNREF(deepCheck); UNREF(index); - return NULL; + return nullptr; } // TpfTemplate::getStringParam /** @@ -183,14 +183,14 @@ StringParam *TpfTemplate::getStringParam(const char *name, bool deepCheck, int i * @param deepcheck flag to check base template if the parameter isn't loaded * @param index array index of the parameter * - * @return the parameter, or NULL if not found + * @return the parameter, or nullptr if not found */ StringIdParam *TpfTemplate::getStringIdParam(const char *name, bool deepCheck, int index) { UNREF(name); UNREF(deepCheck); UNREF(index); - return NULL; + return nullptr; } // TpfTemplate::getStringIdParam /** @@ -200,14 +200,14 @@ StringIdParam *TpfTemplate::getStringIdParam(const char *name, bool deepCheck, i * @param deepcheck flag to check base template if the parameter isn't loaded * @param index array index of the parameter * - * @return the parameter, or NULL if not found + * @return the parameter, or nullptr if not found */ VectorParam *TpfTemplate::getVectorParam(const char *name, bool deepCheck, int index) { UNREF(name); UNREF(deepCheck); UNREF(index); - return NULL; + return nullptr; } // TpfTemplate::getVectorParam /** @@ -217,14 +217,14 @@ VectorParam *TpfTemplate::getVectorParam(const char *name, bool deepCheck, int i * @param deepcheck flag to check base template if the parameter isn't loaded * @param index array index of the parameter * - * @return the parameter, or NULL if not found + * @return the parameter, or nullptr if not found */ DynamicVariableParam *TpfTemplate::getDynamicVariableParam(const char *name, bool deepCheck, int index) { UNREF(name); UNREF(deepCheck); UNREF(index); - return NULL; + return nullptr; } // TpfTemplate::getDynamicVariableParam /** @@ -234,14 +234,14 @@ DynamicVariableParam *TpfTemplate::getDynamicVariableParam(const char *name, boo * @param deepcheck flag to check base template if the parameter isn't loaded * @param index array index of the parameter * - * @return the parameter, or NULL if not found + * @return the parameter, or nullptr if not found */ StructParamOT *TpfTemplate::getStructParamOT(const char *name, bool deepCheck, int index) { UNREF(name); UNREF(deepCheck); UNREF(index); - return NULL; + return nullptr; } // TpfTemplate::getStructParamOT /** @@ -251,14 +251,14 @@ StructParamOT *TpfTemplate::getStructParamOT(const char *name, bool deepCheck, i * @param deepcheck flag to check base template if the parameter isn't loaded * @param index array index of the parameter * - * @return the parameter, or NULL if not found + * @return the parameter, or nullptr if not found */ TriggerVolumeParam *TpfTemplate::getTriggerVolumeParam(const char *name, bool deepCheck, int index) { UNREF(name); UNREF(deepCheck); UNREF(index); - return NULL; + return nullptr; } // TpfTemplate::getTriggerVolumeParam /** @@ -408,7 +408,7 @@ bool TpfTemplate::isParamLoadedLocal(const std::string &name, bool deepCheck) co { result = true; } - else if (deepCheck && getBaseTemplate() != NULL) + else if (deepCheck && getBaseTemplate() != nullptr) { result = getBaseTemplate()->isParamLoadedLocal(name); } @@ -433,7 +433,7 @@ bool TpfTemplate::isParamPureVirtualLocal(const std::string &name, bool deepChec { result = true; } - else if (deepCheck && (getBaseTemplate() != NULL)) + else if (deepCheck && (getBaseTemplate() != nullptr)) { result = getBaseTemplate()->isParamPureVirtualLocal(name); } diff --git a/engine/shared/library/sharedTerrain/src/shared/appearance/ProceduralTerrainAppearance.cpp b/engine/shared/library/sharedTerrain/src/shared/appearance/ProceduralTerrainAppearance.cpp index 3aca2005..3ffa961b 100755 --- a/engine/shared/library/sharedTerrain/src/shared/appearance/ProceduralTerrainAppearance.cpp +++ b/engine/shared/library/sharedTerrain/src/shared/appearance/ProceduralTerrainAppearance.cpp @@ -803,7 +803,7 @@ TerrainGeneratorWaterType ProceduralTerrainAppearance::getWaterType (const Vecto bool ProceduralTerrainAppearance::getWater (const int chunkX, const int chunkZ) const { - if (proceduralTerrainAppearanceTemplate->getBakedTerrain () != NULL) + if (proceduralTerrainAppearanceTemplate->getBakedTerrain () != nullptr) return proceduralTerrainAppearanceTemplate->getBakedTerrain ()->getWater (chunkX, chunkZ); return false; @@ -813,7 +813,7 @@ bool ProceduralTerrainAppearance::getWater (const int chunkX, const int chunkZ) bool ProceduralTerrainAppearance::getSlope (const int chunkX, const int chunkZ) const { - if (proceduralTerrainAppearanceTemplate->getBakedTerrain () != NULL) + if (proceduralTerrainAppearanceTemplate->getBakedTerrain () != nullptr) return proceduralTerrainAppearanceTemplate->getBakedTerrain ()->getSlope (chunkX, chunkZ); return false; @@ -823,7 +823,7 @@ bool ProceduralTerrainAppearance::getSlope (const int chunkX, const int chunkZ) bool ProceduralTerrainAppearance::getWater (const Rectangle2d& rectangle) const { - if (proceduralTerrainAppearanceTemplate->getBakedTerrain () != NULL) + if (proceduralTerrainAppearanceTemplate->getBakedTerrain () != nullptr) return proceduralTerrainAppearanceTemplate->getBakedTerrain ()->getWater (rectangle); return false; @@ -833,7 +833,7 @@ bool ProceduralTerrainAppearance::getWater (const Rectangle2d& rectangle) const bool ProceduralTerrainAppearance::getSlope (const Rectangle2d& rectangle) const { - if (proceduralTerrainAppearanceTemplate->getBakedTerrain () != NULL) + if (proceduralTerrainAppearanceTemplate->getBakedTerrain () != nullptr) return proceduralTerrainAppearanceTemplate->getBakedTerrain ()->getSlope (rectangle); return false; @@ -877,7 +877,7 @@ float ProceduralTerrainAppearance::alter (float elapsedTime) #ifdef _DEBUG const char* const appearanceTemplateName = object->getAppearance () && object->getAppearance ()->getAppearanceTemplate () ? object->getAppearance ()->getAppearanceTemplate ()->getCrcName ().getString () : 0; const Vector position = object->getPosition_w (); - DEBUG_REPORT_LOG (ms_logFloraCreation, ("flora delete: <%1.2f, %1.2f> [%s]\n", position.x, position.z, appearanceTemplateName ? appearanceTemplateName : "null")); + DEBUG_REPORT_LOG (ms_logFloraCreation, ("flora delete: <%1.2f, %1.2f> [%s]\n", position.x, position.z, appearanceTemplateName ? appearanceTemplateName : "nullptr")); #endif delete object; } @@ -1054,7 +1054,7 @@ bool ProceduralTerrainAppearance::isPassableForceChunkCreation(const Vector& pos #ifndef WIN32 if (!chunk) - LOG("PTA::isPFCC", ("(%g,%g,%g) chunk is NULL, %d/%d/%d/%d", position.x, position.y, position.z, getNumberOfChunks(), maximumNumberOfChunksAllowed, getNumberOfReferenceObjects(), maximumNumberOfChunksAlongSide)); + LOG("PTA::isPFCC", ("(%g,%g,%g) chunk is nullptr, %d/%d/%d/%d", position.x, position.y, position.z, getNumberOfChunks(), maximumNumberOfChunksAllowed, getNumberOfReferenceObjects(), maximumNumberOfChunksAlongSide)); #endif return isPassable; @@ -1183,7 +1183,7 @@ void ProceduralTerrainAppearance::_legacyCreateFlora(const Chunk* const chunk) object->yaw_o (yaw); Appearance * const appearance = AppearanceTemplateList::createAppearance (FileName (FileName::P_appearance, data.familyChildData->appearanceTemplateName)); - if (appearance != NULL) { + if (appearance != nullptr) { appearance->setKeepAlive (true); object->setAppearance (appearance); object->setScale (Vector::xyz111 * scale); @@ -1340,7 +1340,7 @@ void ProceduralTerrainAppearance::createFlora (const Chunk* const chunk) object->yaw_o (yaw); Appearance * const appearance = AppearanceTemplateList::createAppearance (FileName (FileName::P_appearance, data.familyChildData->appearanceTemplateName)); - if (appearance != NULL) { + if (appearance != nullptr) { appearance->setKeepAlive (true); object->setAppearance (appearance); object->setScale (Vector::xyz111 * scale); @@ -1403,7 +1403,7 @@ void ProceduralTerrainAppearance::destroyFlora (const Chunk* const chunk) { #ifdef _DEBUG const char* const appearanceTemplateName = object->getAppearance () && object->getAppearance ()->getAppearanceTemplate () ? object->getAppearance ()->getAppearanceTemplate ()->getCrcName ().getString () : 0; - DEBUG_REPORT_LOG (ms_logFloraCreation, ("flora cache: <%1.2f, %1.2f> [%s]\n", position.x, position.z, appearanceTemplateName ? appearanceTemplateName : "null")); + DEBUG_REPORT_LOG (ms_logFloraCreation, ("flora cache: <%1.2f, %1.2f> [%s]\n", position.x, position.z, appearanceTemplateName ? appearanceTemplateName : "nullptr")); #endif iter->second->removeFromWorld (); IGNORE_RETURN (m_cachedFloraMap->insert (std::make_pair (key, iter->second))); diff --git a/engine/shared/library/sharedTerrain/src/shared/appearance/SamplerProceduralTerrainAppearance.cpp b/engine/shared/library/sharedTerrain/src/shared/appearance/SamplerProceduralTerrainAppearance.cpp index 5cf95df7..dbe9e3fe 100755 --- a/engine/shared/library/sharedTerrain/src/shared/appearance/SamplerProceduralTerrainAppearance.cpp +++ b/engine/shared/library/sharedTerrain/src/shared/appearance/SamplerProceduralTerrainAppearance.cpp @@ -910,7 +910,7 @@ void SamplerProceduralTerrainAppearance::generateBetween(Vector const & start_o, } } - // add on all chunks to be generated to chunkList. if we encounter invalid chunks (null), don't include them + // add on all chunks to be generated to chunkList. if we encounter invalid chunks (nullptr), don't include them const Chunk* chunk; for (GenerateList::iterator iter = generateList.begin(); iter != generateList.end(); ++iter) { diff --git a/engine/shared/library/sharedTerrain/src/shared/appearance/ServerProceduralTerrainAppearance.cpp b/engine/shared/library/sharedTerrain/src/shared/appearance/ServerProceduralTerrainAppearance.cpp index 3045b129..938c4f2f 100755 --- a/engine/shared/library/sharedTerrain/src/shared/appearance/ServerProceduralTerrainAppearance.cpp +++ b/engine/shared/library/sharedTerrain/src/shared/appearance/ServerProceduralTerrainAppearance.cpp @@ -805,7 +805,7 @@ void ServerProceduralTerrainAppearance::generateBetween(Vector const & start_o, } } - // add on all chunks to be generated to chunkList. if we encounter invalid chunks (null), don't include them + // add on all chunks to be generated to chunkList. if we encounter invalid chunks (nullptr), don't include them const Chunk* chunk; for (GenerateList::iterator iter = generateList.begin(); iter != generateList.end(); ++iter) { diff --git a/engine/shared/library/sharedTerrain/src/shared/appearance/TerrainQuadTree.cpp b/engine/shared/library/sharedTerrain/src/shared/appearance/TerrainQuadTree.cpp index 275a6986..08cd30a7 100755 --- a/engine/shared/library/sharedTerrain/src/shared/appearance/TerrainQuadTree.cpp +++ b/engine/shared/library/sharedTerrain/src/shared/appearance/TerrainQuadTree.cpp @@ -534,9 +534,9 @@ void TerrainQuadTree::Node::pruneTree () /** * Find the leaf node which directly contains this chunk. * -* @param aChunk the chunk to be located. If non null, the parameters ax and az are ignored. -* @param ax the chunkspace coordinate of the chunk to be located. Only used if param aChunk is null -* @param az the chunkspace coordinate of the chunk to be located. Only used if param aChunk is null +* @param aChunk the chunk to be located. If non nullptr, the parameters ax and az are ignored. +* @param ax the chunkspace coordinate of the chunk to be located. Only used if param aChunk is nullptr +* @param az the chunkspace coordinate of the chunk to be located. Only used if param aChunk is nullptr */ TerrainQuadTree::Node * TerrainQuadTree::Node::findChunkNode (const ProceduralTerrainAppearance::Chunk * const chunk, int x, int z, int size) { @@ -754,9 +754,9 @@ TerrainQuadTree::Node * TerrainQuadTree::Node::findFirstRenderableNode (const in /** * hasChunk is a wrapper for findChunkNode * -* @param aChunk the chunk to be located. If non null, the parameters ax and az are ignored. -* @param ax the chunkspace coordinate of the chunk to be located. Only used if param aChunk is null -* @param az the chunkspace coordinate of the chunk to be located. Only used if param aChunk is null +* @param aChunk the chunk to be located. If non nullptr, the parameters ax and az are ignored. +* @param ax the chunkspace coordinate of the chunk to be located. Only used if param aChunk is nullptr +* @param az the chunkspace coordinate of the chunk to be located. Only used if param aChunk is nullptr * @param chunkSize the relative size of the chunk in chunkspace. */ bool TerrainQuadTree::Node::hasChunk (const ProceduralTerrainAppearance::Chunk * const chunk, const int x, const int z, const int size) diff --git a/engine/shared/library/sharedTerrain/src/shared/appearance/TerrainQuadTree.h b/engine/shared/library/sharedTerrain/src/shared/appearance/TerrainQuadTree.h index cb92dce0..a48d759e 100755 --- a/engine/shared/library/sharedTerrain/src/shared/appearance/TerrainQuadTree.h +++ b/engine/shared/library/sharedTerrain/src/shared/appearance/TerrainQuadTree.h @@ -320,7 +320,7 @@ public: /** * TerrainQuadTree::Iterator is a preorder iterator - * To use an iterator, loop while the current node is non-null. If the + * To use an iterator, loop while the current node is non-nullptr. If the * current node's subtree should be processed further, call descend () * on the iterator, otherwise call advance () to go to the next node. * Either advance () or descend () should be called every loop iteration, diff --git a/engine/shared/library/sharedTerrain/src/shared/core/WaterTypeManager.cpp b/engine/shared/library/sharedTerrain/src/shared/core/WaterTypeManager.cpp index 65b5b1d0..4ec613d1 100755 --- a/engine/shared/library/sharedTerrain/src/shared/core/WaterTypeManager.cpp +++ b/engine/shared/library/sharedTerrain/src/shared/core/WaterTypeManager.cpp @@ -19,8 +19,8 @@ // ====================================================================== bool WaterTypeManager::ms_installed = false; -WaterTypeManager::WaterTypeDataType * WaterTypeManager::ms_waterTypeData=NULL; -WaterTypeManager::CreatureWaterTypeDataType* WaterTypeManager::ms_creatureWaterTypeData=NULL; +WaterTypeManager::WaterTypeDataType * WaterTypeManager::ms_waterTypeData=nullptr; +WaterTypeManager::CreatureWaterTypeDataType* WaterTypeManager::ms_creatureWaterTypeData=nullptr; // ====================================================================== @@ -116,9 +116,9 @@ void WaterTypeManager::remove() } delete ms_waterTypeData; - ms_waterTypeData=NULL; + ms_waterTypeData=nullptr; delete ms_creatureWaterTypeData; - ms_creatureWaterTypeData=NULL; + ms_creatureWaterTypeData=nullptr; ms_installed = false; } diff --git a/engine/shared/library/sharedTerrain/src/shared/generator/BitmapGroup.cpp b/engine/shared/library/sharedTerrain/src/shared/generator/BitmapGroup.cpp index e9215147..9d26743f 100755 --- a/engine/shared/library/sharedTerrain/src/shared/generator/BitmapGroup.cpp +++ b/engine/shared/library/sharedTerrain/src/shared/generator/BitmapGroup.cpp @@ -159,7 +159,7 @@ void BitmapGroup::Family::loadBitmapByFilename() { if(!m_bitmapName) { - DEBUG_WARNING (true, ("BitmapGroup::Family::loadBitmapByFilename() - invalid image - m_bitmapName is NULL")); + DEBUG_WARNING (true, ("BitmapGroup::Family::loadBitmapByFilename() - invalid image - m_bitmapName is nullptr")); } else { diff --git a/engine/shared/library/sharedTerrain/src/shared/generator/ShaderGroup.cpp b/engine/shared/library/sharedTerrain/src/shared/generator/ShaderGroup.cpp index b511c3a4..cbb9562d 100755 --- a/engine/shared/library/sharedTerrain/src/shared/generator/ShaderGroup.cpp +++ b/engine/shared/library/sharedTerrain/src/shared/generator/ShaderGroup.cpp @@ -671,7 +671,7 @@ void ShaderGroup::load_0000 (Iff& iff) //-- add family Family* family = new Family (familyId); - family->setName ("null"); + family->setName ("nullptr"); PackedRgb color; color.r = 255; diff --git a/engine/shared/library/sharedTerrain/src/shared/object/TerrainObject.cpp b/engine/shared/library/sharedTerrain/src/shared/object/TerrainObject.cpp index f48a7b5d..5206146a 100755 --- a/engine/shared/library/sharedTerrain/src/shared/object/TerrainObject.cpp +++ b/engine/shared/library/sharedTerrain/src/shared/object/TerrainObject.cpp @@ -159,7 +159,7 @@ TerrainObject::~TerrainObject () TerrainObject::removeFromWorld (); DEBUG_FATAL (ms_instance != this, ("TerrainObject instance is not this object")); - ms_instance = NULL; + ms_instance = nullptr; } //------------------------------------------------------------------- diff --git a/engine/shared/library/sharedUtility/src/shared/CachedFileManager.cpp b/engine/shared/library/sharedUtility/src/shared/CachedFileManager.cpp index 30bf9486..398ef20e 100755 --- a/engine/shared/library/sharedUtility/src/shared/CachedFileManager.cpp +++ b/engine/shared/library/sharedUtility/src/shared/CachedFileManager.cpp @@ -69,7 +69,7 @@ namespace CachedFileManagerNamespace Tag const TAG_CACH = TAG (C,A,C,H); - char * ms_filenames = NULL; + char * ms_filenames = nullptr; size_t ms_filenamesLength = 0; size_t ms_filenamesCurrentPos = 0; unsigned long ms_totalTime; @@ -150,7 +150,7 @@ void CachedFileManager::install(bool const allowFileCaching) iff.enterForm (TAG_CACH); iff.enterChunk (TAG_0000); - //-- the entire chunk is filled with null terminated strings + //-- the entire chunk is filled with nullptr terminated strings ms_filenamesLength = iff.getChunkLengthLeft(); ms_filenames = iff.readRest_char(); @@ -168,7 +168,7 @@ void CachedFileManager::install(bool const allowFileCaching) void CachedFileManagerNamespace::remove () { delete[] ms_filenames; - ms_filenames = NULL; + ms_filenames = nullptr; ms_filenamesCurrentPos = 0; ms_filenamesLength = 0; @@ -255,7 +255,7 @@ void CachedFileManager::preloadSomeAssets () #endif delete[] ms_filenames; - ms_filenames = NULL; + ms_filenames = nullptr; ms_filenamesCurrentPos = 0; ms_filenamesLength = 0; } @@ -266,7 +266,7 @@ void CachedFileManager::preloadSomeAssets () bool CachedFileManager::donePreloading () { - return ms_filenames == NULL || (ms_filenamesCurrentPos >= ms_filenamesLength); + return ms_filenames == nullptr || (ms_filenamesCurrentPos >= ms_filenamesLength); } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedUtility/src/shared/CurrentUserOptionManager.cpp b/engine/shared/library/sharedUtility/src/shared/CurrentUserOptionManager.cpp index 626c7fcb..dfb11487 100755 --- a/engine/shared/library/sharedUtility/src/shared/CurrentUserOptionManager.cpp +++ b/engine/shared/library/sharedUtility/src/shared/CurrentUserOptionManager.cpp @@ -70,7 +70,7 @@ void CurrentUserOptionManager::load (char const * const userName) ms_optionManager->load (ms_userName.c_str ()); } else - DEBUG_WARNING (true, ("CurrentUserOptionManager::load: userName is null")); + DEBUG_WARNING (true, ("CurrentUserOptionManager::load: userName is nullptr")); } // ---------------------------------------------------------------------- @@ -82,7 +82,7 @@ void CurrentUserOptionManager::save () if (!ms_userName.empty ()) ms_optionManager->save (ms_userName.c_str ()); else - DEBUG_REPORT_LOG (s_verbose, ("CurrentUserOptionManager::save: userName is null\n")); + DEBUG_REPORT_LOG (s_verbose, ("CurrentUserOptionManager::save: userName is nullptr\n")); } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedUtility/src/shared/DataTable.cpp b/engine/shared/library/sharedUtility/src/shared/DataTable.cpp index 0d08193b..2a0974c7 100755 --- a/engine/shared/library/sharedUtility/src/shared/DataTable.cpp +++ b/engine/shared/library/sharedUtility/src/shared/DataTable.cpp @@ -50,7 +50,7 @@ DataTable::~DataTable() if (*k) { delete static_cast *>(*k); - *k = NULL; + *k = nullptr; } } break; @@ -59,7 +59,7 @@ DataTable::~DataTable() if (*k) { delete static_cast *>(*k); - *k = NULL; + *k = nullptr; } } @@ -69,7 +69,7 @@ DataTable::~DataTable() if (*k) { delete static_cast, std::multimap > *>(*k); - *k = NULL; + *k = nullptr; } } @@ -83,7 +83,7 @@ DataTable::~DataTable() case DataTableColumnType::DT_PackedObjVars: default: { - WARNING_STRICT_FATAL((*k) != NULL, ("Bad column Index %d. Unsupported datatype. This may leak memory.", count)); + WARNING_STRICT_FATAL((*k) != nullptr, ("Bad column Index %d. Unsupported datatype. This may leak memory.", count)); } break; } @@ -112,7 +112,7 @@ DataTable::~DataTable() } delete m_columnIndexMap; - m_columnIndexMap = NULL; + m_columnIndexMap = nullptr; } //---------------------------------------------------------------------------- @@ -464,12 +464,12 @@ void DataTable::load(Iff & iff) for (int i = 0; i < count; ++i) { //initialize the table index used for searching. - m_index.push_back(NULL); + m_index.push_back(nullptr); } buildColumnIndexMap(); - if (NULL != iff.getFileName()) + if (nullptr != iff.getFileName()) m_name = iff.getFileName(); else m_name.clear(); diff --git a/engine/shared/library/sharedUtility/src/shared/DataTableColumnType.cpp b/engine/shared/library/sharedUtility/src/shared/DataTableColumnType.cpp index e0ac3cf4..2f73061b 100755 --- a/engine/shared/library/sharedUtility/src/shared/DataTableColumnType.cpp +++ b/engine/shared/library/sharedUtility/src/shared/DataTableColumnType.cpp @@ -148,7 +148,7 @@ DataTableColumnType::DataTableColumnType(std::string const &desc) : std::string::size_type endPos = enumList.find(','); std::string label = enumList.substr(0, eqPos); std::string val = enumList.substr(eqPos+1, endPos-eqPos-1); - (*m_enumMap)[label] = static_cast(strtol(val.c_str(), NULL, 0)); + (*m_enumMap)[label] = static_cast(strtol(val.c_str(), nullptr, 0)); enumList.erase(0, endPos+1); } // assure the default is a member of the enumeration @@ -173,7 +173,7 @@ DataTableColumnType::DataTableColumnType(std::string const &desc) : std::string::size_type endPos = enumList.find(','); std::string label = enumList.substr(0, eqPos); std::string val = enumList.substr(eqPos+1, endPos-eqPos-1); - int bit = static_cast(strtol(val.c_str(), NULL, 0)); + int bit = static_cast(strtol(val.c_str(), nullptr, 0)); if((bit < 1) || (bit > 32)) { WARNING(true, ("Flags value [%s] is not a whole number from 1 to 32", label.c_str())); @@ -247,7 +247,7 @@ void DataTableColumnType::createDefaultCell() switch(m_basicType) { case DT_Int: - m_defaultCell = new DataTableCell(static_cast(strtol(value.c_str(), NULL, 0))); + m_defaultCell = new DataTableCell(static_cast(strtol(value.c_str(), nullptr, 0))); break; case DT_Float: m_defaultCell = new DataTableCell(static_cast(atof(value.c_str()))); diff --git a/engine/shared/library/sharedUtility/src/shared/DataTableManager.cpp b/engine/shared/library/sharedUtility/src/shared/DataTableManager.cpp index 671a5b9c..f6f633c5 100755 --- a/engine/shared/library/sharedUtility/src/shared/DataTableManager.cpp +++ b/engine/shared/library/sharedUtility/src/shared/DataTableManager.cpp @@ -129,7 +129,7 @@ DataTable * DataTableManager::getTable(const std::string& table, bool openIfNotF if (!dt) { DEBUG_WARNING(true, ("Could not find table [%s]", table.c_str())); - return NULL; + return nullptr; } else { @@ -140,7 +140,7 @@ DataTable * DataTableManager::getTable(const std::string& table, bool openIfNotF } else { - return NULL; + return nullptr; } } @@ -158,7 +158,7 @@ DataTable* DataTableManager::reload(const std::string & table) DataTable * const dataTable = open(table); - if (dataTable != NULL) + if (dataTable != nullptr) { std::multimap::const_iterator i = m_reloadCallbacks.lower_bound(table); for (; i != m_reloadCallbacks.end() && (*i).first == table; ++i) @@ -175,7 +175,7 @@ DataTable* DataTableManager::reloadIfOpen(const std::string & table) if(isOpen(table)) return reload(table); else - return NULL; + return nullptr; } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedUtility/src/shared/DataTableWriter.cpp b/engine/shared/library/sharedUtility/src/shared/DataTableWriter.cpp index d3dc927c..795c8696 100755 --- a/engine/shared/library/sharedUtility/src/shared/DataTableWriter.cpp +++ b/engine/shared/library/sharedUtility/src/shared/DataTableWriter.cpp @@ -591,7 +591,7 @@ bool DataTableWriter::save(const char * outputFileName, bool optional) const { if (!outputFileName || outputFileName[0] != '\0') { - DEBUG_FATAL(true, ("OutputFileName is NULL or empty.")); + DEBUG_FATAL(true, ("OutputFileName is nullptr or empty.")); return false; } @@ -728,7 +728,7 @@ DataTableCell *DataTableWriter::_getNewCell(DataTableColumnType const &columnTyp switch (columnType.getBasicType()) { case DataTableColumnType::DT_Int: - return new DataTableCell(static_cast(strtol(value.c_str(), NULL, 0))); + return new DataTableCell(static_cast(strtol(value.c_str(), nullptr, 0))); break; case DataTableColumnType::DT_Float: return new DataTableCell(static_cast(atof(value.c_str()))); diff --git a/engine/shared/library/sharedUtility/src/shared/FileName.cpp b/engine/shared/library/sharedUtility/src/shared/FileName.cpp index 93b579cf..1e8936f4 100755 --- a/engine/shared/library/sharedUtility/src/shared/FileName.cpp +++ b/engine/shared/library/sharedUtility/src/shared/FileName.cpp @@ -52,14 +52,14 @@ FileName::FileName (FileName::Path path, const char* filename, const char* ext) // see if the filename already begins with the path const char *prePath = pathTable [path].path; - if (prePath != NULL && *prePath != '\0') + if (prePath != nullptr && *prePath != '\0') { if (strncmp(filename, prePath, strlen(prePath)) == 0) prePath = ""; } // see if the filename already ends in the extension - if (ext != NULL && *ext != '\0') + if (ext != nullptr && *ext != '\0') { int extLen = strlen(ext); int filenameLen = strlen(filename); diff --git a/engine/shared/library/sharedUtility/src/shared/RotaryCache.cpp b/engine/shared/library/sharedUtility/src/shared/RotaryCache.cpp index b406fe08..6292e0d3 100644 --- a/engine/shared/library/sharedUtility/src/shared/RotaryCache.cpp +++ b/engine/shared/library/sharedUtility/src/shared/RotaryCache.cpp @@ -42,7 +42,7 @@ void* RotaryCache::add(const CrcLowerString& keyString, void* valuePtr) { CacheListEntry listEntry; - void* returnVal = NULL; + void* returnVal = nullptr; listEntry.key = keyString; listEntry.value = valuePtr; @@ -93,7 +93,7 @@ RotaryCache::fetch(const CrcLowerString& keyString) return entryList.value; } - return NULL; + return nullptr; } void* @@ -103,7 +103,7 @@ RotaryCache::remove(const CrcLowerString& keyString) if(iterFind != mMap.end()) { - void* retVal = NULL; + void* retVal = nullptr; CacheMapEntry& entryFind = (*iterFind).second; RotaryList::iterator iterList = entryFind.iter; @@ -119,7 +119,7 @@ RotaryCache::remove(const CrcLowerString& keyString) return retVal; } - return NULL; + return nullptr; } @@ -143,7 +143,7 @@ RotaryCache::getNext() return retVal; } - return NULL; + return nullptr; } void diff --git a/engine/shared/library/sharedUtility/src/shared/SetupSharedUtility.cpp b/engine/shared/library/sharedUtility/src/shared/SetupSharedUtility.cpp index 3336890f..166f5548 100755 --- a/engine/shared/library/sharedUtility/src/shared/SetupSharedUtility.cpp +++ b/engine/shared/library/sharedUtility/src/shared/SetupSharedUtility.cpp @@ -109,7 +109,7 @@ void SetupSharedUtility::installFileManifestEntries () if (!fileName.empty()) FileManifest::addStoredManifestEntry(fileName.c_str(), sceneId.c_str(), fileSize); else - DEBUG_WARNING(true, ("SetupSharedUtility::installFileManifestEntries(): found an entry with a null filename: (row %i)\n", i)); + DEBUG_WARNING(true, ("SetupSharedUtility::installFileManifestEntries(): found an entry with a nullptr filename: (row %i)\n", i)); } } else diff --git a/engine/shared/library/sharedUtility/src/shared/TemplateParameter.cpp b/engine/shared/library/sharedUtility/src/shared/TemplateParameter.cpp index 751aa045..93af0652 100755 --- a/engine/shared/library/sharedUtility/src/shared/TemplateParameter.cpp +++ b/engine/shared/library/sharedUtility/src/shared/TemplateParameter.cpp @@ -951,7 +951,7 @@ DynamicVariableParamData::~DynamicVariableParamData() for (int i = 0; i < count; ++i) { DynamicVariableParamData *temp = m_data.lparam->at(i); - m_data.lparam->at(i) = NULL; + m_data.lparam->at(i) = nullptr; delete temp; } delete m_data.lparam; @@ -1134,15 +1134,15 @@ void DynamicVariableParam::cleanSingleParam(void) { case DynamicVariableParamData::INTEGER: delete m_dataSingle.m_data.iparam; - m_dataSingle.m_data.iparam = NULL; + m_dataSingle.m_data.iparam = nullptr; break; case DynamicVariableParamData::FLOAT: delete m_dataSingle.m_data.fparam; - m_dataSingle.m_data.fparam = NULL; + m_dataSingle.m_data.fparam = nullptr; break; case DynamicVariableParamData::STRING: delete m_dataSingle.m_data.sparam; - m_dataSingle.m_data.sparam = NULL; + m_dataSingle.m_data.sparam = nullptr; break; case DynamicVariableParamData::LIST: { @@ -1152,11 +1152,11 @@ void DynamicVariableParam::cleanSingleParam(void) ++iter) { delete *iter; - *iter = NULL; + *iter = nullptr; } } delete m_dataSingle.m_data.lparam; - m_dataSingle.m_data.lparam = NULL; + m_dataSingle.m_data.lparam = nullptr; break; case DynamicVariableParamData::UNKNOWN: default: diff --git a/engine/shared/library/sharedUtility/src/shared/TemplateParameter.h b/engine/shared/library/sharedUtility/src/shared/TemplateParameter.h index e3db2210..9c86d90b 100755 --- a/engine/shared/library/sharedUtility/src/shared/TemplateParameter.h +++ b/engine/shared/library/sharedUtility/src/shared/TemplateParameter.h @@ -210,19 +210,19 @@ inline void TemplateBase::cleanData(void) ++iter) { delete (*iter).value; - (*iter).value = NULL; + (*iter).value = nullptr; } delete m_data.weightedList; - m_data.weightedList = NULL; + m_data.weightedList = nullptr; } break; case RANGE: delete m_data.range; - m_data.range = NULL; + m_data.range = nullptr; break; case DIE_ROLL: delete m_data.dieRoll; - m_data.dieRoll = NULL; + m_data.dieRoll = nullptr; break; case NONE: default: @@ -288,7 +288,7 @@ inline const typename TemplateBase::Range * TemplateBase @@ -296,7 +296,7 @@ inline const typename TemplateBase::DieRoll * TemplateBase { if (m_dataType == DIE_ROLL) return m_data.dieRoll; - return NULL; + return nullptr; } template @@ -304,7 +304,7 @@ inline const typename TemplateBase::WeightedList * Templat { if (m_dataType == WEIGHTED_LIST) return m_data.weightedList; - return NULL; + return nullptr; } template @@ -541,7 +541,7 @@ inline const IntegerParam::DieRoll * IntegerParam::getDieRollStruct(void) const } else { - return NULL; + return nullptr; } } @@ -553,7 +553,7 @@ inline const IntegerParam::Range * IntegerParam::getRangeStruct(void) const } else { - return NULL; + return nullptr; } } @@ -637,7 +637,7 @@ inline const FloatParam::Range * FloatParam::getRangeStruct() const } else { - return NULL; + return nullptr; } } @@ -765,7 +765,7 @@ class TriggerVolumeData { friend class TriggerVolumeParam; public: - TriggerVolumeData(void) : m_name(NULL), m_radius(0.0f) {} + TriggerVolumeData(void) : m_name(nullptr), m_radius(0.0f) {} TriggerVolumeData(const std::string & name, float radius) : m_name(&name), m_radius(radius) {} const std::string & getName(void) const; @@ -962,7 +962,7 @@ inline TemplateBase *StructParam::createNewParam(void) template inline StructParam::StructParam(void) : TemplateBase() { - this->m_dataSingle = NULL; + this->m_dataSingle = nullptr; } // StructParam::StructParam /** @@ -974,7 +974,7 @@ inline StructParam::~StructParam() if (this->m_dataType == TemplateBase::SINGLE) { delete this->m_dataSingle; - this->m_dataSingle = NULL; + this->m_dataSingle = nullptr; this->m_dataType = TemplateBase::NONE; } } // StructParam::~StructParam @@ -986,7 +986,7 @@ template inline void StructParam::cleanSingleParam(void) { delete this->m_dataSingle; - this->m_dataSingle = NULL; + this->m_dataSingle = nullptr; } // StructParam::cleanSingleParam /** diff --git a/engine/shared/library/sharedUtility/src/shared/ValueDictionary.cpp b/engine/shared/library/sharedUtility/src/shared/ValueDictionary.cpp index cb90f847..5e12a64b 100755 --- a/engine/shared/library/sharedUtility/src/shared/ValueDictionary.cpp +++ b/engine/shared/library/sharedUtility/src/shared/ValueDictionary.cpp @@ -103,7 +103,7 @@ bool ValueDictionary::exists(std::string const & name) const ValueTypeBase * ValueDictionary::getCopy(std::string const & name) const { - ValueTypeBase * returnValue = NULL; + ValueTypeBase * returnValue = nullptr; DictionaryValueMap::const_iterator iter = m_valueMap.find(name); if (iter != m_valueMap.end()) diff --git a/engine/shared/library/sharedUtility/src/shared/ValueDictionaryArchive.cpp b/engine/shared/library/sharedUtility/src/shared/ValueDictionaryArchive.cpp index e6a638e0..f6ca8859 100755 --- a/engine/shared/library/sharedUtility/src/shared/ValueDictionaryArchive.cpp +++ b/engine/shared/library/sharedUtility/src/shared/ValueDictionaryArchive.cpp @@ -59,7 +59,7 @@ namespace Archive std::string name; std::string type; - ValueTypeBase * value = NULL; + ValueTypeBase * value = nullptr; ValueObjectUnpackHandlerMap::const_iterator iterFind; for (int i = 0; i < static_cast(count); ++i) { @@ -77,7 +77,7 @@ namespace Archive target.insert(name, *value); delete value; - value = NULL; + value = nullptr; } } diff --git a/engine/shared/library/sharedXml/src/shared/tree/XmlTreeDocument.cpp b/engine/shared/library/sharedXml/src/shared/tree/XmlTreeDocument.cpp index 2a6d91d0..997a9dee 100755 --- a/engine/shared/library/sharedXml/src/shared/tree/XmlTreeDocument.cpp +++ b/engine/shared/library/sharedXml/src/shared/tree/XmlTreeDocument.cpp @@ -92,7 +92,7 @@ XmlTreeDocument* XmlTreeDocument::createDocument(const char * rootNodeName) doc = xmlNewDoc(BAD_CAST "1.0"); DEBUG_FATAL( !doc, ("Attempted to make new xmlDoc but failed") ); - xmlNode * node = xmlNewNode( NULL, BAD_CAST rootNodeName ); + xmlNode * node = xmlNewNode( nullptr, BAD_CAST rootNodeName ); DEBUG_FATAL( !node, ("Attempted to make root node for new xml document, but failed")); xmlDocSetRootElement(doc, node); @@ -136,8 +136,8 @@ XmlTreeDocument::XmlTreeDocument(CrcString const &name, xmlDoc *xmlDocument) : m_referenceCount(0), m_track( true ) { - DEBUG_FATAL(m_xmlDocument == NULL, ("XmlTreeDocument(): tried to construct with a NULL xmlDocument.")); - WARNING(m_xmlDocument == NULL, ("XmlTreeDocument(): tried to construct with a NULL xmlDocument.")); + DEBUG_FATAL(m_xmlDocument == nullptr, ("XmlTreeDocument(): tried to construct with a nullptr xmlDocument.")); + WARNING(m_xmlDocument == nullptr, ("XmlTreeDocument(): tried to construct with a nullptr xmlDocument.")); } // ---------------------------------------------------------------------- @@ -148,14 +148,14 @@ m_xmlDocument(xmlDocument), m_referenceCount(0), m_track(false) // documents without names are temporary documents for creation of formatted xml { - DEBUG_FATAL(m_xmlDocument == NULL, ("XmlTreeDocument(): tried to construct with a NULL xmlDocument.")); + DEBUG_FATAL(m_xmlDocument == nullptr, ("XmlTreeDocument(): tried to construct with a nullptr xmlDocument.")); } // ---------------------------------------------------------------------- XmlTreeDocument::~XmlTreeDocument() { xmlFreeDoc(m_xmlDocument); - m_xmlDocument = NULL; + m_xmlDocument = nullptr; } // ====================================================================== diff --git a/engine/shared/library/sharedXml/src/shared/tree/XmlTreeDocumentList.cpp b/engine/shared/library/sharedXml/src/shared/tree/XmlTreeDocumentList.cpp index 6579b201..2299aaf5 100755 --- a/engine/shared/library/sharedXml/src/shared/tree/XmlTreeDocumentList.cpp +++ b/engine/shared/library/sharedXml/src/shared/tree/XmlTreeDocumentList.cpp @@ -61,7 +61,7 @@ void XmlTreeDocumentListNamespace::remove() NamedDocumentMap::iterator const endIt = s_documents.end(); for (NamedDocumentMap::iterator it = s_documents.begin(); it != endIt; ++it) { - DEBUG_REPORT_LOG(true, ("-- xml tree document name [%s], reference count [%d].\n", it->first ? it->first->getString() : "", it->second ? it->second->getReferenceCount() : -1)); + DEBUG_REPORT_LOG(true, ("-- xml tree document name [%s], reference count [%d].\n", it->first ? it->first->getString() : "", it->second ? it->second->getReferenceCount() : -1)); } } } @@ -95,7 +95,7 @@ XmlTreeDocument const *XmlTreeDocumentList::fetch(CrcString const &filename) //-- Handle existing entry. if (haveEntry) { - FATAL(!lowerBound->second, ("XmlTreeDocumentList::fetch() found an entry for filename [%s] but the mapped document was NULL.", filename.getString())); + FATAL(!lowerBound->second, ("XmlTreeDocumentList::fetch() found an entry for filename [%s] but the mapped document was nullptr.", filename.getString())); // Increment reference count and return. lowerBound->second->fetch(); @@ -121,7 +121,7 @@ XmlTreeDocument const *XmlTreeDocumentList::fetch(CrcString const &filename) #endif xmlDocPtr const xmlDocument = xmlParseMemory(reinterpret_cast(fileContents), fileSize); - FATAL(!xmlDocument, ("xmlParseMemory() returned NULL when parsing contents of file [%s].", cPathName)); + FATAL(!xmlDocument, ("xmlParseMemory() returned nullptr when parsing contents of file [%s].", cPathName)); #ifdef _DEBUG unsigned long const postDomBytesAllocated = MemoryManager::getCurrentNumberOfBytesAllocated(); @@ -148,7 +148,7 @@ XmlTreeDocument const *XmlTreeDocumentList::fetch(CrcString const &filename) void XmlTreeDocumentList::stopTracking(XmlTreeDocument const *document) { FATAL(!s_installed, ("XmlTreeDocumentList not installed.")); - FATAL(!document, ("XmlTreeDocumentList::stopTracking(): null document passed in.")); + FATAL(!document, ("XmlTreeDocumentList::stopTracking(): nullptr document passed in.")); //-- Find the map entry for the xml tree document. NamedDocumentMap::iterator const findIt = s_documents.find(&(document->getName())); diff --git a/engine/shared/library/sharedXml/src/shared/tree/XmlTreeNode.cpp b/engine/shared/library/sharedXml/src/shared/tree/XmlTreeNode.cpp index c91ff6f6..38692d89 100755 --- a/engine/shared/library/sharedXml/src/shared/tree/XmlTreeNode.cpp +++ b/engine/shared/library/sharedXml/src/shared/tree/XmlTreeNode.cpp @@ -42,7 +42,7 @@ XmlTreeNode::XmlTreeNode(const std::string &name, const std::string &content) : } xmlNode *textNode = xmlNewText(BAD_CAST contentCopy.c_str() ); - m_treeNode = xmlNewNode(NULL, BAD_CAST nameCopy.c_str()); + m_treeNode = xmlNewNode(nullptr, BAD_CAST nameCopy.c_str()); // verify new nodes DEBUG_FATAL(!textNode, ("Failed to create xml text node")); @@ -70,7 +70,7 @@ XmlTreeNode::XmlTreeNode(const std::string &name) : nameCopy = "garbage"; } - m_treeNode = xmlNewNode(NULL, BAD_CAST nameCopy.c_str()); + m_treeNode = xmlNewNode(nullptr, BAD_CAST nameCopy.c_str()); // verify new nodes DEBUG_FATAL(!m_treeNode, ("Failed to create new xml tree node")); @@ -80,7 +80,7 @@ XmlTreeNode::XmlTreeNode(const std::string &name) : XmlTreeNode XmlTreeNode::addChildNode(const char * name) { - DEBUG_FATAL( !m_treeNode, ("Attempted to add child to null xml node")); + DEBUG_FATAL( !m_treeNode, ("Attempted to add child to nullptr xml node")); XmlTreeNode node(name); if (m_treeNode) @@ -109,7 +109,7 @@ void XmlTreeNode::addChild( const XmlTreeNode& node ) bool XmlTreeNode::isNull() const { - return (m_treeNode == NULL); + return (m_treeNode == nullptr); } // ---------------------------------------------------------------------- @@ -140,7 +140,7 @@ void XmlTreeNode::assertIsElement(char const *const elementName) const char const *const nodeName = getName(); UNREF(elementName); UNREF(nodeName); - DEBUG_FATAL(!isElement(), ("expecting element named [%s], found non-element entity named [%s].", elementName ? elementName : "", nodeName)); + DEBUG_FATAL(!isElement(), ("expecting element named [%s], found non-element entity named [%s].", elementName ? elementName : "", nodeName)); DEBUG_FATAL(_stricmp(elementName, nodeName), ("expecting element named [%s], found element named [%s] instead.", nodeName)); } @@ -148,14 +148,14 @@ void XmlTreeNode::assertIsElement(char const *const elementName) const char const *XmlTreeNode::getName() const { - return (m_treeNode ? reinterpret_cast(m_treeNode->name) : ""); + return (m_treeNode ? reinterpret_cast(m_treeNode->name) : ""); } // ---------------------------------------------------------------------- XmlTreeNode XmlTreeNode::getNextSiblingElementNode() const { - xmlNode *siblingNode = m_treeNode ? m_treeNode->next : NULL; + xmlNode *siblingNode = m_treeNode ? m_treeNode->next : nullptr; while (siblingNode && (siblingNode->type != XML_ELEMENT_NODE)) siblingNode = siblingNode->next; @@ -166,16 +166,16 @@ XmlTreeNode XmlTreeNode::getNextSiblingElementNode() const XmlTreeNode XmlTreeNode::getFirstChildNode() const { - return XmlTreeNode(m_treeNode ? m_treeNode->children : NULL); + return XmlTreeNode(m_treeNode ? m_treeNode->children : nullptr); } // ---------------------------------------------------------------------- XmlTreeNode XmlTreeNode::getFirstChildElementNode() const { - //-- Check if we have a NULL node. + //-- Check if we have a nullptr node. if (!m_treeNode) - return XmlTreeNode(NULL); + return XmlTreeNode(nullptr); //-- Look for the first child node that is an element. xmlNode *childNode = m_treeNode->children; @@ -190,9 +190,9 @@ XmlTreeNode XmlTreeNode::getFirstChildElementNode() const XmlTreeNode XmlTreeNode::getFirstChildTextNode() const { - //-- Check if we have a NULL node. + //-- Check if we have a nullptr node. if (!m_treeNode) - return XmlTreeNode(NULL); + return XmlTreeNode(nullptr); //-- Look for the first child node that is a text node. xmlNode *childNode = m_treeNode->children; @@ -212,18 +212,18 @@ XmlTreeNode XmlTreeNode::getElementAttributeValueNode(char const *attributeName, //-- Validate parameters and preconditions. if (!isElement()) { - DEBUG_FATAL(!optional, ("getElementAttributeValueNode(): node [%s] is not an element.", m_treeNode ? reinterpret_cast(m_treeNode->name) : "")); - return XmlTreeNode(NULL); + DEBUG_FATAL(!optional, ("getElementAttributeValueNode(): node [%s] is not an element.", m_treeNode ? reinterpret_cast(m_treeNode->name) : "")); + return XmlTreeNode(nullptr); } if (!attributeName) { - DEBUG_FATAL(!optional, ("getElementAttributeValueNode(): attributeName is NULL.")); - return XmlTreeNode(NULL); + DEBUG_FATAL(!optional, ("getElementAttributeValueNode(): attributeName is nullptr.")); + return XmlTreeNode(nullptr); } //-- Check the attribute nodes for a match on the given name. Ignore case. - for (xmlAttr *attributeNode = m_treeNode ? m_treeNode->properties : NULL; attributeNode; attributeNode = attributeNode->next) + for (xmlAttr *attributeNode = m_treeNode ? m_treeNode->properties : nullptr; attributeNode; attributeNode = attributeNode->next) { if (!_stricmp(attributeName, reinterpret_cast(attributeNode->name))) { @@ -234,7 +234,7 @@ XmlTreeNode XmlTreeNode::getElementAttributeValueNode(char const *attributeName, //-- No attribute node matched the attribute name. DEBUG_FATAL(!optional, ("getElementAttributeValueNode(): failed to find attribute [%s] on element node [%s].", attributeName, getName())); - return XmlTreeNode(NULL); + return XmlTreeNode(nullptr); } // ---------------------------------------------------------------------- @@ -250,7 +250,7 @@ bool XmlTreeNode::getElementAttributeAsBool(char const *attributeName, bool &val char const *const contents = attributeValueNode.getTextValue(); if (!contents) { - DEBUG_FATAL(!contents, ("contents of attribute [%s] is NULL.", attributeName)); + DEBUG_FATAL(!contents, ("contents of attribute [%s] is nullptr.", attributeName)); return false; //lint !e527 // unreachable // reachable in release. } @@ -275,7 +275,7 @@ bool XmlTreeNode::getElementAttributeAsFloat(char const *attributeName, float &v char const *const contents = attributeValueNode.getTextValue(); if (!contents) { - DEBUG_FATAL(!contents, ("contents of attribute [%s] is NULL.", attributeName)); + DEBUG_FATAL(!contents, ("contents of attribute [%s] is nullptr.", attributeName)); return false; //lint !e527 // unreachable // reachable in release. } @@ -306,7 +306,7 @@ bool XmlTreeNode::getElementAttributeAsInt(char const *attributeName, int &value char const *const contents = attributeValueNode.getTextValue(); if (!contents) { - DEBUG_FATAL(!contents, ("contents of attribute [%s] is NULL.", attributeName)); + DEBUG_FATAL(!contents, ("contents of attribute [%s] is nullptr.", attributeName)); return false; //lint !e527 // unreachable // reachable in release. } @@ -366,12 +366,12 @@ char const *XmlTreeNode::getTextValue() const //-- Ensure we're a text node. if(!node.isText()) { - DEBUG_FATAL(true, ("node [%s] is not a text node", m_treeNode ? reinterpret_cast(m_treeNode->name) : "")); - return NULL; //lint !e527 // unreachable // reachable in release. + DEBUG_FATAL(true, ("node [%s] is not a text node", m_treeNode ? reinterpret_cast(m_treeNode->name) : "")); + return nullptr; //lint !e527 // unreachable // reachable in release. } //-- Return contents. - return node.m_treeNode ? reinterpret_cast(node.m_treeNode->content) : NULL; + return node.m_treeNode ? reinterpret_cast(node.m_treeNode->content) : nullptr; } // ---------------------------------------------------------------------- diff --git a/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.cpp b/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.cpp index 49aeee58..cbe80abf 100755 --- a/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.cpp +++ b/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.cpp @@ -51,7 +51,7 @@ MonitorObject::~MonitorObject() if( mConnection ) { - mConnection->SetHandler(NULL); + mConnection->SetHandler(nullptr); mConnection->Disconnect(); mConnection->Release(); } @@ -75,10 +75,10 @@ char hold[214]; UdpConnection::DisconnectReasonText( mConnection->GetOtherSideDisconnectReason())); } } - mConnection->SetHandler(NULL); + mConnection->SetHandler(nullptr); mConnection->Disconnect(); mConnection->Release(); - mConnection = NULL; + mConnection = nullptr; } } @@ -94,10 +94,10 @@ void MonitorObject::OnRoutePacket( UdpConnection * con, const unsigned char *da simpleMessage msg(data); - if( con == NULL ) + if( con == nullptr ) { if( mbprint) - fprintf(stderr,"MONITOR API: MonitorObject.OnRoutePacket, recived a NULL connection.?\n"); + fprintf(stderr,"MONITOR API: MonitorObject.OnRoutePacket, recived a nullptr connection.?\n"); return; } @@ -123,7 +123,7 @@ void MonitorObject::OnRoutePacket( UdpConnection * con, const unsigned char *da if( mHierarchySent == true ) { mMonitorData->processElementsRequest(con,mSequence,(char *)&data[6],dataLen,mlastUpdateTime ); - mlastUpdateTime = (long)time(NULL); + mlastUpdateTime = (long)time(nullptr); break; } @@ -261,7 +261,7 @@ MonitorManager::MonitorManager(const char *configFile, CMonitorData *_gamedata, { mManager = manager; mbprint = _bprint; - passString = NULL; + passString = nullptr; mMonitorData = _gamedata; mObjectCount = 0; @@ -291,7 +291,7 @@ void MonitorManager::OnConnectRequest(UdpConnection *con) { if( con ) { - con->SetHandler(NULL); + con->SetHandler(nullptr); con->Disconnect(); con->Release(); } @@ -313,7 +313,7 @@ void MonitorManager::GiveTime() // check if the monitor object is no longer connected for (int i = 0; i < mObjectCount; i++) { - if( mObject[i]->mConnection == NULL || + if( mObject[i]->mConnection == nullptr || mObject[i]->mConnection->GetStatus() == UdpConnection::cStatusDisconnected ) { MonitorObject *o = mObject[i]; @@ -345,7 +345,7 @@ int x; char buffer[1024]; FILE *fp = fopen(filename,"r"); - if (fp == NULL) + if (fp == nullptr) { fprintf(stderr,"Monitor API: could not open %s file\nTHIS FILE IS REQUIRED.\n", filename); return false; @@ -367,7 +367,7 @@ char buffer[1024]; x = 0; while(!feof(fp)) { - if (fgets( buffer, 1023, fp) != NULL) { + if (fgets( buffer, 1023, fp) != nullptr) { // get rid of '\n' and '\r' for comparisons strtok(buffer,"\r\n"); len = (int)strlen(buffer); @@ -403,17 +403,17 @@ CMonitorAPI::CMonitorAPI( const char *configFile, unsigned short Port, bool _bpr mbprint = _bprint; mPort = Port; - mAddress = NULL; + mAddress = nullptr; if( address ) { mAddress = (char *)malloc(strlen(address)+1); strcpy(mAddress,address); } - if( mang == NULL ) + if( mang == nullptr ) { UdpManager::Params params; - params.handler = NULL; + params.handler = nullptr; params.maxConnections = CONNECTION_MAX; params.outgoingBufferSize = 1000000; params.noDataTimeout = 130000; @@ -595,7 +595,7 @@ int err; unsigned long S = 4000000; unsigned char *p; - data = NULL; + data = nullptr; p = (unsigned char *)malloc(4000000); memset(p,0,4000000); err = uncompress(p,&S,(source+6),(long)getSize()); diff --git a/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.h b/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.h index d97079c7..975e2429 100755 --- a/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.h +++ b/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.h @@ -42,14 +42,14 @@ public: * * debug = turn on/off debugging. * - * address = (NOT USED) Leave as NULL + * address = (NOT USED) Leave as nullptr * - * UdpManager * mang = (NOT USED) Leave as NULL + * UdpManager * mang = (NOT USED) Leave as nullptr * - * // GenericNotifier *notifier = (NOT USED) Leave as NULL + * // GenericNotifier *notifier = (NOT USED) Leave as nullptr * */ - CMonitorAPI( const char *configFile, unsigned short port, bool debug = false , char * address = NULL, UdpManager * mang = NULL ); + CMonitorAPI( const char *configFile, unsigned short port, bool debug = false , char * address = nullptr, UdpManager * mang = nullptr ); ~CMonitorAPI(); @@ -112,7 +112,7 @@ public: * Max Limited * #define ELEMENT_MAX_START 2000 */ - int add( const char *label, int Key, int mode = MON_HISTORY, const char *Description = NULL ); + int add( const char *label, int Key, int mode = MON_HISTORY, const char *Description = nullptr ); /**************** Set the description of an element ** diff --git a/external/3rd/library/platform/projects/MonAPI2/MonitorData.cpp b/external/3rd/library/platform/projects/MonAPI2/MonitorData.cpp index 4b283bc6..044c1a17 100755 --- a/external/3rd/library/platform/projects/MonAPI2/MonitorData.cpp +++ b/external/3rd/library/platform/projects/MonAPI2/MonitorData.cpp @@ -58,7 +58,7 @@ CMonitorData::CMonitorData() { m_sequence = 1; - m_buffer = NULL; + m_buffer = nullptr; m_nbuffer = 0; m_count = 0; m_max = ELEMENT_MAX_START; @@ -103,7 +103,7 @@ void CMonitorData::resize_buffer(int new_size) { char *temp; - if( m_buffer != NULL ) + if( m_buffer != nullptr ) { temp = m_buffer; m_buffer = new char[ new_size]; @@ -331,7 +331,7 @@ char *p; if( get_bit(mark,x) == 0 ) { set_bit( mark, x ); - if( m_data[x].discription != NULL ) + if( m_data[x].discription != nullptr ) { sprintf(tmp,"%d,%s|",m_data[x].id, m_data[x].discription); size += (int)strlen(tmp); @@ -360,7 +360,7 @@ char *p; { flag = 2; set_bit(mark,x); - if( m_data[x].discription != NULL ) + if( m_data[x].discription != nullptr ) { sprintf(tmp,"%d,%s|",m_data[x].id, m_data[x].discription); size += (int)strlen(tmp); @@ -412,7 +412,7 @@ int x; //******* Discription ****** delete [] m_data[x].discription; - m_data[x].discription = NULL; + m_data[x].discription = nullptr; if( des ) { m_data[x].discription = new char [strlen(des)+1]; @@ -459,10 +459,10 @@ int x; { if( Id == m_data[x].id ) { - if( Description == NULL ) + if( Description == nullptr ) { delete [] m_data[x].discription; - m_data[x].discription = NULL; + m_data[x].discription = nullptr; mode = 0; return x; } @@ -510,7 +510,7 @@ int high, i, low; if ( high < m_count && Id==m_data[high].id ) { if (m_data[high].ChangedTime == 0 || m_data[high].value != value) { - m_data[high].ChangedTime = (long)time(NULL); + m_data[high].ChangedTime = (long)time(nullptr); m_data[high].value = value; } } @@ -560,7 +560,7 @@ int CMonitorData::parseList( char **list, char *data, char tok , int max ) int count; int cnt; - if( data == NULL ) + if( data == nullptr ) return 0; list[0] = data; diff --git a/external/3rd/library/platform/projects/MonAPI2/MonitorData.h b/external/3rd/library/platform/projects/MonAPI2/MonitorData.h index 1146d83e..56e3f0b9 100755 --- a/external/3rd/library/platform/projects/MonAPI2/MonitorData.h +++ b/external/3rd/library/platform/projects/MonAPI2/MonitorData.h @@ -35,7 +35,7 @@ Usage 'L' - long long int (8) 'i' - int (4) 's' - short int (2) - 'S' - C-style, null-terminated string (n + null) + 'S' - C-style, nullptr-terminated string (n + nullptr) 'Bn' - buffer, of size n. Used for non-terminated strings, or other binary data. */ @@ -115,7 +115,7 @@ private: //---------------------------------------------------------------- // stringMessage -// This message type is used for passing messages that can consist of a NULL terminated string +// This message type is used for passing messages that can consist of a nullptr terminated string class stringMessage : public monMessage { public: @@ -252,7 +252,7 @@ class CMonitorData { public: -// CMonitorData(GenericNotifier *notifier=NULL ); +// CMonitorData(GenericNotifier *notifier=nullptr ); CMonitorData(); virtual ~CMonitorData(); @@ -266,7 +266,7 @@ public: bool processDescriptionRequest(UdpConnection *con, short & sequence, char * userData, int dataLen,unsigned char *mark); int add(const char *label, int id, int ping, const char *des ); int setDescription( int Id, const char *Description , int & mode); - char *getDescription(int x){ if( m_ndata >= x ) return NULL; return m_data[x].discription;} + char *getDescription(int x){ if( m_ndata >= x ) return nullptr; return m_data[x].discription;} int pingValue(int p); void set(int Id, int value); void remove(int Id); diff --git a/external/3rd/library/platform/projects/Session/CommonAPI/CommonClient.cpp b/external/3rd/library/platform/projects/Session/CommonAPI/CommonClient.cpp index 4856d6e2..f61f6464 100755 --- a/external/3rd/library/platform/projects/Session/CommonAPI/CommonClient.cpp +++ b/external/3rd/library/platform/projects/Session/CommonAPI/CommonClient.cpp @@ -42,7 +42,7 @@ CConnectionHandler::~CConnectionHandler() { if (mConnection) { - mConnection->SetHandler(NULL); + mConnection->SetHandler(nullptr); mConnection->Disconnect(); mConnection->Release(); } @@ -79,7 +79,7 @@ void CConnectionHandler::OnTerminated(UdpConnection *) if (mConnection) { - mConnection->SetHandler(NULL); + mConnection->SetHandler(nullptr); mConnection->Release(); mConnection = 0; } diff --git a/external/3rd/library/platform/projects/Session/LoginAPI/ClientCore.cpp b/external/3rd/library/platform/projects/Session/LoginAPI/ClientCore.cpp index a9e2caf6..1cabca55 100755 --- a/external/3rd/library/platform/projects/Session/LoginAPI/ClientCore.cpp +++ b/external/3rd/library/platform/projects/Session/LoginAPI/ClientCore.cpp @@ -749,7 +749,7 @@ namespace LoginAPI else input.SetSessionID(sessionID); - // don't validate session type, there are clients that pass in NULL. + // don't validate session type, there are clients that pass in nullptr. input.SetSessionType(sessionType); //////////////////////////////////////// @@ -776,7 +776,7 @@ namespace LoginAPI else input.SetSessionID(sessionID); - // don't validate session type, there are clients that pass in NULL. + // don't validate session type, there are clients that pass in nullptr. input.SetSessionType(sessionType); //////////////////////////////////////// @@ -803,7 +803,7 @@ namespace LoginAPI else input.SetSessionID(sessionID); - // don't validate session type, there are clients that pass in NULL. + // don't validate session type, there are clients that pass in nullptr. input.SetSessionType(sessionType); //////////////////////////////////////// @@ -830,7 +830,7 @@ namespace LoginAPI else input.SetSessionID(sessionID); - // don't validate session type, there are clients that pass in NULL. + // don't validate session type, there are clients that pass in nullptr. input.SetSessionType(sessionType); //////////////////////////////////////// diff --git a/external/3rd/library/platform/utils/Base/Archive.cpp b/external/3rd/library/platform/utils/Base/Archive.cpp index 90f5f2f5..7d59c663 100755 --- a/external/3rd/library/platform/utils/Base/Archive.cpp +++ b/external/3rd/library/platform/utils/Base/Archive.cpp @@ -91,7 +91,7 @@ namespace Base ByteStream::ByteStream() : allocatedSize(0), beginReadIterator(), - data(NULL), + data(nullptr), size(0) { data = Data::getNewData(); @@ -187,7 +187,7 @@ namespace Base if(data->size < allocatedSize) { unsigned char * tmp = new unsigned char[newSize]; - if(data->buffer != NULL) + if(data->buffer != nullptr) memcpy(tmp, data->buffer, size); delete[] data->buffer; data->buffer = tmp; diff --git a/external/3rd/library/platform/utils/Base/AutoLog.cpp b/external/3rd/library/platform/utils/Base/AutoLog.cpp index 9b25380e..aa84b96f 100755 --- a/external/3rd/library/platform/utils/Base/AutoLog.cpp +++ b/external/3rd/library/platform/utils/Base/AutoLog.cpp @@ -35,7 +35,7 @@ bool CAutoLog::Open(const char * filename) //------------------------------------- { - if( NULL == filename) + if( nullptr == filename) return false; if (pFilename) @@ -49,13 +49,13 @@ bool CAutoLog::Open(const char * filename) // Sanitize slashes char *ptr; - while ((ptr = strchr(pFilename,WRONGSLASH)) != NULL) + while ((ptr = strchr(pFilename,WRONGSLASH)) != nullptr) *ptr = SLASHCHAR[0]; char strPath[1024]; strcpy(strPath,pFilename); ptr = strrchr(strPath, SLASHCHAR[0]); - if (ptr != NULL) + if (ptr != nullptr) { *ptr = 0; @@ -63,11 +63,11 @@ bool CAutoLog::Open(const char * filename) char curdir[128]; // remember current directory - if( _getcwd(curdir,sizeof(curdir)) == NULL ) + if( _getcwd(curdir,sizeof(curdir)) == nullptr ) { fprintf(stderr,"CAutoLog::Archive failed to get current directory!\n"); free(pFilename); - pFilename = NULL; + pFilename = nullptr; return false; // error, can't proceed } @@ -78,7 +78,7 @@ bool CAutoLog::Open(const char * filename) { fprintf(stderr,"CAutoLog::Archive failed to make directory: %s\n", strPath); free(pFilename); - pFilename = NULL; + pFilename = nullptr; return false; // error, can't proceed } } @@ -98,7 +98,7 @@ bool CAutoLog::Open(const char * filename) { fprintf(stderr,"CAutoLog::Archive failed to make directory: %s\n", strPath); free(pFilename); - pFilename = NULL; + pFilename = nullptr; return false; // error, can't proceed } } @@ -107,7 +107,7 @@ bool CAutoLog::Open(const char * filename) pFile = fopen(pFilename,"a+"); - if( pFile == NULL || pFile == (FILE *)-1) + if( pFile == nullptr || pFile == (FILE *)-1) { //fprintf(stderr,"CAutoLog::Open failed to open log file: %s\n",pFilename); Close(); @@ -127,14 +127,14 @@ bool CAutoLog::Open(const char * filename) void CAutoLog::Close(void) //------------------------------------- { - if( pFile != (FILE *)-1 && pFile != NULL) + if( pFile != (FILE *)-1 && pFile != nullptr) { fclose(pFile); } pFile = (FILE *)-1; free(pFilename); - pFilename = NULL; + pFilename = nullptr; } //------------------------------------- @@ -197,7 +197,7 @@ void CAutoLog::LogDebug(char * format, ...) void CAutoLog::Log(eLogLevel severity, char *fmt, ...) //------------------------------------- { - if (pFile == (FILE *)-1 || pFile == NULL) + if (pFile == (FILE *)-1 || pFile == nullptr) { //fprintf(stderr,"CAutoLog::Log called with no file open!\n"); return; @@ -253,7 +253,7 @@ void CAutoLog::Log(eLogLevel severity, char *fmt, ...) void CAutoLog::Archive(void) //------------------------------------- { - if( pFile == (FILE *)-1 || pFile == NULL) + if( pFile == (FILE *)-1 || pFile == nullptr) { //fprintf(stderr,"CAutoLog::Archive called with no file open!\n"); return; @@ -284,7 +284,7 @@ void CAutoLog::Archive(void) strcpy(strCurrent,pFilename); pCurrent = strrchr(strCurrent, SLASHCHAR[0]); - if (pCurrent != NULL) + if (pCurrent != nullptr) *pCurrent = 0; else sprintf(strCurrent,"."); @@ -293,7 +293,7 @@ void CAutoLog::Archive(void) #ifdef WIN32 // remember current directory - if( _getcwd(curdir,sizeof(curdir)) == NULL ) + if( _getcwd(curdir,sizeof(curdir)) == nullptr ) { fprintf(stderr,"CAutoLog::Archive failed to get current directory!\n"); return; // error, can't proceed @@ -327,7 +327,7 @@ void CAutoLog::Archive(void) #endif pCurrent = strrchr(pFilename, SLASHCHAR[0]); - if (pCurrent == NULL) + if (pCurrent == nullptr) pCurrent = pFilename; else pCurrent++; diff --git a/external/3rd/library/platform/utils/Base/AutoLog.h b/external/3rd/library/platform/utils/Base/AutoLog.h index 0a90a774..18871c7f 100755 --- a/external/3rd/library/platform/utils/Base/AutoLog.h +++ b/external/3rd/library/platform/utils/Base/AutoLog.h @@ -92,14 +92,14 @@ namespace Base //------------------------------------- inline CAutoLog::CAutoLog() { - pFilename = NULL; + pFilename = nullptr; pFile = (FILE *)-1; } //------------------------------------- inline CAutoLog::CAutoLog(const char * file) { - pFilename = NULL; + pFilename = nullptr; pFile = (FILE *)-1; Open(file); } diff --git a/external/3rd/library/platform/utils/Base/Config.cpp b/external/3rd/library/platform/utils/Base/Config.cpp index a305cb9c..6351686f 100755 --- a/external/3rd/library/platform/utils/Base/Config.cpp +++ b/external/3rd/library/platform/utils/Base/Config.cpp @@ -28,7 +28,7 @@ bool CConfig::LoadFile(char * file) // open file fp = fopen(file, "r"); - if (fp == NULL || fp == (FILE *)-1) + if (fp == nullptr || fp == (FILE *)-1) { //fprintf(stderr,"Failed to open config file %s!",file); delete fp; @@ -73,21 +73,21 @@ void CConfig::UnloadFile(void) //----------------------------------- { delete[] pConfig; - pConfig = NULL; + pConfig = nullptr; } //----------------------------------- /// finds a key of the config in memory // key argument is case-insensitive, but must be upper case in config file -// Returns true for success (passing NULL is a special case returned as success) +// Returns true for success (passing nullptr is a special case returned as success) bool CConfig::FindKey(char *key) //----------------------------------- { - if (pConfig == NULL) + if (pConfig == nullptr) return false; // special case...continue with existing key - if (key == NULL) + if (key == nullptr) return true; // form the search key @@ -98,12 +98,12 @@ bool CConfig::FindKey(char *key) // find the key heading pCursor = strstr(pConfig,strBuffer); - if (pCursor==NULL) + if (pCursor==nullptr) return false; // find the closing bracket of key heading pCursor = strchr(pCursor,']'); - if (pCursor==NULL) + if (pCursor==nullptr) return false; pCursor++; @@ -112,7 +112,7 @@ bool CConfig::FindKey(char *key) //----------------------------------- /// extract a number from the config string -// pass the key to find the first number in the list, else NULL to find the next number in the list +// pass the key to find the first number in the list, else nullptr to find the next number in the list // returns 0 if no number is found, else returns the number long CConfig::GetLong(char *key) //----------------------------------- @@ -135,20 +135,20 @@ long CConfig::GetLong(char *key) //----------------------------------- /// extract string (in double-quotes) from the list. -// pass the key to find the first string in the list, else NULL to find the next string in the list -// returns NULL if no string found, else returns a temporary copy of the string (without quotes) +// pass the key to find the first string in the list, else nullptr to find the next string in the list +// returns nullptr if no string found, else returns a temporary copy of the string (without quotes) char * CConfig::GetString(char *key) //----------------------------------- { if (!FindKey(key)) - return NULL; + return nullptr; // look for start of string or end of key while (*pCursor && *pCursor != '"' && *pCursor != '[') pCursor++; if (*(pCursor++) != '"') - return NULL; + return nullptr; // until closing quote int c = 0; @@ -162,7 +162,7 @@ char * CConfig::GetString(char *key) } } - return NULL; + return nullptr; } diff --git a/external/3rd/library/platform/utils/Base/Config.h b/external/3rd/library/platform/utils/Base/Config.h index 56ad96af..f577eef6 100755 --- a/external/3rd/library/platform/utils/Base/Config.h +++ b/external/3rd/library/platform/utils/Base/Config.h @@ -10,7 +10,7 @@ ; list of strings, with code example # config.FindKey("NUMBERS"); -# while (number = config.GetLong(NULL)) +# while (number = config.GetLong(nullptr)) # YourHandleNumber(number); [NUMBERS] 100 200, 300 ; formatting is very flexible as long as numbers are delimited by non-numbers @@ -23,7 +23,7 @@ ; list of strings, with code example # config.FindKey("HOSTS"); -# while (string = config.GetString(NULL)) +# while (string = config.GetString(nullptr)) # YourHandleString(string); [HOSTS] "206.19.151.173:5999" @@ -68,16 +68,16 @@ namespace Base // returns TRUE if key is found. bool FindKey(char *key); - // extract string from config. If key is NULL, extract next string in list, else extract first string. - // if key was not found, returns NULL - char * GetString(char *key = NULL); + // extract string from config. If key is nullptr, extract next string in list, else extract first string. + // if key was not found, returns nullptr + char * GetString(char *key = nullptr); - // extract number from config. If key is NULL, extract next number in list, else extract first number. + // extract number from config. If key is nullptr, extract next number in list, else extract first number. // if key was not found, returns 0 - long GetLong(char *key = NULL); // extract number from config. + long GetLong(char *key = nullptr); // extract number from config. // indicate if config file has been loaded - inline bool FileLoaded() { return pConfig == NULL ? false : true; } + inline bool FileLoaded() { return pConfig == nullptr ? false : true; } private: char * pConfig; // pointer to file memory @@ -87,14 +87,14 @@ namespace Base inline CConfig::CConfig() { - pConfig = NULL; - pCursor = NULL; + pConfig = nullptr; + pCursor = nullptr; } inline CConfig::CConfig(char * file) { - pConfig = NULL; - pCursor = NULL; + pConfig = nullptr; + pCursor = nullptr; LoadFile(file); } diff --git a/external/3rd/library/platform/utils/Base/Statistics.h b/external/3rd/library/platform/utils/Base/Statistics.h index 18e0579e..0856034b 100755 --- a/external/3rd/library/platform/utils/Base/Statistics.h +++ b/external/3rd/library/platform/utils/Base/Statistics.h @@ -34,9 +34,9 @@ namespace Base bool commit = false; if (!mLastSampleTime) - mLastSampleTime = time(NULL); + mLastSampleTime = time(nullptr); - if (!mSampleFrequency || mLastSampleTime + mSampleFrequency < (unsigned)time(NULL)) + if (!mSampleFrequency || mLastSampleTime + mSampleFrequency < (unsigned)time(nullptr)) { mSampleTotal++; mAggregateTotal += value; diff --git a/external/3rd/library/platform/utils/Base/TemplateObjectAllocator.h b/external/3rd/library/platform/utils/Base/TemplateObjectAllocator.h index 40227673..ed1a7937 100755 --- a/external/3rd/library/platform/utils/Base/TemplateObjectAllocator.h +++ b/external/3rd/library/platform/utils/Base/TemplateObjectAllocator.h @@ -93,7 +93,7 @@ namespace Base void Destroy(TYPE *object) { - if (object == NULL) + if (object == nullptr) return; #ifdef USE_ALLOCATOR_MUTEX @@ -142,7 +142,7 @@ namespace Base void FastDestroy(TYPE *object) { - if (object == NULL) + if (object == nullptr) return; object->~TYPE(); diff --git a/external/3rd/library/platform/utils/Base/linux/BlockAllocator.cpp b/external/3rd/library/platform/utils/Base/linux/BlockAllocator.cpp index 4cefb9e7..29d91074 100755 --- a/external/3rd/library/platform/utils/Base/linux/BlockAllocator.cpp +++ b/external/3rd/library/platform/utils/Base/linux/BlockAllocator.cpp @@ -12,7 +12,7 @@ namespace Base { for(unsigned i = 0; i < 31; i++) { - m_blocks[i] = NULL; + m_blocks[i] = nullptr; } } @@ -21,7 +21,7 @@ namespace Base // free all allocated memory blocks for(unsigned i = 0; i < 31; i++) { - while(m_blocks[i] != NULL) + while(m_blocks[i] != nullptr) { unsigned *tmp = m_blocks[i]; m_blocks[i] = (unsigned *)*m_blocks[i]; @@ -36,7 +36,7 @@ namespace Base void *BlockAllocator::getBlock(unsigned bytes) { unsigned accum = 16, bits = 16; - unsigned *handle = NULL; + unsigned *handle = nullptr; // Perform a binary search looking for the highest bit. @@ -96,7 +96,7 @@ namespace Base void BlockAllocator::returnBlock(unsigned *handle) { - // C++ allows for safe deletion of a NULL pointer + // C++ allows for safe deletion of a nullptr pointer if(handle) { // Update the allocator linked list, insert this entry at the head diff --git a/external/3rd/library/platform/utils/Base/linux/Event.cpp b/external/3rd/library/platform/utils/Base/linux/Event.cpp index a3cce3b1..72190595 100755 --- a/external/3rd/library/platform/utils/Base/linux/Event.cpp +++ b/external/3rd/library/platform/utils/Base/linux/Event.cpp @@ -26,8 +26,8 @@ namespace Base mCond(), mThreadCount(0) { - pthread_mutex_init(&mMutex, NULL); - pthread_cond_init(&mCond, NULL); + pthread_mutex_init(&mMutex, nullptr); + pthread_cond_init(&mCond, nullptr); } CEvent::~CEvent() @@ -74,7 +74,7 @@ namespace Base struct timeval now; struct timespec abs_timeout; - gettimeofday(&now, NULL); + gettimeofday(&now, nullptr); abs_timeout.tv_sec = now.tv_sec + timeout/1000; abs_timeout.tv_nsec = now.tv_usec * 1000 + (timeout%1000)*1000000; abs_timeout.tv_sec += abs_timeout.tv_nsec / 1000000000; diff --git a/external/3rd/library/platform/utils/Base/linux/Logger.cpp b/external/3rd/library/platform/utils/Base/linux/Logger.cpp index f305703d..1510e1c1 100755 --- a/external/3rd/library/platform/utils/Base/linux/Logger.cpp +++ b/external/3rd/library/platform/utils/Base/linux/Logger.cpp @@ -18,20 +18,20 @@ Logger::Logger(const char *prefix, int level, unsigned size, bool rollDate) : m_defaultLevel(level), m_defaultSize(size), m_dirPrefix(prefix), m_rollDate(rollDate) { char buf[1024]; - FILE *logDir = NULL; + FILE *logDir = nullptr; logDir = fopen(m_dirPrefix.c_str(), "r+"); if(errno == ENOENT) { cmkdir(m_dirPrefix.c_str(), 0755); } - else if(logDir != NULL) + else if(logDir != nullptr) { fclose(logDir); } tm now; - time_t t = time(NULL); + time_t t = time(nullptr); localtime_r(&t, &now); memcpy(&m_lastDateTime, &now, sizeof(tm)); @@ -48,7 +48,7 @@ Logger::Logger(const char *prefix, int level, unsigned size, bool rollDate) { cmkdir(buf, 0755); } - else if(logDir != NULL) + else if(logDir != nullptr) { fclose(logDir); } @@ -178,7 +178,7 @@ void Logger::logSimple(unsigned logenum, int level, const char *message) { return; } - time_t t = time(NULL); + time_t t = time(nullptr); LogInfo *info = (*iter).second; if(level >= info->level) { @@ -241,7 +241,7 @@ void Logger::log(unsigned logenum, int level, const char *message, ...) { return; } - time_t t = time(NULL); + time_t t = time(nullptr); LogInfo *info = (*iter).second; if(level >= info->level) { @@ -294,14 +294,14 @@ void Logger::log(unsigned logenum, int level, const char *message, ...) void Logger::rollDate(time_t t) { char buf[80]; - FILE *logDir = NULL; + FILE *logDir = nullptr; logDir = fopen(m_dirPrefix.c_str(), "r+"); if(errno == ENOENT) { cmkdir(m_dirPrefix.c_str(), 0755); } - else if(logDir != NULL) + else if(logDir != nullptr) { fclose(logDir); } @@ -316,7 +316,7 @@ void Logger::rollDate(time_t t) { cmkdir(buf, 0755); } - else if(logDir != NULL) + else if(logDir != nullptr) { fclose(logDir); } diff --git a/external/3rd/library/platform/utils/Base/linux/Thread.cpp b/external/3rd/library/platform/utils/Base/linux/Thread.cpp index 2bc4f26b..5cca2017 100755 --- a/external/3rd/library/platform/utils/Base/linux/Thread.cpp +++ b/external/3rd/library/platform/utils/Base/linux/Thread.cpp @@ -76,8 +76,8 @@ namespace Base CThreadPool::CMember::CMember(CThreadPool * parent) : mParent(parent), - mFunction(NULL), - mArgument(NULL), + mFunction(nullptr), + mArgument(nullptr), mSemaphore() { StartThread(); @@ -116,8 +116,8 @@ namespace Base if (mFunction) { mFunction(mArgument); - mArgument = NULL; - mFunction = NULL; + mArgument = nullptr; + mFunction = nullptr; } else if (mParent->OnDestory(this)) mThreadContinue = false; @@ -172,7 +172,7 @@ namespace Base } //////////////////////////////////////// - // (3) Delete the null member threads + // (3) Delete the nullptr member threads mMutex.Lock(); while (!mNullMember.empty()) { @@ -199,7 +199,7 @@ namespace Base } //////////////////////////////////////// - // (2) Delete any null member threads. + // (2) Delete any nullptr member threads. while (!mNullMember.empty()) { delete mNullMember.front(); diff --git a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistStressTest/test.cpp b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistStressTest/test.cpp index c9d48ca3..dae431dd 100755 --- a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistStressTest/test.cpp +++ b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistStressTest/test.cpp @@ -376,8 +376,8 @@ void createTicket() Plat_Unicode::String xml = narrowToWide("Stress Test XML here"); t.setDetails(details.c_str()); t.setLocation(location.c_str()); - track = api->requestCreateTicket(NULL, &t, NULL, t.uid); - //track = api->requestCreateTicket(NULL, &t, xml.c_str(), t.uid); + track = api->requestCreateTicket(nullptr, &t, nullptr, t.uid); + //track = api->requestCreateTicket(nullptr, &t, xml.c_str(), t.uid); submitted++; printf("creating ticket\n"); @@ -478,7 +478,7 @@ int main(int argc, char **argv) gamep = argv[4]; gameserver = argv[5]; - if (serverhost == NULL || strlen(serverhost) == 0) + if (serverhost == nullptr || strlen(serverhost) == 0) { std::cout << "Missing hostname!\n"; return 0; @@ -493,12 +493,12 @@ int main(int argc, char **argv) std::cout << "Missing or invalid number of functions to run!\n"; return 0; } - if (gamep == NULL || strlen(gamep) == 0) + if (gamep == nullptr || strlen(gamep) == 0) { std::cout << "Missing game name!\n"; return 0; } - if (gameserver == NULL || strlen(gameserver) == 0) + if (gameserver == nullptr || strlen(gameserver) == 0) { std::cout << "Missing game server name!\n"; return 0; @@ -517,7 +517,7 @@ while(1) unsigned loginWait(500); unsigned loginAttempts(0); //api = new apiTest(serverhost, serverport, 60, CSASSIST_APIFLAG_ASSUME_RECONNECT); //, 0, CSASSIST_APIFLAG_ASSUME_RECONNECT); - //api->connectCSAssist(NULL, game.c_str(), server.c_str()); + //api->connectCSAssist(nullptr, game.c_str(), server.c_str()); //while (!ready) // api->Update(); @@ -530,7 +530,7 @@ while(1) if (api) delete api; //api = new apiTest(serverhost, serverport, 60, CSASSIST_APIFLAG_ASSUME_RECONNECT); api = new apiTest(serverhost, serverport, 60, CSASSIST_APIFLAG_ASSUME_RECONNECT|CSASSIST_APIFLAG_NO_REDIRECT); - track = api->connectCSAssist(NULL, game.c_str(), server.c_str()); + track = api->connectCSAssist(nullptr, game.c_str(), server.c_str()); loginFailed = false; std::cout <<"Trying to connect..."<requestNewTicketActivity(NULL, testUID, 0); + track = api->requestNewTicketActivity(nullptr, testUID, 0); else - track = api->requestNewTicketActivity(NULL, testUID, character.c_str()); + track = api->requestNewTicketActivity(nullptr, testUID, character.c_str()); submitted++; break; case CSASSIST_CALL_REGISTERCHARACTER: uid = rand(); - track = api->requestRegisterCharacter(NULL, uid, 0, 0); + track = api->requestRegisterCharacter(nullptr, uid, 0, 0); register_list.push(uid); submitted++; break; case CSASSIST_CALL_GETISSUEHIERARCHY: lang = narrowToWide("en"); - track = api->requestGetIssueHierarchy(NULL, hierarchy.c_str(), lang.c_str()); + track = api->requestGetIssueHierarchy(nullptr, hierarchy.c_str(), lang.c_str()); submitted++; break; case CSASSIST_CALL_CREATETICKET: @@ -597,33 +597,33 @@ while(1) case CSASSIST_CALL_APPENDCOMMENT: comment = narrowToWide("Unicode comment by player."); tid = randomTicketID(); - track = api->requestAppendTicketComment(NULL, tid, testUID, character.c_str(), comment.c_str()); + track = api->requestAppendTicketComment(nullptr, tid, testUID, character.c_str(), comment.c_str()); submitted++; break; case CSASSIST_CALL_GETTICKETBYID: tid = randomTicketID(); - track = api->requestGetTicketByID(NULL, tid, 1); + track = api->requestGetTicketByID(nullptr, tid, 1); submitted++; break; case CSASSIST_CALL_GETTICKETCOMMENTS: tid = randomTicketID(); - track = api->requestGetTicketComments(NULL, tid, 0, (rand() % 100)+1, CSASSIST_OFFSET_START); + track = api->requestGetTicketComments(nullptr, tid, 0, (rand() % 100)+1, CSASSIST_OFFSET_START); submitted++; break; case CSASSIST_CALL_GETTICKET: - track = api->requestGetTicketByCharacter(NULL, testUID, character.c_str(), 0, (rand() % 100)+1, 1); + track = api->requestGetTicketByCharacter(nullptr, testUID, character.c_str(), 0, (rand() % 100)+1, 1); submitted++; break; case CSASSIST_CALL_MARKREAD: tid = randomTicketID(); - track = api->requestMarkTicketRead(NULL, tid); + track = api->requestMarkTicketRead(nullptr, tid); submitted++; break; case CSASSIST_CALL_CANCELTICKET: if (firstTicketID != 0) { comment = narrowToWide("Ticket closed by player"); - track = api->requestCancelTicket(NULL, firstTicketID, testUID, comment.c_str()); + track = api->requestCancelTicket(nullptr, firstTicketID, testUID, comment.c_str()); if (++firstTicketID > lastTicketID) { firstTicketID = 0; @@ -634,33 +634,33 @@ while(1) break; case CSASSIST_CALL_COMMENTCOUNT: tid = randomTicketID(); - track = api->requestGetTicketCommentsCount(NULL, tid); + track = api->requestGetTicketCommentsCount(nullptr, tid); submitted++; break; case CSASSIST_CALL_GETDOCUMENTLIST: // lang = narrowToWide("en"); -// track = api->requestGetDocumentList(NULL, hierarchy.c_str(), lang.c_str()); +// track = api->requestGetDocumentList(nullptr, hierarchy.c_str(), lang.c_str()); // submitted++; break; case CSASSIST_CALL_GETDOCUMENT: -// track = api->requestGetDocument(NULL, 1); +// track = api->requestGetDocument(nullptr, 1); // submitted++; break; case CSASSIST_CALL_GETTICKETXMLBLOCK: tid = randomTicketID(); - track = api->requestGetTicketXMLBlock(NULL, tid); + track = api->requestGetTicketXMLBlock(nullptr, tid); submitted++; break; case CSASSIST_CALL_GETKBARTICLE: /*id = narrowToWide("soe1401"); lang = narrowToWide("en"); - track = api->requestGetKBArticle(NULL, id.c_str(), lang.c_str()); + track = api->requestGetKBArticle(nullptr, id.c_str(), lang.c_str()); submitted++; */break; case CSASSIST_CALL_SEARCHKB: /*Plat_Unicode::String searchStr = narrowToWide("video drivers"); lang = narrowToWide("en"); - track = api->requestSearchKB(NULL, searchStr.c_str(), lang.c_str()); + track = api->requestSearchKB(nullptr, searchStr.c_str(), lang.c_str()); submitted++; */break; } @@ -692,7 +692,7 @@ while(1) { uid = register_list.front(); register_list.pop(); - api->requestUnRegisterCharacter(NULL, uid, 0); + api->requestUnRegisterCharacter(nullptr, uid, 0); submitted++; } cout<<"Waiting for unregisters..."<disconnectCSAssist(NULL); + api->disconnectCSAssist(nullptr); submitted++; while (submitted > received) @@ -718,7 +718,7 @@ while(1) cout<<"Going to delete API now."<::iterator iter = servers.begin(); iter != servers.end(); iter++) { @@ -147,7 +147,7 @@ CSAssistGameAPIcore::CSAssistGameAPIcore(CSAssistGameAPI *api, const char *serve memset(host, 0, size); sprintf(host, "%s", strtok(p, ":")); int res(1); - char *pc = strtok(NULL, ":"); + char *pc = strtok(nullptr, ":"); if (pc) { port = atoi(pc);res++; } //if (res == 2) { @@ -212,7 +212,7 @@ CSAssistGameAPIcore::~CSAssistGameAPIcore() m_connection->Disconnect(false); #endif m_connection->Release(); - m_connection = NULL; + m_connection = nullptr; } m_conManager->Release(); delete m_receiver; @@ -298,13 +298,13 @@ void CSAssistGameAPIcore::SubmitRequest(Request *req, Response *res) { if (req->getType() != CSASSIST_CALL_CONNECTLB) { - m_timeout.push(new timeout(res->getTrack(), time(NULL) + m_userTimeout)); - req->setTimeout(time(NULL) + m_userTimeout); + m_timeout.push(new timeout(res->getTrack(), time(nullptr) + m_userTimeout)); + req->setTimeout(time(nullptr) + m_userTimeout); } else { - m_timeout.push(new timeout(res->getTrack(), time(NULL) + CONNECTLB_TIMEOUT)); - req->setTimeout(time(NULL) + CONNECTLB_TIMEOUT); + m_timeout.push(new timeout(res->getTrack(), time(nullptr) + CONNECTLB_TIMEOUT)); + req->setTimeout(time(nullptr) + CONNECTLB_TIMEOUT); } m_outQueue.push(req); m_pending.insert(pair(res->getTrack(), res)); @@ -316,13 +316,13 @@ void CSAssistGameAPIcore::SubmitRequestInt(Request *req, Response *res) { if (req->getType() != CSASSIST_CALL_CONNECTLB) { - m_timeoutInt.push(new timeout(res->getTrack(), time(NULL) + m_userTimeout)); - req->setTimeout(time(NULL) + m_userTimeout); + m_timeoutInt.push(new timeout(res->getTrack(), time(nullptr) + m_userTimeout)); + req->setTimeout(time(nullptr) + m_userTimeout); } else { - m_timeoutInt.push(new timeout(res->getTrack(), time(NULL) + CONNECTLB_TIMEOUT)); - req->setTimeout(time(NULL) + CONNECTLB_TIMEOUT); + m_timeoutInt.push(new timeout(res->getTrack(), time(nullptr) + CONNECTLB_TIMEOUT)); + req->setTimeout(time(nullptr) + CONNECTLB_TIMEOUT); } m_outQueueInt.push(req); m_pendingInt.insert(pair(res->getTrack(), res)); @@ -390,14 +390,14 @@ void CSAssistGameAPIcore::CSAssistGameCallback(Response *response) if (!m_receiver->m_firstConnection) m_api->OnConnectCSAssist(track, result, userData); // normal application layer connect else - m_api->OnConnectCSAssist(0, result, NULL); // internal re-connect + m_api->OnConnectCSAssist(0, result, nullptr); // internal re-connect m_receiver->m_firstConnection = true; } else { if (m_receiver->m_firstConnection) - m_api->OnConnectRejectedCSAssist(0, result, NULL); + m_api->OnConnectRejectedCSAssist(0, result, nullptr); else m_api->OnConnectRejectedCSAssist(track, result, userData); @@ -413,7 +413,7 @@ void CSAssistGameAPIcore::CSAssistGameCallback(Response *response) m_connection->Disconnect(false); #endif m_connection->Release(); - m_connection = NULL; + m_connection = nullptr; } GetLBHost(); m_receiver->m_firstConnection = true; @@ -436,7 +436,7 @@ void CSAssistGameAPIcore::CSAssistGameCallback(Response *response) m_connection->Disconnect(false); #endif m_connection->Release(); - m_connection = NULL; + m_connection = nullptr; } m_api->OnDisconnectCSAssist(track, result, userData); } @@ -624,7 +624,7 @@ Response * CSAssistGameAPIcore::getPending(CSAssistGameAPITrack track) map::iterator iter; iter = m_pending.find(track); if (iter == m_pending.end()) - return NULL; + return nullptr; return (*iter).second; } @@ -635,7 +635,7 @@ Response * CSAssistGameAPIcore::getPendingInt(CSAssistGameAPITrack track) map::iterator iter; iter = m_pendingInt.find(track); if (iter == m_pendingInt.end()) - return NULL; + return nullptr; return (*iter).second; } @@ -681,22 +681,22 @@ void CSAssistGameAPIcore::Update() // ----- Process timeout queue, send timeout messages when appropriate ----- - while((m_timeout.size() > 0) && ((t = m_timeout.front())->time <= time(NULL))) + while((m_timeout.size() > 0) && ((t = m_timeout.front())->time <= time(nullptr))) { Response *Res = getPending(t->track); //fprintf(stderr, "processing timeouts: track(%u) response(%p)\n", t->track, Res); - if(Res != NULL) + if(Res != nullptr) { CSAssistGameCallback(Res); } m_timeout.pop(); delete t; } - while((m_timeoutInt.size() > 0) && ((t = m_timeoutInt.front())->time <= time(NULL))) + while((m_timeoutInt.size() > 0) && ((t = m_timeoutInt.front())->time <= time(nullptr))) { Response *Res = getPendingInt(t->track); //fprintf(stderr, "processing internal timeouts: track(%u) response(%p)\n", t->track, Res); - if(Res != NULL) + if(Res != nullptr) { CSAssistGameCallback(Res); } @@ -705,14 +705,14 @@ void CSAssistGameAPIcore::Update() } // ----- process timeouts for requests ----- - while ((m_outQueue.size() > 0) && (m_outQueue.front()->getTimeout() <= (unsigned)time(NULL))) + while ((m_outQueue.size() > 0) && (m_outQueue.front()->getTimeout() <= (unsigned)time(nullptr))) { Request *R = m_outQueue.front(); //fprintf(stderr, "processing request timeouts: track(%u) request(%u)\n", R->getTrack(), R->getType()); m_outQueue.pop(); delete R; } - while ((m_outQueueInt.size() > 0) && (m_outQueueInt.front()->getTimeout() <= (unsigned)time(NULL))) + while ((m_outQueueInt.size() > 0) && (m_outQueueInt.front()->getTimeout() <= (unsigned)time(nullptr))) { Request *R = m_outQueueInt.front(); //fprintf(stderr, "processing internal request timeouts: track(%u) request(%u)\n", R->getTrack(), R->getType()); @@ -724,18 +724,18 @@ void CSAssistGameAPIcore::Update() { // API does not have a connection, begin connection handshake process //fprintf(stderr, "Going to connect to %s:%d\n", m_ip.c_str(), m_port); - m_reconnectTimeout = time(NULL) + 5; + m_reconnectTimeout = time(nullptr) + 5; m_connection = m_conManager->EstablishConnection(m_ip.c_str(), m_port); // set connected host/port before changing with GetLBHost. m_connectedIP = m_ip.c_str(); m_connectedPort = m_port; - if (m_connection != NULL) + if (m_connection != nullptr) m_connection->SetHandler(m_receiver); else { - m_api->OnConnectRejectedCSAssist(0, CSASSIST_RESULT_FAIL, NULL); + m_api->OnConnectRejectedCSAssist(0, CSASSIST_RESULT_FAIL, nullptr); // Connection failed. Try getting a new host. GetLBHost(); } @@ -777,7 +777,7 @@ void CSAssistGameAPIcore::Update() else { //fprintf(stderr,"Update(1): timing out response(%p) for track(%u)\n", Res, t->track); - if(Res != NULL) + if(Res != nullptr) { CSAssistGameCallback(Res); } @@ -795,18 +795,18 @@ void CSAssistGameAPIcore::Update() //fprintf(stderr, "Update(2) enter\n"); #ifdef USE_UDP_LIBRARY if((m_connection->GetStatus() == UdpConnection::cStatusDisconnected) || - (m_connection->GetStatus() == UdpConnection::cStatusNegotiating && m_reconnectTimeout < time(NULL))) + (m_connection->GetStatus() == UdpConnection::cStatusNegotiating && m_reconnectTimeout < time(nullptr))) { m_connection->Disconnect(); #else if((m_connection->GetStatus() == TcpConnection::StatusDisconnected) || - (m_connection->GetStatus() == TcpConnection::StatusNegotiating && m_reconnectTimeout < time(NULL))) + (m_connection->GetStatus() == TcpConnection::StatusNegotiating && m_reconnectTimeout < time(nullptr))) { m_connection->Disconnect(false); #endif m_connection->Release(); - m_connection = NULL; + m_connection = nullptr; //fprintf(stderr, "Update(2): Disconnected!! m_connectState=%u\n", m_connectState); switch(m_connectState) @@ -835,7 +835,7 @@ void CSAssistGameAPIcore::Update() //if (t-> Response *Res = getPendingInt(t->track); //fprintf(stderr, "Update(2) timing out connect: track(%u) response(%p)\n", t->track, Res); - if(Res != NULL) + if(Res != nullptr) { Res->setResult(CSASSIST_RESULT_FAIL); CSAssistGameCallback(Res); @@ -964,7 +964,7 @@ void CSAssistGameAPIcore::Update() Response *CSAssistGameAPIcore::createServerResponse(short msgtype) //------------------------------------------------------------- { - Response *res = NULL; + Response *res = nullptr; switch (msgtype) { diff --git a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistgameapicore.h b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistgameapicore.h index 0f642423..d7dc8ac4 100755 --- a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistgameapicore.h +++ b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistgameapicore.h @@ -166,11 +166,11 @@ private: void GetLBHost(); void OnConnectLB(unsigned track, unsigned result, std::string serverName, unsigned serverPort, Request *, Response *); #ifdef USE_UDP_LIBRARY - inline bool actuallyConnected() { return (bool)((m_connection != NULL) && (m_connection->GetStatus() == UdpConnection::cStatusConnected)); } + inline bool actuallyConnected() { return (bool)((m_connection != nullptr) && (m_connection->GetStatus() == UdpConnection::cStatusConnected)); } UdpManager *m_conManager; UdpConnection *m_connection; #else - inline bool actuallyConnected() { return (bool)((m_connection != NULL) && (m_connection->GetStatus() == TcpConnection::StatusConnected)); } + inline bool actuallyConnected() { return (bool)((m_connection != nullptr) && (m_connection->GetStatus() == TcpConnection::StatusConnected)); } TcpManager *m_conManager; TcpConnection *m_connection; #endif diff --git a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistreceiver.cpp b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistreceiver.cpp index 5aa9430b..a1b03cf9 100755 --- a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistreceiver.cpp +++ b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistreceiver.cpp @@ -99,7 +99,7 @@ void CSAssistReceiver::OnTerminated(TcpConnection *con) break; case CONNECT_BACKEND_CONNECTED_AND_AUTHED: - m_api->m_api->OnDisconnectCSAssist(0, CSASSIST_RESULT_SERVER_DISCONNECT, NULL); + m_api->m_api->OnDisconnectCSAssist(0, CSASSIST_RESULT_SERVER_DISCONNECT, nullptr); case CONNECT_BACKEND_CONNECTED: m_api->GetLBHost(); case CONNECT_BACKEND_NEGOTIATING: m_api->m_connectState = CONNECT_BACKEND_DISCONNECTED; break; @@ -110,7 +110,7 @@ void CSAssistReceiver::OnTerminated(TcpConnection *con) else { if (m_api->m_connectState == CONNECT_BACKEND_CONNECTED_AND_AUTHED) - m_api->m_api->OnDisconnectCSAssist(0, CSASSIST_RESULT_SERVER_DISCONNECT, NULL); + m_api->m_api->OnDisconnectCSAssist(0, CSASSIST_RESULT_SERVER_DISCONNECT, nullptr); m_api->m_connectState = CONNECT_BACKEND_DISCONNECTED; m_api->GetLBHost(); } @@ -156,7 +156,7 @@ void CSAssistReceiver::OnRoutePacket(TcpConnection *con, const uchar *data, int { res = m_api->getPending(track); } - if(res != NULL) + if(res != nullptr) { res->init(type, track, result); res->decode(iter); diff --git a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssisttest/test.cpp b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssisttest/test.cpp index c172511e..efbc0db4 100755 --- a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssisttest/test.cpp +++ b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssisttest/test.cpp @@ -40,7 +40,7 @@ Plat_Unicode::String globalArticleID; //---------------------------------------------- CSAssistUnicodeChar *get_c_str(Plat_Unicode::String s) // This replaces c_str() by allocating a new buffer, erasing it, and then -// using the non-null terminated data() to copy the data into the buffer. +// using the non-nullptr terminated data() to copy the data into the buffer. //---------------------------------------------- { unsigned length = s.size() + 1; @@ -94,7 +94,7 @@ void DisplayTicket(const CSAssistGameAPITicket *t) std::cout << wideToNarrow(details) << "\n***\n"; } else - std::cout << "***Ticket IS NULL! ***\n"; + std::cout << "***Ticket IS nullptr! ***\n"; } //--------------------------------------------- @@ -110,7 +110,7 @@ void DisplayComment(const CSAssistGameAPITicketComment *t) std::cout << "\n " << wideToNarrow(comment) << "\n"; } else - std::cout << "***Comment IS NULL! ***\n"; + std::cout << "***Comment IS nullptr! ***\n"; } //--------------------------------------------- @@ -132,7 +132,7 @@ void DisplayDocumentHeader(const CSAssistGameAPIDocumentHeader *doc) std::cout << ", Modified: " << date2 << "\n"; } else - std::cout << "***Document Header IS NULL! ***\n"; + std::cout << "***Document Header IS nullptr! ***\n"; } //--------------------------------------------- @@ -148,7 +148,7 @@ void DisplaySearchResult(const CSAssistGameAPISearchResult *doc) std::cout << ", Title: " << wideToNarrow(title) << "\n"; } else - std::cout << "***Search Result IS NULL! ***\n"; + std::cout << "***Search Result IS nullptr! ***\n"; } @@ -360,7 +360,7 @@ void apiTest::OnRequestGameLocation(const CSAssistGameAPITrack sourceTrack, cons CSAssistUnicodeChar *rawLoc = get_c_str(loc); std::cout << "Request Game Location: Source Track(" << sourceTrack << "), uid(" << uid << "), character("; std::cout << wideToNarrow(charry) << "), CSR UID(" << CSRUID << ")\n"; - api->replyGameLocation(NULL, sourceTrack, uid, rawCharry, CSRUID, rawLoc); + api->replyGameLocation(nullptr, sourceTrack, uid, rawCharry, CSRUID, rawLoc); delete [] rawCharry; delete [] rawLoc; } diff --git a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/packdata.cpp b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/packdata.cpp index 4c267fd4..9a8ef45e 100755 --- a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/packdata.cpp +++ b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/packdata.cpp @@ -30,7 +30,7 @@ using namespace Plat_Unicode; //---------------------------------------------- CSAssistUnicodeChar *get_c_str(Plat_Unicode::String s) // This replaces c_str() by allocating a new buffer, erasing it, and then -// using the non-null terminated data() to copy the data into the buffer. +// using the non-nullptr terminated data() to copy the data into the buffer. //---------------------------------------------- { unsigned length = s.size() + 1; diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/Archive.cpp b/external/3rd/library/soePlatform/CSAssist/utils/Base/Archive.cpp index 1afab822..d55481a4 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/Archive.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/Archive.cpp @@ -94,7 +94,7 @@ namespace Base ByteStream::ByteStream() : allocatedSize(0), beginReadIterator(), - data(NULL), + data(nullptr), size(0), lastPutSize(0) { @@ -211,7 +211,7 @@ namespace Base if(data->size < allocatedSize) { unsigned char * tmp = new unsigned char[newSize]; - if(data->buffer != NULL) + if(data->buffer != nullptr) memcpy(tmp, data->buffer, size); delete[] data->buffer; data->buffer = tmp; diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/AutoLog.cpp b/external/3rd/library/soePlatform/CSAssist/utils/Base/AutoLog.cpp index 687381ed..4a8dc976 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/AutoLog.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/AutoLog.cpp @@ -35,7 +35,7 @@ bool CAutoLog::Open(const char * filename) //------------------------------------- { - if( NULL == filename) + if( nullptr == filename) return false; if (pFilename) @@ -45,13 +45,13 @@ bool CAutoLog::Open(const char * filename) // Sanitize slashes char *ptr; - while ((ptr = strchr(pFilename,WRONGSLASH)) != NULL) + while ((ptr = strchr(pFilename,WRONGSLASH)) != nullptr) *ptr = SLASHCHAR[0]; char strPath[1024]; strcpy(strPath,pFilename); ptr = strrchr(strPath, SLASHCHAR[0]); - if (ptr != NULL) + if (ptr != nullptr) { *ptr = 0; @@ -59,11 +59,11 @@ bool CAutoLog::Open(const char * filename) char curdir[128]; // remember current directory - if( getcwd(curdir,sizeof(curdir)) == NULL ) + if( getcwd(curdir,sizeof(curdir)) == nullptr ) { fprintf(stderr,"CAutoLog::Archive failed to get current directory!\n"); free(pFilename); - pFilename = NULL; + pFilename = nullptr; return false; // error, can't proceed } @@ -74,7 +74,7 @@ bool CAutoLog::Open(const char * filename) { fprintf(stderr,"CAutoLog::Archive failed to make directory: %s\n", strPath); free(pFilename); - pFilename = NULL; + pFilename = nullptr; return false; // error, can't proceed } } @@ -94,7 +94,7 @@ bool CAutoLog::Open(const char * filename) { fprintf(stderr,"CAutoLog::Archive failed to make directory: %s\n", strPath); free(pFilename); - pFilename = NULL; + pFilename = nullptr; return false; // error, can't proceed } } @@ -103,7 +103,7 @@ bool CAutoLog::Open(const char * filename) pFile = fopen(pFilename,"a+"); - if( pFile == NULL || pFile == (FILE *)-1) + if( pFile == nullptr || pFile == (FILE *)-1) { //fprintf(stderr,"CAutoLog::Open failed to open log file: %s\n",pFilename); Close(); @@ -123,7 +123,7 @@ bool CAutoLog::Open(const char * filename) void CAutoLog::Close(void) //------------------------------------- { - if( pFile != (FILE *)-1 && pFile != NULL) + if( pFile != (FILE *)-1 && pFile != nullptr) { fclose(pFile); } @@ -131,7 +131,7 @@ void CAutoLog::Close(void) free(pFilename); - pFilename = NULL; + pFilename = nullptr; } //------------------------------------- @@ -194,7 +194,7 @@ void CAutoLog::LogDebug(char * format, ...) void CAutoLog::Log(eLogLevel severity, char *fmt, ...) //------------------------------------- { - if (pFile == (FILE *)-1 || pFile == NULL) + if (pFile == (FILE *)-1 || pFile == nullptr) { //fprintf(stderr,"CAutoLog::Log called with no file open!\n"); return; @@ -250,7 +250,7 @@ void CAutoLog::Log(eLogLevel severity, char *fmt, ...) void CAutoLog::Archive(void) //------------------------------------- { - if( pFile == (FILE *)-1 || pFile == NULL) + if( pFile == (FILE *)-1 || pFile == nullptr) { //fprintf(stderr,"CAutoLog::Archive called with no file open!\n"); return; @@ -281,7 +281,7 @@ void CAutoLog::Archive(void) strcpy(strCurrent,pFilename); pCurrent = strrchr(strCurrent, SLASHCHAR[0]); - if (pCurrent != NULL) + if (pCurrent != nullptr) *pCurrent = 0; else sprintf(strCurrent,"."); @@ -290,7 +290,7 @@ void CAutoLog::Archive(void) #ifdef WIN32 // remember current directory - if( getcwd(curdir,sizeof(curdir)) == NULL ) + if( getcwd(curdir,sizeof(curdir)) == nullptr ) { fprintf(stderr,"CAutoLog::Archive failed to get current directory!\n"); return; // error, can't proceed @@ -324,7 +324,7 @@ void CAutoLog::Archive(void) #endif pCurrent = strrchr(pFilename, SLASHCHAR[0]); - if (pCurrent == NULL) + if (pCurrent == nullptr) pCurrent = pFilename; else pCurrent++; diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/AutoLog.h b/external/3rd/library/soePlatform/CSAssist/utils/Base/AutoLog.h index 0a90a774..18871c7f 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/AutoLog.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/AutoLog.h @@ -92,14 +92,14 @@ namespace Base //------------------------------------- inline CAutoLog::CAutoLog() { - pFilename = NULL; + pFilename = nullptr; pFile = (FILE *)-1; } //------------------------------------- inline CAutoLog::CAutoLog(const char * file) { - pFilename = NULL; + pFilename = nullptr; pFile = (FILE *)-1; Open(file); } diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/Config.cpp b/external/3rd/library/soePlatform/CSAssist/utils/Base/Config.cpp index a5b977fb..97abcd41 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/Config.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/Config.cpp @@ -28,7 +28,7 @@ bool CConfig::LoadFile(char * file) // open file fp = fopen(file, "r"); - if (fp == NULL || fp == (FILE *)-1) + if (fp == nullptr || fp == (FILE *)-1) { //fprintf(stderr,"Failed to open config file %s!",file); return false; @@ -72,21 +72,21 @@ void CConfig::UnloadFile(void) //----------------------------------- { delete[] pConfig; - pConfig = NULL; + pConfig = nullptr; } //----------------------------------- /// finds a key of the config in memory // key argument is case-insensitive, but must be upper case in config file -// Returns true for success (passing NULL is a special case returned as success) +// Returns true for success (passing nullptr is a special case returned as success) bool CConfig::FindKey(char *key) //----------------------------------- { - if (pConfig == NULL) + if (pConfig == nullptr) return false; // special case...continue with existing key - if (key == NULL) + if (key == nullptr) return true; // form the search key @@ -97,12 +97,12 @@ bool CConfig::FindKey(char *key) // find the key heading pCursor = strstr(pConfig,strBuffer); - if (pCursor==NULL) + if (pCursor==nullptr) return false; // find the closing bracket of key heading pCursor = strchr(pCursor,']'); - if (pCursor==NULL) + if (pCursor==nullptr) return false; pCursor++; @@ -111,7 +111,7 @@ bool CConfig::FindKey(char *key) //----------------------------------- /// extract a number from the config string -// pass the key to find the first number in the list, else NULL to find the next number in the list +// pass the key to find the first number in the list, else nullptr to find the next number in the list // returns 0 if no number is found, else returns the number long CConfig::GetLong(char *key) //----------------------------------- @@ -134,20 +134,20 @@ long CConfig::GetLong(char *key) //----------------------------------- /// extract string (in double-quotes) from the list. -// pass the key to find the first string in the list, else NULL to find the next string in the list -// returns NULL if no string found, else returns a temporary copy of the string (without quotes) +// pass the key to find the first string in the list, else nullptr to find the next string in the list +// returns nullptr if no string found, else returns a temporary copy of the string (without quotes) char * CConfig::GetString(char *key) //----------------------------------- { if (!FindKey(key)) - return NULL; + return nullptr; // look for start of string or end of key while (*pCursor && *pCursor != '"' && *pCursor != '[') pCursor++; if (*(pCursor++) != '"') - return NULL; + return nullptr; // until closing quote int c = 0; @@ -161,7 +161,7 @@ char * CConfig::GetString(char *key) } } - return NULL; + return nullptr; } diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/Config.h b/external/3rd/library/soePlatform/CSAssist/utils/Base/Config.h index 864506f3..6f6dc376 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/Config.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/Config.h @@ -10,7 +10,7 @@ ; list of strings, with code example # config.FindKey("NUMBERS"); -# while (number = config.GetLong(NULL)) +# while (number = config.GetLong(nullptr)) # YourHandleNumber(number); [NUMBERS] 100 200, 300 ; formatting is very flexible as long as numbers are delimited by non-numbers @@ -23,7 +23,7 @@ ; list of strings, with code example # config.FindKey("HOSTS"); -# while (string = config.GetString(NULL)) +# while (string = config.GetString(nullptr)) # YourHandleString(string); [HOSTS] "127.0.0.1:5999" @@ -68,16 +68,16 @@ namespace Base // returns TRUE if key is found. bool FindKey(char *key); - // extract string from config. If key is NULL, extract next string in list, else extract first string. - // if key was not found, returns NULL - char * GetString(char *key = NULL); + // extract string from config. If key is nullptr, extract next string in list, else extract first string. + // if key was not found, returns nullptr + char * GetString(char *key = nullptr); - // extract number from config. If key is NULL, extract next number in list, else extract first number. + // extract number from config. If key is nullptr, extract next number in list, else extract first number. // if key was not found, returns 0 - long GetLong(char *key = NULL); // extract number from config. + long GetLong(char *key = nullptr); // extract number from config. // indicate if config file has been loaded - inline bool FileLoaded() { return pConfig == NULL ? false : true; } + inline bool FileLoaded() { return pConfig == nullptr ? false : true; } private: char * pConfig; // pointer to file memory @@ -87,14 +87,14 @@ namespace Base inline CConfig::CConfig() { - pConfig = NULL; - pCursor = NULL; + pConfig = nullptr; + pCursor = nullptr; } inline CConfig::CConfig(char * file) { - pConfig = NULL; - pCursor = NULL; + pConfig = nullptr; + pCursor = nullptr; LoadFile(file); } diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/Logger.cpp b/external/3rd/library/soePlatform/CSAssist/utils/Base/Logger.cpp index 1ce102af..bf3dcc39 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/Logger.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/Logger.cpp @@ -98,7 +98,7 @@ Logger::Logger(const char *programName, void Logger::LoggerInit(const char *programName) { char buf[1024]; - FILE *logDir = NULL; + FILE *logDir = nullptr; if (0 != (m_logType & eUseLocalFile)) { @@ -107,13 +107,13 @@ void Logger::LoggerInit(const char *programName) { cmkdir(m_dirPrefix.c_str(), 0755); } - else if(logDir != NULL) + else if(logDir != nullptr) { fclose(logDir); } tm now; - time_t t = time(NULL); + time_t t = time(nullptr); LOGGER_GET_CURR_TIME(now, t); @@ -131,7 +131,7 @@ void Logger::LoggerInit(const char *programName) { cmkdir(buf, 0755); } - else if(logDir != NULL) + else if(logDir != nullptr) { fclose(logDir); } @@ -300,7 +300,7 @@ void Logger::logSimple(unsigned logenum, int level, const char *message) { return; } - time_t t = time(NULL); + time_t t = time(nullptr); LogInfo *info = (*iter).second; if(level >= info->level) { @@ -377,7 +377,7 @@ void Logger::logSimpleWithSys(unsigned logenum, unsigned priority, int level, co { return; } - time_t t = time(NULL); + time_t t = time(nullptr); LogInfo *info = (*iter).second; if(level >= info->level) @@ -447,7 +447,7 @@ void Logger::log(unsigned logenum, int level, const char *message, ...) // ensure that the buf does not contain any '%' characters. // prevent crash problem char *rv; - while((rv = strchr(buf, '%')) != NULL) + while((rv = strchr(buf, '%')) != nullptr) { *rv = ' '; // replace with space } @@ -478,7 +478,7 @@ void Logger::logWithSys(unsigned logenum, unsigned priority, int level, const ch { return; } - time_t t = time(NULL); + time_t t = time(nullptr); LogInfo *info = (*iter).second; if(level >= info->level) @@ -536,14 +536,14 @@ void Logger::logWithSys(unsigned logenum, unsigned priority, int level, const ch void Logger::rollDate(time_t t) { char buf[80]; - FILE *logDir = NULL; + FILE *logDir = nullptr; logDir = fopen(m_dirPrefix.c_str(), "r+"); if(errno == ENOENT) { cmkdir(m_dirPrefix.c_str(), 0755); } - else if(logDir != NULL) + else if(logDir != nullptr) { fclose(logDir); } @@ -559,7 +559,7 @@ void Logger::rollDate(time_t t) { cmkdir(buf, 0755); } - else if(logDir != NULL) + else if(logDir != nullptr) { fclose(logDir); } @@ -643,7 +643,7 @@ void Logger::rollLog(LogInfo *logInfo) { std::string newLogName; char timeStampBuffer[256]; - time_t t = time(NULL); + time_t t = time(nullptr); tm now; int r; int nTries = 10; diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/Statistics.h b/external/3rd/library/soePlatform/CSAssist/utils/Base/Statistics.h index 18e0579e..0856034b 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/Statistics.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/Statistics.h @@ -34,9 +34,9 @@ namespace Base bool commit = false; if (!mLastSampleTime) - mLastSampleTime = time(NULL); + mLastSampleTime = time(nullptr); - if (!mSampleFrequency || mLastSampleTime + mSampleFrequency < (unsigned)time(NULL)) + if (!mSampleFrequency || mLastSampleTime + mSampleFrequency < (unsigned)time(nullptr)) { mSampleTotal++; mAggregateTotal += value; diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/TemplateObjectAllocator.h b/external/3rd/library/soePlatform/CSAssist/utils/Base/TemplateObjectAllocator.h index 40227673..ed1a7937 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/TemplateObjectAllocator.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/TemplateObjectAllocator.h @@ -93,7 +93,7 @@ namespace Base void Destroy(TYPE *object) { - if (object == NULL) + if (object == nullptr) return; #ifdef USE_ALLOCATOR_MUTEX @@ -142,7 +142,7 @@ namespace Base void FastDestroy(TYPE *object) { - if (object == NULL) + if (object == nullptr) return; object->~TYPE(); diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/WideString.h b/external/3rd/library/soePlatform/CSAssist/utils/Base/WideString.h index 775f9713..28159b18 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/WideString.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/WideString.h @@ -94,12 +94,12 @@ namespace ucs2 } //////////////////////////////////////// - // target string is a null-terminated C string + // target string is a nullptr-terminated C string inline string::string(const char * copy) : mLength(0), mData(8,0) { - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!copy) { return; @@ -111,12 +111,12 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *copy++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; } //////////////////////////////////////// - // target string is a C string that may or may not include null characters + // target string is a C string that may or may not include nullptr characters inline string::string(const std::string & copy) : mLength(copy.length()), mData(8,0) @@ -126,17 +126,17 @@ namespace ucs2 // (2) perform transform to copy the narrow string to our // wide string std::transform(copy.begin(), copy.end(), mData.begin(), NarrowToWide); - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength] = 0; } //////////////////////////////////////// - // target string is a wide null-terminated C string + // target string is a wide nullptr-terminated C string inline string::string(const char_type * copy) : mLength(0), mData(8,0) { - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!copy) { return; @@ -148,7 +148,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *copy++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; } @@ -169,7 +169,7 @@ namespace ucs2 inline string & string::operator=(const char * rhs) { mLength = 0; - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!rhs) { mData[0] = 0; @@ -182,7 +182,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } @@ -195,7 +195,7 @@ namespace ucs2 // (2) perform transform to copy the narrow string to our // wide string std::transform(rhs.begin(), rhs.end(), mData.begin(), NarrowToWide); - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength] = 0; return *this; } @@ -203,7 +203,7 @@ namespace ucs2 inline string & string::operator=(const char_type * rhs) { mLength = 0; - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!rhs) { mData[0] = 0; @@ -216,7 +216,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } @@ -235,7 +235,7 @@ namespace ucs2 inline string & string::operator+=(const char * rhs) { - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!rhs) { return *this; @@ -247,7 +247,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } @@ -259,7 +259,7 @@ namespace ucs2 // (2) perform transform to copy the narrow string to our // wide string std::transform(rhs.begin(), rhs.end(), mData.begin()+mLength, NarrowToWide); - // (3) ensure null termination + // (3) ensure nullptr termination mLength += rhs.length(); mData[mLength] = 0; return *this; @@ -267,7 +267,7 @@ namespace ucs2 inline string & string::operator+=(const char_type * rhs) { - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!rhs) { return *this; @@ -279,7 +279,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } @@ -388,7 +388,7 @@ namespace ucs2 inline string & string::assign(const char_type * rhs) { mLength = 0; - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!rhs) { mData[0] = 0; @@ -401,7 +401,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } @@ -409,7 +409,7 @@ namespace ucs2 inline string & string::assign(const char_type * rhs, size_type count) { mLength = 0; - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!rhs) { mData[0] = 0; @@ -422,7 +422,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } @@ -463,7 +463,7 @@ namespace ucs2 inline string & string::assign(const char_type * first, const char_type * last) { mLength = 0; - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!first || !last) { mData[0] = 0; @@ -476,14 +476,14 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *first++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } inline string & string::append(const char_type * rhs) { - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!rhs) { return *this; @@ -495,14 +495,14 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } inline string & string::append(const char_type * rhs, size_type count) { - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!rhs) { return *this; @@ -514,7 +514,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } @@ -558,7 +558,7 @@ namespace ucs2 inline string & string::append(const char_type * first, const char_type * last) { - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!first || !last) { return *this; @@ -570,7 +570,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *first++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/BlockAllocator.cpp b/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/BlockAllocator.cpp index 4cefb9e7..29d91074 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/BlockAllocator.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/BlockAllocator.cpp @@ -12,7 +12,7 @@ namespace Base { for(unsigned i = 0; i < 31; i++) { - m_blocks[i] = NULL; + m_blocks[i] = nullptr; } } @@ -21,7 +21,7 @@ namespace Base // free all allocated memory blocks for(unsigned i = 0; i < 31; i++) { - while(m_blocks[i] != NULL) + while(m_blocks[i] != nullptr) { unsigned *tmp = m_blocks[i]; m_blocks[i] = (unsigned *)*m_blocks[i]; @@ -36,7 +36,7 @@ namespace Base void *BlockAllocator::getBlock(unsigned bytes) { unsigned accum = 16, bits = 16; - unsigned *handle = NULL; + unsigned *handle = nullptr; // Perform a binary search looking for the highest bit. @@ -96,7 +96,7 @@ namespace Base void BlockAllocator::returnBlock(unsigned *handle) { - // C++ allows for safe deletion of a NULL pointer + // C++ allows for safe deletion of a nullptr pointer if(handle) { // Update the allocator linked list, insert this entry at the head diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/Event.cpp b/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/Event.cpp index a3cce3b1..72190595 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/Event.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/Event.cpp @@ -26,8 +26,8 @@ namespace Base mCond(), mThreadCount(0) { - pthread_mutex_init(&mMutex, NULL); - pthread_cond_init(&mCond, NULL); + pthread_mutex_init(&mMutex, nullptr); + pthread_cond_init(&mCond, nullptr); } CEvent::~CEvent() @@ -74,7 +74,7 @@ namespace Base struct timeval now; struct timespec abs_timeout; - gettimeofday(&now, NULL); + gettimeofday(&now, nullptr); abs_timeout.tv_sec = now.tv_sec + timeout/1000; abs_timeout.tv_nsec = now.tv_usec * 1000 + (timeout%1000)*1000000; abs_timeout.tv_sec += abs_timeout.tv_nsec / 1000000000; diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/Thread.cpp b/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/Thread.cpp index 2bc4f26b..5cca2017 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/Thread.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/Thread.cpp @@ -76,8 +76,8 @@ namespace Base CThreadPool::CMember::CMember(CThreadPool * parent) : mParent(parent), - mFunction(NULL), - mArgument(NULL), + mFunction(nullptr), + mArgument(nullptr), mSemaphore() { StartThread(); @@ -116,8 +116,8 @@ namespace Base if (mFunction) { mFunction(mArgument); - mArgument = NULL; - mFunction = NULL; + mArgument = nullptr; + mFunction = nullptr; } else if (mParent->OnDestory(this)) mThreadContinue = false; @@ -172,7 +172,7 @@ namespace Base } //////////////////////////////////////// - // (3) Delete the null member threads + // (3) Delete the nullptr member threads mMutex.Lock(); while (!mNullMember.empty()) { @@ -199,7 +199,7 @@ namespace Base } //////////////////////////////////////// - // (2) Delete any null member threads. + // (2) Delete any nullptr member threads. while (!mNullMember.empty()) { delete mNullMember.front(); diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/serialize.h b/external/3rd/library/soePlatform/CSAssist/utils/Base/serialize.h index 650681b5..ed38802a 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/serialize.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/serialize.h @@ -501,8 +501,8 @@ namespace soe } else { - //find null terminator, if don't find it before maxLen, then err - const unsigned char *strEnd = NULL; + //find nullptr terminator, if don't find it before maxLen, then err + const unsigned char *strEnd = nullptr; unsigned strLen = 0; for (;strLenm_next; - tmp->m_next = NULL; + tmp->m_next = nullptr; m_numAvailBlocks--; return(tmp); } @@ -56,7 +56,7 @@ void TcpBlockAllocator::returnBlock(data_block *b) void TcpBlockAllocator::realloc() { - data_block *tmp = NULL, *cursor = NULL; + data_block *tmp = nullptr, *cursor = nullptr; tmp = new data_block; m_numAvailBlocks++; cursor = tmp; diff --git a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpConnection.cpp b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpConnection.cpp index 97ca7fd1..c74eaca4 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpConnection.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpConnection.cpp @@ -11,28 +11,28 @@ namespace NAMESPACE //used when want to open new connection with this socket TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, const IPAddress &destIP, short destPort, unsigned timeout) -: m_nextConnection(NULL), - m_prevConnection(NULL), +: m_nextConnection(nullptr), + m_prevConnection(nullptr), m_socket(INVALID_SOCKET), - m_nextKeepAliveConnection(NULL), - m_prevKeepAliveConnection(NULL), + m_nextKeepAliveConnection(nullptr), + m_prevKeepAliveConnection(nullptr), m_aliveListId(tcpManager->m_aliveList.m_listID), - m_nextRecvDataConnection(NULL), - m_prevRecvDataConnection(NULL), + m_nextRecvDataConnection(nullptr), + m_prevRecvDataConnection(nullptr), m_recvDataListId(tcpManager->m_dataList.m_listID), m_manager(tcpManager), m_status(StatusNegotiating), - m_handler(NULL), + m_handler(nullptr), m_destIP(destIP), m_destPort(destPort), m_refCount(0), m_sendAllocator(sendAlloc), - m_head(NULL), - m_tail(NULL), + m_head(nullptr), + m_tail(nullptr), m_bytesRead(0), m_bytesNeeded(0), m_params(params), - m_recvBuff(NULL), + m_recvBuff(nullptr), m_connectTimeout(timeout), m_connectTimer(), m_wasConRemovedFromMgr(false) @@ -94,28 +94,28 @@ TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAllo //used when server mode creates new connection object representing a connect request TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, SOCKET socket, const IPAddress &destIP, short destPort) -: m_nextConnection(NULL), - m_prevConnection(NULL), +: m_nextConnection(nullptr), + m_prevConnection(nullptr), m_socket(socket), - m_nextKeepAliveConnection(NULL), - m_prevKeepAliveConnection(NULL), + m_nextKeepAliveConnection(nullptr), + m_prevKeepAliveConnection(nullptr), m_aliveListId(tcpManager->m_aliveList.m_listID), - m_nextRecvDataConnection(NULL), - m_prevRecvDataConnection(NULL), + m_nextRecvDataConnection(nullptr), + m_prevRecvDataConnection(nullptr), m_recvDataListId(tcpManager->m_dataList.m_listID), m_manager(tcpManager), m_status(StatusConnected), - m_handler(NULL), + m_handler(nullptr), m_destIP(destIP), m_destPort(destPort), m_refCount(0), m_sendAllocator(sendAlloc), - m_head(NULL), - m_tail(NULL), + m_head(nullptr), + m_tail(nullptr), m_bytesRead(0), m_bytesNeeded(0), m_params(params), - m_recvBuff(NULL), + m_recvBuff(nullptr), m_connectTimeout(0), m_connectTimer(), m_wasConRemovedFromMgr(false) @@ -205,7 +205,7 @@ int TcpConnection::finishConnect() t.tv_sec = 0; t.tv_usec = 0; - int err = select(m_socket + 1, NULL, &wrSet, NULL, &t); + int err = select(m_socket + 1, nullptr, &wrSet, nullptr, &t); if (err == 0) { @@ -300,7 +300,7 @@ TcpConnection::~TcpConnection() { delete [] m_recvBuff; - while(m_head != NULL) + while(m_head != nullptr) { data_block *tmp = m_head; m_head = m_head->m_next; @@ -324,22 +324,22 @@ void TcpConnection::Send(const char *data, unsigned int dataLen) { m_aliveListId = m_manager->m_keepAliveList.m_listID; - if (m_prevKeepAliveConnection != NULL) + if (m_prevKeepAliveConnection != nullptr) m_prevKeepAliveConnection->m_nextKeepAliveConnection = m_nextKeepAliveConnection; - if (m_nextKeepAliveConnection != NULL) + if (m_nextKeepAliveConnection != nullptr) m_nextKeepAliveConnection->m_prevKeepAliveConnection = m_prevKeepAliveConnection; if (m_manager->m_keepAliveList.m_beginList == this) m_manager->m_keepAliveList.m_beginList = m_nextKeepAliveConnection; m_nextKeepAliveConnection = m_manager->m_aliveList.m_beginList; - m_prevKeepAliveConnection = NULL; - if (m_manager->m_aliveList.m_beginList != NULL) + m_prevKeepAliveConnection = nullptr; + if (m_manager->m_aliveList.m_beginList != nullptr) m_manager->m_aliveList.m_beginList->m_prevKeepAliveConnection = this; m_manager->m_aliveList.m_beginList = this; } - data_block *work = NULL; + data_block *work = nullptr; // this connection has no send buffer. Get a block if(!m_tail) @@ -464,16 +464,16 @@ int TcpConnection::processIncoming() { m_recvDataListId = m_manager->m_noDataList.m_listID; - if (m_prevRecvDataConnection != NULL) + if (m_prevRecvDataConnection != nullptr) m_prevRecvDataConnection->m_nextRecvDataConnection = m_nextRecvDataConnection; - if (m_nextRecvDataConnection != NULL) + if (m_nextRecvDataConnection != nullptr) m_nextRecvDataConnection->m_prevRecvDataConnection = m_prevRecvDataConnection; if (m_manager->m_noDataList.m_beginList == this) m_manager->m_noDataList.m_beginList = m_nextRecvDataConnection; m_nextRecvDataConnection = m_manager->m_dataList.m_beginList; - m_prevRecvDataConnection = NULL; - if (m_manager->m_dataList.m_beginList != NULL) + m_prevRecvDataConnection = nullptr; + if (m_manager->m_dataList.m_beginList != nullptr) m_manager->m_dataList.m_beginList->m_prevRecvDataConnection = this; m_manager->m_dataList.m_beginList = this; } @@ -619,7 +619,7 @@ int TcpConnection::processOutgoing() int sendError = 1; - // If m_head is not null, then this connection has something to send + // If m_head is not nullptr, then this connection has something to send if(m_head) diff --git a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpConnection.h b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpConnection.h index 07eb4f42..92d631d1 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpConnection.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpConnection.h @@ -50,7 +50,7 @@ public: * connection is disconnected, you simply need to derive your class * (multiply if necessary) from TcpConnectionHandler, then you can use * this method to set the object the TcpConnection will call as appropriate. - * default = NULL (no callbacks made) + * default = nullptr (no callbacks made) * * @param handler The object which will be called for notifications. */ diff --git a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpManager.cpp b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpManager.cpp index 29d51de0..86778910 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpManager.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpManager.cpp @@ -41,14 +41,14 @@ TcpManager::TcpParams::TcpParams(const TcpParams &cpy) } TcpManager::TcpManager(const TcpParams ¶ms) -: m_handler(NULL), - m_keepAliveList(NULL, 1), - m_aliveList(NULL, 2), - m_noDataList(NULL, 1), - m_dataList(NULL, 2), +: m_handler(nullptr), + m_keepAliveList(nullptr, 1), + m_aliveList(nullptr, 2), + m_noDataList(nullptr, 1), + m_dataList(nullptr, 2), m_params(params), m_refCount(1), - m_connectionList(NULL), + m_connectionList(nullptr), m_connectionListCount(0), m_socket(INVALID_SOCKET), m_boundAsServer(false), @@ -86,7 +86,7 @@ TcpManager::~TcpManager() close(m_socket); #endif } - while (m_connectionList != NULL) + while (m_connectionList != nullptr) { TcpConnection *con = m_connectionList; m_connectionList = m_connectionList->m_nextConnection; @@ -162,7 +162,7 @@ bool TcpManager::BindAsServer() { struct hostent * lphp; lphp = gethostbyname(m_params.bindAddress); - if (lphp != NULL) + if (lphp != nullptr) addr_loc.sin_addr.s_addr = ((struct in_addr *)(lphp->h_addr))->s_addr; } else @@ -187,7 +187,7 @@ bool TcpManager::BindAsServer() TcpConnection *TcpManager::acceptClient() { - TcpConnection *newConn = NULL; + TcpConnection *newConn = nullptr; if (m_boundAsServer && m_connectionListCount < m_params.maxConnections) { @@ -201,7 +201,7 @@ TcpConnection *TcpManager::acceptClient() { newConn = new TcpConnection(this, &m_allocator, m_params, sock, IPAddress(addr.sin_addr.s_addr), ntohs(addr.sin_port)); addNewConnection(newConn); - if (m_handler != NULL) + if (m_handler != nullptr) { m_handler->OnConnectRequest(newConn); } @@ -226,8 +226,8 @@ SOCKET TcpManager::getMaxFD() if (m_boundAsServer) maxfd = m_socket+1; - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) { next = con->m_nextConnection; if (con->GetStatus() != TcpConnection::StatusDisconnected && con->m_socket > maxfd) @@ -241,8 +241,8 @@ SOCKET TcpManager::getMaxFD() TcpConnection *TcpManager::getConnection(SOCKET fd) { - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) { next = con->m_nextConnection; if (con->m_socket == fd) @@ -251,7 +251,7 @@ TcpConnection *TcpManager::getConnection(SOCKET fd) } } //if get here ,couldn't find it - return NULL; + return nullptr; } bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendTimePerConnection, unsigned maxRecvTimePerConnection) @@ -273,8 +273,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT { // Send output from last heartbeat - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) { con->AddRef(); if (next) next->Release(); @@ -341,7 +341,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT tmpfds = m_permfds; timeout.tv_sec = 0; timeout.tv_usec = 0; - int cnt = select(maxfd, &tmpfds, NULL, NULL, &timeout); // blocks for timeout + int cnt = select(maxfd, &tmpfds, nullptr, nullptr, &timeout); // blocks for timeout if (cnt > 0) @@ -367,8 +367,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //process incoming client messages if (maxRecvTimePerConnection != 0) { - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) { con->AddRef(); if (next) next->Release(); @@ -433,8 +433,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT pollfds[0].events |= POLLIN; } - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next, idx++) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next, idx++) { next = con->m_nextConnection; pollfds[idx].fd = con->m_socket; @@ -474,7 +474,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT } //process regular msg(s) - if (con == NULL) + if (con == nullptr) { close(pollfds[idx].fd); continue; @@ -506,7 +506,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT }//if(pollfds[... else if (pollfds[idx].revents & POLLHUP) { - if (con == NULL) + if (con == nullptr) { close(pollfds[idx].fd); continue; @@ -524,21 +524,21 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //now process any keepalives, if time to do that if (m_params.keepAliveDelay > 0 && m_keepAliveTimer.isDone(m_params.keepAliveDelay)) { - TcpConnection *next = NULL; - for (TcpConnection *con = m_keepAliveList.m_beginList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_keepAliveList.m_beginList ; con != nullptr ; con = next) { con->AddRef(); if (next) next->Release(); next = con->m_nextKeepAliveConnection; if (next) next->AddRef(); - con->Send(NULL, 0); //note: this request will move the connection from the keepAliveList to the aliveList + con->Send(nullptr, 0); //note: this request will move the connection from the keepAliveList to the aliveList con->Release(); } //now move the complete alive list over to the keepalive list to reset those timers m_keepAliveList.m_beginList = m_aliveList.m_beginList; - m_aliveList.m_beginList = NULL; + m_aliveList.m_beginList = nullptr; //switch id's for those connections that were in the alive list last go - around int tmpID = m_aliveList.m_listID; @@ -552,8 +552,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //now process any noDataCons, if time to do that if (m_params.noDataTimeout > 0 && m_noDataTimer.isDone(m_params.noDataTimeout)) { - TcpConnection *next = NULL; - for (TcpConnection *con = m_noDataList.m_beginList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_noDataList.m_beginList ; con != nullptr ; con = next) { con->AddRef(); if (next) next->Release(); @@ -567,7 +567,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //now move the complete data list over to the nodata list to reset those timers m_noDataList.m_beginList = m_dataList.m_beginList; - m_dataList.m_beginList = NULL; + m_dataList.m_beginList = nullptr; //switch id's for those connections that were in the data list last go - around int tmpID = m_dataList.m_listID; @@ -589,11 +589,11 @@ TcpConnection *TcpManager::EstablishConnection(const char *serverAddress, unsign { //can't open outgoing connections when in server mode // use a different TcpManager to do that - return NULL; + return nullptr; } if (m_connectionListCount >= m_params.maxConnections) - return(NULL); + return(nullptr); // get server address unsigned long address = inet_addr(serverAddress); @@ -601,8 +601,8 @@ TcpConnection *TcpManager::EstablishConnection(const char *serverAddress, unsign { struct hostent * lphp; lphp = gethostbyname(serverAddress); - if (lphp == NULL) - return(NULL); + if (lphp == nullptr) + return(nullptr); address = ((struct in_addr *)(lphp->h_addr))->s_addr; } IPAddress destIP(address); @@ -622,22 +622,22 @@ void TcpManager::addNewConnection(TcpConnection *con) FD_SET(con->m_socket, &m_permfds); #endif con->m_nextConnection = m_connectionList; - con->m_prevConnection = NULL; - if (m_connectionList != NULL) + con->m_prevConnection = nullptr; + if (m_connectionList != nullptr) m_connectionList->m_prevConnection = con; m_connectionList = con; m_connectionListCount++; con->m_nextKeepAliveConnection = m_aliveList.m_beginList; - con->m_prevKeepAliveConnection = NULL; - if (m_aliveList.m_beginList != NULL) + con->m_prevKeepAliveConnection = nullptr; + if (m_aliveList.m_beginList != nullptr) m_aliveList.m_beginList->m_prevKeepAliveConnection = con; m_aliveList.m_beginList = con; con->m_aliveListId = m_keepAliveList.m_listID;//start it out thinking it's already in the alive list, since it is con->m_nextRecvDataConnection = m_dataList.m_beginList; - con->m_prevRecvDataConnection = NULL; - if (m_dataList.m_beginList != NULL) + con->m_prevRecvDataConnection = nullptr; + if (m_dataList.m_beginList != nullptr) m_dataList.m_beginList->m_prevRecvDataConnection = con; m_dataList.m_beginList = con; con->m_recvDataListId = m_noDataList.m_listID;//start it out thinking it's already in the data list, since it is @@ -655,40 +655,40 @@ void TcpManager::removeConnection(TcpConnection *con) FD_CLR(con->m_socket, &m_permfds); } #endif - if (con->m_prevConnection != NULL) + if (con->m_prevConnection != nullptr) con->m_prevConnection->m_nextConnection = con->m_nextConnection; - if (con->m_nextConnection != NULL) + if (con->m_nextConnection != nullptr) con->m_nextConnection->m_prevConnection = con->m_prevConnection; if (m_connectionList == con) m_connectionList = con->m_nextConnection; - con->m_nextConnection = NULL; - con->m_prevConnection = NULL; + con->m_nextConnection = nullptr; + con->m_prevConnection = nullptr; - if (con->m_prevKeepAliveConnection != NULL) + if (con->m_prevKeepAliveConnection != nullptr) con->m_prevKeepAliveConnection->m_nextKeepAliveConnection = con->m_nextKeepAliveConnection; - if (con->m_nextKeepAliveConnection != NULL) + if (con->m_nextKeepAliveConnection != nullptr) con->m_nextKeepAliveConnection->m_prevKeepAliveConnection = con->m_prevKeepAliveConnection; if (m_aliveList.m_beginList == con) m_aliveList.m_beginList = con->m_nextKeepAliveConnection; else if (m_keepAliveList.m_beginList == con) m_keepAliveList.m_beginList = con->m_nextKeepAliveConnection; - con->m_nextKeepAliveConnection = NULL; - con->m_prevKeepAliveConnection = NULL; + con->m_nextKeepAliveConnection = nullptr; + con->m_prevKeepAliveConnection = nullptr; - if (con->m_prevRecvDataConnection != NULL) + if (con->m_prevRecvDataConnection != nullptr) con->m_prevRecvDataConnection->m_nextRecvDataConnection = con->m_nextRecvDataConnection; - if (con->m_nextRecvDataConnection != NULL) + if (con->m_nextRecvDataConnection != nullptr) con->m_nextRecvDataConnection->m_prevRecvDataConnection = con->m_prevRecvDataConnection; if (m_dataList.m_beginList == con) m_dataList.m_beginList = con->m_nextRecvDataConnection; else if (m_noDataList.m_beginList == con) m_noDataList.m_beginList = con->m_nextRecvDataConnection; - con->m_nextRecvDataConnection = NULL; - con->m_prevRecvDataConnection = NULL; + con->m_nextRecvDataConnection = nullptr; + con->m_prevRecvDataConnection = nullptr; diff --git a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpManager.h b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpManager.h index 32132069..cdc01daa 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpManager.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpManager.h @@ -156,7 +156,7 @@ public: * simply need to derive your class (multiply if necessary) from TcpManagerHandler, then you can use * this method to set the object the TcpManager will call as appropriate. The TcpConnection object * also has a handler mechanism that replaces the other callback functions below, see TcpConnection::SetHandler - * default = NULL (no callbacks made) + * default = nullptr (no callbacks made) * * @param handler The object which will be called for manager related notifications. */ @@ -211,7 +211,7 @@ public: * the connect-complete callback to be called if the connection is succesfull. * * @return A pointer to a TcpConnection object. - * NULL if the manager object has exceeded its maximum number of connections + * nullptr if the manager object has exceeded its maximum number of connections * or if the serverAddress cannot be resolved to an IP address. */ TcpConnection *EstablishConnection(const char *serverAddress, unsigned short serverPort, unsigned timeout = 0); diff --git a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TestClient/TestClient.cpp b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TestClient/TestClient.cpp index 075062d5..35423e88 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TestClient/TestClient.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TestClient/TestClient.cpp @@ -42,7 +42,7 @@ void TestClient::process() { m_con->SetHandler(this); m_conState = CON_NEGOTIATE; - m_conTimeout = time(NULL) + 20;//m_reconnectTimeout; + m_conTimeout = time(nullptr) + 20;//m_reconnectTimeout; } break; case CON_NEGOTIATE: @@ -51,10 +51,10 @@ void TestClient::process() m_conState = CON_CONNECT; printf("callback here.... connected\n"); } - else if(time(NULL) > 20) + else if(time(nullptr) > 20) { m_con->Release(); - m_con = NULL; + m_con = nullptr; m_conState = CON_DISCONNECT; } break; @@ -63,7 +63,7 @@ void TestClient::process() default: m_conState = CON_DISCONNECT; m_con->Release(); - m_con = NULL; + m_con = nullptr; } m_manager->GiveTime(); } @@ -95,7 +95,7 @@ void TestClient::OnTerminated(TcpConnection *con) if (m_con) { m_con->Release(); - m_con = NULL; + m_con = nullptr; } m_conState = CON_DISCONNECT; } diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Unicode/UnicodeCharacterDataMap.h b/external/3rd/library/soePlatform/CSAssist/utils/Unicode/UnicodeCharacterDataMap.h index 741a6e80..493c5a2d 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Unicode/UnicodeCharacterDataMap.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/Unicode/UnicodeCharacterDataMap.h @@ -122,7 +122,7 @@ namespace Plat_Unicode /** * Find a CharData for the given code point. - * @return null if no CharData exists for this code point + * @return nullptr if no CharData exists for this code point */ inline const CharData * CharDataMap::findCharData (const unicode_char_t code) const diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Unicode/utf8.cpp b/external/3rd/library/soePlatform/CSAssist/utils/Unicode/utf8.cpp index 527f246d..e7df40e2 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Unicode/utf8.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/Unicode/utf8.cpp @@ -87,7 +87,7 @@ int UTF8_convertCharToUTF16( char * ptr , UTF16 * ret ) int UTF8_convertToUTF16( char * ptr , UTF16 * ret, int limit ) { int len = 0; - while (( *ptr != 0 ) && ( len < ( limit - 1 ) ))//we use limit -1 to leave room for the null terminator + while (( *ptr != 0 ) && ( len < ( limit - 1 ) ))//we use limit -1 to leave room for the nullptr terminator { int clen = UTF8_convertCharToUTF16( ptr, ret ); ptr += clen; diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/Base/Archive.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/Base/Archive.cpp index e3400df0..8ad45428 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/Base/Archive.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/Base/Archive.cpp @@ -91,7 +91,7 @@ namespace Base ByteStream::ByteStream() : allocatedSize(0), beginReadIterator(), - data(NULL), + data(nullptr), size(0), lastPutSize(0) { @@ -208,7 +208,7 @@ namespace Base if(data->size < allocatedSize) { unsigned char * tmp = new unsigned char[newSize]; - if(data->buffer != NULL) + if(data->buffer != nullptr) memcpy(tmp, data->buffer, size); delete[] data->buffer; data->buffer = tmp; diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericApiCore.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericApiCore.cpp index 2f68dd50..527f5b69 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericApiCore.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericApiCore.cpp @@ -117,7 +117,7 @@ unsigned GenericAPICore::submitRequest(GenericRequest *req, GenericResponse *res } req->setTrack(m_currTrack); res->setTrack(m_currTrack); - time_t timeout = time(NULL) + m_requestTimeout; + time_t timeout = time(nullptr) + m_requestTimeout; req->setTimeout(timeout); res->setTimeout(timeout); @@ -136,7 +136,7 @@ void GenericAPICore::process() if (!m_suspended) { // Process timeout on pending requests - while((m_outCount > 0) && ((req = m_outboundQueue.front().first)->getTimeout() <= time(NULL))) + while((m_outCount > 0) && ((req = m_outboundQueue.front().first)->getTimeout() <= time(nullptr))) { --m_outCount; res = m_outboundQueue.front().second; @@ -148,7 +148,7 @@ void GenericAPICore::process() } // Process timeout on pending responses - while((m_pendingCount > 0) && ((res = (*m_pending.begin()).second)->getTimeout() <= time(NULL))) + while((m_pendingCount > 0) && ((res = (*m_pending.begin()).second)->getTimeout() <= time(nullptr))) { --m_pendingCount; m_pending.erase(m_pending.begin()); @@ -161,7 +161,7 @@ void GenericAPICore::process() pair out_pair = m_outboundQueue.front(); req = out_pair.first; res = out_pair.second; - GenericConnection *con = NULL; + GenericConnection *con = nullptr; if (req->getMappedServerTrack() == 0) // request has no originating "owner" server { con = getNextActiveConnection(); // it does not matter which server we send this to @@ -178,7 +178,7 @@ void GenericAPICore::process() } } - if (con != NULL) + if (con != nullptr) { Base::ByteStream msg; req->pack(msg); @@ -213,7 +213,7 @@ GenericConnection *GenericAPICore::getNextActiveConnection() unsigned startIndex = m_nextConnectionIndex; unsigned maxIndex = m_serverConnections.size() - 1; - GenericConnection *con = NULL; + GenericConnection *con = nullptr; //loop until we find an active connection, or until we get back // to where we started @@ -233,7 +233,7 @@ GenericConnection *GenericAPICore::getNextActiveConnection() //went past end of vector, start back at 0 m_nextConnectionIndex = 0; } - }while (con == NULL && m_nextConnectionIndex != startIndex); + }while (con == nullptr && m_nextConnectionIndex != startIndex); return con; } @@ -259,7 +259,7 @@ ServerTrackObject *GenericAPICore::findServer(unsigned server_track) { std::map::iterator iter = m_serverTracks.find(server_track); if (iter == m_serverTracks.end()) - return NULL; + return nullptr; ServerTrackObject *stobj = (*iter).second; m_serverTracks.erase(server_track); return stobj; diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericConnection.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericConnection.cpp index ef652f08..2fd9ca45 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericConnection.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericConnection.cpp @@ -22,7 +22,7 @@ using namespace Base; GenericConnection::GenericConnection(const char *host, short port, GenericAPICore *apiCore, unsigned reconnectTimeout, unsigned noDataTimeoutSecs, unsigned noAckTimeoutSecs, unsigned incomingBufSizeInKB, unsigned outgoingBufSizeInKB, unsigned keepAlive, unsigned maxRecvMessageSizeInKB) : m_bConnected(CON_NONE), m_apiCore(apiCore), - m_con(NULL), + m_con(nullptr), m_host(host), m_port(port), m_lastTrack(123455), //random choice != 1 @@ -47,8 +47,8 @@ GenericConnection::~GenericConnection() { if(m_con) { - m_con->SetHandler(NULL); - m_con->Disconnect();//don't worry about onterminated being called, we've set it's handler to null, so it wont + m_con->SetHandler(nullptr); + m_con->Disconnect();//don't worry about onterminated being called, we've set it's handler to nullptr, so it wont m_con->Release(); } @@ -61,7 +61,7 @@ void GenericConnection::disconnect() { m_con->Disconnect(); //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); - m_con = NULL; + m_con = nullptr; } m_conState = CON_DISCONNECT; m_bConnected = CON_NONE; @@ -74,7 +74,7 @@ void GenericConnection::OnTerminated(TcpConnection *con) if(m_con) { m_con->Release(); - m_con = NULL; + m_con = nullptr; } m_conState = CON_DISCONNECT; m_bConnected = CON_NONE; @@ -90,7 +90,7 @@ void GenericConnection::OnRoutePacket(TcpConnection *con, const unsigned char *d get(iter, type); get(iter, track); - GenericResponse *res = NULL; + GenericResponse *res = nullptr; // the following if block is a temporary fix that prevents // a crash with a game team in which they occasionally find @@ -148,7 +148,7 @@ void GenericConnection::process() { m_con->SetHandler(this); m_conState = CON_NEGOTIATE; - m_conTimeout = time(NULL) + m_reconnectTimeout; + m_conTimeout = time(nullptr) + m_reconnectTimeout; } break; case CON_NEGOTIATE: @@ -169,12 +169,12 @@ void GenericConnection::process() put(msg, m_apiCore->getGameCode()); Send(msg); } - else if(time(NULL) > m_conTimeout) + else if(time(nullptr) > m_conTimeout) { // we did not connect m_con->Disconnect(); //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); - m_con = NULL; + m_con = nullptr; m_conState = CON_DISCONNECT; m_bConnected = CON_NONE; } @@ -190,7 +190,7 @@ void GenericConnection::process() { m_con->Disconnect(); //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); - m_con = NULL; + m_con = nullptr; } } m_manager->GiveTime(); diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/CTServiceAPI.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/CTServiceAPI.cpp index 57f9b409..4e6b0954 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/CTServiceAPI.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/CTServiceAPI.cpp @@ -23,7 +23,7 @@ CTServiceAPI::CTServiceAPI(const char *hostName, const char *game) std::vector hostArray; std::vector portArray; char hostConfig[4096]; - if (hostName == NULL) + if (hostName == nullptr) hostName = DEFAULT_HOST; if (!game) game = DEFAULT_GAMECODE; @@ -47,7 +47,7 @@ CTServiceAPI::CTServiceAPI(const char *hostName, const char *game) portArray.push_back(port); } } - while ((ptr = strtok(NULL, " ")) != NULL); + while ((ptr = strtok(nullptr, " ")) != nullptr); } if (hostArray.empty()) { diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/IPAddress.h b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/IPAddress.h index f6d5f886..03b59e8d 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/IPAddress.h +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/IPAddress.h @@ -32,7 +32,7 @@ public: * @brief Used to retreive the the dot-notation represenatatiion of this address. * * @param buffer A pointer to the buffer to place the ip address into. - * Must be at least 17 characters long, will be null terminated. + * Must be at least 17 characters long, will be nullptr terminated. * * @return A pointer to the buffer the address was placed into. */ diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpBlockAllocator.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpBlockAllocator.cpp index 6d476d78..b7da0f27 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpBlockAllocator.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpBlockAllocator.cpp @@ -6,7 +6,7 @@ namespace NAMESPACE #endif TcpBlockAllocator::TcpBlockAllocator(const unsigned initSize, const unsigned initCount) -: m_freeHead(NULL), m_blockCount(initCount), m_blockSize(initSize), m_numAvailBlocks(0) +: m_freeHead(nullptr), m_blockCount(initCount), m_blockSize(initSize), m_numAvailBlocks(0) { realloc(); } @@ -33,7 +33,7 @@ data_block *TcpBlockAllocator::getBlock() tmp = m_freeHead; m_freeHead = m_freeHead->m_next; - tmp->m_next = NULL; + tmp->m_next = nullptr; m_numAvailBlocks--; return(tmp); } @@ -56,7 +56,7 @@ void TcpBlockAllocator::returnBlock(data_block *b) void TcpBlockAllocator::realloc() { - data_block *tmp = NULL, *cursor = NULL; + data_block *tmp = nullptr, *cursor = nullptr; tmp = new data_block; m_numAvailBlocks++; cursor = tmp; diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpConnection.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpConnection.cpp index 0b3366a8..cd2c1f20 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpConnection.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpConnection.cpp @@ -11,28 +11,28 @@ namespace NAMESPACE //used when want to open new connection with this socket TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, const IPAddress &destIP, short destPort, unsigned timeout) -: m_nextConnection(NULL), - m_prevConnection(NULL), +: m_nextConnection(nullptr), + m_prevConnection(nullptr), m_socket(INVALID_SOCKET), - m_nextKeepAliveConnection(NULL), - m_prevKeepAliveConnection(NULL), + m_nextKeepAliveConnection(nullptr), + m_prevKeepAliveConnection(nullptr), m_aliveListId(tcpManager->m_aliveList.m_listID), - m_nextRecvDataConnection(NULL), - m_prevRecvDataConnection(NULL), + m_nextRecvDataConnection(nullptr), + m_prevRecvDataConnection(nullptr), m_recvDataListId(tcpManager->m_dataList.m_listID), m_manager(tcpManager), m_status(StatusNegotiating), - m_handler(NULL), + m_handler(nullptr), m_destIP(destIP), m_destPort(destPort), m_refCount(0), m_sendAllocator(sendAlloc), - m_head(NULL), - m_tail(NULL), + m_head(nullptr), + m_tail(nullptr), m_bytesRead(0), m_bytesNeeded(0), m_params(params), - m_recvBuff(NULL), + m_recvBuff(nullptr), m_connectTimeout(timeout), m_connectTimer(), m_wasConRemovedFromMgr(false) @@ -94,28 +94,28 @@ TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAllo //used when server mode creates new connection object representing a connect request TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, SOCKET socket, const IPAddress &destIP, short destPort) -: m_nextConnection(NULL), - m_prevConnection(NULL), +: m_nextConnection(nullptr), + m_prevConnection(nullptr), m_socket(socket), - m_nextKeepAliveConnection(NULL), - m_prevKeepAliveConnection(NULL), + m_nextKeepAliveConnection(nullptr), + m_prevKeepAliveConnection(nullptr), m_aliveListId(tcpManager->m_aliveList.m_listID), - m_nextRecvDataConnection(NULL), - m_prevRecvDataConnection(NULL), + m_nextRecvDataConnection(nullptr), + m_prevRecvDataConnection(nullptr), m_recvDataListId(tcpManager->m_dataList.m_listID), m_manager(tcpManager), m_status(StatusConnected), - m_handler(NULL), + m_handler(nullptr), m_destIP(destIP), m_destPort(destPort), m_refCount(0), m_sendAllocator(sendAlloc), - m_head(NULL), - m_tail(NULL), + m_head(nullptr), + m_tail(nullptr), m_bytesRead(0), m_bytesNeeded(0), m_params(params), - m_recvBuff(NULL), + m_recvBuff(nullptr), m_connectTimeout(0), m_connectTimer(), m_wasConRemovedFromMgr(false) @@ -205,7 +205,7 @@ int TcpConnection::finishConnect() t.tv_sec = 0; t.tv_usec = 0; - int err = select(m_socket + 1, NULL, &wrSet, NULL, &t); + int err = select(m_socket + 1, nullptr, &wrSet, nullptr, &t); if (err == 0) { @@ -300,7 +300,7 @@ TcpConnection::~TcpConnection() { delete [] m_recvBuff; - while(m_head != NULL) + while(m_head != nullptr) { data_block *tmp = m_head; m_head = m_head->m_next; @@ -324,22 +324,22 @@ void TcpConnection::Send(const char *data, unsigned int dataLen) { m_aliveListId = m_manager->m_keepAliveList.m_listID; - if (m_prevKeepAliveConnection != NULL) + if (m_prevKeepAliveConnection != nullptr) m_prevKeepAliveConnection->m_nextKeepAliveConnection = m_nextKeepAliveConnection; - if (m_nextKeepAliveConnection != NULL) + if (m_nextKeepAliveConnection != nullptr) m_nextKeepAliveConnection->m_prevKeepAliveConnection = m_prevKeepAliveConnection; if (m_manager->m_keepAliveList.m_beginList == this) m_manager->m_keepAliveList.m_beginList = m_nextKeepAliveConnection; m_nextKeepAliveConnection = m_manager->m_aliveList.m_beginList; - m_prevKeepAliveConnection = NULL; - if (m_manager->m_aliveList.m_beginList != NULL) + m_prevKeepAliveConnection = nullptr; + if (m_manager->m_aliveList.m_beginList != nullptr) m_manager->m_aliveList.m_beginList->m_prevKeepAliveConnection = this; m_manager->m_aliveList.m_beginList = this; } - data_block *work = NULL; + data_block *work = nullptr; // this connection has no send buffer. Get a block if(!m_tail) @@ -464,16 +464,16 @@ int TcpConnection::processIncoming() { m_recvDataListId = m_manager->m_noDataList.m_listID; - if (m_prevRecvDataConnection != NULL) + if (m_prevRecvDataConnection != nullptr) m_prevRecvDataConnection->m_nextRecvDataConnection = m_nextRecvDataConnection; - if (m_nextRecvDataConnection != NULL) + if (m_nextRecvDataConnection != nullptr) m_nextRecvDataConnection->m_prevRecvDataConnection = m_prevRecvDataConnection; if (m_manager->m_noDataList.m_beginList == this) m_manager->m_noDataList.m_beginList = m_nextRecvDataConnection; m_nextRecvDataConnection = m_manager->m_dataList.m_beginList; - m_prevRecvDataConnection = NULL; - if (m_manager->m_dataList.m_beginList != NULL) + m_prevRecvDataConnection = nullptr; + if (m_manager->m_dataList.m_beginList != nullptr) m_manager->m_dataList.m_beginList->m_prevRecvDataConnection = this; m_manager->m_dataList.m_beginList = this; } @@ -619,7 +619,7 @@ int TcpConnection::processOutgoing() int sendError = 1; - // If m_head is not null, then this connection has something to send + // If m_head is not nullptr, then this connection has something to send if(m_head) diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpConnection.h b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpConnection.h index 07eb4f42..92d631d1 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpConnection.h +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpConnection.h @@ -50,7 +50,7 @@ public: * connection is disconnected, you simply need to derive your class * (multiply if necessary) from TcpConnectionHandler, then you can use * this method to set the object the TcpConnection will call as appropriate. - * default = NULL (no callbacks made) + * default = nullptr (no callbacks made) * * @param handler The object which will be called for notifications. */ diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpManager.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpManager.cpp index fa4d61a4..2586fa64 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpManager.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpManager.cpp @@ -41,14 +41,14 @@ TcpManager::TcpParams::TcpParams(const TcpParams &cpy) } TcpManager::TcpManager(const TcpParams ¶ms) -: m_handler(NULL), - m_keepAliveList(NULL, 1), - m_aliveList(NULL, 2), - m_noDataList(NULL, 1), - m_dataList(NULL, 2), +: m_handler(nullptr), + m_keepAliveList(nullptr, 1), + m_aliveList(nullptr, 2), + m_noDataList(nullptr, 1), + m_dataList(nullptr, 2), m_params(params), m_refCount(1), - m_connectionList(NULL), + m_connectionList(nullptr), m_connectionListCount(0), m_socket(INVALID_SOCKET), m_boundAsServer(false), @@ -86,7 +86,7 @@ TcpManager::~TcpManager() close(m_socket); #endif } - while (m_connectionList != NULL) + while (m_connectionList != nullptr) { TcpConnection *con = m_connectionList; m_connectionList = m_connectionList->m_nextConnection; @@ -162,7 +162,7 @@ bool TcpManager::BindAsServer() { struct hostent * lphp; lphp = gethostbyname(m_params.bindAddress); - if (lphp != NULL) + if (lphp != nullptr) addr_loc.sin_addr.s_addr = ((struct in_addr *)(lphp->h_addr))->s_addr; } else @@ -187,7 +187,7 @@ bool TcpManager::BindAsServer() TcpConnection *TcpManager::acceptClient() { - TcpConnection *newConn = NULL; + TcpConnection *newConn = nullptr; if (m_boundAsServer && m_connectionListCount < m_params.maxConnections) { @@ -201,7 +201,7 @@ TcpConnection *TcpManager::acceptClient() { newConn = new TcpConnection(this, &m_allocator, m_params, sock, IPAddress(addr.sin_addr.s_addr), ntohs(addr.sin_port)); addNewConnection(newConn); - if (m_handler != NULL) + if (m_handler != nullptr) { m_handler->OnConnectRequest(newConn); } @@ -226,8 +226,8 @@ SOCKET TcpManager::getMaxFD() if (m_boundAsServer) maxfd = m_socket+1; - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) { next = con->m_nextConnection; if (con->GetStatus() != TcpConnection::StatusDisconnected && con->m_socket > maxfd) @@ -241,8 +241,8 @@ SOCKET TcpManager::getMaxFD() TcpConnection *TcpManager::getConnection(SOCKET fd) { - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) { next = con->m_nextConnection; if (con->m_socket == fd) @@ -251,7 +251,7 @@ TcpConnection *TcpManager::getConnection(SOCKET fd) } } //if get here ,couldn't find it - return NULL; + return nullptr; } bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendTimePerConnection, unsigned maxRecvTimePerConnection) @@ -273,8 +273,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT { // Send output from last heartbeat - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) { con->AddRef(); if (next) next->Release(); @@ -341,7 +341,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT tmpfds = m_permfds; timeout.tv_sec = 0; timeout.tv_usec = 0; - int cnt = select(maxfd, &tmpfds, NULL, NULL, &timeout); // blocks for timeout + int cnt = select(maxfd, &tmpfds, nullptr, nullptr, &timeout); // blocks for timeout if (cnt > 0) @@ -367,8 +367,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //process incoming client messages if (maxRecvTimePerConnection != 0) { - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) { con->AddRef(); if (next) next->Release(); @@ -433,8 +433,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT pollfds[0].events |= POLLIN; } - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next, idx++) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next, idx++) { next = con->m_nextConnection; pollfds[idx].fd = con->m_socket; @@ -474,7 +474,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT } //process regular msg(s) - if (con == NULL) + if (con == nullptr) { close(pollfds[idx].fd); continue; @@ -506,7 +506,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT }//if(pollfds[... else if (pollfds[idx].revents & POLLHUP) { - if (con == NULL) + if (con == nullptr) { close(pollfds[idx].fd); continue; @@ -524,21 +524,21 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //now process any keepalives, if time to do that if (m_params.keepAliveDelay > 0 && m_keepAliveTimer.isDone(m_params.keepAliveDelay)) { - TcpConnection *next = NULL; - for (TcpConnection *con = m_keepAliveList.m_beginList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_keepAliveList.m_beginList ; con != nullptr ; con = next) { con->AddRef(); if (next) next->Release(); next = con->m_nextKeepAliveConnection; if (next) next->AddRef(); - con->Send(NULL, 0); //note: this request will move the connection from the keepAliveList to the aliveList + con->Send(nullptr, 0); //note: this request will move the connection from the keepAliveList to the aliveList con->Release(); } //now move the complete alive list over to the keepalive list to reset those timers m_keepAliveList.m_beginList = m_aliveList.m_beginList; - m_aliveList.m_beginList = NULL; + m_aliveList.m_beginList = nullptr; //switch id's for those connections that were in the alive list last go - around int tmpID = m_aliveList.m_listID; @@ -552,8 +552,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //now process any noDataCons, if time to do that if (m_params.noDataTimeout > 0 && m_noDataTimer.isDone(m_params.noDataTimeout)) { - TcpConnection *next = NULL; - for (TcpConnection *con = m_noDataList.m_beginList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_noDataList.m_beginList ; con != nullptr ; con = next) { con->AddRef(); if (next) next->Release(); @@ -567,7 +567,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //now move the complete data list over to the nodata list to reset those timers m_noDataList.m_beginList = m_dataList.m_beginList; - m_dataList.m_beginList = NULL; + m_dataList.m_beginList = nullptr; //switch id's for those connections that were in the data list last go - around int tmpID = m_dataList.m_listID; @@ -589,11 +589,11 @@ TcpConnection *TcpManager::EstablishConnection(const char *serverAddress, unsign { //can't open outgoing connections when in server mode // use a different TcpManager to do that - return NULL; + return nullptr; } if (m_connectionListCount >= m_params.maxConnections) - return(NULL); + return(nullptr); // get server address unsigned long address = inet_addr(serverAddress); @@ -601,8 +601,8 @@ TcpConnection *TcpManager::EstablishConnection(const char *serverAddress, unsign { struct hostent * lphp; lphp = gethostbyname(serverAddress); - if (lphp == NULL) - return(NULL); + if (lphp == nullptr) + return(nullptr); address = ((struct in_addr *)(lphp->h_addr))->s_addr; } IPAddress destIP(address); @@ -622,22 +622,22 @@ void TcpManager::addNewConnection(TcpConnection *con) FD_SET(con->m_socket, &m_permfds); #endif con->m_nextConnection = m_connectionList; - con->m_prevConnection = NULL; - if (m_connectionList != NULL) + con->m_prevConnection = nullptr; + if (m_connectionList != nullptr) m_connectionList->m_prevConnection = con; m_connectionList = con; m_connectionListCount++; con->m_nextKeepAliveConnection = m_aliveList.m_beginList; - con->m_prevKeepAliveConnection = NULL; - if (m_aliveList.m_beginList != NULL) + con->m_prevKeepAliveConnection = nullptr; + if (m_aliveList.m_beginList != nullptr) m_aliveList.m_beginList->m_prevKeepAliveConnection = con; m_aliveList.m_beginList = con; con->m_aliveListId = m_keepAliveList.m_listID;//start it out thinking it's already in the alive list, since it is con->m_nextRecvDataConnection = m_dataList.m_beginList; - con->m_prevRecvDataConnection = NULL; - if (m_dataList.m_beginList != NULL) + con->m_prevRecvDataConnection = nullptr; + if (m_dataList.m_beginList != nullptr) m_dataList.m_beginList->m_prevRecvDataConnection = con; m_dataList.m_beginList = con; con->m_recvDataListId = m_noDataList.m_listID;//start it out thinking it's already in the data list, since it is @@ -655,40 +655,40 @@ void TcpManager::removeConnection(TcpConnection *con) FD_CLR(con->m_socket, &m_permfds); } #endif - if (con->m_prevConnection != NULL) + if (con->m_prevConnection != nullptr) con->m_prevConnection->m_nextConnection = con->m_nextConnection; - if (con->m_nextConnection != NULL) + if (con->m_nextConnection != nullptr) con->m_nextConnection->m_prevConnection = con->m_prevConnection; if (m_connectionList == con) m_connectionList = con->m_nextConnection; - con->m_nextConnection = NULL; - con->m_prevConnection = NULL; + con->m_nextConnection = nullptr; + con->m_prevConnection = nullptr; - if (con->m_prevKeepAliveConnection != NULL) + if (con->m_prevKeepAliveConnection != nullptr) con->m_prevKeepAliveConnection->m_nextKeepAliveConnection = con->m_nextKeepAliveConnection; - if (con->m_nextKeepAliveConnection != NULL) + if (con->m_nextKeepAliveConnection != nullptr) con->m_nextKeepAliveConnection->m_prevKeepAliveConnection = con->m_prevKeepAliveConnection; if (m_aliveList.m_beginList == con) m_aliveList.m_beginList = con->m_nextKeepAliveConnection; else if (m_keepAliveList.m_beginList == con) m_keepAliveList.m_beginList = con->m_nextKeepAliveConnection; - con->m_nextKeepAliveConnection = NULL; - con->m_prevKeepAliveConnection = NULL; + con->m_nextKeepAliveConnection = nullptr; + con->m_prevKeepAliveConnection = nullptr; - if (con->m_prevRecvDataConnection != NULL) + if (con->m_prevRecvDataConnection != nullptr) con->m_prevRecvDataConnection->m_nextRecvDataConnection = con->m_nextRecvDataConnection; - if (con->m_nextRecvDataConnection != NULL) + if (con->m_nextRecvDataConnection != nullptr) con->m_nextRecvDataConnection->m_prevRecvDataConnection = con->m_prevRecvDataConnection; if (m_dataList.m_beginList == con) m_dataList.m_beginList = con->m_nextRecvDataConnection; else if (m_noDataList.m_beginList == con) m_noDataList.m_beginList = con->m_nextRecvDataConnection; - con->m_nextRecvDataConnection = NULL; - con->m_prevRecvDataConnection = NULL; + con->m_nextRecvDataConnection = nullptr; + con->m_prevRecvDataConnection = nullptr; diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpManager.h b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpManager.h index 75eb6df4..c4e8b1cf 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpManager.h +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpManager.h @@ -156,7 +156,7 @@ public: * simply need to derive your class (multiply if necessary) from TcpManagerHandler, then you can use * this method to set the object the TcpManager will call as appropriate. The TcpConnection object * also has a handler mechanism that replaces the other callback functions below, see TcpConnection::SetHandler - * default = NULL (no callbacks made) + * default = nullptr (no callbacks made) * * @param handler The object which will be called for manager related notifications. */ @@ -211,7 +211,7 @@ public: * the connect-complete callback to be called if the connection is succesfull. * * @return A pointer to a TcpConnection object. - * NULL if the manager object has exceeded its maximum number of connections + * nullptr if the manager object has exceeded its maximum number of connections * or if the serverAddress cannot be resolved to an IP address. */ TcpConnection *EstablishConnection(const char *serverAddress, unsigned short serverPort, unsigned timeout = 0); diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/TestClient/Main.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/TestClient/Main.cpp index eb7a09ab..188be18e 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/TestClient/Main.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/TestClient/Main.cpp @@ -10,7 +10,7 @@ using namespace CTService; unsigned openRequests = 0; -CTServiceAPI *waitclient = NULL; +CTServiceAPI *waitclient = nullptr; std::map m_tests; std::string game_code; diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/Unicode/UnicodeCharacterDataMap.h b/external/3rd/library/soePlatform/CTServiceGameAPI/Unicode/UnicodeCharacterDataMap.h index 741a6e80..493c5a2d 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/Unicode/UnicodeCharacterDataMap.h +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/Unicode/UnicodeCharacterDataMap.h @@ -122,7 +122,7 @@ namespace Plat_Unicode /** * Find a CharData for the given code point. - * @return null if no CharData exists for this code point + * @return nullptr if no CharData exists for this code point */ inline const CharData * CharDataMap::findCharData (const unicode_char_t code) const diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/test/main.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/test/main.cpp index 4f91d382..e24b265e 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/test/main.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/test/main.cpp @@ -135,7 +135,7 @@ namespace CTService const char *game, const char *param) { - printf("onServerTest(%u, %s, %s)\n", server_track, game ? game : "(null)", param ? param : "(null)"); + printf("onServerTest(%u, %s, %s)\n", server_track, game ? game : "(nullptr)", param ? param : "(nullptr)"); replyTest(server_track, 999, 0); } diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/AvatarIteratorCore.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/AvatarIteratorCore.cpp index 3786718c..9548bc9f 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/AvatarIteratorCore.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/AvatarIteratorCore.cpp @@ -9,7 +9,7 @@ namespace ChatSystem // AVATAR ITERATOR CORE AvatarIteratorCore::AvatarIteratorCore() -: m_map(NULL) +: m_map(nullptr) { } @@ -33,7 +33,7 @@ AvatarIteratorCore &AvatarIteratorCore::operator=(const AvatarIteratorCore& rhs) ChatAvatar *AvatarIteratorCore::getCurAvatar() { - ChatAvatar *returnVal = NULL; + ChatAvatar *returnVal = nullptr; if (!outOfBounds()) { @@ -87,7 +87,7 @@ bool AvatarIteratorCore::outOfBounds() // MODERATOR ITERATOR CORE ModeratorIteratorCore::ModeratorIteratorCore() -: m_set(NULL) +: m_set(nullptr) { } @@ -111,7 +111,7 @@ ModeratorIteratorCore &ModeratorIteratorCore::operator=(const ModeratorIteratorC ChatAvatar *ModeratorIteratorCore::getCurAvatar() { - ChatAvatar *returnVal = NULL; + ChatAvatar *returnVal = nullptr; if (!outOfBounds()) { @@ -165,7 +165,7 @@ bool ModeratorIteratorCore::outOfBounds() // TEMPORARY MODERATOR ITERATOR CORE TemporaryModeratorIteratorCore::TemporaryModeratorIteratorCore() -: m_set(NULL) +: m_set(nullptr) { } @@ -189,7 +189,7 @@ TemporaryModeratorIteratorCore &TemporaryModeratorIteratorCore::operator=(const ChatAvatar *TemporaryModeratorIteratorCore::getCurAvatar() { - ChatAvatar *returnVal = NULL; + ChatAvatar *returnVal = nullptr; if (!outOfBounds()) { @@ -243,7 +243,7 @@ bool TemporaryModeratorIteratorCore::outOfBounds() // VOICE ITERATOR CORE VoiceIteratorCore::VoiceIteratorCore() -: m_set(NULL) +: m_set(nullptr) { } @@ -267,7 +267,7 @@ VoiceIteratorCore &VoiceIteratorCore::operator=(const VoiceIteratorCore& rhs) ChatAvatar *VoiceIteratorCore::getCurAvatar() { - ChatAvatar *returnVal = NULL; + ChatAvatar *returnVal = nullptr; if (!outOfBounds()) { @@ -321,7 +321,7 @@ bool VoiceIteratorCore::outOfBounds() // INVITE ITERATOR CORE InviteIteratorCore::InviteIteratorCore() -: m_set(NULL) +: m_set(nullptr) { } @@ -345,7 +345,7 @@ InviteIteratorCore &InviteIteratorCore::operator=(const InviteIteratorCore& rhs) ChatAvatar *InviteIteratorCore::getCurAvatar() { - ChatAvatar *returnVal = NULL; + ChatAvatar *returnVal = nullptr; if (!outOfBounds()) { @@ -399,7 +399,7 @@ bool InviteIteratorCore::outOfBounds() // BAN ITERATOR CORE BanIteratorCore::BanIteratorCore() -: m_set(NULL) +: m_set(nullptr) { } @@ -423,7 +423,7 @@ BanIteratorCore &BanIteratorCore::operator=(const BanIteratorCore& rhs) ChatAvatar *BanIteratorCore::getCurAvatar() { - ChatAvatar *returnVal = NULL; + ChatAvatar *returnVal = nullptr; if (!outOfBounds()) { diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/AvatarListItemCore.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/AvatarListItemCore.cpp index 15e9af48..6bbc82e9 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/AvatarListItemCore.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/AvatarListItemCore.cpp @@ -7,7 +7,7 @@ namespace ChatSystem using namespace Plat_Unicode; AvatarListItem::AvatarListItem() - : m_core(NULL) + : m_core(nullptr) { } @@ -16,7 +16,7 @@ namespace ChatSystem } AvatarListItemCore::AvatarListItemCore() - : m_interface(NULL) + : m_interface(nullptr) { } diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPI.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPI.cpp index 021afd5d..9b1e1cd0 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPI.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPI.cpp @@ -13,7 +13,7 @@ namespace ChatSystem { ChatAPI::ChatAPI(const char *registrar_host, short registrar_port, const char *server_host, short server_port) -: m_defaultRoomParams(NULL), +: m_defaultRoomParams(nullptr), m_defaultLoginPriority(0), m_defaultEntryType(false) { @@ -25,13 +25,13 @@ ChatAPI::ChatAPI(const char *registrar_host, short registrar_port, const char *s ChatAPI::~ChatAPI() { delete m_defaultRoomParams; - m_defaultRoomParams = NULL; + m_defaultRoomParams = nullptr; delete m_core; - m_core = NULL; + m_core = nullptr; } ChatAPI::ChatAPI(ChatAPICore *core) -: m_defaultRoomParams(NULL) +: m_defaultRoomParams(nullptr) { m_core = core; m_core->setAPI(this); @@ -721,7 +721,7 @@ void ChatAPI::setDefaultRoomParams(RoomParams *roomParams) { if (roomParams) { - if (m_defaultRoomParams == NULL) + if (m_defaultRoomParams == nullptr) { m_defaultRoomParams = new RoomParams; } @@ -732,7 +732,7 @@ void ChatAPI::setDefaultRoomParams(RoomParams *roomParams) else { delete m_defaultRoomParams; - m_defaultRoomParams = NULL; + m_defaultRoomParams = nullptr; } } void ChatAPI::setDefaultLoginLocation(const ChatUnicodeString &defaultLoginLocation) diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPI.h b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPI.h index 00533e05..0d255ca2 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPI.h +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPI.h @@ -105,7 +105,7 @@ namespace ChatSystem // will be connected to, as well as the hostname and port of the Registrar // ChatServer (which will automatically reroute the ChatAPI connection to // a hotspare ChatServer if the provided choice is unavailable). - // NULL pointers are NOT valid input. + // nullptr pointers are NOT valid input. ChatAPI(const char *registrar_host, short registrar_port, const char *server_host, short server_port); virtual ~ChatAPI(); @@ -209,7 +209,7 @@ namespace ChatSystem // getAvatar // Requests immediate return of a ChatAvatar object that this API // has cached due to a RequestLoginAvatar. Request does not go - // to ChatServer. Returns NULL if API does not have object locally. + // to ChatServer. Returns nullptr if API does not have object locally. ChatAvatar *getAvatar(const ChatUnicodeString &avatarName, const ChatUnicodeString &avatarAddress); ChatAvatar *getAvatar(unsigned avatarID); @@ -286,7 +286,7 @@ namespace ChatSystem // Requests immediate return of a ChatRoom object that this API // has cached due to a RequestGetRoom, RequestCreateRoom, or // RequestEnterRoom. Request does not go to ChatServer. Returns - // NULL if API does not have object locally. + // nullptr if API does not have object locally. ChatRoom *getRoom(const ChatUnicodeString &roomAddress); ChatRoom *getRoom(unsigned roomID); @@ -298,13 +298,13 @@ namespace ChatSystem // getDefaultRoomParams // Requests the ChatAPI's current default RoomParams object. Used for - // the EnterRoom call. If NULL, EnterRoom will not do passive room + // the EnterRoom call. If nullptr, EnterRoom will not do passive room // creation if the room to enter does not yet exist. Initial value - // is NULL (no RoomParams object defined). + // is nullptr (no RoomParams object defined). const RoomParams *getDefaultRoomParams(void); // setDefaultRoomParams - // Sets the ChatAPI's current default RoomParams object. Passing a NULL + // Sets the ChatAPI's current default RoomParams object. Passing a nullptr // pointer will cause the default params not to be used by EnterRoom. void setDefaultRoomParams(RoomParams *roomParams); diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPICore.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPICore.cpp index 5724a68f..99cfe621 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPICore.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPICore.cpp @@ -67,7 +67,7 @@ const char * const ChatAPICore::ms_errorStringsEnglish[] = "UID node already exists", "Wrong chat server for request", "Succeeded, but local data is invalid", - "Login with null name", + "Login with nullptr name", "No server assigned to this identity", // 45 "Another server already assumed this identity", "Remote server is down", @@ -82,9 +82,9 @@ const char * const ChatAPICore::ms_errorStringsEnglish[] = "Duplicate voice", "Chat avatar must first be logged out", "No work to do", - "Cannot perform rename to NULL avatar name", + "Cannot perform rename to nullptr avatar name", "Cannot perform station acct transfer to stationID = 0", // 60 - "Cannot perform avatar move to NULL avatar address", + "Cannot perform avatar move to nullptr avatar address", "Failed to obtain an ID for a new room or avatar", "Room is local to namespace/world; cannot enter from other worlds", "Room is local to game; cannot enter from other game namespaces", @@ -122,7 +122,7 @@ ChatAPICore::ChatAPICore(const char *registrar_host, short registrar_port, const m_registrarPort(registrar_port), m_defaultServerPort(server_port), m_assignedServerPort(server_port), - m_timeSinceLastDisconnect(time(NULL)), + m_timeSinceLastDisconnect(time(nullptr)), m_rcvdRegistrarResponse(false), m_shouldSendVersion(true) { @@ -132,7 +132,7 @@ ChatAPICore::ChatAPICore(const char *registrar_host, short registrar_port, const ChatAPICore::~ChatAPICore() { - m_api = NULL; + m_api = nullptr; std::map::iterator iter = m_avatarCoreCache.begin(); for (; iter != m_avatarCoreCache.end(); ++iter) @@ -209,7 +209,7 @@ void ChatAPICore::cacheAvatar(ChatAvatarCore *avatarCore) ChatAvatarCore *ChatAPICore::getAvatarCore(unsigned avatarID) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; std::map::iterator iter = m_avatarCoreCache.find(avatarID); if(iter != m_avatarCoreCache.end()) @@ -221,7 +221,7 @@ ChatAvatarCore *ChatAPICore::getAvatarCore(unsigned avatarID) ChatAvatar *ChatAPICore::getAvatar(unsigned avatarID) { - ChatAvatar *returnAvatar = NULL; + ChatAvatar *returnAvatar = nullptr; std::map::iterator iter = m_avatarCache.find(avatarID); if(iter != m_avatarCache.end()) @@ -233,7 +233,7 @@ ChatAvatar *ChatAPICore::getAvatar(unsigned avatarID) ChatAvatarCore *ChatAPICore::decacheAvatar(unsigned avatarID) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; std::map::iterator iterCore = m_avatarCoreCache.find(avatarID); if(iterCore != m_avatarCoreCache.end()) { @@ -267,7 +267,7 @@ void ChatAPICore::cacheRoom(ChatRoomCore *roomCore) ChatRoomCore *ChatAPICore::getRoomCore(unsigned roomID) { - ChatRoomCore *returnRoom = NULL; + ChatRoomCore *returnRoom = nullptr; std::map::iterator iter = m_roomCoreCache.find(roomID); if(iter != m_roomCoreCache.end()) { @@ -279,7 +279,7 @@ ChatRoomCore *ChatAPICore::getRoomCore(unsigned roomID) ChatRoom *ChatAPICore::getRoom(unsigned roomID) { - ChatRoom *returnRoom = NULL; + ChatRoom *returnRoom = nullptr; std::map::iterator iter = m_roomCache.find(roomID); if(iter != m_roomCache.end()) { @@ -291,7 +291,7 @@ ChatRoom *ChatAPICore::getRoom(unsigned roomID) ChatRoomCore *ChatAPICore::decacheRoom(unsigned roomID) { - ChatRoomCore *returnRoom = NULL; + ChatRoomCore *returnRoom = nullptr; std::map::iterator iterCore = m_roomCoreCache.find(roomID); if(iterCore != m_roomCoreCache.end()) @@ -315,7 +315,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_LOGINAVATAR: { ResLoginAvatar *R = static_cast(res); - ChatAvatar *avatar = NULL; + ChatAvatar *avatar = nullptr; if(R->getAvatar()) { @@ -338,7 +338,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_TEMPORARYAVATAR: { ResTemporaryAvatar* R = static_cast(res); - ChatAvatar* avatar = NULL; + ChatAvatar* avatar = nullptr; if ( R->getAvatar() ) { @@ -394,8 +394,8 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_GETAVATAR: { ResGetAvatar *R = static_cast(res); - ChatAvatar *cachedAvatar = NULL; - ChatAvatar *avatar = NULL; + ChatAvatar *cachedAvatar = nullptr; + ChatAvatar *avatar = nullptr; ChatAvatarCore *avatarCore = R->getAvatar(); if (R->getResult() == 0 && avatarCore) // if success @@ -403,7 +403,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) // attempt to return locally cached avatar, if available cachedAvatar = getAvatar(avatarCore->getAvatarID()); - if (cachedAvatar != NULL) + if (cachedAvatar != nullptr) { // update cached information with returned data cachedAvatar->setAttributes(avatarCore->getAttributes()); @@ -427,7 +427,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) m_api->OnGetAvatar(R->getTrack(), R->getResult(), avatar, R->getUser()); - if (cachedAvatar == NULL) + if (cachedAvatar == nullptr) { delete avatar; } @@ -438,8 +438,8 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_GETANYAVATAR: { ResGetAnyAvatar *R = static_cast(res); - ChatAvatar *cachedAvatar = NULL; - ChatAvatar *avatar = NULL; + ChatAvatar *cachedAvatar = nullptr; + ChatAvatar *avatar = nullptr; ChatAvatarCore *avatarCore = R->getAvatar(); if (R->getResult() == 0 && avatarCore) // if success @@ -447,7 +447,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) // attempt to return locally cached avatar, if available cachedAvatar = getAvatar(avatarCore->getAvatarID()); - if (cachedAvatar != NULL) + if (cachedAvatar != nullptr) { // update cached information with returned data cachedAvatar->setAttributes(avatarCore->getAttributes()); @@ -471,7 +471,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) m_api->OnGetAnyAvatar(R->getTrack(), R->getResult(), avatar, R->isLoggedIn(), R->getUser()); - if (cachedAvatar == NULL) + if (cachedAvatar == nullptr) { delete avatar; } @@ -490,8 +490,8 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_SETAVATARATTRIBUTES: { ResSetAvatarAttributes *R = static_cast(res); - ChatAvatar *cachedAvatar = NULL; - ChatAvatar *avatar = NULL; + ChatAvatar *cachedAvatar = nullptr; + ChatAvatar *avatar = nullptr; ChatAvatarCore *avatarCore = R->getAvatar(); if (R->getResult() == 0 && avatarCore) // if success @@ -502,14 +502,14 @@ void ChatAPICore::responseCallback(GenericResponse *res) // attempt to return locally cached avatar, if available cachedAvatar = getAvatar(avatar->getAvatarID()); - if (cachedAvatar != NULL) + if (cachedAvatar != nullptr) { cachedAvatar->setAttributes(avatar->getAttributes()); } } } - if (cachedAvatar != NULL) + if (cachedAvatar != nullptr) { cachedAvatar = avatar; m_api->OnSetAvatarAttributes(R->getTrack(), R->getResult(), cachedAvatar, R->getUser()); @@ -531,8 +531,8 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_SETSTATUSMESSAGE: { ResSetAvatarStatusMessage *R = static_cast(res); - ChatAvatar *cachedAvatar = NULL; - ChatAvatar *avatar = NULL; + ChatAvatar *cachedAvatar = nullptr; + ChatAvatar *avatar = nullptr; ChatAvatarCore *avatarCore = R->getAvatar(); if (R->getResult() == 0 && avatarCore) // if success @@ -543,14 +543,14 @@ void ChatAPICore::responseCallback(GenericResponse *res) // attempt to return locally cached avatar, if available cachedAvatar = getAvatar(avatar->getAvatarID()); - if (cachedAvatar != NULL) + if (cachedAvatar != nullptr) { cachedAvatar->setStatusMessage(avatar->getStatusMessage()); } } } - if (cachedAvatar != NULL) + if (cachedAvatar != nullptr) { cachedAvatar = avatar; m_api->OnSetAvatarStatusMessage(R->getTrack(), R->getResult(), cachedAvatar, R->getUser()); @@ -572,8 +572,8 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_SETAVATAREMAIL: { ResSetAvatarForwardingEmail*R = static_cast(res); - ChatAvatar *cachedAvatar = NULL; - ChatAvatar *avatar = NULL; + ChatAvatar *cachedAvatar = nullptr; + ChatAvatar *avatar = nullptr; ChatAvatarCore *avatarCore = R->getAvatar(); if (R->getResult() == 0 && avatarCore) // if success @@ -584,14 +584,14 @@ void ChatAPICore::responseCallback(GenericResponse *res) // attempt to return locally cached avatar, if available cachedAvatar = getAvatar(avatar->getAvatarID()); - if (cachedAvatar != NULL) + if (cachedAvatar != nullptr) { cachedAvatar->setForwardingEmail(avatar->getForwardingEmail()); } } } - if (cachedAvatar != NULL) + if (cachedAvatar != nullptr) { cachedAvatar = avatar; m_api->OnSetAvatarForwardingEmail(R->getTrack(), R->getResult(), cachedAvatar, R->getUser()); @@ -613,8 +613,8 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_SETAVATARINBOXLIMIT: { ResSetAvatarInboxLimit *R = static_cast(res); - ChatAvatar *cachedAvatar = NULL; - ChatAvatar *avatar = NULL; + ChatAvatar *cachedAvatar = nullptr; + ChatAvatar *avatar = nullptr; ChatAvatarCore *avatarCore = R->getAvatar(); if (R->getResult() == 0 && avatarCore) // if success @@ -625,14 +625,14 @@ void ChatAPICore::responseCallback(GenericResponse *res) // attempt to return locally cached avatar, if available cachedAvatar = getAvatar(avatar->getAvatarID()); - if (cachedAvatar != NULL) + if (cachedAvatar != nullptr) { cachedAvatar->setInboxLimit(avatar->getInboxLimit()); } } } - if (cachedAvatar != NULL) + if (cachedAvatar != nullptr) { cachedAvatar = avatar; m_api->OnSetAvatarInboxLimit(R->getTrack(), R->getResult(), cachedAvatar, R->getUser()); @@ -654,13 +654,13 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_GETROOM: { ResGetRoom *R = static_cast(res); - ChatRoom *room = NULL; + ChatRoom *room = nullptr; ChatRoomCore *roomCore = R->getRoom(); if (R->getResult() == 0 && roomCore) // if success { unsigned roomid = roomCore->getRoomID(); - if (getRoomCore(roomid) == NULL) + if (getRoomCore(roomid) == nullptr) { // we need to cache this room first cacheRoom(roomCore); @@ -708,8 +708,8 @@ void ChatAPICore::responseCallback(GenericResponse *res) { ResCreateRoom *R = static_cast(res); - ChatRoom *room = NULL; - ChatRoomCore* roomCore = NULL; + ChatRoom *room = nullptr; + ChatRoomCore* roomCore = nullptr; if (R->getResult() == 0) // if success { @@ -939,7 +939,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) else if (!room && !roomCore) { // we didn't have room cached, and we didn't get one to cache, - // thus we'll have trouble giving a callback with a NULL pointer. + // thus we'll have trouble giving a callback with a nullptr pointer. _chatdebug_("ChatAPI:BadData: RESPONSE_ENTERROOM: avatar=%p, room=%p , roomCore=%p\n", avatar, room, roomCore); } } @@ -1175,8 +1175,8 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_FINDAVATARBYUID: { ResFindAvatarByUID *R = static_cast(res); - ChatAvatar **avatarMatches = NULL; - ChatAvatarCore **avatarCoreMatches = NULL; + ChatAvatar **avatarMatches = nullptr; + ChatAvatarCore **avatarCoreMatches = nullptr; unsigned numAvatarsOnline = R->getNumAvatarsOnline(); @@ -1374,7 +1374,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) // duplicate login from this API, then effectively // our API must consider him logged out because he's now // no longer logged in to his AID controller. - m_api->OnLogoutAvatar(0, 0, avatar, NULL); + m_api->OnLogoutAvatar(0, 0, avatar, nullptr); } } @@ -1476,7 +1476,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_GETAVATARKEYWORDS: { ResGetAvatarKeywords *R = static_cast(res); - ChatAvatar *avatar = NULL; + ChatAvatar *avatar = nullptr; if(R->getResult() == CHATRESULT_SUCCESS) { @@ -1494,7 +1494,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_SETAVATARKEYWORDS: { ResSetAvatarKeywords *R = static_cast(res); - ChatAvatar *avatar = NULL; + ChatAvatar *avatar = nullptr; if(R->getResult() == CHATRESULT_SUCCESS) { avatar = getAvatar(R->getAvatarID()); @@ -1510,8 +1510,8 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_SEARCHAVATARKEYWORDS: { ResSearchAvatarKeywords *R = static_cast(res); - ChatAvatar **avatarMatches = NULL; - ChatAvatarCore **avatarCoreMatches = NULL; + ChatAvatar **avatarMatches = nullptr; + ChatAvatarCore **avatarCoreMatches = nullptr; if(R->getResult() == CHATRESULT_SUCCESS) { @@ -1530,7 +1530,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_CONFIRMFRIEND: { ResFriendConfirm *R = static_cast(res); - ChatAvatar *avatar = NULL; + ChatAvatar *avatar = nullptr; if(R->getResult() == CHATRESULT_SUCCESS) { avatar = getAvatar(R->getAvatarID()); @@ -1546,7 +1546,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_CONFIRMFRIEND_RECIPROCATE: { ResFriendConfirmReciprocate *R = static_cast(res); - ChatAvatar *avatar = NULL; + ChatAvatar *avatar = nullptr; if(R->getResult() == CHATRESULT_SUCCESS) { avatar = getAvatar(R->getAvatarID()); @@ -1616,7 +1616,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_ADDSNOOPAVATAR: { ResAddSnoopAvatar *R = static_cast(res); - ChatAvatar *avatar = NULL; + ChatAvatar *avatar = nullptr; if(R->getResult() == CHATRESULT_SUCCESS) { avatar = getAvatar(R->getSrcAvatarID()); @@ -1632,7 +1632,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_REMOVESNOOPAVATAR: { ResRemoveSnoopAvatar *R = static_cast(res); - ChatAvatar *avatar = NULL; + ChatAvatar *avatar = nullptr; if(R->getResult() == CHATRESULT_SUCCESS) { avatar = getAvatar(R->getSrcAvatarID()); @@ -1648,7 +1648,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_ADDSNOOPROOM: { ResAddSnoopRoom *R = static_cast(res); - ChatAvatar *avatar = NULL; + ChatAvatar *avatar = nullptr; if(R->getResult() == CHATRESULT_SUCCESS) { avatar = getAvatar(R->getSrcAvatarID()); @@ -1664,7 +1664,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_REMOVESNOOPROOM: { ResRemoveSnoopRoom *R = static_cast(res); - ChatAvatar *avatar = NULL; + ChatAvatar *avatar = nullptr; if(R->getResult() == CHATRESULT_SUCCESS) { avatar = getAvatar(R->getSrcAvatarID()); @@ -1680,7 +1680,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) case RESPONSE_GETSNOOPLIST: { ResGetSnoopList *R = static_cast(res); - ChatAvatar *avatar = NULL; + ChatAvatar *avatar = nullptr; if(R->getResult() == CHATRESULT_SUCCESS) { avatar = getAvatar(R->getSrcAvatarID()); @@ -1691,8 +1691,8 @@ void ChatAPICore::responseCallback(GenericResponse *res) _chatdebug_("ChatAPI:BadData: RESPONSE_REMOVESNOOPROOM: avatar=%p\n", avatar); } - AvatarSnoopPair **avatarList = NULL; - ChatUnicodeString **roomList = NULL; + AvatarSnoopPair **avatarList = nullptr; + ChatUnicodeString **roomList = nullptr; unsigned numAvatars = R->getAvatarSnoopListLength(); unsigned numRooms = R->getRoomSnoopListLength(); @@ -1763,7 +1763,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) ChatAvatar *destAvatar = getAvatar(M.getDestList()[i]); if (!destAvatar) { - _chatdebug_("ChatAPI:BadData: MESSAGE_ROOMMESSAGE: destAvatar[%i]=NULL\n", i); + _chatdebug_("ChatAPI:BadData: MESSAGE_ROOMMESSAGE: destAvatar[%i]=nullptr\n", i); continue; } m_api->OnReceiveRoomMessage(srcAvatar, destAvatar, destRoom, ChatUnicodeString(M.getMsg().data(), M.getMsg().size()), ChatUnicodeString(M.getOOB().data(), M.getOOB().size())); @@ -1797,7 +1797,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) ChatAvatar *destAvatar = getAvatar(M.getDestList()[i]); if (!destAvatar) { - _chatdebug_("ChatAPI:BadData: MESSAGE_BROADCASTMESSAGE: destAvatar[%i]=NULL\n", i); + _chatdebug_("ChatAPI:BadData: MESSAGE_BROADCASTMESSAGE: destAvatar[%i]=nullptr\n", i); continue; } m_api->OnReceiveBroadcastMessage(srcAvatar, ChatUnicodeString(M.getSrcAddress().data(), M.getSrcAddress().size()), destAvatar, ChatUnicodeString(M.getMsg().data(), M.getMsg().size()), ChatUnicodeString(M.getOOB().data(), M.getOOB().size())); @@ -1877,7 +1877,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) ChatRoomCore *destRoomCore = getRoomCore(M.getRoomID()); if (!destRoomCore) { - _chatdebug_("ChatAPI:destroomCore is null!"); + _chatdebug_("ChatAPI:destroomCore is nullptr!"); break; } @@ -1889,7 +1889,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) ChatAvatar *destAvatar = M.getDestAvatar()->getNewChatAvatar(); ChatAvatar *srcAvatar = M.getSrcAvatar()->getNewChatAvatar(); - ChatAvatarCore *kickedAvatar = destRoomCore ? destRoomCore->removeAvatar(destAvatar->getAvatarID()) : NULL; + ChatAvatarCore *kickedAvatar = destRoomCore ? destRoomCore->removeAvatar(destAvatar->getAvatarID()) : nullptr; ChatRoom *destRoom = getRoom(M.getRoomID()); if (!srcAvatar || !destAvatar || !kickedAvatar || !destRoom) @@ -2439,12 +2439,12 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) ChatAvatar *srcAvatar = M.getSrcAvatar()->getNewChatAvatar(); if (!srcAvatar) { - _chatdebug_("ChatAPI:BadData: MESSAGE_ENTERROOM: srcAvatar=NULL\n"); + _chatdebug_("ChatAPI:BadData: MESSAGE_ENTERROOM: srcAvatar=nullptr\n"); delete M.getSrcAvatar(); break; } - bool isLocalAvatar = (getAvatar(srcAvatar->getAvatarID()) != NULL); + bool isLocalAvatar = (getAvatar(srcAvatar->getAvatarID()) != nullptr); if(!destRoomCore->addAvatar(M.getSrcAvatar(),isLocalAvatar)) { delete M.getSrcAvatar(); @@ -2492,10 +2492,10 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) if (destRoomCore) { ChatRoom *destRoom = getRoom(M.getRoomID()); - ChatAvatar *srcAvatar = NULL; + ChatAvatar *srcAvatar = nullptr; if (!M.getSrcAvatar()) { - _chatdebug_("ChatAPI:BadData: MESSAGE_DESTROYROOM: M.getSrcAvatar=NULL\n"); + _chatdebug_("ChatAPI:BadData: MESSAGE_DESTROYROOM: M.getSrcAvatar=nullptr\n"); } else { @@ -2527,7 +2527,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) ChatRoomCore *destRoomCore = getRoomCore(M.getRoomID()); if (!destRoomCore) { - _chatdebug_("ChatAPI:BadData: MESSAGE_SETROOMPARAMS: destRoomCore=NULL\n"); + _chatdebug_("ChatAPI:BadData: MESSAGE_SETROOMPARAMS: destRoomCore=nullptr\n"); break; } @@ -2544,7 +2544,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) if (!M.getSrcAvatar()) { - _chatdebug_("ChatAPI:BadData: MESSAGE_SETROOMPARAMS: M.getSrcAvatar=NULL\n"); + _chatdebug_("ChatAPI:BadData: MESSAGE_SETROOMPARAMS: M.getSrcAvatar=nullptr\n"); break; } ChatAvatar *srcAvatar = M.getSrcAvatar()->getNewChatAvatar(); @@ -2686,7 +2686,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) { MAddAdmin M(iter); ChatRoomCore *destRoomCore = getRoomCore(M.getRoomID()); - if (destRoomCore && (destRoomCore->addAdministrator(M.getAvatar()) == NULL)) + if (destRoomCore && (destRoomCore->addAdministrator(M.getAvatar()) == nullptr)) { delete (M.getAvatar()); } @@ -2696,7 +2696,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) { MRemoveAdmin M(iter); ChatRoomCore *destRoomCore = getRoomCore(M.getRoomID()); - ChatAvatarCore *admin = NULL; + ChatAvatarCore *admin = nullptr; if (destRoomCore) admin = destRoomCore->removeAdministrator(M.getAvatarID()); delete admin; @@ -2707,7 +2707,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) MFriendConfirmRequest M(iter); if (!M.getSrcAvatar()) { - _chatdebug_("ChatAPI:BadData: MESSAGE_FRIENDCONFIRMREQUEST: M.getSrcAvatar=NULL\n"); + _chatdebug_("ChatAPI:BadData: MESSAGE_FRIENDCONFIRMREQUEST: M.getSrcAvatar=nullptr\n"); break; } ChatAvatar *srcAvatar = M.getSrcAvatar()->getNewChatAvatar(); @@ -2730,7 +2730,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) if (!M.getSrcAvatar()) { - _chatdebug_("ChatAPI:BadData: MESSAGE_FRIENDCONFIRMRESPONSE: M.getSrcAvatar=NULL\n"); + _chatdebug_("ChatAPI:BadData: MESSAGE_FRIENDCONFIRMRESPONSE: M.getSrcAvatar=nullptr\n"); break; } ChatAvatar *srcAvatar = M.getSrcAvatar()->getNewChatAvatar(); @@ -2752,7 +2752,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) MFriendConfirmReciprocateRequest M(iter); if (!M.getSrcAvatar()) { - _chatdebug_("ChatAPI:BadData: MESSAGE_FRIENDCONFIRMRECIPROCATE_REQUEST: M.getSrcAvatar=NULL\n"); + _chatdebug_("ChatAPI:BadData: MESSAGE_FRIENDCONFIRMRECIPROCATE_REQUEST: M.getSrcAvatar=nullptr\n"); break; } ChatAvatar *srcAvatar = M.getSrcAvatar()->getNewChatAvatar(); @@ -2775,7 +2775,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) if (!M.getSrcAvatar()) { - _chatdebug_("ChatAPI:BadData: MESSAGE_FRIENDCONFIRMRECIPROCATE_RESPONSE: M.getSrcAvatar=NULL\n"); + _chatdebug_("ChatAPI:BadData: MESSAGE_FRIENDCONFIRMRECIPROCATE_RESPONSE: M.getSrcAvatar=nullptr\n"); break; } ChatAvatar *srcAvatar = M.getSrcAvatar()->getNewChatAvatar(); @@ -2799,7 +2799,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) ChatRoomCore *destRoomCore = getRoomCore(M.getDestRoomID()); if (!destRoomCore) { - _chatdebug_("ChatAPI:BadData: MESSAGE_CHANGEROOMOWNER: destRoomCore=NULL\n"); + _chatdebug_("ChatAPI:BadData: MESSAGE_CHANGEROOMOWNER: destRoomCore=nullptr\n"); break; } @@ -2822,7 +2822,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) if (!M.getRequestorAvatar()) { - _chatdebug_("ChatAPI:BadData: MESSAGE_REQUESTROOMENTRY: M.getRequestorAvatar=NULL\n"); + _chatdebug_("ChatAPI:BadData: MESSAGE_REQUESTROOMENTRY: M.getRequestorAvatar=nullptr\n"); break; } ChatAvatar *srcAvatar = M.getRequestorAvatar()->getNewChatAvatar(); @@ -3025,7 +3025,7 @@ void ChatAPICore::processAPI() } // if we've been disconnected for at least a minute... else if (!m_connected && - time(NULL) - m_timeSinceLastDisconnect >= 60) + time(nullptr) - m_timeSinceLastDisconnect >= 60) { if (m_setToRegistrar) { @@ -3043,7 +3043,7 @@ void ChatAPICore::processAPI() m_setToRegistrar = true; } - m_timeSinceLastDisconnect = time(NULL); + m_timeSinceLastDisconnect = time(nullptr); } @@ -3072,7 +3072,7 @@ void ChatAPICore::OnConnect(const char *host, short port) res->setTrack(m_currTrack); m_currTrack++; - time_t timeout = time(NULL) + m_requestTimeout; + time_t timeout = time(nullptr) + m_requestTimeout; req->setTimeout(timeout); res->setTimeout(timeout); @@ -3103,7 +3103,7 @@ void ChatAPICore::OnConnect(const char *host, short port) res->setTrack(m_currTrack); m_currTrack++; - time_t timeout = time(NULL) + m_requestTimeout; + time_t timeout = time(nullptr) + m_requestTimeout; req->setTimeout(timeout); res->setTimeout(timeout); @@ -3147,7 +3147,7 @@ void ChatAPICore::OnDisconnect(const char *host, short port) // stop processing immediately suspendProcessing(); - m_timeSinceLastDisconnect = time(NULL); + m_timeSinceLastDisconnect = time(nullptr); // determine who we disconnected from and take appropriate action if (strcmp(host, m_registrarHost.c_str()) == 0 && @@ -3214,7 +3214,7 @@ void ChatAPICore::failoverReloginOneAvatar(ChatAvatarCore * avatarCore) res->setTrack(m_currTrack); m_currTrack++; - time_t timeout = time(NULL) + m_requestTimeout; + time_t timeout = time(nullptr) + m_requestTimeout; req->setTimeout(timeout); res->setTimeout(timeout); @@ -3241,7 +3241,7 @@ void ChatAPICore::failoverRecreateRooms() { // first build multimap of rooms keyed by their node level (ascending order is default). multimap levelMap; - ChatRoomCore *roomCore = NULL; + ChatRoomCore *roomCore = nullptr; for (roomIter = m_roomCoreCache.begin(); roomIter != m_roomCoreCache.end(); ++roomIter) { roomCore = (*roomIter).second; @@ -3268,7 +3268,7 @@ void ChatAPICore::failoverRecreateRooms() res->setTrack(m_currTrack); m_currTrack++; - time_t timeout = time(NULL) + m_requestTimeout; + time_t timeout = time(nullptr) + m_requestTimeout; req->setTimeout(timeout); res->setTimeout(timeout); @@ -3296,7 +3296,7 @@ void ChatAPICore::failoverRecreateRooms() ChatAvatar *ChatAPICore::getAvatar(const ChatUnicodeString &avatarName, const ChatUnicodeString &avatarAddress) { - ChatAvatar *returnVal = NULL; + ChatAvatar *returnVal = nullptr; map::iterator iter = m_avatarCache.begin(); @@ -3317,7 +3317,7 @@ ChatAvatar *ChatAPICore::getAvatar(const ChatUnicodeString &avatarName, const Ch ChatRoom *ChatAPICore::getRoom(const ChatUnicodeString &roomAddress) { - ChatRoom *returnVal = NULL; + ChatRoom *returnVal = nullptr; map::iterator iter = m_roomCache.begin(); diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatEnum.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatEnum.cpp index fba1bc17..f18fac5d 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatEnum.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatEnum.cpp @@ -43,7 +43,7 @@ ChatUnicodeString::ChatUnicodeString(const std::string& nSrc) ChatUnicodeString::ChatUnicodeString(const char *nStrSrc) { - if (nStrSrc==NULL) + if (nStrSrc==nullptr) { m_wideString = getEmptyString(); m_cString = wideToNarrow(m_wideString); diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatFriendStatusCore.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatFriendStatusCore.cpp index c6eea945..653f0cbd 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatFriendStatusCore.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatFriendStatusCore.cpp @@ -7,7 +7,7 @@ namespace ChatSystem using namespace Base; using namespace Plat_Unicode; ChatFriendStatusCore::ChatFriendStatusCore() -: m_interface(NULL), +: m_interface(nullptr), m_status(0) { } @@ -31,7 +31,7 @@ ChatFriendStatusCore::~ChatFriendStatusCore() } ChatFriendStatus::ChatFriendStatus() -: m_core(NULL) +: m_core(nullptr) { } diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatIgnoreStatusCore.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatIgnoreStatusCore.cpp index 06717992..a3fefe08 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatIgnoreStatusCore.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatIgnoreStatusCore.cpp @@ -7,7 +7,7 @@ namespace ChatSystem using namespace Plat_Unicode; ChatIgnoreStatus::ChatIgnoreStatus() - : m_core(NULL) + : m_core(nullptr) { } @@ -16,7 +16,7 @@ namespace ChatSystem } ChatIgnoreStatusCore::ChatIgnoreStatusCore() - : m_interface(NULL) + : m_interface(nullptr) { } diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatRoom.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatRoom.cpp index d022aafa..cdd0238a 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatRoom.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatRoom.cpp @@ -581,7 +581,7 @@ unsigned RoomSummary::getRoomMaxSize() const ChatRoom::ChatRoom() { - m_core = NULL; + m_core = nullptr; } ChatRoom::ChatRoom(ChatRoomCore *core) diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatRoomCore.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatRoomCore.cpp index 715a943a..d0c70f68 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatRoomCore.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatRoomCore.cpp @@ -189,7 +189,7 @@ ChatRoomCore::~ChatRoomCore() ChatAvatarCore *ChatRoomCore::getAvatarCore(unsigned avatarID) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; map::iterator iterCore = m_inroomAvatarsCore.find(avatarID); @@ -202,7 +202,7 @@ ChatAvatarCore *ChatRoomCore::getAvatarCore(unsigned avatarID) ChatAvatar *ChatRoomCore::getAvatar(unsigned avatarID) { - ChatAvatar *returnAvatar = NULL; + ChatAvatar *returnAvatar = nullptr; map::iterator iter = m_inroomAvatars.find(avatarID); @@ -215,7 +215,7 @@ ChatAvatar *ChatRoomCore::getAvatar(unsigned avatarID) ChatAvatarCore *ChatRoomCore::getModeratorCore(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; set::iterator iterCore = m_moderatorAvatarsCore.begin(); @@ -238,7 +238,7 @@ ChatAvatarCore *ChatRoomCore::getModeratorCore(const Plat_Unicode::String &name, ChatAvatar *ChatRoomCore::getModerator(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - ChatAvatar *returnAvatar = NULL; + ChatAvatar *returnAvatar = nullptr; set::iterator iter = m_moderatorAvatars.begin(); @@ -263,7 +263,7 @@ ChatAvatar *ChatRoomCore::getModerator(const Plat_Unicode::String &name, const P ChatAvatarCore *ChatRoomCore::getBannedCore(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; set::iterator iterCore = m_banAvatarsCore.begin(); @@ -286,7 +286,7 @@ ChatAvatarCore *ChatRoomCore::getBannedCore(const Plat_Unicode::String &name, co ChatAvatar *ChatRoomCore::getBanned(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - ChatAvatar *returnAvatar = NULL; + ChatAvatar *returnAvatar = nullptr; set::iterator iter = m_banAvatars.begin(); @@ -311,7 +311,7 @@ ChatAvatar *ChatRoomCore::getBanned(const Plat_Unicode::String &name, const Plat ChatAvatarCore *ChatRoomCore::getInvitedCore(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; set::iterator iterCore = m_inviteAvatarsCore.begin(); @@ -334,7 +334,7 @@ ChatAvatarCore *ChatRoomCore::getInvitedCore(const Plat_Unicode::String &name, c ChatAvatar *ChatRoomCore::getInvited(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - ChatAvatar *returnAvatar = NULL; + ChatAvatar *returnAvatar = nullptr; set::iterator iter = m_inviteAvatars.begin(); @@ -359,7 +359,7 @@ ChatAvatar *ChatRoomCore::getInvited(const Plat_Unicode::String &name, const Pla ChatAvatarCore *ChatRoomCore::addAvatar(ChatAvatarCore *newAvatar, bool local) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; if(newAvatar) { @@ -394,7 +394,7 @@ void ChatRoomCore::addLocalAvatar(unsigned avatarID) ChatAvatarCore *ChatRoomCore::removeAvatar(unsigned avatarID) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; map::iterator iterCore = m_inroomAvatarsCore.find(avatarID); @@ -422,7 +422,7 @@ ChatAvatarCore *ChatRoomCore::removeAvatar(unsigned avatarID) ChatAvatarCore *ChatRoomCore::addBan(ChatAvatarCore *newAvatar) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; if(newAvatar) { @@ -446,7 +446,7 @@ ChatAvatarCore *ChatRoomCore::addBan(ChatAvatarCore *newAvatar) ChatAvatarCore *ChatRoomCore::removeBan(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; set::iterator iterCore = m_banAvatarsCore.begin(); @@ -494,7 +494,7 @@ ChatAvatarCore *ChatRoomCore::removeBan(const Plat_Unicode::String &name, const ChatAvatarCore *ChatRoomCore::addAdministrator(ChatAvatarCore *newAvatar) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; if(newAvatar) { @@ -518,7 +518,7 @@ ChatAvatarCore *ChatRoomCore::addAdministrator(ChatAvatarCore *newAvatar) ChatAvatarCore *ChatRoomCore::removeAdministrator(unsigned avatarID) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; map::iterator iterCore = m_adminAvatarsCore.find(avatarID); @@ -541,7 +541,7 @@ ChatAvatarCore *ChatRoomCore::removeAdministrator(unsigned avatarID) ChatAvatarCore *ChatRoomCore::addModerator(ChatAvatarCore *newAvatar) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; if(newAvatar) { @@ -565,7 +565,7 @@ ChatAvatarCore *ChatRoomCore::addModerator(ChatAvatarCore *newAvatar) ChatAvatarCore *ChatRoomCore::removeModerator(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; set::iterator iterCore = m_moderatorAvatarsCore.begin(); @@ -613,7 +613,7 @@ ChatAvatarCore *ChatRoomCore::removeModerator(const Plat_Unicode::String &name, ChatAvatarCore *ChatRoomCore::addTempModerator(ChatAvatarCore *newAvatar) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; if(newAvatar) { @@ -637,7 +637,7 @@ ChatAvatarCore *ChatRoomCore::addTempModerator(ChatAvatarCore *newAvatar) ChatAvatarCore *ChatRoomCore::removeTempModerator(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; set::iterator iterCore = m_tempModeratorAvatarsCore.begin(); @@ -685,7 +685,7 @@ ChatAvatarCore *ChatRoomCore::removeTempModerator(const Plat_Unicode::String &na ChatAvatarCore *ChatRoomCore::addInvite(ChatAvatarCore* newAvatar) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; if(newAvatar) { @@ -709,7 +709,7 @@ ChatAvatarCore *ChatRoomCore::addInvite(ChatAvatarCore* newAvatar) ChatAvatarCore *ChatRoomCore::removeInvite(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; set::iterator iterCore = m_inviteAvatarsCore.begin(); @@ -757,7 +757,7 @@ ChatAvatarCore *ChatRoomCore::removeInvite(const Plat_Unicode::String &name, con ChatAvatarCore *ChatRoomCore::addVoice(ChatAvatarCore* newAvatar) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; if(newAvatar) { @@ -781,7 +781,7 @@ ChatAvatarCore *ChatRoomCore::addVoice(ChatAvatarCore* newAvatar) ChatAvatarCore *ChatRoomCore::removeVoice(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - ChatAvatarCore *returnAvatar = NULL; + ChatAvatarCore *returnAvatar = nullptr; set::iterator iterCore = m_voiceAvatarsCore.begin(); @@ -1053,7 +1053,7 @@ void ChatRoomCore::serializeWithLocalAvatarsOnly(Base::ByteStream &msg) for (avatarIter = m_inroomAvatarsCore.begin(); avatarIter != m_inroomAvatarsCore.end(); ++avatarIter) { // include only the avatars that are on this API - if ( this->getAvatar((*avatarIter).second->getAvatarID()) != NULL ) + if ( this->getAvatar((*avatarIter).second->getAvatarID()) != nullptr ) { avatarsToSend.insert((*avatarIter).second); } diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Message.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Message.cpp index d38defbc..93e7e8e5 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Message.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Message.cpp @@ -21,7 +21,7 @@ namespace ChatSystem MRoomMessage::MRoomMessage(ByteStream::ReadIterator &iter) : GenericMessage(MESSAGE_ROOMMESSAGE), - m_destList(NULL), + m_destList(nullptr), m_srcAvatar(iter), m_messageID(0) { @@ -45,13 +45,13 @@ namespace ChatSystem MRoomMessage::~MRoomMessage() { delete[] m_destList; - m_destList = NULL; + m_destList = nullptr; } MBroadcastMessage::MBroadcastMessage(ByteStream::ReadIterator &iter) : GenericMessage(MESSAGE_BROADCASTMESSAGE), m_srcAvatar(iter), - m_destList(NULL) + m_destList(nullptr) { ASSERT_VALID_STRING_LENGTH(get(iter, m_srcAddress)); get(iter, m_listLength); @@ -68,7 +68,7 @@ namespace ChatSystem MBroadcastMessage::~MBroadcastMessage() { delete[] m_destList; - m_destList = NULL; + m_destList = nullptr; } MFilterMessage::MFilterMessage(ByteStream::ReadIterator &iter) diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/PersistentMessage.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/PersistentMessage.cpp index ca4b509e..bb9cfb82 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/PersistentMessage.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/PersistentMessage.cpp @@ -8,7 +8,7 @@ using namespace Base; using namespace Plat_Unicode; PersistentHeader::PersistentHeader() -: m_core(NULL) +: m_core(nullptr) { } @@ -66,7 +66,7 @@ PersistentHeaderCore::PersistentHeaderCore() m_avatarID(0), m_sentTime(0), m_status(0), - m_interface(NULL) + m_interface(nullptr) { } diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Request.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Request.cpp index 01afbcf7..2f7600ac 100644 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Request.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Request.cpp @@ -127,7 +127,7 @@ void RGetAvatarKeywords::pack(ByteStream &msg) RSearchAvatarKeywords::RSearchAvatarKeywords(const ChatUnicodeString &nodeAddress, const ChatUnicodeString *keywordsList, unsigned keywordsLength) : GenericRequest(REQUEST_SEARCHAVATARKEYWORDS), m_keywordsLength(keywordsLength), - m_keywordsList(NULL) + m_keywordsList(nullptr) { m_nodeAddress.assign(nodeAddress.string_data); m_keywordsList = new String[keywordsLength]; @@ -898,7 +898,7 @@ m_srcAddress(srcAddress.string_data, srcAddress.string_length), m_destRoomAddress(destRoomAddress.string_data, destRoomAddress.string_length) { // we take in a const RoomParams, so make our own and guarantee - // null-terminated char buffers. + // nullptr-terminated char buffers. m_newRoomName.assign(params->getRoomName().string_data, params->getRoomName().string_length); m_newRoomTopic.assign(params->getRoomTopic().string_data, params->getRoomTopic().string_length); m_newRoomPassword.assign(params->getRoomPassword().string_data, params->getRoomPassword().string_length); diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Response.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Response.cpp index 25d587fc..44a2f0dd 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Response.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Response.cpp @@ -20,7 +20,7 @@ using namespace Plat_Unicode; ResLoginAvatar::ResLoginAvatar(void *user, int avatarLoginPriority) : GenericResponse(RESPONSE_LOGINAVATAR, CHATRESULT_TIMEOUT, user), - m_avatar(NULL), + m_avatar(nullptr), m_submittedPriority(avatarLoginPriority), m_requiredPriority(INT_MAX) { @@ -63,7 +63,7 @@ void ResLoginAvatar::unpack(ByteStream::ReadIterator &iter) ResTemporaryAvatar::ResTemporaryAvatar(void *user) : GenericResponse(RESPONSE_TEMPORARYAVATAR, CHATRESULT_TIMEOUT, user) -, m_avatar(NULL) +, m_avatar(nullptr) { } @@ -110,7 +110,7 @@ void ResDestroyAvatar::unpack(ByteStream::ReadIterator &iter) ResGetAvatar::ResGetAvatar(void *user) : GenericResponse(RESPONSE_GETAVATAR, CHATRESULT_TIMEOUT, user), - m_avatar(NULL) + m_avatar(nullptr) { } @@ -144,7 +144,7 @@ void ResGetAvatar::unpack(ByteStream::ReadIterator &iter) ResGetAnyAvatar::ResGetAnyAvatar(void* user) : GenericResponse( RESPONSE_GETANYAVATAR, CHATRESULT_TIMEOUT, user ) - , m_avatar( NULL ) + , m_avatar( nullptr ) { } @@ -181,8 +181,8 @@ void ResGetAnyAvatar::unpack(Base::ByteStream::ReadIterator& iter) ResAvatarList::ResAvatarList(void *user) : GenericResponse(RESPONSE_AVATARLIST, CHATRESULT_TIMEOUT, user) , m_listLength(0) -, m_avatarList(NULL) -, m_cores(NULL) +, m_avatarList(nullptr) +, m_cores(nullptr) { } @@ -214,7 +214,7 @@ void ResAvatarList::unpack(ByteStream::ReadIterator &iter) ResSetAvatarAttributes::ResSetAvatarAttributes(void *user) : GenericResponse(RESPONSE_SETAVATARATTRIBUTES, CHATRESULT_TIMEOUT, user), - m_avatar(NULL) + m_avatar(nullptr) { } @@ -248,7 +248,7 @@ void ResSetAvatarAttributes::unpack(ByteStream::ReadIterator &iter) ResSetAvatarStatusMessage::ResSetAvatarStatusMessage(void *user) : GenericResponse(RESPONSE_SETSTATUSMESSAGE, CHATRESULT_TIMEOUT, user), -m_avatar(NULL) +m_avatar(nullptr) { } @@ -285,7 +285,7 @@ void ResSetAvatarStatusMessage::unpack(ByteStream::ReadIterator &iter) ResSetAvatarForwardingEmail::ResSetAvatarForwardingEmail(void *user) : GenericResponse(RESPONSE_SETAVATAREMAIL, CHATRESULT_TIMEOUT, user), - m_avatar(NULL) + m_avatar(nullptr) { } @@ -312,7 +312,7 @@ void ResSetAvatarForwardingEmail::unpack(ByteStream::ReadIterator &iter) ResSetAvatarInboxLimit::ResSetAvatarInboxLimit(void *user) : GenericResponse(RESPONSE_SETAVATARINBOXLIMIT, CHATRESULT_TIMEOUT, user), - m_avatar(NULL) + m_avatar(nullptr) { } @@ -340,7 +340,7 @@ void ResSetAvatarInboxLimit::unpack(ByteStream::ReadIterator &iter) ResSearchAvatarKeywords::ResSearchAvatarKeywords(void *user) : GenericResponse(RESPONSE_SETAVATARKEYWORDS, CHATRESULT_TIMEOUT, user), m_numMatches(0), - m_avatarMatches(NULL) + m_avatarMatches(nullptr) { } @@ -388,8 +388,8 @@ void ResSetAvatarKeywords::unpack(ByteStream::ReadIterator &iter) ResGetAvatarKeywords::ResGetAvatarKeywords(void *user, unsigned avatarID) : GenericResponse(RESPONSE_GETAVATARKEYWORDS, CHATRESULT_TIMEOUT, user), m_avatarID(avatarID), - m_keywordList(NULL), - m_chatStrList(NULL) + m_keywordList(nullptr), + m_chatStrList(nullptr) { } @@ -420,7 +420,7 @@ void ResGetAvatarKeywords::unpack(ByteStream::ReadIterator &iter) ResGetRoom::ResGetRoom(void *user) : GenericResponse(RESPONSE_GETROOM, CHATRESULT_TIMEOUT, user), - m_room(NULL), + m_room(nullptr), m_numExtraRooms(0) { } @@ -448,7 +448,7 @@ void ResGetRoom::unpack(ByteStream::ReadIterator &iter) ResCreateRoom::ResCreateRoom(void *user, unsigned avatarID) : GenericResponse(RESPONSE_CREATEROOM, CHATRESULT_TIMEOUT, user), m_srcAvatarID(avatarID), - m_room(NULL), + m_room(nullptr), m_numExtraRooms(0) { } @@ -637,8 +637,8 @@ ResFriendStatus::ResFriendStatus(void *user, unsigned avatarID) : GenericResponse(RESPONSE_FRIENDSTATUS, CHATRESULT_TIMEOUT, user), m_avatarID(avatarID), m_listLength(0), - m_friendList(NULL), - m_cores(NULL) + m_friendList(nullptr), + m_cores(nullptr) { } @@ -704,8 +704,8 @@ ResIgnoreStatus::ResIgnoreStatus(void *user, unsigned avatarID) : GenericResponse(RESPONSE_IGNORESTATUS, CHATRESULT_TIMEOUT, user), m_avatarID(avatarID), m_listLength(0), - m_ignoreList(NULL), - m_cores(NULL) + m_ignoreList(nullptr), + m_cores(nullptr) { } @@ -740,7 +740,7 @@ ResEnterRoom::ResEnterRoom(void *user, unsigned avatarID, const ChatUnicodeStrin m_avatarID(avatarID), m_destAddress(destAddress.string_data, destAddress.string_length), m_gotRoomObj(false), - m_room(NULL), + m_room(nullptr), m_numExtraRooms(0) { } @@ -1012,7 +1012,7 @@ void ResChangeRoomOwner::unpack(ByteStream::ReadIterator &iter) ResGetRoomSummaries::ResGetRoomSummaries(void *user) : GenericResponse(RESPONSE_GETROOMSUMMARIES, CHATRESULT_TIMEOUT, user), m_numRooms(0), - m_roomSummaries(NULL) + m_roomSummaries(nullptr) { } @@ -1132,8 +1132,8 @@ ResGetPersistentMessage::ResGetPersistentMessage(void *user, unsigned srcAvatarI : GenericResponse(RESPONSE_GETPERSISTENTMESSAGE, CHATRESULT_TIMEOUT, user), m_srcAvatarID(srcAvatarID), m_messageID(messageID), - m_core(NULL), - m_header(NULL) + m_core(nullptr), + m_header(nullptr) { } @@ -1167,7 +1167,7 @@ void ResGetPersistentMessage::unpack(ByteStream::ReadIterator &iter) ResGetMultiplePersistentMessages::ResGetMultiplePersistentMessages(void *user, unsigned srcAvatarID) : GenericResponse(RESPONSE_GETMULTIPLEPERSISTENTMESSAGES, CHATRESULT_TIMEOUT, user), m_srcAvatarID(srcAvatarID), - m_messages(NULL) + m_messages(nullptr) { } @@ -1217,8 +1217,8 @@ ResGetPersistentHeaders::ResGetPersistentHeaders(void *user, unsigned srcAvatarI : GenericResponse(RESPONSE_GETPERSISTENTHEADERS, CHATRESULT_TIMEOUT, user), m_srcAvatarID(srcAvatarID), m_listLength(0), - m_headers(NULL), - m_cores(NULL) + m_headers(nullptr), + m_cores(nullptr) { } @@ -1263,8 +1263,8 @@ ResGetPartialPersistentHeaders::ResGetPartialPersistentHeaders(void *user, unsig : GenericResponse(RESPONSE_PARTIALPERSISTENTHEADERS, CHATRESULT_TIMEOUT, user), m_srcAvatarID(srcAvatarID), m_listLength(0), - m_headers(NULL), - m_cores(NULL) + m_headers(nullptr), + m_cores(nullptr) { } @@ -1396,7 +1396,7 @@ void ResUnregisterRoom::unpack(ByteStream::ReadIterator &iter) } ResFailoverReloginAvatar::ResFailoverReloginAvatar(unsigned avatarID) -: GenericResponse(RESPONSE_FAILOVER_RELOGINAVATAR, CHATRESULT_TIMEOUT, NULL), +: GenericResponse(RESPONSE_FAILOVER_RELOGINAVATAR, CHATRESULT_TIMEOUT, nullptr), m_avatarID(avatarID) { } @@ -1414,9 +1414,9 @@ void ResFailoverReloginAvatar::unpack(ByteStream::ReadIterator &iter) } ResFailoverRecreateRoom::ResFailoverRecreateRoom(unsigned roomID, bool forced) -: GenericResponse(RESPONSE_FAILOVER_RECREATEROOM, CHATRESULT_TIMEOUT, NULL), +: GenericResponse(RESPONSE_FAILOVER_RECREATEROOM, CHATRESULT_TIMEOUT, nullptr), m_roomID(roomID), - m_room(NULL), + m_room(nullptr), m_forced(forced) { } @@ -1478,7 +1478,7 @@ void ResGetFanClubHandle::unpack(ByteStream::ReadIterator &iter) ResFindAvatarByUID::ResFindAvatarByUID(void *user) : GenericResponse(RESPONSE_FINDAVATARBYUID, CHATRESULT_TIMEOUT, user), m_numAvatarsOnline(0), - m_avatars(NULL) + m_avatars(nullptr) { } @@ -1512,7 +1512,7 @@ void ResFindAvatarByUID::unpack(ByteStream::ReadIterator &iter) } ResRegistrarGetChatServer::ResRegistrarGetChatServer() -: GenericResponse(RESPONSE_REGISTRAR_GETCHATSERVER, CHATRESULT_TIMEOUT, NULL) +: GenericResponse(RESPONSE_REGISTRAR_GETCHATSERVER, CHATRESULT_TIMEOUT, nullptr) { } @@ -1527,7 +1527,7 @@ void ResRegistrarGetChatServer::unpack(ByteStream::ReadIterator &iter) } ResSendApiVersion::ResSendApiVersion() -: GenericResponse(RESPONSE_SETAPIVERSION, CHATRESULT_TIMEOUT, NULL) +: GenericResponse(RESPONSE_SETAPIVERSION, CHATRESULT_TIMEOUT, nullptr) { } @@ -1600,8 +1600,8 @@ void ResRemoveSnoopRoom::unpack(ByteStream::ReadIterator &iter) ResGetSnoopList::ResGetSnoopList(void *user, unsigned srcAvatarID) : GenericResponse(RESPONSE_GETSNOOPLIST, CHATRESULT_TIMEOUT, user), m_srcAvatarID(srcAvatarID), - m_avatarSnoops(NULL), - m_roomSnoops(NULL) + m_avatarSnoops(nullptr), + m_roomSnoops(nullptr) { } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/Archive.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Base/Archive.cpp index c7a1b9a8..2d6b1839 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/Archive.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/Archive.cpp @@ -107,7 +107,7 @@ namespace Base ByteStream::ByteStream() : allocatedSize(0), beginReadIterator(), - data(NULL), + data(nullptr), size(0), lastPutSize(0) { @@ -224,7 +224,7 @@ namespace Base if(data->size < allocatedSize) { unsigned char * tmp = new unsigned char[newSize]; - if(data->buffer != NULL) + if(data->buffer != nullptr) memcpy(tmp, data->buffer, size); delete[] data->buffer; data->buffer = tmp; diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/AutoLog.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Base/AutoLog.cpp index 660d838d..24292a4e 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/AutoLog.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/AutoLog.cpp @@ -35,7 +35,7 @@ bool CAutoLog::Open(const char * filename) //------------------------------------- { - if( NULL == filename) + if( nullptr == filename) return false; if (pFilename) @@ -45,13 +45,13 @@ bool CAutoLog::Open(const char * filename) // Sanitize slashes char *ptr; - while ((ptr = strchr(pFilename,WRONGSLASH)) != NULL) + while ((ptr = strchr(pFilename,WRONGSLASH)) != nullptr) *ptr = SLASHCHAR[0]; char strPath[1024]; strcpy(strPath,pFilename); ptr = strrchr(strPath, SLASHCHAR[0]); - if (ptr != NULL) + if (ptr != nullptr) { *ptr = 0; @@ -59,11 +59,11 @@ bool CAutoLog::Open(const char * filename) char curdir[128]; // remember current directory - if( getcwd(curdir,sizeof(curdir)) == NULL ) + if( getcwd(curdir,sizeof(curdir)) == nullptr ) { fprintf(stderr,"CAutoLog::Archive failed to get current directory!\n"); free(pFilename); - pFilename = NULL; + pFilename = nullptr; return false; // error, can't proceed } @@ -74,7 +74,7 @@ bool CAutoLog::Open(const char * filename) { fprintf(stderr,"CAutoLog::Archive failed to make directory: %s\n", strPath); free(pFilename); - pFilename = NULL; + pFilename = nullptr; return false; // error, can't proceed } } @@ -94,7 +94,7 @@ bool CAutoLog::Open(const char * filename) { fprintf(stderr,"CAutoLog::Archive failed to make directory: %s\n", strPath); free(pFilename); - pFilename = NULL; + pFilename = nullptr; return false; // error, can't proceed } } @@ -103,7 +103,7 @@ bool CAutoLog::Open(const char * filename) pFile = fopen(pFilename,"a+"); - if( pFile == NULL || pFile == (FILE *)-1) + if( pFile == nullptr || pFile == (FILE *)-1) { //fprintf(stderr,"CAutoLog::Open failed to open log file: %s\n",pFilename); Close(); @@ -123,7 +123,7 @@ bool CAutoLog::Open(const char * filename) void CAutoLog::Close(void) //------------------------------------- { - if( pFile != (FILE *)-1 && pFile != NULL) + if( pFile != (FILE *)-1 && pFile != nullptr) { fclose(pFile); } @@ -131,7 +131,7 @@ void CAutoLog::Close(void) free(pFilename); - pFilename = NULL; + pFilename = nullptr; } //------------------------------------- @@ -194,7 +194,7 @@ void CAutoLog::LogDebug(char * format, ...) void CAutoLog::Log(eLogLevel severity, char *fmt, ...) //------------------------------------- { - if (pFile == (FILE *)-1 || pFile == NULL) + if (pFile == (FILE *)-1 || pFile == nullptr) { //fprintf(stderr,"CAutoLog::Log called with no file open!\n"); return; @@ -250,7 +250,7 @@ void CAutoLog::Log(eLogLevel severity, char *fmt, ...) void CAutoLog::Archive(void) //------------------------------------- { - if( pFile == (FILE *)-1 || pFile == NULL) + if( pFile == (FILE *)-1 || pFile == nullptr) { //fprintf(stderr,"CAutoLog::Archive called with no file open!\n"); return; @@ -281,7 +281,7 @@ void CAutoLog::Archive(void) strcpy(strCurrent,pFilename); pCurrent = strrchr(strCurrent, SLASHCHAR[0]); - if (pCurrent != NULL) + if (pCurrent != nullptr) *pCurrent = 0; else sprintf(strCurrent,"."); @@ -290,7 +290,7 @@ void CAutoLog::Archive(void) #ifdef WIN32 // remember current directory - if( getcwd(curdir,sizeof(curdir)) == NULL ) + if( getcwd(curdir,sizeof(curdir)) == nullptr ) { fprintf(stderr,"CAutoLog::Archive failed to get current directory!\n"); return; // error, can't proceed @@ -324,7 +324,7 @@ void CAutoLog::Archive(void) #endif pCurrent = strrchr(pFilename, SLASHCHAR[0]); - if (pCurrent == NULL) + if (pCurrent == nullptr) pCurrent = pFilename; else pCurrent++; diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/AutoLog.h b/external/3rd/library/soePlatform/ChatAPI/utils/Base/AutoLog.h index 0a90a774..18871c7f 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/AutoLog.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/AutoLog.h @@ -92,14 +92,14 @@ namespace Base //------------------------------------- inline CAutoLog::CAutoLog() { - pFilename = NULL; + pFilename = nullptr; pFile = (FILE *)-1; } //------------------------------------- inline CAutoLog::CAutoLog(const char * file) { - pFilename = NULL; + pFilename = nullptr; pFile = (FILE *)-1; Open(file); } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/CmdLine.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Base/CmdLine.cpp index b9d5b3e3..dcaf025a 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/CmdLine.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/CmdLine.cpp @@ -135,7 +135,7 @@ int CCmdLine::SplitLine(int argc, char **argv) bool CCmdLine::IsSwitch(const char *pParam) { - if (pParam==NULL) + if (pParam==nullptr) return false; // switches must non-empty @@ -204,7 +204,7 @@ StringType CCmdLine::GetSafeArgument(const char *pSwitch, int iIdx, const char * { StringType sRet; - if (pDefault!=NULL) + if (pDefault!=nullptr) sRet = pDefault; try diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/Config.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Base/Config.cpp index c5dd63d8..eb6dc55e 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/Config.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/Config.cpp @@ -28,7 +28,7 @@ bool CConfig::LoadFile(char * file) // open file fp = fopen(file, "r"); - if (fp == NULL || fp == (FILE *)-1) + if (fp == nullptr || fp == (FILE *)-1) { //fprintf(stderr,"Failed to open config file %s!",file); return false; @@ -71,21 +71,21 @@ void CConfig::UnloadFile(void) //----------------------------------- { delete[] pConfig; - pConfig = NULL; + pConfig = nullptr; } //----------------------------------- /// finds a key of the config in memory // key argument is case-insensitive, but must be upper case in config file -// Returns true for success (passing NULL is a special case returned as success) +// Returns true for success (passing nullptr is a special case returned as success) bool CConfig::FindKey(char *key) //----------------------------------- { - if (pConfig == NULL) + if (pConfig == nullptr) return false; // special case...continue with existing key - if (key == NULL) + if (key == nullptr) return true; // form the search key @@ -96,12 +96,12 @@ bool CConfig::FindKey(char *key) // find the key heading pCursor = strstr(pConfig,strBuffer); - if (pCursor==NULL) + if (pCursor==nullptr) return false; // find the closing bracket of key heading pCursor = strchr(pCursor,']'); - if (pCursor==NULL) + if (pCursor==nullptr) return false; pCursor++; @@ -110,7 +110,7 @@ bool CConfig::FindKey(char *key) //----------------------------------- /// extract a number from the config string -// pass the key to find the first number in the list, else NULL to find the next number in the list +// pass the key to find the first number in the list, else nullptr to find the next number in the list // returns 0 if no number is found, else returns the number long CConfig::GetLong(char *key) //----------------------------------- @@ -133,20 +133,20 @@ long CConfig::GetLong(char *key) //----------------------------------- /// extract string (in double-quotes) from the list. -// pass the key to find the first string in the list, else NULL to find the next string in the list -// returns NULL if no string found, else returns a temporary copy of the string (without quotes) +// pass the key to find the first string in the list, else nullptr to find the next string in the list +// returns nullptr if no string found, else returns a temporary copy of the string (without quotes) char * CConfig::GetString(char *key) //----------------------------------- { if (!FindKey(key)) - return NULL; + return nullptr; // look for start of string or end of key while (*pCursor && *pCursor != '"' && *pCursor != '[') pCursor++; if (*(pCursor++) != '"') - return NULL; + return nullptr; // until closing quote int c = 0; @@ -160,7 +160,7 @@ char * CConfig::GetString(char *key) } } - return NULL; + return nullptr; } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/Config.h b/external/3rd/library/soePlatform/ChatAPI/utils/Base/Config.h index 864506f3..6f6dc376 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/Config.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/Config.h @@ -10,7 +10,7 @@ ; list of strings, with code example # config.FindKey("NUMBERS"); -# while (number = config.GetLong(NULL)) +# while (number = config.GetLong(nullptr)) # YourHandleNumber(number); [NUMBERS] 100 200, 300 ; formatting is very flexible as long as numbers are delimited by non-numbers @@ -23,7 +23,7 @@ ; list of strings, with code example # config.FindKey("HOSTS"); -# while (string = config.GetString(NULL)) +# while (string = config.GetString(nullptr)) # YourHandleString(string); [HOSTS] "127.0.0.1:5999" @@ -68,16 +68,16 @@ namespace Base // returns TRUE if key is found. bool FindKey(char *key); - // extract string from config. If key is NULL, extract next string in list, else extract first string. - // if key was not found, returns NULL - char * GetString(char *key = NULL); + // extract string from config. If key is nullptr, extract next string in list, else extract first string. + // if key was not found, returns nullptr + char * GetString(char *key = nullptr); - // extract number from config. If key is NULL, extract next number in list, else extract first number. + // extract number from config. If key is nullptr, extract next number in list, else extract first number. // if key was not found, returns 0 - long GetLong(char *key = NULL); // extract number from config. + long GetLong(char *key = nullptr); // extract number from config. // indicate if config file has been loaded - inline bool FileLoaded() { return pConfig == NULL ? false : true; } + inline bool FileLoaded() { return pConfig == nullptr ? false : true; } private: char * pConfig; // pointer to file memory @@ -87,14 +87,14 @@ namespace Base inline CConfig::CConfig() { - pConfig = NULL; - pCursor = NULL; + pConfig = nullptr; + pCursor = nullptr; } inline CConfig::CConfig(char * file) { - pConfig = NULL; - pCursor = NULL; + pConfig = nullptr; + pCursor = nullptr; LoadFile(file); } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/Logger.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Base/Logger.cpp index 8942bfdd..4cdc4532 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/Logger.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/Logger.cpp @@ -120,7 +120,7 @@ Logger::Logger(const char *programName, void Logger::LoggerInit(const char *programName) { char buf[1024]; - FILE *logDir = NULL; + FILE *logDir = nullptr; if (0 != (m_combinedLogType & eUseLocalFile)) { @@ -129,13 +129,13 @@ void Logger::LoggerInit(const char *programName) { cmkdir(m_dirPrefix.c_str(), 0755); } - else if(logDir != NULL) + else if(logDir != nullptr) { fclose(logDir); } tm now; - time_t t = time(NULL); + time_t t = time(nullptr); LOGGER_GET_CURR_TIME(now, t); @@ -153,7 +153,7 @@ void Logger::LoggerInit(const char *programName) { cmkdir(buf, 0755); } - else if(logDir != NULL) + else if(logDir != nullptr) { fclose(logDir); } @@ -279,7 +279,7 @@ void Logger::addLog(const char *id, unsigned logenum, int level, unsigned size) else { newLog->file = fopen(newLog->filename.c_str(), "a+"); - if(newLog->file == NULL) + if(newLog->file == nullptr) { printf("Open file %s failed\n", newLog->filename.c_str()); } @@ -313,7 +313,7 @@ void Logger::addLog(const char *id, unsigned logenum) else { newLog->file = fopen(newLog->filename.c_str(), "a+"); - if(newLog->file == NULL) + if(newLog->file == nullptr) { printf("Open file %s failed\n", newLog->filename.c_str()); } @@ -368,7 +368,7 @@ void Logger::logSimple(unsigned logenum, int level, const char *message) { return; } - time_t t = time(NULL); + time_t t = time(nullptr); LogInfo *info = (*iter).second; if(level >= info->level) { @@ -444,7 +444,7 @@ void Logger::logSimpleWithSys(unsigned logenum, unsigned priority, int level, co { return; } - time_t t = time(NULL); + time_t t = time(nullptr); LogInfo *info = (*iter).second; if(level >= info->level) @@ -514,7 +514,7 @@ void Logger::log(unsigned logenum, int level, const char *message, ...) // ensure that the buf does not contain any '%' characters. // prevent crash problem char *rv; - while((rv = strchr(buf, '%')) != NULL) + while((rv = strchr(buf, '%')) != nullptr) { *rv = ' '; // replace with space } @@ -546,7 +546,7 @@ void Logger::logWithSys(unsigned logenum, unsigned priority, int level, const ch { return; } - time_t t = time(NULL); + time_t t = time(nullptr); LogInfo *info = (*iter).second; if(level >= info->level) @@ -604,14 +604,14 @@ void Logger::logWithSys(unsigned logenum, unsigned priority, int level, const ch void Logger::rollDate(time_t t) { char buf[80]; - FILE *logDir = NULL; + FILE *logDir = nullptr; logDir = fopen(m_dirPrefix.c_str(), "r+"); if(errno == ENOENT) { cmkdir(m_dirPrefix.c_str(), 0755); } - else if(logDir != NULL) + else if(logDir != nullptr) { fclose(logDir); } @@ -627,7 +627,7 @@ void Logger::rollDate(time_t t) { cmkdir(buf, 0755); } - else if(logDir != NULL) + else if(logDir != nullptr) { fclose(logDir); } @@ -711,7 +711,7 @@ void Logger::rollLog(LogInfo *logInfo) { std::string newLogName; char timeStampBuffer[256]; - time_t t = time(NULL); + time_t t = time(nullptr); tm now; int r; int nTries = 10; diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/Statistics.h b/external/3rd/library/soePlatform/ChatAPI/utils/Base/Statistics.h index 18e0579e..0856034b 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/Statistics.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/Statistics.h @@ -34,9 +34,9 @@ namespace Base bool commit = false; if (!mLastSampleTime) - mLastSampleTime = time(NULL); + mLastSampleTime = time(nullptr); - if (!mSampleFrequency || mLastSampleTime + mSampleFrequency < (unsigned)time(NULL)) + if (!mSampleFrequency || mLastSampleTime + mSampleFrequency < (unsigned)time(nullptr)) { mSampleTotal++; mAggregateTotal += value; diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/TemplateObjectAllocator.h b/external/3rd/library/soePlatform/ChatAPI/utils/Base/TemplateObjectAllocator.h index 40227673..ed1a7937 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/TemplateObjectAllocator.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/TemplateObjectAllocator.h @@ -93,7 +93,7 @@ namespace Base void Destroy(TYPE *object) { - if (object == NULL) + if (object == nullptr) return; #ifdef USE_ALLOCATOR_MUTEX @@ -142,7 +142,7 @@ namespace Base void FastDestroy(TYPE *object) { - if (object == NULL) + if (object == nullptr) return; object->~TYPE(); diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/WideString.h b/external/3rd/library/soePlatform/ChatAPI/utils/Base/WideString.h index 775f9713..28159b18 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/WideString.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/WideString.h @@ -94,12 +94,12 @@ namespace ucs2 } //////////////////////////////////////// - // target string is a null-terminated C string + // target string is a nullptr-terminated C string inline string::string(const char * copy) : mLength(0), mData(8,0) { - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!copy) { return; @@ -111,12 +111,12 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *copy++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; } //////////////////////////////////////// - // target string is a C string that may or may not include null characters + // target string is a C string that may or may not include nullptr characters inline string::string(const std::string & copy) : mLength(copy.length()), mData(8,0) @@ -126,17 +126,17 @@ namespace ucs2 // (2) perform transform to copy the narrow string to our // wide string std::transform(copy.begin(), copy.end(), mData.begin(), NarrowToWide); - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength] = 0; } //////////////////////////////////////// - // target string is a wide null-terminated C string + // target string is a wide nullptr-terminated C string inline string::string(const char_type * copy) : mLength(0), mData(8,0) { - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!copy) { return; @@ -148,7 +148,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *copy++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; } @@ -169,7 +169,7 @@ namespace ucs2 inline string & string::operator=(const char * rhs) { mLength = 0; - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!rhs) { mData[0] = 0; @@ -182,7 +182,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } @@ -195,7 +195,7 @@ namespace ucs2 // (2) perform transform to copy the narrow string to our // wide string std::transform(rhs.begin(), rhs.end(), mData.begin(), NarrowToWide); - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength] = 0; return *this; } @@ -203,7 +203,7 @@ namespace ucs2 inline string & string::operator=(const char_type * rhs) { mLength = 0; - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!rhs) { mData[0] = 0; @@ -216,7 +216,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } @@ -235,7 +235,7 @@ namespace ucs2 inline string & string::operator+=(const char * rhs) { - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!rhs) { return *this; @@ -247,7 +247,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } @@ -259,7 +259,7 @@ namespace ucs2 // (2) perform transform to copy the narrow string to our // wide string std::transform(rhs.begin(), rhs.end(), mData.begin()+mLength, NarrowToWide); - // (3) ensure null termination + // (3) ensure nullptr termination mLength += rhs.length(); mData[mLength] = 0; return *this; @@ -267,7 +267,7 @@ namespace ucs2 inline string & string::operator+=(const char_type * rhs) { - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!rhs) { return *this; @@ -279,7 +279,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } @@ -388,7 +388,7 @@ namespace ucs2 inline string & string::assign(const char_type * rhs) { mLength = 0; - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!rhs) { mData[0] = 0; @@ -401,7 +401,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } @@ -409,7 +409,7 @@ namespace ucs2 inline string & string::assign(const char_type * rhs, size_type count) { mLength = 0; - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!rhs) { mData[0] = 0; @@ -422,7 +422,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } @@ -463,7 +463,7 @@ namespace ucs2 inline string & string::assign(const char_type * first, const char_type * last) { mLength = 0; - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!first || !last) { mData[0] = 0; @@ -476,14 +476,14 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *first++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } inline string & string::append(const char_type * rhs) { - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!rhs) { return *this; @@ -495,14 +495,14 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } inline string & string::append(const char_type * rhs, size_type count) { - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!rhs) { return *this; @@ -514,7 +514,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *rhs++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } @@ -558,7 +558,7 @@ namespace ucs2 inline string & string::append(const char_type * first, const char_type * last) { - // (1) protect from null pointer + // (1) protect from nullptr pointer if (!first || !last) { return *this; @@ -570,7 +570,7 @@ namespace ucs2 reserve(mLength+1); mData[mLength++] = *first++; } - // (3) ensure null termination + // (3) ensure nullptr termination mData[mLength]=0; return *this; } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/BlockAllocator.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/BlockAllocator.cpp index 4cefb9e7..29d91074 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/BlockAllocator.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/BlockAllocator.cpp @@ -12,7 +12,7 @@ namespace Base { for(unsigned i = 0; i < 31; i++) { - m_blocks[i] = NULL; + m_blocks[i] = nullptr; } } @@ -21,7 +21,7 @@ namespace Base // free all allocated memory blocks for(unsigned i = 0; i < 31; i++) { - while(m_blocks[i] != NULL) + while(m_blocks[i] != nullptr) { unsigned *tmp = m_blocks[i]; m_blocks[i] = (unsigned *)*m_blocks[i]; @@ -36,7 +36,7 @@ namespace Base void *BlockAllocator::getBlock(unsigned bytes) { unsigned accum = 16, bits = 16; - unsigned *handle = NULL; + unsigned *handle = nullptr; // Perform a binary search looking for the highest bit. @@ -96,7 +96,7 @@ namespace Base void BlockAllocator::returnBlock(unsigned *handle) { - // C++ allows for safe deletion of a NULL pointer + // C++ allows for safe deletion of a nullptr pointer if(handle) { // Update the allocator linked list, insert this entry at the head diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/Event.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/Event.cpp index a3cce3b1..72190595 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/Event.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/Event.cpp @@ -26,8 +26,8 @@ namespace Base mCond(), mThreadCount(0) { - pthread_mutex_init(&mMutex, NULL); - pthread_cond_init(&mCond, NULL); + pthread_mutex_init(&mMutex, nullptr); + pthread_cond_init(&mCond, nullptr); } CEvent::~CEvent() @@ -74,7 +74,7 @@ namespace Base struct timeval now; struct timespec abs_timeout; - gettimeofday(&now, NULL); + gettimeofday(&now, nullptr); abs_timeout.tv_sec = now.tv_sec + timeout/1000; abs_timeout.tv_nsec = now.tv_usec * 1000 + (timeout%1000)*1000000; abs_timeout.tv_sec += abs_timeout.tv_nsec / 1000000000; diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/Thread.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/Thread.cpp index a4b1e3a2..f5bc4629 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/Thread.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/Thread.cpp @@ -77,8 +77,8 @@ namespace Base CThreadPool::CMember::CMember(CThreadPool * parent) : mParent(parent), - mFunction(NULL), - mArgument(NULL), + mFunction(nullptr), + mArgument(nullptr), mSemaphore() { StartThread(); @@ -117,8 +117,8 @@ namespace Base if (mFunction) { mFunction(mArgument); - mArgument = NULL; - mFunction = NULL; + mArgument = nullptr; + mFunction = nullptr; } else if (mParent->OnDestory(this)) mThreadContinue = false; @@ -173,7 +173,7 @@ namespace Base } //////////////////////////////////////// - // (3) Delete the null member threads + // (3) Delete the nullptr member threads mMutex.Lock(); while (!mNullMember.empty()) { @@ -224,7 +224,7 @@ namespace Base } //////////////////////////////////////// - // (2) Delete any null member threads. + // (2) Delete any nullptr member threads. while (!mNullMember.empty()) { delete mNullMember.front(); diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/serialize.h b/external/3rd/library/soePlatform/ChatAPI/utils/Base/serialize.h index 650681b5..ed38802a 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/serialize.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/serialize.h @@ -501,8 +501,8 @@ namespace soe } else { - //find null terminator, if don't find it before maxLen, then err - const unsigned char *strEnd = NULL; + //find nullptr terminator, if don't find it before maxLen, then err + const unsigned char *strEnd = nullptr; unsigned strLen = 0; for (;strLensetTrack(m_currTrack); res->setTrack(m_currTrack); - time_t timeout = time(NULL) + m_requestTimeout; + time_t timeout = time(nullptr) + m_requestTimeout; req->setTimeout(timeout); res->setTimeout(timeout); @@ -125,7 +125,7 @@ unsigned GenericAPICore::submitRequest(GenericRequest *req, GenericResponse *res } req->setTrack(m_currTrack); res->setTrack(m_currTrack); - time_t timeout = time(NULL) + reqTimeout; + time_t timeout = time(nullptr) + reqTimeout; req->setTimeout(timeout); res->setTimeout(timeout); @@ -140,7 +140,7 @@ void GenericAPICore::process() GenericResponse *res; // Process timeout on pending requests - regardless of whether processing is suspended or not - while((m_outCount > 0) && ((req = m_outboundQueue.front().first)->getTimeout() <= time(NULL))) + while((m_outCount > 0) && ((req = m_outboundQueue.front().first)->getTimeout() <= time(nullptr))) { --m_outCount; res = m_outboundQueue.front().second; @@ -152,7 +152,7 @@ void GenericAPICore::process() } // Process timeout on pending responses - while((m_pendingCount > 0) && ((res = (*m_pending.begin()).second)->getTimeout() <= time(NULL))) + while((m_pendingCount > 0) && ((res = (*m_pending.begin()).second)->getTimeout() <= time(nullptr))) { --m_pendingCount; m_pending.erase(m_pending.begin()); @@ -165,7 +165,7 @@ void GenericAPICore::process() while(m_outCount > 0) { GenericConnection *con = getNextActiveConnection(); - if (con != NULL) + if (con != nullptr) { pair out_pair = m_outboundQueue.front(); @@ -184,7 +184,7 @@ void GenericAPICore::process() else { #ifdef USE_SERIALIZE_LIB - const unsigned char *msgBuf = NULL; + const unsigned char *msgBuf = nullptr; unsigned msgSize = 0; msgBuf = req->pack(msgSize); con->Send(msgBuf, msgSize); @@ -222,7 +222,7 @@ GenericConnection *GenericAPICore::getNextActiveConnection() unsigned startIndex = m_nextConnectionIndex; unsigned maxIndex = m_serverConnections.size() - 1; - GenericConnection *con = NULL; + GenericConnection *con = nullptr; //loop until we find an active connection, or until we get back // to where we started @@ -242,7 +242,7 @@ GenericConnection *GenericAPICore::getNextActiveConnection() //went past end of vector, start back at 0 m_nextConnectionIndex = 0; } - }while (con == NULL && m_nextConnectionIndex != startIndex); + }while (con == nullptr && m_nextConnectionIndex != startIndex); return con; } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericConnection.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericConnection.cpp index 3b677c70..3c878e0a 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericConnection.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericConnection.cpp @@ -28,7 +28,7 @@ unsigned GenericConnection::ms_crcBytes = 0; GenericConnection::GenericConnection(const char *host, short port, GenericAPICore *apiCore, unsigned reconnectTimeout, unsigned noDataTimeoutSecs, unsigned noAckTimeoutSecs, unsigned incomingBufSizeInKB, unsigned outgoingBufSizeInKB, unsigned keepAlive, unsigned maxRecvMessageSizeInKB, unsigned holdTime) : m_bConnected(false), m_apiCore(apiCore), - m_con(NULL), + m_con(nullptr), m_host(host), m_nextHost(host), m_port(port), @@ -72,8 +72,8 @@ GenericConnection::~GenericConnection() { if(m_con) { - m_con->SetHandler(NULL); - m_con->Disconnect();//don't worry about onterminated being called, we've set it's handler to null, so it wont + m_con->SetHandler(nullptr); + m_con->Disconnect();//don't worry about onterminated being called, we've set it's handler to nullptr, so it wont m_con->Release(); } @@ -96,7 +96,7 @@ void GenericConnection::disconnect() { m_con->Disconnect(); //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); - m_con = NULL; + m_con = nullptr; } m_conState = CON_DISCONNECT; m_bConnected = false; @@ -112,7 +112,7 @@ void GenericConnection::OnTerminated(UdpConnection *con) if(m_con) { m_con->Release(); - m_con = NULL; + m_con = nullptr; } m_conState = CON_DISCONNECT; m_bConnected = false; @@ -146,7 +146,7 @@ void GenericConnection::OnRoutePacket(UdpConnection *con, const unsigned char *d get(iter, type); get(iter, track); #endif - GenericResponse *res = NULL; + GenericResponse *res = nullptr; // the following if block is a temporary fix that prevents // a crash with a game team in which they occasionally find @@ -208,7 +208,7 @@ void GenericConnection::process(bool giveTime) { m_con->SetHandler(this); m_conState = CON_NEGOTIATE; - m_conTimeout = time(NULL) + m_reconnectTimeout; + m_conTimeout = time(nullptr) + m_reconnectTimeout; } break; case CON_NEGOTIATE: @@ -225,12 +225,12 @@ void GenericConnection::process(bool giveTime) m_apiCore->OnConnect(m_host.c_str(), m_port); m_bConnected = true; } - else if(time(NULL) > m_conTimeout) + else if(time(nullptr) > m_conTimeout) { // we did not connect m_con->Disconnect(); //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); - m_con = NULL; + m_con = nullptr; m_conState = CON_DISCONNECT; m_bConnected = false; } @@ -246,7 +246,7 @@ void GenericConnection::process(bool giveTime) { m_con->Disconnect(); //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); - m_con = NULL; + m_con = nullptr; } } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpConnection.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpConnection.cpp index c9952e9a..df2137bd 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpConnection.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpConnection.cpp @@ -96,7 +96,7 @@ void UdpConnection::Init(UdpManager *udpManager, UdpPlatformAddress destIp, int mLastClockSyncTime = 0; mDataHoldTime = 0; mGettingTime = false; - mHandler = NULL; + mHandler = nullptr; mOtherSideProtocolVersion = 0; mNoDataTimeout = mUdpManager->mParams.noDataTimeout; @@ -108,7 +108,7 @@ void UdpConnection::Init(UdpManager *udpManager, UdpPlatformAddress destIp, int mIcmpErrorRetryStartStamp = 0; // when the timer started for ICMP error retry delay (gets reset on a successful packet receive) mPortRemapRequestStartStamp = 0; - mEncryptXorBuffer = NULL; + mEncryptXorBuffer = nullptr; mEncryptExpansionBytes = 0; mOrderedCountOutgoing = 0; mOrderedCountOutgoing2 = 0; @@ -120,7 +120,7 @@ void UdpConnection::Init(UdpManager *udpManager, UdpPlatformAddress destIp, int mConnectAttemptTimeout = 0; mConnectionCreateTime = mUdpManager->CachedClock(); mSimulateOutgoingQueueBytes = 0; - mPassThroughData = NULL; + mPassThroughData = nullptr; mSilentDisconnect = false; mLastSendBin = 0; @@ -140,7 +140,7 @@ UdpConnection::~UdpConnection() { UdpGuard myGuard(&mGuard); - assert(mUdpManager == NULL); // this should not be possible, since the UdpManager holds a reference to us until we are disconnected and disassociated from the manager. If you are hitting this, then odds are the application is releasing the UdpConnection object more times than it should + assert(mUdpManager == nullptr); // this should not be possible, since the UdpManager holds a reference to us until we are disconnected and disassociated from the manager. If you are hitting this, then odds are the application is releasing the UdpConnection object more times than it should for (int i = 0; i < cReliableChannelCount; i++) delete mChannel[i]; @@ -189,7 +189,7 @@ void UdpConnection::InternalDisconnect(int flushTimeout, DisconnectReason reason if (mStatus == cStatusNegotiating) flushTimeout = 0; - if (mUdpManager != NULL) + if (mUdpManager != nullptr) { if (flushTimeout > 0) { @@ -219,7 +219,7 @@ void UdpConnection::InternalDisconnect(int flushTimeout, DisconnectReason reason } UdpManager *holdUdpManager = mUdpManager; - mUdpManager = NULL; + mUdpManager = nullptr; mStatus = cStatusDisconnected; // only hold a reference to the UdpManager if it is not currently being destructed. @@ -274,7 +274,7 @@ bool UdpConnection::Send(UdpChannel channel, const void *data, int dataLen) if (dataLen == 0) // zero length packets are ignored return(false); - assert(data != NULL); // can't send a null packet + assert(data != nullptr); // can't send a nullptr packet // zero-escape application packets that start with 0 if ((*(const udp_uchar *)data) == 0) @@ -290,7 +290,7 @@ bool UdpConnection::Send(UdpChannel channel, const LogicalPacket *packet) { UdpGuard myGuard(&mGuard); - assert(packet != NULL); // can't send a null packet + assert(packet != nullptr); // can't send a nullptr packet if (mStatus != cStatusConnected) // if we are no longer connected return(false); @@ -337,7 +337,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const udp_uchar *data, int { udp_uchar *bufPtr = tempBuffer; memcpy(bufPtr, data, dataLen); - if (data2 != NULL) + if (data2 != nullptr) memcpy(bufPtr + dataLen, data2, dataLen2); PhysicalSend(bufPtr, totalDataLen, true); return(true); @@ -350,9 +350,9 @@ bool UdpConnection::InternalSend(UdpChannel channel, const udp_uchar *data, int bufPtr[1] = cUdpPacketOrdered; UdpMisc::PutValue16(bufPtr + 2, (udp_ushort)(++mOrderedCountOutgoing & 0xffff)); memcpy(bufPtr + 4, data, dataLen); - if (data2 != NULL) + if (data2 != nullptr) memcpy(bufPtr + 4 + dataLen, data2, dataLen2); - BufferedSend(bufPtr, totalDataLen + 4, NULL, 0, true); + BufferedSend(bufPtr, totalDataLen + 4, nullptr, 0, true); return(true); break; } @@ -363,7 +363,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const udp_uchar *data, int bufPtr[1] = cUdpPacketOrdered2; UdpMisc::PutValue16(bufPtr + 2, (udp_ushort)(++mOrderedCountOutgoing2 & 0xffff)); memcpy(bufPtr + 4, data, dataLen); - if (data2 != NULL) + if (data2 != nullptr) memcpy(bufPtr + 4 + dataLen, data2, dataLen2); PhysicalSend(bufPtr, totalDataLen + 4, true); return(true); @@ -375,7 +375,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const udp_uchar *data, int case cUdpChannelReliable4: { int num = channel - cUdpChannelReliable1; - if (mChannel[num] == NULL) + if (mChannel[num] == nullptr) mChannel[num] = new UdpReliableChannel(num, this, &mUdpManager->mParams.reliable[num]); mChannel[num]->Send(data, dataLen, data2, dataLen2); return(true); @@ -410,9 +410,9 @@ void UdpConnection::GetStats(UdpConnectionStatistics *cs) { UdpGuard myGuard(&mGuard); - assert(cs != NULL); + assert(cs != nullptr); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; *cs = mConnectionStats; @@ -428,7 +428,7 @@ void UdpConnection::GetStats(UdpConnectionStatistics *cs) if (cs->syncTheirSent > 0) cs->percentReceivedSuccess = (float)cs->syncOurReceived / (float)cs->syncTheirSent; cs->reliableAveragePing = 0; - if (mChannel[0] != NULL) + if (mChannel[0] != nullptr) cs->reliableAveragePing = mChannel[0]->GetAveragePing(); } @@ -437,7 +437,7 @@ void UdpConnection::ProcessRawPacket(const UdpManager::PacketHistoryEntry *e) UdpRef ref(this); UdpGuard guard(&mGuard); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; if (e->mLen == 0) @@ -572,7 +572,7 @@ void UdpConnection::ProcessRawPacket(const UdpManager::PacketHistoryEntry *e) *decryptPtr++ = finalStart[1]; int len = (this->*(mDecryptFunction[j]))(decryptPtr, finalStart + 2, finalLen - 2); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; if (len == -1) @@ -627,7 +627,7 @@ void UdpConnection::ProcessCookedPacket(const udp_uchar *data, int dataLen) { udp_uchar buf[256]; udp_uchar *bufPtr; - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; if (data[0] == 0 && dataLen > 1) @@ -826,7 +826,7 @@ void UdpConnection::ProcessCookedPacket(const udp_uchar *data, int dataLen) // (while processing this packet) ended up touching the packet-data and corrupting the next // packet in the multi-sequence. CallbackCorruptPacket(data, dataLen, cUdpCorruptionReasonMultiPacket); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; } else @@ -943,7 +943,7 @@ void UdpConnection::ProcessCookedPacket(const udp_uchar *data, int dataLen) case cUdpPacketFragment4: { int num = (data[1] - cUdpPacketReliable1) % cReliableChannelCount; - if (mChannel[num] == NULL) + if (mChannel[num] == nullptr) mChannel[num] = new UdpReliableChannel(num, this, &mUdpManager->mParams.reliable[num]); mChannel[num]->ReliablePacket(data, dataLen); break; @@ -954,7 +954,7 @@ void UdpConnection::ProcessCookedPacket(const udp_uchar *data, int dataLen) case cUdpPacketAck4: { int num = data[1] - cUdpPacketAck1; - if (mChannel[num] != NULL) + if (mChannel[num] != nullptr) mChannel[num]->AckPacket(data, dataLen); break; } @@ -964,7 +964,7 @@ void UdpConnection::ProcessCookedPacket(const udp_uchar *data, int dataLen) case cUdpPacketAckAll4: { int num = data[1] - cUdpPacketAckAll1; - if (mChannel[num] != NULL) + if (mChannel[num] != nullptr) mChannel[num]->AckAllPacket(data, dataLen); break; } @@ -1015,7 +1015,7 @@ void UdpConnection::FlagPortUnreachable() void UdpConnection::GiveTime(bool fromManager) { UdpGuard myGuard(&mGuard); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; if (fromManager && GetRefCount() == 2) @@ -1115,11 +1115,11 @@ void UdpConnection::InternalGiveTime() int totalPendingBytes = 0; for (int i = 0; i < cReliableChannelCount; i++) { - if (mChannel[i] != NULL) + if (mChannel[i] != nullptr) { totalPendingBytes += mChannel[i]->TotalPendingBytes(); int myNext = mChannel[i]->GiveTime(); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; // giving the reliable channel time caused it to callback the application which may disconnect us nextSchedule = udpMin(nextSchedule, myNext); } @@ -1208,7 +1208,7 @@ void UdpConnection::InternalGiveTime() break; } - if (mUdpManager != NULL) + if (mUdpManager != nullptr) { // safety to prevent us for scheduling ourselves for a time period that has already passed, // as doing so could result in infinite looping in the priority queue processing. @@ -1227,7 +1227,7 @@ int UdpConnection::TotalPendingBytes() const int total = 0; for (int i = 0; i < cReliableChannelCount; i++) { - if (mChannel[i] != NULL) + if (mChannel[i] != nullptr) total += mChannel[i]->TotalPendingBytes(); } return(total); @@ -1293,7 +1293,7 @@ void UdpConnection::ExpireReceiveBin() void UdpConnection::PhysicalSend(const udp_uchar *data, int dataLen, bool appendAllowed) { - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; // if we attempt to do a physical send (ie. encrypt/compress/crc a packet) while we are not connected @@ -1322,7 +1322,7 @@ void UdpConnection::PhysicalSend(const udp_uchar *data, int dataLen, bool append // we know this internal packet will not be a connect or confirm packet since they are sent directly to RawSend to avoid getting encrypted *destPtr++ = finalStart[1]; int len = (this->*(mEncryptFunction[j]))(destPtr, finalStart + 2, finalLen - 2); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; // if this assert triggers, it means the encryption pass expanded the size of the encrypted @@ -1393,8 +1393,8 @@ void UdpConnection::PhysicalSend(const udp_uchar *data, int dataLen, bool append // can note where the ack was placed and replace it udp_uchar *UdpConnection::BufferedSend(const udp_uchar *data, int dataLen, const udp_uchar *data2, int dataLen2, bool appendAllowed) { - if (mUdpManager == NULL) - return(NULL); + if (mUdpManager == nullptr) + return(nullptr); int used = (int)(mMultiBufferPtr - mMultiBufferData); int actualMaxDataHoldSize = udpMin(mUdpManager->mParams.maxDataHoldSize, mConnectionConfig.maxRawPacketSize); @@ -1409,7 +1409,7 @@ udp_uchar *UdpConnection::BufferedSend(const udp_uchar *data, int dataLen, const FlushMultiBuffer(); // now send it (the multi-buffer is empty if you need to use it temporarily to concatenate two data chunks -- it is large enough to hold the largest raw packet) - if (data2 != NULL) + if (data2 != nullptr) { memcpy(mMultiBufferData, data, dataLen); memcpy(mMultiBufferData + dataLen, data2, dataLen2); @@ -1417,7 +1417,7 @@ udp_uchar *UdpConnection::BufferedSend(const udp_uchar *data, int dataLen, const } else PhysicalSend(data, dataLen, appendAllowed); - return(NULL); + return(nullptr); } // if this data will not fit into buffer @@ -1445,7 +1445,7 @@ udp_uchar *UdpConnection::BufferedSend(const udp_uchar *data, int dataLen, const udp_uchar *placementPtr = mMultiBufferPtr; memcpy(mMultiBufferPtr, data, dataLen); mMultiBufferPtr += dataLen; - if (data2 != NULL) + if (data2 != nullptr) { memcpy(mMultiBufferPtr, data2, dataLen2); mMultiBufferPtr += dataLen2; @@ -1454,7 +1454,7 @@ udp_uchar *UdpConnection::BufferedSend(const udp_uchar *data, int dataLen, const if ((mMultiBufferPtr - mMultiBufferData) >= actualMaxDataHoldSize) { FlushMultiBuffer(); - placementPtr = NULL; // it got flushed + placementPtr = nullptr; // it got flushed } return(placementPtr); } @@ -1474,7 +1474,7 @@ void UdpConnection::FlushMultiBuffer() // notify all the reliable channels to clear their buffered acks for (int i = 0; i < cReliableChannelCount; i++) { - if (mChannel[i] != NULL) + if (mChannel[i] != nullptr) { mChannel[i]->ClearBufferedAck(); } @@ -1684,7 +1684,7 @@ void UdpConnection::SetupEncryptModel() mEncryptExpansionBytes += 0; // set up encrypt buffer (random numbers generated based on seed) - if (mEncryptXorBuffer == NULL) + if (mEncryptXorBuffer == nullptr) { int len = ((mUdpManager->mParams.maxRawPacketSize + 1) / 4) * 4; mEncryptXorBuffer = new udp_uchar[len]; @@ -1718,7 +1718,7 @@ void UdpConnection::GetChannelStatus(UdpChannel channel, ChannelStatus *channelS case cUdpChannelReliable2: case cUdpChannelReliable3: case cUdpChannelReliable4: - if (mChannel[channel - cUdpChannelReliable1] != NULL) + if (mChannel[channel - cUdpChannelReliable1] != nullptr) { mChannel[channel - cUdpChannelReliable1]->GetChannelStatus(channelStatus); } @@ -1763,7 +1763,7 @@ char *UdpConnection::GetDestinationString(char *buf, int bufLen) const UdpGuard myGuard(&mGuard); if (bufLen < 22) - return(NULL); + return(nullptr); UdpPlatformAddress ip = GetDestinationIp(); int port = GetDestinationPort(); char hold[256]; @@ -1794,7 +1794,7 @@ void UdpConnection::OnRoutePacket(const udp_uchar *data, int dataLen) { UdpGuard myGuard(&mHandlerGuard); - if (mHandler != NULL) + if (mHandler != nullptr) { mHandler->OnRoutePacket(this, data, dataLen); } @@ -1814,7 +1814,7 @@ void UdpConnection::OnRoutePacket(const udp_uchar *data, int dataLen) void UdpConnection::OnConnectComplete() { UdpGuard myGuard(&mHandlerGuard); - if (mHandler != NULL) + if (mHandler != nullptr) { mHandler->OnConnectComplete(this); } @@ -1823,7 +1823,7 @@ void UdpConnection::OnConnectComplete() void UdpConnection::OnTerminated() { UdpGuard myGuard(&mHandlerGuard); - if (mHandler != NULL) + if (mHandler != nullptr) { mHandler->OnTerminated(this); } @@ -1832,7 +1832,7 @@ void UdpConnection::OnTerminated() void UdpConnection::OnCrcReject(const udp_uchar *data, int dataLen) { UdpGuard myGuard(&mHandlerGuard); - if (mHandler != NULL) + if (mHandler != nullptr) { mHandler->OnCrcReject(this, data, dataLen); } @@ -1841,7 +1841,7 @@ void UdpConnection::OnCrcReject(const udp_uchar *data, int dataLen) void UdpConnection::OnPacketCorrupt(const udp_uchar *data, int dataLen, UdpCorruptionReason reason) { UdpGuard myGuard(&mHandlerGuard); - if (mHandler != NULL) + if (mHandler != nullptr) { mHandler->OnPacketCorrupt(this, data, dataLen, reason); } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpConnection.h b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpConnection.h index 9d64e460..253e9139 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpConnection.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpConnection.h @@ -153,7 +153,7 @@ class UdpConnection : public UdpGuardedRefCount, public PriorityQueueMember, pub int ConnectionAge() const; // returns the UdpManager object that is managing this connection - // will return NULL if the connection has been disconnected for some reason (because disconnecting severes the link to UdpManager) + // will return nullptr if the connection has been disconnected for some reason (because disconnecting severes the link to UdpManager) UdpManager *GetUdpManager() const; // returns the 32-bit encryption-code that was negotiated as part of the connection-establishment process. @@ -234,9 +234,9 @@ class UdpConnection : public UdpGuardedRefCount, public PriorityQueueMember, pub friend class UdpManager; friend class UdpReliableChannel; - // note: if connectPacket is NULL, that means this connection object is being created to establish + // note: if connectPacket is nullptr, that means this connection object is being created to establish // a new connection to the specified ip/port (ie. the connection starts out in cStatusNegotiating mode) - // if connectPacket is non-NULL, that menas this connection object is being created to handle an + // if connectPacket is non-nullptr, that menas this connection object is being created to handle an // incoming connect request and it will start out in cStatusConnected mode. UdpConnection(UdpManager *udpManager, UdpPlatformAddress destIp, int destPort, int timeout); // starts connection-establishment protocol UdpConnection(UdpManager *udpManager, const UdpManager::PacketHistoryEntry *e); // starts already connected, replying to connection request @@ -281,7 +281,7 @@ class UdpConnection : public UdpGuardedRefCount, public PriorityQueueMember, pub void RawSend(const udp_uchar *data, int dataLen); // nothing happens to the data here, it is given to the udpmanager and sent out the port void PhysicalSend(const udp_uchar *data, int dataLen, bool appendAllowed); // sends a physical packet (encrypts and adds crc bytes) udp_uchar *BufferedSend(const udp_uchar *data, int dataLen, const udp_uchar *data2, int dataLen2, bool appendAllowed); // buffers logical packets waiting til we have more data (makes multi-packets) - bool InternalSend(UdpChannel channel, const udp_uchar *data, int dataLen, const udp_uchar *data2 = NULL, int dataLen2 = 0); + bool InternalSend(UdpChannel channel, const udp_uchar *data, int dataLen, const udp_uchar *data2 = nullptr, int dataLen2 = 0); void InternalGiveTime(); void InternalDisconnect(int flushTimeout, DisconnectReason reason); @@ -527,7 +527,7 @@ inline void UdpConnection::ScheduleTimeNow() // prevents us from reprioritizing to 0, only to shortly thereafter be reprioritized to where we actually belong. if (!mGettingTime) { - if (mUdpManager != NULL) + if (mUdpManager != nullptr) mUdpManager->SetPriority(this, 0); } } @@ -575,7 +575,7 @@ inline int UdpConnection::LastReceive(UdpClockStamp useStamp) const inline int UdpConnection::LastReceive() const { UdpGuard guard(&mGuard); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return(0); return(mUdpManager->CachedClockElapsed(mLastReceiveTime)); } @@ -583,7 +583,7 @@ inline int UdpConnection::LastReceive() const inline int UdpConnection::ConnectionAge() const { UdpGuard guard(&mGuard); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return(0); return(mUdpManager->CachedClockElapsed(mConnectionCreateTime)); } @@ -591,7 +591,7 @@ inline int UdpConnection::ConnectionAge() const inline int UdpConnection::LastSend() const { UdpGuard guard(&mGuard); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return(0); return(mUdpManager->CachedClockElapsed(mLastSendTime)); } @@ -599,7 +599,7 @@ inline int UdpConnection::LastSend() const inline udp_ushort UdpConnection::ServerSyncStampShort() const { UdpGuard guard(&mGuard); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return(0); return((udp_ushort)(mUdpManager->LocalSyncStampShort() + (mSyncTimeDelta & 0xffff))); } @@ -607,7 +607,7 @@ inline udp_ushort UdpConnection::ServerSyncStampShort() const inline udp_uint UdpConnection::ServerSyncStampLong() const { UdpGuard guard(&mGuard); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return(0); return(mUdpManager->LocalSyncStampLong() + mSyncTimeDelta); } @@ -649,7 +649,7 @@ inline UdpConnection::DisconnectReason UdpConnection::GetOtherSideDisconnectReas inline int UdpConnection::OutgoingBytesLastSecond() { UdpGuard guard(&mGuard); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return(0); ExpireSendBin(); @@ -659,7 +659,7 @@ inline int UdpConnection::OutgoingBytesLastSecond() inline int UdpConnection::IncomingBytesLastSecond() { UdpGuard guard(&mGuard); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return(0); ExpireReceiveBin(); diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpDriverLinux.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpDriverLinux.cpp index da7bcc5c..aa11f5cd 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpDriverLinux.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpDriverLinux.cpp @@ -101,7 +101,7 @@ bool UdpPlatformDriver::SocketOpen(int port, int incomingBufferSize, int outgoin addr_loc.sin_family = PF_INET; addr_loc.sin_port = htons((unsigned short)port); addr_loc.sin_addr.s_addr = htonl(INADDR_ANY); - if (bindIpAddress != NULL && bindIpAddress[0] != 0) + if (bindIpAddress != nullptr && bindIpAddress[0] != 0) { unsigned long address = inet_addr(bindIpAddress); if (address != INADDR_NONE) @@ -201,7 +201,7 @@ bool UdpPlatformDriver::GetHostByName(UdpPlatformAddress *ipAddress, const char { struct hostent *lphp; lphp = gethostbyname(hostName); - if (lphp == NULL) + if (lphp == nullptr) { address = 0; } @@ -223,7 +223,7 @@ bool UdpPlatformDriver::GetSelfAddress(UdpPlatformAddress *ipAddress, bool prefe if (gethostname(hostname, sizeof(hostname)) == 0) { struct hostent *entry = gethostbyname(hostname); - if (entry != NULL) + if (entry != nullptr) { for (int i = 0; entry->h_addr_list[i] != 0; i++) { @@ -273,7 +273,7 @@ UdpClockStamp UdpPlatformDriver::Clock() UdpGuard guard(&mData->clockGuard); struct timeval tv; - gettimeofday(&tv, NULL); + gettimeofday(&tv, nullptr); UdpClockStamp cs = static_cast(tv.tv_sec) * 1000 + static_cast(tv.tv_usec / 1000); cs += mData->currentCorrection; if (cs < mData->lastStamp) @@ -319,7 +319,7 @@ int IcmpReceive(SOCKET socket, unsigned *address, int *port) return(-1); struct cmsghdr *cmsg; - for(cmsg = CMSG_FIRSTHDR(&msgh); cmsg != NULL; cmsg = CMSG_NXTHDR(&msgh, cmsg)) + for(cmsg = CMSG_FIRSTHDR(&msgh); cmsg != nullptr; cmsg = CMSG_NXTHDR(&msgh, cmsg)) { if(cmsg->cmsg_level == SOL_IP && cmsg->cmsg_type == IP_RECVERR) { @@ -378,7 +378,7 @@ void *GoThread(void *param) thread->mThreadData->running = false; thread->mThreadData->handle = 0; thread->Release(); - return(NULL); + return(nullptr); } UdpPlatformThreadObject::~UdpPlatformThreadObject() @@ -435,7 +435,7 @@ char *UdpPlatformAddress::GetAddress(char *buffer, int bufferLen) const *buffer = 0; return(buffer); } - assert(buffer != NULL); + assert(buffer != nullptr); sprintf(buffer, "%d.%d.%d.%d", mData[0], mData[1], mData[2], mData[3]); return(buffer); } @@ -444,7 +444,7 @@ void UdpPlatformAddress::SetAddress(const char *address) { for (int i = 0; i < 4; i++) { - mData[i] = (unsigned char)strtol(address, NULL, 10); + mData[i] = (unsigned char)strtol(address, nullptr, 10); while (*address >= '0' && *address <= '9') address++; if (*address != 0) diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpDriverWindows.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpDriverWindows.cpp index 04c0c4d0..4a2a80e7 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpDriverWindows.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpDriverWindows.cpp @@ -102,7 +102,7 @@ bool UdpPlatformDriver::SocketOpen(int port, int incomingBufferSize, int outgoin addr_loc.sin_family = PF_INET; addr_loc.sin_port = htons((unsigned short)port); addr_loc.sin_addr.s_addr = htonl(INADDR_ANY); - if (bindIpAddress != NULL && bindIpAddress[0] != 0) + if (bindIpAddress != nullptr && bindIpAddress[0] != 0) { unsigned long address = inet_addr(bindIpAddress); if (address != INADDR_NONE) @@ -205,7 +205,7 @@ bool UdpPlatformDriver::GetHostByName(UdpPlatformAddress *ipAddress, const char { struct hostent *lphp; lphp = gethostbyname(hostName); - if (lphp == NULL) + if (lphp == nullptr) { address = 0; } @@ -227,7 +227,7 @@ bool UdpPlatformDriver::GetSelfAddress(UdpPlatformAddress *ipAddress, bool prefe if (gethostname(hostname, sizeof(hostname)) == 0) { struct hostent *entry = gethostbyname(hostname); - if (entry != NULL) + if (entry != nullptr) { for (int i = 0; entry->h_addr_list[i] != 0; i++) { @@ -329,10 +329,10 @@ unsigned __stdcall GoThread(void *param) UdpPlatformThreadObject::~UdpPlatformThreadObject() { #ifndef UDPLIBRARY_SINGLE_THREAD - if (mThreadData->handle != NULL) + if (mThreadData->handle != nullptr) { CloseHandle(mThreadData->handle); - mThreadData->handle = NULL; + mThreadData->handle = nullptr; } #endif delete mThreadData; @@ -343,7 +343,7 @@ void UdpPlatformThreadObject::Start() AddRef(); #ifndef UDPLIBRARY_SINGLE_THREAD unsigned threadId; - mThreadData->handle = (HANDLE)_beginthreadex(NULL, 0, &GoThread, this, 0, &threadId); + mThreadData->handle = (HANDLE)_beginthreadex(nullptr, 0, &GoThread, this, 0, &threadId); #else GoThread(this); // run it inline in main thread (blocks til it's finished, so odds are it won't work, but they shouldn't be using it anyhow in this mode) #endif @@ -352,7 +352,7 @@ void UdpPlatformThreadObject::Start() UdpPlatformThreadObject::UdpPlatformThreadObject() { mThreadData = new UdpPlatformThreadData; - mThreadData->handle = NULL; + mThreadData->handle = nullptr; mThreadData->running = false; } @@ -389,7 +389,7 @@ char *UdpPlatformAddress::GetAddress(char *buffer, int bufferLen) const *buffer = 0; return(buffer); } - assert(buffer != NULL); + assert(buffer != nullptr); sprintf(buffer, "%d.%d.%d.%d", mData[0], mData[1], mData[2], mData[3]); return(buffer); } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpHashTable.h b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpHashTable.h index 10af003d..9f24044e 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpHashTable.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpHashTable.h @@ -38,11 +38,11 @@ template class HashTable bool Remove(T& obj, int hashValue); void Reset(); // removes all entries from the table - T *FindFirst(int hashValue) const; // returns NULL if not found - T *FindNext(T *prevResult) const; // returns NULL if not found + T *FindFirst(int hashValue) const; // returns nullptr if not found + T *FindNext(T *prevResult) const; // returns nullptr if not found - T *WalkFirst() const; // returns NULL if not found - T *WalkNext(T *prevResult) const; // returns NULL if not found + T *WalkFirst() const; // returns nullptr if not found + T *WalkNext(T *prevResult) const; // returns nullptr if not found void Resize(int hashSize); // the actual hash size will be rounded up to the next larger prime number (very slow, not recommended) void GetStatistics(HashTableStatistics *stats) const; @@ -64,7 +64,7 @@ template class HashTable template HashTable::HashTable(int hashSize) { - mTable = NULL; + mTable = nullptr; mTableSize = 0; mEntryCount = 0; mStatUsedSlots = 0; @@ -84,9 +84,9 @@ template void HashTable::Insert(T& obj, int hashValue) entry->hashValue = hashValue; int spot = ((unsigned)hashValue) % mTableSize; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) { - entry->nextEntry = NULL; + entry->nextEntry = nullptr; mTable[spot] = entry; mStatUsedSlots++; } @@ -103,14 +103,14 @@ template bool HashTable::Remove(T& obj, int hashValue) int spot = ((unsigned)hashValue) % mTableSize; HashEntry* next = mTable[spot]; HashEntry** prev = &mTable[spot]; - while (next != NULL) + while (next != nullptr) { if (next->obj == obj && next->hashValue == hashValue) { *prev = next->nextEntry; delete next; mEntryCount--; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) mStatUsedSlots--; return(true); break; @@ -127,17 +127,17 @@ template void HashTable::Reset() for (int spot = 0; spot < mTableSize; spot++) { HashEntry *curr = mTable[spot]; - if (curr != NULL) + if (curr != nullptr) { mStatUsedSlots--; - while (curr != NULL) + while (curr != nullptr) { HashEntry *next = curr->nextEntry; delete curr; mEntryCount--; curr = next; } - mTable[spot] = NULL; + mTable[spot] = nullptr; } } } @@ -145,13 +145,13 @@ template void HashTable::Reset() template T *HashTable::FindFirst(int hashValue) const { HashEntry *entry = mTable[((unsigned)hashValue) % mTableSize]; - while (entry != NULL) + while (entry != nullptr) { if (entry->hashValue == hashValue) return(&entry->obj); entry = entry->nextEntry; } - return(NULL); + return(nullptr); } template T *HashTable::FindNext(T *prevResult) const @@ -159,13 +159,13 @@ template T *HashTable::FindNext(T *prevResult) const HashEntry *entry = (HashEntry *)(((char *)prevResult) - offsetof(HashEntry, obj)); int hashValue = entry->hashValue; entry = entry->nextEntry; - while (entry != NULL) + while (entry != nullptr) { if (entry->hashValue == hashValue) return(&entry->obj); entry = entry->nextEntry; } - return(NULL); + return(nullptr); } template T *HashTable::WalkFirst() const @@ -173,10 +173,10 @@ template T *HashTable::WalkFirst() const for (int bucket = 0; bucket < mTableSize; bucket++) { HashEntry *entry = mTable[bucket]; - if (entry != NULL) + if (entry != nullptr) return(&entry->obj); } - return(NULL); + return(nullptr); } template T *HashTable::WalkNext(T *prevResult) const @@ -185,17 +185,17 @@ template T *HashTable::WalkNext(T *prevResult) const int bucket = ((unsigned)entry->hashValue) % mTableSize; entry = entry->nextEntry; - if (entry != NULL) + if (entry != nullptr) return(&entry->obj); bucket++; // go onto next bucket for (; bucket < mTableSize; bucket++) { HashEntry *entry = mTable[bucket]; - if (entry != NULL) + if (entry != nullptr) return(&entry->obj); } - return(NULL); + return(nullptr); } template void HashTable::Resize(int hashSize) @@ -215,16 +215,16 @@ template void HashTable::Resize(int hashSize) for (int i = 0; i < oldSize; i++) { HashEntry* next = oldTable[i]; - while (next != NULL) + while (next != nullptr) { HashEntry* hold = next; next = next->nextEntry; // insert hold into new table int spot = ((unsigned)hold->hashValue) % mTableSize; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) { - hold->nextEntry = NULL; + hold->nextEntry = nullptr; mTable[spot] = hold; mStatUsedSlots++; } @@ -284,11 +284,11 @@ template class ObjectHashTable bool Remove(T *obj); void Reset(); // removes all entries from the table - T *FindFirst(int hashValue) const; // returns NULL if not found - T *FindNext(T *prevResult) const; // returns NULL if not found + T *FindFirst(int hashValue) const; // returns nullptr if not found + T *FindNext(T *prevResult) const; // returns nullptr if not found - T *WalkFirst() const; // returns NULL if not found - T *WalkNext(T *prevResult) const; // returns NULL if not found + T *WalkFirst() const; // returns nullptr if not found + T *WalkNext(T *prevResult) const; // returns nullptr if not found void Resize(int hashSize); // the actual hash size will be rounded up to the next larger prime number (very slow, not recommended) void GetStatistics(HashTableStatistics *stats) const; @@ -303,7 +303,7 @@ template class ObjectHashTable template ObjectHashTable::ObjectHashTable(int hashSize) { - mTable = NULL; + mTable = nullptr; mTableSize = 0; mEntryCount = 0; mStatUsedSlots = 0; @@ -320,9 +320,9 @@ template void ObjectHashTable::Insert(T *obj, int static_cast(obj)->mHashValue = hashValue; int spot = ((unsigned)hashValue) % mTableSize; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) { - static_cast(obj)->mHashNextEntry = NULL; + static_cast(obj)->mHashNextEntry = nullptr; mTable[spot] = obj; mStatUsedSlots++; } @@ -339,14 +339,14 @@ template bool ObjectHashTable::Remove(T *obj) int spot = ((unsigned)static_cast(obj)->mHashValue) % mTableSize; T *cur = mTable[spot]; T **prev = &mTable[spot]; - while (cur != NULL) + while (cur != nullptr) { if (cur == obj) { *prev = static_cast(cur)->mHashNextEntry; - static_cast(cur)->mHashNextEntry = NULL; + static_cast(cur)->mHashNextEntry = nullptr; mEntryCount--; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) mStatUsedSlots--; return(true); break; @@ -368,13 +368,13 @@ template void ObjectHashTable::Reset() template T *ObjectHashTable::FindFirst(int hashValue) const { T *entry = mTable[((unsigned)hashValue) % mTableSize]; - while (entry != NULL) + while (entry != nullptr) { if (static_cast(entry)->mHashValue == hashValue) return(entry); entry = static_cast(entry)->mHashNextEntry; } - return(NULL); + return(nullptr); } template T *ObjectHashTable::FindNext(T *prevResult) const @@ -382,13 +382,13 @@ template T *ObjectHashTable::FindNext(T *prevResul T *entry = prevResult; int hashValue = static_cast(entry)->mHashValue; entry = static_cast(entry)->mHashNextEntry; - while (entry != NULL) + while (entry != nullptr) { if (static_cast(entry)->mHashValue == hashValue) return(entry); entry = static_cast(entry)->mHashNextEntry; } - return(NULL); + return(nullptr); } template T *ObjectHashTable::WalkFirst() const @@ -396,10 +396,10 @@ template T *ObjectHashTable::WalkFirst() const for (int bucket = 0; bucket < mTableSize; bucket++) { T *entry = mTable[bucket]; - if (entry != NULL) + if (entry != nullptr) return(entry); } - return(NULL); + return(nullptr); } template T *ObjectHashTable::WalkNext(T *prevResult) const @@ -408,17 +408,17 @@ template T *ObjectHashTable::WalkNext(T *prevResul int bucket = ((unsigned)static_cast(entry)->mHashValue) % mTableSize; entry = static_cast(entry)->mHashNextEntry; - if (entry != NULL) + if (entry != nullptr) return(entry); bucket++; // go onto next bucket for (; bucket < mTableSize; bucket++) { entry = mTable[bucket]; - if (entry != NULL) + if (entry != nullptr) return(entry); } - return(NULL); + return(nullptr); } template void ObjectHashTable::Resize(int hashSize) @@ -438,16 +438,16 @@ template void ObjectHashTable::Resize(int hashSize for (int i = 0; i < oldSize; i++) { T *cur = oldTable[i]; - while (cur != NULL) + while (cur != nullptr) { T *hold = cur; cur = static_cast(cur)->mHashNextEntry; // insert hold into new table int spot = ((unsigned)static_cast(hold)->mHashValue) % mTableSize; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) { - static_cast(hold)->mHashNextEntry = NULL; + static_cast(hold)->mHashNextEntry = nullptr; mTable[spot] = hold; mStatUsedSlots++; } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpLinkedList.h b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpLinkedList.h index 6fab2d03..ad2d7e63 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpLinkedList.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpLinkedList.h @@ -14,8 +14,8 @@ template class UdpLinkedList; template class UdpLinkedListMember { public: - UdpLinkedListMember() { mPrev = NULL; mNext = NULL; } - UdpLinkedListMember(const UdpLinkedListMember &) { mPrev = NULL; mNext = NULL; } + UdpLinkedListMember() { mPrev = nullptr; mNext = nullptr; } + UdpLinkedListMember(const UdpLinkedListMember &) { mPrev = nullptr; mNext = nullptr; } ~UdpLinkedListMember() {} #if defined(_MSC_VER) && (_MSC_VER < 1300) // MSVC 7.0 is the first version to support friend templates @@ -60,8 +60,8 @@ template class UdpLinkedList template UdpLinkedList::UdpLinkedList(UdpLinkedListMember T::*node) { - mHead = NULL; - mTail = NULL; + mHead = nullptr; + mTail = nullptr; mNode = node; mCount = 0; } @@ -98,7 +98,7 @@ template int UdpLinkedList::Count() const template T *UdpLinkedList::Position(int index) const { T *cur = mHead; - while (cur != NULL && index > 0) + while (cur != nullptr && index > 0) { cur = Next(cur); index--; @@ -109,43 +109,43 @@ template T *UdpLinkedList::Position(int index) const template T *UdpLinkedList::Remove(T *cur) { UdpLinkedListMember *node = &(cur->*mNode); - if (node->mPrev == NULL) + if (node->mPrev == nullptr) mHead = node->mNext; else ((node->mPrev)->*mNode).mNext = node->mNext; - if (node->mNext == NULL) + if (node->mNext == nullptr) mTail = node->mPrev; else ((node->mNext)->*mNode).mPrev = node->mPrev; - node->mNext = NULL; - node->mPrev = NULL; + node->mNext = nullptr; + node->mPrev = nullptr; mCount--; return(cur); } template T *UdpLinkedList::RemoveHead() { - if (mHead == NULL) - return(NULL); + if (mHead == nullptr) + return(nullptr); return(Remove(mHead)); } template T *UdpLinkedList::RemoveTail() { - if (mTail == NULL) - return(NULL); + if (mTail == nullptr) + return(nullptr); return(Remove(mTail)); } template T *UdpLinkedList::InsertHead(T *cur) { - assert((cur->*mNode).mPrev == NULL); - assert((cur->*mNode).mNext == NULL); + assert((cur->*mNode).mPrev == nullptr); + assert((cur->*mNode).mNext == nullptr); (cur->*mNode).mNext = mHead; - if (mHead != NULL) + if (mHead != nullptr) { (mHead->*mNode).mPrev = cur; mHead = cur; @@ -161,12 +161,12 @@ template T *UdpLinkedList::InsertHead(T *cur) template T *UdpLinkedList::InsertTail(T *cur) { - assert((cur->*mNode).mPrev == NULL); - assert((cur->*mNode).mNext == NULL); + assert((cur->*mNode).mPrev == nullptr); + assert((cur->*mNode).mNext == nullptr); (cur->*mNode).mPrev = mTail; - if (mTail != NULL) + if (mTail != nullptr) { (mTail->*mNode).mNext = cur; mTail = cur; @@ -182,17 +182,17 @@ template T *UdpLinkedList::InsertTail(T *cur) template T *UdpLinkedList::InsertAfter(T *cur, T *prev) { - assert((cur->*mNode).mPrev == NULL); - assert((cur->*mNode).mNext == NULL); + assert((cur->*mNode).mPrev == nullptr); + assert((cur->*mNode).mNext == nullptr); - if (prev == NULL) + if (prev == nullptr) return(InsertHead(cur)); (cur->*mNode).mPrev = prev; (cur->*mNode).mNext = (prev->*mNode).mNext; (prev->*mNode).mNext = cur; - if ((cur->*mNode).mNext != NULL) + if ((cur->*mNode).mNext != nullptr) (((cur->*mNode).mNext)->*mNode).mPrev = cur; else mTail = cur; @@ -204,7 +204,7 @@ template T *UdpLinkedList::InsertAfter(T *cur, T *prev) template void UdpLinkedList::DeleteAll() { T *cur = First(); - while (cur != NULL) + while (cur != nullptr) { T *next = Next(cur); Remove(cur); @@ -216,7 +216,7 @@ template void UdpLinkedList::DeleteAll() template void UdpLinkedList::ReleaseAll() { T *cur = First(); - while (cur != NULL) + while (cur != nullptr) { T *next = Next(cur); Remove(cur); diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpLogicalPacket.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpLogicalPacket.cpp index 5ecce2fb..76171367 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpLogicalPacket.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpLogicalPacket.cpp @@ -31,7 +31,7 @@ SimpleLogicalPacket::SimpleLogicalPacket(const void *data, int dataLen) { mDataLen = dataLen; mData = new udp_uchar[mDataLen]; - if (data != NULL) + if (data != nullptr) memcpy(mData, data, mDataLen); } @@ -66,7 +66,7 @@ void SimpleLogicalPacket::SetDataLen(int len) GroupLogicalPacket::GroupLogicalPacket() : LogicalPacket() { mDataLen = 0; - mData = NULL; + mData = nullptr; } GroupLogicalPacket::~GroupLogicalPacket() @@ -76,13 +76,13 @@ GroupLogicalPacket::~GroupLogicalPacket() void GroupLogicalPacket::AddPacket(const LogicalPacket *packet) { - assert(packet != NULL); + assert(packet != nullptr); AddPacketInternal(packet->GetDataPtr(), packet->GetDataLen(), packet->IsInternalPacket()); } void GroupLogicalPacket::AddPacket(const void *data, int dataLen) { - assert(data != NULL); + assert(data != nullptr); assert(dataLen >= 0); AddPacketInternal(data, dataLen, false); } @@ -152,10 +152,10 @@ PooledLogicalPacket::PooledLogicalPacket(UdpManager *manager, int len) PooledLogicalPacket::~PooledLogicalPacket() { - if (mUdpManager != NULL) + if (mUdpManager != nullptr) { mUdpManager->PoolDestroyed(this); - mUdpManager = NULL; + mUdpManager = nullptr; } delete[] mData; @@ -168,7 +168,7 @@ void PooledLogicalPacket::AddRef() const void PooledLogicalPacket::Release() const { - if (GetRefCount() == 1 && mUdpManager != NULL) + if (GetRefCount() == 1 && mUdpManager != nullptr) { // the PoolReturn function steals our reference (ie, we don't release, they don't addref), this is for thread safety reasons mUdpManager->PoolReturn(const_cast(this)); @@ -208,9 +208,9 @@ void PooledLogicalPacket::SetDataLen(int len) void PooledLogicalPacket::SetData(const void *data, int dataLen, const void *data2, int dataLen2) { mDataLen = dataLen + dataLen2; - if (data != NULL) + if (data != nullptr) memcpy(mData, data, dataLen); - if (data2 != NULL) + if (data2 != nullptr) memcpy(mData + dataLen, data2, dataLen2); } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpLogicalPacket.h b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpLogicalPacket.h index 6a5962c4..8e1525a8 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpLogicalPacket.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpLogicalPacket.h @@ -81,7 +81,7 @@ class SimpleLogicalPacket : public LogicalPacket // it was originally created to allow the internal code to handle reliable data that was sent // via the Send(char *, int) api call. public: - SimpleLogicalPacket(const void *data, int dataLen); // data can be NULL if you want to populate it after it is allocated (get the pointer and write to it) + SimpleLogicalPacket(const void *data, int dataLen); // data can be nullptr if you want to populate it after it is allocated (get the pointer and write to it) virtual void *GetDataPtr(); virtual const void *GetDataPtr() const; virtual int GetDataLen() const; @@ -152,7 +152,7 @@ template class StructLogicalPacket : public LogicalPacket // with virtual functions) via this method as they may contain hidden data-members (such as pointers // to vtables). public: - StructLogicalPacket(T *initData = NULL); + StructLogicalPacket(T *initData = nullptr); virtual void *GetDataPtr(); virtual const void *GetDataPtr() const; virtual int GetDataLen() const; @@ -226,7 +226,7 @@ class PooledLogicalPacket : public LogicalPacket protected: friend class UdpManager; void TrueRelease() const; - void SetData(const void *data, int dataLen, const void *data2 = NULL, int dataLen2 = 0); + void SetData(const void *data, int dataLen, const void *data2 = nullptr, int dataLen2 = 0); UdpManager *mUdpManager; UdpLinkedListMember mAvailableLink; // for available linked list in manager UdpLinkedListMember mCreatedLink; // for created linked list in manager @@ -240,7 +240,7 @@ class PooledLogicalPacket : public LogicalPacket template FixedLogicalPacket::FixedLogicalPacket(const void *data, int dataLen) { mDataLen = dataLen; - if (data != NULL) + if (data != nullptr) memcpy(mData, data, mDataLen); } @@ -270,7 +270,7 @@ template void FixedLogicalPacket::SetDataLen(int l ///////////////////////////////////////////////////////////////////////// template StructLogicalPacket::StructLogicalPacket(T *initData) { - if (initData != NULL) + if (initData != nullptr) mStruct = *initData; } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpManager.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpManager.cpp index 5a63f361..2129e06f 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpManager.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpManager.cpp @@ -111,10 +111,10 @@ UdpManager::UdpManager(const UdpParams *params) : mConnectionList(&UdpConnection mParams.maxDataHoldSize = udpMin(mParams.maxDataHoldSize, mParams.maxRawPacketSize); mParams.packetHistoryMax = udpMax(1, mParams.packetHistoryMax); mPacketHistoryPosition = 0; - mPassThroughData = NULL; - mBackgroundThread = NULL; + mPassThroughData = nullptr; + mBackgroundThread = nullptr; - if (mParams.udpDriver != NULL) + if (mParams.udpDriver != nullptr) { mDriver = mParams.udpDriver; } @@ -154,7 +154,7 @@ UdpManager::UdpManager(const UdpParams *params) : mConnectionList(&UdpConnection mSimulateOutgoingQueueBytes = 0; if (mParams.avoidPriorityQueue) - mPriorityQueue = NULL; + mPriorityQueue = nullptr; else mPriorityQueue = new PriorityQueue(mParams.maxConnections); @@ -181,7 +181,7 @@ UdpManager::~UdpManager() { // Since the background thread holds a reference to the UdpManager while it is running, this should // not be possible. The only way it could happen is if somebody released the manager who should not have. - assert(mBackgroundThread == NULL); + assert(mBackgroundThread == nullptr); // next thing we must do is tell all the connections to disconnect (which severs their link to this dying manager) // this has to be done first since they will call back into us and have themselves removed from our connection-list/priority-queue/etc @@ -191,7 +191,7 @@ UdpManager::~UdpManager() UdpGuard cg(&mConnectionGuard); UdpConnection *cur = mConnectionList.First(); - while (cur != NULL) + while (cur != nullptr) { cur->AddRef(); cur->InternalDisconnect(0, UdpConnection::cDisconnectReasonManagerDeleted); // this will cause it to remove us from the mConnectionList @@ -216,9 +216,9 @@ UdpManager::~UdpManager() UdpGuard guard(&mPoolGuard); PooledLogicalPacket *walk = mPoolCreatedList.RemoveHead(); - while (walk != NULL) + while (walk != nullptr) { - walk->mUdpManager = NULL; + walk->mUdpManager = nullptr; walk = mPoolCreatedList.RemoveHead(); } // next release the ones we have in our available pool @@ -232,11 +232,11 @@ UdpManager::~UdpManager() CloseSocket(); - if (mParams.udpDriver == NULL) + if (mParams.udpDriver == nullptr) { delete mDriver; // we were not given a driver to use, so we must own this driver we have, so destroy it } - mDriver = NULL; + mDriver = nullptr; delete mAddressHashTable; delete mConnectCodeHashTable; @@ -295,7 +295,7 @@ void UdpManager::ProcessDisconnectPending() UdpGuard guard(&mDisconnectPendingGuard); UdpConnection *entry = mDisconnectPendingList.First(); - while (entry != NULL) + while (entry != nullptr) { UdpConnection *next = mDisconnectPendingList.Next(entry); if (entry->GetStatus() == UdpConnection::cStatusDisconnected) @@ -309,12 +309,12 @@ void UdpManager::ProcessDisconnectPending() void UdpManager::RemoveConnection(UdpConnection *con) { - assert(con != NULL); // attemped to remove a NULL connection object + assert(con != nullptr); // attemped to remove a nullptr connection object // note: it's a bug to Remove a connection object that is already removed...should never be able to happen. UdpGuard cg(&mConnectionGuard); - if (mPriorityQueue != NULL) + if (mPriorityQueue != nullptr) { mPriorityQueue->Remove(con); } @@ -326,7 +326,7 @@ void UdpManager::RemoveConnection(UdpConnection *con) void UdpManager::AddConnection(UdpConnection *con) { - assert(con != NULL); // attemped to add a NULL connection object + assert(con != nullptr); // attemped to add a nullptr connection object UdpGuard cg(&mConnectionGuard); con->AddRef(); // UdpManager keeps a soft reference to the connection (ie. if it sees it is the only one holding a reference, it releases it) @@ -341,17 +341,17 @@ void UdpManager::FlushAllMultiBuffer() mConnectionGuard.Enter(); UdpConnection *cur = mConnectionList.First(); - if (cur != NULL) + if (cur != nullptr) cur->AddRef(); mConnectionGuard.Leave(); - while (cur != NULL) + while (cur != nullptr) { cur->FlushMultiBuffer(); mConnectionGuard.Enter(); UdpConnection *next = mConnectionList.Next(cur); - if (next != NULL) + if (next != nullptr) next->AddRef(); mConnectionGuard.Leave(); @@ -366,15 +366,15 @@ void UdpManager::DisconnectAll() mConnectionGuard.Enter(); UdpConnection *cur = mConnectionList.First(); - if (cur != NULL) + if (cur != nullptr) cur->AddRef(); mConnectionGuard.Leave(); - while (cur != NULL) + while (cur != nullptr) { mConnectionGuard.Enter(); UdpConnection *next = mConnectionList.Next(cur); - if (next != NULL) + if (next != nullptr) next->AddRef(); mConnectionGuard.Leave(); @@ -392,7 +392,7 @@ void UdpManager::DeliverEvents(int maxProcessingTime) for (;;) { CallbackEvent *ce = EventListPop(); - if (ce == NULL) + if (ce == nullptr) break; switch(ce->mEventType) @@ -426,13 +426,13 @@ void UdpManager::DeliverEvents(int maxProcessingTime) { { // guard block UdpGuard hguard(&mHandlerGuard); - if (mParams.handler != NULL) + if (mParams.handler != nullptr) { mParams.handler->OnConnectRequest(ce->mSource); } } - if (ce->mSource->GetHandler() == NULL) // if application did not set a handler, then the connection is considered refused + if (ce->mSource->GetHandler() == nullptr) // if application did not set a handler, then the connection is considered refused { ce->mSource->InternalDisconnect(0, UdpConnection::cDisconnectReasonConnectionRefused); } @@ -513,7 +513,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) PacketHistoryEntry *e = SimulationReceive(); #endif - if (e == NULL) + if (e == nullptr) { mLastEmptySocketBufferStamp = CachedClock(); break; @@ -545,7 +545,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) if (giveConnectionsTime) { - if (mPriorityQueue != NULL) + if (mPriorityQueue != nullptr) { // give time to everybody in the priority-queue that needs it UdpClockStamp curPriority = CachedClock(); @@ -570,10 +570,10 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) mConnectionGuard.Enter(); top = mPriorityQueue->TopRemove(curPriority); - if (top != NULL) + if (top != nullptr) top->AddRef(); // must always addref connections while inside the connection guard mConnectionGuard.Leave(); - if (top == NULL) + if (top == nullptr) break; top->GiveTime(true); @@ -593,17 +593,17 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) // give time to everybody mConnectionGuard.Enter(); UdpConnection *cur = mConnectionList.First(); - if (cur != NULL) + if (cur != nullptr) cur->AddRef(); mConnectionGuard.Leave(); - while (cur != NULL) + while (cur != nullptr) { cur->GiveTime(true); mConnectionGuard.Enter(); UdpConnection *next = mConnectionList.Next(cur); - if (next != NULL) + if (next != nullptr) next->AddRef(); mConnectionGuard.Leave(); @@ -621,13 +621,13 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) UdpClockStamp curStamp = CachedClock(); SimulateQueueEntry *entry = mSimulateOutgoingList.First(); - while (entry != NULL && curStamp >= mSimulateNextOutgoingTime) + while (entry != nullptr && curStamp >= mSimulateNextOutgoingTime) { mSimulateOutgoingList.Remove(entry); SimulateQueueEntry *next = mSimulateOutgoingList.First(); // simulate a delay before next packet is considered (ie. simple lag) - if (next != NULL) + if (next != nullptr) { int latencyDelay = (mSimulation.simulateOutgoingLatency - CachedClockElapsed(next->mQueueTime)); mSimulateNextOutgoingTime = curStamp + latencyDelay; @@ -644,7 +644,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) ActualSendHelper(entry->mData, entry->mDataLen, entry->mIp, entry->mPort); UdpConnection *con = AddressGetConnection(entry->mIp, entry->mPort); - if (con != NULL) + if (con != nullptr) { con->mSimulateOutgoingQueueBytes -= entry->mDataLen; con->Release(); @@ -664,12 +664,12 @@ UdpConnection *UdpManager::EstablishConnection(const char *serverAddress, int se { UdpGuard guard(&mGiveTimeGuard); // probably not needed, I don't see any reason we can't do this while GiveTime is happening in the background...the connection list is protected independently...still, better safe than sorry - assert(serverAddress != NULL); + assert(serverAddress != nullptr); char useServerAddress[512]; UdpLibrary::UdpMisc::Strncpy(useServerAddress, serverAddress, sizeof(useServerAddress)); char *portPtr = strchr(useServerAddress, ':'); - if (portPtr != NULL) + if (portPtr != nullptr) { *portPtr++ = 0; serverPort = atoi(portPtr); @@ -679,21 +679,21 @@ UdpConnection *UdpManager::EstablishConnection(const char *serverAddress, int se assert(serverPort != 0); // can't connect to no port if (mConnectionList.Count() >= mParams.maxConnections) - return(NULL); + return(nullptr); // get server address UdpPlatformAddress destIp; if (!mDriver->GetHostByName(&destIp, useServerAddress)) { - return(NULL); // could not resolve name + return(nullptr); // could not resolve name } // first, see if we already have a connection object managing this ip/port, if we do, then fail UdpConnection *con = AddressGetConnection(destIp, serverPort); - if (con != NULL) + if (con != nullptr) { con->Release(); - return(NULL); // already connected to this address/port + return(nullptr); // already connected to this address/port } return(new UdpConnection(this, destIp, serverPort, timeout)); } @@ -709,7 +709,7 @@ void UdpManager::GetStats(UdpManagerStatistics *stats) { UdpGuard sg(&mStatsGuard); - assert(stats != NULL); + assert(stats != nullptr); *stats = mManagerStats; stats->poolAvailable = mPoolAvailableList.Count(); stats->poolCreated = mPoolCreatedList.Count(); @@ -737,10 +737,10 @@ void UdpManager::DumpPacketHistory(const char *filename) const { UdpGuard guard(&mGiveTimeGuard); - assert(filename != NULL); + assert(filename != nullptr); assert(filename[0] != 0); FILE *file = fopen(filename, "wt"); - if (file != NULL) + if (file != nullptr) { // dump history of packets... for (int i = 0; i < mParams.packetHistoryMax; i++) @@ -789,7 +789,7 @@ UdpManager::PacketHistoryEntry *UdpManager::SimulationReceive() for (;;) { PacketHistoryEntry *entry = ActualReceive(); - if (entry == NULL) + if (entry == nullptr) break; SimulateQueueEntry *qe = new SimulateQueueEntry(entry->mBuffer, entry->mLen, entry->mIp, entry->mPort, curStamp); @@ -797,7 +797,7 @@ UdpManager::PacketHistoryEntry *UdpManager::SimulationReceive() } SimulateQueueEntry *winner = mSimulateIncomingList.First(); - if (winner != NULL && CachedClockElapsed(winner->mQueueTime) >= mSimulation.simulateIncomingLatency) + if (winner != nullptr && CachedClockElapsed(winner->mQueueTime) >= mSimulation.simulateIncomingLatency) { mSimulateIncomingList.Remove(winner); int pos = mPacketHistoryPosition; @@ -809,14 +809,14 @@ UdpManager::PacketHistoryEntry *UdpManager::SimulationReceive() delete winner; return(mPacketHistory[pos]); } - return(NULL); + return(nullptr); } UdpManager::PacketHistoryEntry *UdpManager::ActualReceive() { UdpClockStamp curStamp = CachedClock(); if (mSimulation.simulateIncomingByteRate > 0 && curStamp < mSimulateNextIncomingTime) - return(NULL); + return(nullptr); UdpPlatformAddress fromAddress; int fromPort = 0; @@ -855,7 +855,7 @@ UdpManager::PacketHistoryEntry *UdpManager::ActualReceive() } return(mPacketHistory[pos]); } - return(NULL); + return(nullptr); } void UdpManager::ActualSend(const udp_uchar *data, int dataLen, UdpPlatformAddress ip, int port) @@ -876,7 +876,7 @@ void UdpManager::ActualSend(const udp_uchar *data, int dataLen, UdpPlatformAddre return; // no room, packet gets lost UdpConnection *con = AddressGetConnection(ip, port); - if (con != NULL) + if (con != nullptr) { if (mSimulation.simulateDestinationOverloadLevel > 0 && con->mSimulateOutgoingQueueBytes + dataLen > mSimulation.simulateDestinationOverloadLevel) { @@ -928,7 +928,7 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) UdpConnection *con = AddressGetConnection(e->mIp, e->mPort); - if (con == NULL) + if (con == nullptr) { if (e->mLen == 0) // len = 0 = ICMP error { @@ -946,7 +946,7 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) if (mConnectionList.Count() >= mParams.maxConnections) return; // can't handle any more connections, so ignore this request entirely - if (mParams.handler != NULL) + if (mParams.handler != nullptr) { UdpConnection *newcon = new UdpConnection(this, e); CallbackConnectRequest(newcon); @@ -968,7 +968,7 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) int encryptCode = UdpMisc::GetValue32(ptr); UdpConnection *con = ConnectCodeGetConnection(connectCode); - if (con != NULL) + if (con != nullptr) { if (mParams.allowAddressRemapping || con->mIp == e->mIp) { @@ -1025,7 +1025,7 @@ UdpConnection *UdpManager::AddressGetConnection(UdpPlatformAddress ip, int port) UdpGuard guard(&mConnectionGuard); UdpConnection *found = mAddressHashTable->FindFirst(AddressHashValue(ip, port)); - while (found != NULL) + while (found != nullptr) { if (found->mIp == ip && found->mPort == port) { @@ -1034,7 +1034,7 @@ UdpConnection *UdpManager::AddressGetConnection(UdpPlatformAddress ip, int port) } found = mAddressHashTable->FindNext(found); } - return(NULL); + return(nullptr); } UdpConnection *UdpManager::ConnectCodeGetConnection(int connectCode) const @@ -1042,7 +1042,7 @@ UdpConnection *UdpManager::ConnectCodeGetConnection(int connectCode) const UdpGuard guard(&mConnectionGuard); UdpConnection *found = mConnectCodeHashTable->FindFirst(connectCode); - while (found != NULL) + while (found != nullptr) { if (found->mConnectCode == connectCode) { @@ -1051,7 +1051,7 @@ UdpConnection *UdpManager::ConnectCodeGetConnection(int connectCode) const } found = mConnectCodeHashTable->FindNext(found); } - return(NULL); + return(nullptr); } LogicalPacket *UdpManager::CreatePacket(const void *data, int dataLen, const void *data2, int dataLen2) @@ -1063,7 +1063,7 @@ LogicalPacket *UdpManager::CreatePacket(const void *data, int dataLen, const voi { UdpGuard guard(&mPoolGuard); PooledLogicalPacket *lp = mPoolAvailableList.RemoveHead(); - if (lp == NULL) + if (lp == nullptr) { // create a new pooled packet to fulfil request lp = new PooledLogicalPacket(this, mParams.pooledPacketSize); @@ -1091,7 +1091,7 @@ void UdpManager::PoolDestroyed(PooledLogicalPacket *packet) char *UdpManager::GetLocalString(char *buf, int bufLen) const { if (bufLen < 22) - return(NULL); + return(nullptr); UdpPlatformAddress ip = GetLocalIp(); int port = GetLocalPort(); char hold[256]; @@ -1103,7 +1103,7 @@ UdpManager::CallbackEvent *UdpManager::AvailableEventBorrow() { UdpGuard guard(&mAvailableEventGuard); CallbackEvent *ce = mAvailableEventList.RemoveHead(); - if (ce == NULL) + if (ce == nullptr) { ce = new CallbackEvent(); } @@ -1127,7 +1127,7 @@ void UdpManager::EventListAppend(CallbackEvent *ce) { UdpGuard guard(&mEventListGuard); mEventList.InsertTail(ce); - if (ce->mPayload != NULL) + if (ce->mPayload != nullptr) { mEventListBytes += ce->mPayload->GetDataLen(); } @@ -1137,7 +1137,7 @@ UdpManager::CallbackEvent *UdpManager::EventListPop() { UdpGuard guard(&mEventListGuard); CallbackEvent *event = mEventList.RemoveHead(); - if (event != NULL && event->mPayload != NULL) + if (event != nullptr && event->mPayload != nullptr) { mEventListBytes -= event->mPayload->GetDataLen(); } @@ -1148,7 +1148,7 @@ UdpManager::CallbackEvent *UdpManager::EventListPop() void UdpManager::ThreadStart() { UdpGuard guard(&mThreadGuard); - if (mBackgroundThread == NULL) + if (mBackgroundThread == nullptr) { mBackgroundThread = new UdpManagerThread(this, mParams.threadSleepTime); mBackgroundThread->Start(); @@ -1158,12 +1158,12 @@ void UdpManager::ThreadStart() void UdpManager::ThreadStop() { UdpGuard guard(&mThreadGuard); - if (mBackgroundThread != NULL) + if (mBackgroundThread != nullptr) { assert(mRefCount > 1); // caller must hold a reference, and thread must hold a reference, so this should be true. If it asserts, it means the caller is using a UdpManager that it does not hold a reference to. mBackgroundThread->Stop(true); mBackgroundThread->Release(); - mBackgroundThread = NULL; + mBackgroundThread = nullptr; } } @@ -1256,13 +1256,13 @@ void UdpManager::CallbackConnectRequest(UdpConnection *con) { { // guard block UdpGuard hguard(&mHandlerGuard); - if (mParams.handler != NULL) + if (mParams.handler != nullptr) { mParams.handler->OnConnectRequest(con); } } - if (con->GetHandler() == NULL) // if application did not set a handler, then the connection is considered refused + if (con->GetHandler() == nullptr) // if application did not set a handler, then the connection is considered refused { con->InternalDisconnect(0, UdpConnection::cDisconnectReasonConnectionRefused); } @@ -1276,8 +1276,8 @@ void UdpManager::CallbackConnectRequest(UdpConnection *con) UdpManager::CallbackEvent::CallbackEvent() { mEventType = cCallbackEventNone; - mSource = NULL; - mPayload = NULL; + mSource = nullptr; + mPayload = nullptr; mReason = cUdpCorruptionReasonNone; } @@ -1291,7 +1291,7 @@ void UdpManager::CallbackEvent::SetEventData(CallbackEventType eventType, UdpCon mEventType = eventType; mSource = con; mSource->AddRef(); - if (payload != NULL) + if (payload != nullptr) { mPayload = payload; mPayload->AddRef(); @@ -1300,16 +1300,16 @@ void UdpManager::CallbackEvent::SetEventData(CallbackEventType eventType, UdpCon void UdpManager::CallbackEvent::ClearEventData() { - if (mSource != NULL) + if (mSource != nullptr) { mSource->Release(); - mSource = NULL; + mSource = nullptr; } - if (mPayload != NULL) + if (mPayload != nullptr) { mPayload->Release(); - mPayload = NULL; + mPayload = nullptr; } } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpManager.h b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpManager.h index 3715a0b2..7c263031 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpManager.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpManager.h @@ -178,7 +178,7 @@ struct UdpParams // pointer equal to your object and the UdpManager will call it as appropriate. The UdpConnection object // also has a handler mechanism that replaces the other callback functions below, see UdpConnection::SetHandler // if a handler is specified, the callback function is ignored, even if specified. - // default = NULL (not used) + // default = nullptr (not used) UdpManagerHandler *handler; // this is the maximum number of connections that can be established by this manager, any incoming/outgoing connections @@ -496,7 +496,7 @@ struct UdpParams // the UdpPlatformDriver object itself and chain the calls on through, plus do whatever else it wants; // however, that is not required. The application maintains ownership of this object and the object must // not be destroyed by the application until the UdpManager using it is destroyed. - // default = NULL, meaning the UdpManager it will create it's own UdpPlatformDriver for use. + // default = nullptr, meaning the UdpManager it will create it's own UdpPlatformDriver for use. UdpDriver *udpDriver; @@ -642,7 +642,7 @@ class UdpManager : public UdpGuardedRefCount // will call EstablishConnection, then sit in a loop calling UdpManager::GiveTime and checking to see // if the status of the returned UdpConnection object is changed from cStatusNegotiating. This allows // the application to look for the ESC key or timeout an attempted connection. - // This function will return NULL if the manager object has exceeded its maximum number of connections + // This function will return nullptr if the manager object has exceeded its maximum number of connections // or if the serverAddress cannot be resolved to an IP address // as is noted in the declaration, it is the responsibility of the application establishing the connection to delete it // setting the timeout value (in milliseconds) to something greater than 0 will cause the UdpConnection object to change @@ -685,13 +685,13 @@ class UdpManager : public UdpGuardedRefCount // a terminated packet. void DisconnectAll(); - // creates a logical packet and populates it with data. data can be NULL, in which case it gives you logical packet + // creates a logical packet and populates it with data. data can be nullptr, in which case it gives you logical packet // of the size specified, but copies no data into it. If you are using pool management (see Params::poolPacketMax), // it will give you a packet out of the pool if possible, otherwise it will create a packet for you. When logical // are packets are needed internally for various things (like reliable channel sends that use the (void *, int) interface) // they are gotten from this function, so your application can likely take advantage of pooling, even if it never bothers // to explicitly call this function. - LogicalPacket *CreatePacket(const void *data, int dataLen, const void *data2 = NULL, int dataLen2 = 0); + LogicalPacket *CreatePacket(const void *data, int dataLen, const void *data2 = nullptr, int dataLen2 = 0); void GetSimulation(UdpSimulationParameters *simulationParameters) const; void SetSimulation(const UdpSimulationParameters *simulationParameters); @@ -796,7 +796,7 @@ class UdpManager : public UdpGuardedRefCount CallbackEvent(); ~CallbackEvent(); - void SetEventData(CallbackEventType eventType, UdpConnection *con, const LogicalPacket *payload = NULL); + void SetEventData(CallbackEventType eventType, UdpConnection *con, const LogicalPacket *payload = nullptr); void ClearEventData(); CallbackEventType mEventType; @@ -926,7 +926,7 @@ inline void UdpManager::SetPriority(UdpConnection *con, UdpClockStamp stamp) if (stamp < mMinimumScheduledStamp) stamp = mMinimumScheduledStamp; - if (mPriorityQueue != NULL) + if (mPriorityQueue != nullptr) { mPriorityQueue->Add(con, stamp); } @@ -1025,7 +1025,7 @@ inline int UdpManager::CachedClockElapsed(UdpClockStamp start) inline int UdpManager::EncryptUserSupplied(UdpConnection *con, udp_uchar *destData, const udp_uchar *sourceData, int sourceLen) { UdpGuard guard(&mHandlerGuard); - if (mParams.handler != NULL) + if (mParams.handler != nullptr) { return(mParams.handler->OnUserSuppliedEncrypt(con, destData, sourceData, sourceLen)); } @@ -1035,7 +1035,7 @@ inline int UdpManager::EncryptUserSupplied(UdpConnection *con, udp_uchar *destDa inline int UdpManager::EncryptUserSupplied2(UdpConnection *con, udp_uchar *destData, const udp_uchar *sourceData, int sourceLen) { UdpGuard guard(&mHandlerGuard); - if (mParams.handler != NULL) + if (mParams.handler != nullptr) { return(mParams.handler->OnUserSuppliedEncrypt2(con, destData, sourceData, sourceLen)); } @@ -1045,7 +1045,7 @@ inline int UdpManager::EncryptUserSupplied2(UdpConnection *con, udp_uchar *destD inline int UdpManager::DecryptUserSupplied(UdpConnection *con, udp_uchar *destData, const udp_uchar *sourceData, int sourceLen) { UdpGuard guard(&mHandlerGuard); - if (mParams.handler != NULL) + if (mParams.handler != nullptr) { return(mParams.handler->OnUserSuppliedDecrypt(con, destData, sourceData, sourceLen)); } @@ -1055,7 +1055,7 @@ inline int UdpManager::DecryptUserSupplied(UdpConnection *con, udp_uchar *destDa inline int UdpManager::DecryptUserSupplied2(UdpConnection *con, udp_uchar *destData, const udp_uchar *sourceData, int sourceLen) { UdpGuard guard(&mHandlerGuard); - if (mParams.handler != NULL) + if (mParams.handler != nullptr) { return(mParams.handler->OnUserSuppliedDecrypt2(con, destData, sourceData, sourceLen)); } @@ -1070,7 +1070,7 @@ inline int UdpManager::DecryptUserSupplied2(UdpConnection *con, udp_uchar *destD ///////////////////////////////////////////////////////////////////////////////////////////////////// inline UdpParams::UdpParams(ManagerRole role) { - handler = NULL; + handler = nullptr; outgoingBufferSize = 64 * 1024; incomingBufferSize = 64 * 1024; packetHistoryMax = 4; @@ -1103,7 +1103,7 @@ inline UdpParams::UdpParams(ManagerRole role) reliableOverflowBytes = 0; lingerDelay = 10; bindIpAddress[0] = 0; - udpDriver = NULL; + udpDriver = nullptr; callbackEventPoolMax = 5000; eventQueuing = false; threadSleepTime = 20; diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.cpp index b50daae0..651492fc 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.cpp @@ -113,19 +113,19 @@ void *UdpMisc::SmartResize(void *ptr, int bytes, int round) if (bytes == 0) { - if (ptr != NULL) + if (ptr != nullptr) { free((udp_uchar *)ptr - cAlignment); } - return(NULL); + return(nullptr); } udp_uchar *ptr2; - if (ptr == NULL) + if (ptr == nullptr) { ptr2 = (udp_uchar *)malloc(bytes + cAlignment); - if (ptr2 == NULL) - return(NULL); + if (ptr2 == nullptr) + return(nullptr); *(int *)ptr2 = bytes; return(ptr2 + cAlignment); } @@ -135,8 +135,8 @@ void *UdpMisc::SmartResize(void *ptr, int bytes, int round) return(ptr); ptr2 = (udp_uchar *)realloc((udp_uchar *)ptr - cAlignment, bytes + cAlignment); - if (ptr2 == NULL) - return(NULL); + if (ptr2 == nullptr) + return(nullptr); *(int *)ptr2 = bytes; return(ptr2 + cAlignment); @@ -199,30 +199,30 @@ LogicalPacket *UdpMisc::CreateQuickLogicalPacket(const void *data, int dataLen, switch(q) { case 0: - tlp = new FixedLogicalPacket(NULL, totalDataLen); + tlp = new FixedLogicalPacket(nullptr, totalDataLen); break; case 1: - tlp = new FixedLogicalPacket(NULL, totalDataLen); + tlp = new FixedLogicalPacket(nullptr, totalDataLen); break; case 2: case 3: - tlp = new FixedLogicalPacket(NULL, totalDataLen); + tlp = new FixedLogicalPacket(nullptr, totalDataLen); break; case 4: case 5: case 6: case 7: - tlp = new FixedLogicalPacket(NULL, totalDataLen); + tlp = new FixedLogicalPacket(nullptr, totalDataLen); break; default: - tlp = new SimpleLogicalPacket(NULL, totalDataLen); + tlp = new SimpleLogicalPacket(nullptr, totalDataLen); break; } udp_uchar *dest = (udp_uchar *)tlp->GetDataPtr(); - if (data != NULL) + if (data != nullptr) memcpy(dest, data, dataLen); - if (data2 != NULL) + if (data2 != nullptr) memcpy(dest + dataLen, data2, dataLen2); return(tlp); } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.h b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.h index 3961823f..f77380ca 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.h @@ -57,7 +57,7 @@ class UdpMisc // memory manager does a little bit of this, but if you know you have an allocation that is likely // to grow quite a bit, you can set the round'ing size up to a fairly large number and avoid // unnecessary reallocs at the cost of a little potentially wasted space - // initial allocations are done by passing in ptr==NULL, freeing is done by passing in bytes==0 + // initial allocations are done by passing in ptr==nullptr, freeing is done by passing in bytes==0 static void *SmartResize(void *ptr, int bytes, int round = 1); // the following two functions store values in the buffer as a variable length (B1, 0xffB2B1, 0xffffffB4B3B2B1) @@ -78,7 +78,7 @@ class UdpMisc static udp_uint GetValue24(const void *buffer); // gets a 24-bit value from the buffer in big-endian format static udp_ushort GetValue16(const void *buffer); // gets a 16-bit value from the buffer in big-endian format - static LogicalPacket *CreateQuickLogicalPacket(const void *data, int dataLen, const void *data2 = NULL, int dataLen2 = 0); + static LogicalPacket *CreateQuickLogicalPacket(const void *data, int dataLen, const void *data2 = nullptr, int dataLen2 = 0); // looks up the specified name and translates it to an IP address // this is a blocking call that can at times take a significant amount of time, but will generally be fast (less than 300ms) diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpPriority.h b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpPriority.h index c50dee62..e4f2df20 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpPriority.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpPriority.h @@ -43,12 +43,12 @@ template class PriorityQueue PriorityQueue(int queueSize); ~PriorityQueue(); - T* Top(); // returns NULL if queue is empty - T* TopRemove(); // returns NULL if queue is empty - T* TopRemove(P priority); // removes item from queue if it has a lower priority value, otherwise return NULL + T* Top(); // returns nullptr if queue is empty + T* TopRemove(); // returns nullptr if queue is empty + T* TopRemove(P priority); // removes item from queue if it has a lower priority value, otherwise return nullptr T* Add(T* entry, P priority); // reprioritizes if already in queue, returns entry always T* Remove(T* entry); // returns entry always (even if it was not in the queue) - P *GetPriority(T* entry); // returns NULL if entry is not in the queue + P *GetPriority(T* entry); // returns nullptr if entry is not in the queue int QueueUsed(); // returns how many entries are in the queue protected: struct QueueEntry @@ -94,14 +94,14 @@ template PriorityQueue::~PriorityQueue() template T* PriorityQueue::Top() { if (mQueueEnd == 0) - return(NULL); + return(nullptr); return(mQueue[0].entry); } template T* PriorityQueue::TopRemove() { if (mQueueEnd == 0) - return(NULL); + return(nullptr); T* top = mQueue[0].entry; Remove(top); return(top); @@ -111,14 +111,14 @@ template T* PriorityQueue::TopRemove(P priority) { if (mQueueEnd > 0 && mQueue[0].priority <= priority) return(Remove(mQueue[0].entry)); - return(NULL); + return(nullptr); } template P* PriorityQueue::GetPriority(T* entry) { if (entry->mPriorityQueuePosition >= 0) return(&mQueue[entry->mPriorityQueuePosition].priority); - return(NULL); + return(nullptr); } template T* PriorityQueue::Add(T* entry, P priority) @@ -127,7 +127,7 @@ template T* PriorityQueue::Add(T* entry, P priorit { // not in queue, so add it to the bottom if (mQueueEnd >= mQueueSize) - return(NULL); + return(nullptr); mQueue[mQueueEnd].entry = entry; mQueue[mQueueEnd].priority = priority; mQueue[mQueueEnd].entry->mPriorityQueuePosition = mQueueEnd; diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpReliableChannel.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpReliableChannel.cpp index d31de9b4..5b6250f5 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpReliableChannel.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpReliableChannel.cpp @@ -48,12 +48,12 @@ UdpReliableChannel::UdpReliableChannel(int channelNumber, UdpConnection *con, Ud mReliableOutgoingBytes = 0; mLogicalBytesQueued = 0; - mCoalescePacket = NULL; - mCoalesceStartPtr = NULL; - mCoalesceEndPtr = NULL; + mCoalescePacket = nullptr; + mCoalesceStartPtr = nullptr; + mCoalesceEndPtr = nullptr; mCoalesceCount = 0; - mBufferedAckPtr = NULL; + mBufferedAckPtr = nullptr; mStatDuplicatePacketsReceived = 0; mStatResentPacketsAccelerated = 0; @@ -69,7 +69,7 @@ UdpReliableChannel::UdpReliableChannel(int channelNumber, UdpConnection *con, Ud mBigDataLen = 0; mBigDataTargetLen = 0; - mBigDataPtr = NULL; + mBigDataPtr = nullptr; mFragmentNextPos = 0; mLastTimeStampAcknowledged = 0; mMaxxedOutCurrentWindow = false; @@ -81,14 +81,14 @@ UdpReliableChannel::UdpReliableChannel(int channelNumber, UdpConnection *con, Ud UdpReliableChannel::~UdpReliableChannel() { - if (mCoalescePacket != NULL) + if (mCoalescePacket != nullptr) { mCoalescePacket->Release(); - mCoalescePacket = NULL; + mCoalescePacket = nullptr; } const LogicalPacket *cur = mLogicalPacketList.RemoveHead(); - while (cur != NULL) + while (cur != nullptr) { cur->Release(); cur = mLogicalPacketList.RemoveHead(); @@ -103,7 +103,7 @@ UdpReliableChannel::~UdpReliableChannel() void UdpReliableChannel::Send(const udp_uchar *data, int dataLen, const udp_uchar *data2, int dataLen2) { - if (mLogicalPacketList.Count() == 0 && mCoalescePacket == NULL) + if (mLogicalPacketList.Count() == 0 && mCoalescePacket == nullptr) { // if we are adding something to a previously empty logical queue, then it is possible that // we may be able to send it, so mark ourselves to take time the next time it is offered @@ -126,7 +126,7 @@ void UdpReliableChannel::Send(const udp_uchar *data, int dataLen, const udp_ucha void UdpReliableChannel::FlushCoalesce() { - if (mCoalescePacket != NULL) + if (mCoalescePacket != nullptr) { if (mCoalesceCount == 1) { @@ -140,16 +140,16 @@ void UdpReliableChannel::FlushCoalesce() mCoalescePacket->SetDataLen((int)(mCoalesceEndPtr - mCoalesceStartPtr)); QueueLogicalPacket(mCoalescePacket); mCoalescePacket->Release(); - mCoalescePacket = NULL; + mCoalescePacket = nullptr; } } void UdpReliableChannel::SendCoalesce(const udp_uchar *data, int dataLen, const udp_uchar *data2, int dataLen2) { int totalLen = dataLen + dataLen2; - if (mCoalescePacket == NULL) + if (mCoalescePacket == nullptr) { - mCoalescePacket = mUdpConnection->mUdpManager->CreatePacket(NULL, mMaxDataBytes); + mCoalescePacket = mUdpConnection->mUdpManager->CreatePacket(nullptr, mMaxDataBytes); mCoalesceEndPtr = mCoalesceStartPtr = (udp_uchar *)mCoalescePacket->GetDataPtr(); *mCoalesceEndPtr++ = 0; *mCoalesceEndPtr++ = UdpConnection::cUdpPacketGroup; @@ -169,10 +169,10 @@ void UdpReliableChannel::SendCoalesce(const udp_uchar *data, int dataLen, const // append on end of coalesce mCoalesceCount++; mCoalesceEndPtr += UdpMisc::PutVariableValue(mCoalesceEndPtr, totalLen); - if (data != NULL) + if (data != nullptr) memcpy(mCoalesceEndPtr, data, dataLen); mCoalesceEndPtr += dataLen; - if (data2 != NULL) + if (data2 != nullptr) memcpy(mCoalesceEndPtr, data2, dataLen2); mCoalesceEndPtr += dataLen2; } @@ -287,7 +287,7 @@ int UdpReliableChannel::GiveTime() mMaxxedOutCurrentWindow = false; int outstandingNextSendTime = 10 * 60000; // if we have something to do - if (mReliableOutgoingPendingId < mReliableOutgoingId || mLogicalPacketList.Count() != 0 || mCoalescePacket != NULL) + if (mReliableOutgoingPendingId < mReliableOutgoingId || mLogicalPacketList.Count() != 0 || mCoalescePacket != nullptr) { // first, let's calculate how many bytes we figure is outstanding based on who is still waiting for an ack-packet UdpClockStamp oldestResendTime = udpMax(hotClock - optimalResendDelay, mLastTimeStampAcknowledged); // anything older than this, we need to resend @@ -317,7 +317,7 @@ int UdpReliableChannel::GiveTime() // if this packet has not been acked and it is NOT ready to be sent (was recently sent) then we consider it outstanding // note: packets needing re-sending probably got lost and are therefore not outstanding PhysicalPacket *entry = &mPhysicalPackets[i % mConfig.maxOutstandingPackets]; - if (entry->mDataPtr != NULL) // acked packets set the dataPtr to NULL + if (entry->mDataPtr != nullptr) // acked packets set the dataPtr to nullptr { // if this packet is ready to be sent (ie: needs time now, or some later packet has already been ack'ed) windowSpaceLeft -= entry->mDataLen; // window-space is effectively taken whether we have sent it yet or not @@ -524,7 +524,7 @@ int UdpReliableChannel::GiveTime() void UdpReliableChannel::GetChannelStatus(UdpConnection::ChannelStatus *channelStatus) const { int coalesceBytes = 0; - if (mCoalescePacket != NULL) + if (mCoalescePacket != nullptr) coalesceBytes = (int)(mCoalesceEndPtr - mCoalesceStartPtr); channelStatus->totalPendingBytes = mLogicalBytesQueued + mReliableOutgoingBytes + coalesceBytes; @@ -550,7 +550,7 @@ void UdpReliableChannel::GetChannelStatus(UdpConnection::ChannelStatus *channelS PhysicalPacket *entry = &mPhysicalPackets[mReliableOutgoingPendingId % mConfig.maxOutstandingPackets]; if (entry->mFirstTimeStamp != 0) // if has been sent (we know it hasn't been acknowledged or we couldn't possibly be pointing at it as pending) { - if (mUdpConnection->GetUdpManager() != NULL) + if (mUdpConnection->GetUdpManager() != nullptr) { channelStatus->oldestUnacknowledgedAge = mUdpConnection->GetUdpManager()->CachedClockElapsed(entry->mFirstTimeStamp); } @@ -588,7 +588,7 @@ void UdpReliableChannel::ReliablePacket(const udp_uchar *data, int dataLen) mReliableIncomingId++; // process other packets that have arrived - while (mReliableIncoming[mReliableIncomingId % mConfig.maxInstandingPackets].mPacket != NULL) + while (mReliableIncoming[mReliableIncomingId % mConfig.maxInstandingPackets].mPacket != nullptr) { int spot = (int)(mReliableIncomingId % mConfig.maxInstandingPackets); if (mReliableIncoming[spot].mMode != cReliablePacketModeDelivered) @@ -597,7 +597,7 @@ void UdpReliableChannel::ReliablePacket(const udp_uchar *data, int dataLen) } mReliableIncoming[spot].mPacket->Release(); - mReliableIncoming[spot].mPacket = NULL; + mReliableIncoming[spot].mPacket = nullptr; mReliableIncomingId++; } } @@ -605,7 +605,7 @@ void UdpReliableChannel::ReliablePacket(const udp_uchar *data, int dataLen) { // not the one we need next, but it is later than the one we need , so store it in our buffer until it's turn comes up int spot = (int)(reliableId % mConfig.maxInstandingPackets); - if (mReliableIncoming[spot].mPacket == NULL) // only make the copy of it if we don't already have it in our buffer (in cases where it was sent twice, there would be no harm in the copy again since it must be the same packet, it's just inefficient) + if (mReliableIncoming[spot].mPacket == nullptr) // only make the copy of it if we don't already have it in our buffer (in cases where it was sent twice, there would be no harm in the copy again since it must be the same packet, it's just inefficient) { mReliableIncoming[spot].mMode = mode; mReliableIncoming[spot].mPacket = mUdpConnection->mUdpManager->CreatePacket(data + UdpConnection::cUdpPacketReliableSize, dataLen - UdpConnection::cUdpPacketReliableSize); @@ -651,14 +651,14 @@ void UdpReliableChannel::ReliablePacket(const udp_uchar *data, int dataLen) bufPtr += UdpMisc::PutValue16(bufPtr, (udp_ushort)(reliableId & 0xffff)); } - if (mBufferedAckPtr != NULL && mConfig.ackDeduping && ackAll) + if (mBufferedAckPtr != nullptr && mConfig.ackDeduping && ackAll) { memcpy(mBufferedAckPtr, buf, bufPtr - buf); } else { - udp_uchar *ptr = mUdpConnection->BufferedSend(buf, (int)(bufPtr - buf), NULL, 0, true); // safe to append on our data, it is stack data - if (mBufferedAckPtr == NULL) + udp_uchar *ptr = mUdpConnection->BufferedSend(buf, (int)(bufPtr - buf), nullptr, 0, true); // safe to append on our data, it is stack data + if (mBufferedAckPtr == nullptr) { // the buffered-ack ptr should always point to the earliest ack in the buffer, such that // a replacement ack-all will be processed by the receiver before any selective acks that may @@ -676,7 +676,7 @@ void UdpReliableChannel::ProcessPacket(ReliablePacketMode mode, const udp_uchar if (mode == cReliablePacketModeReliable) { // we are not a fragment, nor was there a fragment in progress, so we are a simple reliable packet, just send it to the app - if (mBigDataPtr != NULL) + if (mBigDataPtr != nullptr) { mUdpConnection->CallbackCorruptPacket(data, dataLen, cUdpCorruptionReasonFragmentExpected); return; @@ -687,7 +687,7 @@ void UdpReliableChannel::ProcessPacket(ReliablePacketMode mode, const udp_uchar else if (mode == cReliablePacketModeFragment) { // append onto end of big packet (or create new big packet if not existing already) - if (mBigDataPtr == NULL) + if (mBigDataPtr == nullptr) { if (dataLen < 4) { @@ -729,7 +729,7 @@ void UdpReliableChannel::ProcessPacket(ReliablePacketMode mode, const udp_uchar delete[] mBigDataPtr; mBigDataLen = 0; mBigDataTargetLen = 0; - mBigDataPtr = NULL; + mBigDataPtr = nullptr; } } } @@ -767,7 +767,7 @@ void UdpReliableChannel::Ack(udp_int64 reliableId) int pos = (int)(reliableId % mConfig.maxOutstandingPackets); PhysicalPacket *entry = &mPhysicalPackets[pos]; - if (entry->mDataPtr != NULL) // if this packet has not been acknowledged yet (sometimes we get back two acks for the same packet) + if (entry->mDataPtr != nullptr) // if this packet has not been acknowledged yet (sometimes we get back two acks for the same packet) { mNextNeedTime = 0; // something got acked, so we actually need to take the time next time it is offered @@ -829,14 +829,14 @@ void UdpReliableChannel::Ack(udp_int64 reliableId) // this packet we have queued has been acknowledged, so delete it from queue mReliableOutgoingBytes -= entry->mDataLen; entry->mDataLen = 0; - entry->mDataPtr = NULL; + entry->mDataPtr = nullptr; entry->mParent->Release(); - entry->mParent = NULL; + entry->mParent = nullptr; // advance the pending ptr until it reaches outgoingId or an entry that has yet to acknowledged while (mReliableOutgoingPendingId < mReliableOutgoingId) { - if (mPhysicalPackets[mReliableOutgoingPendingId % mConfig.maxOutstandingPackets].mDataPtr != NULL) + if (mPhysicalPackets[mReliableOutgoingPendingId % mConfig.maxOutstandingPackets].mDataPtr != nullptr) break; mReliableOutgoingPendingId++; } @@ -855,25 +855,25 @@ void UdpReliableChannel::Ack(udp_int64 reliableId) UdpReliableChannel::IncomingQueueEntry::IncomingQueueEntry() { - mPacket = NULL; + mPacket = nullptr; mMode = UdpReliableChannel::cReliablePacketModeReliable; } UdpReliableChannel::IncomingQueueEntry::~IncomingQueueEntry() { - if (mPacket != NULL) + if (mPacket != nullptr) mPacket->Release(); } UdpReliableChannel::PhysicalPacket::PhysicalPacket() { - mParent = NULL; + mParent = nullptr; } UdpReliableChannel::PhysicalPacket::~PhysicalPacket() { - if (mParent != NULL) + if (mParent != nullptr) mParent->Release(); } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpReliableChannel.h b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpReliableChannel.h index fab02474..033585eb 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpReliableChannel.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpReliableChannel.h @@ -64,7 +64,7 @@ class UdpReliableChannel void ProcessPacket(ReliablePacketMode mode, const udp_uchar *data, int dataLen); bool PullDown(int windowSpaceLeft); void FlushCoalesce(); - void SendCoalesce(const udp_uchar *data, int dataLen, const udp_uchar *data2 = NULL, int dataLen2 = 0); + void SendCoalesce(const udp_uchar *data, int dataLen, const udp_uchar *data2 = nullptr, int dataLen2 = 0); void QueueLogicalPacket(LogicalPacket *packet); UdpReliableConfig mConfig; @@ -138,7 +138,7 @@ inline int UdpReliableChannel::TotalPendingBytes() const inline void UdpReliableChannel::ClearBufferedAck() { - mBufferedAckPtr = NULL; + mBufferedAckPtr = nullptr; } inline udp_int64 UdpReliableChannel::GetReliableOutgoingId(int reliableStamp) const diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/UnicodeCharacterDataMap.h b/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/UnicodeCharacterDataMap.h index 741a6e80..493c5a2d 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/UnicodeCharacterDataMap.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/UnicodeCharacterDataMap.h @@ -122,7 +122,7 @@ namespace Plat_Unicode /** * Find a CharData for the given code point. - * @return null if no CharData exists for this code point + * @return nullptr if no CharData exists for this code point */ inline const CharData * CharDataMap::findCharData (const unicode_char_t code) const diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/utf8.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/utf8.cpp index da8e34e8..57bd0a0d 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/utf8.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/utf8.cpp @@ -87,7 +87,7 @@ int UTF8_convertCharToUTF16( char * ptr , UTF16 * ret ) int UTF8_convertToUTF16( char * ptr , UTF16 * ret, int limit ) { int len = 0; - while (( *ptr != 0 ) && ( len < ( limit - 1 ) ))//we use limit -1 to leave room for the null terminator + while (( *ptr != 0 ) && ( len < ( limit - 1 ) ))//we use limit -1 to leave room for the nullptr terminator { int clen = UTF8_convertCharToUTF16( ptr, ret ); ptr += clen; diff --git a/external/3rd/library/soePlatform/VChatAPI/projects/VChat/VChatAPI/common.cpp b/external/3rd/library/soePlatform/VChatAPI/projects/VChat/VChatAPI/common.cpp index 6076f618..2c07d021 100755 --- a/external/3rd/library/soePlatform/VChatAPI/projects/VChat/VChatAPI/common.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/projects/VChat/VChatAPI/common.cpp @@ -171,37 +171,37 @@ namespace VChatSystem token = strtok((char*)tmpTokenee.c_str(), seps ); - if( token != NULL ) + if( token != nullptr ) { game = token; /* Get next token: */ - token = strtok( NULL, seps ); + token = strtok( nullptr, seps ); } - if( token != NULL ) + if( token != nullptr ) { server = token; /* Get next token: */ - token = strtok( NULL, seps ); + token = strtok( nullptr, seps ); } - if( token != NULL ) + if( token != nullptr ) { name = token; /* Get next token: */ - token = strtok( NULL, seps ); + token = strtok( nullptr, seps ); } - while ( token != NULL ) + while ( token != nullptr ) { name += "."; name += token; /* Get next token: */ - token = strtok( NULL, seps ); + token = strtok( nullptr, seps ); } } @@ -216,29 +216,29 @@ namespace VChatSystem std::string tmpTokenee = userName; token = strtok((char*)tmpTokenee.c_str(), seps ); - if( token != NULL ) + if( token != nullptr ) { server = token; /* Get next token: */ - token = strtok( NULL, seps ); + token = strtok( nullptr, seps ); } - if( token != NULL ) + if( token != nullptr ) { name = token; /* Get next token: */ - token = strtok( NULL, seps ); + token = strtok( nullptr, seps ); } - while ( token != NULL ) + while ( token != nullptr ) { name += "."; name += token; /* Get next token: */ - token = strtok( NULL, seps ); + token = strtok( nullptr, seps ); } } diff --git a/external/3rd/library/soePlatform/VChatAPI/projects/VChat/VChatUnitTest/VChatClient.cpp b/external/3rd/library/soePlatform/VChatAPI/projects/VChat/VChatUnitTest/VChatClient.cpp index 869bf94a..db94c3cd 100755 --- a/external/3rd/library/soePlatform/VChatAPI/projects/VChat/VChatUnitTest/VChatClient.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/projects/VChat/VChatUnitTest/VChatClient.cpp @@ -23,7 +23,7 @@ unsigned VChatClient::GetAccountEx(const std::string &avatarName, { Reset(); - VChatAPI::GetAccount(avatarName, game, world, userID, avatarID, NULL); + VChatAPI::GetAccount(avatarName, game, world, userID, avatarID, nullptr); while(!IsDone() && !HasFailed()) { @@ -69,7 +69,7 @@ unsigned VChatClient::DeactivateVoiceAccount(const std::string &avatarName, { Reset(); - VChatAPI::DeactivateVoiceAccount(avatarName, game, world, NULL); + VChatAPI::DeactivateVoiceAccount(avatarName, game, world, nullptr); while(!IsDone() && !HasFailed()) { @@ -99,7 +99,7 @@ unsigned VChatClient::GetChannelEx( const std::string &channelName, bool persistent) { Reset(); - VChatAPI::GetChannel(channelName, game, server, description, password, limit, persistent, NULL); + VChatAPI::GetChannel(channelName, game, server, description, password, limit, persistent, nullptr); while(!IsDone() && !HasFailed()) { @@ -146,7 +146,7 @@ unsigned VChatClient::GetProximityChannelEx(const std::string &channelName, unsigned distModel) { Reset(); - VChatAPI::GetProximityChannel(channelName, game, server, description, password, limit, persistent, maxRange, clamping, rollOff, maxGain, distModel, NULL); + VChatAPI::GetProximityChannel(channelName, game, server, description, password, limit, persistent, maxRange, clamping, rollOff, maxGain, distModel, nullptr); while(!IsDone() && !HasFailed()) { @@ -183,7 +183,7 @@ unsigned VChatClient::ChannelCommandEx( const std::string &srcUserName, unsigned banTimeout) { Reset(); - VChatAPI::ChannelCommand(srcUserName, destUserName, destChannelAddress, command, banTimeout, NULL); + VChatAPI::ChannelCommand(srcUserName, destUserName, destChannelAddress, command, banTimeout, nullptr); while(!IsDone() && !HasFailed()) { @@ -211,7 +211,7 @@ unsigned VChatClient::ChangePasswordEx(const std::string &channelName, const std::string &password) { Reset(); - VChatAPI::ChangePassword(channelName, game, server, password, NULL); + VChatAPI::ChangePassword(channelName, game, server, password, nullptr); while(!IsDone() && !HasFailed()) { @@ -236,7 +236,7 @@ void VChatClient::OnChangePassword( unsigned track, unsigned VChatClient::GetAllChannelsEx() { Reset(); - VChatAPI::GetAllChannels(NULL); + VChatAPI::GetAllChannels(nullptr); while(!IsDone() && !HasFailed()) { @@ -274,7 +274,7 @@ unsigned VChatClient::DeleteChannelEx(const std::string &channelName, const std::string &server) { Reset(); - VChatAPI::DeleteChannel(channelName, game, server, NULL); + VChatAPI::DeleteChannel(channelName, game, server, nullptr); while(!IsDone() && !HasFailed()) { @@ -301,7 +301,7 @@ unsigned VChatClient::SetBanStatusEx(unsigned userID, unsigned banStatus) { Reset(); - VChatAPI::SetBanStatus(userID, banStatus, NULL); + VChatAPI::SetBanStatus(userID, banStatus, nullptr); while(!IsDone() && !HasFailed()) { @@ -328,7 +328,7 @@ unsigned VChatClient::GetChannelInfoEx( const std::string &channelName, const std::string &server) { Reset(); - VChatAPI::GetChannelInfo(channelName, game, server, NULL); + VChatAPI::GetChannelInfo(channelName, game, server, nullptr); while(!IsDone() && !HasFailed()) { @@ -369,7 +369,7 @@ unsigned VChatClient::GetChannelV2Ex(const std::string &channelName, bool persistent) { Reset(); - VChatAPI::GetChannelV2(channelName, game, server, description, password, limit, persistent, NULL); + VChatAPI::GetChannelV2(channelName, game, server, description, password, limit, persistent, nullptr); while(!IsDone() && !HasFailed()) { @@ -419,7 +419,7 @@ unsigned VChatClient::AddCharacterChannelEx(const unsigned stationID, Reset(); VChatAPI::AddCharacterChannel(stationID, avatarID, characterName, worldName, gameCode, channelType, channelDescription, - password, channelAddress, locale, NULL); + password, channelAddress, locale, nullptr); while(!IsDone() && !HasFailed()) { @@ -449,7 +449,7 @@ unsigned VChatClient::RemoveCharacterChannelEx( const unsigned stationID, { Reset(); VChatAPI::RemoveCharacterChannel(stationID, avatarID, characterName, worldName, - gameCode, channelType, NULL); + gameCode, channelType, nullptr); while(!IsDone() && !HasFailed()) { @@ -477,7 +477,7 @@ unsigned VChatClient::GetCharacterChannelEx(const unsigned stationID, const std::string &gameCode) { Reset(); - VChatAPI::GetCharacterChannel(stationID, characterName, worldName, gameCode, NULL); + VChatAPI::GetCharacterChannel(stationID, characterName, worldName, gameCode, nullptr); while(!IsDone() && !HasFailed()) { diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/api.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/api.cpp index 3af047a2..9c9c8084 100644 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/api.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/api.cpp @@ -45,7 +45,7 @@ namespace API_NAMESPACE //////////////////////////////////////////////////////////////////////////////// CommonAPI::CommonAPI(const char * hostList, const char * failoverHostList, unsigned connectionLimit, unsigned maxMsgSize, unsigned bufferSize) - : mManager(NULL) + : mManager(nullptr) , mHostReconnectTimeout() , mIdleHosts() , mHostMap() @@ -247,7 +247,7 @@ namespace API_NAMESPACE connection->Send((const char*)buffer, size); #endif } - mLastRequestInputTime = time(NULL); + mLastRequestInputTime = time(nullptr); } #ifdef UDP_LIBRARY @@ -466,7 +466,7 @@ namespace API_NAMESPACE RequestMap_t::iterator reqIterator = mRequestMap.find(trackingNumber); bool found = false; - *pUserData = NULL; + *pUserData = nullptr; if (reqIterator != mRequestMap.end()) { TrackedRequest & request = reqIterator->second; @@ -594,7 +594,7 @@ namespace API_NAMESPACE CommonAPI::ApiConnectionInfo * CommonAPI::GetNextUsableConnection() { - ApiConnectionInfo * connectionInfo = NULL; + ApiConnectionInfo * connectionInfo = nullptr; if (!mUsableHosts[0].empty()) { @@ -617,7 +617,7 @@ namespace API_NAMESPACE CommonAPI::ApiConnectionInfo * CommonAPI::FindConnectionInfo(ApiConnection * connection) { // find the connection in the set - ApiConnectionInfo * pInfo = NULL; + ApiConnectionInfo * pInfo = nullptr; ConnectionMap_t::iterator iter; if ( ((iter = mActiveHosts[0].find(connection)) != mActiveHosts[0].end()) || ((iter = mActiveHosts[1].find(connection)) != mActiveHosts[1].end()) ) @@ -777,8 +777,8 @@ namespace API_NAMESPACE mspEnumerationToVersionStringMap = &enumerationToVersionStringMap; } - std::map *VersionMap::mspVersionStringToEnumerationMap = NULL; - std::map *VersionMap::mspEnumerationToVersionStringMap = NULL; + std::map *VersionMap::mspVersionStringToEnumerationMap = nullptr; + std::map *VersionMap::mspEnumerationToVersionStringMap = nullptr; //////////////////////////////////////////////////////////////////////////////// @@ -1009,7 +1009,7 @@ namespace API_NAMESPACE mspLabelToEntryMap = &labelToEntryMap; } - ConfigurationMap::LabelToEntryMap_t *ConfigurationMap::mspLabelToEntryMap = NULL; + ConfigurationMap::LabelToEntryMap_t *ConfigurationMap::mspLabelToEntryMap = nullptr; //////////////////////////////////////////////////////////////////////////////// diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/api.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/api.h index 37512cbd..9cd24094 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/api.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/api.h @@ -58,7 +58,7 @@ namespace API_NAMESPACE typedef std::set TrackingSet_t; struct ApiConnectionInfo { - ApiConnectionInfo(ApiConnection * Connection = NULL) : mConnection(Connection), mIsShuttingDown(false) { } + ApiConnectionInfo(ApiConnection * Connection = nullptr) : mConnection(Connection), mIsShuttingDown(false) { } ApiConnection * mConnection; TrackingSet_t mOutstandingRequests; diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/apiMessages.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/apiMessages.cpp index c38875ab..ae5cdc76 100644 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/apiMessages.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/apiMessages.cpp @@ -253,7 +253,7 @@ namespace API_NAMESPACE Base * Base::Create(unsigned MsgId, StorageVector_t *pStorageVector) { - Base * msg = NULL; + Base * msg = nullptr; if (ms_pClassMap) { std::map::iterator classIter = ms_pClassMap->find(MsgId); @@ -272,7 +272,7 @@ namespace API_NAMESPACE const char * Base::GetMessageName(unsigned msgId) { - const char * requestString = NULL; + const char * requestString = nullptr; if (ms_pClassMap) { std::map::iterator classIter = ms_pClassMap->find(msgId); @@ -287,7 +287,7 @@ namespace API_NAMESPACE const char * Base::GetMessageIDString(unsigned msgId) { - const char * idString = NULL; + const char * idString = nullptr; if (ms_pClassMap) { std::map::iterator classIter = ms_pClassMap->find(msgId); @@ -304,7 +304,7 @@ namespace API_NAMESPACE { static std::map classMap; - if (ms_pClassMap == NULL) { + if (ms_pClassMap == nullptr) { ms_pClassMap = &classMap; } @@ -326,24 +326,24 @@ namespace API_NAMESPACE } Base::DeepPointer::DeepPointer() : - m_ptr(NULL) + m_ptr(nullptr) { } Base::DeepPointer::DeepPointer(const Base & source) : - m_ptr(NULL) + m_ptr(nullptr) { m_ptr = source.Clone(m_storageVector); } Base::DeepPointer::DeepPointer(const Base * source) : - m_ptr(NULL) + m_ptr(nullptr) { m_ptr = source->Clone(m_storageVector); } Base::DeepPointer::DeepPointer(const DeepPointer & source) : - m_ptr(NULL) + m_ptr(nullptr) { if (source.m_ptr) { m_ptr = source->Clone(m_storageVector); } } @@ -364,7 +364,7 @@ namespace API_NAMESPACE { Base *oldPtr = m_ptr; - m_ptr = rhs ? rhs->Clone(m_storageVector) : NULL; + m_ptr = rhs ? rhs->Clone(m_storageVector) : nullptr; if (oldPtr) { oldPtr->~Base(); @@ -377,7 +377,7 @@ namespace API_NAMESPACE { Base *oldPtr = m_ptr; - m_ptr = rhs.m_ptr ? rhs->Clone(m_storageVector) : NULL; + m_ptr = rhs.m_ptr ? rhs->Clone(m_storageVector) : nullptr; if (oldPtr) { oldPtr->~Base(); @@ -396,7 +396,7 @@ namespace API_NAMESPACE return *m_ptr; } - std::map *Base::ms_pClassMap = NULL; + std::map *Base::ms_pClassMap = nullptr; #if defined(PRINTABLE_MESSAGES) || defined(TRACK_READ_WRITE_FAILURES) Basic::Basic() diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/apiMessages.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/apiMessages.h index ef733afb..12b00516 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/apiMessages.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/apiMessages.h @@ -60,7 +60,7 @@ namespace API_NAMESPACE protected: struct DECLSPEC MemberInfo { - MemberInfo(soe::AutoVariableBase *dataIn = NULL, unsigned sizeIn = 1, unsigned versionIn = 0, soe::EVersionEffect effectIn = soe::eNoEffect) + MemberInfo(soe::AutoVariableBase *dataIn = nullptr, unsigned sizeIn = 1, unsigned versionIn = 0, soe::EVersionEffect effectIn = soe::eNoEffect) : data(dataIn) , size(sizeIn) , version(versionIn) @@ -97,8 +97,8 @@ namespace API_NAMESPACE virtual Base * Clone() const; virtual Base * Clone(StorageVector_t &storageVector) const; virtual const char * MessageName() const { return "Base"; } - virtual const char * MessageIDString() const { return "NULL"; } - static Base * Create(unsigned MsgId, StorageVector_t *pStorageVector = NULL); + virtual const char * MessageIDString() const { return "nullptr"; } + static Base * Create(unsigned MsgId, StorageVector_t *pStorageVector = nullptr); static const char * GetMessageName(unsigned msgId); static const char * GetMessageIDString(unsigned msgId); diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/apiPinned.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/apiPinned.cpp index 5a1dd30d..2f72d6e0 100644 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/apiPinned.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/apiPinned.cpp @@ -291,7 +291,7 @@ namespace NAMESPACE if (!mActiveHosts[0].empty()) { // get connection that corresponds to hash index - ApiConnection * connection = NULL; + ApiConnection * connection = nullptr; unsigned hashIndex = hashValue % mActiveHosts[0].size(); unsigned curIndex = 0; for (ConnectionSet_t::iterator it = mActiveHosts[0].begin(); it != mActiveHosts[0].end(); it++, curIndex++) @@ -314,7 +314,7 @@ namespace NAMESPACE else if (!mActiveHosts[1].empty()) { // get connection that corresponds to hash index - ApiConnection * connection = NULL; + ApiConnection * connection = nullptr; unsigned hashIndex = hashValue % mActiveHosts[1].size(); unsigned curIndex = 0; for (ConnectionSet_t::iterator it = mActiveHosts[1].begin(); it != mActiveHosts[1].end(); it++, curIndex++) diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/cmdLine.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/cmdLine.cpp index 8c04219e..9d82c979 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/cmdLine.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/cmdLine.cpp @@ -132,7 +132,7 @@ int CmdLine::SplitLine(int argc, char **argv) bool CmdLine::IsSwitch(const char *pParam) { - if (pParam==NULL) + if (pParam==nullptr) return false; // switches must non-empty @@ -201,7 +201,7 @@ StringType CmdLine::GetSafeArgument(const char *pSwitch, int iIdx, const char *p { StringType sRet; - if (pDefault!=NULL) + if (pDefault!=nullptr) sRet = pDefault; try diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/date.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/date.cpp index 025883cd..0184793d 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/date.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/date.cpp @@ -42,7 +42,7 @@ namespace soe , mSecond(0) { struct tm timeStruct; - struct tm *gotTime = NULL; + struct tm *gotTime = nullptr; #ifdef WIN32 gotTime = gmtime(&src); #else diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/dateUtils.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/dateUtils.h index fecca883..be898b53 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/dateUtils.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/dateUtils.h @@ -144,7 +144,7 @@ namespace soe inline time_t localTimeToGmt(int dstOffsetMinutes = DST_OFFSET_MINUTES_USA) { - time_t localTime = time(NULL); + time_t localTime = time(nullptr); struct tm gt = *(gmtime(&localTime)); struct tm lt = *(localtime(&localTime)); bool isDst = (lt.tm_isdst? true:false); @@ -187,7 +187,7 @@ namespace soe dstOffsetSecs = dstOffsetMS/1000; return retval; } - inline int getGMT(time_t & theTime, const char *id = NULL) + inline int getGMT(time_t & theTime, const char *id = nullptr) { UDate date; UErrorCode ec; diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/genericRateLimitingMechanism.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/genericRateLimitingMechanism.h index 20b16fa1..66934bc1 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/genericRateLimitingMechanism.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/genericRateLimitingMechanism.h @@ -245,7 +245,7 @@ namespace soe template const LimitType * GenericRateLimitingMechanism::GetRateLimit(const FixedKeyType & fixedKey) const { - LimitType const * rateLimit = NULL; + LimitType const * rateLimit = nullptr; typename RateLimitByFixedKeyMap_t::const_iterator limIter = mRateLimits.find(fixedKey); if (limIter != mRateLimits.end()) { @@ -258,7 +258,7 @@ namespace soe template const LimitType * GenericRateLimitingMechanism::GetNextRateLimit(FixedKeyType & fixedKey) const { - LimitType const * rateLimit = NULL; + LimitType const * rateLimit = nullptr; typename RateLimitByFixedKeyMap_t::const_iterator limIter = mRateLimits.upper_bound(fixedKey); if (limIter != mRateLimits.end()) { @@ -272,7 +272,7 @@ namespace soe template const CounterType * GenericRateLimitingMechanism::GetRateCounter(const FixedKeyType & fixedKey, const ArbitraryKeyType & arbitraryKey) const { - const CounterType * counter = NULL; + const CounterType * counter = nullptr; typename RateCounterByKeyPairMap_t::const_iterator counterIter = mRateCounters.find(KeyPair(fixedKey, arbitraryKey)); if (counterIter != mRateCounters.end()) { counter = &(counterIter->second->mCounter); diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/hashtable.hpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/hashtable.hpp index 00f9cd75..4fc2ace9 100644 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/hashtable.hpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/hashtable.hpp @@ -174,11 +174,11 @@ template class HashTable bool Remove(T& obj, int hashValue); void Reset(); // removes all entries from the table - T *FindFirst(int hashValue) const; // returns NULL if not found - T *FindNext(T *prevResult) const; // returns NULL if not found + T *FindFirst(int hashValue) const; // returns nullptr if not found + T *FindNext(T *prevResult) const; // returns nullptr if not found - T *WalkFirst() const; // returns NULL if not found - T *WalkNext(T *prevResult) const; // returns NULL if not found + T *WalkFirst() const; // returns nullptr if not found + T *WalkNext(T *prevResult) const; // returns nullptr if not found void Resize(int hashSize); // the actual hash size will be rounded up to the next larger prime number (very slow, not recommended) void GetStatistics(HashTableStatistics *stats) const; @@ -200,7 +200,7 @@ template class HashTable template HashTable::HashTable(int hashSize) { - mTable = NULL; + mTable = nullptr; mTableSize = 0; mEntryCount = 0; mStatUsedSlots = 0; @@ -220,9 +220,9 @@ template void HashTable::Insert(T& obj, int hashValue) entry->hashValue = hashValue; int spot = ((unsigned)hashValue) % mTableSize; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) { - entry->nextEntry = NULL; + entry->nextEntry = nullptr; mTable[spot] = entry; mStatUsedSlots++; } @@ -239,14 +239,14 @@ template bool HashTable::Remove(T& obj, int hashValue) int spot = ((unsigned)hashValue) % mTableSize; HashEntry* next = mTable[spot]; HashEntry** prev = &mTable[spot]; - while (next != NULL) + while (next != nullptr) { if (next->obj == obj && next->hashValue == hashValue) { *prev = next->nextEntry; delete next; mEntryCount--; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) mStatUsedSlots--; return(true); break; @@ -263,17 +263,17 @@ template void HashTable::Reset() for (int spot = 0; spot < mTableSize; spot++) { HashEntry *curr = mTable[spot]; - if (curr != NULL) + if (curr != nullptr) { mStatUsedSlots--; - while (curr != NULL) + while (curr != nullptr) { HashEntry *next = curr->nextEntry; delete curr; mEntryCount--; curr = next; } - mTable[spot] = NULL; + mTable[spot] = nullptr; } } } @@ -281,13 +281,13 @@ template void HashTable::Reset() template T *HashTable::FindFirst(int hashValue) const { HashEntry *entry = mTable[((unsigned)hashValue) % mTableSize]; - while (entry != NULL) + while (entry != nullptr) { if (entry->hashValue == hashValue) return(&entry->obj); entry = entry->nextEntry; } - return(NULL); + return(nullptr); } template T *HashTable::FindNext(T *prevResult) const @@ -295,13 +295,13 @@ template T *HashTable::FindNext(T *prevResult) const HashEntry *entry = (HashEntry *)(((char *)prevResult) - offsetof(HashEntry, obj)); int hashValue = entry->hashValue; entry = entry->nextEntry; - while (entry != NULL) + while (entry != nullptr) { if (entry->hashValue == hashValue) return(&entry->obj); entry = entry->nextEntry; } - return(NULL); + return(nullptr); } template T *HashTable::WalkFirst() const @@ -309,10 +309,10 @@ template T *HashTable::WalkFirst() const for (int bucket = 0; bucket < mTableSize; bucket++) { HashEntry *entry = mTable[bucket]; - if (entry != NULL) + if (entry != nullptr) return(&entry->obj); } - return(NULL); + return(nullptr); } template T *HashTable::WalkNext(T *prevResult) const @@ -321,17 +321,17 @@ template T *HashTable::WalkNext(T *prevResult) const int bucket = ((unsigned)entry->hashValue) % mTableSize; entry = entry->nextEntry; - if (entry != NULL) + if (entry != nullptr) return(&entry->obj); bucket++; // go onto next bucket for (; bucket < mTableSize; bucket++) { HashEntry *entry = mTable[bucket]; - if (entry != NULL) + if (entry != nullptr) return(&entry->obj); } - return(NULL); + return(nullptr); } template void HashTable::Resize(int hashSize) @@ -351,16 +351,16 @@ template void HashTable::Resize(int hashSize) for (int i = 0; i < oldSize; i++) { HashEntry* next = oldTable[i]; - while (next != NULL) + while (next != nullptr) { HashEntry* hold = next; next = next->nextEntry; // insert hold into new table int spot = ((unsigned)hold->hashValue) % mTableSize; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) { - hold->nextEntry = NULL; + hold->nextEntry = nullptr; mTable[spot] = hold; mStatUsedSlots++; } @@ -414,11 +414,11 @@ template class ObjectHashTable bool Remove(T obj, int hashValue); void Reset(); // removes all entries from the table - T FindFirst(int hashValue) const; // returns NULL if not found - T FindNext(T prevResult) const; // returns NULL if not found + T FindFirst(int hashValue) const; // returns nullptr if not found + T FindNext(T prevResult) const; // returns nullptr if not found - T WalkFirst() const; // returns NULL if not found - T WalkNext(T prevResult) const; // returns NULL if not found + T WalkFirst() const; // returns nullptr if not found + T WalkNext(T prevResult) const; // returns nullptr if not found void Resize(int hashSize); // the actual hash size will be rounded up to the next larger prime number (very slow, not recommended) void GetStatistics(HashTableStatistics *stats) const; @@ -433,7 +433,7 @@ template class ObjectHashTable template ObjectHashTable::ObjectHashTable(int hashSize) { - mTable = NULL; + mTable = nullptr; mTableSize = 0; mEntryCount = 0; mStatUsedSlots = 0; @@ -451,9 +451,9 @@ template void ObjectHashTable::Insert(T obj, int hashValue) obj->mHashValue = hashValue; int spot = ((unsigned)hashValue) % mTableSize; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) { - obj->mHashNextEntry = NULL; + obj->mHashNextEntry = nullptr; mTable[spot] = obj; mStatUsedSlots++; } @@ -470,14 +470,14 @@ template bool ObjectHashTable::Remove(T obj, int hashValue) int spot = ((unsigned)hashValue) % mTableSize; T next = mTable[spot]; T *prev = &mTable[spot]; - while (next != NULL) + while (next != nullptr) { if (next == obj) { *prev = (T)next->mHashNextEntry; - next->mHashNextEntry = NULL; + next->mHashNextEntry = nullptr; mEntryCount--; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) mStatUsedSlots--; return(true); break; @@ -494,16 +494,16 @@ template void ObjectHashTable::Reset() for (int spot = 0; spot < mTableSize; spot++) { T curr = mTable[spot]; - if (curr != NULL) + if (curr != nullptr) { - while (curr != NULL) + while (curr != nullptr) { T next = (T)curr->mHashNextEntry; - curr->mHashNextEntry = NULL; + curr->mHashNextEntry = nullptr; mEntryCount--; curr = next; } - mTable[spot] = NULL; + mTable[spot] = nullptr; mStatUsedSlots--; } } @@ -512,13 +512,13 @@ template void ObjectHashTable::Reset() template T ObjectHashTable::FindFirst(int hashValue) const { T entry = mTable[((unsigned)hashValue) % mTableSize]; - while (entry != NULL) + while (entry != nullptr) { if (entry->mHashValue == hashValue) return(entry); entry = (T)entry->mHashNextEntry; } - return(NULL); + return(nullptr); } template T ObjectHashTable::FindNext(T prevResult) const @@ -526,13 +526,13 @@ template T ObjectHashTable::FindNext(T prevResult) const T entry = prevResult; int hashValue = entry->mHashValue; entry = (T)entry->mHashNextEntry; - while (entry != NULL) + while (entry != nullptr) { if (entry->mHashValue == hashValue) return(entry); entry = (T)entry->mHashNextEntry; } - return(NULL); + return(nullptr); } template T ObjectHashTable::WalkFirst() const @@ -540,10 +540,10 @@ template T ObjectHashTable::WalkFirst() const for (int bucket = 0; bucket < mTableSize; bucket++) { T entry = mTable[bucket]; - if (entry != NULL) + if (entry != nullptr) return(entry); } - return(NULL); + return(nullptr); } template T ObjectHashTable::WalkNext(T prevResult) const @@ -552,17 +552,17 @@ template T ObjectHashTable::WalkNext(T prevResult) const int bucket = ((unsigned)entry->mHashValue) % mTableSize; entry = (T)entry->mHashNextEntry; - if (entry != NULL) + if (entry != nullptr) return(entry); bucket++; // go onto next bucket for (; bucket < mTableSize; bucket++) { entry = mTable[bucket]; - if (entry != NULL) + if (entry != nullptr) return(entry); } - return(NULL); + return(nullptr); } template void ObjectHashTable::Resize(int hashSize) @@ -582,16 +582,16 @@ template void ObjectHashTable::Resize(int hashSize) for (int i = 0; i < oldSize; i++) { T next = oldTable[i]; - while (next != NULL) + while (next != nullptr) { T hold = next; next = (T)next->mHashNextEntry; // insert hold into new table int spot = ((unsigned)hold->mHashValue) % mTableSize; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) { - hold->mHashNextEntry = NULL; + hold->mHashNextEntry = nullptr; mTable[spot] = hold; mStatUsedSlots++; } diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/log.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/log.cpp index e14aee9a..72cac84a 100644 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/log.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/log.cpp @@ -115,7 +115,7 @@ Logger::Logger(const char *programName, void Logger::LoggerInit(const char *programName) { char buf[1024]; - FILE *logDir = NULL; + FILE *logDir = nullptr; if (0 != (m_logType & eUseLocalFile)) { @@ -124,13 +124,13 @@ void Logger::LoggerInit(const char *programName) { cmkdir(m_dirPrefix.c_str(), 0755); } - else if(logDir != NULL) + else if(logDir != nullptr) { fclose(logDir); } tm now; - time_t t = time(NULL); + time_t t = time(nullptr); LOGGER_GET_CURR_TIME(now, t); @@ -148,7 +148,7 @@ void Logger::LoggerInit(const char *programName) { cmkdir(buf, 0755); } - else if(logDir != NULL) + else if(logDir != nullptr) { fclose(logDir); } @@ -330,7 +330,7 @@ void Logger::logSimple(unsigned logenum, int level, const char *message) { return; } - time_t t = time(NULL); + time_t t = time(nullptr); LogInfo *info = (*iter).second; if(level >= info->level) { @@ -400,7 +400,7 @@ void Logger::logSimpleWithSys(unsigned logenum, unsigned priority, int level, co { return; } - time_t t = time(NULL); + time_t t = time(nullptr); LogInfo *info = (*iter).second; if(level >= info->level) @@ -482,7 +482,7 @@ void Logger::logWithSys(unsigned logenum, unsigned priority, int level, const ch { return; } - time_t t = time(NULL); + time_t t = time(nullptr); LogInfo *info = (*iter).second; if(level >= info->level) @@ -562,7 +562,7 @@ void Logger::vlogWithSys(unsigned logenum, unsigned priority, int level, const c { return; } - time_t t = time(NULL); + time_t t = time(nullptr); LogInfo *info = (*iter).second; if(level >= info->level) @@ -630,14 +630,14 @@ void Logger::vlog(unsigned logenum, int level, const char *message, va_list argp void Logger::rollDate(time_t t) { char buf[80]; - FILE *logDir = NULL; + FILE *logDir = nullptr; logDir = fopen(m_dirPrefix.c_str(), "r+"); if(errno == ENOENT) { cmkdir(m_dirPrefix.c_str(), 0755); } - else if(logDir != NULL) + else if(logDir != nullptr) { fclose(logDir); } @@ -653,7 +653,7 @@ void Logger::rollDate(time_t t) { cmkdir(buf, 0755); } - else if(logDir != NULL) + else if(logDir != nullptr) { fclose(logDir); } @@ -737,7 +737,7 @@ void Logger::rollLog(LogInfo *logInfo) { std::string newLogName; char timeStampBuffer[256]; - time_t t = time(NULL); + time_t t = time(nullptr); tm now; int r; int nTries = 10; diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorAPI.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorAPI.cpp index 214e33be..cb3a87d0 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorAPI.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorAPI.cpp @@ -48,7 +48,7 @@ MonitorObject::~MonitorObject() if( mConnection ) { - mConnection->SetHandler(NULL); + mConnection->SetHandler(nullptr); mConnection->Disconnect(); mConnection->Release(); } @@ -72,10 +72,10 @@ char hold[214]; UdpConnection::DisconnectReasonText( mConnection->GetOtherSideDisconnectReason())); } } - mConnection->SetHandler(NULL); + mConnection->SetHandler(nullptr); mConnection->Disconnect(); mConnection->Release(); - mConnection = NULL; + mConnection = nullptr; } } @@ -91,10 +91,10 @@ void MonitorObject::OnRoutePacket(UdpConnection * con, const uchar *data, int d simpleMessage msg(data); - if( con == NULL ) + if( con == nullptr ) { if( mbprint) - fprintf(stderr,"MONITOR API: MonitorObject.OnRoutePacket, recived a NULL connection.?\n"); + fprintf(stderr,"MONITOR API: MonitorObject.OnRoutePacket, recived a nullptr connection.?\n"); return; } @@ -120,7 +120,7 @@ void MonitorObject::OnRoutePacket(UdpConnection * con, const uchar *data, int d if( mHierarchySent == true ) { if( mMonitorData->processElementsRequest(con,mSequence,(char *)&data[6],dataLen,mlastUpdateTime )) - mlastUpdateTime = time(NULL); + mlastUpdateTime = time(nullptr); break; } // NOTE: if mHierarchy is not sent or changed, then send it. @@ -258,7 +258,7 @@ MonitorManager::MonitorManager(char *configFile, CMonitorData *_gamedata, UdpMan { mManager = manager; mbprint = _bprint; - passString = NULL; + passString = nullptr; mMonitorData = _gamedata; mObjectCount = 0; @@ -288,7 +288,7 @@ void MonitorManager::OnConnectRequest(UdpConnection *con) { if( con ) { - con->SetHandler(NULL); + con->SetHandler(nullptr); con->Disconnect(); con->Release(); } @@ -310,7 +310,7 @@ void MonitorManager::GiveTime() // check if the monitor object is no longer connected for (int i = 0; i < mObjectCount; i++) { - if( mObject[i]->mConnection == NULL || + if( mObject[i]->mConnection == nullptr || mObject[i]->mConnection->GetStatus() == UdpConnection::cStatusDisconnected ) { MonitorObject *o = mObject[i]; @@ -342,7 +342,7 @@ int x; char buffer[1024]; FILE *fp = fopen(filename,"r"); - if (fp == NULL) + if (fp == nullptr) { fprintf(stderr,"Monitor API: could not open %s file\nTHIS FILE IS REQUIRED.\n", filename); return false; @@ -364,7 +364,7 @@ char buffer[1024]; x = 0; while(!feof(fp)) { - if (fgets( buffer, 1023, fp) != NULL) { + if (fgets( buffer, 1023, fp) != nullptr) { // get rid of '\n' and '\r' for comparisons strtok(buffer,"\r\n"); @@ -402,17 +402,17 @@ CMonitorAPI::CMonitorAPI( char *configFile, unsigned short Port, bool _bprint , mbprint = _bprint; mPort = Port; - mAddress = NULL; + mAddress = nullptr; if( address ) { mAddress = (char *)malloc(strlen(address)+1); strcpy(mAddress,address); } - if( mang == NULL ) + if( mang == nullptr ) { UdpManager::Params params; - params.handler = NULL; + params.handler = nullptr; params.maxConnections = CONNECTION_MAX; params.outgoingBufferSize = 1000000; params.noDataTimeout = 130000; diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorAPI.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorAPI.h index fa60d698..60fa8509 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorAPI.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorAPI.h @@ -72,13 +72,13 @@ class CMonitorAPI { public: - CMonitorAPI( char *configFile, unsigned short Port, bool _bprint = false , char * address = NULL, UdpManager * mang = NULL ); + CMonitorAPI( char *configFile, unsigned short Port, bool _bprint = false , char * address = nullptr, UdpManager * mang = nullptr ); ~CMonitorAPI(); void Update(); - void add( const char *label, int id, int ping = MON_PING_5MIN, char *des = NULL ); + void add( const char *label, int id, int ping = MON_PING_5MIN, char *des = nullptr ); void setDescription( int Id, const char *Description ) ; diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorData.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorData.cpp index 38614bbf..0d3c66d5 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorData.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorData.cpp @@ -55,7 +55,7 @@ CMonitorData::CMonitorData() { m_sequence = 1; - m_buffer = NULL; + m_buffer = nullptr; m_nbuffer = 0; m_count = 0; m_max = ELEMENT_START_VALUE; @@ -85,7 +85,7 @@ void CMonitorData::resize_buffer(int new_size) { char *temp; - if( m_buffer != NULL ) + if( m_buffer != nullptr ) { temp = m_buffer; m_buffer = new char[ new_size]; @@ -252,7 +252,7 @@ char *p; { if( get_bit(mark,x) == 0 ) { - if( m_data[x].discription != NULL ) + if( m_data[x].discription != nullptr ) snprintf(tmp, sizeof(tmp), "%d,%s|", m_data[x].id, m_data[x].discription); else snprintf(tmp, sizeof(tmp), "%d, |", m_data[x].id); @@ -282,7 +282,7 @@ char *p; { flag = 2; - if( m_data[x].discription != NULL ) + if( m_data[x].discription != nullptr ) snprintf(tmp, sizeof(tmp), "%d,%s|", m_data[x].id, m_data[x].discription); else snprintf(tmp, sizeof(tmp), "%d, |", m_data[x].id); @@ -338,7 +338,7 @@ int x; //******* Discription ****** delete [] m_data[x].discription; - m_data[x].discription = NULL; + m_data[x].discription = nullptr; if( des ) { @@ -387,10 +387,10 @@ int x; for(x=0;x= x ) return NULL; return m_data[x].discription;} + char *getDescription(int x){ if( m_ndata >= x ) return nullptr; return m_data[x].discription;} int pingValue(int p); void set(int Id, int value); void remove(int Id); diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/priority.hpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/priority.hpp index 19f34ab3..516619db 100644 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/priority.hpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/priority.hpp @@ -37,12 +37,12 @@ template class PriorityQueue PriorityQueue(int queueSize); ~PriorityQueue(); - T* Top(); // returns NULL if queue is empty - T* TopRemove(); // returns NULL if queue is empty - T* TopRemove(P priority); // removes item from queue if it has a lower priority value, otherwise return NULL + T* Top(); // returns nullptr if queue is empty + T* TopRemove(); // returns nullptr if queue is empty + T* TopRemove(P priority); // removes item from queue if it has a lower priority value, otherwise return nullptr T* Add(T* entry, P priority); // reprioritizes if already in queue, returns entry always T* Remove(T* entry); // returns entry always (even if it was not in the queue) - P *GetPriority(T* entry); // returns NULL if entry is not in the queue + P *GetPriority(T* entry); // returns nullptr if entry is not in the queue int QueueUsed(); // returns how many entries are in the queue protected: struct QueueEntry @@ -88,14 +88,14 @@ template PriorityQueue::~PriorityQueue() template T* PriorityQueue::Top() { if (mQueueEnd == 0) - return(NULL); + return(nullptr); return(mQueue[0].entry); } template T* PriorityQueue::TopRemove() { if (mQueueEnd == 0) - return(NULL); + return(nullptr); T* top = mQueue[0].entry; Remove(top); return(top); @@ -105,14 +105,14 @@ template T* PriorityQueue::TopRemove(P priority) { if (mQueueEnd > 0 && mQueue[0].priority <= priority) return(Remove(mQueue[0].entry)); - return(NULL); + return(nullptr); } template P* PriorityQueue::GetPriority(T* entry) { if (entry->mPriorityQueuePosition >= 0) return(&mQueue[entry->mPriorityQueuePosition].priority); - return(NULL); + return(nullptr); } template T* PriorityQueue::Add(T* entry, P priority) @@ -121,7 +121,7 @@ template T* PriorityQueue::Add(T* entry, P priorit { // not in queue, so add it to the bottom if (mQueueEnd >= mQueueSize) - return(NULL); + return(nullptr); mQueue[mQueueEnd].entry = entry; mQueue[mQueueEnd].priority = priority; mQueue[mQueueEnd].entry->mPriorityQueuePosition = mQueueEnd; diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/stringutils.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/stringutils.cpp index be0a4376..07c4bcc2 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/stringutils.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/stringutils.cpp @@ -78,12 +78,12 @@ namespace soe if (pos == std::string::npos) { // tok not found take the whole thing - if (dest != NULL) { dest->assign(*base);} + if (dest != nullptr) { dest->assign(*base);} base->clear(); return; } - if (dest != NULL) {dest->assign(base->substr(0,pos));} + if (dest != nullptr) {dest->assign(base->substr(0,pos));} base->erase(0,pos + tok.length()); } diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/stringutils.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/stringutils.h index f994210c..f70facc5 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/stringutils.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/stringutils.h @@ -21,7 +21,7 @@ namespace soe void trim(std::string& str); void crack(std::string * dest, std::string * base, const std::string& tok); void inline crack(std::string& dest, std::string& base, const std::string& tok) {crack(&dest, &base, tok);} - void inline crack(std::string& base, const std::string& tok) {crack(NULL, &base, tok);} + void inline crack(std::string& base, const std::string& tok) {crack(nullptr, &base, tok);} class lowerCaseString { diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/substringSearchTree.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/substringSearchTree.h index 9acfcea7..ebe0729d 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/substringSearchTree.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/substringSearchTree.h @@ -156,15 +156,15 @@ private: class letterNode { public: - letterNode() : mpData(NULL), mpChildren(NULL), mNumChildren(0) { } - letterNode(const letter_t & letter) : mLetter(letter), mpData(NULL), mpChildren(NULL), mNumChildren(0) { } + letterNode() : mpData(nullptr), mpChildren(nullptr), mNumChildren(0) { } + letterNode(const letter_t & letter) : mLetter(letter), mpData(nullptr), mpChildren(nullptr), mNumChildren(0) { } ~letterNode(); - inline bool hasData() const { return (mpData != NULL); } + inline bool hasData() const { return (mpData != nullptr); } inline data_t & getData() { return *mpData; } inline const data_t & getData() const { return *mpData; } inline void setData(const data_t & data) { if (mpData) { *mpData = data; } else { mpData = new data_t(data); } } - inline void removeData() { delete mpData; mpData = NULL; } + inline void removeData() { delete mpData; mpData = nullptr; } letterNode * get(letter_t index) const; bool put(letter_t index, letterNode ** tree); @@ -182,7 +182,7 @@ private: inline letter_t & letter() { return mLetter; } inline const letter_t & letter() const { return mLetter; } - inline bool hasNoChildren() const { return (mpChildren == NULL) || (mNumChildren == 0); } + inline bool hasNoChildren() const { return (mpChildren == nullptr) || (mNumChildren == 0); } private: letter_t mLetter; @@ -272,9 +272,9 @@ bool stringTree::seek(iter_t & start, const iter_t & stop, typ position.mBranch.push_back(&mRoot); } - const letterNode * pnode = (start != stop) ? position.mBranch.back() : NULL; + const letterNode * pnode = (start != stop) ? position.mBranch.back() : nullptr; - for (; (start != stop) && ((pnode = pnode->get(*start)) != NULL); start++) + for (; (start != stop) && ((pnode = pnode->get(*start)) != nullptr); start++) { position.mBranch.push_back(pnode); if (pnode->hasData()) { @@ -298,9 +298,9 @@ bool stringTree::seek(iter_t & start, const iter_t & stop, typ position.mBranch.push_back(&mRoot); } - const letterNode * pnode = (start != stop) ? position.mBranch.back() : NULL; + const letterNode * pnode = (start != stop) ? position.mBranch.back() : nullptr; - for (; (start != stop) && ((pnode = pnode->get(*start)) != NULL); start++) + for (; (start != stop) && ((pnode = pnode->get(*start)) != nullptr); start++) { position.mBranch.push_back(pnode); if (pnode->hasData()) { @@ -441,7 +441,7 @@ stringTree::letterNode::~letterNode() template typename stringTree::letterNode * stringTree::letterNode::get(letter_t index) const { - letterNode * tree = NULL; + letterNode * tree = nullptr; letterNode * end = mpChildren + mNumChildren; letterNode * place = std::lower_bound(mpChildren, mpChildren + mNumChildren, index); @@ -495,10 +495,10 @@ bool stringTree::letterNode::take(letter_t index, bool dealloc mNumChildren--; if (!mNumChildren) { deallocate = true; } - letterNode * children = NULL; + letterNode * children = nullptr; if (deallocate) { - children = mNumChildren ? new letterNode[mNumChildren] : NULL; + children = mNumChildren ? new letterNode[mNumChildren] : nullptr; } else { children = mpChildren; } @@ -536,7 +536,7 @@ void stringTree::const_iterator::getKey(string_t & key) const template typename stringTree::letterNode * stringTree::letterNode::firstChild() const { - letterNode * child = NULL; + letterNode * child = nullptr; if (mpChildren) { child = mpChildren; @@ -548,7 +548,7 @@ typename stringTree::letterNode * stringTree template typename stringTree::letterNode * stringTree::letterNode::lastChild() const { - letterNode * child = NULL; + letterNode * child = nullptr; if (mpChildren) { child = mpChildren + mNumChildren - 1; @@ -560,7 +560,7 @@ typename stringTree::letterNode * stringTree template typename stringTree::letterNode * stringTree::letterNode::nextChild(const letterNode * child) const { - letterNode * next = NULL; + letterNode * next = nullptr; if (mpChildren) { size_t index = child - mpChildren; @@ -577,7 +577,7 @@ typename stringTree::letterNode * stringTree template typename stringTree::letterNode * stringTree::letterNode::previousChild(const letterNode * child) const { - letterNode * previous = NULL; + letterNode * previous = nullptr; if (mpChildren) { size_t index = child - mpChildren; @@ -623,13 +623,13 @@ template bool stringTree::const_iterator::advance() { bool wentForward = false; - const letterNode * terminal = NULL; - const letterNode * penultimate = NULL; - const letterNode * next = NULL; + const letterNode * terminal = nullptr; + const letterNode * penultimate = nullptr; + const letterNode * next = nullptr; if (mBranch.back()->hasNoChildren()) { // go forward - while ((mBranch.size() >= 2) && (next == NULL)) + while ((mBranch.size() >= 2) && (next == nullptr)) { penultimate = mBranch[mBranch.size() - 2]; terminal = mBranch[mBranch.size() - 1]; @@ -654,9 +654,9 @@ template bool stringTree::const_iterator::retreat() { bool wentBack = false; - const letterNode * terminal = NULL; - const letterNode * penultimate = NULL; - const letterNode * next = NULL; + const letterNode * terminal = nullptr; + const letterNode * penultimate = nullptr; + const letterNode * next = nullptr; if (mBranch.size() >= 2) { // go backwards @@ -670,7 +670,7 @@ bool stringTree::const_iterator::retreat() mBranch.pop_back(); } // go to leaf - for (; next != NULL; next = next->lastChild()) + for (; next != nullptr; next = next->lastChild()) { mBranch.push_back(next); if (next->hasData() && next->hasNoChildren()) { @@ -724,9 +724,9 @@ template void stringTree::setBegin() const { mBegin.mBranch.clear(); - const letterNode * leaf = NULL; + const letterNode * leaf = nullptr; - for (leaf = &mRoot; leaf != NULL; leaf = leaf->firstChild()) + for (leaf = &mRoot; leaf != nullptr; leaf = leaf->firstChild()) { mBegin.mBranch.push_back(leaf); if (leaf->hasData()) { @@ -782,7 +782,7 @@ template template const data_t * stringTree::finder::data() const { - const data_t * pData = NULL; + const data_t * pData = nullptr; if (mDictionaryIter != mDictionary.end()) { pData = &(*mDictionaryIter); diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/thread.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/thread.cpp index af797230..7115e242 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/thread.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/thread.cpp @@ -120,10 +120,10 @@ Event::Event(bool signaled) : mEvent() { #ifdef WIN32 - mEvent = CreateEvent(NULL, FALSE, signaled ? TRUE : FALSE, NULL); + mEvent = CreateEvent(nullptr, FALSE, signaled ? TRUE : FALSE, nullptr); #else - pthread_mutex_init(&mMutex, NULL); - pthread_cond_init(&mCond, NULL); + pthread_mutex_init(&mMutex, nullptr); + pthread_cond_init(&mCond, nullptr); #endif } @@ -162,7 +162,7 @@ bool Event::Wait(unsigned timeoutMilliseconds) { struct timeval now; struct timespec abs_timeout; - gettimeofday(&now, NULL); + gettimeofday(&now, nullptr); abs_timeout.tv_sec = now.tv_sec + timeoutMilliseconds/1000; abs_timeout.tv_nsec = now.tv_usec * 1000 + (timeoutMilliseconds%1000)*1000000; abs_timeout.tv_sec += abs_timeout.tv_nsec / 1000000000; @@ -198,10 +198,10 @@ EventLock::EventLock(bool locked) : mEvent() { #ifdef WIN32 - mEvent = CreateEvent(NULL, TRUE, locked ? FALSE : TRUE, NULL); + mEvent = CreateEvent(nullptr, TRUE, locked ? FALSE : TRUE, nullptr); #else - pthread_mutex_init(&mMutex, NULL); - pthread_cond_init(&mCond, NULL); + pthread_mutex_init(&mMutex, nullptr); + pthread_cond_init(&mCond, nullptr); #endif } @@ -243,7 +243,7 @@ bool EventLock::Wait(unsigned timeoutMilliseconds) { struct timeval now; struct timespec abs_timeout; - gettimeofday(&now, NULL); + gettimeofday(&now, nullptr); abs_timeout.tv_sec = now.tv_sec + timeoutMilliseconds/1000; abs_timeout.tv_nsec = now.tv_usec * 1000 + (timeoutMilliseconds%1000)*1000000; abs_timeout.tv_sec += abs_timeout.tv_nsec / 1000000000; diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/utf8.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/utf8.cpp index ce6b8f16..ba5cc0d7 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/utf8.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/utf8.cpp @@ -81,7 +81,7 @@ namespace soe size_t UTF8_convertToUTF16( char * ptr , UTF16 * ret, size_t limit ) { size_t len = 0; - while (( *ptr != 0 ) && ( len < ( limit - 1 ) ))//we use limit -1 to leave room for the null terminator + while (( *ptr != 0 ) && ( len < ( limit - 1 ) ))//we use limit -1 to leave room for the nullptr terminator { size_t clen = UTF8_convertCharToUTF16( ptr, ret ); ptr += clen; diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/IPAddress.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/IPAddress.h index f6d5f886..03b59e8d 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/IPAddress.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/IPAddress.h @@ -32,7 +32,7 @@ public: * @brief Used to retreive the the dot-notation represenatatiion of this address. * * @param buffer A pointer to the buffer to place the ip address into. - * Must be at least 17 characters long, will be null terminated. + * Must be at least 17 characters long, will be nullptr terminated. * * @return A pointer to the buffer the address was placed into. */ diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpBlockAllocator.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpBlockAllocator.cpp index 6d476d78..b7da0f27 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpBlockAllocator.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpBlockAllocator.cpp @@ -6,7 +6,7 @@ namespace NAMESPACE #endif TcpBlockAllocator::TcpBlockAllocator(const unsigned initSize, const unsigned initCount) -: m_freeHead(NULL), m_blockCount(initCount), m_blockSize(initSize), m_numAvailBlocks(0) +: m_freeHead(nullptr), m_blockCount(initCount), m_blockSize(initSize), m_numAvailBlocks(0) { realloc(); } @@ -33,7 +33,7 @@ data_block *TcpBlockAllocator::getBlock() tmp = m_freeHead; m_freeHead = m_freeHead->m_next; - tmp->m_next = NULL; + tmp->m_next = nullptr; m_numAvailBlocks--; return(tmp); } @@ -56,7 +56,7 @@ void TcpBlockAllocator::returnBlock(data_block *b) void TcpBlockAllocator::realloc() { - data_block *tmp = NULL, *cursor = NULL; + data_block *tmp = nullptr, *cursor = nullptr; tmp = new data_block; m_numAvailBlocks++; cursor = tmp; diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpConnection.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpConnection.cpp index 42329552..a41ad0df 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpConnection.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpConnection.cpp @@ -11,28 +11,28 @@ namespace NAMESPACE //used when want to open new connection with this socket TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, const IPAddress &destIP, unsigned short destPort, unsigned timeout) -: m_nextConnection(NULL), - m_prevConnection(NULL), +: m_nextConnection(nullptr), + m_prevConnection(nullptr), m_socket(INVALID_SOCKET), - m_nextKeepAliveConnection(NULL), - m_prevKeepAliveConnection(NULL), + m_nextKeepAliveConnection(nullptr), + m_prevKeepAliveConnection(nullptr), m_aliveListId(tcpManager->m_aliveList.m_listID), - m_nextRecvDataConnection(NULL), - m_prevRecvDataConnection(NULL), + m_nextRecvDataConnection(nullptr), + m_prevRecvDataConnection(nullptr), m_recvDataListId(tcpManager->m_dataList.m_listID), m_manager(tcpManager), m_status(StatusNegotiating), - m_handler(NULL), + m_handler(nullptr), m_destIP(destIP), m_destPort(destPort), m_refCount(0), m_sendAllocator(sendAlloc), - m_head(NULL), - m_tail(NULL), + m_head(nullptr), + m_tail(nullptr), m_bytesRead(0), m_bytesNeeded(0), m_params(params), - m_recvBuff(NULL), + m_recvBuff(nullptr), m_connectTimeout(timeout), m_connectTimer(), m_wasConRemovedFromMgr(false), @@ -94,28 +94,28 @@ TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAllo //used when server mode creates new connection object representing a connect request TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, SOCKET socket, const IPAddress &destIP, unsigned short destPort) -: m_nextConnection(NULL), - m_prevConnection(NULL), +: m_nextConnection(nullptr), + m_prevConnection(nullptr), m_socket(socket), - m_nextKeepAliveConnection(NULL), - m_prevKeepAliveConnection(NULL), + m_nextKeepAliveConnection(nullptr), + m_prevKeepAliveConnection(nullptr), m_aliveListId(tcpManager->m_aliveList.m_listID), - m_nextRecvDataConnection(NULL), - m_prevRecvDataConnection(NULL), + m_nextRecvDataConnection(nullptr), + m_prevRecvDataConnection(nullptr), m_recvDataListId(tcpManager->m_dataList.m_listID), m_manager(tcpManager), m_status(StatusConnected), - m_handler(NULL), + m_handler(nullptr), m_destIP(destIP), m_destPort(destPort), m_refCount(0), m_sendAllocator(sendAlloc), - m_head(NULL), - m_tail(NULL), + m_head(nullptr), + m_tail(nullptr), m_bytesRead(0), m_bytesNeeded(0), m_params(params), - m_recvBuff(NULL), + m_recvBuff(nullptr), m_connectTimeout(0), m_connectTimer(), m_wasConRemovedFromMgr(false) @@ -206,7 +206,7 @@ int TcpConnection::finishConnect() t.tv_sec = 0; t.tv_usec = 0; - int err = select(m_socket + 1, NULL, &wrSet, NULL, &t); + int err = select(m_socket + 1, nullptr, &wrSet, nullptr, &t); if (err == 0) { @@ -303,7 +303,7 @@ TcpConnection::~TcpConnection() { delete [] m_recvBuff; - while(m_head != NULL) + while(m_head != nullptr) { data_block *tmp = m_head; m_head = m_head->m_next; @@ -327,22 +327,22 @@ void TcpConnection::Send(const char *data, unsigned int dataLen) { m_aliveListId = m_manager->m_keepAliveList.m_listID; - if (m_prevKeepAliveConnection != NULL) + if (m_prevKeepAliveConnection != nullptr) m_prevKeepAliveConnection->m_nextKeepAliveConnection = m_nextKeepAliveConnection; - if (m_nextKeepAliveConnection != NULL) + if (m_nextKeepAliveConnection != nullptr) m_nextKeepAliveConnection->m_prevKeepAliveConnection = m_prevKeepAliveConnection; if (m_manager->m_keepAliveList.m_beginList == this) m_manager->m_keepAliveList.m_beginList = m_nextKeepAliveConnection; m_nextKeepAliveConnection = m_manager->m_aliveList.m_beginList; - m_prevKeepAliveConnection = NULL; - if (m_manager->m_aliveList.m_beginList != NULL) + m_prevKeepAliveConnection = nullptr; + if (m_manager->m_aliveList.m_beginList != nullptr) m_manager->m_aliveList.m_beginList->m_prevKeepAliveConnection = this; m_manager->m_aliveList.m_beginList = this; } - data_block *work = NULL; + data_block *work = nullptr; // this connection has no send buffer. Get a block if(!m_tail) @@ -471,16 +471,16 @@ int TcpConnection::processIncoming() { m_recvDataListId = m_manager->m_noDataList.m_listID; - if (m_prevRecvDataConnection != NULL) + if (m_prevRecvDataConnection != nullptr) m_prevRecvDataConnection->m_nextRecvDataConnection = m_nextRecvDataConnection; - if (m_nextRecvDataConnection != NULL) + if (m_nextRecvDataConnection != nullptr) m_nextRecvDataConnection->m_prevRecvDataConnection = m_prevRecvDataConnection; if (m_manager->m_noDataList.m_beginList == this) m_manager->m_noDataList.m_beginList = m_nextRecvDataConnection; m_nextRecvDataConnection = m_manager->m_dataList.m_beginList; - m_prevRecvDataConnection = NULL; - if (m_manager->m_dataList.m_beginList != NULL) + m_prevRecvDataConnection = nullptr; + if (m_manager->m_dataList.m_beginList != nullptr) m_manager->m_dataList.m_beginList->m_prevRecvDataConnection = this; m_manager->m_dataList.m_beginList = this; } @@ -626,7 +626,7 @@ int TcpConnection::processOutgoing() int sendError = 1; - // If m_head is not null, then this connection has something to send + // If m_head is not nullptr, then this connection has something to send if(m_head) diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpConnection.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpConnection.h index 36a41e9f..efe2d031 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpConnection.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpConnection.h @@ -50,7 +50,7 @@ public: * connection is disconnected, you simply need to derive your class * (multiply if necessary) from TcpConnectionHandler, then you can use * this method to set the object the TcpConnection will call as appropriate. - * default = NULL (no callbacks made) + * default = nullptr (no callbacks made) * * @param handler The object which will be called for notifications. */ diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpManager.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpManager.cpp index 53105f3d..6f31e9ae 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpManager.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpManager.cpp @@ -57,14 +57,14 @@ TcpManager::TcpParams::TcpParams(const TcpParams &cpy) } TcpManager::TcpManager(const TcpParams ¶ms) -: m_handler(NULL), - m_keepAliveList(NULL, 1), - m_aliveList(NULL, 2), - m_noDataList(NULL, 1), - m_dataList(NULL, 2), +: m_handler(nullptr), + m_keepAliveList(nullptr, 1), + m_aliveList(nullptr, 2), + m_noDataList(nullptr, 1), + m_dataList(nullptr, 2), m_params(params), m_refCount(1), - m_connectionList(NULL), + m_connectionList(nullptr), m_connectionListCount(0), m_socket(INVALID_SOCKET), m_boundAsServer(false), @@ -103,7 +103,7 @@ TcpManager::~TcpManager() close(m_socket); #endif } - while (m_connectionList != NULL) + while (m_connectionList != nullptr) { TcpConnection *con = m_connectionList; con->AddRef(); @@ -179,7 +179,7 @@ bool TcpManager::BindAsServer() { struct hostent * lphp; lphp = gethostbyname(m_params.bindAddress); - if (lphp != NULL) + if (lphp != nullptr) addr_loc.sin_addr.s_addr = ((struct in_addr *)(lphp->h_addr))->s_addr; } else @@ -204,7 +204,7 @@ bool TcpManager::BindAsServer() TcpConnection *TcpManager::acceptClient() { - TcpConnection *newConn = NULL; + TcpConnection *newConn = nullptr; if (m_boundAsServer && m_connectionListCount < m_params.maxConnections) { @@ -218,7 +218,7 @@ TcpConnection *TcpManager::acceptClient() { newConn = new TcpConnection(this, &m_allocator, m_params, sock, IPAddress(addr.sin_addr.s_addr), ntohs(addr.sin_port)); addNewConnection(newConn); - if (m_handler != NULL) + if (m_handler != nullptr) { m_handler->OnConnectRequest(newConn); } @@ -243,8 +243,8 @@ SOCKET TcpManager::getMaxFD() if (m_boundAsServer) maxfd = m_socket+1; - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) { next = con->m_nextConnection; if (con->GetStatus() != TcpConnection::StatusDisconnected && con->m_socket > maxfd) @@ -258,8 +258,8 @@ SOCKET TcpManager::getMaxFD() TcpConnection *TcpManager::getConnection(SOCKET fd) { - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) { next = con->m_nextConnection; if (con->m_socket == fd) @@ -268,7 +268,7 @@ TcpConnection *TcpManager::getConnection(SOCKET fd) } } //if get here ,couldn't find it - return NULL; + return nullptr; } bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendTimePerConnection, unsigned maxRecvTimePerConnection) @@ -290,8 +290,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT { // Send output from last heartbeat - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) { con->AddRef(); if (next) next->Release(); @@ -358,7 +358,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT tmpfds = m_permfds; timeout.tv_sec = 0; timeout.tv_usec = 0; - int cnt = select(maxfd, &tmpfds, NULL, NULL, &timeout); // blocks for timeout + int cnt = select(maxfd, &tmpfds, nullptr, nullptr, &timeout); // blocks for timeout if (cnt > 0) @@ -384,8 +384,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //process incoming client messages if (maxRecvTimePerConnection != 0) { - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) { con->AddRef(); if (next) next->Release(); @@ -450,8 +450,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT pollfds[0].events |= POLLIN; } - TcpConnection *next = NULL; - for (TcpConnection *con = m_connectionList ; con != NULL ; con = next, idx++) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next, idx++) { next = con->m_nextConnection; pollfds[idx].fd = con->m_socket; @@ -491,7 +491,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT } //process regular msg(s) - if (con == NULL) + if (con == nullptr) { close(pollfds[idx].fd); continue; @@ -523,7 +523,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT }//if(pollfds[... else if (pollfds[idx].revents & POLLHUP) { - if (con == NULL) + if (con == nullptr) { close(pollfds[idx].fd); continue; @@ -541,21 +541,21 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //now process any keepalives, if time to do that if (m_params.keepAliveDelay > 0 && m_keepAliveTimer.isDone(m_params.keepAliveDelay)) { - TcpConnection *next = NULL; - for (TcpConnection *con = m_keepAliveList.m_beginList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_keepAliveList.m_beginList ; con != nullptr ; con = next) { con->AddRef(); if (next) next->Release(); next = con->m_nextKeepAliveConnection; if (next) next->AddRef(); - con->Send(NULL, 0); //note: this request will move the connection from the keepAliveList to the aliveList + con->Send(nullptr, 0); //note: this request will move the connection from the keepAliveList to the aliveList con->Release(); } //now move the complete alive list over to the keepalive list to reset those timers m_keepAliveList.m_beginList = m_aliveList.m_beginList; - m_aliveList.m_beginList = NULL; + m_aliveList.m_beginList = nullptr; //switch id's for those connections that were in the alive list last go - around int tmpID = m_aliveList.m_listID; @@ -569,8 +569,8 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //now process any noDataCons, if time to do that if (m_params.noDataTimeout > 0 && m_noDataTimer.isDone(m_params.noDataTimeout)) { - TcpConnection *next = NULL; - for (TcpConnection *con = m_noDataList.m_beginList ; con != NULL ; con = next) + TcpConnection *next = nullptr; + for (TcpConnection *con = m_noDataList.m_beginList ; con != nullptr ; con = next) { con->AddRef(); if (next) next->Release(); @@ -584,7 +584,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT //now move the complete data list over to the nodata list to reset those timers m_noDataList.m_beginList = m_dataList.m_beginList; - m_dataList.m_beginList = NULL; + m_dataList.m_beginList = nullptr; //switch id's for those connections that were in the data list last go - around int tmpID = m_dataList.m_listID; @@ -606,17 +606,17 @@ TcpConnection *TcpManager::EstablishConnection(const char *serverAddress, unsign { //can't open outgoing connections when in server mode // use a different TcpManager to do that - return NULL; + return nullptr; } if (m_connectionListCount >= m_params.maxConnections) - return(NULL); + return(nullptr); // get server address unsigned long address = inet_addr(serverAddress); if (address == INADDR_NONE) { - if (m_dnsMap[serverAddress].timeout >= time(NULL)) + if (m_dnsMap[serverAddress].timeout >= time(nullptr)) { address = m_dnsMap[serverAddress].addr; } @@ -624,12 +624,12 @@ TcpConnection *TcpManager::EstablishConnection(const char *serverAddress, unsign { struct hostent * lphp; lphp = gethostbyname(serverAddress); - if (lphp == NULL) - return(NULL); + if (lphp == nullptr) + return(nullptr); address = ((struct in_addr *)(lphp->h_addr))->s_addr; m_dnsMap[serverAddress].addr = address; - m_dnsMap[serverAddress].timeout = time(NULL)+DNS_TIMEOUT; + m_dnsMap[serverAddress].timeout = time(nullptr)+DNS_TIMEOUT; } } IPAddress destIP(address); @@ -649,22 +649,22 @@ void TcpManager::addNewConnection(TcpConnection *con) FD_SET(con->m_socket, &m_permfds); #endif con->m_nextConnection = m_connectionList; - con->m_prevConnection = NULL; - if (m_connectionList != NULL) + con->m_prevConnection = nullptr; + if (m_connectionList != nullptr) m_connectionList->m_prevConnection = con; m_connectionList = con; m_connectionListCount++; con->m_nextKeepAliveConnection = m_aliveList.m_beginList; - con->m_prevKeepAliveConnection = NULL; - if (m_aliveList.m_beginList != NULL) + con->m_prevKeepAliveConnection = nullptr; + if (m_aliveList.m_beginList != nullptr) m_aliveList.m_beginList->m_prevKeepAliveConnection = con; m_aliveList.m_beginList = con; con->m_aliveListId = m_keepAliveList.m_listID;//start it out thinking it's already in the alive list, since it is con->m_nextRecvDataConnection = m_dataList.m_beginList; - con->m_prevRecvDataConnection = NULL; - if (m_dataList.m_beginList != NULL) + con->m_prevRecvDataConnection = nullptr; + if (m_dataList.m_beginList != nullptr) m_dataList.m_beginList->m_prevRecvDataConnection = con; m_dataList.m_beginList = con; con->m_recvDataListId = m_noDataList.m_listID;//start it out thinking it's already in the data list, since it is @@ -682,40 +682,40 @@ void TcpManager::removeConnection(TcpConnection *con) FD_CLR(con->m_socket, &m_permfds); } #endif - if (con->m_prevConnection != NULL) + if (con->m_prevConnection != nullptr) con->m_prevConnection->m_nextConnection = con->m_nextConnection; - if (con->m_nextConnection != NULL) + if (con->m_nextConnection != nullptr) con->m_nextConnection->m_prevConnection = con->m_prevConnection; if (m_connectionList == con) m_connectionList = con->m_nextConnection; - con->m_nextConnection = NULL; - con->m_prevConnection = NULL; + con->m_nextConnection = nullptr; + con->m_prevConnection = nullptr; - if (con->m_prevKeepAliveConnection != NULL) + if (con->m_prevKeepAliveConnection != nullptr) con->m_prevKeepAliveConnection->m_nextKeepAliveConnection = con->m_nextKeepAliveConnection; - if (con->m_nextKeepAliveConnection != NULL) + if (con->m_nextKeepAliveConnection != nullptr) con->m_nextKeepAliveConnection->m_prevKeepAliveConnection = con->m_prevKeepAliveConnection; if (m_aliveList.m_beginList == con) m_aliveList.m_beginList = con->m_nextKeepAliveConnection; else if (m_keepAliveList.m_beginList == con) m_keepAliveList.m_beginList = con->m_nextKeepAliveConnection; - con->m_nextKeepAliveConnection = NULL; - con->m_prevKeepAliveConnection = NULL; + con->m_nextKeepAliveConnection = nullptr; + con->m_prevKeepAliveConnection = nullptr; - if (con->m_prevRecvDataConnection != NULL) + if (con->m_prevRecvDataConnection != nullptr) con->m_prevRecvDataConnection->m_nextRecvDataConnection = con->m_nextRecvDataConnection; - if (con->m_nextRecvDataConnection != NULL) + if (con->m_nextRecvDataConnection != nullptr) con->m_nextRecvDataConnection->m_prevRecvDataConnection = con->m_prevRecvDataConnection; if (m_dataList.m_beginList == con) m_dataList.m_beginList = con->m_nextRecvDataConnection; else if (m_noDataList.m_beginList == con) m_noDataList.m_beginList = con->m_nextRecvDataConnection; - con->m_nextRecvDataConnection = NULL; - con->m_prevRecvDataConnection = NULL; + con->m_nextRecvDataConnection = nullptr; + con->m_prevRecvDataConnection = nullptr; diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpManager.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpManager.h index b2192dff..e9b9e176 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpManager.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpManager.h @@ -168,7 +168,7 @@ public: * simply need to derive your class (multiply if necessary) from TcpManagerHandler, then you can use * this method to set the object the TcpManager will call as appropriate. The TcpConnection object * also has a handler mechanism that replaces the other callback functions below, see TcpConnection::SetHandler - * default = NULL (no callbacks made) + * default = nullptr (no callbacks made) * * @param handler The object which will be called for manager related notifications. */ @@ -223,7 +223,7 @@ public: * the connect-complete callback to be called if the connection is succesfull. * * @return A pointer to a TcpConnection object. - * NULL if the manager object has exceeded its maximum number of connections + * nullptr if the manager object has exceeded its maximum number of connections * or if the serverAddress cannot be resolved to an IP address. */ TcpConnection *EstablishConnection(const char *serverAddress, unsigned short serverPort, unsigned timeout = 0); diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpLibrary.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpLibrary.cpp index f8221166..f86f5d7b 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpLibrary.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpLibrary.cpp @@ -150,7 +150,7 @@ UdpIpAddress::UdpIpAddress(unsigned int ip) char *UdpIpAddress::GetAddress(char *buffer) const { - assert(buffer != NULL); + assert(buffer != nullptr); struct sockaddr_in addr_serverUDP; addr_serverUDP.sin_addr.s_addr = mIp; @@ -163,7 +163,7 @@ char *UdpIpAddress::GetAddress(char *buffer) const ///////////////////////////////////////////////////////////////////////////////////////////////////// UdpManager::Params::Params() { - handler = NULL; + handler = nullptr; outgoingBufferSize = 64 * 1024; incomingBufferSize = 64 * 1024; packetHistoryMax = 100; @@ -265,7 +265,7 @@ UdpManager::UdpManager(const UdpManager::Params *params) mParams.maxDataHoldSize = udpMin(mParams.maxDataHoldSize, mParams.maxRawPacketSize); mParams.packetHistoryMax = udpMax(1, mParams.packetHistoryMax); mPacketHistoryPosition = 0; - mPassThroughData = NULL; + mPassThroughData = nullptr; typedef PacketHistoryEntry *PacketHistoryEntryPtr; mPacketHistory = new PacketHistoryEntryPtr[mParams.packetHistoryMax]; @@ -286,17 +286,17 @@ UdpManager::UdpManager(const UdpManager::Params *params) mUdpSocket = INVALID_SOCKET; mConnectionListCount = 0; - mConnectionList = NULL; + mConnectionList = nullptr; mPoolCreated = 0; mPoolAvailable = 0; - mPoolAvailableRoot = NULL; - mPoolCreatedRoot = NULL; + mPoolAvailableRoot = nullptr; + mPoolCreatedRoot = nullptr; mWrappedCreated = 0; mWrappedAvailable = 0; - mWrappedAvailableRoot = NULL; - mWrappedCreatedRoot = NULL; + mWrappedAvailableRoot = nullptr; + mWrappedCreatedRoot = nullptr; for (i = 0; i < mParams.pooledPacketInitial && i < mParams.pooledPacketMax; i++) { @@ -306,16 +306,16 @@ UdpManager::UdpManager(const UdpManager::Params *params) lp->Release(); } - mSimulateQueueStart = NULL; - mSimulateQueueEnd = NULL; + mSimulateQueueStart = nullptr; + mSimulateQueueEnd = nullptr; mSimulateNextOutgoingTime = 0; mSimulateNextIncomingTime = 0; mSimulateQueueBytes = 0; - mDisconnectPendingList = NULL; + mDisconnectPendingList = nullptr; if (mParams.avoidPriorityQueue) - mPriorityQueue = NULL; + mPriorityQueue = nullptr; else mPriorityQueue = new PriorityQueue(mParams.maxConnections); @@ -346,14 +346,14 @@ UdpManager::~UdpManager() // first we need to tell all the pooled packets we have created that they can no longer check themselves back into use // when they are released PooledLogicalPacket *walk = mPoolCreatedRoot; - while (walk != NULL) + while (walk != nullptr) { - walk->mUdpManager = NULL; + walk->mUdpManager = nullptr; walk = walk->mCreatedNext; } // next release the ones we have in our available pool walk = mPoolAvailableRoot; - while (walk != NULL) + while (walk != nullptr) { PooledLogicalPacket *hold = walk; walk = walk->mAvailableNext; @@ -366,14 +366,14 @@ UdpManager::~UdpManager() // next we need to tell all the warpped packets we have created that they can no longer check themselves back into use // when they are released WrappedLogicalPacket *walk = mWrappedCreatedRoot; - while (walk != NULL) + while (walk != nullptr) { - walk->mUdpManager = NULL; + walk->mUdpManager = nullptr; walk = walk->mCreatedNext; } // next release the ones we have in our available pool walk = mWrappedAvailableRoot; - while (walk != NULL) + while (walk != nullptr) { WrappedLogicalPacket *hold = walk; walk = walk->mAvailableNext; @@ -383,7 +383,7 @@ UdpManager::~UdpManager() // next thing we must do is tell all the connections to disconnect (which severs their link to this dying manager) // this has to be done first since they will call back into us and have themselves removed from our connection-list/priority-queue/etc - while (mConnectionList != NULL) + while (mConnectionList != nullptr) { mConnectionList->InternalDisconnect(0, UdpConnection::cDisconnectReasonManagerDeleted); // the above call ended up calling us back and removing them from our connection list, so now mConnectionList is pointing to the next entry @@ -391,7 +391,7 @@ UdpManager::~UdpManager() } // release any objects that were pending disconnection - while (mDisconnectPendingList != NULL) + while (mDisconnectPendingList != nullptr) { UdpConnection *next = mDisconnectPendingList->mDisconnectPendingNextConnection; mDisconnectPendingList->Release(); @@ -416,7 +416,7 @@ UdpManager::~UdpManager() } delete[] mPacketHistory; - while (mSimulateQueueStart != NULL) + while (mSimulateQueueStart != nullptr) { SimulateQueueEntry *entry = mSimulateQueueStart; mSimulateQueueStart = entry->mNext; @@ -529,12 +529,12 @@ void UdpManager::ProcessDisconnectPending() { UdpConnection *entry = mDisconnectPendingList; UdpConnection **prev = &mDisconnectPendingList; - while (entry != NULL) + while (entry != nullptr) { if (entry->GetStatus() == UdpConnection::cStatusDisconnected) { *prev = entry->mDisconnectPendingNextConnection; - entry->mDisconnectPendingNextConnection = NULL; + entry->mDisconnectPendingNextConnection = nullptr; entry->Release(); entry = *prev; } @@ -548,19 +548,19 @@ void UdpManager::ProcessDisconnectPending() void UdpManager::RemoveConnection(UdpConnection *con) { - assert(con != NULL); // attemped to remove a NULL connection object + assert(con != nullptr); // attemped to remove a nullptr connection object // note: it's a bug to Remove a connection object that is already removed...should never be able to happen. mConnectionListCount--; - if (con->mPrevConnection != NULL) + if (con->mPrevConnection != nullptr) con->mPrevConnection->mNextConnection = con->mNextConnection; - if (con->mNextConnection != NULL) + if (con->mNextConnection != nullptr) con->mNextConnection->mPrevConnection = con->mPrevConnection; if (mConnectionList == con) mConnectionList = con->mNextConnection; - con->mNextConnection = NULL; - con->mPrevConnection = NULL; - if (mPriorityQueue != NULL) + con->mNextConnection = nullptr; + con->mPrevConnection = nullptr; + if (mPriorityQueue != nullptr) mPriorityQueue->Remove(con); mAddressHashTable->Remove(con, AddressHashValue(con->mIp, con->mPort)); @@ -569,11 +569,11 @@ void UdpManager::RemoveConnection(UdpConnection *con) void UdpManager::AddConnection(UdpConnection *con) { - assert(con != NULL); // attemped to add a NULL connection object + assert(con != nullptr); // attemped to add a nullptr connection object con->mNextConnection = mConnectionList; - con->mPrevConnection = NULL; - if (mConnectionList != NULL) + con->mPrevConnection = nullptr; + if (mConnectionList != nullptr) mConnectionList->mPrevConnection = con; mConnectionList = con; mConnectionListCount++; @@ -586,7 +586,7 @@ void UdpManager::FlushAllMultiBuffer() { AddRef(); UdpConnection *cur = mConnectionList; - while (cur != NULL) + while (cur != nullptr) { cur->FlushMultiBuffer(); cur = cur->mNextConnection; @@ -609,7 +609,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) { PacketHistoryEntry *e = ActualReceive(); - if (e == NULL) + if (e == nullptr) { mLastEmptySocketBufferStamp = UdpMisc::Clock(); break; @@ -637,7 +637,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) if (giveConnectionsTime) { - if (mPriorityQueue != NULL) + if (mPriorityQueue != nullptr) { // give time to everybody in the priority-queue that needs it UdpMisc::ClockStamp curPriority = UdpMisc::Clock(); @@ -655,7 +655,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) for (;;) { UdpConnection *top = mPriorityQueue->TopRemove(curPriority); - if (top == NULL) + if (top == nullptr) break; top->AddRef(); top->GiveTime(); @@ -668,7 +668,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) { // give time to everybody UdpConnection *cur = mConnectionList; - while (cur != NULL) + while (cur != nullptr) { cur->GiveTime(); cur = cur->mNextConnection; @@ -678,7 +678,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) ProcessDisconnectPending(); } - if (mSimulateQueueStart != NULL && UdpMisc::Clock() >= mSimulateNextOutgoingTime) + if (mSimulateQueueStart != nullptr && UdpMisc::Clock() >= mSimulateNextOutgoingTime) { SimulateQueueEntry *entry = mSimulateQueueStart; mSimulateQueueStart = mSimulateQueueStart->mNext; @@ -686,7 +686,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) ActualSendHelper(entry->mData, entry->mDataLen, entry->mIp, entry->mPort); UdpConnection *con = AddressGetConnection(entry->mIp, entry->mPort); - if (con != NULL) + if (con != nullptr) con->mSimulateQueueBytes -= entry->mDataLen; mSimulateQueueBytes -= entry->mDataLen; delete entry; @@ -699,11 +699,11 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) UdpConnection *UdpManager::EstablishConnection(const char *serverAddress, int serverPort, int timeout) { assert(serverPort != 0); // can't connect to no port - assert(serverAddress != NULL); + assert(serverAddress != nullptr); assert(serverAddress[0] != 0); if (mConnectionListCount >= mParams.maxConnections) - return(NULL); + return(nullptr); // get server address unsigned long address = inet_addr(serverAddress); @@ -711,16 +711,16 @@ UdpConnection *UdpManager::EstablishConnection(const char *serverAddress, int se { struct hostent * lphp; lphp = gethostbyname(serverAddress); - if (lphp == NULL) - return(NULL); + if (lphp == nullptr) + return(nullptr); address = ((struct in_addr *)(lphp->h_addr))->s_addr; } UdpIpAddress destIp(address); // first, see if we already have a connection object managing this ip/port, if we do, then fail UdpConnection *con = AddressGetConnection(destIp, serverPort); - if (con != NULL) - return(NULL); + if (con != nullptr) + return(nullptr); return(new UdpConnection(this, destIp, serverPort, timeout)); } @@ -733,7 +733,7 @@ void UdpManager::KeepUntilDisconnected(UdpConnection *con) void UdpManager::GetStats(UdpManagerStatistics *stats) const { - assert(stats != NULL); + assert(stats != nullptr); *stats = mManagerStats; stats->poolAvailable = mPoolAvailable; stats->poolCreated = mPoolCreated; @@ -748,10 +748,10 @@ void UdpManager::ResetStats() void UdpManager::DumpPacketHistory(const char *filename) const { - assert(filename != NULL); + assert(filename != nullptr); assert(filename[0] != 0); FILE *file = fopen(filename, "wt"); - if (file != NULL) + if (file != nullptr) { // dump history of packets... for (int i = 0; i < mParams.packetHistoryMax; i++) @@ -797,7 +797,7 @@ int UdpManager::GetLocalPort() const UdpManager::PacketHistoryEntry *UdpManager::ActualReceive() { if (mParams.simulateIncomingByteRate > 0 && UdpMisc::Clock() < mSimulateNextIncomingTime) - return(NULL); + return(nullptr); struct sockaddr_in addr_from; socklen_t sf = sizeof(addr_from); @@ -807,7 +807,7 @@ UdpManager::PacketHistoryEntry *UdpManager::ActualReceive() if (res != SOCKET_ERROR) { if (mParams.simulateIncomingLossPercent > 0 && ((rand() % 100) < mParams.simulateIncomingLossPercent)) - return(NULL); // packet, what packet? + return(nullptr); // packet, what packet? if (mParams.simulateIncomingByteRate > 0) mSimulateNextIncomingTime = UdpMisc::Clock() + (res * 1000 / mParams.simulateIncomingByteRate); @@ -832,7 +832,7 @@ UdpManager::PacketHistoryEntry *UdpManager::ActualReceive() UdpIpAddress ip = UdpIpAddress(addr_from.sin_addr.s_addr); int port = (int)ntohs(addr_from.sin_port); UdpConnection *con = AddressGetConnection(ip, port); - if (con != NULL) + if (con != nullptr) { con->AddRef(); con->PortUnreachable(); @@ -852,7 +852,7 @@ UdpManager::PacketHistoryEntry *UdpManager::ActualReceive() } #endif } - return(NULL); + return(nullptr); } void UdpManager::ProcessIcmpErrors() @@ -880,7 +880,7 @@ void UdpManager::ProcessIcmpErrors() struct cmsghdr * cmsg; if(CMSG_FIRSTHDR(&msgh)) { - for(cmsg = CMSG_FIRSTHDR(&msgh); cmsg != NULL; cmsg = CMSG_NXTHDR(&msgh, cmsg)) + for(cmsg = CMSG_FIRSTHDR(&msgh); cmsg != nullptr; cmsg = CMSG_NXTHDR(&msgh, cmsg)) { if(cmsg->cmsg_level == SOL_IP && cmsg->cmsg_type == IP_RECVERR) { @@ -894,7 +894,7 @@ void UdpManager::ProcessIcmpErrors() UdpIpAddress ip = UdpIpAddress(msg_name.sin_addr.s_addr); int port = (int)htons(msg_name.sin_port); UdpConnection *con = AddressGetConnection(ip, port); - if (con != NULL) + if (con != nullptr) { con->AddRef(); con->PortUnreachable(); @@ -923,7 +923,7 @@ void UdpManager::ActualSend(const uchar *data, int dataLen, UdpIpAddress ip, int { // simulating outgoing byte-rate, so queue it up for sending later UdpConnection *con = AddressGetConnection(ip, port); - if (con != NULL) + if (con != nullptr) { if (mParams.simulateDestinationOverloadLevel > 0 && con->mSimulateQueueBytes + dataLen > mParams.simulateDestinationOverloadLevel) return; // no room, packet gets lost @@ -931,17 +931,17 @@ void UdpManager::ActualSend(const uchar *data, int dataLen, UdpIpAddress ip, int if (mParams.simulateOutgoingOverloadLevel > 0 && mSimulateQueueBytes + dataLen > mParams.simulateOutgoingOverloadLevel) return; // no room, packet gets lost - if (con != NULL) + if (con != nullptr) con->mSimulateQueueBytes += dataLen; mSimulateQueueBytes += dataLen; SimulateQueueEntry *entry = new SimulateQueueEntry(data, dataLen, ip, port); - if (mSimulateQueueStart != NULL) + if (mSimulateQueueStart != nullptr) mSimulateQueueEnd->mNext = entry; else mSimulateQueueStart = entry; mSimulateQueueEnd = entry; - mSimulateQueueEnd->mNext = NULL; + mSimulateQueueEnd->mNext = nullptr; return; } ActualSendHelper(data, dataLen, ip, port); @@ -964,7 +964,7 @@ void UdpManager::ActualSendHelper(const uchar *data, int dataLen, UdpIpAddress i // flag connection to terminate itself for port-unreachable error on next give time // we need to flag it instead of actually terminating it to prevent callbacks from occuring during application sends UdpConnection *con = AddressGetConnection(ip, port); - if (con != NULL) + if (con != nullptr) con->FlagPortUnreachable(); return; } @@ -1002,7 +1002,7 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) UdpConnection *con = AddressGetConnection(e->mIp, e->mPort); - if (con == NULL) + if (con == nullptr) { // packet coming from an unknown ip/port // if it is a connection request packet, then establish a new connection object to reply to it @@ -1012,7 +1012,7 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) if (mConnectionListCount >= mParams.maxConnections) return; // can't handle any more connections, so ignore this request entirely - if (mParams.handler != NULL) + if (mParams.handler != nullptr) { UdpConnection *newcon = new UdpConnection(this, e); mParams.handler->OnConnectRequest(newcon); @@ -1040,7 +1040,7 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) int encryptCode = UdpMisc::GetValue32(ptr); UdpConnection *con = ConnectCodeGetConnection(connectCode); - if (con != NULL) + if (con != nullptr) { if (mParams.allowAddressRemapping || con->mIp == e->mIp) { @@ -1090,25 +1090,25 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) UdpConnection *UdpManager::AddressGetConnection(UdpIpAddress ip, int port) const { UdpConnection *found = static_cast(mAddressHashTable->FindFirst(AddressHashValue(ip, port))); - while (found != NULL) + while (found != nullptr) { if (found->mIp == ip && found->mPort == port) return(found); found = static_cast(mAddressHashTable->FindNext(found)); } - return(NULL); + return(nullptr); } UdpConnection *UdpManager::ConnectCodeGetConnection(int connectCode) const { UdpConnection *found = static_cast(mConnectCodeHashTable->FindFirst(connectCode)); - while (found != NULL) + while (found != nullptr) { if (found->mConnectCode == connectCode) return(found); found = static_cast(mConnectCodeHashTable->FindNext(found)); } - return(NULL); + return(nullptr); } WrappedLogicalPacket *UdpManager::WrappedBorrow(const LogicalPacket *lp) @@ -1132,7 +1132,7 @@ WrappedLogicalPacket *UdpManager::WrappedBorrow(const LogicalPacket *lp) void UdpManager::WrappedCreated(WrappedLogicalPacket *wp) { wp->mCreatedNext = mWrappedCreatedRoot; - if (mWrappedCreatedRoot != NULL) + if (mWrappedCreatedRoot != nullptr) mWrappedCreatedRoot->mCreatedPrev = wp; mWrappedCreatedRoot = wp; mWrappedCreated++; @@ -1140,11 +1140,11 @@ void UdpManager::WrappedCreated(WrappedLogicalPacket *wp) void UdpManager::WrappedDestroyed(WrappedLogicalPacket *wp) { - if (wp->mCreatedNext != NULL) + if (wp->mCreatedNext != nullptr) { wp->mCreatedNext->mCreatedPrev = wp->mCreatedPrev; } - if (wp->mCreatedPrev != NULL) + if (wp->mCreatedPrev != nullptr) { wp->mCreatedPrev->mCreatedNext = wp->mCreatedNext; } @@ -1154,9 +1154,9 @@ void UdpManager::WrappedDestroyed(WrappedLogicalPacket *wp) mWrappedCreatedRoot = wp->mCreatedNext; } - wp->mCreatedPrev = NULL; - wp->mCreatedNext = NULL; - wp->mUdpManager = NULL; + wp->mCreatedPrev = nullptr; + wp->mCreatedNext = nullptr; + wp->mUdpManager = nullptr; mWrappedCreated--; } @@ -1191,7 +1191,7 @@ LogicalPacket *UdpManager::CreatePacket(const void *data, int dataLen, const voi void UdpManager::PoolCreated(PooledLogicalPacket *packet) { packet->mCreatedNext = mPoolCreatedRoot; - if (mPoolCreatedRoot != NULL) + if (mPoolCreatedRoot != nullptr) mPoolCreatedRoot->mCreatedPrev = packet; mPoolCreatedRoot = packet; mPoolCreated++; @@ -1199,11 +1199,11 @@ void UdpManager::PoolCreated(PooledLogicalPacket *packet) void UdpManager::PoolDestroyed(PooledLogicalPacket *packet) { - if (packet->mCreatedNext != NULL) + if (packet->mCreatedNext != nullptr) { packet->mCreatedNext->mCreatedPrev = packet->mCreatedPrev; } - if (packet->mCreatedPrev != NULL) + if (packet->mCreatedPrev != nullptr) { packet->mCreatedPrev->mCreatedNext = packet->mCreatedNext; } @@ -1213,9 +1213,9 @@ void UdpManager::PoolDestroyed(PooledLogicalPacket *packet) mPoolCreatedRoot = packet->mCreatedNext; } - packet->mCreatedPrev = NULL; - packet->mCreatedNext = NULL; - packet->mUdpManager = NULL; + packet->mCreatedPrev = nullptr; + packet->mCreatedNext = nullptr; + packet->mUdpManager = nullptr; mPoolCreated--; } @@ -1290,7 +1290,7 @@ void UdpConnection::Init(UdpManager *udpManager, UdpIpAddress destIp, int destPo mLastClockSyncTime = 0; mDataHoldTime = 0; mGettingTime = false; - mHandler = NULL; + mHandler = nullptr; mOtherSideProtocolVersion = 0; mNoDataTimeout = mUdpManager->mParams.noDataTimeout; @@ -1299,13 +1299,13 @@ void UdpConnection::Init(UdpManager *udpManager, UdpIpAddress destIp, int destPo mMultiBufferData = new uchar[mUdpManager->mParams.maxRawPacketSize]; mMultiBufferPtr = mMultiBufferData; - mDisconnectPendingNextConnection = NULL; - mNextConnection = NULL; - mPrevConnection = NULL; + mDisconnectPendingNextConnection = nullptr; + mNextConnection = nullptr; + mPrevConnection = nullptr; mIcmpErrorRetryStartStamp = 0; // when the timer started for ICMP error retry delay (gets reset on a successful packet receive) mPortRemapRequestStartStamp = 0; - mEncryptXorBuffer = NULL; + mEncryptXorBuffer = nullptr; mEncryptExpansionBytes = 0; mOrderedCountOutgoing = 0; mOrderedCountOutgoing2 = 0; @@ -1316,7 +1316,7 @@ void UdpConnection::Init(UdpManager *udpManager, UdpIpAddress destIp, int destPo mConnectionCreateTime = UdpMisc::Clock(); mSimulateQueueBytes = 0; - mPassThroughData = NULL; + mPassThroughData = nullptr; mSilentDisconnect = false; mLastSendBin = 0; @@ -1334,7 +1334,7 @@ void UdpConnection::Init(UdpManager *udpManager, UdpIpAddress destIp, int destPo UdpConnection::~UdpConnection() { - if (mUdpManager != NULL) + if (mUdpManager != nullptr) InternalDisconnect(0, cDisconnectReasonApplicationReleased); for (int i = 0; i < UdpManager::cReliableChannelCount; i++) @@ -1385,7 +1385,7 @@ void UdpConnection::InternalDisconnect(int flushTimeout, DisconnectReason reason if (mStatus == cStatusNegotiating) flushTimeout = 0; - if (mUdpManager != NULL) + if (mUdpManager != nullptr) { if (flushTimeout > 0) { @@ -1415,13 +1415,13 @@ void UdpConnection::InternalDisconnect(int flushTimeout, DisconnectReason reason } mUdpManager->RemoveConnection(this); - mUdpManager = NULL; + mUdpManager = nullptr; } mStatus = cStatusDisconnected; - if (startStatus != cStatusDisconnected && startUdpManager != NULL) + if (startStatus != cStatusDisconnected && startUdpManager != nullptr) { - if (mHandler != NULL) + if (mHandler != nullptr) mHandler->OnTerminated(this); } } @@ -1455,7 +1455,7 @@ bool UdpConnection::Send(UdpChannel channel, const void *data, int dataLen) if (dataLen == 0) // zero length packets are ignored return(false); - assert(data != NULL); // can't send a null packet + assert(data != nullptr); // can't send a nullptr packet mUdpManager->mManagerStats.applicationPacketsSent++; mConnectionStats.applicationPacketsSent++; @@ -1472,7 +1472,7 @@ bool UdpConnection::Send(UdpChannel channel, const void *data, int dataLen) bool UdpConnection::Send(UdpChannel channel, const LogicalPacket *packet) { - assert(packet != NULL); // can't send a null packet + assert(packet != nullptr); // can't send a nullptr packet assert(channel >= 0 && channel < cUdpChannelCount); assert(mStatus != cStatusNegotiating); // you are not allowed to start sending data on a connection that is still in the process of negotiating (only applicable client-side obviously since servers never have connections in this state) @@ -1518,7 +1518,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const uchar *data, int data { uchar *bufPtr = tempBuffer; memcpy(bufPtr, data, dataLen); - if (data2 != NULL) + if (data2 != nullptr) memcpy(bufPtr + dataLen, data2, dataLen2); PhysicalSend(bufPtr, totalDataLen, true); return(true); @@ -1531,9 +1531,9 @@ bool UdpConnection::InternalSend(UdpChannel channel, const uchar *data, int data bufPtr[1] = cUdpPacketOrdered2; UdpMisc::PutValue16(bufPtr + 2, (ushort)(++mOrderedCountOutgoing2 & 0xffff)); memcpy(bufPtr + 4, data, dataLen); - if (data2 != NULL) + if (data2 != nullptr) memcpy(bufPtr + 4 + dataLen, data2, dataLen2); - BufferedSend(bufPtr, totalDataLen + 4, NULL, 0, true); + BufferedSend(bufPtr, totalDataLen + 4, nullptr, 0, true); return(true); break; } @@ -1544,7 +1544,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const uchar *data, int data bufPtr[1] = cUdpPacketOrdered2; UdpMisc::PutValue16(bufPtr + 2, (ushort)(++mOrderedCountOutgoing2 & 0xffff)); memcpy(bufPtr + 4, data, dataLen); - if (data2 != NULL) + if (data2 != nullptr) memcpy(bufPtr + 4 + dataLen, data2, dataLen2); PhysicalSend(bufPtr, totalDataLen + 4, true); return(true); @@ -1556,7 +1556,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const uchar *data, int data case cUdpChannelReliable4: { int num = channel - cUdpChannelReliable1; - if (mChannel[num] == NULL) + if (mChannel[num] == nullptr) mChannel[num] = new UdpReliableChannel(num, this, &mUdpManager->mParams.reliable[num]); mChannel[num]->Send(data, dataLen, data2, dataLen2); return(true); @@ -1578,7 +1578,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const LogicalPacket *packet case cUdpChannelReliable4: { int num = channel - cUdpChannelReliable1; - if (mChannel[num] == NULL) + if (mChannel[num] == nullptr) mChannel[num] = new UdpReliableChannel(num, this, &mUdpManager->mParams.reliable[num]); mChannel[num]->Send(packet); return(true); @@ -1618,9 +1618,9 @@ void UdpConnection::PingStatReset() void UdpConnection::GetStats(UdpConnectionStatistics *cs) const { - assert(cs != NULL); + assert(cs != nullptr); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; *cs = mConnectionStats; @@ -1636,13 +1636,13 @@ void UdpConnection::GetStats(UdpConnectionStatistics *cs) const if (cs->syncTheirSent > 0) cs->percentReceivedSuccess = (float)cs->syncOurReceived / (float)cs->syncTheirSent; cs->reliableAveragePing = 0; - if (mChannel[0] != NULL) + if (mChannel[0] != nullptr) cs->reliableAveragePing = mChannel[0]->GetAveragePing(); } void UdpConnection::ProcessRawPacket(const UdpManager::PacketHistoryEntry *e) { - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; if (e->mBuffer[0] != 0 || e->mBuffer[1] != cUdpPacketUnreachableConnection) @@ -1744,7 +1744,7 @@ void UdpConnection::ProcessRawPacket(const UdpManager::PacketHistoryEntry *e) { mConnectionStats.crcRejectedPackets++; mUdpManager->mManagerStats.crcRejectedPackets++; - if (mHandler != NULL) + if (mHandler != nullptr) mHandler->OnCrcReject(this, e->mBuffer, e->mLen); return; } @@ -1771,7 +1771,7 @@ void UdpConnection::ProcessRawPacket(const UdpManager::PacketHistoryEntry *e) *decryptPtr++ = finalStart[1]; int len = (this->*(mDecryptFunction[j]))(decryptPtr, finalStart + 2, finalLen - 2); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; if (len == -1) @@ -1808,7 +1808,7 @@ void UdpConnection::CallbackRoutePacket(const uchar *data, int dataLen) mUdpManager->mManagerStats.applicationPacketsReceived++; mConnectionStats.applicationPacketsReceived++; - if (mHandler != NULL) + if (mHandler != nullptr) mHandler->OnRoutePacket(this, data, dataLen); } } @@ -1819,7 +1819,7 @@ void UdpConnection::CallbackCorruptPacket(const uchar *data, int dataLen, UdpCor { mConnectionStats.corruptPacketErrors++; mUdpManager->mManagerStats.corruptPacketErrors++; - if (mHandler != NULL) + if (mHandler != nullptr) mHandler->OnPacketCorrupt(this, data, dataLen, reason); } } @@ -1828,7 +1828,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) { uchar buf[256]; uchar *bufPtr; - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; if (data[0] == 0 && dataLen > 1) @@ -1912,7 +1912,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) mOtherSideProtocolVersion = otherSideProtocolVersion; SetupEncryptModel(); mStatus = cStatusConnected; - if (mHandler != NULL) + if (mHandler != nullptr) mHandler->OnConnectComplete(this); } break; @@ -2028,7 +2028,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) // (while processing this packet) ended up touching the packet-data and corrupting the next // packet in the multi-sequence. CallbackCorruptPacket(data, dataLen, cUdpCorruptionMultiPacket); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; } else @@ -2144,7 +2144,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) case cUdpPacketFragment4: { int num = (data[1] - cUdpPacketReliable1) % UdpManager::cReliableChannelCount; - if (mChannel[num] == NULL) + if (mChannel[num] == nullptr) mChannel[num] = new UdpReliableChannel(num, this, &mUdpManager->mParams.reliable[num]); mChannel[num]->ReliablePacket(data, dataLen); break; @@ -2155,7 +2155,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) case cUdpPacketAck4: { int num = data[1] - cUdpPacketAck1; - if (mChannel[num] != NULL) + if (mChannel[num] != nullptr) mChannel[num]->AckPacket(data, dataLen); break; } @@ -2165,7 +2165,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) case cUdpPacketAckAll4: { int num = data[1] - cUdpPacketAckAll1; - if (mChannel[num] != NULL) + if (mChannel[num] != nullptr) mChannel[num]->AckAllPacket(data, dataLen); break; } @@ -2205,7 +2205,7 @@ void UdpConnection::FlagPortUnreachable() void UdpConnection::GiveTime() { - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; UdpManager *myManager = mUdpManager; @@ -2298,11 +2298,11 @@ void UdpConnection::InternalGiveTime() int totalPendingBytes = 0; for (int i = 0; i < UdpManager::cReliableChannelCount; i++) { - if (mChannel[i] != NULL) + if (mChannel[i] != nullptr) { totalPendingBytes += mChannel[i]->TotalPendingBytes(); int myNext = mChannel[i]->GiveTime(); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; // giving the reliable channel time caused it to callback the application which may disconnect us nextSchedule = udpMin(nextSchedule, myNext); } @@ -2391,7 +2391,7 @@ void UdpConnection::InternalGiveTime() break; } - if (mUdpManager != NULL) + if (mUdpManager != nullptr) { // safety to prevent us for scheduling ourselves for a time period that has already passed, // as doing so could result in infinite looping in the priority queue processing. @@ -2408,7 +2408,7 @@ int UdpConnection::TotalPendingBytes() const int total = 0; for (int i = 0; i < UdpManager::cReliableChannelCount; i++) { - if (mChannel[i] != NULL) + if (mChannel[i] != nullptr) total += mChannel[i]->TotalPendingBytes(); } return(total); @@ -2474,7 +2474,7 @@ int UdpConnection::ExpireReceiveBin() void UdpConnection::PhysicalSend(const uchar *data, int dataLen, bool appendAllowed) { - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; // if we attempt to do a physical send (ie. encrypt/compress/crc a packet) while we are not connected @@ -2503,7 +2503,7 @@ void UdpConnection::PhysicalSend(const uchar *data, int dataLen, bool appendAllo // we know this internal packet will not be a connect or confirm packet since they are sent directly to RawSend to avoid getting encrypted *destPtr++ = finalStart[1]; int len = (this->*(mEncryptFunction[j]))(destPtr, finalStart + 2, finalLen - 2); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; // if this assert triggers, it means the encryption pass expanded the size of the encrypted @@ -2574,8 +2574,8 @@ void UdpConnection::PhysicalSend(const uchar *data, int dataLen, bool appendAllo // function can do its job uchar *UdpConnection::BufferedSend(const uchar *data, int dataLen, const uchar *data2, int dataLen2, bool appendAllowed) { - if (mUdpManager == NULL) - return(NULL); + if (mUdpManager == nullptr) + return(nullptr); int used = mMultiBufferPtr - mMultiBufferData; int actualMaxDataHoldSize = udpMin(mUdpManager->mParams.maxDataHoldSize, mConnectionConfig.maxRawPacketSize); @@ -2590,7 +2590,7 @@ uchar *UdpConnection::BufferedSend(const uchar *data, int dataLen, const uchar * FlushMultiBuffer(); // now send it (the multi-buffer is empty if you need to use it temporarily to concatenate two data chunks -- it is large enough to hold the largest raw packet) - if (data2 != NULL) + if (data2 != nullptr) { memcpy(mMultiBufferData, data, dataLen); memcpy(mMultiBufferData + dataLen, data2, dataLen2); @@ -2598,7 +2598,7 @@ uchar *UdpConnection::BufferedSend(const uchar *data, int dataLen, const uchar * } else PhysicalSend(data, dataLen, appendAllowed); - return(NULL); + return(nullptr); } // if this data will not fit into buffer @@ -2626,7 +2626,7 @@ uchar *UdpConnection::BufferedSend(const uchar *data, int dataLen, const uchar * uchar *placementPtr = mMultiBufferPtr; memcpy(mMultiBufferPtr, data, dataLen); mMultiBufferPtr += dataLen; - if (data2 != NULL) + if (data2 != nullptr) { memcpy(mMultiBufferPtr, data2, dataLen2); mMultiBufferPtr += dataLen2; @@ -2635,21 +2635,21 @@ uchar *UdpConnection::BufferedSend(const uchar *data, int dataLen, const uchar * if ((mMultiBufferPtr - mMultiBufferData) >= actualMaxDataHoldSize) { FlushMultiBuffer(); - placementPtr = NULL; // it got flushed + placementPtr = nullptr; // it got flushed } return(placementPtr); } uchar *UdpConnection::InternalAckSend(uchar *bufferedAckPtr, const uchar *ackPtr, int ackLen) { - if (bufferedAckPtr != NULL) + if (bufferedAckPtr != nullptr) { memcpy(bufferedAckPtr, ackPtr, ackLen); return(bufferedAckPtr); } - BufferedSend(ackPtr, ackLen, NULL, 0, false); - return(NULL); // FIX THIS + BufferedSend(ackPtr, ackLen, nullptr, 0, false); + return(nullptr); // FIX THIS } void UdpConnection::FlushMultiBuffer() @@ -2665,7 +2665,7 @@ void UdpConnection::FlushMultiBuffer() // notify all the reliable channels to clear their buffered acks for (int i = 0; i < UdpManager::cReliableChannelCount; i++) { - if (mChannel[i] != NULL) + if (mChannel[i] != nullptr) { mChannel[i]->ClearBufferedAck(); } @@ -2689,7 +2689,7 @@ int UdpConnection::DecryptNone(uchar *destData, const uchar *sourceData, int sou int UdpConnection::EncryptUserSupplied(uchar *destData, const uchar *sourceData, int sourceLen) { UdpManagerHandler *manHandler = mUdpManager->GetHandler(); - if (manHandler != NULL) + if (manHandler != nullptr) return(manHandler->OnUserSuppliedEncrypt(this, destData, sourceData, sourceLen)); assert(0); // if user-supplied encryption is specified, then you must have a manager handler installed to provide the routines return(0); @@ -2698,7 +2698,7 @@ int UdpConnection::EncryptUserSupplied(uchar *destData, const uchar *sourceData, int UdpConnection::DecryptUserSupplied(uchar *destData, const uchar *sourceData, int sourceLen) { UdpManagerHandler *manHandler = mUdpManager->GetHandler(); - if (manHandler != NULL) + if (manHandler != nullptr) return(manHandler->OnUserSuppliedDecrypt(this, destData, sourceData, sourceLen)); assert(0); // if user-supplied encryption is specified, then you must have a manager handler installed to provide the routines return(0); @@ -2707,7 +2707,7 @@ int UdpConnection::DecryptUserSupplied(uchar *destData, const uchar *sourceData, int UdpConnection::EncryptUserSupplied2(uchar *destData, const uchar *sourceData, int sourceLen) { UdpManagerHandler *manHandler = mUdpManager->GetHandler(); - if (manHandler != NULL) + if (manHandler != nullptr) return(manHandler->OnUserSuppliedEncrypt2(this, destData, sourceData, sourceLen)); assert(0); // if user-supplied encryption is specified, then you must have a manager handler installed to provide the routines return(0); @@ -2716,7 +2716,7 @@ int UdpConnection::EncryptUserSupplied2(uchar *destData, const uchar *sourceData int UdpConnection::DecryptUserSupplied2(uchar *destData, const uchar *sourceData, int sourceLen) { UdpManagerHandler *manHandler = mUdpManager->GetHandler(); - if (manHandler != NULL) + if (manHandler != nullptr) return(manHandler->OnUserSuppliedDecrypt2(this, destData, sourceData, sourceLen)); assert(0); // if user-supplied encryption is specified, then you must have a manager handler installed to provide the routines return(0); @@ -2866,7 +2866,7 @@ void UdpConnection::SetupEncryptModel() mEncryptExpansionBytes += 0; // set up encrypt buffer (random numbers generated based on seed) - if (mEncryptXorBuffer == NULL) + if (mEncryptXorBuffer == nullptr) { int len = ((mUdpManager->mParams.maxRawPacketSize + 1) / 4) * 4; mEncryptXorBuffer = new uchar[len]; @@ -2898,7 +2898,7 @@ void UdpConnection::GetChannelStatus(UdpChannel channel, ChannelStatus *channelS case cUdpChannelReliable2: case cUdpChannelReliable3: case cUdpChannelReliable4: - if (mChannel[channel - cUdpChannelReliable1] != NULL) + if (mChannel[channel - cUdpChannelReliable1] != nullptr) { mChannel[channel - cUdpChannelReliable1]->GetChannelStatus(channelStatus); } @@ -2975,12 +2975,12 @@ UdpReliableChannel::UdpReliableChannel(int channelNumber, UdpConnection *con, Ud mLogicalPacketsQueued = 0; mLogicalBytesQueued = 0; - mCoalescePacket = NULL; - mCoalesceStartPtr = NULL; - mCoalesceEndPtr = NULL; + mCoalescePacket = nullptr; + mCoalesceStartPtr = nullptr; + mCoalesceEndPtr = nullptr; mCoalesceCount = 0; - mBufferedAckPtr = NULL; + mBufferedAckPtr = nullptr; mStatDuplicatePacketsReceived = 0; mStatResentPacketsAccelerated = 0; @@ -2994,7 +2994,7 @@ UdpReliableChannel::UdpReliableChannel(int channelNumber, UdpConnection *con, Ud mBigDataLen = 0; mBigDataTargetLen = 0; - mBigDataPtr = NULL; + mBigDataPtr = nullptr; mFragmentNextPos = 0; mLastTimeStampAcknowledged = 0; mMaxxedOutCurrentWindow = false; @@ -3003,23 +3003,23 @@ UdpReliableChannel::UdpReliableChannel(int channelNumber, UdpConnection *con, Ud mPhysicalPackets = new PhysicalPacket[mConfig.maxOutstandingPackets]; mReliableIncoming = new IncomingQueueEntry[mConfig.maxInstandingPackets]; - mLogicalRoot = NULL; - mLogicalEnd = NULL; + mLogicalRoot = nullptr; + mLogicalEnd = nullptr; } UdpReliableChannel::~UdpReliableChannel() { - if (mCoalescePacket != NULL) + if (mCoalescePacket != nullptr) { mCoalescePacket->Release(); - mCoalescePacket = NULL; + mCoalescePacket = nullptr; } const LogicalPacket *cur = mLogicalRoot; - while (cur != NULL) + while (cur != nullptr) { const LogicalPacket *next = cur->mReliableQueueNext; - cur->mReliableQueueNext = NULL; // make sure and mark it available so others could possibly use it (if it is a shared logical packet) + cur->mReliableQueueNext = nullptr; // make sure and mark it available so others could possibly use it (if it is a shared logical packet) cur->Release(); if (cur == next) // pointing to self, so this is end of list break; @@ -3035,7 +3035,7 @@ UdpReliableChannel::~UdpReliableChannel() void UdpReliableChannel::Send(const uchar *data, int dataLen, const uchar *data2, int dataLen2) { - if (mLogicalPacketsQueued == 0 && mCoalescePacket == NULL) + if (mLogicalPacketsQueued == 0 && mCoalescePacket == nullptr) { // if we are adding something to a previously empty logical queue, then it is possible that // we may be able to send it, so mark ourselves to take time the next time it is offered @@ -3086,7 +3086,7 @@ void UdpReliableChannel::Send(const LogicalPacket *packet) void UdpReliableChannel::FlushCoalesce() { - if (mCoalescePacket != NULL) + if (mCoalescePacket != nullptr) { if (mCoalesceCount == 1) { @@ -3103,16 +3103,16 @@ void UdpReliableChannel::FlushCoalesce() } mCoalescePacket->Release(); - mCoalescePacket = NULL; + mCoalescePacket = nullptr; } } void UdpReliableChannel::SendCoalesce(const uchar *data, int dataLen, const uchar *data2, int dataLen2) { int totalLen = dataLen + dataLen2; - if (mCoalescePacket == NULL) + if (mCoalescePacket == nullptr) { - mCoalescePacket = mUdpConnection->mUdpManager->CreatePacket(NULL, mMaxDataBytes); + mCoalescePacket = mUdpConnection->mUdpManager->CreatePacket(nullptr, mMaxDataBytes); mCoalesceEndPtr = mCoalesceStartPtr = (uchar *)mCoalescePacket->GetDataPtr(); *mCoalesceEndPtr++ = 0; *mCoalesceEndPtr++ = UdpConnection::cUdpPacketGroup; @@ -3132,10 +3132,10 @@ void UdpReliableChannel::SendCoalesce(const uchar *data, int dataLen, const ucha // append on end of coalesce mCoalesceCount++; mCoalesceEndPtr += UdpMisc::PutVariableValue(mCoalesceEndPtr, totalLen); - if (data != NULL) + if (data != nullptr) memcpy(mCoalesceEndPtr, data, dataLen); mCoalesceEndPtr += dataLen; - if (data2 != NULL) + if (data2 != nullptr) memcpy(mCoalesceEndPtr, data2, dataLen2); mCoalesceEndPtr += dataLen2; } @@ -3145,7 +3145,7 @@ void UdpReliableChannel::QueueLogicalPacket(const LogicalPacket *packet) mLogicalPacketsQueued++; mLogicalBytesQueued += packet->GetDataLen(); - if (packet->mReliableQueueNext != NULL) + if (packet->mReliableQueueNext != nullptr) { packet = mUdpConnection->mUdpManager->WrappedBorrow(packet); } @@ -3155,13 +3155,13 @@ void UdpReliableChannel::QueueLogicalPacket(const LogicalPacket *packet) } packet->mReliableQueueNext = packet; // have it point to itself to signify that the mNext pointer is taken (ie. reserve it), yet still represents the end of the list - if (mLogicalEnd != NULL) + if (mLogicalEnd != nullptr) { mLogicalEnd->mReliableQueueNext = packet; } mLogicalEnd = packet; - if (mLogicalRoot == NULL) + if (mLogicalRoot == nullptr) { mLogicalRoot = packet; } @@ -3182,10 +3182,10 @@ bool UdpReliableChannel::PullDown(int windowSpaceLeft) int physicalCount = (int)(mReliableOutgoingId - mReliableOutgoingPendingId); while (windowSpaceLeft > 0 && physicalCount < mConfig.maxOutstandingPackets) { - if (mLogicalRoot == NULL) + if (mLogicalRoot == nullptr) { FlushCoalesce(); // this is guaranteed to stick - if (mLogicalRoot == NULL) + if (mLogicalRoot == nullptr) break; // nothing flushed, so we are done } @@ -3225,10 +3225,10 @@ bool UdpReliableChannel::PullDown(int windowSpaceLeft) mLogicalRoot = mLogicalRoot->mReliableQueueNext; if (mLogicalRoot == lp) // ie, we were pointing to ourself, meaning we were the end of the list { - mLogicalRoot = NULL; - mLogicalEnd = NULL; + mLogicalRoot = nullptr; + mLogicalEnd = nullptr; } - lp->mReliableQueueNext = NULL; // clear our next link since we are no longer using it (so somebody else can use it potentially) + lp->mReliableQueueNext = nullptr; // clear our next link since we are no longer using it (so somebody else can use it potentially) lp->Release(); // release from logical queue } else @@ -3279,7 +3279,7 @@ int UdpReliableChannel::GiveTime() mMaxxedOutCurrentWindow = false; int outstandingNextSendTime = 10 * 60000; // if we have something to do - if (mReliableOutgoingPendingId < mReliableOutgoingId || mLogicalRoot != NULL || mCoalescePacket != NULL) + if (mReliableOutgoingPendingId < mReliableOutgoingId || mLogicalRoot != nullptr || mCoalescePacket != nullptr) { // first, let's calculate how many bytes we figure is outstanding based on who is still waiting for an ack-packet UdpMisc::ClockStamp oldestResendTime = udpMax(hotClock - optimalResendDelay, mLastTimeStampAcknowledged); // anything older than this, we need to resend @@ -3304,7 +3304,7 @@ int UdpReliableChannel::GiveTime() // if this packet has not been acked and it is NOT ready to be sent (was recently sent) then we consider it outstanding // note: packets needing re-sending probably got lost and are therefore not outstanding PhysicalPacket *entry = &mPhysicalPackets[i % mConfig.maxOutstandingPackets]; - if (entry->mDataPtr != NULL) // acked packets set the dataPtr to NULL + if (entry->mDataPtr != nullptr) // acked packets set the dataPtr to nullptr { // if this packet is ready to be sent (ie: needs time now, or some later packet has already been ack'ed) windowSpaceLeft -= entry->mDataLen; // window-space is effectively taken whether we have sent it yet or not @@ -3464,7 +3464,7 @@ int UdpReliableChannel::GiveTime() void UdpReliableChannel::GetChannelStatus(UdpConnection::ChannelStatus *channelStatus) const { int coalesceBytes = 0; - if (mCoalescePacket != NULL) + if (mCoalescePacket != nullptr) coalesceBytes = mCoalesceEndPtr - mCoalesceStartPtr; channelStatus->totalPendingBytes = mLogicalBytesQueued + mReliableOutgoingBytes + coalesceBytes; @@ -3525,7 +3525,7 @@ void UdpReliableChannel::ReliablePacket(const uchar *data, int dataLen) mReliableIncomingId++; // process other packets that have arrived - while (mReliableIncoming[mReliableIncomingId % mConfig.maxInstandingPackets].mPacket != NULL) + while (mReliableIncoming[mReliableIncomingId % mConfig.maxInstandingPackets].mPacket != nullptr) { int spot = (int)(mReliableIncomingId % mConfig.maxInstandingPackets); if (mReliableIncoming[spot].mMode != cReliablePacketModeDelivered) @@ -3534,7 +3534,7 @@ void UdpReliableChannel::ReliablePacket(const uchar *data, int dataLen) } mReliableIncoming[spot].mPacket->Release(); - mReliableIncoming[spot].mPacket = NULL; + mReliableIncoming[spot].mPacket = nullptr; mReliableIncomingId++; } } @@ -3542,7 +3542,7 @@ void UdpReliableChannel::ReliablePacket(const uchar *data, int dataLen) { // not the one we need next, but it is later than the one we need , so store it in our buffer until it's turn comes up int spot = (int)(reliableId % mConfig.maxInstandingPackets); - if (mReliableIncoming[spot].mPacket == NULL) // only make the copy of it if we don't already have it in our buffer (in cases where it was sent twice, there would be no harm in the copy again since it must be the same packet, it's just inefficient) + if (mReliableIncoming[spot].mPacket == nullptr) // only make the copy of it if we don't already have it in our buffer (in cases where it was sent twice, there would be no harm in the copy again since it must be the same packet, it's just inefficient) { mReliableIncoming[spot].mMode = mode; mReliableIncoming[spot].mPacket = mUdpConnection->mUdpManager->CreatePacket(data + UdpConnection::cUdpPacketReliableSize, dataLen - UdpConnection::cUdpPacketReliableSize); @@ -3584,16 +3584,16 @@ void UdpReliableChannel::ReliablePacket(const uchar *data, int dataLen) // a simple ack for us only *bufPtr++ = (uchar)(UdpConnection::cUdpPacketAck1 + mChannelNumber); bufPtr += UdpMisc::PutValue16(bufPtr, (ushort)(reliableId & 0xffff)); - mBufferedAckPtr = NULL; // not allowed to replace an old one with a selective-ack + mBufferedAckPtr = nullptr; // not allowed to replace an old one with a selective-ack } - if (mBufferedAckPtr != NULL && mConfig.ackDeduping) + if (mBufferedAckPtr != nullptr && mConfig.ackDeduping) { memcpy(mBufferedAckPtr, buf, bufPtr - buf); } else { - mBufferedAckPtr = mUdpConnection->BufferedSend(buf, bufPtr - buf, NULL, 0, true); // safe to append on our data, it is stack data + mBufferedAckPtr = mUdpConnection->BufferedSend(buf, bufPtr - buf, nullptr, 0, true); // safe to append on our data, it is stack data } } @@ -3610,7 +3610,7 @@ void UdpReliableChannel::ProcessPacket(ReliablePacketMode mode, const uchar *dat else if (mode == cReliablePacketModeFragment) { // append onto end of big packet (or create new big packet if not existing already) - if (mBigDataPtr == NULL) + if (mBigDataPtr == nullptr) { mBigDataTargetLen = UdpMisc::GetValue32(data); // first fragment has a total-length int header on it. mBigDataPtr = new uchar[mBigDataTargetLen]; @@ -3633,7 +3633,7 @@ void UdpReliableChannel::ProcessPacket(ReliablePacketMode mode, const uchar *dat delete[] mBigDataPtr; mBigDataLen = 0; mBigDataTargetLen = 0; - mBigDataPtr = NULL; + mBigDataPtr = nullptr; } } } @@ -3663,7 +3663,7 @@ void UdpReliableChannel::Ack(udp_int64 reliableId) int pos = (int)(reliableId % mConfig.maxOutstandingPackets); PhysicalPacket *entry = &mPhysicalPackets[pos]; - if (entry->mDataPtr != NULL) // if this packet has not been acknowledged yet (sometimes we get back two acks for the same packet) + if (entry->mDataPtr != nullptr) // if this packet has not been acknowledged yet (sometimes we get back two acks for the same packet) { mNextNeedTime = 0; // something got acked, so we actually need to take the time next time it is offered @@ -3721,14 +3721,14 @@ void UdpReliableChannel::Ack(udp_int64 reliableId) // this packet we have queued has been acknowledged, so delete it from queue mReliableOutgoingBytes -= entry->mDataLen; entry->mDataLen = 0; - entry->mDataPtr = NULL; + entry->mDataPtr = nullptr; entry->mParent->Release(); - entry->mParent = NULL; + entry->mParent = nullptr; // advance the pending ptr until it reaches outgoingId or an entry that has yet to acknowledged while (mReliableOutgoingPendingId < mReliableOutgoingId) { - if (mPhysicalPackets[mReliableOutgoingPendingId % mConfig.maxOutstandingPackets].mDataPtr != NULL) + if (mPhysicalPackets[mReliableOutgoingPendingId % mConfig.maxOutstandingPackets].mDataPtr != nullptr) break; mReliableOutgoingPendingId++; } @@ -3750,25 +3750,25 @@ void UdpReliableChannel::Ack(udp_int64 reliableId) UdpReliableChannel::IncomingQueueEntry::IncomingQueueEntry() { - mPacket = NULL; + mPacket = nullptr; mMode = UdpReliableChannel::cReliablePacketModeReliable; } UdpReliableChannel::IncomingQueueEntry::~IncomingQueueEntry() { - if (mPacket != NULL) + if (mPacket != nullptr) mPacket->Release(); } UdpReliableChannel::PhysicalPacket::PhysicalPacket() { - mParent = NULL; + mParent = nullptr; } UdpReliableChannel::PhysicalPacket::~PhysicalPacket() { - if (mParent != NULL) + if (mParent != nullptr) mParent->Release(); } @@ -3780,7 +3780,7 @@ UdpReliableChannel::PhysicalPacket::~PhysicalPacket() LogicalPacket::LogicalPacket() { mRefCount = 1; - mReliableQueueNext = NULL; + mReliableQueueNext = nullptr; } LogicalPacket::~LogicalPacket() @@ -3815,7 +3815,7 @@ SimpleLogicalPacket::SimpleLogicalPacket(const void *data, int dataLen) { mDataLen = dataLen; mData = new uchar[mDataLen]; - if (data != NULL) + if (data != nullptr) memcpy(mData, data, mDataLen); } @@ -3850,7 +3850,7 @@ void SimpleLogicalPacket::SetDataLen(int len) GroupLogicalPacket::GroupLogicalPacket() : LogicalPacket() { mDataLen = 0; - mData = NULL; + mData = nullptr; } GroupLogicalPacket::~GroupLogicalPacket() @@ -3860,13 +3860,13 @@ GroupLogicalPacket::~GroupLogicalPacket() void GroupLogicalPacket::AddPacket(const LogicalPacket *packet) { - assert(packet != NULL); + assert(packet != nullptr); AddPacketInternal(packet->GetDataPtr(), packet->GetDataLen(), packet->IsInternalPacket()); } void GroupLogicalPacket::AddPacket(const void *data, int dataLen) { - assert(data != NULL); + assert(data != nullptr); assert(dataLen >= 0); AddPacketInternal(data, dataLen, false); } @@ -3932,16 +3932,16 @@ PooledLogicalPacket::PooledLogicalPacket(UdpManager *manager, int len) mDataLen = 0; mUdpManager = manager; - mAvailableNext = NULL; - mCreatedNext = NULL; - mCreatedPrev = NULL; + mAvailableNext = nullptr; + mCreatedNext = nullptr; + mCreatedPrev = nullptr; mUdpManager->PoolCreated(this); } PooledLogicalPacket::~PooledLogicalPacket() { - if (mUdpManager != NULL) + if (mUdpManager != nullptr) { mUdpManager->PoolDestroyed(this); } @@ -3956,7 +3956,7 @@ void PooledLogicalPacket::AddRef() const void PooledLogicalPacket::Release() const { - if (mRefCount == 1 && mUdpManager != NULL) + if (mRefCount == 1 && mUdpManager != nullptr) mUdpManager->PoolReturn(const_cast(this)); // if pool wants to keep us, it will inc our ref count, preventing our destruction // we cast off our const, as when we are added back to the pool, we can be modified LogicalPacket::Release(); @@ -3986,9 +3986,9 @@ void PooledLogicalPacket::SetDataLen(int len) void PooledLogicalPacket::SetData(const void *data, int dataLen, const void *data2, int dataLen2) { mDataLen = dataLen + dataLen2; - if (data != NULL) + if (data != nullptr) memcpy(mData, data, dataLen); - if (data2 != NULL) + if (data2 != nullptr) memcpy(mData + dataLen, data2, dataLen2); } @@ -3999,23 +3999,23 @@ void PooledLogicalPacket::SetData(const void *data, int dataLen, const void *dat /////////////////////////////////////////////////////////////////////////////////////////// WrappedLogicalPacket::WrappedLogicalPacket(UdpManager *udpManager) { - mPacket = NULL; + mPacket = nullptr; mUdpManager = udpManager; - mAvailableNext = NULL; - mCreatedNext = NULL; - mCreatedPrev = NULL; + mAvailableNext = nullptr; + mCreatedNext = nullptr; + mCreatedPrev = nullptr; mUdpManager->WrappedCreated(this); } WrappedLogicalPacket::~WrappedLogicalPacket() { - if (mUdpManager != NULL) + if (mUdpManager != nullptr) { mUdpManager->WrappedDestroyed(this); } - if (mPacket != NULL) + if (mPacket != nullptr) { mPacket->Release(); } @@ -4028,7 +4028,7 @@ void WrappedLogicalPacket::AddRef() const void WrappedLogicalPacket::Release() const { - if (mRefCount == 1 && mUdpManager != NULL) + if (mRefCount == 1 && mUdpManager != nullptr) mUdpManager->WrappedReturn(const_cast(this)); // if pool wants to keep us, it will inc our ref count, preventing our destruction // we cast off our const, as when we are added back to the pool, we can be modified LogicalPacket::Release(); @@ -4036,10 +4036,10 @@ void WrappedLogicalPacket::Release() const void WrappedLogicalPacket::SetLogicalPacket(const LogicalPacket *packet) { - if (mPacket != NULL) + if (mPacket != nullptr) mPacket->Release(); mPacket = packet; - if (mPacket != NULL) + if (mPacket != nullptr) mPacket->AddRef(); } @@ -4075,7 +4075,7 @@ UdpManager::SimulateQueueEntry::SimulateQueueEntry(const uchar *data, int dataLe memcpy(mData, data, dataLen); mIp = ip; mPort = port; - mNext = NULL; + mNext = nullptr; } UdpManager::SimulateQueueEntry::~SimulateQueueEntry() @@ -4110,7 +4110,7 @@ UdpMisc::ClockStamp UdpMisc::Clock() static ClockStamp sLastStamp = 0; static ClockStamp sCurrentCorrection = 0; struct timeval tv; - gettimeofday(&tv, NULL); + gettimeofday(&tv, nullptr); UdpMisc::ClockStamp cs = static_cast(tv.tv_sec) * 1000 + static_cast(tv.tv_usec / 1000); cs += sCurrentCorrection; if (cs < sLastStamp) @@ -4226,19 +4226,19 @@ void *UdpMisc::SmartResize(void *ptr, int bytes, int round) if (bytes == 0) { - if (ptr != NULL) + if (ptr != nullptr) { free((uchar *)ptr - cAlignment); } - return(NULL); + return(nullptr); } uchar *ptr2; - if (ptr == NULL) + if (ptr == nullptr) { ptr2 = (uchar *)malloc(bytes + cAlignment); - if (ptr2 == NULL) - return(NULL); + if (ptr2 == nullptr) + return(nullptr); *(int *)ptr2 = bytes; return(ptr2 + cAlignment); } @@ -4248,8 +4248,8 @@ void *UdpMisc::SmartResize(void *ptr, int bytes, int round) return(ptr); ptr2 = (uchar *)realloc((uchar *)ptr - cAlignment, bytes + cAlignment); - if (ptr2 == NULL) - return(NULL); + if (ptr2 == nullptr) + return(nullptr); *(int *)ptr2 = bytes; return(ptr2 + cAlignment); @@ -4312,30 +4312,30 @@ LogicalPacket *UdpMisc::CreateQuickLogicalPacket(const void *data, int dataLen, switch(q) { case 0: - tlp = new FixedLogicalPacket(NULL, totalDataLen); + tlp = new FixedLogicalPacket(nullptr, totalDataLen); break; case 1: - tlp = new FixedLogicalPacket(NULL, totalDataLen); + tlp = new FixedLogicalPacket(nullptr, totalDataLen); break; case 2: case 3: - tlp = new FixedLogicalPacket(NULL, totalDataLen); + tlp = new FixedLogicalPacket(nullptr, totalDataLen); break; case 4: case 5: case 6: case 7: - tlp = new FixedLogicalPacket(NULL, totalDataLen); + tlp = new FixedLogicalPacket(nullptr, totalDataLen); break; default: - tlp = new SimpleLogicalPacket(NULL, totalDataLen); + tlp = new SimpleLogicalPacket(nullptr, totalDataLen); break; } uchar *dest = (uchar *)tlp->GetDataPtr(); - if (data != NULL) + if (data != nullptr) memcpy(dest, data, dataLen); - if (data2 != NULL) + if (data2 != nullptr) memcpy(dest + dataLen, data2, dataLen2); return(tlp); } @@ -4349,7 +4349,7 @@ UdpIpAddress UdpMisc::GetHostByName(const char *hostName) { struct hostent * lphp; lphp = gethostbyname(hostName); - if (lphp == NULL) + if (lphp == nullptr) { address = 0; } diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpLibrary.hpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpLibrary.hpp index 27fc28d1..9db50e40 100644 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpLibrary.hpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpLibrary.hpp @@ -150,7 +150,7 @@ class UdpMisc // memory manager does a little bit of this, but if you know you have an allocation that is likely // to grow quite a bit, you can set the round'ing size up to a fairly large number and avoid // unnecessary reallocs at the cost of a little potentially wasted space - // initial allocations are done by passing in ptr==NULL, freeing is done by passing in bytes==0 + // initial allocations are done by passing in ptr==nullptr, freeing is done by passing in bytes==0 static void *SmartResize(void *ptr, int bytes, int round = 1); // the following two functions store values in the buffer as a variable length (B1, 0xffB2B1, 0xffffffB4B3B2B1) @@ -170,7 +170,7 @@ class UdpMisc static uint GetValue24(const void *buffer); // gets a 24-bit value from the buffer in big-endian format static ushort GetValue16(const void *buffer); // gets a 16-bit value from the buffer in big-endian format - static LogicalPacket *CreateQuickLogicalPacket(const void *data, int dataLen, const void *data2 = NULL, int dataLen2 = 0); + static LogicalPacket *CreateQuickLogicalPacket(const void *data, int dataLen, const void *data2 = nullptr, int dataLen2 = 0); // looks up the specified name and translates it to an IP address // this is a blocking call that can at times take a significant amount of time, but will generally be fast (less than 300ms) @@ -243,7 +243,7 @@ class LogicalPacket protected: friend class UdpReliableChannel; mutable const LogicalPacket *mReliableQueueNext; // owned/managed by the reliable channel object as an optimizations, do not touch - // NULL = unclaimed, point-to-self = claimed, but end of list + // nullptr = unclaimed, point-to-self = claimed, but end of list }; class SimpleLogicalPacket : public LogicalPacket @@ -252,7 +252,7 @@ class SimpleLogicalPacket : public LogicalPacket // it was originally created to allow the internal code to handle reliable data that was sent // via the Send(char *, int) api call. public: - SimpleLogicalPacket(const void *data, int dataLen); // data can be NULL if you want to populate it after it is allocated (get the pointer and write to it) + SimpleLogicalPacket(const void *data, int dataLen); // data can be nullptr if you want to populate it after it is allocated (get the pointer and write to it) virtual void *GetDataPtr(); virtual const void *GetDataPtr() const; virtual int GetDataLen() const; @@ -323,7 +323,7 @@ template class StructLogicalPacket : public LogicalPacket // with virtual functions) via this method as they may contain hidden data-members (such as pointers // to vtables). public: - StructLogicalPacket(T *initData = NULL); + StructLogicalPacket(T *initData = nullptr); virtual void *GetDataPtr(); virtual const void *GetDataPtr() const; virtual int GetDataLen() const; @@ -396,7 +396,7 @@ class PooledLogicalPacket : public LogicalPacket int mMaxDataLen; protected: friend class UdpManager; - void SetData(const void *data, int dataLen, const void *data2 = NULL, int dataLen2 = 0); + void SetData(const void *data, int dataLen, const void *data2 = nullptr, int dataLen2 = 0); UdpManager *mUdpManager; PooledLogicalPacket *mAvailableNext; PooledLogicalPacket *mCreatedNext; @@ -476,7 +476,7 @@ class UdpManager // pointer equal to your object and the UdpManager will call it as appropriate. The UdpConnection object // also has a handler mechanism that replaces the other callback functions below, see UdpConnection::SetHandler // if a handler is specified, the callback function is ignored, even if specified. - // default = NULL (not used) + // default = nullptr (not used) UdpManagerHandler *handler; // this is the maximum number of connections that can be established by this manager, any incoming/outgoing connections @@ -901,7 +901,7 @@ class UdpManager // will call EstablishConnection, then sit in a loop calling UdpManager::GiveTime and checking to see // if the status of the returned UdpConnection object is changed from cStatusNegotiating. This allows // the application to look for the ESC key or timeout an attempted connection. - // This function will return NULL if the manager object has exceeded its maximum number of connections + // This function will return nullptr if the manager object has exceeded its maximum number of connections // or if the serverAddress cannot be resolved to an IP address // as is noted in the declaration, it is the responsibility of the application establishing the connection to delete it // setting the timeout value (in milliseconds) to something greater than 0 will cause the UdpConnection object to change @@ -933,13 +933,13 @@ class UdpManager // manually forces all live connections to flush their multi buffers immediately void FlushAllMultiBuffer(); - // creates a logical packet and populates it with data. data can be NULL, in which case it gives you logical packet + // creates a logical packet and populates it with data. data can be nullptr, in which case it gives you logical packet // of the size specified, but copies no data into it. If you are using pool management (see Params::poolPacketMax), // it will give you a packet out of the pool if possible, otherwise it will create a packet for you. When logical // are packets are needed internally for various things (like reliable channel sends that use the (void *, int) interface) // they are gotten from this function, so your application can likely take advantage of pooling, even if it never bothers // to explicitly call this function. - LogicalPacket *CreatePacket(const void *data, int dataLen, const void *data2 = NULL, int dataLen2 = 0); + LogicalPacket *CreatePacket(const void *data, int dataLen, const void *data2 = nullptr, int dataLen2 = 0); protected: friend class PooledLogicalPacket; @@ -1165,7 +1165,7 @@ class UdpConnection : public PriorityQueueMember, public AddressHashTableMember, int ConnectionAge() const; // returns the UdpManager object that is managing this connection - // will return NULL if the connection has been disconnected for some reason (because disconnecting severes the link to UdpManager) + // will return nullptr if the connection has been disconnected for some reason (because disconnecting severes the link to UdpManager) UdpManager *GetUdpManager() const; // returns the 32-bit encryption-code that was negotiated as part of the connection-establishment process. @@ -1245,9 +1245,9 @@ class UdpConnection : public PriorityQueueMember, public AddressHashTableMember, friend class UdpManager; friend class UdpReliableChannel; - // note: if connectPacket is NULL, that means this connection object is being created to establish + // note: if connectPacket is nullptr, that means this connection object is being created to establish // a new connection to the specified ip/port (ie. the connection starts out in cStatusNegotiating mode) - // if connectPacket is non-NULL, that menas this connection object is being created to handle an + // if connectPacket is non-nullptr, that menas this connection object is being created to handle an // incoming connect request and it will start out in cStatusConnected mode. UdpConnection(UdpManager *udpManager, UdpIpAddress destIp, int destPort, int timeout); // starts connection-establishment protocol UdpConnection(UdpManager *udpManager, const UdpManager::PacketHistoryEntry *e); // starts already connected, replying to connection request @@ -1282,7 +1282,7 @@ class UdpConnection : public PriorityQueueMember, public AddressHashTableMember, void PhysicalSend(const uchar *data, int dataLen, bool appendAllowed); // sends a physical packet (encrypts and adds crc bytes) uchar *BufferedSend(const uchar *data, int dataLen, const uchar *data2, int dataLen2, bool appendAllowed); // buffers logical packets waiting til we have more data (makes multi-packets) bool InternalSend(UdpChannel channel, const LogicalPacket *packet); - bool InternalSend(UdpChannel channel, const uchar *data, int dataLen, const uchar *data2 = NULL, int dataLen2 = 0); + bool InternalSend(UdpChannel channel, const uchar *data, int dataLen, const uchar *data2 = nullptr, int dataLen2 = 0); uchar *InternalAckSend(uchar *bufferedAckPtr, const uchar *ackPtr, int ackLen); // used by reliable channel to send acks (special send that allows for deduping ack feature) @@ -1573,7 +1573,7 @@ class UdpReliableChannel void ProcessPacket(ReliablePacketMode mode, const uchar *data, int dataLen); bool PullDown(int windowSpaceLeft); void FlushCoalesce(); - void SendCoalesce(const uchar *data, int dataLen, const uchar *data2 = NULL, int dataLen2 = 0); + void SendCoalesce(const uchar *data, int dataLen, const uchar *data2 = nullptr, int dataLen2 = 0); void QueueLogicalPacket(const LogicalPacket *packet); UdpManager::ReliableConfig mConfig; @@ -1627,7 +1627,7 @@ class UdpReliableChannel template FixedLogicalPacket::FixedLogicalPacket(const void *data, int dataLen) { mDataLen = dataLen; - if (data != NULL) + if (data != nullptr) memcpy(mData, data, mDataLen); } @@ -1657,7 +1657,7 @@ template void FixedLogicalPacket::SetDataLen(int l ///////////////////////////////////////////////////////////////////////// template StructLogicalPacket::StructLogicalPacket(T *initData) { - if (initData != NULL) + if (initData != nullptr) mStruct = *initData; } @@ -1802,7 +1802,7 @@ inline void UdpManager::SetPriority(UdpConnection *con, UdpMisc::ClockStamp stam if (stamp < mMinimumScheduledStamp) stamp = mMinimumScheduledStamp; - if (mPriorityQueue != NULL) + if (mPriorityQueue != nullptr) mPriorityQueue->Add(con, stamp); } @@ -1829,7 +1829,7 @@ inline void UdpManager::PoolReturn(PooledLogicalPacket *packet) inline void UdpManager::WrappedReturn(WrappedLogicalPacket *wp) { - wp->SetLogicalPacket(NULL); + wp->SetLogicalPacket(nullptr); if (mWrappedAvailable < mParams.wrappedPoolMax) { @@ -1877,7 +1877,7 @@ inline void UdpConnection::ScheduleTimeNow() // prevents us from reprioritizing to 0, only to shortly thereafter be reprioritized to where we actually belong. if (!mGettingTime) { - if (mUdpManager != NULL) + if (mUdpManager != nullptr) mUdpManager->SetPriority(this, 0); } } @@ -2066,7 +2066,7 @@ inline int UdpReliableChannel::TotalPendingBytes() const inline void UdpReliableChannel::ClearBufferedAck() { - mBufferedAckPtr = NULL; + mBufferedAckPtr = nullptr; } inline udp_int64 UdpReliableChannel::GetReliableOutgoingId(int reliableStamp) const diff --git a/external/3rd/library/udplibrary/PointerDeque.hpp b/external/3rd/library/udplibrary/PointerDeque.hpp index 6124afd8..8cc2ccc2 100644 --- a/external/3rd/library/udplibrary/PointerDeque.hpp +++ b/external/3rd/library/udplibrary/PointerDeque.hpp @@ -2,7 +2,7 @@ #define POINTERDEQUE_HPP // This is a simple double ended queue template. Any pointer-type can be stored in this deque - // I pop/peek return NULL if the queue is empty. + // I pop/peek return nullptr if the queue is empty. template class PointerDeque { public: @@ -32,7 +32,7 @@ template class PointerDeque template PointerDeque::PointerDeque(int entriesPerPage) { mEntriesPerPage = entriesPerPage; - mEntries = NULL; + mEntries = nullptr; mOffsetLeft = 0; mEntriesMax = 0; mEntriesCount = 0; @@ -73,7 +73,7 @@ template void PointerDeque::PushLeft(T* obj) template T* PointerDeque::PopLeft() { if (mEntriesCount == 0) - return(NULL); + return(nullptr); T* hold = mEntries[mOffsetLeft]; mOffsetLeft = (mOffsetLeft + 1) % mEntriesMax; mEntriesCount--; @@ -91,7 +91,7 @@ template void PointerDeque::PushRight(T* obj) template T* PointerDeque::PopRight() { if (mEntriesCount == 0) - return(NULL); + return(nullptr); mEntriesCount--; return(mEntries[(mOffsetLeft + mEntriesCount) % mEntriesMax]); } @@ -99,21 +99,21 @@ template T* PointerDeque::PopRight() template T* PointerDeque::PeekLeft() { if (mEntriesCount == 0) - return(NULL); + return(nullptr); return(mEntries[mOffsetLeft]); } template T* PointerDeque::PeekRight() { if (mEntriesCount == 0) - return(NULL); + return(nullptr); return(mEntries[(mOffsetLeft + mEntriesCount - 1) % mEntriesMax]); } template T* PointerDeque::Peek(int index) { if (index >= mEntriesCount) - return(NULL); + return(nullptr); return(mEntries[(mOffsetLeft + index) % mEntriesMax]); } diff --git a/external/3rd/library/udplibrary/UdpLibrary.cpp b/external/3rd/library/udplibrary/UdpLibrary.cpp index a84e147d..c8436157 100755 --- a/external/3rd/library/udplibrary/UdpLibrary.cpp +++ b/external/3rd/library/udplibrary/UdpLibrary.cpp @@ -144,7 +144,7 @@ UdpIpAddress::UdpIpAddress(unsigned int ip) char *UdpIpAddress::GetAddress(char *buffer) const { - assert(buffer != NULL); + assert(buffer != nullptr); struct sockaddr_in addr_serverUDP; addr_serverUDP.sin_addr.s_addr = mIp; @@ -157,7 +157,7 @@ char *UdpIpAddress::GetAddress(char *buffer) const ///////////////////////////////////////////////////////////////////////////////////////////////////// UdpManager::Params::Params() { - handler = NULL; + handler = nullptr; outgoingBufferSize = 64 * 1024; incomingBufferSize = 64 * 1024; packetHistoryMax = 100; @@ -258,7 +258,7 @@ UdpManager::UdpManager(const UdpManager::Params *params) mParams.maxDataHoldSize = udpMin(mParams.maxDataHoldSize, mParams.maxRawPacketSize); mParams.packetHistoryMax = udpMax(1, mParams.packetHistoryMax); mPacketHistoryPosition = 0; - mPassThroughData = NULL; + mPassThroughData = nullptr; typedef PacketHistoryEntry *PacketHistoryEntryPtr; mPacketHistory = new PacketHistoryEntryPtr[mParams.packetHistoryMax]; @@ -279,17 +279,17 @@ UdpManager::UdpManager(const UdpManager::Params *params) mUdpSocket = INVALID_SOCKET; mConnectionListCount = 0; - mConnectionList = NULL; + mConnectionList = nullptr; mPoolCreated = 0; mPoolAvailable = 0; - mPoolAvailableRoot = NULL; - mPoolCreatedRoot = NULL; + mPoolAvailableRoot = nullptr; + mPoolCreatedRoot = nullptr; mWrappedCreated = 0; mWrappedAvailable = 0; - mWrappedAvailableRoot = NULL; - mWrappedCreatedRoot = NULL; + mWrappedAvailableRoot = nullptr; + mWrappedCreatedRoot = nullptr; for (i = 0; i < mParams.pooledPacketInitial && i < mParams.pooledPacketMax; i++) { @@ -299,16 +299,16 @@ UdpManager::UdpManager(const UdpManager::Params *params) lp->Release(); } - mSimulateQueueStart = NULL; - mSimulateQueueEnd = NULL; + mSimulateQueueStart = nullptr; + mSimulateQueueEnd = nullptr; mSimulateNextOutgoingTime = 0; mSimulateNextIncomingTime = 0; mSimulateQueueBytes = 0; - mDisconnectPendingList = NULL; + mDisconnectPendingList = nullptr; if (mParams.avoidPriorityQueue) - mPriorityQueue = NULL; + mPriorityQueue = nullptr; else mPriorityQueue = new PriorityQueue(mParams.maxConnections); @@ -339,14 +339,14 @@ UdpManager::~UdpManager() // first we need to tell all the pooled packets we have created that they can no longer check themselves back into use // when they are released PooledLogicalPacket *walk = mPoolCreatedRoot; - while (walk != NULL) + while (walk != nullptr) { - walk->mUdpManager = NULL; + walk->mUdpManager = nullptr; walk = walk->mCreatedNext; } // next release the ones we have in our available pool walk = mPoolAvailableRoot; - while (walk != NULL) + while (walk != nullptr) { PooledLogicalPacket *hold = walk; walk = walk->mAvailableNext; @@ -359,14 +359,14 @@ UdpManager::~UdpManager() // next we need to tell all the warpped packets we have created that they can no longer check themselves back into use // when they are released WrappedLogicalPacket *walk = mWrappedCreatedRoot; - while (walk != NULL) + while (walk != nullptr) { - walk->mUdpManager = NULL; + walk->mUdpManager = nullptr; walk = walk->mCreatedNext; } // next release the ones we have in our available pool walk = mWrappedAvailableRoot; - while (walk != NULL) + while (walk != nullptr) { WrappedLogicalPacket *hold = walk; walk = walk->mAvailableNext; @@ -376,7 +376,7 @@ UdpManager::~UdpManager() // next thing we must do is tell all the connections to disconnect (which severs their link to this dying manager) // this has to be done first since they will call back into us and have themselves removed from our connection-list/priority-queue/etc - while (mConnectionList != NULL) + while (mConnectionList != nullptr) { mConnectionList->InternalDisconnect(0, UdpConnection::cDisconnectReasonManagerDeleted); // the above call ended up calling us back and removing them from our connection list, so now mConnectionList is pointing to the next entry @@ -384,7 +384,7 @@ UdpManager::~UdpManager() } // release any objects that were pending disconnection - while (mDisconnectPendingList != NULL) + while (mDisconnectPendingList != nullptr) { UdpConnection *next = mDisconnectPendingList->mDisconnectPendingNextConnection; mDisconnectPendingList->Release(); @@ -404,7 +404,7 @@ UdpManager::~UdpManager() } delete[] mPacketHistory; - while (mSimulateQueueStart != NULL) + while (mSimulateQueueStart != nullptr) { SimulateQueueEntry *entry = mSimulateQueueStart; mSimulateQueueStart = entry->mNext; @@ -517,12 +517,12 @@ void UdpManager::ProcessDisconnectPending() { UdpConnection *entry = mDisconnectPendingList; UdpConnection **prev = &mDisconnectPendingList; - while (entry != NULL) + while (entry != nullptr) { if (entry->GetStatus() == UdpConnection::cStatusDisconnected) { *prev = entry->mDisconnectPendingNextConnection; - entry->mDisconnectPendingNextConnection = NULL; + entry->mDisconnectPendingNextConnection = nullptr; entry->Release(); entry = *prev; } @@ -536,19 +536,19 @@ void UdpManager::ProcessDisconnectPending() void UdpManager::RemoveConnection(UdpConnection *con) { - assert(con != NULL); // attemped to remove a NULL connection object + assert(con != nullptr); // attemped to remove a nullptr connection object // note: it's a bug to Remove a connection object that is already removed...should never be able to happen. mConnectionListCount--; - if (con->mPrevConnection != NULL) + if (con->mPrevConnection != nullptr) con->mPrevConnection->mNextConnection = con->mNextConnection; - if (con->mNextConnection != NULL) + if (con->mNextConnection != nullptr) con->mNextConnection->mPrevConnection = con->mPrevConnection; if (mConnectionList == con) mConnectionList = con->mNextConnection; - con->mNextConnection = NULL; - con->mPrevConnection = NULL; - if (mPriorityQueue != NULL) + con->mNextConnection = nullptr; + con->mPrevConnection = nullptr; + if (mPriorityQueue != nullptr) mPriorityQueue->Remove(con); mAddressHashTable->Remove(con, AddressHashValue(con->mIp, con->mPort)); @@ -557,11 +557,11 @@ void UdpManager::RemoveConnection(UdpConnection *con) void UdpManager::AddConnection(UdpConnection *con) { - assert(con != NULL); // attemped to add a NULL connection object + assert(con != nullptr); // attemped to add a nullptr connection object con->mNextConnection = mConnectionList; - con->mPrevConnection = NULL; - if (mConnectionList != NULL) + con->mPrevConnection = nullptr; + if (mConnectionList != nullptr) mConnectionList->mPrevConnection = con; mConnectionList = con; mConnectionListCount++; @@ -574,7 +574,7 @@ void UdpManager::FlushAllMultiBuffer() { AddRef(); UdpConnection *cur = mConnectionList; - while (cur != NULL) + while (cur != nullptr) { cur->FlushMultiBuffer(); cur = cur->mNextConnection; @@ -597,7 +597,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) { PacketHistoryEntry *e = ActualReceive(); - if (e == NULL) + if (e == nullptr) { mLastEmptySocketBufferStamp = UdpMisc::Clock(); break; @@ -625,7 +625,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) if (giveConnectionsTime) { - if (mPriorityQueue != NULL) + if (mPriorityQueue != nullptr) { // give time to everybody in the priority-queue that needs it UdpMisc::ClockStamp curPriority = UdpMisc::Clock(); @@ -643,7 +643,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) for (;;) { UdpConnection *top = mPriorityQueue->TopRemove(curPriority); - if (top == NULL) + if (top == nullptr) break; top->AddRef(); top->GiveTime(); @@ -656,7 +656,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) { // give time to everybody UdpConnection *cur = mConnectionList; - while (cur != NULL) + while (cur != nullptr) { cur->GiveTime(); cur = cur->mNextConnection; @@ -666,7 +666,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) ProcessDisconnectPending(); } - if (mSimulateQueueStart != NULL && UdpMisc::Clock() >= mSimulateNextOutgoingTime) + if (mSimulateQueueStart != nullptr && UdpMisc::Clock() >= mSimulateNextOutgoingTime) { SimulateQueueEntry *entry = mSimulateQueueStart; mSimulateQueueStart = mSimulateQueueStart->mNext; @@ -674,7 +674,7 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) ActualSendHelper(entry->mData, entry->mDataLen, entry->mIp, entry->mPort); UdpConnection *con = AddressGetConnection(entry->mIp, entry->mPort); - if (con != NULL) + if (con != nullptr) con->mSimulateQueueBytes -= entry->mDataLen; mSimulateQueueBytes -= entry->mDataLen; delete entry; @@ -687,11 +687,11 @@ bool UdpManager::GiveTime(int maxPollingTime, bool giveConnectionsTime) UdpConnection *UdpManager::EstablishConnection(const char *serverAddress, int serverPort, int timeout) { assert(serverPort != 0); // can't connect to no port - assert(serverAddress != NULL); + assert(serverAddress != nullptr); assert(serverAddress[0] != 0); if (mConnectionListCount >= mParams.maxConnections) - return(NULL); + return(nullptr); // get server address unsigned long address = inet_addr(serverAddress); @@ -699,16 +699,16 @@ UdpConnection *UdpManager::EstablishConnection(const char *serverAddress, int se { struct hostent * lphp; lphp = gethostbyname(serverAddress); - if (lphp == NULL) - return(NULL); + if (lphp == nullptr) + return(nullptr); address = ((struct in_addr *)(lphp->h_addr))->s_addr; } UdpIpAddress destIp(address); // first, see if we already have a connection object managing this ip/port, if we do, then fail UdpConnection *con = AddressGetConnection(destIp, serverPort); - if (con != NULL) - return(NULL); + if (con != nullptr) + return(nullptr); return(new UdpConnection(this, destIp, serverPort, timeout)); } @@ -721,7 +721,7 @@ void UdpManager::KeepUntilDisconnected(UdpConnection *con) void UdpManager::GetStats(UdpManagerStatistics *stats) const { - assert(stats != NULL); + assert(stats != nullptr); *stats = mManagerStats; stats->poolAvailable = mPoolAvailable; stats->poolCreated = mPoolCreated; @@ -736,10 +736,10 @@ void UdpManager::ResetStats() void UdpManager::DumpPacketHistory(const char *filename) const { - assert(filename != NULL); + assert(filename != nullptr); assert(filename[0] != 0); FILE *file = fopen(filename, "wt"); - if (file != NULL) + if (file != nullptr) { // dump history of packets... for (int i = 0; i < mParams.packetHistoryMax; i++) @@ -785,7 +785,7 @@ int UdpManager::GetLocalPort() const UdpManager::PacketHistoryEntry *UdpManager::ActualReceive() { if (mParams.simulateIncomingByteRate > 0 && UdpMisc::Clock() < mSimulateNextIncomingTime) - return(NULL); + return(nullptr); struct sockaddr_in addr_from; socklen_t sf = sizeof(addr_from); @@ -795,7 +795,7 @@ UdpManager::PacketHistoryEntry *UdpManager::ActualReceive() if (res != SOCKET_ERROR) { if (mParams.simulateIncomingLossPercent > 0 && ((rand() % 100) < mParams.simulateIncomingLossPercent)) - return(NULL); // packet, what packet? + return(nullptr); // packet, what packet? if (mParams.simulateIncomingByteRate > 0) mSimulateNextIncomingTime = UdpMisc::Clock() + (res * 1000 / mParams.simulateIncomingByteRate); @@ -820,7 +820,7 @@ UdpManager::PacketHistoryEntry *UdpManager::ActualReceive() UdpIpAddress ip = UdpIpAddress(addr_from.sin_addr.s_addr); int port = (int)ntohs(addr_from.sin_port); UdpConnection *con = AddressGetConnection(ip, port); - if (con != NULL) + if (con != nullptr) { con->AddRef(); con->PortUnreachable(); @@ -840,7 +840,7 @@ UdpManager::PacketHistoryEntry *UdpManager::ActualReceive() } #endif } - return(NULL); + return(nullptr); } void UdpManager::ProcessIcmpErrors() @@ -868,7 +868,7 @@ void UdpManager::ProcessIcmpErrors() struct cmsghdr * cmsg; if(CMSG_FIRSTHDR(&msgh)) { - for(cmsg = CMSG_FIRSTHDR(&msgh); cmsg != NULL; cmsg = CMSG_NXTHDR(&msgh, cmsg)) + for(cmsg = CMSG_FIRSTHDR(&msgh); cmsg != nullptr; cmsg = CMSG_NXTHDR(&msgh, cmsg)) { if(cmsg->cmsg_level == SOL_IP && cmsg->cmsg_type == IP_RECVERR) { @@ -882,7 +882,7 @@ void UdpManager::ProcessIcmpErrors() UdpIpAddress ip = UdpIpAddress(msg_name.sin_addr.s_addr); int port = (int)htons(msg_name.sin_port); UdpConnection *con = AddressGetConnection(ip, port); - if (con != NULL) + if (con != nullptr) { con->AddRef(); con->PortUnreachable(); @@ -911,7 +911,7 @@ void UdpManager::ActualSend(const uchar *data, int dataLen, UdpIpAddress ip, int { // simulating outgoing byte-rate, so queue it up for sending later UdpConnection *con = AddressGetConnection(ip, port); - if (con != NULL) + if (con != nullptr) { if (mParams.simulateDestinationOverloadLevel > 0 && con->mSimulateQueueBytes + dataLen > mParams.simulateDestinationOverloadLevel) return; // no room, packet gets lost @@ -919,17 +919,17 @@ void UdpManager::ActualSend(const uchar *data, int dataLen, UdpIpAddress ip, int if (mParams.simulateOutgoingOverloadLevel > 0 && mSimulateQueueBytes + dataLen > mParams.simulateOutgoingOverloadLevel) return; // no room, packet gets lost - if (con != NULL) + if (con != nullptr) con->mSimulateQueueBytes += dataLen; mSimulateQueueBytes += dataLen; SimulateQueueEntry *entry = new SimulateQueueEntry(data, dataLen, ip, port); - if (mSimulateQueueStart != NULL) + if (mSimulateQueueStart != nullptr) mSimulateQueueEnd->mNext = entry; else mSimulateQueueStart = entry; mSimulateQueueEnd = entry; - mSimulateQueueEnd->mNext = NULL; + mSimulateQueueEnd->mNext = nullptr; return; } ActualSendHelper(data, dataLen, ip, port); @@ -952,7 +952,7 @@ void UdpManager::ActualSendHelper(const uchar *data, int dataLen, UdpIpAddress i // flag connection to terminate itself for port-unreachable error on next give time // we need to flag it instead of actually terminating it to prevent callbacks from occuring during application sends UdpConnection *con = AddressGetConnection(ip, port); - if (con != NULL) + if (con != nullptr) con->FlagPortUnreachable(); return; } @@ -990,7 +990,7 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) UdpConnection *con = AddressGetConnection(e->mIp, e->mPort); - if (con == NULL) + if (con == nullptr) { // packet coming from an unknown ip/port // if it is a connection request packet, then establish a new connection object to reply to it @@ -1003,7 +1003,7 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) int protocolVersion = UdpMisc::GetValue32(e->mBuffer + 2); if (protocolVersion == cProtocolVersion) { - if (mParams.handler != NULL) + if (mParams.handler != nullptr) { UdpConnection *newcon = new UdpConnection(this, e); mParams.handler->OnConnectRequest(newcon); @@ -1032,7 +1032,7 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) int encryptCode = UdpMisc::GetValue32(ptr); UdpConnection *con = ConnectCodeGetConnection(connectCode); - if (con != NULL) + if (con != nullptr) { if (mParams.allowAddressRemapping || con->mIp == e->mIp) { @@ -1082,25 +1082,25 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) UdpConnection *UdpManager::AddressGetConnection(UdpIpAddress ip, int port) const { UdpConnection *found = static_cast(mAddressHashTable->FindFirst(AddressHashValue(ip, port))); - while (found != NULL) + while (found != nullptr) { if (found->mIp == ip && found->mPort == port) return(found); found = static_cast(mAddressHashTable->FindNext(found)); } - return(NULL); + return(nullptr); } UdpConnection *UdpManager::ConnectCodeGetConnection(int connectCode) const { UdpConnection *found = static_cast(mConnectCodeHashTable->FindFirst(connectCode)); - while (found != NULL) + while (found != nullptr) { if (found->mConnectCode == connectCode) return(found); found = static_cast(mConnectCodeHashTable->FindNext(found)); } - return(NULL); + return(nullptr); } WrappedLogicalPacket *UdpManager::WrappedBorrow(const LogicalPacket *lp) @@ -1124,7 +1124,7 @@ WrappedLogicalPacket *UdpManager::WrappedBorrow(const LogicalPacket *lp) void UdpManager::WrappedCreated(WrappedLogicalPacket *wp) { wp->mCreatedNext = mWrappedCreatedRoot; - if (mWrappedCreatedRoot != NULL) + if (mWrappedCreatedRoot != nullptr) mWrappedCreatedRoot->mCreatedPrev = wp; mWrappedCreatedRoot = wp; mWrappedCreated++; @@ -1132,11 +1132,11 @@ void UdpManager::WrappedCreated(WrappedLogicalPacket *wp) void UdpManager::WrappedDestroyed(WrappedLogicalPacket *wp) { - if (wp->mCreatedNext != NULL) + if (wp->mCreatedNext != nullptr) { wp->mCreatedNext->mCreatedPrev = wp->mCreatedPrev; } - if (wp->mCreatedPrev != NULL) + if (wp->mCreatedPrev != nullptr) { wp->mCreatedPrev->mCreatedNext = wp->mCreatedNext; } @@ -1146,9 +1146,9 @@ void UdpManager::WrappedDestroyed(WrappedLogicalPacket *wp) mWrappedCreatedRoot = wp->mCreatedNext; } - wp->mCreatedPrev = NULL; - wp->mCreatedNext = NULL; - wp->mUdpManager = NULL; + wp->mCreatedPrev = nullptr; + wp->mCreatedNext = nullptr; + wp->mUdpManager = nullptr; mWrappedCreated--; } @@ -1183,7 +1183,7 @@ LogicalPacket *UdpManager::CreatePacket(const void *data, int dataLen, const voi void UdpManager::PoolCreated(PooledLogicalPacket *packet) { packet->mCreatedNext = mPoolCreatedRoot; - if (mPoolCreatedRoot != NULL) + if (mPoolCreatedRoot != nullptr) mPoolCreatedRoot->mCreatedPrev = packet; mPoolCreatedRoot = packet; mPoolCreated++; @@ -1191,11 +1191,11 @@ void UdpManager::PoolCreated(PooledLogicalPacket *packet) void UdpManager::PoolDestroyed(PooledLogicalPacket *packet) { - if (packet->mCreatedNext != NULL) + if (packet->mCreatedNext != nullptr) { packet->mCreatedNext->mCreatedPrev = packet->mCreatedPrev; } - if (packet->mCreatedPrev != NULL) + if (packet->mCreatedPrev != nullptr) { packet->mCreatedPrev->mCreatedNext = packet->mCreatedNext; } @@ -1205,9 +1205,9 @@ void UdpManager::PoolDestroyed(PooledLogicalPacket *packet) mPoolCreatedRoot = packet->mCreatedNext; } - packet->mCreatedPrev = NULL; - packet->mCreatedNext = NULL; - packet->mUdpManager = NULL; + packet->mCreatedPrev = nullptr; + packet->mCreatedNext = nullptr; + packet->mUdpManager = nullptr; mPoolCreated--; } @@ -1282,7 +1282,7 @@ void UdpConnection::Init(UdpManager *udpManager, UdpIpAddress destIp, int destPo mLastClockSyncTime = 0; mDataHoldTime = 0; mGettingTime = false; - mHandler = NULL; + mHandler = nullptr; mNoDataTimeout = mUdpManager->mParams.noDataTimeout; mKeepAliveDelay = mUdpManager->mParams.keepAliveDelay; @@ -1290,13 +1290,13 @@ void UdpConnection::Init(UdpManager *udpManager, UdpIpAddress destIp, int destPo mMultiBufferData = new uchar[mUdpManager->mParams.maxRawPacketSize]; mMultiBufferPtr = mMultiBufferData; - mDisconnectPendingNextConnection = NULL; - mNextConnection = NULL; - mPrevConnection = NULL; + mDisconnectPendingNextConnection = nullptr; + mNextConnection = nullptr; + mPrevConnection = nullptr; mIcmpErrorRetryStartStamp = 0; // when the timer started for ICMP error retry delay (gets reset on a successful packet receive) mPortRemapRequestStartStamp = 0; - mEncryptXorBuffer = NULL; + mEncryptXorBuffer = nullptr; mEncryptExpansionBytes = 0; mOrderedCountOutgoing = 0; mOrderedCountOutgoing2 = 0; @@ -1307,7 +1307,7 @@ void UdpConnection::Init(UdpManager *udpManager, UdpIpAddress destIp, int destPo mConnectionCreateTime = UdpMisc::Clock(); mSimulateQueueBytes = 0; - mPassThroughData = NULL; + mPassThroughData = nullptr; mSilentDisconnect = false; mLastSendBin = 0; @@ -1325,7 +1325,7 @@ void UdpConnection::Init(UdpManager *udpManager, UdpIpAddress destIp, int destPo UdpConnection::~UdpConnection() { - if (mUdpManager != NULL) + if (mUdpManager != nullptr) InternalDisconnect(0, mDisconnectReason); for (int i = 0; i < UdpManager::cReliableChannelCount; i++) @@ -1372,7 +1372,7 @@ void UdpConnection::InternalDisconnect(int flushTimeout, DisconnectReason reason if (mStatus == cStatusNegotiating) flushTimeout = 0; - if (mUdpManager != NULL) + if (mUdpManager != nullptr) { if (flushTimeout > 0) { @@ -1402,13 +1402,13 @@ void UdpConnection::InternalDisconnect(int flushTimeout, DisconnectReason reason } mUdpManager->RemoveConnection(this); - mUdpManager = NULL; + mUdpManager = nullptr; } mStatus = cStatusDisconnected; - if (startStatus != cStatusDisconnected && startUdpManager != NULL) + if (startStatus != cStatusDisconnected && startUdpManager != nullptr) { - if (mHandler != NULL) + if (mHandler != nullptr) mHandler->OnTerminated(this); } } @@ -1442,7 +1442,7 @@ bool UdpConnection::Send(UdpChannel channel, const void *data, int dataLen) if (dataLen == 0) // zero length packets are ignored return(false); - assert(data != NULL); // can't send a null packet + assert(data != nullptr); // can't send a nullptr packet mUdpManager->mManagerStats.applicationPacketsSent++; mConnectionStats.applicationPacketsSent++; @@ -1459,7 +1459,7 @@ bool UdpConnection::Send(UdpChannel channel, const void *data, int dataLen) bool UdpConnection::Send(UdpChannel channel, const LogicalPacket *packet) { - assert(packet != NULL); // can't send a null packet + assert(packet != nullptr); // can't send a nullptr packet assert(channel >= 0 && channel < cUdpChannelCount); assert(mStatus != cStatusNegotiating); // you are not allowed to start sending data on a connection that is still in the process of negotiating (only applicable client-side obviously since servers never have connections in this state) @@ -1505,7 +1505,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const uchar *data, int data { uchar *bufPtr = tempBuffer; memcpy(bufPtr, data, dataLen); - if (data2 != NULL) + if (data2 != nullptr) memcpy(bufPtr + dataLen, data2, dataLen2); PhysicalSend(bufPtr, totalDataLen, true); return(true); @@ -1518,9 +1518,9 @@ bool UdpConnection::InternalSend(UdpChannel channel, const uchar *data, int data bufPtr[1] = cUdpPacketOrdered2; UdpMisc::PutValue16(bufPtr + 2, (ushort)(++mOrderedCountOutgoing2 & 0xffff)); memcpy(bufPtr + 4, data, dataLen); - if (data2 != NULL) + if (data2 != nullptr) memcpy(bufPtr + 4 + dataLen, data2, dataLen2); - BufferedSend(bufPtr, totalDataLen + 4, NULL, 0, true); + BufferedSend(bufPtr, totalDataLen + 4, nullptr, 0, true); return(true); break; } @@ -1531,7 +1531,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const uchar *data, int data bufPtr[1] = cUdpPacketOrdered2; UdpMisc::PutValue16(bufPtr + 2, (ushort)(++mOrderedCountOutgoing2 & 0xffff)); memcpy(bufPtr + 4, data, dataLen); - if (data2 != NULL) + if (data2 != nullptr) memcpy(bufPtr + 4 + dataLen, data2, dataLen2); PhysicalSend(bufPtr, totalDataLen + 4, true); return(true); @@ -1543,7 +1543,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const uchar *data, int data case cUdpChannelReliable4: { int num = channel - cUdpChannelReliable1; - if (mChannel[num] == NULL) + if (mChannel[num] == nullptr) mChannel[num] = new UdpReliableChannel(num, this, &mUdpManager->mParams.reliable[num]); mChannel[num]->Send(data, dataLen, data2, dataLen2); return(true); @@ -1565,7 +1565,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const LogicalPacket *packet case cUdpChannelReliable4: { int num = channel - cUdpChannelReliable1; - if (mChannel[num] == NULL) + if (mChannel[num] == nullptr) mChannel[num] = new UdpReliableChannel(num, this, &mUdpManager->mParams.reliable[num]); mChannel[num]->Send(packet); return(true); @@ -1605,9 +1605,9 @@ void UdpConnection::PingStatReset() void UdpConnection::GetStats(UdpConnectionStatistics *cs) const { - assert(cs != NULL); + assert(cs != nullptr); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; *cs = mConnectionStats; @@ -1623,13 +1623,13 @@ void UdpConnection::GetStats(UdpConnectionStatistics *cs) const if (cs->syncTheirSent > 0) cs->percentReceivedSuccess = (float)cs->syncOurReceived / (float)cs->syncTheirSent; cs->reliableAveragePing = 0; - if (mChannel[0] != NULL) + if (mChannel[0] != nullptr) cs->reliableAveragePing = mChannel[0]->GetAveragePing(); } void UdpConnection::ProcessRawPacket(const UdpManager::PacketHistoryEntry *e) { - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; if (e->mBuffer[0] != 0 || e->mBuffer[1] != cUdpPacketUnreachableConnection) @@ -1731,7 +1731,7 @@ void UdpConnection::ProcessRawPacket(const UdpManager::PacketHistoryEntry *e) { mConnectionStats.crcRejectedPackets++; mUdpManager->mManagerStats.crcRejectedPackets++; - if (mHandler != NULL) + if (mHandler != nullptr) mHandler->OnCrcReject(this, e->mBuffer, e->mLen); return; } @@ -1792,7 +1792,7 @@ void UdpConnection::CallbackRoutePacket(const uchar *data, int dataLen) mUdpManager->mManagerStats.applicationPacketsReceived++; mConnectionStats.applicationPacketsReceived++; - if (mHandler != NULL) + if (mHandler != nullptr) mHandler->OnRoutePacket(this, data, dataLen); } } @@ -1801,7 +1801,7 @@ void UdpConnection::CallbackCorruptPacket(const uchar *data, int dataLen, UdpCor { mConnectionStats.corruptPacketErrors++; mUdpManager->mManagerStats.corruptPacketErrors++; - if (mHandler != NULL) + if (mHandler != nullptr) mHandler->OnPacketCorrupt(this, data, dataLen, reason); } @@ -1809,7 +1809,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) { uchar buf[256]; uchar *bufPtr; - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; if (data[0] == 0 && dataLen > 1) @@ -1882,7 +1882,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) mConnectionConfig = config; SetupEncryptModel(); mStatus = cStatusConnected; - if (mHandler != NULL) + if (mHandler != nullptr) mHandler->OnConnectComplete(this); } break; @@ -2112,7 +2112,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) case cUdpPacketFragment4: { int num = (data[1] - cUdpPacketReliable1) % UdpManager::cReliableChannelCount; - if (mChannel[num] == NULL) + if (mChannel[num] == nullptr) mChannel[num] = new UdpReliableChannel(num, this, &mUdpManager->mParams.reliable[num]); mChannel[num]->ReliablePacket(data, dataLen); break; @@ -2123,7 +2123,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) case cUdpPacketAck4: { int num = data[1] - cUdpPacketAck1; - if (mChannel[num] != NULL) + if (mChannel[num] != nullptr) mChannel[num]->AckPacket(data, dataLen); break; } @@ -2133,7 +2133,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) case cUdpPacketAckAll4: { int num = data[1] - cUdpPacketAckAll1; - if (mChannel[num] != NULL) + if (mChannel[num] != nullptr) mChannel[num]->AckAllPacket(data, dataLen); break; } @@ -2173,7 +2173,7 @@ void UdpConnection::FlagPortUnreachable() void UdpConnection::GiveTime() { - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; UdpManager *myManager = mUdpManager; @@ -2266,11 +2266,11 @@ void UdpConnection::InternalGiveTime() int totalPendingBytes = 0; for (int i = 0; i < UdpManager::cReliableChannelCount; i++) { - if (mChannel[i] != NULL) + if (mChannel[i] != nullptr) { totalPendingBytes += mChannel[i]->TotalPendingBytes(); int myNext = mChannel[i]->GiveTime(); - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; // giving the reliable channel time caused it to callback the application which may disconnect us nextSchedule = udpMin(nextSchedule, myNext); } @@ -2359,7 +2359,7 @@ void UdpConnection::InternalGiveTime() break; } - if (mUdpManager != NULL) + if (mUdpManager != nullptr) { // safety to prevent us for scheduling ourselves for a time period that has already passed, // as doing so could result in infinite looping in the priority queue processing. @@ -2376,7 +2376,7 @@ int UdpConnection::TotalPendingBytes() const int total = 0; for (int i = 0; i < UdpManager::cReliableChannelCount; i++) { - if (mChannel[i] != NULL) + if (mChannel[i] != nullptr) total += mChannel[i]->TotalPendingBytes(); } return(total); @@ -2442,7 +2442,7 @@ int UdpConnection::ExpireReceiveBin() void UdpConnection::PhysicalSend(const uchar *data, int dataLen, bool appendAllowed) { - if (mUdpManager == NULL) + if (mUdpManager == nullptr) return; // if we attempt to do a physical send (ie. encrypt/compress/crc a packet) while we are not connected @@ -2540,8 +2540,8 @@ void UdpConnection::PhysicalSend(const uchar *data, int dataLen, bool appendAllo // function can do its job uchar *UdpConnection::BufferedSend(const uchar *data, int dataLen, const uchar *data2, int dataLen2, bool appendAllowed) { - if (mUdpManager == NULL) - return(NULL); + if (mUdpManager == nullptr) + return(nullptr); int used = mMultiBufferPtr - mMultiBufferData; int actualMaxDataHoldSize = udpMin(mUdpManager->mParams.maxDataHoldSize, mConnectionConfig.maxRawPacketSize); @@ -2556,7 +2556,7 @@ uchar *UdpConnection::BufferedSend(const uchar *data, int dataLen, const uchar * FlushMultiBuffer(); // now send it (the multi-buffer is empty if you need to use it temporarily to concatenate two data chunks -- it is large enough to hold the largest raw packet) - if (data2 != NULL) + if (data2 != nullptr) { memcpy(mMultiBufferData, data, dataLen); memcpy(mMultiBufferData + dataLen, data2, dataLen2); @@ -2564,7 +2564,7 @@ uchar *UdpConnection::BufferedSend(const uchar *data, int dataLen, const uchar * } else PhysicalSend(data, dataLen, appendAllowed); - return(NULL); + return(nullptr); } // if this data will not fit into buffer @@ -2592,7 +2592,7 @@ uchar *UdpConnection::BufferedSend(const uchar *data, int dataLen, const uchar * uchar *placementPtr = mMultiBufferPtr; memcpy(mMultiBufferPtr, data, dataLen); mMultiBufferPtr += dataLen; - if (data2 != NULL) + if (data2 != nullptr) { memcpy(mMultiBufferPtr, data2, dataLen2); mMultiBufferPtr += dataLen2; @@ -2601,21 +2601,21 @@ uchar *UdpConnection::BufferedSend(const uchar *data, int dataLen, const uchar * if ((mMultiBufferPtr - mMultiBufferData) >= actualMaxDataHoldSize) { FlushMultiBuffer(); - placementPtr = NULL; // it got flushed + placementPtr = nullptr; // it got flushed } return(placementPtr); } uchar *UdpConnection::InternalAckSend(uchar *bufferedAckPtr, const uchar *ackPtr, int ackLen) { - if (bufferedAckPtr != NULL) + if (bufferedAckPtr != nullptr) { memcpy(bufferedAckPtr, ackPtr, ackLen); return(bufferedAckPtr); } - BufferedSend(ackPtr, ackLen, NULL, 0, false); - return(NULL); // FIX THIS + BufferedSend(ackPtr, ackLen, nullptr, 0, false); + return(nullptr); // FIX THIS } void UdpConnection::FlushMultiBuffer() @@ -2631,7 +2631,7 @@ void UdpConnection::FlushMultiBuffer() // notify all the reliable channels to clear their buffered acks for (int i = 0; i < UdpManager::cReliableChannelCount; i++) { - if (mChannel[i] != NULL) + if (mChannel[i] != nullptr) { mChannel[i]->ClearBufferedAck(); } @@ -2656,7 +2656,7 @@ int UdpConnection::DecryptNone(uchar *destData, const uchar *sourceData, int sou int UdpConnection::EncryptUserSupplied(uchar *destData, const uchar *sourceData, int sourceLen) { UdpManagerHandler *manHandler = mUdpManager->GetHandler(); - if (manHandler != NULL) + if (manHandler != nullptr) return(manHandler->OnUserSuppliedEncrypt(this, destData, sourceData, sourceLen)); assert(0); // if user-supplied encryption is specified, then you must have a manager handler installed to provide the routines return(0); @@ -2665,7 +2665,7 @@ int UdpConnection::EncryptUserSupplied(uchar *destData, const uchar *sourceData, int UdpConnection::DecryptUserSupplied(uchar *destData, const uchar *sourceData, int sourceLen) { UdpManagerHandler *manHandler = mUdpManager->GetHandler(); - if (manHandler != NULL) + if (manHandler != nullptr) return(manHandler->OnUserSuppliedDecrypt(this, destData, sourceData, sourceLen)); assert(0); // if user-supplied encryption is specified, then you must have a manager handler installed to provide the routines return(0); @@ -2674,7 +2674,7 @@ int UdpConnection::DecryptUserSupplied(uchar *destData, const uchar *sourceData, int UdpConnection::EncryptUserSupplied2(uchar *destData, const uchar *sourceData, int sourceLen) { UdpManagerHandler *manHandler = mUdpManager->GetHandler(); - if (manHandler != NULL) + if (manHandler != nullptr) return(manHandler->OnUserSuppliedEncrypt2(this, destData, sourceData, sourceLen)); assert(0); // if user-supplied encryption is specified, then you must have a manager handler installed to provide the routines return(0); @@ -2683,7 +2683,7 @@ int UdpConnection::EncryptUserSupplied2(uchar *destData, const uchar *sourceData int UdpConnection::DecryptUserSupplied2(uchar *destData, const uchar *sourceData, int sourceLen) { UdpManagerHandler *manHandler = mUdpManager->GetHandler(); - if (manHandler != NULL) + if (manHandler != nullptr) return(manHandler->OnUserSuppliedDecrypt2(this, destData, sourceData, sourceLen)); assert(0); // if user-supplied encryption is specified, then you must have a manager handler installed to provide the routines return(0); @@ -2833,7 +2833,7 @@ void UdpConnection::SetupEncryptModel() mEncryptExpansionBytes += 0; // set up encrypt buffer (random numbers generated based on seed) - if (mEncryptXorBuffer == NULL) + if (mEncryptXorBuffer == nullptr) { int len = ((mUdpManager->mParams.maxRawPacketSize + 1) / 4) * 4; mEncryptXorBuffer = new uchar[len]; @@ -2865,7 +2865,7 @@ void UdpConnection::GetChannelStatus(UdpChannel channel, ChannelStatus *channelS case cUdpChannelReliable2: case cUdpChannelReliable3: case cUdpChannelReliable4: - if (mChannel[channel - cUdpChannelReliable1] != NULL) + if (mChannel[channel - cUdpChannelReliable1] != nullptr) { mChannel[channel - cUdpChannelReliable1]->GetChannelStatus(channelStatus); } @@ -2941,12 +2941,12 @@ UdpReliableChannel::UdpReliableChannel(int channelNumber, UdpConnection *con, Ud mLogicalPacketsQueued = 0; mLogicalBytesQueued = 0; - mCoalescePacket = NULL; - mCoalesceStartPtr = NULL; - mCoalesceEndPtr = NULL; + mCoalescePacket = nullptr; + mCoalesceStartPtr = nullptr; + mCoalesceEndPtr = nullptr; mCoalesceCount = 0; - mBufferedAckPtr = NULL; + mBufferedAckPtr = nullptr; mStatDuplicatePacketsReceived = 0; mStatResentPacketsAccelerated = 0; @@ -2960,7 +2960,7 @@ UdpReliableChannel::UdpReliableChannel(int channelNumber, UdpConnection *con, Ud mBigDataLen = 0; mBigDataTargetLen = 0; - mBigDataPtr = NULL; + mBigDataPtr = nullptr; mFragmentNextPos = 0; mLastTimeStampAcknowledged = 0; mMaxxedOutCurrentWindow = false; @@ -2969,23 +2969,23 @@ UdpReliableChannel::UdpReliableChannel(int channelNumber, UdpConnection *con, Ud mPhysicalPackets = new PhysicalPacket[mConfig.maxOutstandingPackets]; mReliableIncoming = new IncomingQueueEntry[mConfig.maxInstandingPackets]; - mLogicalRoot = NULL; - mLogicalEnd = NULL; + mLogicalRoot = nullptr; + mLogicalEnd = nullptr; } UdpReliableChannel::~UdpReliableChannel() { - if (mCoalescePacket != NULL) + if (mCoalescePacket != nullptr) { mCoalescePacket->Release(); - mCoalescePacket = NULL; + mCoalescePacket = nullptr; } const LogicalPacket *cur = mLogicalRoot; - while (cur != NULL) + while (cur != nullptr) { const LogicalPacket *next = cur->mReliableQueueNext; - cur->mReliableQueueNext = NULL; // make sure and mark it available so others could possibly use it (if it is a shared logical packet) + cur->mReliableQueueNext = nullptr; // make sure and mark it available so others could possibly use it (if it is a shared logical packet) cur->Release(); if (cur == next) // pointing to self, so this is end of list break; @@ -3052,7 +3052,7 @@ void UdpReliableChannel::Send(const LogicalPacket *packet) void UdpReliableChannel::FlushCoalesce() { - if (mCoalescePacket != NULL) + if (mCoalescePacket != nullptr) { if (mCoalesceCount == 1) { @@ -3069,16 +3069,16 @@ void UdpReliableChannel::FlushCoalesce() } mCoalescePacket->Release(); - mCoalescePacket = NULL; + mCoalescePacket = nullptr; } } void UdpReliableChannel::SendCoalesce(const uchar *data, int dataLen, const uchar *data2, int dataLen2) { int totalLen = dataLen + dataLen2; - if (mCoalescePacket == NULL) + if (mCoalescePacket == nullptr) { - mCoalescePacket = mUdpConnection->mUdpManager->CreatePacket(NULL, mMaxDataBytes); + mCoalescePacket = mUdpConnection->mUdpManager->CreatePacket(nullptr, mMaxDataBytes); mCoalesceEndPtr = mCoalesceStartPtr = (uchar *)mCoalescePacket->GetDataPtr(); *mCoalesceEndPtr++ = 0; *mCoalesceEndPtr++ = UdpConnection::cUdpPacketGroup; @@ -3098,10 +3098,10 @@ void UdpReliableChannel::SendCoalesce(const uchar *data, int dataLen, const ucha // append on end of coalesce mCoalesceCount++; mCoalesceEndPtr += UdpMisc::PutVariableValue(mCoalesceEndPtr, totalLen); - if (data != NULL) + if (data != nullptr) memcpy(mCoalesceEndPtr, data, dataLen); mCoalesceEndPtr += dataLen; - if (data2 != NULL) + if (data2 != nullptr) memcpy(mCoalesceEndPtr, data2, dataLen2); mCoalesceEndPtr += dataLen2; } @@ -3111,7 +3111,7 @@ void UdpReliableChannel::QueueLogicalPacket(const LogicalPacket *packet) mLogicalPacketsQueued++; mLogicalBytesQueued += packet->GetDataLen(); - if (packet->mReliableQueueNext != NULL) + if (packet->mReliableQueueNext != nullptr) { packet = mUdpConnection->mUdpManager->WrappedBorrow(packet); } @@ -3121,13 +3121,13 @@ void UdpReliableChannel::QueueLogicalPacket(const LogicalPacket *packet) } packet->mReliableQueueNext = packet; // have it point to itself to signify that the mNext pointer is taken (ie. reserve it), yet still represents the end of the list - if (mLogicalEnd != NULL) + if (mLogicalEnd != nullptr) { mLogicalEnd->mReliableQueueNext = packet; } mLogicalEnd = packet; - if (mLogicalRoot == NULL) + if (mLogicalRoot == nullptr) { mLogicalRoot = packet; } @@ -3148,10 +3148,10 @@ bool UdpReliableChannel::PullDown(int windowSpaceLeft) int physicalCount = (int)(mReliableOutgoingId - mReliableOutgoingPendingId); while (windowSpaceLeft > 0 && physicalCount < mConfig.maxOutstandingPackets) { - if (mLogicalRoot == NULL) + if (mLogicalRoot == nullptr) { FlushCoalesce(); // this is guaranteed to stick - if (mLogicalRoot == NULL) + if (mLogicalRoot == nullptr) break; // nothing flushed, so we are done } @@ -3191,10 +3191,10 @@ bool UdpReliableChannel::PullDown(int windowSpaceLeft) mLogicalRoot = mLogicalRoot->mReliableQueueNext; if (mLogicalRoot == lp) // ie, we were pointing to ourself, meaning we were the end of the list { - mLogicalRoot = NULL; - mLogicalEnd = NULL; + mLogicalRoot = nullptr; + mLogicalEnd = nullptr; } - lp->mReliableQueueNext = NULL; // clear our next link since we are no longer using it (so somebody else can use it potentially) + lp->mReliableQueueNext = nullptr; // clear our next link since we are no longer using it (so somebody else can use it potentially) lp->Release(); // release from logical queue } else @@ -3249,9 +3249,9 @@ int UdpReliableChannel::GiveTime() // this next branch was replaced by JeffP in the latest UdpLibrary drop. Please integrate // that. If something catestrophic happens with reliable channels, uncomment this next line to // replace the existing branch - //if (mReliableOutgoingId < mReliableOutgoingPendingId || mLogicalRoot != NULL || mCoalescePacket != NULL) + //if (mReliableOutgoingId < mReliableOutgoingPendingId || mLogicalRoot != nullptr || mCoalescePacket != nullptr) - if (mReliableOutgoingPendingId < mReliableOutgoingId || mLogicalRoot != NULL || mCoalescePacket != NULL) + if (mReliableOutgoingPendingId < mReliableOutgoingId || mLogicalRoot != nullptr || mCoalescePacket != nullptr) { // first, let's calculate how many bytes we figure is outstanding based on who is still waiting for an ack-packet UdpMisc::ClockStamp oldestResendTime = udpMax(hotClock - optimalResendDelay, mLastTimeStampAcknowledged); // anything older than this, we need to resend @@ -3276,7 +3276,7 @@ int UdpReliableChannel::GiveTime() // if this packet has not been acked and it is NOT ready to be sent (was recently sent) then we consider it outstanding // note: packets needing re-sending probably got lost and are therefore not outstanding PhysicalPacket *entry = &mPhysicalPackets[i % mConfig.maxOutstandingPackets]; - if (entry->mDataPtr != NULL) // acked packets set the dataPtr to NULL + if (entry->mDataPtr != nullptr) // acked packets set the dataPtr to nullptr { // if this packet is ready to be sent (ie: needs time now, or some later packet has already been ack'ed) windowSpaceLeft -= entry->mDataLen; // window-space is effectively taken whether we have sent it yet or not @@ -3436,7 +3436,7 @@ int UdpReliableChannel::GiveTime() void UdpReliableChannel::GetChannelStatus(UdpConnection::ChannelStatus *channelStatus) const { int coalesceBytes = 0; - if (mCoalescePacket != NULL) + if (mCoalescePacket != nullptr) coalesceBytes = mCoalesceEndPtr - mCoalesceStartPtr; channelStatus->totalPendingBytes = mLogicalBytesQueued + mReliableOutgoingBytes + coalesceBytes; @@ -3497,7 +3497,7 @@ void UdpReliableChannel::ReliablePacket(const uchar *data, int dataLen) mReliableIncomingId++; // process other packets that have arrived - while (mReliableIncoming[mReliableIncomingId % mConfig.maxInstandingPackets].mPacket != NULL) + while (mReliableIncoming[mReliableIncomingId % mConfig.maxInstandingPackets].mPacket != nullptr) { int spot = (int)(mReliableIncomingId % mConfig.maxInstandingPackets); if (mReliableIncoming[spot].mMode != cReliablePacketModeDelivered) @@ -3506,7 +3506,7 @@ void UdpReliableChannel::ReliablePacket(const uchar *data, int dataLen) } mReliableIncoming[spot].mPacket->Release(); - mReliableIncoming[spot].mPacket = NULL; + mReliableIncoming[spot].mPacket = nullptr; mReliableIncomingId++; } } @@ -3514,7 +3514,7 @@ void UdpReliableChannel::ReliablePacket(const uchar *data, int dataLen) { // not the one we need next, but it is later than the one we need , so store it in our buffer until it's turn comes up int spot = (int)(reliableId % mConfig.maxInstandingPackets); - if (mReliableIncoming[spot].mPacket == NULL) // only make the copy of it if we don't already have it in our buffer (in cases where it was sent twice, there would be no harm in the copy again since it must be the same packet, it's just inefficient) + if (mReliableIncoming[spot].mPacket == nullptr) // only make the copy of it if we don't already have it in our buffer (in cases where it was sent twice, there would be no harm in the copy again since it must be the same packet, it's just inefficient) { mReliableIncoming[spot].mMode = mode; mReliableIncoming[spot].mPacket = mUdpConnection->mUdpManager->CreatePacket(data + UdpConnection::cUdpPacketReliableSize, dataLen - UdpConnection::cUdpPacketReliableSize); @@ -3556,16 +3556,16 @@ void UdpReliableChannel::ReliablePacket(const uchar *data, int dataLen) // a simple ack for us only *bufPtr++ = (uchar)(UdpConnection::cUdpPacketAck1 + mChannelNumber); bufPtr += UdpMisc::PutValue16(bufPtr, (ushort)(reliableId & 0xffff)); - mBufferedAckPtr = NULL; // not allowed to replace an old one with a selective-ack + mBufferedAckPtr = nullptr; // not allowed to replace an old one with a selective-ack } - if (mBufferedAckPtr != NULL && mConfig.ackDeduping) + if (mBufferedAckPtr != nullptr && mConfig.ackDeduping) { memcpy(mBufferedAckPtr, buf, bufPtr - buf); } else { - mBufferedAckPtr = mUdpConnection->BufferedSend(buf, bufPtr - buf, NULL, 0, true); // safe to append on our data, it is stack data + mBufferedAckPtr = mUdpConnection->BufferedSend(buf, bufPtr - buf, nullptr, 0, true); // safe to append on our data, it is stack data } } @@ -3582,7 +3582,7 @@ void UdpReliableChannel::ProcessPacket(ReliablePacketMode mode, const uchar *dat else if (mode == cReliablePacketModeFragment) { // append onto end of big packet (or create new big packet if not existing already) - if (mBigDataPtr == NULL) + if (mBigDataPtr == nullptr) { mBigDataTargetLen = UdpMisc::GetValue32(data); // first fragment has a total-length int header on it. mBigDataPtr = new uchar[mBigDataTargetLen]; @@ -3611,7 +3611,7 @@ void UdpReliableChannel::ProcessPacket(ReliablePacketMode mode, const uchar *dat delete[] mBigDataPtr; mBigDataLen = 0; mBigDataTargetLen = 0; - mBigDataPtr = NULL; + mBigDataPtr = nullptr; } } } @@ -3641,7 +3641,7 @@ void UdpReliableChannel::Ack(udp_int64 reliableId) int pos = (int)(reliableId % mConfig.maxOutstandingPackets); PhysicalPacket *entry = &mPhysicalPackets[pos]; - if (entry->mDataPtr != NULL) // if this packet has not been acknowledged yet (sometimes we get back two acks for the same packet) + if (entry->mDataPtr != nullptr) // if this packet has not been acknowledged yet (sometimes we get back two acks for the same packet) { mNextNeedTime = 0; // something got acked, so we actually need to take the time next time it is offered @@ -3699,14 +3699,14 @@ void UdpReliableChannel::Ack(udp_int64 reliableId) // this packet we have queued has been acknowledged, so delete it from queue mReliableOutgoingBytes -= entry->mDataLen; entry->mDataLen = 0; - entry->mDataPtr = NULL; + entry->mDataPtr = nullptr; entry->mParent->Release(); - entry->mParent = NULL; + entry->mParent = nullptr; // advance the pending ptr until it reaches outgoingId or an entry that has yet to acknowledged while (mReliableOutgoingPendingId < mReliableOutgoingId) { - if (mPhysicalPackets[mReliableOutgoingPendingId % mConfig.maxOutstandingPackets].mDataPtr != NULL) + if (mPhysicalPackets[mReliableOutgoingPendingId % mConfig.maxOutstandingPackets].mDataPtr != nullptr) break; mReliableOutgoingPendingId++; } @@ -3728,25 +3728,25 @@ void UdpReliableChannel::Ack(udp_int64 reliableId) UdpReliableChannel::IncomingQueueEntry::IncomingQueueEntry() { - mPacket = NULL; + mPacket = nullptr; mMode = UdpReliableChannel::cReliablePacketModeReliable; } UdpReliableChannel::IncomingQueueEntry::~IncomingQueueEntry() { - if (mPacket != NULL) + if (mPacket != nullptr) mPacket->Release(); } UdpReliableChannel::PhysicalPacket::PhysicalPacket() { - mParent = NULL; + mParent = nullptr; } UdpReliableChannel::PhysicalPacket::~PhysicalPacket() { - if (mParent != NULL) + if (mParent != nullptr) mParent->Release(); } @@ -3758,7 +3758,7 @@ UdpReliableChannel::PhysicalPacket::~PhysicalPacket() LogicalPacket::LogicalPacket() { mRefCount = 1; - mReliableQueueNext = NULL; + mReliableQueueNext = nullptr; } LogicalPacket::~LogicalPacket() @@ -3793,7 +3793,7 @@ SimpleLogicalPacket::SimpleLogicalPacket(const void *data, int dataLen) { mDataLen = dataLen; mData = new uchar[mDataLen]; - if (data != NULL) + if (data != nullptr) memcpy(mData, data, mDataLen); } @@ -3828,7 +3828,7 @@ void SimpleLogicalPacket::SetDataLen(int len) GroupLogicalPacket::GroupLogicalPacket() : LogicalPacket() { mDataLen = 0; - mData = NULL; + mData = nullptr; } GroupLogicalPacket::~GroupLogicalPacket() @@ -3838,13 +3838,13 @@ GroupLogicalPacket::~GroupLogicalPacket() void GroupLogicalPacket::AddPacket(const LogicalPacket *packet) { - assert(packet != NULL); + assert(packet != nullptr); AddPacketInternal(packet->GetDataPtr(), packet->GetDataLen(), packet->IsInternalPacket()); } void GroupLogicalPacket::AddPacket(const void *data, int dataLen) { - assert(data != NULL); + assert(data != nullptr); assert(dataLen >= 0); AddPacketInternal(data, dataLen, false); } @@ -3910,16 +3910,16 @@ PooledLogicalPacket::PooledLogicalPacket(UdpManager *manager, int len) mDataLen = 0; mUdpManager = manager; - mAvailableNext = NULL; - mCreatedNext = NULL; - mCreatedPrev = NULL; + mAvailableNext = nullptr; + mCreatedNext = nullptr; + mCreatedPrev = nullptr; mUdpManager->PoolCreated(this); } PooledLogicalPacket::~PooledLogicalPacket() { - if (mUdpManager != NULL) + if (mUdpManager != nullptr) { mUdpManager->PoolDestroyed(this); } @@ -3934,7 +3934,7 @@ void PooledLogicalPacket::AddRef() const void PooledLogicalPacket::Release() const { - if (mRefCount == 1 && mUdpManager != NULL) + if (mRefCount == 1 && mUdpManager != nullptr) mUdpManager->PoolReturn(const_cast(this)); // if pool wants to keep us, it will inc our ref count, preventing our destruction // we cast off our const, as when we are added back to the pool, we can be modified LogicalPacket::Release(); @@ -3964,9 +3964,9 @@ void PooledLogicalPacket::SetDataLen(int len) void PooledLogicalPacket::SetData(const void *data, int dataLen, const void *data2, int dataLen2) { mDataLen = dataLen + dataLen2; - if (data != NULL) + if (data != nullptr) memcpy(mData, data, dataLen); - if (data2 != NULL) + if (data2 != nullptr) memcpy(mData + dataLen, data2, dataLen2); } @@ -3977,23 +3977,23 @@ void PooledLogicalPacket::SetData(const void *data, int dataLen, const void *dat /////////////////////////////////////////////////////////////////////////////////////////// WrappedLogicalPacket::WrappedLogicalPacket(UdpManager *udpManager) { - mPacket = NULL; + mPacket = nullptr; mUdpManager = udpManager; - mAvailableNext = NULL; - mCreatedNext = NULL; - mCreatedPrev = NULL; + mAvailableNext = nullptr; + mCreatedNext = nullptr; + mCreatedPrev = nullptr; mUdpManager->WrappedCreated(this); } WrappedLogicalPacket::~WrappedLogicalPacket() { - if (mUdpManager != NULL) + if (mUdpManager != nullptr) { mUdpManager->WrappedDestroyed(this); } - if (mPacket != NULL) + if (mPacket != nullptr) { mPacket->Release(); } @@ -4006,7 +4006,7 @@ void WrappedLogicalPacket::AddRef() const void WrappedLogicalPacket::Release() const { - if (mRefCount == 1 && mUdpManager != NULL) + if (mRefCount == 1 && mUdpManager != nullptr) mUdpManager->WrappedReturn(const_cast(this)); // if pool wants to keep us, it will inc our ref count, preventing our destruction // we cast off our const, as when we are added back to the pool, we can be modified LogicalPacket::Release(); @@ -4014,10 +4014,10 @@ void WrappedLogicalPacket::Release() const void WrappedLogicalPacket::SetLogicalPacket(const LogicalPacket *packet) { - if (mPacket != NULL) + if (mPacket != nullptr) mPacket->Release(); mPacket = packet; - if (mPacket != NULL) + if (mPacket != nullptr) mPacket->AddRef(); } @@ -4053,7 +4053,7 @@ UdpManager::SimulateQueueEntry::SimulateQueueEntry(const uchar *data, int dataLe memcpy(mData, data, dataLen); mIp = ip; mPort = port; - mNext = NULL; + mNext = nullptr; } UdpManager::SimulateQueueEntry::~SimulateQueueEntry() @@ -4088,7 +4088,7 @@ UdpMisc::ClockStamp UdpMisc::Clock() static ClockStamp sLastStamp = 0; static ClockStamp sCurrentCorrection = 0; struct timeval tv; - gettimeofday(&tv, NULL); + gettimeofday(&tv, nullptr); UdpMisc::ClockStamp cs = static_cast(tv.tv_sec) * 1000 + static_cast(tv.tv_usec / 1000); cs += sCurrentCorrection; if (cs < sLastStamp) @@ -4204,19 +4204,19 @@ void *UdpMisc::SmartResize(void *ptr, int bytes, int round) if (bytes == 0) { - if (ptr != NULL) + if (ptr != nullptr) { free((uchar *)ptr - cAlignment); } - return(NULL); + return(nullptr); } uchar *ptr2; - if (ptr == NULL) + if (ptr == nullptr) { ptr2 = (uchar *)malloc(bytes + cAlignment); - if (ptr2 == NULL) - return(NULL); + if (ptr2 == nullptr) + return(nullptr); *(int *)ptr2 = bytes; return(ptr2 + cAlignment); } @@ -4226,8 +4226,8 @@ void *UdpMisc::SmartResize(void *ptr, int bytes, int round) return(ptr); ptr2 = (uchar *)realloc((uchar *)ptr - cAlignment, bytes + cAlignment); - if (ptr2 == NULL) - return(NULL); + if (ptr2 == nullptr) + return(nullptr); *(int *)ptr2 = bytes; return(ptr2 + cAlignment); @@ -4290,30 +4290,30 @@ LogicalPacket *UdpMisc::CreateQuickLogicalPacket(const void *data, int dataLen, switch(q) { case 0: - tlp = new FixedLogicalPacket(NULL, totalDataLen); + tlp = new FixedLogicalPacket(nullptr, totalDataLen); break; case 1: - tlp = new FixedLogicalPacket(NULL, totalDataLen); + tlp = new FixedLogicalPacket(nullptr, totalDataLen); break; case 2: case 3: - tlp = new FixedLogicalPacket(NULL, totalDataLen); + tlp = new FixedLogicalPacket(nullptr, totalDataLen); break; case 4: case 5: case 6: case 7: - tlp = new FixedLogicalPacket(NULL, totalDataLen); + tlp = new FixedLogicalPacket(nullptr, totalDataLen); break; default: - tlp = new SimpleLogicalPacket(NULL, totalDataLen); + tlp = new SimpleLogicalPacket(nullptr, totalDataLen); break; } uchar *dest = (uchar *)tlp->GetDataPtr(); - if (data != NULL) + if (data != nullptr) memcpy(dest, data, dataLen); - if (data2 != NULL) + if (data2 != nullptr) memcpy(dest + dataLen, data2, dataLen2); return(tlp); } @@ -4327,7 +4327,7 @@ UdpIpAddress UdpMisc::GetHostByName(const char *hostName) { struct hostent * lphp; lphp = gethostbyname(hostName); - if (lphp == NULL) + if (lphp == nullptr) { address = 0; } diff --git a/external/3rd/library/udplibrary/UdpLibrary.hpp b/external/3rd/library/udplibrary/UdpLibrary.hpp index 43a20328..39f05a43 100644 --- a/external/3rd/library/udplibrary/UdpLibrary.hpp +++ b/external/3rd/library/udplibrary/UdpLibrary.hpp @@ -148,7 +148,7 @@ class UdpMisc // memory manager does a little bit of this, but if you know you have an allocation that is likely // to grow quite a bit, you can set the round'ing size up to a fairly large number and avoid // unnecessary reallocs at the cost of a little potentially wasted space - // initial allocations are done by passing in ptr==NULL, freeing is done by passing in bytes==0 + // initial allocations are done by passing in ptr==nullptr, freeing is done by passing in bytes==0 static void *SmartResize(void *ptr, int bytes, int round = 1); // the following two functions store values in the buffer as a variable length (B1, 0xffB2B1, 0xffffffB4B3B2B1) @@ -168,7 +168,7 @@ class UdpMisc static uint GetValue24(const void *buffer); // gets a 24-bit value from the buffer in big-endian format static ushort GetValue16(const void *buffer); // gets a 16-bit value from the buffer in big-endian format - static LogicalPacket *CreateQuickLogicalPacket(const void *data, int dataLen, const void *data2 = NULL, int dataLen2 = 0); + static LogicalPacket *CreateQuickLogicalPacket(const void *data, int dataLen, const void *data2 = nullptr, int dataLen2 = 0); // looks up the specified name and translates it to an IP address // this is a blocking call that can at times take a significant amount of time, but will generally be fast (less than 300ms) @@ -241,7 +241,7 @@ class LogicalPacket protected: friend class UdpReliableChannel; mutable const LogicalPacket *mReliableQueueNext; // owned/managed by the reliable channel object as an optimizations, do not touch - // NULL = unclaimed, point-to-self = claimed, but end of list + // nullptr = unclaimed, point-to-self = claimed, but end of list }; class SimpleLogicalPacket : public LogicalPacket @@ -250,7 +250,7 @@ class SimpleLogicalPacket : public LogicalPacket // it was originally created to allow the internal code to handle reliable data that was sent // via the Send(char *, int) api call. public: - SimpleLogicalPacket(const void *data, int dataLen); // data can be NULL if you want to populate it after it is allocated (get the pointer and write to it) + SimpleLogicalPacket(const void *data, int dataLen); // data can be nullptr if you want to populate it after it is allocated (get the pointer and write to it) virtual void *GetDataPtr(); virtual const void *GetDataPtr() const; virtual int GetDataLen() const; @@ -321,7 +321,7 @@ template class StructLogicalPacket : public LogicalPacket // with virtual functions) via this method as they may contain hidden data-members (such as pointers // to vtables). public: - StructLogicalPacket(T *initData = NULL); + StructLogicalPacket(T *initData = nullptr); virtual void *GetDataPtr(); virtual const void *GetDataPtr() const; virtual int GetDataLen() const; @@ -394,7 +394,7 @@ class PooledLogicalPacket : public LogicalPacket int mMaxDataLen; protected: friend class UdpManager; - void SetData(const void *data, int dataLen, const void *data2 = NULL, int dataLen2 = 0); + void SetData(const void *data, int dataLen, const void *data2 = nullptr, int dataLen2 = 0); UdpManager *mUdpManager; PooledLogicalPacket *mAvailableNext; PooledLogicalPacket *mCreatedNext; @@ -474,7 +474,7 @@ class UdpManager // pointer equal to your object and the UdpManager will call it as appropriate. The UdpConnection object // also has a handler mechanism that replaces the other callback functions below, see UdpConnection::SetHandler // if a handler is specified, the callback function is ignored, even if specified. - // default = NULL (not used) + // default = nullptr (not used) UdpManagerHandler *handler; // this is the maximum number of connections that can be established by this manager, any incoming/outgoing connections @@ -883,7 +883,7 @@ class UdpManager // will call EstablishConnection, then sit in a loop calling UdpManager::GiveTime and checking to see // if the status of the returned UdpConnection object is changed from cStatusNegotiating. This allows // the application to look for the ESC key or timeout an attempted connection. - // This function will return NULL if the manager object has exceeded its maximum number of connections + // This function will return nullptr if the manager object has exceeded its maximum number of connections // or if the serverAddress cannot be resolved to an IP address // as is noted in the declaration, it is the responsibility of the application establishing the connection to delete it // setting the timeout value (in milliseconds) to something greater than 0 will cause the UdpConnection object to change @@ -915,13 +915,13 @@ class UdpManager // manually forces all live connections to flush their multi buffers immediately void FlushAllMultiBuffer(); - // creates a logical packet and populates it with data. data can be NULL, in which case it gives you logical packet + // creates a logical packet and populates it with data. data can be nullptr, in which case it gives you logical packet // of the size specified, but copies no data into it. If you are using pool management (see Params::poolPacketMax), // it will give you a packet out of the pool if possible, otherwise it will create a packet for you. When logical // are packets are needed internally for various things (like reliable channel sends that use the (void *, int) interface) // they are gotten from this function, so your application can likely take advantage of pooling, even if it never bothers // to explicitly call this function. - LogicalPacket *CreatePacket(const void *data, int dataLen, const void *data2 = NULL, int dataLen2 = 0); + LogicalPacket *CreatePacket(const void *data, int dataLen, const void *data2 = nullptr, int dataLen2 = 0); protected: friend class PooledLogicalPacket; @@ -1147,7 +1147,7 @@ class UdpConnection : public PriorityQueueMember, public AddressHashTableMember, int ConnectionAge() const; // returns the UdpManager object that is managing this connection - // will return NULL if the connection has been disconnected for some reason (because disconnecting severes the link to UdpManager) + // will return nullptr if the connection has been disconnected for some reason (because disconnecting severes the link to UdpManager) UdpManager *GetUdpManager() const; // returns the 32-bit encryption-code that was negotiated as part of the connection-establishment process. @@ -1227,9 +1227,9 @@ class UdpConnection : public PriorityQueueMember, public AddressHashTableMember, friend class UdpManager; friend class UdpReliableChannel; - // note: if connectPacket is NULL, that means this connection object is being created to establish + // note: if connectPacket is nullptr, that means this connection object is being created to establish // a new connection to the specified ip/port (ie. the connection starts out in cStatusNegotiating mode) - // if connectPacket is non-NULL, that menas this connection object is being created to handle an + // if connectPacket is non-nullptr, that menas this connection object is being created to handle an // incoming connect request and it will start out in cStatusConnected mode. UdpConnection(UdpManager *udpManager, UdpIpAddress destIp, int destPort, int timeout); // starts connection-establishment protocol UdpConnection(UdpManager *udpManager, const UdpManager::PacketHistoryEntry *e); // starts already connected, replying to connection request @@ -1264,7 +1264,7 @@ class UdpConnection : public PriorityQueueMember, public AddressHashTableMember, void PhysicalSend(const uchar *data, int dataLen, bool appendAllowed); // sends a physical packet (encrypts and adds crc bytes) uchar *BufferedSend(const uchar *data, int dataLen, const uchar *data2, int dataLen2, bool appendAllowed); // buffers logical packets waiting til we have more data (makes multi-packets) bool InternalSend(UdpChannel channel, const LogicalPacket *packet); - bool InternalSend(UdpChannel channel, const uchar *data, int dataLen, const uchar *data2 = NULL, int dataLen2 = 0); + bool InternalSend(UdpChannel channel, const uchar *data, int dataLen, const uchar *data2 = nullptr, int dataLen2 = 0); uchar *InternalAckSend(uchar *bufferedAckPtr, const uchar *ackPtr, int ackLen); // used by reliable channel to send acks (special send that allows for deduping ack feature) @@ -1555,7 +1555,7 @@ class UdpReliableChannel void ProcessPacket(ReliablePacketMode mode, const uchar *data, int dataLen); bool PullDown(int windowSpaceLeft); void FlushCoalesce(); - void SendCoalesce(const uchar *data, int dataLen, const uchar *data2 = NULL, int dataLen2 = 0); + void SendCoalesce(const uchar *data, int dataLen, const uchar *data2 = nullptr, int dataLen2 = 0); void QueueLogicalPacket(const LogicalPacket *packet); UdpManager::ReliableConfig mConfig; @@ -1609,7 +1609,7 @@ class UdpReliableChannel template FixedLogicalPacket::FixedLogicalPacket(const void *data, int dataLen) { mDataLen = dataLen; - if (data != NULL) + if (data != nullptr) memcpy(mData, data, mDataLen); } @@ -1639,7 +1639,7 @@ template void FixedLogicalPacket::SetDataLen(int l ///////////////////////////////////////////////////////////////////////// template StructLogicalPacket::StructLogicalPacket(T *initData) { - if (initData != NULL) + if (initData != nullptr) mStruct = *initData; } @@ -1784,7 +1784,7 @@ inline void UdpManager::SetPriority(UdpConnection *con, UdpMisc::ClockStamp stam if (stamp < mMinimumScheduledStamp) stamp = mMinimumScheduledStamp; - if (mPriorityQueue != NULL) + if (mPriorityQueue != nullptr) mPriorityQueue->Add(con, stamp); } @@ -1811,7 +1811,7 @@ inline void UdpManager::PoolReturn(PooledLogicalPacket *packet) inline void UdpManager::WrappedReturn(WrappedLogicalPacket *wp) { - wp->SetLogicalPacket(NULL); + wp->SetLogicalPacket(nullptr); if (mWrappedAvailable < mParams.wrappedPoolMax) { @@ -1859,7 +1859,7 @@ inline void UdpConnection::ScheduleTimeNow() // prevents us from reprioritizing to 0, only to shortly thereafter be reprioritized to where we actually belong. if (!mGettingTime) { - if (mUdpManager != NULL) + if (mUdpManager != nullptr) mUdpManager->SetPriority(this, 0); } } @@ -2048,7 +2048,7 @@ inline int UdpReliableChannel::TotalPendingBytes() const inline void UdpReliableChannel::ClearBufferedAck() { - mBufferedAckPtr = NULL; + mBufferedAckPtr = nullptr; } inline udp_int64 UdpReliableChannel::GetReliableOutgoingId(int reliableStamp) const diff --git a/external/3rd/library/udplibrary/hashtable.hpp b/external/3rd/library/udplibrary/hashtable.hpp index 8c7340bc..f37a40e1 100644 --- a/external/3rd/library/udplibrary/hashtable.hpp +++ b/external/3rd/library/udplibrary/hashtable.hpp @@ -175,11 +175,11 @@ template class HashTable bool Remove(T& obj, int hashValue); void Reset(); // removes all entries from the table - T *FindFirst(int hashValue) const; // returns NULL if not found - T *FindNext(T *prevResult) const; // returns NULL if not found + T *FindFirst(int hashValue) const; // returns nullptr if not found + T *FindNext(T *prevResult) const; // returns nullptr if not found - T *WalkFirst() const; // returns NULL if not found - T *WalkNext(T *prevResult) const; // returns NULL if not found + T *WalkFirst() const; // returns nullptr if not found + T *WalkNext(T *prevResult) const; // returns nullptr if not found void Resize(int hashSize); // the actual hash size will be rounded up to the next larger prime number (very slow, not recommended) void GetStatistics(HashTableStatistics *stats) const; @@ -201,7 +201,7 @@ template class HashTable template HashTable::HashTable(int hashSize) { - mTable = NULL; + mTable = nullptr; mTableSize = 0; mEntryCount = 0; mStatUsedSlots = 0; @@ -221,9 +221,9 @@ template void HashTable::Insert(T& obj, int hashValue) entry->hashValue = hashValue; int spot = ((unsigned)hashValue) % mTableSize; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) { - entry->nextEntry = NULL; + entry->nextEntry = nullptr; mTable[spot] = entry; mStatUsedSlots++; } @@ -240,14 +240,14 @@ template bool HashTable::Remove(T& obj, int hashValue) int spot = ((unsigned)hashValue) % mTableSize; HashEntry* next = mTable[spot]; HashEntry** prev = &mTable[spot]; - while (next != NULL) + while (next != nullptr) { if (next->obj == obj && next->hashValue == hashValue) { *prev = next->nextEntry; delete next; mEntryCount--; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) mStatUsedSlots--; return(true); break; @@ -264,17 +264,17 @@ template void HashTable::Reset() for (int spot = 0; spot < mTableSize; spot++) { HashEntry *curr = mTable[spot]; - if (curr != NULL) + if (curr != nullptr) { mStatUsedSlots--; - while (curr != NULL) + while (curr != nullptr) { HashEntry *next = curr->nextEntry; delete curr; mEntryCount--; curr = next; } - mTable[spot] = NULL; + mTable[spot] = nullptr; } } } @@ -282,13 +282,13 @@ template void HashTable::Reset() template T *HashTable::FindFirst(int hashValue) const { HashEntry *entry = mTable[((unsigned)hashValue) % mTableSize]; - while (entry != NULL) + while (entry != nullptr) { if (entry->hashValue == hashValue) return(&entry->obj); entry = entry->nextEntry; } - return(NULL); + return(nullptr); } template T *HashTable::FindNext(T *prevResult) const @@ -296,13 +296,13 @@ template T *HashTable::FindNext(T *prevResult) const HashEntry *entry = (HashEntry *)(((char *)prevResult) - offsetof(HashEntry, obj)); int hashValue = entry->hashValue; entry = entry->nextEntry; - while (entry != NULL) + while (entry != nullptr) { if (entry->hashValue == hashValue) return(&entry->obj); entry = entry->nextEntry; } - return(NULL); + return(nullptr); } template T *HashTable::WalkFirst() const @@ -310,10 +310,10 @@ template T *HashTable::WalkFirst() const for (int bucket = 0; bucket < mTableSize; bucket++) { HashEntry *entry = mTable[bucket]; - if (entry != NULL) + if (entry != nullptr) return(&entry->obj); } - return(NULL); + return(nullptr); } template T *HashTable::WalkNext(T *prevResult) const @@ -322,17 +322,17 @@ template T *HashTable::WalkNext(T *prevResult) const int bucket = ((unsigned)entry->hashValue) % mTableSize; entry = entry->nextEntry; - if (entry != NULL) + if (entry != nullptr) return(&entry->obj); bucket++; // go onto next bucket for (; bucket < mTableSize; bucket++) { HashEntry *entry = mTable[bucket]; - if (entry != NULL) + if (entry != nullptr) return(&entry->obj); } - return(NULL); + return(nullptr); } template void HashTable::Resize(int hashSize) @@ -352,16 +352,16 @@ template void HashTable::Resize(int hashSize) for (int i = 0; i < oldSize; i++) { HashEntry* next = oldTable[i]; - while (next != NULL) + while (next != nullptr) { HashEntry* hold = next; next = next->nextEntry; // insert hold into new table int spot = ((unsigned)hold->hashValue) % mTableSize; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) { - hold->nextEntry = NULL; + hold->nextEntry = nullptr; mTable[spot] = hold; mStatUsedSlots++; } @@ -415,11 +415,11 @@ template class ObjectHashTable bool Remove(T obj, int hashValue); void Reset(); // removes all entries from the table - T FindFirst(int hashValue) const; // returns NULL if not found - T FindNext(T prevResult) const; // returns NULL if not found + T FindFirst(int hashValue) const; // returns nullptr if not found + T FindNext(T prevResult) const; // returns nullptr if not found - T WalkFirst() const; // returns NULL if not found - T WalkNext(T prevResult) const; // returns NULL if not found + T WalkFirst() const; // returns nullptr if not found + T WalkNext(T prevResult) const; // returns nullptr if not found void Resize(int hashSize); // the actual hash size will be rounded up to the next larger prime number (very slow, not recommended) void GetStatistics(HashTableStatistics *stats) const; @@ -434,7 +434,7 @@ template class ObjectHashTable template ObjectHashTable::ObjectHashTable(int hashSize) { - mTable = NULL; + mTable = nullptr; mTableSize = 0; mEntryCount = 0; mStatUsedSlots = 0; @@ -452,9 +452,9 @@ template void ObjectHashTable::Insert(T obj, int hashValue) obj->mHashValue = hashValue; int spot = ((unsigned)hashValue) % mTableSize; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) { - obj->mHashNextEntry = NULL; + obj->mHashNextEntry = nullptr; mTable[spot] = obj; mStatUsedSlots++; } @@ -471,14 +471,14 @@ template bool ObjectHashTable::Remove(T obj, int hashValue) int spot = ((unsigned)hashValue) % mTableSize; T next = mTable[spot]; T *prev = &mTable[spot]; - while (next != NULL) + while (next != nullptr) { if (next == obj) { *prev = (T)next->mHashNextEntry; - next->mHashNextEntry = NULL; + next->mHashNextEntry = nullptr; mEntryCount--; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) mStatUsedSlots--; return(true); break; @@ -495,16 +495,16 @@ template void ObjectHashTable::Reset() for (int spot = 0; spot < mTableSize; spot++) { T curr = mTable[spot]; - if (curr != NULL) + if (curr != nullptr) { - while (curr != NULL) + while (curr != nullptr) { T next = (T)curr->mHashNextEntry; - curr->mHashNextEntry = NULL; + curr->mHashNextEntry = nullptr; mEntryCount--; curr = next; } - mTable[spot] = NULL; + mTable[spot] = nullptr; mStatUsedSlots--; } } @@ -513,13 +513,13 @@ template void ObjectHashTable::Reset() template T ObjectHashTable::FindFirst(int hashValue) const { T entry = mTable[((unsigned)hashValue) % mTableSize]; - while (entry != NULL) + while (entry != nullptr) { if (entry->mHashValue == hashValue) return(entry); entry = (T)entry->mHashNextEntry; } - return(NULL); + return(nullptr); } template T ObjectHashTable::FindNext(T prevResult) const @@ -527,13 +527,13 @@ template T ObjectHashTable::FindNext(T prevResult) const T entry = prevResult; int hashValue = entry->mHashValue; entry = (T)entry->mHashNextEntry; - while (entry != NULL) + while (entry != nullptr) { if (entry->mHashValue == hashValue) return(entry); entry = (T)entry->mHashNextEntry; } - return(NULL); + return(nullptr); } template T ObjectHashTable::WalkFirst() const @@ -541,10 +541,10 @@ template T ObjectHashTable::WalkFirst() const for (int bucket = 0; bucket < mTableSize; bucket++) { T entry = mTable[bucket]; - if (entry != NULL) + if (entry != nullptr) return(entry); } - return(NULL); + return(nullptr); } template T ObjectHashTable::WalkNext(T prevResult) const @@ -553,17 +553,17 @@ template T ObjectHashTable::WalkNext(T prevResult) const int bucket = ((unsigned)entry->mHashValue) % mTableSize; entry = (T)entry->mHashNextEntry; - if (entry != NULL) + if (entry != nullptr) return(entry); bucket++; // go onto next bucket for (; bucket < mTableSize; bucket++) { entry = mTable[bucket]; - if (entry != NULL) + if (entry != nullptr) return(entry); } - return(NULL); + return(nullptr); } template void ObjectHashTable::Resize(int hashSize) @@ -583,16 +583,16 @@ template void ObjectHashTable::Resize(int hashSize) for (int i = 0; i < oldSize; i++) { T next = oldTable[i]; - while (next != NULL) + while (next != nullptr) { T hold = next; next = (T)next->mHashNextEntry; // insert hold into new table int spot = ((unsigned)hold->mHashValue) % mTableSize; - if (mTable[spot] == NULL) + if (mTable[spot] == nullptr) { - hold->mHashNextEntry = NULL; + hold->mHashNextEntry = nullptr; mTable[spot] = hold; mStatUsedSlots++; } diff --git a/external/3rd/library/udplibrary/priority.hpp b/external/3rd/library/udplibrary/priority.hpp index 19f34ab3..516619db 100644 --- a/external/3rd/library/udplibrary/priority.hpp +++ b/external/3rd/library/udplibrary/priority.hpp @@ -37,12 +37,12 @@ template class PriorityQueue PriorityQueue(int queueSize); ~PriorityQueue(); - T* Top(); // returns NULL if queue is empty - T* TopRemove(); // returns NULL if queue is empty - T* TopRemove(P priority); // removes item from queue if it has a lower priority value, otherwise return NULL + T* Top(); // returns nullptr if queue is empty + T* TopRemove(); // returns nullptr if queue is empty + T* TopRemove(P priority); // removes item from queue if it has a lower priority value, otherwise return nullptr T* Add(T* entry, P priority); // reprioritizes if already in queue, returns entry always T* Remove(T* entry); // returns entry always (even if it was not in the queue) - P *GetPriority(T* entry); // returns NULL if entry is not in the queue + P *GetPriority(T* entry); // returns nullptr if entry is not in the queue int QueueUsed(); // returns how many entries are in the queue protected: struct QueueEntry @@ -88,14 +88,14 @@ template PriorityQueue::~PriorityQueue() template T* PriorityQueue::Top() { if (mQueueEnd == 0) - return(NULL); + return(nullptr); return(mQueue[0].entry); } template T* PriorityQueue::TopRemove() { if (mQueueEnd == 0) - return(NULL); + return(nullptr); T* top = mQueue[0].entry; Remove(top); return(top); @@ -105,14 +105,14 @@ template T* PriorityQueue::TopRemove(P priority) { if (mQueueEnd > 0 && mQueue[0].priority <= priority) return(Remove(mQueue[0].entry)); - return(NULL); + return(nullptr); } template P* PriorityQueue::GetPriority(T* entry) { if (entry->mPriorityQueuePosition >= 0) return(&mQueue[entry->mPriorityQueuePosition].priority); - return(NULL); + return(nullptr); } template T* PriorityQueue::Add(T* entry, P priority) @@ -121,7 +121,7 @@ template T* PriorityQueue::Add(T* entry, P priorit { // not in queue, so add it to the bottom if (mQueueEnd >= mQueueSize) - return(NULL); + return(nullptr); mQueue[mQueueEnd].entry = entry; mQueue[mQueueEnd].priority = priority; mQueue[mQueueEnd].entry->mPriorityQueuePosition = mQueueEnd; diff --git a/external/3rd/library/udplibrary/udpclient.cpp b/external/3rd/library/udplibrary/udpclient.cpp index 9debac0e..9ed52d3e 100755 --- a/external/3rd/library/udplibrary/udpclient.cpp +++ b/external/3rd/library/udplibrary/udpclient.cpp @@ -106,7 +106,7 @@ int main(int argc, char **argv) printf("Connecting to: %s,%d.", connectIp, connectPort); UdpConnection *myConnection = myUdpManager->EstablishConnection(connectIp, connectPort); myConnection->SetHandler(&myConnectionHandler); - assert(myConnection != NULL); + assert(myConnection != nullptr); int count = 0; while (myConnection->GetStatus() == UdpConnection::cStatusNegotiating) { @@ -181,7 +181,7 @@ int main(int argc, char **argv) if (myConnection->TotalPendingBytes() == 0) { // send another packet - SimpleLogicalPacket *lp = new SimpleLogicalPacket(NULL, 30000000); + SimpleLogicalPacket *lp = new SimpleLogicalPacket(nullptr, 30000000); int dlen = lp->GetDataLen(); char *ptr = (char *)lp->GetDataPtr(); diff --git a/external/3rd/library/udplibrary/udpserver.cpp b/external/3rd/library/udplibrary/udpserver.cpp index c523a05b..c8641671 100755 --- a/external/3rd/library/udplibrary/udpserver.cpp +++ b/external/3rd/library/udplibrary/udpserver.cpp @@ -182,7 +182,7 @@ Player::~Player() { char hold[256]; printf("TERMINATE %s,%d \n", mConnection->GetDestinationIp().GetAddress(hold), mConnection->GetDestinationPort()); - mConnection->SetHandler(NULL); + mConnection->SetHandler(nullptr); mConnection->Disconnect(); mConnection->Release(); } diff --git a/external/ours/library/archive/src/shared/AutoDeltaVariableCallback.h b/external/ours/library/archive/src/shared/AutoDeltaVariableCallback.h index ef0cc7fa..34373722 100755 --- a/external/ours/library/archive/src/shared/AutoDeltaVariableCallback.h +++ b/external/ours/library/archive/src/shared/AutoDeltaVariableCallback.h @@ -186,7 +186,7 @@ inline void AutoDeltaVariableCallback::se ValueType const tmp = this->get(); AutoDeltaVariable::set(source); - if (sourceObject != NULL && tmp != source) + if (sourceObject != nullptr && tmp != source) callback.modified(*sourceObject, tmp, source, true); } diff --git a/external/ours/library/archive/src/shared/ByteStream.cpp b/external/ours/library/archive/src/shared/ByteStream.cpp index 2e19cb81..4965bc8c 100755 --- a/external/ours/library/archive/src/shared/ByteStream.cpp +++ b/external/ours/library/archive/src/shared/ByteStream.cpp @@ -20,7 +20,7 @@ namespace Archive { @brief ReadIterator ctor Initializes the read position to zero, and the ByteStream member value - is NULL + is nullptr */ ReadIterator::ReadIterator() : readPtr(0), diff --git a/external/ours/library/archive/src/shared/ByteStream.h b/external/ours/library/archive/src/shared/ByteStream.h index eda154d5..a94aeb36 100755 --- a/external/ours/library/archive/src/shared/ByteStream.h +++ b/external/ours/library/archive/src/shared/ByteStream.h @@ -261,7 +261,7 @@ inline void ReadIterator::get(void * target, const unsigned long int readSize) } else { - static const char * const desc = "Archive::ReadIterator::get - read operation on null stream object"; + static const char * const desc = "Archive::ReadIterator::get - read operation on nullptr stream object"; ReadException ex(desc); throw (ex); } diff --git a/external/ours/library/crypto/src/shared/original/cryptlib.h b/external/ours/library/crypto/src/shared/original/cryptlib.h index dbbc7fa7..fd258706 100755 --- a/external/ours/library/crypto/src/shared/original/cryptlib.h +++ b/external/ours/library/crypto/src/shared/original/cryptlib.h @@ -440,7 +440,7 @@ public: //@{ //! returns whether this object allows attachment virtual bool Attachable() {return false;} - //! returns the object immediately attached to this object or NULL for no attachment + //! returns the object immediately attached to this object or nullptr for no attachment virtual BufferedTransformation *AttachedTransformation() {return 0;} //! virtual const BufferedTransformation *AttachedTransformation() const diff --git a/external/ours/library/crypto/src/shared/original/filters.cpp b/external/ours/library/crypto/src/shared/original/filters.cpp index 7caaf21d..852a7b7f 100755 --- a/external/ours/library/crypto/src/shared/original/filters.cpp +++ b/external/ours/library/crypto/src/shared/original/filters.cpp @@ -55,7 +55,7 @@ const byte *FilterWithBufferedInput::BlockQueue::GetBlock() return ptr; } else - return NULL; + return nullptr; } const byte *FilterWithBufferedInput::BlockQueue::GetContigousBlocks(unsigned int &numberOfBlocks) @@ -175,7 +175,7 @@ void FilterWithBufferedInput::Put(const byte *inString, unsigned int length) void FilterWithBufferedInput::MessageEnd(int propagation) { if (!m_firstInputDone && m_firstSize==0) - FirstPut(NULL); + FirstPut(nullptr); SecByteBlock temp(m_queue.CurrentSize()); m_queue.GetAll(temp); @@ -200,7 +200,7 @@ void FilterWithBufferedInput::ForceNextPut() // ************************************************************* ProxyFilter::ProxyFilter(Filter *filter, unsigned int firstSize, unsigned int lastSize, BufferedTransformation *outQ) - : FilterWithBufferedInput(firstSize, 1, lastSize, outQ), m_filter(filter), m_proxy(NULL) + : FilterWithBufferedInput(firstSize, 1, lastSize, outQ), m_filter(filter), m_proxy(nullptr) { if (m_filter.get()) m_filter->Attach(m_proxy = new OutputProxy(*this, false)); @@ -229,7 +229,7 @@ void ProxyFilter::SetFilter(Filter *filter) m_filter->Attach(temp.release()); } else - m_proxy=NULL; + m_proxy=nullptr; } void ProxyFilter::NextPut(const byte *s, unsigned int len) diff --git a/external/ours/library/crypto/src/shared/original/filters.h b/external/ours/library/crypto/src/shared/original/filters.h index 6a2f0389..b80c518a 100755 --- a/external/ours/library/crypto/src/shared/original/filters.h +++ b/external/ours/library/crypto/src/shared/original/filters.h @@ -17,7 +17,7 @@ public: bool Attachable() {return true;} BufferedTransformation *AttachedTransformation() {return m_outQueue.get();} const BufferedTransformation *AttachedTransformation() const {return m_outQueue.get();} - void Detach(BufferedTransformation *newOut = NULL); + void Detach(BufferedTransformation *newOut = nullptr); protected: virtual void NotifyAttachmentChange() {} @@ -33,7 +33,7 @@ private: class TransparentFilter : public Filter { public: - TransparentFilter(BufferedTransformation *outQ=NULL) : Filter(outQ) {} + TransparentFilter(BufferedTransformation *outQ=nullptr) : Filter(outQ) {} void Put(byte inByte) {AttachedTransformation()->Put(inByte);} void Put(const byte *inString, unsigned int length) {AttachedTransformation()->Put(inString, length);} }; @@ -42,7 +42,7 @@ public: class OpaqueFilter : public Filter { public: - OpaqueFilter(BufferedTransformation *outQ=NULL) : Filter(outQ) {} + OpaqueFilter(BufferedTransformation *outQ=nullptr) : Filter(outQ) {} void Put(byte inByte) {} void Put(const byte *inString, unsigned int length) {} }; @@ -122,7 +122,7 @@ class StreamCipherFilter : public Filter { public: StreamCipherFilter(StreamCipher &c, - BufferedTransformation *outQueue = NULL) + BufferedTransformation *outQueue = nullptr) : cipher(c), Filter(outQueue) {} void Put(byte inByte) @@ -138,7 +138,7 @@ private: class HashFilter : public Filter { public: - HashFilter(HashModule &hm, BufferedTransformation *outQueue = NULL, bool putMessage=false) + HashFilter(HashModule &hm, BufferedTransformation *outQueue = nullptr, bool putMessage=false) : Filter(outQueue), m_hashModule(hm), m_putMessage(putMessage) {} void MessageEnd(int propagation=-1); @@ -163,7 +163,7 @@ public: }; enum Flags {HASH_AT_BEGIN=1, PUT_MESSAGE=2, PUT_HASH=4, PUT_RESULT=8, THROW_EXCEPTION=16}; - HashVerifier(HashModule &hm, BufferedTransformation *outQueue = NULL, word32 flags = HASH_AT_BEGIN | PUT_RESULT); + HashVerifier(HashModule &hm, BufferedTransformation *outQueue = nullptr, word32 flags = HASH_AT_BEGIN | PUT_RESULT); bool GetLastResult() const {return m_verified;} @@ -183,7 +183,7 @@ private: class SignerFilter : public Filter { public: - SignerFilter(RandomNumberGenerator &rng, const PK_Signer &signer, BufferedTransformation *outQueue = NULL) + SignerFilter(RandomNumberGenerator &rng, const PK_Signer &signer, BufferedTransformation *outQueue = nullptr) : m_rng(rng), m_signer(signer), m_messageAccumulator(signer.NewMessageAccumulator()), Filter(outQueue) {} void MessageEnd(int propagation); @@ -204,7 +204,7 @@ private: class VerifierFilter : public Filter { public: - VerifierFilter(const PK_Verifier &verifier, BufferedTransformation *outQueue = NULL) + VerifierFilter(const PK_Verifier &verifier, BufferedTransformation *outQueue = nullptr) : m_verifier(verifier), m_messageAccumulator(verifier.NewMessageAccumulator()) , m_signature(verifier.SignatureLength()), Filter(outQueue) {} @@ -244,11 +244,11 @@ extern BitBucket g_bitBucket; class Redirector : public Sink { public: - Redirector() : m_target(NULL), m_passSignal(true) {} + Redirector() : m_target(nullptr), m_passSignal(true) {} Redirector(BufferedTransformation &target, bool passSignal=true) : m_target(&target), m_passSignal(passSignal) {} void Redirect(BufferedTransformation &target) {m_target = ⌖} - void StopRedirect() {m_target = NULL;} + void StopRedirect() {m_target = nullptr;} bool GetPassSignal() const {return m_passSignal;} void SetPassSignal(bool passSignal) {m_passSignal = passSignal;} @@ -498,7 +498,7 @@ public: class GeneralSource : public Source { public: - GeneralSource(BufferedTransformation &store, bool pumpAll, BufferedTransformation *outQueue = NULL) + GeneralSource(BufferedTransformation &store, bool pumpAll, BufferedTransformation *outQueue = nullptr) : Source(outQueue), m_store(store) { if (pumpAll) PumpAll(); @@ -517,13 +517,13 @@ private: class StringSource : public Source { public: - StringSource(const char *string, bool pumpAll, BufferedTransformation *outQueue = NULL); - StringSource(const byte *string, unsigned int length, bool pumpAll, BufferedTransformation *outQueue = NULL); + StringSource(const char *string, bool pumpAll, BufferedTransformation *outQueue = nullptr); + StringSource(const byte *string, unsigned int length, bool pumpAll, BufferedTransformation *outQueue = nullptr); #ifdef __MWERKS__ // CW60 workaround - StringSource(const std::string &string, bool pumpAll, BufferedTransformation *outQueue = NULL) + StringSource(const std::string &string, bool pumpAll, BufferedTransformation *outQueue = nullptr) #else - template StringSource(const T &string, bool pumpAll, BufferedTransformation *outQueue = NULL) + template StringSource(const T &string, bool pumpAll, BufferedTransformation *outQueue = nullptr) #endif : Source(outQueue), m_store(string) { @@ -544,7 +544,7 @@ private: class RandomNumberSource : public Source { public: - RandomNumberSource(RandomNumberGenerator &rng, unsigned int length, bool pumpAll, BufferedTransformation *outQueue = NULL); + RandomNumberSource(RandomNumberGenerator &rng, unsigned int length, bool pumpAll, BufferedTransformation *outQueue = nullptr); unsigned long Pump(unsigned long pumpMax=ULONG_MAX) {return m_store.TransferTo(*AttachedTransformation(), pumpMax);} diff --git a/external/ours/library/crypto/src/shared/original/queue.cpp b/external/ours/library/crypto/src/shared/original/queue.cpp index b18c2b4a..2fb3250a 100755 --- a/external/ours/library/crypto/src/shared/original/queue.cpp +++ b/external/ours/library/crypto/src/shared/original/queue.cpp @@ -152,7 +152,7 @@ void ByteQueue::CopyFrom(const ByteQueue ©) m_tail = m_tail->next; } - m_tail->next = NULL; + m_tail->next = nullptr; Put(copy.m_lazyString, copy.m_lazyLength); } diff --git a/external/ours/library/crypto/src/shared/original/smartptr.h b/external/ours/library/crypto/src/shared/original/smartptr.h index 6a0595a1..f5c0b41b 100755 --- a/external/ours/library/crypto/src/shared/original/smartptr.h +++ b/external/ours/library/crypto/src/shared/original/smartptr.h @@ -9,7 +9,7 @@ NAMESPACE_BEGIN(CryptoPP) template class member_ptr { public: - explicit member_ptr(T *p = NULL) : m_p(p) {} + explicit member_ptr(T *p = nullptr) : m_p(p) {} ~member_ptr(); @@ -47,9 +47,9 @@ template class value_ptr : public member_ptr { public: value_ptr(const T &obj) : member_ptr(new T(obj)) {} - value_ptr(T *p = NULL) : member_ptr(p) {} + value_ptr(T *p = nullptr) : member_ptr(p) {} value_ptr(const value_ptr& rhs) - : member_ptr(rhs.m_p ? new T(*rhs.m_p) : NULL) {} + : member_ptr(rhs.m_p ? new T(*rhs.m_p) : nullptr) {} value_ptr& operator=(const value_ptr& rhs); bool operator==(const value_ptr& rhs) @@ -61,7 +61,7 @@ public: template value_ptr& value_ptr::operator=(const value_ptr& rhs) { T *old_p = this->m_p; - this->m_p = rhs.m_p ? new T(*rhs.m_p) : NULL; + this->m_p = rhs.m_p ? new T(*rhs.m_p) : nullptr; delete old_p; return *this; } @@ -72,9 +72,9 @@ template class clonable_ptr : public member_ptr { public: clonable_ptr(const T &obj) : member_ptr(obj.Clone()) {} - clonable_ptr(T *p = NULL) : member_ptr(p) {} + clonable_ptr(T *p = nullptr) : member_ptr(p) {} clonable_ptr(const clonable_ptr& rhs) - : member_ptr(rhs.m_p ? rhs.m_p->Clone() : NULL) {} + : member_ptr(rhs.m_p ? rhs.m_p->Clone() : nullptr) {} clonable_ptr& operator=(const clonable_ptr& rhs); }; @@ -82,7 +82,7 @@ public: template clonable_ptr& clonable_ptr::operator=(const clonable_ptr& rhs) { T *old_p = this->m_p; - this->m_p = rhs.m_p ? rhs.m_p->Clone() : NULL; + this->m_p = rhs.m_p ? rhs.m_p->Clone() : nullptr; delete old_p; return *this; } @@ -184,8 +184,8 @@ template class ConstructorTemp { protected: - ConstructorTemp(const ConstructorTemp ©) : m_temp(NULL) {} - ConstructorTemp(T *t = NULL) : m_temp(t) {} + ConstructorTemp(const ConstructorTemp ©) : m_temp(nullptr) {} + ConstructorTemp(T *t = nullptr) : m_temp(t) {} ConstructorTemp(const T &t) : m_temp(new T(t)) {} member_ptr m_temp; }; diff --git a/external/ours/library/crypto/src/shared/wrapper/TwofishCrypt.cpp b/external/ours/library/crypto/src/shared/wrapper/TwofishCrypt.cpp index 0a88c460..9a272ae3 100755 --- a/external/ours/library/crypto/src/shared/wrapper/TwofishCrypt.cpp +++ b/external/ours/library/crypto/src/shared/wrapper/TwofishCrypt.cpp @@ -84,7 +84,7 @@ void TwofishCrypt::process(const unsigned char * const inputBuffer, unsigned cha } assert( r == 0 ); // size must be a 16 byte block for Twofish to do it's job! } - assert(cipher != NULL); // can't process data without a twofish encryptor or decryptor! + assert(cipher != nullptr); // can't process data without a twofish encryptor or decryptor! } //----------------------------------------------------------------------- diff --git a/external/ours/library/fileInterface/src/shared/AbstractFile.cpp b/external/ours/library/fileInterface/src/shared/AbstractFile.cpp index dd575c36..ef76c7cf 100755 --- a/external/ours/library/fileInterface/src/shared/AbstractFile.cpp +++ b/external/ours/library/fileInterface/src/shared/AbstractFile.cpp @@ -15,7 +15,7 @@ namespace AbstractFileNamespace { - AbstractFile::AudioServeFunction s_audioServeFunction = NULL; + AbstractFile::AudioServeFunction s_audioServeFunction = nullptr; } using namespace AbstractFileNamespace; @@ -51,7 +51,7 @@ void AbstractFile::flush() byte *AbstractFile::readEntireFileAndClose() { - if (s_audioServeFunction != NULL) + if (s_audioServeFunction != nullptr) (*s_audioServeFunction)(); seek(SeekBegin, 0); @@ -84,7 +84,7 @@ int AbstractFile::getZlibCompressedLength() const void AbstractFile::getZlibCompressedDataAndClose(byte *& compressedBuffer, int & compressedBufferLength) { - compressedBuffer = NULL; + compressedBuffer = nullptr; compressedBufferLength = -1; } diff --git a/external/ours/library/fileInterface/src/shared/AbstractFile.h b/external/ours/library/fileInterface/src/shared/AbstractFile.h index 0f649d1e..62c4f804 100755 --- a/external/ours/library/fileInterface/src/shared/AbstractFile.h +++ b/external/ours/library/fileInterface/src/shared/AbstractFile.h @@ -110,7 +110,7 @@ public: * Read the entire file into a memory buffer. The client is responsible for deleting the buffer * using operator delete(). The file will be closed after the read completes. * - * @return null if an error occured + * @return nullptr if an error occured */ virtual unsigned char *readEntireFileAndClose(); diff --git a/external/ours/library/fileInterface/src/shared/StdioFile.cpp b/external/ours/library/fileInterface/src/shared/StdioFile.cpp index 1e7225ed..bb890dfa 100755 --- a/external/ours/library/fileInterface/src/shared/StdioFile.cpp +++ b/external/ours/library/fileInterface/src/shared/StdioFile.cpp @@ -35,7 +35,7 @@ void StdioFile::close() if(m_file) { fclose(m_file); - m_file = NULL; + m_file = nullptr; } } @@ -43,7 +43,7 @@ void StdioFile::close() bool StdioFile::isOpen() const { - return m_file != NULL; + return m_file != nullptr; } // ---------------------------------------------------------------------- @@ -71,7 +71,7 @@ int StdioFile::tell() const bool StdioFile::seek(SeekType seekType, int offset) { - assert(m_file != NULL); + assert(m_file != nullptr); m_justWrote = false; int result = 0; @@ -97,7 +97,7 @@ bool StdioFile::seek(SeekType seekType, int offset) int StdioFile::read(void* dest_buffer, int num_bytes) { - assert(m_file != NULL); + assert(m_file != nullptr); resyncStream(); return static_cast(fread(dest_buffer, 1, static_cast(num_bytes), m_file)); } @@ -106,7 +106,7 @@ int StdioFile::read(void* dest_buffer, int num_bytes) int StdioFile::write(int num_bytes, const void* source_buffer) { - assert(m_file != NULL); + assert(m_file != nullptr); m_justWrote = true; return static_cast(fwrite(source_buffer, 1, static_cast(num_bytes), m_file)); } @@ -115,7 +115,7 @@ int StdioFile::write(int num_bytes, const void* source_buffer) void StdioFile::flush() { - assert(m_file != NULL); + assert(m_file != nullptr); fflush(m_file); m_justWrote = false; } @@ -136,9 +136,9 @@ void StdioFile::resyncStream() AbstractFile* StdioFileFactory::createFile(const char *fileName, const char *openType) { if(!fileName || !openType) - return NULL; + return nullptr; else if (fileName[0] == '\0' || openType[0] == '\0') - return NULL; + return nullptr; else return new StdioFile(fileName, openType); } diff --git a/external/ours/library/localization/src/shared/LocalizationManager.cpp b/external/ours/library/localization/src/shared/LocalizationManager.cpp index 518bf42b..e7b106ca 100755 --- a/external/ours/library/localization/src/shared/LocalizationManager.cpp +++ b/external/ours/library/localization/src/shared/LocalizationManager.cpp @@ -77,8 +77,8 @@ using namespace LocalizationManagerNamespace; //---------------------------------------------------------------------- bool LocalizationManager::ms_installed = 0; -LocalizationManager::LocalizationManagerHashMap * LocalizationManager::ms_singletonHashMap = NULL; -Unicode::NarrowString * LocalizationManager::ms_firstLocaleLoaded = NULL; +LocalizationManager::LocalizationManagerHashMap * LocalizationManager::ms_singletonHashMap = nullptr; +Unicode::NarrowString * LocalizationManager::ms_firstLocaleLoaded = nullptr; //----------------------------------------------------------------- @@ -103,7 +103,7 @@ m_displayBadStringIds (displayBadStringIds) m_usingEnglishLocale = false; } - assert (m_fileFactory != NULL);//lint !e1924 // c-style cast. MSVC bug + assert (m_fileFactory != nullptr);//lint !e1924 // c-style cast. MSVC bug } //----------------------------------------------------------------- @@ -181,23 +181,23 @@ void LocalizationManager::install (AbstractFileFactory * fileFactory, Unicode::U void LocalizationManager::remove () { assert (ms_installed);//lint !e1924 // c-style cast. MSVC bug - assert (ms_singletonHashMap != NULL);//lint !e1924 // c-style cast. MSVC bug - assert (ms_firstLocaleLoaded != NULL); + assert (ms_singletonHashMap != nullptr);//lint !e1924 // c-style cast. MSVC bug + assert (ms_firstLocaleLoaded != nullptr); LocalizationManagerHashMap::iterator end = ms_singletonHashMap->end(); for (LocalizationManagerHashMap::iterator it = ms_singletonHashMap->begin(); it != end; ++it) { LocalizationManager * current = (*it).second; - (*it).second = NULL; + (*it).second = nullptr; delete current; } ms_singletonHashMap->clear(); delete ms_singletonHashMap; - ms_singletonHashMap = NULL; + ms_singletonHashMap = nullptr; delete ms_firstLocaleLoaded; - ms_firstLocaleLoaded = NULL; + ms_firstLocaleLoaded = nullptr; ms_installed = false; } @@ -277,7 +277,7 @@ LocalizedStringTable * LocalizationManager::fetchStringTable(const Unicode::Narr if(find_iter != stmap.end ()) { TimedStringTable & tst = (*find_iter).second; - //-- this can be null + //-- this can be nullptr table = tst.second; tst.first = time(0); } diff --git a/external/ours/library/localization/src/shared/LocalizedString.cpp b/external/ours/library/localization/src/shared/LocalizedString.cpp index 88817b83..de996f95 100755 --- a/external/ours/library/localization/src/shared/LocalizedString.cpp +++ b/external/ours/library/localization/src/shared/LocalizedString.cpp @@ -193,10 +193,10 @@ LocalizedString * LocalizedString::load_0000 (AbstractFile & fl) if (!fl.read (&buflen, sizeof (id_type))) return 0; - // buflen does not include null terminator + // buflen does not include nullptr terminator Unicode::unicode_char_t * buf = new Unicode::unicode_char_t [buflen+1]; - assert (buf != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (buf != nullptr); //lint !e1924 // c-style cast. MSVC bug buf [buflen] = 0; @@ -214,7 +214,7 @@ LocalizedString * LocalizedString::load_0000 (AbstractFile & fl) // TODO: Localized strings are stored little endian! loc_str = new LocalizedString(id, buf); - assert (loc_str != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (loc_str != nullptr); //lint !e1924 // c-style cast. MSVC bug loc_str->resetLineCounts (); @@ -247,10 +247,10 @@ LocalizedString * LocalizedString::load_0001 (AbstractFile & fl) if (!fl.read (&buflen, sizeof (id_type))) return 0; - // buflen does not include null terminator + // buflen does not include nullptr terminator Unicode::unicode_char_t * buf = new Unicode::unicode_char_t [buflen+1]; - assert (buf != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (buf != nullptr); //lint !e1924 // c-style cast. MSVC bug buf [buflen] = 0; @@ -268,7 +268,7 @@ LocalizedString * LocalizedString::load_0001 (AbstractFile & fl) // TODO: Localized strings are stored little endian! loc_str = new LocalizedString(id, crcSource, buf); - assert (loc_str != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (loc_str != nullptr); //lint !e1924 // c-style cast. MSVC bug loc_str->resetLineCounts (); diff --git a/external/ours/library/localization/src/shared/LocalizedStringTable.cpp b/external/ours/library/localization/src/shared/LocalizedStringTable.cpp index 10ab6c60..e0519d6e 100755 --- a/external/ours/library/localization/src/shared/LocalizedStringTable.cpp +++ b/external/ours/library/localization/src/shared/LocalizedStringTable.cpp @@ -187,10 +187,10 @@ bool LocalizedStringTable::load_0000 (AbstractFile & fl) if (!fl.read (&buflen, sizeof (LocalizedString::id_type))) return false; - // buflen does not include null terminator + // buflen does not include nullptr terminator char * buf = new char [buflen+1]; - assert (buf != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (buf != nullptr); //lint !e1924 // c-style cast. MSVC bug buf [buflen] = 0; @@ -276,10 +276,10 @@ bool LocalizedStringTable::load_0001(AbstractFile & fl) if (!fl.read (&buflen, sizeof (LocalizedString::id_type))) return false; - // buflen does not include null terminator + // buflen does not include nullptr terminator char * buf = new char [buflen+1]; - assert (buf != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (buf != nullptr); //lint !e1924 // c-style cast. MSVC bug buf [buflen] = 0; @@ -333,7 +333,7 @@ LocalizedStringTable *LocalizedStringTable::load (AbstractFileFactory & fileFact { case 0: table = new LocalizedStringTable (filename); - assert (table != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (table != nullptr); //lint !e1924 // c-style cast. MSVC bug if (table->load_0000 (*fl) == false) { @@ -344,7 +344,7 @@ LocalizedStringTable *LocalizedStringTable::load (AbstractFileFactory & fileFact case 1: table = new LocalizedStringTable (filename); - assert (table != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (table != nullptr); //lint !e1924 // c-style cast. MSVC bug if (table->load_0001 (*fl) == false) { diff --git a/external/ours/library/localization/src/shared/LocalizedStringTableReaderWriter.cpp b/external/ours/library/localization/src/shared/LocalizedStringTableReaderWriter.cpp index 19e95784..e7dfbf27 100755 --- a/external/ours/library/localization/src/shared/LocalizedStringTableReaderWriter.cpp +++ b/external/ours/library/localization/src/shared/LocalizedStringTableReaderWriter.cpp @@ -126,7 +126,7 @@ bool LocalizedStringTableRW::str_write(AbstractFile & fl, LocalizedString & locs // TODO: swab this buffer Unicode::unicode_char_t * buf = new Unicode::unicode_char_t [buflen+1]; - assert (buf != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (buf != nullptr); //lint !e1924 // c-style cast. MSVC bug buf [buflen] = 0; memcpy (buf, locstr.m_str.c_str (), sizeof (Unicode::unicode_char_t) * buflen); @@ -183,7 +183,7 @@ bool LocalizedStringTableRW::write(AbstractFile & fl) const char * buf = new char [buflen + 1]; - assert (buf != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (buf != nullptr); //lint !e1924 // c-style cast. MSVC bug buf [buflen] = 0; @@ -230,7 +230,7 @@ LocalizedStringTableRW *LocalizedStringTableRW::loadRW (AbstractFileFactory & fi { case 0: table = new LocalizedStringTableRW (filename); - assert (table != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (table != nullptr); //lint !e1924 // c-style cast. MSVC bug if (table->load_0000 (*fl) == false) { @@ -241,7 +241,7 @@ LocalizedStringTableRW *LocalizedStringTableRW::loadRW (AbstractFileFactory & fi case 1: table = new LocalizedStringTableRW (filename); - assert (table != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (table != nullptr); //lint !e1924 // c-style cast. MSVC bug if (table->load_0001 (*fl) == false) { @@ -336,7 +336,7 @@ LocalizedString * LocalizedStringTableRW::addString (const Unicode::String & st { LocalizedString * const locstr = (m_map [m_nextUniqueId] = new LocalizedString (m_nextUniqueId, int(time(0)), str)); - assert (locstr != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (locstr != nullptr); //lint !e1924 // c-style cast. MSVC bug char buf[64]; sprintf (buf, "%03ld_default", m_nextUniqueId); @@ -538,7 +538,7 @@ void LocalizedStringTableRW::prepareTable (const LocalizedStringTableRW & rhs) LocalizedString * locstr = new LocalizedString (rhs_locstr->m_id, 0, rhs_locstr->m_str); - assert (locstr != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (locstr != nullptr); //lint !e1924 // c-style cast. MSVC bug m_map.insert (Map_t::value_type (locstr->getId (), locstr )); } } diff --git a/external/ours/library/singleton/src/shared/Singleton2.h b/external/ours/library/singleton/src/shared/Singleton2.h index 130d0cd7..1b42905d 100755 --- a/external/ours/library/singleton/src/shared/Singleton2.h +++ b/external/ours/library/singleton/src/shared/Singleton2.h @@ -138,7 +138,7 @@ inline Singleton2::Singleton2() template inline Singleton2::~Singleton2() { - assert(instance != NULL); + assert(instance != nullptr); instance = 0; } @@ -165,7 +165,7 @@ inline Singleton2::~Singleton2() template inline ValueType & Singleton2::getInstance() { - assert(instance != NULL); + assert(instance != nullptr); return *instance; } diff --git a/external/ours/library/unicode/src/shared/UnicodeCharacterDataMap.cpp b/external/ours/library/unicode/src/shared/UnicodeCharacterDataMap.cpp index 3f67e74a..6206b680 100755 --- a/external/ours/library/unicode/src/shared/UnicodeCharacterDataMap.cpp +++ b/external/ours/library/unicode/src/shared/UnicodeCharacterDataMap.cpp @@ -218,7 +218,7 @@ CharDataMap::ErrorCode CharDataMap::generateMapFromBuffer (const Unicode::Blocks { CharData * data = new CharData; - assert (data != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (data != nullptr); //lint !e1924 // c-style cast. MSVC bug data->m_reverseCase = 0; @@ -244,7 +244,7 @@ CharDataMap::ErrorCode CharDataMap::generateMapFromBuffer (const Unicode::Blocks m_contiguousData = new CharData [validChars]; - assert (m_contiguousData != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (m_contiguousData != nullptr); //lint !e1924 // c-style cast. MSVC bug size_t dataIndex = 0; @@ -288,7 +288,7 @@ CharDataMap::ErrorCode CharDataMap::generateMap (const Unicode::Blocks::Mapping char * buffer = new char [fileLen + 1]; buffer [fileLen] = 0; - assert (buffer != NULL); //lint !e1924 // c-style cast. MSVC bug + assert (buffer != nullptr); //lint !e1924 // c-style cast. MSVC bug if (fread (buffer, fileLen, 1, fl) != 1) { diff --git a/external/ours/library/unicode/src/shared/UnicodeCharacterDataMap.h b/external/ours/library/unicode/src/shared/UnicodeCharacterDataMap.h index ba84cac2..7659b543 100755 --- a/external/ours/library/unicode/src/shared/UnicodeCharacterDataMap.h +++ b/external/ours/library/unicode/src/shared/UnicodeCharacterDataMap.h @@ -117,7 +117,7 @@ namespace Unicode /** * Find a CharData for the given code point. - * @return null if no CharData exists for this code point + * @return nullptr if no CharData exists for this code point */ inline const CharData * CharDataMap::findCharData (const unicode_char_t code) const diff --git a/external/ours/library/unicode/src/shared/UnicodeUtils.cpp b/external/ours/library/unicode/src/shared/UnicodeUtils.cpp index 4417fc0c..7bf90e7d 100755 --- a/external/ours/library/unicode/src/shared/UnicodeUtils.cpp +++ b/external/ours/library/unicode/src/shared/UnicodeUtils.cpp @@ -103,7 +103,7 @@ namespace Unicode } else if (*from == 0x0000) { - // null character + // nullptr character str += static_cast(0x0000); } else if (*from >= 0x0800) diff --git a/external/ours/library/unicode/src/shared/UnicodeUtils.h b/external/ours/library/unicode/src/shared/UnicodeUtils.h index f2a722ae..348bb64f 100755 --- a/external/ours/library/unicode/src/shared/UnicodeUtils.h +++ b/external/ours/library/unicode/src/shared/UnicodeUtils.h @@ -79,8 +79,8 @@ namespace Unicode bool getNthToken (const Unicode::NarrowString & str, const size_t n, size_t & pos, size_t & endpos, Unicode::NarrowString & token, const char * sepChars = ascii_whitespace); size_t skipWhitespace (const Unicode::NarrowString & str, size_t pos, const char * white = ascii_whitespace); - bool tokenize (const Unicode::String & theStr, UnicodeStringVector & result, Unicode::String const * const delimiters = NULL, Unicode::String const * const separators = NULL); - bool tokenize (const Unicode::String & theStr, UnicodeStringVector & result, const size_t tokenPos, size_t & whichToken, size_t & token_start, size_t & token_end, Unicode::String const * const delimiters = NULL, Unicode::String const * const separators = NULL); + bool tokenize (const Unicode::String & theStr, UnicodeStringVector & result, Unicode::String const * const delimiters = nullptr, Unicode::String const * const separators = nullptr); + bool tokenize (const Unicode::String & theStr, UnicodeStringVector & result, const size_t tokenPos, size_t & whichToken, size_t & token_start, size_t & token_end, Unicode::String const * const delimiters = nullptr, Unicode::String const * const separators = nullptr); bool isUnicode (const Unicode::String & theStr); diff --git a/external/ours/library/unicode/src/shared/utf8.cpp b/external/ours/library/unicode/src/shared/utf8.cpp index 75901043..3a19d82a 100755 --- a/external/ours/library/unicode/src/shared/utf8.cpp +++ b/external/ours/library/unicode/src/shared/utf8.cpp @@ -96,7 +96,7 @@ int UTF8_convertCharToUTF16( char * ptr , UTF16 * ret ) int UTF8_convertToUTF16( char * ptr , UTF16 * ret, int limit ) { int len = 0; - while (( *ptr != 0 ) && ( len < ( limit - 1 ) ))//we use limit -1 to leave room for the null terminator + while (( *ptr != 0 ) && ( len < ( limit - 1 ) ))//we use limit -1 to leave room for the nullptr terminator { int clen = UTF8_convertCharToUTF16( ptr, ret ); if (clen == 0) diff --git a/game/server/application/SwgDatabaseServer/src/linux/main.cpp b/game/server/application/SwgDatabaseServer/src/linux/main.cpp index 9878eed1..71cc11b2 100755 --- a/game/server/application/SwgDatabaseServer/src/linux/main.cpp +++ b/game/server/application/SwgDatabaseServer/src/linux/main.cpp @@ -43,7 +43,7 @@ int main(int argc, char ** argv) SetupSharedFoundation::install (setupFoundationData); SetupSharedFile::install(false); - SetupSharedRandom::install(time(NULL)); + SetupSharedRandom::install(time(nullptr)); SetupSharedNetwork::SetupData networkSetupData; SetupSharedNetwork::getDefaultServerSetupData(networkSetupData); SetupSharedNetwork::install(networkSetupData); diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/AuctionLocationsBuffer.cpp b/game/server/application/SwgDatabaseServer/src/shared/buffers/AuctionLocationsBuffer.cpp index c0baa227..ec5603db 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/AuctionLocationsBuffer.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/buffers/AuctionLocationsBuffer.cpp @@ -30,7 +30,7 @@ AuctionLocationsBuffer::~AuctionLocationsBuffer(void) for (IndexType::iterator i=m_rows.begin(); i!=m_rows.end(); ++i) { delete i->second; - i->second=NULL; + i->second=nullptr; } } @@ -56,7 +56,7 @@ void AuctionLocationsBuffer::removeAuctionLocations(const NetworkId &locationId) if (i!=m_rows.end()) { delete i->second; - i->second=NULL; + i->second=nullptr; m_rows.erase(i); } } diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/BattlefieldParticipantBuffer.cpp b/game/server/application/SwgDatabaseServer/src/shared/buffers/BattlefieldParticipantBuffer.cpp index 7abc8164..41038e8a 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/BattlefieldParticipantBuffer.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/buffers/BattlefieldParticipantBuffer.cpp @@ -30,7 +30,7 @@ BattlefieldParticipantBuffer::~BattlefieldParticipantBuffer(void) for (IndexType::iterator i=m_rows.begin(); i!=m_rows.end(); ++i) { delete i->second; - i->second=NULL; + i->second=nullptr; } } @@ -156,7 +156,7 @@ void BattlefieldParticipantBuffer::removeObject(const NetworkId &object) IndexType::iterator next=i; ++next; delete i->second; - i->second=NULL; + i->second=nullptr; m_rows.erase(i); i=next; } diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/BountyHunterTargetBuffer.cpp b/game/server/application/SwgDatabaseServer/src/shared/buffers/BountyHunterTargetBuffer.cpp index 4098e2c3..16d361fe 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/BountyHunterTargetBuffer.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/buffers/BountyHunterTargetBuffer.cpp @@ -31,7 +31,7 @@ BountyHunterTargetBuffer::~BountyHunterTargetBuffer() for (DataType::iterator i=m_data.begin(); i!=m_data.end(); ++i) { delete i->second; - i->second=NULL; + i->second=nullptr; } } diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/CreatureObjectBuffer.cpp b/game/server/application/SwgDatabaseServer/src/shared/buffers/CreatureObjectBuffer.cpp index 10556590..92dcbbfd 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/CreatureObjectBuffer.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/buffers/CreatureObjectBuffer.cpp @@ -238,7 +238,7 @@ void CreatureObjectBuffer::getAttributesForObject(const NetworkId &objectId, std } if (value == -999) { - WARNING(true,("Object %s had null attribute %i, defaulting to 100",objectId.getValueString().c_str(), position)); + WARNING(true,("Object %s had nullptr attribute %i, defaulting to 100",objectId.getValueString().c_str(), position)); value = 100; } diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/ExperienceBuffer.cpp b/game/server/application/SwgDatabaseServer/src/shared/buffers/ExperienceBuffer.cpp index 5c361b16..ffd4068f 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/ExperienceBuffer.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/buffers/ExperienceBuffer.cpp @@ -31,7 +31,7 @@ ExperienceBuffer::~ExperienceBuffer(void) for (IndexType::iterator i=m_rows.begin(); i!=m_rows.end(); ++i) { delete i->second; - i->second=NULL; + i->second=nullptr; } } @@ -157,7 +157,7 @@ void ExperienceBuffer::removeObject(const NetworkId &object) IndexType::iterator next=i; ++next; delete i->second; - i->second=NULL; + i->second=nullptr; m_rows.erase(i); i=next; } diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/IndexedNetworkTableBuffer.h b/game/server/application/SwgDatabaseServer/src/shared/buffers/IndexedNetworkTableBuffer.h index 5180b92a..65ba2205 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/IndexedNetworkTableBuffer.h +++ b/game/server/application/SwgDatabaseServer/src/shared/buffers/IndexedNetworkTableBuffer.h @@ -103,7 +103,7 @@ IndexedNetworkTableBuffer::~IndexedNetworkTable { delete i->second; ++m_sRowsDeleted; - i->second=NULL; + i->second=nullptr; } } @@ -161,7 +161,7 @@ void IndexedNetworkTableBuffer::removeObject(co { delete i->second; ++m_sRowsDeleted; - i->second=NULL; + i->second=nullptr; m_rows.erase(i); } } diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/ManufactureSchematicAttributeBuffer.cpp b/game/server/application/SwgDatabaseServer/src/shared/buffers/ManufactureSchematicAttributeBuffer.cpp index 12c4e790..487169ef 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/ManufactureSchematicAttributeBuffer.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/buffers/ManufactureSchematicAttributeBuffer.cpp @@ -31,7 +31,7 @@ ManufactureSchematicAttributeBuffer::~ManufactureSchematicAttributeBuffer(void) for (IndexType::iterator i=m_rows.begin(); i!=m_rows.end(); ++i) { delete i->second; - i->second=NULL; + i->second=nullptr; } } @@ -174,7 +174,7 @@ void ManufactureSchematicAttributeBuffer::removeObject(const NetworkId &object) IndexType::iterator next=i; ++next; delete i->second; - i->second=NULL; + i->second=nullptr; m_rows.erase(i); i=next; } diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/MarketAuctionBidsBuffer.cpp b/game/server/application/SwgDatabaseServer/src/shared/buffers/MarketAuctionBidsBuffer.cpp index 3a024651..65d95c48 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/MarketAuctionBidsBuffer.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/buffers/MarketAuctionBidsBuffer.cpp @@ -31,7 +31,7 @@ MarketAuctionBidsBuffer::~MarketAuctionBidsBuffer(void) for (IndexType::iterator i=m_rows.begin(); i!=m_rows.end(); ++i) { delete i->second; - i->second=NULL; + i->second=nullptr; } } @@ -57,7 +57,7 @@ void MarketAuctionBidsBuffer::removeMarketAuctionBids(const NetworkId &itemId) if (i!=m_rows.end()) { delete i->second; - i->second=NULL; + i->second=nullptr; m_rows.erase(i); } } diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/MarketAuctionsBuffer.cpp b/game/server/application/SwgDatabaseServer/src/shared/buffers/MarketAuctionsBuffer.cpp index 8663d1ef..b8529107 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/MarketAuctionsBuffer.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/buffers/MarketAuctionsBuffer.cpp @@ -31,7 +31,7 @@ MarketAuctionsBufferCreate::~MarketAuctionsBufferCreate(void) for (IndexType::iterator i=m_rows.begin(); i!=m_rows.end(); ++i) { delete i->second; - i->second=NULL; + i->second=nullptr; } } @@ -217,7 +217,7 @@ MarketAuctionsBufferDelete::~MarketAuctionsBufferDelete(void) for (IndexType::iterator i=m_rows.begin(); i!=m_rows.end(); ++i) { delete i->second; - i->second=NULL; + i->second=nullptr; } } @@ -330,7 +330,7 @@ MarketAuctionsBufferUpdate::~MarketAuctionsBufferUpdate(void) for (IndexType::iterator i=m_rows.begin(); i!=m_rows.end(); ++i) { delete i->second; - i->second=NULL; + i->second=nullptr; } } diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/ObjectTableBuffer.cpp b/game/server/application/SwgDatabaseServer/src/shared/buffers/ObjectTableBuffer.cpp index 4491b654..b3d787d0 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/ObjectTableBuffer.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/buffers/ObjectTableBuffer.cpp @@ -265,11 +265,11 @@ bool ObjectTableBuffer::save(DB::Session *session) #if 0 // Enable this to debug load_with problems DEBUG_REPORT_LOG(true,("Save object %s ",i->second->object_id.getValue().getValueString().c_str())); if (i->second->contained_by.isNull()) - DEBUG_REPORT_LOG(true, ("contained_by NULL ")); + DEBUG_REPORT_LOG(true, ("contained_by nullptr ")); else DEBUG_REPORT_LOG(true, ("contained_by %s ",i->second->contained_by.getValue().getValueString().c_str())); if (i->second->load_with.isNull()) - DEBUG_REPORT_LOG(true,("load_with NULL\n")); + DEBUG_REPORT_LOG(true,("load_with nullptr\n")); else DEBUG_REPORT_LOG(true,("load_with %s\n",i->second->load_with.getValue().getValueString().c_str())); #endif @@ -671,7 +671,7 @@ void ObjectTableBuffer::getObjvarsForObject(const NetworkId &objectId, std::vect int ObjectTableBuffer::encodeObjVarFreeFlags(const NetworkId & objectId) const { const DBSchema::ObjectBufferRow *row=findConstRowByIndex(objectId); - WARNING_STRICT_FATAL(row==NULL,("Loading object %s, no ObjectRow in the buffer\n",objectId.getValueString().c_str())); + WARNING_STRICT_FATAL(row==nullptr,("Loading object %s, no ObjectRow in the buffer\n",objectId.getValueString().c_str())); if (!row) return 0; diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/ResourceTypeBuffer.cpp b/game/server/application/SwgDatabaseServer/src/shared/buffers/ResourceTypeBuffer.cpp index 0784be9b..fe6cca4f 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/ResourceTypeBuffer.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/buffers/ResourceTypeBuffer.cpp @@ -31,7 +31,7 @@ ResourceTypeBuffer::~ResourceTypeBuffer() for (DataType::iterator i=m_data.begin(); i!=m_data.end(); ++i) { delete i->second; - i->second=NULL; + i->second=nullptr; } } @@ -41,7 +41,7 @@ void ResourceTypeBuffer::handleAddResourceTypeMessage(AddResourceTypeMessage con { for (std::vector::const_iterator typeData = message.getData().begin(); typeData != message.getData().end(); ++typeData) { - DBSchema::ResourceTypeRow * row = NULL; + DBSchema::ResourceTypeRow * row = nullptr; DataType::iterator rowIter = m_data.find(typeData->m_networkId); if (rowIter == m_data.end()) { diff --git a/game/server/application/SwgDatabaseServer/src/shared/cleanup/TaskObjectTemplateListUpdater.cpp b/game/server/application/SwgDatabaseServer/src/shared/cleanup/TaskObjectTemplateListUpdater.cpp index 7b73fc9b..f4653cd9 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/cleanup/TaskObjectTemplateListUpdater.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/cleanup/TaskObjectTemplateListUpdater.cpp @@ -45,7 +45,7 @@ bool TaskObjectTemplateListUpdater::process(DB::Session *session) strcpy(s_sql,"commit"); else if ( i_retval == 2 ) // got ID & Name { - s_name[256]=0; // null term to make sure it fits + s_name[256]=0; // nullptr term to make sure it fits sprintf(s_sql,"insert into object_templates values (%d,'%s')",i_id,s_name); } else diff --git a/game/server/application/SwgDatabaseServer/src/shared/core/CMLoader.cpp b/game/server/application/SwgDatabaseServer/src/shared/core/CMLoader.cpp index 405d6a80..56ac35e8 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/core/CMLoader.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/core/CMLoader.cpp @@ -25,7 +25,7 @@ #include "TaskGetLocationList.h" #include "TaskGetBidList.h" -CMLoader *CMLoader::ms_instance = NULL; +CMLoader *CMLoader::ms_instance = nullptr; // ====================================================================== @@ -42,7 +42,7 @@ void CMLoader::remove() { NOT_NULL(ms_instance); delete ms_instance; - ms_instance = NULL; + ms_instance = nullptr; } // ---------------------------------------------------------------------- diff --git a/game/server/application/SwgDatabaseServer/src/shared/core/ObjvarNameManager.cpp b/game/server/application/SwgDatabaseServer/src/shared/core/ObjvarNameManager.cpp index d5955036..e442f568 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/core/ObjvarNameManager.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/core/ObjvarNameManager.cpp @@ -17,8 +17,8 @@ // ====================================================================== -ObjvarNameManager * ObjvarNameManager::ms_instance = NULL; -ObjvarNameManager * ObjvarNameManager::ms_goldInstance = NULL; +ObjvarNameManager * ObjvarNameManager::ms_instance = nullptr; +ObjvarNameManager * ObjvarNameManager::ms_goldInstance = nullptr; // ====================================================================== @@ -37,11 +37,11 @@ void ObjvarNameManager::remove() { NOT_NULL(ms_instance); delete ms_instance; - ms_instance = NULL; + ms_instance = nullptr; NOT_NULL(ms_goldInstance); delete ms_goldInstance; - ms_goldInstance = NULL; + ms_goldInstance = nullptr; } // ---------------------------------------------------------------------- @@ -64,9 +64,9 @@ ObjvarNameManager::~ObjvarNameManager() delete m_nameToIdMap; delete m_idToNameMap; delete m_newNames; - m_nameToIdMap=NULL; - m_idToNameMap=NULL; - m_newNames=NULL; + m_nameToIdMap=nullptr; + m_idToNameMap=nullptr; + m_newNames=nullptr; } // ---------------------------------------------------------------------- @@ -169,7 +169,7 @@ DB::TaskRequest *ObjvarNameManager::saveNewNames() return task; } else - return NULL; + return nullptr; } // ====================================================================== diff --git a/game/server/application/SwgDatabaseServer/src/shared/core/SwgLoader.cpp b/game/server/application/SwgDatabaseServer/src/shared/core/SwgLoader.cpp index 206cd1ee..99d689d9 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/core/SwgLoader.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/core/SwgLoader.cpp @@ -29,9 +29,9 @@ void SwgLoader::install() SwgLoader::SwgLoader() : Loader(), - m_pendingTaskVerifyCharacter(NULL), - m_loadingTaskVerifyCharacter(NULL), - m_verifyCharacterTaskQ(NULL) + m_pendingTaskVerifyCharacter(nullptr), + m_loadingTaskVerifyCharacter(nullptr), + m_verifyCharacterTaskQ(nullptr) { m_verifyCharacterTaskQ = new DB::TaskQueue(1,DatabaseProcess::getInstance().getDBServer(),4); } @@ -95,7 +95,7 @@ void SwgLoader::update(real updateTime) if (m_pendingTaskVerifyCharacter && !m_loadingTaskVerifyCharacter) { m_loadingTaskVerifyCharacter = m_pendingTaskVerifyCharacter; - m_pendingTaskVerifyCharacter = NULL; + m_pendingTaskVerifyCharacter = nullptr; m_verifyCharacterTaskQ->asyncRequest(m_loadingTaskVerifyCharacter); } @@ -109,7 +109,7 @@ void SwgLoader::verifyCharacterFinished (TaskVerifyCharacter *task) { UNREF(task); DEBUG_FATAL(task!=m_loadingTaskVerifyCharacter,("Programmer bug: wrong TaskVerifyCharacter finished.\n")); - m_loadingTaskVerifyCharacter = NULL; + m_loadingTaskVerifyCharacter = nullptr; } // ---------------------------------------------------------------------- diff --git a/game/server/application/SwgDatabaseServer/src/shared/core/SwgPersister.cpp b/game/server/application/SwgDatabaseServer/src/shared/core/SwgPersister.cpp index 216a6aec..a792d1b5 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/core/SwgPersister.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/core/SwgPersister.cpp @@ -110,7 +110,7 @@ void SwgPersister::moveToPlayer(const NetworkId &oid, const NetworkId &player, c void SwgPersister::getMoneyFromOfflineObject(uint32 replyServer, NetworkId const & sourceObject, int amount, NetworkId const & replyTo, std::string const & successCallback, std::string const & failCallback, stdvector::fwd const & packedDictionary) { - SwgSnapshot * snapshot=NULL; + SwgSnapshot * snapshot=nullptr; if (hasDataForObject(sourceObject)) snapshot=safe_cast(&getSnapshotForObject(sourceObject, 0)); diff --git a/game/server/application/SwgDatabaseServer/src/shared/core/SwgSnapshot.cpp b/game/server/application/SwgDatabaseServer/src/shared/core/SwgSnapshot.cpp index b5e7e461..ccb9ccad 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/core/SwgSnapshot.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/core/SwgSnapshot.cpp @@ -96,8 +96,8 @@ SwgSnapshot::SwgSnapshot(DB::ModeQuery::Mode mode, bool useGoldDatabase) : m_vehicleObjectBuffer(mode), m_waypointBuffer(mode), m_weaponObjectBuffer(mode), - m_immediateDeleteStep(NULL), - m_offlineMoneyCustomPersistStep(NULL) + m_immediateDeleteStep(nullptr), + m_offlineMoneyCustomPersistStep(nullptr) { m_bufferList.push_back(&m_battlefieldMarkerObjectBuffer); m_bufferList.push_back(&m_battlefieldParticipantBuffer); @@ -290,10 +290,10 @@ void SwgSnapshot::decodeScriptObject(NetworkId const & objectId, Archive::ReadIt Archive::get(data,packedScriptList); if (packedScriptList.length()==0) - packedScriptList=' '; // avoid confusing an empty list with NULL + packedScriptList=' '; // avoid confusing an empty list with nullptr DBSchema::ObjectBufferRow *row=m_objectTableBuffer.findRowByIndex(objectId); - if (row==NULL) + if (row==nullptr) row=m_objectTableBuffer.addEmptyRow(objectId); row->script_list=packedScriptList; diff --git a/game/server/application/SwgDatabaseServer/src/shared/queries/CommoditiesQuery.cpp b/game/server/application/SwgDatabaseServer/src/shared/queries/CommoditiesQuery.cpp index 9a245c47..f5ae1da4 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/queries/CommoditiesQuery.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/queries/CommoditiesQuery.cpp @@ -90,7 +90,7 @@ bool AuctionLocationsQuery::setupData(DB::Session *session) bool AuctionLocationsQuery::addData(const DB::Row *_data) { const AuctionLocationsRow *myData=dynamic_cast(_data); - FATAL(myData == NULL, ("Adding NULL data into AuctionLocations")); + FATAL(myData == nullptr, ("Adding nullptr data into AuctionLocations")); switch(mode) { case mode_UPDATE: @@ -413,7 +413,7 @@ bool MarketAuctionsQuery::addData(const DB::Row *_data) case mode_UPDATE: { const MarketAuctionsRowUpdate *myData=dynamic_cast(_data); - FATAL(myData == NULL, ("Adding NULL data into MarketAuctions for mode_UPDATE")); + FATAL(myData == nullptr, ("Adding nullptr data into MarketAuctions for mode_UPDATE")); if (!m_item_ids.push_back(myData->item_id.getValueASCII())) return false; if (!m_owner_ids.push_back(myData->owner_id.getValueASCII())) return false; @@ -424,7 +424,7 @@ bool MarketAuctionsQuery::addData(const DB::Row *_data) case mode_INSERT: { const MarketAuctionsRow *myData=dynamic_cast(_data); - FATAL(myData == NULL, ("Adding NULL data into MarketAuctions for mode_INSERT")); + FATAL(myData == nullptr, ("Adding nullptr data into MarketAuctions for mode_INSERT")); if (!m_item_ids.push_back(myData->item_id.getValueASCII())) return false; if (!m_owner_ids.push_back(myData->owner_id.getValueASCII())) return false; @@ -450,7 +450,7 @@ bool MarketAuctionsQuery::addData(const DB::Row *_data) case mode_DELETE: { const MarketAuctionsRowDelete *myData=dynamic_cast(_data); - FATAL(myData == NULL, ("Adding NULL data into MarketAuctions for mode_DELETE")); + FATAL(myData == nullptr, ("Adding nullptr data into MarketAuctions for mode_DELETE")); if (!m_item_ids.push_back(myData->item_id.getValueASCII())) return false; break; @@ -716,7 +716,7 @@ bool MarketAuctionBidsQuery::addData(const DB::Row *_data) { const MarketAuctionBidsRow *myData=dynamic_cast(_data); - FATAL(myData == NULL, ("Adding NULL data into MarketAuctionBids")); + FATAL(myData == nullptr, ("Adding nullptr data into MarketAuctionBids")); switch(mode) { diff --git a/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskSaveObjvarNames.cpp b/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskSaveObjvarNames.cpp index f30e0962..d809771f 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskSaveObjvarNames.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskSaveObjvarNames.cpp @@ -24,7 +24,7 @@ TaskSaveObjvarNames::TaskSaveObjvarNames(const NameList &names) : TaskSaveObjvarNames::~TaskSaveObjvarNames() { delete m_objvarNames; - m_objvarNames=NULL; + m_objvarNames=nullptr; } // ---------------------------------------------------------------------- diff --git a/game/server/application/SwgGameServer/src/shared/combat/CombatEngine.cpp b/game/server/application/SwgGameServer/src/shared/combat/CombatEngine.cpp index 50a12bbb..4f4269cd 100755 --- a/game/server/application/SwgGameServer/src/shared/combat/CombatEngine.cpp +++ b/game/server/application/SwgGameServer/src/shared/combat/CombatEngine.cpp @@ -102,7 +102,7 @@ void CombatEngine::aim(const Command &, const NetworkId & actor, const NetworkId CachedNetworkId attackerId(actor); TangibleObject * attacker = dynamic_cast(attackerId.getObject()); - if (attacker != NULL) + if (attacker != nullptr) { attacker->addAim(); } @@ -121,7 +121,7 @@ bool CombatEngine::addTargetAction(TangibleObject & attacker, { // @todo: support tangible attacks CreatureObject * const creatureAttacker = attacker.asCreatureObject (); - if (creatureAttacker == NULL) + if (creatureAttacker == nullptr) { WARNING_STRICT_FATAL(true, ("Tangible attackers not supported yet")); return false; @@ -146,7 +146,7 @@ bool CombatEngine::addAttackAction(TangibleObject & attacker, { // @todo: support tangible attacks CreatureObject * const creatureAttacker = attacker.asCreatureObject (); - if (creatureAttacker == NULL) + if (creatureAttacker == nullptr) { WARNING_STRICT_FATAL(true, ("Tangible attackers not supported yet")); return false; @@ -176,7 +176,7 @@ bool CombatEngine::addAimAction(TangibleObject & attacker) // @todo: support tangible attacks CreatureObject * const creatureAttacker = attacker.asCreatureObject (); - if (creatureAttacker == NULL) + if (creatureAttacker == nullptr) { WARNING_STRICT_FATAL(true, ("Tangible attackers not supported yet")); return false; @@ -203,7 +203,7 @@ bool CombatEngine::onSuccessfulAttack(const TangibleObject & attacker, TangibleObject & defender, const WeaponObject & weapon, int damageAmount, int hitLocation) { - const bool creatureDefender = defender.asCreatureObject() != NULL; + const bool creatureDefender = defender.asCreatureObject() != nullptr; const bool isVehicle = GameObjectTypes::isTypeOf (defender.getGameObjectType (), SharedObjectTemplate::GOT_vehicle); // if attacking an object, always hit location 0 @@ -262,9 +262,9 @@ bool CombatEngine::onSuccessfulAttack(const TangibleObject & attacker, } else { - TangibleController * const tangibleController = (defender.getController() != NULL) ? defender.getController()->asTangibleController() : NULL; + TangibleController * const tangibleController = (defender.getController() != nullptr) ? defender.getController()->asTangibleController() : nullptr; - if (tangibleController == NULL) + if (tangibleController == nullptr) { WARNING_STRICT_FATAL(true, ("CombatEngine::onSuccessfulAttack non-auth " "defender %s doesn't have a TangibleController!", @@ -311,7 +311,7 @@ bool CombatEngine::onSuccessfulAttack(const TangibleObject & attacker, TangibleObject & defender, int damageAmount, int hitLocation) { - const bool creatureDefender = defender.asCreatureObject() != NULL; + const bool creatureDefender = defender.asCreatureObject() != nullptr; const bool isVehicle = GameObjectTypes::isTypeOf (defender.getGameObjectType (), SharedObjectTemplate::GOT_vehicle); // if attacking an object, always hit location 0 @@ -359,9 +359,9 @@ bool CombatEngine::onSuccessfulAttack(const TangibleObject & attacker, } else { - TangibleController * const tangibleController = (defender.getController() != NULL) ? defender.getController()->asTangibleController() : NULL; + TangibleController * const tangibleController = (defender.getController() != nullptr) ? defender.getController()->asTangibleController() : nullptr; - if (tangibleController == NULL) + if (tangibleController == nullptr) { WARNING_STRICT_FATAL(true, ("CombatEngine::onSuccessfulAttack non-auth " "defender %s doesn't have a TangibleController!", @@ -411,7 +411,7 @@ bool CombatEngine::damage(TangibleObject & defender, const WeaponObject & weapon const bool isVehicle = GameObjectTypes::isTypeOf (defender.getGameObjectType (), SharedObjectTemplate::GOT_vehicle); // if attacking an object, always hit location 0 - if (critter == NULL || isVehicle) + if (critter == nullptr || isVehicle) hitLocation = 0; // get the damage profile for the hit location @@ -425,7 +425,7 @@ bool CombatEngine::damage(TangibleObject & defender, const WeaponObject & weapon // put a attribMod structure on the defender's damage list for each type of // damage received DamageList damageList; - if (critter != NULL && !isVehicle) + if (critter != nullptr && !isVehicle) { computeCreatureDamage(&hitLocationData, damageAmount, damageList); } @@ -456,7 +456,7 @@ bool CombatEngine::damage(TangibleObject & defender, const WeaponObject & weapon damageData.damage.insert(damageData.damage.end(), damageList.begin(), damageList.end()); damageData.wounded = isWounded; - if (critter != NULL || !defender.isDisabled()) + if (critter != nullptr || !defender.isDisabled()) { // update the object's hit points or attributes for the damage defender.applyDamage(damageData); @@ -485,7 +485,7 @@ void CombatEngine::damage(TangibleObject & defender, const bool isVehicle = GameObjectTypes::isTypeOf (defender.getGameObjectType (), SharedObjectTemplate::GOT_vehicle); // if attacking an object, always hit location 0 - if (critter == NULL || isVehicle) + if (critter == nullptr || isVehicle) hitLocation = 0; // get the damage profile for the hit location @@ -514,7 +514,7 @@ void CombatEngine::damage(TangibleObject & defender, damageData.hitLocationIndex = hitLocation; damageData.damage.insert(damageData.damage.end(), damageList.begin(), damageList.end()); - if (critter != NULL || !defender.isDisabled()) + if (critter != nullptr || !defender.isDisabled()) { // update the object's hit points or attributes for the damage defender.applyDamage(damageData); @@ -668,7 +668,7 @@ void CombatEngine::alter(TangibleObject & object) { NOT_NULL(object.getController()); - if ( (object.getCombatData() == NULL) + if ( (object.getCombatData() == nullptr) || object.getCombatData()->defenseData.damage.empty()) { return; @@ -682,7 +682,7 @@ void CombatEngine::alter(TangibleObject & object) // if the object is a creature, get it's attributes Attributes::Value currentAttribs[Attributes::NumberOfAttributes]; CreatureObject * const critter = object.asCreatureObject (); - if (critter != NULL) + if (critter != nullptr) { for (int i = 0; i < Attributes::NumberOfAttributes; ++i) currentAttribs[i] = critter->getAttribute(i); @@ -710,7 +710,7 @@ void CombatEngine::alter(TangibleObject & object) { TangibleController * const tangibleController = object.getController()->asTangibleController(); - if (tangibleController == NULL) + if (tangibleController == nullptr) { WARNING_STRICT_FATAL(true, ("CombatEngine::alter non-auth " "object %s doesn't have a TangibleController!", diff --git a/game/server/application/SwgGameServer/src/shared/controller/JediManagerController.cpp b/game/server/application/SwgGameServer/src/shared/controller/JediManagerController.cpp index 80099996..defcc868 100755 --- a/game/server/application/SwgGameServer/src/shared/controller/JediManagerController.cpp +++ b/game/server/application/SwgGameServer/src/shared/controller/JediManagerController.cpp @@ -40,7 +40,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_removeJedi: { const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if (msg != NULL) + if (msg != nullptr) { owner->removeJedi(msg->getValue()); } @@ -49,7 +49,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_addJedi: { const MessageQueueJediData * const msg = safe_cast(data); - if (msg != NULL) + if (msg != nullptr) { owner->addJedi(msg->getId(), msg->getName(), @@ -69,7 +69,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_updateJedi: { const MessageQueueJediData * const msg = safe_cast(data); - if (msg != NULL) + if (msg != nullptr) { owner->updateJedi(msg->getId(), msg->getVisibility(), @@ -83,7 +83,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_updateJediState: { const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); - if (msg != NULL) + if (msg != nullptr) { owner->updateJedi(msg->getValue().first, static_cast(msg->getValue().second) @@ -95,7 +95,7 @@ void JediManagerController::handleMessage (const int message, const float value, { /* const MessageQueueGenericValueType > > * const msg = safe_cast > > *>(data); - if (msg != NULL) + if (msg != nullptr) { owner->updateJedi(msg->getValue().first, msg->getValue().second @@ -107,7 +107,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_updateJediLocation: { const MessageQueueJediLocation * const msg = safe_cast(data); - if (msg != NULL) + if (msg != nullptr) { owner->updateJediLocation(msg->getId(), msg->getLocation(), @@ -119,7 +119,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_setJediOffline: { const MessageQueueJediLocation * const msg = safe_cast(data); - if (msg != NULL) + if (msg != nullptr) { owner->setJediOffline(msg->getId(), msg->getLocation(), @@ -131,7 +131,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_requestJediBounty: { const MessageQueueRequestJediBounty * const msg = safe_cast(data); - if (msg != NULL) + if (msg != nullptr) { owner->requestJediBounty(msg->getTargetId(), msg->getHunterId(), @@ -145,7 +145,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_removeJediBounty: { const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); - if (msg != NULL) + if (msg != nullptr) { owner->removeJediBounty(msg->getValue().first, msg->getValue().second); } @@ -154,7 +154,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_removeAllJediBounties: { const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if (msg != NULL) + if (msg != nullptr) { owner->removeAllJediBounties(msg->getValue()); } @@ -163,7 +163,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_updateJediSpentJediSkillPoints: { const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); - if (msg != NULL) + if (msg != nullptr) { owner->updateJediSpentJediSkillPoints(msg->getValue().first, msg->getValue().second); } @@ -172,7 +172,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_updateJediFaction: { const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); - if (msg != NULL) + if (msg != nullptr) { owner->updateJediFaction(msg->getValue().first, msg->getValue().second); } @@ -181,7 +181,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_updateJediScriptData: { const MessageQueueGenericValueType > > * const msg = safe_cast > > *>(data); - if (msg != NULL) + if (msg != nullptr) { owner->updateJediScriptData(msg->getValue().first, msg->getValue().second.first, msg->getValue().second.second); } @@ -190,7 +190,7 @@ void JediManagerController::handleMessage (const int message, const float value, case CM_removeJediScriptData: { const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); - if (msg != NULL) + if (msg != nullptr) { owner->removeJediScriptData(msg->getValue().first, msg->getValue().second); } diff --git a/game/server/application/SwgGameServer/src/shared/controller/SwgPlayerCreatureController.cpp b/game/server/application/SwgGameServer/src/shared/controller/SwgPlayerCreatureController.cpp index dea874be..1e417386 100755 --- a/game/server/application/SwgGameServer/src/shared/controller/SwgPlayerCreatureController.cpp +++ b/game/server/application/SwgGameServer/src/shared/controller/SwgPlayerCreatureController.cpp @@ -40,7 +40,7 @@ void SwgPlayerCreatureController::handleMessage (const int message, const float case CM_setJediState: { const MessageQueueGenericValueType * const msg = dynamic_cast *>(data); - if (msg != NULL) + if (msg != nullptr) playerOwner->setJediState(static_cast(msg->getValue())); } break; diff --git a/game/server/application/SwgGameServer/src/shared/core/CSHandler.cpp b/game/server/application/SwgGameServer/src/shared/core/CSHandler.cpp index 5bb0356e..869755e9 100755 --- a/game/server/application/SwgGameServer/src/shared/core/CSHandler.cpp +++ b/game/server/application/SwgGameServer/src/shared/core/CSHandler.cpp @@ -767,7 +767,7 @@ CS_CMD( create_crafted_object ) if( !( target && target->isAuthoritative() ) ) return; ServerObject *inventory = target->getInventory(); - if( inventory == NULL ) + if( inventory == nullptr ) return; DEBUG_REPORT_LOG( true, ( "Trying to make %s\n", args[ 1 ].c_str())); GameScriptObject * script = target->getScriptObject(); @@ -1116,7 +1116,7 @@ CS_CMD( delete_object ) const NetworkId oid (args[0]); ServerObject *object = ServerObject::getServerObject( oid ); - if (object == NULL) + if (object == nullptr) { return; } @@ -1174,7 +1174,7 @@ CS_CMD( rename_player ) } if( player_id.isValid() ) { - // null id to pass to the playercreationmanager. + // nullptr id to pass to the playercreationmanager. NetworkId source( "0" ); DEBUG_REPORT_LOG( true, ( "Attempting to rename %s.", args[ 0 ].c_str() ) ); @@ -1213,7 +1213,7 @@ CS_CMD( set_bank_credits ) CreatureObject* creatureActor = CreatureObject::getCreatureObject(player_id); PlayerObject const * const player = PlayerCreatureController::getPlayerObject(creatureActor); - if( ( player != NULL ) && ( player->isAuthoritative() ) ) + if( ( player != nullptr ) && ( player->isAuthoritative() ) ) { amount -= creatureActor->getBankBalance(); DEBUG_REPORT_LOG( true, ( "Amount to modify by: %d (%d current balance)\n", amount, creatureActor->getBankBalance() ) ); @@ -1270,7 +1270,7 @@ CS_CMD( get_pc_info ) if(bindId != NetworkId::cms_invalid) { const ServerObject* const bindObject = ServerObject::getServerObject(bindId); - if (bindObject != NULL) + if (bindObject != nullptr) { bindLoc = bindObject->getPosition_w(); snprintf( stringbuffer, sizeof( stringbuffer ) -1, "%02f %02f %02f", bindLoc.x, bindLoc.y, bindLoc.z ); @@ -1380,11 +1380,11 @@ CS_CMD( get_pc_info ) // residence info PlayerObject const * const player = PlayerCreatureController::getPlayerObject(creatureActor); - if (player != NULL) + if (player != nullptr) { NetworkId houseNetworkId = creatureActor->getHouse(); const ServerObject* const resObject = ServerObject::getServerObject(houseNetworkId); - if (resObject != NULL) + if (resObject != nullptr) { resLoc = resObject->getPosition_w(); snprintf( stringbuffer, sizeof( stringbuffer ) - 1 , "%02f %02f %02f", resLoc.x, resLoc.y, resLoc.z ); diff --git a/game/server/application/SwgGameServer/src/shared/core/SwgGameServer.cpp b/game/server/application/SwgGameServer/src/shared/core/SwgGameServer.cpp index 1b310ffd..1bf01f55 100755 --- a/game/server/application/SwgGameServer/src/shared/core/SwgGameServer.cpp +++ b/game/server/application/SwgGameServer/src/shared/core/SwgGameServer.cpp @@ -55,7 +55,7 @@ SwgGameServer::~SwgGameServer() void SwgGameServer::install() { - DEBUG_FATAL (ms_instance != NULL, ("already installed")); + DEBUG_FATAL (ms_instance != nullptr, ("already installed")); ms_instance = new SwgGameServer; SwgServerUniverse::install(); @@ -110,7 +110,7 @@ void SwgGameServer::receiveMessage(const MessageDispatch::Emitter & source, cons JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager != NULL && jediManager->isAuthoritative()) + if (jediManager != nullptr && jediManager->isAuthoritative()) { jediManager->addJediBounties(*msg); delete msg; @@ -129,7 +129,7 @@ void SwgGameServer::receiveMessage(const MessageDispatch::Emitter & source, cons JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager != NULL) + if (jediManager != nullptr) { jediManager->characterBeingDeleted(msg.getValue()); } diff --git a/game/server/application/SwgGameServer/src/shared/core/SwgServerUniverse.cpp b/game/server/application/SwgGameServer/src/shared/core/SwgServerUniverse.cpp index 3d743c93..98bccf40 100755 --- a/game/server/application/SwgGameServer/src/shared/core/SwgServerUniverse.cpp +++ b/game/server/application/SwgGameServer/src/shared/core/SwgServerUniverse.cpp @@ -26,7 +26,7 @@ void SwgServerUniverse::install() SwgServerUniverse::SwgServerUniverse() : ServerUniverse (), - m_jediManager (NULL) + m_jediManager (nullptr) { } @@ -51,7 +51,7 @@ void SwgServerUniverse::updateAndValidateData() "only be called on the process that is authoritative for UniverseObjects.\n")); // create Jedi manager - if (m_jediManager == NULL) + if (m_jediManager == nullptr) { const ServerObjectTemplate * objTemplate = safe_cast(ObjectTemplateList::fetch(ConfigServerGame::getJediManagerTemplate())); m_jediManager = safe_cast(ServerWorld::createNewObject(*objTemplate, Transform::identity, 0, false)); diff --git a/game/server/application/SwgGameServer/src/shared/object/JediManagerObject.cpp b/game/server/application/SwgGameServer/src/shared/object/JediManagerObject.cpp index f4aa0944..89c24610 100755 --- a/game/server/application/SwgGameServer/src/shared/object/JediManagerObject.cpp +++ b/game/server/application/SwgGameServer/src/shared/object/JediManagerObject.cpp @@ -43,7 +43,7 @@ namespace JediManagerObjectNamespace // the bounty hunter target list loaded from the DB; we store it here // and wait until the JediManagerObject object is created, and then // read it into the JediManagerObject object - const BountyHunterTargetListMessage * s_queuedBountyHunterTargetListFromDB = NULL; + const BountyHunterTargetListMessage * s_queuedBountyHunterTargetListFromDB = nullptr; } using namespace JediManagerObjectNamespace; @@ -151,7 +151,7 @@ void JediManagerObject::onServerUniverseGainedAuthority() addJediBounties(*s_queuedBountyHunterTargetListFromDB); delete s_queuedBountyHunterTargetListFromDB; - s_queuedBountyHunterTargetListFromDB = NULL; + s_queuedBountyHunterTargetListFromDB = nullptr; } } @@ -450,7 +450,7 @@ void JediManagerObject::characterBeingDeleted(const NetworkId & id) ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); @@ -1252,7 +1252,7 @@ void JediManagerObject::requestJediBounty(const NetworkId & targetId, ScriptDictionaryPtr dictionary; GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != NULL) + if (dictionary.get() != nullptr) { dictionary->serialize(); if (success) diff --git a/game/server/application/SwgGameServer/src/shared/object/SwgCreatureObject.cpp b/game/server/application/SwgGameServer/src/shared/object/SwgCreatureObject.cpp index e1ab4b18..18cd7b6e 100755 --- a/game/server/application/SwgGameServer/src/shared/object/SwgCreatureObject.cpp +++ b/game/server/application/SwgGameServer/src/shared/object/SwgCreatureObject.cpp @@ -96,7 +96,7 @@ void SwgCreatureObject::onRemovingFromWorld() if (isAuthoritative() && isPlayerControlled() && (getBountyValue() > 0)) { JediManagerObject * const jediManager = static_cast(ServerUniverse::getInstance()).getJediManager(); - if (jediManager != NULL) + if (jediManager != nullptr) { jediManager->setJediOffline(getNetworkId(), getPosition_w(), getSceneId()); } @@ -116,7 +116,7 @@ void SwgCreatureObject::onPermanentlyDestroyed() if (isAuthoritative() && isPlayerControlled() && (getBountyValue() > 0)) { JediManagerObject * const jediManager = static_cast(ServerUniverse::getInstance()).getJediManager(); - if (jediManager != NULL) + if (jediManager != nullptr) { jediManager->removeJedi(getNetworkId()); } @@ -178,7 +178,7 @@ const int SwgCreatureObject::getSpentJediSkillPoints() const } else { - WARNING(true, ("Creature %s had a null in their skill list", getNetworkId().getValueString().c_str())); + WARNING(true, ("Creature %s had a nullptr in their skill list", getNetworkId().getValueString().c_str())); } } */ @@ -198,7 +198,7 @@ bool SwgCreatureObject::hasBounty(const CreatureObject & target) const { const SwgCreatureObject * swgTarget = dynamic_cast( &target); - if (swgTarget == NULL) + if (swgTarget == nullptr) return false; JediManagerObject * jediManager = static_cast( @@ -296,7 +296,7 @@ void SwgCreatureObject::onAddedToWorld() if (isAuthoritative() && isPlayerControlled() && (getBountyValue() > 0)) { JediManagerObject * jediManager = static_cast(ServerUniverse::getInstance()).getJediManager(); - if (jediManager != NULL) + if (jediManager != nullptr) { jediManager->updateJediLocation(getNetworkId(), getPosition_w(), getSceneId()); } @@ -330,7 +330,7 @@ void SwgCreatureObject::setPvpFaction(Pvp::FactionId factionId) if ((oldId != newId) && isAuthoritative() && isPlayerControlled() && (getBountyValue() > 0)) { JediManagerObject * jediManager = static_cast(ServerUniverse::getInstance()).getJediManager(); - if (jediManager != NULL) + if (jediManager != nullptr) { jediManager->updateJediFaction(getNetworkId(), newId); } diff --git a/game/server/application/SwgGameServer/src/shared/object/SwgPlayerObject.cpp b/game/server/application/SwgGameServer/src/shared/object/SwgPlayerObject.cpp index ef587054..c8c838ec 100755 --- a/game/server/application/SwgGameServer/src/shared/object/SwgPlayerObject.cpp +++ b/game/server/application/SwgGameServer/src/shared/object/SwgPlayerObject.cpp @@ -92,12 +92,12 @@ void SwgPlayerObject::virtualOnSetAuthority() PlayerObject::virtualOnSetAuthority(); const SwgCreatureObject * owner = safe_cast(getCreatureObject()); - if ((owner != NULL) && owner->isPlayerControlled() && (owner->getBountyValue() > 0)) + if ((owner != nullptr) && owner->isPlayerControlled() && (owner->getBountyValue() > 0)) { // tell the Jedi manager our position JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager != NULL) + if (jediManager != nullptr) { jediManager->updateJediLocation(owner->getNetworkId(), owner->getPosition_w(), owner->getSceneId()); @@ -192,7 +192,7 @@ void SwgPlayerObject::updateJediLocationTime(float time) // tell the Jedi manager our position JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager != NULL) + if (jediManager != nullptr) { const CreatureObject * owner = getCreatureObject(); if (owner->isInWorld()) @@ -324,7 +324,7 @@ void SwgPlayerObject::setJediBounties(const std::vector & bounties) // update the Jedi manager JediManagerObject * jediManager = static_cast( ServerUniverse::getInstance()).getJediManager(); - if (jediManager != NULL) + if (jediManager != nullptr) { const CreatureObject * owner = getCreatureObject(); jediManager->updateJedi(owner->getNetworkId(), bounties); @@ -351,7 +351,7 @@ bool SwgPlayerObject::getJediBounties(std::vector & bounties) bounties.clear(); SwgCreatureObject * owner = safe_cast(getCreatureObject()); - if (owner != NULL) + if (owner != nullptr) { if (owner->getObjVars().getItem(OBJVAR_JEDI_BOUNTIES, bounties)) { diff --git a/game/server/application/SwgGameServer/src/shared/objectTemplate/ServerJediManagerObjectTemplate.cpp b/game/server/application/SwgGameServer/src/shared/objectTemplate/ServerJediManagerObjectTemplate.cpp index 90edb0a3..aaf9f5a9 100755 --- a/game/server/application/SwgGameServer/src/shared/objectTemplate/ServerJediManagerObjectTemplate.cpp +++ b/game/server/application/SwgGameServer/src/shared/objectTemplate/ServerJediManagerObjectTemplate.cpp @@ -94,10 +94,10 @@ Tag ServerJediManagerObjectTemplate::getTemplateVersion(void) const */ Tag ServerJediManagerObjectTemplate::getHighestTemplateVersion(void) const { - if (m_baseData == NULL) + if (m_baseData == nullptr) return m_templateVersion; const ServerJediManagerObjectTemplate * base = dynamic_cast(m_baseData); - if (base == NULL) + if (base == nullptr) return m_templateVersion; return std::max(m_templateVersion, base->getHighestTemplateVersion()); } // ServerJediManagerObjectTemplate::getHighestTemplateVersion @@ -150,12 +150,12 @@ char paramName[MAX_NAME_SIZE]; file.read_string(baseFilename); file.exitChunk(); const ObjectTemplate *base = ObjectTemplateList::fetch(baseFilename); - DEBUG_WARNING(base == NULL, ("was unable to load base template %s", baseFilename.c_str())); - if (m_baseData == base && base != NULL) + DEBUG_WARNING(base == nullptr, ("was unable to load base template %s", baseFilename.c_str())); + if (m_baseData == base && base != nullptr) base->releaseReference(); else { - if (m_baseData != NULL) + if (m_baseData != nullptr) m_baseData->releaseReference(); m_baseData = base; } diff --git a/game/server/library/swgServerNetworkMessages/src/shared/core/SetupSwgServerNetworkMessages.cpp b/game/server/library/swgServerNetworkMessages/src/shared/core/SetupSwgServerNetworkMessages.cpp index d93e323f..864e2645 100755 --- a/game/server/library/swgServerNetworkMessages/src/shared/core/SetupSwgServerNetworkMessages.cpp +++ b/game/server/library/swgServerNetworkMessages/src/shared/core/SetupSwgServerNetworkMessages.cpp @@ -235,7 +235,7 @@ namespace SetupSwgServerNetworkMessagesNamespace } MessageQueue::Data* unpackNothing(Archive::ReadIterator &) { - return NULL; + return nullptr; } void packVectorNetworkIdVector(const MessageQueue::Data * data, Archive::ByteStream & target) diff --git a/game/shared/library/swgSharedNetworkMessages/src/shared/combat/MessageQueueCombatAction.cpp b/game/shared/library/swgSharedNetworkMessages/src/shared/combat/MessageQueueCombatAction.cpp index e0c98b96..44559bc5 100755 --- a/game/shared/library/swgSharedNetworkMessages/src/shared/combat/MessageQueueCombatAction.cpp +++ b/game/shared/library/swgSharedNetworkMessages/src/shared/combat/MessageQueueCombatAction.cpp @@ -297,7 +297,7 @@ void MessageQueueCombatAction::debugDump() const bool hasActionName; char actionName[256]; - if (s_actionNameLookupFunction != NULL) + if (s_actionNameLookupFunction != nullptr) { hasActionName = true; (*s_actionNameLookupFunction)(m_actionId, actionName, sizeof(actionName)); @@ -316,9 +316,9 @@ void MessageQueueCombatAction::debugDump() const // Print attacker info. DEBUG_REPORT_LOG(true, ("MQCA: attacker: id =[%s].\n", m_attacker.id.getValueString().c_str())); - DEBUG_REPORT_LOG(true, ("MQCA: attacker: template =[%s].\n", attackerObject ? attackerObject->getObjectTemplateName() : "")); + DEBUG_REPORT_LOG(true, ("MQCA: attacker: template =[%s].\n", attackerObject ? attackerObject->getObjectTemplateName() : "")); DEBUG_REPORT_LOG(true, ("MQCA: attacker: weapon =[%s].\n", m_attacker.weapon.getValueString().c_str())); - DEBUG_REPORT_LOG(true, ("MQCA: attacker: weapon template =[%s].\n", weaponObject ? weaponObject->getObjectTemplateName() : "")); + DEBUG_REPORT_LOG(true, ("MQCA: attacker: weapon template =[%s].\n", weaponObject ? weaponObject->getObjectTemplateName() : "")); DEBUG_REPORT_LOG(true, ("MQCA: attacker: end posture =[%s].\n", Postures::getPostureName(m_attacker.endPosture))); DEBUG_REPORT_LOG(true, ("MQCA: attacker: trailBits =[0x%02x].\n", m_attacker.trailBits)); DEBUG_REPORT_LOG(true, ("MQCA: attacker: client effect id=[%d].\n", m_attacker.clientEffectId)); @@ -341,7 +341,7 @@ void MessageQueueCombatAction::debugDump() const UNREF(defenderObject); DEBUG_REPORT_LOG(true, ("MQCA: defender #%d: id =[%s].\n", i + 1, data.id.getValueString().c_str())); - DEBUG_REPORT_LOG(true, ("MQCA: defender #%d: template =[%s].\n", i + 1, defenderObject ? defenderObject->getObjectTemplateName() : "")); + DEBUG_REPORT_LOG(true, ("MQCA: defender #%d: template =[%s].\n", i + 1, defenderObject ? defenderObject->getObjectTemplateName() : "")); DEBUG_REPORT_LOG(true, ("MQCA: defender #%d: end posture =[%s].\n", i + 1, Postures::getPostureName(data.endPosture))); DEBUG_REPORT_LOG(true, ("MQCA: defender #%d: defense =[%s].\n", i + 1, CombatEngineData::getCombatDefenseName(data.defense))); DEBUG_REPORT_LOG(true, ("MQCA: defender #%d: client effect id=[%d].\n", i + 1, data.clientEffectId)); diff --git a/game/shared/library/swgSharedNetworkMessages/src/shared/core/SetupSwgSharedNetworkMessages.cpp b/game/shared/library/swgSharedNetworkMessages/src/shared/core/SetupSwgSharedNetworkMessages.cpp index fb9785c0..399a513c 100755 --- a/game/shared/library/swgSharedNetworkMessages/src/shared/core/SetupSwgSharedNetworkMessages.cpp +++ b/game/shared/library/swgSharedNetworkMessages/src/shared/core/SetupSwgSharedNetworkMessages.cpp @@ -482,7 +482,7 @@ namespace SetupSwgSharedNetworkMessagesNamespace MessageQueue::Data* unpackNothing(Archive::ReadIterator &) { - return NULL; + return nullptr; } //---------------------------------------------------------------------- diff --git a/game/shared/library/swgSharedUtility/src/shared/CombatEngineData.h b/game/shared/library/swgSharedUtility/src/shared/CombatEngineData.h index 0a86c6ee..118e2167 100755 --- a/game/shared/library/swgSharedUtility/src/shared/CombatEngineData.h +++ b/game/shared/library/swgSharedUtility/src/shared/CombatEngineData.h @@ -139,7 +139,7 @@ namespace CombatEngineData std::vector damage;// list of attribute modifiers this damage // caused, pre armor effectiveness - CachedNetworkId attackerId; // who caused the damage (null for + CachedNetworkId attackerId; // who caused the damage (nullptr for // environmental effects, etc) NetworkId weaponId; // id of the weapon used DamageType damageType; @@ -175,10 +175,10 @@ namespace CombatEngineData inline ActionItem::~ActionItem(void) { - if (type == target && actionData.targetData.targets != NULL) + if (type == target && actionData.targetData.targets != nullptr) { delete[] actionData.targetData.targets; - actionData.targetData.targets = NULL; + actionData.targetData.targets = nullptr; } } // ActionItem::~ActionItem @@ -195,7 +195,7 @@ namespace CombatEngineData actionId(0), wounded(false), ignoreInvulnerable(false) -// combatActionMessage(NULL) +// combatActionMessage(nullptr) { } From 6373cf6d743c889634b13a0bd23dce4cf24d8072 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Mon, 15 Feb 2016 00:38:32 -0600 Subject: [PATCH 017/302] in theory this should allow for backward compatibility with the old busted IBM java 1.4, and any other 1.4 java, and above...testers welcome but i prefer to use 1.8 from now on --- .../serverScript/src/shared/JavaLibrary.cpp | 94 +++++++++++-------- 1 file changed, 57 insertions(+), 37 deletions(-) diff --git a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp index e6c87680..a5c2f6c5 100755 --- a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp +++ b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp @@ -1155,8 +1155,6 @@ void JavaLibrary::initializeJavaThread() } else { - // use options derived from config file settings - // set up memory requirements tempOption.optionString = "-Xms128m"; options.push_back(tempOption); @@ -1165,30 +1163,43 @@ void JavaLibrary::initializeJavaThread() tempOption.optionString = "-Xss768k"; options.push_back(tempOption); - if (ms_javaVmType == JV_ibm) + if (ms_javaVmType == JV_sun) { - tempOption.optionString = "-Xoss768k"; + +// java 1.8 and higher uses metaspace...which is apparently unlimited by default +#if defined(JNI_VERSION_1_8) || defined(JNI_VERSION_1_9) + tempOption.optionString = "-XX:MetaspaceSize=128m"; + options.push_back(tempOption); +#endif + +// these don't seem to play nice with java >= 7 +#if !defined(JNI_VERSION_1_9) && !defined(JNI_VERSION_1_8) && !defined(JNI_VERSION_1_7) + tempOption.optionString = "-Xrs"; options.push_back(tempOption); tempOption.optionString = "-Xcheck:jni"; options.push_back(tempOption); - tempOption.optionString = "-Xcheck:nabounds"; - options.push_back(tempOption); - tempOption.optionString = "-Xrs"; - options.push_back(tempOption); -#ifndef WIN32 - tempOption.optionString = "-Xgcpolicy:optavgpause"; - options.push_back(tempOption); #endif - } - else - { if (ConfigServerGame::getCompileScripts()) { tempOption.optionString = "-Xint"; options.push_back(tempOption); } - options.push_back(tempOption); } + else + { + tempOption.optionString = "-Xoss768k"; + options.push_back(tempOption); + tempOption.optionString = "-Xcheck:jni"; + options.push_back(tempOption); + tempOption.optionString = "-Xcheck:nabounds"; + options.push_back(tempOption); + tempOption.optionString = "-Xrs"; + options.push_back(tempOption); +#ifndef WIN32 + tempOption.optionString = "-Xgcpolicy:optavgpause"; + options.push_back(tempOption); +#endif + } if (ConfigServerGame::getUseVerboseJava()) { @@ -1199,6 +1210,7 @@ void JavaLibrary::initializeJavaThread() tempOption.optionString = "-verbose:class"; options.push_back(tempOption); } + if (ConfigServerGame::getLogJavaGc()) { tempOption.optionString = "-Xloggc:javagc.log"; @@ -1255,59 +1267,47 @@ void JavaLibrary::initializeJavaThread() tempOption.optionString = const_cast(classPath.c_str()); options.push_back(tempOption); -// the below is ok but could use the dynamic function call too if we want someday +// TODO: this really sucks as the jvm won't start without the param +// there's a dynamic method but requires the jvm to already be running, wtf? #ifdef JNI_VERSION_1_9 vm_args.version = JNI_VERSION_1_9; - - tempOption.optionString = "-XX:MetaspaceSize=128m"; - options.push_back(tempOption); #define JAVAVERSET = 1 #endif -#ifndef JAVAVERSET -#ifdef JNI_VERSION_1_8 +#if !defined(JAVAVERSET) && defined(JNI_VERSION_1_8) vm_args.version = JNI_VERSION_1_8; - tempOption.optionString = "-XX:MetaspaceSize=128m"; - options.push_back(tempOption); #define JAVAVERSET = 1 #endif -#endif -#ifndef JAVAVERSET -#ifdef JNI_VERSION_1_7 +#if !defined(JAVAVERSET) && defined(JNI_VERSION_1_7) vm_args.version = JNI_VERSION_1_7; #define JAVAVERSET = 1 #endif -#endif -#ifndef JAVAVERSET -#ifdef JNI_VERSION_1_6 +#if !defined(JAVAVERSET) && defined(JNI_VERSION_1_6) vm_args.version = JNI_VERSION_1_6; #define JAVAVERSET = 1 #endif -#endif -#ifndef JAVAVERSET -#ifdef JNI_VERSION_1_5 +#if !defined(JAVAVERSET) && defined(JNI_VERSION_1_5) vm_args.version = JNI_VERSION_1_5; #define JAVAVERSET = 1 #endif -#endif -#ifndef JAVAVERSET -#ifdef JNI_VERSION_1_4 +#if !defined(JAVAVERSET) && defined(JNI_VERSION_1_4) vm_args.version = JNI_VERSION_1_4; #define JAVAVERSET = 1 #endif -#endif #ifdef JAVAVERSET #undef JAVAVERSET +#else +#error JNI version not found/set! #endif vm_args.options = &options[0]; vm_args.nOptions = options.size(); - vm_args.ignoreUnrecognized = JNI_TRUE; + vm_args.ignoreUnrecognized = JNI_TRUE; // ok let's ignore whatever isn't understood instead of crashing like a loser // create the JVM JNIEnv * env = nullptr; @@ -1329,6 +1329,17 @@ void JavaLibrary::initializeJavaThread() } ms_loaded = 1; +#if !defined(JNI_VERSION_1_9) && !defined(JNI_VERSION_1_8) && !defined(JNI_VERSION_1_7) && defined(linux) + if (ConfigServerGame::getTrapScriptCrashes()) + { + //set up signal handler for fatals in linux + OurSa.sa_handler = fatalHandler; + sigemptyset(&OurSa.sa_mask); + OurSa.sa_flags = 0; + IGNORE_RETURN(sigaction(SIGSEGV, &OurSa, &JavaSa)); + } +#endif + // wait until the main thread tells us to shutdown ms_shutdownJava->wait(); @@ -1336,6 +1347,15 @@ void JavaLibrary::initializeJavaThread() IGNORE_RETURN(ms_jvm->DestroyJavaVM()); ms_jvm = nullptr; +#if !defined(JNI_VERSION_1_9) && !defined(JNI_VERSION_1_8) && !defined(JNI_VERSION_1_7) && defined(linux) + if (ConfigServerGame::getTrapScriptCrashes()) + { + // restore the default signal handler + IGNORE_RETURN(sigaction(SIGSEGV, &OrgSa, NULL)); + } +#endif + + #if defined(_WIN32) IGNORE_RETURN(FreeLibrary(static_cast(libHandle))); From 920e8e658dd07025615b0d09e54831dfdfd8b607 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Mon, 15 Feb 2016 11:48:37 -0600 Subject: [PATCH 018/302] this warning is annoying and likely just a remnant of the japanese language version of the game - we can fix all the warned creatures if we turn it on, log them, and edit a custom creature_names file, but for now let's skip it --- .../library/serverScript/src/shared/ScriptMethodsString.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsString.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsString.cpp index cb7135e7..d55f93ec 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsString.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsString.cpp @@ -101,7 +101,8 @@ jstring JNICALL ScriptMethodsStringNamespace::getString(JNIEnv *env, jobject sel return result.getReturnValue(); } - DEBUG_WARNING(true, ("JavaLibrary::log failed to localize the stringId(%s, %s)", table.c_str(), asciiId.c_str())); + //TODO? this warning is annoying and likely just a remnant of the japanese language version of the game + //DEBUG_WARNING(true, ("JavaLibrary::log failed to localize the stringId(%s, %s)", table.c_str(), asciiId.c_str())); return 0; From 1feb285e77e4d52a086a72a216ed71b04012864d Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Mon, 15 Feb 2016 11:48:37 -0600 Subject: [PATCH 019/302] this warning is annoying and likely just a remnant of the japanese language version of the game - we can fix all the warned creatures if we turn it on, log them, and edit a custom creature_names file, but for now let's skip it --- .../library/serverScript/src/shared/ScriptMethodsString.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsString.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsString.cpp index cb7135e7..d55f93ec 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsString.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsString.cpp @@ -101,7 +101,8 @@ jstring JNICALL ScriptMethodsStringNamespace::getString(JNIEnv *env, jobject sel return result.getReturnValue(); } - DEBUG_WARNING(true, ("JavaLibrary::log failed to localize the stringId(%s, %s)", table.c_str(), asciiId.c_str())); + //TODO? this warning is annoying and likely just a remnant of the japanese language version of the game + //DEBUG_WARNING(true, ("JavaLibrary::log failed to localize the stringId(%s, %s)", table.c_str(), asciiId.c_str())); return 0; From aa891e3d8c9cedb738eab514f139d312bc440e14 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Thu, 18 Feb 2016 10:41:03 -0600 Subject: [PATCH 020/302] null -> nullptr conversion i missed --- engine/client/application/Miff/src/lex_yy.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/engine/client/application/Miff/src/lex_yy.c b/engine/client/application/Miff/src/lex_yy.c index e9bd0436..df6de76d 100644 --- a/engine/client/application/Miff/src/lex_yy.c +++ b/engine/client/application/Miff/src/lex_yy.c @@ -271,7 +271,7 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ */ #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ - : NULL) + : nullptr) /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. @@ -5779,7 +5779,7 @@ extern int isatty (int ); */ void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) { - if (new_buffer == NULL) + if (new_buffer == nullptr) return; yyensure_buffer_stack(); @@ -5813,7 +5813,7 @@ void yypop_buffer_state (void) return; yy_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; + YY_CURRENT_BUFFER_LVALUE = nullptr; if ((yy_buffer_stack_top) > 0) --(yy_buffer_stack_top); @@ -6097,13 +6097,13 @@ int yylex_destroy (void) /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ yy_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; + YY_CURRENT_BUFFER_LVALUE = nullptr; yypop_buffer_state(); } /* Destroy the stack itself. */ yyfree((yy_buffer_stack) ); - (yy_buffer_stack) = NULL; + (yy_buffer_stack) = nullptr; /* Reset the globals. This is important in a non-reentrant scanner so the next time * yylex() is called, initialization will occur. */ From 13019a2b14e31ffcf02b8c4be9f1a07d2bccab8e Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Thu, 18 Feb 2016 10:41:03 -0600 Subject: [PATCH 021/302] null -> nullptr conversion i missed --- engine/client/application/Miff/src/lex_yy.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/engine/client/application/Miff/src/lex_yy.c b/engine/client/application/Miff/src/lex_yy.c index e9bd0436..df6de76d 100644 --- a/engine/client/application/Miff/src/lex_yy.c +++ b/engine/client/application/Miff/src/lex_yy.c @@ -271,7 +271,7 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ */ #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ - : NULL) + : nullptr) /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. @@ -5779,7 +5779,7 @@ extern int isatty (int ); */ void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) { - if (new_buffer == NULL) + if (new_buffer == nullptr) return; yyensure_buffer_stack(); @@ -5813,7 +5813,7 @@ void yypop_buffer_state (void) return; yy_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; + YY_CURRENT_BUFFER_LVALUE = nullptr; if ((yy_buffer_stack_top) > 0) --(yy_buffer_stack_top); @@ -6097,13 +6097,13 @@ int yylex_destroy (void) /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ yy_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; + YY_CURRENT_BUFFER_LVALUE = nullptr; yypop_buffer_state(); } /* Destroy the stack itself. */ yyfree((yy_buffer_stack) ); - (yy_buffer_stack) = NULL; + (yy_buffer_stack) = nullptr; /* Reset the globals. This is important in a non-reentrant scanner so the next time * yylex() is called, initialization will occur. */ From 877d0a9b629f3283ed45b52bd2729d74ca721a6c Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Thu, 18 Feb 2016 22:55:54 -0600 Subject: [PATCH 022/302] flint++ static analyzer detected items (not all that were likely legit positives, but a start) as well as some clang detected unused vars, cleanup_ --- .../application/Miff/src/linux/miff.cpp | 2 - .../ConsoleCommandParserLoginServer.cpp | 6 - .../src/shared/TaskUpdatePurgeAccountList.h | 4 - .../src/shared/CentralServerConnection.h | 2 +- .../src/shared/GameServerConnection.h | 2 +- .../serverDatabase/src/shared/LazyDeleter.h | 2 +- .../serverDatabase/src/shared/Persister.h | 2 +- .../src/shared/TaskManagerConnection.h | 2 +- .../src/shared/command/CommandQueue.cpp | 6 - .../shared/network/TaskManagerConnection.h | 2 +- .../src/shared/object/TangibleObject.cpp | 8 - .../src/shared/PathAutoGenerator.cpp | 2 - .../src/shared/ScriptMethodsObjectInfo.cpp | 1 - .../src/shared/ChatLogManager.cpp | 1 - .../src/shared/TemplateCompiler.cpp | 270 ------------------ .../src/shared/core/SpaceAvoidanceManager.cpp | 1 - .../src/linux/SetupSharedFoundation.cpp | 2 +- .../src/shared/mount/SharedSaddleManager.cpp | 2 - .../sharedImage/src/shared/TargaFormat.cpp | 4 - .../shared/portal/PortalPropertyTemplate.h | 2 +- .../src/shared/core/Filename.cpp | 12 +- .../src/shared/core/TemplateData.cpp | 30 -- .../library/platform/utils/Base/ScopeLock.cpp | 2 +- .../library/platform/utils/Base/ScopeLock.h | 2 +- .../CSAssist/utils/Base/ScopeLock.cpp | 2 +- .../CSAssist/utils/Base/ScopeLock.h | 2 +- .../ChatAPI/utils/Base/ScopeLock.cpp | 2 +- .../ChatAPI/utils/Base/ScopeLock.h | 2 +- .../src/shared/buffers/ObjectTableBuffer.cpp | 1 - 29 files changed, 20 insertions(+), 358 deletions(-) diff --git a/engine/client/application/Miff/src/linux/miff.cpp b/engine/client/application/Miff/src/linux/miff.cpp index 5bf4af1b..32f52b5b 100755 --- a/engine/client/application/Miff/src/linux/miff.cpp +++ b/engine/client/application/Miff/src/linux/miff.cpp @@ -53,8 +53,6 @@ #include // for tolower() //================================================= static vars assignment == -const int entryPointVersion = 1; // constantly check DataEntryPoint.h to see if this value has changed - OutputFileHandler *outfileHandler = nullptr; const int bufferSize = 16 * 1024 * 1024; const int maxStringSize = 256; diff --git a/engine/server/application/LoginServer/src/shared/ConsoleCommandParserLoginServer.cpp b/engine/server/application/LoginServer/src/shared/ConsoleCommandParserLoginServer.cpp index b1a2dfad..5d0d579e 100755 --- a/engine/server/application/LoginServer/src/shared/ConsoleCommandParserLoginServer.cpp +++ b/engine/server/application/LoginServer/src/shared/ConsoleCommandParserLoginServer.cpp @@ -22,12 +22,6 @@ namespace CommandNames #undef MAKE_COMMAND } -const CommandParser::CmdInfo cmds[] = -{ - {"runState", 0, "", "Return the running state of the CentralServer. It should always return 'running'"}, - {"", 0, "", ""} // this must be last -}; - //----------------------------------------------------------------------- ConsoleCommandParserLoginServer::ConsoleCommandParserLoginServer() : diff --git a/engine/server/application/LoginServer/src/shared/TaskUpdatePurgeAccountList.h b/engine/server/application/LoginServer/src/shared/TaskUpdatePurgeAccountList.h index 3888e9a5..645d30c4 100755 --- a/engine/server/application/LoginServer/src/shared/TaskUpdatePurgeAccountList.h +++ b/engine/server/application/LoginServer/src/shared/TaskUpdatePurgeAccountList.h @@ -18,10 +18,6 @@ class TaskUpdatePurgeAccountList : public DB::TaskRequest TaskUpdatePurgeAccountList(); virtual bool process (DB::Session *session); virtual void onComplete (); - - private: - StationId m_account; - int m_purgePhase; }; // ====================================================================== diff --git a/engine/server/library/serverDatabase/src/shared/CentralServerConnection.h b/engine/server/library/serverDatabase/src/shared/CentralServerConnection.h index c273c793..3c8bfd56 100755 --- a/engine/server/library/serverDatabase/src/shared/CentralServerConnection.h +++ b/engine/server/library/serverDatabase/src/shared/CentralServerConnection.h @@ -26,7 +26,7 @@ public: void onReceive (const Archive::ByteStream & message); void receiveMessage (const MessageDispatch::Emitter & source, const MessageDispatch::MessageBase & message); private: - CentralServerConnection(CentralServerConnection&); + CentralServerConnection(const CentralServerConnection&); CentralServerConnection& operator=(CentralServerConnection&); }; diff --git a/engine/server/library/serverDatabase/src/shared/GameServerConnection.h b/engine/server/library/serverDatabase/src/shared/GameServerConnection.h index 3cb47a73..3c183f01 100755 --- a/engine/server/library/serverDatabase/src/shared/GameServerConnection.h +++ b/engine/server/library/serverDatabase/src/shared/GameServerConnection.h @@ -31,7 +31,7 @@ private: ChunkCompleteQueueType * const m_chunkCompleteQueue; private: - GameServerConnection(GameServerConnection&); + GameServerConnection(const GameServerConnection&); GameServerConnection& operator=(GameServerConnection&); }; diff --git a/engine/server/library/serverDatabase/src/shared/LazyDeleter.h b/engine/server/library/serverDatabase/src/shared/LazyDeleter.h index e93816ec..7e35e05f 100755 --- a/engine/server/library/serverDatabase/src/shared/LazyDeleter.h +++ b/engine/server/library/serverDatabase/src/shared/LazyDeleter.h @@ -47,7 +47,7 @@ class LazyDeleter ~LazyDeleter(); private: - LazyDeleter(LazyDeleter&); //disable + LazyDeleter(const LazyDeleter&); //disable LazyDeleter &operator=(const LazyDeleter&); //disable private: diff --git a/engine/server/library/serverDatabase/src/shared/Persister.h b/engine/server/library/serverDatabase/src/shared/Persister.h index 3c432fbc..9cc76ac8 100755 --- a/engine/server/library/serverDatabase/src/shared/Persister.h +++ b/engine/server/library/serverDatabase/src/shared/Persister.h @@ -191,7 +191,7 @@ class Persister : public MessageDispatch::Receiver static void installDerived(Persister *derivedInstance); private: - Persister(Persister&); //disable + Persister(const Persister&); //disable Persister &operator=(const Persister&); //disable private: diff --git a/engine/server/library/serverDatabase/src/shared/TaskManagerConnection.h b/engine/server/library/serverDatabase/src/shared/TaskManagerConnection.h index 94d33a42..4a5cd576 100755 --- a/engine/server/library/serverDatabase/src/shared/TaskManagerConnection.h +++ b/engine/server/library/serverDatabase/src/shared/TaskManagerConnection.h @@ -20,7 +20,7 @@ public: void onConnectionOpened (); private: - TaskManagerConnection(TaskManagerConnection&); + TaskManagerConnection(const TaskManagerConnection&); TaskManagerConnection& operator=(TaskManagerConnection&); }; diff --git a/engine/server/library/serverGame/src/shared/command/CommandQueue.cpp b/engine/server/library/serverGame/src/shared/command/CommandQueue.cpp index 913fa7e0..0e3c1b26 100755 --- a/engine/server/library/serverGame/src/shared/command/CommandQueue.cpp +++ b/engine/server/library/serverGame/src/shared/command/CommandQueue.cpp @@ -45,12 +45,6 @@ namespace CommandQueueNamespace const bool cs_debug = false; #endif - /** - * @brief used to assign sequence Ids to server-generated commands - * that need to be replicated on the client. - */ - const uint32 cs_sequenceStart = 0x40000000; - /** * @brief the maximum number of combat commands that are allowed in * the queue at any given time. diff --git a/engine/server/library/serverGame/src/shared/network/TaskManagerConnection.h b/engine/server/library/serverGame/src/shared/network/TaskManagerConnection.h index 7544693e..66cb36ae 100755 --- a/engine/server/library/serverGame/src/shared/network/TaskManagerConnection.h +++ b/engine/server/library/serverGame/src/shared/network/TaskManagerConnection.h @@ -21,7 +21,7 @@ public: void onReceive (const Archive::ByteStream & message); private: - TaskManagerConnection(TaskManagerConnection&); + TaskManagerConnection(const TaskManagerConnection&); TaskManagerConnection& operator=(TaskManagerConnection&); }; diff --git a/engine/server/library/serverGame/src/shared/object/TangibleObject.cpp b/engine/server/library/serverGame/src/shared/object/TangibleObject.cpp index 3602f9a6..4f3c1ebf 100755 --- a/engine/server/library/serverGame/src/shared/object/TangibleObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/TangibleObject.cpp @@ -124,14 +124,6 @@ namespace TangibleObjectNamespace { int const s_minCombatDuration = 4; - const int NUM_DAMAGE_TYPES = 9; - - const int s_ignoreDamageTypes = - static_cast(ServerArmorTemplate::DT_environmental_heat) | - static_cast(ServerArmorTemplate::DT_environmental_cold) | - static_cast(ServerArmorTemplate::DT_environmental_acid) | - static_cast(ServerArmorTemplate::DT_environmental_electrical); - bool isEmpty(const ServerObject& obj) { const Container* container = obj.getContainerProperty(); diff --git a/engine/server/library/serverPathfinding/src/shared/PathAutoGenerator.cpp b/engine/server/library/serverPathfinding/src/shared/PathAutoGenerator.cpp index 328a52aa..b4dc446b 100755 --- a/engine/server/library/serverPathfinding/src/shared/PathAutoGenerator.cpp +++ b/engine/server/library/serverPathfinding/src/shared/PathAutoGenerator.cpp @@ -30,8 +30,6 @@ namespace PathAutoGeneratorNamespace { char const * const s_pathWaypointTemplate = "object/path_waypoint/path_waypoint.iff"; - char const * const s_pathObstacleTemplate = "object/resource_container/energy_solid_lg.iff"; - } using namespace PathAutoGeneratorNamespace; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsObjectInfo.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsObjectInfo.cpp index b285e0be..5e9aea1d 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsObjectInfo.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsObjectInfo.cpp @@ -2684,7 +2684,6 @@ namespace // custom_var TypeId definitions const jint CVT_UNKNOWN = static_cast(0); - const jint CVT_CONST_STRING = static_cast(1); const jint CVT_RANGED_INT = static_cast(2); const jint CVT_PALCOLOR = static_cast(3); diff --git a/engine/server/library/serverUtility/src/shared/ChatLogManager.cpp b/engine/server/library/serverUtility/src/shared/ChatLogManager.cpp index e5283c05..c883063e 100755 --- a/engine/server/library/serverUtility/src/shared/ChatLogManager.cpp +++ b/engine/server/library/serverUtility/src/shared/ChatLogManager.cpp @@ -92,7 +92,6 @@ namespace ChatLogManagerNamespace time_t s_purgeTime = 0; int s_currentIndex = 0; time_t s_chatLogMemoryTimer = 0; - time_t const s_chatLogMemoryTime = 30; int s_cacheHits = 0; int s_cacheMisses = 0; diff --git a/engine/shared/application/TemplateCompiler/src/shared/TemplateCompiler.cpp b/engine/shared/application/TemplateCompiler/src/shared/TemplateCompiler.cpp index 2a3658bb..8f366d02 100755 --- a/engine/shared/application/TemplateCompiler/src/shared/TemplateCompiler.cpp +++ b/engine/shared/application/TemplateCompiler/src/shared/TemplateCompiler.cpp @@ -33,80 +33,6 @@ #include - -//============================================================================== -// subclass Perforce API class ClientUser in order to trap errors - -static const int SUBMIT_NO_FILE_ERR = 17; // need to add file before submitting - -//class MyPerforceUser : public ClientUser -//{ -//public: -// MyPerforceUser(void) : ClientUser(), m_errorOccurred(false) {} -// virtual ~MyPerforceUser() {} -// virtual void HandleError( Error *err ) -// { -// if (err != nullptr && err->Test()) -// { -// m_errorOccurred = true; -// m_lastError = err->GetGeneric(); -// // test for filtered errors -// for (size_t i = 0; i < m_filteredErrors.size(); ++i) -// { -// if (m_lastError == m_filteredErrors[i]) -// return; -// } -// } -// ClientUser::HandleError(err); -// } -// -// bool errorOccurred(void) const -// { -// return m_errorOccurred; -// } -// -// int getLastError(void) const -// { -// return m_lastError; -// } -// -// void clearLastError(void) -// { -// m_errorOccurred = false; -// m_lastError = 0; -// } -// -// void addFilteredError(int error) -// { -// m_filteredErrors.push_back(error); -// } -// -// void clearFilteredErrors(void) -// { -// m_filteredErrors.clear(); -// } -// -//private: -// bool m_errorOccurred; -// int m_lastError; -// std::vector m_filteredErrors; -//}; - -//============================================================================== -// subclass of the PerforceAPI StrBuf class, to workaround a bug -// in the destructor. We can't fix the bug because it's an external library -//class StrBufFixed : public StrBuf -//{ -//public: -// ~StrBufFixed() -// { -// delete buffer; -// StringInit(); -// } -//}; - - - //============================================================================== // functions @@ -287,155 +213,6 @@ TpfFile templateFile; return result; } // verifyTemplate -/** - * Adds or removes parameters from a template based on the current template - * definition. - * - * @param filename the filename of the template - * - * @return 0 on success, error code on fail - * -int updateTemplate(const char *filename) -{ -TpfFile templateFile; - - Filename templateFileName(nullptr, nullptr, filename, TEMPLATE_EXTENSION); - return templateFile.updateTemplate(templateFileName); -} // updateTemplate -*/ -/** - * Checks out a template file and the iff files associated with it from Perforce. - * - * @param filename the filename of the template - * - * @return 0 on success, error code on fail - */ -//int checkOut(const char *filename) -//{ -//MyPerforceUser ui; -//ClientApi client; -//Error e; -// -// // check filename extensions -// Filename templateFileName(nullptr, nullptr, filename, TEMPLATE_EXTENSION); -// Filename iffFileName = templateFileName; -// iffFileName.setExtension(IFF_EXTENSION); -// -// // Connect to Perforce server -// client.Init( &e ); -// if (e.Test()) -// { -// StrBufFixed msg; -// e.Fmt(&msg); -// fprintf(stderr, msg.Text()); -// return -1; -// } -// -// // check out the template file -// const char * commands[2]; -// commands[0] = "edit"; -// commands[1] = templateFileName; -// client.SetArgv( 1, const_cast(&commands[1]) ); -// client.Run( commands[0], &ui ); -// if (ui.errorOccurred()) -// return -1; -// -// // find the client and server paths -// TpfFile templateFile; -// IGNORE_RETURN(templateFile.loadTemplate(templateFileName)); -// -// // check out the client template iff file -// Filename iffName(nullptr, templateFile.getIffPath().c_str(), iffFileName, IFF_EXTENSION); -// commands[1] = iffName; -// client.SetArgv( 1, const_cast(&commands[1]) ); -// client.Run( commands[0], &ui ); -// if (ui.errorOccurred()) -// return -1; -// -// // Close connection -// return client.Final( &e ); -//} // checkOut - -/** - * Checks in a template file and the iff files associated with it to Perforce. - * - * @param filename the filename of the template - * - * @return 0 on success, error code on fail - */ -//int checkIn(const char *filename) -//{ -//MyPerforceUser ui; -//ClientApi client; -//Error e; -// -// // check filename extensions -// Filename templateFileName(nullptr, nullptr, filename, TEMPLATE_EXTENSION); -// Filename iffFileName = templateFileName; -// iffFileName.setExtension(IFF_EXTENSION); -// -// // find the client and server paths -// TpfFile templateFile; -// int result = templateFile.loadTemplate(templateFileName); -// if (result != 0) -// { -// // don't allow check-in if there are errors -// return result; -// } -// -// // Connect to Perforce server -// client.Init( &e ); -// if (e.Test()) -// { -// StrBufFixed msg; -// e.Fmt(&msg); -// fprintf(stderr, msg.Text()); -// return -1; -// } -// -// // try to submit the files -// const char * commands[4]; -// char param1[256]; -// for (;;) -// { -// sprintf(param1, "//depot/.../%s.*", templateFileName.getName().c_str()); -// commands[0] = "submit"; -// commands[1] = param1; -// -// // don't report an error if the files need to be added before submitting -// ui.addFilteredError(SUBMIT_NO_FILE_ERR); -// client.SetArgv( 1, const_cast(&commands[1]) ); -// client.Run( commands[0], &ui ); -// if (!ui.errorOccurred()) -// break; -// if (ui.getLastError() != SUBMIT_NO_FILE_ERR) -// return -1; -// ui.clearLastError(); -// ui.clearFilteredErrors(); -// -// // we need to add the files to Perforce before submitting -// commands[0] = "add"; -// -// // add the template file -// commands[1] = templateFileName; -// client.SetArgv( 1, const_cast(&commands[1]) ); -// client.Run( commands[0], &ui ); -// if (ui.errorOccurred()) -// return -1; -// -// // add the client iff file -// Filename iffName(nullptr, templateFile.getIffPath().c_str(), iffFileName, nullptr); -// commands[1] = iffName; -// client.SetArgv( 1, const_cast(&commands[1]) ); -// client.Run( commands[0], &ui ); -// if (ui.errorOccurred()) -// return -1; -// } -// -// // Close connection -// return client.Final( &e ); -//} // checkIn - /** * Prints the command syntax to the console. */ @@ -444,13 +221,8 @@ void printSyntax(void) printf("TemplateCompiler " __DATE__ " " __TIME__ "\n\n"); printf("Compiler commands:\n"); printf("-generate [.tdf] [.tpf]\n"); -// printf("-update [.tpf] [[.tpf] ...]\n"); -// printf("-derive [.tpf] [.tpf]\n"); printf("-compile [.tpf] [[.tpf] ...]\n"); printf("-verify [.tpf] [[.tpf] ...]\n"); -// printf("Perforce commands:\n"); -// printf("-edit [.tpf] [[.tpf] ...]\n"); -// printf("-submit [.tpf] [[.tpf] ...]\n"); } // printSyntax /** @@ -473,20 +245,6 @@ int processArgs(int argc, char *argv[ ]) } return generateTemplate(argv[2], argv[3]); } -// else if (strcmp(argv[1], "-update") == 0) -// { -// if (argc < 3) -// { -// printSyntax(); -// return 0; -// } -// for (int i = 2; i < argc; ++i) -// { -// int result = updateTemplate(argv[i]); -// if (result != 0) -// return result; -// } -// } else if (strcmp(argv[1], "-derive") == 0) { if (argc != 4) @@ -542,34 +300,6 @@ int processArgs(int argc, char *argv[ ]) } return result; } - //else if (strcmp(argv[1], "-edit") == 0) - //{ - // if (argc < 3) - // { - // printSyntax(); - // return 0; - // } - // for (int i = 2; i < argc; ++i) - // { - // int result = checkOut(argv[i]); - // if (result != 0) - // return result; - // } - //} - //else if (strcmp(argv[1], "-submit") == 0) - //{ - // if (argc < 3) - // { - // printSyntax(); - // return 0; - // } - // for (int i = 2; i < argc; ++i) - // { - // int result = checkIn(argv[i]); - // if (result != 0) - // return result; - // } - //} else { printSyntax(); diff --git a/engine/shared/library/sharedCollision/src/shared/core/SpaceAvoidanceManager.cpp b/engine/shared/library/sharedCollision/src/shared/core/SpaceAvoidanceManager.cpp index bb8e6551..83611cce 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/SpaceAvoidanceManager.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/SpaceAvoidanceManager.cpp @@ -30,7 +30,6 @@ namespace SpaceAvoidanceManagerNamespace { // Lag/Slop factors. - float const cs_lookAheadGain = 1.5f; float const cs_shipBoundSphereRadiusGain = 1.5f; // Dynamic and static query flags. diff --git a/engine/shared/library/sharedFoundation/src/linux/SetupSharedFoundation.cpp b/engine/shared/library/sharedFoundation/src/linux/SetupSharedFoundation.cpp index e54017fc..8a0b901e 100755 --- a/engine/shared/library/sharedFoundation/src/linux/SetupSharedFoundation.cpp +++ b/engine/shared/library/sharedFoundation/src/linux/SetupSharedFoundation.cpp @@ -100,7 +100,7 @@ void SetupSharedFoundation::callbackWithExceptionHandling( void (*callback)(void { callback(); } - catch (__exception * mathException) + catch (const __exception * mathException) { FATAL(true, ("Math Exception: %s\n", mathException->name)); } diff --git a/engine/shared/library/sharedGame/src/shared/mount/SharedSaddleManager.cpp b/engine/shared/library/sharedGame/src/shared/mount/SharedSaddleManager.cpp index 083ed7c5..ddd85bff 100755 --- a/engine/shared/library/sharedGame/src/shared/mount/SharedSaddleManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/mount/SharedSaddleManager.cpp @@ -237,8 +237,6 @@ namespace SharedSaddleManagerNamespace ConstCharCrcString const cs_defaultCoveringLogicalAppearanceName("lookup/mnt_wr_default_covering"); ConstCharCrcString const cs_saddleHardpointName("saddle"); - char const * const cs_driverHardpointName = "player"; - char const * const cs_passengerHardpointName = "passenger"; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/engine/shared/library/sharedImage/src/shared/TargaFormat.cpp b/engine/shared/library/sharedImage/src/shared/TargaFormat.cpp index e8f6f545..882919b9 100755 --- a/engine/shared/library/sharedImage/src/shared/TargaFormat.cpp +++ b/engine/shared/library/sharedImage/src/shared/TargaFormat.cpp @@ -88,10 +88,6 @@ namespace TargaFormatNamespace #pragma pack(pop) #endif - const uint ms_attributeMask = BINARY2(0000,1111); - const uint ms_xOriginLocationMask = BINARY2(0001,0000); - const uint ms_yOriginLocationMask = BINARY2(0010,0000); - static bool _loadImage(AbstractFile *, Image **image, Image::PixelFormat format=Image::PF_nonStandard); static void _readUncompressedColorMapped1( diff --git a/engine/shared/library/sharedObject/src/shared/portal/PortalPropertyTemplate.h b/engine/shared/library/sharedObject/src/shared/portal/PortalPropertyTemplate.h index 68a5ab57..4eea3279 100755 --- a/engine/shared/library/sharedObject/src/shared/portal/PortalPropertyTemplate.h +++ b/engine/shared/library/sharedObject/src/shared/portal/PortalPropertyTemplate.h @@ -140,7 +140,7 @@ private: void load_0005(const PortalPropertyTemplate &portalPropertyTemplate, int cellIndex, Iff &iff); // disabled - PortalPropertyTemplateCell(PortalPropertyTemplateCell &); + PortalPropertyTemplateCell(const PortalPropertyTemplateCell &); PortalPropertyTemplateCell &operator =(PortalPropertyTemplateCell &); private: diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/Filename.cpp b/engine/shared/library/sharedTemplateDefinition/src/shared/core/Filename.cpp index 1f329c77..11a945eb 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/Filename.cpp +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/Filename.cpp @@ -22,13 +22,13 @@ const char WIN32_PATH_SEPARATOR = '\\'; const char LINUX_PATH_SEPARATOR = '/'; -//#if defined(WIN32) -//const char PATH_SEPARATOR = WIN32_PATH_SEPARATOR; -//#elif defined(linux) +#if defined(WIN32) +const char PATH_SEPARATOR = WIN32_PATH_SEPARATOR; +#elif defined(linux) const char PATH_SEPARATOR = LINUX_PATH_SEPARATOR; -//#else -//#error unknown OS -//#endif +#else +#error unknown OS +#endif /** diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateData.cpp b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateData.cpp index 335347bc..db757a94 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateData.cpp +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateData.cpp @@ -176,36 +176,6 @@ static const char * const DefaultDataReturnValue[] = "DefaultString" }; -// map enum ParamType to string equivalent -static const char * const EnumTypeNames[] = -{ - "TYPE_NONE", - "TYPE_COMMENT", - "TYPE_INTEGER", - "TYPE_FLOAT", - "TYPE_BOOL", - "TYPE_STRING", - "TYPE_STRINGID", - "TYPE_VECTOR", - "TYPE_DYNAMIC_VAR", - "TYPE_TEMPLATE", - "TYPE_ENUM", - "TYPE_STRUCT", - "TYPE_TRIGGER_VOLUME", - "TYPE_FILENAME", - "NUM_PARAM_TYPES" -}; - -// map enum TemplateLocation to string equivalent -static const char * const EnumLocationNames[] = -{ - "LOC_NONE", - "LOC_CLIENT", - "LOC_SERVER", - "LOC_SHARED" -}; - - //============================================================================== // class methods diff --git a/external/3rd/library/platform/utils/Base/ScopeLock.cpp b/external/3rd/library/platform/utils/Base/ScopeLock.cpp index ff531174..20866d54 100755 --- a/external/3rd/library/platform/utils/Base/ScopeLock.cpp +++ b/external/3rd/library/platform/utils/Base/ScopeLock.cpp @@ -16,7 +16,7 @@ namespace Base mMutex->Lock(); } - CScopeLock::CScopeLock(CScopeLock& lock) : + CScopeLock::CScopeLock(const CScopeLock& lock) : mMutex(lock.mMutex) { mMutex->Lock(); diff --git a/external/3rd/library/platform/utils/Base/ScopeLock.h b/external/3rd/library/platform/utils/Base/ScopeLock.h index d16c31d0..e50037e3 100755 --- a/external/3rd/library/platform/utils/Base/ScopeLock.h +++ b/external/3rd/library/platform/utils/Base/ScopeLock.h @@ -24,7 +24,7 @@ namespace Base { public: CScopeLock(CMutex& mutex); - CScopeLock(CScopeLock& lock); + CScopeLock(const CScopeLock& lock); virtual ~CScopeLock(); private: CMutex *mMutex; diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/ScopeLock.cpp b/external/3rd/library/soePlatform/CSAssist/utils/Base/ScopeLock.cpp index ff531174..20866d54 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/ScopeLock.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/ScopeLock.cpp @@ -16,7 +16,7 @@ namespace Base mMutex->Lock(); } - CScopeLock::CScopeLock(CScopeLock& lock) : + CScopeLock::CScopeLock(const CScopeLock& lock) : mMutex(lock.mMutex) { mMutex->Lock(); diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/ScopeLock.h b/external/3rd/library/soePlatform/CSAssist/utils/Base/ScopeLock.h index c965b78f..1ae97058 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/ScopeLock.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/ScopeLock.h @@ -24,7 +24,7 @@ namespace Base { public: CScopeLock(CMutex& mutex); - CScopeLock(CScopeLock& lock); + CScopeLock(const CScopeLock& lock); virtual ~CScopeLock(); private: diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/ScopeLock.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Base/ScopeLock.cpp index ff531174..20866d54 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/ScopeLock.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/ScopeLock.cpp @@ -16,7 +16,7 @@ namespace Base mMutex->Lock(); } - CScopeLock::CScopeLock(CScopeLock& lock) : + CScopeLock::CScopeLock(const CScopeLock& lock) : mMutex(lock.mMutex) { mMutex->Lock(); diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/ScopeLock.h b/external/3rd/library/soePlatform/ChatAPI/utils/Base/ScopeLock.h index c965b78f..1ae97058 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/ScopeLock.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/ScopeLock.h @@ -24,7 +24,7 @@ namespace Base { public: CScopeLock(CMutex& mutex); - CScopeLock(CScopeLock& lock); + CScopeLock(const CScopeLock& lock); virtual ~CScopeLock(); private: diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/ObjectTableBuffer.cpp b/game/server/application/SwgDatabaseServer/src/shared/buffers/ObjectTableBuffer.cpp index b3d787d0..d3472915 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/ObjectTableBuffer.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/buffers/ObjectTableBuffer.cpp @@ -30,7 +30,6 @@ namespace ObjectTableBufferNamespace { static const int s_numPositions = 20; static const int s_positionMasks[20] = {1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288}; - static const int s_allPositionsSet = 1048575; } using namespace ObjectTableBufferNamespace; From 3c50042abcb083ea700c39a46b17196df305c05d Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Thu, 18 Feb 2016 22:55:54 -0600 Subject: [PATCH 023/302] flint++ static analyzer detected items (not all that were likely legit positives, but a start) as well as some clang detected unused vars, cleanup_ --- .../application/Miff/src/linux/miff.cpp | 2 - .../ConsoleCommandParserLoginServer.cpp | 6 - .../src/shared/TaskUpdatePurgeAccountList.h | 4 - .../src/shared/CentralServerConnection.h | 2 +- .../src/shared/GameServerConnection.h | 2 +- .../serverDatabase/src/shared/LazyDeleter.h | 2 +- .../serverDatabase/src/shared/Persister.h | 2 +- .../src/shared/TaskManagerConnection.h | 2 +- .../src/shared/command/CommandQueue.cpp | 6 - .../shared/network/TaskManagerConnection.h | 2 +- .../src/shared/object/TangibleObject.cpp | 8 - .../src/shared/PathAutoGenerator.cpp | 2 - .../src/shared/ScriptMethodsObjectInfo.cpp | 1 - .../src/shared/ChatLogManager.cpp | 1 - .../src/shared/TemplateCompiler.cpp | 270 ------------------ .../src/shared/core/SpaceAvoidanceManager.cpp | 1 - .../src/linux/SetupSharedFoundation.cpp | 2 +- .../src/shared/mount/SharedSaddleManager.cpp | 2 - .../sharedImage/src/shared/TargaFormat.cpp | 4 - .../shared/portal/PortalPropertyTemplate.h | 2 +- .../src/shared/core/Filename.cpp | 12 +- .../src/shared/core/TemplateData.cpp | 30 -- .../library/platform/utils/Base/ScopeLock.cpp | 2 +- .../library/platform/utils/Base/ScopeLock.h | 2 +- .../CSAssist/utils/Base/ScopeLock.cpp | 2 +- .../CSAssist/utils/Base/ScopeLock.h | 2 +- .../ChatAPI/utils/Base/ScopeLock.cpp | 2 +- .../ChatAPI/utils/Base/ScopeLock.h | 2 +- .../src/shared/buffers/ObjectTableBuffer.cpp | 1 - 29 files changed, 20 insertions(+), 358 deletions(-) diff --git a/engine/client/application/Miff/src/linux/miff.cpp b/engine/client/application/Miff/src/linux/miff.cpp index 5bf4af1b..32f52b5b 100755 --- a/engine/client/application/Miff/src/linux/miff.cpp +++ b/engine/client/application/Miff/src/linux/miff.cpp @@ -53,8 +53,6 @@ #include // for tolower() //================================================= static vars assignment == -const int entryPointVersion = 1; // constantly check DataEntryPoint.h to see if this value has changed - OutputFileHandler *outfileHandler = nullptr; const int bufferSize = 16 * 1024 * 1024; const int maxStringSize = 256; diff --git a/engine/server/application/LoginServer/src/shared/ConsoleCommandParserLoginServer.cpp b/engine/server/application/LoginServer/src/shared/ConsoleCommandParserLoginServer.cpp index b1a2dfad..5d0d579e 100755 --- a/engine/server/application/LoginServer/src/shared/ConsoleCommandParserLoginServer.cpp +++ b/engine/server/application/LoginServer/src/shared/ConsoleCommandParserLoginServer.cpp @@ -22,12 +22,6 @@ namespace CommandNames #undef MAKE_COMMAND } -const CommandParser::CmdInfo cmds[] = -{ - {"runState", 0, "", "Return the running state of the CentralServer. It should always return 'running'"}, - {"", 0, "", ""} // this must be last -}; - //----------------------------------------------------------------------- ConsoleCommandParserLoginServer::ConsoleCommandParserLoginServer() : diff --git a/engine/server/application/LoginServer/src/shared/TaskUpdatePurgeAccountList.h b/engine/server/application/LoginServer/src/shared/TaskUpdatePurgeAccountList.h index 3888e9a5..645d30c4 100755 --- a/engine/server/application/LoginServer/src/shared/TaskUpdatePurgeAccountList.h +++ b/engine/server/application/LoginServer/src/shared/TaskUpdatePurgeAccountList.h @@ -18,10 +18,6 @@ class TaskUpdatePurgeAccountList : public DB::TaskRequest TaskUpdatePurgeAccountList(); virtual bool process (DB::Session *session); virtual void onComplete (); - - private: - StationId m_account; - int m_purgePhase; }; // ====================================================================== diff --git a/engine/server/library/serverDatabase/src/shared/CentralServerConnection.h b/engine/server/library/serverDatabase/src/shared/CentralServerConnection.h index c273c793..3c8bfd56 100755 --- a/engine/server/library/serverDatabase/src/shared/CentralServerConnection.h +++ b/engine/server/library/serverDatabase/src/shared/CentralServerConnection.h @@ -26,7 +26,7 @@ public: void onReceive (const Archive::ByteStream & message); void receiveMessage (const MessageDispatch::Emitter & source, const MessageDispatch::MessageBase & message); private: - CentralServerConnection(CentralServerConnection&); + CentralServerConnection(const CentralServerConnection&); CentralServerConnection& operator=(CentralServerConnection&); }; diff --git a/engine/server/library/serverDatabase/src/shared/GameServerConnection.h b/engine/server/library/serverDatabase/src/shared/GameServerConnection.h index 3cb47a73..3c183f01 100755 --- a/engine/server/library/serverDatabase/src/shared/GameServerConnection.h +++ b/engine/server/library/serverDatabase/src/shared/GameServerConnection.h @@ -31,7 +31,7 @@ private: ChunkCompleteQueueType * const m_chunkCompleteQueue; private: - GameServerConnection(GameServerConnection&); + GameServerConnection(const GameServerConnection&); GameServerConnection& operator=(GameServerConnection&); }; diff --git a/engine/server/library/serverDatabase/src/shared/LazyDeleter.h b/engine/server/library/serverDatabase/src/shared/LazyDeleter.h index e93816ec..7e35e05f 100755 --- a/engine/server/library/serverDatabase/src/shared/LazyDeleter.h +++ b/engine/server/library/serverDatabase/src/shared/LazyDeleter.h @@ -47,7 +47,7 @@ class LazyDeleter ~LazyDeleter(); private: - LazyDeleter(LazyDeleter&); //disable + LazyDeleter(const LazyDeleter&); //disable LazyDeleter &operator=(const LazyDeleter&); //disable private: diff --git a/engine/server/library/serverDatabase/src/shared/Persister.h b/engine/server/library/serverDatabase/src/shared/Persister.h index 3c432fbc..9cc76ac8 100755 --- a/engine/server/library/serverDatabase/src/shared/Persister.h +++ b/engine/server/library/serverDatabase/src/shared/Persister.h @@ -191,7 +191,7 @@ class Persister : public MessageDispatch::Receiver static void installDerived(Persister *derivedInstance); private: - Persister(Persister&); //disable + Persister(const Persister&); //disable Persister &operator=(const Persister&); //disable private: diff --git a/engine/server/library/serverDatabase/src/shared/TaskManagerConnection.h b/engine/server/library/serverDatabase/src/shared/TaskManagerConnection.h index 94d33a42..4a5cd576 100755 --- a/engine/server/library/serverDatabase/src/shared/TaskManagerConnection.h +++ b/engine/server/library/serverDatabase/src/shared/TaskManagerConnection.h @@ -20,7 +20,7 @@ public: void onConnectionOpened (); private: - TaskManagerConnection(TaskManagerConnection&); + TaskManagerConnection(const TaskManagerConnection&); TaskManagerConnection& operator=(TaskManagerConnection&); }; diff --git a/engine/server/library/serverGame/src/shared/command/CommandQueue.cpp b/engine/server/library/serverGame/src/shared/command/CommandQueue.cpp index 913fa7e0..0e3c1b26 100755 --- a/engine/server/library/serverGame/src/shared/command/CommandQueue.cpp +++ b/engine/server/library/serverGame/src/shared/command/CommandQueue.cpp @@ -45,12 +45,6 @@ namespace CommandQueueNamespace const bool cs_debug = false; #endif - /** - * @brief used to assign sequence Ids to server-generated commands - * that need to be replicated on the client. - */ - const uint32 cs_sequenceStart = 0x40000000; - /** * @brief the maximum number of combat commands that are allowed in * the queue at any given time. diff --git a/engine/server/library/serverGame/src/shared/network/TaskManagerConnection.h b/engine/server/library/serverGame/src/shared/network/TaskManagerConnection.h index 7544693e..66cb36ae 100755 --- a/engine/server/library/serverGame/src/shared/network/TaskManagerConnection.h +++ b/engine/server/library/serverGame/src/shared/network/TaskManagerConnection.h @@ -21,7 +21,7 @@ public: void onReceive (const Archive::ByteStream & message); private: - TaskManagerConnection(TaskManagerConnection&); + TaskManagerConnection(const TaskManagerConnection&); TaskManagerConnection& operator=(TaskManagerConnection&); }; diff --git a/engine/server/library/serverGame/src/shared/object/TangibleObject.cpp b/engine/server/library/serverGame/src/shared/object/TangibleObject.cpp index 3602f9a6..4f3c1ebf 100755 --- a/engine/server/library/serverGame/src/shared/object/TangibleObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/TangibleObject.cpp @@ -124,14 +124,6 @@ namespace TangibleObjectNamespace { int const s_minCombatDuration = 4; - const int NUM_DAMAGE_TYPES = 9; - - const int s_ignoreDamageTypes = - static_cast(ServerArmorTemplate::DT_environmental_heat) | - static_cast(ServerArmorTemplate::DT_environmental_cold) | - static_cast(ServerArmorTemplate::DT_environmental_acid) | - static_cast(ServerArmorTemplate::DT_environmental_electrical); - bool isEmpty(const ServerObject& obj) { const Container* container = obj.getContainerProperty(); diff --git a/engine/server/library/serverPathfinding/src/shared/PathAutoGenerator.cpp b/engine/server/library/serverPathfinding/src/shared/PathAutoGenerator.cpp index 328a52aa..b4dc446b 100755 --- a/engine/server/library/serverPathfinding/src/shared/PathAutoGenerator.cpp +++ b/engine/server/library/serverPathfinding/src/shared/PathAutoGenerator.cpp @@ -30,8 +30,6 @@ namespace PathAutoGeneratorNamespace { char const * const s_pathWaypointTemplate = "object/path_waypoint/path_waypoint.iff"; - char const * const s_pathObstacleTemplate = "object/resource_container/energy_solid_lg.iff"; - } using namespace PathAutoGeneratorNamespace; diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsObjectInfo.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsObjectInfo.cpp index b285e0be..5e9aea1d 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsObjectInfo.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsObjectInfo.cpp @@ -2684,7 +2684,6 @@ namespace // custom_var TypeId definitions const jint CVT_UNKNOWN = static_cast(0); - const jint CVT_CONST_STRING = static_cast(1); const jint CVT_RANGED_INT = static_cast(2); const jint CVT_PALCOLOR = static_cast(3); diff --git a/engine/server/library/serverUtility/src/shared/ChatLogManager.cpp b/engine/server/library/serverUtility/src/shared/ChatLogManager.cpp index e5283c05..c883063e 100755 --- a/engine/server/library/serverUtility/src/shared/ChatLogManager.cpp +++ b/engine/server/library/serverUtility/src/shared/ChatLogManager.cpp @@ -92,7 +92,6 @@ namespace ChatLogManagerNamespace time_t s_purgeTime = 0; int s_currentIndex = 0; time_t s_chatLogMemoryTimer = 0; - time_t const s_chatLogMemoryTime = 30; int s_cacheHits = 0; int s_cacheMisses = 0; diff --git a/engine/shared/application/TemplateCompiler/src/shared/TemplateCompiler.cpp b/engine/shared/application/TemplateCompiler/src/shared/TemplateCompiler.cpp index 2a3658bb..8f366d02 100755 --- a/engine/shared/application/TemplateCompiler/src/shared/TemplateCompiler.cpp +++ b/engine/shared/application/TemplateCompiler/src/shared/TemplateCompiler.cpp @@ -33,80 +33,6 @@ #include - -//============================================================================== -// subclass Perforce API class ClientUser in order to trap errors - -static const int SUBMIT_NO_FILE_ERR = 17; // need to add file before submitting - -//class MyPerforceUser : public ClientUser -//{ -//public: -// MyPerforceUser(void) : ClientUser(), m_errorOccurred(false) {} -// virtual ~MyPerforceUser() {} -// virtual void HandleError( Error *err ) -// { -// if (err != nullptr && err->Test()) -// { -// m_errorOccurred = true; -// m_lastError = err->GetGeneric(); -// // test for filtered errors -// for (size_t i = 0; i < m_filteredErrors.size(); ++i) -// { -// if (m_lastError == m_filteredErrors[i]) -// return; -// } -// } -// ClientUser::HandleError(err); -// } -// -// bool errorOccurred(void) const -// { -// return m_errorOccurred; -// } -// -// int getLastError(void) const -// { -// return m_lastError; -// } -// -// void clearLastError(void) -// { -// m_errorOccurred = false; -// m_lastError = 0; -// } -// -// void addFilteredError(int error) -// { -// m_filteredErrors.push_back(error); -// } -// -// void clearFilteredErrors(void) -// { -// m_filteredErrors.clear(); -// } -// -//private: -// bool m_errorOccurred; -// int m_lastError; -// std::vector m_filteredErrors; -//}; - -//============================================================================== -// subclass of the PerforceAPI StrBuf class, to workaround a bug -// in the destructor. We can't fix the bug because it's an external library -//class StrBufFixed : public StrBuf -//{ -//public: -// ~StrBufFixed() -// { -// delete buffer; -// StringInit(); -// } -//}; - - - //============================================================================== // functions @@ -287,155 +213,6 @@ TpfFile templateFile; return result; } // verifyTemplate -/** - * Adds or removes parameters from a template based on the current template - * definition. - * - * @param filename the filename of the template - * - * @return 0 on success, error code on fail - * -int updateTemplate(const char *filename) -{ -TpfFile templateFile; - - Filename templateFileName(nullptr, nullptr, filename, TEMPLATE_EXTENSION); - return templateFile.updateTemplate(templateFileName); -} // updateTemplate -*/ -/** - * Checks out a template file and the iff files associated with it from Perforce. - * - * @param filename the filename of the template - * - * @return 0 on success, error code on fail - */ -//int checkOut(const char *filename) -//{ -//MyPerforceUser ui; -//ClientApi client; -//Error e; -// -// // check filename extensions -// Filename templateFileName(nullptr, nullptr, filename, TEMPLATE_EXTENSION); -// Filename iffFileName = templateFileName; -// iffFileName.setExtension(IFF_EXTENSION); -// -// // Connect to Perforce server -// client.Init( &e ); -// if (e.Test()) -// { -// StrBufFixed msg; -// e.Fmt(&msg); -// fprintf(stderr, msg.Text()); -// return -1; -// } -// -// // check out the template file -// const char * commands[2]; -// commands[0] = "edit"; -// commands[1] = templateFileName; -// client.SetArgv( 1, const_cast(&commands[1]) ); -// client.Run( commands[0], &ui ); -// if (ui.errorOccurred()) -// return -1; -// -// // find the client and server paths -// TpfFile templateFile; -// IGNORE_RETURN(templateFile.loadTemplate(templateFileName)); -// -// // check out the client template iff file -// Filename iffName(nullptr, templateFile.getIffPath().c_str(), iffFileName, IFF_EXTENSION); -// commands[1] = iffName; -// client.SetArgv( 1, const_cast(&commands[1]) ); -// client.Run( commands[0], &ui ); -// if (ui.errorOccurred()) -// return -1; -// -// // Close connection -// return client.Final( &e ); -//} // checkOut - -/** - * Checks in a template file and the iff files associated with it to Perforce. - * - * @param filename the filename of the template - * - * @return 0 on success, error code on fail - */ -//int checkIn(const char *filename) -//{ -//MyPerforceUser ui; -//ClientApi client; -//Error e; -// -// // check filename extensions -// Filename templateFileName(nullptr, nullptr, filename, TEMPLATE_EXTENSION); -// Filename iffFileName = templateFileName; -// iffFileName.setExtension(IFF_EXTENSION); -// -// // find the client and server paths -// TpfFile templateFile; -// int result = templateFile.loadTemplate(templateFileName); -// if (result != 0) -// { -// // don't allow check-in if there are errors -// return result; -// } -// -// // Connect to Perforce server -// client.Init( &e ); -// if (e.Test()) -// { -// StrBufFixed msg; -// e.Fmt(&msg); -// fprintf(stderr, msg.Text()); -// return -1; -// } -// -// // try to submit the files -// const char * commands[4]; -// char param1[256]; -// for (;;) -// { -// sprintf(param1, "//depot/.../%s.*", templateFileName.getName().c_str()); -// commands[0] = "submit"; -// commands[1] = param1; -// -// // don't report an error if the files need to be added before submitting -// ui.addFilteredError(SUBMIT_NO_FILE_ERR); -// client.SetArgv( 1, const_cast(&commands[1]) ); -// client.Run( commands[0], &ui ); -// if (!ui.errorOccurred()) -// break; -// if (ui.getLastError() != SUBMIT_NO_FILE_ERR) -// return -1; -// ui.clearLastError(); -// ui.clearFilteredErrors(); -// -// // we need to add the files to Perforce before submitting -// commands[0] = "add"; -// -// // add the template file -// commands[1] = templateFileName; -// client.SetArgv( 1, const_cast(&commands[1]) ); -// client.Run( commands[0], &ui ); -// if (ui.errorOccurred()) -// return -1; -// -// // add the client iff file -// Filename iffName(nullptr, templateFile.getIffPath().c_str(), iffFileName, nullptr); -// commands[1] = iffName; -// client.SetArgv( 1, const_cast(&commands[1]) ); -// client.Run( commands[0], &ui ); -// if (ui.errorOccurred()) -// return -1; -// } -// -// // Close connection -// return client.Final( &e ); -//} // checkIn - /** * Prints the command syntax to the console. */ @@ -444,13 +221,8 @@ void printSyntax(void) printf("TemplateCompiler " __DATE__ " " __TIME__ "\n\n"); printf("Compiler commands:\n"); printf("-generate [.tdf] [.tpf]\n"); -// printf("-update [.tpf] [[.tpf] ...]\n"); -// printf("-derive [.tpf] [.tpf]\n"); printf("-compile [.tpf] [[.tpf] ...]\n"); printf("-verify [.tpf] [[.tpf] ...]\n"); -// printf("Perforce commands:\n"); -// printf("-edit [.tpf] [[.tpf] ...]\n"); -// printf("-submit [.tpf] [[.tpf] ...]\n"); } // printSyntax /** @@ -473,20 +245,6 @@ int processArgs(int argc, char *argv[ ]) } return generateTemplate(argv[2], argv[3]); } -// else if (strcmp(argv[1], "-update") == 0) -// { -// if (argc < 3) -// { -// printSyntax(); -// return 0; -// } -// for (int i = 2; i < argc; ++i) -// { -// int result = updateTemplate(argv[i]); -// if (result != 0) -// return result; -// } -// } else if (strcmp(argv[1], "-derive") == 0) { if (argc != 4) @@ -542,34 +300,6 @@ int processArgs(int argc, char *argv[ ]) } return result; } - //else if (strcmp(argv[1], "-edit") == 0) - //{ - // if (argc < 3) - // { - // printSyntax(); - // return 0; - // } - // for (int i = 2; i < argc; ++i) - // { - // int result = checkOut(argv[i]); - // if (result != 0) - // return result; - // } - //} - //else if (strcmp(argv[1], "-submit") == 0) - //{ - // if (argc < 3) - // { - // printSyntax(); - // return 0; - // } - // for (int i = 2; i < argc; ++i) - // { - // int result = checkIn(argv[i]); - // if (result != 0) - // return result; - // } - //} else { printSyntax(); diff --git a/engine/shared/library/sharedCollision/src/shared/core/SpaceAvoidanceManager.cpp b/engine/shared/library/sharedCollision/src/shared/core/SpaceAvoidanceManager.cpp index bb8e6551..83611cce 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/SpaceAvoidanceManager.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/SpaceAvoidanceManager.cpp @@ -30,7 +30,6 @@ namespace SpaceAvoidanceManagerNamespace { // Lag/Slop factors. - float const cs_lookAheadGain = 1.5f; float const cs_shipBoundSphereRadiusGain = 1.5f; // Dynamic and static query flags. diff --git a/engine/shared/library/sharedFoundation/src/linux/SetupSharedFoundation.cpp b/engine/shared/library/sharedFoundation/src/linux/SetupSharedFoundation.cpp index e54017fc..8a0b901e 100755 --- a/engine/shared/library/sharedFoundation/src/linux/SetupSharedFoundation.cpp +++ b/engine/shared/library/sharedFoundation/src/linux/SetupSharedFoundation.cpp @@ -100,7 +100,7 @@ void SetupSharedFoundation::callbackWithExceptionHandling( void (*callback)(void { callback(); } - catch (__exception * mathException) + catch (const __exception * mathException) { FATAL(true, ("Math Exception: %s\n", mathException->name)); } diff --git a/engine/shared/library/sharedGame/src/shared/mount/SharedSaddleManager.cpp b/engine/shared/library/sharedGame/src/shared/mount/SharedSaddleManager.cpp index 083ed7c5..ddd85bff 100755 --- a/engine/shared/library/sharedGame/src/shared/mount/SharedSaddleManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/mount/SharedSaddleManager.cpp @@ -237,8 +237,6 @@ namespace SharedSaddleManagerNamespace ConstCharCrcString const cs_defaultCoveringLogicalAppearanceName("lookup/mnt_wr_default_covering"); ConstCharCrcString const cs_saddleHardpointName("saddle"); - char const * const cs_driverHardpointName = "player"; - char const * const cs_passengerHardpointName = "passenger"; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/engine/shared/library/sharedImage/src/shared/TargaFormat.cpp b/engine/shared/library/sharedImage/src/shared/TargaFormat.cpp index e8f6f545..882919b9 100755 --- a/engine/shared/library/sharedImage/src/shared/TargaFormat.cpp +++ b/engine/shared/library/sharedImage/src/shared/TargaFormat.cpp @@ -88,10 +88,6 @@ namespace TargaFormatNamespace #pragma pack(pop) #endif - const uint ms_attributeMask = BINARY2(0000,1111); - const uint ms_xOriginLocationMask = BINARY2(0001,0000); - const uint ms_yOriginLocationMask = BINARY2(0010,0000); - static bool _loadImage(AbstractFile *, Image **image, Image::PixelFormat format=Image::PF_nonStandard); static void _readUncompressedColorMapped1( diff --git a/engine/shared/library/sharedObject/src/shared/portal/PortalPropertyTemplate.h b/engine/shared/library/sharedObject/src/shared/portal/PortalPropertyTemplate.h index 68a5ab57..4eea3279 100755 --- a/engine/shared/library/sharedObject/src/shared/portal/PortalPropertyTemplate.h +++ b/engine/shared/library/sharedObject/src/shared/portal/PortalPropertyTemplate.h @@ -140,7 +140,7 @@ private: void load_0005(const PortalPropertyTemplate &portalPropertyTemplate, int cellIndex, Iff &iff); // disabled - PortalPropertyTemplateCell(PortalPropertyTemplateCell &); + PortalPropertyTemplateCell(const PortalPropertyTemplateCell &); PortalPropertyTemplateCell &operator =(PortalPropertyTemplateCell &); private: diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/Filename.cpp b/engine/shared/library/sharedTemplateDefinition/src/shared/core/Filename.cpp index 1f329c77..11a945eb 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/Filename.cpp +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/Filename.cpp @@ -22,13 +22,13 @@ const char WIN32_PATH_SEPARATOR = '\\'; const char LINUX_PATH_SEPARATOR = '/'; -//#if defined(WIN32) -//const char PATH_SEPARATOR = WIN32_PATH_SEPARATOR; -//#elif defined(linux) +#if defined(WIN32) +const char PATH_SEPARATOR = WIN32_PATH_SEPARATOR; +#elif defined(linux) const char PATH_SEPARATOR = LINUX_PATH_SEPARATOR; -//#else -//#error unknown OS -//#endif +#else +#error unknown OS +#endif /** diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateData.cpp b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateData.cpp index 335347bc..db757a94 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateData.cpp +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/TemplateData.cpp @@ -176,36 +176,6 @@ static const char * const DefaultDataReturnValue[] = "DefaultString" }; -// map enum ParamType to string equivalent -static const char * const EnumTypeNames[] = -{ - "TYPE_NONE", - "TYPE_COMMENT", - "TYPE_INTEGER", - "TYPE_FLOAT", - "TYPE_BOOL", - "TYPE_STRING", - "TYPE_STRINGID", - "TYPE_VECTOR", - "TYPE_DYNAMIC_VAR", - "TYPE_TEMPLATE", - "TYPE_ENUM", - "TYPE_STRUCT", - "TYPE_TRIGGER_VOLUME", - "TYPE_FILENAME", - "NUM_PARAM_TYPES" -}; - -// map enum TemplateLocation to string equivalent -static const char * const EnumLocationNames[] = -{ - "LOC_NONE", - "LOC_CLIENT", - "LOC_SERVER", - "LOC_SHARED" -}; - - //============================================================================== // class methods diff --git a/external/3rd/library/platform/utils/Base/ScopeLock.cpp b/external/3rd/library/platform/utils/Base/ScopeLock.cpp index ff531174..20866d54 100755 --- a/external/3rd/library/platform/utils/Base/ScopeLock.cpp +++ b/external/3rd/library/platform/utils/Base/ScopeLock.cpp @@ -16,7 +16,7 @@ namespace Base mMutex->Lock(); } - CScopeLock::CScopeLock(CScopeLock& lock) : + CScopeLock::CScopeLock(const CScopeLock& lock) : mMutex(lock.mMutex) { mMutex->Lock(); diff --git a/external/3rd/library/platform/utils/Base/ScopeLock.h b/external/3rd/library/platform/utils/Base/ScopeLock.h index d16c31d0..e50037e3 100755 --- a/external/3rd/library/platform/utils/Base/ScopeLock.h +++ b/external/3rd/library/platform/utils/Base/ScopeLock.h @@ -24,7 +24,7 @@ namespace Base { public: CScopeLock(CMutex& mutex); - CScopeLock(CScopeLock& lock); + CScopeLock(const CScopeLock& lock); virtual ~CScopeLock(); private: CMutex *mMutex; diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/ScopeLock.cpp b/external/3rd/library/soePlatform/CSAssist/utils/Base/ScopeLock.cpp index ff531174..20866d54 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/ScopeLock.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/ScopeLock.cpp @@ -16,7 +16,7 @@ namespace Base mMutex->Lock(); } - CScopeLock::CScopeLock(CScopeLock& lock) : + CScopeLock::CScopeLock(const CScopeLock& lock) : mMutex(lock.mMutex) { mMutex->Lock(); diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/ScopeLock.h b/external/3rd/library/soePlatform/CSAssist/utils/Base/ScopeLock.h index c965b78f..1ae97058 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/ScopeLock.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/ScopeLock.h @@ -24,7 +24,7 @@ namespace Base { public: CScopeLock(CMutex& mutex); - CScopeLock(CScopeLock& lock); + CScopeLock(const CScopeLock& lock); virtual ~CScopeLock(); private: diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/ScopeLock.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Base/ScopeLock.cpp index ff531174..20866d54 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/ScopeLock.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/ScopeLock.cpp @@ -16,7 +16,7 @@ namespace Base mMutex->Lock(); } - CScopeLock::CScopeLock(CScopeLock& lock) : + CScopeLock::CScopeLock(const CScopeLock& lock) : mMutex(lock.mMutex) { mMutex->Lock(); diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/ScopeLock.h b/external/3rd/library/soePlatform/ChatAPI/utils/Base/ScopeLock.h index c965b78f..1ae97058 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/ScopeLock.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/ScopeLock.h @@ -24,7 +24,7 @@ namespace Base { public: CScopeLock(CMutex& mutex); - CScopeLock(CScopeLock& lock); + CScopeLock(const CScopeLock& lock); virtual ~CScopeLock(); private: diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/ObjectTableBuffer.cpp b/game/server/application/SwgDatabaseServer/src/shared/buffers/ObjectTableBuffer.cpp index b3d787d0..d3472915 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/ObjectTableBuffer.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/buffers/ObjectTableBuffer.cpp @@ -30,7 +30,6 @@ namespace ObjectTableBufferNamespace { static const int s_numPositions = 20; static const int s_positionMasks[20] = {1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288}; - static const int s_allPositionsSet = 1048575; } using namespace ObjectTableBufferNamespace; From 9393e6e7af604f905daaf5c02b4b5f9fb5e85e52 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Thu, 18 Feb 2016 23:40:07 -0600 Subject: [PATCH 024/302] another flint detected issue - init to 0 instead of with ourselves --- external/ours/library/crypto/src/shared/original/queue.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/ours/library/crypto/src/shared/original/queue.cpp b/external/ours/library/crypto/src/shared/original/queue.cpp index 2fb3250a..9ce378de 100755 --- a/external/ours/library/crypto/src/shared/original/queue.cpp +++ b/external/ours/library/crypto/src/shared/original/queue.cpp @@ -130,7 +130,7 @@ public: // ******************************************************** ByteQueue::ByteQueue(unsigned int m_nodeSize) - : m_nodeSize(m_nodeSize), m_lazyLength(0) + : m_nodeSize(0), m_lazyLength(0) { m_head = m_tail = new ByteQueueNode(m_nodeSize); } From ad8f6d5a99350401a197499a893e48e6281cd3cb Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Thu, 18 Feb 2016 23:40:07 -0600 Subject: [PATCH 025/302] another flint detected issue - init to 0 instead of with ourselves --- external/ours/library/crypto/src/shared/original/queue.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/ours/library/crypto/src/shared/original/queue.cpp b/external/ours/library/crypto/src/shared/original/queue.cpp index 2fb3250a..9ce378de 100755 --- a/external/ours/library/crypto/src/shared/original/queue.cpp +++ b/external/ours/library/crypto/src/shared/original/queue.cpp @@ -130,7 +130,7 @@ public: // ******************************************************** ByteQueue::ByteQueue(unsigned int m_nodeSize) - : m_nodeSize(m_nodeSize), m_lazyLength(0) + : m_nodeSize(0), m_lazyLength(0) { m_head = m_tail = new ByteQueueNode(m_nodeSize); } From be3df7efda467f9ca7ba70ed14114cd64ea5912c Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Fri, 19 Feb 2016 14:30:32 -0600 Subject: [PATCH 026/302] this fixes one problem, but we still run into the issue with addAllIfNotPresent --- .../serverScript/src/shared/JNIWrappers.cpp | 2 +- .../serverScript/src/shared/JavaLibrary.cpp | 48 +++++++++---------- 2 files changed, 24 insertions(+), 26 deletions(-) diff --git a/engine/server/library/serverScript/src/shared/JNIWrappers.cpp b/engine/server/library/serverScript/src/shared/JNIWrappers.cpp index d958183a..fc3b148f 100755 --- a/engine/server/library/serverScript/src/shared/JNIWrappers.cpp +++ b/engine/server/library/serverScript/src/shared/JNIWrappers.cpp @@ -1093,7 +1093,7 @@ JavaString::JavaString(const Unicode::String & src) : JavaString::~JavaString() { - if (m_ref != 0 && JavaLibrary::getEnv() != nullptr) + if (m_ref > 0 && JavaLibrary::getEnv() != nullptr) JavaLibrary::getEnv()->DeleteLocalRef(m_ref); m_ref = 0; } diff --git a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp index a5c2f6c5..10fe16dc 100755 --- a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp +++ b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp @@ -1172,13 +1172,11 @@ void JavaLibrary::initializeJavaThread() options.push_back(tempOption); #endif -// these don't seem to play nice with java >= 7 -#if !defined(JNI_VERSION_1_9) && !defined(JNI_VERSION_1_8) && !defined(JNI_VERSION_1_7) tempOption.optionString = "-Xrs"; options.push_back(tempOption); - tempOption.optionString = "-Xcheck:jni"; - options.push_back(tempOption); -#endif +// tempOption.optionString = "-Xcheck:jni"; +// options.push_back(tempOption); + if (ConfigServerGame::getCompileScripts()) { tempOption.optionString = "-Xint"; @@ -1271,36 +1269,36 @@ void JavaLibrary::initializeJavaThread() // there's a dynamic method but requires the jvm to already be running, wtf? #ifdef JNI_VERSION_1_9 vm_args.version = JNI_VERSION_1_9; -#define JAVAVERSET = 1 +#define JNIVERSET = 1 #endif -#if !defined(JAVAVERSET) && defined(JNI_VERSION_1_8) +#if !defined(JNIVERSET) && defined(JNI_VERSION_1_8) vm_args.version = JNI_VERSION_1_8; -#define JAVAVERSET = 1 +#define JNIVERSET = 1 #endif -#if !defined(JAVAVERSET) && defined(JNI_VERSION_1_7) +#if !defined(JNIVERSET) && defined(JNI_VERSION_1_7) vm_args.version = JNI_VERSION_1_7; -#define JAVAVERSET = 1 +#define JNIVERSET = 1 #endif -#if !defined(JAVAVERSET) && defined(JNI_VERSION_1_6) +#if !defined(JNIVERSET) && defined(JNI_VERSION_1_6) vm_args.version = JNI_VERSION_1_6; -#define JAVAVERSET = 1 +#define JNIVERSET = 1 #endif -#if !defined(JAVAVERSET) && defined(JNI_VERSION_1_5) +#if !defined(JNIVERSET) && defined(JNI_VERSION_1_5) vm_args.version = JNI_VERSION_1_5; -#define JAVAVERSET = 1 +#define JNIVERSET = 1 #endif -#if !defined(JAVAVERSET) && defined(JNI_VERSION_1_4) +#if !defined(JNIVERSET) && defined(JNI_VERSION_1_4) vm_args.version = JNI_VERSION_1_4; -#define JAVAVERSET = 1 +#define JNIVERSET = 1 #endif -#ifdef JAVAVERSET -#undef JAVAVERSET +#ifdef JNIVERSET +#undef JNIVERSET #else #error JNI version not found/set! #endif @@ -1329,7 +1327,7 @@ void JavaLibrary::initializeJavaThread() } ms_loaded = 1; -#if !defined(JNI_VERSION_1_9) && !defined(JNI_VERSION_1_8) && !defined(JNI_VERSION_1_7) && defined(linux) +//#if !defined(JNI_VERSION_1_9) && !defined(JNI_VERSION_1_8) && !defined(JNI_VERSION_1_7) && defined(linux) if (ConfigServerGame::getTrapScriptCrashes()) { //set up signal handler for fatals in linux @@ -1338,7 +1336,7 @@ void JavaLibrary::initializeJavaThread() OurSa.sa_flags = 0; IGNORE_RETURN(sigaction(SIGSEGV, &OurSa, &JavaSa)); } -#endif +//#endif // wait until the main thread tells us to shutdown ms_shutdownJava->wait(); @@ -1347,13 +1345,13 @@ void JavaLibrary::initializeJavaThread() IGNORE_RETURN(ms_jvm->DestroyJavaVM()); ms_jvm = nullptr; -#if !defined(JNI_VERSION_1_9) && !defined(JNI_VERSION_1_8) && !defined(JNI_VERSION_1_7) && defined(linux) +//#if !defined(JNI_VERSION_1_9) && !defined(JNI_VERSION_1_8) && !defined(JNI_VERSION_1_7) && defined(linux) if (ConfigServerGame::getTrapScriptCrashes()) { // restore the default signal handler IGNORE_RETURN(sigaction(SIGSEGV, &OrgSa, NULL)); } -#endif +//#endif @@ -5251,10 +5249,10 @@ bool JavaLibrary::unpackDictionary(const std::vector & packedData, if (!packedData.empty()) { // get the crc from the data -// uint32 crc = 0; + uint32 crc = 0; int dataLen = packedData.size(); const int8 * data = &packedData[0]; - /* + std::vector::const_iterator result = std::find(packedData.begin(), packedData.end(), '*'); if (result != packedData.end()) @@ -5283,7 +5281,7 @@ bool JavaLibrary::unpackDictionary(const std::vector & packedData, } } } - */ + if (data != nullptr && *data != '\0') { LocalByteArrayRefPtr jdata = createNewByteArray(dataLen); From 3984be6ff0508a0436b504dd9264e8a108099d06 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Fri, 19 Feb 2016 16:51:21 -0600 Subject: [PATCH 027/302] brackets mothafucka! --- .../serverScript/src/shared/JNIWrappers.cpp | 38 ++++++++++++------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/engine/server/library/serverScript/src/shared/JNIWrappers.cpp b/engine/server/library/serverScript/src/shared/JNIWrappers.cpp index fc3b148f..e5ca59c0 100755 --- a/engine/server/library/serverScript/src/shared/JNIWrappers.cpp +++ b/engine/server/library/serverScript/src/shared/JNIWrappers.cpp @@ -902,9 +902,11 @@ LocalRef::LocalRef(jobject src) : LocalRef::~LocalRef() { - if (m_ref != 0 && JavaLibrary::getEnv() != nullptr) + if (m_ref > 0 && JavaLibrary::getEnv() != nullptr) + { JavaLibrary::getEnv()->DeleteLocalRef(m_ref); - m_ref = 0; + m_ref = 0; + } } @@ -917,9 +919,11 @@ LocalArrayRef::LocalArrayRef(jarray src) : LocalArrayRef::~LocalArrayRef() { - if (m_ref != 0 && JavaLibrary::getEnv() != nullptr) + if (m_ref > 0 && JavaLibrary::getEnv() != nullptr) + { JavaLibrary::getEnv()->DeleteLocalRef(m_ref); - m_ref = 0; + m_ref = 0; + } } @@ -932,9 +936,11 @@ LocalObjectArrayRef::LocalObjectArrayRef(jobjectArray src) : LocalObjectArrayRef::~LocalObjectArrayRef() { - if (m_ref != 0 && JavaLibrary::getEnv() != nullptr) + if (m_ref > 0 && JavaLibrary::getEnv() != nullptr) + { JavaLibrary::getEnv()->DeleteLocalRef(m_ref); - m_ref = 0; + m_ref = 0; + } } @@ -1008,9 +1014,11 @@ GlobalRef::GlobalRef(const LocalRefParam & src) : GlobalRef::~GlobalRef() { - if (m_ref != 0 && JavaLibrary::getEnv() != nullptr) + if (m_ref > 0 && JavaLibrary::getEnv() != nullptr) + { JavaLibrary::getEnv()->DeleteGlobalRef(m_ref); - m_ref = 0; + m_ref = 0; + } } @@ -1025,9 +1033,11 @@ GlobalArrayRef::GlobalArrayRef(const LocalObjectArrayRefParam & src) : GlobalArrayRef::~GlobalArrayRef() { - if (m_ref != 0 && JavaLibrary::getEnv() != nullptr) + if (m_ref > 0 && JavaLibrary::getEnv() != nullptr) + { JavaLibrary::getEnv()->DeleteGlobalRef(m_ref); - m_ref = 0; + m_ref = 0; + } } //======================================================================== @@ -1048,7 +1058,7 @@ JavaStringParam::~JavaStringParam() int JavaStringParam::fillBuffer(char * buffer, int size) const { - if (m_ref != 0 && buffer != nullptr && JavaLibrary::getEnv() != nullptr) + if (m_ref > 0 && buffer != nullptr && JavaLibrary::getEnv() != nullptr) { // Get the number of storage bytes required to convert this Java string into a UTF-8 string. // Include the terminating nullptr byte in the required buffer size. @@ -1093,9 +1103,11 @@ JavaString::JavaString(const Unicode::String & src) : JavaString::~JavaString() { - if (m_ref > 0 && JavaLibrary::getEnv() != nullptr) + if (m_ref > 0 && JavaLibrary::getEnv() != nullptr) + { JavaLibrary::getEnv()->DeleteLocalRef(m_ref); - m_ref = 0; + m_ref = 0; + } } From 756c4744f59c65037bba6558b4e1756746bf5477 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Fri, 19 Feb 2016 18:20:35 -0600 Subject: [PATCH 028/302] re-remove these from 7/8 --- .../library/serverScript/src/shared/JavaLibrary.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp index 10fe16dc..e72e068a 100755 --- a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp +++ b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp @@ -1168,14 +1168,17 @@ void JavaLibrary::initializeJavaThread() // java 1.8 and higher uses metaspace...which is apparently unlimited by default #if defined(JNI_VERSION_1_8) || defined(JNI_VERSION_1_9) - tempOption.optionString = "-XX:MetaspaceSize=128m"; + tempOption.optionString = "-XX:MetaspaceSize=512m"; options.push_back(tempOption); #endif +// these don't seem to play nice with java/JNI >= 7 +#if !defined(JNI_VERSION_1_9) && !defined(JNI_VERSION_1_8) && !defined(JNI_VERSION_1_7) tempOption.optionString = "-Xrs"; options.push_back(tempOption); -// tempOption.optionString = "-Xcheck:jni"; -// options.push_back(tempOption); + tempOption.optionString = "-Xcheck:jni"; + options.push_back(tempOption); +#endif if (ConfigServerGame::getCompileScripts()) { From 467c73574e41dc7177b0c990cd5e1e80a37cf3d4 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Fri, 19 Feb 2016 18:24:46 -0600 Subject: [PATCH 029/302] undo the "brackets mothafucka" commit as this should probably still be proper --- .../serverScript/src/shared/JNIWrappers.cpp | 24 +++++-------------- 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/engine/server/library/serverScript/src/shared/JNIWrappers.cpp b/engine/server/library/serverScript/src/shared/JNIWrappers.cpp index e5ca59c0..cb943db2 100755 --- a/engine/server/library/serverScript/src/shared/JNIWrappers.cpp +++ b/engine/server/library/serverScript/src/shared/JNIWrappers.cpp @@ -903,10 +903,8 @@ LocalRef::LocalRef(jobject src) : LocalRef::~LocalRef() { if (m_ref > 0 && JavaLibrary::getEnv() != nullptr) - { JavaLibrary::getEnv()->DeleteLocalRef(m_ref); - m_ref = 0; - } + m_ref = 0; } @@ -920,10 +918,8 @@ LocalArrayRef::LocalArrayRef(jarray src) : LocalArrayRef::~LocalArrayRef() { if (m_ref > 0 && JavaLibrary::getEnv() != nullptr) - { JavaLibrary::getEnv()->DeleteLocalRef(m_ref); - m_ref = 0; - } + m_ref = 0; } @@ -937,10 +933,8 @@ LocalObjectArrayRef::LocalObjectArrayRef(jobjectArray src) : LocalObjectArrayRef::~LocalObjectArrayRef() { if (m_ref > 0 && JavaLibrary::getEnv() != nullptr) - { JavaLibrary::getEnv()->DeleteLocalRef(m_ref); - m_ref = 0; - } + m_ref = 0; } @@ -1015,10 +1009,8 @@ GlobalRef::GlobalRef(const LocalRefParam & src) : GlobalRef::~GlobalRef() { if (m_ref > 0 && JavaLibrary::getEnv() != nullptr) - { JavaLibrary::getEnv()->DeleteGlobalRef(m_ref); - m_ref = 0; - } + m_ref = 0; } @@ -1034,10 +1026,8 @@ GlobalArrayRef::GlobalArrayRef(const LocalObjectArrayRefParam & src) : GlobalArrayRef::~GlobalArrayRef() { if (m_ref > 0 && JavaLibrary::getEnv() != nullptr) - { JavaLibrary::getEnv()->DeleteGlobalRef(m_ref); - m_ref = 0; - } + m_ref = 0; } //======================================================================== @@ -1104,10 +1094,8 @@ JavaString::JavaString(const Unicode::String & src) : JavaString::~JavaString() { if (m_ref > 0 && JavaLibrary::getEnv() != nullptr) - { JavaLibrary::getEnv()->DeleteLocalRef(m_ref); - m_ref = 0; - } + m_ref = 0; } From d3666f0fa3b69a2e23f24a2d295cf3ac356ee17b Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Fri, 19 Feb 2016 18:40:46 -0600 Subject: [PATCH 030/302] ok this plus (potentially) the removal of those flags makes it work --- .../library/serverScript/src/shared/JavaLibrary.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp index e72e068a..94cb02ff 100755 --- a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp +++ b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp @@ -1330,7 +1330,7 @@ void JavaLibrary::initializeJavaThread() } ms_loaded = 1; -//#if !defined(JNI_VERSION_1_9) && !defined(JNI_VERSION_1_8) && !defined(JNI_VERSION_1_7) && defined(linux) +#if !defined(JNI_VERSION_1_9) && !defined(JNI_VERSION_1_8) && !defined(JNI_VERSION_1_7) && defined(linux) if (ConfigServerGame::getTrapScriptCrashes()) { //set up signal handler for fatals in linux @@ -1339,7 +1339,7 @@ void JavaLibrary::initializeJavaThread() OurSa.sa_flags = 0; IGNORE_RETURN(sigaction(SIGSEGV, &OurSa, &JavaSa)); } -//#endif +#endif // wait until the main thread tells us to shutdown ms_shutdownJava->wait(); @@ -1348,13 +1348,13 @@ void JavaLibrary::initializeJavaThread() IGNORE_RETURN(ms_jvm->DestroyJavaVM()); ms_jvm = nullptr; -//#if !defined(JNI_VERSION_1_9) && !defined(JNI_VERSION_1_8) && !defined(JNI_VERSION_1_7) && defined(linux) +#if !defined(JNI_VERSION_1_9) && !defined(JNI_VERSION_1_8) && !defined(JNI_VERSION_1_7) && defined(linux) if (ConfigServerGame::getTrapScriptCrashes()) { // restore the default signal handler IGNORE_RETURN(sigaction(SIGSEGV, &OrgSa, NULL)); } -//#endif +#endif From fe09cb38c19f53830f32583e5631947345ed8e59 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Fri, 19 Feb 2016 19:01:21 -0600 Subject: [PATCH 031/302] add the javaUseXcheck option to ServerGame to allow for use of the jni linting/checking system, which spams shitloads of output --- .../serverGame/src/shared/core/ConfigServerGame.cpp | 1 + .../serverGame/src/shared/core/ConfigServerGame.h | 9 +++++++++ .../library/serverScript/src/shared/JavaLibrary.cpp | 13 +++++++------ 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/engine/server/library/serverGame/src/shared/core/ConfigServerGame.cpp b/engine/server/library/serverGame/src/shared/core/ConfigServerGame.cpp index 03a9061f..255af0e3 100755 --- a/engine/server/library/serverGame/src/shared/core/ConfigServerGame.cpp +++ b/engine/server/library/serverGame/src/shared/core/ConfigServerGame.cpp @@ -103,6 +103,7 @@ void ConfigServerGame::install(void) KEY_INT (jediUpdateLocationTimeSeconds, 60 * 5); KEY_STRING (planetObjectTemplate, "object/planet/planet.iff"); KEY_BOOL (javaConsoleDebugMessages, false); + KEY_BOOL (javaUseXcheck, false); KEY_BOOL (useVerboseJava, false); KEY_BOOL (logJavaGc, false); KEY_INT (javaLocalRefLimit, 16); diff --git a/engine/server/library/serverGame/src/shared/core/ConfigServerGame.h b/engine/server/library/serverGame/src/shared/core/ConfigServerGame.h index 0426f519..da4c6271 100755 --- a/engine/server/library/serverGame/src/shared/core/ConfigServerGame.h +++ b/engine/server/library/serverGame/src/shared/core/ConfigServerGame.h @@ -110,6 +110,7 @@ class ConfigServerGame int universeCheckFrequencySeconds; // how often to scan the resource tree for things that need to be spawned bool javaConsoleDebugMessages; + bool javaUseXcheck; bool useVerboseJava; bool logJavaGc; int javaLocalRefLimit; @@ -670,6 +671,7 @@ class ConfigServerGame static const int getUniverseCheckFrequencySeconds(void); static const bool getJavaConsoleDebugMessages (void); + static const bool getUseJavaXcheck (void); static const bool getUseVerboseJava (void); static const bool getLogJavaGc (void); @@ -1476,6 +1478,13 @@ inline const bool ConfigServerGame::getJavaConsoleDebugMessages() //----------------------------------------------------------------------- +inline const bool ConfigServerGame::getUseJavaXcheck() +{ + return data->javaUseXcheck; +} + +//----------------------------------------------------------------------- + inline const bool ConfigServerGame::getUseVerboseJava(void) { return data->useVerboseJava; diff --git a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp index 94cb02ff..f93d99b6 100755 --- a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp +++ b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp @@ -1168,17 +1168,18 @@ void JavaLibrary::initializeJavaThread() // java 1.8 and higher uses metaspace...which is apparently unlimited by default #if defined(JNI_VERSION_1_8) || defined(JNI_VERSION_1_9) - tempOption.optionString = "-XX:MetaspaceSize=512m"; + tempOption.optionString = "-XX:MetaspaceSize=128m"; options.push_back(tempOption); #endif -// these don't seem to play nice with java/JNI >= 7 -#if !defined(JNI_VERSION_1_9) && !defined(JNI_VERSION_1_8) && !defined(JNI_VERSION_1_7) tempOption.optionString = "-Xrs"; options.push_back(tempOption); - tempOption.optionString = "-Xcheck:jni"; - options.push_back(tempOption); -#endif + + if (ConfigServerGame::getUseJavaXcheck()) + { + tempOption.optionString = "-Xcheck:jni"; + options.push_back(tempOption); + } if (ConfigServerGame::getCompileScripts()) { From bf626d68e4b181101062eff7f0ff41c37c263b9e Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Fri, 19 Feb 2016 19:16:07 -0600 Subject: [PATCH 032/302] default trap script errors to false as they tend to crash the newer javas at the moment --- .../library/serverGame/src/shared/core/ConfigServerGame.cpp | 2 +- .../server/library/serverScript/src/shared/JavaLibrary.cpp | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/engine/server/library/serverGame/src/shared/core/ConfigServerGame.cpp b/engine/server/library/serverGame/src/shared/core/ConfigServerGame.cpp index 255af0e3..42400ead 100755 --- a/engine/server/library/serverGame/src/shared/core/ConfigServerGame.cpp +++ b/engine/server/library/serverGame/src/shared/core/ConfigServerGame.cpp @@ -67,7 +67,7 @@ void ConfigServerGame::install(void) KEY_BOOL (profileScripts, false); KEY_BOOL (crashOnScriptError, false); KEY_BOOL (compileScripts, false); - KEY_BOOL (trapScriptCrashes, true); + KEY_BOOL (trapScriptCrashes, false); //this seems to horrifyingly crash java 7/8 sometimes if not always KEY_INT (scriptWatcherWarnTime, 5000); KEY_INT (scriptWatcherInterruptTime, 5000); KEY_INT (scriptStackErrorLimit, 35); diff --git a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp index f93d99b6..67e9ee34 100755 --- a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp +++ b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp @@ -1331,7 +1331,6 @@ void JavaLibrary::initializeJavaThread() } ms_loaded = 1; -#if !defined(JNI_VERSION_1_9) && !defined(JNI_VERSION_1_8) && !defined(JNI_VERSION_1_7) && defined(linux) if (ConfigServerGame::getTrapScriptCrashes()) { //set up signal handler for fatals in linux @@ -1340,7 +1339,6 @@ void JavaLibrary::initializeJavaThread() OurSa.sa_flags = 0; IGNORE_RETURN(sigaction(SIGSEGV, &OurSa, &JavaSa)); } -#endif // wait until the main thread tells us to shutdown ms_shutdownJava->wait(); @@ -1349,15 +1347,11 @@ void JavaLibrary::initializeJavaThread() IGNORE_RETURN(ms_jvm->DestroyJavaVM()); ms_jvm = nullptr; -#if !defined(JNI_VERSION_1_9) && !defined(JNI_VERSION_1_8) && !defined(JNI_VERSION_1_7) && defined(linux) if (ConfigServerGame::getTrapScriptCrashes()) { // restore the default signal handler IGNORE_RETURN(sigaction(SIGSEGV, &OrgSa, NULL)); } -#endif - - #if defined(_WIN32) IGNORE_RETURN(FreeLibrary(static_cast(libHandle))); From 2a388362d63c9d74077c7878255f2a082c991682 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Tue, 23 Feb 2016 18:36:59 -0600 Subject: [PATCH 033/302] permgen was 64mb so we'll set that for metaspace too --- engine/server/library/serverScript/src/shared/JavaLibrary.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp index 67e9ee34..b2932622 100755 --- a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp +++ b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp @@ -1168,7 +1168,7 @@ void JavaLibrary::initializeJavaThread() // java 1.8 and higher uses metaspace...which is apparently unlimited by default #if defined(JNI_VERSION_1_8) || defined(JNI_VERSION_1_9) - tempOption.optionString = "-XX:MetaspaceSize=128m"; + tempOption.optionString = "-XX:MetaspaceSize=64m"; options.push_back(tempOption); #endif From b86eba889f7873c73e045e8ae72cf2c53ed660d6 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Tue, 23 Feb 2016 22:09:52 -0600 Subject: [PATCH 034/302] by messing with free memory and preallocating we break java 8...so we'll fix it --- .../sharedMemoryManager/src/shared/MemoryManager.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp b/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp index b6e10567..7044d04d 100755 --- a/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp +++ b/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp @@ -63,16 +63,16 @@ #define DO_TRACK 1 #define DO_SCALAR 1 #define DO_GUARDS 1 - #define DO_INITIALIZE_FILLS 1 - #define DO_FREE_FILLS 1 + #define DO_INITIALIZE_FILLS 0 + #define DO_FREE_FILLS 0 #elif DEBUG_LEVEL == DEBUG_LEVEL_OPTIMIZED #define DO_TRACK 1 #define DO_SCALAR 1 #define DO_GUARDS 1 - #define DO_INITIALIZE_FILLS 1 - #define DO_FREE_FILLS 1 + #define DO_INITIALIZE_FILLS 0 + #define DO_FREE_FILLS 0 #elif DEBUG_LEVEL == DEBUG_LEVEL_RELEASE From 65a79f2c07332c391aba28d5e983e2bf1b7c1aa6 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Wed, 24 Feb 2016 10:05:15 -0600 Subject: [PATCH 035/302] force memory manager to always run in production mode, thus reducing usage of memory, thus hopefully making it play nice with java 8 --- .../src/shared/MemoryManager.cpp | 94 +++---------------- 1 file changed, 13 insertions(+), 81 deletions(-) diff --git a/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp b/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp index 7044d04d..d8db6b31 100755 --- a/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp +++ b/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp @@ -34,66 +34,28 @@ #include #include -#ifdef _WIN32 +// the below seems to bare minimum cause the DB process to segfault +// too bad, if we weren't using an omnibus mem manager we could potentially maximize usage #define DISABLE_MEMORY_MANAGER 0 -#else -#define DISABLE_MEMORY_MANAGER 0 -#endif //lint -e826 // Suspicious pointer-to-pointer conversion (area too small) #if !DISABLE_MEMORY_MANAGER // ====================================================================== -// + +// this flag is different than above, as it doesn't fully disable the manager, only a few pieces +// including the destructor for some reason #define DISABLED 0 -#if PRODUCTION - - #define DO_TRACK 0 - #define DO_SCALAR 0 - #define DO_GUARDS 0 - #define DO_INITIALIZE_FILLS 0 - #define DO_FREE_FILLS 0 - -#else - - #if DEBUG_LEVEL == DEBUG_LEVEL_DEBUG - - #define DO_TRACK 1 - #define DO_SCALAR 1 - #define DO_GUARDS 1 - #define DO_INITIALIZE_FILLS 0 - #define DO_FREE_FILLS 0 - - #elif DEBUG_LEVEL == DEBUG_LEVEL_OPTIMIZED - - #define DO_TRACK 1 - #define DO_SCALAR 1 - #define DO_GUARDS 1 - #define DO_INITIALIZE_FILLS 0 - #define DO_FREE_FILLS 0 - - #elif DEBUG_LEVEL == DEBUG_LEVEL_RELEASE - - #define DO_TRACK 0 - #define DO_SCALAR 0 - #define DO_GUARDS 0 - #define DO_INITIALIZE_FILLS 0 - #define DO_FREE_FILLS 0 - - #else - - #error unknown DEBUG_LEVEL - - #endif - -#endif - -#ifdef PLATFORM_LINUX - #undef DO_TRACK - #define DO_TRACK 5 -#endif +// removed all the debug cases for these as these seem to cause problems +// recent modifications force the mem manager to always behave in production mode +// other areas will remain unaffected +#define DO_TRACK 0 +#define DO_SCALAR 0 +#define DO_GUARDS 0 +#define DO_INITIALIZE_FILLS 0 +#define DO_FREE_FILLS 0 // ====================================================================== @@ -261,14 +223,6 @@ namespace MemoryManagerNamespace int ms_numberOfSystemAllocations; int ms_systemMemoryAllocatedMegabytes; bool ms_reportAllocations; -// bool ms_logEachAlloc; - -#if PRODUCTION == 0 - PixCounter::ResetInteger ms_allocationsPerFrame; - PixCounter::ResetInteger ms_bytesAllocatedPerFrame; - PixCounter::ResetInteger ms_freesPerFrame; - PixCounter::ResetInteger ms_bytesFreedPerFrame; -#endif #ifdef _DEBUG bool ms_debugReportFlag; @@ -663,13 +617,6 @@ MemoryManager::~MemoryManager() return; #else -#if PRODUCTION == 0 - ms_allocationsPerFrame.disable(); - ms_bytesAllocatedPerFrame.disable(); - ms_freesPerFrame.disable(); - ms_bytesFreedPerFrame.disable(); -#endif - DEBUG_FATAL(!ms_installed, ("not installed")); ms_criticalSection->enter(); @@ -817,13 +764,6 @@ void MemoryManager::setReportAllocations(bool reportAllocations) void MemoryManager::registerDebugFlags() { -#if PRODUCTION == 0 - ms_allocationsPerFrame.bindToCounter("MemoryManagerAllocateCount"); - ms_bytesAllocatedPerFrame.bindToCounter("MemoryManagerAllocateBytes"); - ms_freesPerFrame.bindToCounter("MemoryManagerFreeCount"); - ms_bytesFreedPerFrame.bindToCounter("MemoryManagerFreeBytes"); -#endif - #ifdef _DEBUG DebugFlags::registerFlag(ms_debugReportFlag, "SharedMemoryManager", "reportMemory", debugReport); DebugFlags::registerFlag(ms_debugReportMapFlag, "SharedMemoryManager", "reportMemoryMap", debugReportMap); @@ -1206,11 +1146,6 @@ void * MemoryManager::allocate(size_t size, uint32 owner, bool array, bool leakT DEBUG_FATAL(!ms_installed, ("not installed")); -#if PRODUCTION == 0 - ++ms_allocationsPerFrame; - ms_bytesAllocatedPerFrame += size; -#endif - #ifdef _DEBUG if (ms_debugProfileAllocate) PROFILER_BLOCK_ENTER(ms_allocateProfilerBlock); @@ -1476,12 +1411,9 @@ void MemoryManager::free(void * userPointer, bool array) DEBUG_FATAL(allocatedBlock->isFree(), ("Freeing already free block %p", userPointer)); #endif -#if PRODUCTION == 0 - ++ms_freesPerFrame; #if DO_TRACK ms_bytesFreedPerFrame += allocatedBlock->getRequestedSize(); #endif -#endif #if DO_GUARDS { From 7e1c44fcbe71f95c7b39b7258f328b731464ed96 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Wed, 24 Feb 2016 10:45:31 -0600 Subject: [PATCH 036/302] this seems to stabilize things; if it does not we can try setting DO_GUARDS and the other flags back on one by one... --- .../sharedMemoryManager/src/shared/MemoryManager.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp b/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp index d8db6b31..920bd427 100755 --- a/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp +++ b/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp @@ -121,7 +121,7 @@ namespace MemoryManagerNamespace bool m_array:1; #endif #if DO_TRACK - bool m_leakTest:1; + bool m_leakTest:0; #endif #if DO_TRACK || DO_GUARDS unsigned int m_requestedSize:cms_requestedSizeBits; @@ -224,6 +224,11 @@ namespace MemoryManagerNamespace int ms_systemMemoryAllocatedMegabytes; bool ms_reportAllocations; + PixCounter::ResetInteger ms_allocationsPerFrame; + PixCounter::ResetInteger ms_bytesAllocatedPerFrame; + PixCounter::ResetInteger ms_freesPerFrame; + PixCounter::ResetInteger ms_bytesFreedPerFrame; + #ifdef _DEBUG bool ms_debugReportFlag; bool ms_debugReportMapFlag; From 1c1cf54a7b83742548fc6049fc6dbdd832c65603 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Wed, 24 Feb 2016 14:11:14 -0600 Subject: [PATCH 037/302] ensure release and debug build properly --- .../sharedMemoryManager/src/shared/MemoryManager.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp b/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp index 920bd427..4dd1138b 100755 --- a/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp +++ b/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp @@ -224,12 +224,12 @@ namespace MemoryManagerNamespace int ms_systemMemoryAllocatedMegabytes; bool ms_reportAllocations; - PixCounter::ResetInteger ms_allocationsPerFrame; - PixCounter::ResetInteger ms_bytesAllocatedPerFrame; - PixCounter::ResetInteger ms_freesPerFrame; - PixCounter::ResetInteger ms_bytesFreedPerFrame; - #ifdef _DEBUG + PixCounter::ResetInteger ms_allocationsPerFrame; + PixCounter::ResetInteger ms_bytesAllocatedPerFrame; + PixCounter::ResetInteger ms_freesPerFrame; + PixCounter::ResetInteger ms_bytesFreedPerFrame; + bool ms_debugReportFlag; bool ms_debugReportMapFlag; bool ms_debugReportAllocations; From 4093f2d0f41dc98afc5c4186b0fe1bbf10fbc926 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Fri, 26 Feb 2016 09:54:55 -0600 Subject: [PATCH 038/302] disable the memory manager entirely! - server scripts may load _slightly_ slower at least, visibly, but we don't crash this way --- .../src/shared/ConfigServerDatabase.cpp | 2 +- .../console/ConsoleCommandParserServer.cpp | 28 ------------------- .../src/shared/MemoryManager.cpp | 2 +- 3 files changed, 2 insertions(+), 30 deletions(-) diff --git a/engine/server/library/serverDatabase/src/shared/ConfigServerDatabase.cpp b/engine/server/library/serverDatabase/src/shared/ConfigServerDatabase.cpp index 2760bb31..a6bb553f 100755 --- a/engine/server/library/serverDatabase/src/shared/ConfigServerDatabase.cpp +++ b/engine/server/library/serverDatabase/src/shared/ConfigServerDatabase.cpp @@ -74,7 +74,7 @@ void ConfigServerDatabase::install(void) KEY_BOOL (enableLoadLocks, true); KEY_INT (databaseReconnectTime, 0); KEY_BOOL (logChunkLoading,false); - KEY_BOOL (useMemoryManagerForOCI,true); + KEY_BOOL (useMemoryManagerForOCI,false); KEY_INT (maxCharactersPerLoadRequest,10); KEY_INT (maxChunksPerLoadRequest,200); KEY_FLOAT (maxLoadStartDelay,300.0f); diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserServer.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserServer.cpp index c81f8966..247aec16 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserServer.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserServer.cpp @@ -439,34 +439,6 @@ bool ConsoleCommandParserServer::performParsing (const NetworkId & userId, const } result += Unicode::narrowToWide(pid.getValueString()); } - - //----------------------------------------------------------------- - else if (isAbbrev( argv[0], "memUsage")) - { - char text[256]; - sprintf(text, "Bytes: %lu Allocations: %d\n", MemoryManager::getCurrentNumberOfBytesAllocated(), MemoryManager::getCurrentNumberOfAllocations()); - - result += Unicode::narrowToWide(text); - result += getErrorMessage (argv[0], ERR_SUCCESS); - } - - //----------------------------------------------------------------- - else if (isAbbrev( argv[0], "memoryReport")) - { - MemoryManager::report(); - result += getErrorMessage (argv[0], ERR_SUCCESS); - } - - //----------------------------------------------------------------- - else if (isAbbrev( argv[0], "dumpMemToFile")) - { - std::string fileName(Unicode::wideToNarrow(argv[1])); - std::string leakStr(Unicode::wideToNarrow(argv[2])); - bool leak = (leakStr == "true" || leakStr == "1"); - - MemoryManager::reportToFile(fileName.c_str(), leak); - result += getErrorMessage (argv[0], ERR_SUCCESS); - } //----------------------------------------------------------------- else if (isAbbrev( argv[0], "clock")) diff --git a/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp b/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp index 4dd1138b..f58a1cc5 100755 --- a/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp +++ b/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp @@ -36,7 +36,7 @@ // the below seems to bare minimum cause the DB process to segfault // too bad, if we weren't using an omnibus mem manager we could potentially maximize usage -#define DISABLE_MEMORY_MANAGER 0 +#define DISABLE_MEMORY_MANAGER 1 //lint -e826 // Suspicious pointer-to-pointer conversion (area too small) From 8212c2a273136963aad7db318ad74c886d43b77f Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Fri, 26 Feb 2016 10:11:28 -0600 Subject: [PATCH 039/302] bump hard mem limit...may go up to 3072 --- .../library/sharedMemoryManager/src/shared/MemoryManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp b/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp index f58a1cc5..aa401be2 100755 --- a/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp +++ b/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp @@ -2039,7 +2039,7 @@ void MemoryManager::setLimit(int, bool, bool) int MemoryManager::getLimit() { - return 768; + return 2048; } // ---------------------------------------------------------------------- From 5a2f6b8af017e5c3b70466a32bb51247050e38a7 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Fri, 26 Feb 2016 10:59:51 -0600 Subject: [PATCH 040/302] consistency --- .../library/sharedMemoryManager/src/shared/MemoryManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp b/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp index aa401be2..58b65a60 100755 --- a/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp +++ b/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp @@ -2039,7 +2039,7 @@ void MemoryManager::setLimit(int, bool, bool) int MemoryManager::getLimit() { - return 2048; + return 3072; } // ---------------------------------------------------------------------- From 519be81acc6684e9be9d25bb5590cbe294e49022 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Thu, 3 Mar 2016 11:19:23 -0600 Subject: [PATCH 041/302] Revert f1c197e700e726d768006f0e91b4ecceaa5bb7eb and fix our crash issue...this is silly --- external/ours/library/archive/src/shared/AutoDeltaSet.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/external/ours/library/archive/src/shared/AutoDeltaSet.h b/external/ours/library/archive/src/shared/AutoDeltaSet.h index 9f64da22..e413c21e 100644 --- a/external/ours/library/archive/src/shared/AutoDeltaSet.h +++ b/external/ours/library/archive/src/shared/AutoDeltaSet.h @@ -184,6 +184,12 @@ inline typename AutoDeltaSet::const_iterator AutoDeltaSet m_commands.push_back(c); ++m_baselineCommandCount; + // hack to convert from const_iterator to iterator as required by std libs + typename SetType::iterator tmp(m_set.begin()); + std::advance(tmp, std::distance(tmp, i)); + i++; + m_set.erase(tmp); + touch(); onErase(c.value); onChanged(); From 52dbee2c86c0c33b14e0034780bfe502184e49bc Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Thu, 3 Mar 2016 11:37:21 -0600 Subject: [PATCH 042/302] report cluster status in debug and release mode --- .../server/application/LoginServer/src/shared/LoginServer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/server/application/LoginServer/src/shared/LoginServer.cpp b/engine/server/application/LoginServer/src/shared/LoginServer.cpp index 759331b4..72201382 100755 --- a/engine/server/application/LoginServer/src/shared/LoginServer.cpp +++ b/engine/server/application/LoginServer/src/shared/LoginServer.cpp @@ -492,7 +492,7 @@ void LoginServer::receiveMessage(const MessageDispatch::Emitter & source, const { if (msg.getFinished()) { - DEBUG_REPORT_LOG(true, ("Cluster %s is ready for players.\n",cle->m_clusterName.c_str())); + REPORT_LOG(true, ("Cluster %s is ready for players.\n",cle->m_clusterName.c_str())); if (!cle->m_readyForPlayers) { cle->m_readyForPlayers = true; @@ -501,7 +501,7 @@ void LoginServer::receiveMessage(const MessageDispatch::Emitter & source, const } else { - DEBUG_REPORT_LOG(true, ("Cluster %s is not ready for players.\n",cle->m_clusterName.c_str())); + REPORT_LOG(true, ("Cluster %s is not ready for players.\n",cle->m_clusterName.c_str())); if (cle->m_readyForPlayers) { cle->m_readyForPlayers = false; From 43fd155bacb0271d356a643b7900644ac7208877 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Thu, 3 Mar 2016 12:00:01 -0600 Subject: [PATCH 043/302] hide some more spam in release mode --- .../serverGame/src/shared/controller/AiCreatureController.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/server/library/serverGame/src/shared/controller/AiCreatureController.cpp b/engine/server/library/serverGame/src/shared/controller/AiCreatureController.cpp index 14425612..3bea36b0 100755 --- a/engine/server/library/serverGame/src/shared/controller/AiCreatureController.cpp +++ b/engine/server/library/serverGame/src/shared/controller/AiCreatureController.cpp @@ -2470,7 +2470,7 @@ NetworkId AICreatureController::getUnarmedWeapon() } else { - WARNING(true, ("AICreatureController::getUnarmedWeapon() Unable to find a default weapon for (%s)", getDebugInformation().c_str())); + DEBUG_WARNING(true, ("AICreatureController::getUnarmedWeapon() Unable to find a default weapon for (%s)", getDebugInformation().c_str())); } return result; From 75f26325ff96ec0aebb7e0e1c94300756a6f67bd Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Mon, 7 Mar 2016 10:41:26 -0600 Subject: [PATCH 044/302] i tested this, yes they are --- engine/shared/library/sharedMath/src/shared/SetupSharedMath.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/engine/shared/library/sharedMath/src/shared/SetupSharedMath.cpp b/engine/shared/library/sharedMath/src/shared/SetupSharedMath.cpp index eb4de955..df9e3018 100755 --- a/engine/shared/library/sharedMath/src/shared/SetupSharedMath.cpp +++ b/engine/shared/library/sharedMath/src/shared/SetupSharedMath.cpp @@ -28,7 +28,6 @@ void SetupSharedMath::install() PaletteArgb::install(); PaletteArgbList::install(); - // @todo don't bother installing this on the servers; it's unnecessary. CompressedQuaternion::install(); Transform::install(); } From b4e6224ce73a1b3024e5ff8aef34a442abccda47 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Fri, 11 Mar 2016 23:01:27 -0600 Subject: [PATCH 045/302] hacky but improves debugging output - may need some format cleanups (extra newline at end?) - gives us function, file, and line # for warnings and fatals --- .../commoditiesMarket/CommoditiesMarket.cpp | 54 +++++++++---------- .../sharedFoundation/src/shared/Fatal.cpp | 10 ++-- .../sharedFoundation/src/shared/Fatal.h | 18 ++++--- 3 files changed, 44 insertions(+), 38 deletions(-) diff --git a/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesMarket.cpp b/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesMarket.cpp index 7529726f..fbc7b761 100755 --- a/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesMarket.cpp +++ b/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesMarket.cpp @@ -653,7 +653,7 @@ static void transferBank(const NetworkId &source, const NetworkId &dest, int32 a } else { -// printf("Transfering %i bank from %Ld to %Ld\n", (int)amount, source.getValue(), dest.getValue()); +// printf("Transfering %i bank from %Ld to %Ld", (int)amount, source.getValue(), dest.getValue()); char buf[100]; sprintf(buf, "%Ld %Ld", (int64)dest.getValue(), (int64)amount); MessageToQueue::getInstance().sendMessageToC(source, "C++ModifyBank", buf, 0, true); @@ -1102,7 +1102,7 @@ void CommoditiesMarket::install() if (!ConfigServerGame::getCommoditiesMarketEnabled()) return; - FATAL(s_market, ("CommoditiesMarket already installed.\n")); + FATAL(s_market, ("CommoditiesMarket already installed.")); getCommoditiesServerConnection(); time_t t = time(0); @@ -1112,7 +1112,7 @@ void CommoditiesMarket::install() } else { - DEBUG_WARNING(true, ("[Commodities API] : No commodities server connection to send SetGameTime.\n")); + DEBUG_WARNING(true, ("[Commodities API] : No commodities server connection to send SetGameTime.")); getCommoditiesServerConnection(); //attempt to reconnect to commodities server } @@ -1127,7 +1127,7 @@ void CommoditiesMarket::remove() if (!ConfigServerGame::getCommoditiesMarketEnabled()) return; - //FATAL(!s_market, ("CommoditiesMarket not installed.\n")); + //FATAL(!s_market, ("CommoditiesMarket not installed.")); try { s_market = 0; @@ -1181,7 +1181,7 @@ void CommoditiesMarket::giveTime() if (Clock::timeSeconds() - ConfigServerGame::getCommoditiesServerReconnectIntervalSec() > reconnectTime) { - DEBUG_WARNING(true, ("[Commodities API] : No commodities server connection to send GiveTime.\n")); + DEBUG_WARNING(true, ("[Commodities API] : No commodities server connection to send GiveTime.")); getCommoditiesServerConnection(); //attempt to reconnect to commodities server reconnectTime = Clock::timeSeconds(); @@ -1393,7 +1393,7 @@ void CommoditiesMarket::onAddAuction(int sequence, int32 result, const NetworkId } else { - DEBUG_WARNING(true, ("[Commodities API] : No commodities server connection to send CancelAuction.\n")); + DEBUG_WARNING(true, ("[Commodities API] : No commodities server connection to send CancelAuction.")); getCommoditiesServerConnection(); //attempt to reconnect to commodities server } } @@ -1509,7 +1509,7 @@ void CommoditiesMarket::auctionCreate(CreatureObject &owner, ServerObject &item, } else { - DEBUG_WARNING(true, ("[Commodities API] : No commodities server connection to send AddAuction.\n")); + DEBUG_WARNING(true, ("[Commodities API] : No commodities server connection to send AddAuction.")); getCommoditiesServerConnection(); //attempt to reconnect to commodities server } @@ -1581,7 +1581,7 @@ void CommoditiesMarket::transferVendorItemFromStockroom(CreatureObject &owner, N else { - DEBUG_WARNING(true, ("[Commodities API] : No commodities server connection to send AddImmediateAuction.\n")); + DEBUG_WARNING(true, ("[Commodities API] : No commodities server connection to send AddImmediateAuction.")); getCommoditiesServerConnection(); //attempt to reconnect to commodities server } @@ -1756,7 +1756,7 @@ void CommoditiesMarket::auctionCreateImmediate(CreatureObject &owner, ServerObje else { - DEBUG_WARNING(true, ("[Commodities API] : No commodities server connection to send AddImmediateAuction.\n")); + DEBUG_WARNING(true, ("[Commodities API] : No commodities server connection to send AddImmediateAuction.")); getCommoditiesServerConnection(); //attempt to reconnect to commodities server } @@ -1828,7 +1828,7 @@ void CommoditiesMarket::auctionCreatePermanent(const std::string &, const Server else { - DEBUG_WARNING(true, ("[Commodities API] : No commodities server connection to send AddImmediateAuction.\n")); + DEBUG_WARNING(true, ("[Commodities API] : No commodities server connection to send AddImmediateAuction.")); getCommoditiesServerConnection(); //attempt to reconnect to commodities server } @@ -1892,7 +1892,7 @@ void CommoditiesMarket::auctionBid(CreatureObject &bidder, AuctionId auctionId, else { - DEBUG_WARNING(true, ("[Commodities API] : No commodities server connection to send AddBid.\n")); + DEBUG_WARNING(true, ("[Commodities API] : No commodities server connection to send AddBid.")); getCommoditiesServerConnection(); //attempt to reconnect to commodities server } @@ -1931,7 +1931,7 @@ void CommoditiesMarket::auctionCancel(const NetworkId &playerId, AuctionId aucti else { - DEBUG_WARNING(true, ("[Commodities API] : No commodities server connection to send CancelAuction.\n")); + DEBUG_WARNING(true, ("[Commodities API] : No commodities server connection to send CancelAuction.")); getCommoditiesServerConnection(); //attempt to reconnect to commodities server } @@ -1956,7 +1956,7 @@ void CommoditiesMarket::auctionAccept(CreatureObject &who, AuctionId auctionId) } else { - WARNING(true, ("[Commodities API] : No commodities server connection to send AcceptHighBid.\n")); + WARNING(true, ("[Commodities API] : No commodities server connection to send AcceptHighBid.")); getCommoditiesServerConnection(); //attempt to reconnect to commodities server } */ @@ -2066,7 +2066,7 @@ void CommoditiesMarket::auctionQueryHeaders( vendorId = zeroNetworkId; else vendorId = vendorObject->getNetworkId(); - DEBUG_REPORT_LOG(true, (" [AuctionQueryHeadersMessage]: container = %s, vendorId = %s\n", container.getValueString().c_str(), vendorId.getValueString().c_str())); + DEBUG_REPORT_LOG(true, (" [AuctionQueryHeadersMessage]: container = %s, vendorId = %s", container.getValueString().c_str(), vendorId.getValueString().c_str())); std::string searchStringPlanet; std::string searchStringRegion; @@ -2101,7 +2101,7 @@ void CommoditiesMarket::auctionQueryHeaders( else { - DEBUG_WARNING(true, ("[Commodities API] : No commodities server connection to send QueryAuctionHeaders.\n")); + DEBUG_WARNING(true, ("[Commodities API] : No commodities server connection to send QueryAuctionHeaders.")); getCommoditiesServerConnection(); //attempt to reconnect to commodities server } @@ -2153,7 +2153,7 @@ void CommoditiesMarket::getAuctionDetails(CreatureObject &who, const NetworkId & else { - DEBUG_WARNING(true, ("[Commodities API] : No commodities server connection to send GetItemDetails.\n")); + DEBUG_WARNING(true, ("[Commodities API] : No commodities server connection to send GetItemDetails.")); getCommoditiesServerConnection(); //attempt to reconnect to commodities server } @@ -2170,7 +2170,7 @@ void CommoditiesMarket::getVendorValue(ServerObject &container) } else { - DEBUG_WARNING(true, ("[Commodities API] : No commodities server connection to send GetVendorValue.\n")); + DEBUG_WARNING(true, ("[Commodities API] : No commodities server connection to send GetVendorValue.")); getCommoditiesServerConnection(); //attempt to reconnect to commodities server } @@ -2189,7 +2189,7 @@ void CommoditiesMarket::createVendorMarket(const CreatureObject &who, ServerObje } else { - DEBUG_WARNING(true, ("[Commodities API] : No commodities server connection to send CreateVendorMarket.\n")); + DEBUG_WARNING(true, ("[Commodities API] : No commodities server connection to send CreateVendorMarket.")); getCommoditiesServerConnection(); //attempt to reconnect to commodities server } @@ -2213,7 +2213,7 @@ void CommoditiesMarket::destroyVendorMarket(const NetworkId &playerId, ServerObj else { - DEBUG_WARNING(true, ("[Commodities API] : No commodities server connection to send DestroyVendorMarket.\n")); + DEBUG_WARNING(true, ("[Commodities API] : No commodities server connection to send DestroyVendorMarket.")); getCommoditiesServerConnection(); //attempt to reconnect to commodities server } @@ -2232,7 +2232,7 @@ void CommoditiesMarket::deleteAuctionLocation(const NetworkId& locationId, const } else { - DEBUG_WARNING(true, ("[Commodities API] : No commodities server connection to send DestroyVendorMarket.\n")); + DEBUG_WARNING(true, ("[Commodities API] : No commodities server connection to send DestroyVendorMarket.")); getCommoditiesServerConnection(); //attempt to reconnect to commodities server } @@ -2254,7 +2254,7 @@ void CommoditiesMarket::isVendorOwner(CreatureObject &who, const NetworkId &cont else { - DEBUG_WARNING(true, ("[Commodities API] : No commodities server connection to send GetVendorOwner.\n")); + DEBUG_WARNING(true, ("[Commodities API] : No commodities server connection to send GetVendorOwner.")); onIsVendorOwner(who.getNetworkId(), zeroNetworkId, zeroNetworkId); getCommoditiesServerConnection(); //attempt to reconnect to commodities server @@ -2558,7 +2558,7 @@ void CommoditiesMarket::checkPendingLoads(const NetworkId &itemId) } else { - DEBUG_WARNING(true, ("[Commodities API] : No commodities server connection to send GetItem.\n")); + DEBUG_WARNING(true, ("[Commodities API] : No commodities server connection to send GetItem.")); getCommoditiesServerConnection(); //attempt to reconnect to commodities server } @@ -2585,7 +2585,7 @@ void CommoditiesMarket::checkPendingLoads(const NetworkId &itemId) } else { - DEBUG_WARNING(true, ("[Commodities API] : No commodities server connection to send CleanupInvalidItemRetrieval.\n")); + DEBUG_WARNING(true, ("[Commodities API] : No commodities server connection to send CleanupInvalidItemRetrieval.")); getCommoditiesServerConnection(); //attempt to reconnect to commodities server } @@ -3007,7 +3007,7 @@ void CommoditiesMarket::onGetItemDetailsReply(int32 result, int32 requestId, Net static const std::string attributeClientSharedTemplateName("ClientSharedTemplateName"); static const std::string attributeAppearanceData("AppearanceData"); - DEBUG_REPORT_LOG(true,("Attribute: %s, %s\n",i->first.c_str(),Unicode::wideToNarrow(i->second).c_str())); + DEBUG_REPORT_LOG(true,("Attribute: %s, %s",i->first.c_str(),Unicode::wideToNarrow(i->second).c_str())); if (i->first==attributeClientSharedTemplateName) details.templateName = Unicode::wideToNarrow(i->second); @@ -3265,7 +3265,7 @@ void CommoditiesMarket::setSalesTax( int32 salesTax, const NetworkId &bankId, Se } else { - WARNING(true, ("[Commodities API] : No commodities server connection to send SetSalesTax.\n")); + WARNING(true, ("[Commodities API] : No commodities server connection to send SetSalesTax.")); getCommoditiesServerConnection(); //attempt to reconnect to commodities server } } @@ -3399,12 +3399,12 @@ bool CommoditiesMarket::restoreItem(ServerObject& item, TangibleObject & vendor) } else { - WARNING(true, ("[Commodities API] : Could not create Owner object in restore item.\n")); + WARNING(true, ("[Commodities API] : Could not create Owner object in restore item.")); } } else { - DEBUG_WARNING(true, ("[Commodities API] : No commodities server connection to send AddImmediateAuction.\n")); + DEBUG_WARNING(true, ("[Commodities API] : No commodities server connection to send AddImmediateAuction.")); getCommoditiesServerConnection(); //attempt to reconnect to commodities server diff --git a/engine/shared/library/sharedFoundation/src/shared/Fatal.cpp b/engine/shared/library/sharedFoundation/src/shared/Fatal.cpp index 37a3884f..c684c6e4 100755 --- a/engine/shared/library/sharedFoundation/src/shared/Fatal.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/Fatal.cpp @@ -80,13 +80,13 @@ static void formatMessage(char *buffer, int bufferLength, int stackDepth, const char file[4 * 1024] = { '\0' }; int line = 0; if (ConfigSharedFoundation::getLookUpCallStackNames() && DebugHelp::lookupAddress(callStack[callStackOffset], lib, file, sizeof(file), line)) - snprintf(buffer, bufferLength, "%s(%d) : %s %08x: ", file, line, type, static_cast(Crc::calculate(format))); + snprintf(buffer, bufferLength, "%s(%d) : %s %08x: \n", file, line, type, static_cast(Crc::calculate(format))); else - snprintf(buffer, bufferLength, "unknown(0x%08X) : %s %08x: ", static_cast(callStack[callStackOffset]), type, static_cast(Crc::calculate(format))); + snprintf(buffer, bufferLength, "(0x%08X) : %s %08x: \n", static_cast(callStack[callStackOffset]), type, static_cast(Crc::calculate(format))); } else { - snprintf(buffer, bufferLength, "unknown location : %s %08x: ", type, static_cast(Crc::calculate(format))); + snprintf(buffer, bufferLength, " (%08x): ", static_cast(Crc::calculate(format))); } { @@ -124,9 +124,9 @@ static void formatMessage(char *buffer, int bufferLength, int stackDepth, const int line = 0; if (ConfigSharedFoundation::getLookUpCallStackNames() && DebugHelp::lookupAddress(callStack[i], lib, file, sizeof(file), line)) - snprintf(buffer, bufferLength, " %s(%d) : caller %d\n", file, line, i-callStackOffset); + snprintf(buffer, bufferLength, " %s(%d) : caller %d\n", file, line, i-callStackOffset); else - snprintf(buffer, bufferLength, " unknown(0x%08X) : caller %d\n", static_cast(callStack[i]), i-callStackOffset); + snprintf(buffer, bufferLength, " (0x%08X) : caller %d\n", static_cast(callStack[i]), i-callStackOffset); const int length = strlen(buffer); buffer += length; diff --git a/engine/shared/library/sharedFoundation/src/shared/Fatal.h b/engine/shared/library/sharedFoundation/src/shared/Fatal.h index 14215b90..378992c6 100755 --- a/engine/shared/library/sharedFoundation/src/shared/Fatal.h +++ b/engine/shared/library/sharedFoundation/src/shared/Fatal.h @@ -33,22 +33,28 @@ void SetWarningCallback(WarningCallback); // ====================================================================== -#define FATAL(a, b) ((a) ? Fatal b : NOP) #ifdef _DEBUG - #define DEBUG_FATAL(a, b) ((a) ? DebugFatal b : NOP) + #define LINEINFO(a) fprintf(stderr, "\n%s in %s() file %s:%d \n", a, __FUNCTION__, __FILE__ , __LINE__) +#else + #define LINEINFO(a) fprintf(stderr, "%s: ", a) +#endif + +#define FATAL(a, b) ((a) ? LINEINFO("FATAL"), Fatal b : NOP) +#ifdef _DEBUG + #define DEBUG_FATAL(a, b) ((a) ? LINEINFO("FATAL"), DebugFatal b : NOP) #else #define DEBUG_FATAL(a, b) NOP #endif -#define WARNING(a, b) ((a) ? Warning b : NOP) -#define WARNING_STACK_DEPTH(a, b) ((a) ? WarningStackDepth b : NOP) +#define WARNING(a, b) ((a) ? LINEINFO("WARNING"), Warning b : NOP) +#define WARNING_STACK_DEPTH(a, b) ((a) ? LINEINFO("WARNING"), WarningStackDepth b : NOP) #ifdef _DEBUG #define DEBUG_WARNING(a, b) WARNING(a, b) #else #define DEBUG_WARNING(a, b) NOP #endif -#define CONSOLE_WARNING(a, b) ((a) ? ConsoleWarning b : NOP) +#define CONSOLE_WARNING(a, b) ((a) ? LINEINFO("WARNING"), ConsoleWarning b : NOP) #ifdef _DEBUG #define DEBUG_CONSOLE_WARNING(a, b) CONSOLE_WARNING(a, b) #else @@ -61,7 +67,7 @@ void SetWarningCallback(WarningCallback); #define WARNING_DEBUG_FATAL(a, b) WARNING(a, b) #endif -#define WARNING_STRICT_FATAL(a, b) ((a) ? WarningStrictFatal b : NOP) +#define WARNING_STRICT_FATAL(a, b) ((a) ? LINEINFO("FATAL"), WarningStrictFatal b : NOP) #ifdef _DEBUG From 89f2b55420b5b043c8806a793fe5de51a17b52a6 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Fri, 11 Mar 2016 23:06:19 -0600 Subject: [PATCH 046/302] more clear descriptions of the macros being called --- engine/shared/library/sharedFoundation/src/shared/Fatal.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/shared/library/sharedFoundation/src/shared/Fatal.h b/engine/shared/library/sharedFoundation/src/shared/Fatal.h index 378992c6..53f11159 100755 --- a/engine/shared/library/sharedFoundation/src/shared/Fatal.h +++ b/engine/shared/library/sharedFoundation/src/shared/Fatal.h @@ -41,7 +41,7 @@ void SetWarningCallback(WarningCallback); #define FATAL(a, b) ((a) ? LINEINFO("FATAL"), Fatal b : NOP) #ifdef _DEBUG - #define DEBUG_FATAL(a, b) ((a) ? LINEINFO("FATAL"), DebugFatal b : NOP) + #define DEBUG_FATAL(a, b) ((a) ? LINEINFO("DEBUG FATAL"), DebugFatal b : NOP) #else #define DEBUG_FATAL(a, b) NOP #endif @@ -67,7 +67,7 @@ void SetWarningCallback(WarningCallback); #define WARNING_DEBUG_FATAL(a, b) WARNING(a, b) #endif -#define WARNING_STRICT_FATAL(a, b) ((a) ? LINEINFO("FATAL"), WarningStrictFatal b : NOP) +#define WARNING_STRICT_FATAL(a, b) ((a) ? LINEINFO("WARNING STRICT FATAL"), WarningStrictFatal b : NOP) #ifdef _DEBUG From 501ba0b0f4e363756e809f6a33e886da7294930d Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Thu, 24 Mar 2016 16:05:08 +0000 Subject: [PATCH 047/302] remove unused field; cleanup a dumb definition --- .../ATGenericAPI/GenericConnection.h | 1 - .../sharedTemplateDefinition/src/shared/core/Filename.cpp | 7 ++----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericConnection.h b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericConnection.h index 28852377..f9b23586 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericConnection.h +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericConnection.h @@ -75,7 +75,6 @@ private: TcpConnection *m_con; std::string m_host; short m_port; - unsigned m_lastTrack; eConState m_conState; time_t m_conTimeout; unsigned m_reconnectTimeout; diff --git a/engine/shared/library/sharedTemplateDefinition/src/shared/core/Filename.cpp b/engine/shared/library/sharedTemplateDefinition/src/shared/core/Filename.cpp index 11a945eb..73a1844d 100755 --- a/engine/shared/library/sharedTemplateDefinition/src/shared/core/Filename.cpp +++ b/engine/shared/library/sharedTemplateDefinition/src/shared/core/Filename.cpp @@ -19,13 +19,10 @@ #include -const char WIN32_PATH_SEPARATOR = '\\'; -const char LINUX_PATH_SEPARATOR = '/'; - #if defined(WIN32) -const char PATH_SEPARATOR = WIN32_PATH_SEPARATOR; +const char PATH_SEPARATOR = '\\'; #elif defined(linux) -const char PATH_SEPARATOR = LINUX_PATH_SEPARATOR; +const char PATH_SEPARATOR = '/'; #else #error unknown OS #endif From 63494a4dec2f7c48e3afc272e2f9083b4d2b8e68 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Thu, 24 Mar 2016 16:14:21 +0000 Subject: [PATCH 048/302] remove the rest of the temporary fix --- .../ATGenericAPI/GenericConnection.cpp | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericConnection.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericConnection.cpp index 8abb0dff..11571d48 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericConnection.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericConnection.cpp @@ -28,7 +28,6 @@ GenericConnection::GenericConnection(const char *host, short port, GenericAPICor m_con(nullptr), m_host(host), m_port(port), - m_lastTrack(123455), //random choice != 1 m_conState(CON_DISCONNECT), m_reconnectTimeout(reconnectTimeout) { @@ -95,22 +94,6 @@ void GenericConnection::OnRoutePacket(TcpConnection *, const unsigned char *data get(iter, track); GenericResponse *res = nullptr; - // the following if block is a temporary fix that prevents - // a crash with a game team in which they occasionally find - // themselves receiving a dupe track in consecutive calls to - // OnRoutePacket (which then leads to a callback being called - // twice and data being invalid on the second call -> crash!). - // TODO: resolve this BK -/* if (track != 0 && - track == m_lastTrack) - { - printf("!!! ERROR !!! Got a duplicate track ID %u\n", track); - return; - } - m_lastTrack = track; -*/ - // end temporary fix. - if(track == 0) // notification message from the server, not as a response to a request from this API { if (type == ATGAME_REQUEST_CONNECT) From 1e2bf250f982e794e20b9cea7ed4dc0fc5ef270f Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Thu, 24 Mar 2016 16:39:57 +0000 Subject: [PATCH 049/302] remove unused var --- .../application/SwgGameServer/src/shared/combat/CombatEngine.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/game/server/application/SwgGameServer/src/shared/combat/CombatEngine.cpp b/game/server/application/SwgGameServer/src/shared/combat/CombatEngine.cpp index 4f4269cd..b343cf6f 100755 --- a/game/server/application/SwgGameServer/src/shared/combat/CombatEngine.cpp +++ b/game/server/application/SwgGameServer/src/shared/combat/CombatEngine.cpp @@ -680,7 +680,6 @@ void CombatEngine::alter(TangibleObject & object) if (object.isAuthoritative()) { // if the object is a creature, get it's attributes - Attributes::Value currentAttribs[Attributes::NumberOfAttributes]; CreatureObject * const critter = object.asCreatureObject (); if (critter != nullptr) { From fe8b531b42e3e30e5d4dd079b357e2a2607a49e9 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Thu, 24 Mar 2016 16:53:59 +0000 Subject: [PATCH 050/302] remove all the set but not used testDataValue warnings - coan is a great tool! http://coan2.sourceforge.net/ --- .../SharedBattlefieldMarkerObjectTemplate.cpp | 121 +-- .../SharedBattlefieldMarkerObjectTemplate.h | 17 +- .../SharedBuildingObjectTemplate.cpp | 49 +- .../SharedBuildingObjectTemplate.h | 9 +- .../SharedCellObjectTemplate.cpp | 13 +- .../objectTemplate/SharedCellObjectTemplate.h | 5 - ...aredConstructionContractObjectTemplate.cpp | 13 +- ...SharedConstructionContractObjectTemplate.h | 5 - .../SharedCreatureObjectTemplate.cpp | 757 ++---------------- .../SharedCreatureObjectTemplate.h | 89 +- .../SharedDraftSchematicObjectTemplate.cpp | 172 +--- .../SharedDraftSchematicObjectTemplate.h | 31 +- .../SharedFactoryObjectTemplate.cpp | 13 +- .../SharedFactoryObjectTemplate.h | 5 - .../SharedGroupObjectTemplate.cpp | 13 +- .../SharedGroupObjectTemplate.h | 5 - .../SharedGuildObjectTemplate.cpp | 13 +- .../SharedGuildObjectTemplate.h | 5 - .../SharedInstallationObjectTemplate.cpp | 13 +- .../SharedInstallationObjectTemplate.h | 5 - .../SharedIntangibleObjectTemplate.cpp | 13 +- .../SharedIntangibleObjectTemplate.h | 5 - .../SharedJediManagerObjectTemplate.cpp | 15 +- .../SharedJediManagerObjectTemplate.h | 5 - ...aredManufactureSchematicObjectTemplate.cpp | 13 +- ...SharedManufactureSchematicObjectTemplate.h | 5 - .../SharedMissionObjectTemplate.cpp | 13 +- .../SharedMissionObjectTemplate.h | 5 - .../objectTemplate/SharedObjectTemplate.cpp | 618 ++------------ .../objectTemplate/SharedObjectTemplate.h | 73 +- .../SharedPlayerObjectTemplate.cpp | 15 +- .../SharedPlayerObjectTemplate.h | 5 - .../SharedPlayerQuestObjectTemplate.cpp | 15 +- .../SharedPlayerQuestObjectTemplate.h | 5 - .../SharedResourceContainerObjectTemplate.cpp | 13 +- .../SharedResourceContainerObjectTemplate.h | 5 - .../SharedShipObjectTemplate.cpp | 87 +- .../objectTemplate/SharedShipObjectTemplate.h | 13 +- .../SharedStaticObjectTemplate.cpp | 13 +- .../SharedStaticObjectTemplate.h | 5 - .../SharedTangibleObjectTemplate.cpp | 465 ++--------- .../SharedTangibleObjectTemplate.h | 71 +- .../SharedTerrainSurfaceObjectTemplate.cpp | 93 +-- .../SharedTerrainSurfaceObjectTemplate.h | 13 +- .../SharedUniverseObjectTemplate.cpp | 15 +- .../SharedUniverseObjectTemplate.h | 5 - .../SharedVehicleObjectTemplate.cpp | 331 +------- .../SharedVehicleObjectTemplate.h | 41 +- .../SharedWaypointObjectTemplate.cpp | 13 +- .../SharedWaypointObjectTemplate.h | 5 - .../SharedWeaponObjectTemplate.cpp | 102 +-- .../SharedWeaponObjectTemplate.h | 15 +- 52 files changed, 497 insertions(+), 2966 deletions(-) diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBattlefieldMarkerObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBattlefieldMarkerObjectTemplate.cpp index a83d8b7f..5219f6c2 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBattlefieldMarkerObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBattlefieldMarkerObjectTemplate.cpp @@ -12,7 +12,7 @@ #include "sharedGame/FirstSharedGame.h" #include "SharedBattlefieldMarkerObjectTemplate.h" -#include "sharedDebug/DataLint.h" + #include "sharedFile/Iff.h" #include "sharedMath/Vector.h" #include "sharedObject/ObjectTemplate.h" @@ -104,22 +104,14 @@ Tag SharedBattlefieldMarkerObjectTemplate::getHighestTemplateVersion(void) const } // SharedBattlefieldMarkerObjectTemplate::getHighestTemplateVersion //@BEGIN TFD -int SharedBattlefieldMarkerObjectTemplate::getNumberOfPoles(bool testData) const +int SharedBattlefieldMarkerObjectTemplate::getNumberOfPoles() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const SharedBattlefieldMarkerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getNumberOfPoles(true); -#endif } if (!m_numberOfPoles.isLoaded()) @@ -159,31 +151,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedBattlefieldMarkerObjectTemplate::getNumberOfPoles -int SharedBattlefieldMarkerObjectTemplate::getNumberOfPolesMin(bool testData) const +int SharedBattlefieldMarkerObjectTemplate::getNumberOfPolesMin() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const SharedBattlefieldMarkerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getNumberOfPolesMin(true); -#endif } if (!m_numberOfPoles.isLoaded()) @@ -223,31 +202,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedBattlefieldMarkerObjectTemplate::getNumberOfPolesMin -int SharedBattlefieldMarkerObjectTemplate::getNumberOfPolesMax(bool testData) const +int SharedBattlefieldMarkerObjectTemplate::getNumberOfPolesMax() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const SharedBattlefieldMarkerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getNumberOfPolesMax(true); -#endif } if (!m_numberOfPoles.isLoaded()) @@ -287,31 +253,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedBattlefieldMarkerObjectTemplate::getNumberOfPolesMax -float SharedBattlefieldMarkerObjectTemplate::getRadius(bool testData) const +float SharedBattlefieldMarkerObjectTemplate::getRadius() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedBattlefieldMarkerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getRadius(true); -#endif } if (!m_radius.isLoaded()) @@ -351,31 +304,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedBattlefieldMarkerObjectTemplate::getRadius -float SharedBattlefieldMarkerObjectTemplate::getRadiusMin(bool testData) const +float SharedBattlefieldMarkerObjectTemplate::getRadiusMin() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedBattlefieldMarkerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getRadiusMin(true); -#endif } if (!m_radius.isLoaded()) @@ -415,31 +355,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedBattlefieldMarkerObjectTemplate::getRadiusMin -float SharedBattlefieldMarkerObjectTemplate::getRadiusMax(bool testData) const +float SharedBattlefieldMarkerObjectTemplate::getRadiusMax() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedBattlefieldMarkerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getRadiusMax(true); -#endif } if (!m_radius.isLoaded()) @@ -479,28 +406,10 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedBattlefieldMarkerObjectTemplate::getRadiusMax -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void SharedBattlefieldMarkerObjectTemplate::testValues(void) const -{ - IGNORE_RETURN(getNumberOfPolesMin(true)); - IGNORE_RETURN(getNumberOfPolesMax(true)); - IGNORE_RETURN(getRadiusMin(true)); - IGNORE_RETURN(getRadiusMax(true)); - SharedTangibleObjectTemplate::testValues(); -} // SharedBattlefieldMarkerObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -543,8 +452,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,1)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBattlefieldMarkerObjectTemplate.h b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBattlefieldMarkerObjectTemplate.h index 29672636..52200959 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBattlefieldMarkerObjectTemplate.h +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBattlefieldMarkerObjectTemplate.h @@ -44,18 +44,13 @@ public: //@BEGIN TFD public: - int getNumberOfPoles(bool testData = false) const; - int getNumberOfPolesMin(bool testData = false) const; - int getNumberOfPolesMax(bool testData = false) const; - float getRadius(bool testData = false) const; - float getRadiusMin(bool testData = false) const; - float getRadiusMax(bool testData = false) const; + int getNumberOfPoles() const; + int getNumberOfPolesMin() const; + int getNumberOfPolesMax() const; + float getRadius() const; + float getRadiusMin() const; + float getRadiusMax() const; -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBuildingObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBuildingObjectTemplate.cpp index 89b64952..b666e7d3 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBuildingObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBuildingObjectTemplate.cpp @@ -103,22 +103,14 @@ Tag SharedBuildingObjectTemplate::getHighestTemplateVersion(void) const } // SharedBuildingObjectTemplate::getHighestTemplateVersion //@BEGIN TFD -const std::string & SharedBuildingObjectTemplate::getTerrainModificationFileName(bool testData) const +const std::string & SharedBuildingObjectTemplate::getTerrainModificationFileName() const { -#ifdef _DEBUG -std::string testDataValue = DefaultString; -#else -UNREF(testData); -#endif + const SharedBuildingObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getTerrainModificationFileName(true); -#endif } if (!m_terrainModificationFileName.isLoaded()) @@ -136,31 +128,18 @@ UNREF(testData); } const std::string & value = m_terrainModificationFileName.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedBuildingObjectTemplate::getTerrainModificationFileName -const std::string & SharedBuildingObjectTemplate::getInteriorLayoutFileName(bool testData) const +const std::string & SharedBuildingObjectTemplate::getInteriorLayoutFileName() const { -#ifdef _DEBUG -std::string testDataValue = DefaultString; -#else -UNREF(testData); -#endif + const SharedBuildingObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getInteriorLayoutFileName(true); -#endif } if (!m_interiorLayoutFileName.isLoaded()) @@ -178,26 +157,10 @@ UNREF(testData); } const std::string & value = m_interiorLayoutFileName.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedBuildingObjectTemplate::getInteriorLayoutFileName -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void SharedBuildingObjectTemplate::testValues(void) const -{ - IGNORE_RETURN(getTerrainModificationFileName(true)); - IGNORE_RETURN(getInteriorLayoutFileName(true)); - SharedTangibleObjectTemplate::testValues(); -} // SharedBuildingObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -240,8 +203,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,1)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBuildingObjectTemplate.h b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBuildingObjectTemplate.h index 1c37d84e..9405f059 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBuildingObjectTemplate.h +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBuildingObjectTemplate.h @@ -44,14 +44,9 @@ public: //@BEGIN TFD public: - const std::string & getTerrainModificationFileName(bool testData = false) const; - const std::string & getInteriorLayoutFileName(bool testData = false) const; + const std::string & getTerrainModificationFileName() const; + const std::string & getInteriorLayoutFileName() const; -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCellObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCellObjectTemplate.cpp index 0c319760..adee55bf 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCellObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCellObjectTemplate.cpp @@ -103,15 +103,6 @@ Tag SharedCellObjectTemplate::getHighestTemplateVersion(void) const } // SharedCellObjectTemplate::getHighestTemplateVersion //@BEGIN TFD -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void SharedCellObjectTemplate::testValues(void) const -{ - SharedObjectTemplate::testValues(); -} // SharedCellObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -154,8 +145,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,0)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCellObjectTemplate.h b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCellObjectTemplate.h index 01c05587..c7489b64 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCellObjectTemplate.h +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCellObjectTemplate.h @@ -45,11 +45,6 @@ public: //@BEGIN TFD public: -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedConstructionContractObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedConstructionContractObjectTemplate.cpp index ab455e20..8f6a8531 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedConstructionContractObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedConstructionContractObjectTemplate.cpp @@ -103,15 +103,6 @@ Tag SharedConstructionContractObjectTemplate::getHighestTemplateVersion(void) co } // SharedConstructionContractObjectTemplate::getHighestTemplateVersion //@BEGIN TFD -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void SharedConstructionContractObjectTemplate::testValues(void) const -{ - SharedIntangibleObjectTemplate::testValues(); -} // SharedConstructionContractObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -154,8 +145,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,0)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedConstructionContractObjectTemplate.h b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedConstructionContractObjectTemplate.h index 20804df0..8e72f49a 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedConstructionContractObjectTemplate.h +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedConstructionContractObjectTemplate.h @@ -45,11 +45,6 @@ public: //@BEGIN TFD public: -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCreatureObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCreatureObjectTemplate.cpp index 6c5c3db1..a6f21c63 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCreatureObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCreatureObjectTemplate.cpp @@ -167,22 +167,14 @@ void SharedCreatureObjectTemplate::createCustomizationDataPropertyAsNeeded(Objec // ---------------------------------------------------------------------- //@BEGIN TFD -SharedCreatureObjectTemplate::Gender SharedCreatureObjectTemplate::getGender(bool testData) const +SharedCreatureObjectTemplate::Gender SharedCreatureObjectTemplate::getGender() const { -#ifdef _DEBUG -SharedCreatureObjectTemplate::Gender testDataValue = static_cast(0); -#else -UNREF(testData); -#endif + const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getGender(true); -#endif } if (!m_gender.isLoaded()) @@ -200,31 +192,18 @@ UNREF(testData); } Gender value = static_cast(m_gender.getValue()); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedCreatureObjectTemplate::getGender -SharedCreatureObjectTemplate::Niche SharedCreatureObjectTemplate::getNiche(bool testData) const +SharedCreatureObjectTemplate::Niche SharedCreatureObjectTemplate::getNiche() const { -#ifdef _DEBUG -SharedCreatureObjectTemplate::Niche testDataValue = static_cast(0); -#else -UNREF(testData); -#endif + const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getNiche(true); -#endif } if (!m_niche.isLoaded()) @@ -242,31 +221,18 @@ UNREF(testData); } Niche value = static_cast(m_niche.getValue()); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedCreatureObjectTemplate::getNiche -SharedCreatureObjectTemplate::Species SharedCreatureObjectTemplate::getSpecies(bool testData) const +SharedCreatureObjectTemplate::Species SharedCreatureObjectTemplate::getSpecies() const { -#ifdef _DEBUG -SharedCreatureObjectTemplate::Species testDataValue = static_cast(0); -#else -UNREF(testData); -#endif + const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getSpecies(true); -#endif } if (!m_species.isLoaded()) @@ -284,31 +250,18 @@ UNREF(testData); } Species value = static_cast(m_species.getValue()); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedCreatureObjectTemplate::getSpecies -SharedCreatureObjectTemplate::Race SharedCreatureObjectTemplate::getRace(bool testData) const +SharedCreatureObjectTemplate::Race SharedCreatureObjectTemplate::getRace() const { -#ifdef _DEBUG -SharedCreatureObjectTemplate::Race testDataValue = static_cast(0); -#else -UNREF(testData); -#endif + const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getRace(true); -#endif } if (!m_race.isLoaded()) @@ -326,11 +279,6 @@ UNREF(testData); } Race value = static_cast(m_race.getValue()); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedCreatureObjectTemplate::getRace @@ -776,22 +724,14 @@ float SharedCreatureObjectTemplate::getTurnRateMax(MovementTypes index) const return value; } // SharedCreatureObjectTemplate::getTurnRateMax -const std::string & SharedCreatureObjectTemplate::getAnimationMapFilename(bool testData) const +const std::string & SharedCreatureObjectTemplate::getAnimationMapFilename() const { -#ifdef _DEBUG -std::string testDataValue = DefaultString; -#else -UNREF(testData); -#endif + const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getAnimationMapFilename(true); -#endif } if (!m_animationMapFilename.isLoaded()) @@ -809,31 +749,18 @@ UNREF(testData); } const std::string & value = m_animationMapFilename.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedCreatureObjectTemplate::getAnimationMapFilename -float SharedCreatureObjectTemplate::getSlopeModAngle(bool testData) const +float SharedCreatureObjectTemplate::getSlopeModAngle() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getSlopeModAngle(true); -#endif } if (!m_slopeModAngle.isLoaded()) @@ -873,31 +800,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedCreatureObjectTemplate::getSlopeModAngle -float SharedCreatureObjectTemplate::getSlopeModAngleMin(bool testData) const +float SharedCreatureObjectTemplate::getSlopeModAngleMin() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getSlopeModAngleMin(true); -#endif } if (!m_slopeModAngle.isLoaded()) @@ -937,31 +851,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedCreatureObjectTemplate::getSlopeModAngleMin -float SharedCreatureObjectTemplate::getSlopeModAngleMax(bool testData) const +float SharedCreatureObjectTemplate::getSlopeModAngleMax() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getSlopeModAngleMax(true); -#endif } if (!m_slopeModAngle.isLoaded()) @@ -1001,31 +902,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedCreatureObjectTemplate::getSlopeModAngleMax -float SharedCreatureObjectTemplate::getSlopeModPercent(bool testData) const +float SharedCreatureObjectTemplate::getSlopeModPercent() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getSlopeModPercent(true); -#endif } if (!m_slopeModPercent.isLoaded()) @@ -1065,31 +953,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedCreatureObjectTemplate::getSlopeModPercent -float SharedCreatureObjectTemplate::getSlopeModPercentMin(bool testData) const +float SharedCreatureObjectTemplate::getSlopeModPercentMin() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getSlopeModPercentMin(true); -#endif } if (!m_slopeModPercent.isLoaded()) @@ -1129,31 +1004,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedCreatureObjectTemplate::getSlopeModPercentMin -float SharedCreatureObjectTemplate::getSlopeModPercentMax(bool testData) const +float SharedCreatureObjectTemplate::getSlopeModPercentMax() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getSlopeModPercentMax(true); -#endif } if (!m_slopeModPercent.isLoaded()) @@ -1193,31 +1055,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedCreatureObjectTemplate::getSlopeModPercentMax -float SharedCreatureObjectTemplate::getWaterModPercent(bool testData) const +float SharedCreatureObjectTemplate::getWaterModPercent() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getWaterModPercent(true); -#endif } if (!m_waterModPercent.isLoaded()) @@ -1257,31 +1106,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedCreatureObjectTemplate::getWaterModPercent -float SharedCreatureObjectTemplate::getWaterModPercentMin(bool testData) const +float SharedCreatureObjectTemplate::getWaterModPercentMin() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getWaterModPercentMin(true); -#endif } if (!m_waterModPercent.isLoaded()) @@ -1321,31 +1157,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedCreatureObjectTemplate::getWaterModPercentMin -float SharedCreatureObjectTemplate::getWaterModPercentMax(bool testData) const +float SharedCreatureObjectTemplate::getWaterModPercentMax() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getWaterModPercentMax(true); -#endif } if (!m_waterModPercent.isLoaded()) @@ -1385,31 +1208,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedCreatureObjectTemplate::getWaterModPercentMax -float SharedCreatureObjectTemplate::getStepHeight(bool testData) const +float SharedCreatureObjectTemplate::getStepHeight() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getStepHeight(true); -#endif } if (!m_stepHeight.isLoaded()) @@ -1449,31 +1259,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedCreatureObjectTemplate::getStepHeight -float SharedCreatureObjectTemplate::getStepHeightMin(bool testData) const +float SharedCreatureObjectTemplate::getStepHeightMin() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getStepHeightMin(true); -#endif } if (!m_stepHeight.isLoaded()) @@ -1513,31 +1310,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedCreatureObjectTemplate::getStepHeightMin -float SharedCreatureObjectTemplate::getStepHeightMax(bool testData) const +float SharedCreatureObjectTemplate::getStepHeightMax() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getStepHeightMax(true); -#endif } if (!m_stepHeight.isLoaded()) @@ -1577,31 +1361,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedCreatureObjectTemplate::getStepHeightMax -float SharedCreatureObjectTemplate::getCollisionHeight(bool testData) const +float SharedCreatureObjectTemplate::getCollisionHeight() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getCollisionHeight(true); -#endif } if (!m_collisionHeight.isLoaded()) @@ -1641,31 +1412,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedCreatureObjectTemplate::getCollisionHeight -float SharedCreatureObjectTemplate::getCollisionHeightMin(bool testData) const +float SharedCreatureObjectTemplate::getCollisionHeightMin() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getCollisionHeightMin(true); -#endif } if (!m_collisionHeight.isLoaded()) @@ -1705,31 +1463,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedCreatureObjectTemplate::getCollisionHeightMin -float SharedCreatureObjectTemplate::getCollisionHeightMax(bool testData) const +float SharedCreatureObjectTemplate::getCollisionHeightMax() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getCollisionHeightMax(true); -#endif } if (!m_collisionHeight.isLoaded()) @@ -1769,31 +1514,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedCreatureObjectTemplate::getCollisionHeightMax -float SharedCreatureObjectTemplate::getCollisionRadius(bool testData) const +float SharedCreatureObjectTemplate::getCollisionRadius() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getCollisionRadius(true); -#endif } if (!m_collisionRadius.isLoaded()) @@ -1833,31 +1565,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedCreatureObjectTemplate::getCollisionRadius -float SharedCreatureObjectTemplate::getCollisionRadiusMin(bool testData) const +float SharedCreatureObjectTemplate::getCollisionRadiusMin() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getCollisionRadiusMin(true); -#endif } if (!m_collisionRadius.isLoaded()) @@ -1897,31 +1616,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedCreatureObjectTemplate::getCollisionRadiusMin -float SharedCreatureObjectTemplate::getCollisionRadiusMax(bool testData) const +float SharedCreatureObjectTemplate::getCollisionRadiusMax() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getCollisionRadiusMax(true); -#endif } if (!m_collisionRadius.isLoaded()) @@ -1961,31 +1667,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedCreatureObjectTemplate::getCollisionRadiusMax -const std::string & SharedCreatureObjectTemplate::getMovementDatatable(bool testData) const +const std::string & SharedCreatureObjectTemplate::getMovementDatatable() const { -#ifdef _DEBUG -std::string testDataValue = DefaultString; -#else -UNREF(testData); -#endif + const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMovementDatatable(true); -#endif } if (!m_movementDatatable.isLoaded()) @@ -2003,11 +1696,6 @@ UNREF(testData); } const std::string & value = m_movementDatatable.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedCreatureObjectTemplate::getMovementDatatable @@ -2039,22 +1727,14 @@ bool SharedCreatureObjectTemplate::getPostureAlignToTerrain(Postures index) cons return value; } // SharedCreatureObjectTemplate::getPostureAlignToTerrain -float SharedCreatureObjectTemplate::getSwimHeight(bool testData) const +float SharedCreatureObjectTemplate::getSwimHeight() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getSwimHeight(true); -#endif } if (!m_swimHeight.isLoaded()) @@ -2094,31 +1774,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedCreatureObjectTemplate::getSwimHeight -float SharedCreatureObjectTemplate::getSwimHeightMin(bool testData) const +float SharedCreatureObjectTemplate::getSwimHeightMin() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getSwimHeightMin(true); -#endif } if (!m_swimHeight.isLoaded()) @@ -2158,31 +1825,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedCreatureObjectTemplate::getSwimHeightMin -float SharedCreatureObjectTemplate::getSwimHeightMax(bool testData) const +float SharedCreatureObjectTemplate::getSwimHeightMax() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getSwimHeightMax(true); -#endif } if (!m_swimHeight.isLoaded()) @@ -2222,31 +1876,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedCreatureObjectTemplate::getSwimHeightMax -float SharedCreatureObjectTemplate::getWarpTolerance(bool testData) const +float SharedCreatureObjectTemplate::getWarpTolerance() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getWarpTolerance(true); -#endif } if (!m_warpTolerance.isLoaded()) @@ -2286,31 +1927,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedCreatureObjectTemplate::getWarpTolerance -float SharedCreatureObjectTemplate::getWarpToleranceMin(bool testData) const +float SharedCreatureObjectTemplate::getWarpToleranceMin() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getWarpToleranceMin(true); -#endif } if (!m_warpTolerance.isLoaded()) @@ -2350,31 +1978,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedCreatureObjectTemplate::getWarpToleranceMin -float SharedCreatureObjectTemplate::getWarpToleranceMax(bool testData) const +float SharedCreatureObjectTemplate::getWarpToleranceMax() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getWarpToleranceMax(true); -#endif } if (!m_warpTolerance.isLoaded()) @@ -2414,31 +2029,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedCreatureObjectTemplate::getWarpToleranceMax -float SharedCreatureObjectTemplate::getCollisionOffsetX(bool testData) const +float SharedCreatureObjectTemplate::getCollisionOffsetX() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getCollisionOffsetX(true); -#endif } if (!m_collisionOffsetX.isLoaded()) @@ -2478,31 +2080,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedCreatureObjectTemplate::getCollisionOffsetX -float SharedCreatureObjectTemplate::getCollisionOffsetXMin(bool testData) const +float SharedCreatureObjectTemplate::getCollisionOffsetXMin() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getCollisionOffsetXMin(true); -#endif } if (!m_collisionOffsetX.isLoaded()) @@ -2542,31 +2131,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedCreatureObjectTemplate::getCollisionOffsetXMin -float SharedCreatureObjectTemplate::getCollisionOffsetXMax(bool testData) const +float SharedCreatureObjectTemplate::getCollisionOffsetXMax() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getCollisionOffsetXMax(true); -#endif } if (!m_collisionOffsetX.isLoaded()) @@ -2606,31 +2182,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedCreatureObjectTemplate::getCollisionOffsetXMax -float SharedCreatureObjectTemplate::getCollisionOffsetZ(bool testData) const +float SharedCreatureObjectTemplate::getCollisionOffsetZ() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getCollisionOffsetZ(true); -#endif } if (!m_collisionOffsetZ.isLoaded()) @@ -2670,31 +2233,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedCreatureObjectTemplate::getCollisionOffsetZ -float SharedCreatureObjectTemplate::getCollisionOffsetZMin(bool testData) const +float SharedCreatureObjectTemplate::getCollisionOffsetZMin() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getCollisionOffsetZMin(true); -#endif } if (!m_collisionOffsetZ.isLoaded()) @@ -2734,31 +2284,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedCreatureObjectTemplate::getCollisionOffsetZMin -float SharedCreatureObjectTemplate::getCollisionOffsetZMax(bool testData) const +float SharedCreatureObjectTemplate::getCollisionOffsetZMax() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getCollisionOffsetZMax(true); -#endif } if (!m_collisionOffsetZ.isLoaded()) @@ -2798,31 +2335,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedCreatureObjectTemplate::getCollisionOffsetZMax -float SharedCreatureObjectTemplate::getCollisionLength(bool testData) const +float SharedCreatureObjectTemplate::getCollisionLength() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getCollisionLength(true); -#endif } if (!m_collisionLength.isLoaded()) @@ -2862,31 +2386,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedCreatureObjectTemplate::getCollisionLength -float SharedCreatureObjectTemplate::getCollisionLengthMin(bool testData) const +float SharedCreatureObjectTemplate::getCollisionLengthMin() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getCollisionLengthMin(true); -#endif } if (!m_collisionLength.isLoaded()) @@ -2926,31 +2437,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedCreatureObjectTemplate::getCollisionLengthMin -float SharedCreatureObjectTemplate::getCollisionLengthMax(bool testData) const +float SharedCreatureObjectTemplate::getCollisionLengthMax() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getCollisionLengthMax(true); -#endif } if (!m_collisionLength.isLoaded()) @@ -2990,31 +2488,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedCreatureObjectTemplate::getCollisionLengthMax -float SharedCreatureObjectTemplate::getCameraHeight(bool testData) const +float SharedCreatureObjectTemplate::getCameraHeight() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getCameraHeight(true); -#endif } if (!m_cameraHeight.isLoaded()) @@ -3054,31 +2539,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedCreatureObjectTemplate::getCameraHeight -float SharedCreatureObjectTemplate::getCameraHeightMin(bool testData) const +float SharedCreatureObjectTemplate::getCameraHeightMin() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getCameraHeightMin(true); -#endif } if (!m_cameraHeight.isLoaded()) @@ -3118,31 +2590,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedCreatureObjectTemplate::getCameraHeightMin -float SharedCreatureObjectTemplate::getCameraHeightMax(bool testData) const +float SharedCreatureObjectTemplate::getCameraHeightMax() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getCameraHeightMax(true); -#endif } if (!m_cameraHeight.isLoaded()) @@ -3182,54 +2641,10 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedCreatureObjectTemplate::getCameraHeightMax -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void SharedCreatureObjectTemplate::testValues(void) const -{ - IGNORE_RETURN(getGender(true)); - IGNORE_RETURN(getNiche(true)); - IGNORE_RETURN(getSpecies(true)); - IGNORE_RETURN(getRace(true)); - IGNORE_RETURN(getAnimationMapFilename(true)); - IGNORE_RETURN(getSlopeModAngleMin(true)); - IGNORE_RETURN(getSlopeModAngleMax(true)); - IGNORE_RETURN(getSlopeModPercentMin(true)); - IGNORE_RETURN(getSlopeModPercentMax(true)); - IGNORE_RETURN(getWaterModPercentMin(true)); - IGNORE_RETURN(getWaterModPercentMax(true)); - IGNORE_RETURN(getStepHeightMin(true)); - IGNORE_RETURN(getStepHeightMax(true)); - IGNORE_RETURN(getCollisionHeightMin(true)); - IGNORE_RETURN(getCollisionHeightMax(true)); - IGNORE_RETURN(getCollisionRadiusMin(true)); - IGNORE_RETURN(getCollisionRadiusMax(true)); - IGNORE_RETURN(getMovementDatatable(true)); - IGNORE_RETURN(getSwimHeightMin(true)); - IGNORE_RETURN(getSwimHeightMax(true)); - IGNORE_RETURN(getWarpToleranceMin(true)); - IGNORE_RETURN(getWarpToleranceMax(true)); - IGNORE_RETURN(getCollisionOffsetXMin(true)); - IGNORE_RETURN(getCollisionOffsetXMax(true)); - IGNORE_RETURN(getCollisionOffsetZMin(true)); - IGNORE_RETURN(getCollisionOffsetZMax(true)); - IGNORE_RETURN(getCollisionLengthMin(true)); - IGNORE_RETURN(getCollisionLengthMax(true)); - IGNORE_RETURN(getCameraHeightMin(true)); - IGNORE_RETURN(getCameraHeightMax(true)); - SharedTangibleObjectTemplate::testValues(); -} // SharedCreatureObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -3272,8 +2687,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,1,3)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCreatureObjectTemplate.h b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCreatureObjectTemplate.h index 53645aa7..63164a08 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCreatureObjectTemplate.h +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCreatureObjectTemplate.h @@ -361,10 +361,10 @@ public: }; public: - Gender getGender(bool testData = false) const; - Niche getNiche(bool testData = false) const; - Species getSpecies(bool testData = false) const; - Race getRace(bool testData = false) const; + Gender getGender() const; + Niche getNiche() const; + Species getSpecies() const; + Race getRace() const; float getAcceleration(MovementTypes index) const; float getAccelerationMin(MovementTypes index) const; float getAccelerationMax(MovementTypes index) const; @@ -374,51 +374,46 @@ public: float getTurnRate(MovementTypes index) const; float getTurnRateMin(MovementTypes index) const; float getTurnRateMax(MovementTypes index) const; - const std::string & getAnimationMapFilename(bool testData = false) const; - float getSlopeModAngle(bool testData = false) const; - float getSlopeModAngleMin(bool testData = false) const; - float getSlopeModAngleMax(bool testData = false) const; - float getSlopeModPercent(bool testData = false) const; - float getSlopeModPercentMin(bool testData = false) const; - float getSlopeModPercentMax(bool testData = false) const; - float getWaterModPercent(bool testData = false) const; - float getWaterModPercentMin(bool testData = false) const; - float getWaterModPercentMax(bool testData = false) const; - float getStepHeight(bool testData = false) const; - float getStepHeightMin(bool testData = false) const; - float getStepHeightMax(bool testData = false) const; - float getCollisionHeight(bool testData = false) const; - float getCollisionHeightMin(bool testData = false) const; - float getCollisionHeightMax(bool testData = false) const; - float getCollisionRadius(bool testData = false) const; - float getCollisionRadiusMin(bool testData = false) const; - float getCollisionRadiusMax(bool testData = false) const; - const std::string & getMovementDatatable(bool testData = false) const; + const std::string & getAnimationMapFilename() const; + float getSlopeModAngle() const; + float getSlopeModAngleMin() const; + float getSlopeModAngleMax() const; + float getSlopeModPercent() const; + float getSlopeModPercentMin() const; + float getSlopeModPercentMax() const; + float getWaterModPercent() const; + float getWaterModPercentMin() const; + float getWaterModPercentMax() const; + float getStepHeight() const; + float getStepHeightMin() const; + float getStepHeightMax() const; + float getCollisionHeight() const; + float getCollisionHeightMin() const; + float getCollisionHeightMax() const; + float getCollisionRadius() const; + float getCollisionRadiusMin() const; + float getCollisionRadiusMax() const; + const std::string & getMovementDatatable() const; bool getPostureAlignToTerrain(Postures index) const; - float getSwimHeight(bool testData = false) const; - float getSwimHeightMin(bool testData = false) const; - float getSwimHeightMax(bool testData = false) const; - float getWarpTolerance(bool testData = false) const; - float getWarpToleranceMin(bool testData = false) const; - float getWarpToleranceMax(bool testData = false) const; - float getCollisionOffsetX(bool testData = false) const; - float getCollisionOffsetXMin(bool testData = false) const; - float getCollisionOffsetXMax(bool testData = false) const; - float getCollisionOffsetZ(bool testData = false) const; - float getCollisionOffsetZMin(bool testData = false) const; - float getCollisionOffsetZMax(bool testData = false) const; - float getCollisionLength(bool testData = false) const; - float getCollisionLengthMin(bool testData = false) const; - float getCollisionLengthMax(bool testData = false) const; - float getCameraHeight(bool testData = false) const; - float getCameraHeightMin(bool testData = false) const; - float getCameraHeightMax(bool testData = false) const; + float getSwimHeight() const; + float getSwimHeightMin() const; + float getSwimHeightMax() const; + float getWarpTolerance() const; + float getWarpToleranceMin() const; + float getWarpToleranceMax() const; + float getCollisionOffsetX() const; + float getCollisionOffsetXMin() const; + float getCollisionOffsetXMax() const; + float getCollisionOffsetZ() const; + float getCollisionOffsetZMin() const; + float getCollisionOffsetZMax() const; + float getCollisionLength() const; + float getCollisionLengthMin() const; + float getCollisionLengthMax() const; + float getCameraHeight() const; + float getCameraHeightMin() const; + float getCameraHeightMax() const; -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedDraftSchematicObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedDraftSchematicObjectTemplate.cpp index 961cebca..50b15cd6 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedDraftSchematicObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedDraftSchematicObjectTemplate.cpp @@ -434,22 +434,14 @@ size_t SharedDraftSchematicObjectTemplate::getAttributesCount(void) const return count; } // SharedDraftSchematicObjectTemplate::getAttributesCount -const std::string & SharedDraftSchematicObjectTemplate::getCraftedSharedTemplate(bool testData) const +const std::string & SharedDraftSchematicObjectTemplate::getCraftedSharedTemplate() const { -#ifdef _DEBUG -std::string testDataValue = DefaultString; -#else -UNREF(testData); -#endif + const SharedDraftSchematicObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getCraftedSharedTemplate(true); -#endif } if (!m_craftedSharedTemplate.isLoaded()) @@ -467,25 +459,10 @@ UNREF(testData); } const std::string & value = m_craftedSharedTemplate.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedDraftSchematicObjectTemplate::getCraftedSharedTemplate -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void SharedDraftSchematicObjectTemplate::testValues(void) const -{ - IGNORE_RETURN(getCraftedSharedTemplate(true)); - SharedIntangibleObjectTemplate::testValues(); -} // SharedDraftSchematicObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -528,8 +505,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,3)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } @@ -638,22 +615,14 @@ Tag SharedDraftSchematicObjectTemplate::_IngredientSlot::getId(void) const return _IngredientSlot_tag; } // SharedDraftSchematicObjectTemplate::_IngredientSlot::getId -const StringId SharedDraftSchematicObjectTemplate::_IngredientSlot::getName(bool versionOk, bool testData) const +const StringId SharedDraftSchematicObjectTemplate::_IngredientSlot::getName(bool versionOk, ) const { -#ifdef _DEBUG -StringId testDataValue = DefaultStringId; -#else -UNREF(testData); -#endif + const SharedDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getName(true); -#endif } if (!m_name.isLoaded()) @@ -671,31 +640,18 @@ UNREF(testData); } const StringId value = m_name.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedDraftSchematicObjectTemplate::_IngredientSlot::getName -const std::string & SharedDraftSchematicObjectTemplate::_IngredientSlot::getHardpoint(bool versionOk, bool testData) const +const std::string & SharedDraftSchematicObjectTemplate::_IngredientSlot::getHardpoint(bool versionOk, ) const { -#ifdef _DEBUG -std::string testDataValue = DefaultString; -#else -UNREF(testData); -#endif + const SharedDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getHardpoint(true); -#endif } if (!m_hardpoint.isLoaded()) @@ -713,25 +669,10 @@ UNREF(testData); } const std::string & value = m_hardpoint.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedDraftSchematicObjectTemplate::_IngredientSlot::getHardpoint -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void SharedDraftSchematicObjectTemplate::_IngredientSlot::testValues(void) const -{ - IGNORE_RETURN(getName(true)); - IGNORE_RETURN(getHardpoint(true)); -} // SharedDraftSchematicObjectTemplate::_IngredientSlot::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -811,22 +752,14 @@ Tag SharedDraftSchematicObjectTemplate::_SchematicAttribute::getId(void) const return _SchematicAttribute_tag; } // SharedDraftSchematicObjectTemplate::_SchematicAttribute::getId -const StringId SharedDraftSchematicObjectTemplate::_SchematicAttribute::getName(bool versionOk, bool testData) const +const StringId SharedDraftSchematicObjectTemplate::_SchematicAttribute::getName(bool versionOk, ) const { -#ifdef _DEBUG -StringId testDataValue = DefaultStringId; -#else -UNREF(testData); -#endif + const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getName(true); -#endif } if (!m_name.isLoaded()) @@ -844,31 +777,18 @@ UNREF(testData); } const StringId value = m_name.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedDraftSchematicObjectTemplate::_SchematicAttribute::getName -const StringId SharedDraftSchematicObjectTemplate::_SchematicAttribute::getExperiment(bool versionOk, bool testData) const +const StringId SharedDraftSchematicObjectTemplate::_SchematicAttribute::getExperiment(bool versionOk, ) const { -#ifdef _DEBUG -StringId testDataValue = DefaultStringId; -#else -UNREF(testData); -#endif + const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getExperiment(true); -#endif } if (!m_experiment.isLoaded()) @@ -886,31 +806,18 @@ UNREF(testData); } const StringId value = m_experiment.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedDraftSchematicObjectTemplate::_SchematicAttribute::getExperiment -int SharedDraftSchematicObjectTemplate::_SchematicAttribute::getValue(bool versionOk, bool testData) const +int SharedDraftSchematicObjectTemplate::_SchematicAttribute::getValue(bool versionOk, ) const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getValue(true); -#endif } if (!m_value.isLoaded()) @@ -950,31 +857,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedDraftSchematicObjectTemplate::_SchematicAttribute::getValue -int SharedDraftSchematicObjectTemplate::_SchematicAttribute::getValueMin(bool versionOk, bool testData) const +int SharedDraftSchematicObjectTemplate::_SchematicAttribute::getValueMin(bool versionOk, ) const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getValueMin(true); -#endif } if (!m_value.isLoaded()) @@ -1014,31 +908,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedDraftSchematicObjectTemplate::_SchematicAttribute::getValueMin -int SharedDraftSchematicObjectTemplate::_SchematicAttribute::getValueMax(bool versionOk, bool testData) const +int SharedDraftSchematicObjectTemplate::_SchematicAttribute::getValueMax(bool versionOk, ) const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getValueMax(true); -#endif } if (!m_value.isLoaded()) @@ -1078,27 +959,10 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedDraftSchematicObjectTemplate::_SchematicAttribute::getValueMax -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void SharedDraftSchematicObjectTemplate::_SchematicAttribute::testValues(void) const -{ - IGNORE_RETURN(getName(true)); - IGNORE_RETURN(getExperiment(true)); - IGNORE_RETURN(getValueMin(true)); - IGNORE_RETURN(getValueMax(true)); -} // SharedDraftSchematicObjectTemplate::_SchematicAttribute::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedDraftSchematicObjectTemplate.h b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedDraftSchematicObjectTemplate.h index e84be62c..9d312500 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedDraftSchematicObjectTemplate.h +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedDraftSchematicObjectTemplate.h @@ -109,14 +109,9 @@ protected: virtual Tag getId(void) const; public: - const StringId getName(bool versionOk, bool testData = false) const; - const std::string & getHardpoint(bool versionOk, bool testData = false) const; + const StringId getName(bool versionOk) const; + const std::string & getHardpoint(bool versionOk) const; -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); @@ -149,17 +144,12 @@ private: virtual Tag getId(void) const; public: - const StringId getName(bool versionOk, bool testData = false) const; - const StringId getExperiment(bool versionOk, bool testData = false) const; - int getValue(bool versionOk, bool testData = false) const; - int getValueMin(bool versionOk, bool testData = false) const; - int getValueMax(bool versionOk, bool testData = false) const; + const StringId getName(bool versionOk) const; + const StringId getExperiment(bool versionOk) const; + int getValue(bool versionOk) const; + int getValueMin(bool versionOk) const; + int getValueMax(bool versionOk) const; -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); @@ -186,13 +176,8 @@ public: void getAttributesMin(SchematicAttribute &data, int index) const; void getAttributesMax(SchematicAttribute &data, int index) const; size_t getAttributesCount(void) const; - const std::string & getCraftedSharedTemplate(bool testData = false) const; + const std::string & getCraftedSharedTemplate() const; -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedFactoryObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedFactoryObjectTemplate.cpp index 4a7e73fa..75390ff3 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedFactoryObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedFactoryObjectTemplate.cpp @@ -103,15 +103,6 @@ Tag SharedFactoryObjectTemplate::getHighestTemplateVersion(void) const } // SharedFactoryObjectTemplate::getHighestTemplateVersion //@BEGIN TFD -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void SharedFactoryObjectTemplate::testValues(void) const -{ - SharedTangibleObjectTemplate::testValues(); -} // SharedFactoryObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -154,8 +145,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,0)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedFactoryObjectTemplate.h b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedFactoryObjectTemplate.h index 3bab50b6..9333931b 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedFactoryObjectTemplate.h +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedFactoryObjectTemplate.h @@ -45,11 +45,6 @@ public: //@BEGIN TFD public: -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGroupObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGroupObjectTemplate.cpp index d3c1d6d0..3605fec1 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGroupObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGroupObjectTemplate.cpp @@ -103,15 +103,6 @@ Tag SharedGroupObjectTemplate::getHighestTemplateVersion(void) const } // SharedGroupObjectTemplate::getHighestTemplateVersion //@BEGIN TFD -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void SharedGroupObjectTemplate::testValues(void) const -{ - SharedUniverseObjectTemplate::testValues(); -} // SharedGroupObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -154,8 +145,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,0)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGroupObjectTemplate.h b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGroupObjectTemplate.h index a114b920..97298566 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGroupObjectTemplate.h +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGroupObjectTemplate.h @@ -45,11 +45,6 @@ public: //@BEGIN TFD public: -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGuildObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGuildObjectTemplate.cpp index e57241db..6a07324b 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGuildObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGuildObjectTemplate.cpp @@ -103,15 +103,6 @@ Tag SharedGuildObjectTemplate::getHighestTemplateVersion(void) const } // SharedGuildObjectTemplate::getHighestTemplateVersion //@BEGIN TFD -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void SharedGuildObjectTemplate::testValues(void) const -{ - SharedUniverseObjectTemplate::testValues(); -} // SharedGuildObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -154,8 +145,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,0)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGuildObjectTemplate.h b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGuildObjectTemplate.h index 43a7c2d3..b69a4dcc 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGuildObjectTemplate.h +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGuildObjectTemplate.h @@ -45,11 +45,6 @@ public: //@BEGIN TFD public: -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedInstallationObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedInstallationObjectTemplate.cpp index 5e66bbf1..64db45c4 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedInstallationObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedInstallationObjectTemplate.cpp @@ -103,15 +103,6 @@ Tag SharedInstallationObjectTemplate::getHighestTemplateVersion(void) const } // SharedInstallationObjectTemplate::getHighestTemplateVersion //@BEGIN TFD -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void SharedInstallationObjectTemplate::testValues(void) const -{ - SharedTangibleObjectTemplate::testValues(); -} // SharedInstallationObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -154,8 +145,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,0)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedInstallationObjectTemplate.h b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedInstallationObjectTemplate.h index 36e3aabe..528b98b5 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedInstallationObjectTemplate.h +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedInstallationObjectTemplate.h @@ -45,11 +45,6 @@ public: //@BEGIN TFD public: -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedIntangibleObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedIntangibleObjectTemplate.cpp index 4934dd40..ef0e1df9 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedIntangibleObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedIntangibleObjectTemplate.cpp @@ -103,15 +103,6 @@ Tag SharedIntangibleObjectTemplate::getHighestTemplateVersion(void) const } // SharedIntangibleObjectTemplate::getHighestTemplateVersion //@BEGIN TFD -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void SharedIntangibleObjectTemplate::testValues(void) const -{ - SharedObjectTemplate::testValues(); -} // SharedIntangibleObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -154,8 +145,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,0)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedIntangibleObjectTemplate.h b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedIntangibleObjectTemplate.h index bf0ae9d3..4d7d15e7 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedIntangibleObjectTemplate.h +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedIntangibleObjectTemplate.h @@ -45,11 +45,6 @@ public: //@BEGIN TFD public: -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedJediManagerObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedJediManagerObjectTemplate.cpp index 3c8ad274..9ee18be7 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedJediManagerObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedJediManagerObjectTemplate.cpp @@ -12,7 +12,7 @@ #include "sharedGame/FirstSharedGame.h" #include "SharedJediManagerObjectTemplate.h" -#include "sharedDebug/DataLint.h" + #include "sharedFile/Iff.h" #include "sharedMath/Vector.h" #include "sharedObject/ObjectTemplate.h" @@ -104,15 +104,6 @@ Tag SharedJediManagerObjectTemplate::getHighestTemplateVersion(void) const } // SharedJediManagerObjectTemplate::getHighestTemplateVersion //@BEGIN TFD -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void SharedJediManagerObjectTemplate::testValues(void) const -{ - SharedUniverseObjectTemplate::testValues(); -} // SharedJediManagerObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -155,8 +146,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,0)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedJediManagerObjectTemplate.h b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedJediManagerObjectTemplate.h index b2be5b14..91b5d4ef 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedJediManagerObjectTemplate.h +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedJediManagerObjectTemplate.h @@ -45,11 +45,6 @@ public: //@BEGIN TFD public: -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedManufactureSchematicObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedManufactureSchematicObjectTemplate.cpp index de9c8b4d..40779694 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedManufactureSchematicObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedManufactureSchematicObjectTemplate.cpp @@ -103,15 +103,6 @@ Tag SharedManufactureSchematicObjectTemplate::getHighestTemplateVersion(void) co } // SharedManufactureSchematicObjectTemplate::getHighestTemplateVersion //@BEGIN TFD -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void SharedManufactureSchematicObjectTemplate::testValues(void) const -{ - SharedIntangibleObjectTemplate::testValues(); -} // SharedManufactureSchematicObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -154,8 +145,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,0)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedManufactureSchematicObjectTemplate.h b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedManufactureSchematicObjectTemplate.h index 71a6c26e..fc80e58d 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedManufactureSchematicObjectTemplate.h +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedManufactureSchematicObjectTemplate.h @@ -45,11 +45,6 @@ public: //@BEGIN TFD public: -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedMissionObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedMissionObjectTemplate.cpp index 10eaba74..67ef6517 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedMissionObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedMissionObjectTemplate.cpp @@ -103,15 +103,6 @@ Tag SharedMissionObjectTemplate::getHighestTemplateVersion(void) const } // SharedMissionObjectTemplate::getHighestTemplateVersion //@BEGIN TFD -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void SharedMissionObjectTemplate::testValues(void) const -{ - SharedIntangibleObjectTemplate::testValues(); -} // SharedMissionObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -154,8 +145,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,0)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedMissionObjectTemplate.h b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedMissionObjectTemplate.h index 7830dc89..554ebadc 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedMissionObjectTemplate.h +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedMissionObjectTemplate.h @@ -45,11 +45,6 @@ public: //@BEGIN TFD public: -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedObjectTemplate.cpp index dc0fe57a..f23cc1e5 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedObjectTemplate.cpp @@ -266,22 +266,14 @@ void SharedObjectTemplate::postLoad(void) } // SharedObjectTemplate::postLoad //@BEGIN TFD -const StringId SharedObjectTemplate::getObjectName(bool testData) const +const StringId SharedObjectTemplate::getObjectName() const { -#ifdef _DEBUG -StringId testDataValue = DefaultStringId; -#else -UNREF(testData); -#endif + const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getObjectName(true); -#endif } if (!m_objectName.isLoaded()) @@ -299,31 +291,18 @@ UNREF(testData); } const StringId value = m_objectName.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedObjectTemplate::getObjectName -const StringId SharedObjectTemplate::getDetailedDescription(bool testData) const +const StringId SharedObjectTemplate::getDetailedDescription() const { -#ifdef _DEBUG -StringId testDataValue = DefaultStringId; -#else -UNREF(testData); -#endif + const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getDetailedDescription(true); -#endif } if (!m_detailedDescription.isLoaded()) @@ -341,31 +320,18 @@ UNREF(testData); } const StringId value = m_detailedDescription.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedObjectTemplate::getDetailedDescription -const StringId SharedObjectTemplate::getLookAtText(bool testData) const +const StringId SharedObjectTemplate::getLookAtText() const { -#ifdef _DEBUG -StringId testDataValue = DefaultStringId; -#else -UNREF(testData); -#endif + const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getLookAtText(true); -#endif } if (!m_lookAtText.isLoaded()) @@ -383,31 +349,18 @@ UNREF(testData); } const StringId value = m_lookAtText.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedObjectTemplate::getLookAtText -bool SharedObjectTemplate::getSnapToTerrain(bool testData) const +bool SharedObjectTemplate::getSnapToTerrain() const { -#ifdef _DEBUG -bool testDataValue = false; -#else -UNREF(testData); -#endif + const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getSnapToTerrain(true); -#endif } if (!m_snapToTerrain.isLoaded()) @@ -425,31 +378,18 @@ UNREF(testData); } bool value = m_snapToTerrain.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedObjectTemplate::getSnapToTerrain -SharedObjectTemplate::ContainerType SharedObjectTemplate::getContainerType(bool testData) const +SharedObjectTemplate::ContainerType SharedObjectTemplate::getContainerType() const { -#ifdef _DEBUG -SharedObjectTemplate::ContainerType testDataValue = static_cast(0); -#else -UNREF(testData); -#endif + const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getContainerType(true); -#endif } if (!m_containerType.isLoaded()) @@ -467,31 +407,18 @@ UNREF(testData); } ContainerType value = static_cast(m_containerType.getValue()); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedObjectTemplate::getContainerType -int SharedObjectTemplate::getContainerVolumeLimit(bool testData) const +int SharedObjectTemplate::getContainerVolumeLimit() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getContainerVolumeLimit(true); -#endif } if (!m_containerVolumeLimit.isLoaded()) @@ -531,31 +458,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedObjectTemplate::getContainerVolumeLimit -int SharedObjectTemplate::getContainerVolumeLimitMin(bool testData) const +int SharedObjectTemplate::getContainerVolumeLimitMin() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getContainerVolumeLimitMin(true); -#endif } if (!m_containerVolumeLimit.isLoaded()) @@ -595,31 +509,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedObjectTemplate::getContainerVolumeLimitMin -int SharedObjectTemplate::getContainerVolumeLimitMax(bool testData) const +int SharedObjectTemplate::getContainerVolumeLimitMax() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getContainerVolumeLimitMax(true); -#endif } if (!m_containerVolumeLimit.isLoaded()) @@ -659,31 +560,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedObjectTemplate::getContainerVolumeLimitMax -const std::string & SharedObjectTemplate::getTintPalette(bool testData) const +const std::string & SharedObjectTemplate::getTintPalette() const { -#ifdef _DEBUG -std::string testDataValue = DefaultString; -#else -UNREF(testData); -#endif + const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getTintPalette(true); -#endif } if (!m_tintPalette.isLoaded()) @@ -701,31 +589,18 @@ UNREF(testData); } const std::string & value = m_tintPalette.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedObjectTemplate::getTintPalette -const std::string & SharedObjectTemplate::getSlotDescriptorFilename(bool testData) const +const std::string & SharedObjectTemplate::getSlotDescriptorFilename() const { -#ifdef _DEBUG -std::string testDataValue = DefaultString; -#else -UNREF(testData); -#endif + const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getSlotDescriptorFilename(true); -#endif } if (!m_slotDescriptorFilename.isLoaded()) @@ -743,31 +618,18 @@ UNREF(testData); } const std::string & value = m_slotDescriptorFilename.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedObjectTemplate::getSlotDescriptorFilename -const std::string & SharedObjectTemplate::getArrangementDescriptorFilename(bool testData) const +const std::string & SharedObjectTemplate::getArrangementDescriptorFilename() const { -#ifdef _DEBUG -std::string testDataValue = DefaultString; -#else -UNREF(testData); -#endif + const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getArrangementDescriptorFilename(true); -#endif } if (!m_arrangementDescriptorFilename.isLoaded()) @@ -785,31 +647,18 @@ UNREF(testData); } const std::string & value = m_arrangementDescriptorFilename.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedObjectTemplate::getArrangementDescriptorFilename -const std::string & SharedObjectTemplate::getAppearanceFilename(bool testData) const +const std::string & SharedObjectTemplate::getAppearanceFilename() const { -#ifdef _DEBUG -std::string testDataValue = DefaultString; -#else -UNREF(testData); -#endif + const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getAppearanceFilename(true); -#endif } if (!m_appearanceFilename.isLoaded()) @@ -827,31 +676,18 @@ UNREF(testData); } const std::string & value = m_appearanceFilename.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedObjectTemplate::getAppearanceFilename -const std::string & SharedObjectTemplate::getPortalLayoutFilename(bool testData) const +const std::string & SharedObjectTemplate::getPortalLayoutFilename() const { -#ifdef _DEBUG -std::string testDataValue = DefaultString; -#else -UNREF(testData); -#endif + const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getPortalLayoutFilename(true); -#endif } if (!m_portalLayoutFilename.isLoaded()) @@ -869,31 +705,18 @@ UNREF(testData); } const std::string & value = m_portalLayoutFilename.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedObjectTemplate::getPortalLayoutFilename -const std::string & SharedObjectTemplate::getClientDataFile(bool testData) const +const std::string & SharedObjectTemplate::getClientDataFile() const { -#ifdef _DEBUG -std::string testDataValue = DefaultString; -#else -UNREF(testData); -#endif + const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getClientDataFile(true); -#endif } if (!m_clientDataFile.isLoaded()) @@ -911,31 +734,18 @@ UNREF(testData); } const std::string & value = m_clientDataFile.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedObjectTemplate::getClientDataFile -float SharedObjectTemplate::getScale(bool testData) const +float SharedObjectTemplate::getScale() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getScale(true); -#endif } if (!m_scale.isLoaded()) @@ -975,31 +785,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedObjectTemplate::getScale -float SharedObjectTemplate::getScaleMin(bool testData) const +float SharedObjectTemplate::getScaleMin() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getScaleMin(true); -#endif } if (!m_scale.isLoaded()) @@ -1039,31 +836,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedObjectTemplate::getScaleMin -float SharedObjectTemplate::getScaleMax(bool testData) const +float SharedObjectTemplate::getScaleMax() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getScaleMax(true); -#endif } if (!m_scale.isLoaded()) @@ -1103,31 +887,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedObjectTemplate::getScaleMax -SharedObjectTemplate::GameObjectType SharedObjectTemplate::getGameObjectType(bool testData) const +SharedObjectTemplate::GameObjectType SharedObjectTemplate::getGameObjectType() const { -#ifdef _DEBUG -SharedObjectTemplate::GameObjectType testDataValue = static_cast(0); -#else -UNREF(testData); -#endif + const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getGameObjectType(true); -#endif } if (!m_gameObjectType.isLoaded()) @@ -1145,31 +916,18 @@ UNREF(testData); } GameObjectType value = static_cast(m_gameObjectType.getValue()); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedObjectTemplate::getGameObjectType -bool SharedObjectTemplate::getSendToClient(bool testData) const +bool SharedObjectTemplate::getSendToClient() const { -#ifdef _DEBUG -bool testDataValue = false; -#else -UNREF(testData); -#endif + const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getSendToClient(true); -#endif } if (!m_sendToClient.isLoaded()) @@ -1187,31 +945,18 @@ UNREF(testData); } bool value = m_sendToClient.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedObjectTemplate::getSendToClient -float SharedObjectTemplate::getScaleThresholdBeforeExtentTest(bool testData) const +float SharedObjectTemplate::getScaleThresholdBeforeExtentTest() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getScaleThresholdBeforeExtentTest(true); -#endif } if (!m_scaleThresholdBeforeExtentTest.isLoaded()) @@ -1251,31 +996,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedObjectTemplate::getScaleThresholdBeforeExtentTest -float SharedObjectTemplate::getScaleThresholdBeforeExtentTestMin(bool testData) const +float SharedObjectTemplate::getScaleThresholdBeforeExtentTestMin() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getScaleThresholdBeforeExtentTestMin(true); -#endif } if (!m_scaleThresholdBeforeExtentTest.isLoaded()) @@ -1315,31 +1047,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedObjectTemplate::getScaleThresholdBeforeExtentTestMin -float SharedObjectTemplate::getScaleThresholdBeforeExtentTestMax(bool testData) const +float SharedObjectTemplate::getScaleThresholdBeforeExtentTestMax() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getScaleThresholdBeforeExtentTestMax(true); -#endif } if (!m_scaleThresholdBeforeExtentTest.isLoaded()) @@ -1379,31 +1098,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedObjectTemplate::getScaleThresholdBeforeExtentTestMax -float SharedObjectTemplate::getClearFloraRadius(bool testData) const +float SharedObjectTemplate::getClearFloraRadius() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getClearFloraRadius(true); -#endif } if (!m_clearFloraRadius.isLoaded()) @@ -1443,31 +1149,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedObjectTemplate::getClearFloraRadius -float SharedObjectTemplate::getClearFloraRadiusMin(bool testData) const +float SharedObjectTemplate::getClearFloraRadiusMin() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getClearFloraRadiusMin(true); -#endif } if (!m_clearFloraRadius.isLoaded()) @@ -1507,31 +1200,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedObjectTemplate::getClearFloraRadiusMin -float SharedObjectTemplate::getClearFloraRadiusMax(bool testData) const +float SharedObjectTemplate::getClearFloraRadiusMax() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getClearFloraRadiusMax(true); -#endif } if (!m_clearFloraRadius.isLoaded()) @@ -1571,31 +1251,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedObjectTemplate::getClearFloraRadiusMax -SharedObjectTemplate::SurfaceType SharedObjectTemplate::getSurfaceType(bool testData) const +SharedObjectTemplate::SurfaceType SharedObjectTemplate::getSurfaceType() const { -#ifdef _DEBUG -SharedObjectTemplate::SurfaceType testDataValue = static_cast(0); -#else -UNREF(testData); -#endif + const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getSurfaceType(true); -#endif } if (!m_surfaceType.isLoaded()) @@ -1613,31 +1280,18 @@ UNREF(testData); } SurfaceType value = static_cast(m_surfaceType.getValue()); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedObjectTemplate::getSurfaceType -float SharedObjectTemplate::getNoBuildRadius(bool testData) const +float SharedObjectTemplate::getNoBuildRadius() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getNoBuildRadius(true); -#endif } if (!m_noBuildRadius.isLoaded()) @@ -1677,31 +1331,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedObjectTemplate::getNoBuildRadius -float SharedObjectTemplate::getNoBuildRadiusMin(bool testData) const +float SharedObjectTemplate::getNoBuildRadiusMin() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getNoBuildRadiusMin(true); -#endif } if (!m_noBuildRadius.isLoaded()) @@ -1741,31 +1382,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedObjectTemplate::getNoBuildRadiusMin -float SharedObjectTemplate::getNoBuildRadiusMax(bool testData) const +float SharedObjectTemplate::getNoBuildRadiusMax() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getNoBuildRadiusMax(true); -#endif } if (!m_noBuildRadius.isLoaded()) @@ -1805,31 +1433,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedObjectTemplate::getNoBuildRadiusMax -bool SharedObjectTemplate::getOnlyVisibleInTools(bool testData) const +bool SharedObjectTemplate::getOnlyVisibleInTools() const { -#ifdef _DEBUG -bool testDataValue = false; -#else -UNREF(testData); -#endif + const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getOnlyVisibleInTools(true); -#endif } if (!m_onlyVisibleInTools.isLoaded()) @@ -1847,31 +1462,18 @@ UNREF(testData); } bool value = m_onlyVisibleInTools.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedObjectTemplate::getOnlyVisibleInTools -float SharedObjectTemplate::getLocationReservationRadius(bool testData) const +float SharedObjectTemplate::getLocationReservationRadius() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getLocationReservationRadius(true); -#endif } if (!m_locationReservationRadius.isLoaded()) @@ -1911,31 +1513,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedObjectTemplate::getLocationReservationRadius -float SharedObjectTemplate::getLocationReservationRadiusMin(bool testData) const +float SharedObjectTemplate::getLocationReservationRadiusMin() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getLocationReservationRadiusMin(true); -#endif } if (!m_locationReservationRadius.isLoaded()) @@ -1975,31 +1564,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedObjectTemplate::getLocationReservationRadiusMin -float SharedObjectTemplate::getLocationReservationRadiusMax(bool testData) const +float SharedObjectTemplate::getLocationReservationRadiusMax() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getLocationReservationRadiusMax(true); -#endif } if (!m_locationReservationRadius.isLoaded()) @@ -2039,31 +1615,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedObjectTemplate::getLocationReservationRadiusMax -bool SharedObjectTemplate::getForceNoCollision(bool testData) const +bool SharedObjectTemplate::getForceNoCollision() const { -#ifdef _DEBUG -bool testDataValue = false; -#else -UNREF(testData); -#endif + const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getForceNoCollision(true); -#endif } if (!m_forceNoCollision.isLoaded()) @@ -2081,51 +1644,10 @@ UNREF(testData); } bool value = m_forceNoCollision.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedObjectTemplate::getForceNoCollision -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void SharedObjectTemplate::testValues(void) const -{ - IGNORE_RETURN(getObjectName(true)); - IGNORE_RETURN(getDetailedDescription(true)); - IGNORE_RETURN(getLookAtText(true)); - IGNORE_RETURN(getSnapToTerrain(true)); - IGNORE_RETURN(getContainerType(true)); - IGNORE_RETURN(getContainerVolumeLimitMin(true)); - IGNORE_RETURN(getContainerVolumeLimitMax(true)); - IGNORE_RETURN(getTintPalette(true)); - IGNORE_RETURN(getSlotDescriptorFilename(true)); - IGNORE_RETURN(getArrangementDescriptorFilename(true)); - IGNORE_RETURN(getAppearanceFilename(true)); - IGNORE_RETURN(getPortalLayoutFilename(true)); - IGNORE_RETURN(getClientDataFile(true)); - IGNORE_RETURN(getScaleMin(true)); - IGNORE_RETURN(getScaleMax(true)); - IGNORE_RETURN(getGameObjectType(true)); - IGNORE_RETURN(getSendToClient(true)); - IGNORE_RETURN(getScaleThresholdBeforeExtentTestMin(true)); - IGNORE_RETURN(getScaleThresholdBeforeExtentTestMax(true)); - IGNORE_RETURN(getClearFloraRadiusMin(true)); - IGNORE_RETURN(getClearFloraRadiusMax(true)); - IGNORE_RETURN(getSurfaceType(true)); - IGNORE_RETURN(getNoBuildRadiusMin(true)); - IGNORE_RETURN(getNoBuildRadiusMax(true)); - IGNORE_RETURN(getOnlyVisibleInTools(true)); - IGNORE_RETURN(getLocationReservationRadiusMin(true)); - IGNORE_RETURN(getLocationReservationRadiusMax(true)); - IGNORE_RETURN(getForceNoCollision(true)); -} // SharedObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -2167,8 +1689,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,1,0)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedObjectTemplate.h b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedObjectTemplate.h index 5fc7686f..6eecadac 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedObjectTemplate.h +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedObjectTemplate.h @@ -339,46 +339,41 @@ public: }; public: - const StringId getObjectName(bool testData = false) const; - const StringId getDetailedDescription(bool testData = false) const; - const StringId getLookAtText(bool testData = false) const; - bool getSnapToTerrain(bool testData = false) const; - ContainerType getContainerType(bool testData = false) const; - int getContainerVolumeLimit(bool testData = false) const; - int getContainerVolumeLimitMin(bool testData = false) const; - int getContainerVolumeLimitMax(bool testData = false) const; - const std::string & getTintPalette(bool testData = false) const; - const std::string & getSlotDescriptorFilename(bool testData = false) const; - const std::string & getArrangementDescriptorFilename(bool testData = false) const; - const std::string & getAppearanceFilename(bool testData = false) const; - const std::string & getPortalLayoutFilename(bool testData = false) const; - const std::string & getClientDataFile(bool testData = false) const; - float getScale(bool testData = false) const; - float getScaleMin(bool testData = false) const; - float getScaleMax(bool testData = false) const; - GameObjectType getGameObjectType(bool testData = false) const; - bool getSendToClient(bool testData = false) const; - float getScaleThresholdBeforeExtentTest(bool testData = false) const; - float getScaleThresholdBeforeExtentTestMin(bool testData = false) const; - float getScaleThresholdBeforeExtentTestMax(bool testData = false) const; - float getClearFloraRadius(bool testData = false) const; - float getClearFloraRadiusMin(bool testData = false) const; - float getClearFloraRadiusMax(bool testData = false) const; - SurfaceType getSurfaceType(bool testData = false) const; - float getNoBuildRadius(bool testData = false) const; - float getNoBuildRadiusMin(bool testData = false) const; - float getNoBuildRadiusMax(bool testData = false) const; - bool getOnlyVisibleInTools(bool testData = false) const; - float getLocationReservationRadius(bool testData = false) const; - float getLocationReservationRadiusMin(bool testData = false) const; - float getLocationReservationRadiusMax(bool testData = false) const; - bool getForceNoCollision(bool testData = false) const; + const StringId getObjectName() const; + const StringId getDetailedDescription() const; + const StringId getLookAtText() const; + bool getSnapToTerrain() const; + ContainerType getContainerType() const; + int getContainerVolumeLimit() const; + int getContainerVolumeLimitMin() const; + int getContainerVolumeLimitMax() const; + const std::string & getTintPalette() const; + const std::string & getSlotDescriptorFilename() const; + const std::string & getArrangementDescriptorFilename() const; + const std::string & getAppearanceFilename() const; + const std::string & getPortalLayoutFilename() const; + const std::string & getClientDataFile() const; + float getScale() const; + float getScaleMin() const; + float getScaleMax() const; + GameObjectType getGameObjectType() const; + bool getSendToClient() const; + float getScaleThresholdBeforeExtentTest() const; + float getScaleThresholdBeforeExtentTestMin() const; + float getScaleThresholdBeforeExtentTestMax() const; + float getClearFloraRadius() const; + float getClearFloraRadiusMin() const; + float getClearFloraRadiusMax() const; + SurfaceType getSurfaceType() const; + float getNoBuildRadius() const; + float getNoBuildRadiusMin() const; + float getNoBuildRadiusMax() const; + bool getOnlyVisibleInTools() const; + float getLocationReservationRadius() const; + float getLocationReservationRadiusMin() const; + float getLocationReservationRadiusMax() const; + bool getForceNoCollision() const; -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerObjectTemplate.cpp index 7d020a59..4a744f52 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerObjectTemplate.cpp @@ -12,7 +12,7 @@ #include "sharedGame/FirstSharedGame.h" #include "SharedPlayerObjectTemplate.h" -#include "sharedDebug/DataLint.h" + #include "sharedFile/Iff.h" #include "sharedMath/Vector.h" #include "sharedObject/ObjectTemplate.h" @@ -104,15 +104,6 @@ Tag SharedPlayerObjectTemplate::getHighestTemplateVersion(void) const } // SharedPlayerObjectTemplate::getHighestTemplateVersion //@BEGIN TFD -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void SharedPlayerObjectTemplate::testValues(void) const -{ - SharedIntangibleObjectTemplate::testValues(); -} // SharedPlayerObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -155,8 +146,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,0)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerObjectTemplate.h b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerObjectTemplate.h index 5b64f2f8..187e83b4 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerObjectTemplate.h +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerObjectTemplate.h @@ -45,11 +45,6 @@ public: //@BEGIN TFD public: -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerQuestObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerQuestObjectTemplate.cpp index 26380963..a68fab70 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerQuestObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerQuestObjectTemplate.cpp @@ -12,7 +12,7 @@ #include "sharedGame/FirstSharedGame.h" #include "SharedPlayerQuestObjectTemplate.h" -#include "sharedDebug/DataLint.h" + #include "sharedFile/Iff.h" #include "sharedMath/Vector.h" #include "sharedObject/ObjectTemplate.h" @@ -104,15 +104,6 @@ Tag SharedPlayerQuestObjectTemplate::getHighestTemplateVersion(void) const } // SharedPlayerQuestObjectTemplate::getHighestTemplateVersion //@BEGIN TFD -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void SharedPlayerQuestObjectTemplate::testValues(void) const -{ - SharedTangibleObjectTemplate::testValues(); -} // SharedPlayerQuestObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -155,8 +146,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,0)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerQuestObjectTemplate.h b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerQuestObjectTemplate.h index e5c9260c..c6b45a38 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerQuestObjectTemplate.h +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerQuestObjectTemplate.h @@ -45,11 +45,6 @@ public: //@BEGIN TFD public: -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedResourceContainerObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedResourceContainerObjectTemplate.cpp index dbb0635d..224c3c26 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedResourceContainerObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedResourceContainerObjectTemplate.cpp @@ -103,15 +103,6 @@ Tag SharedResourceContainerObjectTemplate::getHighestTemplateVersion(void) const } // SharedResourceContainerObjectTemplate::getHighestTemplateVersion //@BEGIN TFD -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void SharedResourceContainerObjectTemplate::testValues(void) const -{ - SharedTangibleObjectTemplate::testValues(); -} // SharedResourceContainerObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -154,8 +145,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,0)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedResourceContainerObjectTemplate.h b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedResourceContainerObjectTemplate.h index 86067879..19f45dd7 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedResourceContainerObjectTemplate.h +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedResourceContainerObjectTemplate.h @@ -45,11 +45,6 @@ public: //@BEGIN TFD public: -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedShipObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedShipObjectTemplate.cpp index e374302c..c4ef1930 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedShipObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedShipObjectTemplate.cpp @@ -13,7 +13,7 @@ #include "sharedGame/FirstSharedGame.h" #include "sharedGame/SharedShipObjectTemplate.h" -#include "sharedDebug/DataLint.h" + #include "sharedFile/Iff.h" #include "sharedGame/AssetCustomizationManager.h" #include "sharedMath/Vector.h" @@ -147,22 +147,14 @@ void SharedShipObjectTemplate::createCustomizationDataPropertyAsNeeded(Object &o } //@BEGIN TFD -const std::string & SharedShipObjectTemplate::getCockpitFilename(bool testData) const +const std::string & SharedShipObjectTemplate::getCockpitFilename() const { -#ifdef _DEBUG -std::string testDataValue = DefaultString; -#else -UNREF(testData); -#endif + const SharedShipObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getCockpitFilename(true); -#endif } if (!m_cockpitFilename.isLoaded()) @@ -180,31 +172,18 @@ UNREF(testData); } const std::string & value = m_cockpitFilename.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedShipObjectTemplate::getCockpitFilename -bool SharedShipObjectTemplate::getHasWings(bool testData) const +bool SharedShipObjectTemplate::getHasWings() const { -#ifdef _DEBUG -bool testDataValue = false; -#else -UNREF(testData); -#endif + const SharedShipObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getHasWings(true); -#endif } if (!m_hasWings.isLoaded()) @@ -222,31 +201,18 @@ UNREF(testData); } bool value = m_hasWings.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedShipObjectTemplate::getHasWings -bool SharedShipObjectTemplate::getPlayerControlled(bool testData) const +bool SharedShipObjectTemplate::getPlayerControlled() const { -#ifdef _DEBUG -bool testDataValue = false; -#else -UNREF(testData); -#endif + const SharedShipObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getPlayerControlled(true); -#endif } if (!m_playerControlled.isLoaded()) @@ -264,31 +230,18 @@ UNREF(testData); } bool value = m_playerControlled.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedShipObjectTemplate::getPlayerControlled -const std::string & SharedShipObjectTemplate::getInteriorLayoutFileName(bool testData) const +const std::string & SharedShipObjectTemplate::getInteriorLayoutFileName() const { -#ifdef _DEBUG -std::string testDataValue = DefaultString; -#else -UNREF(testData); -#endif + const SharedShipObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getInteriorLayoutFileName(true); -#endif } if (!m_interiorLayoutFileName.isLoaded()) @@ -306,28 +259,10 @@ UNREF(testData); } const std::string & value = m_interiorLayoutFileName.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedShipObjectTemplate::getInteriorLayoutFileName -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void SharedShipObjectTemplate::testValues(void) const -{ - IGNORE_RETURN(getCockpitFilename(true)); - IGNORE_RETURN(getHasWings(true)); - IGNORE_RETURN(getPlayerControlled(true)); - IGNORE_RETURN(getInteriorLayoutFileName(true)); - SharedTangibleObjectTemplate::testValues(); -} // SharedShipObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -370,8 +305,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,4)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedShipObjectTemplate.h b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedShipObjectTemplate.h index abbdb08e..d5621428 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedShipObjectTemplate.h +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedShipObjectTemplate.h @@ -45,16 +45,11 @@ public: //@BEGIN TFD public: - const std::string & getCockpitFilename(bool testData = false) const; - bool getHasWings(bool testData = false) const; - bool getPlayerControlled(bool testData = false) const; - const std::string & getInteriorLayoutFileName(bool testData = false) const; + const std::string & getCockpitFilename() const; + bool getHasWings() const; + bool getPlayerControlled() const; + const std::string & getInteriorLayoutFileName() const; -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedStaticObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedStaticObjectTemplate.cpp index 3de71cf2..d1b4ebea 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedStaticObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedStaticObjectTemplate.cpp @@ -103,15 +103,6 @@ Tag SharedStaticObjectTemplate::getHighestTemplateVersion(void) const } // SharedStaticObjectTemplate::getHighestTemplateVersion //@BEGIN TFD -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void SharedStaticObjectTemplate::testValues(void) const -{ - SharedObjectTemplate::testValues(); -} // SharedStaticObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -154,8 +145,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,0)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedStaticObjectTemplate.h b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedStaticObjectTemplate.h index cc22dc7e..6f76144f 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedStaticObjectTemplate.h +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedStaticObjectTemplate.h @@ -45,11 +45,6 @@ public: //@BEGIN TFD public: -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTangibleObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTangibleObjectTemplate.cpp index 95742f60..4adbfc5b 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTangibleObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTangibleObjectTemplate.cpp @@ -262,16 +262,6 @@ void SharedTangibleObjectTemplate::createCustomizationDataPropertyAsNeeded(Objec AssetCustomizationManager::addCustomizationVariablesForAsset(TemporaryCrcString(getAppearanceFilename().c_str(), true), *customizationData, skipSharedOwnerVariables); -#ifdef _DEBUG - //-- set up mappings for any variables which need dependent mappings - int numVariableMappings = getCustomizationVariableMappingCount(); - if(numVariableMappings != 0) - { - //If the object is a wearable, then the dependent variable, which is probably shared, will not exist at the moment the dependency - //is set up. For this reason, make sure that you're really doing what you want. - DEBUG_WARNING(true, ("Generally, CustomizationVariableMapping should not be set on Wearables or other non-Creature tangibles.")); - } -#endif //-- release local reference to the CustomizationData instance customizationData->release(); @@ -879,22 +869,14 @@ size_t SharedTangibleObjectTemplate::getSocketDestinationsCount(void) const return count; } // SharedTangibleObjectTemplate::getSocketDestinationsCount -const std::string & SharedTangibleObjectTemplate::getStructureFootprintFileName(bool testData) const +const std::string & SharedTangibleObjectTemplate::getStructureFootprintFileName() const { -#ifdef _DEBUG -std::string testDataValue = DefaultString; -#else -UNREF(testData); -#endif + const SharedTangibleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getStructureFootprintFileName(true); -#endif } if (!m_structureFootprintFileName.isLoaded()) @@ -912,31 +894,18 @@ UNREF(testData); } const std::string & value = m_structureFootprintFileName.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedTangibleObjectTemplate::getStructureFootprintFileName -bool SharedTangibleObjectTemplate::getUseStructureFootprintOutline(bool testData) const +bool SharedTangibleObjectTemplate::getUseStructureFootprintOutline() const { -#ifdef _DEBUG -bool testDataValue = false; -#else -UNREF(testData); -#endif + const SharedTangibleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getUseStructureFootprintOutline(true); -#endif } if (!m_useStructureFootprintOutline.isLoaded()) @@ -954,31 +923,18 @@ UNREF(testData); } bool value = m_useStructureFootprintOutline.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedTangibleObjectTemplate::getUseStructureFootprintOutline -bool SharedTangibleObjectTemplate::getTargetable(bool testData) const +bool SharedTangibleObjectTemplate::getTargetable() const { -#ifdef _DEBUG -bool testDataValue = false; -#else -UNREF(testData); -#endif + const SharedTangibleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getTargetable(true); -#endif } if (!m_targetable.isLoaded()) @@ -996,11 +952,6 @@ UNREF(testData); } bool value = m_targetable.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedTangibleObjectTemplate::getTargetable @@ -1217,22 +1168,14 @@ size_t SharedTangibleObjectTemplate::getCustomizationVariableMappingCount(void) return count; } // SharedTangibleObjectTemplate::getCustomizationVariableMappingCount -SharedTangibleObjectTemplate::ClientVisabilityFlags SharedTangibleObjectTemplate::getClientVisabilityFlag(bool testData) const +SharedTangibleObjectTemplate::ClientVisabilityFlags SharedTangibleObjectTemplate::getClientVisabilityFlag() const { -#ifdef _DEBUG -SharedTangibleObjectTemplate::ClientVisabilityFlags testDataValue = static_cast(0); -#else -UNREF(testData); -#endif + const SharedTangibleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getClientVisabilityFlag(true); -#endif } if (!m_clientVisabilityFlag.isLoaded()) @@ -1250,28 +1193,10 @@ UNREF(testData); } ClientVisabilityFlags value = static_cast(m_clientVisabilityFlag.getValue()); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedTangibleObjectTemplate::getClientVisabilityFlag -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void SharedTangibleObjectTemplate::testValues(void) const -{ - IGNORE_RETURN(getStructureFootprintFileName(true)); - IGNORE_RETURN(getUseStructureFootprintOutline(true)); - IGNORE_RETURN(getTargetable(true)); - IGNORE_RETURN(getClientVisabilityFlag(true)); - SharedObjectTemplate::testValues(); -} // SharedTangibleObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -1314,8 +1239,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,1,0)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } @@ -1506,22 +1431,14 @@ Tag SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::getId(void) return _ConstStringCustomizationVariable_tag; } // SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::getId -const std::string & SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::getVariableName(bool versionOk, bool testData) const +const std::string & SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::getVariableName(bool versionOk, ) const { -#ifdef _DEBUG -std::string testDataValue = DefaultString; -#else -UNREF(testData); -#endif + const SharedTangibleObjectTemplate::_ConstStringCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getVariableName(true); -#endif } if (!m_variableName.isLoaded()) @@ -1539,31 +1456,18 @@ UNREF(testData); } const std::string & value = m_variableName.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::getVariableName -const std::string & SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::getConstValue(bool versionOk, bool testData) const +const std::string & SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::getConstValue(bool versionOk, ) const { -#ifdef _DEBUG -std::string testDataValue = DefaultString; -#else -UNREF(testData); -#endif + const SharedTangibleObjectTemplate::_ConstStringCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getConstValue(true); -#endif } if (!m_constValue.isLoaded()) @@ -1581,25 +1485,10 @@ UNREF(testData); } const std::string & value = m_constValue.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::getConstValue -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::testValues(void) const -{ - IGNORE_RETURN(getVariableName(true)); - IGNORE_RETURN(getConstValue(true)); -} // SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -1679,22 +1568,14 @@ Tag SharedTangibleObjectTemplate::_CustomizationVariableMapping::getId(void) con return _CustomizationVariableMapping_tag; } // SharedTangibleObjectTemplate::_CustomizationVariableMapping::getId -const std::string & SharedTangibleObjectTemplate::_CustomizationVariableMapping::getSourceVariable(bool versionOk, bool testData) const +const std::string & SharedTangibleObjectTemplate::_CustomizationVariableMapping::getSourceVariable(bool versionOk, ) const { -#ifdef _DEBUG -std::string testDataValue = DefaultString; -#else -UNREF(testData); -#endif + const SharedTangibleObjectTemplate::_CustomizationVariableMapping * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getSourceVariable(true); -#endif } if (!m_sourceVariable.isLoaded()) @@ -1712,31 +1593,18 @@ UNREF(testData); } const std::string & value = m_sourceVariable.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedTangibleObjectTemplate::_CustomizationVariableMapping::getSourceVariable -const std::string & SharedTangibleObjectTemplate::_CustomizationVariableMapping::getDependentVariable(bool versionOk, bool testData) const +const std::string & SharedTangibleObjectTemplate::_CustomizationVariableMapping::getDependentVariable(bool versionOk, ) const { -#ifdef _DEBUG -std::string testDataValue = DefaultString; -#else -UNREF(testData); -#endif + const SharedTangibleObjectTemplate::_CustomizationVariableMapping * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getDependentVariable(true); -#endif } if (!m_dependentVariable.isLoaded()) @@ -1754,25 +1622,10 @@ UNREF(testData); } const std::string & value = m_dependentVariable.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedTangibleObjectTemplate::_CustomizationVariableMapping::getDependentVariable -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void SharedTangibleObjectTemplate::_CustomizationVariableMapping::testValues(void) const -{ - IGNORE_RETURN(getSourceVariable(true)); - IGNORE_RETURN(getDependentVariable(true)); -} // SharedTangibleObjectTemplate::_CustomizationVariableMapping::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -1852,22 +1705,14 @@ Tag SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getId(void return _PaletteColorCustomizationVariable_tag; } // SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getId -const std::string & SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getVariableName(bool versionOk, bool testData) const +const std::string & SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getVariableName(bool versionOk, ) const { -#ifdef _DEBUG -std::string testDataValue = DefaultString; -#else -UNREF(testData); -#endif + const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getVariableName(true); -#endif } if (!m_variableName.isLoaded()) @@ -1885,31 +1730,18 @@ UNREF(testData); } const std::string & value = m_variableName.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getVariableName -const std::string & SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getPalettePathName(bool versionOk, bool testData) const +const std::string & SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getPalettePathName(bool versionOk, ) const { -#ifdef _DEBUG -std::string testDataValue = DefaultString; -#else -UNREF(testData); -#endif + const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getPalettePathName(true); -#endif } if (!m_palettePathName.isLoaded()) @@ -1927,31 +1759,18 @@ UNREF(testData); } const std::string & value = m_palettePathName.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getPalettePathName -int SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getDefaultPaletteIndex(bool versionOk, bool testData) const +int SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getDefaultPaletteIndex(bool versionOk, ) const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getDefaultPaletteIndex(true); -#endif } if (!m_defaultPaletteIndex.isLoaded()) @@ -1991,31 +1810,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getDefaultPaletteIndex -int SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getDefaultPaletteIndexMin(bool versionOk, bool testData) const +int SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getDefaultPaletteIndexMin(bool versionOk, ) const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getDefaultPaletteIndexMin(true); -#endif } if (!m_defaultPaletteIndex.isLoaded()) @@ -2055,31 +1861,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getDefaultPaletteIndexMin -int SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getDefaultPaletteIndexMax(bool versionOk, bool testData) const +int SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getDefaultPaletteIndexMax(bool versionOk, ) const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getDefaultPaletteIndexMax(true); -#endif } if (!m_defaultPaletteIndex.isLoaded()) @@ -2119,27 +1912,10 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getDefaultPaletteIndexMax -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::testValues(void) const -{ - IGNORE_RETURN(getVariableName(true)); - IGNORE_RETURN(getPalettePathName(true)); - IGNORE_RETURN(getDefaultPaletteIndexMin(true)); - IGNORE_RETURN(getDefaultPaletteIndexMax(true)); -} // SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -2221,22 +1997,14 @@ Tag SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getId(void) c return _RangedIntCustomizationVariable_tag; } // SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getId -const std::string & SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getVariableName(bool versionOk, bool testData) const +const std::string & SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getVariableName(bool versionOk, ) const { -#ifdef _DEBUG -std::string testDataValue = DefaultString; -#else -UNREF(testData); -#endif + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getVariableName(true); -#endif } if (!m_variableName.isLoaded()) @@ -2254,31 +2022,18 @@ UNREF(testData); } const std::string & value = m_variableName.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getVariableName -int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMinValueInclusive(bool versionOk, bool testData) const +int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMinValueInclusive(bool versionOk, ) const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMinValueInclusive(true); -#endif } if (!m_minValueInclusive.isLoaded()) @@ -2318,31 +2073,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMinValueInclusive -int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMinValueInclusiveMin(bool versionOk, bool testData) const +int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMinValueInclusiveMin(bool versionOk, ) const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMinValueInclusiveMin(true); -#endif } if (!m_minValueInclusive.isLoaded()) @@ -2382,31 +2124,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMinValueInclusiveMin -int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMinValueInclusiveMax(bool versionOk, bool testData) const +int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMinValueInclusiveMax(bool versionOk, ) const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMinValueInclusiveMax(true); -#endif } if (!m_minValueInclusive.isLoaded()) @@ -2446,31 +2175,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMinValueInclusiveMax -int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getDefaultValue(bool versionOk, bool testData) const +int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getDefaultValue(bool versionOk, ) const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getDefaultValue(true); -#endif } if (!m_defaultValue.isLoaded()) @@ -2510,31 +2226,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getDefaultValue -int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getDefaultValueMin(bool versionOk, bool testData) const +int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getDefaultValueMin(bool versionOk, ) const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getDefaultValueMin(true); -#endif } if (!m_defaultValue.isLoaded()) @@ -2574,31 +2277,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getDefaultValueMin -int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getDefaultValueMax(bool versionOk, bool testData) const +int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getDefaultValueMax(bool versionOk, ) const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getDefaultValueMax(true); -#endif } if (!m_defaultValue.isLoaded()) @@ -2638,31 +2328,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getDefaultValueMax -int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMaxValueExclusive(bool versionOk, bool testData) const +int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMaxValueExclusive(bool versionOk, ) const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMaxValueExclusive(true); -#endif } if (!m_maxValueExclusive.isLoaded()) @@ -2702,31 +2379,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMaxValueExclusive -int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMaxValueExclusiveMin(bool versionOk, bool testData) const +int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMaxValueExclusiveMin(bool versionOk, ) const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMaxValueExclusiveMin(true); -#endif } if (!m_maxValueExclusive.isLoaded()) @@ -2766,31 +2430,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMaxValueExclusiveMin -int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMaxValueExclusiveMax(bool versionOk, bool testData) const +int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMaxValueExclusiveMax(bool versionOk, ) const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMaxValueExclusiveMax(true); -#endif } if (!m_maxValueExclusive.isLoaded()) @@ -2830,30 +2481,10 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMaxValueExclusiveMax -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::testValues(void) const -{ - IGNORE_RETURN(getVariableName(true)); - IGNORE_RETURN(getMinValueInclusiveMin(true)); - IGNORE_RETURN(getMinValueInclusiveMax(true)); - IGNORE_RETURN(getDefaultValueMin(true)); - IGNORE_RETURN(getDefaultValueMax(true)); - IGNORE_RETURN(getMaxValueExclusiveMin(true)); - IGNORE_RETURN(getMaxValueExclusiveMax(true)); -} // SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTangibleObjectTemplate.h b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTangibleObjectTemplate.h index 7cd54f53..a90413ce 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTangibleObjectTemplate.h +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTangibleObjectTemplate.h @@ -97,22 +97,17 @@ protected: virtual Tag getId(void) const; public: - const std::string & getVariableName(bool versionOk, bool testData = false) const; - int getMinValueInclusive(bool versionOk, bool testData = false) const; - int getMinValueInclusiveMin(bool versionOk, bool testData = false) const; - int getMinValueInclusiveMax(bool versionOk, bool testData = false) const; - int getDefaultValue(bool versionOk, bool testData = false) const; - int getDefaultValueMin(bool versionOk, bool testData = false) const; - int getDefaultValueMax(bool versionOk, bool testData = false) const; - int getMaxValueExclusive(bool versionOk, bool testData = false) const; - int getMaxValueExclusiveMin(bool versionOk, bool testData = false) const; - int getMaxValueExclusiveMax(bool versionOk, bool testData = false) const; + const std::string & getVariableName(bool versionOk) const; + int getMinValueInclusive(bool versionOk) const; + int getMinValueInclusiveMin(bool versionOk) const; + int getMinValueInclusiveMax(bool versionOk) const; + int getDefaultValue(bool versionOk) const; + int getDefaultValueMin(bool versionOk) const; + int getDefaultValueMax(bool versionOk) const; + int getMaxValueExclusive(bool versionOk) const; + int getMaxValueExclusiveMin(bool versionOk) const; + int getMaxValueExclusiveMax(bool versionOk) const; -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); @@ -147,17 +142,12 @@ private: virtual Tag getId(void) const; public: - const std::string & getVariableName(bool versionOk, bool testData = false) const; - const std::string & getPalettePathName(bool versionOk, bool testData = false) const; - int getDefaultPaletteIndex(bool versionOk, bool testData = false) const; - int getDefaultPaletteIndexMin(bool versionOk, bool testData = false) const; - int getDefaultPaletteIndexMax(bool versionOk, bool testData = false) const; + const std::string & getVariableName(bool versionOk) const; + const std::string & getPalettePathName(bool versionOk) const; + int getDefaultPaletteIndex(bool versionOk) const; + int getDefaultPaletteIndexMin(bool versionOk) const; + int getDefaultPaletteIndexMax(bool versionOk) const; -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); @@ -191,14 +181,9 @@ private: virtual Tag getId(void) const; public: - const std::string & getVariableName(bool versionOk, bool testData = false) const; - const std::string & getConstValue(bool versionOk, bool testData = false) const; + const std::string & getVariableName(bool versionOk) const; + const std::string & getConstValue(bool versionOk) const; -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); @@ -231,14 +216,9 @@ private: virtual Tag getId(void) const; public: - const std::string & getSourceVariable(bool versionOk, bool testData = false) const; - const std::string & getDependentVariable(bool versionOk, bool testData = false) const; + const std::string & getSourceVariable(bool versionOk) const; + const std::string & getDependentVariable(bool versionOk) const; -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); @@ -270,22 +250,17 @@ public: size_t getConstStringCustomizationVariablesCount(void) const; GameObjectType getSocketDestinations(int index) const; size_t getSocketDestinationsCount(void) const; - const std::string & getStructureFootprintFileName(bool testData = false) const; - bool getUseStructureFootprintOutline(bool testData = false) const; - bool getTargetable(bool testData = false) const; + const std::string & getStructureFootprintFileName() const; + bool getUseStructureFootprintOutline() const; + bool getTargetable() const; const std::string & getCertificationsRequired(int index) const; size_t getCertificationsRequiredCount(void) const; void getCustomizationVariableMapping(CustomizationVariableMapping &data, int index) const; void getCustomizationVariableMappingMin(CustomizationVariableMapping &data, int index) const; void getCustomizationVariableMappingMax(CustomizationVariableMapping &data, int index) const; size_t getCustomizationVariableMappingCount(void) const; - ClientVisabilityFlags getClientVisabilityFlag(bool testData = false) const; + ClientVisabilityFlags getClientVisabilityFlag() const; -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTerrainSurfaceObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTerrainSurfaceObjectTemplate.cpp index b518a9f7..b0724d3a 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTerrainSurfaceObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTerrainSurfaceObjectTemplate.cpp @@ -12,7 +12,7 @@ #include "sharedGame/FirstSharedGame.h" #include "SharedTerrainSurfaceObjectTemplate.h" -#include "sharedDebug/DataLint.h" + #include "sharedFile/Iff.h" #include "sharedMath/Vector.h" #include "sharedObject/ObjectTemplateList.h" @@ -103,22 +103,14 @@ Tag SharedTerrainSurfaceObjectTemplate::getHighestTemplateVersion(void) const } // SharedTerrainSurfaceObjectTemplate::getHighestTemplateVersion //@BEGIN TFD -float SharedTerrainSurfaceObjectTemplate::getCover(bool testData) const +float SharedTerrainSurfaceObjectTemplate::getCover() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedTerrainSurfaceObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getCover(true); -#endif } if (!m_cover.isLoaded()) @@ -158,33 +150,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - if (testDataValue == value) - DEBUG_WARNING(true, ("Template %s, parameter cover is returning same value as base template.", DataResource::getName())); - } -#endif return value; } // SharedTerrainSurfaceObjectTemplate::getCover -float SharedTerrainSurfaceObjectTemplate::getCoverMin(bool testData) const +float SharedTerrainSurfaceObjectTemplate::getCoverMin() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedTerrainSurfaceObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getCoverMin(true); -#endif } if (!m_cover.isLoaded()) @@ -224,33 +201,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - if (testDataValue == value) - DEBUG_WARNING(true, ("Template %s, parameter cover is returning same value as base template.", DataResource::getName())); - } -#endif return value; } // SharedTerrainSurfaceObjectTemplate::getCoverMin -float SharedTerrainSurfaceObjectTemplate::getCoverMax(bool testData) const +float SharedTerrainSurfaceObjectTemplate::getCoverMax() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedTerrainSurfaceObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getCoverMax(true); -#endif } if (!m_cover.isLoaded()) @@ -290,33 +252,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - if (testDataValue == value) - DEBUG_WARNING(true, ("Template %s, parameter cover is returning same value as base template.", DataResource::getName())); - } -#endif return value; } // SharedTerrainSurfaceObjectTemplate::getCoverMax -const std::string & SharedTerrainSurfaceObjectTemplate::getSurfaceType(bool testData) const +const std::string & SharedTerrainSurfaceObjectTemplate::getSurfaceType() const { -#ifdef _DEBUG -std::string testDataValue = DefaultString; -#else -UNREF(testData); -#endif + const SharedTerrainSurfaceObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getSurfaceType(true); -#endif } if (!m_surfaceType.isLoaded()) @@ -334,28 +281,10 @@ UNREF(testData); } const std::string & value = m_surfaceType.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - if (testDataValue == value) - DEBUG_WARNING(true, ("Template %s, parameter surfaceType is returning same value as base template.", DataResource::getName())); - } -#endif return value; } // SharedTerrainSurfaceObjectTemplate::getSurfaceType -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void SharedTerrainSurfaceObjectTemplate::testValues(void) const -{ - IGNORE_RETURN(getCoverMin(true)); - IGNORE_RETURN(getCoverMax(true)); - IGNORE_RETURN(getSurfaceType(true)); -} // SharedTerrainSurfaceObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -397,8 +326,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,0)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTerrainSurfaceObjectTemplate.h b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTerrainSurfaceObjectTemplate.h index bf5265e7..4d2feaf9 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTerrainSurfaceObjectTemplate.h +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTerrainSurfaceObjectTemplate.h @@ -44,16 +44,11 @@ public: //@BEGIN TFD public: - float getCover(bool testData = false) const; - float getCoverMin(bool testData = false) const; - float getCoverMax(bool testData = false) const; - const std::string & getSurfaceType(bool testData = false) const; + float getCover() const; + float getCoverMin() const; + float getCoverMax() const; + const std::string & getSurfaceType() const; -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedUniverseObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedUniverseObjectTemplate.cpp index c6e9b692..bb5fbff4 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedUniverseObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedUniverseObjectTemplate.cpp @@ -12,7 +12,7 @@ #include "sharedGame/FirstSharedGame.h" #include "SharedUniverseObjectTemplate.h" -#include "sharedDebug/DataLint.h" + #include "sharedFile/Iff.h" #include "sharedMath/Vector.h" #include "sharedObject/ObjectTemplate.h" @@ -104,15 +104,6 @@ Tag SharedUniverseObjectTemplate::getHighestTemplateVersion(void) const } // SharedUniverseObjectTemplate::getHighestTemplateVersion //@BEGIN TFD -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void SharedUniverseObjectTemplate::testValues(void) const -{ - SharedObjectTemplate::testValues(); -} // SharedUniverseObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -155,8 +146,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,0)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedUniverseObjectTemplate.h b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedUniverseObjectTemplate.h index 1968e4eb..369199b4 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedUniverseObjectTemplate.h +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedUniverseObjectTemplate.h @@ -45,11 +45,6 @@ public: //@BEGIN TFD public: -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedVehicleObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedVehicleObjectTemplate.cpp index 7467cf59..b48e6d42 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedVehicleObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedVehicleObjectTemplate.cpp @@ -250,22 +250,14 @@ float SharedVehicleObjectTemplate::getSpeedMax(MovementTypes index) const return value; } // SharedVehicleObjectTemplate::getSpeedMax -float SharedVehicleObjectTemplate::getSlopeAversion(bool testData) const +float SharedVehicleObjectTemplate::getSlopeAversion() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getSlopeAversion(true); -#endif } if (!m_slopeAversion.isLoaded()) @@ -305,31 +297,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedVehicleObjectTemplate::getSlopeAversion -float SharedVehicleObjectTemplate::getSlopeAversionMin(bool testData) const +float SharedVehicleObjectTemplate::getSlopeAversionMin() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getSlopeAversionMin(true); -#endif } if (!m_slopeAversion.isLoaded()) @@ -369,31 +348,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedVehicleObjectTemplate::getSlopeAversionMin -float SharedVehicleObjectTemplate::getSlopeAversionMax(bool testData) const +float SharedVehicleObjectTemplate::getSlopeAversionMax() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getSlopeAversionMax(true); -#endif } if (!m_slopeAversion.isLoaded()) @@ -433,31 +399,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedVehicleObjectTemplate::getSlopeAversionMax -float SharedVehicleObjectTemplate::getHoverValue(bool testData) const +float SharedVehicleObjectTemplate::getHoverValue() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getHoverValue(true); -#endif } if (!m_hoverValue.isLoaded()) @@ -497,31 +450,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedVehicleObjectTemplate::getHoverValue -float SharedVehicleObjectTemplate::getHoverValueMin(bool testData) const +float SharedVehicleObjectTemplate::getHoverValueMin() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getHoverValueMin(true); -#endif } if (!m_hoverValue.isLoaded()) @@ -561,31 +501,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedVehicleObjectTemplate::getHoverValueMin -float SharedVehicleObjectTemplate::getHoverValueMax(bool testData) const +float SharedVehicleObjectTemplate::getHoverValueMax() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getHoverValueMax(true); -#endif } if (!m_hoverValue.isLoaded()) @@ -625,31 +552,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedVehicleObjectTemplate::getHoverValueMax -float SharedVehicleObjectTemplate::getTurnRate(bool testData) const +float SharedVehicleObjectTemplate::getTurnRate() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getTurnRate(true); -#endif } if (!m_turnRate.isLoaded()) @@ -689,31 +603,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedVehicleObjectTemplate::getTurnRate -float SharedVehicleObjectTemplate::getTurnRateMin(bool testData) const +float SharedVehicleObjectTemplate::getTurnRateMin() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getTurnRateMin(true); -#endif } if (!m_turnRate.isLoaded()) @@ -753,31 +654,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedVehicleObjectTemplate::getTurnRateMin -float SharedVehicleObjectTemplate::getTurnRateMax(bool testData) const +float SharedVehicleObjectTemplate::getTurnRateMax() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getTurnRateMax(true); -#endif } if (!m_turnRate.isLoaded()) @@ -817,31 +705,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedVehicleObjectTemplate::getTurnRateMax -float SharedVehicleObjectTemplate::getMaxVelocity(bool testData) const +float SharedVehicleObjectTemplate::getMaxVelocity() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMaxVelocity(true); -#endif } if (!m_maxVelocity.isLoaded()) @@ -881,31 +756,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedVehicleObjectTemplate::getMaxVelocity -float SharedVehicleObjectTemplate::getMaxVelocityMin(bool testData) const +float SharedVehicleObjectTemplate::getMaxVelocityMin() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMaxVelocityMin(true); -#endif } if (!m_maxVelocity.isLoaded()) @@ -945,31 +807,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedVehicleObjectTemplate::getMaxVelocityMin -float SharedVehicleObjectTemplate::getMaxVelocityMax(bool testData) const +float SharedVehicleObjectTemplate::getMaxVelocityMax() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMaxVelocityMax(true); -#endif } if (!m_maxVelocity.isLoaded()) @@ -1009,31 +858,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedVehicleObjectTemplate::getMaxVelocityMax -float SharedVehicleObjectTemplate::getAcceleration(bool testData) const +float SharedVehicleObjectTemplate::getAcceleration() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getAcceleration(true); -#endif } if (!m_acceleration.isLoaded()) @@ -1073,31 +909,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedVehicleObjectTemplate::getAcceleration -float SharedVehicleObjectTemplate::getAccelerationMin(bool testData) const +float SharedVehicleObjectTemplate::getAccelerationMin() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getAccelerationMin(true); -#endif } if (!m_acceleration.isLoaded()) @@ -1137,31 +960,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedVehicleObjectTemplate::getAccelerationMin -float SharedVehicleObjectTemplate::getAccelerationMax(bool testData) const +float SharedVehicleObjectTemplate::getAccelerationMax() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getAccelerationMax(true); -#endif } if (!m_acceleration.isLoaded()) @@ -1201,31 +1011,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedVehicleObjectTemplate::getAccelerationMax -float SharedVehicleObjectTemplate::getBraking(bool testData) const +float SharedVehicleObjectTemplate::getBraking() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getBraking(true); -#endif } if (!m_braking.isLoaded()) @@ -1265,31 +1062,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedVehicleObjectTemplate::getBraking -float SharedVehicleObjectTemplate::getBrakingMin(bool testData) const +float SharedVehicleObjectTemplate::getBrakingMin() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getBrakingMin(true); -#endif } if (!m_braking.isLoaded()) @@ -1329,31 +1113,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedVehicleObjectTemplate::getBrakingMin -float SharedVehicleObjectTemplate::getBrakingMax(bool testData) const +float SharedVehicleObjectTemplate::getBrakingMax() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getBrakingMax(true); -#endif } if (!m_braking.isLoaded()) @@ -1393,36 +1164,10 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedVehicleObjectTemplate::getBrakingMax -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void SharedVehicleObjectTemplate::testValues(void) const -{ - IGNORE_RETURN(getSlopeAversionMin(true)); - IGNORE_RETURN(getSlopeAversionMax(true)); - IGNORE_RETURN(getHoverValueMin(true)); - IGNORE_RETURN(getHoverValueMax(true)); - IGNORE_RETURN(getTurnRateMin(true)); - IGNORE_RETURN(getTurnRateMax(true)); - IGNORE_RETURN(getMaxVelocityMin(true)); - IGNORE_RETURN(getMaxVelocityMax(true)); - IGNORE_RETURN(getAccelerationMin(true)); - IGNORE_RETURN(getAccelerationMax(true)); - IGNORE_RETURN(getBrakingMin(true)); - IGNORE_RETURN(getBrakingMax(true)); - SharedTangibleObjectTemplate::testValues(); -} // SharedVehicleObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -1465,8 +1210,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,0)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedVehicleObjectTemplate.h b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedVehicleObjectTemplate.h index 4da4d4c1..739aec05 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedVehicleObjectTemplate.h +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedVehicleObjectTemplate.h @@ -58,30 +58,25 @@ public: float getSpeed(MovementTypes index) const; float getSpeedMin(MovementTypes index) const; float getSpeedMax(MovementTypes index) const; - float getSlopeAversion(bool testData = false) const; - float getSlopeAversionMin(bool testData = false) const; - float getSlopeAversionMax(bool testData = false) const; - float getHoverValue(bool testData = false) const; - float getHoverValueMin(bool testData = false) const; - float getHoverValueMax(bool testData = false) const; - float getTurnRate(bool testData = false) const; - float getTurnRateMin(bool testData = false) const; - float getTurnRateMax(bool testData = false) const; - float getMaxVelocity(bool testData = false) const; - float getMaxVelocityMin(bool testData = false) const; - float getMaxVelocityMax(bool testData = false) const; - float getAcceleration(bool testData = false) const; - float getAccelerationMin(bool testData = false) const; - float getAccelerationMax(bool testData = false) const; - float getBraking(bool testData = false) const; - float getBrakingMin(bool testData = false) const; - float getBrakingMax(bool testData = false) const; + float getSlopeAversion() const; + float getSlopeAversionMin() const; + float getSlopeAversionMax() const; + float getHoverValue() const; + float getHoverValueMin() const; + float getHoverValueMax() const; + float getTurnRate() const; + float getTurnRateMin() const; + float getTurnRateMax() const; + float getMaxVelocity() const; + float getMaxVelocityMin() const; + float getMaxVelocityMax() const; + float getAcceleration() const; + float getAccelerationMin() const; + float getAccelerationMax() const; + float getBraking() const; + float getBrakingMin() const; + float getBrakingMax() const; -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWaypointObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWaypointObjectTemplate.cpp index 2d82cd46..a5f730a2 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWaypointObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWaypointObjectTemplate.cpp @@ -103,15 +103,6 @@ Tag SharedWaypointObjectTemplate::getHighestTemplateVersion(void) const } // SharedWaypointObjectTemplate::getHighestTemplateVersion //@BEGIN TFD -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void SharedWaypointObjectTemplate::testValues(void) const -{ - SharedIntangibleObjectTemplate::testValues(); -} // SharedWaypointObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -154,8 +145,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,0)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWaypointObjectTemplate.h b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWaypointObjectTemplate.h index 4fb31a6b..7bb0e2ec 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWaypointObjectTemplate.h +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWaypointObjectTemplate.h @@ -45,11 +45,6 @@ public: //@BEGIN TFD public: -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWeaponObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWeaponObjectTemplate.cpp index 193d4ac7..4b8d05b7 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWeaponObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWeaponObjectTemplate.cpp @@ -103,22 +103,14 @@ Tag SharedWeaponObjectTemplate::getHighestTemplateVersion(void) const } // SharedWeaponObjectTemplate::getHighestTemplateVersion //@BEGIN TFD -const std::string & SharedWeaponObjectTemplate::getWeaponEffect(bool testData) const +const std::string & SharedWeaponObjectTemplate::getWeaponEffect() const { -#ifdef _DEBUG -std::string testDataValue = DefaultString; -#else -UNREF(testData); -#endif + const SharedWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getWeaponEffect(true); -#endif } if (!m_weaponEffect.isLoaded()) @@ -136,31 +128,18 @@ UNREF(testData); } const std::string & value = m_weaponEffect.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedWeaponObjectTemplate::getWeaponEffect -int SharedWeaponObjectTemplate::getWeaponEffectIndex(bool testData) const +int SharedWeaponObjectTemplate::getWeaponEffectIndex() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const SharedWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getWeaponEffectIndex(true); -#endif } if (!m_weaponEffectIndex.isLoaded()) @@ -200,31 +179,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedWeaponObjectTemplate::getWeaponEffectIndex -int SharedWeaponObjectTemplate::getWeaponEffectIndexMin(bool testData) const +int SharedWeaponObjectTemplate::getWeaponEffectIndexMin() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const SharedWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getWeaponEffectIndexMin(true); -#endif } if (!m_weaponEffectIndex.isLoaded()) @@ -264,31 +230,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedWeaponObjectTemplate::getWeaponEffectIndexMin -int SharedWeaponObjectTemplate::getWeaponEffectIndexMax(bool testData) const +int SharedWeaponObjectTemplate::getWeaponEffectIndexMax() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const SharedWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getWeaponEffectIndexMax(true); -#endif } if (!m_weaponEffectIndex.isLoaded()) @@ -328,31 +281,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedWeaponObjectTemplate::getWeaponEffectIndexMax -SharedWeaponObjectTemplate::AttackType SharedWeaponObjectTemplate::getAttackType(bool testData) const +SharedWeaponObjectTemplate::AttackType SharedWeaponObjectTemplate::getAttackType() const { -#ifdef _DEBUG -SharedWeaponObjectTemplate::AttackType testDataValue = static_cast(0); -#else -UNREF(testData); -#endif + const SharedWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getAttackType(true); -#endif } if (!m_attackType.isLoaded()) @@ -370,28 +310,10 @@ UNREF(testData); } AttackType value = static_cast(m_attackType.getValue()); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // SharedWeaponObjectTemplate::getAttackType -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void SharedWeaponObjectTemplate::testValues(void) const -{ - IGNORE_RETURN(getWeaponEffect(true)); - IGNORE_RETURN(getWeaponEffectIndexMin(true)); - IGNORE_RETURN(getWeaponEffectIndexMax(true)); - IGNORE_RETURN(getAttackType(true)); - SharedTangibleObjectTemplate::testValues(); -} // SharedWeaponObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -434,8 +356,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,4)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWeaponObjectTemplate.h b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWeaponObjectTemplate.h index ba4d771c..ddcf638c 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWeaponObjectTemplate.h +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWeaponObjectTemplate.h @@ -54,17 +54,12 @@ public: }; public: - const std::string & getWeaponEffect(bool testData = false) const; - int getWeaponEffectIndex(bool testData = false) const; - int getWeaponEffectIndexMin(bool testData = false) const; - int getWeaponEffectIndexMax(bool testData = false) const; - AttackType getAttackType(bool testData = false) const; + const std::string & getWeaponEffect() const; + int getWeaponEffectIndex() const; + int getWeaponEffectIndexMin() const; + int getWeaponEffectIndexMax() const; + AttackType getAttackType() const; -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); From b26cc655ba9e232db1368f44ab81e54cbed086d0 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Thu, 24 Mar 2016 16:57:07 +0000 Subject: [PATCH 051/302] missed a couple things with sed --- .../SharedDraftSchematicObjectTemplate.cpp | 14 +++---- .../SharedTangibleObjectTemplate.cpp | 38 +++++++++---------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedDraftSchematicObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedDraftSchematicObjectTemplate.cpp index 50b15cd6..658899be 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedDraftSchematicObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedDraftSchematicObjectTemplate.cpp @@ -615,7 +615,7 @@ Tag SharedDraftSchematicObjectTemplate::_IngredientSlot::getId(void) const return _IngredientSlot_tag; } // SharedDraftSchematicObjectTemplate::_IngredientSlot::getId -const StringId SharedDraftSchematicObjectTemplate::_IngredientSlot::getName(bool versionOk, ) const +const StringId SharedDraftSchematicObjectTemplate::_IngredientSlot::getName(bool versionOk) const { @@ -644,7 +644,7 @@ const StringId SharedDraftSchematicObjectTemplate::_IngredientSlot::getName(bool return value; } // SharedDraftSchematicObjectTemplate::_IngredientSlot::getName -const std::string & SharedDraftSchematicObjectTemplate::_IngredientSlot::getHardpoint(bool versionOk, ) const +const std::string & SharedDraftSchematicObjectTemplate::_IngredientSlot::getHardpoint(bool versionOk) const { @@ -752,7 +752,7 @@ Tag SharedDraftSchematicObjectTemplate::_SchematicAttribute::getId(void) const return _SchematicAttribute_tag; } // SharedDraftSchematicObjectTemplate::_SchematicAttribute::getId -const StringId SharedDraftSchematicObjectTemplate::_SchematicAttribute::getName(bool versionOk, ) const +const StringId SharedDraftSchematicObjectTemplate::_SchematicAttribute::getName(bool versionOk) const { @@ -781,7 +781,7 @@ const StringId SharedDraftSchematicObjectTemplate::_SchematicAttribute::getName( return value; } // SharedDraftSchematicObjectTemplate::_SchematicAttribute::getName -const StringId SharedDraftSchematicObjectTemplate::_SchematicAttribute::getExperiment(bool versionOk, ) const +const StringId SharedDraftSchematicObjectTemplate::_SchematicAttribute::getExperiment(bool versionOk) const { @@ -810,7 +810,7 @@ const StringId SharedDraftSchematicObjectTemplate::_SchematicAttribute::getExper return value; } // SharedDraftSchematicObjectTemplate::_SchematicAttribute::getExperiment -int SharedDraftSchematicObjectTemplate::_SchematicAttribute::getValue(bool versionOk, ) const +int SharedDraftSchematicObjectTemplate::_SchematicAttribute::getValue(bool versionOk) const { @@ -861,7 +861,7 @@ int SharedDraftSchematicObjectTemplate::_SchematicAttribute::getValue(bool versi return value; } // SharedDraftSchematicObjectTemplate::_SchematicAttribute::getValue -int SharedDraftSchematicObjectTemplate::_SchematicAttribute::getValueMin(bool versionOk, ) const +int SharedDraftSchematicObjectTemplate::_SchematicAttribute::getValueMin(bool versionOk) const { @@ -912,7 +912,7 @@ int SharedDraftSchematicObjectTemplate::_SchematicAttribute::getValueMin(bool ve return value; } // SharedDraftSchematicObjectTemplate::_SchematicAttribute::getValueMin -int SharedDraftSchematicObjectTemplate::_SchematicAttribute::getValueMax(bool versionOk, ) const +int SharedDraftSchematicObjectTemplate::_SchematicAttribute::getValueMax(bool versionOk) const { diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTangibleObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTangibleObjectTemplate.cpp index 4adbfc5b..2809b366 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTangibleObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTangibleObjectTemplate.cpp @@ -1431,7 +1431,7 @@ Tag SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::getId(void) return _ConstStringCustomizationVariable_tag; } // SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::getId -const std::string & SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::getVariableName(bool versionOk, ) const +const std::string & SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::getVariableName(bool versionOk) const { @@ -1460,7 +1460,7 @@ const std::string & SharedTangibleObjectTemplate::_ConstStringCustomizationVaria return value; } // SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::getVariableName -const std::string & SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::getConstValue(bool versionOk, ) const +const std::string & SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::getConstValue(bool versionOk) const { @@ -1568,7 +1568,7 @@ Tag SharedTangibleObjectTemplate::_CustomizationVariableMapping::getId(void) con return _CustomizationVariableMapping_tag; } // SharedTangibleObjectTemplate::_CustomizationVariableMapping::getId -const std::string & SharedTangibleObjectTemplate::_CustomizationVariableMapping::getSourceVariable(bool versionOk, ) const +const std::string & SharedTangibleObjectTemplate::_CustomizationVariableMapping::getSourceVariable(bool versionOk) const { @@ -1597,7 +1597,7 @@ const std::string & SharedTangibleObjectTemplate::_CustomizationVariableMapping: return value; } // SharedTangibleObjectTemplate::_CustomizationVariableMapping::getSourceVariable -const std::string & SharedTangibleObjectTemplate::_CustomizationVariableMapping::getDependentVariable(bool versionOk, ) const +const std::string & SharedTangibleObjectTemplate::_CustomizationVariableMapping::getDependentVariable(bool versionOk) const { @@ -1705,7 +1705,7 @@ Tag SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getId(void return _PaletteColorCustomizationVariable_tag; } // SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getId -const std::string & SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getVariableName(bool versionOk, ) const +const std::string & SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getVariableName(bool versionOk) const { @@ -1734,7 +1734,7 @@ const std::string & SharedTangibleObjectTemplate::_PaletteColorCustomizationVari return value; } // SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getVariableName -const std::string & SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getPalettePathName(bool versionOk, ) const +const std::string & SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getPalettePathName(bool versionOk) const { @@ -1763,7 +1763,7 @@ const std::string & SharedTangibleObjectTemplate::_PaletteColorCustomizationVari return value; } // SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getPalettePathName -int SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getDefaultPaletteIndex(bool versionOk, ) const +int SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getDefaultPaletteIndex(bool versionOk) const { @@ -1814,7 +1814,7 @@ int SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getDefault return value; } // SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getDefaultPaletteIndex -int SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getDefaultPaletteIndexMin(bool versionOk, ) const +int SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getDefaultPaletteIndexMin(bool versionOk) const { @@ -1865,7 +1865,7 @@ int SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getDefault return value; } // SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getDefaultPaletteIndexMin -int SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getDefaultPaletteIndexMax(bool versionOk, ) const +int SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getDefaultPaletteIndexMax(bool versionOk) const { @@ -1997,7 +1997,7 @@ Tag SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getId(void) c return _RangedIntCustomizationVariable_tag; } // SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getId -const std::string & SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getVariableName(bool versionOk, ) const +const std::string & SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getVariableName(bool versionOk) const { @@ -2026,7 +2026,7 @@ const std::string & SharedTangibleObjectTemplate::_RangedIntCustomizationVariabl return value; } // SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getVariableName -int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMinValueInclusive(bool versionOk, ) const +int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMinValueInclusive(bool versionOk) const { @@ -2077,7 +2077,7 @@ int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMinValueIn return value; } // SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMinValueInclusive -int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMinValueInclusiveMin(bool versionOk, ) const +int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMinValueInclusiveMin(bool versionOk) const { @@ -2128,7 +2128,7 @@ int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMinValueIn return value; } // SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMinValueInclusiveMin -int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMinValueInclusiveMax(bool versionOk, ) const +int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMinValueInclusiveMax(bool versionOk) const { @@ -2179,7 +2179,7 @@ int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMinValueIn return value; } // SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMinValueInclusiveMax -int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getDefaultValue(bool versionOk, ) const +int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getDefaultValue(bool versionOk) const { @@ -2230,7 +2230,7 @@ int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getDefaultVal return value; } // SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getDefaultValue -int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getDefaultValueMin(bool versionOk, ) const +int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getDefaultValueMin(bool versionOk) const { @@ -2281,7 +2281,7 @@ int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getDefaultVal return value; } // SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getDefaultValueMin -int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getDefaultValueMax(bool versionOk, ) const +int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getDefaultValueMax(bool versionOk) const { @@ -2332,7 +2332,7 @@ int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getDefaultVal return value; } // SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getDefaultValueMax -int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMaxValueExclusive(bool versionOk, ) const +int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMaxValueExclusive(bool versionOk) const { @@ -2383,7 +2383,7 @@ int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMaxValueEx return value; } // SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMaxValueExclusive -int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMaxValueExclusiveMin(bool versionOk, ) const +int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMaxValueExclusiveMin(bool versionOk) const { @@ -2434,7 +2434,7 @@ int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMaxValueEx return value; } // SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMaxValueExclusiveMin -int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMaxValueExclusiveMax(bool versionOk, ) const +int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMaxValueExclusiveMax(bool versionOk) const { From 64b4a7731dad18f6adaba7496943374f6c0da158 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Thu, 24 Mar 2016 17:09:21 +0000 Subject: [PATCH 052/302] fix a little mistake, we do in fact use this --- .../application/SwgGameServer/src/shared/combat/CombatEngine.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/game/server/application/SwgGameServer/src/shared/combat/CombatEngine.cpp b/game/server/application/SwgGameServer/src/shared/combat/CombatEngine.cpp index b343cf6f..4f4269cd 100755 --- a/game/server/application/SwgGameServer/src/shared/combat/CombatEngine.cpp +++ b/game/server/application/SwgGameServer/src/shared/combat/CombatEngine.cpp @@ -680,6 +680,7 @@ void CombatEngine::alter(TangibleObject & object) if (object.isAuthoritative()) { // if the object is a creature, get it's attributes + Attributes::Value currentAttribs[Attributes::NumberOfAttributes]; CreatureObject * const critter = object.asCreatureObject (); if (critter != nullptr) { From a65ea6163d1c13bff0c72874167db7d7fd1c468d Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Thu, 24 Mar 2016 19:19:44 +0000 Subject: [PATCH 053/302] remove more of the testdata stuff - it never does anything other than occupy memory, in debug builds --- .../console/ConsoleCommandParserObject.cpp | 14 +- .../src/shared/object/CreatureObject.cpp | 8 - .../src/shared/object/ServerObject.cpp | 2 - .../objectTemplate/ServerArmorTemplate.cpp | 268 +----- .../objectTemplate/ServerArmorTemplate.h | 38 +- .../ServerBattlefieldMarkerObjectTemplate.cpp | 15 +- .../ServerBattlefieldMarkerObjectTemplate.h | 5 - .../ServerBuildingObjectTemplate.cpp | 84 +- .../ServerBuildingObjectTemplate.h | 13 +- .../ServerCellObjectTemplate.cpp | 13 +- .../objectTemplate/ServerCellObjectTemplate.h | 5 - .../ServerCityObjectTemplate.cpp | 13 +- .../objectTemplate/ServerCityObjectTemplate.h | 5 - ...rverConstructionContractObjectTemplate.cpp | 13 +- ...ServerConstructionContractObjectTemplate.h | 5 - .../ServerCreatureObjectTemplate.cpp | 367 +------ .../ServerCreatureObjectTemplate.h | 45 +- .../ServerDraftSchematicObjectTemplate.cpp | 363 +------ .../ServerDraftSchematicObjectTemplate.h | 46 +- .../ServerFactoryObjectTemplate.cpp | 13 +- .../ServerFactoryObjectTemplate.h | 5 - .../ServerGroupObjectTemplate.cpp | 13 +- .../ServerGroupObjectTemplate.h | 5 - .../ServerGuildObjectTemplate.cpp | 13 +- .../ServerGuildObjectTemplate.h | 5 - ...verHarvesterInstallationObjectTemplate.cpp | 190 +--- ...erverHarvesterInstallationObjectTemplate.h | 25 +- .../ServerInstallationObjectTemplate.cpp | 13 +- .../ServerInstallationObjectTemplate.h | 5 - .../ServerIntangibleObjectTemplate.cpp | 339 +------ .../ServerIntangibleObjectTemplate.h | 54 +- ...rManufactureInstallationObjectTemplate.cpp | 13 +- ...verManufactureInstallationObjectTemplate.h | 5 - ...rverManufactureSchematicObjectTemplate.cpp | 128 +-- ...ServerManufactureSchematicObjectTemplate.h | 22 +- .../ServerMissionObjectTemplate.cpp | 13 +- .../ServerMissionObjectTemplate.h | 5 - .../objectTemplate/ServerObjectTemplate.cpp | 895 ++---------------- .../objectTemplate/ServerObjectTemplate.h | 121 +-- .../ServerPlanetObjectTemplate.cpp | 31 +- .../ServerPlanetObjectTemplate.h | 7 +- .../ServerPlayerObjectTemplate.cpp | 15 +- .../ServerPlayerObjectTemplate.h | 5 - .../ServerPlayerQuestObjectTemplate.cpp | 15 +- .../ServerPlayerQuestObjectTemplate.h | 5 - .../ServerResourceContainerObjectTemplate.cpp | 66 +- .../ServerResourceContainerObjectTemplate.h | 11 +- .../ServerShipObjectTemplate.cpp | 33 +- .../objectTemplate/ServerShipObjectTemplate.h | 7 +- .../ServerStaticObjectTemplate.cpp | 31 +- .../ServerStaticObjectTemplate.h | 7 +- .../ServerTangibleObjectTemplate.cpp | 261 +---- .../ServerTangibleObjectTemplate.h | 33 +- .../ServerUniverseObjectTemplate.cpp | 13 +- .../ServerUniverseObjectTemplate.h | 5 - .../ServerVehicleObjectTemplate.cpp | 190 +--- .../ServerVehicleObjectTemplate.h | 25 +- .../ServerWeaponObjectTemplate.cpp | 668 ++----------- .../ServerWeaponObjectTemplate.h | 79 +- .../ServerXpManagerObjectTemplate.cpp | 15 +- .../ServerXpManagerObjectTemplate.h | 5 - 61 files changed, 682 insertions(+), 4049 deletions(-) diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserObject.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserObject.cpp index a092fc3a..eafa6994 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserObject.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserObject.cpp @@ -656,7 +656,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { if (ConfigServerGame::getStripNonFreeAssetsFromPlayersInTutorial() && NewbieTutorial::isInTutorialArea(userObject)) { - std::string sharedTemplate = ot->getSharedTemplate(false); + std::string sharedTemplate = ot->getSharedTemplate(); if (!FileManifest::contains(sharedTemplate.c_str())) { @@ -739,7 +739,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { if (ConfigServerGame::getStripNonFreeAssetsFromPlayersInTutorial() && NewbieTutorial::isInTutorialArea(userObject)) { - std::string sharedTemplate = ot->getSharedTemplate(false); + std::string sharedTemplate = ot->getSharedTemplate(); if (!FileManifest::contains(sharedTemplate.c_str())) { @@ -809,7 +809,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const if (ConfigServerGame::getStripNonFreeAssetsFromPlayersInTutorial() && NewbieTutorial::isInTutorialArea(userObject)) { - std::string sharedTemplate = ot->getSharedTemplate(false); + std::string sharedTemplate = ot->getSharedTemplate(); if (!FileManifest::contains(sharedTemplate.c_str())) { @@ -886,7 +886,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { if (ConfigServerGame::getStripNonFreeAssetsFromPlayersInTutorial() && NewbieTutorial::isInTutorialArea(userObject)) { - std::string sharedTemplate = ot->getSharedTemplate(false); + std::string sharedTemplate = ot->getSharedTemplate(); if (!FileManifest::contains(sharedTemplate.c_str())) { @@ -953,7 +953,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { if (ConfigServerGame::getStripNonFreeAssetsFromPlayersInTutorial() && NewbieTutorial::isInTutorialArea(userObject)) { - std::string sharedTemplate = ot->getSharedTemplate(false); + std::string sharedTemplate = ot->getSharedTemplate(); if (!FileManifest::contains(sharedTemplate.c_str())) { @@ -1021,7 +1021,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { if (ConfigServerGame::getStripNonFreeAssetsFromPlayersInTutorial() && NewbieTutorial::isInTutorialArea(userObject)) { - std::string sharedTemplate = ot->getSharedTemplate(false); + std::string sharedTemplate = ot->getSharedTemplate(); if (!FileManifest::contains(sharedTemplate.c_str())) { @@ -1093,7 +1093,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const { if (ConfigServerGame::getStripNonFreeAssetsFromPlayersInTutorial() && NewbieTutorial::isInTutorialArea(userObject)) { - std::string sharedTemplate = ot->getSharedTemplate(false); + std::string sharedTemplate = ot->getSharedTemplate(); if (!FileManifest::contains(sharedTemplate.c_str())) { diff --git a/engine/server/library/serverGame/src/shared/object/CreatureObject.cpp b/engine/server/library/serverGame/src/shared/object/CreatureObject.cpp index 73803c0a..65cee1c4 100755 --- a/engine/server/library/serverGame/src/shared/object/CreatureObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/CreatureObject.cpp @@ -4434,7 +4434,6 @@ void CreatureObject::removeAttributeModifier (const std::string & modName) { sendCancelTimedMod(m.mod.tag); } - const char * type = "attrib"; if (AttribMod::isSkillMod(m.mod)) { const char * skillModName = AttribModNameManager::getInstance().getAttribModName(m.mod.skill); @@ -4447,11 +4446,8 @@ void CreatureObject::removeAttributeModifier (const std::string & modName) PlayerObject::getAccountDescription(this).c_str(), m.mod.tag, m.mod.skill, m.mod.value, m.mod.sustain, m.mod.flags)); } - type = "skill"; } m_attributeModList.erase(f); -// LOG("CustomerService", ("Attribs: Removed named %s mod %s from %s", -// type, modName.c_str(), PlayerObject::getAccountDescription(this).c_str())); } } } // CreatureObject::removeAttributeModifier @@ -5185,7 +5181,6 @@ void CreatureObject::decayAttributes(float time) // regenerate attributes int i; - bool attribRegen = false; float regenerationRate[3] = {0,0,0}; m_regenerationTime += time; for (i = 0; i < 3; ++i) @@ -5195,7 +5190,6 @@ void CreatureObject::decayAttributes(float time) int currentAttrib = getAttribute(poolAttrib); if (currentAttrib < maxAttrib) { - attribRegen = true; regenerationRate[i] = getRegenRate(poolAttrib); m_regeneration[poolAttrib] += regenerationRate[i] * time; } @@ -7109,7 +7103,6 @@ void CreatureObject::onContainerGainItem(ServerObject& item, ServerObject* sourc { Object const * inventory = 0; Object const * datapad = 0; - Object const * appearance = 0; SlottedContainer const * const myContainer = ContainerInterface::getSlottedContainer(*this); @@ -7132,7 +7125,6 @@ void CreatureObject::onContainerGainItem(ServerObject& item, ServerObject* sourc if (appearanceInvSlot != SlotId::invalid) { Container::ContainedItem itemId = myContainer->getObjectInSlot(appearanceInvSlot, tmp); - appearance = itemId.getObject(); } } diff --git a/engine/server/library/serverGame/src/shared/object/ServerObject.cpp b/engine/server/library/serverGame/src/shared/object/ServerObject.cpp index e96fc5b1..19082342 100755 --- a/engine/server/library/serverGame/src/shared/object/ServerObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/ServerObject.cpp @@ -351,7 +351,6 @@ namespace ServerObjectNamespace if (!dest || !transferer) return true; - bool isBankTransfer = false; const CreatureObject * const creature = transferer->asCreatureObject(); if (creature && dest == creature->getBankContainer()) { @@ -370,7 +369,6 @@ namespace ServerObjectNamespace const TangibleObject * const bankTerminal = safe_cast(NetworkIdManager::getObjectById(bankTerminalId)); if (bankTerminal) { - isBankTransfer = true; Unicode::String bankName; if (bankTerminal->getObjVars().getItem(OBJVAR_BANK_NAME_ID, bankName)) { diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerArmorTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerArmorTemplate.cpp index 2e429325..e5cac8d4 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerArmorTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerArmorTemplate.cpp @@ -114,22 +114,14 @@ Tag ServerArmorTemplate::getHighestTemplateVersion(void) const } // ServerArmorTemplate::getHighestTemplateVersion //@BEGIN TFD -ServerArmorTemplate::ArmorRating ServerArmorTemplate::getRating(bool testData) const +ServerArmorTemplate::ArmorRating ServerArmorTemplate::getRating() const { -#ifdef _DEBUG -ServerArmorTemplate::ArmorRating testDataValue = static_cast(0); -#else -UNREF(testData); -#endif + const ServerArmorTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getRating(true); -#endif } if (!m_rating.isLoaded()) @@ -147,31 +139,18 @@ UNREF(testData); } ArmorRating value = static_cast(m_rating.getValue()); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerArmorTemplate::getRating -int ServerArmorTemplate::getIntegrity(bool testData) const +int ServerArmorTemplate::getIntegrity() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerArmorTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getIntegrity(true); -#endif } if (!m_integrity.isLoaded()) @@ -211,31 +190,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerArmorTemplate::getIntegrity -int ServerArmorTemplate::getIntegrityMin(bool testData) const +int ServerArmorTemplate::getIntegrityMin() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerArmorTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getIntegrityMin(true); -#endif } if (!m_integrity.isLoaded()) @@ -275,31 +241,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerArmorTemplate::getIntegrityMin -int ServerArmorTemplate::getIntegrityMax(bool testData) const +int ServerArmorTemplate::getIntegrityMax() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerArmorTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getIntegrityMax(true); -#endif } if (!m_integrity.isLoaded()) @@ -339,31 +292,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerArmorTemplate::getIntegrityMax -int ServerArmorTemplate::getEffectiveness(bool testData) const +int ServerArmorTemplate::getEffectiveness() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerArmorTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getEffectiveness(true); -#endif } if (!m_effectiveness.isLoaded()) @@ -403,31 +343,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerArmorTemplate::getEffectiveness -int ServerArmorTemplate::getEffectivenessMin(bool testData) const +int ServerArmorTemplate::getEffectivenessMin() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerArmorTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getEffectivenessMin(true); -#endif } if (!m_effectiveness.isLoaded()) @@ -467,31 +394,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerArmorTemplate::getEffectivenessMin -int ServerArmorTemplate::getEffectivenessMax(bool testData) const +int ServerArmorTemplate::getEffectivenessMax() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerArmorTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getEffectivenessMax(true); -#endif } if (!m_effectiveness.isLoaded()) @@ -531,11 +445,6 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerArmorTemplate::getEffectivenessMax @@ -693,22 +602,14 @@ size_t ServerArmorTemplate::getSpecialProtectionCount(void) const return count; } // ServerArmorTemplate::getSpecialProtectionCount -int ServerArmorTemplate::getVulnerability(bool testData) const +int ServerArmorTemplate::getVulnerability() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerArmorTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getVulnerability(true); -#endif } if (!m_vulnerability.isLoaded()) @@ -748,31 +649,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerArmorTemplate::getVulnerability -int ServerArmorTemplate::getVulnerabilityMin(bool testData) const +int ServerArmorTemplate::getVulnerabilityMin() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerArmorTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getVulnerabilityMin(true); -#endif } if (!m_vulnerability.isLoaded()) @@ -812,31 +700,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerArmorTemplate::getVulnerabilityMin -int ServerArmorTemplate::getVulnerabilityMax(bool testData) const +int ServerArmorTemplate::getVulnerabilityMax() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerArmorTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getVulnerabilityMax(true); -#endif } if (!m_vulnerability.isLoaded()) @@ -876,11 +751,6 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerArmorTemplate::getVulnerabilityMax @@ -1032,21 +902,6 @@ int ServerArmorTemplate::getEncumbranceMax(int index) const return value; } // ServerArmorTemplate::getEncumbranceMax -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void ServerArmorTemplate::testValues(void) const -{ - IGNORE_RETURN(getRating(true)); - IGNORE_RETURN(getIntegrityMin(true)); - IGNORE_RETURN(getIntegrityMax(true)); - IGNORE_RETURN(getEffectivenessMin(true)); - IGNORE_RETURN(getEffectivenessMax(true)); - IGNORE_RETURN(getVulnerabilityMin(true)); - IGNORE_RETURN(getVulnerabilityMax(true)); -} // ServerArmorTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -1088,8 +943,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,1)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } @@ -1197,22 +1052,14 @@ Tag ServerArmorTemplate::_SpecialProtection::getId(void) const return _SpecialProtection_tag; } // ServerArmorTemplate::_SpecialProtection::getId -ServerArmorTemplate::DamageType ServerArmorTemplate::_SpecialProtection::getType(bool versionOk, bool testData) const +ServerArmorTemplate::DamageType ServerArmorTemplate::_SpecialProtection::getType(bool versionOk) const { -#ifdef _DEBUG -ServerArmorTemplate::DamageType testDataValue = static_cast(0); -#else -UNREF(testData); -#endif + const ServerArmorTemplate::_SpecialProtection * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getType(true); -#endif } if (!m_type.isLoaded()) @@ -1230,31 +1077,18 @@ UNREF(testData); } DamageType value = static_cast(m_type.getValue()); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerArmorTemplate::_SpecialProtection::getType -int ServerArmorTemplate::_SpecialProtection::getEffectiveness(bool versionOk, bool testData) const +int ServerArmorTemplate::_SpecialProtection::getEffectiveness(bool versionOk) const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerArmorTemplate::_SpecialProtection * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getEffectiveness(true); -#endif } if (!m_effectiveness.isLoaded()) @@ -1294,31 +1128,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerArmorTemplate::_SpecialProtection::getEffectiveness -int ServerArmorTemplate::_SpecialProtection::getEffectivenessMin(bool versionOk, bool testData) const +int ServerArmorTemplate::_SpecialProtection::getEffectivenessMin(bool versionOk) const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerArmorTemplate::_SpecialProtection * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getEffectivenessMin(true); -#endif } if (!m_effectiveness.isLoaded()) @@ -1358,31 +1179,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerArmorTemplate::_SpecialProtection::getEffectivenessMin -int ServerArmorTemplate::_SpecialProtection::getEffectivenessMax(bool versionOk, bool testData) const +int ServerArmorTemplate::_SpecialProtection::getEffectivenessMax(bool versionOk) const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerArmorTemplate::_SpecialProtection * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getEffectivenessMax(true); -#endif } if (!m_effectiveness.isLoaded()) @@ -1422,26 +1230,10 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerArmorTemplate::_SpecialProtection::getEffectivenessMax -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void ServerArmorTemplate::_SpecialProtection::testValues(void) const -{ - IGNORE_RETURN(getType(true)); - IGNORE_RETURN(getEffectivenessMin(true)); - IGNORE_RETURN(getEffectivenessMax(true)); -} // ServerArmorTemplate::_SpecialProtection::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerArmorTemplate.h b/engine/server/library/serverGame/src/shared/objectTemplate/ServerArmorTemplate.h index 87ee48bc..e52eb69d 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerArmorTemplate.h +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerArmorTemplate.h @@ -98,16 +98,11 @@ protected: virtual Tag getId(void) const; public: - DamageType getType(bool versionOk, bool testData = false) const; - int getEffectiveness(bool versionOk, bool testData = false) const; - int getEffectivenessMin(bool versionOk, bool testData = false) const; - int getEffectivenessMax(bool versionOk, bool testData = false) const; + DamageType getType(bool versionOk) const; + int getEffectiveness(bool versionOk) const; + int getEffectivenessMin(bool versionOk) const; + int getEffectivenessMax(bool versionOk) const; -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); @@ -125,29 +120,24 @@ private: friend class ServerArmorTemplate::_SpecialProtection; public: - ArmorRating getRating(bool testData = false) const; - int getIntegrity(bool testData = false) const; - int getIntegrityMin(bool testData = false) const; - int getIntegrityMax(bool testData = false) const; - int getEffectiveness(bool testData = false) const; - int getEffectivenessMin(bool testData = false) const; - int getEffectivenessMax(bool testData = false) const; + ArmorRating getRating() const; + int getIntegrity() const; + int getIntegrityMin() const; + int getIntegrityMax() const; + int getEffectiveness() const; + int getEffectivenessMin() const; + int getEffectivenessMax() const; void getSpecialProtection(SpecialProtection &data, int index) const; void getSpecialProtectionMin(SpecialProtection &data, int index) const; void getSpecialProtectionMax(SpecialProtection &data, int index) const; size_t getSpecialProtectionCount(void) const; - int getVulnerability(bool testData = false) const; - int getVulnerabilityMin(bool testData = false) const; - int getVulnerabilityMax(bool testData = false) const; + int getVulnerability() const; + int getVulnerabilityMin() const; + int getVulnerabilityMax() const; int getEncumbrance(int index) const; int getEncumbranceMin(int index) const; int getEncumbranceMax(int index) const; -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerBattlefieldMarkerObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerBattlefieldMarkerObjectTemplate.cpp index 0a63ff2d..edd8194e 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerBattlefieldMarkerObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerBattlefieldMarkerObjectTemplate.cpp @@ -13,7 +13,7 @@ #include "serverGame/FirstServerGame.h" #include "ServerBattlefieldMarkerObjectTemplate.h" #include "serverGame/BattlefieldMarkerObject.h" -#include "sharedDebug/DataLint.h" + #include "sharedFile/Iff.h" #include "sharedObject/ObjectTemplate.h" #include "sharedObject/ObjectTemplateList.h" @@ -113,15 +113,6 @@ Object * ServerBattlefieldMarkerObjectTemplate::createObject(void) const } // ServerBattlefieldMarkerObjectTemplate::createObject //@BEGIN TFD -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void ServerBattlefieldMarkerObjectTemplate::testValues(void) const -{ - ServerTangibleObjectTemplate::testValues(); -} // ServerBattlefieldMarkerObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -164,8 +155,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,0)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerBattlefieldMarkerObjectTemplate.h b/engine/server/library/serverGame/src/shared/objectTemplate/ServerBattlefieldMarkerObjectTemplate.h index 935ba00c..85c16d13 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerBattlefieldMarkerObjectTemplate.h +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerBattlefieldMarkerObjectTemplate.h @@ -45,11 +45,6 @@ public: //@BEGIN TFD public: -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerBuildingObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerBuildingObjectTemplate.cpp index 57d3ab90..5fe4a003 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerBuildingObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerBuildingObjectTemplate.cpp @@ -112,22 +112,14 @@ Object * ServerBuildingObjectTemplate::createObject(void) const } // ServerBuildingObjectTemplate::createObject //@BEGIN TFD -int ServerBuildingObjectTemplate::getMaintenanceCost(bool testData) const +int ServerBuildingObjectTemplate::getMaintenanceCost() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerBuildingObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMaintenanceCost(true); -#endif } if (!m_maintenanceCost.isLoaded()) @@ -167,31 +159,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerBuildingObjectTemplate::getMaintenanceCost -int ServerBuildingObjectTemplate::getMaintenanceCostMin(bool testData) const +int ServerBuildingObjectTemplate::getMaintenanceCostMin() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerBuildingObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMaintenanceCostMin(true); -#endif } if (!m_maintenanceCost.isLoaded()) @@ -231,31 +210,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerBuildingObjectTemplate::getMaintenanceCostMin -int ServerBuildingObjectTemplate::getMaintenanceCostMax(bool testData) const +int ServerBuildingObjectTemplate::getMaintenanceCostMax() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerBuildingObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMaintenanceCostMax(true); -#endif } if (!m_maintenanceCost.isLoaded()) @@ -295,31 +261,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerBuildingObjectTemplate::getMaintenanceCostMax -bool ServerBuildingObjectTemplate::getIsPublic(bool testData) const +bool ServerBuildingObjectTemplate::getIsPublic() const { -#ifdef _DEBUG -bool testDataValue = false; -#else -UNREF(testData); -#endif + const ServerBuildingObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getIsPublic(true); -#endif } if (!m_isPublic.isLoaded()) @@ -337,27 +290,10 @@ UNREF(testData); } bool value = m_isPublic.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerBuildingObjectTemplate::getIsPublic -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void ServerBuildingObjectTemplate::testValues(void) const -{ - IGNORE_RETURN(getMaintenanceCostMin(true)); - IGNORE_RETURN(getMaintenanceCostMax(true)); - IGNORE_RETURN(getIsPublic(true)); - ServerTangibleObjectTemplate::testValues(); -} // ServerBuildingObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -400,8 +336,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,1)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerBuildingObjectTemplate.h b/engine/server/library/serverGame/src/shared/objectTemplate/ServerBuildingObjectTemplate.h index 7ae6150d..6e07d836 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerBuildingObjectTemplate.h +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerBuildingObjectTemplate.h @@ -44,16 +44,11 @@ public: //@BEGIN TFD public: - int getMaintenanceCost(bool testData = false) const; - int getMaintenanceCostMin(bool testData = false) const; - int getMaintenanceCostMax(bool testData = false) const; - bool getIsPublic(bool testData = false) const; + int getMaintenanceCost() const; + int getMaintenanceCostMin() const; + int getMaintenanceCostMax() const; + bool getIsPublic() const; -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerCellObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerCellObjectTemplate.cpp index 0c39dc7c..cd6cd28d 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerCellObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerCellObjectTemplate.cpp @@ -118,15 +118,6 @@ Object * ServerCellObjectTemplate::createObject(void) const } // ServerCellObjectTemplate::createObject //@BEGIN TFD -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void ServerCellObjectTemplate::testValues(void) const -{ - ServerObjectTemplate::testValues(); -} // ServerCellObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -169,8 +160,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,0)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerCellObjectTemplate.h b/engine/server/library/serverGame/src/shared/objectTemplate/ServerCellObjectTemplate.h index 4af0214f..8e52800f 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerCellObjectTemplate.h +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerCellObjectTemplate.h @@ -45,11 +45,6 @@ public: //@BEGIN TFD public: -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerCityObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerCityObjectTemplate.cpp index 0f328d56..82ba3562 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerCityObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerCityObjectTemplate.cpp @@ -114,15 +114,6 @@ Object * ServerCityObjectTemplate::createObject(void) const } // ServerCityObjectTemplate::createObject //@BEGIN TFD -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void ServerCityObjectTemplate::testValues(void) const -{ - ServerUniverseObjectTemplate::testValues(); -} // ServerCityObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -165,8 +156,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,0)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerCityObjectTemplate.h b/engine/server/library/serverGame/src/shared/objectTemplate/ServerCityObjectTemplate.h index 3056b960..e656014c 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerCityObjectTemplate.h +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerCityObjectTemplate.h @@ -45,11 +45,6 @@ public: //@BEGIN TFD public: -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerConstructionContractObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerConstructionContractObjectTemplate.cpp index ba882146..3d1d1fec 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerConstructionContractObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerConstructionContractObjectTemplate.cpp @@ -103,15 +103,6 @@ Tag ServerConstructionContractObjectTemplate::getId(void) const } // ServerConstructionContractObjectTemplate::getId //@BEGIN TFD -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void ServerConstructionContractObjectTemplate::testValues(void) const -{ - ServerIntangibleObjectTemplate::testValues(); -} // ServerConstructionContractObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -154,8 +145,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,0)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerConstructionContractObjectTemplate.h b/engine/server/library/serverGame/src/shared/objectTemplate/ServerConstructionContractObjectTemplate.h index b14da90b..3efa0d06 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerConstructionContractObjectTemplate.h +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerConstructionContractObjectTemplate.h @@ -45,11 +45,6 @@ public: //@BEGIN TFD public: -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerCreatureObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerCreatureObjectTemplate.cpp index f1be807d..c3d0f5b1 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerCreatureObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerCreatureObjectTemplate.cpp @@ -601,22 +601,14 @@ int ServerCreatureObjectTemplate::getMaxAttributesMax(Attributes index) const return value; } // ServerCreatureObjectTemplate::getMaxAttributesMax -float ServerCreatureObjectTemplate::getMinDrainModifier(bool testData) const +float ServerCreatureObjectTemplate::getMinDrainModifier() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMinDrainModifier(true); -#endif } if (!m_minDrainModifier.isLoaded()) @@ -656,31 +648,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerCreatureObjectTemplate::getMinDrainModifier -float ServerCreatureObjectTemplate::getMinDrainModifierMin(bool testData) const +float ServerCreatureObjectTemplate::getMinDrainModifierMin() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMinDrainModifierMin(true); -#endif } if (!m_minDrainModifier.isLoaded()) @@ -720,31 +699,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerCreatureObjectTemplate::getMinDrainModifierMin -float ServerCreatureObjectTemplate::getMinDrainModifierMax(bool testData) const +float ServerCreatureObjectTemplate::getMinDrainModifierMax() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMinDrainModifierMax(true); -#endif } if (!m_minDrainModifier.isLoaded()) @@ -784,31 +750,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerCreatureObjectTemplate::getMinDrainModifierMax -float ServerCreatureObjectTemplate::getMaxDrainModifier(bool testData) const +float ServerCreatureObjectTemplate::getMaxDrainModifier() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMaxDrainModifier(true); -#endif } if (!m_maxDrainModifier.isLoaded()) @@ -848,31 +801,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerCreatureObjectTemplate::getMaxDrainModifier -float ServerCreatureObjectTemplate::getMaxDrainModifierMin(bool testData) const +float ServerCreatureObjectTemplate::getMaxDrainModifierMin() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMaxDrainModifierMin(true); -#endif } if (!m_maxDrainModifier.isLoaded()) @@ -912,31 +852,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerCreatureObjectTemplate::getMaxDrainModifierMin -float ServerCreatureObjectTemplate::getMaxDrainModifierMax(bool testData) const +float ServerCreatureObjectTemplate::getMaxDrainModifierMax() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMaxDrainModifierMax(true); -#endif } if (!m_maxDrainModifier.isLoaded()) @@ -976,31 +903,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerCreatureObjectTemplate::getMaxDrainModifierMax -float ServerCreatureObjectTemplate::getMinFaucetModifier(bool testData) const +float ServerCreatureObjectTemplate::getMinFaucetModifier() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMinFaucetModifier(true); -#endif } if (!m_minFaucetModifier.isLoaded()) @@ -1040,31 +954,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerCreatureObjectTemplate::getMinFaucetModifier -float ServerCreatureObjectTemplate::getMinFaucetModifierMin(bool testData) const +float ServerCreatureObjectTemplate::getMinFaucetModifierMin() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMinFaucetModifierMin(true); -#endif } if (!m_minFaucetModifier.isLoaded()) @@ -1104,31 +1005,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerCreatureObjectTemplate::getMinFaucetModifierMin -float ServerCreatureObjectTemplate::getMinFaucetModifierMax(bool testData) const +float ServerCreatureObjectTemplate::getMinFaucetModifierMax() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMinFaucetModifierMax(true); -#endif } if (!m_minFaucetModifier.isLoaded()) @@ -1168,31 +1056,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerCreatureObjectTemplate::getMinFaucetModifierMax -float ServerCreatureObjectTemplate::getMaxFaucetModifier(bool testData) const +float ServerCreatureObjectTemplate::getMaxFaucetModifier() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMaxFaucetModifier(true); -#endif } if (!m_maxFaucetModifier.isLoaded()) @@ -1232,31 +1107,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerCreatureObjectTemplate::getMaxFaucetModifier -float ServerCreatureObjectTemplate::getMaxFaucetModifierMin(bool testData) const +float ServerCreatureObjectTemplate::getMaxFaucetModifierMin() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMaxFaucetModifierMin(true); -#endif } if (!m_maxFaucetModifier.isLoaded()) @@ -1296,31 +1158,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerCreatureObjectTemplate::getMaxFaucetModifierMin -float ServerCreatureObjectTemplate::getMaxFaucetModifierMax(bool testData) const +float ServerCreatureObjectTemplate::getMaxFaucetModifierMax() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMaxFaucetModifierMax(true); -#endif } if (!m_maxFaucetModifier.isLoaded()) @@ -1360,11 +1209,6 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerCreatureObjectTemplate::getMaxFaucetModifierMax @@ -1531,22 +1375,14 @@ size_t ServerCreatureObjectTemplate::getAttribModsCount(void) const return count; } // ServerCreatureObjectTemplate::getAttribModsCount -int ServerCreatureObjectTemplate::getShockWounds(bool testData) const +int ServerCreatureObjectTemplate::getShockWounds() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getShockWounds(true); -#endif } if (!m_shockWounds.isLoaded()) @@ -1586,31 +1422,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerCreatureObjectTemplate::getShockWounds -int ServerCreatureObjectTemplate::getShockWoundsMin(bool testData) const +int ServerCreatureObjectTemplate::getShockWoundsMin() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getShockWoundsMin(true); -#endif } if (!m_shockWounds.isLoaded()) @@ -1650,31 +1473,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerCreatureObjectTemplate::getShockWoundsMin -int ServerCreatureObjectTemplate::getShockWoundsMax(bool testData) const +int ServerCreatureObjectTemplate::getShockWoundsMax() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getShockWoundsMax(true); -#endif } if (!m_shockWounds.isLoaded()) @@ -1714,31 +1524,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerCreatureObjectTemplate::getShockWoundsMax -bool ServerCreatureObjectTemplate::getCanCreateAvatar(bool testData) const +bool ServerCreatureObjectTemplate::getCanCreateAvatar() const { -#ifdef _DEBUG -bool testDataValue = false; -#else -UNREF(testData); -#endif + const ServerCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getCanCreateAvatar(true); -#endif } if (!m_canCreateAvatar.isLoaded()) @@ -1756,31 +1553,18 @@ UNREF(testData); } bool value = m_canCreateAvatar.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerCreatureObjectTemplate::getCanCreateAvatar -const std::string & ServerCreatureObjectTemplate::getNameGeneratorType(bool testData) const +const std::string & ServerCreatureObjectTemplate::getNameGeneratorType() const { -#ifdef _DEBUG -std::string testDataValue = DefaultString; -#else -UNREF(testData); -#endif + const ServerCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getNameGeneratorType(true); -#endif } if (!m_nameGeneratorType.isLoaded()) @@ -1798,31 +1582,18 @@ UNREF(testData); } const std::string & value = m_nameGeneratorType.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerCreatureObjectTemplate::getNameGeneratorType -float ServerCreatureObjectTemplate::getApproachTriggerRange(bool testData) const +float ServerCreatureObjectTemplate::getApproachTriggerRange() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getApproachTriggerRange(true); -#endif } if (!m_approachTriggerRange.isLoaded()) @@ -1862,31 +1633,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerCreatureObjectTemplate::getApproachTriggerRange -float ServerCreatureObjectTemplate::getApproachTriggerRangeMin(bool testData) const +float ServerCreatureObjectTemplate::getApproachTriggerRangeMin() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getApproachTriggerRangeMin(true); -#endif } if (!m_approachTriggerRange.isLoaded()) @@ -1926,31 +1684,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerCreatureObjectTemplate::getApproachTriggerRangeMin -float ServerCreatureObjectTemplate::getApproachTriggerRangeMax(bool testData) const +float ServerCreatureObjectTemplate::getApproachTriggerRangeMax() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getApproachTriggerRangeMax(true); -#endif } if (!m_approachTriggerRange.isLoaded()) @@ -1990,11 +1735,6 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerCreatureObjectTemplate::getApproachTriggerRangeMax @@ -2293,29 +2033,6 @@ float ServerCreatureObjectTemplate::getMentalStatesDecayMax(MentalStates index) return value; } // ServerCreatureObjectTemplate::getMentalStatesDecayMax -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void ServerCreatureObjectTemplate::testValues(void) const -{ - IGNORE_RETURN(getMinDrainModifierMin(true)); - IGNORE_RETURN(getMinDrainModifierMax(true)); - IGNORE_RETURN(getMaxDrainModifierMin(true)); - IGNORE_RETURN(getMaxDrainModifierMax(true)); - IGNORE_RETURN(getMinFaucetModifierMin(true)); - IGNORE_RETURN(getMinFaucetModifierMax(true)); - IGNORE_RETURN(getMaxFaucetModifierMin(true)); - IGNORE_RETURN(getMaxFaucetModifierMax(true)); - IGNORE_RETURN(getShockWoundsMin(true)); - IGNORE_RETURN(getShockWoundsMax(true)); - IGNORE_RETURN(getCanCreateAvatar(true)); - IGNORE_RETURN(getNameGeneratorType(true)); - IGNORE_RETURN(getApproachTriggerRangeMin(true)); - IGNORE_RETURN(getApproachTriggerRangeMax(true)); - ServerTangibleObjectTemplate::testValues(); -} // ServerCreatureObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -2358,8 +2075,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,5)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerCreatureObjectTemplate.h b/engine/server/library/serverGame/src/shared/objectTemplate/ServerCreatureObjectTemplate.h index 17478495..e45a6249 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerCreatureObjectTemplate.h +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerCreatureObjectTemplate.h @@ -70,30 +70,30 @@ public: int getMaxAttributes(Attributes index) const; int getMaxAttributesMin(Attributes index) const; int getMaxAttributesMax(Attributes index) const; - float getMinDrainModifier(bool testData = false) const; - float getMinDrainModifierMin(bool testData = false) const; - float getMinDrainModifierMax(bool testData = false) const; - float getMaxDrainModifier(bool testData = false) const; - float getMaxDrainModifierMin(bool testData = false) const; - float getMaxDrainModifierMax(bool testData = false) const; - float getMinFaucetModifier(bool testData = false) const; - float getMinFaucetModifierMin(bool testData = false) const; - float getMinFaucetModifierMax(bool testData = false) const; - float getMaxFaucetModifier(bool testData = false) const; - float getMaxFaucetModifierMin(bool testData = false) const; - float getMaxFaucetModifierMax(bool testData = false) const; + float getMinDrainModifier() const; + float getMinDrainModifierMin() const; + float getMinDrainModifierMax() const; + float getMaxDrainModifier() const; + float getMaxDrainModifierMin() const; + float getMaxDrainModifierMax() const; + float getMinFaucetModifier() const; + float getMinFaucetModifierMin() const; + float getMinFaucetModifierMax() const; + float getMaxFaucetModifier() const; + float getMaxFaucetModifierMin() const; + float getMaxFaucetModifierMax() const; void getAttribMods(AttribMod &data, int index) const; void getAttribModsMin(AttribMod &data, int index) const; void getAttribModsMax(AttribMod &data, int index) const; size_t getAttribModsCount(void) const; - int getShockWounds(bool testData = false) const; - int getShockWoundsMin(bool testData = false) const; - int getShockWoundsMax(bool testData = false) const; - bool getCanCreateAvatar(bool testData = false) const; - const std::string & getNameGeneratorType(bool testData = false) const; - float getApproachTriggerRange(bool testData = false) const; - float getApproachTriggerRangeMin(bool testData = false) const; - float getApproachTriggerRangeMax(bool testData = false) const; + int getShockWounds() const; + int getShockWoundsMin() const; + int getShockWoundsMax() const; + bool getCanCreateAvatar() const; + const std::string & getNameGeneratorType() const; + float getApproachTriggerRange() const; + float getApproachTriggerRangeMin() const; + float getApproachTriggerRangeMax() const; float getMaxMentalStates(MentalStates index) const; float getMaxMentalStatesMin(MentalStates index) const; float getMaxMentalStatesMax(MentalStates index) const; @@ -101,11 +101,6 @@ public: float getMentalStatesDecayMin(MentalStates index) const; float getMentalStatesDecayMax(MentalStates index) const; -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerDraftSchematicObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerDraftSchematicObjectTemplate.cpp index 5cfd4169..9ffea4cf 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerDraftSchematicObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerDraftSchematicObjectTemplate.cpp @@ -143,12 +143,6 @@ Tag ServerDraftSchematicObjectTemplate::getHighestTemplateVersion(void) const */ Object * ServerDraftSchematicObjectTemplate::createObject(void) const { -#ifdef _DEBUG - if (DataLint::isEnabled()) - { - return new DraftSchematicObject(this); - } -#endif WARNING(true, ("Trying to create a draft schematic %s outside the draft " "schematic factory!\n", getName())); @@ -161,41 +155,17 @@ Object * ServerDraftSchematicObjectTemplate::createObject(void) const */ void ServerDraftSchematicObjectTemplate::postLoad() { -#ifdef _DEBUG - // verify that all slot names are unique - std::set slotNames; - - IngredientSlot data; - int count = getSlotsCount(); - for (int i = 0; i < count; ++i) - { - getSlots(data, i); - if (slotNames.insert(data.name.getText()).second == false) - { - WARNING(true, ("Draft schematic %s has duplicate slot name %s", - getName(), data.name.getText().c_str())); - } - } -#endif } // ServerDraftSchematicObjectTemplate::postLoad //@BEGIN TFD -ServerDraftSchematicObjectTemplate::CraftingType ServerDraftSchematicObjectTemplate::getCategory(bool testData) const +ServerDraftSchematicObjectTemplate::CraftingType ServerDraftSchematicObjectTemplate::getCategory() const { -#ifdef _DEBUG -ServerDraftSchematicObjectTemplate::CraftingType testDataValue = static_cast(0); -#else -UNREF(testData); -#endif + const ServerDraftSchematicObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getCategory(true); -#endif } if (!m_category.isLoaded()) @@ -213,11 +183,6 @@ UNREF(testData); } CraftingType value = static_cast(m_category.getValue()); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerDraftSchematicObjectTemplate::getCategory @@ -522,22 +487,14 @@ size_t ServerDraftSchematicObjectTemplate::getSkillCommandsCount(void) const return count; } // ServerDraftSchematicObjectTemplate::getSkillCommandsCount -bool ServerDraftSchematicObjectTemplate::getDestroyIngredients(bool testData) const +bool ServerDraftSchematicObjectTemplate::getDestroyIngredients() const { -#ifdef _DEBUG -bool testDataValue = false; -#else -UNREF(testData); -#endif + const ServerDraftSchematicObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getDestroyIngredients(true); -#endif } if (!m_destroyIngredients.isLoaded()) @@ -555,11 +512,6 @@ UNREF(testData); } bool value = m_destroyIngredients.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerDraftSchematicObjectTemplate::getDestroyIngredients @@ -623,22 +575,14 @@ size_t ServerDraftSchematicObjectTemplate::getManufactureScriptsCount(void) cons return count; } // ServerDraftSchematicObjectTemplate::getManufactureScriptsCount -int ServerDraftSchematicObjectTemplate::getItemsPerContainer(bool testData) const +int ServerDraftSchematicObjectTemplate::getItemsPerContainer() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerDraftSchematicObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getItemsPerContainer(true); -#endif } if (!m_itemsPerContainer.isLoaded()) @@ -678,31 +622,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerDraftSchematicObjectTemplate::getItemsPerContainer -int ServerDraftSchematicObjectTemplate::getItemsPerContainerMin(bool testData) const +int ServerDraftSchematicObjectTemplate::getItemsPerContainerMin() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerDraftSchematicObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getItemsPerContainerMin(true); -#endif } if (!m_itemsPerContainer.isLoaded()) @@ -742,31 +673,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerDraftSchematicObjectTemplate::getItemsPerContainerMin -int ServerDraftSchematicObjectTemplate::getItemsPerContainerMax(bool testData) const +int ServerDraftSchematicObjectTemplate::getItemsPerContainerMax() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerDraftSchematicObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getItemsPerContainerMax(true); -#endif } if (!m_itemsPerContainer.isLoaded()) @@ -806,31 +724,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerDraftSchematicObjectTemplate::getItemsPerContainerMax -float ServerDraftSchematicObjectTemplate::getManufactureTime(bool testData) const +float ServerDraftSchematicObjectTemplate::getManufactureTime() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerDraftSchematicObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getManufactureTime(true); -#endif } if (!m_manufactureTime.isLoaded()) @@ -870,31 +775,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerDraftSchematicObjectTemplate::getManufactureTime -float ServerDraftSchematicObjectTemplate::getManufactureTimeMin(bool testData) const +float ServerDraftSchematicObjectTemplate::getManufactureTimeMin() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerDraftSchematicObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getManufactureTimeMin(true); -#endif } if (!m_manufactureTime.isLoaded()) @@ -934,31 +826,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerDraftSchematicObjectTemplate::getManufactureTimeMin -float ServerDraftSchematicObjectTemplate::getManufactureTimeMax(bool testData) const +float ServerDraftSchematicObjectTemplate::getManufactureTimeMax() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerDraftSchematicObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getManufactureTimeMax(true); -#endif } if (!m_manufactureTime.isLoaded()) @@ -998,31 +877,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerDraftSchematicObjectTemplate::getManufactureTimeMax -float ServerDraftSchematicObjectTemplate::getPrototypeTime(bool testData) const +float ServerDraftSchematicObjectTemplate::getPrototypeTime() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerDraftSchematicObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getPrototypeTime(true); -#endif } if (!m_prototypeTime.isLoaded()) @@ -1062,31 +928,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerDraftSchematicObjectTemplate::getPrototypeTime -float ServerDraftSchematicObjectTemplate::getPrototypeTimeMin(bool testData) const +float ServerDraftSchematicObjectTemplate::getPrototypeTimeMin() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerDraftSchematicObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getPrototypeTimeMin(true); -#endif } if (!m_prototypeTime.isLoaded()) @@ -1126,31 +979,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerDraftSchematicObjectTemplate::getPrototypeTimeMin -float ServerDraftSchematicObjectTemplate::getPrototypeTimeMax(bool testData) const +float ServerDraftSchematicObjectTemplate::getPrototypeTimeMax() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerDraftSchematicObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getPrototypeTimeMax(true); -#endif } if (!m_prototypeTime.isLoaded()) @@ -1190,32 +1030,10 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerDraftSchematicObjectTemplate::getPrototypeTimeMax -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void ServerDraftSchematicObjectTemplate::testValues(void) const -{ - IGNORE_RETURN(getCategory(true)); - IGNORE_RETURN(getDestroyIngredients(true)); - IGNORE_RETURN(getItemsPerContainerMin(true)); - IGNORE_RETURN(getItemsPerContainerMax(true)); - IGNORE_RETURN(getManufactureTimeMin(true)); - IGNORE_RETURN(getManufactureTimeMax(true)); - IGNORE_RETURN(getPrototypeTimeMin(true)); - IGNORE_RETURN(getPrototypeTimeMax(true)); - ServerIntangibleObjectTemplate::testValues(); -} // ServerDraftSchematicObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -1258,8 +1076,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,7)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } @@ -1410,22 +1228,14 @@ Tag ServerDraftSchematicObjectTemplate::_IngredientSlot::getId(void) const return _IngredientSlot_tag; } // ServerDraftSchematicObjectTemplate::_IngredientSlot::getId -bool ServerDraftSchematicObjectTemplate::_IngredientSlot::getOptional(bool versionOk, bool testData) const +bool ServerDraftSchematicObjectTemplate::_IngredientSlot::getOptional(bool versionOk) const { -#ifdef _DEBUG -bool testDataValue = false; -#else -UNREF(testData); -#endif + const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getOptional(true); -#endif } if (!m_optional.isLoaded()) @@ -1443,31 +1253,18 @@ UNREF(testData); } bool value = m_optional.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerDraftSchematicObjectTemplate::_IngredientSlot::getOptional -const StringId ServerDraftSchematicObjectTemplate::_IngredientSlot::getName(bool versionOk, bool testData) const +const StringId ServerDraftSchematicObjectTemplate::_IngredientSlot::getName(bool versionOk) const { -#ifdef _DEBUG -StringId testDataValue = DefaultStringId; -#else -UNREF(testData); -#endif + const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getName(true); -#endif } if (!m_name.isLoaded()) @@ -1485,11 +1282,6 @@ UNREF(testData); } const StringId value = m_name.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerDraftSchematicObjectTemplate::_IngredientSlot::getName @@ -1671,22 +1463,14 @@ size_t ServerDraftSchematicObjectTemplate::_IngredientSlot::getOptionsCount(void return count; } // ServerDraftSchematicObjectTemplate::_IngredientSlot::getOptionsCount -const std::string & ServerDraftSchematicObjectTemplate::_IngredientSlot::getOptionalSkillCommand(bool versionOk, bool testData) const +const std::string & ServerDraftSchematicObjectTemplate::_IngredientSlot::getOptionalSkillCommand(bool versionOk) const { -#ifdef _DEBUG -std::string testDataValue = DefaultString; -#else -UNREF(testData); -#endif + const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getOptionalSkillCommand(true); -#endif } if (!m_optionalSkillCommand.isLoaded()) @@ -1704,31 +1488,18 @@ UNREF(testData); } const std::string & value = m_optionalSkillCommand.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerDraftSchematicObjectTemplate::_IngredientSlot::getOptionalSkillCommand -float ServerDraftSchematicObjectTemplate::_IngredientSlot::getComplexity(bool versionOk, bool testData) const +float ServerDraftSchematicObjectTemplate::_IngredientSlot::getComplexity(bool versionOk) const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getComplexity(true); -#endif } if (!m_complexity.isLoaded()) @@ -1768,31 +1539,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerDraftSchematicObjectTemplate::_IngredientSlot::getComplexity -float ServerDraftSchematicObjectTemplate::_IngredientSlot::getComplexityMin(bool versionOk, bool testData) const +float ServerDraftSchematicObjectTemplate::_IngredientSlot::getComplexityMin(bool versionOk) const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getComplexityMin(true); -#endif } if (!m_complexity.isLoaded()) @@ -1832,31 +1590,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerDraftSchematicObjectTemplate::_IngredientSlot::getComplexityMin -float ServerDraftSchematicObjectTemplate::_IngredientSlot::getComplexityMax(bool versionOk, bool testData) const +float ServerDraftSchematicObjectTemplate::_IngredientSlot::getComplexityMax(bool versionOk) const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getComplexityMax(true); -#endif } if (!m_complexity.isLoaded()) @@ -1896,31 +1641,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerDraftSchematicObjectTemplate::_IngredientSlot::getComplexityMax -const std::string & ServerDraftSchematicObjectTemplate::_IngredientSlot::getAppearance(bool versionOk, bool testData) const +const std::string & ServerDraftSchematicObjectTemplate::_IngredientSlot::getAppearance(bool versionOk) const { -#ifdef _DEBUG -std::string testDataValue = DefaultString; -#else -UNREF(testData); -#endif + const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getAppearance(true); -#endif } if (!m_appearance.isLoaded()) @@ -1938,29 +1670,10 @@ UNREF(testData); } const std::string & value = m_appearance.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerDraftSchematicObjectTemplate::_IngredientSlot::getAppearance -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void ServerDraftSchematicObjectTemplate::_IngredientSlot::testValues(void) const -{ - IGNORE_RETURN(getOptional(true)); - IGNORE_RETURN(getName(true)); - IGNORE_RETURN(getOptionalSkillCommand(true)); - IGNORE_RETURN(getComplexityMin(true)); - IGNORE_RETURN(getComplexityMax(true)); - IGNORE_RETURN(getAppearance(true)); -} // ServerDraftSchematicObjectTemplate::_IngredientSlot::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerDraftSchematicObjectTemplate.h b/engine/server/library/serverGame/src/shared/objectTemplate/ServerDraftSchematicObjectTemplate.h index a13fec2d..68a60122 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerDraftSchematicObjectTemplate.h +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerDraftSchematicObjectTemplate.h @@ -73,23 +73,18 @@ protected: virtual Tag getId(void) const; public: - bool getOptional(bool versionOk, bool testData = false) const; - const StringId getName(bool versionOk, bool testData = false) const; + bool getOptional(bool versionOk) const; + const StringId getName(bool versionOk) const; void getOptions(Ingredient &data, int index, bool versionOk) const; void getOptionsMin(Ingredient &data, int index, bool versionOk) const; void getOptionsMax(Ingredient &data, int index, bool versionOk) const; size_t getOptionsCount(void) const; - const std::string & getOptionalSkillCommand(bool versionOk, bool testData = false) const; - float getComplexity(bool versionOk, bool testData = false) const; - float getComplexityMin(bool versionOk, bool testData = false) const; - float getComplexityMax(bool versionOk, bool testData = false) const; - const std::string & getAppearance(bool versionOk, bool testData = false) const; + const std::string & getOptionalSkillCommand(bool versionOk) const; + float getComplexity(bool versionOk) const; + float getComplexityMin(bool versionOk) const; + float getComplexityMax(bool versionOk) const; + const std::string & getAppearance(bool versionOk) const; -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); @@ -113,7 +108,7 @@ private: friend class ServerDraftSchematicObjectTemplate::_IngredientSlot; public: - CraftingType getCategory(bool testData = false) const; + CraftingType getCategory() const; const ServerObjectTemplate * getCraftedObjectTemplate() const; const ServerFactoryObjectTemplate * getCrateObjectTemplate() const; void getSlots(IngredientSlot &data, int index) const; @@ -122,24 +117,19 @@ public: size_t getSlotsCount(void) const; const std::string & getSkillCommands(int index) const; size_t getSkillCommandsCount(void) const; - bool getDestroyIngredients(bool testData = false) const; + bool getDestroyIngredients() const; const std::string & getManufactureScripts(int index) const; size_t getManufactureScriptsCount(void) const; - int getItemsPerContainer(bool testData = false) const; - int getItemsPerContainerMin(bool testData = false) const; - int getItemsPerContainerMax(bool testData = false) const; - float getManufactureTime(bool testData = false) const; - float getManufactureTimeMin(bool testData = false) const; - float getManufactureTimeMax(bool testData = false) const; - float getPrototypeTime(bool testData = false) const; - float getPrototypeTimeMin(bool testData = false) const; - float getPrototypeTimeMax(bool testData = false) const; + int getItemsPerContainer() const; + int getItemsPerContainerMin() const; + int getItemsPerContainerMax() const; + float getManufactureTime() const; + float getManufactureTimeMin() const; + float getManufactureTimeMax() const; + float getPrototypeTime() const; + float getPrototypeTimeMin() const; + float getPrototypeTimeMax() const; -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerFactoryObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerFactoryObjectTemplate.cpp index 21075a19..d86622d6 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerFactoryObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerFactoryObjectTemplate.cpp @@ -112,15 +112,6 @@ Object * ServerFactoryObjectTemplate::createObject(void) const } // ServerFactoryObjectTemplate::createObject //@BEGIN TFD -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void ServerFactoryObjectTemplate::testValues(void) const -{ - ServerTangibleObjectTemplate::testValues(); -} // ServerFactoryObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -163,8 +154,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,0)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerFactoryObjectTemplate.h b/engine/server/library/serverGame/src/shared/objectTemplate/ServerFactoryObjectTemplate.h index 91736fac..44d034c7 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerFactoryObjectTemplate.h +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerFactoryObjectTemplate.h @@ -45,11 +45,6 @@ public: //@BEGIN TFD public: -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerGroupObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerGroupObjectTemplate.cpp index d026ef4f..c426aa8b 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerGroupObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerGroupObjectTemplate.cpp @@ -114,15 +114,6 @@ Object * ServerGroupObjectTemplate::createObject(void) const } // ServerGroupObjectTemplate::createObject //@BEGIN TFD -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void ServerGroupObjectTemplate::testValues(void) const -{ - ServerUniverseObjectTemplate::testValues(); -} // ServerGroupObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -165,8 +156,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,0)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerGroupObjectTemplate.h b/engine/server/library/serverGame/src/shared/objectTemplate/ServerGroupObjectTemplate.h index e847ca95..79748283 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerGroupObjectTemplate.h +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerGroupObjectTemplate.h @@ -45,11 +45,6 @@ public: //@BEGIN TFD public: -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerGuildObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerGuildObjectTemplate.cpp index d7a9bcef..9c73ce50 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerGuildObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerGuildObjectTemplate.cpp @@ -114,15 +114,6 @@ Object * ServerGuildObjectTemplate::createObject(void) const } // ServerGuildObjectTemplate::createObject //@BEGIN TFD -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void ServerGuildObjectTemplate::testValues(void) const -{ - ServerUniverseObjectTemplate::testValues(); -} // ServerGuildObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -165,8 +156,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,0)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerGuildObjectTemplate.h b/engine/server/library/serverGame/src/shared/objectTemplate/ServerGuildObjectTemplate.h index 5aed85aa..18222a05 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerGuildObjectTemplate.h +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerGuildObjectTemplate.h @@ -45,11 +45,6 @@ public: //@BEGIN TFD public: -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerHarvesterInstallationObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerHarvesterInstallationObjectTemplate.cpp index 16bf4a31..d62b39c9 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerHarvesterInstallationObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerHarvesterInstallationObjectTemplate.cpp @@ -112,22 +112,14 @@ Object * ServerHarvesterInstallationObjectTemplate::createObject(void) const } // ServerHarvesterInstallationObjectTemplate::createObject //@BEGIN TFD -int ServerHarvesterInstallationObjectTemplate::getMaxExtractionRate(bool testData) const +int ServerHarvesterInstallationObjectTemplate::getMaxExtractionRate() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerHarvesterInstallationObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMaxExtractionRate(true); -#endif } if (!m_maxExtractionRate.isLoaded()) @@ -167,31 +159,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerHarvesterInstallationObjectTemplate::getMaxExtractionRate -int ServerHarvesterInstallationObjectTemplate::getMaxExtractionRateMin(bool testData) const +int ServerHarvesterInstallationObjectTemplate::getMaxExtractionRateMin() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerHarvesterInstallationObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMaxExtractionRateMin(true); -#endif } if (!m_maxExtractionRate.isLoaded()) @@ -231,31 +210,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerHarvesterInstallationObjectTemplate::getMaxExtractionRateMin -int ServerHarvesterInstallationObjectTemplate::getMaxExtractionRateMax(bool testData) const +int ServerHarvesterInstallationObjectTemplate::getMaxExtractionRateMax() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerHarvesterInstallationObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMaxExtractionRateMax(true); -#endif } if (!m_maxExtractionRate.isLoaded()) @@ -295,31 +261,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerHarvesterInstallationObjectTemplate::getMaxExtractionRateMax -int ServerHarvesterInstallationObjectTemplate::getCurrentExtractionRate(bool testData) const +int ServerHarvesterInstallationObjectTemplate::getCurrentExtractionRate() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerHarvesterInstallationObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getCurrentExtractionRate(true); -#endif } if (!m_currentExtractionRate.isLoaded()) @@ -359,31 +312,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerHarvesterInstallationObjectTemplate::getCurrentExtractionRate -int ServerHarvesterInstallationObjectTemplate::getCurrentExtractionRateMin(bool testData) const +int ServerHarvesterInstallationObjectTemplate::getCurrentExtractionRateMin() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerHarvesterInstallationObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getCurrentExtractionRateMin(true); -#endif } if (!m_currentExtractionRate.isLoaded()) @@ -423,31 +363,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerHarvesterInstallationObjectTemplate::getCurrentExtractionRateMin -int ServerHarvesterInstallationObjectTemplate::getCurrentExtractionRateMax(bool testData) const +int ServerHarvesterInstallationObjectTemplate::getCurrentExtractionRateMax() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerHarvesterInstallationObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getCurrentExtractionRateMax(true); -#endif } if (!m_currentExtractionRate.isLoaded()) @@ -487,31 +414,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerHarvesterInstallationObjectTemplate::getCurrentExtractionRateMax -int ServerHarvesterInstallationObjectTemplate::getMaxHopperSize(bool testData) const +int ServerHarvesterInstallationObjectTemplate::getMaxHopperSize() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerHarvesterInstallationObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMaxHopperSize(true); -#endif } if (!m_maxHopperSize.isLoaded()) @@ -551,31 +465,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerHarvesterInstallationObjectTemplate::getMaxHopperSize -int ServerHarvesterInstallationObjectTemplate::getMaxHopperSizeMin(bool testData) const +int ServerHarvesterInstallationObjectTemplate::getMaxHopperSizeMin() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerHarvesterInstallationObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMaxHopperSizeMin(true); -#endif } if (!m_maxHopperSize.isLoaded()) @@ -615,31 +516,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerHarvesterInstallationObjectTemplate::getMaxHopperSizeMin -int ServerHarvesterInstallationObjectTemplate::getMaxHopperSizeMax(bool testData) const +int ServerHarvesterInstallationObjectTemplate::getMaxHopperSizeMax() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerHarvesterInstallationObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMaxHopperSizeMax(true); -#endif } if (!m_maxHopperSize.isLoaded()) @@ -679,31 +567,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerHarvesterInstallationObjectTemplate::getMaxHopperSizeMax -const std::string & ServerHarvesterInstallationObjectTemplate::getMasterClassName(bool testData) const +const std::string & ServerHarvesterInstallationObjectTemplate::getMasterClassName() const { -#ifdef _DEBUG -std::string testDataValue = DefaultString; -#else -UNREF(testData); -#endif + const ServerHarvesterInstallationObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMasterClassName(true); -#endif } if (!m_masterClassName.isLoaded()) @@ -721,31 +596,10 @@ UNREF(testData); } const std::string & value = m_masterClassName.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerHarvesterInstallationObjectTemplate::getMasterClassName -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void ServerHarvesterInstallationObjectTemplate::testValues(void) const -{ - IGNORE_RETURN(getMaxExtractionRateMin(true)); - IGNORE_RETURN(getMaxExtractionRateMax(true)); - IGNORE_RETURN(getCurrentExtractionRateMin(true)); - IGNORE_RETURN(getCurrentExtractionRateMax(true)); - IGNORE_RETURN(getMaxHopperSizeMin(true)); - IGNORE_RETURN(getMaxHopperSizeMax(true)); - IGNORE_RETURN(getMasterClassName(true)); - ServerInstallationObjectTemplate::testValues(); -} // ServerHarvesterInstallationObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -788,8 +642,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,0)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerHarvesterInstallationObjectTemplate.h b/engine/server/library/serverGame/src/shared/objectTemplate/ServerHarvesterInstallationObjectTemplate.h index a1e72bd8..3ac85c82 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerHarvesterInstallationObjectTemplate.h +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerHarvesterInstallationObjectTemplate.h @@ -44,22 +44,17 @@ public: //@BEGIN TFD public: - int getMaxExtractionRate(bool testData = false) const; - int getMaxExtractionRateMin(bool testData = false) const; - int getMaxExtractionRateMax(bool testData = false) const; - int getCurrentExtractionRate(bool testData = false) const; - int getCurrentExtractionRateMin(bool testData = false) const; - int getCurrentExtractionRateMax(bool testData = false) const; - int getMaxHopperSize(bool testData = false) const; - int getMaxHopperSizeMin(bool testData = false) const; - int getMaxHopperSizeMax(bool testData = false) const; - const std::string & getMasterClassName(bool testData = false) const; + int getMaxExtractionRate() const; + int getMaxExtractionRateMin() const; + int getMaxExtractionRateMax() const; + int getCurrentExtractionRate() const; + int getCurrentExtractionRateMin() const; + int getCurrentExtractionRateMax() const; + int getMaxHopperSize() const; + int getMaxHopperSizeMin() const; + int getMaxHopperSizeMax() const; + const std::string & getMasterClassName() const; -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerInstallationObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerInstallationObjectTemplate.cpp index 8bb94ce5..8f8de32d 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerInstallationObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerInstallationObjectTemplate.cpp @@ -113,15 +113,6 @@ Object * ServerInstallationObjectTemplate::createObject(void) const } // ServerInstallationObjectTemplate::createObject //@BEGIN TFD -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void ServerInstallationObjectTemplate::testValues(void) const -{ - ServerTangibleObjectTemplate::testValues(); -} // ServerInstallationObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -164,8 +155,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,1)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerInstallationObjectTemplate.h b/engine/server/library/serverGame/src/shared/objectTemplate/ServerInstallationObjectTemplate.h index 85a1a18b..c505e5c5 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerInstallationObjectTemplate.h +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerInstallationObjectTemplate.h @@ -45,11 +45,6 @@ public: //@BEGIN TFD public: -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerIntangibleObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerIntangibleObjectTemplate.cpp index 18cce6b3..7215902b 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerIntangibleObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerIntangibleObjectTemplate.cpp @@ -112,22 +112,14 @@ Object * ServerIntangibleObjectTemplate::createObject(void) const } // ServerIntangibleObjectTemplate::createObject //@BEGIN TFD -int ServerIntangibleObjectTemplate::getCount(bool testData) const +int ServerIntangibleObjectTemplate::getCount() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerIntangibleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getCount(true); -#endif } if (!m_count.isLoaded()) @@ -167,31 +159,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerIntangibleObjectTemplate::getCount -int ServerIntangibleObjectTemplate::getCountMin(bool testData) const +int ServerIntangibleObjectTemplate::getCountMin() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerIntangibleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getCountMin(true); -#endif } if (!m_count.isLoaded()) @@ -231,31 +210,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerIntangibleObjectTemplate::getCountMin -int ServerIntangibleObjectTemplate::getCountMax(bool testData) const +int ServerIntangibleObjectTemplate::getCountMax() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerIntangibleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getCountMax(true); -#endif } if (!m_count.isLoaded()) @@ -295,26 +261,10 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerIntangibleObjectTemplate::getCountMax -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void ServerIntangibleObjectTemplate::testValues(void) const -{ - IGNORE_RETURN(getCountMin(true)); - IGNORE_RETURN(getCountMax(true)); - ServerObjectTemplate::testValues(); -} // ServerIntangibleObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -357,8 +307,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,1)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } @@ -440,22 +390,14 @@ Tag ServerIntangibleObjectTemplate::_Ingredient::getId(void) const return _Ingredient_tag; } // ServerIntangibleObjectTemplate::_Ingredient::getId -ServerIntangibleObjectTemplate::IngredientType ServerIntangibleObjectTemplate::_Ingredient::getIngredientType(bool versionOk, bool testData) const +ServerIntangibleObjectTemplate::IngredientType ServerIntangibleObjectTemplate::_Ingredient::getIngredientType(bool versionOk) const { -#ifdef _DEBUG -ServerIntangibleObjectTemplate::IngredientType testDataValue = static_cast(0); -#else -UNREF(testData); -#endif + const ServerIntangibleObjectTemplate::_Ingredient * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getIngredientType(true); -#endif } if (!m_ingredientType.isLoaded()) @@ -473,11 +415,6 @@ UNREF(testData); } IngredientType value = static_cast(m_ingredientType.getValue()); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerIntangibleObjectTemplate::_Ingredient::getIngredientType @@ -638,22 +575,14 @@ size_t ServerIntangibleObjectTemplate::_Ingredient::getIngredientsCount(void) co return count; } // ServerIntangibleObjectTemplate::_Ingredient::getIngredientsCount -float ServerIntangibleObjectTemplate::_Ingredient::getComplexity(bool versionOk, bool testData) const +float ServerIntangibleObjectTemplate::_Ingredient::getComplexity(bool versionOk) const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerIntangibleObjectTemplate::_Ingredient * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getComplexity(true); -#endif } if (!m_complexity.isLoaded()) @@ -693,31 +622,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerIntangibleObjectTemplate::_Ingredient::getComplexity -float ServerIntangibleObjectTemplate::_Ingredient::getComplexityMin(bool versionOk, bool testData) const +float ServerIntangibleObjectTemplate::_Ingredient::getComplexityMin(bool versionOk) const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerIntangibleObjectTemplate::_Ingredient * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getComplexityMin(true); -#endif } if (!m_complexity.isLoaded()) @@ -757,31 +673,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerIntangibleObjectTemplate::_Ingredient::getComplexityMin -float ServerIntangibleObjectTemplate::_Ingredient::getComplexityMax(bool versionOk, bool testData) const +float ServerIntangibleObjectTemplate::_Ingredient::getComplexityMax(bool versionOk) const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerIntangibleObjectTemplate::_Ingredient * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getComplexityMax(true); -#endif } if (!m_complexity.isLoaded()) @@ -821,31 +724,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerIntangibleObjectTemplate::_Ingredient::getComplexityMax -const std::string & ServerIntangibleObjectTemplate::_Ingredient::getSkillCommand(bool versionOk, bool testData) const +const std::string & ServerIntangibleObjectTemplate::_Ingredient::getSkillCommand(bool versionOk) const { -#ifdef _DEBUG -std::string testDataValue = DefaultString; -#else -UNREF(testData); -#endif + const ServerIntangibleObjectTemplate::_Ingredient * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getSkillCommand(true); -#endif } if (!m_skillCommand.isLoaded()) @@ -863,27 +753,10 @@ UNREF(testData); } const std::string & value = m_skillCommand.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerIntangibleObjectTemplate::_Ingredient::getSkillCommand -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void ServerIntangibleObjectTemplate::_Ingredient::testValues(void) const -{ - IGNORE_RETURN(getIngredientType(true)); - IGNORE_RETURN(getComplexityMin(true)); - IGNORE_RETURN(getComplexityMax(true)); - IGNORE_RETURN(getSkillCommand(true)); -} // ServerIntangibleObjectTemplate::_Ingredient::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -984,22 +857,14 @@ Tag ServerIntangibleObjectTemplate::_SchematicAttribute::getId(void) const return _SchematicAttribute_tag; } // ServerIntangibleObjectTemplate::_SchematicAttribute::getId -const StringId ServerIntangibleObjectTemplate::_SchematicAttribute::getName(bool versionOk, bool testData) const +const StringId ServerIntangibleObjectTemplate::_SchematicAttribute::getName(bool versionOk) const { -#ifdef _DEBUG -StringId testDataValue = DefaultStringId; -#else -UNREF(testData); -#endif + const ServerIntangibleObjectTemplate::_SchematicAttribute * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getName(true); -#endif } if (!m_name.isLoaded()) @@ -1017,31 +882,18 @@ UNREF(testData); } const StringId value = m_name.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerIntangibleObjectTemplate::_SchematicAttribute::getName -int ServerIntangibleObjectTemplate::_SchematicAttribute::getValue(bool versionOk, bool testData) const +int ServerIntangibleObjectTemplate::_SchematicAttribute::getValue(bool versionOk) const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerIntangibleObjectTemplate::_SchematicAttribute * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getValue(true); -#endif } if (!m_value.isLoaded()) @@ -1081,31 +933,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerIntangibleObjectTemplate::_SchematicAttribute::getValue -int ServerIntangibleObjectTemplate::_SchematicAttribute::getValueMin(bool versionOk, bool testData) const +int ServerIntangibleObjectTemplate::_SchematicAttribute::getValueMin(bool versionOk) const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerIntangibleObjectTemplate::_SchematicAttribute * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getValueMin(true); -#endif } if (!m_value.isLoaded()) @@ -1145,31 +984,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerIntangibleObjectTemplate::_SchematicAttribute::getValueMin -int ServerIntangibleObjectTemplate::_SchematicAttribute::getValueMax(bool versionOk, bool testData) const +int ServerIntangibleObjectTemplate::_SchematicAttribute::getValueMax(bool versionOk) const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerIntangibleObjectTemplate::_SchematicAttribute * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getValueMax(true); -#endif } if (!m_value.isLoaded()) @@ -1209,26 +1035,10 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerIntangibleObjectTemplate::_SchematicAttribute::getValueMax -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void ServerIntangibleObjectTemplate::_SchematicAttribute::testValues(void) const -{ - IGNORE_RETURN(getName(true)); - IGNORE_RETURN(getValueMin(true)); - IGNORE_RETURN(getValueMax(true)); -} // ServerIntangibleObjectTemplate::_SchematicAttribute::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -1308,22 +1118,14 @@ Tag ServerIntangibleObjectTemplate::_SimpleIngredient::getId(void) const return _SimpleIngredient_tag; } // ServerIntangibleObjectTemplate::_SimpleIngredient::getId -const StringId ServerIntangibleObjectTemplate::_SimpleIngredient::getName(bool versionOk, bool testData) const +const StringId ServerIntangibleObjectTemplate::_SimpleIngredient::getName(bool versionOk) const { -#ifdef _DEBUG -StringId testDataValue = DefaultStringId; -#else -UNREF(testData); -#endif + const ServerIntangibleObjectTemplate::_SimpleIngredient * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getName(true); -#endif } if (!m_name.isLoaded()) @@ -1341,31 +1143,18 @@ UNREF(testData); } const StringId value = m_name.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerIntangibleObjectTemplate::_SimpleIngredient::getName -const std::string & ServerIntangibleObjectTemplate::_SimpleIngredient::getIngredient(bool versionOk, bool testData) const +const std::string & ServerIntangibleObjectTemplate::_SimpleIngredient::getIngredient(bool versionOk) const { -#ifdef _DEBUG -std::string testDataValue = DefaultString; -#else -UNREF(testData); -#endif + const ServerIntangibleObjectTemplate::_SimpleIngredient * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getIngredient(true); -#endif } if (!m_ingredient.isLoaded()) @@ -1383,31 +1172,18 @@ UNREF(testData); } const std::string & value = m_ingredient.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerIntangibleObjectTemplate::_SimpleIngredient::getIngredient -int ServerIntangibleObjectTemplate::_SimpleIngredient::getCount(bool versionOk, bool testData) const +int ServerIntangibleObjectTemplate::_SimpleIngredient::getCount(bool versionOk) const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerIntangibleObjectTemplate::_SimpleIngredient * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getCount(true); -#endif } if (!m_count.isLoaded()) @@ -1447,31 +1223,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerIntangibleObjectTemplate::_SimpleIngredient::getCount -int ServerIntangibleObjectTemplate::_SimpleIngredient::getCountMin(bool versionOk, bool testData) const +int ServerIntangibleObjectTemplate::_SimpleIngredient::getCountMin(bool versionOk) const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerIntangibleObjectTemplate::_SimpleIngredient * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getCountMin(true); -#endif } if (!m_count.isLoaded()) @@ -1511,31 +1274,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerIntangibleObjectTemplate::_SimpleIngredient::getCountMin -int ServerIntangibleObjectTemplate::_SimpleIngredient::getCountMax(bool versionOk, bool testData) const +int ServerIntangibleObjectTemplate::_SimpleIngredient::getCountMax(bool versionOk) const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerIntangibleObjectTemplate::_SimpleIngredient * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getCountMax(true); -#endif } if (!m_count.isLoaded()) @@ -1575,27 +1325,10 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerIntangibleObjectTemplate::_SimpleIngredient::getCountMax -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void ServerIntangibleObjectTemplate::_SimpleIngredient::testValues(void) const -{ - IGNORE_RETURN(getName(true)); - IGNORE_RETURN(getIngredient(true)); - IGNORE_RETURN(getCountMin(true)); - IGNORE_RETURN(getCountMax(true)); -} // ServerIntangibleObjectTemplate::_SimpleIngredient::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerIntangibleObjectTemplate.h b/engine/server/library/serverGame/src/shared/objectTemplate/ServerIntangibleObjectTemplate.h index 6c9bf227..d0123ce1 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerIntangibleObjectTemplate.h +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerIntangibleObjectTemplate.h @@ -96,17 +96,12 @@ protected: virtual Tag getId(void) const; public: - const StringId getName(bool versionOk, bool testData = false) const; - const std::string & getIngredient(bool versionOk, bool testData = false) const; - int getCount(bool versionOk, bool testData = false) const; - int getCountMin(bool versionOk, bool testData = false) const; - int getCountMax(bool versionOk, bool testData = false) const; + const StringId getName(bool versionOk) const; + const std::string & getIngredient(bool versionOk) const; + int getCount(bool versionOk) const; + int getCountMin(bool versionOk) const; + int getCountMax(bool versionOk) const; -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); @@ -140,21 +135,16 @@ private: virtual Tag getId(void) const; public: - IngredientType getIngredientType(bool versionOk, bool testData = false) const; + IngredientType getIngredientType(bool versionOk) const; void getIngredients(SimpleIngredient &data, int index, bool versionOk) const; void getIngredientsMin(SimpleIngredient &data, int index, bool versionOk) const; void getIngredientsMax(SimpleIngredient &data, int index, bool versionOk) const; size_t getIngredientsCount(void) const; - float getComplexity(bool versionOk, bool testData = false) const; - float getComplexityMin(bool versionOk, bool testData = false) const; - float getComplexityMax(bool versionOk, bool testData = false) const; - const std::string & getSkillCommand(bool versionOk, bool testData = false) const; + float getComplexity(bool versionOk) const; + float getComplexityMin(bool versionOk) const; + float getComplexityMax(bool versionOk) const; + const std::string & getSkillCommand(bool versionOk) const; -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); @@ -191,16 +181,11 @@ private: virtual Tag getId(void) const; public: - const StringId getName(bool versionOk, bool testData = false) const; - int getValue(bool versionOk, bool testData = false) const; - int getValueMin(bool versionOk, bool testData = false) const; - int getValueMax(bool versionOk, bool testData = false) const; + const StringId getName(bool versionOk) const; + int getValue(bool versionOk) const; + int getValueMin(bool versionOk) const; + int getValueMax(bool versionOk) const; -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); @@ -218,15 +203,10 @@ private: friend class ServerIntangibleObjectTemplate::_SchematicAttribute; public: - int getCount(bool testData = false) const; - int getCountMin(bool testData = false) const; - int getCountMax(bool testData = false) const; + int getCount() const; + int getCountMin() const; + int getCountMax() const; -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureInstallationObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureInstallationObjectTemplate.cpp index 57b4db42..21a0e496 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureInstallationObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureInstallationObjectTemplate.cpp @@ -112,15 +112,6 @@ Object * ServerManufactureInstallationObjectTemplate::createObject(void) const } // ServerManufactureInstallationObjectTemplate::createObject //@BEGIN TFD -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void ServerManufactureInstallationObjectTemplate::testValues(void) const -{ - ServerInstallationObjectTemplate::testValues(); -} // ServerManufactureInstallationObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -163,8 +154,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,0)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureInstallationObjectTemplate.h b/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureInstallationObjectTemplate.h index 6829674e..285b09f0 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureInstallationObjectTemplate.h +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureInstallationObjectTemplate.h @@ -45,11 +45,6 @@ public: //@BEGIN TFD public: -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureSchematicObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureSchematicObjectTemplate.cpp index 3aee1103..2ec206b5 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureSchematicObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureSchematicObjectTemplate.cpp @@ -170,22 +170,14 @@ Object * ServerManufactureSchematicObjectTemplate::createObject(const DraftSchem } // ServerManufactureSchematicObjectTemplate::createObject //@BEGIN TFD -const std::string & ServerManufactureSchematicObjectTemplate::getDraftSchematic(bool testData) const +const std::string & ServerManufactureSchematicObjectTemplate::getDraftSchematic() const { -#ifdef _DEBUG -std::string testDataValue = DefaultString; -#else -UNREF(testData); -#endif + const ServerManufactureSchematicObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getDraftSchematic(true); -#endif } if (!m_draftSchematic.isLoaded()) @@ -203,31 +195,18 @@ UNREF(testData); } const std::string & value = m_draftSchematic.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerManufactureSchematicObjectTemplate::getDraftSchematic -const std::string & ServerManufactureSchematicObjectTemplate::getCreator(bool testData) const +const std::string & ServerManufactureSchematicObjectTemplate::getCreator() const { -#ifdef _DEBUG -std::string testDataValue = DefaultString; -#else -UNREF(testData); -#endif + const ServerManufactureSchematicObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getCreator(true); -#endif } if (!m_creator.isLoaded()) @@ -245,11 +224,6 @@ UNREF(testData); } const std::string & value = m_creator.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerManufactureSchematicObjectTemplate::getCreator @@ -407,22 +381,14 @@ size_t ServerManufactureSchematicObjectTemplate::getIngredientsCount(void) const return count; } // ServerManufactureSchematicObjectTemplate::getIngredientsCount -int ServerManufactureSchematicObjectTemplate::getItemCount(bool testData) const +int ServerManufactureSchematicObjectTemplate::getItemCount() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerManufactureSchematicObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getItemCount(true); -#endif } if (!m_itemCount.isLoaded()) @@ -462,31 +428,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerManufactureSchematicObjectTemplate::getItemCount -int ServerManufactureSchematicObjectTemplate::getItemCountMin(bool testData) const +int ServerManufactureSchematicObjectTemplate::getItemCountMin() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerManufactureSchematicObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getItemCountMin(true); -#endif } if (!m_itemCount.isLoaded()) @@ -526,31 +479,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerManufactureSchematicObjectTemplate::getItemCountMin -int ServerManufactureSchematicObjectTemplate::getItemCountMax(bool testData) const +int ServerManufactureSchematicObjectTemplate::getItemCountMax() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerManufactureSchematicObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getItemCountMax(true); -#endif } if (!m_itemCount.isLoaded()) @@ -590,11 +530,6 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerManufactureSchematicObjectTemplate::getItemCountMax @@ -752,19 +687,6 @@ size_t ServerManufactureSchematicObjectTemplate::getAttributesCount(void) const return count; } // ServerManufactureSchematicObjectTemplate::getAttributesCount -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void ServerManufactureSchematicObjectTemplate::testValues(void) const -{ - IGNORE_RETURN(getDraftSchematic(true)); - IGNORE_RETURN(getCreator(true)); - IGNORE_RETURN(getItemCountMin(true)); - IGNORE_RETURN(getItemCountMax(true)); - ServerIntangibleObjectTemplate::testValues(); -} // ServerManufactureSchematicObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -807,8 +729,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,0)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } @@ -921,22 +843,14 @@ Tag ServerManufactureSchematicObjectTemplate::_IngredientSlot::getId(void) const return _IngredientSlot_tag; } // ServerManufactureSchematicObjectTemplate::_IngredientSlot::getId -const StringId ServerManufactureSchematicObjectTemplate::_IngredientSlot::getName(bool versionOk, bool testData) const +const StringId ServerManufactureSchematicObjectTemplate::_IngredientSlot::getName(bool versionOk) const { -#ifdef _DEBUG -StringId testDataValue = DefaultStringId; -#else -UNREF(testData); -#endif + const ServerManufactureSchematicObjectTemplate::_IngredientSlot * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getName(true); -#endif } if (!m_name.isLoaded()) @@ -954,11 +868,6 @@ UNREF(testData); } const StringId value = m_name.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerManufactureSchematicObjectTemplate::_IngredientSlot::getName @@ -1080,15 +989,6 @@ void ServerManufactureSchematicObjectTemplate::_IngredientSlot::getIngredientMax data.skillCommand = param->getSkillCommand(versionOk); } // ServerManufactureSchematicObjectTemplate::_IngredientSlot::getIngredientMax -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void ServerManufactureSchematicObjectTemplate::_IngredientSlot::testValues(void) const -{ - IGNORE_RETURN(getName(true)); -} // ServerManufactureSchematicObjectTemplate::_IngredientSlot::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureSchematicObjectTemplate.h b/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureSchematicObjectTemplate.h index d7853c72..94adef16 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureSchematicObjectTemplate.h +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureSchematicObjectTemplate.h @@ -68,16 +68,11 @@ protected: virtual Tag getId(void) const; public: - const StringId getName(bool versionOk, bool testData = false) const; + const StringId getName(bool versionOk) const; void getIngredient(Ingredient &data, bool versionOk) const; void getIngredientMin(Ingredient &data, bool versionOk) const; void getIngredientMax(Ingredient &data, bool versionOk) const; -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); @@ -95,25 +90,20 @@ private: friend class ServerManufactureSchematicObjectTemplate::_IngredientSlot; public: - const std::string & getDraftSchematic(bool testData = false) const; - const std::string & getCreator(bool testData = false) const; + const std::string & getDraftSchematic() const; + const std::string & getCreator() const; void getIngredients(IngredientSlot &data, int index) const; void getIngredientsMin(IngredientSlot &data, int index) const; void getIngredientsMax(IngredientSlot &data, int index) const; size_t getIngredientsCount(void) const; - int getItemCount(bool testData = false) const; - int getItemCountMin(bool testData = false) const; - int getItemCountMax(bool testData = false) const; + int getItemCount() const; + int getItemCountMin() const; + int getItemCountMax() const; void getAttributes(SchematicAttribute &data, int index) const; void getAttributesMin(SchematicAttribute &data, int index) const; void getAttributesMax(SchematicAttribute &data, int index) const; size_t getAttributesCount(void) const; -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerMissionObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerMissionObjectTemplate.cpp index 9417be44..393edf46 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerMissionObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerMissionObjectTemplate.cpp @@ -112,15 +112,6 @@ Object * ServerMissionObjectTemplate::createObject(void) const } // ServerMissionObjectTemplate::createObject //@BEGIN TFD -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void ServerMissionObjectTemplate::testValues(void) const -{ - ServerIntangibleObjectTemplate::testValues(); -} // ServerMissionObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -163,8 +154,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,0)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerMissionObjectTemplate.h b/engine/server/library/serverGame/src/shared/objectTemplate/ServerMissionObjectTemplate.h index 9ee9cdfb..5df89cb8 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerMissionObjectTemplate.h +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerMissionObjectTemplate.h @@ -45,11 +45,6 @@ public: //@BEGIN TFD public: -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerObjectTemplate.cpp index 5e11c2e7..2ace8a95 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerObjectTemplate.cpp @@ -363,22 +363,14 @@ const std::string & ServerObjectTemplate::getArmorRatingString (ArmorRating type //---------------------------------------------------------------------- //@BEGIN TFD -const std::string & ServerObjectTemplate::getSharedTemplate(bool testData) const +const std::string & ServerObjectTemplate::getSharedTemplate() const { -#ifdef _DEBUG -std::string testDataValue = DefaultString; -#else -UNREF(testData); -#endif + const ServerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getSharedTemplate(true); -#endif } if (!m_sharedTemplate.isLoaded()) @@ -396,11 +388,6 @@ UNREF(testData); } const std::string & value = m_sharedTemplate.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerObjectTemplate::getSharedTemplate @@ -492,22 +479,14 @@ void ServerObjectTemplate::getObjvars(DynamicVariableList &list) const m_objvars.getDynamicVariableList(list); } // ServerObjectTemplate::getObjvars -int ServerObjectTemplate::getVolume(bool testData) const +int ServerObjectTemplate::getVolume() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getVolume(true); -#endif } if (!m_volume.isLoaded()) @@ -547,31 +526,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerObjectTemplate::getVolume -int ServerObjectTemplate::getVolumeMin(bool testData) const +int ServerObjectTemplate::getVolumeMin() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getVolumeMin(true); -#endif } if (!m_volume.isLoaded()) @@ -611,31 +577,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerObjectTemplate::getVolumeMin -int ServerObjectTemplate::getVolumeMax(bool testData) const +int ServerObjectTemplate::getVolumeMax() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getVolumeMax(true); -#endif } if (!m_volume.isLoaded()) @@ -675,11 +628,6 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerObjectTemplate::getVolumeMax @@ -858,22 +806,14 @@ size_t ServerObjectTemplate::getMoveFlagsCount(void) const return count; } // ServerObjectTemplate::getMoveFlagsCount -bool ServerObjectTemplate::getInvulnerable(bool testData) const +bool ServerObjectTemplate::getInvulnerable() const { -#ifdef _DEBUG -bool testDataValue = false; -#else -UNREF(testData); -#endif + const ServerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getInvulnerable(true); -#endif } if (!m_invulnerable.isLoaded()) @@ -891,31 +831,18 @@ UNREF(testData); } bool value = m_invulnerable.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerObjectTemplate::getInvulnerable -float ServerObjectTemplate::getComplexity(bool testData) const +float ServerObjectTemplate::getComplexity() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getComplexity(true); -#endif } if (!m_complexity.isLoaded()) @@ -955,31 +882,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerObjectTemplate::getComplexity -float ServerObjectTemplate::getComplexityMin(bool testData) const +float ServerObjectTemplate::getComplexityMin() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getComplexityMin(true); -#endif } if (!m_complexity.isLoaded()) @@ -1019,31 +933,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerObjectTemplate::getComplexityMin -float ServerObjectTemplate::getComplexityMax(bool testData) const +float ServerObjectTemplate::getComplexityMax() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getComplexityMax(true); -#endif } if (!m_complexity.isLoaded()) @@ -1083,31 +984,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerObjectTemplate::getComplexityMax -int ServerObjectTemplate::getTintIndex(bool testData) const +int ServerObjectTemplate::getTintIndex() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getTintIndex(true); -#endif } if (!m_tintIndex.isLoaded()) @@ -1147,31 +1035,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerObjectTemplate::getTintIndex -int ServerObjectTemplate::getTintIndexMin(bool testData) const +int ServerObjectTemplate::getTintIndexMin() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getTintIndexMin(true); -#endif } if (!m_tintIndex.isLoaded()) @@ -1211,31 +1086,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerObjectTemplate::getTintIndexMin -int ServerObjectTemplate::getTintIndexMax(bool testData) const +int ServerObjectTemplate::getTintIndexMax() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getTintIndexMax(true); -#endif } if (!m_tintIndex.isLoaded()) @@ -1275,11 +1137,6 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerObjectTemplate::getTintIndexMax @@ -1743,22 +1600,14 @@ size_t ServerObjectTemplate::getXpPointsCount(void) const return count; } // ServerObjectTemplate::getXpPointsCount -bool ServerObjectTemplate::getPersistByDefault(bool testData) const +bool ServerObjectTemplate::getPersistByDefault() const { -#ifdef _DEBUG -bool testDataValue = false; -#else -UNREF(testData); -#endif + const ServerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getPersistByDefault(true); -#endif } if (!m_persistByDefault.isLoaded()) @@ -1776,31 +1625,18 @@ UNREF(testData); } bool value = m_persistByDefault.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerObjectTemplate::getPersistByDefault -bool ServerObjectTemplate::getPersistContents(bool testData) const +bool ServerObjectTemplate::getPersistContents() const { -#ifdef _DEBUG -bool testDataValue = false; -#else -UNREF(testData); -#endif + const ServerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getPersistContents(true); -#endif } if (!m_persistContents.isLoaded()) @@ -1818,33 +1654,10 @@ UNREF(testData); } bool value = m_persistContents.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerObjectTemplate::getPersistContents -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void ServerObjectTemplate::testValues(void) const -{ - IGNORE_RETURN(getSharedTemplate(true)); - IGNORE_RETURN(getVolumeMin(true)); - IGNORE_RETURN(getVolumeMax(true)); - IGNORE_RETURN(getInvulnerable(true)); - IGNORE_RETURN(getComplexityMin(true)); - IGNORE_RETURN(getComplexityMax(true)); - IGNORE_RETURN(getTintIndexMin(true)); - IGNORE_RETURN(getTintIndexMax(true)); - IGNORE_RETURN(getPersistByDefault(true)); - IGNORE_RETURN(getPersistContents(true)); -} // ServerObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -1886,8 +1699,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,1,1)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } @@ -2098,22 +1911,14 @@ Tag ServerObjectTemplate::_AttribMod::getId(void) const return _AttribMod_tag; } // ServerObjectTemplate::_AttribMod::getId -ServerObjectTemplate::Attributes ServerObjectTemplate::_AttribMod::getTarget(bool versionOk, bool testData) const +ServerObjectTemplate::Attributes ServerObjectTemplate::_AttribMod::getTarget(bool versionOk) const { -#ifdef _DEBUG -ServerObjectTemplate::Attributes testDataValue = static_cast(0); -#else -UNREF(testData); -#endif + const ServerObjectTemplate::_AttribMod * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getTarget(true); -#endif } if (!m_target.isLoaded()) @@ -2131,31 +1936,18 @@ UNREF(testData); } Attributes value = static_cast(m_target.getValue()); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerObjectTemplate::_AttribMod::getTarget -int ServerObjectTemplate::_AttribMod::getValue(bool versionOk, bool testData) const +int ServerObjectTemplate::_AttribMod::getValue(bool versionOk) const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerObjectTemplate::_AttribMod * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getValue(true); -#endif } if (!m_value.isLoaded()) @@ -2195,31 +1987,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerObjectTemplate::_AttribMod::getValue -int ServerObjectTemplate::_AttribMod::getValueMin(bool versionOk, bool testData) const +int ServerObjectTemplate::_AttribMod::getValueMin(bool versionOk) const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerObjectTemplate::_AttribMod * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getValueMin(true); -#endif } if (!m_value.isLoaded()) @@ -2259,31 +2038,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerObjectTemplate::_AttribMod::getValueMin -int ServerObjectTemplate::_AttribMod::getValueMax(bool versionOk, bool testData) const +int ServerObjectTemplate::_AttribMod::getValueMax(bool versionOk) const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerObjectTemplate::_AttribMod * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getValueMax(true); -#endif } if (!m_value.isLoaded()) @@ -2323,31 +2089,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerObjectTemplate::_AttribMod::getValueMax -float ServerObjectTemplate::_AttribMod::getTime(bool versionOk, bool testData) const +float ServerObjectTemplate::_AttribMod::getTime(bool versionOk) const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerObjectTemplate::_AttribMod * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getTime(true); -#endif } if (!m_time.isLoaded()) @@ -2387,31 +2140,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerObjectTemplate::_AttribMod::getTime -float ServerObjectTemplate::_AttribMod::getTimeMin(bool versionOk, bool testData) const +float ServerObjectTemplate::_AttribMod::getTimeMin(bool versionOk) const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerObjectTemplate::_AttribMod * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getTimeMin(true); -#endif } if (!m_time.isLoaded()) @@ -2451,31 +2191,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerObjectTemplate::_AttribMod::getTimeMin -float ServerObjectTemplate::_AttribMod::getTimeMax(bool versionOk, bool testData) const +float ServerObjectTemplate::_AttribMod::getTimeMax(bool versionOk) const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerObjectTemplate::_AttribMod * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getTimeMax(true); -#endif } if (!m_time.isLoaded()) @@ -2515,31 +2242,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerObjectTemplate::_AttribMod::getTimeMax -float ServerObjectTemplate::_AttribMod::getTimeAtValue(bool versionOk, bool testData) const +float ServerObjectTemplate::_AttribMod::getTimeAtValue(bool versionOk) const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerObjectTemplate::_AttribMod * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getTimeAtValue(true); -#endif } if (!m_timeAtValue.isLoaded()) @@ -2579,31 +2293,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerObjectTemplate::_AttribMod::getTimeAtValue -float ServerObjectTemplate::_AttribMod::getTimeAtValueMin(bool versionOk, bool testData) const +float ServerObjectTemplate::_AttribMod::getTimeAtValueMin(bool versionOk) const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerObjectTemplate::_AttribMod * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getTimeAtValueMin(true); -#endif } if (!m_timeAtValue.isLoaded()) @@ -2643,31 +2344,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerObjectTemplate::_AttribMod::getTimeAtValueMin -float ServerObjectTemplate::_AttribMod::getTimeAtValueMax(bool versionOk, bool testData) const +float ServerObjectTemplate::_AttribMod::getTimeAtValueMax(bool versionOk) const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerObjectTemplate::_AttribMod * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getTimeAtValueMax(true); -#endif } if (!m_timeAtValue.isLoaded()) @@ -2707,31 +2395,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerObjectTemplate::_AttribMod::getTimeAtValueMax -float ServerObjectTemplate::_AttribMod::getDecay(bool versionOk, bool testData) const +float ServerObjectTemplate::_AttribMod::getDecay(bool versionOk) const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerObjectTemplate::_AttribMod * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getDecay(true); -#endif } if (!m_decay.isLoaded()) @@ -2771,31 +2446,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerObjectTemplate::_AttribMod::getDecay -float ServerObjectTemplate::_AttribMod::getDecayMin(bool versionOk, bool testData) const +float ServerObjectTemplate::_AttribMod::getDecayMin(bool versionOk) const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerObjectTemplate::_AttribMod * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getDecayMin(true); -#endif } if (!m_decay.isLoaded()) @@ -2835,31 +2497,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerObjectTemplate::_AttribMod::getDecayMin -float ServerObjectTemplate::_AttribMod::getDecayMax(bool versionOk, bool testData) const +float ServerObjectTemplate::_AttribMod::getDecayMax(bool versionOk) const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerObjectTemplate::_AttribMod * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getDecayMax(true); -#endif } if (!m_decay.isLoaded()) @@ -2899,32 +2548,10 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerObjectTemplate::_AttribMod::getDecayMax -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void ServerObjectTemplate::_AttribMod::testValues(void) const -{ - IGNORE_RETURN(getTarget(true)); - IGNORE_RETURN(getValueMin(true)); - IGNORE_RETURN(getValueMax(true)); - IGNORE_RETURN(getTimeMin(true)); - IGNORE_RETURN(getTimeMax(true)); - IGNORE_RETURN(getTimeAtValueMin(true)); - IGNORE_RETURN(getTimeAtValueMax(true)); - IGNORE_RETURN(getDecayMin(true)); - IGNORE_RETURN(getDecayMax(true)); -} // ServerObjectTemplate::_AttribMod::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -3057,22 +2684,14 @@ Tag ServerObjectTemplate::_Contents::getId(void) const return _Contents_tag; } // ServerObjectTemplate::_Contents::getId -const std::string & ServerObjectTemplate::_Contents::getSlotName(bool versionOk, bool testData) const +const std::string & ServerObjectTemplate::_Contents::getSlotName(bool versionOk) const { -#ifdef _DEBUG -std::string testDataValue = DefaultString; -#else -UNREF(testData); -#endif + const ServerObjectTemplate::_Contents * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getSlotName(true); -#endif } if (!m_slotName.isLoaded()) @@ -3090,31 +2709,18 @@ UNREF(testData); } const std::string & value = m_slotName.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerObjectTemplate::_Contents::getSlotName -bool ServerObjectTemplate::_Contents::getEquipObject(bool versionOk, bool testData) const +bool ServerObjectTemplate::_Contents::getEquipObject(bool versionOk) const { -#ifdef _DEBUG -bool testDataValue = false; -#else -UNREF(testData); -#endif + const ServerObjectTemplate::_Contents * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getEquipObject(true); -#endif } if (!m_equipObject.isLoaded()) @@ -3132,11 +2738,6 @@ UNREF(testData); } bool value = m_equipObject.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerObjectTemplate::_Contents::getEquipObject @@ -3174,16 +2775,6 @@ const ServerObjectTemplate * ServerObjectTemplate::_Contents::getContent(bool ve return returnValue; } // ServerObjectTemplate::_Contents::getContent -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void ServerObjectTemplate::_Contents::testValues(void) const -{ - IGNORE_RETURN(getSlotName(true)); - IGNORE_RETURN(getEquipObject(true)); -} // ServerObjectTemplate::_Contents::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -3265,22 +2856,14 @@ Tag ServerObjectTemplate::_MentalStateMod::getId(void) const return _MentalStateMod_tag; } // ServerObjectTemplate::_MentalStateMod::getId -ServerObjectTemplate::MentalStates ServerObjectTemplate::_MentalStateMod::getTarget(bool versionOk, bool testData) const +ServerObjectTemplate::MentalStates ServerObjectTemplate::_MentalStateMod::getTarget(bool versionOk) const { -#ifdef _DEBUG -ServerObjectTemplate::MentalStates testDataValue = static_cast(0); -#else -UNREF(testData); -#endif + const ServerObjectTemplate::_MentalStateMod * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getTarget(true); -#endif } if (!m_target.isLoaded()) @@ -3298,31 +2881,18 @@ UNREF(testData); } MentalStates value = static_cast(m_target.getValue()); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerObjectTemplate::_MentalStateMod::getTarget -float ServerObjectTemplate::_MentalStateMod::getValue(bool versionOk, bool testData) const +float ServerObjectTemplate::_MentalStateMod::getValue(bool versionOk) const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerObjectTemplate::_MentalStateMod * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getValue(true); -#endif } if (!m_value.isLoaded()) @@ -3362,31 +2932,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerObjectTemplate::_MentalStateMod::getValue -float ServerObjectTemplate::_MentalStateMod::getValueMin(bool versionOk, bool testData) const +float ServerObjectTemplate::_MentalStateMod::getValueMin(bool versionOk) const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerObjectTemplate::_MentalStateMod * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getValueMin(true); -#endif } if (!m_value.isLoaded()) @@ -3426,31 +2983,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerObjectTemplate::_MentalStateMod::getValueMin -float ServerObjectTemplate::_MentalStateMod::getValueMax(bool versionOk, bool testData) const +float ServerObjectTemplate::_MentalStateMod::getValueMax(bool versionOk) const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerObjectTemplate::_MentalStateMod * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getValueMax(true); -#endif } if (!m_value.isLoaded()) @@ -3490,31 +3034,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerObjectTemplate::_MentalStateMod::getValueMax -float ServerObjectTemplate::_MentalStateMod::getTime(bool versionOk, bool testData) const +float ServerObjectTemplate::_MentalStateMod::getTime(bool versionOk) const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerObjectTemplate::_MentalStateMod * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getTime(true); -#endif } if (!m_time.isLoaded()) @@ -3554,31 +3085,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerObjectTemplate::_MentalStateMod::getTime -float ServerObjectTemplate::_MentalStateMod::getTimeMin(bool versionOk, bool testData) const +float ServerObjectTemplate::_MentalStateMod::getTimeMin(bool versionOk) const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerObjectTemplate::_MentalStateMod * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getTimeMin(true); -#endif } if (!m_time.isLoaded()) @@ -3618,31 +3136,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerObjectTemplate::_MentalStateMod::getTimeMin -float ServerObjectTemplate::_MentalStateMod::getTimeMax(bool versionOk, bool testData) const +float ServerObjectTemplate::_MentalStateMod::getTimeMax(bool versionOk) const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerObjectTemplate::_MentalStateMod * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getTimeMax(true); -#endif } if (!m_time.isLoaded()) @@ -3682,31 +3187,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerObjectTemplate::_MentalStateMod::getTimeMax -float ServerObjectTemplate::_MentalStateMod::getTimeAtValue(bool versionOk, bool testData) const +float ServerObjectTemplate::_MentalStateMod::getTimeAtValue(bool versionOk) const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerObjectTemplate::_MentalStateMod * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getTimeAtValue(true); -#endif } if (!m_timeAtValue.isLoaded()) @@ -3746,31 +3238,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerObjectTemplate::_MentalStateMod::getTimeAtValue -float ServerObjectTemplate::_MentalStateMod::getTimeAtValueMin(bool versionOk, bool testData) const +float ServerObjectTemplate::_MentalStateMod::getTimeAtValueMin(bool versionOk) const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerObjectTemplate::_MentalStateMod * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getTimeAtValueMin(true); -#endif } if (!m_timeAtValue.isLoaded()) @@ -3810,31 +3289,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerObjectTemplate::_MentalStateMod::getTimeAtValueMin -float ServerObjectTemplate::_MentalStateMod::getTimeAtValueMax(bool versionOk, bool testData) const +float ServerObjectTemplate::_MentalStateMod::getTimeAtValueMax(bool versionOk) const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerObjectTemplate::_MentalStateMod * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getTimeAtValueMax(true); -#endif } if (!m_timeAtValue.isLoaded()) @@ -3874,31 +3340,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerObjectTemplate::_MentalStateMod::getTimeAtValueMax -float ServerObjectTemplate::_MentalStateMod::getDecay(bool versionOk, bool testData) const +float ServerObjectTemplate::_MentalStateMod::getDecay(bool versionOk) const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerObjectTemplate::_MentalStateMod * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getDecay(true); -#endif } if (!m_decay.isLoaded()) @@ -3938,31 +3391,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerObjectTemplate::_MentalStateMod::getDecay -float ServerObjectTemplate::_MentalStateMod::getDecayMin(bool versionOk, bool testData) const +float ServerObjectTemplate::_MentalStateMod::getDecayMin(bool versionOk) const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerObjectTemplate::_MentalStateMod * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getDecayMin(true); -#endif } if (!m_decay.isLoaded()) @@ -4002,31 +3442,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerObjectTemplate::_MentalStateMod::getDecayMin -float ServerObjectTemplate::_MentalStateMod::getDecayMax(bool versionOk, bool testData) const +float ServerObjectTemplate::_MentalStateMod::getDecayMax(bool versionOk) const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerObjectTemplate::_MentalStateMod * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getDecayMax(true); -#endif } if (!m_decay.isLoaded()) @@ -4066,32 +3493,10 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerObjectTemplate::_MentalStateMod::getDecayMax -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void ServerObjectTemplate::_MentalStateMod::testValues(void) const -{ - IGNORE_RETURN(getTarget(true)); - IGNORE_RETURN(getValueMin(true)); - IGNORE_RETURN(getValueMax(true)); - IGNORE_RETURN(getTimeMin(true)); - IGNORE_RETURN(getTimeMax(true)); - IGNORE_RETURN(getTimeAtValueMin(true)); - IGNORE_RETURN(getTimeAtValueMax(true)); - IGNORE_RETURN(getDecayMin(true)); - IGNORE_RETURN(getDecayMax(true)); -} // ServerObjectTemplate::_MentalStateMod::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -4177,22 +3582,14 @@ Tag ServerObjectTemplate::_Xp::getId(void) const return _Xp_tag; } // ServerObjectTemplate::_Xp::getId -ServerObjectTemplate::XpTypes ServerObjectTemplate::_Xp::getType(bool versionOk, bool testData) const +ServerObjectTemplate::XpTypes ServerObjectTemplate::_Xp::getType(bool versionOk) const { -#ifdef _DEBUG -ServerObjectTemplate::XpTypes testDataValue = static_cast(0); -#else -UNREF(testData); -#endif + const ServerObjectTemplate::_Xp * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getType(true); -#endif } if (!m_type.isLoaded()) @@ -4210,31 +3607,18 @@ UNREF(testData); } XpTypes value = static_cast(m_type.getValue()); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerObjectTemplate::_Xp::getType -int ServerObjectTemplate::_Xp::getLevel(bool versionOk, bool testData) const +int ServerObjectTemplate::_Xp::getLevel(bool versionOk) const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerObjectTemplate::_Xp * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getLevel(true); -#endif } if (!m_level.isLoaded()) @@ -4274,31 +3658,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerObjectTemplate::_Xp::getLevel -int ServerObjectTemplate::_Xp::getLevelMin(bool versionOk, bool testData) const +int ServerObjectTemplate::_Xp::getLevelMin(bool versionOk) const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerObjectTemplate::_Xp * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getLevelMin(true); -#endif } if (!m_level.isLoaded()) @@ -4338,31 +3709,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerObjectTemplate::_Xp::getLevelMin -int ServerObjectTemplate::_Xp::getLevelMax(bool versionOk, bool testData) const +int ServerObjectTemplate::_Xp::getLevelMax(bool versionOk) const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerObjectTemplate::_Xp * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getLevelMax(true); -#endif } if (!m_level.isLoaded()) @@ -4402,31 +3760,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerObjectTemplate::_Xp::getLevelMax -int ServerObjectTemplate::_Xp::getValue(bool versionOk, bool testData) const +int ServerObjectTemplate::_Xp::getValue(bool versionOk) const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerObjectTemplate::_Xp * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getValue(true); -#endif } if (!m_value.isLoaded()) @@ -4466,31 +3811,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerObjectTemplate::_Xp::getValue -int ServerObjectTemplate::_Xp::getValueMin(bool versionOk, bool testData) const +int ServerObjectTemplate::_Xp::getValueMin(bool versionOk) const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerObjectTemplate::_Xp * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getValueMin(true); -#endif } if (!m_value.isLoaded()) @@ -4530,31 +3862,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerObjectTemplate::_Xp::getValueMin -int ServerObjectTemplate::_Xp::getValueMax(bool versionOk, bool testData) const +int ServerObjectTemplate::_Xp::getValueMax(bool versionOk) const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerObjectTemplate::_Xp * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getValueMax(true); -#endif } if (!m_value.isLoaded()) @@ -4594,28 +3913,10 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerObjectTemplate::_Xp::getValueMax -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void ServerObjectTemplate::_Xp::testValues(void) const -{ - IGNORE_RETURN(getType(true)); - IGNORE_RETURN(getLevelMin(true)); - IGNORE_RETURN(getLevelMax(true)); - IGNORE_RETURN(getValueMin(true)); - IGNORE_RETURN(getValueMax(true)); -} // ServerObjectTemplate::_Xp::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerObjectTemplate.h b/engine/server/library/serverGame/src/shared/objectTemplate/ServerObjectTemplate.h index 774c30f6..ca64fd5e 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerObjectTemplate.h +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerObjectTemplate.h @@ -317,25 +317,20 @@ protected: virtual Tag getId(void) const; public: - Attributes getTarget(bool versionOk, bool testData = false) const; - int getValue(bool versionOk, bool testData = false) const; - int getValueMin(bool versionOk, bool testData = false) const; - int getValueMax(bool versionOk, bool testData = false) const; - float getTime(bool versionOk, bool testData = false) const; - float getTimeMin(bool versionOk, bool testData = false) const; - float getTimeMax(bool versionOk, bool testData = false) const; - float getTimeAtValue(bool versionOk, bool testData = false) const; - float getTimeAtValueMin(bool versionOk, bool testData = false) const; - float getTimeAtValueMax(bool versionOk, bool testData = false) const; - float getDecay(bool versionOk, bool testData = false) const; - float getDecayMin(bool versionOk, bool testData = false) const; - float getDecayMax(bool versionOk, bool testData = false) const; + Attributes getTarget(bool versionOk) const; + int getValue(bool versionOk) const; + int getValueMin(bool versionOk) const; + int getValueMax(bool versionOk) const; + float getTime(bool versionOk) const; + float getTimeMin(bool versionOk) const; + float getTimeMax(bool versionOk) const; + float getTimeAtValue(bool versionOk) const; + float getTimeAtValueMin(bool versionOk) const; + float getTimeAtValueMax(bool versionOk) const; + float getDecay(bool versionOk) const; + float getDecayMin(bool versionOk) const; + float getDecayMax(bool versionOk) const; -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); @@ -371,25 +366,20 @@ private: virtual Tag getId(void) const; public: - MentalStates getTarget(bool versionOk, bool testData = false) const; - float getValue(bool versionOk, bool testData = false) const; - float getValueMin(bool versionOk, bool testData = false) const; - float getValueMax(bool versionOk, bool testData = false) const; - float getTime(bool versionOk, bool testData = false) const; - float getTimeMin(bool versionOk, bool testData = false) const; - float getTimeMax(bool versionOk, bool testData = false) const; - float getTimeAtValue(bool versionOk, bool testData = false) const; - float getTimeAtValueMin(bool versionOk, bool testData = false) const; - float getTimeAtValueMax(bool versionOk, bool testData = false) const; - float getDecay(bool versionOk, bool testData = false) const; - float getDecayMin(bool versionOk, bool testData = false) const; - float getDecayMax(bool versionOk, bool testData = false) const; + MentalStates getTarget(bool versionOk) const; + float getValue(bool versionOk) const; + float getValueMin(bool versionOk) const; + float getValueMax(bool versionOk) const; + float getTime(bool versionOk) const; + float getTimeMin(bool versionOk) const; + float getTimeMax(bool versionOk) const; + float getTimeAtValue(bool versionOk) const; + float getTimeAtValueMin(bool versionOk) const; + float getTimeAtValueMax(bool versionOk) const; + float getDecay(bool versionOk) const; + float getDecayMin(bool versionOk) const; + float getDecayMax(bool versionOk) const; -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); @@ -425,15 +415,10 @@ private: virtual Tag getId(void) const; public: - const std::string & getSlotName(bool versionOk, bool testData = false) const; - bool getEquipObject(bool versionOk, bool testData = false) const; + const std::string & getSlotName(bool versionOk) const; + bool getEquipObject(bool versionOk) const; const ServerObjectTemplate * getContent(bool versionOk) const; -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); @@ -467,19 +452,14 @@ private: virtual Tag getId(void) const; public: - XpTypes getType(bool versionOk, bool testData = false) const; - int getLevel(bool versionOk, bool testData = false) const; - int getLevelMin(bool versionOk, bool testData = false) const; - int getLevelMax(bool versionOk, bool testData = false) const; - int getValue(bool versionOk, bool testData = false) const; - int getValueMin(bool versionOk, bool testData = false) const; - int getValueMax(bool versionOk, bool testData = false) const; + XpTypes getType(bool versionOk) const; + int getLevel(bool versionOk) const; + int getLevelMin(bool versionOk) const; + int getLevelMax(bool versionOk) const; + int getValue(bool versionOk) const; + int getValueMin(bool versionOk) const; + int getValueMax(bool versionOk) const; -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); @@ -498,26 +478,26 @@ private: friend class ServerObjectTemplate::_Xp; public: - const std::string & getSharedTemplate(bool testData = false) const; + const std::string & getSharedTemplate() const; const std::string & getScripts(int index) const; size_t getScriptsCount(void) const; void getObjvars(DynamicVariableList &list) const; - int getVolume(bool testData = false) const; - int getVolumeMin(bool testData = false) const; - int getVolumeMax(bool testData = false) const; + int getVolume() const; + int getVolumeMin() const; + int getVolumeMax() const; VisibleFlags getVisibleFlags(int index) const; size_t getVisibleFlagsCount(void) const; DeleteFlags getDeleteFlags(int index) const; size_t getDeleteFlagsCount(void) const; MoveFlags getMoveFlags(int index) const; size_t getMoveFlagsCount(void) const; - bool getInvulnerable(bool testData = false) const; - float getComplexity(bool testData = false) const; - float getComplexityMin(bool testData = false) const; - float getComplexityMax(bool testData = false) const; - int getTintIndex(bool testData = false) const; - int getTintIndexMin(bool testData = false) const; - int getTintIndexMax(bool testData = false) const; + bool getInvulnerable() const; + float getComplexity() const; + float getComplexityMin() const; + float getComplexityMax() const; + int getTintIndex() const; + int getTintIndexMin() const; + int getTintIndexMax() const; float getUpdateRanges(UpdateRanges index) const; float getUpdateRangesMin(UpdateRanges index) const; float getUpdateRangesMax(UpdateRanges index) const; @@ -529,14 +509,9 @@ public: void getXpPointsMin(Xp &data, int index) const; void getXpPointsMax(Xp &data, int index) const; size_t getXpPointsCount(void) const; - bool getPersistByDefault(bool testData = false) const; - bool getPersistContents(bool testData = false) const; + bool getPersistByDefault() const; + bool getPersistContents() const; -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlanetObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlanetObjectTemplate.cpp index 3c4e1053..e062a1a2 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlanetObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlanetObjectTemplate.cpp @@ -112,22 +112,14 @@ Object * ServerPlanetObjectTemplate::createObject(void) const } // ServerPlanetObjectTemplate::createObject //@BEGIN TFD -const std::string & ServerPlanetObjectTemplate::getPlanetName(bool testData) const +const std::string & ServerPlanetObjectTemplate::getPlanetName() const { -#ifdef _DEBUG -std::string testDataValue = DefaultString; -#else -UNREF(testData); -#endif + const ServerPlanetObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getPlanetName(true); -#endif } if (!m_planetName.isLoaded()) @@ -145,25 +137,10 @@ UNREF(testData); } const std::string & value = m_planetName.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerPlanetObjectTemplate::getPlanetName -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void ServerPlanetObjectTemplate::testValues(void) const -{ - IGNORE_RETURN(getPlanetName(true)); - ServerUniverseObjectTemplate::testValues(); -} // ServerPlanetObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -206,8 +183,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,0)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlanetObjectTemplate.h b/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlanetObjectTemplate.h index 16160251..c87a9d50 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlanetObjectTemplate.h +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlanetObjectTemplate.h @@ -44,13 +44,8 @@ public: //@BEGIN TFD public: - const std::string & getPlanetName(bool testData = false) const; + const std::string & getPlanetName() const; -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerObjectTemplate.cpp index effe5904..5c5b8bc7 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerObjectTemplate.cpp @@ -12,7 +12,7 @@ #include "serverGame/FirstServerGame.h" #include "ServerPlayerObjectTemplate.h" -#include "sharedDebug/DataLint.h" + #include "sharedFile/Iff.h" #include "sharedObject/ObjectTemplate.h" #include "sharedObject/ObjectTemplateList.h" @@ -114,15 +114,6 @@ Object * ServerPlayerObjectTemplate::createObject(void) const } // ServerPlayerObjectTemplate::createObject //@BEGIN TFD -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void ServerPlayerObjectTemplate::testValues(void) const -{ - ServerIntangibleObjectTemplate::testValues(); -} // ServerPlayerObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -165,8 +156,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,0)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerObjectTemplate.h b/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerObjectTemplate.h index 9ca8d598..098ed26c 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerObjectTemplate.h +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerObjectTemplate.h @@ -48,11 +48,6 @@ public: //@BEGIN TFD public: -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerQuestObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerQuestObjectTemplate.cpp index 5949f691..f8e95c89 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerQuestObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerQuestObjectTemplate.cpp @@ -13,7 +13,7 @@ #include "serverGame/FirstServerGame.h" #include "serverGame/PlayerQuestObject.h" #include "ServerPlayerQuestObjectTemplate.h" -#include "sharedDebug/DataLint.h" + #include "sharedFile/Iff.h" #include "sharedMath/Vector.h" #include "sharedObject/ObjectTemplate.h" @@ -115,15 +115,6 @@ Object * ServerPlayerQuestObjectTemplate::createObject(void) const //@BEGIN TFD -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void ServerPlayerQuestObjectTemplate::testValues(void) const -{ - ServerTangibleObjectTemplate::testValues(); -} // ServerPlayerQuestObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -166,8 +157,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,0)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerQuestObjectTemplate.h b/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerQuestObjectTemplate.h index 3027c1af..cf677c9c 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerQuestObjectTemplate.h +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerQuestObjectTemplate.h @@ -45,11 +45,6 @@ public: //@BEGIN TFD public: -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerResourceContainerObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerResourceContainerObjectTemplate.cpp index a5512489..664a0e50 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerResourceContainerObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerResourceContainerObjectTemplate.cpp @@ -112,22 +112,14 @@ Object * ServerResourceContainerObjectTemplate::createObject(void) const } // ServerResourceContainerObjectTemplate::createObject //@BEGIN TFD -int ServerResourceContainerObjectTemplate::getMaxResources(bool testData) const +int ServerResourceContainerObjectTemplate::getMaxResources() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerResourceContainerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMaxResources(true); -#endif } if (!m_maxResources.isLoaded()) @@ -167,31 +159,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerResourceContainerObjectTemplate::getMaxResources -int ServerResourceContainerObjectTemplate::getMaxResourcesMin(bool testData) const +int ServerResourceContainerObjectTemplate::getMaxResourcesMin() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerResourceContainerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMaxResourcesMin(true); -#endif } if (!m_maxResources.isLoaded()) @@ -231,31 +210,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerResourceContainerObjectTemplate::getMaxResourcesMin -int ServerResourceContainerObjectTemplate::getMaxResourcesMax(bool testData) const +int ServerResourceContainerObjectTemplate::getMaxResourcesMax() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerResourceContainerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMaxResourcesMax(true); -#endif } if (!m_maxResources.isLoaded()) @@ -295,26 +261,10 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerResourceContainerObjectTemplate::getMaxResourcesMax -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void ServerResourceContainerObjectTemplate::testValues(void) const -{ - IGNORE_RETURN(getMaxResourcesMin(true)); - IGNORE_RETURN(getMaxResourcesMax(true)); - ServerTangibleObjectTemplate::testValues(); -} // ServerResourceContainerObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -357,8 +307,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,0)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerResourceContainerObjectTemplate.h b/engine/server/library/serverGame/src/shared/objectTemplate/ServerResourceContainerObjectTemplate.h index 478e871f..aff0948e 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerResourceContainerObjectTemplate.h +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerResourceContainerObjectTemplate.h @@ -44,15 +44,10 @@ public: //@BEGIN TFD public: - int getMaxResources(bool testData = false) const; - int getMaxResourcesMin(bool testData = false) const; - int getMaxResourcesMax(bool testData = false) const; + int getMaxResources() const; + int getMaxResourcesMin() const; + int getMaxResourcesMax() const; -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerShipObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerShipObjectTemplate.cpp index a2d12972..fee87be0 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerShipObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerShipObjectTemplate.cpp @@ -13,7 +13,7 @@ #include "serverGame/FirstServerGame.h" #include "ServerShipObjectTemplate.h" #include "serverGame/ShipObject.h" -#include "sharedDebug/DataLint.h" + #include "sharedFile/Iff.h" #include "sharedObject/ObjectTemplate.h" #include "sharedObject/ObjectTemplateList.h" @@ -113,22 +113,14 @@ Object * ServerShipObjectTemplate::createObject(void) const } // ServerShipObjectTemplate::createObject //@BEGIN TFD -const std::string & ServerShipObjectTemplate::getShipType(bool testData) const +const std::string & ServerShipObjectTemplate::getShipType() const { -#ifdef _DEBUG -std::string testDataValue = DefaultString; -#else -UNREF(testData); -#endif + const ServerShipObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getShipType(true); -#endif } if (!m_shipType.isLoaded()) @@ -146,25 +138,10 @@ UNREF(testData); } const std::string & value = m_shipType.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerShipObjectTemplate::getShipType -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void ServerShipObjectTemplate::testValues(void) const -{ - IGNORE_RETURN(getShipType(true)); - ServerTangibleObjectTemplate::testValues(); -} // ServerShipObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -207,8 +184,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,1)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerShipObjectTemplate.h b/engine/server/library/serverGame/src/shared/objectTemplate/ServerShipObjectTemplate.h index 44f18426..c55342f9 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerShipObjectTemplate.h +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerShipObjectTemplate.h @@ -44,13 +44,8 @@ public: //@BEGIN TFD public: - const std::string & getShipType(bool testData = false) const; + const std::string & getShipType() const; -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerStaticObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerStaticObjectTemplate.cpp index f2e49fba..c4d48e62 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerStaticObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerStaticObjectTemplate.cpp @@ -112,22 +112,14 @@ Object * ServerStaticObjectTemplate::createObject(void) const } // ServerStaticObjectTemplate::createObject //@BEGIN TFD -bool ServerStaticObjectTemplate::getClientOnlyBuildout(bool testData) const +bool ServerStaticObjectTemplate::getClientOnlyBuildout() const { -#ifdef _DEBUG -bool testDataValue = false; -#else -UNREF(testData); -#endif + const ServerStaticObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getClientOnlyBuildout(true); -#endif } if (!m_clientOnlyBuildout.isLoaded()) @@ -145,25 +137,10 @@ UNREF(testData); } bool value = m_clientOnlyBuildout.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerStaticObjectTemplate::getClientOnlyBuildout -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void ServerStaticObjectTemplate::testValues(void) const -{ - IGNORE_RETURN(getClientOnlyBuildout(true)); - ServerObjectTemplate::testValues(); -} // ServerStaticObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -206,8 +183,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,1)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerStaticObjectTemplate.h b/engine/server/library/serverGame/src/shared/objectTemplate/ServerStaticObjectTemplate.h index cda42b71..71125cdb 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerStaticObjectTemplate.h +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerStaticObjectTemplate.h @@ -44,13 +44,8 @@ public: //@BEGIN TFD public: - bool getClientOnlyBuildout(bool testData = false) const; + bool getClientOnlyBuildout() const; -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerTangibleObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerTangibleObjectTemplate.cpp index 3bdb728d..6212cc40 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerTangibleObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerTangibleObjectTemplate.cpp @@ -184,22 +184,14 @@ size_t ServerTangibleObjectTemplate::getTriggerVolumesCount(void) const return count; } // ServerTangibleObjectTemplate::getTriggerVolumesCount -ServerTangibleObjectTemplate::CombatSkeleton ServerTangibleObjectTemplate::getCombatSkeleton(bool testData) const +ServerTangibleObjectTemplate::CombatSkeleton ServerTangibleObjectTemplate::getCombatSkeleton() const { -#ifdef _DEBUG -ServerTangibleObjectTemplate::CombatSkeleton testDataValue = static_cast(0); -#else -UNREF(testData); -#endif + const ServerTangibleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getCombatSkeleton(true); -#endif } if (!m_combatSkeleton.isLoaded()) @@ -217,31 +209,18 @@ UNREF(testData); } CombatSkeleton value = static_cast(m_combatSkeleton.getValue()); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerTangibleObjectTemplate::getCombatSkeleton -int ServerTangibleObjectTemplate::getMaxHitPoints(bool testData) const +int ServerTangibleObjectTemplate::getMaxHitPoints() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerTangibleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMaxHitPoints(true); -#endif } if (!m_maxHitPoints.isLoaded()) @@ -281,31 +260,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerTangibleObjectTemplate::getMaxHitPoints -int ServerTangibleObjectTemplate::getMaxHitPointsMin(bool testData) const +int ServerTangibleObjectTemplate::getMaxHitPointsMin() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerTangibleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMaxHitPointsMin(true); -#endif } if (!m_maxHitPoints.isLoaded()) @@ -345,31 +311,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerTangibleObjectTemplate::getMaxHitPointsMin -int ServerTangibleObjectTemplate::getMaxHitPointsMax(bool testData) const +int ServerTangibleObjectTemplate::getMaxHitPointsMax() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerTangibleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMaxHitPointsMax(true); -#endif } if (!m_maxHitPoints.isLoaded()) @@ -409,11 +362,6 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerTangibleObjectTemplate::getMaxHitPointsMax @@ -451,22 +399,14 @@ const ServerArmorTemplate * ServerTangibleObjectTemplate::getArmor() const return returnValue; } // ServerTangibleObjectTemplate::getArmor -int ServerTangibleObjectTemplate::getInterestRadius(bool testData) const +int ServerTangibleObjectTemplate::getInterestRadius() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerTangibleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getInterestRadius(true); -#endif } if (!m_interestRadius.isLoaded()) @@ -506,31 +446,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerTangibleObjectTemplate::getInterestRadius -int ServerTangibleObjectTemplate::getInterestRadiusMin(bool testData) const +int ServerTangibleObjectTemplate::getInterestRadiusMin() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerTangibleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getInterestRadiusMin(true); -#endif } if (!m_interestRadius.isLoaded()) @@ -570,31 +497,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerTangibleObjectTemplate::getInterestRadiusMin -int ServerTangibleObjectTemplate::getInterestRadiusMax(bool testData) const +int ServerTangibleObjectTemplate::getInterestRadiusMax() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerTangibleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getInterestRadiusMax(true); -#endif } if (!m_interestRadius.isLoaded()) @@ -634,31 +548,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerTangibleObjectTemplate::getInterestRadiusMax -int ServerTangibleObjectTemplate::getCount(bool testData) const +int ServerTangibleObjectTemplate::getCount() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerTangibleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getCount(true); -#endif } if (!m_count.isLoaded()) @@ -698,31 +599,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerTangibleObjectTemplate::getCount -int ServerTangibleObjectTemplate::getCountMin(bool testData) const +int ServerTangibleObjectTemplate::getCountMin() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerTangibleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getCountMin(true); -#endif } if (!m_count.isLoaded()) @@ -762,31 +650,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerTangibleObjectTemplate::getCountMin -int ServerTangibleObjectTemplate::getCountMax(bool testData) const +int ServerTangibleObjectTemplate::getCountMax() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerTangibleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getCountMax(true); -#endif } if (!m_count.isLoaded()) @@ -826,31 +701,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerTangibleObjectTemplate::getCountMax -int ServerTangibleObjectTemplate::getCondition(bool testData) const +int ServerTangibleObjectTemplate::getCondition() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerTangibleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getCondition(true); -#endif } if (!m_condition.isLoaded()) @@ -890,31 +752,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerTangibleObjectTemplate::getCondition -int ServerTangibleObjectTemplate::getConditionMin(bool testData) const +int ServerTangibleObjectTemplate::getConditionMin() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerTangibleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getConditionMin(true); -#endif } if (!m_condition.isLoaded()) @@ -954,31 +803,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerTangibleObjectTemplate::getConditionMin -int ServerTangibleObjectTemplate::getConditionMax(bool testData) const +int ServerTangibleObjectTemplate::getConditionMax() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerTangibleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getConditionMax(true); -#endif } if (!m_condition.isLoaded()) @@ -1018,31 +854,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerTangibleObjectTemplate::getConditionMax -bool ServerTangibleObjectTemplate::getWantSawAttackTriggers(bool testData) const +bool ServerTangibleObjectTemplate::getWantSawAttackTriggers() const { -#ifdef _DEBUG -bool testDataValue = false; -#else -UNREF(testData); -#endif + const ServerTangibleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getWantSawAttackTriggers(true); -#endif } if (!m_wantSawAttackTriggers.isLoaded()) @@ -1060,34 +883,10 @@ UNREF(testData); } bool value = m_wantSawAttackTriggers.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerTangibleObjectTemplate::getWantSawAttackTriggers -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void ServerTangibleObjectTemplate::testValues(void) const -{ - IGNORE_RETURN(getCombatSkeleton(true)); - IGNORE_RETURN(getMaxHitPointsMin(true)); - IGNORE_RETURN(getMaxHitPointsMax(true)); - IGNORE_RETURN(getInterestRadiusMin(true)); - IGNORE_RETURN(getInterestRadiusMax(true)); - IGNORE_RETURN(getCountMin(true)); - IGNORE_RETURN(getCountMax(true)); - IGNORE_RETURN(getConditionMin(true)); - IGNORE_RETURN(getConditionMax(true)); - IGNORE_RETURN(getWantSawAttackTriggers(true)); - ServerObjectTemplate::testValues(); -} // ServerTangibleObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -1130,8 +929,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,4)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerTangibleObjectTemplate.h b/engine/server/library/serverGame/src/shared/objectTemplate/ServerTangibleObjectTemplate.h index 785cc5d5..8d4520de 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerTangibleObjectTemplate.h +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerTangibleObjectTemplate.h @@ -86,27 +86,22 @@ public: public: const TriggerVolumeData getTriggerVolumes(int index) const; size_t getTriggerVolumesCount(void) const; - CombatSkeleton getCombatSkeleton(bool testData = false) const; - int getMaxHitPoints(bool testData = false) const; - int getMaxHitPointsMin(bool testData = false) const; - int getMaxHitPointsMax(bool testData = false) const; + CombatSkeleton getCombatSkeleton() const; + int getMaxHitPoints() const; + int getMaxHitPointsMin() const; + int getMaxHitPointsMax() const; const ServerArmorTemplate * getArmor() const; - int getInterestRadius(bool testData = false) const; - int getInterestRadiusMin(bool testData = false) const; - int getInterestRadiusMax(bool testData = false) const; - int getCount(bool testData = false) const; - int getCountMin(bool testData = false) const; - int getCountMax(bool testData = false) const; - int getCondition(bool testData = false) const; - int getConditionMin(bool testData = false) const; - int getConditionMax(bool testData = false) const; - bool getWantSawAttackTriggers(bool testData = false) const; + int getInterestRadius() const; + int getInterestRadiusMin() const; + int getInterestRadiusMax() const; + int getCount() const; + int getCountMin() const; + int getCountMax() const; + int getCondition() const; + int getConditionMin() const; + int getConditionMax() const; + bool getWantSawAttackTriggers() const; -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerUniverseObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerUniverseObjectTemplate.cpp index 9bba2b4b..bf4eafdd 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerUniverseObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerUniverseObjectTemplate.cpp @@ -112,15 +112,6 @@ Object * ServerUniverseObjectTemplate::createObject(void) const } // ServerUniverseObjectTemplate::createObject //@BEGIN TFD -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void ServerUniverseObjectTemplate::testValues(void) const -{ - ServerObjectTemplate::testValues(); -} // ServerUniverseObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -163,8 +154,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,0)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerUniverseObjectTemplate.h b/engine/server/library/serverGame/src/shared/objectTemplate/ServerUniverseObjectTemplate.h index 1a49cd4f..773f6584 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerUniverseObjectTemplate.h +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerUniverseObjectTemplate.h @@ -45,11 +45,6 @@ public: //@BEGIN TFD public: -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerVehicleObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerVehicleObjectTemplate.cpp index 838e7107..fc9605f8 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerVehicleObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerVehicleObjectTemplate.cpp @@ -112,22 +112,14 @@ Object * ServerVehicleObjectTemplate::createObject(void) const } // ServerVehicleObjectTemplate::createObject //@BEGIN TFD -const std::string & ServerVehicleObjectTemplate::getFuelType(bool testData) const +const std::string & ServerVehicleObjectTemplate::getFuelType() const { -#ifdef _DEBUG -std::string testDataValue = DefaultString; -#else -UNREF(testData); -#endif + const ServerVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getFuelType(true); -#endif } if (!m_fuelType.isLoaded()) @@ -145,31 +137,18 @@ UNREF(testData); } const std::string & value = m_fuelType.getValue(); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerVehicleObjectTemplate::getFuelType -float ServerVehicleObjectTemplate::getCurrentFuel(bool testData) const +float ServerVehicleObjectTemplate::getCurrentFuel() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getCurrentFuel(true); -#endif } if (!m_currentFuel.isLoaded()) @@ -209,31 +188,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerVehicleObjectTemplate::getCurrentFuel -float ServerVehicleObjectTemplate::getCurrentFuelMin(bool testData) const +float ServerVehicleObjectTemplate::getCurrentFuelMin() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getCurrentFuelMin(true); -#endif } if (!m_currentFuel.isLoaded()) @@ -273,31 +239,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerVehicleObjectTemplate::getCurrentFuelMin -float ServerVehicleObjectTemplate::getCurrentFuelMax(bool testData) const +float ServerVehicleObjectTemplate::getCurrentFuelMax() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getCurrentFuelMax(true); -#endif } if (!m_currentFuel.isLoaded()) @@ -337,31 +290,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerVehicleObjectTemplate::getCurrentFuelMax -float ServerVehicleObjectTemplate::getMaxFuel(bool testData) const +float ServerVehicleObjectTemplate::getMaxFuel() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMaxFuel(true); -#endif } if (!m_maxFuel.isLoaded()) @@ -401,31 +341,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerVehicleObjectTemplate::getMaxFuel -float ServerVehicleObjectTemplate::getMaxFuelMin(bool testData) const +float ServerVehicleObjectTemplate::getMaxFuelMin() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMaxFuelMin(true); -#endif } if (!m_maxFuel.isLoaded()) @@ -465,31 +392,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerVehicleObjectTemplate::getMaxFuelMin -float ServerVehicleObjectTemplate::getMaxFuelMax(bool testData) const +float ServerVehicleObjectTemplate::getMaxFuelMax() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMaxFuelMax(true); -#endif } if (!m_maxFuel.isLoaded()) @@ -529,31 +443,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerVehicleObjectTemplate::getMaxFuelMax -float ServerVehicleObjectTemplate::getConsumpsion(bool testData) const +float ServerVehicleObjectTemplate::getConsumpsion() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getConsumpsion(true); -#endif } if (!m_consumpsion.isLoaded()) @@ -593,31 +494,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerVehicleObjectTemplate::getConsumpsion -float ServerVehicleObjectTemplate::getConsumpsionMin(bool testData) const +float ServerVehicleObjectTemplate::getConsumpsionMin() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getConsumpsionMin(true); -#endif } if (!m_consumpsion.isLoaded()) @@ -657,31 +545,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerVehicleObjectTemplate::getConsumpsionMin -float ServerVehicleObjectTemplate::getConsumpsionMax(bool testData) const +float ServerVehicleObjectTemplate::getConsumpsionMax() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getConsumpsionMax(true); -#endif } if (!m_consumpsion.isLoaded()) @@ -721,31 +596,10 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerVehicleObjectTemplate::getConsumpsionMax -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void ServerVehicleObjectTemplate::testValues(void) const -{ - IGNORE_RETURN(getFuelType(true)); - IGNORE_RETURN(getCurrentFuelMin(true)); - IGNORE_RETURN(getCurrentFuelMax(true)); - IGNORE_RETURN(getMaxFuelMin(true)); - IGNORE_RETURN(getMaxFuelMax(true)); - IGNORE_RETURN(getConsumpsionMin(true)); - IGNORE_RETURN(getConsumpsionMax(true)); - ServerTangibleObjectTemplate::testValues(); -} // ServerVehicleObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -788,8 +642,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,0)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerVehicleObjectTemplate.h b/engine/server/library/serverGame/src/shared/objectTemplate/ServerVehicleObjectTemplate.h index 8b66cfd5..1b0abf8a 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerVehicleObjectTemplate.h +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerVehicleObjectTemplate.h @@ -44,22 +44,17 @@ public: //@BEGIN TFD public: - const std::string & getFuelType(bool testData = false) const; - float getCurrentFuel(bool testData = false) const; - float getCurrentFuelMin(bool testData = false) const; - float getCurrentFuelMax(bool testData = false) const; - float getMaxFuel(bool testData = false) const; - float getMaxFuelMin(bool testData = false) const; - float getMaxFuelMax(bool testData = false) const; - float getConsumpsion(bool testData = false) const; - float getConsumpsionMin(bool testData = false) const; - float getConsumpsionMax(bool testData = false) const; + const std::string & getFuelType() const; + float getCurrentFuel() const; + float getCurrentFuelMin() const; + float getCurrentFuelMax() const; + float getMaxFuel() const; + float getMaxFuelMin() const; + float getMaxFuelMax() const; + float getConsumpsion() const; + float getConsumpsionMin() const; + float getConsumpsionMax() const; -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerWeaponObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerWeaponObjectTemplate.cpp index bf2ee2cb..973ac20e 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerWeaponObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerWeaponObjectTemplate.cpp @@ -112,22 +112,14 @@ Object * ServerWeaponObjectTemplate::createObject(void) const } // ServerWeaponObjectTemplate::createObject //@BEGIN TFD -ServerWeaponObjectTemplate::WeaponType ServerWeaponObjectTemplate::getWeaponType(bool testData) const +ServerWeaponObjectTemplate::WeaponType ServerWeaponObjectTemplate::getWeaponType() const { -#ifdef _DEBUG -ServerWeaponObjectTemplate::WeaponType testDataValue = static_cast(0); -#else -UNREF(testData); -#endif + const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getWeaponType(true); -#endif } if (!m_weaponType.isLoaded()) @@ -145,31 +137,18 @@ UNREF(testData); } WeaponType value = static_cast(m_weaponType.getValue()); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerWeaponObjectTemplate::getWeaponType -ServerWeaponObjectTemplate::AttackType ServerWeaponObjectTemplate::getAttackType(bool testData) const +ServerWeaponObjectTemplate::AttackType ServerWeaponObjectTemplate::getAttackType() const { -#ifdef _DEBUG -ServerWeaponObjectTemplate::AttackType testDataValue = static_cast(0); -#else -UNREF(testData); -#endif + const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getAttackType(true); -#endif } if (!m_attackType.isLoaded()) @@ -187,31 +166,18 @@ UNREF(testData); } AttackType value = static_cast(m_attackType.getValue()); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerWeaponObjectTemplate::getAttackType -ServerWeaponObjectTemplate::DamageType ServerWeaponObjectTemplate::getDamageType(bool testData) const +ServerWeaponObjectTemplate::DamageType ServerWeaponObjectTemplate::getDamageType() const { -#ifdef _DEBUG -ServerWeaponObjectTemplate::DamageType testDataValue = static_cast(0); -#else -UNREF(testData); -#endif + const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getDamageType(true); -#endif } if (!m_damageType.isLoaded()) @@ -229,31 +195,18 @@ UNREF(testData); } DamageType value = static_cast(m_damageType.getValue()); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerWeaponObjectTemplate::getDamageType -ServerWeaponObjectTemplate::DamageType ServerWeaponObjectTemplate::getElementalType(bool testData) const +ServerWeaponObjectTemplate::DamageType ServerWeaponObjectTemplate::getElementalType() const { -#ifdef _DEBUG -ServerWeaponObjectTemplate::DamageType testDataValue = static_cast(0); -#else -UNREF(testData); -#endif + const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getElementalType(true); -#endif } if (!m_elementalType.isLoaded()) @@ -271,31 +224,18 @@ UNREF(testData); } DamageType value = static_cast(m_elementalType.getValue()); -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerWeaponObjectTemplate::getElementalType -int ServerWeaponObjectTemplate::getElementalValue(bool testData) const +int ServerWeaponObjectTemplate::getElementalValue() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getElementalValue(true); -#endif } if (!m_elementalValue.isLoaded()) @@ -335,31 +275,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerWeaponObjectTemplate::getElementalValue -int ServerWeaponObjectTemplate::getElementalValueMin(bool testData) const +int ServerWeaponObjectTemplate::getElementalValueMin() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getElementalValueMin(true); -#endif } if (!m_elementalValue.isLoaded()) @@ -399,31 +326,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerWeaponObjectTemplate::getElementalValueMin -int ServerWeaponObjectTemplate::getElementalValueMax(bool testData) const +int ServerWeaponObjectTemplate::getElementalValueMax() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getElementalValueMax(true); -#endif } if (!m_elementalValue.isLoaded()) @@ -463,31 +377,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerWeaponObjectTemplate::getElementalValueMax -int ServerWeaponObjectTemplate::getMinDamageAmount(bool testData) const +int ServerWeaponObjectTemplate::getMinDamageAmount() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMinDamageAmount(true); -#endif } if (!m_minDamageAmount.isLoaded()) @@ -527,31 +428,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerWeaponObjectTemplate::getMinDamageAmount -int ServerWeaponObjectTemplate::getMinDamageAmountMin(bool testData) const +int ServerWeaponObjectTemplate::getMinDamageAmountMin() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMinDamageAmountMin(true); -#endif } if (!m_minDamageAmount.isLoaded()) @@ -591,31 +479,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerWeaponObjectTemplate::getMinDamageAmountMin -int ServerWeaponObjectTemplate::getMinDamageAmountMax(bool testData) const +int ServerWeaponObjectTemplate::getMinDamageAmountMax() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMinDamageAmountMax(true); -#endif } if (!m_minDamageAmount.isLoaded()) @@ -655,31 +530,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerWeaponObjectTemplate::getMinDamageAmountMax -int ServerWeaponObjectTemplate::getMaxDamageAmount(bool testData) const +int ServerWeaponObjectTemplate::getMaxDamageAmount() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMaxDamageAmount(true); -#endif } if (!m_maxDamageAmount.isLoaded()) @@ -719,31 +581,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerWeaponObjectTemplate::getMaxDamageAmount -int ServerWeaponObjectTemplate::getMaxDamageAmountMin(bool testData) const +int ServerWeaponObjectTemplate::getMaxDamageAmountMin() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMaxDamageAmountMin(true); -#endif } if (!m_maxDamageAmount.isLoaded()) @@ -783,31 +632,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerWeaponObjectTemplate::getMaxDamageAmountMin -int ServerWeaponObjectTemplate::getMaxDamageAmountMax(bool testData) const +int ServerWeaponObjectTemplate::getMaxDamageAmountMax() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMaxDamageAmountMax(true); -#endif } if (!m_maxDamageAmount.isLoaded()) @@ -847,31 +683,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerWeaponObjectTemplate::getMaxDamageAmountMax -float ServerWeaponObjectTemplate::getAttackSpeed(bool testData) const +float ServerWeaponObjectTemplate::getAttackSpeed() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getAttackSpeed(true); -#endif } if (!m_attackSpeed.isLoaded()) @@ -911,31 +734,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerWeaponObjectTemplate::getAttackSpeed -float ServerWeaponObjectTemplate::getAttackSpeedMin(bool testData) const +float ServerWeaponObjectTemplate::getAttackSpeedMin() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getAttackSpeedMin(true); -#endif } if (!m_attackSpeed.isLoaded()) @@ -975,31 +785,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerWeaponObjectTemplate::getAttackSpeedMin -float ServerWeaponObjectTemplate::getAttackSpeedMax(bool testData) const +float ServerWeaponObjectTemplate::getAttackSpeedMax() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getAttackSpeedMax(true); -#endif } if (!m_attackSpeed.isLoaded()) @@ -1039,31 +836,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerWeaponObjectTemplate::getAttackSpeedMax -float ServerWeaponObjectTemplate::getAudibleRange(bool testData) const +float ServerWeaponObjectTemplate::getAudibleRange() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getAudibleRange(true); -#endif } if (!m_audibleRange.isLoaded()) @@ -1103,31 +887,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerWeaponObjectTemplate::getAudibleRange -float ServerWeaponObjectTemplate::getAudibleRangeMin(bool testData) const +float ServerWeaponObjectTemplate::getAudibleRangeMin() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getAudibleRangeMin(true); -#endif } if (!m_audibleRange.isLoaded()) @@ -1167,31 +938,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerWeaponObjectTemplate::getAudibleRangeMin -float ServerWeaponObjectTemplate::getAudibleRangeMax(bool testData) const +float ServerWeaponObjectTemplate::getAudibleRangeMax() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getAudibleRangeMax(true); -#endif } if (!m_audibleRange.isLoaded()) @@ -1231,31 +989,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerWeaponObjectTemplate::getAudibleRangeMax -float ServerWeaponObjectTemplate::getMinRange(bool testData) const +float ServerWeaponObjectTemplate::getMinRange() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMinRange(true); -#endif } if (!m_minRange.isLoaded()) @@ -1295,31 +1040,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerWeaponObjectTemplate::getMinRange -float ServerWeaponObjectTemplate::getMinRangeMin(bool testData) const +float ServerWeaponObjectTemplate::getMinRangeMin() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMinRangeMin(true); -#endif } if (!m_minRange.isLoaded()) @@ -1359,31 +1091,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerWeaponObjectTemplate::getMinRangeMin -float ServerWeaponObjectTemplate::getMinRangeMax(bool testData) const +float ServerWeaponObjectTemplate::getMinRangeMax() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMinRangeMax(true); -#endif } if (!m_minRange.isLoaded()) @@ -1423,31 +1142,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerWeaponObjectTemplate::getMinRangeMax -float ServerWeaponObjectTemplate::getMaxRange(bool testData) const +float ServerWeaponObjectTemplate::getMaxRange() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMaxRange(true); -#endif } if (!m_maxRange.isLoaded()) @@ -1487,31 +1193,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerWeaponObjectTemplate::getMaxRange -float ServerWeaponObjectTemplate::getMaxRangeMin(bool testData) const +float ServerWeaponObjectTemplate::getMaxRangeMin() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMaxRangeMin(true); -#endif } if (!m_maxRange.isLoaded()) @@ -1551,31 +1244,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerWeaponObjectTemplate::getMaxRangeMin -float ServerWeaponObjectTemplate::getMaxRangeMax(bool testData) const +float ServerWeaponObjectTemplate::getMaxRangeMax() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getMaxRangeMax(true); -#endif } if (!m_maxRange.isLoaded()) @@ -1615,31 +1295,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerWeaponObjectTemplate::getMaxRangeMax -float ServerWeaponObjectTemplate::getDamageRadius(bool testData) const +float ServerWeaponObjectTemplate::getDamageRadius() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getDamageRadius(true); -#endif } if (!m_damageRadius.isLoaded()) @@ -1679,31 +1346,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerWeaponObjectTemplate::getDamageRadius -float ServerWeaponObjectTemplate::getDamageRadiusMin(bool testData) const +float ServerWeaponObjectTemplate::getDamageRadiusMin() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getDamageRadiusMin(true); -#endif } if (!m_damageRadius.isLoaded()) @@ -1743,31 +1397,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerWeaponObjectTemplate::getDamageRadiusMin -float ServerWeaponObjectTemplate::getDamageRadiusMax(bool testData) const +float ServerWeaponObjectTemplate::getDamageRadiusMax() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getDamageRadiusMax(true); -#endif } if (!m_damageRadius.isLoaded()) @@ -1807,31 +1448,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerWeaponObjectTemplate::getDamageRadiusMax -float ServerWeaponObjectTemplate::getWoundChance(bool testData) const +float ServerWeaponObjectTemplate::getWoundChance() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getWoundChance(true); -#endif } if (!m_woundChance.isLoaded()) @@ -1871,31 +1499,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerWeaponObjectTemplate::getWoundChance -float ServerWeaponObjectTemplate::getWoundChanceMin(bool testData) const +float ServerWeaponObjectTemplate::getWoundChanceMin() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getWoundChanceMin(true); -#endif } if (!m_woundChance.isLoaded()) @@ -1935,31 +1550,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerWeaponObjectTemplate::getWoundChanceMin -float ServerWeaponObjectTemplate::getWoundChanceMax(bool testData) const +float ServerWeaponObjectTemplate::getWoundChanceMax() const { -#ifdef _DEBUG -float testDataValue = 0.0f; -#else -UNREF(testData); -#endif + const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getWoundChanceMax(true); -#endif } if (!m_woundChance.isLoaded()) @@ -1999,31 +1601,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerWeaponObjectTemplate::getWoundChanceMax -int ServerWeaponObjectTemplate::getAttackCost(bool testData) const +int ServerWeaponObjectTemplate::getAttackCost() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getAttackCost(true); -#endif } if (!m_attackCost.isLoaded()) @@ -2063,31 +1652,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerWeaponObjectTemplate::getAttackCost -int ServerWeaponObjectTemplate::getAttackCostMin(bool testData) const +int ServerWeaponObjectTemplate::getAttackCostMin() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getAttackCostMin(true); -#endif } if (!m_attackCost.isLoaded()) @@ -2127,31 +1703,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerWeaponObjectTemplate::getAttackCostMin -int ServerWeaponObjectTemplate::getAttackCostMax(bool testData) const +int ServerWeaponObjectTemplate::getAttackCostMax() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getAttackCostMax(true); -#endif } if (!m_attackCost.isLoaded()) @@ -2191,31 +1754,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerWeaponObjectTemplate::getAttackCostMax -int ServerWeaponObjectTemplate::getAccuracy(bool testData) const +int ServerWeaponObjectTemplate::getAccuracy() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getAccuracy(true); -#endif } if (!m_accuracy.isLoaded()) @@ -2255,31 +1805,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerWeaponObjectTemplate::getAccuracy -int ServerWeaponObjectTemplate::getAccuracyMin(bool testData) const +int ServerWeaponObjectTemplate::getAccuracyMin() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getAccuracyMin(true); -#endif } if (!m_accuracy.isLoaded()) @@ -2319,31 +1856,18 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerWeaponObjectTemplate::getAccuracyMin -int ServerWeaponObjectTemplate::getAccuracyMax(bool testData) const +int ServerWeaponObjectTemplate::getAccuracyMax() const { -#ifdef _DEBUG -int testDataValue = 0; -#else -UNREF(testData); -#endif + const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { base = dynamic_cast(m_baseData); -#ifdef _DEBUG - if (testData && base != nullptr) - testDataValue = base->getAccuracyMax(true); -#endif } if (!m_accuracy.isLoaded()) @@ -2383,50 +1907,10 @@ UNREF(testData); else if (delta == '_') value = baseValue - static_cast(baseValue * (value / 100.0f)); } -#ifdef _DEBUG - if (testData && base != nullptr) - { - } -#endif return value; } // ServerWeaponObjectTemplate::getAccuracyMax -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void ServerWeaponObjectTemplate::testValues(void) const -{ - IGNORE_RETURN(getWeaponType(true)); - IGNORE_RETURN(getAttackType(true)); - IGNORE_RETURN(getDamageType(true)); - IGNORE_RETURN(getElementalType(true)); - IGNORE_RETURN(getElementalValueMin(true)); - IGNORE_RETURN(getElementalValueMax(true)); - IGNORE_RETURN(getMinDamageAmountMin(true)); - IGNORE_RETURN(getMinDamageAmountMax(true)); - IGNORE_RETURN(getMaxDamageAmountMin(true)); - IGNORE_RETURN(getMaxDamageAmountMax(true)); - IGNORE_RETURN(getAttackSpeedMin(true)); - IGNORE_RETURN(getAttackSpeedMax(true)); - IGNORE_RETURN(getAudibleRangeMin(true)); - IGNORE_RETURN(getAudibleRangeMax(true)); - IGNORE_RETURN(getMinRangeMin(true)); - IGNORE_RETURN(getMinRangeMax(true)); - IGNORE_RETURN(getMaxRangeMin(true)); - IGNORE_RETURN(getMaxRangeMax(true)); - IGNORE_RETURN(getDamageRadiusMin(true)); - IGNORE_RETURN(getDamageRadiusMax(true)); - IGNORE_RETURN(getWoundChanceMin(true)); - IGNORE_RETURN(getWoundChanceMax(true)); - IGNORE_RETURN(getAttackCostMin(true)); - IGNORE_RETURN(getAttackCostMax(true)); - IGNORE_RETURN(getAccuracyMin(true)); - IGNORE_RETURN(getAccuracyMax(true)); - ServerTangibleObjectTemplate::testValues(); -} // ServerWeaponObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -2469,8 +1953,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,1,1)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerWeaponObjectTemplate.h b/engine/server/library/serverGame/src/shared/objectTemplate/ServerWeaponObjectTemplate.h index 1a3107e8..1f4c57d6 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerWeaponObjectTemplate.h +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerWeaponObjectTemplate.h @@ -78,49 +78,44 @@ public: }; public: - WeaponType getWeaponType(bool testData = false) const; - AttackType getAttackType(bool testData = false) const; - DamageType getDamageType(bool testData = false) const; - DamageType getElementalType(bool testData = false) const; - int getElementalValue(bool testData = false) const; - int getElementalValueMin(bool testData = false) const; - int getElementalValueMax(bool testData = false) const; - int getMinDamageAmount(bool testData = false) const; - int getMinDamageAmountMin(bool testData = false) const; - int getMinDamageAmountMax(bool testData = false) const; - int getMaxDamageAmount(bool testData = false) const; - int getMaxDamageAmountMin(bool testData = false) const; - int getMaxDamageAmountMax(bool testData = false) const; - float getAttackSpeed(bool testData = false) const; - float getAttackSpeedMin(bool testData = false) const; - float getAttackSpeedMax(bool testData = false) const; - float getAudibleRange(bool testData = false) const; - float getAudibleRangeMin(bool testData = false) const; - float getAudibleRangeMax(bool testData = false) const; - float getMinRange(bool testData = false) const; - float getMinRangeMin(bool testData = false) const; - float getMinRangeMax(bool testData = false) const; - float getMaxRange(bool testData = false) const; - float getMaxRangeMin(bool testData = false) const; - float getMaxRangeMax(bool testData = false) const; - float getDamageRadius(bool testData = false) const; - float getDamageRadiusMin(bool testData = false) const; - float getDamageRadiusMax(bool testData = false) const; - float getWoundChance(bool testData = false) const; - float getWoundChanceMin(bool testData = false) const; - float getWoundChanceMax(bool testData = false) const; - int getAttackCost(bool testData = false) const; - int getAttackCostMin(bool testData = false) const; - int getAttackCostMax(bool testData = false) const; - int getAccuracy(bool testData = false) const; - int getAccuracyMin(bool testData = false) const; - int getAccuracyMax(bool testData = false) const; + WeaponType getWeaponType() const; + AttackType getAttackType() const; + DamageType getDamageType() const; + DamageType getElementalType() const; + int getElementalValue() const; + int getElementalValueMin() const; + int getElementalValueMax() const; + int getMinDamageAmount() const; + int getMinDamageAmountMin() const; + int getMinDamageAmountMax() const; + int getMaxDamageAmount() const; + int getMaxDamageAmountMin() const; + int getMaxDamageAmountMax() const; + float getAttackSpeed() const; + float getAttackSpeedMin() const; + float getAttackSpeedMax() const; + float getAudibleRange() const; + float getAudibleRangeMin() const; + float getAudibleRangeMax() const; + float getMinRange() const; + float getMinRangeMin() const; + float getMinRangeMax() const; + float getMaxRange() const; + float getMaxRangeMin() const; + float getMaxRangeMax() const; + float getDamageRadius() const; + float getDamageRadiusMin() const; + float getDamageRadiusMax() const; + float getWoundChance() const; + float getWoundChanceMin() const; + float getWoundChanceMax() const; + int getAttackCost() const; + int getAttackCostMin() const; + int getAttackCostMax() const; + int getAccuracy() const; + int getAccuracyMin() const; + int getAccuracyMax() const; -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerXpManagerObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerXpManagerObjectTemplate.cpp index 0fc6ff30..0ea899e7 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerXpManagerObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerXpManagerObjectTemplate.cpp @@ -12,7 +12,7 @@ #include "serverGame/FirstServerGame.h" #include "ServerXpManagerObjectTemplate.h" -#include "sharedDebug/DataLint.h" + #include "sharedFile/Iff.h" #include "sharedObject/ObjectTemplate.h" #include "sharedObject/ObjectTemplateList.h" @@ -115,15 +115,6 @@ Object * ServerXpManagerObjectTemplate::createObject(void) const } // ServerXpManagerObjectTemplate::createObject //@BEGIN TFD -#ifdef _DEBUG -/** - * Special function used by datalint. Checks for duplicate values in base and derived templates. - */ -void ServerXpManagerObjectTemplate::testValues(void) const -{ - ServerUniverseObjectTemplate::testValues(); -} // ServerXpManagerObjectTemplate::testValues -#endif /** * Loads the template data from an iff file. We should already be in the form @@ -166,8 +157,8 @@ char paramName[MAX_NAME_SIZE]; } if (getHighestTemplateVersion() != TAG(0,0,0,0)) { - if (DataLint::isEnabled()) - DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); + + m_versionOk = false; } diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerXpManagerObjectTemplate.h b/engine/server/library/serverGame/src/shared/objectTemplate/ServerXpManagerObjectTemplate.h index 0e17966c..4147ea9f 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerXpManagerObjectTemplate.h +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerXpManagerObjectTemplate.h @@ -45,11 +45,6 @@ public: //@BEGIN TFD public: -#ifdef _DEBUG -public: - // special code used by datalint - virtual void testValues(void) const; -#endif protected: virtual void load(Iff &file); From fe522029248fe8ca40b3249a957e541e37fd46b7 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Thu, 24 Mar 2016 19:33:37 +0000 Subject: [PATCH 054/302] make this error message actually useful --- .../serverGame/src/shared/core/ServerBuildoutManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/server/library/serverGame/src/shared/core/ServerBuildoutManager.cpp b/engine/server/library/serverGame/src/shared/core/ServerBuildoutManager.cpp index e38943e1..d83f034d 100755 --- a/engine/server/library/serverGame/src/shared/core/ServerBuildoutManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/ServerBuildoutManager.cpp @@ -670,7 +670,7 @@ void ServerBuildoutManagerNamespace::loadArea(AreaInfo &areaInfo) unsigned int const cellIndex = areaBuildoutTable.getIntValue(cellIndexColumn, buildoutRow); ObjectTemplate const * const serverTemplateBase = ObjectTemplateList::fetch(serverTemplateCrc); - FATAL(!serverTemplateBase, ("Nonexistant server template 0x%08x in buildout table %s, row %d (line %d)", serverTemplateCrc, areaInfo.buildoutArea.areaName.c_str(), buildoutRow, buildoutRow + 3)); + FATAL(!serverTemplateBase, ("Nonexistant server template 0x%08x in buildout table %s, row %d (line %d) - rebuild your templates and reimport them into the database!", serverTemplateCrc, areaInfo.buildoutArea.areaName.c_str(), buildoutRow, buildoutRow + 3)); ServerObjectTemplate const * const serverTemplate = serverTemplateBase->asServerObjectTemplate(); FATAL(!serverTemplate, ("Bad server template 0x%08x [%s] in buildout table %s, row %d (line %d)", serverTemplateCrc, serverTemplateBase->getName(), areaInfo.buildoutArea.areaName.c_str(), buildoutRow, buildoutRow + 3)); From f27562881776f7522be5479e18c1fb18f01f5121 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Thu, 24 Mar 2016 19:41:33 +0000 Subject: [PATCH 055/302] more unused vars --- .../application/ChatServer/src/shared/ChatInterface.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/engine/server/application/ChatServer/src/shared/ChatInterface.cpp b/engine/server/application/ChatServer/src/shared/ChatInterface.cpp index 75aeae1b..c52044b8 100755 --- a/engine/server/application/ChatServer/src/shared/ChatInterface.cpp +++ b/engine/server/application/ChatServer/src/shared/ChatInterface.cpp @@ -2345,12 +2345,10 @@ void ChatInterface::OnAddInvite(unsigned track, unsigned result, const ChatAvata AvatarIdSequencePair *pair = (AvatarIdSequencePair *)user; - unsigned sequence = 0; ChatAvatarId destId; if (pair) { destId = pair->avatar; - sequence = pair->sequence; delete pair; pair = nullptr; @@ -2645,12 +2643,10 @@ void ChatInterface::OnKickAvatar(unsigned track, unsigned result, const ChatAvat AvatarIdSequencePair *pair = (AvatarIdSequencePair *)user; - unsigned sequence = 0; ChatAvatarId kickedId; if (pair) { kickedId = pair->avatar; - sequence = pair->sequence; delete pair; pair = nullptr; From 3b430656ba343ce20d28dd95eb0a0d3d9e2c9834 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Thu, 24 Mar 2016 21:07:31 +0000 Subject: [PATCH 056/302] remove SOE deprecated code and files - leaving in the #if 0 blocks with TODO and other possible uses for later --- .../application/Miff/src/linux/bison.simple | 7 - .../application/Miff/src/linux/miff.cpp | 195 -------- .../src/shared/TaskConnection.cpp | 4 - .../src/linux/TaskManagerSysInfo.cpp | 24 - .../src/shared/MetricsServerConnection.cpp | 4 - .../TaskManager/src/shared/TaskManager.cpp | 9 - .../src/shared/DatabaseProcess.cpp | 17 - .../commoditiesMarket/CommoditiesMarket.cpp | 67 --- .../src/shared/core/PreloadManager.cpp | 7 - .../src/shared/core/ServerBuildoutManager.cpp | 16 - .../src/shared/core/ServerWorld.cpp | 12 - .../src/shared/object/CreatureObject.cpp | 6 - .../shared/object/GroupWaypointBuilder.cpp | 24 - .../src/shared/object/ServerObject.cpp | 7 - .../shared/space/ShipClientUpdateTracker.cpp | 15 - .../src/shared/trading/ServerSecureTrade.cpp | 57 --- .../serverKeyShare/src/shared/KeyServer.cpp | 18 +- .../serverScript/src/shared/JavaLibrary.cpp | 14 - .../src/shared/ScriptMethodsChat.cpp | 23 - .../src/shared/ZlibCompressor.cpp | 8 - .../sharedDebug/src/linux/DebugMonitor.cpp | 4 - .../library/sharedFile/src/shared/Iff.h | 4 - .../src/linux/FloatingPointUnit.cpp | 12 - .../library/sharedFoundation/src/linux/Os.cpp | 18 - .../src/linux/PlatformGlue.cpp | 7 - .../src/linux/SetupSharedFoundation.cpp | 6 - .../sharedFoundation/src/shared/Clock.cpp | 18 - .../sharedFoundation/src/shared/Crc.cpp | 19 - .../appearance/WearableAppearanceMap.cpp | 10 - .../sharedGame/src/shared/quest/Quest.cpp | 9 - .../src/shared/ImageManipulation.cpp | 7 - .../src/shared/ImageManipulation.h | 15 +- .../sharedMath/src/shared/PaletteArgb.cpp | 2 +- .../CustomizationData_Directory.h | 5 - .../CustomizationData_LocalDirectory.cpp | 227 --------- .../CustomizationData_LocalDirectory.h | 10 - .../CustomizationData_RemoteDirectory.cpp | 27 -- .../CustomizationData_RemoteDirectory.h | 5 - .../RangedIntCustomizationVariable.cpp | 53 --- .../RangedIntCustomizationVariable.h | 4 - .../sharedObject/src/shared/object/Object.cpp | 4 - .../src/shared/portal/CellProperty.cpp | 8 - .../src/shared/portal/PortalProperty.cpp | 2 +- .../SamplerProceduralTerrainAppearance.cpp | 124 ----- .../src/shared/generator/CoordinateHash.cpp | 21 - .../library/sharedThread/src/linux/Thread.cpp | 15 - .../sharedThread/src/shared/RunThread.cpp | 23 - .../sharedUtility/src/shared/FileName.cpp | 9 - .../projects/VChat/VChatAPI/CMakeLists.txt | 4 - .../VChatAPI/utils2.0/utils/Base/types.h | 19 +- .../utils2.0/utils/TcpLibrary/TcpListener.cpp | 435 ------------------ .../utils2.0/utils/TcpLibrary/TcpListener.h | 160 ------- .../utils2.0/utils/UdpLibrary/UdpListener.cpp | 394 ---------------- .../utils2.0/utils/UdpLibrary/UdpListener.h | 145 ------ external/3rd/library/udplibrary/udpclient.cpp | 61 +-- external/3rd/library/udplibrary/udpserver.cpp | 13 - .../SwgDatabaseServer/src/CMakeLists.txt | 1 - .../src/shared/buffers/IndexedTableBuffer.h | 54 --- 58 files changed, 7 insertions(+), 2481 deletions(-) delete mode 100755 external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpListener.cpp delete mode 100755 external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpListener.h delete mode 100755 external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpListener.cpp delete mode 100755 external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpListener.h delete mode 100755 game/server/application/SwgDatabaseServer/src/shared/buffers/IndexedTableBuffer.h diff --git a/engine/client/application/Miff/src/linux/bison.simple b/engine/client/application/Miff/src/linux/bison.simple index 5f8f386e..27927e11 100644 --- a/engine/client/application/Miff/src/linux/bison.simple +++ b/engine/client/application/Miff/src/linux/bison.simple @@ -632,13 +632,6 @@ yyerrlab1: /* here on error raised explicitly by an action */ yyerrdefault: /* current state does not do anything special for the error token. */ -#if 0 - /* This is wrong; only states that explicitly want error tokens - should shift them. */ - yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ - if (yyn) goto yydefault; -#endif - yyerrpop: /* pop the current state because it cannot handle the error token */ if (yyssp == yyss) YYABORT; diff --git a/engine/client/application/Miff/src/linux/miff.cpp b/engine/client/application/Miff/src/linux/miff.cpp index 32f52b5b..8f62be65 100755 --- a/engine/client/application/Miff/src/linux/miff.cpp +++ b/engine/client/application/Miff/src/linux/miff.cpp @@ -380,201 +380,6 @@ static errorType evaluateArgs(void) return retVal; return retVal; - -#if 0 - - errorType retVal = ERR_NONE; // assume no error has been found - bool outPathUsed = false; // flag to monitor if -o flag was used, if so, we can ignore -d, -p, -e, -f - bool inFileEntered = false; - int argc = CommandLine::getPlainCount(); - - // get default values from DOS - char currentDir[maxStringSize]; - if (nullptr == getcwd(currentDir, maxStringSize)) // get current working directory - { - retVal = ERR_UNKNOWNDIR; - return(retVal); - } - drive[0] = currentDir[0]; // drive letter - drive[1] = 0; // and nullptr terminate it - strcpy(extension, "IFF"); // default to uppercase .IFF - strcpy(directory, ¤tDir[2]); // get everything after the Drive: including the first backslash - filename[0] = 0; - - // see specs.txt for requests - // scan for any argv's that has '-' in the argv[n][0]'s character - for (int index = 0; index < argc; index++) // note: if using argv[] rather then CommandLine::getPlainString() then start with 1 rather then 0 - { - if ('-' == CommandLine::getPlainString(index)[0]) - { - // we've found a parameter switch - switch (tolower(CommandLine::getPlainString(index)[1])) // assume non case sensitive switches - { - case 'i': // install via #pragma - { - usePragma = true; - break; - } - - case 'c': // use CCCP instead of CPP - useCCCP = true; - break; - - case 'v': // don't show any debug message - verboseMode = true; - break; - - case '$': - debugMode = true; - break; - - case 'o': // target output file name and path (complete path) - { - index++; // next param - outPathUsed = true; - strcpy(outFileName, CommandLine::getPlainString(index)); - break; - - } - - case 'd': // target drive letter (-p must be present) - { - if (!outPathUsed) - { - index++; // next param - strcpy(drive, CommandLine::getPlainString(index)); - } - else - index++; // skip the drive letter arg that SHOULD follow the -d option - break; - } - - case 'p': // target pathname - { - if (!outPathUsed) - { - index++; // next param - strcpy(directory, CommandLine::getPlainString(index)); - } - else - index++; // skip the pathname arg that follows the -p option - break; - } - - case 'f': // target filename - { - if (!outPathUsed) - { - index++; // next param - strcpy(filename, CommandLine::getPlainString(index)); - } - else - index++; // skip the filename arg that follows the -f - break; - } - - case 'e': // target extension - { - if (!outPathUsed) - { - index++; // next param - strcpy(extension, CommandLine::getPlainString(index)); - } - else - index++; // skip the extension arg that follows the -e - break; - } - - case 'h': // help! - case '?': - { - help(); - index = argc; // force to exit - retVal = ERR_HELPREQUEST; - return(retVal); // special case, ONLY time I call return() in the middle of the function (because I check for argc < 2 at the end of the code) - break; - } - - default: - { - sprintf(err_msg, "\nUnknown parameter %s, use -h to seek help...\n", CommandLine::getPlainString(index)); - MIFFMessage(err_msg, 1); - index = argc; // force to exit - break; - } - } - } - else - { - // we found an arg that doesn't start with '-' so let's assume it's a filename - if (!inFileEntered) - { - strcpy(inFileName, CommandLine::getPlainString(index)); - inFileEntered = true; - } - else - { - retVal = ERR_MULTIPLEINFILE; - index = argc; - } - - // now construct the DEFAULT filename for this file by scanning backwards to front and only extracting the filename (no extension, no path) - if (ERR_NONE == retVal) - { - char sourceName[maxStringSize]; - strcpy(sourceName, inFileName); // make a duplicate for us to play with - for (int strIndex = strlen(sourceName); strIndex > 0; strIndex--) - { - if ('.' == sourceName[strIndex]) - sourceName[strIndex] = 0; // put a stopper here... we are assuming that '.' indicates extension! I'm going to assume that the person is just testing me if s/he decides to use filename like "foo.bar.psych" which will truncate to "foo" - if ('\\' == sourceName[strIndex]) - break; // get out, for we've reached the path name... - } - - // ok, by here, strIndex should point to either beginning of the string, or where the first '\' was found scanning backwards - strcpy(filename, &sourceName[strIndex]); // ta-da-! - } - } - } - - if (inFileEntered) - { - if (0 == preprocessSource(inFileName)) - { - if (verboseMode) - { - // using err_msg as my temp buffer... - sprintf(err_msg,"Now compiling %s\n", inFileName); - MIFFMessage(err_msg, 0); - } - - if (ERR_NONE == retVal) - retVal = loadInputToBuffer(sourceBuffer, bufferSize); - } - else // preprocessSource returned an error... - { - retVal = ERR_PREPROCESS; - } - } - else // inFileEntered == false - { - MIFFMessage("Missing input filename in command line!", 1); - } - - // construct a outFileName[] based on drive[], directory[], filename[], and extension[] - if (!outPathUsed && (ERR_NONE == retVal)) - { - if (inFileName[0]) // make sure the user has entered a input filename - sprintf(outFileName,"%s:%s\\%s.%s", drive, directory, filename, extension); - } - - if (argc < 1) - retVal = ERR_ARGSTOOFEW; // we can do this because we know -h was not entered... - - return(retVal); - -#endif - } diff --git a/engine/server/application/MetricsServer/src/shared/TaskConnection.cpp b/engine/server/application/MetricsServer/src/shared/TaskConnection.cpp index c3a6d841..3ec3e534 100755 --- a/engine/server/application/MetricsServer/src/shared/TaskConnection.cpp +++ b/engine/server/application/MetricsServer/src/shared/TaskConnection.cpp @@ -72,10 +72,6 @@ void TaskConnection::onConnectionOpened() void TaskConnection::onReceive(const Archive::ByteStream & message) { UNREF(message); -#if 0 - Archive::ReadIterator r(message); - GameNetworkMessage m(r); -#endif } //----------------------------------------------------------------------- diff --git a/engine/server/application/TaskManager/src/linux/TaskManagerSysInfo.cpp b/engine/server/application/TaskManager/src/linux/TaskManagerSysInfo.cpp index 31bc94bf..798245b3 100755 --- a/engine/server/application/TaskManager/src/linux/TaskManagerSysInfo.cpp +++ b/engine/server/application/TaskManager/src/linux/TaskManagerSysInfo.cpp @@ -46,32 +46,8 @@ TaskManagerSysInfo & TaskManagerSysInfo::operator = (const TaskManagerSysInfo & const float TaskManagerSysInfo::getScore() const { -#if 0 - //Temporariy remove this since it's not giving us good results - FILE * avg = popen("uptime", "r"); - float a = 0.0f; - if(avg) - { - std::string output; - while(!feof(avg)) - { - char buf[1024] = {"\0"}; - - fread(buf, sizeof(buf), 1, avg); - output += buf; - } - char formatted[1024] = {"\0"}; - std::string load = output.substr(output.find("load average:")); - sscanf(load.c_str(), "load average: %f", &a); - pclose(avg); - } - return a; -#else - float ret = static_cast(TaskManager::getNumGameConnections()); return ret; - -#endif } //----------------------------------------------------------------------- diff --git a/engine/server/application/TaskManager/src/shared/MetricsServerConnection.cpp b/engine/server/application/TaskManager/src/shared/MetricsServerConnection.cpp index eeef0926..f5287c2a 100755 --- a/engine/server/application/TaskManager/src/shared/MetricsServerConnection.cpp +++ b/engine/server/application/TaskManager/src/shared/MetricsServerConnection.cpp @@ -77,10 +77,6 @@ void MetricsServerConnection::onProcessKilled(const ProcessKilled & k) void MetricsServerConnection::receive(const Archive::ByteStream & ) { -#if 0 - Archive::ReadIterator r(message); - GameNetworkMessage m(r); -#endif } //----------------------------------------------------------------------- diff --git a/engine/server/application/TaskManager/src/shared/TaskManager.cpp b/engine/server/application/TaskManager/src/shared/TaskManager.cpp index 04550a81..24243de7 100755 --- a/engine/server/application/TaskManager/src/shared/TaskManager.cpp +++ b/engine/server/application/TaskManager/src/shared/TaskManager.cpp @@ -831,15 +831,6 @@ void TaskManager::update() lastTime = currentTime; } -#if 0 - instance().m_sysInfoSource->update(); - if (ms_doUpdate) - { - Locator::updateAllLoads(); - ms_doUpdate = false; - } -#endif//0 - // get process status std::set >::iterator i; for(i = instance().m_localServers.begin(); i != instance().m_localServers.end();) diff --git a/engine/server/library/serverDatabase/src/shared/DatabaseProcess.cpp b/engine/server/library/serverDatabase/src/shared/DatabaseProcess.cpp index fb5a56fe..7164f1b8 100755 --- a/engine/server/library/serverDatabase/src/shared/DatabaseProcess.cpp +++ b/engine/server/library/serverDatabase/src/shared/DatabaseProcess.cpp @@ -498,23 +498,6 @@ void DatabaseProcess::receiveMessage(const MessageDispatch::Emitter & source, co Loader::getInstance().checkVersionNumber(ConfigServerDatabase::getExpectedDBVersion(), ConfigServerDatabase::isCorrectDBVersionRequired()); Loader::getInstance().loadClock(); } - else if(message.isType("LoadObjectMessage")) - { -#if 0 - Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); - LoadObjectMessage lom(ri); - connectToGameServer(lom.getAddress().c_str(),lom.getPort(),lom.getProcess()); -#endif - } - else if (message.isType("LoadUniverseMessage")) - { -#if 0 - Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); - LoadUniverseMessage lom(ri); - connectToGameServer(lom.getAddress().c_str(),lom.getPort(),lom.getProcess()); -#endif - } - else if(message.isType("GameSetProcessId") || message.isType("GameGameServerConnect")) { GameServerConnection * g = const_cast(static_cast(&source)); diff --git a/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesMarket.cpp b/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesMarket.cpp index fbc7b761..5d90b89e 100755 --- a/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesMarket.cpp +++ b/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesMarket.cpp @@ -246,15 +246,6 @@ namespace CommoditiesMarketNamespace errorCode = ar_ITEM_EQUIPPED; } -#if 0 - const VolumeContainer *vol = ContainerInterface::getVolumeContainer(item); - if (vol && vol->getCurrentVolume() > 0) - { - errorCode = ar_NOT_EMPTY; - } - -#endif - if ((errorCode == ar_OK) && auctionContainer.isVendor() && !auctionContainer.isBazaarTerminal()) { // check to make sure the vendor isn't restricted from accepting this item @@ -1772,67 +1763,9 @@ void CommoditiesMarket::auctionCreateImmediate(CreatureObject &owner, ServerObje void CommoditiesMarket::auctionCreatePermanent(const std::string &, const ServerObject &, const ServerObject &, BidAmount , const Unicode::String &, bool ) { - if (!ConfigServerGame::getCommoditiesMarketEnabled()) - return; - DEBUG_WARNING(true, ("auctionCreatePermanent has been depricated and shouldn't be used. If you see this WARNING, add a line to catch cheaters in the command in CommandCppFuncs.cpp")); return; - -#if 0 //what the hell is this? - - const NetworkId & itemId = item.getNetworkId(); - int flags = AUCTION_ALWAYS_PRESENT; - if (premium) - { - flags |= AUCTION_PREMIUM_AUCTION; - } - const TangibleObject *tangibleObject = item.asTangibleObject(); - if (tangibleObject && tangibleObject->hasCondition(ServerTangibleObjectTemplate::C_magicItem)) - { - flags |= AUCTION_MAGIC_ITEM; - } - - const Unicode::String objectName = Auction::getItemAuctionName(&item); - - const AuctionToken & token = AuctionTokenServer::createTokenFor(item); - Unicode::String oobData; - OutOfBandPackager::pack(token, 0, oobData); - - ServerObject::AttributeVector attributes; - - //-- I don't know why this cast is necessary, but MSDEV is apparently confused otherwise - static_cast(item).getAttributes(NetworkId::cms_invalid, attributes); - OutOfBandPackager::pack(attributes, 1, oobData); - - OutOfBandPackager::pack(item.getTemplateName(), 2, oobData); - - if (s_market) - { - s_market->AddImmediateAuction( - -1, - ownerName, - price, - 1, - itemId, - objectName.size(), objectName.data(), - item.getGameObjectType(), - ConfigServerGame::getUnclaimedAuctionItemDestroyTimeSec(), - auctionContainer.getNetworkId(), - getLocationString(auctionContainer), - flags, - userDescription.size(), userDescription.data(), - oobData.size(), - oobData); - } - else - { - - DEBUG_WARNING(true, ("[Commodities API] : No commodities server connection to send AddImmediateAuction.")); - - getCommoditiesServerConnection(); //attempt to reconnect to commodities server - } -#endif } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/core/PreloadManager.cpp b/engine/server/library/serverGame/src/shared/core/PreloadManager.cpp index 799e45df..8e13e7ee 100755 --- a/engine/server/library/serverGame/src/shared/core/PreloadManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/PreloadManager.cpp @@ -91,13 +91,6 @@ namespace PreloadManagerNameSpace if (tmp) line = tmp; - DataTable* dt = DataTableManager::getTable(line, true); -#if 0 - if (dt) - ms_dataTableList.push_back(dt); -#else - UNREF(dt); -#endif DEBUG_REPORT_LOG(true, (".")); line = fgets(buf, 256, fp); } diff --git a/engine/server/library/serverGame/src/shared/core/ServerBuildoutManager.cpp b/engine/server/library/serverGame/src/shared/core/ServerBuildoutManager.cpp index d83f034d..cf247722 100755 --- a/engine/server/library/serverGame/src/shared/core/ServerBuildoutManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/ServerBuildoutManager.cpp @@ -549,16 +549,6 @@ void ServerBuildoutManagerNamespace::buildObjectsToSave(std::vectorgetObjectName() ).c_str(), - (int)obj->getNetworkId().getValue(), - obj->getCacheVersion(), - obj->isPersisted(), - obj->isPlayerControlled(), - obj->getIncludeInBuildout() ) ); -#endif - const ServerObject * const containingObject = safe_cast(ContainerInterface::getContainedByObject(*obj)); // make sure that cells that should be included in the buildout have all their @@ -750,12 +740,6 @@ void ServerBuildoutManagerNamespace::loadArea(AreaInfo &areaInfo) FATAL( isPob && ( cellIndex != 0 || containerId != 0 ), ( "tried to add a pob to a cell or other container. %s (objId=%d cellIndex=%d containerId=%d)", serverTemplateBase->getName(), objId, cellIndex,containerId ) ); -#if 0 - DEBUG_REPORT_LOG_PRINT( true, ( "SERVER --------- objId=%016I64x container=%016I64x\n", - objId, - containerId)); - -#endif Quaternion const q( areaBuildoutTable.getFloatValue(qwColumn, buildoutRow), diff --git a/engine/server/library/serverGame/src/shared/core/ServerWorld.cpp b/engine/server/library/serverGame/src/shared/core/ServerWorld.cpp index 3b76b5db..a3fb0233 100755 --- a/engine/server/library/serverGame/src/shared/core/ServerWorld.cpp +++ b/engine/server/library/serverGame/src/shared/core/ServerWorld.cpp @@ -2524,18 +2524,6 @@ void ServerWorld::remove() delete m_sceneId; m_sceneId = 0; -#if 0 //removed pending objects - ObjectMap::iterator objIter; - while (m_pendingObjects->size() > 0) - { - objIter = m_pendingObjects->begin(); - object = (*objIter).second; - m_pendingObjects->erase(objIter); - delete object; - } - delete m_pendingObjects; - m_pendingObjects = 0; -#endif delete g_objectSphereTree; g_objectSphereTree = 0; delete g_triggerSphereTree; diff --git a/engine/server/library/serverGame/src/shared/object/CreatureObject.cpp b/engine/server/library/serverGame/src/shared/object/CreatureObject.cpp index 65cee1c4..ce7819b6 100755 --- a/engine/server/library/serverGame/src/shared/object/CreatureObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/CreatureObject.cpp @@ -2821,12 +2821,6 @@ float CreatureObject::alter(float time) } //check timer and migrate stats if necessary - -//disable self stat migration -#if 0 - migrateStats(time); -#endif - if (isPlayerControlled()) { PROFILER_AUTO_BLOCK_DEFINE("CreatureObject::alter auth player stuff"); diff --git a/engine/server/library/serverGame/src/shared/object/GroupWaypointBuilder.cpp b/engine/server/library/serverGame/src/shared/object/GroupWaypointBuilder.cpp index df72f250..4f2e1f58 100755 --- a/engine/server/library/serverGame/src/shared/object/GroupWaypointBuilder.cpp +++ b/engine/server/library/serverGame/src/shared/object/GroupWaypointBuilder.cpp @@ -112,36 +112,12 @@ void GroupWaypointBuilderNamespace::updateGroupWaypoints(PlayerObject &playerObj void GroupWaypointBuilder::updateGroupWaypoints(GroupObject const &groupObject) { -#if 0 - PlayerObject::WaypointMap groupWaypoints; - buildGroupWaypoints(groupObject, groupWaypoints); - GroupWaypointBuilderNamespace::updateGroupWaypoints(groupObject, groupWaypoints); -#endif } // ---------------------------------------------------------------------- void GroupWaypointBuilder::updateGroupWaypoints(PlayerObject &playerObject, bool const updateGroup) { -#if 0 - CreatureObject const * const creatureObject = playerObject.getCreatureObject(); - if (creatureObject) - { - GroupObject const * const groupObject = creatureObject->getGroup(); - if (groupObject && updateGroup) - { - PlayerObject::WaypointMap groupWaypoints; - buildGroupWaypoints(*groupObject, groupWaypoints); - GroupWaypointBuilderNamespace::updateGroupWaypoints(*groupObject, groupWaypoints); - } - else - { - PlayerObject::WaypointMap groupWaypoints; - buildGroupWaypoints(playerObject, groupWaypoints); - GroupWaypointBuilderNamespace::updateGroupWaypoints(playerObject, groupWaypoints); - } - } -#endif } // ====================================================================== diff --git a/engine/server/library/serverGame/src/shared/object/ServerObject.cpp b/engine/server/library/serverGame/src/shared/object/ServerObject.cpp index 19082342..c4903557 100755 --- a/engine/server/library/serverGame/src/shared/object/ServerObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/ServerObject.cpp @@ -2411,13 +2411,6 @@ int ServerObject::getVolume(void) const { const VolumeContainmentProperty* volumeProperty = ContainerInterface::getVolumeContainmentProperty(*this); return volumeProperty ? volumeProperty->getVolume() : 1; -#if 0 - const VolumeContainer * container = ContainerInterface::getVolumeContainer(*this); - if (container) - return m_volume.get()+container->getCurrentVolume(); - else - return m_volume.get(); -#endif } //----------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/space/ShipClientUpdateTracker.cpp b/engine/server/library/serverGame/src/shared/space/ShipClientUpdateTracker.cpp index a21cbf33..cec5525b 100755 --- a/engine/server/library/serverGame/src/shared/space/ShipClientUpdateTracker.cpp +++ b/engine/server/library/serverGame/src/shared/space/ShipClientUpdateTracker.cpp @@ -268,20 +268,6 @@ void ShipClientUpdateTracker::update(float elapsedTime) // static static Archive::ByteStream bs; - #if 0 - GameClientMessage gcm( - (*k).second, - false, - ShipUpdateTransformMessage( - ship->getNetworkId(), - controller->getTransform(), - controller->getVelocity(), - controller->getYawRate(), - controller->getPitchRate(), - controller->getRollRate(), - (*j).first->getSyncStampLong())); - gcm.pack(bs); - #else static ConstCharCrcString const s_gcmname("GameClientMessage"); static ConstCharCrcString const s_sutmname("ShipUpdateTransformMessage"); static unsigned int const s_sutmByteStreamLength = @@ -313,7 +299,6 @@ void ShipClientUpdateTracker::update(float elapsedTime) // static PackedRotationRate const packedRollRate(controller->getRollRate()); Archive::put(bs, packedRollRate); Archive::put(bs, (*j).first->getSyncStampLong()); - #endif (*j).first->Connection::send(bs, false); bs.clear(); diff --git a/engine/server/library/serverGame/src/shared/trading/ServerSecureTrade.cpp b/engine/server/library/serverGame/src/shared/trading/ServerSecureTrade.cpp index c486c67f..32299369 100755 --- a/engine/server/library/serverGame/src/shared/trading/ServerSecureTrade.cpp +++ b/engine/server/library/serverGame/src/shared/trading/ServerSecureTrade.cpp @@ -733,63 +733,6 @@ void ServerSecureTrade::removeItem(const CreatureObject & trader, const ServerOb //-- CS requested that removing an item cancels the trade to prevent scamming UNREF (item); cancelTrade (trader); - -#if 0 - if (m_tradeState != TS_Trading) - { - DEBUG_REPORT_LOG(true, ("Secure Trade: received an remove item in non-trade state\n")); - beginTrading(); - } - - if (&trader == m_initiator) - { - std::vector::iterator i = std::find(m_initiatorContents->begin(), m_initiatorContents->end(), &item); - if (i != m_initiatorContents->end()) - { - m_initiatorContents->erase(i); - - Client * const recipientClient = m_recipient->getClient(); - if (recipientClient) - { - RemoveItemMessage const m(item.getNetworkId()); - recipientClient->send(m, true); - } - } - else - { - //@todo need an error message - } - - } - else if (& trader == m_recipient) - { - std::vector::iterator i = std::find(m_recipientContents->begin(), m_recipientContents->end(), &item); - if (i != m_recipientContents->end()) - { - m_recipientContents->erase(i); - - Client * const initiatorClient = m_initiator->getClient(); - if (initiatorClient) - { - RemoveItemMessage const m(item.getNetworkId()); - initiatorClient->send(m, true); - } - } - else - { - //@todo need an error message for not found. - } - - } - else - { - WARNING_STRICT_FATAL(true, ("Secure Trade: received a remove Item from non participant\n")); - return; - } - unacceptOffer(*m_initiator); - unacceptOffer(*m_recipient); -#endif - } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverKeyShare/src/shared/KeyServer.cpp b/engine/server/library/serverKeyShare/src/shared/KeyServer.cpp index a6124d8f..ab830063 100755 --- a/engine/server/library/serverKeyShare/src/shared/KeyServer.cpp +++ b/engine/server/library/serverKeyShare/src/shared/KeyServer.cpp @@ -42,23 +42,7 @@ KeyServer::~KeyServer() bool KeyServer::update(void) { - bool result = false; -#if 0 // disable key rotation - lastUpdateTime += Clock::frameTime(); - if(lastUpdateTime > updateRate) - { - lastUpdateTime = CONST_REAL(0.0); - KeyShare::Key k; - for(unsigned int j = 0; j < KeyShareConstants::keyLength; j ++) - { - k.value[j] = static_cast(randomNumberGenerator->random(255)); - } - pushKey(k); - result = true; - } -#endif // disable key rotation - - return result; + return false; } //----------------------------------------------------------------------- diff --git a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp index b2932622..cc2bc006 100755 --- a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp +++ b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp @@ -4705,20 +4705,6 @@ int JavaLibrary::runScript(const NetworkId & caller, const std::string& script, } } break; -#if 0 - case 'S': - { - arg = globals.getNextStringId(); - if (arg == 0) - { - return SCRIPT_OVERRIDE; - } - // @todo: fix this when we get real string ids -// int param = atoi(stringArg); -// ms_env->SetIntField(arg, ms_fidStringIdData, static_cast(param)); - } - break; -#endif default: DEBUG_REPORT_LOG(true, ("unknown parameter type %c(%#x)\n", argList[i], static_cast(argList[i]))); //lint !e571 suspicious cast diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsChat.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsChat.cpp index 39fbf062..53992c20 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsChat.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsChat.cpp @@ -181,29 +181,6 @@ jstring JNICALL ScriptMethodsChatNamespace::chatPackOutOfBandToken(JNIEnv * env, JavaString result("JavaLibrary::chatPackOutOfBandToken - FAILED Token archive not implemented"); return result.getReturnValue(); - -#if 0 - JavaStringParam jt(target); - Unicode::String t; - if(! JavaLibrary::convert(jt, t)) - return 0; - - if(! source) - return 0; - - Token * token = 0; - if(!JavaLibrary::getObject(source, token)) - return 0; - - Archive::ByteStream bs; - Archive::put(bs, std::string(token->getObjectTemplateName())); - Archive::put(bs, *token); - - OutOfBandPackager::pack(bs, gs_Object, position, t); - - JavaString result(t); - return result.getReturnValue(); -#endif } //---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedCompression/src/shared/ZlibCompressor.cpp b/engine/shared/library/sharedCompression/src/shared/ZlibCompressor.cpp index 7f3aed3d..8a0515a8 100755 --- a/engine/shared/library/sharedCompression/src/shared/ZlibCompressor.cpp +++ b/engine/shared/library/sharedCompression/src/shared/ZlibCompressor.cpp @@ -43,9 +43,6 @@ voidpf ZlibCompressorNamespace::allocateWrapper(voidpf opaque, uInt items, uInt UNREF(opaque); void *result = 0; -#if 0 - result = operator new(items * size); -#else int totalSize = items * size; if (totalSize > cms_poolElementThreshold) { @@ -67,7 +64,6 @@ voidpf ZlibCompressorNamespace::allocateWrapper(voidpf opaque, uInt items, uInt ms_mutex.leave(); } -#endif return result; } @@ -78,9 +74,6 @@ void ZlibCompressorNamespace::freeWrapper(voidpf opaque, voidpf address) { UNREF(opaque); -#if 0 - operator delete(address); -#else if (address < ms_memoryBottom || address >= ms_memoryTop) operator delete(address); else @@ -89,7 +82,6 @@ void ZlibCompressorNamespace::freeWrapper(voidpf opaque, voidpf address) ms_memoryPool.push_back(address); ms_mutex.leave(); } -#endif } // ====================================================================== diff --git a/engine/shared/library/sharedDebug/src/linux/DebugMonitor.cpp b/engine/shared/library/sharedDebug/src/linux/DebugMonitor.cpp index 95dfef41..8f4f0682 100755 --- a/engine/shared/library/sharedDebug/src/linux/DebugMonitor.cpp +++ b/engine/shared/library/sharedDebug/src/linux/DebugMonitor.cpp @@ -417,10 +417,6 @@ void DebugMonitor::flushOutput() const int input = wgetch(s_outputWindow); if (input != ERR) { -#if 0 - DEBUG_REPORT_LOG(true, ("DebugMonitor: received key [index=%d].\n", input)); -#endif - //-- Handle input. switch (input) { diff --git a/engine/shared/library/sharedFile/src/shared/Iff.h b/engine/shared/library/sharedFile/src/shared/Iff.h index 1fe0660a..9fe54c7d 100755 --- a/engine/shared/library/sharedFile/src/shared/Iff.h +++ b/engine/shared/library/sharedFile/src/shared/Iff.h @@ -248,10 +248,6 @@ public: void read_string(Unicode::String &str); Unicode::String read_unicodeString(); - -#if 0 - real *read_float (int count, real *array=nullptr); -#endif }; // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedFoundation/src/linux/FloatingPointUnit.cpp b/engine/shared/library/sharedFoundation/src/linux/FloatingPointUnit.cpp index 3ad0c949..4c8f48a1 100755 --- a/engine/shared/library/sharedFoundation/src/linux/FloatingPointUnit.cpp +++ b/engine/shared/library/sharedFoundation/src/linux/FloatingPointUnit.cpp @@ -115,26 +115,14 @@ void FloatingPointUnit::update(void) WORD FloatingPointUnit::getControlWord(void) { - //TODO wtf is this asm statement? -#if 0 - WORD controlWord = 0; - __asm fnstcw controlWord; - return controlWord; -#else return status; -#endif } // ---------------------------------------------------------------------- void FloatingPointUnit::setControlWord(WORD controlWord) { - //TODO see above? - UNREF(controlWord); -#if 0 - __asm fldcw controlWord; -#endif } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedFoundation/src/linux/Os.cpp b/engine/shared/library/sharedFoundation/src/linux/Os.cpp index b1e26987..fd3ee6c2 100755 --- a/engine/shared/library/sharedFoundation/src/linux/Os.cpp +++ b/engine/shared/library/sharedFoundation/src/linux/Os.cpp @@ -88,11 +88,6 @@ void Os::installCommon(void) ExitChain::add(Os::remove, "Os::remove", 0, true); -#if 0 //TODO For now we won't screw with the priority of the process - HANDLE threadHandle = GetCurrentThread(); - DEBUG_FATAL(!SetThreadPriority(threadHandle, THREAD_PRIORITY_ABOVE_NORMAL), ("Failed to set game thread priority")); -#endif - numberOfUpdates = 0; mainThreadId = pthread_self(); @@ -299,19 +294,6 @@ bool Os::update(void) ++numberOfUpdates; -#if 0 -#ifdef _DEBUG - - if (DEBUG_FLAG_PLATFORM(validateHeap)) - { - PROFILER_START("validate heap"); - MemoryManager::validate(); - PROFILER_STOP("validate heap"); - } - -#endif -#endif - Clock::update(); wasPaused = false; diff --git a/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.cpp b/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.cpp index 822a4ee5..97059d06 100755 --- a/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.cpp +++ b/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.cpp @@ -179,13 +179,6 @@ DWORD GetFileSize(FILE* hFile, DWORD* lpHighSize) endPos = ftell(hFile); fseek(hFile, curPos, SEEK_SET); return endPos; - -#if 0 -//This is what I want to do, but I have no file des number - struct stat buf; - fstat(hFile, &buf); - return buf->st_size; -#endif } BOOL FileExists(const char* filename) diff --git a/engine/shared/library/sharedFoundation/src/linux/SetupSharedFoundation.cpp b/engine/shared/library/sharedFoundation/src/linux/SetupSharedFoundation.cpp index 8a0b901e..08809fcc 100755 --- a/engine/shared/library/sharedFoundation/src/linux/SetupSharedFoundation.cpp +++ b/engine/shared/library/sharedFoundation/src/linux/SetupSharedFoundation.cpp @@ -44,12 +44,6 @@ void SetupSharedFoundation::install(const Data &data) if (data.argc) CommandLine::absorbStrings(const_cast(data.argv+1), data.argc-1); -#if 0 - //currently there's a problem that we cannot override the defaults here. - if (data.configFile) - IGNORE_RETURN(ConfigFile::loadFile(data.configFile)); -#endif - // get the post command-line text for the ConfigFile (key-value pairs) const char *configString = CommandLine::getPostCommandLineString(); if (configString) diff --git a/engine/shared/library/sharedFoundation/src/shared/Clock.cpp b/engine/shared/library/sharedFoundation/src/shared/Clock.cpp index 6851f8fb..8aa01785 100755 --- a/engine/shared/library/sharedFoundation/src/shared/Clock.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/Clock.cpp @@ -254,24 +254,6 @@ void Clock::update(void) ms_lastFrameRate = RECIP(ms_lastFrameTime); } -#if 0 - // -qq- debugging W2K QueryPerformanceCounter - static DWORD lastTick; - DWORD newTick = GetTickCount(); - - DEBUG_REPORT_LOG_PRINT(true, ("Clock::update %I64d %I64d %6I64d %10d %10d %3d %6.2f=fps %6.4f=time\n", ms_lastPoll, newPoll, newPoll - ms_lastPoll, lastTick, newTick, newTick - lastTick, ms_lastFrameRate, ms_lastFrameTime)); - - static int bad = 0; - - if (bad && ++bad > 64) - __asm int 3; - - if (ms_lastFrameTime > 3.0) - bad = 1; - - lastTick = newTick; -#endif - ms_lastPoll = newPoll; diff --git a/engine/shared/library/sharedFoundation/src/shared/Crc.cpp b/engine/shared/library/sharedFoundation/src/shared/Crc.cpp index 28ef3514..8ae9cb51 100755 --- a/engine/shared/library/sharedFoundation/src/shared/Crc.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/Crc.cpp @@ -78,25 +78,6 @@ uint32 Crc::calculate(const char *string) // ---------------------------------------------------------------------- -#if 0 - -uint32 Crc::calculateWithToLower(const char *string) -{ - uint32 crc; - - if (!string) - return 0; - - for (crc = CRC_INIT; *string; ++string) - crc = crctable[((crc>>24) ^ static_cast(tolower(*string))) & 0xFF] ^ (crc << 8); - - return (crc ^ CRC_INIT); -} - -#endif - -// ---------------------------------------------------------------------- - uint32 Crc::calculate(const void *data, int length, uint32 initCrc) { DEBUG_FATAL(!data, ("nullptr data arg")); diff --git a/engine/shared/library/sharedGame/src/shared/appearance/WearableAppearanceMap.cpp b/engine/shared/library/sharedGame/src/shared/appearance/WearableAppearanceMap.cpp index 5b7e478f..a0a22121 100755 --- a/engine/shared/library/sharedGame/src/shared/appearance/WearableAppearanceMap.cpp +++ b/engine/shared/library/sharedGame/src/shared/appearance/WearableAppearanceMap.cpp @@ -321,16 +321,6 @@ WearableAppearanceMap::MapResult::MapResult(MapResult const &rhs) : // ---------------------------------------------------------------------- -#if 0 - -WearableAppearanceMap::MapResult &WearableAppearanceMap::MapResult::operator =(MapResult const &rhs) -{ -} - -#endif - -// ---------------------------------------------------------------------- - bool WearableAppearanceMap::MapResult::hasMapping() const { return m_hasMapping; diff --git a/engine/shared/library/sharedGame/src/shared/quest/Quest.cpp b/engine/shared/library/sharedGame/src/shared/quest/Quest.cpp index 14d2fcab..50052b8a 100755 --- a/engine/shared/library/sharedGame/src/shared/quest/Quest.cpp +++ b/engine/shared/library/sharedGame/src/shared/quest/Quest.cpp @@ -485,15 +485,6 @@ int Quest::getMoneyRewardCredits() const // ---------------------------------------------------------------------- -#if 0 -std::vector const & Quest::getTasks() const -{ - return *m_tasks; -} -#endif - -// ---------------------------------------------------------------------- - /** * Conversts a comma-delimited list of strings into a vector or the CRCs * of those strings. diff --git a/engine/shared/library/sharedImage/src/shared/ImageManipulation.cpp b/engine/shared/library/sharedImage/src/shared/ImageManipulation.cpp index 4495b31e..5a71abc9 100755 --- a/engine/shared/library/sharedImage/src/shared/ImageManipulation.cpp +++ b/engine/shared/library/sharedImage/src/shared/ImageManipulation.cpp @@ -367,13 +367,6 @@ void ImageManipulation::install(const InstallData &installData) //-- make sure we've got valid function pointers for all NOT_NULL(ms_nextMipmapFunction); -#if 0 - NOT_NULL(ms_convertFormatFunction); - NOT_NULL(ms_copyIgnoreAlphaFunction); - NOT_NULL(ms_copyRespectAlphaFunction); - NOT_NULL(ms_blendFunction); - NOT_NULL(ms_blendTwoFunction); -#endif } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedImage/src/shared/ImageManipulation.h b/engine/shared/library/sharedImage/src/shared/ImageManipulation.h index 4a8d6bbd..f29ecbcf 100755 --- a/engine/shared/library/sharedImage/src/shared/ImageManipulation.h +++ b/engine/shared/library/sharedImage/src/shared/ImageManipulation.h @@ -55,20 +55,7 @@ public: static void install(const InstallData &installData); - static void generateNextSmallerMipmap(const Image &sourceImage, Image &destImage); - -#if 0 - static void convertFormatSameSize(const Image &sourceImage, Image &destImage); - - // these functions require same pixel format. they do not stretch or compress pixels. - static void copyIgnoreAlpha(const Image &sourceImage, int sourceX, int sourceY, int width, int height, Image &destImage, int destX, int destY); - static void copyRespectAlpha(const Image &sourceImage, int sourceX, int sourceY, int width, int height, Image &destImage, int destX, int destY); - - // these two always respect alpha - static void blend(float sourceBlendFactor, const Image &sourceImage, int sourceX, int sourceY, int width, int height, Image &destImage, int destX, int destY); - static void blendTwo(float firstSourceBlendFactor, float resultToDestBlendFactor, const Image &sourceImage1, const Image &sourceImage2, int sourceX, int sourceY, int width, int height, Image &destImage, int destX, int destY); -#endif - + static void generateNextSmallerMipmap(const Image &sourceImage, Image &destImage); private: static void remove(); diff --git a/engine/shared/library/sharedMath/src/shared/PaletteArgb.cpp b/engine/shared/library/sharedMath/src/shared/PaletteArgb.cpp index a1d12e7c..d91aa072 100755 --- a/engine/shared/library/sharedMath/src/shared/PaletteArgb.cpp +++ b/engine/shared/library/sharedMath/src/shared/PaletteArgb.cpp @@ -146,7 +146,7 @@ void PaletteArgb::release() const --m_referenceCount; //-- We are going to let the PaletteArgbList keep references to the palettes and clean them up at the end. -#if 0 +#if 0 //TODO: should we use the below or nuke it? if (m_referenceCount == 0) { PaletteArgbList::stopTracking(*this); diff --git a/engine/shared/library/sharedObject/src/shared/customization/CustomizationData_Directory.h b/engine/shared/library/sharedObject/src/shared/customization/CustomizationData_Directory.h index fabdd186..688b7324 100755 --- a/engine/shared/library/sharedObject/src/shared/customization/CustomizationData_Directory.h +++ b/engine/shared/library/sharedObject/src/shared/customization/CustomizationData_Directory.h @@ -41,11 +41,6 @@ public: virtual void deleteLinksTo(const CustomizationData &customizationData) = 0; virtual bool isLocalDirectory() const = 0; -#if 0 - virtual std::string writeLocalDirectoryToString() const = 0; - - virtual void loadLocalDirectoryFromString(int version, const std::string &string, int startIndex) = 0; -#endif CustomizationData &getOwner(); const CustomizationData &getOwner() const; diff --git a/engine/shared/library/sharedObject/src/shared/customization/CustomizationData_LocalDirectory.cpp b/engine/shared/library/sharedObject/src/shared/customization/CustomizationData_LocalDirectory.cpp index 1a12a2fd..b631344f 100755 --- a/engine/shared/library/sharedObject/src/shared/customization/CustomizationData_LocalDirectory.cpp +++ b/engine/shared/library/sharedObject/src/shared/customization/CustomizationData_LocalDirectory.cpp @@ -395,231 +395,4 @@ bool CustomizationData::LocalDirectory::isLocalDirectory() const return true; } -// ---------------------------------------------------------------------- - -#if 0 - -std::string CustomizationData::LocalDirectory::writeLocalDirectoryToString() const -{ - char scratchBuffer[1024]; - std::string data; - - //-- count # persistable variables - int variableCount = 0; - - { - const CustomizationVariableMap::const_iterator endIt = m_variables.end(); - for (CustomizationVariableMap::const_iterator it = m_variables.begin(); it != endIt; ++it) - { - //-- verify it's a non-nullptr variable - const CustomizationVariable *const variable = it->second; - if (variable && variable->doesVariablePersist()) - { - // we will write this variable - ++variableCount; - } - } - } - - //-- write # variables - sprintf(scratchBuffer, "%x%c", variableCount, cms_stringFieldSeparator); - data += scratchBuffer; - - //-- write each variable - { - const CustomizationVariableMap::const_iterator endIt = m_variables.end(); - for (CustomizationVariableMap::const_iterator it = m_variables.begin(); it != endIt; ++it) - { - //-- verify it's a non-nullptr variable - const CustomizationVariable *const variable = it->second; - if (!variable) - { - WARNING(true, ("writeLocalDirectoryToString: nullptr variable for [%s], skipping variable writing.")); - continue; - } - - //-- skip variables that should not be written. typically this will be constant data - // that doesn't need to be customized or transmitted/persisted. - if (!variable->doesVariablePersist()) - continue; - - //-- write variable name - data += it->first.getString(); - data += cms_stringFieldSeparator; - - //-- write variable data - // get variable content data - const std::string variableContents = variable->writeToString(); - - // write content length (we do this so we can skip a variable if its not supported at load time) - sprintf(scratchBuffer, "%x%c", variableContents.size(), cms_stringFieldSeparator); - data += scratchBuffer; - - // write variable content - data += variableContents; - } - } - - //-- get # local directories to write - int directoryCount = 0; - { - const DirectoryMap::const_iterator endIt = m_directories.end(); - for (DirectoryMap::const_iterator it = m_directories.begin(); it != endIt; ++it) - { - if (it->second && it->second->isLocalDirectory()) - ++directoryCount; - } - } - - //-- write # directories - sprintf(scratchBuffer, "%x%c", directoryCount, cms_stringFieldSeparator); - data += scratchBuffer; - - //-- write directory contents - { - const DirectoryMap::const_iterator endIt = m_directories.end(); - for (DirectoryMap::const_iterator it = m_directories.begin(); it != endIt; ++it) - { - if (it->second && it->second->isLocalDirectory()) - { - // write directory name - data += it->first.getString(); - data += cms_stringFieldSeparator; - - // get directory data contents - const std::string subdirData = it->second->writeLocalDirectoryToString(); - - // write directory data size (we do this so we can skip a directory if its not supported at load time) - sprintf(scratchBuffer, "%x%c", subdirData.size(), cms_stringFieldSeparator); - data += scratchBuffer; - - // write directory contents - data += subdirData; - } - } - } - - return data; -} - -#endif - -// ---------------------------------------------------------------------- - -#if 0 - -void CustomizationData::LocalDirectory::loadLocalDirectoryFromString(int version, const std::string &string, int startIndex) -{ - if (version == 2) - loadLocalDirectoryFromString_0002(string, startIndex); - else - WARNING(true, ("loadLocalDirectoryFromString(): unsupported version [%d]", version)); -} - -#endif - -// ====================================================================== - -#if 0 - -void CustomizationData::LocalDirectory::loadLocalDirectoryFromString_0002(const std::string &data, int startIndex) -{ - int currentPosition = startIndex; - - //-- get # variables - const int variableCount = parseSeparatedHexInt(data, currentPosition, currentPosition); - if (currentPosition == static_cast(std::string::npos)) - { - WARNING(true, ("loadLocalDirectoryFromString_0002(): failed to load variable count, aborting load.")); - return; - } - - //-- load each variable - { - for (int i = 0; i < variableCount; ++i) - { - //-- load the variable name - const std::string variableName = parseSeparatedString(data, currentPosition, currentPosition); - if (currentPosition == static_cast(std::string::npos)) - { - WARNING(true, ("loadLocalDirectoryFromString_0002(): failed to load variable name, aborting load.")); - return; - } - - //-- load the # characters in the value data - const int valueCharacterCount = parseSeparatedHexInt(data, currentPosition, currentPosition); - if (currentPosition == static_cast(std::string::npos)) - { - WARNING(true, ("loadLocalDirectoryFromString_0002(): failed to load variable data size, aborting load.")); - return; - } - - //-- find the customization variable - CustomizationVariable *const variable = findVariable(variableName, 0); - if (!variable) - { - WARNING(true, ("loadLocalDirectoryFromString_0002(): variable [%s] does not exist to be restored.", variableName.c_str())); - return; - } - else - { - //-- load the data - if (!variable->loadFromString(2, std::string(data, static_cast(currentPosition), static_cast(valueCharacterCount)))) - WARNING(true, ("loadLocalDirectoryFromString_0002(): variable [%s] failed to load.", variableName.c_str())); - } - - //-- pass the variable data - currentPosition += valueCharacterCount; - } - } - - //-- get # subdirectories - const int directoryCount = parseSeparatedHexInt(data, currentPosition, currentPosition); - if (currentPosition == static_cast(std::string::npos)) - { - WARNING(true, ("loadLocalDirectoryFromString_0002(): failed to load directory count, aborting load.")); - return; - } - - //-- load each subdirectory - { - for (int i = 0; i < directoryCount; ++i) - { - //-- load the directory name - const std::string directoryName = parseSeparatedString(data, currentPosition, currentPosition); - if (currentPosition == static_cast(std::string::npos)) - { - WARNING(true, ("loadLocalDirectoryFromString_0002(): failed to load directory name, aborting load.")); - return; - } - - //-- load the # characters in the value data - const int directoryCharacterCount = parseSeparatedHexInt(data, currentPosition, currentPosition); - if (currentPosition == static_cast(std::string::npos)) - { - WARNING(true, ("loadLocalDirectoryFromString_0002(): failed to load directory data size, aborting load.")); - return; - } - - //-- find the customization variable - Directory *const directory = findDirectory(directoryName, 0); - if (!directory) - { - WARNING(true, ("loadLocalDirectoryFromString_0002(): object id=[%s], directory [%s] does not exist to be restored.", getOwner().getOwnerObject().getNetworkId().getValueString().c_str(), directoryName.c_str())); - return; - } - else - { - //-- load the data - directory->loadLocalDirectoryFromString(2, data, currentPosition); - } - - //-- pass the variable data - currentPosition += directoryCharacterCount; - } - } -} - -#endif - // ====================================================================== diff --git a/engine/shared/library/sharedObject/src/shared/customization/CustomizationData_LocalDirectory.h b/engine/shared/library/sharedObject/src/shared/customization/CustomizationData_LocalDirectory.h index a8fba11f..1fc5159a 100755 --- a/engine/shared/library/sharedObject/src/shared/customization/CustomizationData_LocalDirectory.h +++ b/engine/shared/library/sharedObject/src/shared/customization/CustomizationData_LocalDirectory.h @@ -49,11 +49,6 @@ public: virtual void deleteLinksTo(const CustomizationData &customizationData); virtual bool isLocalDirectory() const; -#if 0 - virtual std::string writeLocalDirectoryToString() const; - - virtual void loadLocalDirectoryFromString(int version, const std::string &string, int startIndex); -#endif private: @@ -61,11 +56,6 @@ private: typedef stdmap::fwd CustomizationVariableMap; private: - -#if 0 - void loadLocalDirectoryFromString_0002(const std::string &string, int startIndex); -#endif - // Disabled. LocalDirectory(); LocalDirectory(const LocalDirectory&); diff --git a/engine/shared/library/sharedObject/src/shared/customization/CustomizationData_RemoteDirectory.cpp b/engine/shared/library/sharedObject/src/shared/customization/CustomizationData_RemoteDirectory.cpp index d52cb830..7f906066 100755 --- a/engine/shared/library/sharedObject/src/shared/customization/CustomizationData_RemoteDirectory.cpp +++ b/engine/shared/library/sharedObject/src/shared/customization/CustomizationData_RemoteDirectory.cpp @@ -164,31 +164,4 @@ bool CustomizationData::RemoteDirectory::isLocalDirectory() const return false; } -// ---------------------------------------------------------------------- - -#if 0 - -std::string CustomizationData::RemoteDirectory::writeLocalDirectoryToString() const -{ - WARNING(true, ("writeLocalDirectoryToString(): operation makes no sense on RemoteDirectory instances.\n")); - return ""; -} - -#endif - -// ---------------------------------------------------------------------- - -#if 0 - -void CustomizationData::RemoteDirectory::loadLocalDirectoryFromString(int version, const std::string &string, int startIndex) -{ - UNREF(version); - UNREF(string); - UNREF(startIndex); - - WARNING(true, ("loadLocalDirectoryFromString(): operation makes no sense on RemoteDirectory instances.")); -} - -#endif - // ====================================================================== diff --git a/engine/shared/library/sharedObject/src/shared/customization/CustomizationData_RemoteDirectory.h b/engine/shared/library/sharedObject/src/shared/customization/CustomizationData_RemoteDirectory.h index e1d89ce7..a14c88c4 100755 --- a/engine/shared/library/sharedObject/src/shared/customization/CustomizationData_RemoteDirectory.h +++ b/engine/shared/library/sharedObject/src/shared/customization/CustomizationData_RemoteDirectory.h @@ -47,11 +47,6 @@ public: virtual void deleteLinksTo(const CustomizationData &customizationData); virtual bool isLocalDirectory() const; -#if 0 - virtual std::string writeLocalDirectoryToString() const; - - virtual void loadLocalDirectoryFromString(int version, const std::string &string, int startIndex); -#endif private: diff --git a/engine/shared/library/sharedObject/src/shared/customization/RangedIntCustomizationVariable.cpp b/engine/shared/library/sharedObject/src/shared/customization/RangedIntCustomizationVariable.cpp index a9ef4255..2373dfb2 100755 --- a/engine/shared/library/sharedObject/src/shared/customization/RangedIntCustomizationVariable.cpp +++ b/engine/shared/library/sharedObject/src/shared/customization/RangedIntCustomizationVariable.cpp @@ -52,36 +52,6 @@ int RangedIntCustomizationVariable::getPersistedDataByteCount() const // ---------------------------------------------------------------------- -#if 0 - -std::string RangedIntCustomizationVariable::writeToString() const -{ - char buffer[64]; - sprintf(buffer, "%x", getValue()); - return std::string(buffer); -} - -#endif - -// ---------------------------------------------------------------------- - -#if 0 - -bool RangedIntCustomizationVariable::loadFromString(int version, const std::string &data) -{ - if (version == 2) - return loadFromString_0002(data); - else - { - WARNING(true, ("loadFromString(): version %d unsupported.\n", version)); - return false; - } -} - -#endif - -// ---------------------------------------------------------------------- - void RangedIntCustomizationVariable::saveToByteVector(ByteVector &data) const { int const byteCount = getPersistedDataByteCount(); @@ -179,29 +149,6 @@ RangedIntCustomizationVariable::RangedIntCustomizationVariable() // ====================================================================== -#if 0 - -bool RangedIntCustomizationVariable::loadFromString_0002(const std::string &data) -{ - int newValue; - - const int scanfResult = sscanf(data.c_str(), "%x", &newValue); - if (scanfResult != 1) - { - // failed - return false; - } - else - { - setValue(newValue); - return true; - } -} - -#endif - -//---------------------------------------------------------------------- - /** * This function computes the normalized value. * @return a number in [0.0,1.0] diff --git a/engine/shared/library/sharedObject/src/shared/customization/RangedIntCustomizationVariable.h b/engine/shared/library/sharedObject/src/shared/customization/RangedIntCustomizationVariable.h index 8c172383..76e0db26 100755 --- a/engine/shared/library/sharedObject/src/shared/customization/RangedIntCustomizationVariable.h +++ b/engine/shared/library/sharedObject/src/shared/customization/RangedIntCustomizationVariable.h @@ -46,10 +46,6 @@ protected: private: -#if 0 - bool loadFromString_0002(const std::string &data); -#endif - // disabled RangedIntCustomizationVariable(const RangedIntCustomizationVariable&); RangedIntCustomizationVariable &operator =(const RangedIntCustomizationVariable&); diff --git a/engine/shared/library/sharedObject/src/shared/object/Object.cpp b/engine/shared/library/sharedObject/src/shared/object/Object.cpp index 2cad0571..ce7e05cf 100755 --- a/engine/shared/library/sharedObject/src/shared/object/Object.cpp +++ b/engine/shared/library/sharedObject/src/shared/object/Object.cpp @@ -1390,10 +1390,6 @@ void Object::setParentCell(CellProperty *cellProperty) if (getParentCell() == cellProperty) return; -#if 0 - DEBUG_FATAL(isChildObject(), ("Object::setParentCell called on child object [id=%s template=%s] with parent object [id=%s template=%s]", getNetworkId().getValueString().c_str(), getObjectTemplateName(), m_attachedToObject->getNetworkId().getValueString().c_str(), m_attachedToObject->getObjectTemplateName())); -#endif - // if we were in another cell, detach us. This will leave out object in world space. if (!isInWorldCell()) detachFromObject(DF_world); diff --git a/engine/shared/library/sharedObject/src/shared/portal/CellProperty.cpp b/engine/shared/library/sharedObject/src/shared/portal/CellProperty.cpp index 95281e88..21d861bd 100755 --- a/engine/shared/library/sharedObject/src/shared/portal/CellProperty.cpp +++ b/engine/shared/library/sharedObject/src/shared/portal/CellProperty.cpp @@ -722,14 +722,6 @@ CellProperty *CellProperty::getDestinationCell(const Vector &startPosition, cons CellProperty *cellProperty = 0; closestPortalT = FLT_MAX; -#if 0 - if ((startPosition - endPosition).magnitude() > 2.0f) - { - static volatile int debug = 0; - ++debug; - } -#endif - const PortalObjectList::const_iterator iEnd = m_portalObjectList->end(); for (PortalObjectList::const_iterator i = m_portalObjectList->begin(); i != iEnd; ++i) { diff --git a/engine/shared/library/sharedObject/src/shared/portal/PortalProperty.cpp b/engine/shared/library/sharedObject/src/shared/portal/PortalProperty.cpp index 716b488a..4dce02ea 100755 --- a/engine/shared/library/sharedObject/src/shared/portal/PortalProperty.cpp +++ b/engine/shared/library/sharedObject/src/shared/portal/PortalProperty.cpp @@ -229,7 +229,7 @@ bool PortalProperty::serverEndBaselines(int serverObjectCrc, std::vector vmax.x || pos.z < vmin.z || pos.z > vmax.z) - { - DEBUG_WARNING (true, ("called getHeightAt for position not within chunk")); - return false; - } - // ------------------------------------------------ - - // ------------------------------------------------ - // get height pole and tile coordinate. - const Vector localPos = pos - vmin; - - const ProceduralTerrainAppearanceTemplate *proceduralTerrainAppearanceTemplate = getAppearanceTemplate(); - const float distanceBetweenPoles = proceduralTerrainAppearanceTemplate->getTileWidthInMeters() / 2.0f; - const int numberOfPolesPerChunk = proceduralTerrainAppearanceTemplate->getNumberOfTilesPerChunk() * 2; - - int poleX = int(floor(localPos.x / distanceBetweenPoles)); - if (poleX>=numberOfPolesPerChunk) - { - poleX=numberOfPolesPerChunk-1; - } - - int poleZ = int(floor(localPos.z / distanceBetweenPoles)); - if (poleZ>=numberOfPolesPerChunk) - { - poleZ=numberOfPolesPerChunk-1; - } - - const int tileX = poleX>>1; - const int tileZ = poleZ>>1; - // ------------------------------------------------ - - // ------------------------------------------------ - // if the tile at x,z is excluded, return failure. - - // DEBUG - { - int dbgTileX, dbgTileZ; - _findTileXz(pos, dbgTileX, dbgTileZ); - DEBUG_FATAL(dbgTileX!=tileX, ("")); - DEBUG_FATAL(dbgTileZ!=tileZ, ("")); - } - - if (isExcluded(tileX, tileZ)) - { - return false; - } - // ------------------------------------------------ - - - // ------------------------------------------------ - // construct vertical vector at x,z that goes - // from the highest point in the chunk to the - // lowest point in the chunk. - const Vector start(pos.x, vmax.y + 0.1f, pos.z); - const Vector end(pos.x, vmin.y - 0.1f, pos.z); - const Vector dir = end - start; - // ------------------------------------------------ - - //-- collide with the 8 polygons in the tile - bool found = false; - - CollisionInfo result; - result.setPoint (end); - - Vector intersection; - - const int numberOfTilesPerChunk = m_proceduralTerrainAppearance.getNumberOfTilesPerChunk(); - const int tileIndex = tileZ * numberOfTilesPerChunk + tileX; - const int triangleOffset = tileIndex * 8; - for (int tri = triangleOffset; tri < triangleOffset + 8; ++tri) - { - const Plane& plane = (*m_planeList) [tri]; - const Vector& normal = plane.getNormal (); - - if ( dir.dot(normal)<0.f // if triangle is facing upward - && plane.findIntersection(start, end, intersection) - ) - { - const int i0 = (*ms_indexList)[tri*3 + 0]; - const int i1 = (*ms_indexList)[tri*3 + 1]; - const int i2 = (*ms_indexList)[tri*3 + 2]; - - const Vector& v0 = (*m_vertexList)[i0]; - const Vector& v1 = (*m_vertexList)[i1]; - const Vector& v2 = (*m_vertexList)[i2]; - - DenormalizedLine2d const line01 (Vector2d (v0.x, v0.z), Vector2d (v1.x, v1.z)); - DenormalizedLine2d const line12 (Vector2d (v1.x, v1.z), Vector2d (v2.x, v2.z)); - DenormalizedLine2d const line20 (Vector2d (v2.x, v2.z), Vector2d (v0.x, v0.z)); - - if (line01.computeDistanceTo (Vector2d (start.x, start.z)) <= 0 && - line12.computeDistanceTo (Vector2d (start.x, start.z)) <= 0 && - line20.computeDistanceTo (Vector2d (start.x, start.z)) <= 0) - { - found = true; - - result.setPoint (intersection); - result.setNormal (normal); - } - } - } - - if (found) - { - if (height) - *height = result.getPoint ().y; - - if (normal) - *normal = result.getNormal (); - - return true; - } - - return false; -} -#endif //------------------------------------------------------------------- #define ALLOW_BACKFACING_COLLISION 0 diff --git a/engine/shared/library/sharedTerrain/src/shared/generator/CoordinateHash.cpp b/engine/shared/library/sharedTerrain/src/shared/generator/CoordinateHash.cpp index efd2f614..e6d8c6f5 100755 --- a/engine/shared/library/sharedTerrain/src/shared/generator/CoordinateHash.cpp +++ b/engine/shared/library/sharedTerrain/src/shared/generator/CoordinateHash.cpp @@ -209,25 +209,4 @@ float CoordinateHash::makeFloat(unsigned long hash) return returnValue; } -#if 0 -long CoordinateHash::hashTuple(float x, float z) -{ - const unsigned long ix = (*(unsigned long *)&x)^0x5a5a5a5a; - const unsigned long iz = (*(unsigned long *)&z)^0xa5a5a5a5; - const unsigned long hx = _hash1((ix>>8) | (ix<<24)); - const unsigned long hz = _hash1((iz>>16) | (iz<<16)); - const unsigned long hmix1 = hx^hz; - const unsigned long h = hmix1; - - /* - FastRandomGenerator rngx(hx); - FastRandomGenerator rngz(hz); - const long rnx = rngx.random(); - const long rnz = rngz.random(); - return rnx^rnz; - */ - - return h; -} -#endif //=================================================================== diff --git a/engine/shared/library/sharedThread/src/linux/Thread.cpp b/engine/shared/library/sharedThread/src/linux/Thread.cpp index 90de4e55..2db4ec46 100755 --- a/engine/shared/library/sharedThread/src/linux/Thread.cpp +++ b/engine/shared/library/sharedThread/src/linux/Thread.cpp @@ -142,18 +142,3 @@ void Thread::setPriority(ePriority priority) pthread_setschedparam(thread, policies[priority], &p); } -// Make sure the header-only files compile :) - -#if 0 - -#include "sharedSynchronization/CountingSemaphore.h" -#include "sharedSynchronization/BlockingPointer.h" -#include "sharedSynchronization/BlockingQueue.h" -#include "sharedSynchronization/WriteOnce.h" - -Mutex t; -BlockingQueue bqint(t, 0, 0); -BlockingPointer bpint(t, 0, 0); -WriteOnce woint; - -#endif diff --git a/engine/shared/library/sharedThread/src/shared/RunThread.cpp b/engine/shared/library/sharedThread/src/shared/RunThread.cpp index 3f5e0962..3b4f985d 100755 --- a/engine/shared/library/sharedThread/src/shared/RunThread.cpp +++ b/engine/shared/library/sharedThread/src/shared/RunThread.cpp @@ -19,26 +19,3 @@ FuncPtrThreadZero::Handle runNamedThread(const std::string &name, void (* func)( { return TypedThreadHandle (new FuncPtrThreadZero(name, func)); } - -#if 0 -// Testing stuff - -class testclass -{ -public: - void zeroArg() {} - void oneArg(testclass *) {} - void twoArg(testclass *, int) {} -}; - -testclass m; - -typedef MemberFunctionThreadZero::Handle AsyncTestMemberFunctionZero; -AsyncTestMemberFunctionZero temp = runThread(m, testclass::zeroArg); - -typedef MemberFunctionThreadOne::Handle AsyncTestMemberFunctionOne; -AsyncTestMemberFunctionOne temp2 = runThread(m, testclass::oneArg, &m); - -typedef MemberFunctionThreadTwo::Handle AsyncTestMemberFunctionTwo; -AsyncTestMemberFunctionTwo temp3 = runThread(m, testclass::twoArg, &m, 4); -#endif diff --git a/engine/shared/library/sharedUtility/src/shared/FileName.cpp b/engine/shared/library/sharedUtility/src/shared/FileName.cpp index 1e8936f4..82d68367 100755 --- a/engine/shared/library/sharedUtility/src/shared/FileName.cpp +++ b/engine/shared/library/sharedUtility/src/shared/FileName.cpp @@ -278,12 +278,3 @@ void FileName::stripSpecificPathAndExt (Path path, char* nameBuffer, int nameBuf } //------------------------------------------------------------------- - -#if 0 - - DEBUG_REPORT_LOG_PRINT (true, ("%s\n", FileName (FileName::P_none, "test"))); - DEBUG_REPORT_LOG_PRINT (true, ("%s\n", FileName (FileName::P_none, "test", "iff"))); - DEBUG_REPORT_LOG_PRINT (true, ("%s\n", FileName (FileName::P_sound, "test"))); - DEBUG_REPORT_LOG_PRINT (true, ("%s\n", FileName (FileName::P_sound, "test", "iff"))); - -#endif diff --git a/external/3rd/library/soePlatform/VChatAPI/projects/VChat/VChatAPI/CMakeLists.txt b/external/3rd/library/soePlatform/VChatAPI/projects/VChat/VChatAPI/CMakeLists.txt index 2887003c..7393c1e4 100644 --- a/external/3rd/library/soePlatform/VChatAPI/projects/VChat/VChatAPI/CMakeLists.txt +++ b/external/3rd/library/soePlatform/VChatAPI/projects/VChat/VChatAPI/CMakeLists.txt @@ -87,14 +87,10 @@ add_library(VChatAPI ../../../utils2.0/utils/TcpLibrary/TcpConnection.cpp ../../../utils2.0/utils/TcpLibrary/TcpConnection.h ../../../utils2.0/utils/TcpLibrary/TcpHandlers.h - ../../../utils2.0/utils/TcpLibrary/TcpListener.cpp - ../../../utils2.0/utils/TcpLibrary/TcpListener.h ../../../utils2.0/utils/TcpLibrary/TcpManager.cpp ../../../utils2.0/utils/TcpLibrary/TcpManager.h ../../../utils2.0/utils/UdpLibrary/UdpHandler.hpp ../../../utils2.0/utils/UdpLibrary/UdpLibrary.cpp ../../../utils2.0/utils/UdpLibrary/UdpLibrary.hpp - ../../../utils2.0/utils/UdpLibrary/UdpListener.cpp - ../../../utils2.0/utils/UdpLibrary/UdpListener.h ) diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/types.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/types.h index b0f24d83..ba396c51 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/types.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/types.h @@ -9,23 +9,8 @@ #include #endif -#if 0 -# pragma warning (disable: 4251) - -# ifndef DECLSPEC -# if defined (IMPORT_DLL) -# define DECLSPEC __declspec(dllimport) -# elif defined (EXPORT_DLL) -# define DECLSPEC __declspec(dllexport) -# else -# define DECLSPEC -# endif -# endif -# define DECLIMPORT __declspec(dllimport) -#else -# define DECLSPEC -# define DECLIMPORT extern -#endif +#define DECLSPEC +#define DECLIMPORT extern #ifdef WIN32 # define FILENAME (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__) diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpListener.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpListener.cpp deleted file mode 100755 index 8ae72bac..00000000 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpListener.cpp +++ /dev/null @@ -1,435 +0,0 @@ - -//This code is not used by anything intentionally -//The Connection class was getting mistakenly linked in -//instead of the SWG Connection class that is used for -//all of our connections. Removing the whole thing -//to prevent the issue from coming up again. -#if 0 - -#ifdef WIN32 -#pragma warning (disable: 4786) -#endif - -#include -#include "TcpConnection.h" -#include "TcpListener.h" - -#ifdef WIN32 -#define snprintf _snprintf -#endif - -#ifdef EXTERNAL_DISTRO -namespace NAMESPACE -{ -#endif - -//////////////////////////////////////////////////////////////////////////////// - -Listener::QueueNode::QueueNode() : - connection(0), - request(0) -{ -} - -Listener::QueueNode::QueueNode(Connection * con, RequestBase * req) : - connection(con), - request(req) -{ -} - -Listener::Listener() : - mParams(), - mTcpManager(0), - mConnections(), - mConnectionCount(0), - mClosedConnections(), - mQueuedRequests(), - mActiveRequests(), - mActiveCount(0), - mActiveMax(0), - mAcceptingNewConnections(true) -{ - //printf("ctor 0x%x Listener\n",this); -} - -Listener::~Listener() -{ - std::set::iterator iterator; - for (iterator = mConnections.begin(); iterator != mConnections.end(); iterator++) - { - Connection * connection = *iterator; - delete connection; - } - mConnections.clear(); - - if (mTcpManager != 0) - { - mTcpManager->Release(); - mTcpManager = 0; - } - - //printf("dtor 0x%x Listener\n",this); -} - -void Listener::RequestSleep(RequestBase * request) -{ - mSleepingRequests.insert(request); -} - -void Listener::RequestWake(RequestBase * request) -{ - if (mSleepingRequests.erase(request)) - { - QueueNode node(request->mConnection, request); - mActiveRequests.push_front(node); - } -} - -void Listener::OnConnectRequest(TcpConnection * connection) -{ - if (IsAcceptingNewConnections()) - { - Connection * connectionObject = new Connection(*this, connection); - - mConnections.insert(connectionObject); - mConnectionCount++; - - OnConnectionOpened(connectionObject); - } -} - -void Listener::QueueRequest(Connection * connection, RequestBase * request) -{ - if (connection) - { - // normal request, internal requests have no connection - connection->NotifyQueuedRequest(request); - } - mQueuedRequests.push_back(QueueNode(connection,request)); -} - -bool Listener::IsIdle() const -{ - return (!IsActive() && !mTcpManager && mQueuedRequests.empty() && !mActiveCount); -} - -bool Listener::IsAcceptingNewConnections() const -{ - return (IsActive() && mAcceptingNewConnections); -} - -unsigned Listener::Process() -{ - //Profile profile("Listener::Process"); - //////////////////////////////////////// - // handle inactive state (with UdpManager) - if (!IsActive() && mTcpManager) - { - // check all connections to see if they are idle - std::set::iterator iterator; - for (iterator = mConnections.begin(); iterator != mConnections.end(); iterator++) - { - Connection * connection = *iterator; - if (connection->IsConnected()) - connection->Disconnect(); - } - // close the UdpManager if all the connections are closed - if (!mConnectionCount) - { - mTcpManager->Release(); - mTcpManager = 0; - OnShutdown(); - } - } - //////////////////////////////////////// - // handle active state (without UdpManager) - else if (IsActive() && !mTcpManager) - { - mParams = GetConnectionParams(); - mActiveMax = GetActiveRequestMax(); - mTcpManager = new TcpManager(mParams); - mTcpManager->SetHandler(this); - if (mTcpManager->BindAsServer()){ - OnStartup(); - }else{ - OnFailedStartup(); - return 0; - } - } - - //////////////////////////////////////// - // process the TcpManager - if (mTcpManager) - { - //Profile subProfile("TcpManager::GiveTime()"); - mTcpManager->GiveTime(); - } - - // check all closed connections to see if they are idle - std::list::iterator closedIterator = mClosedConnections.begin(); - while (closedIterator != mClosedConnections.end()) - { - //Profile profile("Listener::Process (cleanup connection)"); - std::list::iterator current = closedIterator++; - Connection * connection = *current; - if (!connection->GetActiveRequests() && - !connection->GetQueuedRequests()) - { - mClosedConnections.erase(current); - mConnections.erase(connection); - mConnectionCount--; - OnConnectionDestroyed(connection); - delete connection; - } - } - - //////////////////////////////////////// - // process request queue - while (!mQueuedRequests.empty() && (!mActiveMax || mActiveCount < mActiveMax)) - { - //Profile profile("Listener::Process (activate queued request)"); - QueueNode & node = mQueuedRequests.front(); - if (!IsActive()) - { - // If not active, discard queued request - if (node.connection) - { - // normal request, internal requests have no connection - node.connection->NotifyDiscardRequest(node.request); - } - DestroyRequest(node.request); - } - else - { - // Move request to active list - if (node.connection) - { - // normal request, internal requests have no connection - node.connection->NotifyBeginRequest(node.request); - } - mActiveRequests.push_back(node); - mActiveCount++; - } - mQueuedRequests.pop_front(); - } - - //////////////////////////////////////// - // Process active requests - unsigned requestsProcessed = 0; - std::list::iterator iterator = mActiveRequests.begin(); - while (iterator != mActiveRequests.end()) - { - //Profile profile("Listener::Process (process request)"); - std::list::iterator current = iterator++; - RequestBase * request = current->request; - Connection * connection = current->connection; - - if (request->Process()) - { - if (connection) - { - // normal request, internal requests have no connection - connection->NotifyEndRequest(request); - } - DestroyRequest(request); - mActiveRequests.erase(current); - mActiveCount--; - } - else if (mSleepingRequests.find(request) != mSleepingRequests.end()) - { - mActiveRequests.erase(current); - } - requestsProcessed++; - } - return requestsProcessed; -} - -/* -void Listener::GetStats(UdpManagerStatistics & statsStruct) -{ - if (mTcpManager) - mTcpManager->GetStats(&statsStruct); -} - -void Listener::ResetStats() -{ - if (mTcpManager) - mTcpManager->ResetStats(); -} -*/ - -void Listener::OnStartup() -{ -} - -void Listener::OnShutdown() -{ -} - -void Listener::OnFailedStartup() -{ -} - -void Listener::OnConnectionOpened(Connection * connection) -{ -} - -void Listener::OnConnectionClosed(Connection * connection, const char * reason) -{ -} - -void Listener::OnConnectionDestroyed(Connection * connection) -{ -} - -void Listener::OnCrcReject(Connection *connection, const unsigned char * buffer, unsigned size) -{ -} - -/* -void Listener::OnPacketCorrupt(Connection *con, const unsigned char *data, int dataLen, UdpCorruptionReason reason) -{ -} -*/ - -//////////////////////////////////////////////////////////////////////////////// - - -Connection::Connection(Listener & listener, TcpConnection * connection) : - mListener(listener), - mConnection(connection), - mHost(), - mHostIp(0), - mDisconnectReason(0), - mQueuedRequests(0), - mActiveRequests(0) -{ - mConnection->AddRef(); - mConnection->SetHandler(this); - - char buffer[256]; - char addr[32]; - mHostIp = mConnection->GetDestinationIp().GetAddress(); - mConnection->GetDestinationIp().GetAddress(addr); - snprintf(buffer, sizeof(buffer), "%s:%u", addr, mConnection->GetDestinationPort()); - mHost = buffer; - - //printf("ctor 0x%x connection\n",this); -} - -Connection::~Connection() -{ - Disconnect(); - - //printf("dtor 0x%x connection\n",this); -} - -unsigned Connection::Send(const unsigned char * data, unsigned dataLen) -{ - if (mConnection) - { - mConnection->Send((const char*)data, dataLen); - return dataLen; - } - return 0; -} - -void Connection::Disconnect() -{ - if (mConnection) - OnTerminated(mConnection); -} - -bool Connection::IsConnected() const -{ - return mConnection != 0; -} - -const std::string & Connection::GetHost() const -{ - return mHost; -} - -const unsigned Connection::GetHostIP() const -{ - return mHostIp; -} - -unsigned Connection::GetQueuedRequests() const -{ - return mQueuedRequests; -} - -unsigned Connection::GetActiveRequests() const -{ - return mActiveRequests; -} - -void Connection::OnTerminated(TcpConnection *con) -{ - mConnection->SetHandler(0); - mConnection->Disconnect(); - //TcpConnection::DisconnectReason disconnectReason = mConnection->GetDisconnectReason(); - mConnection->Release(); - mConnection = 0; - mListener.mClosedConnections.push_back(this); - mListener.OnConnectionClosed(this, "Test"/*TcpConnection::DisconnectReasonText(disconnectReason)*/); -} - -void Connection::OnRoutePacket(TcpConnection *, const unsigned char * data, int dataLen) -{ - mListener.OnReceive(this, data, dataLen); -} - -void Connection::OnCrcReject(TcpConnection *, const unsigned char * data, int dataLen) -{ - mListener.OnCrcReject(this, data, dataLen); -} - -/* -void Connection::OnPacketCorrupt(TcpConnection *, const uchar *data, int dataLen, UdpCorruptionReason reason) -{ - mListener.OnPacketCorrupt(this, data, dataLen, reason); -} -*/ - -void Connection::NotifyQueuedRequest(RequestBase * request) -{ - mQueuedRequests++; -} - -void Connection::NotifyDiscardRequest(RequestBase * request) -{ - mQueuedRequests--; -} - -void Connection::NotifyBeginRequest(RequestBase * request) -{ - mQueuedRequests--; - mActiveRequests++; -} - -void Connection::NotifyEndRequest(RequestBase * request) -{ - mActiveRequests--; -} - - -//////////////////////////////////////////////////////////////////////////////// - - -RequestBase::RequestBase(Connection * connection, bool isInternal) : - mConnection(connection), - mProcessState(0), - mIsInternal(isInternal) -{ -} - -RequestBase::~RequestBase() -{ -} -#ifdef EXTERNAL_DISTRO -} -#endif - -#endif diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpListener.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpListener.h deleted file mode 100755 index 4b6a680d..00000000 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpListener.h +++ /dev/null @@ -1,160 +0,0 @@ - -//This code is not used by anything intentionally -//The Connection class was getting mistakenly linked in -//instead of the SWG Connection class that is used for -//all of our connections. Removing the whole thing -//to prevent the issue from coming up again. -#if 0 - - -#ifndef TCP_LISTENER_H -#define TCP_LISTENER_H - -#include -#include -#include - -#include "TcpManager.h" - - -#ifdef EXTERNAL_DISTRO -namespace NAMESPACE -{ -#endif - -//////////////////////////////////////////////////////////////////////////////// - - class RequestBase; - class Connection; - class Listener : public TcpManagerHandler - { - friend class Connection; - struct QueueNode - { - QueueNode(); - QueueNode(Connection * connection, RequestBase * request); - bool operator<(const QueueNode & rhs) { return request < rhs.request; } - - Connection * connection; - RequestBase * request; - }; - - public: - Listener(); - virtual ~Listener(); - - void QueueRequest(Connection * connection, RequestBase * request); - bool IsIdle() const; - bool IsAcceptingNewConnections() const; - unsigned Process(); - void SetAcceptingNewConnections(bool value) { mAcceptingNewConnections = value; } - //void GetStats(TcpManagerStatistics & statsStruct); - //void ResetStats(); - - unsigned GetNumberQueuedRequests() { return (unsigned)mQueuedRequests.size(); } - - void RequestSleep(RequestBase * request); - void RequestWake(RequestBase * request); - - virtual bool IsActive() const = 0; - virtual unsigned GetActiveRequestMax() = 0; - virtual TcpManager::TcpParams GetConnectionParams() = 0; - - virtual void OnStartup(); - virtual void OnShutdown(); - virtual void OnFailedStartup(); - virtual void OnConnectionOpened(Connection * connection); - virtual void OnConnectionClosed(Connection * connection, const char * reason); - virtual void OnConnectionDestroyed(Connection * connection); - virtual void OnReceive(Connection * connection, const unsigned char * data, unsigned dataLen) = 0; - virtual void OnCrcReject(Connection *connection, const unsigned char * data, unsigned dataLen); - //virtual void OnPacketCorrupt(Connection *con, const unsigned char *data, int dataLen, TcpCorruptionReason reason); - virtual void DestroyRequest(RequestBase * request) = 0; - - virtual void OnConnectRequest(TcpConnection *con); - - protected: - TcpManager::TcpParams mParams; - TcpManager * mTcpManager; - - std::set mConnections; - unsigned mConnectionCount; - std::list mClosedConnections; - - std::list mQueuedRequests; - std::list mActiveRequests; - std::set mSleepingRequests; - unsigned mActiveCount; - unsigned mActiveMax; - bool mAcceptingNewConnections; - }; - -//////////////////////////////////////////////////////////////////////////////// - - class Connection : public TcpConnectionHandler - { - friend class Listener; - public: - Connection(Listener & listener, TcpConnection * connection); - virtual ~Connection(); - - unsigned Send(const unsigned char * data, unsigned dataLen); - void Disconnect(); - bool IsConnected() const; - - const std::string & GetHost() const; - const unsigned GetHostIP() const; - unsigned GetQueuedRequests() const; - unsigned GetActiveRequests() const; - - virtual void OnTerminated(TcpConnection *con); - virtual void OnConnectRequest(TcpConnection *con) {}; - virtual void OnRoutePacket(TcpConnection *con, const unsigned char *data, int dataLen); - virtual void OnCrcReject(TcpConnection *con, const unsigned char *data, int dataLen); - //virtual void OnPacketCorrupt(TcpConnection *con, const unsigned char *data, int dataLen, TcpCorruptionReason reason); - - protected: - void NotifyQueuedRequest(RequestBase * request); - void NotifyDiscardRequest(RequestBase * request); - void NotifyBeginRequest(RequestBase * request); - void NotifyEndRequest(RequestBase * request); - - protected: - Listener & mListener; - TcpConnection * mConnection; - std::string mHost; - unsigned mHostIp; - const char * mDisconnectReason; - unsigned mQueuedRequests; - unsigned mActiveRequests; - }; - -//////////////////////////////////////////////////////////////////////////////// - - class RequestBase - { - friend class Listener; - public: - RequestBase(Connection * connection, bool isInternal=false); - virtual ~RequestBase(); - - virtual bool Process() = 0; - - Connection * GetConnection() const { return mConnection; } - unsigned GetState() const { return mProcessState; } - - protected: - Connection * mConnection; - unsigned mProcessState; - bool mIsInternal; - }; - -//////////////////////////////////////////////////////////////////////////////// - -#ifdef EXTERNAL_DISTRO -} -#endif - -#endif - -#endif diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpListener.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpListener.cpp deleted file mode 100755 index 5b52d6b6..00000000 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpListener.cpp +++ /dev/null @@ -1,394 +0,0 @@ -//This code is not used by anything intentionally -//The Connection class was getting mistakenly linked in -//instead of the SWG Connection class that is used for -//all of our connections. Removing the whole thing -//to prevent the issue from coming up again. -#if 0 - -#ifdef WIN32 -#pragma warning (disable: 4786) -#endif - -#include "Base/timer.h" -#include "UdpListener.h" -#include "Base/profile.h" - - -#ifdef WIN32 -#define snprintf _snprintf -#endif - - -namespace UdpLibrary -{ - //////////////////////////////////////////////////////////////////////////////// - - - Listener::QueueNode::QueueNode() : - connection(0), - request(0) - { - } - - Listener::QueueNode::QueueNode(Connection * con, RequestBase * req) : - connection(con), - request(req) - { - } - - Listener::Listener() : - mParams(), - mUdpManager(0), - mConnections(), - mConnectionCount(0), - mClosedConnections(), - mQueuedRequests(), - mActiveRequests(), - mActiveCount(0), - mActiveMax(0) - { - //printf("ctor 0x%x Listener\n",this); - } - - Listener::~Listener() - { - std::set::iterator iterator; - for (iterator = mConnections.begin(); iterator != mConnections.end(); iterator++) - { - Connection * connection = *iterator; - delete connection; - } - mConnections.clear(); - - if (mUdpManager != 0) - { - mUdpManager->Release(); - mUdpManager = 0; - } - - //printf("dtor 0x%x Listener\n",this); - } - - void Listener::RequestSleep(RequestBase * request) - { - mSleepingRequests.insert(request); - } - - void Listener::RequestWake(RequestBase * request) - { - if (mSleepingRequests.erase(request)) - { - QueueNode node(request->mConnection, request); - mActiveRequests.push_front(node); - } - } - - void Listener::OnConnectRequest(UdpConnection * connection) - { - if (IsActive()) - { - Connection * connectionObject = new Connection(*this, connection); - - mConnections.insert(connectionObject); - mConnectionCount++; - - OnConnectionOpened(connectionObject); - } - } - - void Listener::QueueRequest(Connection * connection, RequestBase * request) - { - connection->NotifyQueuedRequest(request); - mQueuedRequests.push_back(QueueNode(connection,request)); - } - - bool Listener::IsIdle() const - { - return (!IsActive() && !mUdpManager && mQueuedRequests.empty() && !mActiveCount); - } - - unsigned Listener::Process() - { - Profile profile("Listener::Process"); - //////////////////////////////////////// - // handle inactive state (with UdpManager) - if (!IsActive() && mUdpManager) - { - // check all connections to see if they are idle - std::set::iterator iterator; - for (iterator = mConnections.begin(); iterator != mConnections.end(); iterator++) - { - Connection * connection = *iterator; - if (connection->IsConnected()) - connection->Disconnect(); - } - // close the UdpManager if all the connections are closed - if (!mConnectionCount) - { - mUdpManager->Release(); - mUdpManager = 0; - OnShutdown(); - } - } - //////////////////////////////////////// - // handle active state (without UdpManager) - else if (IsActive() && !mUdpManager) - { - mParams = GetConnectionParams(); - mParams.handler = this; - mActiveMax = GetActiveRequestMax(); - mUdpManager = new UdpManager(&mParams); - OnStartup(); - } - - //////////////////////////////////////// - // process the UdpManager - if (mUdpManager) - { - Profile subProfile("UdpManager::GiveTime()"); - mUdpManager->GiveTime(); - } - - // check all closed connections to see if they are idle - std::list::iterator closedIterator = mClosedConnections.begin(); - while (closedIterator != mClosedConnections.end()) - { - Profile profile("Listener::Process (cleanup connection)"); - std::list::iterator current = closedIterator++; - Connection * connection = *current; - if (!connection->GetActiveRequests() && - !connection->GetQueuedRequests()) - { - mClosedConnections.erase(current); - mConnections.erase(connection); - mConnectionCount--; - OnConnectionDestroyed(connection); - delete connection; - } - } - - //////////////////////////////////////// - // process request queue - while (!mQueuedRequests.empty() && (!mActiveMax || mActiveCount < mActiveMax)) - { - Profile profile("Listener::Process (activate queued request)"); - QueueNode & node = mQueuedRequests.front(); - if (!IsActive()) - { - // If not active, discard queued request - node.connection->NotifyDiscardRequest(node.request); - DestroyRequest(node.request); - } - else - { - // Move request to active list - node.connection->NotifyBeginRequest(node.request); - mActiveRequests.push_back(node); - mActiveCount++; - } - mQueuedRequests.pop_front(); - } - - //////////////////////////////////////// - // Process active requests - unsigned requestsProcessed = 0; - std::list::iterator iterator = mActiveRequests.begin(); - while (iterator != mActiveRequests.end()) - { - Profile profile("Listener::Process (process request)"); - std::list::iterator current = iterator++; - RequestBase * request = current->request; - Connection * connection = current->connection; - - if (request->Process()) - { - connection->NotifyEndRequest(request); - DestroyRequest(request); - mActiveRequests.erase(current); - mActiveCount--; - } - else if (mSleepingRequests.find(request) != mSleepingRequests.end()) - { - mActiveRequests.erase(current); - } - requestsProcessed++; - } - return requestsProcessed; - } - - void Listener::GetStats(UdpManagerStatistics & statsStruct) - { - if (mUdpManager) - mUdpManager->GetStats(&statsStruct); - } - - void Listener::ResetStats() - { - if (mUdpManager) - mUdpManager->ResetStats(); - } - - void Listener::OnStartup() - { - } - - void Listener::OnShutdown() - { - } - - void Listener::OnConnectionOpened(Connection * connection) - { - } - - void Listener::OnConnectionClosed(Connection * connection, const char * reason) - { - } - - void Listener::OnConnectionDestroyed(Connection * connection) - { - } - - void Listener::OnCrcReject(Connection *connection, const unsigned char * buffer, unsigned size) - { - } - - void Listener::OnPacketCorrupt(Connection *con, const unsigned char *data, int dataLen, UdpCorruptionReason reason) - { - } - - //////////////////////////////////////////////////////////////////////////////// - - - Connection::Connection(Listener & listener, UdpConnection * connection) : - mListener(listener), - mConnection(connection), - mHost(), - mHostIp(0), - mDisconnectReason(0), - mQueuedRequests(0), - mActiveRequests(0) - { - mConnection->AddRef(); - mConnection->SetHandler(this); - - char buffer[256]; - char addr[32]; - mHostIp = mConnection->GetDestinationIp().GetAddress(); - mConnection->GetDestinationIp().GetAddress(addr); - snprintf(buffer, sizeof(buffer), "%s:%u", addr, mConnection->GetDestinationPort()); - mHost = buffer; - - //printf("ctor 0x%x connection\n",this); - } - - Connection::~Connection() - { - Disconnect(); - - //printf("dtor 0x%x connection\n",this); - } - - unsigned Connection::Send(const unsigned char * data, unsigned dataLen) - { - if (mConnection) - { - mConnection->Send(cUdpChannelReliable1, data, dataLen); - return dataLen; - } - return 0; - } - - void Connection::Disconnect() - { - if (mConnection) - OnTerminated(mConnection); - } - - bool Connection::IsConnected() const - { - return mConnection != 0; - } - - const std::string & Connection::GetHost() const - { - return mHost; - } - - const unsigned Connection::GetHostIP() const - { - return mHostIp; - } - - unsigned Connection::GetQueuedRequests() const - { - return mQueuedRequests; - } - - unsigned Connection::GetActiveRequests() const - { - return mActiveRequests; - } - - void Connection::OnTerminated(UdpConnection *con) - { - mConnection->SetHandler(0); - mConnection->Disconnect(); - UdpConnection::DisconnectReason disconnectReason = mConnection->GetDisconnectReason(); - mConnection->Release(); - mConnection = 0; - mListener.mClosedConnections.push_back(this); - mListener.OnConnectionClosed(this, UdpConnection::DisconnectReasonText(disconnectReason)); - } - - void Connection::OnRoutePacket(UdpConnection *, const unsigned char * data, int dataLen) - { - mListener.OnReceive(this, data, dataLen); - } - - void Connection::OnCrcReject(UdpConnection *, const unsigned char * data, int dataLen) - { - mListener.OnCrcReject(this, data, dataLen); - } - - void Connection::OnPacketCorrupt(UdpConnection *, const uchar *data, int dataLen, UdpCorruptionReason reason) - { - mListener.OnPacketCorrupt(this, data, dataLen, reason); - } - - void Connection::NotifyQueuedRequest(RequestBase * request) - { - mQueuedRequests++; - } - - void Connection::NotifyDiscardRequest(RequestBase * request) - { - mQueuedRequests--; - } - - void Connection::NotifyBeginRequest(RequestBase * request) - { - mQueuedRequests--; - mActiveRequests++; - } - - void Connection::NotifyEndRequest(RequestBase * request) - { - mActiveRequests--; - } - - - //////////////////////////////////////////////////////////////////////////////// - - - RequestBase::RequestBase(Connection * connection) : - mConnection(connection), - mProcessState(0) - { - } - - RequestBase::~RequestBase() - { - } -} - -#endif diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpListener.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpListener.h deleted file mode 100755 index 678b12f0..00000000 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpListener.h +++ /dev/null @@ -1,145 +0,0 @@ -//This code is not used by anything intentionally -//The Connection class was getting mistakenly linked in -//instead of the SWG Connection class that is used for -//all of our connections. Removing the whole thing -//to prevent the issue from coming up again. -#if 0 - -#ifndef COMMON_SERVER__LISTENER_H -#define COMMON_SERVER__LISTENER_H - -#include -#include -#include -#include "UdpLibrary.hpp" - -namespace UdpLibrary -{ - //////////////////////////////////////////////////////////////////////////////// - - class RequestBase; - class Connection; - class Listener : public UdpManagerHandler - { - friend class Connection; - struct QueueNode - { - QueueNode(); - QueueNode(Connection * connection, RequestBase * request); - bool operator<(const QueueNode & rhs) { return request < rhs.request; } - - Connection * connection; - RequestBase * request; - }; - - public: - Listener(); - virtual ~Listener(); - - void QueueRequest(Connection * connection, RequestBase * request); - bool IsIdle() const; - unsigned Process(); - void GetStats(UdpManagerStatistics & statsStruct); - void ResetStats(); - - void RequestSleep(RequestBase * request); - void RequestWake(RequestBase * request); - - virtual bool IsActive() const = 0; - virtual unsigned GetActiveRequestMax() = 0; - virtual UdpManager::Params GetConnectionParams() = 0; - - virtual void OnStartup(); - virtual void OnShutdown(); - virtual void OnConnectionOpened(Connection * connection); - virtual void OnConnectionClosed(Connection * connection, const char * reason); - virtual void OnConnectionDestroyed(Connection * connection); - virtual void OnReceive(Connection * connection, const unsigned char * data, unsigned dataLen) = 0; - virtual void OnCrcReject(Connection *connection, const unsigned char * data, unsigned dataLen); - virtual void OnPacketCorrupt(Connection *con, const unsigned char *data, int dataLen, UdpCorruptionReason reason); - virtual void DestroyRequest(RequestBase * request) = 0; - - virtual void OnConnectRequest(UdpConnection *con); - - protected: - UdpManager::Params mParams; - UdpManager * mUdpManager; - - std::set mConnections; - unsigned mConnectionCount; - std::list mClosedConnections; - - std::list mQueuedRequests; - std::list mActiveRequests; - std::set mSleepingRequests; - unsigned mActiveCount; - unsigned mActiveMax; - }; - - - //////////////////////////////////////////////////////////////////////////////// - - - class Connection : public UdpConnectionHandler - { - friend class Listener; - public: - Connection(Listener & listener, UdpConnection * connection); - virtual ~Connection(); - - unsigned Send(const uchar * data, unsigned dataLen); - void Disconnect(); - bool IsConnected() const; - - const std::string & GetHost() const; - const unsigned GetHostIP() const; - unsigned GetQueuedRequests() const; - unsigned GetActiveRequests() const; - - virtual void OnTerminated(UdpConnection *con); - virtual void OnRoutePacket(UdpConnection *con, const uchar *data, int dataLen); - virtual void OnCrcReject(UdpConnection *con, const uchar *data, int dataLen); - virtual void OnPacketCorrupt(UdpConnection *con, const uchar *data, int dataLen, UdpCorruptionReason reason); - - protected: - void NotifyQueuedRequest(RequestBase * request); - void NotifyDiscardRequest(RequestBase * request); - void NotifyBeginRequest(RequestBase * request); - void NotifyEndRequest(RequestBase * request); - - protected: - Listener & mListener; - UdpConnection * mConnection; - std::string mHost; - unsigned mHostIp; - const char * mDisconnectReason; - unsigned mQueuedRequests; - unsigned mActiveRequests; - }; - - - //////////////////////////////////////////////////////////////////////////////// - - - class RequestBase - { - friend class Listener; - public: - RequestBase(Connection * connection); - virtual ~RequestBase(); - - virtual bool Process() = 0; - - protected: - Connection * mConnection; - unsigned mProcessState; - }; - - - //////////////////////////////////////////////////////////////////////////////// -} - - -#endif - -#endif diff --git a/external/3rd/library/udplibrary/udpclient.cpp b/external/3rd/library/udplibrary/udpclient.cpp index 9ed52d3e..b66ed3a8 100755 --- a/external/3rd/library/udplibrary/udpclient.cpp +++ b/external/3rd/library/udplibrary/udpclient.cpp @@ -72,15 +72,6 @@ int main(int argc, char **argv) params.pooledPacketMax = 50; params.pooledPacketSize = 512; -#if 0 - params.simulateIncomingByteRate = 0; - params.simulateIncomingLossPercent = 10; - params.simulateOutgoingByteRate = 0; - params.simulateOutgoingLossPercent = 10; - params.simulateDestinationOverloadLevel = 0; - params.simulateOutgoingOverloadLevel = 0; -#endif - params.reliable[0].maxInstandingPackets = 500; params.reliable[0].maxOutstandingBytes = 200000; params.reliable[0].maxOutstandingPackets = 500; @@ -156,9 +147,7 @@ int main(int argc, char **argv) break; } - -#if 1 - // randomly send a medium sized packet on a random channel + // randomly send a medium sized packet on a random channel if (rand() % 200 == 0) { char buf[8000]; @@ -176,54 +165,6 @@ int main(int argc, char **argv) myConnection->Send(cUdpChannelReliable1, buf, len); } } -#elif 0 - // send a very large packet one after the other (don't send next packet til the previous one has made it) - if (myConnection->TotalPendingBytes() == 0) - { - // send another packet - SimpleLogicalPacket *lp = new SimpleLogicalPacket(nullptr, 30000000); - int dlen = lp->GetDataLen(); - char *ptr = (char *)lp->GetDataPtr(); - - ptr[0] = (char)(rand() % 50); - for (int i = 1; i < dlen; i++) - { - ptr[i] = (char)(i % 100); - } - - printf("OUT LEN=%d \n", dlen); - myConnection->Send(cUdpChannelReliable1, lp); - lp->Release(); - } -#else - // prepare a random sized group of medium packets and then send the group, don't prepare next group until previous one has made it - UdpConnection::ChannelStatus cs; - myConnection->GetChannelStatus(cUdpChannelReliable1, &cs); - if (cs.queuedBytes == 0) - { - int count = 0; - GroupLogicalPacket *glp = new GroupLogicalPacket(); - int di = rand() % 20 + 1; - for (int i = 0; i < di; i++) - { - GroupLogicalPacket *sub = new GroupLogicalPacket(); - for (int j = 0; j < di; j++) - { - char buf[8000]; - *(ushort *)buf = count; - int len = (rand() % 1000) + 10; - *(ushort *)(buf + len - 2) = count; - sub->AddPacket(buf, len); - count++; - } - glp->AddPacket(sub); - sub->Release(); - } - myConnection->Send(cUdpChannelReliable1, glp); - glp->Release(); - printf("Group of %d packets sent\n", count); - } -#endif myUdpManager->GiveTime(); Sleep(10); diff --git a/external/3rd/library/udplibrary/udpserver.cpp b/external/3rd/library/udplibrary/udpserver.cpp index c8641671..65f844ec 100755 --- a/external/3rd/library/udplibrary/udpserver.cpp +++ b/external/3rd/library/udplibrary/udpserver.cpp @@ -97,14 +97,6 @@ int main(int argc, char **argv) params.pooledPacketMax = 5000; params.pooledPacketSize = 512; -#if 0 - params.simulateIncomingByteRate = 2000; - params.simulateIncomingLossPercent = 0; - params.simulateOutgoingByteRate = 2000; - params.simulateOutgoingLossPercent = 0; - params.simulateDestinationOverloadLevel = 8000; - params.simulateOutgoingOverloadLevel = 8000; -#endif params.reliable[0].maxInstandingPackets = 500; params.reliable[0].maxOutstandingBytes = 200000; params.reliable[0].maxOutstandingPackets = 500; @@ -197,11 +189,6 @@ void Player::OnRoutePacket(UdpConnection * /*con*/, const uchar *data, int dataL char hold[256]; printf("FROM=%s,%d LEN=%d \n", mConnection->GetDestinationIp().GetAddress(hold), mConnection->GetDestinationPort(), dataLen); - -#if 0 - // reflect exact packet back to client - mConnection->Send(cUdpChannelReliable1, data, dataLen); -#endif } diff --git a/game/server/application/SwgDatabaseServer/src/CMakeLists.txt b/game/server/application/SwgDatabaseServer/src/CMakeLists.txt index 4746ea61..b1277e1d 100644 --- a/game/server/application/SwgDatabaseServer/src/CMakeLists.txt +++ b/game/server/application/SwgDatabaseServer/src/CMakeLists.txt @@ -12,7 +12,6 @@ set(SHARED_SOURCES shared/buffers/ExperienceBuffer.h shared/buffers/IndexedNetworkTableBuffer.cpp shared/buffers/IndexedNetworkTableBuffer.h - shared/buffers/IndexedTableBuffer.h shared/buffers/LocationBuffer.cpp shared/buffers/LocationBuffer.h shared/buffers/ManufactureSchematicAttributeBuffer.cpp diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/IndexedTableBuffer.h b/game/server/application/SwgDatabaseServer/src/shared/buffers/IndexedTableBuffer.h deleted file mode 100755 index bf2fc1d6..00000000 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/IndexedTableBuffer.h +++ /dev/null @@ -1,54 +0,0 @@ -#if 0 //@todo code reorg -// ====================================================================== -// -// IndexedNetworkTableBuffer.h -// copyright (c) 2001 Sony Online Entertainment -// -// ====================================================================== - -#ifndef INCLUDED_IndexedNetworkTableBuffer_H -#define INCLUDED_IndexedNetworkTableBuffer_H - -// ====================================================================== - -#include -#include "serverDatabase/TableBuffer.h" - -// ====================================================================== - -/** - * Adds to NetworkTableBuffer the ability to retrieve rows based on an - * integer index. - * @todo Remove "Network" from the name because it no longer has anything to - * do with the network. - * @todo If we have time someday :) Play with the idea of making this be a - * class that's attached to a TableBuffer, much the same way a real DB index - * is attached to a table. The TableBuffer could have a list of pointers - * to indexes, and it would invoke addRow, etc., as needed. - */ - -class IndexedNetworkTableBuffer : public TableBuffer -{ - public: - void addRowToIndex(int indexValue, DB::Row *row); - DB::Row *findRowByIndex(int indexValue); - - protected: - IndexedNetworkTableBuffer(TableBufferMode mode, DB::ModeQuery *query); - - private: - typedef std::unordered_map IndexType; - /** - * Index to locate rows. - * - * Note that the rows are owned by the TableBuffer base class. This - * is just an index to find a specific row quickly. Therefore, this - * class does not create or delete the rows. - */ - IndexType m_index; -}; - -// ====================================================================== - -#endif -#endif From 01cdf52bc07bc4ddba82ed20e2ffbdc8abf7e513 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Thu, 24 Mar 2016 21:19:10 +0000 Subject: [PATCH 057/302] and some more stragglers --- .../ChatServer/src/shared/ChatInterface.h | 81 ------------------- .../src/shared/command/CommandCppFuncs.cpp | 20 ----- .../sharedFoundation/src/shared/CommandLine.h | 10 --- .../src/shared/portal/PortalProperty.cpp | 20 ----- .../src/shared/buffers/ObjectTableBuffer.cpp | 6 +- 5 files changed, 1 insertion(+), 136 deletions(-) diff --git a/engine/server/application/ChatServer/src/shared/ChatInterface.h b/engine/server/application/ChatServer/src/shared/ChatInterface.h index a42a6ecf..31c3bed6 100755 --- a/engine/server/application/ChatServer/src/shared/ChatInterface.h +++ b/engine/server/application/ChatServer/src/shared/ChatInterface.h @@ -166,87 +166,6 @@ private: std::map, int> > trackingRequestGetAnyAvatarForDestroy; }; -#if 0 - -//----------------------------------------------------------------------- - -class ChatInterface : public ChatAPI -{ -public: - ChatInterface (const std::string & strGameCode, - const std::string & strGatewayServerIP, - const unsigned short sGatewayServerPort, - const std::string & strBackupGatewayServerIP, - const unsigned short sBackupGatewayServerPort - ); - - virtual ~ChatInterface (); //lint !e1510 base class 'ChatAPI' has no destructor // jrandall - this is beyond my control - - - void checkRoomExpirations (); - void ConnectPlayer (const unsigned int suid, const std::string & characterName, const NetworkId & networkId); - void deferChatMessageFor (const NetworkId & id, const Archive::ByteStream & bs); - void destroyRoomByName (const std::string & roomName); - - const std::hash_map & getRoomList () const; - const ChatServerAvatarOwner *findAvatar(const ChatAvatarId & avatarId); - - void leaveRoom (const ChatAvatarId & avatarId, const std::string & roomName); - - //--- ChatAPI virtual overrides - virtual void OnConnectAvatar (const std::string & track, const unsigned int resultCode, const ChatAvatar & avatar); - virtual void OnAddFriend (const unsigned int sequence, const std::string & track, const unsigned int nResultCode, const ChatAvatar & requestingAvatar, const ChatAvatar & friendAvatar); - virtual void OnRemoveFriend (const unsigned int sequence, const std::string & track, const unsigned int nResultCode, const ChatAvatar & requestingAvatar, const ChatAvatar & friendAvatar); - virtual void OnAddIgnore (const unsigned int sequence, const std::string & track, const unsigned int nResultCode, const ChatAvatar & requestingAvatar, const ChatAvatar & ignoreAvatar); - virtual void OnRemoveIgnore (const unsigned int sequence, const std::string & track, const unsigned int nResultCode, const ChatAvatar & requestingAvatar, const ChatAvatar & ignoreAvatar); - virtual void OnAddRoomModerator (const unsigned int nSequenceID, const std::string & track, const unsigned int nResultCode, const ChatRoom & room, const unsigned int nRequestingAvatarUID, const ChatAvatar & moderator); - virtual void OnCreateRoom (const unsigned int sequence, const std::string & track, const unsigned int nResultCode, const ChatRoom & room); - virtual void OnDestroyRoom (const unsigned int nSequenceID, const std::string & track, const unsigned int nResultCode, const ChatRoom & room, const std::string & strCharacterName, const std::string & strGameServerName, const std::string & strGameCode); - virtual void OnDisconnectAvatar (const std::string & track, const unsigned int nResultCode, const ChatAvatar & toAvatar); - virtual void OnDisconnectAvatarNotify (const ChatAvatar & toAvatar); - virtual void OnEnterRoom (const unsigned int nSequenceID, const std::string & track, const unsigned int nResultCode, const ChatRoom & room, const ChatAvatar & avatar); - virtual void OnLeaveRoom (const unsigned int nSequenceID, const std::string & track, const unsigned int nResultCode, const ChatRoom & room, const ChatAvatar & avatar); - virtual void OnReceiveInstantMessage (const ChatAvatar & toAvatar, const ChatAvatar & fromAvatar, const Unicode::String & ustrMessage, const Unicode::String & oob); - virtual void OnReceivePersistentMessage (const unsigned int nSequenceID, const std::string & track, const unsigned int nResultCode, const ChatPersistentMessage & message); - virtual void OnReceivePersistentMessageHeader (const ChatPersistentMessageHeader & header); - virtual void OnReceivePersistentMessageHeaders (const unsigned int nSequenceID, const std::string & track, const unsigned int nResultCode, const ChatAvatar & toAvatar, const std::vector & headers); - virtual void OnReceiveRoomMessage (const unsigned int nSequenceID, const ChatRoom & room, const std::string & strFromCharacterName, const std::string & strFromGameServerName, const std::string & strFromGameCode, const Unicode::String & ustrMessage, const Unicode::String & outOfBand, unsigned messageID); - virtual void OnConnect (const unsigned int resultCode); - virtual void OnReceiveRooms (const std::string & track, const unsigned int nResultCode, const std::vector & rooms); - virtual void OnRemoveRoomModerator (const unsigned int nSequenceID, const std::string & track, const unsigned int nResultCode, const ChatRoom & room, const unsigned int nRequestingAvatarUID, const ChatAvatar & moderator); - virtual void OnSendInstantMessage (const unsigned int nSequenceID, const std::string & track, const unsigned int nResultCode, const ChatAvatar & sendingAvatar); - virtual void OnSendPersistentMessage (const unsigned int nSequenceID, const std::string & track, const unsigned int nResultCode, const ChatAvatar& sendingAvatar); - virtual void OnSendRoomMessage (const unsigned int sequence, const std::string & track, const unsigned int resultCode); - virtual void OnUpdateFriendStatus (const ChatAvatar & toAvatar, const ChatAvatar & fromAvatar, const bool bIsConnected); - virtual void OnReceiveRoomInvitation (const std::string & strRoomName, const ChatAvatar & invitorAvatar, const ChatAvatar & inviteeAvatar); - virtual void OnSendRoomInvitation (const unsigned int sequence, const std::string & track, const unsigned int resultCode, const ChatRoom & room, const bool isOnline, const ChatAvatar & invitor, const ChatAvatar & invitee); - - const ChatServerRoomOwner * getRoomByName (const std::string & roomName) const; - - void disconnectPlayer (const ChatAvatarId & avatarId); - void queryRoom (const NetworkId & id, ConnectionServerConnection * connection, const unsigned int sequenceId, const std::string & roomName); - void queryRoom (const NetworkId & id, ConnectionServerConnection * connection, const unsigned int sequenceId, const unsigned int roomId); - void requestRoomList (const NetworkId & id, ConnectionServerConnection * connection); - void sendMessageToAllAvatars (const GameNetworkMessage & message); - bool sendMessageToPendingAvatar(const ChatAvatarId &id, const GameNetworkMessage &message); - -private: - void sendMessageToAvatar (const ChatAvatar & avatar, const GameNetworkMessage & message); - void sendMessageToAvatar (const ChatAvatarId & avatar, const GameNetworkMessage & message); - -private: - ChatInterface & operator = (const ChatInterface & rhs); - ChatInterface(const ChatInterface & source); - std::hash_map pendingAvatars; - std::hash_map, NetworkId::Hash > deferredChatMessages; - std::hash_map roomList; - std::map avatarMap; - time_t lastRoomCheck; - -}; //lint !e1712 default constructor not defined for class - -#endif - std::string toLower(const std::string & source); std::string toUpper(const std::string & source); void makeRoomData(const ChatRoom & room, ChatRoomData & roomData); diff --git a/engine/server/library/serverGame/src/shared/command/CommandCppFuncs.cpp b/engine/server/library/serverGame/src/shared/command/CommandCppFuncs.cpp index f39fcae2..0478a3d6 100755 --- a/engine/server/library/serverGame/src/shared/command/CommandCppFuncs.cpp +++ b/engine/server/library/serverGame/src/shared/command/CommandCppFuncs.cpp @@ -1463,26 +1463,6 @@ static void commandFuncAuctionAccept(Command const &, NetworkId const &actor, Ne static void commandFuncAuctionQuery(Command const &, NetworkId const &actor, NetworkId const &, Unicode::String const ¶ms) { -#if 0 - size_t pos = 0; - NetworkId auctionContainerId(nextOidParm(params, pos)); - int requestId = nextIntParm(params, pos); - int type = nextIntParm(params, pos); - int category = nextIntParm(params, pos); - - CreatureObject *actorCreature = dynamic_cast(NetworkIdManager::getObjectById(actor)); - ServerObject *auctionContainer = dynamic_cast(NetworkIdManager::getObjectById(auctionContainerId)); - - if (actorCreature && auctionContainer) - { - CommoditiesMarket::auctionQuery( - *actorCreature, - requestId, - type, - category, - *auctionContainer); - } -#endif } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedFoundation/src/shared/CommandLine.h b/engine/shared/library/sharedFoundation/src/shared/CommandLine.h index d4eab6a0..04b4d10d 100755 --- a/engine/shared/library/sharedFoundation/src/shared/CommandLine.h +++ b/engine/shared/library/sharedFoundation/src/shared/CommandLine.h @@ -110,16 +110,6 @@ public: int int2; char char1; const char *charp1; - -#if 0 - // if this node's parent is branch head, this variable is ignored. - // if this node's parent is list head, if node is required, at least one instance of this node must be present. - bool nodeRequired; - - // if this node is a list head, this variable is ignored. - // if this node is a branch head, false = 0 or 1 child may be present, true = one child must be present. - bool childrenRequired; -#endif }; enum ArgumentPolicy diff --git a/engine/shared/library/sharedObject/src/shared/portal/PortalProperty.cpp b/engine/shared/library/sharedObject/src/shared/portal/PortalProperty.cpp index 4dce02ea..a24d131b 100755 --- a/engine/shared/library/sharedObject/src/shared/portal/PortalProperty.cpp +++ b/engine/shared/library/sharedObject/src/shared/portal/PortalProperty.cpp @@ -524,26 +524,6 @@ const CellProperty *PortalProperty::getCell(int index) const // ---------------------------------------------------------------------- -#if 0 - -int PortalProperty::getNumberOfLights(int cellIndex) const -{ - DEBUG_FATAL(cellIndex < 0 || cellIndex >= static_cast(m_cellList->size()), ("cell index out of range")); - return (*m_cellDataList)[cellIndex]->getNumberOfLights(); -} - -// ---------------------------------------------------------------------- - -const PortalProperty::LightData &PortalProperty::getLightData(int cellIndex, int lightIndex) const -{ - DEBUG_FATAL(cellIndex < 0 || cellIndex >= static_cast(m_cellList->size()), ("cell index out of range")); - return (*m_cellDataList)[cellIndex]->getLightData(lightIndex); -} - -#endif - -// ---------------------------------------------------------------------- - const PortalProperty::CellNameList &PortalProperty::getCellNames() const { return m_template->getCellNames(); diff --git a/game/server/application/SwgDatabaseServer/src/shared/buffers/ObjectTableBuffer.cpp b/game/server/application/SwgDatabaseServer/src/shared/buffers/ObjectTableBuffer.cpp index d3472915..1abb6304 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/buffers/ObjectTableBuffer.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/buffers/ObjectTableBuffer.cpp @@ -253,11 +253,7 @@ bool ObjectTableBuffer::save(DB::Session *session) ++deletes; - if (getMode()==DB::ModeQuery::mode_INSERT && !i->second->deleted.isNull() && i->second->deleted.getValue()!=0) - { -// DEBUG_REPORT_LOG(true,("Skipped saving deleted object %s\n",i->second->object_id.getValue().getValueString().c_str())); - } - else + if (!(getMode()==DB::ModeQuery::mode_INSERT && !i->second->deleted.isNull() && i->second->deleted.getValue()!=0)) { ++updates; qry.setData(*(i->second)); From cd997925eba1a8918d494323d759cc507f1670f1 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Thu, 24 Mar 2016 21:27:54 +0000 Subject: [PATCH 058/302] cleanup all the "#if 1" macro blocks --- .../shared/controller/ServerController.cpp | 4 +- .../src/shared/object/BuildingObject.cpp | 6 +- .../sharedDebug/src/linux/DebugMonitor.cpp | 2 - .../src/shared/core/PlayerCreationManager.cpp | 2 - .../SharedTangibleObjectTemplate.cpp | 75 ------------------- .../src/shared/generator/AffectorShader.cpp | 15 ---- .../src/shared/generator/FloraGroup.cpp | 4 - .../src/shared/generator/HeightData.cpp | 3 - .../ChatAPI/utils/UdpLibrary/UdpMisc.h | 29 +------ 9 files changed, 5 insertions(+), 135 deletions(-) diff --git a/engine/server/library/serverGame/src/shared/controller/ServerController.cpp b/engine/server/library/serverGame/src/shared/controller/ServerController.cpp index 535341e6..e5022b3e 100755 --- a/engine/server/library/serverGame/src/shared/controller/ServerController.cpp +++ b/engine/server/library/serverGame/src/shared/controller/ServerController.cpp @@ -562,12 +562,12 @@ void ServerController::handleNetUpdateTransformWithParent(const MessageQueueData if(!cellObject) { WARNING_STRICT_FATAL(true, ("WARNING: db or authoritative player says to depersist %s into a cell %s but we cannot because cell does not exist.", getOwner()->getNetworkId().getValueString().c_str(), cellNetworkId.getValueString().c_str())); + //@todo big demo hack. If depersisting into a cell, set the transform to start lcoation -#if 1 Transform start = Transform::identity; start.setPosition_p(ConfigServerGame::getStartingPosition()); setGoal( start, nullptr ); -#endif + return; } setGoal( message.getTransform(), serverCellObject ); diff --git a/engine/server/library/serverGame/src/shared/object/BuildingObject.cpp b/engine/server/library/serverGame/src/shared/object/BuildingObject.cpp index cdc6289f..ab3d5d40 100755 --- a/engine/server/library/serverGame/src/shared/object/BuildingObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/BuildingObject.cpp @@ -611,8 +611,7 @@ bool BuildingObject::isAllowed(CreatureObject const &who) const // allow vendor-creatures to be placed in the building if (who.hasCondition(static_cast(ServerTangibleObjectTemplate::C_vendor))) return true; - // JU_TODO: test -#if 1 + // allow non-player-controlled creatures in private buildings if the *creature* has no owner if (!who.isPlayerControlled() && who.getMasterId() == NetworkId::cms_invalid @@ -621,8 +620,7 @@ bool BuildingObject::isAllowed(CreatureObject const &who) const { return true; } -#endif - // JU_TODO: end test + return CellPermissions::isOnList(m_allowed.get(), who); } } diff --git a/engine/shared/library/sharedDebug/src/linux/DebugMonitor.cpp b/engine/shared/library/sharedDebug/src/linux/DebugMonitor.cpp index 8f4f0682..f1a52dae 100755 --- a/engine/shared/library/sharedDebug/src/linux/DebugMonitor.cpp +++ b/engine/shared/library/sharedDebug/src/linux/DebugMonitor.cpp @@ -115,7 +115,6 @@ void DebugMonitor::install(void) return; } -#if 1 // NOTE: -TRF- I would not expect this chunk of termios setup // code to be necessary. My expectation is that it should // be handled by the curs_inopts (see man page) options I have @@ -152,7 +151,6 @@ void DebugMonitor::install(void) fclose(s_ttyInputFile); return; } -#endif //-- Create a curses screen to represent the DebugMonitor output tty. // NOTE: for now the curses input is hooked up to the application's diff --git a/engine/shared/library/sharedGame/src/shared/core/PlayerCreationManager.cpp b/engine/shared/library/sharedGame/src/shared/core/PlayerCreationManager.cpp index d089cc2c..200a2f9f 100755 --- a/engine/shared/library/sharedGame/src/shared/core/PlayerCreationManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/PlayerCreationManager.cpp @@ -121,7 +121,6 @@ namespace PlayerCreationManagerNamespace for (; iff.enterForm (Tags::PTMP, true); ++ptmp_count) { -#if 1 std::string playerTemplateStr; if (iff.enterChunk (TAG_NAME, true)) { @@ -148,7 +147,6 @@ namespace PlayerCreationManagerNamespace } eq.insert (std::make_pair (playerTemplateStr, v)); -#endif iff.exitForm (true); } diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTangibleObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTangibleObjectTemplate.cpp index 2809b366..2056fc23 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTangibleObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTangibleObjectTemplate.cpp @@ -236,7 +236,6 @@ const StructureFootprint* SharedTangibleObjectTemplate::getStructureFootprint () */ void SharedTangibleObjectTemplate::createCustomizationDataPropertyAsNeeded(Object &object, bool /* forceCreation */) const { -#if 1 //-- Properties cannot be added while an object is in the world. Some callers may be in the world, // so temporarily remove the object from the world if necessary. bool shouldBeInWorld = object.isInWorld(); @@ -266,80 +265,6 @@ void SharedTangibleObjectTemplate::createCustomizationDataPropertyAsNeeded(Objec //-- release local reference to the CustomizationData instance customizationData->release(); } - -#else - // @todo -TRF- remove this code as soon as asset customization manager is working properly. - const size_t paletteColorCount = getPaletteColorCustomizationVariablesCount(); - const size_t rangedIntCount = getRangedIntCustomizationVariablesCount(); - - //-- Return if caller isn't forcing customization data creation and no customization variables are declared for the ObjectTemplate. - const bool makeCustomizationData = forceCreation || (paletteColorCount > 0) || (rangedIntCount > 0); - if (!makeCustomizationData) - return; - - //-- Properties cannot be added while an object is in the world. Some callers may be in the world, - // so temporarily remove the object from the world if necessary. - bool shouldBeInWorld = object.isInWorld(); - if (shouldBeInWorld) - object.removeFromWorld(); - - //-- create the CustomizationDataProperty, add to Object property collection - CustomizationDataProperty *const cdProperty = new CustomizationDataProperty(object); - object.addProperty(*cdProperty); - - //-- Put object back in world if it was originally there. - if (shouldBeInWorld) - object.addToWorld(); - - //-- fetch the CustomizationData instance - CustomizationData *const customizationData = cdProperty->fetchCustomizationData(); - - //-- create PaletteColorCustomizationVariable variables as specified - { - SharedTangibleObjectTemplate::PaletteColorCustomizationVariable variableData; - - for (int i = 0; i < static_cast(paletteColorCount); ++i) - { - //-- get the palette variable data - getPaletteColorCustomizationVariables(variableData, i); - - //-- fetch the palette - const PaletteArgb *const palette = PaletteArgbList::fetch(TemporaryCrcString(variableData.palettePathName.c_str(), true)); - if (!palette) - { - DEBUG_WARNING(true, ("failed to retrieve color palette [%s] for [%s], skipping variable [%s].\n", variableData.palettePathName.c_str(), getName (), variableData.variableName.c_str())); - continue; - } - - //-- create the variable, add to CustomizationData - ::PaletteColorCustomizationVariable * const palColorVar = new ::PaletteColorCustomizationVariable(palette, variableData.defaultPaletteIndex); - - if (variableData.defaultPaletteIndex != palColorVar->getValue ()) - DEBUG_WARNING (true, ("Error loading PaletteColorCustomizationVariable [%s] for [%s]", variableData.variableName.c_str(), getName ())); - - customizationData->addVariableTakeOwnership(variableData.variableName, palColorVar); - - //-- release local palette reference - palette->release(); - } - } - - //-- create BasicRangedIntCustomizationVariable variables as specified - { - SharedTangibleObjectTemplate::RangedIntCustomizationVariable variableData; - - for (int i = 0; i < static_cast(rangedIntCount); ++i) - { - //-- get the palette variable data - getRangedIntCustomizationVariables(variableData, i); - - //-- create the variable, add to CustomizationData - customizationData->addVariableTakeOwnership(variableData.variableName, new ::BasicRangedIntCustomizationVariable(variableData.minValueInclusive, variableData.defaultValue, variableData.maxValueExclusive)); - } - } - //-- release local reference to the CustomizationData instance - customizationData->release(); -#endif } //@BEGIN TFD diff --git a/engine/shared/library/sharedTerrain/src/shared/generator/AffectorShader.cpp b/engine/shared/library/sharedTerrain/src/shared/generator/AffectorShader.cpp index 2c8f2500..8c8ffb3e 100755 --- a/engine/shared/library/sharedTerrain/src/shared/generator/AffectorShader.cpp +++ b/engine/shared/library/sharedTerrain/src/shared/generator/AffectorShader.cpp @@ -100,12 +100,7 @@ void AffectorShaderConstant::affect (const float worldX, const float worldZ, con FastRandomGenerator randomGenerator(CoordinateHash::hashTuple(worldX, worldZ)); -#if 1 if (amount >= featherClamp) -#else - //-- this causes better looking terrain, but more shader blends - if (randomGenerator.randomFloat() <= amount * featherClamp) -#endif { ShaderGroup::Info sgi = m_cachedSgi; sgi.setChildChoice(randomGenerator.randomFloat()); @@ -128,12 +123,7 @@ void AffectorShaderConstant::_legacyAffect (const float /*worldX*/, const float const float featherClamp = m_useFeatherClampOverride ? m_featherClampOverride : m_cachedFeatherClamp; -#if 1 if (amount >= featherClamp) -#else - //-- this causes better looking terrain, but more shader blends - if (generatorChunkData.randomGenerator.randomReal (0.f, 1.f) <= amount * featherClamp) -#endif { ShaderGroup::Info sgi = m_cachedSgi; sgi.setChildChoice (generatorChunkData.m_legacyRandomGenerator->randomReal (0.0f, 1.0f)); @@ -321,12 +311,7 @@ void AffectorShaderReplace::affect (const float /*worldX*/, const float /*worldZ const float featherClamp = m_useFeatherClampOverride ? m_featherClampOverride : m_cachedFeatherClamp; -#if 1 if (amount >= featherClamp) -#else - //-- this causes better looking terrain, but more shader blends - if (generatorChunkData.randomGenerator.randomReal (0.f, 1.f) <= amount * featherClamp) -#endif { m_cachedSgi.setChildChoice (sgi.getChildChoice ()); diff --git a/engine/shared/library/sharedTerrain/src/shared/generator/FloraGroup.cpp b/engine/shared/library/sharedTerrain/src/shared/generator/FloraGroup.cpp index 2f69bb9e..9c9c620e 100755 --- a/engine/shared/library/sharedTerrain/src/shared/generator/FloraGroup.cpp +++ b/engine/shared/library/sharedTerrain/src/shared/generator/FloraGroup.cpp @@ -250,7 +250,6 @@ void FloraGroup::Family::addChild (const FamilyChildData& familyChildData) FamilyChildData child = familyChildData; child.familyId = familyId; -#if 1 //-- fixup fubar'ed names for a version FileName baseName (FileName::P_none, familyChildData.appearanceTemplateName); baseName.stripPathAndExt (); @@ -281,9 +280,6 @@ void FloraGroup::Family::addChild (const FamilyChildData& familyChildData) child.appearanceTemplateName = DuplicateString (familyChildData.appearanceTemplateName); } } -#else - child.appearanceTemplateName = DuplicateString (familyChildData.appearanceTemplateName); -#endif childList.add (child); } diff --git a/engine/shared/library/sharedTerrain/src/shared/generator/HeightData.cpp b/engine/shared/library/sharedTerrain/src/shared/generator/HeightData.cpp index 9075fa4a..169fe49e 100755 --- a/engine/shared/library/sharedTerrain/src/shared/generator/HeightData.cpp +++ b/engine/shared/library/sharedTerrain/src/shared/generator/HeightData.cpp @@ -100,17 +100,14 @@ bool HeightData::Segment::find (const Vector2d& oposition, float& result) const { Vector2d position = oposition; -#if 1 { const float x0 = std::min (m_pointList.begin ()->x, m_pointList.back ().x); const float z0 = std::min (m_pointList.begin ()->z, m_pointList.back ().z); const float x1 = std::max (m_pointList.begin ()->x, m_pointList.back ().x); const float z1 = std::max (m_pointList.begin ()->z, m_pointList.back ().z); -// DEBUG_FATAL (position.x < x0 || position.x > x1 || position.y < z0 || position.y > z1, ("position out of range")); position.x = clamp (x0, position.x, x1); position.y = clamp (z0, position.y, z1); } -#endif const float width = m_pointList.back ().x - m_pointList.begin ()->x; const float height = m_pointList.back ().z - m_pointList.begin ()->z; diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.h b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.h index f77380ca..af72d619 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.h @@ -21,20 +21,6 @@ class UdpMisc // they are stuck into this class so as to avoid conflicts with the application //////////////////////////////////////////////////////////////////////////////////////////// public: - - -#if 1 // DEPRECATED (here for backwards compatibility only. Not used by UdpLibrary, it uses the UdpPlatformDriver version) - // Internally these create a static UdpPlatformDriver and chain the call through. If you have a UdpManager, I recommend - // simply call UdpManager::Clock and UdpManager::ClockElapsed, which chain on through to the driver created by the UdpManager - // values returned by this clock function should not be compared to values return from the UdpManager clock function as - // they go through two different drivers to get the answer and may not return the same number (though in practice it - // likely always will). - typedef UdpClockStamp ClockStamp; - static ClockStamp Clock(); // returns a timestamp (most likely in milliseconds) - static int ClockElapsed(ClockStamp stamp); // returns a elapsed time since stamp in milliseconds (if elapsed is over 23 days, it returns 23 days) -#endif - - static int ClockDiff(UdpClockStamp start, UdpClockStamp stop); // returns a time difference in milliseconds (if difference is over 23 days, it returns 23 days) static unsigned long int Crc32(const void *buffer, int bufferLen, int encryptValue = 0); // calculate a 32-bit crc for a buffer (encrypt value simple scrambles the crc at the beginning so the same packet doesn't produce the same crc on different connections) static int Random(int *seed); // random number generator @@ -95,20 +81,7 @@ class UdpMisc // inline implementations //////////////////////////////////////////////////////////////////////////// - // UdpMisc -#if 1 // DEPRECATED (see declaration) - inline UdpMisc::ClockStamp UdpMisc::Clock() - { - static UdpPlatformDriver sClockDriver; - return(sClockDriver.Clock()); - } - - inline int UdpMisc::ClockElapsed(ClockStamp stamp) - { - return(UdpMisc::ClockDiff(stamp, Clock())); - } -#endif - + // UdpMisc inline int UdpMisc::ClockDiff(UdpClockStamp start, UdpClockStamp stop) { UdpClockStamp t = (stop - start); From 5ed117d9c7cfe05b38209108e4307d3a6dc8c4d8 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Thu, 24 Mar 2016 21:43:51 +0000 Subject: [PATCH 059/302] having these here just leaves unnecessary server crash risks...we'll just ignore these instead of crashing if we get any --- .../src/shared/CentralServer.cpp | 49 +------------------ 1 file changed, 1 insertion(+), 48 deletions(-) diff --git a/engine/server/application/CentralServer/src/shared/CentralServer.cpp b/engine/server/application/CentralServer/src/shared/CentralServer.cpp index 3c1578f9..eea9af1b 100755 --- a/engine/server/application/CentralServer/src/shared/CentralServer.cpp +++ b/engine/server/application/CentralServer/src/shared/CentralServer.cpp @@ -1066,59 +1066,12 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons // Forward this message to the dbProcess sendToGameServer(m_dbProcessServerProcessId, t, true); } - else if(message.isType("ChunkObjectListMessage")) - { - Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); - ChunkObjectListMessage t(ri); - - DEBUG_FATAL(true,("Got ChunkObjectListMessage. Thought it was deprecated.\n")); - // handleChunkList(t.getProcess(), t.getIds()); - } else if(message.isType("LocateStructureMessage")) { Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); LocateStructureMessage t(ri); sendToPlanetServer(t.getSceneId(), t, true); } - else if(message.isType("RequestObjectMessage")) - { - DEBUG_FATAL(true,("Got RequestObjectMessage. Thought this went away.")); - - // Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); - // RequestObjectMessage t(ri); - // // tell the authoritative object to create a proxy - // const GameServerConnection *gameServer = getGameServer(t.getProcess()); - // NOT_NULL(gameServer); - // uint32 authId = sendToAuthoritativeServer(t.getId(), - // LoadObjectMessage(t.getId(), t.getProcess(), gameServer->getGameServiceAddress(), gameServer->getGameServicePort(), false), - // true); - // // if we sent the message to the database process, mark it as being - // // authoritative for this object - // if (authId == m_dbProcessServerProcessId) - // { - // addObjectToMap(t.getId(), authId, gameServer->getSceneId(), true); - // m_pendingLoadingObjects[t.getId()] = t.getProcess(); - // } - } - else if(message.isType("CreateNewObjectMessage")) - { - DEBUG_FATAL(true,("Ain't this supposed to be deprecated or something?")); - } - else if(message.isType("SetObjectPositionMessage")) - { - //@todo remove this message from the library - DEBUG_FATAL(true,("Got SetObjectPositionMessage. Thought this went away")); - } - else if(message.isType("FailedToLoadObjectMessage")) - { - //@todo remove this message from the library - DEBUG_FATAL(true,("Received Failed To Load Object Message. Thought it was depricated\n")); - } - else if(message.isType("ReleaseAuthoritativeMessage")) - { - //@todo remove this message from the library - DEBUG_FATAL(true, ("Received ReleaseAuthoritative for. Thought it was deprecated.")); - } else if(message.isType("ForceUnloadObjectMessage")) { //N.B. This message can come from a game server or from the planet server. @@ -1128,7 +1081,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons ForceUnloadObjectMessage t(ri); //@todo: figure out some way to handle this (such as forwarding to PlanetServers), or remove every case where it's sent - // forceUnload(t.getId(),t.getPermaDelete()); + //forceUnload(t.getId(),t.getPermaDelete()); } //Character Creation Messages else if(message.isType("ConnectionCreateCharacter")) From 8d44908b4bf18725defdaad5ec75ab6d444fc787 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Thu, 24 Mar 2016 21:52:27 +0000 Subject: [PATCH 060/302] this seems to have been test code...we can reenable if something feels missing later --- .../serverGame/src/shared/object/BuildingObject.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/engine/server/library/serverGame/src/shared/object/BuildingObject.cpp b/engine/server/library/serverGame/src/shared/object/BuildingObject.cpp index ab3d5d40..9ba696a0 100755 --- a/engine/server/library/serverGame/src/shared/object/BuildingObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/BuildingObject.cpp @@ -608,19 +608,11 @@ bool BuildingObject::isAllowed(CreatureObject const &who) const // allow non-player-controlled creatures in private buildings with no owner if (!who.isPlayerControlled() && getOwnerId() == NetworkId::cms_invalid) return true; + // allow vendor-creatures to be placed in the building if (who.hasCondition(static_cast(ServerTangibleObjectTemplate::C_vendor))) return true; - // allow non-player-controlled creatures in private buildings if the *creature* has no owner - if (!who.isPlayerControlled() - && who.getMasterId() == NetworkId::cms_invalid - && who.getLevel() < 10 // temp change to < 0 after testing holo item - ) - { - return true; - } - return CellPermissions::isOnList(m_allowed.get(), who); } } From 95961e4a74af4996d4770c5ded9e4ed34af41d63 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Thu, 24 Mar 2016 21:54:12 +0000 Subject: [PATCH 061/302] according to GCC, no it isn't - fixes a warning --- .../src/shared/combat/CombatEngine.cpp | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/game/server/application/SwgGameServer/src/shared/combat/CombatEngine.cpp b/game/server/application/SwgGameServer/src/shared/combat/CombatEngine.cpp index 4f4269cd..2123bc1d 100755 --- a/game/server/application/SwgGameServer/src/shared/combat/CombatEngine.cpp +++ b/game/server/application/SwgGameServer/src/shared/combat/CombatEngine.cpp @@ -679,18 +679,6 @@ void CombatEngine::alter(TangibleObject & object) if (object.isAuthoritative()) { - // if the object is a creature, get it's attributes - Attributes::Value currentAttribs[Attributes::NumberOfAttributes]; - CreatureObject * const critter = object.asCreatureObject (); - if (critter != nullptr) - { - for (int i = 0; i < Attributes::NumberOfAttributes; ++i) - currentAttribs[i] = critter->getAttribute(i); - } - else - { - // @todo: handle damage to objects - } // update the object // to guard against the list changing while we are iterating over it, // we will iterate using index rather than iterator @@ -705,7 +693,7 @@ void CombatEngine::alter(TangibleObject & object) object.applyDamage(damageData[i]); } } - }//lint !e550 Symbol 'currentAttribs' (line 2653) not accessed // yes it is + } else { TangibleController * const tangibleController = object.getController()->asTangibleController(); From 6a8538e2511a0794a5e9d2d2caccdff4f320a580 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sat, 16 Apr 2016 19:58:39 +0000 Subject: [PATCH 062/302] remove superfluous if statement --- .../serverGame/src/shared/object/ServerObject.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/engine/server/library/serverGame/src/shared/object/ServerObject.cpp b/engine/server/library/serverGame/src/shared/object/ServerObject.cpp index c4903557..08367a64 100755 --- a/engine/server/library/serverGame/src/shared/object/ServerObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/ServerObject.cpp @@ -3276,12 +3276,9 @@ void ServerObject::removeTriggerVolume(const std::string & name) void ServerObject::sendControllerMessageToAuthServer(enum GameControllerMessage cm, MessageQueue::Data * msg, float value) { #ifdef _DEBUG - // debug stuff done this way so it is easy to break on - if (!isInitialized() || isInEndBaselines()) - { - WARNING(isInEndBaselines(), ("sendControllerMessageToAuthServer while ending baselines: message id=(%d) from object id=[%s], template=[%s], on server id=[%d]", static_cast(cm), getNetworkId().getValueString().c_str(), getObjectTemplateName(), static_cast(GameServer::getInstance().getProcessId()))); - WARNING(!isInitialized(), ("sendControllerMessageToAuthServer while uninitialized: message id=(%d) from object id=[%s], template=[%s], on server id=[%d]", static_cast(cm), getNetworkId().getValueString().c_str(), getObjectTemplateName(), static_cast(GameServer::getInstance().getProcessId()))); - } + WARNING(isInEndBaselines(), ("sendControllerMessageToAuthServer while ending baselines: message id=(%d) from object id=[%s], template=[%s], on server id=[%d]", static_cast(cm), getNetworkId().getValueString().c_str(), getObjectTemplateName(), static_cast(GameServer::getInstance().getProcessId()))); + + WARNING(!isInitialized(), ("sendControllerMessageToAuthServer while uninitialized: message id=(%d) from object id=[%s], template=[%s], on server id=[%d]", static_cast(cm), getNetworkId().getValueString().c_str(), getObjectTemplateName(), static_cast(GameServer::getInstance().getProcessId()))); #endif Controller * controller = getController(); From 600a78cfe1b22dc0b432011fa93ee53360aa6517 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sat, 16 Apr 2016 23:26:43 +0000 Subject: [PATCH 063/302] add skeleton of auth system based on previous work by parz1val, you need to install libcurl4-gnutls-dev (libcurl4-gnutls-dev:i386 if a 64 bit host) --- CMakeLists.txt | 1 + .../LoginServer/src/CMakeLists.txt | 4 +- .../src/shared/ClientConnection.cpp | 49 ++++++++++++++++++- .../src/shared/ConfigLoginServer.cpp | 1 + .../src/shared/ConfigLoginServer.h | 8 +++ 5 files changed, 61 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cfe0cbfa..44a929d7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,6 +31,7 @@ find_package(PCRE REQUIRED) find_package(Perl REQUIRED) find_package(Threads) find_package(ZLIB REQUIRED) +find_package(CURL REQUIRED) if(WIN32) find_package(Iconv REQUIRED) diff --git a/engine/server/application/LoginServer/src/CMakeLists.txt b/engine/server/application/LoginServer/src/CMakeLists.txt index 94910cb3..ef517f2f 100644 --- a/engine/server/application/LoginServer/src/CMakeLists.txt +++ b/engine/server/application/LoginServer/src/CMakeLists.txt @@ -101,7 +101,7 @@ include_directories( ${SWG_ENGINE_SOURCE_DIR}/server/library/serverKeyShare/include/public ${SWG_ENGINE_SOURCE_DIR}/server/library/serverNetworkMessages/include/public ${SWG_ENGINE_SOURCE_DIR}/server/library/serverUtility/include/public - ${SWG_EXTERNALS_SOURCE_DIR}/ours/library/archive/include + ${SWG_EXTERNALS_SOURCE_DIR}/ours/library/archive/include ${SWG_EXTERNALS_SOURCE_DIR}/ours/library/localization/include ${SWG_EXTERNALS_SOURCE_DIR}/ours/library/localizationArchive/include/public ${SWG_EXTERNALS_SOURCE_DIR}/ours/library/singleton/include @@ -110,6 +110,7 @@ include_directories( ${SWG_EXTERNALS_SOURCE_DIR}/3rd/library/platform/projects ${SWG_EXTERNALS_SOURCE_DIR}/3rd/library/platform/utils ${SWG_EXTERNALS_SOURCE_DIR}/3rd/library/udplibrary + ${CURL_INCLUDE_DIRS} ) add_executable(LoginServer @@ -150,5 +151,6 @@ target_link_libraries(LoginServer CommonAPI LoginAPI MonAPI2 + ${CURL_LIBRARIES} ${CMAKE_DL_LIBS} ) diff --git a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp index 6fe81a51..32ffaa9f 100755 --- a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp @@ -24,6 +24,7 @@ #include "sharedNetworkMessages/LoginEnumCluster.h" #include +#include //----------------------------------------------------------------------- @@ -168,6 +169,14 @@ void ClientConnection::onReceive(const Archive::ByteStream & message) } //----------------------------------------------------------------------- + +static size_t WriteCallback(void *contents, size_t size, size_t nmemb, void *userp) +{ + ((std::string*)userp)->append((char*)contents, size * nmemb); + return size * nmemb; +} + + //----------------------------------------------------------------------- // Stub routine for station API account validation. // Grab a challenge key from the list and send it back to the client. @@ -202,7 +211,45 @@ void ClientConnection::validateClient(const std::string & id, const std::string LOG("LoginClientConnection", ("validateClient() for stationId (%lu) at IP (%s), id (%s) key (%s), skipping validating session", m_stationId, getRemoteAddress().c_str(), id.c_str(), key.c_str())); - LoginServer::getInstance().onValidateClient(suid, id, this, true, nullptr, 0xFFFFFFFF, 0xFFFFFFFF); + if (ConfigLoginServer::getUseExternalAuth() == true) + { + CURL *curl; + std::string readBuffer; + + curl = curl_easy_init(); + if (curl) + { + std::string username(curl_easy_escape(curl, id.c_str(), id.length())); + std::string password(curl_easy_escape(curl, key.c_str(), key.length())); + + curl_easy_setopt(curl, CURLOPT_URL, ("phpauthurl" + username + "&pw=" + password).c_str()); + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback); + curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer); + + curl_easy_cleanup(curl); + curl_global_cleanup(); + + // where possible we'll use http status codes - later this will become json and this nonsense isn't necessary + if (readBuffer == "1") + { + LoginServer::getInstance().onValidateClient(suid, id, this, true, NULL, 0xFFFFFFFF, 0xFFFFFFFF); + } + else if (readBuffer == "2") + { + ErrorMessage err("Login Failed", "You have been banned."); + this->send(err, true); + } + else + { + ErrorMessage err("Login Failed", "Invalid username or password."); + this->send(err, true); + } + } + } + else + { + LoginServer::getInstance().onValidateClient(suid, id, this, true, NULL, 0xFFFFFFFF, 0xFFFFFFFF); + } } } diff --git a/engine/server/application/LoginServer/src/shared/ConfigLoginServer.cpp b/engine/server/application/LoginServer/src/shared/ConfigLoginServer.cpp index 2de2a2fa..8cbaaccc 100755 --- a/engine/server/application/LoginServer/src/shared/ConfigLoginServer.cpp +++ b/engine/server/application/LoginServer/src/shared/ConfigLoginServer.cpp @@ -114,6 +114,7 @@ void ConfigLoginServer::install(void) KEY_INT (populationLightThresholdPercent, 8); KEY_INT (csToolPort, 10666); KEY_BOOL(requireSecureLoginForCsTool, true); + KEY_BOOL(useExternalAuth, false); int index = 0; char const * result = 0; diff --git a/engine/server/application/LoginServer/src/shared/ConfigLoginServer.h b/engine/server/application/LoginServer/src/shared/ConfigLoginServer.h index 7bd94880..3badbf0a 100755 --- a/engine/server/application/LoginServer/src/shared/ConfigLoginServer.h +++ b/engine/server/application/LoginServer/src/shared/ConfigLoginServer.h @@ -65,6 +65,7 @@ class ConfigLoginServer int csToolPort; bool requireSecureLoginForCsTool; + bool useExternalAuth; }; static const uint16 getCentralServicePort(); @@ -126,6 +127,8 @@ class ConfigLoginServer static int getPopulationHeavyThresholdPercent(); static int getPopulationMediumThresholdPercent(); static int getPopulationLightThresholdPercent(); + + static bool getUseExternalAuth(); // has character creation for this cluster been disabled through config option static bool isCharacterCreationDisabled(std::string const & cluster); @@ -467,6 +470,11 @@ inline const int ConfigLoginServer::getCSToolPort() { return data->csToolPort; } + +inline bool ConfigLoginServer::getUseExternalAuth() +{ + return data->useExternalAuth; +} // ====================================================================== #endif // _ConfigLoginServer_H From c7f986bafc0d219763df221759d43def4780f1f0 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sat, 16 Apr 2016 23:58:01 +0000 Subject: [PATCH 064/302] remove redundant call --- .../application/LoginServer/src/shared/ClientConnection.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp index 32ffaa9f..a71c94dc 100755 --- a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp @@ -169,7 +169,7 @@ void ClientConnection::onReceive(const Archive::ByteStream & message) } //----------------------------------------------------------------------- - +// This is used by curl; arguably would be better placed elsewhere? static size_t WriteCallback(void *contents, size_t size, size_t nmemb, void *userp) { ((std::string*)userp)->append((char*)contents, size * nmemb); @@ -227,7 +227,6 @@ void ClientConnection::validateClient(const std::string & id, const std::string curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer); curl_easy_cleanup(curl); - curl_global_cleanup(); // where possible we'll use http status codes - later this will become json and this nonsense isn't necessary if (readBuffer == "1") From 61298b7468a9d59c9480a58e079ad5f2527223b5 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sun, 17 Apr 2016 02:06:13 +0000 Subject: [PATCH 065/302] add "json for modern c++" json.hpp file and implement it; it is in a higher level dir so we can add it elsewhere if need be; up next we want to add an option to have an endpoint GET requested on character creation with the suid and character name --- .../LoginServer/src/CMakeLists.txt | 11 +- .../src/shared/ClientConnection.cpp | 39 +- .../src/shared/ConfigLoginServer.cpp | 1 + .../src/shared/ConfigLoginServer.h | 8 + engine/server/library/CMakeLists.txt | 3 +- engine/server/library/json/json.hpp | 8897 +++++++++++++++++ 6 files changed, 8940 insertions(+), 19 deletions(-) create mode 100644 engine/server/library/json/json.hpp diff --git a/engine/server/application/LoginServer/src/CMakeLists.txt b/engine/server/application/LoginServer/src/CMakeLists.txt index ef517f2f..dc0bb23e 100644 --- a/engine/server/application/LoginServer/src/CMakeLists.txt +++ b/engine/server/application/LoginServer/src/CMakeLists.txt @@ -79,18 +79,19 @@ else() endif() include_directories( - ${CMAKE_CURRENT_SOURCE_DIR}/shared + ${CMAKE_CURRENT_SOURCE_DIR}/shared ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedCommandParser/include/public + ${SWG_ENGINE_SOURCE_DIR}/server/library/json ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedCompression/include/public ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedDatabaseInterface/include/public - ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedDebug/include/public + ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedDebug/include/public ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFile/include/public - ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundation/include/public - ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundationTypes/include/public + ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundation/include/public + ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundationTypes/include/public ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedGame/include/public ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedLog/include/public ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMath/include/public - ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMemoryManager/include/public + ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMemoryManager/include/public ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMessageDispatch/include/public ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetwork/include/public ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetworkMessages/include/public diff --git a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp index a71c94dc..69a1f0c2 100755 --- a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp @@ -25,7 +25,9 @@ #include #include +#include +using json = nlohmann::json; //----------------------------------------------------------------------- ClientConnection::ClientConnection(UdpConnectionMT * u, TcpClient * t) : @@ -211,38 +213,49 @@ void ClientConnection::validateClient(const std::string & id, const std::string LOG("LoginClientConnection", ("validateClient() for stationId (%lu) at IP (%s), id (%s) key (%s), skipping validating session", m_stationId, getRemoteAddress().c_str(), id.c_str(), key.c_str())); - if (ConfigLoginServer::getUseExternalAuth() == true) + std::string authURL = std::string(ConfigLoginServer::getExternalAuthUrl()); + + if (ConfigLoginServer::getUseExternalAuth() == true && !(authURL.empty())) { CURL *curl; + CURLcode res; std::string readBuffer; curl = curl_easy_init(); + if (curl) { std::string username(curl_easy_escape(curl, id.c_str(), id.length())); std::string password(curl_easy_escape(curl, key.c_str(), key.length())); - curl_easy_setopt(curl, CURLOPT_URL, ("phpauthurl" + username + "&pw=" + password).c_str()); + curl_easy_setopt(curl, CURLOPT_URL, (authURL + username + "&pw=" + password).c_str()); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer); + + res = curl_easy_perform(curl); + + if (res == CURLE_OK && !(readBuffer.empty())) + { + json j = json::parse(readBuffer); - curl_easy_cleanup(curl); + if (j["status"] == "success") + { + LoginServer::getInstance().onValidateClient(suid, id, this, true, NULL, 0xFFFFFFFF, 0xFFFFFFFF); + } + else + { + ErrorMessage err("Login Failed", j["userMessage"]); + this->send(err, true); + } - // where possible we'll use http status codes - later this will become json and this nonsense isn't necessary - if (readBuffer == "1") - { - LoginServer::getInstance().onValidateClient(suid, id, this, true, NULL, 0xFFFFFFFF, 0xFFFFFFFF); - } - else if (readBuffer == "2") - { - ErrorMessage err("Login Failed", "You have been banned."); - this->send(err, true); } else { - ErrorMessage err("Login Failed", "Invalid username or password."); + ErrorMessage err("Login Failed", "Error connecting to authentication service."); this->send(err, true); } + + curl_easy_cleanup(curl); } } else diff --git a/engine/server/application/LoginServer/src/shared/ConfigLoginServer.cpp b/engine/server/application/LoginServer/src/shared/ConfigLoginServer.cpp index 8cbaaccc..24367e9f 100755 --- a/engine/server/application/LoginServer/src/shared/ConfigLoginServer.cpp +++ b/engine/server/application/LoginServer/src/shared/ConfigLoginServer.cpp @@ -115,6 +115,7 @@ void ConfigLoginServer::install(void) KEY_INT (csToolPort, 10666); KEY_BOOL(requireSecureLoginForCsTool, true); KEY_BOOL(useExternalAuth, false); + KEY_STRING(externalAuthURL, ""); int index = 0; char const * result = 0; diff --git a/engine/server/application/LoginServer/src/shared/ConfigLoginServer.h b/engine/server/application/LoginServer/src/shared/ConfigLoginServer.h index 3badbf0a..3a84098a 100755 --- a/engine/server/application/LoginServer/src/shared/ConfigLoginServer.h +++ b/engine/server/application/LoginServer/src/shared/ConfigLoginServer.h @@ -66,6 +66,8 @@ class ConfigLoginServer bool requireSecureLoginForCsTool; bool useExternalAuth; + + const char * externalAuthURL; }; static const uint16 getCentralServicePort(); @@ -129,6 +131,7 @@ class ConfigLoginServer static int getPopulationLightThresholdPercent(); static bool getUseExternalAuth(); + static const char * getExternalAuthUrl(); // has character creation for this cluster been disabled through config option static bool isCharacterCreationDisabled(std::string const & cluster); @@ -475,6 +478,11 @@ inline bool ConfigLoginServer::getUseExternalAuth() { return data->useExternalAuth; } + +inline const char * ConfigLoginServer::getExternalAuthUrl() +{ + return data->externalAuthURL; +} // ====================================================================== #endif // _ConfigLoginServer_H diff --git a/engine/server/library/CMakeLists.txt b/engine/server/library/CMakeLists.txt index 84cb7c94..810038ec 100644 --- a/engine/server/library/CMakeLists.txt +++ b/engine/server/library/CMakeLists.txt @@ -1,4 +1,3 @@ - add_subdirectory(serverBase) add_subdirectory(serverDatabase) add_subdirectory(serverGame) @@ -8,3 +7,5 @@ add_subdirectory(serverNetworkMessages) add_subdirectory(serverPathfinding) add_subdirectory(serverScript) add_subdirectory(serverUtility) + +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/json) diff --git a/engine/server/library/json/json.hpp b/engine/server/library/json/json.hpp new file mode 100644 index 00000000..0fdaa281 --- /dev/null +++ b/engine/server/library/json/json.hpp @@ -0,0 +1,8897 @@ +/* + __ _____ _____ _____ + __| | __| | | | JSON for Modern C++ +| | |__ | | | | | | version 2.0.0 +|_____|_____|_____|_|___| https://github.com/nlohmann/json + +Licensed under the MIT License . +Copyright (c) 2013-2016 Niels Lohmann . + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +#ifndef NLOHMANN_JSON_HPP +#define NLOHMANN_JSON_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// disable float-equal warnings on GCC/clang +#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wfloat-equal" +#endif + +/*! +@brief namespace for Niels Lohmann +@see https://github.com/nlohmann +@since version 1.0.0 +*/ +namespace nlohmann +{ + + +/*! +@brief unnamed namespace with internal helper functions +@since version 1.0.0 +*/ +namespace +{ +/*! +@brief Helper to determine whether there's a key_type for T. +@sa http://stackoverflow.com/a/7728728/266378 +*/ +template +struct has_mapped_type +{ + private: + template static char test(typename C::mapped_type*); + template static char (&test(...))[2]; + public: + static constexpr bool value = sizeof(test(0)) == 1; +}; + +/*! +@brief helper class to create locales with decimal point +@sa https://github.com/nlohmann/json/issues/51#issuecomment-86869315 +*/ +class DecimalSeparator : public std::numpunct +{ + protected: + char do_decimal_point() const + { + return '.'; + } +}; + +} + +/*! +@brief a class to store JSON values + +@tparam ObjectType type for JSON objects (`std::map` by default; will be used +in @ref object_t) +@tparam ArrayType type for JSON arrays (`std::vector` by default; will be used +in @ref array_t) +@tparam StringType type for JSON strings and object keys (`std::string` by +default; will be used in @ref string_t) +@tparam BooleanType type for JSON booleans (`bool` by default; will be used +in @ref boolean_t) +@tparam NumberIntegerType type for JSON integer numbers (`int64_t` by +default; will be used in @ref number_integer_t) +@tparam NumberUnsignedType type for JSON unsigned integer numbers (@c +`uint64_t` by default; will be used in @ref number_unsigned_t) +@tparam NumberFloatType type for JSON floating-point numbers (`double` by +default; will be used in @ref number_float_t) +@tparam AllocatorType type of the allocator to use (`std::allocator` by +default) + +@requirement The class satisfies the following concept requirements: +- Basic + - [DefaultConstructible](http://en.cppreference.com/w/cpp/concept/DefaultConstructible): + JSON values can be default constructed. The result will be a JSON null value. + - [MoveConstructible](http://en.cppreference.com/w/cpp/concept/MoveConstructible): + A JSON value can be constructed from an rvalue argument. + - [CopyConstructible](http://en.cppreference.com/w/cpp/concept/CopyConstructible): + A JSON value can be copy-constructed from an lvalue expression. + - [MoveAssignable](http://en.cppreference.com/w/cpp/concept/MoveAssignable): + A JSON value van be assigned from an rvalue argument. + - [CopyAssignable](http://en.cppreference.com/w/cpp/concept/CopyAssignable): + A JSON value can be copy-assigned from an lvalue expression. + - [Destructible](http://en.cppreference.com/w/cpp/concept/Destructible): + JSON values can be destructed. +- Layout + - [StandardLayoutType](http://en.cppreference.com/w/cpp/concept/StandardLayoutType): + JSON values have + [standard layout](http://en.cppreference.com/w/cpp/language/data_members#Standard_layout): + All non-static data members are private and standard layout types, the class + has no virtual functions or (virtual) base classes. +- Library-wide + - [EqualityComparable](http://en.cppreference.com/w/cpp/concept/EqualityComparable): + JSON values can be compared with `==`, see @ref + operator==(const_reference,const_reference). + - [LessThanComparable](http://en.cppreference.com/w/cpp/concept/LessThanComparable): + JSON values can be compared with `<`, see @ref + operator<(const_reference,const_reference). + - [Swappable](http://en.cppreference.com/w/cpp/concept/Swappable): + Any JSON lvalue or rvalue of can be swapped with any lvalue or rvalue of + other compatible types, using unqualified function call @ref swap(). + - [NullablePointer](http://en.cppreference.com/w/cpp/concept/NullablePointer): + JSON values can be compared against `std::nullptr_t` objects which are used + to model the `null` value. +- Container + - [Container](http://en.cppreference.com/w/cpp/concept/Container): + JSON values can be used like STL containers and provide iterator access. + - [ReversibleContainer](http://en.cppreference.com/w/cpp/concept/ReversibleContainer); + JSON values can be used like STL containers and provide reverse iterator + access. + +@internal +@note ObjectType trick from http://stackoverflow.com/a/9860911 +@endinternal + +@see [RFC 7159: The JavaScript Object Notation (JSON) Data Interchange +Format](http://rfc7159.net/rfc7159) + +@since version 1.0.0 + +@nosubgrouping +*/ +template < + template class ObjectType = std::map, + template class ArrayType = std::vector, + class StringType = std::string, + class BooleanType = bool, + class NumberIntegerType = std::int64_t, + class NumberUnsignedType = std::uint64_t, + class NumberFloatType = double, + template class AllocatorType = std::allocator + > +class basic_json +{ + private: + /// workaround type for MSVC + using basic_json_t = basic_json; + + public: + + ///////////////////// + // container types // + ///////////////////// + + /// @name container types + /// @{ + + /// the type of elements in a basic_json container + using value_type = basic_json; + + /// the type of an element reference + using reference = value_type&; + /// the type of an element const reference + using const_reference = const value_type&; + + /// a type to represent differences between iterators + using difference_type = std::ptrdiff_t; + /// a type to represent container sizes + using size_type = std::size_t; + + /// the allocator type + using allocator_type = AllocatorType; + + /// the type of an element pointer + using pointer = typename std::allocator_traits::pointer; + /// the type of an element const pointer + using const_pointer = typename std::allocator_traits::const_pointer; + + // forward declaration + template class json_reverse_iterator; + + /// an iterator for a basic_json container + class iterator; + /// a const iterator for a basic_json container + class const_iterator; + /// a reverse iterator for a basic_json container + using reverse_iterator = json_reverse_iterator; + /// a const reverse iterator for a basic_json container + using const_reverse_iterator = json_reverse_iterator; + + /// @} + + + /*! + @brief returns the allocator associated with the container + */ + static allocator_type get_allocator() + { + return allocator_type(); + } + + + /////////////////////////// + // JSON value data types // + /////////////////////////// + + /// @name JSON value data types + /// @{ + + /*! + @brief a type for an object + + [RFC 7159](http://rfc7159.net/rfc7159) describes JSON objects as follows: + > An object is an unordered collection of zero or more name/value pairs, + > where a name is a string and a value is a string, number, boolean, null, + > object, or array. + + To store objects in C++, a type is defined by the template parameters + described below. + + @tparam ObjectType the container to store objects (e.g., `std::map` or + `std::unordered_map`) + @tparam StringType the type of the keys or names (e.g., `std::string`). The + comparison function `std::less` is used to order elements + inside the container. + @tparam AllocatorType the allocator to use for objects (e.g., + `std::allocator`) + + #### Default type + + With the default values for @a ObjectType (`std::map`), @a StringType + (`std::string`), and @a AllocatorType (`std::allocator`), the default value + for @a object_t is: + + @code {.cpp} + std::map< + std::string, // key_type + basic_json, // value_type + std::less, // key_compare + std::allocator> // allocator_type + > + @endcode + + #### Behavior + + The choice of @a object_t influences the behavior of the JSON class. With + the default type, objects have the following behavior: + + - When all names are unique, objects will be interoperable in the sense + that all software implementations receiving that object will agree on the + name-value mappings. + - When the names within an object are not unique, later stored name/value + pairs overwrite previously stored name/value pairs, leaving the used + names unique. For instance, `{"key": 1}` and `{"key": 2, "key": 1}` will + be treated as equal and both stored as `{"key": 1}`. + - Internally, name/value pairs are stored in lexicographical order of the + names. Objects will also be serialized (see @ref dump) in this order. For + instance, `{"b": 1, "a": 2}` and `{"a": 2, "b": 1}` will be stored and + serialized as `{"a": 2, "b": 1}`. + - When comparing objects, the order of the name/value pairs is irrelevant. + This makes objects interoperable in the sense that they will not be + affected by these differences. For instance, `{"b": 1, "a": 2}` and + `{"a": 2, "b": 1}` will be treated as equal. + + #### Limits + + [RFC 7159](http://rfc7159.net/rfc7159) specifies: + > An implementation may set limits on the maximum depth of nesting. + + In this class, the object's limit of nesting is not constraint explicitly. + However, a maximum depth of nesting may be introduced by the compiler or + runtime environment. A theoretical limit can be queried by calling the @ref + max_size function of a JSON object. + + #### Storage + + Objects are stored as pointers in a @ref basic_json type. That is, for any + access to object values, a pointer of type `object_t*` must be dereferenced. + + @sa @ref array_t -- type for an array value + + @since version 1.0.0 + + @note The order name/value pairs are added to the object is *not* preserved + by the library. Therefore, iterating an object may return name/value pairs + in a different order than they were originally stored. In fact, keys will + be traversed in alphabetical order as `std::map` with `std::less` is used + by default. Please note this behavior conforms to [RFC + 7159](http://rfc7159.net/rfc7159), because any order implements the + specified "unordered" nature of JSON objects. + */ + using object_t = ObjectType, + AllocatorType>>; + + /*! + @brief a type for an array + + [RFC 7159](http://rfc7159.net/rfc7159) describes JSON arrays as follows: + > An array is an ordered sequence of zero or more values. + + To store objects in C++, a type is defined by the template parameters + explained below. + + @tparam ArrayType container type to store arrays (e.g., `std::vector` or + `std::list`) + @tparam AllocatorType allocator to use for arrays (e.g., `std::allocator`) + + #### Default type + + With the default values for @a ArrayType (`std::vector`) and @a + AllocatorType (`std::allocator`), the default value for @a array_t is: + + @code {.cpp} + std::vector< + basic_json, // value_type + std::allocator // allocator_type + > + @endcode + + #### Limits + + [RFC 7159](http://rfc7159.net/rfc7159) specifies: + > An implementation may set limits on the maximum depth of nesting. + + In this class, the array's limit of nesting is not constraint explicitly. + However, a maximum depth of nesting may be introduced by the compiler or + runtime environment. A theoretical limit can be queried by calling the @ref + max_size function of a JSON array. + + #### Storage + + Arrays are stored as pointers in a @ref basic_json type. That is, for any + access to array values, a pointer of type `array_t*` must be dereferenced. + + @sa @ref object_t -- type for an object value + + @since version 1.0.0 + */ + using array_t = ArrayType>; + + /*! + @brief a type for a string + + [RFC 7159](http://rfc7159.net/rfc7159) describes JSON strings as follows: + > A string is a sequence of zero or more Unicode characters. + + To store objects in C++, a type is defined by the template parameter + described below. Unicode values are split by the JSON class into byte-sized + characters during deserialization. + + @tparam StringType the container to store strings (e.g., `std::string`). + Note this container is used for keys/names in objects, see @ref object_t. + + #### Default type + + With the default values for @a StringType (`std::string`), the default + value for @a string_t is: + + @code {.cpp} + std::string + @endcode + + #### String comparison + + [RFC 7159](http://rfc7159.net/rfc7159) states: + > Software implementations are typically required to test names of object + > members for equality. Implementations that transform the textual + > representation into sequences of Unicode code units and then perform the + > comparison numerically, code unit by code unit, are interoperable in the + > sense that implementations will agree in all cases on equality or + > inequality of two strings. For example, implementations that compare + > strings with escaped characters unconverted may incorrectly find that + > `"a\\b"` and `"a\u005Cb"` are not equal. + + This implementation is interoperable as it does compare strings code unit + by code unit. + + #### Storage + + String values are stored as pointers in a @ref basic_json type. That is, + for any access to string values, a pointer of type `string_t*` must be + dereferenced. + + @since version 1.0.0 + */ + using string_t = StringType; + + /*! + @brief a type for a boolean + + [RFC 7159](http://rfc7159.net/rfc7159) implicitly describes a boolean as a + type which differentiates the two literals `true` and `false`. + + To store objects in C++, a type is defined by the template parameter @a + BooleanType which chooses the type to use. + + #### Default type + + With the default values for @a BooleanType (`bool`), the default value for + @a boolean_t is: + + @code {.cpp} + bool + @endcode + + #### Storage + + Boolean values are stored directly inside a @ref basic_json type. + + @since version 1.0.0 + */ + using boolean_t = BooleanType; + + /*! + @brief a type for a number (integer) + + [RFC 7159](http://rfc7159.net/rfc7159) describes numbers as follows: + > The representation of numbers is similar to that used in most programming + > languages. A number is represented in base 10 using decimal digits. It + > contains an integer component that may be prefixed with an optional minus + > sign, which may be followed by a fraction part and/or an exponent part. + > Leading zeros are not allowed. (...) Numeric values that cannot be + > represented in the grammar below (such as Infinity and NaN) are not + > permitted. + + This description includes both integer and floating-point numbers. However, + C++ allows more precise storage if it is known whether the number is a + signed integer, an unsigned integer or a floating-point number. Therefore, + three different types, @ref number_integer_t, @ref number_unsigned_t and + @ref number_float_t are used. + + To store integer numbers in C++, a type is defined by the template + parameter @a NumberIntegerType which chooses the type to use. + + #### Default type + + With the default values for @a NumberIntegerType (`int64_t`), the default + value for @a number_integer_t is: + + @code {.cpp} + int64_t + @endcode + + #### Default behavior + + - The restrictions about leading zeros is not enforced in C++. Instead, + leading zeros in integer literals lead to an interpretation as octal + number. Internally, the value will be stored as decimal number. For + instance, the C++ integer literal `010` will be serialized to `8`. During + deserialization, leading zeros yield an error. + - Not-a-number (NaN) values will be serialized to `null`. + + #### Limits + + [RFC 7159](http://rfc7159.net/rfc7159) specifies: + > An implementation may set limits on the range and precision of numbers. + + When the default type is used, the maximal integer number that can be + stored is `9223372036854775807` (INT64_MAX) and the minimal integer number + that can be stored is `-9223372036854775808` (INT64_MIN). Integer numbers + that are out of range will yield over/underflow when used in a constructor. + During deserialization, too large or small integer numbers will be + automatically be stored as @ref number_unsigned_t or @ref number_float_t. + + [RFC 7159](http://rfc7159.net/rfc7159) further states: + > Note that when such software is used, numbers that are integers and are + > in the range \f$[-2^{53}+1, 2^{53}-1]\f$ are interoperable in the sense + > that implementations will agree exactly on their numeric values. + + As this range is a subrange of the exactly supported range [INT64_MIN, + INT64_MAX], this class's integer type is interoperable. + + #### Storage + + Integer number values are stored directly inside a @ref basic_json type. + + @sa @ref number_float_t -- type for number values (floating-point) + + @sa @ref number_unsigned_t -- type for number values (unsigned integer) + + @since version 1.0.0 + */ + using number_integer_t = NumberIntegerType; + + /*! + @brief a type for a number (unsigned) + + [RFC 7159](http://rfc7159.net/rfc7159) describes numbers as follows: + > The representation of numbers is similar to that used in most programming + > languages. A number is represented in base 10 using decimal digits. It + > contains an integer component that may be prefixed with an optional minus + > sign, which may be followed by a fraction part and/or an exponent part. + > Leading zeros are not allowed. (...) Numeric values that cannot be + > represented in the grammar below (such as Infinity and NaN) are not + > permitted. + + This description includes both integer and floating-point numbers. However, + C++ allows more precise storage if it is known whether the number is a + signed integer, an unsigned integer or a floating-point number. Therefore, + three different types, @ref number_integer_t, @ref number_unsigned_t and + @ref number_float_t are used. + + To store unsigned integer numbers in C++, a type is defined by the template + parameter @a NumberUnsignedType which chooses the type to use. + + #### Default type + + With the default values for @a NumberUnsignedType (`uint64_t`), the default + value for @a number_unsigned_t is: + + @code {.cpp} + uint64_t + @endcode + + #### Default behavior + + - The restrictions about leading zeros is not enforced in C++. Instead, + leading zeros in integer literals lead to an interpretation as octal + number. Internally, the value will be stored as decimal number. For + instance, the C++ integer literal `010` will be serialized to `8`. During + deserialization, leading zeros yield an error. + - Not-a-number (NaN) values will be serialized to `null`. + + #### Limits + + [RFC 7159](http://rfc7159.net/rfc7159) specifies: + > An implementation may set limits on the range and precision of numbers. + + When the default type is used, the maximal integer number that can be + stored is `18446744073709551615` (UINT64_MAX) and the minimal integer + number that can be stored is `0`. Integer numbers that are out of range + will yield over/underflow when used in a constructor. During + deserialization, too large or small integer numbers will be automatically + be stored as @ref number_integer_t or @ref number_float_t. + + [RFC 7159](http://rfc7159.net/rfc7159) further states: + > Note that when such software is used, numbers that are integers and are + > in the range \f$[-2^{53}+1, 2^{53}-1]\f$ are interoperable in the sense + > that implementations will agree exactly on their numeric values. + + As this range is a subrange (when considered in conjunction with the + number_integer_t type) of the exactly supported range [0, UINT64_MAX], this + class's integer type is interoperable. + + #### Storage + + Integer number values are stored directly inside a @ref basic_json type. + + @sa @ref number_float_t -- type for number values (floating-point) + + @sa @ref number_integer_t -- type for number values (integer) + + @since version 2.0.0 + */ + using number_unsigned_t = NumberUnsignedType; + + /*! + @brief a type for a number (floating-point) + + [RFC 7159](http://rfc7159.net/rfc7159) describes numbers as follows: + > The representation of numbers is similar to that used in most programming + > languages. A number is represented in base 10 using decimal digits. It + > contains an integer component that may be prefixed with an optional minus + > sign, which may be followed by a fraction part and/or an exponent part. + > Leading zeros are not allowed. (...) Numeric values that cannot be + > represented in the grammar below (such as Infinity and NaN) are not + > permitted. + + This description includes both integer and floating-point numbers. However, + C++ allows more precise storage if it is known whether the number is a + signed integer, an unsigned integer or a floating-point number. Therefore, + three different types, @ref number_integer_t, @ref number_unsigned_t and + @ref number_float_t are used. + + To store floating-point numbers in C++, a type is defined by the template + parameter @a NumberFloatType which chooses the type to use. + + #### Default type + + With the default values for @a NumberFloatType (`double`), the default + value for @a number_float_t is: + + @code {.cpp} + double + @endcode + + #### Default behavior + + - The restrictions about leading zeros is not enforced in C++. Instead, + leading zeros in floating-point literals will be ignored. Internally, the + value will be stored as decimal number. For instance, the C++ + floating-point literal `01.2` will be serialized to `1.2`. During + deserialization, leading zeros yield an error. + - Not-a-number (NaN) values will be serialized to `null`. + + #### Limits + + [RFC 7159](http://rfc7159.net/rfc7159) states: + > This specification allows implementations to set limits on the range and + > precision of numbers accepted. Since software that implements IEEE + > 754-2008 binary64 (double precision) numbers is generally available and + > widely used, good interoperability can be achieved by implementations that + > expect no more precision or range than these provide, in the sense that + > implementations will approximate JSON numbers within the expected + > precision. + + This implementation does exactly follow this approach, as it uses double + precision floating-point numbers. Note values smaller than + `-1.79769313486232e+308` and values greater than `1.79769313486232e+308` + will be stored as NaN internally and be serialized to `null`. + + #### Storage + + Floating-point number values are stored directly inside a @ref basic_json + type. + + @sa @ref number_integer_t -- type for number values (integer) + + @sa @ref number_unsigned_t -- type for number values (unsigned integer) + + @since version 1.0.0 + */ + using number_float_t = NumberFloatType; + + /// @} + + + /////////////////////////// + // JSON type enumeration // + /////////////////////////// + + /*! + @brief the JSON type enumeration + + This enumeration collects the different JSON types. It is internally used + to distinguish the stored values, and the functions @ref is_null(), @ref + is_object(), @ref is_array(), @ref is_string(), @ref is_boolean(), @ref + is_number(), and @ref is_discarded() rely on it. + + @since version 1.0.0 + */ + enum class value_t : uint8_t + { + null, ///< null value + object, ///< object (unordered set of name/value pairs) + array, ///< array (ordered collection of values) + string, ///< string value + boolean, ///< boolean value + number_integer, ///< number value (integer) + number_unsigned, ///< number value (unsigned integer) + number_float, ///< number value (floating-point) + discarded ///< discarded by the the parser callback function + }; + + + private: + + /*! + @brief a type to hold JSON type information + + This bitfield type holds information about JSON types. It is internally + used to hold the basic JSON type enumeration, as well as additional + information in the case of values that have been parsed from a string + including whether of not it was created directly or parsed, and in the + case of floating point numbers the number of significant figures in the + original representaiton and if it was in exponential form, if a '+' was + included in the exponent and the capitilization of the exponent marker. + The sole purpose of this information is to permit accurate round trips. + + @since version 2.0.0 + */ + union type_data_t + { + struct + { + /// the type of the value (@ref value_t) + uint16_t type : 4; + /// whether the number was parsed from a string + uint16_t parsed : 1; + /// whether parsed number contained an exponent ('e'/'E') + uint16_t has_exp : 1; + /// whether parsed number contained a plus in the exponent + uint16_t exp_plus : 1; + /// whether parsed number's exponent was capitalized ('E') + uint16_t exp_cap : 1; + /// the number of figures for a parsed number + uint16_t precision : 8; + } bits; + uint16_t data; + + /// return the type as value_t + operator value_t() const + { + return static_cast(bits.type); + } + + /// test type for equality (ignore other fields) + bool operator==(const value_t& rhs) const + { + return static_cast(bits.type) == rhs; + } + + /// assignment + type_data_t& operator=(value_t rhs) + { + bits.type = static_cast(rhs); + return *this; + } + + /// construct from value_t + type_data_t(value_t t) noexcept + { + *reinterpret_cast(this) = 0; + bits.type = static_cast(t); + } + + /// default constructor + type_data_t() noexcept + { + data = 0; + bits.type = reinterpret_cast(value_t::null); + } + }; + + /// helper for exception-safe object creation + template + static T* create(Args&& ... args) + { + AllocatorType alloc; + auto deleter = [&](T * object) + { + alloc.deallocate(object, 1); + }; + std::unique_ptr object(alloc.allocate(1), deleter); + alloc.construct(object.get(), std::forward(args)...); + return object.release(); + } + + //////////////////////// + // JSON value storage // + //////////////////////// + + /*! + @brief a JSON value + + The actual storage for a JSON value of the @ref basic_json class. + + @since version 1.0.0 + */ + union json_value + { + /// object (stored with pointer to save storage) + object_t* object; + /// array (stored with pointer to save storage) + array_t* array; + /// string (stored with pointer to save storage) + string_t* string; + /// boolean + boolean_t boolean; + /// number (integer) + number_integer_t number_integer; + /// number (unsigned integer) + number_unsigned_t number_unsigned; + /// number (floating-point) + number_float_t number_float; + + /// default constructor (for null values) + json_value() = default; + /// constructor for booleans + json_value(boolean_t v) noexcept : boolean(v) {} + /// constructor for numbers (integer) + json_value(number_integer_t v) noexcept : number_integer(v) {} + /// constructor for numbers (unsigned) + json_value(number_unsigned_t v) noexcept : number_unsigned(v) {} + /// constructor for numbers (floating-point) + json_value(number_float_t v) noexcept : number_float(v) {} + /// constructor for empty values of a given type + json_value(value_t t) + { + switch (t) + { + case value_t::object: + { + object = create(); + break; + } + + case value_t::array: + { + array = create(); + break; + } + + case value_t::string: + { + string = create(""); + break; + } + + case value_t::boolean: + { + boolean = boolean_t(false); + break; + } + + case value_t::number_integer: + { + number_integer = number_integer_t(0); + break; + } + + case value_t::number_unsigned: + { + number_unsigned = number_unsigned_t(0); + break; + } + + case value_t::number_float: + { + number_float = number_float_t(0.0); + break; + } + + default: + { + break; + } + } + } + + /// constructor for strings + json_value(const string_t& value) + { + string = create(value); + } + + /// constructor for objects + json_value(const object_t& value) + { + object = create(value); + } + + /// constructor for arrays + json_value(const array_t& value) + { + array = create(value); + } + }; + + + public: + ////////////////////////// + // JSON parser callback // + ////////////////////////// + + /*! + @brief JSON callback events + + This enumeration lists the parser events that can trigger calling a + callback function of type @ref parser_callback_t during parsing. + + @since version 1.0.0 + */ + enum class parse_event_t : uint8_t + { + /// the parser read `{` and started to process a JSON object + object_start, + /// the parser read `}` and finished processing a JSON object + object_end, + /// the parser read `[` and started to process a JSON array + array_start, + /// the parser read `]` and finished processing a JSON array + array_end, + /// the parser read a key of a value in an object + key, + /// the parser finished reading a JSON value + value + }; + + /*! + @brief per-element parser callback type + + With a parser callback function, the result of parsing a JSON text can be + influenced. When passed to @ref parse(std::istream&, parser_callback_t) or + @ref parse(const string_t&, parser_callback_t), it is called on certain + events (passed as @ref parse_event_t via parameter @a event) with a set + recursion depth @a depth and context JSON value @a parsed. The return value + of the callback function is a boolean indicating whether the element that + emitted the callback shall be kept or not. + + We distinguish six scenarios (determined by the event type) in which the + callback function can be called. The following table describes the values + of the parameters @a depth, @a event, and @a parsed. + + parameter @a event | description | parameter @a depth | parameter @a parsed + ------------------ | ----------- | ------------------ | ------------------- + parse_event_t::object_start | the parser read `{` and started to process a JSON object | depth of the parent of the JSON object | a JSON value with type discarded + parse_event_t::key | the parser read a key of a value in an object | depth of the currently parsed JSON object | a JSON string containing the key + parse_event_t::object_end | the parser read `}` and finished processing a JSON object | depth of the parent of the JSON object | the parsed JSON object + parse_event_t::array_start | the parser read `[` and started to process a JSON array | depth of the parent of the JSON array | a JSON value with type discarded + parse_event_t::array_end | the parser read `]` and finished processing a JSON array | depth of the parent of the JSON array | the parsed JSON array + parse_event_t::value | the parser finished reading a JSON value | depth of the value | the parsed JSON value + + Discarding a value (i.e., returning `false`) has different effects + depending on the context in which function was called: + + - Discarded values in structured types are skipped. That is, the parser + will behave as if the discarded value was never read. + - In case a value outside a structured type is skipped, it is replaced with + `null`. This case happens if the top-level element is skipped. + + @param[in] depth the depth of the recursion during parsing + + @param[in] event an event of type parse_event_t indicating the context in + the callback function has been called + + @param[in,out] parsed the current intermediate parse result; note that + writing to this value has no effect for parse_event_t::key events + + @return Whether the JSON value which called the function during parsing + should be kept (`true`) or not (`false`). In the latter case, it is either + skipped completely or replaced by an empty discarded object. + + @sa @ref parse(std::istream&, parser_callback_t) or + @ref parse(const string_t&, parser_callback_t) for examples + + @since version 1.0.0 + */ + using parser_callback_t = std::function; + + + ////////////////// + // constructors // + ////////////////// + + /// @name constructors and destructors + /// @{ + + /*! + @brief create an empty value with a given type + + Create an empty JSON value with a given type. The value will be default + initialized with an empty value which depends on the type: + + Value type | initial value + ----------- | ------------- + null | `null` + boolean | `false` + string | `""` + number | `0` + object | `{}` + array | `[]` + + @param[in] value_type the type of the value to create + + @complexity Constant. + + @throw std::bad_alloc if allocation for object, array, or string value + fails + + @liveexample{The following code shows the constructor for different @ref + value_t values,basic_json__value_t} + + @sa @ref basic_json(std::nullptr_t) -- create a `null` value + @sa @ref basic_json(boolean_t value) -- create a boolean value + @sa @ref basic_json(const string_t&) -- create a string value + @sa @ref basic_json(const object_t&) -- create a object value + @sa @ref basic_json(const array_t&) -- create a array value + @sa @ref basic_json(const number_float_t) -- create a number + (floating-point) value + @sa @ref basic_json(const number_integer_t) -- create a number (integer) + value + @sa @ref basic_json(const number_unsigned_t) -- create a number (unsigned) + value + + @since version 1.0.0 + */ + basic_json(const value_t value_type) + : m_type(value_type), m_value(value_type) + {} + + /*! + @brief create a null object (implicitly) + + Create a `null` JSON value. This is the implicit version of the `null` + value constructor as it takes no parameters. + + @complexity Constant. + + @exceptionsafety No-throw guarantee: this constructor never throws + exceptions. + + @requirement This function helps `basic_json` satisfying the + [Container](http://en.cppreference.com/w/cpp/concept/Container) + requirements: + - The complexity is constant. + - As postcondition, it holds: `basic_json().empty() == true`. + + @liveexample{The following code shows the constructor for a `null` JSON + value.,basic_json} + + @sa @ref basic_json(std::nullptr_t) -- create a `null` value + + @since version 1.0.0 + */ + basic_json() = default; + + /*! + @brief create a null object (explicitly) + + Create a `null` JSON value. This is the explicitly version of the `null` + value constructor as it takes a null pointer as parameter. It allows to + create `null` values by explicitly assigning a `nullptr` to a JSON value. + The passed null pointer itself is not read -- it is only used to choose the + right constructor. + + @complexity Constant. + + @exceptionsafety No-throw guarantee: this constructor never throws + exceptions. + + @liveexample{The following code shows the constructor with null pointer + parameter.,basic_json__nullptr_t} + + @sa @ref basic_json() -- default constructor (implicitly creating a `null` + value) + + @since version 1.0.0 + */ + basic_json(std::nullptr_t) noexcept + : basic_json(value_t::null) + {} + + /*! + @brief create an object (explicit) + + Create an object JSON value with a given content. + + @param[in] val a value for the object + + @complexity Linear in the size of the passed @a val. + + @throw std::bad_alloc if allocation for object value fails + + @liveexample{The following code shows the constructor with an @ref object_t + parameter.,basic_json__object_t} + + @sa @ref basic_json(const CompatibleObjectType&) -- create an object value + from a compatible STL container + + @since version 1.0.0 + */ + basic_json(const object_t& val) + : m_type(value_t::object), m_value(val) + {} + + /*! + @brief create an object (implicit) + + Create an object JSON value with a given content. This constructor allows + any type @a CompatibleObjectType that can be used to construct values of + type @ref object_t. + + @tparam CompatibleObjectType An object type whose `key_type` and + `value_type` is compatible to @ref object_t. Examples include `std::map`, + `std::unordered_map`, `std::multimap`, and `std::unordered_multimap` with + a `key_type` of `std::string`, and a `value_type` from which a @ref + basic_json value can be constructed. + + @param[in] val a value for the object + + @complexity Linear in the size of the passed @a val. + + @throw std::bad_alloc if allocation for object value fails + + @liveexample{The following code shows the constructor with several + compatible object type parameters.,basic_json__CompatibleObjectType} + + @sa @ref basic_json(const object_t&) -- create an object value + + @since version 1.0.0 + */ + template ::value and + std::is_constructible::value, int>::type + = 0> + basic_json(const CompatibleObjectType& val) + : m_type(value_t::object) + { + using std::begin; + using std::end; + m_value.object = create(begin(val), end(val)); + } + + /*! + @brief create an array (explicit) + + Create an array JSON value with a given content. + + @param[in] val a value for the array + + @complexity Linear in the size of the passed @a val. + + @throw std::bad_alloc if allocation for array value fails + + @liveexample{The following code shows the constructor with an @ref array_t + parameter.,basic_json__array_t} + + @sa @ref basic_json(const CompatibleArrayType&) -- create an array value + from a compatible STL containers + + @since version 1.0.0 + */ + basic_json(const array_t& val) + : m_type(value_t::array), m_value(val) + {} + + /*! + @brief create an array (implicit) + + Create an array JSON value with a given content. This constructor allows + any type @a CompatibleArrayType that can be used to construct values of + type @ref array_t. + + @tparam CompatibleArrayType An object type whose `value_type` is compatible + to @ref array_t. Examples include `std::vector`, `std::deque`, `std::list`, + `std::forward_list`, `std::array`, `std::set`, `std::unordered_set`, + `std::multiset`, and `unordered_multiset` with a `value_type` from which a + @ref basic_json value can be constructed. + + @param[in] val a value for the array + + @complexity Linear in the size of the passed @a val. + + @throw std::bad_alloc if allocation for array value fails + + @liveexample{The following code shows the constructor with several + compatible array type parameters.,basic_json__CompatibleArrayType} + + @sa @ref basic_json(const array_t&) -- create an array value + + @since version 1.0.0 + */ + template ::value and + not std::is_same::value and + not std::is_same::value and + not std::is_same::value and + not std::is_same::value and + not std::is_same::value and + std::is_constructible::value, int>::type + = 0> + basic_json(const CompatibleArrayType& val) + : m_type(value_t::array) + { + using std::begin; + using std::end; + m_value.array = create(begin(val), end(val)); + } + + /*! + @brief create a string (explicit) + + Create an string JSON value with a given content. + + @param[in] val a value for the string + + @complexity Linear in the size of the passed @a val. + + @throw std::bad_alloc if allocation for string value fails + + @liveexample{The following code shows the constructor with an @ref string_t + parameter.,basic_json__string_t} + + @sa @ref basic_json(const typename string_t::value_type*) -- create a + string value from a character pointer + @sa @ref basic_json(const CompatibleStringType&) -- create a string value + from a compatible string container + + @since version 1.0.0 + */ + basic_json(const string_t& val) + : m_type(value_t::string), m_value(val) + {} + + /*! + @brief create a string (explicit) + + Create a string JSON value with a given content. + + @param[in] val a literal value for the string + + @complexity Linear in the size of the passed @a val. + + @throw std::bad_alloc if allocation for string value fails + + @liveexample{The following code shows the constructor with string literal + parameter.,basic_json__string_t_value_type} + + @sa @ref basic_json(const string_t&) -- create a string value + @sa @ref basic_json(const CompatibleStringType&) -- create a string value + from a compatible string container + + @since version 1.0.0 + */ + basic_json(const typename string_t::value_type* val) + : basic_json(string_t(val)) + {} + + /*! + @brief create a string (implicit) + + Create a string JSON value with a given content. + + @param[in] val a value for the string + + @tparam CompatibleStringType an string type which is compatible to @ref + string_t, for instance `std::string`. + + @complexity Linear in the size of the passed @a val. + + @throw std::bad_alloc if allocation for string value fails + + @liveexample{The following code shows the construction of a string value + from a compatible type.,basic_json__CompatibleStringType} + + @sa @ref basic_json(const string_t&) -- create a string value + @sa @ref basic_json(const typename string_t::value_type*) -- create a + string value from a character pointer + + @since version 1.0.0 + */ + template ::value, int>::type + = 0> + basic_json(const CompatibleStringType& val) + : basic_json(string_t(val)) + {} + + /*! + @brief create a boolean (explicit) + + Creates a JSON boolean type from a given value. + + @param[in] val a boolean value to store + + @complexity Constant. + + @liveexample{The example below demonstrates boolean + values.,basic_json__boolean_t} + + @since version 1.0.0 + */ + basic_json(boolean_t val) noexcept + : m_type(value_t::boolean), m_value(val) + {} + + /*! + @brief create an integer number (explicit) + + Create an integer number JSON value with a given content. + + @tparam T A helper type to remove this function via SFINAE in case @ref + number_integer_t is the same as `int`. In this case, this constructor would + have the same signature as @ref basic_json(const int value). Note the + helper type @a T is not visible in this constructor's interface. + + @param[in] val an integer to create a JSON number from + + @complexity Constant. + + @liveexample{The example below shows the construction of an integer + number value.,basic_json__number_integer_t} + + @sa @ref basic_json(const int) -- create a number value (integer) + @sa @ref basic_json(const CompatibleNumberIntegerType) -- create a number + value (integer) from a compatible number type + + @since version 1.0.0 + */ + template::value) + and std::is_same::value + , int>::type + = 0> + basic_json(const number_integer_t val) noexcept + : m_type(value_t::number_integer), m_value(val) + {} + + /*! + @brief create an integer number from an enum type (explicit) + + Create an integer number JSON value with a given content. + + @param[in] val an integer to create a JSON number from + + @note This constructor allows to pass enums directly to a constructor. As + C++ has no way of specifying the type of an anonymous enum explicitly, we + can only rely on the fact that such values implicitly convert to int. As + int may already be the same type of number_integer_t, we may need to switch + off the constructor @ref basic_json(const number_integer_t). + + @complexity Constant. + + @liveexample{The example below shows the construction of an integer + number value from an anonymous enum.,basic_json__const_int} + + @sa @ref basic_json(const number_integer_t) -- create a number value + (integer) + @sa @ref basic_json(const CompatibleNumberIntegerType) -- create a number + value (integer) from a compatible number type + + @since version 1.0.0 + */ + basic_json(const int val) noexcept + : m_type(value_t::number_integer), + m_value(static_cast(val)) + {} + + /*! + @brief create an integer number (implicit) + + Create an integer number JSON value with a given content. This constructor + allows any type @a CompatibleNumberIntegerType that can be used to + construct values of type @ref number_integer_t. + + @tparam CompatibleNumberIntegerType An integer type which is compatible to + @ref number_integer_t. Examples include the types `int`, `int32_t`, `long`, + and `short`. + + @param[in] val an integer to create a JSON number from + + @complexity Constant. + + @liveexample{The example below shows the construction of several integer + number values from compatible + types.,basic_json__CompatibleIntegerNumberType} + + @sa @ref basic_json(const number_integer_t) -- create a number value + (integer) + @sa @ref basic_json(const int) -- create a number value (integer) + + @since version 1.0.0 + */ + template::value and + std::numeric_limits::is_integer and + std::numeric_limits::is_signed, + CompatibleNumberIntegerType>::type + = 0> + basic_json(const CompatibleNumberIntegerType val) noexcept + : m_type(value_t::number_integer), + m_value(static_cast(val)) + {} + + /*! + @brief create an unsigned integer number (explicit) + + Create an unsigned integer number JSON value with a given content. + + @tparam T helper type to compare number_unsigned_t and unsigned int + (not visible in) the interface. + + @param[in] val an integer to create a JSON number from + + @complexity Constant. + + @sa @ref basic_json(const CompatibleNumberUnsignedType) -- create a number + value (unsigned integer) from a compatible number type + + @since version 2.0.0 + */ + template::value) + and std::is_same::value + , int>::type + = 0> + basic_json(const number_unsigned_t val) noexcept + : m_type(value_t::number_unsigned), m_value(val) + {} + + /*! + @brief create an unsigned number (implicit) + + Create an unsigned number JSON value with a given content. This constructor + allows any type @a CompatibleNumberUnsignedType that can be used to + construct values of type @ref number_unsigned_t. + + @tparam CompatibleNumberUnsignedType An integer type which is compatible to + @ref number_unsigned_t. Examples may include the types `unsigned int`, + `uint32_t`, or `unsigned short`. + + @param[in] val an unsigned integer to create a JSON number from + + @complexity Constant. + + @sa @ref basic_json(const number_unsigned_t) -- create a number value + (unsigned) + + @since version 2.0.0 + */ + template < typename CompatibleNumberUnsignedType, typename + std::enable_if < + std::is_constructible::value and + std::numeric_limits::is_integer and + !std::numeric_limits::is_signed, + CompatibleNumberUnsignedType >::type + = 0 > + basic_json(const CompatibleNumberUnsignedType val) noexcept + : m_type(value_t::number_unsigned), + m_value(static_cast(val)) + {} + + /*! + @brief create a floating-point number (explicit) + + Create a floating-point number JSON value with a given content. + + @param[in] val a floating-point value to create a JSON number from + + @note [RFC 7159](http://www.rfc-editor.org/rfc/rfc7159.txt), section 6 + disallows NaN values: + > Numeric values that cannot be represented in the grammar below (such + > as Infinity and NaN) are not permitted. + In case the parameter @a val is not a number, a JSON null value is + created instead. + + @complexity Constant. + + @liveexample{The following example creates several floating-point + values.,basic_json__number_float_t} + + @sa @ref basic_json(const CompatibleNumberFloatType) -- create a number + value (floating-point) from a compatible number type + + @since version 1.0.0 + */ + basic_json(const number_float_t val) noexcept + : m_type(value_t::number_float), m_value(val) + { + // replace infinity and NAN by null + if (not std::isfinite(val)) + { + m_type = value_t::null; + m_value = json_value(); + } + } + + /*! + @brief create an floating-point number (implicit) + + Create an floating-point number JSON value with a given content. This + constructor allows any type @a CompatibleNumberFloatType that can be used + to construct values of type @ref number_float_t. + + @tparam CompatibleNumberFloatType A floating-point type which is compatible + to @ref number_float_t. Examples may include the types `float` or `double`. + + @param[in] val a floating-point to create a JSON number from + + @note [RFC 7159](http://www.rfc-editor.org/rfc/rfc7159.txt), section 6 + disallows NaN values: + > Numeric values that cannot be represented in the grammar below (such + > as Infinity and NaN) are not permitted. + In case the parameter @a val is not a number, a JSON null value is + created instead. + + @complexity Constant. + + @liveexample{The example below shows the construction of several + floating-point number values from compatible + types.,basic_json__CompatibleNumberFloatType} + + @sa @ref basic_json(const number_float_t) -- create a number value + (floating-point) + + @since version 1.0.0 + */ + template::value and + std::is_floating_point::value>::type + > + basic_json(const CompatibleNumberFloatType val) noexcept + : basic_json(number_float_t(val)) + {} + + /*! + @brief create a container (array or object) from an initializer list + + Creates a JSON value of type array or object from the passed initializer + list @a init. In case @a type_deduction is `true` (default), the type of + the JSON value to be created is deducted from the initializer list @a init + according to the following rules: + + 1. If the list is empty, an empty JSON object value `{}` is created. + 2. If the list consists of pairs whose first element is a string, a JSON + object value is created where the first elements of the pairs are treated + as keys and the second elements are as values. + 3. In all other cases, an array is created. + + The rules aim to create the best fit between a C++ initializer list and + JSON values. The rationale is as follows: + + 1. The empty initializer list is written as `{}` which is exactly an empty + JSON object. + 2. C++ has now way of describing mapped types other than to list a list of + pairs. As JSON requires that keys must be of type string, rule 2 is the + weakest constraint one can pose on initializer lists to interpret them as + an object. + 3. In all other cases, the initializer list could not be interpreted as + JSON object type, so interpreting it as JSON array type is safe. + + With the rules described above, the following JSON values cannot be + expressed by an initializer list: + + - the empty array (`[]`): use @ref array(std::initializer_list) + with an empty initializer list in this case + - arrays whose elements satisfy rule 2: use @ref + array(std::initializer_list) with the same initializer list + in this case + + @note When used without parentheses around an empty initializer list, @ref + basic_json() is called instead of this function, yielding the JSON null + value. + + @param[in] init initializer list with JSON values + + @param[in] type_deduction internal parameter; when set to `true`, the type + of the JSON value is deducted from the initializer list @a init; when set + to `false`, the type provided via @a manual_type is forced. This mode is + used by the functions @ref array(std::initializer_list) and + @ref object(std::initializer_list). + + @param[in] manual_type internal parameter; when @a type_deduction is set to + `false`, the created JSON value will use the provided type (only @ref + value_t::array and @ref value_t::object are valid); when @a type_deduction + is set to `true`, this parameter has no effect + + @throw std::domain_error if @a type_deduction is `false`, @a manual_type is + `value_t::object`, but @a init contains an element which is not a pair + whose first element is a string; example: `"cannot create object from + initializer list"` + + @complexity Linear in the size of the initializer list @a init. + + @liveexample{The example below shows how JSON values are created from + initializer lists.,basic_json__list_init_t} + + @sa @ref array(std::initializer_list) -- create a JSON array + value from an initializer list + @sa @ref object(std::initializer_list) -- create a JSON object + value from an initializer list + + @since version 1.0.0 + */ + basic_json(std::initializer_list init, + bool type_deduction = true, + value_t manual_type = value_t::array) + { + // the initializer list could describe an object + bool is_an_object = true; + + // check if each element is an array with two elements whose first + // element is a string + for (const auto& element : init) + { + if (not element.is_array() or element.size() != 2 + or not element[0].is_string()) + { + // we found an element that makes it impossible to use the + // initializer list as object + is_an_object = false; + break; + } + } + + // adjust type if type deduction is not wanted + if (not type_deduction) + { + // if array is wanted, do not create an object though possible + if (manual_type == value_t::array) + { + is_an_object = false; + } + + // if object is wanted but impossible, throw an exception + if (manual_type == value_t::object and not is_an_object) + { + throw std::domain_error("cannot create object from initializer list"); + } + } + + if (is_an_object) + { + // the initializer list is a list of pairs -> create object + m_type = value_t::object; + m_value = value_t::object; + + assert(m_value.object != nullptr); + + for (auto& element : init) + { + m_value.object->emplace(*(element[0].m_value.string), element[1]); + } + } + else + { + // the initializer list describes an array -> create array + m_type = value_t::array; + m_value.array = create(init); + } + } + + /*! + @brief explicitly create an array from an initializer list + + Creates a JSON array value from a given initializer list. That is, given a + list of values `a, b, c`, creates the JSON value `[a, b, c]`. If the + initializer list is empty, the empty array `[]` is created. + + @note This function is only needed to express two edge cases that cannot be + realized with the initializer list constructor (@ref + basic_json(std::initializer_list, bool, value_t)). These cases + are: + 1. creating an array whose elements are all pairs whose first element is a + string -- in this case, the initializer list constructor would create an + object, taking the first elements as keys + 2. creating an empty array -- passing the empty initializer list to the + initializer list constructor yields an empty object + + @param[in] init initializer list with JSON values to create an array from + (optional) + + @return JSON array value + + @complexity Linear in the size of @a init. + + @liveexample{The following code shows an example for the `array` + function.,array} + + @sa @ref basic_json(std::initializer_list, bool, value_t) -- + create a JSON value from an initializer list + @sa @ref object(std::initializer_list) -- create a JSON object + value from an initializer list + + @since version 1.0.0 + */ + static basic_json array(std::initializer_list init = + std::initializer_list()) + { + return basic_json(init, false, value_t::array); + } + + /*! + @brief explicitly create an object from an initializer list + + Creates a JSON object value from a given initializer list. The initializer + lists elements must be pairs, and their first elements must be strings. If + the initializer list is empty, the empty object `{}` is created. + + @note This function is only added for symmetry reasons. In contrast to the + related function @ref array(std::initializer_list), there are + no cases which can only be expressed by this function. That is, any + initializer list @a init can also be passed to the initializer list + constructor + @ref basic_json(std::initializer_list, bool, value_t). + + @param[in] init initializer list to create an object from (optional) + + @return JSON object value + + @throw std::domain_error if @a init is not a pair whose first elements are + strings; thrown by + @ref basic_json(std::initializer_list, bool, value_t) + + @complexity Linear in the size of @a init. + + @liveexample{The following code shows an example for the `object` + function.,object} + + @sa @ref basic_json(std::initializer_list, bool, value_t) -- + create a JSON value from an initializer list + @sa @ref array(std::initializer_list) -- create a JSON array + value from an initializer list + + @since version 1.0.0 + */ + static basic_json object(std::initializer_list init = + std::initializer_list()) + { + return basic_json(init, false, value_t::object); + } + + /*! + @brief construct an array with count copies of given value + + Constructs a JSON array value by creating @a cnt copies of a passed + value. In case @a cnt is `0`, an empty array is created. As postcondition, + `std::distance(begin(),end()) == cnt` holds. + + @param[in] cnt the number of JSON copies of @a val to create + @param[in] val the JSON value to copy + + @complexity Linear in @a cnt. + + @liveexample{The following code shows examples for the @ref + basic_json(size_type\, const basic_json&) + constructor.,basic_json__size_type_basic_json} + + @since version 1.0.0 + */ + basic_json(size_type cnt, const basic_json& val) + : m_type(value_t::array) + { + m_value.array = create(cnt, val); + } + + /*! + @brief construct a JSON container given an iterator range + + Constructs the JSON value with the contents of the range `[first, last)`. + The semantics depends on the different types a JSON value can have: + - In case of primitive types (number, boolean, or string), @a first must + be `begin()` and @a last must be `end()`. In this case, the value is + copied. Otherwise, std::out_of_range is thrown. + - In case of structured types (array, object), the constructor behaves + as similar versions for `std::vector`. + - In case of a null type, std::domain_error is thrown. + + @tparam InputIT an input iterator type (@ref iterator or @ref + const_iterator) + + @param[in] first begin of the range to copy from (included) + @param[in] last end of the range to copy from (excluded) + + @throw std::domain_error if iterators are not compatible; that is, do not + belong to the same JSON value; example: `"iterators are not compatible"` + @throw std::out_of_range if iterators are for a primitive type (number, + boolean, or string) where an out of range error can be detected easily; + example: `"iterators out of range"` + @throw std::bad_alloc if allocation for object, array, or string fails + @throw std::domain_error if called with a null value; example: `"cannot use + construct with iterators from null"` + + @complexity Linear in distance between @a first and @a last. + + @liveexample{The example below shows several ways to create JSON values by + specifying a subrange with iterators.,basic_json__InputIt_InputIt} + + @since version 1.0.0 + */ + template ::value or + std::is_same::value + , int>::type + = 0> + basic_json(InputIT first, InputIT last) : m_type(first.m_object->m_type) + { + // make sure iterator fits the current value + if (first.m_object != last.m_object) + { + throw std::domain_error("iterators are not compatible"); + } + + // check if iterator range is complete for primitive values + switch (m_type) + { + case value_t::boolean: + case value_t::number_float: + case value_t::number_integer: + case value_t::number_unsigned: + case value_t::string: + { + if (not first.m_it.primitive_iterator.is_begin() or not last.m_it.primitive_iterator.is_end()) + { + throw std::out_of_range("iterators out of range"); + } + break; + } + + default: + { + break; + } + } + + switch (m_type) + { + case value_t::number_integer: + { + assert(first.m_object != nullptr); + m_value.number_integer = first.m_object->m_value.number_integer; + break; + } + + case value_t::number_unsigned: + { + assert(first.m_object != nullptr); + m_value.number_unsigned = first.m_object->m_value.number_unsigned; + break; + } + + case value_t::number_float: + { + assert(first.m_object != nullptr); + m_value.number_float = first.m_object->m_value.number_float; + break; + } + + case value_t::boolean: + { + assert(first.m_object != nullptr); + m_value.boolean = first.m_object->m_value.boolean; + break; + } + + case value_t::string: + { + assert(first.m_object != nullptr); + m_value = *first.m_object->m_value.string; + break; + } + + case value_t::object: + { + m_value.object = create(first.m_it.object_iterator, last.m_it.object_iterator); + break; + } + + case value_t::array: + { + m_value.array = create(first.m_it.array_iterator, last.m_it.array_iterator); + break; + } + + default: + { + assert(first.m_object != nullptr); + throw std::domain_error("cannot use construct with iterators from " + first.m_object->type_name()); + } + } + } + + /*! + @brief construct a JSON value given an input stream + + @param[in,out] i stream to read a serialized JSON value from + @param[in] cb a parser callback function of type @ref parser_callback_t + which is used to control the deserialization by filtering unwanted values + (optional) + + @complexity Linear in the length of the input. The parser is a predictive + LL(1) parser. The complexity can be higher if the parser callback function + @a cb has a super-linear complexity. + + @note A UTF-8 byte order mark is silently ignored. + + @liveexample{The example below demonstrates constructing a JSON value from + a `std::stringstream` with and without callback + function.,basic_json__istream} + + @since version 2.0.0 + */ + explicit basic_json(std::istream& i, parser_callback_t cb = nullptr) + { + *this = parser(i, cb).parse(); + } + + /////////////////////////////////////// + // other constructors and destructor // + /////////////////////////////////////// + + /*! + @brief copy constructor + + Creates a copy of a given JSON value. + + @param[in] other the JSON value to copy + + @complexity Linear in the size of @a other. + + @requirement This function helps `basic_json` satisfying the + [Container](http://en.cppreference.com/w/cpp/concept/Container) + requirements: + - The complexity is linear. + - As postcondition, it holds: `other == basic_json(other)`. + + @throw std::bad_alloc if allocation for object, array, or string fails. + + @liveexample{The following code shows an example for the copy + constructor.,basic_json__basic_json} + + @since version 1.0.0 + */ + basic_json(const basic_json& other) + : m_type(other.m_type) + { + switch (m_type) + { + case value_t::object: + { + assert(other.m_value.object != nullptr); + m_value = *other.m_value.object; + break; + } + + case value_t::array: + { + assert(other.m_value.array != nullptr); + m_value = *other.m_value.array; + break; + } + + case value_t::string: + { + assert(other.m_value.string != nullptr); + m_value = *other.m_value.string; + break; + } + + case value_t::boolean: + { + m_value = other.m_value.boolean; + break; + } + + case value_t::number_integer: + { + m_value = other.m_value.number_integer; + break; + } + + case value_t::number_unsigned: + { + m_value = other.m_value.number_unsigned; + break; + } + + case value_t::number_float: + { + m_value = other.m_value.number_float; + break; + } + + default: + { + break; + } + } + } + + /*! + @brief move constructor + + Move constructor. Constructs a JSON value with the contents of the given + value @a other using move semantics. It "steals" the resources from @a + other and leaves it as JSON null value. + + @param[in,out] other value to move to this object + + @post @a other is a JSON null value + + @complexity Constant. + + @liveexample{The code below shows the move constructor explicitly called + via std::move.,basic_json__moveconstructor} + + @since version 1.0.0 + */ + basic_json(basic_json&& other) noexcept + : m_type(std::move(other.m_type)), + m_value(std::move(other.m_value)) + { + // invalidate payload + other.m_type = value_t::null; + other.m_value = {}; + } + + /*! + @brief copy assignment + + Copy assignment operator. Copies a JSON value via the "copy and swap" + strategy: It is expressed in terms of the copy constructor, destructor, and + the swap() member function. + + @param[in] other value to copy from + + @complexity Linear. + + @requirement This function helps `basic_json` satisfying the + [Container](http://en.cppreference.com/w/cpp/concept/Container) + requirements: + - The complexity is linear. + + @liveexample{The code below shows and example for the copy assignment. It + creates a copy of value `a` which is then swapped with `b`. Finally\, the + copy of `a` (which is the null value after the swap) is + destroyed.,basic_json__copyassignment} + + @since version 1.0.0 + */ + reference& operator=(basic_json other) noexcept ( + std::is_nothrow_move_constructible::value and + std::is_nothrow_move_assignable::value and + std::is_nothrow_move_constructible::value and + std::is_nothrow_move_assignable::value + ) + { + using std::swap; + swap(m_type, other.m_type); + swap(m_value, other.m_value); + return *this; + } + + /*! + @brief destructor + + Destroys the JSON value and frees all allocated memory. + + @complexity Linear. + + @requirement This function helps `basic_json` satisfying the + [Container](http://en.cppreference.com/w/cpp/concept/Container) + requirements: + - The complexity is linear. + - All stored elements are destroyed and all memory is freed. + + @since version 1.0.0 + */ + ~basic_json() + { + switch (m_type) + { + case value_t::object: + { + AllocatorType alloc; + alloc.destroy(m_value.object); + alloc.deallocate(m_value.object, 1); + break; + } + + case value_t::array: + { + AllocatorType alloc; + alloc.destroy(m_value.array); + alloc.deallocate(m_value.array, 1); + break; + } + + case value_t::string: + { + AllocatorType alloc; + alloc.destroy(m_value.string); + alloc.deallocate(m_value.string, 1); + break; + } + + default: + { + // all other types need no specific destructor + break; + } + } + } + + /// @} + + public: + /////////////////////// + // object inspection // + /////////////////////// + + /// @name object inspection + /// @{ + + /*! + @brief serialization + + Serialization function for JSON values. The function tries to mimic + Python's @p json.dumps() function, and currently supports its @p indent + parameter. + + @param[in] indent if indent is nonnegative, then array elements and object + members will be pretty-printed with that indent level. An indent level of 0 + will only insert newlines. -1 (the default) selects the most compact + representation + + @return string containing the serialization of the JSON value + + @complexity Linear. + + @liveexample{The following example shows the effect of different @a indent + parameters to the result of the serialization.,dump} + + @see https://docs.python.org/2/library/json.html#json.dump + + @since version 1.0.0 + */ + string_t dump(const int indent = -1) const + { + std::stringstream ss; + + if (indent >= 0) + { + dump(ss, true, static_cast(indent)); + } + else + { + dump(ss, false, 0); + } + + return ss.str(); + } + + /*! + @brief return the type of the JSON value (explicit) + + Return the type of the JSON value as a value from the @ref value_t + enumeration. + + @return the type of the JSON value + + @complexity Constant. + + @exceptionsafety No-throw guarantee: this member function never throws + exceptions. + + @liveexample{The following code exemplifies `type()` for all JSON + types.,type} + + @since version 1.0.0 + */ + constexpr value_t type() const noexcept + { + return m_type; + } + + /*! + @brief return whether type is primitive + + This function returns true iff the JSON type is primitive (string, number, + boolean, or null). + + @return `true` if type is primitive (string, number, boolean, or null), + `false` otherwise. + + @complexity Constant. + + @exceptionsafety No-throw guarantee: this member function never throws + exceptions. + + @liveexample{The following code exemplifies `is_primitive()` for all JSON + types.,is_primitive} + + @sa @ref is_structured() -- returns whether JSON value is structured + @sa @ref is_null() -- returns whether JSON value is `null` + @sa @ref is_string() -- returns whether JSON value is a string + @sa @ref is_boolean() -- returns whether JSON value is a boolean + @sa @ref is_number() -- returns whether JSON value is a number + + @since version 1.0.0 + */ + constexpr bool is_primitive() const noexcept + { + return is_null() or is_string() or is_boolean() or is_number(); + } + + /*! + @brief return whether type is structured + + This function returns true iff the JSON type is structured (array or + object). + + @return `true` if type is structured (array or object), `false` otherwise. + + @complexity Constant. + + @exceptionsafety No-throw guarantee: this member function never throws + exceptions. + + @liveexample{The following code exemplifies `is_structured()` for all JSON + types.,is_structured} + + @sa @ref is_primitive() -- returns whether value is primitive + @sa @ref is_array() -- returns whether value is an array + @sa @ref is_object() -- returns whether value is an object + + @since version 1.0.0 + */ + constexpr bool is_structured() const noexcept + { + return is_array() or is_object(); + } + + /*! + @brief return whether value is null + + This function returns true iff the JSON value is null. + + @return `true` if type is null, `false` otherwise. + + @complexity Constant. + + @exceptionsafety No-throw guarantee: this member function never throws + exceptions. + + @liveexample{The following code exemplifies `is_null()` for all JSON + types.,is_null} + + @since version 1.0.0 + */ + constexpr bool is_null() const noexcept + { + return m_type == value_t::null; + } + + /*! + @brief return whether value is a boolean + + This function returns true iff the JSON value is a boolean. + + @return `true` if type is boolean, `false` otherwise. + + @complexity Constant. + + @exceptionsafety No-throw guarantee: this member function never throws + exceptions. + + @liveexample{The following code exemplifies `is_boolean()` for all JSON + types.,is_boolean} + + @since version 1.0.0 + */ + constexpr bool is_boolean() const noexcept + { + return m_type == value_t::boolean; + } + + /*! + @brief return whether value is a number + + This function returns true iff the JSON value is a number. This includes + both integer and floating-point values. + + @return `true` if type is number (regardless whether integer, unsigned + integer or floating-type), `false` otherwise. + + @complexity Constant. + + @exceptionsafety No-throw guarantee: this member function never throws + exceptions. + + @liveexample{The following code exemplifies `is_number()` for all JSON + types.,is_number} + + @sa @ref is_number_integer() -- check if value is an integer or unsigned + integer number + @sa @ref is_number_unsigned() -- check if value is an unsigned integer + number + @sa @ref is_number_float() -- check if value is a floating-point number + + @since version 1.0.0 + */ + constexpr bool is_number() const noexcept + { + return is_number_integer() or is_number_float(); + } + + /*! + @brief return whether value is an integer number + + This function returns true iff the JSON value is an integer or unsigned + integer number. This excludes floating-point values. + + @return `true` if type is an integer or unsigned integer number, `false` + otherwise. + + @complexity Constant. + + @exceptionsafety No-throw guarantee: this member function never throws + exceptions. + + @liveexample{The following code exemplifies `is_number_integer()` for all + JSON types.,is_number_integer} + + @sa @ref is_number() -- check if value is a number + @sa @ref is_number_unsigned() -- check if value is an unsigned integer + number + @sa @ref is_number_float() -- check if value is a floating-point number + + @since version 1.0.0 + */ + constexpr bool is_number_integer() const noexcept + { + return m_type == value_t::number_integer or m_type == value_t::number_unsigned; + } + + /*! + @brief return whether value is an unsigned integer number + + This function returns true iff the JSON value is an unsigned integer + number. This excludes floating-point and (signed) integer values. + + @return `true` if type is an unsigned integer number, `false` otherwise. + + @complexity Constant. + + @exceptionsafety No-throw guarantee: this member function never throws + exceptions. + + @liveexample{The following code exemplifies `is_number_unsigned()` for all + JSON types.,is_number_unsigned} + + @sa @ref is_number() -- check if value is a number + @sa @ref is_number_integer() -- check if value is an integer or unsigned + integer number + @sa @ref is_number_float() -- check if value is a floating-point number + + @since version 2.0.0 + */ + constexpr bool is_number_unsigned() const noexcept + { + return m_type == value_t::number_unsigned; + } + + /*! + @brief return whether value is a floating-point number + + This function returns true iff the JSON value is a floating-point number. + This excludes integer and unsigned integer values. + + @return `true` if type is a floating-point number, `false` otherwise. + + @complexity Constant. + + @exceptionsafety No-throw guarantee: this member function never throws + exceptions. + + @liveexample{The following code exemplifies `is_number_float()` for all + JSON types.,is_number_float} + + @sa @ref is_number() -- check if value is number + @sa @ref is_number_integer() -- check if value is an integer number + @sa @ref is_number_unsigned() -- check if value is an unsigned integer + number + + @since version 1.0.0 + */ + constexpr bool is_number_float() const noexcept + { + return m_type == value_t::number_float; + } + + /*! + @brief return whether value is an object + + This function returns true iff the JSON value is an object. + + @return `true` if type is object, `false` otherwise. + + @complexity Constant. + + @exceptionsafety No-throw guarantee: this member function never throws + exceptions. + + @liveexample{The following code exemplifies `is_object()` for all JSON + types.,is_object} + + @since version 1.0.0 + */ + constexpr bool is_object() const noexcept + { + return m_type == value_t::object; + } + + /*! + @brief return whether value is an array + + This function returns true iff the JSON value is an array. + + @return `true` if type is array, `false` otherwise. + + @complexity Constant. + + @exceptionsafety No-throw guarantee: this member function never throws + exceptions. + + @liveexample{The following code exemplifies `is_array()` for all JSON + types.,is_array} + + @since version 1.0.0 + */ + constexpr bool is_array() const noexcept + { + return m_type == value_t::array; + } + + /*! + @brief return whether value is a string + + This function returns true iff the JSON value is a string. + + @return `true` if type is string, `false` otherwise. + + @complexity Constant. + + @exceptionsafety No-throw guarantee: this member function never throws + exceptions. + + @liveexample{The following code exemplifies `is_string()` for all JSON + types.,is_string} + + @since version 1.0.0 + */ + constexpr bool is_string() const noexcept + { + return m_type == value_t::string; + } + + /*! + @brief return whether value is discarded + + This function returns true iff the JSON value was discarded during parsing + with a callback function (see @ref parser_callback_t). + + @note This function will always be `false` for JSON values after parsing. + That is, discarded values can only occur during parsing, but will be + removed when inside a structured value or replaced by null in other cases. + + @return `true` if type is discarded, `false` otherwise. + + @complexity Constant. + + @exceptionsafety No-throw guarantee: this member function never throws + exceptions. + + @liveexample{The following code exemplifies `is_discarded()` for all JSON + types.,is_discarded} + + @since version 1.0.0 + */ + constexpr bool is_discarded() const noexcept + { + return m_type == value_t::discarded; + } + + /*! + @brief return the type of the JSON value (implicit) + + Implicitly return the type of the JSON value as a value from the @ref + value_t enumeration. + + @return the type of the JSON value + + @complexity Constant. + + @exceptionsafety No-throw guarantee: this member function never throws + exceptions. + + @liveexample{The following code exemplifies the @ref value_t operator for + all JSON types.,operator__value_t} + + @since version 1.0.0 + */ + constexpr operator value_t() const noexcept + { + return m_type; + } + + /// @} + + private: + ////////////////// + // value access // + ////////////////// + + /// get an object (explicit) + template ::value and + std::is_convertible::value + , int>::type = 0> + T get_impl(T*) const + { + if (is_object()) + { + assert(m_value.object != nullptr); + return T(m_value.object->begin(), m_value.object->end()); + } + else + { + throw std::domain_error("type must be object, but is " + type_name()); + } + } + + /// get an object (explicit) + object_t get_impl(object_t*) const + { + if (is_object()) + { + assert(m_value.object != nullptr); + return *(m_value.object); + } + else + { + throw std::domain_error("type must be object, but is " + type_name()); + } + } + + /// get an array (explicit) + template ::value and + not std::is_same::value and + not std::is_arithmetic::value and + not std::is_convertible::value and + not has_mapped_type::value + , int>::type = 0> + T get_impl(T*) const + { + if (is_array()) + { + T to_vector; + assert(m_value.array != nullptr); + std::transform(m_value.array->begin(), m_value.array->end(), + std::inserter(to_vector, to_vector.end()), [](basic_json i) + { + return i.get(); + }); + return to_vector; + } + else + { + throw std::domain_error("type must be array, but is " + type_name()); + } + } + + /// get an array (explicit) + template ::value and + not std::is_same::value + , int>::type = 0> + std::vector get_impl(std::vector*) const + { + if (is_array()) + { + std::vector to_vector; + assert(m_value.array != nullptr); + to_vector.reserve(m_value.array->size()); + std::transform(m_value.array->begin(), m_value.array->end(), + std::inserter(to_vector, to_vector.end()), [](basic_json i) + { + return i.get(); + }); + return to_vector; + } + else + { + throw std::domain_error("type must be array, but is " + type_name()); + } + } + + /// get an array (explicit) + template ::value and + not has_mapped_type::value + , int>::type = 0> + T get_impl(T*) const + { + if (is_array()) + { + assert(m_value.array != nullptr); + return T(m_value.array->begin(), m_value.array->end()); + } + else + { + throw std::domain_error("type must be array, but is " + type_name()); + } + } + + /// get an array (explicit) + array_t get_impl(array_t*) const + { + if (is_array()) + { + assert(m_value.array != nullptr); + return *(m_value.array); + } + else + { + throw std::domain_error("type must be array, but is " + type_name()); + } + } + + /// get a string (explicit) + template ::value + , int>::type = 0> + T get_impl(T*) const + { + if (is_string()) + { + assert(m_value.string != nullptr); + return *m_value.string; + } + else + { + throw std::domain_error("type must be string, but is " + type_name()); + } + } + + /// get a number (explicit) + template::value + , int>::type = 0> + T get_impl(T*) const + { + switch (m_type) + { + case value_t::number_integer: + { + return static_cast(m_value.number_integer); + } + + case value_t::number_unsigned: + { + return static_cast(m_value.number_unsigned); + } + + case value_t::number_float: + { + return static_cast(m_value.number_float); + } + + default: + { + throw std::domain_error("type must be number, but is " + type_name()); + } + } + } + + /// get a boolean (explicit) + constexpr boolean_t get_impl(boolean_t*) const + { + return is_boolean() + ? m_value.boolean + : throw std::domain_error("type must be boolean, but is " + type_name()); + } + + /// get a pointer to the value (object) + object_t* get_impl_ptr(object_t*) noexcept + { + return is_object() ? m_value.object : nullptr; + } + + /// get a pointer to the value (object) + constexpr const object_t* get_impl_ptr(const object_t*) const noexcept + { + return is_object() ? m_value.object : nullptr; + } + + /// get a pointer to the value (array) + array_t* get_impl_ptr(array_t*) noexcept + { + return is_array() ? m_value.array : nullptr; + } + + /// get a pointer to the value (array) + constexpr const array_t* get_impl_ptr(const array_t*) const noexcept + { + return is_array() ? m_value.array : nullptr; + } + + /// get a pointer to the value (string) + string_t* get_impl_ptr(string_t*) noexcept + { + return is_string() ? m_value.string : nullptr; + } + + /// get a pointer to the value (string) + constexpr const string_t* get_impl_ptr(const string_t*) const noexcept + { + return is_string() ? m_value.string : nullptr; + } + + /// get a pointer to the value (boolean) + boolean_t* get_impl_ptr(boolean_t*) noexcept + { + return is_boolean() ? &m_value.boolean : nullptr; + } + + /// get a pointer to the value (boolean) + constexpr const boolean_t* get_impl_ptr(const boolean_t*) const noexcept + { + return is_boolean() ? &m_value.boolean : nullptr; + } + + /// get a pointer to the value (integer number) + number_integer_t* get_impl_ptr(number_integer_t*) noexcept + { + return is_number_integer() ? &m_value.number_integer : nullptr; + } + + /// get a pointer to the value (integer number) + constexpr const number_integer_t* get_impl_ptr(const number_integer_t*) const noexcept + { + return is_number_integer() ? &m_value.number_integer : nullptr; + } + + /// get a pointer to the value (unsigned number) + number_unsigned_t* get_impl_ptr(number_unsigned_t*) noexcept + { + return is_number_unsigned() ? &m_value.number_unsigned : nullptr; + } + + /// get a pointer to the value (unsigned number) + constexpr const number_unsigned_t* get_impl_ptr(const number_unsigned_t*) const noexcept + { + return is_number_unsigned() ? &m_value.number_unsigned : nullptr; + } + + /// get a pointer to the value (floating-point number) + number_float_t* get_impl_ptr(number_float_t*) noexcept + { + return is_number_float() ? &m_value.number_float : nullptr; + } + + /// get a pointer to the value (floating-point number) + constexpr const number_float_t* get_impl_ptr(const number_float_t*) const noexcept + { + return is_number_float() ? &m_value.number_float : nullptr; + } + + /*! + @brief helper function to implement get_ref() + + This funcion helps to implement get_ref() without code duplication for + const and non-const overloads + + @tparam ThisType will be deduced as `basic_json` or `const basic_json` + + @throw std::domain_error if ReferenceType does not match underlying value + type of the current JSON + */ + template + static ReferenceType get_ref_impl(ThisType& obj) + { + // delegate the call to get_ptr<>() + using PointerType = typename std::add_pointer::type; + auto ptr = obj.template get_ptr(); + + if (ptr != nullptr) + { + return *ptr; + } + else + { + throw std::domain_error("incompatible ReferenceType for get_ref, actual type is " + + obj.type_name()); + } + } + + public: + + /// @name value access + /// @{ + + /*! + @brief get a value (explicit) + + Explicit type conversion between the JSON value and a compatible value. + + @tparam ValueType non-pointer type compatible to the JSON value, for + instance `int` for JSON integer numbers, `bool` for JSON booleans, or + `std::vector` types for JSON arrays + + @return copy of the JSON value, converted to type @a ValueType + + @throw std::domain_error in case passed type @a ValueType is incompatible + to JSON; example: `"type must be object, but is null"` + + @complexity Linear in the size of the JSON value. + + @liveexample{The example below shows several conversions from JSON values + to other types. There a few things to note: (1) Floating-point numbers can + be converted to integers\, (2) A JSON array can be converted to a standard + `std::vector`\, (3) A JSON object can be converted to C++ + associative containers such as `std::unordered_map`.,get__ValueType_const} + + @internal + The idea of using a casted null pointer to choose the correct + implementation is from . + @endinternal + + @sa @ref operator ValueType() const for implicit conversion + @sa @ref get() for pointer-member access + + @since version 1.0.0 + */ + template::value + , int>::type = 0> + ValueType get() const + { + return get_impl(static_cast(nullptr)); + } + + /*! + @brief get a pointer value (explicit) + + Explicit pointer access to the internally stored JSON value. No copies are + made. + + @warning The pointer becomes invalid if the underlying JSON object changes. + + @tparam PointerType pointer type; must be a pointer to @ref array_t, @ref + object_t, @ref string_t, @ref boolean_t, @ref number_integer_t, + @ref number_unsigned_t, or @ref number_float_t. + + @return pointer to the internally stored JSON value if the requested + pointer type @a PointerType fits to the JSON value; `nullptr` otherwise + + @complexity Constant. + + @liveexample{The example below shows how pointers to internal values of a + JSON value can be requested. Note that no type conversions are made and a + `nullptr` is returned if the value and the requested pointer type does not + match.,get__PointerType} + + @sa @ref get_ptr() for explicit pointer-member access + + @since version 1.0.0 + */ + template::value + , int>::type = 0> + PointerType get() noexcept + { + // delegate the call to get_ptr + return get_ptr(); + } + + /*! + @brief get a pointer value (explicit) + @copydoc get() + */ + template::value + , int>::type = 0> + constexpr const PointerType get() const noexcept + { + // delegate the call to get_ptr + return get_ptr(); + } + + /*! + @brief get a pointer value (implicit) + + Implicit pointer access to the internally stored JSON value. No copies are + made. + + @warning Writing data to the pointee of the result yields an undefined + state. + + @tparam PointerType pointer type; must be a pointer to @ref array_t, @ref + object_t, @ref string_t, @ref boolean_t, @ref number_integer_t, + @ref number_unsigned_t, or @ref number_float_t. + + @return pointer to the internally stored JSON value if the requested + pointer type @a PointerType fits to the JSON value; `nullptr` otherwise + + @complexity Constant. + + @liveexample{The example below shows how pointers to internal values of a + JSON value can be requested. Note that no type conversions are made and a + `nullptr` is returned if the value and the requested pointer type does not + match.,get_ptr} + + @since version 1.0.0 + */ + template::value + , int>::type = 0> + PointerType get_ptr() noexcept + { + // delegate the call to get_impl_ptr<>() + return get_impl_ptr(static_cast(nullptr)); + } + + /*! + @brief get a pointer value (implicit) + @copydoc get_ptr() + */ + template::value + and std::is_const::type>::value + , int>::type = 0> + constexpr const PointerType get_ptr() const noexcept + { + // delegate the call to get_impl_ptr<>() const + return get_impl_ptr(static_cast(nullptr)); + } + + /*! + @brief get a reference value (implicit) + + Implict reference access to the internally stored JSON value. No copies are + made. + + @warning Writing data to the referee of the result yields an undefined + state. + + @tparam ReferenceType reference type; must be a reference to @ref array_t, + @ref object_t, @ref string_t, @ref boolean_t, @ref number_integer_t, or + @ref number_float_t. + + @return reference to the internally stored JSON value if the requested + reference type @a ReferenceType fits to the JSON value; throws + std::domain_error otherwise + + @throw std::domain_error in case passed type @a ReferenceType is + incompatible with the stored JSON value + + @complexity Constant. + + @liveexample{The example shows several calls to `get_ref()`.,get_ref} + + @since version 1.1.0 + */ + template::value + , int>::type = 0> + ReferenceType get_ref() + { + // delegate call to get_ref_impl + return get_ref_impl(*this); + } + + /*! + @brief get a reference value (implicit) + @copydoc get_ref() + */ + template::value + and std::is_const::type>::value + , int>::type = 0> + ReferenceType get_ref() const + { + // delegate call to get_ref_impl + return get_ref_impl(*this); + } + + /*! + @brief get a value (implicit) + + Implicit type conversion between the JSON value and a compatible value. The + call is realized by calling @ref get() const. + + @tparam ValueType non-pointer type compatible to the JSON value, for + instance `int` for JSON integer numbers, `bool` for JSON booleans, or + `std::vector` types for JSON arrays. The character type of @ref string_t as + well as an initializer list of this type is excluded to avoid ambiguities + as these types implicitly convert to `std::string`. + + @return copy of the JSON value, converted to type @a ValueType + + @throw std::domain_error in case passed type @a ValueType is incompatible + to JSON, thrown by @ref get() const + + @complexity Linear in the size of the JSON value. + + @liveexample{The example below shows several conversions from JSON values + to other types. There a few things to note: (1) Floating-point numbers can + be converted to integers\, (2) A JSON array can be converted to a standard + `std::vector`\, (3) A JSON object can be converted to C++ + associative containers such as `std::unordered_map`.,operator__ValueType} + + @since version 1.0.0 + */ + template < typename ValueType, typename + std::enable_if < + not std::is_pointer::value + and not std::is_same::value +#ifndef _MSC_VER // Fix for issue #167 operator<< abiguity under VS2015 + and not std::is_same>::value +#endif + , int >::type = 0 > + operator ValueType() const + { + // delegate the call to get<>() const + return get(); + } + + /// @} + + + //////////////////// + // element access // + //////////////////// + + /// @name element access + /// @{ + + /*! + @brief access specified array element with bounds checking + + Returns a reference to the element at specified location @a idx, with + bounds checking. + + @param[in] idx index of the element to access + + @return reference to the element at index @a idx + + @throw std::domain_error if the JSON value is not an array; example: + `"cannot use at() with string"` + @throw std::out_of_range if the index @a idx is out of range of the array; + that is, `idx >= size()`; example: `"array index 7 is out of range"` + + @complexity Constant. + + @liveexample{The example below shows how array elements can be read and + written using `at()`.,at__size_type} + + @since version 1.0.0 + */ + reference at(size_type idx) + { + // at only works for arrays + if (is_array()) + { + try + { + assert(m_value.array != nullptr); + return m_value.array->at(idx); + } + catch (std::out_of_range&) + { + // create better exception explanation + throw std::out_of_range("array index " + std::to_string(idx) + " is out of range"); + } + } + else + { + throw std::domain_error("cannot use at() with " + type_name()); + } + } + + /*! + @brief access specified array element with bounds checking + + Returns a const reference to the element at specified location @a idx, with + bounds checking. + + @param[in] idx index of the element to access + + @return const reference to the element at index @a idx + + @throw std::domain_error if the JSON value is not an array; example: + `"cannot use at() with string"` + @throw std::out_of_range if the index @a idx is out of range of the array; + that is, `idx >= size()`; example: `"array index 7 is out of range"` + + @complexity Constant. + + @liveexample{The example below shows how array elements can be read using + `at()`.,at__size_type_const} + + @since version 1.0.0 + */ + const_reference at(size_type idx) const + { + // at only works for arrays + if (is_array()) + { + try + { + assert(m_value.array != nullptr); + return m_value.array->at(idx); + } + catch (std::out_of_range&) + { + // create better exception explanation + throw std::out_of_range("array index " + std::to_string(idx) + " is out of range"); + } + } + else + { + throw std::domain_error("cannot use at() with " + type_name()); + } + } + + /*! + @brief access specified object element with bounds checking + + Returns a reference to the element at with specified key @a key, with + bounds checking. + + @param[in] key key of the element to access + + @return reference to the element at key @a key + + @throw std::domain_error if the JSON value is not an object; example: + `"cannot use at() with boolean"` + @throw std::out_of_range if the key @a key is is not stored in the object; + that is, `find(key) == end()`; example: `"key "the fast" not found"` + + @complexity Logarithmic in the size of the container. + + @liveexample{The example below shows how object elements can be read and + written using `at()`.,at__object_t_key_type} + + @sa @ref operator[](const typename object_t::key_type&) for unchecked + access by reference + @sa @ref value() for access by value with a default value + + @since version 1.0.0 + */ + reference at(const typename object_t::key_type& key) + { + // at only works for objects + if (is_object()) + { + try + { + assert(m_value.object != nullptr); + return m_value.object->at(key); + } + catch (std::out_of_range&) + { + // create better exception explanation + throw std::out_of_range("key '" + key + "' not found"); + } + } + else + { + throw std::domain_error("cannot use at() with " + type_name()); + } + } + + /*! + @brief access specified object element with bounds checking + + Returns a const reference to the element at with specified key @a key, with + bounds checking. + + @param[in] key key of the element to access + + @return const reference to the element at key @a key + + @throw std::domain_error if the JSON value is not an object; example: + `"cannot use at() with boolean"` + @throw std::out_of_range if the key @a key is is not stored in the object; + that is, `find(key) == end()`; example: `"key "the fast" not found"` + + @complexity Logarithmic in the size of the container. + + @liveexample{The example below shows how object elements can be read using + `at()`.,at__object_t_key_type_const} + + @sa @ref operator[](const typename object_t::key_type&) for unchecked + access by reference + @sa @ref value() for access by value with a default value + + @since version 1.0.0 + */ + const_reference at(const typename object_t::key_type& key) const + { + // at only works for objects + if (is_object()) + { + try + { + assert(m_value.object != nullptr); + return m_value.object->at(key); + } + catch (std::out_of_range&) + { + // create better exception explanation + throw std::out_of_range("key '" + key + "' not found"); + } + } + else + { + throw std::domain_error("cannot use at() with " + type_name()); + } + } + + /*! + @brief access specified array element + + Returns a reference to the element at specified location @a idx. + + @note If @a idx is beyond the range of the array (i.e., `idx >= size()`), + then the array is silently filled up with `null` values to make `idx` a + valid reference to the last stored element. + + @param[in] idx index of the element to access + + @return reference to the element at index @a idx + + @throw std::domain_error if JSON is not an array or null; example: `"cannot + use operator[] with string"` + + @complexity Constant if @a idx is in the range of the array. Otherwise + linear in `idx - size()`. + + @liveexample{The example below shows how array elements can be read and + written using `[]` operator. Note the addition of `null` + values.,operatorarray__size_type} + + @since version 1.0.0 + */ + reference operator[](size_type idx) + { + // implicitly convert null value to an empty array + if (is_null()) + { + m_type = value_t::array; + m_value.array = create(); + } + + // operator[] only works for arrays + if (is_array()) + { + // fill up array with null values until given idx is reached + assert(m_value.array != nullptr); + for (size_t i = m_value.array->size(); i <= idx; ++i) + { + m_value.array->push_back(basic_json()); + } + + return m_value.array->operator[](idx); + } + else + { + throw std::domain_error("cannot use operator[] with " + type_name()); + } + } + + /*! + @brief access specified array element + + Returns a const reference to the element at specified location @a idx. + + @param[in] idx index of the element to access + + @return const reference to the element at index @a idx + + @throw std::domain_error if JSON is not an array; example: `"cannot use + operator[] with null"` + + @complexity Constant. + + @liveexample{The example below shows how array elements can be read using + the `[]` operator.,operatorarray__size_type_const} + + @since version 1.0.0 + */ + const_reference operator[](size_type idx) const + { + // const operator[] only works for arrays + if (is_array()) + { + assert(m_value.array != nullptr); + return m_value.array->operator[](idx); + } + else + { + throw std::domain_error("cannot use operator[] with " + type_name()); + } + } + + /*! + @brief access specified object element + + Returns a reference to the element at with specified key @a key. + + @note If @a key is not found in the object, then it is silently added to + the object and filled with a `null` value to make `key` a valid reference. + In case the value was `null` before, it is converted to an object. + + @param[in] key key of the element to access + + @return reference to the element at key @a key + + @throw std::domain_error if JSON is not an object or null; example: + `"cannot use operator[] with string"` + + @complexity Logarithmic in the size of the container. + + @liveexample{The example below shows how object elements can be read and + written using the `[]` operator.,operatorarray__key_type} + + @sa @ref at(const typename object_t::key_type&) for access by reference + with range checking + @sa @ref value() for access by value with a default value + + @since version 1.0.0 + */ + reference operator[](const typename object_t::key_type& key) + { + // implicitly convert null value to an empty object + if (is_null()) + { + m_type = value_t::object; + m_value.object = create(); + } + + // operator[] only works for objects + if (is_object()) + { + assert(m_value.object != nullptr); + return m_value.object->operator[](key); + } + else + { + throw std::domain_error("cannot use operator[] with " + type_name()); + } + } + + /*! + @brief read-only access specified object element + + Returns a const reference to the element at with specified key @a key. No + bounds checking is performed. + + @warning If the element with key @a key does not exist, the behavior is + undefined. + + @param[in] key key of the element to access + + @return const reference to the element at key @a key + + @throw std::domain_error if JSON is not an object; example: `"cannot use + operator[] with null"` + + @complexity Logarithmic in the size of the container. + + @liveexample{The example below shows how object elements can be read using + the `[]` operator.,operatorarray__key_type_const} + + @sa @ref at(const typename object_t::key_type&) for access by reference + with range checking + @sa @ref value() for access by value with a default value + + @since version 1.0.0 + */ + const_reference operator[](const typename object_t::key_type& key) const + { + // const operator[] only works for objects + if (is_object()) + { + assert(m_value.object != nullptr); + assert(m_value.object->find(key) != m_value.object->end()); + return m_value.object->find(key)->second; + } + else + { + throw std::domain_error("cannot use operator[] with " + type_name()); + } + } + + /*! + @brief access specified object element + + Returns a reference to the element at with specified key @a key. + + @note If @a key is not found in the object, then it is silently added to + the object and filled with a `null` value to make `key` a valid reference. + In case the value was `null` before, it is converted to an object. + + @param[in] key key of the element to access + + @return reference to the element at key @a key + + @throw std::domain_error if JSON is not an object or null; example: + `"cannot use operator[] with string"` + + @complexity Logarithmic in the size of the container. + + @liveexample{The example below shows how object elements can be read and + written using the `[]` operator.,operatorarray__key_type} + + @sa @ref at(const typename object_t::key_type&) for access by reference + with range checking + @sa @ref value() for access by value with a default value + + @since version 1.0.0 + */ + template + reference operator[](T * (&key)[n]) + { + return operator[](static_cast(key)); + } + + /*! + @brief read-only access specified object element + + Returns a const reference to the element at with specified key @a key. No + bounds checking is performed. + + @warning If the element with key @a key does not exist, the behavior is + undefined. + + @note This function is required for compatibility reasons with Clang. + + @param[in] key key of the element to access + + @return const reference to the element at key @a key + + @throw std::domain_error if JSON is not an object; example: `"cannot use + operator[] with null"` + + @complexity Logarithmic in the size of the container. + + @liveexample{The example below shows how object elements can be read using + the `[]` operator.,operatorarray__key_type_const} + + @sa @ref at(const typename object_t::key_type&) for access by reference + with range checking + @sa @ref value() for access by value with a default value + + @since version 1.0.0 + */ + template + const_reference operator[](T * (&key)[n]) const + { + return operator[](static_cast(key)); + } + + /*! + @brief access specified object element + + Returns a reference to the element at with specified key @a key. + + @note If @a key is not found in the object, then it is silently added to + the object and filled with a `null` value to make `key` a valid reference. + In case the value was `null` before, it is converted to an object. + + @param[in] key key of the element to access + + @return reference to the element at key @a key + + @throw std::domain_error if JSON is not an object or null; example: + `"cannot use operator[] with string"` + + @complexity Logarithmic in the size of the container. + + @liveexample{The example below shows how object elements can be read and + written using the `[]` operator.,operatorarray__key_type} + + @sa @ref at(const typename object_t::key_type&) for access by reference + with range checking + @sa @ref value() for access by value with a default value + + @since version 1.1.0 + */ + template + reference operator[](T* key) + { + // implicitly convert null to object + if (is_null()) + { + m_type = value_t::object; + m_value = value_t::object; + } + + // at only works for objects + if (is_object()) + { + assert(m_value.object != nullptr); + return m_value.object->operator[](key); + } + else + { + throw std::domain_error("cannot use operator[] with " + type_name()); + } + } + + /*! + @brief read-only access specified object element + + Returns a const reference to the element at with specified key @a key. No + bounds checking is performed. + + @warning If the element with key @a key does not exist, the behavior is + undefined. + + @param[in] key key of the element to access + + @return const reference to the element at key @a key + + @throw std::domain_error if JSON is not an object; example: `"cannot use + operator[] with null"` + + @complexity Logarithmic in the size of the container. + + @liveexample{The example below shows how object elements can be read using + the `[]` operator.,operatorarray__key_type_const} + + @sa @ref at(const typename object_t::key_type&) for access by reference + with range checking + @sa @ref value() for access by value with a default value + + @since version 1.1.0 + */ + template + const_reference operator[](T* key) const + { + // at only works for objects + if (is_object()) + { + assert(m_value.object != nullptr); + assert(m_value.object->find(key) != m_value.object->end()); + return m_value.object->find(key)->second; + } + else + { + throw std::domain_error("cannot use operator[] with " + type_name()); + } + } + + /*! + @brief access specified object element with default value + + Returns either a copy of an object's element at the specified key @a key or + a given default value if no element with key @a key exists. + + The function is basically equivalent to executing + @code {.cpp} + try { + return at(key); + } catch(std::out_of_range) { + return default_value; + } + @endcode + + @note Unlike @ref at(const typename object_t::key_type&), this function + does not throw if the given key @a key was not found. + + @note Unlike @ref operator[](const typename object_t::key_type& key), this + function does not implicitly add an element to the position defined by @a + key. This function is furthermore also applicable to const objects. + + @param[in] key key of the element to access + @param[in] default_value the value to return if @a key is not found + + @tparam ValueType type compatible to JSON values, for instance `int` for + JSON integer numbers, `bool` for JSON booleans, or `std::vector` types for + JSON arrays. Note the type of the expected value at @a key and the default + value @a default_value must be compatible. + + @return copy of the element at key @a key or @a default_value if @a key + is not found + + @throw std::domain_error if JSON is not an object; example: `"cannot use + value() with null"` + + @complexity Logarithmic in the size of the container. + + @liveexample{The example below shows how object elements can be queried + with a default value.,basic_json__value} + + @sa @ref at(const typename object_t::key_type&) for access by reference + with range checking + @sa @ref operator[](const typename object_t::key_type&) for unchecked + access by reference + + @since version 1.0.0 + */ + template ::value + , int>::type = 0> + ValueType value(const typename object_t::key_type& key, ValueType default_value) const + { + // at only works for objects + if (is_object()) + { + // if key is found, return value and given default value otherwise + const auto it = find(key); + if (it != end()) + { + return *it; + } + else + { + return default_value; + } + } + else + { + throw std::domain_error("cannot use value() with " + type_name()); + } + } + + /*! + @brief overload for a default value of type const char* + @copydoc basic_json::value() + */ + string_t value(const typename object_t::key_type& key, const char* default_value) const + { + return value(key, string_t(default_value)); + } + + /*! + @brief access the first element + + Returns a reference to the first element in the container. For a JSON + container `c`, the expression `c.front()` is equivalent to `*c.begin()`. + + @return In case of a structured type (array or object), a reference to the + first element is returned. In cast of number, string, or boolean values, a + reference to the value is returned. + + @complexity Constant. + + @pre The JSON value must not be `null` (would throw `std::out_of_range`) or + an empty array or object (undefined behavior, guarded by assertions). + @post The JSON value remains unchanged. + + @throw std::out_of_range when called on `null` value + + @liveexample{The following code shows an example for `front()`.,front} + + @sa @ref back() -- access the last element + + @since version 1.0.0 + */ + reference front() + { + return *begin(); + } + + /*! + @copydoc basic_json::front() + */ + const_reference front() const + { + return *cbegin(); + } + + /*! + @brief access the last element + + Returns a reference to the last element in the container. For a JSON + container `c`, the expression `c.back()` is equivalent to + @code {.cpp} + auto tmp = c.end(); + --tmp; + return *tmp; + @endcode + + @return In case of a structured type (array or object), a reference to the + last element is returned. In cast of number, string, or boolean values, a + reference to the value is returned. + + @complexity Constant. + + @pre The JSON value must not be `null` (would throw `std::out_of_range`) or + an empty array or object (undefined behavior, guarded by assertions). + @post The JSON value remains unchanged. + + @throw std::out_of_range when called on `null` value. + + @liveexample{The following code shows an example for `back()`.,back} + + @sa @ref front() -- access the first element + + @since version 1.0.0 + */ + reference back() + { + auto tmp = end(); + --tmp; + return *tmp; + } + + /*! + @copydoc basic_json::back() + */ + const_reference back() const + { + auto tmp = cend(); + --tmp; + return *tmp; + } + + /*! + @brief remove element given an iterator + + Removes the element specified by iterator @a pos. The iterator @a pos must + be valid and dereferenceable. Thus the `end()` iterator (which is valid, + but is not dereferenceable) cannot be used as a value for @a pos. + + If called on a primitive type other than `null`, the resulting JSON value + will be `null`. + + @param[in] pos iterator to the element to remove + @return Iterator following the last removed element. If the iterator @a pos + refers to the last element, the `end()` iterator is returned. + + @tparam InteratorType an @ref iterator or @ref const_iterator + + @post Invalidates iterators and references at or after the point of the + erase, including the `end()` iterator. + + @throw std::domain_error if called on a `null` value; example: `"cannot use + erase() with null"` + @throw std::domain_error if called on an iterator which does not belong to + the current JSON value; example: `"iterator does not fit current value"` + @throw std::out_of_range if called on a primitive type with invalid + iterator (i.e., any iterator which is not `begin()`); example: `"iterator + out of range"` + + @complexity The complexity depends on the type: + - objects: amortized constant + - arrays: linear in distance between pos and the end of the container + - strings: linear in the length of the string + - other types: constant + + @liveexample{The example shows the result of `erase()` for different JSON + types.,erase__IteratorType} + + @sa @ref erase(InteratorType, InteratorType) -- removes the elements in the + given range + @sa @ref erase(const typename object_t::key_type&) -- removes the element + from an object at the given key + @sa @ref erase(const size_type) -- removes the element from an array at the + given index + + @since version 1.0.0 + */ + template ::value or + std::is_same::value + , int>::type + = 0> + InteratorType erase(InteratorType pos) + { + // make sure iterator fits the current value + if (this != pos.m_object) + { + throw std::domain_error("iterator does not fit current value"); + } + + InteratorType result = end(); + + switch (m_type) + { + case value_t::boolean: + case value_t::number_float: + case value_t::number_integer: + case value_t::number_unsigned: + case value_t::string: + { + if (not pos.m_it.primitive_iterator.is_begin()) + { + throw std::out_of_range("iterator out of range"); + } + + if (is_string()) + { + delete m_value.string; + m_value.string = nullptr; + } + + m_type = value_t::null; + break; + } + + case value_t::object: + { + assert(m_value.object != nullptr); + result.m_it.object_iterator = m_value.object->erase(pos.m_it.object_iterator); + break; + } + + case value_t::array: + { + assert(m_value.array != nullptr); + result.m_it.array_iterator = m_value.array->erase(pos.m_it.array_iterator); + break; + } + + default: + { + throw std::domain_error("cannot use erase() with " + type_name()); + } + } + + return result; + } + + /*! + @brief remove elements given an iterator range + + Removes the element specified by the range `[first; last)`. The iterator @a + first does not need to be dereferenceable if `first == last`: erasing an + empty range is a no-op. + + If called on a primitive type other than `null`, the resulting JSON value + will be `null`. + + @param[in] first iterator to the beginning of the range to remove + @param[in] last iterator past the end of the range to remove + @return Iterator following the last removed element. If the iterator @a + second refers to the last element, the `end()` iterator is returned. + + @tparam InteratorType an @ref iterator or @ref const_iterator + + @post Invalidates iterators and references at or after the point of the + erase, including the `end()` iterator. + + @throw std::domain_error if called on a `null` value; example: `"cannot use + erase() with null"` + @throw std::domain_error if called on iterators which does not belong to + the current JSON value; example: `"iterators do not fit current value"` + @throw std::out_of_range if called on a primitive type with invalid + iterators (i.e., if `first != begin()` and `last != end()`); example: + `"iterators out of range"` + + @complexity The complexity depends on the type: + - objects: `log(size()) + std::distance(first, last)` + - arrays: linear in the distance between @a first and @a last, plus linear + in the distance between @a last and end of the container + - strings: linear in the length of the string + - other types: constant + + @liveexample{The example shows the result of `erase()` for different JSON + types.,erase__IteratorType_IteratorType} + + @sa @ref erase(InteratorType) -- removes the element at a given position + @sa @ref erase(const typename object_t::key_type&) -- removes the element + from an object at the given key + @sa @ref erase(const size_type) -- removes the element from an array at the + given index + + @since version 1.0.0 + */ + template ::value or + std::is_same::value + , int>::type + = 0> + InteratorType erase(InteratorType first, InteratorType last) + { + // make sure iterator fits the current value + if (this != first.m_object or this != last.m_object) + { + throw std::domain_error("iterators do not fit current value"); + } + + InteratorType result = end(); + + switch (m_type) + { + case value_t::boolean: + case value_t::number_float: + case value_t::number_integer: + case value_t::number_unsigned: + case value_t::string: + { + if (not first.m_it.primitive_iterator.is_begin() or not last.m_it.primitive_iterator.is_end()) + { + throw std::out_of_range("iterators out of range"); + } + + if (is_string()) + { + delete m_value.string; + m_value.string = nullptr; + } + + m_type = value_t::null; + break; + } + + case value_t::object: + { + assert(m_value.object != nullptr); + result.m_it.object_iterator = m_value.object->erase(first.m_it.object_iterator, + last.m_it.object_iterator); + break; + } + + case value_t::array: + { + assert(m_value.array != nullptr); + result.m_it.array_iterator = m_value.array->erase(first.m_it.array_iterator, + last.m_it.array_iterator); + break; + } + + default: + { + throw std::domain_error("cannot use erase() with " + type_name()); + } + } + + return result; + } + + /*! + @brief remove element from a JSON object given a key + + Removes elements from a JSON object with the key value @a key. + + @param[in] key value of the elements to remove + + @return Number of elements removed. If @a ObjectType is the default + `std::map` type, the return value will always be `0` (@a key was not found) + or `1` (@a key was found). + + @post References and iterators to the erased elements are invalidated. + Other references and iterators are not affected. + + @throw std::domain_error when called on a type other than JSON object; + example: `"cannot use erase() with null"` + + @complexity `log(size()) + count(key)` + + @liveexample{The example shows the effect of `erase()`.,erase__key_type} + + @sa @ref erase(InteratorType) -- removes the element at a given position + @sa @ref erase(InteratorType, InteratorType) -- removes the elements in the + given range + @sa @ref erase(const size_type) -- removes the element from an array at the + given index + + @since version 1.0.0 + */ + size_type erase(const typename object_t::key_type& key) + { + // this erase only works for objects + if (is_object()) + { + assert(m_value.object != nullptr); + return m_value.object->erase(key); + } + else + { + throw std::domain_error("cannot use erase() with " + type_name()); + } + } + + /*! + @brief remove element from a JSON array given an index + + Removes element from a JSON array at the index @a idx. + + @param[in] idx index of the element to remove + + @throw std::domain_error when called on a type other than JSON array; + example: `"cannot use erase() with null"` + @throw std::out_of_range when `idx >= size()`; example: `"index out of + range"` + + @complexity Linear in distance between @a idx and the end of the container. + + @liveexample{The example shows the effect of `erase()`.,erase__size_type} + + @sa @ref erase(InteratorType) -- removes the element at a given position + @sa @ref erase(InteratorType, InteratorType) -- removes the elements in the + given range + @sa @ref erase(const typename object_t::key_type&) -- removes the element + from an object at the given key + + @since version 1.0.0 + */ + void erase(const size_type idx) + { + // this erase only works for arrays + if (is_array()) + { + if (idx >= size()) + { + throw std::out_of_range("index out of range"); + } + + assert(m_value.array != nullptr); + m_value.array->erase(m_value.array->begin() + static_cast(idx)); + } + else + { + throw std::domain_error("cannot use erase() with " + type_name()); + } + } + + /// @} + + + //////////// + // lookup // + //////////// + + /// @name lookup + /// @{ + + /*! + @brief find an element in a JSON object + + Finds an element in a JSON object with key equivalent to @a key. If the + element is not found or the JSON value is not an object, end() is returned. + + @param[in] key key value of the element to search for + + @return Iterator to an element with key equivalent to @a key. If no such + element is found, past-the-end (see end()) iterator is returned. + + @complexity Logarithmic in the size of the JSON object. + + @liveexample{The example shows how `find()` is used.,find__key_type} + + @since version 1.0.0 + */ + iterator find(typename object_t::key_type key) + { + auto result = end(); + + if (is_object()) + { + assert(m_value.object != nullptr); + result.m_it.object_iterator = m_value.object->find(key); + } + + return result; + } + + /*! + @brief find an element in a JSON object + @copydoc find(typename object_t::key_type) + */ + const_iterator find(typename object_t::key_type key) const + { + auto result = cend(); + + if (is_object()) + { + assert(m_value.object != nullptr); + result.m_it.object_iterator = m_value.object->find(key); + } + + return result; + } + + /*! + @brief returns the number of occurrences of a key in a JSON object + + Returns the number of elements with key @a key. If ObjectType is the + default `std::map` type, the return value will always be `0` (@a key was + not found) or `1` (@a key was found). + + @param[in] key key value of the element to count + + @return Number of elements with key @a key. If the JSON value is not an + object, the return value will be `0`. + + @complexity Logarithmic in the size of the JSON object. + + @liveexample{The example shows how `count()` is used.,count} + + @since version 1.0.0 + */ + size_type count(typename object_t::key_type key) const + { + // return 0 for all nonobject types + assert(not is_object() or m_value.object != nullptr); + return is_object() ? m_value.object->count(key) : 0; + } + + /// @} + + + /////////////// + // iterators // + /////////////// + + /// @name iterators + /// @{ + + /*! + @brief returns an iterator to the first element + + Returns an iterator to the first element. + + @image html range-begin-end.svg "Illustration from cppreference.com" + + @return iterator to the first element + + @complexity Constant. + + @requirement This function helps `basic_json` satisfying the + [Container](http://en.cppreference.com/w/cpp/concept/Container) + requirements: + - The complexity is constant. + + @liveexample{The following code shows an example for `begin()`.,begin} + + @sa @ref cbegin() -- returns a const iterator to the beginning + @sa @ref end() -- returns an iterator to the end + @sa @ref cend() -- returns a const iterator to the end + + @since version 1.0.0 + */ + iterator begin() noexcept + { + iterator result(this); + result.set_begin(); + return result; + } + + /*! + @copydoc basic_json::cbegin() + */ + const_iterator begin() const noexcept + { + return cbegin(); + } + + /*! + @brief returns a const iterator to the first element + + Returns a const iterator to the first element. + + @image html range-begin-end.svg "Illustration from cppreference.com" + + @return const iterator to the first element + + @complexity Constant. + + @requirement This function helps `basic_json` satisfying the + [Container](http://en.cppreference.com/w/cpp/concept/Container) + requirements: + - The complexity is constant. + - Has the semantics of `const_cast(*this).begin()`. + + @liveexample{The following code shows an example for `cbegin()`.,cbegin} + + @sa @ref begin() -- returns an iterator to the beginning + @sa @ref end() -- returns an iterator to the end + @sa @ref cend() -- returns a const iterator to the end + + @since version 1.0.0 + */ + const_iterator cbegin() const noexcept + { + const_iterator result(this); + result.set_begin(); + return result; + } + + /*! + @brief returns an iterator to one past the last element + + Returns an iterator to one past the last element. + + @image html range-begin-end.svg "Illustration from cppreference.com" + + @return iterator one past the last element + + @complexity Constant. + + @requirement This function helps `basic_json` satisfying the + [Container](http://en.cppreference.com/w/cpp/concept/Container) + requirements: + - The complexity is constant. + + @liveexample{The following code shows an example for `end()`.,end} + + @sa @ref cend() -- returns a const iterator to the end + @sa @ref begin() -- returns an iterator to the beginning + @sa @ref cbegin() -- returns a const iterator to the beginning + + @since version 1.0.0 + */ + iterator end() noexcept + { + iterator result(this); + result.set_end(); + return result; + } + + /*! + @copydoc basic_json::cend() + */ + const_iterator end() const noexcept + { + return cend(); + } + + /*! + @brief returns a const iterator to one past the last element + + Returns a const iterator to one past the last element. + + @image html range-begin-end.svg "Illustration from cppreference.com" + + @return const iterator one past the last element + + @complexity Constant. + + @requirement This function helps `basic_json` satisfying the + [Container](http://en.cppreference.com/w/cpp/concept/Container) + requirements: + - The complexity is constant. + - Has the semantics of `const_cast(*this).end()`. + + @liveexample{The following code shows an example for `cend()`.,cend} + + @sa @ref end() -- returns an iterator to the end + @sa @ref begin() -- returns an iterator to the beginning + @sa @ref cbegin() -- returns a const iterator to the beginning + + @since version 1.0.0 + */ + const_iterator cend() const noexcept + { + const_iterator result(this); + result.set_end(); + return result; + } + + /*! + @brief returns an iterator to the reverse-beginning + + Returns an iterator to the reverse-beginning; that is, the last element. + + @image html range-rbegin-rend.svg "Illustration from cppreference.com" + + @complexity Constant. + + @requirement This function helps `basic_json` satisfying the + [ReversibleContainer](http://en.cppreference.com/w/cpp/concept/ReversibleContainer) + requirements: + - The complexity is constant. + - Has the semantics of `reverse_iterator(end())`. + + @liveexample{The following code shows an example for `rbegin()`.,rbegin} + + @sa @ref crbegin() -- returns a const reverse iterator to the beginning + @sa @ref rend() -- returns a reverse iterator to the end + @sa @ref crend() -- returns a const reverse iterator to the end + + @since version 1.0.0 + */ + reverse_iterator rbegin() noexcept + { + return reverse_iterator(end()); + } + + /*! + @copydoc basic_json::crbegin() + */ + const_reverse_iterator rbegin() const noexcept + { + return crbegin(); + } + + /*! + @brief returns an iterator to the reverse-end + + Returns an iterator to the reverse-end; that is, one before the first + element. + + @image html range-rbegin-rend.svg "Illustration from cppreference.com" + + @complexity Constant. + + @requirement This function helps `basic_json` satisfying the + [ReversibleContainer](http://en.cppreference.com/w/cpp/concept/ReversibleContainer) + requirements: + - The complexity is constant. + - Has the semantics of `reverse_iterator(begin())`. + + @liveexample{The following code shows an example for `rend()`.,rend} + + @sa @ref crend() -- returns a const reverse iterator to the end + @sa @ref rbegin() -- returns a reverse iterator to the beginning + @sa @ref crbegin() -- returns a const reverse iterator to the beginning + + @since version 1.0.0 + */ + reverse_iterator rend() noexcept + { + return reverse_iterator(begin()); + } + + /*! + @copydoc basic_json::crend() + */ + const_reverse_iterator rend() const noexcept + { + return crend(); + } + + /*! + @brief returns a const reverse iterator to the last element + + Returns a const iterator to the reverse-beginning; that is, the last + element. + + @image html range-rbegin-rend.svg "Illustration from cppreference.com" + + @complexity Constant. + + @requirement This function helps `basic_json` satisfying the + [ReversibleContainer](http://en.cppreference.com/w/cpp/concept/ReversibleContainer) + requirements: + - The complexity is constant. + - Has the semantics of `const_cast(*this).rbegin()`. + + @liveexample{The following code shows an example for `crbegin()`.,crbegin} + + @sa @ref rbegin() -- returns a reverse iterator to the beginning + @sa @ref rend() -- returns a reverse iterator to the end + @sa @ref crend() -- returns a const reverse iterator to the end + + @since version 1.0.0 + */ + const_reverse_iterator crbegin() const noexcept + { + return const_reverse_iterator(cend()); + } + + /*! + @brief returns a const reverse iterator to one before the first + + Returns a const reverse iterator to the reverse-end; that is, one before + the first element. + + @image html range-rbegin-rend.svg "Illustration from cppreference.com" + + @complexity Constant. + + @requirement This function helps `basic_json` satisfying the + [ReversibleContainer](http://en.cppreference.com/w/cpp/concept/ReversibleContainer) + requirements: + - The complexity is constant. + - Has the semantics of `const_cast(*this).rend()`. + + @liveexample{The following code shows an example for `crend()`.,crend} + + @sa @ref rend() -- returns a reverse iterator to the end + @sa @ref rbegin() -- returns a reverse iterator to the beginning + @sa @ref crbegin() -- returns a const reverse iterator to the beginning + + @since version 1.0.0 + */ + const_reverse_iterator crend() const noexcept + { + return const_reverse_iterator(cbegin()); + } + + private: + // forward declaration + template class iteration_proxy; + + public: + /*! + @brief wrapper to access iterator member functions in range-based for + + This function allows to access @ref iterator::key() and @ref + iterator::value() during range-based for loops. In these loops, a reference + to the JSON values is returned, so there is no access to the underlying + iterator. + + @note The name of this function is not yet final and may change in the + future. + */ + static iteration_proxy iterator_wrapper(reference cont) + { + return iteration_proxy(cont); + } + + /*! + @copydoc iterator_wrapper(reference) + */ + static iteration_proxy iterator_wrapper(const_reference cont) + { + return iteration_proxy(cont); + } + + /// @} + + + ////////////// + // capacity // + ////////////// + + /// @name capacity + /// @{ + + /*! + @brief checks whether the container is empty + + Checks if a JSON value has no elements. + + @return The return value depends on the different types and is + defined as follows: + Value type | return value + ----------- | ------------- + null | `true` + boolean | `false` + string | `false` + number | `false` + object | result of function `object_t::empty()` + array | result of function `array_t::empty()` + + @complexity Constant, as long as @ref array_t and @ref object_t satisfy the + Container concept; that is, their `empty()` functions have constant + complexity. + + @requirement This function helps `basic_json` satisfying the + [Container](http://en.cppreference.com/w/cpp/concept/Container) + requirements: + - The complexity is constant. + - Has the semantics of `begin() == end()`. + + @liveexample{The following code uses `empty()` to check if a JSON + object contains any elements.,empty} + + @sa @ref size() -- returns the number of elements + + @since version 1.0.0 + */ + bool empty() const noexcept + { + switch (m_type) + { + case value_t::null: + { + // null values are empty + return true; + } + + case value_t::array: + { + assert(m_value.array != nullptr); + return m_value.array->empty(); + } + + case value_t::object: + { + assert(m_value.object != nullptr); + return m_value.object->empty(); + } + + default: + { + // all other types are nonempty + return false; + } + } + } + + /*! + @brief returns the number of elements + + Returns the number of elements in a JSON value. + + @return The return value depends on the different types and is + defined as follows: + Value type | return value + ----------- | ------------- + null | `0` + boolean | `1` + string | `1` + number | `1` + object | result of function object_t::size() + array | result of function array_t::size() + + @complexity Constant, as long as @ref array_t and @ref object_t satisfy the + Container concept; that is, their size() functions have constant complexity. + + @requirement This function helps `basic_json` satisfying the + [Container](http://en.cppreference.com/w/cpp/concept/Container) + requirements: + - The complexity is constant. + - Has the semantics of `std::distance(begin(), end())`. + + @liveexample{The following code calls `size()` on the different value + types.,size} + + @sa @ref empty() -- checks whether the container is empty + @sa @ref max_size() -- returns the maximal number of elements + + @since version 1.0.0 + */ + size_type size() const noexcept + { + switch (m_type) + { + case value_t::null: + { + // null values are empty + return 0; + } + + case value_t::array: + { + assert(m_value.array != nullptr); + return m_value.array->size(); + } + + case value_t::object: + { + assert(m_value.object != nullptr); + return m_value.object->size(); + } + + default: + { + // all other types have size 1 + return 1; + } + } + } + + /*! + @brief returns the maximum possible number of elements + + Returns the maximum number of elements a JSON value is able to hold due to + system or library implementation limitations, i.e. `std::distance(begin(), + end())` for the JSON value. + + @return The return value depends on the different types and is + defined as follows: + Value type | return value + ----------- | ------------- + null | `0` (same as `size()`) + boolean | `1` (same as `size()`) + string | `1` (same as `size()`) + number | `1` (same as `size()`) + object | result of function `object_t::max_size()` + array | result of function `array_t::max_size()` + + @complexity Constant, as long as @ref array_t and @ref object_t satisfy the + Container concept; that is, their `max_size()` functions have constant + complexity. + + @requirement This function helps `basic_json` satisfying the + [Container](http://en.cppreference.com/w/cpp/concept/Container) + requirements: + - The complexity is constant. + - Has the semantics of returning `b.size()` where `b` is the largest + possible JSON value. + + @liveexample{The following code calls `max_size()` on the different value + types. Note the output is implementation specific.,max_size} + + @sa @ref size() -- returns the number of elements + + @since version 1.0.0 + */ + size_type max_size() const noexcept + { + switch (m_type) + { + case value_t::array: + { + assert(m_value.array != nullptr); + return m_value.array->max_size(); + } + + case value_t::object: + { + assert(m_value.object != nullptr); + return m_value.object->max_size(); + } + + default: + { + // all other types have max_size() == size() + return size(); + } + } + } + + /// @} + + + /////////////// + // modifiers // + /////////////// + + /// @name modifiers + /// @{ + + /*! + @brief clears the contents + + Clears the content of a JSON value and resets it to the default value as + if @ref basic_json(value_t) would have been called: + + Value type | initial value + ----------- | ------------- + null | `null` + boolean | `false` + string | `""` + number | `0` + object | `{}` + array | `[]` + + @note Floating-point numbers are set to `0.0` which will be serialized to + `0`. The vale type remains @ref number_float_t. + + @complexity Linear in the size of the JSON value. + + @liveexample{The example below shows the effect of `clear()` to different + JSON types.,clear} + + @since version 1.0.0 + */ + void clear() noexcept + { + switch (m_type) + { + case value_t::number_integer: + { + m_value.number_integer = 0; + break; + } + + case value_t::number_unsigned: + { + m_value.number_unsigned = 0; + break; + } + + case value_t::number_float: + { + m_value.number_float = 0.0; + break; + } + + case value_t::boolean: + { + m_value.boolean = false; + break; + } + + case value_t::string: + { + assert(m_value.string != nullptr); + m_value.string->clear(); + break; + } + + case value_t::array: + { + assert(m_value.array != nullptr); + m_value.array->clear(); + break; + } + + case value_t::object: + { + assert(m_value.object != nullptr); + m_value.object->clear(); + break; + } + + default: + { + break; + } + } + } + + /*! + @brief add an object to an array + + Appends the given element @a val to the end of the JSON value. If the + function is called on a JSON null value, an empty array is created before + appending @a val. + + @param[in] val the value to add to the JSON array + + @throw std::domain_error when called on a type other than JSON array or + null; example: `"cannot use push_back() with number"` + + @complexity Amortized constant. + + @liveexample{The example shows how `push_back()` and `+=` can be used to + add elements to a JSON array. Note how the `null` value was silently + converted to a JSON array.,push_back} + + @since version 1.0.0 + */ + void push_back(basic_json&& val) + { + // push_back only works for null objects or arrays + if (not(is_null() or is_array())) + { + throw std::domain_error("cannot use push_back() with " + type_name()); + } + + // transform null object into an array + if (is_null()) + { + m_type = value_t::array; + m_value = value_t::array; + } + + // add element to array (move semantics) + assert(m_value.array != nullptr); + m_value.array->push_back(std::move(val)); + // invalidate object + val.m_type = value_t::null; + } + + /*! + @brief add an object to an array + @copydoc push_back(basic_json&&) + */ + reference operator+=(basic_json&& val) + { + push_back(std::move(val)); + return *this; + } + + /*! + @brief add an object to an array + @copydoc push_back(basic_json&&) + */ + void push_back(const basic_json& val) + { + // push_back only works for null objects or arrays + if (not(is_null() or is_array())) + { + throw std::domain_error("cannot use push_back() with " + type_name()); + } + + // transform null object into an array + if (is_null()) + { + m_type = value_t::array; + m_value = value_t::array; + } + + // add element to array + assert(m_value.array != nullptr); + m_value.array->push_back(val); + } + + /*! + @brief add an object to an array + @copydoc push_back(basic_json&&) + */ + reference operator+=(const basic_json& val) + { + push_back(val); + return *this; + } + + /*! + @brief add an object to an object + + Inserts the given element @a val to the JSON object. If the function is + called on a JSON null value, an empty object is created before inserting @a + val. + + @param[in] val the value to add to the JSON object + + @throw std::domain_error when called on a type other than JSON object or + null; example: `"cannot use push_back() with number"` + + @complexity Logarithmic in the size of the container, O(log(`size()`)). + + @liveexample{The example shows how `push_back()` and `+=` can be used to + add elements to a JSON object. Note how the `null` value was silently + converted to a JSON object.,push_back__object_t__value} + + @since version 1.0.0 + */ + void push_back(const typename object_t::value_type& val) + { + // push_back only works for null objects or objects + if (not(is_null() or is_object())) + { + throw std::domain_error("cannot use push_back() with " + type_name()); + } + + // transform null object into an object + if (is_null()) + { + m_type = value_t::object; + m_value = value_t::object; + } + + // add element to array + assert(m_value.object != nullptr); + m_value.object->insert(val); + } + + /*! + @brief add an object to an object + @copydoc push_back(const typename object_t::value_type&) + */ + reference operator+=(const typename object_t::value_type& val) + { + push_back(val); + return operator[](val.first); + } + + /*! + @brief inserts element + + Inserts element @a val before iterator @a pos. + + @param[in] pos iterator before which the content will be inserted; may be + the end() iterator + @param[in] val element to insert + @return iterator pointing to the inserted @a val. + + @throw std::domain_error if called on JSON values other than arrays; + example: `"cannot use insert() with string"` + @throw std::domain_error if @a pos is not an iterator of *this; example: + `"iterator does not fit current value"` + + @complexity Constant plus linear in the distance between pos and end of the + container. + + @liveexample{The example shows how `insert()` is used.,insert} + + @since version 1.0.0 + */ + iterator insert(const_iterator pos, const basic_json& val) + { + // insert only works for arrays + if (is_array()) + { + // check if iterator pos fits to this JSON value + if (pos.m_object != this) + { + throw std::domain_error("iterator does not fit current value"); + } + + // insert to array and return iterator + iterator result(this); + assert(m_value.array != nullptr); + result.m_it.array_iterator = m_value.array->insert(pos.m_it.array_iterator, val); + return result; + } + else + { + throw std::domain_error("cannot use insert() with " + type_name()); + } + } + + /*! + @brief inserts element + @copydoc insert(const_iterator, const basic_json&) + */ + iterator insert(const_iterator pos, basic_json&& val) + { + return insert(pos, val); + } + + /*! + @brief inserts elements + + Inserts @a cnt copies of @a val before iterator @a pos. + + @param[in] pos iterator before which the content will be inserted; may be + the end() iterator + @param[in] cnt number of copies of @a val to insert + @param[in] val element to insert + @return iterator pointing to the first element inserted, or @a pos if + `cnt==0` + + @throw std::domain_error if called on JSON values other than arrays; + example: `"cannot use insert() with string"` + @throw std::domain_error if @a pos is not an iterator of *this; example: + `"iterator does not fit current value"` + + @complexity Linear in @a cnt plus linear in the distance between @a pos + and end of the container. + + @liveexample{The example shows how `insert()` is used.,insert__count} + + @since version 1.0.0 + */ + iterator insert(const_iterator pos, size_type cnt, const basic_json& val) + { + // insert only works for arrays + if (is_array()) + { + // check if iterator pos fits to this JSON value + if (pos.m_object != this) + { + throw std::domain_error("iterator does not fit current value"); + } + + // insert to array and return iterator + iterator result(this); + assert(m_value.array != nullptr); + result.m_it.array_iterator = m_value.array->insert(pos.m_it.array_iterator, cnt, val); + return result; + } + else + { + throw std::domain_error("cannot use insert() with " + type_name()); + } + } + + /*! + @brief inserts elements + + Inserts elements from range `[first, last)` before iterator @a pos. + + @param[in] pos iterator before which the content will be inserted; may be + the end() iterator + @param[in] first begin of the range of elements to insert + @param[in] last end of the range of elements to insert + + @throw std::domain_error if called on JSON values other than arrays; + example: `"cannot use insert() with string"` + @throw std::domain_error if @a pos is not an iterator of *this; example: + `"iterator does not fit current value"` + @throw std::domain_error if @a first and @a last do not belong to the same + JSON value; example: `"iterators do not fit"` + @throw std::domain_error if @a first or @a last are iterators into + container for which insert is called; example: `"passed iterators may not + belong to container"` + + @return iterator pointing to the first element inserted, or @a pos if + `first==last` + + @complexity Linear in `std::distance(first, last)` plus linear in the + distance between @a pos and end of the container. + + @liveexample{The example shows how `insert()` is used.,insert__range} + + @since version 1.0.0 + */ + iterator insert(const_iterator pos, const_iterator first, const_iterator last) + { + // insert only works for arrays + if (not is_array()) + { + throw std::domain_error("cannot use insert() with " + type_name()); + } + + // check if iterator pos fits to this JSON value + if (pos.m_object != this) + { + throw std::domain_error("iterator does not fit current value"); + } + + if (first.m_object != last.m_object) + { + throw std::domain_error("iterators do not fit"); + } + + if (first.m_object == this or last.m_object == this) + { + throw std::domain_error("passed iterators may not belong to container"); + } + + // insert to array and return iterator + iterator result(this); + assert(m_value.array != nullptr); + result.m_it.array_iterator = m_value.array->insert( + pos.m_it.array_iterator, + first.m_it.array_iterator, + last.m_it.array_iterator); + return result; + } + + /*! + @brief inserts elements + + Inserts elements from initializer list @a ilist before iterator @a pos. + + @param[in] pos iterator before which the content will be inserted; may be + the end() iterator + @param[in] ilist initializer list to insert the values from + + @throw std::domain_error if called on JSON values other than arrays; + example: `"cannot use insert() with string"` + @throw std::domain_error if @a pos is not an iterator of *this; example: + `"iterator does not fit current value"` + + @return iterator pointing to the first element inserted, or @a pos if + `ilist` is empty + + @complexity Linear in `ilist.size()` plus linear in the distance between @a + pos and end of the container. + + @liveexample{The example shows how `insert()` is used.,insert__ilist} + + @since version 1.0.0 + */ + iterator insert(const_iterator pos, std::initializer_list ilist) + { + // insert only works for arrays + if (not is_array()) + { + throw std::domain_error("cannot use insert() with " + type_name()); + } + + // check if iterator pos fits to this JSON value + if (pos.m_object != this) + { + throw std::domain_error("iterator does not fit current value"); + } + + // insert to array and return iterator + iterator result(this); + assert(m_value.array != nullptr); + result.m_it.array_iterator = m_value.array->insert(pos.m_it.array_iterator, ilist); + return result; + } + + /*! + @brief exchanges the values + + Exchanges the contents of the JSON value with those of @a other. Does not + invoke any move, copy, or swap operations on individual elements. All + iterators and references remain valid. The past-the-end iterator is + invalidated. + + @param[in,out] other JSON value to exchange the contents with + + @complexity Constant. + + @liveexample{The example below shows how JSON values can be swapped with + `swap()`.,swap__reference} + + @since version 1.0.0 + */ + void swap(reference other) noexcept ( + std::is_nothrow_move_constructible::value and + std::is_nothrow_move_assignable::value and + std::is_nothrow_move_constructible::value and + std::is_nothrow_move_assignable::value + ) + { + std::swap(m_type, other.m_type); + std::swap(m_value, other.m_value); + } + + /*! + @brief exchanges the values + + Exchanges the contents of a JSON array with those of @a other. Does not + invoke any move, copy, or swap operations on individual elements. All + iterators and references remain valid. The past-the-end iterator is + invalidated. + + @param[in,out] other array to exchange the contents with + + @throw std::domain_error when JSON value is not an array; example: `"cannot + use swap() with string"` + + @complexity Constant. + + @liveexample{The example below shows how arrays can be swapped with + `swap()`.,swap__array_t} + + @since version 1.0.0 + */ + void swap(array_t& other) + { + // swap only works for arrays + if (is_array()) + { + assert(m_value.array != nullptr); + std::swap(*(m_value.array), other); + } + else + { + throw std::domain_error("cannot use swap() with " + type_name()); + } + } + + /*! + @brief exchanges the values + + Exchanges the contents of a JSON object with those of @a other. Does not + invoke any move, copy, or swap operations on individual elements. All + iterators and references remain valid. The past-the-end iterator is + invalidated. + + @param[in,out] other object to exchange the contents with + + @throw std::domain_error when JSON value is not an object; example: + `"cannot use swap() with string"` + + @complexity Constant. + + @liveexample{The example below shows how objects can be swapped with + `swap()`.,swap__object_t} + + @since version 1.0.0 + */ + void swap(object_t& other) + { + // swap only works for objects + if (is_object()) + { + assert(m_value.object != nullptr); + std::swap(*(m_value.object), other); + } + else + { + throw std::domain_error("cannot use swap() with " + type_name()); + } + } + + /*! + @brief exchanges the values + + Exchanges the contents of a JSON string with those of @a other. Does not + invoke any move, copy, or swap operations on individual elements. All + iterators and references remain valid. The past-the-end iterator is + invalidated. + + @param[in,out] other string to exchange the contents with + + @throw std::domain_error when JSON value is not a string; example: `"cannot + use swap() with boolean"` + + @complexity Constant. + + @liveexample{The example below shows how strings can be swapped with + `swap()`.,swap__string_t} + + @since version 1.0.0 + */ + void swap(string_t& other) + { + // swap only works for strings + if (is_string()) + { + assert(m_value.string != nullptr); + std::swap(*(m_value.string), other); + } + else + { + throw std::domain_error("cannot use swap() with " + type_name()); + } + } + + /// @} + + + ////////////////////////////////////////// + // lexicographical comparison operators // + ////////////////////////////////////////// + + /// @name lexicographical comparison operators + /// @{ + + private: + /*! + @brief comparison operator for JSON types + + Returns an ordering that is similar to Python: + - order: null < boolean < number < object < array < string + - furthermore, each type is not smaller than itself + + @since version 1.0.0 + */ + friend bool operator<(const value_t lhs, const value_t rhs) noexcept + { + static constexpr std::array order = {{ + 0, // null + 3, // object + 4, // array + 5, // string + 1, // boolean + 2, // integer + 2, // unsigned + 2, // float + } + }; + + // discarded values are not comparable + if (lhs == value_t::discarded or rhs == value_t::discarded) + { + return false; + } + + return order[static_cast(lhs)] < order[static_cast(rhs)]; + } + + public: + /*! + @brief comparison: equal + + Compares two JSON values for equality according to the following rules: + - Two JSON values are equal if (1) they are from the same type and (2) + their stored values are the same. + - Integer and floating-point numbers are automatically converted before + comparison. Floating-point numbers are compared indirectly: two + floating-point numbers `f1` and `f2` are considered equal if neither + `f1 > f2` nor `f2 > f1` holds. + - Two JSON null values are equal. + + @param[in] lhs first JSON value to consider + @param[in] rhs second JSON value to consider + @return whether the values @a lhs and @a rhs are equal + + @complexity Linear. + + @liveexample{The example demonstrates comparing several JSON + types.,operator__equal} + + @since version 1.0.0 + */ + friend bool operator==(const_reference lhs, const_reference rhs) noexcept + { + const auto lhs_type = lhs.type(); + const auto rhs_type = rhs.type(); + + if (lhs_type == rhs_type) + { + switch (lhs_type) + { + case value_t::array: + { + assert(lhs.m_value.array != nullptr); + assert(rhs.m_value.array != nullptr); + return *lhs.m_value.array == *rhs.m_value.array; + } + case value_t::object: + { + assert(lhs.m_value.object != nullptr); + assert(rhs.m_value.object != nullptr); + return *lhs.m_value.object == *rhs.m_value.object; + } + case value_t::null: + { + return true; + } + case value_t::string: + { + assert(lhs.m_value.string != nullptr); + assert(rhs.m_value.string != nullptr); + return *lhs.m_value.string == *rhs.m_value.string; + } + case value_t::boolean: + { + return lhs.m_value.boolean == rhs.m_value.boolean; + } + case value_t::number_integer: + { + return lhs.m_value.number_integer == rhs.m_value.number_integer; + } + case value_t::number_unsigned: + { + return lhs.m_value.number_unsigned == rhs.m_value.number_unsigned; + } + case value_t::number_float: + { + return lhs.m_value.number_float == rhs.m_value.number_float; + } + default: + { + return false; + } + } + } + else if (lhs_type == value_t::number_integer and rhs_type == value_t::number_float) + { + return static_cast(lhs.m_value.number_integer) == rhs.m_value.number_float; + } + else if (lhs_type == value_t::number_float and rhs_type == value_t::number_integer) + { + return lhs.m_value.number_float == static_cast(rhs.m_value.number_integer); + } + else if (lhs_type == value_t::number_unsigned and rhs_type == value_t::number_float) + { + return static_cast(lhs.m_value.number_unsigned) == rhs.m_value.number_float; + } + else if (lhs_type == value_t::number_float and rhs_type == value_t::number_unsigned) + { + return lhs.m_value.number_float == static_cast(rhs.m_value.number_unsigned); + } + else if (lhs_type == value_t::number_unsigned and rhs_type == value_t::number_integer) + { + return static_cast(lhs.m_value.number_unsigned) == rhs.m_value.number_integer; + } + else if (lhs_type == value_t::number_integer and rhs_type == value_t::number_unsigned) + { + return lhs.m_value.number_integer == static_cast(rhs.m_value.number_unsigned); + } + + return false; + } + + /*! + @brief comparison: equal + + The functions compares the given JSON value against a null pointer. As the + null pointer can be used to initialize a JSON value to null, a comparison + of JSON value @a v with a null pointer should be equivalent to call + `v.is_null()`. + + @param[in] v JSON value to consider + @return whether @a v is null + + @complexity Constant. + + @liveexample{The example compares several JSON types to the null pointer. + ,operator__equal__nullptr_t} + + @since version 1.0.0 + */ + friend bool operator==(const_reference v, std::nullptr_t) noexcept + { + return v.is_null(); + } + + /*! + @brief comparison: equal + @copydoc operator==(const_reference, std::nullptr_t) + */ + friend bool operator==(std::nullptr_t, const_reference v) noexcept + { + return v.is_null(); + } + + /*! + @brief comparison: not equal + + Compares two JSON values for inequality by calculating `not (lhs == rhs)`. + + @param[in] lhs first JSON value to consider + @param[in] rhs second JSON value to consider + @return whether the values @a lhs and @a rhs are not equal + + @complexity Linear. + + @liveexample{The example demonstrates comparing several JSON + types.,operator__notequal} + + @since version 1.0.0 + */ + friend bool operator!=(const_reference lhs, const_reference rhs) noexcept + { + return not (lhs == rhs); + } + + /*! + @brief comparison: not equal + + The functions compares the given JSON value against a null pointer. As the + null pointer can be used to initialize a JSON value to null, a comparison + of JSON value @a v with a null pointer should be equivalent to call + `not v.is_null()`. + + @param[in] v JSON value to consider + @return whether @a v is not null + + @complexity Constant. + + @liveexample{The example compares several JSON types to the null pointer. + ,operator__notequal__nullptr_t} + + @since version 1.0.0 + */ + friend bool operator!=(const_reference v, std::nullptr_t) noexcept + { + return not v.is_null(); + } + + /*! + @brief comparison: not equal + @copydoc operator!=(const_reference, std::nullptr_t) + */ + friend bool operator!=(std::nullptr_t, const_reference v) noexcept + { + return not v.is_null(); + } + + /*! + @brief comparison: less than + + Compares whether one JSON value @a lhs is less than another JSON value @a + rhs according to the following rules: + - If @a lhs and @a rhs have the same type, the values are compared using + the default `<` operator. + - Integer and floating-point numbers are automatically converted before + comparison + - In case @a lhs and @a rhs have different types, the values are ignored + and the order of the types is considered, see + @ref operator<(const value_t, const value_t). + + @param[in] lhs first JSON value to consider + @param[in] rhs second JSON value to consider + @return whether @a lhs is less than @a rhs + + @complexity Linear. + + @liveexample{The example demonstrates comparing several JSON + types.,operator__less} + + @since version 1.0.0 + */ + friend bool operator<(const_reference lhs, const_reference rhs) noexcept + { + const auto lhs_type = lhs.type(); + const auto rhs_type = rhs.type(); + + if (lhs_type == rhs_type) + { + switch (lhs_type) + { + case value_t::array: + { + assert(lhs.m_value.array != nullptr); + assert(rhs.m_value.array != nullptr); + return *lhs.m_value.array < *rhs.m_value.array; + } + case value_t::object: + { + assert(lhs.m_value.object != nullptr); + assert(rhs.m_value.object != nullptr); + return *lhs.m_value.object < *rhs.m_value.object; + } + case value_t::null: + { + return false; + } + case value_t::string: + { + assert(lhs.m_value.string != nullptr); + assert(rhs.m_value.string != nullptr); + return *lhs.m_value.string < *rhs.m_value.string; + } + case value_t::boolean: + { + return lhs.m_value.boolean < rhs.m_value.boolean; + } + case value_t::number_integer: + { + return lhs.m_value.number_integer < rhs.m_value.number_integer; + } + case value_t::number_unsigned: + { + return lhs.m_value.number_unsigned < rhs.m_value.number_unsigned; + } + case value_t::number_float: + { + return lhs.m_value.number_float < rhs.m_value.number_float; + } + default: + { + return false; + } + } + } + else if (lhs_type == value_t::number_integer and rhs_type == value_t::number_float) + { + return static_cast(lhs.m_value.number_integer) < rhs.m_value.number_float; + } + else if (lhs_type == value_t::number_float and rhs_type == value_t::number_integer) + { + return lhs.m_value.number_float < static_cast(rhs.m_value.number_integer); + } + else if (lhs_type == value_t::number_unsigned and rhs_type == value_t::number_float) + { + return static_cast(lhs.m_value.number_unsigned) < rhs.m_value.number_float; + } + else if (lhs_type == value_t::number_float and rhs_type == value_t::number_unsigned) + { + return lhs.m_value.number_float < static_cast(rhs.m_value.number_unsigned); + } + else if (lhs_type == value_t::number_integer and rhs_type == value_t::number_unsigned) + { + return lhs.m_value.number_integer < static_cast(rhs.m_value.number_unsigned); + } + else if (lhs_type == value_t::number_unsigned and rhs_type == value_t::number_integer) + { + return static_cast(lhs.m_value.number_unsigned) < rhs.m_value.number_integer; + } + + // We only reach this line if we cannot compare values. In that case, + // we compare types. Note we have to call the operator explicitly, + // because MSVC has problems otherwise. + return operator<(lhs_type, rhs_type); + } + + /*! + @brief comparison: less than or equal + + Compares whether one JSON value @a lhs is less than or equal to another + JSON value by calculating `not (rhs < lhs)`. + + @param[in] lhs first JSON value to consider + @param[in] rhs second JSON value to consider + @return whether @a lhs is less than or equal to @a rhs + + @complexity Linear. + + @liveexample{The example demonstrates comparing several JSON + types.,operator__greater} + + @since version 1.0.0 + */ + friend bool operator<=(const_reference lhs, const_reference rhs) noexcept + { + return not (rhs < lhs); + } + + /*! + @brief comparison: greater than + + Compares whether one JSON value @a lhs is greater than another + JSON value by calculating `not (lhs <= rhs)`. + + @param[in] lhs first JSON value to consider + @param[in] rhs second JSON value to consider + @return whether @a lhs is greater than to @a rhs + + @complexity Linear. + + @liveexample{The example demonstrates comparing several JSON + types.,operator__lessequal} + + @since version 1.0.0 + */ + friend bool operator>(const_reference lhs, const_reference rhs) noexcept + { + return not (lhs <= rhs); + } + + /*! + @brief comparison: greater than or equal + + Compares whether one JSON value @a lhs is greater than or equal to another + JSON value by calculating `not (lhs < rhs)`. + + @param[in] lhs first JSON value to consider + @param[in] rhs second JSON value to consider + @return whether @a lhs is greater than or equal to @a rhs + + @complexity Linear. + + @liveexample{The example demonstrates comparing several JSON + types.,operator__greaterequal} + + @since version 1.0.0 + */ + friend bool operator>=(const_reference lhs, const_reference rhs) noexcept + { + return not (lhs < rhs); + } + + /// @} + + + /////////////////// + // serialization // + /////////////////// + + /// @name serialization + /// @{ + + /*! + @brief serialize to stream + + Serialize the given JSON value @a j to the output stream @a o. The JSON + value will be serialized using the @ref dump member function. The + indentation of the output can be controlled with the member variable + `width` of the output stream @a o. For instance, using the manipulator + `std::setw(4)` on @a o sets the indentation level to `4` and the + serialization result is the same as calling `dump(4)`. + + @param[in,out] o stream to serialize to + @param[in] j JSON value to serialize + + @return the stream @a o + + @complexity Linear. + + @liveexample{The example below shows the serialization with different + parameters to `width` to adjust the indentation level.,operator_serialize} + + @since version 1.0.0 + */ + friend std::ostream& operator<<(std::ostream& o, const basic_json& j) + { + // read width member and use it as indentation parameter if nonzero + const bool pretty_print = (o.width() > 0); + const auto indentation = (pretty_print ? o.width() : 0); + + // reset width to 0 for subsequent calls to this stream + o.width(0); + + // do the actual serialization + j.dump(o, pretty_print, static_cast(indentation)); + return o; + } + + /*! + @brief serialize to stream + @copydoc operator<<(std::ostream&, const basic_json&) + */ + friend std::ostream& operator>>(const basic_json& j, std::ostream& o) + { + return o << j; + } + + /// @} + + + ///////////////////// + // deserialization // + ///////////////////// + + /// @name deserialization + /// @{ + + /*! + @brief deserialize from string + + @param[in] s string to read a serialized JSON value from + @param[in] cb a parser callback function of type @ref parser_callback_t + which is used to control the deserialization by filtering unwanted values + (optional) + + @return result of the deserialization + + @complexity Linear in the length of the input. The parser is a predictive + LL(1) parser. The complexity can be higher if the parser callback function + @a cb has a super-linear complexity. + + @note A UTF-8 byte order mark is silently ignored. + + @liveexample{The example below demonstrates the `parse()` function with and + without callback function.,parse__string__parser_callback_t} + + @sa @ref parse(std::istream&, parser_callback_t) for a version that reads + from an input stream + + @since version 1.0.0 + */ + static basic_json parse(const string_t& s, parser_callback_t cb = nullptr) + { + return parser(s, cb).parse(); + } + + /*! + @brief deserialize from stream + + @param[in,out] i stream to read a serialized JSON value from + @param[in] cb a parser callback function of type @ref parser_callback_t + which is used to control the deserialization by filtering unwanted values + (optional) + + @return result of the deserialization + + @complexity Linear in the length of the input. The parser is a predictive + LL(1) parser. The complexity can be higher if the parser callback function + @a cb has a super-linear complexity. + + @note A UTF-8 byte order mark is silently ignored. + + @liveexample{The example below demonstrates the `parse()` function with and + without callback function.,parse__istream__parser_callback_t} + + @sa @ref parse(const string_t&, parser_callback_t) for a version that reads + from a string + + @since version 1.0.0 + */ + static basic_json parse(std::istream& i, parser_callback_t cb = nullptr) + { + return parser(i, cb).parse(); + } + + /*! + @copydoc parse(std::istream&, parser_callback_t) + */ + static basic_json parse(std::istream&& i, parser_callback_t cb = nullptr) + { + return parser(i, cb).parse(); + } + + /*! + @brief deserialize from stream + + Deserializes an input stream to a JSON value. + + @param[in,out] i input stream to read a serialized JSON value from + @param[in,out] j JSON value to write the deserialized input to + + @throw std::invalid_argument in case of parse errors + + @complexity Linear in the length of the input. The parser is a predictive + LL(1) parser. + + @note A UTF-8 byte order mark is silently ignored. + + @liveexample{The example below shows how a JSON value is constructed by + reading a serialization from a stream.,operator_deserialize} + + @sa parse(std::istream&, parser_callback_t) for a variant with a parser + callback function to filter values while parsing + + @since version 1.0.0 + */ + friend std::istream& operator<<(basic_json& j, std::istream& i) + { + j = parser(i).parse(); + return i; + } + + /*! + @brief deserialize from stream + @copydoc operator<<(basic_json&, std::istream&) + */ + friend std::istream& operator>>(std::istream& i, basic_json& j) + { + j = parser(i).parse(); + return i; + } + + /// @} + + + private: + /////////////////////////// + // convenience functions // + /////////////////////////// + + /// return the type as string + string_t type_name() const noexcept + { + switch (m_type) + { + case value_t::null: + return "null"; + case value_t::object: + return "object"; + case value_t::array: + return "array"; + case value_t::string: + return "string"; + case value_t::boolean: + return "boolean"; + case value_t::discarded: + return "discarded"; + default: + return "number"; + } + } + + /*! + @brief calculates the extra space to escape a JSON string + + @param[in] s the string to escape + @return the number of characters required to escape string @a s + + @complexity Linear in the length of string @a s. + */ + static std::size_t extra_space(const string_t& s) noexcept + { + std::size_t result = 0; + + for (const auto& c : s) + { + switch (c) + { + case '"': + case '\\': + case '\b': + case '\f': + case '\n': + case '\r': + case '\t': + { + // from c (1 byte) to \x (2 bytes) + result += 1; + break; + } + + default: + { + if (c >= 0x00 and c <= 0x1f) + { + // from c (1 byte) to \uxxxx (6 bytes) + result += 5; + } + break; + } + } + } + + return result; + } + + /*! + @brief escape a string + + Escape a string by replacing certain special characters by a sequence of an + escape character (backslash) and another character and other control + characters by a sequence of "\u" followed by a four-digit hex + representation. + + @param[in] s the string to escape + @return the escaped string + + @complexity Linear in the length of string @a s. + */ + static string_t escape_string(const string_t& s) + { + const auto space = extra_space(s); + if (space == 0) + { + return s; + } + + // create a result string of necessary size + string_t result(s.size() + space, '\\'); + std::size_t pos = 0; + + for (const auto& c : s) + { + switch (c) + { + // quotation mark (0x22) + case '"': + { + result[pos + 1] = '"'; + pos += 2; + break; + } + + // reverse solidus (0x5c) + case '\\': + { + // nothing to change + pos += 2; + break; + } + + // backspace (0x08) + case '\b': + { + result[pos + 1] = 'b'; + pos += 2; + break; + } + + // formfeed (0x0c) + case '\f': + { + result[pos + 1] = 'f'; + pos += 2; + break; + } + + // newline (0x0a) + case '\n': + { + result[pos + 1] = 'n'; + pos += 2; + break; + } + + // carriage return (0x0d) + case '\r': + { + result[pos + 1] = 'r'; + pos += 2; + break; + } + + // horizontal tab (0x09) + case '\t': + { + result[pos + 1] = 't'; + pos += 2; + break; + } + + default: + { + if (c >= 0x00 and c <= 0x1f) + { + // convert a number 0..15 to its hex representation + // (0..f) + auto hexify = [](const char v) -> char + { + return (v < 10) ? ('0' + v) : ('a' + v - 10); + }; + + // print character c as \uxxxx + for (const char m : + { 'u', '0', '0', hexify(c >> 4), hexify(c & 0x0f) + }) + { + result[++pos] = m; + } + + ++pos; + } + else + { + // all other characters are added as-is + result[pos++] = c; + } + break; + } + } + } + + return result; + } + + /*! + @brief internal implementation of the serialization function + + This function is called by the public member function dump and organizes + the serialization internally. The indentation level is propagated as + additional parameter. In case of arrays and objects, the function is called + recursively. Note that + + - strings and object keys are escaped using `escape_string()` + - integer numbers are converted implicitly via `operator<<` + - floating-point numbers are converted to a string using `"%g"` format + + @param[out] o stream to write to + @param[in] pretty_print whether the output shall be pretty-printed + @param[in] indent_step the indent level + @param[in] current_indent the current indent level (only used internally) + */ + void dump(std::ostream& o, + const bool pretty_print, + const unsigned int indent_step, + const unsigned int current_indent = 0) const + { + // variable to hold indentation for recursive calls + unsigned int new_indent = current_indent; + + switch (m_type) + { + case value_t::object: + { + assert(m_value.object != nullptr); + + if (m_value.object->empty()) + { + o << "{}"; + return; + } + + o << "{"; + + // increase indentation + if (pretty_print) + { + new_indent += indent_step; + o << "\n"; + } + + for (auto i = m_value.object->cbegin(); i != m_value.object->cend(); ++i) + { + if (i != m_value.object->cbegin()) + { + o << (pretty_print ? ",\n" : ","); + } + o << string_t(new_indent, ' ') << "\"" + << escape_string(i->first) << "\":" + << (pretty_print ? " " : ""); + i->second.dump(o, pretty_print, indent_step, new_indent); + } + + // decrease indentation + if (pretty_print) + { + new_indent -= indent_step; + o << "\n"; + } + + o << string_t(new_indent, ' ') + "}"; + return; + } + + case value_t::array: + { + assert(m_value.array != nullptr); + + if (m_value.array->empty()) + { + o << "[]"; + return; + } + + o << "["; + + // increase indentation + if (pretty_print) + { + new_indent += indent_step; + o << "\n"; + } + + for (auto i = m_value.array->cbegin(); i != m_value.array->cend(); ++i) + { + if (i != m_value.array->cbegin()) + { + o << (pretty_print ? ",\n" : ","); + } + o << string_t(new_indent, ' '); + i->dump(o, pretty_print, indent_step, new_indent); + } + + // decrease indentation + if (pretty_print) + { + new_indent -= indent_step; + o << "\n"; + } + + o << string_t(new_indent, ' ') << "]"; + return; + } + + case value_t::string: + { + assert(m_value.string != nullptr); + o << string_t("\"") << escape_string(*m_value.string) << "\""; + return; + } + + case value_t::boolean: + { + o << (m_value.boolean ? "true" : "false"); + return; + } + + case value_t::number_integer: + { + o << m_value.number_integer; + return; + } + + case value_t::number_unsigned: + { + o << m_value.number_unsigned; + return; + } + + case value_t::number_float: + { + // check if number was parsed from a string + if (m_type.bits.parsed) + { + // check if parsed number had an exponent given + if (m_type.bits.has_exp) + { + // buffer size: precision (2^8-1 = 255) + other ('-.e-xxx' = 7) + null (1) + char buf[263]; + int len; + + // handle capitalization of the exponent + if (m_type.bits.exp_cap) + { + len = snprintf(buf, sizeof(buf), "%.*E", + m_type.bits.precision, m_value.number_float) + 1; + } + else + { + len = snprintf(buf, sizeof(buf), "%.*e", + m_type.bits.precision, m_value.number_float) + 1; + } + + // remove '+' sign from the exponent if necessary + if (not m_type.bits.exp_plus) + { + if (len > static_cast(sizeof(buf))) + { + len = sizeof(buf); + } + for (int i = 0; i < len; i++) + { + if (buf[i] == '+') + { + for (; i + 1 < len; i++) + { + buf[i] = buf[i + 1]; + } + } + } + } + + o << buf; + } + else + { + // no exponent - output as a decimal + std::stringstream ss; + ss.imbue(std::locale(std::locale(), new DecimalSeparator)); // fix locale problems + ss << std::setprecision(m_type.bits.precision) + << std::fixed << m_value.number_float; + o << ss.str(); + } + } + else + { + if (m_value.number_float == 0) + { + // special case for zero to get "0.0"/"-0.0" + o << (std::signbit(m_value.number_float) ? "-0.0" : "0.0"); + } + else + { + // Otherwise 6, 15 or 16 digits of precision allows + // round-trip IEEE 754 string->float->string, + // string->double->string or string->long double->string; + // to be safe, we read this value from + // std::numeric_limits::digits10 + std::stringstream ss; + ss.imbue(std::locale(std::locale(), new DecimalSeparator)); // fix locale problems + ss << std::setprecision(std::numeric_limits::digits10) + << m_value.number_float; + o << ss.str(); + } + } + return; + } + + case value_t::discarded: + { + o << ""; + return; + } + + case value_t::null: + { + o << "null"; + return; + } + } + } + + private: + ////////////////////// + // member variables // + ////////////////////// + + /// the type of the current element + type_data_t m_type = value_t::null; + + /// the value of the current element + json_value m_value = {}; + + + private: + /////////////// + // iterators // + /////////////// + + /*! + @brief an iterator for primitive JSON types + + This class models an iterator for primitive JSON types (boolean, number, + string). It's only purpose is to allow the iterator/const_iterator classes + to "iterate" over primitive values. Internally, the iterator is modeled by + a `difference_type` variable. Value begin_value (`0`) models the begin, + end_value (`1`) models past the end. + */ + class primitive_iterator_t + { + public: + /// set iterator to a defined beginning + void set_begin() noexcept + { + m_it = begin_value; + } + + /// set iterator to a defined past the end + void set_end() noexcept + { + m_it = end_value; + } + + /// return whether the iterator can be dereferenced + constexpr bool is_begin() const noexcept + { + return (m_it == begin_value); + } + + /// return whether the iterator is at end + constexpr bool is_end() const noexcept + { + return (m_it == end_value); + } + + /// return reference to the value to change and compare + operator difference_type& () noexcept + { + return m_it; + } + + /// return value to compare + constexpr operator difference_type () const noexcept + { + return m_it; + } + + private: + static constexpr difference_type begin_value = 0; + static constexpr difference_type end_value = begin_value + 1; + + /// iterator as signed integer type + difference_type m_it = std::numeric_limits::denorm_min(); + }; + + /*! + @brief an iterator value + + @note This structure could easily be a union, but MSVC currently does not + allow unions members with complex constructors, see + https://github.com/nlohmann/json/pull/105. + */ + struct internal_iterator + { + /// iterator for JSON objects + typename object_t::iterator object_iterator; + /// iterator for JSON arrays + typename array_t::iterator array_iterator; + /// generic iterator for all other types + primitive_iterator_t primitive_iterator; + + /// create an uninitialized internal_iterator + internal_iterator() noexcept + : object_iterator(), array_iterator(), primitive_iterator() + {} + }; + + /// proxy class for the iterator_wrapper functions + template + class iteration_proxy + { + private: + /// helper class for iteration + class iteration_proxy_internal + { + private: + /// the iterator + IteratorType anchor; + /// an index for arrays (used to create key names) + size_t array_index = 0; + + public: + explicit iteration_proxy_internal(IteratorType it) noexcept + : anchor(it) + {} + + /// dereference operator (needed for range-based for) + iteration_proxy_internal& operator*() + { + return *this; + } + + /// increment operator (needed for range-based for) + iteration_proxy_internal& operator++() + { + ++anchor; + ++array_index; + + return *this; + } + + /// inequality operator (needed for range-based for) + bool operator!= (const iteration_proxy_internal& o) const + { + return anchor != o.anchor; + } + + /// return key of the iterator + typename basic_json::string_t key() const + { + assert(anchor.m_object != nullptr); + + switch (anchor.m_object->type()) + { + // use integer array index as key + case value_t::array: + { + return std::to_string(array_index); + } + + // use key from the object + case value_t::object: + { + return anchor.key(); + } + + // use an empty key for all primitive types + default: + { + return ""; + } + } + } + + /// return value of the iterator + typename IteratorType::reference value() const + { + return anchor.value(); + } + }; + + /// the container to iterate + typename IteratorType::reference container; + + public: + /// construct iteration proxy from a container + explicit iteration_proxy(typename IteratorType::reference cont) + : container(cont) + {} + + /// return iterator begin (needed for range-based for) + iteration_proxy_internal begin() noexcept + { + return iteration_proxy_internal(container.begin()); + } + + /// return iterator end (needed for range-based for) + iteration_proxy_internal end() noexcept + { + return iteration_proxy_internal(container.end()); + } + }; + + public: + /*! + @brief a const random access iterator for the @ref basic_json class + + This class implements a const iterator for the @ref basic_json class. From + this class, the @ref iterator class is derived. + + @requirement The class satisfies the following concept requirements: + - [RandomAccessIterator](http://en.cppreference.com/w/cpp/concept/RandomAccessIterator): + The iterator that can be moved to point (forward and backward) to any + element in constant time. + + @since version 1.0.0 + */ + class const_iterator : public std::iterator + { + /// allow basic_json to access private members + friend class basic_json; + + public: + /// the type of the values when the iterator is dereferenced + using value_type = typename basic_json::value_type; + /// a type to represent differences between iterators + using difference_type = typename basic_json::difference_type; + /// defines a pointer to the type iterated over (value_type) + using pointer = typename basic_json::const_pointer; + /// defines a reference to the type iterated over (value_type) + using reference = typename basic_json::const_reference; + /// the category of the iterator + using iterator_category = std::bidirectional_iterator_tag; + + /// default constructor + const_iterator() = default; + + /// constructor for a given JSON instance + explicit const_iterator(pointer object) noexcept + : m_object(object) + { + assert(m_object != nullptr); + + switch (m_object->m_type) + { + case basic_json::value_t::object: + { + m_it.object_iterator = typename object_t::iterator(); + break; + } + + case basic_json::value_t::array: + { + m_it.array_iterator = typename array_t::iterator(); + break; + } + + default: + { + m_it.primitive_iterator = primitive_iterator_t(); + break; + } + } + } + + /// copy constructor given a nonconst iterator + explicit const_iterator(const iterator& other) noexcept + : m_object(other.m_object) + { + assert(m_object != nullptr); + + switch (m_object->m_type) + { + case basic_json::value_t::object: + { + m_it.object_iterator = other.m_it.object_iterator; + break; + } + + case basic_json::value_t::array: + { + m_it.array_iterator = other.m_it.array_iterator; + break; + } + + default: + { + m_it.primitive_iterator = other.m_it.primitive_iterator; + break; + } + } + } + + /// copy constructor + const_iterator(const const_iterator& other) noexcept + : m_object(other.m_object), m_it(other.m_it) + {} + + /// copy assignment + const_iterator& operator=(const_iterator other) noexcept( + std::is_nothrow_move_constructible::value and + std::is_nothrow_move_assignable::value and + std::is_nothrow_move_constructible::value and + std::is_nothrow_move_assignable::value + ) + { + std::swap(m_object, other.m_object); + std::swap(m_it, other.m_it); + return *this; + } + + private: + /// set the iterator to the first value + void set_begin() noexcept + { + assert(m_object != nullptr); + + switch (m_object->m_type) + { + case basic_json::value_t::object: + { + assert(m_object->m_value.object != nullptr); + m_it.object_iterator = m_object->m_value.object->begin(); + break; + } + + case basic_json::value_t::array: + { + assert(m_object->m_value.array != nullptr); + m_it.array_iterator = m_object->m_value.array->begin(); + break; + } + + case basic_json::value_t::null: + { + // set to end so begin()==end() is true: null is empty + m_it.primitive_iterator.set_end(); + break; + } + + default: + { + m_it.primitive_iterator.set_begin(); + break; + } + } + } + + /// set the iterator past the last value + void set_end() noexcept + { + assert(m_object != nullptr); + + switch (m_object->m_type) + { + case basic_json::value_t::object: + { + assert(m_object->m_value.object != nullptr); + m_it.object_iterator = m_object->m_value.object->end(); + break; + } + + case basic_json::value_t::array: + { + assert(m_object->m_value.array != nullptr); + m_it.array_iterator = m_object->m_value.array->end(); + break; + } + + default: + { + m_it.primitive_iterator.set_end(); + break; + } + } + } + + public: + /// return a reference to the value pointed to by the iterator + reference operator*() const + { + assert(m_object != nullptr); + + switch (m_object->m_type) + { + case basic_json::value_t::object: + { + assert(m_object->m_value.object); + assert(m_it.object_iterator != m_object->m_value.object->end()); + return m_it.object_iterator->second; + } + + case basic_json::value_t::array: + { + assert(m_object->m_value.array); + assert(m_it.array_iterator != m_object->m_value.array->end()); + return *m_it.array_iterator; + } + + case basic_json::value_t::null: + { + throw std::out_of_range("cannot get value"); + } + + default: + { + if (m_it.primitive_iterator.is_begin()) + { + return *m_object; + } + else + { + throw std::out_of_range("cannot get value"); + } + } + } + } + + /// dereference the iterator + pointer operator->() const + { + assert(m_object != nullptr); + + switch (m_object->m_type) + { + case basic_json::value_t::object: + { + assert(m_object->m_value.object); + assert(m_it.object_iterator != m_object->m_value.object->end()); + return &(m_it.object_iterator->second); + } + + case basic_json::value_t::array: + { + assert(m_object->m_value.array); + assert(m_it.array_iterator != m_object->m_value.array->end()); + return &*m_it.array_iterator; + } + + default: + { + if (m_it.primitive_iterator.is_begin()) + { + return m_object; + } + else + { + throw std::out_of_range("cannot get value"); + } + } + } + } + + /// post-increment (it++) + const_iterator operator++(int) + { + auto result = *this; + ++(*this); + return result; + } + + /// pre-increment (++it) + const_iterator& operator++() + { + assert(m_object != nullptr); + + switch (m_object->m_type) + { + case basic_json::value_t::object: + { + ++m_it.object_iterator; + break; + } + + case basic_json::value_t::array: + { + ++m_it.array_iterator; + break; + } + + default: + { + ++m_it.primitive_iterator; + break; + } + } + + return *this; + } + + /// post-decrement (it--) + const_iterator operator--(int) + { + auto result = *this; + --(*this); + return result; + } + + /// pre-decrement (--it) + const_iterator& operator--() + { + assert(m_object != nullptr); + + switch (m_object->m_type) + { + case basic_json::value_t::object: + { + --m_it.object_iterator; + break; + } + + case basic_json::value_t::array: + { + --m_it.array_iterator; + break; + } + + default: + { + --m_it.primitive_iterator; + break; + } + } + + return *this; + } + + /// comparison: equal + bool operator==(const const_iterator& other) const + { + // if objects are not the same, the comparison is undefined + if (m_object != other.m_object) + { + throw std::domain_error("cannot compare iterators of different containers"); + } + + assert(m_object != nullptr); + + switch (m_object->m_type) + { + case basic_json::value_t::object: + { + return (m_it.object_iterator == other.m_it.object_iterator); + } + + case basic_json::value_t::array: + { + return (m_it.array_iterator == other.m_it.array_iterator); + } + + default: + { + return (m_it.primitive_iterator == other.m_it.primitive_iterator); + } + } + } + + /// comparison: not equal + bool operator!=(const const_iterator& other) const + { + return not operator==(other); + } + + /// comparison: smaller + bool operator<(const const_iterator& other) const + { + // if objects are not the same, the comparison is undefined + if (m_object != other.m_object) + { + throw std::domain_error("cannot compare iterators of different containers"); + } + + assert(m_object != nullptr); + + switch (m_object->m_type) + { + case basic_json::value_t::object: + { + throw std::domain_error("cannot compare order of object iterators"); + } + + case basic_json::value_t::array: + { + return (m_it.array_iterator < other.m_it.array_iterator); + } + + default: + { + return (m_it.primitive_iterator < other.m_it.primitive_iterator); + } + } + } + + /// comparison: less than or equal + bool operator<=(const const_iterator& other) const + { + return not other.operator < (*this); + } + + /// comparison: greater than + bool operator>(const const_iterator& other) const + { + return not operator<=(other); + } + + /// comparison: greater than or equal + bool operator>=(const const_iterator& other) const + { + return not operator<(other); + } + + /// add to iterator + const_iterator& operator+=(difference_type i) + { + assert(m_object != nullptr); + + switch (m_object->m_type) + { + case basic_json::value_t::object: + { + throw std::domain_error("cannot use offsets with object iterators"); + } + + case basic_json::value_t::array: + { + m_it.array_iterator += i; + break; + } + + default: + { + m_it.primitive_iterator += i; + break; + } + } + + return *this; + } + + /// subtract from iterator + const_iterator& operator-=(difference_type i) + { + return operator+=(-i); + } + + /// add to iterator + const_iterator operator+(difference_type i) + { + auto result = *this; + result += i; + return result; + } + + /// subtract from iterator + const_iterator operator-(difference_type i) + { + auto result = *this; + result -= i; + return result; + } + + /// return difference + difference_type operator-(const const_iterator& other) const + { + assert(m_object != nullptr); + + switch (m_object->m_type) + { + case basic_json::value_t::object: + { + throw std::domain_error("cannot use offsets with object iterators"); + } + + case basic_json::value_t::array: + { + return m_it.array_iterator - other.m_it.array_iterator; + } + + default: + { + return m_it.primitive_iterator - other.m_it.primitive_iterator; + } + } + } + + /// access to successor + reference operator[](difference_type n) const + { + assert(m_object != nullptr); + + switch (m_object->m_type) + { + case basic_json::value_t::object: + { + throw std::domain_error("cannot use operator[] for object iterators"); + } + + case basic_json::value_t::array: + { + return *(m_it.array_iterator + n); + } + + case basic_json::value_t::null: + { + throw std::out_of_range("cannot get value"); + } + + default: + { + if (m_it.primitive_iterator == -n) + { + return *m_object; + } + else + { + throw std::out_of_range("cannot get value"); + } + } + } + } + + /// return the key of an object iterator + typename object_t::key_type key() const + { + assert(m_object != nullptr); + + if (m_object->is_object()) + { + return m_it.object_iterator->first; + } + else + { + throw std::domain_error("cannot use key() for non-object iterators"); + } + } + + /// return the value of an iterator + reference value() const + { + return operator*(); + } + + private: + /// associated JSON instance + pointer m_object = nullptr; + /// the actual iterator of the associated instance + internal_iterator m_it = internal_iterator(); + }; + + /*! + @brief a mutable random access iterator for the @ref basic_json class + + @requirement The class satisfies the following concept requirements: + - [RandomAccessIterator](http://en.cppreference.com/w/cpp/concept/RandomAccessIterator): + The iterator that can be moved to point (forward and backward) to any + element in constant time. + - [OutputIterator](http://en.cppreference.com/w/cpp/concept/OutputIterator): + It is possible to write to the pointed-to element. + + @since version 1.0.0 + */ + class iterator : public const_iterator + { + public: + using base_iterator = const_iterator; + using pointer = typename basic_json::pointer; + using reference = typename basic_json::reference; + + /// default constructor + iterator() = default; + + /// constructor for a given JSON instance + explicit iterator(pointer object) noexcept + : base_iterator(object) + {} + + /// copy constructor + iterator(const iterator& other) noexcept + : base_iterator(other) + {} + + /// copy assignment + iterator& operator=(iterator other) noexcept( + std::is_nothrow_move_constructible::value and + std::is_nothrow_move_assignable::value and + std::is_nothrow_move_constructible::value and + std::is_nothrow_move_assignable::value + ) + { + base_iterator::operator=(other); + return *this; + } + + /// return a reference to the value pointed to by the iterator + reference operator*() const + { + return const_cast(base_iterator::operator*()); + } + + /// dereference the iterator + pointer operator->() const + { + return const_cast(base_iterator::operator->()); + } + + /// post-increment (it++) + iterator operator++(int) + { + iterator result = *this; + base_iterator::operator++(); + return result; + } + + /// pre-increment (++it) + iterator& operator++() + { + base_iterator::operator++(); + return *this; + } + + /// post-decrement (it--) + iterator operator--(int) + { + iterator result = *this; + base_iterator::operator--(); + return result; + } + + /// pre-decrement (--it) + iterator& operator--() + { + base_iterator::operator--(); + return *this; + } + + /// add to iterator + iterator& operator+=(difference_type i) + { + base_iterator::operator+=(i); + return *this; + } + + /// subtract from iterator + iterator& operator-=(difference_type i) + { + base_iterator::operator-=(i); + return *this; + } + + /// add to iterator + iterator operator+(difference_type i) + { + auto result = *this; + result += i; + return result; + } + + /// subtract from iterator + iterator operator-(difference_type i) + { + auto result = *this; + result -= i; + return result; + } + + /// return difference + difference_type operator-(const iterator& other) const + { + return base_iterator::operator-(other); + } + + /// access to successor + reference operator[](difference_type n) const + { + return const_cast(base_iterator::operator[](n)); + } + + /// return the value of an iterator + reference value() const + { + return const_cast(base_iterator::value()); + } + }; + + /*! + @brief a template for a reverse iterator class + + @tparam Base the base iterator type to reverse. Valid types are @ref + iterator (to create @ref reverse_iterator) and @ref const_iterator (to + create @ref const_reverse_iterator). + + @requirement The class satisfies the following concept requirements: + - [RandomAccessIterator](http://en.cppreference.com/w/cpp/concept/RandomAccessIterator): + The iterator that can be moved to point (forward and backward) to any + element in constant time. + - [OutputIterator](http://en.cppreference.com/w/cpp/concept/OutputIterator): + It is possible to write to the pointed-to element (only if @a Base is + @ref iterator). + + @since version 1.0.0 + */ + template + class json_reverse_iterator : public std::reverse_iterator + { + public: + /// shortcut to the reverse iterator adaptor + using base_iterator = std::reverse_iterator; + /// the reference type for the pointed-to element + using reference = typename Base::reference; + + /// create reverse iterator from iterator + json_reverse_iterator(const typename base_iterator::iterator_type& it) noexcept + : base_iterator(it) + {} + + /// create reverse iterator from base class + json_reverse_iterator(const base_iterator& it) noexcept + : base_iterator(it) + {} + + /// post-increment (it++) + json_reverse_iterator operator++(int) + { + return base_iterator::operator++(1); + } + + /// pre-increment (++it) + json_reverse_iterator& operator++() + { + base_iterator::operator++(); + return *this; + } + + /// post-decrement (it--) + json_reverse_iterator operator--(int) + { + return base_iterator::operator--(1); + } + + /// pre-decrement (--it) + json_reverse_iterator& operator--() + { + base_iterator::operator--(); + return *this; + } + + /// add to iterator + json_reverse_iterator& operator+=(difference_type i) + { + base_iterator::operator+=(i); + return *this; + } + + /// add to iterator + json_reverse_iterator operator+(difference_type i) const + { + auto result = *this; + result += i; + return result; + } + + /// subtract from iterator + json_reverse_iterator operator-(difference_type i) const + { + auto result = *this; + result -= i; + return result; + } + + /// return difference + difference_type operator-(const json_reverse_iterator& other) const + { + return this->base() - other.base(); + } + + /// access to successor + reference operator[](difference_type n) const + { + return *(this->operator+(n)); + } + + /// return the key of an object iterator + typename object_t::key_type key() const + { + auto it = --this->base(); + return it.key(); + } + + /// return the value of an iterator + reference value() const + { + auto it = --this->base(); + return it.operator * (); + } + }; + + + private: + ////////////////////// + // lexer and parser // + ////////////////////// + + /*! + @brief lexical analysis + + This class organizes the lexical analysis during JSON deserialization. The + core of it is a scanner generated by [re2c](http://re2c.org) that processes + a buffer and recognizes tokens according to RFC 7159. + */ + class lexer + { + public: + /// token types for the parser + enum class token_type + { + uninitialized, ///< indicating the scanner is uninitialized + literal_true, ///< the "true" literal + literal_false, ///< the "false" literal + literal_null, ///< the "null" literal + value_string, ///< a string -- use get_string() for actual value + value_number, ///< a number -- use get_number() for actual value + begin_array, ///< the character for array begin "[" + begin_object, ///< the character for object begin "{" + end_array, ///< the character for array end "]" + end_object, ///< the character for object end "}" + name_separator, ///< the name separator ":" + value_separator, ///< the value separator "," + parse_error, ///< indicating a parse error + end_of_input ///< indicating the end of the input buffer + }; + + /// the char type to use in the lexer + using lexer_char_t = unsigned char; + + /// constructor with a given buffer + explicit lexer(const string_t& s) noexcept + : m_stream(nullptr), m_buffer(s) + { + m_content = reinterpret_cast(s.c_str()); + assert(m_content != nullptr); + m_start = m_cursor = m_content; + m_limit = m_content + s.size(); + } + + /// constructor with a given stream + explicit lexer(std::istream* s) noexcept + : m_stream(s), m_buffer() + { + assert(m_stream != nullptr); + getline(*m_stream, m_buffer); + m_content = reinterpret_cast(m_buffer.c_str()); + assert(m_content != nullptr); + m_start = m_cursor = m_content; + m_limit = m_content + m_buffer.size(); + } + + /// default constructor + lexer() = default; + + // switch off unwanted functions + lexer(const lexer&) = delete; + lexer operator=(const lexer&) = delete; + + /*! + @brief create a string from a Unicode code point + + @param[in] codepoint1 the code point (can be high surrogate) + @param[in] codepoint2 the code point (can be low surrogate or 0) + + @return string representation of the code point + + @throw std::out_of_range if code point is >0x10ffff; example: `"code + points above 0x10FFFF are invalid"` + @throw std::invalid_argument if the low surrogate is invalid; example: + `""missing or wrong low surrogate""` + + @see + */ + static string_t to_unicode(const std::size_t codepoint1, + const std::size_t codepoint2 = 0) + { + // calculate the codepoint from the given code points + std::size_t codepoint = codepoint1; + + // check if codepoint1 is a high surrogate + if (codepoint1 >= 0xD800 and codepoint1 <= 0xDBFF) + { + // check if codepoint2 is a low surrogate + if (codepoint2 >= 0xDC00 and codepoint2 <= 0xDFFF) + { + codepoint = + // high surrogate occupies the most significant 22 bits + (codepoint1 << 10) + // low surrogate occupies the least significant 15 bits + + codepoint2 + // there is still the 0xD800, 0xDC00 and 0x10000 noise + // in the result so we have to subtract with: + // (0xD800 << 10) + DC00 - 0x10000 = 0x35FDC00 + - 0x35FDC00; + } + else + { + throw std::invalid_argument("missing or wrong low surrogate"); + } + } + + string_t result; + + if (codepoint < 0x80) + { + // 1-byte characters: 0xxxxxxx (ASCII) + result.append(1, static_cast(codepoint)); + } + else if (codepoint <= 0x7ff) + { + // 2-byte characters: 110xxxxx 10xxxxxx + result.append(1, static_cast(0xC0 | ((codepoint >> 6) & 0x1F))); + result.append(1, static_cast(0x80 | (codepoint & 0x3F))); + } + else if (codepoint <= 0xffff) + { + // 3-byte characters: 1110xxxx 10xxxxxx 10xxxxxx + result.append(1, static_cast(0xE0 | ((codepoint >> 12) & 0x0F))); + result.append(1, static_cast(0x80 | ((codepoint >> 6) & 0x3F))); + result.append(1, static_cast(0x80 | (codepoint & 0x3F))); + } + else if (codepoint <= 0x10ffff) + { + // 4-byte characters: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx + result.append(1, static_cast(0xF0 | ((codepoint >> 18) & 0x07))); + result.append(1, static_cast(0x80 | ((codepoint >> 12) & 0x3F))); + result.append(1, static_cast(0x80 | ((codepoint >> 6) & 0x3F))); + result.append(1, static_cast(0x80 | (codepoint & 0x3F))); + } + else + { + throw std::out_of_range("code points above 0x10FFFF are invalid"); + } + + return result; + } + + /// return name of values of type token_type (only used for errors) + static std::string token_type_name(token_type t) + { + switch (t) + { + case token_type::uninitialized: + return ""; + case token_type::literal_true: + return "true literal"; + case token_type::literal_false: + return "false literal"; + case token_type::literal_null: + return "null literal"; + case token_type::value_string: + return "string literal"; + case token_type::value_number: + return "number literal"; + case token_type::begin_array: + return "'['"; + case token_type::begin_object: + return "'{'"; + case token_type::end_array: + return "']'"; + case token_type::end_object: + return "'}'"; + case token_type::name_separator: + return "':'"; + case token_type::value_separator: + return "','"; + case token_type::parse_error: + return ""; + case token_type::end_of_input: + return "end of input"; + default: + { + // catch non-enum values + return "unknown token"; // LCOV_EXCL_LINE + } + } + } + + /*! + This function implements a scanner for JSON. It is specified using + regular expressions that try to follow RFC 7159 as close as possible. + These regular expressions are then translated into a minimized + deterministic finite automaton (DFA) by the tool + [re2c](http://re2c.org). As a result, the translated code for this + function consists of a large block of code with `goto` jumps. + + @return the class of the next token read from the buffer + */ + token_type scan() noexcept + { + // pointer for backtracking information + m_marker = nullptr; + + // remember the begin of the token + m_start = m_cursor; + assert(m_start != nullptr); + + + { + lexer_char_t yych; + unsigned int yyaccept = 0; + static const unsigned char yybm[] = + { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 32, 32, 0, 0, 32, 0, 0, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 160, 128, 0, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 192, 192, 192, 192, 192, 192, 192, 192, + 192, 192, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 0, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 128, 128, 128, 128, 128, 128, 128, + }; + if ((m_limit - m_cursor) < 5) + { + yyfill(); // LCOV_EXCL_LINE; + } + yych = *m_cursor; + if (yybm[0 + yych] & 32) + { + goto basic_json_parser_6; + } + if (yych <= '\\') + { + if (yych <= '-') + { + if (yych <= '"') + { + if (yych <= 0x00) + { + goto basic_json_parser_2; + } + if (yych <= '!') + { + goto basic_json_parser_4; + } + goto basic_json_parser_9; + } + else + { + if (yych <= '+') + { + goto basic_json_parser_4; + } + if (yych <= ',') + { + goto basic_json_parser_10; + } + goto basic_json_parser_12; + } + } + else + { + if (yych <= '9') + { + if (yych <= '/') + { + goto basic_json_parser_4; + } + if (yych <= '0') + { + goto basic_json_parser_13; + } + goto basic_json_parser_15; + } + else + { + if (yych <= ':') + { + goto basic_json_parser_17; + } + if (yych == '[') + { + goto basic_json_parser_19; + } + goto basic_json_parser_4; + } + } + } + else + { + if (yych <= 't') + { + if (yych <= 'f') + { + if (yych <= ']') + { + goto basic_json_parser_21; + } + if (yych <= 'e') + { + goto basic_json_parser_4; + } + goto basic_json_parser_23; + } + else + { + if (yych == 'n') + { + goto basic_json_parser_24; + } + if (yych <= 's') + { + goto basic_json_parser_4; + } + goto basic_json_parser_25; + } + } + else + { + if (yych <= '|') + { + if (yych == '{') + { + goto basic_json_parser_26; + } + goto basic_json_parser_4; + } + else + { + if (yych <= '}') + { + goto basic_json_parser_28; + } + if (yych == 0xEF) + { + goto basic_json_parser_30; + } + goto basic_json_parser_4; + } + } + } +basic_json_parser_2: + ++m_cursor; + { + return token_type::end_of_input; + } +basic_json_parser_4: + ++m_cursor; +basic_json_parser_5: + { + return token_type::parse_error; + } +basic_json_parser_6: + ++m_cursor; + if (m_limit <= m_cursor) + { + yyfill(); // LCOV_EXCL_LINE; + } + yych = *m_cursor; + if (yybm[0 + yych] & 32) + { + goto basic_json_parser_6; + } + { + return scan(); + } +basic_json_parser_9: + yyaccept = 0; + yych = *(m_marker = ++m_cursor); + if (yych <= 0x0F) + { + goto basic_json_parser_5; + } + goto basic_json_parser_32; +basic_json_parser_10: + ++m_cursor; + { + return token_type::value_separator; + } +basic_json_parser_12: + yych = *++m_cursor; + if (yych <= '/') + { + goto basic_json_parser_5; + } + if (yych <= '0') + { + goto basic_json_parser_13; + } + if (yych <= '9') + { + goto basic_json_parser_15; + } + goto basic_json_parser_5; +basic_json_parser_13: + yyaccept = 1; + yych = *(m_marker = ++m_cursor); + if (yych <= 'D') + { + if (yych == '.') + { + goto basic_json_parser_37; + } + } + else + { + if (yych <= 'E') + { + goto basic_json_parser_38; + } + if (yych == 'e') + { + goto basic_json_parser_38; + } + } +basic_json_parser_14: + { + return token_type::value_number; + } +basic_json_parser_15: + yyaccept = 1; + m_marker = ++m_cursor; + if ((m_limit - m_cursor) < 3) + { + yyfill(); // LCOV_EXCL_LINE; + } + yych = *m_cursor; + if (yybm[0 + yych] & 64) + { + goto basic_json_parser_15; + } + if (yych <= 'D') + { + if (yych == '.') + { + goto basic_json_parser_37; + } + goto basic_json_parser_14; + } + else + { + if (yych <= 'E') + { + goto basic_json_parser_38; + } + if (yych == 'e') + { + goto basic_json_parser_38; + } + goto basic_json_parser_14; + } +basic_json_parser_17: + ++m_cursor; + { + return token_type::name_separator; + } +basic_json_parser_19: + ++m_cursor; + { + return token_type::begin_array; + } +basic_json_parser_21: + ++m_cursor; + { + return token_type::end_array; + } +basic_json_parser_23: + yyaccept = 0; + yych = *(m_marker = ++m_cursor); + if (yych == 'a') + { + goto basic_json_parser_39; + } + goto basic_json_parser_5; +basic_json_parser_24: + yyaccept = 0; + yych = *(m_marker = ++m_cursor); + if (yych == 'u') + { + goto basic_json_parser_40; + } + goto basic_json_parser_5; +basic_json_parser_25: + yyaccept = 0; + yych = *(m_marker = ++m_cursor); + if (yych == 'r') + { + goto basic_json_parser_41; + } + goto basic_json_parser_5; +basic_json_parser_26: + ++m_cursor; + { + return token_type::begin_object; + } +basic_json_parser_28: + ++m_cursor; + { + return token_type::end_object; + } +basic_json_parser_30: + yyaccept = 0; + yych = *(m_marker = ++m_cursor); + if (yych == 0xBB) + { + goto basic_json_parser_42; + } + goto basic_json_parser_5; +basic_json_parser_31: + ++m_cursor; + if (m_limit <= m_cursor) + { + yyfill(); // LCOV_EXCL_LINE; + } + yych = *m_cursor; +basic_json_parser_32: + if (yybm[0 + yych] & 128) + { + goto basic_json_parser_31; + } + if (yych <= 0x0F) + { + goto basic_json_parser_33; + } + if (yych <= '"') + { + goto basic_json_parser_34; + } + goto basic_json_parser_36; +basic_json_parser_33: + m_cursor = m_marker; + if (yyaccept == 0) + { + goto basic_json_parser_5; + } + else + { + goto basic_json_parser_14; + } +basic_json_parser_34: + ++m_cursor; + { + return token_type::value_string; + } +basic_json_parser_36: + ++m_cursor; + if (m_limit <= m_cursor) + { + yyfill(); // LCOV_EXCL_LINE; + } + yych = *m_cursor; + if (yych <= 'e') + { + if (yych <= '/') + { + if (yych == '"') + { + goto basic_json_parser_31; + } + if (yych <= '.') + { + goto basic_json_parser_33; + } + goto basic_json_parser_31; + } + else + { + if (yych <= '\\') + { + if (yych <= '[') + { + goto basic_json_parser_33; + } + goto basic_json_parser_31; + } + else + { + if (yych == 'b') + { + goto basic_json_parser_31; + } + goto basic_json_parser_33; + } + } + } + else + { + if (yych <= 'q') + { + if (yych <= 'f') + { + goto basic_json_parser_31; + } + if (yych == 'n') + { + goto basic_json_parser_31; + } + goto basic_json_parser_33; + } + else + { + if (yych <= 's') + { + if (yych <= 'r') + { + goto basic_json_parser_31; + } + goto basic_json_parser_33; + } + else + { + if (yych <= 't') + { + goto basic_json_parser_31; + } + if (yych <= 'u') + { + goto basic_json_parser_43; + } + goto basic_json_parser_33; + } + } + } +basic_json_parser_37: + yych = *++m_cursor; + if (yych <= '/') + { + goto basic_json_parser_33; + } + if (yych <= '9') + { + goto basic_json_parser_44; + } + goto basic_json_parser_33; +basic_json_parser_38: + yych = *++m_cursor; + if (yych <= ',') + { + if (yych == '+') + { + goto basic_json_parser_46; + } + goto basic_json_parser_33; + } + else + { + if (yych <= '-') + { + goto basic_json_parser_46; + } + if (yych <= '/') + { + goto basic_json_parser_33; + } + if (yych <= '9') + { + goto basic_json_parser_47; + } + goto basic_json_parser_33; + } +basic_json_parser_39: + yych = *++m_cursor; + if (yych == 'l') + { + goto basic_json_parser_49; + } + goto basic_json_parser_33; +basic_json_parser_40: + yych = *++m_cursor; + if (yych == 'l') + { + goto basic_json_parser_50; + } + goto basic_json_parser_33; +basic_json_parser_41: + yych = *++m_cursor; + if (yych == 'u') + { + goto basic_json_parser_51; + } + goto basic_json_parser_33; +basic_json_parser_42: + yych = *++m_cursor; + if (yych == 0xBF) + { + goto basic_json_parser_52; + } + goto basic_json_parser_33; +basic_json_parser_43: + ++m_cursor; + if (m_limit <= m_cursor) + { + yyfill(); // LCOV_EXCL_LINE; + } + yych = *m_cursor; + if (yych <= '@') + { + if (yych <= '/') + { + goto basic_json_parser_33; + } + if (yych <= '9') + { + goto basic_json_parser_54; + } + goto basic_json_parser_33; + } + else + { + if (yych <= 'F') + { + goto basic_json_parser_54; + } + if (yych <= '`') + { + goto basic_json_parser_33; + } + if (yych <= 'f') + { + goto basic_json_parser_54; + } + goto basic_json_parser_33; + } +basic_json_parser_44: + yyaccept = 1; + m_marker = ++m_cursor; + if ((m_limit - m_cursor) < 3) + { + yyfill(); // LCOV_EXCL_LINE; + } + yych = *m_cursor; + if (yych <= 'D') + { + if (yych <= '/') + { + goto basic_json_parser_14; + } + if (yych <= '9') + { + goto basic_json_parser_44; + } + goto basic_json_parser_14; + } + else + { + if (yych <= 'E') + { + goto basic_json_parser_38; + } + if (yych == 'e') + { + goto basic_json_parser_38; + } + goto basic_json_parser_14; + } +basic_json_parser_46: + yych = *++m_cursor; + if (yych <= '/') + { + goto basic_json_parser_33; + } + if (yych >= ':') + { + goto basic_json_parser_33; + } +basic_json_parser_47: + ++m_cursor; + if (m_limit <= m_cursor) + { + yyfill(); // LCOV_EXCL_LINE; + } + yych = *m_cursor; + if (yych <= '/') + { + goto basic_json_parser_14; + } + if (yych <= '9') + { + goto basic_json_parser_47; + } + goto basic_json_parser_14; +basic_json_parser_49: + yych = *++m_cursor; + if (yych == 's') + { + goto basic_json_parser_55; + } + goto basic_json_parser_33; +basic_json_parser_50: + yych = *++m_cursor; + if (yych == 'l') + { + goto basic_json_parser_56; + } + goto basic_json_parser_33; +basic_json_parser_51: + yych = *++m_cursor; + if (yych == 'e') + { + goto basic_json_parser_58; + } + goto basic_json_parser_33; +basic_json_parser_52: + ++m_cursor; + { + return scan(); + } +basic_json_parser_54: + ++m_cursor; + if (m_limit <= m_cursor) + { + yyfill(); // LCOV_EXCL_LINE; + } + yych = *m_cursor; + if (yych <= '@') + { + if (yych <= '/') + { + goto basic_json_parser_33; + } + if (yych <= '9') + { + goto basic_json_parser_60; + } + goto basic_json_parser_33; + } + else + { + if (yych <= 'F') + { + goto basic_json_parser_60; + } + if (yych <= '`') + { + goto basic_json_parser_33; + } + if (yych <= 'f') + { + goto basic_json_parser_60; + } + goto basic_json_parser_33; + } +basic_json_parser_55: + yych = *++m_cursor; + if (yych == 'e') + { + goto basic_json_parser_61; + } + goto basic_json_parser_33; +basic_json_parser_56: + ++m_cursor; + { + return token_type::literal_null; + } +basic_json_parser_58: + ++m_cursor; + { + return token_type::literal_true; + } +basic_json_parser_60: + ++m_cursor; + if (m_limit <= m_cursor) + { + yyfill(); // LCOV_EXCL_LINE; + } + yych = *m_cursor; + if (yych <= '@') + { + if (yych <= '/') + { + goto basic_json_parser_33; + } + if (yych <= '9') + { + goto basic_json_parser_63; + } + goto basic_json_parser_33; + } + else + { + if (yych <= 'F') + { + goto basic_json_parser_63; + } + if (yych <= '`') + { + goto basic_json_parser_33; + } + if (yych <= 'f') + { + goto basic_json_parser_63; + } + goto basic_json_parser_33; + } +basic_json_parser_61: + ++m_cursor; + { + return token_type::literal_false; + } +basic_json_parser_63: + ++m_cursor; + if (m_limit <= m_cursor) + { + yyfill(); // LCOV_EXCL_LINE; + } + yych = *m_cursor; + if (yych <= '@') + { + if (yych <= '/') + { + goto basic_json_parser_33; + } + if (yych <= '9') + { + goto basic_json_parser_31; + } + goto basic_json_parser_33; + } + else + { + if (yych <= 'F') + { + goto basic_json_parser_31; + } + if (yych <= '`') + { + goto basic_json_parser_33; + } + if (yych <= 'f') + { + goto basic_json_parser_31; + } + goto basic_json_parser_33; + } + } + + } + + /// append data from the stream to the internal buffer + void yyfill() noexcept + { + if (m_stream == nullptr or not * m_stream) + { + return; + } + + const auto offset_start = m_start - m_content; + const auto offset_marker = m_marker - m_start; + const auto offset_cursor = m_cursor - m_start; + + m_buffer.erase(0, static_cast(offset_start)); + std::string line; + assert(m_stream != nullptr); + std::getline(*m_stream, line); + m_buffer += "\n" + line; // add line with newline symbol + + m_content = reinterpret_cast(m_buffer.c_str()); + assert(m_content != nullptr); + m_start = m_content; + m_marker = m_start + offset_marker; + m_cursor = m_start + offset_cursor; + m_limit = m_start + m_buffer.size() - 1; + } + + /// return string representation of last read token + string_t get_token() const + { + assert(m_start != nullptr); + return string_t(reinterpret_cast(m_start), + static_cast(m_cursor - m_start)); + } + + /*! + @brief return string value for string tokens + + The function iterates the characters between the opening and closing + quotes of the string value. The complete string is the range + [m_start,m_cursor). Consequently, we iterate from m_start+1 to + m_cursor-1. + + We differentiate two cases: + + 1. Escaped characters. In this case, a new character is constructed + according to the nature of the escape. Some escapes create new + characters (e.g., `"\\n"` is replaced by `"\n"`), some are copied as + is (e.g., `"\\\\"`). Furthermore, Unicode escapes of the shape + `"\\uxxxx"` need special care. In this case, to_unicode takes care + of the construction of the values. + 2. Unescaped characters are copied as is. + + @return string value of current token without opening and closing quotes + @throw std::out_of_range if to_unicode fails + */ + string_t get_string() const + { + string_t result; + result.reserve(static_cast(m_cursor - m_start - 2)); + + // iterate the result between the quotes + for (const lexer_char_t* i = m_start + 1; i < m_cursor - 1; ++i) + { + // process escaped characters + if (*i == '\\') + { + // read next character + ++i; + + switch (*i) + { + // the default escapes + case 't': + { + result += "\t"; + break; + } + case 'b': + { + result += "\b"; + break; + } + case 'f': + { + result += "\f"; + break; + } + case 'n': + { + result += "\n"; + break; + } + case 'r': + { + result += "\r"; + break; + } + case '\\': + { + result += "\\"; + break; + } + case '/': + { + result += "/"; + break; + } + case '"': + { + result += "\""; + break; + } + + // unicode + case 'u': + { + // get code xxxx from uxxxx + auto codepoint = std::strtoul(std::string(reinterpret_cast(i + 1), + 4).c_str(), nullptr, 16); + + // check if codepoint is a high surrogate + if (codepoint >= 0xD800 and codepoint <= 0xDBFF) + { + // make sure there is a subsequent unicode + if ((i + 6 >= m_limit) or * (i + 5) != '\\' or * (i + 6) != 'u') + { + throw std::invalid_argument("missing low surrogate"); + } + + // get code yyyy from uxxxx\uyyyy + auto codepoint2 = std::strtoul(std::string(reinterpret_cast + (i + 7), 4).c_str(), nullptr, 16); + result += to_unicode(codepoint, codepoint2); + // skip the next 10 characters (xxxx\uyyyy) + i += 10; + } + else + { + // add unicode character(s) + result += to_unicode(codepoint); + // skip the next four characters (xxxx) + i += 4; + } + break; + } + } + } + else + { + // all other characters are just copied to the end of the + // string + result.append(1, static_cast(*i)); + } + } + + return result; + } + + /*! + @brief parse floating point number + + This function (and its overloads) serves to select the most approprate + standard floating point number parsing function based on the type + supplied via the first parameter. Set this to + @a static_cast(nullptr). + + @param[in] type the @ref number_float_t in use + + @param[in,out] endptr recieves a pointer to the first character after + the number + + @return the floating point number + + @bug This function uses `std::strtof`, `std::strtod`, or `std::strtold` + which use the current C locale to determine which character is used as + decimal point character. This may yield to parse errors if the locale + does not used `.`. + */ + long double str_to_float_t(long double* /* type */, char** endptr) const + { + return std::strtold(reinterpret_cast(m_start), endptr); + } + + /*! + @brief parse floating point number + + This function (and its overloads) serves to select the most approprate + standard floating point number parsing function based on the type + supplied via the first parameter. Set this to + @a static_cast(nullptr). + + @param[in] type the @ref number_float_t in use + + @param[in,out] endptr recieves a pointer to the first character after + the number + + @return the floating point number + */ + double str_to_float_t(double* /* type */, char** endptr) const + { + return std::strtod(reinterpret_cast(m_start), endptr); + } + + /*! + @brief parse floating point number + + This function (and its overloads) serves to select the most approprate + standard floating point number parsing function based on the type + supplied via the first parameter. Set this to + @a static_cast(nullptr). + + @param[in] type the @ref number_float_t in use + + @param[in,out] endptr recieves a pointer to the first character after + the number + + @return the floating point number + */ + float str_to_float_t(float* /* type */, char** endptr) const + { + return std::strtof(reinterpret_cast(m_start), endptr); + } + + /*! + @brief return number value for number tokens + + This function translates the last token into the most appropriate + number type (either integer, unsigned integer or floating point), + which is passed back to the caller via the result parameter. + + This function parses the integer component up to the radix point or + exponent while collecting information about the 'floating point + representation', which it stores in the result parameter. If there is + no radix point or exponent, and the number can fit into a + @ref number_integer_t or @ref number_unsigned_t then it sets the + result parameter accordingly. + + The 'floating point representation' includes the number of significant + figures after the radix point, whether the number is in exponential + or decimal form, the capitalization of the exponent marker, and if the + optional '+' is present in the exponent. This information is necessary + to perform accurate round trips of floating point numbers. + + If the number is a floating point number the number is then parsed + using @a std:strtod (or @a std:strtof or @a std::strtold). + + @param[out] result @ref basic_json object to receive the number, or + NAN if the conversion read past the current token. The latter case + needs to be treated by the caller function. + */ + void get_number(basic_json& result) const + { + assert(m_start != nullptr); + + const lexer::lexer_char_t* curptr = m_start; + + // remember this number was parsed (for later serialization) + result.m_type.bits.parsed = true; + + // 'found_radix_point' will be set to 0xFF upon finding a radix + // point and later used to mask in/out the precision depending + // whether a radix is found i.e. 'precision &= found_radix_point' + uint8_t found_radix_point = 0; + uint8_t precision = 0; + + // accumulate the integer conversion result (unsigned for now) + number_unsigned_t value = 0; + + // maximum absolute value of the relevant integer type + number_unsigned_t max; + + // temporarily store the type to avoid unecessary bitfield access + value_t type; + + // look for sign + if (*curptr == '-') + { + type = value_t::number_integer; + max = static_cast(std::numeric_limits::max()) + 1; + curptr++; + } + else + { + type = value_t::number_unsigned; + max = static_cast(std::numeric_limits::max()); + if (*curptr == '+') + { + curptr++; + } + } + + // count the significant figures + for (; curptr < m_cursor; curptr++) + { + // quickly skip tests if a digit + if (*curptr < '0' || *curptr > '9') + { + if (*curptr == '.') + { + // don't count '.' but change to float + type = value_t::number_float; + + // reset precision count + precision = 0; + found_radix_point = 0xFF; + continue; + } + // assume exponent (if not then will fail parse): change to + // float, stop counting and record exponent details + type = value_t::number_float; + result.m_type.bits.has_exp = true; + + // exponent capitalization + result.m_type.bits.exp_cap = (*curptr == 'E'); + + // exponent '+' sign + result.m_type.bits.exp_plus = (*(++curptr) == '+'); + break; + } + + // skip if definitely not an integer + if (type != value_t::number_float) + { + // multiply last value by ten and add the new digit + auto temp = value * 10 + *curptr - 0x30; + + // test for overflow + if (temp < value || temp > max) + { + // overflow + type = value_t::number_float; + } + else + { + // no overflow - save it + value = temp; + } + } + ++precision; + } + + // If no radix point was found then precision would now be set to + // the number of digits, which is wrong - clear it. + result.m_type.bits.precision = precision & found_radix_point; + + // save the value (if not a float) + if (type == value_t::number_unsigned) + { + result.m_value.number_unsigned = value; + } + else if (type == value_t::number_integer) + { + result.m_value.number_integer = -static_cast(value); + } + else + { + // parse with strtod + result.m_value.number_float = str_to_float_t(static_cast(nullptr), NULL); + } + + // save the type + result.m_type = type; + } + + private: + /// optional input stream + std::istream* m_stream = nullptr; + /// the buffer + string_t m_buffer; + /// the buffer pointer + const lexer_char_t* m_content = nullptr; + /// pointer to the beginning of the current symbol + const lexer_char_t* m_start = nullptr; + /// pointer for backtracking information + const lexer_char_t* m_marker = nullptr; + /// pointer to the current symbol + const lexer_char_t* m_cursor = nullptr; + /// pointer to the end of the buffer + const lexer_char_t* m_limit = nullptr; + }; + + /*! + @brief syntax analysis + + This class implements a recursive decent parser. + */ + class parser + { + public: + /// constructor for strings + parser(const string_t& s, parser_callback_t cb = nullptr) noexcept + : callback(cb), m_lexer(s) + { + // read first token + get_token(); + } + + /// a parser reading from an input stream + parser(std::istream& _is, parser_callback_t cb = nullptr) noexcept + : callback(cb), m_lexer(&_is) + { + // read first token + get_token(); + } + + /// public parser interface + basic_json parse() + { + basic_json result = parse_internal(true); + + expect(lexer::token_type::end_of_input); + + // return parser result and replace it with null in case the + // top-level value was discarded by the callback function + return result.is_discarded() ? basic_json() : result; + } + + private: + /// the actual parser + basic_json parse_internal(bool keep) + { + auto result = basic_json(value_t::discarded); + + switch (last_token) + { + case lexer::token_type::begin_object: + { + if (keep and (not callback or (keep = callback(depth++, parse_event_t::object_start, result)))) + { + // explicitly set result to object to cope with {} + result.m_type = value_t::object; + result.m_value = json_value(value_t::object); + } + + // read next token + get_token(); + + // closing } -> we are done + if (last_token == lexer::token_type::end_object) + { + get_token(); + if (keep and callback and not callback(--depth, parse_event_t::object_end, result)) + { + result = basic_json(value_t::discarded); + } + return result; + } + + // no comma is expected here + unexpect(lexer::token_type::value_separator); + + // otherwise: parse key-value pairs + do + { + // ugly, but could be fixed with loop reorganization + if (last_token == lexer::token_type::value_separator) + { + get_token(); + } + + // store key + expect(lexer::token_type::value_string); + const auto key = m_lexer.get_string(); + + bool keep_tag = false; + if (keep) + { + if (callback) + { + basic_json k(key); + keep_tag = callback(depth, parse_event_t::key, k); + } + else + { + keep_tag = true; + } + } + + // parse separator (:) + get_token(); + expect(lexer::token_type::name_separator); + + // parse and add value + get_token(); + auto value = parse_internal(keep); + if (keep and keep_tag and not value.is_discarded()) + { + result[key] = std::move(value); + } + } + while (last_token == lexer::token_type::value_separator); + + // closing } + expect(lexer::token_type::end_object); + get_token(); + if (keep and callback and not callback(--depth, parse_event_t::object_end, result)) + { + result = basic_json(value_t::discarded); + } + + return result; + } + + case lexer::token_type::begin_array: + { + if (keep and (not callback or (keep = callback(depth++, parse_event_t::array_start, result)))) + { + // explicitly set result to object to cope with [] + result.m_type = value_t::array; + result.m_value = json_value(value_t::array); + } + + // read next token + get_token(); + + // closing ] -> we are done + if (last_token == lexer::token_type::end_array) + { + get_token(); + if (callback and not callback(--depth, parse_event_t::array_end, result)) + { + result = basic_json(value_t::discarded); + } + return result; + } + + // no comma is expected here + unexpect(lexer::token_type::value_separator); + + // otherwise: parse values + do + { + // ugly, but could be fixed with loop reorganization + if (last_token == lexer::token_type::value_separator) + { + get_token(); + } + + // parse value + auto value = parse_internal(keep); + if (keep and not value.is_discarded()) + { + result.push_back(std::move(value)); + } + } + while (last_token == lexer::token_type::value_separator); + + // closing ] + expect(lexer::token_type::end_array); + get_token(); + if (keep and callback and not callback(--depth, parse_event_t::array_end, result)) + { + result = basic_json(value_t::discarded); + } + + return result; + } + + case lexer::token_type::literal_null: + { + get_token(); + result.m_type = value_t::null; + break; + } + + case lexer::token_type::value_string: + { + const auto s = m_lexer.get_string(); + get_token(); + result = basic_json(s); + break; + } + + case lexer::token_type::literal_true: + { + get_token(); + result.m_type = value_t::boolean; + result.m_value = true; + break; + } + + case lexer::token_type::literal_false: + { + get_token(); + result.m_type = value_t::boolean; + result.m_value = false; + break; + } + + case lexer::token_type::value_number: + { + m_lexer.get_number(result); + get_token(); + break; + } + + default: + { + // the last token was unexpected + unexpect(last_token); + } + } + + if (keep and callback and not callback(depth, parse_event_t::value, result)) + { + result = basic_json(value_t::discarded); + } + return result; + } + + /// get next token from lexer + typename lexer::token_type get_token() noexcept + { + last_token = m_lexer.scan(); + return last_token; + } + + void expect(typename lexer::token_type t) const + { + if (t != last_token) + { + std::string error_msg = "parse error - unexpected "; + error_msg += (last_token == lexer::token_type::parse_error ? ("'" + m_lexer.get_token() + "'") : + lexer::token_type_name(last_token)); + error_msg += "; expected " + lexer::token_type_name(t); + throw std::invalid_argument(error_msg); + } + } + + void unexpect(typename lexer::token_type t) const + { + if (t == last_token) + { + std::string error_msg = "parse error - unexpected "; + error_msg += (last_token == lexer::token_type::parse_error ? ("'" + m_lexer.get_token() + "'") : + lexer::token_type_name(last_token)); + throw std::invalid_argument(error_msg); + } + } + + private: + /// current level of recursion + int depth = 0; + /// callback function + parser_callback_t callback; + /// the type of the last read token + typename lexer::token_type last_token = lexer::token_type::uninitialized; + /// the lexer + lexer m_lexer; + }; +}; + + +///////////// +// presets // +///////////// + +/*! +@brief default JSON class + +This type is the default specialization of the @ref basic_json class which uses +the standard template types. + +@since version 1.0.0 +*/ +using json = basic_json<>; +} + + +///////////////////////// +// nonmember functions // +///////////////////////// + +// specialization of std::swap, and std::hash +namespace std +{ +/*! +@brief exchanges the values of two JSON objects + +@since version 1.0.0 +*/ +template <> +inline void swap(nlohmann::json& j1, + nlohmann::json& j2) noexcept( + is_nothrow_move_constructible::value and + is_nothrow_move_assignable::value + ) +{ + j1.swap(j2); +} + +/// hash value for JSON objects +template <> +struct hash +{ + /*! + @brief return a hash value for a JSON object + + @since version 1.0.0 + */ + std::size_t operator()(const nlohmann::json& j) const + { + // a naive hashing via the string representation + const auto& h = hash(); + return h(j.dump()); + } +}; +} + +/*! +@brief user-defined string literal for JSON values + +This operator implements a user-defined string literal for JSON objects. It can +be used by adding \p "_json" to a string literal and returns a JSON object if +no parse error occurred. + +@param[in] s a string representation of a JSON object +@return a JSON object + +@since version 1.0.0 +*/ +inline nlohmann::json operator "" _json(const char* s, std::size_t) +{ + return nlohmann::json::parse(reinterpret_cast(s)); +} + +// restore GCC/clang diagnostic settings +#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) + #pragma GCC diagnostic pop +#endif + +#endif From 81b05726ce75a3cc31715bc32827610d4ee10edc Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sun, 17 Apr 2016 02:13:05 +0000 Subject: [PATCH 066/302] catch any stupid or lazy mistakes that could be made... --- .../LoginServer/src/shared/ClientConnection.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp index 69a1f0c2..de827382 100755 --- a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp @@ -244,7 +244,14 @@ void ClientConnection::validateClient(const std::string & id, const std::string } else { - ErrorMessage err("Login Failed", j["userMessage"]); + std::string errMsg = j["userMessage"]; + + if (errMsg.empty()) //prevent stupid mistakes + { + errMsg = "Error: authentication service provided no user message."; + } + + ErrorMessage err("Login Failed", errMsg); this->send(err, true); } From 0e22ecd027cf3325d66c731cb51d911aa299db1d Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sun, 17 Apr 2016 04:38:16 +0000 Subject: [PATCH 067/302] remove station related session code --- .../src/shared/ClientConnection.cpp | 116 ++++++++---------- .../src/shared/ConfigLoginServer.cpp | 2 - .../src/shared/ConfigLoginServer.h | 18 --- .../LoginServer/src/shared/LoginServer.cpp | 62 +--------- .../LoginServer/src/shared/LoginServer.h | 1 - .../LoginServer/src/shared/PurgeManager.cpp | 5 +- 6 files changed, 56 insertions(+), 148 deletions(-) diff --git a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp index de827382..50cd90b7 100755 --- a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp @@ -184,91 +184,73 @@ static size_t WriteCallback(void *contents, size_t size, size_t nmemb, void *use // Grab a challenge key from the list and send it back to the client. void ClientConnection::validateClient(const std::string & id, const std::string & key) { + StationId suid = atoi(id.c_str()); - if (ConfigLoginServer::getValidateStationKey()) + if (suid==0) { - m_requestedAdminSuid = atoi(id.c_str()); // for normal logins, this will be set to 0 - - SessionApiClient * sessionApiClient = LoginServer::getInstance().getSessionApiClient(); - DEBUG_FATAL(!sessionApiClient, ("Config file says to validate with session, but no session api is installed")); - if(sessionApiClient) //lint !e774 //(Boolean within 'if' always evaluates to True) the previous DEBUG_FATAL probably causes this warning - sessionApiClient->validateClient(this, key); + std::hash h; + suid = h(id); //lint !e603 // Symbol 'h' not initialized (it's a functor) } - else if (ConfigLoginServer::getDoSessionLogin()) + + LOG("LoginClientConnection", ("validateClient() for stationId (%lu) at IP (%s), id (%s) key (%s), skipping validating session", m_stationId, getRemoteAddress().c_str(), id.c_str(), key.c_str())); + + std::string authURL = std::string(ConfigLoginServer::getExternalAuthUrl()); + + if (ConfigLoginServer::getUseExternalAuth() == true && !(authURL.empty())) { - SessionApiClient * sessionApiClient = LoginServer::getInstance().getSessionApiClient(); - DEBUG_FATAL(!sessionApiClient, ("Config file says to do session login, but no session api is installed")); - if(sessionApiClient) //lint !e774 //(Boolean within 'if' always evaluates to True) the previous DEBUG_FATAL probably causes this warning - sessionApiClient->loginClient(this, id, key); - } - else - { - StationId suid = atoi(id.c_str()); + CURL *curl; + CURLcode res; + std::string readBuffer; - if (suid==0) + curl = curl_easy_init(); + + if (curl) { - std::hash h; - suid = h(id); //lint !e603 // Symbol 'h' not initialized (it's a functor) - } - - LOG("LoginClientConnection", ("validateClient() for stationId (%lu) at IP (%s), id (%s) key (%s), skipping validating session", m_stationId, getRemoteAddress().c_str(), id.c_str(), key.c_str())); + std::string username(curl_easy_escape(curl, id.c_str(), 0)); + std::string password(curl_easy_escape(curl, key.c_str(), 0)); + std::string ip(curl_easy_escape(curl, getRemoteAddress().c_str(), 0)); - std::string authURL = std::string(ConfigLoginServer::getExternalAuthUrl()); - - if (ConfigLoginServer::getUseExternalAuth() == true && !(authURL.empty())) - { - CURL *curl; - CURLcode res; - std::string readBuffer; - - curl = curl_easy_init(); - - if (curl) - { - std::string username(curl_easy_escape(curl, id.c_str(), id.length())); - std::string password(curl_easy_escape(curl, key.c_str(), key.length())); - - curl_easy_setopt(curl, CURLOPT_URL, (authURL + username + "&pw=" + password).c_str()); - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback); - curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer); + curl_easy_setopt(curl, CURLOPT_URL, (authURL + username + "&pw=" + password + "&ip=" + ip)); + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback); + curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer); - res = curl_easy_perform(curl); + res = curl_easy_perform(curl); - if (res == CURLE_OK && !(readBuffer.empty())) + if (res == CURLE_OK && !(readBuffer.empty())) + { + json j = json::parse(readBuffer); + + if (j["status"] == "success") { - json j = json::parse(readBuffer); - - if (j["status"] == "success") - { - LoginServer::getInstance().onValidateClient(suid, id, this, true, NULL, 0xFFFFFFFF, 0xFFFFFFFF); - } - else - { - std::string errMsg = j["userMessage"]; - - if (errMsg.empty()) //prevent stupid mistakes - { - errMsg = "Error: authentication service provided no user message."; - } - - ErrorMessage err("Login Failed", errMsg); - this->send(err, true); - } - + LoginServer::getInstance().onValidateClient(suid, id, this, true, NULL, 0xFFFFFFFF, 0xFFFFFFFF); } else { - ErrorMessage err("Login Failed", "Error connecting to authentication service."); + std::string errMsg = j["userMessage"]; + + if (errMsg.empty()) //prevent stupid mistakes + { + errMsg = "Error: authentication service provided no user message."; + } + + ErrorMessage err("Login Failed", errMsg); this->send(err, true); } - curl_easy_cleanup(curl); } + else + { + ErrorMessage err("Login Failed", "Error connecting to authentication service."); + this->send(err, true); + } + + curl_easy_cleanup(curl); + } - else - { - LoginServer::getInstance().onValidateClient(suid, id, this, true, NULL, 0xFFFFFFFF, 0xFFFFFFFF); - } + } + else + { + LoginServer::getInstance().onValidateClient(suid, id, this, true, NULL, 0xFFFFFFFF, 0xFFFFFFFF); } } diff --git a/engine/server/application/LoginServer/src/shared/ConfigLoginServer.cpp b/engine/server/application/LoginServer/src/shared/ConfigLoginServer.cpp index 24367e9f..457d8b59 100755 --- a/engine/server/application/LoginServer/src/shared/ConfigLoginServer.cpp +++ b/engine/server/application/LoginServer/src/shared/ConfigLoginServer.cpp @@ -86,8 +86,6 @@ void ConfigLoginServer::install(void) KEY_INT (maxCharactersPerCluster, 10000); KEY_INT (maxCharactersPerAccount, 20); KEY_BOOL (validateClientVersion, true); - KEY_BOOL (validateStationKey, false); - KEY_BOOL (doSessionLogin, false); KEY_BOOL (doConsumption, false); KEY_STRING (sessionServers, "localhost:3004"); KEY_INT (sessionType, SESSION_TYPE_STARWARS); diff --git a/engine/server/application/LoginServer/src/shared/ConfigLoginServer.h b/engine/server/application/LoginServer/src/shared/ConfigLoginServer.h index 3a84098a..28d05bec 100755 --- a/engine/server/application/LoginServer/src/shared/ConfigLoginServer.h +++ b/engine/server/application/LoginServer/src/shared/ConfigLoginServer.h @@ -19,8 +19,6 @@ class ConfigLoginServer int pingServicePort; int httpServicePort; bool validateClientVersion; - bool validateStationKey; - bool doSessionLogin; bool doConsumption; const char * sessionServers; int sessionType; @@ -77,8 +75,6 @@ class ConfigLoginServer static const uint16 getPingServicePort(); static const uint16 getHttpServicePort(); static const bool getValidateClientVersion(); - static const bool getValidateStationKey(); - static const bool getDoSessionLogin(); static const bool getDoConsumption(); static const char * getSessionServers(); static const int getSessionType(); @@ -207,20 +203,6 @@ inline const bool ConfigLoginServer::getValidateClientVersion() // ---------------------------------------------------------------------- -inline const bool ConfigLoginServer::getValidateStationKey() -{ - return (data->validateStationKey); -} - -// ---------------------------------------------------------------------- - -inline const bool ConfigLoginServer::getDoSessionLogin() -{ - return (data->doSessionLogin); -} - -// ---------------------------------------------------------------------- - inline const bool ConfigLoginServer::getDoConsumption() { return (data->doConsumption); diff --git a/engine/server/application/LoginServer/src/shared/LoginServer.cpp b/engine/server/application/LoginServer/src/shared/LoginServer.cpp index 72201382..d4d1f0bf 100755 --- a/engine/server/application/LoginServer/src/shared/LoginServer.cpp +++ b/engine/server/application/LoginServer/src/shared/LoginServer.cpp @@ -193,11 +193,6 @@ m_soeMonitor(0) connectToMessage("FeatureIdTransactionRequest"); connectToMessage("FeatureIdTransactionSyncUpdate"); keyServer = new KeyServer; - - if (ConfigLoginServer::getValidateStationKey() || ConfigLoginServer::getDoSessionLogin()) - { - installSessionValidation(); - } } //----------------------------------------------------------------------- @@ -259,30 +254,6 @@ void LoginServer::removeClient (int clientId) //----------------------------------------------------------------------- -void LoginServer::installSessionValidation() -{ - int i = 0; - std::vector sessionServers; - - int numberOfSessionServers = ConfigLoginServer::getNumberOfSessionServers(); - for (i = 0; i < numberOfSessionServers; ++i) - { - char const * const p = ConfigLoginServer::getSessionServer(i); - if(p) - { - REPORT_LOG(true, ("Using session server %s\n", p)); - sessionServers.push_back(p); - } - } - - // if there were none specified, use defaults - FATAL(i == 0, ("No session servers specified for session API")); - - m_sessionApiClient = new SessionApiClient(&sessionServers[0], i); -} - -//----------------------------------------------------------------------- - bool LoginServer::deleteCharacter(uint32 clusterId, NetworkId const & characterId, StationId suid) { const ClusterListEntry *cle = findClusterById(clusterId); @@ -1374,33 +1345,12 @@ void LoginServer::onValidateClient(StationId suid, const std::string & username, IGNORE_RETURN(memset(keyBuffer, 0, len)); - if (ConfigLoginServer::getDoConsumption() || ConfigLoginServer::getDoSessionLogin()) - { - // pass the sessionkey - len = apiSessionIdWidth + sizeof(StationId); - memcpy(keyBufferPointer, sessionKey, apiSessionIdWidth); - keyBufferPointer += apiSessionIdWidth; - memcpy(keyBufferPointer, &suid, sizeof(StationId)); - - // if LoginServer did session login, send the session key back to the client; - // the client normally gets the session key from the LaunchPad, but in this mode - // where the LoginServer does the session login, it will get it from the LoginServer - if (ConfigLoginServer::getDoSessionLogin()) - { - std::string const strSessionKey(sessionKey, apiSessionIdWidth); - GenericValueTypeMessage const msg("SetSessionKey", strSessionKey); - conn->send(msg, true); - } - } - else - { - // If we aren't validating sessions, pack username, security status, and username to connectionserver - memcpy(keyBufferPointer, &suid, sizeof(uint32)); //lint !e64 !e119 !e534 (lint isn't resolving memcpy properly) - keyBufferPointer += sizeof(uint32); - memcpy(keyBufferPointer, &isSecure, sizeof(bool)); //lint !e64 !e119 !e534 - keyBufferPointer += sizeof(bool); - memcpy(keyBufferPointer, username.c_str(), MAX_ACCOUNT_NAME_LENGTH); //lint !e64 !e119 !e534 - } + // If we aren't validating sessions, pack username, security status, and username to connectionserver + memcpy(keyBufferPointer, &suid, sizeof(uint32)); //lint !e64 !e119 !e534 (lint isn't resolving memcpy properly) + keyBufferPointer += sizeof(uint32); + memcpy(keyBufferPointer, &isSecure, sizeof(bool)); //lint !e64 !e119 !e534 + keyBufferPointer += sizeof(bool); + memcpy(keyBufferPointer, username.c_str(), MAX_ACCOUNT_NAME_LENGTH); //lint !e64 !e119 !e534 KeyShare::Token token = LoginServer::getInstance().makeToken(keyBuffer, len); Archive::ByteStream a; diff --git a/engine/server/application/LoginServer/src/shared/LoginServer.h b/engine/server/application/LoginServer/src/shared/LoginServer.h index f1d4de5b..f17db0d2 100755 --- a/engine/server/application/LoginServer/src/shared/LoginServer.h +++ b/engine/server/application/LoginServer/src/shared/LoginServer.h @@ -139,7 +139,6 @@ private: typedef std::map ActiveClientsType; private: - void installSessionValidation(); ClusterListEntry * findClusterById (uint32 clusterId); ClusterListEntry * findClusterByName (const std::string & clusterName); ClusterListEntry * findClusterByConnection (const CentralServerConnection *connection); diff --git a/engine/server/application/LoginServer/src/shared/PurgeManager.cpp b/engine/server/application/LoginServer/src/shared/PurgeManager.cpp index 2d649c52..043d468f 100755 --- a/engine/server/application/LoginServer/src/shared/PurgeManager.cpp +++ b/engine/server/application/LoginServer/src/shared/PurgeManager.cpp @@ -120,10 +120,7 @@ void PurgeManager::onGetAccountForPurge(StationId account, int purgePhase) PurgeRecord record(account, static_cast(purgePhase)); m_purgeRecords.insert(std::make_pair(account,record)); - if (ConfigLoginServer::getValidateStationKey()) - NON_NULL(LoginServer::getInstance().getSessionApiClient())->checkStatusForPurge(account); - else - onCheckStatusForPurge(account, false); + onCheckStatusForPurge(account, false); } } From 7d03daec7ddfd7dfd568fc6f1e81f5fafed14f5e Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sun, 17 Apr 2016 04:42:28 +0000 Subject: [PATCH 068/302] remove more dead code --- .../src/shared/ClientConnection.cpp | 37 +++---------------- .../src/shared/ConfigConnectionServer.h | 10 ----- .../src/shared/ConnectionServer.cpp | 6 --- 3 files changed, 6 insertions(+), 47 deletions(-) diff --git a/engine/server/application/ConnectionServer/src/shared/ClientConnection.cpp b/engine/server/application/ConnectionServer/src/shared/ClientConnection.cpp index 32b3811c..3086085e 100755 --- a/engine/server/application/ConnectionServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/ConnectionServer/src/shared/ClientConnection.cpp @@ -330,15 +330,7 @@ void ClientConnection::handleClientIdMessage(const ClientIdMsg& msg) Archive::ReadIterator ri(t); KeyShare::Token token(ri); - if (!ConfigConnectionServer::getValidateStationKey()) - { - // get SUID from token - result = ConnectionServer::decryptToken(token, m_suid, m_isSecure, m_accountName); - } - else - { - result = ConnectionServer::decryptToken(token, sessionId, m_requestedSuid); - } + result = ConnectionServer::decryptToken(token, sessionId, m_requestedSuid); static const std::string loginTrace("TRACE_LOGIN"); LOG(loginTrace, ("ClientConnection SUID = %d", m_suid)); @@ -378,30 +370,13 @@ void ClientConnection::handleClientIdMessage(const ClientIdMsg& msg) return; } - if (ConfigConnectionServer::getValidateStationKey()) + m_suid = atoi(m_accountName.c_str()); + if (m_suid == 0) { - SessionApiClient * session = ConnectionServer::getSessionApiClient(); - NOT_NULL(session); - if(session) - { - session->validateClient(this, sessionId); - } - else - { - ConnectionServer::dropClient(this, "SessionApiClient is not available!"); - disconnect(); - } - } - else - { - m_suid = atoi(m_accountName.c_str()); - if (m_suid == 0) - { - std::hash h; - m_suid = h(m_accountName.c_str()); - } - onValidateClient(m_suid, m_accountName, m_isSecure, nullptr, ConfigConnectionServer::getDefaultGameFeatures(), ConfigConnectionServer::getDefaultSubscriptionFeatures(), 0, 0, 0, 0, ConfigConnectionServer::getFakeBuddyPoints()); + std::hash h; + m_suid = h(m_accountName.c_str()); } + onValidateClient(m_suid, m_accountName, m_isSecure, nullptr, ConfigConnectionServer::getDefaultGameFeatures(), ConfigConnectionServer::getDefaultSubscriptionFeatures(), 0, 0, 0, 0, ConfigConnectionServer::getFakeBuddyPoints()); } else { diff --git a/engine/server/application/ConnectionServer/src/shared/ConfigConnectionServer.h b/engine/server/application/ConnectionServer/src/shared/ConfigConnectionServer.h index 46f67d1e..e3634b88 100755 --- a/engine/server/application/ConnectionServer/src/shared/ConfigConnectionServer.h +++ b/engine/server/application/ConnectionServer/src/shared/ConfigConnectionServer.h @@ -104,7 +104,6 @@ public: static const int getClientHashTableSize (); static const int getLagReportThreshold (); - static bool getValidateStationKey(); static const char * getSessionServers(); static const int getSessionType(); static bool getDisableSessionLogout(); @@ -349,15 +348,6 @@ inline const int ConfigConnectionServer::getLagReportThreshold() // ---------------------------------------------------------------------- -//------------------------------------------------------------------------------------------ - -inline bool ConfigConnectionServer::getValidateStationKey() -{ - return data->validateStationKey; -} - -//------------------------------------------------------------------------------------------ - inline const char * ConfigConnectionServer::getSessionServers() { return data->sessionServers; diff --git a/engine/server/application/ConnectionServer/src/shared/ConnectionServer.cpp b/engine/server/application/ConnectionServer/src/shared/ConnectionServer.cpp index 10d0c99f..d2a7f565 100755 --- a/engine/server/application/ConnectionServer/src/shared/ConnectionServer.cpp +++ b/engine/server/application/ConnectionServer/src/shared/ConnectionServer.cpp @@ -119,12 +119,6 @@ m_recoveringClientList() Address a("", ConfigConnectionServer::getPingPort()); IGNORE_RETURN(pingSocket->bind (a)); - - if (ConfigConnectionServer::getValidateStationKey()) - { - installSessionValidation(); - } - } //----------------------------------------------------------------------- From a76c5dd70b96d6dfb0fba5fb7ce4c7908523a1e2 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sun, 17 Apr 2016 19:17:41 +0000 Subject: [PATCH 069/302] make things more standardized --- .../application/LoginServer/src/shared/ClientConnection.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp index 50cd90b7..901880ac 100755 --- a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp @@ -210,7 +210,7 @@ void ClientConnection::validateClient(const std::string & id, const std::string std::string password(curl_easy_escape(curl, key.c_str(), 0)); std::string ip(curl_easy_escape(curl, getRemoteAddress().c_str(), 0)); - curl_easy_setopt(curl, CURLOPT_URL, (authURL + username + "&pw=" + password + "&ip=" + ip)); + curl_easy_setopt(curl, CURLOPT_URL, (authURL + "?user_name=" + username + "&user_password=" + password + "&user_ip=" + ip)); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer); From a10e8c28cd14f67ee005d65d3266c102d0d88a34 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sun, 17 Apr 2016 19:21:45 +0000 Subject: [PATCH 070/302] let's use post --- .../application/LoginServer/src/shared/ClientConnection.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp index 901880ac..c8a94422 100755 --- a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp @@ -210,7 +210,8 @@ void ClientConnection::validateClient(const std::string & id, const std::string std::string password(curl_easy_escape(curl, key.c_str(), 0)); std::string ip(curl_easy_escape(curl, getRemoteAddress().c_str(), 0)); - curl_easy_setopt(curl, CURLOPT_URL, (authURL + "?user_name=" + username + "&user_password=" + password + "&user_ip=" + ip)); + curl_easy_setopt(curl, CURLOPT_URL, authURL); + curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "user_name=" + username + "&user_password=" + password + "&user_ip=" + ip); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer); From 1405ff948dd9172143d50f406d79fbd388fdd8cd Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sun, 17 Apr 2016 22:21:56 +0000 Subject: [PATCH 071/302] finally this bitch is working with the php auth system --- .../LoginServer/src/linux/main.cpp | 3 +- .../src/shared/ClientConnection.cpp | 43 +++++++++++-------- 2 files changed, 27 insertions(+), 19 deletions(-) diff --git a/engine/server/application/LoginServer/src/linux/main.cpp b/engine/server/application/LoginServer/src/linux/main.cpp index e08cb606..37a806d1 100755 --- a/engine/server/application/LoginServer/src/linux/main.cpp +++ b/engine/server/application/LoginServer/src/linux/main.cpp @@ -42,7 +42,8 @@ int main(int argc, char ** argv) ConfigLoginServer::install(); //-- run game - SetupSharedFoundation::callbackWithExceptionHandling(LoginServer::run); + LoginServer::run(); + //SetupSharedFoundation::callbackWithExceptionHandling(LoginServer::run); SetupSharedFoundation::remove(); return 0; diff --git a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp index c8a94422..ff77bed8 100755 --- a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp @@ -194,9 +194,9 @@ void ClientConnection::validateClient(const std::string & id, const std::string LOG("LoginClientConnection", ("validateClient() for stationId (%lu) at IP (%s), id (%s) key (%s), skipping validating session", m_stationId, getRemoteAddress().c_str(), id.c_str(), key.c_str())); - std::string authURL = std::string(ConfigLoginServer::getExternalAuthUrl()); + const char * authURL = ConfigLoginServer::getExternalAuthUrl(); - if (ConfigLoginServer::getUseExternalAuth() == true && !(authURL.empty())) + if (authURL != NULL && authURL != '\0') { CURL *curl; CURLcode res; @@ -206,42 +206,48 @@ void ClientConnection::validateClient(const std::string & id, const std::string if (curl) { - std::string username(curl_easy_escape(curl, id.c_str(), 0)); - std::string password(curl_easy_escape(curl, key.c_str(), 0)); - std::string ip(curl_easy_escape(curl, getRemoteAddress().c_str(), 0)); + std::string postData = "user_name=" + id + "&user_password=" + key; curl_easy_setopt(curl, CURLOPT_URL, authURL); - curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "user_name=" + username + "&user_password=" + password + "&user_ip=" + ip); + curl_easy_setopt(curl, CURLOPT_POSTFIELDS, postData.c_str()); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer); res = curl_easy_perform(curl); - + if (res == CURLE_OK && !(readBuffer.empty())) { json j = json::parse(readBuffer); + std::string errMsg = "Message not provided by authentication service."; - if (j["status"] == "success") + if (j.count("status") != 0) { - LoginServer::getInstance().onValidateClient(suid, id, this, true, NULL, 0xFFFFFFFF, 0xFFFFFFFF); + std::string status = j["status"].get(); + + if (status == "success") + { + LoginServer::getInstance().onValidateClient(suid, id, this, true, NULL, 0xFFFFFFFF, 0xFFFFFFFF); + } + else + { + if (j.count("message") != 0) + { + errMsg = j["message"].get(); + } + + ErrorMessage err("Login Failed", errMsg); + this->send(err, true); + } } else { - std::string errMsg = j["userMessage"]; - - if (errMsg.empty()) //prevent stupid mistakes - { - errMsg = "Error: authentication service provided no user message."; - } - ErrorMessage err("Login Failed", errMsg); this->send(err, true); } - } else { - ErrorMessage err("Login Failed", "Error connecting to authentication service."); + ErrorMessage err("Login Failed", "Could not connect to authentication service."); this->send(err, true); } @@ -251,6 +257,7 @@ void ClientConnection::validateClient(const std::string & id, const std::string } else { + WARNING(true, ("wtf")); LoginServer::getInstance().onValidateClient(suid, id, this, true, NULL, 0xFFFFFFFF, 0xFFFFFFFF); } } From 99a267b59f6bc0d6844964495925057fc429b7d7 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sun, 17 Apr 2016 22:26:56 +0000 Subject: [PATCH 072/302] add ip address and station id to our request so we can alias them in the db on the php side (todo) --- .../application/LoginServer/src/shared/ClientConnection.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp index ff77bed8..1aaa69ad 100755 --- a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp @@ -206,7 +206,7 @@ void ClientConnection::validateClient(const std::string & id, const std::string if (curl) { - std::string postData = "user_name=" + id + "&user_password=" + key; + std::string postData = "user_name=" + id + "&user_password=" + key + "&stationID=" + std::to_string(atoi(id.c_str())) + "&ip=" + getRemoteAddress(); curl_easy_setopt(curl, CURLOPT_URL, authURL); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, postData.c_str()); From 72f11faa33ab35759fea04cdf33aab008e54a341 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sun, 17 Apr 2016 22:38:08 +0000 Subject: [PATCH 073/302] remove debug line --- engine/server/application/LoginServer/src/linux/main.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/engine/server/application/LoginServer/src/linux/main.cpp b/engine/server/application/LoginServer/src/linux/main.cpp index 37a806d1..e08cb606 100755 --- a/engine/server/application/LoginServer/src/linux/main.cpp +++ b/engine/server/application/LoginServer/src/linux/main.cpp @@ -42,8 +42,7 @@ int main(int argc, char ** argv) ConfigLoginServer::install(); //-- run game - LoginServer::run(); - //SetupSharedFoundation::callbackWithExceptionHandling(LoginServer::run); + SetupSharedFoundation::callbackWithExceptionHandling(LoginServer::run); SetupSharedFoundation::remove(); return 0; From 8bce22b7b10f8080320db9daef32d96e4133f04b Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sun, 17 Apr 2016 22:42:13 +0000 Subject: [PATCH 074/302] remove "wtf" debug test line --- .../application/LoginServer/src/shared/ClientConnection.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp index 1aaa69ad..f0cde095 100755 --- a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp @@ -257,7 +257,6 @@ void ClientConnection::validateClient(const std::string & id, const std::string } else { - WARNING(true, ("wtf")); LoginServer::getInstance().onValidateClient(suid, id, this, true, NULL, 0xFFFFFFFF, 0xFFFFFFFF); } } From 64a4daada5da28e3e66660d0718d9216e08291da Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sun, 17 Apr 2016 22:50:41 +0000 Subject: [PATCH 075/302] add a more proper check to look for an empty string --- .../application/LoginServer/src/shared/ClientConnection.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp index f0cde095..76538e6b 100755 --- a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp @@ -196,7 +196,7 @@ void ClientConnection::validateClient(const std::string & id, const std::string const char * authURL = ConfigLoginServer::getExternalAuthUrl(); - if (authURL != NULL && authURL != '\0') + if (authURL != NULL && strcmp(authURL, "") != 0) { CURL *curl; CURLcode res; From 9aeea8732e01591d43a0efea608899527020d7e5 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Mon, 18 Apr 2016 03:56:57 +0000 Subject: [PATCH 076/302] Revert "remove station related session code" This reverts commit 0e22ecd027cf3325d66c731cb51d911aa299db1d. --- .../src/shared/ConfigLoginServer.cpp | 2 + .../src/shared/ConfigLoginServer.h | 18 ++++++ .../LoginServer/src/shared/LoginServer.cpp | 62 +++++++++++++++++-- .../LoginServer/src/shared/LoginServer.h | 1 + .../LoginServer/src/shared/PurgeManager.cpp | 5 +- 5 files changed, 81 insertions(+), 7 deletions(-) diff --git a/engine/server/application/LoginServer/src/shared/ConfigLoginServer.cpp b/engine/server/application/LoginServer/src/shared/ConfigLoginServer.cpp index 457d8b59..24367e9f 100755 --- a/engine/server/application/LoginServer/src/shared/ConfigLoginServer.cpp +++ b/engine/server/application/LoginServer/src/shared/ConfigLoginServer.cpp @@ -86,6 +86,8 @@ void ConfigLoginServer::install(void) KEY_INT (maxCharactersPerCluster, 10000); KEY_INT (maxCharactersPerAccount, 20); KEY_BOOL (validateClientVersion, true); + KEY_BOOL (validateStationKey, false); + KEY_BOOL (doSessionLogin, false); KEY_BOOL (doConsumption, false); KEY_STRING (sessionServers, "localhost:3004"); KEY_INT (sessionType, SESSION_TYPE_STARWARS); diff --git a/engine/server/application/LoginServer/src/shared/ConfigLoginServer.h b/engine/server/application/LoginServer/src/shared/ConfigLoginServer.h index 28d05bec..3a84098a 100755 --- a/engine/server/application/LoginServer/src/shared/ConfigLoginServer.h +++ b/engine/server/application/LoginServer/src/shared/ConfigLoginServer.h @@ -19,6 +19,8 @@ class ConfigLoginServer int pingServicePort; int httpServicePort; bool validateClientVersion; + bool validateStationKey; + bool doSessionLogin; bool doConsumption; const char * sessionServers; int sessionType; @@ -75,6 +77,8 @@ class ConfigLoginServer static const uint16 getPingServicePort(); static const uint16 getHttpServicePort(); static const bool getValidateClientVersion(); + static const bool getValidateStationKey(); + static const bool getDoSessionLogin(); static const bool getDoConsumption(); static const char * getSessionServers(); static const int getSessionType(); @@ -203,6 +207,20 @@ inline const bool ConfigLoginServer::getValidateClientVersion() // ---------------------------------------------------------------------- +inline const bool ConfigLoginServer::getValidateStationKey() +{ + return (data->validateStationKey); +} + +// ---------------------------------------------------------------------- + +inline const bool ConfigLoginServer::getDoSessionLogin() +{ + return (data->doSessionLogin); +} + +// ---------------------------------------------------------------------- + inline const bool ConfigLoginServer::getDoConsumption() { return (data->doConsumption); diff --git a/engine/server/application/LoginServer/src/shared/LoginServer.cpp b/engine/server/application/LoginServer/src/shared/LoginServer.cpp index d4d1f0bf..72201382 100755 --- a/engine/server/application/LoginServer/src/shared/LoginServer.cpp +++ b/engine/server/application/LoginServer/src/shared/LoginServer.cpp @@ -193,6 +193,11 @@ m_soeMonitor(0) connectToMessage("FeatureIdTransactionRequest"); connectToMessage("FeatureIdTransactionSyncUpdate"); keyServer = new KeyServer; + + if (ConfigLoginServer::getValidateStationKey() || ConfigLoginServer::getDoSessionLogin()) + { + installSessionValidation(); + } } //----------------------------------------------------------------------- @@ -254,6 +259,30 @@ void LoginServer::removeClient (int clientId) //----------------------------------------------------------------------- +void LoginServer::installSessionValidation() +{ + int i = 0; + std::vector sessionServers; + + int numberOfSessionServers = ConfigLoginServer::getNumberOfSessionServers(); + for (i = 0; i < numberOfSessionServers; ++i) + { + char const * const p = ConfigLoginServer::getSessionServer(i); + if(p) + { + REPORT_LOG(true, ("Using session server %s\n", p)); + sessionServers.push_back(p); + } + } + + // if there were none specified, use defaults + FATAL(i == 0, ("No session servers specified for session API")); + + m_sessionApiClient = new SessionApiClient(&sessionServers[0], i); +} + +//----------------------------------------------------------------------- + bool LoginServer::deleteCharacter(uint32 clusterId, NetworkId const & characterId, StationId suid) { const ClusterListEntry *cle = findClusterById(clusterId); @@ -1345,12 +1374,33 @@ void LoginServer::onValidateClient(StationId suid, const std::string & username, IGNORE_RETURN(memset(keyBuffer, 0, len)); - // If we aren't validating sessions, pack username, security status, and username to connectionserver - memcpy(keyBufferPointer, &suid, sizeof(uint32)); //lint !e64 !e119 !e534 (lint isn't resolving memcpy properly) - keyBufferPointer += sizeof(uint32); - memcpy(keyBufferPointer, &isSecure, sizeof(bool)); //lint !e64 !e119 !e534 - keyBufferPointer += sizeof(bool); - memcpy(keyBufferPointer, username.c_str(), MAX_ACCOUNT_NAME_LENGTH); //lint !e64 !e119 !e534 + if (ConfigLoginServer::getDoConsumption() || ConfigLoginServer::getDoSessionLogin()) + { + // pass the sessionkey + len = apiSessionIdWidth + sizeof(StationId); + memcpy(keyBufferPointer, sessionKey, apiSessionIdWidth); + keyBufferPointer += apiSessionIdWidth; + memcpy(keyBufferPointer, &suid, sizeof(StationId)); + + // if LoginServer did session login, send the session key back to the client; + // the client normally gets the session key from the LaunchPad, but in this mode + // where the LoginServer does the session login, it will get it from the LoginServer + if (ConfigLoginServer::getDoSessionLogin()) + { + std::string const strSessionKey(sessionKey, apiSessionIdWidth); + GenericValueTypeMessage const msg("SetSessionKey", strSessionKey); + conn->send(msg, true); + } + } + else + { + // If we aren't validating sessions, pack username, security status, and username to connectionserver + memcpy(keyBufferPointer, &suid, sizeof(uint32)); //lint !e64 !e119 !e534 (lint isn't resolving memcpy properly) + keyBufferPointer += sizeof(uint32); + memcpy(keyBufferPointer, &isSecure, sizeof(bool)); //lint !e64 !e119 !e534 + keyBufferPointer += sizeof(bool); + memcpy(keyBufferPointer, username.c_str(), MAX_ACCOUNT_NAME_LENGTH); //lint !e64 !e119 !e534 + } KeyShare::Token token = LoginServer::getInstance().makeToken(keyBuffer, len); Archive::ByteStream a; diff --git a/engine/server/application/LoginServer/src/shared/LoginServer.h b/engine/server/application/LoginServer/src/shared/LoginServer.h index f17db0d2..f1d4de5b 100755 --- a/engine/server/application/LoginServer/src/shared/LoginServer.h +++ b/engine/server/application/LoginServer/src/shared/LoginServer.h @@ -139,6 +139,7 @@ private: typedef std::map ActiveClientsType; private: + void installSessionValidation(); ClusterListEntry * findClusterById (uint32 clusterId); ClusterListEntry * findClusterByName (const std::string & clusterName); ClusterListEntry * findClusterByConnection (const CentralServerConnection *connection); diff --git a/engine/server/application/LoginServer/src/shared/PurgeManager.cpp b/engine/server/application/LoginServer/src/shared/PurgeManager.cpp index 043d468f..2d649c52 100755 --- a/engine/server/application/LoginServer/src/shared/PurgeManager.cpp +++ b/engine/server/application/LoginServer/src/shared/PurgeManager.cpp @@ -120,7 +120,10 @@ void PurgeManager::onGetAccountForPurge(StationId account, int purgePhase) PurgeRecord record(account, static_cast(purgePhase)); m_purgeRecords.insert(std::make_pair(account,record)); - onCheckStatusForPurge(account, false); + if (ConfigLoginServer::getValidateStationKey()) + NON_NULL(LoginServer::getInstance().getSessionApiClient())->checkStatusForPurge(account); + else + onCheckStatusForPurge(account, false); } } From cb1035d40eaf26d67f7afec59613723c9c792c9c Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Mon, 18 Apr 2016 03:57:01 +0000 Subject: [PATCH 077/302] Revert "remove more dead code" This reverts commit 7d03daec7ddfd7dfd568fc6f1e81f5fafed14f5e. --- .../src/shared/ClientConnection.cpp | 37 ++++++++++++++++--- .../src/shared/ConfigConnectionServer.h | 10 +++++ .../src/shared/ConnectionServer.cpp | 6 +++ 3 files changed, 47 insertions(+), 6 deletions(-) diff --git a/engine/server/application/ConnectionServer/src/shared/ClientConnection.cpp b/engine/server/application/ConnectionServer/src/shared/ClientConnection.cpp index 3086085e..32b3811c 100755 --- a/engine/server/application/ConnectionServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/ConnectionServer/src/shared/ClientConnection.cpp @@ -330,7 +330,15 @@ void ClientConnection::handleClientIdMessage(const ClientIdMsg& msg) Archive::ReadIterator ri(t); KeyShare::Token token(ri); - result = ConnectionServer::decryptToken(token, sessionId, m_requestedSuid); + if (!ConfigConnectionServer::getValidateStationKey()) + { + // get SUID from token + result = ConnectionServer::decryptToken(token, m_suid, m_isSecure, m_accountName); + } + else + { + result = ConnectionServer::decryptToken(token, sessionId, m_requestedSuid); + } static const std::string loginTrace("TRACE_LOGIN"); LOG(loginTrace, ("ClientConnection SUID = %d", m_suid)); @@ -370,13 +378,30 @@ void ClientConnection::handleClientIdMessage(const ClientIdMsg& msg) return; } - m_suid = atoi(m_accountName.c_str()); - if (m_suid == 0) + if (ConfigConnectionServer::getValidateStationKey()) { - std::hash h; - m_suid = h(m_accountName.c_str()); + SessionApiClient * session = ConnectionServer::getSessionApiClient(); + NOT_NULL(session); + if(session) + { + session->validateClient(this, sessionId); + } + else + { + ConnectionServer::dropClient(this, "SessionApiClient is not available!"); + disconnect(); + } + } + else + { + m_suid = atoi(m_accountName.c_str()); + if (m_suid == 0) + { + std::hash h; + m_suid = h(m_accountName.c_str()); + } + onValidateClient(m_suid, m_accountName, m_isSecure, nullptr, ConfigConnectionServer::getDefaultGameFeatures(), ConfigConnectionServer::getDefaultSubscriptionFeatures(), 0, 0, 0, 0, ConfigConnectionServer::getFakeBuddyPoints()); } - onValidateClient(m_suid, m_accountName, m_isSecure, nullptr, ConfigConnectionServer::getDefaultGameFeatures(), ConfigConnectionServer::getDefaultSubscriptionFeatures(), 0, 0, 0, 0, ConfigConnectionServer::getFakeBuddyPoints()); } else { diff --git a/engine/server/application/ConnectionServer/src/shared/ConfigConnectionServer.h b/engine/server/application/ConnectionServer/src/shared/ConfigConnectionServer.h index e3634b88..46f67d1e 100755 --- a/engine/server/application/ConnectionServer/src/shared/ConfigConnectionServer.h +++ b/engine/server/application/ConnectionServer/src/shared/ConfigConnectionServer.h @@ -104,6 +104,7 @@ public: static const int getClientHashTableSize (); static const int getLagReportThreshold (); + static bool getValidateStationKey(); static const char * getSessionServers(); static const int getSessionType(); static bool getDisableSessionLogout(); @@ -348,6 +349,15 @@ inline const int ConfigConnectionServer::getLagReportThreshold() // ---------------------------------------------------------------------- +//------------------------------------------------------------------------------------------ + +inline bool ConfigConnectionServer::getValidateStationKey() +{ + return data->validateStationKey; +} + +//------------------------------------------------------------------------------------------ + inline const char * ConfigConnectionServer::getSessionServers() { return data->sessionServers; diff --git a/engine/server/application/ConnectionServer/src/shared/ConnectionServer.cpp b/engine/server/application/ConnectionServer/src/shared/ConnectionServer.cpp index d2a7f565..10d0c99f 100755 --- a/engine/server/application/ConnectionServer/src/shared/ConnectionServer.cpp +++ b/engine/server/application/ConnectionServer/src/shared/ConnectionServer.cpp @@ -119,6 +119,12 @@ m_recoveringClientList() Address a("", ConfigConnectionServer::getPingPort()); IGNORE_RETURN(pingSocket->bind (a)); + + if (ConfigConnectionServer::getValidateStationKey()) + { + installSessionValidation(); + } + } //----------------------------------------------------------------------- From a82bb979d79dded832b60105ff72d83088b74c2c Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Mon, 18 Apr 2016 19:52:56 +0000 Subject: [PATCH 078/302] reduce code complexity/readability, hopefully make slightly faster --- .../src/shared/ClientConnection.cpp | 42 +++++++------------ 1 file changed, 16 insertions(+), 26 deletions(-) diff --git a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp index 76538e6b..b2802982 100755 --- a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp @@ -198,14 +198,11 @@ void ClientConnection::validateClient(const std::string & id, const std::string if (authURL != NULL && strcmp(authURL, "") != 0) { - CURL *curl; - CURLcode res; - std::string readBuffer; - - curl = curl_easy_init(); + CURL *curl = curl_easy_init(); if (curl) { + std::string readBuffer; std::string postData = "user_name=" + id + "&user_password=" + key + "&stationID=" + std::to_string(atoi(id.c_str())) + "&ip=" + getRemoteAddress(); curl_easy_setopt(curl, CURLOPT_URL, authURL); @@ -213,34 +210,29 @@ void ClientConnection::validateClient(const std::string & id, const std::string curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer); - res = curl_easy_perform(curl); + CURLcode res = curl_easy_perform(curl); if (res == CURLE_OK && !(readBuffer.empty())) { json j = json::parse(readBuffer); - std::string errMsg = "Message not provided by authentication service."; - if (j.count("status") != 0) + if (j.count("status") != 0 && j["status"].get() == "success") { - std::string status = j["status"].get(); - - if (status == "success") - { - LoginServer::getInstance().onValidateClient(suid, id, this, true, NULL, 0xFFFFFFFF, 0xFFFFFFFF); - } - else - { - if (j.count("message") != 0) - { - errMsg = j["message"].get(); - } - - ErrorMessage err("Login Failed", errMsg); - this->send(err, true); - } + LoginServer::getInstance().onValidateClient(suid, id, this, true, NULL, 0xFFFFFFFF, 0xFFFFFFFF); } else { + std::string errMsg; + + if (j.count("message") != 0) + { + errMsg = j["message"].get(); + } + else + { + errMsg = "Message not provided by authentication service."; + } + ErrorMessage err("Login Failed", errMsg); this->send(err, true); } @@ -250,9 +242,7 @@ void ClientConnection::validateClient(const std::string & id, const std::string ErrorMessage err("Login Failed", "Could not connect to authentication service."); this->send(err, true); } - curl_easy_cleanup(curl); - } } else From 7f1c59a44c26765ea456f1bdc0774b6b71801786 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Mon, 18 Apr 2016 20:02:49 +0000 Subject: [PATCH 079/302] just evaluate these as bools --- .../application/LoginServer/src/shared/ClientConnection.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp index b2802982..d0b99086 100755 --- a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp @@ -216,7 +216,7 @@ void ClientConnection::validateClient(const std::string & id, const std::string { json j = json::parse(readBuffer); - if (j.count("status") != 0 && j["status"].get() == "success") + if (j.count("status") && j["status"].get() == "success") { LoginServer::getInstance().onValidateClient(suid, id, this, true, NULL, 0xFFFFFFFF, 0xFFFFFFFF); } @@ -224,7 +224,7 @@ void ClientConnection::validateClient(const std::string & id, const std::string { std::string errMsg; - if (j.count("message") != 0) + if (j.count("message")) { errMsg = j["message"].get(); } From 2375f62ccf015b58b4cf98d0f14b16271d5d2e5a Mon Sep 17 00:00:00 2001 From: swg Date: Thu, 21 Apr 2016 22:07:01 +0100 Subject: [PATCH 080/302] Adding serverinfo command --- .../console/ConsoleCommandParserServer.cpp | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserServer.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserServer.cpp index 247aec16..4ae847c2 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserServer.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserServer.cpp @@ -21,6 +21,7 @@ #include "serverGame/GuildObject.h" #include "serverGame/MessageToQueue.h" #include "serverGame/NameManager.h" +#include "serverGame/ObjectTracker.h" #include "serverGame/PlanetObject.h" #include "serverGame/PlayerCreatureController.h" #include "serverGame/PlayerObject.h" @@ -195,6 +196,7 @@ static const CommandParser::CmdInfo cmds[] = {"setCompletedTutorial", 1, "", "Mark the account belonging to the specified character (character does not have to be logged in) as having completed the tutorial, so that the skip tutorial option will be available during character creation for that account"}, #ifdef _DEBUG {"setExtraDelayPerFrameMs", 1, "", "Do an intentional sleep each frame, to emulate long loop time"}, + {"serverinfo", 0, "", "Serverinformation"}, #endif {"", 0, "", ""} // this must be last }; @@ -3450,6 +3452,81 @@ bool ConsoleCommandParserServer::performParsing2(const NetworkId & userId, const result += Unicode::narrowToWide(FormattedString<512>().sprintf("Setting extra sleep time per frame to %dms.\n", ms)); GameServer::setExtraDelayPerFrameMs(ms); } + else if (isAbbrev(argv[0], "serverinfo")) + { + char numBuf[64] = {"\0"}; + static const Unicode::String unl(Unicode::narrowToWide(std::string("\n"))); + + + result += Unicode::narrowToWide("PID: "); + snprintf(numBuf, sizeof(numBuf), "%lu", GameServer::getInstance().getProcessId()); + result += Unicode::narrowToWide(std::string(numBuf)) + unl; + + result += Unicode::narrowToWide("Scene: ") + Unicode::narrowToWide(ConfigServerGame::getSceneID()) + unl; + + snprintf(numBuf, sizeof(numBuf), "%d", ObjectTracker::getNumObjects()); + result += Unicode::narrowToWide(std::string("Number of Objects: ") + std::string(numBuf)) + unl; + + snprintf(numBuf, sizeof(numBuf), "%d", ObjectTracker::getNumAI()); + result += Unicode::narrowToWide(std::string("Number of AI: ") + std::string(numBuf)) + unl; + + snprintf(numBuf, sizeof(numBuf), "%d", ObjectTracker::getNumBuildings()); + result += Unicode::narrowToWide(std::string("Number of Buildings: ") + std::string(numBuf)) + unl; + + snprintf(numBuf, sizeof(numBuf), "%d", ObjectTracker::getNumInstallations()); + result += Unicode::narrowToWide(std::string("Number of Installations: ") + std::string(numBuf)) + unl; + + snprintf(numBuf, sizeof(numBuf), "%d", ObjectTracker::getNumCreatures()); + result += Unicode::narrowToWide(std::string("Number of Creatures: ") + std::string(numBuf)) + unl; + + snprintf(numBuf, sizeof(numBuf), "%d", ObjectTracker::getNumPlayers()); + result += Unicode::narrowToWide(std::string("Number of Players: ") + std::string(numBuf)) + unl; + + snprintf(numBuf, sizeof(numBuf), "%d", ObjectTracker::getNumTangibles()); + result += Unicode::narrowToWide(std::string("Number of Tangibles: ") + std::string(numBuf)) + unl; + + snprintf(numBuf, sizeof(numBuf), "%d", ObjectTracker::getNumUniverseObjects()); + result += Unicode::narrowToWide(std::string("Number of UniverseObjects: ") + std::string(numBuf)) + unl; + + snprintf(numBuf, sizeof(numBuf), "%d", ObjectTracker::getNumDynamicAI()); + result += Unicode::narrowToWide(std::string("Number of Dynamic AI: ") + std::string(numBuf)) + unl; + + snprintf(numBuf, sizeof(numBuf), "%d", ObjectTracker::getNumStaticAI()); + result += Unicode::narrowToWide(std::string("Number of Static AI: ") + std::string(numBuf)) + unl; + + snprintf(numBuf, sizeof(numBuf), "%d", ObjectTracker::getNumCombatAI()); + result += Unicode::narrowToWide(std::string("Number of Combat AI: ") + std::string(numBuf)) + unl; + + snprintf(numBuf, sizeof(numBuf), "%d", ObjectTracker::getNumHibernatingAI()); + result += Unicode::narrowToWide(std::string("Number of Hibernating AI: ") + std::string(numBuf)) + unl; + + snprintf(numBuf, sizeof(numBuf), "%d", ObjectTracker::getNumDelayedHibernatingAI()); + result += Unicode::narrowToWide(std::string("Number of Delayed Hibernating AI: ") + std::string(numBuf)) + unl; + + snprintf(numBuf, sizeof(numBuf), "%d", ObjectTracker::getNumIntangibles()); + result += Unicode::narrowToWide(std::string("Number of Intangibles: ") + std::string(numBuf)) + unl; + + snprintf(numBuf, sizeof(numBuf), "%d", ObjectTracker::getNumMissionDatas()); + result += Unicode::narrowToWide(std::string("Number of MissionDatas: ") + std::string(numBuf)) + unl; + + snprintf(numBuf, sizeof(numBuf), "%d", ObjectTracker::getNumMissionObjects()); + result += Unicode::narrowToWide(std::string("Number of MissionObjects: ") + std::string(numBuf)) + unl; + + snprintf(numBuf, sizeof(numBuf), "%d", ObjectTracker::getNumRunTimeRules()); + result += Unicode::narrowToWide(std::string("Number of Runtime Rules: ") + std::string(numBuf)) + unl; + + snprintf(numBuf, sizeof(numBuf), "%d", ObjectTracker::getNumGroupObjects()); + result += Unicode::narrowToWide(std::string("Number of GroupObjects: ") + std::string(numBuf)) + unl; + + snprintf(numBuf, sizeof(numBuf), "%d", ObjectTracker::getNumMissionListEntries()); + result += Unicode::narrowToWide(std::string("Number of MissionListEntries: ") + std::string(numBuf)) + unl; + + snprintf(numBuf, sizeof(numBuf), "%d", ObjectTracker::getNumWaypoints()); + result += Unicode::narrowToWide(std::string("Number of Waypoints: ") + std::string(numBuf)) + unl; + + snprintf(numBuf, sizeof(numBuf), "%d", ObjectTracker::getNumPlayerQuestObjects()); + result += Unicode::narrowToWide(std::string("Number of PlayerQuestObjects: ") + std::string(numBuf)) + unl; + } #endif else { From f273239cfb24fc8308dd7ba8e7c37d8fc2ef5878 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sun, 24 Apr 2016 06:55:46 +0000 Subject: [PATCH 081/302] use existing var --- .../application/LoginServer/src/shared/ClientConnection.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp index d0b99086..5b75436d 100755 --- a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp @@ -203,7 +203,7 @@ void ClientConnection::validateClient(const std::string & id, const std::string if (curl) { std::string readBuffer; - std::string postData = "user_name=" + id + "&user_password=" + key + "&stationID=" + std::to_string(atoi(id.c_str())) + "&ip=" + getRemoteAddress(); + std::string postData = "user_name=" + id + "&user_password=" + key + "&stationID=" + m_stationId + "&ip=" + getRemoteAddress(); curl_easy_setopt(curl, CURLOPT_URL, authURL); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, postData.c_str()); From e2d90426672f241bf257ef1f921d5ff646790281 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sun, 24 Apr 2016 07:01:36 +0000 Subject: [PATCH 082/302] better way...since the last one was broken --- .../application/LoginServer/src/shared/ClientConnection.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp index 5b75436d..27458528 100755 --- a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp @@ -203,7 +203,7 @@ void ClientConnection::validateClient(const std::string & id, const std::string if (curl) { std::string readBuffer; - std::string postData = "user_name=" + id + "&user_password=" + key + "&stationID=" + m_stationId + "&ip=" + getRemoteAddress(); + std::string postData = "user_name=" + id + "&user_password=" + key + "&stationID=" + std::to_string(m_stationId) + "&ip=" + getRemoteAddress(); curl_easy_setopt(curl, CURLOPT_URL, authURL); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, postData.c_str()); From 1507b19b3a0a3f812736925870562037bb169163 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sun, 24 Apr 2016 09:13:15 +0000 Subject: [PATCH 083/302] this properly sends all the data; @devcodex please do a review on this as i'm not 100% sure all these types i'm using (or vars) are necessary --- .../LoginServer/src/shared/ClientConnection.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp index 27458528..f9d8be62 100755 --- a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp @@ -184,7 +184,8 @@ static size_t WriteCallback(void *contents, size_t size, size_t nmemb, void *use // Grab a challenge key from the list and send it back to the client. void ClientConnection::validateClient(const std::string & id, const std::string & key) { - StationId suid = atoi(id.c_str()); + + StationId suid = atoi(id.c_str()); if (suid==0) { @@ -202,8 +203,12 @@ void ClientConnection::validateClient(const std::string & id, const std::string if (curl) { + std::ostringstream postBuf; std::string readBuffer; - std::string postData = "user_name=" + id + "&user_password=" + key + "&stationID=" + std::to_string(m_stationId) + "&ip=" + getRemoteAddress(); + std::string postData; + + postBuf << "user_name=" << id << "&user_password=" << key << "&stationID=" << suid << "&ip=" << getRemoteAddress(); + postData = std::string(postBuf.str()); curl_easy_setopt(curl, CURLOPT_URL, authURL); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, postData.c_str()); @@ -211,7 +216,7 @@ void ClientConnection::validateClient(const std::string & id, const std::string curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer); CURLcode res = curl_easy_perform(curl); - + if (res == CURLE_OK && !(readBuffer.empty())) { json j = json::parse(readBuffer); From 5fc9a0e689d09005050d1032839a9f6a7aacfa7e Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sun, 24 Apr 2016 18:14:31 +0000 Subject: [PATCH 084/302] TEMP FIX HACK TODO - for whatever reason spaced strings seem to return as arrays when using the json parser's .get function --- .../application/LoginServer/src/shared/ClientConnection.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp index f9d8be62..c6610318 100755 --- a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp @@ -231,7 +231,11 @@ void ClientConnection::validateClient(const std::string & id, const std::string if (j.count("message")) { - errMsg = j["message"].get(); + // fuuuu hack here - .get() is returning an array and not a string, wtf? + errMsg = j["message"].dump(); + errMsg.erase(std::remove(errMsg.begin(), errMsg.end(), '"'), errMsg.end()); + errMsg.erase(std::remove(errMsg.begin(), errMsg.end(), ']'), errMsg.end()); + errMsg.erase(std::remove(errMsg.begin(), errMsg.end(), '['), errMsg.end()); } else { From f25da4f7f2c610982852c25c90b780adf025e0fd Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sun, 24 Apr 2016 18:36:16 +0000 Subject: [PATCH 085/302] i'm a doofus and failed to notice the message is being returned as an array --- .../application/LoginServer/src/shared/ClientConnection.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp index c6610318..e2d6a3c9 100755 --- a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp @@ -231,11 +231,7 @@ void ClientConnection::validateClient(const std::string & id, const std::string if (j.count("message")) { - // fuuuu hack here - .get() is returning an array and not a string, wtf? - errMsg = j["message"].dump(); - errMsg.erase(std::remove(errMsg.begin(), errMsg.end(), '"'), errMsg.end()); - errMsg.erase(std::remove(errMsg.begin(), errMsg.end(), ']'), errMsg.end()); - errMsg.erase(std::remove(errMsg.begin(), errMsg.end(), '['), errMsg.end()); + errMsg = j["message"][0].get(); } else { From 52672794fe6819b5294d5f8e493402001c6c9c93 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sun, 24 Apr 2016 18:37:18 +0000 Subject: [PATCH 086/302] actually, i'll strip the array on the php side --- .../application/LoginServer/src/shared/ClientConnection.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp index e2d6a3c9..f9d8be62 100755 --- a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp @@ -231,7 +231,7 @@ void ClientConnection::validateClient(const std::string & id, const std::string if (j.count("message")) { - errMsg = j["message"][0].get(); + errMsg = j["message"].get(); } else { From baecfbebb6a9b9ea372e82acd89066b1d2483aa7 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Wed, 27 Apr 2016 21:54:10 +0000 Subject: [PATCH 087/302] has linker error! but this should be a good start on breaking out our changes and web api into a standalone library/namespace --- .../LoginServer/src/CMakeLists.txt | 5 +- .../src/shared/ClientConnection.cpp | 89 ++++++------------- engine/server/library/CMakeLists.txt | 2 - external/3rd/library/CMakeLists.txt | 4 +- external/3rd/library/webAPI/CMakeLists.txt | 13 +++ .../3rd/library/webAPI}/json.hpp | 0 external/3rd/library/webAPI/webAPI.cpp | 86 ++++++++++++++++++ external/3rd/library/webAPI/webAPI.h | 18 ++++ 8 files changed, 151 insertions(+), 66 deletions(-) create mode 100644 external/3rd/library/webAPI/CMakeLists.txt rename {engine/server/library/json => external/3rd/library/webAPI}/json.hpp (100%) create mode 100644 external/3rd/library/webAPI/webAPI.cpp create mode 100644 external/3rd/library/webAPI/webAPI.h diff --git a/engine/server/application/LoginServer/src/CMakeLists.txt b/engine/server/application/LoginServer/src/CMakeLists.txt index dc0bb23e..12cc8c7e 100644 --- a/engine/server/application/LoginServer/src/CMakeLists.txt +++ b/engine/server/application/LoginServer/src/CMakeLists.txt @@ -81,7 +81,6 @@ endif() include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/shared ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedCommandParser/include/public - ${SWG_ENGINE_SOURCE_DIR}/server/library/json ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedCompression/include/public ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedDatabaseInterface/include/public ${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedDebug/include/public @@ -111,7 +110,7 @@ include_directories( ${SWG_EXTERNALS_SOURCE_DIR}/3rd/library/platform/projects ${SWG_EXTERNALS_SOURCE_DIR}/3rd/library/platform/utils ${SWG_EXTERNALS_SOURCE_DIR}/3rd/library/udplibrary - ${CURL_INCLUDE_DIRS} + ${SWG_EXTERNALS_SOURCE_DIR}/3rd/library/webAPI ) add_executable(LoginServer @@ -120,6 +119,7 @@ add_executable(LoginServer ) target_link_libraries(LoginServer + webAPI sharedCommandParser sharedCompression sharedDatabaseInterface @@ -152,6 +152,5 @@ target_link_libraries(LoginServer CommonAPI LoginAPI MonAPI2 - ${CURL_LIBRARIES} ${CMAKE_DL_LIBS} ) diff --git a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp index f9d8be62..a2daaaad 100755 --- a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp @@ -23,11 +23,9 @@ #include "sharedNetworkMessages/GenericValueTypeMessage.h" #include "sharedNetworkMessages/LoginEnumCluster.h" +#include #include -#include -#include -using json = nlohmann::json; //----------------------------------------------------------------------- ClientConnection::ClientConnection(UdpConnectionMT * u, TcpClient * t) : @@ -171,89 +169,60 @@ void ClientConnection::onReceive(const Archive::ByteStream & message) } //----------------------------------------------------------------------- -// This is used by curl; arguably would be better placed elsewhere? -static size_t WriteCallback(void *contents, size_t size, size_t nmemb, void *userp) -{ - ((std::string*)userp)->append((char*)contents, size * nmemb); - return size * nmemb; -} - - -//----------------------------------------------------------------------- -// Stub routine for station API account validation. -// Grab a challenge key from the list and send it back to the client. +// originally was used to validate station API credentials, now uses our custom api void ClientConnection::validateClient(const std::string & id, const std::string & key) { - StationId suid = atoi(id.c_str()); + int authOK = 0; - if (suid==0) + if (suid == 0) { std::hash h; suid = h(id); //lint !e603 // Symbol 'h' not initialized (it's a functor) } - LOG("LoginClientConnection", ("validateClient() for stationId (%lu) at IP (%s), id (%s) key (%s), skipping validating session", m_stationId, getRemoteAddress().c_str(), id.c_str(), key.c_str())); + LOG("LoginClientConnection", ("validateClient() for stationId (%lu) at IP (%s), id (%s)", m_stationId, getRemoteAddress().c_str(), id.c_str())); - const char * authURL = ConfigLoginServer::getExternalAuthUrl(); + std::string authURL(ConfigLoginServer::getExternalAuthUrl()); - if (authURL != NULL && strcmp(authURL, "") != 0) + if (!authURL.empty()) { - CURL *curl = curl_easy_init(); + std::ostringstream postBuf; + std::string postData; - if (curl) + postBuf << "user_name=" << id << "&user_password=" << key << "&stationID=" << suid << "&ip=" << getRemoteAddress(); + postData = std::string(postBuf.str()); + + std::string response = webAPI::simplePost(authURL, postData, nullptr); + + if (!response.empty()) { - std::ostringstream postBuf; - std::string readBuffer; - std::string postData; - - postBuf << "user_name=" << id << "&user_password=" << key << "&stationID=" << suid << "&ip=" << getRemoteAddress(); - postData = std::string(postBuf.str()); - - curl_easy_setopt(curl, CURLOPT_URL, authURL); - curl_easy_setopt(curl, CURLOPT_POSTFIELDS, postData.c_str()); - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback); - curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer); - - CURLcode res = curl_easy_perform(curl); - - if (res == CURLE_OK && !(readBuffer.empty())) + if (response == "success") { - json j = json::parse(readBuffer); - - if (j.count("status") && j["status"].get() == "success") - { - LoginServer::getInstance().onValidateClient(suid, id, this, true, NULL, 0xFFFFFFFF, 0xFFFFFFFF); - } - else - { - std::string errMsg; - - if (j.count("message")) - { - errMsg = j["message"].get(); - } - else - { - errMsg = "Message not provided by authentication service."; - } - - ErrorMessage err("Login Failed", errMsg); - this->send(err, true); - } + authOK = 1; } else { - ErrorMessage err("Login Failed", "Could not connect to authentication service."); + ErrorMessage err("Login Failed", response); this->send(err, true); } - curl_easy_cleanup(curl); + } + else + { + ErrorMessage err("Login Failed", "Error connecting to authentication provider."); + this->send(err, true); } } else + { + authOK = 1; + } + + if (authOK) { LoginServer::getInstance().onValidateClient(suid, id, this, true, NULL, 0xFFFFFFFF, 0xFFFFFFFF); } + // else this case will never be reached, noop } // ---------------------------------------------------------------------------- diff --git a/engine/server/library/CMakeLists.txt b/engine/server/library/CMakeLists.txt index 810038ec..75f23aba 100644 --- a/engine/server/library/CMakeLists.txt +++ b/engine/server/library/CMakeLists.txt @@ -7,5 +7,3 @@ add_subdirectory(serverNetworkMessages) add_subdirectory(serverPathfinding) add_subdirectory(serverScript) add_subdirectory(serverUtility) - -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/json) diff --git a/external/3rd/library/CMakeLists.txt b/external/3rd/library/CMakeLists.txt index 9d0041c3..cee81091 100644 --- a/external/3rd/library/CMakeLists.txt +++ b/external/3rd/library/CMakeLists.txt @@ -1,4 +1,6 @@ - +add_subdirectory(webAPI) add_subdirectory(platform) add_subdirectory(soePlatform) add_subdirectory(udplibrary) + +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/webAPI) diff --git a/external/3rd/library/webAPI/CMakeLists.txt b/external/3rd/library/webAPI/CMakeLists.txt new file mode 100644 index 00000000..f4f8d562 --- /dev/null +++ b/external/3rd/library/webAPI/CMakeLists.txt @@ -0,0 +1,13 @@ +set(SHARED_SOURCES + webAPI.cpp + webAPI.h + json.hpp +) + +include_directories( + ${CURL_INCLUDE_DIRS} +) + +#target_link_libraries( +# ${CURL_LIBRARIES} +#) diff --git a/engine/server/library/json/json.hpp b/external/3rd/library/webAPI/json.hpp similarity index 100% rename from engine/server/library/json/json.hpp rename to external/3rd/library/webAPI/json.hpp diff --git a/external/3rd/library/webAPI/webAPI.cpp b/external/3rd/library/webAPI/webAPI.cpp new file mode 100644 index 00000000..e2b8446c --- /dev/null +++ b/external/3rd/library/webAPI/webAPI.cpp @@ -0,0 +1,86 @@ + +#include "webAPI.h" + +// if status == success, returns "success", or slotName's contents if specified... +// otherwise returns the "message" if no success +std::string simplePost(std::string endpoint, std::string data, std::string slotName) +{ + nlohmann::json response = request(endpoint, data, 1); + std::string output; + + if (response.count("status") && response["status"].get() == "success") + { + if (slotName && response.count(slotName)) + { + output = response[slotName].get(); + } + else + { + output = "success"; + } + } + else + { + if (j.count("message")) + { + output = j["message"].get(); + } + else + { + output = "Message not provided by authentication service."; + } + } + + return output; +} + +nlohmann::json request(std::string endpoint, std::string data, int reqType, ...) +{ + nlohmann::json response; + + if (!endpoint.empty()) //data is allowed to be an empty string if we're doing a normal GET + { + CURL *curl = curl_easy_init(); + + if (curl) + { + std::string readBuffer; + + curl_easy_setopt(curl, CURLOPT_URL, endpoint.c_str()); + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback); + curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer); + + if (reqType == 1) + { + curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data.c_str()); + } + + CURLcode res = curl_easy_perform(curl); + + if (res == CURLE_OK && !(readBuffer.empty())) + { + response = json::parse(readBuffer); + } + curl_easy_cleanup(curl); + } + else + { + response["message"] = "Failed to initialize cURL."; + response["status"] = "failure"; + } + } + else + { + response["message"] = "Invalid endpoint URL."; + response["status"] = "failure"; + } + + return response; +} + +// This is used by curl to grab the response and put it into a var +size_t WriteCallback(void *contents, size_t size, size_t nmemb, void *userp) +{ + ((std::string*)userp)->append((char*)contents, size * nmemb); + return size * nmemb; +} diff --git a/external/3rd/library/webAPI/webAPI.h b/external/3rd/library/webAPI/webAPI.h new file mode 100644 index 00000000..592d25aa --- /dev/null +++ b/external/3rd/library/webAPI/webAPI.h @@ -0,0 +1,18 @@ +#ifndef webAPI_H +#define webAPI_H + +#include "json.hpp" +#include + +namespace webAPI +{ + std::string simplePost(std::string endpoint, std::string data, std::string slotName); + //std::string simpleGet(char* endpoint, char* data); + //nlohmann::json post(char* endpoint, char* data); + //nlohmann::json get(char* endpoint, char* data); + + nlohmann::json request(std::string endpoint, std::string data, int reqType); // 1 for post, 0 for get + size_t WriteCallback(void *contents, size_t size, size_t nmemb, void *userp); +}; + +#endif From 4f7a729d61648faa776071641fd8b1393b41f633 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Wed, 27 Apr 2016 22:27:18 +0000 Subject: [PATCH 088/302] this makes more sense --- external/3rd/library/webAPI/webAPI.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/external/3rd/library/webAPI/webAPI.cpp b/external/3rd/library/webAPI/webAPI.cpp index e2b8446c..0e6c3c67 100644 --- a/external/3rd/library/webAPI/webAPI.cpp +++ b/external/3rd/library/webAPI/webAPI.cpp @@ -10,7 +10,7 @@ std::string simplePost(std::string endpoint, std::string data, std::string slotN if (response.count("status") && response["status"].get() == "success") { - if (slotName && response.count(slotName)) + if (slotName != "" && response.count(slotName)) { output = response[slotName].get(); } @@ -27,7 +27,7 @@ std::string simplePost(std::string endpoint, std::string data, std::string slotN } else { - output = "Message not provided by authentication service."; + output = "Message not provided by remote."; } } From 5f7cf7e9698172ccebf2096bec2d0b461f0d005d Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Thu, 28 Apr 2016 03:28:12 +0000 Subject: [PATCH 089/302] this is closer but still not building correctly --- .../application/LoginServer/src/CMakeLists.txt | 4 +++- .../LoginServer/src/shared/ClientConnection.cpp | 2 +- external/3rd/library/webAPI/CMakeLists.txt | 15 +++++++++------ external/3rd/library/webAPI/webAPI.cpp | 10 +++++++--- 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/engine/server/application/LoginServer/src/CMakeLists.txt b/engine/server/application/LoginServer/src/CMakeLists.txt index 12cc8c7e..2ca54d51 100644 --- a/engine/server/application/LoginServer/src/CMakeLists.txt +++ b/engine/server/application/LoginServer/src/CMakeLists.txt @@ -118,8 +118,9 @@ add_executable(LoginServer ${PLATFORM_SOURCES} ) +link_directories(${SWG_EXTERNALS_SOURCE_DIR}/3rd/library/webAPI) + target_link_libraries(LoginServer - webAPI sharedCommandParser sharedCompression sharedDatabaseInterface @@ -152,5 +153,6 @@ target_link_libraries(LoginServer CommonAPI LoginAPI MonAPI2 + webAPI ${CMAKE_DL_LIBS} ) diff --git a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp index a2daaaad..a6af6997 100755 --- a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp @@ -23,7 +23,7 @@ #include "sharedNetworkMessages/GenericValueTypeMessage.h" #include "sharedNetworkMessages/LoginEnumCluster.h" -#include +#include "webAPI.h" #include //----------------------------------------------------------------------- diff --git a/external/3rd/library/webAPI/CMakeLists.txt b/external/3rd/library/webAPI/CMakeLists.txt index f4f8d562..7eacf57b 100644 --- a/external/3rd/library/webAPI/CMakeLists.txt +++ b/external/3rd/library/webAPI/CMakeLists.txt @@ -1,13 +1,16 @@ -set(SHARED_SOURCES - webAPI.cpp +cmake_minimum_required(VERSION 2.8) + +project(webAPI) + +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) + +add_library(webAPI webAPI.h + webAPI.cpp json.hpp + ${CURL_LIBRARIES} ) include_directories( ${CURL_INCLUDE_DIRS} ) - -#target_link_libraries( -# ${CURL_LIBRARIES} -#) diff --git a/external/3rd/library/webAPI/webAPI.cpp b/external/3rd/library/webAPI/webAPI.cpp index 0e6c3c67..de0c4fb7 100644 --- a/external/3rd/library/webAPI/webAPI.cpp +++ b/external/3rd/library/webAPI/webAPI.cpp @@ -1,6 +1,9 @@ #include "webAPI.h" +namespace webAPI +{ + // if status == success, returns "success", or slotName's contents if specified... // otherwise returns the "message" if no success std::string simplePost(std::string endpoint, std::string data, std::string slotName) @@ -21,9 +24,9 @@ std::string simplePost(std::string endpoint, std::string data, std::string slotN } else { - if (j.count("message")) + if (response.count("message")) { - output = j["message"].get(); + output = response["message"].get(); } else { @@ -59,7 +62,7 @@ nlohmann::json request(std::string endpoint, std::string data, int reqType, ...) if (res == CURLE_OK && !(readBuffer.empty())) { - response = json::parse(readBuffer); + response = nlohmann::json::parse(readBuffer); } curl_easy_cleanup(curl); } @@ -84,3 +87,4 @@ size_t WriteCallback(void *contents, size_t size, size_t nmemb, void *userp) ((std::string*)userp)->append((char*)contents, size * nmemb); return size * nmemb; } +}; From ecc0621f61e9f7f2b582f5240a009ff97a0c371e Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Thu, 28 Apr 2016 03:46:02 +0000 Subject: [PATCH 090/302] if only i could get past the linker errors, this will work... --- external/3rd/library/webAPI/webAPI.cpp | 13 +++++-------- external/3rd/library/webAPI/webAPI.h | 2 +- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/external/3rd/library/webAPI/webAPI.cpp b/external/3rd/library/webAPI/webAPI.cpp index de0c4fb7..76cf6c3b 100644 --- a/external/3rd/library/webAPI/webAPI.cpp +++ b/external/3rd/library/webAPI/webAPI.cpp @@ -1,12 +1,9 @@ #include "webAPI.h" -namespace webAPI -{ - // if status == success, returns "success", or slotName's contents if specified... // otherwise returns the "message" if no success -std::string simplePost(std::string endpoint, std::string data, std::string slotName) +std::string webAPI::simplePost(std::string endpoint, std::string data, std::string slotName) { nlohmann::json response = request(endpoint, data, 1); std::string output; @@ -37,7 +34,7 @@ std::string simplePost(std::string endpoint, std::string data, std::string slotN return output; } -nlohmann::json request(std::string endpoint, std::string data, int reqType, ...) +nlohmann::json webAPI::request(std::string endpoint, std::string data, int reqType) { nlohmann::json response; @@ -50,7 +47,7 @@ nlohmann::json request(std::string endpoint, std::string data, int reqType, ...) std::string readBuffer; curl_easy_setopt(curl, CURLOPT_URL, endpoint.c_str()); - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback); + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writeCallback); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer); if (reqType == 1) @@ -82,9 +79,9 @@ nlohmann::json request(std::string endpoint, std::string data, int reqType, ...) } // This is used by curl to grab the response and put it into a var -size_t WriteCallback(void *contents, size_t size, size_t nmemb, void *userp) +size_t webAPI::writeCallback(void *contents, size_t size, size_t nmemb, void *userp) { ((std::string*)userp)->append((char*)contents, size * nmemb); return size * nmemb; } -}; + diff --git a/external/3rd/library/webAPI/webAPI.h b/external/3rd/library/webAPI/webAPI.h index 592d25aa..9e4e445f 100644 --- a/external/3rd/library/webAPI/webAPI.h +++ b/external/3rd/library/webAPI/webAPI.h @@ -12,7 +12,7 @@ namespace webAPI //nlohmann::json get(char* endpoint, char* data); nlohmann::json request(std::string endpoint, std::string data, int reqType); // 1 for post, 0 for get - size_t WriteCallback(void *contents, size_t size, size_t nmemb, void *userp); + size_t writeCallback(void *contents, size_t size, size_t nmemb, void *userp); }; #endif From b99e3e45f9b4aa88b2710358646095cebaccd3da Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Thu, 28 Apr 2016 16:57:47 +0000 Subject: [PATCH 091/302] properly link the executable against curl, instead of the helper lib --- engine/server/application/LoginServer/src/CMakeLists.txt | 3 +-- external/3rd/library/webAPI/CMakeLists.txt | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/engine/server/application/LoginServer/src/CMakeLists.txt b/engine/server/application/LoginServer/src/CMakeLists.txt index 2ca54d51..80a0989a 100644 --- a/engine/server/application/LoginServer/src/CMakeLists.txt +++ b/engine/server/application/LoginServer/src/CMakeLists.txt @@ -118,8 +118,6 @@ add_executable(LoginServer ${PLATFORM_SOURCES} ) -link_directories(${SWG_EXTERNALS_SOURCE_DIR}/3rd/library/webAPI) - target_link_libraries(LoginServer sharedCommandParser sharedCompression @@ -154,5 +152,6 @@ target_link_libraries(LoginServer LoginAPI MonAPI2 webAPI + ${CURL_LIBRARIES} ${CMAKE_DL_LIBS} ) diff --git a/external/3rd/library/webAPI/CMakeLists.txt b/external/3rd/library/webAPI/CMakeLists.txt index 7eacf57b..550f0b6d 100644 --- a/external/3rd/library/webAPI/CMakeLists.txt +++ b/external/3rd/library/webAPI/CMakeLists.txt @@ -8,7 +8,6 @@ add_library(webAPI webAPI.h webAPI.cpp json.hpp - ${CURL_LIBRARIES} ) include_directories( From 3a3b8e0b2a0193054518b8c0a8b253a92255a8d3 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Thu, 28 Apr 2016 17:10:03 +0000 Subject: [PATCH 092/302] re-stubify this as all it does is hide real errors --- .../src/linux/SetupSharedFoundation.cpp | 29 +------------------ 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/engine/shared/library/sharedFoundation/src/linux/SetupSharedFoundation.cpp b/engine/shared/library/sharedFoundation/src/linux/SetupSharedFoundation.cpp index 08809fcc..65130ea2 100755 --- a/engine/shared/library/sharedFoundation/src/linux/SetupSharedFoundation.cpp +++ b/engine/shared/library/sharedFoundation/src/linux/SetupSharedFoundation.cpp @@ -84,34 +84,7 @@ void SetupSharedFoundation::install(const Data &data) void SetupSharedFoundation::callbackWithExceptionHandling( void (*callback)(void) ) // Routine to call with exception handling { - if (ConfigSharedFoundation::getNoExceptionHandling()) - { - callback(); - } - else - { - try - { - callback(); - } - catch (const __exception * mathException) - { - FATAL(true, ("Math Exception: %s\n", mathException->name)); - } - catch (const char* message) - { - FATAL(true, ("Character Exception: %s\n", message)); - } - catch(std::exception & m) - { - const char * c = m.what(); - FATAL(true, ("Std::exception: %s\n", c)); - } - catch(...) - { - FATAL(true, ("Unknown exception\n")); - } - } + callback(); } // ---------------------------------------------------------------------- From 6049da78af55be2487fa08b0e8466a0143791dd5 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Thu, 28 Apr 2016 17:23:30 +0000 Subject: [PATCH 093/302] all working! thanks for the cmake help, @devcodex! --- .../src/shared/ClientConnection.cpp | 2 +- external/3rd/library/webAPI/webAPI.cpp | 32 ++++++++++++------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp index a6af6997..c75b38c4 100755 --- a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp @@ -193,7 +193,7 @@ void ClientConnection::validateClient(const std::string & id, const std::string postBuf << "user_name=" << id << "&user_password=" << key << "&stationID=" << suid << "&ip=" << getRemoteAddress(); postData = std::string(postBuf.str()); - std::string response = webAPI::simplePost(authURL, postData, nullptr); + std::string response = webAPI::simplePost(authURL, postData, ""); if (!response.empty()) { diff --git a/external/3rd/library/webAPI/webAPI.cpp b/external/3rd/library/webAPI/webAPI.cpp index 76cf6c3b..f0c03a84 100644 --- a/external/3rd/library/webAPI/webAPI.cpp +++ b/external/3rd/library/webAPI/webAPI.cpp @@ -5,12 +5,15 @@ // otherwise returns the "message" if no success std::string webAPI::simplePost(std::string endpoint, std::string data, std::string slotName) { + // declare our output and go ahead and attempt to get data from remote nlohmann::json response = request(endpoint, data, 1); std::string output; + // if we got data back... if (response.count("status") && response["status"].get() == "success") { - if (slotName != "" && response.count(slotName)) + // use custom slot if specified (not "") + if (!(slotName.empty()) && response.count(slotName)) { output = response[slotName].get(); } @@ -18,8 +21,8 @@ std::string webAPI::simplePost(std::string endpoint, std::string data, std::stri { output = "success"; } - } - else + } + else //default message is an error, the other end always assumes "success" or the specified slot { if (response.count("message")) { @@ -34,36 +37,41 @@ std::string webAPI::simplePost(std::string endpoint, std::string data, std::stri return output; } +// this can be broken out to separate the json bits later if we need raw or other http type requests +// all it does is fetch via get or post, and if the status is 200 returns the json, else error json nlohmann::json webAPI::request(std::string endpoint, std::string data, int reqType) { nlohmann::json response; if (!endpoint.empty()) //data is allowed to be an empty string if we're doing a normal GET { - CURL *curl = curl_easy_init(); + CURL *curl = curl_easy_init(); // start up curl if (curl) { - std::string readBuffer; + std::string readBuffer; // container for the remote response + long http_code = 0; // we get this after performing the get or post - curl_easy_setopt(curl, CURLOPT_URL, endpoint.c_str()); - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writeCallback); - curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer); + curl_easy_setopt(curl, CURLOPT_URL, endpoint.c_str()); // endpoint is always specified by caller + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writeCallback); // place the data into readBuffer using writeCallback + curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer); // specify readBuffer as the container for data if (reqType == 1) { curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data.c_str()); } - CURLcode res = curl_easy_perform(curl); + CURLcode res = curl_easy_perform(curl); // make the request! + + curl_easy_getinfo (curl, CURLINFO_RESPONSE_CODE, &http_code); //get status code - if (res == CURLE_OK && !(readBuffer.empty())) + if (res == CURLE_OK && http_code == 200 && !(readBuffer.empty())) // check it all out and parse { response = nlohmann::json::parse(readBuffer); } - curl_easy_cleanup(curl); + curl_easy_cleanup(curl); // always wipe our butt } - else + else //default err messages below { response["message"] = "Failed to initialize cURL."; response["status"] = "failure"; From 909ceab5e919b5da8b90a88a6186c6cf0d044931 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Thu, 28 Apr 2016 17:27:27 +0000 Subject: [PATCH 094/302] poke some fun with license header --- external/3rd/library/webAPI/webAPI.cpp | 13 +++++++++++++ external/3rd/library/webAPI/webAPI.h | 14 ++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/external/3rd/library/webAPI/webAPI.cpp b/external/3rd/library/webAPI/webAPI.cpp index f0c03a84..aaeb38e0 100644 --- a/external/3rd/library/webAPI/webAPI.cpp +++ b/external/3rd/library/webAPI/webAPI.cpp @@ -1,3 +1,16 @@ +/* +This code is just a simple wrapper around nlohmann's wonderful json lib +(https://github.com/nlohmann/json) and libcurl. While originally included directly, +we have come to realize that we may require web API functionality elsewhere in the future. + +As such, and in an effort to keep the code clean, we've broken it out into this simple little +namespace/lib that is easy to include. Just make sure to link against curl when including, and +make all the cmake modifications required to properly use it. + +(c) stellabellum/swgilluminati (combined crews), written by DA with help from DC + +License: what's a license? we're a bunch of dirty pirates! +*/ #include "webAPI.h" diff --git a/external/3rd/library/webAPI/webAPI.h b/external/3rd/library/webAPI/webAPI.h index 9e4e445f..42ecae12 100644 --- a/external/3rd/library/webAPI/webAPI.h +++ b/external/3rd/library/webAPI/webAPI.h @@ -1,3 +1,17 @@ +/* +This code is just a simple wrapper around nlohmann's wonderful json lib +(https://github.com/nlohmann/json) and libcurl. While originally included directly, +we have come to realize that we may require web API functionality elsewhere in the future. + +As such, and in an effort to keep the code clean, we've broken it out into this simple little +namespace/lib that is easy to include. Just make sure to link against curl when including, and +make all the cmake modifications required to properly use it. + +(c) stellabellum/swgilluminati (combined crews), written by DA with help from DC + +License: what's a license? we're a bunch of dirty pirates! +*/ + #ifndef webAPI_H #define webAPI_H From 18e316631f646896bc968f61731c3319599eca36 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Thu, 28 Apr 2016 19:17:47 +0000 Subject: [PATCH 095/302] credit where it's due --- external/3rd/library/webAPI/webAPI.cpp | 1 + external/3rd/library/webAPI/webAPI.h | 1 + 2 files changed, 2 insertions(+) diff --git a/external/3rd/library/webAPI/webAPI.cpp b/external/3rd/library/webAPI/webAPI.cpp index aaeb38e0..6b57c4bc 100644 --- a/external/3rd/library/webAPI/webAPI.cpp +++ b/external/3rd/library/webAPI/webAPI.cpp @@ -8,6 +8,7 @@ namespace/lib that is easy to include. Just make sure to link against curl when make all the cmake modifications required to properly use it. (c) stellabellum/swgilluminati (combined crews), written by DA with help from DC +based on the original prototype by parz1val License: what's a license? we're a bunch of dirty pirates! */ diff --git a/external/3rd/library/webAPI/webAPI.h b/external/3rd/library/webAPI/webAPI.h index 42ecae12..763c69e7 100644 --- a/external/3rd/library/webAPI/webAPI.h +++ b/external/3rd/library/webAPI/webAPI.h @@ -8,6 +8,7 @@ namespace/lib that is easy to include. Just make sure to link against curl when make all the cmake modifications required to properly use it. (c) stellabellum/swgilluminati (combined crews), written by DA with help from DC +based on the original prototype by parz1val License: what's a license? we're a bunch of dirty pirates! */ From 068228a938c37b72b277b157b5331b62bf22d1be Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Thu, 28 Apr 2016 19:52:24 +0000 Subject: [PATCH 096/302] forgot a case --- external/3rd/library/webAPI/webAPI.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/external/3rd/library/webAPI/webAPI.cpp b/external/3rd/library/webAPI/webAPI.cpp index 6b57c4bc..c96effe7 100644 --- a/external/3rd/library/webAPI/webAPI.cpp +++ b/external/3rd/library/webAPI/webAPI.cpp @@ -83,6 +83,11 @@ nlohmann::json webAPI::request(std::string endpoint, std::string data, int reqTy { response = nlohmann::json::parse(readBuffer); } + else + { + response["message"] = "Error fetching data from remote."; + response["status"] = "failure"; + } curl_easy_cleanup(curl); // always wipe our butt } else //default err messages below From 663a7c99886370d0a96926c6e37c36281c6005e7 Mon Sep 17 00:00:00 2001 From: swgnoobs Date: Thu, 5 May 2016 07:26:26 +0000 Subject: [PATCH 097/302] Revert "help me darthargus, this doesnt build at all .." This reverts commit dc2b683c42d4948eaaa5f6a83cc5f0cd611a6e06 --- .../src/shared/CentralServer.cpp | 113 +++++++++++++----- 1 file changed, 80 insertions(+), 33 deletions(-) diff --git a/engine/server/application/CentralServer/src/shared/CentralServer.cpp b/engine/server/application/CentralServer/src/shared/CentralServer.cpp index eea9af1b..35d9e51c 100755 --- a/engine/server/application/CentralServer/src/shared/CentralServer.cpp +++ b/engine/server/application/CentralServer/src/shared/CentralServer.cpp @@ -587,7 +587,7 @@ void CentralServer::getReadyGameServers(std::vector &theList) GameServerConnection * CentralServer::getRandomGameServer(void) { if (m_gameServerConnectionsList.empty()) - return nullptr; + return NULL; // m_gameServerConnectionsList ***DOES NOT*** contain the DB server so // we don't have to worry about checking for and excluding the DB server @@ -611,7 +611,7 @@ GameServerConnection * CentralServer::getRandomGameServer(void) indexNextGameServer = 0; } - return nullptr; + return NULL; } //----------------------------------------------------------------------- @@ -696,7 +696,7 @@ void CentralServer::launchStartingProcesses() const if (!m_taskManager || !m_taskManager->isConnected() || (m_clusterId == 0)) { if (!m_taskManager) - REPORT_LOG(true, ("CentralServer not launching starting processes because m_taskManager is nullptr\n")); + REPORT_LOG(true, ("CentralServer not launching starting processes because m_taskManager is NULL\n")); else if (!m_taskManager->isConnected()) REPORT_LOG(true, ("CentralServer not launching starting processes because m_taskManager->isConnected() is false\n")); @@ -820,7 +820,7 @@ void CentralServer::launchStartingPlanetServers() char const * const p = ConfigCentralServer::getStartPlanet(i); if (p) { - FATAL(!*p, ("CentralServer::launchStartingPlanetServers: ConfigCentralServer::getStartPlanet(%d) specified a non-nullptr but empty planet name", i)); + FATAL(!*p, ("CentralServer::launchStartingPlanetServers: ConfigCentralServer::getStartPlanet(%d) specified a non-null but empty planet name", i)); std::string planetName; std::string hostName; @@ -1066,12 +1066,59 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons // Forward this message to the dbProcess sendToGameServer(m_dbProcessServerProcessId, t, true); } + else if(message.isType("ChunkObjectListMessage")) + { + Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); + ChunkObjectListMessage t(ri); + + DEBUG_FATAL(true,("Got ChunkObjectListMessage. Thought it was deprecated.\n")); + // handleChunkList(t.getProcess(), t.getIds()); + } else if(message.isType("LocateStructureMessage")) { Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); LocateStructureMessage t(ri); sendToPlanetServer(t.getSceneId(), t, true); } + else if(message.isType("RequestObjectMessage")) + { + DEBUG_FATAL(true,("Got RequestObjectMessage. Thought this went away.")); + + // Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); + // RequestObjectMessage t(ri); + // // tell the authoritative object to create a proxy + // const GameServerConnection *gameServer = getGameServer(t.getProcess()); + // NOT_NULL(gameServer); + // uint32 authId = sendToAuthoritativeServer(t.getId(), + // LoadObjectMessage(t.getId(), t.getProcess(), gameServer->getGameServiceAddress(), gameServer->getGameServicePort(), false), + // true); + // // if we sent the message to the database process, mark it as being + // // authoritative for this object + // if (authId == m_dbProcessServerProcessId) + // { + // addObjectToMap(t.getId(), authId, gameServer->getSceneId(), true); + // m_pendingLoadingObjects[t.getId()] = t.getProcess(); + // } + } + else if(message.isType("CreateNewObjectMessage")) + { + DEBUG_FATAL(true,("Ain't this supposed to be deprecated or something?")); + } + else if(message.isType("SetObjectPositionMessage")) + { + //@todo remove this message from the library + DEBUG_FATAL(true,("Got SetObjectPositionMessage. Thought this went away")); + } + else if(message.isType("FailedToLoadObjectMessage")) + { + //@todo remove this message from the library + DEBUG_FATAL(true,("Received Failed To Load Object Message. Thought it was depricated\n")); + } + else if(message.isType("ReleaseAuthoritativeMessage")) + { + //@todo remove this message from the library + DEBUG_FATAL(true, ("Received ReleaseAuthoritative for. Thought it was deprecated.")); + } else if(message.isType("ForceUnloadObjectMessage")) { //N.B. This message can come from a game server or from the planet server. @@ -1081,7 +1128,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons ForceUnloadObjectMessage t(ri); //@todo: figure out some way to handle this (such as forwarding to PlanetServers), or remove every case where it's sent - //forceUnload(t.getId(),t.getPermaDelete()); + // forceUnload(t.getId(),t.getPermaDelete()); } //Character Creation Messages else if(message.isType("ConnectionCreateCharacter")) @@ -1448,7 +1495,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons { ConnectionServerConnection * c = (*ci); - if ( (c != nullptr) + if ( (c != NULL) && !c->getChatServiceAddress().empty() && (c->getChatServicePort() != 0)) { @@ -1490,13 +1537,13 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons { ChatServerConnection *connection = (*iterChatServerConnections); - if (connection != nullptr) + if (connection != NULL) { connection->send(address, true); } else { - REPORT_LOG(true, ("Trying to send the customer service server: chat server service address to a nullptr chat server\n")); + REPORT_LOG(true, ("Trying to send the customer service server: chat server service address to a NULL chat server\n")); } } } @@ -1509,7 +1556,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons { ConnectionServerConnection * c = (*ci); - if ( (c != nullptr) + if ( (c != NULL) && !c->getCustomerServiceAddress().empty() && (c->getCustomerServicePort() != 0)) { @@ -1584,7 +1631,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); const RequestGameServerForLoginMessage msg(ri); - time_t const timeNow = ::time(nullptr); + time_t const timeNow = ::time(NULL); PlayerSceneMapType::const_iterator i = m_playerSceneMap.find(msg.getCharacterId()); if ((i != m_playerSceneMap.end()) && (i->second.second > timeNow)) { @@ -1845,14 +1892,14 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons } else { - if(getInstance().m_transferServerConnection != nullptr) + if(getInstance().m_transferServerConnection != NULL) { getInstance().m_transferServerConnection->disconnect(); getInstance().m_transferServerConnection = 0; s_retryTransferServerConnection = false; } - if(getInstance().m_stationPlayersCollectorConnection != nullptr) + if(getInstance().m_stationPlayersCollectorConnection != NULL) { getInstance().m_stationPlayersCollectorConnection->disconnect(); getInstance().m_stationPlayersCollectorConnection = 0; @@ -1900,11 +1947,11 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons if (iterFind != s_pendingRenameCharacter.end()) { ++(iterFind->second.second); - iterFind->second.first = ::time(nullptr) + 3600; // 1 hour timeout + iterFind->second.first = ::time(NULL) + 3600; // 1 hour timeout } else { - s_pendingRenameCharacter.insert(std::make_pair(msg.getValue().second.first, std::make_pair((::time(nullptr) + 3600), 1))); // 1 hour timeout + s_pendingRenameCharacter.insert(std::make_pair(msg.getValue().second.first, std::make_pair((::time(NULL) + 3600), 1))); // 1 hour timeout } // tell the chat server to destroy any avatar with the new name, but only if the first name changed @@ -2052,11 +2099,11 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons { i->second.first = ssfp.getValue().second.first; if (ssfp.getValue().second.second) - i->second.second = ::time(nullptr) + static_cast(ConfigCentralServer::getCtsDenyLoginThresholdSeconds()); + i->second.second = ::time(NULL) + static_cast(ConfigCentralServer::getCtsDenyLoginThresholdSeconds()); } else { - m_playerSceneMap[ssfp.getValue().first]=std::make_pair(ssfp.getValue().second.first, (ssfp.getValue().second.second ? (::time(nullptr) + static_cast(ConfigCentralServer::getCtsDenyLoginThresholdSeconds())) : 0)); + m_playerSceneMap[ssfp.getValue().first]=std::make_pair(ssfp.getValue().second.first, (ssfp.getValue().second.second ? (::time(NULL) + static_cast(ConfigCentralServer::getCtsDenyLoginThresholdSeconds())) : 0)); } } } @@ -2203,7 +2250,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); GenericValueTypeMessage > const msg(ri); - m_timePopulationStatisticsRefresh = ::time(nullptr); + m_timePopulationStatisticsRefresh = ::time(NULL); m_populationStatistics = msg.getValue(); } else if (message.isType("GcwScoreStatRsp")) @@ -2211,7 +2258,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); GenericValueTypeMessage, std::pair >, std::map > > > > const msg(ri); - m_timeGcwScoreStatisticsRefresh = ::time(nullptr); + m_timeGcwScoreStatisticsRefresh = ::time(NULL); std::string const timeGcwScoreStatisticsRefreshStr = CalendarTime::convertEpochToTimeStringLocal(m_timeGcwScoreStatisticsRefresh); std::map const & gcwImperialScorePercentile = msg.getValue().first; @@ -2283,7 +2330,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); GenericValueTypeMessage >, std::map > > > const msg(ri); - m_timeLastLoginTimeStatisticsRefresh = ::time(nullptr); + m_timeLastLoginTimeStatisticsRefresh = ::time(NULL); m_lastLoginTimeStatistics = msg.getValue().first; m_createTimeStatistics = msg.getValue().second; } @@ -2559,7 +2606,7 @@ void CentralServer::removeGameServer(GameServerConnection const *gameServer) } else { - DEBUG_WARNING(true, ("A game server crashed but our process ID ptr is nullptr.")); + DEBUG_WARNING(true, ("A game server crashed but our process ID ptr is null.")); } } @@ -2781,7 +2828,7 @@ void CentralServer::update() if ( ConfigCentralServer::getAuctionEnabled() ) // allow auctions? { - if ( m_pAuctionTransferClient == nullptr ) + if ( m_pAuctionTransferClient == NULL ) { const char* hostName[1] = { ConfigCentralServer::getAuctionServer() }; const short port[1] = { (short)ConfigCentralServer::getAuctionPort() }; @@ -2928,7 +2975,7 @@ void CentralServer::sendToPlanetServer(const std::string &sceneId, const GameNet // ---------------------------------------------------------------------- -void CentralServer::sendToAllConnectionServers(const GameNetworkMessage & message, const bool reliable, Connection const * exclude /*= nullptr*/) +void CentralServer::sendToAllConnectionServers(const GameNetworkMessage & message, const bool reliable, Connection const * exclude /*= NULL*/) { // send to all connection servers for (ConnectionServerConnectionList::const_iterator i = m_connectionServerConnections.begin(); i != m_connectionServerConnections.end(); ++i) @@ -2958,7 +3005,7 @@ void CentralServer::sendToDBProcess(const GameNetworkMessage & message, const bo bool CentralServer::hasDBConnection() const { const GameServerConnection * g = getGameServer(getDbProcessServerProcessId()); - return (g != nullptr); + return (g != NULL); } //----------------------------------------------------------------------- @@ -3063,7 +3110,7 @@ void CentralServer::startPlanetServer(const std::string & host, const std::strin TaskSpawnProcess spawn(host.empty() ? std::string("any") : host, "PlanetServer", options, spawnDelay); CentralServer::getInstance().sendTaskMessage(spawn); - m_pendingPlanetServers[sceneId] = std::make_pair(std::make_pair(host, options), ::time(nullptr)); + m_pendingPlanetServers[sceneId] = std::make_pair(std::make_pair(host, options), ::time(NULL)); IGNORE_RETURN(m_planetsWaitingForPreload.insert(sceneId)); bool const preloadFinished = isPreloadFinished(); @@ -3072,14 +3119,14 @@ void CentralServer::startPlanetServer(const std::string & host, const std::strin else if (m_timeClusterWentIntoLoadingState <= 0) m_timeClusterWentIntoLoadingState = time(0); - if(getInstance().m_transferServerConnection != nullptr && !preloadFinished) + if(getInstance().m_transferServerConnection != NULL && !preloadFinished) { getInstance().m_transferServerConnection->disconnect(); getInstance().m_transferServerConnection = 0; s_retryTransferServerConnection = false; } - if(getInstance().m_stationPlayersCollectorConnection != nullptr && ! isPreloadFinished()) + if(getInstance().m_stationPlayersCollectorConnection != NULL && ! isPreloadFinished()) { getInstance().m_stationPlayersCollectorConnection->disconnect(); getInstance().m_stationPlayersCollectorConnection = 0; @@ -3216,7 +3263,7 @@ void CentralServer::handleGameServerForLoginMessage(const GameServerForLoginMess void CentralServer::handleExchangeListCreditsMessage(const ExchangeListCreditsMessage &msg) { LOG("Exchange", ("Central Server got exchange list credits %d.",msg.getCredits())); - if ( m_pAuctionTransferClient == nullptr ) + if ( m_pAuctionTransferClient == NULL ) { // send failure packet } @@ -3252,7 +3299,7 @@ ConnectionServerConnection * CentralServer::getAnyConnectionServer() ConnectionServerConnection * CentralServer::getConnectionServerForAccount(StationId suid) { - ConnectionServerConnection * result = nullptr; + ConnectionServerConnection * result = NULL; ConnectionServerSUIDMap::iterator i=m_accountConnectionMap.find(suid); if (i!=m_accountConnectionMap.end()) { @@ -3660,7 +3707,7 @@ void CentralServer::checkShutdownProcess() { // if it's been "awhile" since we requested to restart the PlanetServer, // then assume that something has gone wrong, and try the restart again - time_t const timeNow = ::time(nullptr); + time_t const timeNow = ::time(NULL); if ((iterPendingPlanetServer->second.second + static_cast(ConfigCentralServer::getMaxTimeToWaitForPlanetServerStartSeconds())) < timeNow) { @@ -3935,7 +3982,7 @@ int CentralServer::getSecondsClusterHasBeenInLoadingState() const const std::map & CentralServer::getPopulationStatistics(time_t & refreshTime) { // periodically request updated statistics from the game server - time_t const timeNow = ::time(nullptr); + time_t const timeNow = ::time(NULL); if (m_timePopulationStatisticsNextRefresh <= timeNow) { GameServerConnection * universeGameServerConnection = getGameServer(UniverseManager::getInstance().getUniverseProcess()); @@ -3957,7 +4004,7 @@ const std::map & CentralServer::getPopulationStatistics(time_t const std::map > > & CentralServer::getGcwScoreStatistics(time_t & refreshTime) { // periodically request updated statistics from the game server - time_t const timeNow = ::time(nullptr); + time_t const timeNow = ::time(NULL); if (m_timeGcwScoreStatisticsNextRefresh <= timeNow) { GameServerConnection * universeGameServerConnection = getGameServer(UniverseManager::getInstance().getUniverseProcess()); @@ -3979,7 +4026,7 @@ const std::map > std::pair > const *, std::map > const *> CentralServer::getLastLoginTimeStatistics(time_t & refreshTime) { // periodically request updated statistics from the game server - time_t const timeNow = ::time(nullptr); + time_t const timeNow = ::time(NULL); if (m_timeLastLoginTimeStatisticsNextRefresh <= timeNow) { GameServerConnection * universeGameServerConnection = getGameServer(UniverseManager::getInstance().getUniverseProcess()); @@ -4002,7 +4049,7 @@ std::pair > const *, std::map characterMatchStatisticsRequest("LfgStatReq", 0); From b66fd34d802045d03dff3f36d5829bf647af022c Mon Sep 17 00:00:00 2001 From: swg Date: Thu, 5 May 2016 08:36:42 +0100 Subject: [PATCH 098/302] Revert "Revert "help me, this doesnt build at all .."" This reverts commit 663a7c99886370d0a96926c6e37c36281c6005e7. --- .../src/shared/CentralServer.cpp | 113 +++++------------- 1 file changed, 33 insertions(+), 80 deletions(-) diff --git a/engine/server/application/CentralServer/src/shared/CentralServer.cpp b/engine/server/application/CentralServer/src/shared/CentralServer.cpp index 35d9e51c..eea9af1b 100755 --- a/engine/server/application/CentralServer/src/shared/CentralServer.cpp +++ b/engine/server/application/CentralServer/src/shared/CentralServer.cpp @@ -587,7 +587,7 @@ void CentralServer::getReadyGameServers(std::vector &theList) GameServerConnection * CentralServer::getRandomGameServer(void) { if (m_gameServerConnectionsList.empty()) - return NULL; + return nullptr; // m_gameServerConnectionsList ***DOES NOT*** contain the DB server so // we don't have to worry about checking for and excluding the DB server @@ -611,7 +611,7 @@ GameServerConnection * CentralServer::getRandomGameServer(void) indexNextGameServer = 0; } - return NULL; + return nullptr; } //----------------------------------------------------------------------- @@ -696,7 +696,7 @@ void CentralServer::launchStartingProcesses() const if (!m_taskManager || !m_taskManager->isConnected() || (m_clusterId == 0)) { if (!m_taskManager) - REPORT_LOG(true, ("CentralServer not launching starting processes because m_taskManager is NULL\n")); + REPORT_LOG(true, ("CentralServer not launching starting processes because m_taskManager is nullptr\n")); else if (!m_taskManager->isConnected()) REPORT_LOG(true, ("CentralServer not launching starting processes because m_taskManager->isConnected() is false\n")); @@ -820,7 +820,7 @@ void CentralServer::launchStartingPlanetServers() char const * const p = ConfigCentralServer::getStartPlanet(i); if (p) { - FATAL(!*p, ("CentralServer::launchStartingPlanetServers: ConfigCentralServer::getStartPlanet(%d) specified a non-null but empty planet name", i)); + FATAL(!*p, ("CentralServer::launchStartingPlanetServers: ConfigCentralServer::getStartPlanet(%d) specified a non-nullptr but empty planet name", i)); std::string planetName; std::string hostName; @@ -1066,59 +1066,12 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons // Forward this message to the dbProcess sendToGameServer(m_dbProcessServerProcessId, t, true); } - else if(message.isType("ChunkObjectListMessage")) - { - Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); - ChunkObjectListMessage t(ri); - - DEBUG_FATAL(true,("Got ChunkObjectListMessage. Thought it was deprecated.\n")); - // handleChunkList(t.getProcess(), t.getIds()); - } else if(message.isType("LocateStructureMessage")) { Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); LocateStructureMessage t(ri); sendToPlanetServer(t.getSceneId(), t, true); } - else if(message.isType("RequestObjectMessage")) - { - DEBUG_FATAL(true,("Got RequestObjectMessage. Thought this went away.")); - - // Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); - // RequestObjectMessage t(ri); - // // tell the authoritative object to create a proxy - // const GameServerConnection *gameServer = getGameServer(t.getProcess()); - // NOT_NULL(gameServer); - // uint32 authId = sendToAuthoritativeServer(t.getId(), - // LoadObjectMessage(t.getId(), t.getProcess(), gameServer->getGameServiceAddress(), gameServer->getGameServicePort(), false), - // true); - // // if we sent the message to the database process, mark it as being - // // authoritative for this object - // if (authId == m_dbProcessServerProcessId) - // { - // addObjectToMap(t.getId(), authId, gameServer->getSceneId(), true); - // m_pendingLoadingObjects[t.getId()] = t.getProcess(); - // } - } - else if(message.isType("CreateNewObjectMessage")) - { - DEBUG_FATAL(true,("Ain't this supposed to be deprecated or something?")); - } - else if(message.isType("SetObjectPositionMessage")) - { - //@todo remove this message from the library - DEBUG_FATAL(true,("Got SetObjectPositionMessage. Thought this went away")); - } - else if(message.isType("FailedToLoadObjectMessage")) - { - //@todo remove this message from the library - DEBUG_FATAL(true,("Received Failed To Load Object Message. Thought it was depricated\n")); - } - else if(message.isType("ReleaseAuthoritativeMessage")) - { - //@todo remove this message from the library - DEBUG_FATAL(true, ("Received ReleaseAuthoritative for. Thought it was deprecated.")); - } else if(message.isType("ForceUnloadObjectMessage")) { //N.B. This message can come from a game server or from the planet server. @@ -1128,7 +1081,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons ForceUnloadObjectMessage t(ri); //@todo: figure out some way to handle this (such as forwarding to PlanetServers), or remove every case where it's sent - // forceUnload(t.getId(),t.getPermaDelete()); + //forceUnload(t.getId(),t.getPermaDelete()); } //Character Creation Messages else if(message.isType("ConnectionCreateCharacter")) @@ -1495,7 +1448,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons { ConnectionServerConnection * c = (*ci); - if ( (c != NULL) + if ( (c != nullptr) && !c->getChatServiceAddress().empty() && (c->getChatServicePort() != 0)) { @@ -1537,13 +1490,13 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons { ChatServerConnection *connection = (*iterChatServerConnections); - if (connection != NULL) + if (connection != nullptr) { connection->send(address, true); } else { - REPORT_LOG(true, ("Trying to send the customer service server: chat server service address to a NULL chat server\n")); + REPORT_LOG(true, ("Trying to send the customer service server: chat server service address to a nullptr chat server\n")); } } } @@ -1556,7 +1509,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons { ConnectionServerConnection * c = (*ci); - if ( (c != NULL) + if ( (c != nullptr) && !c->getCustomerServiceAddress().empty() && (c->getCustomerServicePort() != 0)) { @@ -1631,7 +1584,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); const RequestGameServerForLoginMessage msg(ri); - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); PlayerSceneMapType::const_iterator i = m_playerSceneMap.find(msg.getCharacterId()); if ((i != m_playerSceneMap.end()) && (i->second.second > timeNow)) { @@ -1892,14 +1845,14 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons } else { - if(getInstance().m_transferServerConnection != NULL) + if(getInstance().m_transferServerConnection != nullptr) { getInstance().m_transferServerConnection->disconnect(); getInstance().m_transferServerConnection = 0; s_retryTransferServerConnection = false; } - if(getInstance().m_stationPlayersCollectorConnection != NULL) + if(getInstance().m_stationPlayersCollectorConnection != nullptr) { getInstance().m_stationPlayersCollectorConnection->disconnect(); getInstance().m_stationPlayersCollectorConnection = 0; @@ -1947,11 +1900,11 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons if (iterFind != s_pendingRenameCharacter.end()) { ++(iterFind->second.second); - iterFind->second.first = ::time(NULL) + 3600; // 1 hour timeout + iterFind->second.first = ::time(nullptr) + 3600; // 1 hour timeout } else { - s_pendingRenameCharacter.insert(std::make_pair(msg.getValue().second.first, std::make_pair((::time(NULL) + 3600), 1))); // 1 hour timeout + s_pendingRenameCharacter.insert(std::make_pair(msg.getValue().second.first, std::make_pair((::time(nullptr) + 3600), 1))); // 1 hour timeout } // tell the chat server to destroy any avatar with the new name, but only if the first name changed @@ -2099,11 +2052,11 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons { i->second.first = ssfp.getValue().second.first; if (ssfp.getValue().second.second) - i->second.second = ::time(NULL) + static_cast(ConfigCentralServer::getCtsDenyLoginThresholdSeconds()); + i->second.second = ::time(nullptr) + static_cast(ConfigCentralServer::getCtsDenyLoginThresholdSeconds()); } else { - m_playerSceneMap[ssfp.getValue().first]=std::make_pair(ssfp.getValue().second.first, (ssfp.getValue().second.second ? (::time(NULL) + static_cast(ConfigCentralServer::getCtsDenyLoginThresholdSeconds())) : 0)); + m_playerSceneMap[ssfp.getValue().first]=std::make_pair(ssfp.getValue().second.first, (ssfp.getValue().second.second ? (::time(nullptr) + static_cast(ConfigCentralServer::getCtsDenyLoginThresholdSeconds())) : 0)); } } } @@ -2250,7 +2203,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); GenericValueTypeMessage > const msg(ri); - m_timePopulationStatisticsRefresh = ::time(NULL); + m_timePopulationStatisticsRefresh = ::time(nullptr); m_populationStatistics = msg.getValue(); } else if (message.isType("GcwScoreStatRsp")) @@ -2258,7 +2211,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); GenericValueTypeMessage, std::pair >, std::map > > > > const msg(ri); - m_timeGcwScoreStatisticsRefresh = ::time(NULL); + m_timeGcwScoreStatisticsRefresh = ::time(nullptr); std::string const timeGcwScoreStatisticsRefreshStr = CalendarTime::convertEpochToTimeStringLocal(m_timeGcwScoreStatisticsRefresh); std::map const & gcwImperialScorePercentile = msg.getValue().first; @@ -2330,7 +2283,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); GenericValueTypeMessage >, std::map > > > const msg(ri); - m_timeLastLoginTimeStatisticsRefresh = ::time(NULL); + m_timeLastLoginTimeStatisticsRefresh = ::time(nullptr); m_lastLoginTimeStatistics = msg.getValue().first; m_createTimeStatistics = msg.getValue().second; } @@ -2606,7 +2559,7 @@ void CentralServer::removeGameServer(GameServerConnection const *gameServer) } else { - DEBUG_WARNING(true, ("A game server crashed but our process ID ptr is null.")); + DEBUG_WARNING(true, ("A game server crashed but our process ID ptr is nullptr.")); } } @@ -2828,7 +2781,7 @@ void CentralServer::update() if ( ConfigCentralServer::getAuctionEnabled() ) // allow auctions? { - if ( m_pAuctionTransferClient == NULL ) + if ( m_pAuctionTransferClient == nullptr ) { const char* hostName[1] = { ConfigCentralServer::getAuctionServer() }; const short port[1] = { (short)ConfigCentralServer::getAuctionPort() }; @@ -2975,7 +2928,7 @@ void CentralServer::sendToPlanetServer(const std::string &sceneId, const GameNet // ---------------------------------------------------------------------- -void CentralServer::sendToAllConnectionServers(const GameNetworkMessage & message, const bool reliable, Connection const * exclude /*= NULL*/) +void CentralServer::sendToAllConnectionServers(const GameNetworkMessage & message, const bool reliable, Connection const * exclude /*= nullptr*/) { // send to all connection servers for (ConnectionServerConnectionList::const_iterator i = m_connectionServerConnections.begin(); i != m_connectionServerConnections.end(); ++i) @@ -3005,7 +2958,7 @@ void CentralServer::sendToDBProcess(const GameNetworkMessage & message, const bo bool CentralServer::hasDBConnection() const { const GameServerConnection * g = getGameServer(getDbProcessServerProcessId()); - return (g != NULL); + return (g != nullptr); } //----------------------------------------------------------------------- @@ -3110,7 +3063,7 @@ void CentralServer::startPlanetServer(const std::string & host, const std::strin TaskSpawnProcess spawn(host.empty() ? std::string("any") : host, "PlanetServer", options, spawnDelay); CentralServer::getInstance().sendTaskMessage(spawn); - m_pendingPlanetServers[sceneId] = std::make_pair(std::make_pair(host, options), ::time(NULL)); + m_pendingPlanetServers[sceneId] = std::make_pair(std::make_pair(host, options), ::time(nullptr)); IGNORE_RETURN(m_planetsWaitingForPreload.insert(sceneId)); bool const preloadFinished = isPreloadFinished(); @@ -3119,14 +3072,14 @@ void CentralServer::startPlanetServer(const std::string & host, const std::strin else if (m_timeClusterWentIntoLoadingState <= 0) m_timeClusterWentIntoLoadingState = time(0); - if(getInstance().m_transferServerConnection != NULL && !preloadFinished) + if(getInstance().m_transferServerConnection != nullptr && !preloadFinished) { getInstance().m_transferServerConnection->disconnect(); getInstance().m_transferServerConnection = 0; s_retryTransferServerConnection = false; } - if(getInstance().m_stationPlayersCollectorConnection != NULL && ! isPreloadFinished()) + if(getInstance().m_stationPlayersCollectorConnection != nullptr && ! isPreloadFinished()) { getInstance().m_stationPlayersCollectorConnection->disconnect(); getInstance().m_stationPlayersCollectorConnection = 0; @@ -3263,7 +3216,7 @@ void CentralServer::handleGameServerForLoginMessage(const GameServerForLoginMess void CentralServer::handleExchangeListCreditsMessage(const ExchangeListCreditsMessage &msg) { LOG("Exchange", ("Central Server got exchange list credits %d.",msg.getCredits())); - if ( m_pAuctionTransferClient == NULL ) + if ( m_pAuctionTransferClient == nullptr ) { // send failure packet } @@ -3299,7 +3252,7 @@ ConnectionServerConnection * CentralServer::getAnyConnectionServer() ConnectionServerConnection * CentralServer::getConnectionServerForAccount(StationId suid) { - ConnectionServerConnection * result = NULL; + ConnectionServerConnection * result = nullptr; ConnectionServerSUIDMap::iterator i=m_accountConnectionMap.find(suid); if (i!=m_accountConnectionMap.end()) { @@ -3707,7 +3660,7 @@ void CentralServer::checkShutdownProcess() { // if it's been "awhile" since we requested to restart the PlanetServer, // then assume that something has gone wrong, and try the restart again - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); if ((iterPendingPlanetServer->second.second + static_cast(ConfigCentralServer::getMaxTimeToWaitForPlanetServerStartSeconds())) < timeNow) { @@ -3982,7 +3935,7 @@ int CentralServer::getSecondsClusterHasBeenInLoadingState() const const std::map & CentralServer::getPopulationStatistics(time_t & refreshTime) { // periodically request updated statistics from the game server - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); if (m_timePopulationStatisticsNextRefresh <= timeNow) { GameServerConnection * universeGameServerConnection = getGameServer(UniverseManager::getInstance().getUniverseProcess()); @@ -4004,7 +3957,7 @@ const std::map & CentralServer::getPopulationStatistics(time_t const std::map > > & CentralServer::getGcwScoreStatistics(time_t & refreshTime) { // periodically request updated statistics from the game server - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); if (m_timeGcwScoreStatisticsNextRefresh <= timeNow) { GameServerConnection * universeGameServerConnection = getGameServer(UniverseManager::getInstance().getUniverseProcess()); @@ -4026,7 +3979,7 @@ const std::map > std::pair > const *, std::map > const *> CentralServer::getLastLoginTimeStatistics(time_t & refreshTime) { // periodically request updated statistics from the game server - time_t const timeNow = ::time(NULL); + time_t const timeNow = ::time(nullptr); if (m_timeLastLoginTimeStatisticsNextRefresh <= timeNow) { GameServerConnection * universeGameServerConnection = getGameServer(UniverseManager::getInstance().getUniverseProcess()); @@ -4049,7 +4002,7 @@ std::pair > const *, std::map characterMatchStatisticsRequest("LfgStatReq", 0); From 87ae60bba699274a17a8c144bda61e1f59ea3297 Mon Sep 17 00:00:00 2001 From: swg Date: Thu, 5 May 2016 08:41:44 +0100 Subject: [PATCH 099/302] this time --- .../application/CentralServer/src/CMakeLists.txt | 3 +++ .../CentralServer/src/shared/CentralServer.cpp | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) mode change 100644 => 100755 engine/server/application/CentralServer/src/CMakeLists.txt diff --git a/engine/server/application/CentralServer/src/CMakeLists.txt b/engine/server/application/CentralServer/src/CMakeLists.txt old mode 100644 new mode 100755 index 338554da..1bfd4dd6 --- a/engine/server/application/CentralServer/src/CMakeLists.txt +++ b/engine/server/application/CentralServer/src/CMakeLists.txt @@ -154,6 +154,7 @@ include_directories( ${SWG_EXTERNALS_SOURCE_DIR}/3rd/library/platform/projects ${SWG_EXTERNALS_SOURCE_DIR}/3rd/library/platform/utils ${SWG_EXTERNALS_SOURCE_DIR}/3rd/library/udplibrary + ${SWG_EXTERNALS_SOURCE_DIR}/3rd/library/webAPI ) add_executable(CentralServer @@ -190,5 +191,7 @@ target_link_libraries(CentralServer localizationArchive unicode unicodeArchive + webAPI + ${CURL_LIBRARIES} ${CMAKE_DL_LIBS} ) diff --git a/engine/server/application/CentralServer/src/shared/CentralServer.cpp b/engine/server/application/CentralServer/src/shared/CentralServer.cpp index eea9af1b..7918cb53 100755 --- a/engine/server/application/CentralServer/src/shared/CentralServer.cpp +++ b/engine/server/application/CentralServer/src/shared/CentralServer.cpp @@ -123,6 +123,9 @@ #include +// Trying todo something here ... +#include "webAPI.h" + namespace CentralServerNamespace { bool gs_connectionServersPublic=false; @@ -2767,7 +2770,19 @@ void CentralServer::update() { static int loopCount=0; m_curTime = static_cast(time(0)); + + // stella: Adding those for sending regular updates through WebAPI to the webserver + + static int population=0; + population = CentralServer::getInstance().getPlayerCount(); + std::string authURL(ConfigLoginServer::getExternalAuthUrl()); + + postBuf << "population=" << population; + postData = std::string(postBuf.str()); + + + // Tell the LoginServers if necessary if ((++loopCount > ConfigCentralServer::getUpdatePlayerCountFrequency())) { @@ -2775,6 +2790,7 @@ void CentralServer::update() // Update the population on the server sendPopulationUpdateToLoginServer(); + webAPI::simplePost(authURL, postData, ""); } From 8c0d9beb5d5de113a714f947d396f4539c4dba5c Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Thu, 5 May 2016 14:27:27 +0000 Subject: [PATCH 100/302] fixed noobs' commits, this is mostly good except we need to add a config variable to the config for central --- .../CentralServer/src/shared/CentralServer.cpp | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/engine/server/application/CentralServer/src/shared/CentralServer.cpp b/engine/server/application/CentralServer/src/shared/CentralServer.cpp index 7918cb53..411bf5b8 100755 --- a/engine/server/application/CentralServer/src/shared/CentralServer.cpp +++ b/engine/server/application/CentralServer/src/shared/CentralServer.cpp @@ -2772,17 +2772,11 @@ void CentralServer::update() m_curTime = static_cast(time(0)); // stella: Adding those for sending regular updates through WebAPI to the webserver + std::string updateURL = "http://webdev/test/asdf/asdf"; //todo: add config vars to CentralServer config header and cpp - static int population=0; - population = CentralServer::getInstance().getPlayerCount(); - std::string authURL(ConfigLoginServer::getExternalAuthUrl()); - - postBuf << "population=" << population; - postData = std::string(postBuf.str()); + std::ostringstream postBuf; + postBuf << "population=" << CentralServer::getInstance().getPlayerCount(); - - - // Tell the LoginServers if necessary if ((++loopCount > ConfigCentralServer::getUpdatePlayerCountFrequency())) { @@ -2790,11 +2784,9 @@ void CentralServer::update() // Update the population on the server sendPopulationUpdateToLoginServer(); - webAPI::simplePost(authURL, postData, ""); + webAPI::simplePost(updateURL, std::string(postBuf.str()), ""); } - - if ( ConfigCentralServer::getAuctionEnabled() ) // allow auctions? { if ( m_pAuctionTransferClient == nullptr ) @@ -2818,8 +2810,6 @@ void CentralServer::update() m_pAuctionTransferClient = 0; } - - // check every 5th frame (one second roughly?) if( loopCount%5 ) { From ade6e1f1d0779f2efc0507f6ddb0c58cca3ebaf7 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Thu, 5 May 2016 14:34:47 +0000 Subject: [PATCH 101/302] we only use this var once, no reason to keep it... --- .../application/LoginServer/src/shared/ClientConnection.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp index c75b38c4..c9a67d74 100755 --- a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp @@ -188,12 +188,9 @@ void ClientConnection::validateClient(const std::string & id, const std::string if (!authURL.empty()) { std::ostringstream postBuf; - std::string postData; - postBuf << "user_name=" << id << "&user_password=" << key << "&stationID=" << suid << "&ip=" << getRemoteAddress(); - postData = std::string(postBuf.str()); - std::string response = webAPI::simplePost(authURL, postData, ""); + std::string response = webAPI::simplePost(authURL, std::string(postBuf.str()), ""); if (!response.empty()) { From 16c9ba95d00ef17d30ff5cee4eb915ab746b2dbd Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Thu, 5 May 2016 16:04:41 +0000 Subject: [PATCH 102/302] add ConfigCentralServer::getMetricsDataURL() and move the stats collection functionality to the function that sends to the login server; this may or may not be optimal depending on how often it is updated --- .../CentralServer/src/shared/CentralServer.cpp | 18 +++++++++++------- .../src/shared/ConfigCentralServer.cpp | 1 + .../src/shared/ConfigCentralServer.h | 8 +++++++- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/engine/server/application/CentralServer/src/shared/CentralServer.cpp b/engine/server/application/CentralServer/src/shared/CentralServer.cpp index 411bf5b8..700db9f4 100755 --- a/engine/server/application/CentralServer/src/shared/CentralServer.cpp +++ b/engine/server/application/CentralServer/src/shared/CentralServer.cpp @@ -2771,12 +2771,6 @@ void CentralServer::update() static int loopCount=0; m_curTime = static_cast(time(0)); - // stella: Adding those for sending regular updates through WebAPI to the webserver - std::string updateURL = "http://webdev/test/asdf/asdf"; //todo: add config vars to CentralServer config header and cpp - - std::ostringstream postBuf; - postBuf << "population=" << CentralServer::getInstance().getPlayerCount(); - // Tell the LoginServers if necessary if ((++loopCount > ConfigCentralServer::getUpdatePlayerCountFrequency())) { @@ -2784,7 +2778,6 @@ void CentralServer::update() // Update the population on the server sendPopulationUpdateToLoginServer(); - webAPI::simplePost(updateURL, std::string(postBuf.str()), ""); } if ( ConfigCentralServer::getAuctionEnabled() ) // allow auctions? @@ -2847,6 +2840,17 @@ void CentralServer::sendPopulationUpdateToLoginServer() if (!isPreloadFinished() || (time(0)-m_lastLoadingStateTime < static_cast(ConfigCentralServer::getRecentLoadingStateSeconds()))) loadedRecently=true; + // stella: Adding those for sending regular updates through WebAPI to the webserver + std::string updateURL = std::string(ConfigCentralServer::getMetricsDataURL()); + + if (!(updateURL.empty())) + { + std::ostringstream postBuf; + postBuf << "totalPlayerCount=" << m_totalPlayerCount << "&totalEmptySceneCount=" << m_totalEmptySceneCount << "&totalFreeTrialCount=" << m_totalFreeTrialCount << "&totalTutorialSceneCount=" << m_totalTutorialSceneCount << "&totalFalconSceneCount=" << m_totalFalconSceneCount; + + webAPI::simplePost(updateURL, std::string(postBuf.str()), ""); + } + UpdatePlayerCountMessage upm(loadedRecently, m_totalPlayerCount, m_totalFreeTrialCount, m_totalEmptySceneCount, m_totalTutorialSceneCount, m_totalFalconSceneCount); sendToAllLoginServers(upm); } diff --git a/engine/server/application/CentralServer/src/shared/ConfigCentralServer.cpp b/engine/server/application/CentralServer/src/shared/ConfigCentralServer.cpp index a13bd448..28a33e2f 100755 --- a/engine/server/application/CentralServer/src/shared/ConfigCentralServer.cpp +++ b/engine/server/application/CentralServer/src/shared/ConfigCentralServer.cpp @@ -127,6 +127,7 @@ void ConfigCentralServer::install(void) KEY_BOOL (disconnectDuplicateConnectionsOnOtherGalaxies, false); KEY_BOOL (requestDbSaveOnPlanetServerCrash, true); KEY_INT (maxTimeToWaitForPlanetServerStartSeconds, 5*60); // seconds + KEY_STRING (metricsDataURL, ""); int index = 0; char const * result = 0; diff --git a/engine/server/application/CentralServer/src/shared/ConfigCentralServer.h b/engine/server/application/CentralServer/src/shared/ConfigCentralServer.h index fdc5b131..ed971f33 100755 --- a/engine/server/application/CentralServer/src/shared/ConfigCentralServer.h +++ b/engine/server/application/CentralServer/src/shared/ConfigCentralServer.h @@ -71,6 +71,7 @@ public: bool requestDbSaveOnPlanetServerCrash; int maxTimeToWaitForPlanetServerStartSeconds; + const char * metricsDataURL; }; static const unsigned short getChatServicePort (); @@ -140,7 +141,7 @@ public: static bool getRequestDbSaveOnPlanetServerCrash(); static int getMaxTimeToWaitForPlanetServerStartSeconds(); - + static const char * getMetricsDataURL(); private: static Data * data; }; @@ -510,6 +511,11 @@ inline int ConfigCentralServer::getMaxTimeToWaitForPlanetServerStartSeconds() return data->maxTimeToWaitForPlanetServerStartSeconds; } +inline const char * ConfigCentralServer::getMetricsDataURL() +{ + return data->metricsDataURL; +} + // ====================================================================== #endif // _ConfigCentralServer_H From b0d577bc36a8d1b6a80eb4e3211948e000bca90c Mon Sep 17 00:00:00 2001 From: swg Date: Thu, 5 May 2016 19:55:02 +0100 Subject: [PATCH 103/302] i rather do this --- .../application/CentralServer/src/shared/CentralServer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engine/server/application/CentralServer/src/shared/CentralServer.cpp b/engine/server/application/CentralServer/src/shared/CentralServer.cpp index 700db9f4..589d195a 100755 --- a/engine/server/application/CentralServer/src/shared/CentralServer.cpp +++ b/engine/server/application/CentralServer/src/shared/CentralServer.cpp @@ -2823,6 +2823,7 @@ void CentralServer::sendPopulationUpdateToLoginServer() m_totalTutorialSceneCount = 0; m_totalFalconSceneCount = 0; + ConnectionServerConnectionList::const_iterator i; for (i=m_connectionServerConnections.begin(); i!=m_connectionServerConnections.end(); ++i) { @@ -2846,7 +2847,7 @@ void CentralServer::sendPopulationUpdateToLoginServer() if (!(updateURL.empty())) { std::ostringstream postBuf; - postBuf << "totalPlayerCount=" << m_totalPlayerCount << "&totalEmptySceneCount=" << m_totalEmptySceneCount << "&totalFreeTrialCount=" << m_totalFreeTrialCount << "&totalTutorialSceneCount=" << m_totalTutorialSceneCount << "&totalFalconSceneCount=" << m_totalFalconSceneCount; + postBuf << "totalPlayerCount=" << m_totalPlayerCount << "&totalEmptySceneCount=" << m_gameServers.size() - 1 << "&totalFreeTrialCount=" << m_totalFreeTrialCount << "&totalTutorialSceneCount=" << m_totalTutorialSceneCount << "&totalFalconSceneCount=" << m_totalFalconSceneCount; webAPI::simplePost(updateURL, std::string(postBuf.str()), ""); } From 5a082e5f1de1d090eaee3f2f396c018dbd94fd9b Mon Sep 17 00:00:00 2001 From: swg Date: Fri, 6 May 2016 00:18:28 +0100 Subject: [PATCH 104/302] changing the submitted data of the webstatistics stuff --- .../application/CentralServer/src/shared/CentralServer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/server/application/CentralServer/src/shared/CentralServer.cpp b/engine/server/application/CentralServer/src/shared/CentralServer.cpp index 589d195a..e039a517 100755 --- a/engine/server/application/CentralServer/src/shared/CentralServer.cpp +++ b/engine/server/application/CentralServer/src/shared/CentralServer.cpp @@ -2847,7 +2847,7 @@ void CentralServer::sendPopulationUpdateToLoginServer() if (!(updateURL.empty())) { std::ostringstream postBuf; - postBuf << "totalPlayerCount=" << m_totalPlayerCount << "&totalEmptySceneCount=" << m_gameServers.size() - 1 << "&totalFreeTrialCount=" << m_totalFreeTrialCount << "&totalTutorialSceneCount=" << m_totalTutorialSceneCount << "&totalFalconSceneCount=" << m_totalFalconSceneCount; + postBuf << "totalPlayerCount=" << m_totalPlayerCount << "&totalGameServers=" << m_gameServers.size() - 1 << "&totalPlanetServers=" << m_planetServers.size() << "&isPublic=" << getIsClusterPublic() << "&isLocked=" << getIsClusterLocked() << "&isSecret=" << getIsClusterSecret() << "&preloadFinished=" << getClusterStartupTime() << "&databasebacklogged=" << isDatabaseBacklogged() << "&totalTutorialSceneCount=" << m_totalTutorialSceneCount << "&totalFalconSceneCount=" << m_totalFalconSceneCount; webAPI::simplePost(updateURL, std::string(postBuf.str()), ""); } From eb8e50c568b3983249db9b7dfde3a889ca6a3926 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Fri, 6 May 2016 02:52:55 +0000 Subject: [PATCH 105/302] move the web api updates into their own function, and make it a configurable via webUpdateIntervalSeconds, also fix the check using mod operator for shutdown as it fired every frame except frame 5, instead of every second --- .../src/shared/CentralServer.cpp | 39 +++++++++++++------ .../CentralServer/src/shared/CentralServer.h | 1 + .../src/shared/ConfigCentralServer.cpp | 1 + .../src/shared/ConfigCentralServer.h | 13 +++++++ 4 files changed, 42 insertions(+), 12 deletions(-) diff --git a/engine/server/application/CentralServer/src/shared/CentralServer.cpp b/engine/server/application/CentralServer/src/shared/CentralServer.cpp index e039a517..a6b51427 100755 --- a/engine/server/application/CentralServer/src/shared/CentralServer.cpp +++ b/engine/server/application/CentralServer/src/shared/CentralServer.cpp @@ -2780,6 +2780,17 @@ void CentralServer::update() sendPopulationUpdateToLoginServer(); } + + // update the webAPI if specified + // in theory the variables should be set unless this fires at a really early frame + int webUpdateIntervalSeconds = ConfigCentralServer::getWebUpdateIntervalSeconds(); + + // assuming that every 5th frame is ~1 second, we can multiply and then mod + if ( webUpdateIntervalSeconds > 0 && (loopCount%(webUpdateIntervalSeconds*5) == 0)) + { + sendMetricsToWebAPI(); + } + if ( ConfigCentralServer::getAuctionEnabled() ) // allow auctions? { if ( m_pAuctionTransferClient == nullptr ) @@ -2804,7 +2815,8 @@ void CentralServer::update() } // check every 5th frame (one second roughly?) - if( loopCount%5 ) + // mod returns 0 if no remainder - meaning the below would return true without == 0, wtf? + if( loopCount % 5 == 0 ) { checkShutdownProcess(); } @@ -2841,21 +2853,24 @@ void CentralServer::sendPopulationUpdateToLoginServer() if (!isPreloadFinished() || (time(0)-m_lastLoadingStateTime < static_cast(ConfigCentralServer::getRecentLoadingStateSeconds()))) loadedRecently=true; - // stella: Adding those for sending regular updates through WebAPI to the webserver - std::string updateURL = std::string(ConfigCentralServer::getMetricsDataURL()); - - if (!(updateURL.empty())) - { - std::ostringstream postBuf; - postBuf << "totalPlayerCount=" << m_totalPlayerCount << "&totalGameServers=" << m_gameServers.size() - 1 << "&totalPlanetServers=" << m_planetServers.size() << "&isPublic=" << getIsClusterPublic() << "&isLocked=" << getIsClusterLocked() << "&isSecret=" << getIsClusterSecret() << "&preloadFinished=" << getClusterStartupTime() << "&databasebacklogged=" << isDatabaseBacklogged() << "&totalTutorialSceneCount=" << m_totalTutorialSceneCount << "&totalFalconSceneCount=" << m_totalFalconSceneCount; - - webAPI::simplePost(updateURL, std::string(postBuf.str()), ""); - } - UpdatePlayerCountMessage upm(loadedRecently, m_totalPlayerCount, m_totalFreeTrialCount, m_totalEmptySceneCount, m_totalTutorialSceneCount, m_totalFalconSceneCount); sendToAllLoginServers(upm); } +void CentralServer::sendMetricsToWebAPI() +{ + std::string updateURL = std::string(ConfigCentralServer::getMetricsDataURL()); + + if (!(updateURL.empty())) + { + std::ostringstream postBuf; + + postBuf << "totalPlayerCount=" << m_totalPlayerCount << "&totalGameServers=" << m_gameServers.size() - 1 << "&totalPlanetServers=" << m_planetServers.size() << "&isPublic=" << getIsClusterPublic() << "&isLocked=" << getIsClusterLocked() << "&isSecret=" << getIsClusterSecret() << "&preloadFinished=" << getClusterStartupTime() << "&databasebacklogged=" << isDatabaseBacklogged() << "&totalTutorialSceneCount=" << m_totalTutorialSceneCount << "&totalFalconSceneCount=" << m_totalFalconSceneCount; + + webAPI::simplePost(updateURL, std::string(postBuf.str()), ""); + } +} + //----------------------------------------------------------------------- void CentralServer::sendTaskMessage(const GameNetworkMessage & source) diff --git a/engine/server/application/CentralServer/src/shared/CentralServer.h b/engine/server/application/CentralServer/src/shared/CentralServer.h index 262552b0..22e6a7de 100755 --- a/engine/server/application/CentralServer/src/shared/CentralServer.h +++ b/engine/server/application/CentralServer/src/shared/CentralServer.h @@ -182,6 +182,7 @@ private: size_t getGameServerCount (void) const; void update(); void sendPopulationUpdateToLoginServer(); + void sendMetricsToWebAPI(); ConnectionServerConnection * getConnectionServerForAccount(StationId suid); void addToAccountConnectionMap(StationId suid, ConnectionServerConnection * cconn, uint32 subscriptionBits); void removeFromAccountConnectionMap(int connectionServerConnectionId); diff --git a/engine/server/application/CentralServer/src/shared/ConfigCentralServer.cpp b/engine/server/application/CentralServer/src/shared/ConfigCentralServer.cpp index 28a33e2f..0a981a11 100755 --- a/engine/server/application/CentralServer/src/shared/ConfigCentralServer.cpp +++ b/engine/server/application/CentralServer/src/shared/ConfigCentralServer.cpp @@ -128,6 +128,7 @@ void ConfigCentralServer::install(void) KEY_BOOL (requestDbSaveOnPlanetServerCrash, true); KEY_INT (maxTimeToWaitForPlanetServerStartSeconds, 5*60); // seconds KEY_STRING (metricsDataURL, ""); + KEY_INT (webUpdateIntervalSeconds, 0); int index = 0; char const * result = 0; diff --git a/engine/server/application/CentralServer/src/shared/ConfigCentralServer.h b/engine/server/application/CentralServer/src/shared/ConfigCentralServer.h index ed971f33..79e08d55 100755 --- a/engine/server/application/CentralServer/src/shared/ConfigCentralServer.h +++ b/engine/server/application/CentralServer/src/shared/ConfigCentralServer.h @@ -71,7 +71,9 @@ public: bool requestDbSaveOnPlanetServerCrash; int maxTimeToWaitForPlanetServerStartSeconds; + const char * metricsDataURL; + int webUpdateIntervalSeconds; }; static const unsigned short getChatServicePort (); @@ -141,7 +143,9 @@ public: static bool getRequestDbSaveOnPlanetServerCrash(); static int getMaxTimeToWaitForPlanetServerStartSeconds(); + static const char * getMetricsDataURL(); + static int getWebUpdateIntervalSeconds(); private: static Data * data; }; @@ -511,11 +515,20 @@ inline int ConfigCentralServer::getMaxTimeToWaitForPlanetServerStartSeconds() return data->maxTimeToWaitForPlanetServerStartSeconds; } +// ---------------------------------------------------------------------- + inline const char * ConfigCentralServer::getMetricsDataURL() { return data->metricsDataURL; } +// ---------------------------------------------------------------------- + +inline int ConfigCentralServer::getWebUpdateIntervalSeconds() +{ + return data->webUpdateIntervalSeconds; +} + // ====================================================================== #endif // _ConfigCentralServer_H From d78d8b5a62a9c7aec419789d975e1f37783da1f7 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Fri, 6 May 2016 02:55:46 +0000 Subject: [PATCH 106/302] simplification --- .../application/CentralServer/src/shared/CentralServer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/server/application/CentralServer/src/shared/CentralServer.cpp b/engine/server/application/CentralServer/src/shared/CentralServer.cpp index a6b51427..f7087006 100755 --- a/engine/server/application/CentralServer/src/shared/CentralServer.cpp +++ b/engine/server/application/CentralServer/src/shared/CentralServer.cpp @@ -2786,7 +2786,7 @@ void CentralServer::update() int webUpdateIntervalSeconds = ConfigCentralServer::getWebUpdateIntervalSeconds(); // assuming that every 5th frame is ~1 second, we can multiply and then mod - if ( webUpdateIntervalSeconds > 0 && (loopCount%(webUpdateIntervalSeconds*5) == 0)) + if ( webUpdateIntervalSeconds && (loopCount%(webUpdateIntervalSeconds*5) == 0)) { sendMetricsToWebAPI(); } From 040c2518fa40969c9fd47892fa89e901bed24e7c Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Fri, 6 May 2016 02:56:28 +0000 Subject: [PATCH 107/302] fix dumb comment i made --- .../application/CentralServer/src/shared/CentralServer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/server/application/CentralServer/src/shared/CentralServer.cpp b/engine/server/application/CentralServer/src/shared/CentralServer.cpp index f7087006..2a884e5e 100755 --- a/engine/server/application/CentralServer/src/shared/CentralServer.cpp +++ b/engine/server/application/CentralServer/src/shared/CentralServer.cpp @@ -2815,7 +2815,7 @@ void CentralServer::update() } // check every 5th frame (one second roughly?) - // mod returns 0 if no remainder - meaning the below would return true without == 0, wtf? + // mod returns 0 if no remainder - meaning the below would return true every frame except every 5th, without == 0, wtf? if( loopCount % 5 == 0 ) { checkShutdownProcess(); From ecb7bab296867e76bcc4c9534a5da1a1611e2a82 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Fri, 6 May 2016 03:54:59 +0000 Subject: [PATCH 108/302] give the login server update, webAPI update, and server shutdown check their own loop counters as without them the setting back to 0 can cause unreachable cases... as a result mod isn't necessary anymore either --- .../src/shared/CentralServer.cpp | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/engine/server/application/CentralServer/src/shared/CentralServer.cpp b/engine/server/application/CentralServer/src/shared/CentralServer.cpp index 2a884e5e..acf2bcc6 100755 --- a/engine/server/application/CentralServer/src/shared/CentralServer.cpp +++ b/engine/server/application/CentralServer/src/shared/CentralServer.cpp @@ -2768,13 +2768,16 @@ void CentralServer::run(void) */ void CentralServer::update() { - static int loopCount=0; + static int loopCount = 0; + static int apiLoopCount = 0; + static int shutdownCheckLoopCount = 0; + m_curTime = static_cast(time(0)); // Tell the LoginServers if necessary - if ((++loopCount > ConfigCentralServer::getUpdatePlayerCountFrequency())) + if ((++loopCount >= ConfigCentralServer::getUpdatePlayerCountFrequency())) { - loopCount=0; + loopCount = 0; // Update the population on the server sendPopulationUpdateToLoginServer(); @@ -2782,12 +2785,14 @@ void CentralServer::update() // update the webAPI if specified - // in theory the variables should be set unless this fires at a really early frame int webUpdateIntervalSeconds = ConfigCentralServer::getWebUpdateIntervalSeconds(); - // assuming that every 5th frame is ~1 second, we can multiply and then mod - if ( webUpdateIntervalSeconds && (loopCount%(webUpdateIntervalSeconds*5) == 0)) + // assuming that every 5th frame is ~1 second, we can multiply and then check + if ( webUpdateIntervalSeconds && (++apiLoopCount >= (webUpdateIntervalSeconds*5)) ) { + apiLoopCount = 0; + + // update the web api sendMetricsToWebAPI(); } @@ -2815,9 +2820,10 @@ void CentralServer::update() } // check every 5th frame (one second roughly?) - // mod returns 0 if no remainder - meaning the below would return true every frame except every 5th, without == 0, wtf? - if( loopCount % 5 == 0 ) + if ( ++shutdownCheckLoopCount == 5 ) { + shutdownCheckLoopCount = 0; + checkShutdownProcess(); } From e65f6aa238d29b3400970c32c55b8912ce8db03e Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Fri, 6 May 2016 03:57:34 +0000 Subject: [PATCH 109/302] actually, greater than makes sense here without the equal, 0 base and all --- .../application/CentralServer/src/shared/CentralServer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engine/server/application/CentralServer/src/shared/CentralServer.cpp b/engine/server/application/CentralServer/src/shared/CentralServer.cpp index acf2bcc6..5189e047 100755 --- a/engine/server/application/CentralServer/src/shared/CentralServer.cpp +++ b/engine/server/application/CentralServer/src/shared/CentralServer.cpp @@ -2775,7 +2775,7 @@ void CentralServer::update() m_curTime = static_cast(time(0)); // Tell the LoginServers if necessary - if ((++loopCount >= ConfigCentralServer::getUpdatePlayerCountFrequency())) + if ((++loopCount > ConfigCentralServer::getUpdatePlayerCountFrequency())) { loopCount = 0; @@ -2788,7 +2788,7 @@ void CentralServer::update() int webUpdateIntervalSeconds = ConfigCentralServer::getWebUpdateIntervalSeconds(); // assuming that every 5th frame is ~1 second, we can multiply and then check - if ( webUpdateIntervalSeconds && (++apiLoopCount >= (webUpdateIntervalSeconds*5)) ) + if ( webUpdateIntervalSeconds && (++apiLoopCount > (webUpdateIntervalSeconds*5)) ) { apiLoopCount = 0; @@ -2820,7 +2820,7 @@ void CentralServer::update() } // check every 5th frame (one second roughly?) - if ( ++shutdownCheckLoopCount == 5 ) + if ( ++shutdownCheckLoopCount > 5 ) { shutdownCheckLoopCount = 0; From e753f9c25028fe427d4c9264bb4684574e4878c0 Mon Sep 17 00:00:00 2001 From: swg Date: Sat, 7 May 2016 00:00:36 +0100 Subject: [PATCH 110/302] roughly 1 sec update timer now --- .../application/CentralServer/src/shared/CentralServer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/server/application/CentralServer/src/shared/CentralServer.cpp b/engine/server/application/CentralServer/src/shared/CentralServer.cpp index 5189e047..97b5a849 100755 --- a/engine/server/application/CentralServer/src/shared/CentralServer.cpp +++ b/engine/server/application/CentralServer/src/shared/CentralServer.cpp @@ -2788,7 +2788,7 @@ void CentralServer::update() int webUpdateIntervalSeconds = ConfigCentralServer::getWebUpdateIntervalSeconds(); // assuming that every 5th frame is ~1 second, we can multiply and then check - if ( webUpdateIntervalSeconds && (++apiLoopCount > (webUpdateIntervalSeconds*5)) ) + if ( webUpdateIntervalSeconds && (++apiLoopCount > (webUpdateIntervalSeconds*1000)) ) { apiLoopCount = 0; From 0491c0faf297e7f664df63571151b0e5d1229ec7 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Mon, 9 May 2016 16:58:45 +0000 Subject: [PATCH 111/302] silence warnings about sendControllerMessageToAuthServer while uninitialized - closes #22 for release builds, see bug for more info --- .../library/serverGame/src/shared/object/ServerObject.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/server/library/serverGame/src/shared/object/ServerObject.cpp b/engine/server/library/serverGame/src/shared/object/ServerObject.cpp index 08367a64..db1319bd 100755 --- a/engine/server/library/serverGame/src/shared/object/ServerObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/ServerObject.cpp @@ -3276,9 +3276,9 @@ void ServerObject::removeTriggerVolume(const std::string & name) void ServerObject::sendControllerMessageToAuthServer(enum GameControllerMessage cm, MessageQueue::Data * msg, float value) { #ifdef _DEBUG - WARNING(isInEndBaselines(), ("sendControllerMessageToAuthServer while ending baselines: message id=(%d) from object id=[%s], template=[%s], on server id=[%d]", static_cast(cm), getNetworkId().getValueString().c_str(), getObjectTemplateName(), static_cast(GameServer::getInstance().getProcessId()))); + DEBUG_WARNING(isInEndBaselines(), ("sendControllerMessageToAuthServer while ending baselines: message id=(%d) from object id=[%s], template=[%s], on server id=[%d]", static_cast(cm), getNetworkId().getValueString().c_str(), getObjectTemplateName(), static_cast(GameServer::getInstance().getProcessId()))); - WARNING(!isInitialized(), ("sendControllerMessageToAuthServer while uninitialized: message id=(%d) from object id=[%s], template=[%s], on server id=[%d]", static_cast(cm), getNetworkId().getValueString().c_str(), getObjectTemplateName(), static_cast(GameServer::getInstance().getProcessId()))); + DEBUG_WARNING(!isInitialized(), ("sendControllerMessageToAuthServer while uninitialized: message id=(%d) from object id=[%s], template=[%s], on server id=[%d]", static_cast(cm), getNetworkId().getValueString().c_str(), getObjectTemplateName(), static_cast(GameServer::getInstance().getProcessId()))); #endif Controller * controller = getController(); From 18d14502b314d3805a906aab8e754533898151f5 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sun, 15 May 2016 21:02:00 +0000 Subject: [PATCH 112/302] giveTime always ends up succeeding, this message just spams the console --- .../src/shared/commoditiesMarket/CommoditiesMarket.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesMarket.cpp b/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesMarket.cpp index 5d90b89e..77bebe62 100755 --- a/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesMarket.cpp +++ b/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesMarket.cpp @@ -1170,10 +1170,7 @@ void CommoditiesMarket::giveTime() else { if (Clock::timeSeconds() - ConfigServerGame::getCommoditiesServerReconnectIntervalSec() > reconnectTime) - { - - DEBUG_WARNING(true, ("[Commodities API] : No commodities server connection to send GiveTime.")); - + { getCommoditiesServerConnection(); //attempt to reconnect to commodities server reconnectTime = Clock::timeSeconds(); } From 321a19c315fdb39fce177635936de528f7a69367 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sun, 15 May 2016 21:11:29 +0000 Subject: [PATCH 113/302] unnecessary ifdef --- .../library/serverGame/src/shared/object/ServerObject.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/engine/server/library/serverGame/src/shared/object/ServerObject.cpp b/engine/server/library/serverGame/src/shared/object/ServerObject.cpp index db1319bd..59a49942 100755 --- a/engine/server/library/serverGame/src/shared/object/ServerObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/ServerObject.cpp @@ -3275,11 +3275,9 @@ void ServerObject::removeTriggerVolume(const std::string & name) void ServerObject::sendControllerMessageToAuthServer(enum GameControllerMessage cm, MessageQueue::Data * msg, float value) { -#ifdef _DEBUG DEBUG_WARNING(isInEndBaselines(), ("sendControllerMessageToAuthServer while ending baselines: message id=(%d) from object id=[%s], template=[%s], on server id=[%d]", static_cast(cm), getNetworkId().getValueString().c_str(), getObjectTemplateName(), static_cast(GameServer::getInstance().getProcessId()))); DEBUG_WARNING(!isInitialized(), ("sendControllerMessageToAuthServer while uninitialized: message id=(%d) from object id=[%s], template=[%s], on server id=[%d]", static_cast(cm), getNetworkId().getValueString().c_str(), getObjectTemplateName(), static_cast(GameServer::getInstance().getProcessId()))); -#endif Controller * controller = getController(); if(controller) From b724093bcb684c8e5ec5d4812109dd8af7e65ff4 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sun, 15 May 2016 21:20:51 +0000 Subject: [PATCH 114/302] reduce spam on release mode --- .../application/PlanetServer/src/shared/PlanetProxyObject.cpp | 2 +- .../serverGame/src/shared/controller/AiCreatureController.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/server/application/PlanetServer/src/shared/PlanetProxyObject.cpp b/engine/server/application/PlanetServer/src/shared/PlanetProxyObject.cpp index b2d9cf79..648debd0 100755 --- a/engine/server/application/PlanetServer/src/shared/PlanetProxyObject.cpp +++ b/engine/server/application/PlanetServer/src/shared/PlanetProxyObject.cpp @@ -93,7 +93,7 @@ void PlanetProxyObject::update(int x, int y, int z, NetworkId containedBy, uint3 static unsigned long authTransferSanityCheckTimeMs = ConfigPlanetServer::getAuthTransferSanityCheckTimeMs(); if (Clock::timeMs()-m_authTransferTimeMs > authTransferSanityCheckTimeMs) { - WARNING(true, ("Resending auth transfer for %s to %lu due to receiving a stale position update.", m_objectId.getValueString().c_str(), authoritativeServer)); + DEBUG_WARNING(true, ("Resending auth transfer for %s to %lu due to receiving a stale position update.", m_objectId.getValueString().c_str(), authoritativeServer)); sendAuthorityChange(authoritativeServer, m_authoritativeServer, false); return; } diff --git a/engine/server/library/serverGame/src/shared/controller/AiCreatureController.cpp b/engine/server/library/serverGame/src/shared/controller/AiCreatureController.cpp index 3bea36b0..e86fd90e 100755 --- a/engine/server/library/serverGame/src/shared/controller/AiCreatureController.cpp +++ b/engine/server/library/serverGame/src/shared/controller/AiCreatureController.cpp @@ -223,7 +223,7 @@ void AICreatureController::handleMessage (int message, float value, const Messag { if (owner->isAuthoritative()) { - WARNING(true, ("AICreatureController::handleMessage() owner(%s) Received CM_aiSetMovement(%d) for an authoritative object. Only proxied objects should receive this controller message.", getDebugInformation().c_str(), static_cast(msg->getMovementType()))); + DEBUG_WARNING(true, ("AICreatureController::handleMessage() owner(%s) Received CM_aiSetMovement(%d) for an authoritative object. Only proxied objects should receive this controller message.", getDebugInformation().c_str(), static_cast(msg->getMovementType()))); } else { From e7ae2de472f6f8214df165092469f851adbd90e0 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sun, 15 May 2016 21:46:48 +0000 Subject: [PATCH 115/302] cleanup the profiler macro logic --- .../library/sharedDebug/src/shared/Profiler.h | 43 +------------------ 1 file changed, 1 insertion(+), 42 deletions(-) diff --git a/engine/shared/library/sharedDebug/src/shared/Profiler.h b/engine/shared/library/sharedDebug/src/shared/Profiler.h index aaa11d16..cbb46bac 100755 --- a/engine/shared/library/sharedDebug/src/shared/Profiler.h +++ b/engine/shared/library/sharedDebug/src/shared/Profiler.h @@ -207,7 +207,7 @@ inline void ProfilerAutoBlockCheck::transfer(char const *name) // ====================================================================== -#if defined(_DEBUG) || defined(PLATFORM_LINUX) +#if defined(_DEBUG) #define PROFILER_BLOCK_DEFINE(a, b) ProfilerBlock a ( b ) #define PROFILER_BLOCK_ENTER(a) a.enter() @@ -241,47 +241,6 @@ inline void ProfilerAutoBlockCheck::transfer(char const *name) #define PROFILER_GET_LAST_FRAME_DATA() "" #endif - -// ====================================================================== -// Macro functions that stick around for all non-production builds. -// [NP = no/non-production] -// ====================================================================== - -#if (PRODUCTION == 0) - - #define NP_PROFILER_BLOCK_DEFINE(a, b) ProfilerBlock a ( b ) - #define NP_PROFILER_BLOCK_ENTER(a) a.enter() - #define NP_PROFILER_BLOCK_LEAVE(a) a.leave() - #define NP_PROFILER_BLOCK_TRANSFER(a,b) a.transfer(b) - #define NP_PROFILER_BLOCK_LOST_CHECK(a) a.adjustForLostBlocks() - - #define NP_PABD_PASTE(a,b) a##b - #define NP_PABD_XPASTE(a,b) NP_PABD_PASTE(a,b) - #define NP_PROFILER_AUTO_BLOCK_DEFINE(a) ProfilerAutoBlock NP_PABD_XPASTE(profilerAutoBlock, __LINE__) ( a ) - #define NP_PROFILER_AUTO_BLOCK_CHECK_DEFINE(a) ProfilerAutoBlockCheck NP_PABD_XPASTE(profilerAutoBlockCheck, __LINE__) ( a ) - #define NP_PROFILER_NAMED_AUTO_BLOCK_DEFINE(a,b) ProfilerAutoBlock a ( b ) - #define NP_PROFILER_NAMED_AUTO_BLOCK_TRANSFER(a,b) a.transfer(b) - - #define NP_PROFILER_GET_LAST_FRAME_DATA() Profiler::getLastFrameData() - -#else - - #define NP_PROFILER_BLOCK_DEFINE(a, b) - #define NP_PROFILER_BLOCK_CHECK_DEFINE(a, b) - #define NP_PROFILER_BLOCK_ENTER(a) NOP - #define NP_PROFILER_BLOCK_LEAVE(a) NOP - #define NP_PROFILER_BLOCK_TRANSFER(a,b) NOP - #define NP_PROFILER_BLOCK_LOST_CHECK(a) NOP - - #define NP_PROFILER_AUTO_BLOCK_DEFINE(A) NOP - #define NP_PROFILER_AUTO_BLOCK_CHECK_DEFINE(a) NOP - #define NP_PROFILER_NAMED_AUTO_BLOCK_DEFINE(a,b) - #define NP_PROFILER_NAMED_AUTO_BLOCK_TRANSFER(a,b) NOP - - #define NP_PROFILER_GET_LAST_FRAME_DATA() "" - -#endif - // ====================================================================== #endif From a78fbb9978bb0baaeff6f4b52d6a971ec4e42077 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sun, 22 May 2016 04:32:03 +0000 Subject: [PATCH 116/302] make a warning debug only --- .../serverGame/src/shared/controller/AiCreatureController.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/server/library/serverGame/src/shared/controller/AiCreatureController.cpp b/engine/server/library/serverGame/src/shared/controller/AiCreatureController.cpp index e86fd90e..0cc4bb39 100755 --- a/engine/server/library/serverGame/src/shared/controller/AiCreatureController.cpp +++ b/engine/server/library/serverGame/src/shared/controller/AiCreatureController.cpp @@ -2303,7 +2303,7 @@ void AICreatureController::setPrimaryWeapon(CrcString const & objectTemplate) if (newPrimaryWeapon == NetworkId::cms_invalid) { - WARNING(true, ("AICreatureController::setPrimaryWeapon() owner(%s) Unable to create the requested primary weapon(%s)", getDebugInformation().c_str(), objectTemplate.getString())); + DEBUG_WARNING(true, ("AICreatureController::setPrimaryWeapon() owner(%s) Unable to create the requested primary weapon(%s)", getDebugInformation().c_str(), objectTemplate.getString())); } else { From a05e61e0fe3f6643ea8d0383763bcd8fbb8ef449 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sun, 22 May 2016 17:44:00 +0000 Subject: [PATCH 117/302] the response should never be empty but we need to check the json lib for exceptions and return appropriately... + cleanup a bit - closes #33 --- .../src/shared/CentralServer.cpp | 19 ++++++++----------- .../CentralServer/src/shared/CentralServer.h | 2 +- .../src/shared/ClientConnection.cpp | 15 ++++----------- external/3rd/library/webAPI/webAPI.cpp | 10 +++++++++- 4 files changed, 22 insertions(+), 24 deletions(-) diff --git a/engine/server/application/CentralServer/src/shared/CentralServer.cpp b/engine/server/application/CentralServer/src/shared/CentralServer.cpp index 97b5a849..8034bbdb 100755 --- a/engine/server/application/CentralServer/src/shared/CentralServer.cpp +++ b/engine/server/application/CentralServer/src/shared/CentralServer.cpp @@ -2786,14 +2786,15 @@ void CentralServer::update() // update the webAPI if specified int webUpdateIntervalSeconds = ConfigCentralServer::getWebUpdateIntervalSeconds(); + std::string updateURL = std::string(ConfigCentralServer::getMetricsDataURL()); // assuming that every 5th frame is ~1 second, we can multiply and then check - if ( webUpdateIntervalSeconds && (++apiLoopCount > (webUpdateIntervalSeconds*1000)) ) + if ( !(updateURL.empty()) && webUpdateIntervalSeconds && (++apiLoopCount > (webUpdateIntervalSeconds*1000)) ) { apiLoopCount = 0; // update the web api - sendMetricsToWebAPI(); + sendMetricsToWebAPI(updateURL); } if ( ConfigCentralServer::getAuctionEnabled() ) // allow auctions? @@ -2863,18 +2864,14 @@ void CentralServer::sendPopulationUpdateToLoginServer() sendToAllLoginServers(upm); } -void CentralServer::sendMetricsToWebAPI() +void CentralServer::sendMetricsToWebAPI(std::string updateURL) { - std::string updateURL = std::string(ConfigCentralServer::getMetricsDataURL()); + std::ostringstream postBuf; - if (!(updateURL.empty())) - { - std::ostringstream postBuf; - - postBuf << "totalPlayerCount=" << m_totalPlayerCount << "&totalGameServers=" << m_gameServers.size() - 1 << "&totalPlanetServers=" << m_planetServers.size() << "&isPublic=" << getIsClusterPublic() << "&isLocked=" << getIsClusterLocked() << "&isSecret=" << getIsClusterSecret() << "&preloadFinished=" << getClusterStartupTime() << "&databasebacklogged=" << isDatabaseBacklogged() << "&totalTutorialSceneCount=" << m_totalTutorialSceneCount << "&totalFalconSceneCount=" << m_totalFalconSceneCount; + postBuf << "totalPlayerCount=" << m_totalPlayerCount << "&totalGameServers=" << m_gameServers.size() - 1 << "&totalPlanetServers=" << m_planetServers.size() << "&isPublic=" << getIsClusterPublic() << "&isLocked=" << getIsClusterLocked() << "&isSecret=" << getIsClusterSecret() << "&preloadFinished=" << getClusterStartupTime() << "&databasebacklogged=" << isDatabaseBacklogged() << "&totalTutorialSceneCount=" << m_totalTutorialSceneCount << "&totalFalconSceneCount=" << m_totalFalconSceneCount; - webAPI::simplePost(updateURL, std::string(postBuf.str()), ""); - } + std::string response = webAPI::simplePost(updateURL, std::string(postBuf.str()), ""); + WARNING((response != "success"), ("Error sending stats: %s", response.c_str())); } //----------------------------------------------------------------------- diff --git a/engine/server/application/CentralServer/src/shared/CentralServer.h b/engine/server/application/CentralServer/src/shared/CentralServer.h index 22e6a7de..a2da8ddb 100755 --- a/engine/server/application/CentralServer/src/shared/CentralServer.h +++ b/engine/server/application/CentralServer/src/shared/CentralServer.h @@ -182,7 +182,7 @@ private: size_t getGameServerCount (void) const; void update(); void sendPopulationUpdateToLoginServer(); - void sendMetricsToWebAPI(); + void sendMetricsToWebAPI(std::string updateURL); ConnectionServerConnection * getConnectionServerForAccount(StationId suid); void addToAccountConnectionMap(StationId suid, ConnectionServerConnection * cconn, uint32 subscriptionBits); void removeFromAccountConnectionMap(int connectionServerConnectionId); diff --git a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp index c9a67d74..f57947f1 100755 --- a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp @@ -192,23 +192,16 @@ void ClientConnection::validateClient(const std::string & id, const std::string std::string response = webAPI::simplePost(authURL, std::string(postBuf.str()), ""); - if (!response.empty()) + if (response == "success") { - if (response == "success") - { - authOK = 1; - } - else - { - ErrorMessage err("Login Failed", response); - this->send(err, true); - } + authOK = 1; } else { - ErrorMessage err("Login Failed", "Error connecting to authentication provider."); + ErrorMessage err("Login Failed", response); this->send(err, true); } + } else { diff --git a/external/3rd/library/webAPI/webAPI.cpp b/external/3rd/library/webAPI/webAPI.cpp index c96effe7..847010f6 100644 --- a/external/3rd/library/webAPI/webAPI.cpp +++ b/external/3rd/library/webAPI/webAPI.cpp @@ -81,7 +81,15 @@ nlohmann::json webAPI::request(std::string endpoint, std::string data, int reqTy if (res == CURLE_OK && http_code == 200 && !(readBuffer.empty())) // check it all out and parse { - response = nlohmann::json::parse(readBuffer); + try { + response = nlohmann::json::parse(readBuffer); + } catch (std::string e) { + response["message"] = e; + response["status"] = "failure"; + } catch (...) { + response["message"] = "JSON parse error for endpoint."; + response["status"] = "failure"; + } } else { From 02193e560a13a2a7a197119b65702e33703ce3c0 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Mon, 23 May 2016 00:02:14 +0000 Subject: [PATCH 118/302] this warning never really indicates a problem as the gametime DOES get set eventually --- .../src/shared/commoditiesMarket/CommoditiesMarket.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesMarket.cpp b/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesMarket.cpp index 77bebe62..e7ec036b 100755 --- a/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesMarket.cpp +++ b/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesMarket.cpp @@ -1103,7 +1103,7 @@ void CommoditiesMarket::install() } else { - DEBUG_WARNING(true, ("[Commodities API] : No commodities server connection to send SetGameTime.")); + //DEBUG_WARNING(true, ("[Commodities API] : No commodities server connection to send SetGameTime.")); getCommoditiesServerConnection(); //attempt to reconnect to commodities server } From 79cf80c95dfecede607553b924da9630309e45cb Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Mon, 23 May 2016 00:21:09 +0000 Subject: [PATCH 119/302] double the timeout duration to see if that helps at all --- .../application/TaskManager/src/shared/ConfigTaskManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/server/application/TaskManager/src/shared/ConfigTaskManager.cpp b/engine/server/application/TaskManager/src/shared/ConfigTaskManager.cpp index 20c68e81..43ff0300 100755 --- a/engine/server/application/TaskManager/src/shared/ConfigTaskManager.cpp +++ b/engine/server/application/TaskManager/src/shared/ConfigTaskManager.cpp @@ -58,7 +58,7 @@ void ConfigTaskManager::install(void) KEY_BOOL (autoStart, true); KEY_STRING (clusterName, "devcluster"); KEY_BOOL (verifyClusterName, false); - KEY_INT (gameServerTimeout, 600); + KEY_INT (gameServerTimeout, 1200); KEY_STRING (gameServiceBindInterface, ""); KEY_INT (gameServicePort, 60001); KEY_INT (consoleConnectionPort, 60000); From 7139c1354dd57dcc604a31ae9a515ff1a371c6ab Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Mon, 23 May 2016 00:25:06 +0000 Subject: [PATCH 120/302] log when we send a keepalive, it may be related to being overloaded in which case we may need to throttle some things a bit... --- engine/server/library/serverGame/src/shared/core/GameServer.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engine/server/library/serverGame/src/shared/core/GameServer.cpp b/engine/server/library/serverGame/src/shared/core/GameServer.cpp index 30af19ef..6ea5e18c 100755 --- a/engine/server/library/serverGame/src/shared/core/GameServer.cpp +++ b/engine/server/library/serverGame/src/shared/core/GameServer.cpp @@ -888,6 +888,7 @@ void GameServer::receiveMessage(const MessageDispatch::Emitter & source, const M { if(Clock::timeMs() - s_lastTaskKeepaliveTime > 60000) { + DEBUG_WARNING(true, ("Sending keepalive message to taskmanager for process %i", Os::getProcessID())); static const GenericValueTypeMessage gameServerTaskManagerKeepAlive("GameServerTaskManagerKeepAlive", Os::getProcessId()); getInstance().m_taskManagerConnection->send(gameServerTaskManagerKeepAlive, true); s_lastTaskKeepaliveTime = Clock::timeMs(); From e3a67c1ef731e27cb8a65e3179a9c41840870d9f Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Mon, 23 May 2016 00:26:18 +0000 Subject: [PATCH 121/302] stupid casing --- engine/server/library/serverGame/src/shared/core/GameServer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/server/library/serverGame/src/shared/core/GameServer.cpp b/engine/server/library/serverGame/src/shared/core/GameServer.cpp index 6ea5e18c..3e14c6a7 100755 --- a/engine/server/library/serverGame/src/shared/core/GameServer.cpp +++ b/engine/server/library/serverGame/src/shared/core/GameServer.cpp @@ -888,7 +888,7 @@ void GameServer::receiveMessage(const MessageDispatch::Emitter & source, const M { if(Clock::timeMs() - s_lastTaskKeepaliveTime > 60000) { - DEBUG_WARNING(true, ("Sending keepalive message to taskmanager for process %i", Os::getProcessID())); + DEBUG_WARNING(true, ("Sending keepalive message to taskmanager for process %i", Os::getProcessId())); static const GenericValueTypeMessage gameServerTaskManagerKeepAlive("GameServerTaskManagerKeepAlive", Os::getProcessId()); getInstance().m_taskManagerConnection->send(gameServerTaskManagerKeepAlive, true); s_lastTaskKeepaliveTime = Clock::timeMs(); From b9b63e503da01fe2d16206e598143a1d5e44f4e7 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Mon, 23 May 2016 00:40:24 +0000 Subject: [PATCH 122/302] this message is so freaking annoying, i must comment it out. TODO --- .../library/serverGame/src/shared/object/ServerObject.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/server/library/serverGame/src/shared/object/ServerObject.cpp b/engine/server/library/serverGame/src/shared/object/ServerObject.cpp index 59a49942..684f559f 100755 --- a/engine/server/library/serverGame/src/shared/object/ServerObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/ServerObject.cpp @@ -3277,7 +3277,7 @@ void ServerObject::sendControllerMessageToAuthServer(enum GameControllerMessage { DEBUG_WARNING(isInEndBaselines(), ("sendControllerMessageToAuthServer while ending baselines: message id=(%d) from object id=[%s], template=[%s], on server id=[%d]", static_cast(cm), getNetworkId().getValueString().c_str(), getObjectTemplateName(), static_cast(GameServer::getInstance().getProcessId()))); - DEBUG_WARNING(!isInitialized(), ("sendControllerMessageToAuthServer while uninitialized: message id=(%d) from object id=[%s], template=[%s], on server id=[%d]", static_cast(cm), getNetworkId().getValueString().c_str(), getObjectTemplateName(), static_cast(GameServer::getInstance().getProcessId()))); + //DEBUG_WARNING(!isInitialized(), ("sendControllerMessageToAuthServer while uninitialized: message id=(%d) from object id=[%s], template=[%s], on server id=[%d]", static_cast(cm), getNetworkId().getValueString().c_str(), getObjectTemplateName(), static_cast(GameServer::getInstance().getProcessId()))); Controller * controller = getController(); if(controller) From efb7c66690386aca74b54e12013006d66f79946e Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Wed, 25 May 2016 02:01:02 +0000 Subject: [PATCH 123/302] Revert "double the timeout duration to see if that helps at all" This reverts commit 79cf80c95dfecede607553b924da9630309e45cb. --- .../application/TaskManager/src/shared/ConfigTaskManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/server/application/TaskManager/src/shared/ConfigTaskManager.cpp b/engine/server/application/TaskManager/src/shared/ConfigTaskManager.cpp index 43ff0300..20c68e81 100755 --- a/engine/server/application/TaskManager/src/shared/ConfigTaskManager.cpp +++ b/engine/server/application/TaskManager/src/shared/ConfigTaskManager.cpp @@ -58,7 +58,7 @@ void ConfigTaskManager::install(void) KEY_BOOL (autoStart, true); KEY_STRING (clusterName, "devcluster"); KEY_BOOL (verifyClusterName, false); - KEY_INT (gameServerTimeout, 1200); + KEY_INT (gameServerTimeout, 600); KEY_STRING (gameServiceBindInterface, ""); KEY_INT (gameServicePort, 60001); KEY_INT (consoleConnectionPort, 60000); From b27d82ff39b6997a304893490906a36ce80c1edb Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Wed, 1 Jun 2016 04:04:30 +0000 Subject: [PATCH 124/302] no more spaces for extra secret slots - closes #34 --- .../src/shared/ClientConnection.cpp | 14 +++++++++----- .../LoginServer/src/shared/ClientConnection.h | 18 ++++++++++++++++++ external/3rd/library/webAPI/webAPI.cpp | 15 ++++++++------- external/3rd/library/webAPI/webAPI.h | 6 ++++-- 4 files changed, 39 insertions(+), 14 deletions(-) diff --git a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp index f57947f1..911116b1 100755 --- a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp @@ -172,23 +172,27 @@ void ClientConnection::onReceive(const Archive::ByteStream & message) // originally was used to validate station API credentials, now uses our custom api void ClientConnection::validateClient(const std::string & id, const std::string & key) { - StationId suid = atoi(id.c_str()); + // to avoid having to re-type this stupid var all over the place + // ideally we wouldn't copy this here, but it would be a huge pain + const std::string trimmedId = trim(id); + + StationId suid = atoi(trimmedId.c_str()); int authOK = 0; if (suid == 0) { std::hash h; - suid = h(id); //lint !e603 // Symbol 'h' not initialized (it's a functor) + suid = h(trimmedId); //lint !e603 // Symbol 'h' not initialized (it's a functor) } - LOG("LoginClientConnection", ("validateClient() for stationId (%lu) at IP (%s), id (%s)", m_stationId, getRemoteAddress().c_str(), id.c_str())); + LOG("LoginClientConnection", ("validateClient() for stationId (%lu) at IP (%s), id (%s)", m_stationId, getRemoteAddress().c_str(), trimmedId.c_str())); std::string authURL(ConfigLoginServer::getExternalAuthUrl()); if (!authURL.empty()) { std::ostringstream postBuf; - postBuf << "user_name=" << id << "&user_password=" << key << "&stationID=" << suid << "&ip=" << getRemoteAddress(); + postBuf << "user_name=" << trimmedId << "&user_password=" << key << "&stationID=" << suid << "&ip=" << getRemoteAddress(); std::string response = webAPI::simplePost(authURL, std::string(postBuf.str()), ""); @@ -210,7 +214,7 @@ void ClientConnection::validateClient(const std::string & id, const std::string if (authOK) { - LoginServer::getInstance().onValidateClient(suid, id, this, true, NULL, 0xFFFFFFFF, 0xFFFFFFFF); + LoginServer::getInstance().onValidateClient(suid, trimmedId, this, true, NULL, 0xFFFFFFFF, 0xFFFFFFFF); } // else this case will never be reached, noop } diff --git a/engine/server/application/LoginServer/src/shared/ClientConnection.h b/engine/server/application/LoginServer/src/shared/ClientConnection.h index 432e875f..8f92f68f 100755 --- a/engine/server/application/LoginServer/src/shared/ClientConnection.h +++ b/engine/server/application/LoginServer/src/shared/ClientConnection.h @@ -10,6 +10,10 @@ #include "serverUtility/ServerConnection.h" #include "sharedFoundation/StationId.h" +#include +#include +#include + class ClientCommandChannel; class NetworkId; @@ -68,6 +72,20 @@ private: }; //lint !e1712 // default constructor not defined +//----------------------------------------------------------------------- + +// stolen from http://www.codeproject.com/Articles/10880/A-trim-implementation-for-std-string +// i'm rusty and haven't gotten to lambdas yet +inline const std::string trim(std::string str) +{ + + str.erase(str.begin(), std::find_if(str.begin(), str.end(), + [](char& ch)->bool { return !isspace(ch); })); + str.erase(std::find_if(str.rbegin(), str.rend(), + [](char& ch)->bool { return !isspace(ch); }).base(), str.end()); + return str; +} + //----------------------------------------------------------------------- inline const StationId ClientConnection::getStationId() const diff --git a/external/3rd/library/webAPI/webAPI.cpp b/external/3rd/library/webAPI/webAPI.cpp index 847010f6..b9637b03 100644 --- a/external/3rd/library/webAPI/webAPI.cpp +++ b/external/3rd/library/webAPI/webAPI.cpp @@ -15,13 +15,15 @@ License: what's a license? we're a bunch of dirty pirates! #include "webAPI.h" +using namespace std; + // if status == success, returns "success", or slotName's contents if specified... // otherwise returns the "message" if no success -std::string webAPI::simplePost(std::string endpoint, std::string data, std::string slotName) +string webAPI::simplePost(string endpoint, string data, string slotName) { // declare our output and go ahead and attempt to get data from remote nlohmann::json response = request(endpoint, data, 1); - std::string output; + string output; // if we got data back... if (response.count("status") && response["status"].get() == "success") @@ -53,7 +55,7 @@ std::string webAPI::simplePost(std::string endpoint, std::string data, std::stri // this can be broken out to separate the json bits later if we need raw or other http type requests // all it does is fetch via get or post, and if the status is 200 returns the json, else error json -nlohmann::json webAPI::request(std::string endpoint, std::string data, int reqType) +nlohmann::json webAPI::request(string endpoint, string data, int reqType) { nlohmann::json response; @@ -63,7 +65,7 @@ nlohmann::json webAPI::request(std::string endpoint, std::string data, int reqTy if (curl) { - std::string readBuffer; // container for the remote response + string readBuffer; // container for the remote response long http_code = 0; // we get this after performing the get or post curl_easy_setopt(curl, CURLOPT_URL, endpoint.c_str()); // endpoint is always specified by caller @@ -83,7 +85,7 @@ nlohmann::json webAPI::request(std::string endpoint, std::string data, int reqTy { try { response = nlohmann::json::parse(readBuffer); - } catch (std::string e) { + } catch (string e) { response["message"] = e; response["status"] = "failure"; } catch (...) { @@ -116,7 +118,6 @@ nlohmann::json webAPI::request(std::string endpoint, std::string data, int reqTy // This is used by curl to grab the response and put it into a var size_t webAPI::writeCallback(void *contents, size_t size, size_t nmemb, void *userp) { - ((std::string*)userp)->append((char*)contents, size * nmemb); + ((string*)userp)->append((char*)contents, size * nmemb); return size * nmemb; } - diff --git a/external/3rd/library/webAPI/webAPI.h b/external/3rd/library/webAPI/webAPI.h index 763c69e7..51e60a2c 100644 --- a/external/3rd/library/webAPI/webAPI.h +++ b/external/3rd/library/webAPI/webAPI.h @@ -21,12 +21,14 @@ License: what's a license? we're a bunch of dirty pirates! namespace webAPI { - std::string simplePost(std::string endpoint, std::string data, std::string slotName); + using namespace std; + + string simplePost(string endpoint, string data, string slotName); //std::string simpleGet(char* endpoint, char* data); //nlohmann::json post(char* endpoint, char* data); //nlohmann::json get(char* endpoint, char* data); - nlohmann::json request(std::string endpoint, std::string data, int reqType); // 1 for post, 0 for get + nlohmann::json request(string endpoint, string data, int reqType); // 1 for post, 0 for get size_t writeCallback(void *contents, size_t size, size_t nmemb, void *userp); }; From fb430fa7fe88824333ff23f0c13f1573cf057453 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Wed, 1 Jun 2016 14:35:54 +0000 Subject: [PATCH 125/302] fix desync issue with image design - closes #36 --- .../src/shared/core/ServerImageDesignerManager.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/engine/server/library/serverGame/src/shared/core/ServerImageDesignerManager.cpp b/engine/server/library/serverGame/src/shared/core/ServerImageDesignerManager.cpp index 2fd9b849..6b43cd17 100755 --- a/engine/server/library/serverGame/src/shared/core/ServerImageDesignerManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/ServerImageDesignerManager.cpp @@ -457,7 +457,7 @@ void ServerImageDesignerManager::updateGradualCustomizations(CreatureObject * ta std::pair::iterator, std::multimap::iterator> p = ms_gradualCustomizationMap.equal_range(target->getNetworkId()); if(p.first != ms_gradualCustomizationMap.end()) { - for(std::multimap::iterator i = p.first; i != p.second; ++i) + for(std::multimap::iterator i = p.first; i != p.second;) { if(!--(i->second.countdown)) { @@ -490,7 +490,11 @@ void ServerImageDesignerManager::updateGradualCustomizations(CreatureObject * ta DEBUG_WARNING(true, ("Could not create hair %s\n", i->second.templateName.c_str())); } } - ms_gradualCustomizationMap.erase(i); + i = ms_gradualCustomizationMap.erase(i); + } + else + { + ++i; } } } From 3c2243269a9401570f13185fef8791a6308743c8 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Wed, 1 Jun 2016 15:36:46 +0000 Subject: [PATCH 126/302] fix another multimap --- .../CentralServer/src/shared/CentralServer.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/engine/server/application/CentralServer/src/shared/CentralServer.cpp b/engine/server/application/CentralServer/src/shared/CentralServer.cpp index 8034bbdb..89562972 100755 --- a/engine/server/application/CentralServer/src/shared/CentralServer.cpp +++ b/engine/server/application/CentralServer/src/shared/CentralServer.cpp @@ -3006,12 +3006,12 @@ void CentralServer::setTaskManager(TaskConnection * newTaskManager) void CentralServer::removePlanetServer(const PlanetServerConnection * p) { - for (std::map::iterator i = m_planetServers.begin(); i != m_planetServers.end(); ++i) + for (std::map::iterator i = m_planetServers.begin(); i != m_planetServers.end();) { if ((*i).second == p) { DEBUG_REPORT_LOG(true,("Central lost connection to Planet Server %s\n",p->getSceneId().c_str())); - m_planetServers.erase(i); + i = m_planetServers.erase(i); if (isPreloadFinished()) m_timeClusterWentIntoLoadingState = 0; @@ -3020,6 +3020,10 @@ void CentralServer::removePlanetServer(const PlanetServerConnection * p) return; } + else + { + ++i; + } } } From f5df9f29d229dc92058aa5dc1d6b41386890c143 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Fri, 17 Jun 2016 06:42:19 +0000 Subject: [PATCH 127/302] close another loophole that allowed ghost accounts --- .../LoginServer/src/shared/ClientConnection.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp index 911116b1..6bda53cc 100755 --- a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp @@ -175,8 +175,15 @@ void ClientConnection::validateClient(const std::string & id, const std::string // to avoid having to re-type this stupid var all over the place // ideally we wouldn't copy this here, but it would be a huge pain const std::string trimmedId = trim(id); - - StationId suid = atoi(trimmedId.c_str()); + + // and to avoid funny business with atoi and casing + // make it a separate var than the one we send the auth server + std::string lcaseId; + lcaseId.resize(trimmedId.size()); + + std::transform(trimmedId.begin(),trimmedId.end(),lcaseId.begin(),::tolower); + + StationId suid = atoi(lcaseId.c_str()); int authOK = 0; if (suid == 0) From 5da4ab7b76b172f495a4f89f60b3cdfe9a4dc0b9 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sat, 18 Jun 2016 01:40:33 +0000 Subject: [PATCH 128/302] truly fix the ghosting problem this time --- .../application/LoginServer/src/shared/ClientConnection.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp index 6bda53cc..8ec8b511 100755 --- a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp @@ -189,7 +189,7 @@ void ClientConnection::validateClient(const std::string & id, const std::string if (suid == 0) { std::hash h; - suid = h(trimmedId); //lint !e603 // Symbol 'h' not initialized (it's a functor) + suid = h(lcaseId.c_str()); //lint !e603 // Symbol 'h' not initialized (it's a functor) } LOG("LoginClientConnection", ("validateClient() for stationId (%lu) at IP (%s), id (%s)", m_stationId, getRemoteAddress().c_str(), trimmedId.c_str())); From 23d910c53db763380e0a199ebc9d9455c5ef56e3 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sat, 18 Jun 2016 22:24:31 +0000 Subject: [PATCH 129/302] i realize this adds another one time-ish use var, but i'm more comfortable if we trim stuff on both this and the receiving end --- .../application/LoginServer/src/shared/ClientConnection.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp index 8ec8b511..eb79d2ce 100755 --- a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp @@ -175,6 +175,7 @@ void ClientConnection::validateClient(const std::string & id, const std::string // to avoid having to re-type this stupid var all over the place // ideally we wouldn't copy this here, but it would be a huge pain const std::string trimmedId = trim(id); + const std::string trimmedKey = trim(key); // and to avoid funny business with atoi and casing // make it a separate var than the one we send the auth server @@ -199,7 +200,7 @@ void ClientConnection::validateClient(const std::string & id, const std::string if (!authURL.empty()) { std::ostringstream postBuf; - postBuf << "user_name=" << trimmedId << "&user_password=" << key << "&stationID=" << suid << "&ip=" << getRemoteAddress(); + postBuf << "user_name=" << trimmedId << "&user_password=" << trimmedKey << "&stationID=" << suid << "&ip=" << getRemoteAddress(); std::string response = webAPI::simplePost(authURL, std::string(postBuf.str()), ""); From 41cd9ff9b3ffd507f2ce9bf7e6d100295a6f1d00 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Tue, 21 Jun 2016 18:59:05 +0000 Subject: [PATCH 130/302] will it end? --- .../application/LoginServer/src/shared/ClientConnection.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp index eb79d2ce..a2db9786 100755 --- a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp @@ -193,7 +193,7 @@ void ClientConnection::validateClient(const std::string & id, const std::string suid = h(lcaseId.c_str()); //lint !e603 // Symbol 'h' not initialized (it's a functor) } - LOG("LoginClientConnection", ("validateClient() for stationId (%lu) at IP (%s), id (%s)", m_stationId, getRemoteAddress().c_str(), trimmedId.c_str())); + LOG("LoginClientConnection", ("validateClient() for stationId (%lu) at IP (%s), id (%s)", m_stationId, getRemoteAddress().c_str(), lcaseId.c_str())); std::string authURL(ConfigLoginServer::getExternalAuthUrl()); @@ -222,7 +222,7 @@ void ClientConnection::validateClient(const std::string & id, const std::string if (authOK) { - LoginServer::getInstance().onValidateClient(suid, trimmedId, this, true, NULL, 0xFFFFFFFF, 0xFFFFFFFF); + LoginServer::getInstance().onValidateClient(suid, lcaseId, this, true, NULL, 0xFFFFFFFF, 0xFFFFFFFF); } // else this case will never be reached, noop } From 4f1bcb225ac0b55d7b886db68132fa66305c984c Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Tue, 21 Jun 2016 19:53:08 +0000 Subject: [PATCH 131/302] disable java perf counters as they shit in our /tmp dir until it is full, and this upsets oracle --- engine/server/library/serverScript/src/shared/JavaLibrary.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp index cc2bc006..ec8fd7bb 100755 --- a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp +++ b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp @@ -1167,8 +1167,9 @@ void JavaLibrary::initializeJavaThread() { // java 1.8 and higher uses metaspace...which is apparently unlimited by default +// and turn off perf counters as they crap up the tmp dir #if defined(JNI_VERSION_1_8) || defined(JNI_VERSION_1_9) - tempOption.optionString = "-XX:MetaspaceSize=64m"; + tempOption.optionString = "-XX:MetaspaceSize=64m --XX:-UsePerfData"; options.push_back(tempOption); #endif From 478ddced0e33fdd3d18337fa6726c1cf8cddb167 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Fri, 24 Jun 2016 02:03:23 +0000 Subject: [PATCH 132/302] always show logins --- .../server/application/LoginServer/src/shared/LoginServer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/server/application/LoginServer/src/shared/LoginServer.cpp b/engine/server/application/LoginServer/src/shared/LoginServer.cpp index 72201382..a3a213a8 100755 --- a/engine/server/application/LoginServer/src/shared/LoginServer.cpp +++ b/engine/server/application/LoginServer/src/shared/LoginServer.cpp @@ -1440,7 +1440,7 @@ void LoginServer::onValidateClient(StationId suid, const std::string & username, //Send off request for the avatar list from the database. DatabaseConnection::getInstance().requestAvatarListForAccount(suid, 0); - DEBUG_REPORT_LOG(true, ("Client connected. Station Id: %lu, Username: %s\n", suid, username.c_str())); + REPORT_LOG(true, ("Client connected. Station Id: %lu, Username: %s\n", suid, username.c_str())); LOG("LoginClientConnection", ("onValidateClient() for stationId (%lu) at IP (%s), id (%s), requesting avatar list for account", suid, conn->getRemoteAddress().c_str(), username.c_str())); //Set up the connection as being validated with this suid. From b983c3897242536eeb05bc770dadfe26e69ea974 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Wed, 13 Jul 2016 20:38:41 +0000 Subject: [PATCH 133/302] fix a null pointer deref when running the thinner version of MemManager --- .../src/shared/MemoryManager.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp b/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp index 58b65a60..9407855b 100755 --- a/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp +++ b/engine/shared/library/sharedMemoryManager/src/shared/MemoryManager.cpp @@ -46,7 +46,7 @@ // this flag is different than above, as it doesn't fully disable the manager, only a few pieces // including the destructor for some reason -#define DISABLED 0 +#define DISABLED 1 // removed all the debug cases for these as these seem to cause problems // recent modifications force the mem manager to always behave in production mode @@ -1935,9 +1935,11 @@ unsigned long MemoryManager::getCurrentNumberOfBytesAllocated(const int processI static time_t seconds = 0; unsigned long retVal = 0; - + +#if !DISABLED ms_criticalSection->enter(); - +#endif + if (processId) { if ((time (0) - seconds) > 60 ) @@ -1975,9 +1977,11 @@ unsigned long MemoryManager::getCurrentNumberOfBytesAllocated(const int processI retVal = static_cast(s_statm.tpsr) * static_cast(s_pagesize); } } - + +#if !DISABLED ms_criticalSection->leave(); - +#endif + return retVal; #endif } From 5bd85cf54dd7110abf4fc771e82b30b66622f7f5 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Wed, 13 Jul 2016 23:29:40 +0000 Subject: [PATCH 134/302] just slap an inline for the chat debug printing function...@devcodex if this is nasty please let me know...but clang was griping about it in release builds --- .../ChatAPI/projects/ChatAPI/ChatEnum.h | 23 ++++++------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatEnum.h b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatEnum.h index b17ab132..75534928 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatEnum.h +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatEnum.h @@ -6,24 +6,15 @@ #pragma warning ( disable : 4786 ) -// Defining _chatdebug_ +inline static void _chatdebug_(const char *fmt, ...) +{ #ifdef _DEBUG -#ifdef WIN32 -#define _chatdebug_ ::printf -#else -#define _chatdebug_ ::printf + va_list args; + va_start(args, fmt); + printf(fmt, args); + va_end(args); #endif -#endif - -#ifndef _DEBUG -#ifdef WIN32 -#define _chatdebug_ -#else -#define _chatdebug_ -#endif -#endif -// END: "Defining _chatdebug_" - +} // Use AVATAR_PRIORITY_NOFORCELOGOUT on RequestAvatarLogin if you want to override the // "last login wins" rule, switching that given avatar's session to use "first login wins" From 299dd9bf168d3343e2289c0f91488e35926ff438 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Thu, 14 Jul 2016 00:27:40 +0000 Subject: [PATCH 135/302] fix namespacing issue --- .../shared/library/sharedMath/src/shared/PolySolver.cpp | 4 ++-- .../shared/library/sharedMath/src/shared/SphereTreeNode.h | 8 ++++---- engine/shared/library/sharedMath/src/shared/Transform.cpp | 2 +- .../sharedMathArchive/src/shared/QuaternionArchive.h | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/engine/shared/library/sharedMath/src/shared/PolySolver.cpp b/engine/shared/library/sharedMath/src/shared/PolySolver.cpp index 872057d1..c4d61fb8 100755 --- a/engine/shared/library/sharedMath/src/shared/PolySolver.cpp +++ b/engine/shared/library/sharedMath/src/shared/PolySolver.cpp @@ -282,7 +282,7 @@ int PolySolver::solveQuartic( const double c[5], double s[4] ) } static const double nan = sqrt(-1.0f); - if (isnan(D)) + if (std::isnan(D)) { s[0] = nan; s[1] = nan; @@ -293,7 +293,7 @@ int PolySolver::solveQuartic( const double c[5], double s[4] ) s[1] = (-1.0/4.0)*a3 + (1.0/2.0)*R - (1.0/2.0)*D; } - if (isnan(E)) + if (std::isnan(E)) { s[2] = nan; s[3] = nan; diff --git a/engine/shared/library/sharedMath/src/shared/SphereTreeNode.h b/engine/shared/library/sharedMath/src/shared/SphereTreeNode.h index 3d630b82..c33002dc 100755 --- a/engine/shared/library/sharedMath/src/shared/SphereTreeNode.h +++ b/engine/shared/library/sharedMath/src/shared/SphereTreeNode.h @@ -1574,10 +1574,10 @@ inline bool SphereTreeNode::isValidSphere(Sphere con Vector const & center = sphere.getCenter(); float radius = sphere.getRadius(); - if(isnan(center.x)) return false; - if(isnan(center.y)) return false; - if(isnan(center.z)) return false; - if(isnan(radius)) return false; + if(std::isnan(center.x)) return false; + if(std::isnan(center.y)) return false; + if(std::isnan(center.z)) return false; + if(std::isnan(radius)) return false; if(!finite(center.x)) return false; if(!finite(center.y)) return false; diff --git a/engine/shared/library/sharedMath/src/shared/Transform.cpp b/engine/shared/library/sharedMath/src/shared/Transform.cpp index ef35b3d0..3c43e539 100755 --- a/engine/shared/library/sharedMath/src/shared/Transform.cpp +++ b/engine/shared/library/sharedMath/src/shared/Transform.cpp @@ -842,7 +842,7 @@ bool Transform::isNaN() const return true; } #else - if(isnan(matrix[i][j])) + if(std::isnan(matrix[i][j])) { DEBUG_FATAL(true, ("nan")); return true; diff --git a/engine/shared/library/sharedMathArchive/src/shared/QuaternionArchive.h b/engine/shared/library/sharedMathArchive/src/shared/QuaternionArchive.h index e8fbb32f..d27a6823 100755 --- a/engine/shared/library/sharedMathArchive/src/shared/QuaternionArchive.h +++ b/engine/shared/library/sharedMathArchive/src/shared/QuaternionArchive.h @@ -46,7 +46,7 @@ inline void get(ReadIterator & source, Quaternion & target) #ifdef _WIN32 if (_isnan(static_cast(target.w)) || _isnan(static_cast(target.x)) || _isnan(static_cast(target.y)) || _isnan(static_cast(target.z))) #else - if (isnan(target.w) || isnan(target.x) || isnan(target.y) || isnan(target.z)) + if (std::isnan(target.w) || std::isnan(target.x) || std::isnan(target.y) || std::isnan(target.z)) #endif { target.w = 1.0f; From 0e1f0ec90a48434f6c4255b408412603c8e351b9 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Thu, 14 Jul 2016 02:04:53 +0000 Subject: [PATCH 136/302] Ofast --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 44a929d7..f6861b26 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,7 +52,7 @@ elseif(UNIX) find_package(Curses REQUIRED) set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG -DDEBUG_LEVEL=2 -DPRODUCTION=0 -g3 -pipe -O0 -Wall -Wno-overloaded-virtual -Wno-missing-braces -Wno-format -Wno-write-strings -Wno-unknown-pragmas -Wno-uninitialized -Wno-reorder") - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DDEBUG_LEVEL=0 -DPRODUCTION=1 -pipe -march=native -mtune=native -O2 -Wno-overloaded-virtual -Wno-missing-braces -Wno-format -Wno-write-strings -Wno-unknown-pragmas -Wno-uninitialized -Wno-reorder") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DDEBUG_LEVEL=0 -DPRODUCTION=1 -pipe -Ofast -march=native -mtune=native -Wno-overloaded-virtual -Wno-missing-braces -Wno-format -Wno-write-strings -Wno-unknown-pragmas -Wno-uninitialized -Wno-reorder") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -D_GLIBCXX_USE_CXX11_ABI=0") add_definitions(-DLINUX -D_REENTRANT -Dlinux -D_USING_STL -D__STL_NO_BAD_ALLOC -D_GNU_SOURCE -D_XOPEN_SOURCE=500) From f68625a15c82df41b4872682f8f0adea13933518 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Thu, 14 Jul 2016 02:06:41 +0000 Subject: [PATCH 137/302] gitignore --- .gitignore | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.gitignore b/.gitignore index 417912d9..465b261b 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,9 @@ html build*/ !game/server/database/build/ game/server/database/data/templates.sql +.codelite/ +.idea/ +build.log +*.phprj +*.project +*.workspace From 4ac19c9816bf84ed1dc8769540a50adec5cf76c8 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Fri, 15 Jul 2016 05:48:31 +0000 Subject: [PATCH 138/302] icc didn't like the double underscores --- .../shared/library/sharedFoundation/src/linux/PlatformGlue.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.h b/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.h index 0cab423f..96544614 100755 --- a/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.h +++ b/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.h @@ -12,8 +12,8 @@ typedef unsigned short int WORD; typedef unsigned long int DWORD; typedef bool BOOL; -typedef long long __int64; //lint !e13 !e19 // Error: 13 (Bad type), Error: 19 (Useless declaration) // -TRF- Lint preprocessor discrepency, @todo look into this. -typedef __int64 LARGE_INTEGER; +typedef long long int64; //lint !e13 !e19 // Error: 13 (Bad type), Error: 19 (Useless declaration) // -TRF- Lint preprocessor discrepency, @todo look into this. +typedef int64 LARGE_INTEGER; const BOOL FALSE = 0; const BOOL TRUE = 1; From ba3a3fa9dd0e38bc06fc44c89a11f766019c1718 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Fri, 15 Jul 2016 14:39:12 +0000 Subject: [PATCH 139/302] What are you doing here? go back to the icc branch where you belong! - Revert "icc didn't like the double underscores" This reverts commit 4ac19c9816bf84ed1dc8769540a50adec5cf76c8. --- .../shared/library/sharedFoundation/src/linux/PlatformGlue.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.h b/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.h index 96544614..0cab423f 100755 --- a/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.h +++ b/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.h @@ -12,8 +12,8 @@ typedef unsigned short int WORD; typedef unsigned long int DWORD; typedef bool BOOL; -typedef long long int64; //lint !e13 !e19 // Error: 13 (Bad type), Error: 19 (Useless declaration) // -TRF- Lint preprocessor discrepency, @todo look into this. -typedef int64 LARGE_INTEGER; +typedef long long __int64; //lint !e13 !e19 // Error: 13 (Bad type), Error: 19 (Useless declaration) // -TRF- Lint preprocessor discrepency, @todo look into this. +typedef __int64 LARGE_INTEGER; const BOOL FALSE = 0; const BOOL TRUE = 1; From 12f53b3ac53936555d63d8cf8e146af59642722f Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Fri, 15 Jul 2016 19:54:11 +0000 Subject: [PATCH 140/302] more flags --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f6861b26..932876d7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,7 +52,7 @@ elseif(UNIX) find_package(Curses REQUIRED) set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG -DDEBUG_LEVEL=2 -DPRODUCTION=0 -g3 -pipe -O0 -Wall -Wno-overloaded-virtual -Wno-missing-braces -Wno-format -Wno-write-strings -Wno-unknown-pragmas -Wno-uninitialized -Wno-reorder") - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DDEBUG_LEVEL=0 -DPRODUCTION=1 -pipe -Ofast -march=native -mtune=native -Wno-overloaded-virtual -Wno-missing-braces -Wno-format -Wno-write-strings -Wno-unknown-pragmas -Wno-uninitialized -Wno-reorder") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DDEBUG_LEVEL=0 -DPRODUCTION=1 -pipe -Ofast -funroll-loops -march=native -mtune=native -Wno-overloaded-virtual -Wno-missing-braces -Wno-format -Wno-write-strings -Wno-unknown-pragmas -Wno-uninitialized -Wno-reorder") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -D_GLIBCXX_USE_CXX11_ABI=0") add_definitions(-DLINUX -D_REENTRANT -Dlinux -D_USING_STL -D__STL_NO_BAD_ALLOC -D_GNU_SOURCE -D_XOPEN_SOURCE=500) From fd7df09b26130aee48957c01c6f6857e9d8bbf5b Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Fri, 15 Jul 2016 20:35:16 +0000 Subject: [PATCH 141/302] instead of dealing with compiler specific flags i'll stop here... Ofast builds don't run when built with gcc, and the performance difference is too slight to notice when built with clang, compared to O3 --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 932876d7..5699a16e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,8 +51,8 @@ if(WIN32) elseif(UNIX) find_package(Curses REQUIRED) - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG -DDEBUG_LEVEL=2 -DPRODUCTION=0 -g3 -pipe -O0 -Wall -Wno-overloaded-virtual -Wno-missing-braces -Wno-format -Wno-write-strings -Wno-unknown-pragmas -Wno-uninitialized -Wno-reorder") - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DDEBUG_LEVEL=0 -DPRODUCTION=1 -pipe -Ofast -funroll-loops -march=native -mtune=native -Wno-overloaded-virtual -Wno-missing-braces -Wno-format -Wno-write-strings -Wno-unknown-pragmas -Wno-uninitialized -Wno-reorder") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG -DDEBUG_LEVEL=2 -DPRODUCTION=0 -m32 -g3 -pipe -O0 -Wall -Wno-overloaded-virtual -Wno-missing-braces -Wno-format -Wno-write-strings -Wno-unknown-pragmas -Wno-uninitialized -Wno-reorder") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DDEBUG_LEVEL=0 -DPRODUCTION=1 -m32 -pipe -O3 -funroll-loops -march=native -mtune=native -Wno-overloaded-virtual -Wno-missing-braces -Wno-format -Wno-write-strings -Wno-unknown-pragmas -Wno-uninitialized -Wno-reorder") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -D_GLIBCXX_USE_CXX11_ABI=0") add_definitions(-DLINUX -D_REENTRANT -Dlinux -D_USING_STL -D__STL_NO_BAD_ALLOC -D_GNU_SOURCE -D_XOPEN_SOURCE=500) From 74c121f6c7408665261adebce53c19d26c0a6115 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Tue, 19 Jul 2016 16:52:07 +0000 Subject: [PATCH 142/302] add some java performance (ricing) flags, remove support for ancient javas...well, up to 7 --- .../src/shared/core/ConfigServerGame.cpp | 1 - .../src/shared/core/ConfigServerGame.h | 8 - .../serverScript/src/shared/JavaLibrary.cpp | 267 ++++-------------- 3 files changed, 62 insertions(+), 214 deletions(-) diff --git a/engine/server/library/serverGame/src/shared/core/ConfigServerGame.cpp b/engine/server/library/serverGame/src/shared/core/ConfigServerGame.cpp index 42400ead..3e914309 100755 --- a/engine/server/library/serverGame/src/shared/core/ConfigServerGame.cpp +++ b/engine/server/library/serverGame/src/shared/core/ConfigServerGame.cpp @@ -52,7 +52,6 @@ void ConfigServerGame::install(void) KEY_INT (taskManagerPort, 60001); KEY_STRING (centralServerAddress, "localhost"); KEY_INT (centralServerPort, 44451); - KEY_STRING (javaVMName, ""); KEY_STRING (scriptPath, "../../data/sku.0/sys.server/compiled/game"); #if defined(WIN32) KEY_STRING (javaLibPath, "jvm.dll"); diff --git a/engine/server/library/serverGame/src/shared/core/ConfigServerGame.h b/engine/server/library/serverGame/src/shared/core/ConfigServerGame.h index da4c6271..fcd29f59 100755 --- a/engine/server/library/serverGame/src/shared/core/ConfigServerGame.h +++ b/engine/server/library/serverGame/src/shared/core/ConfigServerGame.h @@ -74,7 +74,6 @@ class ConfigServerGame int jediUpdateLocationTimeSeconds; // how long we wait before updating a Jedi's location in the Jedi manager // script data - const char * javaVMName; // the type of vm we are using const char * scriptPath; // location of scripts const char * javaLibPath; // location of jvm files const char * javaDebugPort; // ip port we connect to for remote debugging @@ -1210,13 +1209,6 @@ inline float ConfigServerGame::getInteriorTargetDurationFactor(void) } -//----------------------------------------------------------------------- - -inline const char * ConfigServerGame::getJavaVMName(void) -{ - return data->javaVMName; -} - //----------------------------------------------------------------------- inline const char * ConfigServerGame::getScriptPath(void) diff --git a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp index ec8fd7bb..e552efa3 100755 --- a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp +++ b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp @@ -56,10 +56,6 @@ using namespace JNIWrappersNamespace; #include #endif -#ifndef JNI_VERSION_1_4 -#error JNI version 1.4 or better only! -#endif - //======================================================================== // macros //======================================================================== @@ -1009,87 +1005,9 @@ void JavaLibrary::initializeJavaThread() return; } - const char *javaVMName = ConfigServerGame::getJavaVMName(); - if (javaVMName == nullptr || ( - strcmp(javaVMName, "none") != 0 && - strcmp(javaVMName, "ibm") != 0 && - strcmp(javaVMName, "sun") != 0 && - strcmp(javaVMName, "oracle") != 0)) - { - FATAL(true, ("[ServerGame] javaVMName not defined. Valid values are: " - "none, ibm, oracle, or sun")); - } - else if (strcmp(javaVMName, "ibm") == 0) - { - ms_javaVmType = JV_ibm; - } - else if (strcmp(javaVMName, "sun") == 0 || strcmp(javaVMName, "oracle") == 0) - { - ms_javaVmType = JV_sun; - } - - if (ms_javaVmType == JV_none) - { - DEBUG_REPORT_LOG(true, ("Scripting is disabled.\n")); - ms_loaded = -1; - return; - } - #ifdef linux - // get the default signal handler IGNORE_RETURN(sigaction(SIGSEGV, nullptr, &OrgSa)); - - if (ms_javaVmType == JV_ibm) - { - // check PATH to make sure that it has /usr/bin/java - const char * env = getenv("PATH"); - const char * bin = nullptr; - int envlen = 0; - if (env != nullptr) - { - bin = strstr(env, "/usr/java/bin"); - envlen = strlen(env); - } - - if (bin == nullptr) - { - WARNING(true, ("/usr/java/bin not found in PATH which is needed for IBM Java VM. Adding it now")); - char * tmpbuffer = new char[envlen + 128]; - if (env) - strcpy(tmpbuffer, env); - strcat(tmpbuffer, ":/usr/java/bin"); - setenv("PATH", tmpbuffer, 1); - delete [] tmpbuffer; - } - - // check LD_LIBRARY_PATH for /usr/java/jre/bin and /usr/java/jre/bin/classic - env = getenv("LD_LIBRARY_PATH"); - bin = nullptr; - envlen = 0; - const char * classic = nullptr; - if (env != nullptr) - { - bin = strstr(env, "/usr/java/jre/bin"); - classic = strstr(env, "/usr/java/jre/bin/classic"); - if (bin == classic && bin != nullptr) - bin = strstr(classic + 1, "/usr/java/jre/bin"); - envlen = strlen(env); - } - if (bin == nullptr || classic == nullptr) - { - WARNING(true, ("/usr/java/jre/bin or /usr/java/jre/bin/classic not found " - "in LD_LIBRARY_PATH, needed for IBM Java VM. Adding them both now.")); - char * tmpbuffer = new char[envlen + 256]; - memset(tmpbuffer, 0, envlen + 256); - if (env) - strcpy(tmpbuffer, env); - strcat(tmpbuffer, ":/usr/java/jre/bin"); - strcat(tmpbuffer, ":/usr/java/jre/bin/classic"); - setenv("LD_LIBRARY_PATH", tmpbuffer, 1); - delete [] tmpbuffer; - } - } #endif // linux // dynamically load the jni dll and JNI_CreateJavaVM @@ -1143,6 +1061,10 @@ void JavaLibrary::initializeJavaThread() UNREF(jdwpBuffer); + // always run java in server mode + tempOption.optionString = "-server"; + options.push_back(tempOption); + if (ConfigServerScript::hasJavaOptions()) { int const numberOfJavaOptions = ConfigServerScript::getNumberOfJavaOptions(); @@ -1153,119 +1075,74 @@ void JavaLibrary::initializeJavaThread() options.push_back(tempOption); } } - else + + // set up memory requirements + tempOption.optionString = "-Xms128m"; + options.push_back(tempOption); + + tempOption.optionString = "-Xmx512m"; + options.push_back(tempOption); + + tempOption.optionString = "-Xss768k"; + options.push_back(tempOption); + + // java 1.8 and higher uses metaspace...which is apparently unlimited by default + tempOption.optionString = "-XX:MetaspaceSize=64m"; + options.push_back(tempOption); + + tempOption.optionString = "-Xrs -XX:-UsePerfData -XX:+AllowUserSignalHandlers -XX:UseSSE=3 -XX+DoEscapeAnalysis -XX:AutoBoxCacheMax=1000 -XX:+OptimizeStringConcat -XX:+OptimizeFill -XX:+EliminateAutoBox -XX:+UseCompressedStrings -XX:UseCompressedOops -XX:+EliminateLocks -XX:UseFastAccessorMethods -XX:+UseStringCache"; + options.push_back(tempOption); + + if (ConfigServerGame::getUseJavaXcheck()) { - // set up memory requirements - tempOption.optionString = "-Xms128m"; + tempOption.optionString = "-Xcheck:jni"; options.push_back(tempOption); - tempOption.optionString = "-Xmx512m"; + } + + if (ConfigServerGame::getCompileScripts()) + { + tempOption.optionString = "-Xint"; options.push_back(tempOption); - tempOption.optionString = "-Xss768k"; + } + + if (ConfigServerGame::getUseVerboseJava()) + { + tempOption.optionString = "-verbose:jni"; options.push_back(tempOption); + tempOption.optionString = "-verbose:gc"; + options.push_back(tempOption); + tempOption.optionString = "-verbose:class"; + options.push_back(tempOption); + } - if (ms_javaVmType == JV_sun) - { - -// java 1.8 and higher uses metaspace...which is apparently unlimited by default -// and turn off perf counters as they crap up the tmp dir -#if defined(JNI_VERSION_1_8) || defined(JNI_VERSION_1_9) - tempOption.optionString = "-XX:MetaspaceSize=64m --XX:-UsePerfData"; - options.push_back(tempOption); -#endif - - tempOption.optionString = "-Xrs"; - options.push_back(tempOption); - - if (ConfigServerGame::getUseJavaXcheck()) - { - tempOption.optionString = "-Xcheck:jni"; - options.push_back(tempOption); - } - - if (ConfigServerGame::getCompileScripts()) - { - tempOption.optionString = "-Xint"; - options.push_back(tempOption); - } - } - else - { - tempOption.optionString = "-Xoss768k"; - options.push_back(tempOption); - tempOption.optionString = "-Xcheck:jni"; - options.push_back(tempOption); - tempOption.optionString = "-Xcheck:nabounds"; - options.push_back(tempOption); - tempOption.optionString = "-Xrs"; - options.push_back(tempOption); -#ifndef WIN32 - tempOption.optionString = "-Xgcpolicy:optavgpause"; - options.push_back(tempOption); -#endif - } - - if (ConfigServerGame::getUseVerboseJava()) - { - tempOption.optionString = "-verbose:jni"; - options.push_back(tempOption); - tempOption.optionString = "-verbose:gc"; - options.push_back(tempOption); - tempOption.optionString = "-verbose:class"; - options.push_back(tempOption); - } - - if (ConfigServerGame::getLogJavaGc()) - { - tempOption.optionString = "-Xloggc:javagc.log"; - options.push_back(tempOption); - } + if (ConfigServerGame::getLogJavaGc()) + { + tempOption.optionString = "-Xloggc:javagc.log"; + options.push_back(tempOption); + } #ifdef REMOTE_DEBUG_ON - char *jdwpBuffer = nullptr; - if (ConfigServerGame::getUseRemoteDebugJava()) + char *jdwpBuffer = nullptr; + if (ConfigServerGame::getUseRemoteDebugJava()) + { + tempOption.optionString = "-Xdebug"; + options.push_back(tempOption); + + // we need to copy the -Xrunjdwp parameter into a char buffer due to a bug + // in the Java VM + const char * jdwpString = "-Xrunjdwp:transport=dt_socket,server=y,suspend=n"; + jdwpBuffer = new char[strlen(jdwpString) + 32]; + strcpy(jdwpBuffer, jdwpString); + + if (ConfigServerGame::getJavaDebugPort()[0] == '\0') { - if (ms_javaVmType == JV_ibm) - { - tempOption.optionString = "-Xnoagent"; - options.push_back(tempOption); - tempOption.optionString = "-Djava.compiler=NONE"; - options.push_back(tempOption); - } - tempOption.optionString = "-Xdebug"; - options.push_back(tempOption); - - // we need to copy the -Xrunjdwp parameter into a char buffer due to a bug - // in the Java VM - const char * jdwpString = "-Xrunjdwp:transport=dt_socket,server=y,suspend=n"; - jdwpBuffer = new char[strlen(jdwpString) + 32]; - strcpy(jdwpBuffer, jdwpString); - - if (ConfigServerGame::getJavaDebugPort()[0] == '\0') - { - strcat(jdwpBuffer, ",address="); - strcat(jdwpBuffer, ConfigServerGame::getJavaDebugPort()); - } - tempOption.optionString = jdwpBuffer; - options.push_back(tempOption); - } -#endif // REMOTE_DEBUG_ON - - if (ConfigServerGame::getProfileScripts()) - { - if (ms_javaVmType == JV_ibm) - { - char profileBuffer[128]; - strcpy(profileBuffer,"-Xrunhprof:cpu=times"); - tempOption.optionString = profileBuffer; - options.push_back(tempOption); - } - else - { - WARNING(true, ("profileScripts option enabled using Sun JVM. This option " - "is only supported using the IBM JVM.")); - } + strcat(jdwpBuffer, ",address="); + strcat(jdwpBuffer, ConfigServerGame::getJavaDebugPort()); } + tempOption.optionString = jdwpBuffer; + options.push_back(tempOption); } +#endif // REMOTE_DEBUG_ON tempOption.optionString = const_cast(classPath.c_str()); options.push_back(tempOption); @@ -1282,26 +1159,6 @@ void JavaLibrary::initializeJavaThread() #define JNIVERSET = 1 #endif -#if !defined(JNIVERSET) && defined(JNI_VERSION_1_7) - vm_args.version = JNI_VERSION_1_7; -#define JNIVERSET = 1 -#endif - -#if !defined(JNIVERSET) && defined(JNI_VERSION_1_6) - vm_args.version = JNI_VERSION_1_6; -#define JNIVERSET = 1 -#endif - -#if !defined(JNIVERSET) && defined(JNI_VERSION_1_5) - vm_args.version = JNI_VERSION_1_5; -#define JNIVERSET = 1 -#endif - -#if !defined(JNIVERSET) && defined(JNI_VERSION_1_4) - vm_args.version = JNI_VERSION_1_4; -#define JNIVERSET = 1 -#endif - #ifdef JNIVERSET #undef JNIVERSET #else From 2c6da13d6105dae7c281ba13402bae057bc7b75e Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Tue, 19 Jul 2016 21:41:50 +0000 Subject: [PATCH 143/302] more drag ricing...but it works --- .../serverScript/src/shared/JavaLibrary.cpp | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp index e552efa3..b94a0c52 100755 --- a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp +++ b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp @@ -1061,10 +1061,8 @@ void JavaLibrary::initializeJavaThread() UNREF(jdwpBuffer); - // always run java in server mode - tempOption.optionString = "-server"; - options.push_back(tempOption); - + // append any config file specified options...our defaults below will override them + // as after testing i see them as sane defaults -darth if (ConfigServerScript::hasJavaOptions()) { int const numberOfJavaOptions = ConfigServerScript::getNumberOfJavaOptions(); @@ -1076,35 +1074,44 @@ void JavaLibrary::initializeJavaThread() } } - // set up memory requirements + // initial and minimum jvm allocation size tempOption.optionString = "-Xms128m"; options.push_back(tempOption); + // maximum jvm allocation - max 512m on 32-bit tempOption.optionString = "-Xmx512m"; options.push_back(tempOption); + // thread stack size, that is, size per thread tempOption.optionString = "-Xss768k"; options.push_back(tempOption); // java 1.8 and higher uses metaspace...which is apparently unlimited by default - tempOption.optionString = "-XX:MetaspaceSize=64m"; + // we have to consider it with our 512m max above so 96 on 32-bit is as high as we go + tempOption.optionString = "-XX:MaxMetaspaceSize=96m"; options.push_back(tempOption); - tempOption.optionString = "-Xrs -XX:-UsePerfData -XX:+AllowUserSignalHandlers -XX:UseSSE=3 -XX+DoEscapeAnalysis -XX:AutoBoxCacheMax=1000 -XX:+OptimizeStringConcat -XX:+OptimizeFill -XX:+EliminateAutoBox -XX:+UseCompressedStrings -XX:UseCompressedOops -XX:+EliminateLocks -XX:UseFastAccessorMethods -XX:+UseStringCache"; + // rice options!!!!1! yay - actually after much trial and error these are a good mix for speed and efficiency + // i should split these someday into separate optionStrings...or not + // some may be default, not needed, or ignored by whatever version we're using -darth + tempOption.optionString = "-Xrs -XX:-UsePerfData -XX:-AllowUserSignalHandlers -XX:UseSSE=3 -XX+DoEscapeAnalysis -XX:AutoBoxCacheMax:2000 -XX:+OptimizeStringConcat -XX:+OptimizeFill -XX:+EliminateAutoBox -XX:+UseCompressedStrings -XX:+UseCompressedOops -XX:+EliminateLocks -XX:UseFastAccessorMethods -XX:+UseStringCache -XgcPrio:throughput -XXkeepAreaRatio:1 -XXlazyUnlocking -XXcallProfiling -XXcompactRatio:1"; options.push_back(tempOption); + // left over from SOE, below...probably won't use these most of the time if (ConfigServerGame::getUseJavaXcheck()) { tempOption.optionString = "-Xcheck:jni"; options.push_back(tempOption); } + // if at all if (ConfigServerGame::getCompileScripts()) { tempOption.optionString = "-Xint"; options.push_back(tempOption); } + // ... if (ConfigServerGame::getUseVerboseJava()) { tempOption.optionString = "-verbose:jni"; @@ -1115,12 +1122,14 @@ void JavaLibrary::initializeJavaThread() options.push_back(tempOption); } + // not sure how logging GC runs is even useful personally if (ConfigServerGame::getLogJavaGc()) { tempOption.optionString = "-Xloggc:javagc.log"; options.push_back(tempOption); } +// never used it but this is actually a cool feature, if the crusty turd still works #ifdef REMOTE_DEBUG_ON char *jdwpBuffer = nullptr; if (ConfigServerGame::getUseRemoteDebugJava()) @@ -1149,6 +1158,7 @@ void JavaLibrary::initializeJavaThread() // TODO: this really sucks as the jvm won't start without the param // there's a dynamic method but requires the jvm to already be running, wtf? +// so we'll support the dev and stable versions #ifdef JNI_VERSION_1_9 vm_args.version = JNI_VERSION_1_9; #define JNIVERSET = 1 @@ -1189,6 +1199,7 @@ void JavaLibrary::initializeJavaThread() } ms_loaded = 1; + // i don't think this bit functions anymore with new java? if (ConfigServerGame::getTrapScriptCrashes()) { //set up signal handler for fatals in linux @@ -1202,7 +1213,7 @@ void JavaLibrary::initializeJavaThread() ms_shutdownJava->wait(); // clean up - IGNORE_RETURN(ms_jvm->DestroyJavaVM()); + IGNORE_RETURN(ms_jvm->DestroyJavaVM()); // yeah, screw it, l ms_jvm = nullptr; if (ConfigServerGame::getTrapScriptCrashes()) From d17f0c88d6c8b553ca2b7793fd01772c077504ad Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Tue, 19 Jul 2016 22:08:42 +0000 Subject: [PATCH 144/302] symlink optionally --- cmake/linux/FindJNI.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/linux/FindJNI.cmake b/cmake/linux/FindJNI.cmake index fc15c9cc..57e63e3b 100644 --- a/cmake/linux/FindJNI.cmake +++ b/cmake/linux/FindJNI.cmake @@ -181,6 +181,7 @@ set(JAVA_AWT_INCLUDE_DIRECTORIES /usr/lib/jvm/java-8-oracle/include /usr/lib/jvm/java-7-oracle/include /usr/lib/jvm/java-6-oracle/include + /opt/java/include ) foreach(JAVA_PROG "${JAVA_RUNTIME}" "${JAVA_COMPILE}" "${JAVA_ARCHIVE}") From 6619817e2442a82a58bbda913e91cab979bf64cc Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Wed, 20 Jul 2016 16:04:53 +0000 Subject: [PATCH 145/302] give java a chance to end it's miserable existence --- .../serverScript/src/shared/JavaLibrary.cpp | 39 +------------------ 1 file changed, 2 insertions(+), 37 deletions(-) diff --git a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp index b94a0c52..588bbbff 100755 --- a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp +++ b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp @@ -1046,10 +1046,6 @@ void JavaLibrary::initializeJavaThread() return; } -#if defined(_DEBUG) //&& defined(linux) -#define REMOTE_DEBUG_ON -#endif - // set up the args to initialize the jvm std::string classPath = "-Djava.class.path="; classPath += ConfigServerGame::getScriptPath(); @@ -1129,30 +1125,6 @@ void JavaLibrary::initializeJavaThread() options.push_back(tempOption); } -// never used it but this is actually a cool feature, if the crusty turd still works -#ifdef REMOTE_DEBUG_ON - char *jdwpBuffer = nullptr; - if (ConfigServerGame::getUseRemoteDebugJava()) - { - tempOption.optionString = "-Xdebug"; - options.push_back(tempOption); - - // we need to copy the -Xrunjdwp parameter into a char buffer due to a bug - // in the Java VM - const char * jdwpString = "-Xrunjdwp:transport=dt_socket,server=y,suspend=n"; - jdwpBuffer = new char[strlen(jdwpString) + 32]; - strcpy(jdwpBuffer, jdwpString); - - if (ConfigServerGame::getJavaDebugPort()[0] == '\0') - { - strcat(jdwpBuffer, ",address="); - strcat(jdwpBuffer, ConfigServerGame::getJavaDebugPort()); - } - tempOption.optionString = jdwpBuffer; - options.push_back(tempOption); - } -#endif // REMOTE_DEBUG_ON - tempOption.optionString = const_cast(classPath.c_str()); options.push_back(tempOption); @@ -1183,14 +1155,6 @@ void JavaLibrary::initializeJavaThread() JNIEnv * env = nullptr; jint result = (*JNI_CreateJavaVMProc)(&ms_jvm, reinterpret_cast(&env), &vm_args); -#ifdef REMOTE_DEBUG_ON - if (jdwpBuffer != nullptr) - { - delete[] jdwpBuffer; - jdwpBuffer = nullptr; - } -#endif - if (result != 0) { FATAL (true, ("Failed to CreateJavaVMProc: %d", result)); @@ -1213,7 +1177,8 @@ void JavaLibrary::initializeJavaThread() ms_shutdownJava->wait(); // clean up - IGNORE_RETURN(ms_jvm->DestroyJavaVM()); // yeah, screw it, l + ms_jvm->DestroyJavaVM(); + Os::sleep(1000); // give java a chance to end it's miserable existence ms_jvm = nullptr; if (ConfigServerGame::getTrapScriptCrashes()) From 12633ce384bdaffd30c816a232b6f157a265d1e0 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Wed, 20 Jul 2016 16:09:10 +0000 Subject: [PATCH 146/302] don't preload by default --- .../library/serverGame/src/shared/core/ConfigServerGame.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/server/library/serverGame/src/shared/core/ConfigServerGame.cpp b/engine/server/library/serverGame/src/shared/core/ConfigServerGame.cpp index 3e914309..503d7681 100755 --- a/engine/server/library/serverGame/src/shared/core/ConfigServerGame.cpp +++ b/engine/server/library/serverGame/src/shared/core/ConfigServerGame.cpp @@ -255,8 +255,8 @@ void ConfigServerGame::install(void) KEY_INT (maxGalacticReserveDepositBillion, 3); // 3 billion KEY_INT (maxMoneyTransfer, 100000000); // 100 million KEY_INT (maxFreeTrialMoney, 50000); //50k credits limited to demo customers - KEY_BOOL (enablePreload, true); - KEY_BOOL (buildPreloadLists, true); + KEY_BOOL (enablePreload, false); + KEY_BOOL (buildPreloadLists, false); KEY_BOOL (logAuthTransfer, false); KEY_INT (overrideUpdateRadius, 0); From fd56145248d7967d563c2a3e26b0bec2081876b2 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Fri, 22 Jul 2016 15:01:38 +0000 Subject: [PATCH 147/302] give it a little more time --- engine/server/library/serverScript/src/shared/JavaLibrary.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp index 588bbbff..52c11b4d 100755 --- a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp +++ b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp @@ -1178,7 +1178,7 @@ void JavaLibrary::initializeJavaThread() // clean up ms_jvm->DestroyJavaVM(); - Os::sleep(1000); // give java a chance to end it's miserable existence + Os::sleep(2000); // give java a chance to end it's miserable existence ms_jvm = nullptr; if (ConfigServerGame::getTrapScriptCrashes()) From efaaa4bb42dacdd23ca727fd3b7c283a868b5493 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sat, 23 Jul 2016 18:00:40 -0700 Subject: [PATCH 148/302] readd some win32 files so that we can more easily run static analyzers that are windows only against the source --- .../application/Miff/src/win32/BISON.HAI | 334 ++++++ .../Miff/src/win32/InputFileHandler.cpp | 136 +++ .../Miff/src/win32/InputFileHandler.h | 71 ++ .../Miff/src/win32/OutputFileHandler.cpp | 164 +++ .../Miff/src/win32/OutputFileHandler.h | 80 ++ .../application/Miff/src/win32/bison.simple | 698 ++++++++++++ .../application/Miff/src/win32/mIFF.dox | 62 + .../application/Miff/src/win32/miff.cpp | 961 ++++++++++++++++ .../application/Miff/src/win32/parser.lex | 517 +++++++++ .../application/Miff/src/win32/parser.yac | 1004 +++++++++++++++++ .../src/win32/FirstCentralServer.cpp | 5 + .../CentralServer/src/win32/WinMain.cpp | 84 ++ .../ChatServer/src/win32/WinMain.cpp | 42 + .../src/win32/FirstConnectionServer.cpp | 1 + .../ConnectionServer/src/win32/WinMain.cpp | 58 + .../src/win32/LoggingServerApiWrapper.cpp | 16 + .../LogServer/src/win32/WinMain.cpp | 55 + .../src/win32/FirstLoginServer.cpp | 1 + .../LoginServer/src/win32/WinMain.cpp | 46 + .../MetricsServer/src/win32/WinMain.cpp | 91 ++ .../src/win32/FirstPlanetServer.cpp | 8 + .../PlanetServer/src/win32/WinMain.cpp | 67 ++ .../ServerConsole/src/win32/main.cpp | 59 + .../TaskManager/src/win32/ConsoleInput.cpp | 22 + .../src/win32/EnvironmentVariable.cpp | 33 + .../TaskManager/src/win32/ProcessSpawner.cpp | 153 +++ .../src/win32/TaskManagerSysInfo.cpp | 147 +++ .../TaskManager/src/win32/WinMain.cpp | 50 + 28 files changed, 4965 insertions(+) create mode 100644 engine/client/application/Miff/src/win32/BISON.HAI create mode 100644 engine/client/application/Miff/src/win32/InputFileHandler.cpp create mode 100644 engine/client/application/Miff/src/win32/InputFileHandler.h create mode 100644 engine/client/application/Miff/src/win32/OutputFileHandler.cpp create mode 100644 engine/client/application/Miff/src/win32/OutputFileHandler.h create mode 100644 engine/client/application/Miff/src/win32/bison.simple create mode 100644 engine/client/application/Miff/src/win32/mIFF.dox create mode 100644 engine/client/application/Miff/src/win32/miff.cpp create mode 100644 engine/client/application/Miff/src/win32/parser.lex create mode 100644 engine/client/application/Miff/src/win32/parser.yac create mode 100644 engine/server/application/CentralServer/src/win32/FirstCentralServer.cpp create mode 100644 engine/server/application/CentralServer/src/win32/WinMain.cpp create mode 100644 engine/server/application/ChatServer/src/win32/WinMain.cpp create mode 100644 engine/server/application/ConnectionServer/src/win32/FirstConnectionServer.cpp create mode 100644 engine/server/application/ConnectionServer/src/win32/WinMain.cpp create mode 100644 engine/server/application/LogServer/src/win32/LoggingServerApiWrapper.cpp create mode 100644 engine/server/application/LogServer/src/win32/WinMain.cpp create mode 100644 engine/server/application/LoginServer/src/win32/FirstLoginServer.cpp create mode 100644 engine/server/application/LoginServer/src/win32/WinMain.cpp create mode 100644 engine/server/application/MetricsServer/src/win32/WinMain.cpp create mode 100644 engine/server/application/PlanetServer/src/win32/FirstPlanetServer.cpp create mode 100644 engine/server/application/PlanetServer/src/win32/WinMain.cpp create mode 100644 engine/server/application/ServerConsole/src/win32/main.cpp create mode 100644 engine/server/application/TaskManager/src/win32/ConsoleInput.cpp create mode 100644 engine/server/application/TaskManager/src/win32/EnvironmentVariable.cpp create mode 100644 engine/server/application/TaskManager/src/win32/ProcessSpawner.cpp create mode 100644 engine/server/application/TaskManager/src/win32/TaskManagerSysInfo.cpp create mode 100644 engine/server/application/TaskManager/src/win32/WinMain.cpp diff --git a/engine/client/application/Miff/src/win32/BISON.HAI b/engine/client/application/Miff/src/win32/BISON.HAI new file mode 100644 index 00000000..999b5559 --- /dev/null +++ b/engine/client/application/Miff/src/win32/BISON.HAI @@ -0,0 +1,334 @@ + +extern int timeclock; + + +int yyerror; /* Yyerror and yycost are set by guards. */ +int yycost; /* If yyerror is set to a nonzero value by a */ + /* guard, the reduction with which the guard */ + /* is associated is not performed, and the */ + /* error recovery mechanism is invoked. */ + /* Yycost indicates the cost of performing */ + /* the reduction given the attributes of the */ + /* symbols. */ + + +/* YYMAXDEPTH indicates the size of the parser's state and value */ +/* stacks. */ + +#ifndef YYMAXDEPTH +#define YYMAXDEPTH 500 +#endif + +/* YYMAXRULES must be at least as large as the number of rules that */ +/* could be placed in the rule queue. That number could be determined */ +/* from the grammar and the size of the stack, but, as yet, it is not. */ + +#ifndef YYMAXRULES +#define YYMAXRULES 100 +#endif + +#ifndef YYMAXBACKUP +#define YYMAXBACKUP 100 +#endif + + +short yyss[YYMAXDEPTH]; /* the state stack */ +YYSTYPE yyvs[YYMAXDEPTH]; /* the semantic value stack */ +YYLTYPE yyls[YYMAXDEPTH]; /* the location stack */ +short yyrq[YYMAXRULES]; /* the rule queue */ +int yychar; /* the lookahead symbol */ + +YYSTYPE yylval; /* the semantic value of the */ + /* lookahead symbol */ + +YYSTYPE yytval; /* the semantic value for the state */ + /* at the top of the state stack. */ + +YYSTYPE yyval; /* the variable used to return */ + /* semantic values from the action */ + /* routines */ + +YYLTYPE yylloc; /* location data for the lookahead */ + /* symbol */ + +YYLTYPE yytloc; /* location data for the state at the */ + /* top of the state stack */ + + +int yynunlexed; +short yyunchar[YYMAXBACKUP]; +YYSTYPE yyunval[YYMAXBACKUP]; +YYLTYPE yyunloc[YYMAXBACKUP]; + +short *yygssp; /* a pointer to the top of the state */ + /* stack; only set during error */ + /* recovery. */ + +YYSTYPE *yygvsp; /* a pointer to the top of the value */ + /* stack; only set during error */ + /* recovery. */ + +YYLTYPE *yyglsp; /* a pointer to the top of the */ + /* location stack; only set during */ + /* error recovery. */ + + +/* Yyget is an interface between the parser and the lexical analyzer. */ +/* It is costly to provide such an interface, but it avoids requiring */ +/* the lexical analyzer to be able to back up the scan. */ + +yyget() +{ + if (yynunlexed > 0) + { + yynunlexed--; + yychar = yyunchar[yynunlexed]; + yylval = yyunval[yynunlexed]; + yylloc = yyunloc[yynunlexed]; + } + else if (yychar <= 0) + yychar = 0; + else + { + yychar = yylex(); + if (yychar < 0) + yychar = 0; + else yychar = YYTRANSLATE(yychar); + } +} + + + +yyunlex(chr, val, loc) +int chr; +YYSTYPE val; +YYLTYPE loc; +{ + yyunchar[yynunlexed] = chr; + yyunval[yynunlexed] = val; + yyunloc[yynunlexed] = loc; + yynunlexed++; +} + + + +yyrestore(first, last) +register short *first; +register short *last; +{ + register short *ssp; + register short *rp; + register int symbol; + register int state; + register int tvalsaved; + + ssp = yygssp; + yyunlex(yychar, yylval, yylloc); + + tvalsaved = 0; + while (first != last) + { + symbol = yystos[*ssp]; + if (symbol < YYNTBASE) + { + yyunlex(symbol, yytval, yytloc); + tvalsaved = 1; + ssp--; + } + + ssp--; + + if (first == yyrq) + first = yyrq + YYMAXRULES; + + first--; + + for (rp = yyrhs + yyprhs[*first]; symbol = *rp; rp++) + { + if (symbol < YYNTBASE) + state = yytable[yypact[*ssp] + symbol]; + else + { + state = yypgoto[symbol - YYNTBASE] + *ssp; + + if (state >= 0 && state <= YYLAST && yycheck[state] == *ssp) + state = yytable[state]; + else + state = yydefgoto[symbol - YYNTBASE]; + } + + *++ssp = state; + } + } + + if ( ! tvalsaved && ssp > yyss) + { + yyunlex(yystos[*ssp], yytval, yytloc); + ssp--; + } + + yygssp = ssp; +} + + + +int +yyparse() +{ + register int yystate; + register int yyn; + register short *yyssp; + register short *yyrq0; + register short *yyptr; + register YYSTYPE *yyvsp; + + int yylen; + YYLTYPE *yylsp; + short *yyrq1; + short *yyrq2; + + yystate = 0; + yyssp = yyss - 1; + yyvsp = yyvs - 1; + yylsp = yyls - 1; + yyrq0 = yyrq; + yyrq1 = yyrq0; + yyrq2 = yyrq0; + + yychar = yylex(); + if (yychar < 0) + yychar = 0; + else yychar = YYTRANSLATE(yychar); + +yynewstate: + + if (yyssp >= yyss + YYMAXDEPTH - 1) + { + yyabort("Parser Stack Overflow"); + YYABORT; + } + + *++yyssp = yystate; + +yyresume: + + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yydefault; + + yyn += yychar; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar) + goto yydefault; + + yyn = yytable[yyn]; + if (yyn < 0) + { + yyn = -yyn; + goto yyreduce; + } + else if (yyn == 0) + goto yyerrlab; + + yystate = yyn; + + yyptr = yyrq2; + while (yyptr != yyrq1) + { + yyn = *yyptr++; + yylen = yyr2[yyn]; + yyvsp -= yylen; + yylsp -= yylen; + + yyguard(yyn, yyvsp, yylsp); + if (yyerror) + goto yysemerr; + + yyaction(yyn, yyvsp, yylsp); + *++yyvsp = yyval; + + yylsp++; + if (yylen == 0) + { + yylsp->timestamp = timeclock; + yylsp->first_line = yytloc.first_line; + yylsp->first_column = yytloc.first_column; + yylsp->last_line = (yylsp-1)->last_line; + yylsp->last_column = (yylsp-1)->last_column; + yylsp->text = 0; + } + else + { + yylsp->last_line = (yylsp+yylen-1)->last_line; + yylsp->last_column = (yylsp+yylen-1)->last_column; + } + + if (yyptr == yyrq + YYMAXRULES) + yyptr = yyrq; + } + + if (yystate == YYFINAL) + YYACCEPT; + + yyrq2 = yyptr; + yyrq1 = yyrq0; + + *++yyvsp = yytval; + *++yylsp = yytloc; + yytval = yylval; + yytloc = yylloc; + yyget(); + + goto yynewstate; + +yydefault: + + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + +yyreduce: + + *yyrq0++ = yyn; + + if (yyrq0 == yyrq + YYMAXRULES) + yyrq0 = yyrq; + + if (yyrq0 == yyrq2) + { + yyabort("Parser Rule Queue Overflow"); + YYABORT; + } + + yyssp -= yyr2[yyn]; + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTBASE] + *yyssp; + if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTBASE]; + + goto yynewstate; + +yysemerr: + *--yyptr = yyn; + yyrq2 = yyptr; + yyvsp += yyr2[yyn]; + +yyerrlab: + + yygssp = yyssp; + yygvsp = yyvsp; + yyglsp = yylsp; + yyrestore(yyrq0, yyrq2); + yyrecover(); + yystate = *yygssp; + yyssp = yygssp; + yyvsp = yygvsp; + yyrq0 = yyrq; + yyrq1 = yyrq0; + yyrq2 = yyrq0; + goto yyresume; +} + +$ diff --git a/engine/client/application/Miff/src/win32/InputFileHandler.cpp b/engine/client/application/Miff/src/win32/InputFileHandler.cpp new file mode 100644 index 00000000..b782e0cf --- /dev/null +++ b/engine/client/application/Miff/src/win32/InputFileHandler.cpp @@ -0,0 +1,136 @@ +//=========================================================================== +// +// FILENAME: InputFileHandler.cpp [C:\Projects\new\tools\src\miff\src\] +// COPYRIGHT: (C) 1999 BY Bootprint Entertainment +// +// DESCRIPTION: file handler for input files (standard flat text files) +// AUTHOR: Hideki Ikeda +// DATE: 1/13/99 4:53:31 PM +// +// HISTORY: 1/13/99 [HAI] - File created +// : +// +// FUNCTION: InputFileHandler() constructor +// : ~InputFileHandler() destructor +// : +// +//=========================================================================== + +//========================================================== include files == +#include "sharedFoundation/FirstSharedFoundation.h" +#include "InputFileHandler.h" + +#include "sharedFile/TreeFile.h" +//#include "sharedFile/Iff.h" + +//================================================= static vars assignment == + + + +//--------------------------------------------------------------------------- +// Constructor +// +// Remarks: +// +// +// See Also: +// +// +// Revisions and History: +// 1/13/99 [HAI] - created +// +InputFileHandler::InputFileHandler(const char *infilename) +{ + TreeFile::addSearchAbsolute(0); // search current working directory + + file = TreeFile::open(infilename, AbstractFile::PriorityData, true); + +} + + +//--------------------------------------------------------------------------- +// Destructor +// +// Remarks: +// +// +// See Also: +// +// +// Revisions and History: +// 1/13/99 [HAI] - created +// +InputFileHandler::~InputFileHandler(void) +{ + if(file) + delete file; +} + + +//--------------------------------------------------------------------------- +// reads a file stream into specified buffer of the size passed +// +// Return Value: +// actual size read (signed int) +// +// Remarks: +// +// +// See Also: +// Treefile::read() +// +// Revisions and History: +// 1/13/99 [HAI] - created +// +const int InputFileHandler::read( + void *sourceBuffer, // pointer to the buffer + int bufferSize // number of BYTES to be read + ) +{ + int retVal = -1; // assume fileHandle is NOT valid + + if (file) + retVal = file->read(sourceBuffer, bufferSize); + + return(retVal); +} + +//--------------------------------------------------------------------------- +// Deletes a file +// +// Return Value: +// whatever DeleteFile() returns +// if fileHandle != -1, it assumes that the fileHandle passed belonged to +// this filename, and therefore, it will attempt to close the file and +// set it to 0. +// +// Remarks: +// calls DeleteFile() found in windows.h +// InputFileHandler does NOT have any way to validate that the handle +// passed belongs to the filename that it wants to be deleted. So use +// it with caution +// +// See Also: +// windows.h +// +// Revisions and History: +// 1/13/99 [HAI] - created +// +int InputFileHandler::deleteFile( + const char *filename, + bool deleteHandleFlag + ) +{ + if (deleteHandleFlag && file) + { + delete file; + file = NULL; + } + return(DeleteFile(filename)); +} + + +//=========================================================================== +//============================================================ End-of-file == +//=========================================================================== + diff --git a/engine/client/application/Miff/src/win32/InputFileHandler.h b/engine/client/application/Miff/src/win32/InputFileHandler.h new file mode 100644 index 00000000..9e4734fe --- /dev/null +++ b/engine/client/application/Miff/src/win32/InputFileHandler.h @@ -0,0 +1,71 @@ +#ifndef __INPUTFILEHANDLER_H__ +#define __INPUTFILEHANDLER_H__ + +//=========================================================================== +// +// FILENAME: InputFileHandler.h [C:\Projects\new\tools\src\miff\src\] +// COPYRIGHT: (C) 1999 BY Bootprint Entertainment +// +// DESCRIPTION: file handler for input files (flat text files) +// AUTHOR: Hideki Ikeda +// DATE: 1/13/99 4:55:15 PM +// +// HISTORY: 1/13/99 [HAI] - File created +// : +// +//=========================================================================== + +//============================================================== #includes == + +//========================================================= class typedefs == + +//====================================================== class definitions == + +class AbstractFile; + +class InputFileHandler +{ +//------------------------------ +//--- public var & functions --- +//------------------------------ +public: // functions + InputFileHandler(const char *infilename); + ~InputFileHandler(void); + + const int read(void *sourceBuffer, int bufferSize); + int deleteFile(const char * filename, bool deleteHandleFlag = false); + +public: // vars + + + //------------------------------- + //--- member vars declaration --- + //------------------------------- +protected: // vars + AbstractFile *file; + +private: // vars + + //----------------------------------- + //--- member function declaration --- + //----------------------------------- +protected: // functions + +private: // functions + void close(void); // close the input file called by destructor + +}; + +//=========================================================================== +//========================================================= inline methods == +//=========================================================================== + + +//=========================================================================== +//============================================================ End-of-file == +//=========================================================================== +#else + #ifdef DEBUG + #pragma message("InputFileHandler.h included more then once!") + #endif +#endif // ifndef __H__ diff --git a/engine/client/application/Miff/src/win32/OutputFileHandler.cpp b/engine/client/application/Miff/src/win32/OutputFileHandler.cpp new file mode 100644 index 00000000..1c8ffe96 --- /dev/null +++ b/engine/client/application/Miff/src/win32/OutputFileHandler.cpp @@ -0,0 +1,164 @@ +//=========================================================================== +// +// FILENAME: OutputFileHandler.cpp +// COPYRIGHT: (C) 1999 BY Bootprint Entertainment +// +// DESCRIPTION: file handler for Output file (IFF file) +// AUTHOR: Hideki Ikeda +// DATE: 1/13/99 4:52:42 PM +// +//=========================================================================== + +#include "sharedFoundation/FirstSharedFoundation.h" +#include "OutputFileHandler.h" + +#include "sharedFile/Iff.h" + +//=========================================================================== +// Constructor + +OutputFileHandler::OutputFileHandler(const char *filename) +{ + outputIFF = new Iff(MAXIFFDATASIZE); + outFilename = NULL; + + setCurrentFilename(filename); +} + +void OutputFileHandler::setCurrentFilename(const char *filename) +{ + if (outFilename) + delete [] outFilename; + + outFilename = new char[strlen(filename)+1]; + strcpy(outFilename, filename); +} + +//--------------------------------------------------------------------------- +// Destructor + +OutputFileHandler::~OutputFileHandler(void) +{ + if (outputIFF && outFilename) + { + delete outputIFF; + delete [] outFilename; + } + + outputIFF = NULL; +} + + +//--------------------------------------------------------------------------- +// begins a new FORM in the IFF +// +// Return Value: +// bool - true == success +// +// See Also: +// Iff::insertForm() + +void OutputFileHandler::insertForm( + const char *tag + ) +{ + Tag formTag = convertStrToTag(tag); + outputIFF->insertForm(formTag); +} + +//--------------------------------------------------------------------------- +// begins a new CHUNK in the IFF +// +// See Also: +// Iff::insertChunk() + +void OutputFileHandler::insertChunk( + const char *tag + ) +{ + Tag chunkTag = convertStrToTag(tag); + outputIFF->insertChunk(chunkTag); +} + + +//--------------------------------------------------------------------------- +// converts string (4 bytes) form into Tag format +// +// Return Value: +// Tag +// +// Remarks: +// currently, this code is machine dependant code (non portable) and it assumes little endian +// +// See Also: +// Tag + +Tag OutputFileHandler::convertStrToTag( + const char *str + ) +{ + // prepare for hack-o-rama. It is byte order dependant, thus not portable ^_^ + Tag retVal = str[3] + (str[2] * 0x100) + (str[1] * 0x10000) + (str[0] * 0x1000000); + + return(retVal); +} + + +//--------------------------------------------------------------------------- +// adds new chunk data into the current chunk it is in +// +// See Also: +// Iff::insertChunkData() +// + +void OutputFileHandler::insertChunkData( + void *data, + int length + ) +{ + outputIFF->insertChunkData(data, length); +} + +//--------------------------------------------------------------------------- +// exits current FORM section we are in +// +// See Also: +// Iff::exitForm() + +void OutputFileHandler::exitForm(void) +{ + outputIFF->exitForm(); +} + +//--------------------------------------------------------------------------- +// exits current CHUNK we are in +// +// See Also: +// Iff::exitChunk() + +void OutputFileHandler::exitChunk(void) +{ + outputIFF->exitChunk(); +} + + +//--------------------------------------------------------------------------- +// Calls Iff:write() +// +// Return Value: +// +// True if the Iff was successfully written, otherwise false +// +// See Also: +// Iff::write() + +bool OutputFileHandler::writeBuffer(void) +{ + if (outputIFF && outFilename) + return outputIFF->write(outFilename, true); + + return false; +} + +//=========================================================================== + diff --git a/engine/client/application/Miff/src/win32/OutputFileHandler.h b/engine/client/application/Miff/src/win32/OutputFileHandler.h new file mode 100644 index 00000000..5f4eaf58 --- /dev/null +++ b/engine/client/application/Miff/src/win32/OutputFileHandler.h @@ -0,0 +1,80 @@ +#ifndef __OUTPUTFILEHANDLER_H__ +#define __OUTPUTFILEHANDLER_H__ + +//=========================================================================== +// +// FILENAME: OutputFileHandler.h [C:\Projects\new\tools\src\miff\src\] +// COPYRIGHT: (C) 1999 BY Bootprint Entertainment +// +// DESCRIPTION: file handler for output files (IFF file format) +// AUTHOR: Hideki Ikeda +// DATE: 1/13/99 4:55:56 PM +// +// HISTORY: 1/13/99 [HAI] - File created +// : +// +//=========================================================================== + +//============================================================== #includes == + +//========================================================= class typedefs == +#include "sharedFile/Iff.h" + +//====================================================== class definitions == +class OutputFileHandler +{ +//------------------------------ +//--- public var & functions --- +//------------------------------ +public: // functions + OutputFileHandler(const char *filename); + ~OutputFileHandler(void); + bool writeBuffer(void); + + void insertForm(const char *tagName); + void insertChunk(const char *tagName); + void insertChunkData(void *data, int length); + void exitForm(void); + void exitChunk(void); + + void setCurrentFilename(const char *fname); + +public: // vars + + + //------------------------------- + //--- member vars declaration --- + //------------------------------- +protected: // vars + Iff * outputIFF; + char *outFilename; + +enum{ + MAXIFFDATASIZE = 8192 // allocate 8K of memory for a starter + }; + +private: // vars + + //----------------------------------- + //--- member function declaration --- + //----------------------------------- +protected: // functions + +private: // functions + Tag convertStrToTag(const char *str); + +}; + +//=========================================================================== +//========================================================= inline methods == +//=========================================================================== + + +//=========================================================================== +//============================================================ End-of-file == +//=========================================================================== +#else + #ifdef DEBUG + #pragma message("OutputFileHandler.h included more then once!") + #endif +#endif // ifndef __H__ diff --git a/engine/client/application/Miff/src/win32/bison.simple b/engine/client/application/Miff/src/win32/bison.simple new file mode 100644 index 00000000..5f8f386e --- /dev/null +++ b/engine/client/application/Miff/src/win32/bison.simple @@ -0,0 +1,698 @@ +/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ +#line 3 "bison.simple" + +/* Skeleton output parser for bison, + Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* As a special exception, when this file is copied by Bison into a + Bison output file, you may use that output file without restriction. + This special exception was added by the Free Software Foundation + in version 1.24 of Bison. */ + +#define MSDOS 1 + +#ifndef alloca +#ifdef __GNUC__ +#define alloca __builtin_alloca +#else /* not GNU C. */ +#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) +#include +#else /* not sparc */ +#if defined (MSDOS) && !defined (__TURBOC__) +#include +#else /* not MSDOS, or __TURBOC__ */ +#if defined(_AIX) +#include + #pragma alloca +#else /* not MSDOS, __TURBOC__, or _AIX */ +#ifdef __hpux +#ifdef __cplusplus +extern "C" { +void *alloca (unsigned int); +}; +#else /* not __cplusplus */ +void *alloca (); +#endif /* not __cplusplus */ +#endif /* __hpux */ +#endif /* not _AIX */ +#endif /* not MSDOS, or __TURBOC__ */ +#endif /* not sparc. */ +#endif /* not GNU C. */ +#endif /* alloca not defined. */ + +#ifdef MSDOS +#define alloca(n) malloc(n) +#endif + +/* This is the parser code that is written into each bison parser + when the %semantic_parser declaration is not specified in the grammar. + It was written by Richard Stallman by simplifying the hairy parser + used when %semantic_parser is specified. */ + +/* Note: there must be only one dollar sign in this file. + It is replaced by the list of actions, each action + as one case of the switch. */ + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY -2 +#define YYEOF 0 +#define YYACCEPT return(0) +#define YYABORT return(1) +#define YYERROR goto yyerrlab1 +/* Like YYERROR except do call yyerror. + This remains here temporarily to ease the + transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. */ +#define YYFAIL goto yyerrlab +#define YYRECOVERING() (!!yyerrstatus) +#define YYBACKUP(token, value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { yychar = (token), yylval = (value); \ + yychar1 = YYTRANSLATE (yychar); \ + YYPOPSTACK; \ + goto yybackup; \ + } \ + else \ + { yyerror ("syntax error: cannot back up"); YYERROR; } \ +while (0) + +#define YYTERROR 1 +#define YYERRCODE 256 + +#ifndef YYPURE +#define YYLEX yylex() +#endif + +#ifdef YYPURE +#ifdef YYLSP_NEEDED +#ifdef YYLEX_PARAM +#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) +#else +#define YYLEX yylex(&yylval, &yylloc) +#endif +#else /* not YYLSP_NEEDED */ +#ifdef YYLEX_PARAM +#define YYLEX yylex(&yylval, YYLEX_PARAM) +#else +#define YYLEX yylex(&yylval) +#endif +#endif /* not YYLSP_NEEDED */ +#endif + +/* If nonreentrant, generate the variables here */ + +#ifndef YYPURE + +int yychar; /* the lookahead symbol */ +YYSTYPE yylval; /* the semantic value of the */ + /* lookahead symbol */ + +#ifdef YYLSP_NEEDED +YYLTYPE yylloc; /* location data for the lookahead */ + /* symbol */ +#endif + +int yynerrs; /* number of parse errors so far */ +#endif /* not YYPURE */ + +#if YYDEBUG != 0 +int yydebug = 1; /* nonzero means print parse trace */ +/* Since this is uninitialized, it does not stop multiple parsers + from coexisting. */ +#endif + +/* YYINITDEPTH indicates the initial size of the parser's stacks */ + +#ifndef YYINITDEPTH +#define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH is the maximum size the stacks can grow to + (effective only if the built-in stack extension method is used). */ + +#if YYMAXDEPTH == 0 +#undef YYMAXDEPTH +#endif + +#ifndef YYMAXDEPTH +#define YYMAXDEPTH 10000 +#endif + +/* Prevent warning if -Wstrict-prototypes. */ +#ifdef __GNUC__ +int yyparse (void); +#endif + +#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ +#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) +#else /* not GNU C or C++ */ +#ifndef __cplusplus + +/* This is the most reliable way to avoid incompatibilities + in available built-in functions on various systems. */ +static void +__yy_memcpy (to, from, count) + char *to; + char *from; + int count; +{ + register char *f = from; + register char *t = to; + register int i = count; + + while (i-- > 0) + *t++ = *f++; +} + +#else /* __cplusplus */ + +/* This is the most reliable way to avoid incompatibilities + in available built-in functions on various systems. */ +static void +__yy_memcpy (char *to, char *from, int count) +{ + register char *f = from; + register char *t = to; + register int i = count; + + while (i-- > 0) + *t++ = *f++; +} + +#endif +#endif + +#line 196 "bison.simple" + +/* The user can define YYPARSE_PARAM as the name of an argument to be passed + into yyparse. The argument should have type void *. + It should actually point to an object. + Grammar actions can access the variable by casting it + to the proper pointer type. */ + +#ifdef YYPARSE_PARAM +#ifdef __cplusplus +#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM +#define YYPARSE_PARAM_DECL +#else /* not __cplusplus */ +#define YYPARSE_PARAM_ARG YYPARSE_PARAM +#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; +#endif /* not __cplusplus */ +#else /* not YYPARSE_PARAM */ +#define YYPARSE_PARAM_ARG +#define YYPARSE_PARAM_DECL +#endif /* not YYPARSE_PARAM */ + +int +yyparse(YYPARSE_PARAM_ARG) + YYPARSE_PARAM_DECL +{ + register int yystate; + register int yyn; + register short *yyssp; + register YYSTYPE *yyvsp; + int yyerrstatus; /* number of tokens to shift before error messages enabled */ + int yychar1 = 0; /* lookahead token as an internal (translated) token number */ + + short yyssa[YYINITDEPTH]; /* the state stack */ + YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ + + short *yyss = yyssa; /* refer to the stacks thru separate pointers */ + YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ + +#ifdef YYLSP_NEEDED + YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ + YYLTYPE *yyls = yylsa; + YYLTYPE *yylsp; + +#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) +#else +#define YYPOPSTACK (yyvsp--, yyssp--) +#endif + + int yystacksize = YYINITDEPTH; + +#ifdef YYPURE + int yychar; + YYSTYPE yylval; + int yynerrs; +#ifdef YYLSP_NEEDED + YYLTYPE yylloc; +#endif +#endif + + YYSTYPE yyval; /* the variable used to return */ + /* semantic values from the action */ + /* routines */ + + int yylen; + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Starting parse\n"); +#endif + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + + yyssp = yyss - 1; + yyvsp = yyvs; +#ifdef YYLSP_NEEDED + yylsp = yyls; +#endif + +/* Push a new state, which is found in yystate . */ +/* In all cases, when you get here, the value and location stacks + have just been pushed. so pushing a state here evens the stacks. */ +yynewstate: + + *++yyssp = yystate; + + if (yyssp >= yyss + yystacksize - 1) + { + /* Give user a chance to reallocate the stack */ + /* Use copies of these so that the &'s don't force the real ones into memory. */ + YYSTYPE *yyvs1 = yyvs; + short *yyss1 = yyss; +#ifdef YYLSP_NEEDED + YYLTYPE *yyls1 = yyls; +#endif + + /* Get the current used size of the three stacks, in elements. */ + int size = yyssp - yyss + 1; + +#ifdef yyoverflow + /* Each stack pointer address is followed by the size of + the data in use in that stack, in bytes. */ +#ifdef YYLSP_NEEDED + /* This used to be a conditional around just the two extra args, + but that might be undefined if yyoverflow is a macro. */ + yyoverflow("parser stack overflow", + &yyss1, size * sizeof (*yyssp), + &yyvs1, size * sizeof (*yyvsp), + &yyls1, size * sizeof (*yylsp), + &yystacksize); +#else + yyoverflow("parser stack overflow", + &yyss1, size * sizeof (*yyssp), + &yyvs1, size * sizeof (*yyvsp), + &yystacksize); +#endif + + yyss = yyss1; yyvs = yyvs1; +#ifdef YYLSP_NEEDED + yyls = yyls1; +#endif +#else /* no yyoverflow */ + /* Extend the stack our own way. */ + if (yystacksize >= YYMAXDEPTH) + { + yyerror("parser stack overflow"); + return 2; + } + yystacksize *= 2; + if (yystacksize > YYMAXDEPTH) + yystacksize = YYMAXDEPTH; + yyss = (short *) alloca (yystacksize * sizeof (*yyssp)); + __yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp)); + yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp)); + __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp)); +#ifdef YYLSP_NEEDED + yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp)); + __yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp)); +#endif +#endif /* no yyoverflow */ + + yyssp = yyss + size - 1; + yyvsp = yyvs + size - 1; +#ifdef YYLSP_NEEDED + yylsp = yyls + size - 1; +#endif + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Stack size increased to %d\n", yystacksize); +#endif + + if (yyssp >= yyss + yystacksize - 1) + YYABORT; + } + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Entering state %d\n", yystate); +#endif + + goto yybackup; + yybackup: + +/* Do appropriate processing given the current state. */ +/* Read a lookahead token if we need one and don't already have one. */ +/* yyresume: */ + + /* First try to decide what to do without reference to lookahead token. */ + + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* yychar is either YYEMPTY or YYEOF + or a valid token in external form. */ + + if (yychar == YYEMPTY) + { +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Reading a token: "); +#endif + yychar = YYLEX; + } + + /* Convert token to internal form (in yychar1) for indexing tables with */ + + if (yychar <= 0) /* This means end of input. */ + { + yychar1 = 0; + yychar = YYEOF; /* Don't call YYLEX any more */ + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Now at end of input.\n"); +#endif + } + else + { + yychar1 = YYTRANSLATE(yychar); + +#if YYDEBUG != 0 + if (yydebug) + { + fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); + /* Give the individual parser a way to print the precise meaning + of a token, for further debugging info. */ +#ifdef YYPRINT + YYPRINT (stderr, yychar, yylval); +#endif + fprintf (stderr, ")\n"); + } +#endif + } + + yyn += yychar1; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) + goto yydefault; + + yyn = yytable[yyn]; + + /* yyn is what to do for this token type in this state. + Negative => reduce, -yyn is rule number. + Positive => shift, yyn is new state. + New state is final state => don't bother to shift, + just return success. + 0, or most negative number => error. */ + + if (yyn < 0) + { + if (yyn == YYFLAG) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + else if (yyn == 0) + goto yyerrlab; + + if (yyn == YYFINAL) + YYACCEPT; + + /* Shift the lookahead token. */ + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); +#endif + + /* Discard the token being shifted unless it is eof. */ + if (yychar != YYEOF) + yychar = YYEMPTY; + + *++yyvsp = yylval; +#ifdef YYLSP_NEEDED + *++yylsp = yylloc; +#endif + + /* count tokens shifted since error; after three, turn off error status. */ + if (yyerrstatus) yyerrstatus--; + + yystate = yyn; + goto yynewstate; + +/* Do the default action for the current state. */ +yydefault: + + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + +/* Do a reduction. yyn is the number of a rule to reduce with. */ +yyreduce: + yylen = yyr2[yyn]; + if (yylen > 0) + yyval = yyvsp[1-yylen]; /* implement default value of the action */ + +#if YYDEBUG != 0 + if (yydebug) + { + int i; + + fprintf (stderr, "Reducing via rule %d (line %d), ", + yyn, yyrline[yyn]); + + /* Print the symbols being reduced, and their result. */ + for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) + fprintf (stderr, "%s ", yytname[yyrhs[i]]); + fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); + } +#endif + +$ /* the action file gets copied in in place of this dollarsign */ +#line 498 "bison.simple" + + yyvsp -= yylen; + yyssp -= yylen; +#ifdef YYLSP_NEEDED + yylsp -= yylen; +#endif + +#if YYDEBUG != 0 + if (yydebug) + { + short *ssp1 = yyss - 1; + fprintf (stderr, "state stack now"); + while (ssp1 != yyssp) + fprintf (stderr, " %d", *++ssp1); + fprintf (stderr, "\n"); + } +#endif + + *++yyvsp = yyval; + +#ifdef YYLSP_NEEDED + yylsp++; + if (yylen == 0) + { + yylsp->first_line = yylloc.first_line; + yylsp->first_column = yylloc.first_column; + yylsp->last_line = (yylsp-1)->last_line; + yylsp->last_column = (yylsp-1)->last_column; + yylsp->text = 0; + } + else + { + yylsp->last_line = (yylsp+yylen-1)->last_line; + yylsp->last_column = (yylsp+yylen-1)->last_column; + } +#endif + + /* Now "shift" the result of the reduction. + Determine what state that goes to, + based on the state we popped back to + and the rule number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTBASE] + *yyssp; + if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTBASE]; + + goto yynewstate; + +yyerrlab: /* here on detecting error */ + + if (! yyerrstatus) + /* If not already recovering from an error, report this error. */ + { + ++yynerrs; + +#ifdef YYERROR_VERBOSE + yyn = yypact[yystate]; + + if (yyn > YYFLAG && yyn < YYLAST) + { + int size = 0; + char *msg; + int x, count; + + count = 0; + /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ + for (x = (yyn < 0 ? -yyn : 0); + x < (sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) + size += strlen(yytname[x]) + 15, count++; + msg = (char *) malloc(size + 15); + if (msg != 0) + { + strcpy(msg, "parse error"); + + if (count < 5) + { + count = 0; + for (x = (yyn < 0 ? -yyn : 0); + x < (sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) + { + strcat(msg, count == 0 ? ", expecting `" : " or `"); + strcat(msg, yytname[x]); + strcat(msg, "'"); + count++; + } + } + yyerror(msg); + free(msg); + } + else + yyerror ("parse error; also virtual memory exceeded"); + } + else +#endif /* YYERROR_VERBOSE */ + yyerror("parse error"); + } + + goto yyerrlab1; +yyerrlab1: /* here on error raised explicitly by an action */ + + if (yyerrstatus == 3) + { + /* if just tried and failed to reuse lookahead token after an error, discard it. */ + + /* return failure if at end of input */ + if (yychar == YYEOF) + YYABORT; + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); +#endif + + yychar = YYEMPTY; + } + + /* Else will try to reuse lookahead token + after shifting the error token. */ + + yyerrstatus = 3; /* Each real token shifted decrements this */ + + goto yyerrhandle; + +yyerrdefault: /* current state does not do anything special for the error token. */ + +#if 0 + /* This is wrong; only states that explicitly want error tokens + should shift them. */ + yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ + if (yyn) goto yydefault; +#endif + +yyerrpop: /* pop the current state because it cannot handle the error token */ + + if (yyssp == yyss) YYABORT; + yyvsp--; + yystate = *--yyssp; +#ifdef YYLSP_NEEDED + yylsp--; +#endif + +#if YYDEBUG != 0 + if (yydebug) + { + short *ssp1 = yyss - 1; + fprintf (stderr, "Error: state stack now"); + while (ssp1 != yyssp) + fprintf (stderr, " %d", *++ssp1); + fprintf (stderr, "\n"); + } +#endif + +yyerrhandle: + + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yyerrdefault; + + yyn += YYTERROR; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) + goto yyerrdefault; + + yyn = yytable[yyn]; + if (yyn < 0) + { + if (yyn == YYFLAG) + goto yyerrpop; + yyn = -yyn; + goto yyreduce; + } + else if (yyn == 0) + goto yyerrpop; + + if (yyn == YYFINAL) + YYACCEPT; + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Shifting error token, "); +#endif + + *++yyvsp = yylval; +#ifdef YYLSP_NEEDED + *++yylsp = yylloc; +#endif + + yystate = yyn; + goto yynewstate; +} diff --git a/engine/client/application/Miff/src/win32/mIFF.dox b/engine/client/application/Miff/src/win32/mIFF.dox new file mode 100644 index 00000000..4c46d600 --- /dev/null +++ b/engine/client/application/Miff/src/win32/mIFF.dox @@ -0,0 +1,62 @@ +// NOTE: this makes it more convinient for me to make the help screen fancier... +// blah... not that anybody cares... + +printf("\ +Usage:\n\ + mIFF {-%c |--%s=}\n\ + [{-%c |--%s=} | {-%c|--%s}]\n\ + [{-%c|--%s}] [{-%c|--%s}] [{-%c|--%s}]\n\n", + SNAME_INPUT_FILE, LNAME_INPUT_FILE, + SNAME_OUTPUT_FILE, LNAME_OUTPUT_FILE, + SNAME_PRAGMA_TARGET, LNAME_PRAGMA_TARGET, + SNAME_CCCP, LNAME_CCCP, + SNAME_VERBOSE, LNAME_VERBOSE, + SNAME_DEBUG, LNAME_DEBUG); +printf("\ + mIFF {-%c|--%s}\n\n", SNAME_HELP, LNAME_HELP); + +printf("\ +Parameters:\n\ + -%c ,--%s=\n\ + [required] specifies the input path for IFF source file.\n", SNAME_INPUT_FILE, LNAME_INPUT_FILE); +printf("\ + -%c ,--%s=\n\ + [optional] specifies the pathname for the generated \n\ + IFF data file. Note that if neither this nor the following \n\ + option are specified, a default output filename of the source\n\ + file's base name with extension \".iff\" will be used.\n", SNAME_OUTPUT_FILE, LNAME_OUTPUT_FILE); +printf("\ + -%c,--%s\n\ + [optional] specifies the generated output filename should be \n\ + taken from the #pragma options within the source file. \n\ + Allowable #pragma options are: \n\ + #pragma drive \":\"\n\ + #pragma directory \"\"\n\ + #pragma filename \"\"\n\ + #pragma extension \"\"\n", SNAME_PRAGMA_TARGET, LNAME_PRAGMA_TARGET); +printf("\ + -%c,--%s\n\ + [optional] use CCCP rather than CPP.\n", SNAME_CCCP, LNAME_CCCP); +printf("\ + -%c,--%s\n\ + [optional] display more information during execution.\n", SNAME_VERBOSE, LNAME_VERBOSE); +printf("\ + -%c,--%s\n\ + [optional] enable debug mode (save intermediate files).\n", SNAME_DEBUG, LNAME_DEBUG); +printf("\ + -%c,--%s\n\ + [very optional] this help screen.\n", SNAME_HELP, LNAME_HELP); +printf("\ +Examples:\n\ + mIFF -%c foo.bar\n\ + this will generate an iff file foo.iff (default if no parm specified)\n\ + in the current working directory. Even if foo.bar contains #pragma, \n\ + it will create foo.iff because -%c was not specified.\n", SNAME_INPUT_FILE, SNAME_PRAGMA_TARGET); +printf("\ + mIFF -%c \"C:\\my project\\myData\\foo.iff\" --%s=foo.bar\n\ + notice that if you have space in your dirname, use \" to encapsulate \n\ + it.\n", SNAME_OUTPUT_FILE, LNAME_INPUT_FILE); +printf("\ + mIFF -%c foo.bar --%s\n\ + will generate output file specified by #pragma statements \n\ + within file foo.bar.\n", SNAME_INPUT_FILE, LNAME_PRAGMA_TARGET); diff --git a/engine/client/application/Miff/src/win32/miff.cpp b/engine/client/application/Miff/src/win32/miff.cpp new file mode 100644 index 00000000..89535216 --- /dev/null +++ b/engine/client/application/Miff/src/win32/miff.cpp @@ -0,0 +1,961 @@ +//=========================================================================== +// +// FILENAME: mIFF.cpp [C:\Projects\new\tools\src\miff\src\] +// COPYRIGHT: (C) 1999 BY Bootprint Entertainment +// +// DESCRIPTION: make IFF (Console version) +// AUTHOR: Hideki Ikeda +// DATE: 1/07/99 12:57:20 PM +// +// HISTORY: 1/07/99 [HAI] - File created +// : 1/07/99 [HAI] - v1.0 introductory version +// : 1/12/99 [HAI] - v1.1 switched from DOS to Engine library +// : - first attempt was to setup the main entry +// : point via ConsoleEntryPoint() via callback +// : 1/29/99 [HAI] - changed the parameter in MIFFMessage to allow +// : output even in non-verbose mode (for error +// : message purpose. +// : 05/07/99 [HAI]- added MIFFallocString() and MIFFfreeString() +// : to work with memory manager. they are allocated +// : in the lexical analyzer for IDENTIFIERS and STR_LIT +// : deleted after parser parses the rule. +// +// FUNCTION: main() +// : evaluateArgs() +// : help() +// : handleError() +// : preprocessSource() +// : MIFFMessage() +// : callbackFunction() +// +//=========================================================================== + +//========================================================== include files == +#include "sharedFoundation/FirstSharedFoundation.h" + +#include "sharedCompression/SetupSharedCompression.h" +#include "sharedDebug/SetupSharedDebug.h" +#include "sharedFile/SetupSharedFile.h" +#include "sharedFile/TreeFile.h" +#include "sharedFoundation/CommandLine.h" +#include "sharedFoundation/Crc.h" +#include "sharedFoundation/Os.h" +#include "sharedFoundation/SetupSharedFoundation.h" +#include "sharedMemoryManager/MemoryManager.h" +#include "sharedThread/SetupSharedThread.h" + +#include "InputFileHandler.h" +#include "OutputFileHandler.h" + +#include // for memset() +#include // FILE stuff +#include // for getcwd() +#include // for tolower() +#include // for system() + +//================================================= static vars assignment == +const int entryPointVersion = 1; // constantly check DataEntryPoint.h to see if this value has changed + +OutputFileHandler *outfileHandler = NULL; +const int bufferSize = 16 * 1024 * 1024; +const int maxStringSize = 256; +const char version[] = "1.3 September 18, 2000"; + +// vars set by pragmas or via command line +char drive[4]; // should be no more then 2 char "C:" +char directory[maxStringSize]; +char filename[maxStringSize]; +char extension[8]; // we'll truncate if the extension is more then 8 chars... +char inFileName[maxStringSize]; + +// switches to be sent to mIFF Compiler +char sourceBuffer[bufferSize]; +char outFileName[(maxStringSize * 2) + 8]; // x2 to combine filename, dir, and ext +bool usePragma = false; +bool useCCCP = false; +bool verboseMode = false; // default to non-verbose mode +bool debugMode = false; // set this on and the preprocessed source file (mIFF.$$$) won't be deleted + +static bool runningUnderNT; + +enum errorType { + ERR_FILENOTFOUND = -1, + ERR_ARGSTOOFEW = -2, + ERR_BUFFERTOOSMALL = -3, + ERR_UNKNOWNDIR = -4, + ERR_PREPROCESS = -5, + ERR_MULTIPLEINFILE = -6, + ERR_PARSER = -7, + ERR_ENGINE = -8, + + ERR_HELPREQUEST = -9, + ERR_OPTIONS = -10, + + ERR_WRITEERROR = -11, + + ERR_NONE = 0 + }; +char err_msg[512]; +errorType errorFlag = ERR_NONE; // assume no error (default) + + +// long and short name definitions for command line options + +static const char * const LNAME_HELP = "help"; +static const char * const LNAME_INPUT_FILE = "inputfile"; +static const char * const LNAME_OUTPUT_FILE = "outputfile"; +static const char * const LNAME_PRAGMA_TARGET = "pragmatarget"; +static const char * const LNAME_CCCP = "cccp"; +static const char * const LNAME_VERBOSE = "verbose"; +static const char * const LNAME_DEBUG = "debug"; + +static const char SNAME_HELP = 'h'; +static const char SNAME_INPUT_FILE = 'i'; +static const char SNAME_OUTPUT_FILE = 'o'; +static const char SNAME_PRAGMA_TARGET = 'p'; +static const char SNAME_CCCP = 'c'; +static const char SNAME_VERBOSE = 'v'; +static const char SNAME_DEBUG = 'd'; + +// following is the command line option spec tree needed for command line processing +static CommandLine::OptionSpec optionSpecArray[] = +{ + OP_BEGIN_SWITCH(OP_NODE_REQUIRED), + + // help + OP_SINGLE_SWITCH_NODE(SNAME_HELP, LNAME_HELP, OP_ARG_NONE, OP_MULTIPLE_DENIED), + + // real options + OP_BEGIN_SWITCH_NODE(OP_MULTIPLE_DENIED), + OP_BEGIN_LIST(), + // input filename required + OP_SINGLE_LIST_NODE(SNAME_INPUT_FILE, LNAME_INPUT_FILE, OP_ARG_REQUIRED, OP_MULTIPLE_DENIED, OP_NODE_REQUIRED), + + // optional, mutually exclusive output file specification options + // if none specified, generate derive output filename from input filename + OP_BEGIN_LIST_NODE(OP_MULTIPLE_DENIED, OP_NODE_OPTIONAL), + OP_BEGIN_SWITCH(OP_NODE_OPTIONAL), + // specify output filename on command line + OP_SINGLE_SWITCH_NODE(SNAME_OUTPUT_FILE, LNAME_OUTPUT_FILE, OP_ARG_REQUIRED, OP_MULTIPLE_DENIED), + + // use pragma target for output filename + OP_SINGLE_SWITCH_NODE(SNAME_PRAGMA_TARGET, LNAME_PRAGMA_TARGET, OP_ARG_NONE, OP_MULTIPLE_DENIED), + OP_END_SWITCH(), + OP_END_LIST_NODE(), + + // if specified, use cccp instead of cpp + OP_SINGLE_LIST_NODE(SNAME_CCCP, LNAME_CCCP, OP_ARG_NONE, OP_MULTIPLE_DENIED, OP_NODE_OPTIONAL), + + // if specified, be verbose + OP_SINGLE_LIST_NODE(SNAME_VERBOSE, LNAME_VERBOSE, OP_ARG_NONE, OP_MULTIPLE_DENIED, OP_NODE_OPTIONAL), + + // if specified, enter debug info + OP_SINGLE_LIST_NODE(SNAME_DEBUG, LNAME_DEBUG, OP_ARG_NONE, OP_MULTIPLE_DENIED, OP_NODE_OPTIONAL), + OP_END_LIST(), + OP_END_SWITCH_NODE(), + + OP_END_SWITCH() +}; +static const int optionSpecCount = sizeof(optionSpecArray) / sizeof(optionSpecArray[0]); + +//================================================= function prototypes == +int main(int argc, char *argv[]); +static errorType evaluateArgs(void); +static void help(void); +static void handleError(errorType error); +static int preprocessSource(char *sourceName); +static void callbackFunction(void); +static errorType loadInputToBuffer(void *destAddr, int maxBufferSize); + +// functions called by parser.yac and parser.lex +extern "C" void MIFFMessage(char *msg, int forceOut); +extern "C" void MIFFSetError(void); +extern "C" void MIFFSetIFFName(const char *newFileName); +extern "C" void MIFFinsertForm(const char *formName); +extern "C" void MIFFinsertChunk(const char *chunkName); +extern "C" void MIFFinsertChunkData(void * buffer, unsigned bufferSize); +extern "C" int MIFFloadRawData(char *fname, void * buffer, unsigned maxBufferSize); +extern "C" void MIFFexitChunk(void); +extern "C" void MIFFexitForm(void); +extern "C" unsigned long MIFFgetLabelHash(char *inputStream); + +// external functions found in parser.lex file +extern "C" void MIFFCompile(char *inputStream, char *inputFname); +extern "C" void MIFFCompileInit(char *inputStream, char *inputFname); + +//--------------------------------------------------------------------------- +// main entry point from console call +// +// Return Value: +// errorType - see enumeration; 0 if no errors +// +// Remarks: +// +// +// See Also: +// +// +// Revisions and History: +// 1/07/99 [HAI] - created +// +int main( int argc, // number of args in commandline + char * argv[] // list of pointers to strings + ) +{ + memset(sourceBuffer, 0, bufferSize); + + SetupSharedThread::install(); + SetupSharedDebug::install(4096); + + SetupSharedFoundation::Data SetupSharedFoundationData (SetupSharedFoundation::Data::D_console); + SetupSharedFoundationData.useWindowHandle = false; + SetupSharedFoundationData.argc = argc; + SetupSharedFoundationData.argv = argv; + SetupSharedFoundationData.demoMode = true; + SetupSharedFoundation::install (SetupSharedFoundationData); + + SetupSharedCompression::install(); + + SetupSharedFile::install(false); + + TreeFile::addSearchAbsolute(0); + TreeFile::addSearchPath (".", 0); + + SetupSharedFoundation::callbackWithExceptionHandling(callbackFunction); + SetupSharedFoundation::remove(); + + SetupSharedThread::remove(); + return static_cast (errorFlag); +} + +//--------------------------------------------------------------------------- +// callback function for Engine's console entry point +// +// Return Value: +// none +// +// Remarks: +// this is like a substitute of main() +// +// See Also: +// +// +// Revisions and History: +// 1/12/99 [HAI] - created +// +static void callbackFunction(void) +{ + outfileHandler = NULL; + +#ifdef WIN32 + + // check if we're running under NT + OSVERSIONINFO osInfo; + Zero(osInfo); + + osInfo.dwOSVersionInfoSize = sizeof(osInfo); + const BOOL getVersionResult = GetVersionEx(&osInfo); + if (getVersionResult) + runningUnderNT = (osInfo.dwPlatformId == VER_PLATFORM_WIN32_NT); + if (runningUnderNT) + DEBUG_REPORT_LOG(true, ("MIFF: running under Windows NT platform\n")); + else + DEBUG_REPORT_LOG(true, ("MIFF: running under non-NT Windows platform\n")); + +#endif + + errorFlag = evaluateArgs(); + if (ERR_NONE == errorFlag) + { + outfileHandler = new OutputFileHandler(outFileName); + MIFFCompile(sourceBuffer, inFileName); + } + else + handleError(errorFlag); + + if (outfileHandler) + { + // only write output IF there was no error + if (ERR_NONE == errorFlag) + { + if (!outfileHandler->writeBuffer()) + { + fprintf(stderr, "MIFF: failed to write output file \"%s\"\n", outFileName); + errorFlag = ERR_WRITEERROR; + } + } + delete outfileHandler; + } +} + +//--------------------------------------------------------------------------- +// Evaluates the command line and sets up the environment variables required for mIFF to function +// +// Return Value: +// errorType +// +// Remarks: +// argc's and argv's are substituted with CommandLine::functions() +// +// See Also: +// +// +// Revisions and History: +// 1/07/99 [HAI] - created +// +static errorType evaluateArgs(void) +{ + errorType retVal = ERR_NONE; + + // parse the commandline + const CommandLine::MatchCode mc = CommandLine::parseOptions(optionSpecArray, optionSpecCount); + if (mc != CommandLine::MC_MATCH) + { + // -TF- add call to retrieve command line error buffer for display (as soon as it is written!) + printf("WARNING: usage error detected, printing help.\n"); + help(); + return ERR_OPTIONS; + } + else if (CommandLine::getOccurrenceCount(SNAME_HELP)) + { + // user specified help + help(); + retVal = ERR_HELPREQUEST; + return(retVal); + } + + // at this point, we can assume a valid combination of options has been specified on the commandline + + + // setup input filename + strcpy(inFileName, CommandLine::getOptionString(SNAME_INPUT_FILE)); + + + // handle output filename spec + if (CommandLine::getOccurrenceCount(SNAME_OUTPUT_FILE)) + { + strcpy(outFileName, CommandLine::getOptionString(SNAME_OUTPUT_FILE)); + } + else if (CommandLine::getOccurrenceCount(SNAME_PRAGMA_TARGET)) + { + // use pragma target within iff source for output filename + usePragma = true; + } + else + { + // no output option specified on commandline, derive from input filename + char *terminator; + + // start with input file pathname + strcpy(outFileName, inFileName); + + // try to terminate at rightmost '.' + terminator = strrchr(outFileName, '.'); + if (terminator) + *terminator = 0; + + // append the default iff extension + strcat(outFileName, ".iff"); + } + + + // handle options (get them out of the way, as we use them later) + useCCCP = (CommandLine::getOccurrenceCount(SNAME_CCCP) != 0); + verboseMode = (CommandLine::getOccurrenceCount(SNAME_VERBOSE) != 0); + debugMode = (CommandLine::getOccurrenceCount(SNAME_DEBUG) != 0); + + + // preprocess the input file + if (0 == preprocessSource(inFileName)) + { + if (verboseMode) + { + sprintf(err_msg,"Now compiling %s...\n", inFileName); + MIFFMessage(err_msg, 0); + } + if (ERR_NONE == retVal) + retVal = loadInputToBuffer(sourceBuffer, bufferSize); + } + else + { + // preprocessSource returned an error... + retVal = ERR_PREPROCESS; + } + if (retVal != ERR_NONE) + return retVal; + + return retVal; + +#if 0 + + errorType retVal = ERR_NONE; // assume no error has been found + bool outPathUsed = false; // flag to monitor if -o flag was used, if so, we can ignore -d, -p, -e, -f + bool inFileEntered = false; + int argc = CommandLine::getPlainCount(); + + // get default values from DOS + char currentDir[maxStringSize]; + if (NULL == getcwd(currentDir, maxStringSize)) // get current working directory + { + retVal = ERR_UNKNOWNDIR; + return(retVal); + } + drive[0] = currentDir[0]; // drive letter + drive[1] = 0; // and null terminate it + strcpy(extension, "IFF"); // default to uppercase .IFF + strcpy(directory, ¤tDir[2]); // get everything after the Drive: including the first backslash + filename[0] = 0; + + // see specs.txt for requests + // scan for any argv's that has '-' in the argv[n][0]'s character + for (int index = 0; index < argc; index++) // note: if using argv[] rather then CommandLine::getPlainString() then start with 1 rather then 0 + { + if ('-' == CommandLine::getPlainString(index)[0]) + { + // we've found a parameter switch + switch (tolower(CommandLine::getPlainString(index)[1])) // assume non case sensitive switches + { + case 'i': // install via #pragma + { + usePragma = true; + break; + } + + case 'c': // use CCCP instead of CPP + useCCCP = true; + break; + + case 'v': // don't show any debug message + verboseMode = true; + break; + + case '$': + debugMode = true; + break; + + case 'o': // target output file name and path (complete path) + { + index++; // next param + outPathUsed = true; + strcpy(outFileName, CommandLine::getPlainString(index)); + break; + + } + + case 'd': // target drive letter (-p must be present) + { + if (!outPathUsed) + { + index++; // next param + strcpy(drive, CommandLine::getPlainString(index)); + } + else + index++; // skip the drive letter arg that SHOULD follow the -d option + break; + } + + case 'p': // target pathname + { + if (!outPathUsed) + { + index++; // next param + strcpy(directory, CommandLine::getPlainString(index)); + } + else + index++; // skip the pathname arg that follows the -p option + break; + } + + case 'f': // target filename + { + if (!outPathUsed) + { + index++; // next param + strcpy(filename, CommandLine::getPlainString(index)); + } + else + index++; // skip the filename arg that follows the -f + break; + } + + case 'e': // target extension + { + if (!outPathUsed) + { + index++; // next param + strcpy(extension, CommandLine::getPlainString(index)); + } + else + index++; // skip the extension arg that follows the -e + break; + } + + case 'h': // help! + case '?': + { + help(); + index = argc; // force to exit + retVal = ERR_HELPREQUEST; + return(retVal); // special case, ONLY time I call return() in the middle of the function (because I check for argc < 2 at the end of the code) + break; + } + + default: + { + sprintf(err_msg, "\nUnknown parameter %s, use -h to seek help...\n", CommandLine::getPlainString(index)); + MIFFMessage(err_msg, 1); + index = argc; // force to exit + break; + } + } + } + else + { + // we found an arg that doesn't start with '-' so let's assume it's a filename + if (!inFileEntered) + { + strcpy(inFileName, CommandLine::getPlainString(index)); + inFileEntered = true; + } + else + { + retVal = ERR_MULTIPLEINFILE; + index = argc; + } + + // now construct the DEFAULT filename for this file by scanning backwards to front and only extracting the filename (no extension, no path) + if (ERR_NONE == retVal) + { + char sourceName[maxStringSize]; + strcpy(sourceName, inFileName); // make a duplicate for us to play with + for (int strIndex = strlen(sourceName); strIndex > 0; strIndex--) + { + if ('.' == sourceName[strIndex]) + sourceName[strIndex] = 0; // put a stopper here... we are assuming that '.' indicates extension! I'm going to assume that the person is just testing me if s/he decides to use filename like "foo.bar.psych" which will truncate to "foo" + if ('\\' == sourceName[strIndex]) + break; // get out, for we've reached the path name... + } + + // ok, by here, strIndex should point to either beginning of the string, or where the first '\' was found scanning backwards + strcpy(filename, &sourceName[strIndex]); // ta-da-! + } + } + } + + if (inFileEntered) + { + if (0 == preprocessSource(inFileName)) + { + if (verboseMode) + { + // using err_msg as my temp buffer... + sprintf(err_msg,"Now compiling %s\n", inFileName); + MIFFMessage(err_msg, 0); + } + + if (ERR_NONE == retVal) + retVal = loadInputToBuffer(sourceBuffer, bufferSize); + } + else // preprocessSource returned an error... + { + retVal = ERR_PREPROCESS; + } + } + else // inFileEntered == false + { + MIFFMessage("Missing input filename in command line!", 1); + } + + // construct a outFileName[] based on drive[], directory[], filename[], and extension[] + if (!outPathUsed && (ERR_NONE == retVal)) + { + if (inFileName[0]) // make sure the user has entered a input filename + sprintf(outFileName,"%s:%s\\%s.%s", drive, directory, filename, extension); + } + + if (argc < 1) + retVal = ERR_ARGSTOOFEW; // we can do this because we know -h was not entered... + + return(retVal); + +#endif + +} + + +//--------------------------------------------------------------------------- +// reads the tmeporary files spit out by CCCP and stuffs the plain text into source buffer +// +// Return Value: +// errorType +// +// Remarks: +// +// +// See Also: +// +// +// Revisions and History: +// 1/14/99 [HAI] - created +// +static errorType loadInputToBuffer( + void * dest, // destination address of where you want the date to be read + int maxBufferSize // maximum destination data pool size + ) +{ + errorType retVal = ERR_NONE; + InputFileHandler *inFileHandler = new InputFileHandler("mIFF.$$$"); + if (inFileHandler) + { + int sizeRead = inFileHandler->read(dest, maxBufferSize); + if (sizeRead >= maxBufferSize) + { + retVal = ERR_BUFFERTOOSMALL; + } + else + { + reinterpret_cast(dest)[sizeRead] = 0; // so stupid... but if you don't zero-terminate at exact spot, YYInput may chokes because of extra grammer that may exist... + } + if (!debugMode) + inFileHandler->deleteFile("mIFF.$$$", true); // no need for temp file now... + + // we've successfully read the file, now close it... + delete inFileHandler; + } + else // inFileName is NULL + { + retVal = ERR_FILENOTFOUND; + } + + return(retVal); +} + +//--------------------------------------------------------------------------- +// help function called by main upon -h switch +// +// Return Value: +// none +// +// Remarks: +// #include's mIFF.dox +// make sure to update the version when modified. +// Notice that help() does NOT go thru MIFFMessage() because we want it to +// print out whether it's verbose mode or not... +// +// See Also: +// mIFF.dox +// +// Revisions and History: +// 1/07/99 [HAI] - created +// +static void help(void) +{ + printf("\nmIFF v%s (DOS version) - Bootprint Ent. (c) 1999\n", version); + printf("Hideki Ikeda\n"); +#include "mIFF.dox" +} + + +//--------------------------------------------------------------------------- +// upon exit from main(), if error has been found, it calls here to inform the user of the type of errors it has encounted. +// +// Return Value: +// none +// +// Remarks: +// use -q switch to suppress error messages - but in shell, return value can be used to determine the handling +// +// See Also: +// +// +// Revisions and History: +// 1/07/99 [HAI] - created +// +static void handleError(errorType error) +{ + if (ERR_NONE == error) + return; + + switch (error) + { + case ERR_NONE: + break; + + case ERR_FILENOTFOUND: + MIFFMessage("ERROR: INPUT File not found!\n", 1); + break; + + case ERR_ARGSTOOFEW: + MIFFMessage("ERROR: Not enough arguments. Use -h for help.\n", 1); + break; + + case ERR_BUFFERTOOSMALL: + MIFFMessage("ERROR: Internally allocated buffer for reading\nsource code is too small, increase buffer and re-compile\n", 1); + break; + + case ERR_UNKNOWNDIR: + MIFFMessage("ERROR: Directory unknown...\n", 1); + break; + + case ERR_PREPROCESS: + MIFFMessage("ERROR: Possible problems running the GNU C Preprocessor.\n", 1); + break; + + case ERR_MULTIPLEINFILE: + MIFFMessage("ERROR: There can only be ONE inputfile name.\nPerhaps you've forgotten the -o option flag\n", 1); + break; + + case ERR_ENGINE: + MIFFMessage("ERROR: Engine returned a non-zero value...\n", 1); + break; + + case ERR_PARSER: + MIFFMessage("ERROR: Parser error\n", 1); + break; + + case ERR_HELPREQUEST: + break; + + case ERR_OPTIONS: + MIFFMessage("ERROR: Failed to handle command line options\n", 1); + break; + + default: + MIFFMessage("ERROR: Unknown error, you suck!\n", 1); + break; + } +} + + +///////////////////////////////////////////////////////////////////////////// +// gotta write all these externs because you can't call C++ class based non-static +// functions from C... So we will use here as the bridge between the two +// languages + + +//--------------------------------------------------------------------------- +// Message output handler called by ALL external "C" functions +// +// Return Value: +// none +// +// Remarks: +// all the messages that are displayed are channeled thru this function. Note the -q quiet mode suppresses all messages. +// this is an extern "C" function +// +// See Also: +// yyerror() +// +// Revisions and History: +// 1/07/99 [] - created +// +extern "C" void MIFFMessage(char *message, // null terminated string to be displayed + int forceOutput) // if non-zero, it will print out even in quiet mode (for ERRORs) +{ + if (forceOutput) + fprintf(stdout, "%s\n", message); + else if (verboseMode) + fprintf(stdout, "%s\n", message); + OutputDebugString(message); + OutputDebugString("\n"); +} + +// Only call this via parser!!! +extern "C" void MIFFSetError(void) +{ + errorFlag = ERR_PARSER; +} + +//--------------------------------------------------------------------------- +// validation of the filename passed are legal. +// +// Return Value: +// bool usePragma - whether #pragma is ignored or not +// +// Remarks: +// if -i switch is used then #pragma's are expected +// this is an extern "C" function +// +// See Also: +// +// +// Revisions and History: +// 1/07/99 [ ] - created +// +extern "C" int validateTargetFilename( char *targetFileName, // pointer to where we can store the string filename + unsigned maxTargetBufSize // size of the filename string buffer + ) +{ + if (strlen(outFileName) > maxTargetBufSize) + MIFFMessage("Internal error, increase string buffer size in parser.yac and recompile!", 1); + + strcpy(targetFileName, outFileName); + + return(usePragma); +} + + +//--------------------------------------------------------------------------- +// function calls CCCP or CPP via shell to preprocess the source code for #include's and #define's via C-Compatible Compiler Preprocessor +// +// Return Value: +// shell return value (4DOS is very generous on returning different values, while DOS just returns 0 all the time) +// +// Remarks: +// use -c switch to use CCCP rather then CPP in your search path +// +// See Also: +// +// +// Revisions and History: +// 1/07/99 [ ] - created +// +static int preprocessSource(char *sourceName) +{ + char shellCommand[512]; + int retVal = 0; + + memset(shellCommand, 0, sizeof(shellCommand)); + +// if (!runningUnderNT) + { + + if (verboseMode) + MIFFMessage("Preprocessing... via CCCP", 0); + + // CCCP parameters: + // -nostdinc -nostdinc++ - do NOT search for standard include directory; without this, your + // puter would be just twiddling its thumb because CCCP can't find it... + // -pedantic - issue warnings (use pedantic-errors if you want it as errors) + // required by the ANSI C standard in certain cases such as comments that + // follow the #else/#endif + // -dD - output #defines (for the purpose of error msg I parse) + // -H - display the name of the header/included files (verbose mode) + // -P - originally, I had this... so it won't show the # line_num "filename" ??? + if (!useCCCP && verboseMode) + { + sprintf(shellCommand, "cpp.exe -nostdinc -nostdinc++ -pedantic -Wall -dD -H %s mIFF.$$$", sourceName); + } + else if (!useCCCP && !verboseMode) + { + sprintf(shellCommand, "cpp.exe -nostdinc -nostdinc++ -pedantic -Wall -dD %s mIFF.$$$", sourceName); + } + else if (useCCCP && verboseMode) + { + sprintf(shellCommand, "cccp.exe -nostdinc -nostdinc++ -pedantic -Wall -dD -H %s mIFF.$$$", sourceName); + } + else + sprintf(shellCommand, "cccp.exe -nostdinc -nostdinc++ -pedantic -Wall -dD %s mIFF.$$$", sourceName); + } +// else + { + // running under NT. Use the MSVC cl since it deals with long filenames on fat16/fat32 partitions correctly + // and ccp and cccp don't +// sprintf(shellCommand, "cl /nologo /W4 /EP %s > mIFF.$$$", sourceName); + } + + retVal = system(shellCommand); + if (2 == retVal) // actually, I think 4DOS reports 2 for cannot find file, but DOS returns a 0... + { + REPORT_LOG(true, ("failed to execute following shell command (%d):\n", retVal)); + REPORT_LOG(true, (" %s\n", shellCommand)); + MIFFMessage("\n\nERROR: Cannot find preprocessor (either CCCP.EXE, CPP.EXE or CL.EXE (under NT) in the search path...\n", 1); + MIFFMessage("Please make sure the preprocessor is in your search path!\n", 1); + } + return(retVal); +} + +extern "C" void MIFFSetIFFName(const char *newFileName) +{ + if (ERR_NONE != errorFlag) + return; + + if (outfileHandler) + outfileHandler->setCurrentFilename(newFileName); +} + +extern "C" void MIFFinsertForm(const char *formName) +{ + if (ERR_NONE != errorFlag) + return; + + if (outfileHandler) + outfileHandler->insertForm(formName); +} + +extern "C" void MIFFinsertChunk(const char *chunkName) +{ + if (ERR_NONE != errorFlag) + return; + + if (outfileHandler) + outfileHandler->insertChunk(chunkName); +} + +extern "C" void MIFFinsertChunkData(void * buffer, unsigned bufferSize) +{ + if (ERR_NONE != errorFlag) + return; + + if (outfileHandler) + outfileHandler->insertChunkData(buffer, bufferSize); +} + +extern "C" int MIFFloadRawData(char *fname, void * buffer, unsigned maxBufferSize) +{ + int sizeRead = -1; + + if (ERR_NONE != errorFlag) + return(sizeRead); // should be -1 + + InputFileHandler * inFileName = new InputFileHandler(fname); + if (inFileName) + { + sizeRead = inFileName->read(buffer, maxBufferSize); + if (static_cast(sizeRead) >= maxBufferSize) + { + handleError(ERR_BUFFERTOOSMALL); + sizeRead = -1; + } + delete inFileName; + } + + return(sizeRead); +} + +extern "C" void MIFFexitChunk(void) +{ + if (ERR_NONE != errorFlag) + return; + + if (outfileHandler) + outfileHandler->exitChunk(); +} +extern "C" void MIFFexitForm(void) +{ + if (ERR_NONE != errorFlag) + return; + + if (outfileHandler) + outfileHandler->exitForm(); +} + +extern "C" char * MIFFallocString(int sizeOfString) +{ + return(new char[sizeOfString]); +} + +extern "C" void MIFFfreeString(char * pointer) +{ + delete [] pointer; +} + +extern "C" unsigned long MIFFgetLabelHash(char * inputStream) +{ + return (unsigned long)Crc::calculate(inputStream); +} + +//=========================================================================== +//============================================================ End-of-file == +//=========================================================================== + diff --git a/engine/client/application/Miff/src/win32/parser.lex b/engine/client/application/Miff/src/win32/parser.lex new file mode 100644 index 00000000..b2996a07 --- /dev/null +++ b/engine/client/application/Miff/src/win32/parser.lex @@ -0,0 +1,517 @@ +%option full + +%{ +/*-----------------------------------------------------------------------------** +** FILE: parser.lex ** +** (c) 1998 - Bootprint GTInteractive ** +** ** +** DESCRIPTION: lexical analyzer for mIFF ** +** ** +** AUTHOR: Hideki Ikeda ** +** ** +** HISTORY: ** +** ** +** Notes: companion to parser.yac ** +**-----------------------------------------------------------------------------*/ +/* Disable compiler warnings (we want warning level 4) for anything that flex spits out */ +#pragma warning (disable: 4127) /* conditional expression is constant - ie. while(1) */ +#pragma warning (disable: 4131) /* usage of old-style declarator */ +#pragma warning (disable: 4098) /* void function returning a vlue - this is because yyterminate() is defined as return() */ +#pragma warning (disable: 4505) /* unreferenced local function has been removed (to be direct: yyunput()) */ + +/* include files */ +#include "parser.h" /* NOTE: make sure this matches what Bison/yacc spits out */ + +#include +#include + +/*--------------------------------** +** exteranl prototype declaration ** +**--------------------------------*/ +void MIFFMessage(char *message, int forceOutput); +void MIFFSetError(void); +char * MIFFallocString(int sizeOfString); +void MIFFfreeString(char * pointer); + +int yyparse(); + +/* prototype declaration */ +int MIFFYYInput(char *buf,int max_size); +void initParser(void); +void count(void); +void yyerror(char *err); +void open_brace(void); +void close_brace(void); +int count_brace(void); + +void printString(char *str); + +/* global vars that has to be pre-declared because it's referenced by the lexical analyzer */ +int initialCompile = 0; +int globalErrorFlag = 0; +char inFileName[512]; /* keep track of source file name for error message */ + +#undef YY_INPUT +#define YY_INPUT(buf,result,max_size) (result = MIFFYYInput(buf,max_size)) + +#define SPACE_COUNT_FOR_TAB (8) + +%} + +DIGIT [0-9] +HEXDIGIT [0-9a-fA-F] +LETTER [A-z_] +FLOATSYM (f|F|l|L) +INTSYM (u|U|l|L)* +EXP (e|E)(\+|-)? + +%% +"//"[^\n]*\n { + /* don't do count(); */ + } + +"#define"[^\n]*\n { + /* don't you love regular expression? [^\n]* everything but \n, and then end with \n */ + /* don't do count(); just like comments */ + /* return(DEFINE); <-- note: #define's are ignored in parser for they are handled via preprocessors CCCP */ + } + +\"([^\"]|(\\\"))*\" { + /* start with " then ( [^\"] | (\\\") )* which means either anything but " OR \" of multiple encounter, and then close with " */ + /* case for "string" literals */ + char *s; // allocate space for string and pass the string pointer rather then yytext + + count(); + s = MIFFallocString(strlen(yytext) + 1); + strcpy(s, yytext+1); /* strip off the double quotes */ + s[strlen(yytext+1)-1] = 0; /* strip off the ending double quotes */ + yylval.stype = s; + return(STR_LIT); + } + +"form" | +"FORM" { + count(); + return(FORM); + } + +"chunk" | +"CHUNK" { + count(); + return(CHUNK); + } + +"int32" { + count(); + return(INT32); + } +"int16" { + count(); + return(INT16); + } +"int8" { + count(); + return(INT8); + } +"uint32" { + count(); + return(UINT32); + } +"uint16" { + count(); + return(UINT16); + } +"uint8" { + count(); + return(UINT8); + } +"float" { + count(); + return(FLOAT); + } +"double" { + count(); + return(DOUBLE); + } +"string" | +"cstring" | +"CString" { + count(); + return(STRING); + } +"wstring" | +"WString" { + count(); + return(WSTRING); + } +"labelhash" { + count(); + return(LABELHASH); + } + +"sin" { + count(); + return(SIN); + } +"cos" { + count(); + return(COS); + } +"tan" { + count(); + return(TAN); + } +"asin" { + count(); + return(ASIN); + } +"acos" { + count(); + return(ACOS); + } +"atan" { + count(); + return(ATAN); + } + +"enum" { + count(); + return(ENUMSTRUCT); + } + +"includeIFF" | +"includeiff" { + count(); + return(INCLUDEIFF); + } +"include" { + count(); + return(INCLUDEBIN); + } +"#include" { + count(); + return(INCLUDESOURCE); + } +"#pragma" { + count(); + return(PRAGMA); + } +"drive" { + count(); + return(PRAGMA_DRIVE); + } +"directory" { + count(); + return(PRAGMA_DIR); + } +"filename" { + count(); + return(PRAGMA_FNAME); + } +"extension" { + count(); + return(PRAGMA_EXT); + } + +{LETTER}({LETTER}|{DIGIT})* { + /* label identifiers */ + char *s; // allocate space for string and pass the string pointer rather then yytext + + count(); + s = MIFFallocString(strlen(yytext) + 1); + strcpy(s, yytext); + yylval.stype = s; + return(IDENTIFIER); + } + +{DIGIT}*"."{DIGIT}+{FLOATSYM}? { + /* handle numericals (floats) */ + /* + * {DIGIT}*"."{DIGIT}+{FLOATSYM}? means zero or more digits . one or more digit and with/without f at the end + */ + count(); + /* make sure to store it to dtype, and use strtod to convert to double */ + yylval.dtype = strtod((char *) yytext, (char **) 0); + return(FLOAT_LIT); + } + +0[xX]{HEXDIGIT}+{INTSYM}? | +0{DIGIT}+{INTSYM}? | +{DIGIT}+{INTSYM}? { + /* handle numericals ( hex, ints) */ + /* + * 0[xX]{HEXDIGIT}+{INTSYM}? means start with 0, then X one or more digit and you can put int symbol if you want + * 0{DIGIT}+{INTSYM}? means start with 0, one ore more digit and w/or w/o int symbol + * {DIGIT}+{INTSYM}? means one or more digit and w/or w/o int symbol + */ + count(); + /* make sure to store it to ltype (long), and use strtod to convert to unsigned long */ + yylval.ltype = strtoul((char *) yytext, (char **) 0, 0); + return(LIT); + } + +'(\\.|[^\\'])+' { + /* handle 'x' - single character */ + count(); + yylval.chtype = yytext[1]; + return(CHAR_LIT); + } + +"#" { + /* #'s are used for informing the parser which file and line number it is processing (debug purpose) */ + count(); + return(POUND); + } + +">>" { + count(); + return(SHIFTRIGHT); + } +"<<" { + count(); + return(SHIFTLEFT); + } +"^^" { + count(); + return(RAISEDPOWER); + } + +"[" | +"]" | +"^" | +";" | +"," | +":" | +"=" | +"(" | +")" | +"." | +"&" | +"!" | +"~" | +"-" | +"+" | +"*" | +"/" | +"%" | +"<" | +">" | +"|" | +"?" { + /* valid operators */ + count(); + yylval.stype = yytext; + return(* yylval.stype); + } + +"{" { + count(); + open_brace(); + yylval.stype = yytext; + return(* yylval.stype); + } +"}" { + count(); + close_brace(); + yylval.stype = yytext; + return(* yylval.stype); + } + +[ \t\n\r]+ { + /* white spaces and newlines are ignored */ + count(); + } + +<> { + /* do a count on bracket matching... */ + if (0 == count_brace()) + { + if (!initialCompile && !globalErrorFlag) + MIFFMessage("mIFF successfully compiled!\n", 0); + } + + yyterminate(); /* tell yyparse() it's time to quit! DO NOT comment or delete this line! */ + } + +. { + /* anything that's not a rule from above goes here */ + count(); + yyerror((char *) yytext); + } +%% + +/*--------------------** +** C supporting codes ** +**--------------------*/ + +/*------------------** +** static variables ** +**------------------*/ +static char *MIFFInputStream; +int column = 0; +int line_num = 1; +int line_num2 = 1; +char error_line_buffer[4096]; +long brace_counter = 0; + + +/*---------------------------------------------------------------------** +** Initialize all the static variables before all calls to MIFFCompile ** +**---------------------------------------------------------------------*/ +void initParser(void) +{ + line_num = 1; + column = 0; + + brace_counter = 0; + error_line_buffer[0] = 0; + + globalErrorFlag = 0; + + memset(inFileName, 0, 512); /* make sure to change this size if the char array gets bigger... */ +} + +/*-------------------------------------------------** +** generate a dialog box to MFC to report an error ** +**-------------------------------------------------*/ +void yyerror(char *err) /* called by yyparse() */ +{ + char myString[256]; + + if (!initialCompile) + { + /* spit it out in MSDev error format */ + sprintf(myString, "\n%s(%d) : yyERROR : %s\n>>%s<<", inFileName, line_num, err, error_line_buffer); + MIFFMessage(myString, 1); + globalErrorFlag = 1; + MIFFSetError(); /* set global error flag for shell as well */ + yyterminate(); + } + +} + +/*-------------------------** +** our version of YY_INPUT ** +**-------------------------*/ +int MIFFYYInput(char *buf,int max_size) +{ + int len = strlen(MIFFInputStream); + int n = max_size < len ? max_size : len; + if (n > 0) + { + memcpy(buf,MIFFInputStream,n); + MIFFInputStream += n; + } + return(n); +} + +/*------------------------------------------------------------** +** line and column counter for error searching during compile ** +**------------------------------------------------------------*/ +void count() +{ + int i; + static char *elb = error_line_buffer; + for (i = 0; yytext[i] != '\0'; i++) + { + if (yytext[i] == '\n') + { + column = 0; + line_num++; + elb = error_line_buffer; + } + else + { + *elb++ = yytext[i]; + if (yytext[i] == '\t') + column += SPACE_COUNT_FOR_TAB - (column & (SPACE_COUNT_FOR_TAB - 1)); + else + column++; + } + *elb = 0; + } +} + +/*--------------------------------------------------------------** +** sets up current line number and filename the error came from ** +**--------------------------------------------------------------*/ +void setCurrentLineNumber(int lineNum, char * fileName, int mysteryNum) +{ + line_num = lineNum; + strcpy(inFileName, fileName); + line_num2 = mysteryNum; +} + +/*----------------------------------------------** +** MIFFCompile called by CMIFFView::OnCompile() ** +**----------------------------------------------*/ +void MIFFCompile(char *inputStream, char *inputFileName) +{ + MIFFInputStream = inputStream; + yyrestart(0); + initParser(); + initialCompile = 0; + strcpy(inFileName, inputFileName); + yyparse(); +} + +void MIFFCompileInit(char *inputStream, char *inputFileName) +{ + MIFFInputStream = inputStream; + yyrestart(0); + initParser(); + initialCompile = 1; + strcpy(inFileName, inputFileName); + yyparse(); +} + +/*---------------------------------------** +** matching of open/close brace checking ** +**---------------------------------------*/ +void open_brace(void) +{ + brace_counter++; +} + +void close_brace(void) +{ + brace_counter--; +} + +/* + * what: count_brace(): + * return: 0 == all braces matched + */ +int count_brace(void) +{ + if (0 == brace_counter) /* things are fine... */ + return(0); + + /* if this is called, we should have 0 brace counter if not, we have a mis-match*/ + if (brace_counter > 0) + { + /* a mismatch */ + yyerror("There are more OPEN brackets then closed"); + } + else if (brace_counter < 0) + { + yyerror("There are more CLOSED brackets then open"); + } + + return(-1); +} + +/*-----------------------------------------------------------------------** +** FLEX.SLK requires this prototype function so I'm forced to do this... ** +**-----------------------------------------------------------------------*/ +int yywrap() +{ + return(1); +} + +void printString(char *str) +{ + char ts[256]; + sprintf(ts, "%s - %s", str, yytext); + MIFFMessage(ts, 0); +} diff --git a/engine/client/application/Miff/src/win32/parser.yac b/engine/client/application/Miff/src/win32/parser.yac new file mode 100644 index 00000000..1bfec252 --- /dev/null +++ b/engine/client/application/Miff/src/win32/parser.yac @@ -0,0 +1,1004 @@ +%expect 1 +%{ +/*-----------------------------------------------------------------------------** +** FILE: parser.yac ** +** (c) 1998 - Bootprint GTInteractive ** +** ** +** DESCRIPTION: parser for mIFF ** +** ** +** AUTHOR: Hideki Ikeda ** +** HISTORY: ** +** ** +** Notes: companion to parser.lex ** +**-----------------------------------------------------------------------------*/ + +/*---------------** +** C declaration ** +**---------------*/ +#pragma warning (disable: 4005) /* macro redefinition - bision.simple redefines alloca() */ +#pragma warning (disable: 4127) /* conditional expression is constant - in bison.simple */ +#pragma warning (disable: 4131) /* uses old-style declarator - mostly in bison.simple */ +#pragma warning (disable: 4244) /* possible loss of data due to conversion from one type to another - bision.simple */ +#pragma warning (disable: 4701) /* local variable ('yyval' in first case) may be used without having been initialed */ +// #pragma warning (disable: 6311) /* compiler malloc.h: see previous definition of alloca() */ + +/* include files */ +#include /* for pow() and stuff */ +#include +#include /* for toupper() */ +#include /* for wide character (16bit) strings */ + +#include +#include + +/*----------------------------------------------------------------** +** debug options, turn these on to TEST ONLY! don't leave these ** +** switch on, it's annoying as hell in console mode! ** +** NOTE: if you turn YYERROR_VERBOSE on, you MUST have YYDEBUG! ** +** IMHO, it's better off using primitive printf() method to debug ** +**----------------------------------------------------------------*/ +#define YYERROR_VERBOSE 1 +#define YYDEBUG 1 + +#undef YYERROR_VERBOSE +#undef YYDEBUG + +/* external prototype declaration */ +extern void MIFFMessage(char *message); /* found in mIFF.CPP */ +extern char * MIFFallocString(int sizeOfString); +extern void MIFFfreeString(char * pointer); +extern int validateTargetFilename(char *fname, int fnameSize); /* found mIFF.CPP */ +extern void yyerror(char *); +extern int yylex(void); +extern void setCurrentLineNumber(int lineNum, char * fileName, int mysteryNum); +extern void MIFFSetIFFName(const char *newFileName); +extern void MIFFinsertForm(const char *formName); +extern void MIFFinsertChunk(const char *chunkName); +extern void MIFFinsertChunkData(void * buffer, unsigned bufferSize); +extern int MIFFloadRawData(char *fname, void * buffer, unsigned maxBufferSize); +extern void MIFFexitChunk(void); +extern void MIFFexitForm(void); +extern unsigned long MIFFgetLabelHash(char *inputStream); + +/* local prototype declaration */ +void initGlobalVars(void); +void checkArgs(void); +void checkPragmas(void); + +void includeBinary(char *fname); + +void write32(long i32); +void write16(short i16); +void write8(char i8); +void writeU32(unsigned long ui32); +void writeU16(unsigned short ui16); +void writeU8(unsigned char u8); +void writeDouble(double d); +void writeFloat(float f); +void writeString(char *s); +void writeString16(char *s); +void writeLabelHash(char *s); +void writeTag(char *tag); +void writeSize(unsigned long size); +void writeData(void *dataPtr, unsigned dataSize); + +void initSymTable(void); +long searchEnumSymbolTable(char *symString); +long getEnumValue(long index); +void addEnumSymbol(char *symString, long value); +void parseESCstring(char *str, char *targetBuffer, int sizeOfTarget); + +/*----------------------------------------------** +** Global vars used by all functions and parser ** +**----------------------------------------------*/ +char err_msg[256]; +int errorFlag; + +/*-----------------------------------------------------------------------------** +** NOTE: this symbol table is ONLY used to construct symbols for enum table!!! ** +**-----------------------------------------------------------------------------*/ +#define MAX_SYMBOLS (1024) /* total number of symbols it can grow to... */ +#define MAX_SYMCHARS (128) /* I label thee insane if you have more the 128 char for your variable! */ +struct structEnumSymTableType +{ + char symbol[MAX_SYMCHARS]; + long value; +}; + +struct structEnumSymTableType symbolEnumTable[MAX_SYMBOLS]; +unsigned currSymIndex = 0; +long lastValue = -1; +char id[MAX_SYMCHARS]; + +/* vars set by pragmas */ +#define MAX_BUFFER_SIZE (16 * 1024 * 1024) +#define MAX_STRING_SIZE (512) +char drive[8]; +char directory[MAX_STRING_SIZE/2]; +char filename[MAX_STRING_SIZE/2]; +char extension[8]; +char outFileName[MAX_STRING_SIZE]; +int usePragmas; + +/*------------------------------------------------------------------------** +** The IRONY of these so-called temp-data's that are GLOBAL is ** +** that they aren't temp if functions called within are also using it ** +** This really gives me the creeps and goosbumps! DOWN with GLOBAL VARS! ** +**------------------------------------------------------------------------*/ +int iTemp, jTemp; +char byteTemp; +short wordTemp; +char tempStr[MAX_STRING_SIZE]; + +%} + +/*--------------------** +** Bison declarations ** +**--------------------*/ +%union { + long ltype; + double dtype; + char *stype; + char chtype; + + int tokentype; +} + +/*------------------------------------------------** +** define tokens defined in lex file ** +** NOTE: all LITERALs are treated as signed long ** +** all FLOAT_LITERALs are treated as double ** +**------------------------------------------------*/ +%token CHAR_LIT +%token STR_LIT +%token IDENTIFIER +%token LIT +%token FLOAT_LIT + +/* all command tokens are type */ +%token INT32 +%token INT16 +%token INT8 +%token UINT32 +%token UINT16 +%token UINT8 +%token FLOAT +%token DOUBLE +%token STRING +%token WSTRING +%token LABELHASH + +%token FORM +%token CHUNK +%token PRAGMA +%token PRAGMA_DRIVE PRAGMA_DIR PRAGMA_FNAME PRAGMA_EXT +%token ENUMSTRUCT +%token INCLUDESOURCE +%token INCLUDEBIN +%token INCLUDEIFF +%token SIN +%token COS +%token TAN +%token ACOS +%token ASIN +%token ATAN +%token POUND +%token SHIFTRIGHT +%token SHIFTLEFT +%token RAISEDPOWER + +%% + +/*------------------------------------------------------------------------** +** Begin Grammar rules ** +** ** +** Note: if possible, always try to use left recurrsion rather then right ** +** to save stack depth... ** +**------------------------------------------------------------------------*/ +mIFFSource: + { + /* initialize some global varibles before we start */ + initGlobalVars(); + checkArgs(); + } + preprocessor + { + /* take care of any mIFF related preprocessors that we might encounter */ + checkPragmas(); + } + body + ; + +/*----------------------** +** Preprocessor handler ** +**----------------------*/ +preprocessor: { /* we don't really have to have preprocessor */} + | preprocessor pragma + | preprocessor debugInfo /* we have to have debugInfo or else pragma gets confused when it finds a # line */ + ; + +pragma: PRAGMA PRAGMA_DRIVE STR_LIT { + if (usePragmas) + { + strcpy(drive, $3); + if (strlen(drive) > 2) + { + sprintf(err_msg, "Drive [%s] is not a valid drive [must be in C: format]", drive); + yyerror(err_msg); + } + drive[1] = ':'; + drive[2] = 0; + } + MIFFfreeString($3); + } + | PRAGMA PRAGMA_DIR STR_LIT { + if (usePragmas) + { + strcpy(directory, $3); + if (directory[strlen(directory)] != '\\') + directory[strlen(directory)] = '\\'; + directory[strlen(directory) + 1] = 0; + } + MIFFfreeString($3); + } + | PRAGMA PRAGMA_FNAME STR_LIT { + if (usePragmas) + strcpy(filename, $3); + MIFFfreeString($3); + } + | PRAGMA PRAGMA_EXT STR_LIT { + if (usePragmas) + strcpy(extension, $3); + MIFFfreeString($3); + } + | PRAGMA IDENTIFIER STR_LIT { + sprintf(err_msg, "Unknown PRAGMA identifier [%s]", $2); + yyerror(err_msg); + MIFFfreeString($2); + MIFFfreeString($3); + } + ; + +/*-------------------------------------------------------** +** This is the #line pragmas in a format of: ** +** # lineNum "FileName" mysteryNumber ** +** We call setCurrentLineNumber so when an error occurs, ** +** it will be sync'd to correct filename and linenumber ** +**-------------------------------------------------------*/ +debugInfo: POUND LIT STR_LIT { setCurrentLineNumber($2, $3, 0); MIFFfreeString($3);} + | POUND LIT STR_LIT LIT { setCurrentLineNumber($2, $3, $4); MIFFfreeString($3);} + ; + +/*-----------------------** +** The main body section ** +**-----------------------*/ +body: /* body can be empty */ + | body form formbody + | body chunk chunkbody + | body enumSection + | body includesource { /* do nothing... should not exist if went thru the preprocessor */ } + | body includeIFF + | body debugInfo + ; + +/*------------------------** +** Enumeration definition ** +**------------------------*/ +enumSection: ENUMSTRUCT enumDeclare '{' enumBody '}' enumType ';' { /* enumSection */ } + ; + +enumDeclare: { /* could have no declaration */ lastValue = -1; } + | IDENTIFIER { /* enumDeclare: ID */ lastValue = -1; MIFFfreeString($1);} + ; + +enumBody: { /* enumBody: can be empty list */ } + | enumAssign { /* enumAssign */ } + | enumBody ',' enumAssign { /* enumAssign, enumBody */ } + ; + +enumAssign: IDENTIFIER '=' exprL { + addEnumSymbol($1, $3); + MIFFfreeString($1); + } + | IDENTIFIER { /* in this case, inc 1 from last count */ + addEnumSymbol($1, ++lastValue); + MIFFfreeString($1); + } + ; + +enumType: /* type declaration can be empty */ + | enumList + ; + +enumList: IDENTIFIER { /* enumList: just ID */ MIFFfreeString($1);} + | enumList ',' IDENTIFIER { /* enumList: ID, enumList */ MIFFfreeString($3);} + ; + +/*----------------------------** +** different types of include ** +**----------------------------*/ +includesource: INCLUDESOURCE STR_LIT { /* do nothing... because CCCP/preprocessor takes care of this*/ MIFFfreeString($2);} + ; + +includebin: INCLUDEBIN STR_LIT { includeBinary($2); MIFFfreeString($2);} + ; + +includeIFF: INCLUDEIFF STR_LIT { includeBinary($2); MIFFfreeString($2);} + ; + +/*------------------** +** the FORM section ** +**------------------*/ +form: FORM STR_LIT { + /* first make sure we have 4 char for FORM name */ + if (strlen($2) > 4) + { + sprintf(err_msg, "FORM name %s greater then 4 char", $2); + yyerror(err_msg); + } + else if (!errorFlag) + { + /* pack the string with ' ' (spaces) if less then 4 chars */ + strcpy(tempStr, $2); + if (strlen(tempStr) < 4) + { + /* pack the string */ + for (iTemp = strlen(tempStr);iTemp < 4; iTemp++) + { + tempStr[iTemp] = ' '; /* pack it with space */ + } + } + + /* let's make sure we don't have a smart ass who wants to do form "FORM" */ + if ((toupper(tempStr[0]) == 'F') && + (toupper(tempStr[1]) == 'O') && + (toupper(tempStr[2]) == 'R') && + (toupper(tempStr[3]) == 'M')) + { + yyerror("FORM name CANNOT BE 'FORM'... nice try bozo!"); + } + + /* FORM */ + MIFFinsertForm(tempStr); + } + MIFFfreeString($2); + } + ; + +formbody: '{' formelements '}' { if (!errorFlag) MIFFexitForm(); }; + +formelements: body { /* recursion of multiple depth in form is allowed */ } + | INCLUDEBIN STR_LIT { + yyerror("Found attempt to include binary file inside FORM\nBinary file inclusion ONLY allowed inside a CHUNK!\nError"); + MIFFfreeString($2); + } + ; + +/*-------------------** +** the CHUNK section ** +**-------------------*/ +chunk: CHUNK STR_LIT { + /* first make sure we have 4 char for CHUNK name */ + if (strlen($2) > 4) + { + sprintf(err_msg, "CHUNK name %s greater then 4 char", $2); + yyerror(err_msg); + } + else if (!errorFlag) + { + /* pack the string with ' ' (spaces) if less then 4 chars */ + strcpy(tempStr, $2); + if (strlen(tempStr) < 4) + { + /* pack the string */ + for (iTemp = strlen(tempStr);iTemp < 4; iTemp++) + { + tempStr[iTemp] = ' '; /* pack it with space */ + } + } + + /* let's make sure we don't have a smart ass who wants to do chunk "FORM" */ + if ((toupper(tempStr[0]) == 'F') && + (toupper(tempStr[1]) == 'O') && + (toupper(tempStr[2]) == 'R') && + (toupper(tempStr[3]) == 'M')) + { + yyerror("CHUNK name CANNOT BE 'FORM'... nice try bozo!"); + } + + MIFFinsertChunk(tempStr); + } + MIFFfreeString($2); + } + ; + +chunkbody: '{' chunkelements '}' { if (!errorFlag) MIFFexitChunk(); }; + +chunkelements: /* can be empty */ + | chunkelements memalloc + | chunkelements includebin + | chunkelements debugInfo + | chunkelements includeIFF { yyerror("Found attempt to include IFF (binary) file inside CHUNK\nIFF inclusion ONLY allowed outside a CHUNK!\nError"); } + ; + +memalloc: INT32 l32AllocExpr { } + | INT16 l16AllocExpr { } + | INT8 l8AllocExpr { } + | UINT32 lU32AllocExpr { } + | UINT16 lU16AllocExpr { } + | UINT8 lU8AllocExpr { } + | FLOAT fAllocExpr { } + | DOUBLE dAllocExpr { } + | LABELHASH STR_LIT { + writeLabelHash($2); + } + | STRING STR_LIT { writeString($2); + /* now, add a NULL termination for this string */ + byteTemp = 0; write8(byteTemp); + MIFFfreeString($2); + } + | WSTRING STR_LIT { writeString16($2); + /* now, add a NULL termination for this string */ + wordTemp = 0; write16(wordTemp); + MIFFfreeString($2); + } + ; + +l32AllocExpr: exprL { write32($1); } + | l32AllocExpr ',' exprL { write32($3); } + ; + +l16AllocExpr: exprL { write16((short) $1); } + | l16AllocExpr ',' exprL { write16((short) $3); } + ; + +l8AllocExpr: exprL { write8((char) $1); } + | l8AllocExpr ',' exprL { write8((char) $3); } + ; + +lU32AllocExpr: exprL { writeU32($1); } + | lU32AllocExpr ',' exprL { writeU32($3); } + ; + +lU16AllocExpr: exprL { writeU16((unsigned short) $1); } + | lU16AllocExpr ',' exprL { writeU16((unsigned short) $3); } + ; + +lU8AllocExpr: exprL { writeU8((unsigned char) $1); } + | lU8AllocExpr ',' exprL { writeU8((unsigned char) $3); } + ; + +fAllocExpr: exprD { writeFloat((float) $1); } + | fAllocExpr ',' exprD { writeFloat((float) $3); } + ; + +dAllocExpr: exprD { writeDouble($1); } + | dAllocExpr ',' exprD { writeDouble($3); } + ; + + +/*-------------------------** +** expression for integers ** +**-------------------------*/ +exprL: exprL '+' factorL { $$ = $1 + $3; } + | exprL '-' factorL { $$ = $1 - $3; } + | exprL SHIFTLEFT factorL { $$ = $1 << $3; } + | exprL SHIFTRIGHT factorL { $$ = $1 >> $3; } + | exprL '&' factorL { $$ = $1 & $3; } + | exprL '|' factorL { $$ = $1 | $3; } + | exprL '^' factorL { $$ = $1 ^ $3; } + | factorL { $$ = ($1); } + ; + +factorL: factorL '*' termL { $$ = $1 * $3; } + | factorL '/' termL { $$ = $1 / $3; } + | factorL '%' termL { $$ = $1 % $3; } + | termL { $$ = ($1); } + ; + +termL: LIT { $$ = $1; } + | '~' termL { $$ = ~$2; } /* bitwise NOT */ + | '-' termL { $$ = -$2; } /* Unary minus */ + | '+' termL { $$ = $2; } /* Unary plus */ + | '(' exprL ')' { $$ = ($2); } + | IDENTIFIER { /* assume it's enum symbol */ + $$ = (signed long) getEnumValue(searchEnumSymbolTable($1)); + MIFFfreeString($1); + } + ; + +/*-----------------------** +** expression for floats ** +**-----------------------*/ +exprD: exprD '+' factorD { $$ = $1 + $3; } + | exprD '-' factorD { $$ = $1 - $3; } + | exprD RAISEDPOWER factorD { $$ = pow($1, $3);} /* exponentiation */ + | factorD { $$ = ($1); } + ; + +factorD: factorD '*' termD { $$ = $1 * $3; } + | factorD '/' termD { $$ = $1 / $3; } + | termD { $$ = ($1); } + ; + +termD: FLOAT_LIT { $$ = $1; } + | LIT { $$ = (double) $1; } /* we should be able to handle values that are integer and treat it as float */ + | '-' termD { $$ = -$2; } /* Unary minus */ + | '+' termD { $$ = $2; } /* Unary plus */ + | '(' exprD ')' { $$ = ($2); } + | SIN '(' exprD ')' { $$ = sin( $3 ); } + | COS '(' exprD ')' { $$ = cos( $3 ); } + | TAN '(' exprD ')' { $$ = tan( $3 ); } + | ACOS '(' exprD ')' { $$ = acos( $3 ); } + | ASIN '(' exprD ')' { $$ = asin( $3 ); } + | ATAN '(' exprD ')' { $$ = atan( $3 ); } + | IDENTIFIER { /* assume it's enum symbol */ + $$ = (signed long) getEnumValue(searchEnumSymbolTable($1)); + MIFFfreeString($1); + } + ; + +%% + +/*-------------------------------------------** +** and now... the supporting C functions... ** +**-------------------------------------------*/ +void initGlobalVars(void) +{ + /* assign defaults */ + drive[0] = 0; + directory[0] = 0; + filename[0] = 0; + extension[0] = 0; + err_msg[0] = 0; + usePragmas = 1; /* default to #pragmas enabled because as a stand-alone .YAC, we have no knowledge of outFileName */ + + errorFlag = 0; + + initSymTable(); +} + +void checkPragmas(void) +{ + int indexOriginal, indexDest; + char _tempStr[512]; + + if (usePragmas) + { + /* check after pre processor if output target is still NULL */ + if (!drive[0] && !errorFlag) + { + yyerror("Drive pragma not defined"); + errorFlag = 1; + } + if (!directory[0] && !errorFlag) + { + yyerror("Directory pragma not defined"); + errorFlag = 1; + } + if (!filename[0] && !errorFlag) + { + yyerror("Filename pragma not defined"); + errorFlag = 1; + } + if (!extension[0] && !errorFlag) + { + yyerror("Extension pragma not defined"); + errorFlag = 1; + } + + if (!errorFlag) + { + /* create an output file */ + strcpy(_tempStr, directory); /* copy directory to _tempStr because we'll be messing with directory */ + for (indexOriginal = 0, indexDest = 0; indexOriginal < (int) strlen(_tempStr); indexOriginal++) + { + /* search for double-slashes and convert it to single slash */ + if ((_tempStr[indexOriginal] == '\\') && (_tempStr[indexOriginal+1] == '\\')) + { + directory[indexDest] = '\\'; + indexOriginal++; + } + else + directory[indexDest] = _tempStr[indexOriginal]; /* copy current position of _tempStr to directory */ + indexDest++; + directory[indexDest] = 0; /* force NULL termination */ + } + sprintf(outFileName, "%s%s%s%s", drive, directory, filename, extension); + } + } /* if usePragmas */ + + MIFFSetIFFName(outFileName); /* tell mIFF we want to use this filename instead of whatever it has! */ +} + +/*--------------------------------------------------------------------------------------** +** This function is called early in the process to find out if usePragma flag was set ** +** in the command line or not. If it was, mIFF already has the outfile and will stuff ** +** it into the outFileName data pool. Even if mIFF had an idea of what the output file ** +** name is, if usePragma flag returned said it is true, then #pragas in the mIFF source ** +** is used instead and overrides whatever file name it has returned. ** +** see usePragmas() for more details. ** +**--------------------------------------------------------------------------------------*/ +void checkArgs(void) +{ + /* request an external function (found in either mIFF.CPP or mIFFView.CPP) to see if pragmas and filename was set... */ + usePragmas = validateTargetFilename(outFileName, sizeof(outFileName)); +} + +/*----------------------------** +** Write to FILE functions... ** +**----------------------------*/ +void write32(long i32) +{ + MIFFinsertChunkData(&i32, sizeof(long)); +} + +void write16(short i16) +{ + MIFFinsertChunkData(&i16, sizeof(short)); +} + +void write8(char i8) +{ + MIFFinsertChunkData(&i8, sizeof(char)); +} + +void writeU32(unsigned long ui32) +{ + MIFFinsertChunkData(&ui32, sizeof(long)); +} + +void writeU16(unsigned short ui16) +{ + MIFFinsertChunkData(&ui16, sizeof(short)); +} + +void writeU8(unsigned char ui8) +{ + MIFFinsertChunkData(&ui8, sizeof(char)); +} + +void writeDouble(double d) +{ + MIFFinsertChunkData(&d, sizeof(double)); +} + +void writeFloat(float f) +{ + MIFFinsertChunkData(&f, sizeof(float)); +} + +void writeString(char *s) +{ + char tempS[MAX_STRING_SIZE]; + parseESCstring(s, tempS, MAX_STRING_SIZE); + + MIFFinsertChunkData(tempS, strlen(tempS)); +} + +void writeString16(char *s) +{ + char tempS[MAX_STRING_SIZE]; + int charCount = 0; + wchar_t wtempStr[512]; /* just to be on the safe side, allocating huge array... */ + + parseESCstring(s, tempS, MAX_STRING_SIZE); + + /* make sure string length is less then the allocated wchar size */ + if ((strlen(tempS) * sizeof(wchar_t)) > (512* sizeof(wchar_t))) + yyerror("wstring: 16bit string too long to handle in buffer!\n"); + else + { + /* call MultiByteString to WideCharString function */ + charCount = mbstowcs(wtempStr, tempS, strlen(tempS)); + writeData(wtempStr, charCount * sizeof(wchar_t)); + } +} + +void writeLabelHash(char *s) +{ + writeU32(MIFFgetLabelHash(s)); +} + +/* search from escape string such as \n and convert it to actual byte */ +void parseESCstring(char *str, char *targetBuffer, int sizeOfTarget) +{ + char *sPtr = str; + int strIndex = 0; + char numString[32]; /* hopefully, never go over 3 char i.e. \x0FF */ + int numIndex = 0; + int tempNum = 0; + int exitParser = 0; + int loopFlag = 0; + + /* memory hog but cute way to convert ascii hex to number */ + int hexTable[256]; + memset(hexTable, 0xFF, 256); + hexTable['0'] = 0x00; + hexTable['1'] = 0x01; + hexTable['2'] = 0x02; + hexTable['3'] = 0x03; + hexTable['4'] = 0x04; + hexTable['5'] = 0x05; + hexTable['6'] = 0x06; + hexTable['7'] = 0x07; + hexTable['8'] = 0x08; + hexTable['9'] = 0x09; + hexTable['A'] = 0x0A; hexTable['a'] = 0x0A; + hexTable['B'] = 0x0B; hexTable['b'] = 0x0B; + hexTable['C'] = 0x0C; hexTable['c'] = 0x0C; + hexTable['D'] = 0x0D; hexTable['d'] = 0x0D; + hexTable['E'] = 0x0E; hexTable['e'] = 0x0E; + hexTable['F'] = 0x0F; hexTable['f'] = 0x0F; + + memset(targetBuffer, 0, sizeOfTarget); + while ((*sPtr) && !exitParser) /* assume we can go until NULL termination */ + { + /* check for escape sequences */ + if (*sPtr == '\\') + { + sPtr++; /* check out next character */ + switch (tolower(*sPtr)) + { + case 'a': /* BELL */ + { + targetBuffer[strIndex++] = '\a'; + break; + } + + case 'b': /* BACKSPACE */ + { + targetBuffer[strIndex++] = '\b'; + break; + } + + case 'f': /* FORMFEED */ + { + targetBuffer[strIndex++] = '\a'; + break; + } + + case 'n': /* NEWLINE */ + { + targetBuffer[strIndex++] = '\n'; + break; + } + + case 'r': /* CARRIAGE RETURN */ + { + targetBuffer[strIndex++] = '\r'; + break; + } + + case 't': /* TAB */ + { + targetBuffer[strIndex++] = '\t'; + break; + } + + case 'v': /* VERTICAL TAB */ + { + targetBuffer[strIndex++] = '\v'; + break; + } + + case '\'': /* SINGLE QUOTE */ + { + targetBuffer[strIndex++] = '\''; + break; + } + + case '\"': /* DOUBLE QUOTE */ + { + targetBuffer[strIndex++] = '\"'; + break; + } + + case '\\': /* BACKSLASH */ + { + targetBuffer[strIndex++] = '\\'; + break; + } + + case '?': /* LITERAL QUESTION MARK */ + { + targetBuffer[strIndex++] = '\?'; + break; + } + + case '0': /* ASCII octal */ + case '1': /* ASCII octal */ + case '2': /* ASCII octal */ + case '3': /* ASCII octal */ + case '4': /* ASCII octal */ + case '5': /* ASCII octal */ + case '6': /* ASCII octal */ + case '7': /* ASCII octal */ + { + /* read until non-digit encountered - if octal value is greater then \377 (400 or more) it is bigger the 255! */ + numIndex = 0; + + while ((*sPtr >= '0') && (*sPtr <= '7') && (*sPtr)) + { + numString[numIndex++] = *sPtr; + sPtr++; + if (numIndex > 3) + { + sprintf(err_msg, "Escape sequence Octal numbers greater then\noctal o400 (256 decimal)! [more then 3 digits]", *sPtr); + yyerror(err_msg); + exitParser = 1; + } + } + + /* now we should have string of octal number in numString */ + if (!exitParser) + { + if (numIndex == 3) + tempNum = (hexTable[numString[0]] * 64) + (hexTable[numString[1]] * 8) + hexTable[numString[2]]; + else if (numIndex == 2) + tempNum = (hexTable[numString[0]] * 8) + hexTable[numString[1]]; + else + tempNum = hexTable[numString[0]]; + + if (tempNum > 255) + { + sprintf(err_msg, "Escape sequence Octal numbers greater then\noctal o400 (256 decimal)!", tempNum); + yyerror(err_msg); + exitParser = 1; + } + + if (!exitParser) + targetBuffer[strIndex++] = tempNum; + } + break; + } + + case 'x': /* ASCII hex */ + { + /* we have to make sure the hex value is less then 256! */ + numIndex = 0; + loopFlag = 1; + sPtr++; /* skip the 'x' */ + + while ((0xFF != hexTable[*sPtr]) && (*sPtr)) + { + numString[numIndex++] = *sPtr; + sPtr++; + if (numIndex > 3) + { + sprintf(err_msg, "Escape sequence HEX numbers greater then 0x100\n(256 decimal)! [more then 3 digits]", *sPtr); + yyerror(err_msg); + exitParser = 1; + } + } + + if (!exitParser) + { + if (numIndex == 3) + tempNum = (hexTable[numString[0]] * 0x100) + (hexTable[numString[1]] * 0x10) + hexTable[numString[2]]; + else if (numIndex == 2) + tempNum = (hexTable[numString[0]] * 0x10) + hexTable[numString[1]]; + else + tempNum = hexTable[numString[0]]; + } + + if (tempNum > 255) + { + sprintf(err_msg, "Escape sequence HEX numbers greater then 0x100\n(256 decimal)!", *sPtr); + yyerror(err_msg); + exitParser = 1; + } + + if (!exitParser) + targetBuffer[strIndex++] = tempNum; + + break; + } + + case '8': + case '9': + { + /* they tried to do octal mode, but 8 and 9 is not in the definition of octal */ + yyerror("Attempted to enter escape sequence with non-octal value"); + exitParser = 1; + break; + } + + default: + sprintf(err_msg, "Unknown ESCape sequence \\%c found in string.\n", *sPtr); + yyerror(err_msg); + exitParser = 1; + break; + } + } + else + targetBuffer[strIndex++] = *sPtr; + sPtr++; + } +} + + +void writeData(void *dataPtr, unsigned dataSize) +{ + MIFFinsertChunkData(dataPtr, dataSize); +} + + +/* NOTE: includeBinary modifies fsize for the caller to access for adjusting the chunk size */ +void includeBinary(char *fname) +{ + char buffer[MAX_BUFFER_SIZE+1]; + int fsize = 0; + + fsize = MIFFloadRawData(fname, buffer, MAX_BUFFER_SIZE); + MIFFinsertChunkData(buffer, fsize); +} + +/*--------------------------------------------------------------------------------** +** Following functions below are all used for constructing, adding, and searching ** +** the symbol table created by enum keyword. It is at this moment, set in a way ** +** that if two identical symbols are added to the list, it will use the first ** +** symbol added to the list and ignores the rest (because of forward search) ** +**--------------------------------------------------------------------------------*/ +void initSymTable(void) +{ + memset(symbolEnumTable, 0, sizeof(struct structEnumSymTableType) * MAX_SYMBOLS); + currSymIndex = 0; + lastValue = -1; +} + +/* Searches thru the symbol table and returns the index */ +long searchEnumSymbolTable(char *symString) +{ + long index = 0; + int found = 0; + while ((0 != symbolEnumTable[index].symbol[0]) && !found) + { + + if (0 == strcmp(symbolEnumTable[index].symbol, symString)) + { + found = 1; + break; + } + else + index++; + } + + if (!found) + { + index = -1; + sprintf(err_msg, "Undefined symbol %s", symString); + yyerror(err_msg); + } + + return(index); +} + +long getEnumValue(long index) +{ + if (index >= 0) + return(symbolEnumTable[index].value); + return(-1); +} + +void addEnumSymbol(char *symString, long value) +{ + if (MAX_SYMCHARS < strlen(symString)) + { + /* somebody insane decided to use variable longer then max size! */ + sprintf(err_msg, "%s is longer then %d characters! [value: %d]", symString, MAX_SYMCHARS, value); + yyerror(err_msg); + } + else + { + strcpy(symbolEnumTable[currSymIndex].symbol, symString); + symbolEnumTable[currSymIndex].value = value; + lastValue = value; + currSymIndex++; + if (MAX_SYMBOLS < currSymIndex) + { + sprintf(err_msg, "Symbol table reached maximum size of %d", MAX_SYMBOLS); + yyerror(err_msg); + } + } +} diff --git a/engine/server/application/CentralServer/src/win32/FirstCentralServer.cpp b/engine/server/application/CentralServer/src/win32/FirstCentralServer.cpp new file mode 100644 index 00000000..509e7da9 --- /dev/null +++ b/engine/server/application/CentralServer/src/win32/FirstCentralServer.cpp @@ -0,0 +1,5 @@ +// CentralServerPrecompiledHeader.cpp +// copyright 2001 Verant Interactive +// Author: Justin Randall + +#include "FirstCentralServer.h" diff --git a/engine/server/application/CentralServer/src/win32/WinMain.cpp b/engine/server/application/CentralServer/src/win32/WinMain.cpp new file mode 100644 index 00000000..6c760f37 --- /dev/null +++ b/engine/server/application/CentralServer/src/win32/WinMain.cpp @@ -0,0 +1,84 @@ +#include "FirstCentralServer.h" +#include "ConfigCentralServer.h" +#include "CentralServer.h" + +#include "sharedCompression/SetupSharedCompression.h" +#include "sharedDebug/SetupSharedDebug.h" +#include "sharedFile/SetupSharedFile.h" +#include "sharedFoundation/SetupSharedFoundation.h" +#include "sharedNetworkMessages/SetupSharedNetworkMessages.h" +#include "sharedRandom/SetupSharedRandom.h" +#include "sharedThread/SetupSharedThread.h" + +#include +#include + +//_____________________________________________________________________ +/* +int WINAPI WinMain( + HINSTANCE hInstance, // handle to current instance + HINSTANCE hPrevInstance, // handle to previous instance + LPSTR lpCmdLine, // pointer to command line + int nCmdShow // show state of window + ) + */ +int main(int argc, char ** argv) +{ //lint !e1065 //WinMain conflicts with clib + int i = 0; + +// UNREF(hPrevInstance); +// UNREF(nCmdShow); + + SetupSharedThread::install(); + SetupSharedDebug::install(1024); + + //-- setup foundation + SetupSharedFoundation::Data setupFoundationData(SetupSharedFoundation::Data::D_game); + + // command line hack + std::string cmdLine; + for(i = 1; i < argc; ++i) + { + cmdLine += argv[i]; + if(i + 1 < argc) + { + cmdLine += " "; + } + } +// setupFoundationData.hInstance = hInstance; + setupFoundationData.commandLine = cmdLine.c_str(); + setupFoundationData.createWindow = false; + setupFoundationData.clockUsesSleep = true; + + SetupSharedFoundation::install (setupFoundationData); + + SetupSharedCompression::install(); + + SetupSharedFile::install(false); + + SetupSharedNetworkMessages::install(); + + ConfigCentralServer::install(); + + cmdLine = ""; + // now, the real command line + for(i = 0; i < argc; ++i) + { + cmdLine += argv[i]; + if(i + 1 < argc) + { + cmdLine += " "; + } + } + + CentralServer::getInstance().setCommandLine(cmdLine); + + //-- run game + SetupSharedFoundation::callbackWithExceptionHandling(CentralServer::run); + + SetupSharedFoundation::remove(); + + return 0; +} + +//_____________________________________________________________________ diff --git a/engine/server/application/ChatServer/src/win32/WinMain.cpp b/engine/server/application/ChatServer/src/win32/WinMain.cpp new file mode 100644 index 00000000..8d0ac8fc --- /dev/null +++ b/engine/server/application/ChatServer/src/win32/WinMain.cpp @@ -0,0 +1,42 @@ +#include "FirstChatServer.h" +#include "ConfigChatServer.h" +#include "ChatServer.h" +#include "sharedCompression/SetupSharedCompression.h" +#include "sharedDebug/SetupSharedDebug.h" +#include "sharedFoundation/SetupSharedFoundation.h" +#include "sharedNetworkMessages/SetupSharedNetworkMessages.h" +#include "sharedThread/SetupSharedThread.h" + +#include +#include + +int main( int argc, char ** argv ) +{ + SetupSharedThread::install(); + SetupSharedDebug::install(1024); + + //-- setup foundation + SetupSharedFoundation::Data setupFoundationData(SetupSharedFoundation::Data::D_game); + + //setupFoundationData.hInstance = hInstance; + setupFoundationData.argc = argc; + setupFoundationData.argv = argv; + setupFoundationData.createWindow = false; + setupFoundationData.clockUsesSleep = true; + + SetupSharedFoundation::install (setupFoundationData); + + SetupSharedCompression::install(); + + SetupSharedNetworkMessages::install(); + + //-- setup game server + ConfigChatServer::install (); + + //-- run game + SetupSharedFoundation::callbackWithExceptionHandling(ChatServer::run); + + SetupSharedFoundation::remove(); + + return 0; +} diff --git a/engine/server/application/ConnectionServer/src/win32/FirstConnectionServer.cpp b/engine/server/application/ConnectionServer/src/win32/FirstConnectionServer.cpp new file mode 100644 index 00000000..137cad41 --- /dev/null +++ b/engine/server/application/ConnectionServer/src/win32/FirstConnectionServer.cpp @@ -0,0 +1 @@ +#include "FirstConnectionServer.h" diff --git a/engine/server/application/ConnectionServer/src/win32/WinMain.cpp b/engine/server/application/ConnectionServer/src/win32/WinMain.cpp new file mode 100644 index 00000000..236a8ebf --- /dev/null +++ b/engine/server/application/ConnectionServer/src/win32/WinMain.cpp @@ -0,0 +1,58 @@ +#include "FirstConnectionServer.h" +#include "ConfigConnectionServer.h" +#include "ConnectionServer.h" + +#include "sharedCompression/SetupSharedCompression.h" +#include "sharedDebug/SetupSharedDebug.h" +#include "sharedFile/SetupSharedFile.h" +#include "sharedFoundation/PerThreadData.h" +#include "sharedFoundation/SetupSharedFoundation.h" +#include "sharedNetworkMessages/SetupSharedNetworkMessages.h" +#include "sharedRandom/SetupSharedRandom.h" +#include "sharedThread/SetupSharedThread.h" + +#include + +int main(int argc, char ** argv) +{ + // command line hack + std::string cmdLine; + for(int i = 1; i < argc; ++i) + { + cmdLine += argv[i]; + if(i + 1 < argc) + { + cmdLine += " "; + } + } + + SetupSharedThread::install(); + SetupSharedDebug::install(1024); + +//-- setup foundation + SetupSharedFoundation::Data setupFoundationData(SetupSharedFoundation::Data::D_game); + +// setupFoundationData.hInstance = hInstance; + setupFoundationData.commandLine = cmdLine.c_str(); + setupFoundationData.createWindow = false; + setupFoundationData.clockUsesSleep = true; + + SetupSharedFoundation::install (setupFoundationData); + SetupSharedFile::install(false); + SetupSharedCompression::install(); + + SetupSharedNetworkMessages::install(); + SetupSharedRandom::install(int(time(NULL))); + + //-- setup game server + ConfigConnectionServer::install (); + + ConnectionServer::install(); + //-- run game + SetupSharedFoundation::callbackWithExceptionHandling(ConnectionServer::run); + ConnectionServer::remove(); + ConfigConnectionServer::remove(); + SetupSharedFoundation::remove(); + PerThreadData::threadRemove(); + return 0; +} diff --git a/engine/server/application/LogServer/src/win32/LoggingServerApiWrapper.cpp b/engine/server/application/LogServer/src/win32/LoggingServerApiWrapper.cpp new file mode 100644 index 00000000..78b377f5 --- /dev/null +++ b/engine/server/application/LogServer/src/win32/LoggingServerApiWrapper.cpp @@ -0,0 +1,16 @@ +// LoggingServerApiWrapper.cpp +// Copyright 2000-02, Sony Online Entertainment Inc., all rights reserved. +// Author: Justin Randall + +// This is a wrapper cpp to workaround PCH and RSP's. While a DSP +// may exclude a single file from using precompiled headers, the +// dsp builder has no way (I know of) to honor this behavior. +//----------------------------------------------------------------------- + +#include "FirstLogServer.h" +//#include "LoggingServerApi.cpp" + +//----------------------------------------------------------------------- + +//----------------------------------------------------------------------- + diff --git a/engine/server/application/LogServer/src/win32/WinMain.cpp b/engine/server/application/LogServer/src/win32/WinMain.cpp new file mode 100644 index 00000000..21d829c4 --- /dev/null +++ b/engine/server/application/LogServer/src/win32/WinMain.cpp @@ -0,0 +1,55 @@ +// ====================================================================== +// +// WinMain.cpp +// +// Copyright 2002 Sony Online Entertainment +// +// ====================================================================== + +#include "FirstLogServer.h" +#include "sharedFoundation/FirstSharedFoundation.h" +#include "LogServer.h" + +#include "sharedCompression/SetupSharedCompression.h" +#include "sharedDebug/SetupSharedDebug.h" +#include "sharedFile/SetupSharedFile.h" +#include "sharedFoundation/SetupSharedFoundation.h" +#include "sharedNetworkMessages/SetupSharedNetworkMessages.h" +#include "sharedThread/SetupSharedThread.h" + +// ====================================================================== + +int main(int argc, char **argv) +{ + SetupSharedThread::install(); + SetupSharedDebug::install(1024); + + //-- setup foundation + SetupSharedFoundation::Data setupFoundationData(SetupSharedFoundation::Data::D_game); + + setupFoundationData.argc = argc; + setupFoundationData.argv = argv; + setupFoundationData.createWindow = false; + setupFoundationData.clockUsesSleep = true; + + SetupSharedFoundation::install(setupFoundationData); + + SetupSharedCompression::install(); + + SetupSharedFile::install(false); + SetupSharedNetworkMessages::install(); + + //-- setup server + LogServer::install(); + + //-- run server + SetupSharedFoundation::callbackWithExceptionHandling(LogServer::run); + + LogServer::remove(); + SetupSharedFoundation::remove(); + SetupSharedThread::remove(); + + return 0; +} + +// ====================================================================== diff --git a/engine/server/application/LoginServer/src/win32/FirstLoginServer.cpp b/engine/server/application/LoginServer/src/win32/FirstLoginServer.cpp new file mode 100644 index 00000000..199562bb --- /dev/null +++ b/engine/server/application/LoginServer/src/win32/FirstLoginServer.cpp @@ -0,0 +1 @@ +#include "FirstLoginServer.h" diff --git a/engine/server/application/LoginServer/src/win32/WinMain.cpp b/engine/server/application/LoginServer/src/win32/WinMain.cpp new file mode 100644 index 00000000..f5c7056c --- /dev/null +++ b/engine/server/application/LoginServer/src/win32/WinMain.cpp @@ -0,0 +1,46 @@ +#include "FirstLoginServer.h" +#include "ConfigLoginServer.h" +#include "LoginServer.h" + +#include "sharedCompression/SetupSharedCompression.h" +#include "sharedDebug/SetupSharedDebug.h" +#include "sharedFile/SetupSharedFile.h" +#include "sharedFoundation/SetupSharedFoundation.h" +#include "sharedNetworkMessages/SetupSharedNetworkMessages.h" +#include "sharedRandom/SetupSharedRandom.h" +#include "sharedThread/SetupSharedThread.h" + +#include + +int main(int argc, char **argv) +{ + + SetupSharedThread::install(); + SetupSharedDebug::install(1024); + + //-- setup foundation + SetupSharedFoundation::Data setupFoundationData(SetupSharedFoundation::Data::D_game); + + setupFoundationData.argc = argc; + setupFoundationData.argv = argv; + setupFoundationData.createWindow = false; + + SetupSharedFoundation::install (setupFoundationData); + SetupSharedNetworkMessages::install(); + + SetupSharedCompression::install(); + + SetupSharedFile::install(false); + + SetupSharedRandom::install(time(NULL)); + + //-- setup game server + ConfigLoginServer::install (); + + //-- run game + SetupSharedFoundation::callbackWithExceptionHandling(LoginServer::run); + + SetupSharedFoundation::remove(); + + return 0; +} diff --git a/engine/server/application/MetricsServer/src/win32/WinMain.cpp b/engine/server/application/MetricsServer/src/win32/WinMain.cpp new file mode 100644 index 00000000..5955efba --- /dev/null +++ b/engine/server/application/MetricsServer/src/win32/WinMain.cpp @@ -0,0 +1,91 @@ +#include "sharedFoundation/FirstSharedFoundation.h" + +#include "ConfigMetricsServer.h" +#include "MetricsServer.h" + +#include "sharedCompression/SetupSharedCompression.h" +#include "sharedDebug/SetupSharedDebug.h" +#include "sharedFile/SetupSharedFile.h" +#include "sharedFoundation/Os.h" +#include "sharedFoundation/SetupSharedFoundation.h" +#include "sharedNetwork/NetworkHandler.h" +#include "sharedNetwork/SetupSharedNetwork.h" +#include "sharedNetworkMessages/SetupSharedNetworkMessages.h" +#include "sharedRandom/SetupSharedRandom.h" +#include "sharedThread/SetupSharedThread.h" + +#include + +// ====================================================================== + +int main(int argc, char ** argv) +{ + SetupSharedThread::install(); + SetupSharedDebug::install(1024); + + //-- setup foundation + SetupSharedFoundation::Data setupFoundationData(SetupSharedFoundation::Data::D_game); + + // command line hack + std::string cmdLine; + for(int i = 1; i < argc; ++i) + { + cmdLine += argv[i]; + if(i + 1 < argc) + { + cmdLine += " "; + } + } + + setupFoundationData.commandLine = cmdLine.c_str(); + setupFoundationData.createWindow = false; + setupFoundationData.clockUsesSleep = true; + + SetupSharedFoundation::install (setupFoundationData); + + { + //SetupSharedObject::Data data; + //SetupSharedObject::setupDefaultGameData(data); + //SetupSharedObject::install(data); + } + SetupSharedCompression::install(); + SetupSharedFile::install(true, 32); + + SetupSharedNetwork::SetupData networkSetupData; + SetupSharedNetwork::getDefaultServerSetupData(networkSetupData); + SetupSharedNetwork::install(networkSetupData); + + SetupSharedRandom::install(static_cast(time(NULL))); //lint !e1924 !e64 // NULL is a C-Style cast? + + //Os::setProgramName("MetricsServer"); + //setup the server + ConfigMetricsServer::install(); + + //set command line + cmdLine = setupFoundationData.commandLine; + size_t firstArg = cmdLine.find(" ", 0); + size_t lastSlash = 0; + size_t nextSlash = 0; + while(nextSlash < firstArg) + { + nextSlash = cmdLine.find("/", lastSlash); + if(nextSlash == cmdLine.npos || nextSlash >= firstArg) //lint !e1705 static class members may be accessed by the scoping operator (huh?) + break; + lastSlash = nextSlash + 1; + } + cmdLine = cmdLine.substr(lastSlash); + MetricsServer::setCommandLine(cmdLine); + + + //-- run game + NetworkHandler::install(); + MetricsServer::install(); + MetricsServer::run(); + MetricsServer::remove(); + NetworkHandler::remove(); + SetupSharedFoundation::remove(); + + return 0; +} + + diff --git a/engine/server/application/PlanetServer/src/win32/FirstPlanetServer.cpp b/engine/server/application/PlanetServer/src/win32/FirstPlanetServer.cpp new file mode 100644 index 00000000..97e05471 --- /dev/null +++ b/engine/server/application/PlanetServer/src/win32/FirstPlanetServer.cpp @@ -0,0 +1,8 @@ +// ====================================================================== +// +// FirstPlanetServer.cpp +// copyright (c) 2001 Sony Online Entertainment +// +// ====================================================================== + +#include "FirstPlanetServer.h" diff --git a/engine/server/application/PlanetServer/src/win32/WinMain.cpp b/engine/server/application/PlanetServer/src/win32/WinMain.cpp new file mode 100644 index 00000000..f153fee1 --- /dev/null +++ b/engine/server/application/PlanetServer/src/win32/WinMain.cpp @@ -0,0 +1,67 @@ +#include "FirstPlanetServer.h" +#include "ConfigPlanetServer.h" +#include "PlanetServer.h" + +#include "sharedCompression/SetupSharedCompression.h" +#include "sharedDebug/SetupSharedDebug.h" +#include "sharedFile/SetupSharedFile.h" +#include "sharedFoundation/Os.h" +#include "sharedFoundation/SetupSharedFoundation.h" +#include "sharedLog/SetupSharedLog.h" +#include "sharedNetwork/SetupSharedNetwork.h" +#include "sharedNetworkMessages/SetupSharedNetworkMessages.h" +#include "sharedRandom/SetupSharedRandom.h" +#include "sharedThread/SetupSharedThread.h" +#include "sharedUtility/SetupSharedUtility.h" + +#include + +//_____________________________________________________________________ +int main(int argc, char ** argv) +{ + SetupSharedThread::install(); + SetupSharedDebug::install(1024); + + //-- setup foundation + SetupSharedFoundation::Data setupFoundationData(SetupSharedFoundation::Data::D_game); + + setupFoundationData.argc = argc; + setupFoundationData.argv = argv; + setupFoundationData.createWindow = false; + setupFoundationData.clockUsesSleep = true; + + SetupSharedFoundation::install (setupFoundationData); + + SetupSharedCompression::install(); + SetupSharedFile::install(false); + + SetupSharedNetwork::SetupData networkSetupData; + SetupSharedNetwork::getDefaultServerSetupData(networkSetupData); + SetupSharedNetwork::install(networkSetupData); + + SetupSharedNetworkMessages::install(); + + SetupSharedRandom::install(int(time(NULL))); + + SetupSharedUtility::Data sharedUtilityData; + SetupSharedUtility::setupGameData (sharedUtilityData); + SetupSharedUtility::install (sharedUtilityData); + + //-- setup server + ConfigPlanetServer::install (); + + char tmp[92]; + sprintf(tmp, "PlanetServer:%d", Os::getProcessId()); + SetupSharedLog::install(tmp); + + //-- run server + SetupSharedFoundation::callbackWithExceptionHandling(PlanetServer::run); + + SetupSharedLog::remove(); + SetupSharedFoundation::remove(); + SetupSharedThread::remove(); + + return 0; +} + +//_____________________________________________________________________ diff --git a/engine/server/application/ServerConsole/src/win32/main.cpp b/engine/server/application/ServerConsole/src/win32/main.cpp new file mode 100644 index 00000000..3de57087 --- /dev/null +++ b/engine/server/application/ServerConsole/src/win32/main.cpp @@ -0,0 +1,59 @@ +// main.cpp +// Copyright 2000-02, Sony Online Entertainment Inc., all rights reserved. +// Author: Justin Randall + +//----------------------------------------------------------------------- + +#include "FirstServerConsole.h" + +#include "sharedFoundation/FirstSharedFoundation.h" +#include "sharedCompression/SetupSharedCompression.h" +#include "sharedDebug/SetupSharedDebug.h" +#include "sharedFile/SetupSharedFile.h" +#include "sharedFoundation/ConfigFile.h" +#include "sharedFoundation/SetupSharedFoundation.h" +#include "sharedNetwork/SetupSharedNetwork.h" +#include "sharedNetwork/NetworkHandler.h" +#include "sharedNetworkMessages/SetupSharedNetworkMessages.h" +#include "sharedThread/SetupSharedThread.h" +#include "ServerConsole.h" +#include "ConfigServerConsole.h" + +//----------------------------------------------------------------------- + +int main(int argc, char ** argv) +{ + SetupSharedThread::install(); + SetupSharedDebug::install(1024); + + //-- setup foundation + SetupSharedFoundation::Data setupFoundationData(SetupSharedFoundation::Data::D_game); + + setupFoundationData.argc = argc; + setupFoundationData.argv = argv; + setupFoundationData.clockUsesSleep = true; + setupFoundationData.createWindow = false; + SetupSharedFoundation::install (setupFoundationData); + + SetupSharedCompression::install(); + SetupSharedNetworkMessages::install(); + + SetupSharedNetwork::SetupData networkSetupData; + SetupSharedNetwork::getDefaultClientSetupData(networkSetupData); + SetupSharedNetwork::install(networkSetupData); + NetworkHandler::install(); + + ConfigServerConsole::install(); + + //-- run server + SetupSharedFoundation::callbackWithExceptionHandling(ServerConsole::run); + + NetworkHandler::remove(); + SetupSharedFoundation::remove(); + SetupSharedThread::remove(); + + return 0; +} + +//----------------------------------------------------------------------- + diff --git a/engine/server/application/TaskManager/src/win32/ConsoleInput.cpp b/engine/server/application/TaskManager/src/win32/ConsoleInput.cpp new file mode 100644 index 00000000..dfd6c431 --- /dev/null +++ b/engine/server/application/TaskManager/src/win32/ConsoleInput.cpp @@ -0,0 +1,22 @@ +// ConsoleInput.cpp +// Copyright 2000-02, Sony Online Entertainment Inc., all rights reserved. +// Author: Justin Randall + +//----------------------------------------------------------------------- + +#include "FirstTaskManager.h" +#include "Console.h" +#include + +//----------------------------------------------------------------------- + +const char Console::getNextChar() +{ + char result = 0; + if(_kbhit()) + result = static_cast(_getche()); + return result; +} + +//----------------------------------------------------------------------- + diff --git a/engine/server/application/TaskManager/src/win32/EnvironmentVariable.cpp b/engine/server/application/TaskManager/src/win32/EnvironmentVariable.cpp new file mode 100644 index 00000000..017b221e --- /dev/null +++ b/engine/server/application/TaskManager/src/win32/EnvironmentVariable.cpp @@ -0,0 +1,33 @@ +#include "FirstTaskManager.h" + +namespace EnvironmentVariable +{ + bool addToEnvironmentVariable(const char* key, const char* value) + { + bool retval = false; + char oldValue[256]; + DWORD tmp = GetEnvironmentVariable(key, oldValue, sizeof(oldValue)); + if (tmp != 0) + { + std::string s(oldValue); + s += ";"; + s += value; + + //Bad things happen if the first character happens to be ; (ie from an empty environment string) + const char* newValue = s.c_str(); + if (newValue[0] == ';') + ++newValue; + + retval = (SetEnvironmentVariable(key, newValue) != 0); + } + else + { + retval = (SetEnvironmentVariable(key, value) != 0); + } + return retval; + } + bool setEnvironmentVariable(const char* key, const char* value) + { + return (SetEnvironmentVariable(key, value) != 0); + } +}; diff --git a/engine/server/application/TaskManager/src/win32/ProcessSpawner.cpp b/engine/server/application/TaskManager/src/win32/ProcessSpawner.cpp new file mode 100644 index 00000000..b544a301 --- /dev/null +++ b/engine/server/application/TaskManager/src/win32/ProcessSpawner.cpp @@ -0,0 +1,153 @@ +#include "FirstTaskManager.h" +#include "sharedFoundation/FirstSharedFoundation.h" +#include "ProcessSpawner.h" +#include +#include +#include "TaskManager.h" + +#include + +uint32 ProcessSpawner::prefix; +std::map procById; + +//----------------------------------------------------------------------- + +bool tokenize (const std::string & str, std::vector & result) +{ + size_t end_pos = 0; + size_t start_pos = 0; + + result.clear (); + + for (;;) + { + if (end_pos >= str.size ()) + break; + + start_pos = str.find_first_not_of (' ', end_pos); + + if (start_pos == str.npos) + break; + + //---------------------------------------------------------------------- + + if (str [start_pos] == '\"') + { + if (++start_pos >= str.size ()) + break; + end_pos = str.find_first_of ('\"', start_pos); + } + else + end_pos = str.find_first_of (' ', start_pos); + + //---------------------------------------------------------------------- + + if (start_pos == end_pos) + break; + + if (end_pos == str.npos) + { + result.push_back (str.substr (start_pos)); + break; + } + else + result.push_back (str.substr (start_pos, end_pos - start_pos)); + + ++start_pos; + } + + return true; +} + +uint32 ProcessSpawner::execute(const std::string & processName, const std::vector & parameters) +{ + STARTUPINFO si; + PROCESS_INFORMATION pi; + char cmd[1024] = {"\0"}; + std::string cmdLine; + + cmdLine = processName.c_str(); + cmdLine += " "; + std::vector::const_iterator i; + for(i = parameters.begin(); i != parameters.end(); ++i) + { + cmdLine += (*i).c_str(); + cmdLine += " "; + } + + _snprintf(cmd, 1024, "%s.exe", processName.c_str()); +// _snprintf(cmd, 1024, "%s", processName.c_str()); + memset(&si, 0, sizeof(si)); + memset(&pi, 0, sizeof(pi)); + + si.cb = sizeof(si); + + const int result = CreateProcess(cmd, const_cast(cmdLine.c_str()), NULL, NULL, false, 0, 0, 0, &si, &pi); + UNREF (result); + +#ifdef _DEBUG + if (!result) + { + DWORD iErr = GetLastError(); + char * errStr = strerror(iErr); + DEBUG_REPORT_LOG(true, ("ProcessSpawner: %s - %s\n", cmd, errStr)); + } +#endif + + procById.insert(std::pair(pi.dwProcessId, pi.hProcess)); + return pi.dwProcessId; +} + +//----------------------------------------------------------------------- + +uint32 ProcessSpawner::execute(const std::string & cmd) +{ + std::vector args; + size_t firstArg = cmd.find_first_of(" "); + std::string processName; + if(firstArg < cmd.size()) + { + std::string a = cmd.substr(firstArg + 1); + tokenize(a, args); + processName = cmd.substr(0, firstArg); + } + else + { + processName = cmd; + } + return execute(processName, args); +} + +//----------------------------------------------------------------------- + +bool ProcessSpawner::isProcessActive(uint32 pid) +{ + bool result = false; + std::map::const_iterator f = procById.find(pid); + if(f != procById.end()) + { + DWORD exitCode; + GetExitCodeProcess((*f).second, &exitCode); + result = (exitCode == STILL_ACTIVE); + } + return result; +} + +//----------------------------------------------------------------------- + +void ProcessSpawner::kill(uint32 pid) +{ + HANDLE p = OpenProcess(PROCESS_TERMINATE, false, (DWORD)pid); + if(p) + TerminateProcess(p, 0); +} + +//----------------------------------------------------------------------- + +void ProcessSpawner::forceCore(const unsigned long pid) +{ + ProcessSpawner::kill(pid); +} + +//----------------------------------------------------------------------- + diff --git a/engine/server/application/TaskManager/src/win32/TaskManagerSysInfo.cpp b/engine/server/application/TaskManager/src/win32/TaskManagerSysInfo.cpp new file mode 100644 index 00000000..feadf4f6 --- /dev/null +++ b/engine/server/application/TaskManager/src/win32/TaskManagerSysInfo.cpp @@ -0,0 +1,147 @@ +// TaskManagerSysInfo.cpp +// Copyright 2000-02, Sony Online Entertainment Inc., all rights reserved. +// Author: Justin Randall + +//----------------------------------------------------------------------- + +#include "FirstTaskManager.h" +#include "TaskManagerSysInfo.h" +#pragma warning ( disable : 4201) +#include +#include +//----------------------------------------------------------------------- + +TaskManagerSysInfo::TaskManagerSysInfo() : +averageScore() +{ + update(); +} + +//----------------------------------------------------------------------- + +TaskManagerSysInfo::TaskManagerSysInfo(const TaskManagerSysInfo &) +{ + +} + +//----------------------------------------------------------------------- + +TaskManagerSysInfo::~TaskManagerSysInfo() +{ +} + +//----------------------------------------------------------------------- + +TaskManagerSysInfo & TaskManagerSysInfo::operator = (const TaskManagerSysInfo & rhs) +{ + if(this != &rhs) + { + // make assignments if right hand side is not this instance + } + return *this; +} + +//----------------------------------------------------------------------- + +const float TaskManagerSysInfo::getScore() const +{ + std::list::const_iterator i; + float avg = 0.0f; + for(i = averageScore.begin(); i != averageScore.end(); ++i) + { + avg += (*i); + } + avg = avg / averageScore.size(); + return avg; +} + +//----------------------------------------------------------------------- + +void TaskManagerSysInfo::update() +{ + static int64 activeTime[2] = {0}; + static int64 currentTime[2] = {0}; + + float currentScore = 0.0f; + activeTime[0] = activeTime[1]; + currentTime[0] = currentTime[1]; + activeTime[1] = 0; + + HANDLE hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPALL, 0); + double procAvg = 0.0f; + + MEMORYSTATUS memStat; + GlobalMemoryStatus(&memStat); + + currentScore = static_cast(static_cast(memStat.dwMemoryLoad) * 0.005f); + if(hProcessSnap != INVALID_HANDLE_VALUE) + { + PROCESSENTRY32 pe32 = {0}; + pe32.dwSize = sizeof(PROCESSENTRY32); + if (Process32First(hProcessSnap, &pe32)) + { + do + { + HANDLE proc = OpenProcess(PROCESS_QUERY_INFORMATION, false, pe32.th32ProcessID); + // some stuf with the enumerated processes + FILETIME createTime = {0}; + FILETIME exitTime = {0}; + FILETIME kernelTime = {0}; + FILETIME userTime = {0}; + GetProcessTimes(proc, &createTime, &exitTime, &kernelTime, &userTime); + int64 totals; + + // SDK docs say: + // It is not recommended that you add and subtract values + // from the FILETIME structure to obtain relative times. Instead, you should + // Copy the resulting FILETIME structure to a ULARGE_INTEGER structure. + // Use normal 64-bit arithmetic on the ULARGE_INTEGER value. + int64 c; + int64 e; + int64 k; + int64 u; + memcpy(&c, &createTime, sizeof(int64)); + memcpy(&e, &exitTime, sizeof(int64)); + memcpy(&k, &kernelTime, sizeof(int64)); + memcpy(&u, &userTime, sizeof(int64)); + + totals = k + u; + + FILETIME fst; + SYSTEMTIME st; + GetSystemTime(&st); + SystemTimeToFileTime(&st, &fst); + + int64 runTime; + memcpy(&runTime, &fst, sizeof(int64)); + runTime = runTime - c; + + if(c || e || k || u) + { + activeTime[1] += k + e; + } + + } + while (Process32Next(hProcessSnap, &pe32)); + } + } + + FILETIME fst; + SYSTEMTIME st; + GetSystemTime(&st); + SystemTimeToFileTime(&st, &fst); + memcpy(¤tTime[1], &fst, sizeof(int64)); + int64 timeSlice = currentTime[1] - currentTime[0]; + int64 activeSlice = activeTime[1] - activeTime[0]; + procAvg = static_cast(static_cast(activeSlice) / timeSlice); + //REPORT_LOG(true, ("%f\n", procAvg)); + currentScore = currentScore + static_cast(procAvg * 0.5); + + averageScore.insert(averageScore.end(), currentScore); + + if(averageScore.size() > 100) + averageScore.erase(averageScore.begin()); +} + +//----------------------------------------------------------------------- + diff --git a/engine/server/application/TaskManager/src/win32/WinMain.cpp b/engine/server/application/TaskManager/src/win32/WinMain.cpp new file mode 100644 index 00000000..14a6ab39 --- /dev/null +++ b/engine/server/application/TaskManager/src/win32/WinMain.cpp @@ -0,0 +1,50 @@ +#include "FirstTaskManager.h" + +#include "sharedFoundation/FirstSharedFoundation.h" +#include "sharedCompression/SetupSharedCompression.h" +#include "sharedDebug/SetupSharedDebug.h" +#include "sharedFile/SetupSharedFile.h" +#include "sharedFoundation/ConfigFile.h" +#include "sharedFoundation/SetupSharedFoundation.h" +#include "sharedNetworkMessages/SetupSharedNetworkMessages.h" +#include "sharedRandom/SetupSharedRandom.h" +#include "sharedThread/SetupSharedThread.h" +#include "TaskManager.h" +#include "ConfigTaskManager.h" + +//===================================================================== + +int main(int argc, char **argv) +{ + SetupSharedThread::install(); + SetupSharedDebug::install(1024); + + //-- setup foundation + SetupSharedFoundation::Data setupFoundationData(SetupSharedFoundation::Data::D_game); + + setupFoundationData.argc = argc; + setupFoundationData.argv = argv; + setupFoundationData.createWindow = false; + setupFoundationData.clockUsesSleep = true; + SetupSharedFoundation::install (setupFoundationData); + + SetupSharedCompression::install(); + SetupSharedFile::install(false); + SetupSharedNetworkMessages::install(); + SetupSharedRandom::install(static_cast(time(NULL))); //lint !e1924 !e64 // NULL is a C-Style cast? + + ConfigTaskManager::install(); + + TaskManager::install(); + + //-- run server + SetupSharedFoundation::callbackWithExceptionHandling(TaskManager::run); + + TaskManager::remove(); + SetupSharedFoundation::remove(); + SetupSharedThread::remove(); + + return 0; +} + +//===================================================================== From 9b369713e1ec525aeba80c079f7aadc896bff43e Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sat, 23 Jul 2016 18:01:50 -0700 Subject: [PATCH 149/302] again, re-add some windows stuff Revert "possibly controversial commit: remove all windows sources, keeping only the windows cmake so that we can generate an sln to edit the code" This reverts commit 48ba7961eb001a98d3e55748345acfed67aa33f2. --- .../Base/win32/Archive.h | 42 + .../Base/win32/Platform.cpp | 31 + .../Base/win32/Platform.h | 98 + .../AuctionTransferGameAPI/Base/win32/Types.h | 42 + .../CommoditiesServer/src/win32/WinMain.cpp | 70 + .../TransferServer/src/win32/WinMain.cpp | 60 + .../src/win32/FirstServerDatabase.cpp | 9 + .../serverGame/src/win32/FirstServerGame.cpp | 10 + .../src/win32/FirstServerKeyShare.cpp | 8 + .../src/win32/FirstServerMetrics.cpp | 9 + .../src/win32/FirstServerNetworkMessages.cpp | 3 + .../src/win32/FirstServerPathfinding.cpp | 8 + .../src/win32/FirstServerScript.cpp | 2 + .../src/win32/FirstServerUtility.cpp | 2 + .../src/win32/FirstTemplateCompiler.cpp | 1 + .../src/win32/FirstTemplateCompiler.h | 8 + .../win32/FirstTemplateDefinitionCompiler.cpp | 1 + .../win32/FirstTemplateDefinitionCompiler.h | 8 + .../src/win32/FirstSharedCollision.cpp | 8 + .../src/win32/FirstSharedCommandParser.cpp | 8 + .../src/win32/FirstSharedCompression.cpp | 8 + .../win32/FirstSharedDatabaseInterface.cpp | 9 + .../src/win32/SQLC_Defs.h | 19 + .../sharedDebug/src/win32/DebugHelp.cpp | 670 +++++++ .../library/sharedDebug/src/win32/DebugHelp.h | 35 + .../sharedDebug/src/win32/DebugMonitor.cpp | 321 ++++ .../sharedDebug/src/win32/DebugMonitor.h | 48 + .../src/win32/FirstSharedDebug.cpp | 8 + .../src/win32/PerformanceTimer.cpp | 105 ++ .../sharedDebug/src/win32/PerformanceTimer.h | 49 + .../sharedDebug/src/win32/ProfilerTimer.cpp | 90 + .../sharedDebug/src/win32/ProfilerTimer.h | 29 + .../library/sharedDebug/src/win32/VTune.cpp | 142 ++ .../library/sharedDebug/src/win32/VTune.h | 65 + .../sharedFile/src/win32/FirstSharedFile.cpp | 8 + .../library/sharedFile/src/win32/OsFile.cpp | 195 ++ .../library/sharedFile/src/win32/OsFile.h | 48 + .../sharedFoundation/src/win32/ByteOrder.cpp | 58 + .../sharedFoundation/src/win32/ByteOrder.h | 22 + .../src/win32/ConfigSharedFoundation.cpp | 324 ++++ .../src/win32/ConfigSharedFoundation.h | 74 + .../src/win32/FirstPlatform.h | 82 + .../src/win32/FirstSharedFoundation.cpp | 8 + .../src/win32/FloatingPointUnit.cpp | 257 +++ .../src/win32/FloatingPointUnit.h | 104 ++ .../library/sharedFoundation/src/win32/Os.cpp | 1633 +++++++++++++++++ .../library/sharedFoundation/src/win32/Os.h | 152 ++ .../src/win32/PerThreadData.cpp | 465 +++++ .../src/win32/PerThreadData.h | 57 + .../src/win32/PlatformGlue.cpp | 124 ++ .../sharedFoundation/src/win32/PlatformGlue.h | 32 + .../src/win32/ProcessSpawner.cpp | 310 ++++ .../src/win32/ProcessSpawner.h | 43 + .../src/win32/RegistryKey.cpp | 918 +++++++++ .../sharedFoundation/src/win32/RegistryKey.h | 270 +++ .../src/win32/SetupSharedFoundation.cpp | 410 +++++ .../src/win32/SetupSharedFoundation.h | 99 + .../src/win32/WindowsWrapper.h | 51 + .../src/win32/FoundationTypesWin32.h | 33 + .../src/win32/FirstSharedFractal.cpp | 8 + .../sharedGame/src/win32/FirstSharedGame.cpp | 9 + .../src/win32/FirstSharedImage.cpp | 8 + .../src/win32/FirstSharedIoWin.cpp | 8 + .../sharedLog/src/win32/StderrLogger.cpp | 35 + .../sharedMath/src/win32/FirstSharedMath.cpp | 8 + .../library/sharedMath/src/win32/SseMath.cpp | 430 +++++ .../library/sharedMath/src/win32/SseMath.h | 58 + .../src/win32/OsMemory.cpp | 56 + .../sharedMemoryManager/src/win32/OsMemory.h | 29 + .../src/win32/OsNewDel.cpp | 211 +++ .../sharedMemoryManager/src/win32/OsNewDel.h | 52 + .../src/win32/FirstSharedMessageDispatch.cpp | 8 + .../sharedNetwork/src/win32/Address.cpp | 410 +++++ .../src/win32/FirstSharedNetwork.cpp | 9 + .../src/win32/NetworkGetHostName.cpp | 67 + .../sharedNetwork/src/win32/OverlappedTcp.cpp | 85 + .../sharedNetwork/src/win32/OverlappedTcp.h | 47 + .../library/sharedNetwork/src/win32/Sock.cpp | 366 ++++ .../library/sharedNetwork/src/win32/Sock.h | 129 ++ .../sharedNetwork/src/win32/TcpClient.cpp | 631 +++++++ .../sharedNetwork/src/win32/TcpClient.h | 87 + .../sharedNetwork/src/win32/TcpServer.cpp | 194 ++ .../sharedNetwork/src/win32/TcpServer.h | 50 + .../sharedNetwork/src/win32/UdpSock.cpp | 108 ++ .../src/win32/FirstSharedNetworkMessages.cpp | 8 + .../src/win32/FirstSharedObject.cpp | 8 + .../src/win32/FirstSharedPathfinding.cpp | 8 + .../src/win32/FirstSharedRandom.cpp | 8 + .../src/win32/FirstSharedRegex.cpp | 9 + .../sharedRegex/src/win32/RegexServices.cpp | 57 + .../sharedRegex/src/win32/RegexServices.h | 25 + .../src/win32/FirstSharedSkillSystem.cpp | 8 + .../src/win32/ConditionVariable.cpp | 50 + .../src/win32/ConditionVariable.h | 42 + .../src/win32/FirstSharedSynchronization.cpp | 8 + .../sharedSynchronization/src/win32/Gate.cpp | 60 + .../sharedSynchronization/src/win32/Gate.h | 39 + .../src/win32/InterlockedInteger.h | 52 + .../src/win32/InterlockedVoidPointer.h | 45 + .../sharedSynchronization/src/win32/Mutex.cpp | 53 + .../sharedSynchronization/src/win32/Mutex.h | 41 + .../src/win32/RecursiveMutex.cpp | 53 + .../src/win32/RecursiveMutex.h | 41 + .../src/win32/Semaphore.cpp | 37 + .../src/win32/Semaphore.h | 28 + .../src/win32/FirstSharedTemplate.cpp | 1 + .../win32/FirstSharedTemplateDefinition.cpp | 1 + .../src/win32/FirstSharedTerrain.cpp | 8 + .../src/win32/FirstSharedThread.cpp | 8 + .../library/sharedThread/src/win32/Thread.cpp | 179 ++ .../library/sharedThread/src/win32/Thread.h | 94 + .../src/win32/FirstSharedUtility.cpp | 8 + .../src/win32/core/FirstSharedXml.cpp | 11 + .../platform/utils/Base/win32/Archive.h | 42 + .../utils/Base/win32/BlockAllocator.cpp | 112 ++ .../platform/utils/Base/win32/Event.cpp | 44 + .../library/platform/utils/Base/win32/Event.h | 92 + .../platform/utils/Base/win32/File.cpp | 19 + .../library/platform/utils/Base/win32/File.h | 22 + .../platform/utils/Base/win32/Logger.cpp | 385 ++++ .../platform/utils/Base/win32/Mutex.cpp | 40 + .../library/platform/utils/Base/win32/Mutex.h | 73 + .../platform/utils/Base/win32/Platform.cpp | 31 + .../platform/utils/Base/win32/Platform.h | 98 + .../platform/utils/Base/win32/Thread.cpp | 279 +++ .../platform/utils/Base/win32/Thread.h | 144 ++ .../library/platform/utils/Base/win32/Types.h | 42 + .../CSAssist/utils/Base/win32/Archive.h | 42 + .../utils/Base/win32/BlockAllocator.cpp | 112 ++ .../CSAssist/utils/Base/win32/Event.cpp | 44 + .../CSAssist/utils/Base/win32/Event.h | 92 + .../CSAssist/utils/Base/win32/File.cpp | 19 + .../CSAssist/utils/Base/win32/File.h | 22 + .../CSAssist/utils/Base/win32/Mutex.cpp | 40 + .../CSAssist/utils/Base/win32/Mutex.h | 73 + .../CSAssist/utils/Base/win32/Platform.cpp | 31 + .../CSAssist/utils/Base/win32/Platform.h | 98 + .../CSAssist/utils/Base/win32/Thread.cpp | 279 +++ .../CSAssist/utils/Base/win32/Thread.h | 144 ++ .../CSAssist/utils/Base/win32/Types.h | 42 + .../CTServiceGameAPI/Base/win32/Archive.h | 42 + .../CTServiceGameAPI/Base/win32/Platform.cpp | 31 + .../CTServiceGameAPI/Base/win32/Platform.h | 98 + .../CTServiceGameAPI/Base/win32/Types.h | 42 + .../ChatAPI/utils/Base/win32/Archive.h | 42 + .../utils/Base/win32/BlockAllocator.cpp | 112 ++ .../ChatAPI/utils/Base/win32/Event.cpp | 44 + .../ChatAPI/utils/Base/win32/Event.h | 92 + .../ChatAPI/utils/Base/win32/File.cpp | 22 + .../ChatAPI/utils/Base/win32/File.h | 26 + .../ChatAPI/utils/Base/win32/Mutex.cpp | 40 + .../ChatAPI/utils/Base/win32/Mutex.h | 73 + .../ChatAPI/utils/Base/win32/Platform.cpp | 31 + .../ChatAPI/utils/Base/win32/Platform.h | 98 + .../ChatAPI/utils/Base/win32/Thread.cpp | 315 ++++ .../ChatAPI/utils/Base/win32/Thread.h | 152 ++ .../ChatAPI/utils/Base/win32/Types.h | 42 + .../archive/src/win32/ArchiveMutex.cpp | 35 + .../library/archive/src/win32/ArchiveMutex.h | 27 + .../archive/src/win32/FirstArchive.cpp | 16 + .../library/crypto/src/win32/FirstCrypto.cpp | 1 + .../src/win32/FirstFileInterface.cpp | 1 + .../src/win32/FirstLocalization.cpp | 8 + .../src/win32/FirstLocalizationArchive.cpp | 10 + .../unicode/src/win32/FirstUnicode.cpp | 8 + .../src/win32/FirstUnicodeArchive.cpp | 12 + .../src/win32/FirstSwgDatabaseServer.cpp | 1 + .../SwgDatabaseServer/src/win32/WinMain.cpp | 87 + .../src/win32/FirstSwgGameServer.cpp | 1 + .../SwgGameServer/src/win32/WinMain.cpp | 553 ++++++ .../win32/FirstSwgServerNetworkMessages.cpp | 9 + .../win32/FirstSwgSharedNetworkMessages.cpp | 9 + .../src/win32/FirstSwgSharedUtility.cpp | 11 + 173 files changed, 16448 insertions(+) create mode 100755 engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/win32/Archive.h create mode 100755 engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/win32/Platform.cpp create mode 100755 engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/win32/Platform.h create mode 100755 engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/win32/Types.h create mode 100755 engine/server/application/CommoditiesServer/src/win32/WinMain.cpp create mode 100755 engine/server/application/TransferServer/src/win32/WinMain.cpp create mode 100755 engine/server/library/serverDatabase/src/win32/FirstServerDatabase.cpp create mode 100755 engine/server/library/serverGame/src/win32/FirstServerGame.cpp create mode 100755 engine/server/library/serverKeyShare/src/win32/FirstServerKeyShare.cpp create mode 100755 engine/server/library/serverMetrics/src/win32/FirstServerMetrics.cpp create mode 100755 engine/server/library/serverNetworkMessages/src/win32/FirstServerNetworkMessages.cpp create mode 100755 engine/server/library/serverPathfinding/src/win32/FirstServerPathfinding.cpp create mode 100755 engine/server/library/serverScript/src/win32/FirstServerScript.cpp create mode 100755 engine/server/library/serverUtility/src/win32/FirstServerUtility.cpp create mode 100755 engine/shared/application/TemplateCompiler/src/win32/FirstTemplateCompiler.cpp create mode 100755 engine/shared/application/TemplateCompiler/src/win32/FirstTemplateCompiler.h create mode 100755 engine/shared/application/TemplateDefinitionCompiler/src/win32/FirstTemplateDefinitionCompiler.cpp create mode 100755 engine/shared/application/TemplateDefinitionCompiler/src/win32/FirstTemplateDefinitionCompiler.h create mode 100755 engine/shared/library/sharedCollision/src/win32/FirstSharedCollision.cpp create mode 100755 engine/shared/library/sharedCommandParser/src/win32/FirstSharedCommandParser.cpp create mode 100755 engine/shared/library/sharedCompression/src/win32/FirstSharedCompression.cpp create mode 100755 engine/shared/library/sharedDatabaseInterface/src/win32/FirstSharedDatabaseInterface.cpp create mode 100755 engine/shared/library/sharedDatabaseInterface/src/win32/SQLC_Defs.h create mode 100755 engine/shared/library/sharedDebug/src/win32/DebugHelp.cpp create mode 100755 engine/shared/library/sharedDebug/src/win32/DebugHelp.h create mode 100755 engine/shared/library/sharedDebug/src/win32/DebugMonitor.cpp create mode 100755 engine/shared/library/sharedDebug/src/win32/DebugMonitor.h create mode 100755 engine/shared/library/sharedDebug/src/win32/FirstSharedDebug.cpp create mode 100755 engine/shared/library/sharedDebug/src/win32/PerformanceTimer.cpp create mode 100755 engine/shared/library/sharedDebug/src/win32/PerformanceTimer.h create mode 100755 engine/shared/library/sharedDebug/src/win32/ProfilerTimer.cpp create mode 100755 engine/shared/library/sharedDebug/src/win32/ProfilerTimer.h create mode 100755 engine/shared/library/sharedDebug/src/win32/VTune.cpp create mode 100755 engine/shared/library/sharedDebug/src/win32/VTune.h create mode 100755 engine/shared/library/sharedFile/src/win32/FirstSharedFile.cpp create mode 100755 engine/shared/library/sharedFile/src/win32/OsFile.cpp create mode 100755 engine/shared/library/sharedFile/src/win32/OsFile.h create mode 100755 engine/shared/library/sharedFoundation/src/win32/ByteOrder.cpp create mode 100755 engine/shared/library/sharedFoundation/src/win32/ByteOrder.h create mode 100755 engine/shared/library/sharedFoundation/src/win32/ConfigSharedFoundation.cpp create mode 100755 engine/shared/library/sharedFoundation/src/win32/ConfigSharedFoundation.h create mode 100755 engine/shared/library/sharedFoundation/src/win32/FirstPlatform.h create mode 100755 engine/shared/library/sharedFoundation/src/win32/FirstSharedFoundation.cpp create mode 100755 engine/shared/library/sharedFoundation/src/win32/FloatingPointUnit.cpp create mode 100755 engine/shared/library/sharedFoundation/src/win32/FloatingPointUnit.h create mode 100755 engine/shared/library/sharedFoundation/src/win32/Os.cpp create mode 100755 engine/shared/library/sharedFoundation/src/win32/Os.h create mode 100755 engine/shared/library/sharedFoundation/src/win32/PerThreadData.cpp create mode 100755 engine/shared/library/sharedFoundation/src/win32/PerThreadData.h create mode 100755 engine/shared/library/sharedFoundation/src/win32/PlatformGlue.cpp create mode 100755 engine/shared/library/sharedFoundation/src/win32/PlatformGlue.h create mode 100755 engine/shared/library/sharedFoundation/src/win32/ProcessSpawner.cpp create mode 100755 engine/shared/library/sharedFoundation/src/win32/ProcessSpawner.h create mode 100755 engine/shared/library/sharedFoundation/src/win32/RegistryKey.cpp create mode 100755 engine/shared/library/sharedFoundation/src/win32/RegistryKey.h create mode 100755 engine/shared/library/sharedFoundation/src/win32/SetupSharedFoundation.cpp create mode 100755 engine/shared/library/sharedFoundation/src/win32/SetupSharedFoundation.h create mode 100755 engine/shared/library/sharedFoundation/src/win32/WindowsWrapper.h create mode 100755 engine/shared/library/sharedFoundationTypes/src/win32/FoundationTypesWin32.h create mode 100755 engine/shared/library/sharedFractal/src/win32/FirstSharedFractal.cpp create mode 100755 engine/shared/library/sharedGame/src/win32/FirstSharedGame.cpp create mode 100755 engine/shared/library/sharedImage/src/win32/FirstSharedImage.cpp create mode 100755 engine/shared/library/sharedIoWin/src/win32/FirstSharedIoWin.cpp create mode 100755 engine/shared/library/sharedLog/src/win32/StderrLogger.cpp create mode 100755 engine/shared/library/sharedMath/src/win32/FirstSharedMath.cpp create mode 100755 engine/shared/library/sharedMath/src/win32/SseMath.cpp create mode 100755 engine/shared/library/sharedMath/src/win32/SseMath.h create mode 100755 engine/shared/library/sharedMemoryManager/src/win32/OsMemory.cpp create mode 100755 engine/shared/library/sharedMemoryManager/src/win32/OsMemory.h create mode 100755 engine/shared/library/sharedMemoryManager/src/win32/OsNewDel.cpp create mode 100755 engine/shared/library/sharedMemoryManager/src/win32/OsNewDel.h create mode 100755 engine/shared/library/sharedMessageDispatch/src/win32/FirstSharedMessageDispatch.cpp create mode 100755 engine/shared/library/sharedNetwork/src/win32/Address.cpp create mode 100755 engine/shared/library/sharedNetwork/src/win32/FirstSharedNetwork.cpp create mode 100755 engine/shared/library/sharedNetwork/src/win32/NetworkGetHostName.cpp create mode 100755 engine/shared/library/sharedNetwork/src/win32/OverlappedTcp.cpp create mode 100755 engine/shared/library/sharedNetwork/src/win32/OverlappedTcp.h create mode 100755 engine/shared/library/sharedNetwork/src/win32/Sock.cpp create mode 100755 engine/shared/library/sharedNetwork/src/win32/Sock.h create mode 100755 engine/shared/library/sharedNetwork/src/win32/TcpClient.cpp create mode 100755 engine/shared/library/sharedNetwork/src/win32/TcpClient.h create mode 100755 engine/shared/library/sharedNetwork/src/win32/TcpServer.cpp create mode 100755 engine/shared/library/sharedNetwork/src/win32/TcpServer.h create mode 100755 engine/shared/library/sharedNetwork/src/win32/UdpSock.cpp create mode 100755 engine/shared/library/sharedNetworkMessages/src/win32/FirstSharedNetworkMessages.cpp create mode 100755 engine/shared/library/sharedObject/src/win32/FirstSharedObject.cpp create mode 100755 engine/shared/library/sharedPathfinding/src/win32/FirstSharedPathfinding.cpp create mode 100755 engine/shared/library/sharedRandom/src/win32/FirstSharedRandom.cpp create mode 100755 engine/shared/library/sharedRegex/src/win32/FirstSharedRegex.cpp create mode 100755 engine/shared/library/sharedRegex/src/win32/RegexServices.cpp create mode 100755 engine/shared/library/sharedRegex/src/win32/RegexServices.h create mode 100755 engine/shared/library/sharedSkillSystem/src/win32/FirstSharedSkillSystem.cpp create mode 100755 engine/shared/library/sharedSynchronization/src/win32/ConditionVariable.cpp create mode 100755 engine/shared/library/sharedSynchronization/src/win32/ConditionVariable.h create mode 100755 engine/shared/library/sharedSynchronization/src/win32/FirstSharedSynchronization.cpp create mode 100755 engine/shared/library/sharedSynchronization/src/win32/Gate.cpp create mode 100755 engine/shared/library/sharedSynchronization/src/win32/Gate.h create mode 100755 engine/shared/library/sharedSynchronization/src/win32/InterlockedInteger.h create mode 100755 engine/shared/library/sharedSynchronization/src/win32/InterlockedVoidPointer.h create mode 100755 engine/shared/library/sharedSynchronization/src/win32/Mutex.cpp create mode 100755 engine/shared/library/sharedSynchronization/src/win32/Mutex.h create mode 100755 engine/shared/library/sharedSynchronization/src/win32/RecursiveMutex.cpp create mode 100755 engine/shared/library/sharedSynchronization/src/win32/RecursiveMutex.h create mode 100755 engine/shared/library/sharedSynchronization/src/win32/Semaphore.cpp create mode 100755 engine/shared/library/sharedSynchronization/src/win32/Semaphore.h create mode 100755 engine/shared/library/sharedTemplate/src/win32/FirstSharedTemplate.cpp create mode 100755 engine/shared/library/sharedTemplateDefinition/src/win32/FirstSharedTemplateDefinition.cpp create mode 100755 engine/shared/library/sharedTerrain/src/win32/FirstSharedTerrain.cpp create mode 100755 engine/shared/library/sharedThread/src/win32/FirstSharedThread.cpp create mode 100755 engine/shared/library/sharedThread/src/win32/Thread.cpp create mode 100755 engine/shared/library/sharedThread/src/win32/Thread.h create mode 100755 engine/shared/library/sharedUtility/src/win32/FirstSharedUtility.cpp create mode 100755 engine/shared/library/sharedXml/src/win32/core/FirstSharedXml.cpp create mode 100755 external/3rd/library/platform/utils/Base/win32/Archive.h create mode 100755 external/3rd/library/platform/utils/Base/win32/BlockAllocator.cpp create mode 100755 external/3rd/library/platform/utils/Base/win32/Event.cpp create mode 100755 external/3rd/library/platform/utils/Base/win32/Event.h create mode 100755 external/3rd/library/platform/utils/Base/win32/File.cpp create mode 100755 external/3rd/library/platform/utils/Base/win32/File.h create mode 100755 external/3rd/library/platform/utils/Base/win32/Logger.cpp create mode 100755 external/3rd/library/platform/utils/Base/win32/Mutex.cpp create mode 100755 external/3rd/library/platform/utils/Base/win32/Mutex.h create mode 100755 external/3rd/library/platform/utils/Base/win32/Platform.cpp create mode 100755 external/3rd/library/platform/utils/Base/win32/Platform.h create mode 100755 external/3rd/library/platform/utils/Base/win32/Thread.cpp create mode 100755 external/3rd/library/platform/utils/Base/win32/Thread.h create mode 100755 external/3rd/library/platform/utils/Base/win32/Types.h create mode 100755 external/3rd/library/soePlatform/CSAssist/utils/Base/win32/Archive.h create mode 100755 external/3rd/library/soePlatform/CSAssist/utils/Base/win32/BlockAllocator.cpp create mode 100755 external/3rd/library/soePlatform/CSAssist/utils/Base/win32/Event.cpp create mode 100755 external/3rd/library/soePlatform/CSAssist/utils/Base/win32/Event.h create mode 100755 external/3rd/library/soePlatform/CSAssist/utils/Base/win32/File.cpp create mode 100755 external/3rd/library/soePlatform/CSAssist/utils/Base/win32/File.h create mode 100755 external/3rd/library/soePlatform/CSAssist/utils/Base/win32/Mutex.cpp create mode 100755 external/3rd/library/soePlatform/CSAssist/utils/Base/win32/Mutex.h create mode 100755 external/3rd/library/soePlatform/CSAssist/utils/Base/win32/Platform.cpp create mode 100755 external/3rd/library/soePlatform/CSAssist/utils/Base/win32/Platform.h create mode 100755 external/3rd/library/soePlatform/CSAssist/utils/Base/win32/Thread.cpp create mode 100755 external/3rd/library/soePlatform/CSAssist/utils/Base/win32/Thread.h create mode 100755 external/3rd/library/soePlatform/CSAssist/utils/Base/win32/Types.h create mode 100755 external/3rd/library/soePlatform/CTServiceGameAPI/Base/win32/Archive.h create mode 100755 external/3rd/library/soePlatform/CTServiceGameAPI/Base/win32/Platform.cpp create mode 100755 external/3rd/library/soePlatform/CTServiceGameAPI/Base/win32/Platform.h create mode 100755 external/3rd/library/soePlatform/CTServiceGameAPI/Base/win32/Types.h create mode 100755 external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/Archive.h create mode 100755 external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/BlockAllocator.cpp create mode 100755 external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/Event.cpp create mode 100755 external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/Event.h create mode 100755 external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/File.cpp create mode 100755 external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/File.h create mode 100755 external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/Mutex.cpp create mode 100755 external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/Mutex.h create mode 100755 external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/Platform.cpp create mode 100755 external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/Platform.h create mode 100755 external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/Thread.cpp create mode 100755 external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/Thread.h create mode 100755 external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/Types.h create mode 100755 external/ours/library/archive/src/win32/ArchiveMutex.cpp create mode 100755 external/ours/library/archive/src/win32/ArchiveMutex.h create mode 100755 external/ours/library/archive/src/win32/FirstArchive.cpp create mode 100755 external/ours/library/crypto/src/win32/FirstCrypto.cpp create mode 100755 external/ours/library/fileInterface/src/win32/FirstFileInterface.cpp create mode 100755 external/ours/library/localization/src/win32/FirstLocalization.cpp create mode 100755 external/ours/library/localizationArchive/src/win32/FirstLocalizationArchive.cpp create mode 100755 external/ours/library/unicode/src/win32/FirstUnicode.cpp create mode 100755 external/ours/library/unicodeArchive/src/win32/FirstUnicodeArchive.cpp create mode 100755 game/server/application/SwgDatabaseServer/src/win32/FirstSwgDatabaseServer.cpp create mode 100755 game/server/application/SwgDatabaseServer/src/win32/WinMain.cpp create mode 100755 game/server/application/SwgGameServer/src/win32/FirstSwgGameServer.cpp create mode 100755 game/server/application/SwgGameServer/src/win32/WinMain.cpp create mode 100755 game/server/library/swgServerNetworkMessages/src/win32/FirstSwgServerNetworkMessages.cpp create mode 100755 game/shared/library/swgSharedNetworkMessages/src/win32/FirstSwgSharedNetworkMessages.cpp create mode 100755 game/shared/library/swgSharedUtility/src/win32/FirstSwgSharedUtility.cpp diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/win32/Archive.h b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/win32/Archive.h new file mode 100755 index 00000000..30ddce43 --- /dev/null +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/win32/Archive.h @@ -0,0 +1,42 @@ +#ifndef BASE_WIN32_ARCHIVE_H +#define BASE_WIN32_ARCHIVE_H + +#ifdef EXTERNAL_DISTRO +namespace NAMESPACE +{ + +#endif +namespace Base +{ + + +#ifdef PACK_BIG_ENDIAN + + inline double byteSwap(double value) { byteReverse64(&value); return value; } + inline float byteSwap(float value) { byteReverse32(&value); return value; } + inline uint64 byteSwap(uint64 value) { byteReverse64(&value); return value; } + inline int64 byteSwap(int64 value) { byteReverse64(&value); return value; } + inline uint32 byteSwap(uint32 value) { byteReverse32(&value); return value; } + inline int32 byteSwap(int32 value) { byteReverse32(&value); return value; } + inline uint16 byteSwap(uint16 value) { byteReverse16(&value); return value; } + inline int16 byteSwap(int16 value) { byteReverse16(&value); return value; } + +#else + + inline double byteSwap(double value) { return value; } + inline float byteSwap(float value) { return value; } + inline uint64 byteSwap(uint64 value) { return value; } + inline int64 byteSwap(int64 value) { return value; } + inline uint32 byteSwap(uint32 value) { return value; } + inline int32 byteSwap(int32 value) { return value; } + inline uint16 byteSwap(uint16 value) { return value; } + inline int16 byteSwap(int16 value) { return value; } + +#endif + +}; +#ifdef EXTERNAL_DISTRO +}; +#endif + +#endif diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/win32/Platform.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/win32/Platform.cpp new file mode 100755 index 00000000..3b52563e --- /dev/null +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/win32/Platform.cpp @@ -0,0 +1,31 @@ +//////////////////////////////////////// +// Platform.cpp +// +// Purpose: +// 1. Implementation of the global functionality declaired in Platform.h. +// +// Revisions: +// 07/10/2001 Created +// + +#include "Platform.h" + +#ifdef EXTERNAL_DISTRO +namespace NAMESPACE +{ + +#endif +namespace Base +{ + + + CTimer::CTimer() : + mTimer(0) + { + } + + +}; +#ifdef EXTERNAL_DISTRO +}; +#endif diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/win32/Platform.h b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/win32/Platform.h new file mode 100755 index 00000000..aaee37b7 --- /dev/null +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/win32/Platform.h @@ -0,0 +1,98 @@ +//////////////////////////////////////// +// Platform.h +// +// Purpose: +// 1. Include relevent system headers that are platform specific. +// 2. Declair global platform specific functionality. +// 3. Include primative type definitions +// +// Global Functions: +// getTimer() : Return the current high resolution clock count. +// getTimerFrequency() : Return the frequency of the high resolution clock. +// sleep() : Voluntarily relinquish timeslice of the calling thread for a +// specified number of milliseconds. +// +// Revisions: +// 07/10/2001 Created +// + +#ifndef BASE_WIN32_PLATFORM_H +#define BASE_WIN32_PLATFORM_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include "Types.h" + +#ifdef EXTERNAL_DISTRO +namespace NAMESPACE +{ + +#endif +namespace Base +{ + + uint64 getTimer(void); + uint64 getTimerFrequency(void); + + inline uint64 getTimer(void) + { + uint64 result; + if (!QueryPerformanceCounter(reinterpret_cast(&result))) + result = 0; + return result; + } + + inline uint64 getTimerFrequency(void) + { + uint64 result; + if (!QueryPerformanceFrequency(reinterpret_cast(&result))) + result = 0; + return result; + } + + inline void sleep(uint32 ms) + { + Sleep(ms); + } + + + class CTimer + { + public: + CTimer(); + + void Set(uint32 seconds); + void Signal(); + bool Expired(); + + private: + uint32 mTimer; + }; + + inline void CTimer::Set(uint32 interval) + { + mTimer = (uint32)time(0) + interval; + } + + inline void CTimer::Signal() + { + mTimer = 0; + } + + inline bool CTimer::Expired() + { + return (mTimer <= (uint32)time(0)); + } +}; +#ifdef EXTERNAL_DISTRO +}; +#endif + + +#endif BASE_WIN32_PLATFORM_H \ No newline at end of file diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/win32/Types.h b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/win32/Types.h new file mode 100755 index 00000000..0c64cb2c --- /dev/null +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/win32/Types.h @@ -0,0 +1,42 @@ +//////////////////////////////////////// +// Types.h +// +// Purpose: +// 1. Define integer types that are unambiguous with respect to size +// +// Revisions: +// 07/10/2001 Created +// + +#ifndef BASE_WIN32_TYPES_H +#define BASE_WIN32_TYPES_H + +#ifdef EXTERNAL_DISTRO +namespace NAMESPACE +{ + +#endif +namespace Base +{ + +#define INT32_MAX 0x7FFFFFFF +#define INT32_MIN 0x80000000 +#define UINT32_MAX 0xFFFFFFFF + +typedef signed char int8; +typedef unsigned char uint8; +typedef short int16; +typedef unsigned short uint16; + +typedef int int32; +typedef unsigned uint32; +typedef __int64 int64; +typedef unsigned __int64 uint64; + +}; +#ifdef EXTERNAL_DISTRO +}; +#endif + +#endif // BASE_WIN32_TYPES_H + diff --git a/engine/server/application/CommoditiesServer/src/win32/WinMain.cpp b/engine/server/application/CommoditiesServer/src/win32/WinMain.cpp new file mode 100755 index 00000000..5051cfa4 --- /dev/null +++ b/engine/server/application/CommoditiesServer/src/win32/WinMain.cpp @@ -0,0 +1,70 @@ +#include "FirstCommodityServer.h" + +#include "sharedFoundation/FirstSharedFoundation.h" +#include "sharedCompression/SetupSharedCompression.h" +#include "sharedDebug/SetupSharedDebug.h" +#include "sharedFile/TreeFile.h" +#include "sharedFile/SetupSharedFile.h" +#include "sharedFoundation/ConfigFile.h" +#include "sharedFoundation/ExitChain.h" +#include "sharedFoundation/Os.h" +#include "sharedFoundation/SetupSharedFoundation.h" +#include "sharedGame/CommoditiesAdvancedSearchAttribute.h" +#include "sharedGame/ConfigSharedGame.h" +#include "sharedNetwork/SetupSharedNetwork.h" +#include "sharedNetwork/NetworkHandler.h" +#include "sharedNetworkMessages/SetupSharedNetworkMessages.h" +#include "sharedThread/SetupSharedThread.h" +#include "sharedUtility/DataTableManager.h" +#include "CommodityServer.h" +#include "ConfigCommodityServer.h" +#include "LocalizationManager.h" +#include "UnicodeUtils.h" + +int main(int argc, char ** argv) +{ + SetupSharedThread::install(); + SetupSharedDebug::install(1024); + + //-- setup foundation + SetupSharedFoundation::Data setupFoundationData(SetupSharedFoundation::Data::D_game); + + setupFoundationData.argc = argc; + setupFoundationData.argv = argv; + setupFoundationData.createWindow = false; + setupFoundationData.clockUsesSleep = true; + SetupSharedFoundation::install (setupFoundationData); + + ConfigSharedGame::install(); + SetupSharedCompression::install(); + SetupSharedFile::install(false); + SetupSharedNetworkMessages::install(); + + SetupSharedNetwork::SetupData networkSetupData; + SetupSharedNetwork::getDefaultServerSetupData(networkSetupData); + SetupSharedNetwork::install(networkSetupData); + NetworkHandler::install(); + + ConfigCommodityServer::install(); + + const bool displayBadStringIds = ConfigSharedGame::getDisplayBadStringIds (); + const bool debugStringIds = ConfigSharedGame::getDebugStringIds (); + Unicode::NarrowString defaultLocale(ConfigSharedGame::getDefaultLocale ()); + Unicode::UnicodeNarrowStringVector localeVector; + localeVector.push_back(defaultLocale); + + LocalizationManager::install (new TreeFile::TreeFileFactory, localeVector, debugStringIds, NULL, displayBadStringIds); + ExitChain::add(LocalizationManager::remove, "LocalizationManager::remove"); + + DataTableManager::install(); + CommoditiesAdvancedSearchAttribute::install(); + + //-- run server + SetupSharedFoundation::callbackWithExceptionHandling(CommodityServer::run); + + SetupSharedFoundation::remove(); + + return 0; +} + +//----------------------------------------------------------------------- diff --git a/engine/server/application/TransferServer/src/win32/WinMain.cpp b/engine/server/application/TransferServer/src/win32/WinMain.cpp new file mode 100755 index 00000000..b1533f7c --- /dev/null +++ b/engine/server/application/TransferServer/src/win32/WinMain.cpp @@ -0,0 +1,60 @@ +// main.cpp +// Copyright 2000-02, Sony Online Entertainment Inc., all rights reserved. +// Author: Justin Randall + +//----------------------------------------------------------------------- + +#include "FirstTransferServer.h" + +#include "sharedFoundation/FirstSharedFoundation.h" +#include "sharedCompression/SetupSharedCompression.h" +#include "sharedDebug/SetupSharedDebug.h" +#include "sharedFile/SetupSharedFile.h" +#include "sharedFoundation/Os.h" +#include "sharedFoundation/SetupSharedFoundation.h" +#include "sharedNetwork/SetupSharedNetwork.h" +#include "sharedNetwork/NetworkHandler.h" +#include "sharedNetworkMessages/SetupSharedNetworkMessages.h" +#include "sharedThread/SetupSharedThread.h" +#include "TransferServer.h" +#include "ConfigTransferServer.h" + +//----------------------------------------------------------------------- + +int main(int argc, char ** argv) +{ + SetupSharedThread::install(); + SetupSharedDebug::install(1024); + + //-- setup foundation + SetupSharedFoundation::Data setupFoundationData(SetupSharedFoundation::Data::D_game); + + setupFoundationData.argc = argc; + setupFoundationData.argv = argv; + setupFoundationData.createWindow = true; + SetupSharedFoundation::install (setupFoundationData); + + SetupSharedCompression::install(); + SetupSharedFile::install(false); + SetupSharedNetworkMessages::install(); + + SetupSharedNetwork::SetupData networkSetupData; + SetupSharedNetwork::getDefaultServerSetupData(networkSetupData); + SetupSharedNetwork::install(networkSetupData); + NetworkHandler::install(); + + //Os::setProgramName("TransferServer"); + ConfigTransferServer::install(); + + //-- run server + SetupSharedFoundation::callbackWithExceptionHandling(TransferServer::run); + + NetworkHandler::remove(); + SetupSharedFoundation::remove(); + SetupSharedThread::remove(); + + return 0; +} + +//----------------------------------------------------------------------- + diff --git a/engine/server/library/serverDatabase/src/win32/FirstServerDatabase.cpp b/engine/server/library/serverDatabase/src/win32/FirstServerDatabase.cpp new file mode 100755 index 00000000..944e604d --- /dev/null +++ b/engine/server/library/serverDatabase/src/win32/FirstServerDatabase.cpp @@ -0,0 +1,9 @@ +// ====================================================================== +// +// FirstServerDatabase.cpp +// copyright (c) 2001 Sony Online Entertainment +// +// ====================================================================== + +#include "serverDatabase/FirstServerDatabase.h" + diff --git a/engine/server/library/serverGame/src/win32/FirstServerGame.cpp b/engine/server/library/serverGame/src/win32/FirstServerGame.cpp new file mode 100755 index 00000000..c10e7d27 --- /dev/null +++ b/engine/server/library/serverGame/src/win32/FirstServerGame.cpp @@ -0,0 +1,10 @@ +// ====================================================================== +// +// FirstServerGame.cpp +// copyright (c) 2001 Sony Online Entertainment +// +// ====================================================================== + +#include "serverGame/FirstServerGame.h" + +// ====================================================================== diff --git a/engine/server/library/serverKeyShare/src/win32/FirstServerKeyShare.cpp b/engine/server/library/serverKeyShare/src/win32/FirstServerKeyShare.cpp new file mode 100755 index 00000000..541cbe71 --- /dev/null +++ b/engine/server/library/serverKeyShare/src/win32/FirstServerKeyShare.cpp @@ -0,0 +1,8 @@ +// ====================================================================== +// +// FirstServerKeyShare.cpp +// copyright (c) 2001 Sony Online Entertainment +// +// ====================================================================== + +#include "serverKeyShare/FirstServerKeyShare.h" diff --git a/engine/server/library/serverMetrics/src/win32/FirstServerMetrics.cpp b/engine/server/library/serverMetrics/src/win32/FirstServerMetrics.cpp new file mode 100755 index 00000000..5133f174 --- /dev/null +++ b/engine/server/library/serverMetrics/src/win32/FirstServerMetrics.cpp @@ -0,0 +1,9 @@ +// FirstServerMetrics.cpp +// Copyright 2000-02, Sony Online Entertainment Inc., all rights reserved. +// Author: Justin Randall + +//----------------------------------------------------------------------- + +#include "serverMetrics/FirstServerMetrics.h" + +//----------------------------------------------------------------------- diff --git a/engine/server/library/serverNetworkMessages/src/win32/FirstServerNetworkMessages.cpp b/engine/server/library/serverNetworkMessages/src/win32/FirstServerNetworkMessages.cpp new file mode 100755 index 00000000..16562107 --- /dev/null +++ b/engine/server/library/serverNetworkMessages/src/win32/FirstServerNetworkMessages.cpp @@ -0,0 +1,3 @@ + + +#include "serverNetworkMessages/FirstServerNetworkMessages.h" diff --git a/engine/server/library/serverPathfinding/src/win32/FirstServerPathfinding.cpp b/engine/server/library/serverPathfinding/src/win32/FirstServerPathfinding.cpp new file mode 100755 index 00000000..ac6ecea0 --- /dev/null +++ b/engine/server/library/serverPathfinding/src/win32/FirstServerPathfinding.cpp @@ -0,0 +1,8 @@ +// ====================================================================== +// +// FirstServerPathfinding.cpp +// copyright (c) 2001 Sony Online Entertainment +// +// ====================================================================== + +#include "serverPathfinding/FirstServerPathfinding.h" diff --git a/engine/server/library/serverScript/src/win32/FirstServerScript.cpp b/engine/server/library/serverScript/src/win32/FirstServerScript.cpp new file mode 100755 index 00000000..46a6979d --- /dev/null +++ b/engine/server/library/serverScript/src/win32/FirstServerScript.cpp @@ -0,0 +1,2 @@ + +#include "serverScript/FirstServerScript.h" \ No newline at end of file diff --git a/engine/server/library/serverUtility/src/win32/FirstServerUtility.cpp b/engine/server/library/serverUtility/src/win32/FirstServerUtility.cpp new file mode 100755 index 00000000..73488cc4 --- /dev/null +++ b/engine/server/library/serverUtility/src/win32/FirstServerUtility.cpp @@ -0,0 +1,2 @@ + +#include "serverUtility/FirstServerUtility.h" \ No newline at end of file diff --git a/engine/shared/application/TemplateCompiler/src/win32/FirstTemplateCompiler.cpp b/engine/shared/application/TemplateCompiler/src/win32/FirstTemplateCompiler.cpp new file mode 100755 index 00000000..ef9c16dc --- /dev/null +++ b/engine/shared/application/TemplateCompiler/src/win32/FirstTemplateCompiler.cpp @@ -0,0 +1 @@ +#include "FirstTemplateCompiler.h" diff --git a/engine/shared/application/TemplateCompiler/src/win32/FirstTemplateCompiler.h b/engine/shared/application/TemplateCompiler/src/win32/FirstTemplateCompiler.h new file mode 100755 index 00000000..355e5538 --- /dev/null +++ b/engine/shared/application/TemplateCompiler/src/win32/FirstTemplateCompiler.h @@ -0,0 +1,8 @@ +#include "sharedFoundationTypes/FoundationTypes.h" +#include "sharedDebug/FirstSharedDebug.h" +#include "sharedFoundation/FirstSharedFoundation.h" +#include +#include +#include +#include +#include \ No newline at end of file diff --git a/engine/shared/application/TemplateDefinitionCompiler/src/win32/FirstTemplateDefinitionCompiler.cpp b/engine/shared/application/TemplateDefinitionCompiler/src/win32/FirstTemplateDefinitionCompiler.cpp new file mode 100755 index 00000000..1444700b --- /dev/null +++ b/engine/shared/application/TemplateDefinitionCompiler/src/win32/FirstTemplateDefinitionCompiler.cpp @@ -0,0 +1 @@ +#include "FirstTemplateDefinitionCompiler.h" \ No newline at end of file diff --git a/engine/shared/application/TemplateDefinitionCompiler/src/win32/FirstTemplateDefinitionCompiler.h b/engine/shared/application/TemplateDefinitionCompiler/src/win32/FirstTemplateDefinitionCompiler.h new file mode 100755 index 00000000..355e5538 --- /dev/null +++ b/engine/shared/application/TemplateDefinitionCompiler/src/win32/FirstTemplateDefinitionCompiler.h @@ -0,0 +1,8 @@ +#include "sharedFoundationTypes/FoundationTypes.h" +#include "sharedDebug/FirstSharedDebug.h" +#include "sharedFoundation/FirstSharedFoundation.h" +#include +#include +#include +#include +#include \ No newline at end of file diff --git a/engine/shared/library/sharedCollision/src/win32/FirstSharedCollision.cpp b/engine/shared/library/sharedCollision/src/win32/FirstSharedCollision.cpp new file mode 100755 index 00000000..175da0d0 --- /dev/null +++ b/engine/shared/library/sharedCollision/src/win32/FirstSharedCollision.cpp @@ -0,0 +1,8 @@ +// ====================================================================== +// +// FirstSharedCollision.cpp +// copyright (c) 2001 Sony Online Entertainment +// +// ====================================================================== + +#include "sharedCollision/FirstSharedCollision.h" diff --git a/engine/shared/library/sharedCommandParser/src/win32/FirstSharedCommandParser.cpp b/engine/shared/library/sharedCommandParser/src/win32/FirstSharedCommandParser.cpp new file mode 100755 index 00000000..e07abaf5 --- /dev/null +++ b/engine/shared/library/sharedCommandParser/src/win32/FirstSharedCommandParser.cpp @@ -0,0 +1,8 @@ +// ====================================================================== +// +// FirstCommandParser.cpp +// copyright (c) 2001 Sony Online Entertainment +// +// ====================================================================== + +#include "sharedCommandParser/FirstSharedCommandParser.h" diff --git a/engine/shared/library/sharedCompression/src/win32/FirstSharedCompression.cpp b/engine/shared/library/sharedCompression/src/win32/FirstSharedCompression.cpp new file mode 100755 index 00000000..4c24e040 --- /dev/null +++ b/engine/shared/library/sharedCompression/src/win32/FirstSharedCompression.cpp @@ -0,0 +1,8 @@ +// ====================================================================== +// +// FirstCompression.cpp +// copyright (c) 2001 Sony Online Entertainment +// +// ====================================================================== + +#include "sharedCompression/FirstSharedCompression.h" diff --git a/engine/shared/library/sharedDatabaseInterface/src/win32/FirstSharedDatabaseInterface.cpp b/engine/shared/library/sharedDatabaseInterface/src/win32/FirstSharedDatabaseInterface.cpp new file mode 100755 index 00000000..46137c3b --- /dev/null +++ b/engine/shared/library/sharedDatabaseInterface/src/win32/FirstSharedDatabaseInterface.cpp @@ -0,0 +1,9 @@ +// ====================================================================== +// +// FirstServerDatabaseInterface.cpp +// copyright (c) 2001 Sony Online Entertainment +// +// ====================================================================== + +#include "sharedDatabaseInterface/FirstSharedDatabaseInterface.h" + diff --git a/engine/shared/library/sharedDatabaseInterface/src/win32/SQLC_Defs.h b/engine/shared/library/sharedDatabaseInterface/src/win32/SQLC_Defs.h new file mode 100755 index 00000000..6722c280 --- /dev/null +++ b/engine/shared/library/sharedDatabaseInterface/src/win32/SQLC_Defs.h @@ -0,0 +1,19 @@ +/* SQLC_Defs.h + * + * This file includes common definitions needed by the other SQLClasses header files. + * (Don't include this file directly -- files that require it will include it.) + * + * Note that this file is specific to each OS, because what header files are + * needed varies in each OS. In particular, Unix versions don't want windows.h. + * + * ODBC versions: includes definitions of ODBC datatypes needed by the various + * SQLClasses + */ + +#ifndef _SQLC_DEFS_H +#define _SQLC_DEFS_H + +#include +#include + +#endif \ No newline at end of file diff --git a/engine/shared/library/sharedDebug/src/win32/DebugHelp.cpp b/engine/shared/library/sharedDebug/src/win32/DebugHelp.cpp new file mode 100755 index 00000000..b80a6a45 --- /dev/null +++ b/engine/shared/library/sharedDebug/src/win32/DebugHelp.cpp @@ -0,0 +1,670 @@ +// ====================================================================== +// +// DebugHelp.cpp +// copyright 2000 Verant Interactive +// +// ====================================================================== + +#include "sharedDebug/FirstSharedDebug.h" +#include "sharedDebug/DebugHelp.h" + +#include "sharedFoundation/WindowsWrapper.h" + +#include +#include +#include + +// ====================================================================== + + +// ====================================================================== +// This was done to keep the header file from having to include or + +namespace DebugHelpNamespace +{ + static HINSTANCE library; + static HANDLE process; + + struct CallbackData + { + const char *name; + bool loaded; + }; + + typedef DWORD (__stdcall *SymSetOptionsFP)(IN DWORD SymOptions); + typedef BOOL (__stdcall *SymInitializeFP)(IN HANDLE hProcess, IN PSTR UserSearchPath, IN BOOL fInvadeProcess); + typedef BOOL (__stdcall *SymCleanupFP)(IN HANDLE hProcess); + + typedef BOOL (__stdcall *StackWalk64FP)(DWORD MachineType, HANDLE hProcess, HANDLE hThread, LPSTACKFRAME64 StackFrame, PVOID ContextRecord, PREAD_PROCESS_MEMORY_ROUTINE64 ReadMemoryRoutine, PFUNCTION_TABLE_ACCESS_ROUTINE64 FunctionTableAccessRoutine, PGET_MODULE_BASE_ROUTINE64 GetModuleBaseRoutine, PTRANSLATE_ADDRESS_ROUTINE64 TranslateAddress); + typedef BOOL (__stdcall *SymGetModuleInfo64FP)(IN HANDLE hProcess, IN DWORD64 dwAddr, OUT PIMAGEHLP_MODULE64 ModuleInfo); + typedef DWORD64 (__stdcall *SymLoadModule64FP)(IN HANDLE hProcess, IN HANDLE hFile, IN PSTR ImageName, IN PSTR ModuleName, IN DWORD64 BaseOfDll, IN DWORD SizeOfDll); + typedef BOOL (__stdcall *SymGetSymFromAddr64FP)(IN HANDLE hProcess, IN DWORD64 dwAddr, OUT PDWORD64 pdwDisplacement, OUT PIMAGEHLP_SYMBOL64 Symbol); + typedef BOOL (__stdcall *SymGetLineFromAddr64FP)(IN HANDLE hProcess, IN DWORD64 dwAddr, OUT PDWORD pdwDisplacement, OUT PIMAGEHLP_LINE64 Line); + typedef PVOID (__stdcall *SymFunctionTableAccess64FP)(HANDLE hProcess, DWORD64 AddrBase); + typedef DWORD64 (__stdcall *SymGetModuleBase64FP)(IN HANDLE hProcess, IN DWORD64 dwAddr); + typedef BOOL (__stdcall *SymEnumerateModules64FP)(HANDLE hProcess, PSYM_ENUMMODULES_CALLBACK64 EnumModulesCallback, PVOID UserContext); + typedef BOOL (__stdcall *EnumerateLoadedModules64FP)(IN HANDLE hProcess, IN PENUMLOADED_MODULES_CALLBACK64 EnumLoadedModulesCallback, IN PVOID UserContext); + typedef BOOL (__stdcall *MiniDumpWriteDumpFP)(HANDLE hProcess, DWORD ProcessId, HANDLE hFile, MINIDUMP_TYPE DumpType, PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam, PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam, PMINIDUMP_CALLBACK_INFORMATION CallbackParam); + + static SymSetOptionsFP symSetOptions; + static SymInitializeFP symInitialize; + static SymCleanupFP symCleanup; + static StackWalk64FP stackWalk64; + static SymGetModuleInfo64FP symGetModuleInfo64; + static SymLoadModule64FP symLoadModule64; + static SymGetSymFromAddr64FP symGetSymFromAddr64; + static SymGetLineFromAddr64FP symGetLineFromAddr64; + static SymFunctionTableAccess64FP symFunctionTableAccess64; + static SymGetModuleBase64FP symGetModuleBase64; + static SymEnumerateModules64FP symEnumerateModules64; + static EnumerateLoadedModules64FP enumerateLoadedModules64; + static MiniDumpWriteDumpFP miniDumpWriteDump; + static CRITICAL_SECTION criticalSection; + + // ---------------------------------------------------------------------- + + //BOOL CALLBACK loadSymbolsForDllCallback(PTSTR ModuleName, DWORD64 ModuleBase, ULONG ModuleSize, PVOID UserContext); + + // ---------------------------------------------------------------------- + + + typedef unsigned long int ub4; /* unsigned 4-byte quantities */ + typedef unsigned char ub1; /* unsigned 1-byte quantities */ + + #define hashsize(n) ((ub4)1<<(n)) + #define hashmask(n) (hashsize(n)-1) + + /* + -------------------------------------------------------------------- + mix -- mix 3 32-bit values reversibly. + For every delta with one or two bits set, and the deltas of all three + high bits or all three low bits, whether the original value of a,b,c + is almost all zero or is uniformly distributed, + * If mix() is run forward or backward, at least 32 bits in a,b,c + have at least 1/4 probability of changing. + * If mix() is run forward, every bit of c will change between 1/3 and + 2/3 of the time. (Well, 22/100 and 78/100 for some 2-bit deltas.) + mix() was built out of 36 single-cycle latency instructions in a + structure that could supported 2x parallelism, like so: + a -= b; + a -= c; x = (c>>13); + b -= c; a ^= x; + b -= a; x = (a<<8); + c -= a; b ^= x; + c -= b; x = (b>>13); + ... + Unfortunately, superscalar Pentiums and Sparcs can't take advantage + of that parallelism. They've also turned some of those single-cycle + latency instructions into multi-cycle latency instructions. Still, + this is the fastest good hash I could find. There were about 2^^68 + to choose from. I only looked at a billion or so. + -------------------------------------------------------------------- + */ + #define mix(a,b,c) \ + { \ + a -= b; a -= c; a ^= (c>>13); \ + b -= c; b -= a; b ^= (a<<8); \ + c -= a; c -= b; c ^= (b>>13); \ + a -= b; a -= c; a ^= (c>>12); \ + b -= c; b -= a; b ^= (a<<16); \ + c -= a; c -= b; c ^= (b>>5); \ + a -= b; a -= c; a ^= (c>>3); \ + b -= c; b -= a; b ^= (a<<10); \ + c -= a; c -= b; c ^= (b>>15); \ + } + + /* + -------------------------------------------------------------------- + hash() -- hash a variable-length key into a 32-bit value + k : the key (the unaligned variable-length array of bytes) + len : the length of the key, counting by bytes + initval : can be any 4-byte value + Returns a 32-bit value. Every bit of the key affects every bit of + the return value. Every 1-bit and 2-bit delta achieves avalanche. + About 6*len+35 instructions. + + The best hash table sizes are powers of 2. There is no need to do + mod a prime (mod is sooo slow!). If you need less than 32 bits, + use a bitmask. For example, if you need only 10 bits, do + h = (h & hashmask(10)); + In which case, the hash table should have hashsize(10) elements. + + If you are hashing n strings (ub1 **)k, do it like this: + for (i=0, h=0; i= 12) + { + a += (k[0] +((ub4)k[1]<<8) +((ub4)k[2]<<16) +((ub4)k[3]<<24)); + b += (k[4] +((ub4)k[5]<<8) +((ub4)k[6]<<16) +((ub4)k[7]<<24)); + c += (k[8] +((ub4)k[9]<<8) +((ub4)k[10]<<16)+((ub4)k[11]<<24)); + mix(a,b,c); + k += 12; len -= 12; + } + + /*------------------------------------- handle the last 11 bytes */ + c += length; + switch(len) /* all the case statements fall through */ + { + case 11: c+=((ub4)k[10]<<24); + case 10: c+=((ub4)k[9]<<16); + case 9 : c+=((ub4)k[8]<<8); + /* the first byte of c is reserved for the length */ + case 8 : b+=((ub4)k[7]<<24); + case 7 : b+=((ub4)k[6]<<16); + case 6 : b+=((ub4)k[5]<<8); + case 5 : b+=k[4]; + case 4 : a+=((ub4)k[3]<<24); + case 3 : a+=((ub4)k[2]<<16); + case 2 : a+=((ub4)k[1]<<8); + case 1 : a+=k[0]; + /* case 0: nothing left to add */ + } + mix(a,b,c); + /*-------------------------------------------- report the result */ + return c; + } +#endif + + // version optimized for 4 byte input. + static ub4 hash_DWORD(const DWORD in, const ub4 initval) + { + ub1 *const k = (ub1 *)∈ + ub4 a, b, c, len; + + /* Set up the internal state */ + len = 4; + a = b = 0x9e3779b9; /* the golden ratio; an arbitrary value */ + c = initval; /* the previous hash value */ + + /*------------------------------------- handle the last 11 bytes */ + c += 4; + a+=((ub4)k[3]<<24); + a+=((ub4)k[2]<<16); + a+=((ub4)k[1]<<8); + a+=k[0]; + + mix(a,b,c); + + /*-------------------------------------------- report the result */ + return c; + } + + + // ---------------------------------------------------------------------- + + struct BaseAddressLookup + { + DWORD64 keyAddress; // key + DWORD64 baseAddress; // value + }; + + static BaseAddressLookup * s_baseAddressCache; + static inline unsigned _baseAddressCachePageBits() { return 8; } + static inline unsigned _baseAddressCacheBits() { return _baseAddressCachePageBits() + 12; } + static inline unsigned _baseAddressCacheSize() { return 1 << (_baseAddressCacheBits()); } + static inline unsigned _baseAddressCacheElements() { return _baseAddressCacheSize() / sizeof(*s_baseAddressCache); } + static inline unsigned _baseAddressCacheMask() { return _baseAddressCacheElements() - 1; } + + static int s_baseAddressCacheMisses; + static int s_baseAddressCacheHits; + + static int s_baseAddressElements; + static int s_baseAddressUsed; + + /* + static void _baseAddressCacheAnalyze() + { + s_baseAddressElements=0; + s_baseAddressUsed=0; + + unsigned i; + const unsigned count = _baseAddressCacheElements(); + for (i=0;ibaseAddress) + { + s_baseAddressUsed++; + } + } + } + */ + + static DWORD64 _baseAddressLookup(DWORD64 addr) + { + BaseAddressLookup *lookup; + + unsigned long bits = _baseAddressCacheBits(); + + DWORD *addr32 = (DWORD *)&addr; + unsigned long hash32 = hash_DWORD(addr32[0], addr32[1]); + unsigned long hash = (hash32>>(32-bits)) ^ hash32; + + unsigned long mask = _baseAddressCacheMask(); + + unsigned long index = hash & mask; + lookup = s_baseAddressCache + index; + if (lookup->keyAddress==addr) + { + s_baseAddressCacheHits++; + //DEBUG_FATAL(symGetModuleBase64(process, addr) != lookup->baseAddress, ("Cache failure.\n")); + return lookup->baseAddress; + } + else + { + s_baseAddressCacheMisses++; + + DWORD64 baseAddress = symGetModuleBase64(process, addr); + + lookup->keyAddress=addr; + lookup->baseAddress=baseAddress; + + return baseAddress; + } + } + + static DWORD64 __stdcall getModuleBase(HANDLE hProcess, DWORD64 dwAddr) + { + UNREF(hProcess); + DEBUG_FATAL(hProcess!=process, ("Wrong process handle for module base lookup.\n")); + return _baseAddressLookup(dwAddr); + } + + // ---------------------------------------------------------------------- + struct FunctionTableLookup + { + DWORD64 keyAddress; // key + PVOID functionTable; // value + }; + + static FunctionTableLookup * s_functionTableCache; + static inline unsigned _functionTableCachePageBits() { return 4; } + static inline unsigned _functionTableCacheBits() { return _functionTableCachePageBits() + 12; } + static inline unsigned _functionTableCacheSize() { return 1 << (_functionTableCacheBits()); } + static inline unsigned _functionTableCacheElements() { return _functionTableCacheSize() / sizeof(*s_functionTableCache); } + static inline unsigned _functionTableCacheMask() { return _functionTableCacheElements() - 1; } + + static int s_functionTableCacheMisses; + static int s_functionTableCacheHits; + + + static PVOID _functionTableLookup(DWORD64 addr) + { + FunctionTableLookup *lookup; + + unsigned long bits = _functionTableCacheBits(); + + DWORD *addr32 = (DWORD *)&addr; + unsigned long hash32 = hash_DWORD(addr32[0], addr32[1]); + unsigned long hash = (hash32>>(32-bits)) ^ hash32; + + unsigned long mask = _functionTableCacheMask(); + + unsigned long index = hash & mask; + lookup = s_functionTableCache + index; + if (lookup->keyAddress==addr) + { + s_functionTableCacheHits++; + //DEBUG_FATAL(symFunctionTableAccess64(process, addr) != lookup->functionTable, ("Cache failure.\n")); + return lookup->functionTable; + } + else + { + s_functionTableCacheMisses++; + PVOID functionTable = symFunctionTableAccess64(process, addr); + lookup->keyAddress=addr; + lookup->functionTable=functionTable; + + return functionTable; + } + } + + static PVOID __stdcall functionTableAccess(HANDLE hProcess, DWORD64 dwAddr) + { + UNREF(hProcess); + DEBUG_FATAL(hProcess!=process, ("Wrong process handle for module base lookup.\n")); + return _functionTableLookup(DWORD(dwAddr)); + } + + // ---------------------------------------------------------------------- +} +using namespace DebugHelpNamespace; + +// ---------------------------------------------------------------------- + +BOOL CALLBACK loadSymbolsForDllCallback(PSTR ModuleName, DWORD64 ModuleBase, ULONG ModuleSize, PVOID UserContext) +{ + if (!library) + return false; + + CallbackData *callbackData = reinterpret_cast(UserContext); + + // see if this is the right file module and if we can load its symbol information + if (_stricmp(ModuleName, callbackData->name) == 0 && symLoadModule64(process, NULL, ModuleName, 0, ModuleBase, ModuleSize) != 0) + { + callbackData->loaded = true; + return FALSE; + } + + return TRUE; +} + +// ====================================================================== + +void DebugHelp::install() +{ + DEBUG_FATAL(library, ("DebugHelp already installed")); + + library = LoadLibrary("dbghelp_6.3.17.0.dll"); + if (library) + { + process = GetCurrentProcess(); + +#define GPA(a, b) a = reinterpret_cast(GetProcAddress(library, #b)); DEBUG_FATAL(!a, ("GetProcAddress failed for " #b)) + GPA(symSetOptions, SymSetOptions); + GPA(symInitialize, SymInitialize); + GPA(symCleanup, SymCleanup); + GPA(stackWalk64, StackWalk64); + GPA(symGetModuleInfo64, SymGetModuleInfo64); + GPA(symLoadModule64, SymLoadModule64); + GPA(symGetSymFromAddr64, SymGetSymFromAddr64); + GPA(symGetLineFromAddr64, SymGetLineFromAddr64); + GPA(symFunctionTableAccess64, SymFunctionTableAccess64); + GPA(symGetModuleBase64, SymGetModuleBase64); + GPA(symEnumerateModules64, SymEnumerateModules64); + GPA(enumerateLoadedModules64, EnumerateLoadedModules64); + GPA(miniDumpWriteDump, MiniDumpWriteDump); +#undef GPA + + IGNORE_RETURN(symSetOptions(SYMOPT_DEFERRED_LOADS | SYMOPT_UNDNAME | SYMOPT_LOAD_LINES)); + + // get the path to the executable + char executableDirectory[MAX_PATH * 2]; + const DWORD result = GetModuleFileName(NULL, executableDirectory, sizeof(executableDirectory)); + FATAL(result == 0, ("GetModuleFileName failed")); + char * const slash = strrchr(executableDirectory, '\\'); + DEBUG_FATAL(!slash, ("Executable path does not contain a slash")); + *slash = '\0'; + + const BOOL result1 = symInitialize(process, executableDirectory, TRUE); + UNREF(result1); + DEBUG_FATAL(!result1, ("SymInitialize failed")); + + // ----------------------------------------------------------------------- + + s_baseAddressCache = (BaseAddressLookup *)VirtualAlloc(0, _baseAddressCacheSize(), MEM_COMMIT, PAGE_READWRITE); + + s_functionTableCache = (FunctionTableLookup *)VirtualAlloc(0, _functionTableCacheSize(), MEM_COMMIT, PAGE_READWRITE); + + // ----------------------------------------------------------------------- + } + + // Initialize the critical section one time only. + InitializeCriticalSection(&criticalSection); +} + +// ---------------------------------------------------------------------- + +void DebugHelp::remove() +{ + if (s_baseAddressCache) + { + VirtualFree(s_baseAddressCache, 0, MEM_RELEASE); + s_baseAddressCache=0; + } + + if (s_functionTableCache) + { + VirtualFree(s_functionTableCache, 0, MEM_RELEASE); + s_functionTableCache=0; + } + + if (library) + { + IGNORE_RETURN(symCleanup(process)); + IGNORE_RETURN(FreeLibrary(library)); + library = NULL; + process = NULL; + symSetOptions = NULL; + symInitialize = NULL; + symCleanup = NULL; + stackWalk64 = NULL; + symGetModuleInfo64 = NULL; + symLoadModule64 = NULL; + symGetSymFromAddr64 = NULL; + symGetLineFromAddr64 = NULL; + symFunctionTableAccess64 = NULL; + symGetModuleBase64 = NULL; + symEnumerateModules64 = NULL; + enumerateLoadedModules64 = NULL; + } + + // Release resources used by the critical section object. + DeleteCriticalSection(&criticalSection); +} + +// ---------------------------------------------------------------------- + +bool DebugHelp::loadSymbolsForDll(const char *name) +{ + if (!library) + return false; + + CallbackData callbackData = { name, false }; + enumerateLoadedModules64(process, (PENUMLOADED_MODULES_CALLBACK64)loadSymbolsForDllCallback, reinterpret_cast(&callbackData)); + return callbackData.loaded; +} + +// ---------------------------------------------------------------------- +#pragma warning (disable: 4740 4748) +void DebugHelp::getCallStack(uint32 *callStack, int sizeOfCallStack) +{ + { + for (int i = 0; i < sizeOfCallStack; ++i) + callStack[i] = 0; + } + + if (!library) + return; + + CONTEXT context; + Zero(context); + context.ContextFlags = CONTEXT_FULL; + + // GetThreadContext returns invalid data when called from within the same thread + //if (!GetThreadContext(GetCurrentThread(), &context)) + // return; + + EnterCriticalSection(&criticalSection); + __asm + { + call GetEIP + GetEIP: + pop eax + mov context.Eip, eax + mov context.Esp, esp + mov context.Ebp, ebp + } + LeaveCriticalSection(&criticalSection); + + STACKFRAME64 stackFrame; + Zero(stackFrame); + stackFrame.AddrPC.Mode = AddrModeFlat; + stackFrame.AddrPC.Offset = context.Eip; + stackFrame.AddrStack.Offset = context.Esp; + stackFrame.AddrStack.Mode = AddrModeFlat; + stackFrame.AddrFrame.Offset = context.Ebp; + stackFrame.AddrFrame.Mode = AddrModeFlat; + + for (int i = 0; i < sizeOfCallStack; ++i, ++callStack) + { + if (stackWalk64(IMAGE_FILE_MACHINE_I386, process, process, &stackFrame, &context, NULL, functionTableAccess, getModuleBase, NULL)) + { + const DWORD64 Offset = stackFrame.AddrPC.Offset; + *callStack = DWORD(Offset); + } + } +} + +// ---------------------------------------------------------------------- + +void DebugHelp::reportCallStack(int const maxStackDepth) +{ + // look up the call stack information + int const callStackOffset = 2; + int const callStackSize = callStackOffset + maxStackDepth; + uint32 * callStack = static_cast(_alloca((callStackOffset + maxStackDepth) * sizeof(uint32))); + getCallStack(callStack, callStackOffset + maxStackDepth); + + // look up the caller's file and line + if (callStack[callStackOffset]) + { + char lib[4 * 1024] = { '\0' }; + char file[4 * 1024] = { '\0' }; + int line = 0; + for (int i = callStackOffset; i < callStackSize; ++i) + { + if (callStack[i]) + { + if (lookupAddress(callStack[i], lib, file, sizeof(file), line)) + REPORT_LOG(true, ("\t%s(%d) : caller %d\n", file, line, i-callStackOffset)); + else + REPORT_LOG(true, ("\tunknown(0x%08X) : caller %d\n", static_cast(callStack[i]), i-callStackOffset)); + } + } + } +} + +// ---------------------------------------------------------------------- + +bool DebugHelp::lookupAddress(uint32 address, char *libName, char *fileName, int fileNameLength, int &line) +{ + UNREF(libName); + + if (!library) + return false; + + // make sure the image is loaded + IMAGEHLP_MODULE64 imageHelpModule; + Zero(imageHelpModule); + imageHelpModule.SizeOfStruct = sizeof(imageHelpModule); + if (!symGetModuleInfo64(process, address, &imageHelpModule)) + return false; + + // look up the symbol + const int MaxNameLength = 256; + char buffer[sizeof(IMAGEHLP_SYMBOL64) + MaxNameLength]; + memset(buffer, 0, sizeof(buffer)); + IMAGEHLP_SYMBOL64 *imageHelpSymbol = reinterpret_cast(buffer); + imageHelpSymbol->SizeOfStruct = sizeof(IMAGEHLP_SYMBOL64); + imageHelpSymbol->Address = address; + imageHelpSymbol->MaxNameLength = MaxNameLength; + { + DWORD64 displacement = 0; + if (!symGetSymFromAddr64(process, address, &displacement, imageHelpSymbol)) + { + return false; + } + } + + // look up the source file name and line number + IMAGEHLP_LINE64 imageHelpLine; + Zero(imageHelpLine); + imageHelpLine.SizeOfStruct = sizeof(imageHelpLine); + { + DWORD displacement = 0; + if (!symGetLineFromAddr64(process, address, &displacement, &imageHelpLine)) + { + return false; + } + } + + // return the results + strncpy(fileName, imageHelpLine.FileName, static_cast(fileNameLength)); + line = static_cast(imageHelpLine.LineNumber); + return true; +} + +// ---------------------------------------------------------------------- + +bool DebugHelp::writeMiniDump(char const *miniDumpFileName, PEXCEPTION_POINTERS exceptionPointers) +{ + if (!miniDumpWriteDump) + return false; + + char buffer[256]; + if (!miniDumpFileName) + { + // get the program name + char programName[512]; + DWORD result = GetModuleFileName(NULL, programName, sizeof(programName)); + if (result == 0) + return false; + + // get the file name without the path + const char *shortProgramName = strrchr(programName, '\\'); + if (shortProgramName) + ++shortProgramName; + else + shortProgramName = programName; + + // lop off the extension + char *dot = const_cast(strchr(shortProgramName, '.')); + if (dot) + *dot = '\0'; + + // create a reasonable minidump filename + snprintf(buffer, sizeof(buffer), "%s_%d.mdmp", shortProgramName, static_cast(GetCurrentProcessId())); + miniDumpFileName = buffer; + } + + // create the file + HANDLE const file = CreateFile(miniDumpFileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_ARCHIVE, NULL); + if (file == INVALID_HANDLE_VALUE) + return false; + + // create the exception information + MINIDUMP_EXCEPTION_INFORMATION exceptionInformationData; + MINIDUMP_EXCEPTION_INFORMATION *exceptionInformation = 0; + if (exceptionPointers) + { + exceptionInformationData.ThreadId = GetCurrentThreadId(); + exceptionInformationData.ExceptionPointers = exceptionPointers; + exceptionInformationData.ClientPointers = true; + exceptionInformation = &exceptionInformationData; + } + + // @todo make the minidump style modifiable + BOOL const result = miniDumpWriteDump(process, GetCurrentProcessId(), file, MiniDumpNormal, exceptionInformation, NULL, NULL); + + // close the file + CloseHandle(file); + + return result ? true : false; +} + +// ====================================================================== diff --git a/engine/shared/library/sharedDebug/src/win32/DebugHelp.h b/engine/shared/library/sharedDebug/src/win32/DebugHelp.h new file mode 100755 index 00000000..ead64d75 --- /dev/null +++ b/engine/shared/library/sharedDebug/src/win32/DebugHelp.h @@ -0,0 +1,35 @@ +// ====================================================================== +// +// DebugHelp.h +// copyright 2000 Verant Interactive +// +// ====================================================================== + +#ifndef DEBUG_HELP_H +#define DEBUG_HELP_H + +// ====================================================================== + +typedef unsigned long uint32; + +// ====================================================================== + +class DebugHelp +{ +public: + + static void install(); + static void remove(); + + static bool loadSymbolsForDll(const char *name); + + static void getCallStack(uint32 *callStack, int sizeOfCallStack); + static void reportCallStack(int const maxStackDepth = 4); + static bool lookupAddress(uint32 address, char *libName, char *fileName, int fileNameLength, int &line); + + static bool writeMiniDump(char const *miniDumpFileName=0, PEXCEPTION_POINTERS exceptionPointers=0); +}; + +// ====================================================================== + +#endif diff --git a/engine/shared/library/sharedDebug/src/win32/DebugMonitor.cpp b/engine/shared/library/sharedDebug/src/win32/DebugMonitor.cpp new file mode 100755 index 00000000..ebc7b249 --- /dev/null +++ b/engine/shared/library/sharedDebug/src/win32/DebugMonitor.cpp @@ -0,0 +1,321 @@ +// ====================================================================== +// +// DebugMonitor.cpp +// copyright 1998 Bootprint Entertainment +// copyright 2001-2004 Sony Online Entertainment +// +// ====================================================================== + +#include "sharedDebug/FirstSharedDebug.h" +#include "sharedDebug/DebugMonitor.h" + +#if PRODUCTION == 0 + +#include "sharedDebug/DebugFlags.h" +#include "sharedFoundation/ConfigFile.h" + +// ====================================================================== + +namespace DebugMonitorNamespace +{ + typedef void (*ChangedWindowCallback)(int x, int y, int width, int height); + + typedef bool (*InstallFunction)(int x, int y, int width, int height); + typedef void (*RemoveFunction)(); + typedef void (*ShowFunction)(); + typedef void (*HideFunction)(); + typedef void (*SetChangedWindowCallback)(ChangedWindowCallback); + typedef void (*SetBehindWindowFunction)(HWND window); + typedef void (*ClearScreenFunction)(); + typedef void (*ClearToCursorFunction)(); + typedef void (*GotoXYFunction)(int x, int y); + typedef void (*PrintFunction)(const char *string); + + void changedWindowCallback(int x, int y, int width, int height); + + HINSTANCE dll; + HKEY registryKey = HKEY_CLASSES_ROOT; + RemoveFunction removeFunction; + ShowFunction showFunction; + HideFunction hideFunction; + SetBehindWindowFunction setBehindWindowFunction; + ClearScreenFunction clearScreenFunction; + ClearToCursorFunction clearToCursorFunction; + GotoXYFunction gotoXYFunction; + PrintFunction printFunction; + + bool noClear; + + int GetRegistryValue(char const * name, int defaultValue) + { + int value; + DWORD type = 0; + DWORD size = sizeof(DWORD); + LONG result = RegQueryValueEx(registryKey, name, NULL, &type, reinterpret_cast(&value), &size); + if ((result != ERROR_SUCCESS || type != REG_DWORD) && (size != sizeof(int))) + value = defaultValue; + return value; + } + + void SetRegistryValue(char const * name, int value) + { + RegSetValueEx(registryKey, name, NULL, REG_DWORD, reinterpret_cast(&value), sizeof(int)); + } +} +using namespace DebugMonitorNamespace; + +// ====================================================================== +// Install the debug monitor subsystem +// +// Remarks: +// +// This routine will first attempt to install the selected debug monitor. + +void DebugMonitor::install() +{ + dll = LoadLibrary("debugWindow.dll"); + if (dll) + { + InstallFunction installFunction = reinterpret_cast(GetProcAddress(dll, "install")); + + RegCreateKeyEx(HKEY_CURRENT_USER, "Software\\Sony Online Entertainment\\DebugWindow", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, ®istryKey, NULL); + + int const x = ConfigFile::getKeyInt("SharedDebug", "debugWindowX", GetRegistryValue("x", 0)); + int const y = ConfigFile::getKeyInt("SharedDebug", "debugWindowY", GetRegistryValue("y", 0)); + int const width = ConfigFile::getKeyInt("SharedDebug", "debugWindowWidth", GetRegistryValue("width", 80)); + int const height = ConfigFile::getKeyInt("SharedDebug", "debugWindowHeight", GetRegistryValue("height", 50)); + + if (installFunction && installFunction(x, y, width, height)) + { + showFunction = reinterpret_cast(GetProcAddress(dll, "showWindow")); + hideFunction = reinterpret_cast(GetProcAddress(dll, "hideWindow")); + removeFunction = reinterpret_cast(GetProcAddress(dll, "remove")); + setBehindWindowFunction = reinterpret_cast(GetProcAddress(dll, "setBehindWindow")); + clearScreenFunction = reinterpret_cast(GetProcAddress(dll, "clearScreen")); + clearToCursorFunction = reinterpret_cast(GetProcAddress(dll, "clearToCursor")); + gotoXYFunction = reinterpret_cast(GetProcAddress(dll, "gotoXY")); + printFunction = reinterpret_cast(GetProcAddress(dll, "print")); + + SetChangedWindowCallback setChangedWindowCallback = reinterpret_cast(GetProcAddress(dll, "setChangedWindowCallback")); + if (setChangedWindowCallback) + (*setChangedWindowCallback)(changedWindowCallback); + + DebugFlags::registerFlag(noClear, "SharedDebug", "noDebugMonitorClear"); + + if (ConfigFile::getKeyBool("SharedDebug", "debugWindow", false)) + show(); + } + else + { + installFunction = NULL; + const BOOL result = FreeLibrary(dll); + dll = NULL; + UNREF(result); + DEBUG_FATAL(!result, ("FreeLibrary failed")); + } + } +} + +// ---------------------------------------------------------------------- +/** + * Remove the debug monitor subsystem. + */ + +void DebugMonitor::remove() +{ + if (removeFunction) + removeFunction(); + + removeFunction = NULL; + setBehindWindowFunction = NULL; + clearScreenFunction = NULL; + clearToCursorFunction = NULL; + gotoXYFunction = NULL; + printFunction = NULL; + + if (dll) + { + const BOOL result = FreeLibrary(dll); + UNREF(result); + DEBUG_FATAL(!result, ("FreeLibrary failed")); + dll = NULL; + + if (registryKey != HKEY_CLASSES_ROOT) + { + RegCloseKey(registryKey); + registryKey = HKEY_CLASSES_ROOT; + } + } +} + +// ---------------------------------------------------------------------- + +void DebugMonitorNamespace::changedWindowCallback(int const x, int const y, int const width, int const height) +{ + SetRegistryValue("x", x); + SetRegistryValue("y", y); + SetRegistryValue("width", width); + SetRegistryValue("height", height); +} + +// ---------------------------------------------------------------------- + +void DebugMonitor::show() +{ + if (showFunction) + (*showFunction)(); +} + +// ---------------------------------------------------------------------- + +void DebugMonitor::hide() +{ + if (hideFunction) + (*hideFunction)(); +} + +// ---------------------------------------------------------------------- +/** + * Set the debug window's z-order. + */ + +void DebugMonitor::setBehindWindow(HWND window) +{ + if (setBehindWindowFunction) + setBehindWindowFunction(window); +} + +// ---------------------------------------------------------------------- +/** + * Clear the debug monitor and home the cursor. + * + * If the mono monitor is not installed, this routine does nothing. + * + * This routine will clear the contents of the debug monitor, reset the screen + * offset to 0, and move the cursor to the upper left corner of the screen. + * + * @see DebugMonitor::home(), DebugMonitor::clearToCursor() + */ + +void DebugMonitor::clearScreen() +{ + if (noClear) + return; + + if (clearScreenFunction) + clearScreenFunction(); +} + +// ---------------------------------------------------------------------- +/** + * Clear the debug monitor to the current cursor position and home the cursor. + * + * If the debug monitor is not installed, this routine does nothing. + * + * This routine will clear the contents of the debug monitor only up to the + * cursor position. If the cursor is not very far down on the screen, + * this routine may be significantly more efficient clearing the screen. + * + * It will also move the cursor to the upper left corner of the screen. + * + * @see DebugMonitor::clearScreen(), DebugMonitor::home() + */ + +void DebugMonitor::clearToCursor() +{ + if (clearToCursorFunction) + clearToCursorFunction(); + else + clearScreen(); +} + +// ====================================================================== +// Move the cursor to the upper left hand corner of the mono monitor screen +// +// Remarks: +// +// If the debug monitor is not installed, this routine does nothing. +// +// All printing happens at the cursor position. +// +// This routine is identical to calling gotoXY(0,0); +// +// See Also: +// +// DebugMonitor::gotoXY() + +void DebugMonitor::home() +{ + gotoXY(0,0); +} + +// ---------------------------------------------------------------------- +/** + * Position the cursor on the debug monitor screen. + * + * If the debug monitor is not installed, this routine does nothing. + * + * All printing happens at the cursor position. + * + * @param x New X position for the cursor + * @param y New Y position for the cursor + */ + +void DebugMonitor::gotoXY(int x, int y) +{ + if (gotoXYFunction) + gotoXYFunction(x, y); +} + +// ---------------------------------------------------------------------- +/** + * Display a string on the debug monitor. + * + * If the debug monitor is not installed, this routine does nothing. + * + * Printing occurs from the cursor position. + * + * Newline characters '\n' will cause the cursor position to advance to the + * beginning of the next line. If the cursor is already on the last line of + * the screen, the screen will scroll up one line and the cursor will move to + * the beginning of the last line. + * + * The backspace character '\b' will cause the cursor to move one character + * backwards. If at the beginning of the line, the cursor will move to the + * end of the previous line. If already on the first line of the screen, the + * cursor position and screen contents will be unchanged. + * + * All other characters are placed directly into the text frame buffer. + * After each character, the cursor will be logically advanced one + * character forward. If the cursor was on the last column, it will advance + * to the next line. If the cursor was already on the last line, the screen + * will be scrolled up one line and the cursor will move to the beginning of + * the last line. + * + * @param string String to display on the debug monitor + */ + +void DebugMonitor::print(const char *string) +{ + if (printFunction) + printFunction(string); +} + +// ---------------------------------------------------------------------- +/** + * Ensure all changes to the DebugMonitor have taken effect by the time + * this function returns. + * + * Note: some platforms may do nothing here. The Win32 platform does not + * require flushing. The Linux platform does. Call it assuming + * that it is needed. It will be a no-op when not required. + */ + +void DebugMonitor::flushOutput() +{ + // Win32 debug monitors don't need to do anything here. +} + +// ====================================================================== + +#endif diff --git a/engine/shared/library/sharedDebug/src/win32/DebugMonitor.h b/engine/shared/library/sharedDebug/src/win32/DebugMonitor.h new file mode 100755 index 00000000..c992ed11 --- /dev/null +++ b/engine/shared/library/sharedDebug/src/win32/DebugMonitor.h @@ -0,0 +1,48 @@ +// ====================================================================== +// +// DebugMonitor.h +// +// Portions copyright 1998 Bootprint Entertainment +// Portions copyright 2002-2004 Sony Online Entertainment +// All Rights Reserved. +// +// ====================================================================== + +#ifndef INCLUDED_DebugMonitor_H +#define INCLUDED_DebugMonitor_H + +// ====================================================================== + +#include "sharedFoundation/Production.h" + +// ====================================================================== + +#if PRODUCTION == 0 + +class DebugMonitor +{ +public: + + static void install(); + static void remove(); + + static void setBehindWindow(HWND window); + + static void show(); + static void hide(); + + static void clearScreen(); + static void clearToCursor(); + + static void home(); + static void gotoXY(int x, int y); + static void print(const char *string); + + static void flushOutput(); +}; + +#endif + +// ====================================================================== + +#endif diff --git a/engine/shared/library/sharedDebug/src/win32/FirstSharedDebug.cpp b/engine/shared/library/sharedDebug/src/win32/FirstSharedDebug.cpp new file mode 100755 index 00000000..ee53a32e --- /dev/null +++ b/engine/shared/library/sharedDebug/src/win32/FirstSharedDebug.cpp @@ -0,0 +1,8 @@ +// ====================================================================== +// +// FirstDebug.cpp +// copyright (c) 2001 Sony Online Entertainment +// +// ====================================================================== + +#include "shareddebug/FirstSharedDebug.h" diff --git a/engine/shared/library/sharedDebug/src/win32/PerformanceTimer.cpp b/engine/shared/library/sharedDebug/src/win32/PerformanceTimer.cpp new file mode 100755 index 00000000..be770b7f --- /dev/null +++ b/engine/shared/library/sharedDebug/src/win32/PerformanceTimer.cpp @@ -0,0 +1,105 @@ +// +// PerformanceTimer.cpp +// Copyright 2000-2004 Sony Online Entertainment +// + +//------------------------------------------------------------------- + +#include "shareddebug/FirstSharedDebug.h" +#include "shareddebug/PerformanceTimer.h" + +//------------------------------------------------------------------- + +#include + +//------------------------------------------------------------------- + +__int64 PerformanceTimer::ms_frequency; + +//------------------------------------------------------------------- + +void PerformanceTimer::install() +{ + BOOL result = QueryPerformanceFrequency(reinterpret_cast(&ms_frequency)); + FATAL(!result, ("PerformanceTimer::install QPF failed")); +} + +//------------------------------------------------------------------- + +PerformanceTimer::PerformanceTimer() : + m_startTime (0), + m_stopTime (0) +{ + DEBUG_FATAL (ms_frequency == 0.f, ("PerformanceTimer not installed")); +} + +//------------------------------------------------------------------- + +PerformanceTimer::~PerformanceTimer() +{ +} + +//------------------------------------------------------------------- + +void PerformanceTimer::start() +{ + //-- get the current time + BOOL result = QueryPerformanceCounter(reinterpret_cast(&m_startTime)); + DEBUG_FATAL(!result, ("PerformanceTimer::start QPC failed")); + UNREF (result); +} + +//------------------------------------------------------------------- + +void PerformanceTimer::resume() +{ + __int64 delta = m_stopTime - m_startTime; + start(); + m_startTime -= delta; +} + +//------------------------------------------------------------------- + +void PerformanceTimer::stop () +{ + //-- get the current time + BOOL result = QueryPerformanceCounter(reinterpret_cast(&m_stopTime)); + DEBUG_FATAL(!result, ("PerformanceTimer::stop QPC failed")); + UNREF (result); +} + +//------------------------------------------------------------------- + +float PerformanceTimer::getElapsedTime() const +{ + return static_cast (m_stopTime - m_startTime) / static_cast (ms_frequency); +} + +// ---------------------------------------------------------------------- + +float PerformanceTimer::getSplitTime() const +{ + __int64 currentTime; + BOOL result = QueryPerformanceCounter(reinterpret_cast(¤tTime)); + UNREF(result); + DEBUG_FATAL(!result, ("PerformanceTimer::getSplitTime QPC failed")); + + return static_cast (currentTime - m_startTime) / static_cast (ms_frequency); +} + +//------------------------------------------------------------------- + +void PerformanceTimer::logElapsedTime(const char* string) const +{ + UNREF (string); + +#ifdef _DEBUG + static char buffer [1000]; + sprintf (buffer, "%s : %1.5f seconds\n", string ? string : "null", getElapsedTime()); + DEBUG_REPORT_LOG_PRINT (true, ("%s", buffer)); + DEBUG_OUTPUT_CHANNEL("Foundation\\PerformanceTimer", ("%s", buffer)); +#endif +} + +//------------------------------------------------------------------- + diff --git a/engine/shared/library/sharedDebug/src/win32/PerformanceTimer.h b/engine/shared/library/sharedDebug/src/win32/PerformanceTimer.h new file mode 100755 index 00000000..0fda7c1a --- /dev/null +++ b/engine/shared/library/sharedDebug/src/win32/PerformanceTimer.h @@ -0,0 +1,49 @@ +// +// PerformanceTimer.h +// Copyright 2000-2004 Sony Online Entertainment +// + +//------------------------------------------------------------------- + +#ifndef INCLUDED_PerformanceTimer_H +#define INCLUDED_PerformanceTimer_H + +//------------------------------------------------------------------- + +class PerformanceTimer +{ +public: + + static void install(); + +public: + + DLLEXPORT PerformanceTimer(); + DLLEXPORT ~PerformanceTimer(); + + void DLLEXPORT start(); + void DLLEXPORT resume(); + void DLLEXPORT stop(); + + float DLLEXPORT getElapsedTime() const; + float getSplitTime() const; // Get the time since the timer was started without stopping the timer. + void logElapsedTime(const char* string) const; + +private: + + PerformanceTimer(PerformanceTimer const &); + PerformanceTimer & operator=(PerformanceTimer const &); + +private: + + static __int64 ms_frequency; + +private: + + __int64 m_startTime; + __int64 m_stopTime; +}; + +//------------------------------------------------------------------- + +#endif \ No newline at end of file diff --git a/engine/shared/library/sharedDebug/src/win32/ProfilerTimer.cpp b/engine/shared/library/sharedDebug/src/win32/ProfilerTimer.cpp new file mode 100755 index 00000000..774765a6 --- /dev/null +++ b/engine/shared/library/sharedDebug/src/win32/ProfilerTimer.cpp @@ -0,0 +1,90 @@ +// ====================================================================== +// +// ProfilerTimer.cpp +// copyright (c) 2001 Sony Online Entertainment +// +// ====================================================================== + +#include "shareddebug/FirstSharedDebug.h" +#include "shareddebug/ProfilerTimer.h" + +#include "shareddebug/DebugFlags.h" +#include "sharedFoundation/WindowsWrapper.h" + +// ====================================================================== + +namespace ProfilerTimerNamespace +{ + ProfilerTimer::Type ms_qpcFrequency; + float ms_floatQpcFrequency; + __int64 ms_rdtsc; + __int64 ms_qpc; + bool ms_useRdtsc; + +} +using namespace ProfilerTimerNamespace; + +// ====================================================================== + +static __int64 __declspec(naked) __stdcall readTimeStampCounter() +{ + __asm + { + rdtsc; + ret; + } +} + +// ====================================================================== + +void ProfilerTimer::install() +{ + IGNORE_RETURN(QueryPerformanceCounter(reinterpret_cast(&ms_qpc))); + ms_rdtsc = readTimeStampCounter(); + + IGNORE_RETURN(QueryPerformanceFrequency(reinterpret_cast(&ms_qpcFrequency))); + ms_floatQpcFrequency = static_cast(ms_qpcFrequency); + + DebugFlags::registerFlag(ms_useRdtsc, "SharedDebug/Profiler", "useRdtsc"); +} + +// ---------------------------------------------------------------------- + +void ProfilerTimer::getTime(Type &time) +{ + if (ms_useRdtsc) + time = readTimeStampCounter(); + else + IGNORE_RETURN(QueryPerformanceCounter(reinterpret_cast(&time))); +} + +// ---------------------------------------------------------------------- + +void ProfilerTimer::getCalibratedTime(Type &time, Type &frequency) +{ + if (ms_useRdtsc) + { + __int64 qpc; + IGNORE_RETURN(QueryPerformanceCounter(reinterpret_cast(&qpc))); + __int64 rdtsc = readTimeStampCounter(); + + float const t = static_cast(qpc - ms_qpc) / ms_floatQpcFrequency; + frequency = static_cast<__int64>(static_cast(rdtsc - ms_rdtsc) / t); + + time = rdtsc; + ms_qpc = qpc; + ms_rdtsc = time; + } + else + { + IGNORE_RETURN(QueryPerformanceCounter(reinterpret_cast(&time))); + frequency = ms_qpcFrequency; + } +} + +void ProfilerTimer::getFrequency(Type &frequency) +{ + frequency = ms_qpcFrequency; +} + +// ====================================================================== diff --git a/engine/shared/library/sharedDebug/src/win32/ProfilerTimer.h b/engine/shared/library/sharedDebug/src/win32/ProfilerTimer.h new file mode 100755 index 00000000..fe1b8f9a --- /dev/null +++ b/engine/shared/library/sharedDebug/src/win32/ProfilerTimer.h @@ -0,0 +1,29 @@ +// ====================================================================== +// +// ProfilerTimer.h +// copyright (c) 2001 Sony Online Entertainment +// +// ====================================================================== + +#ifndef INCLUDED_ProfilerTimer_H +#define INCLUDED_ProfilerTimer_H + +// ====================================================================== + +class ProfilerTimer +{ +public: + + typedef __int64 Type; + +public: + + static void install(); + static void getTime(Type &time); + static void getCalibratedTime(Type &time, Type &frequency); + static void getFrequency(Type &frequency); +}; + +// ====================================================================== + +#endif diff --git a/engine/shared/library/sharedDebug/src/win32/VTune.cpp b/engine/shared/library/sharedDebug/src/win32/VTune.cpp new file mode 100755 index 00000000..6b876fff --- /dev/null +++ b/engine/shared/library/sharedDebug/src/win32/VTune.cpp @@ -0,0 +1,142 @@ +// ====================================================================== +// +// VTune.cpp +// Copyright 2000-01, Sony Online Entertainment Inc. +// All Rights Reserved. +// +// ====================================================================== + +#include "sharedDebug/FirstSharedDebug.h" +#include "sharedDebug/VTune.h" + +#if PRODUCTION == 0 + +#include "sharedDebug/DebugFlags.h" + +#include + +// ====================================================================== + +HMODULE VTune::ms_module; +VTune::PauseFunction VTune::ms_pauseFunction; +VTune::ResumeFunction VTune::ms_resumeFunction; +VTune::State VTune::ms_state; +bool VTune::ms_resumeNextFrame; +bool VTune::ms_pauseNextFrame; +bool VTune::ms_debugReport; + +// ====================================================================== + +void VTune::install() +{ + DEBUG_FATAL(ms_module, ("vtune already installed")); + + ms_module = LoadLibrary("VTuneAPI"); + if (!ms_module) + return; + + ms_pauseFunction = reinterpret_cast(GetProcAddress(ms_module, "VTPause")); + ms_resumeFunction = reinterpret_cast(GetProcAddress(ms_module, "VTResume")); + ms_state = S_default; + +#if PRODUCTION == 0 + DebugFlags::registerFlag(ms_debugReport, "SharedDebug", "vtuneState", debugReport); +#endif +} + +// ---------------------------------------------------------------------- + +void VTune::remove() +{ + if (ms_module) + { + FreeLibrary(ms_module); + ms_pauseFunction = 0; + ms_resumeFunction = 0; + } +} + +// ---------------------------------------------------------------------- + +void VTune::debugReport() +{ + switch (ms_state) + { + case S_default: + REPORT_PRINT(true, ("Vtune state unknown\n")); + break; + + case S_sampling: + REPORT_PRINT(true, ("Vtune is sampling\n")); + break; + + case S_paused: + REPORT_PRINT(true, ("Vtune is NOT sampling\n")); + break; + + default: + DEBUG_FATAL(true, ("bad case")); + + } +} + +// ---------------------------------------------------------------------- + +void VTune::resume() +{ + if (ms_module && ms_resumeFunction) + { + MessageBeep(MB_OK); + (*ms_resumeFunction)(); + ms_state = S_sampling; + } +} + +// ---------------------------------------------------------------------- + +void VTune::pause() +{ + if (ms_module && ms_pauseFunction) + { + (*ms_pauseFunction)(); + MessageBeep(MB_ICONEXCLAMATION); + ms_state = S_paused; + } +} + +// ---------------------------------------------------------------------- + +void VTune::pauseNextFrame() +{ + ms_pauseNextFrame = true; + ms_resumeNextFrame = false; +} + +// ---------------------------------------------------------------------- + +void VTune::resumeNextFrame() +{ + ms_pauseNextFrame = false; + ms_resumeNextFrame = true; +} + +// ---------------------------------------------------------------------- + +void VTune::beginFrame() +{ + if (ms_pauseNextFrame) + { + pause(); + ms_pauseNextFrame = false; + } + + if (ms_resumeNextFrame) + { + resume(); + ms_resumeNextFrame = false; + } +} + +// ====================================================================== + +#endif // PRODUCTION == 0 diff --git a/engine/shared/library/sharedDebug/src/win32/VTune.h b/engine/shared/library/sharedDebug/src/win32/VTune.h new file mode 100755 index 00000000..31125646 --- /dev/null +++ b/engine/shared/library/sharedDebug/src/win32/VTune.h @@ -0,0 +1,65 @@ +// ====================================================================== +// +// VTune.h +// Copyright 2000-01, Sony Online Entertainment Inc. +// All Rights Reserved. +// +// ====================================================================== + +#ifndef INCLUDED_VTune_H +#define INCLUDED_VTune_H + +// ====================================================================== + +#include "sharedFoundation/Production.h" + +// ====================================================================== + +#if PRODUCTION == 0 + +class VTune +{ +public: + + static void install(); + + static void resume(); + static void pause(); + + static void resumeNextFrame(); + static void pauseNextFrame(); + static void beginFrame(); + +private: + + static void remove(); + static void debugReport(); + +private: + + enum State + { + S_default, + S_sampling, + S_paused + }; + + typedef void (__cdecl *PauseFunction)(void); + typedef void (__cdecl *ResumeFunction)(void); + +private: + + static HMODULE ms_module; + static PauseFunction ms_pauseFunction; + static ResumeFunction ms_resumeFunction; + static State ms_state; + static bool ms_resumeNextFrame; + static bool ms_pauseNextFrame; + static bool ms_debugReport; +}; + +#endif // PRODUCTION == 0 + +// ====================================================================== + +#endif diff --git a/engine/shared/library/sharedFile/src/win32/FirstSharedFile.cpp b/engine/shared/library/sharedFile/src/win32/FirstSharedFile.cpp new file mode 100755 index 00000000..038a7931 --- /dev/null +++ b/engine/shared/library/sharedFile/src/win32/FirstSharedFile.cpp @@ -0,0 +1,8 @@ +// ====================================================================== +// +// FirstFile.cpp +// copyright (c) 2001 Sony Online Entertainment +// +// ====================================================================== + +#include "sharedFile/FirstSharedFile.h" diff --git a/engine/shared/library/sharedFile/src/win32/OsFile.cpp b/engine/shared/library/sharedFile/src/win32/OsFile.cpp new file mode 100755 index 00000000..64acc1a7 --- /dev/null +++ b/engine/shared/library/sharedFile/src/win32/OsFile.cpp @@ -0,0 +1,195 @@ +// ====================================================================== +// +// OsFile.cpp +// Copyright 2002, Sony Online Entertainment Inc. +// All Rights Reserved. +// +// ====================================================================== + +#include "sharedFile/FirstSharedFile.h" +#include "sharedFile/OsFile.h" + +#ifdef _DEBUG +#include "sharedDebug/PerformanceTimer.h" +#endif + +namespace OsFileNamespace +{ + float ms_time; +} +using namespace OsFileNamespace; + +// ====================================================================== + +void OsFile::install() +{ + +} + +// ---------------------------------------------------------------------- + +float OsFile::getSpentTime() +{ + float const result = ms_time; + ms_time = 0.0f; + return result; +} + +// ---------------------------------------------------------------------- + +bool OsFile::exists(const char *fileName) +{ + NOT_NULL(fileName); + DWORD attributes = GetFileAttributes(fileName); + +#if _MSC_VER < 1300 + const DWORD INVALID_FILE_ATTRIBUTES = 0xffffffff; +#endif + return (attributes != INVALID_FILE_ATTRIBUTES && (attributes & FILE_ATTRIBUTE_DIRECTORY) == 0); +} + +// ---------------------------------------------------------------------- + +int OsFile::getFileSize(const char *fileName) +{ + NOT_NULL(fileName); + +#ifdef _DEBUG + PerformanceTimer t; + t.start(); +#endif + + HANDLE handle = CreateFile(fileName, 0, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (handle == INVALID_HANDLE_VALUE) + return -1; + + int const size = GetFileSize(handle, NULL); + CloseHandle(handle); + +#ifdef _DEBUG + t.stop(); + ms_time += t.getElapsedTime(); +#endif + return size; +} + +// ---------------------------------------------------------------------- + +OsFile *OsFile::open(const char *fileName, bool randomAccess) +{ +#ifdef _DEBUG + PerformanceTimer t; + t.start(); +#endif + + // attempt to open the file + HANDLE handle = CreateFile(fileName, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | (randomAccess ? FILE_FLAG_RANDOM_ACCESS : 0), NULL); + + // check to make sure the file opened sucessfully + if (handle == INVALID_HANDLE_VALUE) + return NULL; + +#ifdef _DEBUG + t.stop(); + ms_time += t.getElapsedTime(); +#endif + + return new OsFile(handle); +} + +// ---------------------------------------------------------------------- + +OsFile::OsFile(HANDLE handle) +: m_handle(handle), + m_offset(0) +{ +} + +// ---------------------------------------------------------------------- + +OsFile::~OsFile() +{ +#ifdef _DEBUG + PerformanceTimer t; + t.start(); +#endif + + CloseHandle(m_handle); + +#ifdef _DEBUG + t.stop(); + ms_time+= t.getElapsedTime(); +#endif +} + +// ---------------------------------------------------------------------- + +int OsFile::length() const +{ + return GetFileSize(m_handle, NULL); +} + +// ---------------------------------------------------------------------- + +void OsFile::seek(int newFilePosition) +{ +#ifdef _DEBUG + PerformanceTimer t; + t.start(); +#endif + + if (m_offset != newFilePosition) + { + const DWORD result = SetFilePointer(m_handle, newFilePosition, NULL, FILE_BEGIN); + DEBUG_FATAL(static_cast(result) != newFilePosition, ("SetFilePointer failed")); + UNREF(result); + m_offset = newFilePosition; + } + +#ifdef _DEBUG + t.stop(); + ms_time += t.getElapsedTime(); +#endif +} + +// ---------------------------------------------------------------------- + +int OsFile::read(void *destinationBuffer, int numberOfBytes) +{ +#ifdef _DEBUG + PerformanceTimer t; + t.start(); +#endif + + DWORD amountReadDword; + BOOL result = ReadFile(m_handle, destinationBuffer, static_cast(numberOfBytes), &amountReadDword, NULL); + +// miles crasher hack +#if 0 + FATAL(!result, ("FileStreamerThread::processRead ReadFile failed to read '%d' bytes with error '%d'", static_cast(numberOfBytes), GetLastError())); +#else + if(!result) + { + if(GetLastError() == 998) // access violation - buffer coming from miles hosed + { + WARNING(true,("FileStreamerThread::processRead ReadFile failed to read '%d' bytes with error '%d'", static_cast(numberOfBytes), GetLastError())); + return 0; + } + else + { + FATAL(true, ("FileStreamerThread::processRead ReadFile failed to read '%d' bytes with error '%d'", static_cast(numberOfBytes), GetLastError())); + } + } +#endif +// end miles crasher hack + +#ifdef _DEBUG + t.stop(); + ms_time += t.getElapsedTime(); +#endif + + m_offset += static_cast(amountReadDword); + return static_cast(amountReadDword); +} + +// ====================================================================== diff --git a/engine/shared/library/sharedFile/src/win32/OsFile.h b/engine/shared/library/sharedFile/src/win32/OsFile.h new file mode 100755 index 00000000..1f3e6ba9 --- /dev/null +++ b/engine/shared/library/sharedFile/src/win32/OsFile.h @@ -0,0 +1,48 @@ +// ====================================================================== +// +// OsFile.h +// Copyright 2002, Sony Online Entertainment Inc. +// All Rights Reserved. +// +// ====================================================================== + +#ifndef INCLUDED_OsFile_H +#define INCLUDED_OsFile_H + +// ====================================================================== + +class OsFile +{ +public: + + static void install(); + + static float getSpentTime(); + + static bool exists(const char *fileName); + static int getFileSize(const char *fileName); + static OsFile *open(const char *fileName, bool randomAccess=false); + +public: + + ~OsFile(); + + int length() const; + int tell() const; + void seek(int newFilePosition); + int read(void *destinationBuffer, int numberOfBytes); + +private: + + OsFile(HANDLE handle); + OsFile(const char *fileName); + +private: + + HANDLE m_handle; + int m_offset; +}; + +// ====================================================================== + +#endif diff --git a/engine/shared/library/sharedFoundation/src/win32/ByteOrder.cpp b/engine/shared/library/sharedFoundation/src/win32/ByteOrder.cpp new file mode 100755 index 00000000..12add8e5 --- /dev/null +++ b/engine/shared/library/sharedFoundation/src/win32/ByteOrder.cpp @@ -0,0 +1,58 @@ +// ====================================================================== +// +// ByteOrder.cpp +// copyright (c) 2001 Sony Online Entertainment +// +// ====================================================================== + +#include "sharedFoundation/FirstSharedFoundation.h" +#include "sharedFoundation/ByteOrder.h" + +// ====================================================================== + +// I'm using the arguments, but the compiler can't tell that +#pragma warning(disable: 4100) + +__declspec(naked) ulong ntohl(ulong netLong) +{ + _asm + { + mov eax, [esp+4] + bswap eax + ret + } +} //lint !e533 !e715 // function should return a value, argument not referenced + +__declspec(naked) ulong htonl(ulong hostLong) +{ + _asm + { + mov eax, [esp+4] + bswap eax + ret + } +} //lint !e533 !e715 // function should return a value, argument not referenced + +__declspec(naked) ushort ntohs(ushort netShort) +{ + _asm + { + mov eax, [esp+4] + bswap eax + shr eax, 16 + ret + } +} //lint !e533 !e715 // function should return a value, argument not referenced + +__declspec(naked) ushort htons(ushort hostShort) +{ + _asm + { + mov eax, [esp+4] + bswap eax + shr eax, 16 + ret + } +} //lint !e533 !e715 // function should return a value, argument not referenced + +// ====================================================================== diff --git a/engine/shared/library/sharedFoundation/src/win32/ByteOrder.h b/engine/shared/library/sharedFoundation/src/win32/ByteOrder.h new file mode 100755 index 00000000..4e478703 --- /dev/null +++ b/engine/shared/library/sharedFoundation/src/win32/ByteOrder.h @@ -0,0 +1,22 @@ +// ====================================================================== +// +// ByteOrder.h +// copyright 1998 Bootprint Entertainment +// copyright 2001 Sony Online Entertainment +// +// ====================================================================== + +#ifndef BYTE_ORDER_H +#define BYTE_ORDER_H + +// ====================================================================== + +ulong __cdecl ntohl(ulong netLong); +ushort __cdecl ntohs(ushort netShort); + +ulong __cdecl htonl(ulong hostLong); +ushort __cdecl htons(ushort hostShort); + +// ====================================================================== + +#endif diff --git a/engine/shared/library/sharedFoundation/src/win32/ConfigSharedFoundation.cpp b/engine/shared/library/sharedFoundation/src/win32/ConfigSharedFoundation.cpp new file mode 100755 index 00000000..9498c256 --- /dev/null +++ b/engine/shared/library/sharedFoundation/src/win32/ConfigSharedFoundation.cpp @@ -0,0 +1,324 @@ +// ====================================================================== +// +// ConfigSharedFoundation.cpp +// copyright 1998 Bootprint Entertainment +// copyright 2001 Sony Online Entertainment +// +// ====================================================================== + +#include "sharedFoundation/FirstSharedFoundation.h" +#include "sharedFoundation/ConfigSharedFoundation.h" + +#include "sharedFoundation/ConfigFile.h" +#include "sharedFoundation/Production.h" + +// ====================================================================== + +#define KEY_INT(a,b) (ms_ ## a = ConfigFile::getKeyInt("SharedFoundation", #a, b)) +#define KEY_BOOL(a,b) (ms_ ## a = ConfigFile::getKeyBool("SharedFoundation", #a, b)) +#define KEY_FLOAT(a,b) (ms_ ## a = ConfigFile::getKeyFloat("SharedFoundation", #a, b)) +#define KEY_STRING(a,b) (ms_ ## a = ConfigFile::getKeyString("SharedFoundation", #a, b)) + +// ====================================================================== + +const int c_defaultFatalCallStackDepth = 32; +const int c_defaultWarningCallStackDepth = PRODUCTION ? -1 : 8; + +// ====================================================================== + +namespace ConfigSharedFoundationNamespace +{ + bool ms_noExceptionHandling; + + bool ms_fpuExceptionPrecision; + bool ms_fpuExceptionUnderflow; + bool ms_fpuExceptionOverflow; + bool ms_fpuExceptionZeroDivide; + bool ms_fpuExceptionDenormal; + bool ms_fpuExceptionInvalid; + + bool ms_demoMode; + + real ms_frameRateLimit; + real ms_minFrameRate; + + bool ms_useRemoteDebug; + int ms_defaultRemoteDebugPort; + + bool ms_profilerExpandAllBranches; + + bool ms_memoryManagerReportAllocations; + bool ms_memoryManagerReportOnOutOfMemory; + + bool ms_useMemoryBlockManager; + bool ms_memoryBlockManagerDebugDumpOnRemove; + + int ms_fatalCallStackDepth; + int ms_warningCallStackDepth; + bool ms_lookUpCallStackNames; + + int ms_processPriority; + + bool ms_verboseHardwareLogging; + bool ms_verboseWarnings; + + bool ms_causeAccessViolation; + + float ms_debugReportLongFrameTime; +} + +using namespace ConfigSharedFoundationNamespace; + +// ====================================================================== +// Determine the Platform-specific configuration information +// +// Remarks: +// +// This routine inspects the ConfigFile class to set some variables for rapid access +// by the rest of the engine. + +void ConfigSharedFoundation::install (const Defaults &defaults) +{ + KEY_BOOL(noExceptionHandling, false); + + KEY_BOOL(fpuExceptionPrecision, false); + KEY_BOOL(fpuExceptionUnderflow, false); + KEY_BOOL(fpuExceptionOverflow, false); + KEY_BOOL(fpuExceptionZeroDivide, false); + KEY_BOOL(fpuExceptionDenormal, false); + KEY_BOOL(fpuExceptionInvalid, false); + + KEY_BOOL(demoMode, defaults.demoMode); + +#if defined (WIN32) && PRODUCTION == 1 + // In production builds, force our frame rate limit to be the application defined limit + ms_frameRateLimit = defaults.frameRateLimit; +#else + KEY_FLOAT(frameRateLimit, defaults.frameRateLimit); +#endif + + KEY_FLOAT(minFrameRate, 1.0f); + + KEY_BOOL(useRemoteDebug, false); + KEY_INT(defaultRemoteDebugPort, 4445); + + KEY_BOOL(profilerExpandAllBranches, false); + KEY_BOOL(memoryManagerReportAllocations, true); + KEY_BOOL(memoryManagerReportOnOutOfMemory, true); + KEY_BOOL(useMemoryBlockManager, true); + KEY_BOOL(memoryBlockManagerDebugDumpOnRemove, false); + + KEY_INT(fatalCallStackDepth, c_defaultFatalCallStackDepth); + KEY_INT(warningCallStackDepth, PRODUCTION ? -1 : c_defaultWarningCallStackDepth); + KEY_BOOL(lookUpCallStackNames, true); + + KEY_INT(processPriority, 0); + + KEY_BOOL(verboseHardwareLogging, false); + KEY_BOOL(verboseWarnings, defaults.verboseWarnings); + + KEY_BOOL(causeAccessViolation, false); + + KEY_FLOAT(debugReportLongFrameTime, 0.25f); +} + +// ---------------------------------------------------------------------- +/** + * Return whether to run with exception handling enabled. + * + * @return True to run without exception handling + */ + +bool ConfigSharedFoundation::getNoExceptionHandling() +{ + return ms_noExceptionHandling; +} + +// ---------------------------------------------------------------------- + +bool ConfigSharedFoundation::getFpuExceptionPrecision() +{ + return ms_fpuExceptionPrecision; +} + +// ---------------------------------------------------------------------- + +bool ConfigSharedFoundation::getFpuExceptionUnderflow() +{ + return ms_fpuExceptionUnderflow; +} + +// ---------------------------------------------------------------------- + +bool ConfigSharedFoundation::getFpuExceptionOverflow() +{ + return ms_fpuExceptionOverflow; +} + +// ---------------------------------------------------------------------- + +bool ConfigSharedFoundation::getFpuExceptionZeroDivide() +{ + return ms_fpuExceptionZeroDivide; +} + +// ---------------------------------------------------------------------- + +bool ConfigSharedFoundation::getFpuExceptionDenormal() +{ + return ms_fpuExceptionDenormal; +} + +// ---------------------------------------------------------------------- + +bool ConfigSharedFoundation::getFpuExceptionInvalid() +{ + return ms_fpuExceptionInvalid; +} + +// ---------------------------------------------------------------------- + +bool ConfigSharedFoundation::getDemoMode() +{ + return ms_demoMode; +} + +// ---------------------------------------------------------------------- +/** + * Return the frame rate limit value for the game. + * + * @return The initial frame rate limiter value + */ + +real ConfigSharedFoundation::getFrameRateLimit() +{ + return ms_frameRateLimit; +} + +// ---------------------------------------------------------------------- +/** + * Return the minimum frame rate value for the game. Frames that take longer + * will log a warning and be hard set to the given value. + * + * @return The initial min frame rate value + */ + +real ConfigSharedFoundation::getMinFrameRate() +{ + return ms_minFrameRate; +} + +// ---------------------------------------------------------------------- + +int ConfigSharedFoundation::getDefaultRemoteDebugPort() +{ + return ms_defaultRemoteDebugPort; +} + +// ---------------------------------------------------------------------- + +bool ConfigSharedFoundation::getUseRemoteDebug() +{ + return ms_useRemoteDebug; +} + +// ---------------------------------------------------------------------- + +bool ConfigSharedFoundation::getProfilerExpandAllBranches() +{ + return ms_profilerExpandAllBranches; +} + +// ---------------------------------------------------------------------- + +bool ConfigSharedFoundation::getMemoryManagerReportAllocations() +{ + return ms_memoryManagerReportAllocations; +} + +// ---------------------------------------------------------------------- + +bool ConfigSharedFoundation::getMemoryManagerReportOnOutOfMemory() +{ + return ms_memoryManagerReportOnOutOfMemory; +} + +// ---------------------------------------------------------------------- + +bool ConfigSharedFoundation::getUseMemoryBlockManager() +{ + return ms_useMemoryBlockManager; +} + +// ---------------------------------------------------------------------- + +bool ConfigSharedFoundation::getMemoryBlockManagerDebugDumpOnRemove () +{ + return ms_memoryBlockManagerDebugDumpOnRemove; +} + +// ---------------------------------------------------------------------- + +int ConfigSharedFoundation::getFatalCallStackDepth() +{ + return ms_fatalCallStackDepth; +} + +// ---------------------------------------------------------------------- + +int ConfigSharedFoundation::getWarningCallStackDepth() +{ + return ms_warningCallStackDepth; +} + +// ---------------------------------------------------------------------- + +bool ConfigSharedFoundation::getLookUpCallStackNames() +{ + return ms_lookUpCallStackNames; +} + +// ---------------------------------------------------------------------- + +int ConfigSharedFoundation::getProcessPriority() +{ + return ms_processPriority; +} + +// ---------------------------------------------------------------------- + +bool ConfigSharedFoundation::getVerboseHardwareLogging() +{ + return ms_verboseHardwareLogging; +} + +// ---------------------------------------------------------------------- + +bool ConfigSharedFoundation::getVerboseWarnings() +{ + return ms_verboseWarnings; +} + +// ---------------------------------------------------------------------- + +void ConfigSharedFoundation::setVerboseWarnings(bool const verboseWarnings) +{ + ms_verboseWarnings = verboseWarnings; +} + +// ---------------------------------------------------------------------- + +bool ConfigSharedFoundation::getCauseAccessViolation() +{ + return ms_causeAccessViolation; +} + + +// ---------------------------------------------------------------------- + +float ConfigSharedFoundation::getDebugReportLongFrameTime() +{ + return ms_debugReportLongFrameTime; +} + +// ====================================================================== diff --git a/engine/shared/library/sharedFoundation/src/win32/ConfigSharedFoundation.h b/engine/shared/library/sharedFoundation/src/win32/ConfigSharedFoundation.h new file mode 100755 index 00000000..6efa3840 --- /dev/null +++ b/engine/shared/library/sharedFoundation/src/win32/ConfigSharedFoundation.h @@ -0,0 +1,74 @@ +// ====================================================================== +// +// ConfigSharedFoundation.h +// copyright 1998 Bootprint Entertainment +// copyright 2001 Sony Online Entertainment +// +// ====================================================================== + +#ifndef INCLUDED_ConfigSharedFoundation_H +#define INCLUDED_ConfigSharedFoundation_H + +// ====================================================================== + +class ConfigSharedFoundation +{ +public: + + struct Defaults + { + int screenHeight; + int screenWidth; + bool windowed; + real frameRateLimit; + bool demoMode; + bool verboseWarnings; + }; + +public: + + static void install(const Defaults &defaults); + + static bool getNoExceptionHandling(); + + static bool getFpuExceptionPrecision(); + static bool getFpuExceptionUnderflow(); + static bool getFpuExceptionOverflow(); + static bool getFpuExceptionZeroDivide(); + static bool getFpuExceptionDenormal(); + static bool getFpuExceptionInvalid(); + + static bool getDemoMode(); + + static real getFrameRateLimit(); + static real getMinFrameRate(); + + static bool getUseRemoteDebug(); + static int getDefaultRemoteDebugPort(); + + static bool getProfilerExpandAllBranches(); + + static bool getMemoryManagerReportAllocations(); + static bool getMemoryManagerReportOnOutOfMemory(); + + static bool getUseMemoryBlockManager(); + static bool getMemoryBlockManagerDebugDumpOnRemove(); + + static int getFatalCallStackDepth(); + static int getWarningCallStackDepth(); + static bool getLookUpCallStackNames(); + + static int getProcessPriority(); + + static DLLEXPORT bool getVerboseHardwareLogging(); + static bool getVerboseWarnings(); + static void setVerboseWarnings(bool verboseWarnings); + + static bool getCauseAccessViolation(); + + static float getDebugReportLongFrameTime(); +}; + +// ====================================================================== + +#endif diff --git a/engine/shared/library/sharedFoundation/src/win32/FirstPlatform.h b/engine/shared/library/sharedFoundation/src/win32/FirstPlatform.h new file mode 100755 index 00000000..5a4d021a --- /dev/null +++ b/engine/shared/library/sharedFoundation/src/win32/FirstPlatform.h @@ -0,0 +1,82 @@ +// ====================================================================== +// +// FirstPlatform.h +// copyright 1998 Bootprint Entertainment +// copyright 2001 Sony Online Entertainment +// +// ====================================================================== + +#ifndef INCLUDED_FirstPlatform_H +#define INCLUDED_FirstPlatform_H + + +#ifdef WIN32 +#include +#include +#endif + +// ====================================================================== + +// C4127 conditional expression is constant +// C4291 no matching operator delete found; memory will not be freed if initialization throws an exception +// C4503 decorated name length exceeded, name was truncated +// C4514 unreferenced inline function has been removed +// C4702 unreachable code +// C4710 inline function not expanded +// C4786 identifier was truncated to 'number' characters in the debug + +#pragma warning(disable: 4127 4291 4503 4514 4702 4710 4786) + +// ====================================================================== +// If we haven't defined this yet, then we're not compiling a DLL + +#ifndef COMPILE_DLL +#define COMPILE_DLL 0 +#endif + +#if COMPILE_DLL +#define DLLEXPORT __declspec(dllimport) +#else +#define DLLEXPORT __declspec(dllexport) +#endif + +// ====================================================================== + +template +inline int ComGetReferenceCount(T *t) +{ + t->AddRef(); + return t->Release(); +} + +// ====================================================================== +// forward declare some windows stuff to avoid having to include here + +struct HCURSOR__; +struct HICON__; +struct HINSTANCE__; +struct HWND__; + +typedef void *HANDLE; +typedef HICON__ *HCURSOR; +typedef HICON__ *HICON; +typedef HINSTANCE__ *HINSTANCE; +typedef HWND__ *HWND; + +// @todo codereorg still working on this +#include "sharedFoundation/WindowsWrapper.h" + +// ====================================================================== +// convienent fatal macros that check windows HRESULT codes + +#define FATAL_HR(a,b) FATAL(FAILED(b), (a, HRESULT_CODE(b))) +#define DEBUG_FATAL_HR(a,b) DEBUG_FATAL(FAILED(b), (a, HRESULT_CODE(b))) + +// ====================================================================== +// include anything we need to replace missing functionality that other platforms provide + +#include "sharedFoundation/PlatformGlue.h" + +// ====================================================================== + +#endif diff --git a/engine/shared/library/sharedFoundation/src/win32/FirstSharedFoundation.cpp b/engine/shared/library/sharedFoundation/src/win32/FirstSharedFoundation.cpp new file mode 100755 index 00000000..1cfb9020 --- /dev/null +++ b/engine/shared/library/sharedFoundation/src/win32/FirstSharedFoundation.cpp @@ -0,0 +1,8 @@ +// ====================================================================== +// +// FirstFoundation.cpp +// copyright (c) 2001 Sony Online Entertainment +// +// ====================================================================== + +#include "sharedFoundation/FirstSharedFoundation.h" diff --git a/engine/shared/library/sharedFoundation/src/win32/FloatingPointUnit.cpp b/engine/shared/library/sharedFoundation/src/win32/FloatingPointUnit.cpp new file mode 100755 index 00000000..f303e0eb --- /dev/null +++ b/engine/shared/library/sharedFoundation/src/win32/FloatingPointUnit.cpp @@ -0,0 +1,257 @@ +// ====================================================================== +// +// FloatingPointUnit.cpp +// copyright 1999 Bootprint Entertainment +// copyright 2001 Sony Online Entertainment +// +// ====================================================================== + +#include "sharedFoundation/FirstSharedFoundation.h" +#include "sharedFoundation/FloatingPointUnit.h" + +#include "sharedFoundation/ConfigSharedFoundation.h" + +// ====================================================================== + +int FloatingPointUnit::updateNumber; +ushort FloatingPointUnit::status; +FloatingPointUnit::Precision FloatingPointUnit::precision; +FloatingPointUnit::Rounding FloatingPointUnit::rounding; +bool FloatingPointUnit::exceptionEnabled[E_max]; + +// ====================================================================== + +const WORD PRECISION_MASK = BINARY4(0000,0011,0000,0000); +const WORD PRECISION_24 = BINARY4(0000,0000,0000,0000); +const WORD PRECISION_53 = BINARY4(0000,0010,0000,0000); +const WORD PRECISION_64 = BINARY4(0000,0011,0000,0000); + +const WORD ROUND_MASK = BINARY4(0000,1100,0000,0000); +const WORD ROUND_NEAREST = BINARY4(0000,0000,0000,0000); +const WORD ROUND_CHOP = BINARY4(0000,1100,0000,0000); +const WORD ROUND_DOWN = BINARY4(0000,0100,0000,0000); +const WORD ROUND_UP = BINARY4(0000,1000,0000,0000); + +const WORD EXCEPTION_PRECISION = BINARY4(0000,0000,0010,0000); +const WORD EXCEPTION_UNDERFLOW = BINARY4(0000,0000,0001,0000); +const WORD EXCEPTION_OVERFLOW = BINARY4(0000,0000,0000,1000); +const WORD EXCEPTION_ZERO_DIVIDE = BINARY4(0000,0000,0000,0100); +const WORD EXCEPTION_DENORMAL = BINARY4(0000,0000,0000,0010); +const WORD EXCEPTION_INVALID = BINARY4(0000,0000,0000,0001); +const WORD EXCEPTION_ALL = BINARY4(0000,0000,0011,1111); + +// ====================================================================== + +void FloatingPointUnit::install(void) +{ + precision = P_24; + rounding = R_roundToNearestOrEven; + memset(exceptionEnabled, 0, sizeof(exceptionEnabled)); + + // preserve all other bits + status = getControlWord(); + status &= ~(PRECISION_MASK | ROUND_MASK | EXCEPTION_ALL); + + // set to single precision, rounding, and all exceptions masked + status |= PRECISION_24 | ROUND_NEAREST | EXCEPTION_ALL; + + // check the config platform flags to see if we should enable some exceptions + if (ConfigSharedFoundation::getFpuExceptionPrecision()) + { + exceptionEnabled[E_precision] = true; + status &= ~EXCEPTION_PRECISION; + } + + if (ConfigSharedFoundation::getFpuExceptionUnderflow()) + { + exceptionEnabled[E_underflow] = true; + status &= ~EXCEPTION_UNDERFLOW; + } + + if (ConfigSharedFoundation::getFpuExceptionOverflow()) + { + exceptionEnabled[E_overflow] = true; + status &= ~EXCEPTION_OVERFLOW; + } + + if (ConfigSharedFoundation::getFpuExceptionZeroDivide()) + { + exceptionEnabled[E_zeroDivide] = true; + status &= ~EXCEPTION_ZERO_DIVIDE; + } + + if (ConfigSharedFoundation::getFpuExceptionDenormal()) + { + exceptionEnabled[E_denormal] = true; + status &= ~EXCEPTION_DENORMAL; + } + + if (ConfigSharedFoundation::getFpuExceptionInvalid()) + { + exceptionEnabled[E_invalid] = true; + status &= ~EXCEPTION_INVALID; + } + + setControlWord(status); +} + +// ---------------------------------------------------------------------- + +void FloatingPointUnit::update(void) +{ + WORD currentStatus = getControlWord(); + + if (currentStatus != status) + { +// DEBUG_REPORT_LOG_PRINT(true, ("FPU: update=%d, in mode=%04x, should be in mode=%04x\n", updateNumber, static_cast(currentStatus), static_cast(status))); + setControlWord(status); + } + + ++updateNumber; +} + +// ---------------------------------------------------------------------- + +WORD FloatingPointUnit::getControlWord(void) +{ + WORD controlWord = 0; + + __asm fnstcw controlWord; + return controlWord; +} + +// ---------------------------------------------------------------------- + +void FloatingPointUnit::setControlWord(WORD controlWord) +{ + UNREF(controlWord); + __asm fldcw controlWord; +} + +// ---------------------------------------------------------------------- + +void FloatingPointUnit::setPrecision(Precision newPrecision) +{ + WORD bits = 0; + + switch (precision) + { + case P_24: + bits = PRECISION_24; + break; + + case P_53: + bits = PRECISION_53; + break; + + case P_64: + bits = PRECISION_64; + break; + + case P_max: + default: + DEBUG_FATAL(true, ("bad case")); + } + + // record the current state + precision = newPrecision; + + // set the proper bit pattern + status &= ~PRECISION_MASK; + status |= bits; + + // slam it into the FPU + setControlWord(status); +} + +// ---------------------------------------------------------------------- + +void FloatingPointUnit::setRounding(Rounding newRounding) +{ + WORD bits = 0; + + switch (newRounding) + { + case R_roundToNearestOrEven: + bits = ROUND_NEAREST; + break; + + case R_chop: + bits = ROUND_CHOP; + break; + + case R_roundDown: + bits = ROUND_DOWN; + break; + + case R_roundUp: + bits = ROUND_UP; + break; + + case R_max: + default: + DEBUG_FATAL(true, ("bad case")); + } + + // record the current state + rounding = newRounding; + + // set the proper bit pattern + status &= ~ROUND_MASK; + status |= bits; + + // slam it into the FPU + setControlWord(status); +} + +// ---------------------------------------------------------------------- + +void FloatingPointUnit::setExceptionEnabled(Exception exception, bool enabled) +{ + WORD bits = 0; + + switch (exception) + { + case E_precision: + bits = EXCEPTION_PRECISION; + break; + + case E_underflow: + bits = EXCEPTION_UNDERFLOW; + break; + + case E_overflow: + bits = EXCEPTION_OVERFLOW; + break; + + case E_zeroDivide: + bits = EXCEPTION_ZERO_DIVIDE; + break; + + case E_denormal: + bits = EXCEPTION_DENORMAL; + break; + + case E_invalid: + bits = EXCEPTION_INVALID; + break; + + case E_max: + default: + DEBUG_FATAL(true, ("bad case")); + } + + // record the current state + exceptionEnabled[exception] = enabled; + + // twiddle the bit appropriately. these bits masks, so set the bit to disable the exception, clear the bit to enable it. + if (enabled) + status &= ~bits; + else + status |= bits; + + // slam it into the FPU + setControlWord(status); +} + +// ====================================================================== diff --git a/engine/shared/library/sharedFoundation/src/win32/FloatingPointUnit.h b/engine/shared/library/sharedFoundation/src/win32/FloatingPointUnit.h new file mode 100755 index 00000000..9cda070d --- /dev/null +++ b/engine/shared/library/sharedFoundation/src/win32/FloatingPointUnit.h @@ -0,0 +1,104 @@ +// ====================================================================== +// +// FloatingPointUnit.h +// jeff grills +// +// copyright 1999 Bootprint Entertainment +// +// ====================================================================== + +#ifndef FLOATING_POINT_UNIT_H +#define FLOATING_POINT_UNIT_H + +// ====================================================================== + +class FloatingPointUnit +{ +public: + + typedef unsigned short WORD; + + enum Precision + { + P_24, + P_53, + P_64, + + P_max + }; + + enum Rounding + { + R_roundToNearestOrEven, + R_chop, + R_roundDown, + R_roundUp, + + R_max + }; + + enum Exception + { + E_precision, + E_underflow, + E_overflow, + E_zeroDivide, + E_denormal, + E_invalid, + + E_max + }; + +private: + + static int updateNumber; + static WORD status; + static Precision precision; + static Rounding rounding; + static bool exceptionEnabled[E_max]; + +public: + + static WORD getControlWord(void); + static void setControlWord(WORD controlWord); + +public: + + static void install(void); + + static void update(void); + + static void setPrecision(Precision newPrecision); + static void setRounding(Rounding newRounding); + static void setExceptionEnabled(Exception exception, bool enabled); + + static Precision getPrecision(void); + static Rounding getRounding(void); + static bool getExceptionEnabled(Exception exception); +}; + +// ====================================================================== + +inline FloatingPointUnit::Precision FloatingPointUnit::getPrecision(void) +{ + return precision; +} + +// ---------------------------------------------------------------------- + +inline FloatingPointUnit::Rounding FloatingPointUnit::getRounding(void) +{ + return rounding; +} + +// ---------------------------------------------------------------------- + +inline bool FloatingPointUnit::getExceptionEnabled(Exception theException) +{ + DEBUG_FATAL(static_cast(theException) < 0 || static_cast(theException) >= static_cast(E_max), ("exception out of range")); //lint !e568 // non-negative quantity is never less than 0 + return exceptionEnabled[theException]; +} + +// ====================================================================== + +#endif diff --git a/engine/shared/library/sharedFoundation/src/win32/Os.cpp b/engine/shared/library/sharedFoundation/src/win32/Os.cpp new file mode 100755 index 00000000..9c828361 --- /dev/null +++ b/engine/shared/library/sharedFoundation/src/win32/Os.cpp @@ -0,0 +1,1633 @@ +// ====================================================================== +// +// Os.cpp +// +// Portions copyright 1998 Bootprint Entertainment +// Portions copyright 2000-2002 Sony Online Entertainment +// All Rights Reserved +// +// ====================================================================== + +#include "sharedFoundation/FirstSharedFoundation.h" +#include "sharedFoundation/Os.h" + +#include "sharedDebug/DebugFlags.h" +#include "sharedDebug/DebugKey.h" +#include "sharedDebug/DebugMonitor.h" +#include "sharedDebug/Profiler.h" +#include "sharedFoundation/Clock.h" +#include "sharedFoundation/ConfigFile.h" +#include "sharedFoundation/ConfigSharedFoundation.h" +#include "sharedFoundation/CrashReportInformation.h" +#include "sharedFoundation/ExitChain.h" +#include "sharedFoundation/FloatingPointUnit.h" +#include "sharedFoundation/Production.h" +#include "sharedFoundation/StringCompare.h" +#include "sharedFoundation/WindowsWrapper.h" +#include "shellapi.h" + +#include +#include +#include +#include + +// ====================================================================== + +namespace OsNamespace +{ + void applyWindowChanges(); + void updateMousePosition(int x, int y); + + const int PROGRAM_NAME_SIZE = 512; + + bool ms_installed; + bool ms_processMessagePump = true; + +#if PRODUCTION == 0 + bool ms_validateGuardPatterns; + bool ms_validateFreePatterns; + bool ms_allowPopupDebugMenu; +#endif + + int ms_numberOfUpdates; + HWND ms_window; + HCURSOR ms_cursorArrow; + bool ms_engineOwnsWindow; + bool ms_wasFocusLost; + bool ms_gameOver; + bool ms_shouldReturnFromAbort; + bool ms_wantPopupDebugMenu; + bool ms_threadDied; + bool ms_mouseMoveInClient; + bool ms_clickToMove; + char ms_programName[PROGRAM_NAME_SIZE]; + char *ms_shortProgramName; + char ms_programStartupDirectory[MAX_PATH]; + Os::ThreadId ms_mainThreadId; + Os::IsGdiVisibleHookFunction ms_isGdiVisibleHookFunction; + Os::LostFocusHookFunction ms_lostFocusHookFunction; + Os::AcquiredFocusHookFunction ms_acquiredFocusHookFunction; + Os::AcquiredFocusHookFunction ms_acquiredFocusHookFunction2; + Os::QueueCharacterHookFunction ms_queueCharacterHookFunction; + Os::SetSystemMouseCursorPositionHookFunction ms_setSystemMouseCursorPositionHookFunction; + Os::SetSystemMouseCursorPositionHookFunction ms_setSystemMouseCursorPositionHookFunction2; + Os::GetHardwareMouseCursorEnabled ms_getHardwareMouseCursorEnabled; + Os::GetOtherAdapterRectsHookFunction ms_getOtherAdapterRectsHookFunction; + Os::WindowPositionChangedHookFunction ms_windowPositionChangedHookFunction; + Os::DisplayModeChangedHookFunction ms_displayModeChangedHookFunction; + Os::InputLanguageChangedHookFunction ms_inputLanguageChangedHookFunction; + Os::IMEHookFunction ms_IMEHookFunction; + Os::QueueKeyDownHookFunction ms_queueKeyDownHookFunction; + + int ms_processorCount; + int ms_debugKeyIndex; + int ms_SystemMouseCursorPositionX; + int ms_SystemMouseCursorPositionY; + + std::vector ms_otherAdapterRects; + + char ms_keyboardLayout[KL_NAMELENGTH]; + + bool ms_focused; + + int const ms_hotKeyId = 0xBEEF; + + extern "C" WINBASEAPI BOOL WINAPI IsDebuggerPresent(VOID); +}; + +using namespace OsNamespace; + + +static LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); + +// ====================================================================== +/** + * Install the Os subsystem for games + * + * This routine is supported for all platforms, although different platforms may + * require different arguments to this routine. + * + * This routine registers the window class and creates the window for the application. + * + * This routine will add Os::remove to the ExitChain. + * + * @param instance Handle to the instance for this application + * @param windowName Name for the window title bar + * @paran normalIcon Normal icon for the game + * @param smallIcon Small icon for the task bar + * @see Os::remove() + */ + +void Os::install(HINSTANCE instance, const char *windowName, HICON normalIcon, HICON smallIcon) +{ + installCommon(); + + // setup the window class + WNDCLASSEX wclass; + Zero(wclass); + wclass.cbSize = sizeof(wclass); + wclass.style = CS_BYTEALIGNCLIENT; + wclass.lpfnWndProc = WindowProc; + wclass.hInstance = instance; + wclass.hIcon = normalIcon; + wclass.hCursor = NULL; + wclass.hbrBackground = reinterpret_cast(GetStockObject(BLACK_BRUSH)); + wclass.lpszClassName = windowName; + wclass.hIconSm = smallIcon; + + // register the window class + ATOM atom = RegisterClassEx(&wclass); + FATAL(atom == 0, ("RegisterClassEx failed")); + + // create the window + ms_window = CreateWindow( + windowName, // pointer to registered class name + windowName, // pointer to window name + WS_POPUP, // window style + 0, // horizontal position of window + 0, // vertical position of window + 640, // window width + 480, // window height + NULL, // handle to parent or owner window + NULL, // handle to menu or child-window identifier + instance, // handle to application instance + NULL); // pointer to window-creation data + FATAL(!ms_window, ("CreateWindow failed")); + ms_engineOwnsWindow = true; + + // load the arrow cursor + ms_cursorArrow = LoadCursor(NULL, IDC_ARROW); + FATAL(ms_cursorArrow == NULL, ("LoadCursor failed")); +} + +// ---------------------------------------------------------------------- +/** + * Install the Os subsystem for non-games. + * + * This routine is supported for all platforms, although different platforms may + * require different arguments to this routine.F + * + * This routine will add Os::remove to the ExitChain. + * + * @see Os::remove() + */ + +void Os::install(HWND newWindow, bool newProcessMessagePump) +{ + installCommon(); + ms_window = newWindow; + ms_processMessagePump = newProcessMessagePump; +} + +// ---------------------------------------------------------------------- +/** + * Install the Os subsystem for non-games. + * + * This routine is supported for all platforms, although different platforms may + * require different arguments to this routine. + * + * This routine will add Os::remove to the ExitChain. + * + * @see Os::remove() + */ + +void Os::install() +{ + installCommon(); +} + +// ---------------------------------------------------------------------- +/** + * This routine will remove the Os subsystem. + * + * This routine should not be called directly. It will be called from the ExitChain. + * + * @see Os::install() + */ + +void Os::remove() +{ + DEBUG_FATAL(!ms_installed, ("not installed")); + ms_installed = false; +} + +// ---------------------------------------------------------------------- + +void Os::installCommon() +{ + DEBUG_FATAL(ms_installed, ("already installed")); + + ExitChain::add(Os::remove, "Os::remove", 0, true); + + // get startup folder. + GetCurrentDirectory(sizeof(ms_programStartupDirectory), ms_programStartupDirectory); + + ms_numberOfUpdates = 0; + ms_mainThreadId = GetCurrentThreadId(); + setThreadName(ms_mainThreadId, "Main"); + +#if PRODUCTION == 0 + ms_allowPopupDebugMenu = ConfigFile::getKeyBool("SharedFoundation", "allowPopupDebugMenu", false); +#endif + + // get the name of the executable + DWORD result = GetModuleFileName(NULL, ms_programName, sizeof(ms_programName)); + FATAL(result == 0, ("GetModuleFileName failed")); + + // get the file name without the path + ms_shortProgramName = strrchr(ms_programName, '\\'); + if (ms_shortProgramName) + ++ms_shortProgramName; + else + ms_shortProgramName = ms_programName; + + // switch into single-precision floating point mode + FloatingPointUnit::install(); + + // get the amount of memory + MEMORYSTATUS memoryStatus; + GlobalMemoryStatus(&memoryStatus); + CrashReportInformation::addStaticText("Ram: %dmb\n", memoryStatus.dwTotalPhys / (1024 * 1024)); + + // log the os information + { + OSVERSIONINFO versionInfo; + Zero(versionInfo); + versionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + GetVersionEx(&versionInfo); + CrashReportInformation::addStaticText("Os1: %d.%d.%d\n", versionInfo.dwMajorVersion, versionInfo.dwMinorVersion, versionInfo.dwBuildNumber); + + char const * os = "Unknown"; + if (versionInfo.dwMajorVersion == 4 && versionInfo.dwMinorVersion == 10) + os = "Windows 98"; + else + if (versionInfo.dwMajorVersion == 4 && versionInfo.dwMinorVersion == 90) + os = "Windows Me"; + else + if (versionInfo.dwMajorVersion == 5 && versionInfo.dwMinorVersion == 0) + os = "Windows 2000"; + else + if (versionInfo.dwMajorVersion == 5 && versionInfo.dwMinorVersion == 1) + os = "Windows XP"; + else + if (versionInfo.dwMajorVersion == 5 && versionInfo.dwMinorVersion == 2) + os = "Windows Server 2003"; + else + if (versionInfo.dwMajorVersion == 6 && versionInfo.dwMinorVersion == 0) + os = "Windows Vista"; + + + + CrashReportInformation::addStaticText("Os2: %s %s\n", os, versionInfo.szCSDVersion); + } + + // get the number of processors + SYSTEM_INFO si; + GetSystemInfo(&si); + ms_processorCount = static_cast(si.dwNumberOfProcessors); + REPORT_LOG (ConfigSharedFoundation::getVerboseHardwareLogging(), ("Processor Count: %i\n", ms_processorCount)); + CrashReportInformation::addStaticText("NumProc: %d\n", ms_processorCount); + + { + HKEY key; + LONG result = RegOpenKeyEx (HKEY_LOCAL_MACHINE, "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0", 0, KEY_EXECUTE, &key); + + if (result == ERROR_SUCCESS) + { + DWORD data; + DWORD type = REG_DWORD; + DWORD size = sizeof (data); + result = RegQueryValueEx (key, "~MHz", NULL, &type, reinterpret_cast (&data), &size); + if ((result == ERROR_SUCCESS) && (size > 0)) + REPORT_LOG (ConfigSharedFoundation::getVerboseHardwareLogging(), ("Processor Speed: %i MHz\n", data)); + + RegCloseKey (key); + } + } + + if (!GetKeyboardLayoutName(ms_keyboardLayout)) + ms_keyboardLayout[0] = '\0'; + + ms_installed = true; + +#if PRODUCTION == 0 + DebugFlags::registerFlag(ms_validateGuardPatterns, "SharedFoundation", "validateGuardPatterns"); + DebugFlags::registerFlag(ms_validateFreePatterns, "SharedFoundation", "validateFreePatterns"); +#endif + + switch (ConfigSharedFoundation::getProcessPriority()) + { + case -1: + setProcessPriority(P_low); + break; + + case 0: + setProcessPriority(P_normal); + break; + + case 1: + setProcessPriority(P_high); + break; + + default: + DEBUG_WARNING(true, ("invalid process priority, %d should be betweein [-1..1]", ConfigSharedFoundation::getProcessPriority())); + break; + } +} + +// ====================================================================== +// Return the window handle +// +// Return value: +// +// Handle to the window for this application +// +// Remarks: +// +// This routine is only supported on the Win* platforms, and should not be used by the +// game or the engine if portability is required. + +HWND Os::getWindow() +{ + return ms_window; +} + +// ---------------------------------------------------------------------- + +bool Os::engineOwnsWindow() +{ + return ms_engineOwnsWindow; +} + +// ---------------------------------------------------------------------- +/** + * Return the full name of the running executable. + * + * The program name will include the path as well. + * + * @return The full name of the running executable + * @see Os::getShortProgramName() + */ + +const char *Os::getProgramName() +{ + return ms_programName; +} + +// ---------------------------------------------------------------------- +/** + * Return the short name of the running executable. + * + * The program name will not include the path, but will just be the file name. + * + * @return The short name of the running executable + * @see Os::getProgramName() + */ + +const char *Os::getShortProgramName() +{ + return ms_shortProgramName; +} + +// ---------------------------------------------------------------------- +/** + * Return the current working directory when the program was started. + * + */ + +const char *Os::getProgramStartupDirectory() +{ + return ms_programStartupDirectory; +} + +// ---------------------------------------------------------------------- +/** + * Cause Os::abort() to return instead of abort the process. + * + * This routine should not be called directly by users. + * + * This routine is provided so that structured exception handling can catch + * an exception, call Fatal to run the ExitChain, and rethrow the exception + * so that the debugger will catch it. + */ + +void Os::returnFromAbort() +{ + ms_shouldReturnFromAbort = true; +} + +// ---------------------------------------------------------------------- +/** + * Check if the Os knows the game needs to shut down. + * + * The Os can decide that the game need to end for a number of reasons, + * including closing the application or shutting the machine down. + * + * @return True if the game should quit, otherwise false + */ + +bool Os::isGameOver() +{ + return ms_gameOver; +} + +// ---------------------------------------------------------------------- +/** + * Return the number of updates that the have occurred. + * + * @return This value is updated during the Os::update() routine. + */ + +int Os::getNumberOfUpdates() +{ + return ms_numberOfUpdates; +} + +// ---------------------------------------------------------------------- +/** + * Indicate whether or not the application was paused. + * + * @return True if the application was in the background (paused), otherwise false + */ + +bool Os::wasFocusLost() +{ + return ms_wasFocusLost; +} + +// ---------------------------------------------------------------------- +/** + * Return a flag indicating whether we are running a multiprocessor machine or not. + * + * @return True if the machine has more than one processor, false if not. + */ + +bool Os::isMultiprocessor() +{ + return ms_processorCount > 1; +} + +// ---------------------------------------------------------------------- +/** + * Return the number of processors. + * + * @return The number of processors in the machine. + */ + +int Os::getProcessorCount() +{ + return ms_processorCount; +} + +// ---------------------------------------------------------------------- + +bool Os::isMainThread() +{ + // if the Os class hasn't been installed, then assume we are the main thread. + // otherwise, check to see if our thread id is the main thread id + return !ms_installed || (GetCurrentThreadId() == ms_mainThreadId); +} + +// ---------------------------------------------------------------------- +/** + * Terminate the application because of an error condition. + * + * This routine is supported for all platforms. + * + * This routine should not be called directly. The engine and game should use the + * FATAL macro to terminate the application because of an error. + * + * Calling Os::returnFromAbort() will cause the routine to do nothing but return + * immediately. + * + * @see Os::returnFromAbort(), FATAL() + */ + +void Os::abort() +{ + if (!isMainThread()) + { + ms_threadDied = true; + ExitThread(1); + } + + if (!ms_shouldReturnFromAbort) + { + // let the C runtime deal with the abnormal termination + ::abort(); + } +} + +// ---------------------------------------------------------------------- + +void Os::setLostFocusHookFunction(LostFocusHookFunction lostFocusHookFunction) +{ + ms_lostFocusHookFunction = lostFocusHookFunction; +} + +// ---------------------------------------------------------------------- + +void Os::setIsGdiVisibleHookFunction(IsGdiVisibleHookFunction isGdiVisibleHookFunction) +{ + ms_isGdiVisibleHookFunction = isGdiVisibleHookFunction; +} + +// ---------------------------------------------------------------------- + +void Os::setQueueCharacterHookFunction(QueueCharacterHookFunction queueCharacterHookFunction) +{ + ms_queueCharacterHookFunction = queueCharacterHookFunction; +} + +// ---------------------------------------------------------------------- + +void Os::setSetSystemMouseCursorPositionHookFunction(SetSystemMouseCursorPositionHookFunction setSystemMouseCursorPositionHookFunction) +{ + ms_setSystemMouseCursorPositionHookFunction = setSystemMouseCursorPositionHookFunction; +} + +// ---------------------------------------------------------------------- + +void Os::setSetSystemMouseCursorPositionHookFunction2(SetSystemMouseCursorPositionHookFunction setSystemMouseCursorPositionHookFunction) +{ + ms_setSystemMouseCursorPositionHookFunction2 = setSystemMouseCursorPositionHookFunction; +} + +// ---------------------------------------------------------------------- + +void Os::setAcquiredFocusHookFunction(AcquiredFocusHookFunction acquiredFocusHookFunction) +{ + ms_acquiredFocusHookFunction = acquiredFocusHookFunction; +} + +// ---------------------------------------------------------------------- + +void Os::setAcquiredFocusHookFunction2(AcquiredFocusHookFunction acquiredFocusHookFunction) +{ + ms_acquiredFocusHookFunction2 = acquiredFocusHookFunction; +} + +// ---------------------------------------------------------------------- + +void Os::setGetHardwareMouseCursorEnabled(GetHardwareMouseCursorEnabled getHardwareMouseCursorEnabled) +{ + ms_getHardwareMouseCursorEnabled = getHardwareMouseCursorEnabled; +} + +// ---------------------------------------------------------------------- + +void Os::setGetOtherAdapterRectsHookFunction(GetOtherAdapterRectsHookFunction getOtherAdapterRectsHookFunction) +{ + ms_getOtherAdapterRectsHookFunction = getOtherAdapterRectsHookFunction; +} + +// ---------------------------------------------------------------------- + +void Os::setWindowPositionChangedHookFunction(WindowPositionChangedHookFunction windowPositionChangedHookFunction) +{ + ms_windowPositionChangedHookFunction = windowPositionChangedHookFunction; +} + +//----------------------------------------------------------------- + +void Os::setDisplayModeChangedHookFunction(DisplayModeChangedHookFunction displayModeChangedHookFunction) +{ + ms_displayModeChangedHookFunction = displayModeChangedHookFunction; +} + +//----------------------------------------------------------------- + +void Os::setInputLanguageChangedHookFunction(InputLanguageChangedHookFunction inputLanguageChangedHookFunction) +{ + ms_inputLanguageChangedHookFunction = inputLanguageChangedHookFunction; +} + +//----------------------------------------------------------------- +// rls - In IME mode, the F5 key can cause the IME pad window to open up. +// This causes the Japanese player to essentially lock-up because of +// context issues. There is probably a better way to handle this, but be +// warned: the SWG input system may not work properly. +void Os::setIMEHookFunction(IMEHookFunction imeHookFunction) +{ + if (ms_IMEHookFunction) + { + UnregisterHotKey(ms_window, ms_hotKeyId); + } + + ms_IMEHookFunction = imeHookFunction; + + // do not install the hotkey fix if the debugger is present. + if (ms_IMEHookFunction && !OsNamespace::IsDebuggerPresent()) + { + RegisterHotKey(ms_window, ms_hotKeyId, 0, VK_F5); + } +} + +//----------------------------------------------------------------- + +void Os::setQueueKeyDownHookFunction(QueueKeyDownHookFunction queueKeyDownHookFunction) +{ + ms_queueKeyDownHookFunction = queueKeyDownHookFunction; +} + +//----------------------------------------------------------------- +/** +* Create the specified directory and all of it's parents. +* @param directory the path to a directory +* @return always true currently +*/ + +bool Os::createDirectories (const char *directory) +{ + //-- construct list of subdirectories all the way down to root + std::stack directoryStack; + + std::string currentDirectory = directory; + + static const char path_seps [] = { '\\', '/', 0 }; + + // build the stack + while (!currentDirectory.empty()) + { + // remove trailing backslash + if (currentDirectory[currentDirectory.size()-1] == '\\' || currentDirectory[currentDirectory.size()-1] == '/') + IGNORE_RETURN(currentDirectory.erase(currentDirectory.size()-1)); + + if (currentDirectory[currentDirectory.size()-1] == ':') + { + // we've hit something like c: + break; + } + + if (!currentDirectory.empty()) + directoryStack.push(currentDirectory); + + // now strip off current directory + const size_t previousDirIndex = currentDirectory.find_last_of (path_seps); + if (static_cast(previousDirIndex) == currentDirectory.npos) + break; + else + IGNORE_RETURN(currentDirectory.erase(previousDirIndex)); + } + + //-- build all directories specified by the initial directory + while (!directoryStack.empty()) + { + // get the directory + currentDirectory = directoryStack.top(); + directoryStack.pop(); + + // try to create it (don't pass any security attributes) + IGNORE_RETURN (CreateDirectory(currentDirectory.c_str(), NULL)); + } + + return true; +} + +// ---------------------------------------------------------------------- +/** + * Write out a file. + * + * The file name and where the file is written is system-dependent. + * + * @param fileName Name of the file to write + * @param data Data buffer to write to the file + */ + +bool Os::writeFile(const char *fileName, const void *data, int length) // Length of the data bufferto write +{ + BOOL result; + HANDLE handle; + DWORD written; + + // open the file for writing + handle = CreateFile(fileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + + // check if it was opened + if (handle == INVALID_HANDLE_VALUE) + { + WARNING (true, ("Os::writeFile unable to create file [%s] for writing.", fileName)); + return false; + } + + // attempt to write the data + result = WriteFile(handle, data, static_cast(length), &written, NULL); + + // make sure the data was written okay + if (!result || written != static_cast(length)) + { + WARNING (true, ("Os::writeFile error writing file [%s]. Wrote %d, attempted to write %d.", fileName, written, length)); + static_cast(CloseHandle(handle)); + return false; + } + + // close the file + result = CloseHandle(handle); + + // make sure the close was sucessful + if (!result) + { + WARNING (true, ("Os::writeFile error closing file [%s].", fileName)); + return false; + } + + return true; +} + +// ---------------------------------------------------------------------- +/** + * Check to see if any child threads have Fataled. + * + * This routine will + */ + +void Os::checkChildThreads() +{ + FATAL(ms_threadDied, ("child thread died")); +} + +// ---------------------------------------------------------------------- +/** + * Change the priority of this process. + * + */ + +void Os::setProcessPriority(Priority priority) +{ + switch (priority) + { + case P_low: + SetPriorityClass(GetCurrentProcess(), IDLE_PRIORITY_CLASS); + break; + + case P_normal: + SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS); + break; + + case P_high: + SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS); + break; + + default: + DEBUG_FATAL(true, ("Invalid priority")); + break; + } +} + +// ---------------------------------------------------------------------- +/** + * Update the Os subsystem. + * + * This routine is supported for all platforms. + * + * For the Win* platforms, this routine will process the windows message pump. + */ + +bool Os::update() +{ + MSG msg; + int result; + + FloatingPointUnit::update(); + + ms_wasFocusLost = false; + ++ms_numberOfUpdates; + +#if PRODUCTION == 0 + + if (ms_validateGuardPatterns || ms_validateFreePatterns) + { + PROFILER_AUTO_BLOCK_DEFINE ("validate heap"); + MemoryManager::verify(ms_validateGuardPatterns, ms_validateFreePatterns); + } + +#endif + + if (ms_processMessagePump) + { + do + { + checkChildThreads(); + + // while there are messages in the queue + while (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) + { + result = GetMessage(&msg, NULL, 0, 0); + + if (result < 0) + { + // error, ignore GetMessage + } + else + // get the message + if (result > 0) + { + static_cast(TranslateMessage(&msg)); + static_cast(DispatchMessage(&msg)); + } + else + { + // WM_QUIT handled here + ms_gameOver = true; + return false; + } + } + + // may need to reprocess the message queue now + } while (handleDebugMenu()); + } + + Clock::update(); + + return true; +} + +// ---------------------------------------------------------------------- +/** + * Formats a message error using GetLastError() and FormatMessge(). + * + * The buffer returned from this function is dynamically allocated to prevent + * issues with this routine being called from multiple threads. The caller + * must delete the buffer when it is done. + * + * @return A dynamically allocated buffer containing the error message + */ + +char *Os::getLastError() +{ + char buffer[2048]; + + const DWORD result = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), buffer, sizeof(buffer), NULL); + + if (result == 0) + return NULL; + + return DuplicateString(buffer); +} + +// ---------------------------------------------------------------------- + +bool Os::handleDebugMenu() +{ +#if PRODUCTION == 0 + + // pop up the menu if it is wanted and GDI is actually visible + if (ms_wantPopupDebugMenu && ms_isGdiVisibleHookFunction && ms_isGdiVisibleHookFunction()) + { + ms_focused = false; + // unaquire all the dinput devices + if (ms_lostFocusHookFunction) + ms_lostFocusHookFunction(); + + BOOL b; + POINT p; + + // get the upper left corner of the client space in screen coordinates + p.x = 0; + p.y = 0; + b = ClientToScreen(ms_window, &p); + DEBUG_FATAL(!b, ("ClientToScreen failed")); + + typedef std::map Map; + Map map; + + // create the menu + HMENU menu = CreatePopupMenu(); + const char *lastSection.clear(); + HMENU lastSubmenu = NULL; + int index = 1; + DebugFlags::FlagVector::const_iterator end = DebugFlags::ms_flagsSortedByName.end(); + for (DebugFlags::FlagVector::const_iterator i = DebugFlags::ms_flagsSortedByName.begin(); i != end; ++i, ++index) + { + const DebugFlags::Flag &flag = *i; + + // check if we are starting a new section + if (strcmp(lastSection, flag.section) != 0) + { + lastSection = flag.section; + + char buffer[512]; + strcpy(buffer, lastSection); + char *start = buffer; + char *slash = NULL; + lastSubmenu = menu; + while ((slash = strchr(start, '/')) != NULL) + { + *slash = '\0'; + + Map::iterator entry = map.find(buffer); + if (entry == map.end()) + { + const int numberOfItems = GetMenuItemCount(lastSubmenu); + int insertLocation = 0; + for (insertLocation = 0; insertLocation < numberOfItems && GetSubMenu(lastSubmenu, insertLocation); ++insertLocation) + ; + + HMENU newMenu = CreatePopupMenu(); + static_cast(InsertMenu(lastSubmenu, insertLocation, MF_BYPOSITION | MF_POPUP, reinterpret_cast(newMenu), start)); + lastSubmenu = newMenu; + map.insert(Map::value_type(DuplicateString(buffer), lastSubmenu)); + } + else + lastSubmenu = entry->second; + + *slash = '/'; + start = slash + 1; + } + + const int numberOfItems = GetMenuItemCount(lastSubmenu); + int insertLocation = 0; + for (insertLocation = 0; insertLocation < numberOfItems && GetSubMenu(lastSubmenu, insertLocation); ++insertLocation) + ; + + HMENU newMenu = CreatePopupMenu(); + static_cast(InsertMenu(lastSubmenu, insertLocation, MF_BYPOSITION | MF_POPUP, reinterpret_cast(newMenu), start)); + lastSubmenu = newMenu; + map.insert(Map::value_type(DuplicateString(buffer), lastSubmenu)); + } + + // add the current flag to the current menu + static_cast(AppendMenu(lastSubmenu, MF_ENABLED | MF_STRING | (*flag.variable ? MF_CHECKED : MF_UNCHECKED), index, flag.name)); + } + + { + ms_debugKeyIndex = index; + + Map::iterator entry = map.find("SharedDebug"); + DEBUG_FATAL(entry == map.end(), ("Could not find SharedDebug section")); + + HMENU newMenu = CreatePopupMenu(); + static_cast(AppendMenu(entry->second, MF_POPUP, reinterpret_cast(newMenu), "DebugKey")); + lastSubmenu = newMenu; + + DebugKey::FlagVector::const_iterator end = DebugKey::ms_flags.end(); + for (DebugKey::FlagVector::const_iterator i = DebugKey::ms_flags.begin(); i != end; ++i, ++index) + { + // add the current flag to the current menu + const DebugKey::Flag &flag = *i; + static_cast(AppendMenu(lastSubmenu, MF_ENABLED | MF_STRING | (*flag.variable ? MF_CHECKED : MF_UNCHECKED), index, flag.name)); + } + } + + // free the map memory + while (!map.empty()) + { + Map::iterator i = map.begin(); + char *value = i->first; + map.erase(i); + delete [] value; + } + + // pop up the menu at the top corner of the client space + index = TrackPopupMenuEx(menu, TPM_LEFTALIGN | TPM_TOPALIGN | TPM_NONOTIFY | TPM_RETURNCMD | TPM_RIGHTBUTTON, p.x, p.y, ms_window, NULL); + if (index) + { + if (index < ms_debugKeyIndex) + { + bool &value = *DebugFlags::ms_flagsSortedByName[index-1].variable; + value = !value; + } + else + { +#if PRODUCTION == 0 + DebugKey::setCurrentFlag(DebugKey::ms_flags[index - ms_debugKeyIndex].variable); +#endif + } + } + + DestroyMenu(menu); + + // don't want the menu anymore + ms_wantPopupDebugMenu = false; + ms_wasFocusLost = true; + ms_focused = true; + if (ms_acquiredFocusHookFunction2) + ms_acquiredFocusHookFunction2(); + + return true; + } + +#endif + + return false; +} + +// ---------------------------------------------------------------------- + +void Os::enablePopupDebugMenu() +{ +#if PRODUCTION == 0 + ms_allowPopupDebugMenu = true; +#endif +} + +// ---------------------------------------------------------------------- +/** + * Request that the popup debug menu be displayed. + * + * The popup debug menu will only be displayed if the proper config file + * switch has been set. + */ + +void Os::requestPopupDebugMenu() +{ +#if PRODUCTION == 0 + ms_wantPopupDebugMenu = ms_allowPopupDebugMenu; +#endif +} + +bool Os::isNumPadValue(unsigned char asciiChar) +{ + return (asciiChar >= '0' && asciiChar <= '9') || + (asciiChar == '/') || + (asciiChar == '*') || + (asciiChar == '-') || + (asciiChar == '+') || + (asciiChar == '.'); +} + + +// ---------------------------------------------------------------------- +/** + * Check to see if this is a NumPad keypress to be consumed. Enter is the only one not consumed. + */ +bool Os::isNumPadChar(unsigned char asciiChar) +{ + BYTE keyboardstate[256]; + GetKeyboardState( keyboardstate ); + + if (isNumPadValue(asciiChar)) + { + return ( (keyboardstate[VK_NUMPAD1] > 1) || + (keyboardstate[VK_NUMPAD2] > 1) || + (keyboardstate[VK_NUMPAD3] > 1) || + (keyboardstate[VK_NUMPAD4] > 1) || + (keyboardstate[VK_NUMPAD5] > 1) || + (keyboardstate[VK_NUMPAD6] > 1) || + (keyboardstate[VK_NUMPAD7] > 1) || + (keyboardstate[VK_NUMPAD8] > 1) || + (keyboardstate[VK_NUMPAD9] > 1) || + (keyboardstate[VK_NUMPAD0] > 1) || + (keyboardstate[VK_DIVIDE] > 1) || + (keyboardstate[VK_ADD] > 1) || + (keyboardstate[VK_SUBTRACT] > 1) || + (keyboardstate[VK_MULTIPLY] > 1) || + (keyboardstate[VK_DECIMAL] > 1)); + } + return false; +} + +// ---------------------------------------------------------------------- +/** + * Handle window messages. + * + * This routine will process window messages that are passed into the application from + * Windows, likely though the Os::update() routine, but may be from other locations as well. + * + * @param hwnd Handle of window + * @param uMsg Message identifier + * @param wParam First message parameter + * @param lParam Second message parameter + * @see Os::update() + */ + +LRESULT CALLBACK Os::WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ +#if 0 + DEBUG_REPORT_LOG_PRINT(true, ("%08d %08x %08x %08x\n", ms_numberOfUpdates, uMsg, wParam, lParam)); +#endif + + if (ms_IMEHookFunction) + { + // Let the IME Manager see and possibly consume message + if (ms_IMEHookFunction(hwnd, uMsg, wParam, lParam) == 0) + { + return 0; + } + } + + switch (uMsg) + { + case WM_ERASEBKGND: + // won't let windows erase the background + return 0; + + case WM_IME_CHAR: + if (ms_queueCharacterHookFunction) + { + const char ansiChars [2] = + { + static_cast(HIBYTE( wParam )), //lint !e1924 // c-style case msvc bug + static_cast(LOBYTE( wParam )) //lint !e1924 // c-style case msvc bug + }; + + wchar_t u; + if (MultiByteToWideChar (CP_ACP, MB_PRECOMPOSED, reinterpret_cast(ansiChars), 2, &u, 1)) + ms_queueCharacterHookFunction(0, static_cast(u)); + } + return 0; + + case WM_HOTKEY: + { + if (ms_queueKeyDownHookFunction) + { + ms_queueKeyDownHookFunction(0, MapVirtualKey(HIWORD(lParam), 0)); + } + return 0; + } + case WM_CHAR: + // handle typed string characters + if (ms_queueCharacterHookFunction) + { + //-- the extended bit is bit 24 + const int extended = (lParam & (1 << 24)) != 0; + + if (!extended) + { + int keyCode = (lParam << 8) >> 24; // key code is in bits 16-23 + // cp* == ASCII until 0x80, for which you then need to call the following to get the Unicode value + // from the cp* value. WM_CHAR always returns the values from the windows codepage (cp) used. For US/Europe + // it is cp1252 and for Japan it is cp932. + if (wParam >= 0x80) + { + char cpChar[2]; + wchar_t unicodeChar[2]; + + cpChar[0] = static_cast(wParam); + cpChar[1] = '\0'; + + int result = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, cpChar, sizeof(cpChar), unicodeChar, sizeof(unicodeChar)); + + + if (result > 0) + { + ms_queueCharacterHookFunction(keyCode, static_cast(unicodeChar[0])); + } + } + else + { + ms_queueCharacterHookFunction(keyCode, static_cast(wParam)); + } + } + } + return 0; + + case WM_INPUTLANGCHANGE: + { + if (ms_inputLanguageChangedHookFunction) + { + ms_inputLanguageChangedHookFunction(); + } + } + return 0; + + case WM_DESTROY: + // if the main window gets destroyed, it's time to quit + PostQuitMessage(0); + return 0; + + case WM_SYSCOMMAND: + switch (wParam & 0xFFF0) + { + // hack hack hack hack hack + // don't let alt-f4 close the window, but allow clicking on the close X button to close the window + case SC_CLOSE: + if (GetKeyState(VK_F4) && (GetKeyState(VK_MENU) || GetKeyState(VK_RMENU))) + return 0; + break; + + // don't let the monitor get turned off + case SC_MONITORPOWER: + return 0; + + // don't allow the screen saver to come on + case SC_SCREENSAVE: + return 0; + + // don't allow alt-space to open up the window menu + case SC_KEYMENU: + return 0; + + case SC_MOVE: + ClipCursor(NULL); + ms_focused = false; + if (ms_lostFocusHookFunction) + ms_lostFocusHookFunction(); + ms_wasFocusLost = true; + break; + default: + break; + } + break; + + case WM_ENTERSIZEMOVE: + if (ms_getOtherAdapterRectsHookFunction) + { + ms_otherAdapterRects.clear(); + (*ms_getOtherAdapterRectsHookFunction)(ms_otherAdapterRects); + } + break; + + case WM_EXITSIZEMOVE: + ms_focused = true; + if (ms_acquiredFocusHookFunction) + ms_acquiredFocusHookFunction(); + if (ms_acquiredFocusHookFunction2) + ms_acquiredFocusHookFunction2(); + ms_wasFocusLost = true; + if (ms_windowPositionChangedHookFunction) + (*ms_windowPositionChangedHookFunction)(); +#if PRODUCTION == 0 + DebugMonitor::setBehindWindow(ms_window); +#endif + break; + + case WM_MOUSEACTIVATE: + if (hwnd == ms_window) + { + if (LOWORD(lParam) == HTCAPTION) + ms_clickToMove = true; + else if (LOWORD(lParam) == HTCLIENT) + { + ms_focused = true; + if (ms_acquiredFocusHookFunction) + ms_acquiredFocusHookFunction(); + if (ms_acquiredFocusHookFunction2) + ms_acquiredFocusHookFunction2(); + } + } + + break; + + case WM_MOUSEMOVE: + if (ms_focused && hwnd == ms_window) + { + ms_mouseMoveInClient = true; + updateMousePosition(LOWORD(lParam), HIWORD(lParam)); + } + break; + + case WM_NCMOUSEMOVE: + ms_mouseMoveInClient = false; + break; + + case WM_SETCURSOR: + if (!ms_mouseMoveInClient || hwnd != ms_window) + SetCursor(ms_cursorArrow); + else + if (!ms_getHardwareMouseCursorEnabled || !ms_getHardwareMouseCursorEnabled()) + SetCursor(NULL); + break; + + case WM_NCACTIVATE: +#if PRODUCTION == 0 + // hack to handle coming back from the debugger cleanly + if (wParam) + { + //allow game-specific systems a chance to respond to focus changes + DebugMonitor::setBehindWindow(ms_window); + if (ms_lostFocusHookFunction) + ms_lostFocusHookFunction(); + if (ms_acquiredFocusHookFunction) + ms_acquiredFocusHookFunction(); + if (ms_acquiredFocusHookFunction2) + ms_acquiredFocusHookFunction2(); + ms_wasFocusLost = true; + ms_focused = true; + } +#endif + break; + + case WM_ACTIVATE: + if (hwnd == ms_window) + { + if (wParam != WA_INACTIVE) + { + if (ms_clickToMove) + ms_clickToMove = false; + ms_mouseMoveInClient = true; + ms_focused = true; + ms_wasFocusLost = true; + + if (ms_acquiredFocusHookFunction) + ms_acquiredFocusHookFunction(); + if (ms_acquiredFocusHookFunction2) + ms_acquiredFocusHookFunction2(); + } + else + { + ClipCursor(NULL); + ms_focused = false; + if (ms_lostFocusHookFunction) + ms_lostFocusHookFunction(); + } + } + break; + + case WM_ACTIVATEAPP: + if (wParam == FALSE) + { + ClipCursor(NULL); + ms_focused = false; + if (ms_lostFocusHookFunction) + ms_lostFocusHookFunction(); + } + break; + + case WM_DISPLAYCHANGE: + if (ms_displayModeChangedHookFunction) + ms_displayModeChangedHookFunction(); + break; + + default: + break; + } + + return DefWindowProc(hwnd, uMsg, wParam, lParam); +} + +// ---------------------------------------------------------------------- + +void OsNamespace::updateMousePosition(int x, int y) +{ + if (ms_setSystemMouseCursorPositionHookFunction) + ms_setSystemMouseCursorPositionHookFunction(x, y); + + if (ms_setSystemMouseCursorPositionHookFunction2) + ms_setSystemMouseCursorPositionHookFunction2(x, y); +} + +// ---------------------------------------------------------------------- +/** + * Get an identifier indicating which thread called this function. + */ + +Os::ThreadId Os::getThreadId() +{ + return GetCurrentThreadId(); +} + +// ---------------------------------------------------------------------- +/** + * Get the actual system time, in seconds since the epoch. + * + * Do not use this for most game systems, since it does not take into account + * clock sku, game loop times, etc. + */ +time_t Os::getRealSystemTime() +{ + return time(0); +} + +// ---------------------------------------------------------------------- +/** + * Convert a time in seconds since the epoch to GMT. + * + */ + +void Os::convertTimeToGMT(const time_t &convertTime, tm &zulu) +{ + zulu=*gmtime(&convertTime); // gmtime uses a single static tm structure. Yuck! +} + +// ---------------------------------------------------------------------- +/** + * Convert a tm structure to the time in seconds since the epoch. + * + */ + +time_t Os::convertGMTToTime(const tm &zulu) +{ + return mktime(const_cast(&zulu)); +} + +// ---------------------------------------------------------------------- +/** + * Cause the current thread to suspend for a period of time. Zero delay indicates + * to yield the current time slice. + */ + +void Os::sleep(int ms) +{ + ::Sleep(static_cast(ms)); +} + +// ---------------------------------------------------------------------- +/** + * Assign the given thread a reasonable name (only works for MSDev 6.0 debugger) + * Max 9 characters + * + */ + +void Os::setThreadName(ThreadId threadID, const char* threadName) +{ + //used to give threads reasonable names in the MSDev debugger, + //see http://www.vcdj.com/upload/free/features/vcdj/2001/03mar01/et0103/et0103.asp for more info + struct ThreadNameInfo + { + DWORD dwType; + LPCSTR szName; + DWORD dwThreadID; + DWORD dwFlags; + }; + + ThreadNameInfo info; + info.dwType = 0x1000; //must be this value + info.szName = threadName; + info.dwThreadID = threadID; + info.dwFlags = 0; //unused, reserved for future use + + __try + { + // use the magic exception number MS picked for this purpose + RaiseException(0x406D1388, 0, sizeof(info) / sizeof(DWORD), reinterpret_cast(&info)); + } + __except (EXCEPTION_CONTINUE_EXECUTION) + { + } +} + +// ---------------------------------------------------------------------- +/** + * Given a base directory and a full file pathname, find the relative path + * needed to get from the source directory to the target. + * + * This command is case sensitive. It does not care whether baseDirectory contains + * a trailing backslash or not. + * + * @param baseDirectory the base directory from which a relative path will be constructed. + * @param targetPathname the full pathname for the file for which we want to generate a relative path + * @param relativePath the string into which the constructed relative path will be returned + */ + +void Os::buildRelativePath(const char *baseDirectory, const char *targetPathname, std::string &relativePath) +{ + NOT_NULL(baseDirectory); + DEBUG_FATAL(!targetPathname || !*targetPathname, ("bad targetPathname, must be non-zero length")); + + const char directorySeparator = '\\'; + const char *const backupDirectoryString = "..\\"; + + std::string workingBaseDirectory(baseDirectory); + + //-- ensure base directory ends in directory separator + if (workingBaseDirectory[workingBaseDirectory.length()-1] != directorySeparator) + workingBaseDirectory += directorySeparator; + + //-- grab the target directory + std::string workingTargetDirectory; + + const char *endOfDirectory = strrchr(targetPathname, static_cast(directorySeparator)); + if (endOfDirectory) + IGNORE_RETURN(workingTargetDirectory.append(targetPathname, static_cast(endOfDirectory - targetPathname + 1))); + + //-- find count of character of match between directory strings + const size_t workingBaseDirectoryLength = workingBaseDirectory.length(); + const size_t workingTargetDirectoryLength = workingTargetDirectory.length(); + + size_t searchIndex = 0; + while ((searchIndex < workingBaseDirectoryLength) && (searchIndex < workingTargetDirectoryLength) && (workingBaseDirectory[searchIndex] == workingTargetDirectory[searchIndex])) + ++searchIndex; + + size_t matchCount = searchIndex; + + //-- if we match into the middle of a directory, back up until the previous directory + if ((matchCount > 0) && (workingBaseDirectory[matchCount - 1] != directorySeparator)) + { + do + { + --matchCount; + } while ((matchCount > 0) && (workingBaseDirectory[matchCount - 1] != directorySeparator)); + } + + //-- if we have no match between directories, the best path is the full path. + if (matchCount < 1) + { + relativePath = targetPathname; + return; + } + + //-- for each directory in base directory not matched, insert a "backup directory" string + relativePath.clear(); + { + for (size_t i = matchCount; i < workingBaseDirectoryLength; ++i) + if (workingBaseDirectory[i] == directorySeparator) + IGNORE_RETURN(relativePath.append(backupDirectoryString)); + } + + //-- for each directory in the target directory not matched, append to result. + // this works out to copying from the match point forward in the target path. + IGNORE_RETURN(relativePath.append(targetPathname + matchCount)); +} + +// ---------------------------------------------------------------------- +/** + * Convert a relative path to an absolute path. + */ +bool Os::getAbsolutePath(const char *relativePath, char *absolutePath, int absolutePathBufferSize) +{ + if (_fullpath(absolutePath, relativePath, static_cast(absolutePathBufferSize)) == NULL) + return false; + + // convert the slashes to be forwards + for (char *convert = absolutePath; *convert; ++convert) + if (*convert == '\\') + *convert = '/'; + + return true; +} + +// ---------------------------------------------------------------------- +/** + * Copy text to the system clipboard. + * + * This routine can be used if the application wants to make some data easily available for pasting (like crash call stacks). + */ + +bool Os::copyTextToClipboard(const char *text) +{ + if (!OpenClipboard(ms_window)) + return false; + + if (!EmptyClipboard()) + return false; + + // need to convert to cr/lf sequences. yuck. + int length = 1; + for (const char *t2 = text; *t2; ++t2, ++length) + { + if (*t2 == '\n') + ++length; + } + + HANDLE memoryHandle = GlobalAlloc(GMEM_MOVEABLE, length); + if (memoryHandle == NULL) + { + CloseClipboard(); + return FALSE; + } + + // lock the handle and copy the text to the buffer. + char *destination = reinterpret_cast(GlobalLock(memoryHandle)); + while (*text) + { + if (*text == '\n') + *(destination++) = '\r'; + *destination++ = *text++; + } + + if (GlobalUnlock(memoryHandle) != 0 || GetLastError() != NO_ERROR) + { + IGNORE_RETURN(GlobalFree(memoryHandle)); + return false; + } + + if (!SetClipboardData(CF_TEXT, memoryHandle)) + return false; + + if (!CloseClipboard()) + return false; + + return true; +} + +// ---------------------------------------------------------------------- + +bool Os::getUserName(char *buffer, int &bufferSize) +{ + NOT_NULL(buffer); + DWORD windowsBufferSize = static_cast(bufferSize); + buffer[0] = '\0'; + bool result = GetUserName(buffer, &windowsBufferSize) == TRUE; + return result; +} + +//----------------------------------------------------------------------- + +Os::OsPID_t Os::getProcessId() +{ + return static_cast(GetCurrentProcessId()); +} + +//---------------------------------------------------------------------- + +bool Os::isFocused() +{ + return ms_focused; +} + +//---------------------------------------------------------------------- + +bool Os::launchBrowser(std::string const & website) +{ + std::string URL("http://"); + if (strncmp(URL.c_str(), website.c_str(),7)!=0) + URL+=website; + else + URL=website; + int result = reinterpret_cast(ShellExecute(NULL, "open", URL.c_str(), NULL, NULL, SW_SHOWNORMAL)); + return (result > 32); +} + + +// ====================================================================== diff --git a/engine/shared/library/sharedFoundation/src/win32/Os.h b/engine/shared/library/sharedFoundation/src/win32/Os.h new file mode 100755 index 00000000..afb3be40 --- /dev/null +++ b/engine/shared/library/sharedFoundation/src/win32/Os.h @@ -0,0 +1,152 @@ +// ====================================================================== +// +// Os.h +// +// Portions copyright 1998 Bootprint Entertainment +// Portions copyright 2000-2002 Sony Online Entertainment +// All Rights Reserved +// +// ====================================================================== + +#ifndef INCLUDED_Os_H +#define INCLUDED_Os_H + +// ====================================================================== + +#include + +// ====================================================================== + +class Os +{ +public: + + typedef bool (*IsGdiVisibleHookFunction)(); + typedef void (*LostFocusHookFunction)(); + typedef void (*AcquiredFocusHookFunction)(); + typedef void (*QueueCharacterHookFunction)(int keyboard, int character); + typedef void (*SetSystemMouseCursorPositionHookFunction)(int x, int y); + typedef bool (*GetHardwareMouseCursorEnabled)(); + typedef void (*GetOtherAdapterRectsHookFunction)(stdvector::fwd &); + typedef void (*WindowPositionChangedHookFunction)(); + typedef void (*DisplayModeChangedHookFunction)(); + typedef void (*InputLanguageChangedHookFunction)(); + typedef int (*IMEHookFunction)(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); + typedef void (*QueueKeyDownHookFunction)(int keyboard, int character); + + typedef uint ThreadId; + typedef DWORD OsPID_t; + + enum Priority + { + P_high, + P_normal, + P_low + }; + + enum + { + MAX_PATH_LENGTH = 512 + }; + +public: + + static void install(HINSTANCE newInstance, const char *windowName, HICON normalIcon, HICON smallIcon); + static void install(HWND newWindow, bool processMessagePump); + static void install(); + + static bool isGameOver(); + static DLLEXPORT bool isMainThread(); + static bool wasFocusLost(); + static void checkChildThreads(); + + static void setProcessPriority(Priority priority); + + static bool update(); + + static void returnFromAbort(); + static void abort(); + + static void enablePopupDebugMenu(); + static void requestPopupDebugMenu(); + + static bool createDirectories (const char *dirname); + + static bool writeFile(const char *fileName, const void *data, int length); + + static HWND getWindow(); + static bool engineOwnsWindow(); + + static int getNumberOfUpdates(); + + static char *getLastError(); + + static const char *getProgramName(); + static const char *getShortProgramName(); + static const char *getProgramStartupDirectory(); + + static void setIsGdiVisibleHookFunction(IsGdiVisibleHookFunction newGlIsGdiVisible); + static void setLostFocusHookFunction(LostFocusHookFunction lostFocusHookFunction); + static void setQueueCharacterHookFunction(QueueCharacterHookFunction queueCharacterHookFunction); + static void setSetSystemMouseCursorPositionHookFunction(SetSystemMouseCursorPositionHookFunction setSystemMouseCursorPositionHookFunction); + static void setSetSystemMouseCursorPositionHookFunction2(SetSystemMouseCursorPositionHookFunction setSystemMouseCursorPositionHookFunction); + static void setAcquiredFocusHookFunction(AcquiredFocusHookFunction acquiredFocusHookFunction); + static void setAcquiredFocusHookFunction2(AcquiredFocusHookFunction acquiredFocusHookFunction); + static void setGetHardwareMouseCursorEnabled(GetHardwareMouseCursorEnabled getHardwareMouseCursorEnabled); + static void setGetOtherAdapterRectsHookFunction(GetOtherAdapterRectsHookFunction getOtherAdapterRectsHookFunction); + static void setWindowPositionChangedHookFunction(WindowPositionChangedHookFunction windowPositionChangedHookFunction); + static void setDisplayModeChangedHookFunction(DisplayModeChangedHookFunction displayModeChangedHookFunction); + static void setInputLanguageChangedHookFunction(InputLanguageChangedHookFunction inputLanguageChangedHookFunction); + static void setIMEHookFunction(IMEHookFunction imeHookFunction); + static void setQueueKeyDownHookFunction(QueueKeyDownHookFunction queueKeyDownHookFunction); + + static DLLEXPORT ThreadId getThreadId(); + static void setThreadName(ThreadId threadID, const char* name); + + static void sleep(int ms); + + static time_t getRealSystemTime(); + static void convertTimeToGMT(const time_t &time, tm &zulu); + static time_t convertGMTToTime(const tm &zulu); + + static bool isMultiprocessor(); + static int getProcessorCount(); + + static void buildRelativePath(const char *baseDirectory, const char *targetPathname, std::string &relativePath); + static bool getAbsolutePath(const char *relativePath, char *absolutePath, int absolutePathBufferSize); + + static bool copyTextToClipboard(const char *text); + + static bool getUserName(char *buffer, int &bufferSize); + + static OsPID_t getProcessId(); + + static bool isFocused(); + + static bool launchBrowser(std::string const & website); + static bool isNumPadValue(unsigned char asciiChar); + static bool isNumPadChar(unsigned char asciiChar); + +private: + + Os(); + Os(const Os &); + Os &operator =(const Os &); + +private: + + static void remove(); + static void installCommon(); + + static LRESULT CALLBACK Os::WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); + +private: + +private: + + static bool handleDebugMenu(); +}; + +// ====================================================================== + +#endif diff --git a/engine/shared/library/sharedFoundation/src/win32/PerThreadData.cpp b/engine/shared/library/sharedFoundation/src/win32/PerThreadData.cpp new file mode 100755 index 00000000..7b2d0b58 --- /dev/null +++ b/engine/shared/library/sharedFoundation/src/win32/PerThreadData.cpp @@ -0,0 +1,465 @@ +// ====================================================================== +// +// PerThreadData.cpp +// +// Portions copyright 1998 Bootprint Entertainment +// Portions Copyright 2002 Sony Online Entertainment +// All Rights Reserved +// +// ====================================================================== + +#include "sharedFoundation/FirstSharedFoundation.h" +#include "sharedFoundation/PerThreadData.h" + +#include "sharedSynchronization/RecursiveMutex.h" +#include "sharedSynchronization/Gate.h" + +#include "sharedFoundation/Os.h" + +#include +#include + +// ====================================================================== + +// ====================================================================== +namespace PerThreadDataNamespace +{ + struct Data + { + bool exitChainRunning; + bool exitChainFataling; + ExitChain::Entry *exitChainFirstEntry; + + int debugPrintFlags; + + Gate *fileStreamerReadGate; + + HANDLE watchHandle; + }; + + typedef std::vector DataAllocations; + + // ------------------------------------------------------ + + static char buffer1[sizeof(RecursiveMutex)]; + static char buffer2[sizeof(DataAllocations)]; + + static const DWORD BadSlot = 0xffffffff; + + static DWORD slot = BadSlot; + static RecursiveMutex *criticalSection; + static DataAllocations *dataAllocations; + + // ------------------------------------------------------ + + static void _threadRemove(Data *data); + static void _removeFromList(Data *data); + static void _watchThreads(); + + /*---------------------------------------------------------------------- + * Get access to the per-thread-data. + * + * This routine will verify the per-thread-data subsystem has been installed and the + * threadInstall() function has been called for the current thread. + * + * @return A pointer to the per-thread-data. + */ + inline static Data *_getData(bool allowReturnNull=false) + { + UNREF(allowReturnNull); + + if (slot == BadSlot) + { + DEBUG_FATAL(true && !allowReturnNull, ("not installed")); + return NULL; + } + + Data * const data = reinterpret_cast(TlsGetValue(slot)); + DEBUG_FATAL(!data && !allowReturnNull, ("not installed for this thread")); + return data; + } + + // ------------------------------------------------------ + + inline static void _closeData(Data *data) + { + if (data->fileStreamerReadGate) + { + delete data->fileStreamerReadGate; + data->fileStreamerReadGate=0; + } + if (data->watchHandle) + { + CloseHandle(data->watchHandle); + data->watchHandle=0; + } + } + + // ------------------------------------------------------ + + inline static void _freeData(Data *data) + { + delete data; + } + + // ------------------------------------------------------ +} +using namespace PerThreadDataNamespace; + +// ====================================================================== + +// ====================================================================== +// Install the per-thread-data subsystem +// +// Remarks: +// +// This routine will install the per-thread-data subsystem that is required for several +// other subsystems in the engine. It should be called from the primary thread before +// any other threads have been created. It will also call threadInstall() for the +// primary thread. +// +// See Also: +// +// PerThreadData::remove() + +void PerThreadData::install() +{ + slot = TlsAlloc(); + FATAL(slot == BadSlot, ("TlsAlloc failed")); + + criticalSection = new(buffer1) RecursiveMutex; + dataAllocations = new(buffer2) DataAllocations; + dataAllocations->reserve(8); + threadInstall(); +} + +// ---------------------------------------------------------------------- +/** + * Remove the per-thread-subsystem. + * + * This routine should be called by the primary thread after all other threads have + * terminated, and no other uses of per-thread-data will occur. + * + * @see PerThreadData::install() + */ +void PerThreadData::remove() +{ + criticalSection->enter(); + { + // remove this thread. + threadRemove(); + + // clean up after any threads which didn't clean up after themselves (like the miles sound system) + const DataAllocations::iterator iEnd = dataAllocations->end(); + for (DataAllocations::iterator i = dataAllocations->begin(); i != iEnd; ++i) + { + _closeData(*i); + _freeData(*i); + } + + dataAllocations->clear(); + } + criticalSection->leave(); + + criticalSection->~RecursiveMutex(); + dataAllocations->~vector(); + + memset(buffer1, 0, sizeof(buffer1)); + memset(buffer2, 0, sizeof(buffer2)); + + const BOOL result = TlsFree(slot); + FATAL(!result, ("TlsFree failed")); +} + +// ---------------------------------------------------------------------- +/** + * Create the per-thread-data for a new thread. + * + * This routine should be called in a thread before the first usage of per-thread-data. + * + * If the client is calling this function on a thread that existed before the engine was + * installed, the client should set isNewThread to false. Setting isNewThread to false + * prevents the function from validating that the thread's TLS is NULL. For threads existing + * before the engine is installed, the TLS data for the thread is undefined. + * + * @param isNewThread [IN] true if the thread was created after the engine was installed, false otherwise + * @see PerThreadData::threadRemove() + */ + +void PerThreadData::threadInstall(bool isNewThread) +{ + UNREF(isNewThread); + + DEBUG_FATAL(slot == BadSlot, ("not installed")); + + // only check for already-set data if this is supposed to be a new thread + DEBUG_FATAL(isNewThread && TlsGetValue(slot), ("already installed for this thread")); + + // create the data + Data * const data = new Data; + + // initialize the data + memset(data, 0, sizeof(*data)); + + //create the event for file streaming reads + data->fileStreamerReadGate = new Gate(false); + + // set the data into the thread slot + const BOOL result = TlsSetValue(slot, data); + UNREF(result); + DEBUG_FATAL(!result, ("TlsSetValue failed")); + + criticalSection->enter(); + { + _watchThreads(); + + dataAllocations->push_back(data); + + // This is most likely a thread created by a 3rd party library such as Miles or Bink. + // Add a watch handle to it so we can clean it up. + if (!isNewThread) + { + const HANDLE processHandle = GetCurrentProcess(); + DuplicateHandle(processHandle, GetCurrentThread(), processHandle, &data->watchHandle, 0, FALSE, DUPLICATE_SAME_ACCESS); + } + } + criticalSection->leave(); +} + +// ---------------------------------------------------------------------- + +void PerThreadDataNamespace::_removeFromList(Data *data) +{ + const DataAllocations::iterator iEnd = dataAllocations->end(); + const DataAllocations::iterator i = std::find(dataAllocations->begin(), iEnd, data); + if (i!=iEnd) + { + dataAllocations->erase(i); + } +} + +// ---------------------------------------------------------------------- +// Synchronization is left up to the user +// Unless this is called during shutdown, the critical section +// needs to be entered. +void PerThreadDataNamespace::_watchThreads() +{ + DataAllocations::iterator tiDest = dataAllocations->begin(); + DataAllocations::iterator tiSrc = tiDest; + DataAllocations::iterator tiEnd = dataAllocations->end(); + + while (tiSrc!=tiEnd) + { + Data *const data = *tiSrc; + const HANDLE h = data->watchHandle; + + if (h!=0 && WaitForSingleObject(h, 0)==WAIT_OBJECT_0) + { + _closeData(data); + _freeData(data); + } + else + { + *tiDest++=data; + } + ++tiSrc; + } + + if (tiSrc!=tiDest) + { + const int newSize = tiDest - dataAllocations->begin(); + dataAllocations->resize(newSize); + } +} + +// ---------------------------------------------------------------------- + +void PerThreadDataNamespace::_threadRemove(Data *data) +{ + //close the event used for file streaming reads + _closeData(data); + + _removeFromList(data); + + // free the memory + _freeData(data); +} + +// ---------------------------------------------------------------------- +/** + * Destroy the per-thread-data for a terminating thread. + * + * This routine should be called in a thread after the last usage of per-thread-data. + * + * @see PerThreadData::threadInstall() + */ + +void PerThreadData::threadRemove() +{ + DEBUG_FATAL(slot == BadSlot, ("not installed")); + DEBUG_FATAL(!TlsGetValue(slot), ("thread not installed")); + + // find our thread record and free the memory + criticalSection->enter(); + + _threadRemove(_getData()); + + // wipe the data in the thread slot + const BOOL result = TlsSetValue(slot, NULL); + UNREF(result); + DEBUG_FATAL(!result, ("TlsSetValue failed")); + + criticalSection->leave(); +} + +// ====================================================================== + +// ====================================================================== +// Determine if the per-thread-data is available for this thread +// +// Return value: +// +// True if the per-thread-data is installed correctly, false otherwise +// +// Remarks: +// +// This routine is not intended for general use; it should only be used by the ExitChain class. +// +// -TRF- looks like Win98 does not zero out a new TLS slot for +// threads existing at the time of slot creation. Thus, if you build a +// plugin that only initializes the engine the first time it is +// used, and other threads already exist in the app, those threads +// will contain bogus non-null data in the TLS slot. If the plugin really +// wants to do lazy initialization of the engine, it will need +// to handle calling PerThreadData::threadInstall() for all existing threads +// (except the thread that initialized the engine, which already +// has its PerThreadData::threadInstall() called). + +bool PerThreadData::isThreadInstalled() +{ + return (_getData(true) != NULL); +} + +// ---------------------------------------------------------------------- +/** + * Get the exit chain running flag value. + * + * This routine is not intended for general use; it should only be used by the ExitChain class. + * + * @return True if the exit chain is running, false otherwise. + * @see ExitChain::isRunning() + */ + +bool PerThreadData::getExitChainRunning() +{ + return _getData()->exitChainRunning; +} + +// ---------------------------------------------------------------------- +/** + * Set the exit chain running flag value. + * + * This routine is not intended for general use; it should only be used by the ExitChain class. + * + * @param newValue New value for the exit chain running flag + */ + +void PerThreadData::setExitChainRunning(bool newValue) +{ + _getData()->exitChainRunning = newValue; +} + +// ---------------------------------------------------------------------- +/** + * Get the exit chain fataling flag value. + * + * This routine is not intended for general use; it should only be used by the ExitChain class. + * + * @return True if the exit chain is fataling, false otherwise. + * @see ExitChain::isFataling() + */ + +bool PerThreadData::getExitChainFataling() +{ + return _getData()->exitChainFataling; +} + +// ---------------------------------------------------------------------- +/** + * Set the exit chain fataling flag value. + * + * This routine is not intended for general use; it should only be used by the ExitChain class. + * + * @param newValue New value for the exit chain fataling flag + */ + +void PerThreadData::setExitChainFataling(bool newValue) +{ + _getData()->exitChainFataling = newValue; +} + +// ---------------------------------------------------------------------- +/** + * Get the first entry for the exit chain. + * + * This routine is not intended for general use; it should only be used by the ExitChain class. + * This routine may return NULL. + * + * @return Pointer to the first entry on the exit chain + * @see ExitChain::isFataling() + */ + +ExitChain::Entry *PerThreadData::getExitChainFirstEntry() +{ + return _getData()->exitChainFirstEntry; +} + +// ---------------------------------------------------------------------- +/** + * Set the exit chain fataling flag value. + * + * This routine is not intended for general use; it should only be used by the ExitChain class. + * The parameter to this routine may be NULL. + * + * @param newValue New value for the exit chain first entry + */ + +void PerThreadData::setExitChainFirstEntry(ExitChain::Entry *newValue) +{ + _getData()->exitChainFirstEntry = newValue; +} + +// ---------------------------------------------------------------------- +/** + * Get the debug print flags. + * + * This routine is not intended for general use; it should only be used by the DebugPrint functions. + * + * @return Current value of the debug print flags + */ + +int PerThreadData::getDebugPrintFlags() +{ + return _getData()->debugPrintFlags; +} + +// ---------------------------------------------------------------------- +/** + * Set the debug print flags value. + * + * This routine is not intended for general use; it should only be used by the DebugPrint functions. + */ + +void PerThreadData::setDebugPrintFlags(int newValue) +{ + _getData()->debugPrintFlags = newValue; +} + +// ---------------------------------------------------------------------- + +Gate *PerThreadData::getFileStreamerReadGate() +{ + return _getData()->fileStreamerReadGate; +} + +// ====================================================================== diff --git a/engine/shared/library/sharedFoundation/src/win32/PerThreadData.h b/engine/shared/library/sharedFoundation/src/win32/PerThreadData.h new file mode 100755 index 00000000..e45a4170 --- /dev/null +++ b/engine/shared/library/sharedFoundation/src/win32/PerThreadData.h @@ -0,0 +1,57 @@ +// ====================================================================== +// +// PerThreadData.h +// +// Portions copyright 1998 Bootprint Entertainment +// Portions Copyright 2002 Sony Online Entertainment +// All Rights Reserved +// +// ====================================================================== + +#ifndef INCLUDED_PerThreadData_H +#define INCLUDED_PerThreadData_H + +// ====================================================================== + +class Gate; + +#include "sharedFoundation/ExitChain.h" + +// ====================================================================== + +// Provide thread local storage functionality. +// +// This class' purpose is to allow each thread to maintain some storage that is local and private to each thread. +// The system must be installed before use. Each thread that may use per-thread-data will also need to call the +// threadInstall() routine after creation and threadRemove() just before termination of the thread. + +class PerThreadData +{ +public: + + static void install(void); + static void remove(void); + + static void threadInstall(bool isNewThread = true); + static void threadRemove(void); + + static bool isThreadInstalled(void); + + static bool getExitChainRunning(void); + static void setExitChainRunning(bool newValue); + + static bool getExitChainFataling(void); + static void setExitChainFataling(bool newValue); + + static ExitChain::Entry *getExitChainFirstEntry(void); + static void setExitChainFirstEntry(ExitChain::Entry *newValue); + + static int getDebugPrintFlags(void); + static void setDebugPrintFlags(int newValue); + + static Gate *getFileStreamerReadGate(void); +}; + +// ====================================================================== + +#endif diff --git a/engine/shared/library/sharedFoundation/src/win32/PlatformGlue.cpp b/engine/shared/library/sharedFoundation/src/win32/PlatformGlue.cpp new file mode 100755 index 00000000..cf562e00 --- /dev/null +++ b/engine/shared/library/sharedFoundation/src/win32/PlatformGlue.cpp @@ -0,0 +1,124 @@ +// ====================================================================== +// +// PlatformGlue.cpp +// copyright (c) 2001 Sony Online Entertainment +// +// ====================================================================== + +#include "sharedFoundation/FirstSharedFoundation.h" +#include "sharedFoundation/PlatformGlue.h" + +#include +#include + +// ====================================================================== + +namespace +{ + +// ---------------------------------------------------------------------- + +class GmTimeSection +{ +public: + + GmTimeSection() + { + InitializeCriticalSection(&m_section); + } + + ~GmTimeSection() + { + DeleteCriticalSection(&m_section); + } + + void enter() + { + EnterCriticalSection(&m_section); + } + + void leave() + { + LeaveCriticalSection(&m_section); + } + +private: + CRITICAL_SECTION m_section; +}; + +// ---------------------------------------------------------------------- + +static GmTimeSection s_gmTimeSection; + +// ---------------------------------------------------------------------- + +} + +// ====================================================================== +// Tokenizing a string. +// Like strtok, except re-entrant. + +char *strsep(char **string, const char *delim) +{ + char *result = *string; + + // handle no string specified, or the end of the string + if (result == 0) + return 0; + + // skip leading delimiters + result = result + strspn(result, delim); + + // handle trailing delimiters + if (*result == '\0') + return 0; + + // look for the first delimiter + const int len = strcspn(result, delim); + if (result[len] == '\0') + { + // hit the end of the string + *string = 0; + } + else + { + // terminate the string and return the substring + result[len] = '\0'; + *string = result + len + 1; + } + + return result; +} + +// ---------------------------------------------------------------------- + +int snprintf(char *buffer, size_t count, const char *format, ...) +{ + va_list va; + + va_start(va, format); + const int result = _vsnprintf(buffer, count, format, va); + va_end(va); + + return result; +} + +// ---------------------------------------------------------------------- + +struct tm *gmtime_r(const time_t *timep, struct tm *result) +{ + s_gmTimeSection.enter(); + tm *t = gmtime(timep); + *result = *t; + s_gmTimeSection.leave(); + return result; +} + +// ---------------------------------------------------------------------- + +int finite(double value) +{ + return _finite(value); +} + +// ====================================================================== diff --git a/engine/shared/library/sharedFoundation/src/win32/PlatformGlue.h b/engine/shared/library/sharedFoundation/src/win32/PlatformGlue.h new file mode 100755 index 00000000..7eec7bb5 --- /dev/null +++ b/engine/shared/library/sharedFoundation/src/win32/PlatformGlue.h @@ -0,0 +1,32 @@ +// ====================================================================== +// +// PlatformGlue.h +// copyright (c) 2001 Sony Online Entertainment +// +// ====================================================================== + +#ifndef INCLUDED_PlatformGlue_H +#define INCLUDED_PlatformGlue_H + +// ====================================================================== + +#include + +// ====================================================================== + +char * strsep(char **string, const char *delim); +int snprintf(char *buffer, size_t count, const char *format, ...); +struct tm * gmtime_r(const time_t *timep, struct tm *result); +int finite(double value); + +//Format specifier for non-portable printf +#define UINT64_FORMAT_SPECIFIER "%I64u" +#define INT64_FORMAT_SPECIFIER "%I64i" + +//Constant definition macro for 64 bit values +#define UINT64_LITERAL(a) a ## ui64 +#define INT64_LITERAL(a) a ## i64 + +// ====================================================================== + +#endif diff --git a/engine/shared/library/sharedFoundation/src/win32/ProcessSpawner.cpp b/engine/shared/library/sharedFoundation/src/win32/ProcessSpawner.cpp new file mode 100755 index 00000000..987e9b64 --- /dev/null +++ b/engine/shared/library/sharedFoundation/src/win32/ProcessSpawner.cpp @@ -0,0 +1,310 @@ +// +// ProcessSpawner.cpp +// +//------------------------------------------------------------------- + +#include "sharedFoundation/FirstSharedFoundation.h" +#include "sharedFoundation/ProcessSpawner.h" + +#include "sharedFoundation/Os.h" + +#include + +ProcessSpawner::ProcessSpawner() +{ + m_asConsole=false; + hProcess=0; + hOutputRead=0; + hInputWrite=0; + currentLine=currentRead=readBuffer; +} + + +ProcessSpawner::~ProcessSpawner() +{ + if (hProcess) + { + CloseHandle(hProcess); + hProcess=0; + } + if (hOutputRead) + { + CloseHandle(hOutputRead); + hOutputRead=0; + } + if (hInputWrite) + { + CloseHandle(hInputWrite); + hInputWrite=0; + } +} + +bool ProcessSpawner::terminate(unsigned exitCode) +{ + if (!hProcess) + { + return false; + } + return TerminateProcess(hProcess, exitCode)!=0; +} + +bool ProcessSpawner::create(const char *commandLine, const char *startupFolder, bool asConsole) +{ + if (hProcess) + { + return false; + } + + if (!commandLine) + { + return false; + } + + if (!startupFolder) + { + startupFolder=Os::getProgramStartupDirectory(); + } + + m_asConsole=asConsole; + + STARTUPINFO sinfo; + memset(&sinfo, 0, sizeof(sinfo)); + sinfo.cb=sizeof(sinfo); + + HANDLE hOutputWrite=0; + HANDLE hErrorWrite=0; + HANDLE hInputRead=0; + + if (asConsole) + { + SECURITY_ATTRIBUTES sa; + sa.nLength=sizeof(sa); + sa.lpSecurityDescriptor=0; + sa.bInheritHandle=true; + + // ----------------------------------------------------- + + // Create the child output pipe. + HANDLE hOutputReadTmp; + CreatePipe(&hOutputReadTmp,&hOutputWrite,&sa,0); + + // Create a duplicate of the output write handle for the std error + // write handle. This is necessary in case the child application + // closes one of its std output handles. + DuplicateHandle( + GetCurrentProcess(), hOutputWrite, + GetCurrentProcess(),&hErrorWrite, + 0, + TRUE,DUPLICATE_SAME_ACCESS + ); + + + // Create the child input pipe. + HANDLE hInputWriteTmp; + CreatePipe(&hInputRead,&hInputWriteTmp,&sa,0); + + // Create new output read handle and the input write handles. Set + // the Properties to FALSE. Otherwise, the child inherits the + // properties and, as a result, non-closeable handles to the pipes + // are created. + DuplicateHandle( + GetCurrentProcess(), hOutputReadTmp, + GetCurrentProcess(), &hOutputRead, // Address of new handle. + 0, FALSE, // Make it uninheritable. + DUPLICATE_SAME_ACCESS + ); + + DuplicateHandle( + GetCurrentProcess(), hInputWriteTmp, + GetCurrentProcess(), &hInputWrite, // Address of new handle. + 0,FALSE, // Make it uninheritable. + DUPLICATE_SAME_ACCESS + ); + + + // Close inheritable copies of the handles you do not want to be + // inherited. + CloseHandle(hOutputReadTmp); hOutputReadTmp=0; + CloseHandle(hInputWriteTmp); hInputWriteTmp=0; + + sinfo.dwFlags|=(STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW); + sinfo.hStdError=hErrorWrite; + sinfo.hStdInput=hInputRead; + sinfo.hStdOutput=hOutputWrite; + sinfo.wShowWindow = SW_HIDE; + } + + PROCESS_INFORMATION pinfo; + BOOL result = CreateProcess( + 0, + (char *)commandLine, + 0, + 0, + TRUE, + CREATE_NEW_CONSOLE, + 0, + startupFolder, + &sinfo, + &pinfo + ); + + if (asConsole) + { + // Close pipe handles (do not continue to modify the parent). + // You need to make sure that no handles to the write end of the + // output pipe are maintained in this process or else the pipe will + // not close when the child process exits and the ReadFile will hang. + CloseHandle(hOutputWrite); hOutputWrite=0; + CloseHandle(hErrorWrite); hErrorWrite=0; + CloseHandle(hInputRead); hInputRead=0; + } + + if (result) + { + CloseHandle(pinfo.hThread); + hProcess=pinfo.hProcess; + return true; + } + else + { + // Failed to launch turf + hProcess=0; + return false; + } +} + +bool ProcessSpawner::isFinished(unsigned waitTime) +{ + if (!hProcess) + { + return true; + } + + DWORD waitResult = WaitForSingleObject(hProcess, waitTime); + + return waitResult==WAIT_OBJECT_0; +} + +bool ProcessSpawner::getExitCode(unsigned &o_code) +{ + if (!hProcess) + { + return false; + } + + DWORD exitCode; + BOOL result = GetExitCodeProcess(hProcess, &exitCode); + if (result) + { + o_code=exitCode; + return true; + } + else + { + return false; + } +} + +bool ProcessSpawner::_returnExistingLine(char *buffer, const int bufferSize) +{ + const char *const bufferStop = buffer + bufferSize; + char *iter = currentLine; + while (iter!=currentRead) + { + if (buffer==bufferStop) + { + currentLine=iter; + return true; + } + + if (*iter=='\n') + { + *buffer++=0; + _stepIter(iter); + currentLine=iter; + return true; + } + else + { + *buffer++=*iter; + _stepIter(iter); + } + } + + return false; +} + +bool ProcessSpawner::getOutputString(char *buffer, int bufferSize) +{ + if (_returnExistingLine(buffer, bufferSize)) + { + return true; + } + + // ---------------------------------------------- + + if (!hOutputRead) + { + return false; + } + + DWORD dwAvail = 0; + if (!::PeekNamedPipe(hOutputRead, NULL, 0, NULL, &dwAvail, NULL)) + { + // ERROR + return false; + } + + if (!dwAvail) + { + return false; + } + + DWORD dwRead; + + if (currentRead >= currentLine) + { + const unsigned bufferAvailable = sizeof(readBuffer) - (currentRead - readBuffer); + unsigned toRead = dwAvail; + if (toRead > bufferAvailable) + { + toRead=bufferAvailable; + } + + dwRead=0; + if (!::ReadFile(hOutputRead, currentRead, min(bufferAvailable, dwAvail), &dwRead, NULL) || !dwRead) + { + return false; + } + dwAvail-=dwRead; + currentRead+=dwRead; + if (currentRead==readBuffer+sizeof(readBuffer)) + { + currentRead=readBuffer; + } + } + + if (dwAvail>0) + { + const unsigned bufferAvailable = currentLine - currentRead - 1; + if (bufferAvailable) + { + unsigned toRead = dwAvail; + if (toRead > bufferAvailable) + { + toRead=bufferAvailable; + } + + dwRead=0; + if (!::ReadFile(hOutputRead, currentRead, min(bufferAvailable, dwAvail), &dwRead, NULL) || !dwRead) + { + return false; + } + currentRead+=dwRead; + + DEBUG_FATAL(currentRead>=currentLine, ("")); + } + } + + return _returnExistingLine(buffer, bufferSize); +} diff --git a/engine/shared/library/sharedFoundation/src/win32/ProcessSpawner.h b/engine/shared/library/sharedFoundation/src/win32/ProcessSpawner.h new file mode 100755 index 00000000..ed64750f --- /dev/null +++ b/engine/shared/library/sharedFoundation/src/win32/ProcessSpawner.h @@ -0,0 +1,43 @@ +#ifndef INCLUDED_ProcessSpawner_H +#define INCLUDED_ProcessSpawner_H + +class ProcessSpawner +{ +public: + + ProcessSpawner(); + ~ProcessSpawner(); + + bool create(const char *commandLine, const char *startupFolder=0, bool asConsole=true); + + bool terminate(unsigned exitCode=0); + bool isFinished(unsigned waitTime=0); + bool getExitCode(unsigned &o_code); + + bool getOutputString(char *buffer, int bufferSize); + +protected: + + bool _returnExistingLine(char *buffer, int bufferSize); + + void _stepIter(char *&i) + { + if (i==readBuffer+sizeof(readBuffer)-1) + { + i=readBuffer; + } + else + { + i++; + } + } + + HANDLE hProcess; + HANDLE hOutputRead, hInputWrite; + bool m_asConsole; + char *currentLine, *currentRead, readBuffer[4096]; +}; + +#endif + + diff --git a/engine/shared/library/sharedFoundation/src/win32/RegistryKey.cpp b/engine/shared/library/sharedFoundation/src/win32/RegistryKey.cpp new file mode 100755 index 00000000..a29d0db5 --- /dev/null +++ b/engine/shared/library/sharedFoundation/src/win32/RegistryKey.cpp @@ -0,0 +1,918 @@ +// ====================================================================== +// +// RegistryKey.cpp +// Todd Fiala +// +// copyright 1998 Bootprint Entertainment +// +// ====================================================================== + +#include "sharedFoundation/FirstSharedFoundation.h" +#include "sharedFoundation/RegistryKey.h" + +#include "sharedFoundation/ExitChain.h" +#include "sharedFoundation/ConfigFile.h" + +#if USE_REGISTRY_EXECUTION_STATISTICS +#include +#include +#endif + +// ====================================================================== + +// keyname for config file parameter containing relative registry path +// for the product + +const char * const RegistryKey::PRODUCT_REGISTRY_PATH_KEYNAME = "ProductRegistryPath"; +const char * const RegistryKey::DEFAULT_PRODUCT_REGISTRY_PATH = "Software\\Sony Online Entertainment\\Default"; + +#if USE_REGISTRY_EXECUTION_STATISTICS +const char * const RegistryKey::STATISTICS_KEYNAME = "Statistics"; +const char * const RegistryKey::STAT_EXEC_STARTED_COUNT_VALUENAME = "StartedExecutions"; +const char * const RegistryKey::STAT_EXEC_INCOMPLETE_COUNT_VALUENAME = "IncompleteExecutions"; +const char * const RegistryKey::STAT_TIME_AVERAGE_VALUENAME = "AverageClockTime"; +const char * const RegistryKey::STAT_TIME_MIN_VALUENAME = "MinimumClockTime"; +const char * const RegistryKey::STAT_TIME_MAX_VALUENAME = "MaximumClockTime"; +const char * const RegistryKey::STAT_TIME_START_VALUENAME = "StartClockTime"; + +#endif + +bool RegistryKey::installed; +bool RegistryKey::setProductKeyPathFromConfig; + +RegistryKey *RegistryKey::usersKey; +RegistryKey *RegistryKey::currentUserKey; +RegistryKey *RegistryKey::classRootKey; +RegistryKey *RegistryKey::localMachineKey; +RegistryKey *RegistryKey::productUserKey; +RegistryKey *RegistryKey::productMachineKey; + +// ====================================================================== +// construct a RegistryKey instance +// +// Remarks: +// This function does not create the underlying registry object. It +// solely attaches such a registry object with a RegistryKey class +// instance. + +RegistryKey::RegistryKey( + HKEY newKeyHandle, // [IN] handle of existing registry key + bool newCloseKeyOnDestroy // [IN] true if RegCloseKey() should be called on key at destruction time + ) : + keyHandle(newKeyHandle), + closeKeyOnDestroy(newCloseKeyOnDestroy) +{ + // -qq- don't know which of these indicates an invalid handle, so check for both + DEBUG_FATAL(!newKeyHandle, ("null newKeyHandle arg")); + DEBUG_FATAL(newKeyHandle == INVALID_HANDLE_VALUE, ("newKeyHandle arg is an invalid handle")); +} + +// ---------------------------------------------------------------------- +/** + * destroy a RegistryKey instance. + */ + +RegistryKey::~RegistryKey(void) +{ + DEBUG_FATAL(!keyHandle, ("null keyHandle")); + + if (closeKeyOnDestroy) + { + const LONG result = RegCloseKey(keyHandle); + UNREF(result); + DEBUG_FATAL(result != ERROR_SUCCESS, ("failed to close registry key, error = %ld\n", result)); + } + keyHandle = 0; +} + +// ---------------------------------------------------------------------- +/** + * enumerate all child subkeys of the current key. + * + * @param context [IN] user-specified context variable passed to callback + * @param callback [IN] function to call for each subkey enumerated + * @see EnumerateKeyCallback, enumerateValues() + */ + +void RegistryKey::enumerateSubkeys(void *context, EnumerateKeyCallback callback) const +{ + const size_t MAX_NAME_LENGTH = 256; + + LONG result; + FILETIME lastModifiedFileTime; + char subkeyName[MAX_NAME_LENGTH]; + DWORD subkeyNameLength; + DWORD index; + + DEBUG_FATAL(!callback, ("null callback arg\n")); + + for ( + index = 0, subkeyNameLength = MAX_NAME_LENGTH; + ERROR_SUCCESS == (result = RegEnumKeyEx(keyHandle, index, subkeyName, &subkeyNameLength, 0, 0, 0, &lastModifiedFileTime)); + ++index, subkeyNameLength = MAX_NAME_LENGTH + ) + { + bool continueEnum = callback(context, subkeyName, &lastModifiedFileTime); + if (!continueEnum) break; + } + + // ensure we finished enumeration cleanly + FATAL( + (result != ERROR_SUCCESS) && (result != ERROR_NO_MORE_ITEMS), + ("failed to enumerate registry subkeys, error = %ld\n", result)); +} + +// ---------------------------------------------------------------------- +/** + * open and return a subkey under this RegistryKey instance. + * + * The function will fail if the specified subkey does not exist. + * + * @param subkeyName [IN] registry path for subkey to open, relative to this RegistryKey instance + * @param accessFlags [IN] flags indicating access granted to the returned RegistryKey + * @return This function returns a RegistryKey instance for the specified + * subkey. + */ + +RegistryKey *RegistryKey::openSubkey(const char *subkeyName, uint32 accessFlags) const +{ + REGSAM samDesired = 0; + LONG result; + HKEY newKey = 0; + + DEBUG_FATAL(!keyHandle, ("null keyHandle")); + DEBUG_FATAL(!subkeyName, ("null subkeyName arg")); + DEBUG_FATAL(!strlen(subkeyName), ("zero-length subkeyName arg")); + + // configure security access desired + if (accessFlags & AF_READ) + samDesired |= KEY_READ; + if (accessFlags & AF_WRITE) + samDesired |= KEY_WRITE; + + // open the key + result = RegOpenKeyEx(keyHandle, subkeyName, 0, samDesired, &newKey); + FATAL(result != ERROR_SUCCESS, ("failed to open registry subkey \"%s\", error = %ld\n", subkeyName, result)); + + // Create the RegistryKey object. Assume the key must be closed upon + // destruction. + return new RegistryKey(newKey, true); +} + +// ---------------------------------------------------------------------- +/** + * create and return a subkey under this RegistryKey instance. + * + * The function will succeed even if the specified subkey + * already exists. + * + * @return This function returns a RegistryKey instance for the specified + * subkey. + */ + +RegistryKey *RegistryKey::createSubkey(const char *subkeyName, uint32 accessFlags) const +{ + REGSAM samDesired = 0; + LONG result; + HKEY newKey = 0; + DWORD disposition; + + DEBUG_FATAL(!keyHandle, ("null keyHandle")); + DEBUG_FATAL(!subkeyName, ("null subkeyName arg")); + DEBUG_FATAL(!strlen(subkeyName), ("zero-length subkeyName arg")); + + // configure security access desired + if (accessFlags & AF_READ) + samDesired |= KEY_READ; + if (accessFlags & AF_WRITE) + samDesired |= KEY_WRITE; + + // open the key + result = RegCreateKeyEx( + keyHandle, + subkeyName, + 0, // reserved + const_cast(""), // class + REG_OPTION_NON_VOLATILE, // options + samDesired, + NULL, // security + &newKey, + &disposition); + FATAL(result != ERROR_SUCCESS, ("failed to create registry subkey \"%s\", error = %ld\n", subkeyName, result)); + + // Create the RegistryKey object. Assume the key must be closed upon + // destruction. + return new RegistryKey(newKey, true); +} + +// ---------------------------------------------------------------------- +/** + * delete a subkey relative to this RegistryKey instance. + * + * Under Windows NT, deleting a key that has subkeys is considered an + * error. Therefore, the client should ensure the target key for + * deletion does not have any subkeys. (Under Windows 9X, deletion of + * the target registry key will automatically delete all subkeys + * underneath the target key.) + */ + +void RegistryKey::deleteSubkey(const char *subkeyName) +{ + DEBUG_FATAL(!keyHandle, ("null keyHandle")); + DEBUG_FATAL(!subkeyName, ("null subkeyName arg")); + DEBUG_FATAL(!strlen(subkeyName), ("zero-length subkeyName arg")); + + IGNORE_RETURN(RegDeleteKey(keyHandle, subkeyName)); +} + +// ---------------------------------------------------------------------- +/** + * test for the existence of a subkey under this RegistryKey instance. + * + * @param subkeyName [IN] registry path for subkey to open, relative to this RegistryKey instance + */ + +bool RegistryKey::subKeyExists(const char *subkeyName) +{ + REGSAM samDesired = KEY_READ; + LONG result; + HKEY newKey = 0; + + DEBUG_FATAL(!keyHandle, ("null keyHandle")); + DEBUG_FATAL(!subkeyName, ("null subkeyName arg")); + DEBUG_FATAL(!strlen(subkeyName), ("zero-length subkeyName arg")); + + // open the key + result = RegOpenKeyEx(keyHandle, subkeyName, 0, samDesired, &newKey); + return (result == ERROR_SUCCESS); +} + +// ---------------------------------------------------------------------- +/** + * enumerate all values under the current key. + * + * @param context [IN] user-specified context variable passed to callback + * @param callback [IN] function to call for each value enumerated + * @see EnumerateValueCallback, enumerateSubkeys() + */ + +void RegistryKey::enumerateValues(void *context, EnumerateValueCallback callback) const +{ + const size_t MAX_NAME_LENGTH = 256; + + LONG result; + char valueName[MAX_NAME_LENGTH]; + DWORD valueNameLength; + DWORD index; + DWORD dataSize; + DWORD valueType; + + DEBUG_FATAL(!callback, ("null callback arg\n")); + + for ( + index = 0, valueNameLength = MAX_NAME_LENGTH, dataSize = 0; + ERROR_SUCCESS == (result = RegEnumValue(keyHandle, index, valueName, &valueNameLength, 0, &valueType, 0, &dataSize)); + ++index, valueNameLength = MAX_NAME_LENGTH, dataSize = 0 + ) + { + bool continueEnum = callback(context, valueName, static_cast(dataSize), valueType); + if (!continueEnum) break; + } + + // ensure we finished enumeration cleanly + FATAL( + (result != ERROR_SUCCESS) && (result != ERROR_NO_MORE_ITEMS), + ("failed to enumerate registry values, error = %ld\n", result)); +} + +// ---------------------------------------------------------------------- +/** + * query if a value exists and how many bytes that value occupies. + * + * The client does can pass null for the valueSize and/or valueType + * parameter if that information is not desired. The value returned + * within the valueSize and valueType parameter is only valid + * if the doesExist parameter is set to true upon function return. + * The value of the valueType parameter is one of the Windows-defined + * REG_* constants provided for use with the Win32 Reg* registry + * API. Common values are REG_BINARY (binary data), REG_DWORD + * (unsigned integral type data) and REG_SZ (C-style zero-terminated + * strings). Consult the Win32 documentation for RegGetValueEx() + * for a description of all the type constants. + * + * @param valueName [IN] name of the value to query + * @param doesExist [OUT] true if value exists under this key, false otherwise + * @param valueSize [OUT] number of bytes occupied by value's data + * @param valueType [OUT] type flag for registry value (see REG_* in RegSetValueEx()) + */ + +void RegistryKey::getValueInfo(const char *valueName, bool *doesExist, uint32 *valueSize, DWORD *valueType) const +{ + LONG result; + DWORD dwSize = 0; + + DEBUG_FATAL(!keyHandle, ("null keyHandle")); + DEBUG_FATAL(!valueName, ("null valueName arg")); + DEBUG_FATAL(!doesExist, ("null doesExist arg")); + DEBUG_FATAL(!strlen(valueName), ("zero-length valueName arg")); + + // get information on the value + result = RegQueryValueEx(keyHandle, valueName, 0, valueType, 0, &dwSize); + + // assume a query failure indicates the value was not found + *doesExist = (result == ERROR_SUCCESS); + if (valueSize) + *valueSize = static_cast(dwSize); +} + +// ---------------------------------------------------------------------- +/** + * set the data for this key's value. + * + * The value of the valueType parameter is one of the Windows-defined + * REG_* constants provided for use with the Win32 Reg* registry + * API. Common values are REG_BINARY (binary data), REG_DWORD + * (unsigned integral type data) and REG_SZ (C-style zero-terminated + * strings). Consult the Win32 documentation for RegGetValueEx() + * for a description of all the type constants. + * + * @param valueName [IN] name of value under which data will be stored + * @param dataPtr [IN] pointer to buffer containing value's data + * @param dataSize [IN] # bytes to store + * @param valueType [IN] type field for value (indicates nature of data stored with value) + */ + +void RegistryKey::setValue(const char *valueName, const void *dataPtr, uint32 dataSize, DWORD valueType) +{ + LONG result; + + DEBUG_FATAL(!keyHandle, ("null keyHandle")); + DEBUG_FATAL(!valueName, ("null valueName arg")); + DEBUG_FATAL(!strlen(valueName), ("zero-length valueName arg")); + DEBUG_FATAL(!dataPtr, ("null dataPtr arg")); + + // get information on the value + result = RegSetValueEx(keyHandle, valueName, 0, valueType, static_cast(dataPtr), static_cast(dataSize)); + FATAL(result != ERROR_SUCCESS, ("failed to set registry value \"%s\", error = %ld\n", valueName, result)); +} + +// ---------------------------------------------------------------------- +/** + * retrieve the data for the this key's value. + * + * The valueType and/or the valueDataSize parameter may be set + * to null if the client doesn't need this information. + * The value of the valueType parameter is one of the Windows-defined + * REG_* constants provided for use with the Win32 Reg* registry + * API. Common values are REG_BINARY (binary data), REG_DWORD + * (unsigned integral type data) and REG_SZ (C-style zero-terminated + * strings). Consult the Win32 documentation for RegGetValueEx() + * for a description of all the type constants. + * + * @param valueName [IN] the name of the value to retrieve + * @param dataPtr [OUT] the buffer where the value's data will be stored + * @param maxDataSize [IN] size of the data buffer in bytes + * @param valueDataSize [OUT] number of bytes retrieved from the named value + * @param valueType [OUT] type field for value's data (see REG_* codes in RegSetValueEx) + */ + +void RegistryKey::getValue(const char *valueName, void *dataPtr, uint32 maxDataSize, uint32 *valueDataSize, DWORD *valueType) const +{ + LONG result; + DWORD dwSize = maxDataSize; + + DEBUG_FATAL(!keyHandle, ("null keyHandle")); + DEBUG_FATAL(!valueName, ("null valueName arg")); + DEBUG_FATAL(!strlen(valueName), ("zero-length valueName arg")); + + // get information on the value + result = RegQueryValueEx(keyHandle, valueName, 0, valueType, static_cast(dataPtr), &dwSize); + FATAL(result != ERROR_SUCCESS, ("failed to read registry value \"%s\", error = %ld\n", valueName, result)); + + // assume a query failure indicates the value was not found + if (valueDataSize) + *valueDataSize = static_cast(dwSize); +} + +// ---------------------------------------------------------------------- +/** + * retrieve a string from of this key's values, returning a default string + * if the value doesn't exist. + * + * The defaultValue arg is required, must be non-null. + * + * If the specified value exists but is not of type REG_SZ, the default + * string will be returned. + * + * This routine will DEBUG_FATAL on null args, even if optional is set. + * Optional only controls whether a FATAL occurs if there is an issue + * retrieving the value. + * + * @param valueName [IN] name of the string value to retrieve + * @param defaultValue [IN] string to return if registry key does not contain thev value + * @param dest [OUT] buffer for returned string + * @param destSize [IN] max number of bytes (including terminating null) that can be placed in dest + * @param optional [IN] if set, the function will return false if there is a problem retrieving the value. otherwise, a DEBUG_FATAL will occur + */ + +bool RegistryKey::getStringValue(const char *valueName, const char *defaultValue, char *dest, DWORD destSize, bool optional) +{ + DEBUG_FATAL(!defaultValue, ("null defaultValue arg")); + DEBUG_FATAL(!dest, ("null dest arg")); + + bool doesExist; + DWORD valueType; + DWORD valueSize; + + // clear out string + memset(dest, 0, static_cast(destSize)); + + // get info on the value + getValueInfo (valueName, &doesExist, &valueSize, &valueType); + if (!doesExist || (valueType != REG_SZ)) + strncpy(dest, defaultValue, destSize-1); + else + { + // value exists and is a string, retrieve it + getValue (valueName, dest, destSize, &valueSize); + if (!valueSize) + { + FATAL(!optional, ("failed to get registry data for key %s\n", valueName)); + return false; + } + + // terminate the string + dest [valueSize] = 0; + } + return true; +} + + +// ---------------------------------------------------------------------- +/** + * delete a value from this registry key. + */ + +void RegistryKey::deleteValue(const char *valueName) +{ + LONG result; + + DEBUG_FATAL(!keyHandle, ("null keyHandle")); + DEBUG_FATAL(!valueName, ("null valueName arg")); + DEBUG_FATAL(!strlen(valueName), ("zero-length valueName arg")); + + result = RegDeleteValue(keyHandle, valueName); + FATAL(result != ERROR_SUCCESS, ("failed to delete registry value \"%s\", error = %ld\n", valueName, result)); +} + +#if USE_REGISTRY_EXECUTION_STATISTICS + +// ---------------------------------------------------------------------- +/** + * updates beginning-of-execution statistics using the values under a + * given key. + * + * Call this function at the beginning of execution of the code + * for which statistics are desired. At the end of execution, + * call updateShutdownKey() to finish generating statistics. + * This function should only be called once per execution, + * and should be followed by a call to updateShutdownKey(). + * If the latter is not called, the next call to updateStartupKey() + * will assume the application terminated abnormally before + * proper shutdown could occur. + */ + +void RegistryKey::updateStartupKey(RegistryKey *key) +{ + bool valueExist; + uint32 valueSize; + DWORD valueType; + DWORD execStartedCount = 0; + clock_t startTime = clock(); + + DEBUG_FATAL(!key, ("null key arg\n")); + + // handle improper shutdown of last run + key->getValueInfo(STAT_TIME_START_VALUENAME, &valueExist); + if (valueExist) + { + // appears the product did not run to completion on last run. + // increment the incomplete run counts + + DWORD execIncompleteCount = 0; + + key->getValueInfo(STAT_EXEC_INCOMPLETE_COUNT_VALUENAME, &valueExist); + if (valueExist) + { + key->getValue(STAT_EXEC_INCOMPLETE_COUNT_VALUENAME, &execIncompleteCount, sizeof(DWORD), &valueSize, &valueType); + DEBUG_FATAL((valueType != REG_DWORD) || (valueSize != sizeof(DWORD)), ("%s key not DWORD type as expected\n", STAT_EXEC_INCOMPLETE_COUNT_VALUENAME)); + } + ++execIncompleteCount; + key->setValue(STAT_EXEC_INCOMPLETE_COUNT_VALUENAME, &execIncompleteCount, sizeof(DWORD), REG_DWORD); + } + + // get the start count + key->getValueInfo(STAT_EXEC_STARTED_COUNT_VALUENAME, &valueExist); + if (valueExist) + { + key->getValue(STAT_EXEC_STARTED_COUNT_VALUENAME, &execStartedCount, sizeof(DWORD), &valueSize, &valueType); + DEBUG_FATAL((valueType != REG_DWORD) || (valueSize != sizeof(DWORD)), ("%s key not DWORD type as expected\n", STAT_EXEC_STARTED_COUNT_VALUENAME)); + } + ++execStartedCount; + + // save the data + key->setValue(STAT_EXEC_STARTED_COUNT_VALUENAME, &execStartedCount, sizeof(DWORD), REG_DWORD); + key->setValue(STAT_TIME_START_VALUENAME, &startTime, sizeof(clock_t)); +} + +#endif + + +#if USE_REGISTRY_EXECUTION_STATISTICS + +// ---------------------------------------------------------------------- +/** + * updates end-of-execution statistics using the values under a given key. + * + * This function should only be called after updateStartupKey() + * has been called on the same key. After this call returns, + * this function should not be called again until another + * call to updateStartupKey() is made. + */ + +void RegistryKey::updateShutdownKey(RegistryKey *key) +{ + bool valueExist; + uint32 valueSize; + DWORD valueType; + clock_t minTime; + clock_t maxTime; + clock_t averageTime = 0; + clock_t startTime; + clock_t stopTime = clock(); + clock_t runTime; + DWORD startExecCount; + DWORD incompleteExecCount = 0; + DWORD completeExecCount; + real averageFraction; + + DEBUG_FATAL(!key, ("null key arg\n")); + + // find the number of complete execution runs of the product + key->getValue(STAT_EXEC_STARTED_COUNT_VALUENAME, &startExecCount, sizeof(DWORD), &valueSize, &valueType); + DEBUG_FATAL((valueSize != sizeof(DWORD)) || (valueType != REG_DWORD), ("invalid start count statistic registry value\n")); + + key->getValueInfo(STAT_EXEC_INCOMPLETE_COUNT_VALUENAME, &valueExist); + if (valueExist) + { + key->getValue(STAT_EXEC_INCOMPLETE_COUNT_VALUENAME, &incompleteExecCount, sizeof(DWORD), &valueSize, &valueType); + DEBUG_FATAL((valueType != REG_DWORD) || (valueSize != sizeof(DWORD)), ("%s expected to be DWORD type, was %lu instead\n", STAT_EXEC_INCOMPLETE_COUNT_VALUENAME, valueType)); + } + completeExecCount = startExecCount - incompleteExecCount; + + // retrieve the start time + key->getValue(STAT_TIME_START_VALUENAME, &startTime, sizeof(clock_t), &valueSize, &valueType); + DEBUG_FATAL((valueSize != sizeof(clock_t)) || (valueType != REG_BINARY), ("invalid start time statistic registry value\n")); + + // -qq- we don't handle clock wraparound + runTime = stopTime - startTime; + minTime = runTime; + maxTime = runTime; + + // calculate average time + key->getValueInfo(STAT_TIME_AVERAGE_VALUENAME, &valueExist); + if (valueExist) + { + key->getValue(STAT_TIME_AVERAGE_VALUENAME, &averageTime, sizeof(clock_t), &valueSize, &valueType); + DEBUG_FATAL((valueSize != sizeof(clock_t)) || (valueType != REG_BINARY), ("invalid average exec time statistic registry value\n")); + } + averageFraction = CONST_REAL(1.0 / completeExecCount); + averageTime = static_cast(( CONST_REAL(averageTime) * (completeExecCount-1) + runTime) * averageFraction); + if (averageTime < 1) + averageTime = 1; + + // check min exec time + key->getValueInfo(STAT_TIME_MIN_VALUENAME, &valueExist); + if (valueExist) + { + clock_t testValue; + key->getValue(STAT_TIME_MIN_VALUENAME, &testValue, sizeof(clock_t), &valueSize, &valueType); + DEBUG_FATAL((valueSize != sizeof(clock_t)) || (valueType != REG_BINARY), ("invalid min exec time statistic registry value\n")); + if (testValue < minTime) + minTime = testValue; + } + + // check for max exec time + key->getValueInfo(STAT_TIME_MAX_VALUENAME, &valueExist); + if (valueExist) + { + clock_t testValue; + key->getValue(STAT_TIME_MAX_VALUENAME, &testValue, sizeof(clock_t), &valueSize, &valueType); + DEBUG_FATAL((valueSize != sizeof(clock_t)) || (valueType != REG_BINARY), ("invalid max exec time statistic registry value\n")); + if (testValue > maxTime) + maxTime = testValue; + } + + // save the data + key->setValue(STAT_TIME_AVERAGE_VALUENAME, &averageTime, sizeof(clock_t)); + key->setValue(STAT_TIME_MIN_VALUENAME, &minTime, sizeof(clock_t)); + key->setValue(STAT_TIME_MAX_VALUENAME, &maxTime, sizeof(clock_t)); + + // delete the start time value + key->deleteValue(STAT_TIME_START_VALUENAME); +} + +#endif + + +#if USE_REGISTRY_EXECUTION_STATISTICS + +// ---------------------------------------------------------------------- +/** + * An EnumValueCallback that prints each value name, type and size + * + * @param valueName name of value + * @param valueSize size of value in bytes + * @param valueTye type of value + */ + +bool RegistryKey::enumValueInfoPrint( + void*, // unused user context + const char *valueName, + uint32 valueSize, + DWORD valueType + ) +{ + char *valueTypeStr; + char buffer[64]; + + switch (valueType) + { + case REG_BINARY: + valueTypeStr = "REG_BINARY"; + break; + case REG_DWORD: + valueTypeStr = "REG_DWORD [little endian]"; + break; + case REG_DWORD_BIG_ENDIAN: + valueTypeStr = "REG_DWORD_BIG_ENDIAN"; + break; + case REG_EXPAND_SZ: + valueTypeStr = "REG_EXPAND_SZ"; + break; + case REG_NONE: + valueTypeStr = "REG_NONE"; + break; + case REG_SZ: + valueTypeStr = "REG_SZ"; + break; + default: + valueTypeStr = buffer; + sprintf(buffer, "", valueType); + break; + } + + DEBUG_PRINT_LOG(true, (" Key: \"%s\", %s, %u bytes\n", valueName, valueTypeStr, valueSize)); + + // continue enumerating + return true; +} + +#endif + + +#if USE_REGISTRY_EXECUTION_STATISTICS + +// ---------------------------------------------------------------------- +/** + * Update per-startup registry values. + * + * This routine is used primarily to test registry read/write + * functionality; however, it does provide statistics related + * to game usage. These include the following statistics on + * a per-game and per-machine basis: + * # times product was executed + * average real-time duration of execution + * minimum execution time + * maximum execution time + * # times product failed to execute to completion + * (i.e. updateRegistryShutdown() never executed---hard crash, stop debugging) + */ + +void RegistryKey::updateStartupStatistics(void) +{ + DEBUG_FATAL(!productUserKey, ("null productUserKey\n")); + DEBUG_FATAL(!productMachineKey, ("null productMachineKey\n")); + + // create required keys + RegistryKey *userStatKey = productUserKey->createSubkey(STATISTICS_KEYNAME); + RegistryKey *machineStatKey = productMachineKey->createSubkey(STATISTICS_KEYNAME); + + FATAL(!userStatKey, ("failed to create user statistics key")); + FATAL(!machineStatKey, ("failed to create machine statistics key")); + + // handle machine stat key + +#if 1 + // print existing machine stat keys + DEBUG_PRINT_LOG(true, ("BEGIN machine stat key enumeration:\n")); + machineStatKey->enumerateValues(0, enumValueInfoPrint); + DEBUG_PRINT_LOG(true, ("END machine stat key enumeration:\n")); +#endif + + updateStartupKey(machineStatKey); + + + // handle user stat key + +#if 1 + // print existing user stat keys + DEBUG_PRINT_LOG(true, ("BEGIN user stat key enumeration:\n")); + userStatKey->enumerateValues(0, enumValueInfoPrint); + DEBUG_PRINT_LOG(true, ("END user stat key enumeration:\n")); +#endif + + updateStartupKey(userStatKey); + + // cleanup + delete machineStatKey; + delete userStatKey; +} + +#endif + + +#if USE_REGISTRY_EXECUTION_STATISTICS + +// ---------------------------------------------------------------------- +/** + * Update per-shutdown registry values. + * + * @see updateRegistryStartup() + */ + +void RegistryKey::updateShutdownStatistics(void) +{ + DEBUG_FATAL(!productUserKey, ("null productUserKey\n")); + DEBUG_FATAL(!productMachineKey, ("null productMachineKey\n")); + + // create required keys + RegistryKey *userStatKey = productUserKey->createSubkey(STATISTICS_KEYNAME); + RegistryKey *machineStatKey = productMachineKey->createSubkey(STATISTICS_KEYNAME); + + FATAL(!userStatKey, ("failed to create user statistics key")); + FATAL(!machineStatKey, ("failed to create machine statistics key")); + + // handle machine stat key + updateShutdownKey(machineStatKey); + + // handle user stat key + updateShutdownKey(userStatKey); + + // cleanup + delete machineStatKey; + delete userStatKey; +} + +#endif + +// ---------------------------------------------------------------------- +/** + * install the RegistryKey class. + * + * After installation, the following predefined keys are available: + * + * usersKey: HKEY_USERS + * currentUserKey: HKEY_CURRENT_USER + * classRootKey: HKEY_CLASSES_ROOT + * localMachineKey: HKEY_LOCAL_MACHINE + * productUserKey: HKEY_CURENT_USER\ + * productMachineKey: HKEY_LOCAL_MACHINE\ + * + * The client is free to create any other keys required. + * + * The product relative registry path is determined by the first of the + * following methods that succeed: + * 1. If the config file key "ProductRegistryPath" is set, that value is + * used for the relative path. If the product relative path is set + * in this manner, the client's attempt to change the product relative + * path via the setProductKey() function will silently fail. + * 2. If the productKeyRelativePath parameter is a non-null positive length + * string, that value is used as the product keys' relative path. + * 3. The default value DEFAULT_PRODUCT_REGISTRY_PATH ("Software\\Bootprint\\Default") + * is used. + * + * RegistryKey::remove() is added to the exit chain. + * + * Do not delete any of the predefined registry keys. + * + * @param productKeyRelativePath [IN] relative registry path for the product keys + * @see setProductKeyPath() + */ + +void RegistryKey::install(const char *productKeyRelativePath) +{ + UNREF(productKeyRelativePath); + char *useRegistryPath = 0; + + DEBUG_FATAL(installed, ("attempted to install RegistryKey when already installed\n")); + installed = true; + + // add to exit chain + ExitChain::add(remove, "RegistryKey::remove", 0, true); + + // if no passed in value, use the default + setProductKeyPathFromConfig = false; + useRegistryPath = DuplicateString(DEFAULT_PRODUCT_REGISTRY_PATH); + + // create the Windows-defined RegistryKeys (these keys don't get closed at object destruction time) + usersKey = new RegistryKey(HKEY_USERS, false); //lint !e1924 // Note -- C-style cast + currentUserKey = new RegistryKey(HKEY_CURRENT_USER, false); //lint !e1924 // Note -- C-style cast + classRootKey = new RegistryKey(HKEY_CLASSES_ROOT, false); //lint !e1924 // Note -- C-style cast + localMachineKey = new RegistryKey(HKEY_LOCAL_MACHINE, false); //lint !e1924 // Note -- C-style cast + + // check for errors --- unnecessary if new cannot return NULL + FATAL( + !usersKey || !currentUserKey || !classRootKey || !localMachineKey, + ("failed to create standard RegistryKey objects")); + + // create/open the product user key + productUserKey = currentUserKey->createSubkey(useRegistryPath, AF_READ | AF_WRITE); + + // create/open the product machine key + productMachineKey = localMachineKey->createSubkey(useRegistryPath, AF_READ); + + delete [] useRegistryPath; + +#if USE_REGISTRY_EXECUTION_STATISTICS + updateStartupStatistics(); +#endif +} + +// ---------------------------------------------------------------------- +/** + * release all resources and state associated with the RegistryKey system. + * + * It is invalid to call any RegistryKey functions other than install() + * after calling remove(). + */ + +void RegistryKey::remove(void) +{ +#if USE_REGISTRY_EXECUTION_STATISTICS + updateShutdownStatistics(); +#endif + + DEBUG_FATAL(!installed, ("attempted to remove RegistryKey when not installed\n")); + installed = false; + + delete productMachineKey; + delete productUserKey; + delete localMachineKey; + delete classRootKey; + delete currentUserKey; + delete usersKey; + + productMachineKey = 0; + productUserKey = 0; + localMachineKey = 0; + classRootKey = 0; + currentUserKey = 0; + usersKey = 0; + +} + +// ---------------------------------------------------------------------- +/** + * reset the path to the product's machine and user keys. + * + * This routine will redefine the following keys: + * productUserKey: HKEY_CURENT_USER\ + * productMachineKey: HKEY_LOCAL_MACHINE\ + * + * If the product key relative paths were specified in the config + * file, this routine will essentially do nothing --- the client + * is not able to ovveride the config file settings. + */ + +void RegistryKey::setProductKeyPath(const char *productKeyRelativePath) +{ + DEBUG_FATAL( + !productKeyRelativePath || !productKeyRelativePath[0], + ("invalid productKeyRelativePath arg\n")); + + // don't allow client to overwrite if path set by config file + if (setProductKeyPathFromConfig) + { + DEBUG_REPORT_LOG_PRINT(true, ("attempted to set product registry key path to '%s' but config file setting will override\n", productKeyRelativePath)); + return; + } + + delete productUserKey; + delete productMachineKey; + + productUserKey = currentUserKey->createSubkey(productKeyRelativePath, AF_READ | AF_WRITE); + productMachineKey = localMachineKey->createSubkey(productKeyRelativePath, AF_READ | AF_WRITE); +} + +// ====================================================================== diff --git a/engine/shared/library/sharedFoundation/src/win32/RegistryKey.h b/engine/shared/library/sharedFoundation/src/win32/RegistryKey.h new file mode 100755 index 00000000..9c885194 --- /dev/null +++ b/engine/shared/library/sharedFoundation/src/win32/RegistryKey.h @@ -0,0 +1,270 @@ +#ifndef REGISTRY_KEY_H +#define REGISTRY_KEY_H + +// ====================================================================== +// +// RegistryKey.h +// Todd Fiala +// +// copyright 1998 Bootprint Entertainment +// +// ====================================================================== + +// provide read and write access to the Windows Registry +// +// Remarks: +// +// Each RegistryKey can create or open a subkey relative to that +// key. This process produces another RegistryKey. RegistryKeys +// provide a mechanism to enumerate all the child subkeys and values +// associated with the key. In addition, clients may query for +// the presence, type and size of a specific value, get a specific +// value's data, and set a named value's data and type. +// +// The RegistryKey class provides the client with six RegistryKey +// objects as starting points into the registry. See documentation +// for install() for more info on these starting points. +// +// The client must install() the RegistryKey class before using it. + +class RegistryKey +{ +public: + // ---------------------------------------------------------------------- + // flags used to indicate what type of access (e.g. read, write) should + // be granted when creating or opening a key. + // + // See Also: + // + // createSubkey(), openSubkey() + + enum // AccessFlags + { + AF_READ = BINARY1(0001), // query values, enumerate subkeys + AF_WRITE = BINARY1(0010) // set values, create subkeys + }; + + // ---------------------------------------------------------------------- + // callback prototype for subkey enumeration + // + // Return Value: + // + // A return value of true indicates the enumeration of subkeys should + // continue. A return value of false stops further enumeration of + // subkeys. + // + // Remarks: + // + // The context parameter is specified in the call to + // enumerateSubkeys(). One use for this could be to pass a class + // instance, with the callack defined as a static member function. + // The function can then cast the context to a pointer to class + // instance, allowing the static function to access per-instance + // data explicitly in place of an assumed this pointer. + // + // See Also: + // + // enumerateSubkeys() + + typedef bool (*EnumerateKeyCallback)( + void *context, // [IN] user-specified context variable + const char *keyName, // [IN] name of the key being enumerated + const FILETIME *lastWriteTime // [IN] last time this key was modified + ); + + // ---------------------------------------------------------------------- + // callback prototype for value enumeration + // + // Return Value: + // + // A return value of true indicates the enumeration of values should + // continue. A return value of false stops further enumeration of + // values . + // + // Remarks: + // + // The context parameter is specified in the call to + // enumerateValues(). One use for this could be to pass a class + // instance, with the callack defined as a static member function. + // The function can then cast the context to a pointer to class + // instance, allowing the static function to access per-instance + // data explicitly in place of an assumed this pointer. + // + // See Also: + // + // enumerateValues() + + typedef bool (*EnumerateValueCallback)( + void *context, // [IN] user-specified context variable + const char *valueName, // [IN] name of the value being enumerated + uint32 valueSize, // [IN] number of bytes occupied by this value's data + DWORD valueType // [IN] type of value (one of REG_* as in RegSetValueEx documentation) + ); + +private: + static const char * const PRODUCT_REGISTRY_PATH_KEYNAME; + static const char * const DEFAULT_PRODUCT_REGISTRY_PATH; + +#if USE_REGISTRY_EXECUTION_STATISTICS + static const char * const STATISTICS_KEYNAME; + static const char * const STAT_EXEC_STARTED_COUNT_VALUENAME; + static const char * const STAT_EXEC_INCOMPLETE_COUNT_VALUENAME; + static const char * const STAT_TIME_AVERAGE_VALUENAME; + static const char * const STAT_TIME_MIN_VALUENAME; + static const char * const STAT_TIME_MAX_VALUENAME; + static const char * const STAT_TIME_START_VALUENAME; +#endif + + static bool installed; + static bool setProductKeyPathFromConfig; + + // private instance member variables + HKEY keyHandle; + bool closeKeyOnDestroy; + +private: + // public member variables + static RegistryKey *usersKey; + static RegistryKey *currentUserKey; + static RegistryKey *classRootKey; + static RegistryKey *localMachineKey; + static RegistryKey *productUserKey; + static RegistryKey *productMachineKey; + +private: + // private member functions + static void remove(void); + RegistryKey(HKEY newKeyHandle, bool newCloseKeyOnDestroy); + +#if USE_REGISTRY_EXECUTION_STATISTICS + static void updateStartupKey(RegistryKey *key); + static void updateShutdownKey(RegistryKey *key); + static bool enumValueInfoPrint(void *context, const char *valueName, uint32 valueSize, DWORD valueType); + + static void updateStartupStatistics(void); + static void updateShutdownStatistics(void); +#endif + +private: + // disable: default constructor, copy constructor, assignment operator + // NOTE: last two can be implemented, but must be specially handled + RegistryKey(void); + RegistryKey(const RegistryKey&); + RegistryKey &operator =(const RegistryKey&); + +public: + // public member functions + + static void install(const char *productKeyRelativePath = 0); + static void setProductKeyPath(const char *productKeyRelativePath); + + // pre-defined RegistryKey retrieval + static RegistryKey *getUsersKey(void); + static RegistryKey *getCurrentUserKey(void); + static RegistryKey *getClassRootKey(void); + static RegistryKey *getLocalMachineKey(void); + static RegistryKey *getProductUserKey(void); + static RegistryKey *getProductMachineKey(void); + + ~RegistryKey(void); + + // subkey interface + void enumerateSubkeys(void *context, EnumerateKeyCallback callback) const; + RegistryKey *openSubkey(const char *subkeyName, uint32 accessFlags = AF_READ) const; + RegistryKey *createSubkey(const char *subkeyName, uint32 accessFlags = AF_READ | AF_WRITE) const; + void deleteSubkey(const char *subkeyName); + bool subKeyExists(const char *subkeyName); + + // value interface + void enumerateValues(void *context, EnumerateValueCallback callback) const; + void setValue(const char *valueName, const void *dataPtr, uint32 dataSize, DWORD valueType = REG_BINARY); + void deleteValue(const char *valueName); + + void getValueInfo(const char *valueName, bool *doesExist, uint32 *valueSize = 0, DWORD *valueType = 0) const; + void getValue(const char *valueName, void *dataPtr, uint32 maxDataSize, uint32 *valueDataSize, DWORD *valueType = 0) const; + bool getStringValue(const char *valueName, const char *defaultValue, char *dest, DWORD destSize, bool optional = false); + +}; + +// ====================================================================== +// retrieve a key to the HKEY_USERS registry key with read access + +inline RegistryKey *RegistryKey::getUsersKey(void) +{ + DEBUG_FATAL(!installed, ("Attempted to use RegistryKey when not installed\n")); + return usersKey; +} + +// ---------------------------------------------------------------------- +/** + * retrieve a key to the HKEY_CURRENT_USER registry key with read/write + * access. + */ + +inline RegistryKey *RegistryKey::getCurrentUserKey(void) +{ + DEBUG_FATAL(!installed, ("Attempted to use RegistryKey when not installed\n")); + return currentUserKey; +} + +// ---------------------------------------------------------------------- +/** + * retrieve a key to the HKEY_CLASSES_ROOT registry key with read/write + * access. + */ + +inline RegistryKey *RegistryKey::getClassRootKey(void) +{ + DEBUG_FATAL(!installed, ("Attempted to use RegistryKey when not installed\n")); + return classRootKey; +} + +// ---------------------------------------------------------------------- +/** + * retrieve a key to the HKEY_LOCAL_MACHINE registry key with read/write + * access. + */ + +inline RegistryKey *RegistryKey::getLocalMachineKey(void) +{ + DEBUG_FATAL(!installed, ("Attempted to use RegistryKey when not installed\n")); + return localMachineKey; +} + +// ---------------------------------------------------------------------- +/** + * retrieve a key to the product's user key with read/write access. + * + * The product user key is the root key for storing user-specific + * product-related information. install() describes where this + * information exists in the registry. + * + * @see install(), getProductMachineKey() + */ + +inline RegistryKey *RegistryKey::getProductUserKey(void) +{ + DEBUG_FATAL(!installed, ("Attempted to use RegistryKey when not installed\n")); + return productUserKey; +} + +// ---------------------------------------------------------------------- +/** + * retrieve a key to the product's machine key with read/write access. + * + * The product machine key is the root key for storing machine-specific + * product-related information. install() describes where this + * information exists in the registry. + * + * @see install(), getProductUserKey() + */ + +inline RegistryKey *RegistryKey::getProductMachineKey(void) +{ + DEBUG_FATAL(!installed, ("Attempted to use RegistryKey when not installed\n")); + return productMachineKey; +} + +// ====================================================================== + +#endif diff --git a/engine/shared/library/sharedFoundation/src/win32/SetupSharedFoundation.cpp b/engine/shared/library/sharedFoundation/src/win32/SetupSharedFoundation.cpp new file mode 100755 index 00000000..98889b52 --- /dev/null +++ b/engine/shared/library/sharedFoundation/src/win32/SetupSharedFoundation.cpp @@ -0,0 +1,410 @@ +// ====================================================================== +// +// SetupSharedFoundation.cpp +// copyright 1998 Bootprint Entertainment +// copyright 2001 Sony Online Entertainment +// +// ====================================================================== + +#include "sharedFoundation/FirstSharedFoundation.h" +#include "sharedFoundation/SetupSharedFoundation.h" + +#include "sharedDebug/DebugMonitor.h" +#include "sharedDebug/InstallTimer.h" +#include "sharedDebug/Profiler.h" + +#include "sharedFoundation/ApplicationVersion.h" +#include "sharedFoundation/Clock.h" +#include "sharedFoundation/CommandLine.h" +#include "sharedFoundation/ConfigFile.h" +#include "sharedFoundation/ConfigSharedFoundation.h" +#include "sharedFoundation/CrashReportInformation.h" +#include "sharedFoundation/CrcLowerString.h" +#include "sharedFoundation/ExitChain.h" +#include "sharedFoundation/Os.h" +#include "sharedFoundation/Production.h" +#include "sharedFoundation/RegistryKey.h" +#include "sharedFoundation/StaticCallbackEntry.h" +#include "sharedFoundation/MemoryBlockManager.h" +#include "sharedFoundation/Watcher.h" +#include "sharedLog/TailFileLogObserver.h" + +#include +#include + +// ====================================================================== + +namespace FatalNamespace +{ + extern char ms_buffer[32 * 1024]; +} + +namespace SetupSharedFoundationNamespace +{ + LONG __stdcall MyUnhandledExceptionFilter(LPEXCEPTION_POINTERS exceptionPointers); + + bool ms_writeMiniDumps; +} + +using namespace SetupSharedFoundationNamespace; + +// ====================================================================== + +LONG __stdcall SetupSharedFoundationNamespace::MyUnhandledExceptionFilter(LPEXCEPTION_POINTERS exceptionPointers) +{ + // make the routine somewhat safe from re-entrance + static bool entered = false; + if (entered) + return EXCEPTION_CONTINUE_SEARCH; + entered = true; + + // log some important information + static char buffer[128]; + sprintf(buffer, "Exception %08x(%d)=code %08x=addr\n", exceptionPointers->ExceptionRecord->ExceptionCode, exceptionPointers->ExceptionRecord->ExceptionCode, exceptionPointers->ExceptionRecord->ExceptionAddress); + OutputDebugString(buffer); + + // write the minidump if we're in here for the first time + static bool ms_alreadyWroteMiniDump = false; + if (ms_writeMiniDumps && !ms_alreadyWroteMiniDump) + { + ms_alreadyWroteMiniDump = true; + + uint64 timestamp; + time_t now; + tm t; + + IGNORE_RETURN(time(&now)); + IGNORE_RETURN(gmtime_r(&now, &t)); + timestamp = t.tm_year+1900; //lint !e732 !e737 !e776 + timestamp *= 100; + timestamp += t.tm_mon+1; //lint !e737 !e776 + timestamp *= 100; + timestamp += static_cast(t.tm_mday); + timestamp *= 100; + timestamp += static_cast(t.tm_hour); + timestamp *= 100; + timestamp += static_cast(t.tm_min); + timestamp *= 100; + timestamp += static_cast(t.tm_sec); + + static char fileName[512]; + + sprintf(fileName, "%s-%s-%I64d.txt", Os::getShortProgramName(), ApplicationVersion::getInternalVersion(), timestamp); + HANDLE const file = CreateFile(fileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_ARCHIVE, NULL); + if (file != INVALID_HANDLE_VALUE) + { + char text1[] = "automated crash dump from "; + DWORD bytesWritten; + WriteFile(file, text1, strlen(text1), &bytesWritten, NULL); + + char const * text2 = Os::getShortProgramName(); + WriteFile(file, text2, strlen(text2), &bytesWritten, NULL); + + char text3[] = " "; + WriteFile(file, text3, strlen(text3), &bytesWritten, NULL); + + char const * text4 = ApplicationVersion::getInternalVersion(); + WriteFile(file, text4, strlen(text4), &bytesWritten, NULL); + + char text5[] = "\n\n\n"; + WriteFile(file, text5, strlen(text5), &bytesWritten, NULL); + + if (exceptionPointers->ExceptionRecord->ExceptionCode == 0x80000003) + { + // write out the fatal buffer + char const * text6 = FatalNamespace::ms_buffer; + WriteFile(file, text6, strlen(text6), &bytesWritten, NULL); + } + else + { + char const * text6 = buffer; + WriteFile(file, text6, strlen(text6), &bytesWritten, NULL); + } + + char text7[] = "\n\n"; + WriteFile(file, text7, strlen(text7), &bytesWritten, NULL); + + char const * text8 = ""; + for (int i = 0; text8; ++i) + { + text8 = CrashReportInformation::getEntry(i); + if (text8) + { + int const text8Length = strlen(text8); + if (text8Length) + WriteFile(file, text8, text8Length, &bytesWritten, NULL); + } + } + + CloseHandle(file); + } + + sprintf(fileName, "%s-%s-%I64d.mdmp", Os::getShortProgramName(), ApplicationVersion::getInternalVersion(), timestamp); + OutputDebugString("Generating minidump "); + OutputDebugString(fileName); + OutputDebugString("\n"); + DebugHelp::writeMiniDump(fileName, exceptionPointers); + + sprintf(fileName, "%s-%s-%I64d.log", Os::getShortProgramName(), ApplicationVersion::getInternalVersion(), timestamp); + TailFileLogObserver::flushAllTailFileLogObservers(fileName); + } + + // tell the Os not to abort so we can rethrow the exception + Os::returnFromAbort(); + + // Let the ExitChain do its job + Fatal("ExceptionHandler invoked"); + + // rethrow the exception so that the debugger can catch it + entered = false; + return EXCEPTION_CONTINUE_SEARCH; //lint !e527 // Unreachable +} + +// ---------------------------------------------------------------------- + +static void setFatalVersionString() +{ + char buffer[256]; + sprintf(buffer, "%s: %s\n", Os::getShortProgramName(), ApplicationVersion::getInternalVersion()); + FatalSetVersionString(buffer); +} + +// ====================================================================== +// Install the engine +// +// Remarks: +// +// The settings in the Data structure will determine which subsystems +// get initialized. + +void SetupSharedFoundation::install(const Data &data) +{ + InstallTimer const installTimer("SetupSharedFoundation::install"); + + DEBUG_REPORT_LOG(true, ("SetupSharedFoundation::install: version %s\n", ApplicationVersion::getInternalVersion())); + + ms_writeMiniDumps = data.writeMiniDumps; + SetUnhandledExceptionFilter(MyUnhandledExceptionFilter); + + // and get the command line stuff in quick so we can make decisions based on the command line settings + CommandLine::install(); + + // feed CommandLine with appropriate strings + if (data.commandLine) + CommandLine::absorbString(data.commandLine); + if (data.argc) + CommandLine::absorbStrings(const_cast(data.argv+1), data.argc-1); + + // load the config file + ConfigFile::install(); + if (data.configFile) + IGNORE_RETURN(ConfigFile::loadFile(data.configFile)); + + // get the post command-line text for the ConfigFile (key-value pairs) + const char *configString = CommandLine::getPostCommandLineString(); + if (configString) + { + IGNORE_RETURN(ConfigFile::loadFromCommandLine(configString)); + } + + // @todo codereorg should this be here? + MemoryManager::registerDebugFlags(); +#if PRODUCTION == 0 + Profiler::registerDebugFlags(); +#endif + FatalInstall(); + + // @todo move these, it's part of sharedDebug. However, sharedDebug is installed before sharedFoundation, but these need the ConfigFile. ugh. +#if PRODUCTION == 0 + DebugMonitor::install(); +#endif + SetWarningStrictFatal(ConfigFile::getKeyBool("SharedDebug", "strict", false)); + + { + ConfigSharedFoundation::Defaults defaults; + defaults.frameRateLimit = data.frameRateLimit; + defaults.demoMode = data.demoMode; + defaults.verboseWarnings = data.verboseWarnings; + ConfigSharedFoundation::install(defaults); + + if (ConfigSharedFoundation::getCauseAccessViolation()) + static_cast(0)[0] = 0; + } + + // @todo codereorg should this be here? +#ifdef _DEBUG + MemoryManager::setReportAllocations (ConfigSharedFoundation::getMemoryManagerReportAllocations ()); +#endif + + MemoryBlockManager::install (ConfigSharedFoundation::getMemoryBlockManagerDebugDumpOnRemove ()); + + ExitChain::install(); + Report::install(); + Clock::install(data.clockUsesSleep, data.clockUsesRecalibrationThread); + CrashReportInformation::install(); + RegistryKey::install(data.productRegistryKey); + + PersistentCrcString::install(); + CrcLowerString::install(); + + WatchedByList::install(); + + if (data.createWindow) + { + DEBUG_FATAL(data.useWindowHandle, ("exactly one of createWindow and useWindowHandle must be true")); + Os::install(data.hInstance, data.windowName, data.windowNormalIcon, data.windowSmallIcon); + } + else + { + if (data.useWindowHandle) + Os::install(data.windowHandle, data.processMessagePump); + else + Os::install(); + } + + StaticCallbackEntry::install(); + + setFatalVersionString(); +} + +// ---------------------------------------------------------------------- +// Call a function with appropriate exception handling +// +// Remarks: +// +// If exception handling has been disabled in the config file, this routine +// will call the callback without exception handling. + +void SetupSharedFoundation::callbackWithExceptionHandling( + void (*callback)(void) // Routine to call with exception handling + ) +{ + callback(); +} + +// ---------------------------------------------------------------------- +// Uninstall the engine +// +// Remarks: +// +// This routine will properly uninstall the engine componenets that were +// installed by SetupSharedFoundation::install(). + +void SetupSharedFoundation::remove(void) +{ + ExitChain::quit(); + + if (!ConfigSharedFoundation::getDemoMode() && GetNumberOfWarnings()) + REPORT(true, Report::RF_print | Report::RF_log | Report::RF_dialog, ("%d warnings logged", GetNumberOfWarnings())); +} + +// ====================================================================== + +SetupSharedFoundation::Data::Data(Defaults defaults) +{ + Zero(*this); + + switch (defaults) + { + case D_console: setupConsoleDefaults(); break; + case D_game: setupGameDefaults(); break; + case D_mfc: setupMfcDefaults(); break; + default: DEBUG_FATAL(true, ("invalid enum value")); + } +} + +// ---------------------------------------------------------------------- + +void SetupSharedFoundation::Data::setupGameDefaults() +{ + createWindow = true; + windowName = NULL; + windowNormalIcon = NULL; + windowSmallIcon = NULL; + hInstance = NULL; + useWindowHandle = false; + processMessagePump = true; + windowHandle = NULL; + clockUsesSleep = false; + clockUsesRecalibrationThread = true; + writeMiniDumps = false; + + commandLine = NULL; + argc = 0; + argv = NULL; + + configFile = NULL; + + productRegistryKey = NULL; + + frameRateLimit = CONST_REAL(0); + + lostFocusCallback = NULL; + + demoMode = false; + verboseWarnings = false; +} + +// ---------------------------------------------------------------------- + +void SetupSharedFoundation::Data::setupConsoleDefaults() +{ + createWindow = false; + windowName = NULL; + windowNormalIcon = NULL; + windowSmallIcon = NULL; + hInstance = NULL; + useWindowHandle = false; + processMessagePump = true; + windowHandle = NULL; + clockUsesSleep = false; + clockUsesRecalibrationThread = false; + writeMiniDumps = false; + + commandLine = NULL; + argc = NULL; + argv = NULL; + + configFile = NULL; + + productRegistryKey = NULL; + + frameRateLimit = CONST_REAL(0); + + lostFocusCallback = NULL; + + demoMode = false; + verboseWarnings = false; +} + +// ---------------------------------------------------------------------- + +void SetupSharedFoundation::Data::setupMfcDefaults() +{ + createWindow = false; + windowName = NULL; + windowNormalIcon = NULL; + windowSmallIcon = NULL; + hInstance = NULL; + useWindowHandle = false; + processMessagePump = true; + windowHandle = NULL; + clockUsesSleep = false; + clockUsesRecalibrationThread = false; + writeMiniDumps = false; + + commandLine = NULL; + argc = 0; + argv = NULL; + + configFile = NULL; + + productRegistryKey = NULL; + + frameRateLimit = CONST_REAL(0); + + demoMode = false; + verboseWarnings = false; +} + +// ====================================================================== diff --git a/engine/shared/library/sharedFoundation/src/win32/SetupSharedFoundation.h b/engine/shared/library/sharedFoundation/src/win32/SetupSharedFoundation.h new file mode 100755 index 00000000..b0675d8f --- /dev/null +++ b/engine/shared/library/sharedFoundation/src/win32/SetupSharedFoundation.h @@ -0,0 +1,99 @@ +// ====================================================================== +// +// SetupSharedFoundation.h +// copyright 1998 Bootprint Entertainment +// copyright 2001 Sony Online Entertainment +// +// ====================================================================== + +#ifndef INCLUDED_SetupSharedFoundation_H +#define INCLUDED_SetupSharedFoundation_H + +// ====================================================================== + +class SetupSharedFoundation +{ +public: + + struct Data + { + typedef void (*LostFocusCallbackFuction)(); + + // window creation stuff + bool createWindow; + const char *windowName; + HICON windowNormalIcon; + HICON windowSmallIcon; + HINSTANCE hInstance; + + // window use stuff + bool useWindowHandle; + bool processMessagePump; + HWND windowHandle; + + bool writeMiniDumps; + + bool clockUsesSleep; + bool clockUsesRecalibrationThread; + + // pointer to command line + const char *commandLine; + int argc; + char **argv; + + // name of the config file to lead + const char *configFile; + + // registry stuff + const char *productRegistryKey; + + real frameRateLimit; + + + bool demoMode; + + bool verboseWarnings; + + LostFocusCallbackFuction lostFocusCallback; + + public: + + enum Defaults + { + D_console, + D_game, + D_mfc + }; + + Data(Defaults defaults); + + private: + + Data(); + + void setupGameDefaults(); + void setupConsoleDefaults(); + void setupMfcDefaults(); + }; + +public: + + typedef void (*MainFunction)(); + +public: + + static void install(const Data &data); + static void remove(void); + + static void callbackWithExceptionHandling(MainFunction mainFunction); + +private: + + SetupSharedFoundation(); + SetupSharedFoundation(const SetupSharedFoundation &); + SetupSharedFoundation &operator =(const SetupSharedFoundation &); +}; + +// ====================================================================== + +#endif diff --git a/engine/shared/library/sharedFoundation/src/win32/WindowsWrapper.h b/engine/shared/library/sharedFoundation/src/win32/WindowsWrapper.h new file mode 100755 index 00000000..88b64ed5 --- /dev/null +++ b/engine/shared/library/sharedFoundation/src/win32/WindowsWrapper.h @@ -0,0 +1,51 @@ +// ====================================================================== +// +// WindowsWrapper.h +// copyright (c) 1998 Bootprint Entertainment +// copyright (c) 2001 Sony Online Entertainment +// +// ====================================================================== + +#ifndef INCLUDED_WindowsWrapper_H +#define INCLUDED_WindowsWrapper_H + +// ====================================================================== + +// C4201 nonstandard extension used : nameless struct/union +#pragma warning(disable: 4201) + +// make windows.h more strict in the types of handles +#ifndef STRICT +#define STRICT 1 +#endif + +// trim down the amount of stuff windows.h includes +#define NOGDICAPMASKS +#define NOVIRTUALKEYCODE +#define NOKEYSTATES +#define NORASTEROPS +#define NOATOM +#define NOCOLOR +#define NODRAWTEXT +#define NOMEMMGR +#define NOMETAFILE +#define NOMINMAX +#define NOOPENFILE +#define NOSERVICE +#define NOSOUND +#define NOCOMM +#define NOHELP +#define NOPROFILER +#define NODEFERWINDOWPOS +#define NOMCX +#define WIN32_LEAN_AND_MEAN + +#include +#include + +// reenable warnings disables for windows.h +#pragma warning(default: 4201) + +// ====================================================================== + +#endif diff --git a/engine/shared/library/sharedFoundationTypes/src/win32/FoundationTypesWin32.h b/engine/shared/library/sharedFoundationTypes/src/win32/FoundationTypesWin32.h new file mode 100755 index 00000000..622039d8 --- /dev/null +++ b/engine/shared/library/sharedFoundationTypes/src/win32/FoundationTypesWin32.h @@ -0,0 +1,33 @@ +// PRIVATE. Do not export this header file outside the package. + +// ====================================================================== +// +// FoundationTypesWin32.cpp +// copyright (c) 2001 Sony Online Entertainment +// +// ====================================================================== + +#ifndef INCLUDED_FoundationTypesWin32_H +#define INCLUDED_FoundationTypesWin32_H + +// ====================================================================== +// specify what platform we're running on. + +#define PLATFORM_WIN32 + +// ====================================================================== +// basic types that we assume to be around + +typedef unsigned char uint8; +typedef unsigned short uint16; +typedef unsigned long uint32; +typedef unsigned __int64 uint64; +typedef signed char int8; +typedef signed short int16; +typedef signed long int32; +typedef signed __int64 int64; +typedef int FILE_HANDLE; + +// ====================================================================== + +#endif diff --git a/engine/shared/library/sharedFractal/src/win32/FirstSharedFractal.cpp b/engine/shared/library/sharedFractal/src/win32/FirstSharedFractal.cpp new file mode 100755 index 00000000..20d5ff2f --- /dev/null +++ b/engine/shared/library/sharedFractal/src/win32/FirstSharedFractal.cpp @@ -0,0 +1,8 @@ +// ====================================================================== +// +// FirstFractal.cpp +// copyright (c) 2001 Sony Online Entertainment +// +// ====================================================================== + +#include "sharedFractal/FirstSharedFractal.h" diff --git a/engine/shared/library/sharedGame/src/win32/FirstSharedGame.cpp b/engine/shared/library/sharedGame/src/win32/FirstSharedGame.cpp new file mode 100755 index 00000000..b95c88bf --- /dev/null +++ b/engine/shared/library/sharedGame/src/win32/FirstSharedGame.cpp @@ -0,0 +1,9 @@ +// ====================================================================== +// +// FirstSharedGame.cpp +// Copyright 2002-2003 Sony Online Entertainment, Inc. +// All Rights Reserved. +// +// ====================================================================== + +#include "sharedGame/FirstSharedGame.h" diff --git a/engine/shared/library/sharedImage/src/win32/FirstSharedImage.cpp b/engine/shared/library/sharedImage/src/win32/FirstSharedImage.cpp new file mode 100755 index 00000000..c57c713f --- /dev/null +++ b/engine/shared/library/sharedImage/src/win32/FirstSharedImage.cpp @@ -0,0 +1,8 @@ +// ====================================================================== +// +// FirstImage.cpp +// copyright (c) 2001 Sony Online Entertainment +// +// ====================================================================== + +#include "sharedImage/FirstSharedImage.h" diff --git a/engine/shared/library/sharedIoWin/src/win32/FirstSharedIoWin.cpp b/engine/shared/library/sharedIoWin/src/win32/FirstSharedIoWin.cpp new file mode 100755 index 00000000..52f7b83b --- /dev/null +++ b/engine/shared/library/sharedIoWin/src/win32/FirstSharedIoWin.cpp @@ -0,0 +1,8 @@ +// ====================================================================== +// +// FirstIoWin.cpp +// copyright (c) 2001 Sony Online Entertainment +// +// ====================================================================== + +#include "sharedIoWin/FirstSharedIoWin.h" diff --git a/engine/shared/library/sharedLog/src/win32/StderrLogger.cpp b/engine/shared/library/sharedLog/src/win32/StderrLogger.cpp new file mode 100755 index 00000000..c7efe43d --- /dev/null +++ b/engine/shared/library/sharedLog/src/win32/StderrLogger.cpp @@ -0,0 +1,35 @@ +// ====================================================================== +// +// StderrLogger.cpp +// +// Copyright 2003 Sony Online Entertainment +// +// ====================================================================== + +#include "sharedLog/FirstSharedLog.h" +#include "sharedLog/StderrLogger.h" + +// ====================================================================== + +// Unimplemented for win32 + +// ====================================================================== + +void StderrLogger::install() +{ +} + +// ---------------------------------------------------------------------- + +void StderrLogger::remove() +{ +} + +// ---------------------------------------------------------------------- + +void StderrLogger::update() +{ +} + +// ====================================================================== + diff --git a/engine/shared/library/sharedMath/src/win32/FirstSharedMath.cpp b/engine/shared/library/sharedMath/src/win32/FirstSharedMath.cpp new file mode 100755 index 00000000..5f04bd2a --- /dev/null +++ b/engine/shared/library/sharedMath/src/win32/FirstSharedMath.cpp @@ -0,0 +1,8 @@ +// ====================================================================== +// +// FirstMath.cpp +// copyright (c) 2001 Sony Online Entertainment +// +// ====================================================================== + +#include "sharedMath/FirstSharedMath.h" diff --git a/engine/shared/library/sharedMath/src/win32/SseMath.cpp b/engine/shared/library/sharedMath/src/win32/SseMath.cpp new file mode 100755 index 00000000..11624aab --- /dev/null +++ b/engine/shared/library/sharedMath/src/win32/SseMath.cpp @@ -0,0 +1,430 @@ +// ====================================================================== +// +// SseMath.cpp +// Copyright 2002 Sony Online Entertainment, Inc. +// All Rights Reserved. +// +// ====================================================================== + +#include "sharedMath/FirstSharedMath.h" +#include "sharedMath/SseMath.h" + +#include "sharedMath/Transform.h" +#include "sharedMath/Vector.h" + +// ====================================================================== + +#define SSE_ALIGN __declspec(align(16)) +#define SSE_VARIABLE_COUNT 5 + +// ====================================================================== + +namespace +{ + SSE_ALIGN float sseVariable[SSE_VARIABLE_COUNT][4]; +} + +// ====================================================================== +/** + * Retrieve whether the hardware can do SSE math. + * + * @return true if SSE math processing is available; false otherwise. + */ + +bool SseMath::canDoSseMath() +{ +#if 0 + return false; +#else + //-- First check the CPUID instruction. If it raises an exception, + // the CPUID instruction doesn't exist and SSE math support is not available. + bool cpuHasSse = false; + bool cpuHasSaveRestore = false; + + uint32 featureBits; + +#if 0 + bool osSupportsSaveRestore = false; + bool osSimdExceptionSupport = false; + bool x87EmulationDisabled = false; + + uint32 controlRegister4; + uint32 controlRegister0; +#endif + + try + { + __asm { + //-- Get features bits. + mov eax, 1 + cpuid + + mov featureBits, edx + +#if 0 + //-- Get control registers. + mov ecx, CR4 + mov controlRegister4, ecx + + mov ecx, CR0 + mov controlRegister0, ecx +#endif + } + + cpuHasSse = ((featureBits & 0x02000000) != 0); //lint !e530 // featureBits not initialized - yes it is, in the asm + cpuHasSaveRestore = ((featureBits & 0x01000000) != 0); + +#if 0 + osSupportsSaveRestore = ((controlRegister4 & 0x00000200) != 0); + osSimdExceptionSupport = ((controlRegister4 & 0x00000400) != 0); + x87EmulationDisabled = ((controlRegister0 & 0x00000004) == 0); +#endif + } + catch (...) + { //lint !e1775 // catch block does not catch any declared exceptions + } + +#if 1 + return cpuHasSse && cpuHasSaveRestore; +#else + return cpuHasSse && cpuHasSaveRestore && osSupportsSaveRestore && osSimdExceptionSupport && x87EmulationDisabled; +#endif +#endif +} + +// ---------------------------------------------------------------------- + +Vector SseMath::rotateTranslateScale_l2p(const Transform &transform, const Vector &vector, float scale) +{ + // NOTE: technically, my xmm register data contents comments are listing items in reverse order from how INTEL docs list them, left most val is really least significant value. + + __asm { + //-- Keep track of ebx. Client is crashing if I trash this. + push ebx + + //-- Load up matrix. + mov ebx, transform + + movaps xmm0, [ebx + 0] // xmm0 = a1 a2 a3 a4 + movaps xmm1, [ebx + 16] // xmm1 = b1 b2 b3 b4 + movaps xmm2, [ebx + 32] // xmm2 = c1 c2 c3 c4 + } + + //-- Prepare source vector. + sseVariable[0][0] = vector.x; + sseVariable[0][1] = vector.y; + sseVariable[0][2] = vector.z; + sseVariable[0][3] = 1.0f; + + __asm { + //-- Load up the source vector. + mov ebx, offset sseVariable + + movaps xmm3, [ebx] // xmm3 = sx sy sz 1 + + //-- Copy source to workspaces. + movaps xmm4, xmm3 // xmm4 = sx sy sz 1 + movaps xmm5, xmm3 // xmm5 = sx sy sz 1 + } + + //-- Prepare the scale vector. + __asm { + movss xmm6, scale // xmm6 = scale ? ? ? + shufps xmm6, xmm6, 0x00 // xmm6 = scale scale + movlhps xmm6, xmm6 // xmm6 = scale scale scale scale + + //-- Do the transform multiplies. + mulps xmm3, xmm0 // xmm3 = a1*sx a2*sy a3*sz a4 + mulps xmm4, xmm1 // xmm4 = b1*sx b2*sy b3*sz b4 + mulps xmm5, xmm2 // xmm5 = c1*sx c2*sy c3*sz c4 + + //-- Do the scale multiplies. + mulps xmm3, xmm6 // xmm3 = a1*sx*scale a2*sy*scale a3*sz*scale a4*scale + mulps xmm4, xmm6 // xmm4 = b1*sx*scale b2*sy*scale b3*sz*scale b4*scale + mulps xmm5, xmm6 // xmm5 = c1*sx*scale c2*sy*scale c3*sz*scale c4*scale + + //-- Save out data. + movaps [ebx + 32], xmm3 + movaps [ebx + 48], xmm4 + movaps [ebx + 64], xmm5 + + //-- Restore EBX + pop ebx + } + + // @todo consider twizzling/detwizzling to be able to perform add in sse. + return Vector( + sseVariable[2][0] + sseVariable[2][1] + sseVariable[2][2] + sseVariable[2][3], + sseVariable[3][0] + sseVariable[3][1] + sseVariable[3][2] + sseVariable[3][3], + sseVariable[4][0] + sseVariable[4][1] + sseVariable[4][2] + sseVariable[4][3]); +} //lint !e715 // scale/transform not referenced - it's in the asm + +// ---------------------------------------------------------------------- + +Vector SseMath::rotateScale_l2p(const Transform &transform, const Vector &vector, float scale) +{ +#if 0 + // @todo do the real thing. + return transform.rotate_l2p(vector) * scale; +#else + + // NOTE: technically, my xmm register data contents comments are listing items in reverse order from how INTEL docs list them, left most val is really least significant value. + + __asm { + //-- Keep track of ebx. Client is crashing if I trash this. + push ebx + + //-- Load up matrix. + mov ebx, transform + + movaps xmm0, [ebx + 0] // xmm0 = a1 a2 a3 a4 + movaps xmm1, [ebx + 16] // xmm1 = b1 b2 b3 b4 + movaps xmm2, [ebx + 32] // xmm2 = c1 c2 c3 c4 + } + + //-- Prepare source vector. + sseVariable[0][0] = vector.x; + sseVariable[0][1] = vector.y; + sseVariable[0][2] = vector.z; + sseVariable[0][3] = 0.0f; + + __asm { + //-- Load up the source vector. + mov ebx, offset sseVariable + + movaps xmm3, [ebx] // xmm3 = sx sy sz 1 + + //-- Copy source to workspaces. + movaps xmm4, xmm3 // xmm4 = sx sy sz 1 + movaps xmm5, xmm3 // xmm5 = sx sy sz 1 + } + + //-- Prepare the scale vector. + __asm { + movss xmm6, scale // xmm6 = scale ? ? ? + shufps xmm6, xmm6, 0x00 // xmm6 = scale scale + movlhps xmm6, xmm6 // xmm6 = scale scale scale scale + + //-- Do the transform multiplies. + mulps xmm3, xmm0 // xmm3 = a1*sx a2*sy a3*sz 0 + mulps xmm4, xmm1 // xmm4 = b1*sx b2*sy b3*sz 0 + mulps xmm5, xmm2 // xmm5 = c1*sx c2*sy c3*sz 0 + + //-- Do the scale multiplies. + mulps xmm3, xmm6 // xmm3 = a1*sx*scale a2*sy*scale a3*sz*scale 0 + mulps xmm4, xmm6 // xmm4 = b1*sx*scale b2*sy*scale b3*sz*scale 0 + mulps xmm5, xmm6 // xmm5 = c1*sx*scale c2*sy*scale c3*sz*scale 0 + + //-- Save out data. + movaps [ebx + 32], xmm3 + movaps [ebx + 48], xmm4 + movaps [ebx + 64], xmm5 + + //-- Restore EBX + pop ebx + } + + // @todo consider twizzling/detwizzling to be able to perform add in sse. + return Vector( + sseVariable[2][0] + sseVariable[2][1] + sseVariable[2][2], + sseVariable[3][0] + sseVariable[3][1] + sseVariable[3][2], + sseVariable[4][0] + sseVariable[4][1] + sseVariable[4][2]); + +#endif +} //lint !e715 // scale/transform not referenced - it's in the asm + +// ---------------------------------------------------------------------- + +void SseMath::skinPositionNormal_l2p(const Transform &transform, const Vector &sourcePosition, const Vector &sourceNormal, float scale, Vector &destPosition, Vector &destNormal) +{ + // NOTE: technically, my xmm register data contents comments are listing items in reverse order from how INTEL docs list them, left most val is really least significant value. + + __asm { + //-- Keep track of ebx. Client is crashing if I trash this. + push ebx + + //-- Load up matrix. + mov ebx, transform + + movaps xmm0, [ebx + 0] // xmm0 = a1 a2 a3 a4 + movaps xmm1, [ebx + 16] // xmm1 = b1 b2 b3 b4 + movaps xmm2, [ebx + 32] // xmm2 = c1 c2 c3 c4 + } + + //-- Prepare source position. + sseVariable[0][0] = sourcePosition.x; + sseVariable[0][1] = sourcePosition.y; + sseVariable[0][2] = sourcePosition.z; + sseVariable[0][3] = 1.0f; + + __asm { + //-- Load up the source vector. + mov ebx, offset sseVariable + + movaps xmm3, [ebx] // xmm3 = sx sy sz 1 + + //-- Copy source to workspaces. + movaps xmm4, xmm3 // xmm4 = sx sy sz 1 + movaps xmm5, xmm3 // xmm5 = sx sy sz 1 + + //-- Prepare the scale vector. + movss xmm6, scale // xmm6 = scale ? ? ? + shufps xmm6, xmm6, 0x00 // xmm6 = scale scale + movlhps xmm6, xmm6 // xmm6 = scale scale scale scale + + //-- Do the transform multiplies. + mulps xmm3, xmm0 // xmm3 = a1*sx a2*sy a3*sz a4 + mulps xmm4, xmm1 // xmm4 = b1*sx b2*sy b3*sz b4 + mulps xmm5, xmm2 // xmm5 = c1*sx c2*sy c3*sz c4 + + //-- Do the scale multiplies. + mulps xmm3, xmm6 // xmm3 = a1*sx*scale a2*sy*scale a3*sz*scale a4*scale + mulps xmm4, xmm6 // xmm4 = b1*sx*scale b2*sy*scale b3*sz*scale b4*scale + mulps xmm5, xmm6 // xmm5 = c1*sx*scale c2*sy*scale c3*sz*scale c4*scale + + //-- Save out data. + movaps [ebx + 32], xmm3 + movaps [ebx + 48], xmm4 + movaps [ebx + 64], xmm5 + } + + destPosition.x = sseVariable[2][0] + sseVariable[2][1] + sseVariable[2][2] + sseVariable[2][3]; + destPosition.y = sseVariable[3][0] + sseVariable[3][1] + sseVariable[3][2] + sseVariable[3][3]; + destPosition.z = sseVariable[4][0] + sseVariable[4][1] + sseVariable[4][2] + sseVariable[4][3]; + + //-- Prepare source normal. + sseVariable[0][0] = sourceNormal.x; + sseVariable[0][1] = sourceNormal.y; + sseVariable[0][2] = sourceNormal.z; + sseVariable[0][3] = 1.0f; + + __asm { + //-- Load up the source vector. + movaps xmm3, [ebx] // xmm3 = sx sy sz 1 + + //-- Copy source to workspaces. + movaps xmm4, xmm3 // xmm4 = sx sy sz 1 + movaps xmm5, xmm3 // xmm5 = sx sy sz 1 + + //-- Do the transform multiplies. + mulps xmm3, xmm0 // xmm3 = a1*sx a2*sy a3*sz a4 + mulps xmm4, xmm1 // xmm4 = b1*sx b2*sy b3*sz b4 + mulps xmm5, xmm2 // xmm5 = c1*sx c2*sy c3*sz c4 + + //-- Do the scale multiplies. + mulps xmm3, xmm6 // xmm3 = a1*sx*scale a2*sy*scale a3*sz*scale a4*scale + mulps xmm4, xmm6 // xmm4 = b1*sx*scale b2*sy*scale b3*sz*scale b4*scale + mulps xmm5, xmm6 // xmm5 = c1*sx*scale c2*sy*scale c3*sz*scale c4*scale + + //-- Save out data. + movaps [ebx + 32], xmm3 + movaps [ebx + 48], xmm4 + movaps [ebx + 64], xmm5 + + //-- Restore EBX + pop ebx + } + + destNormal.x = sseVariable[2][0] + sseVariable[2][1] + sseVariable[2][2]; + destNormal.y = sseVariable[3][0] + sseVariable[3][1] + sseVariable[3][2]; + destNormal.z = sseVariable[4][0] + sseVariable[4][1] + sseVariable[4][2]; +} //lint !e715 // scale/transform not referenced - it's in the asm + +// ---------------------------------------------------------------------- + +void SseMath::skinPositionNormalAdd_l2p(const Transform &transform, const Vector &sourcePosition, const Vector &sourceNormal, float scale, Vector &destPosition, Vector &destNormal) +{ + // NOTE: technically, my xmm register data contents comments are listing items in reverse order from how INTEL docs list them, left most val is really least significant value. + + __asm { + //-- Keep track of ebx. Client is crashing if I trash this. + push ebx + + //-- Load up matrix. + mov ebx, transform + + movaps xmm0, [ebx + 0] // xmm0 = a1 a2 a3 a4 + movaps xmm1, [ebx + 16] // xmm1 = b1 b2 b3 b4 + movaps xmm2, [ebx + 32] // xmm2 = c1 c2 c3 c4 + } + + //-- Prepare source position. + sseVariable[0][0] = sourcePosition.x; + sseVariable[0][1] = sourcePosition.y; + sseVariable[0][2] = sourcePosition.z; + sseVariable[0][3] = 1.0f; + + __asm { + //-- Load up the source vector. + mov ebx, offset sseVariable + + movaps xmm3, [ebx] // xmm3 = sx sy sz 1 + + //-- Copy source to workspaces. + movaps xmm4, xmm3 // xmm4 = sx sy sz 1 + movaps xmm5, xmm3 // xmm5 = sx sy sz 1 + + //-- Prepare the scale vector. + movss xmm6, scale // xmm6 = scale ? ? ? + shufps xmm6, xmm6, 0x00 // xmm6 = scale scale + movlhps xmm6, xmm6 // xmm6 = scale scale scale scale + + //-- Do the transform multiplies. + mulps xmm3, xmm0 // xmm3 = a1*sx a2*sy a3*sz a4 + mulps xmm4, xmm1 // xmm4 = b1*sx b2*sy b3*sz b4 + mulps xmm5, xmm2 // xmm5 = c1*sx c2*sy c3*sz c4 + + //-- Do the scale multiplies. + mulps xmm3, xmm6 // xmm3 = a1*sx*scale a2*sy*scale a3*sz*scale a4*scale + mulps xmm4, xmm6 // xmm4 = b1*sx*scale b2*sy*scale b3*sz*scale b4*scale + mulps xmm5, xmm6 // xmm5 = c1*sx*scale c2*sy*scale c3*sz*scale c4*scale + + //-- Save out data. + movaps [ebx + 32], xmm3 + movaps [ebx + 48], xmm4 + movaps [ebx + 64], xmm5 + } + + destPosition.x += sseVariable[2][0] + sseVariable[2][1] + sseVariable[2][2] + sseVariable[2][3]; + destPosition.y += sseVariable[3][0] + sseVariable[3][1] + sseVariable[3][2] + sseVariable[3][3]; + destPosition.z += sseVariable[4][0] + sseVariable[4][1] + sseVariable[4][2] + sseVariable[4][3]; + + //-- Prepare source normal. + sseVariable[0][0] = sourceNormal.x; + sseVariable[0][1] = sourceNormal.y; + sseVariable[0][2] = sourceNormal.z; + sseVariable[0][3] = 1.0f; + + __asm { + //-- Load up the source vector. + movaps xmm3, [ebx] // xmm3 = sx sy sz 1 + + //-- Copy source to workspaces. + movaps xmm4, xmm3 // xmm4 = sx sy sz 1 + movaps xmm5, xmm3 // xmm5 = sx sy sz 1 + + //-- Do the transform multiplies. + mulps xmm3, xmm0 // xmm3 = a1*sx a2*sy a3*sz a4 + mulps xmm4, xmm1 // xmm4 = b1*sx b2*sy b3*sz b4 + mulps xmm5, xmm2 // xmm5 = c1*sx c2*sy c3*sz c4 + + //-- Do the scale multiplies. + mulps xmm3, xmm6 // xmm3 = a1*sx*scale a2*sy*scale a3*sz*scale a4*scale + mulps xmm4, xmm6 // xmm4 = b1*sx*scale b2*sy*scale b3*sz*scale b4*scale + mulps xmm5, xmm6 // xmm5 = c1*sx*scale c2*sy*scale c3*sz*scale c4*scale + + //-- Save out data. + movaps [ebx + 32], xmm3 + movaps [ebx + 48], xmm4 + movaps [ebx + 64], xmm5 + + //-- Restore EBX + pop ebx + } + + destNormal.x += sseVariable[2][0] + sseVariable[2][1] + sseVariable[2][2]; + destNormal.y += sseVariable[3][0] + sseVariable[3][1] + sseVariable[3][2]; + destNormal.z += sseVariable[4][0] + sseVariable[4][1] + sseVariable[4][2]; +} //lint !e715 // scale/transform not referenced - it's in the asm + +// ====================================================================== diff --git a/engine/shared/library/sharedMath/src/win32/SseMath.h b/engine/shared/library/sharedMath/src/win32/SseMath.h new file mode 100755 index 00000000..fcbeaef2 --- /dev/null +++ b/engine/shared/library/sharedMath/src/win32/SseMath.h @@ -0,0 +1,58 @@ +// ====================================================================== +// +// SseMath.h +// Copyright 2002 Sony Online Entertainment, Inc. +// All Rights Reserved. +// +// ====================================================================== + +#ifndef INCLUDED_SseMath_H +#define INCLUDED_SseMath_H + +// ====================================================================== + +class Transform; +class Vector; + +// ====================================================================== +#define MXCSR_FLUSH_TO_ZERO (1<<15) +#define MXCSR_PRECISION_MASK (1<<12) +#define MXCSR_UNDERFLOW_MASK (1<<11) +#define MXCSR_OVERFLOW_MASK (1<<10) +#define MXCSR_DIVIDE_BY_ZERO_MASK (1<< 9) +#define MXCSR_DENORMAL_MASK (1<< 8) + +class SseMath +{ +public: + + static bool canDoSseMath(); + + static Vector rotateTranslateScale_l2p(const Transform &transform, const Vector &vector, float scale); + static Vector rotateScale_l2p(const Transform &transform, const Vector &vector, float scale); + + static void skinPositionNormal_l2p(const Transform &transform, const Vector &position, const Vector &normal, float scale, Vector &destPosition, Vector &destNormal); + static void skinPositionNormalAdd_l2p(const Transform &transform, const Vector &position, const Vector &normal, float scale, Vector &destPosition, Vector &destNormal); + static void prefetch(void const * const sourceData, size_t const objectSize); +}; + +// ---------------------------------------------------------------------- + +inline void SseMath::prefetch(void const * const sourceData, size_t const objectSize) +{ +#if defined(_MSC_VER) + _asm + { + mov esi, sourceData + prefetchnta objectSize[esi] + } +#else + // rls - add linux version here. + UNREF(sourceData); + UNREF(objectSize); +#endif +} + +// ====================================================================== + +#endif diff --git a/engine/shared/library/sharedMemoryManager/src/win32/OsMemory.cpp b/engine/shared/library/sharedMemoryManager/src/win32/OsMemory.cpp new file mode 100755 index 00000000..a6ad6331 --- /dev/null +++ b/engine/shared/library/sharedMemoryManager/src/win32/OsMemory.cpp @@ -0,0 +1,56 @@ +// ====================================================================== +// +// OsMemory.cpp +// +// Copyright 2002 Sony Online Entertainment +// +// ====================================================================== + +#include "sharedMemoryManager/FirstSharedMemoryManager.h" +#include "sharedMemoryManager/OsMemory.h" + +// ====================================================================== + +void OsMemory::install() +{ +} + +// ---------------------------------------------------------------------- + +void OsMemory::remove() +{ +} + +// ---------------------------------------------------------------------- + +void *OsMemory::reserve(size_t bytes) +{ + return VirtualAlloc(0, bytes, MEM_RESERVE, PAGE_READWRITE); +} + +// ---------------------------------------------------------------------- + +void *OsMemory::commit(void *addr, size_t bytes) +{ + return VirtualAlloc(addr, bytes, MEM_COMMIT, PAGE_READWRITE); +} + +// ---------------------------------------------------------------------- + +bool OsMemory::free(void *addr, size_t bytes) +{ + UNREF(bytes); + return VirtualFree(addr, 0, MEM_RELEASE) ? true : false; +} + +// ---------------------------------------------------------------------- + +bool OsMemory::protect(void *addr, size_t bytes, bool allowAccess) +{ + DWORD old; + BOOL result = VirtualProtect(addr, bytes, allowAccess ? PAGE_READWRITE : PAGE_NOACCESS, &old); + return result ? true : false; +} + +// ====================================================================== + diff --git a/engine/shared/library/sharedMemoryManager/src/win32/OsMemory.h b/engine/shared/library/sharedMemoryManager/src/win32/OsMemory.h new file mode 100755 index 00000000..07ff6918 --- /dev/null +++ b/engine/shared/library/sharedMemoryManager/src/win32/OsMemory.h @@ -0,0 +1,29 @@ +// ====================================================================== +// +// OsMemory.h +// +// Copyright 2002 Sony Online Entertainment +// +// ====================================================================== + +#ifndef INCLUDED_OsMemory_H +#define INCLUDED_OsMemory_H + +// ====================================================================== + +class OsMemory +{ +public: + static void install(); + static void remove(); + + static void * reserve(size_t bytes); + static void * commit(void *addr, size_t bytes); + static bool free(void *addr, size_t bytes); + static bool protect(void *addr, size_t bytes, bool allowAccess); +}; + +// ====================================================================== + +#endif INCLUDED_OsMemory_H + diff --git a/engine/shared/library/sharedMemoryManager/src/win32/OsNewDel.cpp b/engine/shared/library/sharedMemoryManager/src/win32/OsNewDel.cpp new file mode 100755 index 00000000..c6569707 --- /dev/null +++ b/engine/shared/library/sharedMemoryManager/src/win32/OsNewDel.cpp @@ -0,0 +1,211 @@ +// ====================================================================== +// +// OsNewDel.cpp +// +// Copyright 2002 Sony Online Entertainment +// +// ====================================================================== + +#include "sharedMemoryManager/FirstSharedMemoryManager.h" +#include "sharedMemoryManager/OsNewDel.h" + +// ====================================================================== + +// this is here because MSVC won't call MemoryManager::allocate() from asm directly +static void * __cdecl localAllocate(size_t size, uint32 owner, bool array, bool leakTest) +{ + return MemoryManager::allocate(size, owner, array, leakTest); +} + +// ---------------------------------------------------------------------- + +// We are using the arguments (except for file and line), but MSVC can't tell that. +#pragma warning(disable: 4100) + +// ---------------------------------------------------------------------- + +__declspec(naked) void *operator new(size_t size, MemoryManagerNotALeak) +{ + _asm + { + // setup local call stack + push ebp + mov ebp, esp + + // MemoryManager::alloc(size, [return address], false, false) + push 0 + push 0 + mov eax, dword ptr [ebp+4] + push eax + mov eax, dword ptr [ebp+8] + push eax + call localAllocate + add esp, 12 + + mov esp, ebp + pop ebp + ret + } +} + +// ---------------------------------------------------------------------- + +__declspec(naked) void *operator new(size_t size) +{ + _asm + { + // setup local call stack + push ebp + mov ebp, esp + + // MemoryManager::alloc(size, [return address], false, true) + push 1 + push 0 + mov eax, dword ptr [ebp+4] + push eax + mov eax, dword ptr [ebp+8] + push eax + call localAllocate + add esp, 12 + + mov esp, ebp + pop ebp + ret + } +} + +// ---------------------------------------------------------------------- + +__declspec(naked) void *operator new[](size_t size) +{ + _asm + { + // setup local call stack + push ebp + mov ebp, esp + + // MemoryManager::alloc(size, [return address], true, true) + push 1 + push 1 + mov eax, dword ptr [ebp+4] + push eax + mov eax, dword ptr [ebp+8] + push eax + call localAllocate + add esp, 12 + + mov esp, ebp + pop ebp + ret + } +} + +// ---------------------------------------------------------------------- + +__declspec(naked) void *operator new(size_t size, const char *file, int line) +{ + _asm + { + // setup local call stack + push ebp + mov ebp, esp + + // MemoryManager::alloc(size, [return address], false, true) + push 1 + push 0 + mov eax, dword ptr [ebp+4] + push eax + mov eax, dword ptr [ebp+8] + push eax + call localAllocate + add esp, 12 + + mov esp, ebp + pop ebp + ret + } +} + +// ---------------------------------------------------------------------- + +__declspec(naked) void *operator new[](size_t size, const char *file, int line) +{ + _asm + { + // setup local call stack + push ebp + mov ebp, esp + + // MemoryManager::alloc(size, [return address], true, true) + push 1 + push 1 + mov eax, dword ptr [ebp+4] + push eax + mov eax, dword ptr [ebp+8] + push eax + call localAllocate + add esp, 12 + + mov esp, ebp + pop ebp + ret + } +} + +// ---------------------------------------------------------------------- + +#pragma warning(default: 4100) + +// ---------------------------------------------------------------------- + +void operator delete(void *pointer) +{ + if (pointer) + MemoryManager::free(pointer, false); +} + +// ---------------------------------------------------------------------- + +void operator delete[](void *pointer) +{ + if (pointer) + MemoryManager::free(pointer, true); +} + +// ---------------------------------------------------------------------- + +void operator delete(void *pointer, const char *file, int line) +{ + UNREF(file); + UNREF(line); + + if (pointer) + MemoryManager::free(pointer, false); +} + +// ---------------------------------------------------------------------- + +void operator delete[](void *pointer, const char *file, int line) +{ + UNREF(file); + UNREF(line); + + if (pointer) + MemoryManager::free(pointer, true); +} + +// ====================================================================== +// WARNING!!!!!!! +// +// The init_seg pragma command is used to create certain static objects first, before other static objects are created. +// However, multiple static variables that use the same init_seg category(i.e. compiler) are not guaranteed to destroy in any +// particular order. It is completely random based on how all the linking of static objects occurs. Since this command is being +// used on our memory manager(to overwrite new/delete) - NO OTHER STATIC SHOULD EVER USE INIT_SEG(COMPILER)!!!! This static object +// *MUST* be the final static object that is destroyed. +// +#pragma warning(disable: 4074) +#pragma init_seg(compiler) // ^-Read warning above.-^ +static MemoryManager memoryManager; + +// ====================================================================== + diff --git a/engine/shared/library/sharedMemoryManager/src/win32/OsNewDel.h b/engine/shared/library/sharedMemoryManager/src/win32/OsNewDel.h new file mode 100755 index 00000000..477a6674 --- /dev/null +++ b/engine/shared/library/sharedMemoryManager/src/win32/OsNewDel.h @@ -0,0 +1,52 @@ +// ====================================================================== +// +// OsNewDel.h +// +// Copyright 2002 Sony Online Entertainment +// +// ====================================================================== + +#ifndef INCLUDED_OsNewDel_H +#define INCLUDED_OsNewDel_H + +// ====================================================================== + +enum MemoryManagerNotALeak +{ + MM_notALeak +}; + +void * __cdecl operator new(size_t size, MemoryManagerNotALeak); +void * __cdecl operator new(size_t size); +void * __cdecl operator new[](size_t size); +void * __cdecl operator new(size_t size, char const *file, int line); +void * __cdecl operator new[](size_t size, char const *file, int line); +void * __cdecl operator new(size_t size, void *placement); + +void operator delete(void *pointer); +void operator delete[](void *pointer); +void operator delete(void *pointer, char const *file, int line); +void operator delete[](void *pointer, char const *file, int line); +void operator delete(void *pointer, void *placement); + +#ifndef __PLACEMENT_NEW_INLINE +#define __PLACEMENT_NEW_INLINE + +inline void *operator new(size_t size, void *placement) +{ + static_cast(size); + return placement; +} + +inline void operator delete(void *pointer, void *placement) +{ + static_cast(pointer); + static_cast(placement); +} + +#endif // __PLACEMENT_NEW_INLINE + +// ====================================================================== + +#endif INCLUDED_OsNewDel_H + diff --git a/engine/shared/library/sharedMessageDispatch/src/win32/FirstSharedMessageDispatch.cpp b/engine/shared/library/sharedMessageDispatch/src/win32/FirstSharedMessageDispatch.cpp new file mode 100755 index 00000000..c2403b0f --- /dev/null +++ b/engine/shared/library/sharedMessageDispatch/src/win32/FirstSharedMessageDispatch.cpp @@ -0,0 +1,8 @@ +// ====================================================================== +// +// FirstMessageDispatch.cpp +// copyright (c) 2001 Sony Online Entertainment +// +// ====================================================================== + +#include "sharedMessageDispatch/FirstSharedMessageDispatch.h" diff --git a/engine/shared/library/sharedNetwork/src/win32/Address.cpp b/engine/shared/library/sharedNetwork/src/win32/Address.cpp new file mode 100755 index 00000000..0d4b0b2a --- /dev/null +++ b/engine/shared/library/sharedNetwork/src/win32/Address.cpp @@ -0,0 +1,410 @@ +// Address.cpp +// Copyright 2000-02, Sony Online Entertainment Inc., all rights reserved. + +//--------------------------------------------------------------------- + +#include "sharedNetwork/FirstSharedNetwork.h" +#include "sharedNetwork/Address.h" + +#include +#include + +//--------------------------------------------------------------------- +/** + @brief Construct an empty address (INADDR_ANY) + + @author Justin Randall +*/ +Address::Address() : +addr4(new struct sockaddr_in), +hostAddress("0.0.0.0") +{ + memset(addr4, 0, sizeof(struct sockaddr_in)); + addr4->sin_family = AF_INET; +} + +//--------------------------------------------------------------------- +/** + @brief construct an address from a human readable dotted-decimal + host address and port + + Care should be taken when using this constructor. It could potentially + invoke gethostbyname() and block while the resolver returns a + valid ip address. + + @author Justin Randall + + @todo Add a static resolver cache to Address to reduce potential + calls to gethostbyname() +*/ +Address::Address(const std::string & newHostAddress, const unsigned short newHostPort) : +addr4(new struct sockaddr_in), +hostAddress(newHostAddress) +{ + HOSTENT * h; + unsigned long u; + + memset(addr4, 0, sizeof(struct sockaddr_in)); + addr4->sin_port = htons(newHostPort); + addr4->sin_family = AF_INET; + // was an address supplied? + if(hostAddress.size() > 0) + { + // Is the first byte a number? (IP names begin with an alpha) + if(!isdigit(hostAddress[0])) + { + // The first byte is a letter, resolve it + if( (h = gethostbyname(hostAddress.c_str())) != 0) + { + int i = 0; + while (h->h_addr_list[i] != 0) { + memcpy(&addr4->sin_addr, h->h_addr_list[i++], sizeof(addr4->sin_addr)); + //addr4->sin_addr = *(u_long *) h->h_addr_list[i++]; + //printf("\tIP Address #%d: %s\n", i, inet_ntoa(addr)); + } + //memcpy(&addr4->sin_addr, h->h_addr_list[0], sizeof(addr4->sin_addr)); + } + else + { + // boom! grab the entry from the h_addr member instead! + if( (h = gethostbyname(hostAddress.c_str())) != 0) + { + memcpy(&addr4->sin_addr, h->h_addr, sizeof(addr4->sin_addr)); + } + else + { + // no resolution, INADDR_ANY + // could be that the network needs a kick in the ass + memset(&addr4->sin_addr, 0, sizeof(addr4->sin_addr)); + } + } + + // extract IP bytes from ipv4add4 + const unsigned char * ip; + char name[17] = {"\0"}; + + ip = reinterpret_cast(&addr4->sin_addr); + _snprintf(name, 17, "%u.%u.%u.%u", ip[0], ip[1], ip[2], ip[3]); //lint !e534 + hostAddress = name; + } + else + { + // A dotted decimal ip number string was supplied. Convert for sin_addr + u = inet_addr(hostAddress.c_str()); + memcpy(&addr4->sin_addr, &u, sizeof(addr4->sin_addr)); + } + } + else + { + // nothing was supplied, assign INADDR_ANY + addr4->sin_addr.s_addr = INADDR_ANY; + } + convertFromSockAddr(*addr4); +} + +//--------------------------------------------------------------------- +/** + @brief Address copy constructor + + @author Justin Randall +*/ +Address::Address(const Address & source) : +addr4(new struct sockaddr_in), +hostAddress(source.hostAddress) +{ + *addr4 = *source.addr4; +} + +//--------------------------------------------------------------------- +/** + @brief Constructs an address from a BSD sockaddr structure + + @author Justin Randall +*/ +Address::Address(const struct sockaddr_in & ipv4addr) : +addr4(new struct sockaddr_in), +hostAddress() +{ + convertFromSockAddr(ipv4addr); +} + +//--------------------------------------------------------------------- +/** + @brief Destroy an address + + @author Justin Randall +*/ +Address::~Address() +{ + delete addr4; +} + +//--------------------------------------------------------------------- +/** + @brief Aassign an address to anothe address +*/ +Address & Address::operator = (const Address & rhs) +{ + if(this != &rhs) + { + hostAddress = rhs.hostAddress; + *addr4 = *rhs.addr4; + } + return *this; +} + +//--------------------------------------------------------------------- +/** + @brief Assign an address to a BSD sockaddr_in structure + + @author Justin Randall +*/ +Address & Address::operator = (const struct sockaddr_in & rhs) +{ + convertFromSockAddr(rhs); + return *this; +} + +//--------------------------------------------------------------------- + +void Address::convertFromSockAddr(const struct sockaddr_in & source) +{ + // extract IP bytes from ipv4add4 + const unsigned char * ip; + char name[17] = {"\0"}; + + ip = reinterpret_cast(&source.sin_addr); + _snprintf(name, 17, "%u.%u.%u.%u", ip[0], ip[1], ip[2], ip[3]); //lint !e534 + hostAddress = name; + if(addr4 != &source) + *addr4 = source; +} + +//--------------------------------------------------------------------- +/** + @brief get a human readable host address + + Example: + \code + void foo(struct sockaddr_in & a) + { + Address b(a); + printf("address = %%s\\n", b.getHostAddress().c_str()); + } + \endcode + + @return A human readable host address string + + @author Justin Randall +*/ +const std::string & Address::getHostAddress() const +{ + return hostAddress; +} + +//--------------------------------------------------------------------- +/** + @brief get the port associated with this address + + Example: + \code + void foo(struct sockaddr_in & a) + { + Address b(a); + printf("port = %%i\\n", b.getHostPort()); + } + \endcode + + @return A human readable port in host-byte order associated with + this address. + + @author Justin Randall +*/ +const unsigned short Address::getHostPort() const +{ + return ntohs(addr4->sin_port); +} + +//--------------------------------------------------------------------- +/** + @brief get the BSD sockaddr describing this address + + Example: + \code + void foo(SOCKET s, unsigned char * d, int l, const Address & a) + { + int t = sizeof(struct sockaddr_in); + sendto(s, s, l, 0, reinterpret_cast(&(a.getSockAddr4())), t); + } + \endcode + + @return a BSD sockaddr that describes this IPv4 address + + @author Justin Randall +*/ +const struct sockaddr_in & Address::getSockAddr4() const +{ + return *addr4; +} + +//--------------------------------------------------------------------- +/** + @brief equality operator + + The equality operator compares the ip address, ip port, + and address family to establish equality. + + Example: + \code + Address a("127.0.0.1", 55443); + Address b; + + b = a; + \endcode + + @return True of the right hand side is equal to this address + + @author Justin Randall +*/ +const bool Address::operator == (const Address & rhs) const +{ + return (addr4->sin_addr.s_addr == rhs.addr4->sin_addr.s_addr && + addr4->sin_family == rhs.addr4->sin_family && + addr4->sin_port == rhs.addr4->sin_port); +} + +//--------------------------------------------------------------------- +/** + @brief less-than comparison operator + + The < comparison operator compares the IP number and port. If + the IP numbers are identical, but the left hand side port is + less than the right hand side port, the operator will return + true. + + @return true if the left hand side's IP number is less than + the right hand side IP number. If the numbers are equal, it + will return true if the left hand side IP port is less + than the right hand side port. Otherwise it returns false. + + @author Justin Randall +*/ +const bool Address::operator < (const Address & rhs) const +{ + return(addr4->sin_addr.s_addr < rhs.addr4->sin_addr.s_addr || + addr4->sin_addr.s_addr == rhs.addr4->sin_addr.s_addr && + addr4->sin_port < rhs.addr4->sin_port); +} + +//--------------------------------------------------------------------- +/** + @brief inequality operator + + Leverages the equality operator, so whenever == returns true, + this returns false, and visa versa. + + @return true if the right hand side is not equal to the left + hand side. False if they are equal. + + @see Adress::operator== + + @author Justin Randall +*/ +const bool Address::operator != (const Address & rhs) const +{ + return(! (rhs == *this)); +} + +//--------------------------------------------------------------------- +/** + @brief greater-than comparison operator + + The > comparison operator compares the IP number and port. If + the IP numbers are identical, but the right hand side port is + lesser than the left hand side port, the operator will return + true. + + @return true if the left hand side's IP number is greater than + the right hand side IP number. If the numbers are equal, it + will return true if the left hand side IP port is greater + than the right hand side port. Otherwise it returns false. + + @author Justin Randall +*/ +const bool Address::operator > (const Address & rhs) const +{ + return(addr4->sin_addr.s_addr > rhs.addr4->sin_addr.s_addr || + addr4->sin_addr.s_addr == rhs.addr4->sin_addr.s_addr && + addr4->sin_port > rhs.addr4->sin_port); +} + +//--------------------------------------------------------------------- +/** + @brief a hash_map support routine + + The STL hash_map (present in most STL implementations) requires + a size_t return from a hash function to identify which bucket + a particular value should reside in. On 32 bit or better platforms + the sockaddr_in.sin_addr.s_addr member is small enough to + qualify as a hash-result, provides reasonably unique values + and is reproducable given an address input. + + Example: + \code + typedef std::hash_map AddressMap; + \endcode + + @return the ip number member of a sockaddr_in struct + + @author Justin Randall +*/ +size_t Address::hashFunction() const +{ + return addr4->sin_addr.s_addr; +} + +//--------------------------------------------------------------------- +/** + @brief STL map support routine + + STL maps (including hash_maps) require unique keys, and therefore + need to compare a key for equality with an existing target. + + The functor uses Address::operator = for the comparison. + + Example: + \code + typedef std::unordered_map AddressMap; + \endcode + + @return true if the left hand side and right hand side are equal + using Address::operator = + @see Address::operator= + +*/ +bool Address::EqualFunction::operator () (const Address & lhs, const Address & rhs) const +{ + return lhs == rhs; +} + +//--------------------------------------------------------------------- +/** + @brief STL hash_map support routine + + The HashFunction::operator() invokes Address::hashFunction to + determine an appropriate hash for the address. + + Example: + \code + typedef std::hash_map AddressMap; + \endcode + + @see Address::hashFunction + + @author Justin Randall +*/ +size_t Address::HashFunction::operator () (const Address & a) const +{ + return a.hashFunction(); +} +//--------------------------------------------------------------------- diff --git a/engine/shared/library/sharedNetwork/src/win32/FirstSharedNetwork.cpp b/engine/shared/library/sharedNetwork/src/win32/FirstSharedNetwork.cpp new file mode 100755 index 00000000..abf6e1d6 --- /dev/null +++ b/engine/shared/library/sharedNetwork/src/win32/FirstSharedNetwork.cpp @@ -0,0 +1,9 @@ +// FirstSharedNetwork.cpp +// Copyright 2000-02, Sony Online Entertainment Inc., all rights reserved. + +//----------------------------------------------------------------------- + +#include "sharedNetwork/FirstSharedNetwork.h" + +//----------------------------------------------------------------------- + diff --git a/engine/shared/library/sharedNetwork/src/win32/NetworkGetHostName.cpp b/engine/shared/library/sharedNetwork/src/win32/NetworkGetHostName.cpp new file mode 100755 index 00000000..faebb2b9 --- /dev/null +++ b/engine/shared/library/sharedNetwork/src/win32/NetworkGetHostName.cpp @@ -0,0 +1,67 @@ +// NetworkGetHostName.cpp +// Copyright 2000-02, Sony Online Entertainment Inc., all rights reserved. + +//----------------------------------------------------------------------- + +#include "sharedNetwork/FirstSharedNetwork.h" + +#include "sharedNetwork/Address.h" +#include "sharedNetwork/NetworkHandler.h" + +#include + +//----------------------------------------------------------------------- + +struct HN +{ + HN(); + std::string hostName; +}; + +//----------------------------------------------------------------------- + +HN::HN() +{ + WSADATA wsaData; + int iResult = WSAStartup(MAKEWORD(2, 2), &wsaData); + char name[512] = {"\0"}; + if(gethostname(name, sizeof(name)) == 0) + { + Address a(name, 0); + hostName = a.getHostAddress();//name; + } +} + +//----------------------------------------------------------------------- + +const std::string & NetworkHandler::getHostName() +{ + static HN hn; + return hn.hostName; +} + +const std::string & NetworkHandler::getHumanReadableHostName() +{ + char name[512] = {"\0"}; + static std::string nameString; + if(nameString.empty()) + { + if(gethostname(name, sizeof(name)) == 0) + { + name[sizeof(name) - 1] = 0; + //hostName = name; + nameString = name; + } + } + return nameString; +} + +//----------------------------------------------------------------------- + +const std::vector > & NetworkHandler::getInterfaceAddresses() +{ + static std::vector > s; + return s; +} + +//----------------------------------------------------------------------- diff --git a/engine/shared/library/sharedNetwork/src/win32/OverlappedTcp.cpp b/engine/shared/library/sharedNetwork/src/win32/OverlappedTcp.cpp new file mode 100755 index 00000000..c79c5b50 --- /dev/null +++ b/engine/shared/library/sharedNetwork/src/win32/OverlappedTcp.cpp @@ -0,0 +1,85 @@ +// OverlappedTcp.cpp +// Copyright 2000-02, Sony Online Entertainment Inc., all rights reserved. +// Author: Justin Randall + +//----------------------------------------------------------------------- + +#include "sharedNetwork/FirstSharedNetwork.h" +#include "OverlappedTcp.h" +#include +#include "TcpClient.h" +#include "TcpServer.h" + +//--------------------------------------------------------------------- + +OverlappedTcp::~OverlappedTcp() +{ + delete[] m_acceptData; + delete[] m_recvBuf.buf; +} + +//--------------------------------------------------------------------- + +struct OverlappedFreeList +{ + ~OverlappedFreeList(); + std::vector allOverlapped; + std::vector freeOverlapped; +}; + +//--------------------------------------------------------------------- + +OverlappedFreeList::~OverlappedFreeList() +{ + std::vector::const_iterator i; + for(i = allOverlapped.begin(); i != allOverlapped.end(); ++i) + { + OverlappedTcp * t = (*i); + delete t; + } +} + +//--------------------------------------------------------------------- + +OverlappedFreeList overlappedFreeList; + +//--------------------------------------------------------------------- + +OverlappedTcp * getFreeOverlapped() +{ + OverlappedTcp * result = NULL; + + if(! overlappedFreeList.freeOverlapped.empty()) + { + result = overlappedFreeList.freeOverlapped.back(); + overlappedFreeList.freeOverlapped.pop_back(); + } + else + { + result = new OverlappedTcp; + result->m_bytes = 0; + memset(&result->m_overlapped, 0, sizeof(OVERLAPPED)); + result->m_recvBuf.buf = new char[1024]; + result->m_recvBuf.len = 1024; + result->m_tcpClient = 0; + result->m_tcpServer = 0; + result->m_acceptData = 0; + overlappedFreeList.allOverlapped.push_back(result); + } + return result; +} + +//--------------------------------------------------------------------- + +void releaseOverlapped(OverlappedTcp * o) +{ + o->m_bytes = 0; + o->m_tcpClient = 0; + o->m_tcpServer = 0; + o->m_acceptData = 0; + memset(&o->m_overlapped, 0, sizeof(OVERLAPPED)); + overlappedFreeList.freeOverlapped.push_back(o); +} + +//----------------------------------------------------------------------- + diff --git a/engine/shared/library/sharedNetwork/src/win32/OverlappedTcp.h b/engine/shared/library/sharedNetwork/src/win32/OverlappedTcp.h new file mode 100755 index 00000000..c852ab60 --- /dev/null +++ b/engine/shared/library/sharedNetwork/src/win32/OverlappedTcp.h @@ -0,0 +1,47 @@ +// OverlappedTcp.h +// Copyright 2000-02, Sony Online Entertainment Inc., all rights reserved. +// Author: Justin Randall + +#ifndef _INCLUDED_OverlappedTcp_H +#define _INCLUDED_OverlappedTcp_H + +//----------------------------------------------------------------------- + +#include + +//----------------------------------------------------------------------- + +class TcpClient; +class TcpServer; + +//----------------------------------------------------------------------- + +struct OverlappedTcp +{ + ~OverlappedTcp(); + OVERLAPPED m_overlapped; + + enum OPERATIONS + { + INVALID, + ACCEPT, + SEND, + RECV + }; + + unsigned char * m_acceptData; // getting peer name during accept + DWORD m_bytes; + enum OPERATIONS m_operation; + const TcpServer * m_tcpServer; + TcpClient * m_tcpClient; // accepted sock when operation is accept + WSABUF m_recvBuf; +}; + +//--------------------------------------------------------------------- + +OverlappedTcp * getFreeOverlapped(); +void releaseOverlapped(OverlappedTcp *); + +//----------------------------------------------------------------------- + +#endif // _INCLUDED_OverlappedTcp_H diff --git a/engine/shared/library/sharedNetwork/src/win32/Sock.cpp b/engine/shared/library/sharedNetwork/src/win32/Sock.cpp new file mode 100755 index 00000000..663f6af4 --- /dev/null +++ b/engine/shared/library/sharedNetwork/src/win32/Sock.cpp @@ -0,0 +1,366 @@ +// Sock.cpp +// Copyright 2000-02, Sony Online Entertainment Inc., all rights reserved. + +//--------------------------------------------------------------------- + +#include "sharedNetwork/FirstSharedNetwork.h" +#include "sharedNetwork/Sock.h" + +#include + +struct WinsockStartupObject +{ + WinsockStartupObject(); + ~WinsockStartupObject(); +}; + +WinsockStartupObject::WinsockStartupObject() +{ + WSADATA wsaData; + WORD wVersionRequested; + + wVersionRequested = MAKEWORD(2,0); + int err; + err = WSAStartup(wVersionRequested, &wsaData); +} + +WinsockStartupObject::~WinsockStartupObject() +{ + WSACleanup(); +} + +WinsockStartupObject wso; + +//--------------------------------------------------------------------- +/** + @brief construct a Sock + + This constructor sets handle to INVALID_SOCKET, lastError to + Sock::SOCK_NO_ERROR and the bindAddress to the default Address. + + @see Address + + @author Justin Randall +*/ +Sock::Sock() : +handle(INVALID_SOCKET), +lastError(Sock::SOCK_NO_ERROR), +bindAddress() +{ +} + +//--------------------------------------------------------------------- +/** + @brief destroy the Sock object + + checks for a valid socket close. It is an error to close a socket + that will fail a close operation. + + Also resets handle to INVALID_SOCKET + + @author Justin Randall +*/ +Sock::~Sock() +{ + // ensure we don't block, and that pending + // data is sent with a graceful shutdown + int err; + err = closesocket(handle); + if(err == SOCKET_ERROR) + { + OutputDebugString(getLastError().c_str()); + } + handle = INVALID_SOCKET; +} + +//--------------------------------------------------------------------- +/** + @brief Bind the socket to the specified local address +*/ +bool Sock::bind(const Address & newBindAddress) +{ + bool result = false; + + int enable = 1; + setsockopt(handle, SOL_SOCKET, SO_REUSEADDR, reinterpret_cast(&enable), sizeof(enable)); + + bindAddress = newBindAddress; + int namelen = sizeof(struct sockaddr_in); + int err = ::bind(handle, reinterpret_cast(&(bindAddress.getSockAddr4())), namelen); + if(err == 0) + { + result = true; + struct sockaddr_in a; + int r; + r = getsockname(handle, reinterpret_cast(&a), &namelen); + bindAddress = a; + } + else + { + result = false; + OutputDebugString(getLastError().c_str()); + OutputDebugString("\n"); + } + return result; +} + +//--------------------------------------------------------------------- +/** + @brief bind the socket to the first available local address + as provided by the operating system. + + This bind call is useful for client sockets, or server sockets that + can report their new address to a locator service. + + @author Justin Randall +*/ +bool Sock::bind() +{ + bool result = false; + struct sockaddr_in a; + int namelen = sizeof(struct sockaddr_in); + memset(&a, 0, sizeof(struct sockaddr_in)); + a.sin_family = AF_INET; + a.sin_port = 0; + a.sin_addr.s_addr = INADDR_ANY; + int err = ::bind(handle, reinterpret_cast(&a), namelen); + if(err == 0) + { + result = true; + int r; + r = getsockname(handle, reinterpret_cast(&a), &namelen); + bindAddress = a; + } + return result; +} + +//--------------------------------------------------------------------- +/** + @brief determine if a socket is ready to receive + + On Win32, select is invoked. On Linux, the poll() system call is + used to deterine readability of a socket. + + @return true if the socket can read data without blocking. + + @author Justin Randall + + @todo Win32 should be using WSAEventSelect and WSAEnumNetworkEvents + if they outperform select. +*/ +bool Sock::canRecv() const +{ + struct timeval tv; + fd_set r; + + tv.tv_sec = 0; + tv.tv_usec = 0; + FD_ZERO(&r); +#pragma warning (disable : 4127) + FD_SET(handle, &r); //lint !e717 // I have no idea why MS makes this a do { .. } while(0); macro?! Pointless. + return (select(1, &r, 0, 0, &tv) > 0); +} + +//--------------------------------------------------------------------- +/** + @brief determine writeability of the socket + + Win32 systems use select, Linux use poll. + + @return true if the socket can send data without blocking. + @author Justin Randall + + @todo Win32 should be using WSAEventSelect and WSAEnumNetworkEvents + if they outperform select. +*/ +bool Sock::canSend() const +{ + struct timeval tv; + fd_set w; + + tv.tv_sec = 0; + tv.tv_usec = 0; + + FD_ZERO(&w); + FD_SET(handle, &w); //lint !e717 // I have no idea why MS makes this a do { .. } while(0); macro?! Pointless. + + return (select(1, 0, &w, 0, &tv) > 0); +} + +//--------------------------------------------------------------------- +/** + @brief determine the number of bytes pending on the socket + + Uses ioctl (ioctlsocket on win32) to determine the number + of bytes pending. + + @return the number of unread bytes pending on the socket + + @author Justin Randall +*/ +const unsigned int Sock::getInputBytesPending() const +{ + unsigned long int bytes = 0; + int err; + err = ioctlsocket(handle, FIONREAD, &bytes); //lint !e1924 (I don't know WHAT Microsoft is doing here!) + return bytes; +} + +//--------------------------------------------------------------------- +/** + @brief determine the error state of the socket + + This routine also sets the lastError member of the Sock object, which + is used to determine common errors (connection failure, connection + closed, connection reset, etc..) + + @return an STL string that describes the error state of the socket, + + @author Justin Randall +*/ +const std::string Sock::getLastError() const +{ + std::string errString; + int iErr = WSAGetLastError(); + + switch(iErr) + { + case WSAENOPROTOOPT: + errString = "Bad protocol option. An unknown, invalid or unsupported option or level was specified in a getsockopt or setsockopt call."; + break; + case WSAENETDOWN: + errString = "The network subsystem has failed."; + break; + case WSAEFAULT: + errString = "The buf parameter is not completely contained in a valid part of the user address space."; + break; + case WSAENOTCONN: + errString = "The socket is not connected."; + lastError = Sock::CONNECTION_FAILED; + break; + case WSAEINTR: + errString = "The (blocking) call was canceled through WSACancelBlockingCall."; + break; + case WSAEINPROGRESS: + errString = "A blocking Windows Sockets 1.1 call is in progress, or the service provider is still processing a callback function."; + break; + case WSAENETRESET: + errString = "The connection has been broken due to the keep-alive activity detecting a failure while the operation was in progress."; + break; + case WSAENOTSOCK: + errString = "The descriptor is not a socket."; + break; + case WSAEOPNOTSUPP: + errString = "MSG_OOB was specified, but the socket is not stream-style such as type SOCK_STREAM, out-of-band data is not supported in the communication domain associated with this socket, or the socket is unidirectional and supports only send operations."; + break; + case WSAESHUTDOWN: + errString = "The socket has been shut down; it is not possible to recv on a socket after shutdown has been invoked with how set to SD_RECEIVE or SD_BOTH."; + break; + case WSAEWOULDBLOCK: + errString = "The socket is marked as nonblocking and the receive operation would block."; + break; + case WSAEMSGSIZE: + errString = "The message was too large to fit into the specified buffer and was truncated."; + break; + case WSAEINVAL: + errString = "The socket has not been bound with bind, or an unknown flag was specified, or MSG_OOB was specified for a socket with SO_OOBINLINE enabled or (for byte stream sockets only) len was zero or negative."; + break; + case WSAECONNABORTED: + errString = "The virtual circuit was terminated due to a time-out or other failure. The application should close the socket as it is no longer usable."; + lastError = Sock::CONNECTION_RESET; + break; + case WSAETIMEDOUT: + errString = "The connection has been dropped because of a network failure or because the peer system failed to respond."; + break; + case WSAECONNRESET: + errString = "The virtual circuit was reset by the remote side executing a \"hard\" or \"abortive\" close. The application should close the socket as it is no longer usable. On a UDP datagram socket this error would indicate that a previous send operation resulted in an ICMP \"Port Unreachable\" message."; + lastError = Sock::CONNECTION_RESET; + break; + case WSAECONNREFUSED: + errString = "No connection could be made because the target machine actively refused it. This usually results from trying to connect to a service that is inactive on the foreign host - i.e. one with no server application running. "; + lastError = Sock::CONNECTION_FAILED; + break; + default: + errString = "An unknown socket error has occurred."; + break; + } + + return errString; +} + +//----------------------------------------------------------------------- +/** @brief determine the maximum message size that may be sent on this socket +*/ +const unsigned int Sock::getMaxMessageSendSize() const +{ + /* + int maxMsgSize = 400; + int optlen = sizeof(int); + int result = getsockopt(handle, SOL_SOCKET, SO_MAX_MSG_SIZE, reinterpret_cast(&maxMsgSize), &optlen); + if(result != 0) + { + int errCode = WSAGetLastError(); + switch(errCode) + { + case WSANOTINITIALISED: + OutputDebugString("A successful WSAStartup call must occur before using this function. "); + break; + case WSAENETDOWN: + OutputDebugString("The network subsystem has failed. "); + break; + case WSAEFAULT: + OutputDebugString("One of the optval or the optlen parameters is not a valid part of the user address space, or the optlen parameter is too small. "); + case WSAEINPROGRESS: + OutputDebugString("A blocking Windows Sockets 1.1 call is in progress, or the service provider is still processing a callback function. "); + break; + case WSAEINVAL: + OutputDebugString("The level parameter is unknown or invalid. "); + break; + case WSAENOPROTOOPT: + OutputDebugString("The option is unknown or unsupported by the indicated protocol family. "); + break; + case WSAENOTSOCK: + OutputDebugString("The descriptor is not a socket. "); + break; + default: + OutputDebugString("An unknown error occurred while processing getsockopt"); + break; + } + } + */ + return 400; +} + +//--------------------------------------------------------------------- +/** + @brief get a BSD sockaddr struct describing the remote address + of a socket + + @param target a BSD sockaddr struct that will receive the peer + address + @param s the socket to query for the peername + + @author Justin Randall +*/ +void Sock::getPeerName(struct sockaddr_in & target, SOCKET s) +{ + int namelen = sizeof(struct sockaddr_in); + int err; + err = getpeername(s, reinterpret_cast(&(target)), &namelen); +} + +//--------------------------------------------------------------------- +/** @brief a support routine to place the socket in non-blocking mode + + @author Justin Randall +*/ +void Sock::setNonBlocking() const +{ + unsigned long int nb = 1; + int err; + err = ioctlsocket(handle, FIONBIO, &nb); //lint !e569 // loss of precision in the FIONBIO macro, beyond my control + if(err == SOCKET_ERROR) + OutputDebugString(getLastError().c_str()); +} + +//--------------------------------------------------------------------- diff --git a/engine/shared/library/sharedNetwork/src/win32/Sock.h b/engine/shared/library/sharedNetwork/src/win32/Sock.h new file mode 100755 index 00000000..d5dbb028 --- /dev/null +++ b/engine/shared/library/sharedNetwork/src/win32/Sock.h @@ -0,0 +1,129 @@ +// ====================================================================== +// +// Sock.h +// +// Copyright 2003 Sony Online Entertainment +// +// ====================================================================== + +#ifndef INCLUDED_Sock_H +#define INCLUDED_Sock_H + +// ====================================================================== + +#include "sharedNetwork/Address.h" + +// ====================================================================== + +const unsigned int SOCK_ERROR = 0xFFFFFFFF; +typedef unsigned int SOCKET; + +/** + @brief a BSD socket abstraction + + Sock abstracts BSD sockets for platform independant operation. It + also provides common socket operations to simplify socket management. + + @see BroadcastSock + @see TcpSock + @see UdpSock + + @author Justin Randall +*/ +class Sock +{ +public: + /** + @brief failure states for a socket + */ + enum ErrorCodes + { + SOCK_NO_ERROR, + CONNECTION_FAILED, + CONNECTION_CLOSED, + CONNECTION_RESET + }; + + Sock(); + virtual ~Sock() = 0; + bool bind(const Address & bindAddress); + bool bind(); + bool canSend() const; + bool canRecv() const; + const Address & getBindAddress() const; + const SOCKET getHandle() const; + const unsigned int getInputBytesPending() const; + const std::string getLastError() const; + const enum ErrorCodes getLastErrorCode() const; + const unsigned int getMaxMessageSendSize() const; + static void getPeerName(struct sockaddr_in & target, SOCKET s); + +private: + // disabled + Sock(const Sock & source); + Sock & operator= (const Sock & source); + +protected: + void setNonBlocking() const; +protected: + int handle; + + /** + @brief support for setting/getting last error from derived + sock classes + */ + mutable enum ErrorCodes lastError; +private: + Address bindAddress; +}; + +//--------------------------------------------------------------------- +/** + @brief return the local address of the socket + + Until a socket is bound, the bind address may be reported as + 0.0.0.0:0 + + @return a const Address reference describing the local address + of the socket. + + @author Justin Randall +*/ +inline const Address & Sock::getBindAddress() const +{ + return bindAddress; +} + +//--------------------------------------------------------------------- +/** + @brief return the platform specific socket handle + + the handle returned is not portable and should only be used locally + for Sock specific operations. + + @author Justin Randall +*/ +inline const SOCKET Sock::getHandle() const +{ + return handle; +} + +//--------------------------------------------------------------------- +/** + @brief get the last error code on the socket + + @return the last error code on the socket + + @see Sock::ErrorCodes + + @author Justin Randall +*/ +inline const enum Sock::ErrorCodes Sock::getLastErrorCode() const +{ + return lastError; +} + +//--------------------------------------------------------------------- + +#endif // _Sock_H + diff --git a/engine/shared/library/sharedNetwork/src/win32/TcpClient.cpp b/engine/shared/library/sharedNetwork/src/win32/TcpClient.cpp new file mode 100755 index 00000000..22c9d992 --- /dev/null +++ b/engine/shared/library/sharedNetwork/src/win32/TcpClient.cpp @@ -0,0 +1,631 @@ +// TcpClient.cpp +// Copyright 2000-02, Sony Online Entertainment Inc., all rights reserved. +// Author: Justin Randall + +//----------------------------------------------------------------------- + +#include "sharedNetwork/FirstSharedNetwork.h" +#include "Archive/Archive.h" +#include "Archive/ByteStream.h" +#include "sharedFoundation/Clock.h" +#include "sharedNetwork/Address.h" +#include "sharedNetwork/ConfigSharedNetwork.h" +#include "sharedNetwork/Connection.h" +#include "sharedNetwork/Service.h" +#include "OverlappedTcp.h" +#include "TcpClient.h" +#include +#include + +//----------------------------------------------------------------------- + +const unsigned long KEEPALIVE_MS = 1000; + +//----------------------------------------------------------------------- + +namespace TcpClientNamespace +{ + std::set s_pendingConnectionSends; + std::set s_pendingConnectionRemoves; + std::set s_tcpClients; + QOS s_sqos; + QOS s_gqos; +} + +using namespace TcpClientNamespace; + +//----------------------------------------------------------------------- + +TcpClient::TcpClient(HANDLE parentIOCP) : +m_connectEvent(INVALID_HANDLE_VALUE), +m_socket(), +m_tcpServer(0), +m_localIOCP(INVALID_HANDLE_VALUE), +m_pendingSend(), +m_connection(0), +m_refCount(0), +m_connected(false), +m_ownHandle(false), +m_lastSendTime(0), +m_bindPort(0), +m_rawTCP( false ) +{ + static PROTOENT * p = getprotobyname ("tcp"); + if (p) + { + static int entry = p->p_proto; + m_socket = WSASocket (AF_INET, SOCK_STREAM, entry, NULL, 0, WSA_FLAG_OVERLAPPED); + char optval = 1; + setsockopt(m_socket, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval)); + setsockopt(m_socket, IPPROTO_TCP, TCP_NODELAY, &optval, sizeof(optval)); + unsigned long opt = 1; + ioctlsocket(m_socket, FIONBIO, &opt); + + struct sockaddr_in bindAddr; + int addrLen = sizeof(struct sockaddr_in); + if(getsockname(m_socket, reinterpret_cast(&bindAddr), &addrLen) == 0) + { + m_bindPort = ntohs(bindAddr.sin_port); + } + + m_localIOCP = CreateIoCompletionPort (reinterpret_cast (m_socket), parentIOCP, 0, 0); + queueReceive(); + } + s_tcpClients.insert(this); +} + +//----------------------------------------------------------------------- + +TcpClient::TcpClient(const std::string & remoteAddress, const unsigned short remotePort) : +m_connectEvent(INVALID_HANDLE_VALUE), +m_socket(), +m_localIOCP(INVALID_HANDLE_VALUE), +m_connection(0), +m_refCount(0), +m_connected(false), +m_ownHandle(true), +m_lastSendTime(0), +m_rawTCP( false ) +{ + static PROTOENT * p = getprotobyname ("tcp"); + if (p) + { + static int entry = p->p_proto; + m_socket = WSASocket (AF_INET, SOCK_STREAM, entry, NULL, 0, WSA_FLAG_OVERLAPPED); + if (m_socket != INVALID_SOCKET) + { + int nameLen = sizeof (struct sockaddr_in); + static WSABUF emptyBuf; + emptyBuf.buf = 0; + emptyBuf.len = 0; + + Address a(remoteAddress, remotePort); + char optval = 1; + setsockopt(m_socket, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval)); + setsockopt(m_socket, IPPROTO_TCP, TCP_NODELAY, &optval, sizeof(optval)); + unsigned long opt = 1; + ioctlsocket(m_socket, FIONBIO, &opt); + + int result; + result = WSAConnect (m_socket, reinterpret_cast (&a.getSockAddr4 () ), nameLen, 0, &emptyBuf, &s_sqos, &s_gqos); + m_connectEvent = WSACreateEvent (); + WSAEventSelect (m_socket, m_connectEvent, FD_CONNECT); + m_localIOCP = CreateIoCompletionPort (reinterpret_cast (m_socket), 0, 0, 0); + struct sockaddr_in bindAddr; + int addrLen = sizeof(struct sockaddr_in); + if(getsockname(m_socket, reinterpret_cast(&bindAddr), &addrLen) == 0) + { + m_bindPort = ntohs(bindAddr.sin_port); + } + + } + } + s_tcpClients.insert(this); +} + +//----------------------------------------------------------------------- + +TcpClient::~TcpClient() +{ + s_pendingConnectionRemoves.insert(this); + std::set::iterator f = s_tcpClients.find(this); + if(f != s_tcpClients.end()) + s_tcpClients.erase(f); + + closesocket (m_socket); + if(m_ownHandle) + CloseHandle(m_localIOCP); +} + +//----------------------------------------------------------------------- + +void TcpClient::addRef() +{ + m_refCount++; +} + +//----------------------------------------------------------------------- + +unsigned short TcpClient::getBindPort() const +{ + return m_bindPort; +} + +//----------------------------------------------------------------------- + +std::string const &TcpClient::getRemoteAddress() const +{ + // TODO: implement this + static std::string dummy; + return dummy; +} + +//----------------------------------------------------------------------- + +unsigned short TcpClient::getRemotePort() const +{ + // TODO: implement this + return 0; +} + +//----------------------------------------------------------------------- + +void TcpClient::commit(const unsigned char * const buffer, const int bufferLen) +{ + WSABUF wsaBuf; + + // yuck, docs say this is actually going to be const for the send, + // but WSABUF::buf is not const! + wsaBuf.buf = (char *)buffer; + wsaBuf.len = bufferLen; + + OverlappedTcp * op = getFreeOverlapped (); + if (op) + { + op->m_operation = OverlappedTcp::SEND; + op->m_tcpClient = const_cast(this); + int sent; + sent = WSASend (m_socket, &wsaBuf, 1, &op->m_bytes, 0, &op->m_overlapped, NULL); + if(sent == SOCKET_ERROR) + { + int errCode = WSAGetLastError(); + char * err; + if(errCode != WSA_IO_PENDING) + { + switch(errCode) + { + case WSANOTINITIALISED: + err = "A successful WSAStartup must occur before using this function."; + break; + case WSAENETDOWN: + err = "The network subsystem has failed."; + break; + case WSAENOTCONN: + err = "The socket is not connected."; + break; + case WSAEINTR: + err = "The (blocking) call was canceled through WSACancelBlockingCall. \n"; + break; + case WSAEINPROGRESS: + err = "A blocking Windows Sockets 1.1 call is in progress, or the service provider is still processing a callback function. \n"; + break; + case WSAENETRESET: + err = "The connection has been broken due to \"keep-alive\" activity detecting a failure while the operation was in progress."; + break; + case WSAENOTSOCK: + err = "The descriptor is not a socket."; + break; + case WSAEFAULT: + err = "The lpBuffers parameter is not completely contained in a valid part of the user address space."; + break; + case WSAEOPNOTSUPP: + err = "MSG_OOB was specified, but the socket is not stream-style such as type SOCK_STREAM, out-of-band data is not supported in the communication domain associated with this socket, or the socket is unidirectional and supports only send operations."; + break; + case WSAESHUTDOWN: + err = "The socket has been shut down; it is not possible to call WSARecv on a socket after shutdown has been invoked with how set to SD_RECEIVE or SD_BOTH. \n"; + break; + case WSAEWOULDBLOCK: + err = "Overlapped sockets: There are too many outstanding overlapped I/O requests. Nonoverlapped sockets: The socket is marked as nonblocking and the receive operation cannot be completed immediately. \n"; + break; + case WSAEMSGSIZE: + err = "The message was too large to fit into the specified buffer and (for unreliable protocols only) any trailing portion of the message that did not fit into the buffer has been discarded."; + break; + case WSAEINVAL: + err = "The socket has not been bound (for example, with bind)."; + break; + case WSAECONNABORTED: + err = "The virtual circuit was terminated due to a time-out or other failure. \n"; + break; + case WSAECONNRESET: + err = "The virtual circuit was reset by the remote side. \n"; + break; + case WSAEDISCON: + err = "Socket s is message oriented and the virtual circuit was gracefully closed by the remote side. \n"; + break; + case WSA_IO_PENDING: + err = "An overlapped operation was successfully initiated and completion will be indicated at a later time. \n"; + break; + case WSA_OPERATION_ABORTED: + err = "The overlapped operation has been canceled due to the closure of the socket. \n"; + break; + default: + err = "An unknown error occured while processing WSARecv()."; + break; + } + onConnectionClosed(); + } + } + } +} + +//----------------------------------------------------------------------- + +void TcpClient::flush() +{ + if(m_connected && m_pendingSend.getSize() > 0) + { + // put it on the wire + commit(m_pendingSend.getBuffer(), m_pendingSend.getSize()); + m_pendingSend.clear (); + } +} + +//----------------------------------------------------------------------- + +void TcpClient::flushPendingWrites() +{ + std::set::iterator f; + std::set::iterator i; + for(i = s_pendingConnectionSends.begin(); i != s_pendingConnectionSends.end(); ++i) + { + if(s_pendingConnectionRemoves.empty()) + { + (*i)->flush(); + } + else + { + f = s_pendingConnectionRemoves.find((*i)); + if(f == s_pendingConnectionRemoves.end()) + (*i)->flush(); + } + } + s_pendingConnectionSends.clear(); +} + +//----------------------------------------------------------------------- + +SOCKET TcpClient::getSocket() const +{ + return m_socket; +} + +//----------------------------------------------------------------------- + +void TcpClient::install() +{ + WORD wVersionRequested = MAKEWORD(2,2); + WSADATA wsaData; + WSAStartup(wVersionRequested, &wsaData); + s_sqos.ProviderSpecific.buf = 0; + s_sqos.ProviderSpecific.len = 0; + + s_sqos.ReceivingFlowspec.DelayVariation = 0; + s_sqos.ReceivingFlowspec.Latency = 0; + s_sqos.ReceivingFlowspec.MaxSduSize = 0; + s_sqos.ReceivingFlowspec.MinimumPolicedSize = 0; + s_sqos.ReceivingFlowspec.PeakBandwidth = 0; + s_sqos.ReceivingFlowspec.ServiceType = 0; + s_sqos.ReceivingFlowspec.TokenBucketSize = 0; + s_sqos.ReceivingFlowspec.TokenRate = 0; + + s_sqos.SendingFlowspec.DelayVariation = 0; + s_sqos.SendingFlowspec.Latency = 0; + s_sqos.SendingFlowspec.MaxSduSize = 0; + s_sqos.SendingFlowspec.MinimumPolicedSize = 0; + s_sqos.SendingFlowspec.PeakBandwidth = 0; + s_sqos.SendingFlowspec.ServiceType = 0; + s_sqos.SendingFlowspec.TokenBucketSize = 0; + s_sqos.SendingFlowspec.TokenRate = 0; + + s_gqos.ProviderSpecific.buf = 0; + s_gqos.ProviderSpecific.len = 0; + + s_gqos.ReceivingFlowspec.DelayVariation = 0; + s_gqos.ReceivingFlowspec.Latency = 0; + s_gqos.ReceivingFlowspec.MaxSduSize = 0; + s_gqos.ReceivingFlowspec.MinimumPolicedSize = 0; + s_gqos.ReceivingFlowspec.PeakBandwidth = 0; + s_gqos.ReceivingFlowspec.ServiceType = 0; + s_gqos.ReceivingFlowspec.TokenBucketSize = 0; + s_gqos.ReceivingFlowspec.TokenRate = 0; + + s_gqos.SendingFlowspec.DelayVariation = 0; + s_gqos.SendingFlowspec.Latency = 0; + s_gqos.SendingFlowspec.MaxSduSize = 0; + s_gqos.SendingFlowspec.MinimumPolicedSize = 0; + s_gqos.SendingFlowspec.PeakBandwidth = 0; + s_gqos.SendingFlowspec.ServiceType = 0; + s_gqos.SendingFlowspec.TokenBucketSize = 0; + s_gqos.SendingFlowspec.TokenRate = 0; +} + +//----------------------------------------------------------------------- + +void TcpClient::onConnectionClosed() +{ + m_connected = false; + if(m_connection) + { + NetworkHandler::onTerminate(m_connection); + } +} + +//----------------------------------------------------------------------- + +void TcpClient::onConnectionOpened() +{ + m_connected = true; + queueReceive(); + flush(); + if(m_connection) + m_connection->onConnectionOpened(); +} + +//----------------------------------------------------------------------- + +void TcpClient::onReceive(const unsigned char * const buffer, const int length) +{ + queueReceive(); + if(m_connection) + { + m_connection->receive(buffer, length); + } +} + +//----------------------------------------------------------------------- + +void TcpClient::queryConnect() +{ + bool result = false; + + WSANETWORKEVENTS w; + if (WSAEnumNetworkEvents (m_socket, m_connectEvent, &w) != SOCKET_ERROR) + { + if (w.lNetworkEvents == FD_CONNECT) + { + if (w.iErrorCode[FD_CONNECT_BIT] == 0) + { + CloseHandle (m_connectEvent); + result = true; + onConnectionOpened(); + } + else + { + onConnectionClosed(); + } + } + } +} + +//----------------------------------------------------------------------- + +void TcpClient::queueReceive() +{ + OverlappedTcp * op = getFreeOverlapped(); + op->m_operation = OverlappedTcp::RECV; + op->m_tcpClient = const_cast(this); + DWORD flags = 0; + int result; + result = WSARecv(m_socket, &op->m_recvBuf, 1, &op->m_bytes, &flags, &op->m_overlapped, NULL); + + if(result == SOCKET_ERROR) + { + int errCode = WSAGetLastError(); + char * err; + if(errCode != WSA_IO_PENDING) + { + switch(errCode) + { + case WSANOTINITIALISED: + err = "A successful WSAStartup must occur before using this function."; + break; + case WSAENETDOWN: + err = "The network subsystem has failed."; + break; + case WSAENOTCONN: + err = "The socket is not connected."; + break; + case WSAEINTR: + err = "The (blocking) call was canceled through WSACancelBlockingCall. \n"; + break; + case WSAEINPROGRESS: + err = "A blocking Windows Sockets 1.1 call is in progress, or the service provider is still processing a callback function. \n"; + break; + case WSAENETRESET: + err = "The connection has been broken due to \"keep-alive\" activity detecting a failure while the operation was in progress."; + break; + case WSAENOTSOCK: + err = "The descriptor is not a socket."; + break; + case WSAEFAULT: + err = "The lpBuffers parameter is not completely contained in a valid part of the user address space."; + break; + case WSAEOPNOTSUPP: + err = "MSG_OOB was specified, but the socket is not stream-style such as type SOCK_STREAM, out-of-band data is not supported in the communication domain associated with this socket, or the socket is unidirectional and supports only send operations."; + break; + case WSAESHUTDOWN: + err = "The socket has been shut down; it is not possible to call WSARecv on a socket after shutdown has been invoked with how set to SD_RECEIVE or SD_BOTH. \n"; + break; + case WSAEWOULDBLOCK: + err = "Overlapped sockets: There are too many outstanding overlapped I/O requests. Nonoverlapped sockets: The socket is marked as nonblocking and the receive operation cannot be completed immediately. \n"; + break; + case WSAEMSGSIZE: + err = "The message was too large to fit into the specified buffer and (for unreliable protocols only) any trailing portion of the message that did not fit into the buffer has been discarded."; + break; + case WSAEINVAL: + err = "The socket has not been bound (for example, with bind)."; + break; + case WSAECONNABORTED: + err = "The virtual circuit was terminated due to a time-out or other failure. \n"; + break; + case WSAECONNRESET: + err = "The virtual circuit was reset by the remote side. \n"; + break; + case WSAEDISCON: + err = "Socket s is message oriented and the virtual circuit was gracefully closed by the remote side. \n"; + break; + case WSA_IO_PENDING: + err = "An overlapped operation was successfully initiated and completion will be indicated at a later time. \n"; + break; + case WSA_OPERATION_ABORTED: + err = "The overlapped operation has been canceled due to the closure of the socket. \n"; + break; + default: + err = "An unknown error occured while processing WSARecv()."; + break; + } + } + } +} + +//----------------------------------------------------------------------- + +void TcpClient::send(const unsigned char * const buffer, const int length) +{ + if (length) + { + m_lastSendTime = Clock::getFrameStartTimeMs(); + s_pendingConnectionSends.insert(this); + if( !m_rawTCP ) + Archive::put(m_pendingSend, length); + m_pendingSend.put(buffer, length); + + static int const tcpMinimumFrame = ConfigSharedNetwork::getTcpMinimumFrame(); + if (static_cast(m_pendingSend.getSize()) >= tcpMinimumFrame) + flush(); + } +} + +//----------------------------------------------------------------------- + +void TcpClient::setConnection(Connection * c) +{ + m_connection = c; +} + +//--------------------------------------------------------------------- + +void TcpClient::update() +{ + OVERLAPPED * overlapped = 0; + OverlappedTcp * op = 0; + unsigned long int bytesTransferred = 0; + unsigned long int completionKey = 0; + bool success = false; + + if (m_connected) + { + unsigned long timeNow = Clock::getFrameStartTimeMs(); + if (timeNow-m_lastSendTime > KEEPALIVE_MS) + { + m_lastSendTime = timeNow; + s_pendingConnectionSends.insert(this); + Archive::put(m_pendingSend, 0); + } + } + + if(! m_connected) + queryConnect(); + + //PlatformTcpClient::queryConnects(); + do + { + success = false; + int ok = GetQueuedCompletionStatus( + m_localIOCP, // completion port of interest + &bytesTransferred, // number of bytes sent or received + &completionKey, + &overlapped, + 0 // timeout immediately if there are no completions + ); + if(ok) + { + op = reinterpret_cast(overlapped); + if(op) + { + switch(op->m_operation) + { + case OverlappedTcp::RECV: + { + if(op->m_tcpClient != 0) + { + if(bytesTransferred > 0) + { + op->m_tcpClient->onReceive((const unsigned char * const)op->m_recvBuf.buf, bytesTransferred); + success = true; + } + } + } + + break; + case OverlappedTcp::SEND: + success = true; + break; + default: + break; + } + releaseOverlapped(op); + } + } + } while(success); +} + +//----------------------------------------------------------------------- + +void TcpClient::setRawTCP( bool bNewValue ) +{ + m_rawTCP = bNewValue; +} + +//----------------------------------------------------------------------- + +void TcpClient::release() +{ + m_refCount--; + if(m_refCount < 1) + { + if(m_connected) + onConnectionClosed(); + delete this; + } +} + +//----------------------------------------------------------------------- + +void TcpClient::remove() +{ + std::set::iterator i; + for(i = s_tcpClients.begin(); i != s_tcpClients.end(); ++i) + { + TcpClient * c = (*i); + delete c; + } + s_tcpClients.clear(); + WSACleanup(); +} + +//----------------------------------------------------------------------- + +void TcpClient::checkKeepalive() +{ + unsigned long const timeNow = Clock::getFrameStartTimeMs(); + if (timeNow-m_lastSendTime > KEEPALIVE_MS) + { + m_lastSendTime = timeNow; + s_pendingConnectionSends.insert(this); + Archive::put(m_pendingSend, 0); + } +} + +//----------------------------------------------------------------------- + diff --git a/engine/shared/library/sharedNetwork/src/win32/TcpClient.h b/engine/shared/library/sharedNetwork/src/win32/TcpClient.h new file mode 100755 index 00000000..a83ec780 --- /dev/null +++ b/engine/shared/library/sharedNetwork/src/win32/TcpClient.h @@ -0,0 +1,87 @@ +// TcpClient.h +// Copyright 2000-02, Sony Online Entertainment Inc., all rights reserved. +// Author: Justin Randall + +#ifndef _INCLUDED_TcpClient_H +#define _INCLUDED_TcpClient_H + +//----------------------------------------------------------------------- + +#include +#include "Archive/ByteStream.h" +#include + +//----------------------------------------------------------------------- + +class Connection; + +//----------------------------------------------------------------------- + +class TcpClient +{ +public: + explicit TcpClient(HANDLE parentIOCP); + TcpClient(const std::string & address, const unsigned short port); + ~TcpClient(); + + static void install(); + static void remove(); + void send(const unsigned char * const buffer, const int length); + unsigned short getBindPort() const; + std::string const &getRemoteAddress() const; + unsigned short getRemotePort() const; + void setPendingSendAllocatedSizeLimit(unsigned int limit); + + // only used by clients + void update(); + static void flushPendingWrites(); + +protected: + friend TcpServer; + friend Connection; + + void addRef(); + void commit(const unsigned char * const buffer, const int bufferLen); + SOCKET getSocket() const; + void onConnectionClosed(); + void onConnectionOpened(); + void onReceive(const unsigned char * const recvBuf, const int bytes); + void queryConnect(); + void queueReceive(); + void release(); + void setConnection(Connection *); + + void checkKeepalive(); + void setRawTCP( bool bNewValue ); + + +private: + TcpClient & operator = (const TcpClient & rhs); + TcpClient(const TcpClient & source); + void flush (); + + WSAEVENT m_connectEvent; + SOCKET m_socket; + TcpServer * m_tcpServer; + HANDLE m_localIOCP; + Archive::ByteStream m_pendingSend; + Connection * m_connection; + int m_refCount; + bool m_connected; + bool m_ownHandle; + unsigned long m_lastSendTime; + unsigned short m_bindPort; + + bool m_rawTCP; +}; + +//----------------------------------------------------------------------- + +inline void TcpClient::setPendingSendAllocatedSizeLimit(const unsigned int limit) +{ + m_pendingSend.setAllocatedSizeLimit(limit); +} + +//----------------------------------------------------------------------- + +#endif // _INCLUDED_TcpClient_H diff --git a/engine/shared/library/sharedNetwork/src/win32/TcpServer.cpp b/engine/shared/library/sharedNetwork/src/win32/TcpServer.cpp new file mode 100755 index 00000000..17a8f5da --- /dev/null +++ b/engine/shared/library/sharedNetwork/src/win32/TcpServer.cpp @@ -0,0 +1,194 @@ +// TcpServer.cpp +// Copyright 2000-02, Sony Online Entertainment Inc., all rights reserved. +// Author: Justin Randall + +//----------------------------------------------------------------------- + +#include "sharedNetwork/FirstSharedNetwork.h" +#include +#include +#include "sharedNetwork/Address.h" +#include "sharedNetwork/Service.h" +#include "OverlappedTcp.h" +#include "TcpClient.h" +#include "TcpServer.h" + +//----------------------------------------------------------------------- + +TcpServer::TcpServer(Service * service, const std::string & bindAddress, const unsigned short bindPort) : +m_handle(), +m_localIOCP(), +m_pendingConnections(), +m_bindAddress(bindAddress), +m_bindPort(bindPort), +m_service(service) +{ + static PROTOENT * p = getprotobyname("tcp"); + if(p) + { + static int entry = p->p_proto; + m_handle = WSASocket(AF_INET, SOCK_STREAM, entry, NULL, 0, WSA_FLAG_OVERLAPPED); + if(m_handle != INVALID_SOCKET) + { + m_localIOCP = CreateIoCompletionPort(reinterpret_cast(m_handle), 0, 0, 0); + Address a(bindAddress, bindPort); + + int result = bind(m_handle, reinterpret_cast(&a.getSockAddr4()), sizeof(struct sockaddr_in)); + if(result == 0) + { + struct sockaddr_in b; + int addrlen = sizeof(struct sockaddr_in); + getsockname(m_handle, (struct sockaddr *)(&b), &addrlen); + m_bindPort = ntohs(b.sin_port); + result = listen(m_handle, 256); + queueAccept(); + } + } + } +} + +//----------------------------------------------------------------------- + +TcpServer::~TcpServer() +{ + closesocket(m_handle); + CloseHandle(m_localIOCP); +} + +//----------------------------------------------------------------------- + +TcpClient * TcpServer::accept() +{ + TcpClient * result = 0; + if(! m_pendingConnections.empty()) + { + result = m_pendingConnections.back(); + m_pendingConnections.pop_back(); + } + return result; +} + +//----------------------------------------------------------------------- + +const unsigned short TcpServer::getBindPort() const +{ + return m_bindPort; +} + +//----------------------------------------------------------------------- + +void TcpServer::onConnectionClosed(TcpClient *) +{ +} + +//----------------------------------------------------------------------- + +void TcpServer::queueAccept() +{ + OverlappedTcp * op = getFreeOverlapped(); + + // this will contain struct sockaddr data with additional + // book keeping when Windows returns an overlapped + // accept operation (nevermind that +16 or * 2, I don't have the MS + // kb article handy, but it's a gross workaround for the documented + // API and what acceptData really expects to have). + op->m_acceptData = new unsigned char[(sizeof( struct sockaddr_in ) + 16 ) * 2]; + op->m_operation = OverlappedTcp::ACCEPT; + op->m_tcpServer = this; + op->m_tcpClient = new TcpClient(m_localIOCP); + AcceptEx( + m_handle, + op->m_tcpClient->getSocket(), + op->m_acceptData, + 0, + sizeof(struct sockaddr_in) + 16, + sizeof(struct sockaddr_in) + 16, + &op->m_bytes, + &op->m_overlapped); +} + +//----------------------------------------------------------------------- + +void TcpServer::update() +{ + OVERLAPPED * overlapped = 0; + OverlappedTcp * op = 0; + unsigned long int bytesTransferred = 0; + unsigned long int completionKey = 0; + bool success = false; + + do + { + success = false; + int ok = GetQueuedCompletionStatus( + m_localIOCP, // completion port of interest + &bytesTransferred, // number of bytes sent or received + &completionKey, + &overlapped, + 0 // timeout immediately if there are no completions + ); + if(ok) + { + op = reinterpret_cast(overlapped); + if(op) + { + switch(op->m_operation) + { + case OverlappedTcp::ACCEPT: + { + if(op->m_tcpServer == this) + { + if(op->m_acceptData != 0) + { + // Extremely lame hack to keep things safe from Winsock stacktrashing + //struct sockaddr_in local; + //struct sockaddr_in remote; + //memcpy(&local, reinterpret_cast(op->m_acceptData + 10), sizeof(struct sockaddr_in)); + //memcpy(&remote, reinterpret_cast(op->m_acceptData + 38), sizeof(struct sockaddr_in)); + delete[] op->m_acceptData; + TcpClient * newClient = op->m_tcpClient; + newClient->addRef(); + newClient->onConnectionOpened(); + m_pendingConnections.push_back(newClient); + success = true; + queueAccept(); + if(m_service) + { + m_service->onConnectionOpened(newClient); + } + newClient->release(); + } + } + } + break; + case OverlappedTcp::RECV: + { + if(op->m_tcpClient != 0) + { + op->m_tcpClient->onReceive((const unsigned char * const)op->m_recvBuf.buf, bytesTransferred); + } + } + success = true; + break; + case OverlappedTcp::SEND: + success = true; + break; + default: + break; + } + releaseOverlapped(op); + } + } + } while(success); +} + +//----------------------------------------------------------------------- + +const std::string & TcpServer::getBindAddress() const +{ + return m_bindAddress; +} + +//--------------------------------------------------------------------- + + diff --git a/engine/shared/library/sharedNetwork/src/win32/TcpServer.h b/engine/shared/library/sharedNetwork/src/win32/TcpServer.h new file mode 100755 index 00000000..2ae6b934 --- /dev/null +++ b/engine/shared/library/sharedNetwork/src/win32/TcpServer.h @@ -0,0 +1,50 @@ +// TcpServer.h +// Copyright 2000-02, Sony Online Entertainment Inc., all rights reserved. +// Author: Justin Randall + +#ifndef _INCLUDED_TcpServer_H +#define _INCLUDED_TcpServer_H + +//----------------------------------------------------------------------- + +#include +#include +#include + +//----------------------------------------------------------------------- + +class Service; +class TcpClient; + +//----------------------------------------------------------------------- + +class TcpServer +{ +public: + TcpServer(Service * service, const std::string & bindAddress, const unsigned short bindPort); + ~TcpServer(); + + TcpClient * accept (); + const std::string & getBindAddress () const; + const unsigned short getBindPort () const; + void onConnectionClosed (TcpClient *); + void update (); + +private: + TcpServer & operator = (const TcpServer & rhs); + TcpServer(const TcpServer & source); + + void queueAccept (); + +private: + SOCKET m_handle; + HANDLE m_localIOCP; + std::vector m_pendingConnections; + std::string m_bindAddress; + unsigned short m_bindPort; + Service * m_service; +}; + +//----------------------------------------------------------------------- + +#endif // _INCLUDED_TcpServer_H diff --git a/engine/shared/library/sharedNetwork/src/win32/UdpSock.cpp b/engine/shared/library/sharedNetwork/src/win32/UdpSock.cpp new file mode 100755 index 00000000..05224a37 --- /dev/null +++ b/engine/shared/library/sharedNetwork/src/win32/UdpSock.cpp @@ -0,0 +1,108 @@ +// UdpSock.cpp +// Copyright 2000-02, Sony Online Entertainment Inc., all rights reserved. + +//--------------------------------------------------------------------- + +#include "sharedNetwork/FirstSharedNetwork.h" +#include "sharedNetwork/UdpSock.h" + +#include + +//--------------------------------------------------------------------- +/** + @brief construct a UdpSock object + + Allocates the socket descriptor, sets it to non-blocking mode. + + @author Justin Randall +*/ +UdpSock::UdpSock() : +Sock() +{ + handle = socket(AF_INET, SOCK_DGRAM, 0); + setNonBlocking(); +} + +//--------------------------------------------------------------------- +/** + @brief destroy the UdpSock object + + Doesn't do anything special. + + @author Justin Randall +*/ +UdpSock::~UdpSock() +{ +} + +//--------------------------------------------------------------------- +/** + @brief receive a datagram + + Receives a datagram and populates the outAddr parameter with the + source address of the message. + + Calling Sock::getInputBytesPending can provide a hint before + allocating the user supplied target buffer. + + @param outAddr target Address reference that receives + the message source IP address + @param targetBuffer a user supplied buffer to receive the data. + @param targetBufferSize the size of the user supplied buffer + + @author Justin Randall +*/ +const unsigned int UdpSock::recvFrom(Address & outAddr, void * targetBuffer, const unsigned int bufferSize) const +{ + int fromLen = sizeof(struct sockaddr_in); + struct sockaddr_in addr; + unsigned int result = ::recvfrom(handle, static_cast(targetBuffer), static_cast(bufferSize), 0, reinterpret_cast(&addr), &fromLen); //lint !e732 // MS wants an int, should be unsigned IMO + outAddr = addr; + if(result == SOCK_ERROR) + { + OutputDebugString(getLastError().c_str()); + } + return result; +} + +//--------------------------------------------------------------------- +/** + @brief send a datagram to a remote system + + sendTo sends a datagram to a remote system. + + @param targetAddress System to receive the datagram + @param sourceBuffer A user supplied buffer containint the data + to be sent + @param length The amount of data in the source buffer to + send + + @return The number of bytes sent on success + + @author Justin Randall +*/ +const unsigned int UdpSock::sendTo(const Address & targetAddress, const void * sourceBuffer, const unsigned int length) const +{ + unsigned int bytesSent = 0; + if(canSend()) + { + int toLen = sizeof(struct sockaddr_in); + bytesSent = ::sendto(handle, static_cast(sourceBuffer), static_cast(length), 0, reinterpret_cast(&(targetAddress.getSockAddr4())), toLen); //lint !e732 // MS wants an int, should be unsigned IMO + if(bytesSent != length) + { + OutputDebugString(getLastError().c_str()); + } + } + return bytesSent; +} + +//----------------------------------------------------------------------- + +void UdpSock::enableBroadcast() +{ + char optval = 1; + int err; + err = setsockopt(getHandle(), SOL_SOCKET, SO_BROADCAST, &optval, sizeof(char)); +} + +//--------------------------------------------------------------------- diff --git a/engine/shared/library/sharedNetworkMessages/src/win32/FirstSharedNetworkMessages.cpp b/engine/shared/library/sharedNetworkMessages/src/win32/FirstSharedNetworkMessages.cpp new file mode 100755 index 00000000..a5d2ce4d --- /dev/null +++ b/engine/shared/library/sharedNetworkMessages/src/win32/FirstSharedNetworkMessages.cpp @@ -0,0 +1,8 @@ +// ====================================================================== +// +// FirstNetworkMessages.cpp +// copyright (c) 2001 Sony Online Entertainment +// +// ====================================================================== + +#include "sharedNetworkMessages/FirstSharedNetworkMessages.h" diff --git a/engine/shared/library/sharedObject/src/win32/FirstSharedObject.cpp b/engine/shared/library/sharedObject/src/win32/FirstSharedObject.cpp new file mode 100755 index 00000000..4221af2e --- /dev/null +++ b/engine/shared/library/sharedObject/src/win32/FirstSharedObject.cpp @@ -0,0 +1,8 @@ +// ====================================================================== +// +// FirstObject.cpp +// copyright (c) 2001 Sony Online Entertainment +// +// ====================================================================== + +#include "sharedObject/FirstSharedObject.h" diff --git a/engine/shared/library/sharedPathfinding/src/win32/FirstSharedPathfinding.cpp b/engine/shared/library/sharedPathfinding/src/win32/FirstSharedPathfinding.cpp new file mode 100755 index 00000000..9792c261 --- /dev/null +++ b/engine/shared/library/sharedPathfinding/src/win32/FirstSharedPathfinding.cpp @@ -0,0 +1,8 @@ +// ====================================================================== +// +// FirstSharedPathfinding.cpp +// copyright (c) 2001 Sony Online Entertainment +// +// ====================================================================== + +#include "sharedPathfinding/FirstSharedPathfinding.h" diff --git a/engine/shared/library/sharedRandom/src/win32/FirstSharedRandom.cpp b/engine/shared/library/sharedRandom/src/win32/FirstSharedRandom.cpp new file mode 100755 index 00000000..1ce55673 --- /dev/null +++ b/engine/shared/library/sharedRandom/src/win32/FirstSharedRandom.cpp @@ -0,0 +1,8 @@ +// ====================================================================== +// +// FirstRandom.cpp +// copyright (c) 2001 Sony Online Entertainment +// +// ====================================================================== + +#include "sharedRandom/FirstSharedRandom.h" diff --git a/engine/shared/library/sharedRegex/src/win32/FirstSharedRegex.cpp b/engine/shared/library/sharedRegex/src/win32/FirstSharedRegex.cpp new file mode 100755 index 00000000..d219edf0 --- /dev/null +++ b/engine/shared/library/sharedRegex/src/win32/FirstSharedRegex.cpp @@ -0,0 +1,9 @@ +// ====================================================================== +// +// FirstSharedRegex.cpp +// Copyright 2003 Sony Online Entertainment, Inc. +// All Rights Reserved. +// +// ====================================================================== + +#include "sharedRegex/FirstSharedRegex.h" diff --git a/engine/shared/library/sharedRegex/src/win32/RegexServices.cpp b/engine/shared/library/sharedRegex/src/win32/RegexServices.cpp new file mode 100755 index 00000000..c12a1c67 --- /dev/null +++ b/engine/shared/library/sharedRegex/src/win32/RegexServices.cpp @@ -0,0 +1,57 @@ +// ====================================================================== +// +// RegexServices.cpp +// Copyright 2003 Sony Online Entertainment, Inc. +// All Rights Reserved. +// +// ====================================================================== + +#include "sharedRegex/FirstSharedRegex.h" +#include "sharedRegex/RegexServices.h" + +// ====================================================================== + +static void * __cdecl localAllocate(size_t size, uint32 owner, bool array, bool leakTest) +{ + return MemoryManager::allocate(size, owner, array, leakTest); +} + +static __declspec(naked) void * regexAllocate(size_t) +{ + _asm + { + // setup local call stack + push ebp + mov ebp, esp + + // MemoryManager::alloc(size, [return address], false, true) + push 1 + push 0 + mov eax, dword ptr [ebp+4] + push eax + mov eax, dword ptr [ebp+8] + push eax + call localAllocate + add esp, 12 + + mov esp, ebp + pop ebp + ret + } +} + +// ---------------------------------------------------------------------- + +void *RegexServices::allocateMemory(size_t byteCount) +{ + return regexAllocate(byteCount); +} + +// ---------------------------------------------------------------------- + +void RegexServices::freeMemory(void *pointer) +{ + MemoryManager::free(pointer, false); +} + +// ====================================================================== diff --git a/engine/shared/library/sharedRegex/src/win32/RegexServices.h b/engine/shared/library/sharedRegex/src/win32/RegexServices.h new file mode 100755 index 00000000..762c80de --- /dev/null +++ b/engine/shared/library/sharedRegex/src/win32/RegexServices.h @@ -0,0 +1,25 @@ +// ====================================================================== +// +// RegexServices.h +// Copyright 2003 Sony Online Entertainment, Inc. +// All Rights Reserved. +// +// ====================================================================== + +#ifndef INCLUDED_RegexServices_H +#define INCLUDED_RegexServices_H + +// ====================================================================== + +class RegexServices +{ +public: + + static void *allocateMemory(size_t byteCount); + static void freeMemory(void *pointer); + +}; + +// ====================================================================== + +#endif diff --git a/engine/shared/library/sharedSkillSystem/src/win32/FirstSharedSkillSystem.cpp b/engine/shared/library/sharedSkillSystem/src/win32/FirstSharedSkillSystem.cpp new file mode 100755 index 00000000..0b610d18 --- /dev/null +++ b/engine/shared/library/sharedSkillSystem/src/win32/FirstSharedSkillSystem.cpp @@ -0,0 +1,8 @@ +// FirstSharedSkillSystem.cpp +// Copyright 2000-01, Sony Online Entertainment Inc., all rights reserved. +// Author: Justin Randall + +//----------------------------------------------------------------------- + +#include "sharedSkillSystem/FirstSharedSkillSystem.h" + diff --git a/engine/shared/library/sharedSynchronization/src/win32/ConditionVariable.cpp b/engine/shared/library/sharedSynchronization/src/win32/ConditionVariable.cpp new file mode 100755 index 00000000..bdcb1a5f --- /dev/null +++ b/engine/shared/library/sharedSynchronization/src/win32/ConditionVariable.cpp @@ -0,0 +1,50 @@ +// ====================================================================== +// +// ConditionVariable.cpp +// Acy Stapp +// +// Copyright 6/19/2001 Sony Online Entertainment +// +// ====================================================================== + +#include "sharedSynchronization/FirstSharedSynchronization.h" +#include "sharedSynchronization/ConditionVariable.h" + +#include "sharedSynchronization/Mutex.h" + +ConditionVariable::ConditionVariable(Mutex &m) +: sem(1), _mutex(m), count(0) +{ +} + +ConditionVariable::~ConditionVariable() +{ +} + +void ConditionVariable::wait() +{ + ++count; + _mutex.leave(); + sem.wait(); + _mutex.enter(); +} + +void ConditionVariable::signal() +{ + if (count) + { + --count; + sem.signal(); + } +} + +void ConditionVariable::broadcast() +{ + if (count) + { + int oldcount = count; + count = 0; + sem.signal(oldcount); + } +} + diff --git a/engine/shared/library/sharedSynchronization/src/win32/ConditionVariable.h b/engine/shared/library/sharedSynchronization/src/win32/ConditionVariable.h new file mode 100755 index 00000000..07ab3034 --- /dev/null +++ b/engine/shared/library/sharedSynchronization/src/win32/ConditionVariable.h @@ -0,0 +1,42 @@ +// ====================================================================== +// +// ConditionVariable.h +// Acy Stapp +// +// Copyright 6/19/2001 Sony Online Entertainment +// +// ====================================================================== + +#ifndef INCLUDED_ConditionVariable_h +#define INCLUDED_ConditionVariable_h + +class Mutex; + +#include "sharedSynchronization/Semaphore.h" + +/* Condition variable semantics follow pthreads semantics. You +must have the mutex locked before calling signal or broadcast. +When wait returns, the mutex is locked and you must unlock it. +*/ + +class ConditionVariable +{ +public: + ConditionVariable(Mutex &m); + ~ConditionVariable(); + void wait(); + // You must own the mutex before calling signal. + void signal(); + void broadcast(); + Mutex &mutex() { return _mutex; } +private: + ConditionVariable(const ConditionVariable &o); + ConditionVariable &operator =(const ConditionVariable &o); + + Semaphore sem; + Mutex &_mutex; + int count; +}; + + +#endif \ No newline at end of file diff --git a/engine/shared/library/sharedSynchronization/src/win32/FirstSharedSynchronization.cpp b/engine/shared/library/sharedSynchronization/src/win32/FirstSharedSynchronization.cpp new file mode 100755 index 00000000..12dd9b70 --- /dev/null +++ b/engine/shared/library/sharedSynchronization/src/win32/FirstSharedSynchronization.cpp @@ -0,0 +1,8 @@ +// ====================================================================== +// +// FirstSynchronization.cpp +// copyright (c) 2001 Sony Online Entertainment +// +// ====================================================================== + +#include "sharedSynchronization/FirstSharedSynchronization.h" diff --git a/engine/shared/library/sharedSynchronization/src/win32/Gate.cpp b/engine/shared/library/sharedSynchronization/src/win32/Gate.cpp new file mode 100755 index 00000000..654ab4f6 --- /dev/null +++ b/engine/shared/library/sharedSynchronization/src/win32/Gate.cpp @@ -0,0 +1,60 @@ +// ====================================================================== +// +// Gate.cpp +// +// Copyright 2001-2002 Sony Online Entertainment +// All Rights Reserved. +// +// ====================================================================== + +#include "sharedSynchronization/FirstSharedSynchronization.h" +#include "sharedSynchronization/Gate.h" + +// ====================================================================== + +Gate::Gate(bool open) +{ + handle = CreateEvent(0, true, open, 0); + DEBUG_FATAL(handle == NULL, ("CreateEvent failed")); +} + +// ---------------------------------------------------------------------- + +Gate::~Gate() +{ + CloseHandle(handle); +} + +// ---------------------------------------------------------------------- + +void Gate::wait() +{ + int errors = 0; + for (;;) + { + DWORD result = WaitForSingleObject(handle, INFINITE); + if (result == WAIT_OBJECT_0) + return; + + ++errors; + FATAL(errors >= 3, ("WaitForSingleObject failed multiple times")); + } +} + +// ---------------------------------------------------------------------- + +void Gate::close() +{ + const BOOL result = ResetEvent(handle); + FATAL(result == 0, ("ResetEvent failed")); +} + +// ---------------------------------------------------------------------- + +void Gate::open() +{ + const BOOL result = SetEvent(handle); + FATAL(result == 0, ("SetEvent failed")); +} + +// ====================================================================== diff --git a/engine/shared/library/sharedSynchronization/src/win32/Gate.h b/engine/shared/library/sharedSynchronization/src/win32/Gate.h new file mode 100755 index 00000000..a0d3116e --- /dev/null +++ b/engine/shared/library/sharedSynchronization/src/win32/Gate.h @@ -0,0 +1,39 @@ +// ====================================================================== +// +// Gate.h +// +// Copyright 2001-2002 Sony Online Entertainment +// All Rights Reseved. +// +// ====================================================================== + +#ifndef INCLUDED_Gate_h +#define INCLUDED_Gate_h + +// ====================================================================== + +class Gate +{ +public: + + Gate(bool initiallyOpen); + ~Gate(); + + void wait(); + + void close(); + void open(); + +private: + + Gate(const Gate &o); + Gate &operator =(const Gate &o); + +private: + + HANDLE handle; +}; + +// ====================================================================== + +#endif \ No newline at end of file diff --git a/engine/shared/library/sharedSynchronization/src/win32/InterlockedInteger.h b/engine/shared/library/sharedSynchronization/src/win32/InterlockedInteger.h new file mode 100755 index 00000000..0489c3f8 --- /dev/null +++ b/engine/shared/library/sharedSynchronization/src/win32/InterlockedInteger.h @@ -0,0 +1,52 @@ +// ====================================================================== +// +// InterlockedInteger.h +// Acy Stapp +// +// Copyright 6/19/2001 Sony Online Entertainment +// +// ====================================================================== + +#ifndef INCLUDED_InterlockedInteger_h +#define INCLUDED_InterlockedInteger_h + +// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +class InterlockedInteger +{ +public: + explicit InterlockedInteger(int initialValue=0); + int operator =(int); // returns prior value (exchange) + int operator ++(); // returns new value + int operator --(); // returns new value + operator int() const { return static_cast(value); } +private: + InterlockedInteger(const InterlockedInteger &o); + InterlockedInteger &operator =(const InterlockedInteger &o); + volatile int value; +}; + +inline InterlockedInteger::InterlockedInteger(int i_value) +: value(i_value) +{ +} + +inline int InterlockedInteger::operator =(int i_value) +{ + long * ptr = (long *)&value; + return static_cast(InterlockedExchange(ptr, static_cast(i_value))); +} + +inline int InterlockedInteger::operator ++() +{ + long * ptr = (long *)&value; + return static_cast(InterlockedIncrement(ptr)); +} + +inline int InterlockedInteger::operator --() +{ + long * ptr = (long *)&value; + return static_cast(InterlockedDecrement(ptr)); +} + +#endif \ No newline at end of file diff --git a/engine/shared/library/sharedSynchronization/src/win32/InterlockedVoidPointer.h b/engine/shared/library/sharedSynchronization/src/win32/InterlockedVoidPointer.h new file mode 100755 index 00000000..eff0a63e --- /dev/null +++ b/engine/shared/library/sharedSynchronization/src/win32/InterlockedVoidPointer.h @@ -0,0 +1,45 @@ +// ====================================================================== +// +// InterlockedVoidPointer.h +// Acy Stapp +// +// Copyright 6/19/2001 Sony Online Entertainment +// +// ====================================================================== + +#ifndef INCLUDED_InterlockedVoidPointer_h +#define INCLUDED_InterlockedVoidPointer_h + +// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +class InterlockedVoidPointer +{ +public: + explicit InterlockedVoidPointer(void * initialValue=0); + void * compareExchange(void * compare, void * exchange); // compare and exchange if same + operator void * () const { return reinterpret_cast(value); } +private: + InterlockedVoidPointer(const InterlockedVoidPointer &o); + InterlockedVoidPointer &operator =(const InterlockedVoidPointer &o); + void * volatile value; +}; + +template +class InterlockedPointer: public InterlockedVoidPointer +{ +public: + explicit InterlockedPointer(T * initialValue): InterlockedVoidPointer(initialValue) {} + operator T * () const { return static_cast(value); } +}; + +inline InterlockedVoidPointer::InterlockedVoidPointer(void * initialValue) +{ + value = initialValue; +} + +inline void * InterlockedVoidPointer::compareExchange(void * compare, void * exchange) +{ + return (void *)InterlockedCompareExchange((void **)&value, exchange, compare); +} + +#endif \ No newline at end of file diff --git a/engine/shared/library/sharedSynchronization/src/win32/Mutex.cpp b/engine/shared/library/sharedSynchronization/src/win32/Mutex.cpp new file mode 100755 index 00000000..557412a7 --- /dev/null +++ b/engine/shared/library/sharedSynchronization/src/win32/Mutex.cpp @@ -0,0 +1,53 @@ +// ====================================================================== +// +// Mutex.cpp +// +// Copyright 2001-2002 Sony Online Entertainment +// All Rights Reserved +// +// ====================================================================== + +#include "sharedSynchronization/FirstSharedSynchronization.h" +#include "sharedSynchronization/Mutex.h" + +// ====================================================================== + +void Mutex::install() +{ +} + +// ---------------------------------------------------------------------- + +void Mutex::remove() +{ +} + +// ====================================================================== + +Mutex::Mutex() +{ + InitializeCriticalSection(&m_criticalSection); +} + +// ---------------------------------------------------------------------- + +Mutex::~Mutex() +{ + DeleteCriticalSection(&m_criticalSection); +} + +// ---------------------------------------------------------------------- + +void Mutex::enter() +{ + EnterCriticalSection(&m_criticalSection); +} + +// ---------------------------------------------------------------------- + +void Mutex::leave() +{ + LeaveCriticalSection(&m_criticalSection); +} + +// ====================================================================== diff --git a/engine/shared/library/sharedSynchronization/src/win32/Mutex.h b/engine/shared/library/sharedSynchronization/src/win32/Mutex.h new file mode 100755 index 00000000..579b52c5 --- /dev/null +++ b/engine/shared/library/sharedSynchronization/src/win32/Mutex.h @@ -0,0 +1,41 @@ +// ====================================================================== +// +// Mutex.h +// Copyright 2001-2002 Sony Online Entertainment +// All Rights Reserved. +// +// ====================================================================== + +#ifndef INCLUDED_Mutex_H +#define INCLUDED_Mutex_H + +// ====================================================================== + +class Mutex +{ +public: + + static void install(); + static void remove(); + +public: + + Mutex(); + ~Mutex(); + + void enter(); + void leave(); + +private: + + Mutex(const Mutex &); + Mutex &operator =(const Mutex &); + +private: + + CRITICAL_SECTION m_criticalSection; +}; + +// ====================================================================== + +#endif diff --git a/engine/shared/library/sharedSynchronization/src/win32/RecursiveMutex.cpp b/engine/shared/library/sharedSynchronization/src/win32/RecursiveMutex.cpp new file mode 100755 index 00000000..fa39da6b --- /dev/null +++ b/engine/shared/library/sharedSynchronization/src/win32/RecursiveMutex.cpp @@ -0,0 +1,53 @@ +// ====================================================================== +// +// RecursiveMutex.cpp +// +// Copyright 2001-2002 Sony Online Entertainment +// All Rights Reserved +// +// ====================================================================== + +#include "sharedSynchronization/FirstSharedSynchronization.h" +#include "sharedSynchronization/RecursiveMutex.h" + +// ====================================================================== + +void RecursiveMutex::install() +{ +} + +// ---------------------------------------------------------------------- + +void RecursiveMutex::remove() +{ +} + +// ====================================================================== + +RecursiveMutex::RecursiveMutex() +{ + InitializeCriticalSection(&m_criticalSection); +} + +// ---------------------------------------------------------------------- + +RecursiveMutex::~RecursiveMutex() +{ + DeleteCriticalSection(&m_criticalSection); +} + +// ---------------------------------------------------------------------- + +void RecursiveMutex::enter() +{ + EnterCriticalSection(&m_criticalSection); +} + +// ---------------------------------------------------------------------- + +void RecursiveMutex::leave() +{ + LeaveCriticalSection(&m_criticalSection); +} + +// ====================================================================== diff --git a/engine/shared/library/sharedSynchronization/src/win32/RecursiveMutex.h b/engine/shared/library/sharedSynchronization/src/win32/RecursiveMutex.h new file mode 100755 index 00000000..6c056a6c --- /dev/null +++ b/engine/shared/library/sharedSynchronization/src/win32/RecursiveMutex.h @@ -0,0 +1,41 @@ +// ====================================================================== +// +// RecursiveMutex.h +// Copyright 2001-2002 Sony Online Entertainment +// All Rights Reserved. +// +// ====================================================================== + +#ifndef INCLUDED_RecursiveMutex_H +#define INCLUDED_RecursiveMutex_H + +// ====================================================================== + +class RecursiveMutex +{ +public: + + static void install(); + static void remove(); + +public: + + RecursiveMutex(); + ~RecursiveMutex(); + + void enter(); + void leave(); + +private: + + RecursiveMutex(const RecursiveMutex &); + RecursiveMutex &operator =(const RecursiveMutex &); + +private: + + CRITICAL_SECTION m_criticalSection; +}; + +// ====================================================================== + +#endif diff --git a/engine/shared/library/sharedSynchronization/src/win32/Semaphore.cpp b/engine/shared/library/sharedSynchronization/src/win32/Semaphore.cpp new file mode 100755 index 00000000..47a385b4 --- /dev/null +++ b/engine/shared/library/sharedSynchronization/src/win32/Semaphore.cpp @@ -0,0 +1,37 @@ +// ====================================================================== +// +// Semaphore.cpp +// Acy Stapp +// +// Copyright 6/19/2001 Sony Online Entertainment +// +// ====================================================================== + +#include "sharedSynchronization/FirstSharedSynchronization.h" +#include "sharedSynchronization/Semaphore.h" + +Semaphore::Semaphore(int count, int initial) +{ + handle = CreateSemaphore(0, initial, count, 0); +} + +Semaphore::~Semaphore() +{ + CloseHandle(handle); +} + +void Semaphore::wait() +{ + WaitForSingleObject(handle, INFINITE); +} + +void Semaphore::wait(unsigned int maxDurationMs) +{ + WaitForSingleObject(handle, maxDurationMs); +} + +void Semaphore::signal(int count) +{ + ReleaseSemaphore(handle, count, 0); +} + diff --git a/engine/shared/library/sharedSynchronization/src/win32/Semaphore.h b/engine/shared/library/sharedSynchronization/src/win32/Semaphore.h new file mode 100755 index 00000000..744743a4 --- /dev/null +++ b/engine/shared/library/sharedSynchronization/src/win32/Semaphore.h @@ -0,0 +1,28 @@ +// ====================================================================== +// +// Semaphore.h +// Acy Stapp +// +// Copyright 6/19/2001 Sony Online Entertainment +// +// ====================================================================== + +#ifndef INCLUDED_Semaphore_h +#define INCLUDED_Semaphore_h + +class Semaphore +{ +public: + Semaphore(int count=0x7FFFFFFF, int initial=0); + ~Semaphore(); + + void wait(); + void wait(unsigned int maxDurationMs); + void signal(int count=1); +private: + Semaphore(const Semaphore &o); + Semaphore &operator =(const Semaphore &o); + HANDLE handle; +}; + +#endif diff --git a/engine/shared/library/sharedTemplate/src/win32/FirstSharedTemplate.cpp b/engine/shared/library/sharedTemplate/src/win32/FirstSharedTemplate.cpp new file mode 100755 index 00000000..527ba602 --- /dev/null +++ b/engine/shared/library/sharedTemplate/src/win32/FirstSharedTemplate.cpp @@ -0,0 +1 @@ +#include "sharedTemplate/FirstSharedTemplate.h" diff --git a/engine/shared/library/sharedTemplateDefinition/src/win32/FirstSharedTemplateDefinition.cpp b/engine/shared/library/sharedTemplateDefinition/src/win32/FirstSharedTemplateDefinition.cpp new file mode 100755 index 00000000..b156d0fd --- /dev/null +++ b/engine/shared/library/sharedTemplateDefinition/src/win32/FirstSharedTemplateDefinition.cpp @@ -0,0 +1 @@ +#include "sharedTemplateDefinition/FirstSharedTemplateDefinition.h" diff --git a/engine/shared/library/sharedTerrain/src/win32/FirstSharedTerrain.cpp b/engine/shared/library/sharedTerrain/src/win32/FirstSharedTerrain.cpp new file mode 100755 index 00000000..b8b5d9c2 --- /dev/null +++ b/engine/shared/library/sharedTerrain/src/win32/FirstSharedTerrain.cpp @@ -0,0 +1,8 @@ +// ====================================================================== +// +// FirstTerrain.cpp +// copyright (c) 2001 Sony Online Entertainment +// +// ====================================================================== + +#include "sharedTerrain/FirstSharedTerrain.h" diff --git a/engine/shared/library/sharedThread/src/win32/FirstSharedThread.cpp b/engine/shared/library/sharedThread/src/win32/FirstSharedThread.cpp new file mode 100755 index 00000000..44b0e50c --- /dev/null +++ b/engine/shared/library/sharedThread/src/win32/FirstSharedThread.cpp @@ -0,0 +1,8 @@ +// ====================================================================== +// +// FirstThread.cpp +// copyright (c) 2001 Sony Online Entertainment +// +// ====================================================================== + +#include "sharedThread/FirstSharedThread.h" diff --git a/engine/shared/library/sharedThread/src/win32/Thread.cpp b/engine/shared/library/sharedThread/src/win32/Thread.cpp new file mode 100755 index 00000000..2db63ced --- /dev/null +++ b/engine/shared/library/sharedThread/src/win32/Thread.cpp @@ -0,0 +1,179 @@ +// ====================================================================== +// +// Thread.cpp +// Acy Stapp +// +// Copyright6/19/2001 Sony Online Entertainment +// +// ====================================================================== + +#include "sharedThread/FirstSharedThread.h" +#include "sharedThread/Thread.h" + +#include "sharedFoundation/ExitChain.h" +#include "sharedSynchronization/Mutex.h" +#include "sharedSynchronization/RecursiveMutex.h" +#include "sharedFoundation/Os.h" +#include "sharedFoundation/PerThreadData.h" +#include + +#include + +class MainThread: public Thread +{ +public: + MainThread(const std::string &name): Thread(name) {} +protected: + void run() {} +private: + MainThread(const MainThread &o); + MainThread &operator =(const MainThread &o); +}; + +int Thread::implindex; +Thread * Thread::mainThread; + +void Thread::install() +{ + DEBUG_FATAL(mainThread, ("Thread::install: already installed")); + + implindex = TlsAlloc(); + mainThread = new MainThread("Main"); + mainThread->attach(); + + ExitChain::add(remove, "Thread::remove"); + + Mutex::install(); + RecursiveMutex::install(); + +} + +void Thread::remove() +{ + DEBUG_FATAL(!mainThread, ("Thread::remove: not installed")); + DEBUG_FATAL(mainThread->refcount > 1, ("Someone still holds the main thread")); + delete mainThread; // can't kill because it would terminate the app + TlsFree(implindex); + + Mutex::remove(); + RecursiveMutex::remove(); + + mainThread = 0; +} + +Thread::Thread() +: refcount(1), name(new std::string) +{ +} + +Thread::Thread(const std::string &i_name) +: refcount(1), name(new std::string(i_name)) +{ +} + +void Thread::start() +{ + handle = (HANDLE) _beginthreadex(0, 0, threadFunc, this, 0, &id); +} + +void Thread::attach() +{ + id = GetCurrentThreadId(); + HANDLE process = GetCurrentProcess(); + DuplicateHandle(process, GetCurrentThread(), process, &handle, 0, FALSE, DUPLICATE_SAME_ACCESS); + + TlsSetValue(implindex, this); + Os::setThreadName(id, name->c_str()); +} + +Thread::~Thread() +{ + CloseHandle(handle); + delete name; +} + +unsigned int Thread::threadFunc(void * i) +{ + Thread * impl = static_cast(i); + TlsSetValue(implindex, impl); + Os::setThreadName(impl->id, impl->name->c_str()); + PerThreadData::threadInstall(true); + impl->run(); + PerThreadData::threadRemove(); + impl->kill(); + return 0; +} + +void Thread::kill() +{ + void * h = getCurrentThread()->handle; + deref(); + if (this == getCurrentThread()) + { + _endthreadex(1); + } + else + { + TerminateThread(h, 1); + } +} + +void Thread::wait() +{ + WaitForSingleObject(handle, INFINITE); +} + +bool Thread::done() +{ + return WaitForSingleObject(handle, 0) == WAIT_OBJECT_0; // WAIT_TIMEOUT if the thread is still active +} + +void Thread::setName(const std::string &i_name) +{ + *name = i_name; + Os::setThreadName(id, name->c_str()); +} + +void Thread::setPriority(ePriority priority) +{ + static int priorities[] = + { + THREAD_PRIORITY_IDLE, + THREAD_PRIORITY_LOWEST, + THREAD_PRIORITY_NORMAL, + THREAD_PRIORITY_HIGHEST, + THREAD_PRIORITY_TIME_CRITICAL + }; + ::SetThreadPriority(handle, priorities[priority]); +} + +void Thread::suspend() +{ + ::SuspendThread(handle); +} + +void Thread::resume() +{ + ::ResumeThread(handle); +} + +const std::string &Thread::getName() const +{ + return *name; +} + +// Make sure the header-only files compile :) + +#if 0 + +#include "sharedSynchronization/CountingSemaphore.h" +#include "sharedSynchronization/BlockingPointer.h" +#include "sharedSynchronization/BlockingQueue.h" +#include "sharedSynchronization/WriteOnce.h" + +Mutex t; +BlockingQueue bqint(t, 0, 0); +BlockingPointer bpint(t, 0, 0); +WriteOnce woint; + +#endif \ No newline at end of file diff --git a/engine/shared/library/sharedThread/src/win32/Thread.h b/engine/shared/library/sharedThread/src/win32/Thread.h new file mode 100755 index 00000000..6d59c27d --- /dev/null +++ b/engine/shared/library/sharedThread/src/win32/Thread.h @@ -0,0 +1,94 @@ +// ====================================================================== +// +// Thread.h +// Acy Stapp +// +// Copyright 6/19/2001 Sony Online Entertainment +// +// ====================================================================== + +#ifndef INCLUDED_Thread_h +#define INCLUDED_Thread_h + +#include "sharedSynchronization/InterlockedInteger.h" + +template class TypedThreadHandle; + +class Thread +{ + // Visual studio fails to compile this valid code + // template friend TypedThreadHandle; +public: + static void install(); + static void remove(); + + Thread(); + Thread(const std::string &i_name); + + void kill(); + bool done(); + void wait(); + + enum ePriority + { + kIdle = 0, + kLow = 1, + kNormal = 2, + kHigh = 3, + kCritical = 4 + }; + void setPriority(ePriority priority); + void suspend(); + void resume(); + + const std::string &getName() const; + void setName(const std::string &i_name); + + static Thread * getCurrentThread(); + static Thread * getMainThread(); +protected: + virtual ~Thread(); + virtual void run()=0; + + HANDLE handle; + unsigned int id; + InterlockedInteger refcount; +public: // should be private:, see above + Thread(const Thread &o); + Thread &operator =(const Thread &o); + + void start(); + void attach(); // pick up the currently running thread + + void ref(); + void deref(); + + std::string *name; + + static int implindex; + static Thread * mainThread; + static unsigned int __stdcall threadFunc(void * data); +}; + +inline void Thread::ref() +{ + ++refcount; +} + +inline void Thread::deref() +{ + if (--refcount == 0) + delete this; +} + +inline Thread * Thread::getCurrentThread() +{ + return static_cast(TlsGetValue(implindex)); +} + +inline Thread * Thread::getMainThread() +{ + return mainThread; +} + +#endif \ No newline at end of file diff --git a/engine/shared/library/sharedUtility/src/win32/FirstSharedUtility.cpp b/engine/shared/library/sharedUtility/src/win32/FirstSharedUtility.cpp new file mode 100755 index 00000000..fde40d23 --- /dev/null +++ b/engine/shared/library/sharedUtility/src/win32/FirstSharedUtility.cpp @@ -0,0 +1,8 @@ +// ====================================================================== +// +// FirstUtility.cpp +// copyright (c) 2001 Sony Online Entertainment +// +// ====================================================================== + +#include "sharedUtility/FirstSharedUtility.h" diff --git a/engine/shared/library/sharedXml/src/win32/core/FirstSharedXml.cpp b/engine/shared/library/sharedXml/src/win32/core/FirstSharedXml.cpp new file mode 100755 index 00000000..0d9c1ae2 --- /dev/null +++ b/engine/shared/library/sharedXml/src/win32/core/FirstSharedXml.cpp @@ -0,0 +1,11 @@ +// ====================================================================== +// +// FirstSharedXml.cpp +// Copyright 2004 Sony Online Entertainment, Inc. +// All Rights Reserved. +// +// ====================================================================== + +#include "sharedXml/FirstSharedXml.h" + +// ====================================================================== diff --git a/external/3rd/library/platform/utils/Base/win32/Archive.h b/external/3rd/library/platform/utils/Base/win32/Archive.h new file mode 100755 index 00000000..30ddce43 --- /dev/null +++ b/external/3rd/library/platform/utils/Base/win32/Archive.h @@ -0,0 +1,42 @@ +#ifndef BASE_WIN32_ARCHIVE_H +#define BASE_WIN32_ARCHIVE_H + +#ifdef EXTERNAL_DISTRO +namespace NAMESPACE +{ + +#endif +namespace Base +{ + + +#ifdef PACK_BIG_ENDIAN + + inline double byteSwap(double value) { byteReverse64(&value); return value; } + inline float byteSwap(float value) { byteReverse32(&value); return value; } + inline uint64 byteSwap(uint64 value) { byteReverse64(&value); return value; } + inline int64 byteSwap(int64 value) { byteReverse64(&value); return value; } + inline uint32 byteSwap(uint32 value) { byteReverse32(&value); return value; } + inline int32 byteSwap(int32 value) { byteReverse32(&value); return value; } + inline uint16 byteSwap(uint16 value) { byteReverse16(&value); return value; } + inline int16 byteSwap(int16 value) { byteReverse16(&value); return value; } + +#else + + inline double byteSwap(double value) { return value; } + inline float byteSwap(float value) { return value; } + inline uint64 byteSwap(uint64 value) { return value; } + inline int64 byteSwap(int64 value) { return value; } + inline uint32 byteSwap(uint32 value) { return value; } + inline int32 byteSwap(int32 value) { return value; } + inline uint16 byteSwap(uint16 value) { return value; } + inline int16 byteSwap(int16 value) { return value; } + +#endif + +}; +#ifdef EXTERNAL_DISTRO +}; +#endif + +#endif diff --git a/external/3rd/library/platform/utils/Base/win32/BlockAllocator.cpp b/external/3rd/library/platform/utils/Base/win32/BlockAllocator.cpp new file mode 100755 index 00000000..029946b4 --- /dev/null +++ b/external/3rd/library/platform/utils/Base/win32/BlockAllocator.cpp @@ -0,0 +1,112 @@ +#include "../BlockAllocator.h" + +#ifdef EXTERNAL_DISTRO +namespace NAMESPACE +{ + +#endif +namespace Base +{ + + BlockAllocator::BlockAllocator() + { + for(unsigned i = 0; i < 31; i++) + { + m_blocks[i] = NULL; + } + } + + BlockAllocator::~BlockAllocator() + { + // free all allocated memory blocks + for(unsigned i = 0; i < 31; i++) + { + while(m_blocks[i] != NULL) + { + uintptr_t *tmp = m_blocks[i]; + m_blocks[i] = (uintptr_t *)*m_blocks[i]; + free(tmp); + } + } + } + +// Allocate a block that is the next power of two greater than the # of bytes passed. +// 33 bytes yields a 64 byte block of memory and so forth. + + void *BlockAllocator::getBlock(unsigned bytes) + { + unsigned accum = 16, bits = 16; + uintptr_t *handle = NULL; + + // Perform a binary search looking for the highest bit. + + while(bits != 0) + { + // If bytes is less than the bit we're testing for, subtract half + // from the bit value and repeat + if(bytes < (unsigned)(1 << accum)) + { + bits /= 2; + accum -= bits; + } + // If bytes is greater than the bit we're testing for, add half + // from the but value and repeat + else if(bytes > (unsigned)(1 << accum)) + { + bits /= 2; + accum += bits; + } + // Got lucky and hit the value dead on + else + { + break; + } + } + // At this point accum contains the most significant bit index, increment + accum++; + if(accum < 2) + { + accum = 2; + } + + // Note that when memory is actually allocated, 8 extra bytes will be allocated.at the front + // The first integer is the address of the next block of memory when the block is in the allocator + // The second integer is the bit length of the block + // Memory is allocated on 4 byte boundaries to sidestep byte alignment problems + + + // Check if the allocator already has a block of that size + if(m_blocks[accum] == 0) + { + // remove the pre allocated block from the linked list + handle = (uintptr_t *)calloc(((1 << accum) / 4) + 2, sizeof(unsigned)); + handle[1] = accum; + handle[0] = 0; + } + else + { + // Allocate a new block + handle = m_blocks[accum]; + m_blocks[accum] = (uintptr_t *)handle[0]; + handle[0] = 0; + } + // return a pointer that skips over the header used for the allocator's purposes + return(handle + 2); + } + + void BlockAllocator::returnBlock(unsigned *handle) + { + // C++ allows for safe deletion of a NULL pointer + if(handle) + { + // Update the allocator linked list, insert this entry at the head + *(handle - 2) = (uintptr_t)m_blocks[*(handle - 1)]; + // Add this entry to the proper linked list node + m_blocks[*(handle - 1)] = (handle - 2); + } + } +}; +#ifdef EXTERNAL_DISTRO +}; +#endif + diff --git a/external/3rd/library/platform/utils/Base/win32/Event.cpp b/external/3rd/library/platform/utils/Base/win32/Event.cpp new file mode 100755 index 00000000..12ee8fe7 --- /dev/null +++ b/external/3rd/library/platform/utils/Base/win32/Event.cpp @@ -0,0 +1,44 @@ +//////////////////////////////////////// +// Event.cpp +// +// Purpose: +// 1. Implementation of the CEvent class. +// +// Revisions: +// 07/10/2001 Created +// + + +#if !defined(_MT) +# pragma message( "Excluding Base::CEvent - requires multi-threaded compile. (_MT)" ) +#else + +#include "Event.h" + +#ifdef EXTERNAL_DISTRO +namespace NAMESPACE +{ + +#endif +namespace Base +{ + + CEvent::CEvent() + { + mEvent = CreateEvent( NULL, FALSE, FALSE, NULL ); + } + + CEvent::~CEvent() + { + if (mEvent) + CloseHandle(mEvent); + } + +}; +#ifdef EXTERNAL_DISTRO +}; +#endif + + +#endif // #if defined(_MT) + diff --git a/external/3rd/library/platform/utils/Base/win32/Event.h b/external/3rd/library/platform/utils/Base/win32/Event.h new file mode 100755 index 00000000..5d2bc712 --- /dev/null +++ b/external/3rd/library/platform/utils/Base/win32/Event.h @@ -0,0 +1,92 @@ +//////////////////////////////////////// +// Event.h +// +// Purpose: +// 1. Declair the CEvent class that encapsulates the functionality of a +// single-locking semaphore. +// +// Revisions: +// 07/10/2001 Created +// + +#ifndef BASE_WIN32_EVENT_H +#define BASE_WIN32_EVENT_H + +#if defined(_MT) + + + +#include "Platform.h" + +#ifdef EXTERNAL_DISTRO +namespace NAMESPACE +{ + +#endif +namespace Base +{ + + //////////////////////////////////////// + // Class: + // CEvent + // + // Purpose: + // Encapsulates the functionality of a singal-locking semaphore. + // This class is valuable for thread syncronization when a thead's + // execution needs to be dependent upon another thread. + // + // Public Methods: + // Signal() : Signals a thread that has called Wait() so that it can + // continue execution. This function returns true if the waiting + // thread was signalled successfully, otherwise false is returned. + // Wait() : Halts the calling thread's execution indefinately until + // a Singal() call is made by an external thread. If the thread is + // successfully signalled, the function returns eWAIT_SIGNAL. If + // timeout period expires without a signal, eWAIT_TIMEOUT is returned. + // If the function fails, eWAIT_ERROR is returned. + // + class CEvent + { + public: + CEvent(); + virtual ~CEvent(); + + bool Signal(); + int32 Wait(uint32 timeout = 0); + + public: + enum { eWAIT_ERROR, eWAIT_SIGNAL, eWAIT_TIMEOUT }; + private: + HANDLE mEvent; + }; + + inline bool CEvent::Signal() + { + if (mEvent) + return SetEvent(mEvent)!=0; + + return false; + } + + inline int32 CEvent::Wait(uint32 timeout) + { + if (!mEvent) + return CEvent::eWAIT_ERROR; + + DWORD result = WaitForSingleObjectEx(mEvent, timeout ? timeout : INFINITE, FALSE); + if (result == WAIT_OBJECT_0) + return CEvent::eWAIT_SIGNAL; + else if (result == WAIT_TIMEOUT) + return CEvent::eWAIT_TIMEOUT; + else + return CEvent::eWAIT_ERROR; + } + +}; +#ifdef EXTERNAL_DISTRO +}; +#endif +#endif // #if defined(_MT) + + +#endif // BASE_WIN32_EVENT_H diff --git a/external/3rd/library/platform/utils/Base/win32/File.cpp b/external/3rd/library/platform/utils/Base/win32/File.cpp new file mode 100755 index 00000000..e6b6ee23 --- /dev/null +++ b/external/3rd/library/platform/utils/Base/win32/File.cpp @@ -0,0 +1,19 @@ +// File.cpp: implementation of the CFile class. +// +////////////////////////////////////////////////////////////////////// + +#include "File.h" + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +CFile::CFile(const char *) +{ + +} + +CFile::~CFile() +{ + +} diff --git a/external/3rd/library/platform/utils/Base/win32/File.h b/external/3rd/library/platform/utils/Base/win32/File.h new file mode 100755 index 00000000..7965427a --- /dev/null +++ b/external/3rd/library/platform/utils/Base/win32/File.h @@ -0,0 +1,22 @@ +// File.h: interface for the CFile class. +// +////////////////////////////////////////////////////////////////////// + +#ifndef BASE_FILE_H +#define BASE_FILE_H + +#include + +class CFile +{ + public: + CFile(const char *); + virtual ~CFile(); + + bool IsOpen(); + + private: + FILE* mFileHandle; +}; + +#endif // BASE_FILE_H diff --git a/external/3rd/library/platform/utils/Base/win32/Logger.cpp b/external/3rd/library/platform/utils/Base/win32/Logger.cpp new file mode 100755 index 00000000..cf2afcf6 --- /dev/null +++ b/external/3rd/library/platform/utils/Base/win32/Logger.cpp @@ -0,0 +1,385 @@ +#include "../Logger.h" +#include "Mutex.h" + +using namespace std; + +#ifdef EXTERNAL_DISTRO +namespace NAMESPACE +{ + +#endif +namespace Base +{ + + +const char file_sep = '\\'; + +Logger::Logger(const char *prefix, int level, unsigned size, bool rollDate) +: m_defaultLevel(level), m_defaultSize(size), m_dirPrefix(prefix), m_rollDate(rollDate) +{ + char buf[1024]; + FILE *logDir = NULL; + + logDir = fopen(m_dirPrefix.c_str(), "r+"); + if(errno == ENOENT) + { + cmkdir(m_dirPrefix.c_str(), 0755); + } + else if(logDir != NULL) + { + fclose(logDir); + } + + tm now; + time_t t = time(NULL); + memcpy(&now, localtime(&t), sizeof(tm)); + memcpy(&m_lastDateTime, &now, sizeof(tm)); + if(m_rollDate) + { + sprintf(buf, "%s%c%2.2d-%2.2d-%2.2d", m_dirPrefix.c_str(), file_sep, (now.tm_mon + 1), now.tm_mday, (now.tm_year % 100)); + } + else + { + sprintf(buf, "%s", m_dirPrefix.c_str()); + } + + logDir = fopen(buf, "r+"); + if(errno == ENOENT) + { + cmkdir(buf, 0755); + } + else if(logDir != NULL) + { + fclose(logDir); + } + m_logPrefix = buf; +} + +Logger::~Logger() +{ + map::iterator iter; + for(iter = m_logTable.begin(); iter != m_logTable.end(); ++iter) + { + log((*iter).first, LOG_FILEONLY, "---=== Log Stopped ===---"); + fflush((*iter).second->file); + fclose((*iter).second->file); + delete((*iter).second); + + } + m_logTable.clear(); +} + +void Logger::flush(unsigned logenum) +{ + map::iterator iter = m_logTable.find(logenum); + + if(iter != m_logTable.end()) + { + LogInfo *info = (*iter).second; + fflush(info->file); + info->used = 0; + } +} + +void Logger::flushAll() +{ + map::iterator iter; + + for(iter = m_logTable.begin(); iter != m_logTable.end(); ++iter) + { + LogInfo *info = (*iter).second; + fflush(info->file); + info->used = 0; + } +} + +void Logger::addLog(const char *id, unsigned logenum, int level, unsigned size) +{ + LogInfo *newLog = new LogInfo; + newLog->filename = m_logPrefix + file_sep + id + ".log"; + newLog->name = id; + newLog->used = 0; + newLog->max = size; + newLog->last = 0; + newLog->level = level; + + m_logTable.insert(pair(logenum, newLog)); + + if(strcmp("stdout", id) == 0) + { + newLog->file = stdout; + } + else if(strcmp("stderr", id) == 0) + { + newLog->file = stderr; + } + else + { + newLog->file = fopen(newLog->filename.c_str(), "a+"); + } + log(logenum, LOG_FILEONLY, "---=== Log Started ===---"); +} + +void Logger::addLog(const char *id, unsigned logenum) +{ + LogInfo *newLog = new LogInfo; + newLog->filename = m_logPrefix + file_sep + id + ".log"; + newLog->name = id; + newLog->used = 0; + newLog->max = m_defaultSize; + newLog->last = 0; + newLog->level = m_defaultLevel; + m_logTable.insert(pair(logenum, newLog)); + + if(strcmp("stdout", id) == 0) + { + newLog->file = stdout; + } + else if(strcmp("stderr", id) == 0) + { + newLog->file = stderr; + } + else + { + newLog->file = fopen(newLog->filename.c_str(), "a+"); + } + log(logenum, LOG_FILEONLY, "---=== Log Started ===---"); + +} + +void Logger::updateLog(unsigned logenum, int level, unsigned size) +{ + map::iterator iter = m_logTable.find(logenum); + + if(iter != m_logTable.end()) + { + (*iter).second->level = level; + (*iter).second->max = size; + } +} + +void Logger::removeLog(unsigned logenum) +{ + map::iterator iter = m_logTable.find(logenum); + + if(iter != m_logTable.end()) + { + log((*iter).first, LOG_FILEONLY, "---=== Log Stopped ===---"); + fflush((*iter).second->file); + fclose((*iter).second->file); + delete((*iter).second); + } +} + +void Logger::logSimple(unsigned logenum, int level, const char *message) +{ + map::iterator iter = m_logTable.find(logenum); + char dateBuffer[256]; + + if(iter == m_logTable.end()) + { + return; + } + time_t t = time(NULL); + LogInfo *info = (*iter).second; + if(level >= info->level) + { + return; + } + if(info->last != t) + { + memcpy(&info->ts, localtime(&t), sizeof(tm)); + info->last = t; + } + + if(m_rollDate && info->ts.tm_mday != m_lastDateTime.tm_mday) + { +#if defined(_MT) + rLock.Lock(); +#endif + if(info->ts.tm_mday != m_lastDateTime.tm_mday) + { + memcpy(&m_lastDateTime, &info->ts, sizeof(tm)); + rollDate(t); + } +#if defined(_MT) + rLock.Unlock(); +#endif + } + if(iter != m_logTable.end()) + { + if(info->max > 0) + { + sprintf(dateBuffer, "[%2.2d/%2.2d/%2.2d %2.2d:%2.2d:%2.2d] " , (info->ts.tm_mon + 1), info->ts.tm_mday, (info->ts.tm_year % 100), info->ts.tm_hour, info->ts.tm_min, info->ts.tm_sec); + info->used += fputs(dateBuffer, info->file); + info->used += fputs(message, info->file); + fputc('\n', info->file); + if(info->used > info->max) + { + fflush(info->file); + info->used = 0; + } + } + else + { + sprintf(dateBuffer, "[%2.2d/%2.2d/%2.2d %2.2d:%2.2d:%2.2d] " , (info->ts.tm_mon + 1), info->ts.tm_mday, (info->ts.tm_year % 100), info->ts.tm_hour, info->ts.tm_min, info->ts.tm_sec); + fputs(dateBuffer, info->file); + fputs(message, info->file); + fputc('\n', info->file); + fflush(info->file); + } + } +} + +void Logger::log(unsigned logenum, int level, const char *message, ...) +{ + char buf[2048]; + char dateBuffer[256]; + va_list varg; + va_start(varg, message); + _vsnprintf(buf, 2047, message, varg); + buf[2047] = 0; + va_end(varg); + + map::iterator iter = m_logTable.find(logenum); + if(iter == m_logTable.end()) + { + return; + } + time_t t = time(NULL); + LogInfo *info = (*iter).second; + + if(level >= info->level) + { + return; + } + + if(level == LOG_FILEONLY && ((info->file == stderr) || (info->file == stdout))) + { + return; + } + if(info->last != t) + { + memcpy(&info->ts, localtime(&t), sizeof(tm)); + info->last = t; + } + if(m_rollDate && info->ts.tm_mday != m_lastDateTime.tm_mday) + { +#if defined(_MT) + rLock.Lock(); +#endif + if(info->ts.tm_mday != m_lastDateTime.tm_mday) + { + memcpy(&m_lastDateTime, &info->ts, sizeof(tm)); + rollDate(t); + } +#if defined(_MT) + rLock.Unlock(); +#endif + } + + if(iter != m_logTable.end()) + { + if(info->max > 0) + { + sprintf(dateBuffer, "[%2.2d/%2.2d/%2.2d %2.2d:%2.2d:%2.2d] " , (info->ts.tm_mon + 1), info->ts.tm_mday, (info->ts.tm_year % 100), info->ts.tm_hour, info->ts.tm_min, info->ts.tm_sec); + info->used += fputs(dateBuffer, info->file); + info->used += fputs(buf, info->file); + fputc('\n', info->file); + if(info->used > info->max) + { + fflush(info->file); + info->used = 0; + } + } + else + { + sprintf(dateBuffer, "[%2.2d/%2.2d/%2.2d %2.2d:%2.2d:%2.2d] " , (info->ts.tm_mon + 1), info->ts.tm_mday, (info->ts.tm_year % 100), info->ts.tm_hour, info->ts.tm_min, info->ts.tm_sec); + info->used += fputs(dateBuffer, info->file); + info->used += fputs(buf, info->file); + fputc('\n', info->file); + fflush(info->file); + } + } +} + +void Logger::rollDate(time_t t) +{ + char buf[80]; + FILE *logDir = NULL; + + logDir = fopen(m_dirPrefix.c_str(), "r+"); + if(errno == ENOENT) + { + cmkdir(m_dirPrefix.c_str(), 0755); + } + else if(logDir != NULL) + { + fclose(logDir); + } + + tm now; + memcpy(&now, localtime(&t), sizeof(tm)); + + sprintf(buf, "%s%c%2.2d-%2.2d-%2.2d", m_dirPrefix.c_str(), file_sep, (now.tm_mon + 1), now.tm_mday, (now.tm_year % 100)); + logDir = fopen(buf, "r+"); + + if(errno == ENOENT) + { + cmkdir(buf, 0755); + } + else if(logDir != NULL) + { + fclose(logDir); + } + m_logPrefix = buf; + + map::iterator iter; + for(iter = m_logTable.begin(); iter != m_logTable.end(); ++iter) + { + (*iter).second->filename = m_logPrefix + file_sep + (*iter).second->name.c_str() + ".log"; + fflush((*iter).second->file); + fclose((*iter).second->file); + (*iter).second->file = fopen((*iter).second->filename.c_str(), "a+"); + memcpy(&((*iter).second->ts), &now, sizeof(tm)); + } +} + +// mkdir function that creates intermediate directories +void Logger::cmkdir(const char *dir, int mode) +{ + char dirbuf[128]; + strncpy(dirbuf, dir, 127); + dirbuf[127] = 0; + char *j = dirbuf, *i = dirbuf; + int handle; + + while(*i) + { + if(*i == file_sep) + { + (*i) = 0; + handle = _open(j, O_EXCL); + + if((handle > 0) || (errno != EISDIR && errno != ENOENT && errno != EACCES)) + { + perror("Logger::cmkdir():"); + abort(); + } + _mkdir(j); + _close(handle); + (*i) = file_sep; + } + else if(*(i + 1) == 0) + { + _mkdir(j); + } + i++; + } +} + +}; +#ifdef EXTERNAL_DISTRO +}; +#endif + diff --git a/external/3rd/library/platform/utils/Base/win32/Mutex.cpp b/external/3rd/library/platform/utils/Base/win32/Mutex.cpp new file mode 100755 index 00000000..482481e8 --- /dev/null +++ b/external/3rd/library/platform/utils/Base/win32/Mutex.cpp @@ -0,0 +1,40 @@ +//////////////////////////////////////// +// Mutex.cpp +// +// Purpose: +// 1. Implementation of the CMutex class. +// +// Revisions: +// 07/10/2001 Created +// +#if !defined(_MT) +# pragma message( "Excluding Base::CMutex - requires multi-threaded compile. (_MT)" ) +#else + +#include "Mutex.h" + +#ifdef EXTERNAL_DISTRO +namespace NAMESPACE +{ + +#endif +namespace Base +{ + +CMutex::CMutex() + { + InitializeCriticalSection(&mCriticalSection); + } + +CMutex::~CMutex() + { + DeleteCriticalSection(&mCriticalSection); + } +}; +#ifdef EXTERNAL_DISTRO +}; +#endif + + +#endif // #if defined(_MT) + diff --git a/external/3rd/library/platform/utils/Base/win32/Mutex.h b/external/3rd/library/platform/utils/Base/win32/Mutex.h new file mode 100755 index 00000000..66e1c08b --- /dev/null +++ b/external/3rd/library/platform/utils/Base/win32/Mutex.h @@ -0,0 +1,73 @@ +//////////////////////////////////////// +// Mutex.h +// +// Purpose: +// 1. Declair the CMutex class that encapsulates the functionality of a +// mutually-exclusive device. +// +// Revisions: +// 07/10/2001 Created +// + +#ifndef BASE_WIN32_MUTEX_H +#define BASE_WIN32_MUTEX_H + +#if defined (_MT) + +#include "Platform.h" + +#ifdef EXTERNAL_DISTRO +namespace NAMESPACE +{ + +#endif +namespace Base +{ + + //////////////////////////////////////// + // Class: + // CMutex + // + // Purpose: + // Encapsulates the functionality of a mutually-exclusive device. + // This class is valuable for protecting against race conditions + // within threaded applications. The CMutex class can be used to + // only allow a single thread to run within a specified code + // segment at a time. + // + // Public Methods: + // Lock() : Locks the mutex. If the mutex is already locked, the + // operating system will block the calling thread until another + // thread has unlocked the mutex. + // Unlock() : Unlocks the mutex. + // + class CMutex + { + public: + CMutex(); + ~CMutex(); + + void Lock(); + void Unlock(); + private: + CRITICAL_SECTION mCriticalSection; + }; + + inline void CMutex::Lock() + { + EnterCriticalSection(&mCriticalSection); + } + + inline void CMutex::Unlock() + { + LeaveCriticalSection(&mCriticalSection); + } + +}; +#ifdef EXTERNAL_DISTRO +}; +#endif + +#endif // #if defined(_MT) + +#endif // BASE_WIN32_MUTEX_H \ No newline at end of file diff --git a/external/3rd/library/platform/utils/Base/win32/Platform.cpp b/external/3rd/library/platform/utils/Base/win32/Platform.cpp new file mode 100755 index 00000000..3b52563e --- /dev/null +++ b/external/3rd/library/platform/utils/Base/win32/Platform.cpp @@ -0,0 +1,31 @@ +//////////////////////////////////////// +// Platform.cpp +// +// Purpose: +// 1. Implementation of the global functionality declaired in Platform.h. +// +// Revisions: +// 07/10/2001 Created +// + +#include "Platform.h" + +#ifdef EXTERNAL_DISTRO +namespace NAMESPACE +{ + +#endif +namespace Base +{ + + + CTimer::CTimer() : + mTimer(0) + { + } + + +}; +#ifdef EXTERNAL_DISTRO +}; +#endif diff --git a/external/3rd/library/platform/utils/Base/win32/Platform.h b/external/3rd/library/platform/utils/Base/win32/Platform.h new file mode 100755 index 00000000..aaee37b7 --- /dev/null +++ b/external/3rd/library/platform/utils/Base/win32/Platform.h @@ -0,0 +1,98 @@ +//////////////////////////////////////// +// Platform.h +// +// Purpose: +// 1. Include relevent system headers that are platform specific. +// 2. Declair global platform specific functionality. +// 3. Include primative type definitions +// +// Global Functions: +// getTimer() : Return the current high resolution clock count. +// getTimerFrequency() : Return the frequency of the high resolution clock. +// sleep() : Voluntarily relinquish timeslice of the calling thread for a +// specified number of milliseconds. +// +// Revisions: +// 07/10/2001 Created +// + +#ifndef BASE_WIN32_PLATFORM_H +#define BASE_WIN32_PLATFORM_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include "Types.h" + +#ifdef EXTERNAL_DISTRO +namespace NAMESPACE +{ + +#endif +namespace Base +{ + + uint64 getTimer(void); + uint64 getTimerFrequency(void); + + inline uint64 getTimer(void) + { + uint64 result; + if (!QueryPerformanceCounter(reinterpret_cast(&result))) + result = 0; + return result; + } + + inline uint64 getTimerFrequency(void) + { + uint64 result; + if (!QueryPerformanceFrequency(reinterpret_cast(&result))) + result = 0; + return result; + } + + inline void sleep(uint32 ms) + { + Sleep(ms); + } + + + class CTimer + { + public: + CTimer(); + + void Set(uint32 seconds); + void Signal(); + bool Expired(); + + private: + uint32 mTimer; + }; + + inline void CTimer::Set(uint32 interval) + { + mTimer = (uint32)time(0) + interval; + } + + inline void CTimer::Signal() + { + mTimer = 0; + } + + inline bool CTimer::Expired() + { + return (mTimer <= (uint32)time(0)); + } +}; +#ifdef EXTERNAL_DISTRO +}; +#endif + + +#endif BASE_WIN32_PLATFORM_H \ No newline at end of file diff --git a/external/3rd/library/platform/utils/Base/win32/Thread.cpp b/external/3rd/library/platform/utils/Base/win32/Thread.cpp new file mode 100755 index 00000000..2692e88e --- /dev/null +++ b/external/3rd/library/platform/utils/Base/win32/Thread.cpp @@ -0,0 +1,279 @@ +//////////////////////////////////////// +// Thread.cpp +// +// Purpose: +// 1. Implementation of the CThread class. +// +// Revisions: +// 07/10/2001 Created +// + + +#pragma warning ( disable: 4786 ) + + +#if !defined(_MT) +# pragma message( "Excluding Base::CThread - requires multi-threaded compile. (_MT)" ) +#else + +#include +#include +#include "Thread.h" + +using namespace std; + + +#ifdef EXTERNAL_DISTRO +namespace NAMESPACE +{ + +#endif +namespace Base +{ + + void threadProc(void *threadPtr) + { + CThread &thread = *((CThread*)threadPtr); + thread.mThreadActive = true; + thread.ThreadProc(); + thread.mThreadActive = false; + } + + CThread::CThread() + { + mThreadID = 0; + mThreadActive = false; + mThreadContinue = false; + } + + CThread::~CThread() + { + StopThread(); + } + + void CThread::StartThread() + { + mThreadContinue = true; + mThreadID = _beginthread(threadProc,0,this); + while (!IsThreadActive()) + Base::sleep(1); + } + + int32 CThread::StopThread(int32 timeout) + { + timeout += int(time(0)); + + mThreadContinue = false; + while (mThreadActive && time(0)OnStartup(this); + while (mThreadContinue) + { + mParent->OnIdle(this); + mSemaphore.Wait(mParent->GetTimeOut()*1000); + + if (mFunction) + { + mFunction(mArgument); + mArgument = NULL; + mFunction = NULL; + } + else if (mParent->OnDestory(this)) + mThreadContinue = false; + } + } + + +//////////////////////////////////////////////////////////////////////////////// + + + CThreadPool::CThreadPool(uint32 maxThreads, uint32 minThreads, uint32 timeout) : + mMutex(), + mIdleMember(), + mBusyMember(), + mNullMember(), + mThreadCount(0), + mMaxThreads(maxThreads), + mMinThreads(minThreads), + mTimeOut(timeout) + { + if (mMaxThreads == 0) mMaxThreads = 1; + if (mMinThreads == 0) mMinThreads = 1; + if (mMinThreads > mMaxThreads) mMinThreads = mMaxThreads; + + for (uint32 i=0; i::iterator setIterator; + + //////////////////////////////////////// + // (1) Destory all busy member threads + mMutex.Lock(); + setIterator = mBusyMember.begin(); + while (setIterator != mBusyMember.end()) + (*setIterator++)->Destroy(); + mMutex.Unlock(); + + //////////////////////////////////////// + // (2) Destory all idle member threads + while (mThreadCount) + { + mMutex.Lock(); + setIterator = mIdleMember.begin(); + while (setIterator != mIdleMember.end()) + (*setIterator++)->Destroy(); + mMutex.Unlock(); + + sleep(1); + } + + //////////////////////////////////////// + // (3) Delete the null member threads + mMutex.Lock(); + while (!mNullMember.empty()) + { + delete mNullMember.front(); + mNullMember.pop_front(); + } + mMutex.Unlock(); + } + + bool CThreadPool::Execute(void( __cdecl *function )( void * ), void * arg) + { + mMutex.Lock(); + + //////////////////////////////////////// + // (1) If no idle members, return false to indicate that no threads + // were available. If the thread count is below the max, create + // a new thread. + if (mIdleMember.empty()) + { + if (mThreadCount < mMaxThreads) + new CMember(this); + mMutex.Unlock(); + return false; + } + + //////////////////////////////////////// + // (2) Delete any null member threads. + while (!mNullMember.empty()) + { + delete mNullMember.front(); + mNullMember.pop_front(); + } + + //////////////////////////////////////// + // (3) Move the first idle thread to the busy set and signal the + // thread to execute the specified function. + CMember * member = *(mIdleMember.begin()); + mIdleMember.erase(member); + mBusyMember.insert(member); + member->Execute(function,arg); + + mMutex.Unlock(); + return true; + } + + uint32 CThreadPool::GetTimeOut() + { + return mTimeOut; + } + + void CThreadPool::OnStartup(CMember * member) + { + mMutex.Lock(); + + mThreadCount++; + mIdleMember.insert(member); + + mMutex.Unlock(); + } + + void CThreadPool::OnIdle(CMember * member) + { + mMutex.Lock(); + + mBusyMember.erase(member); + mIdleMember.insert(member); + + mMutex.Unlock(); + } + + bool CThreadPool::OnDestory(CMember * member) + { + set::iterator setIterator; + + mMutex.Lock(); + + bool result = (setIterator = mIdleMember.find(member)) != mIdleMember.end(); + if (result) + { + mNullMember.push_back(member); + mIdleMember.erase(setIterator); + mThreadCount--; + } + + mMutex.Unlock(); + + return result; + } + + +//////////////////////////////////////////////////////////////////////////////// + +}; +#ifdef EXTERNAL_DISTRO +}; +#endif + + +#endif // #if defined(_MT) + diff --git a/external/3rd/library/platform/utils/Base/win32/Thread.h b/external/3rd/library/platform/utils/Base/win32/Thread.h new file mode 100755 index 00000000..a8338917 --- /dev/null +++ b/external/3rd/library/platform/utils/Base/win32/Thread.h @@ -0,0 +1,144 @@ +//////////////////////////////////////// +// Thread.h +// +// Purpose: +// 1. Declair the CThread class that encapsulates threading functionality. +// This abstract base class in intended to be used to encapsulate +// individual tasks that require threading in derived classes. +// +// Revisions: +// 07/10/2001 Created +// + +#ifndef BASE_WIN32_THREAD_H +#define BASE_WIN32_THREAD_H + +#if defined(_MT) + +#pragma warning( disable : 4786) + +#include +#include +#include "Platform.h" +#include "Mutex.h" +#include "Event.h" + +#ifdef EXTERNAL_DISTRO +namespace NAMESPACE +{ + +#endif +namespace Base +{ + + //////////////////////////////////////// + // Class: + // CThread + // + // Purpose: + // Encapsulates threading functionality. Creating classes derived + // from CThread provides an easy way to encapsulate tasks that require + // their own thread. + // + // Public Methods: + // StartThread() : Creates the low-level thread handle and begins executing + // the CThread::ThreadProc() function within the new thread. + // StopThread() : Signals the ThreadProc() function to stop executing using + // the mThreadContinue member variable, and waits for the ThreadProc() + // function to exit. By default, the function will block for a maximum + // of 5 seconds before exiting without the thread halting. + // IsThreadActive() : Returns true if the physical thread is still executing + // within the ThreadProc() function, otherwise it returns false. + // ThreadProc() : Pure-virtual function that will be executed when the StartThread() + // function is called. Derived classes must implement this function. The + // mThreadContinue member variable should be used internal the the ThreadProc() + // function to indicate whether it should continue executing or exit. + // Protected Attributes: + // mThreadContinue : Boolean value indicating to the ThreadProc() function + // whether to continue executing or to exit. If mThreadContinue is true, + // ThreadProc() should continue, otherwise ThreadProc() should exit. It + // left up to the derived class to implement a ThreadProc() function that + // uses the mThreadContinue member. + // + // + class CThread + { + friend void threadProc(void *); + + public: + enum { eSTOP_SUCCESS, eSTOP_TIMEOUT }; + public: + CThread(); + virtual ~CThread(); + + void StartThread(); + int32 StopThread(int32 timeout=5); + bool IsThreadActive() { return mThreadActive; } + + protected: + virtual void ThreadProc() = 0; + + protected: + bool mThreadContinue; + private: + uint32 mThreadID; + bool mThreadActive; + }; + + + class CThreadPool + { + private: + class CMember : public CThread + { + public: + CMember(CThreadPool * parent); + virtual ~CMember(); + + bool Execute(void( __cdecl *function )( void * ), void * arg); + void Destroy(); + + protected: + virtual void ThreadProc(); + + private: + CThreadPool * mParent; + void( __cdecl * mFunction )( void * ); + void * mArgument; + CEvent mSemaphore; + }; + friend class CMember; + + public: + CThreadPool(uint32 maxThreads, uint32 minThreads=1, uint32 timeout=15*60); + ~CThreadPool(); + + bool Execute(void( __cdecl *function )( void * ), void * arg); + + private: + uint32 GetTimeOut(); + void OnStartup(CMember * member); + void OnIdle(CMember * member); + bool OnDestory(CMember * member); + + private: + CMutex mMutex; + std::set mIdleMember; + std::set mBusyMember; + std::list mNullMember; + uint32 mThreadCount; + + uint32 mMaxThreads; + uint32 mMinThreads; + uint32 mTimeOut; + }; + + +}; +#ifdef EXTERNAL_DISTRO +}; +#endif + +#endif // #if defined(_MT) + +#endif // BASE_WIN32_THREAD_H diff --git a/external/3rd/library/platform/utils/Base/win32/Types.h b/external/3rd/library/platform/utils/Base/win32/Types.h new file mode 100755 index 00000000..0c64cb2c --- /dev/null +++ b/external/3rd/library/platform/utils/Base/win32/Types.h @@ -0,0 +1,42 @@ +//////////////////////////////////////// +// Types.h +// +// Purpose: +// 1. Define integer types that are unambiguous with respect to size +// +// Revisions: +// 07/10/2001 Created +// + +#ifndef BASE_WIN32_TYPES_H +#define BASE_WIN32_TYPES_H + +#ifdef EXTERNAL_DISTRO +namespace NAMESPACE +{ + +#endif +namespace Base +{ + +#define INT32_MAX 0x7FFFFFFF +#define INT32_MIN 0x80000000 +#define UINT32_MAX 0xFFFFFFFF + +typedef signed char int8; +typedef unsigned char uint8; +typedef short int16; +typedef unsigned short uint16; + +typedef int int32; +typedef unsigned uint32; +typedef __int64 int64; +typedef unsigned __int64 uint64; + +}; +#ifdef EXTERNAL_DISTRO +}; +#endif + +#endif // BASE_WIN32_TYPES_H + diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/Archive.h b/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/Archive.h new file mode 100755 index 00000000..30ddce43 --- /dev/null +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/Archive.h @@ -0,0 +1,42 @@ +#ifndef BASE_WIN32_ARCHIVE_H +#define BASE_WIN32_ARCHIVE_H + +#ifdef EXTERNAL_DISTRO +namespace NAMESPACE +{ + +#endif +namespace Base +{ + + +#ifdef PACK_BIG_ENDIAN + + inline double byteSwap(double value) { byteReverse64(&value); return value; } + inline float byteSwap(float value) { byteReverse32(&value); return value; } + inline uint64 byteSwap(uint64 value) { byteReverse64(&value); return value; } + inline int64 byteSwap(int64 value) { byteReverse64(&value); return value; } + inline uint32 byteSwap(uint32 value) { byteReverse32(&value); return value; } + inline int32 byteSwap(int32 value) { byteReverse32(&value); return value; } + inline uint16 byteSwap(uint16 value) { byteReverse16(&value); return value; } + inline int16 byteSwap(int16 value) { byteReverse16(&value); return value; } + +#else + + inline double byteSwap(double value) { return value; } + inline float byteSwap(float value) { return value; } + inline uint64 byteSwap(uint64 value) { return value; } + inline int64 byteSwap(int64 value) { return value; } + inline uint32 byteSwap(uint32 value) { return value; } + inline int32 byteSwap(int32 value) { return value; } + inline uint16 byteSwap(uint16 value) { return value; } + inline int16 byteSwap(int16 value) { return value; } + +#endif + +}; +#ifdef EXTERNAL_DISTRO +}; +#endif + +#endif diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/BlockAllocator.cpp b/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/BlockAllocator.cpp new file mode 100755 index 00000000..927c5aef --- /dev/null +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/BlockAllocator.cpp @@ -0,0 +1,112 @@ +#include "../BlockAllocator.h" + +#ifdef EXTERNAL_DISTRO +namespace NAMESPACE +{ + +#endif +namespace Base +{ + + BlockAllocator::BlockAllocator() + { + for(unsigned i = 0; i < 31; i++) + { + m_blocks[i] = NULL; + } + } + + BlockAllocator::~BlockAllocator() + { + // free all allocated memory blocks + for(unsigned i = 0; i < 31; i++) + { + while(m_blocks[i] != NULL) + { + uintptr_t *tmp = m_blocks[i]; + m_blocks[i] = (uintptr_t *)*m_blocks[i]; + free(tmp); + } + } + } + +// Allocate a block that is the next power of two greater than the # of bytes passed. +// 33 bytes yields a 64 byte block of memory and so forth. + + void *BlockAllocator::getBlock(unsigned bytes) + { + unsigned accum = 16, bits = 16; + unsigned *handle = NULL; + + // Perform a binary search looking for the highest bit. + + while(bits != 0) + { + // If bytes is less than the bit we're testing for, subtract half + // from the bit value and repeat + if(bytes < (unsigned)(1 << accum)) + { + bits /= 2; + accum -= bits; + } + // If bytes is greater than the bit we're testing for, add half + // from the but value and repeat + else if(bytes > (unsigned)(1 << accum)) + { + bits /= 2; + accum += bits; + } + // Got lucky and hit the value dead on + else + { + break; + } + } + // At this point accum contains the most significant bit index, increment + accum++; + if(accum < 2) + { + accum = 2; + } + + // Note that when memory is actually allocated, 8 extra bytes will be allocated.at the front + // The first integer is the address of the next block of memory when the block is in the allocator + // The second integer is the bit length of the block + // Memory is allocated on 4 byte boundaries to sidestep byte alignment problems + + + // Check if the allocator already has a block of that size + if(m_blocks[accum] == 0) + { + // remove the pre allocated block from the linked list + handle = (uintptr_t *)calloc(((1 << accum) / 4) + 2, sizeof(uintptr_t)); + handle[1] = accum; + handle[0] = 0; + } + else + { + // Allocate a new block + handle = m_blocks[accum]; + m_blocks[accum] = (uintptr_t *)handle[0]; + handle[0] = 0; + } + // return a pointer that skips over the header used for the allocator's purposes + return(handle + 2); + } + + void BlockAllocator::returnBlock(uintptr_t *handle) + { + // C++ allows for safe deletion of a NULL pointer + if(handle) + { + // Update the allocator linked list, insert this entry at the head + *(handle - 2) = (uintptr_t)m_blocks[*(handle - 1)]; + // Add this entry to the proper linked list node + m_blocks[*(handle - 1)] = (handle - 2); + } + } +}; +#ifdef EXTERNAL_DISTRO +}; +#endif + diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/Event.cpp b/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/Event.cpp new file mode 100755 index 00000000..12ee8fe7 --- /dev/null +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/Event.cpp @@ -0,0 +1,44 @@ +//////////////////////////////////////// +// Event.cpp +// +// Purpose: +// 1. Implementation of the CEvent class. +// +// Revisions: +// 07/10/2001 Created +// + + +#if !defined(_MT) +# pragma message( "Excluding Base::CEvent - requires multi-threaded compile. (_MT)" ) +#else + +#include "Event.h" + +#ifdef EXTERNAL_DISTRO +namespace NAMESPACE +{ + +#endif +namespace Base +{ + + CEvent::CEvent() + { + mEvent = CreateEvent( NULL, FALSE, FALSE, NULL ); + } + + CEvent::~CEvent() + { + if (mEvent) + CloseHandle(mEvent); + } + +}; +#ifdef EXTERNAL_DISTRO +}; +#endif + + +#endif // #if defined(_MT) + diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/Event.h b/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/Event.h new file mode 100755 index 00000000..5d2bc712 --- /dev/null +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/Event.h @@ -0,0 +1,92 @@ +//////////////////////////////////////// +// Event.h +// +// Purpose: +// 1. Declair the CEvent class that encapsulates the functionality of a +// single-locking semaphore. +// +// Revisions: +// 07/10/2001 Created +// + +#ifndef BASE_WIN32_EVENT_H +#define BASE_WIN32_EVENT_H + +#if defined(_MT) + + + +#include "Platform.h" + +#ifdef EXTERNAL_DISTRO +namespace NAMESPACE +{ + +#endif +namespace Base +{ + + //////////////////////////////////////// + // Class: + // CEvent + // + // Purpose: + // Encapsulates the functionality of a singal-locking semaphore. + // This class is valuable for thread syncronization when a thead's + // execution needs to be dependent upon another thread. + // + // Public Methods: + // Signal() : Signals a thread that has called Wait() so that it can + // continue execution. This function returns true if the waiting + // thread was signalled successfully, otherwise false is returned. + // Wait() : Halts the calling thread's execution indefinately until + // a Singal() call is made by an external thread. If the thread is + // successfully signalled, the function returns eWAIT_SIGNAL. If + // timeout period expires without a signal, eWAIT_TIMEOUT is returned. + // If the function fails, eWAIT_ERROR is returned. + // + class CEvent + { + public: + CEvent(); + virtual ~CEvent(); + + bool Signal(); + int32 Wait(uint32 timeout = 0); + + public: + enum { eWAIT_ERROR, eWAIT_SIGNAL, eWAIT_TIMEOUT }; + private: + HANDLE mEvent; + }; + + inline bool CEvent::Signal() + { + if (mEvent) + return SetEvent(mEvent)!=0; + + return false; + } + + inline int32 CEvent::Wait(uint32 timeout) + { + if (!mEvent) + return CEvent::eWAIT_ERROR; + + DWORD result = WaitForSingleObjectEx(mEvent, timeout ? timeout : INFINITE, FALSE); + if (result == WAIT_OBJECT_0) + return CEvent::eWAIT_SIGNAL; + else if (result == WAIT_TIMEOUT) + return CEvent::eWAIT_TIMEOUT; + else + return CEvent::eWAIT_ERROR; + } + +}; +#ifdef EXTERNAL_DISTRO +}; +#endif +#endif // #if defined(_MT) + + +#endif // BASE_WIN32_EVENT_H diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/File.cpp b/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/File.cpp new file mode 100755 index 00000000..e6b6ee23 --- /dev/null +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/File.cpp @@ -0,0 +1,19 @@ +// File.cpp: implementation of the CFile class. +// +////////////////////////////////////////////////////////////////////// + +#include "File.h" + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +CFile::CFile(const char *) +{ + +} + +CFile::~CFile() +{ + +} diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/File.h b/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/File.h new file mode 100755 index 00000000..7965427a --- /dev/null +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/File.h @@ -0,0 +1,22 @@ +// File.h: interface for the CFile class. +// +////////////////////////////////////////////////////////////////////// + +#ifndef BASE_FILE_H +#define BASE_FILE_H + +#include + +class CFile +{ + public: + CFile(const char *); + virtual ~CFile(); + + bool IsOpen(); + + private: + FILE* mFileHandle; +}; + +#endif // BASE_FILE_H diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/Mutex.cpp b/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/Mutex.cpp new file mode 100755 index 00000000..482481e8 --- /dev/null +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/Mutex.cpp @@ -0,0 +1,40 @@ +//////////////////////////////////////// +// Mutex.cpp +// +// Purpose: +// 1. Implementation of the CMutex class. +// +// Revisions: +// 07/10/2001 Created +// +#if !defined(_MT) +# pragma message( "Excluding Base::CMutex - requires multi-threaded compile. (_MT)" ) +#else + +#include "Mutex.h" + +#ifdef EXTERNAL_DISTRO +namespace NAMESPACE +{ + +#endif +namespace Base +{ + +CMutex::CMutex() + { + InitializeCriticalSection(&mCriticalSection); + } + +CMutex::~CMutex() + { + DeleteCriticalSection(&mCriticalSection); + } +}; +#ifdef EXTERNAL_DISTRO +}; +#endif + + +#endif // #if defined(_MT) + diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/Mutex.h b/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/Mutex.h new file mode 100755 index 00000000..66e1c08b --- /dev/null +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/Mutex.h @@ -0,0 +1,73 @@ +//////////////////////////////////////// +// Mutex.h +// +// Purpose: +// 1. Declair the CMutex class that encapsulates the functionality of a +// mutually-exclusive device. +// +// Revisions: +// 07/10/2001 Created +// + +#ifndef BASE_WIN32_MUTEX_H +#define BASE_WIN32_MUTEX_H + +#if defined (_MT) + +#include "Platform.h" + +#ifdef EXTERNAL_DISTRO +namespace NAMESPACE +{ + +#endif +namespace Base +{ + + //////////////////////////////////////// + // Class: + // CMutex + // + // Purpose: + // Encapsulates the functionality of a mutually-exclusive device. + // This class is valuable for protecting against race conditions + // within threaded applications. The CMutex class can be used to + // only allow a single thread to run within a specified code + // segment at a time. + // + // Public Methods: + // Lock() : Locks the mutex. If the mutex is already locked, the + // operating system will block the calling thread until another + // thread has unlocked the mutex. + // Unlock() : Unlocks the mutex. + // + class CMutex + { + public: + CMutex(); + ~CMutex(); + + void Lock(); + void Unlock(); + private: + CRITICAL_SECTION mCriticalSection; + }; + + inline void CMutex::Lock() + { + EnterCriticalSection(&mCriticalSection); + } + + inline void CMutex::Unlock() + { + LeaveCriticalSection(&mCriticalSection); + } + +}; +#ifdef EXTERNAL_DISTRO +}; +#endif + +#endif // #if defined(_MT) + +#endif // BASE_WIN32_MUTEX_H \ No newline at end of file diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/Platform.cpp b/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/Platform.cpp new file mode 100755 index 00000000..3b52563e --- /dev/null +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/Platform.cpp @@ -0,0 +1,31 @@ +//////////////////////////////////////// +// Platform.cpp +// +// Purpose: +// 1. Implementation of the global functionality declaired in Platform.h. +// +// Revisions: +// 07/10/2001 Created +// + +#include "Platform.h" + +#ifdef EXTERNAL_DISTRO +namespace NAMESPACE +{ + +#endif +namespace Base +{ + + + CTimer::CTimer() : + mTimer(0) + { + } + + +}; +#ifdef EXTERNAL_DISTRO +}; +#endif diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/Platform.h b/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/Platform.h new file mode 100755 index 00000000..aaee37b7 --- /dev/null +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/Platform.h @@ -0,0 +1,98 @@ +//////////////////////////////////////// +// Platform.h +// +// Purpose: +// 1. Include relevent system headers that are platform specific. +// 2. Declair global platform specific functionality. +// 3. Include primative type definitions +// +// Global Functions: +// getTimer() : Return the current high resolution clock count. +// getTimerFrequency() : Return the frequency of the high resolution clock. +// sleep() : Voluntarily relinquish timeslice of the calling thread for a +// specified number of milliseconds. +// +// Revisions: +// 07/10/2001 Created +// + +#ifndef BASE_WIN32_PLATFORM_H +#define BASE_WIN32_PLATFORM_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include "Types.h" + +#ifdef EXTERNAL_DISTRO +namespace NAMESPACE +{ + +#endif +namespace Base +{ + + uint64 getTimer(void); + uint64 getTimerFrequency(void); + + inline uint64 getTimer(void) + { + uint64 result; + if (!QueryPerformanceCounter(reinterpret_cast(&result))) + result = 0; + return result; + } + + inline uint64 getTimerFrequency(void) + { + uint64 result; + if (!QueryPerformanceFrequency(reinterpret_cast(&result))) + result = 0; + return result; + } + + inline void sleep(uint32 ms) + { + Sleep(ms); + } + + + class CTimer + { + public: + CTimer(); + + void Set(uint32 seconds); + void Signal(); + bool Expired(); + + private: + uint32 mTimer; + }; + + inline void CTimer::Set(uint32 interval) + { + mTimer = (uint32)time(0) + interval; + } + + inline void CTimer::Signal() + { + mTimer = 0; + } + + inline bool CTimer::Expired() + { + return (mTimer <= (uint32)time(0)); + } +}; +#ifdef EXTERNAL_DISTRO +}; +#endif + + +#endif BASE_WIN32_PLATFORM_H \ No newline at end of file diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/Thread.cpp b/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/Thread.cpp new file mode 100755 index 00000000..cfb2c177 --- /dev/null +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/Thread.cpp @@ -0,0 +1,279 @@ +//////////////////////////////////////// +// Thread.cpp +// +// Purpose: +// 1. Implementation of the CThread class. +// +// Revisions: +// 07/10/2001 Created +// + + +#pragma warning ( disable: 4786 ) + + +#if !defined(_MT) +# pragma message( "Excluding Base::CThread - requires multi-threaded compile. (_MT)" ) +#else + +#include +#include +#include "Thread.h" + +using namespace std; + + +#ifdef EXTERNAL_DISTRO +namespace NAMESPACE +{ + +#endif +namespace Base +{ + + void threadProc(void *threadPtr) + { + CThread &thread = *((CThread*)threadPtr); + thread.mThreadActive = true; + thread.ThreadProc(); + thread.mThreadActive = false; + } + + CThread::CThread() + { + mThreadID = 0; + mThreadActive = false; + mThreadContinue = false; + } + + CThread::~CThread() + { + StopThread(); + } + + void CThread::StartThread() + { + mThreadContinue = true; + mThreadID = _beginthread(threadProc,0,this); + while (!IsThreadActive()) + Base::sleep(1); + } + + int32 CThread::StopThread(int32 timeout) + { + timeout += time(0); + + mThreadContinue = false; + while (mThreadActive && time(0)OnStartup(this); + while (mThreadContinue) + { + mParent->OnIdle(this); + mSemaphore.Wait(mParent->GetTimeOut()*1000); + + if (mFunction) + { + mFunction(mArgument); + mArgument = NULL; + mFunction = NULL; + } + else if (mParent->OnDestory(this)) + mThreadContinue = false; + } + } + + +//////////////////////////////////////////////////////////////////////////////// + + + CThreadPool::CThreadPool(uint32 maxThreads, uint32 minThreads, uint32 timeout) : + mMutex(), + mIdleMember(), + mBusyMember(), + mNullMember(), + mThreadCount(0), + mMaxThreads(maxThreads), + mMinThreads(minThreads), + mTimeOut(timeout) + { + if (mMaxThreads == 0) mMaxThreads = 1; + if (mMinThreads == 0) mMinThreads = 1; + if (mMinThreads > mMaxThreads) mMinThreads = mMaxThreads; + + for (uint32 i=0; i::iterator setIterator; + + //////////////////////////////////////// + // (1) Destory all busy member threads + mMutex.Lock(); + setIterator = mBusyMember.begin(); + while (setIterator != mBusyMember.end()) + (*setIterator++)->Destroy(); + mMutex.Unlock(); + + //////////////////////////////////////// + // (2) Destory all idle member threads + while (mThreadCount) + { + mMutex.Lock(); + setIterator = mIdleMember.begin(); + while (setIterator != mIdleMember.end()) + (*setIterator++)->Destroy(); + mMutex.Unlock(); + + sleep(1); + } + + //////////////////////////////////////// + // (3) Delete the null member threads + mMutex.Lock(); + while (!mNullMember.empty()) + { + delete mNullMember.front(); + mNullMember.pop_front(); + } + mMutex.Unlock(); + } + + bool CThreadPool::Execute(void( __cdecl *function )( void * ), void * arg) + { + mMutex.Lock(); + + //////////////////////////////////////// + // (1) If no idle members, return false to indicate that no threads + // were available. If the thread count is below the max, create + // a new thread. + if (mIdleMember.empty()) + { + if (mThreadCount < mMaxThreads) + new CMember(this); + mMutex.Unlock(); + return false; + } + + //////////////////////////////////////// + // (2) Delete any null member threads. + while (!mNullMember.empty()) + { + delete mNullMember.front(); + mNullMember.pop_front(); + } + + //////////////////////////////////////// + // (3) Move the first idle thread to the busy set and signal the + // thread to execute the specified function. + CMember * member = *(mIdleMember.begin()); + mIdleMember.erase(member); + mBusyMember.insert(member); + member->Execute(function,arg); + + mMutex.Unlock(); + return true; + } + + uint32 CThreadPool::GetTimeOut() + { + return mTimeOut; + } + + void CThreadPool::OnStartup(CMember * member) + { + mMutex.Lock(); + + mThreadCount++; + mIdleMember.insert(member); + + mMutex.Unlock(); + } + + void CThreadPool::OnIdle(CMember * member) + { + mMutex.Lock(); + + mBusyMember.erase(member); + mIdleMember.insert(member); + + mMutex.Unlock(); + } + + bool CThreadPool::OnDestory(CMember * member) + { + set::iterator setIterator; + + mMutex.Lock(); + + bool result = (setIterator = mIdleMember.find(member)) != mIdleMember.end(); + if (result) + { + mNullMember.push_back(member); + mIdleMember.erase(setIterator); + mThreadCount--; + } + + mMutex.Unlock(); + + return result; + } + + +//////////////////////////////////////////////////////////////////////////////// + +}; +#ifdef EXTERNAL_DISTRO +}; +#endif + + +#endif // #if defined(_MT) + diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/Thread.h b/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/Thread.h new file mode 100755 index 00000000..a8338917 --- /dev/null +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/Thread.h @@ -0,0 +1,144 @@ +//////////////////////////////////////// +// Thread.h +// +// Purpose: +// 1. Declair the CThread class that encapsulates threading functionality. +// This abstract base class in intended to be used to encapsulate +// individual tasks that require threading in derived classes. +// +// Revisions: +// 07/10/2001 Created +// + +#ifndef BASE_WIN32_THREAD_H +#define BASE_WIN32_THREAD_H + +#if defined(_MT) + +#pragma warning( disable : 4786) + +#include +#include +#include "Platform.h" +#include "Mutex.h" +#include "Event.h" + +#ifdef EXTERNAL_DISTRO +namespace NAMESPACE +{ + +#endif +namespace Base +{ + + //////////////////////////////////////// + // Class: + // CThread + // + // Purpose: + // Encapsulates threading functionality. Creating classes derived + // from CThread provides an easy way to encapsulate tasks that require + // their own thread. + // + // Public Methods: + // StartThread() : Creates the low-level thread handle and begins executing + // the CThread::ThreadProc() function within the new thread. + // StopThread() : Signals the ThreadProc() function to stop executing using + // the mThreadContinue member variable, and waits for the ThreadProc() + // function to exit. By default, the function will block for a maximum + // of 5 seconds before exiting without the thread halting. + // IsThreadActive() : Returns true if the physical thread is still executing + // within the ThreadProc() function, otherwise it returns false. + // ThreadProc() : Pure-virtual function that will be executed when the StartThread() + // function is called. Derived classes must implement this function. The + // mThreadContinue member variable should be used internal the the ThreadProc() + // function to indicate whether it should continue executing or exit. + // Protected Attributes: + // mThreadContinue : Boolean value indicating to the ThreadProc() function + // whether to continue executing or to exit. If mThreadContinue is true, + // ThreadProc() should continue, otherwise ThreadProc() should exit. It + // left up to the derived class to implement a ThreadProc() function that + // uses the mThreadContinue member. + // + // + class CThread + { + friend void threadProc(void *); + + public: + enum { eSTOP_SUCCESS, eSTOP_TIMEOUT }; + public: + CThread(); + virtual ~CThread(); + + void StartThread(); + int32 StopThread(int32 timeout=5); + bool IsThreadActive() { return mThreadActive; } + + protected: + virtual void ThreadProc() = 0; + + protected: + bool mThreadContinue; + private: + uint32 mThreadID; + bool mThreadActive; + }; + + + class CThreadPool + { + private: + class CMember : public CThread + { + public: + CMember(CThreadPool * parent); + virtual ~CMember(); + + bool Execute(void( __cdecl *function )( void * ), void * arg); + void Destroy(); + + protected: + virtual void ThreadProc(); + + private: + CThreadPool * mParent; + void( __cdecl * mFunction )( void * ); + void * mArgument; + CEvent mSemaphore; + }; + friend class CMember; + + public: + CThreadPool(uint32 maxThreads, uint32 minThreads=1, uint32 timeout=15*60); + ~CThreadPool(); + + bool Execute(void( __cdecl *function )( void * ), void * arg); + + private: + uint32 GetTimeOut(); + void OnStartup(CMember * member); + void OnIdle(CMember * member); + bool OnDestory(CMember * member); + + private: + CMutex mMutex; + std::set mIdleMember; + std::set mBusyMember; + std::list mNullMember; + uint32 mThreadCount; + + uint32 mMaxThreads; + uint32 mMinThreads; + uint32 mTimeOut; + }; + + +}; +#ifdef EXTERNAL_DISTRO +}; +#endif + +#endif // #if defined(_MT) + +#endif // BASE_WIN32_THREAD_H diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/Types.h b/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/Types.h new file mode 100755 index 00000000..0c64cb2c --- /dev/null +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/Types.h @@ -0,0 +1,42 @@ +//////////////////////////////////////// +// Types.h +// +// Purpose: +// 1. Define integer types that are unambiguous with respect to size +// +// Revisions: +// 07/10/2001 Created +// + +#ifndef BASE_WIN32_TYPES_H +#define BASE_WIN32_TYPES_H + +#ifdef EXTERNAL_DISTRO +namespace NAMESPACE +{ + +#endif +namespace Base +{ + +#define INT32_MAX 0x7FFFFFFF +#define INT32_MIN 0x80000000 +#define UINT32_MAX 0xFFFFFFFF + +typedef signed char int8; +typedef unsigned char uint8; +typedef short int16; +typedef unsigned short uint16; + +typedef int int32; +typedef unsigned uint32; +typedef __int64 int64; +typedef unsigned __int64 uint64; + +}; +#ifdef EXTERNAL_DISTRO +}; +#endif + +#endif // BASE_WIN32_TYPES_H + diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/Base/win32/Archive.h b/external/3rd/library/soePlatform/CTServiceGameAPI/Base/win32/Archive.h new file mode 100755 index 00000000..30ddce43 --- /dev/null +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/Base/win32/Archive.h @@ -0,0 +1,42 @@ +#ifndef BASE_WIN32_ARCHIVE_H +#define BASE_WIN32_ARCHIVE_H + +#ifdef EXTERNAL_DISTRO +namespace NAMESPACE +{ + +#endif +namespace Base +{ + + +#ifdef PACK_BIG_ENDIAN + + inline double byteSwap(double value) { byteReverse64(&value); return value; } + inline float byteSwap(float value) { byteReverse32(&value); return value; } + inline uint64 byteSwap(uint64 value) { byteReverse64(&value); return value; } + inline int64 byteSwap(int64 value) { byteReverse64(&value); return value; } + inline uint32 byteSwap(uint32 value) { byteReverse32(&value); return value; } + inline int32 byteSwap(int32 value) { byteReverse32(&value); return value; } + inline uint16 byteSwap(uint16 value) { byteReverse16(&value); return value; } + inline int16 byteSwap(int16 value) { byteReverse16(&value); return value; } + +#else + + inline double byteSwap(double value) { return value; } + inline float byteSwap(float value) { return value; } + inline uint64 byteSwap(uint64 value) { return value; } + inline int64 byteSwap(int64 value) { return value; } + inline uint32 byteSwap(uint32 value) { return value; } + inline int32 byteSwap(int32 value) { return value; } + inline uint16 byteSwap(uint16 value) { return value; } + inline int16 byteSwap(int16 value) { return value; } + +#endif + +}; +#ifdef EXTERNAL_DISTRO +}; +#endif + +#endif diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/Base/win32/Platform.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/Base/win32/Platform.cpp new file mode 100755 index 00000000..3b52563e --- /dev/null +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/Base/win32/Platform.cpp @@ -0,0 +1,31 @@ +//////////////////////////////////////// +// Platform.cpp +// +// Purpose: +// 1. Implementation of the global functionality declaired in Platform.h. +// +// Revisions: +// 07/10/2001 Created +// + +#include "Platform.h" + +#ifdef EXTERNAL_DISTRO +namespace NAMESPACE +{ + +#endif +namespace Base +{ + + + CTimer::CTimer() : + mTimer(0) + { + } + + +}; +#ifdef EXTERNAL_DISTRO +}; +#endif diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/Base/win32/Platform.h b/external/3rd/library/soePlatform/CTServiceGameAPI/Base/win32/Platform.h new file mode 100755 index 00000000..aaee37b7 --- /dev/null +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/Base/win32/Platform.h @@ -0,0 +1,98 @@ +//////////////////////////////////////// +// Platform.h +// +// Purpose: +// 1. Include relevent system headers that are platform specific. +// 2. Declair global platform specific functionality. +// 3. Include primative type definitions +// +// Global Functions: +// getTimer() : Return the current high resolution clock count. +// getTimerFrequency() : Return the frequency of the high resolution clock. +// sleep() : Voluntarily relinquish timeslice of the calling thread for a +// specified number of milliseconds. +// +// Revisions: +// 07/10/2001 Created +// + +#ifndef BASE_WIN32_PLATFORM_H +#define BASE_WIN32_PLATFORM_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include "Types.h" + +#ifdef EXTERNAL_DISTRO +namespace NAMESPACE +{ + +#endif +namespace Base +{ + + uint64 getTimer(void); + uint64 getTimerFrequency(void); + + inline uint64 getTimer(void) + { + uint64 result; + if (!QueryPerformanceCounter(reinterpret_cast(&result))) + result = 0; + return result; + } + + inline uint64 getTimerFrequency(void) + { + uint64 result; + if (!QueryPerformanceFrequency(reinterpret_cast(&result))) + result = 0; + return result; + } + + inline void sleep(uint32 ms) + { + Sleep(ms); + } + + + class CTimer + { + public: + CTimer(); + + void Set(uint32 seconds); + void Signal(); + bool Expired(); + + private: + uint32 mTimer; + }; + + inline void CTimer::Set(uint32 interval) + { + mTimer = (uint32)time(0) + interval; + } + + inline void CTimer::Signal() + { + mTimer = 0; + } + + inline bool CTimer::Expired() + { + return (mTimer <= (uint32)time(0)); + } +}; +#ifdef EXTERNAL_DISTRO +}; +#endif + + +#endif BASE_WIN32_PLATFORM_H \ No newline at end of file diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/Base/win32/Types.h b/external/3rd/library/soePlatform/CTServiceGameAPI/Base/win32/Types.h new file mode 100755 index 00000000..0c64cb2c --- /dev/null +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/Base/win32/Types.h @@ -0,0 +1,42 @@ +//////////////////////////////////////// +// Types.h +// +// Purpose: +// 1. Define integer types that are unambiguous with respect to size +// +// Revisions: +// 07/10/2001 Created +// + +#ifndef BASE_WIN32_TYPES_H +#define BASE_WIN32_TYPES_H + +#ifdef EXTERNAL_DISTRO +namespace NAMESPACE +{ + +#endif +namespace Base +{ + +#define INT32_MAX 0x7FFFFFFF +#define INT32_MIN 0x80000000 +#define UINT32_MAX 0xFFFFFFFF + +typedef signed char int8; +typedef unsigned char uint8; +typedef short int16; +typedef unsigned short uint16; + +typedef int int32; +typedef unsigned uint32; +typedef __int64 int64; +typedef unsigned __int64 uint64; + +}; +#ifdef EXTERNAL_DISTRO +}; +#endif + +#endif // BASE_WIN32_TYPES_H + diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/Archive.h b/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/Archive.h new file mode 100755 index 00000000..30ddce43 --- /dev/null +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/Archive.h @@ -0,0 +1,42 @@ +#ifndef BASE_WIN32_ARCHIVE_H +#define BASE_WIN32_ARCHIVE_H + +#ifdef EXTERNAL_DISTRO +namespace NAMESPACE +{ + +#endif +namespace Base +{ + + +#ifdef PACK_BIG_ENDIAN + + inline double byteSwap(double value) { byteReverse64(&value); return value; } + inline float byteSwap(float value) { byteReverse32(&value); return value; } + inline uint64 byteSwap(uint64 value) { byteReverse64(&value); return value; } + inline int64 byteSwap(int64 value) { byteReverse64(&value); return value; } + inline uint32 byteSwap(uint32 value) { byteReverse32(&value); return value; } + inline int32 byteSwap(int32 value) { byteReverse32(&value); return value; } + inline uint16 byteSwap(uint16 value) { byteReverse16(&value); return value; } + inline int16 byteSwap(int16 value) { byteReverse16(&value); return value; } + +#else + + inline double byteSwap(double value) { return value; } + inline float byteSwap(float value) { return value; } + inline uint64 byteSwap(uint64 value) { return value; } + inline int64 byteSwap(int64 value) { return value; } + inline uint32 byteSwap(uint32 value) { return value; } + inline int32 byteSwap(int32 value) { return value; } + inline uint16 byteSwap(uint16 value) { return value; } + inline int16 byteSwap(int16 value) { return value; } + +#endif + +}; +#ifdef EXTERNAL_DISTRO +}; +#endif + +#endif diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/BlockAllocator.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/BlockAllocator.cpp new file mode 100755 index 00000000..6762bc2a --- /dev/null +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/BlockAllocator.cpp @@ -0,0 +1,112 @@ +#include "../BlockAllocator.h" + +#ifdef EXTERNAL_DISTRO +namespace NAMESPACE +{ + +#endif +namespace Base +{ + + BlockAllocator::BlockAllocator() + { + for(unsigned i = 0; i < 31; i++) + { + m_blocks[i] = NULL; + } + } + + BlockAllocator::~BlockAllocator() + { + // free all allocated memory blocks + for(unsigned i = 0; i < 31; i++) + { + while(m_blocks[i] != NULL) + { + unsigned *tmp = m_blocks[i]; + m_blocks[i] = (uintptr_t *)*m_blocks[i]; + free(tmp); + } + } + } + +// Allocate a block that is the next power of two greater than the # of bytes passed. +// 33 bytes yields a 64 byte block of memory and so forth. + + void *BlockAllocator::getBlock(unsigned bytes) + { + unsigned accum = 16, bits = 16; + unsigned *handle = NULL; + + // Perform a binary search looking for the highest bit. + + while(bits != 0) + { + // If bytes is less than the bit we're testing for, subtract half + // from the bit value and repeat + if(bytes < (unsigned)(1 << accum)) + { + bits /= 2; + accum -= bits; + } + // If bytes is greater than the bit we're testing for, add half + // from the but value and repeat + else if(bytes > (unsigned)(1 << accum)) + { + bits /= 2; + accum += bits; + } + // Got lucky and hit the value dead on + else + { + break; + } + } + // At this point accum contains the most significant bit index, increment + accum++; + if(accum < 2) + { + accum = 2; + } + + // Note that when memory is actually allocated, 8 extra bytes will be allocated.at the front + // The first integer is the address of the next block of memory when the block is in the allocator + // The second integer is the bit length of the block + // Memory is allocated on 4 byte boundaries to sidestep byte alignment problems + + + // Check if the allocator already has a block of that size + if(m_blocks[accum] == 0) + { + // remove the pre allocated block from the linked list + handle = (unsigned *)calloc(((1 << accum) / 4) + 2, sizeof(unsigned)); + handle[1] = accum; + handle[0] = 0; + } + else + { + // Allocate a new block + handle = m_blocks[accum]; + m_blocks[accum] = (uintptr_t *)handle[0]; + handle[0] = 0; + } + // return a pointer that skips over the header used for the allocator's purposes + return(handle + 2); + } + + void BlockAllocator::returnBlock(uintptr_t *handle) + { + // C++ allows for safe deletion of a NULL pointer + if(handle) + { + // Update the allocator linked list, insert this entry at the head + *(handle - 2) = (uintptr_t)m_blocks[*(handle - 1)]; + // Add this entry to the proper linked list node + m_blocks[*(handle - 1)] = (handle - 2); + } + } +}; +#ifdef EXTERNAL_DISTRO +}; +#endif + diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/Event.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/Event.cpp new file mode 100755 index 00000000..12ee8fe7 --- /dev/null +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/Event.cpp @@ -0,0 +1,44 @@ +//////////////////////////////////////// +// Event.cpp +// +// Purpose: +// 1. Implementation of the CEvent class. +// +// Revisions: +// 07/10/2001 Created +// + + +#if !defined(_MT) +# pragma message( "Excluding Base::CEvent - requires multi-threaded compile. (_MT)" ) +#else + +#include "Event.h" + +#ifdef EXTERNAL_DISTRO +namespace NAMESPACE +{ + +#endif +namespace Base +{ + + CEvent::CEvent() + { + mEvent = CreateEvent( NULL, FALSE, FALSE, NULL ); + } + + CEvent::~CEvent() + { + if (mEvent) + CloseHandle(mEvent); + } + +}; +#ifdef EXTERNAL_DISTRO +}; +#endif + + +#endif // #if defined(_MT) + diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/Event.h b/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/Event.h new file mode 100755 index 00000000..5d2bc712 --- /dev/null +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/Event.h @@ -0,0 +1,92 @@ +//////////////////////////////////////// +// Event.h +// +// Purpose: +// 1. Declair the CEvent class that encapsulates the functionality of a +// single-locking semaphore. +// +// Revisions: +// 07/10/2001 Created +// + +#ifndef BASE_WIN32_EVENT_H +#define BASE_WIN32_EVENT_H + +#if defined(_MT) + + + +#include "Platform.h" + +#ifdef EXTERNAL_DISTRO +namespace NAMESPACE +{ + +#endif +namespace Base +{ + + //////////////////////////////////////// + // Class: + // CEvent + // + // Purpose: + // Encapsulates the functionality of a singal-locking semaphore. + // This class is valuable for thread syncronization when a thead's + // execution needs to be dependent upon another thread. + // + // Public Methods: + // Signal() : Signals a thread that has called Wait() so that it can + // continue execution. This function returns true if the waiting + // thread was signalled successfully, otherwise false is returned. + // Wait() : Halts the calling thread's execution indefinately until + // a Singal() call is made by an external thread. If the thread is + // successfully signalled, the function returns eWAIT_SIGNAL. If + // timeout period expires without a signal, eWAIT_TIMEOUT is returned. + // If the function fails, eWAIT_ERROR is returned. + // + class CEvent + { + public: + CEvent(); + virtual ~CEvent(); + + bool Signal(); + int32 Wait(uint32 timeout = 0); + + public: + enum { eWAIT_ERROR, eWAIT_SIGNAL, eWAIT_TIMEOUT }; + private: + HANDLE mEvent; + }; + + inline bool CEvent::Signal() + { + if (mEvent) + return SetEvent(mEvent)!=0; + + return false; + } + + inline int32 CEvent::Wait(uint32 timeout) + { + if (!mEvent) + return CEvent::eWAIT_ERROR; + + DWORD result = WaitForSingleObjectEx(mEvent, timeout ? timeout : INFINITE, FALSE); + if (result == WAIT_OBJECT_0) + return CEvent::eWAIT_SIGNAL; + else if (result == WAIT_TIMEOUT) + return CEvent::eWAIT_TIMEOUT; + else + return CEvent::eWAIT_ERROR; + } + +}; +#ifdef EXTERNAL_DISTRO +}; +#endif +#endif // #if defined(_MT) + + +#endif // BASE_WIN32_EVENT_H diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/File.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/File.cpp new file mode 100755 index 00000000..c888e545 --- /dev/null +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/File.cpp @@ -0,0 +1,22 @@ +// File.cpp: implementation of the CFile class. +// +////////////////////////////////////////////////////////////////////// + +#include "File.h" + +namespace Base +{ + ////////////////////////////////////////////////////////////////////// + // Construction/Destruction + ////////////////////////////////////////////////////////////////////// + + CFile::CFile(const char *) + { + + } + + CFile::~CFile() + { + + } +} diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/File.h b/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/File.h new file mode 100755 index 00000000..fb15ccf1 --- /dev/null +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/File.h @@ -0,0 +1,26 @@ +// File.h: interface for the CFile class. +// +////////////////////////////////////////////////////////////////////// + +#ifndef BASE_FILE_H +#define BASE_FILE_H + +#include + +namespace Base +{ + + class CFile + { + public: + CFile(const char *); + virtual ~CFile(); + + bool IsOpen(); + + private: + FILE* mFileHandle; + }; +} + +#endif // BASE_FILE_H diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/Mutex.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/Mutex.cpp new file mode 100755 index 00000000..482481e8 --- /dev/null +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/Mutex.cpp @@ -0,0 +1,40 @@ +//////////////////////////////////////// +// Mutex.cpp +// +// Purpose: +// 1. Implementation of the CMutex class. +// +// Revisions: +// 07/10/2001 Created +// +#if !defined(_MT) +# pragma message( "Excluding Base::CMutex - requires multi-threaded compile. (_MT)" ) +#else + +#include "Mutex.h" + +#ifdef EXTERNAL_DISTRO +namespace NAMESPACE +{ + +#endif +namespace Base +{ + +CMutex::CMutex() + { + InitializeCriticalSection(&mCriticalSection); + } + +CMutex::~CMutex() + { + DeleteCriticalSection(&mCriticalSection); + } +}; +#ifdef EXTERNAL_DISTRO +}; +#endif + + +#endif // #if defined(_MT) + diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/Mutex.h b/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/Mutex.h new file mode 100755 index 00000000..66e1c08b --- /dev/null +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/Mutex.h @@ -0,0 +1,73 @@ +//////////////////////////////////////// +// Mutex.h +// +// Purpose: +// 1. Declair the CMutex class that encapsulates the functionality of a +// mutually-exclusive device. +// +// Revisions: +// 07/10/2001 Created +// + +#ifndef BASE_WIN32_MUTEX_H +#define BASE_WIN32_MUTEX_H + +#if defined (_MT) + +#include "Platform.h" + +#ifdef EXTERNAL_DISTRO +namespace NAMESPACE +{ + +#endif +namespace Base +{ + + //////////////////////////////////////// + // Class: + // CMutex + // + // Purpose: + // Encapsulates the functionality of a mutually-exclusive device. + // This class is valuable for protecting against race conditions + // within threaded applications. The CMutex class can be used to + // only allow a single thread to run within a specified code + // segment at a time. + // + // Public Methods: + // Lock() : Locks the mutex. If the mutex is already locked, the + // operating system will block the calling thread until another + // thread has unlocked the mutex. + // Unlock() : Unlocks the mutex. + // + class CMutex + { + public: + CMutex(); + ~CMutex(); + + void Lock(); + void Unlock(); + private: + CRITICAL_SECTION mCriticalSection; + }; + + inline void CMutex::Lock() + { + EnterCriticalSection(&mCriticalSection); + } + + inline void CMutex::Unlock() + { + LeaveCriticalSection(&mCriticalSection); + } + +}; +#ifdef EXTERNAL_DISTRO +}; +#endif + +#endif // #if defined(_MT) + +#endif // BASE_WIN32_MUTEX_H \ No newline at end of file diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/Platform.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/Platform.cpp new file mode 100755 index 00000000..3b52563e --- /dev/null +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/Platform.cpp @@ -0,0 +1,31 @@ +//////////////////////////////////////// +// Platform.cpp +// +// Purpose: +// 1. Implementation of the global functionality declaired in Platform.h. +// +// Revisions: +// 07/10/2001 Created +// + +#include "Platform.h" + +#ifdef EXTERNAL_DISTRO +namespace NAMESPACE +{ + +#endif +namespace Base +{ + + + CTimer::CTimer() : + mTimer(0) + { + } + + +}; +#ifdef EXTERNAL_DISTRO +}; +#endif diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/Platform.h b/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/Platform.h new file mode 100755 index 00000000..aaee37b7 --- /dev/null +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/Platform.h @@ -0,0 +1,98 @@ +//////////////////////////////////////// +// Platform.h +// +// Purpose: +// 1. Include relevent system headers that are platform specific. +// 2. Declair global platform specific functionality. +// 3. Include primative type definitions +// +// Global Functions: +// getTimer() : Return the current high resolution clock count. +// getTimerFrequency() : Return the frequency of the high resolution clock. +// sleep() : Voluntarily relinquish timeslice of the calling thread for a +// specified number of milliseconds. +// +// Revisions: +// 07/10/2001 Created +// + +#ifndef BASE_WIN32_PLATFORM_H +#define BASE_WIN32_PLATFORM_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include "Types.h" + +#ifdef EXTERNAL_DISTRO +namespace NAMESPACE +{ + +#endif +namespace Base +{ + + uint64 getTimer(void); + uint64 getTimerFrequency(void); + + inline uint64 getTimer(void) + { + uint64 result; + if (!QueryPerformanceCounter(reinterpret_cast(&result))) + result = 0; + return result; + } + + inline uint64 getTimerFrequency(void) + { + uint64 result; + if (!QueryPerformanceFrequency(reinterpret_cast(&result))) + result = 0; + return result; + } + + inline void sleep(uint32 ms) + { + Sleep(ms); + } + + + class CTimer + { + public: + CTimer(); + + void Set(uint32 seconds); + void Signal(); + bool Expired(); + + private: + uint32 mTimer; + }; + + inline void CTimer::Set(uint32 interval) + { + mTimer = (uint32)time(0) + interval; + } + + inline void CTimer::Signal() + { + mTimer = 0; + } + + inline bool CTimer::Expired() + { + return (mTimer <= (uint32)time(0)); + } +}; +#ifdef EXTERNAL_DISTRO +}; +#endif + + +#endif BASE_WIN32_PLATFORM_H \ No newline at end of file diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/Thread.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/Thread.cpp new file mode 100755 index 00000000..9dcbb9a9 --- /dev/null +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/Thread.cpp @@ -0,0 +1,315 @@ +//////////////////////////////////////// +// Thread.cpp +// +// Purpose: +// 1. Implementation of the CThread class. +// +// Revisions: +// 07/10/2001 Created +// + + +#pragma warning ( disable: 4786 ) + + +#if !defined(_MT) +# pragma message( "Excluding Base::CThread - requires multi-threaded compile. (_MT)" ) +#else + +#include +#include +#include "Thread.h" + +using namespace std; + + +#ifdef EXTERNAL_DISTRO +namespace NAMESPACE +{ + +#endif +namespace Base +{ + + void threadProc(void *threadPtr) + { + CThread &thread = *((CThread*)threadPtr); + thread.mThreadActive = true; + thread.ThreadProc(); + thread.mThreadActive = false; + } + + CThread::CThread() + { + mThreadID = 0; + mThreadActive = false; + mThreadContinue = false; + } + + CThread::~CThread() + { + StopThread(); + } + + void CThread::StartThread() + { + mThreadContinue = true; + mThreadID = _beginthread(threadProc,0,this); + while (!IsThreadActive()) + Base::sleep(1); + } + + int32 CThread::StopThread(int32 timeout) + { + timeout += time(0); + + mThreadContinue = false; + while (mThreadActive && time(0)OnStartup(this); + while (mThreadContinue) + { + mParent->OnIdle(this); + mSemaphore.Wait(mParent->GetTimeOut()*1000); + + if (mFunction) + { + mFunction(mArgument); + mArgument = NULL; + mFunction = NULL; + } + else if (mParent->OnDestory(this)) + mThreadContinue = false; + } + } + + +//////////////////////////////////////////////////////////////////////////////// + + + CThreadPool::CThreadPool(uint32 maxThreads, uint32 minThreads, uint32 timeout) : + mMutex(), + mIdleMember(), + mBusyMember(), + mNullMember(), + mThreadCount(0), + mMaxThreads(maxThreads), + mMinThreads(minThreads), + mTimeOut(timeout) + { + if (mMaxThreads == 0) mMaxThreads = 1; + if (mMinThreads == 0) mMinThreads = 1; + if (mMinThreads > mMaxThreads) mMinThreads = mMaxThreads; + + for (uint32 i=0; i::iterator setIterator; + + //////////////////////////////////////// + // (1) Destory all busy member threads + mMutex.Lock(); + setIterator = mBusyMember.begin(); + while (setIterator != mBusyMember.end()) + (*setIterator++)->Destroy(); + mMutex.Unlock(); + + //////////////////////////////////////// + // (2) Destory all idle member threads + while (mThreadCount) + { + mMutex.Lock(); + setIterator = mIdleMember.begin(); + while (setIterator != mIdleMember.end()) + (*setIterator++)->Destroy(); + mMutex.Unlock(); + + sleep(1); + } + + //////////////////////////////////////// + // (3) Delete the null member threads + mMutex.Lock(); + while (!mNullMember.empty()) + { + delete mNullMember.front(); + mNullMember.pop_front(); + } + mMutex.Unlock(); + } + + bool CThreadPool::Execute(void( __cdecl *function )( void * ), void * arg, uint32 poolGrowthSize ) + { + mMutex.Lock(); + + //////////////////////////////////////// + // (1) If no idle members, return false to indicate that no threads + // were available. If the thread count is below the max, create + // a new thread. + if (mIdleMember.empty()) + { + if (mThreadCount < mMaxThreads) + { + if (!poolGrowthSize) + poolGrowthSize = mMinThreads; + + if ((mThreadCount + poolGrowthSize) > mMaxThreads) + poolGrowthSize = mMaxThreads - mThreadCount; + + for (uint32 i(0); i < poolGrowthSize; i++) + new CMember(this); + mMutex.Unlock(); + time_t idleTimeout = time(0) + 5; + while(mIdleMember.empty()) + { + if (time(0) >= idleTimeout) + { + return false; + } + Base::sleep(10); + } + mMutex.Lock(); + + } + else + { + mMutex.Unlock(); + return false; + } + } + + //////////////////////////////////////// + // (2) Delete any null member threads. + while (!mNullMember.empty()) + { + delete mNullMember.front(); + mNullMember.pop_front(); + } + + //////////////////////////////////////// + // (3) Move the first idle thread to the busy set and signal the + // thread to execute the specified function. + CMember * member = *(mIdleMember.begin()); + mIdleMember.erase(member); + mBusyMember.insert(member); + member->Execute(function,arg); + + mMutex.Unlock(); + return true; + } + + uint32 CThreadPool::GetTimeOut() + { + return mTimeOut; + } + + void CThreadPool::OnStartup(CMember * member) + { + mMutex.Lock(); + + mThreadCount++; + mIdleMember.insert(member); + + mMutex.Unlock(); + } + + void CThreadPool::OnIdle(CMember * member) + { + mMutex.Lock(); + + mBusyMember.erase(member); + mIdleMember.insert(member); + + mMutex.Unlock(); + } + + bool CThreadPool::OnDestory(CMember * member) + { + set::iterator setIterator; + + mMutex.Lock(); + + bool result = (setIterator = mIdleMember.find(member)) != mIdleMember.end(); + if (result) + { + mNullMember.push_back(member); + mIdleMember.erase(setIterator); + mThreadCount--; + } + + mMutex.Unlock(); + + return result; + } + + SwitchableScopeLock::SwitchableScopeLock(CMutex & mutex, bool isOn) : + mMutex(mutex), + mIsOn(isOn) + { + if(mIsOn) { mMutex.Lock(); } + } + + SwitchableScopeLock::~SwitchableScopeLock() + { + if(mIsOn) { mMutex.Unlock(); } + } + + +//////////////////////////////////////////////////////////////////////////////// + +}; +#ifdef EXTERNAL_DISTRO +}; +#endif + + +#endif // #if defined(_MT) + diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/Thread.h b/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/Thread.h new file mode 100755 index 00000000..cbffabb6 --- /dev/null +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/Thread.h @@ -0,0 +1,152 @@ +//////////////////////////////////////// +// Thread.h +// +// Purpose: +// 1. Declair the CThread class that encapsulates threading functionality. +// This abstract base class in intended to be used to encapsulate +// individual tasks that require threading in derived classes. +// +// Revisions: +// 07/10/2001 Created +// + +#ifndef BASE_WIN32_THREAD_H +#define BASE_WIN32_THREAD_H + +#if defined(_MT) + +#pragma warning( disable : 4786) + +#include +#include +#include "Platform.h" +#include "Mutex.h" +#include "Event.h" + +#ifdef EXTERNAL_DISTRO +namespace NAMESPACE +{ + +#endif +namespace Base +{ + + //////////////////////////////////////// + // Class: + // CThread + // + // Purpose: + // Encapsulates threading functionality. Creating classes derived + // from CThread provides an easy way to encapsulate tasks that require + // their own thread. + // + // Public Methods: + // StartThread() : Creates the low-level thread handle and begins executing + // the CThread::ThreadProc() function within the new thread. + // StopThread() : Signals the ThreadProc() function to stop executing using + // the mThreadContinue member variable, and waits for the ThreadProc() + // function to exit. By default, the function will block for a maximum + // of 5 seconds before exiting without the thread halting. + // IsThreadActive() : Returns true if the physical thread is still executing + // within the ThreadProc() function, otherwise it returns false. + // ThreadProc() : Pure-virtual function that will be executed when the StartThread() + // function is called. Derived classes must implement this function. The + // mThreadContinue member variable should be used internal the the ThreadProc() + // function to indicate whether it should continue executing or exit. + // Protected Attributes: + // mThreadContinue : Boolean value indicating to the ThreadProc() function + // whether to continue executing or to exit. If mThreadContinue is true, + // ThreadProc() should continue, otherwise ThreadProc() should exit. It + // left up to the derived class to implement a ThreadProc() function that + // uses the mThreadContinue member. + // + // + class CThread + { + friend void threadProc(void *); + + public: + enum { eSTOP_SUCCESS, eSTOP_TIMEOUT }; + public: + CThread(); + virtual ~CThread(); + + void StartThread(); + int32 StopThread(int32 timeout=5); + bool IsThreadActive() { return mThreadActive; } + + protected: + virtual void ThreadProc() = 0; + + protected: + bool mThreadContinue; + private: + uint32 mThreadID; + bool mThreadActive; + }; + + + class CThreadPool + { + private: + class CMember : public CThread + { + public: + CMember(CThreadPool * parent); + virtual ~CMember(); + + bool Execute(void( __cdecl *function )( void * ), void * arg); + void Destroy(); + + protected: + virtual void ThreadProc(); + + private: + CThreadPool * mParent; + void( __cdecl * mFunction )( void * ); + void * mArgument; + CEvent mSemaphore; + }; + friend class CMember; + + public: + CThreadPool(uint32 maxThreads, uint32 minThreads=1, uint32 timeout=15*60); + ~CThreadPool(); + + virtual bool Execute(void( __cdecl *function )( void * ), void * arg, uint32 poolGrowthSize = 0); + + private: + uint32 GetTimeOut(); + void OnStartup(CMember * member); + void OnIdle(CMember * member); + bool OnDestory(CMember * member); + + private: + CMutex mMutex; + std::set mIdleMember; + std::set mBusyMember; + std::list mNullMember; + uint32 mThreadCount; + + uint32 mMaxThreads; + uint32 mMinThreads; + uint32 mTimeOut; + }; + + class SwitchableScopeLock + { + public: + SwitchableScopeLock(CMutex & mutex, bool isOn); + ~SwitchableScopeLock(); + private: + CMutex & mMutex; + bool mIsOn; + }; +}; +#ifdef EXTERNAL_DISTRO +}; +#endif + +#endif // #if defined(_MT) + +#endif // BASE_WIN32_THREAD_H diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/Types.h b/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/Types.h new file mode 100755 index 00000000..0c64cb2c --- /dev/null +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/Types.h @@ -0,0 +1,42 @@ +//////////////////////////////////////// +// Types.h +// +// Purpose: +// 1. Define integer types that are unambiguous with respect to size +// +// Revisions: +// 07/10/2001 Created +// + +#ifndef BASE_WIN32_TYPES_H +#define BASE_WIN32_TYPES_H + +#ifdef EXTERNAL_DISTRO +namespace NAMESPACE +{ + +#endif +namespace Base +{ + +#define INT32_MAX 0x7FFFFFFF +#define INT32_MIN 0x80000000 +#define UINT32_MAX 0xFFFFFFFF + +typedef signed char int8; +typedef unsigned char uint8; +typedef short int16; +typedef unsigned short uint16; + +typedef int int32; +typedef unsigned uint32; +typedef __int64 int64; +typedef unsigned __int64 uint64; + +}; +#ifdef EXTERNAL_DISTRO +}; +#endif + +#endif // BASE_WIN32_TYPES_H + diff --git a/external/ours/library/archive/src/win32/ArchiveMutex.cpp b/external/ours/library/archive/src/win32/ArchiveMutex.cpp new file mode 100755 index 00000000..016c070b --- /dev/null +++ b/external/ours/library/archive/src/win32/ArchiveMutex.cpp @@ -0,0 +1,35 @@ +// ====================================================================== +// +// +// Copyright 6/19/2001 Sony Online Entertainment +// +// ====================================================================== + + +#include "FirstArchive.h" +#include "ArchiveMutex.h" + +namespace Archive +{ + +ArchiveMutex::ArchiveMutex() +{ + InitializeCriticalSection(&m_criticalSection); +} + +ArchiveMutex::~ArchiveMutex() +{ + DeleteCriticalSection(&m_criticalSection); +} + +void ArchiveMutex::enter() +{ + EnterCriticalSection(&m_criticalSection); +} + +void ArchiveMutex::leave() +{ + LeaveCriticalSection(&m_criticalSection); +} + +} diff --git a/external/ours/library/archive/src/win32/ArchiveMutex.h b/external/ours/library/archive/src/win32/ArchiveMutex.h new file mode 100755 index 00000000..b453981b --- /dev/null +++ b/external/ours/library/archive/src/win32/ArchiveMutex.h @@ -0,0 +1,27 @@ +#ifndef _ArchiveMutex_H +#define _ArchiveMutex_H + +#include + +namespace Archive +{ + + class ArchiveMutex + { + public: + + ArchiveMutex(); + ~ArchiveMutex(); + void enter(); + void leave(); + + private: + ArchiveMutex(const ArchiveMutex &o); + ArchiveMutex &operator =(const ArchiveMutex &o); + + CRITICAL_SECTION m_criticalSection; + + }; +} + +#endif diff --git a/external/ours/library/archive/src/win32/FirstArchive.cpp b/external/ours/library/archive/src/win32/FirstArchive.cpp new file mode 100755 index 00000000..6e118e67 --- /dev/null +++ b/external/ours/library/archive/src/win32/FirstArchive.cpp @@ -0,0 +1,16 @@ +// FirstArchive.cpp +// copyright 2001 Verant Interactive +// Author: Justin Randall + +//----------------------------------------------------------------------- + +#include "FirstArchive.h" + +//----------------------------------------------------------------------- + +namespace +{ + void supress_warning_LNK4221() + { + } +} diff --git a/external/ours/library/crypto/src/win32/FirstCrypto.cpp b/external/ours/library/crypto/src/win32/FirstCrypto.cpp new file mode 100755 index 00000000..8b9ece1b --- /dev/null +++ b/external/ours/library/crypto/src/win32/FirstCrypto.cpp @@ -0,0 +1 @@ +#include "FirstCrypto.h" diff --git a/external/ours/library/fileInterface/src/win32/FirstFileInterface.cpp b/external/ours/library/fileInterface/src/win32/FirstFileInterface.cpp new file mode 100755 index 00000000..33fdbcbc --- /dev/null +++ b/external/ours/library/fileInterface/src/win32/FirstFileInterface.cpp @@ -0,0 +1 @@ +#include "fileInterface/FirstFileInterface.h" diff --git a/external/ours/library/localization/src/win32/FirstLocalization.cpp b/external/ours/library/localization/src/win32/FirstLocalization.cpp new file mode 100755 index 00000000..c21d66d0 --- /dev/null +++ b/external/ours/library/localization/src/win32/FirstLocalization.cpp @@ -0,0 +1,8 @@ +// ====================================================================== +// +// FirstLocalization.cpp +// copyright (c) 2001 Sony Online Entertainment +// +// ====================================================================== + +#include "FirstLocalization.h" diff --git a/external/ours/library/localizationArchive/src/win32/FirstLocalizationArchive.cpp b/external/ours/library/localizationArchive/src/win32/FirstLocalizationArchive.cpp new file mode 100755 index 00000000..475bd6c7 --- /dev/null +++ b/external/ours/library/localizationArchive/src/win32/FirstLocalizationArchive.cpp @@ -0,0 +1,10 @@ +//====================================================================== +// +// FirstLocalizationArchive.cpp +// copyright (c) 2002 Sony Online Entertainment +// +//====================================================================== + +#include "localizationArchive/FirstLocalizationArchive.h" + +//====================================================================== diff --git a/external/ours/library/unicode/src/win32/FirstUnicode.cpp b/external/ours/library/unicode/src/win32/FirstUnicode.cpp new file mode 100755 index 00000000..176b4e33 --- /dev/null +++ b/external/ours/library/unicode/src/win32/FirstUnicode.cpp @@ -0,0 +1,8 @@ +// ====================================================================== +// +// FirstUnicode.cpp +// copyright (c) 2001 Sony Online Entertainment +// +// ====================================================================== + +#include "FirstUnicode.h" diff --git a/external/ours/library/unicodeArchive/src/win32/FirstUnicodeArchive.cpp b/external/ours/library/unicodeArchive/src/win32/FirstUnicodeArchive.cpp new file mode 100755 index 00000000..4cb0ce59 --- /dev/null +++ b/external/ours/library/unicodeArchive/src/win32/FirstUnicodeArchive.cpp @@ -0,0 +1,12 @@ +//====================================================================== +// +// FirstUnicodeArchive.cpp +// copyright (c) 2002 Sony Online Entertainment +// +//====================================================================== + +#include "unicodeArchive/FirstUnicodeArchive.h" + +//====================================================================== + +//====================================================================== diff --git a/game/server/application/SwgDatabaseServer/src/win32/FirstSwgDatabaseServer.cpp b/game/server/application/SwgDatabaseServer/src/win32/FirstSwgDatabaseServer.cpp new file mode 100755 index 00000000..d815aeca --- /dev/null +++ b/game/server/application/SwgDatabaseServer/src/win32/FirstSwgDatabaseServer.cpp @@ -0,0 +1 @@ +#include "SwgDatabaseServer/FirstSwgDatabaseServer.h" diff --git a/game/server/application/SwgDatabaseServer/src/win32/WinMain.cpp b/game/server/application/SwgDatabaseServer/src/win32/WinMain.cpp new file mode 100755 index 00000000..6e458a7c --- /dev/null +++ b/game/server/application/SwgDatabaseServer/src/win32/WinMain.cpp @@ -0,0 +1,87 @@ +#include "SwgDatabaseServer/FirstSwgDatabaseServer.h" + +#include "serverDatabase/ConfigServerDatabase.h" +#include "serverDatabase/DatabaseProcess.h" + +#include "sharedDebug/SetupSharedDebug.h" +#include "sharedFile/SetupSharedFile.h" +#include "sharedFile/TreeFile.h" +#include "sharedFoundation/SetupSharedFoundation.h" +#include "sharedLog/LogManager.h" +#include "sharedLog/SetupSharedLog.h" +#include "sharedNetwork/NetworkHandler.h" +#include "sharedNetwork/SetupSharedNetwork.h" +#include "sharedNetworkMessages/SetupSharedNetworkMessages.h" +#include "sharedObject/SetupSharedObject.h" +#include "sharedRandom/SetupSharedRandom.h" +#include "sharedThread/SetupSharedThread.h" +#include "SwgDatabaseServer/SwgDatabaseServer.h" + +#include + + +//_____________________________________________________________________ +int main(int argc, char ** argv) +{ + // command line hack + std::string cmdLine; + for(int i = 1; i < argc; ++i) + { + cmdLine += argv[i]; + if(i + 1 < argc) + { + cmdLine += " "; + } + } + + SetupSharedThread::install(); + SetupSharedDebug::install(1024); + + // -- setup foundation + SetupSharedFoundation::Data setupFoundationData(SetupSharedFoundation::Data::D_game); + + setupFoundationData.commandLine = cmdLine.c_str(); + setupFoundationData.createWindow = false; + setupFoundationData.clockUsesSleep = true; + + SetupSharedFoundation::install (setupFoundationData); + + SetupSharedFile::install(false); + SetupSharedRandom::install(int(time(NULL))); + { + SetupSharedObject::Data data; + SetupSharedObject::setupDefaultGameData(data); + SetupSharedObject::install(data); + } + + SetupSharedNetwork::SetupData networkSetupData; + SetupSharedNetwork::getDefaultServerSetupData(networkSetupData); + SetupSharedNetwork::install(networkSetupData); + + SetupSharedNetworkMessages::install(); + + SetupSharedLog::install("SwgDatabaseServer"); + + TreeFile::addSearchAbsolute(0); + TreeFile::addSearchPath(".",0); + + //-- setup server + ConfigServerDatabase::install (); + + NetworkHandler::install(); + + SwgDatabaseServer::install(); + + //-- run server + SetupSharedFoundation::callbackWithExceptionHandling(SwgDatabaseServer::runStatic); + + NetworkHandler::remove(); + SetupSharedLog::remove(); + + SetupSharedFoundation::remove(); + SetupSharedThread::remove(); + + return 0; +} + +//_____________________________________________________________________ diff --git a/game/server/application/SwgGameServer/src/win32/FirstSwgGameServer.cpp b/game/server/application/SwgGameServer/src/win32/FirstSwgGameServer.cpp new file mode 100755 index 00000000..9716e6e8 --- /dev/null +++ b/game/server/application/SwgGameServer/src/win32/FirstSwgGameServer.cpp @@ -0,0 +1 @@ +#include "FirstSwgGameServer.h" diff --git a/game/server/application/SwgGameServer/src/win32/WinMain.cpp b/game/server/application/SwgGameServer/src/win32/WinMain.cpp new file mode 100755 index 00000000..5824ddc5 --- /dev/null +++ b/game/server/application/SwgGameServer/src/win32/WinMain.cpp @@ -0,0 +1,553 @@ +#include "FirstSwgGameServer.h" +#include "serverGame/GameServer.h" + +#include "LocalizationManager.h" +#include "serverGame/SetupServerGame.h" +#include "serverGame/ServerWorld.h" +#include "serverGame/ServerObjectTemplate.h" +#include "ServerObjectLint.h" +#include "serverPathfinding/SetupServerPathfinding.h" +#include "serverScript/SetupScript.h" +#include "serverUtility/SetupServerUtility.h" +#include "sharedDebug/SetupSharedDebug.h" +#include "sharedFile/SetupSharedFile.h" +#include "sharedFile/TreeFile.h" +#include "sharedFoundation/ConfigFile.h" +#include "sharedFoundation/ExitChain.h" +#include "sharedFoundation/FormattedString.h" +#include "sharedFoundation/Os.h" +#include "sharedFoundation/SetupSharedFoundation.h" +#include "sharedGame/SetupSharedGame.h" +#include "sharedGame/SharedObjectTemplate.h" +#include "sharedImage/SetupSharedImage.h" +#include "sharedLog/LogManager.h" +#include "sharedLog/SetupSharedLog.h" +#include "sharedMath/SetupSharedMath.h" +#include "sharedNetwork/NetworkHandler.h" +#include "sharedNetwork/SetupSharedNetwork.h" +#include "sharedObject/SetupSharedObject.h" +#include "sharedObject/ObjectTemplateList.h" +#include "sharedRandom/SetupSharedRandom.h" +#include "sharedRegex/SetupSharedRegex.h" +#include "sharedRemoteDebugServer/SharedRemoteDebugServer.h" +#include "sharedTerrain/SetupSharedTerrain.h" +#include "sharedThread/SetupSharedThread.h" +#include "sharedUtility/SetupSharedUtility.h" +#include "sharedNetworkMessages/SetupSharedNetworkMessages.h" +#include "SwgGameServer/SwgGameServer.h" +#include "SwgGameServer/WorldSnapshotParser.h" +#include "swgSharedNetworkMessages/SetupSwgSharedNetworkMessages.h" +#include "swgServerNetworkMessages/SetupSwgServerNetworkMessages.h" + +#include +#include +#include + +#include + +#ifdef _DEBUG +#include "sharedDebug/DataLint.h" +#include "sharedDebug/PerformanceTimer.h" +#include "sharedFoundation/Os.h" +#include "sharedObject/Object.h" +#include "sharedObject/ObjectTemplate.h" + +void runDataLint(char const *responsePath); +void verifyUpdateRanges (const char* filename); +#endif // _DEBUG + +//_____________________________________________________________________ +/* +int WINAPI WinMain( + HINSTANCE hInstance, // handle to current instance + HINSTANCE hPrevInstance, // handle to previous instance + LPSTR lpCmdLine, // pointer to command line + int nCmdShow // show state of window + ) +*/ +int main(int argc, char ** argv) +{ + int i = 0; + +// UNREF(hPrevInstance); +// UNREF(nCmdShow); +//-- setup foundation + SetupSharedFoundation::Data setupFoundationData(SetupSharedFoundation::Data::D_game); + + // command line hack + std::string cmdLine; + for(i = 1; i < argc; ++i) + { + cmdLine += argv[i]; + if(i + 1 < argc) + { + cmdLine += " "; + } + } +// setupFoundationData.hInstance = hInstance; + setupFoundationData.commandLine = cmdLine.c_str(); + setupFoundationData.createWindow = false; + setupFoundationData.clockUsesSleep = true; + + SetupSharedThread::install(); + SetupSharedDebug::install(1024); + + SetupSharedFoundation::install (setupFoundationData); + + SetupServerUtility::install(); + + SetupSharedRegex::install(); + + SetupSharedFile::install(false); + + SetupSharedNetwork::SetupData networkSetupData; + SetupSharedNetwork::getDefaultServerSetupData(networkSetupData); + SetupSharedNetwork::install(networkSetupData); + + SetupSharedMath::install(); + + SetupSharedUtility::Data setupUtilityData; + SetupSharedUtility::setupGameData (setupUtilityData); + SetupSharedUtility::install (setupUtilityData); + + SetupSharedRandom::install(int(time(NULL))); + { + SetupSharedObject::Data data; + SetupSharedObject::setupDefaultGameData(data); + // we want the SlotIdManager initialized, but we don't need the associated hardpoint names on the server. + SetupSharedObject::addSlotIdManagerData(data, false); + // we want movement table information on this server + SetupSharedObject::addMovementTableData(data); + // we want CustomizationData support on this server. + SetupSharedObject::addCustomizationSupportData(data); + // we want POB ejection point override support. + SetupSharedObject::addPobEjectionTransformData(data); + // objects should not automatically alter their children and contents + data.objectsAlterChildrenAndContents = false; + SetupSharedObject::install(data); + } + + SetupSharedLog::install(FormattedString<92>().sprintf("SwgGameServer:%d", Os::getProcessId())); + + TreeFile::addSearchAbsolute(0); + TreeFile::addSearchPath(".",0); + + SetupSharedNetworkMessages::install(); + SetupSwgServerNetworkMessages::install(); + SetupSwgSharedNetworkMessages::install(); + + SetupSharedImage::Data setupImageData; + SetupSharedImage::setupDefaultData (setupImageData); + SetupSharedImage::install (setupImageData); + + SetupSharedGame::Data setupSharedGameData; + setupSharedGameData.setUseMountValidScaleRangeTable(true); + setupSharedGameData.setUseClientCombatManagerSupport(true); + SetupSharedGame::install (setupSharedGameData); + + SetupSharedTerrain::Data setupSharedTerrainData; + SetupSharedTerrain::setupGameData (setupSharedTerrainData); + SetupSharedTerrain::install (setupSharedTerrainData); + + SetupScript::Data setupScriptData; + SetupScript::setupDefaultGameData(setupScriptData); + SetupScript::install(); + + SetupServerPathfinding::install(); + + //-- setup game server + SetupServerGame::install(); + + SharedRemoteDebugServer::install(); + + //-- setup game server + cmdLine.clear(); + // now, the real command line + for(i = 0; i < argc; ++i) + { + cmdLine += argv[i]; + if(i + 1 < argc) + { + cmdLine += " "; + } + } + + + Archive::ByteStream bs; + UNREF(bs); + + NetworkHandler::install(); + SwgGameServer::install(); + GameServer::getInstance().setCommandLine(cmdLine); + +#ifdef _DEBUG + //-- see if the game server is being run in a mode to parse the database dump to create planetary snapshot files + const char* const createWorldSnapshots = ConfigFile::getKeyString("WorldSnapshot", "createWorldSnapshots", 0); + if (createWorldSnapshots) + { + WorldSnapshotParser::createWorldSnapshots (createWorldSnapshots); + } + else + //-- see if the gameserver is to be run in a mode to scan update ranges + if (ConfigFile::getKeyBool ("SwgGameServer", "verifyUpdateRanges", false)) + { + ServerWorld::install (); + verifyUpdateRanges ("../../exe/win32/serverobjecttemplates.txt"); + ServerWorld::remove (); + } + else + if (!ConfigFile::getKeyBool("SwgGameServer/DataLint", "disable", true)) + { + runDataLint("../../exe/win32/DataLintServer.rsp"); + } + else +#endif // _DEBUG + { + //-- run game + SetupSharedFoundation::callbackWithExceptionHandling(GameServer::run); + } + + NetworkHandler::remove(); + SetupServerGame::remove(); + + SharedRemoteDebugServer::remove(); + SetupSharedLog::remove(); + SetupSharedFoundation::remove(); + SetupSharedThread::remove (); + + return 0; +} + +#ifdef _DEBUG + +void verifyUpdateRanges (const char* const filename) +{ + FILE* const infile = fopen (filename, "rt"); + if (!infile) + { + DEBUG_REPORT_LOG (true, ("verifyUpdateRanges: response file %s could not be opened\n", filename)); + return; + } + + char serverObjectTemplateName [1024]; + while (fscanf (infile, "%s", serverObjectTemplateName) != EOF) + { + //-- does the name contain test? + if (strstr (serverObjectTemplateName, "test") != 0) + { + DEBUG_REPORT_LOG (true, ("verifyUpdateRanges: skipping test object template %s\n", serverObjectTemplateName)); + continue; + } + + if (strstr (serverObjectTemplateName, "e3_") != 0) + { + DEBUG_REPORT_LOG (true, ("verifyUpdateRanges: skipping test object template %s\n", serverObjectTemplateName)); + continue; + } + + //-- get the object template + const ObjectTemplate* const objectTemplate = ObjectTemplateList::fetch (serverObjectTemplateName); + if (!objectTemplate) + { + DEBUG_REPORT_LOG (true, ("verifyUpdateRanges: %s is not a valid object template\n", serverObjectTemplateName)); + continue; + } + + //-- make sure its a server object template + const ServerObjectTemplate* const serverObjectTemplate = dynamic_cast (objectTemplate); + if (!serverObjectTemplate) + { + objectTemplate->releaseReference (); + DEBUG_REPORT_LOG (true, ("verifyUpdateRanges: %s is not a valid server object template\n", serverObjectTemplateName)); + continue; + } + + //-- make sure it has a shared object template + const std::string& sharedObjectTemplateName = serverObjectTemplate->getSharedTemplate (); + if (sharedObjectTemplateName.empty ()) + { + objectTemplate->releaseReference (); + continue; + } + + //-- make sure the shared template exists + const SharedObjectTemplate* const sharedObjectTemplate = safe_cast (ObjectTemplateList::fetch (sharedObjectTemplateName.c_str ())); + if (!sharedObjectTemplate) + { + DEBUG_REPORT_LOG (true, ("verifyUpdateRanges: %s is not a valid shared object template for server object template %s\n", sharedObjectTemplateName.c_str (), serverObjectTemplateName)); + objectTemplate->releaseReference (); + continue; + } + + const float farUpdateRange = serverObjectTemplate->getUpdateRanges (ServerObjectTemplate::UR_far); + DEBUG_REPORT_LOG (true, ("OK:\t%s\t%s\t%1.1f\n", serverObjectTemplateName, sharedObjectTemplateName.c_str (), farUpdateRange)); + objectTemplate->releaseReference (); + } + fclose(infile); +} + +static std::string currentLintedAsset; +static int m_startIndex = 0; +static int m_numberOfFilesToLint = -1; + +//----------------------------------------------------------------------------- +static int ExceptionHandler(LPEXCEPTION_POINTERS exceptionPointers) +{ + UNREF(exceptionPointers); + + static bool entered = false; + + // make the routine safe from re-entrance + + if (entered) + { + return EXCEPTION_CONTINUE_SEARCH; + } + + entered = true; + + // tell the Os not to abort so we can rethrow the exception + + Os::returnFromAbort(); + + // Let the ExitChain do its job + + DataLint::pushAsset(currentLintedAsset.c_str()); + FATAL(true, ("ExceptionHandler invoked - A crash just occured. The asset is bad or it is constructed improperly with DataLint.")); + DataLint::popAsset(); + + // rethrow the exception so that the debugger can catch it + + return EXCEPTION_CONTINUE_SEARCH; //lint !e527 // Unreachable +} + +//----------------------------------------------------------------------------- +static void lintType(char const *filePath, DataLint::AssetType const assetType, bool const skip) +{ + DataLint::setCurrentAssetType(assetType); + + static int assetNumber = 0; + + if (!skip) + { + DEBUG_REPORT_LOG (true, ("%5i Linting file %s... ", assetNumber, filePath)); + + bool failed = false; + + try + { + switch (assetType) + { + case DataLint::AT_objectTemplate: + { + const ObjectTemplate *objectTemplate = ObjectTemplateList::fetch(filePath); + if (objectTemplate) + { + objectTemplate->testValues(); + + // if file has the directory "base" in it's path, don't + // create an object + if (strstr(filePath, "/base/") == NULL) + { + Object* const object = objectTemplate->createObject (); + delete object; + } + + objectTemplate->releaseReference(); + } + else + { + failed = true; + } + } + break; + case DataLint::AT_unSupported: + { + } + break; + + } + + if (failed) + { + DEBUG_REPORT_LOG (true, ("failed\n")); + } + else + { + DEBUG_REPORT_LOG (true, ("ok\n")); + } + } + catch (FatalException const &e) + { + DEBUG_REPORT_LOG (true, ("failed\n")); + + DataLint::logWarning(e.getMessage()); + } + } + + ++assetNumber; +} + +//----------------------------------------------------------------------------- +static void makeMicrosoftHappyAboutObjectUnWinding(char const *filePath, DataLint::AssetType const assetType, bool const skip) +{ + __try + { + lintType(filePath, assetType, skip); + } + __except (ExceptionHandler(GetExceptionInformation())) + { + } +} + +//----------------------------------------------------------------------------- +static void lint(char const *dataTypeString, DataLint::AssetType const assetType) +{ + DataLint::StringPairList stringPairList(DataLint::getList(assetType)); + DataLint::StringPairList::const_iterator dataLintStringListIter = stringPairList.begin(); + + DEBUG_REPORT_LOG_PRINT(1, ("Linting %d %s assets\n", stringPairList.size(), dataTypeString)); + + int currentIndex = 0; + for (; dataLintStringListIter != stringPairList.end(); ++dataLintStringListIter) + { + { + if ((currentIndex % 10) == 0) + { + //-- see if a file exists to abort + + FILE *file = fopen("stoplint.dat", "rt"); + + if (file) + { + fclose(file); + DEBUG_REPORT_LOG_PRINT(1, ("Stopping all DataLint processing for %s.\n", dataTypeString)); + DataLint::logWarning("Forced DataLint stop. Delete \"stoplint.dat\" to DataLint all the assets."); + break; + } + } + } + + char const *filePath = dataLintStringListIter->first.c_str(); + currentLintedAsset = dataLintStringListIter->second.c_str(); + + //DataLint::pushAsset(filePath); + makeMicrosoftHappyAboutObjectUnWinding(filePath, assetType, (currentIndex < m_startIndex)); + //DataLint::popAsset(); + + DataLint::clearAssetStack(); + ++currentIndex; + + if ((m_numberOfFilesToLint != -1) && (currentIndex >= (m_startIndex + m_numberOfFilesToLint))) + { + break; + } + } +} + +//----------------------------------------------------------------------------- +void runDataLint(char const *responsePath) +{ + ServerObjectLint::install(); + ServerWorld::install(); + DataLint::setServerMode(); + + PerformanceTimer performanceTimer; + performanceTimer.start(); + + FILE *fp = fopen(responsePath, "r"); + + if (fp) + { + // Default to start with the first asset + + m_startIndex = ConfigFile::getKeyInt("SwgGameServer/DataLint", "startIndex", 0); + + // Default to lint all assets + + m_numberOfFilesToLint = ConfigFile::getKeyInt("SwgGameServer/DataLint", "numberOfFilesToLint", -1); + + // Verify this is a valid resonse file + + char text[4096]; + fgets(text, sizeof(text), fp); + + if (strstr(text, "Valid DataLint Rsp") == NULL) + { + DEBUG_REPORT_LOG_PRINT(1, ("DataLint: Invalid Rsp file: %s\n", responsePath)); + +#ifdef WIN32 + char text[4096]; + sprintf(text, "Invalid Rsp file specified: %s. Make sure to run DataLintRspBuilder before running DataLint.", responsePath); + MessageBox(NULL, text, "DataLint Error!", MB_OK | MB_ICONERROR); +#endif // WIN32 + } + else + { + DataLint::install(); + + typedef std::vector StringList; + StringList stringList; + stringList.reserve(32768); + + DEBUG_REPORT_LOG_PRINT(1, ("Loading assets to lint from: %s\n", responsePath)); + + while (fgets(text, sizeof(text), fp)) + { + // Remove the newline character + + char *newLineTest = strchr(text, '\n'); + + if (newLineTest) + { + *newLineTest = '\0'; + } + + // Add the files to the master file list + + stringList.push_back(text); + } + + fclose(fp); + + // Add files to data lint + + DEBUG_REPORT_LOG_PRINT(1, ("Adding %d assets to DataLint to be categorized\n", stringList.size())); + + StringList::iterator stringListIter = stringList.begin(); + + for (; stringListIter != stringList.end(); ++stringListIter) + { + DataLint::addFilePath((*stringListIter).c_str()); + } + + if (ConfigFile::getKeyBool("SwgGameServer/DataLint", "objectTemplate", true)) + { + lint("Objects Template", DataLint::AT_objectTemplate); + } + + DataLint::report(); + } + } + else + { + DEBUG_REPORT_LOG_PRINT(1, ("Bad response path specified: %s", responsePath)); + +#ifdef WIN32 + char text[4096]; + sprintf(text, "Bad response file specified: %s. Make sure to run DataLintRspBuilder before running DataLint.", responsePath); + MessageBox(NULL, text, "DataLint Error!", MB_OK | MB_ICONERROR); +#endif // WIN32 + } + + // Dump the time required to data lint + + performanceTimer.stop(); + float const dataLintTime = performanceTimer.getElapsedTime(); + int const seconds = static_cast(dataLintTime) % 60; + int const minutes = (static_cast(dataLintTime) - seconds) / 60; + DEBUG_REPORT_LOG_PRINT(1, ("DateLint took: %dm %ds\n", minutes, seconds)); +} +#endif // _DEBUG + +//_____________________________________________________________________ diff --git a/game/server/library/swgServerNetworkMessages/src/win32/FirstSwgServerNetworkMessages.cpp b/game/server/library/swgServerNetworkMessages/src/win32/FirstSwgServerNetworkMessages.cpp new file mode 100755 index 00000000..ba4d4d4a --- /dev/null +++ b/game/server/library/swgServerNetworkMessages/src/win32/FirstSwgServerNetworkMessages.cpp @@ -0,0 +1,9 @@ +//======================================================================== +// +// FirstSwgServerNetworkMessages.cpp +// +// copyright 2001 Sony Online Entertainment +// +//======================================================================== + +#include "swgServerNetworkMessages/FirstSwgServerNetworkMessages.h" diff --git a/game/shared/library/swgSharedNetworkMessages/src/win32/FirstSwgSharedNetworkMessages.cpp b/game/shared/library/swgSharedNetworkMessages/src/win32/FirstSwgSharedNetworkMessages.cpp new file mode 100755 index 00000000..c29a3b43 --- /dev/null +++ b/game/shared/library/swgSharedNetworkMessages/src/win32/FirstSwgSharedNetworkMessages.cpp @@ -0,0 +1,9 @@ +//======================================================================== +// +// FirstSwgSharedNetworkMessages.cpp +// +// copyright 2001 Sony Online Entertainment +// +//======================================================================== + +#include "swgSharedNetworkMessages/FirstSwgSharedNetworkMessages.h" diff --git a/game/shared/library/swgSharedUtility/src/win32/FirstSwgSharedUtility.cpp b/game/shared/library/swgSharedUtility/src/win32/FirstSwgSharedUtility.cpp new file mode 100755 index 00000000..29d94d84 --- /dev/null +++ b/game/shared/library/swgSharedUtility/src/win32/FirstSwgSharedUtility.cpp @@ -0,0 +1,11 @@ +// ====================================================================== +// +// FirstSwgSharedUtility.cpp +// Copyright 2002 Sony Online Entertainment, Inc. +// All Rights Reserved. +// +// ====================================================================== + +#include "swgSharedUtility/FirstSwgSharedUtility.h" + +// ====================================================================== From 359838ef8d950aa4f90ad9a78a97341cc5dbea2f Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sat, 23 Jul 2016 18:58:31 -0700 Subject: [PATCH 150/302] libcurl can be had in a nuget package --- CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5699a16e..33a0aa14 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,7 +31,11 @@ find_package(PCRE REQUIRED) find_package(Perl REQUIRED) find_package(Threads) find_package(ZLIB REQUIRED) -find_package(CURL REQUIRED) + +if(UNIX) + # Maybe use the nuGet version instead? possibly can do the same for many of the other libs... + find_package(CURL REQUIRED) +endif() if(WIN32) find_package(Iconv REQUIRED) From 5664aba588130919b5d1a2a19b61050713103422 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sat, 23 Jul 2016 20:09:28 -0700 Subject: [PATCH 151/302] win32: here on out it's std conversion and such...bleh --- .gitignore | 2 ++ .../src/win32/FirstPlatform.h | 20 ++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 465b261b..4b9c6401 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +*.cfg +*.cmd .project *.kdev4 latex diff --git a/engine/shared/library/sharedFoundation/src/win32/FirstPlatform.h b/engine/shared/library/sharedFoundation/src/win32/FirstPlatform.h index 5a4d021a..25a298f2 100755 --- a/engine/shared/library/sharedFoundation/src/win32/FirstPlatform.h +++ b/engine/shared/library/sharedFoundation/src/win32/FirstPlatform.h @@ -11,8 +11,26 @@ #ifdef WIN32 + +//fucks up use of std::min std::max +#define NOMINMAX + +#include + +#ifndef __wtypes_h__ +#include +#endif + +#ifndef __WINDEF_ +#include +#endif + #include -#include + +//laziness +#include +#include + #endif // ====================================================================== From 5c8a1ebc4265e4076c84c2608e4b27eb86d418de Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sat, 23 Jul 2016 20:53:20 -0700 Subject: [PATCH 152/302] despite the codemaid changes, this is some static analysis detected issues --- .../src/shared/ConnectionServer.cpp | 372 +++++----- .../platform/projects/MonAPI2/MonitorData.cpp | 657 +++++++++--------- .../3rd/library/platform/utils/Base/AutoLog.h | 165 +++-- 3 files changed, 576 insertions(+), 618 deletions(-) diff --git a/engine/server/application/ConnectionServer/src/shared/ConnectionServer.cpp b/engine/server/application/ConnectionServer/src/shared/ConnectionServer.cpp index 10d0c99f..ae9f8bec 100755 --- a/engine/server/application/ConnectionServer/src/shared/ConnectionServer.cpp +++ b/engine/server/application/ConnectionServer/src/shared/ConnectionServer.cpp @@ -1,8 +1,6 @@ - // ConnectionServer.cpp // copyright 2001 Verant Interactive - //----------------------------------------------------------------------- #include "FirstConnectionServer.h" @@ -59,10 +57,10 @@ // ====================================================================== namespace ConnectionServerNamespace { - ConnectionServer * s_connectionServer = 0; + ConnectionServer * s_connectionServer = 0; NetworkSetupData * s_clientServiceSetup = 0; - const std::string SCENE_NAME_TUTORIAL = "tutorial"; + const std::string SCENE_NAME_TUTORIAL = "tutorial"; const std::string SCENE_NAME_FALCON_PREFIX = "space_npe_falcon"; }; @@ -78,39 +76,39 @@ ConnectionServer & ConnectionServer::instance() //----------------------------------------------------------------------- ConnectionServer::ConnectionServer() : -MessageDispatch::Receiver(), -chatService(0), -customerService(0), -clientServicePrivate(0), -clientServicePublic(0), -gameService(0), -loginServerKeys(0), -done(false), -m_id(0), -m_metricsData(0), -centralConnection(0), -chatServers(), -customerServiceServers(), -clientMap(), -connectedMap(), -gameServerMap(), -freeTrials(), -networkBarrier(0), -pingSocket (new UdpSock), -m_recoverTime(0), -m_sessionApiClient(0), -m_pingTrafficNumBytes(0), -m_recoveringClientList() + MessageDispatch::Receiver(), + chatService(0), + customerService(0), + clientServicePrivate(0), + clientServicePublic(0), + gameService(0), + loginServerKeys(0), + done(false), + m_id(0), + m_metricsData(0), + centralConnection(0), + chatServers(), + customerServiceServers(), + clientMap(), + connectedMap(), + gameServerMap(), + freeTrials(), + networkBarrier(0), + pingSocket(new UdpSock), + m_recoverTime(0), + m_sessionApiClient(0), + m_pingTrafficNumBytes(0), + m_recoveringClientList() { - if(s_clientServiceSetup == 0) + if (s_clientServiceSetup == 0) s_clientServiceSetup = new NetworkSetupData; - + s_clientServiceSetup->maxOutstandingPackets = ConfigConnectionServer::getClientMaxOutstandingPackets(); s_clientServiceSetup->maxRawPacketSize = ConfigConnectionServer::getClientMaxRawPacketSize(); s_clientServiceSetup->maxConnections = ConfigConnectionServer::getClientMaxConnections(); s_clientServiceSetup->fragmentSize = ConfigConnectionServer::getClientFragmentSize(); s_clientServiceSetup->maxDataHoldTime = ConfigConnectionServer::getClientMaxDataHoldTime(); - s_clientServiceSetup->hashTableSize=ConfigConnectionServer::getClientHashTableSize(); + s_clientServiceSetup->hashTableSize = ConfigConnectionServer::getClientHashTableSize(); s_clientServiceSetup->port = ConfigConnectionServer::getClientServicePortPublic(); s_clientServiceSetup->compress = ConfigConnectionServer::getCompressClientNetworkTraffic(); s_clientServiceSetup->useTcp = false; @@ -118,13 +116,12 @@ m_recoveringClientList() loginServerKeys = new KeyServer(20); Address a("", ConfigConnectionServer::getPingPort()); - IGNORE_RETURN(pingSocket->bind (a)); + IGNORE_RETURN(pingSocket->bind(a)); if (ConfigConnectionServer::getValidateStationKey()) { installSessionValidation(); } - } //----------------------------------------------------------------------- @@ -137,7 +134,7 @@ ConnectionServer::~ConnectionServer() delete loginServerKeys; loginServerKeys = 0; - centralConnection=0; + centralConnection = 0; chatServers.clear(); @@ -157,9 +154,9 @@ ConnectionServer::~ConnectionServer() //----------------------------------------------------------------------- -const CustomerServiceConnection * ConnectionServer::getCustomerServiceConnection () +const CustomerServiceConnection * ConnectionServer::getCustomerServiceConnection() { - if(! instance().customerServiceServers.empty()) + if (!instance().customerServiceServers.empty()) { return (*(instance().customerServiceServers.begin())); } @@ -180,10 +177,10 @@ void ConnectionServer::addGameConnection(unsigned long gameServerId, GameConnect cs.gameServerMap[gameServerId] = gc;//@todo check for dupe // find characters pending for THIS gameserver SuidMap::iterator i; - for(i = cs.connectedMap.begin(); i != cs.connectedMap.end(); ++i) + for (i = cs.connectedMap.begin(); i != cs.connectedMap.end(); ++i) { ClientConnection * c = (*i).second; - if(!c->getHasBeenSentToGameServer()) + if (!c->getHasBeenSentToGameServer()) IGNORE_RETURN(c->sendToGameServer()); } } @@ -199,16 +196,15 @@ bool ConnectionServer::decryptToken(const KeyShare::Token & token, uint32 & stat unsigned char * keyBuffer = new unsigned char[len]; unsigned char * keyBufferPointer = keyBuffer; memset(keyBuffer, 0, len); - - - bool retval = cs.loginServerKeys->decipherToken(token, keyBuffer, len); - if (! retval) + bool retval = cs.loginServerKeys->decipherToken(token, keyBuffer, len); + + if (!retval) return retval; char *tmpBuffer = new char[MAX_ACCOUNT_NAME_LENGTH + 1]; memset(tmpBuffer, 0, MAX_ACCOUNT_NAME_LENGTH + 1); - + memcpy(&stationUserId, keyBufferPointer, sizeof(uint32)); keyBufferPointer += sizeof(uint32); memcpy(&secure, keyBufferPointer, sizeof(bool)); @@ -216,33 +212,31 @@ bool ConnectionServer::decryptToken(const KeyShare::Token & token, uint32 & stat memcpy(tmpBuffer, keyBufferPointer, MAX_ACCOUNT_NAME_LENGTH); accountName = tmpBuffer; delete[] tmpBuffer; - delete [] keyBuffer; + delete[] keyBuffer; return retval; -} +} bool ConnectionServer::decryptToken(const KeyShare::Token & token, char* sessionKey, StationId & stationId) { static ConnectionServer & cs = instance(); - + uint32 len = apiSessionIdWidth + sizeof(StationId); unsigned char * keyBuffer = new unsigned char[len + 1]; unsigned char * keyBufferPointer = keyBuffer; - memset(keyBuffer, 0, sizeof(*keyBuffer)); - - - bool retval = cs.loginServerKeys->decipherToken(token, keyBuffer, len); + memset(keyBuffer, 0, len); - if (! retval) + bool retval = cs.loginServerKeys->decipherToken(token, keyBuffer, len); + + if (!retval) return retval; - memcpy(sessionKey, keyBufferPointer, sizeof(*keyBuffer)); + memcpy(sessionKey, keyBufferPointer, len); keyBufferPointer += apiSessionIdWidth; memcpy(&stationId, keyBufferPointer, sizeof(StationId)); - delete [] keyBuffer; + delete[] keyBuffer; return retval; } - //----------------------------------------------------------------------- const Service * ConnectionServer::getChatService() @@ -297,21 +291,21 @@ void ConnectionServer::addNewClient(ClientConnection* cconn, const NetworkId &oi { static ConnectionServer & cs = instance(); ClientMap::iterator i = cs.clientMap.find(oid); - if(i != cs.clientMap.end()) + if (i != cs.clientMap.end()) { - if(cconn->getClient()) - { - WARNING_STRICT_FATAL(true, ("Client already connected, attempting to drop old one\n")); - dropClient(cconn, "Duplicate Login"); - return; - } - else - { - // stale connection in map - cs.removeFromClientMap(oid); - } + if (cconn->getClient()) + { + WARNING_STRICT_FATAL(true, ("Client already connected, attempting to drop old one\n")); + dropClient(cconn, "Duplicate Login"); + return; + } + else + { + // stale connection in map + cs.removeFromClientMap(oid); + } } - + // Create a new entry in the client map cs.addToClientMap(oid, cconn); @@ -322,51 +316,51 @@ void ConnectionServer::addNewClient(ClientConnection* cconn, const NetworkId &oi // select a chat server connection for the client // if non exists, then the client will be notified when // one starts - if(! cs.chatServers.empty()) + if (!cs.chatServers.empty()) { //ChatServerConnection * c = (*chatServers.begin()); // find chat server with least load size_t max = 0xFFFFFFFF; ChatServerConnection * candidate = 0; std::set::const_iterator iter; - for(iter = cs.chatServers.begin(); iter != cs.chatServers.end(); ++iter) + for (iter = cs.chatServers.begin(); iter != cs.chatServers.end(); ++iter) { - if((*iter)->getClients().size() <= max) + if ((*iter)->getClients().size() <= max) { candidate = (*iter); max = (*iter)->getClients().size(); } } - if(candidate) + if (candidate) newClient->setChatConnection(candidate); } // select a cs server connection for the client // if non exists, then the client will be notified when // one starts - if(! cs.customerServiceServers.empty()) + if (!cs.customerServiceServers.empty()) { //ChatServerConnection * c = (*chatServers.begin()); // find chat server with least load size_t max = 0xFFFFFFFF; CustomerServiceConnection * candidate = 0; std::set::const_iterator iter; - for(iter = cs.customerServiceServers.begin(); iter != cs.customerServiceServers.end(); ++iter) + for (iter = cs.customerServiceServers.begin(); iter != cs.customerServiceServers.end(); ++iter) { - if((*iter)->getClients().size() <= max) + if ((*iter)->getClients().size() <= max) { candidate = (*iter); max = (*iter)->getClients().size(); } } - if(candidate) + if (candidate) newClient->setCustomerServiceConnection(candidate); } - + //send the game server a message about this client. static const std::string loginTrace("TRACE_LOGIN"); LOG(loginTrace, ("NewClient(%d, %s, %s)", cconn->getSUID(), oid.getValueString().c_str(), cconn->getAccountName().c_str())); - NewClient m(oid, cconn->getAccountName(), cconn->getRemoteAddress(), cconn->getIsSecure(), false, cconn->getSUID(), nullptr, cconn->getGameFeatures(), cconn->getSubscriptionFeatures(), cconn->getEntitlementTotalTime(), cconn->getEntitlementEntitledTime(), cconn->getEntitlementTotalTimeSinceLastLogin(), cconn->getEntitlementEntitledTimeSinceLastLogin(), cconn->getBuddyPoints(), cconn->getConsumedRewardEvents(), cconn->getClaimedRewardItems(), cconn->isUsingAdminLogin(), cconn->getCanSkipTutorial(), sendToStarport ); + NewClient m(oid, cconn->getAccountName(), cconn->getRemoteAddress(), cconn->getIsSecure(), false, cconn->getSUID(), nullptr, cconn->getGameFeatures(), cconn->getSubscriptionFeatures(), cconn->getEntitlementTotalTime(), cconn->getEntitlementEntitledTime(), cconn->getEntitlementTotalTimeSinceLastLogin(), cconn->getEntitlementEntitledTimeSinceLastLogin(), cconn->getBuddyPoints(), cconn->getConsumedRewardEvents(), cconn->getClaimedRewardItems(), cconn->isUsingAdminLogin(), cconn->getCanSkipTutorial(), sendToStarport); gconn->send(m, true); //@todo move this to ClientConnection.cpp } @@ -378,7 +372,7 @@ void ConnectionServer::dropClient(ClientConnection * conn, const std::string& de DEBUG_FATAL(!conn, ("Cannot call dropClient with nullptr connection")); if (!conn) //lint !e774 // boolean within 'if' always evaluates to False //suppresed because this is only relevant in DEBUG builds return; - + static ConnectionServer & cs = instance(); //Client dropped. Tell game server if they've logged in. LOG("ClientDisconnect", ("Dropping client for SUID %d\n", conn->getSUID())); @@ -415,7 +409,7 @@ void ConnectionServer::dropClient(ClientConnection * conn, const std::string& de // void ConnectionServer::addPendingCharacter(uint32 suid, ClientConnection* conn) // { // if (pendingMap.find(suid) == pendingMap.end()) -// pendingMap[suid] = conn; +// pendingMap[suid] = conn; // else // { // WARNING_STRICT_FATAL(true, ("Attepting to add duplicate pending chatacter")); @@ -438,7 +432,7 @@ ClientConnection* ConnectionServer::getClientConnection(const uint32 suid) static ConnectionServer & cs = instance(); ClientConnection * result = 0; SuidMap::const_iterator i = cs.connectedMap.find(suid); - if(i != cs.connectedMap.end()) + if (i != cs.connectedMap.end()) { result = (*i).second; } @@ -459,7 +453,7 @@ GameConnection* ConnectionServer::getGameConnection(const std::string &sceneName { static ConnectionServer & cs = instance(); GameServerMap::iterator i = cs.gameServerMap.begin(); - for(; i != cs.gameServerMap.end(); ++i) + for (; i != cs.gameServerMap.end(); ++i) { if (sceneName == (*i).second->getSceneName()) { @@ -483,13 +477,13 @@ void ConnectionServer::handleConnectionServerIdMessage(const ConnectionServerId FATAL(g == nullptr, ("No game service is active!")); const Service * const c = getChatService(); const Service * const cs = getCustomerService(); - const uint16 pingPort = getPingPort (); + const uint16 pingPort = getPingPort(); - if((servicePrivate != nullptr || servicePublic != nullptr) && g != nullptr) //lint !e774 // always evaluates to false // suppresed because the FATAL macro triggers this lint warning + if ((servicePrivate != nullptr || servicePublic != nullptr) && g != nullptr) //lint !e774 // always evaluates to false // suppresed because the FATAL macro triggers this lint warning { uint16 chatPort = 0; uint16 csPort = 0; - if(c) + if (c) chatPort = c->getBindPort(); if (cs) @@ -498,18 +492,18 @@ void ConnectionServer::handleConnectionServerIdMessage(const ConnectionServerId } uint16 publicPort = 0; - if(servicePublic) + if (servicePublic) publicPort = servicePublic->getBindPort(); uint16 privatePort = 0; - if(servicePrivate) + if (servicePrivate) privatePort = servicePrivate->getBindPort(); std::string clientServicePublicBindAddress = NetworkHandler::getHostName(); - + NOT_NULL(gameService); NOT_NULL(chatService); NOT_NULL(customerService); - + const NewCentralConnectionServer ncs(gameService->getBindAddress(), clientServicePublicBindAddress, chatService->getBindAddress(), customerService->getBindAddress(), privatePort, publicPort, g->getBindPort(), chatPort, csPort, pingPort, ConfigConnectionServer::getConnectionServerNumber()); sendToCentralProcess(ncs); } @@ -524,9 +518,9 @@ void ConnectionServer::receiveMessage(const MessageDispatch::Emitter & source, c // it's reasonably safe to cast, message type verified // determine message type - if(message.isType("GameConnectionOpened")) + if (message.isType("GameConnectionOpened")) { - DEBUG_REPORT_LOG(true,("Game Connection opened\n")); + DEBUG_REPORT_LOG(true, ("Game Connection opened\n")); } else if (message.isType("GameConnectionClosed")) { @@ -535,9 +529,9 @@ void ConnectionServer::receiveMessage(const MessageDispatch::Emitter & source, c const GameConnection & downConnection = static_cast(source); DEBUG_REPORT_LOG(true, ("Game Server connection went down. Dropping clients.\n")); //remove Game Conection from list - + PseudoClientConnection::gameConnectionClosed(&downConnection); - + GameServerMap::iterator j = gameServerMap.find(downConnection.getGameServerId()); if (j != gameServerMap.end()) { @@ -545,46 +539,45 @@ void ConnectionServer::receiveMessage(const MessageDispatch::Emitter & source, c } } - else if(message.isType("CentralConnectionOpened")) + else if (message.isType("CentralConnectionOpened")) { - DEBUG_REPORT_LOG(true,("Opened connection with central\n")); - centralConnection = const_cast(static_cast(&source));//lint !e826 // info: Suspiscious pointer-to-pointer conversion (area too small) - if(s_clientServiceSetup == 0) + DEBUG_REPORT_LOG(true, ("Opened connection with central\n")); + centralConnection = const_cast(static_cast(&source));//lint !e826 // info: Suspiscious pointer-to-pointer conversion (area too small) + if (s_clientServiceSetup == 0) s_clientServiceSetup = new NetworkSetupData; s_clientServiceSetup->useTcp = false; - if(ConfigConnectionServer::getStartPublicServer()) + if (ConfigConnectionServer::getStartPublicServer()) clientServicePublic = new Service(ConnectionAllocator(), *s_clientServiceSetup); s_clientServiceSetup->port = ConfigConnectionServer::getClientServicePortPrivate(); clientServicePrivate = new Service(ConnectionAllocator(), *s_clientServiceSetup); s_clientServiceSetup->port = ConfigConnectionServer::getClientServicePortPublic(); - + connectToMessage("ClientConnectionOpened"); connectToMessage("ClientConnectionClosed"); - } else if (message.isType("CentralConnectionClosed")) { - centralConnection = const_cast(static_cast(&source));//lint !e826 // info: Suspiscious pointer-to-pointer conversion (area too small) + centralConnection = const_cast(static_cast(&source));//lint !e826 // info: Suspiscious pointer-to-pointer conversion (area too small) setDone("CentralConnectionClosed: %s", centralConnection ? centralConnection->getDisconnectReason().c_str() : ""); centralConnection = 0; DEBUG_REPORT_LOG(true, ("CentralDied. So we will too\n")); //@todo Drop all pending clients. } - else if(message.isType("ClientConnectionOpened")) + else if (message.isType("ClientConnectionOpened")) { DEBUG_REPORT_LOG(true, ("Opened connection with client\n")); } else if (message.isType("ClientConnectionClosed")) { DEBUG_REPORT_LOG(true, ("Client is Dropping connection\n")); - ClientConnection * cconn = const_cast(static_cast(&source));//lint !e826 // info: Suspiscious pointer-to-pointer conversion (area too small) + ClientConnection * cconn = const_cast(static_cast(&source));//lint !e826 // info: Suspiscious pointer-to-pointer conversion (area too small) //tell CentralServer if (centralConnection) { GenericValueTypeMessage const msg("ClientConnectionClosed", cconn->getSUID()); - centralConnection->send(msg,true); + centralConnection->send(msg, true); } //Client dropped. Tell game server if they've logged in. @@ -613,14 +606,14 @@ void ConnectionServer::receiveMessage(const MessageDispatch::Emitter & source, c ConnectionServerId m(ri); handleConnectionServerIdMessage(m); } - + else if (message.isType("ConnectionKeyPush")) { Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); ConnectionKeyPush pk(ri); loginServerKeys->pushKey(pk.getKey()); } - + else if (message.isType("LoginKeyPush")) { Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); @@ -631,7 +624,7 @@ void ConnectionServer::receiveMessage(const MessageDispatch::Emitter & source, c { Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); const CharacterListMessage msg(ri); - WARNING_STRICT_FATAL(true,("CharacterListMessage is deprecated on the ConnectionServer -- fix whoever is sending it.\n")); + WARNING_STRICT_FATAL(true, ("CharacterListMessage is deprecated on the ConnectionServer -- fix whoever is sending it.\n")); } else if (message.isType("ConnectionCreateCharacterSuccess")) { @@ -641,7 +634,7 @@ void ConnectionServer::receiveMessage(const MessageDispatch::Emitter & source, c ClientConnection* const client = getClientConnection(msg.getStationId()); if (client) { - const ClientCreateCharacterSuccess m (msg.getNetworkId ()); + const ClientCreateCharacterSuccess m(msg.getNetworkId()); client->send(m, true); } else @@ -697,7 +690,7 @@ void ConnectionServer::receiveMessage(const MessageDispatch::Emitter & source, c VerifyAndLockNameResponse connMsg(ri); ClientConnection* cconn = getClientConnection(connMsg.getStationId()); - ClientVerifyAndLockNameResponse cvalnr(connMsg.getCharacterName(), connMsg.getErrorMessage()); + ClientVerifyAndLockNameResponse cvalnr(connMsg.getCharacterName(), connMsg.getErrorMessage()); if (cconn) cconn->send(cvalnr, true); } @@ -710,26 +703,26 @@ void ConnectionServer::receiveMessage(const MessageDispatch::Emitter & source, c { ChatServerConnection * c = const_cast(static_cast(&source));//lint !e826 suspiscious pointer-to-pointer conversion // suppressed, you bet it is std::set::iterator f = chatServers.find(c); - if(f != chatServers.end()) + if (f != chatServers.end()) { // migrate players that were on this chat server // to another chat server // now remove the server from the set chatServers.erase(f); - if(!chatServers.empty()) + if (!chatServers.empty()) { std::set::iterator ic = chatServers.begin(); const std::set & clients = c->getClients(); std::set::const_iterator i; - for(i = clients.begin(); i != clients.end(); ++ i) + for (i = clients.begin(); i != clients.end(); ++i) { ChatServerConnection * newConn = (*ic); Client * cl = (*i); cl->setChatConnection(newConn); ++ic; - if(ic == chatServers.end()) + if (ic == chatServers.end()) ic = chatServers.begin(); } } @@ -737,7 +730,7 @@ void ConnectionServer::receiveMessage(const MessageDispatch::Emitter & source, c { const std::set & clients = c->getClients(); std::set::const_iterator i; - for(i = clients.begin(); i != clients.end(); ++ i) + for (i = clients.begin(); i != clients.end(); ++i) { (*i)->setChatConnection(nullptr); } @@ -753,26 +746,26 @@ void ConnectionServer::receiveMessage(const MessageDispatch::Emitter & source, c { CustomerServiceConnection * c = const_cast(static_cast(&source));//lint !e826 suspiscious pointer-to-pointer conversion // suppressed, you bet it is std::set::iterator f = customerServiceServers.find(c); - if(f != customerServiceServers.end()) + if (f != customerServiceServers.end()) { // migrate players that were on this chat server // to another chat server // now remove the server from the set customerServiceServers.erase(f); - if(!customerServiceServers.empty()) + if (!customerServiceServers.empty()) { std::set::iterator ic = customerServiceServers.begin(); const std::set & clients = c->getClients(); std::set::const_iterator i; - for(i = clients.begin(); i != clients.end(); ++ i) + for (i = clients.begin(); i != clients.end(); ++i) { CustomerServiceConnection * newConn = (*ic); Client * cl = (*i); cl->setCustomerServiceConnection(newConn); ++ic; - if(ic == customerServiceServers.end()) + if (ic == customerServiceServers.end()) ic = customerServiceServers.begin(); } } @@ -780,12 +773,11 @@ void ConnectionServer::receiveMessage(const MessageDispatch::Emitter & source, c { const std::set & clients = c->getClients(); std::set::const_iterator i; - for(i = clients.begin(); i != clients.end(); ++ i) + for (i = clients.begin(); i != clients.end(); ++i) { (*i)->setCustomerServiceConnection(nullptr); } } - } } else if (message.isType("GameServerForLoginMessage")) @@ -794,18 +786,18 @@ void ConnectionServer::receiveMessage(const MessageDispatch::Emitter & source, c const GameServerForLoginMessage msg(ri); ClientConnection* client = getClientConnection(msg.getStationId()); - + // see if the client is for the same character as the login message. // this is required to prevent admin login via the CS Tool from // disconnecting other characters logged in from the same account // (but not the same character) as the character we're administratively // logging in. bool clientIsForSameCharacterId = false; - if(client) + if (client) { clientIsForSameCharacterId = client->getCharacterId() == msg.getCharacterId(); } - + bool handledByPseudoClient = false; // if the character id in the message doesn't match the character id for // the existing client, it may be for a pseudoclient. Check, and if so, @@ -815,13 +807,13 @@ void ConnectionServer::receiveMessage(const MessageDispatch::Emitter & source, c PseudoClientConnection * pcc = PseudoClientConnection::getPseudoClientConnection(msg.getCharacterId()); // hand off to the PCC only if we do have a pseudoclient, and either we don't have a client, or // the pseudoclient has a tool id, telling us that it's for cs tool login. - if(pcc && ((!client) || (pcc->getTransferCharacterData().getCSToolId() > 0))) + if (pcc && ((!client) || (pcc->getTransferCharacterData().getCSToolId() > 0))) { handledByPseudoClient = true; bool result; result = PseudoClientConnection::tryToDeliverMessageTo(msg.getStationId(), static_cast(message).getByteStream()); UNREF(result); - DEBUG_REPORT_LOG(! result,("Received GameServerForLoginMessage for %lu, who was not connected.\n",msg.getStationId())); + DEBUG_REPORT_LOG(!result, ("Received GameServerForLoginMessage for %lu, who was not connected.\n", msg.getStationId())); } } @@ -839,10 +831,10 @@ void ConnectionServer::receiveMessage(const MessageDispatch::Emitter & source, c ClientConnection* cconn = getClientConnection(msg.getSuid()); if (!cconn) - DEBUG_REPORT_LOG(true, ("Received ValidateCharacterForLoginReplyMessage for account %lu, which is no longer connected.\n",msg.getSuid())); + DEBUG_REPORT_LOG(true, ("Received ValidateCharacterForLoginReplyMessage for account %lu, which is no longer connected.\n", msg.getSuid())); else { - cconn->onCharacterValidated(msg.getApproved(),msg.getCharacterId(), Unicode::wideToNarrow(msg.getCharacterName()), msg.getContainerId(), msg.getScene(), msg.getCoordinates()); + cconn->onCharacterValidated(msg.getApproved(), msg.getCharacterId(), Unicode::wideToNarrow(msg.getCharacterName()), msg.getContainerId(), msg.getScene(), msg.getCoordinates()); } } else if (message.isType("ValidateAccountReplyMessage")) @@ -852,21 +844,21 @@ void ConnectionServer::receiveMessage(const MessageDispatch::Emitter & source, c ClientConnection* cconn = getClientConnection(msg.getStationId()); if (!cconn) - DEBUG_REPORT_LOG(true, ("Received ValidateAccountReplyMessage for account %lu, which is no longer connected.\n",msg.getStationId())); + DEBUG_REPORT_LOG(true, ("Received ValidateAccountReplyMessage for account %lu, which is no longer connected.\n", msg.getStationId())); else { - cconn->onIdValidated(msg.getCanLogin(),msg.getCanCreateRegular(),msg.getCanCreateJedi(),msg.getCanSkipTutorial(),msg.getConsumedRewardEvents(),msg.getClaimedRewardItems()); + cconn->onIdValidated(msg.getCanLogin(), msg.getCanCreateRegular(), msg.getCanCreateJedi(), msg.getCanSkipTutorial(), msg.getConsumedRewardEvents(), msg.getClaimedRewardItems()); } } - else if(message.isType("SetConnectionServerPublic")) + else if (message.isType("SetConnectionServerPublic")) { Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); SetConnectionServerPublic p(ri);//lint !e40 !e522 !e10 // Undeclared identifier 'SetConnectionServerPublic' // suppressed because it IS declared bool statusChanged = false; DEBUG_REPORT_LOG(true, ("Conn Server: attempting to chang status\n")); - if(p.getIsPublic())//lint !e40 !e1013 !e10 // Undeclared identifier 'p' // suppressed because it IS declared + if (p.getIsPublic())//lint !e40 !e1013 !e10 // Undeclared identifier 'p' // suppressed because it IS declared { - if(! clientServicePublic) + if (!clientServicePublic) { statusChanged = true; } @@ -878,19 +870,19 @@ void ConnectionServer::receiveMessage(const MessageDispatch::Emitter & source, c statusChanged = true; } - if(statusChanged && centralConnection) + if (statusChanged && centralConnection) { const Service * publicService = getClientServicePublic(); const Service * privateService = getClientServicePrivate(); - if(publicService || privateService) + if (publicService || privateService) { uint16 publicServicePort = 0; uint16 privateServicePort = 0; - if(publicService) + if (publicService) { publicServicePort = publicService->getBindPort(); } - if(privateService) + if (privateService) { privateServicePort = privateService->getBindPort(); } @@ -899,7 +891,7 @@ void ConnectionServer::receiveMessage(const MessageDispatch::Emitter & source, c } } }//lint !e529 // Symbol 'ri' not subsequently referenced // suppressed because it IS referenced. I think lint is very confused for some reason. - else if(message.isType("ProfilerOperationMessage")) + else if (message.isType("ProfilerOperationMessage")) { Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); ProfilerOperationMessage msg(ri); @@ -912,17 +904,17 @@ void ConnectionServer::receiveMessage(const MessageDispatch::Emitter & source, c Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); ExcommunicateGameServerMessage msg(ri); - LOG("GameGameConnect",("Told to drop connection to %lu by Central",msg.getServerId())); - - GameConnection *conn =getGameConnection(msg.getServerId()); + LOG("GameGameConnect", ("Told to drop connection to %lu by Central", msg.getServerId())); + + GameConnection *conn = getGameConnection(msg.getServerId()); if (conn) conn->disconnect(); - } + } else if (message.isType("CntrlSrvDropDupeConns")) { Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); GenericValueTypeMessage > const msg(ri); - + ClientConnection* client = getClientConnection(msg.getValue().first); if (client && !client->isUsingAdminLogin() && !client->getIsSecure()) { @@ -940,12 +932,12 @@ void ConnectionServer::install() { s_connectionServer = new ConnectionServer; - char tmp[128] = {"\0"}; - IGNORE_RETURN(snprintf(tmp, sizeof(tmp), "ConnectionServer:%d", Os::getProcessId())); + char tmp[128] = { "\0" }; + IGNORE_RETURN(snprintf(tmp, sizeof(tmp), "ConnectionServer:%d", Os::getProcessId())); SetupSharedLog::install(tmp); s_connectionServer->setupConnections(); s_connectionServer->m_metricsData = new ConnectionServerMetricsData; - MetricsManager::install(s_connectionServer->m_metricsData, true, "ConnectionServer" , "", ConfigConnectionServer::getConnectionServerNumber()); + MetricsManager::install(s_connectionServer->m_metricsData, true, "ConnectionServer", "", ConfigConnectionServer::getConnectionServerNumber()); DataTableManager::install(); AdminAccountManager::install(ConfigConnectionServer::getAdminAccountDataTable()); } @@ -958,30 +950,29 @@ void ConnectionServer::remove() delete s_connectionServer->m_metricsData; s_connectionServer->m_metricsData = 0; - // explicitly delete all connections that were setup from setupConnections rather than letting + // explicitly delete all connections that were setup from setupConnections rather than letting // Connection::remove do it. There are connections that require a valid s_connectionServer which is deleted // and set to nullptr. s_connectionServer->unsetupConnections(); - + SetupSharedLog::remove(); - + delete s_connectionServer; s_connectionServer = 0; } //----------------------------------------------------------------------- - void ConnectionServer::run(void) { static const bool shouldSleep = ConfigConnectionServer::getShouldSleep(); static ConnectionServer & cserver = instance(); - DEBUG_FATAL (!cserver.m_metricsData, ("Connection server not installed properly")); + DEBUG_FATAL(!cserver.m_metricsData, ("Connection server not installed properly")); unsigned long startTime = Clock::timeMs(); Clock::setFrameRateLimit(50.0f); - LOG("ServerStartup",("ConnectionServer starting on %s", NetworkHandler::getHostName().c_str())); + LOG("ServerStartup", ("ConnectionServer starting on %s", NetworkHandler::getHostName().c_str())); while (!cserver.done) { PROFILER_AUTO_BLOCK_DEFINE("main loop"); @@ -1004,10 +995,10 @@ void ConnectionServer::run(void) { GenericValueTypeMessage > const syncStampMessage("SetSyncStamp", std::make_pair(static_cast(UdpMisc::LocalSyncStampShort()), static_cast(UdpMisc::LocalSyncStampLong()))); GameServerMap::iterator end = cserver.gameServerMap.end(); - for(GameServerMap::iterator iter = cserver.gameServerMap.begin(); iter != end; ++iter) + for (GameServerMap::iterator iter = cserver.gameServerMap.begin(); iter != end; ++iter) iter->second->send(syncStampMessage, true); } - + { PROFILER_AUTO_BLOCK_DEFINE("NetworkHandler::dispatch"); NetworkHandler::dispatch(); @@ -1030,23 +1021,21 @@ void ConnectionServer::run(void) startTime = curTime; } - if (shouldSleep) { PROFILER_AUTO_BLOCK_DEFINE("Os::sleep"); Os::sleep(1); } - } while (!cserver.done); NetworkHandler::clearBytesThisFrame(); - + cserver.updateRecoveringClientList(static_cast(Clock::frameTime()*1000.0f)); } } // ---------------------------------------------------------------------- -/** +/** * Invoked every frame to do whatever updates are needed */ void ConnectionServer::update() @@ -1054,7 +1043,7 @@ void ConnectionServer::update() if (centralConnection) { static Timer t(5.0f); - if(t.updateZero(Clock::frameTime())) + if (t.updateZero(Clock::frameTime())) { // Update the population on the central server updatePopulationOnCentralServer(); @@ -1074,16 +1063,16 @@ void ConnectionServer::update() static const int ping_throttle_max = 1024; - static char buffer [4]; + static char buffer[4]; - for (int throttle = 0; pingSocket->canRecv () && throttle < ping_throttle_max; ++throttle) + for (int throttle = 0; pingSocket->canRecv() && throttle < ping_throttle_max; ++throttle) { Address addr; - const uint32 count = pingSocket->recvFrom (addr, buffer, 4); + const uint32 count = pingSocket->recvFrom(addr, buffer, 4); m_pingTrafficNumBytes += static_cast(count); if (m_pingTrafficNumBytes < 0) m_pingTrafficNumBytes = 0; - IGNORE_RETURN(pingSocket->sendTo (addr, buffer, count)); + IGNORE_RETURN(pingSocket->sendTo(addr, buffer, count)); } } @@ -1102,7 +1091,7 @@ void ConnectionServer::updateRecoveringClientList(uint elapsedTime) m_recoverTime += elapsedTime; static std::set listPlayersDropped; - for (RecoveringClientListType::iterator i=m_recoveringClientList.begin(); i!=m_recoveringClientList.end();) + for (RecoveringClientListType::iterator i = m_recoveringClientList.begin(); i != m_recoveringClientList.end();) { if (m_recoverTime > i->first) { @@ -1110,16 +1099,16 @@ void ConnectionServer::updateRecoveringClientList(uint elapsedTime) if (client) { if (client->getGameConnection()) - DEBUG_REPORT_LOG(true,("Player %s recovered from a server crash and will not be dropped.\n",i->second.getValueString().c_str())); + DEBUG_REPORT_LOG(true, ("Player %s recovered from a server crash and will not be dropped.\n", i->second.getValueString().c_str())); else { - LOG("Network", ("Dropping player %s because game server crashed and no other server took authority.\n",i->second.getValueString().c_str())); + LOG("Network", ("Dropping player %s because game server crashed and no other server took authority.\n", i->second.getValueString().c_str())); dropClient(client->getClientConnection(), "Game Server Crash"); IGNORE_RETURN(listPlayersDropped.insert(i->second)); } } - i=m_recoveringClientList.erase(i); + i = m_recoveringClientList.erase(i); } else ++i; @@ -1141,7 +1130,7 @@ void ConnectionServer::updateRecoveringClientList(uint elapsedTime) } if (m_recoveringClientList.empty()) - m_recoverTime = 0; // prevent rollover and other problems I don't want to worry about + m_recoverTime = 0; // prevent rollover and other problems I don't want to worry about } } @@ -1158,15 +1147,15 @@ void ConnectionServer::unsetupConnections() { // remove all ClientConnection objects so when Connection::remove() is called we don't crash since // ConnectionServer no longer exists - while( !instance().connectedMap.empty() ) + while (!instance().connectedMap.empty()) { SuidMap::iterator i = instance().connectedMap.begin(); - if( i != instance().connectedMap.end() ) + if (i != instance().connectedMap.end()) { ClientConnection * c = (*i).second; uint32 suid = (*i).first; IGNORE_RETURN(instance().connectedMap.erase(suid)); - if( c ) + if (c) { ConnectionServer::dropClient(c, "ConnectionServer shutting down."); delete c; @@ -1174,30 +1163,29 @@ void ConnectionServer::unsetupConnections() } } - if( customerService ) + if (customerService) { delete customerService; customerService = 0; } - if( chatService ) + if (chatService) { delete chatService; chatService = 0; } - if( centralConnection ) + if (centralConnection) { delete centralConnection; centralConnection = 0; } - if( gameService ) + if (gameService) { delete gameService; gameService = 0; } - } //----------------------------------------------------------------------- @@ -1239,7 +1227,7 @@ void ConnectionServer::setupConnections() connectToMessage("ConnectionKeyPush"); connectToMessage("LoginKeyPush"); connectToMessage("CharacterListMessage"); - + //Create Characters Messages connectToMessage("ClientCreateCharacter"); connectToMessage("ConnectionCreateCharacterSuccess"); @@ -1250,7 +1238,7 @@ void ConnectionServer::setupConnections() // name query messages connectToMessage("ClientRandomNameRequest"); // from client connectToMessage("RandomNameResponse"); // from game server - + connectToMessage("ClientVerifyAndLockNameRequest"); // from client connectToMessage("VerifyAndLockNameResponse"); // from game server @@ -1283,10 +1271,10 @@ void ConnectionServer::setupConnections() //---------------------------------------------------------------------- -uint16 ConnectionServer::getPingPort () +uint16 ConnectionServer::getPingPort() { static ConnectionServer & cs = instance(); - return cs.pingSocket->getBindAddress ().getHostPort (); + return cs.pingSocket->getBindAddress().getHostPort(); } //----------------------------------------------------------------------- @@ -1315,7 +1303,7 @@ GameConnection* ConnectionServer::getGameConnection(uint32 gameServerId) const GameServerMap::const_iterator i = cs.gameServerMap.find(gameServerId); if (i != cs.gameServerMap.end()) return (*i).second; - + return nullptr; } @@ -1448,11 +1436,11 @@ void ConnectionServer::addToConnectedMap(uint32 suid, ClientConnection* cconn) connectedMap[suid] = cconn; } - if ( ((cconn->getSubscriptionFeatures() & ClientSubscriptionFeature::FreeTrial) != 0) - && ((cconn->getSubscriptionFeatures() & ClientSubscriptionFeature::Base) == 0)) + if (((cconn->getSubscriptionFeatures() & ClientSubscriptionFeature::FreeTrial) != 0) + && ((cconn->getSubscriptionFeatures() & ClientSubscriptionFeature::Base) == 0)) { freeTrials.insert(suid); - } + } // Update the population on the CentralServer immediately // since we are trying to avoid people "rushing" the server @@ -1468,7 +1456,7 @@ void ConnectionServer::removeFromConnectedMap(uint32 suid) { connectedMap.erase(i); } - + FreeTrialsSet::iterator j = freeTrials.find(suid); if (j != freeTrials.end()) { @@ -1487,20 +1475,20 @@ void ConnectionServer::updatePopulationOnCentralServer() if (centralConnection) { // Total number of clients and how many of those are free trials - const int numPlayers = getNumberOfClients(); + const int numPlayers = getNumberOfClients(); const int numFreeTrial = getNumberOfFreeTrials(); // We are concerned about too many people piling up at the beginning // of the tutorial, so count how many players could be a problem - int numPlayersEmptyScene = 0; + int numPlayersEmptyScene = 0; int numPlayersTutorialScene = 0; - int numPlayersFalconScene = 0; + int numPlayersFalconScene = 0; // Walk through the clients and evaluate what scene they are in SuidMap::const_iterator i; - for(i = connectedMap.begin(); i != connectedMap.end(); ++i) + for (i = connectedMap.begin(); i != connectedMap.end(); ++i) { - const ClientConnection * const conn = (*i).second; + const ClientConnection * const conn = (*i).second; const Client * const client = conn->getClient(); if (client && client->getGameConnection()) @@ -1527,18 +1515,17 @@ void ConnectionServer::updatePopulationOnCentralServer() } const UpdatePlayerCountMessage msg(false, numPlayers, numFreeTrial, numPlayersEmptyScene, numPlayersTutorialScene, numPlayersFalconScene); - centralConnection->send(msg,true); + centralConnection->send(msg, true); } } - // ---------------------------------------------------------------------- SessionApiClient* ConnectionServer::getSessionApiClient() { // this is causing crashes when ConnectionServer is shutdown and something calls this function // because instance() returns 0. - if( s_connectionServer ) + if (s_connectionServer) { return instance().m_sessionApiClient; } @@ -1558,7 +1545,7 @@ void ConnectionServer::setDone(char const *reasonfmt, ...) va_list ap; va_start(ap, reasonfmt); IGNORE_RETURN(_vsnprintf(reason, sizeof(reason), reasonfmt, ap));//lint !e530 Symbol 'ap' not initialized - reason[sizeof(reason)-1] = '\0'; + reason[sizeof(reason) - 1] = '\0'; LOG( "ServerShutdown", @@ -1579,5 +1566,4 @@ void ConnectionServer::setDone(char const *reasonfmt, ...) } } -// ====================================================================== - +// ====================================================================== \ No newline at end of file diff --git a/external/3rd/library/platform/projects/MonAPI2/MonitorData.cpp b/external/3rd/library/platform/projects/MonAPI2/MonitorData.cpp index 044c1a17..cf8952eb 100755 --- a/external/3rd/library/platform/projects/MonAPI2/MonitorData.cpp +++ b/external/3rd/library/platform/projects/MonAPI2/MonitorData.cpp @@ -5,7 +5,6 @@ #include "zlib.h" #include "MonitorData.h" - //********************************************************************************************** //********************************************************************************************** //********************************** DO NOT EDIT THIS FILE *********************************** @@ -15,39 +14,37 @@ #define BUFFER_SIZE_START 2048 #define BUFFER_RESIZE_VALUE 1024 -extern void set_bit( unsigned char p[], int bit); +extern void set_bit(unsigned char p[], int bit); extern void unset_bit(unsigned char p[], int bit); -extern int get_bit( unsigned char p[], int bit); - +extern int get_bit(unsigned char p[], int bit); // ------------------ Support Routine ----------------------------- ////////////////////////////////////////////////////////////////////// // qsort compare routine ////////////////////////////////////////////////////////////////////// -int compar_name( const void *e1, const void *e2 ) +int compar_name(const void *e1, const void *e2) { -MON_ELEMENT *data1,*data2; + MON_ELEMENT *data1, *data2; - data1 = *(MON_ELEMENT **)e1; - data2 = *(MON_ELEMENT **)e2; + data1 = *(MON_ELEMENT **)e1; + data2 = *(MON_ELEMENT **)e2; #ifdef _WIN32 - return _stricmp(data1->label, data2->label); + return _stricmp(data1->label, data2->label); #else - return strcasecmp(data1->label,data2->label); + return strcasecmp(data1->label, data2->label); #endif } -int compar_index( const void *e1, const void *e2 ) +int compar_index(const void *e1, const void *e2) { -MON_ELEMENT *data1,*data2; - data1 = (MON_ELEMENT *)e1; - data2 = (MON_ELEMENT *)e2; - return data1->id - data2->id; + MON_ELEMENT *data1, *data2; + data1 = (MON_ELEMENT *)e1; + data2 = (MON_ELEMENT *)e2; + return data1->id - data2->id; } - // ------------------ Game Data Object ---------------------------- ////////////////////////////////////////////////////////////////////// // Construction/Destruction @@ -56,423 +53,416 @@ MON_ELEMENT *data1,*data2; //: m_notifier(notifier) CMonitorData::CMonitorData() { - - m_sequence = 1; - m_buffer = nullptr; - m_nbuffer = 0; - m_count = 0; - m_max = ELEMENT_MAX_START; - m_data = new MON_ELEMENT[m_max]; - for(int x=0;xSend(cUdpChannelReliable1, p, size + 6); free(p); sequence++; } -void CMonitorData::send( UdpConnection *con,short & sequence,short msg,char *data,int size ) +void CMonitorData::send(UdpConnection *con, short & sequence, short msg, char *data, int size) { -unsigned long compress_len; -int len; -unsigned short usize; -char *p; -int rnt; + unsigned long compress_len; + int len; + unsigned short usize; + char *p; + int rnt; - if( CURRENT_API_VERSION != CURRENT_API_3 ) - return; + if (CURRENT_API_VERSION != CURRENT_API_3) + return; - p = (char *)malloc(size+6+1000); - len = 0; - memset(p,0,size+6+1000); - packShort(p+len, len, msg); - packShort(p+len, len, m_sequence); - compress_len = size + 1000; - rnt = compress2((Bytef *)p+6,&compress_len,(Bytef *)data,(long)size,2); - if( rnt != Z_OK ) - { + p = (char *)malloc(size + 6 + 1000); + len = 0; + memset(p, 0, size + 6 + 1000); + packShort(p + len, len, msg); + packShort(p + len, len, m_sequence); + compress_len = size + 1000; + rnt = compress2((Bytef *)p + 6, &compress_len, (Bytef *)data, (long)size, 2); + if (rnt != Z_OK) + { free(p); - printf("CMonitor::send-compress failed, error=%d size =%d\n",rnt,size); - return; - } + printf("CMonitor::send-compress failed, error=%d size =%d\n", rnt, size); + return; + } - usize = (unsigned short)compress_len; - packShort(p+len, len, usize); - usize += 6; + usize = (unsigned short)compress_len; + packShort(p + len, len, usize); + usize += 6; con->Send(cUdpChannelReliable1, p, usize); free(p); sequence++; } -bool CMonitorData::processHierarchyRequestBlock( UdpConnection *con, short & sequence ) +bool CMonitorData::processHierarchyRequestBlock(UdpConnection *con, short & sequence) { -int x,size,count,len; -char temp[512]; + int x, size, count, len; + char temp[512]; - if( m_count == 0 ) + if (m_count == 0) { - send(con,sequence,MON_MSG_REPLY_HIERARCHY,"NOTREADY"); + send(con, sequence, MON_MSG_REPLY_HIERARCHY, "NOTREADY"); return 0; } - memset(m_buffer,0,16); - send(con,sequence,MON_MSG_REPLY_HIERARCHY_BLOCK_BEGIN,m_buffer); + memset(m_buffer, 0, 16); + send(con, sequence, MON_MSG_REPLY_HIERARCHY_BLOCK_BEGIN, m_buffer); - MON_ELEMENT **me; - me = new MON_ELEMENT *[m_count]; - for(x=0;xlabel,me[x]->id,me[x]->ping); - if( len+size >= m_nbuffer ) resize_buffer(size+BUFFER_RESIZE_VALUE); - strcpy(&m_buffer[size],temp); + len = sprintf(temp, "%s,%X,%d|", me[x]->label, me[x]->id, me[x]->ping); + if (len + size >= m_nbuffer) resize_buffer(size + BUFFER_RESIZE_VALUE); + strcpy(&m_buffer[size], temp); size += len; - if( size > 64000 ) - { - send(con,sequence,MON_MSG_REPLY_HIERARCHY_BLOCK,m_buffer,size+1); - memset(m_buffer,0,size); - count++; - size = 0; - } - x++; + if (size > 64000) + { + send(con, sequence, MON_MSG_REPLY_HIERARCHY_BLOCK, m_buffer, size + 1); + memset(m_buffer, 0, size); + count++; + size = 0; + } + x++; } - delete [] me; - if( size > 0 ) - { - send(con,sequence,MON_MSG_REPLY_HIERARCHY_BLOCK,m_buffer,size+1); - memset(m_buffer,0, 16); - count++; - size = 0; - } - memset(m_buffer,0, 16); - send(con,sequence,MON_MSG_REPLY_HIERARCHY_BLOCK_END,m_buffer); - return 1; + delete[] me; + if (size > 0) + { + send(con, sequence, MON_MSG_REPLY_HIERARCHY_BLOCK, m_buffer, size + 1); + memset(m_buffer, 0, 16); + count++; + size = 0; + } + memset(m_buffer, 0, 16); + send(con, sequence, MON_MSG_REPLY_HIERARCHY_BLOCK_END, m_buffer); + return 1; } - bool CMonitorData::processElementsRequest( - UdpConnection *con, short & sequence, char * data, int /* dataLen */ , long lastUpdateTime ) + UdpConnection *con, short & sequence, char * data, int /* dataLen */, long lastUpdateTime) { -char tmp[200]; -int x,id; -int size; -int count; -char **list; + char tmp[200]; + int x, id; + int size; + int count; + char **list; - memset(m_buffer,0,16); - if( !strcmp(data,"-1") ) + memset(m_buffer, 0, 16); + if (!strcmp(data, "-1")) { size = 0; - for (x=0;x= m_nbuffer ) - resize_buffer(size+BUFFER_RESIZE_VALUE); - strcat(m_buffer,tmp); - if( size > 65000 ) + if (size >= m_nbuffer) + resize_buffer(size + BUFFER_RESIZE_VALUE); + strcat(m_buffer, tmp); + if (size > 65000) { - send(con,sequence,MON_MSG_REPLY_ELEMENTS,m_buffer); - memset(m_buffer,0,16); + send(con, sequence, MON_MSG_REPLY_ELEMENTS, m_buffer); + memset(m_buffer, 0, 16); } - } - if( size ) - send(con,sequence,MON_MSG_REPLY_ELEMENTS,m_buffer); + if (size) + send(con, sequence, MON_MSG_REPLY_ELEMENTS, m_buffer); return 1; } - if( !strcmp(data,"-2") ) + if (!strcmp(data, "-2")) { size = 0; count = 0; - for (x=0;x= m_nbuffer ) - resize_buffer(size+BUFFER_RESIZE_VALUE); - strcat(m_buffer,tmp); + if (size >= m_nbuffer) + resize_buffer(size + BUFFER_RESIZE_VALUE); + strcat(m_buffer, tmp); count++; } - if( size > 65000 ) + if (size > 65000) { - send(con,sequence,MON_MSG_REPLY_ELEMENTS,m_buffer); - memset(m_buffer,0,16); + send(con, sequence, MON_MSG_REPLY_ELEMENTS, m_buffer); + memset(m_buffer, 0, 16); } } - if ( count ) + if (count) { - send(con,sequence,MON_MSG_REPLY_ELEMENTS,m_buffer); + send(con, sequence, MON_MSG_REPLY_ELEMENTS, m_buffer); return 1; } return 0; } - - list = new char * [m_max]; - count = parseList( list, data,'|',m_max); - memset(m_buffer,0,16); - + + list = new char *[m_max]; + count = parseList(list, data, '|', m_max); + memset(m_buffer, 0, 16); + size = 0; - for(x=0;x= m_nbuffer ) - resize_buffer(size+BUFFER_RESIZE_VALUE); - strcat(m_buffer,tmp); + if (size >= m_nbuffer) + resize_buffer(size + BUFFER_RESIZE_VALUE); + strcat(m_buffer, tmp); } } - delete [] list; + delete[] list; - if( count > 0 ) - send(con,sequence,MON_MSG_REPLY_ELEMENTS,m_buffer); + if (count > 0) + send(con, sequence, MON_MSG_REPLY_ELEMENTS, m_buffer); return 0; } - -bool CMonitorData::processDescriptionRequest(UdpConnection *con, short & sequence, char * userData, int , unsigned char *mark) +bool CMonitorData::processDescriptionRequest(UdpConnection *con, short & sequence, char * userData, int, unsigned char *mark) { -char line[4096]; -char tmp[400]; -int x,id,size; -int flag; -char *p; + char line[4096]; + char tmp[400]; + int x, id, size; + int flag; + char *p; size = 0; - memset(m_buffer,0,16); - strcpy(line,userData); - p = strtok(line,"|"); + memset(m_buffer, 0, 16); + strcpy(line, userData); + p = strtok(line, "|"); flag = 0; - if( strstr(p,"next") ) + if (strstr(p, "next")) { - for(x=0;x= m_nbuffer ) - resize_buffer(size+BUFFER_RESIZE_VALUE); - strcat(m_buffer,tmp); - send(con,sequence,MON_MSG_REPLY_DESCRIPTION,m_buffer); - return 1; - } + set_bit(mark, x); + if (m_data[x].discription != nullptr) + { + sprintf(tmp, "%d,%s|", m_data[x].id, m_data[x].discription); + size += (int)strlen(tmp); + if (size >= m_nbuffer) + resize_buffer(size + BUFFER_RESIZE_VALUE); + strcat(m_buffer, tmp); + send(con, sequence, MON_MSG_REPLY_DESCRIPTION, m_buffer); + return 1; + } } } } else { - if( p ) + if (p) { size = 0; flag = 0; id = atoi(p); - for(x=0;x= m_nbuffer ) - resize_buffer(size+BUFFER_RESIZE_VALUE); - strcat(m_buffer,tmp); - if( size >= 2000 || m_data[x].discription ) - { - send(con,sequence,MON_MSG_REPLY_DESCRIPTION,m_buffer); - return 1; - } - } + set_bit(mark, x); + if (m_data[x].discription != nullptr) + { + sprintf(tmp, "%d,%s|", m_data[x].id, m_data[x].discription); + size += (int)strlen(tmp); + if (size >= m_nbuffer) + resize_buffer(size + BUFFER_RESIZE_VALUE); + strcat(m_buffer, tmp); + if (size >= 2000 || m_data[x].discription) + { + send(con, sequence, MON_MSG_REPLY_DESCRIPTION, m_buffer); + return 1; + } + } } } } } - - if( flag == 2 ) - send(con,sequence,MON_MSG_REPLY_DESCRIPTION,m_buffer); - send(con,sequence,MON_MSG_REPLY_DESCRIPTION,"none"); - return 0; - + if (flag == 2) + send(con, sequence, MON_MSG_REPLY_DESCRIPTION, m_buffer); + send(con, sequence, MON_MSG_REPLY_DESCRIPTION, "none"); + return 0; } -int CMonitorData::add(const char *label, int id, int ping, const char *des ) +int CMonitorData::add(const char *label, int id, int ping, const char *des) { -int x; + int x; - if( strlen(label) >= 127 ) + if (strlen(label) >= 127) { - printf("MonAPI Error: add() label exceeds length of 127. ->%s\n",label); + printf("MonAPI Error: add() label exceeds length of 127. ->%s\n", label); return 0; } - for(x=0;x %s\n",id,m_data[x].label,label); - m_data[x].ping = pingValue( ping ); + printf("MonAPI: assign new Id (%d) %s -> %s\n", id, m_data[x].label, label); + m_data[x].ping = pingValue(ping); m_data[x].value = 0; m_data[x].id = id; //******* Label *********** - delete [] m_data[x].label; - m_data[x].label = new char [strlen(label)+1]; - strcpy(m_data[x].label,label); - + delete[] m_data[x].label; + m_data[x].label = new char[strlen(label) + 1]; + strcpy(m_data[x].label, label); + //******* Discription ****** - delete [] m_data[x].discription; + delete[] m_data[x].discription; m_data[x].discription = nullptr; - if( des ) + if (des) { - m_data[x].discription = new char [strlen(des)+1]; - strcpy(m_data[x].discription,des); + m_data[x].discription = new char[strlen(des) + 1]; + strcpy(m_data[x].discription, des); } - qsort(m_data,m_count,sizeof(MON_ELEMENT),compar_index); + qsort(m_data, m_count, sizeof(MON_ELEMENT), compar_index); return 1; } - if( !strcmp(label,m_data[x].label) ) + if (!strcmp(label, m_data[x].label)) { - printf("MonAPI ERROR: Label already found %s Id: old(%d) new(%d).\n",label,m_data[x].id,id); + printf("MonAPI ERROR: Label already found %s Id: old(%d) new(%d).\n", label, m_data[x].id, id); return 0; } } - if( m_max == m_count + 1 ) + if (m_max == m_count + 1) { - printf("MonitorObject: max element reached [%d].\n%s\nContact David Taylor (858) 577-3155.\n",m_max,label); + printf("MonitorObject: max element reached [%d].\n%s\nContact David Taylor (858) 577-3155.\n", m_max, label); return 0; } - m_data[m_count].ping = pingValue( ping ); + m_data[m_count].ping = pingValue(ping); m_data[m_count].value = 0; m_data[m_count].id = id; - delete [] m_data[m_count].label; - m_data[m_count].label = new char [strlen(label)+1]; - strcpy(m_data[m_count].label,label); - if( des ) + delete[] m_data[m_count].label; + m_data[m_count].label = new char[strlen(label) + 1]; + strcpy(m_data[m_count].label, label); + if (des) { - delete [] m_data[x].discription; - m_data[x].discription = new char [strlen(des)+1]; - strcpy(m_data[x].discription,des); + delete[] m_data[x].discription; + m_data[x].discription = new char[strlen(des) + 1]; + strcpy(m_data[x].discription, des); } m_count++; - qsort(m_data,m_count,sizeof(MON_ELEMENT),compar_index); + qsort(m_data, m_count, sizeof(MON_ELEMENT), compar_index); return 1; } -int CMonitorData::setDescription( int Id, const char *Description , int & mode) +int CMonitorData::setDescription(int Id, const char *Description, int & mode) { -int x; + int x; - for(x=0;x 1; ) + for (low = (-1), high = m_count; high - low > 1; ) { - i = (high+low) / 2; - if ( Id <= m_data[i].id ) + i = (high + low) / 2; + if (Id <= m_data[i].id) high = i; else - low = i; + low = i; } - if ( high < m_count && Id==m_data[high].id ) - { - if (m_data[high].ChangedTime == 0 || m_data[high].value != value) { - m_data[high].ChangedTime = (long)time(nullptr); - m_data[high].value = value; - } - } + if (high < m_count && Id == m_data[high].id) + { + if (m_data[high].ChangedTime == 0 || m_data[high].value != value) { + m_data[high].ChangedTime = (long)time(nullptr); + m_data[high].value = value; + } + } } void CMonitorData::remove(int Id) { -int x; + int x; - if( m_count == 1 ) + if (m_count == 1) { - delete [] m_data[0].label; - - delete [] m_data[0].discription; + delete[] m_data[0].label; + delete[] m_data[0].discription; m_data[0].label = 0; m_data[0].id = 0; @@ -535,61 +524,60 @@ int x; return; } - for(x=0;x 0 ) - { - if( *data == tok ) - { - *data = 0; - data++; + list[0] = data; + count = 1; + cnt = 0; + while (cnt < max && *data > 0) + { + if (*data == tok) + { + *data = 0; + data++; + cnt++; + list[count] = data; + if (*data) count++; + } cnt++; - list[count] = data; - if( *data ) count++; - } - cnt++; - if( *data ) data++; + if (*data) data++; } - return count; + return count; } - void CMonitorData::dump() { printf("********** Monitor API Dump *******************\n"); - printf(" Version: %d\n",CURRENT_API_VERSION); + printf(" Version: %d\n", CURRENT_API_VERSION); printf("\ncount: %d\n", m_count); - printf("\t%-40s %8s\t%s\t%s\n","Label","Id","Ping","Value"); - for(int x=0;x #ifdef EXTERNAL_DISTRO -namespace NAMESPACE +namespace NAMESPACE { - #endif -namespace Base -{ + namespace Base + { + class CAutoLog + { + public: + enum eLogLevel { + eLOG_NONE = 0, // log entries are discarded + eLOG_ERROR = 1, // log errors only + eLOG_ALERT = 2, // log alerts and errors only + eLOG_NORMAL = 3, // log all normal events, no debug + eLOG_DEBUG = 4 // log everything + }; - class CAutoLog - { - public: - enum eLogLevel { - eLOG_NONE = 0, // log entries are discarded - eLOG_ERROR = 1, // log errors only - eLOG_ALERT = 2, // log alerts and errors only - eLOG_NORMAL = 3, // log all normal events, no debug - eLOG_DEBUG = 4 // log everything - }; + // Global setting for all AutoLog instances for this application. Can be set on the fly. Default is eLOG_NORMAL. + void SetLogLevel(eLogLevel loglevel); - // Global setting for all AutoLog instances for this application. Can be set on the fly. Default is eLOG_NORMAL. - void SetLogLevel(eLogLevel loglevel); + // Global setting for all AutoLog instances for this application. Can be set on the fly. Default is eLOG_ERROR. + void SetPrintLevel(eLogLevel printlevel); - // Global setting for all AutoLog instances for this application. Can be set on the fly. Default is eLOG_ERROR. - void SetPrintLevel(eLogLevel printlevel); + // Global setting for all AutoLog instances for this application. Can be set on the fly. Default is eLOG_ERROR. + void SetFlushLevel(eLogLevel flushlevel); - // Global setting for all AutoLog instances for this application. Can be set on the fly. Default is eLOG_ERROR. - void SetFlushLevel(eLogLevel flushlevel); + // constructor, no file loaded + CAutoLog(); - // constructor, no file loaded - CAutoLog(); + // version of constructor that calls Open(file) + CAutoLog(const char * file); - // version of constructor that calls Open(file) - CAutoLog(const char * file); + // destructor, will close file if opened + ~CAutoLog(); - // destructor, will close file if opened - ~CAutoLog(); + // Open log file. If a file is already open, function will fail. + // returns true if no error + bool Open(const char * file); - // Open log file. If a file is already open, function will fail. - // returns true if no error - bool Open(const char * file); + // Close log file if opened. + void Close(void); - // Close log file if opened. - void Close(void); + // Make an entry in the log. Format and variable arguments are identical to printf. + // severity will be compared to master log level to determine if the log entry will be made + // severity will be compared to master print level to determine if the log entry will be printed to stdout + void Log(eLogLevel severity, char * format, ...); - // Make an entry in the log. Format and variable arguments are identical to printf. - // severity will be compared to master log level to determine if the log entry will be made - // severity will be compared to master print level to determine if the log entry will be printed to stdout - void Log(eLogLevel severity, char * format, ...); + // Equivalent to the above with the approriate severity argument + void LogError(char * format, ...); + void LogAlert(char * format, ...); + void Log(char * format, ...); + void LogDebug(char * format, ...); - // Equivalent to the above with the approriate severity argument - void LogError(char * format, ...); - void LogAlert(char * format, ...); - void Log(char * format, ...); - void LogDebug(char * format, ...); + private: + FILE * pFile; // current log file opened + char * pFilename; // current log file opened + void Archive(void); // archives current log - private: - FILE * pFile; // current log file opened - char * pFilename; // current log file opened - int nTodaysDayOfYear; // remember the current day to detect change of day - void Archive(void); // archives current log + static eLogLevel nLogMask; // master severity level + static eLogLevel nPrintMask; // master severity level + static eLogLevel nFlushMask; // master severity level + }; - static eLogLevel nLogMask; // master severity level - static eLogLevel nPrintMask; // master severity level - static eLogLevel nFlushMask; // master severity level - }; + //------------------------------------- + inline void CAutoLog::SetLogLevel(eLogLevel loglevel) + { + nLogMask = loglevel; + } - //------------------------------------- - inline void CAutoLog::SetLogLevel(eLogLevel loglevel) - { - nLogMask = loglevel; - } + //------------------------------------- + inline void CAutoLog::SetPrintLevel(eLogLevel printlevel) + { + nPrintMask = printlevel; + } - //------------------------------------- - inline void CAutoLog::SetPrintLevel(eLogLevel printlevel) - { - nPrintMask = printlevel; - } + //------------------------------------- + inline void CAutoLog::SetFlushLevel(eLogLevel flushlevel) + { + nFlushMask = flushlevel; + } - //------------------------------------- - inline void CAutoLog::SetFlushLevel(eLogLevel flushlevel) - { - nFlushMask = flushlevel; - } + //------------------------------------- + inline CAutoLog::CAutoLog() + { + pFilename = nullptr; + pFile = (FILE *)-1; + } - //------------------------------------- - inline CAutoLog::CAutoLog() - { - pFilename = nullptr; - pFile = (FILE *)-1; - } + //------------------------------------- + inline CAutoLog::CAutoLog(const char * file) + { + pFilename = nullptr; + pFile = (FILE *)-1; + Open(file); + } - //------------------------------------- - inline CAutoLog::CAutoLog(const char * file) - { - pFilename = nullptr; - pFile = (FILE *)-1; - Open(file); - } - - //------------------------------------- - inline CAutoLog::~CAutoLog() - { - Close(); - } -}; + //------------------------------------- + inline CAutoLog::~CAutoLog() + { + Close(); + } + }; #ifdef EXTERNAL_DISTRO }; #endif From a31d7ca48b71155590a850c7ed87749ef1579874 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sun, 24 Jul 2016 01:52:29 +0000 Subject: [PATCH 153/302] partial revert as pvs mislead me --- .../3rd/library/platform/utils/Base/AutoLog.h | 165 +++++++++--------- 1 file changed, 84 insertions(+), 81 deletions(-) diff --git a/external/3rd/library/platform/utils/Base/AutoLog.h b/external/3rd/library/platform/utils/Base/AutoLog.h index daabba68..18871c7f 100755 --- a/external/3rd/library/platform/utils/Base/AutoLog.h +++ b/external/3rd/library/platform/utils/Base/AutoLog.h @@ -6,107 +6,110 @@ #include #ifdef EXTERNAL_DISTRO -namespace NAMESPACE +namespace NAMESPACE { + #endif - namespace Base - { - class CAutoLog - { - public: - enum eLogLevel { - eLOG_NONE = 0, // log entries are discarded - eLOG_ERROR = 1, // log errors only - eLOG_ALERT = 2, // log alerts and errors only - eLOG_NORMAL = 3, // log all normal events, no debug - eLOG_DEBUG = 4 // log everything - }; +namespace Base +{ - // Global setting for all AutoLog instances for this application. Can be set on the fly. Default is eLOG_NORMAL. - void SetLogLevel(eLogLevel loglevel); + class CAutoLog + { + public: + enum eLogLevel { + eLOG_NONE = 0, // log entries are discarded + eLOG_ERROR = 1, // log errors only + eLOG_ALERT = 2, // log alerts and errors only + eLOG_NORMAL = 3, // log all normal events, no debug + eLOG_DEBUG = 4 // log everything + }; - // Global setting for all AutoLog instances for this application. Can be set on the fly. Default is eLOG_ERROR. - void SetPrintLevel(eLogLevel printlevel); + // Global setting for all AutoLog instances for this application. Can be set on the fly. Default is eLOG_NORMAL. + void SetLogLevel(eLogLevel loglevel); - // Global setting for all AutoLog instances for this application. Can be set on the fly. Default is eLOG_ERROR. - void SetFlushLevel(eLogLevel flushlevel); + // Global setting for all AutoLog instances for this application. Can be set on the fly. Default is eLOG_ERROR. + void SetPrintLevel(eLogLevel printlevel); - // constructor, no file loaded - CAutoLog(); + // Global setting for all AutoLog instances for this application. Can be set on the fly. Default is eLOG_ERROR. + void SetFlushLevel(eLogLevel flushlevel); - // version of constructor that calls Open(file) - CAutoLog(const char * file); + // constructor, no file loaded + CAutoLog(); - // destructor, will close file if opened - ~CAutoLog(); + // version of constructor that calls Open(file) + CAutoLog(const char * file); - // Open log file. If a file is already open, function will fail. - // returns true if no error - bool Open(const char * file); + // destructor, will close file if opened + ~CAutoLog(); - // Close log file if opened. - void Close(void); + // Open log file. If a file is already open, function will fail. + // returns true if no error + bool Open(const char * file); - // Make an entry in the log. Format and variable arguments are identical to printf. - // severity will be compared to master log level to determine if the log entry will be made - // severity will be compared to master print level to determine if the log entry will be printed to stdout - void Log(eLogLevel severity, char * format, ...); + // Close log file if opened. + void Close(void); - // Equivalent to the above with the approriate severity argument - void LogError(char * format, ...); - void LogAlert(char * format, ...); - void Log(char * format, ...); - void LogDebug(char * format, ...); + // Make an entry in the log. Format and variable arguments are identical to printf. + // severity will be compared to master log level to determine if the log entry will be made + // severity will be compared to master print level to determine if the log entry will be printed to stdout + void Log(eLogLevel severity, char * format, ...); - private: - FILE * pFile; // current log file opened - char * pFilename; // current log file opened - void Archive(void); // archives current log + // Equivalent to the above with the approriate severity argument + void LogError(char * format, ...); + void LogAlert(char * format, ...); + void Log(char * format, ...); + void LogDebug(char * format, ...); - static eLogLevel nLogMask; // master severity level - static eLogLevel nPrintMask; // master severity level - static eLogLevel nFlushMask; // master severity level - }; + private: + FILE * pFile; // current log file opened + char * pFilename; // current log file opened + int nTodaysDayOfYear; // remember the current day to detect change of day + void Archive(void); // archives current log - //------------------------------------- - inline void CAutoLog::SetLogLevel(eLogLevel loglevel) - { - nLogMask = loglevel; - } + static eLogLevel nLogMask; // master severity level + static eLogLevel nPrintMask; // master severity level + static eLogLevel nFlushMask; // master severity level + }; - //------------------------------------- - inline void CAutoLog::SetPrintLevel(eLogLevel printlevel) - { - nPrintMask = printlevel; - } + //------------------------------------- + inline void CAutoLog::SetLogLevel(eLogLevel loglevel) + { + nLogMask = loglevel; + } - //------------------------------------- - inline void CAutoLog::SetFlushLevel(eLogLevel flushlevel) - { - nFlushMask = flushlevel; - } + //------------------------------------- + inline void CAutoLog::SetPrintLevel(eLogLevel printlevel) + { + nPrintMask = printlevel; + } - //------------------------------------- - inline CAutoLog::CAutoLog() - { - pFilename = nullptr; - pFile = (FILE *)-1; - } + //------------------------------------- + inline void CAutoLog::SetFlushLevel(eLogLevel flushlevel) + { + nFlushMask = flushlevel; + } - //------------------------------------- - inline CAutoLog::CAutoLog(const char * file) - { - pFilename = nullptr; - pFile = (FILE *)-1; - Open(file); - } + //------------------------------------- + inline CAutoLog::CAutoLog() + { + pFilename = nullptr; + pFile = (FILE *)-1; + } - //------------------------------------- - inline CAutoLog::~CAutoLog() - { - Close(); - } - }; + //------------------------------------- + inline CAutoLog::CAutoLog(const char * file) + { + pFilename = nullptr; + pFile = (FILE *)-1; + Open(file); + } + + //------------------------------------- + inline CAutoLog::~CAutoLog() + { + Close(); + } +}; #ifdef EXTERNAL_DISTRO }; #endif From 0944957824db647da55d4ff69d33fd8eaecfd72f Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sun, 24 Jul 2016 01:55:15 +0000 Subject: [PATCH 154/302] forgot to declare --- .../3rd/library/platform/projects/MonAPI2/MonitorData.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/external/3rd/library/platform/projects/MonAPI2/MonitorData.cpp b/external/3rd/library/platform/projects/MonAPI2/MonitorData.cpp index cf8952eb..5740d61e 100755 --- a/external/3rd/library/platform/projects/MonAPI2/MonitorData.cpp +++ b/external/3rd/library/platform/projects/MonAPI2/MonitorData.cpp @@ -284,7 +284,7 @@ bool CMonitorData::processElementsRequest( { id = atoi(list[x]); - for (y = 0; y < m_count; y++) + for (int y = 0; y < m_count; y++) if (m_data[y].id == id) { sprintf(tmp, "%d %x|", m_data[y].id, m_data[y].value); @@ -716,4 +716,4 @@ int unpackByte(char *buffer, int & len, char &value) value = buffer[0]; len++; return 1; -} \ No newline at end of file +} From 5217465f671301594f388c8baf403e25edf9bd63 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sun, 24 Jul 2016 17:47:01 -0700 Subject: [PATCH 155/302] pvs studio suggested improvements for performance --- external/3rd/library/webAPI/webAPI.cpp | 56 +++++++++++++------------- external/3rd/library/webAPI/webAPI.h | 15 +++---- 2 files changed, 37 insertions(+), 34 deletions(-) diff --git a/external/3rd/library/webAPI/webAPI.cpp b/external/3rd/library/webAPI/webAPI.cpp index b9637b03..61cb403d 100644 --- a/external/3rd/library/webAPI/webAPI.cpp +++ b/external/3rd/library/webAPI/webAPI.cpp @@ -19,7 +19,7 @@ using namespace std; // if status == success, returns "success", or slotName's contents if specified... // otherwise returns the "message" if no success -string webAPI::simplePost(string endpoint, string data, string slotName) +string webAPI::simplePost(const string &endpoint, const string &data, const string &slotName) { // declare our output and go ahead and attempt to get data from remote nlohmann::json response = request(endpoint, data, 1); @@ -37,7 +37,7 @@ string webAPI::simplePost(string endpoint, string data, string slotName) { output = "success"; } - } + } else //default message is an error, the other end always assumes "success" or the specified slot { if (response.count("message")) @@ -50,12 +50,12 @@ string webAPI::simplePost(string endpoint, string data, string slotName) } } - return output; + return output; } // this can be broken out to separate the json bits later if we need raw or other http type requests // all it does is fetch via get or post, and if the status is 200 returns the json, else error json -nlohmann::json webAPI::request(string endpoint, string data, int reqType) +nlohmann::json webAPI::request(const string &endpoint, const string &data, const int &reqType) { nlohmann::json response; @@ -63,34 +63,36 @@ nlohmann::json webAPI::request(string endpoint, string data, int reqType) { CURL *curl = curl_easy_init(); // start up curl - if (curl) - { - string readBuffer; // container for the remote response + if (curl) + { + string readBuffer; // container for the remote response long http_code = 0; // we get this after performing the get or post - curl_easy_setopt(curl, CURLOPT_URL, endpoint.c_str()); // endpoint is always specified by caller - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writeCallback); // place the data into readBuffer using writeCallback - curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer); // specify readBuffer as the container for data + curl_easy_setopt(curl, CURLOPT_URL, endpoint.c_str()); // endpoint is always specified by caller + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writeCallback); // place the data into readBuffer using writeCallback + curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer); // specify readBuffer as the container for data if (reqType == 1) { curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data.c_str()); - } + } //todo - get request? etc CURLcode res = curl_easy_perform(curl); // make the request! - - curl_easy_getinfo (curl, CURLINFO_RESPONSE_CODE, &http_code); //get status code + + curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &http_code); //get status code if (res == CURLE_OK && http_code == 200 && !(readBuffer.empty())) // check it all out and parse { try { - response = nlohmann::json::parse(readBuffer); - } catch (string e) { - response["message"] = e; - response["status"] = "failure"; - } catch (...) { - response["message"] = "JSON parse error for endpoint."; - response["status"] = "failure"; + response = nlohmann::json::parse(readBuffer); + } + catch (string &e) { + response["message"] = e; + response["status"] = "failure"; + } + catch (...) { + response["message"] = "JSON parse error for endpoint."; + response["status"] = "failure"; } } else @@ -102,14 +104,14 @@ nlohmann::json webAPI::request(string endpoint, string data, int reqType) } else //default err messages below { - response["message"] = "Failed to initialize cURL."; - response["status"] = "failure"; + response["message"] = "Failed to initialize cURL."; + response["status"] = "failure"; } } else { - response["message"] = "Invalid endpoint URL."; - response["status"] = "failure"; + response["message"] = "Invalid endpoint URL."; + response["status"] = "failure"; } return response; @@ -118,6 +120,6 @@ nlohmann::json webAPI::request(string endpoint, string data, int reqType) // This is used by curl to grab the response and put it into a var size_t webAPI::writeCallback(void *contents, size_t size, size_t nmemb, void *userp) { - ((string*)userp)->append((char*)contents, size * nmemb); - return size * nmemb; -} + ((string*)userp)->append((char*)contents, size * nmemb); + return size * nmemb; +} \ No newline at end of file diff --git a/external/3rd/library/webAPI/webAPI.h b/external/3rd/library/webAPI/webAPI.h index 51e60a2c..be5b64ef 100644 --- a/external/3rd/library/webAPI/webAPI.h +++ b/external/3rd/library/webAPI/webAPI.h @@ -17,18 +17,19 @@ License: what's a license? we're a bunch of dirty pirates! #define webAPI_H #include "json.hpp" + +#ifdef WIN32 +#include +#else #include +#endif namespace webAPI { using namespace std; - - string simplePost(string endpoint, string data, string slotName); - //std::string simpleGet(char* endpoint, char* data); - //nlohmann::json post(char* endpoint, char* data); - //nlohmann::json get(char* endpoint, char* data); - - nlohmann::json request(string endpoint, string data, int reqType); // 1 for post, 0 for get + + string simplePost(const string &endpoint, const string &data, const string &slotName); + nlohmann::json request(const string &endpoint, const string &data, const int &reqType); // 1 for post, 0 for get size_t writeCallback(void *contents, size_t size, size_t nmemb, void *userp); }; From d2c830306fb5c5a5781391336a6154b1bb68058d Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sun, 24 Jul 2016 20:37:39 -0700 Subject: [PATCH 156/302] i must test these before calling them good - as gcc isn't on the windows machine i push, test, fix, and then push again - pvs studio <3 --- .../ATGenericAPI/GenericApiCore.cpp | 439 ++- .../ATGenericAPI/GenericConnection.cpp | 305 +- .../ATGenericAPI/GenericMessage.cpp | 47 +- .../TcpLibrary/TcpManager.cpp | 1246 ++++--- .../src/shared/CentralCSHandler.h | 98 +- .../src/shared/ConnectionServerConnection.cpp | 140 +- .../src/shared/ConnectionServer.cpp | 2 +- .../src/shared/TemplateParameter.h | 380 +- .../3rd/library/platform/utils/Base/AutoLog.h | 169 +- .../projects/ChatAPI/AvatarIteratorCore.cpp | 829 +++-- .../ChatAPI/projects/ChatAPI/ChatAPICore.cpp | 2185 ++++++----- .../projects/ChatAPI/ChatAvatarCore.cpp | 324 +- .../ChatAPI/projects/ChatAPI/ChatRoomCore.cpp | 1911 +++++----- .../ChatAPI/projects/ChatAPI/Request.cpp | 3085 ++++++++-------- .../ChatAPI/projects/ChatAPI/Response.cpp | 3186 ++++++++--------- .../soePlatform/ChatAPI/utils/Base/AutoLog.h | 167 +- .../utils/GenericAPI/GenericConnection.cpp | 519 ++- .../utils/GenericAPI/GenericMessage.cpp | 43 +- .../ChatAPI/utils/Unicode/UnicodeUtils.h | 604 ++-- 19 files changed, 7743 insertions(+), 7936 deletions(-) diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericApiCore.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericApiCore.cpp index 3735217d..d4b0941d 100644 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericApiCore.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericApiCore.cpp @@ -13,260 +13,255 @@ using namespace std; #ifdef EXTERNAL_DISTRO -namespace NAMESPACE +namespace NAMESPACE { - #endif -//---------------------------------------- -ServerTrackObject::ServerTrackObject(unsigned mapped_track, unsigned real_track, GenericConnection *con) -: m_mappedTrack(mapped_track), m_realTrack(real_track), m_connection(con) -//---------------------------------------- -{ -} + //---------------------------------------- + ServerTrackObject::ServerTrackObject(unsigned mapped_track, unsigned real_track, GenericConnection *con) + : m_mappedTrack(mapped_track), m_realTrack(real_track), m_connection(con) + //---------------------------------------- + { + } -//---------------------------------------- -GenericAPICore::GenericAPICore(const char *host, - short port, - unsigned reqTimeout, - unsigned reconnectTimeout, - unsigned noDataTimeoutSecs, - unsigned noAckTimeoutSecs, - unsigned incomingBufSizeInKB, - unsigned outgoingBufSizeInKB, - unsigned keepAlive, - unsigned maxRecvMessageSizeInKB) -: m_currTrack(0), - m_reconnectTimeout(0), - m_outCount(0), - m_pendingCount(0), - m_requestTimeout(reqTimeout), - m_currentConnections(0), m_maxConnections(0), - m_suspended(false), - m_nextConnectionIndex(0) -//---------------------------------------- -{ - GenericConnection *con = new GenericConnection(host, port, this, reconnectTimeout, noDataTimeoutSecs, noAckTimeoutSecs, incomingBufSizeInKB, outgoingBufSizeInKB, keepAlive, maxRecvMessageSizeInKB); - m_serverConnections.push_back(con); -} - -//---------------------------------------- -GenericAPICore::GenericAPICore(const char *game, const char *hosts[], - const short port[], - unsigned arraySize, - unsigned reqTimeout, - unsigned reconnectTimeout, - unsigned noDataTimeoutSecs, - unsigned noAckTimeoutSecs, - unsigned incomingBufSizeInKB, - unsigned outgoingBufSizeInKB, - unsigned keepAlive, - unsigned maxRecvMessageSizeInKB) -: m_currTrack(0), - m_reconnectTimeout(0), - m_outCount(0), - m_pendingCount(0), - m_requestTimeout(reqTimeout), - m_currentConnections(0), m_maxConnections(0), - m_suspended(false), - m_nextConnectionIndex(0), - m_game(game) -//---------------------------------------- -{ - for (unsigned i=0; i::iterator conIter = m_serverConnections.begin(); conIter != m_serverConnections.end(); conIter++) - { - GenericConnection *con = *conIter; - delete con; - } - m_serverConnections.clear(); - - for(map::iterator iter = m_pending.begin(); iter != m_pending.end(); ++iter) - { - delete (*iter).second; } - m_pending.empty(); - - while(m_outCount > 0) + //---------------------------------------- + GenericAPICore::GenericAPICore(const char *game, const char *hosts[], + const short port[], + unsigned arraySize, + unsigned reqTimeout, + unsigned reconnectTimeout, + unsigned noDataTimeoutSecs, + unsigned noAckTimeoutSecs, + unsigned incomingBufSizeInKB, + unsigned outgoingBufSizeInKB, + unsigned keepAlive, + unsigned maxRecvMessageSizeInKB) + : m_currTrack(0), + m_reconnectTimeout(0), + m_outCount(0), + m_pendingCount(0), + m_requestTimeout(reqTimeout), + m_currentConnections(0), m_maxConnections(0), + m_suspended(false), + m_nextConnectionIndex(0), + m_game(game) + //---------------------------------------- { - delete m_outboundQueue.front().second; - delete m_outboundQueue.front().first; - m_outboundQueue.pop(); - --m_outCount; - } -} - -//---------------------------------------- -unsigned GenericAPICore::submitRequest(GenericRequest *req, GenericResponse *res) -//---------------------------------------- -{ - ++m_outCount; - if(m_currTrack == 0) - { - m_currTrack++; - } - req->setTrack(m_currTrack); - res->setTrack(m_currTrack); - time_t timeout = time(nullptr) + m_requestTimeout; - - req->setTimeout(timeout); - res->setTimeout(timeout); - - m_outboundQueue.push(pair(req, res)); - return(m_currTrack++); -} - -//---------------------------------------- -void GenericAPICore::process() -//---------------------------------------- -{ - GenericRequest *req; - GenericResponse *res; - - if (!m_suspended) - { - // Process timeout on pending requests - while((m_outCount > 0) && ((req = m_outboundQueue.front().first)->getTimeout() <= time(nullptr))) + for (unsigned i = 0; i < arraySize; i++) { - --m_outCount; - res = m_outboundQueue.front().second; + GenericConnection *con = new GenericConnection(hosts[i], port[i], this, reconnectTimeout, noDataTimeoutSecs, noAckTimeoutSecs, incomingBufSizeInKB, outgoingBufSizeInKB, keepAlive, maxRecvMessageSizeInKB); + m_serverConnections.push_back(con); + } + } + + //---------------------------------------- + GenericAPICore::~GenericAPICore() + //---------------------------------------- + { + for (std::vector::iterator conIter = m_serverConnections.begin(); conIter != m_serverConnections.end(); conIter++) + { + GenericConnection *con = *conIter; + delete con; + } + m_serverConnections.clear(); + + for (map::iterator iter = m_pending.begin(); iter != m_pending.end(); ++iter) + { + delete (*iter).second; + } + + m_pending.clear(); + + while (m_outCount > 0) + { + delete m_outboundQueue.front().second; + delete m_outboundQueue.front().first; m_outboundQueue.pop(); - - responseCallback(res); - delete res; - delete req; + --m_outCount; } + } - // Process timeout on pending responses - while((m_pendingCount > 0) && ((res = (*m_pending.begin()).second)->getTimeout() <= time(nullptr))) + //---------------------------------------- + unsigned GenericAPICore::submitRequest(GenericRequest *req, GenericResponse *res) + //---------------------------------------- + { + ++m_outCount; + if (m_currTrack == 0) { - --m_pendingCount; - m_pending.erase(m_pending.begin()); - responseCallback(res); - delete res; + m_currTrack++; } + req->setTrack(m_currTrack); + res->setTrack(m_currTrack); + time_t timeout = time(nullptr) + m_requestTimeout; - while(m_outCount > 0) + req->setTimeout(timeout); + res->setTimeout(timeout); + + m_outboundQueue.push(pair(req, res)); + return(m_currTrack++); + } + + //---------------------------------------- + void GenericAPICore::process() + //---------------------------------------- + { + GenericRequest *req; + GenericResponse *res; + + if (!m_suspended) { - pair out_pair = m_outboundQueue.front(); - req = out_pair.first; - res = out_pair.second; - GenericConnection *con = nullptr; - if (req->getMappedServerTrack() == 0) // request has no originating "owner" server + // Process timeout on pending requests + while ((m_outCount > 0) && ((req = m_outboundQueue.front().first)->getTimeout() <= time(nullptr))) { - con = getNextActiveConnection(); // it does not matter which server we send this to + --m_outCount; + res = m_outboundQueue.front().second; + m_outboundQueue.pop(); + + responseCallback(res); + delete res; + delete req; } - else + + // Process timeout on pending responses + while ((m_pendingCount > 0) && ((res = (*m_pending.begin()).second)->getTimeout() <= time(nullptr))) { - ServerTrackObject *stobj = findServer(req->getMappedServerTrack()); - if (stobj) + --m_pendingCount; + m_pending.erase(m_pending.begin()); + responseCallback(res); + delete res; + } + + while (m_outCount > 0) + { + pair out_pair = m_outboundQueue.front(); + req = out_pair.first; + res = out_pair.second; + GenericConnection *con = nullptr; + if (req->getMappedServerTrack() == 0) // request has no originating "owner" server { - con = stobj->getConnection(); // the server connection to respond to - req->setServerTrack(stobj->getRealServerTrack()); // map server track back to REAL server track - //printf("\nUnmapping %d to %d", stobj->getMappedServerTrack(), req->getMappedServerTrack()); //debug - delete stobj; + con = getNextActiveConnection(); // it does not matter which server we send this to + } + else + { + ServerTrackObject *stobj = findServer(req->getMappedServerTrack()); + if (stobj) + { + con = stobj->getConnection(); // the server connection to respond to + req->setServerTrack(stobj->getRealServerTrack()); // map server track back to REAL server track + //printf("\nUnmapping %d to %d", stobj->getMappedServerTrack(), req->getMappedServerTrack()); //debug + delete stobj; + } + } + + if (con != nullptr) + { + Base::ByteStream msg; + req->pack(msg); + con->Send(msg); + m_pending.insert(pair(res->getTrack(), res)); + --m_outCount; + ++m_pendingCount; + m_outboundQueue.pop(); + delete req; + } + else + { + //no active connections + break; //from while loop } } + } - if (con != nullptr) - { - Base::ByteStream msg; - req->pack(msg); - con->Send(msg); - m_pending.insert(pair(res->getTrack(), res)); - --m_outCount; - ++m_pendingCount; - m_outboundQueue.pop(); - delete req; - } - else - { - //no active connections - break; //from while loop - } - + for (std::vector::iterator conIter = m_serverConnections.begin(); conIter != m_serverConnections.end(); conIter++) + { + GenericConnection *con = *conIter; + con->process(); } } - for (std::vector::iterator conIter = m_serverConnections.begin(); conIter != m_serverConnections.end(); conIter++) - { - GenericConnection *con = *conIter; - con->process(); - } -} + //---------------------------------------- + GenericConnection *GenericAPICore::getNextActiveConnection() + //---------------------------------------- + { + unsigned startIndex = m_nextConnectionIndex; + unsigned maxIndex = m_serverConnections.size() - 1; + GenericConnection *con = nullptr; -//---------------------------------------- -GenericConnection *GenericAPICore::getNextActiveConnection() -//---------------------------------------- -{ - unsigned startIndex = m_nextConnectionIndex; - unsigned maxIndex = m_serverConnections.size() - 1; + //loop until we find an active connection, or until we get back + // to where we started + do + { + if (m_serverConnections[m_nextConnectionIndex]->isConnected()) + { + con = m_serverConnections[m_nextConnectionIndex]; + if (m_nextConnectionIndex == maxIndex) + m_nextConnectionIndex = 0; + else + m_nextConnectionIndex++; + } + else if (++m_nextConnectionIndex > maxIndex) + { + //went past end of vector, start back at 0 + m_nextConnectionIndex = 0; + } + } while (con == nullptr && m_nextConnectionIndex != startIndex); - GenericConnection *con = nullptr; + return con; + } - //loop until we find an active connection, or until we get back - // to where we started - do - { - if (m_serverConnections[m_nextConnectionIndex]->isConnected()) - { - con = m_serverConnections[m_nextConnectionIndex]; - if (m_nextConnectionIndex == maxIndex) - m_nextConnectionIndex = 0; - else - m_nextConnectionIndex++; - - } - else if (++m_nextConnectionIndex > maxIndex) - { - //went past end of vector, start back at 0 - m_nextConnectionIndex = 0; - } - }while (con == nullptr && m_nextConnectionIndex != startIndex); + //---------------------------------------- + void GenericAPICore::countOpenConnections() + //---------------------------------------- + { + m_currentConnections = 0; + m_maxConnections = m_serverConnections.size(); - return con; -} + for (std::vector::iterator conIter = m_serverConnections.begin(); conIter != m_serverConnections.end(); conIter++) + { + GenericConnection *con = *conIter; + if (con->isConnected()) + ++m_currentConnections; + } + } -//---------------------------------------- -void GenericAPICore::countOpenConnections() -//---------------------------------------- -{ - m_currentConnections = 0; - m_maxConnections = m_serverConnections.size(); - - for (std::vector::iterator conIter = m_serverConnections.begin(); conIter != m_serverConnections.end(); conIter++) - { - GenericConnection *con = *conIter; - if (con->isConnected()) - ++m_currentConnections; - } -} - -//---------------------------------------- -ServerTrackObject *GenericAPICore::findServer(unsigned server_track) -//---------------------------------------- -{ - std::map::iterator iter = m_serverTracks.find(server_track); - if (iter == m_serverTracks.end()) - return nullptr; - ServerTrackObject *stobj = (*iter).second; - m_serverTracks.erase(server_track); - return stobj; -} + //---------------------------------------- + ServerTrackObject *GenericAPICore::findServer(unsigned server_track) + //---------------------------------------- + { + std::map::iterator iter = m_serverTracks.find(server_track); + if (iter == m_serverTracks.end()) + return nullptr; + ServerTrackObject *stobj = (*iter).second; + m_serverTracks.erase(server_track); + return stobj; + } #ifdef EXTERNAL_DISTRO }; -#endif +#endif \ No newline at end of file diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericConnection.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericConnection.cpp index 11571d48..88aa786b 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericConnection.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericConnection.cpp @@ -15,187 +15,188 @@ #define GAME_RESOURCE 1 #ifdef EXTERNAL_DISTRO -namespace NAMESPACE +namespace NAMESPACE { #endif -using namespace std; -using namespace Base; + using namespace std; + using namespace Base; -GenericConnection::GenericConnection(const char *host, short port, GenericAPICore *apiCore, unsigned reconnectTimeout, unsigned noDataTimeoutSecs, unsigned, unsigned incomingBufSizeInKB, unsigned outgoingBufSizeInKB, unsigned keepAlive, unsigned maxRecvMessageSizeInKB) -: m_bConnected(CON_NONE), - m_apiCore(apiCore), - m_con(nullptr), - m_host(host), - m_port(port), - m_conState(CON_DISCONNECT), - m_reconnectTimeout(reconnectTimeout) -{ - TcpManager::TcpParams params; - - params.incomingBufferSize = incomingBufSizeInKB * 1024; - params.outgoingBufferSize = outgoingBufSizeInKB * 1024; - params.maxConnections = 1; - params.port = 0; - params.maxRecvMessageSize = maxRecvMessageSizeInKB*1024; - params.keepAliveDelay = keepAlive * 1000; - params.noDataTimeout = noDataTimeoutSecs * 1000; - //params.oldestUnacknowledgedTimeout = noAckTimeoutSecs * 1000; - - m_manager = new TcpManager(params); -} - -GenericConnection::~GenericConnection() -{ - if(m_con) + GenericConnection::GenericConnection(const char *host, short port, GenericAPICore *apiCore, unsigned reconnectTimeout, unsigned noDataTimeoutSecs, unsigned, unsigned incomingBufSizeInKB, unsigned outgoingBufSizeInKB, unsigned keepAlive, unsigned maxRecvMessageSizeInKB) + : m_bConnected(CON_NONE), + m_apiCore(apiCore), + m_con(nullptr), + m_host(host), + m_port(port), + m_conState(CON_DISCONNECT), + m_reconnectTimeout(reconnectTimeout), + m_conTimeout(0) { - m_con->SetHandler(nullptr); - m_con->Disconnect();//don't worry about onterminated being called, we've set it's handler to nullptr, so it wont - m_con->Release(); + TcpManager::TcpParams params; + + params.incomingBufferSize = incomingBufSizeInKB * 1024; + params.outgoingBufferSize = outgoingBufSizeInKB * 1024; + params.maxConnections = 1; + params.port = 0; + params.maxRecvMessageSize = maxRecvMessageSizeInKB * 1024; + params.keepAliveDelay = keepAlive * 1000; + params.noDataTimeout = noDataTimeoutSecs * 1000; + //params.oldestUnacknowledgedTimeout = noAckTimeoutSecs * 1000; + + m_manager = new TcpManager(params); } - m_manager->Release(); -} - -void GenericConnection::disconnect() -{ - if (m_con) + GenericConnection::~GenericConnection() { - m_con->Disconnect(); - //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); - m_con = nullptr; + if (m_con) + { + m_con->SetHandler(nullptr); + m_con->Disconnect();//don't worry about onterminated being called, we've set it's handler to nullptr, so it wont + m_con->Release(); + } + + m_manager->Release(); } - m_conState = CON_DISCONNECT; - m_bConnected = CON_NONE; -} -void GenericConnection::OnTerminated(TcpConnection *) -{ -// m_apiCore->OnDisconnect(m_host.c_str(), m_port); - m_apiCore->OnDisconnect(this); - if(m_con) + void GenericConnection::disconnect() { - m_con->Release(); - m_con = nullptr; + if (m_con) + { + m_con->Disconnect(); + //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); + m_con = nullptr; + } + m_conState = CON_DISCONNECT; + m_bConnected = CON_NONE; } - m_conState = CON_DISCONNECT; - m_bConnected = CON_NONE; -} -void GenericConnection::OnRoutePacket(TcpConnection *, const unsigned char *data, int dataLen) -{ - short type; - unsigned track; - - ByteStream msg(data, dataLen); - ByteStream::ReadIterator iter = msg.begin(); - - get(iter, type); - get(iter, track); - GenericResponse *res = nullptr; - - if(track == 0) // notification message from the server, not as a response to a request from this API + void GenericConnection::OnTerminated(TcpConnection *) { - if (type == ATGAME_REQUEST_CONNECT) - { // this is a special case, for when we have identified our game code to server - m_bConnected = CON_IDENTIFIED; - m_apiCore->OnConnect(this); + // m_apiCore->OnDisconnect(m_host.c_str(), m_port); + m_apiCore->OnDisconnect(this); + if (m_con) + { + m_con->Release(); + m_con = nullptr; + } + m_conState = CON_DISCONNECT; + m_bConnected = CON_NONE; + } + + void GenericConnection::OnRoutePacket(TcpConnection *, const unsigned char *data, int dataLen) + { + short type; + unsigned track; + + ByteStream msg(data, dataLen); + ByteStream::ReadIterator iter = msg.begin(); + + get(iter, type); + get(iter, track); + GenericResponse *res = nullptr; + + if (track == 0) // notification message from the server, not as a response to a request from this API + { + if (type == ATGAME_REQUEST_CONNECT) + { // this is a special case, for when we have identified our game code to server + m_bConnected = CON_IDENTIFIED; + m_apiCore->OnConnect(this); + } + else + { + m_apiCore->responseCallback(type, iter, this); + } } else { - m_apiCore->responseCallback(type, iter, this); + map::iterator mapIter = m_apiCore->m_pending.find(track); + + if (mapIter != m_apiCore->m_pending.end()) + { + res = (*mapIter).second; + iter = msg.begin(); + res->unpack(iter); + m_apiCore->responseCallback(res); + m_apiCore->m_pendingCount--; + m_apiCore->m_pending.erase(mapIter); + delete res; + } } } - else + + void GenericConnection::process() { - map::iterator mapIter = m_apiCore->m_pending.find(track); - - if(mapIter != m_apiCore->m_pending.end()) + switch (m_conState) { - res = (*mapIter).second; - iter = msg.begin(); - res->unpack(iter); - m_apiCore->responseCallback(res); - m_apiCore->m_pendingCount--; - m_apiCore->m_pending.erase(mapIter); - delete res; - } - } -} + case CON_DISCONNECT: + // create connection object, attempting to connect and + // checking for connection in next state, CON_NEGOTIATE + m_con = m_manager->EstablishConnection(m_host.c_str(), m_port); + if (m_con) + { + m_con->SetHandler(this); + m_conState = CON_NEGOTIATE; + m_conTimeout = time(nullptr) + m_reconnectTimeout; + } + break; + case CON_NEGOTIATE: + // check for connection -void GenericConnection::process() -{ - switch(m_conState) - { - case CON_DISCONNECT: - // create connection object, attempting to connect and - // checking for connection in next state, CON_NEGOTIATE - m_con = m_manager->EstablishConnection(m_host.c_str(), m_port); - if(m_con) - { - m_con->SetHandler(this); - m_conState = CON_NEGOTIATE; - m_conTimeout = time(nullptr) + m_reconnectTimeout; - } - break; - case CON_NEGOTIATE: - // check for connection + if (m_con->GetStatus() == TcpConnection::StatusConnected) + { + // we're connected + m_conState = CON_CONNECT; + m_bConnected = CON_CONNECTED; + // instead of calling OnConnect() right now, we are going to submit a connection packet + // identifying us + // m_apiCore->OnConnect(this); + Base::ByteStream msg; + put(msg, (short)REQUEST_SET_API); + put(msg, (unsigned)0); // track + put(msg, (unsigned)API_VERSION_CODE); + put(msg, GAME_RESOURCE); // identify us as a game connection resource - if(m_con->GetStatus() == TcpConnection::StatusConnected) - { - // we're connected - m_conState = CON_CONNECT; - m_bConnected = CON_CONNECTED; - // instead of calling OnConnect() right now, we are going to submit a connection packet - // identifying us -// m_apiCore->OnConnect(this); - Base::ByteStream msg; - put(msg, (short)REQUEST_SET_API); - put(msg, (unsigned)0); // track - put(msg, (unsigned)API_VERSION_CODE); - put(msg, GAME_RESOURCE); // identify us as a game connection resource - - // now add in the game identifiers - put(msg, (unsigned)m_apiCore->m_gameIdentifiers.size()); // number of strings to read - for(unsigned index = 0; index < m_apiCore->m_gameIdentifiers.size(); index++) - put(msg, std::string(m_apiCore->m_gameIdentifiers[index])); - Send(msg); - } - else if(time(nullptr) > m_conTimeout) - { - // we did not connect - m_con->Disconnect(); - //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); - m_con = nullptr; + // now add in the game identifiers + put(msg, (unsigned)m_apiCore->m_gameIdentifiers.size()); // number of strings to read + for (unsigned index = 0; index < m_apiCore->m_gameIdentifiers.size(); index++) + put(msg, std::string(m_apiCore->m_gameIdentifiers[index])); + Send(msg); + } + else if (time(nullptr) > m_conTimeout) + { + // we did not connect + m_con->Disconnect(); + //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); + m_con = nullptr; + m_conState = CON_DISCONNECT; + m_bConnected = CON_NONE; + } + break; + case CON_CONNECT: + // do nothing + break; + default: + // this should not occur, but we revert to CON_DISCONNECT if it does m_conState = CON_DISCONNECT; - m_bConnected = CON_NONE; - } - break; - case CON_CONNECT: - // do nothing - break; - default: - // this should not occur, but we revert to CON_DISCONNECT if it does - m_conState = CON_DISCONNECT; - m_bConnected = CON_NONE; - if (m_con) - { - m_con->Disconnect(); - //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); - m_con = nullptr; + m_bConnected = CON_NONE; + if (m_con) + { + m_con->Disconnect(); + //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); + m_con = nullptr; + } } + m_manager->GiveTime(); } - m_manager->GiveTime(); -} -void GenericConnection::Send(Base::ByteStream &msg) -{ - if(m_con && m_con->GetStatus() == TcpConnection::StatusConnected) + void GenericConnection::Send(Base::ByteStream &msg) { - m_con->Send((const char *)msg.getBuffer(), msg.getSize()); + if (m_con && m_con->GetStatus() == TcpConnection::StatusConnected) + { + m_con->Send((const char *)msg.getBuffer(), msg.getSize()); + } } -} #ifdef EXTERNAL_DISTRO }; -#endif +#endif \ No newline at end of file diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericMessage.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericMessage.cpp index c01729d8..e97312fd 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericMessage.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericMessage.cpp @@ -9,36 +9,35 @@ //---------------------------------------- #ifdef EXTERNAL_DISTRO -namespace NAMESPACE +namespace NAMESPACE { - #endif -using namespace Base; + using namespace Base; -//------------------------------------------- -GenericRequest::GenericRequest(short type, unsigned server_track) -: m_type(type), m_server_track(server_track) -//------------------------------------------- -{ -} + //------------------------------------------- + GenericRequest::GenericRequest(short type, unsigned server_track) + : m_type(type), m_server_track(server_track), m_track(0), m_timeout(0) + //------------------------------------------- + { + } -//------------------------------------------- -GenericResponse::GenericResponse(short type, unsigned result, void *user) -: m_type(type), m_result(result), m_user(user) -//------------------------------------------- -{ -} + //------------------------------------------- + GenericResponse::GenericResponse(short type, unsigned result, void *user) + : m_type(type), m_result(result), m_user(user), m_track(0), m_timeout(0) + //------------------------------------------- + { + } -//----------------------------------------- -void GenericResponse::unpack(ByteStream::ReadIterator &iter) -//----------------------------------------- -{ - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); -} + //----------------------------------------- + void GenericResponse::unpack(ByteStream::ReadIterator &iter) + //----------------------------------------- + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + } #ifdef EXTERNAL_DISTRO }; -#endif +#endif \ No newline at end of file diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpManager.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpManager.cpp index 7c00d9f6..7202f4a3 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpManager.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpManager.cpp @@ -4,743 +4,719 @@ #include "TcpConnection.h" #ifndef WIN32 - #include +#include #endif - #ifdef EXTERNAL_DISTRO -namespace NAMESPACE +namespace NAMESPACE { #endif -TcpManager::TcpParams::TcpParams() -: port(0), - maxConnections(10), - incomingBufferSize(64*1024), - outgoingBufferSize(64*1024), - allocatorBlockSize(8*1024), - allocatorBlockCount(16), - maxRecvMessageSize(0), - keepAliveDelay(0), - noDataTimeout(0) -{ - memset(bindAddress, 0, sizeof(bindAddress)); -} + TcpManager::TcpParams::TcpParams() + : port(0), + maxConnections(10), + incomingBufferSize(64 * 1024), + outgoingBufferSize(64 * 1024), + allocatorBlockSize(8 * 1024), + allocatorBlockCount(16), + maxRecvMessageSize(0), + keepAliveDelay(0), + noDataTimeout(0) + { + memset(bindAddress, 0, sizeof(bindAddress)); + } -TcpManager::TcpParams::TcpParams(const TcpParams &cpy) -: port(cpy.port), - maxConnections(cpy.maxConnections), - incomingBufferSize(cpy.incomingBufferSize), - outgoingBufferSize(cpy.outgoingBufferSize), - allocatorBlockSize(cpy.allocatorBlockSize), - allocatorBlockCount(cpy.allocatorBlockCount), - maxRecvMessageSize(cpy.maxRecvMessageSize), - keepAliveDelay(cpy.keepAliveDelay), - noDataTimeout(cpy.noDataTimeout) -{ -} + TcpManager::TcpParams::TcpParams(const TcpParams &cpy) + : port(cpy.port), + maxConnections(cpy.maxConnections), + incomingBufferSize(cpy.incomingBufferSize), + outgoingBufferSize(cpy.outgoingBufferSize), + allocatorBlockSize(cpy.allocatorBlockSize), + allocatorBlockCount(cpy.allocatorBlockCount), + maxRecvMessageSize(cpy.maxRecvMessageSize), + keepAliveDelay(cpy.keepAliveDelay), + noDataTimeout(cpy.noDataTimeout) + { + } -TcpManager::TcpManager(const TcpParams ¶ms) -: m_handler(nullptr), - m_keepAliveList(nullptr, 1), - m_aliveList(nullptr, 2), - m_noDataList(nullptr, 1), - m_dataList(nullptr, 2), - m_params(params), - m_refCount(1), - m_connectionList(nullptr), - m_connectionListCount(0), - m_socket(INVALID_SOCKET), - m_boundAsServer(false), - m_allocator(params.allocatorBlockSize, params.allocatorBlockCount), - m_keepAliveTimer(), - m_noDataTimer() -{ - if (params.keepAliveDelay > 0) - m_keepAliveTimer.start(); + TcpManager::TcpManager(const TcpParams ¶ms) + : m_handler(nullptr), + m_keepAliveList(nullptr, 1), + m_aliveList(nullptr, 2), + m_noDataList(nullptr, 1), + m_dataList(nullptr, 2), + m_params(params), + m_refCount(1), + m_connectionList(nullptr), + m_connectionListCount(0), + m_socket(INVALID_SOCKET), + m_boundAsServer(false), + m_allocator(params.allocatorBlockSize, params.allocatorBlockCount), + m_keepAliveTimer(), + m_noDataTimer() +#if defined(WIN32) + , m_permfds() +#endif + { + if (params.keepAliveDelay > 0) + m_keepAliveTimer.start(); - if (params.noDataTimeout > 0) - m_noDataTimer.start(); + if (params.noDataTimeout > 0) + m_noDataTimer.start(); #if defined(WIN32) - WSADATA wsaData; - WSAStartup(MAKEWORD(1,1), &wsaData); + WSADATA wsaData; + WSAStartup(MAKEWORD(1, 1), &wsaData); - FD_ZERO(&m_permfds);//select only used on win32 + FD_ZERO(&m_permfds);//select only used on win32 +#endif + } + + TcpManager::~TcpManager() + { +#if defined(WIN32) + WSACleanup(); #endif -} - - -TcpManager::~TcpManager() -{ + if (m_boundAsServer) + { #if defined(WIN32) - WSACleanup(); -#endif - - if (m_boundAsServer) - { -#if defined(WIN32) - closesocket(m_socket); + closesocket(m_socket); #else - close(m_socket); + close(m_socket); #endif - } - while (m_connectionList != nullptr) - { - TcpConnection *con = m_connectionList; - m_connectionList = m_connectionList->m_nextConnection; - con->Release(); - m_connectionListCount--; - } -} + } + while (m_connectionList != nullptr) + { + TcpConnection *con = m_connectionList; + m_connectionList = m_connectionList->m_nextConnection; + con->Release(); + m_connectionListCount--; + } + } + bool TcpManager::BindAsServer() + { + m_socket = socket(AF_INET, SOCK_STREAM, 0); -bool TcpManager::BindAsServer() -{ - - m_socket = socket(AF_INET, SOCK_STREAM, 0); - - if (m_socket != INVALID_SOCKET) - { + if (m_socket != INVALID_SOCKET) + { #if defined(WIN32) #pragma warning(push) #pragma warning(disable : 4127) - FD_SET(m_socket, &m_permfds);//the socket this server is listening on + FD_SET(m_socket, &m_permfds);//the socket this server is listening on #pragma warning(pop) - unsigned long isNonBlocking = 1; - int outBufSize = m_params.outgoingBufferSize; - int inBufSize = m_params.incomingBufferSize; - int keepAlive = 1; - int reuseAddr = 1; - struct linger ld; - ld.l_onoff = 0; - ld.l_linger = 0; + unsigned long isNonBlocking = 1; + int outBufSize = m_params.outgoingBufferSize; + int inBufSize = m_params.incomingBufferSize; + int keepAlive = 1; + int reuseAddr = 1; + struct linger ld; + ld.l_onoff = 0; + ld.l_linger = 0; - if (ioctlsocket(m_socket, FIONBIO, &isNonBlocking) != 0 - || setsockopt(m_socket, SOL_SOCKET, SO_SNDBUF, (char *)&outBufSize, sizeof(outBufSize)) != 0 - || setsockopt(m_socket, SOL_SOCKET, SO_RCVBUF, (char *)&inBufSize, sizeof(inBufSize)) != 0 - || setsockopt(m_socket, SOL_SOCKET, SO_KEEPALIVE, (char *)&keepAlive, sizeof(keepAlive)) != 0 - || setsockopt(m_socket, SOL_SOCKET, SO_REUSEADDR, (char *)&reuseAddr, sizeof(reuseAddr)) != 0 - || setsockopt(m_socket, SOL_SOCKET, SO_LINGER, (char *)&ld, sizeof(ld)) != 0 ) - { - return false; - } + if (ioctlsocket(m_socket, FIONBIO, &isNonBlocking) != 0 + || setsockopt(m_socket, SOL_SOCKET, SO_SNDBUF, (char *)&outBufSize, sizeof(outBufSize)) != 0 + || setsockopt(m_socket, SOL_SOCKET, SO_RCVBUF, (char *)&inBufSize, sizeof(inBufSize)) != 0 + || setsockopt(m_socket, SOL_SOCKET, SO_KEEPALIVE, (char *)&keepAlive, sizeof(keepAlive)) != 0 + || setsockopt(m_socket, SOL_SOCKET, SO_REUSEADDR, (char *)&reuseAddr, sizeof(reuseAddr)) != 0 + || setsockopt(m_socket, SOL_SOCKET, SO_LINGER, (char *)&ld, sizeof(ld)) != 0) + { + return false; + } #else // linux is to remain the default compile mode - unsigned long isNonBlocking = 1; - unsigned long keepAlive = 1; - unsigned long outBufSize = m_params.outgoingBufferSize; - unsigned long inBufSize = m_params.incomingBufferSize; - unsigned long reuseAddr = 1; - struct linger ld; - ld.l_onoff = 0; - ld.l_linger = 0; + unsigned long isNonBlocking = 1; + unsigned long keepAlive = 1; + unsigned long outBufSize = m_params.outgoingBufferSize; + unsigned long inBufSize = m_params.incomingBufferSize; + unsigned long reuseAddr = 1; + struct linger ld; + ld.l_onoff = 0; + ld.l_linger = 0; - if (ioctl(m_socket, FIONBIO, &isNonBlocking) != 0 - || setsockopt(m_socket, SOL_SOCKET, SO_SNDBUF, &outBufSize, sizeof(outBufSize)) != 0 - || setsockopt(m_socket, SOL_SOCKET, SO_RCVBUF, &inBufSize, sizeof(inBufSize)) != 0 - || setsockopt(m_socket, SOL_SOCKET, SO_KEEPALIVE, &keepAlive, sizeof(keepAlive)) != 0 - || setsockopt(m_socket, SOL_SOCKET, SO_REUSEADDR, &reuseAddr, sizeof(reuseAddr)) != 0 - || setsockopt(m_socket, SOL_SOCKET, SO_LINGER, &ld, sizeof(ld)) != 0) - { - return false; - } + if (ioctl(m_socket, FIONBIO, &isNonBlocking) != 0 + || setsockopt(m_socket, SOL_SOCKET, SO_SNDBUF, &outBufSize, sizeof(outBufSize)) != 0 + || setsockopt(m_socket, SOL_SOCKET, SO_RCVBUF, &inBufSize, sizeof(inBufSize)) != 0 + || setsockopt(m_socket, SOL_SOCKET, SO_KEEPALIVE, &keepAlive, sizeof(keepAlive)) != 0 + || setsockopt(m_socket, SOL_SOCKET, SO_REUSEADDR, &reuseAddr, sizeof(reuseAddr)) != 0 + || setsockopt(m_socket, SOL_SOCKET, SO_LINGER, &ld, sizeof(ld)) != 0) + { + return false; + } #endif - } - else - { - return false; - } + } + else + { + return false; + } + struct sockaddr_in addr_loc; + addr_loc.sin_family = AF_INET; + addr_loc.sin_port = htons(m_params.port); + addr_loc.sin_addr.s_addr = htonl(INADDR_ANY); + if (m_params.bindAddress[0] != 0) + { + unsigned long address = inet_addr(m_params.bindAddress); + if (address == INADDR_NONE) + { + struct hostent * lphp; + lphp = gethostbyname(m_params.bindAddress); + if (lphp != nullptr) + addr_loc.sin_addr.s_addr = ((struct in_addr *)(lphp->h_addr))->s_addr; + } + else + { + addr_loc.sin_addr.s_addr = address; + } + } - struct sockaddr_in addr_loc; - addr_loc.sin_family = AF_INET; - addr_loc.sin_port = htons(m_params.port); - addr_loc.sin_addr.s_addr = htonl(INADDR_ANY); - if (m_params.bindAddress[0] != 0) - { - unsigned long address = inet_addr(m_params.bindAddress); - if (address == INADDR_NONE) - { - struct hostent * lphp; - lphp = gethostbyname(m_params.bindAddress); - if (lphp != nullptr) - addr_loc.sin_addr.s_addr = ((struct in_addr *)(lphp->h_addr))->s_addr; - } - else - { - addr_loc.sin_addr.s_addr = address; - } - } + if (bind(m_socket, (struct sockaddr *)&addr_loc, sizeof(addr_loc)) != 0) + { + return false; + } - if (bind(m_socket, (struct sockaddr *)&addr_loc, sizeof(addr_loc)) != 0) - { - return false; - } + if (listen(m_socket, 1000) != 0) + { + return false; + } - if (listen(m_socket, 1000) != 0) - { - return false; - } + m_boundAsServer = true; + return true; + } - m_boundAsServer = true; - return true; -} + TcpConnection *TcpManager::acceptClient() + { + TcpConnection *newConn = nullptr; -TcpConnection *TcpManager::acceptClient() -{ - TcpConnection *newConn = nullptr; - - if (m_boundAsServer && m_connectionListCount < m_params.maxConnections) - { + if (m_boundAsServer && m_connectionListCount < m_params.maxConnections) + { + sockaddr_in addr; + int addrLength = sizeof(addr); + SOCKET sock = ::accept(m_socket, (sockaddr *)&addr, (socklen_t *)&addrLength); - sockaddr_in addr; - int addrLength = sizeof(addr); - SOCKET sock = ::accept(m_socket, (sockaddr *) &addr, (socklen_t *) &addrLength); + if (sock != INVALID_SOCKET) + { + newConn = new TcpConnection(this, &m_allocator, m_params, sock, IPAddress(addr.sin_addr.s_addr), ntohs(addr.sin_port)); + addNewConnection(newConn); + if (m_handler != nullptr) + { + m_handler->OnConnectRequest(newConn); + } + } + } + return newConn; + } - if (sock != INVALID_SOCKET) - { - newConn = new TcpConnection(this, &m_allocator, m_params, sock, IPAddress(addr.sin_addr.s_addr), ntohs(addr.sin_port)); - addNewConnection(newConn); - if (m_handler != nullptr) - { - m_handler->OnConnectRequest(newConn); - } - } - } + void TcpManager::SetHandler(TcpManagerHandler *handler) + { + m_handler = handler; + } - return newConn; -} - -void TcpManager::SetHandler(TcpManagerHandler *handler) -{ - m_handler = handler; -} - -SOCKET TcpManager::getMaxFD() -{ + SOCKET TcpManager::getMaxFD() + { #ifdef WIN32 - return 0;//this param is not used on win32 for select, only on unix + return 0;//this param is not used on win32 for select, only on unix #else - SOCKET maxfd = 0; - - if (m_boundAsServer) - maxfd = m_socket+1; - - TcpConnection *next = nullptr; - for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) - { - next = con->m_nextConnection; - if (con->GetStatus() != TcpConnection::StatusDisconnected && con->m_socket > maxfd) - { - maxfd = con->m_socket + 1; - } - } - return maxfd; + SOCKET maxfd = 0; + + if (m_boundAsServer) + maxfd = m_socket + 1; + + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList; con != nullptr; con = next) + { + next = con->m_nextConnection; + if (con->GetStatus() != TcpConnection::StatusDisconnected && con->m_socket > maxfd) + { + maxfd = con->m_socket + 1; + } + } + return maxfd; #endif -} + } -TcpConnection *TcpManager::getConnection(SOCKET fd) -{ - TcpConnection *next = nullptr; - for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) - { - next = con->m_nextConnection; - if (con->m_socket == fd) - { - return con; - } - } - //if get here ,couldn't find it - return nullptr; -} + TcpConnection *TcpManager::getConnection(SOCKET fd) + { + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList; con != nullptr; con = next) + { + next = con->m_nextConnection; + if (con->m_socket == fd) + { + return con; + } + } + //if get here ,couldn't find it + return nullptr; + } -bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendTimePerConnection, unsigned maxRecvTimePerConnection) -{ - bool processedIncoming = false; + bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections, unsigned maxSendTimePerConnection, unsigned maxRecvTimePerConnection) + { + bool processedIncoming = false; - if (maxTimeAcceptingConnections == 0 && maxSendTimePerConnection==0 && maxRecvTimePerConnection==0) - { - //they don't want to do anything now - return processedIncoming; - } + if (maxTimeAcceptingConnections == 0 && maxSendTimePerConnection == 0 && maxRecvTimePerConnection == 0) + { + //they don't want to do anything now + return processedIncoming; + } - AddRef(); //keep a reference to ourself in case we callback to the application and the application releases us. + AddRef(); //keep a reference to ourself in case we callback to the application and the application releases us. + //first process outgoing on each connection, and finish establishing connections, if params say to + if (m_connectionListCount != 0 && maxSendTimePerConnection != 0) + { + // Send output from last heartbeat + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList; con != nullptr; con = next) + { + con->AddRef(); + if (next) next->Release(); + next = con->m_nextConnection; + if (next) next->AddRef(); + if (con->GetStatus() == TcpConnection::StatusConnected) + { + Clock timer; + timer.start(); + while (!timer.isDone(maxSendTimePerConnection)) + { + int err = con->processOutgoing(); - - //first process outgoing on each connection, and finish establishing connections, if params say to - if (m_connectionListCount != 0 && maxSendTimePerConnection != 0) - { - - // Send output from last heartbeat - TcpConnection *next = nullptr; - for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) - { - con->AddRef(); - if (next) next->Release(); - next = con->m_nextConnection; - if (next) next->AddRef(); - if(con->GetStatus() == TcpConnection::StatusConnected) - { - Clock timer; - timer.start(); - while(!timer.isDone(maxSendTimePerConnection)) - { - int err = con->processOutgoing(); - - if (err > 0) - { - //couldn't finish processing last request, don't try more - break; - } - else if (err < 0) - { - break; - } - } - con->Release(); - } - else if (con->GetStatus() == TcpConnection::StatusNegotiating) - { - if (con->finishConnect() < 0) - { + if (err > 0) + { + //couldn't finish processing last request, don't try more + break; + } + else if (err < 0) + { + break; + } + } con->Release(); - continue; - } - con->Release(); - } - else //inactive client in client list???? - { - removeConnection(con); - con->Release(); - continue; - } - } - - } - - //process incoming messages (including connect requests) - if (( - m_boundAsServer //if in server mode and want to spend time accepting clients - && maxTimeAcceptingConnections != 0 - ) - || - ( - m_connectionListCount != 0 //if there are connections and want to spend time receiving on them - && maxRecvTimePerConnection != 0 - ) - ) - { -#ifdef WIN32 - SOCKET maxfd = getMaxFD(); //re-calc maxfd every time select on WIN32 - - //select on all fd's - struct timeval timeout; - - fd_set tmpfds; - tmpfds = m_permfds; - timeout.tv_sec = 0; - timeout.tv_usec = 0; - int cnt = select(maxfd, &tmpfds, nullptr, nullptr, &timeout); // blocks for timeout - - - if (cnt > 0) - { - if (m_boundAsServer && maxTimeAcceptingConnections != 0) - {//activity on our socket means connect requests - - //see if are new incoming clients - if (FD_ISSET(m_socket, &tmpfds)) - { - //yep - Clock timer; - timer.start(); - while (acceptClient() && !timer.isDone(maxTimeAcceptingConnections)) - { - //loop - } - } - } - - - - //process incoming client messages - if (maxRecvTimePerConnection != 0) - { - TcpConnection *next = nullptr; - for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) - { - con->AddRef(); - if (next) next->Release(); - next = con->m_nextConnection; - if (next) next->AddRef(); - - SOCKET fd = con->m_socket; - if (fd == INVALID_SOCKET) - { - //invalid socket in list?, check if is connecting, otherwise, Disconnect and discard - if (con->GetStatus() != TcpConnection::StatusNegotiating) - { - removeConnection(con); - con->Release(); - continue; - } - } - - if (FD_ISSET(fd, &tmpfds)) - { - Clock timer; - timer.start(); - while(!timer.isDone(maxRecvTimePerConnection) && con->GetStatus() == TcpConnection::StatusConnected) - { - int err = con->processIncoming(); - if (err >= 0) - { - processedIncoming = true; - } - - if (err > 0) - { - //couldn't finish processing last request, don't try more - break; - } - else if (err < 0) - { - break; - } - - }//while(!timer...) - }//if (FD_ISSET...) + } + else if (con->GetStatus() == TcpConnection::StatusNegotiating) + { + if (con->finishConnect() < 0) + { + con->Release(); + continue; + } con->Release(); - }//for (...) - } //maxRecvTimePerConnection != 0 - }//cnt > 0 + } + else //inactive client in client list???? + { + removeConnection(con); + con->Release(); + continue; + } + } + } + + //process incoming messages (including connect requests) + if (( + m_boundAsServer //if in server mode and want to spend time accepting clients + && maxTimeAcceptingConnections != 0 + ) + || + ( + m_connectionListCount != 0 //if there are connections and want to spend time receiving on them + && maxRecvTimePerConnection != 0 + ) + ) + { +#ifdef WIN32 + SOCKET maxfd = getMaxFD(); //re-calc maxfd every time select on WIN32 + + //select on all fd's + struct timeval timeout; + + fd_set tmpfds; + tmpfds = m_permfds; + timeout.tv_sec = 0; + timeout.tv_usec = 0; + int cnt = select(maxfd, &tmpfds, nullptr, nullptr, &timeout); // blocks for timeout + + if (cnt > 0) + { + if (m_boundAsServer && maxTimeAcceptingConnections != 0) + {//activity on our socket means connect requests + //see if are new incoming clients + if (FD_ISSET(m_socket, &tmpfds)) + { + //yep + Clock timer; + timer.start(); + while (acceptClient() && !timer.isDone(maxTimeAcceptingConnections)) + { + //loop + } + } + } + + //process incoming client messages + if (maxRecvTimePerConnection != 0) + { + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList; con != nullptr; con = next) + { + con->AddRef(); + if (next) next->Release(); + next = con->m_nextConnection; + if (next) next->AddRef(); + + SOCKET fd = con->m_socket; + if (fd == INVALID_SOCKET) + { + //invalid socket in list?, check if is connecting, otherwise, Disconnect and discard + if (con->GetStatus() != TcpConnection::StatusNegotiating) + { + removeConnection(con); + con->Release(); + continue; + } + } + + if (FD_ISSET(fd, &tmpfds)) + { + Clock timer; + timer.start(); + while (!timer.isDone(maxRecvTimePerConnection) && con->GetStatus() == TcpConnection::StatusConnected) + { + int err = con->processIncoming(); + if (err >= 0) + { + processedIncoming = true; + } + + if (err > 0) + { + //couldn't finish processing last request, don't try more + break; + } + else if (err < 0) + { + break; + } + }//while(!timer...) + }//if (FD_ISSET...) + con->Release(); + }//for (...) + } //maxRecvTimePerConnection != 0 + }//cnt > 0 #else //on UNIX use poll - int numfds = m_connectionListCount; - int idx = 0; - if (m_boundAsServer) - { - numfds++; - idx++; - } + int numfds = m_connectionListCount; + int idx = 0; + if (m_boundAsServer) + { + numfds++; + idx++; + } - struct pollfd pollfds[numfds]; + struct pollfd pollfds[numfds]; - if (m_boundAsServer) - { - pollfds[0].fd = m_socket; - pollfds[0].events |= POLLIN; - } + if (m_boundAsServer) + { + pollfds[0].fd = m_socket; + pollfds[0].events |= POLLIN; + } - TcpConnection *next = nullptr; - for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next, idx++) - { - next = con->m_nextConnection; - pollfds[idx].fd = con->m_socket; - pollfds[idx].events |= POLLIN; - pollfds[idx].events |= POLLHUP; - } - + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList; con != nullptr; con = next, idx++) + { + next = con->m_nextConnection; + pollfds[idx].fd = con->m_socket; + pollfds[idx].events |= POLLIN; + pollfds[idx].events |= POLLHUP; + } - int cnt = poll(pollfds, numfds, 1); + int cnt = poll(pollfds, numfds, 1); - if(cnt == SOCKET_ERROR) - { - //poll not working? - //TODO: need to notify client somehow, don't think we can assume a fatal error here - } - else if (cnt > 0) - { - for (idx = 0; idx < numfds; idx++) - { - //find corresponding TcpConnection - //TODO: optimize, seriously, this is takes linear time, every time - TcpConnection *con = getConnection(pollfds[idx].fd); + if (cnt == SOCKET_ERROR) + { + //poll not working? + //TODO: need to notify client somehow, don't think we can assume a fatal error here + } + else if (cnt > 0) + { + for (idx = 0; idx < numfds; idx++) + { + //find corresponding TcpConnection + //TODO: optimize, seriously, this is takes linear time, every time + TcpConnection *con = getConnection(pollfds[idx].fd); - if (pollfds[idx].revents & POLLIN) - { - if (m_boundAsServer && maxTimeAcceptingConnections != 0 && pollfds[idx].fd == m_socket) - { - //new incoming clients - Clock timer; - timer.start(); - while (acceptClient() && !timer.isDone(maxTimeAcceptingConnections)) - { - //loop - } + if (pollfds[idx].revents & POLLIN) + { + if (m_boundAsServer && maxTimeAcceptingConnections != 0 && pollfds[idx].fd == m_socket) + { + //new incoming clients + Clock timer; + timer.start(); + while (acceptClient() && !timer.isDone(maxTimeAcceptingConnections)) + { + //loop + } - continue;//don't try to readmsgs from listening fd - } - - //process regular msg(s) - if (con == nullptr) - { - close(pollfds[idx].fd); - continue; - } + continue;//don't try to readmsgs from listening fd + } - Clock timer; - timer.start(); - con->AddRef();//so it can't get deleted while we are checking it's status - while(!timer.isDone(maxRecvTimePerConnection) && con->GetStatus() == TcpConnection::StatusConnected) - { - int err = con->processIncoming(); - if (err >= 0) - { - processedIncoming = true; - } + //process regular msg(s) + if (con == nullptr) + { + close(pollfds[idx].fd); + continue; + } - if (err > 0) - { - //couldn't finish processing last request, don't try more - break; - } - else if (err < 0) - { - break; - } + Clock timer; + timer.start(); + con->AddRef();//so it can't get deleted while we are checking it's status + while (!timer.isDone(maxRecvTimePerConnection) && con->GetStatus() == TcpConnection::StatusConnected) + { + int err = con->processIncoming(); + if (err >= 0) + { + processedIncoming = true; + } - }//while(!timer....) - con->Release(); - }//if(pollfds[... - else if (pollfds[idx].revents & POLLHUP) - { - if (con == nullptr) - { - close(pollfds[idx].fd); - continue; - } + if (err > 0) + { + //couldn't finish processing last request, don't try more + break; + } + else if (err < 0) + { + break; + } + }//while(!timer....) + con->Release(); + }//if(pollfds[... + else if (pollfds[idx].revents & POLLHUP) + { + if (con == nullptr) + { + close(pollfds[idx].fd); + continue; + } - //Disconnect client - con->Disconnect(); - } - }//for (idx=0.... - }//else if (cnt > 0) + //Disconnect client + con->Disconnect(); + } + }//for (idx=0.... + }//else if (cnt > 0) #endif - }//wanted to process incoming messages or connect requests + }//wanted to process incoming messages or connect requests - //now process any keepalives, if time to do that - if (m_params.keepAliveDelay > 0 && m_keepAliveTimer.isDone(m_params.keepAliveDelay)) - { - TcpConnection *next = nullptr; - for (TcpConnection *con = m_keepAliveList.m_beginList ; con != nullptr ; con = next) - { - con->AddRef(); - if (next) next->Release(); - next = con->m_nextKeepAliveConnection; - if (next) next->AddRef(); - - con->Send(nullptr, 0); //note: this request will move the connection from the keepAliveList to the aliveList - con->Release(); - } + //now process any keepalives, if time to do that + if (m_params.keepAliveDelay > 0 && m_keepAliveTimer.isDone(m_params.keepAliveDelay)) + { + TcpConnection *next = nullptr; + for (TcpConnection *con = m_keepAliveList.m_beginList; con != nullptr; con = next) + { + con->AddRef(); + if (next) next->Release(); + next = con->m_nextKeepAliveConnection; + if (next) next->AddRef(); - //now move the complete alive list over to the keepalive list to reset those timers - m_keepAliveList.m_beginList = m_aliveList.m_beginList; - m_aliveList.m_beginList = nullptr; + con->Send(nullptr, 0); //note: this request will move the connection from the keepAliveList to the aliveList + con->Release(); + } - //switch id's for those connections that were in the alive list last go - around - int tmpID = m_aliveList.m_listID; - m_aliveList.m_listID = m_keepAliveList.m_listID; - m_keepAliveList.m_listID = tmpID; + //now move the complete alive list over to the keepalive list to reset those timers + m_keepAliveList.m_beginList = m_aliveList.m_beginList; + m_aliveList.m_beginList = nullptr; - m_keepAliveTimer.reset(); - m_keepAliveTimer.start(); - } + //switch id's for those connections that were in the alive list last go - around + int tmpID = m_aliveList.m_listID; + m_aliveList.m_listID = m_keepAliveList.m_listID; + m_keepAliveList.m_listID = tmpID; - //now process any noDataCons, if time to do that - if (m_params.noDataTimeout > 0 && m_noDataTimer.isDone(m_params.noDataTimeout)) - { - TcpConnection *next = nullptr; - for (TcpConnection *con = m_noDataList.m_beginList ; con != nullptr ; con = next) - { - con->AddRef(); - if (next) next->Release(); - next = con->m_nextRecvDataConnection; - if (next) next->AddRef(); + m_keepAliveTimer.reset(); + m_keepAliveTimer.start(); + } - //time to disconnect this guy - con->Disconnect(); - con->Release(); - } + //now process any noDataCons, if time to do that + if (m_params.noDataTimeout > 0 && m_noDataTimer.isDone(m_params.noDataTimeout)) + { + TcpConnection *next = nullptr; + for (TcpConnection *con = m_noDataList.m_beginList; con != nullptr; con = next) + { + con->AddRef(); + if (next) next->Release(); + next = con->m_nextRecvDataConnection; + if (next) next->AddRef(); - //now move the complete data list over to the nodata list to reset those timers - m_noDataList.m_beginList = m_dataList.m_beginList; - m_dataList.m_beginList = nullptr; + //time to disconnect this guy + con->Disconnect(); + con->Release(); + } - //switch id's for those connections that were in the data list last go - around - int tmpID = m_dataList.m_listID; - m_dataList.m_listID = m_noDataList.m_listID; - m_noDataList.m_listID = tmpID; + //now move the complete data list over to the nodata list to reset those timers + m_noDataList.m_beginList = m_dataList.m_beginList; + m_dataList.m_beginList = nullptr; - m_noDataTimer.reset(); - m_noDataTimer.start(); - } + //switch id's for those connections that were in the data list last go - around + int tmpID = m_dataList.m_listID; + m_dataList.m_listID = m_noDataList.m_listID; + m_noDataList.m_listID = tmpID; - Release(); + m_noDataTimer.reset(); + m_noDataTimer.start(); + } - return processedIncoming; -} + Release(); -TcpConnection *TcpManager::EstablishConnection(const char *serverAddress, unsigned short serverPort, unsigned timeout) -{ - if (m_boundAsServer) - { - //can't open outgoing connections when in server mode - // use a different TcpManager to do that - return nullptr; - } + return processedIncoming; + } - if (m_connectionListCount >= m_params.maxConnections) - return(nullptr); + TcpConnection *TcpManager::EstablishConnection(const char *serverAddress, unsigned short serverPort, unsigned timeout) + { + if (m_boundAsServer) + { + //can't open outgoing connections when in server mode + // use a different TcpManager to do that + return nullptr; + } - // get server address - unsigned long address = inet_addr(serverAddress); - if (address == INADDR_NONE) - { - struct hostent * lphp; - lphp = gethostbyname(serverAddress); - if (lphp == nullptr) - return(nullptr); - address = ((struct in_addr *)(lphp->h_addr))->s_addr; - } - IPAddress destIP(address); + if (m_connectionListCount >= m_params.maxConnections) + return(nullptr); - TcpConnection *con = new TcpConnection(this, &m_allocator, m_params, destIP, serverPort, timeout); - con->AddRef();//for the client - to conform to UdpLibrary method - addNewConnection(con); + // get server address + unsigned long address = inet_addr(serverAddress); + if (address == INADDR_NONE) + { + struct hostent * lphp; + lphp = gethostbyname(serverAddress); + if (lphp == nullptr) + return(nullptr); + address = ((struct in_addr *)(lphp->h_addr))->s_addr; + } + IPAddress destIP(address); - return con; -} + TcpConnection *con = new TcpConnection(this, &m_allocator, m_params, destIP, serverPort, timeout); + con->AddRef();//for the client - to conform to UdpLibrary method + addNewConnection(con); -void TcpManager::addNewConnection(TcpConnection *con) -{ - con->AddRef(); + return con; + } + + void TcpManager::addNewConnection(TcpConnection *con) + { + con->AddRef(); #ifdef WIN32 //uses select - if (con->m_socket != INVALID_SOCKET) - { + if (con->m_socket != INVALID_SOCKET) + { #pragma warning(push) #pragma warning(disable : 4127) - FD_SET(con->m_socket, &m_permfds); + FD_SET(con->m_socket, &m_permfds); #pragma warning(pop) - } + } #endif - con->m_nextConnection = m_connectionList; - con->m_prevConnection = nullptr; - if (m_connectionList != nullptr) - m_connectionList->m_prevConnection = con; - m_connectionList = con; - m_connectionListCount++; + con->m_nextConnection = m_connectionList; + con->m_prevConnection = nullptr; + if (m_connectionList != nullptr) + m_connectionList->m_prevConnection = con; + m_connectionList = con; + m_connectionListCount++; - con->m_nextKeepAliveConnection = m_aliveList.m_beginList; - con->m_prevKeepAliveConnection = nullptr; - if (m_aliveList.m_beginList != nullptr) - m_aliveList.m_beginList->m_prevKeepAliveConnection = con; - m_aliveList.m_beginList = con; - con->m_aliveListId = m_keepAliveList.m_listID;//start it out thinking it's already in the alive list, since it is + con->m_nextKeepAliveConnection = m_aliveList.m_beginList; + con->m_prevKeepAliveConnection = nullptr; + if (m_aliveList.m_beginList != nullptr) + m_aliveList.m_beginList->m_prevKeepAliveConnection = con; + m_aliveList.m_beginList = con; + con->m_aliveListId = m_keepAliveList.m_listID;//start it out thinking it's already in the alive list, since it is - con->m_nextRecvDataConnection = m_dataList.m_beginList; - con->m_prevRecvDataConnection = nullptr; - if (m_dataList.m_beginList != nullptr) - m_dataList.m_beginList->m_prevRecvDataConnection = con; - m_dataList.m_beginList = con; - con->m_recvDataListId = m_noDataList.m_listID;//start it out thinking it's already in the data list, since it is -} + con->m_nextRecvDataConnection = m_dataList.m_beginList; + con->m_prevRecvDataConnection = nullptr; + if (m_dataList.m_beginList != nullptr) + m_dataList.m_beginList->m_prevRecvDataConnection = con; + m_dataList.m_beginList = con; + con->m_recvDataListId = m_noDataList.m_listID;//start it out thinking it's already in the data list, since it is + } -void TcpManager::removeConnection(TcpConnection *con) -{ - if (!con->wasRemovedFromMgr()) - { - con->setRemovedFromMgr(); - m_connectionListCount--; - #ifdef WIN32 //select only used on win32 - if (con->m_socket != INVALID_SOCKET) - { + void TcpManager::removeConnection(TcpConnection *con) + { + if (!con->wasRemovedFromMgr()) + { + con->setRemovedFromMgr(); + m_connectionListCount--; +#ifdef WIN32 //select only used on win32 + if (con->m_socket != INVALID_SOCKET) + { #pragma warning(push) #pragma warning(disable : 4127) - FD_CLR(con->m_socket, &m_permfds); + FD_CLR(con->m_socket, &m_permfds); #pragma warning(pop) - } - #endif - if (con->m_prevConnection != nullptr) - con->m_prevConnection->m_nextConnection = con->m_nextConnection; - if (con->m_nextConnection != nullptr) - con->m_nextConnection->m_prevConnection = con->m_prevConnection; - if (m_connectionList == con) - m_connectionList = con->m_nextConnection; - con->m_nextConnection = nullptr; - con->m_prevConnection = nullptr; + } +#endif + if (con->m_prevConnection != nullptr) + con->m_prevConnection->m_nextConnection = con->m_nextConnection; + if (con->m_nextConnection != nullptr) + con->m_nextConnection->m_prevConnection = con->m_prevConnection; + if (m_connectionList == con) + m_connectionList = con->m_nextConnection; + con->m_nextConnection = nullptr; + con->m_prevConnection = nullptr; - if (con->m_prevKeepAliveConnection != nullptr) - con->m_prevKeepAliveConnection->m_nextKeepAliveConnection = con->m_nextKeepAliveConnection; - if (con->m_nextKeepAliveConnection != nullptr) - con->m_nextKeepAliveConnection->m_prevKeepAliveConnection = con->m_prevKeepAliveConnection; + if (con->m_prevKeepAliveConnection != nullptr) + con->m_prevKeepAliveConnection->m_nextKeepAliveConnection = con->m_nextKeepAliveConnection; + if (con->m_nextKeepAliveConnection != nullptr) + con->m_nextKeepAliveConnection->m_prevKeepAliveConnection = con->m_prevKeepAliveConnection; - if (m_aliveList.m_beginList == con) - m_aliveList.m_beginList = con->m_nextKeepAliveConnection; - else if (m_keepAliveList.m_beginList == con) - m_keepAliveList.m_beginList = con->m_nextKeepAliveConnection; - con->m_nextKeepAliveConnection = nullptr; - con->m_prevKeepAliveConnection = nullptr; + if (m_aliveList.m_beginList == con) + m_aliveList.m_beginList = con->m_nextKeepAliveConnection; + else if (m_keepAliveList.m_beginList == con) + m_keepAliveList.m_beginList = con->m_nextKeepAliveConnection; + con->m_nextKeepAliveConnection = nullptr; + con->m_prevKeepAliveConnection = nullptr; + if (con->m_prevRecvDataConnection != nullptr) + con->m_prevRecvDataConnection->m_nextRecvDataConnection = con->m_nextRecvDataConnection; + if (con->m_nextRecvDataConnection != nullptr) + con->m_nextRecvDataConnection->m_prevRecvDataConnection = con->m_prevRecvDataConnection; + if (m_dataList.m_beginList == con) + m_dataList.m_beginList = con->m_nextRecvDataConnection; + else if (m_noDataList.m_beginList == con) + m_noDataList.m_beginList = con->m_nextRecvDataConnection; + con->m_nextRecvDataConnection = nullptr; + con->m_prevRecvDataConnection = nullptr; - if (con->m_prevRecvDataConnection != nullptr) - con->m_prevRecvDataConnection->m_nextRecvDataConnection = con->m_nextRecvDataConnection; - if (con->m_nextRecvDataConnection != nullptr) - con->m_nextRecvDataConnection->m_prevRecvDataConnection = con->m_prevRecvDataConnection; + con->Release(); + } + } - if (m_dataList.m_beginList == con) - m_dataList.m_beginList = con->m_nextRecvDataConnection; - else if (m_noDataList.m_beginList == con) - m_noDataList.m_beginList = con->m_nextRecvDataConnection; - con->m_nextRecvDataConnection = nullptr; - con->m_prevRecvDataConnection = nullptr; + void TcpManager::AddRef() + { + m_refCount++; + } + void TcpManager::Release() + { + if (--m_refCount == 0) + delete this; + } + IPAddress TcpManager::GetLocalIp() const + { + struct sockaddr_in addr_self; + memset(&addr_self, 0, sizeof(addr_self)); + socklen_t len = sizeof(addr_self); + getsockname(m_socket, (struct sockaddr *)&addr_self, &len); + return(IPAddress(addr_self.sin_addr.s_addr)); + } - con->Release(); - } -} - -void TcpManager::AddRef() -{ - m_refCount++; -} - -void TcpManager::Release() -{ - if (--m_refCount == 0) - delete this; -} - -IPAddress TcpManager::GetLocalIp() const -{ - struct sockaddr_in addr_self; - memset(&addr_self, 0, sizeof(addr_self)); - socklen_t len = sizeof(addr_self); - getsockname(m_socket, (struct sockaddr *)&addr_self, &len); - return(IPAddress(addr_self.sin_addr.s_addr)); - -} - -unsigned int TcpManager::GetLocalPort() const -{ - struct sockaddr_in addr_self; - memset(&addr_self, 0, sizeof(addr_self)); - socklen_t len = sizeof(addr_self); - getsockname(m_socket, (struct sockaddr *)&addr_self, &len); - return(ntohs(addr_self.sin_port)); -} - + unsigned int TcpManager::GetLocalPort() const + { + struct sockaddr_in addr_self; + memset(&addr_self, 0, sizeof(addr_self)); + socklen_t len = sizeof(addr_self); + getsockname(m_socket, (struct sockaddr *)&addr_self, &len); + return(ntohs(addr_self.sin_port)); + } #ifdef EXTERNAL_DISTRO }; -#endif - - +#endif \ No newline at end of file diff --git a/engine/server/application/CentralServer/src/shared/CentralCSHandler.h b/engine/server/application/CentralServer/src/shared/CentralCSHandler.h index b07690de..09e7c5f3 100755 --- a/engine/server/application/CentralServer/src/shared/CentralCSHandler.h +++ b/engine/server/application/CentralServer/src/shared/CentralCSHandler.h @@ -16,28 +16,27 @@ class StructureListMessage; #define DECLARE_CS_CMD( _name ) void handle_##_name( GameServerCSRequestMessage & message ); - class CentralCSHandler { public: static void install(); static void remove(); static CentralCSHandler & getInstance(); - void handle( const CSToolRequest& msg, uint32 loginServerId ); + void handle(const CSToolRequest& msg, uint32 loginServerId); ~CentralCSHandler(); - - void handleFindObjectResponse( int iIndex, bool bFound ); - void handleStructureListResponse( StructureListMessage& msg ); - + + void handleFindObjectResponse(int iIndex, bool bFound); + void handleStructureListResponse(StructureListMessage& msg); + // only need to DECLARE_CS_CMD for commands handled at the CentralServer. - - DECLARE_CS_CMD( list_structures ); - DECLARE_CS_CMD( login_character ); - DECLARE_CS_CMD( warp_player ); - + + DECLARE_CS_CMD(list_structures); + DECLARE_CS_CMD(login_character); + DECLARE_CS_CMD(warp_player); + protected: static CentralCSHandler * smp_instance; - typedef void( CentralCSHandler::*CentralCSHandlerFunc )( GameServerCSRequestMessage & ); + typedef void(CentralCSHandler::*CentralCSHandlerFunc)(GameServerCSRequestMessage &); class HandlerEntry { @@ -52,75 +51,70 @@ protected: TYPE_ARBITRARY_GAME_SERVER // send to a game server, we don't care which one. This is used // if all game servers have what we're looking for, so we don't care who gets it. }; - - - HandlerEntry( const std::string & in_name, CentralCSHandlerFunc in_func, EntryType in_type ) : - name( in_name ), - type( in_type ), - func( in_func ) + + HandlerEntry(const std::string & in_name, CentralCSHandlerFunc in_func, EntryType in_type) : + name(in_name), + type(in_type), + func(in_func) { } - - HandlerEntry( const std::string & in_name, EntryType in_type ) : - name(in_name), - type( in_type ) + + HandlerEntry(const std::string & in_name, EntryType in_type) : + name(in_name), + type(in_type), + func(nullptr) { } - + std::string name; EntryType type; CentralCSHandlerFunc func; // will be nullptr unless it's of TYPE_CENTRAL. - - }; - + class CSCharacterFindInfo { public: - CSCharacterFindInfo( NetworkId & id, int numServers, GameServerCSRequestMessage &req, bool bHandleAtCentral ) : - commandLine( req.getCommandString() ), - command( req.getCommandName() ), - iAccessLevel( req.getAccessLevel() ), - user(req.getUserName() ), - iToolId( req.getToolId() ), - iAccount( req.getAccountId() ), - responsesWaiting( numServers ), - iLoginServerId( req.getLoginServerID() ), - bCentral( bHandleAtCentral ) - + CSCharacterFindInfo(NetworkId & id, int numServers, GameServerCSRequestMessage &req, bool bHandleAtCentral) : + commandLine(req.getCommandString()), + command(req.getCommandName()), + iAccessLevel(req.getAccessLevel()), + user(req.getUserName()), + iToolId(req.getToolId()), + iAccount(req.getAccountId()), + responsesWaiting(numServers), + iLoginServerId(req.getLoginServerID()), + bCentral(bHandleAtCentral) + { - } - + std::string commandLine; std::string command; - + uint32 iAccessLevel; std::string user; - + uint32 iToolId; int iAccount; - - - int responsesWaiting; + + int responsesWaiting; int iLoginServerId; bool bCentral; // if offline, should we handle this at the Central Server or the DB? protected: - }; - + typedef std::map< int, CSCharacterFindInfo * > CentralCharFindMap; - + CentralCharFindMap m_findMap; - + typedef std::map< std::string, HandlerEntry * > CentralCSHandlerMap; - + CentralCSHandlerMap m_entries; - + private: CentralCSHandler() : - m_findMap(), - m_entries() + m_findMap(), + m_entries() { }; }; diff --git a/engine/server/application/CentralServer/src/shared/ConnectionServerConnection.cpp b/engine/server/application/CentralServer/src/shared/ConnectionServerConnection.cpp index 3ef1d338..1c31b191 100755 --- a/engine/server/application/CentralServer/src/shared/ConnectionServerConnection.cpp +++ b/engine/server/application/CentralServer/src/shared/ConnectionServerConnection.cpp @@ -1,8 +1,6 @@ // ConnectionServerConnection.cpp // copyright 2001 Verant Interactive - - //----------------------------------------------------------------------- #include "FirstCentralServer.h" @@ -40,48 +38,50 @@ struct OnConnectionServerConnectionClosed {}; //----------------------------------------------------------------------- ConnectionServerConnection::ConnectionServerConnection(const std::string & a, const uint16 p) : -ServerConnection (a, p, NetworkSetupData()), -m_chatServicePort (0), -m_csServicePort (0), -m_clientServicePortPrivate (0), -m_clientServicePortPublic (0), -m_gameServicePort (0), -m_id (0), -m_pingPort (0), -m_connectionServerNumber (0), -m_gameServiceAddress (), -m_playerCount (0), -m_freeTrialCount (0), -m_emptySceneCount (0), -m_tutorialSceneCount (0), -m_falconSceneCount (0), -m_clientServiceAddress (), -m_chatServiceAddress (), -m_customerServiceAddress () + ServerConnection(a, p, NetworkSetupData()), + m_chatServicePort(0), + m_csServicePort(0), + m_clientServicePortPrivate(0), + m_clientServicePortPublic(0), + m_gameServicePort(0), + m_id(0), + m_pingPort(0), + m_connectionServerNumber(0), + m_gameServiceAddress(), + m_playerCount(0), + m_freeTrialCount(0), + m_emptySceneCount(0), + m_tutorialSceneCount(0), + m_falconSceneCount(0), + m_clientServiceAddress(), + m_chatServiceAddress(), + m_customerServiceAddress(), + m_voiceChatServicePort(0) { } //----------------------------------------------------------------------- ConnectionServerConnection::ConnectionServerConnection(UdpConnectionMT * u, TcpClient * t) : -ServerConnection (u, t), -m_chatServicePort (0), -m_csServicePort (0), -m_clientServicePortPrivate (0), -m_clientServicePortPublic (0), -m_gameServicePort (0), -m_id (0), -m_pingPort (0), -m_connectionServerNumber (0), -m_gameServiceAddress (), -m_playerCount (0), -m_freeTrialCount (0), -m_emptySceneCount (0), -m_tutorialSceneCount (0), -m_falconSceneCount (0), -m_clientServiceAddress (), -m_chatServiceAddress (), -m_customerServiceAddress () + ServerConnection(u, t), + m_chatServicePort(0), + m_csServicePort(0), + m_clientServicePortPrivate(0), + m_clientServicePortPublic(0), + m_gameServicePort(0), + m_id(0), + m_pingPort(0), + m_connectionServerNumber(0), + m_gameServiceAddress(), + m_playerCount(0), + m_freeTrialCount(0), + m_emptySceneCount(0), + m_tutorialSceneCount(0), + m_falconSceneCount(0), + m_clientServiceAddress(), + m_chatServiceAddress(), + m_customerServiceAddress(), + m_voiceChatServicePort(0) { } @@ -89,12 +89,12 @@ m_customerServiceAddress () ConnectionServerConnection::~ConnectionServerConnection() { - // remove ConnectionServerConnection *'s from the + // remove ConnectionServerConnection *'s from the // s_pseudoClientConnectionMap std::map >::iterator i; - for(i = s_pseudoClientConnectionMap.begin(); i != s_pseudoClientConnectionMap.end();) + for (i = s_pseudoClientConnectionMap.begin(); i != s_pseudoClientConnectionMap.end();) { - if(i->second.second == this) + if (i->second.second == this) { if (i->second.first == TransferRequestMoveValidation::TRS_transfer_server) { @@ -121,7 +121,7 @@ bool ConnectionServerConnection::sendToPseudoClientConnection(unsigned int stati { bool result = false; std::map >::iterator f = s_pseudoClientConnectionMap.find(stationId); - if(f != s_pseudoClientConnectionMap.end()) + if (f != s_pseudoClientConnectionMap.end()) { result = true; f->second.second->send(message, true); @@ -166,9 +166,9 @@ void ConnectionServerConnection::onReceive(const Archive::ByteStream & message) { Archive::ReadIterator ri = message.begin(); GameNetworkMessage m(ri); - ri = message.begin(); + ri = message.begin(); - if(m.isType("NewCentralConnectionServer")) + if (m.isType("NewCentralConnectionServer")) { const NewCentralConnectionServer ncs(ri); @@ -178,7 +178,7 @@ void ConnectionServerConnection::onReceive(const Archive::ByteStream & message) m_clientServicePortPrivate = ncs.getClientServicePortPrivate(); m_clientServicePortPublic = ncs.getClientServicePortPublic(); m_gameServicePort = ncs.getGameServicePort(); - m_pingPort = ncs.getPingPort (); + m_pingPort = ncs.getPingPort(); m_connectionServerNumber = ncs.getConnectionServerNumber(); m_gameServiceAddress = ncs.getGameServiceAddress(); m_clientServiceAddress = ncs.getClientServiceAddress(); @@ -207,8 +207,8 @@ void ConnectionServerConnection::onReceive(const Archive::ByteStream & message) //Send to CS servers const EnumerateServers e2(true, getCustomerServiceAddress(), getCustomerServicePort(), ct); - if ( !getCustomerServiceAddress().empty() - && (getCustomerServicePort() != 0)) + if (!getCustomerServiceAddress().empty() + && (getCustomerServicePort() != 0)) { CentralServer::getInstance().broadcastToCustomerServiceServers(e2); } @@ -218,10 +218,10 @@ void ConnectionServerConnection::onReceive(const Archive::ByteStream & message) } //Send to login Servers - if ( (getClientServicePortPrivate() != 0) || (getClientServicePortPublic() != 0) ) + if ((getClientServicePortPrivate() != 0) || (getClientServicePortPublic() != 0)) { const LoginConnectionServerAddress csa(m_id, getClientServiceAddress(), getClientServicePortPrivate(), - getClientServicePortPublic(), getPlayerCount(), getPingPort ()); + getClientServicePortPublic(), getPlayerCount(), getPingPort()); CentralServer::getInstance().sendToAllLoginServers(csa); } } @@ -235,12 +235,12 @@ void ConnectionServerConnection::onReceive(const Archive::ByteStream & message) CentralServer::getInstance().sendToAllLoginServers(ulc); } - else if(m.isType("TaskSpawnProcess")) + else if (m.isType("TaskSpawnProcess")) { const TaskSpawnProcess spawn(ri); CentralServer::getInstance().sendTaskMessage(spawn); } - else if(m.isType("NewPseudoClientConnection")) + else if (m.isType("NewPseudoClientConnection")) { const GenericValueTypeMessage > info(ri); s_pseudoClientConnectionMap[info.getValue().first] = std::make_pair(static_cast(info.getValue().second), this); @@ -248,20 +248,20 @@ void ConnectionServerConnection::onReceive(const Archive::ByteStream & message) // remove corresponding "non pseudo client connection" CentralServer::getInstance().removeFromAccountConnectionMap(static_cast(info.getValue().first)); } - else if(m.isType("DestroyPseudoClientConnection")) + else if (m.isType("DestroyPseudoClientConnection")) { const GenericValueTypeMessage info(ri); std::map >::iterator f = s_pseudoClientConnectionMap.find(info.getValue()); - if(f != s_pseudoClientConnectionMap.end()) + if (f != s_pseudoClientConnectionMap.end()) { s_pseudoClientConnectionMap.erase(f); } } - else if(m.isType("TransferReceiveDataFromGameServer")) + else if (m.isType("TransferReceiveDataFromGameServer")) { const GenericValueTypeMessage transferReply(ri); - if(transferReply.getValue().getTransferRequestSource() == TransferRequestMoveValidation::TRS_transfer_server) + if (transferReply.getValue().getTransferRequestSource() == TransferRequestMoveValidation::TRS_transfer_server) { CentralServer::getInstance().sendToTransferServer(transferReply); } @@ -275,7 +275,7 @@ void ConnectionServerConnection::onReceive(const Archive::ByteStream & message) LOG("CustomerService", ("CharacterTransfer: Sending TransferLoginCharacterToDestinationServer to CentralServer (via LoginServer) (%s) for (%s)", transferReply.getValue().getDestinationGalaxy().c_str(), login.getValue().toString().c_str())); } } - else if(m.isType("ApplyTransferDataSuccess")) + else if (m.isType("ApplyTransferDataSuccess")) { const GenericValueTypeMessage success(ri); @@ -290,7 +290,7 @@ void ConnectionServerConnection::onReceive(const Archive::ByteStream & message) // send the message back to the transfer server, which then // sends a disable login request to the source central server, // "removing" the account on the source galaxy. - if(success.getValue().getTransferRequestSource() == TransferRequestMoveValidation::TRS_transfer_server) + if (success.getValue().getTransferRequestSource() == TransferRequestMoveValidation::TRS_transfer_server) { CentralServer::getInstance().sendToTransferServer(success); } @@ -303,14 +303,14 @@ void ConnectionServerConnection::onReceive(const Archive::ByteStream & message) IGNORE_RETURN(CentralServer::getInstance().sendToArbitraryLoginServer(toggleLoginStatus)); } } - else if(m.isType("ApplyTransferDataFail")) + else if (m.isType("ApplyTransferDataFail")) { const GenericValueTypeMessage fail(ri); - + // send the message back to the transfer server, which then // sends a delete request to the destination central server, // "removing" the account on the destination galaxy. - if(fail.getValue().getTransferRequestSource() == TransferRequestMoveValidation::TRS_transfer_server) + if (fail.getValue().getTransferRequestSource() == TransferRequestMoveValidation::TRS_transfer_server) { CentralServer::getInstance().sendToTransferServer(fail); } @@ -329,11 +329,11 @@ void ConnectionServerConnection::onReceive(const Archive::ByteStream & message) IGNORE_RETURN(CentralServer::getInstance().sendToArbitraryLoginServer(closeRequestTarget)); } } - else if(m.isType("TransferCreateCharacterFailed")) + else if (m.isType("TransferCreateCharacterFailed")) { const GenericValueTypeMessage fail(ri); - if(fail.getValue().getTransferRequestSource() == TransferRequestMoveValidation::TRS_transfer_server) + if (fail.getValue().getTransferRequestSource() == TransferRequestMoveValidation::TRS_transfer_server) { CentralServer::getInstance().sendToTransferServer(fail); } @@ -348,11 +348,11 @@ void ConnectionServerConnection::onReceive(const Archive::ByteStream & message) IGNORE_RETURN(CentralServer::getInstance().sendToArbitraryLoginServer(closeRequestTarget)); } } - else if(m.isType("ReplyTransferDataFail")) + else if (m.isType("ReplyTransferDataFail")) { const GenericValueTypeMessage reply(ri); - if(reply.getValue().getTransferRequestSource() == TransferRequestMoveValidation::TRS_transfer_server) + if (reply.getValue().getTransferRequestSource() == TransferRequestMoveValidation::TRS_transfer_server) { CentralServer::getInstance().sendToTransferServer(reply); } @@ -367,11 +367,11 @@ void ConnectionServerConnection::onReceive(const Archive::ByteStream & message) IGNORE_RETURN(CentralServer::getInstance().sendToArbitraryLoginServer(closeRequestTarget)); } } - else if(m.isType("TransferFailGameServerClosedConnectionWithConnectionServer")) + else if (m.isType("TransferFailGameServerClosedConnectionWithConnectionServer")) { const GenericValueTypeMessage fail(ri); - if(fail.getValue().getTransferRequestSource() == TransferRequestMoveValidation::TRS_transfer_server) + if (fail.getValue().getTransferRequestSource() == TransferRequestMoveValidation::TRS_transfer_server) { CentralServer::getInstance().sendToTransferServer(fail); } @@ -386,12 +386,12 @@ void ConnectionServerConnection::onReceive(const Archive::ByteStream & message) IGNORE_RETURN(CentralServer::getInstance().sendToArbitraryLoginServer(closeRequestTarget)); } } - else if(m.isType("AccountFeatureIdRequest")) + else if (m.isType("AccountFeatureIdRequest")) { const AccountFeatureIdRequest msg(ri); CentralServer::getInstance().sendToArbitraryLoginServer(msg); } - else if(m.isType("AdjustAccountFeatureIdRequest")) + else if (m.isType("AdjustAccountFeatureIdRequest")) { const AdjustAccountFeatureIdRequest msg(ri); CentralServer::getInstance().sendToArbitraryLoginServer(msg); @@ -408,7 +408,7 @@ ConnectionServerConnection * ConnectionServerConnection::getConnectionForAccount { ConnectionServerConnection * result = 0; std::map >::iterator f = s_pseudoClientConnectionMap.find(stationId); - if(f != s_pseudoClientConnectionMap.end()) + if (f != s_pseudoClientConnectionMap.end()) { result = f->second.second; } @@ -424,4 +424,4 @@ void ConnectionServerConnection::removeFromAccountConnectionMap(unsigned int sta { s_pseudoClientConnectionMap.erase(f); } -} +} \ No newline at end of file diff --git a/engine/server/application/ConnectionServer/src/shared/ConnectionServer.cpp b/engine/server/application/ConnectionServer/src/shared/ConnectionServer.cpp index ae9f8bec..2fabbf21 100755 --- a/engine/server/application/ConnectionServer/src/shared/ConnectionServer.cpp +++ b/engine/server/application/ConnectionServer/src/shared/ConnectionServer.cpp @@ -223,7 +223,7 @@ bool ConnectionServer::decryptToken(const KeyShare::Token & token, char* session uint32 len = apiSessionIdWidth + sizeof(StationId); unsigned char * keyBuffer = new unsigned char[len + 1]; unsigned char * keyBufferPointer = keyBuffer; - memset(keyBuffer, 0, len); + memset(keyBuffer, 0, sizeof(*keyBuffer)); bool retval = cs.loginServerKeys->decipherToken(token, keyBuffer, len); diff --git a/engine/shared/library/sharedUtility/src/shared/TemplateParameter.h b/engine/shared/library/sharedUtility/src/shared/TemplateParameter.h index 9c86d90b..c4b1cc1a 100755 --- a/engine/shared/library/sharedUtility/src/shared/TemplateParameter.h +++ b/engine/shared/library/sharedUtility/src/shared/TemplateParameter.h @@ -21,7 +21,6 @@ class Vector; - //======================================================================== template class TemplateBase @@ -40,12 +39,12 @@ public: DataType max_value; Range(void) {} - Range(const Range &s) : - min_value(s.min_value), + Range(const Range &s) : + min_value(s.min_value), max_value(s.max_value) {} Range & operator=(const Range &s) { - min_value = s.min_value; + min_value = s.min_value; max_value = s.max_value; return *this; } @@ -58,8 +57,8 @@ public: DataType base; DieRoll(void) {} - DieRoll(const DieRoll &s) : - num_dice(s.num_dice), + DieRoll(const DieRoll &s) : + num_dice(s.num_dice), die_sides(s.die_sides), base(s.base) {} DieRoll & operator =(const DieRoll &s) @@ -112,81 +111,80 @@ protected: } m_data; // storage for complex-type data bool m_loaded; // flag that this parameter has been loaded - - TemplateBase(void); - TemplateBase(const TemplateBase &); - TemplateBase & operator =(const TemplateBase &); + TemplateBase(void); + TemplateBase(const TemplateBase &); + TemplateBase & operator =(const TemplateBase &); virtual ~TemplateBase(); - virtual void cleanSingleParam(void); - void loadWeightedListFromIff(Iff &file); - void saveWeightedListToIff(Iff &file) const; + void loadWeightedListFromIff(Iff &file); + void saveWeightedListToIff(Iff &file) const; virtual TemplateBase * createNewParam(void) = 0; virtual ReturnType getSingle(void) const; virtual ReturnType getRange(void) const; virtual ReturnType getDieRoll(void) const; - void setValue(const DataType & min_value, const DataType & max_value); - void setValue(const DataType & num_dice, const DataType & die_sides, const DataType & base); + void setValue(const DataType & min_value, const DataType & max_value); + void setValue(const DataType & num_dice, const DataType & die_sides, const DataType & base); }; template inline TemplateBase::TemplateBase(void) : - m_dataType(NONE), - m_loaded(false) + m_dataType(NONE), + m_loaded(false), + m_data(nullptr) { } // TemplateBase::TemplateBase(void) template inline TemplateBase::TemplateBase(const TemplateBase< - DataType, ReturnType> & source) + DataType, ReturnType> & source) : m_loaded(false) { m_dataType = source.m_dataType; switch (m_dataType) { - case SINGLE: - m_dataSingle = source.m_dataSingle; - break; - case WEIGHTED_LIST: - m_data.weightedList = new WeightedList(*source.m_data.weightedList); - break; - case RANGE: - m_data.range = new Range(*source.m_data.range); - break; - case DIE_ROLL: - m_data.dieRoll = new DieRoll(*source.m_data.dieRoll); - break; - case NONE: - default: - break; + case SINGLE: + m_dataSingle = source.m_dataSingle; + break; + case WEIGHTED_LIST: + m_data.weightedList = new WeightedList(*source.m_data.weightedList); + break; + case RANGE: + m_data.range = new Range(*source.m_data.range); + break; + case DIE_ROLL: + m_data.dieRoll = new DieRoll(*source.m_data.dieRoll); + break; + case NONE: + default: + break; } } // TemplateBase::TemplateBase(const TemplateBase &) template inline TemplateBase & TemplateBase:: - operator =(const TemplateBase &source) +operator =(const TemplateBase &source) { cleanData(); m_dataType = source.m_dataType; switch (m_dataType) { - case SINGLE: - m_dataSingle = source.m_dataSingle; - break; - case WEIGHTED_LIST: - m_data.weightedList = new WeightedList(*source.m_data.weightedList); - break; - case RANGE: - m_data.range = new Range(*source.m_data.range); - break; - case DIE_ROLL: - m_data.dieRoll = new DieRoll(*source.m_data.dieRoll); - break; - case NONE: - default: - break; + case SINGLE: + m_dataSingle = source.m_dataSingle; + break; + case WEIGHTED_LIST: + m_data.weightedList = new WeightedList(*source.m_data.weightedList); + break; + case RANGE: + m_data.range = new Range(*source.m_data.range); + break; + case DIE_ROLL: + m_data.dieRoll = new DieRoll(*source.m_data.dieRoll); + break; + case NONE: + default: + break; } return *this; } // TemplateBase::operator = @@ -199,34 +197,34 @@ inline void TemplateBase::cleanData(void) { switch (m_dataType) { - case SINGLE: - cleanSingleParam(); - break; - case WEIGHTED_LIST: - { - typename WeightedList::iterator end = m_data.weightedList->end(); - for (typename WeightedList::iterator iter = m_data.weightedList->begin(); - iter != end; - ++iter) - { - delete (*iter).value; - (*iter).value = nullptr; - } - delete m_data.weightedList; - m_data.weightedList = nullptr; - } - break; - case RANGE: - delete m_data.range; - m_data.range = nullptr; - break; - case DIE_ROLL: - delete m_data.dieRoll; - m_data.dieRoll = nullptr; - break; - case NONE: - default: - break; + case SINGLE: + cleanSingleParam(); + break; + case WEIGHTED_LIST: + { + typename WeightedList::iterator end = m_data.weightedList->end(); + for (typename WeightedList::iterator iter = m_data.weightedList->begin(); + iter != end; + ++iter) + { + delete (*iter).value; + (*iter).value = nullptr; + } + delete m_data.weightedList; + m_data.weightedList = nullptr; + } + break; + case RANGE: + delete m_data.range; + m_data.range = nullptr; + break; + case DIE_ROLL: + delete m_data.dieRoll; + m_data.dieRoll = nullptr; + break; + case NONE: + default: + break; } m_dataType = NONE; m_loaded = false; @@ -247,38 +245,38 @@ inline bool TemplateBase::isLoaded(void) const template inline ReturnType TemplateBase::getValue(void) const { -static DataType dummyReturn; + static DataType dummyReturn; switch (m_dataType) { - case SINGLE: - return getSingle(); - case WEIGHTED_LIST: + case SINGLE: + return getSingle(); + case WEIGHTED_LIST: + { + int weight = Random::random(1, 100); + typename WeightedList::const_iterator end = m_data.weightedList->end(); + for (typename WeightedList::const_iterator iter = m_data.weightedList->begin(); + iter != end; + ++iter) + { + weight -= (*iter).weight; + if (weight <= 0) { - int weight = Random::random(1, 100); - typename WeightedList::const_iterator end = m_data.weightedList->end(); - for (typename WeightedList::const_iterator iter = m_data.weightedList->begin(); - iter != end; - ++iter) - { - weight -= (*iter).weight; - if (weight <= 0) - { - return dynamic_cast *> - ((*iter).value)->getValue(); - } - } - DEBUG_FATAL(true, ("weighted list does not equal 100")); + return dynamic_cast *> + ((*iter).value)->getValue(); } - break; - case RANGE: - return getRange(); - case DIE_ROLL: - return getDieRoll(); - case NONE: - default: - DEBUG_FATAL(true, ("Unknown data type %d for template param", m_dataType)); - break; + } + DEBUG_FATAL(true, ("weighted list does not equal 100")); + } + break; + case RANGE: + return getRange(); + case DIE_ROLL: + return getDieRoll(); + case NONE: + default: + DEBUG_FATAL(true, ("Unknown data type %d for template param", m_dataType)); + break; } return dummyReturn; } // TemplateBase::getValue @@ -322,7 +320,7 @@ inline ReturnType TemplateBase::getSingle(void) const template inline ReturnType TemplateBase::getRange(void) const { -static DataType dummyReturn; + static DataType dummyReturn; DEBUG_FATAL(true, ("getRange not supported")); return dummyReturn; @@ -331,7 +329,7 @@ static DataType dummyReturn; template inline ReturnType TemplateBase::getDieRoll(void) const { -static DataType dummyReturn; + static DataType dummyReturn; DEBUG_FATAL(true, ("getDieRoll not supported")); return dummyReturn; @@ -347,7 +345,7 @@ inline void TemplateBase::setValue(const DataType & value) } template -inline void TemplateBase::setValue(const DataType & min_value, +inline void TemplateBase::setValue(const DataType & min_value, const DataType & max_value) { cleanData(); @@ -359,7 +357,7 @@ inline void TemplateBase::setValue(const DataType & min_va } template -inline void TemplateBase::setValue(const DataType & num_dice, +inline void TemplateBase::setValue(const DataType & num_dice, const DataType & die_sides, const DataType & base) { cleanData(); @@ -398,7 +396,7 @@ inline void TemplateBase::cleanSingleParam(void) template inline void TemplateBase::loadWeightedListFromIff(Iff &file) { -WeightedValue weightedValue; + WeightedValue weightedValue; NOT_NULL(m_data.weightedList); @@ -423,7 +421,7 @@ WeightedValue weightedValue; template inline void TemplateBase::saveWeightedListToIff(Iff &file) const { -int32 intData; + int32 intData; NOT_NULL(m_data.weightedList); @@ -441,14 +439,13 @@ int32 intData; } } // TemplateBase::saveWeightedListToIff - //======================================================================== // class IntegerParam class IntegerParam : public TemplateBase { public: - IntegerParam(void); + IntegerParam(void); virtual ~IntegerParam(); virtual void loadFromIff(Iff &file); @@ -478,7 +475,6 @@ private: // derived template param }; - inline char IntegerParam::getDeltaType(void) const { return m_dataDeltaType; @@ -535,7 +531,7 @@ inline void IntegerParam::setValue(const int & num_dice, const int & die_sides, inline const IntegerParam::DieRoll * IntegerParam::getDieRollStruct(void) const { - if(m_dataType == DIE_ROLL) + if (m_dataType == DIE_ROLL) { return m_data.dieRoll; } @@ -547,7 +543,7 @@ inline const IntegerParam::DieRoll * IntegerParam::getDieRollStruct(void) const inline const IntegerParam::Range * IntegerParam::getRangeStruct(void) const { - if(m_dataType == RANGE) + if (m_dataType == RANGE) { return m_data.range; } @@ -563,7 +559,7 @@ inline const IntegerParam::Range * IntegerParam::getRangeStruct(void) const class FloatParam : public TemplateBase { public: - FloatParam(void); + FloatParam(void); virtual ~FloatParam(); virtual void loadFromIff(Iff &file); @@ -590,7 +586,6 @@ private: // derived template param }; - inline char FloatParam::getDeltaType(void) const { return m_dataDeltaType; @@ -631,7 +626,7 @@ inline void FloatParam::setValue(const float & min_value, const float & max_valu inline const FloatParam::Range * FloatParam::getRangeStruct() const { - if(m_dataType == RANGE) + if (m_dataType == RANGE) { return m_data.range; } @@ -647,7 +642,7 @@ inline const FloatParam::Range * FloatParam::getRangeStruct() const class BoolParam : public TemplateBase { public: - BoolParam(void); + BoolParam(void); virtual ~BoolParam(); virtual void loadFromIff(Iff &file); @@ -662,14 +657,13 @@ inline TemplateBase *BoolParam::createNewParam(void) return new BoolParam; } - //======================================================================== // class StringParam : public TemplateBase { public: - StringParam(void); + StringParam(void); virtual ~StringParam(); virtual void cleanSingleParam(void); @@ -681,13 +675,11 @@ protected: virtual TemplateBase *createNewParam(void); }; - inline TemplateBase *StringParam::createNewParam(void) { return new StringParam; } - //======================================================================== // class VectorParam @@ -705,7 +697,7 @@ struct VectorParamData class VectorParam : public TemplateBase { public: - VectorParam(void); + VectorParam(void); virtual ~VectorParam(); virtual void cleanSingleParam(void); @@ -717,28 +709,26 @@ protected: virtual TemplateBase *createNewParam(void); }; - inline TemplateBase *VectorParam::createNewParam(void) { return new VectorParam; } - //======================================================================== // class StringId param struct StringIdParamData -{ +{ StringParam table; StringParam index; - StringIdParamData(void) : table() , index() {} + StringIdParamData(void) : table(), index() {} }; class StringIdParam : public TemplateBase { public: - StringIdParam(void); + StringIdParam(void); virtual ~StringIdParam(); virtual void cleanSingleParam(void); @@ -757,7 +747,6 @@ inline TemplateBase *StringIdParam::create return new StringIdParam; } - //======================================================================== // class TriggerVolume param @@ -788,11 +777,11 @@ inline float TriggerVolumeData::getRadius(void) const } // TriggerVolumeData::getRadius struct TriggerVolumeParamData -{ +{ StringParam name; FloatParam radius; - TriggerVolumeParamData(void) : name() , radius() {} + TriggerVolumeParamData(void) : name(), radius() {} private: // no copying @@ -800,11 +789,11 @@ private: // TriggerVolumeParamData & operator =(const TriggerVolumeParamData &); }; -class TriggerVolumeParam : public TemplateBase { public: - TriggerVolumeParam(void); + TriggerVolumeParam(void); virtual ~TriggerVolumeParam(); virtual void cleanSingleParam(void); @@ -823,7 +812,6 @@ inline TemplateBase *TriggerVolu return new TriggerVolumeParam; } - //======================================================================== // class DynamicVariableParamData - used by class DynamicVariableParam @@ -842,7 +830,7 @@ public: STRING, LIST } m_type; - union + union { IntegerParam *iparam; FloatParam *fparam; @@ -850,8 +838,8 @@ public: std::vector *lparam; } m_data; - DynamicVariableParamData(void); - DynamicVariableParamData(const std::string &name, DataType type); + DynamicVariableParamData(void); + DynamicVariableParamData(const std::string &name, DataType type); virtual ~DynamicVariableParamData(); void loadFromIff(Iff &file); void saveToIff(Iff &file) const; @@ -862,21 +850,20 @@ private: DynamicVariableParamData & operator =(const DynamicVariableParamData &); }; -inline DynamicVariableParamData::DynamicVariableParamData(void) : +inline DynamicVariableParamData::DynamicVariableParamData(void) : m_name(), m_type(UNKNOWN) { memset(&m_data, 0, sizeof(m_data)); } - //======================================================================== // class DynamicVariableParam : public TemplateBase { public: - DynamicVariableParam(void); + DynamicVariableParam(void); virtual ~DynamicVariableParam(); virtual void cleanSingleParam(void); @@ -900,9 +887,8 @@ private: DynamicVariableParam & operator =(const DynamicVariableParam &); }; - inline TemplateBase * - DynamicVariableParam::createNewParam(void) +DynamicVariableParam::createNewParam(void) { return new DynamicVariableParam(); } @@ -922,7 +908,6 @@ inline void DynamicVariableParam::setIsLoaded(void) m_loaded = true; } - //======================================================================== // @@ -930,7 +915,7 @@ template class StructParam : public TemplateBase { public: - StructParam(void); + StructParam(void); virtual ~StructParam(); bool isInitialized(void) const; @@ -1000,34 +985,34 @@ inline void StructParam::loadFromIff(Iff &file) typename StructParam::DataTypeId dataType = static_cast::DataTypeId>(file.read_int8()); switch (dataType) { - case TemplateBase::SINGLE: - { - Tag id = file.read_int32(); - SP * structTemplate = DataResourceList::fetch(id); - NOT_NULL(structTemplate); - // we need to exit the chunk because the iff class doesn't - // support chunk nesting - file.exitChunk(); - structTemplate->loadFromIff(file); - // we need to enter a fake chunk because whoever called this - // function assumes we are still in a chunk - file.enterChunk(); - this->setValue(structTemplate); - this->m_loaded = true; - } - break; - case TemplateBase::WEIGHTED_LIST: - this->setValue(new typename TemplateBase::WeightedList); - this->loadWeightedListFromIff(file); - break; - case TemplateBase::NONE: - this->cleanData(); - break; - case TemplateBase::RANGE: - case TemplateBase::DIE_ROLL: - default: - DEBUG_FATAL(true, ("loaded unknown data type %d for template struct param", this->m_dataType)); - break; + case TemplateBase::SINGLE: + { + Tag id = file.read_int32(); + SP * structTemplate = DataResourceList::fetch(id); + NOT_NULL(structTemplate); + // we need to exit the chunk because the iff class doesn't + // support chunk nesting + file.exitChunk(); + structTemplate->loadFromIff(file); + // we need to enter a fake chunk because whoever called this + // function assumes we are still in a chunk + file.enterChunk(); + this->setValue(structTemplate); + this->m_loaded = true; + } + break; + case TemplateBase::WEIGHTED_LIST: + this->setValue(new typename TemplateBase::WeightedList); + this->loadWeightedListFromIff(file); + break; + case TemplateBase::NONE: + this->cleanData(); + break; + case TemplateBase::RANGE: + case TemplateBase::DIE_ROLL: + default: + DEBUG_FATAL(true, ("loaded unknown data type %d for template struct param", this->m_dataType)); + break; } } // StructParam::loadFromIff @@ -1043,35 +1028,32 @@ inline void StructParam::saveToIff(Iff &file) const file.insertChunkData(&type, sizeof(type)); switch (this->m_dataType) { - case TemplateBase::SINGLE: - { - int32 tag = this->m_dataSingle->getId(); - file.insertChunkData(&tag, sizeof(tag)); - // we need to exit the chunk because the iff class doesn't - // support chunk nesting - file.exitChunk(); - this->m_dataSingle->saveToIff(file); - // we need to insert a fake chunk because whoever called this - // function assumes we are still in a chunk - file.insertChunk(TAG(X, X, X, X)); - } - break; - case TemplateBase::WEIGHTED_LIST: - this->saveWeightedListToIff(file); - break; - case TemplateBase::NONE: - break; - case TemplateBase::RANGE: - case TemplateBase::DIE_ROLL: - default: - DEBUG_FATAL(true, ("saving unknown data type %d for template struct param", this->m_dataType)); - break; + case TemplateBase::SINGLE: + { + int32 tag = this->m_dataSingle->getId(); + file.insertChunkData(&tag, sizeof(tag)); + // we need to exit the chunk because the iff class doesn't + // support chunk nesting + file.exitChunk(); + this->m_dataSingle->saveToIff(file); + // we need to insert a fake chunk because whoever called this + // function assumes we are still in a chunk + file.insertChunk(TAG(X, X, X, X)); + } + break; + case TemplateBase::WEIGHTED_LIST: + this->saveWeightedListToIff(file); + break; + case TemplateBase::NONE: + break; + case TemplateBase::RANGE: + case TemplateBase::DIE_ROLL: + default: + DEBUG_FATAL(true, ("saving unknown data type %d for template struct param", this->m_dataType)); + break; } } // StructParam::saveToIff - //======================================================================== - #endif // _INCLUDED_TemplateParameter_H - diff --git a/external/3rd/library/platform/utils/Base/AutoLog.h b/external/3rd/library/platform/utils/Base/AutoLog.h index 18871c7f..e3d13a47 100755 --- a/external/3rd/library/platform/utils/Base/AutoLog.h +++ b/external/3rd/library/platform/utils/Base/AutoLog.h @@ -6,112 +6,111 @@ #include #ifdef EXTERNAL_DISTRO -namespace NAMESPACE +namespace NAMESPACE { - #endif -namespace Base -{ + namespace Base + { + class CAutoLog + { + public: + enum eLogLevel { + eLOG_NONE = 0, // log entries are discarded + eLOG_ERROR = 1, // log errors only + eLOG_ALERT = 2, // log alerts and errors only + eLOG_NORMAL = 3, // log all normal events, no debug + eLOG_DEBUG = 4 // log everything + }; - class CAutoLog - { - public: - enum eLogLevel { - eLOG_NONE = 0, // log entries are discarded - eLOG_ERROR = 1, // log errors only - eLOG_ALERT = 2, // log alerts and errors only - eLOG_NORMAL = 3, // log all normal events, no debug - eLOG_DEBUG = 4 // log everything - }; + // Global setting for all AutoLog instances for this application. Can be set on the fly. Default is eLOG_NORMAL. + void SetLogLevel(eLogLevel loglevel); - // Global setting for all AutoLog instances for this application. Can be set on the fly. Default is eLOG_NORMAL. - void SetLogLevel(eLogLevel loglevel); + // Global setting for all AutoLog instances for this application. Can be set on the fly. Default is eLOG_ERROR. + void SetPrintLevel(eLogLevel printlevel); - // Global setting for all AutoLog instances for this application. Can be set on the fly. Default is eLOG_ERROR. - void SetPrintLevel(eLogLevel printlevel); + // Global setting for all AutoLog instances for this application. Can be set on the fly. Default is eLOG_ERROR. + void SetFlushLevel(eLogLevel flushlevel); - // Global setting for all AutoLog instances for this application. Can be set on the fly. Default is eLOG_ERROR. - void SetFlushLevel(eLogLevel flushlevel); + // constructor, no file loaded + CAutoLog(); - // constructor, no file loaded - CAutoLog(); + // version of constructor that calls Open(file) + CAutoLog(const char * file); - // version of constructor that calls Open(file) - CAutoLog(const char * file); + // destructor, will close file if opened + ~CAutoLog(); - // destructor, will close file if opened - ~CAutoLog(); + // Open log file. If a file is already open, function will fail. + // returns true if no error + bool Open(const char * file); - // Open log file. If a file is already open, function will fail. - // returns true if no error - bool Open(const char * file); + // Close log file if opened. + void Close(void); - // Close log file if opened. - void Close(void); + // Make an entry in the log. Format and variable arguments are identical to printf. + // severity will be compared to master log level to determine if the log entry will be made + // severity will be compared to master print level to determine if the log entry will be printed to stdout + void Log(eLogLevel severity, char * format, ...); - // Make an entry in the log. Format and variable arguments are identical to printf. - // severity will be compared to master log level to determine if the log entry will be made - // severity will be compared to master print level to determine if the log entry will be printed to stdout - void Log(eLogLevel severity, char * format, ...); + // Equivalent to the above with the approriate severity argument + void LogError(char * format, ...); + void LogAlert(char * format, ...); + void Log(char * format, ...); + void LogDebug(char * format, ...); - // Equivalent to the above with the approriate severity argument - void LogError(char * format, ...); - void LogAlert(char * format, ...); - void Log(char * format, ...); - void LogDebug(char * format, ...); + private: + FILE * pFile; // current log file opened + char * pFilename; // current log file opened + int nTodaysDayOfYear; // remember the current day to detect change of day + void Archive(void); // archives current log - private: - FILE * pFile; // current log file opened - char * pFilename; // current log file opened - int nTodaysDayOfYear; // remember the current day to detect change of day - void Archive(void); // archives current log + static eLogLevel nLogMask; // master severity level + static eLogLevel nPrintMask; // master severity level + static eLogLevel nFlushMask; // master severity level + }; - static eLogLevel nLogMask; // master severity level - static eLogLevel nPrintMask; // master severity level - static eLogLevel nFlushMask; // master severity level - }; + //------------------------------------- + inline void CAutoLog::SetLogLevel(eLogLevel loglevel) + { + nLogMask = loglevel; + } - //------------------------------------- - inline void CAutoLog::SetLogLevel(eLogLevel loglevel) - { - nLogMask = loglevel; - } + //------------------------------------- + inline void CAutoLog::SetPrintLevel(eLogLevel printlevel) + { + nPrintMask = printlevel; + } - //------------------------------------- - inline void CAutoLog::SetPrintLevel(eLogLevel printlevel) - { - nPrintMask = printlevel; - } + //------------------------------------- + inline void CAutoLog::SetFlushLevel(eLogLevel flushlevel) + { + nFlushMask = flushlevel; + } - //------------------------------------- - inline void CAutoLog::SetFlushLevel(eLogLevel flushlevel) - { - nFlushMask = flushlevel; - } + //------------------------------------- + inline CAutoLog::CAutoLog() + { + pFilename = nullptr; + pFile = (FILE *)-1; + nTodaysDayOfYear = 0; + } - //------------------------------------- - inline CAutoLog::CAutoLog() - { - pFilename = nullptr; - pFile = (FILE *)-1; - } + //------------------------------------- + inline CAutoLog::CAutoLog(const char * file) + { + pFilename = nullptr; + pFile = (FILE *)-1; + Open(file); + } - //------------------------------------- - inline CAutoLog::CAutoLog(const char * file) - { - pFilename = nullptr; - pFile = (FILE *)-1; - Open(file); - } - - //------------------------------------- - inline CAutoLog::~CAutoLog() - { - Close(); - } -}; + //------------------------------------- + inline CAutoLog::~CAutoLog() + { + Close(); + } + }; #ifdef EXTERNAL_DISTRO -}; + }; #endif #endif diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/AvatarIteratorCore.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/AvatarIteratorCore.cpp index 9548bc9f..be7f3a83 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/AvatarIteratorCore.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/AvatarIteratorCore.cpp @@ -3,476 +3,473 @@ using namespace std; -namespace ChatSystem +namespace ChatSystem { + // AVATAR ITERATOR CORE -// AVATAR ITERATOR CORE - -AvatarIteratorCore::AvatarIteratorCore() -: m_map(nullptr) -{ -} - -AvatarIteratorCore::AvatarIteratorCore(std::map *mapIn, std::map::iterator iter) -: m_map(mapIn), - m_mapIter(iter) -{ -} - -AvatarIteratorCore::~AvatarIteratorCore() -{ -} - -AvatarIteratorCore &AvatarIteratorCore::operator=(const AvatarIteratorCore& rhs) -{ - m_map = rhs.m_map; - m_mapIter = rhs.m_mapIter; - - return (*this); -} - -ChatAvatar *AvatarIteratorCore::getCurAvatar() -{ - ChatAvatar *returnVal = nullptr; - - if (!outOfBounds()) + AvatarIteratorCore::AvatarIteratorCore() + : m_map(nullptr), m_mapIter() { - returnVal = (*m_mapIter).second; } - return returnVal; -} - -bool AvatarIteratorCore::increment() -{ - bool returnVal = false; - - m_mapIter++; - if (!outOfBounds()) + AvatarIteratorCore::AvatarIteratorCore(std::map *mapIn, std::map::iterator iter) + : m_map(mapIn), + m_mapIter(iter) { - returnVal = true; } - return returnVal; -} - -bool AvatarIteratorCore::decrement() -{ - bool returnVal = false; - - m_mapIter--; - if (!outOfBounds()) + AvatarIteratorCore::~AvatarIteratorCore() { - returnVal = true; } - return returnVal; -} - -bool AvatarIteratorCore::outOfBounds() -{ - bool returnVal = true; - - if (m_map) + AvatarIteratorCore &AvatarIteratorCore::operator=(const AvatarIteratorCore& rhs) { - if (m_mapIter != m_map->end()) + m_map = rhs.m_map; + m_mapIter = rhs.m_mapIter; + + return (*this); + } + + ChatAvatar *AvatarIteratorCore::getCurAvatar() + { + ChatAvatar *returnVal = nullptr; + + if (!outOfBounds()) { - returnVal = false; + returnVal = (*m_mapIter).second; } + + return returnVal; } - return returnVal; -} - -// MODERATOR ITERATOR CORE - -ModeratorIteratorCore::ModeratorIteratorCore() -: m_set(nullptr) -{ -} - -ModeratorIteratorCore::ModeratorIteratorCore(std::set *setIn, std::set::iterator iter) -: m_set(setIn), - m_setIter(iter) -{ -} - -ModeratorIteratorCore::~ModeratorIteratorCore() -{ -} - -ModeratorIteratorCore &ModeratorIteratorCore::operator=(const ModeratorIteratorCore& rhs) -{ - m_set = rhs.m_set; - m_setIter = rhs.m_setIter; - - return (*this); -} - -ChatAvatar *ModeratorIteratorCore::getCurAvatar() -{ - ChatAvatar *returnVal = nullptr; - - if (!outOfBounds()) + bool AvatarIteratorCore::increment() { - returnVal = (*m_setIter); - } + bool returnVal = false; - return returnVal; -} - -bool ModeratorIteratorCore::increment() -{ - bool returnVal = false; - - m_setIter++; - if (!outOfBounds()) - { - returnVal = true; - } - - return returnVal; -} - -bool ModeratorIteratorCore::decrement() -{ - bool returnVal = false; - - m_setIter--; - if (!outOfBounds()) - { - returnVal = true; - } - - return returnVal; -} - -bool ModeratorIteratorCore::outOfBounds() -{ - bool returnVal = true; - - if (m_set) - { - if (m_setIter != m_set->end()) + m_mapIter++; + if (!outOfBounds()) { - returnVal = false; + returnVal = true; } + + return returnVal; } - return returnVal; -} - -// TEMPORARY MODERATOR ITERATOR CORE - -TemporaryModeratorIteratorCore::TemporaryModeratorIteratorCore() -: m_set(nullptr) -{ -} - -TemporaryModeratorIteratorCore::TemporaryModeratorIteratorCore(std::set *setIn, std::set::iterator iter) -: m_set(setIn), - m_setIter(iter) -{ -} - -TemporaryModeratorIteratorCore::~TemporaryModeratorIteratorCore() -{ -} - -TemporaryModeratorIteratorCore &TemporaryModeratorIteratorCore::operator=(const TemporaryModeratorIteratorCore& rhs) -{ - m_set = rhs.m_set; - m_setIter = rhs.m_setIter; - - return (*this); -} - -ChatAvatar *TemporaryModeratorIteratorCore::getCurAvatar() -{ - ChatAvatar *returnVal = nullptr; - - if (!outOfBounds()) + bool AvatarIteratorCore::decrement() { - returnVal = (*m_setIter); - } + bool returnVal = false; - return returnVal; -} - -bool TemporaryModeratorIteratorCore::increment() -{ - bool returnVal = false; - - m_setIter++; - if (!outOfBounds()) - { - returnVal = true; - } - - return returnVal; -} - -bool TemporaryModeratorIteratorCore::decrement() -{ - bool returnVal = false; - - m_setIter--; - if (!outOfBounds()) - { - returnVal = true; - } - - return returnVal; -} - -bool TemporaryModeratorIteratorCore::outOfBounds() -{ - bool returnVal = true; - - if (m_set) - { - if (m_setIter != m_set->end()) + m_mapIter--; + if (!outOfBounds()) { - returnVal = false; + returnVal = true; } + + return returnVal; } - return returnVal; -} - -// VOICE ITERATOR CORE - -VoiceIteratorCore::VoiceIteratorCore() -: m_set(nullptr) -{ -} - -VoiceIteratorCore::VoiceIteratorCore(std::set *setIn, std::set::iterator iter) -: m_set(setIn), - m_setIter(iter) -{ -} - -VoiceIteratorCore::~VoiceIteratorCore() -{ -} - -VoiceIteratorCore &VoiceIteratorCore::operator=(const VoiceIteratorCore& rhs) -{ - m_set = rhs.m_set; - m_setIter = rhs.m_setIter; - - return (*this); -} - -ChatAvatar *VoiceIteratorCore::getCurAvatar() -{ - ChatAvatar *returnVal = nullptr; - - if (!outOfBounds()) + bool AvatarIteratorCore::outOfBounds() { - returnVal = (*m_setIter); - } + bool returnVal = true; - return returnVal; -} - -bool VoiceIteratorCore::increment() -{ - bool returnVal = false; - - m_setIter++; - if (!outOfBounds()) - { - returnVal = true; - } - - return returnVal; -} - -bool VoiceIteratorCore::decrement() -{ - bool returnVal = false; - - m_setIter--; - if (!outOfBounds()) - { - returnVal = true; - } - - return returnVal; -} - -bool VoiceIteratorCore::outOfBounds() -{ - bool returnVal = true; - - if (m_set) - { - if (m_setIter != m_set->end()) + if (m_map) { - returnVal = false; + if (m_mapIter != m_map->end()) + { + returnVal = false; + } } + + return returnVal; } - return returnVal; -} + // MODERATOR ITERATOR CORE -// INVITE ITERATOR CORE - -InviteIteratorCore::InviteIteratorCore() -: m_set(nullptr) -{ -} - -InviteIteratorCore::InviteIteratorCore(std::set *setIn, std::set::iterator iter) -: m_set(setIn), - m_setIter(iter) -{ -} - -InviteIteratorCore::~InviteIteratorCore() -{ -} - -InviteIteratorCore &InviteIteratorCore::operator=(const InviteIteratorCore& rhs) -{ - m_set = rhs.m_set; - m_setIter = rhs.m_setIter; - - return (*this); -} - -ChatAvatar *InviteIteratorCore::getCurAvatar() -{ - ChatAvatar *returnVal = nullptr; - - if (!outOfBounds()) + ModeratorIteratorCore::ModeratorIteratorCore() + : m_set(nullptr), m_setIter() { - returnVal = (*m_setIter); } - return returnVal; -} - -bool InviteIteratorCore::increment() -{ - bool returnVal = false; - - m_setIter++; - if (!outOfBounds()) + ModeratorIteratorCore::ModeratorIteratorCore(std::set *setIn, std::set::iterator iter) + : m_set(setIn), + m_setIter(iter) { - returnVal = true; } - return returnVal; -} - -bool InviteIteratorCore::decrement() -{ - bool returnVal = false; - - m_setIter--; - if (!outOfBounds()) + ModeratorIteratorCore::~ModeratorIteratorCore() { - returnVal = true; } - return returnVal; -} - -bool InviteIteratorCore::outOfBounds() -{ - bool returnVal = true; - - if (m_set) + ModeratorIteratorCore &ModeratorIteratorCore::operator=(const ModeratorIteratorCore& rhs) { - if (m_setIter != m_set->end()) + m_set = rhs.m_set; + m_setIter = rhs.m_setIter; + + return (*this); + } + + ChatAvatar *ModeratorIteratorCore::getCurAvatar() + { + ChatAvatar *returnVal = nullptr; + + if (!outOfBounds()) { - returnVal = false; + returnVal = (*m_setIter); } + + return returnVal; } - return returnVal; -} - -// BAN ITERATOR CORE - -BanIteratorCore::BanIteratorCore() -: m_set(nullptr) -{ -} - -BanIteratorCore::BanIteratorCore(std::set *setIn, std::set::iterator iter) -: m_set(setIn), - m_setIter(iter) -{ -} - -BanIteratorCore::~BanIteratorCore() -{ -} - -BanIteratorCore &BanIteratorCore::operator=(const BanIteratorCore& rhs) -{ - m_set = rhs.m_set; - m_setIter = rhs.m_setIter; - - return (*this); -} - -ChatAvatar *BanIteratorCore::getCurAvatar() -{ - ChatAvatar *returnVal = nullptr; - - if (!outOfBounds()) + bool ModeratorIteratorCore::increment() { - returnVal = (*m_setIter); - } + bool returnVal = false; - return returnVal; -} - -bool BanIteratorCore::increment() -{ - bool returnVal = false; - - m_setIter++; - if (!outOfBounds()) - { - returnVal = true; - } - - return returnVal; -} - -bool BanIteratorCore::decrement() -{ - bool returnVal = false; - - m_setIter--; - if (!outOfBounds()) - { - returnVal = true; - } - - return returnVal; -} - -bool BanIteratorCore::outOfBounds() -{ - bool returnVal = true; - - if (m_set) - { - if (m_setIter != m_set->end()) + m_setIter++; + if (!outOfBounds()) { - returnVal = false; + returnVal = true; } + + return returnVal; } - return returnVal; -} + bool ModeratorIteratorCore::decrement() + { + bool returnVal = false; -}; + m_setIter--; + if (!outOfBounds()) + { + returnVal = true; + } + return returnVal; + } + + bool ModeratorIteratorCore::outOfBounds() + { + bool returnVal = true; + + if (m_set) + { + if (m_setIter != m_set->end()) + { + returnVal = false; + } + } + + return returnVal; + } + + // TEMPORARY MODERATOR ITERATOR CORE + + TemporaryModeratorIteratorCore::TemporaryModeratorIteratorCore() + : m_set(nullptr), m_setIter() + { + } + + TemporaryModeratorIteratorCore::TemporaryModeratorIteratorCore(std::set *setIn, std::set::iterator iter) + : m_set(setIn), + m_setIter(iter) + { + } + + TemporaryModeratorIteratorCore::~TemporaryModeratorIteratorCore() + { + } + + TemporaryModeratorIteratorCore &TemporaryModeratorIteratorCore::operator=(const TemporaryModeratorIteratorCore& rhs) + { + m_set = rhs.m_set; + m_setIter = rhs.m_setIter; + + return (*this); + } + + ChatAvatar *TemporaryModeratorIteratorCore::getCurAvatar() + { + ChatAvatar *returnVal = nullptr; + + if (!outOfBounds()) + { + returnVal = (*m_setIter); + } + + return returnVal; + } + + bool TemporaryModeratorIteratorCore::increment() + { + bool returnVal = false; + + m_setIter++; + if (!outOfBounds()) + { + returnVal = true; + } + + return returnVal; + } + + bool TemporaryModeratorIteratorCore::decrement() + { + bool returnVal = false; + + m_setIter--; + if (!outOfBounds()) + { + returnVal = true; + } + + return returnVal; + } + + bool TemporaryModeratorIteratorCore::outOfBounds() + { + bool returnVal = true; + + if (m_set) + { + if (m_setIter != m_set->end()) + { + returnVal = false; + } + } + + return returnVal; + } + + // VOICE ITERATOR CORE + + VoiceIteratorCore::VoiceIteratorCore() + : m_set(nullptr), m_setIter() + { + } + + VoiceIteratorCore::VoiceIteratorCore(std::set *setIn, std::set::iterator iter) + : m_set(setIn), + m_setIter(iter) + { + } + + VoiceIteratorCore::~VoiceIteratorCore() + { + } + + VoiceIteratorCore &VoiceIteratorCore::operator=(const VoiceIteratorCore& rhs) + { + m_set = rhs.m_set; + m_setIter = rhs.m_setIter; + + return (*this); + } + + ChatAvatar *VoiceIteratorCore::getCurAvatar() + { + ChatAvatar *returnVal = nullptr; + + if (!outOfBounds()) + { + returnVal = (*m_setIter); + } + + return returnVal; + } + + bool VoiceIteratorCore::increment() + { + bool returnVal = false; + + m_setIter++; + if (!outOfBounds()) + { + returnVal = true; + } + + return returnVal; + } + + bool VoiceIteratorCore::decrement() + { + bool returnVal = false; + + m_setIter--; + if (!outOfBounds()) + { + returnVal = true; + } + + return returnVal; + } + + bool VoiceIteratorCore::outOfBounds() + { + bool returnVal = true; + + if (m_set) + { + if (m_setIter != m_set->end()) + { + returnVal = false; + } + } + + return returnVal; + } + + // INVITE ITERATOR CORE + + InviteIteratorCore::InviteIteratorCore() + : m_set(nullptr), m_setIter() + { + } + + InviteIteratorCore::InviteIteratorCore(std::set *setIn, std::set::iterator iter) + : m_set(setIn), + m_setIter(iter) + { + } + + InviteIteratorCore::~InviteIteratorCore() + { + } + + InviteIteratorCore &InviteIteratorCore::operator=(const InviteIteratorCore& rhs) + { + m_set = rhs.m_set; + m_setIter = rhs.m_setIter; + + return (*this); + } + + ChatAvatar *InviteIteratorCore::getCurAvatar() + { + ChatAvatar *returnVal = nullptr; + + if (!outOfBounds()) + { + returnVal = (*m_setIter); + } + + return returnVal; + } + + bool InviteIteratorCore::increment() + { + bool returnVal = false; + + m_setIter++; + if (!outOfBounds()) + { + returnVal = true; + } + + return returnVal; + } + + bool InviteIteratorCore::decrement() + { + bool returnVal = false; + + m_setIter--; + if (!outOfBounds()) + { + returnVal = true; + } + + return returnVal; + } + + bool InviteIteratorCore::outOfBounds() + { + bool returnVal = true; + + if (m_set) + { + if (m_setIter != m_set->end()) + { + returnVal = false; + } + } + + return returnVal; + } + + // BAN ITERATOR CORE + + BanIteratorCore::BanIteratorCore() + : m_set(nullptr), m_setIter() + { + } + + BanIteratorCore::BanIteratorCore(std::set *setIn, std::set::iterator iter) + : m_set(setIn), + m_setIter(iter) + { + } + + BanIteratorCore::~BanIteratorCore() + { + } + + BanIteratorCore &BanIteratorCore::operator=(const BanIteratorCore& rhs) + { + m_set = rhs.m_set; + m_setIter = rhs.m_setIter; + + return (*this); + } + + ChatAvatar *BanIteratorCore::getCurAvatar() + { + ChatAvatar *returnVal = nullptr; + + if (!outOfBounds()) + { + returnVal = (*m_setIter); + } + + return returnVal; + } + + bool BanIteratorCore::increment() + { + bool returnVal = false; + + m_setIter++; + if (!outOfBounds()) + { + returnVal = true; + } + + return returnVal; + } + + bool BanIteratorCore::decrement() + { + bool returnVal = false; + + m_setIter--; + if (!outOfBounds()) + { + returnVal = true; + } + + return returnVal; + } + + bool BanIteratorCore::outOfBounds() + { + bool returnVal = true; + + if (m_set) + { + if (m_setIter != m_set->end()) + { + returnVal = false; + } + } + + return returnVal; + } +}; \ No newline at end of file diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPICore.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPICore.cpp index 99cfe621..797c4aba 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPICore.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPICore.cpp @@ -13,316 +13,316 @@ const unsigned long kChatApiVersion = 2; -namespace ChatSystem +namespace ChatSystem { + using namespace std; + using namespace Base; + using namespace Plat_Unicode; + using namespace GenericAPI; -using namespace std; -using namespace Base; -using namespace Plat_Unicode; -using namespace GenericAPI; - -const char * const ChatAPICore::ms_errorStringsEnglish[] = -{ - "Succeeded", // 0 - "Timed Out", - "Duplicate login", - "Source avatar does not exist", - "Destination avatar does not exist", - "Address does not exist", // 5 - "Address is not a room", - "Address is not an AID node", - "Friend not found", - "Unknown failure", - "Source avatar not in room", // 10 - "Destination avatar not in room", - "Avatar is banned from room", - "Room is private", - "Room is moderated", - "Not in room", // 15 - "Insufficient room privileges", - "Database error", - "Cannot get avatar ID", - "Cannot get node ID", - "Cannot get persistent message ID", // 20 - "Persistent message not found", - "Maximum number of avatars already in room", - "Destination avatar is ignoring source avatar", - "Room already exists", - "Nothing to confirm", // 25 - "Duplicate friend", - "Ignore not found", - "Duplicate ignore", - "Database error", - "Destination avatar is not a moderator", // 30 - "Destination avatar is not a invited", - "Destination avatar has not been banned", - "Duplicate ban", - "Duplicate moderator", - "Duplicate invite", // 35 - "Already in room", - "Parent room is not persistent", - "Parent node is of wrong type", - "No fan club handle", - "AID node already exists", // 40 - "UID node already exists", - "Wrong chat server for request", - "Succeeded, but local data is invalid", - "Login with nullptr name", - "No server assigned to this identity", // 45 - "Another server already assumed this identity", - "Remote server is down", - "Node ID conflict", - "Invalid node name", - "Insufficient message privileges", // 50 - "Snoop already added", - "Not snooping", - "Destination avatar is not a temporary moderator", - "Destination avatar does not have voice", - "Duplicate temporary moderator", // 55 - "Duplicate voice", - "Chat avatar must first be logged out", - "No work to do", - "Cannot perform rename to nullptr avatar name", - "Cannot perform station acct transfer to stationID = 0", // 60 - "Cannot perform avatar move to nullptr avatar address", - "Failed to obtain an ID for a new room or avatar", - "Room is local to namespace/world; cannot enter from other worlds", - "Room is local to game; cannot enter from other game namespaces", - "Destination avatar has not submitted entry request for room", // 65 - "Insufficient login priority to force logout of current avatar", - "Avatar must wait to be allowed into specified room.", - "Persistent message would exceed inbox limit for this avatar", - "Duplicate destination specified for multiple persistent send", - "Persistent message would exceed given category limit", // 70 - "Add friend request is pending due to destination avatar is offline", -}; - -unsigned ChatAPICore::ms_numErrorStrings = sizeof(ChatAPICore::ms_errorStringsEnglish) / sizeof(const char *); - -ChatAPICore::ChatAPICore(const char *registrar_host, short registrar_port, const char *server_host, short server_port) -: GenericAPICore(registrar_host, - registrar_port, - 180 /*request timeout*/, - 10 /* reconnect timeout */, - 60 /*nodata timeout*/, - 60 /*noack timeout*/, - 2048 /*in buffer in KB*/, - 2048 /*out buffer in KB*/, - 15 /*keepalives in secs*/), - m_connected(false), - m_sentVersion(false), - m_inFailoverMode(false), - m_failoverAvatarResRemain(0), - m_failoverRoomResRemain(0), - m_requestCount(0), - m_setToRegistrar(true), - m_registrarHost(registrar_host), - m_defaultServerHost(server_host), - m_assignedServerHost(server_host), - m_registrarPort(registrar_port), - m_defaultServerPort(server_port), - m_assignedServerPort(server_port), - m_timeSinceLastDisconnect(time(nullptr)), - m_rcvdRegistrarResponse(false), - m_shouldSendVersion(true) -{ - // prevent user requests from going through - suspendProcessing(); -} - -ChatAPICore::~ChatAPICore() -{ - m_api = nullptr; - - std::map::iterator iter = m_avatarCoreCache.begin(); - for (; iter != m_avatarCoreCache.end(); ++iter) + const char * const ChatAPICore::ms_errorStringsEnglish[] = { - delete (*iter).second; + "Succeeded", // 0 + "Timed Out", + "Duplicate login", + "Source avatar does not exist", + "Destination avatar does not exist", + "Address does not exist", // 5 + "Address is not a room", + "Address is not an AID node", + "Friend not found", + "Unknown failure", + "Source avatar not in room", // 10 + "Destination avatar not in room", + "Avatar is banned from room", + "Room is private", + "Room is moderated", + "Not in room", // 15 + "Insufficient room privileges", + "Database error", + "Cannot get avatar ID", + "Cannot get node ID", + "Cannot get persistent message ID", // 20 + "Persistent message not found", + "Maximum number of avatars already in room", + "Destination avatar is ignoring source avatar", + "Room already exists", + "Nothing to confirm", // 25 + "Duplicate friend", + "Ignore not found", + "Duplicate ignore", + "Database error", + "Destination avatar is not a moderator", // 30 + "Destination avatar is not a invited", + "Destination avatar has not been banned", + "Duplicate ban", + "Duplicate moderator", + "Duplicate invite", // 35 + "Already in room", + "Parent room is not persistent", + "Parent node is of wrong type", + "No fan club handle", + "AID node already exists", // 40 + "UID node already exists", + "Wrong chat server for request", + "Succeeded, but local data is invalid", + "Login with nullptr name", + "No server assigned to this identity", // 45 + "Another server already assumed this identity", + "Remote server is down", + "Node ID conflict", + "Invalid node name", + "Insufficient message privileges", // 50 + "Snoop already added", + "Not snooping", + "Destination avatar is not a temporary moderator", + "Destination avatar does not have voice", + "Duplicate temporary moderator", // 55 + "Duplicate voice", + "Chat avatar must first be logged out", + "No work to do", + "Cannot perform rename to nullptr avatar name", + "Cannot perform station acct transfer to stationID = 0", // 60 + "Cannot perform avatar move to nullptr avatar address", + "Failed to obtain an ID for a new room or avatar", + "Room is local to namespace/world; cannot enter from other worlds", + "Room is local to game; cannot enter from other game namespaces", + "Destination avatar has not submitted entry request for room", // 65 + "Insufficient login priority to force logout of current avatar", + "Avatar must wait to be allowed into specified room.", + "Persistent message would exceed inbox limit for this avatar", + "Duplicate destination specified for multiple persistent send", + "Persistent message would exceed given category limit", // 70 + "Add friend request is pending due to destination avatar is offline", + }; + + unsigned ChatAPICore::ms_numErrorStrings = sizeof(ChatAPICore::ms_errorStringsEnglish) / sizeof(const char *); + + ChatAPICore::ChatAPICore(const char *registrar_host, short registrar_port, const char *server_host, short server_port) + : GenericAPICore(registrar_host, + registrar_port, + 180 /*request timeout*/, + 10 /* reconnect timeout */, + 60 /*nodata timeout*/, + 60 /*noack timeout*/, + 2048 /*in buffer in KB*/, + 2048 /*out buffer in KB*/, + 15 /*keepalives in secs*/), + m_connected(false), + m_sentVersion(false), + m_inFailoverMode(false), + m_failoverAvatarResRemain(0), + m_failoverRoomResRemain(0), + m_requestCount(0), + m_setToRegistrar(true), + m_registrarHost(registrar_host), + m_defaultServerHost(server_host), + m_assignedServerHost(server_host), + m_registrarPort(registrar_port), + m_defaultServerPort(server_port), + m_assignedServerPort(server_port), + m_timeSinceLastDisconnect(time(nullptr)), + m_rcvdRegistrarResponse(false), + m_shouldSendVersion(true), + m_api(nullptr) + { + // prevent user requests from going through + suspendProcessing(); } - std::map::iterator iter2 = m_avatarCache.begin(); - for (; iter2 != m_avatarCache.end(); ++iter2) + ChatAPICore::~ChatAPICore() { - delete (*iter2).second; - } + m_api = nullptr; - std::map::iterator iter3 = m_roomCoreCache.begin(); - for (; iter3 != m_roomCoreCache.end(); ++iter3) - { - delete (*iter3).second; - } - - std::map::iterator iter4 = m_roomCache.begin(); - for (; iter4 != m_roomCache.end(); ++iter4) - { - delete (*iter4).second; - } -} - -ChatUnicodeString ChatAPICore::getErrorString(unsigned resultCode) -{ - ChatUnicodeString errorString; - - if (resultCode < ms_numErrorStrings) - { - errorString = ms_errorStringsEnglish[resultCode]; - } - - return errorString; -} - -void ChatAPICore::cacheAvatar(ChatAvatarCore *avatarCore) -{ - if(avatarCore) - { - pair < map::iterator, bool > result; - - result = m_avatarCoreCache.insert(pair(avatarCore->getAvatarID(), avatarCore)); - - if (result.second == true) + std::map::iterator iter = m_avatarCoreCache.begin(); + for (; iter != m_avatarCoreCache.end(); ++iter) { - // create m_avatarCache entry as well - ChatAvatar *newAvatar = new ChatAvatar(avatarCore->getAvatarID(), - avatarCore->getUserID(), - ChatUnicodeString(avatarCore->getName().data(), avatarCore->getName().size()), - ChatUnicodeString(avatarCore->getAddress().data(), avatarCore->getAddress().size()), - ChatUnicodeString(avatarCore->getGateway().data(), avatarCore->getGateway().size()), - ChatUnicodeString(avatarCore->getServer().data(), avatarCore->getServer().size()), - avatarCore->getGatewayID(), - avatarCore->getServerID(), - ChatUnicodeString(avatarCore->getLoginLocation().data(), avatarCore->getLoginLocation().size()), - avatarCore->getAttributes()); - - newAvatar->setLoginPriority(avatarCore->getLoginPriority()); - newAvatar->setForwardingEmail(avatarCore->getEmail()); - newAvatar->setInboxLimit(avatarCore->getInboxLimit()); - - m_avatarCache.insert(pair(newAvatar->getAvatarID(), newAvatar)); + delete (*iter).second; } - else + + std::map::iterator iter2 = m_avatarCache.begin(); + for (; iter2 != m_avatarCache.end(); ++iter2) { - // insert failed; we have to clean up the ChatAvatarCore - delete avatarCore; + delete (*iter2).second; + } + + std::map::iterator iter3 = m_roomCoreCache.begin(); + for (; iter3 != m_roomCoreCache.end(); ++iter3) + { + delete (*iter3).second; + } + + std::map::iterator iter4 = m_roomCache.begin(); + for (; iter4 != m_roomCache.end(); ++iter4) + { + delete (*iter4).second; } } -} -ChatAvatarCore *ChatAPICore::getAvatarCore(unsigned avatarID) -{ - ChatAvatarCore *returnAvatar = nullptr; - - std::map::iterator iter = m_avatarCoreCache.find(avatarID); - if(iter != m_avatarCoreCache.end()) + ChatUnicodeString ChatAPICore::getErrorString(unsigned resultCode) { - returnAvatar = (*iter).second; + ChatUnicodeString errorString; + + if (resultCode < ms_numErrorStrings) + { + errorString = ms_errorStringsEnglish[resultCode]; + } + + return errorString; } - return(returnAvatar); -} -ChatAvatar *ChatAPICore::getAvatar(unsigned avatarID) -{ - ChatAvatar *returnAvatar = nullptr; - - std::map::iterator iter = m_avatarCache.find(avatarID); - if(iter != m_avatarCache.end()) + void ChatAPICore::cacheAvatar(ChatAvatarCore *avatarCore) { - returnAvatar = (*iter).second; + if (avatarCore) + { + pair < map::iterator, bool > result; + + result = m_avatarCoreCache.insert(pair(avatarCore->getAvatarID(), avatarCore)); + + if (result.second == true) + { + // create m_avatarCache entry as well + ChatAvatar *newAvatar = new ChatAvatar(avatarCore->getAvatarID(), + avatarCore->getUserID(), + ChatUnicodeString(avatarCore->getName().data(), avatarCore->getName().size()), + ChatUnicodeString(avatarCore->getAddress().data(), avatarCore->getAddress().size()), + ChatUnicodeString(avatarCore->getGateway().data(), avatarCore->getGateway().size()), + ChatUnicodeString(avatarCore->getServer().data(), avatarCore->getServer().size()), + avatarCore->getGatewayID(), + avatarCore->getServerID(), + ChatUnicodeString(avatarCore->getLoginLocation().data(), avatarCore->getLoginLocation().size()), + avatarCore->getAttributes()); + + newAvatar->setLoginPriority(avatarCore->getLoginPriority()); + newAvatar->setForwardingEmail(avatarCore->getEmail()); + newAvatar->setInboxLimit(avatarCore->getInboxLimit()); + + m_avatarCache.insert(pair(newAvatar->getAvatarID(), newAvatar)); + } + else + { + // insert failed; we have to clean up the ChatAvatarCore + delete avatarCore; + } + } } - return(returnAvatar); -} -ChatAvatarCore *ChatAPICore::decacheAvatar(unsigned avatarID) -{ - ChatAvatarCore *returnAvatar = nullptr; - std::map::iterator iterCore = m_avatarCoreCache.find(avatarID); - if(iterCore != m_avatarCoreCache.end()) + ChatAvatarCore *ChatAPICore::getAvatarCore(unsigned avatarID) { - returnAvatar = (*iterCore).second; - m_avatarCoreCache.erase(iterCore); + ChatAvatarCore *returnAvatar = nullptr; + + std::map::iterator iter = m_avatarCoreCache.find(avatarID); + if (iter != m_avatarCoreCache.end()) + { + returnAvatar = (*iter).second; + } + return(returnAvatar); + } + + ChatAvatar *ChatAPICore::getAvatar(unsigned avatarID) + { + ChatAvatar *returnAvatar = nullptr; - // erase and delete from m_avatarCache as well std::map::iterator iter = m_avatarCache.find(avatarID); - delete (*iter).second; - m_avatarCache.erase(iter); - } - return(returnAvatar); -} - -void ChatAPICore::cacheRoom(ChatRoomCore *roomCore) -{ - if(roomCore) - { - pair < map::iterator, bool > result; - result = m_roomCoreCache.insert(pair(roomCore->getRoomID(), roomCore)); - - if (result.second == true) + if (iter != m_avatarCache.end()) { - // create m_avatarCache entry as well - ChatRoom *newRoom = new ChatRoom(roomCore); + returnAvatar = (*iter).second; + } + return(returnAvatar); + } - m_roomCache.insert(pair(roomCore->getRoomID(), newRoom)); + ChatAvatarCore *ChatAPICore::decacheAvatar(unsigned avatarID) + { + ChatAvatarCore *returnAvatar = nullptr; + std::map::iterator iterCore = m_avatarCoreCache.find(avatarID); + if (iterCore != m_avatarCoreCache.end()) + { + returnAvatar = (*iterCore).second; + m_avatarCoreCache.erase(iterCore); + + // erase and delete from m_avatarCache as well + std::map::iterator iter = m_avatarCache.find(avatarID); + delete (*iter).second; + m_avatarCache.erase(iter); + } + return(returnAvatar); + } + + void ChatAPICore::cacheRoom(ChatRoomCore *roomCore) + { + if (roomCore) + { + pair < map::iterator, bool > result; + result = m_roomCoreCache.insert(pair(roomCore->getRoomID(), roomCore)); + + if (result.second == true) + { + // create m_avatarCache entry as well + ChatRoom *newRoom = new ChatRoom(roomCore); + + m_roomCache.insert(pair(roomCore->getRoomID(), newRoom)); + } } } -} -ChatRoomCore *ChatAPICore::getRoomCore(unsigned roomID) -{ - ChatRoomCore *returnRoom = nullptr; - std::map::iterator iter = m_roomCoreCache.find(roomID); - if(iter != m_roomCoreCache.end()) + ChatRoomCore *ChatAPICore::getRoomCore(unsigned roomID) { - returnRoom = (*iter).second; + ChatRoomCore *returnRoom = nullptr; + std::map::iterator iter = m_roomCoreCache.find(roomID); + if (iter != m_roomCoreCache.end()) + { + returnRoom = (*iter).second; + } + + return(returnRoom); } - - return(returnRoom); -} -ChatRoom *ChatAPICore::getRoom(unsigned roomID) -{ - ChatRoom *returnRoom = nullptr; - std::map::iterator iter = m_roomCache.find(roomID); - if(iter != m_roomCache.end()) + ChatRoom *ChatAPICore::getRoom(unsigned roomID) { - returnRoom = (*iter).second; - } - - return(returnRoom); -} - -ChatRoomCore *ChatAPICore::decacheRoom(unsigned roomID) -{ - ChatRoomCore *returnRoom = nullptr; - - std::map::iterator iterCore = m_roomCoreCache.find(roomID); - if(iterCore != m_roomCoreCache.end()) - { - returnRoom = (*iterCore).second; - m_roomCoreCache.erase(iterCore); - - // erase and delete from m_roomCache as well + ChatRoom *returnRoom = nullptr; std::map::iterator iter = m_roomCache.find(roomID); - delete (*iter).second; - m_roomCache.erase(iter); + if (iter != m_roomCache.end()) + { + returnRoom = (*iter).second; + } + + return(returnRoom); } - return(returnRoom); -} - -void ChatAPICore::responseCallback(GenericResponse *res) -{ - switch(res->getType()) + ChatRoomCore *ChatAPICore::decacheRoom(unsigned roomID) { - case RESPONSE_LOGINAVATAR: + ChatRoomCore *returnRoom = nullptr; + + std::map::iterator iterCore = m_roomCoreCache.find(roomID); + if (iterCore != m_roomCoreCache.end()) + { + returnRoom = (*iterCore).second; + m_roomCoreCache.erase(iterCore); + + // erase and delete from m_roomCache as well + std::map::iterator iter = m_roomCache.find(roomID); + delete (*iter).second; + m_roomCache.erase(iter); + } + + return(returnRoom); + } + + void ChatAPICore::responseCallback(GenericResponse *res) + { + switch (res->getType()) + { + case RESPONSE_LOGINAVATAR: { ResLoginAvatar *R = static_cast(res); ChatAvatar *avatar = nullptr; - if(R->getAvatar()) + if (R->getAvatar()) { cacheAvatar(R->getAvatar()); avatar = getAvatar(R->getAvatar()->getAvatarID()); } - if (!avatar && R->getResult()==CHATRESULT_SUCCESS) + if (!avatar && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_LOGINAVATAR: avatar=%p\n", avatar); @@ -335,30 +335,30 @@ void ChatAPICore::responseCallback(GenericResponse *res) m_api->OnLoginAvatar(R->getTrack(), R->getResult(), avatar, R->getRequiredLoginPriority(), R->getUser()); } break; - case RESPONSE_TEMPORARYAVATAR: - { - ResTemporaryAvatar* R = static_cast(res); - ChatAvatar* avatar = nullptr; + case RESPONSE_TEMPORARYAVATAR: + { + ResTemporaryAvatar* R = static_cast(res); + ChatAvatar* avatar = nullptr; - if ( R->getAvatar() ) - { - cacheAvatar(R->getAvatar()); - avatar = getAvatar(R->getAvatar()->getAvatarID()); - } - if (!avatar && R->getResult()==CHATRESULT_SUCCESS) - { - R->setResult(CHATRESULT_SUCCESSBADDATA); - _chatdebug_("ChatAPI:BadData: RESPONSE_TEMPORARYAVATAR: avatar=%p\n", avatar); - } + if (R->getAvatar()) + { + cacheAvatar(R->getAvatar()); + avatar = getAvatar(R->getAvatar()->getAvatarID()); + } + if (!avatar && R->getResult() == CHATRESULT_SUCCESS) + { + R->setResult(CHATRESULT_SUCCESSBADDATA); + _chatdebug_("ChatAPI:BadData: RESPONSE_TEMPORARYAVATAR: avatar=%p\n", avatar); + } - m_api->OnTemporaryAvatar(R->getTrack(), R->getResult(), avatar, R->getUser()); - } - break; - case RESPONSE_LOGOUTAVATAR: + m_api->OnTemporaryAvatar(R->getTrack(), R->getResult(), avatar, R->getUser()); + } + break; + case RESPONSE_LOGOUTAVATAR: { ResLogoutAvatar *R = static_cast(res); ChatAvatar *avatar = getAvatar(R->getAvatarID()); - if (!avatar && R->getResult()==CHATRESULT_SUCCESS) + if (!avatar && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_LOGOUTAVATAR: avatar=%p\n", avatar); @@ -371,11 +371,11 @@ void ChatAPICore::responseCallback(GenericResponse *res) } } break; - case RESPONSE_DESTROYAVATAR: + case RESPONSE_DESTROYAVATAR: { ResDestroyAvatar *R = static_cast(res); ChatAvatar *avatar = getAvatar(R->getAvatarID()); - if (!avatar && R->getResult()==CHATRESULT_SUCCESS) + if (!avatar && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_DESTROYAVATAR: avatar=%p\n", avatar); @@ -385,24 +385,24 @@ void ChatAPICore::responseCallback(GenericResponse *res) delete avatarCore; } break; - case RESPONSE_GETFANCLUBHANDLE: + case RESPONSE_GETFANCLUBHANDLE: { ResGetFanClubHandle *R = static_cast(res); m_api->OnFanClubHandle(R->getTrack(), R->getResult(), ChatUnicodeString(R->getHandle().data(), R->getHandle().size()), R->getStationID(), R->getFanClubCode(), R->getUser()); } break; - case RESPONSE_GETAVATAR: + case RESPONSE_GETAVATAR: { ResGetAvatar *R = static_cast(res); ChatAvatar *cachedAvatar = nullptr; ChatAvatar *avatar = nullptr; ChatAvatarCore *avatarCore = R->getAvatar(); - + if (R->getResult() == 0 && avatarCore) // if success { // attempt to return locally cached avatar, if available cachedAvatar = getAvatar(avatarCore->getAvatarID()); - + if (cachedAvatar != nullptr) { // update cached information with returned data @@ -419,7 +419,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) } } - if ((!avatar||!avatarCore) && (R->getResult() == CHATRESULT_SUCCESS)) + if ((!avatar || !avatarCore) && (R->getResult() == CHATRESULT_SUCCESS)) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_GETAVATAR: avatarCore=%p, avatar=%p\n", avatarCore, avatar); @@ -435,65 +435,65 @@ void ChatAPICore::responseCallback(GenericResponse *res) delete avatarCore; } break; - case RESPONSE_GETANYAVATAR: - { - ResGetAnyAvatar *R = static_cast(res); - ChatAvatar *cachedAvatar = nullptr; - ChatAvatar *avatar = nullptr; - ChatAvatarCore *avatarCore = R->getAvatar(); + case RESPONSE_GETANYAVATAR: + { + ResGetAnyAvatar *R = static_cast(res); + ChatAvatar *cachedAvatar = nullptr; + ChatAvatar *avatar = nullptr; + ChatAvatarCore *avatarCore = R->getAvatar(); - if (R->getResult() == 0 && avatarCore) // if success - { - // attempt to return locally cached avatar, if available - cachedAvatar = getAvatar(avatarCore->getAvatarID()); + if (R->getResult() == 0 && avatarCore) // if success + { + // attempt to return locally cached avatar, if available + cachedAvatar = getAvatar(avatarCore->getAvatarID()); - if (cachedAvatar != nullptr) - { - // update cached information with returned data - cachedAvatar->setAttributes(avatarCore->getAttributes()); - cachedAvatar->setForwardingEmail(avatarCore->getEmail()); - cachedAvatar->setInboxLimit(avatarCore->getInboxLimit()); + if (cachedAvatar != nullptr) + { + // update cached information with returned data + cachedAvatar->setAttributes(avatarCore->getAttributes()); + cachedAvatar->setForwardingEmail(avatarCore->getEmail()); + cachedAvatar->setInboxLimit(avatarCore->getInboxLimit()); - avatar = cachedAvatar; - } - else - { - // don't cache uncached avatars - avatar = avatarCore->getNewChatAvatar(); - } - } + avatar = cachedAvatar; + } + else + { + // don't cache uncached avatars + avatar = avatarCore->getNewChatAvatar(); + } + } - if ((!avatar||!avatarCore) && (R->getResult() == CHATRESULT_SUCCESS)) - { - R->setResult(CHATRESULT_SUCCESSBADDATA); - _chatdebug_("ChatAPI:BadData: RESPONSE_GETANYAVATAR: avatarCore=%p, avatar=%p\n", avatarCore, avatar); - } + if ((!avatar || !avatarCore) && (R->getResult() == CHATRESULT_SUCCESS)) + { + R->setResult(CHATRESULT_SUCCESSBADDATA); + _chatdebug_("ChatAPI:BadData: RESPONSE_GETANYAVATAR: avatarCore=%p, avatar=%p\n", avatarCore, avatar); + } - m_api->OnGetAnyAvatar(R->getTrack(), R->getResult(), avatar, R->isLoggedIn(), R->getUser()); + m_api->OnGetAnyAvatar(R->getTrack(), R->getResult(), avatar, R->isLoggedIn(), R->getUser()); - if (cachedAvatar == nullptr) - { - delete avatar; - } + if (cachedAvatar == nullptr) + { + delete avatar; + } - delete avatarCore; - } - break; - case RESPONSE_AVATARLIST: - { - ResAvatarList *R = static_cast(res); + delete avatarCore; + } + break; + case RESPONSE_AVATARLIST: + { + ResAvatarList *R = static_cast(res); - m_api->OnAvatarList(R->getTrack(), R->getResult(), R->getListLength(), R->getAvatarList(), R->getUser()); - - break; - } - case RESPONSE_SETAVATARATTRIBUTES: + m_api->OnAvatarList(R->getTrack(), R->getResult(), R->getListLength(), R->getAvatarList(), R->getUser()); + + break; + } + case RESPONSE_SETAVATARATTRIBUTES: { ResSetAvatarAttributes *R = static_cast(res); ChatAvatar *cachedAvatar = nullptr; ChatAvatar *avatar = nullptr; ChatAvatarCore *avatarCore = R->getAvatar(); - + if (R->getResult() == 0 && avatarCore) // if success { avatar = avatarCore->getNewChatAvatar(); @@ -508,7 +508,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) } } } - + if (cachedAvatar != nullptr) { cachedAvatar = avatar; @@ -516,7 +516,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) } else { - if ((!avatar||!avatarCore) && R->getResult()==CHATRESULT_SUCCESS) + if ((!avatar || !avatarCore) && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_SETAVATARATTRIBUTES: avatarCore=%p, avatar=%p\n", avatarCore, avatar); @@ -528,54 +528,54 @@ void ChatAPICore::responseCallback(GenericResponse *res) delete avatarCore; } break; - case RESPONSE_SETSTATUSMESSAGE: - { - ResSetAvatarStatusMessage *R = static_cast(res); - ChatAvatar *cachedAvatar = nullptr; - ChatAvatar *avatar = nullptr; - ChatAvatarCore *avatarCore = R->getAvatar(); + case RESPONSE_SETSTATUSMESSAGE: + { + ResSetAvatarStatusMessage *R = static_cast(res); + ChatAvatar *cachedAvatar = nullptr; + ChatAvatar *avatar = nullptr; + ChatAvatarCore *avatarCore = R->getAvatar(); - if (R->getResult() == 0 && avatarCore) // if success - { - avatar = avatarCore->getNewChatAvatar(); - if (avatar) - { - // attempt to return locally cached avatar, if available - cachedAvatar = getAvatar(avatar->getAvatarID()); + if (R->getResult() == 0 && avatarCore) // if success + { + avatar = avatarCore->getNewChatAvatar(); + if (avatar) + { + // attempt to return locally cached avatar, if available + cachedAvatar = getAvatar(avatar->getAvatarID()); - if (cachedAvatar != nullptr) - { - cachedAvatar->setStatusMessage(avatar->getStatusMessage()); - } - } - } + if (cachedAvatar != nullptr) + { + cachedAvatar->setStatusMessage(avatar->getStatusMessage()); + } + } + } - if (cachedAvatar != nullptr) - { - cachedAvatar = avatar; - m_api->OnSetAvatarStatusMessage(R->getTrack(), R->getResult(), cachedAvatar, R->getUser()); - } - else - { - if ((!avatar||!avatarCore) && R->getResult()==CHATRESULT_SUCCESS) - { - R->setResult(CHATRESULT_SUCCESSBADDATA); - _chatdebug_("ChatAPI:BadData: RESPONSE_SETAVATARATTRIBUTES: avatarCore=%p, avatar=%p\n", avatarCore, avatar); - } - m_api->OnSetAvatarAttributes(R->getTrack(), R->getResult(), avatar, R->getUser()); - } + if (cachedAvatar != nullptr) + { + cachedAvatar = avatar; + m_api->OnSetAvatarStatusMessage(R->getTrack(), R->getResult(), cachedAvatar, R->getUser()); + } + else + { + if ((!avatar || !avatarCore) && R->getResult() == CHATRESULT_SUCCESS) + { + R->setResult(CHATRESULT_SUCCESSBADDATA); + _chatdebug_("ChatAPI:BadData: RESPONSE_SETAVATARATTRIBUTES: avatarCore=%p, avatar=%p\n", avatarCore, avatar); + } + m_api->OnSetAvatarAttributes(R->getTrack(), R->getResult(), avatar, R->getUser()); + } - delete avatar; - delete avatarCore; - } - break; - case RESPONSE_SETAVATAREMAIL: + delete avatar; + delete avatarCore; + } + break; + case RESPONSE_SETAVATAREMAIL: { ResSetAvatarForwardingEmail*R = static_cast(res); ChatAvatar *cachedAvatar = nullptr; ChatAvatar *avatar = nullptr; ChatAvatarCore *avatarCore = R->getAvatar(); - + if (R->getResult() == 0 && avatarCore) // if success { avatar = avatarCore->getNewChatAvatar(); @@ -590,7 +590,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) } } } - + if (cachedAvatar != nullptr) { cachedAvatar = avatar; @@ -598,7 +598,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) } else { - if ((!avatar||!avatarCore) && R->getResult()==CHATRESULT_SUCCESS) + if ((!avatar || !avatarCore) && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_SETAVATAREMAIL: avatarCore=%p, avatar=%p\n", avatarCore, avatar); @@ -610,13 +610,13 @@ void ChatAPICore::responseCallback(GenericResponse *res) delete avatarCore; } break; - case RESPONSE_SETAVATARINBOXLIMIT: + case RESPONSE_SETAVATARINBOXLIMIT: { ResSetAvatarInboxLimit *R = static_cast(res); ChatAvatar *cachedAvatar = nullptr; ChatAvatar *avatar = nullptr; ChatAvatarCore *avatarCore = R->getAvatar(); - + if (R->getResult() == 0 && avatarCore) // if success { avatar = avatarCore->getNewChatAvatar(); @@ -631,7 +631,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) } } } - + if (cachedAvatar != nullptr) { cachedAvatar = avatar; @@ -639,7 +639,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) } else { - if ((!avatar||!avatarCore) && R->getResult()==CHATRESULT_SUCCESS) + if ((!avatar || !avatarCore) && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_SETAVATARINBOXLIMIT: avatarCore=%p, avatar=%p\n", avatarCore, avatar); @@ -651,7 +651,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) delete avatarCore; } break; - case RESPONSE_GETROOM: + case RESPONSE_GETROOM: { ResGetRoom *R = static_cast(res); ChatRoom *room = nullptr; @@ -663,7 +663,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) if (getRoomCore(roomid) == nullptr) { // we need to cache this room first - cacheRoom(roomCore); + cacheRoom(roomCore); // are there any parent rooms to the one we // created that we need to cache as well? @@ -679,7 +679,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) // room was already cached, so we must // recache it ChatRoomCore *oldCore = decacheRoom(roomid); - + delete oldCore; cacheRoom(roomCore); @@ -692,11 +692,11 @@ void ChatAPICore::responseCallback(GenericResponse *res) delete (*iter); } } - + room = getRoom(roomid); } - - if ((!room||!roomCore) && R->getResult()==CHATRESULT_SUCCESS) + + if ((!room || !roomCore) && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_GETROOM: roomCore=%p, room=%p\n", roomCore, room); @@ -704,7 +704,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) m_api->OnGetRoom(R->getTrack(), R->getResult(), room, R->getUser()); } break; - case RESPONSE_CREATEROOM: + case RESPONSE_CREATEROOM: { ResCreateRoom *R = static_cast(res); @@ -714,7 +714,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) if (R->getResult() == 0) // if success { roomCore = R->getRoom(); - + if (roomCore) { // cache this room @@ -735,7 +735,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) } } - if ((!room||!roomCore) && R->getResult()==CHATRESULT_SUCCESS) + if ((!room || !roomCore) && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_CREATEROOM: roomCore=%p, room=%p\n", roomCore, room); @@ -743,18 +743,18 @@ void ChatAPICore::responseCallback(GenericResponse *res) m_api->OnCreateRoom(R->getTrack(), R->getResult(), room, R->getUser()); } break; - case RESPONSE_DESTROYROOM: + case RESPONSE_DESTROYROOM: { ResDestroyRoom *R = static_cast(res); m_api->OnDestroyRoom(R->getTrack(), R->getResult(), R->getUser()); // decache occurs on MESSAGE_DESTROYROOM } break; - case RESPONSE_SENDINSTANTMESSAGE: + case RESPONSE_SENDINSTANTMESSAGE: { ResSendInstantMessage *R = static_cast(res); ChatAvatar *avatar = getAvatar(R->getAvatarID()); - if (!avatar && R->getResult()==CHATRESULT_SUCCESS) + if (!avatar && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_SENDINSTANTMESSAGE: avatar=%p\n", avatar); @@ -762,12 +762,12 @@ void ChatAPICore::responseCallback(GenericResponse *res) m_api->OnSendInstantMessage(R->getTrack(), R->getResult(), avatar, R->getUser()); } break; - case RESPONSE_SENDROOMMESSAGE: + case RESPONSE_SENDROOMMESSAGE: { ResSendRoomMessage *R = static_cast(res); ChatAvatar *avatar = getAvatar(R->getAvatarID()); ChatRoom *room = getRoom(R->getRoomID()); - if ((!avatar||!room) && R->getResult()==CHATRESULT_SUCCESS) + if ((!avatar || !room) && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_SENDROOMMESSAGE: avatar=%p, room=%p\n", avatar, room); @@ -775,11 +775,11 @@ void ChatAPICore::responseCallback(GenericResponse *res) m_api->OnSendRoomMessage(R->getTrack(), R->getResult(), avatar, room, R->getUser()); } break; - case RESPONSE_SENDBROADCASTMESSAGE: + case RESPONSE_SENDBROADCASTMESSAGE: { ResSendBroadcastMessage *R = static_cast(res); ChatAvatar *avatar = getAvatar(R->getAvatarID()); - if (!avatar && R->getResult()==CHATRESULT_SUCCESS) + if (!avatar && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_SENDBROADCASTMESSAGE: avatar=%p\n", avatar); @@ -787,23 +787,23 @@ void ChatAPICore::responseCallback(GenericResponse *res) m_api->OnSendBroadcastMessage(R->getTrack(), R->getResult(), avatar, ChatUnicodeString(R->getAddress().data(), R->getAddress().size()), R->getUser()); } break; - case RESPONSE_FILTERMESSAGE: + case RESPONSE_FILTERMESSAGE: { ResFilterMessage *R = static_cast(res); - m_api->OnFilterMessage(R->getTrack(), R->getResult(), ChatUnicodeString(R->getMsg().data(),R->getMsg().size()), R->getUser()); + m_api->OnFilterMessage(R->getTrack(), R->getResult(), ChatUnicodeString(R->getMsg().data(), R->getMsg().size()), R->getUser()); } break; - case RESPONSE_FILTERMESSAGE_EX: + case RESPONSE_FILTERMESSAGE_EX: { ResFilterMessage *R = static_cast(res); - m_api->OnFilterMessageEx(R->getTrack(), R->getResult(), ChatUnicodeString(R->getMsg().data(),R->getMsg().size()), R->getUser()); + m_api->OnFilterMessageEx(R->getTrack(), R->getResult(), ChatUnicodeString(R->getMsg().data(), R->getMsg().size()), R->getUser()); } break; - case RESPONSE_ADDFRIEND: + case RESPONSE_ADDFRIEND: { ResAddFriend *R = static_cast(res); ChatAvatar *avatar = getAvatar(R->getAvatarID()); - if (!avatar && R->getResult()==CHATRESULT_SUCCESS) + if (!avatar && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_ADDFRIEND: avatar=%p\n", avatar); @@ -811,11 +811,11 @@ void ChatAPICore::responseCallback(GenericResponse *res) m_api->OnAddFriend(R->getTrack(), R->getResult(), avatar, ChatUnicodeString(R->getName().data(), R->getName().size()), ChatUnicodeString(R->getAddress().data(), R->getAddress().size()), R->getUser()); } break; - case RESPONSE_ADDFRIEND_RECIPROCATE: + case RESPONSE_ADDFRIEND_RECIPROCATE: { ResAddFriendReciprocate *R = static_cast(res); ChatAvatar *avatar = getAvatar(R->getAvatarID()); - if (!avatar && R->getResult()==CHATRESULT_SUCCESS) + if (!avatar && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_ADDFRIEND_RECIPROCATE: avatar=%p\n", avatar); @@ -823,23 +823,23 @@ void ChatAPICore::responseCallback(GenericResponse *res) m_api->OnAddFriendReciprocate(R->getTrack(), R->getResult(), avatar, ChatUnicodeString(R->getName().data(), R->getName().size()), ChatUnicodeString(R->getAddress().data(), R->getAddress().size()), R->getUser()); } break; - case RESPONSE_SETFRIENDCOMMENT: + case RESPONSE_SETFRIENDCOMMENT: { ResSetFriendComment *R = static_cast(res); ChatAvatar *avatar = getAvatar(R->getAvatarID()); - if (!avatar && R->getResult()==CHATRESULT_SUCCESS) + if (!avatar && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_ADDFRIEND: avatar=%p\n", avatar); } - m_api->OnSetFriendComment(R->getTrack(), R->getResult(), avatar, ChatUnicodeString(R->getName().data(), R->getName().size()), ChatUnicodeString(R->getAddress().data(), R->getAddress().size()), ChatUnicodeString(R->getComment().data(), R->getComment().size()) ,R->getUser()); + m_api->OnSetFriendComment(R->getTrack(), R->getResult(), avatar, ChatUnicodeString(R->getName().data(), R->getName().size()), ChatUnicodeString(R->getAddress().data(), R->getAddress().size()), ChatUnicodeString(R->getComment().data(), R->getComment().size()), R->getUser()); } break; - case RESPONSE_REMOVEFRIEND: + case RESPONSE_REMOVEFRIEND: { ResRemoveFriend *R = static_cast(res); ChatAvatar *avatar = getAvatar(R->getAvatarID()); - if (!avatar && R->getResult()==CHATRESULT_SUCCESS) + if (!avatar && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_REMOVEFRIEND: avatar=%p\n", avatar); @@ -848,11 +848,11 @@ void ChatAPICore::responseCallback(GenericResponse *res) } break; - case RESPONSE_REMOVEFRIEND_RECIPROCATE: + case RESPONSE_REMOVEFRIEND_RECIPROCATE: { ResRemoveFriendReciprocate *R = static_cast(res); ChatAvatar *avatar = getAvatar(R->getAvatarID()); - if (!avatar && R->getResult()==CHATRESULT_SUCCESS) + if (!avatar && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_REMOVEFRIEND_RECIPROCATE: avatar=%p\n", avatar); @@ -860,11 +860,11 @@ void ChatAPICore::responseCallback(GenericResponse *res) m_api->OnRemoveFriendReciprocate(R->getTrack(), R->getResult(), avatar, ChatUnicodeString(R->getName().data(), R->getName().size()), ChatUnicodeString(R->getAddress().data(), R->getAddress().size()), R->getUser()); } break; - case RESPONSE_FRIENDSTATUS: + case RESPONSE_FRIENDSTATUS: { ResFriendStatus *R = static_cast(res); ChatAvatar *avatar = getAvatar(R->getAvatarID()); - if (!avatar && R->getResult()==CHATRESULT_SUCCESS) + if (!avatar && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_FRIENDSTATUS: avatar=%p\n", avatar); @@ -872,11 +872,11 @@ void ChatAPICore::responseCallback(GenericResponse *res) m_api->OnFriendStatus(R->getTrack(), R->getResult(), avatar, R->getListLength(), R->getFriendList(), R->getUser()); } break; - case RESPONSE_ADDIGNORE: + case RESPONSE_ADDIGNORE: { ResAddIgnore *R = static_cast(res); ChatAvatar *avatar = getAvatar(R->getAvatarID()); - if (!avatar && R->getResult()==CHATRESULT_SUCCESS) + if (!avatar && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_ADDIGNORE: avatar=%p\n", avatar); @@ -884,11 +884,11 @@ void ChatAPICore::responseCallback(GenericResponse *res) m_api->OnAddIgnore(R->getTrack(), R->getResult(), avatar, ChatUnicodeString(R->getName().data(), R->getName().size()), ChatUnicodeString(R->getAddress().data(), R->getAddress().size()), R->getUser()); } break; - case RESPONSE_REMOVEIGNORE: + case RESPONSE_REMOVEIGNORE: { ResRemoveIgnore *R = static_cast(res); ChatAvatar *avatar = getAvatar(R->getAvatarID()); - if (!avatar && R->getResult()==CHATRESULT_SUCCESS) + if (!avatar && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_REMOVEIGNORE: avatar=%p\n", avatar); @@ -896,13 +896,13 @@ void ChatAPICore::responseCallback(GenericResponse *res) m_api->OnRemoveIgnore(R->getTrack(), R->getResult(), avatar, ChatUnicodeString(R->getName().data(), R->getName().size()), ChatUnicodeString(R->getAddress().data(), R->getAddress().size()), R->getUser()); } break; - case RESPONSE_ENTERROOM: + case RESPONSE_ENTERROOM: { ResEnterRoom *R = static_cast(res); ChatAvatar *avatar = getAvatar(R->getAvatarID()); ChatRoomCore *roomCore = R->getRoom(); ChatRoom *room = getRoom(R->getRoomID()); - + if (R->getResult() == 0) { if (!room && roomCore) @@ -922,7 +922,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) } else if (room && roomCore) { - // We already had room (and parents) cached, and our + // We already had room (and parents) cached, and our // ResEnterRoom object has created a new ChatRoomCore, // so we delete it because we don't need to cache it. delete roomCore; @@ -943,7 +943,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) _chatdebug_("ChatAPI:BadData: RESPONSE_ENTERROOM: avatar=%p, room=%p , roomCore=%p\n", avatar, room, roomCore); } } - if ((!avatar||!room) && R->getResult()==CHATRESULT_SUCCESS) + if ((!avatar || !room) && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_ENTERROOM: avatar=%p, room=%p\n", avatar, room); @@ -951,12 +951,12 @@ void ChatAPICore::responseCallback(GenericResponse *res) m_api->OnEnterRoom(R->getTrack(), R->getResult(), avatar, room, R->getUser()); } break; - case RESPONSE_ALLOWROOMENTRY: + case RESPONSE_ALLOWROOMENTRY: { ResAllowRoomEntry *R = static_cast(res); ChatAvatar *srcAvatar = getAvatar(R->getSrcAvatarID()); - if (!srcAvatar && R->getResult()==CHATRESULT_SUCCESS) + if (!srcAvatar && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_ALLOWROOMENTRY: srcAvatar=%p\n", srcAvatar); @@ -965,13 +965,13 @@ void ChatAPICore::responseCallback(GenericResponse *res) m_api->OnAllowRoomEntry(R->getTrack(), R->getResult(), srcAvatar, R->getDestRoomAddress(), R->getUser()); } break; - case RESPONSE_LEAVEROOM: + case RESPONSE_LEAVEROOM: { ResLeaveRoom *R = static_cast(res); ChatRoom *room = getRoom(R->getRoomID()); - + ChatAvatar *avatar = getAvatar(R->getAvatarID()); - if ((!avatar||!room) && R->getResult()==CHATRESULT_SUCCESS) + if ((!avatar || !room) && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_LEAVEROOM: avatar=%p, room=%p\n", avatar, room); @@ -979,12 +979,12 @@ void ChatAPICore::responseCallback(GenericResponse *res) m_api->OnLeaveRoom(R->getTrack(), R->getResult(), avatar, room, R->getUser()); } break; - case RESPONSE_ADDMODERATOR: + case RESPONSE_ADDMODERATOR: { ResAddModerator *R = static_cast(res); ChatAvatar *avatar = getAvatar(R->getSrcAvatarID()); ChatRoom *room = getRoom(R->getDestRoomID()); - if ((!avatar||!room) && R->getResult()==CHATRESULT_SUCCESS) + if ((!avatar || !room) && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_ADDMODERATOR: avatar=%p, room=%p\n", avatar, room); @@ -993,12 +993,12 @@ void ChatAPICore::responseCallback(GenericResponse *res) // cached room gets updated by MESSAGE_ADDMODERATOR } break; - case RESPONSE_REMOVEMODERATOR: + case RESPONSE_REMOVEMODERATOR: { ResRemoveModerator *R = static_cast(res); ChatAvatar *avatar = getAvatar(R->getSrcAvatarID()); ChatRoom *room = getRoom(R->getDestRoomID()); - if ((!avatar||!room) && R->getResult()==CHATRESULT_SUCCESS) + if ((!avatar || !room) && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_REMOVEMODERATOR: avatar=%p, room=%p\n", avatar, room); @@ -1007,12 +1007,12 @@ void ChatAPICore::responseCallback(GenericResponse *res) // cached room gets updated by MESSAGE_REMOVEMODERATOR } break; - case RESPONSE_ADDTEMPORARYMODERATOR: + case RESPONSE_ADDTEMPORARYMODERATOR: { ResAddTemporaryModerator *R = static_cast(res); ChatAvatar *avatar = getAvatar(R->getSrcAvatarID()); ChatRoom *room = getRoom(R->getDestRoomID()); - if ((!avatar||!room) && R->getResult()==CHATRESULT_SUCCESS) + if ((!avatar || !room) && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_ADDTEMPORARYMODERATOR: avatar=%p, room=%p\n", avatar, room); @@ -1021,12 +1021,12 @@ void ChatAPICore::responseCallback(GenericResponse *res) // cached room gets updated by MESSAGE_ADDMTEMPORARYODERATOR } break; - case RESPONSE_REMOVETEMPORARYMODERATOR: + case RESPONSE_REMOVETEMPORARYMODERATOR: { ResRemoveTemporaryModerator *R = static_cast(res); ChatAvatar *avatar = getAvatar(R->getSrcAvatarID()); ChatRoom *room = getRoom(R->getDestRoomID()); - if ((!avatar||!room) && R->getResult()==CHATRESULT_SUCCESS) + if ((!avatar || !room) && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_REMOVETEMPORARYMODERATOR: avatar=%p, room=%p\n", avatar, room); @@ -1035,12 +1035,12 @@ void ChatAPICore::responseCallback(GenericResponse *res) // cached room gets updated by MESSAGE_REMOVETEMPORARYMODERATOR } break; - case RESPONSE_ADDBAN: + case RESPONSE_ADDBAN: { ResAddBan *R = static_cast(res); ChatAvatar *avatar = getAvatar(R->getSrcAvatarID()); ChatRoom *room = getRoom(R->getDestRoomID()); - if ((!avatar||!room) && R->getResult()==CHATRESULT_SUCCESS) + if ((!avatar || !room) && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_ADDBAN: avatar=%p, room=%p\n", avatar, room); @@ -1049,12 +1049,12 @@ void ChatAPICore::responseCallback(GenericResponse *res) // cached room gets updated by MESSAGE_ADDBAN } break; - case RESPONSE_REMOVEBAN: + case RESPONSE_REMOVEBAN: { ResRemoveBan *R = static_cast(res); ChatAvatar *avatar = getAvatar(R->getSrcAvatarID()); ChatRoom *room = getRoom(R->getDestRoomID()); - if ((!avatar||!room) && R->getResult()==CHATRESULT_SUCCESS) + if ((!avatar || !room) && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_REMOVEBAN: avatar=%p, room=%p\n", avatar, room); @@ -1063,12 +1063,12 @@ void ChatAPICore::responseCallback(GenericResponse *res) // cached room gets updated by MESSAGE_REMOVEBAN } break; - case RESPONSE_ADDINVITE: + case RESPONSE_ADDINVITE: { ResAddInvite *R = static_cast(res); ChatAvatar *avatar = getAvatar(R->getSrcAvatarID()); ChatRoom *room = getRoom(R->getDestRoomID()); - if ((!avatar||!room) && R->getResult()==CHATRESULT_SUCCESS) + if ((!avatar || !room) && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_ADDINVITE: avatar=%p, room=%p\n", avatar, room); @@ -1077,12 +1077,12 @@ void ChatAPICore::responseCallback(GenericResponse *res) // cached room gets updated by MESSAGE_ADDINVITE } break; - case RESPONSE_REMOVEINVITE: + case RESPONSE_REMOVEINVITE: { ResRemoveInvite *R = static_cast(res); ChatAvatar *avatar = getAvatar(R->getSrcAvatarID()); ChatRoom *room = getRoom(R->getDestRoomID()); - if ((!avatar||!room) && R->getResult()==CHATRESULT_SUCCESS) + if ((!avatar || !room) && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_REMOVEINVITE: avatar=%p, room=%p\n", avatar, room); @@ -1091,12 +1091,12 @@ void ChatAPICore::responseCallback(GenericResponse *res) // cached room gets updated by MESSAGE_REMOVEINVITE } break; - case RESPONSE_GRANTVOICE: + case RESPONSE_GRANTVOICE: { ResGrantVoice *R = static_cast(res); ChatAvatar *avatar = getAvatar(R->getSrcAvatarID()); ChatRoom *room = getRoom(R->getDestRoomID()); - if ((!avatar||!room) && R->getResult()==CHATRESULT_SUCCESS) + if ((!avatar || !room) && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_GRANTVOICE: avatar=%p, room=%p\n", avatar, room); @@ -1105,12 +1105,12 @@ void ChatAPICore::responseCallback(GenericResponse *res) // cached room gets updated by MESSAGE_GRANTVOICE } break; - case RESPONSE_REVOKEVOICE: + case RESPONSE_REVOKEVOICE: { ResRevokeVoice *R = static_cast(res); ChatAvatar *avatar = getAvatar(R->getSrcAvatarID()); ChatRoom *room = getRoom(R->getDestRoomID()); - if ((!avatar||!room) && R->getResult()==CHATRESULT_SUCCESS) + if ((!avatar || !room) && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_REVOKEVOICE: avatar=%p, room=%p\n", avatar, room); @@ -1119,12 +1119,12 @@ void ChatAPICore::responseCallback(GenericResponse *res) // cached room gets updated by MESSAGE_REVOKEVOICE } break; - case RESPONSE_KICKAVATAR: + case RESPONSE_KICKAVATAR: { ResKickAvatar *R = static_cast(res); ChatAvatar *avatar = getAvatar(R->getSrcAvatarID()); ChatRoom *room = getRoom(R->getDestRoomID()); - if ((!avatar||!room) && R->getResult()==CHATRESULT_SUCCESS) + if ((!avatar || !room) && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_KICKAVATAR: avatar=%p, room=%p\n", avatar, room); @@ -1133,12 +1133,12 @@ void ChatAPICore::responseCallback(GenericResponse *res) // cached room gets updated by MESSAGE_KICK } break; - case RESPONSE_SETROOMPARAMS: + case RESPONSE_SETROOMPARAMS: { ResSetRoomParams *R = static_cast(res); ChatAvatar *avatar = getAvatar(R->getSrcAvatarID()); ChatRoom *room = getRoom(R->getDestRoomID()); - if ((!avatar||!room) && R->getResult()==CHATRESULT_SUCCESS) + if ((!avatar || !room) && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_SETROOMPARAMS: avatar=%p, room=%p\n", avatar, room); @@ -1148,12 +1148,12 @@ void ChatAPICore::responseCallback(GenericResponse *res) // cached room gets updated by MESSAGE_SETROOMPARAMS } break; - case RESPONSE_CHANGEROOMOWNER: + case RESPONSE_CHANGEROOMOWNER: { ResChangeRoomOwner *R = static_cast(res); ChatAvatar *avatar = getAvatar(R->getSrcAvatarID()); ChatRoom *room = getRoom(R->getDestRoomID()); - if ((!avatar||!room) && R->getResult()==CHATRESULT_SUCCESS) + if ((!avatar || !room) && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_CHANGEROOMOWNER: avatar=%p, room=%p\n", avatar, room); @@ -1163,7 +1163,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) // cached room gets updated by MESSAGE_CHANGEROOMOWNER } break; - case RESPONSE_GETROOMSUMMARIES: + case RESPONSE_GETROOMSUMMARIES: { ResGetRoomSummaries *R = static_cast(res); unsigned numRooms = R->getNumRooms(); @@ -1172,15 +1172,15 @@ void ChatAPICore::responseCallback(GenericResponse *res) m_api->OnGetRoomSummaries(R->getTrack(), R->getResult(), numRooms, foundRooms, R->getUser()); } break; - case RESPONSE_FINDAVATARBYUID: + case RESPONSE_FINDAVATARBYUID: { ResFindAvatarByUID *R = static_cast(res); ChatAvatar **avatarMatches = nullptr; ChatAvatarCore **avatarCoreMatches = nullptr; - + unsigned numAvatarsOnline = R->getNumAvatarsOnline(); - if(R->getResult() == CHATRESULT_SUCCESS) + if (R->getResult() == CHATRESULT_SUCCESS) { avatarCoreMatches = R->getAvatarsCore(); avatarMatches = new ChatAvatar*[numAvatarsOnline]; @@ -1192,14 +1192,14 @@ void ChatAPICore::responseCallback(GenericResponse *res) m_api->OnFindAvatarByUID(R->getTrack(), R->getResult(), numAvatarsOnline, avatarMatches, R->getUser()); - delete [] avatarMatches; + delete[] avatarMatches; } break; - case RESPONSE_SENDPERSISTENTMESSAGE: + case RESPONSE_SENDPERSISTENTMESSAGE: { ResSendPersistentMessage *R = static_cast(res); ChatAvatar *avatar = getAvatar(R->getSrcAvatarID()); - if (!avatar && R->getResult()==CHATRESULT_SUCCESS) + if (!avatar && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_SENDPERSISTENTMESSAGE: avatar=%p\n", avatar); @@ -1208,11 +1208,11 @@ void ChatAPICore::responseCallback(GenericResponse *res) m_api->OnSendPersistentMessage(R->getTrack(), R->getResult(), avatar, R->getMessageID(), R->getUser()); } break; - case RESPONSE_SENDMULTIPLEPERSISTENTMESSAGES: + case RESPONSE_SENDMULTIPLEPERSISTENTMESSAGES: { ResSendMultiplePersistentMessages *R = static_cast(res); ChatAvatar *avatar = getAvatar(R->getSrcAvatarID()); - if (!avatar && R->getResult()==CHATRESULT_SUCCESS) + if (!avatar && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_SENDMULTIPLEPERSISTENTMESSAGES: avatar=%p\n", avatar); @@ -1221,7 +1221,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) m_api->OnSendMultiplePersistentMessages(R->getTrack(), R->getResult(), R->getNumResults(), &R->getResultVector()[0], &R->getMessageIDvector()[0], avatar, R->getUser()); } break; - case RESPONSE_ALTERPERSISTENTMESSAGE: + case RESPONSE_ALTERPERSISTENTMESSAGE: { ResAlterPersistentMessage *R = static_cast(res); ChatUnicodeString destAvatarName(R->getDestAvatarName().data(), R->getDestAvatarName().length()); @@ -1230,13 +1230,13 @@ void ChatAPICore::responseCallback(GenericResponse *res) m_api->OnAlterPersistentMessage(R->getTrack(), R->getResult(), destAvatarName, destAvatarAddress, R->getMessageID()); } break; - case RESPONSE_GETPERSISTENTMESSAGE: + case RESPONSE_GETPERSISTENTMESSAGE: { ResGetPersistentMessage *R = static_cast(res); ChatAvatar *avatar = getAvatar(R->getSrcAvatarID()); ChatUnicodeString message(R->getMsg().data(), R->getMsg().size()); ChatUnicodeString oobdata(R->getOOB().data(), R->getOOB().size()); - if (!avatar && R->getResult()==CHATRESULT_SUCCESS) + if (!avatar && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_GETPERSISTENTMESSAGE: avatar=%p\n", avatar); @@ -1244,11 +1244,11 @@ void ChatAPICore::responseCallback(GenericResponse *res) m_api->OnGetPersistentMessage(R->getTrack(), R->getResult(), avatar, R->getHeader(), message, oobdata, R->getUser()); } break; - case RESPONSE_GETMULTIPLEPERSISTENTMESSAGES: - { + case RESPONSE_GETMULTIPLEPERSISTENTMESSAGES: + { ResGetMultiplePersistentMessages *R = static_cast(res); ChatAvatar *avatar = getAvatar(R->getSrcAvatarID()); - if (!avatar && R->getResult()==CHATRESULT_SUCCESS) + if (!avatar && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_GETMULTIPLEPERSISTENTMESSAGES: avatar=%p\n", avatar); @@ -1256,11 +1256,11 @@ void ChatAPICore::responseCallback(GenericResponse *res) m_api->OnGetMultiplePersistentMessages(R->getTrack(), R->getResult(), avatar, R->getListLength(), R->getList(), R->getUser()); } break; - case RESPONSE_UPDATEPERSISTENTMESSAGE: + case RESPONSE_UPDATEPERSISTENTMESSAGE: { ResUpdatePersistentMessage *R = static_cast(res); ChatAvatar *avatar = getAvatar(R->getSrcAvatarID()); - if (!avatar && R->getResult()==CHATRESULT_SUCCESS) + if (!avatar && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_UPDATEPERSISTENTMESSAGE: avatar=%p\n", avatar); @@ -1268,11 +1268,11 @@ void ChatAPICore::responseCallback(GenericResponse *res) m_api->OnUpdatePersistentMessage(R->getTrack(), R->getResult(), avatar, R->getUser()); } break; - case RESPONSE_UPDATEPERSISTENTMESSAGES: + case RESPONSE_UPDATEPERSISTENTMESSAGES: { ResUpdatePersistentMessages *R = static_cast(res); ChatAvatar *avatar = getAvatar(R->getSrcAvatarID()); - if (!avatar && R->getResult()==CHATRESULT_SUCCESS) + if (!avatar && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_UPDATEPERSISTENTMESSAGES: avatar=%p\n", avatar); @@ -1280,11 +1280,11 @@ void ChatAPICore::responseCallback(GenericResponse *res) m_api->OnUpdatePersistentMessages(R->getTrack(), R->getResult(), avatar, R->getUser()); } break; - case RESPONSE_CHANGEPERSISTENTFOLDER: + case RESPONSE_CHANGEPERSISTENTFOLDER: { ResClassifyPersistentMessages *R = static_cast(res); ChatAvatar *avatar = getAvatar(R->getSrcAvatarID()); - if (!avatar && R->getResult()==CHATRESULT_SUCCESS) + if (!avatar && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_CHANGEPERSISTENTFOLDER: avatar=%p\n", avatar); @@ -1292,18 +1292,18 @@ void ChatAPICore::responseCallback(GenericResponse *res) m_api->OnClassifyPersistentMessages(R->getTrack(), R->getResult(), avatar, R->getUser()); } break; - case RESPONSE_PURGEPERSISTENTMESSAGES: + case RESPONSE_PURGEPERSISTENTMESSAGES: { ResDeleteAllPersistentMessages *R = static_cast(res); m_api->OnDeleteAllPersistentMessages(R->getTrack(), R->getResult(), R->getAvatarName(), R->getAvatarAddress(), R->getNumberDeleted(), R->getUser()); } break; - case RESPONSE_GETPERSISTENTHEADERS: + case RESPONSE_GETPERSISTENTHEADERS: { ResGetPersistentHeaders *R = static_cast(res); ChatAvatar *avatar = getAvatar(R->getSrcAvatarID()); - if (!avatar && R->getResult()==CHATRESULT_SUCCESS) + if (!avatar && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_GETPERSISTENTHEADERS: avatar=%p\n", avatar); @@ -1311,11 +1311,11 @@ void ChatAPICore::responseCallback(GenericResponse *res) m_api->OnGetPersistentHeaders(R->getTrack(), R->getResult(), avatar, R->getListLength(), R->getList(), R->getUser()); } break; - case RESPONSE_PARTIALPERSISTENTHEADERS: + case RESPONSE_PARTIALPERSISTENTHEADERS: { ResGetPartialPersistentHeaders *R = static_cast(res); ChatAvatar *avatar = getAvatar(R->getSrcAvatarID()); - if (!avatar && R->getResult()==CHATRESULT_SUCCESS) + if (!avatar && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_GETPARTIALPERSISTENTHEADERS: avatar=%p\n", avatar); @@ -1323,18 +1323,18 @@ void ChatAPICore::responseCallback(GenericResponse *res) m_api->OnGetPartialPersistentHeaders(R->getTrack(), R->getResult(), avatar, R->getListLength(), R->getList(), R->getUser()); } break; - case RESPONSE_COUNTPERSISTENTMESSAGES: + case RESPONSE_COUNTPERSISTENTMESSAGES: { ResCountPersistentMessages *R = static_cast(res); - + m_api->OnCountPersistentMessages(R->getTrack(), R->getResult(), R->getAvatarName(), R->getAvatarAddress(), R->getNumberOfMessages(), R->getUser()); } break; - case RESPONSE_UNREGISTERROOM: + case RESPONSE_UNREGISTERROOM: { ResUnregisterRoom *R = static_cast(res); ChatRoom *room = getRoom(R->getDestRoomID()); - if (!room && R->getResult()==CHATRESULT_SUCCESS) + if (!room && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_UNREGISTERROOM: room=%p\n", room); @@ -1348,11 +1348,11 @@ void ChatAPICore::responseCallback(GenericResponse *res) } } break; - case RESPONSE_IGNORESTATUS: + case RESPONSE_IGNORESTATUS: { ResIgnoreStatus *R = static_cast(res); ChatAvatar *avatar = getAvatar(R->getAvatarID()); - if (!avatar && R->getResult()==CHATRESULT_SUCCESS) + if (!avatar && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_IGNORESTATUS: avatar=%p\n", avatar); @@ -1360,10 +1360,10 @@ void ChatAPICore::responseCallback(GenericResponse *res) m_api->OnIgnoreStatus(R->getTrack(), R->getResult(), avatar, R->getListLength(), R->getIgnoreList(), R->getUser()); } break; - case RESPONSE_FAILOVER_RELOGINAVATAR: + case RESPONSE_FAILOVER_RELOGINAVATAR: { ResFailoverReloginAvatar *R = static_cast(res); - + unsigned result = R->getResult(); if (result != 0 && result != CHATRESULT_DUPLICATELOGIN) { @@ -1377,7 +1377,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) m_api->OnLogoutAvatar(0, 0, avatar, nullptr); } } - + m_failoverAvatarResRemain--; if (!m_failoverAvatarResRemain) @@ -1386,14 +1386,14 @@ void ChatAPICore::responseCallback(GenericResponse *res) } } break; - case RESPONSE_FAILOVER_RECREATEROOM: + case RESPONSE_FAILOVER_RECREATEROOM: { ResFailoverRecreateRoom *R = static_cast(res); if (R->getResult() == 0) { ChatRoomCore *rcvdRoom = R->getRoom(); - + if (rcvdRoom) { ChatRoomCore *roomCore = getRoomCore(R->getRoomID()); @@ -1405,11 +1405,10 @@ void ChatAPICore::responseCallback(GenericResponse *res) } else { - // MAKE APPROPRIATE CHANGES to the cached roomCore object - + // creator values should NEVER change - + // CHECK room values (attribs, topic, maxsize, id) // (name, address, createtime should NEVER change) if (roomCore->getRoomID() != rcvdRoom->getRoomID()) @@ -1444,21 +1443,21 @@ void ChatAPICore::responseCallback(GenericResponse *res) ChatUnicodeString cus2(pus2.data(), pus2.size()); ChatAvatar dummySrcAvatar(0, 0, cus1, cus1, cus2, cus2, 0, 0); - + ChatRoom *destRoom = getRoom(R->getRoomID()); - - if (!destRoom && R->getResult()==CHATRESULT_SUCCESS) + + if (!destRoom && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_FAILOVER_RECREATEROOM: destRoom=%p\n", destRoom); } m_api->OnReceiveDestroyRoom(&dummySrcAvatar, destRoom); - + destRoomCore = decacheRoom(R->getRoomID()); delete destRoomCore; } } - + if (R->wasFailoverForcedByServer() == false) { m_failoverRoomResRemain--; @@ -1473,16 +1472,16 @@ void ChatAPICore::responseCallback(GenericResponse *res) } } break; - case RESPONSE_GETAVATARKEYWORDS: + case RESPONSE_GETAVATARKEYWORDS: { ResGetAvatarKeywords *R = static_cast(res); ChatAvatar *avatar = nullptr; - if(R->getResult() == CHATRESULT_SUCCESS) + if (R->getResult() == CHATRESULT_SUCCESS) { avatar = getAvatar(R->getAvatarID()); } - if (!avatar && R->getResult()==CHATRESULT_SUCCESS) + if (!avatar && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_GETAVATARKEYWORDS: avatar=%p\n", avatar); @@ -1491,15 +1490,15 @@ void ChatAPICore::responseCallback(GenericResponse *res) } break; - case RESPONSE_SETAVATARKEYWORDS: + case RESPONSE_SETAVATARKEYWORDS: { ResSetAvatarKeywords *R = static_cast(res); ChatAvatar *avatar = nullptr; - if(R->getResult() == CHATRESULT_SUCCESS) + if (R->getResult() == CHATRESULT_SUCCESS) { avatar = getAvatar(R->getAvatarID()); } - if (!avatar && R->getResult()==CHATRESULT_SUCCESS) + if (!avatar && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_SETAVATARKEYWORDS: avatar=%p\n", avatar); @@ -1507,13 +1506,13 @@ void ChatAPICore::responseCallback(GenericResponse *res) m_api->OnSetAvatarKeywords(R->getTrack(), R->getResult(), avatar, R->getUser()); } break; - case RESPONSE_SEARCHAVATARKEYWORDS: + case RESPONSE_SEARCHAVATARKEYWORDS: { ResSearchAvatarKeywords *R = static_cast(res); ChatAvatar **avatarMatches = nullptr; ChatAvatarCore **avatarCoreMatches = nullptr; - - if(R->getResult() == CHATRESULT_SUCCESS) + + if (R->getResult() == CHATRESULT_SUCCESS) { avatarCoreMatches = R->getMatches(); avatarMatches = new ChatAvatar*[R->getNumMatches()]; @@ -1524,18 +1523,18 @@ void ChatAPICore::responseCallback(GenericResponse *res) } m_api->OnSearchAvatarKeywords(R->getTrack(), R->getResult(), avatarMatches, R->getNumMatches(), R->getUser()); - delete [] avatarMatches; + delete[] avatarMatches; } break; - case RESPONSE_CONFIRMFRIEND: + case RESPONSE_CONFIRMFRIEND: { ResFriendConfirm *R = static_cast(res); ChatAvatar *avatar = nullptr; - if(R->getResult() == CHATRESULT_SUCCESS) + if (R->getResult() == CHATRESULT_SUCCESS) { avatar = getAvatar(R->getAvatarID()); } - if (!avatar && R->getResult()==CHATRESULT_SUCCESS) + if (!avatar && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_CONFIRMFRIEND: avatar=%p\n", avatar); @@ -1543,15 +1542,15 @@ void ChatAPICore::responseCallback(GenericResponse *res) m_api->OnFriendConfirm(R->getTrack(), R->getResult(), avatar, R->getUser()); } break; - case RESPONSE_CONFIRMFRIEND_RECIPROCATE: + case RESPONSE_CONFIRMFRIEND_RECIPROCATE: { ResFriendConfirmReciprocate *R = static_cast(res); ChatAvatar *avatar = nullptr; - if(R->getResult() == CHATRESULT_SUCCESS) + if (R->getResult() == CHATRESULT_SUCCESS) { avatar = getAvatar(R->getAvatarID()); } - if (!avatar && R->getResult()==CHATRESULT_SUCCESS) + if (!avatar && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_CONFIRMFRIEND_RECIPROCATE: avatar=%p\n", avatar); @@ -1559,20 +1558,20 @@ void ChatAPICore::responseCallback(GenericResponse *res) m_api->OnFriendConfirmReciprocate(R->getTrack(), R->getResult(), avatar, R->getUser()); } break; - case RESPONSE_REGISTRAR_GETCHATSERVER: + case RESPONSE_REGISTRAR_GETCHATSERVER: { ResRegistrarGetChatServer *R = static_cast(res); - + m_rcvdRegistrarResponse = true; if (R->getResult() == CHATRESULT_SUCCESS) { m_assignedServerHost = wideToNarrow(R->getHostname()).c_str(); - m_assignedServerPort = (short) R->getPort(); + m_assignedServerPort = (short)R->getPort(); } } break; - case RESPONSE_SETAPIVERSION: + case RESPONSE_SETAPIVERSION: { ResSendApiVersion *R = static_cast(res); @@ -1613,15 +1612,15 @@ void ChatAPICore::responseCallback(GenericResponse *res) } } break; - case RESPONSE_ADDSNOOPAVATAR: + case RESPONSE_ADDSNOOPAVATAR: { ResAddSnoopAvatar *R = static_cast(res); ChatAvatar *avatar = nullptr; - if(R->getResult() == CHATRESULT_SUCCESS) + if (R->getResult() == CHATRESULT_SUCCESS) { avatar = getAvatar(R->getSrcAvatarID()); } - if (!avatar && R->getResult()==CHATRESULT_SUCCESS) + if (!avatar && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_ADDSNOOPAVATAR: avatar=%p\n", avatar); @@ -1629,15 +1628,15 @@ void ChatAPICore::responseCallback(GenericResponse *res) m_api->OnBeginSnoopingAvatar(R->getTrack(), R->getResult(), avatar, ChatUnicodeString(R->getDestAvatarName()), ChatUnicodeString(R->getDestAvatarAddress()), R->getUser()); } break; - case RESPONSE_REMOVESNOOPAVATAR: + case RESPONSE_REMOVESNOOPAVATAR: { ResRemoveSnoopAvatar *R = static_cast(res); ChatAvatar *avatar = nullptr; - if(R->getResult() == CHATRESULT_SUCCESS) + if (R->getResult() == CHATRESULT_SUCCESS) { avatar = getAvatar(R->getSrcAvatarID()); } - if (!avatar && R->getResult()==CHATRESULT_SUCCESS) + if (!avatar && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_REMOVESNOOPAVATAR: avatar=%p\n", avatar); @@ -1645,15 +1644,15 @@ void ChatAPICore::responseCallback(GenericResponse *res) m_api->OnStopSnoopingAvatar(R->getTrack(), R->getResult(), avatar, ChatUnicodeString(R->getDestAvatarName()), ChatUnicodeString(R->getDestAvatarAddress()), R->getUser()); } break; - case RESPONSE_ADDSNOOPROOM: + case RESPONSE_ADDSNOOPROOM: { ResAddSnoopRoom *R = static_cast(res); ChatAvatar *avatar = nullptr; - if(R->getResult() == CHATRESULT_SUCCESS) + if (R->getResult() == CHATRESULT_SUCCESS) { avatar = getAvatar(R->getSrcAvatarID()); } - if (!avatar && R->getResult()==CHATRESULT_SUCCESS) + if (!avatar && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_ADDSNOOPROOM: avatar=%p\n", avatar); @@ -1661,15 +1660,15 @@ void ChatAPICore::responseCallback(GenericResponse *res) m_api->OnBeginSnoopingRoom(R->getTrack(), R->getResult(), avatar, ChatUnicodeString(R->getRoomAddress()), R->getUser()); } break; - case RESPONSE_REMOVESNOOPROOM: + case RESPONSE_REMOVESNOOPROOM: { ResRemoveSnoopRoom *R = static_cast(res); ChatAvatar *avatar = nullptr; - if(R->getResult() == CHATRESULT_SUCCESS) + if (R->getResult() == CHATRESULT_SUCCESS) { avatar = getAvatar(R->getSrcAvatarID()); } - if (!avatar && R->getResult()==CHATRESULT_SUCCESS) + if (!avatar && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_REMOVESNOOPROOM: avatar=%p\n", avatar); @@ -1677,15 +1676,15 @@ void ChatAPICore::responseCallback(GenericResponse *res) m_api->OnStopSnoopingRoom(R->getTrack(), R->getResult(), avatar, ChatUnicodeString(R->getRoomAddress()), R->getUser()); } break; - case RESPONSE_GETSNOOPLIST: + case RESPONSE_GETSNOOPLIST: { ResGetSnoopList *R = static_cast(res); ChatAvatar *avatar = nullptr; - if(R->getResult() == CHATRESULT_SUCCESS) + if (R->getResult() == CHATRESULT_SUCCESS) { avatar = getAvatar(R->getSrcAvatarID()); } - if (!avatar && R->getResult()==CHATRESULT_SUCCESS) + if (!avatar && R->getResult() == CHATRESULT_SUCCESS) { R->setResult(CHATRESULT_SUCCESSBADDATA); _chatdebug_("ChatAPI:BadData: RESPONSE_REMOVESNOOPROOM: avatar=%p\n", avatar); @@ -1693,11 +1692,11 @@ void ChatAPICore::responseCallback(GenericResponse *res) AvatarSnoopPair **avatarList = nullptr; ChatUnicodeString **roomList = nullptr; - + unsigned numAvatars = R->getAvatarSnoopListLength(); unsigned numRooms = R->getRoomSnoopListLength(); - if(R->getResult() == CHATRESULT_SUCCESS) + if (R->getResult() == CHATRESULT_SUCCESS) { avatarList = R->getAvatarSnoopList(); roomList = R->getRoomSnoopList(); @@ -1706,7 +1705,7 @@ void ChatAPICore::responseCallback(GenericResponse *res) m_api->OnGetSnoopList(R->getTrack(), R->getResult(), avatar, numAvatars, avatarList, numRooms, roomList, R->getUser()); } break; - case RESPONSE_TRANSFERAVATAR: + case RESPONSE_TRANSFERAVATAR: { ResTransferAvatar *R = static_cast(res); @@ -1714,51 +1713,51 @@ void ChatAPICore::responseCallback(GenericResponse *res) } break; - default: - fprintf(stderr, "[ChatAPICore.cpp] default (response) responseCallback(GenericResponse *), type = %u\n", res->getType()); + default: + fprintf(stderr, "[ChatAPICore.cpp] default (response) responseCallback(GenericResponse *), type = %u\n", res->getType()); + } } -} -void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) -{ - switch(type) + void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) { - case MESSAGE_INSTANTMESSAGE: + switch (type) + { + case MESSAGE_INSTANTMESSAGE: { MInstantMessage M(iter); ChatAvatar *destAvatar = getAvatar(M.getDestAvatarID()); if (!M.getSrcAvatar()) { _chatdebug_("ChatAPI:BadData: MESSAGE_INSTANTMESSAGE: M.getSrcAvatar()=%p\n", M.getSrcAvatar()); - break; + break; } ChatAvatar *srcAvatar = M.getSrcAvatar()->getNewChatAvatar(); if (!destAvatar || !srcAvatar) { _chatdebug_("ChatAPI:BadData: MESSAGE_INSTANTMESSAGE: srcAvatar=%p, destAvatar=%p\n", srcAvatar, destAvatar); - delete srcAvatar; - break; + delete srcAvatar; + break; } m_api->OnReceiveInstantMessage(srcAvatar, destAvatar, ChatUnicodeString(M.getMsg().data(), M.getMsg().size()), ChatUnicodeString(M.getOOB().data(), M.getOOB().size())); delete srcAvatar; } break; - case MESSAGE_ROOMMESSAGE: + case MESSAGE_ROOMMESSAGE: { MRoomMessage M(iter); ChatRoom *destRoom = getRoom(M.getRoomID()); if (!M.getSrcAvatar() || !destRoom) { _chatdebug_("ChatAPI:BadData: MESSAGE_ROOMMESSAGE: M.getSrcAvatar()=%p, destRoom=%p\n", M.getSrcAvatar(), destRoom); - break; + break; } ChatAvatar *srcAvatar = M.getSrcAvatar()->getNewChatAvatar(); if (!srcAvatar) { _chatdebug_("ChatAPI:BadData: MESSAGE_ROOMMESSAGE: srcAvatar=%p\n", srcAvatar); - break; + break; } - for(unsigned i = 0; i < M.getListLength(); i++) + for (unsigned i = 0; i < M.getListLength(); i++) { ChatAvatar *destAvatar = getAvatar(M.getDestList()[i]); if (!destAvatar) @@ -1778,24 +1777,24 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) delete srcAvatar; } break; - case MESSAGE_BROADCASTMESSAGE: + case MESSAGE_BROADCASTMESSAGE: { MBroadcastMessage M(iter); if (!M.getSrcAvatar()) { _chatdebug_("ChatAPI:BadData: MESSAGE_BROADCASTMESSAGE: M.getSrcAvatar()=%p\n", M.getSrcAvatar()); - break; + break; } ChatAvatar *srcAvatar = M.getSrcAvatar()->getNewChatAvatar(); if (!srcAvatar) { _chatdebug_("ChatAPI:BadData: MESSAGE_BROADCASTMESSAGE: srcAvatar=%p\n", srcAvatar); - break; + break; } - for(unsigned i = 0; i < M.getListLength(); i++) + for (unsigned i = 0; i < M.getListLength(); i++) { ChatAvatar *destAvatar = getAvatar(M.getDestList()[i]); - if (!destAvatar) + if (!destAvatar) { _chatdebug_("ChatAPI:BadData: MESSAGE_BROADCASTMESSAGE: destAvatar[%i]=nullptr\n", i); continue; @@ -1805,73 +1804,73 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) delete srcAvatar; } break; - case MESSAGE_FILTERMESSAGE: + case MESSAGE_FILTERMESSAGE: { MFilterMessage M(iter); m_api->OnReceiveFilterMessage(ChatUnicodeString(M.getMsg().data(), M.getMsg().size())); } break; - case MESSAGE_FRIENDLOGIN: + case MESSAGE_FRIENDLOGIN: { MFriendLogin M(iter); ChatAvatar *destAvatar = getAvatar(M.getDestAvatarID()); if (!M.getFriendAvatar() || !destAvatar) { _chatdebug_("ChatAPI:BadData: MESSAGE_FRIENDLOGIN: M.getFriendAvatar()=%p, destAvatar=%p\n", M.getFriendAvatar(), destAvatar); - break; + break; } ChatAvatar *friendAvatar = M.getFriendAvatar()->getNewChatAvatar(); if (!friendAvatar) { _chatdebug_("ChatAPI:BadData: MESSAGE_FRIENDLOGIN: friendAvatar=%p\n", friendAvatar); - break; + break; } - - friendAvatar->setStatusMessage( M.getFriendStatusMessage() ); + + friendAvatar->setStatusMessage(M.getFriendStatusMessage()); m_api->OnReceiveFriendLogin(friendAvatar, ChatUnicodeString(M.getFriendAddress().data(), M.getFriendAddress().size()), destAvatar); delete friendAvatar; } break; - case MESSAGE_FRIENDLOGOUT: + case MESSAGE_FRIENDLOGOUT: { MFriendLogout M(iter); ChatAvatar *destAvatar = getAvatar(M.getDestAvatarID()); if (!M.getFriendAvatar() || !destAvatar) { _chatdebug_("ChatAPI:BadData: MESSAGE_FRIENDLOGOUT: M.getFriendAvatar()=%p, destAvatar=%p\n", M.getFriendAvatar(), destAvatar); - break; + break; } ChatAvatar *friendAvatar = M.getFriendAvatar()->getNewChatAvatar(); if (!friendAvatar) { _chatdebug_("ChatAPI:BadData: MESSAGE_FRIENDLOGOUT: friendAvatar=%p\n", friendAvatar); - break; + break; } m_api->OnReceiveFriendLogout(friendAvatar, ChatUnicodeString(M.getFriendAddress().data(), M.getFriendAddress().size()), destAvatar); delete friendAvatar; } break; - case MESSAGE_FRIENDSTATUS: - { - MFriendStatus M(iter); - ChatAvatar *destAvatar = getAvatar(M.getDestAvatarID()); - if (!M.getFriendAvatar() || !destAvatar) - { - _chatdebug_("ChatAPI:BadData: MESSAGE_FRIENDSTATUS: M.getFriendAvatar()=%p, destAvatar=%p\n", M.getFriendAvatar(), destAvatar); - break; - } - ChatAvatar *friendAvatar = M.getFriendAvatar()->getNewChatAvatar(); - if (!friendAvatar) - { - _chatdebug_("ChatAPI:BadData: MESSAGE_FRIENDSTATUS: friendAvatar=%p\n", friendAvatar); - break; - } - friendAvatar->setStatusMessage( M.getFriendStatusMessage() ); - m_api->OnReceiveFriendStatusChange(friendAvatar, ChatUnicodeString(M.getFriendAddress().data(), M.getFriendAddress().size()), destAvatar); - delete friendAvatar; - } - break; - case MESSAGE_KICKROOM: + case MESSAGE_FRIENDSTATUS: + { + MFriendStatus M(iter); + ChatAvatar *destAvatar = getAvatar(M.getDestAvatarID()); + if (!M.getFriendAvatar() || !destAvatar) + { + _chatdebug_("ChatAPI:BadData: MESSAGE_FRIENDSTATUS: M.getFriendAvatar()=%p, destAvatar=%p\n", M.getFriendAvatar(), destAvatar); + break; + } + ChatAvatar *friendAvatar = M.getFriendAvatar()->getNewChatAvatar(); + if (!friendAvatar) + { + _chatdebug_("ChatAPI:BadData: MESSAGE_FRIENDSTATUS: friendAvatar=%p\n", friendAvatar); + break; + } + friendAvatar->setStatusMessage(M.getFriendStatusMessage()); + m_api->OnReceiveFriendStatusChange(friendAvatar, ChatUnicodeString(M.getFriendAddress().data(), M.getFriendAddress().size()), destAvatar); + delete friendAvatar; + } + break; + case MESSAGE_KICKROOM: { MKickRoom M(iter); ChatRoomCore *destRoomCore = getRoomCore(M.getRoomID()); @@ -1884,21 +1883,25 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) if (!M.getSrcAvatar() || !M.getDestAvatar()) { _chatdebug_("ChatAPI:BadData: MESSAGE_KICKROOM: M.getSrcAvatar()=%p, M.getDestAvatar()=%p\n", M.getSrcAvatar(), M.getDestAvatar()); - break; + break; } ChatAvatar *destAvatar = M.getDestAvatar()->getNewChatAvatar(); ChatAvatar *srcAvatar = M.getSrcAvatar()->getNewChatAvatar(); - ChatAvatarCore *kickedAvatar = destRoomCore ? destRoomCore->removeAvatar(destAvatar->getAvatarID()) : nullptr; - + ChatAvatarCore *kickedAvatar = nullptr; + + if (destAvatar != nullptr) { + kickedAvatar = destRoomCore ? destRoomCore->removeAvatar(destAvatar->getAvatarID()) : nullptr; + } + ChatRoom *destRoom = getRoom(M.getRoomID()); - if (!srcAvatar || !destAvatar || !kickedAvatar || !destRoom) + if (!srcAvatar || !destAvatar || !kickedAvatar || !destRoom) { _chatdebug_("ChatAPI:BadData: MESSAGE_KICKROOM: srcAvatar=%p, destAvatar=%p, kickedAvatar=%p, destRoom=%p\n", srcAvatar, destAvatar, kickedAvatar, destRoom); - delete srcAvatar; - delete destAvatar; + delete srcAvatar; + delete destAvatar; delete kickedAvatar; - break; + break; } m_api->OnReceiveKickRoom(srcAvatar, destAvatar, destRoom); @@ -1907,7 +1910,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) delete srcAvatar; } break; - case MESSAGE_ADDMODERATORROOM: + case MESSAGE_ADDMODERATORROOM: { MAddModeratorRoom M(iter); ChatRoomCore *destRoomCore = getRoomCore(M.getRoomID()); @@ -1918,32 +1921,32 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) delete M.getDestAvatar(); break; } - + const ChatAvatar *srcAvatar = destRoomCore->getAvatar(M.getSrcAvatarID()); ChatAvatarCore *destAvatarCore = M.getDestAvatar(); if (!srcAvatar || !destAvatarCore) { _chatdebug_("ChatAPI:BadData: MESSAGE_ADDMODERATORROOM: srcAvatar=%p, destAvatarCore=%p\n", srcAvatar, destAvatarCore); delete M.getDestAvatar(); - break; + break; } ChatAvatar *destAvatar = destAvatarCore->getNewChatAvatar(); if (!destRoomCore->addModerator(destAvatarCore)) { - delete M.getDestAvatar(); + delete M.getDestAvatar(); } if (!destAvatar) { _chatdebug_("ChatAPI:BadData: MESSAGE_ADDMODERATORROOM: destAvatar=%p\n", destAvatar); - break; + break; } m_api->OnReceiveAddModeratorRoom(srcAvatar, destAvatar, destRoom); delete destAvatar; } break; - case MESSAGE_REMOVEMODERATORROOM: + case MESSAGE_REMOVEMODERATORROOM: { MRemoveModeratorRoom M(iter); ChatRoomCore *destRoomCore = getRoomCore(M.getRoomID()); @@ -1951,7 +1954,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) if (!destRoomCore || !destRoom) { _chatdebug_("ChatAPI:BadData: MESSAGE_REMOVEMODERATORROOM: destRoomCore=%p, destRoom=%p\n", destRoomCore, destRoom); - break; + break; } ChatAvatarCore *destAvatarCore = destRoomCore->removeModerator(M.getDestAvatarName(), M.getDestAvatarAddress()); @@ -1959,16 +1962,16 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) const ChatAvatar *srcAvatar = destRoomCore->getAvatar(M.getSrcAvatarID()); if (!destAvatarCore) { - _chatdebug_("ChatAPI:BadData: MESSAGE_REMOVEMODERATORROOM: destAvatarCore=%p\n", destAvatarCore); - delete destAvatarCore; - break; + _chatdebug_("ChatAPI:BadData: MESSAGE_REMOVEMODERATORROOM: destAvatarCore=%p\n", destAvatarCore); + delete destAvatarCore; + break; } ChatAvatar *destAvatar = destAvatarCore->getNewChatAvatar(); if (!srcAvatar || !destAvatar) { _chatdebug_("ChatAPI:BadData: MESSAGE_REMOVEMODERATORROOM: srcAvatar=%p, destAvatar=%p\n", srcAvatar, destAvatar); - delete destAvatar; - break; + delete destAvatar; + break; } m_api->OnReceiveRemoveModeratorRoom(srcAvatar, destAvatar, destRoom); @@ -1976,13 +1979,13 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) delete destAvatar; } break; - case MESSAGE_REMOVEMODERATORAVATAR: + case MESSAGE_REMOVEMODERATORAVATAR: { MRemoveModeratorAvatar M(iter); if (!M.getSrcAvatar() || !M.getDestAvatar()) { _chatdebug_("ChatAPI:BadData: MESSAGE_REMOVEMODERATORAVATAR: M.getSrcAvatar()=%p, M.getDestAvatar()=%p\n", M.getSrcAvatar(), M.getDestAvatar()); - break; + break; } ChatAvatar *srcAvatar = M.getSrcAvatar()->getNewChatAvatar(); @@ -1990,16 +1993,16 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) if (!srcAvatar || !destAvatar) { _chatdebug_("ChatAPI:BadData: MESSAGE_REMOVEMODERATORAVATAR: srcAvatar=%p, destAvatar=%p\n", srcAvatar, destAvatar); - delete srcAvatar; - delete destAvatar; - break; + delete srcAvatar; + delete destAvatar; + break; } m_api->OnReceiveRemoveModeratorAvatar(srcAvatar, destAvatar, ChatUnicodeString(M.getRoomName().data(), M.getRoomName().size()), ChatUnicodeString(M.getRoomAddress().data(), M.getRoomAddress().size())); delete srcAvatar; delete destAvatar; } break; - case MESSAGE_ADDTEMPORARYMODERATORROOM: + case MESSAGE_ADDTEMPORARYMODERATORROOM: { MAddTemporaryModeratorRoom M(iter); ChatRoomCore *destRoomCore = getRoomCore(M.getRoomID()); @@ -2010,32 +2013,32 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) delete M.getDestAvatar(); break; } - + const ChatAvatar *srcAvatar = destRoomCore->getAvatar(M.getSrcAvatarID()); ChatAvatarCore *destAvatarCore = M.getDestAvatar(); if (!srcAvatar || !destAvatarCore) { _chatdebug_("ChatAPI:BadData: MESSAGE_ADDTEMPORARYMODERATORROOM: srcAvatar=%p, destAvatarCore=%p\n", srcAvatar, destAvatarCore); delete M.getDestAvatar(); - break; + break; } ChatAvatar *destAvatar = destAvatarCore->getNewChatAvatar(); if (!destRoomCore->addTempModerator(destAvatarCore)) { - delete M.getDestAvatar(); + delete M.getDestAvatar(); } if (!destAvatar) { _chatdebug_("ChatAPI:BadData: MESSAGE_ADDTEMPORARYMODERATORROOM: destAvatar=%p\n", destAvatar); - break; + break; } m_api->OnReceiveAddTemporaryModeratorRoom(srcAvatar, destAvatar, destRoom); delete destAvatar; } break; - case MESSAGE_REMOVETEMPORARYMODERATORROOM: + case MESSAGE_REMOVETEMPORARYMODERATORROOM: { MRemoveTemporaryModeratorRoom M(iter); ChatRoomCore *destRoomCore = getRoomCore(M.getRoomID()); @@ -2043,7 +2046,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) if (!destRoomCore || !destRoom) { _chatdebug_("ChatAPI:BadData: MESSAGE_REMOVETEMPORARYMODERATORROOM: destRoomCore=%p, destRoom=%p\n", destRoomCore, destRoom); - break; + break; } ChatAvatarCore *destAvatarCore = destRoomCore->removeTempModerator(M.getDestAvatarName(), M.getDestAvatarAddress()); @@ -2052,15 +2055,15 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) if (!destAvatarCore) { _chatdebug_("ChatAPI:BadData: MESSAGE_REMOVETEMPORARYMODERATORROOM: destAvatarCore=%p\n", destAvatarCore); - delete destAvatarCore; - break; + delete destAvatarCore; + break; } ChatAvatar *destAvatar = destAvatarCore->getNewChatAvatar(); if (!srcAvatar || !destAvatar) { _chatdebug_("ChatAPI:BadData: MESSAGE_REMOVETEMPORARYMODERATORROOM: srcAvatar=%p, destAvatar=%p\n", srcAvatar, destAvatar); - delete destAvatar; - break; + delete destAvatar; + break; } m_api->OnReceiveRemoveTemporaryModeratorRoom(srcAvatar, destAvatar, destRoom); @@ -2068,13 +2071,13 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) delete destAvatar; } break; - case MESSAGE_REMOVETEMPORARYMODERATORAVATAR: + case MESSAGE_REMOVETEMPORARYMODERATORAVATAR: { MRemoveTemporaryModeratorAvatar M(iter); if (!M.getSrcAvatar() || !M.getDestAvatar()) { _chatdebug_("ChatAPI:BadData: MESSAGE_REMOVETEMPORARYMODERATORAVATAR: M.getSrcAvatar()=%p, M.getDestAvatar()=%p\n", M.getSrcAvatar(), M.getDestAvatar()); - break; + break; } ChatAvatar *srcAvatar = M.getSrcAvatar()->getNewChatAvatar(); @@ -2082,16 +2085,16 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) if (!srcAvatar || !destAvatar) { _chatdebug_("ChatAPI:BadData: MESSAGE_REMOVETEMPORARYMODERATORAVATAR: srcAvatar=%p, destAvatar=%p\n", srcAvatar, destAvatar); - delete srcAvatar; - delete destAvatar; - break; + delete srcAvatar; + delete destAvatar; + break; } m_api->OnReceiveRemoveTemporaryModeratorAvatar(srcAvatar, destAvatar, ChatUnicodeString(M.getRoomName().data(), M.getRoomName().size()), ChatUnicodeString(M.getRoomAddress().data(), M.getRoomAddress().size())); delete srcAvatar; delete destAvatar; } break; - case MESSAGE_ADDBANROOM: + case MESSAGE_ADDBANROOM: { MAddBanRoom M(iter); ChatRoomCore *destRoomCore = getRoomCore(M.getRoomID()); @@ -2107,22 +2110,22 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) { _chatdebug_("ChatAPI:BadData: MESSAGE_ADDBANAVATAR: M.getSrcAvatar()=%p, M.getDestAvatar()=%p\n", M.getSrcAvatar(), M.getDestAvatar()); delete M.getSrcAvatar(); - break; + break; } ChatAvatar *destAvatar = M.getDestAvatar()->getNewChatAvatar(); ChatAvatar *srcAvatar = M.getSrcAvatar()->getNewChatAvatar(); - if (!destRoomCore->addBan(M.getDestAvatar())) + if (destRoomCore && !destRoomCore->addBan(M.getDestAvatar())) { - delete M.getSrcAvatar(); + delete M.getSrcAvatar(); } - if (!destRoomCore || !destRoom) + if (destRoomCore && !destRoomCore || !destRoom) { _chatdebug_("ChatAPI:BadData: MESSAGE_ADDBANAVATAR: destRoom=%p, destRoomCore=%p\n", destRoom, destRoomCore); - delete srcAvatar; - delete destAvatar; - break; + delete srcAvatar; + delete destAvatar; + break; } ChatAvatarCore *removedAvatar = destRoomCore->removeAvatar(destAvatar->getAvatarID()); @@ -2134,7 +2137,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) delete srcAvatar; } break; - case MESSAGE_REMOVEBANROOM: + case MESSAGE_REMOVEBANROOM: { MRemoveBanRoom M(iter); ChatRoomCore *destRoomCore = getRoomCore(M.getRoomID()); @@ -2143,54 +2146,54 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) if (!destRoom || !destRoomCore) { _chatdebug_("ChatAPI:BadData: MESSAGE_REMOVEBANROOM: destRoom=%p, destRoomCore=%p\n", destRoom, destRoomCore); - break; + break; } - ChatAvatarCore *destAvatarCore = destRoomCore->removeBan(M.getDestAvatarName(), M.getDestAvatarAddress()); + ChatAvatarCore *destAvatarCore = destRoomCore->removeBan(M.getDestAvatarName(), M.getDestAvatarAddress()); if (!destAvatarCore) { _chatdebug_("ChatAPI:BadData: MESSAGE_REMOVEBANROOM: destAvatarCore=%p\n", destAvatarCore); - break; + break; } - + const ChatAvatar *srcAvatar = destRoomCore->getAvatar(M.getSrcAvatarID()); ChatAvatar *destAvatar = destAvatarCore->getNewChatAvatar(); if (!srcAvatar || !destAvatar) { _chatdebug_("ChatAPI:BadData: MESSAGE_REMOVEBANROOM: srcAvatar=%p, destAvatar=%p\n", srcAvatar, destAvatar); - delete destAvatar; - break; + delete destAvatar; + break; } - + m_api->OnReceiveRemoveBanRoom(srcAvatar, destAvatar, destRoom); delete destAvatarCore; delete destAvatar; } break; - case MESSAGE_REMOVEBANAVATAR: + case MESSAGE_REMOVEBANAVATAR: { MRemoveBanAvatar M(iter); if (!M.getSrcAvatar() || !M.getDestAvatar()) { _chatdebug_("ChatAPI:BadData: MESSAGE_REMOVEBANAVATAR: M.getSrcAvatar=()%p, M.getDestAvatar()=%p\n", M.getSrcAvatar(), M.getDestAvatar()); - break; + break; } ChatAvatar *srcAvatar = M.getSrcAvatar()->getNewChatAvatar(); ChatAvatar *destAvatar = M.getDestAvatar()->getNewChatAvatar(); - + if (!srcAvatar || !destAvatar) { _chatdebug_("ChatAPI:BadData: MESSAGE_REMOVEBANAVATAR: srcAvatar=%p, destAvatar=%p\n", srcAvatar, destAvatar); - delete srcAvatar; - delete destAvatar; - break; + delete srcAvatar; + delete destAvatar; + break; } m_api->OnReceiveRemoveBanAvatar(srcAvatar, destAvatar, ChatUnicodeString(M.getRoomName().data(), M.getRoomName().size()), ChatUnicodeString(M.getRoomAddress().data(), M.getRoomAddress().size())); delete srcAvatar; delete destAvatar; } break; - case MESSAGE_ADDINVITEROOM: + case MESSAGE_ADDINVITEROOM: { MAddInviteRoom M(iter); ChatRoomCore *destRoomCore = getRoomCore(M.getRoomID()); @@ -2214,9 +2217,9 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) if (!srcAvatar || !destAvatar || !destRoom) { _chatdebug_("ChatAPI:BadData: MESSAGE_ADDINVITEROOM: srcAvatar=%p, destAvatar=%p, destRoom=%p\n", srcAvatar, destAvatar, destRoom); - delete srcAvatar; - delete destAvatar; - break; + delete srcAvatar; + delete destAvatar; + break; } m_api->OnReceiveAddInviteRoom(srcAvatar, destAvatar, destRoom); @@ -2224,13 +2227,13 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) delete destAvatar; } break; - case MESSAGE_ADDINVITEAVATAR: + case MESSAGE_ADDINVITEAVATAR: { MAddInviteAvatar M(iter); if (!M.getSrcAvatar() || !M.getDestAvatar()) { _chatdebug_("ChatAPI:BadData: MESSAGE_ADDINVITEAVATAR: M.getSrcAvatar()=%p, M.getDestAvatar()=%p\n", M.getSrcAvatar(), M.getDestAvatar()); - break; + break; } ChatAvatar *srcAvatar = M.getSrcAvatar()->getNewChatAvatar(); @@ -2239,16 +2242,16 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) if (!srcAvatar || !destAvatar) { _chatdebug_("ChatAPI:BadData: MESSAGE_ADDINVITEAVATAR: srcAvatar=%p, destAvatar=%p\n", srcAvatar, destAvatar); - delete srcAvatar; - delete destAvatar; - break; + delete srcAvatar; + delete destAvatar; + break; } m_api->OnReceiveAddInviteAvatar(srcAvatar, destAvatar, ChatUnicodeString(M.getRoomName().data(), M.getRoomName().size()), ChatUnicodeString(M.getRoomAddress().data(), M.getRoomAddress().size())); delete srcAvatar; delete destAvatar; } break; - case MESSAGE_REMOVEINVITEROOM: + case MESSAGE_REMOVEINVITEROOM: { MRemoveInviteRoom M(iter); ChatRoomCore *destRoomCore = getRoomCore(M.getRoomID()); @@ -2256,25 +2259,25 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) if (!destRoomCore || !destRoom) { _chatdebug_("ChatAPI:BadData: MESSAGE_REMOVEINVITEROOM: destRoomCore=%p, destRoom=%p\n", destRoomCore, destRoom); - break; + break; } ChatAvatarCore *destAvatarCore = destRoomCore->removeInvite(M.getDestAvatarName(), M.getDestAvatarAddress()); if (!destAvatarCore) { _chatdebug_("ChatAPI:BadData: MESSAGE_REMOVEINVITEROOM: destAvatarCore=%p\n", destAvatarCore); - break; + break; } - + const ChatAvatar *srcAvatar = destRoomCore->getAvatar(M.getSrcAvatarID()); ChatAvatar *destAvatar = destAvatarCore->getNewChatAvatar(); if (!srcAvatar || !destAvatar) { _chatdebug_("ChatAPI:BadData: MESSAGE_REMOVEINVITEROOM: srcAvatar=%p, destAvatar=%p\n", srcAvatar, destAvatar); - delete destAvatarCore; - delete destAvatar; - break; + delete destAvatarCore; + delete destAvatar; + break; } m_api->OnReceiveRemoveInviteRoom(srcAvatar, destAvatar, destRoom); @@ -2282,11 +2285,11 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) delete destAvatar; } break; - case MESSAGE_REMOVEINVITEAVATAR: + case MESSAGE_REMOVEINVITEAVATAR: { MRemoveInviteAvatar M(iter); - if (!M.getSrcAvatar() || !M.getDestAvatar()) + if (!M.getSrcAvatar() || !M.getDestAvatar()) { _chatdebug_("ChatAPI:BadData: MESSAGE_REMOVEINVITEAVATAR: M.getSrcAvatar=%p, M.getDestAvatar=%p\n", M.getSrcAvatar(), M.getDestAvatar()); break; @@ -2297,16 +2300,16 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) if (!srcAvatar || !destAvatar) { _chatdebug_("ChatAPI:BadData: MESSAGE_REMOVEINVITEAVATAR: srcAvatar=%p, destAvatar=%p\n", srcAvatar, destAvatar); - delete srcAvatar; - delete destAvatar; - break; + delete srcAvatar; + delete destAvatar; + break; } m_api->OnReceiveRemoveInviteAvatar(srcAvatar, destAvatar, ChatUnicodeString(M.getRoomName().data(), M.getRoomName().size()), ChatUnicodeString(M.getRoomAddress().data(), M.getRoomAddress().size())); delete srcAvatar; delete destAvatar; } break; - case MESSAGE_GRANTVOICEROOM: + case MESSAGE_GRANTVOICEROOM: { MGrantVoiceRoom M(iter); ChatRoomCore *destRoomCore = getRoomCore(M.getRoomID()); @@ -2330,9 +2333,9 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) if (!srcAvatar || !destAvatar || !destRoom) { _chatdebug_("ChatAPI:BadData: MESSAGE_GRANTVOICEROOM: srcAvatar=%p, destAvatar=%p, destRoom=%p\n", srcAvatar, destAvatar, destRoom); - delete srcAvatar; - delete destAvatar; - break; + delete srcAvatar; + delete destAvatar; + break; } m_api->OnReceiveGrantVoiceRoom(srcAvatar, destAvatar, destRoom); @@ -2340,13 +2343,13 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) delete destAvatar; } break; - case MESSAGE_GRANTVOICEAVATAR: + case MESSAGE_GRANTVOICEAVATAR: { MGrantVoiceAvatar M(iter); if (!M.getSrcAvatar() || !M.getDestAvatar()) { _chatdebug_("ChatAPI:BadData: MESSAGE_GRANTVOICEAVATAR: M.getSrcAvatar()=%p, M.getDestAvatar()=%p\n", M.getSrcAvatar(), M.getDestAvatar()); - break; + break; } ChatAvatar *srcAvatar = M.getSrcAvatar()->getNewChatAvatar(); @@ -2355,16 +2358,16 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) if (!srcAvatar || !destAvatar) { _chatdebug_("ChatAPI:BadData: MESSAGE_GRANTVOICEAVATAR: srcAvatar=%p, destAvatar=%p\n", srcAvatar, destAvatar); - delete srcAvatar; - delete destAvatar; - break; + delete srcAvatar; + delete destAvatar; + break; } m_api->OnReceiveGrantVoiceAvatar(srcAvatar, destAvatar, ChatUnicodeString(M.getRoomName().data(), M.getRoomName().size()), ChatUnicodeString(M.getRoomAddress().data(), M.getRoomAddress().size())); delete srcAvatar; delete destAvatar; } break; - case MESSAGE_REVOKEVOICEROOM: + case MESSAGE_REVOKEVOICEROOM: { MRevokeVoiceRoom M(iter); ChatRoomCore *destRoomCore = getRoomCore(M.getRoomID()); @@ -2372,25 +2375,25 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) if (!destRoomCore || !destRoom) { _chatdebug_("ChatAPI:BadData: MESSAGE_REVOKEVOICEROOM: destRoomCore=%p, destRoom=%p\n", destRoomCore, destRoom); - break; + break; } ChatAvatarCore *destAvatarCore = destRoomCore->removeVoice(M.getDestAvatarName(), M.getDestAvatarAddress()); if (!destAvatarCore) { _chatdebug_("ChatAPI:BadData: MESSAGE_REVOKEVOICEROOM: destAvatarCore=%p\n", destAvatarCore); - break; + break; } - + const ChatAvatar *srcAvatar = destRoomCore->getAvatar(M.getSrcAvatarID()); ChatAvatar *destAvatar = destAvatarCore->getNewChatAvatar(); if (!srcAvatar || !destAvatar) { _chatdebug_("ChatAPI:BadData: MESSAGE_REVOKEVOICEROOM: srcAvatar=%p, destAvatar=%p\n", srcAvatar, destAvatar); - delete destAvatarCore; - delete destAvatar; - break; + delete destAvatarCore; + delete destAvatar; + break; } m_api->OnReceiveRevokeVoiceRoom(srcAvatar, destAvatar, destRoom); @@ -2398,11 +2401,11 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) delete destAvatar; } break; - case MESSAGE_REVOKEVOICEAVATAR: + case MESSAGE_REVOKEVOICEAVATAR: { MRevokeVoiceAvatar M(iter); - if (!M.getSrcAvatar() || !M.getDestAvatar()) + if (!M.getSrcAvatar() || !M.getDestAvatar()) { _chatdebug_("ChatAPI:BadData: MESSAGE_REVOKEVOICEAVATAR: M.getSrcAvatar=%p, M.getDestAvatar=%p\n", M.getSrcAvatar(), M.getDestAvatar()); break; @@ -2413,21 +2416,21 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) if (!srcAvatar || !destAvatar) { _chatdebug_("ChatAPI:BadData: MESSAGE_REVOKEVOICEAVATAR: srcAvatar=%p, destAvatar=%p\n", srcAvatar, destAvatar); - delete srcAvatar; - delete destAvatar; - break; + delete srcAvatar; + delete destAvatar; + break; } m_api->OnReceiveRevokeVoiceAvatar(srcAvatar, destAvatar, ChatUnicodeString(M.getRoomName().data(), M.getRoomName().size()), ChatUnicodeString(M.getRoomAddress().data(), M.getRoomAddress().size())); delete srcAvatar; delete destAvatar; } break; - case MESSAGE_ENTERROOM: + case MESSAGE_ENTERROOM: { MEnterRoom M(iter); ChatRoomCore *destRoomCore = getRoomCore(M.getRoomID()); - + ChatRoom *destRoom = getRoom(M.getRoomID()); if (!destRoomCore || !destRoom || !M.getSrcAvatar()) { @@ -2445,16 +2448,16 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) } bool isLocalAvatar = (getAvatar(srcAvatar->getAvatarID()) != nullptr); - if(!destRoomCore->addAvatar(M.getSrcAvatar(),isLocalAvatar)) + if (!destRoomCore->addAvatar(M.getSrcAvatar(), isLocalAvatar)) { - delete M.getSrcAvatar(); + delete M.getSrcAvatar(); } - + m_api->OnReceiveEnterRoom(srcAvatar, destRoom); delete srcAvatar; } break; - case MESSAGE_LEAVEROOM: + case MESSAGE_LEAVEROOM: { MLeaveRoom M(iter); ChatRoomCore *destRoomCore = getRoomCore(M.getRoomID()); @@ -2483,7 +2486,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) delete srcAvatar; } break; - case MESSAGE_DESTROYROOM: + case MESSAGE_DESTROYROOM: { MDestroyRoom M(iter); @@ -2521,11 +2524,11 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) } } break; - case MESSAGE_SETROOMPARAMS: + case MESSAGE_SETROOMPARAMS: { MSetRoomParams M(iter); ChatRoomCore *destRoomCore = getRoomCore(M.getRoomID()); - if (!destRoomCore) + if (!destRoomCore) { _chatdebug_("ChatAPI:BadData: MESSAGE_SETROOMPARAMS: destRoomCore=nullptr\n"); break; @@ -2541,7 +2544,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) destRoomCore->setName(M.getRoomName()); destRoomCore->setTopic(M.getRoomTopic()); destRoomCore->setPassword(M.getRoomPassword()); - + if (!M.getSrcAvatar()) { _chatdebug_("ChatAPI:BadData: MESSAGE_SETROOMPARAMS: M.getSrcAvatar=nullptr\n"); @@ -2554,13 +2557,13 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) { _chatdebug_("ChatAPI:BadData: MESSAGE_SETROOMPARAMS: srcAvatar=%p, destRoom=%p\n", srcAvatar, destRoom); delete srcAvatar; - break; + break; } m_api->OnReceiveRoomParams(srcAvatar, destRoom, ¶ms, &oldParams); delete srcAvatar; } break; - case MESSAGE_PERSISTENTMESSAGE: + case MESSAGE_PERSISTENTMESSAGE: { MPersistentMessage M(iter); ChatAvatar *avatar = getAvatar(M.getDestAvatarID()); @@ -2568,7 +2571,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) m_api->OnReceivePersistentMessage(avatar, M.getHeader()); } break; - case MESSAGE_FORCEDLOGOUT: + case MESSAGE_FORCEDLOGOUT: { MForcedLogout M(iter); ChatAvatar *avatar = getAvatar(M.getAvatarID()); @@ -2578,7 +2581,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) delete core; } break; - case MESSAGE_UNREGISTERROOMREADY: + case MESSAGE_UNREGISTERROOMREADY: { MUnregisterRoomReady M(iter); @@ -2590,13 +2593,13 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) } } break; - case MESSAGE_KICKAVATAR: + case MESSAGE_KICKAVATAR: { MKickAvatar M(iter); if (!M.getSrcAvatar() || !M.getDestAvatar()) { _chatdebug_("ChatAPI:BadData: MESSAGE_KICKAVATAR: M.getSrcAvatar=%p, M.getDestAvatar=%p\n", M.getSrcAvatar(), M.getDestAvatar()); - break; + break; } ChatAvatar *srcAvatar = M.getSrcAvatar()->getNewChatAvatar(); ChatAvatar *destAvatar = M.getDestAvatar()->getNewChatAvatar(); @@ -2606,20 +2609,20 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) _chatdebug_("ChatAPI:BadData: MESSAGE_KICKAVATAR: srcAvatar=%p, destAvatar=%p\n", srcAvatar, destAvatar); delete srcAvatar; delete destAvatar; - break; + break; } m_api->OnReceiveKickAvatar(srcAvatar, destAvatar, ChatUnicodeString(M.getRoomName().data(), M.getRoomName().size()), ChatUnicodeString(M.getRoomAddress().data(), M.getRoomAddress().size())); delete srcAvatar; delete destAvatar; } break; - case MESSAGE_ADDMODERATORAVATAR: + case MESSAGE_ADDMODERATORAVATAR: { MAddModeratorAvatar M(iter); if (!M.getSrcAvatar() || !M.getDestAvatar()) { _chatdebug_("ChatAPI:BadData: MESSAGE_ADDMODERATORAVATAR: M.getSrcAvatar=%p, M.getDestAvatar=%p\n", M.getSrcAvatar(), M.getDestAvatar()); - break; + break; } ChatAvatar *srcAvatar = M.getSrcAvatar()->getNewChatAvatar(); ChatAvatar *destAvatar = M.getDestAvatar()->getNewChatAvatar(); @@ -2629,20 +2632,20 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) _chatdebug_("ChatAPI:BadData: MESSAGE_ADDMODERATORAVATAR: srcAvatar=%p, destAvatar=%p\n", srcAvatar, destAvatar); delete srcAvatar; delete destAvatar; - break; + break; } m_api->OnReceiveAddModeratorAvatar(srcAvatar, destAvatar, ChatUnicodeString(M.getRoomName().data(), M.getRoomName().size()), ChatUnicodeString(M.getRoomAddress().data(), M.getRoomAddress().size())); delete srcAvatar; delete destAvatar; } break; - case MESSAGE_ADDTEMPORARYMODERATORAVATAR: + case MESSAGE_ADDTEMPORARYMODERATORAVATAR: { MAddTemporaryModeratorAvatar M(iter); if (!M.getSrcAvatar() || !M.getDestAvatar()) { _chatdebug_("ChatAPI:BadData: MESSAGE_ADDTEMPORARYMODERATORAVATAR: M.getSrcAvatar=%p, M.getDestAvatar=%p\n", M.getSrcAvatar(), M.getDestAvatar()); - break; + break; } ChatAvatar *srcAvatar = M.getSrcAvatar()->getNewChatAvatar(); ChatAvatar *destAvatar = M.getDestAvatar()->getNewChatAvatar(); @@ -2652,20 +2655,20 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) _chatdebug_("ChatAPI:BadData: MESSAGE_ADDTEMPORARYMODERATORAVATAR: srcAvatar=%p, destAvatar=%p\n", srcAvatar, destAvatar); delete srcAvatar; delete destAvatar; - break; + break; } m_api->OnReceiveAddTemporaryModeratorAvatar(srcAvatar, destAvatar, ChatUnicodeString(M.getRoomName().data(), M.getRoomName().size()), ChatUnicodeString(M.getRoomAddress().data(), M.getRoomAddress().size())); delete srcAvatar; delete destAvatar; } break; - case MESSAGE_ADDBANAVATAR: + case MESSAGE_ADDBANAVATAR: { MAddBanAvatar M(iter); if (!M.getSrcAvatar() || !M.getDestAvatar()) { _chatdebug_("ChatAPI:BadData: MESSAGE_ADDBANAVATAR: M.getSrcAvatar=%p, M.getDestAvatar=%p\n", M.getSrcAvatar(), M.getDestAvatar()); - break; + break; } ChatAvatar *srcAvatar = M.getSrcAvatar()->getNewChatAvatar(); ChatAvatar *destAvatar = M.getDestAvatar()->getNewChatAvatar(); @@ -2675,14 +2678,14 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) _chatdebug_("ChatAPI:BadData: MESSAGE_ADDBANAVATAR: srcAvatar=%p, destAvatar=%p\n", srcAvatar, destAvatar); delete srcAvatar; delete destAvatar; - break; + break; } m_api->OnReceiveAddBanAvatar(srcAvatar, destAvatar, ChatUnicodeString(M.getRoomName().data(), M.getRoomName().size()), ChatUnicodeString(M.getRoomAddress().data(), M.getRoomAddress().size())); delete srcAvatar; delete destAvatar; } break; - case MESSAGE_ADDADMIN: + case MESSAGE_ADDADMIN: { MAddAdmin M(iter); ChatRoomCore *destRoomCore = getRoomCore(M.getRoomID()); @@ -2692,7 +2695,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) } } break; - case MESSAGE_REMOVEADMIN: + case MESSAGE_REMOVEADMIN: { MRemoveAdmin M(iter); ChatRoomCore *destRoomCore = getRoomCore(M.getRoomID()); @@ -2702,7 +2705,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) delete admin; } break; - case MESSAGE_FRIENDCONFIRMREQUEST: + case MESSAGE_FRIENDCONFIRMREQUEST: { MFriendConfirmRequest M(iter); if (!M.getSrcAvatar()) @@ -2713,22 +2716,22 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) ChatAvatar *srcAvatar = M.getSrcAvatar()->getNewChatAvatar(); ChatAvatar *destAvatar = getAvatar(M.getDestAvatarID()); - if (!srcAvatar || !destAvatar) + if (!srcAvatar || !destAvatar) { _chatdebug_("ChatAPI:BadData: MESSAGE_FRIENDCONFIRMREQUEST: srcAvatar=%p, destAvatar=%p\n", srcAvatar, destAvatar); - delete srcAvatar; - break; + delete srcAvatar; + break; } m_api->OnReceiveFriendConfirmRequest(srcAvatar, destAvatar); delete srcAvatar; } break; - case MESSAGE_FRIENDCONFIRMRESPONSE: + case MESSAGE_FRIENDCONFIRMRESPONSE: { MFriendConfirmResponse M(iter); - if (!M.getSrcAvatar()) + if (!M.getSrcAvatar()) { _chatdebug_("ChatAPI:BadData: MESSAGE_FRIENDCONFIRMRESPONSE: M.getSrcAvatar=nullptr\n"); break; @@ -2736,18 +2739,18 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) ChatAvatar *srcAvatar = M.getSrcAvatar()->getNewChatAvatar(); ChatAvatar *destAvatar = getAvatar(M.getDestAvatarID()); - if (!srcAvatar || !destAvatar) + if (!srcAvatar || !destAvatar) { _chatdebug_("ChatAPI:BadData: MESSAGE_FRIENDCONFIRMRESPONSE: srcAvatar=%p, destAvatar=%p\n", srcAvatar, destAvatar); - delete srcAvatar; - break; + delete srcAvatar; + break; } m_api->OnReceiveFriendConfirmResponse(srcAvatar, destAvatar, M.getConfirm()); delete srcAvatar; } break; - case MESSAGE_FRIENDCONFIRMRECIPROCATE_REQUEST: + case MESSAGE_FRIENDCONFIRMRECIPROCATE_REQUEST: { MFriendConfirmReciprocateRequest M(iter); if (!M.getSrcAvatar()) @@ -2758,22 +2761,22 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) ChatAvatar *srcAvatar = M.getSrcAvatar()->getNewChatAvatar(); ChatAvatar *destAvatar = getAvatar(M.getDestAvatarID()); - if (!srcAvatar || !destAvatar) + if (!srcAvatar || !destAvatar) { _chatdebug_("ChatAPI:BadData: MESSAGE_FRIENDCONFIRMRECIPROCATE_REQUEST: srcAvatar=%p, destAvatar=%p\n", srcAvatar, destAvatar); - delete srcAvatar; - break; + delete srcAvatar; + break; } m_api->OnReceiveFriendConfirmReciprocateRequest(srcAvatar, destAvatar); delete srcAvatar; } break; - case MESSAGE_FRIENDCONFIRMRECIPROCATE_RESPONSE: + case MESSAGE_FRIENDCONFIRMRECIPROCATE_RESPONSE: { MFriendConfirmReciprocateResponse M(iter); - if (!M.getSrcAvatar()) + if (!M.getSrcAvatar()) { _chatdebug_("ChatAPI:BadData: MESSAGE_FRIENDCONFIRMRECIPROCATE_RESPONSE: M.getSrcAvatar=nullptr\n"); break; @@ -2781,23 +2784,23 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) ChatAvatar *srcAvatar = M.getSrcAvatar()->getNewChatAvatar(); ChatAvatar *destAvatar = getAvatar(M.getDestAvatarID()); - if (!srcAvatar || !destAvatar) + if (!srcAvatar || !destAvatar) { _chatdebug_("ChatAPI:BadData: MESSAGE_FRIENDCONFIRMRECIPROCATE_RESPONSE: srcAvatar=%p, destAvatar=%p\n", srcAvatar, destAvatar); - delete srcAvatar; - break; + delete srcAvatar; + break; } m_api->OnReceiveFriendConfirmReciprocateResponse(srcAvatar, destAvatar, M.getConfirm()); delete srcAvatar; } break; - case MESSAGE_CHANGEROOMOWNER: + case MESSAGE_CHANGEROOMOWNER: { MChangeRoomOwner M(iter); - + ChatRoomCore *destRoomCore = getRoomCore(M.getDestRoomID()); - if (!destRoomCore) + if (!destRoomCore) { _chatdebug_("ChatAPI:BadData: MESSAGE_CHANGEROOMOWNER: destRoomCore=nullptr\n"); break; @@ -2810,17 +2813,17 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) if (!destRoom) { _chatdebug_("ChatAPI:BadData: MESSAGE_CHANGEROOMOWNER: destRoom=%p\n", destRoom); - break; + break; } - + m_api->OnReceiveRoomOwnerChange(destRoom); } break; - case MESSAGE_REQUESTROOMENTRY: + case MESSAGE_REQUESTROOMENTRY: { MRoomEntryRequest M(iter); - if (!M.getRequestorAvatar()) + if (!M.getRequestorAvatar()) { _chatdebug_("ChatAPI:BadData: MESSAGE_REQUESTROOMENTRY: M.getRequestorAvatar=nullptr\n"); break; @@ -2828,11 +2831,11 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) ChatAvatar *srcAvatar = M.getRequestorAvatar()->getNewChatAvatar(); ChatAvatar *destAvatar = getAvatar(M.getRoomOwnerID()); - if (!destAvatar) + if (!destAvatar) { _chatdebug_("ChatAPI:BadData: MESSAGE_REQUESTROOMENTRY: destAvatar=%p\n", destAvatar); delete srcAvatar; - break; + break; } m_api->OnReceiveRoomEntryRequest(srcAvatar, destAvatar, M.getRequestedRoomAddress()); @@ -2840,7 +2843,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) delete srcAvatar; } break; - case MESSAGE_DELAYEDROOMENTRY: + case MESSAGE_DELAYEDROOMENTRY: { MDelayedRoomEntry M(iter); @@ -2873,22 +2876,22 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) m_api->OnReceiveDelayedRoomEntry(avatar, room); } break; - case MESSAGE_DENIEDROOMENTRY: + case MESSAGE_DENIEDROOMENTRY: { MDeniedRoomEntry M(iter); ChatAvatar *destAvatar = getAvatar(M.getRequestorID()); - if (!destAvatar) + if (!destAvatar) { _chatdebug_("ChatAPI:BadData: MESSAGE_DENIEDROOMENTRY: destAvatar=%p\n", destAvatar); - break; + break; } m_api->OnReceiveDeniedRoomEntry(destAvatar, M.getRequestedRoomAddress()); } break; - case MESSAGE_FORCEROOMFAILOVER: + case MESSAGE_FORCEROOMFAILOVER: { MForceRoomFailover M(iter); @@ -2902,7 +2905,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) { ChatRoomCore *room = (*roomIter).second; const String &roomAddress = room->getAddress(); - + // compare room address against aid string, it is a match // if aid string is found at index 0 (start of roomAddr string) String::size_type index; @@ -2923,7 +2926,7 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) } } break; - case MESSAGE_FAILOVER_AVATAR_LIST: + case MESSAGE_FAILOVER_AVATAR_LIST: { unsigned numWorlds = 0; @@ -2937,16 +2940,16 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) get(iter, world); worldVec.push_back(world); } - + map::iterator avatarIter; if (m_avatarCoreCache.size() > 0) { for (avatarIter = m_avatarCoreCache.begin(); avatarIter != m_avatarCoreCache.end(); ++avatarIter) { - for(i = 0; i < worldVec.size(); ++i) + for (i = 0; i < worldVec.size(); ++i) { - if (caseInsensitiveCompare((*avatarIter).second->getAddress(),worldVec[i])) + if (caseInsensitiveCompare((*avatarIter).second->getAddress(), worldVec[i])) { failoverReloginOneAvatar((*avatarIter).second); break; // break out of world loop into avatar loop @@ -2956,311 +2959,114 @@ void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) } } break; - case MESSAGE_SNOOP: + case MESSAGE_SNOOP: { MSnoop M(iter); m_api->OnReceiveSnoopMessage(M.getSnoopType(), - ChatUnicodeString(M.getSnooperName()), - ChatUnicodeString(M.getSnooperAddr()), - ChatUnicodeString(M.getSrcName()), - ChatUnicodeString(M.getSrcAddr()), - ChatUnicodeString(M.getDestName()), - ChatUnicodeString(M.getDestAddr()), - ChatUnicodeString(M.getMessage())); + ChatUnicodeString(M.getSnooperName()), + ChatUnicodeString(M.getSnooperAddr()), + ChatUnicodeString(M.getSrcName()), + ChatUnicodeString(M.getSrcAddr()), + ChatUnicodeString(M.getDestName()), + ChatUnicodeString(M.getDestAddr()), + ChatUnicodeString(M.getMessage())); } break; - case MESSAGE_UIDLIST: + case MESSAGE_UIDLIST: { MUIDList M(iter); m_uidSet = M.getUIDList(); } break; - case MESSAGE_NOTIFY_FRIEND_IS_REMOVED: + case MESSAGE_NOTIFY_FRIEND_IS_REMOVED: { MNotifyFriendIsRemoved M(iter); ChatAvatar *avatar = getAvatar(M.getAvatarID()); - if (!avatar) + if (!avatar) { _chatdebug_("ChatAPI:BadData: MESSAGE_NOTIFY_FRIEND_IS_REMOVED: avatar=%p avatarID(%d)\n", avatar, M.getAvatarID()); - break; + break; } m_api->OnReceiveNotifyFriendIsRemoved(avatar, M.getDestName(), M.getDestAddress()); } break; - case MESSAGE_NOTIFY_FRIENDS_LIST_CHANGE: + case MESSAGE_NOTIFY_FRIENDS_LIST_CHANGE: { MNotifyFriendsListChange M(iter); ChatAvatar *avatar = getAvatar(M.getAvatarID()); - if (!avatar) + if (!avatar) { _chatdebug_("ChatAPI:BadData: MESSAGE_NOTIFY_FRIENDS_LIST_CHANGE: avatar=%p avatarID(%d)\n", avatar, M.getAvatarID()); - break; + break; } - m_api->OnReceiveNotifyFriendsListChange(avatar,M.getOriginalName(), M.getOriginalAddress(), M.getNewName(), M.getNewAddress()); + m_api->OnReceiveNotifyFriendsListChange(avatar, M.getOriginalName(), M.getOriginalAddress(), M.getNewName(), M.getNewAddress()); } break; - default: - fprintf(stderr, "[ChatAPICore.cpp] default (message) responseCallback(ByteStream::ReadIterator &), type = %u\n", type); + default: + fprintf(stderr, "[ChatAPICore.cpp] default (message) responseCallback(ByteStream::ReadIterator &), type = %u\n", type); + } } -} -void ChatAPICore::processAPI() -{ - // if we are connected to the registrar and we got the - // ResRegistrarGetChatServer callback, then we disconnect - // and connect to the assigned ChatServer - if (m_connected && - m_setToRegistrar && - m_rcvdRegistrarResponse) + void ChatAPICore::processAPI() { - // disconnect from the Registrar - m_serverConnections[0]->disconnect(); + // if we are connected to the registrar and we got the + // ResRegistrarGetChatServer callback, then we disconnect + // and connect to the assigned ChatServer + if (m_connected && + m_setToRegistrar && + m_rcvdRegistrarResponse) + { + // disconnect from the Registrar + m_serverConnections[0]->disconnect(); + } + // if we've been disconnected for at least a minute... + else if (!m_connected && + time(nullptr) - m_timeSinceLastDisconnect >= 60) + { + if (m_setToRegistrar) + { + // ...and we can't connect to the registrar, then + // connect to lastAssigned Chat Server host and port + // (which on the first attempt would be the same as default) + changeHostPort(0, m_assignedServerHost.c_str(), m_assignedServerPort); + m_setToRegistrar = false; + } + else + { + // ...and we can't connect to the Chat Server, then + // connect to the registrar and ask again for direction + changeHostPort(0, m_registrarHost.c_str(), m_registrarPort); + m_setToRegistrar = true; + } + + m_timeSinceLastDisconnect = time(nullptr); + } + + // call GenericAPICore::process() + process(); } - // if we've been disconnected for at least a minute... - else if (!m_connected && - time(nullptr) - m_timeSinceLastDisconnect >= 60) + + void ChatAPICore::OnConnect(const char *host, short port) { + m_connected = true; + + // act on connection depending on if we are connected to + // registrar or chatserver if (m_setToRegistrar) { - // ...and we can't connect to the registrar, then - // connect to lastAssigned Chat Server host and port - // (which on the first attempt would be the same as default) - changeHostPort(0, m_assignedServerHost.c_str(), m_assignedServerPort); - m_setToRegistrar = false; - } - else - { - // ...and we can't connect to the Chat Server, then - // connect to the registrar and ask again for direction - changeHostPort(0, m_registrarHost.c_str(), m_registrarPort); - m_setToRegistrar = true; - } - - m_timeSinceLastDisconnect = time(nullptr); - } - - - // call GenericAPICore::process() - process(); -} - -void ChatAPICore::OnConnect(const char *host, short port) -{ - m_connected = true; - - // act on connection depending on if we are connected to - // registrar or chatserver - if (m_setToRegistrar) - { - // negotiate chat server host/port with the Registrar - Base::ByteStream msg; - RRegistrarGetChatServer *req = new RRegistrarGetChatServer(m_defaultServerHost, m_defaultServerPort); - ResRegistrarGetChatServer *res = new ResRegistrarGetChatServer(); - - if(m_currTrack == 0) - { - m_currTrack++; - } - req->setTrack(m_currTrack); - res->setTrack(m_currTrack); - m_currTrack++; - - time_t timeout = time(nullptr) + m_requestTimeout; - req->setTimeout(timeout); - res->setTimeout(timeout); - - m_pending.insert(pair(res->getTrack(), res)); - m_pendingCount++; - - // submit request directly (the exception, not using submitRequest()) - req->pack(msg); - m_serverConnections[0]->Send(msg); - delete req; - - m_rcvdRegistrarResponse = false; - m_serverConnections[0]->process(); - } - else if (!m_sentVersion && - m_shouldSendVersion) // always true, except ChatAdminAPICore can override - { - // send the version to the chat server - Base::ByteStream msg; - RSendApiVersion *req = new RSendApiVersion(kChatApiVersion); - ResSendApiVersion *res = new ResSendApiVersion(); - - if(m_currTrack == 0) - { - m_currTrack++; - } - req->setTrack(m_currTrack); - res->setTrack(m_currTrack); - m_currTrack++; - - time_t timeout = time(nullptr) + m_requestTimeout; - req->setTimeout(timeout); - res->setTimeout(timeout); - - m_pending.insert(pair(res->getTrack(), res)); - m_pendingCount++; - - // submit request directly (the exception, not using submitRequest()) - req->pack(msg); - m_serverConnections[0]->Send(msg); - delete req; - - m_serverConnections[0]->process(); - } - else if (m_shouldSendVersion == false) - { - if (m_inFailoverMode) - { - // reconnect to server succeeded, proceed with failover procedures. - // The failover procs will make the resumeProcessing() call. - m_api->OnFailoverBegin(); - failoverReloginAvatars(); - } - else - { - // first time connecting, allow user requests to go through - resumeProcessing(); - m_api->OnConnect(); - } - } -} - -void ChatAPICore::OnDisconnect(const char *host, short port) -{ - // we may get OnDisconnect even when we're already disconnected, - // so protect against unnecessary OnDisconnects by checking m_connected - if (m_connected) - { - m_connected = false; - m_sentVersion = false; - - // stop processing immediately - suspendProcessing(); - - m_timeSinceLastDisconnect = time(nullptr); - - // determine who we disconnected from and take appropriate action - if (strcmp(host, m_registrarHost.c_str()) == 0 && - port == m_registrarPort) - { - // we finished communication to the registrar - // change connection to the assigned host and port - changeHostPort(0, m_assignedServerHost.c_str(), m_assignedServerPort); - m_setToRegistrar = false; - } - else - { - // we disconnected from a Chat Server - // consider ourselves in failover mode, meaning next connection to - // a Chat Server will induce API failure procedure. First we will - // attempt to connect to Registrar again. - m_inFailoverMode = true; - m_failoverAvatarResRemain = 0; - m_failoverRoomResRemain = 0; - - changeHostPort(0, m_registrarHost.c_str(), m_registrarPort); - m_setToRegistrar = true; - - // indicate disconnect state - m_api->OnDisconnect(); - } - } -} - -void ChatAPICore::failoverReloginAvatars() -{ - map::iterator avatarIter; - - if (m_avatarCoreCache.size() > 0) - { - for (avatarIter = m_avatarCoreCache.begin(); avatarIter != m_avatarCoreCache.end(); ++avatarIter) - { - // build failover-login request for avatar - failoverReloginOneAvatar(avatarIter->second); - } - } - else - { - // no avatars to relogin, so directly proceed to failover rooms - failoverRecreateRooms(); - } -} - - -void ChatAPICore::failoverReloginOneAvatar(ChatAvatarCore * avatarCore) -{ - if (avatarCore) - { - // build failover-login request for avatar - Base::ByteStream msg; - RFailoverReloginAvatar *req = new RFailoverReloginAvatar(avatarCore); - ResFailoverReloginAvatar *res = new ResFailoverReloginAvatar(avatarCore->getAvatarID()); - - if(m_currTrack == 0) - { - m_currTrack++; - } - req->setTrack(m_currTrack); - res->setTrack(m_currTrack); - m_currTrack++; - - time_t timeout = time(nullptr) + m_requestTimeout; - req->setTimeout(timeout); - res->setTimeout(timeout); - - m_pending.insert(pair(res->getTrack(), res)); - m_pendingCount++; - - // submit request directly (the exception, not using submitRequest()) - req->pack(msg); - m_serverConnections[0]->Send(msg); - delete req; - - m_failoverAvatarResRemain++; - m_serverConnections[0]->process(false); - } -} - - -void ChatAPICore::failoverRecreateRooms() -{ - map::iterator roomIter; - multimap::iterator roomMultiIter; - - if (m_roomCoreCache.size() > 0) - { - // first build multimap of rooms keyed by their node level (ascending order is default). - multimap levelMap; - ChatRoomCore *roomCore = nullptr; - for (roomIter = m_roomCoreCache.begin(); roomIter != m_roomCoreCache.end(); ++roomIter) - { - roomCore = (*roomIter).second; - if (roomCore->getNodeLevel() != 0) - { - levelMap.insert(pair(roomCore->getNodeLevel(), roomCore)); - } - } - - for (roomMultiIter = levelMap.begin(); roomMultiIter != levelMap.end(); ++roomMultiIter) - { - roomCore = (*roomMultiIter).second; - - // build failover-room-create request for room + // negotiate chat server host/port with the Registrar Base::ByteStream msg; - RFailoverRecreateRoom *req = new RFailoverRecreateRoom(roomCore); - ResFailoverRecreateRoom *res = new ResFailoverRecreateRoom(roomCore->getRoomID()); + RRegistrarGetChatServer *req = new RRegistrarGetChatServer(m_defaultServerHost, m_defaultServerPort); + ResRegistrarGetChatServer *res = new ResRegistrarGetChatServer(); - if(m_currTrack == 0) + if (m_currTrack == 0) { m_currTrack++; } @@ -3271,91 +3077,284 @@ void ChatAPICore::failoverRecreateRooms() time_t timeout = time(nullptr) + m_requestTimeout; req->setTimeout(timeout); res->setTimeout(timeout); - + m_pending.insert(pair(res->getTrack(), res)); m_pendingCount++; - + // submit request directly (the exception, not using submitRequest()) req->pack(msg); m_serverConnections[0]->Send(msg); delete req; - m_failoverRoomResRemain++; - m_serverConnections[0]->process(false); + m_rcvdRegistrarResponse = false; + m_serverConnections[0]->process(); } - } - else - { - // no rooms to recreate, so resume processing and - // indicate it's ok to send new requests. - m_inFailoverMode = false; - m_api->OnFailoverComplete(); - resumeProcessing(); - } -} - -ChatAvatar *ChatAPICore::getAvatar(const ChatUnicodeString &avatarName, const ChatUnicodeString &avatarAddress) -{ - ChatAvatar *returnVal = nullptr; - - map::iterator iter = m_avatarCache.begin(); - - for (; iter != m_avatarCache.end(); ++iter) - { - ChatAvatar *avatar = (*iter).second; - - if (areEqualChatStrings(avatarName, avatar->getName()) && - areEqualChatStrings(avatarAddress, avatar->getAddress())) + else if (!m_sentVersion && + m_shouldSendVersion) // always true, except ChatAdminAPICore can override { - returnVal = avatar; - break; - } - } + // send the version to the chat server + Base::ByteStream msg; + RSendApiVersion *req = new RSendApiVersion(kChatApiVersion); + ResSendApiVersion *res = new ResSendApiVersion(); - return returnVal; -} - -ChatRoom *ChatAPICore::getRoom(const ChatUnicodeString &roomAddress) -{ - ChatRoom *returnVal = nullptr; - - map::iterator iter = m_roomCache.begin(); - - for (; iter != m_roomCache.end(); ++iter) - { - ChatRoom *room = (*iter).second; - - if (areEqualChatStrings(roomAddress, room->getAddress())) - { - returnVal = room; - break; - } - } - - return returnVal; -} - -bool ChatAPICore::areEqualChatStrings(const ChatUnicodeString &str1, const ChatUnicodeString &str2) -{ - bool returnVal = true; - - if (str1.string_length != str2.string_length) - { - returnVal = false; - } - else - { - for (unsigned i = 0; i != str1.string_length; i++) - { - if (trueLower(str1.string_data[i]) != trueLower(str2.string_data[i])) + if (m_currTrack == 0) { - returnVal = false; - break; + m_currTrack++; + } + req->setTrack(m_currTrack); + res->setTrack(m_currTrack); + m_currTrack++; + + time_t timeout = time(nullptr) + m_requestTimeout; + req->setTimeout(timeout); + res->setTimeout(timeout); + + m_pending.insert(pair(res->getTrack(), res)); + m_pendingCount++; + + // submit request directly (the exception, not using submitRequest()) + req->pack(msg); + m_serverConnections[0]->Send(msg); + delete req; + + m_serverConnections[0]->process(); + } + else if (m_shouldSendVersion == false) + { + if (m_inFailoverMode) + { + // reconnect to server succeeded, proceed with failover procedures. + // The failover procs will make the resumeProcessing() call. + m_api->OnFailoverBegin(); + failoverReloginAvatars(); + } + else + { + // first time connecting, allow user requests to go through + resumeProcessing(); + m_api->OnConnect(); } } } - return returnVal; -} + void ChatAPICore::OnDisconnect(const char *host, short port) + { + // we may get OnDisconnect even when we're already disconnected, + // so protect against unnecessary OnDisconnects by checking m_connected + if (m_connected) + { + m_connected = false; + m_sentVersion = false; -}; + // stop processing immediately + suspendProcessing(); + + m_timeSinceLastDisconnect = time(nullptr); + + // determine who we disconnected from and take appropriate action + if (strcmp(host, m_registrarHost.c_str()) == 0 && + port == m_registrarPort) + { + // we finished communication to the registrar + // change connection to the assigned host and port + changeHostPort(0, m_assignedServerHost.c_str(), m_assignedServerPort); + m_setToRegistrar = false; + } + else + { + // we disconnected from a Chat Server + // consider ourselves in failover mode, meaning next connection to + // a Chat Server will induce API failure procedure. First we will + // attempt to connect to Registrar again. + m_inFailoverMode = true; + m_failoverAvatarResRemain = 0; + m_failoverRoomResRemain = 0; + + changeHostPort(0, m_registrarHost.c_str(), m_registrarPort); + m_setToRegistrar = true; + + // indicate disconnect state + m_api->OnDisconnect(); + } + } + } + + void ChatAPICore::failoverReloginAvatars() + { + map::iterator avatarIter; + + if (m_avatarCoreCache.size() > 0) + { + for (avatarIter = m_avatarCoreCache.begin(); avatarIter != m_avatarCoreCache.end(); ++avatarIter) + { + // build failover-login request for avatar + failoverReloginOneAvatar(avatarIter->second); + } + } + else + { + // no avatars to relogin, so directly proceed to failover rooms + failoverRecreateRooms(); + } + } + + void ChatAPICore::failoverReloginOneAvatar(ChatAvatarCore * avatarCore) + { + if (avatarCore) + { + // build failover-login request for avatar + Base::ByteStream msg; + RFailoverReloginAvatar *req = new RFailoverReloginAvatar(avatarCore); + ResFailoverReloginAvatar *res = new ResFailoverReloginAvatar(avatarCore->getAvatarID()); + + if (m_currTrack == 0) + { + m_currTrack++; + } + req->setTrack(m_currTrack); + res->setTrack(m_currTrack); + m_currTrack++; + + time_t timeout = time(nullptr) + m_requestTimeout; + req->setTimeout(timeout); + res->setTimeout(timeout); + + m_pending.insert(pair(res->getTrack(), res)); + m_pendingCount++; + + // submit request directly (the exception, not using submitRequest()) + req->pack(msg); + m_serverConnections[0]->Send(msg); + delete req; + + m_failoverAvatarResRemain++; + m_serverConnections[0]->process(false); + } + } + + void ChatAPICore::failoverRecreateRooms() + { + map::iterator roomIter; + multimap::iterator roomMultiIter; + + if (m_roomCoreCache.size() > 0) + { + // first build multimap of rooms keyed by their node level (ascending order is default). + multimap levelMap; + ChatRoomCore *roomCore = nullptr; + for (roomIter = m_roomCoreCache.begin(); roomIter != m_roomCoreCache.end(); ++roomIter) + { + roomCore = (*roomIter).second; + if (roomCore->getNodeLevel() != 0) + { + levelMap.insert(pair(roomCore->getNodeLevel(), roomCore)); + } + } + + for (roomMultiIter = levelMap.begin(); roomMultiIter != levelMap.end(); ++roomMultiIter) + { + roomCore = (*roomMultiIter).second; + + // build failover-room-create request for room + Base::ByteStream msg; + RFailoverRecreateRoom *req = new RFailoverRecreateRoom(roomCore); + ResFailoverRecreateRoom *res = new ResFailoverRecreateRoom(roomCore->getRoomID()); + + if (m_currTrack == 0) + { + m_currTrack++; + } + req->setTrack(m_currTrack); + res->setTrack(m_currTrack); + m_currTrack++; + + time_t timeout = time(nullptr) + m_requestTimeout; + req->setTimeout(timeout); + res->setTimeout(timeout); + + m_pending.insert(pair(res->getTrack(), res)); + m_pendingCount++; + + // submit request directly (the exception, not using submitRequest()) + req->pack(msg); + m_serverConnections[0]->Send(msg); + delete req; + + m_failoverRoomResRemain++; + m_serverConnections[0]->process(false); + } + } + else + { + // no rooms to recreate, so resume processing and + // indicate it's ok to send new requests. + m_inFailoverMode = false; + m_api->OnFailoverComplete(); + resumeProcessing(); + } + } + + ChatAvatar *ChatAPICore::getAvatar(const ChatUnicodeString &avatarName, const ChatUnicodeString &avatarAddress) + { + ChatAvatar *returnVal = nullptr; + + map::iterator iter = m_avatarCache.begin(); + + for (; iter != m_avatarCache.end(); ++iter) + { + ChatAvatar *avatar = (*iter).second; + + if (areEqualChatStrings(avatarName, avatar->getName()) && + areEqualChatStrings(avatarAddress, avatar->getAddress())) + { + returnVal = avatar; + break; + } + } + + return returnVal; + } + + ChatRoom *ChatAPICore::getRoom(const ChatUnicodeString &roomAddress) + { + ChatRoom *returnVal = nullptr; + + map::iterator iter = m_roomCache.begin(); + + for (; iter != m_roomCache.end(); ++iter) + { + ChatRoom *room = (*iter).second; + + if (areEqualChatStrings(roomAddress, room->getAddress())) + { + returnVal = room; + break; + } + } + + return returnVal; + } + + bool ChatAPICore::areEqualChatStrings(const ChatUnicodeString &str1, const ChatUnicodeString &str2) + { + bool returnVal = true; + + if (str1.string_length != str2.string_length) + { + returnVal = false; + } + else + { + for (unsigned i = 0; i != str1.string_length; i++) + { + if (trueLower(str1.string_data[i]) != trueLower(str2.string_data[i])) + { + returnVal = false; + break; + } + } + } + + return returnVal; + } +}; \ No newline at end of file diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAvatarCore.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAvatarCore.cpp index 25e2e8f0..871f63d7 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAvatarCore.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAvatarCore.cpp @@ -1,186 +1,184 @@ #include "ChatAvatarCore.h" #include "ChatAvatar.h" -namespace ChatSystem +namespace ChatSystem { + using namespace Plat_Unicode; + using namespace Base; -using namespace Plat_Unicode; -using namespace Base; + ChatAvatarCore::ChatAvatarCore() + : m_inboxLimit(0), + m_loginPriority(0), + m_userID(0), + m_avatarID(0), + m_serverID(0), + m_gatewayID(0), + m_attributes(0) + { + } -ChatAvatarCore::ChatAvatarCore() -: m_inboxLimit(0), - m_loginPriority(0), - m_userID(0), - m_avatarID(0), - m_serverID(0), - m_gatewayID(0) -{ -} + ChatAvatarCore::ChatAvatarCore(unsigned avatarID, unsigned userID, const unsigned short *name, const unsigned short *address, const unsigned short *gateway, const unsigned short *server, unsigned gatewayID, unsigned serverID, const unsigned short *loginLocation, unsigned attributes) + : m_name(name), + m_address(address), + m_server(server), + m_gateway(gateway), + m_loginLocation(loginLocation), + m_attributes(attributes), + m_inboxLimit(0), + m_loginPriority(0), + m_userID(userID), + m_avatarID(avatarID), + m_serverID(serverID), + m_gatewayID(gatewayID) + { + } -ChatAvatarCore::ChatAvatarCore(unsigned avatarID, unsigned userID, const unsigned short *name, const unsigned short *address, const unsigned short *gateway, const unsigned short *server, unsigned gatewayID, unsigned serverID, const unsigned short *loginLocation, unsigned attributes) -: m_name(name), - m_address(address), - m_server(server), - m_gateway(gateway), - m_loginLocation(loginLocation), - m_attributes(attributes), - m_inboxLimit(0), - m_loginPriority(0), - m_userID(userID), - m_avatarID(avatarID), - m_serverID(serverID), - m_gatewayID(gatewayID) -{ -} + ChatAvatarCore::ChatAvatarCore(unsigned avatarID, unsigned userID, const ChatUnicodeString &name, const ChatUnicodeString &address, const ChatUnicodeString &gateway, const ChatUnicodeString &server, unsigned gatewayID, unsigned serverID, const ChatUnicodeString &loginLocation, unsigned attributes) + : m_name(name.string_data, name.string_length), + m_address(address.string_data, address.string_length), + m_server(server.string_data, server.string_length), + m_gateway(gateway.string_data, gateway.string_length), + m_loginLocation(loginLocation.string_data, loginLocation.string_length), + m_attributes(attributes), + m_inboxLimit(0), + m_loginPriority(0), + m_userID(userID), + m_avatarID(avatarID), + m_serverID(serverID), + m_gatewayID(gatewayID) + { + } -ChatAvatarCore::ChatAvatarCore(unsigned avatarID, unsigned userID, const ChatUnicodeString &name, const ChatUnicodeString &address, const ChatUnicodeString &gateway, const ChatUnicodeString &server, unsigned gatewayID, unsigned serverID, const ChatUnicodeString &loginLocation, unsigned attributes) -: m_name(name.string_data, name.string_length), - m_address(address.string_data, address.string_length), - m_server(server.string_data, server.string_length), - m_gateway(gateway.string_data, gateway.string_length), - m_loginLocation(loginLocation.string_data, loginLocation.string_length), - m_attributes(attributes), - m_inboxLimit(0), - m_loginPriority(0), - m_userID(userID), - m_avatarID(avatarID), - m_serverID(serverID), - m_gatewayID(gatewayID) -{ -} + ChatAvatarCore::ChatAvatarCore(unsigned avatarID, unsigned userID, const String &name, const String &address, const String &gateway, const String &server, unsigned gatewayID, unsigned serverID, const Plat_Unicode::String &loginLocation, unsigned attributes) + : m_name(name), + m_address(address), + m_server(server), + m_gateway(gateway), + m_loginLocation(loginLocation), + m_attributes(attributes), + m_inboxLimit(0), + m_loginPriority(0), + m_userID(userID), + m_avatarID(avatarID), + m_serverID(serverID), + m_gatewayID(gatewayID) + { + } -ChatAvatarCore::ChatAvatarCore(unsigned avatarID, unsigned userID, const String &name, const String &address, const String &gateway, const String &server, unsigned gatewayID, unsigned serverID, const Plat_Unicode::String &loginLocation, unsigned attributes) -: m_name(name), - m_address(address), - m_server(server), - m_gateway(gateway), - m_loginLocation(loginLocation), - m_attributes(attributes), - m_inboxLimit(0), - m_loginPriority(0), - m_userID(userID), - m_avatarID(avatarID), - m_serverID(serverID), - m_gatewayID(gatewayID) -{ -} + ChatAvatarCore::ChatAvatarCore(ByteStream::ReadIterator &iter) + { + get(iter, m_avatarID); + get(iter, m_userID); + ASSERT_VALID_STRING_LENGTH(get(iter, m_name)); + ASSERT_VALID_STRING_LENGTH(get(iter, m_address)); + get(iter, (uint32 &)m_attributes); + ASSERT_VALID_STRING_LENGTH(get(iter, m_loginLocation)); + ASSERT_VALID_STRING_LENGTH(get(iter, m_server)); + ASSERT_VALID_STRING_LENGTH(get(iter, m_gateway)); + get(iter, m_serverID); + get(iter, m_gatewayID); + m_loginPriority = 0; + m_inboxLimit = 0; + } -ChatAvatarCore::ChatAvatarCore(ByteStream::ReadIterator &iter) -{ - get(iter, m_avatarID); - get(iter, m_userID); - ASSERT_VALID_STRING_LENGTH(get(iter, m_name)); - ASSERT_VALID_STRING_LENGTH(get(iter, m_address)); - get(iter, (uint32 &)m_attributes); - ASSERT_VALID_STRING_LENGTH(get(iter, m_loginLocation)); - ASSERT_VALID_STRING_LENGTH(get(iter, m_server)); - ASSERT_VALID_STRING_LENGTH(get(iter, m_gateway)); - get(iter, m_serverID); - get(iter, m_gatewayID); + ChatAvatarCore::ChatAvatarCore(const ChatAvatarCore &rhs) + : m_name(rhs.m_name), + m_address(rhs.m_address), + m_server(rhs.m_server), + m_gateway(rhs.m_gateway), + m_loginLocation(rhs.m_loginLocation), + m_email(rhs.m_email), + m_statusMessage(rhs.m_statusMessage), + m_attributes(rhs.m_attributes), + m_inboxLimit(rhs.m_inboxLimit), + m_loginPriority(rhs.m_loginPriority), + m_userID(rhs.m_userID), + m_avatarID(rhs.m_avatarID), + m_serverID(rhs.m_serverID), + m_gatewayID(rhs.m_gatewayID) + { + } - m_loginPriority = 0; - m_inboxLimit = 0; -} + ChatAvatarCore &ChatAvatarCore::operator=(const ChatAvatarCore &rhs) + { + m_name = rhs.m_name; + m_address = rhs.m_address; + m_userID = rhs.m_userID; + m_avatarID = rhs.m_avatarID; + m_server = rhs.m_server; + m_gateway = rhs.m_gateway; + m_serverID = rhs.m_serverID; + m_gatewayID = rhs.m_gatewayID; + m_attributes = rhs.m_attributes; + m_inboxLimit = rhs.m_inboxLimit; + m_loginPriority = rhs.m_loginPriority; + m_loginLocation = rhs.m_loginLocation; + m_email = rhs.m_email; + m_inboxLimit = rhs.m_inboxLimit; + m_statusMessage = rhs.m_statusMessage; -ChatAvatarCore::ChatAvatarCore(const ChatAvatarCore &rhs) -: m_name(rhs.m_name), - m_address(rhs.m_address), - m_server(rhs.m_server), - m_gateway(rhs.m_gateway), - m_loginLocation(rhs.m_loginLocation), - m_email(rhs.m_email), - m_statusMessage(rhs.m_statusMessage), - m_attributes(rhs.m_attributes), - m_inboxLimit(rhs.m_inboxLimit), - m_loginPriority(rhs.m_loginPriority), - m_userID(rhs.m_userID), - m_avatarID(rhs.m_avatarID), - m_serverID(rhs.m_serverID), - m_gatewayID(rhs.m_gatewayID) -{ -} + return(*this); + } -ChatAvatarCore &ChatAvatarCore::operator=(const ChatAvatarCore &rhs) -{ - m_name = rhs.m_name; - m_address = rhs.m_address; - m_userID = rhs.m_userID; - m_avatarID = rhs.m_avatarID; - m_server = rhs.m_server; - m_gateway = rhs.m_gateway; - m_serverID = rhs.m_serverID; - m_gatewayID = rhs.m_gatewayID; - m_attributes = rhs.m_attributes; - m_inboxLimit = rhs.m_inboxLimit; - m_loginPriority = rhs.m_loginPriority; - m_loginLocation = rhs.m_loginLocation; - m_email = rhs.m_email; - m_inboxLimit = rhs.m_inboxLimit; - m_statusMessage = rhs.m_statusMessage; + ChatAvatar *ChatAvatarCore::getNewChatAvatar() const + { + ChatUnicodeString addr(m_address.data(), m_address.size()); + ChatUnicodeString name(m_name.data(), m_name.size()); + ChatUnicodeString gateway(m_gateway.data(), m_gateway.size()); + ChatUnicodeString server(m_server.data(), m_server.size()); - return(*this); -} + ChatAvatar *newChatAvatar = new ChatAvatar(m_avatarID, + m_userID, + name, + addr, + gateway, + server, + m_gatewayID, + m_serverID, + m_loginLocation, + m_attributes); -ChatAvatar *ChatAvatarCore::getNewChatAvatar() const -{ - ChatUnicodeString addr(m_address.data(), m_address.size()); - ChatUnicodeString name(m_name.data(), m_name.size()); - ChatUnicodeString gateway(m_gateway.data(), m_gateway.size()); - ChatUnicodeString server(m_server.data(), m_server.size()); + newChatAvatar->setLoginPriority(m_loginPriority); + newChatAvatar->setInboxLimit(m_inboxLimit); + newChatAvatar->setForwardingEmail(m_email); + newChatAvatar->setStatusMessage(m_statusMessage); - ChatAvatar *newChatAvatar = new ChatAvatar(m_avatarID, - m_userID, - name, - addr, - gateway, - server, - m_gatewayID, - m_serverID, - m_loginLocation, - m_attributes); + return (newChatAvatar); + } - newChatAvatar->setLoginPriority(m_loginPriority); - newChatAvatar->setInboxLimit(m_inboxLimit); - newChatAvatar->setForwardingEmail(m_email); - newChatAvatar->setStatusMessage(m_statusMessage); + void ChatAvatarCore::serialize(Base::ByteStream &msg) + { + put(msg, m_avatarID); + put(msg, m_userID); + put(msg, m_name); + put(msg, m_address); + put(msg, (uint32)m_attributes); + put(msg, m_loginLocation); + } - return (newChatAvatar); -} + void ChatAvatarCore::setAttributes(unsigned long attributes) + { + m_attributes = attributes; + } -void ChatAvatarCore::serialize(Base::ByteStream &msg) -{ - put(msg, m_avatarID); - put(msg, m_userID); - put(msg, m_name); - put(msg, m_address); - put(msg, (uint32)m_attributes); - put(msg, m_loginLocation); -} + void ChatAvatarCore::setLoginPriority(int loginPriority) + { + m_loginPriority = loginPriority; + } -void ChatAvatarCore::setAttributes(unsigned long attributes) -{ - m_attributes = attributes; -} + void ChatAvatarCore::setEmail(const Plat_Unicode::String email) + { + m_email = email; + } -void ChatAvatarCore::setLoginPriority(int loginPriority) -{ - m_loginPriority = loginPriority; -} + void ChatAvatarCore::setInboxLimit(unsigned inboxLimit) + { + m_inboxLimit = inboxLimit; + } -void ChatAvatarCore::setEmail(const Plat_Unicode::String email) -{ - m_email = email; -} - -void ChatAvatarCore::setInboxLimit(unsigned inboxLimit) -{ - m_inboxLimit = inboxLimit; -} - -void ChatAvatarCore::setStatusMessage(const Plat_Unicode::String &statusMessage) -{ - m_statusMessage = statusMessage; -} - -}; + void ChatAvatarCore::setStatusMessage(const Plat_Unicode::String &statusMessage) + { + m_statusMessage = statusMessage; + } +}; \ No newline at end of file diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatRoomCore.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatRoomCore.cpp index d0c70f68..ee6c1a32 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatRoomCore.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatRoomCore.cpp @@ -3,592 +3,248 @@ #include "ChatAvatarCore.h" #include "AvatarIteratorCore.h" -namespace ChatSystem +namespace ChatSystem { + using namespace std; + using namespace Base; + using namespace Plat_Unicode; -using namespace std; -using namespace Base; -using namespace Plat_Unicode; - -ChatRoomCore::ChatRoomCore() -: m_creatorID(0), - m_roomAttributes(0), - m_maxRoomSize(0), - m_roomID(0), - m_createTime(0), - m_nodeLevel(0) -{ -} - -ChatRoomCore::ChatRoomCore(ByteStream::ReadIterator &iter) -{ - unsigned avatarCount; - unsigned administratorCount; - unsigned moderatorCount; - unsigned tempModeratorCount; - unsigned bannedCount; - unsigned invitedCount; - unsigned voiceCount; - ChatAvatarCore *avatar; - unsigned i; - - ASSERT_VALID_STRING_LENGTH(get(iter, m_creatorName)); - ASSERT_VALID_STRING_LENGTH(get(iter, m_creatorAddress)); - get(iter, m_creatorID); - ASSERT_VALID_STRING_LENGTH(get(iter, m_roomName)); - ASSERT_VALID_STRING_LENGTH(get(iter, m_roomTopic)); - ASSERT_VALID_STRING_LENGTH(get(iter, m_roomPrefix)); - ASSERT_VALID_STRING_LENGTH(get(iter, m_roomAddress)); - ASSERT_VALID_STRING_LENGTH(get(iter, m_roomPassword)); - get(iter, m_roomAttributes); - get(iter, m_maxRoomSize); - get(iter, m_roomID); - get(iter, m_createTime); - get(iter, m_nodeLevel); - - get(iter, avatarCount); - for (i = 0; i != avatarCount; i++) + ChatRoomCore::ChatRoomCore() + : m_creatorID(0), + m_roomAttributes(0), + m_maxRoomSize(0), + m_roomID(0), + m_createTime(0), + m_nodeLevel(0), + m_roomMessageID(0) { - avatar = new ChatAvatarCore(iter); - this->addAvatar(avatar, false); } - get(iter, administratorCount); - for (i = 0; i != administratorCount; i++) + ChatRoomCore::ChatRoomCore(ByteStream::ReadIterator &iter) { - avatar = new ChatAvatarCore(iter); - this->addAdministrator(avatar); - } - - get(iter, moderatorCount); - for (i = 0; i != moderatorCount; i++) - { - avatar = new ChatAvatarCore(iter); - this->addModerator(avatar); - } - - get(iter, tempModeratorCount); - for (i = 0; i != tempModeratorCount; i++) - { - avatar = new ChatAvatarCore(iter); - this->addTempModerator(avatar); - } + unsigned avatarCount; + unsigned administratorCount; + unsigned moderatorCount; + unsigned tempModeratorCount; + unsigned bannedCount; + unsigned invitedCount; + unsigned voiceCount; + ChatAvatarCore *avatar; + unsigned i; - get(iter, bannedCount); - for (i = 0; i != bannedCount; i++) - { - avatar = new ChatAvatarCore(iter); - this->addBan(avatar); - } - - get(iter, invitedCount); - for (i = 0; i != invitedCount; i++) - { - avatar = new ChatAvatarCore(iter); - this->addInvite(avatar); - } - - get(iter, voiceCount); - for (i = 0; i != voiceCount; i++) - { - avatar = new ChatAvatarCore(iter); - this->addVoice(avatar); - } -} + ASSERT_VALID_STRING_LENGTH(get(iter, m_creatorName)); + ASSERT_VALID_STRING_LENGTH(get(iter, m_creatorAddress)); + get(iter, m_creatorID); + ASSERT_VALID_STRING_LENGTH(get(iter, m_roomName)); + ASSERT_VALID_STRING_LENGTH(get(iter, m_roomTopic)); + ASSERT_VALID_STRING_LENGTH(get(iter, m_roomPrefix)); + ASSERT_VALID_STRING_LENGTH(get(iter, m_roomAddress)); + ASSERT_VALID_STRING_LENGTH(get(iter, m_roomPassword)); + get(iter, m_roomAttributes); + get(iter, m_maxRoomSize); + get(iter, m_roomID); + get(iter, m_createTime); + get(iter, m_nodeLevel); -ChatRoomCore::ChatRoomCore(const String &name, const String &address, const String &topic, const unsigned attributes, const unsigned maxSize) -: m_roomName(name), - m_roomTopic(topic), - m_roomAddress(address), - m_creatorID(0), - m_roomAttributes(attributes), - m_maxRoomSize(maxSize), - m_roomID(0) -{ -} - -ChatRoomCore::~ChatRoomCore() -{ - map::iterator iterCore; - map::iterator iter; - - set::iterator setIterCore; - set::iterator setIter; - - for (iterCore = m_inroomAvatarsCore.begin(); iterCore != m_inroomAvatarsCore.end(); ++iterCore) - { - delete (iterCore->second); - } - - for (iter = m_inroomAvatars.begin(); iter != m_inroomAvatars.end(); ++iter) - { - delete (iter->second); - } - - for (iterCore = m_adminAvatarsCore.begin(); iterCore != m_adminAvatarsCore.end(); ++iterCore) - { - delete (iterCore->second); - } - - for (iter = m_adminAvatars.begin(); iter != m_adminAvatars.end(); ++iter) - { - delete (iter->second); - } - - for (setIterCore = m_moderatorAvatarsCore.begin(); setIterCore != m_moderatorAvatarsCore.end(); ++setIterCore) - { - delete (*setIterCore); - } - - for (setIter = m_moderatorAvatars.begin(); setIter != m_moderatorAvatars.end(); ++setIter) - { - delete (*setIter); - } - - for (setIterCore = m_tempModeratorAvatarsCore.begin(); setIterCore != m_tempModeratorAvatarsCore.end(); ++setIterCore) - { - delete (*setIterCore); - } - - for (setIter = m_tempModeratorAvatars.begin(); setIter != m_tempModeratorAvatars.end(); ++setIter) - { - delete (*setIter); - } - - for (setIterCore = m_banAvatarsCore.begin(); setIterCore != m_banAvatarsCore.end(); ++setIterCore) - { - delete (*setIterCore); - } - - for (setIter = m_banAvatars.begin(); setIter != m_banAvatars.end(); ++setIter) - { - delete (*setIter); - } - - for (setIterCore = m_inviteAvatarsCore.begin(); setIterCore != m_inviteAvatarsCore.end(); ++setIterCore) - { - delete (*setIterCore); - } - - for (setIter = m_inviteAvatars.begin(); setIter != m_inviteAvatars.end(); ++setIter) - { - delete (*setIter); - } - - for (setIterCore = m_voiceAvatarsCore.begin(); setIterCore != m_voiceAvatarsCore.end(); ++setIterCore) - { - delete (*setIterCore); - } - - for (setIter = m_voiceAvatars.begin(); setIter != m_voiceAvatars.end(); ++setIter) - { - delete (*setIter); - } - -} - -ChatAvatarCore *ChatRoomCore::getAvatarCore(unsigned avatarID) -{ - ChatAvatarCore *returnAvatar = nullptr; - - map::iterator iterCore = m_inroomAvatarsCore.find(avatarID); - - if(iterCore != m_inroomAvatarsCore.end()) - { - returnAvatar = (*iterCore).second; - } - return(returnAvatar); -} - -ChatAvatar *ChatRoomCore::getAvatar(unsigned avatarID) -{ - ChatAvatar *returnAvatar = nullptr; - - map::iterator iter = m_inroomAvatars.find(avatarID); - - if(iter != m_inroomAvatars.end()) - { - returnAvatar = (*iter).second; - } - return(returnAvatar); -} - -ChatAvatarCore *ChatRoomCore::getModeratorCore(const Plat_Unicode::String &name, const Plat_Unicode::String &address) -{ - ChatAvatarCore *returnAvatar = nullptr; - - set::iterator iterCore = m_moderatorAvatarsCore.begin(); - - for(; iterCore != m_moderatorAvatarsCore.end(); ++iterCore) - { - ChatAvatarCore *avatarCore = (*iterCore); - if (caseInsensitiveCompare(name, avatarCore->getName()) && - caseInsensitiveCompare(address, avatarCore->getAddress(), true)) + get(iter, avatarCount); + for (i = 0; i != avatarCount; i++) { - break; + avatar = new ChatAvatarCore(iter); + this->addAvatar(avatar, false); + } + + get(iter, administratorCount); + for (i = 0; i != administratorCount; i++) + { + avatar = new ChatAvatarCore(iter); + this->addAdministrator(avatar); + } + + get(iter, moderatorCount); + for (i = 0; i != moderatorCount; i++) + { + avatar = new ChatAvatarCore(iter); + this->addModerator(avatar); + } + + get(iter, tempModeratorCount); + for (i = 0; i != tempModeratorCount; i++) + { + avatar = new ChatAvatarCore(iter); + this->addTempModerator(avatar); + } + + get(iter, bannedCount); + for (i = 0; i != bannedCount; i++) + { + avatar = new ChatAvatarCore(iter); + this->addBan(avatar); + } + + get(iter, invitedCount); + for (i = 0; i != invitedCount; i++) + { + avatar = new ChatAvatarCore(iter); + this->addInvite(avatar); + } + + get(iter, voiceCount); + for (i = 0; i != voiceCount; i++) + { + avatar = new ChatAvatarCore(iter); + this->addVoice(avatar); } } - if(iterCore != m_moderatorAvatarsCore.end()) + ChatRoomCore::ChatRoomCore(const String &name, const String &address, const String &topic, const unsigned attributes, const unsigned maxSize) + : m_roomName(name), + m_roomTopic(topic), + m_roomAddress(address), + m_creatorID(0), + m_roomAttributes(attributes), + m_maxRoomSize(maxSize), + m_roomID(0), + m_createTime(0), + m_nodeLevel(0), + m_roomMessageID(0) { - returnAvatar = (*iterCore); } - return(returnAvatar); -} -ChatAvatar *ChatRoomCore::getModerator(const Plat_Unicode::String &name, const Plat_Unicode::String &address) -{ - ChatAvatar *returnAvatar = nullptr; - - set::iterator iter = m_moderatorAvatars.begin(); - - for(; iter != m_moderatorAvatars.end(); ++iter) + ChatRoomCore::~ChatRoomCore() { - ChatAvatar *avatar = (*iter); - Plat_Unicode::String avatarName(avatar->getName().string_data, avatar->getName().string_length); - Plat_Unicode::String avatarAddress(avatar->getAddress().string_data, avatar->getAddress().string_length); - if (caseInsensitiveCompare(name, avatarName) && - caseInsensitiveCompare(address, avatarAddress, true)) + map::iterator iterCore; + map::iterator iter; + + set::iterator setIterCore; + set::iterator setIter; + + for (iterCore = m_inroomAvatarsCore.begin(); iterCore != m_inroomAvatarsCore.end(); ++iterCore) { - break; + delete (iterCore->second); + } + + for (iter = m_inroomAvatars.begin(); iter != m_inroomAvatars.end(); ++iter) + { + delete (iter->second); + } + + for (iterCore = m_adminAvatarsCore.begin(); iterCore != m_adminAvatarsCore.end(); ++iterCore) + { + delete (iterCore->second); + } + + for (iter = m_adminAvatars.begin(); iter != m_adminAvatars.end(); ++iter) + { + delete (iter->second); + } + + for (setIterCore = m_moderatorAvatarsCore.begin(); setIterCore != m_moderatorAvatarsCore.end(); ++setIterCore) + { + delete (*setIterCore); + } + + for (setIter = m_moderatorAvatars.begin(); setIter != m_moderatorAvatars.end(); ++setIter) + { + delete (*setIter); + } + + for (setIterCore = m_tempModeratorAvatarsCore.begin(); setIterCore != m_tempModeratorAvatarsCore.end(); ++setIterCore) + { + delete (*setIterCore); + } + + for (setIter = m_tempModeratorAvatars.begin(); setIter != m_tempModeratorAvatars.end(); ++setIter) + { + delete (*setIter); + } + + for (setIterCore = m_banAvatarsCore.begin(); setIterCore != m_banAvatarsCore.end(); ++setIterCore) + { + delete (*setIterCore); + } + + for (setIter = m_banAvatars.begin(); setIter != m_banAvatars.end(); ++setIter) + { + delete (*setIter); + } + + for (setIterCore = m_inviteAvatarsCore.begin(); setIterCore != m_inviteAvatarsCore.end(); ++setIterCore) + { + delete (*setIterCore); + } + + for (setIter = m_inviteAvatars.begin(); setIter != m_inviteAvatars.end(); ++setIter) + { + delete (*setIter); + } + + for (setIterCore = m_voiceAvatarsCore.begin(); setIterCore != m_voiceAvatarsCore.end(); ++setIterCore) + { + delete (*setIterCore); + } + + for (setIter = m_voiceAvatars.begin(); setIter != m_voiceAvatars.end(); ++setIter) + { + delete (*setIter); } } - if(iter != m_moderatorAvatars.end()) + ChatAvatarCore *ChatRoomCore::getAvatarCore(unsigned avatarID) { - returnAvatar = (*iter); - } - return(returnAvatar); -} + ChatAvatarCore *returnAvatar = nullptr; -ChatAvatarCore *ChatRoomCore::getBannedCore(const Plat_Unicode::String &name, const Plat_Unicode::String &address) -{ - ChatAvatarCore *returnAvatar = nullptr; + map::iterator iterCore = m_inroomAvatarsCore.find(avatarID); - set::iterator iterCore = m_banAvatarsCore.begin(); - - for(; iterCore != m_banAvatarsCore.end(); ++iterCore) - { - ChatAvatarCore *avatarCore = (*iterCore); - if (caseInsensitiveCompare(name, avatarCore->getName()) && - caseInsensitiveCompare(address, avatarCore->getAddress(), true)) + if (iterCore != m_inroomAvatarsCore.end()) { - break; + returnAvatar = (*iterCore).second; } + return(returnAvatar); } - if(iterCore != m_banAvatarsCore.end()) + ChatAvatar *ChatRoomCore::getAvatar(unsigned avatarID) { - returnAvatar = (*iterCore); - } - return(returnAvatar); -} + ChatAvatar *returnAvatar = nullptr; -ChatAvatar *ChatRoomCore::getBanned(const Plat_Unicode::String &name, const Plat_Unicode::String &address) -{ - ChatAvatar *returnAvatar = nullptr; + map::iterator iter = m_inroomAvatars.find(avatarID); - set::iterator iter = m_banAvatars.begin(); - - for(; iter != m_banAvatars.end(); ++iter) - { - ChatAvatar *avatar = (*iter); - Plat_Unicode::String avatarName(avatar->getName().string_data, avatar->getName().string_length); - Plat_Unicode::String avatarAddress(avatar->getAddress().string_data, avatar->getAddress().string_length); - if (caseInsensitiveCompare(name, avatarName) && - caseInsensitiveCompare(address, avatarAddress, true)) + if (iter != m_inroomAvatars.end()) { - break; + returnAvatar = (*iter).second; } + return(returnAvatar); } - if(iter != m_banAvatars.end()) + ChatAvatarCore *ChatRoomCore::getModeratorCore(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - returnAvatar = (*iter); - } - return(returnAvatar); -} + ChatAvatarCore *returnAvatar = nullptr; -ChatAvatarCore *ChatRoomCore::getInvitedCore(const Plat_Unicode::String &name, const Plat_Unicode::String &address) -{ - ChatAvatarCore *returnAvatar = nullptr; + set::iterator iterCore = m_moderatorAvatarsCore.begin(); - set::iterator iterCore = m_inviteAvatarsCore.begin(); - - for(; iterCore != m_inviteAvatarsCore.end(); ++iterCore) - { - ChatAvatarCore *avatarCore = (*iterCore); - if (caseInsensitiveCompare(name, avatarCore->getName()) && - caseInsensitiveCompare(address, avatarCore->getAddress(), true)) + for (; iterCore != m_moderatorAvatarsCore.end(); ++iterCore) { - break; - } - } - - if(iterCore != m_inviteAvatarsCore.end()) - { - returnAvatar = (*iterCore); - } - return(returnAvatar); -} - -ChatAvatar *ChatRoomCore::getInvited(const Plat_Unicode::String &name, const Plat_Unicode::String &address) -{ - ChatAvatar *returnAvatar = nullptr; - - set::iterator iter = m_inviteAvatars.begin(); - - for(; iter != m_inviteAvatars.end(); ++iter) - { - ChatAvatar *avatar = (*iter); - Plat_Unicode::String avatarName(avatar->getName().string_data, avatar->getName().string_length); - Plat_Unicode::String avatarAddress(avatar->getAddress().string_data, avatar->getAddress().string_length); - if (caseInsensitiveCompare(name, avatarName) && - caseInsensitiveCompare(address, avatarAddress, true)) - { - break; - } - } - - if(iter != m_inviteAvatars.end()) - { - returnAvatar = (*iter); - } - return(returnAvatar); -} - -ChatAvatarCore *ChatRoomCore::addAvatar(ChatAvatarCore *newAvatar, bool local) -{ - ChatAvatarCore *returnAvatar = nullptr; - - if(newAvatar) - { - pair< map::iterator, bool > result; - - result = m_inroomAvatarsCore.insert(pair(newAvatar->getAvatarID(), newAvatar)); - - // if add of ChatAvatarCore works, add a new ChatAvatar also. - if (result.second == true) - { - ChatAvatar *avatar = newAvatar->getNewChatAvatar(); - - m_inroomAvatars.insert(pair(avatar->getAvatarID(), avatar)); - - // keep track of avatars connected to this API that are in room - if (local) - { - m_inroomAvatarsLocal.insert(newAvatar->getAvatarID()); - } - - returnAvatar = newAvatar; - } - } - - return returnAvatar; -} - -void ChatRoomCore::addLocalAvatar(unsigned avatarID) -{ - m_inroomAvatarsLocal.insert(avatarID); -} - -ChatAvatarCore *ChatRoomCore::removeAvatar(unsigned avatarID) -{ - ChatAvatarCore *returnAvatar = nullptr; - - map::iterator iterCore = m_inroomAvatarsCore.find(avatarID); - - if(iterCore != m_inroomAvatarsCore.end()) - { - // remove ChatAvatarCore and ChatAvatar objects. - returnAvatar = (*iterCore).second; - - m_inroomAvatarsCore.erase(iterCore); - - // because the addAvatar() made the ChatAvatar, removeAvatar() deletes it. - map::iterator iter = m_inroomAvatars.find(avatarID); - delete (*iter).second; - m_inroomAvatars.erase(avatarID); - - // remove from cache of local API avatars logged into this room, if nec. - std::set::iterator localIter = m_inroomAvatarsLocal.find(avatarID); - if (localIter != m_inroomAvatarsLocal.end()) - m_inroomAvatarsLocal.erase(localIter); - } - - // pass back the ChatAvatarCore and let caller delete it (b/c he created it). - return(returnAvatar); -} - -ChatAvatarCore *ChatRoomCore::addBan(ChatAvatarCore *newAvatar) -{ - ChatAvatarCore *returnAvatar = nullptr; - - if(newAvatar) - { - pair< set::iterator, bool > result; - - result = m_banAvatarsCore.insert(newAvatar); - - // if add of ChatAvatarCore works, add a new ChatAvatar also. - if (result.second == true) - { - ChatAvatar *avatar = newAvatar->getNewChatAvatar(); - - m_banAvatars.insert(avatar); - - returnAvatar = newAvatar; - } - } - - return returnAvatar; -} - -ChatAvatarCore *ChatRoomCore::removeBan(const Plat_Unicode::String &name, const Plat_Unicode::String &address) -{ - ChatAvatarCore *returnAvatar = nullptr; - - set::iterator iterCore = m_banAvatarsCore.begin(); - - for(; iterCore != m_banAvatarsCore.end(); ++iterCore) - { - ChatAvatarCore *avatarCore = (*iterCore); - if (caseInsensitiveCompare(name, avatarCore->getName()) && - caseInsensitiveCompare(address, avatarCore->getAddress(), true)) - { - break; - } - } - - if(iterCore != m_banAvatarsCore.end()) - { - // remove ChatAvatarCore and ChatAvatar objects. - returnAvatar = (*iterCore); - m_banAvatarsCore.erase(iterCore); - - // because the addBan() made the ChatAvatar, removeBan() deletes it. - set::iterator iter = m_banAvatars.begin(); - - for(; iter != m_banAvatars.end(); ++iter) - { - ChatAvatar *avatar = (*iter); - Plat_Unicode::String avatarName(avatar->getName().string_data, avatar->getName().string_length); - Plat_Unicode::String avatarAddress(avatar->getAddress().string_data, avatar->getAddress().string_length); - if (caseInsensitiveCompare(name, avatarName) && - caseInsensitiveCompare(address, avatarAddress, true)) + ChatAvatarCore *avatarCore = (*iterCore); + if (caseInsensitiveCompare(name, avatarCore->getName()) && + caseInsensitiveCompare(address, avatarCore->getAddress(), true)) { break; } } - if(iter != m_banAvatars.end()) + if (iterCore != m_moderatorAvatarsCore.end()) { - delete (*iter); - m_banAvatars.erase(iter); + returnAvatar = (*iterCore); } + return(returnAvatar); } - // pass back the ChatAvatarCore and let caller delete it (b/c he created it). - return(returnAvatar); -} - -ChatAvatarCore *ChatRoomCore::addAdministrator(ChatAvatarCore *newAvatar) -{ - ChatAvatarCore *returnAvatar = nullptr; - - if(newAvatar) + ChatAvatar *ChatRoomCore::getModerator(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - pair< map::iterator, bool > result; + ChatAvatar *returnAvatar = nullptr; - result = this->m_adminAvatarsCore.insert(pair(newAvatar->getAvatarID(), newAvatar)); - - // if add of ChatAvatarCore works, add a new ChatAvatar also. - if (result.second == true) - { - ChatAvatar *avatar = newAvatar->getNewChatAvatar(); - - m_adminAvatars.insert(pair(avatar->getAvatarID(), avatar)); - - returnAvatar = newAvatar; - } - } - - return returnAvatar; -} - -ChatAvatarCore *ChatRoomCore::removeAdministrator(unsigned avatarID) -{ - ChatAvatarCore *returnAvatar = nullptr; - - map::iterator iterCore = m_adminAvatarsCore.find(avatarID); - - if(iterCore != m_adminAvatarsCore.end()) - { - // remove ChatAvatarCore and ChatAvatar objects. - returnAvatar = (*iterCore).second; - - m_adminAvatarsCore.erase(iterCore); - - // because the addAvatar() made the ChatAvatar, removeAvatar() deletes it. - map::iterator iter = m_adminAvatars.find(avatarID); - delete (*iter).second; - m_adminAvatars.erase(avatarID); - } - - // pass back the ChatAvatarCore and let caller delete it (b/c he created it). - return(returnAvatar); -} - -ChatAvatarCore *ChatRoomCore::addModerator(ChatAvatarCore *newAvatar) -{ - ChatAvatarCore *returnAvatar = nullptr; - - if(newAvatar) - { - pair< set::iterator, bool > result; - - result = this->m_moderatorAvatarsCore.insert(newAvatar); - - // if add of ChatAvatarCore works, add a new ChatAvatar also. - if (result.second == true) - { - ChatAvatar *avatar = newAvatar->getNewChatAvatar(); - - m_moderatorAvatars.insert(avatar); - - returnAvatar = newAvatar; - } - } - - return returnAvatar; -} - -ChatAvatarCore *ChatRoomCore::removeModerator(const Plat_Unicode::String &name, const Plat_Unicode::String &address) -{ - ChatAvatarCore *returnAvatar = nullptr; - - set::iterator iterCore = m_moderatorAvatarsCore.begin(); - - for(; iterCore != m_moderatorAvatarsCore.end(); ++iterCore) - { - ChatAvatarCore *avatarCore = (*iterCore); - if (caseInsensitiveCompare(name, avatarCore->getName()) && - caseInsensitiveCompare(address, avatarCore->getAddress(), true)) - { - break; - } - } - - if(iterCore != m_moderatorAvatarsCore.end()) - { - // remove ChatAvatarCore and ChatAvatar objects. - returnAvatar = (*iterCore); - m_moderatorAvatarsCore.erase(iterCore); - - // because the addBan() made the ChatAvatar, removeBan() deletes it. set::iterator iter = m_moderatorAvatars.begin(); - for(; iter != m_moderatorAvatars.end(); ++iter) + for (; iter != m_moderatorAvatars.end(); ++iter) { ChatAvatar *avatar = (*iter); Plat_Unicode::String avatarName(avatar->getName().string_data, avatar->getName().string_length); @@ -600,67 +256,43 @@ ChatAvatarCore *ChatRoomCore::removeModerator(const Plat_Unicode::String &name, } } - if(iter != m_moderatorAvatars.end()) + if (iter != m_moderatorAvatars.end()) { - delete (*iter); - m_moderatorAvatars.erase(iter); + returnAvatar = (*iter); } + return(returnAvatar); } - // pass back the ChatAvatarCore and let caller delete it (b/c he created it). - return(returnAvatar); -} - -ChatAvatarCore *ChatRoomCore::addTempModerator(ChatAvatarCore *newAvatar) -{ - ChatAvatarCore *returnAvatar = nullptr; - - if(newAvatar) + ChatAvatarCore *ChatRoomCore::getBannedCore(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - pair< set::iterator, bool > result; + ChatAvatarCore *returnAvatar = nullptr; - result = this->m_tempModeratorAvatarsCore.insert(newAvatar); - - // if add of ChatAvatarCore works, add a new ChatAvatar also. - if (result.second == true) + set::iterator iterCore = m_banAvatarsCore.begin(); + + for (; iterCore != m_banAvatarsCore.end(); ++iterCore) { - ChatAvatar *avatar = newAvatar->getNewChatAvatar(); - - m_tempModeratorAvatars.insert(avatar); - - returnAvatar = newAvatar; + ChatAvatarCore *avatarCore = (*iterCore); + if (caseInsensitiveCompare(name, avatarCore->getName()) && + caseInsensitiveCompare(address, avatarCore->getAddress(), true)) + { + break; + } } - } - - return returnAvatar; -} -ChatAvatarCore *ChatRoomCore::removeTempModerator(const Plat_Unicode::String &name, const Plat_Unicode::String &address) -{ - ChatAvatarCore *returnAvatar = nullptr; - - set::iterator iterCore = m_tempModeratorAvatarsCore.begin(); - - for(; iterCore != m_tempModeratorAvatarsCore.end(); ++iterCore) - { - ChatAvatarCore *avatarCore = (*iterCore); - if (caseInsensitiveCompare(name, avatarCore->getName()) && - caseInsensitiveCompare(address, avatarCore->getAddress(), true)) + if (iterCore != m_banAvatarsCore.end()) { - break; + returnAvatar = (*iterCore); } + return(returnAvatar); } - if(iterCore != m_tempModeratorAvatarsCore.end()) + ChatAvatar *ChatRoomCore::getBanned(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - // remove ChatAvatarCore and ChatAvatar objects. - returnAvatar = (*iterCore); - m_tempModeratorAvatarsCore.erase(iterCore); + ChatAvatar *returnAvatar = nullptr; - // because the addBan() made the ChatAvatar, removeBan() deletes it. - set::iterator iter = m_tempModeratorAvatars.begin(); + set::iterator iter = m_banAvatars.begin(); - for(; iter != m_tempModeratorAvatars.end(); ++iter) + for (; iter != m_banAvatars.end(); ++iter) { ChatAvatar *avatar = (*iter); Plat_Unicode::String avatarName(avatar->getName().string_data, avatar->getName().string_length); @@ -672,67 +304,43 @@ ChatAvatarCore *ChatRoomCore::removeTempModerator(const Plat_Unicode::String &na } } - if(iter != m_tempModeratorAvatars.end()) + if (iter != m_banAvatars.end()) { - delete (*iter); - m_tempModeratorAvatars.erase(iter); + returnAvatar = (*iter); } + return(returnAvatar); } - // pass back the ChatAvatarCore and let caller delete it (b/c he created it). - return(returnAvatar); -} - -ChatAvatarCore *ChatRoomCore::addInvite(ChatAvatarCore* newAvatar) -{ - ChatAvatarCore *returnAvatar = nullptr; - - if(newAvatar) + ChatAvatarCore *ChatRoomCore::getInvitedCore(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - pair< set::iterator, bool > result; + ChatAvatarCore *returnAvatar = nullptr; - result = m_inviteAvatarsCore.insert(newAvatar); - - // if add of ChatAvatarCore works, add a new ChatAvatar also. - if (result.second == true) + set::iterator iterCore = m_inviteAvatarsCore.begin(); + + for (; iterCore != m_inviteAvatarsCore.end(); ++iterCore) { - ChatAvatar *avatar = newAvatar->getNewChatAvatar(); - - m_inviteAvatars.insert(avatar); - - returnAvatar = newAvatar; + ChatAvatarCore *avatarCore = (*iterCore); + if (caseInsensitiveCompare(name, avatarCore->getName()) && + caseInsensitiveCompare(address, avatarCore->getAddress(), true)) + { + break; + } } - } - - return returnAvatar; -} -ChatAvatarCore *ChatRoomCore::removeInvite(const Plat_Unicode::String &name, const Plat_Unicode::String &address) -{ - ChatAvatarCore *returnAvatar = nullptr; - - set::iterator iterCore = m_inviteAvatarsCore.begin(); - - for(; iterCore != m_inviteAvatarsCore.end(); ++iterCore) - { - ChatAvatarCore *avatarCore = (*iterCore); - if (caseInsensitiveCompare(name, avatarCore->getName()) && - caseInsensitiveCompare(address, avatarCore->getAddress(), true)) + if (iterCore != m_inviteAvatarsCore.end()) { - break; + returnAvatar = (*iterCore); } + return(returnAvatar); } - if(iterCore != m_inviteAvatarsCore.end()) + ChatAvatar *ChatRoomCore::getInvited(const Plat_Unicode::String &name, const Plat_Unicode::String &address) { - // remove ChatAvatarCore and ChatAvatar objects. - returnAvatar = (*iterCore); - m_inviteAvatarsCore.erase(iterCore); + ChatAvatar *returnAvatar = nullptr; - // because the addBan() made the ChatAvatar, removeBan() deletes it. set::iterator iter = m_inviteAvatars.begin(); - for(; iter != m_inviteAvatars.end(); ++iter) + for (; iter != m_inviteAvatars.end(); ++iter) { ChatAvatar *avatar = (*iter); Plat_Unicode::String avatarName(avatar->getName().string_data, avatar->getName().string_length); @@ -744,67 +352,551 @@ ChatAvatarCore *ChatRoomCore::removeInvite(const Plat_Unicode::String &name, con } } - if(iter != m_inviteAvatars.end()) + if (iter != m_inviteAvatars.end()) { - delete (*iter); - m_inviteAvatars.erase(iter); + returnAvatar = (*iter); } + return(returnAvatar); } - // pass back the ChatAvatarCore and let caller delete it (b/c he created it). - return(returnAvatar); -} - -ChatAvatarCore *ChatRoomCore::addVoice(ChatAvatarCore* newAvatar) -{ - ChatAvatarCore *returnAvatar = nullptr; - - if(newAvatar) + ChatAvatarCore *ChatRoomCore::addAvatar(ChatAvatarCore *newAvatar, bool local) { - pair< set::iterator, bool > result; + ChatAvatarCore *returnAvatar = nullptr; - result = m_voiceAvatarsCore.insert(newAvatar); - - // if add of ChatAvatarCore works, add a new ChatAvatar also. - if (result.second == true) + if (newAvatar) { - ChatAvatar *avatar = newAvatar->getNewChatAvatar(); + pair< map::iterator, bool > result; - m_voiceAvatars.insert(avatar); + result = m_inroomAvatarsCore.insert(pair(newAvatar->getAvatarID(), newAvatar)); - returnAvatar = newAvatar; + // if add of ChatAvatarCore works, add a new ChatAvatar also. + if (result.second == true) + { + ChatAvatar *avatar = newAvatar->getNewChatAvatar(); + + m_inroomAvatars.insert(pair(avatar->getAvatarID(), avatar)); + + // keep track of avatars connected to this API that are in room + if (local) + { + m_inroomAvatarsLocal.insert(newAvatar->getAvatarID()); + } + + returnAvatar = newAvatar; + } } - } - - return returnAvatar; -} -ChatAvatarCore *ChatRoomCore::removeVoice(const Plat_Unicode::String &name, const Plat_Unicode::String &address) -{ - ChatAvatarCore *returnAvatar = nullptr; - - set::iterator iterCore = m_voiceAvatarsCore.begin(); - - for(; iterCore != m_voiceAvatarsCore.end(); ++iterCore) - { - ChatAvatarCore *avatarCore = (*iterCore); - if (caseInsensitiveCompare(name, avatarCore->getName()) && - caseInsensitiveCompare(address, avatarCore->getAddress(), true)) - { - break; - } + return returnAvatar; } - if(iterCore != m_voiceAvatarsCore.end()) + void ChatRoomCore::addLocalAvatar(unsigned avatarID) { - // remove ChatAvatarCore and ChatAvatar objects. - returnAvatar = (*iterCore); - m_voiceAvatarsCore.erase(iterCore); + m_inroomAvatarsLocal.insert(avatarID); + } - // because the addBan() made the ChatAvatar, removeBan() deletes it. - set::iterator iter = m_voiceAvatars.begin(); + ChatAvatarCore *ChatRoomCore::removeAvatar(unsigned avatarID) + { + ChatAvatarCore *returnAvatar = nullptr; - for(; iter != m_voiceAvatars.end(); ++iter) + map::iterator iterCore = m_inroomAvatarsCore.find(avatarID); + + if (iterCore != m_inroomAvatarsCore.end()) + { + // remove ChatAvatarCore and ChatAvatar objects. + returnAvatar = (*iterCore).second; + + m_inroomAvatarsCore.erase(iterCore); + + // because the addAvatar() made the ChatAvatar, removeAvatar() deletes it. + map::iterator iter = m_inroomAvatars.find(avatarID); + delete (*iter).second; + m_inroomAvatars.erase(avatarID); + + // remove from cache of local API avatars logged into this room, if nec. + std::set::iterator localIter = m_inroomAvatarsLocal.find(avatarID); + if (localIter != m_inroomAvatarsLocal.end()) + m_inroomAvatarsLocal.erase(localIter); + } + + // pass back the ChatAvatarCore and let caller delete it (b/c he created it). + return(returnAvatar); + } + + ChatAvatarCore *ChatRoomCore::addBan(ChatAvatarCore *newAvatar) + { + ChatAvatarCore *returnAvatar = nullptr; + + if (newAvatar) + { + pair< set::iterator, bool > result; + + result = m_banAvatarsCore.insert(newAvatar); + + // if add of ChatAvatarCore works, add a new ChatAvatar also. + if (result.second == true) + { + ChatAvatar *avatar = newAvatar->getNewChatAvatar(); + + m_banAvatars.insert(avatar); + + returnAvatar = newAvatar; + } + } + + return returnAvatar; + } + + ChatAvatarCore *ChatRoomCore::removeBan(const Plat_Unicode::String &name, const Plat_Unicode::String &address) + { + ChatAvatarCore *returnAvatar = nullptr; + + set::iterator iterCore = m_banAvatarsCore.begin(); + + for (; iterCore != m_banAvatarsCore.end(); ++iterCore) + { + ChatAvatarCore *avatarCore = (*iterCore); + if (caseInsensitiveCompare(name, avatarCore->getName()) && + caseInsensitiveCompare(address, avatarCore->getAddress(), true)) + { + break; + } + } + + if (iterCore != m_banAvatarsCore.end()) + { + // remove ChatAvatarCore and ChatAvatar objects. + returnAvatar = (*iterCore); + m_banAvatarsCore.erase(iterCore); + + // because the addBan() made the ChatAvatar, removeBan() deletes it. + set::iterator iter = m_banAvatars.begin(); + + for (; iter != m_banAvatars.end(); ++iter) + { + ChatAvatar *avatar = (*iter); + Plat_Unicode::String avatarName(avatar->getName().string_data, avatar->getName().string_length); + Plat_Unicode::String avatarAddress(avatar->getAddress().string_data, avatar->getAddress().string_length); + if (caseInsensitiveCompare(name, avatarName) && + caseInsensitiveCompare(address, avatarAddress, true)) + { + break; + } + } + + if (iter != m_banAvatars.end()) + { + delete (*iter); + m_banAvatars.erase(iter); + } + } + + // pass back the ChatAvatarCore and let caller delete it (b/c he created it). + return(returnAvatar); + } + + ChatAvatarCore *ChatRoomCore::addAdministrator(ChatAvatarCore *newAvatar) + { + ChatAvatarCore *returnAvatar = nullptr; + + if (newAvatar) + { + pair< map::iterator, bool > result; + + result = this->m_adminAvatarsCore.insert(pair(newAvatar->getAvatarID(), newAvatar)); + + // if add of ChatAvatarCore works, add a new ChatAvatar also. + if (result.second == true) + { + ChatAvatar *avatar = newAvatar->getNewChatAvatar(); + + m_adminAvatars.insert(pair(avatar->getAvatarID(), avatar)); + + returnAvatar = newAvatar; + } + } + + return returnAvatar; + } + + ChatAvatarCore *ChatRoomCore::removeAdministrator(unsigned avatarID) + { + ChatAvatarCore *returnAvatar = nullptr; + + map::iterator iterCore = m_adminAvatarsCore.find(avatarID); + + if (iterCore != m_adminAvatarsCore.end()) + { + // remove ChatAvatarCore and ChatAvatar objects. + returnAvatar = (*iterCore).second; + + m_adminAvatarsCore.erase(iterCore); + + // because the addAvatar() made the ChatAvatar, removeAvatar() deletes it. + map::iterator iter = m_adminAvatars.find(avatarID); + delete (*iter).second; + m_adminAvatars.erase(avatarID); + } + + // pass back the ChatAvatarCore and let caller delete it (b/c he created it). + return(returnAvatar); + } + + ChatAvatarCore *ChatRoomCore::addModerator(ChatAvatarCore *newAvatar) + { + ChatAvatarCore *returnAvatar = nullptr; + + if (newAvatar) + { + pair< set::iterator, bool > result; + + result = this->m_moderatorAvatarsCore.insert(newAvatar); + + // if add of ChatAvatarCore works, add a new ChatAvatar also. + if (result.second == true) + { + ChatAvatar *avatar = newAvatar->getNewChatAvatar(); + + m_moderatorAvatars.insert(avatar); + + returnAvatar = newAvatar; + } + } + + return returnAvatar; + } + + ChatAvatarCore *ChatRoomCore::removeModerator(const Plat_Unicode::String &name, const Plat_Unicode::String &address) + { + ChatAvatarCore *returnAvatar = nullptr; + + set::iterator iterCore = m_moderatorAvatarsCore.begin(); + + for (; iterCore != m_moderatorAvatarsCore.end(); ++iterCore) + { + ChatAvatarCore *avatarCore = (*iterCore); + if (caseInsensitiveCompare(name, avatarCore->getName()) && + caseInsensitiveCompare(address, avatarCore->getAddress(), true)) + { + break; + } + } + + if (iterCore != m_moderatorAvatarsCore.end()) + { + // remove ChatAvatarCore and ChatAvatar objects. + returnAvatar = (*iterCore); + m_moderatorAvatarsCore.erase(iterCore); + + // because the addBan() made the ChatAvatar, removeBan() deletes it. + set::iterator iter = m_moderatorAvatars.begin(); + + for (; iter != m_moderatorAvatars.end(); ++iter) + { + ChatAvatar *avatar = (*iter); + Plat_Unicode::String avatarName(avatar->getName().string_data, avatar->getName().string_length); + Plat_Unicode::String avatarAddress(avatar->getAddress().string_data, avatar->getAddress().string_length); + if (caseInsensitiveCompare(name, avatarName) && + caseInsensitiveCompare(address, avatarAddress, true)) + { + break; + } + } + + if (iter != m_moderatorAvatars.end()) + { + delete (*iter); + m_moderatorAvatars.erase(iter); + } + } + + // pass back the ChatAvatarCore and let caller delete it (b/c he created it). + return(returnAvatar); + } + + ChatAvatarCore *ChatRoomCore::addTempModerator(ChatAvatarCore *newAvatar) + { + ChatAvatarCore *returnAvatar = nullptr; + + if (newAvatar) + { + pair< set::iterator, bool > result; + + result = this->m_tempModeratorAvatarsCore.insert(newAvatar); + + // if add of ChatAvatarCore works, add a new ChatAvatar also. + if (result.second == true) + { + ChatAvatar *avatar = newAvatar->getNewChatAvatar(); + + m_tempModeratorAvatars.insert(avatar); + + returnAvatar = newAvatar; + } + } + + return returnAvatar; + } + + ChatAvatarCore *ChatRoomCore::removeTempModerator(const Plat_Unicode::String &name, const Plat_Unicode::String &address) + { + ChatAvatarCore *returnAvatar = nullptr; + + set::iterator iterCore = m_tempModeratorAvatarsCore.begin(); + + for (; iterCore != m_tempModeratorAvatarsCore.end(); ++iterCore) + { + ChatAvatarCore *avatarCore = (*iterCore); + if (caseInsensitiveCompare(name, avatarCore->getName()) && + caseInsensitiveCompare(address, avatarCore->getAddress(), true)) + { + break; + } + } + + if (iterCore != m_tempModeratorAvatarsCore.end()) + { + // remove ChatAvatarCore and ChatAvatar objects. + returnAvatar = (*iterCore); + m_tempModeratorAvatarsCore.erase(iterCore); + + // because the addBan() made the ChatAvatar, removeBan() deletes it. + set::iterator iter = m_tempModeratorAvatars.begin(); + + for (; iter != m_tempModeratorAvatars.end(); ++iter) + { + ChatAvatar *avatar = (*iter); + Plat_Unicode::String avatarName(avatar->getName().string_data, avatar->getName().string_length); + Plat_Unicode::String avatarAddress(avatar->getAddress().string_data, avatar->getAddress().string_length); + if (caseInsensitiveCompare(name, avatarName) && + caseInsensitiveCompare(address, avatarAddress, true)) + { + break; + } + } + + if (iter != m_tempModeratorAvatars.end()) + { + delete (*iter); + m_tempModeratorAvatars.erase(iter); + } + } + + // pass back the ChatAvatarCore and let caller delete it (b/c he created it). + return(returnAvatar); + } + + ChatAvatarCore *ChatRoomCore::addInvite(ChatAvatarCore* newAvatar) + { + ChatAvatarCore *returnAvatar = nullptr; + + if (newAvatar) + { + pair< set::iterator, bool > result; + + result = m_inviteAvatarsCore.insert(newAvatar); + + // if add of ChatAvatarCore works, add a new ChatAvatar also. + if (result.second == true) + { + ChatAvatar *avatar = newAvatar->getNewChatAvatar(); + + m_inviteAvatars.insert(avatar); + + returnAvatar = newAvatar; + } + } + + return returnAvatar; + } + + ChatAvatarCore *ChatRoomCore::removeInvite(const Plat_Unicode::String &name, const Plat_Unicode::String &address) + { + ChatAvatarCore *returnAvatar = nullptr; + + set::iterator iterCore = m_inviteAvatarsCore.begin(); + + for (; iterCore != m_inviteAvatarsCore.end(); ++iterCore) + { + ChatAvatarCore *avatarCore = (*iterCore); + if (caseInsensitiveCompare(name, avatarCore->getName()) && + caseInsensitiveCompare(address, avatarCore->getAddress(), true)) + { + break; + } + } + + if (iterCore != m_inviteAvatarsCore.end()) + { + // remove ChatAvatarCore and ChatAvatar objects. + returnAvatar = (*iterCore); + m_inviteAvatarsCore.erase(iterCore); + + // because the addBan() made the ChatAvatar, removeBan() deletes it. + set::iterator iter = m_inviteAvatars.begin(); + + for (; iter != m_inviteAvatars.end(); ++iter) + { + ChatAvatar *avatar = (*iter); + Plat_Unicode::String avatarName(avatar->getName().string_data, avatar->getName().string_length); + Plat_Unicode::String avatarAddress(avatar->getAddress().string_data, avatar->getAddress().string_length); + if (caseInsensitiveCompare(name, avatarName) && + caseInsensitiveCompare(address, avatarAddress, true)) + { + break; + } + } + + if (iter != m_inviteAvatars.end()) + { + delete (*iter); + m_inviteAvatars.erase(iter); + } + } + + // pass back the ChatAvatarCore and let caller delete it (b/c he created it). + return(returnAvatar); + } + + ChatAvatarCore *ChatRoomCore::addVoice(ChatAvatarCore* newAvatar) + { + ChatAvatarCore *returnAvatar = nullptr; + + if (newAvatar) + { + pair< set::iterator, bool > result; + + result = m_voiceAvatarsCore.insert(newAvatar); + + // if add of ChatAvatarCore works, add a new ChatAvatar also. + if (result.second == true) + { + ChatAvatar *avatar = newAvatar->getNewChatAvatar(); + + m_voiceAvatars.insert(avatar); + + returnAvatar = newAvatar; + } + } + + return returnAvatar; + } + + ChatAvatarCore *ChatRoomCore::removeVoice(const Plat_Unicode::String &name, const Plat_Unicode::String &address) + { + ChatAvatarCore *returnAvatar = nullptr; + + set::iterator iterCore = m_voiceAvatarsCore.begin(); + + for (; iterCore != m_voiceAvatarsCore.end(); ++iterCore) + { + ChatAvatarCore *avatarCore = (*iterCore); + if (caseInsensitiveCompare(name, avatarCore->getName()) && + caseInsensitiveCompare(address, avatarCore->getAddress(), true)) + { + break; + } + } + + if (iterCore != m_voiceAvatarsCore.end()) + { + // remove ChatAvatarCore and ChatAvatar objects. + returnAvatar = (*iterCore); + m_voiceAvatarsCore.erase(iterCore); + + // because the addBan() made the ChatAvatar, removeBan() deletes it. + set::iterator iter = m_voiceAvatars.begin(); + + for (; iter != m_voiceAvatars.end(); ++iter) + { + ChatAvatar *avatar = (*iter); + Plat_Unicode::String avatarName(avatar->getName().string_data, avatar->getName().string_length); + Plat_Unicode::String avatarAddress(avatar->getAddress().string_data, avatar->getAddress().string_length); + if (caseInsensitiveCompare(name, avatarName) && + caseInsensitiveCompare(address, avatarAddress, true)) + { + break; + } + } + + if (iter != m_voiceAvatars.end()) + { + delete (*iter); + m_voiceAvatars.erase(iter); + } + } + + // pass back the ChatAvatarCore and let caller delete it (b/c he created it). + return(returnAvatar); + } + + // ------- ChatRoom class support functions + + unsigned ChatRoomCore::getAvatarCount() const + { + return m_inroomAvatarsCore.size(); + } + + unsigned ChatRoomCore::getBanCount() const + { + return m_banAvatarsCore.size(); + } + + unsigned ChatRoomCore::getInviteCount() const + { + return m_inviteAvatarsCore.size(); + } + + unsigned ChatRoomCore::getModeratorCount() const + { + return m_moderatorAvatarsCore.size(); + } + + unsigned ChatRoomCore::getTemporaryModeratorCount() const + { + return m_tempModeratorAvatarsCore.size(); + } + + unsigned ChatRoomCore::getVoiceCount() const + { + return m_voiceAvatarsCore.size(); + } + + AvatarIteratorCore ChatRoomCore::getFirstAvatar() + { + return (AvatarIteratorCore(&m_inroomAvatars, m_inroomAvatars.begin())); + } + + AvatarIteratorCore ChatRoomCore::findAvatar(unsigned avatarID) + { + return (AvatarIteratorCore(&m_inroomAvatars, m_inroomAvatars.find(avatarID))); + } + + AvatarIteratorCore ChatRoomCore::findAvatar(const String &name, const String &address) + { + map::iterator iter; + + for (iter = m_inroomAvatars.begin(); iter != m_inroomAvatars.end(); ++iter) + { + if (String((*iter).second->getName().string_data, (*iter).second->getName().string_length) == name && + String((*iter).second->getAddress().string_data, (*iter).second->getAddress().string_length) == address) + { + break; + } + } + + return (AvatarIteratorCore(&m_inroomAvatars, iter)); + } + + ModeratorIteratorCore ChatRoomCore::getFirstModerator() + { + return (ModeratorIteratorCore(&m_moderatorAvatars, m_moderatorAvatars.begin())); + } + + ModeratorIteratorCore ChatRoomCore::findModerator(const String &name, const String &address) + { + set::iterator iter; + + for (iter = m_moderatorAvatars.begin(); iter != m_moderatorAvatars.end(); ++iter) { ChatAvatar *avatar = (*iter); Plat_Unicode::String avatarName(avatar->getName().string_data, avatar->getName().string_length); @@ -816,328 +908,235 @@ ChatAvatarCore *ChatRoomCore::removeVoice(const Plat_Unicode::String &name, cons } } - if(iter != m_voiceAvatars.end()) + return (ModeratorIteratorCore(&m_moderatorAvatars, iter)); + } + + TemporaryModeratorIteratorCore ChatRoomCore::getFirstTemporaryModerator() + { + return (TemporaryModeratorIteratorCore(&m_tempModeratorAvatars, m_tempModeratorAvatars.begin())); + } + + TemporaryModeratorIteratorCore ChatRoomCore::findTemporaryModerator(const String &name, const String &address) + { + set::iterator iter; + + for (iter = m_tempModeratorAvatars.begin(); iter != m_tempModeratorAvatars.end(); ++iter) { - delete (*iter); - m_voiceAvatars.erase(iter); + ChatAvatar *avatar = (*iter); + Plat_Unicode::String avatarName(avatar->getName().string_data, avatar->getName().string_length); + Plat_Unicode::String avatarAddress(avatar->getAddress().string_data, avatar->getAddress().string_length); + if (caseInsensitiveCompare(name, avatarName) && + caseInsensitiveCompare(address, avatarAddress, true)) + { + break; + } } + + return (TemporaryModeratorIteratorCore(&m_tempModeratorAvatars, iter)); } - // pass back the ChatAvatarCore and let caller delete it (b/c he created it). - return(returnAvatar); -} - -// ------- ChatRoom class support functions - - -unsigned ChatRoomCore::getAvatarCount() const -{ - return m_inroomAvatarsCore.size(); -} - -unsigned ChatRoomCore::getBanCount() const -{ - return m_banAvatarsCore.size(); -} - -unsigned ChatRoomCore::getInviteCount() const -{ - return m_inviteAvatarsCore.size(); -} - -unsigned ChatRoomCore::getModeratorCount() const -{ - return m_moderatorAvatarsCore.size(); -} - -unsigned ChatRoomCore::getTemporaryModeratorCount() const -{ - return m_tempModeratorAvatarsCore.size(); -} - -unsigned ChatRoomCore::getVoiceCount() const -{ - return m_voiceAvatarsCore.size(); -} - -AvatarIteratorCore ChatRoomCore::getFirstAvatar() -{ - return (AvatarIteratorCore(&m_inroomAvatars, m_inroomAvatars.begin())); -} - -AvatarIteratorCore ChatRoomCore::findAvatar(unsigned avatarID) -{ - return (AvatarIteratorCore(&m_inroomAvatars, m_inroomAvatars.find(avatarID))); -} - -AvatarIteratorCore ChatRoomCore::findAvatar(const String &name, const String &address) -{ - map::iterator iter; - - for (iter = m_inroomAvatars.begin(); iter != m_inroomAvatars.end(); ++iter) + BanIteratorCore ChatRoomCore::getFirstBanned() { - if(String((*iter).second->getName().string_data, (*iter).second->getName().string_length) == name && - String((*iter).second->getAddress().string_data, (*iter).second->getAddress().string_length) == address) + return (BanIteratorCore(&m_banAvatars, m_banAvatars.begin())); + } + + BanIteratorCore ChatRoomCore::findBanned(const String &name, const String &address) + { + set::iterator iter; + + for (iter = m_banAvatars.begin(); iter != m_banAvatars.end(); ++iter) { - break; + ChatAvatar *avatar = (*iter); + Plat_Unicode::String avatarName(avatar->getName().string_data, avatar->getName().string_length); + Plat_Unicode::String avatarAddress(avatar->getAddress().string_data, avatar->getAddress().string_length); + if (caseInsensitiveCompare(name, avatarName) && + caseInsensitiveCompare(address, avatarAddress, true)) + { + break; + } } + + return (BanIteratorCore(&m_banAvatars, iter)); } - return (AvatarIteratorCore(&m_inroomAvatars, iter)); -} - -ModeratorIteratorCore ChatRoomCore::getFirstModerator() -{ - return (ModeratorIteratorCore(&m_moderatorAvatars, m_moderatorAvatars.begin())); -} - -ModeratorIteratorCore ChatRoomCore::findModerator(const String &name, const String &address) -{ - set::iterator iter; - - for (iter = m_moderatorAvatars.begin(); iter != m_moderatorAvatars.end(); ++iter) + InviteIteratorCore ChatRoomCore::getFirstInvited() { - ChatAvatar *avatar = (*iter); - Plat_Unicode::String avatarName(avatar->getName().string_data, avatar->getName().string_length); - Plat_Unicode::String avatarAddress(avatar->getAddress().string_data, avatar->getAddress().string_length); - if (caseInsensitiveCompare(name, avatarName) && - caseInsensitiveCompare(address, avatarAddress, true)) + return (InviteIteratorCore(&m_inviteAvatars, m_inviteAvatars.begin())); + } + + InviteIteratorCore ChatRoomCore::findInvited(const String &name, const String &address) + { + set::iterator iter; + + for (iter = m_inviteAvatars.begin(); iter != m_inviteAvatars.end(); ++iter) { - break; + ChatAvatar *avatar = (*iter); + Plat_Unicode::String avatarName(avatar->getName().string_data, avatar->getName().string_length); + Plat_Unicode::String avatarAddress(avatar->getAddress().string_data, avatar->getAddress().string_length); + if (caseInsensitiveCompare(name, avatarName) && + caseInsensitiveCompare(address, avatarAddress, true)) + { + break; + } } + + return (InviteIteratorCore(&m_inviteAvatars, iter)); } - return (ModeratorIteratorCore(&m_moderatorAvatars, iter)); -} - -TemporaryModeratorIteratorCore ChatRoomCore::getFirstTemporaryModerator() -{ - return (TemporaryModeratorIteratorCore(&m_tempModeratorAvatars, m_tempModeratorAvatars.begin())); -} - -TemporaryModeratorIteratorCore ChatRoomCore::findTemporaryModerator(const String &name, const String &address) -{ - set::iterator iter; - - for (iter = m_tempModeratorAvatars.begin(); iter != m_tempModeratorAvatars.end(); ++iter) + VoiceIteratorCore ChatRoomCore::getFirstVoice() { - ChatAvatar *avatar = (*iter); - Plat_Unicode::String avatarName(avatar->getName().string_data, avatar->getName().string_length); - Plat_Unicode::String avatarAddress(avatar->getAddress().string_data, avatar->getAddress().string_length); - if (caseInsensitiveCompare(name, avatarName) && - caseInsensitiveCompare(address, avatarAddress, true)) + return (VoiceIteratorCore(&m_voiceAvatars, m_voiceAvatars.begin())); + } + + VoiceIteratorCore ChatRoomCore::findVoice(const String &name, const String &address) + { + set::iterator iter; + + for (iter = m_voiceAvatars.begin(); iter != m_voiceAvatars.end(); ++iter) { - break; + ChatAvatar *avatar = (*iter); + Plat_Unicode::String avatarName(avatar->getName().string_data, avatar->getName().string_length); + Plat_Unicode::String avatarAddress(avatar->getAddress().string_data, avatar->getAddress().string_length); + if (caseInsensitiveCompare(name, avatarName) && + caseInsensitiveCompare(address, avatarAddress, true)) + { + break; + } } + + return (VoiceIteratorCore(&m_voiceAvatars, iter)); } - return (TemporaryModeratorIteratorCore(&m_tempModeratorAvatars, iter)); -} - -BanIteratorCore ChatRoomCore::getFirstBanned() -{ - return (BanIteratorCore(&m_banAvatars, m_banAvatars.begin())); -} - -BanIteratorCore ChatRoomCore::findBanned(const String &name, const String &address) -{ - set::iterator iter; - - for (iter = m_banAvatars.begin(); iter != m_banAvatars.end(); ++iter) + void ChatRoomCore::serializeWithLocalAvatarsOnly(Base::ByteStream &msg) { - ChatAvatar *avatar = (*iter); - Plat_Unicode::String avatarName(avatar->getName().string_data, avatar->getName().string_length); - Plat_Unicode::String avatarAddress(avatar->getAddress().string_data, avatar->getAddress().string_length); - if (caseInsensitiveCompare(name, avatarName) && - caseInsensitiveCompare(address, avatarAddress, true)) + // put creator name + put(msg, m_creatorName); + + // put creator address + put(msg, m_creatorAddress); + + // put creator ID + put(msg, m_creatorID); + + // put room name + put(msg, m_roomName); + + // put room topic + put(msg, m_roomTopic); + + // put room password + put(msg, m_roomPassword); + + // put room prefix + put(msg, m_roomPrefix); + + // put room address + put(msg, m_roomAddress); + + // put room attributes + put(msg, m_roomAttributes); + + // put room max size + put(msg, m_maxRoomSize); + + // put room ID + put(msg, m_roomID); + + // put room creation time + put(msg, m_createTime); + + // put in-room avatars + unsigned avatarCount = m_inroomAvatarsCore.size(); + + std::map::iterator avatarIter; + std::set avatarsToSend; + + for (avatarIter = m_inroomAvatarsCore.begin(); avatarIter != m_inroomAvatarsCore.end(); ++avatarIter) { - break; + // include only the avatars that are on this API + if (this->getAvatar((*avatarIter).second->getAvatarID()) != nullptr) + { + avatarsToSend.insert((*avatarIter).second); + } } - } - return (BanIteratorCore(&m_banAvatars, iter)); -} + // actually send avatars from this API *after* they have been counted + avatarCount = avatarsToSend.size(); + put(msg, avatarCount); -InviteIteratorCore ChatRoomCore::getFirstInvited() -{ - return (InviteIteratorCore(&m_inviteAvatars, m_inviteAvatars.begin())); -} - -InviteIteratorCore ChatRoomCore::findInvited(const String &name, const String &address) -{ - set::iterator iter; - - for (iter = m_inviteAvatars.begin(); iter != m_inviteAvatars.end(); ++iter) - { - ChatAvatar *avatar = (*iter); - Plat_Unicode::String avatarName(avatar->getName().string_data, avatar->getName().string_length); - Plat_Unicode::String avatarAddress(avatar->getAddress().string_data, avatar->getAddress().string_length); - if (caseInsensitiveCompare(name, avatarName) && - caseInsensitiveCompare(address, avatarAddress, true)) + std::set::iterator sendIter; + for (sendIter = avatarsToSend.begin(); sendIter != avatarsToSend.end(); ++sendIter) { - break; + (*sendIter)->serialize(msg); } - } - return (InviteIteratorCore(&m_inviteAvatars, iter)); -} + // put administrator avatars + unsigned administratorCount = m_adminAvatarsCore.size(); + put(msg, administratorCount); -VoiceIteratorCore ChatRoomCore::getFirstVoice() -{ - return (VoiceIteratorCore(&m_voiceAvatars, m_voiceAvatars.begin())); -} - -VoiceIteratorCore ChatRoomCore::findVoice(const String &name, const String &address) -{ - set::iterator iter; - - for (iter = m_voiceAvatars.begin(); iter != m_voiceAvatars.end(); ++iter) - { - ChatAvatar *avatar = (*iter); - Plat_Unicode::String avatarName(avatar->getName().string_data, avatar->getName().string_length); - Plat_Unicode::String avatarAddress(avatar->getAddress().string_data, avatar->getAddress().string_length); - if (caseInsensitiveCompare(name, avatarName) && - caseInsensitiveCompare(address, avatarAddress, true)) + std::map::iterator adminIter; + for (adminIter = m_adminAvatarsCore.begin(); adminIter != m_adminAvatarsCore.end(); ++adminIter) { - break; + (*adminIter).second->serialize(msg); } - } - return (VoiceIteratorCore(&m_voiceAvatars, iter)); -} + // put moderator avatars + unsigned moderatorCount = m_moderatorAvatarsCore.size(); + put(msg, moderatorCount); -void ChatRoomCore::serializeWithLocalAvatarsOnly(Base::ByteStream &msg) -{ - // put creator name - put(msg, m_creatorName); - - // put creator address - put(msg, m_creatorAddress); - - // put creator ID - put(msg, m_creatorID); - - // put room name - put(msg, m_roomName); - - // put room topic - put(msg, m_roomTopic); - - // put room password - put(msg, m_roomPassword); - - // put room prefix - put(msg, m_roomPrefix); - - // put room address - put(msg, m_roomAddress); - - // put room attributes - put(msg, m_roomAttributes); - - // put room max size - put(msg, m_maxRoomSize); - - // put room ID - put(msg, m_roomID); - - // put room creation time - put(msg, m_createTime); - - // put in-room avatars - unsigned avatarCount = m_inroomAvatarsCore.size(); - - std::map::iterator avatarIter; - std::set avatarsToSend; - - for (avatarIter = m_inroomAvatarsCore.begin(); avatarIter != m_inroomAvatarsCore.end(); ++avatarIter) - { - // include only the avatars that are on this API - if ( this->getAvatar((*avatarIter).second->getAvatarID()) != nullptr ) + std::set::iterator moderatorIter; + for (moderatorIter = m_moderatorAvatarsCore.begin(); moderatorIter != m_moderatorAvatarsCore.end(); ++moderatorIter) { - avatarsToSend.insert((*avatarIter).second); + (*moderatorIter)->serialize(msg); } + + // put temporary moderator avatars + unsigned tempModeratorCount = m_tempModeratorAvatarsCore.size(); + put(msg, tempModeratorCount); + + std::set::iterator tempModeratorIter; + for (tempModeratorIter = m_tempModeratorAvatarsCore.begin(); tempModeratorIter != m_tempModeratorAvatarsCore.end(); ++tempModeratorIter) + { + (*tempModeratorIter)->serialize(msg); + } + + // put banned avatars + unsigned bannedCount = m_banAvatarsCore.size(); + put(msg, bannedCount); + + std::set::iterator bannedIter; + for (bannedIter = m_banAvatarsCore.begin(); bannedIter != m_banAvatarsCore.end(); ++bannedIter) + { + (*bannedIter)->serialize(msg); + } + + // put invited avatars + unsigned invitedCount = m_inviteAvatarsCore.size(); + put(msg, invitedCount); + + std::set::iterator invitesIter; + for (invitesIter = m_inviteAvatarsCore.begin(); invitesIter != m_inviteAvatarsCore.end(); ++invitesIter) + { + (*invitesIter)->serialize(msg); + } + + // put voice avatars + unsigned voiceCount = m_voiceAvatarsCore.size(); + put(msg, voiceCount); + + std::set::iterator voicesIter; + for (voicesIter = m_voiceAvatarsCore.begin(); voicesIter != m_voiceAvatarsCore.end(); ++voicesIter) + { + (*voicesIter)->serialize(msg); + } + + put(msg, m_roomMessageID); } - // actually send avatars from this API *after* they have been counted - avatarCount = avatarsToSend.size(); - put(msg, avatarCount); - - std::set::iterator sendIter; - for (sendIter = avatarsToSend.begin(); sendIter != avatarsToSend.end(); ++sendIter) + void ChatRoomCore::setCreator(unsigned creatorID, const Plat_Unicode::String &creatorName, const Plat_Unicode::String &creatorAddress) { - (*sendIter)->serialize(msg); + m_creatorID = creatorID; + m_creatorName = creatorName; + m_creatorAddress = creatorAddress; } - - // put administrator avatars - unsigned administratorCount = m_adminAvatarsCore.size(); - put(msg, administratorCount); - - std::map::iterator adminIter; - for (adminIter = m_adminAvatarsCore.begin(); adminIter != m_adminAvatarsCore.end(); ++adminIter) - { - (*adminIter).second->serialize(msg); - } - - // put moderator avatars - unsigned moderatorCount = m_moderatorAvatarsCore.size(); - put(msg, moderatorCount); - - std::set::iterator moderatorIter; - for (moderatorIter = m_moderatorAvatarsCore.begin(); moderatorIter != m_moderatorAvatarsCore.end(); ++moderatorIter) - { - (*moderatorIter)->serialize(msg); - } - - // put temporary moderator avatars - unsigned tempModeratorCount = m_tempModeratorAvatarsCore.size(); - put(msg, tempModeratorCount); - - std::set::iterator tempModeratorIter; - for (tempModeratorIter = m_tempModeratorAvatarsCore.begin(); tempModeratorIter != m_tempModeratorAvatarsCore.end(); ++tempModeratorIter) - { - (*tempModeratorIter)->serialize(msg); - } - - // put banned avatars - unsigned bannedCount = m_banAvatarsCore.size(); - put(msg, bannedCount); - - std::set::iterator bannedIter; - for (bannedIter = m_banAvatarsCore.begin(); bannedIter != m_banAvatarsCore.end(); ++bannedIter) - { - (*bannedIter)->serialize(msg); - } - - // put invited avatars - unsigned invitedCount = m_inviteAvatarsCore.size(); - put(msg, invitedCount); - - std::set::iterator invitesIter; - for (invitesIter = m_inviteAvatarsCore.begin(); invitesIter != m_inviteAvatarsCore.end(); ++invitesIter) - { - (*invitesIter)->serialize(msg); - } - - // put voice avatars - unsigned voiceCount = m_voiceAvatarsCore.size(); - put(msg, voiceCount); - - std::set::iterator voicesIter; - for (voicesIter = m_voiceAvatarsCore.begin(); voicesIter != m_voiceAvatarsCore.end(); ++voicesIter) - { - (*voicesIter)->serialize(msg); - } - - put(msg, m_roomMessageID); -} - -void ChatRoomCore::setCreator(unsigned creatorID, const Plat_Unicode::String &creatorName, const Plat_Unicode::String &creatorAddress) -{ - m_creatorID = creatorID; - m_creatorName = creatorName; - m_creatorAddress = creatorAddress; -} - -}; - +}; \ No newline at end of file diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Request.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Request.cpp index 2f7600ac..06b643bd 100644 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Request.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Request.cpp @@ -4,1572 +4,1567 @@ #include "ChatRoomCore.h" #include "PersistentMessage.h" -namespace ChatSystem +namespace ChatSystem { + using namespace Base; + using namespace Plat_Unicode; -using namespace Base; -using namespace Plat_Unicode; - -RLoginAvatar::RLoginAvatar(unsigned userID, const ChatUnicodeString &name, const ChatUnicodeString &address, const ChatUnicodeString &avatarLoginLocation, int avatarLoginPriority, int avatarLoginAttributes) -: GenericRequest(REQUEST_LOGINAVATAR), - m_userID(userID), - m_name(name.string_data, name.string_length), - m_address(address.string_data, address.string_length), - m_loginLocation(avatarLoginLocation.string_data, avatarLoginLocation.string_length), - m_loginPriority(avatarLoginPriority), - m_loginAttributes(avatarLoginAttributes) -{ -} - -void RLoginAvatar::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_userID); - put(msg, m_name); - put(msg, m_address); - put(msg, m_loginLocation); - put(msg, m_loginPriority); - put(msg, m_loginAttributes); -} - -RTemporaryAvatar::RTemporaryAvatar(unsigned userID, const ChatUnicodeString &name, const ChatUnicodeString &address, const ChatUnicodeString &avatarLoginLocation ) -: GenericRequest(REQUEST_TEMPORARYAVATAR), -m_userID(userID), -m_name(name.string_data, name.string_length), -m_address(address.string_data, address.string_length), -m_loginLocation(avatarLoginLocation.string_data, avatarLoginLocation.string_length) -{ -} - -void RTemporaryAvatar::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_userID); - put(msg, m_name); - put(msg, m_address); - put(msg, m_loginLocation); -} - -RLogoutAvatar::RLogoutAvatar(unsigned avatarID, const ChatUnicodeString & address) -: GenericRequest(REQUEST_LOGOUTAVATAR) -, m_avatarID(avatarID) -, m_address(address.string_data, address.string_length) -{ -} - -void RLogoutAvatar::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_avatarID); - put(msg, m_address); -} - -RDestroyAvatar::RDestroyAvatar(unsigned avatarID, const ChatUnicodeString & address) -: GenericRequest(REQUEST_DESTROYAVATAR) -, m_avatarID(avatarID) -, m_address(address.string_data, address.string_length) -{ -} - -void RDestroyAvatar::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_avatarID); - put(msg, m_address); -} - -RSetAvatarKeywords::RSetAvatarKeywords(unsigned srcAvatarID, const ChatUnicodeString *keywordsList, unsigned keywordsLength) -: GenericRequest(REQUEST_SETAVATARKEYWORDS), - m_srcAvatarID(srcAvatarID), - m_keywordsLength(keywordsLength) -{ - m_keywordsList = new String[keywordsLength]; - for(unsigned i = 0; i < keywordsLength; i++) + RLoginAvatar::RLoginAvatar(unsigned userID, const ChatUnicodeString &name, const ChatUnicodeString &address, const ChatUnicodeString &avatarLoginLocation, int avatarLoginPriority, int avatarLoginAttributes) + : GenericRequest(REQUEST_LOGINAVATAR), + m_userID(userID), + m_name(name.string_data, name.string_length), + m_address(address.string_data, address.string_length), + m_loginLocation(avatarLoginLocation.string_data, avatarLoginLocation.string_length), + m_loginPriority(avatarLoginPriority), + m_loginAttributes(avatarLoginAttributes) { - m_keywordsList[i].assign(keywordsList[i].string_data, keywordsList[i].string_length); - } -} - -RSetAvatarKeywords::~RSetAvatarKeywords() -{ - delete[] m_keywordsList; -} - -void RSetAvatarKeywords::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_srcAvatarID); - put(msg, m_keywordsLength); - for(unsigned i = 0; i < m_keywordsLength; i++) - { - put(msg, m_keywordsList[i]); - } -} - -RGetAvatarKeywords::RGetAvatarKeywords(unsigned srcAvatarID) -: GenericRequest(REQUEST_GETAVATARKEYWORDS), - m_srcAvatarID(srcAvatarID) -{ -} - -void RGetAvatarKeywords::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_srcAvatarID); -} - -RSearchAvatarKeywords::RSearchAvatarKeywords(const ChatUnicodeString &nodeAddress, const ChatUnicodeString *keywordsList, unsigned keywordsLength) -: GenericRequest(REQUEST_SEARCHAVATARKEYWORDS), - m_keywordsLength(keywordsLength), - m_keywordsList(nullptr) -{ - m_nodeAddress.assign(nodeAddress.string_data); - m_keywordsList = new String[keywordsLength]; - for(unsigned i = 0; i < keywordsLength; i++) - { - m_keywordsList[i].assign(keywordsList[i].string_data, keywordsList[i].string_length); - } -} - -RSearchAvatarKeywords::~RSearchAvatarKeywords() -{ - delete[] m_keywordsList; -} - -void RSearchAvatarKeywords::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_nodeAddress); - put(msg, m_keywordsLength); - for(unsigned i = 0; i < m_keywordsLength; i++) - { - put(msg, m_keywordsList[i]); - } -} - -RGetAvatar::RGetAvatar(const ChatUnicodeString &destName, const ChatUnicodeString &destAddress) -: GenericRequest(REQUEST_GETAVATAR), - m_destName(destName.string_data, destName.string_length), - m_destAddress(destAddress.string_data, destAddress.string_length) -{ -} - -void RGetAvatar::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_destName); - put(msg, m_destAddress); -} - -RGetAnyAvatar::RGetAnyAvatar(const ChatUnicodeString& destName, const ChatUnicodeString& destAddress) - : GenericRequest(REQUEST_GETANYAVATAR) - , m_destName(destName.string_data, destName.string_length) - , m_destAddress(destAddress.string_data, destAddress.string_length ) -{ -} - -void RGetAnyAvatar::pack(Base::ByteStream& msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_destName); - put(msg, m_destAddress); -} - -RAvatarList::RAvatarList(unsigned userID) - : GenericRequest(REQUEST_AVATARLIST) - , m_userID( userID ) -{ -} - -void RAvatarList::pack(Base::ByteStream& msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_userID); -} - -RSetAvatarAttributes::RSetAvatarAttributes(unsigned avatarID, const ChatUnicodeString &srcAddress, unsigned long avatarAttributes, bool persistent) -: GenericRequest(REQUEST_SETAVATARATTRIBUTES), - m_avatarID(avatarID), - m_avatarAttributes(avatarAttributes), - m_persistent(persistent), - m_srcAddress(srcAddress.string_data, srcAddress.string_length) -{ -} - -void RSetAvatarAttributes::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_avatarID); - put(msg, (uint32)m_avatarAttributes); - put(msg, m_persistent); - put(msg, m_srcAddress); -} - -RSetAvatarStatusMessage::RSetAvatarStatusMessage(unsigned avatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString& statusMessage) -: GenericRequest(REQUEST_SETAVATARSTATUSMESSAGE), -m_avatarID(avatarID), -m_statusMessage(statusMessage.data(),statusMessage.length()), -m_srcAddress(srcAddress.string_data, srcAddress.string_length) -{ -} - -void RSetAvatarStatusMessage::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_avatarID); - put(msg, m_statusMessage); - put(msg, m_srcAddress); -} - -RSetAvatarForwardingEmail::RSetAvatarForwardingEmail(unsigned avatarID, const ChatUnicodeString &avatarForwardingEmail) -: GenericRequest(REQUEST_SETAVATAREMAIL), - m_avatarID(avatarID), - m_avatarForwardingEmail(avatarForwardingEmail.data(), avatarForwardingEmail.length()) -{ -} - -void RSetAvatarForwardingEmail::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_avatarID); - put(msg, m_avatarForwardingEmail); -} - -RSetAvatarInboxLimit::RSetAvatarInboxLimit(unsigned avatarID, unsigned long avatarInboxLimit) -: GenericRequest(REQUEST_SETAVATARINBOXLIMIT), - m_avatarID(avatarID), - m_avatarInboxLimit(avatarInboxLimit) -{ -} - -void RSetAvatarInboxLimit::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_avatarID); - put(msg, (uint32)m_avatarInboxLimit); -} - -RGetRoom::RGetRoom(const ChatUnicodeString &roomAddress) -: GenericRequest(REQUEST_GETROOM), - m_roomAddress(roomAddress.string_data, roomAddress.string_length) -{ -} - -void RGetRoom::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_roomAddress); -} - -RCreateRoom::RCreateRoom(unsigned avatarID, const ChatUnicodeString & srcAddress, const RoomParams ¶ms, const ChatUnicodeString &roomAddress) -: GenericRequest(REQUEST_CREATEROOM), - m_avatarID(avatarID), - m_roomName(params.getRoomName().string_data, params.getRoomName().string_length), - m_roomTopic(params.getRoomTopic().string_data, params.getRoomTopic().string_length), - m_roomPassword(params.getRoomPassword().string_data, params.getRoomPassword().string_length), - m_roomAttributes(params.getRoomAttributes()), - m_maxRoomSize(params.getRoomMaxSize()), - m_roomAddress(roomAddress.string_data, roomAddress.string_length), - m_srcAddress(srcAddress.string_data, srcAddress.string_length) -{ -} - -void RCreateRoom::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_avatarID); - put(msg, m_roomName); - put(msg, m_roomTopic); - put(msg, m_roomPassword); - put(msg, m_roomAttributes); - put(msg, m_maxRoomSize); - put(msg, m_roomAddress); - put(msg, m_srcAddress); -} - -RDestroyRoom::RDestroyRoom(unsigned avatarID, const ChatUnicodeString & srcAddress, const ChatUnicodeString &roomAddress) -: GenericRequest(REQUEST_DESTROYROOM), - m_avatarID(avatarID), - m_roomAddress(roomAddress.string_data, roomAddress.string_length), - m_srcAddress(srcAddress.string_data, srcAddress.string_length) -{ -} - -void RDestroyRoom::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_avatarID); - put(msg, m_roomAddress); - put(msg, m_srcAddress); -} - -RSendInstantMessage::RSendInstantMessage(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destName, const ChatUnicodeString &destAddress, const ChatUnicodeString &msg, const ChatUnicodeString &oob) -: GenericRequest(REQUEST_SENDINSTANTMESSAGE), - m_srcAvatarID(srcAvatarID), - m_destName(destName.string_data, destName.string_length), - m_destAddress(destAddress.string_data, destAddress.string_length), - m_msg(msg.string_data, msg.string_length), - m_oob(oob.string_data, oob.string_length), - m_srcAddress(srcAddress.string_data, srcAddress.string_length) -{ -} - -void RSendInstantMessage::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_srcAvatarID); - put(msg, m_destName); - put(msg, m_destAddress); - put(msg, m_msg); - put(msg, m_oob); - put(msg, m_srcAddress); -} - -RSendRoomMessage::RSendRoomMessage(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destRoomAddress, const ChatUnicodeString &msg, const ChatUnicodeString &oob) -: GenericRequest(REQUEST_SENDROOMMESSAGE), - m_srcAvatarID(srcAvatarID), - m_destRoomAddress(destRoomAddress.string_data, destRoomAddress.string_length), - m_msg(msg.string_data, msg.string_length), - m_oob(oob.string_data, oob.string_length), - m_srcAddress(srcAddress.string_data, srcAddress.string_length) -{ -} - -void RSendRoomMessage::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_srcAvatarID); - put(msg, m_destRoomAddress); - put(msg, m_msg); - put(msg, m_oob); - put(msg, m_srcAddress); -} - -RSendBroadcastMessage::RSendBroadcastMessage(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destAddress, const ChatUnicodeString &msg, const ChatUnicodeString &oob) -: GenericRequest(REQUEST_SENDBROADCASTMESSAGE), - m_srcAvatarID(srcAvatarID), - m_destAddress(destAddress.string_data, destAddress.string_length), - m_msg(msg.string_data, msg.string_length), - m_oob(oob.string_data, oob.string_length), - m_srcAddress(srcAddress.string_data, srcAddress.string_length) -{ -} - -void RSendBroadcastMessage::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_srcAvatarID); - put(msg, m_destAddress); - put(msg, m_msg); - put(msg, m_oob); - put(msg, m_srcAddress); -} - -RFilterMessage::RFilterMessage(const ChatUnicodeString &msg) -: GenericRequest(REQUEST_FILTERMESSAGE), - m_msg(msg.string_data, msg.string_length) -{ -} - -void RFilterMessage::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_msg); -} - -RFilterMessageEx::RFilterMessageEx(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destName, const ChatUnicodeString &destAddress, const ChatUnicodeString &msg) -: GenericRequest(REQUEST_FILTERMESSAGE_EX), - m_srcAvatarID(srcAvatarID), - m_destName(destName.string_data, destName.string_length), - m_destAddress(destAddress.string_data, destAddress.string_length), - m_msg(msg.string_data, msg.string_length) -{ -} - -void RFilterMessageEx::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_srcAvatarID); - put(msg, m_destName); - put(msg, m_destAddress); - put(msg, m_msg); -} - -RAddFriend::RAddFriend(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destName, const ChatUnicodeString &destAddress, const ChatUnicodeString &friendComment, bool confirm) -: GenericRequest(REQUEST_ADDFRIEND), - m_srcAvatarID(srcAvatarID), - m_srcAddress(srcAddress.string_data, srcAddress.string_length), - m_destName(destName.string_data, destName.string_length), - m_destAddress(destAddress.string_data, destAddress.string_length), - m_friendComment(friendComment.string_data, friendComment.string_length), - m_confirm(confirm) -{ -} - -void RAddFriend::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_srcAvatarID); - put(msg, m_destName); - put(msg, m_destAddress); - put(msg, m_friendComment); - put(msg, m_confirm); - put(msg, m_srcAddress); -} - -RAddFriendReciprocate::RAddFriendReciprocate(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destName, const ChatUnicodeString &destAddress, const ChatUnicodeString &friendComment, bool confirm) -: GenericRequest(REQUEST_ADDFRIEND_RECIPROCATE), -m_srcAvatarID(srcAvatarID), -m_srcAddress(srcAddress.string_data, srcAddress.string_length), -m_destName(destName.string_data, destName.string_length), -m_destAddress(destAddress.string_data, destAddress.string_length), -m_friendComment(friendComment.string_data, friendComment.string_length), -m_confirm(confirm) -{ -} - -void RAddFriendReciprocate::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_srcAvatarID); - put(msg, m_destName); - put(msg, m_destAddress); - put(msg, m_friendComment); - put(msg, m_confirm); - put(msg, m_srcAddress); -} - -RSetFriendComment::RSetFriendComment(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destName, const ChatUnicodeString &destAddress, const ChatUnicodeString &friendComment) -: GenericRequest(REQUEST_SETFRIENDCOMMENT), -m_srcAvatarID(srcAvatarID), -m_srcAddress(srcAddress.string_data, srcAddress.string_length), - m_destName(destName.string_data, destName.string_length), - m_destAddress(destAddress.string_data, destAddress.string_length), - m_friendComment(friendComment.string_data, friendComment.string_length) -{ -} - -void RSetFriendComment::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_srcAvatarID); - put(msg, m_destName); - put(msg, m_destAddress); - put(msg, m_friendComment); - put(msg, m_srcAddress); -} - -RRemoveFriend::RRemoveFriend(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destName, const ChatUnicodeString &destAddress) -: GenericRequest(REQUEST_REMOVEFRIEND), -m_srcAvatarID(srcAvatarID), -m_srcAddress(srcAddress.string_data, srcAddress.string_length), - m_destName(destName.string_data, destName.string_length), - m_destAddress(destAddress.string_data, destAddress.string_length) -{ -} - -void RRemoveFriend::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_srcAvatarID); - put(msg, m_destName); - put(msg, m_destAddress); - put(msg, m_srcAddress); -} -RRemoveFriendReciprocate::RRemoveFriendReciprocate(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destName, const ChatUnicodeString &destAddress) -: GenericRequest(REQUEST_REMOVEFRIEND_RECIPROCATE), -m_srcAvatarID(srcAvatarID), -m_srcAddress(srcAddress.string_data, srcAddress.string_length), -m_destName(destName.string_data, destName.string_length), -m_destAddress(destAddress.string_data, destAddress.string_length) -{ -} - -void RRemoveFriendReciprocate::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_srcAvatarID); - put(msg, m_destName); - put(msg, m_destAddress); - put(msg, m_srcAddress); -} -RFriendStatus::RFriendStatus(unsigned srcAvatarID, const ChatUnicodeString &srcAddress) -: GenericRequest(REQUEST_FRIENDSTATUS), -m_srcAvatarID(srcAvatarID), -m_srcAddress(srcAddress.string_data, srcAddress.string_length) -{ -} - -void RFriendStatus::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_srcAvatarID); - put(msg, m_srcAddress); -} - -RAddIgnore::RAddIgnore(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destName, const ChatUnicodeString &destAddress) -: GenericRequest(REQUEST_ADDIGNORE), -m_srcAvatarID(srcAvatarID), -m_srcAddress(srcAddress.string_data, srcAddress.string_length), - m_destName(destName.string_data, destName.string_length), - m_destAddress(destAddress.string_data, destAddress.string_length) -{ -} - -void RAddIgnore::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_srcAvatarID); - put(msg, m_destName); - put(msg, m_destAddress); - put(msg, m_srcAddress); -} - -RRemoveIgnore::RRemoveIgnore(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destName, const ChatUnicodeString &destAddress) -: GenericRequest(REQUEST_REMOVEIGNORE), -m_srcAvatarID(srcAvatarID), -m_srcAddress(srcAddress.string_data, srcAddress.string_length), - m_destName(destName.string_data, destName.string_length), - m_destAddress(destAddress.string_data, destAddress.string_length) -{ -} - -void RRemoveIgnore::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_srcAvatarID); - put(msg, m_destName); - put(msg, m_destAddress); - put(msg, m_srcAddress); -} - - -REnterRoom::REnterRoom(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &roomAddress, const ChatUnicodeString &roomPassword, const RoomParams *roomParams, bool requestingEntry) -: GenericRequest(REQUEST_ENTERROOM), - m_srcAvatarID(srcAvatarID), - m_roomAddress(roomAddress.string_data, roomAddress.string_length), - m_roomPassword(roomPassword.string_data, roomPassword.string_length), - m_requestingEntry(requestingEntry), - m_srcAddress(srcAddress.string_data, srcAddress.string_length) -{ - if (roomParams) - { - // passive room creation if room address does not exist IS enabled - m_passiveCreate = true; - m_paramRoomTopic.assign(roomParams->getRoomTopic().string_data, roomParams->getRoomTopic().string_length); - m_paramRoomAttributes = roomParams->getRoomAttributes(); - m_paramRoomMaxSize = roomParams->getRoomMaxSize(); - } - else - { - // passive room creation disabled - m_passiveCreate = false; - } -} - -void REnterRoom::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_srcAvatarID); - put(msg, m_roomAddress); - put(msg, m_roomPassword); - put(msg, m_passiveCreate); - - if (m_passiveCreate) - { - put(msg, m_paramRoomTopic); - put(msg, m_paramRoomAttributes); - put(msg, m_paramRoomMaxSize); } - put(msg, m_requestingEntry); - put(msg, m_srcAddress); - -} - -RAllowRoomEntry::RAllowRoomEntry(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destAvatarName, const ChatUnicodeString &destAvatarAddress, const ChatUnicodeString &destRoomAddress, bool allow) -: GenericRequest(REQUEST_ALLOWROOMENTRY), -m_srcAvatarID(srcAvatarID), -m_srcAddress(srcAddress.string_data, srcAddress.string_length), - m_destAvatarName(destAvatarName.string_data, destAvatarName.string_length), - m_destAvatarAddress(destAvatarAddress.string_data, destAvatarAddress.string_length), - m_destRoomAddress(destRoomAddress.string_data, destRoomAddress.string_length), - m_allow(allow) -{ -} - -void RAllowRoomEntry::pack(Base::ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_srcAvatarID); - put(msg, m_destAvatarName); - put(msg, m_destAvatarAddress); - put(msg, m_destRoomAddress); - put(msg, m_allow); - put(msg, m_srcAddress); -} - -RLeaveRoom::RLeaveRoom(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &roomAddress) -: GenericRequest(REQUEST_LEAVEROOM), - m_srcAvatarID(srcAvatarID), - m_roomAddress(roomAddress.string_data, roomAddress.string_length), - m_srcAddress(srcAddress.string_data, srcAddress.string_length) -{ -} - -void RLeaveRoom::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_srcAvatarID); - put(msg, m_roomAddress); - put(msg, m_srcAddress); -} - -RAddModerator::RAddModerator(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destAvatarName, const ChatUnicodeString &destAvatarAddress, const ChatUnicodeString &destRoomAddress) -: GenericRequest(REQUEST_ADDMODERATOR), - m_srcAvatarID(srcAvatarID), - m_srcAddress(srcAddress.string_data, srcAddress.string_length), - m_destAvatarName(destAvatarName.string_data, destAvatarName.string_length), - m_destAvatarAddress(destAvatarAddress.string_data, destAvatarAddress.string_length), - m_destRoomAddress(destRoomAddress.string_data, destRoomAddress.string_length) -{ -} - -void RAddModerator::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_srcAvatarID); - put(msg, m_destAvatarName); - put(msg, m_destAvatarAddress); - put(msg, m_destRoomAddress); - put(msg, m_srcAddress); -} - -RRemoveModerator::RRemoveModerator(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destAvatarName, const ChatUnicodeString &destAvatarAddress, const ChatUnicodeString &destRoomAddress) -: GenericRequest(REQUEST_REMOVEMODERATOR), -m_srcAvatarID(srcAvatarID), -m_srcAddress(srcAddress.string_data, srcAddress.string_length), - m_destAvatarName(destAvatarName.string_data, destAvatarName.string_length), - m_destAvatarAddress(destAvatarAddress.string_data, destAvatarAddress.string_length), - m_destRoomAddress(destRoomAddress.string_data, destRoomAddress.string_length) -{ -} - -void RRemoveModerator::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_srcAvatarID); - put(msg, m_destAvatarName); - put(msg, m_destAvatarAddress); - put(msg, m_destRoomAddress); - put(msg, m_srcAddress); -} - -RAddTemporaryModerator::RAddTemporaryModerator(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destAvatarName, const ChatUnicodeString &destAvatarAddress, const ChatUnicodeString &destRoomAddress) -: GenericRequest(REQUEST_ADDTEMPORARYMODERATOR), -m_srcAvatarID(srcAvatarID), -m_srcAddress(srcAddress.string_data, srcAddress.string_length), - m_destAvatarName(destAvatarName.string_data, destAvatarName.string_length), - m_destAvatarAddress(destAvatarAddress.string_data, destAvatarAddress.string_length), - m_destRoomAddress(destRoomAddress.string_data, destRoomAddress.string_length) -{ -} - -void RAddTemporaryModerator::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_srcAvatarID); - put(msg, m_destAvatarName); - put(msg, m_destAvatarAddress); - put(msg, m_destRoomAddress); - put(msg, m_srcAddress); -} - -RRemoveTemporaryModerator::RRemoveTemporaryModerator(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destAvatarName, const ChatUnicodeString &destAvatarAddress, const ChatUnicodeString &destRoomAddress) -: GenericRequest(REQUEST_REMOVETEMPORARYMODERATOR), -m_srcAvatarID(srcAvatarID), -m_srcAddress(srcAddress.string_data, srcAddress.string_length), - m_destAvatarName(destAvatarName.string_data, destAvatarName.string_length), - m_destAvatarAddress(destAvatarAddress.string_data, destAvatarAddress.string_length), - m_destRoomAddress(destRoomAddress.string_data, destRoomAddress.string_length) -{ -} - -void RRemoveTemporaryModerator::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_srcAvatarID); - put(msg, m_destAvatarName); - put(msg, m_destAvatarAddress); - put(msg, m_destRoomAddress); - put(msg, m_srcAddress); -} - - -RAddBan::RAddBan(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destAvatarName, const ChatUnicodeString &destAvatarAddress, const ChatUnicodeString &destRoomAddress) -: GenericRequest(REQUEST_ADDBAN), -m_srcAvatarID(srcAvatarID), -m_srcAddress(srcAddress.string_data, srcAddress.string_length), - m_destAvatarName(destAvatarName.string_data, destAvatarName.string_length), - m_destAvatarAddress(destAvatarAddress.string_data, destAvatarAddress.string_length), - m_destRoomAddress(destRoomAddress.string_data, destRoomAddress.string_length) -{ -} - -void RAddBan::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_srcAvatarID); - put(msg, m_destAvatarName); - put(msg, m_destAvatarAddress); - put(msg, m_destRoomAddress); - put(msg, m_srcAddress); -} - -RRemoveBan::RRemoveBan(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destAvatarName, const ChatUnicodeString &destAvatarAddress, const ChatUnicodeString &destRoomAddress) -: GenericRequest(REQUEST_REMOVEBAN), -m_srcAvatarID(srcAvatarID), -m_srcAddress(srcAddress.string_data, srcAddress.string_length), - m_destAvatarName(destAvatarName.string_data, destAvatarName.string_length), - m_destAvatarAddress(destAvatarAddress.string_data, destAvatarAddress.string_length), - m_destRoomAddress(destRoomAddress.string_data, destRoomAddress.string_length) -{ -} - -void RRemoveBan::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_srcAvatarID); - put(msg, m_destAvatarName); - put(msg, m_destAvatarAddress); - put(msg, m_destRoomAddress); - put(msg, m_srcAddress); -} - -RAddInvite::RAddInvite(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destAvatarName, const ChatUnicodeString &destAvatarAddress, const ChatUnicodeString &destRoomAddress) -: GenericRequest(REQUEST_ADDINVITE), - m_srcAvatarID(srcAvatarID), - m_destAvatarName(destAvatarName.string_data, destAvatarName.string_length), - m_destAvatarAddress(destAvatarAddress.string_data, destAvatarAddress.string_length), - m_destRoomAddress(destRoomAddress.string_data, destRoomAddress.string_length), - m_srcAddress(srcAddress.string_data, srcAddress.string_length) -{ -} - -void RAddInvite::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_srcAvatarID); - put(msg, m_destAvatarName); - put(msg, m_destAvatarAddress); - put(msg, m_destRoomAddress); - put(msg, m_srcAddress); -} - -RRemoveInvite::RRemoveInvite(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destAvatarName, const ChatUnicodeString &destAvatarAddress, const ChatUnicodeString &destRoomAddress) -: GenericRequest(REQUEST_REMOVEINVITE), -m_srcAvatarID(srcAvatarID), -m_srcAddress(srcAddress.string_data, srcAddress.string_length), - m_destAvatarName(destAvatarName.string_data, destAvatarName.string_length), - m_destAvatarAddress(destAvatarAddress.string_data, destAvatarAddress.string_length), - m_destRoomAddress(destRoomAddress.string_data, destRoomAddress.string_length) -{ -} - -void RRemoveInvite::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_srcAvatarID); - put(msg, m_destAvatarName); - put(msg, m_destAvatarAddress); - put(msg, m_destRoomAddress); - put(msg, m_srcAddress); -} - -RGrantVoice::RGrantVoice(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destAvatarName, const ChatUnicodeString &destAvatarAddress, const ChatUnicodeString &destRoomAddress) -: GenericRequest(REQUEST_GRANTVOICE), -m_srcAvatarID(srcAvatarID), -m_srcAddress(srcAddress.string_data, srcAddress.string_length), - m_destAvatarName(destAvatarName.string_data, destAvatarName.string_length), - m_destAvatarAddress(destAvatarAddress.string_data, destAvatarAddress.string_length), - m_destRoomAddress(destRoomAddress.string_data, destRoomAddress.string_length) -{ -} - -void RGrantVoice::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_srcAvatarID); - put(msg, m_destAvatarName); - put(msg, m_destAvatarAddress); - put(msg, m_destRoomAddress); - put(msg, m_srcAddress); -} - -RRevokeVoice::RRevokeVoice(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destAvatarName, const ChatUnicodeString &destAvatarAddress, const ChatUnicodeString &destRoomAddress) -: GenericRequest(REQUEST_REVOKEVOICE), -m_srcAvatarID(srcAvatarID), -m_srcAddress(srcAddress.string_data, srcAddress.string_length), - m_destAvatarName(destAvatarName.string_data, destAvatarName.string_length), - m_destAvatarAddress(destAvatarAddress.string_data, destAvatarAddress.string_length), - m_destRoomAddress(destRoomAddress.string_data, destRoomAddress.string_length) -{ -} - -void RRevokeVoice::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_srcAvatarID); - put(msg, m_destAvatarName); - put(msg, m_destAvatarAddress); - put(msg, m_destRoomAddress); - put(msg, m_srcAddress); -} - -RKickAvatar::RKickAvatar(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destAvatarName, const ChatUnicodeString &destAvatarAddress, const ChatUnicodeString &destRoomAddress) -: GenericRequest(REQUEST_KICKAVATAR), -m_srcAvatarID(srcAvatarID), -m_srcAddress(srcAddress.string_data, srcAddress.string_length), - m_destAvatarName(destAvatarName.string_data, destAvatarName.string_length), - m_destAvatarAddress(destAvatarAddress.string_data, destAvatarAddress.string_length), - m_destRoomAddress(destRoomAddress.string_data, destRoomAddress.string_length) -{ -} - -void RKickAvatar::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_srcAvatarID); - put(msg, m_destAvatarName); - put(msg, m_destAvatarAddress); - put(msg, m_destRoomAddress); - put(msg, m_srcAddress); -} - -RSetRoomParams::RSetRoomParams(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destRoomAddress, const RoomParams *params) - -: GenericRequest(REQUEST_SETROOMPARAMS), -m_srcAvatarID(srcAvatarID), -m_srcAddress(srcAddress.string_data, srcAddress.string_length), - m_destRoomAddress(destRoomAddress.string_data, destRoomAddress.string_length) -{ - // we take in a const RoomParams, so make our own and guarantee - // nullptr-terminated char buffers. - m_newRoomName.assign(params->getRoomName().string_data, params->getRoomName().string_length); - m_newRoomTopic.assign(params->getRoomTopic().string_data, params->getRoomTopic().string_length); - m_newRoomPassword.assign(params->getRoomPassword().string_data, params->getRoomPassword().string_length); - m_newRoomAttributes = params->getRoomAttributes(); - m_newRoomSize = params->getRoomMaxSize(); -} - -void RSetRoomParams::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_srcAvatarID); - put(msg, m_destRoomAddress); - put(msg, m_newRoomName); - put(msg, m_newRoomTopic); - put(msg, m_newRoomPassword); - put(msg, m_newRoomAttributes); - put(msg, m_newRoomSize); - put(msg, m_srcAddress); -} - -RChangeRoomOwner::RChangeRoomOwner(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destRoomAddress, const ChatUnicodeString &destAvatarName, const ChatUnicodeString &destAvatarAddress) -: GenericRequest(REQUEST_CHANGEROOMOWNER), -m_srcAvatarID(srcAvatarID), -m_srcAddress(srcAddress.string_data, srcAddress.string_length), - m_destRoomAddress(destRoomAddress.string_data, destRoomAddress.string_length), - m_newRoomOwnerName(destAvatarName.data(), destAvatarName.length()), - m_newRoomOwnerAddress(destAvatarAddress.data(), destAvatarAddress.length()) -{ -} - -void RChangeRoomOwner::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_srcAvatarID); - put(msg, m_destRoomAddress); - put(msg, m_newRoomOwnerName); - put(msg, m_newRoomOwnerAddress); - put(msg, m_srcAddress); -} - -RGetRoomSummaries::RGetRoomSummaries(const ChatUnicodeString &startNodeAddress, const ChatUnicodeString &roomFilter) -: GenericRequest(REQUEST_GETROOMSUMMARIES), - m_startNodeAddress(startNodeAddress.string_data, startNodeAddress.string_length), - m_roomFilter(roomFilter.string_data, roomFilter.string_length) -{ -} - -void RGetRoomSummaries::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_startNodeAddress); - put(msg, m_roomFilter); -} - -RSendPersistentMessage::RSendPersistentMessage(const ChatUnicodeString &src, const ChatUnicodeString &destAvatar, const ChatUnicodeString &destAddress, const ChatUnicodeString &subject, const ChatUnicodeString &msg, const ChatUnicodeString &oob, const ChatUnicodeString &category, bool enforceInboxLimit, unsigned categoryLimit) -: GenericRequest(REQUEST_SENDPERSISTENTMESSAGE), - m_avatarPresence(0), - m_srcName(src.string_data, src.string_length), - m_destAvatar(destAvatar.string_data, destAvatar.string_length), - m_destAddress(destAddress.string_data, destAddress.string_length), - m_subject(subject.string_data, subject.string_length), - m_msg(msg.string_data, msg.string_length), - m_oob(oob.string_data, oob.string_length), - m_category(category.string_data, category.string_length), - m_enforceInboxLimit(enforceInboxLimit), - m_categoryLimit(categoryLimit) -{ -} - -RSendPersistentMessage::RSendPersistentMessage(unsigned srcAvatarID, const ChatUnicodeString &destAvatar, const ChatUnicodeString &destAddress, const ChatUnicodeString &subject, const ChatUnicodeString &msg, const ChatUnicodeString &oob, const ChatUnicodeString &category, bool enforceInboxLimit, unsigned categoryLimit) -: GenericRequest(REQUEST_SENDPERSISTENTMESSAGE), - m_avatarPresence(1), - m_srcAvatarID(srcAvatarID), - m_destAvatar(destAvatar.string_data, destAvatar.string_length), - m_destAddress(destAddress.string_data, destAddress.string_length), - m_subject(subject.string_data, subject.string_length), - m_msg(msg.string_data, msg.string_length), - m_oob(oob.string_data, oob.string_length), - m_category(category.string_data, category.string_length), - m_enforceInboxLimit(enforceInboxLimit), - m_categoryLimit(categoryLimit) -{ -} - -void RSendPersistentMessage::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_avatarPresence); - if(m_avatarPresence) + void RLoginAvatar::pack(ByteStream &msg) { + put(msg, m_type); + put(msg, m_track); + put(msg, m_userID); + put(msg, m_name); + put(msg, m_address); + put(msg, m_loginLocation); + put(msg, m_loginPriority); + put(msg, m_loginAttributes); + } + + RTemporaryAvatar::RTemporaryAvatar(unsigned userID, const ChatUnicodeString &name, const ChatUnicodeString &address, const ChatUnicodeString &avatarLoginLocation) + : GenericRequest(REQUEST_TEMPORARYAVATAR), + m_userID(userID), + m_name(name.string_data, name.string_length), + m_address(address.string_data, address.string_length), + m_loginLocation(avatarLoginLocation.string_data, avatarLoginLocation.string_length) + { + } + + void RTemporaryAvatar::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_userID); + put(msg, m_name); + put(msg, m_address); + put(msg, m_loginLocation); + } + + RLogoutAvatar::RLogoutAvatar(unsigned avatarID, const ChatUnicodeString & address) + : GenericRequest(REQUEST_LOGOUTAVATAR) + , m_avatarID(avatarID) + , m_address(address.string_data, address.string_length) + { + } + + void RLogoutAvatar::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_avatarID); + put(msg, m_address); + } + + RDestroyAvatar::RDestroyAvatar(unsigned avatarID, const ChatUnicodeString & address) + : GenericRequest(REQUEST_DESTROYAVATAR) + , m_avatarID(avatarID) + , m_address(address.string_data, address.string_length) + { + } + + void RDestroyAvatar::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_avatarID); + put(msg, m_address); + } + + RSetAvatarKeywords::RSetAvatarKeywords(unsigned srcAvatarID, const ChatUnicodeString *keywordsList, unsigned keywordsLength) + : GenericRequest(REQUEST_SETAVATARKEYWORDS), + m_srcAvatarID(srcAvatarID), + m_keywordsLength(keywordsLength) + { + m_keywordsList = new String[keywordsLength]; + for (unsigned i = 0; i < keywordsLength; i++) + { + m_keywordsList[i].assign(keywordsList[i].string_data, keywordsList[i].string_length); + } + } + + RSetAvatarKeywords::~RSetAvatarKeywords() + { + delete[] m_keywordsList; + } + + void RSetAvatarKeywords::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_srcAvatarID); + put(msg, m_keywordsLength); + for (unsigned i = 0; i < m_keywordsLength; i++) + { + put(msg, m_keywordsList[i]); + } + } + + RGetAvatarKeywords::RGetAvatarKeywords(unsigned srcAvatarID) + : GenericRequest(REQUEST_GETAVATARKEYWORDS), + m_srcAvatarID(srcAvatarID) + { + } + + void RGetAvatarKeywords::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); put(msg, m_srcAvatarID); } - else + + RSearchAvatarKeywords::RSearchAvatarKeywords(const ChatUnicodeString &nodeAddress, const ChatUnicodeString *keywordsList, unsigned keywordsLength) + : GenericRequest(REQUEST_SEARCHAVATARKEYWORDS), + m_keywordsLength(keywordsLength), + m_keywordsList(nullptr) { - put(msg, m_srcName); + m_nodeAddress.assign(nodeAddress.string_data); + m_keywordsList = new String[keywordsLength]; + for (unsigned i = 0; i < keywordsLength; i++) + { + m_keywordsList[i].assign(keywordsList[i].string_data, keywordsList[i].string_length); + } } - put(msg, m_destAvatar); - put(msg, m_destAddress); - put(msg, m_subject); - put(msg, m_msg); - put(msg, m_oob); - put(msg, m_category); - put(msg, m_enforceInboxLimit); - put(msg, m_categoryLimit); -} -RSendMultiplePersistentMessages::RSendMultiplePersistentMessages(const ChatUnicodeString &src, unsigned numDestAvatars, const ChatUnicodeString *destAvatars, const ChatUnicodeString *destAddresses, const ChatUnicodeString &subject, const ChatUnicodeString &msg, const ChatUnicodeString &oob, const ChatUnicodeString &category, bool enforceInboxLimit, unsigned categoryLimit) -: GenericRequest(REQUEST_SENDMULTIPLEPERSISTENTMESSAGES), - m_avatarPresence(0), - m_srcName(src.string_data, src.string_length), - m_numDestAvatars(numDestAvatars), - m_subject(subject.string_data, subject.string_length), - m_msg(msg.string_data, msg.string_length), - m_oob(oob.string_data, oob.string_length), - m_category(category.string_data, category.string_length), - m_enforceInboxLimit(enforceInboxLimit), - m_categoryLimit(categoryLimit) -{ - unsigned destIndex; - - m_destAvatars.resize(m_numDestAvatars); - m_destAddresses.resize(m_numDestAvatars); - - for (destIndex = 0; destIndex < m_numDestAvatars; destIndex++) + RSearchAvatarKeywords::~RSearchAvatarKeywords() { - m_destAvatars[destIndex].assign(destAvatars[destIndex].string_data, destAvatars[destIndex].string_length); - m_destAddresses[destIndex].assign(destAddresses[destIndex].string_data, destAddresses[destIndex].string_length); + delete[] m_keywordsList; } -} -RSendMultiplePersistentMessages::RSendMultiplePersistentMessages(unsigned srcAvatarID, unsigned numDestAvatars, const ChatUnicodeString *destAvatars, const ChatUnicodeString *destAddresses, const ChatUnicodeString &subject, const ChatUnicodeString &msg, const ChatUnicodeString &oob, const ChatUnicodeString &category, bool enforceInboxLimit, unsigned categoryLimit) -: GenericRequest(REQUEST_SENDMULTIPLEPERSISTENTMESSAGES), - m_avatarPresence(1), - m_srcAvatarID(srcAvatarID), - m_numDestAvatars(numDestAvatars), - m_subject(subject.string_data, subject.string_length), - m_msg(msg.string_data, msg.string_length), - m_oob(oob.string_data, oob.string_length), - m_category(category.string_data, category.string_length), - m_enforceInboxLimit(enforceInboxLimit), - m_categoryLimit(categoryLimit) -{ - unsigned destIndex; - - m_destAvatars.resize(m_numDestAvatars); - m_destAddresses.resize(m_numDestAvatars); - - for (destIndex = 0; destIndex < m_numDestAvatars; destIndex++) + void RSearchAvatarKeywords::pack(ByteStream &msg) { - m_destAvatars[destIndex].assign(destAvatars[destIndex].string_data, destAvatars[destIndex].string_length); - m_destAddresses[destIndex].assign(destAddresses[destIndex].string_data, destAddresses[destIndex].string_length); + put(msg, m_type); + put(msg, m_track); + put(msg, m_nodeAddress); + put(msg, m_keywordsLength); + for (unsigned i = 0; i < m_keywordsLength; i++) + { + put(msg, m_keywordsList[i]); + } } -} -void RSendMultiplePersistentMessages::pack(ByteStream &msg) -{ - unsigned destIndex; - - put(msg, m_type); - put(msg, m_track); - put(msg, m_avatarPresence); - if(m_avatarPresence) + RGetAvatar::RGetAvatar(const ChatUnicodeString &destName, const ChatUnicodeString &destAddress) + : GenericRequest(REQUEST_GETAVATAR), + m_destName(destName.string_data, destName.string_length), + m_destAddress(destAddress.string_data, destAddress.string_length) { + } + + void RGetAvatar::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_destName); + put(msg, m_destAddress); + } + + RGetAnyAvatar::RGetAnyAvatar(const ChatUnicodeString& destName, const ChatUnicodeString& destAddress) + : GenericRequest(REQUEST_GETANYAVATAR) + , m_destName(destName.string_data, destName.string_length) + , m_destAddress(destAddress.string_data, destAddress.string_length) + { + } + + void RGetAnyAvatar::pack(Base::ByteStream& msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_destName); + put(msg, m_destAddress); + } + + RAvatarList::RAvatarList(unsigned userID) + : GenericRequest(REQUEST_AVATARLIST) + , m_userID(userID) + { + } + + void RAvatarList::pack(Base::ByteStream& msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_userID); + } + + RSetAvatarAttributes::RSetAvatarAttributes(unsigned avatarID, const ChatUnicodeString &srcAddress, unsigned long avatarAttributes, bool persistent) + : GenericRequest(REQUEST_SETAVATARATTRIBUTES), + m_avatarID(avatarID), + m_avatarAttributes(avatarAttributes), + m_persistent(persistent), + m_srcAddress(srcAddress.string_data, srcAddress.string_length) + { + } + + void RSetAvatarAttributes::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_avatarID); + put(msg, (uint32)m_avatarAttributes); + put(msg, m_persistent); + put(msg, m_srcAddress); + } + + RSetAvatarStatusMessage::RSetAvatarStatusMessage(unsigned avatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString& statusMessage) + : GenericRequest(REQUEST_SETAVATARSTATUSMESSAGE), + m_avatarID(avatarID), + m_statusMessage(statusMessage.data(), statusMessage.length()), + m_srcAddress(srcAddress.string_data, srcAddress.string_length) + { + } + + void RSetAvatarStatusMessage::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_avatarID); + put(msg, m_statusMessage); + put(msg, m_srcAddress); + } + + RSetAvatarForwardingEmail::RSetAvatarForwardingEmail(unsigned avatarID, const ChatUnicodeString &avatarForwardingEmail) + : GenericRequest(REQUEST_SETAVATAREMAIL), + m_avatarID(avatarID), + m_avatarForwardingEmail(avatarForwardingEmail.data(), avatarForwardingEmail.length()) + { + } + + void RSetAvatarForwardingEmail::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_avatarID); + put(msg, m_avatarForwardingEmail); + } + + RSetAvatarInboxLimit::RSetAvatarInboxLimit(unsigned avatarID, unsigned long avatarInboxLimit) + : GenericRequest(REQUEST_SETAVATARINBOXLIMIT), + m_avatarID(avatarID), + m_avatarInboxLimit(avatarInboxLimit) + { + } + + void RSetAvatarInboxLimit::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_avatarID); + put(msg, (uint32)m_avatarInboxLimit); + } + + RGetRoom::RGetRoom(const ChatUnicodeString &roomAddress) + : GenericRequest(REQUEST_GETROOM), + m_roomAddress(roomAddress.string_data, roomAddress.string_length) + { + } + + void RGetRoom::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_roomAddress); + } + + RCreateRoom::RCreateRoom(unsigned avatarID, const ChatUnicodeString & srcAddress, const RoomParams ¶ms, const ChatUnicodeString &roomAddress) + : GenericRequest(REQUEST_CREATEROOM), + m_avatarID(avatarID), + m_roomName(params.getRoomName().string_data, params.getRoomName().string_length), + m_roomTopic(params.getRoomTopic().string_data, params.getRoomTopic().string_length), + m_roomPassword(params.getRoomPassword().string_data, params.getRoomPassword().string_length), + m_roomAttributes(params.getRoomAttributes()), + m_maxRoomSize(params.getRoomMaxSize()), + m_roomAddress(roomAddress.string_data, roomAddress.string_length), + m_srcAddress(srcAddress.string_data, srcAddress.string_length) + { + } + + void RCreateRoom::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_avatarID); + put(msg, m_roomName); + put(msg, m_roomTopic); + put(msg, m_roomPassword); + put(msg, m_roomAttributes); + put(msg, m_maxRoomSize); + put(msg, m_roomAddress); + put(msg, m_srcAddress); + } + + RDestroyRoom::RDestroyRoom(unsigned avatarID, const ChatUnicodeString & srcAddress, const ChatUnicodeString &roomAddress) + : GenericRequest(REQUEST_DESTROYROOM), + m_avatarID(avatarID), + m_roomAddress(roomAddress.string_data, roomAddress.string_length), + m_srcAddress(srcAddress.string_data, srcAddress.string_length) + { + } + + void RDestroyRoom::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_avatarID); + put(msg, m_roomAddress); + put(msg, m_srcAddress); + } + + RSendInstantMessage::RSendInstantMessage(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destName, const ChatUnicodeString &destAddress, const ChatUnicodeString &msg, const ChatUnicodeString &oob) + : GenericRequest(REQUEST_SENDINSTANTMESSAGE), + m_srcAvatarID(srcAvatarID), + m_destName(destName.string_data, destName.string_length), + m_destAddress(destAddress.string_data, destAddress.string_length), + m_msg(msg.string_data, msg.string_length), + m_oob(oob.string_data, oob.string_length), + m_srcAddress(srcAddress.string_data, srcAddress.string_length) + { + } + + void RSendInstantMessage::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_srcAvatarID); + put(msg, m_destName); + put(msg, m_destAddress); + put(msg, m_msg); + put(msg, m_oob); + put(msg, m_srcAddress); + } + + RSendRoomMessage::RSendRoomMessage(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destRoomAddress, const ChatUnicodeString &msg, const ChatUnicodeString &oob) + : GenericRequest(REQUEST_SENDROOMMESSAGE), + m_srcAvatarID(srcAvatarID), + m_destRoomAddress(destRoomAddress.string_data, destRoomAddress.string_length), + m_msg(msg.string_data, msg.string_length), + m_oob(oob.string_data, oob.string_length), + m_srcAddress(srcAddress.string_data, srcAddress.string_length) + { + } + + void RSendRoomMessage::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_srcAvatarID); + put(msg, m_destRoomAddress); + put(msg, m_msg); + put(msg, m_oob); + put(msg, m_srcAddress); + } + + RSendBroadcastMessage::RSendBroadcastMessage(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destAddress, const ChatUnicodeString &msg, const ChatUnicodeString &oob) + : GenericRequest(REQUEST_SENDBROADCASTMESSAGE), + m_srcAvatarID(srcAvatarID), + m_destAddress(destAddress.string_data, destAddress.string_length), + m_msg(msg.string_data, msg.string_length), + m_oob(oob.string_data, oob.string_length), + m_srcAddress(srcAddress.string_data, srcAddress.string_length) + { + } + + void RSendBroadcastMessage::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_srcAvatarID); + put(msg, m_destAddress); + put(msg, m_msg); + put(msg, m_oob); + put(msg, m_srcAddress); + } + + RFilterMessage::RFilterMessage(const ChatUnicodeString &msg) + : GenericRequest(REQUEST_FILTERMESSAGE), + m_msg(msg.string_data, msg.string_length) + { + } + + void RFilterMessage::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_msg); + } + + RFilterMessageEx::RFilterMessageEx(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destName, const ChatUnicodeString &destAddress, const ChatUnicodeString &msg) + : GenericRequest(REQUEST_FILTERMESSAGE_EX), + m_srcAvatarID(srcAvatarID), + m_destName(destName.string_data, destName.string_length), + m_destAddress(destAddress.string_data, destAddress.string_length), + m_msg(msg.string_data, msg.string_length) + { + } + + void RFilterMessageEx::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_srcAvatarID); + put(msg, m_destName); + put(msg, m_destAddress); + put(msg, m_msg); + } + + RAddFriend::RAddFriend(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destName, const ChatUnicodeString &destAddress, const ChatUnicodeString &friendComment, bool confirm) + : GenericRequest(REQUEST_ADDFRIEND), + m_srcAvatarID(srcAvatarID), + m_srcAddress(srcAddress.string_data, srcAddress.string_length), + m_destName(destName.string_data, destName.string_length), + m_destAddress(destAddress.string_data, destAddress.string_length), + m_friendComment(friendComment.string_data, friendComment.string_length), + m_confirm(confirm) + { + } + + void RAddFriend::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_srcAvatarID); + put(msg, m_destName); + put(msg, m_destAddress); + put(msg, m_friendComment); + put(msg, m_confirm); + put(msg, m_srcAddress); + } + + RAddFriendReciprocate::RAddFriendReciprocate(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destName, const ChatUnicodeString &destAddress, const ChatUnicodeString &friendComment, bool confirm) + : GenericRequest(REQUEST_ADDFRIEND_RECIPROCATE), + m_srcAvatarID(srcAvatarID), + m_srcAddress(srcAddress.string_data, srcAddress.string_length), + m_destName(destName.string_data, destName.string_length), + m_destAddress(destAddress.string_data, destAddress.string_length), + m_friendComment(friendComment.string_data, friendComment.string_length), + m_confirm(confirm) + { + } + + void RAddFriendReciprocate::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_srcAvatarID); + put(msg, m_destName); + put(msg, m_destAddress); + put(msg, m_friendComment); + put(msg, m_confirm); + put(msg, m_srcAddress); + } + + RSetFriendComment::RSetFriendComment(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destName, const ChatUnicodeString &destAddress, const ChatUnicodeString &friendComment) + : GenericRequest(REQUEST_SETFRIENDCOMMENT), + m_srcAvatarID(srcAvatarID), + m_srcAddress(srcAddress.string_data, srcAddress.string_length), + m_destName(destName.string_data, destName.string_length), + m_destAddress(destAddress.string_data, destAddress.string_length), + m_friendComment(friendComment.string_data, friendComment.string_length) + { + } + + void RSetFriendComment::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_srcAvatarID); + put(msg, m_destName); + put(msg, m_destAddress); + put(msg, m_friendComment); + put(msg, m_srcAddress); + } + + RRemoveFriend::RRemoveFriend(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destName, const ChatUnicodeString &destAddress) + : GenericRequest(REQUEST_REMOVEFRIEND), + m_srcAvatarID(srcAvatarID), + m_srcAddress(srcAddress.string_data, srcAddress.string_length), + m_destName(destName.string_data, destName.string_length), + m_destAddress(destAddress.string_data, destAddress.string_length) + { + } + + void RRemoveFriend::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_srcAvatarID); + put(msg, m_destName); + put(msg, m_destAddress); + put(msg, m_srcAddress); + } + RRemoveFriendReciprocate::RRemoveFriendReciprocate(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destName, const ChatUnicodeString &destAddress) + : GenericRequest(REQUEST_REMOVEFRIEND_RECIPROCATE), + m_srcAvatarID(srcAvatarID), + m_srcAddress(srcAddress.string_data, srcAddress.string_length), + m_destName(destName.string_data, destName.string_length), + m_destAddress(destAddress.string_data, destAddress.string_length) + { + } + + void RRemoveFriendReciprocate::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_srcAvatarID); + put(msg, m_destName); + put(msg, m_destAddress); + put(msg, m_srcAddress); + } + RFriendStatus::RFriendStatus(unsigned srcAvatarID, const ChatUnicodeString &srcAddress) + : GenericRequest(REQUEST_FRIENDSTATUS), + m_srcAvatarID(srcAvatarID), + m_srcAddress(srcAddress.string_data, srcAddress.string_length) + { + } + + void RFriendStatus::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_srcAvatarID); + put(msg, m_srcAddress); + } + + RAddIgnore::RAddIgnore(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destName, const ChatUnicodeString &destAddress) + : GenericRequest(REQUEST_ADDIGNORE), + m_srcAvatarID(srcAvatarID), + m_srcAddress(srcAddress.string_data, srcAddress.string_length), + m_destName(destName.string_data, destName.string_length), + m_destAddress(destAddress.string_data, destAddress.string_length) + { + } + + void RAddIgnore::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_srcAvatarID); + put(msg, m_destName); + put(msg, m_destAddress); + put(msg, m_srcAddress); + } + + RRemoveIgnore::RRemoveIgnore(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destName, const ChatUnicodeString &destAddress) + : GenericRequest(REQUEST_REMOVEIGNORE), + m_srcAvatarID(srcAvatarID), + m_srcAddress(srcAddress.string_data, srcAddress.string_length), + m_destName(destName.string_data, destName.string_length), + m_destAddress(destAddress.string_data, destAddress.string_length) + { + } + + void RRemoveIgnore::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_srcAvatarID); + put(msg, m_destName); + put(msg, m_destAddress); + put(msg, m_srcAddress); + } + + REnterRoom::REnterRoom(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &roomAddress, const ChatUnicodeString &roomPassword, const RoomParams *roomParams, bool requestingEntry) + : GenericRequest(REQUEST_ENTERROOM), + m_srcAvatarID(srcAvatarID), + m_roomAddress(roomAddress.string_data, roomAddress.string_length), + m_roomPassword(roomPassword.string_data, roomPassword.string_length), + m_requestingEntry(requestingEntry), + m_srcAddress(srcAddress.string_data, srcAddress.string_length) + { + if (roomParams) + { + // passive room creation if room address does not exist IS enabled + m_passiveCreate = true; + m_paramRoomTopic.assign(roomParams->getRoomTopic().string_data, roomParams->getRoomTopic().string_length); + m_paramRoomAttributes = roomParams->getRoomAttributes(); + m_paramRoomMaxSize = roomParams->getRoomMaxSize(); + } + else + { + // passive room creation disabled + m_passiveCreate = false; + } + } + + void REnterRoom::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_srcAvatarID); + put(msg, m_roomAddress); + put(msg, m_roomPassword); + put(msg, m_passiveCreate); + + if (m_passiveCreate) + { + put(msg, m_paramRoomTopic); + put(msg, m_paramRoomAttributes); + put(msg, m_paramRoomMaxSize); + } + + put(msg, m_requestingEntry); + put(msg, m_srcAddress); + } + + RAllowRoomEntry::RAllowRoomEntry(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destAvatarName, const ChatUnicodeString &destAvatarAddress, const ChatUnicodeString &destRoomAddress, bool allow) + : GenericRequest(REQUEST_ALLOWROOMENTRY), + m_srcAvatarID(srcAvatarID), + m_srcAddress(srcAddress.string_data, srcAddress.string_length), + m_destAvatarName(destAvatarName.string_data, destAvatarName.string_length), + m_destAvatarAddress(destAvatarAddress.string_data, destAvatarAddress.string_length), + m_destRoomAddress(destRoomAddress.string_data, destRoomAddress.string_length), + m_allow(allow) + { + } + + void RAllowRoomEntry::pack(Base::ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_srcAvatarID); + put(msg, m_destAvatarName); + put(msg, m_destAvatarAddress); + put(msg, m_destRoomAddress); + put(msg, m_allow); + put(msg, m_srcAddress); + } + + RLeaveRoom::RLeaveRoom(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &roomAddress) + : GenericRequest(REQUEST_LEAVEROOM), + m_srcAvatarID(srcAvatarID), + m_roomAddress(roomAddress.string_data, roomAddress.string_length), + m_srcAddress(srcAddress.string_data, srcAddress.string_length) + { + } + + void RLeaveRoom::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_srcAvatarID); + put(msg, m_roomAddress); + put(msg, m_srcAddress); + } + + RAddModerator::RAddModerator(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destAvatarName, const ChatUnicodeString &destAvatarAddress, const ChatUnicodeString &destRoomAddress) + : GenericRequest(REQUEST_ADDMODERATOR), + m_srcAvatarID(srcAvatarID), + m_srcAddress(srcAddress.string_data, srcAddress.string_length), + m_destAvatarName(destAvatarName.string_data, destAvatarName.string_length), + m_destAvatarAddress(destAvatarAddress.string_data, destAvatarAddress.string_length), + m_destRoomAddress(destRoomAddress.string_data, destRoomAddress.string_length) + { + } + + void RAddModerator::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_srcAvatarID); + put(msg, m_destAvatarName); + put(msg, m_destAvatarAddress); + put(msg, m_destRoomAddress); + put(msg, m_srcAddress); + } + + RRemoveModerator::RRemoveModerator(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destAvatarName, const ChatUnicodeString &destAvatarAddress, const ChatUnicodeString &destRoomAddress) + : GenericRequest(REQUEST_REMOVEMODERATOR), + m_srcAvatarID(srcAvatarID), + m_srcAddress(srcAddress.string_data, srcAddress.string_length), + m_destAvatarName(destAvatarName.string_data, destAvatarName.string_length), + m_destAvatarAddress(destAvatarAddress.string_data, destAvatarAddress.string_length), + m_destRoomAddress(destRoomAddress.string_data, destRoomAddress.string_length) + { + } + + void RRemoveModerator::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_srcAvatarID); + put(msg, m_destAvatarName); + put(msg, m_destAvatarAddress); + put(msg, m_destRoomAddress); + put(msg, m_srcAddress); + } + + RAddTemporaryModerator::RAddTemporaryModerator(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destAvatarName, const ChatUnicodeString &destAvatarAddress, const ChatUnicodeString &destRoomAddress) + : GenericRequest(REQUEST_ADDTEMPORARYMODERATOR), + m_srcAvatarID(srcAvatarID), + m_srcAddress(srcAddress.string_data, srcAddress.string_length), + m_destAvatarName(destAvatarName.string_data, destAvatarName.string_length), + m_destAvatarAddress(destAvatarAddress.string_data, destAvatarAddress.string_length), + m_destRoomAddress(destRoomAddress.string_data, destRoomAddress.string_length) + { + } + + void RAddTemporaryModerator::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_srcAvatarID); + put(msg, m_destAvatarName); + put(msg, m_destAvatarAddress); + put(msg, m_destRoomAddress); + put(msg, m_srcAddress); + } + + RRemoveTemporaryModerator::RRemoveTemporaryModerator(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destAvatarName, const ChatUnicodeString &destAvatarAddress, const ChatUnicodeString &destRoomAddress) + : GenericRequest(REQUEST_REMOVETEMPORARYMODERATOR), + m_srcAvatarID(srcAvatarID), + m_srcAddress(srcAddress.string_data, srcAddress.string_length), + m_destAvatarName(destAvatarName.string_data, destAvatarName.string_length), + m_destAvatarAddress(destAvatarAddress.string_data, destAvatarAddress.string_length), + m_destRoomAddress(destRoomAddress.string_data, destRoomAddress.string_length) + { + } + + void RRemoveTemporaryModerator::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_srcAvatarID); + put(msg, m_destAvatarName); + put(msg, m_destAvatarAddress); + put(msg, m_destRoomAddress); + put(msg, m_srcAddress); + } + + RAddBan::RAddBan(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destAvatarName, const ChatUnicodeString &destAvatarAddress, const ChatUnicodeString &destRoomAddress) + : GenericRequest(REQUEST_ADDBAN), + m_srcAvatarID(srcAvatarID), + m_srcAddress(srcAddress.string_data, srcAddress.string_length), + m_destAvatarName(destAvatarName.string_data, destAvatarName.string_length), + m_destAvatarAddress(destAvatarAddress.string_data, destAvatarAddress.string_length), + m_destRoomAddress(destRoomAddress.string_data, destRoomAddress.string_length) + { + } + + void RAddBan::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_srcAvatarID); + put(msg, m_destAvatarName); + put(msg, m_destAvatarAddress); + put(msg, m_destRoomAddress); + put(msg, m_srcAddress); + } + + RRemoveBan::RRemoveBan(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destAvatarName, const ChatUnicodeString &destAvatarAddress, const ChatUnicodeString &destRoomAddress) + : GenericRequest(REQUEST_REMOVEBAN), + m_srcAvatarID(srcAvatarID), + m_srcAddress(srcAddress.string_data, srcAddress.string_length), + m_destAvatarName(destAvatarName.string_data, destAvatarName.string_length), + m_destAvatarAddress(destAvatarAddress.string_data, destAvatarAddress.string_length), + m_destRoomAddress(destRoomAddress.string_data, destRoomAddress.string_length) + { + } + + void RRemoveBan::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_srcAvatarID); + put(msg, m_destAvatarName); + put(msg, m_destAvatarAddress); + put(msg, m_destRoomAddress); + put(msg, m_srcAddress); + } + + RAddInvite::RAddInvite(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destAvatarName, const ChatUnicodeString &destAvatarAddress, const ChatUnicodeString &destRoomAddress) + : GenericRequest(REQUEST_ADDINVITE), + m_srcAvatarID(srcAvatarID), + m_destAvatarName(destAvatarName.string_data, destAvatarName.string_length), + m_destAvatarAddress(destAvatarAddress.string_data, destAvatarAddress.string_length), + m_destRoomAddress(destRoomAddress.string_data, destRoomAddress.string_length), + m_srcAddress(srcAddress.string_data, srcAddress.string_length) + { + } + + void RAddInvite::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_srcAvatarID); + put(msg, m_destAvatarName); + put(msg, m_destAvatarAddress); + put(msg, m_destRoomAddress); + put(msg, m_srcAddress); + } + + RRemoveInvite::RRemoveInvite(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destAvatarName, const ChatUnicodeString &destAvatarAddress, const ChatUnicodeString &destRoomAddress) + : GenericRequest(REQUEST_REMOVEINVITE), + m_srcAvatarID(srcAvatarID), + m_srcAddress(srcAddress.string_data, srcAddress.string_length), + m_destAvatarName(destAvatarName.string_data, destAvatarName.string_length), + m_destAvatarAddress(destAvatarAddress.string_data, destAvatarAddress.string_length), + m_destRoomAddress(destRoomAddress.string_data, destRoomAddress.string_length) + { + } + + void RRemoveInvite::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_srcAvatarID); + put(msg, m_destAvatarName); + put(msg, m_destAvatarAddress); + put(msg, m_destRoomAddress); + put(msg, m_srcAddress); + } + + RGrantVoice::RGrantVoice(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destAvatarName, const ChatUnicodeString &destAvatarAddress, const ChatUnicodeString &destRoomAddress) + : GenericRequest(REQUEST_GRANTVOICE), + m_srcAvatarID(srcAvatarID), + m_srcAddress(srcAddress.string_data, srcAddress.string_length), + m_destAvatarName(destAvatarName.string_data, destAvatarName.string_length), + m_destAvatarAddress(destAvatarAddress.string_data, destAvatarAddress.string_length), + m_destRoomAddress(destRoomAddress.string_data, destRoomAddress.string_length) + { + } + + void RGrantVoice::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_srcAvatarID); + put(msg, m_destAvatarName); + put(msg, m_destAvatarAddress); + put(msg, m_destRoomAddress); + put(msg, m_srcAddress); + } + + RRevokeVoice::RRevokeVoice(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destAvatarName, const ChatUnicodeString &destAvatarAddress, const ChatUnicodeString &destRoomAddress) + : GenericRequest(REQUEST_REVOKEVOICE), + m_srcAvatarID(srcAvatarID), + m_srcAddress(srcAddress.string_data, srcAddress.string_length), + m_destAvatarName(destAvatarName.string_data, destAvatarName.string_length), + m_destAvatarAddress(destAvatarAddress.string_data, destAvatarAddress.string_length), + m_destRoomAddress(destRoomAddress.string_data, destRoomAddress.string_length) + { + } + + void RRevokeVoice::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_srcAvatarID); + put(msg, m_destAvatarName); + put(msg, m_destAvatarAddress); + put(msg, m_destRoomAddress); + put(msg, m_srcAddress); + } + + RKickAvatar::RKickAvatar(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destAvatarName, const ChatUnicodeString &destAvatarAddress, const ChatUnicodeString &destRoomAddress) + : GenericRequest(REQUEST_KICKAVATAR), + m_srcAvatarID(srcAvatarID), + m_srcAddress(srcAddress.string_data, srcAddress.string_length), + m_destAvatarName(destAvatarName.string_data, destAvatarName.string_length), + m_destAvatarAddress(destAvatarAddress.string_data, destAvatarAddress.string_length), + m_destRoomAddress(destRoomAddress.string_data, destRoomAddress.string_length) + { + } + + void RKickAvatar::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_srcAvatarID); + put(msg, m_destAvatarName); + put(msg, m_destAvatarAddress); + put(msg, m_destRoomAddress); + put(msg, m_srcAddress); + } + + RSetRoomParams::RSetRoomParams(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destRoomAddress, const RoomParams *params) + + : GenericRequest(REQUEST_SETROOMPARAMS), + m_srcAvatarID(srcAvatarID), + m_srcAddress(srcAddress.string_data, srcAddress.string_length), + m_destRoomAddress(destRoomAddress.string_data, destRoomAddress.string_length) + { + // we take in a const RoomParams, so make our own and guarantee + // nullptr-terminated char buffers. + m_newRoomName.assign(params->getRoomName().string_data, params->getRoomName().string_length); + m_newRoomTopic.assign(params->getRoomTopic().string_data, params->getRoomTopic().string_length); + m_newRoomPassword.assign(params->getRoomPassword().string_data, params->getRoomPassword().string_length); + m_newRoomAttributes = params->getRoomAttributes(); + m_newRoomSize = params->getRoomMaxSize(); + } + + void RSetRoomParams::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_srcAvatarID); + put(msg, m_destRoomAddress); + put(msg, m_newRoomName); + put(msg, m_newRoomTopic); + put(msg, m_newRoomPassword); + put(msg, m_newRoomAttributes); + put(msg, m_newRoomSize); + put(msg, m_srcAddress); + } + + RChangeRoomOwner::RChangeRoomOwner(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, const ChatUnicodeString &destRoomAddress, const ChatUnicodeString &destAvatarName, const ChatUnicodeString &destAvatarAddress) + : GenericRequest(REQUEST_CHANGEROOMOWNER), + m_srcAvatarID(srcAvatarID), + m_srcAddress(srcAddress.string_data, srcAddress.string_length), + m_destRoomAddress(destRoomAddress.string_data, destRoomAddress.string_length), + m_newRoomOwnerName(destAvatarName.data(), destAvatarName.length()), + m_newRoomOwnerAddress(destAvatarAddress.data(), destAvatarAddress.length()) + { + } + + void RChangeRoomOwner::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_srcAvatarID); + put(msg, m_destRoomAddress); + put(msg, m_newRoomOwnerName); + put(msg, m_newRoomOwnerAddress); + put(msg, m_srcAddress); + } + + RGetRoomSummaries::RGetRoomSummaries(const ChatUnicodeString &startNodeAddress, const ChatUnicodeString &roomFilter) + : GenericRequest(REQUEST_GETROOMSUMMARIES), + m_startNodeAddress(startNodeAddress.string_data, startNodeAddress.string_length), + m_roomFilter(roomFilter.string_data, roomFilter.string_length) + { + } + + void RGetRoomSummaries::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_startNodeAddress); + put(msg, m_roomFilter); + } + + RSendPersistentMessage::RSendPersistentMessage(const ChatUnicodeString &src, const ChatUnicodeString &destAvatar, const ChatUnicodeString &destAddress, const ChatUnicodeString &subject, const ChatUnicodeString &msg, const ChatUnicodeString &oob, const ChatUnicodeString &category, bool enforceInboxLimit, unsigned categoryLimit) + : GenericRequest(REQUEST_SENDPERSISTENTMESSAGE), + m_avatarPresence(0), + m_srcName(src.string_data, src.string_length), + m_destAvatar(destAvatar.string_data, destAvatar.string_length), + m_destAddress(destAddress.string_data, destAddress.string_length), + m_subject(subject.string_data, subject.string_length), + m_msg(msg.string_data, msg.string_length), + m_oob(oob.string_data, oob.string_length), + m_category(category.string_data, category.string_length), + m_enforceInboxLimit(enforceInboxLimit), + m_categoryLimit(categoryLimit), + m_srcAvatarID(0) + { + } + + RSendPersistentMessage::RSendPersistentMessage(unsigned srcAvatarID, const ChatUnicodeString &destAvatar, const ChatUnicodeString &destAddress, const ChatUnicodeString &subject, const ChatUnicodeString &msg, const ChatUnicodeString &oob, const ChatUnicodeString &category, bool enforceInboxLimit, unsigned categoryLimit) + : GenericRequest(REQUEST_SENDPERSISTENTMESSAGE), + m_avatarPresence(1), + m_srcAvatarID(srcAvatarID), + m_destAvatar(destAvatar.string_data, destAvatar.string_length), + m_destAddress(destAddress.string_data, destAddress.string_length), + m_subject(subject.string_data, subject.string_length), + m_msg(msg.string_data, msg.string_length), + m_oob(oob.string_data, oob.string_length), + m_category(category.string_data, category.string_length), + m_enforceInboxLimit(enforceInboxLimit), + m_categoryLimit(categoryLimit) + { + } + + void RSendPersistentMessage::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_avatarPresence); + if (m_avatarPresence) + { + put(msg, m_srcAvatarID); + } + else + { + put(msg, m_srcName); + } + put(msg, m_destAvatar); + put(msg, m_destAddress); + put(msg, m_subject); + put(msg, m_msg); + put(msg, m_oob); + put(msg, m_category); + put(msg, m_enforceInboxLimit); + put(msg, m_categoryLimit); + } + + RSendMultiplePersistentMessages::RSendMultiplePersistentMessages(const ChatUnicodeString &src, unsigned numDestAvatars, const ChatUnicodeString *destAvatars, const ChatUnicodeString *destAddresses, const ChatUnicodeString &subject, const ChatUnicodeString &msg, const ChatUnicodeString &oob, const ChatUnicodeString &category, bool enforceInboxLimit, unsigned categoryLimit) + : GenericRequest(REQUEST_SENDMULTIPLEPERSISTENTMESSAGES), + m_avatarPresence(0), + m_srcName(src.string_data, src.string_length), + m_numDestAvatars(numDestAvatars), + m_subject(subject.string_data, subject.string_length), + m_msg(msg.string_data, msg.string_length), + m_oob(oob.string_data, oob.string_length), + m_category(category.string_data, category.string_length), + m_enforceInboxLimit(enforceInboxLimit), + m_categoryLimit(categoryLimit), + m_srcAvatarID(0) + { + unsigned destIndex; + + m_destAvatars.resize(m_numDestAvatars); + m_destAddresses.resize(m_numDestAvatars); + + for (destIndex = 0; destIndex < m_numDestAvatars; destIndex++) + { + m_destAvatars[destIndex].assign(destAvatars[destIndex].string_data, destAvatars[destIndex].string_length); + m_destAddresses[destIndex].assign(destAddresses[destIndex].string_data, destAddresses[destIndex].string_length); + } + } + + RSendMultiplePersistentMessages::RSendMultiplePersistentMessages(unsigned srcAvatarID, unsigned numDestAvatars, const ChatUnicodeString *destAvatars, const ChatUnicodeString *destAddresses, const ChatUnicodeString &subject, const ChatUnicodeString &msg, const ChatUnicodeString &oob, const ChatUnicodeString &category, bool enforceInboxLimit, unsigned categoryLimit) + : GenericRequest(REQUEST_SENDMULTIPLEPERSISTENTMESSAGES), + m_avatarPresence(1), + m_srcAvatarID(srcAvatarID), + m_numDestAvatars(numDestAvatars), + m_subject(subject.string_data, subject.string_length), + m_msg(msg.string_data, msg.string_length), + m_oob(oob.string_data, oob.string_length), + m_category(category.string_data, category.string_length), + m_enforceInboxLimit(enforceInboxLimit), + m_categoryLimit(categoryLimit) + { + unsigned destIndex; + + m_destAvatars.resize(m_numDestAvatars); + m_destAddresses.resize(m_numDestAvatars); + + for (destIndex = 0; destIndex < m_numDestAvatars; destIndex++) + { + m_destAvatars[destIndex].assign(destAvatars[destIndex].string_data, destAvatars[destIndex].string_length); + m_destAddresses[destIndex].assign(destAddresses[destIndex].string_data, destAddresses[destIndex].string_length); + } + } + + void RSendMultiplePersistentMessages::pack(ByteStream &msg) + { + unsigned destIndex; + + put(msg, m_type); + put(msg, m_track); + put(msg, m_avatarPresence); + if (m_avatarPresence) + { + put(msg, m_srcAvatarID); + } + else + { + put(msg, m_srcName); + } + put(msg, m_numDestAvatars); + for (destIndex = 0; destIndex < m_numDestAvatars; destIndex++) + { + put(msg, m_destAvatars[destIndex]); + put(msg, m_destAddresses[destIndex]); + } + put(msg, m_subject); + put(msg, m_msg); + put(msg, m_oob); + put(msg, m_category); + put(msg, m_enforceInboxLimit); + put(msg, m_categoryLimit); + } + + RAlterPersistentMessage::RAlterPersistentMessage(const ChatUnicodeString &destAvatarName, const ChatUnicodeString &destAvatarAddress, unsigned messageID, unsigned alterationAttributes, const ChatUnicodeString &newSenderName, const ChatUnicodeString &newSenderAddress, const ChatUnicodeString &newSubject, const ChatUnicodeString &newMsg, const ChatUnicodeString &newOOB, const ChatUnicodeString &newCategory, unsigned newSentTime) + : GenericRequest(REQUEST_ALTERPERISTENTMESSAGE), + m_destAvatarName(destAvatarName.data(), destAvatarName.length()), + m_destAvatarAddress(destAvatarAddress.data(), destAvatarAddress.length()), + m_messageID(messageID), + m_alterationAttributes(alterationAttributes), + m_newSenderName(newSenderName.data(), newSenderName.length()), + m_newSenderAddress(newSenderAddress.data(), newSenderAddress.length()), + m_newSubject(newSubject.data(), newSubject.length()), + m_newMsg(newMsg.data(), newMsg.length()), + m_newOOB(newOOB.data(), newOOB.length()), + m_newCategory(newCategory.data(), newCategory.length()), + m_newSentTime(newSentTime) + { + } + + RAlterPersistentMessage::~RAlterPersistentMessage() + { + } + + void RAlterPersistentMessage::pack(Base::ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + + put(msg, m_destAvatarName); + put(msg, m_destAvatarAddress); + + put(msg, m_messageID); + put(msg, m_alterationAttributes); + put(msg, m_newSenderName); + put(msg, m_newSenderAddress); + put(msg, m_newSubject); + put(msg, m_newMsg); + put(msg, m_newOOB); + put(msg, m_newCategory); + put(msg, m_newSentTime); + } + + RGetPersistentHeaders::RGetPersistentHeaders(unsigned srcAvatarID, const ChatUnicodeString &category) + : GenericRequest(REQUEST_GETPERSISTENTHEADERS), + m_srcAvatarID(srcAvatarID), + m_category(category.string_data, category.string_length) + { + } + + void RGetPersistentHeaders::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_srcAvatarID); + put(msg, m_category); + } + + RGetPartialPersistentHeaders::RGetPartialPersistentHeaders(unsigned srcAvatarID, unsigned maxHeaders, bool inDescendingOrder, unsigned sentTimeStart, const ChatUnicodeString &category) + : GenericRequest(REQUEST_PARTIALPERSISTENTHEADERS), + m_srcAvatarID(srcAvatarID), + m_maxHeaders(maxHeaders), + m_inDescendingOrder(inDescendingOrder), + m_sentTimeStart(sentTimeStart), + m_category(category.string_data, category.string_length) + { + } + + void RGetPartialPersistentHeaders::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_srcAvatarID); + put(msg, m_maxHeaders); + put(msg, m_inDescendingOrder); + put(msg, m_sentTimeStart); + put(msg, m_category); + } + + RCountPersistentMessages::RCountPersistentMessages(const ChatUnicodeString &avatarName, const ChatUnicodeString &avatarAddress, const ChatUnicodeString &category) + : GenericRequest(REQUEST_COUNTPERSISTENTMESSAGES), + m_avatarName(avatarName.string_data, avatarName.string_length), + m_avatarAddress(avatarAddress.string_data, avatarAddress.string_length), + m_category(category.string_data, category.string_length) + { + } + + void RCountPersistentMessages::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_avatarName); + put(msg, m_avatarAddress); + put(msg, m_category); + } + + RGetPersistentMessage::RGetPersistentMessage(unsigned srcAvatarID, unsigned messageID) + : GenericRequest(REQUEST_GETPERSISTENTMESSAGE), + m_srcAvatarID(srcAvatarID), + m_messageID(messageID) + { + } + + void RGetPersistentMessage::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_srcAvatarID); + put(msg, m_messageID); + } + + RGetMultiplePersistentMessages::RGetMultiplePersistentMessages(unsigned srcAvatarID, unsigned maxHeaders, bool inDescendingOrder, unsigned sentTimeStart, const ChatUnicodeString &category) + : GenericRequest(REQUEST_GETMULTIPLEPERSISTENTMESSAGES), + m_srcAvatarID(srcAvatarID), + m_maxHeaders(maxHeaders), + m_inDescendingOrder(inDescendingOrder), + m_sentTimeStart(sentTimeStart), + m_category(category.string_data, category.string_length) + { + } + + void RGetMultiplePersistentMessages::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_srcAvatarID); + put(msg, m_maxHeaders); + put(msg, m_inDescendingOrder); + put(msg, m_sentTimeStart); + put(msg, m_category); + } + + RUpdatePersistentMessage::RUpdatePersistentMessage(unsigned srcAvatarID, unsigned messageID, PersistentStatus status) + : GenericRequest(REQUEST_UPDATEPERSISTENTMESSAGE), + m_srcAvatarID(srcAvatarID), + m_messageID(messageID), + m_status(status) + { + } + + void RUpdatePersistentMessage::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_srcAvatarID); + put(msg, m_messageID); + put(msg, m_status); + } + + RUpdatePersistentMessages::RUpdatePersistentMessages(unsigned srcAvatarID, PersistentStatus currentStatus, PersistentStatus newStatus, const ChatUnicodeString &category) + : GenericRequest(REQUEST_UPDATEPERSISTENTMESSAGES), + m_srcAvatarID(srcAvatarID), + m_currentStatus(currentStatus), + m_newStatus(newStatus), + m_category(category.string_data, category.string_length) + { + } + + void RUpdatePersistentMessages::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_srcAvatarID); + put(msg, m_currentStatus); + put(msg, m_newStatus); + put(msg, m_category); + } + + RClassifyPersistentMessages::RClassifyPersistentMessages(unsigned srcAvatarID, unsigned numIDs, const unsigned *messageIDs, const ChatUnicodeString &newFolder) + : GenericRequest(REQUEST_CHANGEPERSISTENTFOLDER), + m_srcAvatarID(srcAvatarID), + m_newFolder(newFolder.data(), newFolder.length()) + { + for (; numIDs > 0; numIDs--) + { + m_messageIDs.insert(messageIDs[numIDs - 1]); + } + } + + RClassifyPersistentMessages::RClassifyPersistentMessages(const ChatUnicodeString &avatarName, const ChatUnicodeString &avatarAddress, unsigned numIDs, const unsigned *messageIDs, const ChatUnicodeString &newFolder) + : GenericRequest(REQUEST_CHANGEPERSISTENTFOLDER), + m_srcAvatarID(0), + m_avatarName(avatarName.data(), avatarName.length()), + m_avatarAddress(avatarAddress.data(), avatarAddress.length()), + m_newFolder(newFolder.data(), newFolder.length()) + { + for (; numIDs > 0; numIDs--) + { + m_messageIDs.insert(messageIDs[numIDs - 1]); + } + } + + void RClassifyPersistentMessages::pack(ByteStream &msg) + { + std::set::iterator idIter; + + put(msg, m_type); + put(msg, m_track); + put(msg, m_srcAvatarID); + put(msg, m_messageIDs.size()); + for (idIter = m_messageIDs.begin(); idIter != m_messageIDs.end(); idIter++) + { + put(msg, *idIter); + } + put(msg, m_newFolder); + put(msg, m_avatarName); + put(msg, m_avatarAddress); + } + + RDeleteAllPersistentMessages::RDeleteAllPersistentMessages(const ChatUnicodeString &avatarName, const ChatUnicodeString &avatarAddress, const ChatUnicodeString &category, unsigned olderThan) + : GenericRequest(REQUEST_PURGEPERSISTENTMESSAGES), + m_avatarName(avatarName.string_data, avatarName.string_length), + m_avatarAddress(avatarAddress.string_data, avatarAddress.string_length), + m_category(category.string_data, category.string_length), + m_olderThan(olderThan) + { + } + + void RDeleteAllPersistentMessages::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_avatarName); + put(msg, m_avatarAddress); + put(msg, m_category); + put(msg, m_olderThan); + } + + RUnregisterRoom::RUnregisterRoom(const ChatUnicodeString &destRoomAddress) + : GenericRequest(REQUEST_UNREGISTERROOM), + m_destRoomAddress(destRoomAddress.string_data, destRoomAddress.string_length) + { + } + + void RUnregisterRoom::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_destRoomAddress); + } + + RIgnoreStatus::RIgnoreStatus(unsigned srcAvatarID, const ChatUnicodeString &srcAddress) + : GenericRequest(REQUEST_IGNORESTATUS), + m_srcAvatarID(srcAvatarID), + m_srcAddress(srcAddress.string_data, srcAddress.string_length) + { + } + + void RIgnoreStatus::pack(Base::ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_srcAvatarID); + put(msg, m_srcAddress); + } + + RFailoverReloginAvatar::RFailoverReloginAvatar(ChatAvatarCore *avatar) + : GenericRequest(REQUEST_FAILOVER_RELOGINAVATAR), + m_avatar(avatar) + { + } + + void RFailoverReloginAvatar::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_avatar->getAvatarID()); + put(msg, m_avatar->getUserID()); + put(msg, m_avatar->getName()); + put(msg, m_avatar->getAddress()); + put(msg, m_avatar->getLoginLocation()); + put(msg, m_avatar->getLoginPriority()); + put(msg, m_avatar->getAttributes()); + } + + RFailoverRecreateRoom::RFailoverRecreateRoom(ChatRoomCore *room) + : GenericRequest(REQUEST_FAILOVER_RECREATEROOM), + m_room(room) + { + } + + void RFailoverRecreateRoom::pack(ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + + // send full room object, except that the avatars sent only + // includes those on the API--"each API for itself" method reduces + // the amount of wasted iterations on the server. + m_room->serializeWithLocalAvatarsOnly(msg); + } + + RFriendConfirm::RFriendConfirm(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, unsigned destAvatarID, bool confirm) + : GenericRequest(REQUEST_CONFIRMFRIEND), + m_srcAvatarID(srcAvatarID), + m_destAvatarID(destAvatarID), + m_confirm(confirm != 0), + m_srcAddress(srcAddress.string_data, srcAddress.string_length) + { + } + + void RFriendConfirm::pack(Base::ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_srcAvatarID); + put(msg, m_destAvatarID); + put(msg, m_confirm); + put(msg, m_srcAddress); + } + + RFriendConfirmReciprocate::RFriendConfirmReciprocate(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, unsigned destAvatarID, bool confirm) + : GenericRequest(REQUEST_CONFIRMFRIEND_RECIPROCATE), + m_srcAvatarID(srcAvatarID), + m_destAvatarID(destAvatarID), + m_confirm(confirm != 0), + m_srcAddress(srcAddress.string_data, srcAddress.string_length) + { + } + + void RFriendConfirmReciprocate::pack(Base::ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_srcAvatarID); + put(msg, m_destAvatarID); + put(msg, m_confirm); + put(msg, m_srcAddress); + } + + RGetFanClubHandle::RGetFanClubHandle(unsigned stationID, unsigned fanClubCode) + : GenericRequest(REQUEST_GETFANCLUBHANDLE), + m_stationID(stationID), + m_fanClubCode(fanClubCode) + { + } + + void RGetFanClubHandle::pack(Base::ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_stationID); + put(msg, m_fanClubCode); + } + + RFindAvatarByUID::RFindAvatarByUID(unsigned userID) + : GenericRequest(REQUEST_FINDAVATARBYUID), + m_userID(userID) + { + } + + void RFindAvatarByUID::pack(Base::ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_userID); + } + + RRegistrarGetChatServer::RRegistrarGetChatServer(std::string &hostname, unsigned short port) + : GenericRequest(REQUEST_REGISTRAR_GETCHATSERVER), + m_hostname(narrowToWide(hostname)), + m_port(port) + { + } + + void RRegistrarGetChatServer::pack(Base::ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_hostname); + put(msg, m_port); + } + + RSendApiVersion::RSendApiVersion(unsigned long version) + : GenericRequest(REQUEST_SETAPIVERSION), + m_version(version) + { + } + + void RSendApiVersion::pack(Base::ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, (uint32)m_version); + } + + RAddSnoopAvatar::RAddSnoopAvatar(unsigned srcAvatarID, const ChatUnicodeString &destName, const ChatUnicodeString &destAddress) + : GenericRequest(REQUEST_ADDSNOOPAVATAR), + m_srcAvatarID(srcAvatarID), + m_destAvatarName(destName.string_data, destName.string_length), + m_destAvatarAddress(destAddress.string_data, destAddress.string_length) + { + } + + void RAddSnoopAvatar::pack(Base::ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_srcAvatarID); + put(msg, m_destAvatarName); + put(msg, m_destAvatarAddress); + } + + RRemoveSnoopAvatar::RRemoveSnoopAvatar(unsigned srcAvatarID, const ChatUnicodeString &destName, const ChatUnicodeString &destAddress) + : GenericRequest(REQUEST_REMOVESNOOPAVATAR), + m_srcAvatarID(srcAvatarID), + m_destAvatarName(destName.string_data, destName.string_length), + m_destAvatarAddress(destAddress.string_data, destAddress.string_length) + { + } + + void RRemoveSnoopAvatar::pack(Base::ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_srcAvatarID); + put(msg, m_destAvatarName); + put(msg, m_destAvatarAddress); + } + + RAddSnoopRoom::RAddSnoopRoom(unsigned srcAvatarID, const ChatUnicodeString &roomAddress) + : GenericRequest(REQUEST_ADDSNOOPROOM), + m_srcAvatarID(srcAvatarID), + m_roomAddress(roomAddress.string_data, roomAddress.string_length) + { + } + + void RAddSnoopRoom::pack(Base::ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_srcAvatarID); + put(msg, m_roomAddress); + } + + RRemoveSnoopRoom::RRemoveSnoopRoom(unsigned srcAvatarID, const ChatUnicodeString &roomAddress) + : GenericRequest(REQUEST_REMOVESNOOPROOM), + m_srcAvatarID(srcAvatarID), + m_roomAddress(roomAddress.string_data, roomAddress.string_length) + { + } + + void RRemoveSnoopRoom::pack(Base::ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); + put(msg, m_srcAvatarID); + put(msg, m_roomAddress); + } + + RGetSnoopList::RGetSnoopList(unsigned srcAvatarID) + : GenericRequest(REQUEST_GETSNOOPLIST), + m_srcAvatarID(srcAvatarID) + { + } + + void RGetSnoopList::pack(Base::ByteStream &msg) + { + put(msg, m_type); + put(msg, m_track); put(msg, m_srcAvatarID); } - else + + RTransferAvatar::RTransferAvatar(unsigned userID, unsigned newUserID, const ChatUnicodeString &avatarName, const ChatUnicodeString &newAvatarName, const ChatUnicodeString &avatarAddress, const ChatUnicodeString &newAvatarAddress, bool transferPersistentMessages) + : GenericRequest(REQUEST_TRANSFERAVATAR), + m_userID(userID), + m_newUserID(newUserID), + m_avatarName(avatarName.string_data, avatarName.string_length), + m_newAvatarName(newAvatarName.string_data, newAvatarName.string_length), + m_avatarAddress(avatarAddress.string_data, avatarAddress.string_length), + m_newAvatarAddress(newAvatarAddress.string_data, newAvatarAddress.string_length), + m_transferPersistentMessages(transferPersistentMessages) { - put(msg, m_srcName); } - put(msg, m_numDestAvatars); - for (destIndex = 0; destIndex < m_numDestAvatars; destIndex++) + + void RTransferAvatar::pack(Base::ByteStream &msg) { - put(msg, m_destAvatars[destIndex]); - put(msg, m_destAddresses[destIndex]); + put(msg, m_type); + put(msg, m_track); + put(msg, m_userID); + put(msg, m_newUserID); + put(msg, m_avatarName); + put(msg, m_newAvatarName); + put(msg, m_avatarAddress); + put(msg, m_newAvatarAddress); + put(msg, m_transferPersistentMessages); } - put(msg, m_subject); - put(msg, m_msg); - put(msg, m_oob); - put(msg, m_category); - put(msg, m_enforceInboxLimit); - put(msg, m_categoryLimit); -} - -RAlterPersistentMessage::RAlterPersistentMessage(const ChatUnicodeString &destAvatarName, const ChatUnicodeString &destAvatarAddress, unsigned messageID, unsigned alterationAttributes, const ChatUnicodeString &newSenderName, const ChatUnicodeString &newSenderAddress, const ChatUnicodeString &newSubject, const ChatUnicodeString &newMsg, const ChatUnicodeString &newOOB, const ChatUnicodeString &newCategory, unsigned newSentTime) -: GenericRequest(REQUEST_ALTERPERISTENTMESSAGE), - m_destAvatarName(destAvatarName.data(), destAvatarName.length()), - m_destAvatarAddress(destAvatarAddress.data(), destAvatarAddress.length()), - m_messageID(messageID), - m_alterationAttributes(alterationAttributes), - m_newSenderName(newSenderName.data(), newSenderName.length()), - m_newSenderAddress(newSenderAddress.data(), newSenderAddress.length()), - m_newSubject(newSubject.data(), newSubject.length()), - m_newMsg(newMsg.data(), newMsg.length()), - m_newOOB(newOOB.data(), newOOB.length()), - m_newCategory(newCategory.data(), newCategory.length()), - m_newSentTime(newSentTime) -{ -} - -RAlterPersistentMessage::~RAlterPersistentMessage() -{ -} - -void RAlterPersistentMessage::pack(Base::ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - - put(msg, m_destAvatarName); - put(msg, m_destAvatarAddress); - - put(msg, m_messageID); - put(msg, m_alterationAttributes); - put(msg, m_newSenderName); - put(msg, m_newSenderAddress); - put(msg, m_newSubject); - put(msg, m_newMsg); - put(msg, m_newOOB); - put(msg, m_newCategory); - put(msg, m_newSentTime); -} - -RGetPersistentHeaders::RGetPersistentHeaders(unsigned srcAvatarID, const ChatUnicodeString &category) -: GenericRequest(REQUEST_GETPERSISTENTHEADERS), - m_srcAvatarID(srcAvatarID), - m_category(category.string_data, category.string_length) -{ -} - -void RGetPersistentHeaders::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_srcAvatarID); - put(msg, m_category); -} - -RGetPartialPersistentHeaders::RGetPartialPersistentHeaders(unsigned srcAvatarID, unsigned maxHeaders, bool inDescendingOrder, unsigned sentTimeStart, const ChatUnicodeString &category) -: GenericRequest(REQUEST_PARTIALPERSISTENTHEADERS), - m_srcAvatarID(srcAvatarID), - m_maxHeaders(maxHeaders), - m_inDescendingOrder(inDescendingOrder), - m_sentTimeStart(sentTimeStart), - m_category(category.string_data, category.string_length) -{ -} - -void RGetPartialPersistentHeaders::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_srcAvatarID); - put(msg, m_maxHeaders); - put(msg, m_inDescendingOrder); - put(msg, m_sentTimeStart); - put(msg, m_category); -} - -RCountPersistentMessages::RCountPersistentMessages(const ChatUnicodeString &avatarName, const ChatUnicodeString &avatarAddress, const ChatUnicodeString &category) -: GenericRequest(REQUEST_COUNTPERSISTENTMESSAGES), - m_avatarName(avatarName.string_data, avatarName.string_length), - m_avatarAddress(avatarAddress.string_data, avatarAddress.string_length), - m_category(category.string_data, category.string_length) -{ -} - -void RCountPersistentMessages::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_avatarName); - put(msg, m_avatarAddress); - put(msg, m_category); -} - -RGetPersistentMessage::RGetPersistentMessage(unsigned srcAvatarID, unsigned messageID) -: GenericRequest(REQUEST_GETPERSISTENTMESSAGE), - m_srcAvatarID(srcAvatarID), - m_messageID(messageID) -{ -} - -void RGetPersistentMessage::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_srcAvatarID); - put(msg, m_messageID); -} - -RGetMultiplePersistentMessages::RGetMultiplePersistentMessages(unsigned srcAvatarID, unsigned maxHeaders, bool inDescendingOrder, unsigned sentTimeStart, const ChatUnicodeString &category) -: GenericRequest(REQUEST_GETMULTIPLEPERSISTENTMESSAGES), - m_srcAvatarID(srcAvatarID), - m_maxHeaders(maxHeaders), - m_inDescendingOrder(inDescendingOrder), - m_sentTimeStart(sentTimeStart), - m_category(category.string_data, category.string_length) -{ -} - -void RGetMultiplePersistentMessages::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_srcAvatarID); - put(msg, m_maxHeaders); - put(msg, m_inDescendingOrder); - put(msg, m_sentTimeStart); - put(msg, m_category); -} - -RUpdatePersistentMessage::RUpdatePersistentMessage(unsigned srcAvatarID, unsigned messageID, PersistentStatus status) -: GenericRequest(REQUEST_UPDATEPERSISTENTMESSAGE), - m_srcAvatarID(srcAvatarID), - m_messageID(messageID), - m_status(status) -{ -} - -void RUpdatePersistentMessage::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_srcAvatarID); - put(msg, m_messageID); - put(msg, m_status); -} - -RUpdatePersistentMessages::RUpdatePersistentMessages(unsigned srcAvatarID, PersistentStatus currentStatus, PersistentStatus newStatus, const ChatUnicodeString &category) -: GenericRequest(REQUEST_UPDATEPERSISTENTMESSAGES), - m_srcAvatarID(srcAvatarID), - m_currentStatus(currentStatus), - m_newStatus(newStatus), - m_category(category.string_data, category.string_length) -{ -} - -void RUpdatePersistentMessages::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_srcAvatarID); - put(msg, m_currentStatus); - put(msg, m_newStatus); - put(msg, m_category); -} - -RClassifyPersistentMessages::RClassifyPersistentMessages(unsigned srcAvatarID, unsigned numIDs, const unsigned *messageIDs, const ChatUnicodeString &newFolder) -: GenericRequest(REQUEST_CHANGEPERSISTENTFOLDER), - m_srcAvatarID(srcAvatarID), - m_newFolder(newFolder.data(), newFolder.length()) -{ - for (; numIDs > 0; numIDs--) - { - m_messageIDs.insert(messageIDs[numIDs - 1]); - } -} - -RClassifyPersistentMessages::RClassifyPersistentMessages(const ChatUnicodeString &avatarName, const ChatUnicodeString &avatarAddress, unsigned numIDs, const unsigned *messageIDs, const ChatUnicodeString &newFolder) -: GenericRequest(REQUEST_CHANGEPERSISTENTFOLDER), - m_srcAvatarID(0), - m_avatarName(avatarName.data(), avatarName.length()), - m_avatarAddress(avatarAddress.data(), avatarAddress.length()), - m_newFolder(newFolder.data(), newFolder.length()) -{ - for (; numIDs > 0; numIDs--) - { - m_messageIDs.insert(messageIDs[numIDs - 1]); - } -} - -void RClassifyPersistentMessages::pack(ByteStream &msg) -{ - std::set::iterator idIter; - - put(msg, m_type); - put(msg, m_track); - put(msg, m_srcAvatarID); - put(msg, m_messageIDs.size()); - for (idIter = m_messageIDs.begin(); idIter != m_messageIDs.end(); idIter++) - { - put(msg, *idIter); - } - put(msg, m_newFolder); - put(msg, m_avatarName); - put(msg, m_avatarAddress); -} - -RDeleteAllPersistentMessages::RDeleteAllPersistentMessages(const ChatUnicodeString &avatarName, const ChatUnicodeString &avatarAddress, const ChatUnicodeString &category, unsigned olderThan) -: GenericRequest(REQUEST_PURGEPERSISTENTMESSAGES), - m_avatarName(avatarName.string_data, avatarName.string_length), - m_avatarAddress(avatarAddress.string_data, avatarAddress.string_length), - m_category(category.string_data, category.string_length), - m_olderThan(olderThan) -{ -} - -void RDeleteAllPersistentMessages::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_avatarName); - put(msg, m_avatarAddress); - put(msg, m_category); - put(msg, m_olderThan); -} - -RUnregisterRoom::RUnregisterRoom(const ChatUnicodeString &destRoomAddress) -: GenericRequest(REQUEST_UNREGISTERROOM), -m_destRoomAddress(destRoomAddress.string_data, destRoomAddress.string_length) -{ -} - -void RUnregisterRoom::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_destRoomAddress); -} - -RIgnoreStatus::RIgnoreStatus(unsigned srcAvatarID, const ChatUnicodeString &srcAddress) -: GenericRequest(REQUEST_IGNORESTATUS), -m_srcAvatarID(srcAvatarID), -m_srcAddress(srcAddress.string_data, srcAddress.string_length) -{ -} - -void RIgnoreStatus::pack(Base::ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_srcAvatarID); - put(msg, m_srcAddress); -} - -RFailoverReloginAvatar::RFailoverReloginAvatar(ChatAvatarCore *avatar) -: GenericRequest(REQUEST_FAILOVER_RELOGINAVATAR), - m_avatar(avatar) -{ -} - -void RFailoverReloginAvatar::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_avatar->getAvatarID()); - put(msg, m_avatar->getUserID()); - put(msg, m_avatar->getName()); - put(msg, m_avatar->getAddress()); - put(msg, m_avatar->getLoginLocation()); - put(msg, m_avatar->getLoginPriority()); - put(msg, m_avatar->getAttributes()); -} - -RFailoverRecreateRoom::RFailoverRecreateRoom(ChatRoomCore *room) -: GenericRequest(REQUEST_FAILOVER_RECREATEROOM), - m_room(room) -{ -} - -void RFailoverRecreateRoom::pack(ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - - // send full room object, except that the avatars sent only - // includes those on the API--"each API for itself" method reduces - // the amount of wasted iterations on the server. - m_room->serializeWithLocalAvatarsOnly(msg); -} - -RFriendConfirm::RFriendConfirm(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, unsigned destAvatarID, bool confirm) -: GenericRequest(REQUEST_CONFIRMFRIEND), - m_srcAvatarID(srcAvatarID), - m_destAvatarID(destAvatarID), - m_confirm(confirm != 0), - m_srcAddress(srcAddress.string_data, srcAddress.string_length) -{ -} - -void RFriendConfirm::pack(Base::ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_srcAvatarID); - put(msg, m_destAvatarID); - put(msg, m_confirm); - put(msg, m_srcAddress); -} - -RFriendConfirmReciprocate::RFriendConfirmReciprocate(unsigned srcAvatarID, const ChatUnicodeString &srcAddress, unsigned destAvatarID, bool confirm) -: GenericRequest(REQUEST_CONFIRMFRIEND_RECIPROCATE), -m_srcAvatarID(srcAvatarID), -m_destAvatarID(destAvatarID), -m_confirm(confirm != 0), -m_srcAddress(srcAddress.string_data, srcAddress.string_length) -{ -} - -void RFriendConfirmReciprocate::pack(Base::ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_srcAvatarID); - put(msg, m_destAvatarID); - put(msg, m_confirm); - put(msg, m_srcAddress); -} - -RGetFanClubHandle::RGetFanClubHandle(unsigned stationID, unsigned fanClubCode) -: GenericRequest(REQUEST_GETFANCLUBHANDLE), - m_stationID(stationID), - m_fanClubCode(fanClubCode) -{ -} - -void RGetFanClubHandle::pack(Base::ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_stationID); - put(msg, m_fanClubCode); -} - -RFindAvatarByUID::RFindAvatarByUID(unsigned userID) -: GenericRequest(REQUEST_FINDAVATARBYUID), - m_userID(userID) -{ -} - -void RFindAvatarByUID::pack(Base::ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_userID); -} - -RRegistrarGetChatServer::RRegistrarGetChatServer(std::string &hostname, unsigned short port) -: GenericRequest(REQUEST_REGISTRAR_GETCHATSERVER), - m_hostname(narrowToWide(hostname)), - m_port(port) -{ -} - -void RRegistrarGetChatServer::pack(Base::ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_hostname); - put(msg, m_port); -} - -RSendApiVersion::RSendApiVersion(unsigned long version) -: GenericRequest(REQUEST_SETAPIVERSION), - m_version(version) -{ -} - -void RSendApiVersion::pack(Base::ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, (uint32)m_version); -} - -RAddSnoopAvatar::RAddSnoopAvatar(unsigned srcAvatarID, const ChatUnicodeString &destName, const ChatUnicodeString &destAddress) -: GenericRequest(REQUEST_ADDSNOOPAVATAR), - m_srcAvatarID(srcAvatarID), - m_destAvatarName(destName.string_data, destName.string_length), - m_destAvatarAddress(destAddress.string_data, destAddress.string_length) -{ -} - -void RAddSnoopAvatar::pack(Base::ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_srcAvatarID); - put(msg, m_destAvatarName); - put(msg, m_destAvatarAddress); -} - -RRemoveSnoopAvatar::RRemoveSnoopAvatar(unsigned srcAvatarID, const ChatUnicodeString &destName, const ChatUnicodeString &destAddress) -: GenericRequest(REQUEST_REMOVESNOOPAVATAR), - m_srcAvatarID(srcAvatarID), - m_destAvatarName(destName.string_data, destName.string_length), - m_destAvatarAddress(destAddress.string_data, destAddress.string_length) -{ -} - -void RRemoveSnoopAvatar::pack(Base::ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_srcAvatarID); - put(msg, m_destAvatarName); - put(msg, m_destAvatarAddress); -} - -RAddSnoopRoom::RAddSnoopRoom(unsigned srcAvatarID, const ChatUnicodeString &roomAddress) -: GenericRequest(REQUEST_ADDSNOOPROOM), - m_srcAvatarID(srcAvatarID), - m_roomAddress(roomAddress.string_data, roomAddress.string_length) -{ -} - -void RAddSnoopRoom::pack(Base::ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_srcAvatarID); - put(msg, m_roomAddress); -} - -RRemoveSnoopRoom::RRemoveSnoopRoom(unsigned srcAvatarID, const ChatUnicodeString &roomAddress) -: GenericRequest(REQUEST_REMOVESNOOPROOM), - m_srcAvatarID(srcAvatarID), - m_roomAddress(roomAddress.string_data, roomAddress.string_length) -{ -} - -void RRemoveSnoopRoom::pack(Base::ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_srcAvatarID); - put(msg, m_roomAddress); -} - -RGetSnoopList::RGetSnoopList(unsigned srcAvatarID) -: GenericRequest(REQUEST_GETSNOOPLIST), - m_srcAvatarID(srcAvatarID) -{ -} - -void RGetSnoopList::pack(Base::ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_srcAvatarID); -} - -RTransferAvatar::RTransferAvatar(unsigned userID, unsigned newUserID, const ChatUnicodeString &avatarName, const ChatUnicodeString &newAvatarName, const ChatUnicodeString &avatarAddress, const ChatUnicodeString &newAvatarAddress, bool transferPersistentMessages) -: GenericRequest(REQUEST_TRANSFERAVATAR), - m_userID(userID), - m_newUserID(newUserID), - m_avatarName(avatarName.string_data, avatarName.string_length), - m_newAvatarName(newAvatarName.string_data, newAvatarName.string_length), - m_avatarAddress(avatarAddress.string_data, avatarAddress.string_length), - m_newAvatarAddress(newAvatarAddress.string_data, newAvatarAddress.string_length), - m_transferPersistentMessages(transferPersistentMessages) -{ -} - -void RTransferAvatar::pack(Base::ByteStream &msg) -{ - put(msg, m_type); - put(msg, m_track); - put(msg, m_userID); - put(msg, m_newUserID); - put(msg, m_avatarName); - put(msg, m_newAvatarName); - put(msg, m_avatarAddress); - put(msg, m_newAvatarAddress); - put(msg, m_transferPersistentMessages); -} - - -}; - +}; \ No newline at end of file diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Response.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Response.cpp index 44a2f0dd..c6b4a23e 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Response.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Response.cpp @@ -12,1670 +12,1602 @@ #include "AvatarListItem.h" #include "AvatarListItemCore.h" -namespace ChatSystem +namespace ChatSystem { + using namespace Base; + using namespace Plat_Unicode; -using namespace Base; -using namespace Plat_Unicode; - -ResLoginAvatar::ResLoginAvatar(void *user, int avatarLoginPriority) -: GenericResponse(RESPONSE_LOGINAVATAR, CHATRESULT_TIMEOUT, user), - m_avatar(nullptr), - m_submittedPriority(avatarLoginPriority), - m_requiredPriority(INT_MAX) -{ -} - -void ResLoginAvatar::unpack(ByteStream::ReadIterator &iter) -{ - - Plat_Unicode::String email; - unsigned inboxLimit = 0; - - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - - if(m_result == 0) + ResLoginAvatar::ResLoginAvatar(void *user, int avatarLoginPriority) + : GenericResponse(RESPONSE_LOGINAVATAR, CHATRESULT_TIMEOUT, user), + m_avatar(nullptr), + m_submittedPriority(avatarLoginPriority), + m_requiredPriority(INT_MAX) { - m_avatar = new ChatAvatarCore(iter); - + } + + void ResLoginAvatar::unpack(ByteStream::ReadIterator &iter) + { + Plat_Unicode::String email; + unsigned inboxLimit = 0; + + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + + if (m_result == 0) + { + m_avatar = new ChatAvatarCore(iter); + + if (iter.getSize() > 0) + { + get(iter, m_requiredPriority); + } + + if (iter.getSize() > 0) + { + ASSERT_VALID_STRING_LENGTH(get(iter, email)); + get(iter, inboxLimit); + } + + if (m_avatar) + { + m_avatar->setEmail(email); + m_avatar->setInboxLimit(inboxLimit); + } + } + } + + ResTemporaryAvatar::ResTemporaryAvatar(void *user) + : GenericResponse(RESPONSE_TEMPORARYAVATAR, CHATRESULT_TIMEOUT, user) + , m_avatar(nullptr) + { + } + + void ResTemporaryAvatar::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + + if (m_result == 0) + { + m_avatar = new ChatAvatarCore(iter); + } + } + + ResLogoutAvatar::ResLogoutAvatar(void *user, unsigned avatarID) + : GenericResponse(RESPONSE_LOGOUTAVATAR, CHATRESULT_TIMEOUT, user), + m_avatarID(avatarID) + { + } + + void ResLogoutAvatar::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + } + + ResDestroyAvatar::ResDestroyAvatar(void *user, unsigned avatarID) + : GenericResponse(RESPONSE_DESTROYAVATAR, CHATRESULT_TIMEOUT, user), + m_avatarID(avatarID) + { + } + + void ResDestroyAvatar::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + } + + ResGetAvatar::ResGetAvatar(void *user) + : GenericResponse(RESPONSE_GETAVATAR, CHATRESULT_TIMEOUT, user), + m_avatar(nullptr) + { + } + + void ResGetAvatar::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + + if (m_result == 0) + { + Plat_Unicode::String email; + unsigned inboxLimit = 0; + + m_avatar = new ChatAvatarCore(iter); + + if (iter.getSize() > 0) + { + ASSERT_VALID_STRING_LENGTH(get(iter, email)); + get(iter, inboxLimit); + } + + if (m_avatar) + { + m_avatar->setEmail(email); + m_avatar->setInboxLimit(inboxLimit); + } + } + } + + ResGetAnyAvatar::ResGetAnyAvatar(void* user) + : GenericResponse(RESPONSE_GETANYAVATAR, CHATRESULT_TIMEOUT, user) + , m_avatar(nullptr), m_online(0) + { + } + + void ResGetAnyAvatar::unpack(Base::ByteStream::ReadIterator& iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + get(iter, m_online); + + if (m_result == CHATRESULT_SUCCESS) + { + Plat_Unicode::String email; + unsigned inboxLimit = 0; + + m_avatar = new ChatAvatarCore(iter); + + if (iter.getSize() > 0) + { + ASSERT_VALID_STRING_LENGTH(get(iter, email)); + get(iter, inboxLimit); + } + + if (m_avatar) + { + m_avatar->setEmail(email); + m_avatar->setInboxLimit(inboxLimit); + } + } + } + + ResAvatarList::ResAvatarList(void *user) + : GenericResponse(RESPONSE_AVATARLIST, CHATRESULT_TIMEOUT, user) + , m_listLength(0) + , m_avatarList(nullptr) + , m_cores(nullptr) + { + } + + ResAvatarList::~ResAvatarList() + { + delete[] m_avatarList; + delete[] m_cores; + } + + void ResAvatarList::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + get(iter, m_listLength); + + if (m_listLength > 0) + { + m_avatarList = new AvatarListItem[m_listLength]; + m_cores = new AvatarListItemCore[m_listLength]; + + for (unsigned i = 0; i < m_listLength; i++) + { + m_cores[i].load(iter, &m_avatarList[i]); + } + } + } + + ResSetAvatarAttributes::ResSetAvatarAttributes(void *user) + : GenericResponse(RESPONSE_SETAVATARATTRIBUTES, CHATRESULT_TIMEOUT, user), + m_avatar(nullptr) + { + } + + void ResSetAvatarAttributes::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + + if (m_result == 0) + { + Plat_Unicode::String email; + unsigned inboxLimit = 0; + + m_avatar = new ChatAvatarCore(iter); + + if (iter.getSize() > 0) + { + ASSERT_VALID_STRING_LENGTH(get(iter, email)); + get(iter, inboxLimit); + } + + if (m_avatar) + { + m_avatar->setEmail(email); + m_avatar->setInboxLimit(inboxLimit); + } + } + } + + ResSetAvatarStatusMessage::ResSetAvatarStatusMessage(void *user) + : GenericResponse(RESPONSE_SETSTATUSMESSAGE, CHATRESULT_TIMEOUT, user), + m_avatar(nullptr) + { + } + + void ResSetAvatarStatusMessage::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + + if (m_result == 0) + { + Plat_Unicode::String email; + Plat_Unicode::String statusMessage; + unsigned inboxLimit = 0; + + m_avatar = new ChatAvatarCore(iter); + + if (iter.getSize() > 0) + { + ASSERT_VALID_STRING_LENGTH(get(iter, email)); + get(iter, inboxLimit); + ASSERT_VALID_STRING_LENGTH(get(iter, statusMessage)); + } + + if (m_avatar) + { + m_avatar->setEmail(email); + m_avatar->setInboxLimit(inboxLimit); + m_avatar->setStatusMessage(statusMessage); + } + } + } + + ResSetAvatarForwardingEmail::ResSetAvatarForwardingEmail(void *user) + : GenericResponse(RESPONSE_SETAVATAREMAIL, CHATRESULT_TIMEOUT, user), + m_avatar(nullptr) + { + } + + void ResSetAvatarForwardingEmail::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + + if (m_result == 0) + { + Plat_Unicode::String email; + unsigned inboxLimit = 0; + + m_avatar = new ChatAvatarCore(iter); + + ASSERT_VALID_STRING_LENGTH(get(iter, email)); + get(iter, inboxLimit); + m_avatar->setEmail(email); + m_avatar->setInboxLimit(inboxLimit); + } + } + + ResSetAvatarInboxLimit::ResSetAvatarInboxLimit(void *user) + : GenericResponse(RESPONSE_SETAVATARINBOXLIMIT, CHATRESULT_TIMEOUT, user), + m_avatar(nullptr) + { + } + + void ResSetAvatarInboxLimit::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + + if (m_result == 0) + { + Plat_Unicode::String email; + unsigned inboxLimit = 0; + + m_avatar = new ChatAvatarCore(iter); + + ASSERT_VALID_STRING_LENGTH(get(iter, email)); + get(iter, inboxLimit); + m_avatar->setEmail(email); + m_avatar->setInboxLimit(inboxLimit); + } + } + + ResSearchAvatarKeywords::ResSearchAvatarKeywords(void *user) + : GenericResponse(RESPONSE_SETAVATARKEYWORDS, CHATRESULT_TIMEOUT, user), + m_numMatches(0), + m_avatarMatches(nullptr) + { + } + + void ResSearchAvatarKeywords::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + get(iter, m_numMatches); + if (m_result == CHATRESULT_SUCCESS) + { + m_avatarMatches = new ChatAvatarCore*[m_numMatches]; + for (unsigned i = 0; i < m_numMatches; i++) + { + m_avatarMatches[i] = new ChatAvatarCore(iter); + } + } + } + + ResSearchAvatarKeywords::~ResSearchAvatarKeywords() + { + for (unsigned i = 0; i < m_numMatches; i++) + { + delete m_avatarMatches[i]; + } + + delete[] m_avatarMatches; + } + + ResSetAvatarKeywords::ResSetAvatarKeywords(void *user, unsigned avatarID) + : GenericResponse(RESPONSE_SETAVATARKEYWORDS, CHATRESULT_TIMEOUT, user), + m_avatarID(avatarID) + { + } + + void ResSetAvatarKeywords::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + } + + ResGetAvatarKeywords::ResGetAvatarKeywords(void *user, unsigned avatarID) + : GenericResponse(RESPONSE_GETAVATARKEYWORDS, CHATRESULT_TIMEOUT, user), + m_avatarID(avatarID), + m_keywordList(nullptr), + m_chatStrList(nullptr), + m_keywordLength(0) + { + } + + ResGetAvatarKeywords::~ResGetAvatarKeywords() + { + delete[] m_keywordList; + delete[] m_chatStrList; + } + + void ResGetAvatarKeywords::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + get(iter, m_keywordLength); + if (m_result == CHATRESULT_SUCCESS) + { + m_keywordList = new String[m_keywordLength]; + m_chatStrList = new ChatUnicodeString[m_keywordLength]; + for (unsigned i = 0; i < m_keywordLength; i++) + { + ASSERT_VALID_STRING_LENGTH(get(iter, m_keywordList[i])); + m_chatStrList[i] = m_keywordList[i]; + } + } + } + + ResGetRoom::ResGetRoom(void *user) + : GenericResponse(RESPONSE_GETROOM, CHATRESULT_TIMEOUT, user), + m_room(nullptr), + m_numExtraRooms(0) + { + } + + void ResGetRoom::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + + if (m_result == 0) + { + m_room = new ChatRoomCore(iter); + + // any extra parent rooms sent for caching? + get(iter, m_numExtraRooms); + for (unsigned i = 0; i != m_numExtraRooms; i++) + { + m_setExtraRooms.insert(new ChatRoomCore(iter)); + } + } + } + + ResCreateRoom::ResCreateRoom(void *user, unsigned avatarID) + : GenericResponse(RESPONSE_CREATEROOM, CHATRESULT_TIMEOUT, user), + m_srcAvatarID(avatarID), + m_room(nullptr), + m_numExtraRooms(0) + { + } + + void ResCreateRoom::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + if (m_result == 0) + { + m_room = new ChatRoomCore(iter); + + // any extra parent rooms sent for caching? + get(iter, m_numExtraRooms); + for (unsigned i = 0; i != m_numExtraRooms; i++) + { + m_setExtraRooms.insert(new ChatRoomCore(iter)); + } + } + } + + ResDestroyRoom::ResDestroyRoom(void *user, unsigned avatarID) + : GenericResponse(RESPONSE_DESTROYROOM, CHATRESULT_TIMEOUT, user), + m_avatarID(avatarID), + m_roomID(0) + { + } + + void ResDestroyRoom::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + get(iter, m_roomID); + } + + ResSendInstantMessage::ResSendInstantMessage(void *user, unsigned avatarID, const ChatUnicodeString &name, const ChatUnicodeString &address) + : GenericResponse(RESPONSE_SENDINSTANTMESSAGE, CHATRESULT_TIMEOUT, user), + m_avatarID(avatarID), + m_name(name.string_data, name.string_length), + m_address(address.string_data, address.string_length) + { + } + + void ResSendInstantMessage::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + } + + ResSendRoomMessage::ResSendRoomMessage(void *user, unsigned avatarID) + : GenericResponse(RESPONSE_SENDROOMMESSAGE, CHATRESULT_TIMEOUT, user), + m_avatarID(avatarID), + m_roomID(0) + { + } + + void ResSendRoomMessage::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + get(iter, m_roomID); + } + + ResSendBroadcastMessage::ResSendBroadcastMessage(void *user, unsigned avatarID, const ChatUnicodeString &address) + : GenericResponse(RESPONSE_SENDBROADCASTMESSAGE, CHATRESULT_TIMEOUT, user), + m_avatarID(avatarID), + m_address(address.string_data, address.string_length) + { + } + + void ResSendBroadcastMessage::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + } + + ResFilterMessage::ResFilterMessage(void *user, unsigned version) + : GenericResponse(version, CHATRESULT_TIMEOUT, user) + , m_version(version) + { + } + + void ResFilterMessage::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + ASSERT_VALID_STRING_LENGTH(get(iter, m_msg)); + } + + ResAddFriend::ResAddFriend(void *user, unsigned avatarID, const ChatUnicodeString &name, const ChatUnicodeString &address, const ChatUnicodeString &comment) + : GenericResponse(RESPONSE_ADDFRIEND, CHATRESULT_TIMEOUT, user), + m_avatarID(avatarID), + m_name(name.string_data, name.string_length), + m_address(address.string_data, address.string_length), + m_comment(comment.string_data, comment.string_length) + { + } + + void ResAddFriend::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + } + + ResAddFriendReciprocate::ResAddFriendReciprocate(void *user, unsigned avatarID, const ChatUnicodeString &name, const ChatUnicodeString &address, const ChatUnicodeString &comment) + : GenericResponse(RESPONSE_ADDFRIEND_RECIPROCATE, CHATRESULT_TIMEOUT, user), + m_avatarID(avatarID), + m_name(name.string_data, name.string_length), + m_address(address.string_data, address.string_length), + m_comment(comment.string_data, comment.string_length) + { + } + + void ResAddFriendReciprocate::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + } + + ResSetFriendComment::ResSetFriendComment(void *user, unsigned avatarID, const ChatUnicodeString &name, const ChatUnicodeString &address, const ChatUnicodeString &comment) + : GenericResponse(RESPONSE_SETFRIENDCOMMENT, CHATRESULT_TIMEOUT, user), + m_avatarID(avatarID), + m_name(name.string_data, name.string_length), + m_address(address.string_data, address.string_length), + m_comment(comment.string_data, comment.string_length) + { + } + + void ResSetFriendComment::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + } + + ResRemoveFriend::ResRemoveFriend(void *user, unsigned avatarID, const ChatUnicodeString &name, const ChatUnicodeString &address) + : GenericResponse(RESPONSE_REMOVEFRIEND, CHATRESULT_TIMEOUT, user), + m_avatarID(avatarID), + m_name(name.string_data, name.string_length), + m_address(address.string_data, address.string_length) + { + } + + void ResRemoveFriend::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + } + ResRemoveFriendReciprocate::ResRemoveFriendReciprocate(void *user, unsigned avatarID, const ChatUnicodeString &name, const ChatUnicodeString &address) + : GenericResponse(RESPONSE_REMOVEFRIEND_RECIPROCATE, CHATRESULT_TIMEOUT, user), + m_avatarID(avatarID), + m_name(name.string_data, name.string_length), + m_address(address.string_data, address.string_length) + { + } + + void ResRemoveFriendReciprocate::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + } + + ResFriendStatus::ResFriendStatus(void *user, unsigned avatarID) + : GenericResponse(RESPONSE_FRIENDSTATUS, CHATRESULT_TIMEOUT, user), + m_avatarID(avatarID), + m_listLength(0), + m_friendList(nullptr), + m_cores(nullptr) + { + } + + ResFriendStatus::~ResFriendStatus() + { + delete[] m_friendList; + delete[] m_cores; + } + + void ResFriendStatus::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + get(iter, m_listLength); + + if (m_listLength > 0) + { + m_friendList = new ChatFriendStatus[m_listLength]; + m_cores = new ChatFriendStatusCore[m_listLength]; + + for (unsigned i = 0; i < m_listLength; i++) + { + m_cores[i].load(iter, &m_friendList[i]); + } + } + } + + ResAddIgnore::ResAddIgnore(void *user, unsigned avatarID, const ChatUnicodeString &name, const ChatUnicodeString &address) + : GenericResponse(RESPONSE_ADDIGNORE, CHATRESULT_TIMEOUT, user), + m_avatarID(avatarID), + m_name(name.string_data, name.string_length), + m_address(address.string_data, address.string_length) + { + } + + void ResAddIgnore::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + } + + ResRemoveIgnore::ResRemoveIgnore(void *user, unsigned avatarID, const ChatUnicodeString &name, const ChatUnicodeString &address) + : GenericResponse(RESPONSE_REMOVEIGNORE, CHATRESULT_TIMEOUT, user), + m_avatarID(avatarID), + m_name(name.string_data, name.string_length), + m_address(address.string_data, address.string_length) + { + } + + void ResRemoveIgnore::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + } + + ResIgnoreStatus::ResIgnoreStatus(void *user, unsigned avatarID) + : GenericResponse(RESPONSE_IGNORESTATUS, CHATRESULT_TIMEOUT, user), + m_avatarID(avatarID), + m_listLength(0), + m_ignoreList(nullptr), + m_cores(nullptr) + { + } + + ResIgnoreStatus::~ResIgnoreStatus() + { + delete[] m_ignoreList; + delete[] m_cores; + } + + void ResIgnoreStatus::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + get(iter, m_listLength); + + if (m_listLength > 0) + { + m_ignoreList = new ChatIgnoreStatus[m_listLength]; + m_cores = new ChatIgnoreStatusCore[m_listLength]; + + for (unsigned i = 0; i < m_listLength; i++) + { + m_cores[i].load(iter, &m_ignoreList[i]); + } + } + } + + ResEnterRoom::ResEnterRoom(void *user, unsigned avatarID, const ChatUnicodeString &destAddress) + : GenericResponse(RESPONSE_ENTERROOM, CHATRESULT_TIMEOUT, user), + m_avatarID(avatarID), + m_destAddress(destAddress.string_data, destAddress.string_length), + m_gotRoomObj(false), + m_room(nullptr), + m_numExtraRooms(0) + { + } + + void ResEnterRoom::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + get(iter, m_roomID); + get(iter, m_gotRoomObj); + + if (m_gotRoomObj) + { + // we were sent room info to cache, so create a new ChatRoomCore! + m_room = new ChatRoomCore(iter); + + // any extra parent rooms sent for caching? + get(iter, m_numExtraRooms); + for (unsigned i = 0; i != m_numExtraRooms; i++) + { + m_setExtraRooms.insert(new ChatRoomCore(iter)); + } + } + } + + ResAllowRoomEntry::ResAllowRoomEntry(void *user, unsigned srcAvatarID, const ChatUnicodeString &destRoomAddress) + : GenericResponse(RESPONSE_ALLOWROOMENTRY, CHATRESULT_TIMEOUT, user), + m_srcAvatarID(srcAvatarID), + m_roomID(0), + m_destRoomAddress(destRoomAddress.string_data, destRoomAddress.string_length) + { + } + + void ResAllowRoomEntry::unpack(Base::ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + get(iter, m_roomID); + } + + ResLeaveRoom::ResLeaveRoom(void *user, unsigned avatarID, const ChatUnicodeString &destAddress) + : GenericResponse(RESPONSE_LEAVEROOM, CHATRESULT_TIMEOUT, user), + m_avatarID(avatarID), + m_destAddress(destAddress.string_data, destAddress.string_length) + { + } + + void ResLeaveRoom::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + get(iter, m_roomID); + } + + ResAddModerator::ResAddModerator(void *user, unsigned srcAvatarID) + : GenericResponse(RESPONSE_ADDMODERATOR, CHATRESULT_TIMEOUT, user), + m_srcAvatarID(srcAvatarID), + m_destRoomID(0) + { + } + + void ResAddModerator::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + get(iter, m_destRoomID); + } + + ResRemoveModerator::ResRemoveModerator(void *user, unsigned srcAvatarID) + : GenericResponse(RESPONSE_REMOVEMODERATOR, CHATRESULT_TIMEOUT, user), + m_srcAvatarID(srcAvatarID), + m_destRoomID(0) + { + } + + void ResRemoveModerator::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + get(iter, m_destRoomID); + } + + ResAddTemporaryModerator::ResAddTemporaryModerator(void *user, unsigned srcAvatarID) + : GenericResponse(RESPONSE_ADDTEMPORARYMODERATOR, CHATRESULT_TIMEOUT, user), + m_srcAvatarID(srcAvatarID), + m_destRoomID(0) + { + } + + void ResAddTemporaryModerator::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + get(iter, m_destRoomID); + } + + ResRemoveTemporaryModerator::ResRemoveTemporaryModerator(void *user, unsigned srcAvatarID) + : GenericResponse(RESPONSE_REMOVETEMPORARYMODERATOR, CHATRESULT_TIMEOUT, user), + m_srcAvatarID(srcAvatarID), + m_destRoomID(0) + { + } + + void ResRemoveTemporaryModerator::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + get(iter, m_destRoomID); + } + + ResAddBan::ResAddBan(void *user, unsigned srcAvatarID) + : GenericResponse(RESPONSE_ADDBAN, CHATRESULT_TIMEOUT, user), + m_srcAvatarID(srcAvatarID), + m_destRoomID(0) + { + } + + void ResAddBan::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + get(iter, m_destRoomID); + } + + ResRemoveBan::ResRemoveBan(void *user, unsigned srcAvatarID) + : GenericResponse(RESPONSE_REMOVEBAN, CHATRESULT_TIMEOUT, user), + m_srcAvatarID(srcAvatarID), + m_destRoomID(0) + { + } + + void ResRemoveBan::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + get(iter, m_destRoomID); + } + + ResAddInvite::ResAddInvite(void *user, unsigned srcAvatarID) + : GenericResponse(RESPONSE_ADDINVITE, CHATRESULT_TIMEOUT, user), + m_srcAvatarID(srcAvatarID), + m_destRoomID(0) + { + } + + void ResAddInvite::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + get(iter, m_destRoomID); + } + + ResRemoveInvite::ResRemoveInvite(void *user, unsigned srcAvatarID) + : GenericResponse(RESPONSE_REMOVEINVITE, CHATRESULT_TIMEOUT, user), + m_srcAvatarID(srcAvatarID), + m_destRoomID(0) + { + } + + void ResRemoveInvite::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + get(iter, m_destRoomID); + } + + ResGrantVoice::ResGrantVoice(void *user, unsigned srcAvatarID) + : GenericResponse(RESPONSE_GRANTVOICE, CHATRESULT_TIMEOUT, user), + m_srcAvatarID(srcAvatarID), + m_destRoomID(0) + { + } + + void ResGrantVoice::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + get(iter, m_destRoomID); + } + + ResRevokeVoice::ResRevokeVoice(void *user, unsigned srcAvatarID) + : GenericResponse(RESPONSE_REVOKEVOICE, CHATRESULT_TIMEOUT, user), + m_srcAvatarID(srcAvatarID), + m_destRoomID(0) + { + } + + void ResRevokeVoice::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + get(iter, m_destRoomID); + } + + ResKickAvatar::ResKickAvatar(void *user, unsigned srcAvatarID) + : GenericResponse(RESPONSE_KICKAVATAR, CHATRESULT_TIMEOUT, user), + m_srcAvatarID(srcAvatarID), + m_destRoomID(0) + { + } + + void ResKickAvatar::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + get(iter, m_destRoomID); + } + + ResSetRoomParams::ResSetRoomParams(void *user, unsigned srcAvatarID) + : GenericResponse(RESPONSE_SETROOMPARAMS, CHATRESULT_TIMEOUT, user), + m_srcAvatarID(srcAvatarID), + m_destRoomID(0) + { + } + + void ResSetRoomParams::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + get(iter, m_destRoomID); + } + + ResChangeRoomOwner::ResChangeRoomOwner(void *user, unsigned srcAvatarID) + : GenericResponse(RESPONSE_CHANGEROOMOWNER, CHATRESULT_TIMEOUT, user), + m_srcAvatarID(srcAvatarID), + m_destRoomID(0) + { + } + + void ResChangeRoomOwner::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + get(iter, m_destRoomID); + } + + ResGetRoomSummaries::ResGetRoomSummaries(void *user) + : GenericResponse(RESPONSE_GETROOMSUMMARIES, CHATRESULT_TIMEOUT, user), + m_numRooms(0), + m_roomSummaries(nullptr) + { + } + + ResGetRoomSummaries::~ResGetRoomSummaries() + { + delete[] m_roomSummaries; + } + + void ResGetRoomSummaries::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + get(iter, m_numRooms); + + if (m_numRooms > 0) + { + String tempStr; + unsigned tempNum; + + m_roomSummaries = new RoomSummary[m_numRooms]; + + for (unsigned i = 0; i != m_numRooms; i++) + { + // process RoomSummary objects from message + ASSERT_VALID_STRING_LENGTH(get(iter, tempStr)); + m_roomSummaries[i].setRoomAddress(ChatUnicodeString(tempStr.data(), tempStr.size())); + ASSERT_VALID_STRING_LENGTH(get(iter, tempStr)); + m_roomSummaries[i].setRoomTopic(ChatUnicodeString(tempStr.data(), tempStr.size())); + get(iter, tempNum); + m_roomSummaries[i].setRoomAttributes(tempNum); + get(iter, tempNum); + m_roomSummaries[i].setRoomCurSize(tempNum); + get(iter, tempNum); + m_roomSummaries[i].setRoomMaxSize(tempNum); + } + } + } + + ResSendPersistentMessage::ResSendPersistentMessage(void *user, unsigned srcAvatarID) + : GenericResponse(RESPONSE_SENDPERSISTENTMESSAGE, CHATRESULT_TIMEOUT, user), + m_srcAvatarID(srcAvatarID), + m_messageID(0) + { + } + + void ResSendPersistentMessage::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + + if (iter.getSize() > 0) + { + get(iter, m_messageID); + } + } + + ResSendMultiplePersistentMessages::ResSendMultiplePersistentMessages(void *user, unsigned srcAvatarID) + : GenericResponse(RESPONSE_SENDMULTIPLEPERSISTENTMESSAGES, CHATRESULT_TIMEOUT, user), + m_srcAvatarID(srcAvatarID), + m_numResults(0) + { + } + + void ResSendMultiplePersistentMessages::unpack(ByteStream::ReadIterator &iter) + { + unsigned resultIndex; + + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + + get(iter, m_numResults); + + m_resultVector.resize(m_numResults); + m_messageIDvector.resize(m_numResults); + + for (resultIndex = 0; resultIndex < m_numResults; resultIndex++) + { + get(iter, m_resultVector[resultIndex]); + } + + if (iter.getSize() > 0) + { + for (resultIndex = 0; resultIndex < m_numResults; resultIndex++) + { + get(iter, m_messageIDvector[resultIndex]); + } + } + } + + ResAlterPersistentMessage::ResAlterPersistentMessage(const ChatUnicodeString &destAvatarName, const ChatUnicodeString &destAvatarAddress, unsigned messageID, void *user) + : GenericResponse(RESPONSE_ALTERPERSISTENTMESSAGE, CHATRESULT_TIMEOUT, user), + m_destAvatarName(destAvatarName.data(), destAvatarName.length()), + m_destAvatarAddress(destAvatarAddress.data(), destAvatarAddress.length()), + m_messageID(messageID) + { + } + + ResAlterPersistentMessage::~ResAlterPersistentMessage() + { + } + + void ResAlterPersistentMessage::unpack(Base::ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + } + + ResGetPersistentMessage::ResGetPersistentMessage(void *user, unsigned srcAvatarID, unsigned messageID) + : GenericResponse(RESPONSE_GETPERSISTENTMESSAGE, CHATRESULT_TIMEOUT, user), + m_srcAvatarID(srcAvatarID), + m_messageID(messageID), + m_core(nullptr), + m_header(nullptr) + { + } + + ResGetPersistentMessage::~ResGetPersistentMessage() + { + delete m_header; + delete m_core; + } + void ResGetPersistentMessage::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + if (m_result == 0) + { + m_header = new PersistentHeader; + m_core = new PersistentHeaderCore; + m_core->load(iter, m_header); + ASSERT_VALID_STRING_LENGTH(get(iter, m_msg)); + ASSERT_VALID_STRING_LENGTH(get(iter, m_oob)); + + if (iter.getSize() > 0) + { + m_core->setFolder(iter); + m_core->setCategory(iter); + } + } + } + + ResGetMultiplePersistentMessages::ResGetMultiplePersistentMessages(void *user, unsigned srcAvatarID) + : GenericResponse(RESPONSE_GETMULTIPLEPERSISTENTMESSAGES, CHATRESULT_TIMEOUT, user), + m_srcAvatarID(srcAvatarID), + m_messages(nullptr) + { + } + + ResGetMultiplePersistentMessages::~ResGetMultiplePersistentMessages() + { + unsigned i; + + if (m_messages) + { + for (i = 0; i < m_listLength; i++) + { + delete m_messages[i]; + } + } + + delete[] m_messages; + } + + PersistentMessage ** const ResGetMultiplePersistentMessages::getList() const + { + return (PersistentMessage **)m_messages; + } + + void ResGetMultiplePersistentMessages::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + get(iter, m_listLength); + + if (m_listLength > 0) + { + unsigned i = 0; + + m_messages = new PersistentMessageCore*[m_listLength]; + + for (i = 0; i < m_listLength; i++) + { + m_messages[i] = new PersistentMessageCore(); + m_messages[i]->load(iter); + } + } + } + + ResGetPersistentHeaders::ResGetPersistentHeaders(void *user, unsigned srcAvatarID) + : GenericResponse(RESPONSE_GETPERSISTENTHEADERS, CHATRESULT_TIMEOUT, user), + m_srcAvatarID(srcAvatarID), + m_listLength(0), + m_headers(nullptr), + m_cores(nullptr), + m_listLength(0) + { + } + + ResGetPersistentHeaders::~ResGetPersistentHeaders() + { + delete[] m_headers; + delete[] m_cores; + } + + void ResGetPersistentHeaders::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + get(iter, m_listLength); + + if (m_listLength > 0) + { + unsigned i = 0; + + this->m_headers = new PersistentHeader[m_listLength]; + m_cores = new PersistentHeaderCore[m_listLength]; + + for (i = 0; i < m_listLength; i++) + { + m_cores[i].load(iter, &m_headers[i]); + } + + if (iter.getSize() > 0) + { + for (i = 0; i < m_listLength; i++) + { + m_cores[i].setFolder(iter); + m_cores[i].setCategory(iter); + } + } + } + } + + ResGetPartialPersistentHeaders::ResGetPartialPersistentHeaders(void *user, unsigned srcAvatarID) + : GenericResponse(RESPONSE_PARTIALPERSISTENTHEADERS, CHATRESULT_TIMEOUT, user), + m_srcAvatarID(srcAvatarID), + m_listLength(0), + m_headers(nullptr), + m_cores(nullptr) + { + } + + ResGetPartialPersistentHeaders::~ResGetPartialPersistentHeaders() + { + delete[] m_headers; + delete[] m_cores; + } + + void ResGetPartialPersistentHeaders::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + get(iter, m_listLength); + + if (m_listLength > 0) + { + unsigned i = 0; + + m_headers = new PersistentHeader[m_listLength]; + m_cores = new PersistentHeaderCore[m_listLength]; + + for (i = 0; i < m_listLength; i++) + { + m_cores[i].load(iter, &m_headers[i]); + } + + if (iter.getSize() > 0) + { + for (i = 0; i < m_listLength; i++) + { + m_cores[i].setFolder(iter); + m_cores[i].setCategory(iter); + } + } + } + } + + ResCountPersistentMessages::ResCountPersistentMessages(void *user, const ChatUnicodeString &avatarName, const ChatUnicodeString &avatarAddress) + : GenericResponse(RESPONSE_COUNTPERSISTENTMESSAGES, CHATRESULT_TIMEOUT, user), + m_avatarName(avatarName.string_data, avatarName.string_length), + m_avatarAddress(avatarAddress.string_data, avatarAddress.string_length), + m_numMessages(0) + { + } + + void ResCountPersistentMessages::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + get(iter, m_numMessages); + } + + ResUpdatePersistentMessage::ResUpdatePersistentMessage(void *user, unsigned srcAvatarID, unsigned messageID) + : GenericResponse(RESPONSE_UPDATEPERSISTENTMESSAGE, CHATRESULT_TIMEOUT, user), + m_srcAvatarID(srcAvatarID), + m_messageID(messageID) + { + } + + void ResUpdatePersistentMessage::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + } + + ResUpdatePersistentMessages::ResUpdatePersistentMessages(void *user, unsigned srcAvatarID) + : GenericResponse(RESPONSE_UPDATEPERSISTENTMESSAGES, CHATRESULT_TIMEOUT, user), + m_srcAvatarID(srcAvatarID) + { + } + + void ResUpdatePersistentMessages::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + } + + ResClassifyPersistentMessages::ResClassifyPersistentMessages(void *user, unsigned srcAvatarID) + : GenericResponse(RESPONSE_CHANGEPERSISTENTFOLDER, CHATRESULT_TIMEOUT, user), + m_srcAvatarID(srcAvatarID) + { + } + + void ResClassifyPersistentMessages::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + } + + ResDeleteAllPersistentMessages::ResDeleteAllPersistentMessages(void *user, const ChatUnicodeString &avatarName, const ChatUnicodeString &avatarAddress) + : GenericResponse(RESPONSE_PURGEPERSISTENTMESSAGES, CHATRESULT_TIMEOUT, user), + m_avatarName(avatarName.string_data, avatarName.string_length), + m_avatarAddress(avatarAddress.string_data, avatarAddress.string_length), + m_numDeleted(0) + { + } + + void ResDeleteAllPersistentMessages::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + get(iter, m_numDeleted); + } + + ResUnregisterRoom::ResUnregisterRoom(void *user) + : GenericResponse(RESPONSE_UNREGISTERROOM, CHATRESULT_TIMEOUT, user), + m_destRoomID(0) + { + } + + void ResUnregisterRoom::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + get(iter, m_destRoomID); + } + + ResFailoverReloginAvatar::ResFailoverReloginAvatar(unsigned avatarID) + : GenericResponse(RESPONSE_FAILOVER_RELOGINAVATAR, CHATRESULT_TIMEOUT, nullptr), + m_avatarID(avatarID) + { + } + + void ResFailoverReloginAvatar::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + if (iter.getSize() > 0) { get(iter, m_requiredPriority); } + } - if (iter.getSize() > 0) + ResFailoverRecreateRoom::ResFailoverRecreateRoom(unsigned roomID, bool forced) + : GenericResponse(RESPONSE_FAILOVER_RECREATEROOM, CHATRESULT_TIMEOUT, nullptr), + m_roomID(roomID), + m_room(nullptr), + m_forced(forced) + { + } + + void ResFailoverRecreateRoom::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + + if (m_result == 0) { - ASSERT_VALID_STRING_LENGTH(get(iter, email)); - get(iter, inboxLimit); - } - - if (m_avatar) - { - m_avatar->setEmail(email); - m_avatar->setInboxLimit(inboxLimit); - - } - } -} - -ResTemporaryAvatar::ResTemporaryAvatar(void *user) -: GenericResponse(RESPONSE_TEMPORARYAVATAR, CHATRESULT_TIMEOUT, user) -, m_avatar(nullptr) -{ -} - -void ResTemporaryAvatar::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - - if(m_result == 0) - { - m_avatar = new ChatAvatarCore(iter); - } -} - -ResLogoutAvatar::ResLogoutAvatar(void *user, unsigned avatarID) -: GenericResponse(RESPONSE_LOGOUTAVATAR, CHATRESULT_TIMEOUT, user), - m_avatarID(avatarID) -{ -} - -void ResLogoutAvatar::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); -} - -ResDestroyAvatar::ResDestroyAvatar(void *user, unsigned avatarID) -: GenericResponse(RESPONSE_DESTROYAVATAR, CHATRESULT_TIMEOUT, user), - m_avatarID(avatarID) -{ -} - -void ResDestroyAvatar::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); -} - -ResGetAvatar::ResGetAvatar(void *user) -: GenericResponse(RESPONSE_GETAVATAR, CHATRESULT_TIMEOUT, user), - m_avatar(nullptr) -{ -} - -void ResGetAvatar::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - - if (m_result == 0) - { - Plat_Unicode::String email; - unsigned inboxLimit = 0; - - m_avatar = new ChatAvatarCore(iter); - - if (iter.getSize() > 0) - { - ASSERT_VALID_STRING_LENGTH(get(iter, email)); - get(iter, inboxLimit); - } - - if (m_avatar) - { - m_avatar->setEmail(email); - m_avatar->setInboxLimit(inboxLimit); - } - } -} - -ResGetAnyAvatar::ResGetAnyAvatar(void* user) - : GenericResponse( RESPONSE_GETANYAVATAR, CHATRESULT_TIMEOUT, user ) - , m_avatar( nullptr ) -{ -} - -void ResGetAnyAvatar::unpack(Base::ByteStream::ReadIterator& iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - get(iter, m_online); - - if ( m_result == CHATRESULT_SUCCESS ) - { - Plat_Unicode::String email; - unsigned inboxLimit = 0; - - m_avatar = new ChatAvatarCore(iter); - - if ( iter.getSize() > 0) - { - ASSERT_VALID_STRING_LENGTH(get(iter, email)); - get(iter, inboxLimit); - - } - - if ( m_avatar ) - { - m_avatar->setEmail(email); - m_avatar->setInboxLimit(inboxLimit); - } - } -} - -ResAvatarList::ResAvatarList(void *user) -: GenericResponse(RESPONSE_AVATARLIST, CHATRESULT_TIMEOUT, user) -, m_listLength(0) -, m_avatarList(nullptr) -, m_cores(nullptr) -{ -} - -ResAvatarList::~ResAvatarList() -{ - delete[] m_avatarList; - delete[] m_cores; -} - -void ResAvatarList::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - get(iter, m_listLength); - - if(m_listLength > 0) - { - m_avatarList = new AvatarListItem[m_listLength]; - m_cores = new AvatarListItemCore[m_listLength]; - - for(unsigned i = 0; i < m_listLength; i++) - { - m_cores[i].load(iter, &m_avatarList[i]); - } - } -} - -ResSetAvatarAttributes::ResSetAvatarAttributes(void *user) -: GenericResponse(RESPONSE_SETAVATARATTRIBUTES, CHATRESULT_TIMEOUT, user), - m_avatar(nullptr) -{ -} - -void ResSetAvatarAttributes::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - - if (m_result == 0) - { - Plat_Unicode::String email; - unsigned inboxLimit = 0; - - m_avatar = new ChatAvatarCore(iter); - - if (iter.getSize() > 0) - { - ASSERT_VALID_STRING_LENGTH(get(iter, email)); - get(iter, inboxLimit); - } - - if (m_avatar) - { - m_avatar->setEmail(email); - m_avatar->setInboxLimit(inboxLimit); - } - } -} - -ResSetAvatarStatusMessage::ResSetAvatarStatusMessage(void *user) -: GenericResponse(RESPONSE_SETSTATUSMESSAGE, CHATRESULT_TIMEOUT, user), -m_avatar(nullptr) -{ -} - -void ResSetAvatarStatusMessage::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - - if (m_result == 0) - { - Plat_Unicode::String email; - Plat_Unicode::String statusMessage; - unsigned inboxLimit = 0; - - m_avatar = new ChatAvatarCore(iter); - - if (iter.getSize() > 0) - { - ASSERT_VALID_STRING_LENGTH(get(iter, email)); - get(iter, inboxLimit); - ASSERT_VALID_STRING_LENGTH(get(iter, statusMessage)); - } - - if (m_avatar) - { - m_avatar->setEmail(email); - m_avatar->setInboxLimit(inboxLimit); - m_avatar->setStatusMessage(statusMessage); - } - } -} - -ResSetAvatarForwardingEmail::ResSetAvatarForwardingEmail(void *user) -: GenericResponse(RESPONSE_SETAVATAREMAIL, CHATRESULT_TIMEOUT, user), - m_avatar(nullptr) -{ -} - -void ResSetAvatarForwardingEmail::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - - if (m_result == 0) - { - Plat_Unicode::String email; - unsigned inboxLimit = 0; - - m_avatar = new ChatAvatarCore(iter); - - ASSERT_VALID_STRING_LENGTH(get(iter, email)); - get(iter, inboxLimit); - m_avatar->setEmail(email); - m_avatar->setInboxLimit(inboxLimit); - } -} - -ResSetAvatarInboxLimit::ResSetAvatarInboxLimit(void *user) -: GenericResponse(RESPONSE_SETAVATARINBOXLIMIT, CHATRESULT_TIMEOUT, user), - m_avatar(nullptr) -{ -} - -void ResSetAvatarInboxLimit::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - - if (m_result == 0) - { - Plat_Unicode::String email; - unsigned inboxLimit = 0; - - m_avatar = new ChatAvatarCore(iter); - - ASSERT_VALID_STRING_LENGTH(get(iter, email)); - get(iter, inboxLimit); - m_avatar->setEmail(email); - m_avatar->setInboxLimit(inboxLimit); - } -} - -ResSearchAvatarKeywords::ResSearchAvatarKeywords(void *user) -: GenericResponse(RESPONSE_SETAVATARKEYWORDS, CHATRESULT_TIMEOUT, user), - m_numMatches(0), - m_avatarMatches(nullptr) -{ -} - -void ResSearchAvatarKeywords::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - get(iter, m_numMatches); - if (m_result == CHATRESULT_SUCCESS) - { - m_avatarMatches = new ChatAvatarCore*[m_numMatches]; - for (unsigned i = 0; i < m_numMatches; i++) - { - m_avatarMatches[i] = new ChatAvatarCore(iter); - } - } -} - -ResSearchAvatarKeywords::~ResSearchAvatarKeywords() -{ - for (unsigned i = 0; i < m_numMatches; i++) - { - delete m_avatarMatches[i]; - } - - delete[] m_avatarMatches; -} - -ResSetAvatarKeywords::ResSetAvatarKeywords(void *user, unsigned avatarID) -: GenericResponse(RESPONSE_SETAVATARKEYWORDS, CHATRESULT_TIMEOUT, user), - m_avatarID(avatarID) -{ -} - -void ResSetAvatarKeywords::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); -} - -ResGetAvatarKeywords::ResGetAvatarKeywords(void *user, unsigned avatarID) -: GenericResponse(RESPONSE_GETAVATARKEYWORDS, CHATRESULT_TIMEOUT, user), - m_avatarID(avatarID), - m_keywordList(nullptr), - m_chatStrList(nullptr) -{ -} - -ResGetAvatarKeywords::~ResGetAvatarKeywords() -{ - delete[] m_keywordList; - delete[] m_chatStrList; -} - -void ResGetAvatarKeywords::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - get(iter, m_keywordLength); - if(m_result == CHATRESULT_SUCCESS) - { - m_keywordList = new String[m_keywordLength]; - m_chatStrList = new ChatUnicodeString[m_keywordLength]; - for(unsigned i = 0; i < m_keywordLength; i++) - { - ASSERT_VALID_STRING_LENGTH(get(iter, m_keywordList[i])); - m_chatStrList[i] = m_keywordList[i]; - } - } -} - -ResGetRoom::ResGetRoom(void *user) -: GenericResponse(RESPONSE_GETROOM, CHATRESULT_TIMEOUT, user), - m_room(nullptr), - m_numExtraRooms(0) -{ -} - -void ResGetRoom::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - - if (m_result == 0) - { - m_room = new ChatRoomCore(iter); - - // any extra parent rooms sent for caching? - get(iter, m_numExtraRooms); - for (unsigned i = 0; i != m_numExtraRooms; i++) - { - m_setExtraRooms.insert(new ChatRoomCore(iter)); - } - } -} - -ResCreateRoom::ResCreateRoom(void *user, unsigned avatarID) -: GenericResponse(RESPONSE_CREATEROOM, CHATRESULT_TIMEOUT, user), - m_srcAvatarID(avatarID), - m_room(nullptr), - m_numExtraRooms(0) -{ -} - -void ResCreateRoom::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - if (m_result == 0) - { - m_room = new ChatRoomCore(iter); - - // any extra parent rooms sent for caching? - get(iter, m_numExtraRooms); - for (unsigned i = 0; i != m_numExtraRooms; i++) - { - m_setExtraRooms.insert(new ChatRoomCore(iter)); - } - } -} - -ResDestroyRoom::ResDestroyRoom(void *user, unsigned avatarID) -: GenericResponse(RESPONSE_DESTROYROOM, CHATRESULT_TIMEOUT, user), - m_avatarID(avatarID), - m_roomID(0) -{ -} - -void ResDestroyRoom::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - get(iter, m_roomID); -} - -ResSendInstantMessage::ResSendInstantMessage(void *user, unsigned avatarID, const ChatUnicodeString &name, const ChatUnicodeString &address) -: GenericResponse(RESPONSE_SENDINSTANTMESSAGE, CHATRESULT_TIMEOUT, user), - m_avatarID(avatarID), - m_name(name.string_data, name.string_length), - m_address(address.string_data, address.string_length) -{ -} - -void ResSendInstantMessage::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); -} - -ResSendRoomMessage::ResSendRoomMessage(void *user, unsigned avatarID) -: GenericResponse(RESPONSE_SENDROOMMESSAGE, CHATRESULT_TIMEOUT, user), - m_avatarID(avatarID), - m_roomID(0) -{ -} - -void ResSendRoomMessage::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - get(iter, m_roomID); -} - -ResSendBroadcastMessage::ResSendBroadcastMessage(void *user, unsigned avatarID, const ChatUnicodeString &address) -: GenericResponse(RESPONSE_SENDBROADCASTMESSAGE, CHATRESULT_TIMEOUT, user), - m_avatarID(avatarID), - m_address(address.string_data, address.string_length) -{ -} - -void ResSendBroadcastMessage::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); -} - -ResFilterMessage::ResFilterMessage(void *user, unsigned version) -: GenericResponse(version, CHATRESULT_TIMEOUT, user) -,m_version(version) -{ -} - -void ResFilterMessage::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - ASSERT_VALID_STRING_LENGTH(get(iter, m_msg)); -} - -ResAddFriend::ResAddFriend(void *user, unsigned avatarID, const ChatUnicodeString &name, const ChatUnicodeString &address, const ChatUnicodeString &comment) -: GenericResponse(RESPONSE_ADDFRIEND, CHATRESULT_TIMEOUT, user), - m_avatarID(avatarID), - m_name(name.string_data, name.string_length), - m_address(address.string_data, address.string_length), - m_comment(comment.string_data, comment.string_length) -{ -} - -void ResAddFriend::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); -} - -ResAddFriendReciprocate::ResAddFriendReciprocate(void *user, unsigned avatarID, const ChatUnicodeString &name, const ChatUnicodeString &address, const ChatUnicodeString &comment) -: GenericResponse(RESPONSE_ADDFRIEND_RECIPROCATE, CHATRESULT_TIMEOUT, user), -m_avatarID(avatarID), -m_name(name.string_data, name.string_length), -m_address(address.string_data, address.string_length), -m_comment(comment.string_data, comment.string_length) -{ -} - -void ResAddFriendReciprocate::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); -} - - -ResSetFriendComment::ResSetFriendComment(void *user, unsigned avatarID, const ChatUnicodeString &name, const ChatUnicodeString &address, const ChatUnicodeString &comment) -: GenericResponse(RESPONSE_SETFRIENDCOMMENT, CHATRESULT_TIMEOUT, user), - m_avatarID(avatarID), - m_name(name.string_data, name.string_length), - m_address(address.string_data, address.string_length), - m_comment(comment.string_data, comment.string_length) -{ -} - -void ResSetFriendComment::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); -} - -ResRemoveFriend::ResRemoveFriend(void *user, unsigned avatarID, const ChatUnicodeString &name, const ChatUnicodeString &address) -: GenericResponse(RESPONSE_REMOVEFRIEND, CHATRESULT_TIMEOUT, user), - m_avatarID(avatarID), - m_name(name.string_data, name.string_length), - m_address(address.string_data, address.string_length) -{ -} - -void ResRemoveFriend::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); -} -ResRemoveFriendReciprocate::ResRemoveFriendReciprocate(void *user, unsigned avatarID, const ChatUnicodeString &name, const ChatUnicodeString &address) -: GenericResponse(RESPONSE_REMOVEFRIEND_RECIPROCATE, CHATRESULT_TIMEOUT, user), -m_avatarID(avatarID), -m_name(name.string_data, name.string_length), -m_address(address.string_data, address.string_length) -{ -} - -void ResRemoveFriendReciprocate::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); -} - -ResFriendStatus::ResFriendStatus(void *user, unsigned avatarID) -: GenericResponse(RESPONSE_FRIENDSTATUS, CHATRESULT_TIMEOUT, user), - m_avatarID(avatarID), - m_listLength(0), - m_friendList(nullptr), - m_cores(nullptr) -{ -} - -ResFriendStatus::~ResFriendStatus() -{ - delete[] m_friendList; - delete[] m_cores; -} - -void ResFriendStatus::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - get(iter, m_listLength); - - if(m_listLength > 0) - { - m_friendList = new ChatFriendStatus[m_listLength]; - m_cores = new ChatFriendStatusCore[m_listLength]; - - for(unsigned i = 0; i < m_listLength; i++) - { - m_cores[i].load(iter, &m_friendList[i]); - } - } -} - -ResAddIgnore::ResAddIgnore(void *user, unsigned avatarID, const ChatUnicodeString &name, const ChatUnicodeString &address) -: GenericResponse(RESPONSE_ADDIGNORE, CHATRESULT_TIMEOUT, user), - m_avatarID(avatarID), - m_name(name.string_data, name.string_length), - m_address(address.string_data, address.string_length) -{ -} - -void ResAddIgnore::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); -} - -ResRemoveIgnore::ResRemoveIgnore(void *user, unsigned avatarID, const ChatUnicodeString &name, const ChatUnicodeString &address) -: GenericResponse(RESPONSE_REMOVEIGNORE, CHATRESULT_TIMEOUT, user), - m_avatarID(avatarID), - m_name(name.string_data, name.string_length), - m_address(address.string_data, address.string_length) -{ -} - -void ResRemoveIgnore::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); -} - -ResIgnoreStatus::ResIgnoreStatus(void *user, unsigned avatarID) -: GenericResponse(RESPONSE_IGNORESTATUS, CHATRESULT_TIMEOUT, user), - m_avatarID(avatarID), - m_listLength(0), - m_ignoreList(nullptr), - m_cores(nullptr) -{ -} - -ResIgnoreStatus::~ResIgnoreStatus() -{ - delete[] m_ignoreList; - delete[] m_cores; -} - -void ResIgnoreStatus::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - get(iter, m_listLength); - - if(m_listLength > 0) - { - m_ignoreList = new ChatIgnoreStatus[m_listLength]; - m_cores = new ChatIgnoreStatusCore[m_listLength]; - - for(unsigned i = 0; i < m_listLength; i++) - { - m_cores[i].load(iter, &m_ignoreList[i]); - } - } -} - -ResEnterRoom::ResEnterRoom(void *user, unsigned avatarID, const ChatUnicodeString &destAddress) -: GenericResponse(RESPONSE_ENTERROOM, CHATRESULT_TIMEOUT, user), - m_avatarID(avatarID), - m_destAddress(destAddress.string_data, destAddress.string_length), - m_gotRoomObj(false), - m_room(nullptr), - m_numExtraRooms(0) -{ -} - -void ResEnterRoom::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - get(iter, m_roomID); - get(iter, m_gotRoomObj); - - if (m_gotRoomObj) - { - // we were sent room info to cache, so create a new ChatRoomCore! - m_room = new ChatRoomCore(iter); - - // any extra parent rooms sent for caching? - get(iter, m_numExtraRooms); - for (unsigned i = 0; i != m_numExtraRooms; i++) - { - m_setExtraRooms.insert(new ChatRoomCore(iter)); - } - } -} - -ResAllowRoomEntry::ResAllowRoomEntry(void *user, unsigned srcAvatarID, const ChatUnicodeString &destRoomAddress) - : GenericResponse(RESPONSE_ALLOWROOMENTRY, CHATRESULT_TIMEOUT, user), - m_srcAvatarID(srcAvatarID), - m_roomID(0), - m_destRoomAddress(destRoomAddress.string_data, destRoomAddress.string_length) -{ -} - -void ResAllowRoomEntry::unpack(Base::ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - get(iter, m_roomID); -} - -ResLeaveRoom::ResLeaveRoom(void *user, unsigned avatarID, const ChatUnicodeString &destAddress) -: GenericResponse(RESPONSE_LEAVEROOM, CHATRESULT_TIMEOUT, user), - m_avatarID(avatarID), - m_destAddress(destAddress.string_data, destAddress.string_length) -{ -} - -void ResLeaveRoom::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - get(iter, m_roomID); -} - -ResAddModerator::ResAddModerator(void *user, unsigned srcAvatarID) -: GenericResponse(RESPONSE_ADDMODERATOR, CHATRESULT_TIMEOUT, user), - m_srcAvatarID(srcAvatarID), - m_destRoomID(0) -{ -} - -void ResAddModerator::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - get(iter, m_destRoomID); -} - -ResRemoveModerator::ResRemoveModerator(void *user, unsigned srcAvatarID) -: GenericResponse(RESPONSE_REMOVEMODERATOR, CHATRESULT_TIMEOUT, user), - m_srcAvatarID(srcAvatarID), - m_destRoomID(0) -{ -} - -void ResRemoveModerator::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - get(iter, m_destRoomID); -} - -ResAddTemporaryModerator::ResAddTemporaryModerator(void *user, unsigned srcAvatarID) -: GenericResponse(RESPONSE_ADDTEMPORARYMODERATOR, CHATRESULT_TIMEOUT, user), - m_srcAvatarID(srcAvatarID), - m_destRoomID(0) -{ -} - -void ResAddTemporaryModerator::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - get(iter, m_destRoomID); -} - -ResRemoveTemporaryModerator::ResRemoveTemporaryModerator(void *user, unsigned srcAvatarID) -: GenericResponse(RESPONSE_REMOVETEMPORARYMODERATOR, CHATRESULT_TIMEOUT, user), - m_srcAvatarID(srcAvatarID), - m_destRoomID(0) -{ -} - -void ResRemoveTemporaryModerator::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - get(iter, m_destRoomID); -} - -ResAddBan::ResAddBan(void *user, unsigned srcAvatarID) -: GenericResponse(RESPONSE_ADDBAN, CHATRESULT_TIMEOUT, user), - m_srcAvatarID(srcAvatarID), - m_destRoomID(0) -{ -} - -void ResAddBan::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - get(iter, m_destRoomID); -} - -ResRemoveBan::ResRemoveBan(void *user, unsigned srcAvatarID) -: GenericResponse(RESPONSE_REMOVEBAN, CHATRESULT_TIMEOUT, user), - m_srcAvatarID(srcAvatarID), - m_destRoomID(0) -{ -} - -void ResRemoveBan::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - get(iter, m_destRoomID); -} - -ResAddInvite::ResAddInvite(void *user, unsigned srcAvatarID) -: GenericResponse(RESPONSE_ADDINVITE, CHATRESULT_TIMEOUT, user), - m_srcAvatarID(srcAvatarID), - m_destRoomID(0) -{ -} - -void ResAddInvite::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - get(iter, m_destRoomID); -} - -ResRemoveInvite::ResRemoveInvite(void *user, unsigned srcAvatarID) -: GenericResponse(RESPONSE_REMOVEINVITE, CHATRESULT_TIMEOUT, user), - m_srcAvatarID(srcAvatarID), - m_destRoomID(0) -{ -} - -void ResRemoveInvite::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - get(iter, m_destRoomID); -} - -ResGrantVoice::ResGrantVoice(void *user, unsigned srcAvatarID) -: GenericResponse(RESPONSE_GRANTVOICE, CHATRESULT_TIMEOUT, user), - m_srcAvatarID(srcAvatarID), - m_destRoomID(0) -{ -} - -void ResGrantVoice::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - get(iter, m_destRoomID); -} - -ResRevokeVoice::ResRevokeVoice(void *user, unsigned srcAvatarID) -: GenericResponse(RESPONSE_REVOKEVOICE, CHATRESULT_TIMEOUT, user), - m_srcAvatarID(srcAvatarID), - m_destRoomID(0) -{ -} - -void ResRevokeVoice::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - get(iter, m_destRoomID); -} - -ResKickAvatar::ResKickAvatar(void *user, unsigned srcAvatarID) -: GenericResponse(RESPONSE_KICKAVATAR, CHATRESULT_TIMEOUT, user), - m_srcAvatarID(srcAvatarID), - m_destRoomID(0) -{ -} - -void ResKickAvatar::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - get(iter, m_destRoomID); -} - -ResSetRoomParams::ResSetRoomParams(void *user, unsigned srcAvatarID) -: GenericResponse(RESPONSE_SETROOMPARAMS, CHATRESULT_TIMEOUT, user), - m_srcAvatarID(srcAvatarID), - m_destRoomID(0) -{ -} - -void ResSetRoomParams::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - get(iter, m_destRoomID); -} - -ResChangeRoomOwner::ResChangeRoomOwner(void *user, unsigned srcAvatarID) -: GenericResponse(RESPONSE_CHANGEROOMOWNER, CHATRESULT_TIMEOUT, user), - m_srcAvatarID(srcAvatarID), - m_destRoomID(0) -{ -} - -void ResChangeRoomOwner::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - get(iter, m_destRoomID); -} - -ResGetRoomSummaries::ResGetRoomSummaries(void *user) -: GenericResponse(RESPONSE_GETROOMSUMMARIES, CHATRESULT_TIMEOUT, user), - m_numRooms(0), - m_roomSummaries(nullptr) -{ -} - -ResGetRoomSummaries::~ResGetRoomSummaries() -{ - delete[] m_roomSummaries; -} - -void ResGetRoomSummaries::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - get(iter, m_numRooms); - - if (m_numRooms > 0) - { - String tempStr; - unsigned tempNum; - - m_roomSummaries = new RoomSummary[m_numRooms]; - - for (unsigned i = 0; i != m_numRooms; i++) - { - // process RoomSummary objects from message - ASSERT_VALID_STRING_LENGTH(get(iter, tempStr)); - m_roomSummaries[i].setRoomAddress(ChatUnicodeString(tempStr.data(), tempStr.size())); - ASSERT_VALID_STRING_LENGTH(get(iter, tempStr)); - m_roomSummaries[i].setRoomTopic(ChatUnicodeString(tempStr.data(), tempStr.size())); - get(iter, tempNum); - m_roomSummaries[i].setRoomAttributes(tempNum); - get(iter, tempNum); - m_roomSummaries[i].setRoomCurSize(tempNum); - get(iter, tempNum); - m_roomSummaries[i].setRoomMaxSize(tempNum); - } - } -} - -ResSendPersistentMessage::ResSendPersistentMessage(void *user, unsigned srcAvatarID) -: GenericResponse(RESPONSE_SENDPERSISTENTMESSAGE, CHATRESULT_TIMEOUT, user), - m_srcAvatarID(srcAvatarID), - m_messageID(0) -{ -} - -void ResSendPersistentMessage::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - - if (iter.getSize() > 0) - { - get(iter, m_messageID); - } -} - -ResSendMultiplePersistentMessages::ResSendMultiplePersistentMessages(void *user, unsigned srcAvatarID) -: GenericResponse(RESPONSE_SENDMULTIPLEPERSISTENTMESSAGES, CHATRESULT_TIMEOUT, user), - m_srcAvatarID(srcAvatarID), - m_numResults(0) -{ -} - -void ResSendMultiplePersistentMessages::unpack(ByteStream::ReadIterator &iter) -{ - - unsigned resultIndex; - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - - get(iter, m_numResults); - - m_resultVector.resize(m_numResults); - m_messageIDvector.resize(m_numResults); - - for (resultIndex = 0; resultIndex < m_numResults; resultIndex++) - { - get(iter, m_resultVector[resultIndex]); - } - - if (iter.getSize() > 0) - { - for (resultIndex = 0; resultIndex < m_numResults; resultIndex++) - { - get(iter, m_messageIDvector[resultIndex]); - } - } -} - -ResAlterPersistentMessage::ResAlterPersistentMessage(const ChatUnicodeString &destAvatarName, const ChatUnicodeString &destAvatarAddress, unsigned messageID, void *user) -: GenericResponse(RESPONSE_ALTERPERSISTENTMESSAGE, CHATRESULT_TIMEOUT, user), - m_destAvatarName(destAvatarName.data(), destAvatarName.length()), - m_destAvatarAddress(destAvatarAddress.data(), destAvatarAddress.length()), - m_messageID(messageID) -{ -} - -ResAlterPersistentMessage::~ResAlterPersistentMessage() -{ -} - -void ResAlterPersistentMessage::unpack(Base::ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); -} - -ResGetPersistentMessage::ResGetPersistentMessage(void *user, unsigned srcAvatarID, unsigned messageID) -: GenericResponse(RESPONSE_GETPERSISTENTMESSAGE, CHATRESULT_TIMEOUT, user), - m_srcAvatarID(srcAvatarID), - m_messageID(messageID), - m_core(nullptr), - m_header(nullptr) -{ -} - -ResGetPersistentMessage::~ResGetPersistentMessage() -{ - delete m_header; - delete m_core; -} -void ResGetPersistentMessage::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - if(m_result == 0) - { - m_header = new PersistentHeader; - m_core = new PersistentHeaderCore; - m_core->load(iter, m_header); - ASSERT_VALID_STRING_LENGTH(get(iter, m_msg)); - ASSERT_VALID_STRING_LENGTH(get(iter, m_oob)); - - if (iter.getSize() > 0) - { - m_core->setFolder(iter); - m_core->setCategory(iter); - } - } -} - -ResGetMultiplePersistentMessages::ResGetMultiplePersistentMessages(void *user, unsigned srcAvatarID) -: GenericResponse(RESPONSE_GETMULTIPLEPERSISTENTMESSAGES, CHATRESULT_TIMEOUT, user), - m_srcAvatarID(srcAvatarID), - m_messages(nullptr) -{ -} - -ResGetMultiplePersistentMessages::~ResGetMultiplePersistentMessages() -{ - unsigned i; - - if (m_messages) - { - for(i = 0; i < m_listLength; i++) - { - delete m_messages[i]; + m_room = new ChatRoomCore(iter); } } - delete[] m_messages; -} - -PersistentMessage ** const ResGetMultiplePersistentMessages::getList() const -{ - return (PersistentMessage **)m_messages; -} - -void ResGetMultiplePersistentMessages::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - get(iter, m_listLength); - - if(m_listLength > 0) + ResFriendConfirm::ResFriendConfirm(unsigned srcAvatarID, void *user) + : GenericResponse(RESPONSE_CONFIRMFRIEND, CHATRESULT_TIMEOUT, user), + m_avatarID(srcAvatarID) { - unsigned i = 0; - - m_messages = new PersistentMessageCore*[m_listLength]; - - for(i = 0; i < m_listLength; i++) - { - m_messages[i] = new PersistentMessageCore(); - m_messages[i]->load(iter); - } - } -} - -ResGetPersistentHeaders::ResGetPersistentHeaders(void *user, unsigned srcAvatarID) -: GenericResponse(RESPONSE_GETPERSISTENTHEADERS, CHATRESULT_TIMEOUT, user), - m_srcAvatarID(srcAvatarID), - m_listLength(0), - m_headers(nullptr), - m_cores(nullptr) -{ -} - -ResGetPersistentHeaders::~ResGetPersistentHeaders() -{ - delete[] m_headers; - delete[] m_cores; -} - -void ResGetPersistentHeaders::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - get(iter, m_listLength); - - if(m_listLength > 0) - { - unsigned i = 0; - - this->m_headers = new PersistentHeader[m_listLength]; - m_cores = new PersistentHeaderCore[m_listLength]; - - for(i = 0; i < m_listLength; i++) - { - m_cores[i].load(iter, &m_headers[i]); - } - - if (iter.getSize() > 0) - { - for(i = 0; i < m_listLength; i++) - { - m_cores[i].setFolder(iter); - m_cores[i].setCategory(iter); - } - } - } -} - -ResGetPartialPersistentHeaders::ResGetPartialPersistentHeaders(void *user, unsigned srcAvatarID) -: GenericResponse(RESPONSE_PARTIALPERSISTENTHEADERS, CHATRESULT_TIMEOUT, user), - m_srcAvatarID(srcAvatarID), - m_listLength(0), - m_headers(nullptr), - m_cores(nullptr) -{ -} - -ResGetPartialPersistentHeaders::~ResGetPartialPersistentHeaders() -{ - delete[] m_headers; - delete[] m_cores; -} - -void ResGetPartialPersistentHeaders::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - get(iter, m_listLength); - - if(m_listLength > 0) - { - unsigned i = 0; - - m_headers = new PersistentHeader[m_listLength]; - m_cores = new PersistentHeaderCore[m_listLength]; - - for(i = 0; i < m_listLength; i++) - { - m_cores[i].load(iter, &m_headers[i]); - } - - if (iter.getSize() > 0) - { - for(i = 0; i < m_listLength; i++) - { - m_cores[i].setFolder(iter); - m_cores[i].setCategory(iter); - } - } - } -} - -ResCountPersistentMessages::ResCountPersistentMessages(void *user, const ChatUnicodeString &avatarName, const ChatUnicodeString &avatarAddress) -: GenericResponse(RESPONSE_COUNTPERSISTENTMESSAGES, CHATRESULT_TIMEOUT, user), - m_avatarName(avatarName.string_data, avatarName.string_length), - m_avatarAddress(avatarAddress.string_data, avatarAddress.string_length), - m_numMessages(0) -{ -} - -void ResCountPersistentMessages::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - get(iter, m_numMessages); -} - -ResUpdatePersistentMessage::ResUpdatePersistentMessage(void *user, unsigned srcAvatarID, unsigned messageID) -: GenericResponse(RESPONSE_UPDATEPERSISTENTMESSAGE, CHATRESULT_TIMEOUT, user), - m_srcAvatarID(srcAvatarID), - m_messageID(messageID) -{ -} - -void ResUpdatePersistentMessage::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); -} - -ResUpdatePersistentMessages::ResUpdatePersistentMessages(void *user, unsigned srcAvatarID) -: GenericResponse(RESPONSE_UPDATEPERSISTENTMESSAGES, CHATRESULT_TIMEOUT, user), - m_srcAvatarID(srcAvatarID) -{ -} - -void ResUpdatePersistentMessages::unpack(ByteStream::ReadIterator &iter) -{ - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); -} - -ResClassifyPersistentMessages::ResClassifyPersistentMessages(void *user, unsigned srcAvatarID) -: GenericResponse(RESPONSE_CHANGEPERSISTENTFOLDER, CHATRESULT_TIMEOUT, user), - m_srcAvatarID(srcAvatarID) -{ -} - -void ResClassifyPersistentMessages::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); -} - -ResDeleteAllPersistentMessages::ResDeleteAllPersistentMessages(void *user, const ChatUnicodeString &avatarName, const ChatUnicodeString &avatarAddress) -: GenericResponse(RESPONSE_PURGEPERSISTENTMESSAGES, CHATRESULT_TIMEOUT, user), - m_avatarName(avatarName.string_data, avatarName.string_length), - m_avatarAddress(avatarAddress.string_data, avatarAddress.string_length), - m_numDeleted(0) -{ -} - -void ResDeleteAllPersistentMessages::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - get(iter, m_numDeleted); -} - -ResUnregisterRoom::ResUnregisterRoom(void *user) -: GenericResponse(RESPONSE_UNREGISTERROOM, CHATRESULT_TIMEOUT, user), - m_destRoomID(0) -{ -} - -void ResUnregisterRoom::unpack(ByteStream::ReadIterator &iter) -{ - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - get(iter, m_destRoomID); -} - -ResFailoverReloginAvatar::ResFailoverReloginAvatar(unsigned avatarID) -: GenericResponse(RESPONSE_FAILOVER_RELOGINAVATAR, CHATRESULT_TIMEOUT, nullptr), - m_avatarID(avatarID) -{ -} - -void ResFailoverReloginAvatar::unpack(ByteStream::ReadIterator &iter) -{ - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - - if (iter.getSize() > 0) - { - get(iter, m_requiredPriority); - } -} - -ResFailoverRecreateRoom::ResFailoverRecreateRoom(unsigned roomID, bool forced) -: GenericResponse(RESPONSE_FAILOVER_RECREATEROOM, CHATRESULT_TIMEOUT, nullptr), - m_roomID(roomID), - m_room(nullptr), - m_forced(forced) -{ -} - -void ResFailoverRecreateRoom::unpack(ByteStream::ReadIterator &iter) -{ - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - - if (m_result == 0) - { - m_room = new ChatRoomCore(iter); - } -} - -ResFriendConfirm::ResFriendConfirm(unsigned srcAvatarID, void *user) -: GenericResponse(RESPONSE_CONFIRMFRIEND, CHATRESULT_TIMEOUT, user), - m_avatarID(srcAvatarID) -{ -} - -void ResFriendConfirmReciprocate::unpack(ByteStream::ReadIterator &iter) -{ - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); -} - -ResFriendConfirmReciprocate::ResFriendConfirmReciprocate(unsigned srcAvatarID, void *user) -: GenericResponse(RESPONSE_CONFIRMFRIEND_RECIPROCATE, CHATRESULT_TIMEOUT, user), -m_avatarID(srcAvatarID) -{ -} - -void ResFriendConfirm::unpack(ByteStream::ReadIterator &iter) -{ - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); -} - -ResGetFanClubHandle::ResGetFanClubHandle(unsigned stationID, unsigned fanClubCode, void *user) -: GenericResponse(RESPONSE_GETFANCLUBHANDLE, CHATRESULT_TIMEOUT, user), - m_stationID(stationID), - m_fanClubCode(fanClubCode) -{ -} - -void ResGetFanClubHandle::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - ASSERT_VALID_STRING_LENGTH(get(iter, m_handle)); -} - -ResFindAvatarByUID::ResFindAvatarByUID(void *user) -: GenericResponse(RESPONSE_FINDAVATARBYUID, CHATRESULT_TIMEOUT, user), - m_numAvatarsOnline(0), - m_avatars(nullptr) -{ -} - -ResFindAvatarByUID::~ResFindAvatarByUID() -{ - for (unsigned i = 0; i < m_numAvatarsOnline; i++) - { - delete m_avatars[i]; } - delete[] m_avatars; -} - -void ResFindAvatarByUID::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - get(iter, m_numAvatarsOnline); - - if (m_numAvatarsOnline > 0) + void ResFriendConfirmReciprocate::unpack(ByteStream::ReadIterator &iter) { - m_avatars = new ChatAvatarCore*[m_numAvatarsOnline]; + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + } + ResFriendConfirmReciprocate::ResFriendConfirmReciprocate(unsigned srcAvatarID, void *user) + : GenericResponse(RESPONSE_CONFIRMFRIEND_RECIPROCATE, CHATRESULT_TIMEOUT, user), + m_avatarID(srcAvatarID) + { + } + + void ResFriendConfirm::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + } + + ResGetFanClubHandle::ResGetFanClubHandle(unsigned stationID, unsigned fanClubCode, void *user) + : GenericResponse(RESPONSE_GETFANCLUBHANDLE, CHATRESULT_TIMEOUT, user), + m_stationID(stationID), + m_fanClubCode(fanClubCode) + { + } + + void ResGetFanClubHandle::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + ASSERT_VALID_STRING_LENGTH(get(iter, m_handle)); + } + + ResFindAvatarByUID::ResFindAvatarByUID(void *user) + : GenericResponse(RESPONSE_FINDAVATARBYUID, CHATRESULT_TIMEOUT, user), + m_numAvatarsOnline(0), + m_avatars(nullptr) + { + } + + ResFindAvatarByUID::~ResFindAvatarByUID() + { for (unsigned i = 0; i < m_numAvatarsOnline; i++) { - m_avatars[i] = new ChatAvatarCore(iter); + delete m_avatars[i]; + } + + delete[] m_avatars; + } + + void ResFindAvatarByUID::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + get(iter, m_numAvatarsOnline); + + if (m_numAvatarsOnline > 0) + { + m_avatars = new ChatAvatarCore*[m_numAvatarsOnline]; + + for (unsigned i = 0; i < m_numAvatarsOnline; i++) + { + m_avatars[i] = new ChatAvatarCore(iter); + } } } -} -ResRegistrarGetChatServer::ResRegistrarGetChatServer() -: GenericResponse(RESPONSE_REGISTRAR_GETCHATSERVER, CHATRESULT_TIMEOUT, nullptr) -{ -} - -void ResRegistrarGetChatServer::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - ASSERT_VALID_STRING_LENGTH(get(iter, m_hostname)); - get(iter, m_port); -} - -ResSendApiVersion::ResSendApiVersion() -: GenericResponse(RESPONSE_SETAPIVERSION, CHATRESULT_TIMEOUT, nullptr) -{ -} - -void ResSendApiVersion::unpack(ByteStream::ReadIterator &iter) -{ - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - get(iter, (uint32 &)m_serverVersion); -} - -ResAddSnoopAvatar::ResAddSnoopAvatar(void *user, unsigned srcAvatarID, const ChatUnicodeString &destName, const ChatUnicodeString &destAddress) -: GenericResponse(RESPONSE_ADDSNOOPAVATAR, CHATRESULT_TIMEOUT, user), - m_srcAvatarID(srcAvatarID), - m_destAvatarName(destName.string_data, destName.string_length), - m_destAvatarAddress(destAddress.string_data, destAddress.string_length) -{ -} - -void ResAddSnoopAvatar::unpack(ByteStream::ReadIterator &iter) -{ - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); -} - -ResRemoveSnoopAvatar::ResRemoveSnoopAvatar(void *user, unsigned srcAvatarID, const ChatUnicodeString &destName, const ChatUnicodeString &destAddress) -: GenericResponse(RESPONSE_REMOVESNOOPAVATAR, CHATRESULT_TIMEOUT, user), - m_srcAvatarID(srcAvatarID), - m_destAvatarName(destName.string_data, destName.string_length), - m_destAvatarAddress(destAddress.string_data, destAddress.string_length) -{ -} - -void ResRemoveSnoopAvatar::unpack(ByteStream::ReadIterator &iter) -{ - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); -} - -ResAddSnoopRoom::ResAddSnoopRoom(void *user, unsigned srcAvatarID, const ChatUnicodeString &roomAddress) -: GenericResponse(RESPONSE_ADDSNOOPROOM, CHATRESULT_TIMEOUT, user), - m_srcAvatarID(srcAvatarID), - m_roomAddress(roomAddress.string_data, roomAddress.string_length) -{ -} - -void ResAddSnoopRoom::unpack(ByteStream::ReadIterator &iter) -{ - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); -} - -ResRemoveSnoopRoom::ResRemoveSnoopRoom(void *user, unsigned srcAvatarID, const ChatUnicodeString &roomAddress) -: GenericResponse(RESPONSE_REMOVESNOOPROOM, CHATRESULT_TIMEOUT, user), - m_srcAvatarID(srcAvatarID), - m_roomAddress(roomAddress.string_data, roomAddress.string_length) -{ -} - -void ResRemoveSnoopRoom::unpack(ByteStream::ReadIterator &iter) -{ - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); -} - -ResGetSnoopList::ResGetSnoopList(void *user, unsigned srcAvatarID) -: GenericResponse(RESPONSE_GETSNOOPLIST, CHATRESULT_TIMEOUT, user), - m_srcAvatarID(srcAvatarID), - m_avatarSnoops(nullptr), - m_roomSnoops(nullptr) -{ -} - -ResGetSnoopList::~ResGetSnoopList() -{ - for (unsigned i = 0; i < m_avatarSnoopListLength; i++) + ResRegistrarGetChatServer::ResRegistrarGetChatServer() + : GenericResponse(RESPONSE_REGISTRAR_GETCHATSERVER, CHATRESULT_TIMEOUT, nullptr) { - delete m_avatarSnoops[i]; } - delete[] m_avatarSnoops; - for (unsigned j = 0; j < m_roomSnoopListLength; j++) + void ResRegistrarGetChatServer::unpack(ByteStream::ReadIterator &iter) { - delete m_roomSnoops[j]; + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + ASSERT_VALID_STRING_LENGTH(get(iter, m_hostname)); + get(iter, m_port); } - delete[] m_roomSnoops; -} -void ResGetSnoopList::unpack(ByteStream::ReadIterator &iter) -{ - - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); - get(iter, m_avatarSnoopListLength); - get(iter, m_roomSnoopListLength); - - if (m_avatarSnoopListLength > 0) + ResSendApiVersion::ResSendApiVersion() + : GenericResponse(RESPONSE_SETAPIVERSION, CHATRESULT_TIMEOUT, nullptr) { - m_avatarSnoops = new AvatarSnoopPair*[m_avatarSnoopListLength]; + } + void ResSendApiVersion::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + get(iter, (uint32 &)m_serverVersion); + } + + ResAddSnoopAvatar::ResAddSnoopAvatar(void *user, unsigned srcAvatarID, const ChatUnicodeString &destName, const ChatUnicodeString &destAddress) + : GenericResponse(RESPONSE_ADDSNOOPAVATAR, CHATRESULT_TIMEOUT, user), + m_srcAvatarID(srcAvatarID), + m_destAvatarName(destName.string_data, destName.string_length), + m_destAvatarAddress(destAddress.string_data, destAddress.string_length) + { + } + + void ResAddSnoopAvatar::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + } + + ResRemoveSnoopAvatar::ResRemoveSnoopAvatar(void *user, unsigned srcAvatarID, const ChatUnicodeString &destName, const ChatUnicodeString &destAddress) + : GenericResponse(RESPONSE_REMOVESNOOPAVATAR, CHATRESULT_TIMEOUT, user), + m_srcAvatarID(srcAvatarID), + m_destAvatarName(destName.string_data, destName.string_length), + m_destAvatarAddress(destAddress.string_data, destAddress.string_length) + { + } + + void ResRemoveSnoopAvatar::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + } + + ResAddSnoopRoom::ResAddSnoopRoom(void *user, unsigned srcAvatarID, const ChatUnicodeString &roomAddress) + : GenericResponse(RESPONSE_ADDSNOOPROOM, CHATRESULT_TIMEOUT, user), + m_srcAvatarID(srcAvatarID), + m_roomAddress(roomAddress.string_data, roomAddress.string_length) + { + } + + void ResAddSnoopRoom::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + } + + ResRemoveSnoopRoom::ResRemoveSnoopRoom(void *user, unsigned srcAvatarID, const ChatUnicodeString &roomAddress) + : GenericResponse(RESPONSE_REMOVESNOOPROOM, CHATRESULT_TIMEOUT, user), + m_srcAvatarID(srcAvatarID), + m_roomAddress(roomAddress.string_data, roomAddress.string_length) + { + } + + void ResRemoveSnoopRoom::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + } + + ResGetSnoopList::ResGetSnoopList(void *user, unsigned srcAvatarID) + : GenericResponse(RESPONSE_GETSNOOPLIST, CHATRESULT_TIMEOUT, user), + m_srcAvatarID(srcAvatarID), + m_avatarSnoops(nullptr), + m_roomSnoops(nullptr) + { + } + + ResGetSnoopList::~ResGetSnoopList() + { for (unsigned i = 0; i < m_avatarSnoopListLength; i++) { - Plat_Unicode::String name; - Plat_Unicode::String addr; - ASSERT_VALID_STRING_LENGTH(get(iter, name)); - ASSERT_VALID_STRING_LENGTH(get(iter, addr)); - - m_avatarSnoops[i] = new AvatarSnoopPair(name, addr); + delete m_avatarSnoops[i]; } - } + delete[] m_avatarSnoops; - if(m_roomSnoopListLength > 0) - { - m_roomSnoops = new ChatUnicodeString*[m_roomSnoopListLength]; - - for(unsigned j = 0; j < m_roomSnoopListLength; j++) + for (unsigned j = 0; j < m_roomSnoopListLength; j++) { - Plat_Unicode::String room; - ASSERT_VALID_STRING_LENGTH(get(iter, room)); + delete m_roomSnoops[j]; + } + delete[] m_roomSnoops; + } - m_roomSnoops[j] = new ChatUnicodeString(room); + void ResGetSnoopList::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + get(iter, m_avatarSnoopListLength); + get(iter, m_roomSnoopListLength); + + if (m_avatarSnoopListLength > 0) + { + m_avatarSnoops = new AvatarSnoopPair*[m_avatarSnoopListLength]; + + for (unsigned i = 0; i < m_avatarSnoopListLength; i++) + { + Plat_Unicode::String name; + Plat_Unicode::String addr; + ASSERT_VALID_STRING_LENGTH(get(iter, name)); + ASSERT_VALID_STRING_LENGTH(get(iter, addr)); + + m_avatarSnoops[i] = new AvatarSnoopPair(name, addr); + } + } + + if (m_roomSnoopListLength > 0) + { + m_roomSnoops = new ChatUnicodeString*[m_roomSnoopListLength]; + + for (unsigned j = 0; j < m_roomSnoopListLength; j++) + { + Plat_Unicode::String room; + ASSERT_VALID_STRING_LENGTH(get(iter, room)); + + m_roomSnoops[j] = new ChatUnicodeString(room); + } } } -} -ResTransferAvatar::ResTransferAvatar(void *user, unsigned userID, unsigned newUserID, const ChatUnicodeString &avatarName, const ChatUnicodeString &newAvatarName, const ChatUnicodeString &avatarAddress, const ChatUnicodeString &newAvatarAddress) -: GenericResponse(RESPONSE_TRANSFERAVATAR, CHATRESULT_TIMEOUT, user), - m_userID(userID), - m_newUserID(newUserID), - m_avatarName(avatarName.string_data, avatarName.string_length), - m_newAvatarName(newAvatarName.string_data, newAvatarName.string_length), - m_avatarAddress(avatarAddress.string_data, avatarAddress.string_length), - m_newAvatarAddress(newAvatarAddress.string_data, newAvatarAddress.string_length) -{ -} - -void ResTransferAvatar::unpack(ByteStream::ReadIterator &iter) -{ - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); -} - - -}; // end namespace + ResTransferAvatar::ResTransferAvatar(void *user, unsigned userID, unsigned newUserID, const ChatUnicodeString &avatarName, const ChatUnicodeString &newAvatarName, const ChatUnicodeString &avatarAddress, const ChatUnicodeString &newAvatarAddress) + : GenericResponse(RESPONSE_TRANSFERAVATAR, CHATRESULT_TIMEOUT, user), + m_userID(userID), + m_newUserID(newUserID), + m_avatarName(avatarName.string_data, avatarName.string_length), + m_newAvatarName(newAvatarName.string_data, newAvatarName.string_length), + m_avatarAddress(avatarAddress.string_data, avatarAddress.string_length), + m_newAvatarAddress(newAvatarAddress.string_data, newAvatarAddress.string_length) + { + } + void ResTransferAvatar::unpack(ByteStream::ReadIterator &iter) + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + } +}; // end namespace \ No newline at end of file diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/AutoLog.h b/external/3rd/library/soePlatform/ChatAPI/utils/Base/AutoLog.h index 18871c7f..0386b26e 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/AutoLog.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/AutoLog.h @@ -6,110 +6,109 @@ #include #ifdef EXTERNAL_DISTRO -namespace NAMESPACE +namespace NAMESPACE { - #endif -namespace Base -{ + namespace Base + { + class CAutoLog + { + public: + enum eLogLevel { + eLOG_NONE = 0, // log entries are discarded + eLOG_ERROR = 1, // log errors only + eLOG_ALERT = 2, // log alerts and errors only + eLOG_NORMAL = 3, // log all normal events, no debug + eLOG_DEBUG = 4 // log everything + }; - class CAutoLog - { - public: - enum eLogLevel { - eLOG_NONE = 0, // log entries are discarded - eLOG_ERROR = 1, // log errors only - eLOG_ALERT = 2, // log alerts and errors only - eLOG_NORMAL = 3, // log all normal events, no debug - eLOG_DEBUG = 4 // log everything - }; + // Global setting for all AutoLog instances for this application. Can be set on the fly. Default is eLOG_NORMAL. + void SetLogLevel(eLogLevel loglevel); - // Global setting for all AutoLog instances for this application. Can be set on the fly. Default is eLOG_NORMAL. - void SetLogLevel(eLogLevel loglevel); + // Global setting for all AutoLog instances for this application. Can be set on the fly. Default is eLOG_ERROR. + void SetPrintLevel(eLogLevel printlevel); - // Global setting for all AutoLog instances for this application. Can be set on the fly. Default is eLOG_ERROR. - void SetPrintLevel(eLogLevel printlevel); + // Global setting for all AutoLog instances for this application. Can be set on the fly. Default is eLOG_ERROR. + void SetFlushLevel(eLogLevel flushlevel); - // Global setting for all AutoLog instances for this application. Can be set on the fly. Default is eLOG_ERROR. - void SetFlushLevel(eLogLevel flushlevel); + // constructor, no file loaded + CAutoLog(); - // constructor, no file loaded - CAutoLog(); + // version of constructor that calls Open(file) + CAutoLog(const char * file); - // version of constructor that calls Open(file) - CAutoLog(const char * file); + // destructor, will close file if opened + ~CAutoLog(); - // destructor, will close file if opened - ~CAutoLog(); + // Open log file. If a file is already open, function will fail. + // returns true if no error + bool Open(const char * file); - // Open log file. If a file is already open, function will fail. - // returns true if no error - bool Open(const char * file); + // Close log file if opened. + void Close(void); - // Close log file if opened. - void Close(void); + // Make an entry in the log. Format and variable arguments are identical to printf. + // severity will be compared to master log level to determine if the log entry will be made + // severity will be compared to master print level to determine if the log entry will be printed to stdout + void Log(eLogLevel severity, char * format, ...); - // Make an entry in the log. Format and variable arguments are identical to printf. - // severity will be compared to master log level to determine if the log entry will be made - // severity will be compared to master print level to determine if the log entry will be printed to stdout - void Log(eLogLevel severity, char * format, ...); + // Equivalent to the above with the approriate severity argument + void LogError(char * format, ...); + void LogAlert(char * format, ...); + void Log(char * format, ...); + void LogDebug(char * format, ...); - // Equivalent to the above with the approriate severity argument - void LogError(char * format, ...); - void LogAlert(char * format, ...); - void Log(char * format, ...); - void LogDebug(char * format, ...); + private: + FILE * pFile; // current log file opened + char * pFilename; // current log file opened + int nTodaysDayOfYear; // remember the current day to detect change of day + void Archive(void); // archives current log - private: - FILE * pFile; // current log file opened - char * pFilename; // current log file opened - int nTodaysDayOfYear; // remember the current day to detect change of day - void Archive(void); // archives current log + static eLogLevel nLogMask; // master severity level + static eLogLevel nPrintMask; // master severity level + static eLogLevel nFlushMask; // master severity level + }; - static eLogLevel nLogMask; // master severity level - static eLogLevel nPrintMask; // master severity level - static eLogLevel nFlushMask; // master severity level - }; + //------------------------------------- + inline void CAutoLog::SetLogLevel(eLogLevel loglevel) + { + nLogMask = loglevel; + } - //------------------------------------- - inline void CAutoLog::SetLogLevel(eLogLevel loglevel) - { - nLogMask = loglevel; - } + //------------------------------------- + inline void CAutoLog::SetPrintLevel(eLogLevel printlevel) + { + nPrintMask = printlevel; + } - //------------------------------------- - inline void CAutoLog::SetPrintLevel(eLogLevel printlevel) - { - nPrintMask = printlevel; - } + //------------------------------------- + inline void CAutoLog::SetFlushLevel(eLogLevel flushlevel) + { + nFlushMask = flushlevel; + } - //------------------------------------- - inline void CAutoLog::SetFlushLevel(eLogLevel flushlevel) - { - nFlushMask = flushlevel; - } + //------------------------------------- + inline CAutoLog::CAutoLog() + { + pFilename = nullptr; + pFile = (FILE *)-1; + nTodaysDayOfYear = 0; + } - //------------------------------------- - inline CAutoLog::CAutoLog() - { - pFilename = nullptr; - pFile = (FILE *)-1; - } + //------------------------------------- + inline CAutoLog::CAutoLog(const char * file) + { + pFilename = nullptr; + pFile = (FILE *)-1; + Open(file); + } - //------------------------------------- - inline CAutoLog::CAutoLog(const char * file) - { - pFilename = nullptr; - pFile = (FILE *)-1; - Open(file); - } - - //------------------------------------- - inline CAutoLog::~CAutoLog() - { - Close(); - } -}; + //------------------------------------- + inline CAutoLog::~CAutoLog() + { + Close(); + } + }; #ifdef EXTERNAL_DISTRO }; #endif diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericConnection.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericConnection.cpp index 3c878e0a..c7c6234c 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericConnection.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericConnection.cpp @@ -2,297 +2,286 @@ #include "GenericAPI/GenericConnection.h" #include "GenericAPI/GenericMessage.h" - using namespace UdpLibrary; #ifdef USE_SERIALIZE_LIB - #include +#include #endif - #ifdef EXTERNAL_DISTRO -namespace NAMESPACE +namespace NAMESPACE { - - #endif -namespace GenericAPI -{ + namespace GenericAPI + { + using namespace std; + using namespace Base; - -using namespace std; -using namespace Base; + unsigned GenericConnection::ms_crcBytes = 0; -unsigned GenericConnection::ms_crcBytes = 0; - -GenericConnection::GenericConnection(const char *host, short port, GenericAPICore *apiCore, unsigned reconnectTimeout, unsigned noDataTimeoutSecs, unsigned noAckTimeoutSecs, unsigned incomingBufSizeInKB, unsigned outgoingBufSizeInKB, unsigned keepAlive, unsigned maxRecvMessageSizeInKB, unsigned holdTime) -: m_bConnected(false), - m_apiCore(apiCore), - m_con(nullptr), - m_host(host), - m_nextHost(host), - m_port(port), - m_nextPort(port), - m_lastTrack(123455), //random choice != 1 - m_conState(CON_DISCONNECT), - m_reconnectTimeout(reconnectTimeout) -{ + GenericConnection::GenericConnection(const char *host, short port, GenericAPICore *apiCore, unsigned reconnectTimeout, unsigned noDataTimeoutSecs, unsigned noAckTimeoutSecs, unsigned incomingBufSizeInKB, unsigned outgoingBufSizeInKB, unsigned keepAlive, unsigned maxRecvMessageSizeInKB, unsigned holdTime) + : m_bConnected(false), + m_apiCore(apiCore), + m_con(nullptr), + m_host(host), + m_nextHost(host), + m_port(port), + m_nextPort(port), + m_lastTrack(123455), //random choice != 1 + m_conState(CON_DISCONNECT), + m_reconnectTimeout(reconnectTimeout), + m_conTimeout(100) + { #ifdef USE_TCP_LIBRARY - TcpManager::TcpParams params; - - params.incomingBufferSize = incomingBufSizeInKB * 1024; - params.outgoingBufferSize = outgoingBufSizeInKB * 1024; - params.maxConnections = 1; - params.port = 0; - params.maxRecvMessageSize = maxRecvMessageSizeInKB*1024; - params.keepAliveDelay = keepAlive * 1000; - params.noDataTimeout = noDataTimeoutSecs * 1000; - //params.oldestUnacknowledgedTimeout = noAckTimeoutSecs * 1000; - - m_manager = new TcpManager(params); -#else //default to UDP_LIBRARY - UdpManager::Params params; + TcpManager::TcpParams params; - params.keepAliveDelay = keepAlive * 1000; - params.maxDataHoldTime = holdTime; - params.incomingBufferSize = incomingBufSizeInKB * 1024; - params.outgoingBufferSize = outgoingBufSizeInKB * 1024; - params.maxConnections = 1; - params.port = 0; - params.noDataTimeout = noDataTimeoutSecs * 1000; - params.oldestUnacknowledgedTimeout = noAckTimeoutSecs * 1000; - params.crcBytes = ms_crcBytes; - - m_manager = new UdpManager(¶ms); + params.incomingBufferSize = incomingBufSizeInKB * 1024; + params.outgoingBufferSize = outgoingBufSizeInKB * 1024; + params.maxConnections = 1; + params.port = 0; + params.maxRecvMessageSize = maxRecvMessageSizeInKB * 1024; + params.keepAliveDelay = keepAlive * 1000; + params.noDataTimeout = noDataTimeoutSecs * 1000; + //params.oldestUnacknowledgedTimeout = noAckTimeoutSecs * 1000; + + m_manager = new TcpManager(params); +#else //default to UDP_LIBRARY + UdpManager::Params params; + + params.keepAliveDelay = keepAlive * 1000; + params.maxDataHoldTime = holdTime; + params.incomingBufferSize = incomingBufSizeInKB * 1024; + params.outgoingBufferSize = outgoingBufSizeInKB * 1024; + params.maxConnections = 1; + params.port = 0; + params.noDataTimeout = noDataTimeoutSecs * 1000; + params.oldestUnacknowledgedTimeout = noAckTimeoutSecs * 1000; + params.crcBytes = ms_crcBytes; + + m_manager = new UdpManager(¶ms); #endif //USE_TCP_LIBRARY - -} - -GenericConnection::~GenericConnection() -{ - if(m_con) - { - m_con->SetHandler(nullptr); - m_con->Disconnect();//don't worry about onterminated being called, we've set it's handler to nullptr, so it wont - m_con->Release(); - } - - m_manager->Release(); -} - -void GenericConnection::changeHostPort(const char *host, short port) -{ - if (host && - strcmp(host, "") != 0) - { - m_nextHost = host; - m_nextPort = port; - } -} - -void GenericConnection::disconnect() -{ - if (m_con) - { - m_con->Disconnect(); - //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); - m_con = nullptr; - } - m_conState = CON_DISCONNECT; - m_bConnected = false; -} - -#ifdef USE_TCP_LIBRARY -void GenericConnection::OnTerminated(TcpConnection *con) -#else //default to UDP_LIBRARY -void GenericConnection::OnTerminated(UdpConnection *con) -#endif -{ - m_apiCore->OnDisconnect(m_host.c_str(), m_port); - if(m_con) - { - m_con->Release(); - m_con = nullptr; - } - m_conState = CON_DISCONNECT; - m_bConnected = false; -} - -#ifdef USE_TCP_LIBRARY -void GenericConnection::OnRoutePacket(TcpConnection *con, const unsigned char *data, int dataLen) -#else //default to UDP_LIBRARY -void GenericConnection::OnRoutePacket(UdpConnection *con, const unsigned char *data, int dataLen) -#endif -{ - short type; - unsigned track; - - -#ifdef USE_SERIALIZE_LIB - unsigned bytes = 0; - unsigned fieldLen = soe::Read(data, dataLen, type); - if (fieldLen == 0) - return;//invalid message - bytes += fieldLen; - - fieldLen = soe::Read(data+bytes, dataLen-bytes, track); - if (fieldLen == 0) - return;//invalid message - bytes += fieldLen; -#else - ByteStream msg(data, dataLen); - ByteStream::ReadIterator iter = msg.begin(); - - get(iter, type); - get(iter, track); -#endif - GenericResponse *res = nullptr; - - // the following if block is a temporary fix that prevents - // a crash with a game team in which they occasionally find - // themselves receiving a dupe track in consecutive calls to - // OnRoutePacket (which then leads to a callback being called - // twice and data being invalid on the second call -> crash!). - if (track != 0 && - track == m_lastTrack) - { - printf("!!! ERROR !!! Got a duplicate track ID %u\n", track); - return; - } - m_lastTrack = track; - - // end temporary fix. - - if(track == 0) - { -#ifdef USE_SERIALIZE_LIB - m_apiCore->responseCallback(type, data+bytes, dataLen-bytes); -#else - m_apiCore->responseCallback(type, iter); -#endif - } - else - { - map::iterator mapIter = m_apiCore->m_pending.find(track); - - if(mapIter != m_apiCore->m_pending.end()) - { - res = (*mapIter).second; -#ifdef USE_SERIALIZE_LIB - res->unpack(data, dataLen); -#else - iter = msg.begin(); - res->unpack(iter); -#endif - m_apiCore->m_pending.erase(mapIter); - m_apiCore->m_pendingCount--; - m_apiCore->responseCallback(res); - delete res; } - } -} -void GenericConnection::process(bool giveTime) -{ - switch(m_conState) - { - case CON_DISCONNECT: - // if host/port was changed, it takes effect here - m_host = m_nextHost; - m_port = m_nextPort; - - // create connection object, attempting to connect and - // checking for connection in next state, CON_NEGOTIATE - m_con = m_manager->EstablishConnection(m_host.c_str(), m_port); - if(m_con) + GenericConnection::~GenericConnection() { - m_con->SetHandler(this); - m_conState = CON_NEGOTIATE; - m_conTimeout = time(nullptr) + m_reconnectTimeout; - } - break; - case CON_NEGOTIATE: - // check for connection + if (m_con) + { + m_con->SetHandler(nullptr); + m_con->Disconnect();//don't worry about onterminated being called, we've set it's handler to nullptr, so it wont + m_con->Release(); + } -#ifdef USE_TCP_LIBRARY - if(m_con->GetStatus() == TcpConnection::StatusConnected) -#else //default to UDP_LIBRARY - if(m_con->GetStatus() == UdpConnection::cStatusConnected) -#endif - { - // we're connected - m_conState = CON_CONNECT; - m_apiCore->OnConnect(m_host.c_str(), m_port); - m_bConnected = true; + m_manager->Release(); } - else if(time(nullptr) > m_conTimeout) + + void GenericConnection::changeHostPort(const char *host, short port) { - // we did not connect - m_con->Disconnect(); - //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); - m_con = nullptr; + if (host && + strcmp(host, "") != 0) + { + m_nextHost = host; + m_nextPort = port; + } + } + + void GenericConnection::disconnect() + { + if (m_con) + { + m_con->Disconnect(); + //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); + m_con = nullptr; + } m_conState = CON_DISCONNECT; - m_bConnected = false; + m_bConnected = false; } - break; - case CON_CONNECT: - // do nothing - break; - default: - // this should not occur, but we revert to CON_DISCONNECT if it does - m_conState = CON_DISCONNECT; - m_bConnected = false; - if (m_con) - { - m_con->Disconnect(); - //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); - m_con = nullptr; - } - } - if (giveTime) - { - m_manager->GiveTime(); - } - -} +#ifdef USE_TCP_LIBRARY + void GenericConnection::OnTerminated(TcpConnection *con) +#else //default to UDP_LIBRARY + void GenericConnection::OnTerminated(UdpConnection *con) +#endif + { + m_apiCore->OnDisconnect(m_host.c_str(), m_port); + if (m_con) + { + m_con->Release(); + m_con = nullptr; + } + m_conState = CON_DISCONNECT; + m_bConnected = false; + } + +#ifdef USE_TCP_LIBRARY + void GenericConnection::OnRoutePacket(TcpConnection *con, const unsigned char *data, int dataLen) +#else //default to UDP_LIBRARY + void GenericConnection::OnRoutePacket(UdpConnection *con, const unsigned char *data, int dataLen) +#endif + { + short type; + unsigned track; #ifdef USE_SERIALIZE_LIB - void GenericConnection::Send(const unsigned char *data, int dataLen) - { - #ifdef USE_TCP_LIBRARY - if(m_con && m_con->GetStatus() == TcpConnection::StatusConnected) - { - m_con->Send((const char *)data, dataLen); - } - #else//USE_TCP_LIBRARY - if(m_con && m_con->GetStatus() == UdpConnection::cStatusConnected) - { - m_con->Send(cUdpChannelReliable1, data, dataLen); - } - #endif//USE_TCP_LIBRARY - } + unsigned bytes = 0; + unsigned fieldLen = soe::Read(data, dataLen, type); + if (fieldLen == 0) + return;//invalid message + bytes += fieldLen; + + fieldLen = soe::Read(data + bytes, dataLen - bytes, track); + if (fieldLen == 0) + return;//invalid message + bytes += fieldLen; +#else + ByteStream msg(data, dataLen); + ByteStream::ReadIterator iter = msg.begin(); + + get(iter, type); + get(iter, track); +#endif + GenericResponse *res = nullptr; + + // the following if block is a temporary fix that prevents + // a crash with a game team in which they occasionally find + // themselves receiving a dupe track in consecutive calls to + // OnRoutePacket (which then leads to a callback being called + // twice and data being invalid on the second call -> crash!). + if (track != 0 && + track == m_lastTrack) + { + printf("!!! ERROR !!! Got a duplicate track ID %u\n", track); + return; + } + m_lastTrack = track; + + // end temporary fix. + + if (track == 0) + { +#ifdef USE_SERIALIZE_LIB + m_apiCore->responseCallback(type, data + bytes, dataLen - bytes); +#else + m_apiCore->responseCallback(type, iter); +#endif + } + else + { + map::iterator mapIter = m_apiCore->m_pending.find(track); + + if (mapIter != m_apiCore->m_pending.end()) + { + res = (*mapIter).second; +#ifdef USE_SERIALIZE_LIB + res->unpack(data, dataLen); +#else + iter = msg.begin(); + res->unpack(iter); +#endif + m_apiCore->m_pending.erase(mapIter); + m_apiCore->m_pendingCount--; + m_apiCore->responseCallback(res); + delete res; + } + } + } + + void GenericConnection::process(bool giveTime) + { + switch (m_conState) + { + case CON_DISCONNECT: + // if host/port was changed, it takes effect here + m_host = m_nextHost; + m_port = m_nextPort; + + // create connection object, attempting to connect and + // checking for connection in next state, CON_NEGOTIATE + m_con = m_manager->EstablishConnection(m_host.c_str(), m_port); + if (m_con) + { + m_con->SetHandler(this); + m_conState = CON_NEGOTIATE; + m_conTimeout = time(nullptr) + m_reconnectTimeout; + } + break; + case CON_NEGOTIATE: + // check for connection + +#ifdef USE_TCP_LIBRARY + if (m_con->GetStatus() == TcpConnection::StatusConnected) +#else //default to UDP_LIBRARY + if (m_con->GetStatus() == UdpConnection::cStatusConnected) +#endif + { + // we're connected + m_conState = CON_CONNECT; + m_apiCore->OnConnect(m_host.c_str(), m_port); + m_bConnected = true; + } + else if (time(nullptr) > m_conTimeout) + { + // we did not connect + m_con->Disconnect(); + //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); + m_con = nullptr; + m_conState = CON_DISCONNECT; + m_bConnected = false; + } + break; + case CON_CONNECT: + // do nothing + break; + default: + // this should not occur, but we revert to CON_DISCONNECT if it does + m_conState = CON_DISCONNECT; + m_bConnected = false; + if (m_con) + { + m_con->Disconnect(); + //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); + m_con = nullptr; + } + } + + if (giveTime) + { + m_manager->GiveTime(); + } + } + +#ifdef USE_SERIALIZE_LIB + void GenericConnection::Send(const unsigned char *data, int dataLen) + { +#ifdef USE_TCP_LIBRARY + if (m_con && m_con->GetStatus() == TcpConnection::StatusConnected) + { + m_con->Send((const char *)data, dataLen); + } +#else//USE_TCP_LIBRARY + if (m_con && m_con->GetStatus() == UdpConnection::cStatusConnected) + { + m_con->Send(cUdpChannelReliable1, data, dataLen); + } +#endif//USE_TCP_LIBRARY + } #else //USE_SERIALIZE_LIB - void GenericConnection::Send(Base::ByteStream &msg) - { - #ifdef USE_TCP_LIBRARY - if(m_con && m_con->GetStatus() == TcpConnection::StatusConnected) - { - m_con->Send((const char *)msg.getBuffer(), msg.getSize()); - } - #else //USE_TCP_LIBRARY - if(m_con && m_con->GetStatus() == UdpConnection::cStatusConnected) - { - m_con->Send(cUdpChannelReliable1, msg.getBuffer(), msg.getSize()); - } - #endif//USE_TCP_LIBRARY - } + void GenericConnection::Send(Base::ByteStream &msg) + { +#ifdef USE_TCP_LIBRARY + if (m_con && m_con->GetStatus() == TcpConnection::StatusConnected) + { + m_con->Send((const char *)msg.getBuffer(), msg.getSize()); + } +#else //USE_TCP_LIBRARY + if (m_con && m_con->GetStatus() == UdpConnection::cStatusConnected) + { + m_con->Send(cUdpChannelReliable1, msg.getBuffer(), msg.getSize()); + } +#endif//USE_TCP_LIBRARY + } #endif //USE_SERIALIZE_LIB - - - -}; + }; #ifdef EXTERNAL_DISTRO }; -#endif +#endif \ No newline at end of file diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericMessage.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericMessage.cpp index 05d08328..8ee9459f 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericMessage.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericMessage.cpp @@ -1,32 +1,31 @@ #include "GenericMessage.h" #ifdef EXTERNAL_DISTRO -namespace NAMESPACE +namespace NAMESPACE { - #endif -namespace GenericAPI -{ + namespace GenericAPI + { + GenericMessage::GenericMessage(short type) + : m_type(type) + { + } -GenericMessage::GenericMessage(short type) -: m_type(type) -{ -} + GenericRequest::GenericRequest(short type) + : GenericMessage(type) + { + } -GenericRequest::GenericRequest(short type) -: GenericMessage(type) -{ -} - -GenericResponse::GenericResponse(short type, unsigned result, void *user) -: GenericMessage(type), - m_result(result), - m_user(user) -{ -} - -}; + GenericResponse::GenericResponse(short type, unsigned result, void *user) + : GenericMessage(type), + m_result(result), + m_user(user), + m_track(0), + m_timeout(100) + { + } + }; #ifdef EXTERNAL_DISTRO }; -#endif +#endif \ No newline at end of file diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/UnicodeUtils.h b/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/UnicodeUtils.h index d6528a19..c00c3f2f 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/UnicodeUtils.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/UnicodeUtils.h @@ -24,360 +24,314 @@ //----------------------------------------------------------------- #ifdef EXTERNAL_DISTRO -namespace NAMESPACE +namespace NAMESPACE { #endif -namespace Plat_Unicode -{ - - String narrowToWide (const NarrowString & nstr); - String & narrowToWide (const NarrowString & nstr, String & str); //lint !e1929 // function returning a reference - - NarrowString wideToNarrow (const String & nstr); - NarrowString & wideToNarrow (const String & nstr, NarrowString & str); //lint !e1929 // function returning a reference - NarrowString toLower (const NarrowString & nstr); - NarrowString toUpper (const NarrowString & nstr); - String toLower (const String & nstr); - String toUpper (const String & nstr); - - const String getTrim (const String & str, const unicode_char_t * white = whitespace); - String & trim (String & str, const unicode_char_t * white = whitespace); - - bool getFirstToken (const String & str, size_t pos, size_t & endpos, String & token, const unicode_char_t * sepChars = whitespace); - bool getNthToken (const String & str, const size_t n, size_t & pos, size_t & endpos, String & token, const unicode_char_t * sepChars = whitespace); - size_t skipWhitespace (const String & str, size_t pos, const unicode_char_t * white = whitespace); - - const NarrowString getTrim (const NarrowString & str, const char * white = ascii_whitespace); - NarrowString & trim (NarrowString & str, const char * white = ascii_whitespace); - - bool getFirstToken (const NarrowString & str, size_t pos, size_t & endpos, NarrowString & token, const char * sepChars = ascii_whitespace); - bool getNthToken (const NarrowString & str, const size_t n, size_t & pos, size_t & endpos, NarrowString & token, const char * sepChars = ascii_whitespace); - size_t skipWhitespace (const NarrowString & str, size_t pos, const char * white = ascii_whitespace); - - enum FieldAlignment + namespace Plat_Unicode { - FA_LEFT, - FA_RIGHT, - FA_CENTER - }; + String narrowToWide(const NarrowString & nstr); + String & narrowToWide(const NarrowString & nstr, String & str); //lint !e1929 // function returning a reference - String & appendStringField (String & dst, const String & src, size_t width, FieldAlignment fa = FA_LEFT, unicode_char_t pad = ' ', bool truncate = false); - String & appendStringField (String & dst, const NarrowString & src, size_t width, FieldAlignment fa = FA_LEFT, unicode_char_t pad = ' ', bool truncate = false); -// ====================================================================== + NarrowString wideToNarrow(const String & nstr); + NarrowString & wideToNarrow(const String & nstr, NarrowString & str); //lint !e1929 // function returning a reference + NarrowString toLower(const NarrowString & nstr); + NarrowString toUpper(const NarrowString & nstr); + String toLower(const String & nstr); + String toUpper(const String & nstr); - //----------------------------------------------------------------- - /** - * Hacky code to correctly handle Cyrillic. - */ + const String getTrim(const String & str, const unicode_char_t * white = whitespace); + String & trim(String & str, const unicode_char_t * white = whitespace); - inline unicode_char_t trueUpper(unicode_char_t letter) - { - if ((cyrillic_lower_first <= letter) && (letter <= cyrillic_lower_last)) { - return letter + (cyrillic_upper_first - cyrillic_lower_first); - } else { - return static_cast(toupper(letter)); - } - } + bool getFirstToken(const String & str, size_t pos, size_t & endpos, String & token, const unicode_char_t * sepChars = whitespace); + bool getNthToken(const String & str, const size_t n, size_t & pos, size_t & endpos, String & token, const unicode_char_t * sepChars = whitespace); + size_t skipWhitespace(const String & str, size_t pos, const unicode_char_t * white = whitespace); - inline unicode_char_t trueLower(unicode_char_t letter) - { - if ((cyrillic_upper_first <= letter) && (letter <= cyrillic_upper_last)) { - return letter - (cyrillic_upper_first - cyrillic_lower_first); - } else { - return static_cast(tolower(letter)); - } - } - - /** - * Compare substrings of str2 and str1, each starting with pos and containing n characters - */ + const NarrowString getTrim(const NarrowString & str, const char * white = ascii_whitespace); + NarrowString & trim(NarrowString & str, const char * white = ascii_whitespace); + bool getFirstToken(const NarrowString & str, size_t pos, size_t & endpos, NarrowString & token, const char * sepChars = ascii_whitespace); + bool getNthToken(const NarrowString & str, const size_t n, size_t & pos, size_t & endpos, NarrowString & token, const char * sepChars = ascii_whitespace); + size_t skipWhitespace(const NarrowString & str, size_t pos, const char * white = ascii_whitespace); - /** - * Compares str1 and str2, where str1 is a String and str2 is templated, - * thus could be a std::string as well. Set reverseCompare to true if you - * want to begin comparison at end of string--a useful optimization if your - * strings tend to differ at the end. - */ - template bool caseInsensitiveCompare (const String & str1, const T & str2, bool reverseCompare = false) - { - const size_t len1 = str1.size(); - const size_t len2 = str2.size(); - - if (len1 != len2) + enum FieldAlignment { - return false; - } + FA_LEFT, + FA_RIGHT, + FA_CENTER + }; - if (!reverseCompare) + String & appendStringField(String & dst, const String & src, size_t width, FieldAlignment fa = FA_LEFT, unicode_char_t pad = ' ', bool truncate = false); + String & appendStringField(String & dst, const NarrowString & src, size_t width, FieldAlignment fa = FA_LEFT, unicode_char_t pad = ' ', bool truncate = false); + // ====================================================================== + + //----------------------------------------------------------------- + /** + * Hacky code to correctly handle Cyrillic. + */ + + inline unicode_char_t trueUpper(unicode_char_t letter) { - for (size_t i = 0; i < len1; i++) - { - if ( trueLower(str1[i]) != trueLower(str2[i]) ) - return false; + if ((cyrillic_lower_first <= letter) && (letter <= cyrillic_lower_last)) { + return letter + (cyrillic_upper_first - cyrillic_lower_first); } - } - else - { - for (size_t i = len1; i > 0; i--) - { - if ( trueLower(str1[i-1]) != trueLower(str2[i-1]) ) - return false; + else { + return static_cast(toupper(letter)); } } - return true; - } - - /** - * Compares str1 and str2, where str1 is a String and str2 is templated, - * thus could be a std::string as well. Unlike caseInsensitiveCompare, this - * version returns an int for < or > comparisons, and comparison must start - * at the front. Note that this kind of comparison does not allow the shortcut - * of first comparing sizes--every character must be compared up to the last one. - */ - template int caseInsensitiveCompareInt (const String & str1, const T & str2) - { - const size_t len1 = str1.size(); - const size_t len2 = str2.size(); - - size_t len; - if (len1 < len2) - len = len1; - else - len = len2; - - // iterate over smallest length - for (size_t i = 0; i < len; i++) + inline unicode_char_t trueLower(unicode_char_t letter) { - if ( trueLower(str1[i]) < trueLower(str2[i]) ) + if ((cyrillic_upper_first <= letter) && (letter <= cyrillic_upper_last)) { + return letter - (cyrillic_upper_first - cyrillic_lower_first); + } + else { + return static_cast(tolower(letter)); + } + } + + /** + * Compare substrings of str2 and str1, each starting with pos and containing n characters + */ + + /** + * Compares str1 and str2, where str1 is a String and str2 is templated, + * thus could be a std::string as well. Set reverseCompare to true if you + * want to begin comparison at end of string--a useful optimization if your + * strings tend to differ at the end. + */ + template bool caseInsensitiveCompare(const String & str1, const T & str2, bool reverseCompare = false) + { + const size_t len1 = str1.size(); + const size_t len2 = str2.size(); + + if (len1 != len2) + { + return false; + } + + if (!reverseCompare) + { + for (size_t i = 0; i < len1; i++) + { + if (trueLower(str1[i]) != trueLower(str2[i])) + return false; + } + } + else + { + for (size_t i = len1; i > 0; i--) + { + if (trueLower(str1[i - 1]) != trueLower(str2[i - 1])) + return false; + } + } + + return true; + } + + /** + * Compares str1 and str2, where str1 is a String and str2 is templated, + * thus could be a std::string as well. Unlike caseInsensitiveCompare, this + * version returns an int for < or > comparisons, and comparison must start + * at the front. Note that this kind of comparison does not allow the shortcut + * of first comparing sizes--every character must be compared up to the last one. + */ + template int caseInsensitiveCompareInt(const String & str1, const T & str2) + { + const size_t len1 = str1.size(); + const size_t len2 = str2.size(); + + size_t len; + if (len1 < len2) + len = len1; + else + len = len2; + + // iterate over smallest length + for (size_t i = 0; i < len; i++) + { + if (trueLower(str1[i]) < trueLower(str2[i])) + return -1; + else if (trueLower(str1[i]) > trueLower(str2[i])) + return 1; + } + + // Equal so far, thus: if len1 < len2, the result is less-than, else + // if len1 = len2, the result is equal, else the result is greater-than. + + if (len1 < len2) return -1; - else if ( trueLower(str1[i]) > trueLower(str2[i]) ) + else if (len1 == len2) + return 0; + else return 1; } - // Equal so far, thus: if len1 < len2, the result is less-than, else - // if len1 = len2, the result is equal, else the result is greater-than. + /** + * Optimized implementation of isWhitespace. Must be kept in line with ::whitespace array + */ - if (len1 < len2) - return -1; - else if (len1 == len2) - return 0; - else - return 1; - } + template bool isWhitespace(T c) + { + return c == ' ' || c == '\n' || c == '\r' || c == '\t'; + } - - /** - * Optimized implementation of isWhitespace. Must be kept in line with ::whitespace array - */ - - template bool isWhitespace (T c) - { - return c == ' ' || c == '\n' || c == '\r' || c == '\t'; - } - - /* - * @todo: uncomment when caseInsensitiveCompare matures - * - template class CompareNoCasePredicate - { - public: - bool operator()( T & a, T & b ) const - { - return caseInsensitiveCompare (a, b) < 0; + template class CompareNoCasePredicate + { + public: + bool operator()(T & a, T & b) const + { + return caseInsensitiveCompare(a, b) < 0; + }; }; + + template class EqualsNoCasePredicate + { + public: + bool operator()(T & a, T & b) const + { + return caseInsensitiveCompare(a, b) == 0; + }; + }; + + //----------------------------------------------------------------- + //-- implementation + //----------------------------------------------------------------- + + //----------------------------------------------------------------- + /** + * Utility to convert a string and obtain the result by value + */ + + inline String narrowToWide(const NarrowString & nstr) + { + return String(nstr.begin(), nstr.end()); // STL original + } + + //----------------------------------------------------------------- + /** + * Utility to convert a string and obtain the result by reference + */ + + inline String & narrowToWide(const NarrowString & nstr, String & str) + { + return str.assign(nstr.begin(), nstr.end()); // STL original + } + + //----------------------------------------------------------------- + /** + + * Utility to convert a string and obtain the result by value + + * This should only be used when the Unicode string is known to contain only 8 bit assignable values + + */ + + inline NarrowString wideToNarrow(const String & str) + { + return NarrowString(str.begin(), str.end()); // STL original + } + + //----------------------------------------------------------------- + /** + + * Utility to convert a string and obtain the result by reference + + * This should only be used when the Unicode string is known to contain only 8 bit assignable values + + */ + + inline NarrowString & wideToNarrow(const String & str, NarrowString & nstr) + { + return nstr.assign(str.begin(), str.end()); // STL original + } + + /** + * Get the trimmed version of str by value. + */ + + inline const String getTrim(const String & str, const unicode_char_t * white) + { + const size_t first_nonspace = str.find_first_not_of(white); + const size_t last_nonspace = str.find_last_not_of(white); + return (first_nonspace == str.npos ? str : str.substr(first_nonspace, last_nonspace == str.npos ? last_nonspace : (last_nonspace - first_nonspace + 1))); + } + + //----------------------------------------------------------------- + /** + * Trim the specified string and return a reference to it. + */ + + inline String & trim(String & str, const unicode_char_t * white) + { + return (str = getTrim(str, white)); + } + + /** + * Get the trimmed version of str by value. + */ + + inline const NarrowString getTrim(const NarrowString & str, const char * white) + { + const size_t first_nonspace = str.find_first_not_of(white); + const size_t last_nonspace = str.find_last_not_of(white); + return (first_nonspace == str.npos ? str : str.substr(first_nonspace, last_nonspace == str.npos ? last_nonspace : (last_nonspace - first_nonspace + 1))); + } + + //----------------------------------------------------------------- + /** + * Trim the specified string and return a reference to it. + */ + inline NarrowString & trim(NarrowString & str, const char * white) + { + return (str = getTrim(str, white)); + } + /** + * Return the first non-white position starting with pos. returns str.npos if there is no non-white characer after pos + */ + inline size_t skipWhitespace(const String & str, size_t pos, const unicode_char_t * white) + { + return str.find_first_not_of(white, pos); + } + + //----------------------------------------------------------------- + /** + * Return the first non-white position starting with pos. returns str.npos if there is no non-white characer after pos + */ + + inline size_t skipWhitespace(const NarrowString & str, size_t pos, const char * white) + { + return str.find_first_not_of(white, pos); + } + + //----------------------------------------------------------------- + /** + * Append src to dst, padding the field as needed, and truncating the field if desired. + */ + + inline String & appendStringField(String & dst, const NarrowString & src, size_t width, FieldAlignment fa, unicode_char_t pad, bool truncate) + { + return appendStringField(dst, narrowToWide(src), width, fa, pad, truncate); + } + + // ====================================================================== }; - template class EqualsNoCasePredicate + // ====================================================================== + // Extensions to Base/Archive for String + // ====================================================================== + //class Base::ByteStream; + //----------------------------------------------------------------------- + namespace Base { - public: - bool operator()( T & a, T & b ) const - { - return caseInsensitiveCompare (a, b) == 0; - }; + extern unsigned get(ByteStream::ReadIterator & source, Plat_Unicode::String & target); + extern void put(ByteStream & target, const Plat_Unicode::String & source); + + //--------------------------------------------------------------------- + + // namespace Base }; - */ - -//----------------------------------------------------------------- -//-- implementation -//----------------------------------------------------------------- - - //----------------------------------------------------------------- - /** - * Utility to convert a string and obtain the result by value - */ - - inline String narrowToWide (const NarrowString & nstr) - { -// return String (nstr.begin (), nstr.end ()); // STLPort original - String s; - unsigned index = 0; - s.resize(nstr.size()); - const NarrowString::const_iterator end = nstr.end(); - for (NarrowString::const_iterator iter = nstr.begin(); iter != end; ++iter) - { - // Cast to unsigned char so that we don't pick up a negative value - // for the unsigned short - s[index++] = (unsigned char)*iter; - } - return s; - } - - //----------------------------------------------------------------- - /** - * Utility to convert a string and obtain the result by reference - */ - - inline String & narrowToWide (const NarrowString & nstr, String & str) - { -// return str.assign (nstr.begin (), nstr.end ()); // STLport original - unsigned index = 0; - str.resize(nstr.size()); - const NarrowString::const_iterator end = nstr.end(); - for (NarrowString::const_iterator iter = nstr.begin(); iter != end; ++iter) - { - str[index++] = *iter; - } - return str; - } - - //----------------------------------------------------------------- - /** - - * Utility to convert a string and obtain the result by value - - * This should only be used when the Unicode string is known to contain only 8 bit assignable values - - */ - - inline NarrowString wideToNarrow (const String & str) - { -// return NarrowString (str.begin (), str.end ()); // STLPort original - NarrowString s; - unsigned index = 0; - s.resize(str.size()); - const String::const_iterator end = str.end(); - for (String::const_iterator iter = str.begin(); iter != end; ++iter) - { - s[index++] = (char)*iter; - } - return s; - } - - //----------------------------------------------------------------- - /** - - * Utility to convert a string and obtain the result by reference - - * This should only be used when the Unicode string is known to contain only 8 bit assignable values - - */ - - inline NarrowString & wideToNarrow (const String & str, NarrowString & nstr) - { -// return nstr.assign (str.begin (), str.end ()); // STLPort original - unsigned index = 0; - nstr.resize(str.size()); - const String::const_iterator end = str.end(); - for (String::const_iterator iter = str.begin(); iter != end; ++iter) - { - nstr[index++] = (char)*iter; - } - return nstr; - } - - /** - * Get the trimmed version of str by value. - */ - - inline const String getTrim (const String & str, const unicode_char_t * white) - { - const size_t first_nonspace = str.find_first_not_of ( white ); - const size_t last_nonspace = str.find_last_not_of ( white ); - return (first_nonspace == str.npos ? str : str.substr (first_nonspace, last_nonspace == str.npos ? last_nonspace : (last_nonspace - first_nonspace + 1))); - } - - - - //----------------------------------------------------------------- - /** - * Trim the specified string and return a reference to it. - */ - - inline String & trim (String & str, const unicode_char_t * white) - { - return (str = getTrim (str, white)); - } - - /** - * Get the trimmed version of str by value. - */ - - inline const NarrowString getTrim (const NarrowString & str, const char * white) - { - const size_t first_nonspace = str.find_first_not_of ( white ); - const size_t last_nonspace = str.find_last_not_of ( white ); - return (first_nonspace == str.npos ? str : str.substr (first_nonspace, last_nonspace == str.npos ? last_nonspace : (last_nonspace - first_nonspace + 1))); - } - - //----------------------------------------------------------------- - /** - * Trim the specified string and return a reference to it. - */ - inline NarrowString & trim (NarrowString & str, const char * white) - { - return (str = getTrim (str, white)); - } - /** - * Return the first non-white position starting with pos. returns str.npos if there is no non-white characer after pos - */ - inline size_t skipWhitespace (const String & str, size_t pos, const unicode_char_t * white) - { - return str.find_first_not_of (white, pos); - } - - //----------------------------------------------------------------- - /** - * Return the first non-white position starting with pos. returns str.npos if there is no non-white characer after pos - */ - - inline size_t skipWhitespace (const NarrowString & str, size_t pos, const char * white) - { - return str.find_first_not_of (white, pos); - } - - - - //----------------------------------------------------------------- - /** - * Append src to dst, padding the field as needed, and truncating the field if desired. - */ - - inline String & appendStringField (String & dst, const NarrowString & src, size_t width, FieldAlignment fa, unicode_char_t pad, bool truncate) - { - return appendStringField (dst, narrowToWide (src), width, fa, pad, truncate); - } - -// ====================================================================== -}; - -// ====================================================================== -// Extensions to Base/Archive for String -// ====================================================================== -//class Base::ByteStream; -//----------------------------------------------------------------------- -namespace Base -{ -extern unsigned get(ByteStream::ReadIterator & source, Plat_Unicode::String & target); -extern void put(ByteStream & target, const Plat_Unicode::String & source); - -//--------------------------------------------------------------------- - - // namespace Base - -}; #ifdef EXTERNAL_DISTRO }; #endif From 5084c72fbe2822f53f89593494512e48c1fd2ea8 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Mon, 25 Jul 2016 01:46:39 +0000 Subject: [PATCH 157/302] fix a few discrepancies --- .../library/sharedUtility/src/shared/TemplateParameter.h | 2 +- .../soePlatform/ChatAPI/projects/ChatAPI/ChatAPICore.cpp | 6 +++--- .../soePlatform/ChatAPI/projects/ChatAPI/Response.cpp | 5 ++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/engine/shared/library/sharedUtility/src/shared/TemplateParameter.h b/engine/shared/library/sharedUtility/src/shared/TemplateParameter.h index c4b1cc1a..03d82ff0 100755 --- a/engine/shared/library/sharedUtility/src/shared/TemplateParameter.h +++ b/engine/shared/library/sharedUtility/src/shared/TemplateParameter.h @@ -133,7 +133,7 @@ template inline TemplateBase::TemplateBase(void) : m_dataType(NONE), m_loaded(false), - m_data(nullptr) + m_data() { } // TemplateBase::TemplateBase(void) diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPICore.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPICore.cpp index 797c4aba..06bea775 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPICore.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPICore.cpp @@ -2115,12 +2115,12 @@ namespace ChatSystem ChatAvatar *destAvatar = M.getDestAvatar()->getNewChatAvatar(); ChatAvatar *srcAvatar = M.getSrcAvatar()->getNewChatAvatar(); - if (destRoomCore && !destRoomCore->addBan(M.getDestAvatar())) + if (destRoomCore && (!destRoomCore->addBan(M.getDestAvatar()))) { delete M.getSrcAvatar(); } - if (destRoomCore && !destRoomCore || !destRoom) + if (destRoomCore && (!destRoomCore || !destRoom)) { _chatdebug_("ChatAPI:BadData: MESSAGE_ADDBANAVATAR: destRoom=%p, destRoomCore=%p\n", destRoom, destRoomCore); delete srcAvatar; @@ -3357,4 +3357,4 @@ namespace ChatSystem return returnVal; } -}; \ No newline at end of file +}; diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Response.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Response.cpp index c6b4a23e..ad089499 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Response.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Response.cpp @@ -1162,8 +1162,7 @@ namespace ChatSystem m_srcAvatarID(srcAvatarID), m_listLength(0), m_headers(nullptr), - m_cores(nullptr), - m_listLength(0) + m_cores(nullptr) { } @@ -1610,4 +1609,4 @@ namespace ChatSystem get(iter, m_track); get(iter, m_result); } -}; // end namespace \ No newline at end of file +}; // end namespace From e65b05ada93f086900fba9554073f1f14f4afa6b Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sun, 24 Jul 2016 21:25:03 -0700 Subject: [PATCH 158/302] mostly template initializations to prevent undefined behavior in the (unlikely) chance some of these properties are used --- .../LogServer/src/shared/LoggingServerApi.cpp | 146 +- .../src/shared/LoggingServerApiObserver.cpp | 25 +- .../src/shared/CSToolConnection.cpp | 246 +- .../LoginServer/src/shared/LoginServer.cpp | 506 ++-- .../src/shared/TaskEnableCharacter.cpp | 59 +- .../src/shared/TaskGetAccountForPurge.cpp | 20 +- .../src/shared/TaskGetValidationData.cpp | 167 +- .../src/shared/PlanetProxyObject.cpp | 229 +- .../DeleteCharacterCustomPersistStep.cpp | 27 +- .../src/shared/TaskCheckCharacterName.cpp | 17 +- .../src/shared/command/CommandCppFuncs.cpp | 1732 ++++++------- .../src/shared/command/CommandQueueEntry.cpp | 70 +- .../shared/controller/AiShipController.cpp | 160 +- .../src/shared/controller/CellController.cpp | 63 +- .../src/shared/controller/CellController.h | 9 +- .../shared/controller/CreatureController.cpp | 2292 ++++++++--------- .../src/shared/core/ServerBuildoutManager.cpp | 384 ++- .../src/shared/object/LineOfSightCache.cpp | 7 +- .../objectTemplate/ServerArmorTemplate.cpp | 93 +- .../ServerBattlefieldMarkerObjectTemplate.cpp | 24 +- .../ServerBuildingObjectTemplate.cpp | 33 +- .../ServerCellObjectTemplate.cpp | 28 +- .../ServerCityObjectTemplate.cpp | 24 +- ...rverConstructionContractObjectTemplate.cpp | 24 +- .../ServerCreatureObjectTemplate.cpp | 101 +- .../ServerDraftSchematicObjectTemplate.cpp | 150 +- .../ServerFactoryObjectTemplate.cpp | 24 +- .../ServerGroupObjectTemplate.cpp | 24 +- .../ServerGuildObjectTemplate.cpp | 24 +- ...verHarvesterInstallationObjectTemplate.cpp | 45 +- .../ServerInstallationObjectTemplate.cpp | 24 +- .../ServerIntangibleObjectTemplate.cpp | 111 +- ...rManufactureInstallationObjectTemplate.cpp | 24 +- ...rverManufactureSchematicObjectTemplate.cpp | 127 +- .../ServerMissionObjectTemplate.cpp | 24 +- .../objectTemplate/ServerObjectTemplate.cpp | 250 +- .../ServerPlanetObjectTemplate.cpp | 27 +- .../ServerPlayerObjectTemplate.cpp | 24 +- .../ServerPlayerQuestObjectTemplate.cpp | 25 +- .../ServerResourceContainerObjectTemplate.cpp | 31 +- .../ServerShipObjectTemplate.cpp | 27 +- .../ServerStaticObjectTemplate.cpp | 27 +- .../ServerTangibleObjectTemplate.cpp | 59 +- .../ServerUniverseObjectTemplate.cpp | 24 +- .../ServerVehicleObjectTemplate.cpp | 45 +- .../ServerWeaponObjectTemplate.cpp | 99 +- .../clientGameServer/MessageQueueDraftSlots.h | 46 +- .../platform/projects/MonAPI2/MonitorAPI.cpp | 415 ++- .../soePlatform/CSAssist/utils/Base/AutoLog.h | 167 +- .../CSAssist/utils/TcpLibrary/TcpManager.cpp | 1292 +++++----- .../CTGenericAPI/GenericConnection.cpp | 325 +-- .../CTGenericAPI/GenericMessage.cpp | 47 +- .../TcpLibrary/TcpManager.cpp | 1292 +++++----- .../crypto/src/shared/original/queue.cpp | 68 +- .../LocalizedStringTableReaderWriter.cpp | 443 ++-- 55 files changed, 5565 insertions(+), 6231 deletions(-) diff --git a/engine/server/application/LogServer/src/shared/LoggingServerApi.cpp b/engine/server/application/LogServer/src/shared/LoggingServerApi.cpp index a6b9920f..c2429a76 100755 --- a/engine/server/application/LogServer/src/shared/LoggingServerApi.cpp +++ b/engine/server/application/LogServer/src/shared/LoggingServerApi.cpp @@ -9,8 +9,6 @@ #include "LoggingServerApi.h" - - LoggingServerApi::LoggingServerApi(LoggingServerHandler *handler, int queueSize) { mHandler = handler; @@ -18,6 +16,7 @@ LoggingServerApi::LoggingServerApi(LoggingServerHandler *handler, int queueSize) mQueue = new QueueEntry[mQueueSize]; mQueuePosition = 0; mQueueCount = 0; + mLoginSent = 0; mAuthenticated = false; mLoginName[0] = 0; @@ -117,22 +116,22 @@ void LoggingServerApi::Flush(int timeout) UdpMisc::Sleep(20); } -LoggingServerApi::Status LoggingServerApi::GetStatus() const +LoggingServerApi::Status LoggingServerApi::GetStatus() const { if (mConnection != nullptr) { switch (mConnection->GetStatus()) { - case UdpConnection::cStatusConnected: - if (mAuthenticated) - return(cStatusConnected); - else - return(cStatusAuthenticating); - break; - case UdpConnection::cStatusNegotiating: - return(cStatusNegotiating); - default: - break; + case UdpConnection::cStatusConnected: + if (mAuthenticated) + return(cStatusConnected); + else + return(cStatusAuthenticating); + break; + case UdpConnection::cStatusNegotiating: + return(cStatusNegotiating); + default: + break; } } return(cStatusDisconnected); @@ -140,57 +139,57 @@ LoggingServerApi::Status LoggingServerApi::GetStatus() const void LoggingServerApi::OnRoutePacket(UdpConnection *, const uchar *data, int) { - switch(data[0]) + switch (data[0]) { - case cS2CPacketLoginConfirm: + case cS2CPacketLoginConfirm: + { + mAuthenticated = data[1] ? true : false; + if (mAuthenticated) { - mAuthenticated = data[1] ? true : false; - if (mAuthenticated) - { - // flush the queue on authentication. This sends not only any data that was queued before connecting - // but also any data that was sent in the last 3 minutes, just to ensure that it didn't get lost on the - // server side of things - FlushQueue(); - } + // flush the queue on authentication. This sends not only any data that was queued before connecting + // but also any data that was sent in the last 3 minutes, just to ensure that it didn't get lost on the + // server side of things + FlushQueue(); + } - if (mHandler != nullptr) - mHandler->LshOnLoginConfirm(mAuthenticated); - break; - } - case cS2CPacketMonitor: - { - char *ptr = (char *)(data + 1); - int sessionId = UdpMisc::GetValue32(ptr); - ptr += 4; - int sequenceNumber = UdpMisc::GetValue32(ptr); - ptr += 4; - int typeCode = UdpMisc::GetValue32(ptr); - ptr += 4; - char *name = ptr; - ptr += strlen(ptr) + 1; - char *filename = ptr; - ptr += strlen(ptr) + 1; - char *message = ptr; - if (mHandler != nullptr) - mHandler->LshOnMonitor(sessionId, sequenceNumber, name, filename, typeCode, message); - break; - } - case cS2CPacketFileList: - { - if (mHandler != nullptr) - mHandler->LshOnFileList((char *)(data + 1)); - break; - } - default: - break; + if (mHandler != nullptr) + mHandler->LshOnLoginConfirm(mAuthenticated); + break; + } + case cS2CPacketMonitor: + { + char *ptr = (char *)(data + 1); + int sessionId = UdpMisc::GetValue32(ptr); + ptr += 4; + int sequenceNumber = UdpMisc::GetValue32(ptr); + ptr += 4; + int typeCode = UdpMisc::GetValue32(ptr); + ptr += 4; + char *name = ptr; + ptr += strlen(ptr) + 1; + char *filename = ptr; + ptr += strlen(ptr) + 1; + char *message = ptr; + if (mHandler != nullptr) + mHandler->LshOnMonitor(sessionId, sequenceNumber, name, filename, typeCode, message); + break; + } + case cS2CPacketFileList: + { + if (mHandler != nullptr) + mHandler->LshOnFileList((char *)(data + 1)); + break; + } + default: + break; } } void LoggingServerApi::OnTerminated(UdpConnection *con) { - if(mHandler != nullptr) + if (mHandler != nullptr) { - mHandler->LshOnTerminated( con->GetDisconnectReason() ); + mHandler->LshOnTerminated(con->GetDisconnectReason()); } } @@ -202,7 +201,7 @@ void LoggingServerApi::GiveTime() { mLoginSent = true; - // send login packet + // send login packet char buf[1024]; char *ptr = buf; *ptr++ = cC2SPacketLogin; @@ -221,8 +220,8 @@ void LoggingServerApi::GiveTime() { int spot = mQueuePosition % mQueueSize; - // if entry was actually sent and it has been sitting in the queue long enough to be deleted - if (mQueue[spot].sentTime != 0 && UdpMisc::ClockElapsed(mQueue[spot].sentTime) > cSafetyQueueTime) + // if entry was actually sent and it has been sitting in the queue long enough to be deleted + if (mQueue[spot].sentTime != 0 && UdpMisc::ClockElapsed(mQueue[spot].sentTime) > cSafetyQueueTime) { mQueue[spot].packet->Release(); mQueue[spot].packet = nullptr; @@ -259,7 +258,7 @@ void LoggingServerApi::StopTransaction() void LoggingServerApi::PacketSend(LogicalPacket *lp) { - // make room in queue + // make room in queue if (mQueueCount == mQueueSize) { int spot = mQueuePosition % mQueueSize; @@ -269,14 +268,14 @@ void LoggingServerApi::PacketSend(LogicalPacket *lp) mQueueCount--; } - // queue it + // queue it int spot = (mQueuePosition + mQueueCount) % mQueueSize; lp->AddRef(); mQueue[spot].packet = lp; mQueue[spot].sentTime = 0; mQueueCount++; - // if possible, send it + // if possible, send it if (GetStatus() == cStatusConnected) { mQueue[spot].sentTime = UdpMisc::Clock(); @@ -284,7 +283,6 @@ void LoggingServerApi::PacketSend(LogicalPacket *lp) } } - void LoggingServerApi::Log16(const char *filename, int typeCode, const unsigned short *ucs2String) { char buffer[32768]; @@ -376,7 +374,7 @@ void LoggingServerApi::LogPacket(char *data, int len) { if (mTransaction != nullptr) { - // add it to the transaction + // add it to the transaction mTransaction->AddPacket(data, len); } else @@ -437,12 +435,12 @@ void LoggingServerApi::RequestFileList() void LoggingServerApi::GetStatistics(LoggingServerApiStatistics *stats) { - memset( stats, 0, sizeof( *stats) ); + memset(stats, 0, sizeof(*stats)); UdpConnectionStatistics udpConnectionStats; - memset( &udpConnectionStats, 0, sizeof( udpConnectionStats ) ); - if( mConnection != nullptr ) + memset(&udpConnectionStats, 0, sizeof(udpConnectionStats)); + if (mConnection != nullptr) { - mConnection->GetStats( &udpConnectionStats ); + mConnection->GetStats(&udpConnectionStats); stats->applicationPacketsReceived = udpConnectionStats.applicationPacketsReceived; stats->applicationPacketsSent = udpConnectionStats.applicationPacketsSent; stats->totalBytesReceived = udpConnectionStats.totalBytesReceived; @@ -454,25 +452,25 @@ void LoggingServerApi::GetStatistics(LoggingServerApiStatistics *stats) } UdpManagerStatistics managerStats; - if( mUdpManager != nullptr ) + if (mUdpManager != nullptr) { - mUdpManager->GetStats( &managerStats ); + mUdpManager->GetStats(&managerStats); udp_int64 iterations = managerStats.iterations; int elapseTime = managerStats.elapsedTime; - if( elapseTime != 0 ) + if (elapseTime != 0) { - stats->iterationsPerSecond = (double)((iterations * 1000 )/(double)elapseTime); + stats->iterationsPerSecond = (double)((iterations * 1000) / (double)elapseTime); } mUdpManager->ResetStats(); } } -void LoggingServerHandler::LshOnLoginConfirm(bool ) +void LoggingServerHandler::LshOnLoginConfirm(bool) { } -void LoggingServerHandler::LshOnMonitor(int , int , const char * const, const char * const, int , const char * const) +void LoggingServerHandler::LshOnMonitor(int, int, const char * const, const char * const, int, const char * const) { } @@ -482,4 +480,4 @@ void LoggingServerHandler::LshOnFileList(const char * const) void LoggingServerHandler::LshOnTerminated(UdpConnection::DisconnectReason) { -} +} \ No newline at end of file diff --git a/engine/server/application/LogServer/src/shared/LoggingServerApiObserver.cpp b/engine/server/application/LogServer/src/shared/LoggingServerApiObserver.cpp index 209b2b0d..bd8c4753 100755 --- a/engine/server/application/LogServer/src/shared/LoggingServerApiObserver.cpp +++ b/engine/server/application/LogServer/src/shared/LoggingServerApiObserver.cpp @@ -1,5 +1,5 @@ // LoggingServerApiObserver.cpp -// Copyright 2000-02, Sony Online Entertainment Inc., all rights reserved. +// Copyright 2000-02, Sony Online Entertainment Inc., all rights reserved. // Author: Justin Randall //----------------------------------------------------------------------- @@ -15,7 +15,7 @@ //----------------------------------------------------------------------- LoggingServerApiObserver::LoggingServerApiObserver() : -m_loggingServerApi(new LoggingServerApi(0, ConfigLogServer::getLoggingServerApiQueueSize())) + m_loggingServerApi(new LoggingServerApi(0, ConfigLogServer::getLoggingServerApiQueueSize())) { m_loggingServerApi->Connect(ConfigLogServer::getLoggingServerApiAddress(), LoggingServerApi::cDefaultPort, ConfigLogServer::getLoggingServerApiLoginName(), ConfigLogServer::getLoggingServerApiPassword(), ConfigLogServer::getLoggingServerApiDefaultDirectory()); } @@ -47,30 +47,30 @@ LogObserver * LoggingServerApiObserver::create(const std::string &) void LoggingServerApiObserver::log(const LogMessage & msg) { std::string fileName = "misc.txt"; - + std::string msgText; - if(! msg.getText().empty()) + if (!msg.getText().empty()) { time_t now; tm t; - IGNORE_RETURN( time(&now) ); - IGNORE_RETURN( gmtime_r(&now, &t) ); - char dirBuf[128] = {"\0"}; + IGNORE_RETURN(time(&now)); + IGNORE_RETURN(gmtime_r(&now, &t)); + char dirBuf[128] = { "\0" }; snprintf(dirBuf, sizeof(dirBuf), "%d/%d/%d/", t.tm_year + 1900, t.tm_mon + 1, t.tm_mday); fileName = ConfigLogServer::getClusterName(); fileName += "/"; fileName += dirBuf; - + std::string splittext = msg.getText(); - if(splittext.find(":") != splittext.npos) + if (splittext.find(":") != splittext.npos) { fileName += splittext.substr(0, splittext.find(":")) + ".txt"; } msgText = splittext.substr(splittext.find(":") + 1); - + // If there is ANY Unicode, send the whole log as Unicode. If there is ONLY non-Unicode, then send the log non-Unicode. if (!msg.getUnicodeAttach().empty()) @@ -106,7 +106,7 @@ void LoggingServerApiObserver::flush() void LoggingServerApiObserver::update() { - if(m_loggingServerApi->GetStatus() == LoggingServerApi::cStatusDisconnected) + if (m_loggingServerApi->GetStatus() == LoggingServerApi::cStatusDisconnected) { m_loggingServerApi->Connect(ConfigLogServer::getLoggingServerApiAddress(), LoggingServerApi::cDefaultPort, ConfigLogServer::getLoggingServerApiLoginName(), ConfigLogServer::getLoggingServerApiPassword(), ConfigLogServer::getLoggingServerApiDefaultDirectory()); } @@ -114,5 +114,4 @@ void LoggingServerApiObserver::update() m_loggingServerApi->GiveTime(); } -//----------------------------------------------------------------------- - +//----------------------------------------------------------------------- \ No newline at end of file diff --git a/engine/server/application/LoginServer/src/shared/CSToolConnection.cpp b/engine/server/application/LoginServer/src/shared/CSToolConnection.cpp index 7e10c623..9163a15a 100755 --- a/engine/server/application/LoginServer/src/shared/CSToolConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/CSToolConnection.cpp @@ -14,9 +14,9 @@ #include "sharedLog/Log.h" #if defined(WIN32) - #include +#include #else // for non-windows platforms (linux) - #include +#include #endif namespace CSToolConnectionNamespace @@ -28,9 +28,9 @@ uint32 CSToolConnection::m_curToolID = 0; // statics -CSToolConnection * CSToolConnection::getCSToolConnectionByToolId( uint32 id ) +CSToolConnection * CSToolConnection::getCSToolConnectionByToolId(uint32 id) { - std::map< uint32, CSToolConnection * >::iterator it = CSToolConnectionNamespace::toolsByID.find( id ); + std::map< uint32, CSToolConnection * >::iterator it = CSToolConnectionNamespace::toolsByID.find(id); return it == CSToolConnectionNamespace::toolsByID.end() ? 0 : it->second; } @@ -40,9 +40,9 @@ void CSToolConnection::validateCSTool(uint32 toolId, apiResult result, const api CSToolConnection * p_connection = getCSToolConnectionByToolId(toolId); if (!p_connection) return; // no connection, they must have bailed. - + // check the result - if(result == RESULT_SUCCESS) + if (result == RESULT_SUCCESS) { // if we're valid, set to logged in p_connection->m_bLoggedIn = true; @@ -50,24 +50,23 @@ void CSToolConnection::validateCSTool(uint32 toolId, apiResult result, const api { p_connection->m_bSecure = true; } - + // if we have a nullptr session type, then we aren't connected to the // Session Server and are in debug mode. // // if we *do* have a good session, then check the admin table for access level. int accessLevel = 100; - + bool sessionNull = (session.GetType() == SESSION_TYPE_NULL); bool isAdmin = AdminAccountManager::isAdminAccount(p_connection->m_sUserName, accessLevel); bool needSecure = ConfigLoginServer::getRequireSecureLoginForCsTool(); bool isInternal = AdminAccountManager::isInternalIp(p_connection->getRemoteAddress()); - DEBUG_REPORT_LOG( true, ("CS Tool login for %s, admin=%s, access=%d, internal=%s\n", - p_connection->m_sUserName.c_str(), - isAdmin ? "true" : "false", - accessLevel, - isInternal ? "true" : "false")); + DEBUG_REPORT_LOG(true, ("CS Tool login for %s, admin=%s, access=%d, internal=%s\n", + p_connection->m_sUserName.c_str(), + isAdmin ? "true" : "false", + accessLevel, + isInternal ? "true" : "false")); - bool canLogin = isInternal; // we always have to be internal. if (sessionNull) { @@ -78,10 +77,10 @@ void CSToolConnection::validateCSTool(uint32 toolId, apiResult result, const api else { // if we don't have a session, we need to be on the admin table - if(isAdmin) + if (isAdmin) { // allow login if we either don't need to be secure, or if we are. - if((!needSecure) || p_connection->m_bSecure) + if ((!needSecure) || p_connection->m_bSecure) { canLogin = canLogin && true; } @@ -94,58 +93,57 @@ void CSToolConnection::validateCSTool(uint32 toolId, apiResult result, const api { canLogin = false; } - } - - if(canLogin) + } + + if (canLogin) { // and inform std::string response = "Logged in successfully."; response += "\r\n"; p_connection->sendToTool(response); - + p_connection->m_ui32PrivilegeLevel = (uint32)accessLevel; } else { p_connection->sendToTool("Invalid name/password.\r\n"); } - } - // otherwise, give the appropriate response - else if( result == RESULT_INVALID_NAME_OR_PASSWORD ) + // otherwise, give the appropriate response + else if (result == RESULT_INVALID_NAME_OR_PASSWORD) { p_connection->sendToTool("Invalid name/password.\r\n"); } else { - DEBUG_REPORT_LOG(true,("Could not log in CS Tool for user %s, reason %d\n", p_connection->m_sUserName.c_str(), result)); + DEBUG_REPORT_LOG(true, ("Could not log in CS Tool for user %s, reason %d\n", p_connection->m_sUserName.c_str(), result)); p_connection->sendToTool("Invalid name/password.\r\n"); } - } // members -CSToolConnection::CSToolConnection( UdpConnectionMT * pUdpConn, TcpClient * pTcpConn ) : - Connection( pUdpConn, pTcpConn ), - m_ui32StationID( 0 ), - m_bSecure( false ), - m_bLoggedIn( false ), - m_ui32PrivilegeLevel( 0 ) +CSToolConnection::CSToolConnection(UdpConnectionMT * pUdpConn, TcpClient * pTcpConn) : + Connection(pUdpConn, pTcpConn), + m_ui32StationID(0), + m_bSecure(false), + m_bLoggedIn(false), + m_ui32PrivilegeLevel(0), + m_toolID(0) { - if( pTcpConn ) // it'd better be! - setRawTCP( true ); + if (pTcpConn) // it'd better be! + setRawTCP(true); } CSToolConnection::~CSToolConnection() { } -void CSToolConnection::onReceive( const Archive::ByteStream & message ) +void CSToolConnection::onReceive(const Archive::ByteStream & message) { // for testing purposes, just echo back to the user. - + // add to buffer std::string input; const unsigned char * uc = message.getBuffer(); @@ -156,242 +154,234 @@ void CSToolConnection::onReceive( const Archive::ByteStream & message ) ++uc; } m_sInputBuffer += input; - - + // while we've got an EOL signifier std::string::size_type pos; - while( ( pos = m_sInputBuffer.find( '\r' ) ) != std::string::npos ) + while ((pos = m_sInputBuffer.find('\r')) != std::string::npos) { // rebuild message buffer properly. - std::string command = m_sInputBuffer.substr( 0, pos ); + std::string command = m_sInputBuffer.substr(0, pos); // should dispatch here, for now we're echoing back for debug. - + //command = command + "\r\n"; //sendToTool( command ); - this->parse( command ); + this->parse(command); // then we have additional data. Otherwise, we don't. - if( m_sInputBuffer.size() >= pos + 2 ) + if (m_sInputBuffer.size() >= pos + 2) { - m_sInputBuffer = m_sInputBuffer.substr( pos + 2, m_sInputBuffer.length() - ( pos + 2 ) ); + m_sInputBuffer = m_sInputBuffer.substr(pos + 2, m_sInputBuffer.length() - (pos + 2)); } else { m_sInputBuffer.clear(); } - } } -void CSToolConnection::parse( const std::string command ) +void CSToolConnection::parse(const std::string command) { // grab the first word of the command. std::string first; std::string args; std::string::size_type pos; - if( ( pos = command.find( ' ' ) ) == std::string::npos ) + if ((pos = command.find(' ')) == std::string::npos) { first = command; } else { - first = command.substr( 0, pos ); - args = command.substr( pos + 1, command.size() - ( pos + 1 ) ); + first = command.substr(0, pos); + args = command.substr(pos + 1, command.size() - (pos + 1)); } // test for empty commands. - if( first.length() == 0 || first[ 0 ] == ' ' ) + if (first.length() == 0 || first[0] == ' ') { return; } - + std::string response = "ls:"; - - - if( first == "clusters" ) + + if (first == "clusters") { response += "Active clusters:\r\n"; - std::map< std::string, uint32 > data; - LoginServer::getInstance().getAllClusterNamesAndIDs( data ); - for( std::map< std::string, uint32 >::iterator it = data.begin(); - it != data.end(); - ++it ) + std::map< std::string, uint32 > data; + LoginServer::getInstance().getAllClusterNamesAndIDs(data); + for (std::map< std::string, uint32 >::iterator it = data.begin(); + it != data.end(); + ++it) { response += it->first + "\r\n"; } - sendToTool( response ); + sendToTool(response); } - else if ( first == "select" ) + else if (first == "select") { // see if we're adding, removing, or exclusive-adding. - if( args[ 0 ] == '+' ) + if (args[0] == '+') { - if( args.size() > 1 ) + if (args.size() > 1) { - if( args[ 1 ] == '+' ) + if (args[1] == '+') { m_selectedClusters.clear(); - sendToTool( "ls:deselected all servers\r\n" ); + sendToTool("ls:deselected all servers\r\n"); } - pos = args.find_first_not_of( "+" ); - if( pos == std::string::npos ) + pos = args.find_first_not_of("+"); + if (pos == std::string::npos) { } else { - std::string cluster = args.substr( pos, args.size() - pos ); - response += selectCluster( cluster ); - sendToTool( response ); + std::string cluster = args.substr(pos, args.size() - pos); + response += selectCluster(cluster); + sendToTool(response); } } } - else if( args[ 0 ] == '-' ) + else if (args[0] == '-') { - if( args.size() > 1 ) + if (args.size() > 1) { - std::string cluster = args.substr( 1, args.size() - 1 ); - if( m_selectedClusters.find( cluster ) != m_selectedClusters.end() ) + std::string cluster = args.substr(1, args.size() - 1); + if (m_selectedClusters.find(cluster) != m_selectedClusters.end()) { - response += deselectCluster( cluster ); - sendToTool( response ); + response += deselectCluster(cluster); + sendToTool(response); } } } else { - sendToTool( "Error! Bad select format!\r\n" ); + sendToTool("Error! Bad select format!\r\n"); } } - else if ( first == "showselected" ) + else if (first == "showselected") { response += "Currently selected clusters:\r\n"; - for( std::set< std::string >::iterator it = m_selectedClusters.begin(); - it != m_selectedClusters.end(); - ++it ) + for (std::set< std::string >::iterator it = m_selectedClusters.begin(); + it != m_selectedClusters.end(); + ++it) { response += *it + "\r\n"; } - sendToTool( response ); - + sendToTool(response); } - else if( first == "login" ) + else if (first == "login") { // assume name/pw do not have spaces. std::string name; std::string pw; - + // split apart - unsigned pos = args.find( " " ); - if( pos != std::string::npos ) + unsigned pos = args.find(" "); + if (pos != std::string::npos) { - name = args.substr( 0, pos ); - pw = args.substr( pos + 1, args.length() - pos - 1 ); + name = args.substr(0, pos); + pw = args.substr(pos + 1, args.length() - pos - 1); m_sUserName = name; - if( !LoginServer::getInstance().getSessionApiClient() ) + if (!LoginServer::getInstance().getSessionApiClient()) { apiSession session; - validateCSTool( m_toolID, RESULT_SUCCESS, session ); + validateCSTool(m_toolID, RESULT_SUCCESS, session); return; } LoginServer::getInstance().getSessionApiClient()-> - SessionLogin(name.c_str(), - pw.c_str(), + SessionLogin(name.c_str(), + pw.c_str(), SESSION_TYPE_STARWARS, - inet_addr( getRemoteAddress().c_str() ), + inet_addr(getRemoteAddress().c_str()), 0, - _defaultNamespace, - ( void * )m_toolID ); + _defaultNamespace, + (void *)m_toolID); } - + // pass to session. } // default command handler. else { - if( m_bLoggedIn ) + if (m_bLoggedIn) { - sendToClusters( first, command ); + sendToClusters(first, command); } else { - sendToTool( "Not logged in.\r\n" ); + sendToTool("Not logged in.\r\n"); } } - } -void CSToolConnection::sendToClusters( const std::string & sCommand, const std::string & sCommandLine ) +void CSToolConnection::sendToClusters(const std::string & sCommand, const std::string & sCommandLine) { // build the message - CSToolRequest msg( m_ui32StationID, m_ui32PrivilegeLevel, sCommandLine, sCommand, m_toolID, m_sUserName ); - + CSToolRequest msg(m_ui32StationID, m_ui32PrivilegeLevel, sCommandLine, sCommand, m_toolID, m_sUserName); + // send to all currently selected clusters. - for( std::set< std::string >::iterator it = m_selectedClusters.begin(); - it != m_selectedClusters.end(); - ++it ) + for (std::set< std::string >::iterator it = m_selectedClusters.begin(); + it != m_selectedClusters.end(); + ++it) { - LoginServer::getInstance().sendToCluster( LoginServer::getInstance().getClusterIDByName( *it ), msg ); + LoginServer::getInstance().sendToCluster(LoginServer::getInstance().getClusterIDByName(*it), msg); } } -std::string CSToolConnection::selectCluster( const std::string & cluster ) +std::string CSToolConnection::selectCluster(const std::string & cluster) { std::string response; // see if we have a valid cluster. - uint32 cluster_id = LoginServer::getInstance().getClusterIDByName( cluster ); - if( cluster_id == 0 ) + uint32 cluster_id = LoginServer::getInstance().getClusterIDByName(cluster); + if (cluster_id == 0) { response += "Cluster " + cluster + " does not exist.\r\n"; } else { - m_selectedClusters.insert( cluster ); + m_selectedClusters.insert(cluster); response += "Cluster " + cluster + " added to active list\r\n"; } return response; } -std::string CSToolConnection::deselectCluster( const std::string & cluster ) +std::string CSToolConnection::deselectCluster(const std::string & cluster) { std::string response; - + // see if we are currently talking to that cluster. - std::set< std::string >::iterator it = m_selectedClusters.find( cluster ); - if( it == m_selectedClusters.end() ) + std::set< std::string >::iterator it = m_selectedClusters.find(cluster); + if (it == m_selectedClusters.end()) { response += "Cluster " + cluster + " is not currently selected.\r\n"; } else { - m_selectedClusters.erase( it ); + m_selectedClusters.erase(it); response += "Cluster " + cluster + " removed from active list.\r\n"; } return response; - } -void CSToolConnection::sendToTool( const std::string & message ) +void CSToolConnection::sendToTool(const std::string & message) { // convert to ByteStream std::string temp = message; temp += "\r\n*\r\n"; Archive::ByteStream bs; - bs.put( temp.c_str(), temp.size() ); + bs.put(temp.c_str(), temp.size()); // send. - this->send( bs, true ); -} + this->send(bs, true); +} void CSToolConnection::onConnectionOpened() { - LOG( "CSTool", ("Connection opened") ); + LOG("CSTool", ("Connection opened")); // assign an ID, and stick it in our map. m_curToolID++; m_toolID = m_curToolID; - CSToolConnectionNamespace::toolsByID[ m_toolID ] = this; - + CSToolConnectionNamespace::toolsByID[m_toolID] = this; } void CSToolConnection::onConnectionClosed() { - LOG( "CSTool", ("Connection closed") ); - CSToolConnectionNamespace::toolsByID.erase( m_toolID ); - -} + LOG("CSTool", ("Connection closed")); + CSToolConnectionNamespace::toolsByID.erase(m_toolID); +} \ No newline at end of file diff --git a/engine/server/application/LoginServer/src/shared/LoginServer.cpp b/engine/server/application/LoginServer/src/shared/LoginServer.cpp index a3a213a8..8393f5a9 100755 --- a/engine/server/application/LoginServer/src/shared/LoginServer.cpp +++ b/engine/server/application/LoginServer/src/shared/LoginServer.cpp @@ -2,7 +2,6 @@ // copyright 2000 Verant Interactive // Author: Justin Randall - //----------------------------------------------------------------------- #include "FirstLoginServer.h" @@ -123,23 +122,22 @@ bool ConnectionServerEntryLessThan::operator()(const LoginServer::ConnectionServ return x.numClients < y.numClients; } - //----------------------------------------------------------------------- LoginServer::LoginServer() : -Singleton(), -MessageDispatch::Receiver(), -done(false), -m_centralService(nullptr), -clientService(0), -pingService(0), -keyServer(0), -m_clientMap(), -m_clusterList(), -m_sessionApiClient(0), -m_validatedClientMap(), -m_clusterStatusChanged(false), -m_soeMonitor(0) + Singleton(), + MessageDispatch::Receiver(), + done(false), + m_centralService(nullptr), + clientService(0), + pingService(0), + keyServer(0), + m_clientMap(), + m_clusterList(), + m_sessionApiClient(0), + m_validatedClientMap(), + m_clusterStatusChanged(false), + m_soeMonitor(0) { NetworkSetupData setup; setup.port = ConfigLoginServer::getClientServicePort(); @@ -161,9 +159,9 @@ m_soeMonitor(0) setup.maxConnections = 1000; m_centralService = new Service(ConnectionAllocator(), setup); } - + setup.port = ConfigLoginServer::getCSToolPort(); - m_CSService = new Service(ConnectionAllocator(), setup ); + m_CSService = new Service(ConnectionAllocator(), setup); // set up message connections connectToMessage("ClaimRewardsMessage"); @@ -209,7 +207,7 @@ LoginServer::~LoginServer() //----------------------------------------------------------------------- -int LoginServer::addClient (ClientConnection & client) +int LoginServer::addClient(ClientConnection & client) { DEBUG_FATAL(client.getIsValidated(), ("Tried to add an already validated client?!")); //Perhaps add a debug only check to make sure a client connection isn't in twice...I'm not sure how that could happen. @@ -221,18 +219,17 @@ int LoginServer::addClient (ClientConnection & client) //----------------------------------------------------------------------- -ClientConnection* LoginServer::getValidatedClient (const StationId& clientId) +ClientConnection* LoginServer::getValidatedClient(const StationId& clientId) { std::map::iterator i = m_validatedClientMap.find(clientId); if (i == m_validatedClientMap.end()) return 0; return i->second; - } //----------------------------------------------------------------------- -ClientConnection* LoginServer::getUnvalidatedClient (int clientId) +ClientConnection* LoginServer::getUnvalidatedClient(int clientId) { WARNING_STRICT_FATAL(clientId == 0, ("Tried to get an unvalidated client with client id == 0")); std::map::iterator i = m_clientMap.find(clientId); @@ -243,7 +240,7 @@ ClientConnection* LoginServer::getUnvalidatedClient (int clientId) } //----------------------------------------------------------------------- -void LoginServer::removeClient (int clientId) +void LoginServer::removeClient(int clientId) { WARNING_STRICT_FATAL(clientId == 0, ("Tried to remove a client with client id == 0")); std::map::iterator i = m_clientMap.find(clientId); @@ -268,7 +265,7 @@ void LoginServer::installSessionValidation() for (i = 0; i < numberOfSessionServers; ++i) { char const * const p = ConfigLoginServer::getSessionServer(i); - if(p) + if (p) { REPORT_LOG(true, ("Using session server %s\n", p)); sessionServers.push_back(p); @@ -291,7 +288,7 @@ bool LoginServer::deleteCharacter(uint32 clusterId, NetworkId const & characterI if (cle->m_centralServerConnection) { ServerDeleteCharacterMessage smsg(suid, characterId, 0); - cle->m_centralServerConnection->send(smsg,true); + cle->m_centralServerConnection->send(smsg, true); ClientConnection* target = getValidatedClient(suid); if (target) @@ -304,18 +301,17 @@ bool LoginServer::deleteCharacter(uint32 clusterId, NetworkId const & characterI } else { - DEBUG_REPORT_LOG(true,("User %lu requested deleting character %s on cluster %lu, but the cluster is not currently connected.\n",suid , characterId.getValueString().c_str(), clusterId)); + DEBUG_REPORT_LOG(true, ("User %lu requested deleting character %s on cluster %lu, but the cluster is not currently connected.\n", suid, characterId.getValueString().c_str(), clusterId)); return false; } } else { - DEBUG_REPORT_LOG(true,("User %lu requested deleting character %s on cluster %lu, but we have no cluster with that number.\n", suid, characterId.getValueString().c_str(), clusterId)); + DEBUG_REPORT_LOG(true, ("User %lu requested deleting character %s on cluster %lu, but we have no cluster with that number.\n", suid, characterId.getValueString().c_str(), clusterId)); return false; } } - //----------------------------------------------------------------------- const KeyShare::Key & LoginServer::getCurrentKey(void) const @@ -330,7 +326,6 @@ SessionApiClient * LoginServer::getSessionApiClient() return m_sessionApiClient; } - //----------------------------------------------------------------------- KeyShare::Token LoginServer::makeToken(const unsigned char * const data, const uint32 dataLen) const @@ -342,7 +337,7 @@ KeyShare::Token LoginServer::makeToken(const unsigned char * const data, const u void LoginServer::pushAllKeys(CentralServerConnection * targetGameServer) const { - for(int i = static_cast(keyServer->getKeyCount()) - 1; i >=0 ; i --) + for (int i = static_cast(keyServer->getKeyCount()) - 1; i >= 0; i--) { LoginKeyPush pk(keyServer->getKey(static_cast(i))); targetGameServer->send(pk, true); @@ -353,24 +348,24 @@ void LoginServer::pushAllKeys(CentralServerConnection * targetGameServer) const void LoginServer::pushKeyToAllServers(void) { - KeyShare::Key k = keyServer->getKey(0); - CentralServerConnection * c; + KeyShare::Key k = keyServer->getKey(0); + CentralServerConnection * c; - LoginKeyPush msg(k); + LoginKeyPush msg(k); - unsigned char s[128]; - memcpy(s, k.value, 16); //lint !e64 !e119 !e534 // not sure where lint is finding a memcpy(void *, int) prototype - DEBUG_REPORT_LOG(true, ("Key Exchange ->: ")); - for(int x = 0; x < 16; x++) - { - DEBUG_REPORT_LOG(true, ("[%3i]", s[x])); - } - DEBUG_REPORT_LOG(true, ("\n")); + unsigned char s[128]; + memcpy(s, k.value, 16); //lint !e64 !e119 !e534 // not sure where lint is finding a memcpy(void *, int) prototype + DEBUG_REPORT_LOG(true, ("Key Exchange ->: ")); + for (int x = 0; x < 16; x++) + { + DEBUG_REPORT_LOG(true, ("[%3i]", s[x])); + } + DEBUG_REPORT_LOG(true, ("\n")); - for (ClusterListType::const_iterator i=m_clusterList.begin(); i!=m_clusterList.end(); ++i) + for (ClusterListType::const_iterator i = m_clusterList.begin(); i != m_clusterList.end(); ++i) { c = (*i)->m_centralServerConnection; - if(c) + if (c) { c->send(msg, true); } @@ -382,16 +377,16 @@ void LoginServer::pushKeyToAllServers(void) void LoginServer::receiveMessage(const MessageDispatch::Emitter & source, const MessageDispatch::MessageBase & message) { // determine message type - - if(message.isType("LoginClusterName") || message.isType( "LoginClusterName2" ) ) - { + + if (message.isType("LoginClusterName") || message.isType("LoginClusterName2")) + { Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); - const LoginClusterName msg(ri); - if(msg.getClusterName().length() > 0) - { + const LoginClusterName msg(ri); + if (msg.getClusterName().length() > 0) + { CentralServerConnection * connection = const_cast(safe_cast(&source)); DEBUG_REPORT_LOG(true, ("Cluster connection %s opened\n", msg.getClusterName().c_str())); - ClusterListEntry *cle=nullptr; + ClusterListEntry *cle = nullptr; if (ConfigLoginServer::getDevelopmentMode()) { // in this mode, we trust the name sent by the cluster and we dynamically add clusters we don't know about @@ -404,13 +399,13 @@ void LoginServer::receiveMessage(const MessageDispatch::Emitter & source, const // in this mode, the cluster name has to match what we were expecting cle = findClusterByConnection(connection); if (!cle) - DEBUG_FATAL(true,("PROGRAMMER BUG: Got a connection from %s:%hu, which we weren't expecting. Cluster name is \"%s\".\n",connection->getRemoteAddress().c_str(), connection->getRemotePort(), msg.getClusterName().c_str())); + DEBUG_FATAL(true, ("PROGRAMMER BUG: Got a connection from %s:%hu, which we weren't expecting. Cluster name is \"%s\".\n", connection->getRemoteAddress().c_str(), connection->getRemotePort(), msg.getClusterName().c_str())); else if (msg.getClusterName() != cle->m_clusterName) { - WARNING(true,("Server %i is named \"%s\" in the database. The server at the specified address (%s:%hu) reports its name as \"%s\". It will not be allowed in the service. Either the name in the database or the name in Central's config file should be corrected.\n",cle->m_clusterId, cle->m_clusterName.c_str(), connection->getRemoteAddress().c_str(), connection->getRemotePort(), msg.getClusterName().c_str())); - disconnectCluster(*cle,true,false); - cle=nullptr; + WARNING(true, ("Server %i is named \"%s\" in the database. The server at the specified address (%s:%hu) reports its name as \"%s\". It will not be allowed in the service. Either the name in the database or the name in Central's config file should be corrected.\n", cle->m_clusterId, cle->m_clusterName.c_str(), connection->getRemoteAddress().c_str(), connection->getRemotePort(), msg.getClusterName().c_str())); + disconnectCluster(*cle, true, false); + cle = nullptr; } } @@ -423,8 +418,8 @@ void LoginServer::receiveMessage(const MessageDispatch::Emitter & source, const if (cle->m_clusterId == 0) { - DEBUG_FATAL(!ConfigLoginServer::getDevelopmentMode(),("Programmer bug: cle->m_clusterId was 0 in non-development mode. The code before this line should have prevented this.\n")); - DEBUG_REPORT_LOG(true,("Cluster was not on the list. Adding it to the database.\n")); + DEBUG_FATAL(!ConfigLoginServer::getDevelopmentMode(), ("Programmer bug: cle->m_clusterId was 0 in non-development mode. The code before this line should have prevented this.\n")); + DEBUG_REPORT_LOG(true, ("Cluster was not on the list. Adding it to the database.\n")); DatabaseConnection::getInstance().registerNewCluster(msg.getClusterName(), connection->getRemoteAddress()); } else @@ -441,30 +436,30 @@ void LoginServer::receiveMessage(const MessageDispatch::Emitter & source, const // tell the cluster about its locked and secret state GenericValueTypeMessage > const msgState("UpdateClusterLockedAndSecretState", std::make_pair(cle->m_locked, cle->m_secret)); - cle->m_centralServerConnection->send(msgState,true); + cle->m_centralServerConnection->send(msgState, true); } } - } + } else if (message.isType("LoginConnectionServerAddress")) { const CentralServerConnection * cs = safe_cast(&source); Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); - LoginConnectionServerAddress m(ri); //lint !e1774 !e826onServerEntry entry; + LoginConnectionServerAddress m(ri); //lint !e1774 !e826onServerEntry entry; ConnectionServerEntry entry; - entry.clientServiceAddress = Address(Address(m.getClientServiceAddress(), 0).getSockAddr4()).getHostAddress(); - entry.clientServicePortPrivate = m.getClientServicePortPrivate(); - entry.clientServicePortPublic = m.getClientServicePortPublic(); - entry.id = m.getId(); - entry.numClients = m.getNumClients(); - entry.pingPort = m.getPingPort (); + entry.clientServiceAddress = Address(Address(m.getClientServiceAddress(), 0).getSockAddr4()).getHostAddress(); + entry.clientServicePortPrivate = m.getClientServicePortPrivate(); + entry.clientServicePortPublic = m.getClientServicePortPublic(); + entry.id = m.getId(); + entry.numClients = m.getNumClients(); + entry.pingPort = m.getPingPort(); DEBUG_REPORT_LOG(true, ("ConnectionServer Reconnect - address from connection server (%s), address after conversion (%s)\n", m.getClientServiceAddress().c_str(), entry.clientServiceAddress.c_str())); ClusterListEntry *cle = findClusterByConnection(cs); if (cle) { - WARNING_STRICT_FATAL(!cle->m_centralServerConnection, ("Got reconnect for connection server with no central! Cluster %s\n",cs->getClusterName().c_str())); + WARNING_STRICT_FATAL(!cle->m_centralServerConnection, ("Got reconnect for connection server with no central! Cluster %s\n", cs->getClusterName().c_str())); std::vector::iterator i = std::find(cle->m_connectionServers.begin(), cle->m_connectionServers.end(), entry); if (i == cle->m_connectionServers.end()) { @@ -479,7 +474,7 @@ void LoginServer::receiveMessage(const MessageDispatch::Emitter & source, const std::sort(cle->m_connectionServers.begin(), cle->m_connectionServers.end(), ConnectionServerEntryLessThan()); } else - WARNING_STRICT_FATAL(true,("Programmer bug: Got LoginConnectionServerAddress from a cluster that wasn't on the list. Probably indicates we aren't tracking connections properly.\n")); + WARNING_STRICT_FATAL(true, ("Programmer bug: Got LoginConnectionServerAddress from a cluster that wasn't on the list. Probably indicates we aren't tracking connections properly.\n")); } else if (message.isType("PreloadFinishedMessage")) { @@ -492,7 +487,7 @@ void LoginServer::receiveMessage(const MessageDispatch::Emitter & source, const { if (msg.getFinished()) { - REPORT_LOG(true, ("Cluster %s is ready for players.\n",cle->m_clusterName.c_str())); + REPORT_LOG(true, ("Cluster %s is ready for players.\n", cle->m_clusterName.c_str())); if (!cle->m_readyForPlayers) { cle->m_readyForPlayers = true; @@ -501,7 +496,7 @@ void LoginServer::receiveMessage(const MessageDispatch::Emitter & source, const } else { - REPORT_LOG(true, ("Cluster %s is not ready for players.\n",cle->m_clusterName.c_str())); + REPORT_LOG(true, ("Cluster %s is not ready for players.\n", cle->m_clusterName.c_str())); if (cle->m_readyForPlayers) { cle->m_readyForPlayers = false; @@ -511,11 +506,10 @@ void LoginServer::receiveMessage(const MessageDispatch::Emitter & source, const } } else - WARNING_STRICT_FATAL(true,("Programmer bug: Got PreloadFinishedMessage from a cluster that wasn't on the list. Probably indicates we aren't tracking connections properly.\n")); + WARNING_STRICT_FATAL(true, ("Programmer bug: Got PreloadFinishedMessage from a cluster that wasn't on the list. Probably indicates we aren't tracking connections properly.\n")); } - else if(message.isType("ConnectionServerDown")) + else if (message.isType("ConnectionServerDown")) { - const CentralServerConnection * centralConnection = safe_cast(&source); Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); ConnectionServerDown c(ri); //lint !e1774 !e826 @@ -540,9 +534,9 @@ void LoginServer::receiveMessage(const MessageDispatch::Emitter & source, const m_clusterStatusChanged = true; } else - WARNING_STRICT_FATAL(true,("Programmer bug: Got ConnectionServerDown from a cluster that wasn't on the list. Probably indicates we aren't tracking connections properly.\n")); + WARNING_STRICT_FATAL(true, ("Programmer bug: Got ConnectionServerDown from a cluster that wasn't on the list. Probably indicates we aren't tracking connections properly.\n")); } - else if(message.isType("ConnectionClosed")) + else if (message.isType("ConnectionClosed")) { const CentralServerConnection *c = dynamic_cast(&source); if (c) @@ -551,22 +545,22 @@ void LoginServer::receiveMessage(const MessageDispatch::Emitter & source, const if (cle) { DEBUG_REPORT_LOG(true, ("Cluster connection %s closed.\n", c->getClusterName().c_str())); - disconnectCluster(*cle,false,true); + disconnectCluster(*cle, false, true); } else - WARNING_STRICT_FATAL(true,("Programmer bug: Cluster disconnected but it wasn't on the list. Probably indicates we aren't tracking connections properly.\n")); + WARNING_STRICT_FATAL(true, ("Programmer bug: Cluster disconnected but it wasn't on the list. Probably indicates we aren't tracking connections properly.\n")); } } else if (message.isType("ValidateAccountMessage")) { Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); - ValidateAccountMessage msg(ri); + ValidateAccountMessage msg(ri); const CentralServerConnection *conn = dynamic_cast(&source); if (conn) - DatabaseConnection::getInstance().getAccountValidationData(msg.getStationId(), conn->getClusterId(), msg.getTrack(), msg.getSubscriptionBits()); + DatabaseConnection::getInstance().getAccountValidationData(msg.getStationId(), conn->getClusterId(), msg.getTrack(), msg.getSubscriptionBits()); else - WARNING_STRICT_FATAL(true,("Expect ValidateAccountMessage's to only come from CentralServers.\n")); + WARNING_STRICT_FATAL(true, ("Expect ValidateAccountMessage's to only come from CentralServers.\n")); } else if (message.isType("CntrlSrvDropDupeConns")) { @@ -621,9 +615,9 @@ void LoginServer::receiveMessage(const MessageDispatch::Emitter & source, const if (nonSessionTestingAccountFeatureIds && !msg.getTargetPlayerDescription().empty() && msg.getTargetItem().isValid() && !msg.getTargetItemDescription().empty()) { if (msg.getGameCode() == PlatformGameCode::SWGTCG) - LOG("CustomerService",("TcgRedemption: %s redeemed %s for SWGTCG account feature Id %lu (%d -> %d)", msg.getTargetPlayerDescription().c_str(), msg.getTargetItemDescription().c_str(), msg.getFeatureId(), currentFeatureIdCount, updatedFeatureIdCount)); + LOG("CustomerService", ("TcgRedemption: %s redeemed %s for SWGTCG account feature Id %lu (%d -> %d)", msg.getTargetPlayerDescription().c_str(), msg.getTargetItemDescription().c_str(), msg.getFeatureId(), currentFeatureIdCount, updatedFeatureIdCount)); else if (msg.getGameCode() == PlatformGameCode::SWG) - LOG("CustomerService",("VeteranRewards: %s traded in %s for SWG account feature Id %lu (%d -> %d)", msg.getTargetPlayerDescription().c_str(), msg.getTargetItemDescription().c_str(), msg.getFeatureId(), currentFeatureIdCount, updatedFeatureIdCount)); + LOG("CustomerService", ("VeteranRewards: %s traded in %s for SWG account feature Id %lu (%d -> %d)", msg.getTargetPlayerDescription().c_str(), msg.getTargetItemDescription().c_str(), msg.getFeatureId(), currentFeatureIdCount, updatedFeatureIdCount)); } const CentralServerConnection * conn = dynamic_cast(&source); @@ -723,10 +717,10 @@ void LoginServer::receiveMessage(const MessageDispatch::Emitter & source, const // send failure back to originating server TransferReplyMoveValidation reply(request.getTransferRequestSource(), request.getTrack(), request.getSourceStationId(), request.getDestinationStationId(), request.getSourceGalaxy(), request.getDestinationGalaxy(), request.getSourceCharacter(), request.getSourceCharacterId(), request.getSourceCharacterTemplateId(), request.getDestinationCharacter(), request.getCustomerLocalizedLanguage(), result); const CentralServerConnection * conn = dynamic_cast(&source); - if(conn) + if (conn) { ClusterListEntry * sourceEntry = findClusterById(conn->getClusterId()); - if(sourceEntry && sourceEntry->m_centralServerConnection) + if (sourceEntry && sourceEntry->m_centralServerConnection) { sourceEntry->m_centralServerConnection->send(reply, true); } @@ -776,7 +770,7 @@ void LoginServer::receiveMessage(const MessageDispatch::Emitter & source, const if (cle) { std::vector::iterator i = cle->m_connectionServers.begin(); - for (; i!= cle->m_connectionServers.end(); ++i) + for (; i != cle->m_connectionServers.end(); ++i) { if (i->id == msg.getId()) { @@ -789,7 +783,6 @@ void LoginServer::receiveMessage(const MessageDispatch::Emitter & source, const std::sort(cle->m_connectionServers.begin(), cle->m_connectionServers.end(), ConnectionServerEntryLessThan()); } } - } else if (message.isType("UpdatePlayerCountMessage")) { @@ -805,9 +798,9 @@ void LoginServer::receiveMessage(const MessageDispatch::Emitter & source, const // We only want to update the clients if some "threshold" has been crossed if ((cle->m_notRecommendedCentral != msg.getLoadedRecently()) - || hasCrossedThreshold(cle->m_onlineTutorialLimit, cle->m_numTutorialPlayers, tutorialPlayerCount) - || hasCrossedThreshold(cle->m_onlineFreeTrialLimit, cle->m_numFreeTrialPlayers, msg.getFreeTrialCount()) - || hasCrossedThreshold(cle->m_onlinePlayerLimit, cle->m_numPlayers, msg.getCount())) + || hasCrossedThreshold(cle->m_onlineTutorialLimit, cle->m_numTutorialPlayers, tutorialPlayerCount) + || hasCrossedThreshold(cle->m_onlineFreeTrialLimit, cle->m_numFreeTrialPlayers, msg.getFreeTrialCount()) + || hasCrossedThreshold(cle->m_onlinePlayerLimit, cle->m_numPlayers, msg.getCount())) { m_clusterStatusChanged = true; } @@ -828,7 +821,7 @@ void LoginServer::receiveMessage(const MessageDispatch::Emitter & source, const if (conn) DatabaseConnection::getInstance().renameCharacter(conn->getClusterId(), msg.getCharacterId(), msg.getNewName(), nullptr); else - WARNING_STRICT_FATAL(true,("Got RenameCharacterMessage from something other than CentralServerConnection.\n")); + WARNING_STRICT_FATAL(true, ("Got RenameCharacterMessage from something other than CentralServerConnection.\n")); } else if (message.isType("LoginCreateCharacterMessage")) { @@ -836,7 +829,7 @@ void LoginServer::receiveMessage(const MessageDispatch::Emitter & source, const LoginCreateCharacterMessage msg(ri); const CentralServerConnection *conn = dynamic_cast(&source); if (conn) - DatabaseConnection::getInstance().createCharacter(conn->getClusterId(),msg.getStationId(),msg.getCharacterName(),msg.getCharacterObjectId(),msg.getTemplateId(), msg.getJedi()); + DatabaseConnection::getInstance().createCharacter(conn->getClusterId(), msg.getStationId(), msg.getCharacterName(), msg.getCharacterObjectId(), msg.getTemplateId(), msg.getJedi()); } else if (message.isType("LoginRestoreCharacterMessage")) { @@ -844,7 +837,7 @@ void LoginServer::receiveMessage(const MessageDispatch::Emitter & source, const LoginRestoreCharacterMessage msg(ri); const CentralServerConnection *conn = dynamic_cast(&source); if (conn) - DatabaseConnection::getInstance().restoreCharacter(conn->getClusterId(),msg.getWhoRequested(),msg.getAccount(),msg.getCharacterName(),msg.getCharacterId(),msg.getTemplateId(), msg.getJedi()); + DatabaseConnection::getInstance().restoreCharacter(conn->getClusterId(), msg.getWhoRequested(), msg.getAccount(), msg.getCharacterName(), msg.getCharacterId(), msg.getTemplateId(), msg.getJedi()); } else if (message.isType("LoginUpgradeAccountMessage")) { @@ -852,7 +845,7 @@ void LoginServer::receiveMessage(const MessageDispatch::Emitter & source, const LoginUpgradeAccountMessage *msg = new LoginUpgradeAccountMessage(ri); const CentralServerConnection *conn = dynamic_cast(&source); if (conn) - DatabaseConnection::getInstance().upgradeAccount(msg,conn->getClusterId()); + DatabaseConnection::getInstance().upgradeAccount(msg, conn->getClusterId()); } else if (message.isType("ClaimRewardsMessage")) { @@ -960,7 +953,7 @@ void LoginServer::receiveMessage(const MessageDispatch::Emitter & source, const if (conn) PurgeManager::handlePurgeCompleteOnCluster(msg.getValue(), conn->getClusterId()); else - WARNING_STRICT_FATAL(true,("Programmer bug: got PurgeCompleteMessage from something that couldn't be cast to a CentralServerConnection")); + WARNING_STRICT_FATAL(true, ("Programmer bug: got PurgeCompleteMessage from something that couldn't be cast to a CentralServerConnection")); } else if (message.isType("OccupyUnlockedSlotReq")) { @@ -1010,11 +1003,11 @@ void LoginServer::validateAccount(const StationId& stationId, uint32 clusterId, // allow logins unless the cluster is full bool clientIsInternal = false; ClientConnection *conn = getValidatedClient(stationId); - if (conn) + if (conn) { clientIsInternal = AdminAccountManager::isInternalIp(conn->getRemoteAddress()); } - + if (clientIsInternal && ConfigLoginServer::getInternalBypassOnlineLimit()) { canLogin = true; @@ -1022,17 +1015,17 @@ void LoginServer::validateAccount(const StationId& stationId, uint32 clusterId, else if (cle->m_numPlayers <= cle->m_onlinePlayerLimit) { canLogin = true; - + // Check cluster npe user limit if (cle->m_numTutorialPlayers > cle->m_onlineTutorialLimit) { - canCreateRegular=false; - canCreateJedi=false; + canCreateRegular = false; + canCreateJedi = false; } - + // limit login/character creation based on subscription feature bits - if ( ((subscriptionBits & ClientSubscriptionFeature::FreeTrial) != 0) - && ((subscriptionBits & ClientSubscriptionFeature::Base) == 0)) + if (((subscriptionBits & ClientSubscriptionFeature::FreeTrial) != 0) + && ((subscriptionBits & ClientSubscriptionFeature::Base) == 0)) { // Check cluster free trial user limit if (cle->m_numFreeTrialPlayers > cle->m_onlineFreeTrialLimit) @@ -1042,25 +1035,25 @@ void LoginServer::validateAccount(const StationId& stationId, uint32 clusterId, // Check cluster free trial character creation if (!cle->m_freeTrialCanCreateChar) { - canCreateRegular=false; - canCreateJedi=false; + canCreateRegular = false; + canCreateJedi = false; } } } if (!canLogin) { - canCreateRegular=false; - canCreateJedi=false; - canSkipTutorial=false; + canCreateRegular = false; + canCreateJedi = false; + canSkipTutorial = false; } // check if we want to allow skip tutorial to all if (ConfigLoginServer::getAllowSkipTutorialToAll()) - canSkipTutorial=true; + canSkipTutorial = true; ValidateAccountReplyMessage msg(stationId, canLogin, canCreateRegular, canCreateJedi, canSkipTutorial, track, consumedRewardEvents, claimedRewardItems); - cle->m_centralServerConnection->send(msg,true); + cle->m_centralServerConnection->send(msg, true); } } @@ -1095,7 +1088,7 @@ void LoginServer::validateAccountForTransfer(const TransferRequestMoveValidation } ClusterListEntry * cle = findClusterById(clusterId); - if(cle && cle->m_centralServerConnection) + if (cle && cle->m_centralServerConnection) { TransferReplyMoveValidation response(request.getTransferRequestSource(), request.getTrack(), request.getSourceStationId(), request.getDestinationStationId(), request.getSourceGalaxy(), request.getDestinationGalaxy(), request.getSourceCharacter(), request.getSourceCharacterId(), sourceCharacterTemplateId, request.getDestinationCharacter(), request.getCustomerLocalizedLanguage(), (canCreateRegular ? TransferReplyMoveValidation::TRMVR_can_create_regular_character : TransferReplyMoveValidation::TRMVR_cannot_create_regular_character)); cle->m_centralServerConnection->send(response, true); @@ -1126,7 +1119,7 @@ void LoginServer::run(void) mon->add(masterChannel, WORLD_COUNT_CHANNEL); std::string host = NetworkHandler::getHostName().c_str(); size_t dotPos = host.find("."); - if(dotPos != host.npos) + if (dotPos != host.npos) { host = host.substr(0, dotPos - 1); } @@ -1136,11 +1129,11 @@ void LoginServer::run(void) mon->add("Galaxies", CLUSTER_COUNT_CHANNEL); - while(!getInstance().done) + while (!getInstance().done) { startTime = Clock::timeMs(); IGNORE_RETURN(Os::update()); - if(getInstance().keyServer->update()) + if (getInstance().keyServer->update()) { getInstance().pushKeyToAllServers(); } @@ -1149,10 +1142,10 @@ void LoginServer::run(void) { Os::sleep(1); NetworkHandler::update(); - } while(Clock::timeMs() - startTime < limit); + } while (Clock::timeMs() - startTime < limit); DatabaseConnection::getInstance().update(); - PurgeManager::update(static_cast(limit)/ 1000.0f); + PurgeManager::update(static_cast(limit) / 1000.0f); if (getInstance().m_clusterStatusChanged) { getInstance().sendClusterStatusToAll(); @@ -1175,9 +1168,9 @@ void LoginServer::run(void) mon->set(WORLD_COUNT_CHANNEL, static_cast(getInstance().m_clientMap.size())); int count = 0; ClusterListType::const_iterator i; - for(i = getInstance().m_clusterList.begin(); i != getInstance().m_clusterList.end(); ++i) + for (i = getInstance().m_clusterList.begin(); i != getInstance().m_clusterList.end(); ++i) { - if((*i)->m_connected) + if ((*i)->m_connected) ++count; } mon->set(CLUSTER_COUNT_CHANNEL, count); @@ -1194,7 +1187,6 @@ void LoginServer::run(void) NetworkHandler::remove(); } - //----------------------------------------------------------------------- void LoginServer::sendAvatarList(const StationId& stationId, int stationIdNumberJediSlot, const AvatarList &avatars, TransferCharacterData * const transferData) @@ -1203,7 +1195,7 @@ void LoginServer::sendAvatarList(const StationId& stationId, int stationIdNumber chardata.reserve(avatars.size()); EnumerateCharacterId::Chardata temp; - for (AvatarList::const_iterator i=avatars.begin(); i!=avatars.end(); ++i) + for (AvatarList::const_iterator i = avatars.begin(); i != avatars.end(); ++i) { temp.m_name = (*i).m_name; temp.m_objectTemplateId = (*i).m_objectTemplateId; @@ -1216,15 +1208,15 @@ void LoginServer::sendAvatarList(const StationId& stationId, int stationIdNumber EnumerateCharacterId msg(chardata); - if(transferData) + if (transferData) { // send this to the appropriate CentralServer - if(transferData->getSourceCharacterName().empty()) + if (transferData->getSourceCharacterName().empty()) { // CTS API character list request bool result = CentralServerConnection::sendCharacterListResponse(transferData->getSourceStationId(), avatars, *transferData); UNREF(result); - DEBUG_REPORT_LOG(! result,("Could not send avatar list to StationId %lu because connection has been closed.\n",stationId)); + DEBUG_REPORT_LOG(!result, ("Could not send avatar list to StationId %lu because connection has been closed.\n", stationId)); } else { @@ -1234,11 +1226,11 @@ void LoginServer::sendAvatarList(const StationId& stationId, int stationIdNumber if (cle) { // find associated character ID - for (AvatarList::const_iterator i=avatars.begin(); i!=avatars.end(); ++i) + for (AvatarList::const_iterator i = avatars.begin(); i != avatars.end(); ++i) { REPORT_LOG(true, ("checking %s == %s\n", Unicode::wideToNarrow(i->m_name).c_str(), transferData->getSourceCharacterName().c_str())); - if(Unicode::wideToNarrow(i->m_name) == transferData->getSourceCharacterName() - && i->m_clusterId == cle->m_clusterId) + if (Unicode::wideToNarrow(i->m_name) == transferData->getSourceCharacterName() + && i->m_clusterId == cle->m_clusterId) { characterTemplateId = static_cast(i->m_objectTemplateId); characterId = i->m_networkId; @@ -1267,13 +1259,13 @@ void LoginServer::sendAvatarList(const StationId& stationId, int stationIdNumber // this message ***MUST*** be sent first, as the client expects to // receive this information before receiving the avatar list information GenericValueTypeMessage const msgStationIdHasJediSlot("StationIdHasJediSlot", stationIdNumberJediSlot); - conn->send(msgStationIdHasJediSlot,true); + conn->send(msgStationIdHasJediSlot, true); - conn->send(msg,true); + conn->send(msg, true); } else { - DEBUG_REPORT_LOG(true,("Could not send avatar list to StationId %lu.\n",stationId)); + DEBUG_REPORT_LOG(true, ("Could not send avatar list to StationId %lu.\n", stationId)); LOG("LoginClientConnection", ("sendAvatarList() for stationId (%lu), cannot find connection to client for sending avatar list", stationId)); } } @@ -1281,7 +1273,7 @@ void LoginServer::sendAvatarList(const StationId& stationId, int stationIdNumber // ---------------------------------------------------------------------- -void LoginServer::performAccountTransfer (const AvatarList &avatars, TransferAccountData * transferAccountData) +void LoginServer::performAccountTransfer(const AvatarList &avatars, TransferAccountData * transferAccountData) { // grab the station ids StationId sourceStationId = transferAccountData->getSourceStationId(); @@ -1297,14 +1289,14 @@ void LoginServer::performAccountTransfer (const AvatarList &avatars, TransferAcc if (cluster) { - std::string clusterName = cluster->m_clusterName; + std::string clusterName = cluster->m_clusterName; std::string avatarName = Unicode::wideToNarrow(i->m_name); avatarData.push_back(AvatarData(clusterName, avatarName)); - + LOG("CustomerService", ("CharacterTransfer: Sending request to update game db (via cluster: %s) for account transfer from %lu to %lu (avatar: %s)", clusterName.c_str(), sourceStationId, destinationStationId, avatarName.c_str())); const GenericValueTypeMessage message("TransferAccountRequestCentralDatabase", *transferAccountData); - sendToCluster (i->m_clusterId, message); + sendToCluster(i->m_clusterId, message); } else { @@ -1331,38 +1323,38 @@ void LoginServer::onValidateClient(StationId suid, const std::string & username, NOT_NULL(conn); WARNING_STRICT_FATAL(getValidatedClient(suid), ("Validating an already valid client in onValidateClient(). StationId: %d UserName: %s", suid, username.c_str())); - int adminLevel=0; + int adminLevel = 0; const bool isAdminAccount = AdminAccountManager::isAdminAccount(Unicode::toLower(username), adminLevel); if (conn->getRequestedAdminSuid() != 0) { //verify internal, secure, is on the god list - bool loginOK=false; - if(!isSecure) - LOG("CustomerService",("AdminLogin: User %s (account %li) attempted to log into account %li, but was not using a SecureID token", username.c_str(),suid, conn->getRequestedAdminSuid())); + bool loginOK = false; + if (!isSecure) + LOG("CustomerService", ("AdminLogin: User %s (account %li) attempted to log into account %li, but was not using a SecureID token", username.c_str(), suid, conn->getRequestedAdminSuid())); else { if (!AdminAccountManager::isInternalIp(conn->getRemoteAddress())) - LOG("CustomerService",("AdminLogin: User %s (account %li) attempted to log into account %li, but was not logging in from an internal IP", username.c_str(),suid, conn->getRequestedAdminSuid())); + LOG("CustomerService", ("AdminLogin: User %s (account %li) attempted to log into account %li, but was not logging in from an internal IP", username.c_str(), suid, conn->getRequestedAdminSuid())); else { if (!isAdminAccount || adminLevel < 10) - LOG("CustomerService",("AdminLogin: User %s (account %li) attempted to log into account %li, but did not have sufficient permissions", username.c_str(),suid, conn->getRequestedAdminSuid())); + LOG("CustomerService", ("AdminLogin: User %s (account %li) attempted to log into account %li, but did not have sufficient permissions", username.c_str(), suid, conn->getRequestedAdminSuid())); else { suid = conn->getRequestedAdminSuid(); - loginOK=true; + loginOK = true; } } } - + if (!loginOK) { conn->disconnect(); return; } } - + // encrypt the clients credentials with the key, return // the cipher text to the client for use as a connection // token with the central server @@ -1408,35 +1400,35 @@ void LoginServer::onValidateClient(StationId suid, const std::string & username, const LoginClientToken k(a.getBuffer(), static_cast(a.getSize()), static_cast(suid), username); conn->send(k, true); - delete [] keyBuffer; + delete[] keyBuffer; // send cluster enum bool clientInternal = AdminAccountManager::isInternalIp(conn->getRemoteAddress()); - + std::vector data; - for(ClusterListType::const_iterator j = m_clusterList.begin(); j != m_clusterList.end(); ++j) + for (ClusterListType::const_iterator j = m_clusterList.begin(); j != m_clusterList.end(); ++j) { ClusterListEntry *cle = *j; - if (cle && cle->m_clusterId!=0 && cle->m_clusterName.size()!=0 && (clientInternal || !cle->m_secret)) + if (cle && cle->m_clusterId != 0 && cle->m_clusterName.size() != 0 && (clientInternal || !cle->m_secret)) { LoginEnumCluster::ClusterData item; - item.m_clusterId = cle->m_clusterId; + item.m_clusterId = cle->m_clusterId; item.m_clusterName = cle->m_clusterName; - item.m_timeZone = cle->m_timeZone; + item.m_timeZone = cle->m_timeZone; data.push_back(item); } } - - LoginEnumCluster e( data, ConfigLoginServer::getMaxCharactersPerAccount() ); - - conn->send(e,true); + + LoginEnumCluster e(data, ConfigLoginServer::getMaxCharactersPerAccount()); + + conn->send(e, true); //Send off list of cluster that has character //creation disabled, even if the list is empty //***MUST*** be done after sending LoginEnumCluster GenericValueTypeMessage > const msgCharacterCreationDisabledClusterList("CharacterCreationDisabled", ConfigLoginServer::getCharacterCreationDisabledClusterList()); - conn->send(msgCharacterCreationDisabledClusterList,true); + conn->send(msgCharacterCreationDisabledClusterList, true); //Send off request for the avatar list from the database. DatabaseConnection::getInstance().requestAvatarListForAccount(suid, 0); @@ -1459,7 +1451,7 @@ void LoginServer::onValidateClient(StationId suid, const std::string & username, LoginServer::ClusterListEntry *LoginServer::findClusterByName(const std::string &clusterName) { ClusterListType::iterator i; - for (i=m_clusterList.begin(); i!=m_clusterList.end(); ++i) + for (i = m_clusterList.begin(); i != m_clusterList.end(); ++i) { NOT_NULL(*i); // not legal to push nullptr pointers on the vector if ((*i)->m_clusterName == clusterName) @@ -1470,15 +1462,15 @@ LoginServer::ClusterListEntry *LoginServer::findClusterByName(const std::string // ---------------------------------------------------------------------- -uint32 LoginServer::getClusterIDByName( const std::string &sName ) +uint32 LoginServer::getClusterIDByName(const std::string &sName) { - ClusterListEntry const * const p_cluster = findClusterByName( sName ); + ClusterListEntry const * const p_cluster = findClusterByName(sName); return p_cluster ? p_cluster->m_clusterId : 0; } // ---------------------------------------------------------------------- -const std::string & LoginServer::getClusterNameById( uint32 clusterId ) +const std::string & LoginServer::getClusterNameById(uint32 clusterId) { static std::string const empty; @@ -1493,7 +1485,7 @@ const std::string & LoginServer::getClusterNameById( uint32 clusterId ) LoginServer::ClusterListEntry *LoginServer::addCluster(const std::string &clusterName) { - DEBUG_FATAL(!ConfigLoginServer::getDevelopmentMode(),("Programmer bug: addCluster(std::string&) can only be used in development mode.\n")); + DEBUG_FATAL(!ConfigLoginServer::getDevelopmentMode(), ("Programmer bug: addCluster(std::string&) can only be used in development mode.\n")); ClusterListEntry *e = new ClusterListEntry; e->m_clusterName = clusterName; @@ -1503,27 +1495,26 @@ LoginServer::ClusterListEntry *LoginServer::addCluster(const std::string &cluste // ---------------------------------------------------------------------- -void LoginServer::sendExtendedClusterInfo( ClientConnection &client ) const +void LoginServer::sendExtendedClusterInfo(ClientConnection &client) const { std::vector data; - - for(ClusterListType::const_iterator j = m_clusterList.begin(); j != m_clusterList.end(); ++j) + + for (ClusterListType::const_iterator j = m_clusterList.begin(); j != m_clusterList.end(); ++j) { ClusterListEntry *cle = *j; - if ( cle ) + if (cle) { LoginClusterStatusEx::ClusterData item; - item.m_clusterId = cle->m_clusterId; - item.m_branch = cle->m_branch; - item.m_version = cle->m_changelist; + item.m_clusterId = cle->m_clusterId; + item.m_branch = cle->m_branch; + item.m_version = cle->m_changelist; item.m_networkVersion = cle->m_networkVersion; - data.push_back( item ); + data.push_back(item); } - } - - client.send( LoginClusterStatusEx( data ), true ); + + client.send(LoginClusterStatusEx(data), true); } // ---------------------------------------------------------------------- @@ -1536,15 +1527,15 @@ void LoginServer::sendExtendedClusterInfo( ClientConnection &client ) const */ void LoginServer::sendClusterStatus(ClientConnection &conn) const { - const bool clientIsPrivate = AdminAccountManager::isInternalIp(conn.getRemoteAddress()); - const unsigned int subscriptionBits = conn.getSubscriptionBits(); - const bool isFreeTrialAccount = ( ((subscriptionBits & ClientSubscriptionFeature::FreeTrial) != 0) - && ((subscriptionBits & ClientSubscriptionFeature::Base) == 0)); + const bool clientIsPrivate = AdminAccountManager::isInternalIp(conn.getRemoteAddress()); + const unsigned int subscriptionBits = conn.getSubscriptionBits(); + const bool isFreeTrialAccount = (((subscriptionBits & ClientSubscriptionFeature::FreeTrial) != 0) + && ((subscriptionBits & ClientSubscriptionFeature::Base) == 0)); std::vector data; std::vector dataEx; - - for(ClusterListType::const_iterator j = m_clusterList.begin(); j != m_clusterList.end(); ++j) + + for (ClusterListType::const_iterator j = m_clusterList.begin(); j != m_clusterList.end(); ++j) { ClusterListEntry *cle = *j; // Cluster is OK for login if @@ -1553,26 +1544,26 @@ void LoginServer::sendClusterStatus(ClientConnection &conn) const // 3) We have at least one Connection Server // 4) Client is internal or the cluster is not secret // 5) Cluster has told us its ready for players - if (cle && cle->m_clusterId!=0 && cle->m_connected && !cle->m_connectionServers.empty() && (clientIsPrivate || !cle->m_secret)) + if (cle && cle->m_clusterId != 0 && cle->m_connected && !cle->m_connectionServers.empty() && (clientIsPrivate || !cle->m_secret)) { - DEBUG_FATAL(!cle->m_centralServerConnection,("Programmer bug: m_connected was true but m_centralServerConnection was nullptr\n")); + DEBUG_FATAL(!cle->m_centralServerConnection, ("Programmer bug: m_connected was true but m_centralServerConnection was nullptr\n")); LoginClusterStatus::ClusterData item; item.m_clusterId = cle->m_clusterId; item.m_timeZone = cle->m_timeZone; -// size_t connectionServerChoice = Random::random(cle->m_connectionServers.size() - 1); //lint !e713 !e732 // loss of precision (arg no 1) + // size_t connectionServerChoice = Random::random(cle->m_connectionServers.size() - 1); //lint !e713 !e732 // loss of precision (arg no 1) ConnectionServerEntry &connServer = cle->m_connectionServers[0]; - item.m_connectionServerAddress = connServer.clientServiceAddress; - if(clientIsPrivate) + item.m_connectionServerAddress = connServer.clientServiceAddress; + if (clientIsPrivate) { - item.m_connectionServerPort = connServer.clientServicePortPrivate; + item.m_connectionServerPort = connServer.clientServicePortPrivate; } else { - item.m_connectionServerPort = connServer.clientServicePortPublic; + item.m_connectionServerPort = connServer.clientServicePortPublic; } - if(item.m_connectionServerPort) + if (item.m_connectionServerPort) { item.m_connectionServerPingPort = connServer.pingPort; @@ -1580,27 +1571,27 @@ void LoginServer::sendClusterStatus(ClientConnection &conn) const // population count to secured internal connections with // admin privilege >= 10 if (clientIsPrivate && conn.getIsSecure() && (conn.getAdminLevel() >= 10)) - item.m_populationOnline = cle->m_numPlayers; + item.m_populationOnline = cle->m_numPlayers; else - item.m_populationOnline = -1; + item.m_populationOnline = -1; const int percentFull = cle->m_numPlayers * 100 / cle->m_onlinePlayerLimit; if (percentFull >= 100) item.m_populationOnlineStatus = LoginClusterStatus::ClusterData::PS_full; else if (percentFull >= ConfigLoginServer::getPopulationExtremelyHeavyThresholdPercent()) item.m_populationOnlineStatus = LoginClusterStatus::ClusterData::PS_extremely_heavy; - else if (percentFull >= ConfigLoginServer::getPopulationVeryHeavyThresholdPercent()) + else if (percentFull >= ConfigLoginServer::getPopulationVeryHeavyThresholdPercent()) item.m_populationOnlineStatus = LoginClusterStatus::ClusterData::PS_very_heavy; - else if (percentFull >= ConfigLoginServer::getPopulationHeavyThresholdPercent()) + else if (percentFull >= ConfigLoginServer::getPopulationHeavyThresholdPercent()) item.m_populationOnlineStatus = LoginClusterStatus::ClusterData::PS_heavy; - else if (percentFull >= ConfigLoginServer::getPopulationMediumThresholdPercent()) + else if (percentFull >= ConfigLoginServer::getPopulationMediumThresholdPercent()) item.m_populationOnlineStatus = LoginClusterStatus::ClusterData::PS_medium; - else if (percentFull >= ConfigLoginServer::getPopulationLightThresholdPercent()) + else if (percentFull >= ConfigLoginServer::getPopulationLightThresholdPercent()) item.m_populationOnlineStatus = LoginClusterStatus::ClusterData::PS_light; - else + else item.m_populationOnlineStatus = LoginClusterStatus::ClusterData::PS_very_light; - item.m_maxCharactersPerAccount = cle->m_maxCharactersPerAccount; + item.m_maxCharactersPerAccount = cle->m_maxCharactersPerAccount; if (cle->m_readyForPlayers) { item.m_status = LoginClusterStatus::ClusterData::S_up; @@ -1611,7 +1602,7 @@ void LoginServer::sendClusterStatus(ClientConnection &conn) const item.m_status = LoginClusterStatus::ClusterData::S_restricted; } if ((cle->m_numPlayers >= cle->m_onlinePlayerLimit) - || (isFreeTrialAccount && (cle->m_numFreeTrialPlayers >= cle->m_onlineFreeTrialLimit))) + || (isFreeTrialAccount && (cle->m_numFreeTrialPlayers >= cle->m_onlineFreeTrialLimit))) { item.m_status = LoginClusterStatus::ClusterData::S_full; } @@ -1620,31 +1611,30 @@ void LoginServer::sendClusterStatus(ClientConnection &conn) const item.m_status = LoginClusterStatus::ClusterData::S_loading; if (cle->m_locked && !clientIsPrivate) item.m_status = LoginClusterStatus::ClusterData::S_locked; // locked takes precedence over up or loading - + item.m_dontRecommend = (cle->m_notRecommendedDatabase || cle->m_notRecommendedCentral); - item.m_onlinePlayerLimit = cle->m_onlinePlayerLimit; - item.m_onlineFreeTrialLimit = cle->m_onlineFreeTrialLimit; - + item.m_onlinePlayerLimit = cle->m_onlinePlayerLimit; + item.m_onlineFreeTrialLimit = cle->m_onlineFreeTrialLimit; + data.push_back(item); } ++connServer.numClients; std::sort(cle->m_connectionServers.begin(), cle->m_connectionServers.end(), ConnectionServerEntryLessThan()); - } - - if ( cle ) + + if (cle) { LoginClusterStatusEx::ClusterData itemEx; itemEx.m_clusterId = cle->m_clusterId; - itemEx.m_branch = cle->m_branch; - itemEx.m_version = cle->m_changelist; - dataEx.push_back( itemEx ); + itemEx.m_branch = cle->m_branch; + itemEx.m_version = cle->m_changelist; + dataEx.push_back(itemEx); } } LoginClusterStatus msg(data); - conn.send(msg,true); + conn.send(msg, true); } // ---------------------------------------------------------------------- @@ -1654,7 +1644,7 @@ void LoginServer::sendClusterStatus(ClientConnection &conn) const */ void LoginServer::sendClusterStatusToAll() const { - for (std::map::const_iterator i=m_validatedClientMap.begin(); i!=m_validatedClientMap.end(); ++i) + for (std::map::const_iterator i = m_validatedClientMap.begin(); i != m_validatedClientMap.end(); ++i) { if (i->second) sendClusterStatus(*(i->second)); @@ -1664,29 +1654,30 @@ void LoginServer::sendClusterStatusToAll() const // ---------------------------------------------------------------------- LoginServer::ClusterListEntry::ClusterListEntry() : - m_clusterId(0), - m_clusterName(), - m_centralServerConnection(0), - m_connectionServers(), - m_numPlayers(0), - m_numFreeTrialPlayers(0), - m_numTutorialPlayers(0), - m_maxCharacters(ConfigLoginServer::getMaxCharactersPerCluster()), - m_maxCharactersPerAccount(0), - m_onlinePlayerLimit(0), - m_onlineFreeTrialLimit(0), - m_onlineTutorialLimit(0), - m_freeTrialCanCreateChar(false), - m_timeZone(0), - m_connected(false), - m_address(""), - m_port(0), - m_allowReconnect(true), - m_secret(false), - m_readyForPlayers(false), - m_locked(false), - m_notRecommendedDatabase(false), - m_notRecommendedCentral(false) + m_clusterId(0), + m_clusterName(), + m_centralServerConnection(0), + m_connectionServers(), + m_numPlayers(0), + m_numFreeTrialPlayers(0), + m_numTutorialPlayers(0), + m_maxCharacters(ConfigLoginServer::getMaxCharactersPerCluster()), + m_maxCharactersPerAccount(0), + m_onlinePlayerLimit(0), + m_onlineFreeTrialLimit(0), + m_onlineTutorialLimit(0), + m_freeTrialCanCreateChar(false), + m_timeZone(0), + m_connected(false), + m_address(""), + m_port(0), + m_allowReconnect(true), + m_secret(false), + m_readyForPlayers(false), + m_locked(false), + m_notRecommendedDatabase(false), + m_notRecommendedCentral(false), + m_changelist(0) { } @@ -1713,26 +1704,26 @@ void LoginServer::updateClusterData(uint32 clusterId, const std::string &cluster // refreshing data on a cluster we already know about if ((cle->m_clusterName != clusterName) || (cle->m_address != address) || (cle->m_port != port)) { - DEBUG_REPORT_LOG(true,("Disconnecting from cluster %lu because its data has changed in the database.\n",clusterId)); - disconnectCluster(*cle,true,true); + DEBUG_REPORT_LOG(true, ("Disconnecting from cluster %lu because its data has changed in the database.\n", clusterId)); + disconnectCluster(*cle, true, true); } } } if (!cle) { - DEBUG_REPORT_LOG(true,("Cluster %lu: %s\n", clusterId, clusterName.c_str())); + DEBUG_REPORT_LOG(true, ("Cluster %lu: %s\n", clusterId, clusterName.c_str())); cle = new ClusterListEntry; m_clusterList.push_back(cle); } if ((cle->m_secret != secret) - || (cle->m_locked != locked) - || (cle->m_onlinePlayerLimit != onlinePlayerLimit) - || (cle->m_onlineFreeTrialLimit != onlineFreeTrialLimit) - || (cle->m_freeTrialCanCreateChar != freeTrialCanCreateChar) - || (cle->m_onlineTutorialLimit != onlineTutorialLimit)) + || (cle->m_locked != locked) + || (cle->m_onlinePlayerLimit != onlinePlayerLimit) + || (cle->m_onlineFreeTrialLimit != onlineFreeTrialLimit) + || (cle->m_freeTrialCanCreateChar != freeTrialCanCreateChar) + || (cle->m_onlineTutorialLimit != onlineTutorialLimit)) { // The cluster may now be locked/unlocked to some players, so let them know m_clusterStatusChanged = true; @@ -1742,7 +1733,7 @@ void LoginServer::updateClusterData(uint32 clusterId, const std::string &cluster if (((cle->m_locked != locked) || (cle->m_secret != secret)) && cle->m_connected && cle->m_centralServerConnection) { GenericValueTypeMessage > const msgState("UpdateClusterLockedAndSecretState", std::make_pair(locked, secret)); - cle->m_centralServerConnection->send(msgState,true); + cle->m_centralServerConnection->send(msgState, true); } bool const clusterIdSet = ((cle->m_clusterId == 0) && (clusterId > 0)); @@ -1806,7 +1797,7 @@ void LoginServer::disconnectCluster(ClusterListEntry &cle, bool const forceDisco // started, and the LoginServer will connect to it if (!ConfigLoginServer::getDevelopmentMode() && reconnect) { - for (ClusterListType::iterator i=m_clusterList.begin(); i!=m_clusterList.end(); ++i) + for (ClusterListType::iterator i = m_clusterList.begin(); i != m_clusterList.end(); ++i) { NOT_NULL(*i); if (!(*i)->m_centralServerConnection && !(*i)->m_allowReconnect && ((*i)->m_address == cle.m_address)) @@ -1824,7 +1815,7 @@ void LoginServer::disconnectCluster(ClusterListEntry &cle, bool const forceDisco */ void LoginServer::onClusterRegistered(uint32 clusterId, const std::string &clusterName) { - DEBUG_FATAL(!ConfigLoginServer::getDevelopmentMode(),("Programmer bug: should not be registering new clusters automatically unless running in development mode.\n")); + DEBUG_FATAL(!ConfigLoginServer::getDevelopmentMode(), ("Programmer bug: should not be registering new clusters automatically unless running in development mode.\n")); static std::string noAddress(""); updateClusterData(clusterId, clusterName, noAddress, 0, false, false, false, 8, 100, 100, true, 350); } @@ -1838,7 +1829,7 @@ void LoginServer::onClusterRegistered(uint32 clusterId, const std::string &clust LoginServer::ClusterListEntry * LoginServer::findClusterById(uint32 clusterId) { ClusterListType::const_iterator i; - for (i=m_clusterList.begin(); i!=m_clusterList.end(); ++i) + for (i = m_clusterList.begin(); i != m_clusterList.end(); ++i) { NOT_NULL(*i); // not legal to push nullptr pointers on the vector if ((*i)->m_clusterId == clusterId) @@ -1857,7 +1848,7 @@ LoginServer::ClusterListEntry * LoginServer::findClusterById(uint32 clusterId) LoginServer::ClusterListEntry * LoginServer::findClusterByConnection(const CentralServerConnection *connection) { ClusterListType::const_iterator i; - for (i=m_clusterList.begin(); i!=m_clusterList.end(); ++i) + for (i = m_clusterList.begin(); i != m_clusterList.end(); ++i) { NOT_NULL(*i); // not legal to push nullptr pointers on the vector if ((*i)->m_centralServerConnection == connection) @@ -1874,7 +1865,7 @@ void LoginServer::refreshConnections() if (ConfigLoginServer::getDevelopmentMode()) return; // in development mode, we don't establish any connections ClusterListType::iterator i; - for (i=m_clusterList.begin(); i!=m_clusterList.end(); ++i) + for (i = m_clusterList.begin(); i != m_clusterList.end(); ++i) { NOT_NULL(*i); if (!(*i)->m_centralServerConnection && (*i)->m_allowReconnect) @@ -1890,13 +1881,13 @@ void LoginServer::refreshConnections() // ---------------------------------------------------------------------- -void LoginServer::sendToCluster (uint32 clusterId, const GameNetworkMessage &message) +void LoginServer::sendToCluster(uint32 clusterId, const GameNetworkMessage &message) { ClusterListEntry *cle = findClusterById(clusterId); if (cle && cle->m_connected && cle->m_centralServerConnection) - cle->m_centralServerConnection->send(message,true); + cle->m_centralServerConnection->send(message, true); else - DEBUG_REPORT_LOG(true,("Could not send message to cluster %lu because it was not connected.\n",clusterId)); + DEBUG_REPORT_LOG(true, ("Could not send message to cluster %lu because it was not connected.\n", clusterId)); } //----------------------------------------------------------------------- @@ -1911,10 +1902,10 @@ void LoginServer::setDone(const bool isDone) void LoginServer::sendToAllClusters(GameNetworkMessage const & message, Connection const * excludeCentralConnection /*= nullptr*/, uint32 excludeClusterId /*= 0*/, char const * excludeClusterName /*= nullptr*/) { ClusterListType::const_iterator i; - for (i=m_clusterList.begin(); i!=m_clusterList.end(); ++i) + for (i = m_clusterList.begin(); i != m_clusterList.end(); ++i) { if (NON_NULL(*i)->m_connected && (*i)->m_centralServerConnection && ((*i)->m_centralServerConnection != excludeCentralConnection) && ((*i)->m_clusterId != excludeClusterId) && ((excludeClusterName == nullptr) || _stricmp(excludeClusterName, (*i)->m_centralServerConnection->getClusterName().c_str()))) - (*i)->m_centralServerConnection->send(message,true); + (*i)->m_centralServerConnection->send(message, true); } } @@ -1924,9 +1915,9 @@ bool LoginServer::areAllClustersUp() const { if (m_clusterList.empty()) return false; - + ClusterListType::const_iterator i; - for (i=m_clusterList.begin(); i!=m_clusterList.end(); ++i) + for (i = m_clusterList.begin(); i != m_clusterList.end(); ++i) { if (!(NON_NULL(*i)->m_readyForPlayers)) return false; @@ -1936,16 +1927,15 @@ bool LoginServer::areAllClustersUp() const // ---------------------------------------------------------------------- -void LoginServer::getAllClusterNamesAndIDs( std::map< std::string, uint32 > &results ) const +void LoginServer::getAllClusterNamesAndIDs(std::map< std::string, uint32 > &results) const { results.clear(); - for (ClusterListType::const_iterator i=m_clusterList.begin(); i!=m_clusterList.end(); ++i) + for (ClusterListType::const_iterator i = m_clusterList.begin(); i != m_clusterList.end(); ++i) { - if( !*i ) + if (!*i) continue; - results[ (*i)->m_clusterName ] = (*i)->m_clusterId; + results[(*i)->m_clusterName] = (*i)->m_clusterId; } - } // ---------------------------------------------------------------------- @@ -1953,22 +1943,22 @@ void LoginServer::getAllClusterNamesAndIDs( std::map< std::string, uint32 > &res void LoginServer::getClusterIds(std::vector result) { result.reserve(m_clusterList.size()); - for (ClusterListType::const_iterator i=m_clusterList.begin(); i!=m_clusterList.end(); ++i) + for (ClusterListType::const_iterator i = m_clusterList.begin(); i != m_clusterList.end(); ++i) result.push_back(NON_NULL(*i)->m_clusterId); } // ---------------------------------------------------------------------- -void LoginServer::setClusterInfoByName( const std::string &name, const std::string &branch, int changelist, const std::string &networkVersion ) +void LoginServer::setClusterInfoByName(const std::string &name, const std::string &branch, int changelist, const std::string &networkVersion) { - ClusterListEntry *entry = findClusterByName( name ); - - if ( entry ) + ClusterListEntry *entry = findClusterByName(name); + + if (entry) { - entry->m_branch = branch; - entry->m_changelist = changelist; + entry->m_branch = branch; + entry->m_changelist = changelist; entry->m_networkVersion = networkVersion; } } -// ====================================================================== +// ====================================================================== \ No newline at end of file diff --git a/engine/server/application/LoginServer/src/shared/TaskEnableCharacter.cpp b/engine/server/application/LoginServer/src/shared/TaskEnableCharacter.cpp index b72adbe3..209d613d 100755 --- a/engine/server/application/LoginServer/src/shared/TaskEnableCharacter.cpp +++ b/engine/server/application/LoginServer/src/shared/TaskEnableCharacter.cpp @@ -18,12 +18,13 @@ // ====================================================================== TaskEnableCharacter::TaskEnableCharacter(StationId &stationId, const NetworkId &characterId, const std::string &whoRequested, bool enabled, uint32 clusterId) : - TaskRequest(), - m_stationId(stationId), - m_characterId(characterId), - m_whoRequested(whoRequested), - m_enabled(enabled), - m_clusterId(clusterId) + TaskRequest(), + m_stationId(stationId), + m_characterId(characterId), + m_whoRequested(whoRequested), + m_enabled(enabled), + m_clusterId(clusterId), + m_result(0) { } @@ -32,16 +33,15 @@ TaskEnableCharacter::TaskEnableCharacter(StationId &stationId, const NetworkId & bool TaskEnableCharacter::process(DB::Session *session) { EnableCharacterQuery qry; - qry.station_id=static_cast(m_stationId); - qry.character_id=m_characterId; + qry.station_id = static_cast(m_stationId); + qry.character_id = m_characterId; qry.enabled.setValue(m_enabled); bool rval = session->exec(&qry); - + qry.done(); m_result = qry.result.getValue(); return rval; - } // ---------------------------------------------------------------------- @@ -51,34 +51,34 @@ void TaskEnableCharacter::onComplete() std::string message; switch (m_result) { - case 1: - if (m_enabled) - message = "Character enabled."; - else - message = "Character disabled."; - break; + case 1: + if (m_enabled) + message = "Character enabled."; + else + message = "Character disabled."; + break; - case 2: - message = "Could not find Character"; - break; + case 2: + message = "Could not find Character"; + break; - default: - message = "The database returned an unknown error code"; - break; + default: + message = "The database returned an unknown error code"; + break; } - + GenericValueTypeMessage > reply("EnableCharacterReplyMessage", - std::make_pair(m_whoRequested, message)); + std::make_pair(m_whoRequested, message)); LoginServer::getInstance().sendToCluster(m_clusterId, reply); } // ---------------------------------------------------------------------- TaskEnableCharacter::EnableCharacterQuery::EnableCharacterQuery() : - Query(), - station_id(), - character_id(), - enabled() + Query(), + station_id(), + character_id(), + enabled() { } @@ -87,7 +87,6 @@ TaskEnableCharacter::EnableCharacterQuery::EnableCharacterQuery() : void TaskEnableCharacter::EnableCharacterQuery::getSQL(std::string &sql) { sql = std::string("begin :result := ") + DatabaseConnection::getInstance().getSchemaQualifier() + "login.enable_disable_character(:station_id, :character_id, :enabled); end;"; - } // ---------------------------------------------------------------------- @@ -116,4 +115,4 @@ DB::Query::QueryMode TaskEnableCharacter::EnableCharacterQuery::getExecutionMode return MODE_PROCEXEC; } -// ====================================================================== +// ====================================================================== \ No newline at end of file diff --git a/engine/server/application/LoginServer/src/shared/TaskGetAccountForPurge.cpp b/engine/server/application/LoginServer/src/shared/TaskGetAccountForPurge.cpp index bc755e82..061b1c4d 100755 --- a/engine/server/application/LoginServer/src/shared/TaskGetAccountForPurge.cpp +++ b/engine/server/application/LoginServer/src/shared/TaskGetAccountForPurge.cpp @@ -30,7 +30,7 @@ namespace TaskGetAccountForPurgeNamespace virtual QueryMode getExecutionMode() const; StationId getAccount() const; - + private: DB::BindableLong m_account; DB::BindableLong m_min_age; @@ -46,8 +46,9 @@ using namespace TaskGetAccountForPurgeNamespace; // ====================================================================== TaskGetAccountForPurge::TaskGetAccountForPurge(int purgePhase) : - DB::TaskRequest(), - m_purgePhase(purgePhase) + DB::TaskRequest(), + m_purgePhase(purgePhase), + m_account(0) { } @@ -71,12 +72,11 @@ void TaskGetAccountForPurge::onComplete() // ====================================================================== - GetAccountForPurgeQuery::GetAccountForPurgeQuery(int purgePhase, int minAge) : - Query(), - m_account(), - m_min_age(minAge), - m_purge_phase(purgePhase) + Query(), + m_account(), + m_min_age(minAge), + m_purge_phase(purgePhase) { } @@ -84,7 +84,7 @@ GetAccountForPurgeQuery::GetAccountForPurgeQuery(int purgePhase, int minAge) : void GetAccountForPurgeQuery::getSQL(std::string &sql) { - sql=std::string("begin :account := ")+DatabaseConnection::getInstance().getSchemaQualifier()+"purge_process.get_account_for_purge(:purge_phase, :min_age); end;"; + sql = std::string("begin :account := ") + DatabaseConnection::getInstance().getSchemaQualifier() + "purge_process.get_account_for_purge(:purge_phase, :min_age); end;"; } // ---------------------------------------------------------------------- @@ -121,4 +121,4 @@ StationId GetAccountForPurgeQuery::getAccount() const return 0; } -// ====================================================================== +// ====================================================================== \ No newline at end of file diff --git a/engine/server/application/LoginServer/src/shared/TaskGetValidationData.cpp b/engine/server/application/LoginServer/src/shared/TaskGetValidationData.cpp index d646b57c..735e9e7a 100755 --- a/engine/server/application/LoginServer/src/shared/TaskGetValidationData.cpp +++ b/engine/server/application/LoginServer/src/shared/TaskGetValidationData.cpp @@ -46,8 +46,8 @@ namespace TaskGetValidationDataNamespace public: GetCompletedTutorialQuery(StationId stationId); - DB::BindableLong station_id; - DB::BindableBool completed_tutorial; + DB::BindableLong station_id; + DB::BindableBool completed_tutorial; virtual void getSQL(std::string &sql); virtual bool bindParameters(); @@ -72,13 +72,13 @@ namespace TaskGetValidationDataNamespace std::string getEventId() const; uint32 getClusterId() const; NetworkId const getCharacterId() const; - + private: DB::BindableLong station_id; DB::BindableString<100> event_id; DB::BindableLong cluster_id; DB::BindableNetworkId character_id; - + private: //disable GetConsumedRewardEventsQuery(); GetConsumedRewardEventsQuery(const GetConsumedRewardEventsQuery&); @@ -119,13 +119,13 @@ namespace TaskGetValidationDataNamespace DB::BindableLong cluster_id; //lint !e1925 // public data member DB::BindableLong result; //lint !e1925 // public data member - virtual void getSQL (std::string &sql); - virtual bool bindParameters (); - virtual bool bindColumns (); - virtual QueryMode getExecutionMode () const; + virtual void getSQL(std::string &sql); + virtual bool bindParameters(); + virtual bool bindColumns(); + virtual QueryMode getExecutionMode() const; private: //disable - IsClusterAtLimitQuery (const IsClusterAtLimitQuery&); + IsClusterAtLimitQuery(const IsClusterAtLimitQuery&); IsClusterAtLimitQuery &operator= (const IsClusterAtLimitQuery&); }; } @@ -134,36 +134,37 @@ using namespace TaskGetValidationDataNamespace; // ====================================================================== -TaskGetValidationData::TaskGetValidationData (StationId stationId, int clusterGroupId, uint32 clusterId, unsigned int track, uint32 subscriptionBits) : - TaskRequest(), - m_stationId(stationId), - m_clusterGroupId(clusterGroupId), - m_clusterId(clusterId), - m_openCharacterSlots(4,0), - m_canSkipTutorial(false), - m_track(track), - m_subscriptionBits(subscriptionBits), - m_transferRequest(0), - m_transferRequestSourceCharacterTemplateId(0), - m_consumedRewardEvents(), - m_claimedRewardItems() +TaskGetValidationData::TaskGetValidationData(StationId stationId, int clusterGroupId, uint32 clusterId, unsigned int track, uint32 subscriptionBits) : + TaskRequest(), + m_stationId(stationId), + m_clusterGroupId(clusterGroupId), + m_clusterId(clusterId), + m_openCharacterSlots(4, 0), + m_canSkipTutorial(false), + m_track(track), + m_subscriptionBits(subscriptionBits), + m_transferRequest(0), + m_transferRequestSourceCharacterTemplateId(0), + m_consumedRewardEvents(), + m_claimedRewardItems() { } // ---------------------------------------------------------------------- TaskGetValidationData::TaskGetValidationData(const TransferRequestMoveValidation & request, int clusterGroupId, uint32 clusterId) : - TaskRequest(), - m_stationId(request.getDestinationStationId()), - m_clusterGroupId(clusterGroupId), - m_clusterId(clusterId), - m_openCharacterSlots(4,0), - m_canSkipTutorial(true), - m_track(request.getTrack()), - m_transferRequest(0), - m_transferRequestSourceCharacterTemplateId(request.getSourceCharacterTemplateId()), - m_consumedRewardEvents(), - m_claimedRewardItems() + TaskRequest(), + m_stationId(request.getDestinationStationId()), + m_clusterGroupId(clusterGroupId), + m_clusterId(clusterId), + m_openCharacterSlots(4, 0), + m_canSkipTutorial(true), + m_track(request.getTrack()), + m_transferRequest(0), + m_transferRequestSourceCharacterTemplateId(request.getSourceCharacterTemplateId()), + m_consumedRewardEvents(), + m_claimedRewardItems(), + m_subscriptionBits(0) { Archive::ByteStream bs; request.pack(bs); @@ -205,10 +206,10 @@ bool TaskGetValidationData::process(DB::Session *session) qry.cluster_id = static_cast(m_clusterId); int rowsFetched; - if (! (session->exec(&qry))) + if (!(session->exec(&qry))) return false; while ((rowsFetched = qry.fetch()) > 0) - m_openCharacterSlots[static_cast(qry.character_type_id.getValue())]=qry.num_open_slots.getValue(); + m_openCharacterSlots[static_cast(qry.character_type_id.getValue())] = qry.num_open_slots.getValue(); qry.done(); if (rowsFetched < 0) return false; @@ -219,12 +220,12 @@ bool TaskGetValidationData::process(DB::Session *session) GetValidationDataQuery qry; qry.station_id = static_cast(m_stationId); qry.cluster_id = static_cast(m_clusterId); - + int rowsFetched; - if (! (session->exec(&qry))) + if (!(session->exec(&qry))) return false; while ((rowsFetched = qry.fetch()) > 0) - m_openCharacterSlots[static_cast(qry.character_type_id.getValue())]=qry.num_open_slots.getValue(); + m_openCharacterSlots[static_cast(qry.character_type_id.getValue())] = qry.num_open_slots.getValue(); qry.done(); if (rowsFetched < 0) return false; @@ -254,7 +255,7 @@ bool TaskGetValidationData::process(DB::Session *session) qryGetCharacters.character_name.getValue(characterName); if (characterName == m_transferRequest->getSourceCharacter()) { - qryGetCharacters.object_template_id.getValue(m_transferRequestSourceCharacterTemplateId); + qryGetCharacters.object_template_id.getValue(m_transferRequestSourceCharacterTemplateId); break; } } @@ -267,13 +268,13 @@ bool TaskGetValidationData::process(DB::Session *session) { GetConsumedRewardEventsQuery eventQuery(m_stationId); int rowsFetched; - if (! (session->exec(&eventQuery))) + if (!(session->exec(&eventQuery))) return false; while ((rowsFetched = eventQuery.fetch()) > 0) { // If the event was claimed on this cluster, tell the cluster the network ID of the character that claimed it. - // If claimed on another cluster, hide the network ID because it's not meaningful - NetworkId const characterId = eventQuery.getClusterId()==m_clusterId ? eventQuery.getCharacterId() : NetworkId::cms_invalid; + // If claimed on another cluster, hide the network ID because it's not meaningful + NetworkId const characterId = eventQuery.getClusterId() == m_clusterId ? eventQuery.getCharacterId() : NetworkId::cms_invalid; m_consumedRewardEvents.push_back(std::make_pair(characterId, eventQuery.getEventId())); } eventQuery.done(); @@ -281,11 +282,11 @@ bool TaskGetValidationData::process(DB::Session *session) return false; GetClaimedRewardItemsQuery itemQuery(m_stationId); - if (! (session->exec(&itemQuery))) + if (!(session->exec(&itemQuery))) return false; while ((rowsFetched = itemQuery.fetch()) > 0) { - NetworkId const characterId = itemQuery.getClusterId()==m_clusterId ? itemQuery.getCharacterId() : NetworkId::cms_invalid; + NetworkId const characterId = itemQuery.getClusterId() == m_clusterId ? itemQuery.getCharacterId() : NetworkId::cms_invalid; m_claimedRewardItems.push_back(std::make_pair(characterId, itemQuery.getItemId())); } itemQuery.done(); @@ -294,12 +295,12 @@ bool TaskGetValidationData::process(DB::Session *session) // check to see if the account can skip the tutorial or not GetCompletedTutorialQuery tutorialQuery(m_stationId); - if (! (session->exec(&tutorialQuery))) + if (!(session->exec(&tutorialQuery))) return false; while ((rowsFetched = tutorialQuery.fetch()) > 0) { tutorialQuery.completed_tutorial.getValue(m_canSkipTutorial); - } + } tutorialQuery.done(); if (rowsFetched < 0) return false; @@ -311,21 +312,21 @@ bool TaskGetValidationData::process(DB::Session *session) void TaskGetValidationData::onComplete() { - bool canCreateNormal=false; - bool canCreateJedi=false; + bool canCreateNormal = false; + bool canCreateJedi = false; if (m_openCharacterSlots[1] > 0) - canCreateNormal=true; + canCreateNormal = true; if (m_openCharacterSlots[2] > 0 && m_openCharacterSlots[3] > 0) - canCreateJedi=true; + canCreateJedi = true; // check to see if character creation has been disabled for the cluster if (ConfigLoginServer::isCharacterCreationDisabled(LoginServer::getInstance().getClusterNameById(m_clusterId))) { - canCreateNormal=false; - canCreateJedi=false; + canCreateNormal = false; + canCreateJedi = false; } - if(m_transferRequest) + if (m_transferRequest) { LoginServer::getInstance().validateAccountForTransfer(*m_transferRequest, m_clusterId, m_transferRequestSourceCharacterTemplateId, canCreateNormal, false); } @@ -339,7 +340,7 @@ void TaskGetValidationData::onComplete() void GetValidationDataQuery::getSQL(std::string &sql) { - sql = std::string("begin :rc := ")+DatabaseConnection::getInstance().getSchemaQualifier()+"login.get_open_character_slots(:station_id,:cluster_id); end;"; + sql = std::string("begin :rc := ") + DatabaseConnection::getInstance().getSchemaQualifier() + "login.get_open_character_slots(:station_id,:cluster_id); end;"; } // ---------------------------------------------------------------------- @@ -347,9 +348,9 @@ void GetValidationDataQuery::getSQL(std::string &sql) bool GetValidationDataQuery::bindParameters() { if (!bindParameter(station_id)) return false; - if (!bindParameter(cluster_id)) return false; + if (!bindParameter(cluster_id)) return false; - return true; + return true; } // ---------------------------------------------------------------------- @@ -372,11 +373,11 @@ DB::Query::QueryMode GetValidationDataQuery::getExecutionMode() const // ---------------------------------------------------------------------- GetValidationDataQuery::GetValidationDataQuery() : - Query(), - station_id(), - cluster_id(), - character_type_id(), - num_open_slots() + Query(), + station_id(), + cluster_id(), + character_type_id(), + num_open_slots() { } @@ -384,7 +385,7 @@ GetValidationDataQuery::GetValidationDataQuery() : void GetCompletedTutorialQuery::getSQL(std::string &sql) { - sql = std::string("begin :rc := ")+DatabaseConnection::getInstance().getSchemaQualifier()+"login.get_completed_tutorial(:station_id); end;"; + sql = std::string("begin :rc := ") + DatabaseConnection::getInstance().getSchemaQualifier() + "login.get_completed_tutorial(:station_id); end;"; } // ---------------------------------------------------------------------- @@ -393,7 +394,7 @@ bool GetCompletedTutorialQuery::bindParameters() { if (!bindParameter(station_id)) return false; - return true; + return true; } // ---------------------------------------------------------------------- @@ -415,20 +416,20 @@ DB::Query::QueryMode GetCompletedTutorialQuery::getExecutionMode() const // ---------------------------------------------------------------------- GetCompletedTutorialQuery::GetCompletedTutorialQuery(StationId stationId) : - DB::Query(), - station_id(stationId), - completed_tutorial(false) + DB::Query(), + station_id(stationId), + completed_tutorial(false) { } // ====================================================================== GetConsumedRewardEventsQuery::GetConsumedRewardEventsQuery(StationId stationId) : - DB::Query(), - station_id(static_cast(stationId)), - event_id(), - cluster_id(), - character_id() + DB::Query(), + station_id(static_cast(stationId)), + event_id(), + cluster_id(), + character_id() { } @@ -436,7 +437,7 @@ GetConsumedRewardEventsQuery::GetConsumedRewardEventsQuery(StationId stationId) void GetConsumedRewardEventsQuery::getSQL(std::string &sql) { - sql = std::string("begin :result := ")+DatabaseConnection::getInstance().getSchemaQualifier()+"login.get_consumed_reward_events(:station_id); end;"; + sql = std::string("begin :result := ") + DatabaseConnection::getInstance().getSchemaQualifier() + "login.get_consumed_reward_events(:station_id); end;"; } // ---------------------------------------------------------------------- @@ -488,11 +489,11 @@ NetworkId const GetConsumedRewardEventsQuery::getCharacterId() const // ====================================================================== GetClaimedRewardItemsQuery::GetClaimedRewardItemsQuery(StationId stationId) : - DB::Query(), - station_id(static_cast(stationId)), - item_id(), - cluster_id(), - character_id() + DB::Query(), + station_id(static_cast(stationId)), + item_id(), + cluster_id(), + character_id() { } @@ -500,7 +501,7 @@ GetClaimedRewardItemsQuery::GetClaimedRewardItemsQuery(StationId stationId) : void GetClaimedRewardItemsQuery::getSQL(std::string &sql) { - sql = std::string("begin :result := ")+DatabaseConnection::getInstance().getSchemaQualifier()+"login.get_claimed_reward_items(:station_id); end;"; + sql = std::string("begin :result := ") + DatabaseConnection::getInstance().getSchemaQualifier() + "login.get_claimed_reward_items(:station_id); end;"; } // ---------------------------------------------------------------------- @@ -552,9 +553,9 @@ NetworkId const GetClaimedRewardItemsQuery::getCharacterId() const // ====================================================================== IsClusterAtLimitQuery::IsClusterAtLimitQuery() : -Query(), -cluster_id(), -result() + Query(), + cluster_id(), + result() { } @@ -562,7 +563,7 @@ result() void IsClusterAtLimitQuery::getSQL(std::string &sql) { - sql = std::string("begin :result := ")+DatabaseConnection::getInstance().getSchemaQualifier()+"login.is_cluster_at_limit(:cluster_id); end;"; + sql = std::string("begin :result := ") + DatabaseConnection::getInstance().getSchemaQualifier() + "login.is_cluster_at_limit(:cluster_id); end;"; } // ---------------------------------------------------------------------- @@ -588,4 +589,4 @@ DB::Query::QueryMode IsClusterAtLimitQuery::getExecutionMode() const return MODE_PROCEXEC; } -// ====================================================================== +// ====================================================================== \ No newline at end of file diff --git a/engine/server/application/PlanetServer/src/shared/PlanetProxyObject.cpp b/engine/server/application/PlanetServer/src/shared/PlanetProxyObject.cpp index 648debd0..5e6a0338 100755 --- a/engine/server/application/PlanetServer/src/shared/PlanetProxyObject.cpp +++ b/engine/server/application/PlanetServer/src/shared/PlanetProxyObject.cpp @@ -32,42 +32,43 @@ MemoryBlockManager* PlanetProxyObject::memoryBlockManager; // ====================================================================== -PlanetProxyObject::PlanetProxyObject (const NetworkId &objectId) : - m_objectId(objectId), - m_containedBy(NetworkId::cms_invalid), - m_x(0), - m_y(0), - m_z(0), - m_authoritativeServer(0), - m_lastReportedServer(0), - m_interestRadius(0), - m_quadtreeNode(nullptr), - m_authTransferTimeMs(Clock::timeMs()), - m_contents(nullptr), - m_level(0), - m_hibernating(false), - m_templateCrc(0), - m_aiActivity(-1), - m_creationType(-1) +PlanetProxyObject::PlanetProxyObject(const NetworkId &objectId) : + m_objectId(objectId), + m_containedBy(NetworkId::cms_invalid), + m_x(0), + m_y(0), + m_z(0), + m_authoritativeServer(0), + m_lastReportedServer(0), + m_interestRadius(0), + m_quadtreeNode(nullptr), + m_authTransferTimeMs(Clock::timeMs()), + m_contents(nullptr), + m_level(0), + m_hibernating(false), + m_templateCrc(0), + m_aiActivity(-1), + m_creationType(-1), + m_objectTypeTag(0) { } // ---------------------------------------------------------------------- -PlanetProxyObject::~PlanetProxyObject () +PlanetProxyObject::~PlanetProxyObject() { if (PlanetServer::getInstance().isWatcherPresent()) { outputStatusToAll(true); } - m_quadtreeNode=0; + m_quadtreeNode = 0; if (m_contents) { - for (std::vector::const_iterator i=m_contents->begin(); i!=m_contents->end(); ++i) - WARNING(true,("Object %s was deleted without removing contained object %s first",m_objectId.getValueString().c_str(), i->getValueString().c_str())); + for (std::vector::const_iterator i = m_contents->begin(); i != m_contents->end(); ++i) + WARNING(true, ("Object %s was deleted without removing contained object %s first", m_objectId.getValueString().c_str(), i->getValueString().c_str())); delete m_contents; - m_contents=0; + m_contents = 0; } } @@ -79,7 +80,7 @@ PlanetProxyObject::~PlanetProxyObject () */ void PlanetProxyObject::update(int x, int y, int z, NetworkId containedBy, uint32 authoritativeServer, int interestRadius, int objectTypeTag, int const level, bool const hibernating, uint32 const templateCrc, int const aiActivity, int const creationType) { - WARNING_DEBUG_FATAL(m_objectId==NetworkId::cms_invalid,("Object ID was 0.")); + WARNING_DEBUG_FATAL(m_objectId == NetworkId::cms_invalid, ("Object ID was 0.")); bool watcherUpdateNeeded = false; m_level = level; @@ -88,64 +89,64 @@ void PlanetProxyObject::update(int x, int y, int z, NetworkId containedBy, uint3 m_aiActivity = aiActivity; m_creationType = creationType; - if ((m_authoritativeServer != 0 ) && (authoritativeServer != m_authoritativeServer) && (containedBy == NetworkId::cms_invalid)) + if ((m_authoritativeServer != 0) && (authoritativeServer != m_authoritativeServer) && (containedBy == NetworkId::cms_invalid)) { static unsigned long authTransferSanityCheckTimeMs = ConfigPlanetServer::getAuthTransferSanityCheckTimeMs(); - if (Clock::timeMs()-m_authTransferTimeMs > authTransferSanityCheckTimeMs) + if (Clock::timeMs() - m_authTransferTimeMs > authTransferSanityCheckTimeMs) { DEBUG_WARNING(true, ("Resending auth transfer for %s to %lu due to receiving a stale position update.", m_objectId.getValueString().c_str(), authoritativeServer)); sendAuthorityChange(authoritativeServer, m_authoritativeServer, false); return; } if (ConfigPlanetServer::getLogObjectLoading()) - LOG("ObjectLoading",("Ignoring update for %s from %lu because server was not authoritative.",m_objectId.getValueString().c_str(),authoritativeServer)); + LOG("ObjectLoading", ("Ignoring update for %s from %lu because server was not authoritative.", m_objectId.getValueString().c_str(), authoritativeServer)); return; } - - if (interestRadius>ConfigPlanetServer::getMaxInterestRadius()) + + if (interestRadius > ConfigPlanetServer::getMaxInterestRadius()) interestRadius = ConfigPlanetServer::getMaxInterestRadius(); - - if (interestRadius>0 && PlanetServer::getInstance().isInTutorialMode()) + + if (interestRadius > 0 && PlanetServer::getInstance().isInTutorialMode()) interestRadius = 1; - if (containedBy!=NetworkId::cms_invalid) + if (containedBy != NetworkId::cms_invalid) { // get coordinates from container PlanetProxyObject *container = Scene::getInstance().findObjectByID(containedBy); if (container) { - x=container->getX(); - y=container->getY(); - z=container->getZ(); + x = container->getX(); + y = container->getY(); + z = container->getZ(); } else { - LOG("PlanetUpdate",("Game server said object %s was contained by object %s, but we could not find the container.",m_objectId.getValueString().c_str(),containedBy.getValueString().c_str())); + LOG("PlanetUpdate", ("Game server said object %s was contained by object %s, but we could not find the container.", m_objectId.getValueString().c_str(), containedBy.getValueString().c_str())); containedBy = NetworkId::cms_invalid; // so that we'll try again when the object moves again, in case we just got objects out-of-order from the game server } } - + std::vector oldProxyList; - Node *newNode=Scene::getInstance().findNodeByPosition(x,z); + Node *newNode = Scene::getInstance().findNodeByPosition(x, z); NOT_NULL(newNode); - if (newNode!=m_quadtreeNode || m_interestRadius != interestRadius || m_authoritativeServer != authoritativeServer || m_containedBy != containedBy) + if (newNode != m_quadtreeNode || m_interestRadius != interestRadius || m_authoritativeServer != authoritativeServer || m_containedBy != containedBy) { watcherUpdateNeeded = true; // For debugging, update the contents of the containers - if (ConfigPlanetServer::getEnableContentsChecking() && (m_containedBy!=containedBy)) + if (ConfigPlanetServer::getEnableContentsChecking() && (m_containedBy != containedBy)) updateContentsTracking(containedBy); - + bool const firstUpdate = (m_quadtreeNode == nullptr); - if (m_quadtreeNode!=nullptr) // if this is the first update for this object, m_quadtreeNode will be nullptr because it hasn't been placed anywhere yet + if (m_quadtreeNode != nullptr) // if this is the first update for this object, m_quadtreeNode will be nullptr because it hasn't been placed anywhere yet { removeServerStatistics(); // remember old list of proxies getServers(oldProxyList); - + // remove from the old location m_quadtreeNode->removeObject(this); @@ -153,34 +154,34 @@ void PlanetProxyObject::update(int x, int y, int z, NetworkId containedBy, uint3 LOG("ObjectLoading", ("unsubscribing nodes for object id=[%s]", m_objectId.getValueString().c_str())); unsubscribeSurroundingNodes(false); } - + // update data - m_quadtreeNode=newNode; - m_x=x; - m_y=y; - m_z=z; - m_interestRadius=interestRadius; + m_quadtreeNode = newNode; + m_x = x; + m_y = y; + m_z = z; + m_interestRadius = interestRadius; m_objectTypeTag = objectTypeTag; - m_authoritativeServer=authoritativeServer; - m_containedBy=containedBy; + m_authoritativeServer = authoritativeServer; + m_containedBy = containedBy; // make sure the destination is loaded if (!newNode->isLoaded()) { if (ConfigPlanetServer::getLogObjectLoading()) - LOG("ObjectLoading",("Loading node %s because object %s entered it.",newNode->getDebugNodeString().c_str(), m_objectId.getValueString().c_str())); + LOG("ObjectLoading", ("Loading node %s because object %s entered it.", newNode->getDebugNodeString().c_str(), m_objectId.getValueString().c_str())); newNode->load(); } - + // check if we're on the right server if (!isAuthorityOk()) { uint32 preferredServer = m_quadtreeNode->getPreferredServer(); - if (m_containedBy==NetworkId::cms_invalid) + if (m_containedBy == NetworkId::cms_invalid) { if (ConfigPlanetServer::getLogObjectLoading()) - LOG("ObjectLoading",("Changing authority for object %s from %lu to %lu because node %s is authoritative on that server.", - m_objectId.getValueString().c_str(),m_authoritativeServer,preferredServer,m_quadtreeNode->getDebugNodeString().c_str())); + LOG("ObjectLoading", ("Changing authority for object %s from %lu to %lu because node %s is authoritative on that server.", + m_objectId.getValueString().c_str(), m_authoritativeServer, preferredServer, m_quadtreeNode->getDebugNodeString().c_str())); changeAuthority(preferredServer, false, false); // changes m_authoritativeServer and sends message // we received the object for the first time, and we had to @@ -192,8 +193,8 @@ void PlanetProxyObject::update(int x, int y, int z, NetworkId containedBy, uint3 } else { - WARNING(true,("Programmer bug: Object %s is in container %s, which is node %s. The object should be authoritative on server %i but it is authoritative on server %i.", - m_objectId.getValueString().c_str(),m_containedBy.getValueString().c_str(),m_quadtreeNode->getDebugNodeString().c_str(), m_authoritativeServer, preferredServer)); + WARNING(true, ("Programmer bug: Object %s is in container %s, which is node %s. The object should be authoritative on server %i but it is authoritative on server %i.", + m_objectId.getValueString().c_str(), m_containedBy.getValueString().c_str(), m_quadtreeNode->getDebugNodeString().c_str(), m_authoritativeServer, preferredServer)); } } @@ -204,30 +205,30 @@ void PlanetProxyObject::update(int x, int y, int z, NetworkId containedBy, uint3 { if (ConfigPlanetServer::getLogObjectLoading()) LOG("ObjectLoading", ("subscribing nodes for object id=[%s]", m_objectId.getValueString().c_str())); - subscribeSurroundingNodes(); + subscribeSurroundingNodes(); } - + // check against new interested servers, and send proxy/unproxy as needed - if (m_containedBy==NetworkId::cms_invalid) // we don't manage proxies for containers + if (m_containedBy == NetworkId::cms_invalid) // we don't manage proxies for containers { std::vector newProxyList; getServers(newProxyList); - changeProxies(oldProxyList,newProxyList); + changeProxies(oldProxyList, newProxyList); } - + addServerStatistics(); - } + } else { if (m_interestRadius > 0 || (abs(m_x - x) > 25) || (abs(m_z - z) > 25)) watcherUpdateNeeded = true; } - + if (PlanetServer::getInstance().isWatcherPresent() && watcherUpdateNeeded) { - m_x=x; - m_y=y; - m_z=z; + m_x = x; + m_y = y; + m_z = z; m_objectTypeTag = objectTypeTag; outputStatusToAll(false); @@ -240,11 +241,11 @@ void PlanetProxyObject::unsubscribeSurroundingNodes(bool clearZeroSubscriptions) { if (m_interestRadius <= 0) return; - + Scene::NodeListType nodelist; - Scene::getInstance().findIntersection(nodelist,m_x,m_z,m_interestRadius); - - for (Scene::NodeListType::iterator i=nodelist.begin(); i!=nodelist.end(); ++i) + Scene::getInstance().findIntersection(nodelist, m_x, m_z, m_interestRadius); + + for (Scene::NodeListType::iterator i = nodelist.begin(); i != nodelist.end(); ++i) { (*i)->unsubscribeServer(m_authoritativeServer, 1, clearZeroSubscriptions); } @@ -253,20 +254,20 @@ void PlanetProxyObject::unsubscribeSurroundingNodes(bool clearZeroSubscriptions) // ---------------------------------------------------------------------- void PlanetProxyObject::subscribeSurroundingNodes() -{ +{ if (m_interestRadius <= 0) return; NOT_NULL(m_quadtreeNode); Scene::NodeListType nodelist; - Scene::getInstance().findIntersection(nodelist,m_x,m_z,m_interestRadius); - - for (Scene::NodeListType::iterator i=nodelist.begin(); i!=nodelist.end(); ++i) + Scene::getInstance().findIntersection(nodelist, m_x, m_z, m_interestRadius); + + for (Scene::NodeListType::iterator i = nodelist.begin(); i != nodelist.end(); ++i) { (*i)->subscribeServer(m_authoritativeServer, 1); uint32 serverId = (*i)->getPreferredServer(); if (serverId != m_authoritativeServer) - m_quadtreeNode->subscribeServer(serverId,0); // make sure if we can see them, they can see us + m_quadtreeNode->subscribeServer(serverId, 0); // make sure if we can see them, they can see us } } @@ -332,22 +333,22 @@ void PlanetProxyObject::unload(bool tellGameServer) if (m_quadtreeNode) m_quadtreeNode->removeObject(this); - Scene::getInstance().removeObjectFromMap(m_objectId,tellGameServer); + Scene::getInstance().removeObjectFromMap(m_objectId, tellGameServer); if (tellGameServer) { - PlanetServer::getInstance().unloadObject(m_objectId,m_authoritativeServer); + PlanetServer::getInstance().unloadObject(m_objectId, m_authoritativeServer); } removeServerStatistics(); - if (ConfigPlanetServer::getEnableContentsChecking() && m_containedBy!=NetworkId::cms_invalid) + if (ConfigPlanetServer::getEnableContentsChecking() && m_containedBy != NetworkId::cms_invalid) { PlanetProxyObject *container = Scene::getInstance().findObjectByID(m_containedBy); if (container) container->removeContainedObject(m_objectId); else - WARNING(true,("Unloading object %s in container %s, but the container could not be found.",m_objectId.getValueString().c_str(), m_containedBy.getValueString().c_str())); + WARNING(true, ("Unloading object %s in container %s, but the container could not be found.", m_objectId.getValueString().c_str(), m_containedBy.getValueString().c_str())); } } @@ -368,7 +369,7 @@ void PlanetProxyObject::outputStatus(WatcherConnection &conn, bool deleteObject) void PlanetProxyObject::outputStatusToAll(bool deleteObject) const { const PlanetServer::WatcherList &connections = PlanetServer::getInstance().getWatchers(); - for (PlanetServer::WatcherList::const_iterator i= connections.begin(); i!=connections.end(); ++i) + for (PlanetServer::WatcherList::const_iterator i = connections.begin(); i != connections.end(); ++i) { outputStatus(**i, deleteObject); } @@ -376,21 +377,21 @@ void PlanetProxyObject::outputStatusToAll(bool deleteObject) const // ---------------------------------------------------------------------- -/** +/** * Update the GameServerData with statistics about this object. */ void PlanetProxyObject::addServerStatistics() const { - GameServerData *data=PlanetServer::getInstance().getGameServerData(m_authoritativeServer); + GameServerData *data = PlanetServer::getInstance().getGameServerData(m_authoritativeServer); if (data) { data->adjustObjectCount(1); - if (m_interestRadius!=0) + if (m_interestRadius != 0) { data->adjustInterestObjectCount(1); if (isCreature()) data->adjustInterestCreatureObjectCount(1); - } + } } } @@ -402,15 +403,15 @@ void PlanetProxyObject::addServerStatistics() const */ void PlanetProxyObject::removeServerStatistics() const { - GameServerData *data=PlanetServer::getInstance().getGameServerData(m_authoritativeServer); + GameServerData *data = PlanetServer::getInstance().getGameServerData(m_authoritativeServer); if (data) { data->adjustObjectCount(-1); - if (m_interestRadius!=0) + if (m_interestRadius != 0) { data->adjustInterestObjectCount(-1); if (isCreature()) - data->adjustInterestCreatureObjectCount(-1); + data->adjustInterestCreatureObjectCount(-1); } } } @@ -423,7 +424,7 @@ void PlanetProxyObject::removeServerStatistics() const void PlanetProxyObject::install() { memoryBlockManager = new MemoryBlockManager("PlanetProxyObject::memoryBlockManager", true, sizeof(PlanetProxyObject), 0, 0, 0); - ExitChain::add(&remove, "PlanetProxyObject::remove"); + ExitChain::add(&remove, "PlanetProxyObject::remove"); } // ---------------------------------------------------------------------- @@ -461,7 +462,7 @@ void PlanetProxyObject::operator delete(void* pointer) void PlanetProxyObject::sendAuthorityChange(uint32 currentAuthServer, uint32 newAuthServer, bool handlingCrash) { - DEBUG_WARNING(!isAuthorityClean(), ("Object %s attempted to change authority before previous authority change was complete.",getObjectId().getValueString().c_str())); + DEBUG_WARNING(!isAuthorityClean(), ("Object %s attempted to change authority before previous authority change was complete.", getObjectId().getValueString().c_str())); SetAuthoritativeMessage const auth(getObjectId(), newAuthServer, false, handlingCrash, NetworkId::cms_invalid, Transform::identity, false); PlanetServer::getInstance().sendToGameServer(currentAuthServer, auth); @@ -473,7 +474,7 @@ void PlanetProxyObject::sendAuthorityChange(uint32 currentAuthServer, uint32 new void PlanetProxyObject::sendAddProxy(uint32 proxyServer) { if (ConfigPlanetServer::getLogObjectLoading()) - LOG("ObjectLoading",("Gameserver %lu needs a proxy of object %s",proxyServer,m_objectId.getValueString().c_str())); + LOG("ObjectLoading", ("Gameserver %lu needs a proxy of object %s", proxyServer, m_objectId.getValueString().c_str())); if (isAuthorityClean()) { LoadObjectMessage const loadMsg(getObjectId(), proxyServer); @@ -491,15 +492,15 @@ void PlanetProxyObject::sendAddProxy(uint32 proxyServer) void PlanetProxyObject::sendRemoveProxy(uint32 proxyServer) { if (ConfigPlanetServer::getLogObjectLoading()) - LOG("ObjectLoading",("Gameserver %lu no longer needs a proxy of object %s",proxyServer,m_objectId.getValueString().c_str())); + LOG("ObjectLoading", ("Gameserver %lu no longer needs a proxy of object %s", proxyServer, m_objectId.getValueString().c_str())); if (isAuthorityClean()) { - UnloadProxyMessage msg(getObjectId(),proxyServer); + UnloadProxyMessage msg(getObjectId(), proxyServer); PlanetServer::getInstance().sendToGameServer(m_authoritativeServer, msg); } else { - UnloadProxyMessage *msg = new UnloadProxyMessage(getObjectId(),proxyServer); + UnloadProxyMessage *msg = new UnloadProxyMessage(getObjectId(), proxyServer); PlanetServer::getInstance().queueMessageForObject(getObjectId(), msg); } } @@ -516,7 +517,7 @@ void PlanetProxyObject::onReceivedMessageFromServer(uint32 server) if (m_lastReportedServer != m_authoritativeServer && server == m_authoritativeServer) // we've received a message from the new authoritative server. Send queued messages: PlanetServer::getInstance().sendQueuedMessagesForObject(*this); - + m_lastReportedServer = server; } @@ -534,8 +535,8 @@ void PlanetProxyObject::getServers(std::vector &serverList) const } else { - PlanetProxyObject *container=Scene::getInstance().findObjectByID(m_containedBy); - WARNING_STRICT_FATAL(!container,("Object %s is in container %s, which couldn't be found",m_objectId.getValueString().c_str(),m_containedBy.getValueString().c_str())); + PlanetProxyObject *container = Scene::getInstance().findObjectByID(m_containedBy); + WARNING_STRICT_FATAL(!container, ("Object %s is in container %s, which couldn't be found", m_objectId.getValueString().c_str(), m_containedBy.getValueString().c_str())); if (container) effectiveNode = container->getNode(); else @@ -557,12 +558,12 @@ void PlanetProxyObject::getServers(std::vector &serverList) const void PlanetProxyObject::changeProxies(const std::vector &oldServers, const std::vector &newServers) { { - for (std::vector::const_iterator i=oldServers.begin(); i!=oldServers.end(); ++i) + for (std::vector::const_iterator i = oldServers.begin(); i != oldServers.end(); ++i) { if (*i != m_authoritativeServer) { bool removeNeeded = true; - for (std::vector::const_iterator j=newServers.begin(); j!=newServers.end(); ++j) + for (std::vector::const_iterator j = newServers.begin(); j != newServers.end(); ++j) { if (*i == *j) { @@ -576,12 +577,12 @@ void PlanetProxyObject::changeProxies(const std::vector &oldServers, con } } { - for (std::vector::const_iterator i=newServers.begin(); i!=newServers.end(); ++i) + for (std::vector::const_iterator i = newServers.begin(); i != newServers.end(); ++i) { if (*i != m_authoritativeServer) { bool addNeeded = true; - for (std::vector::const_iterator j=oldServers.begin(); j!=oldServers.end(); ++j) + for (std::vector::const_iterator j = oldServers.begin(); j != oldServers.end(); ++j) { if (*i == *j) { @@ -638,10 +639,10 @@ void PlanetProxyObject::addContainedObject(const NetworkId &theObject) { m_contents = new std::vector; } - for (std::vector::const_iterator i=m_contents->begin(); i!=m_contents->end(); ++i) + for (std::vector::const_iterator i = m_contents->begin(); i != m_contents->end(); ++i) { - if (*i==theObject) - WARNING(true,("Object %s was placed in container %s twice.", theObject.getValueString().c_str(), m_objectId.getValueString().c_str())); + if (*i == theObject) + WARNING(true, ("Object %s was placed in container %s twice.", theObject.getValueString().c_str(), m_objectId.getValueString().c_str())); } m_contents->push_back(theObject); } @@ -652,13 +653,13 @@ void PlanetProxyObject::removeContainedObject(const NetworkId &theObject) { if (!m_contents) { - WARNING(true,("Attempted to remove object %s from object %s, but that object has no contents.", theObject.getValueString().c_str(), m_objectId.getValueString().c_str())); + WARNING(true, ("Attempted to remove object %s from object %s, but that object has no contents.", theObject.getValueString().c_str(), m_objectId.getValueString().c_str())); return; } - std::vector::iterator newEnd=std::remove(m_contents->begin(), m_contents->end(), theObject); - if (newEnd==m_contents->end()) + std::vector::iterator newEnd = std::remove(m_contents->begin(), m_contents->end(), theObject); + if (newEnd == m_contents->end()) { - WARNING(true,("Attempted to remove object %s from object %s, but it was not in the container.", theObject.getValueString().c_str(), m_objectId.getValueString().c_str())); + WARNING(true, ("Attempted to remove object %s from object %s, but it was not in the container.", theObject.getValueString().c_str(), m_objectId.getValueString().c_str())); return; } m_contents->erase(newEnd, m_contents->end()); @@ -672,22 +673,22 @@ void PlanetProxyObject::removeContainedObject(const NetworkId &theObject) */ void PlanetProxyObject::updateContentsTracking(const NetworkId &newContainedBy) { - if (m_containedBy!=NetworkId::cms_invalid) + if (m_containedBy != NetworkId::cms_invalid) { PlanetProxyObject *container = Scene::getInstance().findObjectByID(m_containedBy); if (container) container->removeContainedObject(m_objectId); else - WARNING(true,("Removing object %s from container %s, but the container could not be found.",m_objectId.getValueString().c_str(), m_containedBy.getValueString().c_str())); + WARNING(true, ("Removing object %s from container %s, but the container could not be found.", m_objectId.getValueString().c_str(), m_containedBy.getValueString().c_str())); } - if (newContainedBy!=NetworkId::cms_invalid) + if (newContainedBy != NetworkId::cms_invalid) { PlanetProxyObject *container = Scene::getInstance().findObjectByID(newContainedBy); if (container) container->addContainedObject(m_objectId); else - WARNING(true,("Adding object %s to container %s, but the container could not be found.",m_objectId.getValueString().c_str(), newContainedBy.getValueString().c_str())); + WARNING(true, ("Adding object %s to container %s, but the container could not be found.", m_objectId.getValueString().c_str(), newContainedBy.getValueString().c_str())); } } @@ -695,7 +696,7 @@ void PlanetProxyObject::updateContentsTracking(const NetworkId &newContainedBy) bool PlanetProxyObject::isCreature() const { - return m_objectTypeTag==TAG(C,R,E,O); + return m_objectTypeTag == TAG(C, R, E, O); } -// ====================================================================== +// ====================================================================== \ No newline at end of file diff --git a/engine/server/library/serverDatabase/src/shared/DeleteCharacterCustomPersistStep.cpp b/engine/server/library/serverDatabase/src/shared/DeleteCharacterCustomPersistStep.cpp index 67ec7bd2..3463861b 100755 --- a/engine/server/library/serverDatabase/src/shared/DeleteCharacterCustomPersistStep.cpp +++ b/engine/server/library/serverDatabase/src/shared/DeleteCharacterCustomPersistStep.cpp @@ -16,8 +16,9 @@ // ====================================================================== DeleteCharacterCustomPersistStep::DeleteCharacterCustomPersistStep(uint32 stationId, const NetworkId &characterId) : - m_characterId(characterId), - m_stationId(stationId) + m_characterId(characterId), + m_stationId(stationId), + m_resultCode(0) { } @@ -33,12 +34,12 @@ bool DeleteCharacterCustomPersistStep::beforePersist(DB::Session *) bool DeleteCharacterCustomPersistStep::afterPersist(DB::Session *session) { DeleteCharacterQuery qry(m_stationId, m_characterId); - - if (! (session->exec(&qry))) + + if (!(session->exec(&qry))) return false; qry.done(); - m_resultCode=qry.result.getValue(); + m_resultCode = qry.result.getValue(); return true; } @@ -48,18 +49,18 @@ void DeleteCharacterCustomPersistStep::onComplete() { if (m_resultCode == 2) { - GenericValueTypeMessage msg("ReleaseCharacterNameByIdMessage",m_characterId); - DatabaseProcess::getInstance().sendToAllGameServers(msg,true); + GenericValueTypeMessage msg("ReleaseCharacterNameByIdMessage", m_characterId); + DatabaseProcess::getInstance().sendToAllGameServers(msg, true); } } // ====================================================================== DeleteCharacterCustomPersistStep::DeleteCharacterQuery::DeleteCharacterQuery(uint32 stationId, const NetworkId &characterId) : - station_id(stationId), - character_id(characterId), - delete_minutes(ConfigServerDatabase::getCharacterImmediateDeleteMinutes()), - result() + station_id(stationId), + character_id(characterId), + delete_minutes(ConfigServerDatabase::getCharacterImmediateDeleteMinutes()), + result() { } @@ -67,7 +68,7 @@ DeleteCharacterCustomPersistStep::DeleteCharacterQuery::DeleteCharacterQuery(uin void DeleteCharacterCustomPersistStep::DeleteCharacterQuery::getSQL(std::string &sql) { - sql="begin :result := " + DatabaseProcess::getInstance().getSchemaQualifier() + "persister.delete_character (:station_id, :character_id, :delete_minutes); end;"; + sql = "begin :result := " + DatabaseProcess::getInstance().getSchemaQualifier() + "persister.delete_character (:station_id, :character_id, :delete_minutes); end;"; } // ---------------------------------------------------------------------- @@ -95,4 +96,4 @@ DB::Query::QueryMode DeleteCharacterCustomPersistStep::DeleteCharacterQuery::get return DB::Query::MODE_PROCEXEC; } -// ====================================================================== +// ====================================================================== \ No newline at end of file diff --git a/engine/server/library/serverDatabase/src/shared/TaskCheckCharacterName.cpp b/engine/server/library/serverDatabase/src/shared/TaskCheckCharacterName.cpp index fbb863ff..a7e3f5fb 100755 --- a/engine/server/library/serverDatabase/src/shared/TaskCheckCharacterName.cpp +++ b/engine/server/library/serverDatabase/src/shared/TaskCheckCharacterName.cpp @@ -16,8 +16,9 @@ // ====================================================================== TaskCheckCharacterName::TaskCheckCharacterName(uint32 stationId, const Unicode::String &name) : - m_name(name), - m_stationId(stationId) + m_name(name), + m_stationId(stationId), + m_resultCode(0) { } @@ -26,11 +27,11 @@ TaskCheckCharacterName::TaskCheckCharacterName(uint32 stationId, const Unicode:: bool TaskCheckCharacterName::process(DB::Session *session) { CheckCharacterNameQuery qry(Unicode::wideToNarrow(m_name)); - + bool rval = session->exec(&qry); qry.done(); - m_resultCode=qry.result.getValue(); + m_resultCode = qry.result.getValue(); return rval; } @@ -38,14 +39,14 @@ bool TaskCheckCharacterName::process(DB::Session *session) void TaskCheckCharacterName::onComplete() { - DataLookup::getInstance().onCharacterNameChecked(m_stationId, m_name,m_resultCode); + DataLookup::getInstance().onCharacterNameChecked(m_stationId, m_name, m_resultCode); LOG("TraceCharacterCreation", ("%d TaskCheckCharacterName(%s) complete with result code %d", m_stationId, Unicode::wideToNarrow(m_name).c_str(), m_resultCode)); } // ====================================================================== TaskCheckCharacterName::CheckCharacterNameQuery::CheckCharacterNameQuery(const std::string &name) : - character_name(name) + character_name(name) { } @@ -53,7 +54,7 @@ TaskCheckCharacterName::CheckCharacterNameQuery::CheckCharacterNameQuery(const s void TaskCheckCharacterName::CheckCharacterNameQuery::getSQL(std::string &sql) { - sql="begin :result := " + DatabaseProcess::getInstance().getSchemaQualifier() + "datalookup.check_character_name (:name); end;"; + sql = "begin :result := " + DatabaseProcess::getInstance().getSchemaQualifier() + "datalookup.check_character_name (:name); end;"; } // ---------------------------------------------------------------------- @@ -79,4 +80,4 @@ DB::Query::QueryMode TaskCheckCharacterName::CheckCharacterNameQuery::getExecuti return DB::Query::MODE_PROCEXEC; } -// ====================================================================== +// ====================================================================== \ No newline at end of file diff --git a/engine/server/library/serverGame/src/shared/command/CommandCppFuncs.cpp b/engine/server/library/serverGame/src/shared/command/CommandCppFuncs.cpp index 0478a3d6..54e165fb 100755 --- a/engine/server/library/serverGame/src/shared/command/CommandCppFuncs.cpp +++ b/engine/server/library/serverGame/src/shared/command/CommandCppFuncs.cpp @@ -146,20 +146,20 @@ namespace CommandCppFuncsNamespace { ServerObject * const actorServerObj = safe_cast(NetworkIdManager::getObjectById(actor)); CreatureObject * const actorCreature = actorServerObj != nullptr ? actorServerObj->asCreatureObject() : nullptr; - + if (actorCreature == nullptr) return; - + ShipObject * const shipObject = actorCreature->getPilotedShip(); if (shipObject == nullptr) return; - + if (!shipObject->isSlotInstalled(ShipChassisSlotType::SCST_booster)) { Chat::sendSystemMessage(*actorCreature, SharedStringIds::no_booster, Unicode::emptyString); return; } - + if (!shipObject->isComponentFunctional(ShipChassisSlotType::SCST_booster)) { Chat::sendSystemMessage(*actorCreature, SharedStringIds::booster_disabled, Unicode::emptyString); @@ -167,7 +167,7 @@ namespace CommandCppFuncsNamespace } if (onOff && shipObject->getBoosterEnergyCurrent() < shipObject->getBoosterEnergyRechargeRate()) - { + { Chat::sendSystemMessage(*actorCreature, SharedStringIds::booster_low_energy, Unicode::emptyString); return; } @@ -196,16 +196,15 @@ namespace CommandCppFuncsNamespace return o; } - ShipObject *getAttachedShip(CreatureObject *creature) { // The "attached" ship is the ship which must move along with the creature. // This means if the creature is piloting, the ship is is piloting, // or the containing ship if the creature is the ship's owner. ShipObject * const ship = ShipObject::getContainingShipObject(creature); - if ( ship - && ( ship->getOwnerId() == creature->getNetworkId() - || creature->getPilotedShip() == ship)) + if (ship + && (ship->getOwnerId() == creature->getNetworkId() + || creature->getPilotedShip() == ship)) return ship; return 0; } @@ -263,9 +262,9 @@ namespace CommandCppFuncsNamespace for (ContainerConstIterator i = container->begin(); i != container->end(); ++i) { ServerObject const * const content = safe_cast((*i).getObject()); - if ( content - && content->getGameObjectType() == SharedObjectTemplate::GOT_data_ship_control_device - && !content->isBeingDestroyed()) + if (content + && content->getGameObjectType() == SharedObjectTemplate::GOT_data_ship_control_device + && !content->isBeingDestroyed()) { Container const * const scdContainer = ContainerInterface::getContainer(*content); if (scdContainer) @@ -310,20 +309,20 @@ namespace CommandCppFuncsNamespace { bool creatureIsContainedInPOBShip(CreatureObject const * creatureObject); void removeFromGroupAndCreatePOBGroup(GroupObject * groupToRemoveFrom, - GroupMemberParam const & leader, - GroupObject::GroupMemberParamVector & membersInsidePOB); + GroupMemberParam const & leader, + GroupObject::GroupMemberParamVector & membersInsidePOB); // The owner of the POB ship is not included in the inside POB member lists void separateGroupBasedOffofPOBShip(GroupObject * groupObj, - NetworkId const & ownerOfThePOBShipId, - NetworkId const & POBShipId, - GroupObject::GroupMemberParamVector & membersInsidePOB, - GroupObject::GroupMemberParamVector & membersOutsidePOB); + NetworkId const & ownerOfThePOBShipId, + NetworkId const & POBShipId, + GroupObject::GroupMemberParamVector & membersInsidePOB, + GroupObject::GroupMemberParamVector & membersOutsidePOB); TravelPoint const * getNearestTravelPoint(std::string const & planetName, Vector const & location, std::vector const & cityBanList, uint32 faction, bool starPortAndShuttleportOnly); } void triggerSpaceEjectPlayerFromShip(CreatureObject * creatureObject); - + int const cs_spaceSpeechMultiple = 10; } @@ -340,8 +339,8 @@ bool CommandCppFuncsNamespace::GroupHelpers::creatureIsContainedInPOBShip(Creatu // ---------------------------------------------------------------------- void CommandCppFuncsNamespace::GroupHelpers::removeFromGroupAndCreatePOBGroup(GroupObject * const groupToRemoveFrom, - GroupMemberParam const & leader, - GroupObject::GroupMemberParamVector & membersInsidePOB) + GroupMemberParam const & leader, + GroupObject::GroupMemberParamVector & membersInsidePOB) { if (groupToRemoveFrom != 0) { @@ -372,10 +371,10 @@ void CommandCppFuncsNamespace::GroupHelpers::removeFromGroupAndCreatePOBGroup(Gr // The owner of the POB ship is not included in the inside POB member lists void CommandCppFuncsNamespace::GroupHelpers::separateGroupBasedOffofPOBShip(GroupObject * const groupObj, - NetworkId const & ownerOfThePOBShipId, - NetworkId const & POBShipId, - GroupObject::GroupMemberParamVector & membersInsidePOB, - GroupObject::GroupMemberParamVector & membersOutsidePOB) + NetworkId const & ownerOfThePOBShipId, + NetworkId const & POBShipId, + GroupObject::GroupMemberParamVector & membersInsidePOB, + GroupObject::GroupMemberParamVector & membersOutsidePOB) { NOT_NULL(groupObj); @@ -417,7 +416,7 @@ void CommandCppFuncsNamespace::triggerSpaceEjectPlayerFromShip(CreatureObject * GameScriptObject * gameScriptObject = creatureObject->getScriptObject(); - if(gameScriptObject != 0) + if (gameScriptObject != 0) { ScriptParams scriptParams; IGNORE_RETURN(gameScriptObject->trigAllScripts(Scripting::TRIG_SPACE_EJECT_PLAYER_FROM_SHIP, scriptParams)); @@ -484,7 +483,7 @@ static const std::string OBJVAR_PLAYERS_CAN_ACCESS_CONTAINER("players_can_access static void sendProseMessage(const CreatureObject &actor, const ServerObject * const target, StringId const &stringId) { - Chat::sendSystemMessageSimple (actor, stringId, target); + Chat::sendSystemMessageSimple(actor, stringId, target); } // ====================================================================== @@ -504,7 +503,7 @@ static std::string nextStringParm(Unicode::String const &str, size_t &curpos) size_t endpos = 0; Unicode::String token; if (!Unicode::getFirstToken(str, curpos, endpos, token)) - return std::string (); + return std::string(); curpos = endpos; return Unicode::wideToNarrow(token); } @@ -540,7 +539,6 @@ static float nextFloatParm(Unicode::String const &str, size_t &curpos) return static_cast(strtod(nextStringParm(str, curpos).c_str(), nullptr)); } - // ---------------------------------------------------------------------- static bool nextBoolParm(Unicode::String const &str, size_t &curpos) @@ -552,11 +550,11 @@ static bool nextBoolParm(Unicode::String const &str, size_t &curpos) static Vector nextVectorParm(Unicode::String const &str, size_t &curpos) { - float x=nextFloatParm(str,curpos); - float y=nextFloatParm(str,curpos); - float z=nextFloatParm(str,curpos); + float x = nextFloatParm(str, curpos); + float y = nextFloatParm(str, curpos); + float z = nextFloatParm(str, curpos); - return Vector(x,y,z); + return Vector(x, y, z); } // ====================================================================== @@ -574,7 +572,7 @@ static void commandFuncConsoleAll(Command const &command, NetworkId const &actor Client *client = obj->getClient(); if (client && client->isGod()) { - LOG("CustomerService",("Avatar:%s executing command: %s", PlayerObject::getAccountDescription(client->getCharacterObjectId()).c_str(), Unicode::wideToNarrow(params).c_str())); + LOG("CustomerService", ("Avatar:%s executing command: %s", PlayerObject::getAccountDescription(client->getCharacterObjectId()).c_str(), Unicode::wideToNarrow(params).c_str())); ConsoleMgr::processString(Unicode::wideToNarrow(params), client, 0); } } @@ -736,7 +734,7 @@ static void commandFuncAdminSetGodMode(Command const &, NetworkId const &actor, // ---------------------------------------------------------------------- static void commandFuncResetCooldowns(Command const &, NetworkId const &actor, - NetworkId const &, Unicode::String const ¶ms) + NetworkId const &, Unicode::String const ¶ms) { CreatureObject *actorObj = dynamic_cast(NetworkIdManager::getObjectById(actor)); if (actorObj) @@ -748,7 +746,7 @@ static void commandFuncResetCooldowns(Command const &, NetworkId const &actor, // ---------------------------------------------------------------------- static void commandFuncSpewCommandQueue(Command const &, NetworkId const &actor, - NetworkId const &, Unicode::String const ¶ms) + NetworkId const &, Unicode::String const ¶ms) { CreatureObject *actorObj = dynamic_cast(NetworkIdManager::getObjectById(actor)); if (actorObj) @@ -780,14 +778,14 @@ static void commandFuncAdminKick(Command const &, NetworkId const &actor, // If the target is a ship, kick all the people in the ship std::vector passengers; shipObject->findAllPassengers(passengers, true); - for (std::vector::const_iterator i=passengers.begin(); i!=passengers.end(); ++i) + for (std::vector::const_iterator i = passengers.begin(); i != passengers.end(); ++i) { KickPlayer const kickMessage((*i)->getNetworkId(), "Admin Kick"); GameServer::getInstance().sendToConnectionServers(kickMessage); } } else - { + { KickPlayer const kickMessage(who, "Admin Kick"); GameServer::getInstance().sendToConnectionServers(kickMessage); } @@ -998,7 +996,7 @@ static void commandFuncShowCtsHistory(Command const &, NetworkId const &actor, N if (orderedCtsHistory.empty()) { - ConsoleMgr::broadcastString("No CTS history found.", clientObj); + ConsoleMgr::broadcastString("No CTS history found.", clientObj); } else { @@ -1086,10 +1084,10 @@ static void commandFuncAdminTeleport(Command const &, NetworkId const &actor, Ne if (actorClient) { char buffer[512]; - snprintf(buffer, sizeof(buffer)-1, "specified coordinate (%.2f,%.2f,%.2f) (%.2f,%.2f,%.2f) is out of range", + snprintf(buffer, sizeof(buffer) - 1, "specified coordinate (%.2f,%.2f,%.2f) (%.2f,%.2f,%.2f) is out of range", position_w.x, position_w.y, position_w.z, position_p.x, position_p.y, position_p.z); - buffer[sizeof(buffer)-1] = '\0'; + buffer[sizeof(buffer) - 1] = '\0'; ConsoleMgr::broadcastString(buffer, actorClient); } @@ -1192,7 +1190,7 @@ static void commandFuncAdminListGuilds(Command const &, NetworkId const &actor, static void commandFuncAdminEditBank(Command const &cmd, NetworkId const &actor, NetworkId const &target, Unicode::String const ¶ms) { - CreatureObject * actorCreature = safe_cast(ServerWorld::findObjectByNetworkId(actor)); + CreatureObject * actorCreature = safe_cast(ServerWorld::findObjectByNetworkId(actor)); CreatureObject * targetCreature = safe_cast(ServerWorld::findObjectByNetworkId(target)); if (!targetCreature || !actorCreature) { @@ -1201,7 +1199,7 @@ static void commandFuncAdminEditBank(Command const &cmd, NetworkId const &actor, } ServerObject * targetBank = targetCreature->getBankContainer(); - if(!targetBank) + if (!targetBank) { DEBUG_REPORT_LOG(true, ("Couldn't get bank for player %s.\n", target.getValueString().c_str())); return; @@ -1238,17 +1236,17 @@ static void commandFuncAdminEditBank(Command const &cmd, NetworkId const &actor, static void commandFuncAdminEditStats(Command const &, NetworkId const &actor, NetworkId const &target, Unicode::String const &) { - CreatureObject* const creatureActor = dynamic_cast(NetworkIdManager::getObjectById (actor)); + CreatureObject* const creatureActor = dynamic_cast(NetworkIdManager::getObjectById(actor)); if (!creatureActor) { - WARNING (true, ("commandFuncAdminEditStats: nullptr actor")); + WARNING(true, ("commandFuncAdminEditStats: nullptr actor")); return; } - CreatureObject* const creatureTarget = dynamic_cast(NetworkIdManager::getObjectById (target)); + CreatureObject* const creatureTarget = dynamic_cast(NetworkIdManager::getObjectById(target)); if (!creatureTarget) { - WARNING (true, ("commandFuncAdminEditStats: nullptr target")); + WARNING(true, ("commandFuncAdminEditStats: nullptr target")); return; } @@ -1262,17 +1260,17 @@ static void commandFuncAdminEditStats(Command const &, NetworkId const &actor, N static void commandFuncAdminEditAppearance(Command const &, NetworkId const &actor, NetworkId const &target, Unicode::String const &) { - CreatureObject* const creatureActor = dynamic_cast(NetworkIdManager::getObjectById (actor)); + CreatureObject* const creatureActor = dynamic_cast(NetworkIdManager::getObjectById(actor)); if (!creatureActor) { - WARNING (true, ("commandFuncAdminEditAppearance: nullptr actor")); + WARNING(true, ("commandFuncAdminEditAppearance: nullptr actor")); return; } - CreatureObject* const creatureTarget = dynamic_cast(NetworkIdManager::getObjectById (target)); + CreatureObject* const creatureTarget = dynamic_cast(NetworkIdManager::getObjectById(target)); if (!creatureTarget) { - WARNING (true, ("commandFuncAdminEditAppearance: nullptr target")); + WARNING(true, ("commandFuncAdminEditAppearance: nullptr target")); return; } @@ -1296,7 +1294,7 @@ static void commandFuncAdminCredits(Command const &, NetworkId const &, NetworkI // ---------------------------------------------------------------------- -static void commandFuncAdminGetStationName(Command const &, NetworkId const & actor, NetworkId const & target , Unicode::String const & params) +static void commandFuncAdminGetStationName(Command const &, NetworkId const & actor, NetworkId const & target, Unicode::String const & params) { const Object * const actorObj = NetworkIdManager::getObjectById(actor); if (actorObj && actorObj->asServerObject()) @@ -1304,25 +1302,25 @@ static void commandFuncAdminGetStationName(Command const &, NetworkId const & ac Client * const actorClient = actorObj->asServerObject()->getClient(); if (actorClient) { - const CreatureObject* creatureTarget = dynamic_cast(NetworkIdManager::getObjectById (target)); + const CreatureObject* creatureTarget = dynamic_cast(NetworkIdManager::getObjectById(target)); if (!creatureTarget) { size_t pos = 0; NetworkId targetId(nextOidParm(params, pos)); - creatureTarget = dynamic_cast(NetworkIdManager::getObjectById (targetId)); + creatureTarget = dynamic_cast(NetworkIdManager::getObjectById(targetId)); } - if(!creatureTarget) + if (!creatureTarget) { ConsoleMgr::broadcastString("Could not resolve target passed to getStationName", actorClient); return; } const Client * const clientTarget = creatureTarget->getClient(); - if(clientTarget) + if (clientTarget) { const std::string & stationName = clientTarget->getAccountName(); - char buf [512]; + char buf[512]; snprintf(buf, 511, "Station name is: %s.", stationName.c_str()); ConsoleMgr::broadcastString(buf, actorClient); } @@ -1340,7 +1338,6 @@ static void commandFuncAdminGetStationName(Command const &, NetworkId const & ac static void commandFuncAuctionCreate(Command const &, NetworkId const &actor, NetworkId const &, Unicode::String const ¶ms) { - /*printf("!!!!AUCTION: process = %i\n", (int)GameServer::getInstance().getProcessId()); printf("!!!!PID = %i\n", (int)getpid()); @@ -1385,8 +1382,6 @@ static void commandFuncAuctionCreateImmediate(Command const &, NetworkId const & CreatureObject *actorCreature = dynamic_cast(NetworkIdManager::getObjectById(actor)); - - TangibleObject *itemTangible = dynamic_cast(NetworkIdManager::getObjectById(itemId)); ServerObject *auctionContainer = dynamic_cast(NetworkIdManager::getObjectById(auctionContainerId)); @@ -1413,10 +1408,10 @@ static void commandFuncAuctionBid(Command const &, NetworkId const &actor, Netwo int maxProxyBid = nextIntParm(params, pos); CreatureObject *actorCreature = dynamic_cast(NetworkIdManager::getObjectById(actor)); - CommoditiesMarket::getAuctionDetails(*actorCreature, auctionId); - if (actorCreature) { + CommoditiesMarket::getAuctionDetails(*actorCreature, auctionId); + CommoditiesMarket::auctionBid( *actorCreature, auctionId.getValue(), @@ -1498,29 +1493,29 @@ static void commandFuncSocial(Command const &command, NetworkId const &actor, Ne if (obj) { Unicode::UnicodeStringVector sv; - Unicode::tokenize (params, sv); + Unicode::tokenize(params, sv); - if (sv.empty ()) + if (sv.empty()) { - WARNING (true, ("commandFuncSocial no params")); + WARNING(true, ("commandFuncSocial no params")); return; } - const std::string & socialName = Unicode::wideToNarrow (sv [0]); - const uint32 socialType = SocialsManager::getSocialTypeByName (socialName); + const std::string & socialName = Unicode::wideToNarrow(sv[0]); + const uint32 socialType = SocialsManager::getSocialTypeByName(socialName); if (!socialType) - WARNING (true, ("commandFuncSocial Bad social type specified: [%s]", socialName.c_str ())); + WARNING(true, ("commandFuncSocial Bad social type specified: [%s]", socialName.c_str())); else { bool animationOk = true; - bool textOk = true; - if (sv.size () > 1) - animationOk = !sv [1].empty () && sv [1][0] == '1'; - if (sv.size () > 2) - textOk = !sv [2].empty () && sv [2][0] == '1'; + bool textOk = true; + if (sv.size() > 1) + animationOk = !sv[1].empty() && sv[1][0] == '1'; + if (sv.size() > 2) + textOk = !sv[2].empty() && sv[2][0] == '1'; - obj->performSocial (target, socialType, animationOk, textOk); + obj->performSocial(target, socialType, animationOk, textOk); } } } @@ -1528,7 +1523,7 @@ static void commandFuncSocial(Command const &command, NetworkId const &actor, Ne // ---------------------------------------------------------------------- -static void commandFuncSocialInternal (Command const &command, NetworkId const &actor, NetworkId const &, Unicode::String const ¶ms) +static void commandFuncSocialInternal(Command const &command, NetworkId const &actor, NetworkId const &, Unicode::String const ¶ms) { UNREF(command); if (actor != NetworkId::cms_invalid) @@ -1537,29 +1532,29 @@ static void commandFuncSocialInternal (Command const &command, NetworkId const & if (obj) { Unicode::UnicodeStringVector sv; - Unicode::tokenize (params, sv); + Unicode::tokenize(params, sv); - if (sv.size () < 2) + if (sv.size() < 2) { - WARNING (true, ("commandFuncSocial not enough params")); + WARNING(true, ("commandFuncSocial not enough params")); return; } - const NetworkId targetId (Unicode::wideToNarrow (sv [0])); - const uint32 socialType = atoi (Unicode::wideToNarrow (sv [1]).c_str()); + const NetworkId targetId(Unicode::wideToNarrow(sv[0])); + const uint32 socialType = atoi(Unicode::wideToNarrow(sv[1]).c_str()); if (!socialType) - WARNING (true, ("commandFuncSocialInternal Bad social type specified: '%d'", socialType)); + WARNING(true, ("commandFuncSocialInternal Bad social type specified: '%d'", socialType)); else { bool animationOk = true; - bool textOk = true; - if (sv.size () > 3) + bool textOk = true; + if (sv.size() > 3) { - animationOk = !sv [2].empty () && sv [2][0] == '1'; - textOk = !sv [3].empty () && sv [3][0] == '1'; + animationOk = !sv[2].empty() && sv[2][0] == '1'; + textOk = !sv[3].empty() && sv[3][0] == '1'; } - obj->performSocial (targetId, socialType, animationOk, textOk); + obj->performSocial(targetId, socialType, animationOk, textOk); } } } @@ -1567,7 +1562,7 @@ static void commandFuncSocialInternal (Command const &command, NetworkId const & //---------------------------------------------------------------------- -static void commandFuncSetMood (Command const &command, NetworkId const &actor, NetworkId const &, Unicode::String const & params) +static void commandFuncSetMood(Command const &command, NetworkId const &actor, NetworkId const &, Unicode::String const & params) { UNREF(command); if (actor != NetworkId::cms_invalid) @@ -1575,17 +1570,17 @@ static void commandFuncSetMood (Command const &command, NetworkId const &actor, CreatureObject * const obj = dynamic_cast(NetworkIdManager::getObjectById(actor)); if (obj) { - const std::string moodName = Unicode::wideToNarrow (params); + const std::string moodName = Unicode::wideToNarrow(params); if (moodName == "none") { - obj->setMood (0); + obj->setMood(0); } else { - const uint32 moodType = MoodManager::getMoodByCanonicalName (moodName); + const uint32 moodType = MoodManager::getMoodByCanonicalName(moodName); if (moodType) - obj->setMood (moodType); + obj->setMood(moodType); } } } @@ -1593,7 +1588,7 @@ static void commandFuncSetMood (Command const &command, NetworkId const &actor, // ---------------------------------------------------------------------- -static void commandFuncSetMoodInternal (Command const &command, NetworkId const &actor, +static void commandFuncSetMoodInternal(Command const &command, NetworkId const &actor, NetworkId const &, Unicode::String const ¶ms) { UNREF(command); @@ -1603,14 +1598,14 @@ static void commandFuncSetMoodInternal (Command const &command, NetworkId const if (obj) { const uint32 moodType = atoi(Unicode::wideToNarrow(params).c_str()); - obj->setMood (moodType); + obj->setMood(moodType); } } } //---------------------------------------------------------------------- -static void commandFuncRequestWaypointAtPosition (Command const &command, NetworkId const &actor, +static void commandFuncRequestWaypointAtPosition(Command const &command, NetworkId const &actor, NetworkId const &, Unicode::String const ¶ms) { UNREF(command); @@ -1619,15 +1614,15 @@ static void commandFuncRequestWaypointAtPosition (Command const &command, Networ CreatureObject * const obj = dynamic_cast(NetworkIdManager::getObjectById(actor)); if (obj) { - if(obj->isPlayerControlled()) + if (obj->isPlayerControlled()) { PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(obj); - if(playerObject) + if (playerObject) { size_t curpos = 0; uint8 color = static_cast(Waypoint::Blue); - std::string planet = nextStringParm (params, curpos); + std::string planet = nextStringParm(params, curpos); // the first parameter may be the name of the planet or an unsigned // int specifying the color of the waypoint, in which case the @@ -1636,8 +1631,8 @@ static void commandFuncRequestWaypointAtPosition (Command const &command, Networ // obfuscation to prevent player from manually entering the // requestWaypointAtPosition command and specifying the waypoint color char buffer[256]; - snprintf(buffer, sizeof(buffer)-1, "(^-,=+_)color_%s(,+-=_^)=", actor.getValueString().c_str()); - buffer[sizeof(buffer)-1] = '\0'; + snprintf(buffer, sizeof(buffer) - 1, "(^-,=+_)color_%s(,+-=_^)=", actor.getValueString().c_str()); + buffer[sizeof(buffer) - 1] = '\0'; if (planet.find(buffer) == 0) { @@ -1654,18 +1649,18 @@ static void commandFuncRequestWaypointAtPosition (Command const &command, Networ planet = nextStringParm(params, curpos); } - const float x = nextFloatParm (params, curpos); - const float y = nextFloatParm (params, curpos); - const float z = nextFloatParm (params, curpos); - curpos = Unicode::skipWhitespace (params, curpos); + const float x = nextFloatParm(params, curpos); + const float y = nextFloatParm(params, curpos); + const float z = nextFloatParm(params, curpos); + curpos = Unicode::skipWhitespace(params, curpos); const std::string& sceneId = ServerWorld::getSceneId(); StringId s("planet_n", sceneId); - const Unicode::String & name = ((curpos != Unicode::String::npos) ? (params.substr (curpos)) : (Unicode::narrowToWide("@" + s.getCanonicalRepresentation()))); + const Unicode::String & name = ((curpos != Unicode::String::npos) ? (params.substr(curpos)) : (Unicode::narrowToWide("@" + s.getCanonicalRepresentation()))); // get player object - Waypoint waypoint(playerObject->createWaypoint(Location(Vector(x, y, z), NetworkId::cms_invalid, Location::getCrcBySceneName(planet)),false)); + Waypoint waypoint(playerObject->createWaypoint(Location(Vector(x, y, z), NetworkId::cms_invalid, Location::getCrcBySceneName(planet)), false)); if (waypoint.isValid()) { waypoint.setName(name); // Waypoints are a bit like smart pointers, so this is changing the data on the PlayerObject, not just on a local variable @@ -1695,14 +1690,13 @@ static void commandFuncSpatialChatInternal(Command const &, NetworkId const &act ServerObject * const obj = safe_cast(NetworkIdManager::getObjectById(actor)); if (obj) { - size_t curpos = 0; - const NetworkId targetId (nextStringParm (params, curpos)); - const int chatType = nextIntParm (params, curpos); - const int mood = nextIntParm (params, curpos); - int flags = nextIntParm (params, curpos); - int language = nextIntParm (params, curpos); + const NetworkId targetId(nextStringParm(params, curpos)); + const int chatType = nextIntParm(params, curpos); + const int mood = nextIntParm(params, curpos); + int flags = nextIntParm(params, curpos); + int language = nextIntParm(params, curpos); // Verify the language parameter @@ -1711,29 +1705,29 @@ static void commandFuncSpatialChatInternal(Command const &, NetworkId const &act language = GameLanguageManager::getBasicLanguageId(); } - curpos = Unicode::skipWhitespace (params, curpos); + curpos = Unicode::skipWhitespace(params, curpos); if (curpos == Unicode::String::npos) { - DEBUG_WARNING (true, ("empty string in spatial chat")); + DEBUG_WARNING(true, ("empty string in spatial chat")); return; } - const size_t nullpos = params.find (static_cast(0), curpos); + const size_t nullpos = params.find(static_cast(0), curpos); Unicode::String text; Unicode::String oob; if (nullpos != Unicode::String::npos) { - text = params.substr (curpos, nullpos - curpos); - oob = params.substr (nullpos + 1); + text = params.substr(curpos, nullpos - curpos); + oob = params.substr(nullpos + 1); } else { // Strip any color codes the user may have entered - text = TextIterator(params.substr (curpos)).getPrintableText(); + text = TextIterator(params.substr(curpos)).getPrintableText(); } if (text.empty()) @@ -1741,19 +1735,19 @@ static void commandFuncSpatialChatInternal(Command const &, NetworkId const &act return; } - const bool isPrivate = SpatialChatManager::isPrivate (chatType); + const bool isPrivate = SpatialChatManager::isPrivate(chatType); if (isPrivate) flags |= MessageQueueSpatialChat::F_isPrivate; if (chatType != -1 && mood != -1 && flags != -1 && curpos != Unicode::String::npos) { - uint16 volume = SpatialChatManager::getVolume (chatType); + uint16 volume = SpatialChatManager::getVolume(chatType); CreatureObject * const creatureActor = obj->asCreatureObject(); //speak cs_spaceSpeechMultiple times when piloting a ship - if(creatureActor && creatureActor->getPilotedShip()) + if (creatureActor && creatureActor->getPilotedShip()) volume *= cs_spaceSpeechMultiple; // track amount of spatial chat for the character @@ -1786,15 +1780,15 @@ static void commandFuncSpatialChatInternal(Command const &, NetworkId const &act // character allowed to talk obj->speakText( MessageQueueSpatialChat( - CachedNetworkId(actor), - CachedNetworkId(targetId), - text, - volume, - static_cast(chatType), - static_cast(mood), - flags, - language, - oob)); + CachedNetworkId(actor), + CachedNetworkId(targetId), + text, + volume, + static_cast(chatType), + static_cast(mood), + flags, + language, + oob)); } else if (!squelched && (ConfigServerGame::getChatSpamNotifyPlayerWhenLimitedIntervalSeconds() > 0) && obj->getClient()) { @@ -1834,65 +1828,64 @@ static void commandFuncSpatialChat(Command const &, NetworkId const &actor, Netw Unicode::String moodTypeName; Unicode::String flagsString; - if (!Unicode::getFirstToken (params, curpos, curpos, chatTypeName) || curpos == Unicode::String::npos) + if (!Unicode::getFirstToken(params, curpos, curpos, chatTypeName) || curpos == Unicode::String::npos) { - WARNING (true, ("Not enough arguments to commandFuncSpatialChat (no chat type)")); + WARNING(true, ("Not enough arguments to commandFuncSpatialChat (no chat type)")); return; } - if (!Unicode::getFirstToken (params, ++curpos, curpos, moodTypeName) || curpos == Unicode::String::npos) + if (!Unicode::getFirstToken(params, ++curpos, curpos, moodTypeName) || curpos == Unicode::String::npos) { - WARNING (true, ("Not enough arguments to commandFuncSpatialChat (no mood type)")); + WARNING(true, ("Not enough arguments to commandFuncSpatialChat (no mood type)")); return; } - if (!Unicode::getFirstToken (params, ++curpos, curpos, flagsString) || curpos == Unicode::String::npos) + if (!Unicode::getFirstToken(params, ++curpos, curpos, flagsString) || curpos == Unicode::String::npos) { - WARNING (true, ("Not enough arguments to commandFuncSpatialChat (no flags)")); + WARNING(true, ("Not enough arguments to commandFuncSpatialChat (no flags)")); return; } curpos = Unicode::skipWhitespace(params, ++curpos); - const std::string & narrow_chatTypeName = Unicode::wideToNarrow (chatTypeName); - const std::string & narrow_moodTypeName = Unicode::wideToNarrow (moodTypeName); + const std::string & narrow_chatTypeName = Unicode::wideToNarrow(chatTypeName); + const std::string & narrow_moodTypeName = Unicode::wideToNarrow(moodTypeName); - const uint32 chatType = SpatialChatManager::getChatTypeByName (narrow_chatTypeName); + const uint32 chatType = SpatialChatManager::getChatTypeByName(narrow_chatTypeName); - curpos = Unicode::skipWhitespace (params, curpos); + curpos = Unicode::skipWhitespace(params, curpos); if (curpos == Unicode::String::npos) { - DEBUG_WARNING (true, ("empty string in spatial chat")); + DEBUG_WARNING(true, ("empty string in spatial chat")); return; } - size_t nullpos = params.find (static_cast(0), curpos); + size_t nullpos = params.find(static_cast(0), curpos); Unicode::String text; Unicode::String oob; if (nullpos != Unicode::String::npos) { - text = params.substr (curpos, nullpos - curpos); - oob = params.substr (nullpos + 1); + text = params.substr(curpos, nullpos - curpos); + oob = params.substr(nullpos + 1); } else { - text = params.substr (curpos); - + text = params.substr(curpos); } if (curpos != Unicode::String::npos) { - const uint32 moodType = MoodManager::getMoodByCanonicalName (narrow_moodTypeName); - const bool isPrivate = SpatialChatManager::isPrivate (chatType); + const uint32 moodType = MoodManager::getMoodByCanonicalName(narrow_moodTypeName); + const bool isPrivate = SpatialChatManager::isPrivate(chatType); - uint32 flags = atoi (Unicode::wideToNarrow (flagsString).c_str ()); + uint32 flags = atoi(Unicode::wideToNarrow(flagsString).c_str()); if (isPrivate) flags |= MessageQueueSpatialChat::F_isPrivate; - const uint16 volume = SpatialChatManager::getVolume (chatType); + const uint16 volume = SpatialChatManager::getVolume(chatType); // track amount of spatial chat for the character bool allowToSpeak = true; @@ -1924,15 +1917,15 @@ static void commandFuncSpatialChat(Command const &, NetworkId const &actor, Netw // character allowed to talk obj->speakText( MessageQueueSpatialChat( - CachedNetworkId(actor), - CachedNetworkId(targetId), - text, - volume, - static_cast(chatType), - static_cast(moodType), - flags, - 0, - oob)); + CachedNetworkId(actor), + CachedNetworkId(targetId), + text, + volume, + static_cast(chatType), + static_cast(moodType), + flags, + 0, + oob)); } else if (!squelched && (ConfigServerGame::getChatSpamNotifyPlayerWhenLimitedIntervalSeconds() > 0) && obj->getClient()) { @@ -1949,7 +1942,7 @@ static void commandFuncSpatialChat(Command const &, NetworkId const &actor, Netw } } else - WARNING (true, ("Invalid empty output string in commandFuncSpatialChat")); + WARNING(true, ("Invalid empty output string in commandFuncSpatialChat")); } } } @@ -2071,31 +2064,31 @@ static void commandFuncSystemMessage(Command const &, NetworkId const &, Network Unicode::String targetTypeStr; Unicode::String targetIdStr; - if (!Unicode::getFirstToken (params, curpos, curpos, targetTypeStr) || curpos == Unicode::String::npos) + if (!Unicode::getFirstToken(params, curpos, curpos, targetTypeStr) || curpos == Unicode::String::npos) { - WARNING (true, ("Not enough arguments to commandFuncSystemMessage (missing int value)")); + WARNING(true, ("Not enough arguments to commandFuncSystemMessage (missing int value)")); return; } - if (!Unicode::getFirstToken (params, ++curpos, curpos, targetIdStr) || curpos == Unicode::String::npos) + if (!Unicode::getFirstToken(params, ++curpos, curpos, targetIdStr) || curpos == Unicode::String::npos) { - WARNING (true, ("Not enough arguments to commandFuncSystemMessage (missing bitflags)")); + WARNING(true, ("Not enough arguments to commandFuncSystemMessage (missing bitflags)")); return; } if (curpos == Unicode::String::npos) { - WARNING (true, ("Not enough arguments to commandFuncSystemMessage (missing msg)")); + WARNING(true, ("Not enough arguments to commandFuncSystemMessage (missing msg)")); return; } curpos = Unicode::skipWhitespace(params, ++curpos); - Unicode::String output = params.substr (curpos); + Unicode::String output = params.substr(curpos); - if (output.empty ()) + if (output.empty()) { - WARNING (true, ("Not enough arguments to commandFuncSystemMessage (missing msg)")); + WARNING(true, ("Not enough arguments to commandFuncSystemMessage (missing msg)")); return; } @@ -2103,11 +2096,11 @@ static void commandFuncSystemMessage(Command const &, NetworkId const &, Network std::string targetId = Unicode::wideToNarrow(targetIdStr); static const Unicode::String oob; - if(targetType == "Player") + if (targetType == "Player") { Chat::sendInstantMessage("SYSTEM", targetId, output, oob); } - else if(targetType == "ChatChannel") + else if (targetType == "ChatChannel") { Chat::sendToRoom("SYSTEM", targetId, output, oob); } @@ -2118,32 +2111,32 @@ static void commandFuncSystemMessage(Command const &, NetworkId const &, Network static void commandFuncSetWaypointActiveStatus(Command const &, NetworkId const & actor, NetworkId const & target, Unicode::String const ¶ms) { CachedNetworkId actorId(actor); - WARNING(! actorId.getObject(), ("commandSetWaypointActiveStatus: Could not get an object for actor id %s\n", actor.getValueString().c_str())); - if(actorId.getObject()) + WARNING(!actorId.getObject(), ("commandSetWaypointActiveStatus: Could not get an object for actor id %s\n", actor.getValueString().c_str())); + if (actorId.getObject()) { CreatureObject * creature = dynamic_cast(actorId.getObject()); - if(creature) + if (creature) { - if(creature->isPlayerControlled()) + if (creature->isPlayerControlled()) { PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(creature); - if(playerObject) + if (playerObject) { Waypoint w = playerObject->getWaypoint(target); if (w.isValid()) { Unicode::String status; size_t curpos = 0; - if (!Unicode::getFirstToken (params, curpos, curpos, status)) + if (!Unicode::getFirstToken(params, curpos, curpos, status)) { - WARNING (true, ("Not enough arguments to commandFuncSystemMessage (missing int value)")); + WARNING(true, ("Not enough arguments to commandFuncSystemMessage (missing int value)")); return; } - if(status == Unicode::narrowToWide("on")) + if (status == Unicode::narrowToWide("on")) { w.setActive(true); } - else if(status == Unicode::narrowToWide("off")) + else if (status == Unicode::narrowToWide("off")) { w.setActive(false); } @@ -2159,25 +2152,25 @@ static void commandFuncSetWaypointActiveStatus(Command const &, NetworkId const static void commandFuncSetWaypointName(Command const &, NetworkId const & actor, NetworkId const & target, Unicode::String const ¶ms) { CachedNetworkId actorId(actor); - WARNING(! actorId.getObject(), ("commandFuncSetWaypointName: Could not get an object for actor id %s\n", actor.getValueString().c_str())); - if(actorId.getObject()) + WARNING(!actorId.getObject(), ("commandFuncSetWaypointName: Could not get an object for actor id %s\n", actor.getValueString().c_str())); + if (actorId.getObject()) { CreatureObject * creature = dynamic_cast(actorId.getObject()); - if(creature) + if (creature) { - if(creature->isPlayerControlled()) + if (creature->isPlayerControlled()) { PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(creature); - if(playerObject) + if (playerObject) { Waypoint w = playerObject->getWaypoint(target); if (w.isValid()) { Unicode::String name; size_t curpos = 0; - if (!Unicode::getFirstToken (params, curpos, curpos, name)) + if (!Unicode::getFirstToken(params, curpos, curpos, name)) { - WARNING (true, ("Not enough arguments to commandFuncSystemMessage (missing text value)")); + WARNING(true, ("Not enough arguments to commandFuncSystemMessage (missing text value)")); return; } w.setName(params); @@ -2198,8 +2191,8 @@ static void commandSetPosture(Command const &command, NetworkId const &actor, Ne CreatureController * const controller = dynamic_cast(actorId.getObject()->getController()); if (controller != nullptr) { - CreatureObject * const creature = safe_cast(actorId.getObject()); - NOT_NULL (creature); + CreatureObject * const creature = safe_cast(actorId.getObject()); + NOT_NULL(creature); Postures::Enumerator const posture = creature->getPosture(); // send the creature's posture to it @@ -2211,7 +2204,7 @@ static void commandSetPosture(Command const &command, NetworkId const &actor, Ne GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_ALL_CLIENT - ); + ); // Ensure the chair sitting state is off if the player is not sitting. if (posture != Postures::Sitting) @@ -2239,7 +2232,7 @@ static void commandFuncJumpServer(Command const &command, NetworkId const &actor GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_ALL_CLIENT - ); + ); } } } @@ -2414,9 +2407,9 @@ static void resolveDuelParticipants(CreatureObject &actor, TangibleObject &targe // Dueling a ship // actorFlagObj is the containing ship of the actor if he owns it ShipObject * const actorShip = ShipObject::getContainingShipObject(&actor); - if ( actorShip - && actorShip->isPlayerShip() - && actor.getNetworkId() == actorShip->getOwnerId()) + if (actorShip + && actorShip->isPlayerShip() + && actor.getNetworkId() == actorShip->getOwnerId()) actorFlagObj = actorShip; // targetMessageObj is the owner of the target ship if (targetShip->isPlayerShip()) @@ -2481,7 +2474,7 @@ static void commandFuncDuel(Command const &, NetworkId const &actor, NetworkId c return; } - if(targetObj->getObjVars().hasItem("hologram_performer")) + if (targetObj->getObjVars().hasItem("hologram_performer")) { sendProseMessage(*actorObj, targetMessageObj, CommandStringId::SID_DUEL_NOT_HOLOGRAM); } @@ -2505,58 +2498,56 @@ static void commandFuncDuel(Command const &, NetworkId const &actor, NetworkId c // Call their Script Triggers ServerObject* serverActor = actorObj->asServerObject(); - if(serverActor) + if (serverActor) { ScriptParams params; params.addParam(actor); params.addParam(target); - if(serverActor->getScriptObject()) + if (serverActor->getScriptObject()) { IGNORE_RETURN(serverActor->getScriptObject()->trigAllScripts(Scripting::TRIG_ON_DUEL_START, params)); - } } ServerObject* serverTarget = targetObj->asServerObject(); - if(serverTarget) + if (serverTarget) { ScriptParams params; params.addParam(actor); params.addParam(target); - if(serverTarget->getScriptObject()) + if (serverTarget->getScriptObject()) { - IGNORE_RETURN( serverTarget->getScriptObject()->trigAllScripts(Scripting::TRIG_ON_DUEL_START, params)); + IGNORE_RETURN(serverTarget->getScriptObject()->trigAllScripts(Scripting::TRIG_ON_DUEL_START, params)); } } /// End script triggers. - } else { // Duel Request // Call their Script Triggers ServerObject* serverActor = actorObj->asServerObject(); - if(serverActor) + if (serverActor) { ScriptParams params; params.addParam(actor); params.addParam(target); - if(serverActor->getScriptObject()) + if (serverActor->getScriptObject()) { - if( serverActor->getScriptObject()->trigAllScripts(Scripting::TRIG_ON_DUEL_REQUEST, params) == SCRIPT_OVERRIDE ) + if (serverActor->getScriptObject()->trigAllScripts(Scripting::TRIG_ON_DUEL_REQUEST, params) == SCRIPT_OVERRIDE) return; } } ServerObject* serverTarget = targetObj->asServerObject(); - if(serverTarget) + if (serverTarget) { ScriptParams params; params.addParam(actor); params.addParam(target); - if(serverTarget->getScriptObject()) + if (serverTarget->getScriptObject()) { - if( serverTarget->getScriptObject()->trigAllScripts(Scripting::TRIG_ON_DUEL_REQUEST, params) == SCRIPT_OVERRIDE ) + if (serverTarget->getScriptObject()->trigAllScripts(Scripting::TRIG_ON_DUEL_REQUEST, params) == SCRIPT_OVERRIDE) return; } } @@ -2597,16 +2588,16 @@ static void commandFuncEndDuel(Command const &, NetworkId const &actor, NetworkI // notify script that the duel has ended because of the EndDuel command { - ScriptParams params; - params.addParam(targetObj->getNetworkId(), "target"); - ScriptDictionaryPtr dictionary; - GameScriptObject::makeScriptDictionary(params, dictionary); - if (dictionary.get() != nullptr) - { - dictionary->serialize(); - MessageToQueue::getInstance().sendMessageToJava(actorFlagObj->getNetworkId(), - "endDuelCommandNotification", dictionary->getSerializedData(), 0, false); - } + ScriptParams params; + params.addParam(targetObj->getNetworkId(), "target"); + ScriptDictionaryPtr dictionary; + GameScriptObject::makeScriptDictionary(params, dictionary); + if (dictionary.get() != nullptr) + { + dictionary->serialize(); + MessageToQueue::getInstance().sendMessageToJava(actorFlagObj->getNetworkId(), + "endDuelCommandNotification", dictionary->getSerializedData(), 0, false); + } } { @@ -2617,7 +2608,7 @@ static void commandFuncEndDuel(Command const &, NetworkId const &actor, NetworkI if (dictionary.get() != nullptr) { dictionary->serialize(); - MessageToQueue::getInstance().sendMessageToJava(targetObj->getNetworkId(), + MessageToQueue::getInstance().sendMessageToJava(targetObj->getNetworkId(), "endDuelCommandNotification", dictionary->getSerializedData(), 0, false); } } @@ -2650,7 +2641,7 @@ static void commandFuncHarvesterActivate(Command const &, NetworkId const &actor CreatureObject *actorObj = dynamic_cast(NetworkIdManager::getObjectById(actor)); HarvesterInstallationObject *targetObj = dynamic_cast(NetworkIdManager::getObjectById(target)); if (targetObj && actorObj && targetObj->isOnAdminList(*actorObj)) - targetObj->activate(actor); + targetObj->activate(actor); } // ---------------------------------------------------------------------- @@ -2660,8 +2651,7 @@ static void commandFuncHarvesterDeactivate(Command const &, NetworkId const &act CreatureObject *actorObj = dynamic_cast(NetworkIdManager::getObjectById(actor)); HarvesterInstallationObject *targetObj = dynamic_cast(NetworkIdManager::getObjectById(target)); if (targetObj && actorObj &&targetObj->isOnAdminList(*actorObj)) - targetObj->deactivate(); - + targetObj->deactivate(); } // ---------------------------------------------------------------------- @@ -2671,7 +2661,7 @@ static void commandFuncHarvesterHarvest(Command const &, NetworkId const &actor, CreatureObject *actorObj = dynamic_cast(NetworkIdManager::getObjectById(actor)); HarvesterInstallationObject *targetObj = dynamic_cast(NetworkIdManager::getObjectById(target)); if (targetObj && actorObj && targetObj->isOnAdminList(*actorObj)) - targetObj->harvest(); + targetObj->harvest(); } // ---------------------------------------------------------------------- @@ -2701,14 +2691,14 @@ static void commandFuncHarvesterMakeCrate(Command const &, NetworkId const &acto { CreatureObject *actorObj = dynamic_cast(NetworkIdManager::getObjectById(actor)); HarvesterInstallationObject *targetObj = dynamic_cast(NetworkIdManager::getObjectById(target)); - size_t pos=0; - const NetworkId resourceId = nextOidParm(params,pos); - const int amount = nextIntParm(params,pos); - const bool discard = nextBoolParm(params,pos); - const uint8 sequenceId = static_cast(nextIntParm(params,pos)); + size_t pos = 0; + const NetworkId resourceId = nextOidParm(params, pos); + const int amount = nextIntParm(params, pos); + const bool discard = nextBoolParm(params, pos); + const uint8 sequenceId = static_cast(nextIntParm(params, pos)); if (targetObj && actorObj && targetObj->isOnAdminList(*actorObj)) - targetObj->emptyHopper(actor,resourceId,amount,discard,sequenceId); + targetObj->emptyHopper(actor, resourceId, amount, discard, sequenceId); } // ---------------------------------------------------------------------- @@ -2727,14 +2717,13 @@ static void commandFuncResourceContainerTransfer(Command const &, NetworkId cons CreatureObject * const player = safe_cast(ServerWorld::findObjectByNetworkId(actor)); if (!player) return; - + ResourceContainerObject *sourceObj = dynamic_cast(NetworkIdManager::getObjectById(target)); size_t pos = 0; - NetworkId destId = nextOidParm(params,pos); + NetworkId destId = nextOidParm(params, pos); ResourceContainerObject *destObj = dynamic_cast(NetworkIdManager::getObjectById(destId)); - int amount = nextIntParm(params,pos); + int amount = nextIntParm(params, pos); - if (!sourceObj || !destObj || amount <= 0) return; @@ -2749,7 +2738,7 @@ static void commandFuncResourceContainerTransfer(Command const &, NetworkId cons ContainerInterface::sendContainerMessageToClient(*player, error, destObj); return; } - + sourceObj->transferTo(*destObj, amount); } @@ -2768,7 +2757,7 @@ static void commandFuncRequestSurvey(Command const &, NetworkId const &actor, Ne if (actorObj && actorObj->getClient()) { size_t curpos = 0; - Unicode::String resourceName = Unicode::narrowToWide(nextStringParm (params, curpos)); + Unicode::String resourceName = Unicode::narrowToWide(nextStringParm(params, curpos)); ScriptParams params; params.addParam(actor); @@ -2789,7 +2778,7 @@ static void commandFuncRequestCoreSample(Command const &, NetworkId const &actor if (actorObj && actorObj->getClient()) { size_t curpos = 0; - Unicode::String resourceName = Unicode::narrowToWide(nextStringParm (params, curpos)); + Unicode::String resourceName = Unicode::narrowToWide(nextStringParm(params, curpos)); ScriptParams params; params.addParam(actor); @@ -2815,19 +2804,19 @@ static void commandFuncResourceContainerSplit(Command const &, NetworkId const & return; size_t pos = 0; - const int amount = nextIntParm(params,pos); - const CachedNetworkId destContainer (nextOidParm(params,pos)); - const int arrangementId = nextIntParm(params,pos); - const Vector & newLocation = nextVectorParm(params,pos); + const int amount = nextIntParm(params, pos); + const CachedNetworkId destContainer(nextOidParm(params, pos)); + const int arrangementId = nextIntParm(params, pos); + const Vector & newLocation = nextVectorParm(params, pos); Container::ContainerErrorCode error = Container::CEC_Success; if (!player->canManipulateObject(*sourceObj, true, true, true, 10.0f, error)) { ContainerInterface::sendContainerMessageToClient(*player, error, sourceObj); } - else if (!sourceObj->splitContainer(amount,destContainer,arrangementId,newLocation, safe_cast(NetworkIdManager::getObjectById(actor)))) + else if (!sourceObj->splitContainer(amount, destContainer, arrangementId, newLocation, safe_cast(NetworkIdManager::getObjectById(actor)))) { - ContainerInterface::sendContainerMessageToClient(*player, Container::CEC_Full, safe_cast(destContainer.getObject ())); + ContainerInterface::sendContainerMessageToClient(*player, Container::CEC_Full, safe_cast(destContainer.getObject())); } } @@ -2844,8 +2833,8 @@ static void commandFuncFactoryCrateSplit(Command const &, NetworkId const &actor return; size_t pos = 0; - const int amount = nextIntParm(params,pos); - const CachedNetworkId destContainerId (nextOidParm(params,pos)); + const int amount = nextIntParm(params, pos); + const CachedNetworkId destContainerId(nextOidParm(params, pos)); ServerObject * destContainer = safe_cast(destContainerId.getObject()); if (destContainer == nullptr || ContainerInterface::getVolumeContainer(*destContainer) == nullptr) { @@ -2873,9 +2862,9 @@ static void commandFuncPermissionListModify(Command const &, NetworkId const &ac if (actorObj && actorObj->getClient()) { size_t curpos = 0; - const Unicode::String & playerName = Unicode::narrowToWide(nextStringParm (params, curpos)); - const Unicode::String & listName = Unicode::narrowToWide(nextStringParm (params, curpos)); - const Unicode::String & action = Unicode::narrowToWide(nextStringParm (params, curpos)); + const Unicode::String & playerName = Unicode::narrowToWide(nextStringParm(params, curpos)); + const Unicode::String & listName = Unicode::narrowToWide(nextStringParm(params, curpos)); + const Unicode::String & action = Unicode::narrowToWide(nextStringParm(params, curpos)); ScriptParams params; params.addParam(actor); @@ -2927,8 +2916,8 @@ static void commandFuncHarvesterGetResourceData(Command const &, NetworkId const //------------------------------------------------------------------------------------------ static void commandFuncTransferItem(Command const &, NetworkId const &actor, NetworkId const &target, Unicode::String const & params) { - ServerObject * const item = ServerWorld::findObjectByNetworkId(target); - ServerObject * const playerSo = ServerWorld::findObjectByNetworkId(actor); + ServerObject * const item = ServerWorld::findObjectByNetworkId(target); + ServerObject * const playerSo = ServerWorld::findObjectByNetworkId(actor); if (!playerSo || !item) { @@ -2945,7 +2934,7 @@ static void commandFuncTransferItem(Command const &, NetworkId const &actor, Net size_t curpos = 0; const NetworkId & destId = nextOidParm(params, curpos); - const int arrangement = nextIntParm(params, curpos); + const int arrangement = nextIntParm(params, curpos); const Vector & pos = nextVectorParm(params, curpos); Transform t; t.setPosition_p(pos); @@ -2999,10 +2988,10 @@ static void commandFuncTransferItem(Command const &, NetworkId const &actor, Net if (!canManipulateTarget) { - if(errorCode == Container::CEC_NoPermission) + if (errorCode == Container::CEC_NoPermission) { Object * parentObject = ContainerInterface::getContainedByObject(*item); - if(parentObject && parentObject->asServerObject() && parentObject->asServerObject()->asTangibleObject() + if (parentObject && parentObject->asServerObject() && parentObject->asServerObject()->asTangibleObject() && parentObject->asServerObject()->asTangibleObject()->isLocked()) { ContainerInterface::sendContainerMessageToClient(*player, errorCode, parentObject->asServerObject()); @@ -3015,50 +3004,48 @@ static void commandFuncTransferItem(Command const &, NetworkId const &actor, Net //-- don't transfer from/to factory crates { - if (destination && destination->getGameObjectType () == SharedObjectTemplate::GOT_misc_factory_crate) + if (destination && destination->getGameObjectType() == SharedObjectTemplate::GOT_misc_factory_crate) return; - const ServerObject * const containedBy = safe_cast(ContainerInterface::getContainedByObject (*item)); + const ServerObject * const containedBy = safe_cast(ContainerInterface::getContainedByObject(*item)); - if (containedBy && containedBy->getGameObjectType () == SharedObjectTemplate::GOT_misc_factory_crate) + if (containedBy && containedBy->getGameObjectType() == SharedObjectTemplate::GOT_misc_factory_crate) return; } // If our destination is a locked container, make sure we can access it. bool lockedDestContainer = false; { - if(destination && destination->asTangibleObject() && destination->asTangibleObject()->isLocked()) + if (destination && destination->asTangibleObject() && destination->asTangibleObject()->isLocked()) { lockedDestContainer = true; TangibleObject * destTangible = destination->asTangibleObject(); - if(!destTangible->isUserOnAccessList(player->getNetworkId()) && !destTangible->isGuildOnAccessList(player->getGuildId()) + if (!destTangible->isUserOnAccessList(player->getNetworkId()) && !destTangible->isGuildOnAccessList(player->getGuildId()) && player->getClient() && !player->getClient()->isGod()) { ContainerInterface::sendContainerMessageToClient(*player, Container::CEC_NoPermission, destination); return; } } - } { // No Drag and Drop while using Loot rules (especially random). const ServerObject * source = getFirstCreatureContainer(item); - if(source && source->asCreatureObject() && source->asCreatureObject()->isDead() && destination) + if (source && source->asCreatureObject() && source->asCreatureObject()->isDead() && destination) { const ServerObject* dest = getFirstCreatureContainer(destination); - if(dest && dest->asCreatureObject() && dest->asCreatureObject()->getGroup()) + if (dest && dest->asCreatureObject() && dest->asCreatureObject()->getGroup()) { int lootRule = dest->asCreatureObject()->getGroup()->getLootRule(); // Random/Lotto Loot Rule, no drag and drop allowed! - if(lootRule == 3 || lootRule == 2) + if (lootRule == 3 || lootRule == 2) { return; } } } - } if (!item->isAuthoritative()) @@ -3107,8 +3094,8 @@ static void commandFuncTransferItem(Command const &, NetworkId const &actor, Net } //Don't allow people to put things in unowned containers. Locked containers are allowed since they enforce their own list. - if (!destination->getObjVars().hasItem(OBJVAR_PLAYERS_CAN_ACCESS_CONTAINER) && !lockedDestContainer && - player->getClient() && !player->getClient()->isGod() && + if (!destination->getObjVars().hasItem(OBJVAR_PLAYERS_CAN_ACCESS_CONTAINER) && !lockedDestContainer && + player->getClient() && !player->getClient()->isGod() && destination->getOwnerId() == NetworkId::cms_invalid) { errorCode = Container::CEC_NoPermission; @@ -3143,32 +3130,31 @@ static void commandFuncTransferItem(Command const &, NetworkId const &actor, Net { int oldCap = volContainer->debugDoNotUseSetCapacity(allowedOverload); retval = ContainerInterface::transferItemToVolumeContainer(*destination, *item, player, errorCode, true); - IGNORE_RETURN( volContainer->debugDoNotUseSetCapacity(oldCap) ); + IGNORE_RETURN(volContainer->debugDoNotUseSetCapacity(oldCap)); } } } else { const Object * destParent = ContainerInterface::getContainedByObject(*destination); - if(destParent && destParent == player->getAppearanceInventory()) + if (destParent && destParent == player->getAppearanceInventory()) { // Trying to transfer to a container currently in our Appearance inventory. Not allowed. StringId const code("container_error_message", "container34_prose"); ProsePackage pp; pp.stringId = code; - pp.actor.id = player->getNetworkId (); + pp.actor.id = player->getNetworkId(); // Send to the player. - Chat::sendSystemMessage (*player, pp); + Chat::sendSystemMessage(*player, pp); retval = false; - } else if (destination == player->getAppearanceInventory() && ContainerInterface::getContainer(*item) != nullptr) { const Container * itemContainer = ContainerInterface::getContainer(*item); - if(itemContainer && itemContainer->getNumberOfItems() == 0) + if (itemContainer && itemContainer->getNumberOfItems() == 0) { retval = ContainerInterface::transferItemToUnknownContainer(*destination, *item, arrangement, t, player, errorCode); } @@ -3178,16 +3164,16 @@ static void commandFuncTransferItem(Command const &, NetworkId const &actor, Net ProsePackage pp; pp.stringId = code; - pp.actor.id = player->getNetworkId (); + pp.actor.id = player->getNetworkId(); // Send to the player. - Chat::sendSystemMessage (*player, pp); + Chat::sendSystemMessage(*player, pp); } } else { retval = ContainerInterface::transferItemToUnknownContainer(*destination, *item, arrangement, t, player, errorCode); - + // if we are equipping an object to a filled slot, move the equipped item(s) to our inventory if (!retval && errorCode == Container::CEC_SlotOccupied && destination->getNetworkId() == player->getNetworkId()) { @@ -3223,7 +3209,6 @@ static void commandFuncTransferItem(Command const &, NetworkId const &actor, Net reequipItems(*destination, oldItems); retval = false; } - } else { @@ -3239,14 +3224,14 @@ static void commandFuncTransferItem(Command const &, NetworkId const &actor, Net if (!retval && player) { - if(errorCode == Container::CEC_SlotOccupied && destination == player->getAppearanceInventory()) + if (errorCode == Container::CEC_SlotOccupied && destination == player->getAppearanceInventory()) { // Failed to place an object in our appearance inventory. Let's flush out some more information. ServerObject * appearanceInv = player->getAppearanceInventory(); const SlottedContainer * equipment = ContainerInterface::getSlottedContainer(*appearanceInv); const SlottedContainmentProperty * itemContainmentProperty = ContainerInterface::getSlottedContainmentProperty(*item); - if(!itemContainmentProperty || !equipment || arrangement < 0) + if (!itemContainmentProperty || !equipment || arrangement < 0) { // This should never happen, but if it does - just send our normal bland error message. ContainerInterface::sendContainerMessageToClient(*player, errorCode); @@ -3262,16 +3247,16 @@ static void commandFuncTransferItem(Command const &, NetworkId const &actor, Net ServerObject * oldItem = safe_cast(currentWeaponId.getObject()); if (oldItem != nullptr) { - if( std::find(objectsToSend.begin(), objectsToSend.end(), oldItem) == objectsToSend.end() ) + if (std::find(objectsToSend.begin(), objectsToSend.end(), oldItem) == objectsToSend.end()) objectsToSend.push_back(oldItem); } } - + std::vector::iterator iter = objectsToSend.begin(); - for(; iter != objectsToSend.end(); ++iter) + for (; iter != objectsToSend.end(); ++iter) { // No idea how this could happen, but just incase. - if((*iter) == nullptr) + if ((*iter) == nullptr) continue; StringId const code("container_error_message", "container32_prose"); @@ -3280,22 +3265,22 @@ static void commandFuncTransferItem(Command const &, NetworkId const &actor, Net ProsePackage pp; pp.stringId = code; - pp.target.id = (*iter)->getNetworkId (); - pp.target.str = (*iter)->getAssignedObjectName (); - if (pp.target.str.empty ()) - pp.target.stringId = (*iter)->getObjectNameStringId (); + pp.target.id = (*iter)->getNetworkId(); + pp.target.str = (*iter)->getAssignedObjectName(); + if (pp.target.str.empty()) + pp.target.stringId = (*iter)->getObjectNameStringId(); - pp.other.id = item->getNetworkId(); - pp.other.str = item->getAssignedObjectName(); + pp.other.id = item->getNetworkId(); + pp.other.str = item->getAssignedObjectName(); if (pp.other.str.empty()) pp.other.stringId = item->getObjectNameStringId(); - pp.actor.id = player->getNetworkId (); + pp.actor.id = player->getNetworkId(); // Send to the player. - Chat::sendSystemMessage (*player, pp); + Chat::sendSystemMessage(*player, pp); } - + return; } @@ -3340,14 +3325,13 @@ static void commandFuncTransferWeapon(Command const & c, NetworkId const &actor, size_t curpos = 0; const NetworkId & destId = nextOidParm(params, curpos); - const int arrangement = nextIntParm(params, curpos); + const int arrangement = nextIntParm(params, curpos); UNREF(destId); - + if (item && actorObject && isGoingInWeaponSlot(*item, arrangement)) { commandFuncTransferItem(c, actor, target, params); } - } //------------------------------------------------------------------------------------------ @@ -3367,14 +3351,14 @@ void CommandCppFuncs::commandFuncTransferMisc(Command const & c, NetworkId const { ServerObject * item = ServerWorld::findObjectByNetworkId(target); CreatureObject * actorObject = safe_cast(ServerWorld::findObjectByNetworkId(actor)); - + size_t curpos = 0; const NetworkId & destId = nextOidParm(params, curpos); - const int arrangement = nextIntParm(params, curpos); + const int arrangement = nextIntParm(params, curpos); //This command can only be used to transfer non-weapon objects not contained directly by the player unless it is not armor if (item && actorObject && !isGoingInWeaponSlot(*item, arrangement) && - ( destId != actor || !GameObjectTypes::isTypeOf(item->getGameObjectType(), SharedObjectTemplate::GOT_armor)) ) + (destId != actor || !GameObjectTypes::isTypeOf(item->getGameObjectType(), SharedObjectTemplate::GOT_armor))) { commandFuncTransferItem(c, actor, target, params); } @@ -3402,23 +3386,23 @@ static void commandFuncOpenContainer(Command const & cmd, NetworkId const &actor } //-- don't open factory crates - if (container->getGameObjectType () == SharedObjectTemplate::GOT_misc_factory_crate) + if (container->getGameObjectType() == SharedObjectTemplate::GOT_misc_factory_crate) return; //-- if they are opening a crafting station, what they really want is the hopper //-- but only if the object is not a volume container - if (container->getGameObjectType () == SharedObjectTemplate::GOT_misc_crafting_station - && (nullptr == ContainerInterface::getVolumeContainer (*container))) - { + if (container->getGameObjectType() == SharedObjectTemplate::GOT_misc_crafting_station + && (nullptr == ContainerInterface::getVolumeContainer(*container))) + { static const SlotId inputHopperId(SlotIdManager::findSlotId(CrcLowerString("ingredient_hopper"))); ServerObject const * const station = container; ServerObject * hopper = nullptr; - const SlottedContainer * stationContainer = ContainerInterface::getSlottedContainer (*station); + const SlottedContainer * stationContainer = ContainerInterface::getSlottedContainer(*station); if (stationContainer != nullptr) { Container::ContainerErrorCode tmp = Container::CEC_Success; - Object* tmpHopperObj = (stationContainer->getObjectInSlot (inputHopperId, tmp)).getObject(); + Object* tmpHopperObj = (stationContainer->getObjectInSlot(inputHopperId, tmp)).getObject(); if (tmp == Container::CEC_Success && tmpHopperObj) { hopper = tmpHopperObj->asServerObject(); @@ -3439,18 +3423,18 @@ static void commandFuncOpenContainer(Command const & cmd, NetworkId const &actor size_t curpos = 0; std::string slotName; - int sequence = nextIntParm (params, curpos); + int sequence = nextIntParm(params, curpos); if (curpos != std::string::npos) { ++curpos; - slotName = nextStringParm (params, curpos); + slotName = nextStringParm(params, curpos); } if (container->isAuthoritative()) { Container::ContainerErrorCode code = Container::CEC_Success; - bool const isPublicContainer = container->getGameObjectType () == SharedObjectTemplate::GOT_misc_container_public; + bool const isPublicContainer = container->getGameObjectType() == SharedObjectTemplate::GOT_misc_container_public; if (isPublicContainer && player->getClient()) ObserveTracker::onClientAboutToOpenPublicContainer(*player->getClient(), *container); @@ -3461,10 +3445,10 @@ static void commandFuncOpenContainer(Command const & cmd, NetworkId const &actor if (player->canManipulateObject(*container, false, doPermissionCheckOnItem, doPermissionCheckOnParents, 6.0f, code)) { // Additional check for Locked containers. - if(container->asTangibleObject() && container->asTangibleObject()->isLocked()) + if (container->asTangibleObject() && container->asTangibleObject()->isLocked()) { TangibleObject * tangibleTarget = container->asTangibleObject(); - if(!tangibleTarget->isUserOnAccessList(player->getNetworkId()) && !tangibleTarget->isGuildOnAccessList(player->getGuildId())) + if (!tangibleTarget->isUserOnAccessList(player->getNetworkId()) && !tangibleTarget->isGuildOnAccessList(player->getGuildId())) { // Player is NOT on the admin list or guild list, they cannot open the container. ContainerInterface::sendContainerMessageToClient(*player, Container::CEC_NoPermission, container); @@ -3532,7 +3516,6 @@ static void commandFuncCloseContainer(Command const &, NetworkId const &actor, N //@todo the player is trying to access a container not on this server. Somehow get it here //Then do the check } - } //------------------------------------------------------------------------------------------ @@ -3591,7 +3574,7 @@ static void commandFuncCloseLotteryContainer(Command const & cmd, NetworkId cons */ static void commandFuncGiveItem(Command const &, NetworkId const &actor, NetworkId const &target, Unicode::String const & params) { - ServerObject * const item = ServerWorld::findObjectByNetworkId(target); + ServerObject * const item = ServerWorld::findObjectByNetworkId(target); ServerObject * const player = ServerWorld::findObjectByNetworkId(actor); if (!player || !item) { @@ -3654,14 +3637,14 @@ static void commandFuncGiveItem(Command const &, NetworkId const &actor, Network TangibleObject * const gem = dynamic_cast(item); if (gem != nullptr) { - const int destGot = socket->getGameObjectType(); + const int destGot = socket->getGameObjectType(); const SharedTangibleObjectTemplate * const gemTemplate = safe_cast(gem->getSharedTemplate()); - const int count = gemTemplate->getSocketDestinationsCount(); + const int count = gemTemplate->getSocketDestinationsCount(); for (int i = 0; i < count; ++i) { const int gemSocketGot = gemTemplate->getSocketDestinations(i); - if (destGot == gemSocketGot || GameObjectTypes::isTypeOf (destGot, gemSocketGot)) + if (destGot == gemSocketGot || GameObjectTypes::isTypeOf(destGot, gemSocketGot)) { // make sure the gem and socket are both in the player's inventory if (!socket->isContainedBy(*player, true) || @@ -3706,14 +3689,13 @@ static void commandFuncGiveItem(Command const &, NetworkId const &actor, Network // nope, pass it on to scripts ScriptParams scriptParameters; - scriptParameters.addParam (target); - scriptParameters.addParam (actor); + scriptParameters.addParam(target); + scriptParameters.addParam(actor); if (destination->getScriptObject()->trigAllScripts(Scripting::TRIG_GIVE_ITEM, scriptParameters) == SCRIPT_OVERRIDE) { item->permanentlyDestroy(DeleteReasons::BadContainerTransfer); } - } // ---------------------------------------------------------------------- @@ -3776,8 +3758,8 @@ static void commandFuncGroupInvite(Command const & command, NetworkId const &act // send a messageTo to the target to invite to group char buffer[1024]; - snprintf(buffer, sizeof(buffer)-1, "%s|%s|%s|%s", actor.getValueString().c_str(), (actorShipObject ? actorShipObject->getNetworkId().getValueString().c_str() : "0"), (groupObj ? groupObj->getNetworkId().getValueString().c_str() : "0"), Unicode::wideToNarrow(actorObj->getAssignedObjectName()).c_str()); - buffer[sizeof(buffer)-1] = '\0'; + snprintf(buffer, sizeof(buffer) - 1, "%s|%s|%s|%s", actor.getValueString().c_str(), (actorShipObject ? actorShipObject->getNetworkId().getValueString().c_str() : "0"), (groupObj ? groupObj->getNetworkId().getValueString().c_str() : "0"), Unicode::wideToNarrow(actorObj->getAssignedObjectName()).c_str()); + buffer[sizeof(buffer) - 1] = '\0'; MessageToQueue::getInstance().sendMessageToC(parsedNetworkId, "C++InviteToGroupReq", @@ -3823,8 +3805,8 @@ static void commandFuncGroupUninvite(Command const &, NetworkId const &actor, Ne // send a messageTo to the target to uninvite char buffer[1024]; - snprintf(buffer, sizeof(buffer)-1, "%s|%s", actor.getValueString().c_str(), Unicode::wideToNarrow(actorObj->getAssignedObjectName()).c_str()); - buffer[sizeof(buffer)-1] = '\0'; + snprintf(buffer, sizeof(buffer) - 1, "%s|%s", actor.getValueString().c_str(), Unicode::wideToNarrow(actorObj->getAssignedObjectName()).c_str()); + buffer[sizeof(buffer) - 1] = '\0'; MessageToQueue::getInstance().sendMessageToC(parsedNetworkId, "C++UninviteFromGroupReq", @@ -3944,10 +3926,10 @@ static void commandFuncGroupDisband(Command const &, NetworkId const &actor, Net GroupObject::GroupMemberParamVector membersOutsidePOB; GroupHelpers::separateGroupBasedOffofPOBShip(groupObj, - actor, - POBShipId, - membersInsidePOB, - membersOutsidePOB); + actor, + POBShipId, + membersInsidePOB, + membersOutsidePOB); // if there are no members outside, then the group only consisted of // the people in the POB. If that's the case, then don't destroy the @@ -4025,10 +4007,10 @@ static void commandFuncGroupDisband(Command const &, NetworkId const &actor, Net NetworkId const & POBShipId = (*ii).m_memberShipId; GroupHelpers::separateGroupBasedOffofPOBShip(groupObj, - memberId, - POBShipId, - membersInsidePOB[memberId], - membersOutsidePOB[memberId]); + memberId, + POBShipId, + membersInsidePOB[memberId], + membersOutsidePOB[memberId]); } } @@ -4150,7 +4132,7 @@ static void commandFuncGroupDisband(Command const &, NetworkId const &actor, Net static void commandFuncKickFromShip(Command const &, NetworkId const & actor, NetworkId const & target, Unicode::String const ¶ms) { - CreatureObject const * const actorObject = dynamic_cast(ServerWorld::findObjectByNetworkId(actor)); + CreatureObject const * const actorObject = dynamic_cast(ServerWorld::findObjectByNetworkId(actor)); if (actorObject != 0) { CreatureObject * const targetObject = dynamic_cast(ServerWorld::findObjectByNetworkId(target)); @@ -4209,7 +4191,6 @@ static void commandFuncAuctionChat(Command const &, NetworkId const &actor, Netw const std::string channelName = "SWG." + GameServer::getInstance().getClusterName() + "." + ServerWorld::getSceneId() + ".named.Auction"; Chat::sendToRoom(firstName, channelName, params, Unicode::String()); - } } @@ -4357,8 +4338,8 @@ static void commandFuncCreateGroupPickup(Command const &, NetworkId const &actor if ((iterGroupMember->first != actor) && groupObj->isMemberPC(iterGroupMember->first)) { char buffer[1024]; - snprintf(buffer, sizeof(buffer)-1, "%s|%d|%d|%d|%s", currentScene.c_str(), static_cast(currentWorldLocation.x), static_cast(currentWorldLocation.y), static_cast(currentWorldLocation.z), actorName.c_str()); - buffer[sizeof(buffer)-1] = '\0'; + snprintf(buffer, sizeof(buffer) - 1, "%s|%d|%d|%d|%s", currentScene.c_str(), static_cast(currentWorldLocation.x), static_cast(currentWorldLocation.y), static_cast(currentWorldLocation.z), actorName.c_str()); + buffer[sizeof(buffer) - 1] = '\0'; MessageToQueue::getInstance().sendMessageToC(iterGroupMember->first, "C++GroupPickupPointCreated", @@ -4558,7 +4539,7 @@ static void commandFuncUseGroupPickup(Command const &, NetworkId const &actor, N return; } - // if nearest travel point and current planet is the same, and the nearest travel point to the + // if nearest travel point and current planet is the same, and the nearest travel point to the // group pickup point is farther away than the current location to the group pickup point, then // fail, as there is no need to travel as the player is currently closer to the group pickup point if ((sceneIdOfNearestTravelPoint == currentScene) && (sceneIdOfNearestTravelPoint == groupPickupLocation.first) && (groupPickupLocation.second.magnitudeBetweenSquared(nearestTravelPoint->getPosition_w()) > groupPickupLocation.second.magnitudeBetweenSquared(currentWorldLocation))) @@ -4613,8 +4594,8 @@ static void commandFuncUseGroupPickup(Command const &, NetworkId const &actor, N if (cityHallAtNearestTravelPoint.isValid() && (cityShareOfCost > 0)) { char buffer[64]; - snprintf(buffer, sizeof(buffer)-1, "%d", cityShareOfCost); - buffer[sizeof(buffer)-1] = '\0'; + snprintf(buffer, sizeof(buffer) - 1, "%d", cityShareOfCost); + buffer[sizeof(buffer) - 1] = '\0'; MessageToQueue::getInstance().sendMessageToC(cityHallAtNearestTravelPoint, "C++CityShareGroupPickupPointTravelCost", @@ -5247,37 +5228,37 @@ static void commandFuncShowMusicianVisuals(Command const &, NetworkId const &act // ---------------------------------------------------------------------- -static void commandFuncPlaceStructure (const Command& /*command*/, const NetworkId& actor, const NetworkId& /*target*/, const Unicode::String& parameters) +static void commandFuncPlaceStructure(const Command& /*command*/, const NetworkId& actor, const NetworkId& /*target*/, const Unicode::String& parameters) { - Object* const object = NetworkIdManager::getObjectById (actor); + Object* const object = NetworkIdManager::getObjectById(actor); if (!object) { - DEBUG_WARNING (true, ("commandFuncPlaceStructure: PB nullptr actor\n")); + DEBUG_WARNING(true, ("commandFuncPlaceStructure: PB nullptr actor\n")); return; } ServerObject* const serverObject = dynamic_cast (object); if (!serverObject) { - DEBUG_WARNING (true, ("commandFuncPlaceStructure: object is not a server object\n")); + DEBUG_WARNING(true, ("commandFuncPlaceStructure: object is not a server object\n")); return; } size_t pos = 0; - const NetworkId deedNetworkId = nextOidParm (parameters, pos); - const float x = nextFloatParm (parameters, pos); - const float z = nextFloatParm (parameters, pos); - const Vector position (x, 0.f, z); - const int rotation = nextIntParm (parameters, pos); + const NetworkId deedNetworkId = nextOidParm(parameters, pos); + const float x = nextFloatParm(parameters, pos); + const float z = nextFloatParm(parameters, pos); + const Vector position(x, 0.f, z); + const int rotation = nextIntParm(parameters, pos); ScriptParams scriptParameters; - scriptParameters.addParam (actor); - scriptParameters.addParam (deedNetworkId); - scriptParameters.addParam (position); - scriptParameters.addParam (rotation); + scriptParameters.addParam(actor); + scriptParameters.addParam(deedNetworkId); + scriptParameters.addParam(position); + scriptParameters.addParam(rotation); - if (serverObject->getScriptObject ()->trigAllScripts (Scripting::TRIG_PLACE_STRUCTURE, scriptParameters) != SCRIPT_CONTINUE) - DEBUG_REPORT_LOG (true, ("commandFuncPlaceStructure: did not return SCRIPT_CONTINUE\n")); + if (serverObject->getScriptObject()->trigAllScripts(Scripting::TRIG_PLACE_STRUCTURE, scriptParameters) != SCRIPT_CONTINUE) + DEBUG_REPORT_LOG(true, ("commandFuncPlaceStructure: did not return SCRIPT_CONTINUE\n")); } // ---------------------------------------------------------------------- @@ -5336,14 +5317,14 @@ static void commandFuncSitServer(const Command& /*command*/, const NetworkId& ac if (!sittingOnChair) { // Trying to sit on the ground. - const TerrainObject* const terrainObject = TerrainObject::getConstInstance(); - const CollisionProperty* const collisionProperty = actorObject->getCollisionProperty (); - const bool isOnSolidFloor = collisionProperty && collisionProperty->getFootprint() && collisionProperty->getFootprint()->isOnSolidFloor(); + const TerrainObject* const terrainObject = TerrainObject::getConstInstance(); + const CollisionProperty* const collisionProperty = actorObject->getCollisionProperty(); + const bool isOnSolidFloor = collisionProperty && collisionProperty->getFootprint() && collisionProperty->getFootprint()->isOnSolidFloor(); Vector normal = Vector::unitY; if (terrainObject && actorObject->isInWorldCell() && !isOnSolidFloor) { - const Vector position = actorObject->getPosition_w (); + const Vector position = actorObject->getPosition_w(); float terrainHeight; if (terrainObject->getHeight(position, terrainHeight, normal)) @@ -5352,10 +5333,10 @@ static void commandFuncSitServer(const Command& /*command*/, const NetworkId& ac float waterHeight; if (terrainObject->getWaterHeight(position, waterHeight)) { - if (waterHeight >terrainHeight) + if (waterHeight > terrainHeight) { // Client is in the water, abort the command. - Chat::sendSystemMessage (*creatureActorObject, SharedStringIds::no_sitting_in_water, Unicode::emptyString); + Chat::sendSystemMessage(*creatureActorObject, SharedStringIds::no_sitting_in_water, Unicode::emptyString); return; } } @@ -5382,7 +5363,6 @@ static void commandFuncSitServer(const Command& /*command*/, const NetworkId& ac //-- Send a SitOnObject message with the chair coordinates. const_cast(creatureActorObject)->sitOnObject(chairCellId, chairPosition_p); } - } // ---------------------------------------------------------------------- @@ -5397,11 +5377,11 @@ static void commandFuncGetAttributes(Command const &, NetworkId const &actor, Ne // ---------------------------------------------------------------------- -static void commandFuncGetAttributesBatch(Command const &, NetworkId const &actor, NetworkId const & , Unicode::String const & params) +static void commandFuncGetAttributesBatch(Command const &, NetworkId const &actor, NetworkId const &, Unicode::String const & params) { size_t curpos = 0; NetworkId obj = nextOidParm(params, curpos); - while(obj != NetworkId::cms_invalid) + while (obj != NetworkId::cms_invalid) { int const clientRevision = nextIntParm(params, curpos); TaskGetAttributes * const task = new TaskGetAttributes(actor, obj, clientRevision); @@ -5412,55 +5392,55 @@ static void commandFuncGetAttributesBatch(Command const &, NetworkId const &acto // ---------------------------------------------------------------------- -static std::string underscoreToSpace (const std::string& source) +static std::string underscoreToSpace(const std::string& source) { std::string result = source; - std::replace (result.begin (), result.end (), '_', ' '); + std::replace(result.begin(), result.end(), '_', ' '); return result; } // ---------------------------------------------------------------------- -static void commandFuncPurchaseTicket (const Command& /*command*/, const NetworkId& actor, const NetworkId& /*target*/, const Unicode::String& parameters) +static void commandFuncPurchaseTicket(const Command& /*command*/, const NetworkId& actor, const NetworkId& /*target*/, const Unicode::String& parameters) { ServerObject* const serverObject = ServerObject::getServerObject(actor); if (!serverObject) { - DEBUG_WARNING (true, ("commandFuncPurchaseTicket: object is not a server object")); + DEBUG_WARNING(true, ("commandFuncPurchaseTicket: object is not a server object")); return; } size_t pos = 0; - const Unicode::String planetName1 = Unicode::narrowToWide (nextStringParm (parameters, pos)); - const Unicode::String travelPoint1 = Unicode::narrowToWide (underscoreToSpace (nextStringParm (parameters, pos))); - const Unicode::String planetName2 = Unicode::narrowToWide (nextStringParm (parameters, pos)); - const Unicode::String travelPoint2 = Unicode::narrowToWide (underscoreToSpace (nextStringParm (parameters, pos))); - const bool roundTrip = nextBoolParm (parameters, pos); - const bool instantTravel = nextBoolParm (parameters, pos); + const Unicode::String planetName1 = Unicode::narrowToWide(nextStringParm(parameters, pos)); + const Unicode::String travelPoint1 = Unicode::narrowToWide(underscoreToSpace(nextStringParm(parameters, pos))); + const Unicode::String planetName2 = Unicode::narrowToWide(nextStringParm(parameters, pos)); + const Unicode::String travelPoint2 = Unicode::narrowToWide(underscoreToSpace(nextStringParm(parameters, pos))); + const bool roundTrip = nextBoolParm(parameters, pos); + const bool instantTravel = nextBoolParm(parameters, pos); ScriptParams scriptParameters; - scriptParameters.addParam (actor); - scriptParameters.addParam (planetName1); - scriptParameters.addParam (travelPoint1); - scriptParameters.addParam (planetName2); - scriptParameters.addParam (travelPoint2); - scriptParameters.addParam (roundTrip); + scriptParameters.addParam(actor); + scriptParameters.addParam(planetName1); + scriptParameters.addParam(travelPoint1); + scriptParameters.addParam(planetName2); + scriptParameters.addParam(travelPoint2); + scriptParameters.addParam(roundTrip); Scripting::TrigId id = instantTravel ? Scripting::TRIG_PURCHASE_TICKET_INSTANT_TRAVEL : Scripting::TRIG_PURCHASE_TICKET; - if (serverObject->getScriptObject ()->trigAllScripts (id, scriptParameters) != SCRIPT_CONTINUE) - DEBUG_REPORT_LOG (true, ("commandFuncPurchaseTicket: did not return SCRIPT_CONTINUE\n")); + if (serverObject->getScriptObject()->trigAllScripts(id, scriptParameters) != SCRIPT_CONTINUE) + DEBUG_REPORT_LOG(true, ("commandFuncPurchaseTicket: did not return SCRIPT_CONTINUE\n")); } //---------------------------------------------------------------------- -static void commandFuncRequestResourceWeights(const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) +static void commandFuncRequestResourceWeights(const Command&, const NetworkId& actor, const NetworkId&, const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); if (creature == nullptr) { - WARNING (true, ("commandFuncRequestResourceWeights: PB nullptr actor")); + WARNING(true, ("commandFuncRequestResourceWeights: PB nullptr actor")); return; } @@ -5471,12 +5451,12 @@ static void commandFuncRequestResourceWeights(const Command& , const NetworkId& //---------------------------------------------------------------------- -static void commandFuncRequestResourceWeightsBatch(const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) +static void commandFuncRequestResourceWeightsBatch(const Command&, const NetworkId& actor, const NetworkId&, const Unicode::String& params) { - CreatureObject* const creature = dynamic_cast(NetworkIdManager::getObjectById (actor)); + CreatureObject* const creature = dynamic_cast(NetworkIdManager::getObjectById(actor)); if (creature == nullptr) { - WARNING (true, ("commandFuncRequestResourceWeightsBatch: PB nullptr actor")); + WARNING(true, ("commandFuncRequestResourceWeightsBatch: PB nullptr actor")); return; } @@ -5484,7 +5464,7 @@ static void commandFuncRequestResourceWeightsBatch(const Command& , const Networ size_t curpos = 0; schematicCrc = nextIntParm(params, curpos); - while(schematicCrc != -1) + while (schematicCrc != -1) { DraftSchematicObject::requestResourceWeights(*creature, static_cast(schematicCrc)); schematicCrc = nextIntParm(params, curpos); @@ -5493,19 +5473,19 @@ static void commandFuncRequestResourceWeightsBatch(const Command& , const Networ //---------------------------------------------------------------------- -static void commandFuncRequestDraftSlots (const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) +static void commandFuncRequestDraftSlots(const Command&, const NetworkId& actor, const NetworkId&, const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); if (creature == nullptr) { - WARNING (true, ("commandFuncRequestDraftSlots: PB nullptr actor")); + WARNING(true, ("commandFuncRequestDraftSlots: PB nullptr actor")); return; } PlayerObject * const player = PlayerCreatureController::getPlayerObject(creature); if (player == nullptr) { - WARNING (true, ("commandFuncRequestDraftSlots: no player object for actor ""%s", actor.getValueString().c_str())); + WARNING(true, ("commandFuncRequestDraftSlots: no player object for actor ""%s", actor.getValueString().c_str())); return; } @@ -5515,26 +5495,26 @@ static void commandFuncRequestDraftSlots (const Command& , const NetworkId& acto MessageQueueDraftSlotsQueryResponse * const message = new MessageQueueDraftSlotsQueryResponse(std::make_pair(serverCrc, sharedCrc)); if (!player->requestDraftSlots(serverCrc, nullptr, message)) { - WARNING (true, ("commandFuncRequestDraftSlots failed to request draft slots for %u", serverCrc)); + WARNING(true, ("commandFuncRequestDraftSlots failed to request draft slots for %u", serverCrc)); delete message; } } // ---------------------------------------------------------------------- -static void commandFuncRequestDraftSlotsBatch (const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) +static void commandFuncRequestDraftSlotsBatch(const Command&, const NetworkId& actor, const NetworkId&, const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); if (creature == nullptr) { - WARNING (true, ("commandFuncRequestDraftSlotsBatch: PB nullptr actor")); + WARNING(true, ("commandFuncRequestDraftSlotsBatch: PB nullptr actor")); return; } PlayerObject * const player = PlayerCreatureController::getPlayerObject(creature); if (player == nullptr) { - WARNING (true, ("commandFuncRequestDraftSlotsBatch: no player object for actor ""%s", actor.getValueString().c_str())); + WARNING(true, ("commandFuncRequestDraftSlotsBatch: no player object for actor ""%s", actor.getValueString().c_str())); return; } @@ -5543,29 +5523,29 @@ static void commandFuncRequestDraftSlotsBatch (const Command& , const NetworkId& size_t curpos = 0; std::string serverCrcString = nextStringParm(params, curpos); - if(serverCrcString.empty()) + if (serverCrcString.empty()) return; sscanf(serverCrcString.c_str(), "%lu", &uServerCrc); std::string sharedCrcString = nextStringParm(params, curpos); - if(sharedCrcString.empty()) + if (sharedCrcString.empty()) return; sscanf(sharedCrcString.c_str(), "%lu", &uSharedCrc); bool done = false; - while(uServerCrc != 0 && uSharedCrc != 0 && !done) + while (uServerCrc != 0 && uSharedCrc != 0 && !done) { MessageQueueDraftSlotsQueryResponse * const message = new MessageQueueDraftSlotsQueryResponse(std::make_pair(uServerCrc, uSharedCrc)); if (!player->requestDraftSlots(uServerCrc, nullptr, message)) { - WARNING (true, ("commandFuncRequestDraftSlotsBatch failed to request draft slots for %lu", uServerCrc)); + WARNING(true, ("commandFuncRequestDraftSlotsBatch failed to request draft slots for %lu", uServerCrc)); delete message; } serverCrcString = nextStringParm(params, curpos); - if(serverCrcString.empty()) + if (serverCrcString.empty()) done = true; sscanf(serverCrcString.c_str(), "%lu", &uServerCrc); sharedCrcString = nextStringParm(params, curpos); - if(sharedCrcString.empty()) + if (sharedCrcString.empty()) done = true; sscanf(sharedCrcString.c_str(), "%lu", &uSharedCrc); } @@ -5573,12 +5553,12 @@ static void commandFuncRequestDraftSlotsBatch (const Command& , const NetworkId& // ---------------------------------------------------------------------- -static void commandFuncRequestManfSchematicSlots (const Command& , const NetworkId& actor, const NetworkId& target, const Unicode::String& params) +static void commandFuncRequestManfSchematicSlots(const Command&, const NetworkId& actor, const NetworkId& target, const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); if (creature == nullptr) { - WARNING (true, ("commandFuncRequestDraftSlots: PB nullptr actor")); + WARNING(true, ("commandFuncRequestDraftSlots: PB nullptr actor")); return; } @@ -5592,19 +5572,19 @@ static void commandFuncRequestManfSchematicSlots (const Command& , const Network // ---------------------------------------------------------------------- -static void commandFuncRequestCraftingSession (const Command& , const NetworkId& actor, const NetworkId& target, const Unicode::String& params) +static void commandFuncRequestCraftingSession(const Command&, const NetworkId& actor, const NetworkId& target, const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); if (creature == nullptr) { - WARNING (true, ("commandFuncRequestCraftingSession: PB nullptr actor")); + WARNING(true, ("commandFuncRequestCraftingSession: PB nullptr actor")); return; } PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); if (player == nullptr) { - WARNING (true, ("commandFuncRequestCraftingSession: no player object for actor " + WARNING(true, ("commandFuncRequestCraftingSession: no player object for actor " "%s", actor.getValueString().c_str())); return; } @@ -5617,7 +5597,7 @@ static void commandFuncRequestCraftingSession (const Command& , const NetworkId& // 1 means this request was made on a crafting station versus a crafting tool. uint8 const sequenceId = static_cast(craftingObject && craftingObject->isCraftingStation() ? 1 : 0); - MessageQueueGenericIntResponse * response = new MessageQueueGenericIntResponse ( + MessageQueueGenericIntResponse * response = new MessageQueueGenericIntResponse( CM_requestCraftingSession, false, sequenceId); creature->getController()->appendMessage(CM_craftingResult, 0.0f, response, GameControllerMessageFlags::SEND | @@ -5645,19 +5625,19 @@ static void commandFuncRequestCraftingSessionFail(Command const &, NetworkId con // ---------------------------------------------------------------------- -static void commandFuncSelectDraftSchematic (const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) +static void commandFuncSelectDraftSchematic(const Command&, const NetworkId& actor, const NetworkId&, const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); if (creature == nullptr) { - WARNING (true, ("commandFuncSelectDraftSchematic: PB nullptr actor")); + WARNING(true, ("commandFuncSelectDraftSchematic: PB nullptr actor")); return; } PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); if (player == nullptr) { - WARNING (true, ("commandFuncSelectDraftSchematic: no player object for actor " + WARNING(true, ("commandFuncSelectDraftSchematic: no player object for actor " "%s", actor.getValueString().c_str())); return; } @@ -5669,19 +5649,19 @@ static void commandFuncSelectDraftSchematic (const Command& , const NetworkId& a // ---------------------------------------------------------------------- -static void commandFuncNextCraftingStage(const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) +static void commandFuncNextCraftingStage(const Command&, const NetworkId& actor, const NetworkId&, const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); if (creature == nullptr) { - WARNING (true, ("commandFuncNextCraftingStage: PB nullptr actor")); + WARNING(true, ("commandFuncNextCraftingStage: PB nullptr actor")); return; } PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); if (player == nullptr) { - WARNING (true, ("commandFuncNextCraftingStage: no player object for actor " + WARNING(true, ("commandFuncNextCraftingStage: no player object for actor " "%s", actor.getValueString().c_str())); return; } @@ -5689,7 +5669,7 @@ static void commandFuncNextCraftingStage(const Command& , const NetworkId& actor uint8 sequenceId = static_cast(atoi(Unicode::wideToNarrow(params).c_str())); int result = player->goToNextCraftingStage(); - MessageQueueGenericIntResponse * response = new MessageQueueGenericIntResponse ( + MessageQueueGenericIntResponse * response = new MessageQueueGenericIntResponse( CM_nextCraftingStage, result, sequenceId); creature->getController()->appendMessage(CM_nextCraftingStageResult, 0.0f, response, GameControllerMessageFlags::SEND | @@ -5699,19 +5679,19 @@ static void commandFuncNextCraftingStage(const Command& , const NetworkId& actor // ---------------------------------------------------------------------- -static void commandFuncCreatePrototype(const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) +static void commandFuncCreatePrototype(const Command&, const NetworkId& actor, const NetworkId&, const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); if (creature == nullptr) { - WARNING (true, ("commandFuncCreatePrototype: PB nullptr actor")); + WARNING(true, ("commandFuncCreatePrototype: PB nullptr actor")); return; } PlayerObject * const player = PlayerCreatureController::getPlayerObject(creature); if (player == nullptr) { - WARNING (true, ("commandFuncCreatePrototype: no player object for actor %s", actor.getValueString().c_str())); + WARNING(true, ("commandFuncCreatePrototype: no player object for actor %s", actor.getValueString().c_str())); return; } @@ -5721,7 +5701,7 @@ static void commandFuncCreatePrototype(const Command& , const NetworkId& actor, const bool result = player->createPrototype(realPrototype); - MessageQueueGenericIntResponse * const response = new MessageQueueGenericIntResponse (CM_createPrototype, result, sequenceId); + MessageQueueGenericIntResponse * const response = new MessageQueueGenericIntResponse(CM_createPrototype, result, sequenceId); creature->getController()->appendMessage(CM_craftingResult, 0.0f, response, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | @@ -5733,19 +5713,19 @@ static void commandFuncCreatePrototype(const Command& , const NetworkId& actor, // ---------------------------------------------------------------------- -static void commandFuncCreateManfSchematic(const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) +static void commandFuncCreateManfSchematic(const Command&, const NetworkId& actor, const NetworkId&, const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); if (creature == nullptr) { - WARNING (true, ("commandFuncCreateManfSchematic: PB nullptr actor")); + WARNING(true, ("commandFuncCreateManfSchematic: PB nullptr actor")); return; } PlayerObject * const player = PlayerCreatureController::getPlayerObject(creature); if (player == nullptr) { - WARNING (true, ("commandFuncCreateManfSchematic: no player object for actor %s", actor.getValueString().c_str())); + WARNING(true, ("commandFuncCreateManfSchematic: no player object for actor %s", actor.getValueString().c_str())); return; } @@ -5753,7 +5733,7 @@ static void commandFuncCreateManfSchematic(const Command& , const NetworkId& act const bool result = player->createManufacturingSchematic(); - MessageQueueGenericIntResponse * const response = new MessageQueueGenericIntResponse (CM_createManfSchematic, result, sequenceId); + MessageQueueGenericIntResponse * const response = new MessageQueueGenericIntResponse(CM_createManfSchematic, result, sequenceId); creature->getController()->appendMessage(CM_craftingResult, 0.0f, response, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | @@ -5765,19 +5745,19 @@ static void commandFuncCreateManfSchematic(const Command& , const NetworkId& act // ---------------------------------------------------------------------- -static void commandFuncCancelCraftingSession(const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) +static void commandFuncCancelCraftingSession(const Command&, const NetworkId& actor, const NetworkId&, const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); if (creature == nullptr) { - WARNING (true, ("commandFuncCancelCraftingSession: PB nullptr actor")); + WARNING(true, ("commandFuncCancelCraftingSession: PB nullptr actor")); return; } PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); if (player == nullptr) { - WARNING (true, ("commandFuncCancelCraftingSession: no player object for actor " + WARNING(true, ("commandFuncCancelCraftingSession: no player object for actor " "%s", actor.getValueString().c_str())); return; } @@ -5787,19 +5767,19 @@ static void commandFuncCancelCraftingSession(const Command& , const NetworkId& a // ---------------------------------------------------------------------- -static void commandFuncStopCraftingSession(const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) +static void commandFuncStopCraftingSession(const Command&, const NetworkId& actor, const NetworkId&, const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); if (creature == nullptr) { - WARNING (true, ("commandFuncStopCraftingSession: PB nullptr actor")); + WARNING(true, ("commandFuncStopCraftingSession: PB nullptr actor")); return; } PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); if (player == nullptr) { - WARNING (true, ("commandFuncStopCraftingSession: no player object for actor " + WARNING(true, ("commandFuncStopCraftingSession: no player object for actor " "%s", actor.getValueString().c_str())); return; } @@ -5809,19 +5789,19 @@ static void commandFuncStopCraftingSession(const Command& , const NetworkId& act // ---------------------------------------------------------------------- -static void commandFuncRestartCraftingSession(const Command& , const NetworkId& actor, const NetworkId& , const Unicode::String& params) +static void commandFuncRestartCraftingSession(const Command&, const NetworkId& actor, const NetworkId&, const Unicode::String& params) { CreatureObject* const creature = CreatureObject::getCreatureObject(actor); if (creature == nullptr) { - WARNING (true, ("commandFuncRestartCraftingSession: PB nullptr actor")); + WARNING(true, ("commandFuncRestartCraftingSession: PB nullptr actor")); return; } PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); if (player == nullptr) { - WARNING (true, ("commandFuncRestartCraftingSession: no player object for actor " + WARNING(true, ("commandFuncRestartCraftingSession: no player object for actor " "%s", actor.getValueString().c_str())); return; } @@ -5830,7 +5810,7 @@ static void commandFuncRestartCraftingSession(const Command& , const NetworkId& const bool success = player->restartCrafting(); - MessageQueueGenericIntResponse * response = new MessageQueueGenericIntResponse ( + MessageQueueGenericIntResponse * response = new MessageQueueGenericIntResponse( CM_restartCraftingSession, success, sequenceId); creature->getController()->appendMessage(CM_craftingResult, 0.0f, response, GameControllerMessageFlags::SEND | @@ -6018,18 +5998,18 @@ static void commandFuncSetBiography(Command const &, NetworkId const & actor, Ne CreatureObject * const creatureActor = CreatureObject::getCreatureObject(actor); if (!creatureActor) { - WARNING (true, ("commandFuncSetBiography: bad actor")); + WARNING(true, ("commandFuncSetBiography: bad actor")); return; } Client * const clientActor = creatureActor->getClient(); - if(!clientActor) + if (!clientActor) { WARNING(true, ("no Client in commandFuncSetBiography")); return; } - if(!clientActor->isGod()) + if (!clientActor->isGod()) { LOG("CustomerService", ("CheatChannel:%s attempted to set biography data on %s, but is not a God", PlayerObject::getAccountDescription(actor).c_str(), PlayerObject::getAccountDescription(target).c_str())); } @@ -6051,13 +6031,13 @@ static void commandFuncRequestCharacterSheetInfo(Command const &, NetworkId cons const CreatureObject* const creatureActor = CreatureObject::getCreatureObject(actor); if (creatureActor == nullptr) { - WARNING (true, ("commandFuncRequestCharacterSheetInfo: nullptr actor")); + WARNING(true, ("commandFuncRequestCharacterSheetInfo: nullptr actor")); return; } //TODO get the born and played times (once they're in the DB) - int born = 0; - int played = 0; + int born = 0; + int played = 0; //get the bind location Vector bindLoc; @@ -6067,12 +6047,12 @@ static void commandFuncRequestCharacterSheetInfo(Command const &, NetworkId cons { creatureActor->getObjVars().getItem("bind.facility", bindId); } - if(bindId != NetworkId::cms_invalid) + if (bindId != NetworkId::cms_invalid) { const ServerObject* const bindObject = ServerObject::getServerObject(bindId); if (bindObject != nullptr) { - bindLoc = bindObject->getPosition_w(); + bindLoc = bindObject->getPosition_w(); bindPlanet = bindObject->getSceneId(); } } @@ -6124,7 +6104,7 @@ static void commandFuncRequestCharacterSheetInfo(Command const &, NetworkId cons const ServerObject* const resObject = ServerObject::getServerObject(houseNetworkId); if (resObject != nullptr) { - resLoc = resObject->getPosition_w(); + resLoc = resObject->getPosition_w(); resPlanet = ServerWorld::getSceneId(); } else if (houseNetworkId.isValid() && MessageToQueue::isInstalled()) @@ -6148,7 +6128,7 @@ static void commandFuncRequestCharacterSheetInfo(Command const &, NetworkId cons int lots = creatureActor->getMaxNumberOfLots(); PlayerObject const * const player = PlayerCreatureController::getPlayerObject(creatureActor); - if(player) + if (player) { int lotsUsed = player->getAccountNumLots(); lots -= lotsUsed; @@ -6183,21 +6163,21 @@ static void commandFuncExtractObject(Command const &, NetworkId const &actor, Ne CreatureObject* const creature = CreatureObject::getCreatureObject(actor); if (creature == nullptr) { - WARNING (true, ("commandFuncExtractObject: PB nullptr actor")); + WARNING(true, ("commandFuncExtractObject: PB nullptr actor")); return; } if (creature->getInventory() == nullptr) { - WARNING (true, ("commandFuncExtractObject: actor %s has no inventory", + WARNING(true, ("commandFuncExtractObject: actor %s has no inventory", actor.getValueString().c_str())); return; } - FactoryObject* const factory = dynamic_cast(NetworkIdManager::getObjectById (target)); + FactoryObject* const factory = dynamic_cast(NetworkIdManager::getObjectById(target)); if (factory == nullptr) { - WARNING (true, ("commandFuncExtractObject: PB nullptr target")); + WARNING(true, ("commandFuncExtractObject: PB nullptr target")); return; } @@ -6215,22 +6195,22 @@ static void commandFuncRevokeSkill(Command const &, NetworkId const &actor, Netw CreatureObject * const creature = CreatureObject::getCreatureObject(actor); if (creature == nullptr) { - WARNING (true, ("commandFuncRevokeSkill: PB nullptr actor")); + WARNING(true, ("commandFuncRevokeSkill: PB nullptr actor")); return; } size_t pos = 0; std::string skillName = nextStringParm(params, pos); - const SkillObject * skill = SkillManager::getInstance ().getSkill (skillName); + const SkillObject * skill = SkillManager::getInstance().getSkill(skillName); if (skill == nullptr) { - WARNING (true, ("commandFuncRevokeSkill: can't revoke bad skill")); + WARNING(true, ("commandFuncRevokeSkill: can't revoke bad skill")); } else { LOG("CustomerService", ("Skill: God (via cmdfunc) has requested the revocation of skill %s from character %s.", skillName.c_str(), creature->getNetworkId().getValueString().c_str())); - creature->revokeSkill (*skill); + creature->revokeSkill(*skill); } } @@ -6358,8 +6338,8 @@ static void commandFuncSetCurrentSkillTitle(Command const &, NetworkId const &ac { SkillObject const *skillObject = (*iterSkillList); - if ( (skillObject != nullptr) - && skillObject->isTitle() + if ((skillObject != nullptr) + && skillObject->isTitle() && (skillObject->getSkillName() == title)) { playerObject->setTitle(title); @@ -6381,17 +6361,17 @@ static void commandFuncSetCurrentSkillTitle(Command const &, NetworkId const &ac static void commandFuncRepair(Command const &, NetworkId const &actor, NetworkId const & target, Unicode::String const ¶ms) { - CreatureObject* const creature = dynamic_cast(NetworkIdManager::getObjectById (actor)); + CreatureObject* const creature = dynamic_cast(NetworkIdManager::getObjectById(actor)); if (creature == nullptr) { - WARNING (true, ("commandFuncRepair: PB nullptr actor")); + WARNING(true, ("commandFuncRepair: PB nullptr actor")); return; } - TangibleObject* const object = dynamic_cast(NetworkIdManager::getObjectById (target)); + TangibleObject* const object = dynamic_cast(NetworkIdManager::getObjectById(target)); if (object == nullptr) { - WARNING (true, ("commandFuncRepair: PB nullptr target")); + WARNING(true, ("commandFuncRepair: PB nullptr target")); return; } } @@ -6466,7 +6446,6 @@ static void commandFuncToggleRolePlay(Command const &, NetworkId const &actor, N } } - // ---------------------------------------------------------------------- static void commandFuncToggleOutOfCharacter(Command const &, NetworkId const &actor, NetworkId const & target, Unicode::String const ¶ms) @@ -6491,7 +6470,6 @@ static void commandFuncToggleLookingForWork(Command const &, NetworkId const &ac } } - // ---------------------------------------------------------------------- static void commandFuncToggleLookingForGroup(Command const &, NetworkId const &actor, NetworkId const & target, Unicode::String const ¶ms) @@ -6564,14 +6542,14 @@ static void commandFuncReport(Command const &, NetworkId const &actor, NetworkId Unicode::String const delimiter = Unicode::narrowToWide("|"); Unicode::UnicodeStringVector tokens; - if(Unicode::tokenize(params, tokens, &delimiter) && tokens.size() > 1) + if (Unicode::tokenize(params, tokens, &delimiter) && tokens.size() > 1) { harassingPlayerName = tokens[0]; Unicode::String rest; uint32 numTokens = tokens.size(); - for(uint32 i = 1; i < numTokens; ++i) + for (uint32 i = 1; i < numTokens; ++i) { - if(i != 1) + if (i != 1) { rest.append(delimiter); } @@ -6588,7 +6566,6 @@ static void commandFuncReport(Command const &, NetworkId const &actor, NetworkId Chat::sendSystemMessage(*reportingCreatureObject, StringId("system_msg", "report_no_name"), Unicode::emptyString); } - //if (Unicode::getFirstToken(name, curpos, endpos, harassingPlayerName)) //{ @@ -6639,7 +6616,7 @@ static void commandFuncNpcConversationStart(Command const &, NetworkId const &ac return; } } - + std::string const & realParams = Unicode::wideToNarrow(params); if (realParams.size() < 2) { @@ -6650,7 +6627,7 @@ static void commandFuncNpcConversationStart(Command const &, NetworkId const &ac const char * const conversationName = &realParams[2]; NpcConversationData::ConversationStarter const starter = static_cast(atoi(realParams.c_str())); - player->startNpcConversation (*npc, conversationName, starter, 0); + player->startNpcConversation(*npc, conversationName, starter, 0); } //---------------------------------------------------------------------- @@ -6658,7 +6635,7 @@ static void commandFuncNpcConversationStart(Command const &, NetworkId const &ac static void commandFuncNpcConversationStop(Command const &, NetworkId const &actor, NetworkId const & target, Unicode::String const ¶ms) { ServerObject * const actorObject = safe_cast(NetworkIdManager::getObjectById(actor)); - TangibleObject * const player = actorObject != nullptr ? actorObject->asTangibleObject(): nullptr; + TangibleObject * const player = actorObject != nullptr ? actorObject->asTangibleObject() : nullptr; if (player == nullptr) { DEBUG_WARNING(true, ("commandFuncNpcConversationStop: couldn't find actor")); @@ -6686,27 +6663,27 @@ static void commandFuncNpcConversationSelect(Command const &, NetworkId const &a //---------------------------------------------------------------------- -static void commandFuncServerDestroyObject (Command const &, NetworkId const & actor, NetworkId const & target, Unicode::String const & params) +static void commandFuncServerDestroyObject(Command const &, NetworkId const & actor, NetworkId const & target, Unicode::String const & params) { - CreatureObject * const player = dynamic_cast (NetworkIdManager::getObjectById (actor)); + CreatureObject * const player = dynamic_cast (NetworkIdManager::getObjectById(actor)); if (player == nullptr) { - DEBUG_WARNING (true, ("commandFuncServerDestroyObject: couldn't find actor")); + DEBUG_WARNING(true, ("commandFuncServerDestroyObject: couldn't find actor")); return; } - ServerObject * const targetObject = safe_cast(NetworkIdManager::getObjectById (target)); + ServerObject * const targetObject = safe_cast(NetworkIdManager::getObjectById(target)); if (!targetObject) { PlayerObject * p = PlayerCreatureController::getPlayerObject(player); - if(p) + if (p) { p->destroyWaypoint(target); return; } else { - DEBUG_WARNING (true, ("commandFuncServerDestroyObject: couldn't find target")); + DEBUG_WARNING(true, ("commandFuncServerDestroyObject: couldn't find target")); return; } } @@ -6714,18 +6691,18 @@ static void commandFuncServerDestroyObject (Command const &, NetworkId const & a ServerObject const * const topMost = getFirstParentInWorldOrPlayer(targetObject); if (!topMost || topMost->getNetworkId() != actor) { - DEBUG_WARNING (true, ("player tried to delete something not in their inventory")); + DEBUG_WARNING(true, ("player tried to delete something not in their inventory")); return; } ProsePackage pp; - const bool sendResponse = !params.empty (); + const bool sendResponse = !params.empty(); - int const got = targetObject->getGameObjectType (); + int const got = targetObject->getGameObjectType(); if (sendResponse) { - ProsePackageManagerServer::createSimpleProsePackage (*targetObject, SharedStringIds::rsp_object_deleted_prose, pp); - pp.other.stringId = GameObjectTypes::getStringId (got); + ProsePackageManagerServer::createSimpleProsePackage(*targetObject, SharedStringIds::rsp_object_deleted_prose, pp); + pp.other.stringId = GameObjectTypes::getStringId(got); } // Cannot destroy an empty ship pcd while contained by a ship you own @@ -6749,7 +6726,7 @@ static void commandFuncServerDestroyObject (Command const &, NetworkId const & a return; Object const * const currentContainer = ContainerInterface::getContainedByObject(*targetObject); - if(currentContainer && currentContainer->asServerObject() && ( currentContainer->asServerObject()->getGameObjectType() == SharedObjectTemplate::GOT_chronicles_quest_holocron || currentContainer->asServerObject()->getGameObjectType() == SharedObjectTemplate::GOT_chronicles_quest_holocron_recipe ) ) + if (currentContainer && currentContainer->asServerObject() && (currentContainer->asServerObject()->getGameObjectType() == SharedObjectTemplate::GOT_chronicles_quest_holocron || currentContainer->asServerObject()->getGameObjectType() == SharedObjectTemplate::GOT_chronicles_quest_holocron_recipe)) { // Give the player a warning here? return; @@ -6759,10 +6736,10 @@ static void commandFuncServerDestroyObject (Command const &, NetworkId const & a { LOG("CustomerService", ("Deletion:%s is deleting object %s", PlayerObject::getAccountDescription(actor).c_str(), ServerObject::getLogDescription(targetObject).c_str())); if (sendResponse) - Chat::sendSystemMessage (*player, pp); + Chat::sendSystemMessage(*player, pp); } else - WARNING (true, ("commandFuncServerDestroyObject: Error encountered while deleting object %s", target.getValueString ().c_str ())); + WARNING(true, ("commandFuncServerDestroyObject: Error encountered while deleting object %s", target.getValueString().c_str())); } // ---------------------------------------------------------------------- @@ -6855,10 +6832,10 @@ static void commandFuncUnstick(Command const &, NetworkId const &actor, NetworkI static void commandFuncGetAccountInfo(Command const &, NetworkId const &actor, NetworkId const & target, Unicode::String const ¶ms) { const CreatureObject * gm = dynamic_cast(NetworkIdManager::getObjectById(actor)); - if(gm) + if (gm) { const Client * gmClient = gm->getClient(); - if(gmClient) + if (gmClient) { bool foundAsPilot = false; const CreatureObject * player = dynamic_cast(NetworkIdManager::getObjectById(target)); @@ -6872,23 +6849,23 @@ static void commandFuncGetAccountInfo(Command const &, NetworkId const &actor, N } } std::string result; - if(player) + if (player) { const Client * client = player->getClient(); - if(client) + if (client) { if (foundAsPilot) - result = "Pilot Character Name : "; + result = "Pilot Character Name : "; else - result = "Character Name : "; + result = "Character Name : "; result += Unicode::wideToNarrow(player->getAssignedObjectName()); result += "\nAccount Name : "; result += client->getAccountName(); result += "\nStation Id : "; char buf[32]; - IGNORE_RETURN(snprintf(buf, sizeof(buf)-1, "%d", client->getStationId())); - buf[sizeof(buf)-1] = '\0'; + IGNORE_RETURN(snprintf(buf, sizeof(buf) - 1, "%d", client->getStationId())); + buf[sizeof(buf) - 1] = '\0'; result += buf; result += "\nGame Features : "; result += ClientGameFeature::getDescription(client->getGameFeatures()); @@ -6916,7 +6893,7 @@ static void commandFuncGetAccountInfo(Command const &, NetworkId const &actor, N result += "\nIP Address : "; result += client->getIpAddress(); result += "\nGod Mode : "; - if(client->isGod()) + if (client->isGod()) result += "true"; else result += "false"; @@ -6938,28 +6915,28 @@ static void commandFuncGetAccountInfo(Command const &, NetworkId const &actor, N // ---------------------------------------------------------------------- -static void commandFuncApplyPowerup (Command const &, NetworkId const &actor, NetworkId const & target, Unicode::String const ¶ms) +static void commandFuncApplyPowerup(Command const &, NetworkId const &actor, NetworkId const & target, Unicode::String const ¶ms) { - const NetworkId & powerupId = target; - const NetworkId targetOfApplyId (Unicode::wideToNarrow (params)); - ServerObject * const powerup = safe_cast(NetworkIdManager::getObjectById (powerupId)); + const NetworkId & powerupId = target; + const NetworkId targetOfApplyId(Unicode::wideToNarrow(params)); + ServerObject * const powerup = safe_cast(NetworkIdManager::getObjectById(powerupId)); if (powerup) { - const ServerObject * const targetOfApply = safe_cast(NetworkIdManager::getObjectById (targetOfApplyId)); + const ServerObject * const targetOfApply = safe_cast(NetworkIdManager::getObjectById(targetOfApplyId)); if (targetOfApply) { - const int got_targetOfApply = targetOfApply->getGameObjectType (); - const int got_powerup = powerup->getGameObjectType (); + const int got_targetOfApply = targetOfApply->getGameObjectType(); + const int got_powerup = powerup->getGameObjectType(); - if (GameObjectTypes::doesPowerupApply (got_powerup, got_targetOfApply)) + if (GameObjectTypes::doesPowerupApply(got_powerup, got_targetOfApply)) { GameScriptObject * const gso = powerup->getScriptObject(); if (gso) { ScriptParams scriptParams; - scriptParams.addParam (actor); - scriptParams.addParam (targetOfApplyId); + scriptParams.addParam(actor); + scriptParams.addParam(targetOfApplyId); gso->trigAllScripts(Scripting::TRIG_APPLY_POWERUP, scriptParams); } } @@ -6969,20 +6946,20 @@ static void commandFuncApplyPowerup (Command const &, NetworkId const &actor, Ne // ---------------------------------------------------------------------- -static void commandFuncLag (Command const &, NetworkId const &actor, NetworkId const & target, Unicode::String const ¶ms) +static void commandFuncLag(Command const &, NetworkId const &actor, NetworkId const & target, Unicode::String const ¶ms) { #if 0 ServerObject * a = safe_cast(NetworkIdManager::getObjectById(actor)); ServerObject * t = safe_cast(NetworkIdManager::getObjectById(target)); - if(! t) + if (!t) { t = a; } - if(t != 0) + if (t != 0) { - if(t->getClient()) + if (t->getClient()) { - if(a && a->getClient()) + if (a && a->getClient()) { GameNetworkMessage const request("LagRequest"); t->getClient()->send(request, true); @@ -7001,7 +6978,7 @@ static void commandFuncLag (Command const &, NetworkId const &actor, NetworkId c // ---------------------------------------------------------------------- -static void commandExecuteKnowledgeBaseMessage (Command const &, NetworkId const &actor, NetworkId const & , Unicode::String const ¶ms) +static void commandExecuteKnowledgeBaseMessage(Command const &, NetworkId const &actor, NetworkId const &, Unicode::String const ¶ms) { UNREF(actor); UNREF(params); @@ -7030,7 +7007,7 @@ static void commandFuncSetPlayerAppearance(Command const &, NetworkId const &act std::string objectTemplateName; bool useTarget = false; - size_t pos = 0; + size_t pos = 0; do { @@ -7042,15 +7019,15 @@ static void commandFuncSetPlayerAppearance(Command const &, NetworkId const &act } while (!token.empty()); //-- Log attempt. - NetworkId subjectNetworkId = useTarget ? target: actor; + NetworkId subjectNetworkId = useTarget ? target : actor; - LOG("setPlayerAppearance", + LOG("setPlayerAppearance", ("commandFuncSetPlayerAppearance(): command called by actor id=[%s]: attempting to change appearance for player id=[%s], using appearance info from object template=[%s], subject=[%s]", - actor.getValueString().c_str(), - subjectNetworkId.getValueString().c_str(), - objectTemplateName.c_str(), - useTarget ? "target" : "self" - )); + actor.getValueString().c_str(), + subjectNetworkId.getValueString().c_str(), + objectTemplateName.c_str(), + useTarget ? "target" : "self" + )); //-- Validate parameters. if (subjectNetworkId == NetworkId::cms_invalid) @@ -7076,11 +7053,11 @@ static void commandFuncSetPlayerAppearance(Command const &, NetworkId const &act // Ensure non-default object template name refers to an existing file. if (!TreeFile::exists(objectTemplateName.c_str())) { - WARNING(true, + WARNING(true, ("commandFuncSetPlayerAppearance(): could not change id=[%s] to non-default object template name=[%s]: object template does not exist", - subjectNetworkId.getValueString().c_str(), - objectTemplateName.c_str() - )); + subjectNetworkId.getValueString().c_str(), + objectTemplateName.c_str() + )); return; } } @@ -7104,7 +7081,7 @@ static void commandFuncRevertPlayerAppearance(Command const &, NetworkId const & std::string objectTemplateName; bool useTarget = false; - size_t pos = 0; + size_t pos = 0; do { @@ -7116,15 +7093,15 @@ static void commandFuncRevertPlayerAppearance(Command const &, NetworkId const & } while (!token.empty()); //-- Log attempt. - NetworkId subjectNetworkId = useTarget ? target: actor; + NetworkId subjectNetworkId = useTarget ? target : actor; - LOG("setPlayerAppearance", + LOG("setPlayerAppearance", ("commandFuncRevertPlayerAppearance(): command called by actor id=[%s]: attempting to change appearance for player id=[%s], using appearance info from object template=[%s], subject=[%s]", - actor.getValueString().c_str(), - subjectNetworkId.getValueString().c_str(), - objectTemplateName.c_str(), - useTarget ? "target" : "self" - )); + actor.getValueString().c_str(), + subjectNetworkId.getValueString().c_str(), + objectTemplateName.c_str(), + useTarget ? "target" : "self" + )); //-- Validate parameters. if (subjectNetworkId == NetworkId::cms_invalid) @@ -7155,7 +7132,7 @@ static void commandFuncRevertPlayerAppearance(Command const &, NetworkId const & //----------------------------------------------------------------------- -static void commandFuncReconnectToTransferServer(Command const &, NetworkId const &, NetworkId const & , Unicode::String const &) +static void commandFuncReconnectToTransferServer(Command const &, NetworkId const &, NetworkId const &, Unicode::String const &) { GameNetworkMessage const msg("ReconnectToTransferServer"); GameServer::getInstance().sendToCentralServer(msg); @@ -7163,17 +7140,17 @@ static void commandFuncReconnectToTransferServer(Command const &, NetworkId cons //----------------------------------------------------------------------- -static void commandFuncFindFriend(Command const &, NetworkId const &actor, NetworkId const & , Unicode::String const ¶ms) +static void commandFuncFindFriend(Command const &, NetworkId const &actor, NetworkId const &, Unicode::String const ¶ms) { ServerObject * a = safe_cast(NetworkIdManager::getObjectById(actor)); - if(a && a->getClient()) + if (a && a->getClient()) { size_t pos = 0; - const std::string playerName = nextStringParm (params, pos); + const std::string playerName = nextStringParm(params, pos); CreatureObject * creatureObject = a->asCreatureObject(); - if(creatureObject) + if (creatureObject) { - if(! playerName.empty()) + if (!playerName.empty()) { // break the name down into its subcomponents ChatAvatarId const cav(NameManager::normalizeName(playerName)); @@ -7190,7 +7167,7 @@ static void commandFuncFindFriend(Command const &, NetworkId const &actor, Netwo else { PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(creatureObject); - if(playerObject) + if (playerObject) { playerObject->findFriend(cav.name); } @@ -7200,7 +7177,7 @@ static void commandFuncFindFriend(Command const &, NetworkId const &actor, Netwo { // playerName is empty, send an error to requesting client StringId stringId = StringId("ui_cmnty", "friend_location_failed_usage"); - Chat::sendSystemMessage(*creatureObject, stringId, Unicode::emptyString); + Chat::sendSystemMessage(*creatureObject, stringId, Unicode::emptyString); } } } @@ -7213,87 +7190,87 @@ static void commandFuncFormCommand(Command const &, NetworkId const & actor, Net UNREF(target); Unicode::UnicodeStringVector tokens; - IGNORE_RETURN(Unicode::tokenize (params, tokens)); + IGNORE_RETURN(Unicode::tokenize(params, tokens)); - if(tokens.size() == 0) + if (tokens.size() == 0) return; std::string const commandStr = Unicode::wideToNarrow(tokens[0]); FormManager::Command const command = static_cast(atoi(commandStr.c_str())); - switch(command) + switch (command) { - case FormManager::CREATE_OBJECT: + case FormManager::CREATE_OBJECT: + { + if (tokens.size() < 5) + return; + + std::string const templateName = Unicode::wideToNarrow(tokens[1]); + + std::string const & xStr = Unicode::wideToNarrow(tokens[2]); + std::string const & yStr = Unicode::wideToNarrow(tokens[3]); + std::string const & zStr = Unicode::wideToNarrow(tokens[4]); + std::string const & cellStr = Unicode::wideToNarrow(tokens[5]); + NetworkId const cellId(cellStr); + + float const x = static_cast(atof(xStr.c_str())); + float const y = static_cast(atof(yStr.c_str())); + float const z = static_cast(atof(zStr.c_str())); + + //we must have an odd number of tokens left (so that the datamap has a full key->value mapping) + if (tokens.size() % 2 != 0) + return; + + //TODO centralize pack/unpack + FormManager::UnpackedFormData dataMap; + std::vector values; + for (int i = 6; i < static_cast(tokens.size()) - 1; i += 2) { - if(tokens.size() < 5) - return; - - std::string const templateName = Unicode::wideToNarrow(tokens[1]); - - std::string const & xStr = Unicode::wideToNarrow(tokens[2]); - std::string const & yStr = Unicode::wideToNarrow(tokens[3]); - std::string const & zStr = Unicode::wideToNarrow(tokens[4]); - std::string const & cellStr = Unicode::wideToNarrow(tokens[5]); - NetworkId const cellId(cellStr); - - float const x = static_cast(atof(xStr.c_str())); - float const y = static_cast(atof(yStr.c_str())); - float const z = static_cast(atof(zStr.c_str())); - - //we must have an odd number of tokens left (so that the datamap has a full key->value mapping) - if(tokens.size() % 2 != 0) - return; - - //TODO centralize pack/unpack - FormManager::UnpackedFormData dataMap; - std::vector values; - for(int i = 6; i < static_cast(tokens.size()) - 1; i += 2) - { - std::string const & key = Unicode::wideToNarrow(tokens[static_cast(i)]); - std::string const & value = Unicode::wideToNarrow(tokens[static_cast(i + 1)]); - values.clear(); - values.push_back(value); - dataMap[key] = values; - } - - FormManagerServer::handleCreateObjectData(actor, templateName, Vector(x, y, z), cellId, dataMap); - break; + std::string const & key = Unicode::wideToNarrow(tokens[static_cast(i)]); + std::string const & value = Unicode::wideToNarrow(tokens[static_cast(i + 1)]); + values.clear(); + values.push_back(value); + dataMap[key] = values; } - case FormManager::EDIT_OBJECT: + FormManagerServer::handleCreateObjectData(actor, templateName, Vector(x, y, z), cellId, dataMap); + break; + } + + case FormManager::EDIT_OBJECT: + { + if (tokens.size() < 1) + return; + + //we must have an even number of tokens left (so that the datamap has a full key->value mapping) + if (tokens.size() % 2 != 1) + return; + + //TODO centralize pack/unpack + FormManager::UnpackedFormData dataMap; + std::vector values; + for (int i = 1; i < static_cast(tokens.size()) - 1; i += 2) { - if(tokens.size() < 1) - return; - - //we must have an even number of tokens left (so that the datamap has a full key->value mapping) - if(tokens.size() % 2 != 1) - return; - - //TODO centralize pack/unpack - FormManager::UnpackedFormData dataMap; - std::vector values; - for(int i = 1; i < static_cast(tokens.size()) - 1; i += 2) - { - std::string const & key = Unicode::wideToNarrow(tokens[static_cast(i)]); - std::string const & value = Unicode::wideToNarrow(tokens[static_cast(i + 1)]); - values.clear(); - values.push_back(value); - dataMap[key] = values; - } - - FormManagerServer::handleEditObjectData(actor, target, dataMap); - break; + std::string const & key = Unicode::wideToNarrow(tokens[static_cast(i)]); + std::string const & value = Unicode::wideToNarrow(tokens[static_cast(i + 1)]); + values.clear(); + values.push_back(value); + dataMap[key] = values; } - case FormManager::REQUEST_EDIT_OBJECT: - { - FormManagerServer::requestEditObjectDataForClient(actor, target); - break; - } + FormManagerServer::handleEditObjectData(actor, target, dataMap); + break; + } - default: - DEBUG_FATAL(true, ("Unknown command in commandFuncFormCommand")); - break; + case FormManager::REQUEST_EDIT_OBJECT: + { + FormManagerServer::requestEditObjectDataForClient(actor, target); + break; + } + + default: + DEBUG_FATAL(true, ("Unknown command in commandFuncFormCommand")); + break; } } @@ -7302,25 +7279,25 @@ static void commandFuncFormCommand(Command const &, NetworkId const & actor, Net static void commandFuncInstallShipComponents(Command const &, NetworkId const & actor, NetworkId const & target, Unicode::String const & params) { //params for installShipComponent are " " - + Object const * const actorObj = NetworkIdManager::getObjectById(actor); ServerObject const * const actorServerObj = actorObj ? actorObj->asServerObject() : nullptr; CreatureObject const * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : nullptr; - if(!actorCreature) + if (!actorCreature) { return; } //they must be near a space terminal (if not a god) Client const * const client = actorCreature->getClient(); - if(!client) + if (!client) return; - if(!client->isGod()) + if (!client->isGod()) { Object * const targetObj = NetworkIdManager::getObjectById(target); ServerObject * const targetServerObj = targetObj ? targetObj->asServerObject() : nullptr; - if( !targetServerObj || ((targetServerObj->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space) && - (targetServerObj->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space_npe)) ) + if (!targetServerObj || ((targetServerObj->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space) && + (targetServerObj->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space_npe))) return; } else @@ -7333,7 +7310,7 @@ static void commandFuncInstallShipComponents(Command const &, NetworkId const & Object * const shipObj = NetworkIdManager::getObjectById(shipId); ServerObject * const shipServerObj = shipObj ? shipObj->asServerObject() : nullptr; ShipObject * const ship = shipServerObj ? shipServerObj->asShipObject() : nullptr; - if(!ship) + if (!ship) return; ShipChassisSlotType::Type const slotType = static_cast(nextIntParm(params, pos)); @@ -7341,7 +7318,7 @@ static void commandFuncInstallShipComponents(Command const &, NetworkId const & Object * const componentObj = NetworkIdManager::getObjectById(componentId); ServerObject * const componentServerObj = componentObj ? componentObj->asServerObject() : nullptr; TangibleObject * const component = componentServerObj ? componentServerObj->asTangibleObject() : nullptr; - if(!component) + if (!component) { return; } @@ -7363,14 +7340,14 @@ static void commandFuncInstallShipComponents(Command const &, NetworkId const & if (containedByObject) { SlottedContainer const * const slottedContainer = ContainerInterface::getSlottedContainer(*containedByObject); - if(slottedContainer) + if (slottedContainer) { SlotId const & slotId = slottedContainer->findFirstSlotIdForObject(component->getNetworkId()); - if(slotId != SlotId::invalid) + if (slotId != SlotId::invalid) { - if(!ContainerInterface::canPlayerManipulateSlot(slotId)) + if (!ContainerInterface::canPlayerManipulateSlot(slotId)) { - StringId cantManipulateId("player_utility", "cannot_manipulate_slot"); + StringId cantManipulateId("player_utility", "cannot_manipulate_slot"); Chat::sendSystemMessage(*actorCreature, cantManipulateId, Unicode::emptyString); return; } @@ -7391,23 +7368,23 @@ static void commandFuncUninstallShipComponents(Command const &, NetworkId const Object * const actorObj = NetworkIdManager::getObjectById(actor); ServerObject * const actorServerObj = actorObj ? actorObj->asServerObject() : nullptr; CreatureObject * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : nullptr; - if(!actorCreature) + if (!actorCreature) return; ServerObject * const actorInv = actorCreature->getInventory(); - if(!actorInv) + if (!actorInv) return; //they must be near a space terminal (if not a god) Client const * const client = actorCreature->getClient(); - if(!client) + if (!client) return; - if(!client->isGod()) + if (!client->isGod()) { Object * const targetObj = NetworkIdManager::getObjectById(target); ServerObject * const targetServerObj = targetObj ? targetObj->asServerObject() : nullptr; - if(!targetServerObj || - ((targetServerObj->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space) - && (targetServerObj->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space_npe)) ) + if (!targetServerObj || + ((targetServerObj->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space) + && (targetServerObj->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space_npe))) return; } else @@ -7416,13 +7393,13 @@ static void commandFuncUninstallShipComponents(Command const &, NetworkId const } ServerObject const * const actorInventoryObject = actorCreature->getInventory(); - if(!actorInventoryObject) + if (!actorInventoryObject) { Chat::sendSystemMessage(*actorCreature, SharedStringIds::shipcomponentinstall_noinventory, Unicode::emptyString); return; } VolumeContainer const * const inventoryContainer = ContainerInterface::getVolumeContainer(*actorInventoryObject); - if(!inventoryContainer) + if (!inventoryContainer) { Chat::sendSystemMessage(*actorCreature, SharedStringIds::shipcomponentinstall_noinventorycontainer, Unicode::emptyString); return; @@ -7438,7 +7415,7 @@ static void commandFuncUninstallShipComponents(Command const &, NetworkId const Object * const shipObj = NetworkIdManager::getObjectById(shipId); ServerObject * const shipServerObj = shipObj ? shipObj->asServerObject() : nullptr; ShipObject * const ship = shipServerObj ? shipServerObj->asShipObject() : nullptr; - if(!ship) + if (!ship) return; ShipChassisSlotType::Type const slotType = static_cast(nextIntParm(params, pos)); @@ -7446,7 +7423,6 @@ static void commandFuncUninstallShipComponents(Command const &, NetworkId const IGNORE_RETURN(ship->uninstallComponent(actor, slotType, *actorInv)); } - // ---------------------------------------------------------------------- static void commandFuncInsertItemIntoShipComponentSlot(Command const &, NetworkId const & actor, NetworkId const & target, Unicode::String const & params) @@ -7456,19 +7432,19 @@ static void commandFuncInsertItemIntoShipComponentSlot(Command const &, NetworkI Object * const actorObj = NetworkIdManager::getObjectById(actor); ServerObject * const actorServerObj = actorObj ? actorObj->asServerObject() : nullptr; CreatureObject * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : nullptr; - if(!actorCreature) + if (!actorCreature) return; //they must be near a space terminal (if not a god) Client const * const client = actorCreature->getClient(); - if(!client) + if (!client) return; - if(!client->isGod()) + if (!client->isGod()) { Object * const targetObj = NetworkIdManager::getObjectById(target); ServerObject * const targetServerObj = targetObj ? targetObj->asServerObject() : nullptr; - if(!targetServerObj || ((targetServerObj->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space) && - (targetServerObj->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space_npe)) ) + if (!targetServerObj || ((targetServerObj->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space) && + (targetServerObj->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space_npe))) return; } else @@ -7481,12 +7457,12 @@ static void commandFuncInsertItemIntoShipComponentSlot(Command const &, NetworkI Object * const shipObj = NetworkIdManager::getObjectById(shipId); ServerObject * const shipServerObj = shipObj ? shipObj->asServerObject() : nullptr; ShipObject * const ship = shipServerObj ? shipServerObj->asShipObject() : nullptr; - if(!ship) + if (!ship) return; ShipChassisSlotType::Type const slotType = static_cast(nextIntParm(params, pos)); - if(!ship->isSlotInstalled(slotType)) + if (!ship->isSlotInstalled(slotType)) return; NetworkId const componentId = nextOidParm(params, pos); @@ -7514,14 +7490,14 @@ static void commandFuncAssociateDroidControlDeviceWithShip(Command const &, Netw //they must be near a space terminal (if not a god) Client const * const client = actorCreature->getClient(); - if(!client) + if (!client) return; - if(!client->isGod()) + if (!client->isGod()) { Object * const targetObj = NetworkIdManager::getObjectById(target); ServerObject * const targetServerObj = targetObj ? targetObj->asServerObject() : nullptr; - if(!targetServerObj || ((targetServerObj->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space) && - (targetServerObj->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space_npe)) ) + if (!targetServerObj || ((targetServerObj->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space) && + (targetServerObj->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space_npe))) return; } else @@ -7534,7 +7510,7 @@ static void commandFuncAssociateDroidControlDeviceWithShip(Command const &, Netw Object * const shipObj = NetworkIdManager::getObjectById(shipId); ServerObject * const shipServerObj = shipObj ? shipObj->asServerObject() : nullptr; ShipObject * const ship = shipServerObj ? shipServerObj->asShipObject() : nullptr; - if(!ship) + if (!ship) return; NetworkId const droidControlDeviceId = nextOidParm(params, pos); @@ -7558,12 +7534,12 @@ static void commandFuncAssociateDroidControlDeviceWithShip(Command const &, Netw // ---------------------------------------------------------------------- -static void commandFuncServerAsteroidDataListen(Command const &, NetworkId const & actor, NetworkId const & , Unicode::String const & ) +static void commandFuncServerAsteroidDataListen(Command const &, NetworkId const & actor, NetworkId const &, Unicode::String const &) { Object const * const actorObj = NetworkIdManager::getObjectById(actor); ServerObject const * const actorServerObj = actorObj ? actorObj->asServerObject() : nullptr; CreatureObject const * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : nullptr; - if(!actorCreature) + if (!actorCreature) return; ServerAsteroidManager::listenforServerAsteroidDebugData(actor); @@ -7571,12 +7547,12 @@ static void commandFuncServerAsteroidDataListen(Command const &, NetworkId const // ---------------------------------------------------------------------- -static void commandFuncServerAsteroidDataStopListening(Command const &, NetworkId const & actor, NetworkId const & , Unicode::String const & ) +static void commandFuncServerAsteroidDataStopListening(Command const &, NetworkId const & actor, NetworkId const &, Unicode::String const &) { Object const * const actorObj = NetworkIdManager::getObjectById(actor); ServerObject const * const actorServerObj = actorObj ? actorObj->asServerObject() : nullptr; CreatureObject const * const actorCreature = actorServerObj ? actorServerObj->asCreatureObject() : nullptr; - if(!actorCreature) + if (!actorCreature) return; ServerAsteroidManager::endListenforServerAsteroidDebugData(actor); @@ -7603,21 +7579,21 @@ static void commandFuncSetFormation(Command const &, NetworkId const & actor, Ne Object * const o = NetworkIdManager::getObjectById(actor); ServerObject * const so = o ? o->asServerObject() : nullptr; CreatureObject * const actorCreature = so ? so->asCreatureObject() : nullptr; - if(actorCreature) + if (actorCreature) { GroupObject * const group = actorCreature->getGroup(); - if(group) + if (group) { - if(group->getGroupLeaderId() == actor) + if (group->getGroupLeaderId() == actor) { std::string paramsNarrow = Unicode::wideToNarrow(params); - if(paramsNarrow == "none") + if (paramsNarrow == "none") { group->setFormationNameCrc(Crc::crcNull); } else { - if(PlayerFormationManager::isValidFormationName(paramsNarrow)) + if (PlayerFormationManager::isValidFormationName(paramsNarrow)) group->setFormationNameCrc(Crc::normalizeAndCalculate(paramsNarrow.c_str())); } } @@ -7683,20 +7659,20 @@ static void commandFuncUnDock(Command const &, NetworkId const & actor, NetworkI WARNING(true, ("commandFuncUnDock() Undock requested on a nullptr object(%s).", actor.getValueString().c_str())); } } - + //---------------------------------------------------------------------- static void commandFuncLaunchIntoSpace(Command const &, NetworkId const & actor, NetworkId const & target, Unicode::String const & params) { ServerObject * const actorServerObj = safe_cast(NetworkIdManager::getObjectById(actor)); CreatureObject * const actorCreature = actorServerObj != nullptr ? actorServerObj->asCreatureObject() : nullptr; - if(!actorCreature) + if (!actorCreature) { WARNING(true, ("No actorCreature in commandFuncLaunchIntoSpace")); return; } - if(!target.isValid()) + if (!target.isValid()) { StringId invalidTargetId("player_utility", "invalid_target"); Chat::sendSystemMessage(*actorCreature, invalidTargetId, Unicode::emptyString); @@ -7706,13 +7682,13 @@ static void commandFuncLaunchIntoSpace(Command const &, NetworkId const & actor, //target must be a space terminal Object const * const o = NetworkIdManager::getObjectById(target); ServerObject const * const so = o ? o->asServerObject() : nullptr; - if(!so) + if (!so) { StringId invalidTargetId("player_utility", "target_not_server_object"); Chat::sendSystemMessage(*actorCreature, invalidTargetId, Unicode::emptyString); return; } - if(so->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space) + if (so->getGameObjectType() != SharedObjectTemplate::GOT_terminal_space) { ProsePackage p; p.stringId = StringId("player_utility", "not_space_terminal"); @@ -7724,35 +7700,35 @@ static void commandFuncLaunchIntoSpace(Command const &, NetworkId const & actor, } Unicode::UnicodeStringVector tokens; - Unicode::tokenize (params, tokens); - - if(tokens.empty()) + Unicode::tokenize(params, tokens); + + if (tokens.empty()) { Chat::sendSystemMessage(*actorCreature, Unicode::narrowToWide("(unlocalized) No parameters."), Unicode::emptyString); return; } NetworkId const shipPCDId(Unicode::wideToNarrow(tokens[0]).c_str()); - if(!shipPCDId.isValid()) + if (!shipPCDId.isValid()) { Chat::sendSystemMessage(*actorCreature, Unicode::narrowToWide("(unlocalized) Invalid ship."), Unicode::emptyString); return; } Object * const terminalO = NetworkIdManager::getObjectById(target); ServerObject * const terminalSO = terminalO ? terminalO->asServerObject() : nullptr; - if(terminalSO) + if (terminalSO) { std::vector networkIds; unsigned int tokenIndex = 1; - if(tokens.size() > tokenIndex) + if (tokens.size() > tokenIndex) { int const numberOfNetworkIds = atoi(Unicode::wideToNarrow(tokens[tokenIndex]).c_str()); for (int i = 0; i < numberOfNetworkIds; ++i) { ++tokenIndex; - if(tokens.size() > tokenIndex) + if (tokens.size() > tokenIndex) { NetworkId const Id(Unicode::wideToNarrow(tokens[tokenIndex])); if (Id.isValid()) @@ -7761,13 +7737,13 @@ static void commandFuncLaunchIntoSpace(Command const &, NetworkId const & actor, } } } - } + } ++tokenIndex; //adding an empty string is fine (it means they aren't traveling to another ground starport) std::string strPointPlanetResult; - if(tokens.size() > tokenIndex) + if (tokens.size() > tokenIndex) { strPointPlanetResult = Unicode::wideToNarrow(tokens[tokenIndex]); } @@ -7776,10 +7752,10 @@ static void commandFuncLaunchIntoSpace(Command const &, NetworkId const & actor, //adding an empty string is fine (it means they aren't traveling to another ground starport) std::string strPointLocationResult; - if(tokens.size() > tokenIndex) + if (tokens.size() > tokenIndex) { strPointLocationResult = Unicode::wideToNarrow(tokens[tokenIndex]); - std::replace (strPointLocationResult.begin (), strPointLocationResult.end (), '_', ' '); + std::replace(strPointLocationResult.begin(), strPointLocationResult.end(), '_', ' '); } ScriptParams params; @@ -7805,20 +7781,20 @@ static void commandFuncAcceptQuest(Command const &, NetworkId const & actor, Net { ServerObject * const actorServerObj = safe_cast(NetworkIdManager::getObjectById(actor)); CreatureObject * const actorCreature = actorServerObj != nullptr ? actorServerObj->asCreatureObject() : nullptr; - if(!actorCreature) + if (!actorCreature) { WARNING(true, ("No actorCreature in commandFuncAcceptQuest")); return; } PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(actorCreature); - if(!playerObject) + if (!playerObject) { WARNING(true, ("No playerObject in commandFuncAcceptQuest")); return; } uint32 const questCrc = atoi(Unicode::wideToNarrow(params).c_str()); - if(playerObject->getPendingRequestQuestCrc() == questCrc) + if (playerObject->getPendingRequestQuestCrc() == questCrc) { NetworkId const & questGiver = playerObject->getPendingRequestQuestGiver(); playerObject->questActivateQuest(questCrc, questGiver); @@ -7832,29 +7808,29 @@ static void commandFuncReceiveReward(Command const &, NetworkId const & actor, N { ServerObject * const actorServerObj = safe_cast(NetworkIdManager::getObjectById(actor)); CreatureObject * const actorCreature = actorServerObj != nullptr ? actorServerObj->asCreatureObject() : nullptr; - if(!actorCreature) + if (!actorCreature) { WARNING(true, ("No actorCreature in commandFuncReceiveReward")); return; } PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(actorCreature); - if(!playerObject) + if (!playerObject) { WARNING(true, ("No playerObject in commandFuncReceiveReward")); return; } Unicode::UnicodeStringVector sv; - Unicode::tokenize (params, sv); - - if(sv.empty()) + Unicode::tokenize(params, sv); + + if (sv.empty()) return; uint32 const questCrc = atoi(Unicode::wideToNarrow(sv[0]).c_str()); std::string selectedReward; - if(sv.size() > 1) + if (sv.size() > 1) selectedReward = Unicode::wideToNarrow(sv[1]); - if((playerObject->getPendingRequestQuestCrc() == questCrc) || playerObject->questPlayerCanClaimRewardFor(questCrc)) + if ((playerObject->getPendingRequestQuestCrc() == questCrc) || playerObject->questPlayerCanClaimRewardFor(questCrc)) { playerObject->questGrantQuestReward(questCrc, selectedReward); playerObject->setPendingRequestQuestInformation(0, NetworkId::cms_invalid); @@ -7863,26 +7839,26 @@ static void commandFuncReceiveReward(Command const &, NetworkId const & actor, N //---------------------------------------------------------------------- -static void commandFuncAbandonQuest(Command const &, NetworkId const & actor, NetworkId const & , Unicode::String const & params) +static void commandFuncAbandonQuest(Command const &, NetworkId const & actor, NetworkId const &, Unicode::String const & params) { size_t pos = 0; - + //not currently used, but can distinguish between different quest types int const questSystemType = nextIntParm(params, pos); UNREF(questSystemType); std::string const & questName = nextStringParm(params, pos); - if(QuestManager::isQuestAbandonable(questName)) + if (QuestManager::isQuestAbandonable(questName)) { ServerObject * const actorServerObj = safe_cast(NetworkIdManager::getObjectById(actor)); CreatureObject * const actorCreature = actorServerObj != nullptr ? actorServerObj->asCreatureObject() : nullptr; - if(actorCreature) + if (actorCreature) { PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(actorCreature); - if(playerObject) + if (playerObject) { Quest const * const q = QuestManager::getQuest(questName); - if(q && playerObject->questHasActiveQuest(q->getId()) && !playerObject->questHasCompletedQuest(q->getId())) + if (q && playerObject->questHasActiveQuest(q->getId()) && !playerObject->questHasCompletedQuest(q->getId())) { LOG("Quest", ("Abandon:%s abandoned quest [%s] with status [0x%08X].\n", PlayerObject::getAccountDescription(actorServerObj->getClient()->getCharacterObjectId()).c_str(), @@ -7895,43 +7871,39 @@ static void commandFuncAbandonQuest(Command const &, NetworkId const & actor, Ne } } - - // ---------------------------------------------------------------------- static void commandFuncExchangeListCredits(Command const &, NetworkId const &actor, NetworkId const &target, Unicode::String const ¶ms) { ServerObject * const actorServerObj = safe_cast(NetworkIdManager::getObjectById(actor)); CreatureObject * const actorCreature = actorServerObj != nullptr ? actorServerObj->asCreatureObject() : nullptr; - if(!actorCreature) + if (!actorCreature) { WARNING(true, ("No actorCreature in commandFuncReceiveReward")); return; } PlayerObject * playerObject = PlayerCreatureController::getPlayerObject(actorCreature); - if(!playerObject) + if (!playerObject) { WARNING(true, ("No playerObject in commandFuncReceiveReward")); return; } Unicode::UnicodeStringVector sv; - Unicode::tokenize (params, sv); - - if(sv.empty()) + Unicode::tokenize(params, sv); + + if (sv.empty()) return; uint32 const credits = (uint32)atoi(Unicode::wideToNarrow(sv[0]).c_str()); - if ( credits <= 0 ) + if (credits <= 0) return; - char message[512]; - sprintf(message,"Listing %ld credits on station exchange.", credits); + sprintf(message, "Listing %ld credits on station exchange.", credits); Chat::sendSystemMessage(*actorCreature, Unicode::narrowToWide(message), Unicode::emptyString); - ExchangeListCreditsMessage const msg(actor, credits, GameServer::getInstance().getProcessId()); - GameServer::getInstance().sendToCentralServer(msg); + GameServer::getInstance().sendToCentralServer(msg); } //----------------------------------------------------------------------- @@ -7955,8 +7927,8 @@ static void commandFuncSquelch(Command const &, NetworkId const &actor, NetworkI ServerObject * so = dynamic_cast(NetworkIdManager::getObjectById(target)); if (!so) { - snprintf(buffer, sizeof(buffer)-1, "Error! Cannot find object for %s", target.getValueString().c_str()); - buffer[sizeof(buffer)-1] = '\0'; + snprintf(buffer, sizeof(buffer) - 1, "Error! Cannot find object for %s", target.getValueString().c_str()); + buffer[sizeof(buffer) - 1] = '\0'; ConGenericMessage const msg(buffer, 0); gmClient->send(msg, true); } @@ -7965,8 +7937,8 @@ static void commandFuncSquelch(Command const &, NetworkId const &actor, NetworkI CreatureObject * c = so->asCreatureObject(); if (!c) { - snprintf(buffer, sizeof(buffer)-1, "Error! %s (%s) is not a creature object", target.getValueString().c_str(), Unicode::wideToNarrow(so->getAssignedObjectName()).c_str()); - buffer[sizeof(buffer)-1] = '\0'; + snprintf(buffer, sizeof(buffer) - 1, "Error! %s (%s) is not a creature object", target.getValueString().c_str(), Unicode::wideToNarrow(so->getAssignedObjectName()).c_str()); + buffer[sizeof(buffer) - 1] = '\0'; ConGenericMessage const msg(buffer, 0); gmClient->send(msg, true); } @@ -7975,22 +7947,22 @@ static void commandFuncSquelch(Command const &, NetworkId const &actor, NetworkI PlayerObject * p = PlayerCreatureController::getPlayerObject(c); if (!p) { - snprintf(buffer, sizeof(buffer)-1, "Error! %s (%s) is not a player object", target.getValueString().c_str(), Unicode::wideToNarrow(so->getAssignedObjectName()).c_str()); - buffer[sizeof(buffer)-1] = '\0'; + snprintf(buffer, sizeof(buffer) - 1, "Error! %s (%s) is not a player object", target.getValueString().c_str(), Unicode::wideToNarrow(so->getAssignedObjectName()).c_str()); + buffer[sizeof(buffer) - 1] = '\0'; ConGenericMessage const msg(buffer, 0); gmClient->send(msg, true); } else if (p->getSecondsUntilUnsquelched() < 0) { - snprintf(buffer, sizeof(buffer)-1, "Error! %s (%s) is already squelched", target.getValueString().c_str(), Unicode::wideToNarrow(so->getAssignedObjectName()).c_str()); - buffer[sizeof(buffer)-1] = '\0'; + snprintf(buffer, sizeof(buffer) - 1, "Error! %s (%s) is already squelched", target.getValueString().c_str(), Unicode::wideToNarrow(so->getAssignedObjectName()).c_str()); + buffer[sizeof(buffer) - 1] = '\0'; ConGenericMessage const msg(buffer, 0); gmClient->send(msg, true); } else { - snprintf(buffer, sizeof(buffer)-1, "Squelching %s (%s)", target.getValueString().c_str(), Unicode::wideToNarrow(so->getAssignedObjectName()).c_str()); - buffer[sizeof(buffer)-1] = '\0'; + snprintf(buffer, sizeof(buffer) - 1, "Squelching %s (%s)", target.getValueString().c_str(), Unicode::wideToNarrow(so->getAssignedObjectName()).c_str()); + buffer[sizeof(buffer) - 1] = '\0'; ConGenericMessage const msg(buffer, 0); gmClient->send(msg, true); @@ -8024,8 +7996,8 @@ static void commandFuncUnsquelch(Command const &, NetworkId const &actor, Networ ServerObject * so = dynamic_cast(NetworkIdManager::getObjectById(target)); if (!so) { - snprintf(buffer, sizeof(buffer)-1, "Error! Cannot find object for %s", target.getValueString().c_str()); - buffer[sizeof(buffer)-1] = '\0'; + snprintf(buffer, sizeof(buffer) - 1, "Error! Cannot find object for %s", target.getValueString().c_str()); + buffer[sizeof(buffer) - 1] = '\0'; ConGenericMessage const msg(buffer, 0); gmClient->send(msg, true); } @@ -8034,8 +8006,8 @@ static void commandFuncUnsquelch(Command const &, NetworkId const &actor, Networ CreatureObject * c = so->asCreatureObject(); if (!c) { - snprintf(buffer, sizeof(buffer)-1, "Error! %s (%s) is not a creature object", target.getValueString().c_str(), Unicode::wideToNarrow(so->getAssignedObjectName()).c_str()); - buffer[sizeof(buffer)-1] = '\0'; + snprintf(buffer, sizeof(buffer) - 1, "Error! %s (%s) is not a creature object", target.getValueString().c_str(), Unicode::wideToNarrow(so->getAssignedObjectName()).c_str()); + buffer[sizeof(buffer) - 1] = '\0'; ConGenericMessage const msg(buffer, 0); gmClient->send(msg, true); } @@ -8044,22 +8016,22 @@ static void commandFuncUnsquelch(Command const &, NetworkId const &actor, Networ PlayerObject * p = PlayerCreatureController::getPlayerObject(c); if (!p) { - snprintf(buffer, sizeof(buffer)-1, "Error! %s (%s) is not a player object", target.getValueString().c_str(), Unicode::wideToNarrow(so->getAssignedObjectName()).c_str()); - buffer[sizeof(buffer)-1] = '\0'; + snprintf(buffer, sizeof(buffer) - 1, "Error! %s (%s) is not a player object", target.getValueString().c_str(), Unicode::wideToNarrow(so->getAssignedObjectName()).c_str()); + buffer[sizeof(buffer) - 1] = '\0'; ConGenericMessage const msg(buffer, 0); gmClient->send(msg, true); } else if (p->getSecondsUntilUnsquelched() == 0) { - snprintf(buffer, sizeof(buffer)-1, "Error! %s (%s) is not currently squelched", target.getValueString().c_str(), Unicode::wideToNarrow(so->getAssignedObjectName()).c_str()); - buffer[sizeof(buffer)-1] = '\0'; + snprintf(buffer, sizeof(buffer) - 1, "Error! %s (%s) is not currently squelched", target.getValueString().c_str(), Unicode::wideToNarrow(so->getAssignedObjectName()).c_str()); + buffer[sizeof(buffer) - 1] = '\0'; ConGenericMessage const msg(buffer, 0); gmClient->send(msg, true); } else { - snprintf(buffer, sizeof(buffer)-1, "Unsquelching %s (%s)", target.getValueString().c_str(), Unicode::wideToNarrow(so->getAssignedObjectName()).c_str()); - buffer[sizeof(buffer)-1] = '\0'; + snprintf(buffer, sizeof(buffer) - 1, "Unsquelching %s (%s)", target.getValueString().c_str(), Unicode::wideToNarrow(so->getAssignedObjectName()).c_str()); + buffer[sizeof(buffer) - 1] = '\0'; ConGenericMessage const msg(buffer, 0); gmClient->send(msg, true); @@ -8093,8 +8065,8 @@ static void commandFuncGrantWarden(Command const &, NetworkId const &actor, Netw ServerObject * so = dynamic_cast(NetworkIdManager::getObjectById(target)); if (!so) { - snprintf(buffer, sizeof(buffer)-1, "Error! Cannot find object for %s", target.getValueString().c_str()); - buffer[sizeof(buffer)-1] = '\0'; + snprintf(buffer, sizeof(buffer) - 1, "Error! Cannot find object for %s", target.getValueString().c_str()); + buffer[sizeof(buffer) - 1] = '\0'; ConGenericMessage const msg(buffer, 0); gmClient->send(msg, true); } @@ -8103,8 +8075,8 @@ static void commandFuncGrantWarden(Command const &, NetworkId const &actor, Netw CreatureObject * c = so->asCreatureObject(); if (!c) { - snprintf(buffer, sizeof(buffer)-1, "Error! %s (%s) is not a creature object", target.getValueString().c_str(), Unicode::wideToNarrow(so->getAssignedObjectName()).c_str()); - buffer[sizeof(buffer)-1] = '\0'; + snprintf(buffer, sizeof(buffer) - 1, "Error! %s (%s) is not a creature object", target.getValueString().c_str(), Unicode::wideToNarrow(so->getAssignedObjectName()).c_str()); + buffer[sizeof(buffer) - 1] = '\0'; ConGenericMessage const msg(buffer, 0); gmClient->send(msg, true); } @@ -8113,22 +8085,22 @@ static void commandFuncGrantWarden(Command const &, NetworkId const &actor, Netw PlayerObject * p = PlayerCreatureController::getPlayerObject(c); if (!p) { - snprintf(buffer, sizeof(buffer)-1, "Error! %s (%s) is not a player object", target.getValueString().c_str(), Unicode::wideToNarrow(so->getAssignedObjectName()).c_str()); - buffer[sizeof(buffer)-1] = '\0'; + snprintf(buffer, sizeof(buffer) - 1, "Error! %s (%s) is not a player object", target.getValueString().c_str(), Unicode::wideToNarrow(so->getAssignedObjectName()).c_str()); + buffer[sizeof(buffer) - 1] = '\0'; ConGenericMessage const msg(buffer, 0); gmClient->send(msg, true); } else if (p->isWarden()) { - snprintf(buffer, sizeof(buffer)-1, "Error! %s (%s) is already a warden", target.getValueString().c_str(), Unicode::wideToNarrow(so->getAssignedObjectName()).c_str()); - buffer[sizeof(buffer)-1] = '\0'; + snprintf(buffer, sizeof(buffer) - 1, "Error! %s (%s) is already a warden", target.getValueString().c_str(), Unicode::wideToNarrow(so->getAssignedObjectName()).c_str()); + buffer[sizeof(buffer) - 1] = '\0'; ConGenericMessage const msg(buffer, 0); gmClient->send(msg, true); } else { - snprintf(buffer, sizeof(buffer)-1, "Granting warden to %s (%s)", target.getValueString().c_str(), Unicode::wideToNarrow(so->getAssignedObjectName()).c_str()); - buffer[sizeof(buffer)-1] = '\0'; + snprintf(buffer, sizeof(buffer) - 1, "Granting warden to %s (%s)", target.getValueString().c_str(), Unicode::wideToNarrow(so->getAssignedObjectName()).c_str()); + buffer[sizeof(buffer) - 1] = '\0'; ConGenericMessage const msg(buffer, 0); gmClient->send(msg, true); @@ -8164,8 +8136,8 @@ static void commandFuncRevokeWarden(Command const &, NetworkId const &actor, Net ServerObject * so = dynamic_cast(NetworkIdManager::getObjectById(target)); if (!so) { - snprintf(buffer, sizeof(buffer)-1, "Error! Cannot find object for %s", target.getValueString().c_str()); - buffer[sizeof(buffer)-1] = '\0'; + snprintf(buffer, sizeof(buffer) - 1, "Error! Cannot find object for %s", target.getValueString().c_str()); + buffer[sizeof(buffer) - 1] = '\0'; ConGenericMessage const msg(buffer, 0); gmClient->send(msg, true); } @@ -8174,8 +8146,8 @@ static void commandFuncRevokeWarden(Command const &, NetworkId const &actor, Net CreatureObject * c = so->asCreatureObject(); if (!c) { - snprintf(buffer, sizeof(buffer)-1, "Error! %s (%s) is not a creature object", target.getValueString().c_str(), Unicode::wideToNarrow(so->getAssignedObjectName()).c_str()); - buffer[sizeof(buffer)-1] = '\0'; + snprintf(buffer, sizeof(buffer) - 1, "Error! %s (%s) is not a creature object", target.getValueString().c_str(), Unicode::wideToNarrow(so->getAssignedObjectName()).c_str()); + buffer[sizeof(buffer) - 1] = '\0'; ConGenericMessage const msg(buffer, 0); gmClient->send(msg, true); } @@ -8184,22 +8156,22 @@ static void commandFuncRevokeWarden(Command const &, NetworkId const &actor, Net PlayerObject * p = PlayerCreatureController::getPlayerObject(c); if (!p) { - snprintf(buffer, sizeof(buffer)-1, "Error! %s (%s) is not a player object", target.getValueString().c_str(), Unicode::wideToNarrow(so->getAssignedObjectName()).c_str()); - buffer[sizeof(buffer)-1] = '\0'; + snprintf(buffer, sizeof(buffer) - 1, "Error! %s (%s) is not a player object", target.getValueString().c_str(), Unicode::wideToNarrow(so->getAssignedObjectName()).c_str()); + buffer[sizeof(buffer) - 1] = '\0'; ConGenericMessage const msg(buffer, 0); gmClient->send(msg, true); } else if (!p->isWarden()) { - snprintf(buffer, sizeof(buffer)-1, "Error! %s (%s) is not a warden", target.getValueString().c_str(), Unicode::wideToNarrow(so->getAssignedObjectName()).c_str()); - buffer[sizeof(buffer)-1] = '\0'; + snprintf(buffer, sizeof(buffer) - 1, "Error! %s (%s) is not a warden", target.getValueString().c_str(), Unicode::wideToNarrow(so->getAssignedObjectName()).c_str()); + buffer[sizeof(buffer) - 1] = '\0'; ConGenericMessage const msg(buffer, 0); gmClient->send(msg, true); } else { - snprintf(buffer, sizeof(buffer)-1, "Revoking warden from %s (%s)", target.getValueString().c_str(), Unicode::wideToNarrow(so->getAssignedObjectName()).c_str()); - buffer[sizeof(buffer)-1] = '\0'; + snprintf(buffer, sizeof(buffer) - 1, "Revoking warden from %s (%s)", target.getValueString().c_str(), Unicode::wideToNarrow(so->getAssignedObjectName()).c_str()); + buffer[sizeof(buffer) - 1] = '\0'; ConGenericMessage const msg(buffer, 0); gmClient->send(msg, true); @@ -8273,8 +8245,8 @@ static void commandFuncSpammer(Command const &, NetworkId const &actor, NetworkI { // send a messageTo to the target to do apply the /spammer operation char buffer[1024]; - snprintf(buffer, sizeof(buffer)-1, "%s %s", actor.getValueString().c_str(), Unicode::wideToNarrow(gm->getAssignedObjectName()).c_str()); - buffer[sizeof(buffer)-1] = '\0'; + snprintf(buffer, sizeof(buffer) - 1, "%s %s", actor.getValueString().c_str(), Unicode::wideToNarrow(gm->getAssignedObjectName()).c_str()); + buffer[sizeof(buffer) - 1] = '\0'; MessageToQueue::getInstance().sendMessageToC(parsedNetworkId, "C++SpammerReq", @@ -8534,8 +8506,8 @@ static void commandFuncDeputizeWarden(Command const &, NetworkId const &actor, N // send a messageTo to the target to complete the deputize process char buffer[1024]; - snprintf(buffer, sizeof(buffer)-1, "%s|%lu", gm->getNetworkId().getValueString().c_str(), gmPlayerObject->getStationId()); - buffer[sizeof(buffer)-1] = '\0'; + snprintf(buffer, sizeof(buffer) - 1, "%s|%lu", gm->getNetworkId().getValueString().c_str(), gmPlayerObject->getStationId()); + buffer[sizeof(buffer) - 1] = '\0'; MessageToQueue::getInstance().sendMessageToC(parsedNetworkId, "C++DeputizeWardenReq", @@ -8597,8 +8569,8 @@ static void commandFuncUndeputizeWarden(Command const &, NetworkId const &actor, // send a messageTo to the target to complete the undeputize process char buffer[1024]; - snprintf(buffer, sizeof(buffer)-1, "%s|%lu", gm->getNetworkId().getValueString().c_str(), gmPlayerObject->getStationId()); - buffer[sizeof(buffer)-1] = '\0'; + snprintf(buffer, sizeof(buffer) - 1, "%s|%lu", gm->getNetworkId().getValueString().c_str(), gmPlayerObject->getStationId()); + buffer[sizeof(buffer) - 1] = '\0'; MessageToQueue::getInstance().sendMessageToC(parsedNetworkId, "C++UndeputizeWardenReq", @@ -8613,7 +8585,7 @@ static void commandFuncUndeputizeWarden(Command const &, NetworkId const &actor, //----------------------------------------------------------------------- -static void commandFuncRemoveBuff(Command const &, NetworkId const &actor, NetworkId const & , Unicode::String const ¶ms) +static void commandFuncRemoveBuff(Command const &, NetworkId const &actor, NetworkId const &, Unicode::String const ¶ms) { CreatureObject * player = dynamic_cast(NetworkIdManager::getObjectById(actor)); if (player) @@ -8679,7 +8651,7 @@ static void commandFuncOccupyUnlockedSlot(Command const &, NetworkId const &acto } // CS log the request - LOG("CustomerService",("JediUnlockedSlot:%s requesting OccupyUnlockedSlot", PlayerObject::getAccountDescription(gm).c_str())); + LOG("CustomerService", ("JediUnlockedSlot:%s requesting OccupyUnlockedSlot", PlayerObject::getAccountDescription(gm).c_str())); // send off request to LoginServer to make this character occupy the unlocked slot GenericValueTypeMessage, uint32> > const occupyUnlockedSlotReq("OccupyUnlockedSlotReq", std::make_pair(std::make_pair(static_cast(gmPlayerObject->getStationId()), actor), GameServer::getInstance().getProcessId())); @@ -8745,7 +8717,7 @@ static void commandFuncVacateUnlockedSlot(Command const &, NetworkId const &acto } // CS log the request - LOG("CustomerService",("JediUnlockedSlot:%s requesting VacateUnlockedSlot", PlayerObject::getAccountDescription(gm).c_str())); + LOG("CustomerService", ("JediUnlockedSlot:%s requesting VacateUnlockedSlot", PlayerObject::getAccountDescription(gm).c_str())); // send off request to LoginServer to make this character vacate the unlocked slot GenericValueTypeMessage, uint32> > const vacateUnlockedSlotReq("VacateUnlockedSlotReq", std::make_pair(std::make_pair(static_cast(gmPlayerObject->getStationId()), actor), GameServer::getInstance().getProcessId())); @@ -8833,7 +8805,7 @@ static void commandFuncSwapUnlockedSlot(Command const &, NetworkId const &actor, } // CS log the request - LOG("CustomerService",("JediUnlockedSlot:%s requesting SwapUnlockedSlot with %s (%s)", PlayerObject::getAccountDescription(gm).c_str(), parsedNetworkId.getValueString().c_str(), NameManager::getInstance().getPlayerFullName(parsedNetworkId).c_str())); + LOG("CustomerService", ("JediUnlockedSlot:%s requesting SwapUnlockedSlot with %s (%s)", PlayerObject::getAccountDescription(gm).c_str(), parsedNetworkId.getValueString().c_str(), NameManager::getInstance().getPlayerFullName(parsedNetworkId).c_str())); // send off request to LoginServer to make this character normal and the target characer unlocked GenericValueTypeMessage, std::pair > > const swapUnlockedSlotReq("SwapUnlockedSlotReq", std::make_pair(std::make_pair(static_cast(gmPlayerObject->getStationId()), actor), std::make_pair(GameServer::getInstance().getProcessId(), parsedNetworkId))); @@ -9580,114 +9552,114 @@ static void commandFuncRoomPickRandomPlayer(Command const &, NetworkId const &ac void CommandCppFuncs::install() { // console style commands - CommandTable::addCppFunction("console_all", commandFuncConsoleAll); - CommandTable::addCppFunction("console_combat", commandFuncConsoleCombat); - CommandTable::addCppFunction("console_craft", commandFuncConsoleCraft); - CommandTable::addCppFunction("console_database", commandFuncConsoleDatabase); - CommandTable::addCppFunction("console_manufacture", commandFuncConsoleManufacture); - CommandTable::addCppFunction("console_money", commandFuncConsoleMoney); - CommandTable::addCppFunction("console_npc", commandFuncConsoleNpc); - CommandTable::addCppFunction("console_object", commandFuncConsoleObject); - CommandTable::addCppFunction("console_objvar", commandFuncConsoleObjvar); - CommandTable::addCppFunction("console_resource", commandFuncConsoleResource); - CommandTable::addCppFunction("console_script", commandFuncConsoleScript); - CommandTable::addCppFunction("console_server", commandFuncConsoleServer); - CommandTable::addCppFunction("console_skill", commandFuncConsoleSkill); + CommandTable::addCppFunction("console_all", commandFuncConsoleAll); + CommandTable::addCppFunction("console_combat", commandFuncConsoleCombat); + CommandTable::addCppFunction("console_craft", commandFuncConsoleCraft); + CommandTable::addCppFunction("console_database", commandFuncConsoleDatabase); + CommandTable::addCppFunction("console_manufacture", commandFuncConsoleManufacture); + CommandTable::addCppFunction("console_money", commandFuncConsoleMoney); + CommandTable::addCppFunction("console_npc", commandFuncConsoleNpc); + CommandTable::addCppFunction("console_object", commandFuncConsoleObject); + CommandTable::addCppFunction("console_objvar", commandFuncConsoleObjvar); + CommandTable::addCppFunction("console_resource", commandFuncConsoleResource); + CommandTable::addCppFunction("console_script", commandFuncConsoleScript); + CommandTable::addCppFunction("console_server", commandFuncConsoleServer); + CommandTable::addCppFunction("console_skill", commandFuncConsoleSkill); // communication commands - CommandTable::addCppFunction("social", commandFuncSocial); - CommandTable::addCppFunction("socialInternal", commandFuncSocialInternal); - CommandTable::addCppFunction("spatialChat", commandFuncSpatialChat); - CommandTable::addCppFunction("spatialChatInternal", commandFuncSpatialChatInternal); - CommandTable::addCppFunction("setMood", commandFuncSetMood); - CommandTable::addCppFunction("setMoodInternal", commandFuncSetMoodInternal); - CommandTable::addCppFunction("systemMessage", commandFuncSystemMessage); -// CommandTable::addCppFunction("combatSpam", commandFuncCombatSpam); + CommandTable::addCppFunction("social", commandFuncSocial); + CommandTable::addCppFunction("socialInternal", commandFuncSocialInternal); + CommandTable::addCppFunction("spatialChat", commandFuncSpatialChat); + CommandTable::addCppFunction("spatialChatInternal", commandFuncSpatialChatInternal); + CommandTable::addCppFunction("setMood", commandFuncSetMood); + CommandTable::addCppFunction("setMoodInternal", commandFuncSetMoodInternal); + CommandTable::addCppFunction("systemMessage", commandFuncSystemMessage); + // CommandTable::addCppFunction("combatSpam", commandFuncCombatSpam); - // admin commands - CommandTable::addCppFunction("admin_setGodMode", commandFuncAdminSetGodMode); - CommandTable::addCppFunction("admin_kick", commandFuncAdminKick); - CommandTable::addCppFunction("admin_planetwarp", commandFuncAdminPlanetwarp); - CommandTable::addCppFunction("admin_teleport", commandFuncAdminTeleport); - CommandTable::addCppFunction("admin_teleportTo", commandFuncAdminTeleportTo); - CommandTable::addCppFunction("admin_listGuilds", commandFuncAdminListGuilds); - CommandTable::addCppFunction("editBank", commandFuncAdminEditBank); - CommandTable::addCppFunction("editStats", commandFuncAdminEditStats); - CommandTable::addCppFunction("editAppearance", commandFuncAdminEditAppearance); - CommandTable::addCppFunction("grantTitle", commandFuncAdminGrantTitle); - CommandTable::addCppFunction("credits", commandFuncAdminCredits); - CommandTable::addCppFunction("getStationName", commandFuncAdminGetStationName); - CommandTable::addCppFunction("emptyMailTarget", commandFuncEmptyMailTarget); - CommandTable::addCppFunction("setPlayerAppearance", commandFuncSetPlayerAppearance); + // admin commands + CommandTable::addCppFunction("admin_setGodMode", commandFuncAdminSetGodMode); + CommandTable::addCppFunction("admin_kick", commandFuncAdminKick); + CommandTable::addCppFunction("admin_planetwarp", commandFuncAdminPlanetwarp); + CommandTable::addCppFunction("admin_teleport", commandFuncAdminTeleport); + CommandTable::addCppFunction("admin_teleportTo", commandFuncAdminTeleportTo); + CommandTable::addCppFunction("admin_listGuilds", commandFuncAdminListGuilds); + CommandTable::addCppFunction("editBank", commandFuncAdminEditBank); + CommandTable::addCppFunction("editStats", commandFuncAdminEditStats); + CommandTable::addCppFunction("editAppearance", commandFuncAdminEditAppearance); + CommandTable::addCppFunction("grantTitle", commandFuncAdminGrantTitle); + CommandTable::addCppFunction("credits", commandFuncAdminCredits); + CommandTable::addCppFunction("getStationName", commandFuncAdminGetStationName); + CommandTable::addCppFunction("emptyMailTarget", commandFuncEmptyMailTarget); + CommandTable::addCppFunction("setPlayerAppearance", commandFuncSetPlayerAppearance); CommandTable::addCppFunction("revertPlayerAppearance", commandFuncRevertPlayerAppearance); // auction commands - CommandTable::addCppFunction("auction_create", commandFuncAuctionCreate); - CommandTable::addCppFunction("auction_create_immediate", commandFuncAuctionCreateImmediate); - CommandTable::addCppFunction("auction_bid", commandFuncAuctionBid); - CommandTable::addCppFunction("auction_cancel", commandFuncAuctionCancel); - CommandTable::addCppFunction("auction_accept", commandFuncAuctionAccept); - CommandTable::addCppFunction("auction_query", commandFuncAuctionQuery); - CommandTable::addCppFunction("auction_retrieve", commandFuncAuctionRetrieve); + CommandTable::addCppFunction("auction_create", commandFuncAuctionCreate); + CommandTable::addCppFunction("auction_create_immediate", commandFuncAuctionCreateImmediate); + CommandTable::addCppFunction("auction_bid", commandFuncAuctionBid); + CommandTable::addCppFunction("auction_cancel", commandFuncAuctionCancel); + CommandTable::addCppFunction("auction_accept", commandFuncAuctionAccept); + CommandTable::addCppFunction("auction_query", commandFuncAuctionQuery); + CommandTable::addCppFunction("auction_retrieve", commandFuncAuctionRetrieve); // cell/building permissions commands - CommandTable::addCppFunction("addBannedPlayer", commandFuncAddBannedPlayer); - CommandTable::addCppFunction("removeBannedPlayer", commandFuncRemoveBannedPlayer); - CommandTable::addCppFunction("addAllowedPlayer", commandFuncAddAllowedPlayer); - CommandTable::addCppFunction("removeAllowedPlayer", commandFuncRemoveAllowedPlayer); - CommandTable::addCppFunction("setPublicState", commandFuncSetPublicState); - CommandTable::addCppFunction("setOwner", commandFuncSetOwner); + CommandTable::addCppFunction("addBannedPlayer", commandFuncAddBannedPlayer); + CommandTable::addCppFunction("removeBannedPlayer", commandFuncRemoveBannedPlayer); + CommandTable::addCppFunction("addAllowedPlayer", commandFuncAddAllowedPlayer); + CommandTable::addCppFunction("removeAllowedPlayer", commandFuncRemoveAllowedPlayer); + CommandTable::addCppFunction("setPublicState", commandFuncSetPublicState); + CommandTable::addCppFunction("setOwner", commandFuncSetOwner); - CommandTable::addCppFunction("setPosture", commandSetPosture); - CommandTable::addCppFunction("duel", commandFuncDuel); - CommandTable::addCppFunction("endDuel", commandFuncEndDuel); + CommandTable::addCppFunction("setPosture", commandSetPosture); + CommandTable::addCppFunction("duel", commandFuncDuel); + CommandTable::addCppFunction("endDuel", commandFuncEndDuel); // ui CommandTable::addCppFunction("setWaypointActiveStatus", commandFuncSetWaypointActiveStatus); - CommandTable::addCppFunction("setWaypointName", commandFuncSetWaypointName); + CommandTable::addCppFunction("setWaypointName", commandFuncSetWaypointName); // harvester - CommandTable::addCppFunction("harvesterActivate", commandFuncHarvesterActivate); - CommandTable::addCppFunction("harvesterDeactivate", commandFuncHarvesterDeactivate); - CommandTable::addCppFunction("harvesterHarvest", commandFuncHarvesterHarvest); - CommandTable::addCppFunction("harvesterSelectResource", commandFuncHarvesterSelectResource); - CommandTable::addCppFunction("harvesterDiscardHopper", commandFuncHarvesterDiscardHopper); - CommandTable::addCppFunction("harvesterMakeCrate", commandFuncHarvesterMakeCrate); - CommandTable::addCppFunction("harvesterGetResourceData", commandFuncHarvesterGetResourceData); + CommandTable::addCppFunction("harvesterActivate", commandFuncHarvesterActivate); + CommandTable::addCppFunction("harvesterDeactivate", commandFuncHarvesterDeactivate); + CommandTable::addCppFunction("harvesterHarvest", commandFuncHarvesterHarvest); + CommandTable::addCppFunction("harvesterSelectResource", commandFuncHarvesterSelectResource); + CommandTable::addCppFunction("harvesterDiscardHopper", commandFuncHarvesterDiscardHopper); + CommandTable::addCppFunction("harvesterMakeCrate", commandFuncHarvesterMakeCrate); + CommandTable::addCppFunction("harvesterGetResourceData", commandFuncHarvesterGetResourceData); // syncronized ui - CommandTable::addCppFunction("synchronizedUiListen" , commandFuncSynchronizedUiListen); - CommandTable::addCppFunction("synchronizedUiStopListening", commandFuncSynchronizedUiStopListening); + CommandTable::addCppFunction("synchronizedUiListen", commandFuncSynchronizedUiListen); + CommandTable::addCppFunction("synchronizedUiStopListening", commandFuncSynchronizedUiStopListening); // resource - CommandTable::addCppFunction("resourceSetName", commandFuncResourceSetName); + CommandTable::addCppFunction("resourceSetName", commandFuncResourceSetName); // resource container CommandTable::addCppFunction("resourceContainerTransfer", commandFuncResourceContainerTransfer); - CommandTable::addCppFunction("resourceContainerSplit", commandFuncResourceContainerSplit); + CommandTable::addCppFunction("resourceContainerSplit", commandFuncResourceContainerSplit); // survey - CommandTable::addCppFunction("makeSurvey", commandFuncMakeSurvey); - CommandTable::addCppFunction("requestSurvey", commandFuncRequestSurvey); - CommandTable::addCppFunction("requestCoreSample", commandFuncRequestCoreSample); + CommandTable::addCppFunction("makeSurvey", commandFuncMakeSurvey); + CommandTable::addCppFunction("requestSurvey", commandFuncRequestSurvey); + CommandTable::addCppFunction("requestCoreSample", commandFuncRequestCoreSample); - CommandTable::addCppFunction("transferItemWeapon", commandFuncTransferWeapon); - CommandTable::addCppFunction("transferItemArmor", commandFuncTransferArmor); - CommandTable::addCppFunction("transferItemMisc", commandFuncTransferMisc); - CommandTable::addCppFunction("openContainer", commandFuncOpenContainer); - CommandTable::addCppFunction("closeContainer", commandFuncCloseContainer); - CommandTable::addCppFunction("openLotteryContainer", commandFuncOpenLotteryContainer); + CommandTable::addCppFunction("transferItemWeapon", commandFuncTransferWeapon); + CommandTable::addCppFunction("transferItemArmor", commandFuncTransferArmor); + CommandTable::addCppFunction("transferItemMisc", commandFuncTransferMisc); + CommandTable::addCppFunction("openContainer", commandFuncOpenContainer); + CommandTable::addCppFunction("closeContainer", commandFuncCloseContainer); + CommandTable::addCppFunction("openLotteryContainer", commandFuncOpenLotteryContainer); CommandTable::addCppFunction("closeLotteryContainer", commandFuncCloseLotteryContainer); - CommandTable::addCppFunction("giveItem", commandFuncGiveItem); + CommandTable::addCppFunction("giveItem", commandFuncGiveItem); // grouping - CommandTable::addCppFunction("groupInvite", commandFuncGroupInvite); - CommandTable::addCppFunction("groupUninvite", commandFuncGroupUninvite); - CommandTable::addCppFunction("groupJoin", commandFuncGroupJoin); - CommandTable::addCppFunction("groupDecline", commandFuncGroupDecline); - CommandTable::addCppFunction("groupDisband", commandFuncGroupDisband); - CommandTable::addCppFunction("kickFromShip", commandFuncKickFromShip); - CommandTable::addCppFunction("groupChat", commandFuncGroupChat); + CommandTable::addCppFunction("groupInvite", commandFuncGroupInvite); + CommandTable::addCppFunction("groupUninvite", commandFuncGroupUninvite); + CommandTable::addCppFunction("groupJoin", commandFuncGroupJoin); + CommandTable::addCppFunction("groupDecline", commandFuncGroupDecline); + CommandTable::addCppFunction("groupDisband", commandFuncGroupDisband); + CommandTable::addCppFunction("kickFromShip", commandFuncKickFromShip); + CommandTable::addCppFunction("groupChat", commandFuncGroupChat); CommandTable::addCppFunction("groupMakeLeader", commandFuncGroupMakeLeader); CommandTable::addCppFunction("groupMakeMasterLooter", commandFuncGroupMakeMasterLooter); CommandTable::addCppFunction("createGroupPickup", commandFuncCreateGroupPickup); @@ -9696,102 +9668,102 @@ void CommandCppFuncs::install() CommandTable::addCppFunction("groupPickRandomGroupMember", commandFuncGroupPickRandomGroupMember); // guilds - CommandTable::addCppFunction("guildChat", commandFuncGuildChat); + CommandTable::addCppFunction("guildChat", commandFuncGuildChat); CommandTable::addCppFunction("guildTextChatRoomRejoin", commandFuncGuildTextChatRoomRejoin); CommandTable::addCppFunction("guildPickRandomGuildMember", commandFuncGuildPickRandomGuildMember); // city - CommandTable::addCppFunction("cityChat", commandFuncCityChat); + CommandTable::addCppFunction("cityChat", commandFuncCityChat); CommandTable::addCppFunction("cityTextChatRoomRejoin", commandFuncCityTextChatRoomRejoin); CommandTable::addCppFunction("cityPickRandomCitizen", commandFuncCityPickRandomCitizen); //chat - CommandTable::addCppFunction("auctionChat", commandFuncAuctionChat); - CommandTable::addCppFunction("planetChat", commandFuncPlanetChat); - + CommandTable::addCppFunction("auctionChat", commandFuncAuctionChat); + CommandTable::addCppFunction("planetChat", commandFuncPlanetChat); + // crafting - CommandTable::addCppFunction("requestResourceWeights", commandFuncRequestResourceWeights); + CommandTable::addCppFunction("requestResourceWeights", commandFuncRequestResourceWeights); CommandTable::addCppFunction("requestResourceWeightsBatch", commandFuncRequestResourceWeightsBatch); - CommandTable::addCppFunction("requestDraftSlots", commandFuncRequestDraftSlots); - CommandTable::addCppFunction("requestDraftSlotsBatch", commandFuncRequestDraftSlotsBatch); + CommandTable::addCppFunction("requestDraftSlots", commandFuncRequestDraftSlots); + CommandTable::addCppFunction("requestDraftSlotsBatch", commandFuncRequestDraftSlotsBatch); CommandTable::addCppFunction("requestManfSchematicSlots", commandFuncRequestManfSchematicSlots); - CommandTable::addCppFunction("requestCraftingSession", commandFuncRequestCraftingSession); - CommandTable::addCppFunction("requestCraftingSessionFail",commandFuncRequestCraftingSessionFail); - CommandTable::addCppFunction("selectDraftSchematic", commandFuncSelectDraftSchematic); - CommandTable::addCppFunction("nextCraftingStage", commandFuncNextCraftingStage); - CommandTable::addCppFunction("createPrototype", commandFuncCreatePrototype); - CommandTable::addCppFunction("createManfSchematic", commandFuncCreateManfSchematic); - CommandTable::addCppFunction("cancelCraftingSession", commandFuncCancelCraftingSession); - CommandTable::addCppFunction("stopCraftingSession", commandFuncStopCraftingSession); - CommandTable::addCppFunction("restartCraftingSession", commandFuncRestartCraftingSession); - CommandTable::addCppFunction("extractObject", commandFuncExtractObject); - CommandTable::addCppFunction("repair", commandFuncRepair); - CommandTable::addCppFunction("factoryCrateSplit", commandFuncFactoryCrateSplit); + CommandTable::addCppFunction("requestCraftingSession", commandFuncRequestCraftingSession); + CommandTable::addCppFunction("requestCraftingSessionFail", commandFuncRequestCraftingSessionFail); + CommandTable::addCppFunction("selectDraftSchematic", commandFuncSelectDraftSchematic); + CommandTable::addCppFunction("nextCraftingStage", commandFuncNextCraftingStage); + CommandTable::addCppFunction("createPrototype", commandFuncCreatePrototype); + CommandTable::addCppFunction("createManfSchematic", commandFuncCreateManfSchematic); + CommandTable::addCppFunction("cancelCraftingSession", commandFuncCancelCraftingSession); + CommandTable::addCppFunction("stopCraftingSession", commandFuncStopCraftingSession); + CommandTable::addCppFunction("restartCraftingSession", commandFuncRestartCraftingSession); + CommandTable::addCppFunction("extractObject", commandFuncExtractObject); + CommandTable::addCppFunction("repair", commandFuncRepair); + CommandTable::addCppFunction("factoryCrateSplit", commandFuncFactoryCrateSplit); // misc - CommandTable::addCppFunction("showDanceVisuals", commandFuncShowDanceVisuals); - CommandTable::addCppFunction("showMusicianVisuals", commandFuncShowMusicianVisuals); - CommandTable::addCppFunction("placeStructure", commandFuncPlaceStructure); - CommandTable::addCppFunction("getAttributes", commandFuncGetAttributes); - CommandTable::addCppFunction("getAttributesBatch", commandFuncGetAttributesBatch); - CommandTable::addCppFunction("sitServer", commandFuncSitServer); - CommandTable::addCppFunction("jumpServer", commandFuncJumpServer); - CommandTable::addCppFunction("purchaseTicket", commandFuncPurchaseTicket); - CommandTable::addCppFunction("addFriend", commandFuncAddFriend); - CommandTable::addCppFunction("removeFriend", commandFuncRemoveFriend); - CommandTable::addCppFunction("getFriendList", commandFuncGetFriendList); - CommandTable::addCppFunction("addIgnore", commandFuncAddIgnore); - CommandTable::addCppFunction("removeIgnore", commandFuncRemoveIgnore); - CommandTable::addCppFunction("getIgnoreList", commandFuncGetIgnoreList); - CommandTable::addCppFunction("requestBiography", commandFuncRequestBiography); - CommandTable::addCppFunction("setBiography", commandFuncSetBiography); + CommandTable::addCppFunction("showDanceVisuals", commandFuncShowDanceVisuals); + CommandTable::addCppFunction("showMusicianVisuals", commandFuncShowMusicianVisuals); + CommandTable::addCppFunction("placeStructure", commandFuncPlaceStructure); + CommandTable::addCppFunction("getAttributes", commandFuncGetAttributes); + CommandTable::addCppFunction("getAttributesBatch", commandFuncGetAttributesBatch); + CommandTable::addCppFunction("sitServer", commandFuncSitServer); + CommandTable::addCppFunction("jumpServer", commandFuncJumpServer); + CommandTable::addCppFunction("purchaseTicket", commandFuncPurchaseTicket); + CommandTable::addCppFunction("addFriend", commandFuncAddFriend); + CommandTable::addCppFunction("removeFriend", commandFuncRemoveFriend); + CommandTable::addCppFunction("getFriendList", commandFuncGetFriendList); + CommandTable::addCppFunction("addIgnore", commandFuncAddIgnore); + CommandTable::addCppFunction("removeIgnore", commandFuncRemoveIgnore); + CommandTable::addCppFunction("getIgnoreList", commandFuncGetIgnoreList); + CommandTable::addCppFunction("requestBiography", commandFuncRequestBiography); + CommandTable::addCppFunction("setBiography", commandFuncSetBiography); CommandTable::addCppFunction("requestWaypointAtPosition", commandFuncRequestWaypointAtPosition); - CommandTable::addCppFunction("serverDestroyObject", commandFuncServerDestroyObject); - CommandTable::addCppFunction("setSpokenLanguage", commandFuncSetSpokenLanguage); - CommandTable::addCppFunction("applyPowerup", commandFuncApplyPowerup); - CommandTable::addCppFunction("report", commandFuncReport); - CommandTable::addCppFunction("resetCooldowns", commandFuncResetCooldowns); - CommandTable::addCppFunction("spewCommandQueue", commandFuncSpewCommandQueue); - CommandTable::addCppFunction("locateStructure", commandFuncLocateStructure); - CommandTable::addCppFunction("locateVendor", commandFuncLocateVendor); - CommandTable::addCppFunction("showCtsHistory", commandFuncShowCtsHistory); + CommandTable::addCppFunction("serverDestroyObject", commandFuncServerDestroyObject); + CommandTable::addCppFunction("setSpokenLanguage", commandFuncSetSpokenLanguage); + CommandTable::addCppFunction("applyPowerup", commandFuncApplyPowerup); + CommandTable::addCppFunction("report", commandFuncReport); + CommandTable::addCppFunction("resetCooldowns", commandFuncResetCooldowns); + CommandTable::addCppFunction("spewCommandQueue", commandFuncSpewCommandQueue); + CommandTable::addCppFunction("locateStructure", commandFuncLocateStructure); + CommandTable::addCppFunction("locateVendor", commandFuncLocateVendor); + CommandTable::addCppFunction("showCtsHistory", commandFuncShowCtsHistory); CommandTable::addCppFunction("pickupAllRoomItemsIntoInventory", commandFuncPickupAllRoomItemsIntoInventory); CommandTable::addCppFunction("dropAllInventoryItemsIntoRoom", commandFuncDropAllInventoryItemsIntoRoom); - CommandTable::addCppFunction("saveDecorationLayout", commandFuncSaveDecorationLayout); - CommandTable::addCppFunction("restoreDecorationLayout", commandFuncRestoreDecorationLayout); - CommandTable::addCppFunction("areaPickRandomPlayer", commandFuncAreaPickRandomPlayer); - CommandTable::addCppFunction("roomPickRandomPlayer", commandFuncRoomPickRandomPlayer); + CommandTable::addCppFunction("saveDecorationLayout", commandFuncSaveDecorationLayout); + CommandTable::addCppFunction("restoreDecorationLayout", commandFuncRestoreDecorationLayout); + CommandTable::addCppFunction("areaPickRandomPlayer", commandFuncAreaPickRandomPlayer); + CommandTable::addCppFunction("roomPickRandomPlayer", commandFuncRoomPickRandomPlayer); // match making - CommandTable::addCppFunction("setMatchMakingPersonalId", commandFuncSetMatchMakingPersonalId); + CommandTable::addCppFunction("setMatchMakingPersonalId", commandFuncSetMatchMakingPersonalId); CommandTable::addCppFunction("setMatchMakingCharacterId", commandFuncSetMatchMakingCharacterId); - CommandTable::addCppFunction("requestCharacterMatch", commandFuncRequestCharacterMatch); + CommandTable::addCppFunction("requestCharacterMatch", commandFuncRequestCharacterMatch); CommandTable::addCppFunction("toggleSearchableByCtsSourceGalaxy", commandFuncToggleSearchableByCtsSourceGalaxy); CommandTable::addCppFunction("toggleDisplayLocationInSearchResults", commandFuncToggleDisplayLocationInSearchResults); - CommandTable::addCppFunction("toggleAnonymous", commandFuncToggleAnonymous); - CommandTable::addCppFunction("toggleHelper", commandFuncToggleHelper); - CommandTable::addCppFunction("toggleRolePlay", commandFuncToggleRolePlay); - CommandTable::addCppFunction("toggleLookingForGroup", commandFuncToggleLookingForGroup); - CommandTable::addCppFunction("toggleAwayFromKeyBoard", commandFuncToggleAwayFromKeyBoard); + CommandTable::addCppFunction("toggleAnonymous", commandFuncToggleAnonymous); + CommandTable::addCppFunction("toggleHelper", commandFuncToggleHelper); + CommandTable::addCppFunction("toggleRolePlay", commandFuncToggleRolePlay); + CommandTable::addCppFunction("toggleLookingForGroup", commandFuncToggleLookingForGroup); + CommandTable::addCppFunction("toggleAwayFromKeyBoard", commandFuncToggleAwayFromKeyBoard); CommandTable::addCppFunction("toggleDisplayingFactionRank", commandFuncToggleDisplayingFactionRank); - CommandTable::addCppFunction("toggleOutOfCharacter", commandFuncToggleOutOfCharacter); - CommandTable::addCppFunction("toggleLookingForWork", commandFuncToggleLookingForWork); + CommandTable::addCppFunction("toggleOutOfCharacter", commandFuncToggleOutOfCharacter); + CommandTable::addCppFunction("toggleLookingForWork", commandFuncToggleLookingForWork); //skill - CommandTable::addCppFunction("revokeSkill", commandFuncRevokeSkill); - CommandTable::addCppFunction("setCurrentSkillTitle", commandFuncSetCurrentSkillTitle); + CommandTable::addCppFunction("revokeSkill", commandFuncRevokeSkill); + CommandTable::addCppFunction("setCurrentSkillTitle", commandFuncSetCurrentSkillTitle); //misc ui - CommandTable::addCppFunction("permissionListModify", commandFuncPermissionListModify); - CommandTable::addCppFunction("requestCharacterSheetInfo", commandFuncRequestCharacterSheetInfo); - CommandTable::addCppFunction("removeBuff", commandFuncRemoveBuff); + CommandTable::addCppFunction("permissionListModify", commandFuncPermissionListModify); + CommandTable::addCppFunction("requestCharacterSheetInfo", commandFuncRequestCharacterSheetInfo); + CommandTable::addCppFunction("removeBuff", commandFuncRemoveBuff); // npc conversation - CommandTable::addCppFunction("npcConversationStart", commandFuncNpcConversationStart); - CommandTable::addCppFunction("npcConversationStop", commandFuncNpcConversationStop); + CommandTable::addCppFunction("npcConversationStart", commandFuncNpcConversationStart); + CommandTable::addCppFunction("npcConversationStop", commandFuncNpcConversationStop); CommandTable::addCppFunction("npcConversationSelect", commandFuncNpcConversationSelect); - CommandTable::addCppFunction("handleUnstick", commandFuncUnstick); - CommandTable::addCppFunction("getAccountInfo", commandFuncGetAccountInfo); + CommandTable::addCppFunction("handleUnstick", commandFuncUnstick); + CommandTable::addCppFunction("getAccountInfo", commandFuncGetAccountInfo); CommandTable::addCppFunction("lag", commandFuncLag); //knowledgebase (i.e. holocron) @@ -9809,8 +9781,8 @@ void CommandCppFuncs::install() CommandTable::addCppFunction("associateDroidControlDeviceWithShip", commandFuncAssociateDroidControlDeviceWithShip); CommandTable::addCppFunction("unassociateDroidControlDeviceWithShip", commandFuncAssociateDroidControlDeviceWithShip); - CommandTable::addCppFunction("serverAsteroidDataListen" , commandFuncServerAsteroidDataListen); - CommandTable::addCppFunction("serverAsteroidDataStopListening", commandFuncServerAsteroidDataStopListening); + CommandTable::addCppFunction("serverAsteroidDataListen", commandFuncServerAsteroidDataListen); + CommandTable::addCppFunction("serverAsteroidDataStopListening", commandFuncServerAsteroidDataStopListening); CommandTable::addCppFunction("boosterOn", commandFuncBoosterOn); CommandTable::addCppFunction("boosterOff", commandFuncBoosterOff); @@ -9824,7 +9796,7 @@ void CommandCppFuncs::install() CommandTable::addCppFunction("abandonQuest", commandFuncAbandonQuest); // exchange - CommandTable::addCppFunction("exchangeListCredits", commandFuncExchangeListCredits); + CommandTable::addCppFunction("exchangeListCredits", commandFuncExchangeListCredits); // squelch CommandTable::addCppFunction("squelch", commandFuncSquelch); @@ -9850,4 +9822,4 @@ void CommandCppFuncs::remove() { } -// ====================================================================== +// ====================================================================== \ No newline at end of file diff --git a/engine/server/library/serverGame/src/shared/command/CommandQueueEntry.cpp b/engine/server/library/serverGame/src/shared/command/CommandQueueEntry.cpp index 4473f70f..b13330b9 100755 --- a/engine/server/library/serverGame/src/shared/command/CommandQueueEntry.cpp +++ b/engine/server/library/serverGame/src/shared/command/CommandQueueEntry.cpp @@ -6,7 +6,6 @@ // // ====================================================================== - #include "serverGame/FirstServerGame.h" #include "serverGame/CommandQueueEntry.h" #include "serverGame/CreatureObject.h" @@ -14,15 +13,15 @@ #include "Archive/ByteStream.h" #include "sharedGame/CommandTable.h" - // ====================================================================== CommandQueueEntry::CommandQueueEntry() : - m_command(&CommandTable::getNullCommand ()), + m_command(&CommandTable::getNullCommand()), m_targetId(NetworkId::cms_invalid), m_params(), m_sequenceId(0), - m_clearable(true) + m_clearable(true), + m_priority() { } @@ -35,8 +34,8 @@ CommandQueueEntry::CommandQueueEntry( uint32 sequenceId, bool clearable, Command::Priority priority, - bool autoAttack ) : - + bool autoAttack) : + m_command(&command), m_targetId(targetId), m_params(params), @@ -64,12 +63,12 @@ CommandQueueEntry &CommandQueueEntry::operator=(CommandQueueEntry const &rhs) { if (&rhs != this) { - m_command = rhs.m_command; //lint !e1555 - m_targetId = rhs.m_targetId; - m_params = rhs.m_params; + m_command = rhs.m_command; //lint !e1555 + m_targetId = rhs.m_targetId; + m_params = rhs.m_params; m_sequenceId = rhs.m_sequenceId; - m_clearable = rhs.m_clearable; - m_priority = rhs.m_priority; + m_clearable = rhs.m_clearable; + m_priority = rhs.m_priority; } return *this; } @@ -78,35 +77,30 @@ CommandQueueEntry &CommandQueueEntry::operator=(CommandQueueEntry const &rhs) namespace Archive { + // ---------------------------------------------------------------------- -// ---------------------------------------------------------------------- + void get(ReadIterator &source, CommandQueueEntry &target) + { + uint32 commandHash; -void get(ReadIterator &source, CommandQueueEntry &target) -{ - uint32 commandHash; + Archive::get(source, commandHash); + Archive::get(source, target.m_targetId); + Archive::get(source, target.m_params); + Archive::get(source, target.m_sequenceId); + Archive::get(source, target.m_clearable); + target.m_command = &CommandTable::getCommand(commandHash); + } - Archive::get(source, commandHash); - Archive::get(source, target.m_targetId); - Archive::get(source, target.m_params); - Archive::get(source, target.m_sequenceId); - Archive::get(source, target.m_clearable); - target.m_command = &CommandTable::getCommand(commandHash); -} + // ---------------------------------------------------------------------- -// ---------------------------------------------------------------------- + void put(ByteStream &target, CommandQueueEntry const &source) + { + Archive::put(target, source.m_command->m_commandHash); + Archive::put(target, source.m_targetId); + Archive::put(target, source.m_params); + Archive::put(target, source.m_sequenceId); + Archive::put(target, source.m_clearable); + } -void put(ByteStream &target, CommandQueueEntry const &source) -{ - Archive::put(target, source.m_command->m_commandHash); - Archive::put(target, source.m_targetId); - Archive::put(target, source.m_params); - Archive::put(target, source.m_sequenceId); - Archive::put(target, source.m_clearable); -} - - - -// ---------------------------------------------------------------------- - - -} // namespace Archive + // ---------------------------------------------------------------------- +} // namespace Archive \ No newline at end of file diff --git a/engine/server/library/serverGame/src/shared/controller/AiShipController.cpp b/engine/server/library/serverGame/src/shared/controller/AiShipController.cpp index 3fe9a88f..a08e1ad0 100755 --- a/engine/server/library/serverGame/src/shared/controller/AiShipController.cpp +++ b/engine/server/library/serverGame/src/shared/controller/AiShipController.cpp @@ -136,7 +136,7 @@ AiShipController * AiShipController::asAiShipController(Controller * const contr { ShipController * const shipController = (controller != nullptr) ? controller->asShipController() : nullptr; AiShipController * const aiShipController = (shipController != nullptr) ? shipController->asAiShipController() : nullptr; - + return aiShipController; } @@ -146,7 +146,7 @@ AiShipController const * AiShipController::asAiShipController(Controller const * { ShipController const * const shipController = (controller != nullptr) ? controller->asShipController() : nullptr; AiShipController const * const aiShipController = (shipController != nullptr) ? shipController->asAiShipController() : nullptr; - + return aiShipController; } @@ -253,8 +253,8 @@ float AiShipController::realAlter(float const elapsedTime) #ifdef _DEBUG AiDebugString * aiDebugString = nullptr; - if ( s_spaceAiClientDebugEnabled - && !getShipOwner()->getObservers().empty()) + if (s_spaceAiClientDebugEnabled + && !getShipOwner()->getObservers().empty()) { aiDebugString = new AiDebugString; } @@ -277,8 +277,8 @@ float AiShipController::realAlter(float const elapsedTime) m_pendingDockingBehavior = nullptr; } - if ( (m_dockingBehavior != nullptr) - && (m_dockingBehavior->isDockFinished())) + if ((m_dockingBehavior != nullptr) + && (m_dockingBehavior->isDockFinished())) { delete m_dockingBehavior; m_dockingBehavior = nullptr; @@ -319,8 +319,8 @@ float AiShipController::realAlter(float const elapsedTime) m_dockingBehavior->unDock(); } - if ( isAttackSquadLeader() - || !getAttackSquad().isInFormation()) + if (isAttackSquadLeader() + || !getAttackSquad().isInFormation()) { m_attackBehavior->alter(elapsedTime); @@ -394,8 +394,8 @@ float AiShipController::realAlter(float const elapsedTime) // Check for enemies periodically - if ( !m_enemyCheckQueued - && shouldCheckForEnemies()) + if (!m_enemyCheckQueued + && shouldCheckForEnemies()) { m_enemyCheckQueued = true; ShipAiEnemySearchManager::add(*shipOwner); @@ -435,7 +435,7 @@ float AiShipController::realAlter(float const elapsedTime) { ShipController * const followedUnitShipController = squadLeader->getController()->asShipController(); AiShipController * const followedUnitAiShipController = (followedUnitShipController != nullptr) ? followedUnitShipController->asAiShipController() : nullptr; - + if (followedUnitAiShipController != nullptr) { followedUnitAiShipController->requestSlowDown(); @@ -485,8 +485,8 @@ float AiShipController::realAlter(float const elapsedTime) if (isSquadLeader()) { PROFILER_AUTO_BLOCK_DEFINE("check squadLeader"); - if ( isAttacking() - || !hasFunctionalEngines()) + if (isAttacking() + || !hasFunctionalEngines()) { getSquad().assignNewLeader(); } @@ -508,28 +508,28 @@ float AiShipController::realAlter(float const elapsedTime) PROFILER_AUTO_BLOCK_DEFINE("Manage countermeasures"); switch (m_countermeasureState) { - case CS_reacting: - if (m_reactToMissileTimer->updateZero(elapsedTime)) - m_countermeasureState = CS_launching; - break; + case CS_reacting: + if (m_reactToMissileTimer->updateZero(elapsedTime)) + m_countermeasureState = CS_launching; + break; - case CS_launching: - if (MissileManager::getInstance().isTargetedByMissile(getOwner()->getNetworkId())) + case CS_launching: + if (MissileManager::getInstance().isTargetedByMissile(getOwner()->getNetworkId())) + { + for (int weaponIndex = 0; weaponIndex < ShipChassisSlotType::cms_numWeaponIndices; ++weaponIndex) { - for (int weaponIndex = 0; weaponIndex < ShipChassisSlotType::cms_numWeaponIndices; ++weaponIndex) - { - PROFILER_AUTO_BLOCK_DEFINE("countermeasures missile loop"); - if (NON_NULL(getShipOwner())->isCountermeasure(weaponIndex)) - getShipOwner()->fireShotNonTurretServer(weaponIndex, NetworkId::cms_invalid, ShipChassisSlotType::SCST_invalid); - } + PROFILER_AUTO_BLOCK_DEFINE("countermeasures missile loop"); + if (NON_NULL(getShipOwner())->isCountermeasure(weaponIndex)) + getShipOwner()->fireShotNonTurretServer(weaponIndex, NetworkId::cms_invalid, ShipChassisSlotType::SCST_invalid); } - else - m_countermeasureState = CS_none; - break; - - case CS_none: - default: - break; + } + else + m_countermeasureState = CS_none; + break; + + case CS_none: + default: + break; } } @@ -551,8 +551,8 @@ float AiShipController::realAlter(float const elapsedTime) } #ifdef _DEBUG - if ( (m_attackBehavior != nullptr) - && (aiDebugString != nullptr)) + if ((m_attackBehavior != nullptr) + && (aiDebugString != nullptr)) { PROFILER_AUTO_BLOCK_DEFINE("sendDebugAiToClients"); sendDebugAiToClients(*aiDebugString); @@ -574,9 +574,9 @@ void AiShipController::moveTo(Vector const & position_w, float const throttle, f // If we are not following a unit, see if we need to slow down for someone - if ( (m_nonAttackBehavior != nullptr) - && (m_nonAttackBehavior->getBehaviorType() != ASBT_follow) - && m_requestedSlowDown + if ((m_nonAttackBehavior != nullptr) + && (m_nonAttackBehavior->getBehaviorType() != ASBT_follow) + && m_requestedSlowDown && !isAttacking()) { slowDown = true; @@ -599,7 +599,7 @@ void AiShipController::moveTo(Vector const & position_w, float const throttle, f Vector resultAvoidancePosition_w; Vector const & shipVelocity = getShipOwner()->getCurrentVelocity_p(); - + if (SpaceAvoidanceManager::getAvoidancePosition(*getOwner(), shipVelocity, position_w, resultAvoidancePosition_w)) { IGNORE_RETURN(face(resultAvoidancePosition_w, deltaTime)); @@ -649,7 +649,7 @@ bool AiShipController::addDamageTaken(NetworkId const & attackingUnit, float con { CreatureObject const * const attackingPilotCreatureObject = attackingShipObject->getPilot(); - if ( (attackingPilotCreatureObject != nullptr) + if ((attackingPilotCreatureObject != nullptr) && attackingPilotCreatureObject->isPlayerControlled()) { GroupObject * const groupObject = attackingPilotCreatureObject->getGroup(); @@ -760,7 +760,7 @@ void AiShipController::follow(NetworkId const & followedUnit, Vector const & dir CollisionProperty const * const ownerCollisionProperty = getOwner()->getCollisionProperty(); CollisionProperty const * const followedObjectCollisionProperty = followedObject->getCollisionProperty(); - + if (ownerCollisionProperty != nullptr) { appearanceRadius += ownerCollisionProperty->getBoundingSphere_l().getRadius(); @@ -768,7 +768,7 @@ void AiShipController::follow(NetworkId const & followedUnit, Vector const & dir if (followedObjectCollisionProperty != nullptr) { - appearanceRadius += followedObjectCollisionProperty ->getBoundingSphere_l().getRadius(); + appearanceRadius += followedObjectCollisionProperty->getBoundingSphere_l().getRadius(); } } @@ -790,7 +790,7 @@ int AiShipController::getBehaviorType() const { result = m_nonAttackBehavior->getBehaviorType(); } - + LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipController::getBehaviorType() owner(%s) behavior(%s)", getOwner()->getNetworkId().getValueString().c_str(), AiShipBehaviorBase::getBehaviorString(static_cast(result)))); return static_cast(result); @@ -831,7 +831,7 @@ void AiShipController::track(Object const & target) void AiShipController::moveTo(SpacePath * const path) { LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipController::moveTo() owner(%s) path(0x%p)", getOwner()->getNetworkId().getValueString().c_str(), path)); - + if (path != m_path) { SpacePathManager::release(m_path, getOwner()); @@ -959,7 +959,7 @@ void AiShipController::setPilotType(std::string const & pilotType) if (pilotType.empty()) { - DEBUG_WARNING(true, ("AiShipController::setPilotType empty pilotType for ship [%s]", + DEBUG_WARNING(true, ("AiShipController::setPilotType empty pilotType for ship [%s]", shipObject ? shipObject->getDebugInformation().c_str() : "NONE")); return; } @@ -992,23 +992,23 @@ void AiShipController::setPilotType(std::string const & pilotType) switch (m_shipClass) { - case ShipAiReactionManager::SC_invalid: - default: { FATAL(true, ("Invalid ship name(%s)", m_shipName.getString())); } - case ShipAiReactionManager::SC_fighter: { m_attackBehavior = new AiShipBehaviorAttackFighter(*this); } break; - case ShipAiReactionManager::SC_bomber: { m_attackBehavior = new AiShipBehaviorAttackBomber(*this); } break; - case ShipAiReactionManager::SC_capitalShip: { m_attackBehavior = new AiShipBehaviorAttackCapitalShip(*this); } break; - case ShipAiReactionManager::SC_transport: { m_attackBehavior = new AiShipBehaviorAttackFighter(*this); } break; + case ShipAiReactionManager::SC_invalid: + default: { FATAL(true, ("Invalid ship name(%s)", m_shipName.getString())); } + case ShipAiReactionManager::SC_fighter: { m_attackBehavior = new AiShipBehaviorAttackFighter(*this); } break; + case ShipAiReactionManager::SC_bomber: { m_attackBehavior = new AiShipBehaviorAttackBomber(*this); } break; + case ShipAiReactionManager::SC_capitalShip: { m_attackBehavior = new AiShipBehaviorAttackCapitalShip(*this); } break; + case ShipAiReactionManager::SC_transport: { m_attackBehavior = new AiShipBehaviorAttackFighter(*this); } break; } // Create the turreting target system, if appropriate - + if (shipObject && shipObject->hasTurrets()) addTurretTargetingSystem(new AiShipTurretTargetingSystem(*this)); // Set the default aggro distance setAggroRadius(m_pilotData->m_aggroRadius); - + FATAL((m_attackBehavior == nullptr), ("The attack behavior can not be nullptr.")); } @@ -1097,8 +1097,8 @@ void AiShipController::setSquad(SpaceSquad * const squad) { // Remove the unit from its previous squad - if ( (m_squad != nullptr) - && !m_squad->isEmpty()) + if ((m_squad != nullptr) + && !m_squad->isEmpty()) { m_squad->removeUnit(getOwner()->getNetworkId()); } @@ -1209,7 +1209,7 @@ float AiShipController::getShipRadius() const float result = 1.0f; ShipObject const * const shipObject = getShipOwner(); CollisionProperty const * const shipCollision = shipObject->getCollisionProperty(); - + if (shipCollision != nullptr) { result = shipCollision->getBoundingSphere_l().getRadius(); @@ -1280,7 +1280,7 @@ bool AiShipController::shouldCheckForEnemies() const } } } - + return result; } @@ -1290,8 +1290,8 @@ void AiShipController::setCurrentPathIndex(unsigned int const index) { //LOGC(ConfigServerGame::isSpaceAiLoggingEnabled(), "debug_ai", ("AiShipController::setCurrentPathIndex() unit(%s) pathIndex(%u) pathSize(%u)", getOwner()->getNetworkId().getValueString().c_str(), index, (m_path != nullptr) ? m_path->getTransformList().size() : 0)); - if ( (m_path != nullptr) - && !m_path->isEmpty()) + if ((m_path != nullptr) + && !m_path->isEmpty()) { m_currentPathIndex = index; } @@ -1314,21 +1314,21 @@ unsigned int AiShipController::getCurrentPathIndex() const float AiShipController::calculateThrottleToPosition_w(Vector const & position_w, float const slowDownDistance) const { float result = 0.0f; - + Object const * const object = getOwner(); if (object != nullptr) { float const distanceToGoalSquared = object->getPosition_w().magnitudeBetweenSquared(position_w); - if ( (distanceToGoalSquared < sqr(slowDownDistance)) + if ((distanceToGoalSquared < sqr(slowDownDistance)) && (slowDownDistance > 0.0f)) { static float scale = 0.5f; float const distanceToGoal = sqrt(distanceToGoalSquared); result = clamp(0.0f, (distanceToGoal / slowDownDistance) * scale, 1.0f); - if ( (result < 0.5f) + if ((result < 0.5f) && (distanceToGoal < getGoalStopDistance())) { result = 0.0f; @@ -1397,7 +1397,7 @@ float AiShipController::getPilotAggression() const */ void AiShipController::switchToFighterAttack() { - DEBUG_FATAL(dynamic_cast(m_attackBehavior),("Programmer bug: called switchToFighterAttack() when already using a fighter attack")); + DEBUG_FATAL(dynamic_cast(m_attackBehavior), ("Programmer bug: called switchToFighterAttack() when already using a fighter attack")); delete m_pendingAttackBehavior; // in case we tried to switch twice m_pendingAttackBehavior = new AiShipBehaviorAttackFighter(*NON_NULL(m_attackBehavior)); } @@ -1410,7 +1410,7 @@ void AiShipController::switchToFighterAttack() */ void AiShipController::switchToBomberAttack() { - DEBUG_FATAL(dynamic_cast(m_attackBehavior),("Programmer bug: called switchToBomberAttack() when already using a bomber attack")); + DEBUG_FATAL(dynamic_cast(m_attackBehavior), ("Programmer bug: called switchToBomberAttack() when already using a bomber attack")); delete m_pendingAttackBehavior; // in case we tried to switch twice m_pendingAttackBehavior = new AiShipBehaviorAttackBomber(*NON_NULL(m_attackBehavior)); } @@ -1496,8 +1496,8 @@ void AiShipController::onAttackTargetListEmpty() SpaceSquad::SpaceSquadList const & guardedByList = getSquad().getGuardedByList(); - if ( !guardedByList.empty() - && getSquad().isAttackTargetListEmpty()) + if (!guardedByList.empty() + && getSquad().isAttackTargetListEmpty()) { SpaceSquad::SpaceSquadList::const_iterator iterGuardedByList = guardedByList.begin(); @@ -1561,7 +1561,7 @@ void AiShipController::sendDebugAiToClients(AiDebugString & aiDebugString) // // aiDebugString.addText(guardString, PackedRgb::solidYellow); //} - + // Are my engines functional? if (!shipOwner->isComponentFunctional(ShipChassisSlotType::SCST_engine)) @@ -1651,14 +1651,14 @@ void AiShipController::sendDebugAiToClients(AiDebugString & aiDebugString) aiDebugString.addText(formattedString.sprintf("turret miss(%.0f%% @ %.0f)\n", turretMissChance, turretMissAngleDegrees)); } } - + //int ammoCurrent = 0; //int ammoMax = 0; // //for (int chassisSlot = ShipChassisSlotType::SCST_weapon_first; chassisSlot < ShipChassisSlotType::SCST_weapon_last; ++chassisSlot) //{ // int const weaponIndex = ShipChassisSlotType::getWeaponIndex(chassisSlot); - // + // // if (parentShipObject->isMissile(weaponIndex)) // { // ammoCurrent += parentShipObject->getWeaponAmmoCurrent(static_cast(chassisSlot)); @@ -1687,14 +1687,14 @@ void AiShipController::sendDebugAiToClients(AiDebugString & aiDebugString) // Only send to the client if the objvar is set int temp = 0; - if ( (characterObject != nullptr) - && characterObject->getObjVars().getItem("ai_debug_string", temp)) + if ((characterObject != nullptr) + && characterObject->getObjVars().getItem("ai_debug_string", temp)) { if (temp > 0) { bool const reliable = true; GenericValueTypeMessage > message("AiDebugString", std::make_pair(getOwner()->getNetworkId(), finalString)); - + client->send(message, reliable); } } @@ -1714,7 +1714,7 @@ bool AiShipController::debug_forceFighterAttackManeuver(int const maneuverType) { aiFighterBehavior->debug_forceManeuver(maneuverType); success = true; - } + } return success; } @@ -1741,11 +1741,11 @@ char const * AiShipController::getAttackOrdersString(AttackOrders const attackOr { switch (attackOrders) { - case AO_holdFire: { return "HOLD FIRE"; } - case AO_returnFire: { return "RETURN FIRE"; } - case AO_attackFreely: { return "ATTACK FREELY"; } - case AO_count: - default: break; + case AO_holdFire: { return "HOLD FIRE"; } + case AO_returnFire: { return "RETURN FIRE"; } + case AO_attackFreely: { return "ATTACK FREELY"; } + case AO_count: + default: break; } return "INVALID ATTACK ORDER"; @@ -1771,8 +1771,8 @@ void AiShipController::addExclusiveAggro(NetworkId const & unit) ServerObject * const unitServerObject = (unitObject != nullptr) ? unitObject->asServerObject() : nullptr; CreatureObject * const unitCreatureObject = (unitServerObject != nullptr) ? unitServerObject->asCreatureObject() : nullptr; - if ( !unitCreatureObject - || !unitCreatureObject->isPlayerControlled()) + if (!unitCreatureObject + || !unitCreatureObject->isPlayerControlled()) { DEBUG_WARNING(true, ("debug_ai: AiShipController::addExclusiveAggro() owner(%s) ERROR: The unit(%s) must be a player.", getOwner()->getDebugInformation().c_str(), unit.getValueString().c_str())); return; @@ -1922,4 +1922,4 @@ float AiShipController::getTurretMissAngle() const return m_pilotData->m_turretMissAngle; } -// ====================================================================== +// ====================================================================== \ No newline at end of file diff --git a/engine/server/library/serverGame/src/shared/controller/CellController.cpp b/engine/server/library/serverGame/src/shared/controller/CellController.cpp index 7737ee55..7b8366f8 100755 --- a/engine/server/library/serverGame/src/shared/controller/CellController.cpp +++ b/engine/server/library/serverGame/src/shared/controller/CellController.cpp @@ -1,5 +1,5 @@ // CellController.cpp -// Copyright 2000-02, Sony Online Entertainment Inc., all rights reserved. +// Copyright 2000-02, Sony Online Entertainment Inc., all rights reserved. // Author: Justin Randall //----------------------------------------------------------------------- @@ -12,7 +12,7 @@ //----------------------------------------------------------------------- CellController::CellController(CellObject * newOwner) : -ServerController(newOwner) + ServerController(newOwner) { } @@ -24,50 +24,49 @@ CellController::~CellController() //----------------------------------------------------------------------- - -void CellController::handleMessage (int message, float value, const MessageQueue::Data* data, uint32 flags) +void CellController::handleMessage(int message, float value, const MessageQueue::Data* data, uint32 flags) { CellObject * owner = dynamic_cast(getOwner()); NOT_NULL(owner); - + switch (message) { case CM_addAllowed: + { + const MessageQueueGenericValueType * const msg = safe_cast *>(data); + if (msg) { - const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if(msg) - { - owner->addAllowed(msg->getValue()); - } + owner->addAllowed(msg->getValue()); } - break; + } + break; case CM_removeAllowed: + { + const MessageQueueGenericValueType * const msg = safe_cast *>(data); + if (msg) { - const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if(msg) - { - owner->removeAllowed(msg->getValue()); - } + owner->removeAllowed(msg->getValue()); } - break; + } + break; case CM_addBanned: + { + const MessageQueueGenericValueType * const msg = safe_cast *>(data); + if (msg) { - const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if(msg) - { - owner->addBanned(msg->getValue()); - } + owner->addBanned(msg->getValue()); } - break; + } + break; case CM_removeBanned: + { + const MessageQueueGenericValueType * const msg = safe_cast *>(data); + if (msg) { - const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if(msg) - { - owner->removeBanned(msg->getValue()); - } + owner->removeBanned(msg->getValue()); } - break; + } + break; default: ServerController::handleMessage(message, value, data, flags); break; @@ -76,9 +75,9 @@ void CellController::handleMessage (int message, float value, const MessageQueue //----------------------------------------------------------------------- -void CellController::setGoal(Transform const & , ServerObject * ) +void CellController::setGoal(Transform const &, ServerObject *, bool teleport = false) { - DEBUG_WARNING(true, ("Cell setGoal was called for CellObject %s. Cells may not have goals!",getOwner()->getNetworkId().getValueString().c_str())); + DEBUG_WARNING(true, ("Cell setGoal was called for CellObject %s. Cells may not have goals!", getOwner()->getNetworkId().getValueString().c_str())); } -//----------------------------------------------------------------------- +//----------------------------------------------------------------------- \ No newline at end of file diff --git a/engine/server/library/serverGame/src/shared/controller/CellController.h b/engine/server/library/serverGame/src/shared/controller/CellController.h index 996e4f99..533a6179 100755 --- a/engine/server/library/serverGame/src/shared/controller/CellController.h +++ b/engine/server/library/serverGame/src/shared/controller/CellController.h @@ -1,5 +1,5 @@ // CellController.h -// Copyright 2000-02, Sony Online Entertainment Inc., all rights reserved. +// Copyright 2000-02, Sony Online Entertainment Inc., all rights reserved. // Author: Justin Randall #ifndef _INCLUDED_CellController_H @@ -20,13 +20,12 @@ public: ~CellController(); protected: - virtual void handleMessage (int message, float value, const MessageQueue::Data* data, uint32 flags); - virtual void setGoal (Transform const & newGoal, ServerObject * goalCellObject ); - + virtual void handleMessage(int message, float value, const MessageQueue::Data* data, uint32 flags); + virtual void setGoal(Transform const & newGoal, ServerObject * goalCellObject, bool teleport); + private: CellController & operator = (const CellController & rhs); CellController(const CellController & source); - }; //----------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/controller/CreatureController.cpp b/engine/server/library/serverGame/src/shared/controller/CreatureController.cpp index f25d0fb1..e0563d26 100755 --- a/engine/server/library/serverGame/src/shared/controller/CreatureController.cpp +++ b/engine/server/library/serverGame/src/shared/controller/CreatureController.cpp @@ -82,13 +82,12 @@ #include "Unicode.h" #include "UnicodeUtils.h" - //----------------------------------------------------------------------- -namespace CreatureControllerNamespace +namespace CreatureControllerNamespace { template - ObjectType & getOwner(Controller * controller) + ObjectType & getOwner(Controller * controller) { NOT_NULL(controller); NOT_NULL(controller->getOwner()); @@ -119,705 +118,703 @@ CreatureController::~CreatureController() //----------------------------------------------------------------------- -void CreatureController::handleMessage (const int message, const float value, const MessageQueue::Data* const data, const uint32 flags) +void CreatureController::handleMessage(const int message, const float value, const MessageQueue::Data* const data, const uint32 flags) { CreatureObject * const owner = static_cast(getOwner()); DEBUG_FATAL(!owner, ("Owner is nullptr in CreatureController::handleMessage\n")); - switch(message) + switch (message) { case CM_netUpdateTransform: + { + // if the auth server sent this to us, forward it to clients + const MessageQueueDataTransform * const msg = NON_NULL(dynamic_cast(data)); + owner->setLookAtYaw(msg->getLookAtYaw(), msg->getUseLookAtYaw()); + if (flags&GameControllerMessageFlags::SOURCE_REMOTE_SERVER) { - // if the auth server sent this to us, forward it to clients - const MessageQueueDataTransform * const msg = NON_NULL (dynamic_cast(data)); - owner->setLookAtYaw(msg->getLookAtYaw(), msg->getUseLookAtYaw()); - if (flags&GameControllerMessageFlags::SOURCE_REMOTE_SERVER) + // If we're not contained by what we are attached to, then transform + // updates are not relevant to clients because our position is + // dictated purely by our containing object. + if (owner->getAttachedTo() == ContainerInterface::getContainedByObject(*owner)) { - // If we're not contained by what we are attached to, then transform - // updates are not relevant to clients because our position is - // dictated purely by our containing object. - if (owner->getAttachedTo() == ContainerInterface::getContainedByObject(*owner)) - { - UpdateTransformMessage utm(owner->getNetworkId(), msg->getSequenceNumber(), msg->getTransform(), static_cast(msg->getSpeed()), msg->getLookAtYaw(), msg->getUseLookAtYaw()); - owner->sendToClientsInUpdateRange(utm, flags & GameControllerMessageFlags::RELIABLE, false); - } + UpdateTransformMessage utm(owner->getNetworkId(), msg->getSequenceNumber(), msg->getTransform(), static_cast(msg->getSpeed()), msg->getLookAtYaw(), msg->getUseLookAtYaw()); + owner->sendToClientsInUpdateRange(utm, flags & GameControllerMessageFlags::RELIABLE, false); } - TangibleController::handleMessage(message, value, data, flags); } - break; + TangibleController::handleMessage(message, value, data, flags); + } + break; case CM_netUpdateTransformWithParent: + { + // if the auth server sent this to us, forward it to clients + const MessageQueueDataTransformWithParent * const msg = NON_NULL(dynamic_cast(data)); + owner->setLookAtYaw(msg->getLookAtYaw(), msg->getUseLookAtYaw()); + if (flags&GameControllerMessageFlags::SOURCE_REMOTE_SERVER) { - // if the auth server sent this to us, forward it to clients - const MessageQueueDataTransformWithParent * const msg = NON_NULL (dynamic_cast(data)); - owner->setLookAtYaw(msg->getLookAtYaw(), msg->getUseLookAtYaw()); - if (flags&GameControllerMessageFlags::SOURCE_REMOTE_SERVER) + // If we're not contained by what we are attached to, then transform + // updates are not relevant to clients because our position is + // dictated purely by our containing object. + if (owner->getAttachedTo() == ContainerInterface::getContainedByObject(*owner)) { - // If we're not contained by what we are attached to, then transform - // updates are not relevant to clients because our position is - // dictated purely by our containing object. - if (owner->getAttachedTo() == ContainerInterface::getContainedByObject(*owner)) - { - UpdateTransformWithParentMessage utm(owner->getNetworkId(), msg->getSequenceNumber(), msg->getParent(), msg->getTransform(), static_cast(msg->getSpeed()), msg->getLookAtYaw(), msg->getUseLookAtYaw()); - owner->sendToClientsInUpdateRange(utm, flags & GameControllerMessageFlags::RELIABLE, false); - } + UpdateTransformWithParentMessage utm(owner->getNetworkId(), msg->getSequenceNumber(), msg->getParent(), msg->getTransform(), static_cast(msg->getSpeed()), msg->getLookAtYaw(), msg->getUseLookAtYaw()); + owner->sendToClientsInUpdateRange(utm, flags & GameControllerMessageFlags::RELIABLE, false); } - TangibleController::handleMessage(message, value, data, flags); } - break; - + TangibleController::handleMessage(message, value, data, flags); + } + break; + case CM_clientResourceHarvesterActivate: - { - const MessageQueueNetworkId * const msg = NON_NULL (dynamic_cast(data)); - - InstallationObject * const harvester = dynamic_cast(ServerWorld::findObjectByNetworkId (msg->getNetworkId ())); - - UNREF (harvester); - - if (harvester && harvester->isOnAdminList(*owner)) - harvester->activate (owner->getNetworkId()); - } - break; - + { + const MessageQueueNetworkId * const msg = NON_NULL(dynamic_cast(data)); + + InstallationObject * const harvester = dynamic_cast(ServerWorld::findObjectByNetworkId(msg->getNetworkId())); + + UNREF(harvester); + + if (harvester && harvester->isOnAdminList(*owner)) + harvester->activate(owner->getNetworkId()); + } + break; + case CM_clientResourceHarvesterDeactivate: - { - const MessageQueueNetworkId * const msg = NON_NULL (dynamic_cast(data)); - - InstallationObject * const harvester = dynamic_cast(ServerWorld::findObjectByNetworkId (msg->getNetworkId ())); - - if (harvester && harvester->isOnAdminList(*owner)) - harvester->deactivate (); - } - break; - + { + const MessageQueueNetworkId * const msg = NON_NULL(dynamic_cast(data)); + + InstallationObject * const harvester = dynamic_cast(ServerWorld::findObjectByNetworkId(msg->getNetworkId())); + + if (harvester && harvester->isOnAdminList(*owner)) + harvester->deactivate(); + } + break; + case CM_clientResourceHarvesterListen: - { - const MessageQueueNetworkId * const msg = NON_NULL (dynamic_cast(data)); - - HarvesterInstallationObject * const harvester = dynamic_cast(ServerWorld::findObjectByNetworkId (msg->getNetworkId ())); - - if (harvester && owner) - harvester->addSynchronizedUiClient (*owner); - } - break; - + { + const MessageQueueNetworkId * const msg = NON_NULL(dynamic_cast(data)); + + HarvesterInstallationObject * const harvester = dynamic_cast(ServerWorld::findObjectByNetworkId(msg->getNetworkId())); + + if (harvester && owner) + harvester->addSynchronizedUiClient(*owner); + } + break; + case CM_clientResourceHarvesterStopListening: - { - const MessageQueueNetworkId * const msg = NON_NULL (dynamic_cast(data)); - - HarvesterInstallationObject * const harvester = dynamic_cast(ServerWorld::findObjectByNetworkId (msg->getNetworkId ())); - - if (harvester && owner) - harvester->removeSynchronizedUiClient (owner->getNetworkId ()); - } - break; - + { + const MessageQueueNetworkId * const msg = NON_NULL(dynamic_cast(data)); + + HarvesterInstallationObject * const harvester = dynamic_cast(ServerWorld::findObjectByNetworkId(msg->getNetworkId())); + + if (harvester && owner) + harvester->removeSynchronizedUiClient(owner->getNetworkId()); + } + break; + case CM_clientResourceHarvesterResourceSelect: - { - const MessageQueueNetworkIdPair * const msg = NON_NULL (dynamic_cast(data)); - - HarvesterInstallationObject * const harvester = dynamic_cast(ServerWorld::findObjectByNetworkId (msg->getFirstNetworkId ())); - - harvester->selectResource (msg->getSecondNetworkId (), owner->getNetworkId()); - } - break; - + { + const MessageQueueNetworkIdPair * const msg = NON_NULL(dynamic_cast(data)); + + HarvesterInstallationObject * const harvester = dynamic_cast(ServerWorld::findObjectByNetworkId(msg->getFirstNetworkId())); + + harvester->selectResource(msg->getSecondNetworkId(), owner->getNetworkId()); + } + break; + case CM_clientResourceHarvesterGetResourceData: + { + const MessageQueueNetworkId * const msg = NON_NULL(dynamic_cast(data)); + + typedef stdvector::fwd DataVector; + DataVector dv; + + HarvesterInstallationObject * const harvester = dynamic_cast(ServerWorld::findObjectByNetworkId(msg->getNetworkId())); + ServerObject * const player = owner; + + if (harvester && player) { - const MessageQueueNetworkId * const msg = NON_NULL (dynamic_cast(data)); - - typedef stdvector::fwd DataVector; - DataVector dv; - - HarvesterInstallationObject * const harvester = dynamic_cast(ServerWorld::findObjectByNetworkId (msg->getNetworkId ())); - ServerObject * const player = owner; - - if (harvester && player) + harvester->getResourceData(dv); + + if (!dv.empty()) { - harvester->getResourceData (dv); - - if (!dv.empty ()) - { - MessageQueueHarvesterResourceData * const newData = new MessageQueueHarvesterResourceData (msg->getNetworkId (), dv); - appendMessage(static_cast(CM_clientResourceHarvesterResourceData), 0.0f, newData, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_CLIENT); - } + MessageQueueHarvesterResourceData * const newData = new MessageQueueHarvesterResourceData(msg->getNetworkId(), dv); + appendMessage(static_cast(CM_clientResourceHarvesterResourceData), 0.0f, newData, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_CLIENT); } } - break; - + } + break; + case CM_clientResourceHarvesterEmptyHopper: - { - const MessageQueueResourceEmptyHopper * const msg = NON_NULL (dynamic_cast(data)); - - HarvesterInstallationObject * const harvester = dynamic_cast(ServerWorld::findObjectByNetworkId (msg->getHarvesterId ())); - - if (harvester && owner && harvester->isOnHopperList(*owner)) - harvester->emptyHopper (msg->getPlayerId(),msg->getResourceId(), msg->getAmount(),msg->getDiscard(),msg->getSequenceId()); - } - break; + { + const MessageQueueResourceEmptyHopper * const msg = NON_NULL(dynamic_cast(data)); + + HarvesterInstallationObject * const harvester = dynamic_cast(ServerWorld::findObjectByNetworkId(msg->getHarvesterId())); + + if (harvester && owner && harvester->isOnHopperList(*owner)) + harvester->emptyHopper(msg->getPlayerId(), msg->getResourceId(), msg->getAmount(), msg->getDiscard(), msg->getSequenceId()); + } + break; case CM_getTokenForObject: - { - WARNING_STRICT_FATAL(true, ("Received CM_getTokenForObject controller message. This message is depracated")); - } - break; + { + WARNING_STRICT_FATAL(true, ("Received CM_getTokenForObject controller message. This message is depracated")); + } + break; case CM_getWaypointForObject: + { + const MessageQueueNetworkId * const msg = NON_NULL(dynamic_cast(data)); + if (msg) { - const MessageQueueNetworkId * const msg = NON_NULL (dynamic_cast(data)); - if(msg) + if (owner) { - if(owner) + PlayerObject * player = PlayerCreatureController::getPlayerObject(owner); + if (player) { - PlayerObject * player = PlayerCreatureController::getPlayerObject(owner); - if(player) + const ServerObject * target = ServerWorld::findObjectByNetworkId(msg->getNetworkId()); + if (target) { - const ServerObject * target = ServerWorld::findObjectByNetworkId(msg->getNetworkId()); - if(target) + const Object * topMost = ContainerInterface::getFirstParentInWorld(*target); + if (topMost) { - const Object * topMost = ContainerInterface::getFirstParentInWorld(*target); - if(topMost) - { - const Vector pos = topMost->getPosition_w(); - IGNORE_RETURN(player->createWaypoint(Location(pos, NetworkId::cms_invalid, Location::getCrcBySceneName(ServerWorld::getSceneId())), true)); - } + const Vector pos = topMost->getPosition_w(); + IGNORE_RETURN(player->createWaypoint(Location(pos, NetworkId::cms_invalid, Location::getCrcBySceneName(ServerWorld::getSceneId())), true)); } } } } } - break; + } + break; case CM_secureTrade: + { + if (owner->isAuthoritative()) { - if (owner->isAuthoritative()) - { - handleSecureTradeMessage(dynamic_cast(data)); - } - // @todo else - //resend to auth - + handleSecureTradeMessage(dynamic_cast(data)); } - break; + // @todo else + //resend to auth + } + break; case CM_clientLookAtTarget: - { - const MessageQueueNetworkId * const msg = NON_NULL (dynamic_cast(data)); - owner->setLookAtTarget (msg->getNetworkId ()); - } - break; + { + const MessageQueueNetworkId * const msg = NON_NULL(dynamic_cast(data)); + owner->setLookAtTarget(msg->getNetworkId()); + } + break; case CM_clientIntendedTarget: - { - const MessageQueueNetworkId * const msg = NON_NULL (dynamic_cast(data)); - owner->setIntendedTarget (msg->getNetworkId ()); - } - break; + { + const MessageQueueNetworkId * const msg = NON_NULL(dynamic_cast(data)); + owner->setIntendedTarget(msg->getNetworkId()); + } + break; case CM_clientMoodChange: - if (value < 0.0f || value > 255.0f) - WARNING (true, ("Out of range mood: %f", value)); + if (value < 0.0f || value > 255.0f) + WARNING(true, ("Out of range mood: %f", value)); else - owner->setMood (static_cast(value)); - + owner->setMood(static_cast(value)); + break; - + case CM_setState: + { + if (!(flags&GameControllerMessageFlags::SOURCE_REMOTE_CLIENT)) { - if (!(flags&GameControllerMessageFlags::SOURCE_REMOTE_CLIENT)) - { - MessageQueueSetState const *msg = safe_cast(data); - owner->setState(static_cast(msg->getState()), msg->getValue()); - } + MessageQueueSetState const *msg = safe_cast(data); + owner->setState(static_cast(msg->getState()), msg->getValue()); } - break; + } + break; case CM_setAttribute: + { + const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); + if (owner) { - const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); - if(owner) + if (msg) { const std::pair & attributePair = msg->getValue(); - if(msg) - { - owner->setAttribute(attributePair.first, attributePair.second); - } - DEBUG_WARNING(! msg, ("CreatureController (%s:%s) received a CM_setAttribute message but could not retrieve data from the message supplied", owner->getObjectTemplateName(), owner->getNetworkId().getValueString().c_str())); + owner->setAttribute(attributePair.first, attributePair.second); } + DEBUG_WARNING(!msg, ("CreatureController (%s:%s) received a CM_setAttribute message but could not retrieve data from the message supplied", owner->getObjectTemplateName(), owner->getNetworkId().getValueString().c_str())); } - break; + } + break; case CM_setMaxAttribute: + { + const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); + // set the object value and send a message to all it's proxies + if (msg) { - const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); - // set the object value and send a message to all it's proxies - if(msg) - { - owner->setMaxAttribute(msg->getValue().first, msg->getValue().second); - } - DEBUG_WARNING(! msg, ("CreatureController (%s:%s) received a CM_setMaxAttribute message but could not retrieve data from the message supplied", owner->getObjectTemplateName(), owner->getNetworkId().getValueString().c_str())); + owner->setMaxAttribute(msg->getValue().first, msg->getValue().second); } - break; + DEBUG_WARNING(!msg, ("CreatureController (%s:%s) received a CM_setMaxAttribute message but could not retrieve data from the message supplied", owner->getObjectTemplateName(), owner->getNetworkId().getValueString().c_str())); + } + break; case CM_setMentalState: + { + const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); + // set the object value and send a message to all it's proxies + if (msg) { - const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); - // set the object value and send a message to all it's proxies - if(msg) - { - owner->setMentalState(msg->getValue().first, msg->getValue().second); - } - DEBUG_WARNING(! msg, ("CreatureController (%s:%s) received a CM_setMentalState message but could not retrieve data from the message supplied", owner->getObjectTemplateName(), owner->getNetworkId().getValueString().c_str())); + owner->setMentalState(msg->getValue().first, msg->getValue().second); } - break; + DEBUG_WARNING(!msg, ("CreatureController (%s:%s) received a CM_setMentalState message but could not retrieve data from the message supplied", owner->getObjectTemplateName(), owner->getNetworkId().getValueString().c_str())); + } + break; case CM_setMentalStateToward: + { + const MessageQueueGenericValueType > > * const msg = safe_cast > > *>(data); + if (msg) { - const MessageQueueGenericValueType > > * const msg = safe_cast > > *>(data); - if(msg) - { - owner->setMentalStateToward(msg->getValue().first, msg->getValue().second.first, msg->getValue().second.second); - } - DEBUG_WARNING(! msg, ("CreatureController (%s:%s) received a CM_setMentalStateToward message but could not retrieve data from the message supplied", owner->getObjectTemplateName(), owner->getNetworkId().getValueString().c_str())); + owner->setMentalStateToward(msg->getValue().first, msg->getValue().second.first, msg->getValue().second.second); } - break; + DEBUG_WARNING(!msg, ("CreatureController (%s:%s) received a CM_setMentalStateToward message but could not retrieve data from the message supplied", owner->getObjectTemplateName(), owner->getNetworkId().getValueString().c_str())); + } + break; case CM_setCover: + { + const MessageQueueGenericValueType * const msg = safe_cast *>(data); + if (msg) { - const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if(msg) - { - owner->setCover(msg->getValue()); - } - DEBUG_WARNING(! msg, ("CreatureController (%s:%s) received a CM_setCover message but could not retrieve data from the message supplied", owner->getObjectTemplateName(), owner->getNetworkId().getValueString().c_str())); + owner->setCover(msg->getValue()); } - break; + DEBUG_WARNING(!msg, ("CreatureController (%s:%s) received a CM_setCover message but could not retrieve data from the message supplied", owner->getObjectTemplateName(), owner->getNetworkId().getValueString().c_str())); + } + break; case CM_setMentalStateTowardClampBehavior: + { + const MessageQueueGenericValueType > > > * const msg = safe_cast > > > *>(data); + if (msg) { - const MessageQueueGenericValueType > > > * const msg = safe_cast > > > *>(data); - if(msg) - { - owner->setMentalStateTowardClampBehavior( - msg->getValue().first, - msg->getValue().second.first, - msg->getValue().second.second.first, - msg->getValue().second.second.second); - } - DEBUG_WARNING(! msg, ("CreatureController (%s:%s) received a CM_setMentalStateTowardClampBehavior message but could not retrieve data from the message supplied", owner->getObjectTemplateName(), owner->getNetworkId().getValueString().c_str())); + owner->setMentalStateTowardClampBehavior( + msg->getValue().first, + msg->getValue().second.first, + msg->getValue().second.second.first, + msg->getValue().second.second.second); } - break; + DEBUG_WARNING(!msg, ("CreatureController (%s:%s) received a CM_setMentalStateTowardClampBehavior message but could not retrieve data from the message supplied", owner->getObjectTemplateName(), owner->getNetworkId().getValueString().c_str())); + } + break; case CM_setMaxMentalState: + { + const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); + if (msg) { - const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); - if(msg) - { - owner->setMaxMentalState(msg->getValue().first, msg->getValue().second); - } - DEBUG_WARNING(! msg, ("CreatureController (%s:%s) received a CM_setMaxMentalState message but could not retrieve data from the message supplied", owner->getObjectTemplateName(), owner->getNetworkId().getValueString().c_str())); + owner->setMaxMentalState(msg->getValue().first, msg->getValue().second); } - break; + DEBUG_WARNING(!msg, ("CreatureController (%s:%s) received a CM_setMaxMentalState message but could not retrieve data from the message supplied", owner->getObjectTemplateName(), owner->getNetworkId().getValueString().c_str())); + } + break; case CM_setMentalStateDecay: + { + const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); + if (msg) { - const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); - if(msg) - { - owner->setMentalStateDecay(msg->getValue().first, msg->getValue().second); - } - DEBUG_WARNING(! msg, ("CreatureController (%s:%s) received a CM_setMentalStateDecay message but could not retrieve data from the message supplied", owner->getObjectTemplateName(), owner->getNetworkId().getValueString().c_str())); + owner->setMentalStateDecay(msg->getValue().first, msg->getValue().second); } - break; + DEBUG_WARNING(!msg, ("CreatureController (%s:%s) received a CM_setMentalStateDecay message but could not retrieve data from the message supplied", owner->getObjectTemplateName(), owner->getNetworkId().getValueString().c_str())); + } + break; case CM_setPosture: - { - const MessageQueuePosture * const msg = safe_cast(data); - - if(msg) - { - owner->setPosture(msg->getPosture(), msg->isClientImmediate()); - } - DEBUG_WARNING(! msg, ("CreatureController (%s:%s) received a CM_setPosture message but could not retrieve data from the message supplied", owner->getObjectTemplateName(), owner->getNetworkId().getValueString().c_str())); - } - break; - case CM_setLocomotion: - { - const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if(msg) - { - owner->setLocomotion(msg->getValue()); - } - DEBUG_WARNING(! msg, ("CreatureController (%s:%s) received a CM_setLocomotion message but could not retrieve data from the message supplied", owner->getObjectTemplateName(), owner->getNetworkId().getValueString().c_str())); - } - break; - case CM_setGroupInviter: - { - const MessageQueueGenericValueType > > * const msg = safe_cast > > *>(data); - if (msg) - { - owner->setGroupInviter(msg->getValue().second.first, msg->getValue().first, msg->getValue().second.second); - } - } - break; - case CM_setPerformanceType: - { - const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if (msg) - { - owner->setPerformanceType(msg->getValue()); - } - } - break; - case CM_setPerformanceStartTime: - { - const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if (msg) - { - owner->setPerformanceStartTime(msg->getValue()); - } - } - break; - case CM_setPerformanceListenTarget: - { - const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if (msg) - { - owner->setPerformanceListenTarget(msg->getValue()); - } - } - break; - case CM_setPerformanceWatchTarget: - { - const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if (msg) - { - owner->setPerformanceWatchTarget(msg->getValue()); - } - } - break; - case CM_setModValue: - { - const - MessageQueueGenericValueType > * const msg = safe_cast > *>(data); - if(msg) - { - owner->setModValue(msg->getValue().first, msg->getValue().second); - } - } - break; - case CM_grantCommand: - { - const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if(msg) - { - owner->grantCommand(msg->getValue(), false); - } - } - break; - case CM_grantExperiencePoints: - { - const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); - if(msg) - { - owner->grantExperiencePoints(msg->getValue().first, msg->getValue().second); - } - } - break; - case CM_incrementKillMeter: - { - const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if(msg) - { - owner->incrementKillMeter(msg->getValue()); - } - } - break; - case CM_grantSkill: - { - const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if(msg) - { - const SkillObject * newSkill = SkillManager::getInstance().getSkill(msg->getValue()); - if(newSkill) - { - owner->grantSkill(*newSkill); - } - } - } - break; - case CM_revokeCommand: - { - const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if(msg) - { - owner->revokeCommand(msg->getValue(), false); - } - } - break; - case CM_revokeSkill: - { - const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if(msg) - { - const SkillObject * oldSkill = SkillManager::getInstance().getSkill(msg->getValue()); - if(oldSkill) - { - LOG("CustomerService", ("Skill: Removing skill %s from character %s via controller message.", - msg->getValue().c_str(), owner->getNetworkId().getValueString().c_str())); - owner->revokeSkill(*oldSkill); - } - } - } - break; - case CM_alterAttribute: - { - const MessageQueueAlterAttribute * const msg = safe_cast(data); - if(msg) - { - owner->alterAttribute(msg->getAttrib(), - msg->getDelta(), - msg->getCheckIncapacitation(), - msg->getSource() - ); - } - } - break; - case CM_addAttributeModifier: - { - const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if(msg) - { - owner->addAttributeModifier(msg->getValue()); - } - } - break; - case CM_removeAttributeModifiers: - { - const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if(msg) - { - owner->removeAttributeModifiers(msg->getValue()); - } - } - break; - case CM_removeAllAttributeModifiers: - { - owner->removeAllAttributeModifiers(); - } - break; - case CM_removeAllAttributeAndSkillmodModifiers: - { - owner->removeAllAttributeAndSkillmodMods(); - } - break; - case CM_setCurrentWeapon: - { - const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if(msg) - { - WeaponObject * weapon = safe_cast(NetworkIdManager::getObjectById(msg->getValue())); - if(weapon) - owner->setCurrentWeapon(*weapon); - } - } - break; - case CM_setGroup: - { - const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); - if(msg) - { - GroupObject * group = safe_cast(NetworkIdManager::getObjectById(msg->getValue().second)); + { + const MessageQueuePosture * const msg = safe_cast(data); - if (group) - { - owner->setGroup(group, msg->getValue().first); - } - else if (!msg->getValue().second.isValid()) - { - if (owner->getGroup()) - owner->getGroup()->onGroupMemberRemoved(owner->getNetworkId(), msg->getValue().first); - } + if (msg) + { + owner->setPosture(msg->getPosture(), msg->isClientImmediate()); + } + DEBUG_WARNING(!msg, ("CreatureController (%s:%s) received a CM_setPosture message but could not retrieve data from the message supplied", owner->getObjectTemplateName(), owner->getNetworkId().getValueString().c_str())); + } + break; + case CM_setLocomotion: + { + const MessageQueueGenericValueType * const msg = safe_cast *>(data); + if (msg) + { + owner->setLocomotion(msg->getValue()); + } + DEBUG_WARNING(!msg, ("CreatureController (%s:%s) received a CM_setLocomotion message but could not retrieve data from the message supplied", owner->getObjectTemplateName(), owner->getNetworkId().getValueString().c_str())); + } + break; + case CM_setGroupInviter: + { + const MessageQueueGenericValueType > > * const msg = safe_cast > > *>(data); + if (msg) + { + owner->setGroupInviter(msg->getValue().second.first, msg->getValue().first, msg->getValue().second.second); + } + } + break; + case CM_setPerformanceType: + { + const MessageQueueGenericValueType * const msg = safe_cast *>(data); + if (msg) + { + owner->setPerformanceType(msg->getValue()); + } + } + break; + case CM_setPerformanceStartTime: + { + const MessageQueueGenericValueType * const msg = safe_cast *>(data); + if (msg) + { + owner->setPerformanceStartTime(msg->getValue()); + } + } + break; + case CM_setPerformanceListenTarget: + { + const MessageQueueGenericValueType * const msg = safe_cast *>(data); + if (msg) + { + owner->setPerformanceListenTarget(msg->getValue()); + } + } + break; + case CM_setPerformanceWatchTarget: + { + const MessageQueueGenericValueType * const msg = safe_cast *>(data); + if (msg) + { + owner->setPerformanceWatchTarget(msg->getValue()); + } + } + break; + case CM_setModValue: + { + const + MessageQueueGenericValueType > * const msg = safe_cast > *>(data); + if (msg) + { + owner->setModValue(msg->getValue().first, msg->getValue().second); + } + } + break; + case CM_grantCommand: + { + const MessageQueueGenericValueType * const msg = safe_cast *>(data); + if (msg) + { + owner->grantCommand(msg->getValue(), false); + } + } + break; + case CM_grantExperiencePoints: + { + const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); + if (msg) + { + owner->grantExperiencePoints(msg->getValue().first, msg->getValue().second); + } + } + break; + case CM_incrementKillMeter: + { + const MessageQueueGenericValueType * const msg = safe_cast *>(data); + if (msg) + { + owner->incrementKillMeter(msg->getValue()); + } + } + break; + case CM_grantSkill: + { + const MessageQueueGenericValueType * const msg = safe_cast *>(data); + if (msg) + { + const SkillObject * newSkill = SkillManager::getInstance().getSkill(msg->getValue()); + if (newSkill) + { + owner->grantSkill(*newSkill); } } - break; + } + break; + case CM_revokeCommand: + { + const MessageQueueGenericValueType * const msg = safe_cast *>(data); + if (msg) + { + owner->revokeCommand(msg->getValue(), false); + } + } + break; + case CM_revokeSkill: + { + const MessageQueueGenericValueType * const msg = safe_cast *>(data); + if (msg) + { + const SkillObject * oldSkill = SkillManager::getInstance().getSkill(msg->getValue()); + if (oldSkill) + { + LOG("CustomerService", ("Skill: Removing skill %s from character %s via controller message.", + msg->getValue().c_str(), owner->getNetworkId().getValueString().c_str())); + owner->revokeSkill(*oldSkill); + } + } + } + break; + case CM_alterAttribute: + { + const MessageQueueAlterAttribute * const msg = safe_cast(data); + if (msg) + { + owner->alterAttribute(msg->getAttrib(), + msg->getDelta(), + msg->getCheckIncapacitation(), + msg->getSource() + ); + } + } + break; + case CM_addAttributeModifier: + { + const MessageQueueGenericValueType * const msg = safe_cast *>(data); + if (msg) + { + owner->addAttributeModifier(msg->getValue()); + } + } + break; + case CM_removeAttributeModifiers: + { + const MessageQueueGenericValueType * const msg = safe_cast *>(data); + if (msg) + { + owner->removeAttributeModifiers(msg->getValue()); + } + } + break; + case CM_removeAllAttributeModifiers: + { + owner->removeAllAttributeModifiers(); + } + break; + case CM_removeAllAttributeAndSkillmodModifiers: + { + owner->removeAllAttributeAndSkillmodMods(); + } + break; + case CM_setCurrentWeapon: + { + const MessageQueueGenericValueType * const msg = safe_cast *>(data); + if (msg) + { + WeaponObject * weapon = safe_cast(NetworkIdManager::getObjectById(msg->getValue())); + if (weapon) + owner->setCurrentWeapon(*weapon); + } + } + break; + case CM_setGroup: + { + const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); + if (msg) + { + GroupObject * group = safe_cast(NetworkIdManager::getObjectById(msg->getValue().second)); + + if (group) + { + owner->setGroup(group, msg->getValue().first); + } + else if (!msg->getValue().second.isValid()) + { + if (owner->getGroup()) + owner->getGroup()->onGroupMemberRemoved(owner->getNetworkId(), msg->getValue().first); + } + } + } + break; case CM_setIncapacitated: - { - const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); - if (msg != nullptr) - owner->setIncapacitated(msg->getValue().first, msg->getValue().second); - } - break; + { + const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); + if (msg != nullptr) + owner->setIncapacitated(msg->getValue().first, msg->getValue().second); + } + break; case CM_setSayMode: + { + const MessageQueueGenericValueType * const msg = safe_cast *>(data); + if (msg) { - const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if(msg) - { - owner->setSayMode(msg->getValue()); - } + owner->setSayMode(msg->getValue()); } - break; + } + break; case CM_setAnimationMood: + { + const MessageQueueGenericValueType * const msg = safe_cast *>(data); + if (msg) { - const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if(msg) - { - owner->setAnimationMood(msg->getValue()); - } + owner->setAnimationMood(msg->getValue()); } - break; + } + break; case CM_setScaleFactor: + { + const MessageQueueGenericValueType * const msg = safe_cast *>(data); + if (msg) { - const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if(msg) - { - owner->setScaleFactor(msg->getValue()); - } + owner->setScaleFactor(msg->getValue()); } - break; + } + break; case CM_setShockWounds: + { + const MessageQueueGenericValueType * const msg = safe_cast *>(data); + if (msg) { - const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if(msg) - { - owner->setShockWounds(msg->getValue()); - } + owner->setShockWounds(msg->getValue()); } - break; + } + break; case CM_setLookAtTarget: + { + const MessageQueueGenericValueType * const msg = safe_cast *>(data); + if (msg) { - const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if(msg) - { - owner->setLookAtTarget(msg->getValue()); - } + owner->setLookAtTarget(msg->getValue()); } - break; + } + break; case CM_setIntendedTarget: + { + const MessageQueueGenericValueType * const msg = safe_cast *>(data); + if (msg) { - const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if(msg) - { - owner->setIntendedTarget(msg->getValue()); - } + owner->setIntendedTarget(msg->getValue()); } - break; + } + break; case CM_setMovementStationary: - { - owner->setMovementStationary(); - } - break; + { + owner->setMovementStationary(); + } + break; case CM_setMovementWalk: - { - owner->setMovementWalk(); - } - break; + { + owner->setMovementWalk(); + } + break; case CM_setMovementRun: - { - owner->setMovementRun(); - } - break; + { + owner->setMovementRun(); + } + break; case CM_setSlopeModAngle: + { + const MessageQueueGenericValueType * const msg = safe_cast *>(data); + if (msg) { - const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if(msg) - { - owner->setSlopeModAngle(msg->getValue()); - } + owner->setSlopeModAngle(msg->getValue()); } - break; + } + break; case CM_setSlopeModPercent: + { + const MessageQueueGenericValueType * const msg = safe_cast *>(data); + if (msg) { - const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if(msg) - { - owner->setSlopeModPercent(msg->getValue()); - } + owner->setSlopeModPercent(msg->getValue()); } - break; + } + break; case CM_setWaterModPercent: + { + const MessageQueueGenericValueType * const msg = safe_cast *>(data); + if (msg) { - const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if(msg) - { - owner->setWaterModPercent(msg->getValue()); - } + owner->setWaterModPercent(msg->getValue()); } - break; + } + break; case CM_setMovementScale: + { + const MessageQueueGenericValueType * const msg = safe_cast *>(data); + if (msg) { - const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if(msg) - { - owner->setMovementScale(msg->getValue()); - } + owner->setMovementScale(msg->getValue()); } - break; + } + break; case CM_setMovementPercent: + { + const MessageQueueGenericValueType * const msg = safe_cast *>(data); + if (msg) { - const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if(msg) - { - owner->setMovementPercent(msg->getValue()); - } + owner->setMovementPercent(msg->getValue()); } - break; + } + break; case CM_setTurnPercent: + { + const MessageQueueGenericValueType * const msg = safe_cast *>(data); + if (msg) { - const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if(msg) - { - owner->setTurnPercent(msg->getValue()); - } + owner->setTurnPercent(msg->getValue()); } - break; + } + break; case CM_setAccelScale: + { + const MessageQueueGenericValueType * const msg = safe_cast *>(data); + if (msg) { - const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if(msg) - { - owner->setAccelScale(msg->getValue()); - } + owner->setAccelScale(msg->getValue()); } - break; + } + break; case CM_setAccelPercent: + { + const MessageQueueGenericValueType * const msg = safe_cast *>(data); + if (msg) { - const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if(msg) - { - owner->setAccelPercent(msg->getValue()); - } + owner->setAccelPercent(msg->getValue()); } - break; + } + break; case CM_sitOnObject: + { + const MessageQueueSitOnObject * const msg = safe_cast(data); + if (msg) { - const MessageQueueSitOnObject * const msg = safe_cast(data); - if(msg) - { - owner->sitOnObject(msg->getChairCellId(), msg->getChairPosition_p()); - } + owner->sitOnObject(msg->getChairCellId(), msg->getChairPosition_p()); } - break; + } + break; case CM_setMasterId: + { + const MessageQueueGenericValueType * const msg = safe_cast *>(data); + if (msg) { - const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if (msg) - { - owner->setMasterId(msg->getValue()); - } + owner->setMasterId(msg->getValue()); } - break; + } + break; case CM_setHouse: + { + const MessageQueueGenericValueType * const msg = safe_cast *>(data); + if (msg) { - const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if (msg) - { - owner->setHouse(CachedNetworkId(msg->getValue())); - } + owner->setHouse(CachedNetworkId(msg->getValue())); } - break; + } + break; case CM_setDifficulty: case CM_setLevel: - { - MessageQueueGenericValueType const *msg = safe_cast const *>(data); - if (msg) - owner->setLevel(static_cast(msg->getValue())); - } - break; + { + MessageQueueGenericValueType const *msg = safe_cast const *>(data); + if (msg) + owner->setLevel(static_cast(msg->getValue())); + } + break; case CM_recalculateLevel: - { - MessageQueueGenericValueType const *msg = safe_cast const *>(data); - if (msg) - owner->recalculateLevel(); - } - break; - + { + MessageQueueGenericValueType const *msg = safe_cast const *>(data); + if (msg) + owner->recalculateLevel(); + } + break; case CM_creatureSetBaseWalkSpeed: owner->setBaseWalkSpeed(value); @@ -832,518 +829,518 @@ void CreatureController::handleMessage (const int message, const float value, co break; case CM_detachRiderForMount: - { - typedef MessageQueueGenericValueType Message; - Message const * const msg = safe_cast(data); + { + typedef MessageQueueGenericValueType Message; + Message const * const msg = safe_cast(data); - if (msg != 0) - { - owner->detachRider(msg->getValue()); - } - break; + if (msg != 0) + { + owner->detachRider(msg->getValue()); } + break; + } case CM_detachAllRidersForMount: owner->detachAllRiders(); break; case CM_setAppearanceFromObjectTemplate: - { - MessageQueueGenericValueType const *const msg = dynamic_cast const *>(data); - if (owner && msg) - owner->setAlternateAppearance(msg->getValue()); - else - WARNING(true, ("CreatureController: received CM_setAppearanceFromObjectTemplate but owner or message was nullptr.")); - } - break; + { + MessageQueueGenericValueType const *const msg = dynamic_cast const *>(data); + if (owner && msg) + owner->setAlternateAppearance(msg->getValue()); + else + WARNING(true, ("CreatureController: received CM_setAppearanceFromObjectTemplate but owner or message was nullptr.")); + } + break; case CM_makeDead: + { + const MessageQueueGenericValueType > * msg = dynamic_cast > *>(data); + if (msg) { - const MessageQueueGenericValueType > * msg = dynamic_cast > *>(data); - if (msg) - { - owner->makeDead(msg->getValue().first, msg->getValue().second); - } + owner->makeDead(msg->getValue().first, msg->getValue().second); } - break; + } + break; case CM_pushCreature: + { + const MessageQueuePushCreature * const msg = safe_cast(data); + if (msg) { - const MessageQueuePushCreature * const msg = safe_cast(data); - if (msg) + ServerObject * defender = safe_cast(NetworkIdManager::getObjectById(msg->getDefender())); + if (defender != nullptr) { - ServerObject * defender = safe_cast(NetworkIdManager::getObjectById(msg->getDefender())); - if (defender != nullptr) + if (defender->asCreatureObject() != nullptr) { - if (defender->asCreatureObject() != nullptr) - { - defender->asCreatureObject()->pushedMe(msg->getAttacker(), msg->getAttackerPos(), msg->getDefenderPos(), msg->getDistance()); - } - else - { - WARNING(true, ("Received MessageQueuePushCreature for non-creature defender %s", msg->getDefender().getValueString().c_str())); - } + defender->asCreatureObject()->pushedMe(msg->getAttacker(), msg->getAttackerPos(), msg->getDefenderPos(), msg->getDistance()); + } + else + { + WARNING(true, ("Received MessageQueuePushCreature for non-creature defender %s", msg->getDefender().getValueString().c_str())); } } } - break; + } + break; case CM_slowDownEffect: + { + const MessageQueueSlowDownEffect * const msg = safe_cast(data); + if (msg) { - const MessageQueueSlowDownEffect * const msg = safe_cast(data); - if (msg) + ServerObject * target = safe_cast(NetworkIdManager::getObjectById(msg->getTarget())); + if (target != nullptr && target->asTangibleObject() != nullptr) { - ServerObject * target = safe_cast(NetworkIdManager::getObjectById(msg->getTarget())); - if (target != nullptr && target->asTangibleObject() != nullptr) - { - if (owner->isAuthoritative()) - owner->addSlowDownEffect(*(target->asTangibleObject()), msg->getConeLength(), msg->getConeAngle(), msg->getSlopeAngle(), msg->getExpireTime()); - else - owner->addSlowDownEffectProxy(*(target->asTangibleObject()), msg->getConeLength(), msg->getConeAngle(), msg->getSlopeAngle(), msg->getExpireTime()); - } + if (owner->isAuthoritative()) + owner->addSlowDownEffect(*(target->asTangibleObject()), msg->getConeLength(), msg->getConeAngle(), msg->getSlopeAngle(), msg->getExpireTime()); else - { - WARNING(true, ("Received slow down effect messge for creature %s " - "with unknown target %s", - owner->getNetworkId().getValueString().c_str(), - msg->getTarget().getValueString().c_str())); - } + owner->addSlowDownEffectProxy(*(target->asTangibleObject()), msg->getConeLength(), msg->getConeAngle(), msg->getSlopeAngle(), msg->getExpireTime()); + } + else + { + WARNING(true, ("Received slow down effect messge for creature %s " + "with unknown target %s", + owner->getNetworkId().getValueString().c_str(), + msg->getTarget().getValueString().c_str())); } } - break; + } + break; case CM_removeSlowDownEffect: + { + if (owner->isAuthoritative()) + owner->removeSlowDownEffect(); + else { - if (owner->isAuthoritative()) - owner->removeSlowDownEffect(); - else - { - WARNING(true, ("CM_removeSlowDownEffect message recieved by proxy object %s", owner->getNetworkId().getValueString().c_str())); - } + WARNING(true, ("CM_removeSlowDownEffect message recieved by proxy object %s", owner->getNetworkId().getValueString().c_str())); } - break; + } + break; case CM_removeSlowDownEffectProxy: + { + if (!owner->isAuthoritative()) + owner->removeSlowDownEffectProxy(); + else { - if (!owner->isAuthoritative()) - owner->removeSlowDownEffectProxy(); - else - { - WARNING(true, ("CM_removeSlowDownEffectProxy message recieved by authoritative object %s", owner->getNetworkId().getValueString().c_str())); - } + WARNING(true, ("CM_removeSlowDownEffectProxy message recieved by authoritative object %s", owner->getNetworkId().getValueString().c_str())); } - break; + } + break; case CM_groupLotteryWindowCloseResults: + { + typedef std::pair > Payload; + + MessageQueueGenericValueType const * const msg = safe_cast const *>(data); + if (msg != 0) { - typedef std::pair > Payload; + Payload const & incomingPayload = msg->getValue(); - MessageQueueGenericValueType const * const msg = safe_cast const *>(data); - if (msg != 0) + typedef std::vector Ids; + + NetworkId const & player = incomingPayload.first; + Ids const & selectedItems = incomingPayload.second; + + GameScriptObject * const scriptObject = owner->getScriptObject(); + if (scriptObject != 0) { - Payload const & incomingPayload = msg->getValue(); - - typedef std::vector Ids; - - NetworkId const & player = incomingPayload.first; - Ids const & selectedItems = incomingPayload.second; - - GameScriptObject * const scriptObject = owner->getScriptObject(); - if (scriptObject != 0) - { - ScriptParams params; - params.addParam(player); - params.addParam(selectedItems); - IGNORE_RETURN(scriptObject->trigAllScripts(Scripting::TRIG_LOOT_LOTTERY_SELECTED, params)); - } + ScriptParams params; + params.addParam(player); + params.addParam(selectedItems); + IGNORE_RETURN(scriptObject->trigAllScripts(Scripting::TRIG_LOOT_LOTTERY_SELECTED, params)); } } - break; + } + break; case CM_cyberneticsChangeRequestToNPC: + { + MessageQueueCyberneticsChangeRequest const * const msg = safe_cast(data); + NOT_NULL(msg); + if (msg != nullptr) { - MessageQueueCyberneticsChangeRequest const * const msg = safe_cast(data); - NOT_NULL(msg); - if (msg != nullptr) + NetworkId const & playerId = msg->getTarget(); + GameScriptObject * const scriptObject = owner->getScriptObject(); + if (scriptObject) { - NetworkId const & playerId = msg->getTarget(); - GameScriptObject * const scriptObject = owner->getScriptObject(); - if (scriptObject) - { - ScriptParams params; - params.addParam(playerId); - params.addParam(static_cast(msg->getChangeType())); - params.addParam(msg->getCyberneticPiece()); - - IGNORE_RETURN(scriptObject->trigAllScripts(Scripting::TRIG_CYBERNETIC_CHANGE_REQUEST, params)); - } + ScriptParams params; + params.addParam(playerId); + params.addParam(static_cast(msg->getChangeType())); + params.addParam(msg->getCyberneticPiece()); + + IGNORE_RETURN(scriptObject->trigAllScripts(Scripting::TRIG_CYBERNETIC_CHANGE_REQUEST, params)); } } - break; + } + break; case CM_setCurrentQuest: + { + MessageQueueGenericValueType const * const msg = safe_cast const *>(data); + if (msg != nullptr) { - MessageQueueGenericValueType const * const msg = safe_cast const *>(data); - if (msg != nullptr) + PlayerObject * player = PlayerCreatureController::getPlayerObject(owner); + if (player != nullptr) { - PlayerObject * player = PlayerCreatureController::getPlayerObject(owner); - if (player != nullptr) - { - player->setCurrentQuest(msg->getValue()); - } - else - { - DEBUG_WARNING(true, ("Non-player creature %s sent CM_setCurrentQuest message (%u)", - owner->getNetworkId().getValueString().c_str(), msg->getValue())); - } + player->setCurrentQuest(msg->getValue()); + } + else + { + DEBUG_WARNING(true, ("Non-player creature %s sent CM_setCurrentQuest message (%u)", + owner->getNetworkId().getValueString().c_str(), msg->getValue())); } } - break; + } + break; case CM_setRegenRate: + { + MessageQueueGenericValueType > const * const msg = safe_cast > const *>(data); + if (msg != nullptr) { - MessageQueueGenericValueType > const * const msg = safe_cast > const *>(data); - if (msg != nullptr) - { - owner->setRegenRate(static_cast(msg->getValue().first), msg->getValue().second); - } + owner->setRegenRate(static_cast(msg->getValue().first), msg->getValue().second); } - break; + } + break; case CM_modifyCurrentGcwPoints: + { + const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); + if (msg) { - const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); - if(msg) + PlayerObject * player = PlayerCreatureController::getPlayerObject(owner); + if (player) { - PlayerObject * player = PlayerCreatureController::getPlayerObject(owner); - if(player) - { - player->modifyCurrentGcwPoints(msg->getValue().first, (msg->getValue().second != 0)); - } + player->modifyCurrentGcwPoints(msg->getValue().first, (msg->getValue().second != 0)); } } - break; + } + break; case CM_modifyCurrentGcwRating: + { + const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); + if (msg) { - const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); - if(msg) + PlayerObject * player = PlayerCreatureController::getPlayerObject(owner); + if (player) { - PlayerObject * player = PlayerCreatureController::getPlayerObject(owner); - if(player) - { - player->modifyCurrentGcwRating(msg->getValue().first, (msg->getValue().second != 0)); - } + player->modifyCurrentGcwRating(msg->getValue().first, (msg->getValue().second != 0)); } } - break; + } + break; case CM_modifyCurrentPvpKills: + { + const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); + if (msg) { - const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); - if(msg) + PlayerObject * player = PlayerCreatureController::getPlayerObject(owner); + if (player) { - PlayerObject * player = PlayerCreatureController::getPlayerObject(owner); - if(player) - { - player->modifyCurrentPvpKills(msg->getValue().first, (msg->getValue().second != 0)); - } + player->modifyCurrentPvpKills(msg->getValue().first, (msg->getValue().second != 0)); } } - break; + } + break; case CM_modifyLifetimeGcwPoints: + { + const MessageQueueGenericValueType * const msg = safe_cast *>(data); + if (msg) { - const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if(msg) + PlayerObject * player = PlayerCreatureController::getPlayerObject(owner); + if (player) { - PlayerObject * player = PlayerCreatureController::getPlayerObject(owner); - if(player) - { - player->modifyLifetimeGcwPoints(msg->getValue()); - } + player->modifyLifetimeGcwPoints(msg->getValue()); } } - break; + } + break; case CM_modifyMaxGcwImperialRating: + { + const MessageQueueGenericValueType * const msg = safe_cast *>(data); + if (msg) { - const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if(msg) + PlayerObject * player = PlayerCreatureController::getPlayerObject(owner); + if (player) { - PlayerObject * player = PlayerCreatureController::getPlayerObject(owner); - if(player) - { - player->modifyMaxGcwImperialRating(msg->getValue()); - } + player->modifyMaxGcwImperialRating(msg->getValue()); } } - break; + } + break; case CM_modifyMaxGcwRebelRating: + { + const MessageQueueGenericValueType * const msg = safe_cast *>(data); + if (msg) { - const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if(msg) + PlayerObject * player = PlayerCreatureController::getPlayerObject(owner); + if (player) { - PlayerObject * player = PlayerCreatureController::getPlayerObject(owner); - if(player) - { - player->modifyMaxGcwRebelRating(msg->getValue()); - } + player->modifyMaxGcwRebelRating(msg->getValue()); } } - break; + } + break; case CM_modifyLifetimePvpKills: + { + const MessageQueueGenericValueType * const msg = safe_cast *>(data); + if (msg) { - const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if(msg) + PlayerObject * player = PlayerCreatureController::getPlayerObject(owner); + if (player) { - PlayerObject * player = PlayerCreatureController::getPlayerObject(owner); - if(player) - { - player->modifyLifetimePvpKills(msg->getValue()); - } + player->modifyLifetimePvpKills(msg->getValue()); } } - break; + } + break; case CM_modifyNextGcwRatingCalcTime: + { + const MessageQueueGenericValueType * const msg = safe_cast *>(data); + if (msg) { - const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if(msg) + PlayerObject * player = PlayerCreatureController::getPlayerObject(owner); + if (player) { - PlayerObject * player = PlayerCreatureController::getPlayerObject(owner); - if(player) - { - player->modifyNextGcwRatingCalcTime(msg->getValue()); - } + player->modifyNextGcwRatingCalcTime(msg->getValue()); } } - break; + } + break; case CM_customizeFinished: + { + typedef std::pair Payload; + + MessageQueueGenericValueType const * const msg = safe_cast const *>(data); + if (msg != 0) { - typedef std::pair Payload; + Payload const & incomingPayload = msg->getValue(); - MessageQueueGenericValueType const * const msg = safe_cast const *>(data); - if (msg != 0) + NetworkId const & object = incomingPayload.first; + std::string const & msgValue = incomingPayload.second; + + GameScriptObject * const scriptObject = owner->getScriptObject(); + if (scriptObject != 0) { - Payload const & incomingPayload = msg->getValue(); - - NetworkId const & object = incomingPayload.first; - std::string const & msgValue = incomingPayload.second; - - GameScriptObject * const scriptObject = owner->getScriptObject(); - if (scriptObject != 0) - { - ScriptParams params; - params.addParam(object); - params.addParam(msgValue.c_str()); - IGNORE_RETURN(scriptObject->trigAllScripts(Scripting::TRIG_ON_CUSTOMIZE_FINISHED, params)); - } + ScriptParams params; + params.addParam(object); + params.addParam(msgValue.c_str()); + IGNORE_RETURN(scriptObject->trigAllScripts(Scripting::TRIG_ON_CUSTOMIZE_FINISHED, params)); } } - break; + } + break; case CM_clearSessionActivity: + { + PlayerObject * player = PlayerCreatureController::getPlayerObject(owner); + if (player) { - PlayerObject * player = PlayerCreatureController::getPlayerObject(owner); - if(player) - { - player->clearSessionActivity(); - } + player->clearSessionActivity(); } - break; + } + break; case CM_addSessionActivity: - { - const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if(msg) - { - PlayerObject * player = PlayerCreatureController::getPlayerObject(owner); - if(player) - { - player->addSessionActivity(static_cast(msg->getValue())); - } - } - } - break; - - case CM_modifyHologramType: - { - MessageQueueGenericValueType const *msg = safe_cast const *>(data); - if (msg) - owner->setHologramType(msg->getValue()); - } - break; - - case CM_modifyVisibleOnMapAndRadar: - { - MessageQueueGenericValueType const *msg = safe_cast const *>(data); - if (msg) - owner->setVisibleOnMapAndRadar(msg->getValue()); - } - break; - - case CM_setCoverVisibility: - { - const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if (msg) - { - owner->setCoverVisibility(msg->getValue()); - } - } - break; - - case CM_incubatorCancel: - { - IncubatorCommitMessage const * const msg = safe_cast(data); - if (msg) - { - ServerObject * incubatorSo = ServerWorld::findObjectByNetworkId(msg->getTerminalId()); - if (incubatorSo) - { - TangibleObject * incubatorTo = incubatorSo->asTangibleObject(); - - if (incubatorTo) - incubatorTo->handleIncubatorCancel(*owner); - } - } - } - break; - - case CM_incubatorCommit: - { - IncubatorCommitMessage const * const msg = safe_cast(data); - if (msg) - { - ServerObject * incubatorSo = ServerWorld::findObjectByNetworkId(msg->getTerminalId()); - if (incubatorSo) - { - TangibleObject * incubatorTo = incubatorSo->asTangibleObject(); - - if (incubatorTo) - incubatorTo->handleIncubatorCommit(*owner, *msg); - } - } - } - break; - - case CM_modifyCollectionSlotValue: - { - const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); - if(msg) - { - PlayerObject * player = PlayerCreatureController::getPlayerObject(owner); - if(player) - { - player->modifyCollectionSlotValue(msg->getValue().first, msg->getValue().second); - } - } - } - break; - - case CM_adjustLotCount: - { - const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if(msg) - { - PlayerObject * player = PlayerCreatureController::getPlayerObject(owner); - if(player) - { - player->adjustLotCount(msg->getValue()); - } - } - } - break; - - case CM_squelch: - { - const MessageQueueGenericValueType > > * const msg = safe_cast > > *>(data); - if(msg) - { - PlayerObject * player = PlayerCreatureController::getPlayerObject(owner); - if(player) - { - player->squelch(msg->getValue().second.first, msg->getValue().first, msg->getValue().second.second); - } - } - } - break; - - case CM_unsquelch: + { + const MessageQueueGenericValueType * const msg = safe_cast *>(data); + if (msg) { PlayerObject * player = PlayerCreatureController::getPlayerObject(owner); - if(player) + if (player) { - player->unsquelch(); + player->addSessionActivity(static_cast(msg->getValue())); } } - break; + } + break; + + case CM_modifyHologramType: + { + MessageQueueGenericValueType const *msg = safe_cast const *>(data); + if (msg) + owner->setHologramType(msg->getValue()); + } + break; + + case CM_modifyVisibleOnMapAndRadar: + { + MessageQueueGenericValueType const *msg = safe_cast const *>(data); + if (msg) + owner->setVisibleOnMapAndRadar(msg->getValue()); + } + break; + + case CM_setCoverVisibility: + { + const MessageQueueGenericValueType * const msg = safe_cast *>(data); + if (msg) + { + owner->setCoverVisibility(msg->getValue()); + } + } + break; + + case CM_incubatorCancel: + { + IncubatorCommitMessage const * const msg = safe_cast(data); + if (msg) + { + ServerObject * incubatorSo = ServerWorld::findObjectByNetworkId(msg->getTerminalId()); + if (incubatorSo) + { + TangibleObject * incubatorTo = incubatorSo->asTangibleObject(); + + if (incubatorTo) + incubatorTo->handleIncubatorCancel(*owner); + } + } + } + break; + + case CM_incubatorCommit: + { + IncubatorCommitMessage const * const msg = safe_cast(data); + if (msg) + { + ServerObject * incubatorSo = ServerWorld::findObjectByNetworkId(msg->getTerminalId()); + if (incubatorSo) + { + TangibleObject * incubatorTo = incubatorSo->asTangibleObject(); + + if (incubatorTo) + incubatorTo->handleIncubatorCommit(*owner, *msg); + } + } + } + break; + + case CM_modifyCollectionSlotValue: + { + const MessageQueueGenericValueType > * const msg = safe_cast > *>(data); + if (msg) + { + PlayerObject * player = PlayerCreatureController::getPlayerObject(owner); + if (player) + { + player->modifyCollectionSlotValue(msg->getValue().first, msg->getValue().second); + } + } + } + break; + + case CM_adjustLotCount: + { + const MessageQueueGenericValueType * const msg = safe_cast *>(data); + if (msg) + { + PlayerObject * player = PlayerCreatureController::getPlayerObject(owner); + if (player) + { + player->adjustLotCount(msg->getValue()); + } + } + } + break; + + case CM_squelch: + { + const MessageQueueGenericValueType > > * const msg = safe_cast > > *>(data); + if (msg) + { + PlayerObject * player = PlayerCreatureController::getPlayerObject(owner); + if (player) + { + player->squelch(msg->getValue().second.first, msg->getValue().first, msg->getValue().second.second); + } + } + } + break; + + case CM_unsquelch: + { + PlayerObject * player = PlayerCreatureController::getPlayerObject(owner); + if (player) + { + player->unsquelch(); + } + } + break; case CM_setPriviledgedTitle: + { + const MessageQueueGenericValueType * const msg = safe_cast *>(data); + if (msg) { - const MessageQueueGenericValueType * const msg = safe_cast *>(data); - if(msg) + PlayerObject * player = PlayerCreatureController::getPlayerObject(owner); + if (player) { - PlayerObject * player = PlayerCreatureController::getPlayerObject(owner); - if(player) - { - player->setPriviledgedTitle(static_cast(msg->getValue())); - } + player->setPriviledgedTitle(static_cast(msg->getValue())); } } - break; + } + break; case CM_addBuff: + { + const MessageQueueGenericValueType > > > > * const msg = safe_cast > > > > *>(data); + if (msg) { - const MessageQueueGenericValueType > > > > * const msg = safe_cast > > > > *>(data); - if(msg) - { - owner->addBuff (static_cast(msg->getValue ().first), msg->getValue ().second.first, msg->getValue ().second.second.first, msg->getValue ().second.second.second.first, msg->getValue ().second.second.second.second); - } + owner->addBuff(static_cast(msg->getValue().first), msg->getValue().second.first, msg->getValue().second.second.first, msg->getValue().second.second.second.first, msg->getValue().second.second.second.second); } - break; + } + break; case CM_removeBuff: + { + const MessageQueueGenericValueType * const msg = safe_cast *>(data); + if (msg) { - const MessageQueueGenericValueType * const msg = safe_cast * >(data); - if(msg) - { - owner->removeBuff (static_cast(msg->getValue ())); - } + owner->removeBuff(static_cast(msg->getValue())); } - break; + } + break; case CM_ratingFinished: + { + const MessageQueueGenericValueType * const msg = safe_cast *>(data); + if (msg) { - const MessageQueueGenericValueType * const msg = safe_cast * >(data); - if(msg) + if (owner->getScriptObject()) { - if(owner->getScriptObject()) - { - ScriptParams params; - params.addParam(msg->getValue()); - IGNORE_RETURN(owner->getScriptObject()->trigAllScripts(Scripting::TRIG_ON_RATING_FINISHED, params)); - } + ScriptParams params; + params.addParam(msg->getValue()); + IGNORE_RETURN(owner->getScriptObject()->trigAllScripts(Scripting::TRIG_ON_RATING_FINISHED, params)); } } - break; + } + break; case CM_abandonPlayerQuest: + { + const MessageQueueGenericValueType * const msg = safe_cast *>(data); + if (msg) { - const MessageQueueGenericValueType * const msg = safe_cast * >(data); - if(msg) + if (owner->getScriptObject()) { - if(owner->getScriptObject()) - { - ScriptParams params; - params.addParam(msg->getValue()); - IGNORE_RETURN(owner->getScriptObject()->trigAllScripts(Scripting::TRIG_ON_ABANDON_PLAYER_QUEST, params)); - } - } + ScriptParams params; + params.addParam(msg->getValue()); + IGNORE_RETURN(owner->getScriptObject()->trigAllScripts(Scripting::TRIG_ON_ABANDON_PLAYER_QUEST, params)); + } } - break; + } + break; default: TangibleController::handleMessage(message, value, data, flags); @@ -1361,12 +1358,12 @@ float CreatureController::realAlter(float time) CreatureObject * const owner = NON_NULL(getCreature()); - if(getHibernate()) + if (getHibernate()) return alterResult; if (owner->isAuthoritative()) owner->decayAttributes(time); - + if (owner->isInWorld()) { bool isBurning = false; @@ -1381,23 +1378,23 @@ float CreatureController::realAlter(float time) bool const currentSwimState = owner->getState(States::Swimming); bool newSwimState = false; float waterHeight = 0.0f; - calculateWaterState(newSwimState,isBurning,lavaResistance,waterHeight); + calculateWaterState(newSwimState, isBurning, lavaResistance, waterHeight); - bool const isVehicle = GameObjectTypes::isTypeOf (owner->getGameObjectType (), static_cast(SharedObjectTemplate::GOT_vehicle)); - if(!isVehicle) // make everything but vehicles walk on lava + bool const isVehicle = GameObjectTypes::isTypeOf(owner->getGameObjectType(), static_cast(SharedObjectTemplate::GOT_vehicle)); + if (!isVehicle) // make everything but vehicles walk on lava { - const Vector & position = owner->getPosition_w (); + const Vector & position = owner->getPosition_w(); Footprint *const footprint = owner->getFootprint(); - if(footprint) + if (footprint) { - if(isBurning) + if (isBurning) { footprint->setSwimHeight(owner->getSwimHeight() * 0.2f); owner->move_p(Vector::unitY * (waterHeight - position.y)); } else { - footprint->setSwimHeight(owner->getSwimHeight()); + footprint->setSwimHeight(owner->getSwimHeight()); } } } @@ -1425,7 +1422,7 @@ float CreatureController::realAlter(float time) // update the rider's CollisionProperty extent causes line of sight // to fail (line of sight ends up using the value present in CollisionProperty // at the time of mounting). - + if (collisionProperty) collisionProperty->updateExtents(); } @@ -1433,43 +1430,43 @@ float CreatureController::realAlter(float time) const bool isPlayerControlled = (collisionProperty && collisionProperty->isPlayerControlled()); // lava damage - if(WaterTypeManager::getCausesDamage(TGWT_lava) - && isBurning + if (WaterTypeManager::getCausesDamage(TGWT_lava) + && isBurning && (isPlayerControlled || owner->isBeast()) - ) + ) { const unsigned long serverTime = ServerClock::getInstance().getGameTimeSeconds(); const unsigned long lastBurnTime = owner->getLastWaterDamageTime(); const unsigned long waterDamageInterval = WaterTypeManager::getDamageInterval(TGWT_lava); - if(serverTime - lastBurnTime > (waterDamageInterval*3)) // skip the first lava damage frame + if (serverTime - lastBurnTime > (waterDamageInterval * 3)) // skip the first lava damage frame { owner->setLastWaterDamageTime(serverTime - waterDamageInterval); //DEBUG_WARNING(true,("LAVA DAMAGE SLUSH TIME- serverTime=%ul, lastBurnTime=%ul, diff=%d",serverTime,lastBurnTime,serverTime-lastBurnTime)); - } - else if(serverTime - lastBurnTime > waterDamageInterval && !owner->isDead()) + } + else if (serverTime - lastBurnTime > waterDamageInterval && !owner->isDead()) { owner->setLastWaterDamageTime(serverTime); - const float percentWaterDamagePerInterval = WaterTypeManager::getDamagePerInterval(TGWT_lava)/100.0f; - const float lavaResistanceModifier = 1.0f - lavaResistance/100.0f; - - const int damageValue = + const float percentWaterDamagePerInterval = WaterTypeManager::getDamagePerInterval(TGWT_lava) / 100.0f; + const float lavaResistanceModifier = 1.0f - lavaResistance / 100.0f; + + const int damageValue = static_cast ( - -( owner->getMaxAttribute(Attributes::Health) - * percentWaterDamagePerInterval + -(owner->getMaxAttribute(Attributes::Health) + * percentWaterDamagePerInterval * lavaResistanceModifier - ) - ); - + ) + ); + StringId stringId = StringId("combat_effects", "environment_damage_lava"); - owner->showFlyText(stringId,5.0f,255,0,0); - - if(WaterTypeManager::getDamageKills(TGWT_lava) + owner->showFlyText(stringId, 5.0f, 255, 0, 0); + + if (WaterTypeManager::getDamageKills(TGWT_lava) && (owner->getAttribute(Attributes::Health) + damageValue) <= 0) { - owner->makeDead(NetworkId::cms_invalid, NetworkId::cms_invalid); + owner->makeDead(NetworkId::cms_invalid, NetworkId::cms_invalid); ScriptParams params; - owner->getScriptObject()->trigAllScripts(Scripting::TRIG_ENVIRONMENTAL_DEATH,params); + owner->getScriptObject()->trigAllScripts(Scripting::TRIG_ENVIRONMENTAL_DEATH, params); } else { @@ -1496,7 +1493,7 @@ float CreatureController::realAlter(float time) void CreatureController::conclude() { PROFILER_AUTO_BLOCK_DEFINE("CreatureController::conclude"); - + MessageQueue::Data* data; int message; @@ -1505,12 +1502,12 @@ void CreatureController::conclude() NetworkId networkId; int const messageCount = getNumberOfMessages(); - for(int i = 0; i < messageCount; ++i) + for (int i = 0; i < messageCount; ++i) { //-- Get the message. getMessage(i, &message, &value, &data, &flags); //@todo why does getMessage need a signed size? - if(message == CM_combatAction) + if (message == CM_combatAction) { //-- Check if it's a combat action message. If so, the message's end postures for the // combatants must be adjusted to reflect the server's idea of the post-alter end posture. @@ -1519,23 +1516,23 @@ void CreatureController::conclude() if (combatMessage != nullptr) { //-- Fix up end postures in messages. - + // @todo: change postures to locomotion // set the attacker's posture - MessageQueueCombatAction::AttackerData & attackerData = + MessageQueueCombatAction::AttackerData & attackerData = const_cast( combatMessage->getAttacker()); const CreatureObject * attacker = dynamic_cast( NetworkIdManager::getObjectById(attackerData.id)); attackerData.endPosture = (attacker != nullptr) ? attacker->getPosture() : static_cast(0); - + // set the defenders' posture - const MessageQueueCombatAction::DefenderDataVector & defenderData = + const MessageQueueCombatAction::DefenderDataVector & defenderData = combatMessage->getDefenders(); - for (MessageQueueCombatAction::DefenderDataVector::const_iterator - iter(defenderData.begin()); iter != defenderData.end(); ++iter) + for (MessageQueueCombatAction::DefenderDataVector::const_iterator + iter(defenderData.begin()); iter != defenderData.end(); ++iter) { - MessageQueueCombatAction::DefenderData & defenderData = + MessageQueueCombatAction::DefenderData & defenderData = const_cast(*iter); const CreatureObject * defender = dynamic_cast( NetworkIdManager::getObjectById(defenderData.id)); @@ -1546,7 +1543,7 @@ void CreatureController::conclude() } CreatureObject * const owner = static_cast(getOwner()); - if(owner) + if (owner) { owner->checkNotifyRegions(); } @@ -1605,159 +1602,156 @@ void CreatureController::handleSecureTradeMessage(const MessageQueueSecureTrade switch (data->getTradeMessageId()) { case MessageQueueSecureTrade::TMI_RequestTrade: + { + if (data->getRecipient() == owner->getNetworkId()) { - if (data->getRecipient() == owner->getNetworkId()) - { - DEBUG_REPORT_LOG(true, ("Creature %s tried to trade with himself.", getOwner()->getNetworkId().getValueString().c_str())); - return; - } - if (m_secureTrade) - { - DEBUG_REPORT_LOG(true, ("Creature %s is already trading\n", getOwner()->getNetworkId().getValueString().c_str())); - return; - } - - CreatureObject * recipient = dynamic_cast(ServerWorld::findObjectByNetworkId(data->getRecipient())); - if (!recipient) - { - DEBUG_REPORT_LOG(true, ("Could not find recipient for secure trade message\n")); - MessageQueueSecureTrade * m = new MessageQueueSecureTrade(MessageQueueSecureTrade::TMI_DeniedPlayerUnreachable, owner->getNetworkId(), data->getRecipient()); - appendMessage(static_cast(CM_secureTrade), 0.0f, m, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_CLIENT); - return; - } - - if (owner->isIncapacitated() || owner->isDead()) - { - DEBUG_REPORT_LOG(true, ("Owner creature %s is incapacitated or dead.\n", getOwner()->getNetworkId().getValueString().c_str())); - MessageQueueSecureTrade * m = new MessageQueueSecureTrade(MessageQueueSecureTrade::TMI_DeniedPlayerUnreachable, owner->getNetworkId(), data->getRecipient()); - appendMessage(static_cast(CM_secureTrade), 0.0f, m, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_CLIENT); - return; - } - else if (recipient->isIncapacitated() || recipient->isDead()) - { - DEBUG_REPORT_LOG(true, ("Recipient creature %s is incapacitated or dead.\n", getOwner()->getNetworkId().getValueString().c_str())); - MessageQueueSecureTrade * m = new MessageQueueSecureTrade(MessageQueueSecureTrade::TMI_DeniedPlayerUnreachable, owner->getNetworkId(), data->getRecipient()); - appendMessage(static_cast(CM_secureTrade), 0.0f, m, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_CLIENT); - return; - } - - if (! recipient->isAuthoritative()) - { - if (owner->isInWorldCell()) - { - // transfer player to authoritative server - owner->transferAuthority(recipient->getAuthServerProcessId(), true, false, true); - owner->sendControllerMessageToAuthServer(CM_secureTrade, new MessageQueueSecureTrade(MessageQueueSecureTrade::TMI_RequestTrade, owner->getNetworkId(), data->getRecipient())); - } - else if (recipient->isInWorldCell()) - { - recipient->sendControllerMessageToAuthServer(CM_secureTrade, new MessageQueueSecureTrade(MessageQueueSecureTrade::TMI_RequestTradeReversed, owner->getNetworkId(), data->getRecipient())); - } - else - { - DEBUG_REPORT_LOG(true, ("Player %s tried to trade with player " - "%s, but both were in interiors that are on different " - "servers. Cell/server= (%s/%lu), (%s/%lu)", - owner->getNetworkId().getValueString().c_str(), - recipient->getNetworkId().getValueString().c_str(), - ContainerInterface::getTopmostContainer(*owner)->getNetworkId().getValueString().c_str(), - owner->getAuthServerProcessId(), - ContainerInterface::getTopmostContainer(*recipient)->getNetworkId().getValueString().c_str(), - recipient->getAuthServerProcessId() - )); - } - } - else if (recipient->getClient() == nullptr) - { -// GameServer::getInstance().sendToPlanetServer( -// GenericValueTypeMessage >( -// "RequestSameServer", -// std::make_pair( -// ContainerInterface::getTopmostContainer(*owner)->getNetworkId(), -// ContainerInterface::getTopmostContainer(*recipient)->getNetworkId())), -// true); - - // transfer player to authoritative server - //owner->transferAuthority(recipient->getAuthServerProcessId(), true, false); - //owner->sendControllerMessageToAuthServer(CM_secureTrade, new MessageQueueSecureTrade(MessageQueueSecureTrade::TMI_RequestTrade, owner->getNetworkId(), data->getRecipient())); - - // try again next frame - owner->sendControllerMessageToAuthServer(CM_secureTrade, new MessageQueueSecureTrade(MessageQueueSecureTrade::TMI_RequestTrade, owner->getNetworkId(), data->getRecipient())); - } - else if (!ServerSecureTradeManager::requestTradeWith(*owner, *recipient)) - { - MessageQueueSecureTrade * m = new MessageQueueSecureTrade(MessageQueueSecureTrade::TMI_DeniedPlayerBusy, owner->getNetworkId(), recipient->getNetworkId()); - appendMessage(static_cast(CM_secureTrade), 0.0f, m, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_CLIENT); - - } - } - break; - - // we get this when the traders are on different servers, but the trade - // initiator can't be moved to our server - case MessageQueueSecureTrade::TMI_RequestTradeReversed: - { - CreatureObject * initiator = dynamic_cast(ServerWorld::findObjectByNetworkId(data->getInitiator())); - if (!initiator) - { - DEBUG_REPORT_LOG(true, ("Could not find initiator for reversed secure trade message\n")); - return; - } - if (! initiator->isAuthoritative()) - { - if (owner->isInWorldCell()) - { - // transfer player to authoritative server - owner->transferAuthority(initiator->getAuthServerProcessId(), true, false, true); - owner->sendControllerMessageToAuthServer(CM_secureTrade, new MessageQueueSecureTrade(MessageQueueSecureTrade::TMI_RequestTradeReversed, initiator->getNetworkId(), owner->getNetworkId())); - } - else - { - WARNING(true, ("Got TMI_RequestTradeReversed, but we are not in the world! Trade request abandoned.")); - return; - } - } - else - initiator->sendControllerMessageToAuthServer(CM_secureTrade, new MessageQueueSecureTrade(MessageQueueSecureTrade::TMI_RequestTrade, initiator->getNetworkId(), owner->getNetworkId())); - } - break; - - case MessageQueueSecureTrade::TMI_TradeRequested: - { - WARNING_STRICT_FATAL(true, ("Server should not receive this message\n")); + DEBUG_REPORT_LOG(true, ("Creature %s tried to trade with himself.", getOwner()->getNetworkId().getValueString().c_str())); return; } - break; + if (m_secureTrade) + { + DEBUG_REPORT_LOG(true, ("Creature %s is already trading\n", getOwner()->getNetworkId().getValueString().c_str())); + return; + } + + CreatureObject * recipient = dynamic_cast(ServerWorld::findObjectByNetworkId(data->getRecipient())); + if (!recipient) + { + DEBUG_REPORT_LOG(true, ("Could not find recipient for secure trade message\n")); + MessageQueueSecureTrade * m = new MessageQueueSecureTrade(MessageQueueSecureTrade::TMI_DeniedPlayerUnreachable, owner->getNetworkId(), data->getRecipient()); + appendMessage(static_cast(CM_secureTrade), 0.0f, m, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_CLIENT); + return; + } + + if (owner->isIncapacitated() || owner->isDead()) + { + DEBUG_REPORT_LOG(true, ("Owner creature %s is incapacitated or dead.\n", getOwner()->getNetworkId().getValueString().c_str())); + MessageQueueSecureTrade * m = new MessageQueueSecureTrade(MessageQueueSecureTrade::TMI_DeniedPlayerUnreachable, owner->getNetworkId(), data->getRecipient()); + appendMessage(static_cast(CM_secureTrade), 0.0f, m, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_CLIENT); + return; + } + else if (recipient->isIncapacitated() || recipient->isDead()) + { + DEBUG_REPORT_LOG(true, ("Recipient creature %s is incapacitated or dead.\n", getOwner()->getNetworkId().getValueString().c_str())); + MessageQueueSecureTrade * m = new MessageQueueSecureTrade(MessageQueueSecureTrade::TMI_DeniedPlayerUnreachable, owner->getNetworkId(), data->getRecipient()); + appendMessage(static_cast(CM_secureTrade), 0.0f, m, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_CLIENT); + return; + } + + if (!recipient->isAuthoritative()) + { + if (owner->isInWorldCell()) + { + // transfer player to authoritative server + owner->transferAuthority(recipient->getAuthServerProcessId(), true, false, true); + owner->sendControllerMessageToAuthServer(CM_secureTrade, new MessageQueueSecureTrade(MessageQueueSecureTrade::TMI_RequestTrade, owner->getNetworkId(), data->getRecipient())); + } + else if (recipient->isInWorldCell()) + { + recipient->sendControllerMessageToAuthServer(CM_secureTrade, new MessageQueueSecureTrade(MessageQueueSecureTrade::TMI_RequestTradeReversed, owner->getNetworkId(), data->getRecipient())); + } + else + { + DEBUG_REPORT_LOG(true, ("Player %s tried to trade with player " + "%s, but both were in interiors that are on different " + "servers. Cell/server= (%s/%lu), (%s/%lu)", + owner->getNetworkId().getValueString().c_str(), + recipient->getNetworkId().getValueString().c_str(), + ContainerInterface::getTopmostContainer(*owner)->getNetworkId().getValueString().c_str(), + owner->getAuthServerProcessId(), + ContainerInterface::getTopmostContainer(*recipient)->getNetworkId().getValueString().c_str(), + recipient->getAuthServerProcessId() + )); + } + } + else if (recipient->getClient() == nullptr) + { + // GameServer::getInstance().sendToPlanetServer( + // GenericValueTypeMessage >( + // "RequestSameServer", + // std::make_pair( + // ContainerInterface::getTopmostContainer(*owner)->getNetworkId(), + // ContainerInterface::getTopmostContainer(*recipient)->getNetworkId())), + // true); + + // transfer player to authoritative server + //owner->transferAuthority(recipient->getAuthServerProcessId(), true, false); + //owner->sendControllerMessageToAuthServer(CM_secureTrade, new MessageQueueSecureTrade(MessageQueueSecureTrade::TMI_RequestTrade, owner->getNetworkId(), data->getRecipient())); + + // try again next frame + owner->sendControllerMessageToAuthServer(CM_secureTrade, new MessageQueueSecureTrade(MessageQueueSecureTrade::TMI_RequestTrade, owner->getNetworkId(), data->getRecipient())); + } + else if (!ServerSecureTradeManager::requestTradeWith(*owner, *recipient)) + { + MessageQueueSecureTrade * m = new MessageQueueSecureTrade(MessageQueueSecureTrade::TMI_DeniedPlayerBusy, owner->getNetworkId(), recipient->getNetworkId()); + appendMessage(static_cast(CM_secureTrade), 0.0f, m, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_CLIENT); + } + } + break; + + // we get this when the traders are on different servers, but the trade + // initiator can't be moved to our server + case MessageQueueSecureTrade::TMI_RequestTradeReversed: + { + CreatureObject * initiator = dynamic_cast(ServerWorld::findObjectByNetworkId(data->getInitiator())); + if (!initiator) + { + DEBUG_REPORT_LOG(true, ("Could not find initiator for reversed secure trade message\n")); + return; + } + if (!initiator->isAuthoritative()) + { + if (owner->isInWorldCell()) + { + // transfer player to authoritative server + owner->transferAuthority(initiator->getAuthServerProcessId(), true, false, true); + owner->sendControllerMessageToAuthServer(CM_secureTrade, new MessageQueueSecureTrade(MessageQueueSecureTrade::TMI_RequestTradeReversed, initiator->getNetworkId(), owner->getNetworkId())); + } + else + { + WARNING(true, ("Got TMI_RequestTradeReversed, but we are not in the world! Trade request abandoned.")); + return; + } + } + else + initiator->sendControllerMessageToAuthServer(CM_secureTrade, new MessageQueueSecureTrade(MessageQueueSecureTrade::TMI_RequestTrade, initiator->getNetworkId(), owner->getNetworkId())); + } + break; + + case MessageQueueSecureTrade::TMI_TradeRequested: + { + WARNING_STRICT_FATAL(true, ("Server should not receive this message\n")); + return; + } + break; case MessageQueueSecureTrade::TMI_AcceptTrade: + { + if (m_secureTrade || !m_secureTradeInitiator) { - if (m_secureTrade || !m_secureTradeInitiator) - { - DEBUG_REPORT_LOG(true, ("Trade acceptance denied because of previous trade or failed startup steps\n")); - return; - } - ServerSecureTradeManager::acceptTradeRequest(*m_secureTradeInitiator, *(static_cast(getOwner()))); - m_secureTradeInitiator = 0; - + DEBUG_REPORT_LOG(true, ("Trade acceptance denied because of previous trade or failed startup steps\n")); + return; } - break; + ServerSecureTradeManager::acceptTradeRequest(*m_secureTradeInitiator, *(static_cast(getOwner()))); + m_secureTradeInitiator = 0; + } + break; case MessageQueueSecureTrade::TMI_DeniedTrade: + { + if (m_secureTrade || !m_secureTradeInitiator) { - if (m_secureTrade || !m_secureTradeInitiator) - { - DEBUG_REPORT_LOG(true, ("Trade acceptance denied because of previous trade or failed startup steps\n")); - return; - } - ServerSecureTradeManager::refuseTrade(*m_secureTradeInitiator, *(static_cast(getOwner()))); - m_secureTradeInitiator = 0; - + DEBUG_REPORT_LOG(true, ("Trade acceptance denied because of previous trade or failed startup steps\n")); + return; } - break; + ServerSecureTradeManager::refuseTrade(*m_secureTradeInitiator, *(static_cast(getOwner()))); + m_secureTradeInitiator = 0; + } + break; default: - { - DEBUG_REPORT_LOG(true, ("Unhandled secure trade message type\n")); - } - break; + { + DEBUG_REPORT_LOG(true, ("Unhandled secure trade message type\n")); + } + break; } } @@ -1779,10 +1773,10 @@ bool CreatureController::tradeRequested(CreatureObject & initiator) //---------------------------------------------------------------------- -void CreatureController::sendGenericResponse (int responseType, int requestType, bool success, uint8 sequenceId) +void CreatureController::sendGenericResponse(int responseType, int requestType, bool success, uint8 sequenceId) { // send result back to player - MessageQueueGenericResponse * response = new MessageQueueGenericResponse (requestType, success, sequenceId); + MessageQueueGenericResponse * response = new MessageQueueGenericResponse(requestType, success, sequenceId); appendMessage(responseType, 0.0f, response, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_CLIENT); } @@ -1907,23 +1901,23 @@ void CreatureController::updateHibernate() bool CreatureController::shouldHibernate() const { - if(!ConfigServerGame::getHibernateEnabled()) + if (!ConfigServerGame::getHibernateEnabled()) return false; // ---------- CreatureObject const * creature = getCreature(); NOT_NULL(creature); - + // If the creature is static, it hibernates. - if(creature->getIsStatic()) + if (creature->getIsStatic()) return true; // If proxied creatures aren't allowed to hibernate and this creature is proxied, // it's not hibernating. - if(!ConfigServerGame::getHibernateProxies() && (creature->getProxyCount() > 0)) + if (!ConfigServerGame::getHibernateProxies() && (creature->getProxyCount() > 0)) return false; // if any players are observing me, don't hibernate @@ -1944,7 +1938,7 @@ bool CreatureController::getHibernate() const void CreatureController::setHibernate(bool newHibernate) { bool oldHibernate = getHibernate(); - if (oldHibernate == newHibernate) + if (oldHibernate == newHibernate) return; CreatureObject * owner = static_cast(getOwner()); @@ -1955,34 +1949,34 @@ void CreatureController::setHibernate(bool newHibernate) bool transitionOk = true; - if(newHibernate) + if (newHibernate) { ScriptParams params; int result = getServerOwner()->getScriptObject()->trigAllScripts(Scripting::TRIG_HIBERNATE_BEGIN, params); - if(result == SCRIPT_OVERRIDE) transitionOk = false; + if (result == SCRIPT_OVERRIDE) transitionOk = false; } else { ScriptParams params; int result = getServerOwner()->getScriptObject()->trigAllScripts(Scripting::TRIG_HIBERNATE_END, params); - if(result == SCRIPT_OVERRIDE) transitionOk = false; + if (result == SCRIPT_OVERRIDE) transitionOk = false; } // ---------- - if(transitionOk) + if (transitionOk) { - if(newHibernate) + if (newHibernate) { -// DEBUG_REPORT_LOG(true, ("[aitest] Hibernating %s\n", owner->getNetworkId().getValueString().c_str())); + // DEBUG_REPORT_LOG(true, ("[aitest] Hibernating %s\n", owner->getNetworkId().getValueString().c_str())); owner->setCondition(ServerTangibleObjectTemplate::C_hibernating); owner->setDefaultAlterTime(AlterResult::cms_keepNoAlter); } else { -// DEBUG_REPORT_LOG(true, ("[aitest] Waking up %s\n", owner->getNetworkId().getValueString().c_str())); + // DEBUG_REPORT_LOG(true, ("[aitest] Waking up %s\n", owner->getNetworkId().getValueString().c_str())); owner->clearCondition(ServerTangibleObjectTemplate::C_hibernating); if (owner->isPlayerControlled()) owner->setDefaultAlterTime(0); @@ -2013,70 +2007,70 @@ void CreatureController::calculateWaterState(bool& isSwimming, bool &isBurning, // Note: we do the real computation for the mount here because the rider gets // an alter prior to the mount. If we just checked the mount's swim state here, // we would be a frame behind on determining the player's swim state. - mountCreatureController->calculateWaterState(isSwimming,isBurning,lavaResistance,waterHeight); + mountCreatureController->calculateWaterState(isSwimming, isBurning, lavaResistance, waterHeight); return; } } //-- Determine if the owner is swimming. - CollisionProperty const * const collisionProperty = ownerCreature->getCollisionProperty (); + CollisionProperty const * const collisionProperty = ownerCreature->getCollisionProperty(); if (!collisionProperty) return; -// JU_TODO: disabled - possibly make burning a persistant state + // JU_TODO: disabled - possibly make burning a persistant state #if 0 //-- Don't recompute if we're idle --- it shouldn't have changed. bool const isIdle = collisionProperty && collisionProperty->isIdle(); if (isIdle) return ownerCreature->getState(States::Swimming); #endif -// JU_TODO: end disabled + // JU_TODO: end disabled - TerrainObject const * const terrainObject = TerrainObject::getConstInstance (); - bool const isOnSolidFloor = collisionProperty && collisionProperty->getFootprint () && collisionProperty->getFootprint ()->isOnSolidFloor (); + TerrainObject const * const terrainObject = TerrainObject::getConstInstance(); + bool const isOnSolidFloor = collisionProperty && collisionProperty->getFootprint() && collisionProperty->getFootprint()->isOnSolidFloor(); isSwimming = false; - - if (collisionProperty && ownerCreature->isInWorldCell () && !isOnSolidFloor) + + if (collisionProperty && ownerCreature->isInWorldCell() && !isOnSolidFloor) { - Vector const position = ownerCreature->getPosition_w (); + Vector const position = ownerCreature->getPosition_w(); float terrainHeight; Footprint const * foot = collisionProperty->getFootprint(); - + lavaResistance = ownerCreature->getLavaResistance(); bool const isImmuneToLava = (lavaResistance == 100.0f); - + TerrainGeneratorWaterType waterType = terrainObject->getWaterType(position); - if(!foot || !foot->getTerrainHeight(terrainHeight)) + if (!foot || !foot->getTerrainHeight(terrainHeight)) { - if(!terrainObject->getHeight(position,terrainHeight)) + if (!terrainObject->getHeight(position, terrainHeight)) { - if(!terrainObject->getHeightForceChunkCreation(position,terrainHeight)) + if (!terrainObject->getHeightForceChunkCreation(position, terrainHeight)) { return; } } } - + //-- see if the object is swimming and/or burning - if (terrainObject->getWaterHeight (position, waterHeight)) + if (terrainObject->getWaterHeight(position, waterHeight)) { - if(position.y - waterHeight < 1.0f && waterHeight >= terrainHeight) + if (position.y - waterHeight < 1.0f && waterHeight >= terrainHeight) { - float const swimHeight = ownerCreature->getSwimHeight (); + float const swimHeight = ownerCreature->getSwimHeight(); isSwimming = (terrainHeight + swimHeight) < waterHeight; - if(waterType == TGWT_lava) + if (waterType == TGWT_lava) { isSwimming = false; - if(!isImmuneToLava) + if (!isImmuneToLava) { isBurning = true; } } } } - } + } } // ---------------------------------------------------------------------- @@ -2089,10 +2083,10 @@ void CreatureController::onEnterSwimming() CreatureObject *const owner = safe_cast(getOwner()); if (!owner) return; - + //-- Set the state to swimming. owner->setState(States::Swimming, true); - + //-- Fire off the script trigger indicating that the owner is now swimming. ScriptParams params; IGNORE_RETURN(owner->getScriptObject()->trigAllScripts(Scripting::TRIG_ENTER_SWIMMING, params)); @@ -2108,10 +2102,10 @@ void CreatureController::onExitSwimming() CreatureObject *const owner = safe_cast(getOwner()); if (!owner) return; - + //-- Clear the state to swimming. owner->setState(States::Swimming, false); - + //-- Fire off the script trigger indicating that the owner is no longer swimming. ScriptParams params; IGNORE_RETURN(owner->getScriptObject()->trigAllScripts(Scripting::TRIG_EXIT_SWIMMING, params)); @@ -2189,4 +2183,4 @@ CreatureController const * CreatureController::asCreatureController(Controller c return (controller != nullptr) ? controller->asCreatureController() : nullptr; } -// ====================================================================== +// ====================================================================== \ No newline at end of file diff --git a/engine/server/library/serverGame/src/shared/core/ServerBuildoutManager.cpp b/engine/server/library/serverGame/src/shared/core/ServerBuildoutManager.cpp index cf247722..8c2617ad 100755 --- a/engine/server/library/serverGame/src/shared/core/ServerBuildoutManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/ServerBuildoutManager.cpp @@ -45,7 +45,6 @@ namespace ServerBuildoutManagerNamespace { - const int cs_buildingObjIdOffset = 2000; // ---------------------------------------------------------------------- @@ -80,23 +79,21 @@ namespace ServerBuildoutManagerNamespace struct ServerEventAreaInfo { - ServerEventAreaInfo(): - buildOut(nullptr), - loadedObject(nullptr) + ServerEventAreaInfo() : + buildOut(nullptr), + loadedObject(nullptr) { - } - ServerEventAreaInfo(BuildoutRow const * _buildOut, ServerObject* _loadedObject): - buildOut(_buildOut), - loadedObject(_loadedObject) + ServerEventAreaInfo(BuildoutRow const * _buildOut, ServerObject* _loadedObject) : + buildOut(_buildOut), + loadedObject(_loadedObject) { - } BuildoutRow const * buildOut; ServerObject* loadedObject; }; - + typedef std::map< std::string, std::list< ServerEventAreaInfo > > ServerEventMap; // ---------------------------------------------------------------------- @@ -120,7 +117,6 @@ namespace ServerBuildoutManagerNamespace #else const int64 cs_dataBitStripMask = 0x80000000ffffffffLL; #endif - } using namespace ServerBuildoutManagerNamespace; @@ -152,10 +148,10 @@ void ServerBuildoutManager::onChunkComplete(int nodeX, int nodeZ) for (std::vector::iterator i = s_areas.begin(); i != s_areas.end(); ++i) { AreaInfo &areaInfo = *i; - if ( nodeX < areaInfo.buildoutArea.rect.x1 - && nodeX+100 > areaInfo.buildoutArea.rect.x0 - && nodeZ < areaInfo.buildoutArea.rect.y1 - && nodeZ+100 > areaInfo.buildoutArea.rect.y0) + if (nodeX < areaInfo.buildoutArea.rect.x1 + && nodeX + 100 > areaInfo.buildoutArea.rect.x0 + && nodeZ < areaInfo.buildoutArea.rect.y1 + && nodeZ + 100 > areaInfo.buildoutArea.rect.y0) { if (!areaInfo.loaded) loadArea(areaInfo); @@ -168,7 +164,7 @@ void ServerBuildoutManager::onChunkComplete(int nodeX, int nodeZ) void ServerBuildoutManager::saveArea(std::string const &serverFileName, std::string const &clientFileName, float x1, float z1, float x2, float z2) { - FATAL( true, ( "ServerBuildoutManager::saveArea\n" ) ); + FATAL(true, ("ServerBuildoutManager::saveArea\n")); if (!ConfigServerGame::getBuildoutAreaEditingEnabled()) { @@ -214,12 +210,12 @@ void ServerBuildoutManager::saveArea(std::string const &serverFileName, std::str { ConstCharCrcString const &serverTemplateName = ObjectTemplateList::lookUp((*i).serverTemplateCrc); char buf[512]; - IGNORE_RETURN(snprintf(buf, sizeof(buf)-1, "%s\t%d\t%g\t%g\t%g\t%g\t%g\t%g\t%g\t", + IGNORE_RETURN(snprintf(buf, sizeof(buf) - 1, "%s\t%d\t%g\t%g\t%g\t%g\t%g\t%g\t%g\t", serverTemplateName.getString(), (*i).cellIndex, (*i).position.x, (*i).position.y, (*i).position.z, (*i).orientation.w, (*i).orientation.x, (*i).orientation.y, (*i).orientation.z)); - buf[sizeof(buf)-1] = '\0'; + buf[sizeof(buf) - 1] = '\0'; serverOutputFile.write(strlen(buf), buf); serverOutputFile.write((*i).scripts.length(), (*i).scripts.c_str()); serverOutputFile.write(1, "\t"); @@ -234,14 +230,14 @@ void ServerBuildoutManager::saveArea(std::string const &serverFileName, std::str { ConstCharCrcString const &sharedTemplateName = ObjectTemplateList::lookUp((*i).sharedTemplateCrc); char buf[512]; - IGNORE_RETURN(snprintf(buf, sizeof(buf)-1, "%s\t%d\t%g\t%g\t%g\t%g\t%g\t%g\t%g\t%g\t%d\n", + IGNORE_RETURN(snprintf(buf, sizeof(buf) - 1, "%s\t%d\t%g\t%g\t%g\t%g\t%g\t%g\t%g\t%g\t%d\n", sharedTemplateName.getString(), (*i).cellIndex, (*i).position.x, (*i).position.y, (*i).position.z, (*i).orientation.w, (*i).orientation.x, (*i).orientation.y, (*i).orientation.z, (*i).radius, static_cast((*i).portalLayoutCrc))); - buf[sizeof(buf)-1] = '\0'; + buf[sizeof(buf) - 1] = '\0'; clientOutputFile.write(strlen(buf), buf); } } @@ -262,14 +258,13 @@ void ServerBuildoutManager::clientSaveArea(Client &client, std::string const &ar std::vector clientRows; generateBuildoutData(x1, z1, x2, z2, serverRows, clientRows); - // pass them to the client GenericValueTypeMessage< std::pair< - std::pair, // scene, area - std::pair, std::vector > // serverRows, clientRows - > - > const message( + std::pair, // scene, area + std::pair, std::vector > // serverRows, clientRows + > + > const message( "GodClientSaveBuildoutArea", std::make_pair( std::make_pair(std::string(ConfigServerGame::getSceneID()), areaName), @@ -317,12 +312,12 @@ void ServerBuildoutManager::destroyPersistedDuplicates() for (std::vector::const_iterator k = objectsToTest.begin(); k != objectsToTest.end(); ++k) { ServerObject * const so = *k; - if ( so - && so->getNetworkId().getValue() != buildoutRow.m_id - && so->isPersisted() - && so->getTemplateCrc() == buildoutRow.m_serverTemplate->getCrcName().getCrc() - && so->getPosition_p().magnitudeBetweenSquared(buildoutRow.m_transform_p.getPosition_p()) < 0.005f - && ContainerInterface::getContainedByObject(*so) == container) + if (so + && so->getNetworkId().getValue() != buildoutRow.m_id + && so->isPersisted() + && so->getTemplateCrc() == buildoutRow.m_serverTemplate->getCrcName().getCrc() + && so->getPosition_p().magnitudeBetweenSquared(buildoutRow.m_transform_p.getPosition_p()) < 0.005f + && ContainerInterface::getContainedByObject(*so) == container) so->permanentlyDestroy(DeleteReasons::Replaced); } } @@ -377,12 +372,12 @@ void ServerBuildoutManagerNamespace::remove() void ServerBuildoutManagerNamespace::generateBuildoutData(float x1, float z1, float x2, float z2, std::vector &serverRows, std::vector &clientRows) { -// int objIdBase = -1; + // int objIdBase = -1; - typedef std::map ObjIdMap; + typedef std::map ObjIdMap; ObjIdMap objIdMap; - + std::vector objectsToSave; // build vector of objects we need to save, in the appropriate order @@ -408,9 +403,8 @@ void ServerBuildoutManagerNamespace::generateBuildoutData(float x1, float z1, fl { ServerObject const * const obj = *i; - // check for unexported gold data - if ( obj->getIncludeInBuildout() == false && obj->getNetworkId().getValue() < 10000000 ) + if (obj->getIncludeInBuildout() == false && obj->getNetworkId().getValue() < 10000000) { continue; } @@ -428,7 +422,6 @@ void ServerBuildoutManagerNamespace::generateBuildoutData(float x1, float z1, fl serverOnly = false; } - Quaternion const q(obj->getTransform_o2p()); Vector p(obj->getPosition_p()); int cellIndex = 0; @@ -461,30 +454,29 @@ void ServerBuildoutManagerNamespace::generateBuildoutData(float x1, float z1, fl serverRows.push_back(ServerBuildoutAreaRow()); ServerBuildoutAreaRow &serverRow = serverRows.back(); - serverRow.id = static_cast< int >( obj->getNetworkId().getValue() ); - serverRow.container = containingObject ? static_cast< int >( containingObject->getNetworkId().getValue() ) : 0; + serverRow.id = static_cast(obj->getNetworkId().getValue()); + serverRow.container = containingObject ? static_cast(containingObject->getNetworkId().getValue()) : 0; serverRow.serverTemplateCrc = obj->getTemplateCrc(); - serverRow.cellIndex = cellIndex; - serverRow.position = p; - serverRow.orientation = q; - serverRow.scripts = packedScriptList; - serverRow.objvars = obj->getPackedObjVars(std::string()); + serverRow.cellIndex = cellIndex; + serverRow.position = p; + serverRow.orientation = q; + serverRow.scripts = packedScriptList; + serverRow.objvars = obj->getPackedObjVars(std::string()); - - if ( serverRow.id >= 10000000 ) + if (serverRow.id >= 10000000) { serverRow.id = Random::random() | 0x80000000; // generate a negative random number. - objIdMap[ obj->getNetworkId().getValue() ] = serverRow.id; + objIdMap[obj->getNetworkId().getValue()] = serverRow.id; } else { serverRow.id &= cs_dataBitStripMask; // strip data bits } - if ( serverRow.container >= 10000000 ) + if (serverRow.container >= 10000000) { - ObjIdMap::const_iterator it = objIdMap.find( serverRow.container ); - FATAL( it == objIdMap.end(), ( "Unable to find the container relative objid for object %d\n", serverRow.id ) ); + ObjIdMap::const_iterator it = objIdMap.find(serverRow.container); + FATAL(it == objIdMap.end(), ("Unable to find the container relative objid for object %d\n", serverRow.id)); serverRow.container = it->second; } else @@ -497,17 +489,17 @@ void ServerBuildoutManagerNamespace::generateBuildoutData(float x1, float z1, fl clientRows.push_back(ClientBuildoutAreaRow()); ClientBuildoutAreaRow &clientRow = clientRows.back(); - clientRow.id = serverRow.id; - clientRow.container = serverRow.container; - clientRow.type = serverTemplate ? serverTemplate->getId() : 0; + clientRow.id = serverRow.id; + clientRow.container = serverRow.container; + clientRow.type = serverTemplate ? serverTemplate->getId() : 0; clientRow.sharedTemplateCrc = ConstCharCrcString(obj->getSharedTemplateName()).getCrc(); - clientRow.cellIndex = cellIndex; - clientRow.position = p; - clientRow.orientation = q; - clientRow.radius = serverTemplate->getUpdateRanges(ServerObjectTemplate::UR_far); + clientRow.cellIndex = cellIndex; + clientRow.position = p; + clientRow.orientation = q; + clientRow.radius = serverTemplate->getUpdateRanges(ServerObjectTemplate::UR_far); int portalLayoutCrc = 0; obj->getObjVars().getItem("portalProperty.crc", portalLayoutCrc); - clientRow.portalLayoutCrc = static_cast(portalLayoutCrc); + clientRow.portalLayoutCrc = static_cast(portalLayoutCrc); } } } @@ -549,49 +541,50 @@ void ServerBuildoutManagerNamespace::buildObjectsToSave(std::vector(ContainerInterface::getContainedByObject(*obj)); - - // make sure that cells that should be included in the buildout have all their - // children included too! - if ( obj->getObjectTemplate()->getId() == ServerCellObjectTemplate::ServerCellObjectTemplate_tag && containingObject && containingObject->getIncludeInBuildout() ) + if (obj) { - ServerObject *tmpObj = const_cast< ServerObject * >( obj ); - tmpObj->setIncludeInBuildout( true ); - } + const ServerObject * const containingObject = safe_cast(ContainerInterface::getContainedByObject(*obj)); - if ( !obj || !obj->isInWorld() || (!obj->isPersisted() && !obj->getIncludeInBuildout() ) || obj->isPlayerControlled() ) - { - return true; - } + // make sure that cells that should be included in the buildout have all their + // children included too! + if (obj->getObjectTemplate()->getId() == ServerCellObjectTemplate::ServerCellObjectTemplate_tag && containingObject && containingObject->getIncludeInBuildout()) + { + ServerObject *tmpObj = const_cast(obj); + tmpObj->setIncludeInBuildout(true); + } + if (!obj || !obj->isInWorld() || (!obj->isPersisted() && !obj->getIncludeInBuildout()) || obj->isPlayerControlled()) + { + return true; + } + } return false; - } // ---------------------------------------------------------------------- void ServerBuildoutManagerNamespace::loadArea(AreaInfo &areaInfo) { - int64 buildingObjId = areaInfo.buildoutArea.getSharedBaseId(); - int64 objIdBase = buildingObjId + cs_buildingObjIdOffset; - int64 currentBuilding = 0; - int64 currentCell = 0; + int64 buildingObjId = areaInfo.buildoutArea.getSharedBaseId(); + int64 objIdBase = buildingObjId + cs_buildingObjIdOffset; + int64 currentBuilding = 0; + int64 currentCell = 0; - int serverIdBase = areaInfo.buildoutArea.getServerBaseId(); + int serverIdBase = areaInfo.buildoutArea.getServerBaseId(); const bool isBuildoutEditingEnabled = ConfigServerGame::getBuildoutAreaEditingEnabled(); - UNREF( isBuildoutEditingEnabled ); + UNREF(isBuildoutEditingEnabled); char filename[256]; - snprintf(filename, sizeof(filename)-1, "datatables/buildout/%s/%s.iff", ConfigServerGame::getSceneID(), areaInfo.buildoutArea.areaName.c_str()); - filename[sizeof(filename)-1] = '\0'; + snprintf(filename, sizeof(filename) - 1, "datatables/buildout/%s/%s.iff", ConfigServerGame::getSceneID(), areaInfo.buildoutArea.areaName.c_str()); + filename[sizeof(filename) - 1] = '\0'; std::string const & eventRequired = areaInfo.buildoutArea.getRequiredEventName(); - if(!eventRequired.empty()) + if (!eventRequired.empty()) { ServerEventMap::iterator iter = s_eventObjects.find(eventRequired); - if(iter != s_eventObjects.end()) + if (iter != s_eventObjects.end()) { // Nothing to do here. We've already setup a list for this event. //eventObjList = &(*iter).second; @@ -600,11 +593,10 @@ void ServerBuildoutManagerNamespace::loadArea(AreaInfo &areaInfo) { s_eventObjects.insert(std::pair >(eventRequired, std::list())); } - } Iff iff; - if (!areaInfo.buildoutArea.areaName.empty() && iff.open(filename, true) && !iff.atEndOfForm() ) + if (!areaInfo.buildoutArea.areaName.empty() && iff.open(filename, true) && !iff.atEndOfForm()) { DataTable areaBuildoutTable; areaBuildoutTable.load(iff); @@ -614,19 +606,19 @@ void ServerBuildoutManagerNamespace::loadArea(AreaInfo &areaInfo) { areaInfo.buildoutRows.reserve(buildoutRowCount); - int const objIdColumn = areaBuildoutTable.findColumnNumber( "objid" ); - int const containerColumn = areaBuildoutTable.findColumnNumber( "container" ); + int const objIdColumn = areaBuildoutTable.findColumnNumber("objid"); + int const containerColumn = areaBuildoutTable.findColumnNumber("container"); int const serverTemplateCrcColumn = areaBuildoutTable.findColumnNumber("server_template_crc"); - int const cellIndexColumn = areaBuildoutTable.findColumnNumber("cell_index"); - int const pxColumn = areaBuildoutTable.findColumnNumber("px"); - int const pyColumn = areaBuildoutTable.findColumnNumber("py"); - int const pzColumn = areaBuildoutTable.findColumnNumber("pz"); - int const qwColumn = areaBuildoutTable.findColumnNumber("qw"); - int const qxColumn = areaBuildoutTable.findColumnNumber("qx"); - int const qyColumn = areaBuildoutTable.findColumnNumber("qy"); - int const qzColumn = areaBuildoutTable.findColumnNumber("qz"); - int const scriptsColumn = areaBuildoutTable.findColumnNumber("scripts"); - int const objvarsColumn = areaBuildoutTable.findColumnNumber("objvars"); + int const cellIndexColumn = areaBuildoutTable.findColumnNumber("cell_index"); + int const pxColumn = areaBuildoutTable.findColumnNumber("px"); + int const pyColumn = areaBuildoutTable.findColumnNumber("py"); + int const pzColumn = areaBuildoutTable.findColumnNumber("pz"); + int const qwColumn = areaBuildoutTable.findColumnNumber("qw"); + int const qxColumn = areaBuildoutTable.findColumnNumber("qx"); + int const qyColumn = areaBuildoutTable.findColumnNumber("qy"); + int const qzColumn = areaBuildoutTable.findColumnNumber("qz"); + int const scriptsColumn = areaBuildoutTable.findColumnNumber("scripts"); + int const objvarsColumn = areaBuildoutTable.findColumnNumber("objvars"); FATAL(serverTemplateCrcColumn < 0, ("Unable to find serverTemplateCrcColumn in [%s]", filename)); FATAL(cellIndexColumn < 0, ("Unable to find cellIndexColumn in [%s]", filename)); @@ -642,20 +634,18 @@ void ServerBuildoutManagerNamespace::loadArea(AreaInfo &areaInfo) int buildOutFileVersion = 1; - if ( objIdColumn != -1 ) + if (objIdColumn != -1) { buildOutFileVersion = 2; } - + std::set< int64 > objects; for (int buildoutRow = 0; buildoutRow < buildoutRowCount; ++buildoutRow) { - - int64 objId = 0; + int64 objId = 0; int64 containerId = 0; - uint32 const serverTemplateCrc = static_cast(areaBuildoutTable.getIntValue(serverTemplateCrcColumn, buildoutRow)); unsigned int const cellIndex = areaBuildoutTable.getIntValue(cellIndexColumn, buildoutRow); @@ -673,7 +663,7 @@ void ServerBuildoutManagerNamespace::loadArea(AreaInfo &areaInfo) FATAL(!sharedTemplate, ("Bad shared template [%s] for [%s] in buildout table %s, row %d (line %d)", sharedTemplateName.c_str(), serverTemplateBase->getName(), areaInfo.buildoutArea.areaName.c_str(), buildoutRow, buildoutRow + 3)); bool const isPob = !sharedTemplate->getPortalLayoutFilename().empty(); sharedTemplateBase->releaseReference(); - + bool serverOnly = false; if (!isPob && dynamic_cast(serverTemplate)) { @@ -684,26 +674,25 @@ void ServerBuildoutManagerNamespace::loadArea(AreaInfo &areaInfo) serverOnly = false; } - - if ( buildOutFileVersion == 1 ) + if (buildOutFileVersion == 1) { - if ( isPob ) // if ( is a building ) + if (isPob) // if ( is a building ) { objId = buildingObjId++; currentBuilding = objId; } - else if ( serverTemplate->getId() == ServerCellObjectTemplate::ServerCellObjectTemplate_tag ) // if ( is a cell ) + else if (serverTemplate->getId() == ServerCellObjectTemplate::ServerCellObjectTemplate_tag) // if ( is a cell ) { objId = buildingObjId++; currentCell = objId; containerId = currentBuilding; } - else if ( cellIndex > 0 ) // if ( is an object in a cell ) + else if (cellIndex > 0) // if ( is an object in a cell ) { objId = objIdBase++; containerId = currentCell; } - else if ( serverOnly ) + else if (serverOnly) { objId = serverIdBase++; } @@ -712,34 +701,32 @@ void ServerBuildoutManagerNamespace::loadArea(AreaInfo &areaInfo) objId = objIdBase++; } - FATAL( buildingObjId >= areaInfo.buildoutArea.getSharedBaseId() + cs_buildingObjIdOffset, ( "building object id overflow" ) ); + FATAL(buildingObjId >= areaInfo.buildoutArea.getSharedBaseId() + cs_buildingObjIdOffset, ("building object id overflow")); } else { - objId = areaBuildoutTable.getIntValue(objIdColumn, buildoutRow); + objId = areaBuildoutTable.getIntValue(objIdColumn, buildoutRow); containerId = areaBuildoutTable.getIntValue(containerColumn, buildoutRow); - + // with new buildout files, the object id is a random 31-bit negative value // then we give the area index some bits in the upper part of the number // by shifting the area index value left 48 bits. const int64 areaIndex = areaInfo.buildoutArea.areaIndex + 1; - if ( objId < 0 ) + if (objId < 0) { - objId ^= areaIndex << 48; } - if ( containerId < 0 ) + if (containerId < 0) { containerId ^= areaIndex << 48; } - } - FATAL( isPob && ( cellIndex != 0 || containerId != 0 ), ( "tried to add a pob to a cell or other container. %s (objId=%d cellIndex=%d containerId=%d)", - serverTemplateBase->getName(), objId, cellIndex,containerId ) ); + FATAL(isPob && (cellIndex != 0 || containerId != 0), ("tried to add a pob to a cell or other container. %s (objId=%d cellIndex=%d containerId=%d)", + serverTemplateBase->getName(), objId, cellIndex, containerId)); Quaternion const q( areaBuildoutTable.getFloatValue(qwColumn, buildoutRow), @@ -751,7 +738,7 @@ void ServerBuildoutManagerNamespace::loadArea(AreaInfo &areaInfo) q.getTransform(&transform_p); - if ( cellIndex == 0 ) + if (cellIndex == 0) { transform_p.setPosition_p( areaBuildoutTable.getFloatValue(pxColumn, buildoutRow) + areaInfo.buildoutArea.rect.x0, @@ -766,7 +753,7 @@ void ServerBuildoutManagerNamespace::loadArea(AreaInfo &areaInfo) areaBuildoutTable.getFloatValue(pzColumn, buildoutRow)); } - if ( containerId == 0 || objects.find ( containerId ) != objects.end() ) + if (containerId == 0 || objects.find(containerId) != objects.end()) { areaInfo.buildoutRows.push_back( BuildoutRow( @@ -780,7 +767,7 @@ void ServerBuildoutManagerNamespace::loadArea(AreaInfo &areaInfo) eventRequired)); } - objects.insert( objId ); + objects.insert(objId); serverTemplateBase->releaseReference(); } @@ -810,13 +797,12 @@ void ServerBuildoutManagerNamespace::instantiateAreaNode(AreaInfo const &areaInf UNREF(nodeZ); UNREF(nodeX); - std::vector newObjects; int buildingId = 0; int cellIndex = 0; UNREF(cellIndex); - UNREF( buildingId ); + UNREF(buildingId); NetworkId controllerObjectId; @@ -824,8 +810,8 @@ void ServerBuildoutManagerNamespace::instantiateAreaNode(AreaInfo const &areaInf PlanetObject * const planetObject = ServerUniverse::getInstance().getTatooinePlanet(); std::vector events; - - if(planetObject) + + if (planetObject) planetObject->parseCurrentEventsList(events); for (std::vector::const_iterator rowIter = areaInfo.buildoutRows.begin(); rowIter != areaInfo.buildoutRows.end(); ++rowIter) @@ -836,7 +822,7 @@ void ServerBuildoutManagerNamespace::instantiateAreaNode(AreaInfo const &areaInf int64 const containerId = buildoutRow.m_containerId; - if ( containerId && discardContainedObjects ) + if (containerId && discardContainedObjects) { continue; } @@ -860,21 +846,21 @@ void ServerBuildoutManagerNamespace::instantiateAreaNode(AreaInfo const &areaInf } // reject object if it is out of bounds and is not the controller - if ( !containerId && objectId != controllerObjectId ) + if (!containerId && objectId != controllerObjectId) { const Vector &position_w = buildoutRow.m_transform_p.getPosition_p(); - if ( position_w.x < nodeX || position_w.x >= nodeX+100 || position_w.z < nodeZ || position_w.z >= nodeZ+100 ) + if (position_w.x < nodeX || position_w.x >= nodeX + 100 || position_w.z < nodeZ || position_w.z >= nodeZ + 100) { discardContainedObjects = true; continue; } } - if(!buildoutRow.m_eventRequired.empty()) + if (!buildoutRow.m_eventRequired.empty()) { ServerEventMap::iterator searchIter = s_eventObjects.find(buildoutRow.m_eventRequired); - if(searchIter != s_eventObjects.end()) + if (searchIter != s_eventObjects.end()) { ServerEventAreaInfo newEventObj(&buildoutRow, nullptr); (*searchIter).second.push_back(newEventObj); @@ -883,28 +869,27 @@ void ServerBuildoutManagerNamespace::instantiateAreaNode(AreaInfo const &areaInf { DEBUG_REPORT_LOG(true, ("ServerBuildoutManager: Tried to load an unknown event object. Event name: %s\n", buildoutRow.m_eventRequired.c_str())); } - - if(planetObject) // We have a valid Tatooine Planet Object which keeps track of our universe wide events. + + if (planetObject) // We have a valid Tatooine Planet Object which keeps track of our universe wide events. { bool eventCurrentlyRunning = false; - + std::vector::size_type i = 0; - for(; i < events.size(); ++i) + for (; i < events.size(); ++i) { - if(events[i] == buildoutRow.m_eventRequired) // Is our required event already running? + if (events[i] == buildoutRow.m_eventRequired) // Is our required event already running? eventCurrentlyRunning = true; } - if(!eventCurrentlyRunning) + if (!eventCurrentlyRunning) continue; // We found an event object but their event isn't started yet. Hold off on Object creation. } else continue; // No planet object. This should NEVER happen. Better hold off on any event object creation for now. - } - + ServerObject * const containingObject = containerId ? safe_cast(NetworkIdManager::getObjectById(NetworkId(static_cast(containerId)))) : 0; - FATAL(containerId && !containingObject, ("could not find containing object obj=%d container=%d", (int)objectId.getValue(), containerId )); + FATAL(containerId && !containingObject, ("could not find containing object obj=%d container=%d", (int)objectId.getValue(), containerId)); //-- object has already been created //-- this must be the controller object or one of its contents. @@ -921,7 +906,7 @@ void ServerBuildoutManagerNamespace::instantiateAreaNode(AreaInfo const &areaInf if (newCellObject) { - newCellObject->setCell( buildoutRow.m_cellIndex ); + newCellObject->setCell(buildoutRow.m_cellIndex); } if (!newObject->getController()) @@ -940,15 +925,15 @@ void ServerBuildoutManagerNamespace::instantiateAreaNode(AreaInfo const &areaInf // to client-cache any objects otherwise we will not be able to // move them around or delete them, etc. // - + const bool isEditing = ConfigServerGame::getBuildoutAreaEditingEnabled(); - - if ( isEditing == false ) + + if (isEditing == false) { // // cells and their parents should NOT BE CLIENT CACHED // - if ( newObject->asCellObject() ) + if (newObject->asCellObject()) { // by the time we get here the cache version on the POB has // already been set to non-zero, so we need to reset it back @@ -970,12 +955,12 @@ void ServerBuildoutManagerNamespace::instantiateAreaNode(AreaInfo const &areaInf // them in god mode!!! // const int vfCount = buildoutRow.m_serverTemplate->getVisibleFlagsCount(); - - for ( int index = 0; index < vfCount ; ++index ) + + for (int index = 0; index < vfCount; ++index) { - const ServerObjectTemplate::VisibleFlags vf = buildoutRow.m_serverTemplate->getVisibleFlags( index ); - - if ( vf == ServerObjectTemplate::VF_player && buildoutRow.m_eventRequired.empty()) // Event objects can never be client cached currently. + const ServerObjectTemplate::VisibleFlags vf = buildoutRow.m_serverTemplate->getVisibleFlags(index); + + if (vf == ServerObjectTemplate::VF_player && buildoutRow.m_eventRequired.empty()) // Event objects can never be client cached currently. { newObject->setCacheVersion(s_buildoutCacheVersion); break; @@ -983,8 +968,7 @@ void ServerBuildoutManagerNamespace::instantiateAreaNode(AreaInfo const &areaInf } } } - - + if (buildoutRow.m_transform_p != Transform::identity) { newObject->setTransform_o2p(buildoutRow.m_transform_p); @@ -1005,7 +989,7 @@ void ServerBuildoutManagerNamespace::instantiateAreaNode(AreaInfo const &areaInf { newObject->setPackedObjVars(buildoutRow.m_objvars); } - + int const count = buildoutRow.m_serverTemplate->getScriptsCount(); for (int j = 0; j < count; ++j) @@ -1027,7 +1011,7 @@ void ServerBuildoutManagerNamespace::instantiateAreaNode(AreaInfo const &areaInf while (scripts[pos] && scripts[pos] != ':') ++pos; - std::string const & scriptName = scripts.substr(oldPos, pos-oldPos); + std::string const & scriptName = scripts.substr(oldPos, pos - oldPos); if (!gso->hasScript(scriptName)) IGNORE_RETURN(gso->attachScript(scriptName, false)); @@ -1038,10 +1022,10 @@ void ServerBuildoutManagerNamespace::instantiateAreaNode(AreaInfo const &areaInf } newObjects.push_back(newObject); - if(!buildoutRow.m_eventRequired.empty()) + if (!buildoutRow.m_eventRequired.empty()) { ServerEventMap::iterator searchIter = s_eventObjects.find(buildoutRow.m_eventRequired); - if(searchIter != s_eventObjects.end()) + if (searchIter != s_eventObjects.end()) { ServerEventAreaInfo & newEventObj = (*searchIter).second.back(); newEventObj.loadedObject = newObject; @@ -1058,7 +1042,7 @@ void ServerBuildoutManagerNamespace::instantiateAreaNode(AreaInfo const &areaInf } // run through newly instantiated objects and notify the controller object - if ( controllerObjectId.isValid() ) + if (controllerObjectId.isValid()) { ServerObject * const controllerObject = safe_cast(NetworkIdManager::getObjectById(controllerObjectId)); if (nullptr != controllerObject) @@ -1070,12 +1054,12 @@ void ServerBuildoutManagerNamespace::instantiateAreaNode(AreaInfo const &areaInf ServerObject * const obj = *it; if (obj == controllerObject) continue; - + int registerWithController = 0; if (obj->getObjVars().getItem("registerWithController", registerWithController)) { if (registerWithController) - { + { if (nullptr != script) { ScriptParams p; @@ -1090,36 +1074,33 @@ void ServerBuildoutManagerNamespace::instantiateAreaNode(AreaInfo const &areaInf // initialize any theaters { - for (std::vector::reverse_iterator it = newObjects.rbegin(); it != newObjects.rend(); ++it) { ServerObject *obj = *it; - if ( obj && obj->isAuthoritative() ) + if (obj && obj->isAuthoritative()) { GameScriptObject *scripts = obj->getScriptObject(); - - if ( scripts ) //&& scripts->hasScript( "poi.template.scene.base.base_theater" ) ) + + if (scripts) //&& scripts->hasScript( "poi.template.scene.base.base_theater" ) ) { - scripts->handleMessage( "startTheaterFromBuildout", std::vector() ); + scripts->handleMessage("startTheaterFromBuildout", std::vector()); } - } } } - } // ---------------------------------------------------------------------- ServerBuildoutManagerNamespace::BuildoutRow::BuildoutRow() : -m_id(0), -m_containerId(0), -m_transform_p(), -m_serverTemplate(0), -m_scripts(), -m_objvars(), -m_cellIndex(0) + m_id(0), + m_containerId(0), + m_transform_p(), + m_serverTemplate(0), + m_scripts(), + m_objvars(), + m_cellIndex(0) { } @@ -1190,12 +1171,12 @@ ServerBuildoutManagerNamespace::BuildoutRow &ServerBuildoutManagerNamespace::Bui void ServerBuildoutManager::onEventStarted(std::string const & eventName) { - if(s_eventObjects.empty()) + if (s_eventObjects.empty()) return; ServerEventMap::iterator iter = s_eventObjects.find(eventName); - - if(iter == s_eventObjects.end()) + + if (iter == s_eventObjects.end()) return; // Perhaps we should print a warning here? Would we ever have an event with no server side event objects? std::list< ServerEventAreaInfo >* eventList = &(*iter).second; @@ -1204,7 +1185,7 @@ void ServerBuildoutManager::onEventStarted(std::string const & eventName) NetworkId controllerObjectId; std::list< ServerEventAreaInfo >::iterator objIter = eventList->begin(); - for(; objIter != eventList->end(); ++objIter) + for (; objIter != eventList->end(); ++objIter) { // Object Creation @@ -1232,7 +1213,7 @@ void ServerBuildoutManager::onEventStarted(std::string const & eventName) } ServerObject * const containingObject = containerId ? safe_cast(NetworkIdManager::getObjectById(NetworkId(static_cast(containerId)))) : 0; - FATAL(containerId && !containingObject, ("could not find containing object obj=%d container=%d", (int)objectId.getValue(), containerId )); + FATAL(containerId && !containingObject, ("could not find containing object obj=%d container=%d", (int)objectId.getValue(), containerId)); //-- object has already been created //-- this must be the controller object or one of its contents. @@ -1242,9 +1223,9 @@ void ServerBuildoutManager::onEventStarted(std::string const & eventName) ServerObject * const newObject = safe_cast(buildoutRow.m_serverTemplate->createObject()); FATAL(!newObject, ("could not create buildout object")); - LOGC(ConfigServerGame::getLogEventObjectCreation(),"EventBuildout", ("Loading Object for Event [%s].\nTemplate Name[%s]\nNetwork ID[%s]\nCell[%d]\nPosition[%-4.3f %-4.3f %-4.3f]\n\n", - eventName.c_str(), buildoutRow.m_serverTemplate->getName(), objectId.getValueString().c_str(),buildoutRow.m_cellIndex, - buildoutRow.m_transform_p.getPosition_p().x, buildoutRow.m_transform_p.getPosition_p().y, buildoutRow.m_transform_p.getPosition_p().z)); + LOGC(ConfigServerGame::getLogEventObjectCreation(), "EventBuildout", ("Loading Object for Event [%s].\nTemplate Name[%s]\nNetwork ID[%s]\nCell[%d]\nPosition[%-4.3f %-4.3f %-4.3f]\n\n", + eventName.c_str(), buildoutRow.m_serverTemplate->getName(), objectId.getValueString().c_str(), buildoutRow.m_cellIndex, + buildoutRow.m_transform_p.getPosition_p().x, buildoutRow.m_transform_p.getPosition_p().y, buildoutRow.m_transform_p.getPosition_p().z)); newObject->setNetworkId(objectId); newObject->setIncludeInBuildout(true); @@ -1253,7 +1234,7 @@ void ServerBuildoutManager::onEventStarted(std::string const & eventName) if (newCellObject) { - newCellObject->setCell( buildoutRow.m_cellIndex ); + newCellObject->setCell(buildoutRow.m_cellIndex); } if (!newObject->getController()) @@ -1275,12 +1256,12 @@ void ServerBuildoutManager::onEventStarted(std::string const & eventName) const bool isEditing = ConfigServerGame::getBuildoutAreaEditingEnabled(); - if ( isEditing == false ) + if (isEditing == false) { // // cells and their parents should NOT BE CLIENT CACHED // - if ( newObject->asCellObject() ) + if (newObject->asCellObject()) { // by the time we get here the cache version on the POB has // already been set to non-zero, so we need to reset it back @@ -1303,11 +1284,11 @@ void ServerBuildoutManager::onEventStarted(std::string const & eventName) // const int vfCount = buildoutRow.m_serverTemplate->getVisibleFlagsCount(); - for ( int index = 0; index < vfCount ; ++index ) + for (int index = 0; index < vfCount; ++index) { - const ServerObjectTemplate::VisibleFlags vf = buildoutRow.m_serverTemplate->getVisibleFlags( index ); + const ServerObjectTemplate::VisibleFlags vf = buildoutRow.m_serverTemplate->getVisibleFlags(index); - if ( vf == ServerObjectTemplate::VF_player ) + if (vf == ServerObjectTemplate::VF_player) { // Removing this code temporarily since we don't have a proper way to do client side, cached event build out objects. // All event objects are objects that are streamed down from the server. Until we have a way for the client to know @@ -1320,7 +1301,6 @@ void ServerBuildoutManager::onEventStarted(std::string const & eventName) } } - if (buildoutRow.m_transform_p != Transform::identity) { newObject->setTransform_o2p(buildoutRow.m_transform_p); @@ -1363,7 +1343,7 @@ void ServerBuildoutManager::onEventStarted(std::string const & eventName) while (scripts[pos] && scripts[pos] != ':') ++pos; - std::string const & scriptName = scripts.substr(oldPos, pos-oldPos); + std::string const & scriptName = scripts.substr(oldPos, pos - oldPos); if (!gso->hasScript(scriptName)) IGNORE_RETURN(gso->attachScript(scriptName, false)); @@ -1373,12 +1353,11 @@ void ServerBuildoutManager::onEventStarted(std::string const & eventName) } } - (*objIter).loadedObject = newObject; + (*objIter).loadedObject = newObject; newObjects.push_back(newObject); } - // run through newly instantiated objects and initialize them { for (std::vector::reverse_iterator it = newObjects.rbegin(); it != newObjects.rend(); ++it) @@ -1388,7 +1367,7 @@ void ServerBuildoutManager::onEventStarted(std::string const & eventName) } // run through newly instantiated objects and notify the controller object - if ( controllerObjectId.isValid() ) + if (controllerObjectId.isValid()) { ServerObject * const controllerObject = safe_cast(NetworkIdManager::getObjectById(controllerObjectId)); if (nullptr != controllerObject) @@ -1405,7 +1384,7 @@ void ServerBuildoutManager::onEventStarted(std::string const & eventName) if (obj->getObjVars().getItem("registerWithController", registerWithController)) { if (registerWithController) - { + { if (nullptr != script) { ScriptParams p; @@ -1420,20 +1399,18 @@ void ServerBuildoutManager::onEventStarted(std::string const & eventName) // initialize any theaters { - for (std::vector::reverse_iterator it = newObjects.rbegin(); it != newObjects.rend(); ++it) { ServerObject *obj = *it; - if ( obj && obj->isAuthoritative() ) + if (obj && obj->isAuthoritative()) { GameScriptObject *scripts = obj->getScriptObject(); - if ( scripts ) //&& scripts->hasScript( "poi.template.scene.base.base_theater" ) ) + if (scripts) //&& scripts->hasScript( "poi.template.scene.base.base_theater" ) ) { - scripts->handleMessage( "startTheaterFromBuildout", std::vector() ); + scripts->handleMessage("startTheaterFromBuildout", std::vector()); } - } } } @@ -1443,33 +1420,32 @@ void ServerBuildoutManager::onEventStarted(std::string const & eventName) void ServerBuildoutManager::onEventStopped(std::string const & eventName) { - if(s_eventObjects.empty()) + if (s_eventObjects.empty()) return; ServerEventMap::iterator iter = s_eventObjects.find(eventName); - if(iter == s_eventObjects.end()) + if (iter == s_eventObjects.end()) return; // We stopped an event with no objects? Warning? std::list< ServerEventAreaInfo >* eventList = &(*iter).second; std::list< ServerEventAreaInfo >::iterator objIter = eventList->begin(); - for(; objIter != eventList->end(); ++objIter) + for (; objIter != eventList->end(); ++objIter) { // Object clean up. - if((*objIter).loadedObject) + if ((*objIter).loadedObject) { ServerObject* object = (*objIter).loadedObject; - + LOGC(ConfigServerGame::getLogEventObjectDestruction(), "EventBuildout", ("Unloading Object for Event [%s].\nTemplate Name[%s]\nNetwork ID[%s]\nPosition[%-4.3f %-4.3f %-4.3f]\n\n", eventName.c_str(), object->getTemplateName(), object->getNetworkId().getValueString().c_str(), object->getTransform_o2p().getPosition_p().x, object->getTransform_o2p().getPosition_p().y, object->getTransform_o2p().getPosition_p().z)); - + object->unload(); - + (*objIter).loadedObject = nullptr; } } } -// ====================================================================== - +// ====================================================================== \ No newline at end of file diff --git a/engine/server/library/serverGame/src/shared/object/LineOfSightCache.cpp b/engine/server/library/serverGame/src/shared/object/LineOfSightCache.cpp index 3d3c72ff..d68143f2 100755 --- a/engine/server/library/serverGame/src/shared/object/LineOfSightCache.cpp +++ b/engine/server/library/serverGame/src/shared/object/LineOfSightCache.cpp @@ -56,7 +56,7 @@ void LineOfSightCache::update() while (!s_lineOfSightCacheExpireQueue.empty()) { LineOfSightCacheExpireQueueEntry const &entry = s_lineOfSightCacheExpireQueue.front(); - if (static_cast(entry.second-frameStartTime) > 0) + if (static_cast(entry.second - frameStartTime) > 0) break; IGNORE_RETURN(s_lineOfSightCacheMap.erase(entry.first)); s_lineOfSightCacheExpireQueue.pop(); @@ -64,7 +64,7 @@ void LineOfSightCache::update() while (!s_lineOfSightLocationCacheExpireQueue.empty()) { LineOfSightLocationCacheExpireQueueEntry const &entry = s_lineOfSightLocationCacheExpireQueue.front(); - if (static_cast(entry.second-frameStartTime) > 0) + if (static_cast(entry.second - frameStartTime) > 0) break; IGNORE_RETURN(s_lineOfSightLocationCacheMap.erase(entry.first)); s_lineOfSightLocationCacheExpireQueue.pop(); @@ -435,5 +435,4 @@ bool LineOfSightCache::checkLOS(Object const &a, Location const &b) return (*result.first).second; } -// ====================================================================== - +// ====================================================================== \ No newline at end of file diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerArmorTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerArmorTemplate.cpp index e5cac8d4..2e644ad9 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerArmorTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerArmorTemplate.cpp @@ -23,22 +23,22 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool ServerArmorTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ ServerArmorTemplate::ServerArmorTemplate(const std::string & filename) //@BEGIN TFD INIT : ObjectTemplate(filename) - ,m_specialProtectionLoaded(false) - ,m_specialProtectionAppend(false) - ,m_versionOk(true) -//@END TFD INIT + , m_specialProtectionLoaded(false) + , m_specialProtectionAppend(false) + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // ServerArmorTemplate::ServerArmorTemplate @@ -47,7 +47,7 @@ ServerArmorTemplate::ServerArmorTemplate(const std::string & filename) */ ServerArmorTemplate::~ServerArmorTemplate() { -//@BEGIN TFD CLEANUP + //@BEGIN TFD CLEANUP { std::vector::iterator iter; for (iter = m_specialProtection.begin(); iter != m_specialProtection.end(); ++iter) @@ -57,7 +57,7 @@ ServerArmorTemplate::~ServerArmorTemplate() } m_specialProtection.clear(); } -//@END TFD CLEANUP + //@END TFD CLEANUP } // ServerArmorTemplate::~ServerArmorTemplate /** @@ -116,8 +116,6 @@ Tag ServerArmorTemplate::getHighestTemplateVersion(void) const //@BEGIN TFD ServerArmorTemplate::ArmorRating ServerArmorTemplate::getRating() const { - - const ServerArmorTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -145,8 +143,6 @@ ServerArmorTemplate::ArmorRating ServerArmorTemplate::getRating() const int ServerArmorTemplate::getIntegrity() const { - - const ServerArmorTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -196,8 +192,6 @@ int ServerArmorTemplate::getIntegrity() const int ServerArmorTemplate::getIntegrityMin() const { - - const ServerArmorTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -247,8 +241,6 @@ int ServerArmorTemplate::getIntegrityMin() const int ServerArmorTemplate::getIntegrityMax() const { - - const ServerArmorTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -298,8 +290,6 @@ int ServerArmorTemplate::getIntegrityMax() const int ServerArmorTemplate::getEffectiveness() const { - - const ServerArmorTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -349,8 +339,6 @@ int ServerArmorTemplate::getEffectiveness() const int ServerArmorTemplate::getEffectivenessMin() const { - - const ServerArmorTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -400,8 +388,6 @@ int ServerArmorTemplate::getEffectivenessMin() const int ServerArmorTemplate::getEffectivenessMax() const { - - const ServerArmorTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -462,7 +448,7 @@ void ServerArmorTemplate::getSpecialProtection(SpecialProtection &data, int inde if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter specialProtection in template %s", DataResource::getName())); - return ; + return; } else { @@ -476,10 +462,10 @@ void ServerArmorTemplate::getSpecialProtection(SpecialProtection &data, int inde { int baseCount = base->getSpecialProtectionCount(); if (index < baseCount) - { - base->getSpecialProtection(data, index); - return; - } + { + base->getSpecialProtection(data, index); + return; + } index -= baseCount; } @@ -505,7 +491,7 @@ void ServerArmorTemplate::getSpecialProtectionMin(SpecialProtection &data, int i if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter specialProtection in template %s", DataResource::getName())); - return ; + return; } else { @@ -519,10 +505,10 @@ void ServerArmorTemplate::getSpecialProtectionMin(SpecialProtection &data, int i { int baseCount = base->getSpecialProtectionCount(); if (index < baseCount) - { - base->getSpecialProtectionMin(data, index); - return; - } + { + base->getSpecialProtectionMin(data, index); + return; + } index -= baseCount; } @@ -548,7 +534,7 @@ void ServerArmorTemplate::getSpecialProtectionMax(SpecialProtection &data, int i if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter specialProtection in template %s", DataResource::getName())); - return ; + return; } else { @@ -562,10 +548,10 @@ void ServerArmorTemplate::getSpecialProtectionMax(SpecialProtection &data, int i { int baseCount = base->getSpecialProtectionCount(); if (index < baseCount) - { - base->getSpecialProtectionMax(data, index); - return; - } + { + base->getSpecialProtectionMax(data, index); + return; + } index -= baseCount; } @@ -604,8 +590,6 @@ size_t ServerArmorTemplate::getSpecialProtectionCount(void) const int ServerArmorTemplate::getVulnerability() const { - - const ServerArmorTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -655,8 +639,6 @@ int ServerArmorTemplate::getVulnerability() const int ServerArmorTemplate::getVulnerabilityMin() const { - - const ServerArmorTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -706,8 +688,6 @@ int ServerArmorTemplate::getVulnerabilityMin() const int ServerArmorTemplate::getVulnerabilityMax() const { - - const ServerArmorTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -902,7 +882,6 @@ int ServerArmorTemplate::getEncumbranceMax(int index) const return value; } // ServerArmorTemplate::getEncumbranceMax - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -911,8 +890,8 @@ int ServerArmorTemplate::getEncumbranceMax(int index) const */ void ServerArmorTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != ServerArmorTemplate_tag) { @@ -921,7 +900,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -941,10 +920,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,1)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 1)) { - - m_versionOk = false; } @@ -1005,7 +982,6 @@ char paramName[MAX_NAME_SIZE]; return; } // ServerArmorTemplate::load - //============================================================================= // class ServerArmorTemplate::_SpecialProtection @@ -1054,8 +1030,6 @@ Tag ServerArmorTemplate::_SpecialProtection::getId(void) const ServerArmorTemplate::DamageType ServerArmorTemplate::_SpecialProtection::getType(bool versionOk) const { - - const ServerArmorTemplate::_SpecialProtection * base = nullptr; if (m_baseData != nullptr) { @@ -1083,8 +1057,6 @@ ServerArmorTemplate::DamageType ServerArmorTemplate::_SpecialProtection::getType int ServerArmorTemplate::_SpecialProtection::getEffectiveness(bool versionOk) const { - - const ServerArmorTemplate::_SpecialProtection * base = nullptr; if (m_baseData != nullptr) { @@ -1134,8 +1106,6 @@ int ServerArmorTemplate::_SpecialProtection::getEffectiveness(bool versionOk) co int ServerArmorTemplate::_SpecialProtection::getEffectivenessMin(bool versionOk) const { - - const ServerArmorTemplate::_SpecialProtection * base = nullptr; if (m_baseData != nullptr) { @@ -1185,8 +1155,6 @@ int ServerArmorTemplate::_SpecialProtection::getEffectivenessMin(bool versionOk) int ServerArmorTemplate::_SpecialProtection::getEffectivenessMax(bool versionOk) const { - - const ServerArmorTemplate::_SpecialProtection * base = nullptr; if (m_baseData != nullptr) { @@ -1234,7 +1202,6 @@ int ServerArmorTemplate::_SpecialProtection::getEffectivenessMax(bool versionOk) return value; } // ServerArmorTemplate::_SpecialProtection::getEffectivenessMax - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -1243,8 +1210,8 @@ int ServerArmorTemplate::_SpecialProtection::getEffectivenessMax(bool versionOk) */ void ServerArmorTemplate::_SpecialProtection::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -1266,4 +1233,4 @@ char paramName[MAX_NAME_SIZE]; UNREF(file); } // ServerArmorTemplate::_SpecialProtection::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerBattlefieldMarkerObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerBattlefieldMarkerObjectTemplate.cpp index edd8194e..6560b6de 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerBattlefieldMarkerObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerBattlefieldMarkerObjectTemplate.cpp @@ -23,20 +23,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool ServerBattlefieldMarkerObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ ServerBattlefieldMarkerObjectTemplate::ServerBattlefieldMarkerObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : ServerTangibleObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // ServerBattlefieldMarkerObjectTemplate::ServerBattlefieldMarkerObjectTemplate @@ -45,8 +45,8 @@ ServerBattlefieldMarkerObjectTemplate::ServerBattlefieldMarkerObjectTemplate(con */ ServerBattlefieldMarkerObjectTemplate::~ServerBattlefieldMarkerObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // ServerBattlefieldMarkerObjectTemplate::~ServerBattlefieldMarkerObjectTemplate /** @@ -122,8 +122,8 @@ Object * ServerBattlefieldMarkerObjectTemplate::createObject(void) const */ void ServerBattlefieldMarkerObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != ServerBattlefieldMarkerObjectTemplate_tag) { @@ -133,7 +133,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -153,10 +153,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -174,4 +172,4 @@ char paramName[MAX_NAME_SIZE]; return; } // ServerBattlefieldMarkerObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerBuildingObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerBuildingObjectTemplate.cpp index 5fe4a003..df2091ee 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerBuildingObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerBuildingObjectTemplate.cpp @@ -22,20 +22,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool ServerBuildingObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ ServerBuildingObjectTemplate::ServerBuildingObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : ServerTangibleObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // ServerBuildingObjectTemplate::ServerBuildingObjectTemplate @@ -44,8 +44,8 @@ ServerBuildingObjectTemplate::ServerBuildingObjectTemplate(const std::string & f */ ServerBuildingObjectTemplate::~ServerBuildingObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // ServerBuildingObjectTemplate::~ServerBuildingObjectTemplate /** @@ -114,8 +114,6 @@ Object * ServerBuildingObjectTemplate::createObject(void) const //@BEGIN TFD int ServerBuildingObjectTemplate::getMaintenanceCost() const { - - const ServerBuildingObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -165,8 +163,6 @@ int ServerBuildingObjectTemplate::getMaintenanceCost() const int ServerBuildingObjectTemplate::getMaintenanceCostMin() const { - - const ServerBuildingObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -216,8 +212,6 @@ int ServerBuildingObjectTemplate::getMaintenanceCostMin() const int ServerBuildingObjectTemplate::getMaintenanceCostMax() const { - - const ServerBuildingObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -267,8 +261,6 @@ int ServerBuildingObjectTemplate::getMaintenanceCostMax() const bool ServerBuildingObjectTemplate::getIsPublic() const { - - const ServerBuildingObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -294,7 +286,6 @@ bool ServerBuildingObjectTemplate::getIsPublic() const return value; } // ServerBuildingObjectTemplate::getIsPublic - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -303,8 +294,8 @@ bool ServerBuildingObjectTemplate::getIsPublic() const */ void ServerBuildingObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != ServerBuildingObjectTemplate_tag) { @@ -314,7 +305,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -334,10 +325,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,1)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 1)) { - - m_versionOk = false; } @@ -363,4 +352,4 @@ char paramName[MAX_NAME_SIZE]; return; } // ServerBuildingObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerCellObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerCellObjectTemplate.cpp index cd6cd28d..3690c159 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerCellObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerCellObjectTemplate.cpp @@ -22,20 +22,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool ServerCellObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ ServerCellObjectTemplate::ServerCellObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : ServerObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // ServerCellObjectTemplate::ServerCellObjectTemplate @@ -46,12 +46,12 @@ ServerCellObjectTemplate::~ServerCellObjectTemplate() { if (m_baseData) { - DEBUG_REPORT_LOG(true,("Released m_baseData.\n")); + DEBUG_REPORT_LOG(true, ("Released m_baseData.\n")); m_baseData->releaseReference(); - m_baseData=0; + m_baseData = 0; } -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // ServerCellObjectTemplate::~ServerCellObjectTemplate /** @@ -127,8 +127,8 @@ Object * ServerCellObjectTemplate::createObject(void) const */ void ServerCellObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != ServerCellObjectTemplate_tag) { @@ -138,7 +138,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -158,10 +158,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -179,4 +177,4 @@ char paramName[MAX_NAME_SIZE]; return; } // ServerCellObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerCityObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerCityObjectTemplate.cpp index 82ba3562..6cf2743f 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerCityObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerCityObjectTemplate.cpp @@ -24,20 +24,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool ServerCityObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ ServerCityObjectTemplate::ServerCityObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : ServerUniverseObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // ServerCityObjectTemplate::ServerCityObjectTemplate @@ -46,8 +46,8 @@ ServerCityObjectTemplate::ServerCityObjectTemplate(const std::string & filename) */ ServerCityObjectTemplate::~ServerCityObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // ServerCityObjectTemplate::~ServerCityObjectTemplate /** @@ -123,8 +123,8 @@ Object * ServerCityObjectTemplate::createObject(void) const */ void ServerCityObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != ServerCityObjectTemplate_tag) { @@ -134,7 +134,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -154,10 +154,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -175,4 +173,4 @@ char paramName[MAX_NAME_SIZE]; return; } // ServerCityObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerConstructionContractObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerConstructionContractObjectTemplate.cpp index 3d1d1fec..40fccb9d 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerConstructionContractObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerConstructionContractObjectTemplate.cpp @@ -23,20 +23,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool ServerConstructionContractObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ ServerConstructionContractObjectTemplate::ServerConstructionContractObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : ServerIntangibleObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // ServerConstructionContractObjectTemplate::ServerConstructionContractObjectTemplate @@ -45,8 +45,8 @@ ServerConstructionContractObjectTemplate::ServerConstructionContractObjectTempla */ ServerConstructionContractObjectTemplate::~ServerConstructionContractObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // ServerConstructionContractObjectTemplate::~ServerConstructionContractObjectTemplate /** @@ -112,8 +112,8 @@ Tag ServerConstructionContractObjectTemplate::getId(void) const */ void ServerConstructionContractObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != ServerConstructionContractObjectTemplate_tag) { @@ -123,7 +123,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -143,10 +143,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -164,4 +162,4 @@ char paramName[MAX_NAME_SIZE]; return; } // ServerConstructionContractObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerCreatureObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerCreatureObjectTemplate.cpp index c3d0f5b1..37e95c27 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerCreatureObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerCreatureObjectTemplate.cpp @@ -26,22 +26,22 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool ServerCreatureObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ ServerCreatureObjectTemplate::ServerCreatureObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : ServerTangibleObjectTemplate(filename) - ,m_attribModsLoaded(false) - ,m_attribModsAppend(false) - ,m_versionOk(true) -//@END TFD INIT + , m_attribModsLoaded(false) + , m_attribModsAppend(false) + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // ServerCreatureObjectTemplate::ServerCreatureObjectTemplate @@ -50,7 +50,7 @@ ServerCreatureObjectTemplate::ServerCreatureObjectTemplate(const std::string & f */ ServerCreatureObjectTemplate::~ServerCreatureObjectTemplate() { -//@BEGIN TFD CLEANUP + //@BEGIN TFD CLEANUP { std::vector::iterator iter; for (iter = m_attribMods.begin(); iter != m_attribMods.end(); ++iter) @@ -60,7 +60,7 @@ ServerCreatureObjectTemplate::~ServerCreatureObjectTemplate() } m_attribMods.clear(); } -//@END TFD CLEANUP + //@END TFD CLEANUP } // ServerCreatureObjectTemplate::~ServerCreatureObjectTemplate /** @@ -155,7 +155,7 @@ const ServerWeaponObjectTemplate * ServerCreatureObjectTemplate::getDefaultWeapo { returnValue = dynamic_cast(ObjectTemplateList::fetch(templateName)); if (returnValue == nullptr) - WARNING_STRICT_FATAL(true, ("Error loading template %s",templateName.c_str())); + WARNING_STRICT_FATAL(true, ("Error loading template %s", templateName.c_str())); } return returnValue; } // ServerCreatureObjectTemplate::getDefaultWeapon @@ -603,8 +603,6 @@ int ServerCreatureObjectTemplate::getMaxAttributesMax(Attributes index) const float ServerCreatureObjectTemplate::getMinDrainModifier() const { - - const ServerCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -654,8 +652,6 @@ float ServerCreatureObjectTemplate::getMinDrainModifier() const float ServerCreatureObjectTemplate::getMinDrainModifierMin() const { - - const ServerCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -705,8 +701,6 @@ float ServerCreatureObjectTemplate::getMinDrainModifierMin() const float ServerCreatureObjectTemplate::getMinDrainModifierMax() const { - - const ServerCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -756,8 +750,6 @@ float ServerCreatureObjectTemplate::getMinDrainModifierMax() const float ServerCreatureObjectTemplate::getMaxDrainModifier() const { - - const ServerCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -807,8 +799,6 @@ float ServerCreatureObjectTemplate::getMaxDrainModifier() const float ServerCreatureObjectTemplate::getMaxDrainModifierMin() const { - - const ServerCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -858,8 +848,6 @@ float ServerCreatureObjectTemplate::getMaxDrainModifierMin() const float ServerCreatureObjectTemplate::getMaxDrainModifierMax() const { - - const ServerCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -909,8 +897,6 @@ float ServerCreatureObjectTemplate::getMaxDrainModifierMax() const float ServerCreatureObjectTemplate::getMinFaucetModifier() const { - - const ServerCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -960,8 +946,6 @@ float ServerCreatureObjectTemplate::getMinFaucetModifier() const float ServerCreatureObjectTemplate::getMinFaucetModifierMin() const { - - const ServerCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1011,8 +995,6 @@ float ServerCreatureObjectTemplate::getMinFaucetModifierMin() const float ServerCreatureObjectTemplate::getMinFaucetModifierMax() const { - - const ServerCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1062,8 +1044,6 @@ float ServerCreatureObjectTemplate::getMinFaucetModifierMax() const float ServerCreatureObjectTemplate::getMaxFaucetModifier() const { - - const ServerCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1113,8 +1093,6 @@ float ServerCreatureObjectTemplate::getMaxFaucetModifier() const float ServerCreatureObjectTemplate::getMaxFaucetModifierMin() const { - - const ServerCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1164,8 +1142,6 @@ float ServerCreatureObjectTemplate::getMaxFaucetModifierMin() const float ServerCreatureObjectTemplate::getMaxFaucetModifierMax() const { - - const ServerCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1226,7 +1202,7 @@ void ServerCreatureObjectTemplate::getAttribMods(AttribMod &data, int index) con if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attribMods in template %s", DataResource::getName())); - return ; + return; } else { @@ -1240,10 +1216,10 @@ void ServerCreatureObjectTemplate::getAttribMods(AttribMod &data, int index) con { int baseCount = base->getAttribModsCount(); if (static_cast(index) < baseCount) - { - base->getAttribMods(data, index); - return; - } + { + base->getAttribMods(data, index); + return; + } index -= baseCount; } @@ -1272,7 +1248,7 @@ void ServerCreatureObjectTemplate::getAttribModsMin(AttribMod &data, int index) if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attribMods in template %s", DataResource::getName())); - return ; + return; } else { @@ -1286,10 +1262,10 @@ void ServerCreatureObjectTemplate::getAttribModsMin(AttribMod &data, int index) { int baseCount = base->getAttribModsCount(); if (static_cast(index) < baseCount) - { - base->getAttribModsMin(data, index); - return; - } + { + base->getAttribModsMin(data, index); + return; + } index -= baseCount; } @@ -1318,7 +1294,7 @@ void ServerCreatureObjectTemplate::getAttribModsMax(AttribMod &data, int index) if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attribMods in template %s", DataResource::getName())); - return ; + return; } else { @@ -1332,10 +1308,10 @@ void ServerCreatureObjectTemplate::getAttribModsMax(AttribMod &data, int index) { int baseCount = base->getAttribModsCount(); if (static_cast(index) < baseCount) - { - base->getAttribModsMax(data, index); - return; - } + { + base->getAttribModsMax(data, index); + return; + } index -= baseCount; } @@ -1377,8 +1353,6 @@ size_t ServerCreatureObjectTemplate::getAttribModsCount(void) const int ServerCreatureObjectTemplate::getShockWounds() const { - - const ServerCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1428,8 +1402,6 @@ int ServerCreatureObjectTemplate::getShockWounds() const int ServerCreatureObjectTemplate::getShockWoundsMin() const { - - const ServerCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1479,8 +1451,6 @@ int ServerCreatureObjectTemplate::getShockWoundsMin() const int ServerCreatureObjectTemplate::getShockWoundsMax() const { - - const ServerCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1530,8 +1500,6 @@ int ServerCreatureObjectTemplate::getShockWoundsMax() const bool ServerCreatureObjectTemplate::getCanCreateAvatar() const { - - const ServerCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1559,8 +1527,6 @@ bool ServerCreatureObjectTemplate::getCanCreateAvatar() const const std::string & ServerCreatureObjectTemplate::getNameGeneratorType() const { - - const ServerCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1588,8 +1554,6 @@ const std::string & ServerCreatureObjectTemplate::getNameGeneratorType() const float ServerCreatureObjectTemplate::getApproachTriggerRange() const { - - const ServerCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1639,8 +1603,6 @@ float ServerCreatureObjectTemplate::getApproachTriggerRange() const float ServerCreatureObjectTemplate::getApproachTriggerRangeMin() const { - - const ServerCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1690,8 +1652,6 @@ float ServerCreatureObjectTemplate::getApproachTriggerRangeMin() const float ServerCreatureObjectTemplate::getApproachTriggerRangeMax() const { - - const ServerCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -2033,7 +1993,6 @@ float ServerCreatureObjectTemplate::getMentalStatesDecayMax(MentalStates index) return value; } // ServerCreatureObjectTemplate::getMentalStatesDecayMax - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -2042,8 +2001,8 @@ float ServerCreatureObjectTemplate::getMentalStatesDecayMax(MentalStates index) */ void ServerCreatureObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != ServerCreatureObjectTemplate_tag) { @@ -2053,7 +2012,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -2073,10 +2032,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,5)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 5)) { - - m_versionOk = false; } @@ -2226,4 +2183,4 @@ const StringId &ServerCreatureObjectTemplate::verifyName(const Unicode::String & void ServerCreatureObjectTemplate::postLoad() { ServerTangibleObjectTemplate::postLoad(); -} +} \ No newline at end of file diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerDraftSchematicObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerDraftSchematicObjectTemplate.cpp index 9ffea4cf..5d8a2fc9 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerDraftSchematicObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerDraftSchematicObjectTemplate.cpp @@ -24,26 +24,26 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool ServerDraftSchematicObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ ServerDraftSchematicObjectTemplate::ServerDraftSchematicObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : ServerIntangibleObjectTemplate(filename) - ,m_slotsLoaded(false) - ,m_slotsAppend(false) - ,m_skillCommandsLoaded(false) - ,m_skillCommandsAppend(false) - ,m_manufactureScriptsLoaded(false) - ,m_manufactureScriptsAppend(false) - ,m_versionOk(true) -//@END TFD INIT + , m_slotsLoaded(false) + , m_slotsAppend(false) + , m_skillCommandsLoaded(false) + , m_skillCommandsAppend(false) + , m_manufactureScriptsLoaded(false) + , m_manufactureScriptsAppend(false) + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // ServerDraftSchematicObjectTemplate::ServerDraftSchematicObjectTemplate @@ -52,7 +52,7 @@ ServerDraftSchematicObjectTemplate::ServerDraftSchematicObjectTemplate(const std */ ServerDraftSchematicObjectTemplate::~ServerDraftSchematicObjectTemplate() { -//@BEGIN TFD CLEANUP + //@BEGIN TFD CLEANUP { std::vector::iterator iter; for (iter = m_slots.begin(); iter != m_slots.end(); ++iter) @@ -80,7 +80,7 @@ ServerDraftSchematicObjectTemplate::~ServerDraftSchematicObjectTemplate() } m_manufactureScripts.clear(); } -//@END TFD CLEANUP + //@END TFD CLEANUP } // ServerDraftSchematicObjectTemplate::~ServerDraftSchematicObjectTemplate /** @@ -143,14 +143,13 @@ Tag ServerDraftSchematicObjectTemplate::getHighestTemplateVersion(void) const */ Object * ServerDraftSchematicObjectTemplate::createObject(void) const { - WARNING(true, ("Trying to create a draft schematic %s outside the draft " "schematic factory!\n", getName())); return nullptr; } // ServerDraftSchematicObjectTemplate::createObject /** - * Called after the template data has been loaded. Verifies that the schematic has + * Called after the template data has been loaded. Verifies that the schematic has * good data. */ void ServerDraftSchematicObjectTemplate::postLoad() @@ -160,8 +159,6 @@ void ServerDraftSchematicObjectTemplate::postLoad() //@BEGIN TFD ServerDraftSchematicObjectTemplate::CraftingType ServerDraftSchematicObjectTemplate::getCategory() const { - - const ServerDraftSchematicObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -212,7 +209,7 @@ const ServerObjectTemplate * ServerDraftSchematicObjectTemplate::getCraftedObjec const std::string & templateName = m_craftedObjectTemplate.getValue(); const ServerObjectTemplate * returnValue = dynamic_cast(ObjectTemplateList::fetch(templateName)); if (returnValue == nullptr) - WARNING_STRICT_FATAL(true, ("Error loading template %s",templateName.c_str())); + WARNING_STRICT_FATAL(true, ("Error loading template %s", templateName.c_str())); return returnValue; } // ServerDraftSchematicObjectTemplate::getCraftedObjectTemplate @@ -241,7 +238,7 @@ const ServerFactoryObjectTemplate * ServerDraftSchematicObjectTemplate::getCrate const std::string & templateName = m_crateObjectTemplate.getValue(); const ServerFactoryObjectTemplate * returnValue = dynamic_cast(ObjectTemplateList::fetch(templateName)); if (returnValue == nullptr) - WARNING_STRICT_FATAL(true, ("Error loading template %s",templateName.c_str())); + WARNING_STRICT_FATAL(true, ("Error loading template %s", templateName.c_str())); return returnValue; } // ServerDraftSchematicObjectTemplate::getCrateObjectTemplate @@ -258,7 +255,7 @@ void ServerDraftSchematicObjectTemplate::getSlots(IngredientSlot &data, int inde if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slots in template %s", DataResource::getName())); - return ; + return; } else { @@ -272,10 +269,10 @@ void ServerDraftSchematicObjectTemplate::getSlots(IngredientSlot &data, int inde { int baseCount = base->getSlotsCount(); if (index < baseCount) - { - base->getSlots(data, index); - return; - } + { + base->getSlots(data, index); + return; + } index -= baseCount; } @@ -311,7 +308,7 @@ void ServerDraftSchematicObjectTemplate::getSlotsMin(IngredientSlot &data, int i if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slots in template %s", DataResource::getName())); - return ; + return; } else { @@ -325,10 +322,10 @@ void ServerDraftSchematicObjectTemplate::getSlotsMin(IngredientSlot &data, int i { int baseCount = base->getSlotsCount(); if (index < baseCount) - { - base->getSlotsMin(data, index); - return; - } + { + base->getSlotsMin(data, index); + return; + } index -= baseCount; } @@ -364,7 +361,7 @@ void ServerDraftSchematicObjectTemplate::getSlotsMax(IngredientSlot &data, int i if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slots in template %s", DataResource::getName())); - return ; + return; } else { @@ -378,10 +375,10 @@ void ServerDraftSchematicObjectTemplate::getSlotsMax(IngredientSlot &data, int i { int baseCount = base->getSlotsCount(); if (index < baseCount) - { - base->getSlotsMax(data, index); - return; - } + { + base->getSlotsMax(data, index); + return; + } index -= baseCount; } @@ -489,8 +486,6 @@ size_t ServerDraftSchematicObjectTemplate::getSkillCommandsCount(void) const bool ServerDraftSchematicObjectTemplate::getDestroyIngredients() const { - - const ServerDraftSchematicObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -577,8 +572,6 @@ size_t ServerDraftSchematicObjectTemplate::getManufactureScriptsCount(void) cons int ServerDraftSchematicObjectTemplate::getItemsPerContainer() const { - - const ServerDraftSchematicObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -628,8 +621,6 @@ int ServerDraftSchematicObjectTemplate::getItemsPerContainer() const int ServerDraftSchematicObjectTemplate::getItemsPerContainerMin() const { - - const ServerDraftSchematicObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -679,8 +670,6 @@ int ServerDraftSchematicObjectTemplate::getItemsPerContainerMin() const int ServerDraftSchematicObjectTemplate::getItemsPerContainerMax() const { - - const ServerDraftSchematicObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -730,8 +719,6 @@ int ServerDraftSchematicObjectTemplate::getItemsPerContainerMax() const float ServerDraftSchematicObjectTemplate::getManufactureTime() const { - - const ServerDraftSchematicObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -781,8 +768,6 @@ float ServerDraftSchematicObjectTemplate::getManufactureTime() const float ServerDraftSchematicObjectTemplate::getManufactureTimeMin() const { - - const ServerDraftSchematicObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -832,8 +817,6 @@ float ServerDraftSchematicObjectTemplate::getManufactureTimeMin() const float ServerDraftSchematicObjectTemplate::getManufactureTimeMax() const { - - const ServerDraftSchematicObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -883,8 +866,6 @@ float ServerDraftSchematicObjectTemplate::getManufactureTimeMax() const float ServerDraftSchematicObjectTemplate::getPrototypeTime() const { - - const ServerDraftSchematicObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -934,8 +915,6 @@ float ServerDraftSchematicObjectTemplate::getPrototypeTime() const float ServerDraftSchematicObjectTemplate::getPrototypeTimeMin() const { - - const ServerDraftSchematicObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -985,8 +964,6 @@ float ServerDraftSchematicObjectTemplate::getPrototypeTimeMin() const float ServerDraftSchematicObjectTemplate::getPrototypeTimeMax() const { - - const ServerDraftSchematicObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1034,7 +1011,6 @@ float ServerDraftSchematicObjectTemplate::getPrototypeTimeMax() const return value; } // ServerDraftSchematicObjectTemplate::getPrototypeTimeMax - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -1043,8 +1019,8 @@ float ServerDraftSchematicObjectTemplate::getPrototypeTimeMax() const */ void ServerDraftSchematicObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != ServerDraftSchematicObjectTemplate_tag) { @@ -1054,7 +1030,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -1074,10 +1050,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,7)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 7)) { - - m_versionOk = false; } @@ -1170,7 +1144,6 @@ char paramName[MAX_NAME_SIZE]; return; } // ServerDraftSchematicObjectTemplate::load - //============================================================================= // class ServerDraftSchematicObjectTemplate::_IngredientSlot @@ -1179,8 +1152,8 @@ char paramName[MAX_NAME_SIZE]; */ ServerDraftSchematicObjectTemplate::_IngredientSlot::_IngredientSlot(const std::string & filename) : ObjectTemplate(filename) - ,m_optionsLoaded(false) - ,m_optionsAppend(false) + , m_optionsLoaded(false) + , m_optionsAppend(false) { } // ServerDraftSchematicObjectTemplate::_IngredientSlot::_IngredientSlot @@ -1230,8 +1203,6 @@ Tag ServerDraftSchematicObjectTemplate::_IngredientSlot::getId(void) const bool ServerDraftSchematicObjectTemplate::_IngredientSlot::getOptional(bool versionOk) const { - - const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; if (m_baseData != nullptr) { @@ -1259,8 +1230,6 @@ bool ServerDraftSchematicObjectTemplate::_IngredientSlot::getOptional(bool versi const StringId ServerDraftSchematicObjectTemplate::_IngredientSlot::getName(bool versionOk) const { - - const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; if (m_baseData != nullptr) { @@ -1299,7 +1268,7 @@ void ServerDraftSchematicObjectTemplate::_IngredientSlot::getOptions(Ingredient if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter options in template %s", DataResource::getName())); - return ; + return; } else { @@ -1313,10 +1282,10 @@ void ServerDraftSchematicObjectTemplate::_IngredientSlot::getOptions(Ingredient { int baseCount = base->getOptionsCount(); if (index < baseCount) - { - base->getOptions(data, index, versionOk); - return; - } + { + base->getOptions(data, index, versionOk); + return; + } index -= baseCount; } @@ -1350,7 +1319,7 @@ void ServerDraftSchematicObjectTemplate::_IngredientSlot::getOptionsMin(Ingredie if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter options in template %s", DataResource::getName())); - return ; + return; } else { @@ -1364,10 +1333,10 @@ void ServerDraftSchematicObjectTemplate::_IngredientSlot::getOptionsMin(Ingredie { int baseCount = base->getOptionsCount(); if (index < baseCount) - { - base->getOptionsMin(data, index, versionOk); - return; - } + { + base->getOptionsMin(data, index, versionOk); + return; + } index -= baseCount; } @@ -1401,7 +1370,7 @@ void ServerDraftSchematicObjectTemplate::_IngredientSlot::getOptionsMax(Ingredie if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter options in template %s", DataResource::getName())); - return ; + return; } else { @@ -1415,10 +1384,10 @@ void ServerDraftSchematicObjectTemplate::_IngredientSlot::getOptionsMax(Ingredie { int baseCount = base->getOptionsCount(); if (index < baseCount) - { - base->getOptionsMax(data, index, versionOk); - return; - } + { + base->getOptionsMax(data, index, versionOk); + return; + } index -= baseCount; } @@ -1465,8 +1434,6 @@ size_t ServerDraftSchematicObjectTemplate::_IngredientSlot::getOptionsCount(void const std::string & ServerDraftSchematicObjectTemplate::_IngredientSlot::getOptionalSkillCommand(bool versionOk) const { - - const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; if (m_baseData != nullptr) { @@ -1494,8 +1461,6 @@ const std::string & ServerDraftSchematicObjectTemplate::_IngredientSlot::getOpti float ServerDraftSchematicObjectTemplate::_IngredientSlot::getComplexity(bool versionOk) const { - - const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; if (m_baseData != nullptr) { @@ -1545,8 +1510,6 @@ float ServerDraftSchematicObjectTemplate::_IngredientSlot::getComplexity(bool ve float ServerDraftSchematicObjectTemplate::_IngredientSlot::getComplexityMin(bool versionOk) const { - - const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; if (m_baseData != nullptr) { @@ -1596,8 +1559,6 @@ float ServerDraftSchematicObjectTemplate::_IngredientSlot::getComplexityMin(bool float ServerDraftSchematicObjectTemplate::_IngredientSlot::getComplexityMax(bool versionOk) const { - - const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; if (m_baseData != nullptr) { @@ -1647,8 +1608,6 @@ float ServerDraftSchematicObjectTemplate::_IngredientSlot::getComplexityMax(bool const std::string & ServerDraftSchematicObjectTemplate::_IngredientSlot::getAppearance(bool versionOk) const { - - const ServerDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; if (m_baseData != nullptr) { @@ -1674,7 +1633,6 @@ const std::string & ServerDraftSchematicObjectTemplate::_IngredientSlot::getAppe return value; } // ServerDraftSchematicObjectTemplate::_IngredientSlot::getAppearance - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -1683,8 +1641,8 @@ const std::string & ServerDraftSchematicObjectTemplate::_IngredientSlot::getAppe */ void ServerDraftSchematicObjectTemplate::_IngredientSlot::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -1731,4 +1689,4 @@ char paramName[MAX_NAME_SIZE]; UNREF(file); } // ServerDraftSchematicObjectTemplate::_IngredientSlot::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerFactoryObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerFactoryObjectTemplate.cpp index d86622d6..fe0c4e5f 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerFactoryObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerFactoryObjectTemplate.cpp @@ -22,20 +22,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool ServerFactoryObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ ServerFactoryObjectTemplate::ServerFactoryObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : ServerTangibleObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // ServerFactoryObjectTemplate::ServerFactoryObjectTemplate @@ -44,8 +44,8 @@ ServerFactoryObjectTemplate::ServerFactoryObjectTemplate(const std::string & fil */ ServerFactoryObjectTemplate::~ServerFactoryObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // ServerFactoryObjectTemplate::~ServerFactoryObjectTemplate /** @@ -121,8 +121,8 @@ Object * ServerFactoryObjectTemplate::createObject(void) const */ void ServerFactoryObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != ServerFactoryObjectTemplate_tag) { @@ -132,7 +132,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -152,10 +152,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -173,4 +171,4 @@ char paramName[MAX_NAME_SIZE]; return; } // ServerFactoryObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerGroupObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerGroupObjectTemplate.cpp index c426aa8b..4e1add97 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerGroupObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerGroupObjectTemplate.cpp @@ -24,20 +24,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool ServerGroupObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ ServerGroupObjectTemplate::ServerGroupObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : ServerUniverseObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // ServerGroupObjectTemplate::ServerGroupObjectTemplate @@ -46,8 +46,8 @@ ServerGroupObjectTemplate::ServerGroupObjectTemplate(const std::string & filenam */ ServerGroupObjectTemplate::~ServerGroupObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // ServerGroupObjectTemplate::~ServerGroupObjectTemplate /** @@ -123,8 +123,8 @@ Object * ServerGroupObjectTemplate::createObject(void) const */ void ServerGroupObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != ServerGroupObjectTemplate_tag) { @@ -134,7 +134,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -154,10 +154,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -175,4 +173,4 @@ char paramName[MAX_NAME_SIZE]; return; } // ServerGroupObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerGuildObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerGuildObjectTemplate.cpp index 9c73ce50..7af51fce 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerGuildObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerGuildObjectTemplate.cpp @@ -24,20 +24,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool ServerGuildObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ ServerGuildObjectTemplate::ServerGuildObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : ServerUniverseObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // ServerGuildObjectTemplate::ServerGuildObjectTemplate @@ -46,8 +46,8 @@ ServerGuildObjectTemplate::ServerGuildObjectTemplate(const std::string & filenam */ ServerGuildObjectTemplate::~ServerGuildObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // ServerGuildObjectTemplate::~ServerGuildObjectTemplate /** @@ -123,8 +123,8 @@ Object * ServerGuildObjectTemplate::createObject(void) const */ void ServerGuildObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != ServerGuildObjectTemplate_tag) { @@ -134,7 +134,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -154,10 +154,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -175,4 +173,4 @@ char paramName[MAX_NAME_SIZE]; return; } // ServerGuildObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerHarvesterInstallationObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerHarvesterInstallationObjectTemplate.cpp index d62b39c9..566f6a37 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerHarvesterInstallationObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerHarvesterInstallationObjectTemplate.cpp @@ -22,20 +22,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool ServerHarvesterInstallationObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ ServerHarvesterInstallationObjectTemplate::ServerHarvesterInstallationObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : ServerInstallationObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // ServerHarvesterInstallationObjectTemplate::ServerHarvesterInstallationObjectTemplate @@ -44,8 +44,8 @@ ServerHarvesterInstallationObjectTemplate::ServerHarvesterInstallationObjectTemp */ ServerHarvesterInstallationObjectTemplate::~ServerHarvesterInstallationObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // ServerHarvesterInstallationObjectTemplate::~ServerHarvesterInstallationObjectTemplate /** @@ -114,8 +114,6 @@ Object * ServerHarvesterInstallationObjectTemplate::createObject(void) const //@BEGIN TFD int ServerHarvesterInstallationObjectTemplate::getMaxExtractionRate() const { - - const ServerHarvesterInstallationObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -165,8 +163,6 @@ int ServerHarvesterInstallationObjectTemplate::getMaxExtractionRate() const int ServerHarvesterInstallationObjectTemplate::getMaxExtractionRateMin() const { - - const ServerHarvesterInstallationObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -216,8 +212,6 @@ int ServerHarvesterInstallationObjectTemplate::getMaxExtractionRateMin() const int ServerHarvesterInstallationObjectTemplate::getMaxExtractionRateMax() const { - - const ServerHarvesterInstallationObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -267,8 +261,6 @@ int ServerHarvesterInstallationObjectTemplate::getMaxExtractionRateMax() const int ServerHarvesterInstallationObjectTemplate::getCurrentExtractionRate() const { - - const ServerHarvesterInstallationObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -318,8 +310,6 @@ int ServerHarvesterInstallationObjectTemplate::getCurrentExtractionRate() const int ServerHarvesterInstallationObjectTemplate::getCurrentExtractionRateMin() const { - - const ServerHarvesterInstallationObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -369,8 +359,6 @@ int ServerHarvesterInstallationObjectTemplate::getCurrentExtractionRateMin() con int ServerHarvesterInstallationObjectTemplate::getCurrentExtractionRateMax() const { - - const ServerHarvesterInstallationObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -420,8 +408,6 @@ int ServerHarvesterInstallationObjectTemplate::getCurrentExtractionRateMax() con int ServerHarvesterInstallationObjectTemplate::getMaxHopperSize() const { - - const ServerHarvesterInstallationObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -471,8 +457,6 @@ int ServerHarvesterInstallationObjectTemplate::getMaxHopperSize() const int ServerHarvesterInstallationObjectTemplate::getMaxHopperSizeMin() const { - - const ServerHarvesterInstallationObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -522,8 +506,6 @@ int ServerHarvesterInstallationObjectTemplate::getMaxHopperSizeMin() const int ServerHarvesterInstallationObjectTemplate::getMaxHopperSizeMax() const { - - const ServerHarvesterInstallationObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -573,8 +555,6 @@ int ServerHarvesterInstallationObjectTemplate::getMaxHopperSizeMax() const const std::string & ServerHarvesterInstallationObjectTemplate::getMasterClassName() const { - - const ServerHarvesterInstallationObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -600,7 +580,6 @@ const std::string & ServerHarvesterInstallationObjectTemplate::getMasterClassNam return value; } // ServerHarvesterInstallationObjectTemplate::getMasterClassName - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -609,8 +588,8 @@ const std::string & ServerHarvesterInstallationObjectTemplate::getMasterClassNam */ void ServerHarvesterInstallationObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != ServerHarvesterInstallationObjectTemplate_tag) { @@ -620,7 +599,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -640,10 +619,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -673,4 +650,4 @@ char paramName[MAX_NAME_SIZE]; return; } // ServerHarvesterInstallationObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerInstallationObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerInstallationObjectTemplate.cpp index 8f8de32d..17832c22 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerInstallationObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerInstallationObjectTemplate.cpp @@ -23,20 +23,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool ServerInstallationObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ ServerInstallationObjectTemplate::ServerInstallationObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : ServerTangibleObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // ServerInstallationObjectTemplate::ServerInstallationObjectTemplate @@ -45,8 +45,8 @@ ServerInstallationObjectTemplate::ServerInstallationObjectTemplate(const std::st */ ServerInstallationObjectTemplate::~ServerInstallationObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // ServerInstallationObjectTemplate::~ServerInstallationObjectTemplate /** @@ -122,8 +122,8 @@ Object * ServerInstallationObjectTemplate::createObject(void) const */ void ServerInstallationObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != ServerInstallationObjectTemplate_tag) { @@ -133,7 +133,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -153,10 +153,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,1)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 1)) { - - m_versionOk = false; } @@ -174,4 +172,4 @@ char paramName[MAX_NAME_SIZE]; return; } // ServerInstallationObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerIntangibleObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerIntangibleObjectTemplate.cpp index 7215902b..60bfb3c8 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerIntangibleObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerIntangibleObjectTemplate.cpp @@ -22,20 +22,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool ServerIntangibleObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ ServerIntangibleObjectTemplate::ServerIntangibleObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : ServerObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // ServerIntangibleObjectTemplate::ServerIntangibleObjectTemplate @@ -44,8 +44,8 @@ ServerIntangibleObjectTemplate::ServerIntangibleObjectTemplate(const std::string */ ServerIntangibleObjectTemplate::~ServerIntangibleObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // ServerIntangibleObjectTemplate::~ServerIntangibleObjectTemplate /** @@ -114,8 +114,6 @@ Object * ServerIntangibleObjectTemplate::createObject(void) const //@BEGIN TFD int ServerIntangibleObjectTemplate::getCount() const { - - const ServerIntangibleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -165,8 +163,6 @@ int ServerIntangibleObjectTemplate::getCount() const int ServerIntangibleObjectTemplate::getCountMin() const { - - const ServerIntangibleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -216,8 +212,6 @@ int ServerIntangibleObjectTemplate::getCountMin() const int ServerIntangibleObjectTemplate::getCountMax() const { - - const ServerIntangibleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -265,7 +259,6 @@ int ServerIntangibleObjectTemplate::getCountMax() const return value; } // ServerIntangibleObjectTemplate::getCountMax - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -274,8 +267,8 @@ int ServerIntangibleObjectTemplate::getCountMax() const */ void ServerIntangibleObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != ServerIntangibleObjectTemplate_tag) { @@ -285,7 +278,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -305,10 +298,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,1)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 1)) { - - m_versionOk = false; } @@ -332,7 +323,6 @@ char paramName[MAX_NAME_SIZE]; return; } // ServerIntangibleObjectTemplate::load - //============================================================================= // class ServerIntangibleObjectTemplate::_Ingredient @@ -341,8 +331,8 @@ char paramName[MAX_NAME_SIZE]; */ ServerIntangibleObjectTemplate::_Ingredient::_Ingredient(const std::string & filename) : ObjectTemplate(filename) - ,m_ingredientsLoaded(false) - ,m_ingredientsAppend(false) + , m_ingredientsLoaded(false) + , m_ingredientsAppend(false) { } // ServerIntangibleObjectTemplate::_Ingredient::_Ingredient @@ -392,8 +382,6 @@ Tag ServerIntangibleObjectTemplate::_Ingredient::getId(void) const ServerIntangibleObjectTemplate::IngredientType ServerIntangibleObjectTemplate::_Ingredient::getIngredientType(bool versionOk) const { - - const ServerIntangibleObjectTemplate::_Ingredient * base = nullptr; if (m_baseData != nullptr) { @@ -432,7 +420,7 @@ void ServerIntangibleObjectTemplate::_Ingredient::getIngredients(SimpleIngredien if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredients in template %s", DataResource::getName())); - return ; + return; } else { @@ -446,10 +434,10 @@ void ServerIntangibleObjectTemplate::_Ingredient::getIngredients(SimpleIngredien { int baseCount = base->getIngredientsCount(); if (index < baseCount) - { - base->getIngredients(data, index, versionOk); - return; - } + { + base->getIngredients(data, index, versionOk); + return; + } index -= baseCount; } @@ -476,7 +464,7 @@ void ServerIntangibleObjectTemplate::_Ingredient::getIngredientsMin(SimpleIngred if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredients in template %s", DataResource::getName())); - return ; + return; } else { @@ -490,10 +478,10 @@ void ServerIntangibleObjectTemplate::_Ingredient::getIngredientsMin(SimpleIngred { int baseCount = base->getIngredientsCount(); if (index < baseCount) - { - base->getIngredientsMin(data, index, versionOk); - return; - } + { + base->getIngredientsMin(data, index, versionOk); + return; + } index -= baseCount; } @@ -520,7 +508,7 @@ void ServerIntangibleObjectTemplate::_Ingredient::getIngredientsMax(SimpleIngred if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredients in template %s", DataResource::getName())); - return ; + return; } else { @@ -534,10 +522,10 @@ void ServerIntangibleObjectTemplate::_Ingredient::getIngredientsMax(SimpleIngred { int baseCount = base->getIngredientsCount(); if (index < baseCount) - { - base->getIngredientsMax(data, index, versionOk); - return; - } + { + base->getIngredientsMax(data, index, versionOk); + return; + } index -= baseCount; } @@ -577,8 +565,6 @@ size_t ServerIntangibleObjectTemplate::_Ingredient::getIngredientsCount(void) co float ServerIntangibleObjectTemplate::_Ingredient::getComplexity(bool versionOk) const { - - const ServerIntangibleObjectTemplate::_Ingredient * base = nullptr; if (m_baseData != nullptr) { @@ -628,8 +614,6 @@ float ServerIntangibleObjectTemplate::_Ingredient::getComplexity(bool versionOk) float ServerIntangibleObjectTemplate::_Ingredient::getComplexityMin(bool versionOk) const { - - const ServerIntangibleObjectTemplate::_Ingredient * base = nullptr; if (m_baseData != nullptr) { @@ -679,8 +663,6 @@ float ServerIntangibleObjectTemplate::_Ingredient::getComplexityMin(bool version float ServerIntangibleObjectTemplate::_Ingredient::getComplexityMax(bool versionOk) const { - - const ServerIntangibleObjectTemplate::_Ingredient * base = nullptr; if (m_baseData != nullptr) { @@ -730,8 +712,6 @@ float ServerIntangibleObjectTemplate::_Ingredient::getComplexityMax(bool version const std::string & ServerIntangibleObjectTemplate::_Ingredient::getSkillCommand(bool versionOk) const { - - const ServerIntangibleObjectTemplate::_Ingredient * base = nullptr; if (m_baseData != nullptr) { @@ -757,7 +737,6 @@ const std::string & ServerIntangibleObjectTemplate::_Ingredient::getSkillCommand return value; } // ServerIntangibleObjectTemplate::_Ingredient::getSkillCommand - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -766,8 +745,8 @@ const std::string & ServerIntangibleObjectTemplate::_Ingredient::getSkillCommand */ void ServerIntangibleObjectTemplate::_Ingredient::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -810,7 +789,6 @@ char paramName[MAX_NAME_SIZE]; UNREF(file); } // ServerIntangibleObjectTemplate::_Ingredient::load - //============================================================================= // class ServerIntangibleObjectTemplate::_SchematicAttribute @@ -859,8 +837,6 @@ Tag ServerIntangibleObjectTemplate::_SchematicAttribute::getId(void) const const StringId ServerIntangibleObjectTemplate::_SchematicAttribute::getName(bool versionOk) const { - - const ServerIntangibleObjectTemplate::_SchematicAttribute * base = nullptr; if (m_baseData != nullptr) { @@ -888,8 +864,6 @@ const StringId ServerIntangibleObjectTemplate::_SchematicAttribute::getName(bool int ServerIntangibleObjectTemplate::_SchematicAttribute::getValue(bool versionOk) const { - - const ServerIntangibleObjectTemplate::_SchematicAttribute * base = nullptr; if (m_baseData != nullptr) { @@ -939,8 +913,6 @@ int ServerIntangibleObjectTemplate::_SchematicAttribute::getValue(bool versionOk int ServerIntangibleObjectTemplate::_SchematicAttribute::getValueMin(bool versionOk) const { - - const ServerIntangibleObjectTemplate::_SchematicAttribute * base = nullptr; if (m_baseData != nullptr) { @@ -990,8 +962,6 @@ int ServerIntangibleObjectTemplate::_SchematicAttribute::getValueMin(bool versio int ServerIntangibleObjectTemplate::_SchematicAttribute::getValueMax(bool versionOk) const { - - const ServerIntangibleObjectTemplate::_SchematicAttribute * base = nullptr; if (m_baseData != nullptr) { @@ -1039,7 +1009,6 @@ int ServerIntangibleObjectTemplate::_SchematicAttribute::getValueMax(bool versio return value; } // ServerIntangibleObjectTemplate::_SchematicAttribute::getValueMax - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -1048,8 +1017,8 @@ int ServerIntangibleObjectTemplate::_SchematicAttribute::getValueMax(bool versio */ void ServerIntangibleObjectTemplate::_SchematicAttribute::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -1071,7 +1040,6 @@ char paramName[MAX_NAME_SIZE]; UNREF(file); } // ServerIntangibleObjectTemplate::_SchematicAttribute::load - //============================================================================= // class ServerIntangibleObjectTemplate::_SimpleIngredient @@ -1120,8 +1088,6 @@ Tag ServerIntangibleObjectTemplate::_SimpleIngredient::getId(void) const const StringId ServerIntangibleObjectTemplate::_SimpleIngredient::getName(bool versionOk) const { - - const ServerIntangibleObjectTemplate::_SimpleIngredient * base = nullptr; if (m_baseData != nullptr) { @@ -1149,8 +1115,6 @@ const StringId ServerIntangibleObjectTemplate::_SimpleIngredient::getName(bool v const std::string & ServerIntangibleObjectTemplate::_SimpleIngredient::getIngredient(bool versionOk) const { - - const ServerIntangibleObjectTemplate::_SimpleIngredient * base = nullptr; if (m_baseData != nullptr) { @@ -1178,8 +1142,6 @@ const std::string & ServerIntangibleObjectTemplate::_SimpleIngredient::getIngred int ServerIntangibleObjectTemplate::_SimpleIngredient::getCount(bool versionOk) const { - - const ServerIntangibleObjectTemplate::_SimpleIngredient * base = nullptr; if (m_baseData != nullptr) { @@ -1229,8 +1191,6 @@ int ServerIntangibleObjectTemplate::_SimpleIngredient::getCount(bool versionOk) int ServerIntangibleObjectTemplate::_SimpleIngredient::getCountMin(bool versionOk) const { - - const ServerIntangibleObjectTemplate::_SimpleIngredient * base = nullptr; if (m_baseData != nullptr) { @@ -1280,8 +1240,6 @@ int ServerIntangibleObjectTemplate::_SimpleIngredient::getCountMin(bool versionO int ServerIntangibleObjectTemplate::_SimpleIngredient::getCountMax(bool versionOk) const { - - const ServerIntangibleObjectTemplate::_SimpleIngredient * base = nullptr; if (m_baseData != nullptr) { @@ -1329,7 +1287,6 @@ int ServerIntangibleObjectTemplate::_SimpleIngredient::getCountMax(bool versionO return value; } // ServerIntangibleObjectTemplate::_SimpleIngredient::getCountMax - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -1338,8 +1295,8 @@ int ServerIntangibleObjectTemplate::_SimpleIngredient::getCountMax(bool versionO */ void ServerIntangibleObjectTemplate::_SimpleIngredient::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -1363,4 +1320,4 @@ char paramName[MAX_NAME_SIZE]; UNREF(file); } // ServerIntangibleObjectTemplate::_SimpleIngredient::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureInstallationObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureInstallationObjectTemplate.cpp index 21a0e496..d58f2225 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureInstallationObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureInstallationObjectTemplate.cpp @@ -22,20 +22,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool ServerManufactureInstallationObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ ServerManufactureInstallationObjectTemplate::ServerManufactureInstallationObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : ServerInstallationObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // ServerManufactureInstallationObjectTemplate::ServerManufactureInstallationObjectTemplate @@ -44,8 +44,8 @@ ServerManufactureInstallationObjectTemplate::ServerManufactureInstallationObject */ ServerManufactureInstallationObjectTemplate::~ServerManufactureInstallationObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // ServerManufactureInstallationObjectTemplate::~ServerManufactureInstallationObjectTemplate /** @@ -121,8 +121,8 @@ Object * ServerManufactureInstallationObjectTemplate::createObject(void) const */ void ServerManufactureInstallationObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != ServerManufactureInstallationObjectTemplate_tag) { @@ -132,7 +132,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -152,10 +152,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -173,4 +171,4 @@ char paramName[MAX_NAME_SIZE]; return; } // ServerManufactureInstallationObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureSchematicObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureSchematicObjectTemplate.cpp index 2ec206b5..177c7aa8 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureSchematicObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerManufactureSchematicObjectTemplate.cpp @@ -22,24 +22,24 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool ServerManufactureSchematicObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ ServerManufactureSchematicObjectTemplate::ServerManufactureSchematicObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : ServerIntangibleObjectTemplate(filename) - ,m_ingredientsLoaded(false) - ,m_ingredientsAppend(false) - ,m_attributesLoaded(false) - ,m_attributesAppend(false) - ,m_versionOk(true) -//@END TFD INIT + , m_ingredientsLoaded(false) + , m_ingredientsAppend(false) + , m_attributesLoaded(false) + , m_attributesAppend(false) + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // ServerManufactureSchematicObjectTemplate::ServerManufactureSchematicObjectTemplate @@ -48,7 +48,7 @@ ServerManufactureSchematicObjectTemplate::ServerManufactureSchematicObjectTempla */ ServerManufactureSchematicObjectTemplate::~ServerManufactureSchematicObjectTemplate() { -//@BEGIN TFD CLEANUP + //@BEGIN TFD CLEANUP { std::vector::iterator iter; for (iter = m_ingredients.begin(); iter != m_ingredients.end(); ++iter) @@ -67,7 +67,7 @@ ServerManufactureSchematicObjectTemplate::~ServerManufactureSchematicObjectTempl } m_attributes.clear(); } -//@END TFD CLEANUP + //@END TFD CLEANUP } // ServerManufactureSchematicObjectTemplate::~ServerManufactureSchematicObjectTemplate /** @@ -131,8 +131,8 @@ Tag ServerManufactureSchematicObjectTemplate::getHighestTemplateVersion(void) co */ Object * ServerManufactureSchematicObjectTemplate::createObject(void) const { -// WARNING(true, ("Someone is trying to create a manf schematic without a " -// "draft schematic source!")); + // WARNING(true, ("Someone is trying to create a manf schematic without a " + // "draft schematic source!")); return new ManufactureSchematicObject(this); } // ServerManufactureSchematicObjectTemplate::createObject @@ -147,12 +147,12 @@ Object * ServerManufactureSchematicObjectTemplate::createObject(const char *cons if (objectTemplate) { Object * object = nullptr; - const ServerManufactureSchematicObjectTemplate * const manfTemplate = + const ServerManufactureSchematicObjectTemplate * const manfTemplate = dynamic_cast( - objectTemplate); + objectTemplate); if (manfTemplate != nullptr) object = manfTemplate->createObject(schematic); - objectTemplate->releaseReference (); + objectTemplate->releaseReference(); return object; } @@ -172,8 +172,6 @@ Object * ServerManufactureSchematicObjectTemplate::createObject(const DraftSchem //@BEGIN TFD const std::string & ServerManufactureSchematicObjectTemplate::getDraftSchematic() const { - - const ServerManufactureSchematicObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -201,8 +199,6 @@ const std::string & ServerManufactureSchematicObjectTemplate::getDraftSchematic( const std::string & ServerManufactureSchematicObjectTemplate::getCreator() const { - - const ServerManufactureSchematicObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -241,7 +237,7 @@ void ServerManufactureSchematicObjectTemplate::getIngredients(IngredientSlot &da if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredients in template %s", DataResource::getName())); - return ; + return; } else { @@ -255,10 +251,10 @@ void ServerManufactureSchematicObjectTemplate::getIngredients(IngredientSlot &da { int baseCount = base->getIngredientsCount(); if (index < baseCount) - { - base->getIngredients(data, index); - return; - } + { + base->getIngredients(data, index); + return; + } index -= baseCount; } @@ -284,7 +280,7 @@ void ServerManufactureSchematicObjectTemplate::getIngredientsMin(IngredientSlot if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredients in template %s", DataResource::getName())); - return ; + return; } else { @@ -298,10 +294,10 @@ void ServerManufactureSchematicObjectTemplate::getIngredientsMin(IngredientSlot { int baseCount = base->getIngredientsCount(); if (index < baseCount) - { - base->getIngredientsMin(data, index); - return; - } + { + base->getIngredientsMin(data, index); + return; + } index -= baseCount; } @@ -327,7 +323,7 @@ void ServerManufactureSchematicObjectTemplate::getIngredientsMax(IngredientSlot if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredients in template %s", DataResource::getName())); - return ; + return; } else { @@ -341,10 +337,10 @@ void ServerManufactureSchematicObjectTemplate::getIngredientsMax(IngredientSlot { int baseCount = base->getIngredientsCount(); if (index < baseCount) - { - base->getIngredientsMax(data, index); - return; - } + { + base->getIngredientsMax(data, index); + return; + } index -= baseCount; } @@ -383,8 +379,6 @@ size_t ServerManufactureSchematicObjectTemplate::getIngredientsCount(void) const int ServerManufactureSchematicObjectTemplate::getItemCount() const { - - const ServerManufactureSchematicObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -434,8 +428,6 @@ int ServerManufactureSchematicObjectTemplate::getItemCount() const int ServerManufactureSchematicObjectTemplate::getItemCountMin() const { - - const ServerManufactureSchematicObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -485,8 +477,6 @@ int ServerManufactureSchematicObjectTemplate::getItemCountMin() const int ServerManufactureSchematicObjectTemplate::getItemCountMax() const { - - const ServerManufactureSchematicObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -547,7 +537,7 @@ void ServerManufactureSchematicObjectTemplate::getAttributes(SchematicAttribute if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attributes in template %s", DataResource::getName())); - return ; + return; } else { @@ -561,10 +551,10 @@ void ServerManufactureSchematicObjectTemplate::getAttributes(SchematicAttribute { int baseCount = base->getAttributesCount(); if (index < baseCount) - { - base->getAttributes(data, index); - return; - } + { + base->getAttributes(data, index); + return; + } index -= baseCount; } @@ -590,7 +580,7 @@ void ServerManufactureSchematicObjectTemplate::getAttributesMin(SchematicAttribu if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attributes in template %s", DataResource::getName())); - return ; + return; } else { @@ -604,10 +594,10 @@ void ServerManufactureSchematicObjectTemplate::getAttributesMin(SchematicAttribu { int baseCount = base->getAttributesCount(); if (index < baseCount) - { - base->getAttributesMin(data, index); - return; - } + { + base->getAttributesMin(data, index); + return; + } index -= baseCount; } @@ -633,7 +623,7 @@ void ServerManufactureSchematicObjectTemplate::getAttributesMax(SchematicAttribu if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attributes in template %s", DataResource::getName())); - return ; + return; } else { @@ -647,10 +637,10 @@ void ServerManufactureSchematicObjectTemplate::getAttributesMax(SchematicAttribu { int baseCount = base->getAttributesCount(); if (index < baseCount) - { - base->getAttributesMax(data, index); - return; - } + { + base->getAttributesMax(data, index); + return; + } index -= baseCount; } @@ -687,7 +677,6 @@ size_t ServerManufactureSchematicObjectTemplate::getAttributesCount(void) const return count; } // ServerManufactureSchematicObjectTemplate::getAttributesCount - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -696,8 +685,8 @@ size_t ServerManufactureSchematicObjectTemplate::getAttributesCount(void) const */ void ServerManufactureSchematicObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != ServerManufactureSchematicObjectTemplate_tag) { @@ -707,7 +696,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -727,10 +716,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -796,7 +783,6 @@ char paramName[MAX_NAME_SIZE]; return; } // ServerManufactureSchematicObjectTemplate::load - //============================================================================= // class ServerManufactureSchematicObjectTemplate::_IngredientSlot @@ -845,8 +831,6 @@ Tag ServerManufactureSchematicObjectTemplate::_IngredientSlot::getId(void) const const StringId ServerManufactureSchematicObjectTemplate::_IngredientSlot::getName(bool versionOk) const { - - const ServerManufactureSchematicObjectTemplate::_IngredientSlot * base = nullptr; if (m_baseData != nullptr) { @@ -885,7 +869,7 @@ void ServerManufactureSchematicObjectTemplate::_IngredientSlot::getIngredient(In if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredient in template %s", DataResource::getName())); - return ; + return; } else { @@ -924,7 +908,7 @@ void ServerManufactureSchematicObjectTemplate::_IngredientSlot::getIngredientMin if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredient in template %s", DataResource::getName())); - return ; + return; } else { @@ -963,7 +947,7 @@ void ServerManufactureSchematicObjectTemplate::_IngredientSlot::getIngredientMax if (ms_allowDefaultTemplateParams && /*!versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter ingredient in template %s", DataResource::getName())); - return ; + return; } else { @@ -989,7 +973,6 @@ void ServerManufactureSchematicObjectTemplate::_IngredientSlot::getIngredientMax data.skillCommand = param->getSkillCommand(versionOk); } // ServerManufactureSchematicObjectTemplate::_IngredientSlot::getIngredientMax - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -998,8 +981,8 @@ void ServerManufactureSchematicObjectTemplate::_IngredientSlot::getIngredientMax */ void ServerManufactureSchematicObjectTemplate::_IngredientSlot::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -1021,4 +1004,4 @@ char paramName[MAX_NAME_SIZE]; UNREF(file); } // ServerManufactureSchematicObjectTemplate::_IngredientSlot::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerMissionObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerMissionObjectTemplate.cpp index 393edf46..5ee34097 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerMissionObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerMissionObjectTemplate.cpp @@ -22,20 +22,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool ServerMissionObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ ServerMissionObjectTemplate::ServerMissionObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : ServerIntangibleObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // ServerMissionObjectTemplate::ServerMissionObjectTemplate @@ -44,8 +44,8 @@ ServerMissionObjectTemplate::ServerMissionObjectTemplate(const std::string & fil */ ServerMissionObjectTemplate::~ServerMissionObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // ServerMissionObjectTemplate::~ServerMissionObjectTemplate /** @@ -121,8 +121,8 @@ Object * ServerMissionObjectTemplate::createObject(void) const */ void ServerMissionObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != ServerMissionObjectTemplate_tag) { @@ -132,7 +132,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -152,10 +152,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -173,4 +171,4 @@ char paramName[MAX_NAME_SIZE]; return; } // ServerMissionObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerObjectTemplate.cpp index 2ace8a95..957562c3 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerObjectTemplate.cpp @@ -26,35 +26,35 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool ServerObjectTemplate::ms_allowDefaultTemplateParams = true; -typedef std::unordered_map > XP_MAP; +typedef std::unordered_map > XP_MAP; static XP_MAP * XpMap = nullptr; - /** * Class constructor. */ ServerObjectTemplate::ServerObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : ObjectTemplate(filename) - ,m_scriptsLoaded(false) - ,m_scriptsAppend(false) - ,m_visibleFlagsLoaded(false) - ,m_visibleFlagsAppend(false) - ,m_deleteFlagsLoaded(false) - ,m_deleteFlagsAppend(false) - ,m_moveFlagsLoaded(false) - ,m_moveFlagsAppend(false) - ,m_contentsLoaded(false) - ,m_contentsAppend(false) - ,m_xpPointsLoaded(false) - ,m_xpPointsAppend(false) - ,m_versionOk(true) -//@END TFD INIT + , m_scriptsLoaded(false) + , m_scriptsAppend(false) + , m_visibleFlagsLoaded(false) + , m_visibleFlagsAppend(false) + , m_deleteFlagsLoaded(false) + , m_deleteFlagsAppend(false) + , m_moveFlagsLoaded(false) + , m_moveFlagsAppend(false) + , m_contentsLoaded(false) + , m_contentsAppend(false) + , m_xpPointsLoaded(false) + , m_xpPointsAppend(false) + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // ServerObjectTemplate::ServerObjectTemplate @@ -66,9 +66,9 @@ ServerObjectTemplate::~ServerObjectTemplate() if (m_baseData) { m_baseData->releaseReference(); - m_baseData=0; + m_baseData = 0; } -//@BEGIN TFD CLEANUP + //@BEGIN TFD CLEANUP { std::vector::iterator iter; for (iter = m_scripts.begin(); iter != m_scripts.end(); ++iter) @@ -123,7 +123,7 @@ ServerObjectTemplate::~ServerObjectTemplate() } m_xpPoints.clear(); } -//@END TFD CLEANUP + //@END TFD CLEANUP } // ServerObjectTemplate::~ServerObjectTemplate /** @@ -299,11 +299,11 @@ const std::string & ServerObjectTemplate::getXpString(XpTypes type) //---------------------------------------------------------------------- -const std::string & ServerObjectTemplate::getDamageTypeString (DamageType type) +const std::string & ServerObjectTemplate::getDamageTypeString(DamageType type) { static const std::string emptyString; - static const std::string DAMAGE_TYPE_NAMES[] = + static const std::string DAMAGE_TYPE_NAMES[] = { "kinetic", "energy", @@ -329,7 +329,7 @@ const std::string & ServerObjectTemplate::getDamageTypeString (DamageType type) for (int index = 0; index < DAMAGE_TYPE_NAMES_SIZE; ++index) { if ((i_damage & (1 << index)) != 0) - return DAMAGE_TYPE_NAMES [index]; + return DAMAGE_TYPE_NAMES[index]; } } @@ -338,11 +338,11 @@ const std::string & ServerObjectTemplate::getDamageTypeString (DamageType type) //---------------------------------------------------------------------- -const std::string & ServerObjectTemplate::getArmorRatingString (ArmorRating type) +const std::string & ServerObjectTemplate::getArmorRatingString(ArmorRating type) { static const std::string emptyString; - static const std::string ARMOR_RATING_NAMES[] = + static const std::string ARMOR_RATING_NAMES[] = { "none", "light", @@ -357,7 +357,7 @@ const std::string & ServerObjectTemplate::getArmorRatingString (ArmorRating type if (i_type < 0 || i_type >= ARMOR_RATING_NAMES_SIZE) return emptyString; - return ARMOR_RATING_NAMES [i_type]; + return ARMOR_RATING_NAMES[i_type]; } //---------------------------------------------------------------------- @@ -365,8 +365,6 @@ const std::string & ServerObjectTemplate::getArmorRatingString (ArmorRating type //@BEGIN TFD const std::string & ServerObjectTemplate::getSharedTemplate() const { - - const ServerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -464,7 +462,7 @@ void ServerObjectTemplate::getObjvars(DynamicVariableList &list) const if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter objvars in template %s", DataResource::getName())); - return ; + return; } else { @@ -481,8 +479,6 @@ void ServerObjectTemplate::getObjvars(DynamicVariableList &list) const int ServerObjectTemplate::getVolume() const { - - const ServerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -532,8 +528,6 @@ int ServerObjectTemplate::getVolume() const int ServerObjectTemplate::getVolumeMin() const { - - const ServerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -583,8 +577,6 @@ int ServerObjectTemplate::getVolumeMin() const int ServerObjectTemplate::getVolumeMax() const { - - const ServerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -808,8 +800,6 @@ size_t ServerObjectTemplate::getMoveFlagsCount(void) const bool ServerObjectTemplate::getInvulnerable() const { - - const ServerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -837,8 +827,6 @@ bool ServerObjectTemplate::getInvulnerable() const float ServerObjectTemplate::getComplexity() const { - - const ServerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -888,8 +876,6 @@ float ServerObjectTemplate::getComplexity() const float ServerObjectTemplate::getComplexityMin() const { - - const ServerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -939,8 +925,6 @@ float ServerObjectTemplate::getComplexityMin() const float ServerObjectTemplate::getComplexityMax() const { - - const ServerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -990,8 +974,6 @@ float ServerObjectTemplate::getComplexityMax() const int ServerObjectTemplate::getTintIndex() const { - - const ServerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1041,8 +1023,6 @@ int ServerObjectTemplate::getTintIndex() const int ServerObjectTemplate::getTintIndexMin() const { - - const ServerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1092,8 +1072,6 @@ int ServerObjectTemplate::getTintIndexMin() const int ServerObjectTemplate::getTintIndexMax() const { - - const ServerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1301,7 +1279,7 @@ void ServerObjectTemplate::getContents(Contents &data, int index) const if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter contents in template %s", DataResource::getName())); - return ; + return; } else { @@ -1315,10 +1293,10 @@ void ServerObjectTemplate::getContents(Contents &data, int index) const { int baseCount = base->getContentsCount(); if (index < baseCount) - { - base->getContents(data, index); - return; - } + { + base->getContents(data, index); + return; + } index -= baseCount; } @@ -1345,7 +1323,7 @@ void ServerObjectTemplate::getContentsMin(Contents &data, int index) const if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter contents in template %s", DataResource::getName())); - return ; + return; } else { @@ -1359,10 +1337,10 @@ void ServerObjectTemplate::getContentsMin(Contents &data, int index) const { int baseCount = base->getContentsCount(); if (index < baseCount) - { - base->getContentsMin(data, index); - return; - } + { + base->getContentsMin(data, index); + return; + } index -= baseCount; } @@ -1389,7 +1367,7 @@ void ServerObjectTemplate::getContentsMax(Contents &data, int index) const if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter contents in template %s", DataResource::getName())); - return ; + return; } else { @@ -1403,10 +1381,10 @@ void ServerObjectTemplate::getContentsMax(Contents &data, int index) const { int baseCount = base->getContentsCount(); if (index < baseCount) - { - base->getContentsMax(data, index); - return; - } + { + base->getContentsMax(data, index); + return; + } index -= baseCount; } @@ -1457,7 +1435,7 @@ void ServerObjectTemplate::getXpPoints(Xp &data, int index) const if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter xpPoints in template %s", DataResource::getName())); - return ; + return; } else { @@ -1471,10 +1449,10 @@ void ServerObjectTemplate::getXpPoints(Xp &data, int index) const { int baseCount = base->getXpPointsCount(); if (index < baseCount) - { - base->getXpPoints(data, index); - return; - } + { + base->getXpPoints(data, index); + return; + } index -= baseCount; } @@ -1501,7 +1479,7 @@ void ServerObjectTemplate::getXpPointsMin(Xp &data, int index) const if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter xpPoints in template %s", DataResource::getName())); - return ; + return; } else { @@ -1515,10 +1493,10 @@ void ServerObjectTemplate::getXpPointsMin(Xp &data, int index) const { int baseCount = base->getXpPointsCount(); if (index < baseCount) - { - base->getXpPointsMin(data, index); - return; - } + { + base->getXpPointsMin(data, index); + return; + } index -= baseCount; } @@ -1545,7 +1523,7 @@ void ServerObjectTemplate::getXpPointsMax(Xp &data, int index) const if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter xpPoints in template %s", DataResource::getName())); - return ; + return; } else { @@ -1559,10 +1537,10 @@ void ServerObjectTemplate::getXpPointsMax(Xp &data, int index) const { int baseCount = base->getXpPointsCount(); if (index < baseCount) - { - base->getXpPointsMax(data, index); - return; - } + { + base->getXpPointsMax(data, index); + return; + } index -= baseCount; } @@ -1602,8 +1580,6 @@ size_t ServerObjectTemplate::getXpPointsCount(void) const bool ServerObjectTemplate::getPersistByDefault() const { - - const ServerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1631,8 +1607,6 @@ bool ServerObjectTemplate::getPersistByDefault() const bool ServerObjectTemplate::getPersistContents() const { - - const ServerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1658,7 +1632,6 @@ bool ServerObjectTemplate::getPersistContents() const return value; } // ServerObjectTemplate::getPersistContents - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -1667,8 +1640,8 @@ bool ServerObjectTemplate::getPersistContents() const */ void ServerObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != ServerObjectTemplate_tag) { @@ -1677,7 +1650,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -1697,10 +1670,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,1,1)) + if (getHighestTemplateVersion() != TAG(0, 0, 1, 1)) { - - m_versionOk = false; } @@ -1864,7 +1835,6 @@ char paramName[MAX_NAME_SIZE]; return; } // ServerObjectTemplate::load - //============================================================================= // class ServerObjectTemplate::_AttribMod @@ -1913,8 +1883,6 @@ Tag ServerObjectTemplate::_AttribMod::getId(void) const ServerObjectTemplate::Attributes ServerObjectTemplate::_AttribMod::getTarget(bool versionOk) const { - - const ServerObjectTemplate::_AttribMod * base = nullptr; if (m_baseData != nullptr) { @@ -1942,8 +1910,6 @@ ServerObjectTemplate::Attributes ServerObjectTemplate::_AttribMod::getTarget(boo int ServerObjectTemplate::_AttribMod::getValue(bool versionOk) const { - - const ServerObjectTemplate::_AttribMod * base = nullptr; if (m_baseData != nullptr) { @@ -1993,8 +1959,6 @@ int ServerObjectTemplate::_AttribMod::getValue(bool versionOk) const int ServerObjectTemplate::_AttribMod::getValueMin(bool versionOk) const { - - const ServerObjectTemplate::_AttribMod * base = nullptr; if (m_baseData != nullptr) { @@ -2044,8 +2008,6 @@ int ServerObjectTemplate::_AttribMod::getValueMin(bool versionOk) const int ServerObjectTemplate::_AttribMod::getValueMax(bool versionOk) const { - - const ServerObjectTemplate::_AttribMod * base = nullptr; if (m_baseData != nullptr) { @@ -2095,8 +2057,6 @@ int ServerObjectTemplate::_AttribMod::getValueMax(bool versionOk) const float ServerObjectTemplate::_AttribMod::getTime(bool versionOk) const { - - const ServerObjectTemplate::_AttribMod * base = nullptr; if (m_baseData != nullptr) { @@ -2146,8 +2106,6 @@ float ServerObjectTemplate::_AttribMod::getTime(bool versionOk) const float ServerObjectTemplate::_AttribMod::getTimeMin(bool versionOk) const { - - const ServerObjectTemplate::_AttribMod * base = nullptr; if (m_baseData != nullptr) { @@ -2197,8 +2155,6 @@ float ServerObjectTemplate::_AttribMod::getTimeMin(bool versionOk) const float ServerObjectTemplate::_AttribMod::getTimeMax(bool versionOk) const { - - const ServerObjectTemplate::_AttribMod * base = nullptr; if (m_baseData != nullptr) { @@ -2248,8 +2204,6 @@ float ServerObjectTemplate::_AttribMod::getTimeMax(bool versionOk) const float ServerObjectTemplate::_AttribMod::getTimeAtValue(bool versionOk) const { - - const ServerObjectTemplate::_AttribMod * base = nullptr; if (m_baseData != nullptr) { @@ -2299,8 +2253,6 @@ float ServerObjectTemplate::_AttribMod::getTimeAtValue(bool versionOk) const float ServerObjectTemplate::_AttribMod::getTimeAtValueMin(bool versionOk) const { - - const ServerObjectTemplate::_AttribMod * base = nullptr; if (m_baseData != nullptr) { @@ -2350,8 +2302,6 @@ float ServerObjectTemplate::_AttribMod::getTimeAtValueMin(bool versionOk) const float ServerObjectTemplate::_AttribMod::getTimeAtValueMax(bool versionOk) const { - - const ServerObjectTemplate::_AttribMod * base = nullptr; if (m_baseData != nullptr) { @@ -2401,8 +2351,6 @@ float ServerObjectTemplate::_AttribMod::getTimeAtValueMax(bool versionOk) const float ServerObjectTemplate::_AttribMod::getDecay(bool versionOk) const { - - const ServerObjectTemplate::_AttribMod * base = nullptr; if (m_baseData != nullptr) { @@ -2452,8 +2400,6 @@ float ServerObjectTemplate::_AttribMod::getDecay(bool versionOk) const float ServerObjectTemplate::_AttribMod::getDecayMin(bool versionOk) const { - - const ServerObjectTemplate::_AttribMod * base = nullptr; if (m_baseData != nullptr) { @@ -2503,8 +2449,6 @@ float ServerObjectTemplate::_AttribMod::getDecayMin(bool versionOk) const float ServerObjectTemplate::_AttribMod::getDecayMax(bool versionOk) const { - - const ServerObjectTemplate::_AttribMod * base = nullptr; if (m_baseData != nullptr) { @@ -2552,7 +2496,6 @@ float ServerObjectTemplate::_AttribMod::getDecayMax(bool versionOk) const return value; } // ServerObjectTemplate::_AttribMod::getDecayMax - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -2561,8 +2504,8 @@ float ServerObjectTemplate::_AttribMod::getDecayMax(bool versionOk) const */ void ServerObjectTemplate::_AttribMod::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -2590,7 +2533,6 @@ char paramName[MAX_NAME_SIZE]; UNREF(file); } // ServerObjectTemplate::_AttribMod::load - //============================================================================= // struct ServerObjectTemplate::Contents @@ -2637,7 +2579,6 @@ ServerObjectTemplate::Contents & ServerObjectTemplate::Contents::operator =(cons } // ServerObjectTemplate::Contents::operator = #endif - //============================================================================= // class ServerObjectTemplate::_Contents @@ -2686,8 +2627,6 @@ Tag ServerObjectTemplate::_Contents::getId(void) const const std::string & ServerObjectTemplate::_Contents::getSlotName(bool versionOk) const { - - const ServerObjectTemplate::_Contents * base = nullptr; if (m_baseData != nullptr) { @@ -2715,8 +2654,6 @@ const std::string & ServerObjectTemplate::_Contents::getSlotName(bool versionOk) bool ServerObjectTemplate::_Contents::getEquipObject(bool versionOk) const { - - const ServerObjectTemplate::_Contents * base = nullptr; if (m_baseData != nullptr) { @@ -2770,12 +2707,11 @@ const ServerObjectTemplate * ServerObjectTemplate::_Contents::getContent(bool ve { returnValue = dynamic_cast(ObjectTemplateList::fetch(templateName)); if (returnValue == nullptr) - WARNING_STRICT_FATAL(true, ("Error loading template %s",templateName.c_str())); + WARNING_STRICT_FATAL(true, ("Error loading template %s", templateName.c_str())); } return returnValue; } // ServerObjectTemplate::_Contents::getContent - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -2784,8 +2720,8 @@ const ServerObjectTemplate * ServerObjectTemplate::_Contents::getContent(bool ve */ void ServerObjectTemplate::_Contents::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -2809,7 +2745,6 @@ char paramName[MAX_NAME_SIZE]; UNREF(file); } // ServerObjectTemplate::_Contents::load - //============================================================================= // class ServerObjectTemplate::_MentalStateMod @@ -2858,8 +2793,6 @@ Tag ServerObjectTemplate::_MentalStateMod::getId(void) const ServerObjectTemplate::MentalStates ServerObjectTemplate::_MentalStateMod::getTarget(bool versionOk) const { - - const ServerObjectTemplate::_MentalStateMod * base = nullptr; if (m_baseData != nullptr) { @@ -2887,8 +2820,6 @@ ServerObjectTemplate::MentalStates ServerObjectTemplate::_MentalStateMod::getTar float ServerObjectTemplate::_MentalStateMod::getValue(bool versionOk) const { - - const ServerObjectTemplate::_MentalStateMod * base = nullptr; if (m_baseData != nullptr) { @@ -2938,8 +2869,6 @@ float ServerObjectTemplate::_MentalStateMod::getValue(bool versionOk) const float ServerObjectTemplate::_MentalStateMod::getValueMin(bool versionOk) const { - - const ServerObjectTemplate::_MentalStateMod * base = nullptr; if (m_baseData != nullptr) { @@ -2989,8 +2918,6 @@ float ServerObjectTemplate::_MentalStateMod::getValueMin(bool versionOk) const float ServerObjectTemplate::_MentalStateMod::getValueMax(bool versionOk) const { - - const ServerObjectTemplate::_MentalStateMod * base = nullptr; if (m_baseData != nullptr) { @@ -3040,8 +2967,6 @@ float ServerObjectTemplate::_MentalStateMod::getValueMax(bool versionOk) const float ServerObjectTemplate::_MentalStateMod::getTime(bool versionOk) const { - - const ServerObjectTemplate::_MentalStateMod * base = nullptr; if (m_baseData != nullptr) { @@ -3091,8 +3016,6 @@ float ServerObjectTemplate::_MentalStateMod::getTime(bool versionOk) const float ServerObjectTemplate::_MentalStateMod::getTimeMin(bool versionOk) const { - - const ServerObjectTemplate::_MentalStateMod * base = nullptr; if (m_baseData != nullptr) { @@ -3142,8 +3065,6 @@ float ServerObjectTemplate::_MentalStateMod::getTimeMin(bool versionOk) const float ServerObjectTemplate::_MentalStateMod::getTimeMax(bool versionOk) const { - - const ServerObjectTemplate::_MentalStateMod * base = nullptr; if (m_baseData != nullptr) { @@ -3193,8 +3114,6 @@ float ServerObjectTemplate::_MentalStateMod::getTimeMax(bool versionOk) const float ServerObjectTemplate::_MentalStateMod::getTimeAtValue(bool versionOk) const { - - const ServerObjectTemplate::_MentalStateMod * base = nullptr; if (m_baseData != nullptr) { @@ -3244,8 +3163,6 @@ float ServerObjectTemplate::_MentalStateMod::getTimeAtValue(bool versionOk) cons float ServerObjectTemplate::_MentalStateMod::getTimeAtValueMin(bool versionOk) const { - - const ServerObjectTemplate::_MentalStateMod * base = nullptr; if (m_baseData != nullptr) { @@ -3295,8 +3212,6 @@ float ServerObjectTemplate::_MentalStateMod::getTimeAtValueMin(bool versionOk) c float ServerObjectTemplate::_MentalStateMod::getTimeAtValueMax(bool versionOk) const { - - const ServerObjectTemplate::_MentalStateMod * base = nullptr; if (m_baseData != nullptr) { @@ -3346,8 +3261,6 @@ float ServerObjectTemplate::_MentalStateMod::getTimeAtValueMax(bool versionOk) c float ServerObjectTemplate::_MentalStateMod::getDecay(bool versionOk) const { - - const ServerObjectTemplate::_MentalStateMod * base = nullptr; if (m_baseData != nullptr) { @@ -3397,8 +3310,6 @@ float ServerObjectTemplate::_MentalStateMod::getDecay(bool versionOk) const float ServerObjectTemplate::_MentalStateMod::getDecayMin(bool versionOk) const { - - const ServerObjectTemplate::_MentalStateMod * base = nullptr; if (m_baseData != nullptr) { @@ -3448,8 +3359,6 @@ float ServerObjectTemplate::_MentalStateMod::getDecayMin(bool versionOk) const float ServerObjectTemplate::_MentalStateMod::getDecayMax(bool versionOk) const { - - const ServerObjectTemplate::_MentalStateMod * base = nullptr; if (m_baseData != nullptr) { @@ -3497,7 +3406,6 @@ float ServerObjectTemplate::_MentalStateMod::getDecayMax(bool versionOk) const return value; } // ServerObjectTemplate::_MentalStateMod::getDecayMax - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -3506,8 +3414,8 @@ float ServerObjectTemplate::_MentalStateMod::getDecayMax(bool versionOk) const */ void ServerObjectTemplate::_MentalStateMod::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -3535,7 +3443,6 @@ char paramName[MAX_NAME_SIZE]; UNREF(file); } // ServerObjectTemplate::_MentalStateMod::load - //============================================================================= // class ServerObjectTemplate::_Xp @@ -3584,8 +3491,6 @@ Tag ServerObjectTemplate::_Xp::getId(void) const ServerObjectTemplate::XpTypes ServerObjectTemplate::_Xp::getType(bool versionOk) const { - - const ServerObjectTemplate::_Xp * base = nullptr; if (m_baseData != nullptr) { @@ -3613,8 +3518,6 @@ ServerObjectTemplate::XpTypes ServerObjectTemplate::_Xp::getType(bool versionOk) int ServerObjectTemplate::_Xp::getLevel(bool versionOk) const { - - const ServerObjectTemplate::_Xp * base = nullptr; if (m_baseData != nullptr) { @@ -3664,8 +3567,6 @@ int ServerObjectTemplate::_Xp::getLevel(bool versionOk) const int ServerObjectTemplate::_Xp::getLevelMin(bool versionOk) const { - - const ServerObjectTemplate::_Xp * base = nullptr; if (m_baseData != nullptr) { @@ -3715,8 +3616,6 @@ int ServerObjectTemplate::_Xp::getLevelMin(bool versionOk) const int ServerObjectTemplate::_Xp::getLevelMax(bool versionOk) const { - - const ServerObjectTemplate::_Xp * base = nullptr; if (m_baseData != nullptr) { @@ -3766,8 +3665,6 @@ int ServerObjectTemplate::_Xp::getLevelMax(bool versionOk) const int ServerObjectTemplate::_Xp::getValue(bool versionOk) const { - - const ServerObjectTemplate::_Xp * base = nullptr; if (m_baseData != nullptr) { @@ -3817,8 +3714,6 @@ int ServerObjectTemplate::_Xp::getValue(bool versionOk) const int ServerObjectTemplate::_Xp::getValueMin(bool versionOk) const { - - const ServerObjectTemplate::_Xp * base = nullptr; if (m_baseData != nullptr) { @@ -3868,8 +3763,6 @@ int ServerObjectTemplate::_Xp::getValueMin(bool versionOk) const int ServerObjectTemplate::_Xp::getValueMax(bool versionOk) const { - - const ServerObjectTemplate::_Xp * base = nullptr; if (m_baseData != nullptr) { @@ -3917,7 +3810,6 @@ int ServerObjectTemplate::_Xp::getValueMax(bool versionOk) const return value; } // ServerObjectTemplate::_Xp::getValueMax - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -3926,8 +3818,8 @@ int ServerObjectTemplate::_Xp::getValueMax(bool versionOk) const */ void ServerObjectTemplate::_Xp::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -3951,4 +3843,4 @@ char paramName[MAX_NAME_SIZE]; UNREF(file); } // ServerObjectTemplate::_Xp::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlanetObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlanetObjectTemplate.cpp index e062a1a2..6f5a7cbf 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlanetObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlanetObjectTemplate.cpp @@ -22,20 +22,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool ServerPlanetObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ ServerPlanetObjectTemplate::ServerPlanetObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : ServerUniverseObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // ServerPlanetObjectTemplate::ServerPlanetObjectTemplate @@ -44,8 +44,8 @@ ServerPlanetObjectTemplate::ServerPlanetObjectTemplate(const std::string & filen */ ServerPlanetObjectTemplate::~ServerPlanetObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // ServerPlanetObjectTemplate::~ServerPlanetObjectTemplate /** @@ -114,8 +114,6 @@ Object * ServerPlanetObjectTemplate::createObject(void) const //@BEGIN TFD const std::string & ServerPlanetObjectTemplate::getPlanetName() const { - - const ServerPlanetObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -141,7 +139,6 @@ const std::string & ServerPlanetObjectTemplate::getPlanetName() const return value; } // ServerPlanetObjectTemplate::getPlanetName - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -150,8 +147,8 @@ const std::string & ServerPlanetObjectTemplate::getPlanetName() const */ void ServerPlanetObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != ServerPlanetObjectTemplate_tag) { @@ -161,7 +158,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -181,10 +178,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -208,4 +203,4 @@ char paramName[MAX_NAME_SIZE]; return; } // ServerPlanetObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerObjectTemplate.cpp index 5c5b8bc7..752f5ed4 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerObjectTemplate.cpp @@ -24,20 +24,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool ServerPlayerObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ ServerPlayerObjectTemplate::ServerPlayerObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : ServerIntangibleObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // ServerPlayerObjectTemplate::ServerPlayerObjectTemplate @@ -46,8 +46,8 @@ ServerPlayerObjectTemplate::ServerPlayerObjectTemplate(const std::string & filen */ ServerPlayerObjectTemplate::~ServerPlayerObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // ServerPlayerObjectTemplate::~ServerPlayerObjectTemplate /** @@ -123,8 +123,8 @@ Object * ServerPlayerObjectTemplate::createObject(void) const */ void ServerPlayerObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != ServerPlayerObjectTemplate_tag) { @@ -134,7 +134,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -154,10 +154,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -175,4 +173,4 @@ char paramName[MAX_NAME_SIZE]; return; } // ServerPlayerObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerQuestObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerQuestObjectTemplate.cpp index f8e95c89..48d74162 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerQuestObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerPlayerQuestObjectTemplate.cpp @@ -24,20 +24,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool ServerPlayerQuestObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ ServerPlayerQuestObjectTemplate::ServerPlayerQuestObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : ServerTangibleObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // ServerPlayerQuestObjectTemplate::ServerPlayerQuestObjectTemplate @@ -46,8 +46,8 @@ ServerPlayerQuestObjectTemplate::ServerPlayerQuestObjectTemplate(const std::stri */ ServerPlayerQuestObjectTemplate::~ServerPlayerQuestObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // ServerPlayerQuestObjectTemplate::~ServerPlayerQuestObjectTemplate /** @@ -113,7 +113,6 @@ Object * ServerPlayerQuestObjectTemplate::createObject(void) const return new PlayerQuestObject(this); } // ServerMissionObjectTemplate::createObject - //@BEGIN TFD /** @@ -124,8 +123,8 @@ Object * ServerPlayerQuestObjectTemplate::createObject(void) const */ void ServerPlayerQuestObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != ServerPlayerQuestObjectTemplate_tag) { @@ -135,7 +134,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -155,10 +154,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -176,4 +173,4 @@ char paramName[MAX_NAME_SIZE]; return; } // ServerPlayerQuestObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerResourceContainerObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerResourceContainerObjectTemplate.cpp index 664a0e50..a4eba676 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerResourceContainerObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerResourceContainerObjectTemplate.cpp @@ -22,20 +22,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool ServerResourceContainerObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ ServerResourceContainerObjectTemplate::ServerResourceContainerObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : ServerTangibleObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // ServerResourceContainerObjectTemplate::ServerResourceContainerObjectTemplate @@ -44,8 +44,8 @@ ServerResourceContainerObjectTemplate::ServerResourceContainerObjectTemplate(con */ ServerResourceContainerObjectTemplate::~ServerResourceContainerObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // ServerResourceContainerObjectTemplate::~ServerResourceContainerObjectTemplate /** @@ -114,8 +114,6 @@ Object * ServerResourceContainerObjectTemplate::createObject(void) const //@BEGIN TFD int ServerResourceContainerObjectTemplate::getMaxResources() const { - - const ServerResourceContainerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -165,8 +163,6 @@ int ServerResourceContainerObjectTemplate::getMaxResources() const int ServerResourceContainerObjectTemplate::getMaxResourcesMin() const { - - const ServerResourceContainerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -216,8 +212,6 @@ int ServerResourceContainerObjectTemplate::getMaxResourcesMin() const int ServerResourceContainerObjectTemplate::getMaxResourcesMax() const { - - const ServerResourceContainerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -265,7 +259,6 @@ int ServerResourceContainerObjectTemplate::getMaxResourcesMax() const return value; } // ServerResourceContainerObjectTemplate::getMaxResourcesMax - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -274,8 +267,8 @@ int ServerResourceContainerObjectTemplate::getMaxResourcesMax() const */ void ServerResourceContainerObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != ServerResourceContainerObjectTemplate_tag) { @@ -285,7 +278,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -305,10 +298,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -332,4 +323,4 @@ char paramName[MAX_NAME_SIZE]; return; } // ServerResourceContainerObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerShipObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerShipObjectTemplate.cpp index fee87be0..d4b0320c 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerShipObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerShipObjectTemplate.cpp @@ -23,20 +23,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool ServerShipObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ ServerShipObjectTemplate::ServerShipObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : ServerTangibleObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // ServerShipObjectTemplate::ServerShipObjectTemplate @@ -45,8 +45,8 @@ ServerShipObjectTemplate::ServerShipObjectTemplate(const std::string & filename) */ ServerShipObjectTemplate::~ServerShipObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // ServerShipObjectTemplate::~ServerShipObjectTemplate /** @@ -115,8 +115,6 @@ Object * ServerShipObjectTemplate::createObject(void) const //@BEGIN TFD const std::string & ServerShipObjectTemplate::getShipType() const { - - const ServerShipObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -142,7 +140,6 @@ const std::string & ServerShipObjectTemplate::getShipType() const return value; } // ServerShipObjectTemplate::getShipType - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -151,8 +148,8 @@ const std::string & ServerShipObjectTemplate::getShipType() const */ void ServerShipObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != ServerShipObjectTemplate_tag) { @@ -162,7 +159,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -182,10 +179,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,1)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 1)) { - - m_versionOk = false; } @@ -209,4 +204,4 @@ char paramName[MAX_NAME_SIZE]; return; } // ServerShipObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerStaticObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerStaticObjectTemplate.cpp index c4d48e62..46819a82 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerStaticObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerStaticObjectTemplate.cpp @@ -22,20 +22,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool ServerStaticObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ ServerStaticObjectTemplate::ServerStaticObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : ServerObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // ServerStaticObjectTemplate::ServerStaticObjectTemplate @@ -44,8 +44,8 @@ ServerStaticObjectTemplate::ServerStaticObjectTemplate(const std::string & filen */ ServerStaticObjectTemplate::~ServerStaticObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // ServerStaticObjectTemplate::~ServerStaticObjectTemplate /** @@ -114,8 +114,6 @@ Object * ServerStaticObjectTemplate::createObject(void) const //@BEGIN TFD bool ServerStaticObjectTemplate::getClientOnlyBuildout() const { - - const ServerStaticObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -141,7 +139,6 @@ bool ServerStaticObjectTemplate::getClientOnlyBuildout() const return value; } // ServerStaticObjectTemplate::getClientOnlyBuildout - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -150,8 +147,8 @@ bool ServerStaticObjectTemplate::getClientOnlyBuildout() const */ void ServerStaticObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != ServerStaticObjectTemplate_tag) { @@ -161,7 +158,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -181,10 +178,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,1)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 1)) { - - m_versionOk = false; } @@ -208,4 +203,4 @@ char paramName[MAX_NAME_SIZE]; return; } // ServerStaticObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerTangibleObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerTangibleObjectTemplate.cpp index 6212cc40..7909df9e 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerTangibleObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerTangibleObjectTemplate.cpp @@ -23,22 +23,22 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool ServerTangibleObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ ServerTangibleObjectTemplate::ServerTangibleObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : ServerObjectTemplate(filename) - ,m_triggerVolumesLoaded(false) - ,m_triggerVolumesAppend(false) - ,m_versionOk(true) -//@END TFD INIT + , m_triggerVolumesLoaded(false) + , m_triggerVolumesAppend(false) + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // ServerTangibleObjectTemplate::ServerTangibleObjectTemplate @@ -47,7 +47,7 @@ ServerTangibleObjectTemplate::ServerTangibleObjectTemplate(const std::string & f */ ServerTangibleObjectTemplate::~ServerTangibleObjectTemplate() { -//@BEGIN TFD CLEANUP + //@BEGIN TFD CLEANUP { std::vector::iterator iter; for (iter = m_triggerVolumes.begin(); iter != m_triggerVolumes.end(); ++iter) @@ -57,7 +57,7 @@ ServerTangibleObjectTemplate::~ServerTangibleObjectTemplate() } m_triggerVolumes.clear(); } -//@END TFD CLEANUP + //@END TFD CLEANUP } // ServerTangibleObjectTemplate::~ServerTangibleObjectTemplate /** @@ -186,8 +186,6 @@ size_t ServerTangibleObjectTemplate::getTriggerVolumesCount(void) const ServerTangibleObjectTemplate::CombatSkeleton ServerTangibleObjectTemplate::getCombatSkeleton() const { - - const ServerTangibleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -215,8 +213,6 @@ ServerTangibleObjectTemplate::CombatSkeleton ServerTangibleObjectTemplate::getCo int ServerTangibleObjectTemplate::getMaxHitPoints() const { - - const ServerTangibleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -266,8 +262,6 @@ int ServerTangibleObjectTemplate::getMaxHitPoints() const int ServerTangibleObjectTemplate::getMaxHitPointsMin() const { - - const ServerTangibleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -317,8 +311,6 @@ int ServerTangibleObjectTemplate::getMaxHitPointsMin() const int ServerTangibleObjectTemplate::getMaxHitPointsMax() const { - - const ServerTangibleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -394,15 +386,13 @@ const ServerArmorTemplate * ServerTangibleObjectTemplate::getArmor() const { returnValue = dynamic_cast(ObjectTemplateList::fetch(templateName)); if (returnValue == nullptr) - WARNING_STRICT_FATAL(true, ("Error loading template %s",templateName.c_str())); + WARNING_STRICT_FATAL(true, ("Error loading template %s", templateName.c_str())); } return returnValue; } // ServerTangibleObjectTemplate::getArmor int ServerTangibleObjectTemplate::getInterestRadius() const { - - const ServerTangibleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -452,8 +442,6 @@ int ServerTangibleObjectTemplate::getInterestRadius() const int ServerTangibleObjectTemplate::getInterestRadiusMin() const { - - const ServerTangibleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -503,8 +491,6 @@ int ServerTangibleObjectTemplate::getInterestRadiusMin() const int ServerTangibleObjectTemplate::getInterestRadiusMax() const { - - const ServerTangibleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -554,8 +540,6 @@ int ServerTangibleObjectTemplate::getInterestRadiusMax() const int ServerTangibleObjectTemplate::getCount() const { - - const ServerTangibleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -605,8 +589,6 @@ int ServerTangibleObjectTemplate::getCount() const int ServerTangibleObjectTemplate::getCountMin() const { - - const ServerTangibleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -656,8 +638,6 @@ int ServerTangibleObjectTemplate::getCountMin() const int ServerTangibleObjectTemplate::getCountMax() const { - - const ServerTangibleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -707,8 +687,6 @@ int ServerTangibleObjectTemplate::getCountMax() const int ServerTangibleObjectTemplate::getCondition() const { - - const ServerTangibleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -758,8 +736,6 @@ int ServerTangibleObjectTemplate::getCondition() const int ServerTangibleObjectTemplate::getConditionMin() const { - - const ServerTangibleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -809,8 +785,6 @@ int ServerTangibleObjectTemplate::getConditionMin() const int ServerTangibleObjectTemplate::getConditionMax() const { - - const ServerTangibleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -860,8 +834,6 @@ int ServerTangibleObjectTemplate::getConditionMax() const bool ServerTangibleObjectTemplate::getWantSawAttackTriggers() const { - - const ServerTangibleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -887,7 +859,6 @@ bool ServerTangibleObjectTemplate::getWantSawAttackTriggers() const return value; } // ServerTangibleObjectTemplate::getWantSawAttackTriggers - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -896,8 +867,8 @@ bool ServerTangibleObjectTemplate::getWantSawAttackTriggers() const */ void ServerTangibleObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != ServerTangibleObjectTemplate_tag) { @@ -907,7 +878,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -927,10 +898,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,4)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 4)) { - - m_versionOk = false; } @@ -985,4 +954,4 @@ char paramName[MAX_NAME_SIZE]; return; } // ServerTangibleObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerUniverseObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerUniverseObjectTemplate.cpp index bf4eafdd..eb9194d0 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerUniverseObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerUniverseObjectTemplate.cpp @@ -22,20 +22,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool ServerUniverseObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ ServerUniverseObjectTemplate::ServerUniverseObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : ServerObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // ServerUniverseObjectTemplate::ServerUniverseObjectTemplate @@ -44,8 +44,8 @@ ServerUniverseObjectTemplate::ServerUniverseObjectTemplate(const std::string & f */ ServerUniverseObjectTemplate::~ServerUniverseObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // ServerUniverseObjectTemplate::~ServerUniverseObjectTemplate /** @@ -121,8 +121,8 @@ Object * ServerUniverseObjectTemplate::createObject(void) const */ void ServerUniverseObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != ServerUniverseObjectTemplate_tag) { @@ -132,7 +132,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -152,10 +152,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -173,4 +171,4 @@ char paramName[MAX_NAME_SIZE]; return; } // ServerUniverseObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerVehicleObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerVehicleObjectTemplate.cpp index fc9605f8..0ee8b18c 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerVehicleObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerVehicleObjectTemplate.cpp @@ -22,20 +22,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool ServerVehicleObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ ServerVehicleObjectTemplate::ServerVehicleObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : ServerTangibleObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // ServerVehicleObjectTemplate::ServerVehicleObjectTemplate @@ -44,8 +44,8 @@ ServerVehicleObjectTemplate::ServerVehicleObjectTemplate(const std::string & fil */ ServerVehicleObjectTemplate::~ServerVehicleObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // ServerVehicleObjectTemplate::~ServerVehicleObjectTemplate /** @@ -114,8 +114,6 @@ Object * ServerVehicleObjectTemplate::createObject(void) const //@BEGIN TFD const std::string & ServerVehicleObjectTemplate::getFuelType() const { - - const ServerVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -143,8 +141,6 @@ const std::string & ServerVehicleObjectTemplate::getFuelType() const float ServerVehicleObjectTemplate::getCurrentFuel() const { - - const ServerVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -194,8 +190,6 @@ float ServerVehicleObjectTemplate::getCurrentFuel() const float ServerVehicleObjectTemplate::getCurrentFuelMin() const { - - const ServerVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -245,8 +239,6 @@ float ServerVehicleObjectTemplate::getCurrentFuelMin() const float ServerVehicleObjectTemplate::getCurrentFuelMax() const { - - const ServerVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -296,8 +288,6 @@ float ServerVehicleObjectTemplate::getCurrentFuelMax() const float ServerVehicleObjectTemplate::getMaxFuel() const { - - const ServerVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -347,8 +337,6 @@ float ServerVehicleObjectTemplate::getMaxFuel() const float ServerVehicleObjectTemplate::getMaxFuelMin() const { - - const ServerVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -398,8 +386,6 @@ float ServerVehicleObjectTemplate::getMaxFuelMin() const float ServerVehicleObjectTemplate::getMaxFuelMax() const { - - const ServerVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -449,8 +435,6 @@ float ServerVehicleObjectTemplate::getMaxFuelMax() const float ServerVehicleObjectTemplate::getConsumpsion() const { - - const ServerVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -500,8 +484,6 @@ float ServerVehicleObjectTemplate::getConsumpsion() const float ServerVehicleObjectTemplate::getConsumpsionMin() const { - - const ServerVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -551,8 +533,6 @@ float ServerVehicleObjectTemplate::getConsumpsionMin() const float ServerVehicleObjectTemplate::getConsumpsionMax() const { - - const ServerVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -600,7 +580,6 @@ float ServerVehicleObjectTemplate::getConsumpsionMax() const return value; } // ServerVehicleObjectTemplate::getConsumpsionMax - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -609,8 +588,8 @@ float ServerVehicleObjectTemplate::getConsumpsionMax() const */ void ServerVehicleObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != ServerVehicleObjectTemplate_tag) { @@ -620,7 +599,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -640,10 +619,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -673,4 +650,4 @@ char paramName[MAX_NAME_SIZE]; return; } // ServerVehicleObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerWeaponObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerWeaponObjectTemplate.cpp index 973ac20e..ee19eb9c 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerWeaponObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerWeaponObjectTemplate.cpp @@ -22,20 +22,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool ServerWeaponObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ ServerWeaponObjectTemplate::ServerWeaponObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : ServerTangibleObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // ServerWeaponObjectTemplate::ServerWeaponObjectTemplate @@ -44,8 +44,8 @@ ServerWeaponObjectTemplate::ServerWeaponObjectTemplate(const std::string & filen */ ServerWeaponObjectTemplate::~ServerWeaponObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // ServerWeaponObjectTemplate::~ServerWeaponObjectTemplate /** @@ -114,8 +114,6 @@ Object * ServerWeaponObjectTemplate::createObject(void) const //@BEGIN TFD ServerWeaponObjectTemplate::WeaponType ServerWeaponObjectTemplate::getWeaponType() const { - - const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -143,8 +141,6 @@ ServerWeaponObjectTemplate::WeaponType ServerWeaponObjectTemplate::getWeaponType ServerWeaponObjectTemplate::AttackType ServerWeaponObjectTemplate::getAttackType() const { - - const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -172,8 +168,6 @@ ServerWeaponObjectTemplate::AttackType ServerWeaponObjectTemplate::getAttackType ServerWeaponObjectTemplate::DamageType ServerWeaponObjectTemplate::getDamageType() const { - - const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -201,8 +195,6 @@ ServerWeaponObjectTemplate::DamageType ServerWeaponObjectTemplate::getDamageType ServerWeaponObjectTemplate::DamageType ServerWeaponObjectTemplate::getElementalType() const { - - const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -230,8 +222,6 @@ ServerWeaponObjectTemplate::DamageType ServerWeaponObjectTemplate::getElementalT int ServerWeaponObjectTemplate::getElementalValue() const { - - const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -281,8 +271,6 @@ int ServerWeaponObjectTemplate::getElementalValue() const int ServerWeaponObjectTemplate::getElementalValueMin() const { - - const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -332,8 +320,6 @@ int ServerWeaponObjectTemplate::getElementalValueMin() const int ServerWeaponObjectTemplate::getElementalValueMax() const { - - const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -383,8 +369,6 @@ int ServerWeaponObjectTemplate::getElementalValueMax() const int ServerWeaponObjectTemplate::getMinDamageAmount() const { - - const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -434,8 +418,6 @@ int ServerWeaponObjectTemplate::getMinDamageAmount() const int ServerWeaponObjectTemplate::getMinDamageAmountMin() const { - - const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -485,8 +467,6 @@ int ServerWeaponObjectTemplate::getMinDamageAmountMin() const int ServerWeaponObjectTemplate::getMinDamageAmountMax() const { - - const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -536,8 +516,6 @@ int ServerWeaponObjectTemplate::getMinDamageAmountMax() const int ServerWeaponObjectTemplate::getMaxDamageAmount() const { - - const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -587,8 +565,6 @@ int ServerWeaponObjectTemplate::getMaxDamageAmount() const int ServerWeaponObjectTemplate::getMaxDamageAmountMin() const { - - const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -638,8 +614,6 @@ int ServerWeaponObjectTemplate::getMaxDamageAmountMin() const int ServerWeaponObjectTemplate::getMaxDamageAmountMax() const { - - const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -689,8 +663,6 @@ int ServerWeaponObjectTemplate::getMaxDamageAmountMax() const float ServerWeaponObjectTemplate::getAttackSpeed() const { - - const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -740,8 +712,6 @@ float ServerWeaponObjectTemplate::getAttackSpeed() const float ServerWeaponObjectTemplate::getAttackSpeedMin() const { - - const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -791,8 +761,6 @@ float ServerWeaponObjectTemplate::getAttackSpeedMin() const float ServerWeaponObjectTemplate::getAttackSpeedMax() const { - - const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -842,8 +810,6 @@ float ServerWeaponObjectTemplate::getAttackSpeedMax() const float ServerWeaponObjectTemplate::getAudibleRange() const { - - const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -893,8 +859,6 @@ float ServerWeaponObjectTemplate::getAudibleRange() const float ServerWeaponObjectTemplate::getAudibleRangeMin() const { - - const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -944,8 +908,6 @@ float ServerWeaponObjectTemplate::getAudibleRangeMin() const float ServerWeaponObjectTemplate::getAudibleRangeMax() const { - - const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -995,8 +957,6 @@ float ServerWeaponObjectTemplate::getAudibleRangeMax() const float ServerWeaponObjectTemplate::getMinRange() const { - - const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1046,8 +1006,6 @@ float ServerWeaponObjectTemplate::getMinRange() const float ServerWeaponObjectTemplate::getMinRangeMin() const { - - const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1097,8 +1055,6 @@ float ServerWeaponObjectTemplate::getMinRangeMin() const float ServerWeaponObjectTemplate::getMinRangeMax() const { - - const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1148,8 +1104,6 @@ float ServerWeaponObjectTemplate::getMinRangeMax() const float ServerWeaponObjectTemplate::getMaxRange() const { - - const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1199,8 +1153,6 @@ float ServerWeaponObjectTemplate::getMaxRange() const float ServerWeaponObjectTemplate::getMaxRangeMin() const { - - const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1250,8 +1202,6 @@ float ServerWeaponObjectTemplate::getMaxRangeMin() const float ServerWeaponObjectTemplate::getMaxRangeMax() const { - - const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1301,8 +1251,6 @@ float ServerWeaponObjectTemplate::getMaxRangeMax() const float ServerWeaponObjectTemplate::getDamageRadius() const { - - const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1352,8 +1300,6 @@ float ServerWeaponObjectTemplate::getDamageRadius() const float ServerWeaponObjectTemplate::getDamageRadiusMin() const { - - const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1403,8 +1349,6 @@ float ServerWeaponObjectTemplate::getDamageRadiusMin() const float ServerWeaponObjectTemplate::getDamageRadiusMax() const { - - const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1454,8 +1398,6 @@ float ServerWeaponObjectTemplate::getDamageRadiusMax() const float ServerWeaponObjectTemplate::getWoundChance() const { - - const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1505,8 +1447,6 @@ float ServerWeaponObjectTemplate::getWoundChance() const float ServerWeaponObjectTemplate::getWoundChanceMin() const { - - const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1556,8 +1496,6 @@ float ServerWeaponObjectTemplate::getWoundChanceMin() const float ServerWeaponObjectTemplate::getWoundChanceMax() const { - - const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1607,8 +1545,6 @@ float ServerWeaponObjectTemplate::getWoundChanceMax() const int ServerWeaponObjectTemplate::getAttackCost() const { - - const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1658,8 +1594,6 @@ int ServerWeaponObjectTemplate::getAttackCost() const int ServerWeaponObjectTemplate::getAttackCostMin() const { - - const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1709,8 +1643,6 @@ int ServerWeaponObjectTemplate::getAttackCostMin() const int ServerWeaponObjectTemplate::getAttackCostMax() const { - - const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1760,8 +1692,6 @@ int ServerWeaponObjectTemplate::getAttackCostMax() const int ServerWeaponObjectTemplate::getAccuracy() const { - - const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1811,8 +1741,6 @@ int ServerWeaponObjectTemplate::getAccuracy() const int ServerWeaponObjectTemplate::getAccuracyMin() const { - - const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1862,8 +1790,6 @@ int ServerWeaponObjectTemplate::getAccuracyMin() const int ServerWeaponObjectTemplate::getAccuracyMax() const { - - const ServerWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1911,7 +1837,6 @@ int ServerWeaponObjectTemplate::getAccuracyMax() const return value; } // ServerWeaponObjectTemplate::getAccuracyMax - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -1920,8 +1845,8 @@ int ServerWeaponObjectTemplate::getAccuracyMax() const */ void ServerWeaponObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != ServerWeaponObjectTemplate_tag) { @@ -1931,7 +1856,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -1951,10 +1876,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,1,1)) + if (getHighestTemplateVersion() != TAG(0, 0, 1, 1)) { - - m_versionOk = false; } @@ -2006,4 +1929,4 @@ char paramName[MAX_NAME_SIZE]; return; } // ServerWeaponObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedNetworkMessages/src/shared/clientGameServer/MessageQueueDraftSlots.h b/engine/shared/library/sharedNetworkMessages/src/shared/clientGameServer/MessageQueueDraftSlots.h index 8514b2f3..4cb0740b 100755 --- a/engine/shared/library/sharedNetworkMessages/src/shared/clientGameServer/MessageQueueDraftSlots.h +++ b/engine/shared/library/sharedNetworkMessages/src/shared/clientGameServer/MessageQueueDraftSlots.h @@ -7,7 +7,6 @@ // //======================================================================== - #ifndef INCLUDED_MessageQueueDraftSlots_H #define INCLUDED_MessageQueueDraftSlots_H @@ -40,17 +39,17 @@ public: const Slot & getSlot(int index) const; typedef stdvector::fwd SlotVector; - const SlotVector & getSlots () const; - void setSlots (const SlotVector & sv); + const SlotVector & getSlots() const; + void setSlots(const SlotVector & sv); - void setManfSchemId (const NetworkId & id); - const NetworkId & getManfSchemId () const; + void setManfSchemId(const NetworkId & id); + const NetworkId & getManfSchemId() const; - void setPrototypeId (const NetworkId & id); - const NetworkId & getPrototypeId () const; + void setPrototypeId(const NetworkId & id); + const NetworkId & getPrototypeId() const; - void setVolume (int volume); - int getVolume () const; + void setVolume(int volume); + int getVolume() const; void setCanManufacture(bool canManufacture); bool canManufacture() const; @@ -64,15 +63,15 @@ private: bool m_canManufacture; }; - //---------------------------------------------------------------------- inline MessageQueueDraftSlots::MessageQueueDraftSlots(const NetworkId & toolId, const NetworkId & manfSchemId) : -m_slots (), -m_toolId (toolId), -m_manfSchemId (manfSchemId), -m_prototypeId (), -m_volume (1) + m_slots(), + m_toolId(toolId), + m_manfSchemId(manfSchemId), + m_prototypeId(), + m_volume(1), + m_canManufacture() { } @@ -107,56 +106,56 @@ inline const MessageQueueDraftSlots::Slot & MessageQueueDraftSlots::getSlot(int //---------------------------------------------------------------------- -inline void MessageQueueDraftSlots::setSlots (const SlotVector & sv) +inline void MessageQueueDraftSlots::setSlots(const SlotVector & sv) { m_slots = sv; } //---------------------------------------------------------------------- -inline const MessageQueueDraftSlots::SlotVector & MessageQueueDraftSlots::getSlots () const +inline const MessageQueueDraftSlots::SlotVector & MessageQueueDraftSlots::getSlots() const { return m_slots; } //---------------------------------------------------------------------- -inline void MessageQueueDraftSlots::setManfSchemId (const NetworkId & id) +inline void MessageQueueDraftSlots::setManfSchemId(const NetworkId & id) { m_manfSchemId = id; } //---------------------------------------------------------------------- -inline const NetworkId & MessageQueueDraftSlots::getManfSchemId () const +inline const NetworkId & MessageQueueDraftSlots::getManfSchemId() const { return m_manfSchemId; } //---------------------------------------------------------------------- -inline void MessageQueueDraftSlots::setPrototypeId (const NetworkId & id) +inline void MessageQueueDraftSlots::setPrototypeId(const NetworkId & id) { m_prototypeId = id; } //---------------------------------------------------------------------- -inline const NetworkId & MessageQueueDraftSlots::getPrototypeId () const +inline const NetworkId & MessageQueueDraftSlots::getPrototypeId() const { return m_prototypeId; } //---------------------------------------------------------------------- -inline void MessageQueueDraftSlots::setVolume (int volume) +inline void MessageQueueDraftSlots::setVolume(int volume) { m_volume = volume; } //---------------------------------------------------------------------- -inline int MessageQueueDraftSlots::getVolume () const +inline int MessageQueueDraftSlots::getVolume() const { return m_volume; } @@ -177,5 +176,4 @@ inline bool MessageQueueDraftSlots::canManufacture() const //---------------------------------------------------------------------- - #endif // INCLUDED_MessageQueueDraftSlots_H diff --git a/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.cpp b/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.cpp index cbe80abf..9c2994aa 100755 --- a/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.cpp +++ b/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.cpp @@ -10,46 +10,45 @@ // ********************************** DO NOT EDIT THIS FILE *********************************** // ********************************************************************************************** // ********************************************************************************************** -void set_bit( unsigned char p[], int bit){ p[bit >> 3] |= 1 << (bit & 0x7); } -void unset_bit(unsigned char p[], int bit){ p[bit >> 3] &= ~(1 << (bit & 0x7)); } -int get_bit( unsigned char p[], int bit){ return (p[bit >> 3] >> (bit & 0x7)) & 1; } -int ZEXPORT uncompress2( Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen); - +void set_bit(unsigned char p[], int bit) { p[bit >> 3] |= 1 << (bit & 0x7); } +void unset_bit(unsigned char p[], int bit) { p[bit >> 3] &= ~(1 << (bit & 0x7)); } +int get_bit(unsigned char p[], int bit) { return (p[bit >> 3] >> (bit & 0x7)) & 1; } +int ZEXPORT uncompress2(Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen); //////////////////////////////////////// // Player implementation //////////////////////////////////////// -MonitorObject::MonitorObject(UdpConnection *con,CMonitorData *_gamedata, char *passwd, char **addressList,bool _bprint) +MonitorObject::MonitorObject(UdpConnection *con, CMonitorData *_gamedata, char *passwd, char **addressList, bool _bprint) { - mbprint = _bprint; - mMonitorData = _gamedata; - mbAuthenticated = false; - mPasswd = passwd; - mAddressList = addressList; - mHierarchySent = false; - mSequence = 1; + mbprint = _bprint; + mMonitorData = _gamedata; + mbAuthenticated = false; + mPasswd = passwd; + mAddressList = addressList; + mHierarchySent = false; + mSequence = 1; mlastUpdateTime = 0; - mConnection = con; + mConnection = con; mConnection->AddRef(); mConnection->SetHandler(this); // Flag all the descriptions - mMark = new unsigned char [ (mMonitorData->DataMax()/8)+2]; - memset(mMark,0,(mMonitorData->DataMax()/8)+2); + mMark = new unsigned char[(mMonitorData->DataMax() / 8) + 2]; + memset(mMark, 0, (mMonitorData->DataMax() / 8) + 2); char hold[256]; - if( mbprint ) + if (mbprint) { - fprintf(stderr,"MONITOR API CONNECTED: %s:%d\n", - mConnection->GetDestinationIp().GetAddress(hold), + fprintf(stderr, "MONITOR API CONNECTED: %s:%d\n", + mConnection->GetDestinationIp().GetAddress(hold), mConnection->GetDestinationPort()); } } MonitorObject::~MonitorObject() { - delete [] mMark; + delete[] mMark; - if( mConnection ) + if (mConnection) { mConnection->SetHandler(nullptr); mConnection->Disconnect(); @@ -57,22 +56,22 @@ MonitorObject::~MonitorObject() } } -void MonitorObject::OnTerminated( UdpConnection * /* con */) +void MonitorObject::OnTerminated(UdpConnection * /* con */) { -char hold[214]; + char hold[214]; - if( mConnection ) + if (mConnection) { - if( mbprint ) + if (mbprint) { mConnection->GetDestinationIp().GetAddress(hold); - if( mbprint ) + if (mbprint) { - fprintf(stderr,"MONITOR API TERMINATE %s:%d %s - %s\n", - hold, + fprintf(stderr, "MONITOR API TERMINATE %s:%d %s - %s\n", + hold, mConnection->GetDestinationPort(), - UdpConnection::DisconnectReasonText( mConnection->GetDisconnectReason()), - UdpConnection::DisconnectReasonText( mConnection->GetOtherSideDisconnectReason())); + UdpConnection::DisconnectReasonText(mConnection->GetDisconnectReason()), + UdpConnection::DisconnectReasonText(mConnection->GetOtherSideDisconnectReason())); } } mConnection->SetHandler(nullptr); @@ -82,32 +81,30 @@ char hold[214]; } } - -void MonitorObject::OnRoutePacket( UdpConnection * con, const unsigned char *data, int dataLen) +void MonitorObject::OnRoutePacket(UdpConnection * con, const unsigned char *data, int dataLen) { - - if( dataLen < 6 ) + if (dataLen < 6) { - if( mbprint ) - fprintf(stderr,"MONITOR API: This should not happen, line %d\n",__LINE__); + if (mbprint) + fprintf(stderr, "MONITOR API: This should not happen, line %d\n", __LINE__); } simpleMessage msg(data); - if( con == nullptr ) + if (con == nullptr) { - if( mbprint) - fprintf(stderr,"MONITOR API: MonitorObject.OnRoutePacket, recived a nullptr connection.?\n"); + if (mbprint) + fprintf(stderr, "MONITOR API: MonitorObject.OnRoutePacket, recived a nullptr connection.?\n"); return; } // ************************* Login Process *************************** - if ( mbAuthenticated == false ) - { - if ( msg.getCommand() != MON_MSG_AUTH ) - return; + if (mbAuthenticated == false) + { + if (msg.getCommand() != MON_MSG_AUTH) + return; - if( processAuthRequest(data, dataLen) == false ) + if (processAuthRequest(data, dataLen) == false) return; mbAuthenticated = true; @@ -115,21 +112,20 @@ void MonitorObject::OnRoutePacket( UdpConnection * con, const unsigned char *da } // ************************* Process Commands *********************** - switch(msg.getCommand()) + switch (msg.getCommand()) { - - // *********************** Game Server Processing ****************** + // *********************** Game Server Processing ****************** case MON_MSG_QUERY_ELEMENTS: - if( mHierarchySent == true ) - { - mMonitorData->processElementsRequest(con,mSequence,(char *)&data[6],dataLen,mlastUpdateTime ); + if (mHierarchySent == true) + { + mMonitorData->processElementsRequest(con, mSequence, (char *)&data[6], dataLen, mlastUpdateTime); mlastUpdateTime = (long)time(nullptr); break; } // When the hierarchy has changed, fall through case MON_MSG_QUERY_HIERARCHY_BLOCK: - if( mMonitorData->processHierarchyRequestBlock(con,mSequence) == false) + if (mMonitorData->processHierarchyRequestBlock(con, mSequence) == false) { break; } @@ -137,7 +133,7 @@ void MonitorObject::OnRoutePacket( UdpConnection * con, const unsigned char *da break; case MON_MSG_QUERY_DESCRIPTION: - mMonitorData->processDescriptionRequest(con,mSequence,(char *)&data[6], dataLen,mMark); + mMonitorData->processDescriptionRequest(con, mSequence, (char *)&data[6], dataLen, mMark); break; case MON_MSG_ERROR: @@ -145,43 +141,41 @@ void MonitorObject::OnRoutePacket( UdpConnection * con, const unsigned char *da break; default: - fprintf(stderr,"MONITOR API: unknown message type received from client [%x]\n",msg.getCommand()); + fprintf(stderr, "MONITOR API: unknown message type received from client [%x]\n", msg.getCommand()); break; } } - bool MonitorObject::checkAddress(const char * address) { -int x = 0; - while( mAddressList[x] ) + int x = 0; + while (mAddressList[x]) { - if (strncmp(mAddressList[x], address, strlen(mAddressList[x]))== 0) + if (strncmp(mAddressList[x], address, strlen(mAddressList[x])) == 0) return true; x++; } return false; } -bool MonitorObject::checkPasswd( const char *passwd) +bool MonitorObject::checkPasswd(const char *passwd) { - if (strcmp(mPasswd,passwd)== 0 ) + if (strcmp(mPasswd, passwd) == 0) return true; - return false; + return false; } bool MonitorObject::processAuthRequest(const unsigned char * data, int /* dataLen */) { -char reply; -stringMessage strMsg(data); -char addBuff[16] = {0}; -char sendBuf[32]; -int len; - + char reply; + stringMessage strMsg(data); + char addBuff[16] = { 0 }; + char sendBuf[32]; + int len; reply = '1'; - - if ( checkAddress(mConnection->GetDestinationIp().GetAddress(addBuff)) == false) + + if (checkAddress(mConnection->GetDestinationIp().GetAddress(addBuff)) == false) { reply = '3'; } @@ -191,21 +185,21 @@ int len; } memset(sendBuf, 0, sizeof(sendBuf)); - + len = 0; - packShort( sendBuf + len, len,(short)MON_MSG_AUTHREPLY); - packShort( sendBuf + len, len, mSequence); - packShort( sendBuf + len, len,(short)3); - packShort( sendBuf + len, len,(short)CURRENT_API_VERSION); - packByte( sendBuf + len, len, reply); - - mConnection->Send(cUdpChannelReliable1, sendBuf, 9 ); + packShort(sendBuf + len, len, (short)MON_MSG_AUTHREPLY); + packShort(sendBuf + len, len, mSequence); + packShort(sendBuf + len, len, (short)3); + packShort(sendBuf + len, len, (short)CURRENT_API_VERSION); + packByte(sendBuf + len, len, reply); + + mConnection->Send(cUdpChannelReliable1, sendBuf, 9); return true; } -void MonitorObject::DescriptionMark(int x,int mode) +void MonitorObject::DescriptionMark(int x, int mode) { - if( mode == 0 ) set_bit(mMark,x); else unset_bit(mMark,x); + if (mode == 0) set_bit(mMark, x); else unset_bit(mMark, x); } char * getErrorString(unsigned short errorCode) @@ -240,7 +234,6 @@ char * getErrorString(unsigned short errorCode) case INVALID_ERROR_CODE: return "Received invalid error message"; - } } return "Undefined error code"; @@ -250,7 +243,7 @@ bool MonitorObject::processError(const unsigned char * data) { stringMessage strMsg(data); unsigned short errCode = (unsigned short)atoi(strMsg.getData()); - fprintf(stderr,"MONITOR API Error: %s\n", getErrorString(errCode)); + fprintf(stderr, "MONITOR API Error: %s\n", getErrorString(errCode)); return true; } @@ -261,46 +254,46 @@ MonitorManager::MonitorManager(const char *configFile, CMonitorData *_gamedata, { mManager = manager; mbprint = _bprint; - passString = nullptr; + passString = nullptr; mMonitorData = _gamedata; mObjectCount = 0; - for(int x=0;xSetHandler(nullptr); con->Disconnect(); con->Release(); } - if( mbprint ) - fprintf(stderr,"MonitorAPI: Collector connection reached max (%d).\n",CONNECTION_MAX); + if (mbprint) + fprintf(stderr, "MonitorAPI: Collector connection reached max (%d).\n", CONNECTION_MAX); return; } - - AddObject(new MonitorObject(con,mMonitorData,passString,allowedAddressList,mbprint)); + + AddObject(new MonitorObject(con, mMonitorData, passString, allowedAddressList, mbprint)); } void MonitorManager::AddObject(MonitorObject *Object) @@ -313,8 +306,8 @@ void MonitorManager::GiveTime() // check if the monitor object is no longer connected for (int i = 0; i < mObjectCount; i++) { - if( mObject[i]->mConnection == nullptr || - mObject[i]->mConnection->GetStatus() == UdpConnection::cStatusDisconnected ) + if (mObject[i]->mConnection == nullptr || + mObject[i]->mConnection->GetStatus() == UdpConnection::cStatusDisconnected) { MonitorObject *o = mObject[i]; mObjectCount--; @@ -331,32 +324,31 @@ void MonitorManager::HierarchyChanged() mObject[i]->HeirarchyChanged(); } -void MonitorManager::DescriptionMark(int x ,int mode) +void MonitorManager::DescriptionMark(int x, int mode) { for (int i = 0; i < mObjectCount; i++) - mObject[i]->DescriptionMark(x,mode); + mObject[i]->DescriptionMark(x, mode); } bool MonitorManager::loadAuthData(const char * filename) { -int nline; -int len; -int x; -char buffer[1024]; + int nline; + int len; + int x; + char buffer[1024]; - FILE *fp = fopen(filename,"r"); + FILE *fp = fopen(filename, "r"); if (fp == nullptr) { - fprintf(stderr,"Monitor API: could not open %s file\nTHIS FILE IS REQUIRED.\n", filename); + fprintf(stderr, "Monitor API: could not open %s file\nTHIS FILE IS REQUIRED.\n", filename); return false; } - + free(passString); - - for(x=0;x 0 ) + if (len > 0) { - if( nline == 0 ) + if (nline == 0) { - passString = (char *)malloc( len + 1 ); - strcpy(passString,buffer); + passString = (char *)malloc(len + 1); + strcpy(passString, buffer); } else { - allowedAddressList[x] = (char *)malloc( len + 1 ); - strcpy(allowedAddressList[x],buffer); + allowedAddressList[x] = (char *)malloc(len + 1); + strcpy(allowedAddressList[x], buffer); x++; } } nline++; - } + } } // clean up fclose(fp); @@ -398,40 +390,40 @@ char buffer[1024]; // ****************************************************************************************************** // ****************************************************************************************************** -CMonitorAPI::CMonitorAPI( const char *configFile, unsigned short Port, bool _bprint , char *address, UdpManager * mang ) +CMonitorAPI::CMonitorAPI(const char *configFile, unsigned short Port, bool _bprint, char *address, UdpManager * mang) { mbprint = _bprint; mPort = Port; mAddress = nullptr; - if( address ) + if (address) { - mAddress = (char *)malloc(strlen(address)+1); - strcpy(mAddress,address); + mAddress = (char *)malloc(strlen(address) + 1); + strcpy(mAddress, address); } - if( mang == nullptr ) + if (mang == nullptr) { UdpManager::Params params; - params.handler = nullptr; - params.maxConnections = CONNECTION_MAX; + params.handler = nullptr; + params.maxConnections = CONNECTION_MAX; params.outgoingBufferSize = 1000000; - params.noDataTimeout = 130000; + params.noDataTimeout = 130000; params.oldestUnacknowledgedTimeout = 120000; params.processIcmpErrors = false; - params.port = mPort; - mManager = new UdpManager(¶ms); - mMonitorData = new CMonitorData(); + params.port = mPort; + mManager = new UdpManager(¶ms); + mMonitorData = new CMonitorData(); } - - mObjectManager = new MonitorManager(configFile,mMonitorData,mManager,mbprint); + + mObjectManager = new MonitorManager(configFile, mMonitorData, mManager, mbprint); mManager->SetHandler(mObjectManager); - if( mbprint ) - fprintf(stderr,"MonitorAPI: started on port->%d\n",mPort); + if (mbprint) + fprintf(stderr, "MonitorAPI: started on port->%d\n", mPort); } - + CMonitorAPI::~CMonitorAPI() { free(mAddress); @@ -441,127 +433,123 @@ CMonitorAPI::~CMonitorAPI() mManager->Release(); delete mMonitorData; - } void CMonitorAPI::Update() { - if( mManager ) + if (mManager) mManager->GiveTime(); - if( mObjectManager ) + if (mObjectManager) mObjectManager->GiveTime(); } -int CMonitorAPI::add(const char *label, int id, int ping, const char *des ) -{ -int rnt; +int CMonitorAPI::add(const char *label, int id, int ping, const char *des) +{ + int rnt; - rnt = mMonitorData->add(label,id,ping,des); - if( rnt ) + rnt = mMonitorData->add(label, id, ping, des); + if (rnt) mObjectManager->HierarchyChanged(); - return rnt; + return rnt; } void CMonitorAPI::remove(int Id) -{ - mMonitorData->remove(Id); +{ + mMonitorData->remove(Id); mObjectManager->HierarchyChanged(); } -void CMonitorAPI::setDescription( int Id, const char *Description ) +void CMonitorAPI::setDescription(int Id, const char *Description) { -int x; -int mode; - - x = mMonitorData->setDescription(Id,Description,mode); - if( x == -1 ) + int x; + int mode; + + x = mMonitorData->setDescription(Id, Description, mode); + if (x == -1) return; - mObjectManager->DescriptionMark(x,mode); + mObjectManager->DescriptionMark(x, mode); } -void CMonitorAPI::dump(){ mMonitorData->dump(); } +void CMonitorAPI::dump() { mMonitorData->dump(); } //---------------------------------------------------------------- -monMessage::monMessage():command(0),sequence(0),size(0){} +monMessage::monMessage() :command(0), sequence(0), size(0) {} //---------------------------------------------------------------- -monMessage::monMessage(short cmd,short seq,short s):command(cmd),sequence(seq),size(s){} +monMessage::monMessage(short cmd, short seq, short s) : command(cmd), sequence(seq), size(s) {} //---------------------------------------------------------------- -monMessage::monMessage(const unsigned char * source):command(0),sequence(0),size(0) -{ -int len; +monMessage::monMessage(const unsigned char * source) : command(0), sequence(0), size(0) +{ + int len; len = 0; - unpackShort( (char *)source + len, len,command); - unpackShort( (char *)source + len, len,sequence); - unpackShort( (char *)source + len, len,size); + unpackShort((char *)source + len, len, command); + unpackShort((char *)source + len, len, sequence); + unpackShort((char *)source + len, len, size); } //---------------------------------------------------------------- // monMessage::monMessage(const monMessage ©):command(copy.command),sequence(copy.sequence),size(copy.size){} - - //---------------------------------------------------------------- -stringMessage::stringMessage(const unsigned char * source):monMessage(source) +stringMessage::stringMessage(const unsigned char * source) :monMessage(source) { -int size; + int size; - size = (int)strlen((char *)source+6) +1; - data = new char [ size ]; - strcpy(data,(char *)source+6); // Add six for the size of the header + size = (int)strlen((char *)source + 6) + 1; + data = new char[size]; + strcpy(data, (char *)source + 6); // Add six for the size of the header } //---------------------------------------------------------------- -stringMessage::stringMessage(const unsigned short command,const unsigned short sequence,const unsigned short size,char * newData): -monMessage(command, sequence, size) +stringMessage::stringMessage(const unsigned short command, const unsigned short sequence, const unsigned short size, char * newData) : + monMessage(command, sequence, size) { - data = new char [strlen(newData) + 1]; + data = new char[strlen(newData) + 1]; strncpy(data, newData, strlen(newData + 1)); } //---------------------------------------------------------------- stringMessage::~stringMessage() { - delete [] data; + delete[] data; data = 0; } //---------------------------------------------------------------- authReplyMessage::authReplyMessage(const unsigned char * source) : -monMessage(source) + monMessage(source) { int len = 6; - unpackShort((char *)source+len,len,version); - unpackByte((char *)source+len,len,data); + unpackShort((char *)source + len, len, version); + unpackByte((char *)source + len, len, data); } //---------------------------------------------------------------- -authReplyMessage::authReplyMessage(const unsigned short command, - const unsigned short sequence, - const unsigned short size, - unsigned char newData): -monMessage(command, sequence, size),data(newData){} - +authReplyMessage::authReplyMessage(const unsigned short command, + const unsigned short sequence, + const unsigned short size, + unsigned char newData) : + monMessage(command, sequence, size), data(newData), version() {} //---------------------------------------------------------------- dataReplyMessage::dataReplyMessage(const unsigned char * source) : -monMessage(source) + monMessage(source) { - data = new unsigned char[getSize()+1]; + data = new unsigned char[getSize() + 1]; memcpy(data, source + 6, getSize()); data[getSize()] = 0; } //---------------------------------------------------------------- -dataReplyMessage::dataReplyMessage(const unsigned short command, - const unsigned short sequence, - const unsigned short size, - unsigned char * newData, - int newDataLen): -monMessage(command, sequence, size) +dataReplyMessage::dataReplyMessage(const unsigned short command, + const unsigned short sequence, + const unsigned short size, + unsigned char * newData, + int newDataLen) : + monMessage(command, sequence, size) { data = new unsigned char[newDataLen]; memcpy(data, newData, newDataLen); @@ -570,51 +558,46 @@ monMessage(command, sequence, size) //---------------------------------------------------------------- dataReplyMessage::~dataReplyMessage() { - delete [] data; + delete[] data; data = 0; } //---------------------------------------------------------------- -simpleMessage::simpleMessage(const unsigned char * source):monMessage(source){} +simpleMessage::simpleMessage(const unsigned char * source) :monMessage(source) {} //---------------------------------------------------------------- -simpleMessage::simpleMessage(const unsigned short command, - const unsigned short sequence, - const unsigned short size): -monMessage(command, sequence, size){} +simpleMessage::simpleMessage(const unsigned short command, + const unsigned short sequence, + const unsigned short size) : + monMessage(command, sequence, size) {} //---------------------------------------------------------------- -simpleMessage::~simpleMessage(){} +simpleMessage::~simpleMessage() {} //---------------------------------------------------------------- - //---------------------------------------------------------------- dataBlockReplyMessage::dataBlockReplyMessage(const unsigned char * source) : -monMessage(source) + monMessage(source) { -int err; -unsigned long S = 4000000; -unsigned char *p; + int err; + unsigned long S = 4000000; + unsigned char *p; data = nullptr; p = (unsigned char *)malloc(4000000); - memset(p,0,4000000); - err = uncompress(p,&S,(source+6),(long)getSize()); - if( Z_OK != err ) { free(p);return; } - data = new unsigned char[S+1]; - memcpy(data,p,S); + memset(p, 0, 4000000); + err = uncompress(p, &S, (source + 6), (long)getSize()); + if (Z_OK != err) { free(p); return; } + data = new unsigned char[S + 1]; + memcpy(data, p, S); setSize((unsigned short)S); free(p); } //---------------------------------------------------------------- dataBlockReplyMessage::~dataBlockReplyMessage() { - if (data) - { - delete [] data; - data = 0; - } -} - - - - + if (data) + { + delete[] data; + data = 0; + } +} \ No newline at end of file diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/AutoLog.h b/external/3rd/library/soePlatform/CSAssist/utils/Base/AutoLog.h index 18871c7f..0386b26e 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/AutoLog.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/AutoLog.h @@ -6,110 +6,109 @@ #include #ifdef EXTERNAL_DISTRO -namespace NAMESPACE +namespace NAMESPACE { - #endif -namespace Base -{ + namespace Base + { + class CAutoLog + { + public: + enum eLogLevel { + eLOG_NONE = 0, // log entries are discarded + eLOG_ERROR = 1, // log errors only + eLOG_ALERT = 2, // log alerts and errors only + eLOG_NORMAL = 3, // log all normal events, no debug + eLOG_DEBUG = 4 // log everything + }; - class CAutoLog - { - public: - enum eLogLevel { - eLOG_NONE = 0, // log entries are discarded - eLOG_ERROR = 1, // log errors only - eLOG_ALERT = 2, // log alerts and errors only - eLOG_NORMAL = 3, // log all normal events, no debug - eLOG_DEBUG = 4 // log everything - }; + // Global setting for all AutoLog instances for this application. Can be set on the fly. Default is eLOG_NORMAL. + void SetLogLevel(eLogLevel loglevel); - // Global setting for all AutoLog instances for this application. Can be set on the fly. Default is eLOG_NORMAL. - void SetLogLevel(eLogLevel loglevel); + // Global setting for all AutoLog instances for this application. Can be set on the fly. Default is eLOG_ERROR. + void SetPrintLevel(eLogLevel printlevel); - // Global setting for all AutoLog instances for this application. Can be set on the fly. Default is eLOG_ERROR. - void SetPrintLevel(eLogLevel printlevel); + // Global setting for all AutoLog instances for this application. Can be set on the fly. Default is eLOG_ERROR. + void SetFlushLevel(eLogLevel flushlevel); - // Global setting for all AutoLog instances for this application. Can be set on the fly. Default is eLOG_ERROR. - void SetFlushLevel(eLogLevel flushlevel); + // constructor, no file loaded + CAutoLog(); - // constructor, no file loaded - CAutoLog(); + // version of constructor that calls Open(file) + CAutoLog(const char * file); - // version of constructor that calls Open(file) - CAutoLog(const char * file); + // destructor, will close file if opened + ~CAutoLog(); - // destructor, will close file if opened - ~CAutoLog(); + // Open log file. If a file is already open, function will fail. + // returns true if no error + bool Open(const char * file); - // Open log file. If a file is already open, function will fail. - // returns true if no error - bool Open(const char * file); + // Close log file if opened. + void Close(void); - // Close log file if opened. - void Close(void); + // Make an entry in the log. Format and variable arguments are identical to printf. + // severity will be compared to master log level to determine if the log entry will be made + // severity will be compared to master print level to determine if the log entry will be printed to stdout + void Log(eLogLevel severity, char * format, ...); - // Make an entry in the log. Format and variable arguments are identical to printf. - // severity will be compared to master log level to determine if the log entry will be made - // severity will be compared to master print level to determine if the log entry will be printed to stdout - void Log(eLogLevel severity, char * format, ...); + // Equivalent to the above with the approriate severity argument + void LogError(char * format, ...); + void LogAlert(char * format, ...); + void Log(char * format, ...); + void LogDebug(char * format, ...); - // Equivalent to the above with the approriate severity argument - void LogError(char * format, ...); - void LogAlert(char * format, ...); - void Log(char * format, ...); - void LogDebug(char * format, ...); + private: + FILE * pFile; // current log file opened + char * pFilename; // current log file opened + int nTodaysDayOfYear; // remember the current day to detect change of day + void Archive(void); // archives current log - private: - FILE * pFile; // current log file opened - char * pFilename; // current log file opened - int nTodaysDayOfYear; // remember the current day to detect change of day - void Archive(void); // archives current log + static eLogLevel nLogMask; // master severity level + static eLogLevel nPrintMask; // master severity level + static eLogLevel nFlushMask; // master severity level + }; - static eLogLevel nLogMask; // master severity level - static eLogLevel nPrintMask; // master severity level - static eLogLevel nFlushMask; // master severity level - }; + //------------------------------------- + inline void CAutoLog::SetLogLevel(eLogLevel loglevel) + { + nLogMask = loglevel; + } - //------------------------------------- - inline void CAutoLog::SetLogLevel(eLogLevel loglevel) - { - nLogMask = loglevel; - } + //------------------------------------- + inline void CAutoLog::SetPrintLevel(eLogLevel printlevel) + { + nPrintMask = printlevel; + } - //------------------------------------- - inline void CAutoLog::SetPrintLevel(eLogLevel printlevel) - { - nPrintMask = printlevel; - } + //------------------------------------- + inline void CAutoLog::SetFlushLevel(eLogLevel flushlevel) + { + nFlushMask = flushlevel; + } - //------------------------------------- - inline void CAutoLog::SetFlushLevel(eLogLevel flushlevel) - { - nFlushMask = flushlevel; - } + //------------------------------------- + inline CAutoLog::CAutoLog() + { + pFilename = nullptr; + pFile = (FILE *)-1; + nTodaysDayOfYear = 0; + } - //------------------------------------- - inline CAutoLog::CAutoLog() - { - pFilename = nullptr; - pFile = (FILE *)-1; - } + //------------------------------------- + inline CAutoLog::CAutoLog(const char * file) + { + pFilename = nullptr; + pFile = (FILE *)-1; + Open(file); + } - //------------------------------------- - inline CAutoLog::CAutoLog(const char * file) - { - pFilename = nullptr; - pFile = (FILE *)-1; - Open(file); - } - - //------------------------------------- - inline CAutoLog::~CAutoLog() - { - Close(); - } -}; + //------------------------------------- + inline CAutoLog::~CAutoLog() + { + Close(); + } + }; #ifdef EXTERNAL_DISTRO }; #endif diff --git a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpManager.cpp b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpManager.cpp index 86778910..2073fc8f 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpManager.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpManager.cpp @@ -4,731 +4,707 @@ #include "TcpConnection.h" #ifndef WIN32 - #include +#include #endif - #ifdef EXTERNAL_DISTRO -namespace NAMESPACE +namespace NAMESPACE { #endif -TcpManager::TcpParams::TcpParams() -: port(0), - maxConnections(10), - incomingBufferSize(64*1024), - outgoingBufferSize(64*1024), - allocatorBlockSize(8*1024), - allocatorBlockCount(16), - maxRecvMessageSize(0), - keepAliveDelay(0), - noDataTimeout(0) -{ - memset(bindAddress, 0, sizeof(bindAddress)); -} + TcpManager::TcpParams::TcpParams() + : port(0), + maxConnections(10), + incomingBufferSize(64 * 1024), + outgoingBufferSize(64 * 1024), + allocatorBlockSize(8 * 1024), + allocatorBlockCount(16), + maxRecvMessageSize(0), + keepAliveDelay(0), + noDataTimeout(0) + { + memset(bindAddress, 0, sizeof(bindAddress)); + } -TcpManager::TcpParams::TcpParams(const TcpParams &cpy) -: port(cpy.port), - maxConnections(cpy.maxConnections), - incomingBufferSize(cpy.incomingBufferSize), - outgoingBufferSize(cpy.outgoingBufferSize), - allocatorBlockSize(cpy.allocatorBlockSize), - allocatorBlockCount(cpy.allocatorBlockCount), - maxRecvMessageSize(cpy.maxRecvMessageSize), - keepAliveDelay(cpy.keepAliveDelay), - noDataTimeout(cpy.noDataTimeout) -{ -} + TcpManager::TcpParams::TcpParams(const TcpParams &cpy) + : port(cpy.port), + maxConnections(cpy.maxConnections), + incomingBufferSize(cpy.incomingBufferSize), + outgoingBufferSize(cpy.outgoingBufferSize), + allocatorBlockSize(cpy.allocatorBlockSize), + allocatorBlockCount(cpy.allocatorBlockCount), + maxRecvMessageSize(cpy.maxRecvMessageSize), + keepAliveDelay(cpy.keepAliveDelay), + noDataTimeout(cpy.noDataTimeout) + { + } -TcpManager::TcpManager(const TcpParams ¶ms) -: m_handler(nullptr), - m_keepAliveList(nullptr, 1), - m_aliveList(nullptr, 2), - m_noDataList(nullptr, 1), - m_dataList(nullptr, 2), - m_params(params), - m_refCount(1), - m_connectionList(nullptr), - m_connectionListCount(0), - m_socket(INVALID_SOCKET), - m_boundAsServer(false), - m_allocator(params.allocatorBlockSize, params.allocatorBlockCount), - m_keepAliveTimer(), - m_noDataTimer() -{ - if (params.keepAliveDelay > 0) - m_keepAliveTimer.start(); - - if (params.noDataTimeout > 0) - m_noDataTimer.start(); - -#if defined(WIN32) - WSADATA wsaData; - WSAStartup(MAKEWORD(1,1), &wsaData); - - FD_ZERO(&m_permfds);//select only used on win32 -#endif - -} - - -TcpManager::~TcpManager() -{ -#if defined(WIN32) - WSACleanup(); -#endif - - if (m_boundAsServer) - { -#if defined(WIN32) - closesocket(m_socket); -#else - close(m_socket); -#endif - } - while (m_connectionList != nullptr) - { - TcpConnection *con = m_connectionList; - m_connectionList = m_connectionList->m_nextConnection; - con->Release(); - m_connectionListCount--; - } -} - - -bool TcpManager::BindAsServer() -{ - - m_socket = socket(AF_INET, SOCK_STREAM, 0); - - if ((unsigned) m_socket != INVALID_SOCKET) - { -#if defined(WIN32) - FD_SET(m_socket, &m_permfds);//the socket this server is listening on - - unsigned long isNonBlocking = 1; - int outBufSize = m_params.outgoingBufferSize; - int inBufSize = m_params.incomingBufferSize; - int keepAlive = 1; - int reuseAddr = 1; - struct linger ld; - ld.l_onoff = 0; - ld.l_linger = 0; - - if (ioctlsocket(m_socket, FIONBIO, &isNonBlocking) != 0 - || setsockopt(m_socket, SOL_SOCKET, SO_SNDBUF, (char *)&outBufSize, sizeof(outBufSize)) != 0 - || setsockopt(m_socket, SOL_SOCKET, SO_RCVBUF, (char *)&inBufSize, sizeof(inBufSize)) != 0 - || setsockopt(m_socket, SOL_SOCKET, SO_KEEPALIVE, (char *)&keepAlive, sizeof(keepAlive)) != 0 - || setsockopt(m_socket, SOL_SOCKET, SO_REUSEADDR, (char *)&reuseAddr, sizeof(reuseAddr)) != 0 - || setsockopt(m_socket, SOL_SOCKET, SO_LINGER, (char *)&ld, sizeof(ld)) != 0 ) - { - return false; - } -#else // linux is to remain the default compile mode - unsigned long isNonBlocking = 1; - unsigned long keepAlive = 1; - unsigned long outBufSize = m_params.outgoingBufferSize; - unsigned long inBufSize = m_params.incomingBufferSize; - unsigned long reuseAddr = 1; - struct linger ld; - ld.l_onoff = 0; - ld.l_linger = 0; - - if (ioctl(m_socket, FIONBIO, &isNonBlocking) != 0 - || setsockopt(m_socket, SOL_SOCKET, SO_SNDBUF, &outBufSize, sizeof(outBufSize)) != 0 - || setsockopt(m_socket, SOL_SOCKET, SO_RCVBUF, &inBufSize, sizeof(inBufSize)) != 0 - || setsockopt(m_socket, SOL_SOCKET, SO_KEEPALIVE, &keepAlive, sizeof(keepAlive)) != 0 - || setsockopt(m_socket, SOL_SOCKET, SO_REUSEADDR, &reuseAddr, sizeof(reuseAddr)) != 0 - || setsockopt(m_socket, SOL_SOCKET, SO_LINGER, &ld, sizeof(ld)) != 0) - { - return false; - } -#endif - } - else - { - return false; - } - - - struct sockaddr_in addr_loc; - addr_loc.sin_family = AF_INET; - addr_loc.sin_port = htons(m_params.port); - addr_loc.sin_addr.s_addr = htonl(INADDR_ANY); - if (m_params.bindAddress[0] != 0) - { - unsigned long address = inet_addr(m_params.bindAddress); - if (address == INADDR_NONE) - { - struct hostent * lphp; - lphp = gethostbyname(m_params.bindAddress); - if (lphp != nullptr) - addr_loc.sin_addr.s_addr = ((struct in_addr *)(lphp->h_addr))->s_addr; - } - else - { - addr_loc.sin_addr.s_addr = address; - } - } - - if (bind(m_socket, (struct sockaddr *)&addr_loc, sizeof(addr_loc)) != 0) - { - return false; - } - - if (listen(m_socket, 1000) != 0) - { - return false; - } - - m_boundAsServer = true; - return true; -} - -TcpConnection *TcpManager::acceptClient() -{ - TcpConnection *newConn = nullptr; - - if (m_boundAsServer && m_connectionListCount < m_params.maxConnections) - { - - sockaddr_in addr; - int addrLength = sizeof(addr); - SOCKET sock = ::accept(m_socket, (sockaddr *) &addr, (socklen_t *) &addrLength); - - - if ((unsigned) sock != INVALID_SOCKET) - { - newConn = new TcpConnection(this, &m_allocator, m_params, sock, IPAddress(addr.sin_addr.s_addr), ntohs(addr.sin_port)); - addNewConnection(newConn); - if (m_handler != nullptr) - { - m_handler->OnConnectRequest(newConn); - } - } - } - - return newConn; -} - -void TcpManager::SetHandler(TcpManagerHandler *handler) -{ - m_handler = handler; -} - -SOCKET TcpManager::getMaxFD() -{ + TcpManager::TcpManager(const TcpParams ¶ms) + : m_handler(nullptr), + m_keepAliveList(nullptr, 1), + m_aliveList(nullptr, 2), + m_noDataList(nullptr, 1), + m_dataList(nullptr, 2), + m_params(params), + m_refCount(1), + m_connectionList(nullptr), + m_connectionListCount(0), + m_socket(INVALID_SOCKET), + m_boundAsServer(false), + m_allocator(params.allocatorBlockSize, params.allocatorBlockCount), + m_keepAliveTimer(), + m_noDataTimer() #ifdef WIN32 - return 0;//this param is not used on win32 for select, only on unix -#else - SOCKET maxfd = 0; - - if (m_boundAsServer) - maxfd = m_socket+1; - - TcpConnection *next = nullptr; - for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) - { - next = con->m_nextConnection; - if (con->GetStatus() != TcpConnection::StatusDisconnected && con->m_socket > maxfd) - { - maxfd = con->m_socket + 1; - } - } - return maxfd; + , m_permfds() #endif -} + { + if (params.keepAliveDelay > 0) + m_keepAliveTimer.start(); -TcpConnection *TcpManager::getConnection(SOCKET fd) -{ - TcpConnection *next = nullptr; - for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) - { - next = con->m_nextConnection; - if (con->m_socket == fd) - { - return con; - } - } - //if get here ,couldn't find it - return nullptr; -} + if (params.noDataTimeout > 0) + m_noDataTimer.start(); -bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendTimePerConnection, unsigned maxRecvTimePerConnection) -{ - bool processedIncoming = false; +#if defined(WIN32) + WSADATA wsaData; + WSAStartup(MAKEWORD(1, 1), &wsaData); - if (maxTimeAcceptingConnections == 0 && maxSendTimePerConnection==0 && maxRecvTimePerConnection==0) - { - //they don't want to do anything now - return processedIncoming; - } + FD_ZERO(&m_permfds);//select only used on win32 +#endif + } - AddRef(); //keep a reference to ourself in case we callback to the application and the application releases us. + TcpManager::~TcpManager() + { +#if defined(WIN32) + WSACleanup(); +#endif + if (m_boundAsServer) + { +#if defined(WIN32) + closesocket(m_socket); +#else + close(m_socket); +#endif + } + while (m_connectionList != nullptr) + { + TcpConnection *con = m_connectionList; + m_connectionList = m_connectionList->m_nextConnection; + con->Release(); + m_connectionListCount--; + } + } + bool TcpManager::BindAsServer() + { + m_socket = socket(AF_INET, SOCK_STREAM, 0); - //first process outgoing on each connection, and finish establishing connections, if params say to - if (m_connectionListCount != 0 && maxSendTimePerConnection != 0) - { + if ((unsigned)m_socket != INVALID_SOCKET) + { +#if defined(WIN32) + FD_SET(m_socket, &m_permfds);//the socket this server is listening on - // Send output from last heartbeat - TcpConnection *next = nullptr; - for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) - { - con->AddRef(); - if (next) next->Release(); - next = con->m_nextConnection; - if (next) next->AddRef(); - if(con->GetStatus() == TcpConnection::StatusConnected) - { - Clock timer; - timer.start(); - while(!timer.isDone(maxSendTimePerConnection)) - { - int err = con->processOutgoing(); + unsigned long isNonBlocking = 1; + int outBufSize = m_params.outgoingBufferSize; + int inBufSize = m_params.incomingBufferSize; + int keepAlive = 1; + int reuseAddr = 1; + struct linger ld; + ld.l_onoff = 0; + ld.l_linger = 0; - if (err > 0) - { - //couldn't finish processing last request, don't try more - break; - } - else if (err < 0) - { - break; - } - } - con->Release(); - } - else if (con->GetStatus() == TcpConnection::StatusNegotiating) - { - if (con->finishConnect() < 0) - { + if (ioctlsocket(m_socket, FIONBIO, &isNonBlocking) != 0 + || setsockopt(m_socket, SOL_SOCKET, SO_SNDBUF, (char *)&outBufSize, sizeof(outBufSize)) != 0 + || setsockopt(m_socket, SOL_SOCKET, SO_RCVBUF, (char *)&inBufSize, sizeof(inBufSize)) != 0 + || setsockopt(m_socket, SOL_SOCKET, SO_KEEPALIVE, (char *)&keepAlive, sizeof(keepAlive)) != 0 + || setsockopt(m_socket, SOL_SOCKET, SO_REUSEADDR, (char *)&reuseAddr, sizeof(reuseAddr)) != 0 + || setsockopt(m_socket, SOL_SOCKET, SO_LINGER, (char *)&ld, sizeof(ld)) != 0) + { + return false; + } +#else // linux is to remain the default compile mode + unsigned long isNonBlocking = 1; + unsigned long keepAlive = 1; + unsigned long outBufSize = m_params.outgoingBufferSize; + unsigned long inBufSize = m_params.incomingBufferSize; + unsigned long reuseAddr = 1; + struct linger ld; + ld.l_onoff = 0; + ld.l_linger = 0; + + if (ioctl(m_socket, FIONBIO, &isNonBlocking) != 0 + || setsockopt(m_socket, SOL_SOCKET, SO_SNDBUF, &outBufSize, sizeof(outBufSize)) != 0 + || setsockopt(m_socket, SOL_SOCKET, SO_RCVBUF, &inBufSize, sizeof(inBufSize)) != 0 + || setsockopt(m_socket, SOL_SOCKET, SO_KEEPALIVE, &keepAlive, sizeof(keepAlive)) != 0 + || setsockopt(m_socket, SOL_SOCKET, SO_REUSEADDR, &reuseAddr, sizeof(reuseAddr)) != 0 + || setsockopt(m_socket, SOL_SOCKET, SO_LINGER, &ld, sizeof(ld)) != 0) + { + return false; + } +#endif + } + else + { + return false; + } + + struct sockaddr_in addr_loc; + addr_loc.sin_family = AF_INET; + addr_loc.sin_port = htons(m_params.port); + addr_loc.sin_addr.s_addr = htonl(INADDR_ANY); + if (m_params.bindAddress[0] != 0) + { + unsigned long address = inet_addr(m_params.bindAddress); + if (address == INADDR_NONE) + { + struct hostent * lphp; + lphp = gethostbyname(m_params.bindAddress); + if (lphp != nullptr) + addr_loc.sin_addr.s_addr = ((struct in_addr *)(lphp->h_addr))->s_addr; + } + else + { + addr_loc.sin_addr.s_addr = address; + } + } + + if (bind(m_socket, (struct sockaddr *)&addr_loc, sizeof(addr_loc)) != 0) + { + return false; + } + + if (listen(m_socket, 1000) != 0) + { + return false; + } + + m_boundAsServer = true; + return true; + } + + TcpConnection *TcpManager::acceptClient() + { + TcpConnection *newConn = nullptr; + + if (m_boundAsServer && m_connectionListCount < m_params.maxConnections) + { + sockaddr_in addr; + int addrLength = sizeof(addr); + SOCKET sock = ::accept(m_socket, (sockaddr *)&addr, (socklen_t *)&addrLength); + + if ((unsigned)sock != INVALID_SOCKET) + { + newConn = new TcpConnection(this, &m_allocator, m_params, sock, IPAddress(addr.sin_addr.s_addr), ntohs(addr.sin_port)); + addNewConnection(newConn); + if (m_handler != nullptr) + { + m_handler->OnConnectRequest(newConn); + } + } + } + + return newConn; + } + + void TcpManager::SetHandler(TcpManagerHandler *handler) + { + m_handler = handler; + } + + SOCKET TcpManager::getMaxFD() + { +#ifdef WIN32 + return 0;//this param is not used on win32 for select, only on unix +#else + SOCKET maxfd = 0; + + if (m_boundAsServer) + maxfd = m_socket + 1; + + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList; con != nullptr; con = next) + { + next = con->m_nextConnection; + if (con->GetStatus() != TcpConnection::StatusDisconnected && con->m_socket > maxfd) + { + maxfd = con->m_socket + 1; + } + } + return maxfd; +#endif + } + + TcpConnection *TcpManager::getConnection(SOCKET fd) + { + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList; con != nullptr; con = next) + { + next = con->m_nextConnection; + if (con->m_socket == fd) + { + return con; + } + } + //if get here ,couldn't find it + return nullptr; + } + + bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections, unsigned maxSendTimePerConnection, unsigned maxRecvTimePerConnection) + { + bool processedIncoming = false; + + if (maxTimeAcceptingConnections == 0 && maxSendTimePerConnection == 0 && maxRecvTimePerConnection == 0) + { + //they don't want to do anything now + return processedIncoming; + } + + AddRef(); //keep a reference to ourself in case we callback to the application and the application releases us. + + //first process outgoing on each connection, and finish establishing connections, if params say to + if (m_connectionListCount != 0 && maxSendTimePerConnection != 0) + { + // Send output from last heartbeat + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList; con != nullptr; con = next) + { + con->AddRef(); + if (next) next->Release(); + next = con->m_nextConnection; + if (next) next->AddRef(); + if (con->GetStatus() == TcpConnection::StatusConnected) + { + Clock timer; + timer.start(); + while (!timer.isDone(maxSendTimePerConnection)) + { + int err = con->processOutgoing(); + + if (err > 0) + { + //couldn't finish processing last request, don't try more + break; + } + else if (err < 0) + { + break; + } + } con->Release(); - continue; - } - con->Release(); - } - else //inactive client in client list???? - { - removeConnection(con); - con->Release(); - continue; - } - } - - } - - //process incoming messages (including connect requests) - if (( - m_boundAsServer //if in server mode and want to spend time accepting clients - && maxTimeAcceptingConnections != 0 - ) - || - ( - m_connectionListCount != 0 //if there are connections and want to spend time receiving on them - && maxRecvTimePerConnection != 0 - ) - ) - { -#ifdef WIN32 - SOCKET maxfd = getMaxFD(); //re-calc maxfd every time select on WIN32 - - //select on all fd's - struct timeval timeout; - - fd_set tmpfds; - tmpfds = m_permfds; - timeout.tv_sec = 0; - timeout.tv_usec = 0; - int cnt = select(maxfd, &tmpfds, nullptr, nullptr, &timeout); // blocks for timeout - - - if (cnt > 0) - { - if (m_boundAsServer && maxTimeAcceptingConnections != 0) - {//activity on our socket means connect requests - - //see if are new incoming clients - if (FD_ISSET(m_socket, &tmpfds)) - { - //yep - Clock timer; - timer.start(); - while (acceptClient() && !timer.isDone(maxTimeAcceptingConnections)) - { - //loop - } - } - } - - - - //process incoming client messages - if (maxRecvTimePerConnection != 0) - { - TcpConnection *next = nullptr; - for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) - { - con->AddRef(); - if (next) next->Release(); - next = con->m_nextConnection; - if (next) next->AddRef(); - - SOCKET fd = con->m_socket; - if (fd == INVALID_SOCKET) - { - //invalid socket in list?, check if is connecting, otherwise, Disconnect and discard - if (con->GetStatus() != TcpConnection::StatusNegotiating) - { - removeConnection(con); - con->Release(); - continue; - } - } - - if (FD_ISSET(fd, &tmpfds)) - { - Clock timer; - timer.start(); - while(!timer.isDone(maxRecvTimePerConnection) && con->GetStatus() == TcpConnection::StatusConnected) - { - int err = con->processIncoming(); - if (err >= 0) - { - processedIncoming = true; - } - - if (err > 0) - { - //couldn't finish processing last request, don't try more - break; - } - else if (err < 0) - { - break; - } - - }//while(!timer...) - }//if (FD_ISSET...) + } + else if (con->GetStatus() == TcpConnection::StatusNegotiating) + { + if (con->finishConnect() < 0) + { + con->Release(); + continue; + } con->Release(); - }//for (...) - } //maxRecvTimePerConnection != 0 - }//cnt > 0 + } + else //inactive client in client list???? + { + removeConnection(con); + con->Release(); + continue; + } + } + } + + //process incoming messages (including connect requests) + if (( + m_boundAsServer //if in server mode and want to spend time accepting clients + && maxTimeAcceptingConnections != 0 + ) + || + ( + m_connectionListCount != 0 //if there are connections and want to spend time receiving on them + && maxRecvTimePerConnection != 0 + ) + ) + { +#ifdef WIN32 + SOCKET maxfd = getMaxFD(); //re-calc maxfd every time select on WIN32 + + //select on all fd's + struct timeval timeout; + + fd_set tmpfds; + tmpfds = m_permfds; + timeout.tv_sec = 0; + timeout.tv_usec = 0; + int cnt = select(maxfd, &tmpfds, nullptr, nullptr, &timeout); // blocks for timeout + + if (cnt > 0) + { + if (m_boundAsServer && maxTimeAcceptingConnections != 0) + {//activity on our socket means connect requests + //see if are new incoming clients + if (FD_ISSET(m_socket, &tmpfds)) + { + //yep + Clock timer; + timer.start(); + while (acceptClient() && !timer.isDone(maxTimeAcceptingConnections)) + { + //loop + } + } + } + + //process incoming client messages + if (maxRecvTimePerConnection != 0) + { + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList; con != nullptr; con = next) + { + con->AddRef(); + if (next) next->Release(); + next = con->m_nextConnection; + if (next) next->AddRef(); + + SOCKET fd = con->m_socket; + if (fd == INVALID_SOCKET) + { + //invalid socket in list?, check if is connecting, otherwise, Disconnect and discard + if (con->GetStatus() != TcpConnection::StatusNegotiating) + { + removeConnection(con); + con->Release(); + continue; + } + } + + if (FD_ISSET(fd, &tmpfds)) + { + Clock timer; + timer.start(); + while (!timer.isDone(maxRecvTimePerConnection) && con->GetStatus() == TcpConnection::StatusConnected) + { + int err = con->processIncoming(); + if (err >= 0) + { + processedIncoming = true; + } + + if (err > 0) + { + //couldn't finish processing last request, don't try more + break; + } + else if (err < 0) + { + break; + } + }//while(!timer...) + }//if (FD_ISSET...) + con->Release(); + }//for (...) + } //maxRecvTimePerConnection != 0 + }//cnt > 0 #else //on UNIX use poll - int numfds = m_connectionListCount; - int idx = 0; - if (m_boundAsServer) - { - numfds++; - idx++; - } + int numfds = m_connectionListCount; + int idx = 0; + if (m_boundAsServer) + { + numfds++; + idx++; + } - struct pollfd pollfds[numfds]; + struct pollfd pollfds[numfds]; - if (m_boundAsServer) - { - pollfds[0].fd = m_socket; - pollfds[0].events |= POLLIN; - } + if (m_boundAsServer) + { + pollfds[0].fd = m_socket; + pollfds[0].events |= POLLIN; + } - TcpConnection *next = nullptr; - for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next, idx++) - { - next = con->m_nextConnection; - pollfds[idx].fd = con->m_socket; - pollfds[idx].events |= POLLIN; - pollfds[idx].events |= POLLHUP; - } - + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList; con != nullptr; con = next, idx++) + { + next = con->m_nextConnection; + pollfds[idx].fd = con->m_socket; + pollfds[idx].events |= POLLIN; + pollfds[idx].events |= POLLHUP; + } - int cnt = poll(pollfds, numfds, 1); + int cnt = poll(pollfds, numfds, 1); - if((unsigned) cnt == SOCKET_ERROR) - { - //poll not working? - //TODO: need to notify client somehow, don't think we can assume a fatal error here - } - else if (cnt > 0) - { - for (idx = 0; idx < numfds; idx++) - { - //find corresponding TcpConnection - //TODO: optimize, seriously, this is takes linear time, every time - TcpConnection *con = getConnection(pollfds[idx].fd); + if ((unsigned)cnt == SOCKET_ERROR) + { + //poll not working? + //TODO: need to notify client somehow, don't think we can assume a fatal error here + } + else if (cnt > 0) + { + for (idx = 0; idx < numfds; idx++) + { + //find corresponding TcpConnection + //TODO: optimize, seriously, this is takes linear time, every time + TcpConnection *con = getConnection(pollfds[idx].fd); - if (pollfds[idx].revents & POLLIN) - { - if (m_boundAsServer && maxTimeAcceptingConnections != 0 && pollfds[idx].fd == m_socket) - { - //new incoming clients - Clock timer; - timer.start(); - while (acceptClient() && !timer.isDone(maxTimeAcceptingConnections)) - { - //loop - } + if (pollfds[idx].revents & POLLIN) + { + if (m_boundAsServer && maxTimeAcceptingConnections != 0 && pollfds[idx].fd == m_socket) + { + //new incoming clients + Clock timer; + timer.start(); + while (acceptClient() && !timer.isDone(maxTimeAcceptingConnections)) + { + //loop + } - continue;//don't try to readmsgs from listening fd - } - - //process regular msg(s) - if (con == nullptr) - { - close(pollfds[idx].fd); - continue; - } + continue;//don't try to readmsgs from listening fd + } - Clock timer; - timer.start(); - con->AddRef();//so it can't get deleted while we are checking it's status - while(!timer.isDone(maxRecvTimePerConnection) && con->GetStatus() == TcpConnection::StatusConnected) - { - int err = con->processIncoming(); - if (err >= 0) - { - processedIncoming = true; - } + //process regular msg(s) + if (con == nullptr) + { + close(pollfds[idx].fd); + continue; + } - if (err > 0) - { - //couldn't finish processing last request, don't try more - break; - } - else if (err < 0) - { - break; - } + Clock timer; + timer.start(); + con->AddRef();//so it can't get deleted while we are checking it's status + while (!timer.isDone(maxRecvTimePerConnection) && con->GetStatus() == TcpConnection::StatusConnected) + { + int err = con->processIncoming(); + if (err >= 0) + { + processedIncoming = true; + } - }//while(!timer....) - con->Release(); - }//if(pollfds[... - else if (pollfds[idx].revents & POLLHUP) - { - if (con == nullptr) - { - close(pollfds[idx].fd); - continue; - } + if (err > 0) + { + //couldn't finish processing last request, don't try more + break; + } + else if (err < 0) + { + break; + } + }//while(!timer....) + con->Release(); + }//if(pollfds[... + else if (pollfds[idx].revents & POLLHUP) + { + if (con == nullptr) + { + close(pollfds[idx].fd); + continue; + } - //Disconnect client - con->Disconnect(); - } - }//for (idx=0.... - }//else if (cnt > 0) + //Disconnect client + con->Disconnect(); + } + }//for (idx=0.... + }//else if (cnt > 0) #endif - }//wanted to process incoming messages or connect requests + }//wanted to process incoming messages or connect requests - //now process any keepalives, if time to do that - if (m_params.keepAliveDelay > 0 && m_keepAliveTimer.isDone(m_params.keepAliveDelay)) - { - TcpConnection *next = nullptr; - for (TcpConnection *con = m_keepAliveList.m_beginList ; con != nullptr ; con = next) - { - con->AddRef(); - if (next) next->Release(); - next = con->m_nextKeepAliveConnection; - if (next) next->AddRef(); - - con->Send(nullptr, 0); //note: this request will move the connection from the keepAliveList to the aliveList - con->Release(); - } + //now process any keepalives, if time to do that + if (m_params.keepAliveDelay > 0 && m_keepAliveTimer.isDone(m_params.keepAliveDelay)) + { + TcpConnection *next = nullptr; + for (TcpConnection *con = m_keepAliveList.m_beginList; con != nullptr; con = next) + { + con->AddRef(); + if (next) next->Release(); + next = con->m_nextKeepAliveConnection; + if (next) next->AddRef(); - //now move the complete alive list over to the keepalive list to reset those timers - m_keepAliveList.m_beginList = m_aliveList.m_beginList; - m_aliveList.m_beginList = nullptr; + con->Send(nullptr, 0); //note: this request will move the connection from the keepAliveList to the aliveList + con->Release(); + } - //switch id's for those connections that were in the alive list last go - around - int tmpID = m_aliveList.m_listID; - m_aliveList.m_listID = m_keepAliveList.m_listID; - m_keepAliveList.m_listID = tmpID; + //now move the complete alive list over to the keepalive list to reset those timers + m_keepAliveList.m_beginList = m_aliveList.m_beginList; + m_aliveList.m_beginList = nullptr; - m_keepAliveTimer.reset(); - m_keepAliveTimer.start(); - } + //switch id's for those connections that were in the alive list last go - around + int tmpID = m_aliveList.m_listID; + m_aliveList.m_listID = m_keepAliveList.m_listID; + m_keepAliveList.m_listID = tmpID; - //now process any noDataCons, if time to do that - if (m_params.noDataTimeout > 0 && m_noDataTimer.isDone(m_params.noDataTimeout)) - { - TcpConnection *next = nullptr; - for (TcpConnection *con = m_noDataList.m_beginList ; con != nullptr ; con = next) - { - con->AddRef(); - if (next) next->Release(); - next = con->m_nextRecvDataConnection; - if (next) next->AddRef(); + m_keepAliveTimer.reset(); + m_keepAliveTimer.start(); + } - //time to disconnect this guy - con->Disconnect(); - con->Release(); - } + //now process any noDataCons, if time to do that + if (m_params.noDataTimeout > 0 && m_noDataTimer.isDone(m_params.noDataTimeout)) + { + TcpConnection *next = nullptr; + for (TcpConnection *con = m_noDataList.m_beginList; con != nullptr; con = next) + { + con->AddRef(); + if (next) next->Release(); + next = con->m_nextRecvDataConnection; + if (next) next->AddRef(); - //now move the complete data list over to the nodata list to reset those timers - m_noDataList.m_beginList = m_dataList.m_beginList; - m_dataList.m_beginList = nullptr; + //time to disconnect this guy + con->Disconnect(); + con->Release(); + } - //switch id's for those connections that were in the data list last go - around - int tmpID = m_dataList.m_listID; - m_dataList.m_listID = m_noDataList.m_listID; - m_noDataList.m_listID = tmpID; + //now move the complete data list over to the nodata list to reset those timers + m_noDataList.m_beginList = m_dataList.m_beginList; + m_dataList.m_beginList = nullptr; - m_noDataTimer.reset(); - m_noDataTimer.start(); - } + //switch id's for those connections that were in the data list last go - around + int tmpID = m_dataList.m_listID; + m_dataList.m_listID = m_noDataList.m_listID; + m_noDataList.m_listID = tmpID; - Release(); + m_noDataTimer.reset(); + m_noDataTimer.start(); + } - return processedIncoming; -} + Release(); -TcpConnection *TcpManager::EstablishConnection(const char *serverAddress, unsigned short serverPort, unsigned timeout) -{ - if (m_boundAsServer) - { - //can't open outgoing connections when in server mode - // use a different TcpManager to do that - return nullptr; - } + return processedIncoming; + } - if (m_connectionListCount >= m_params.maxConnections) - return(nullptr); + TcpConnection *TcpManager::EstablishConnection(const char *serverAddress, unsigned short serverPort, unsigned timeout) + { + if (m_boundAsServer) + { + //can't open outgoing connections when in server mode + // use a different TcpManager to do that + return nullptr; + } - // get server address - unsigned long address = inet_addr(serverAddress); - if (address == INADDR_NONE) - { - struct hostent * lphp; - lphp = gethostbyname(serverAddress); - if (lphp == nullptr) - return(nullptr); - address = ((struct in_addr *)(lphp->h_addr))->s_addr; - } - IPAddress destIP(address); + if (m_connectionListCount >= m_params.maxConnections) + return(nullptr); - TcpConnection *con = new TcpConnection(this, &m_allocator, m_params, destIP, serverPort, timeout); - con->AddRef();//for the client - to conform to UdpLibrary method - addNewConnection(con); + // get server address + unsigned long address = inet_addr(serverAddress); + if (address == INADDR_NONE) + { + struct hostent * lphp; + lphp = gethostbyname(serverAddress); + if (lphp == nullptr) + return(nullptr); + address = ((struct in_addr *)(lphp->h_addr))->s_addr; + } + IPAddress destIP(address); - return con; -} + TcpConnection *con = new TcpConnection(this, &m_allocator, m_params, destIP, serverPort, timeout); + con->AddRef();//for the client - to conform to UdpLibrary method + addNewConnection(con); -void TcpManager::addNewConnection(TcpConnection *con) -{ - con->AddRef(); + return con; + } + + void TcpManager::addNewConnection(TcpConnection *con) + { + con->AddRef(); #ifdef WIN32 //uses select - if (con->m_socket != INVALID_SOCKET) - FD_SET(con->m_socket, &m_permfds); + if (con->m_socket != INVALID_SOCKET) + FD_SET(con->m_socket, &m_permfds); #endif - con->m_nextConnection = m_connectionList; - con->m_prevConnection = nullptr; - if (m_connectionList != nullptr) - m_connectionList->m_prevConnection = con; - m_connectionList = con; - m_connectionListCount++; + con->m_nextConnection = m_connectionList; + con->m_prevConnection = nullptr; + if (m_connectionList != nullptr) + m_connectionList->m_prevConnection = con; + m_connectionList = con; + m_connectionListCount++; - con->m_nextKeepAliveConnection = m_aliveList.m_beginList; - con->m_prevKeepAliveConnection = nullptr; - if (m_aliveList.m_beginList != nullptr) - m_aliveList.m_beginList->m_prevKeepAliveConnection = con; - m_aliveList.m_beginList = con; - con->m_aliveListId = m_keepAliveList.m_listID;//start it out thinking it's already in the alive list, since it is + con->m_nextKeepAliveConnection = m_aliveList.m_beginList; + con->m_prevKeepAliveConnection = nullptr; + if (m_aliveList.m_beginList != nullptr) + m_aliveList.m_beginList->m_prevKeepAliveConnection = con; + m_aliveList.m_beginList = con; + con->m_aliveListId = m_keepAliveList.m_listID;//start it out thinking it's already in the alive list, since it is - con->m_nextRecvDataConnection = m_dataList.m_beginList; - con->m_prevRecvDataConnection = nullptr; - if (m_dataList.m_beginList != nullptr) - m_dataList.m_beginList->m_prevRecvDataConnection = con; - m_dataList.m_beginList = con; - con->m_recvDataListId = m_noDataList.m_listID;//start it out thinking it's already in the data list, since it is -} + con->m_nextRecvDataConnection = m_dataList.m_beginList; + con->m_prevRecvDataConnection = nullptr; + if (m_dataList.m_beginList != nullptr) + m_dataList.m_beginList->m_prevRecvDataConnection = con; + m_dataList.m_beginList = con; + con->m_recvDataListId = m_noDataList.m_listID;//start it out thinking it's already in the data list, since it is + } -void TcpManager::removeConnection(TcpConnection *con) -{ - if (!con->wasRemovedFromMgr()) - { - con->setRemovedFromMgr(); - m_connectionListCount--; - #ifdef WIN32 //select only used on win32 - if (con->m_socket != INVALID_SOCKET) - { - FD_CLR(con->m_socket, &m_permfds); - } - #endif - if (con->m_prevConnection != nullptr) - con->m_prevConnection->m_nextConnection = con->m_nextConnection; - if (con->m_nextConnection != nullptr) - con->m_nextConnection->m_prevConnection = con->m_prevConnection; - if (m_connectionList == con) - m_connectionList = con->m_nextConnection; - con->m_nextConnection = nullptr; - con->m_prevConnection = nullptr; + void TcpManager::removeConnection(TcpConnection *con) + { + if (!con->wasRemovedFromMgr()) + { + con->setRemovedFromMgr(); + m_connectionListCount--; +#ifdef WIN32 //select only used on win32 + if (con->m_socket != INVALID_SOCKET) + { + FD_CLR(con->m_socket, &m_permfds); + } +#endif + if (con->m_prevConnection != nullptr) + con->m_prevConnection->m_nextConnection = con->m_nextConnection; + if (con->m_nextConnection != nullptr) + con->m_nextConnection->m_prevConnection = con->m_prevConnection; + if (m_connectionList == con) + m_connectionList = con->m_nextConnection; + con->m_nextConnection = nullptr; + con->m_prevConnection = nullptr; - if (con->m_prevKeepAliveConnection != nullptr) - con->m_prevKeepAliveConnection->m_nextKeepAliveConnection = con->m_nextKeepAliveConnection; - if (con->m_nextKeepAliveConnection != nullptr) - con->m_nextKeepAliveConnection->m_prevKeepAliveConnection = con->m_prevKeepAliveConnection; + if (con->m_prevKeepAliveConnection != nullptr) + con->m_prevKeepAliveConnection->m_nextKeepAliveConnection = con->m_nextKeepAliveConnection; + if (con->m_nextKeepAliveConnection != nullptr) + con->m_nextKeepAliveConnection->m_prevKeepAliveConnection = con->m_prevKeepAliveConnection; - if (m_aliveList.m_beginList == con) - m_aliveList.m_beginList = con->m_nextKeepAliveConnection; - else if (m_keepAliveList.m_beginList == con) - m_keepAliveList.m_beginList = con->m_nextKeepAliveConnection; - con->m_nextKeepAliveConnection = nullptr; - con->m_prevKeepAliveConnection = nullptr; + if (m_aliveList.m_beginList == con) + m_aliveList.m_beginList = con->m_nextKeepAliveConnection; + else if (m_keepAliveList.m_beginList == con) + m_keepAliveList.m_beginList = con->m_nextKeepAliveConnection; + con->m_nextKeepAliveConnection = nullptr; + con->m_prevKeepAliveConnection = nullptr; + if (con->m_prevRecvDataConnection != nullptr) + con->m_prevRecvDataConnection->m_nextRecvDataConnection = con->m_nextRecvDataConnection; + if (con->m_nextRecvDataConnection != nullptr) + con->m_nextRecvDataConnection->m_prevRecvDataConnection = con->m_prevRecvDataConnection; + if (m_dataList.m_beginList == con) + m_dataList.m_beginList = con->m_nextRecvDataConnection; + else if (m_noDataList.m_beginList == con) + m_noDataList.m_beginList = con->m_nextRecvDataConnection; + con->m_nextRecvDataConnection = nullptr; + con->m_prevRecvDataConnection = nullptr; - if (con->m_prevRecvDataConnection != nullptr) - con->m_prevRecvDataConnection->m_nextRecvDataConnection = con->m_nextRecvDataConnection; - if (con->m_nextRecvDataConnection != nullptr) - con->m_nextRecvDataConnection->m_prevRecvDataConnection = con->m_prevRecvDataConnection; + con->Release(); + } + } - if (m_dataList.m_beginList == con) - m_dataList.m_beginList = con->m_nextRecvDataConnection; - else if (m_noDataList.m_beginList == con) - m_noDataList.m_beginList = con->m_nextRecvDataConnection; - con->m_nextRecvDataConnection = nullptr; - con->m_prevRecvDataConnection = nullptr; + void TcpManager::AddRef() + { + m_refCount++; + } + void TcpManager::Release() + { + if (--m_refCount == 0) + delete this; + } + IPAddress TcpManager::GetLocalIp() const + { + struct sockaddr_in addr_self; + memset(&addr_self, 0, sizeof(addr_self)); + socklen_t len = sizeof(addr_self); + getsockname(m_socket, (struct sockaddr *)&addr_self, &len); + return(IPAddress(addr_self.sin_addr.s_addr)); + } - con->Release(); - } -} - -void TcpManager::AddRef() -{ - m_refCount++; -} - -void TcpManager::Release() -{ - if (--m_refCount == 0) - delete this; -} - -IPAddress TcpManager::GetLocalIp() const -{ - struct sockaddr_in addr_self; - memset(&addr_self, 0, sizeof(addr_self)); - socklen_t len = sizeof(addr_self); - getsockname(m_socket, (struct sockaddr *)&addr_self, &len); - return(IPAddress(addr_self.sin_addr.s_addr)); - -} - -unsigned int TcpManager::GetLocalPort() const -{ - struct sockaddr_in addr_self; - memset(&addr_self, 0, sizeof(addr_self)); - socklen_t len = sizeof(addr_self); - getsockname(m_socket, (struct sockaddr *)&addr_self, &len); - return(ntohs(addr_self.sin_port)); -} - + unsigned int TcpManager::GetLocalPort() const + { + struct sockaddr_in addr_self; + memset(&addr_self, 0, sizeof(addr_self)); + socklen_t len = sizeof(addr_self); + getsockname(m_socket, (struct sockaddr *)&addr_self, &len); + return(ntohs(addr_self.sin_port)); + } #ifdef EXTERNAL_DISTRO }; -#endif - - +#endif \ No newline at end of file diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericConnection.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericConnection.cpp index 2fd9ca45..ae67918e 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericConnection.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericConnection.cpp @@ -12,198 +12,199 @@ //---------------------------------------- #ifdef EXTERNAL_DISTRO -namespace NAMESPACE +namespace NAMESPACE { #endif -using namespace std; -using namespace Base; + using namespace std; + using namespace Base; -GenericConnection::GenericConnection(const char *host, short port, GenericAPICore *apiCore, unsigned reconnectTimeout, unsigned noDataTimeoutSecs, unsigned noAckTimeoutSecs, unsigned incomingBufSizeInKB, unsigned outgoingBufSizeInKB, unsigned keepAlive, unsigned maxRecvMessageSizeInKB) -: m_bConnected(CON_NONE), - m_apiCore(apiCore), - m_con(nullptr), - m_host(host), - m_port(port), - m_lastTrack(123455), //random choice != 1 - m_conState(CON_DISCONNECT), - m_reconnectTimeout(reconnectTimeout) -{ - TcpManager::TcpParams params; - - params.incomingBufferSize = incomingBufSizeInKB * 1024; - params.outgoingBufferSize = outgoingBufSizeInKB * 1024; - params.maxConnections = 1; - params.port = 0; - params.maxRecvMessageSize = maxRecvMessageSizeInKB*1024; - params.keepAliveDelay = keepAlive * 1000; - params.noDataTimeout = noDataTimeoutSecs * 1000; - //params.oldestUnacknowledgedTimeout = noAckTimeoutSecs * 1000; - - m_manager = new TcpManager(params); -} - -GenericConnection::~GenericConnection() -{ - if(m_con) + GenericConnection::GenericConnection(const char *host, short port, GenericAPICore *apiCore, unsigned reconnectTimeout, unsigned noDataTimeoutSecs, unsigned noAckTimeoutSecs, unsigned incomingBufSizeInKB, unsigned outgoingBufSizeInKB, unsigned keepAlive, unsigned maxRecvMessageSizeInKB) + : m_bConnected(CON_NONE), + m_apiCore(apiCore), + m_con(nullptr), + m_host(host), + m_port(port), + m_lastTrack(123455), //random choice != 1 + m_conState(CON_DISCONNECT), + m_reconnectTimeout(reconnectTimeout), + m_conTimeout(100) { - m_con->SetHandler(nullptr); - m_con->Disconnect();//don't worry about onterminated being called, we've set it's handler to nullptr, so it wont - m_con->Release(); + TcpManager::TcpParams params; + + params.incomingBufferSize = incomingBufSizeInKB * 1024; + params.outgoingBufferSize = outgoingBufSizeInKB * 1024; + params.maxConnections = 1; + params.port = 0; + params.maxRecvMessageSize = maxRecvMessageSizeInKB * 1024; + params.keepAliveDelay = keepAlive * 1000; + params.noDataTimeout = noDataTimeoutSecs * 1000; + //params.oldestUnacknowledgedTimeout = noAckTimeoutSecs * 1000; + + m_manager = new TcpManager(params); } - m_manager->Release(); -} - -void GenericConnection::disconnect() -{ - if (m_con) + GenericConnection::~GenericConnection() { - m_con->Disconnect(); - //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); - m_con = nullptr; + if (m_con) + { + m_con->SetHandler(nullptr); + m_con->Disconnect();//don't worry about onterminated being called, we've set it's handler to nullptr, so it wont + m_con->Release(); + } + + m_manager->Release(); } - m_conState = CON_DISCONNECT; - m_bConnected = CON_NONE; -} -void GenericConnection::OnTerminated(TcpConnection *con) -{ -// m_apiCore->OnDisconnect(m_host.c_str(), m_port); - m_apiCore->OnDisconnect(this); - if(m_con) + void GenericConnection::disconnect() { - m_con->Release(); - m_con = nullptr; + if (m_con) + { + m_con->Disconnect(); + //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); + m_con = nullptr; + } + m_conState = CON_DISCONNECT; + m_bConnected = CON_NONE; } - m_conState = CON_DISCONNECT; - m_bConnected = CON_NONE; -} -void GenericConnection::OnRoutePacket(TcpConnection *con, const unsigned char *data, int dataLen) -{ - short type; - unsigned track; - - ByteStream msg(data, dataLen); - ByteStream::ReadIterator iter = msg.begin(); - - get(iter, type); - get(iter, track); - GenericResponse *res = nullptr; - - // the following if block is a temporary fix that prevents - // a crash with a game team in which they occasionally find - // themselves receiving a dupe track in consecutive calls to - // OnRoutePacket (which then leads to a callback being called - // twice and data being invalid on the second call -> crash!). - if (track != 0 && - track == m_lastTrack) + void GenericConnection::OnTerminated(TcpConnection *con) { - printf("!!! ERROR !!! Got a duplicate track ID %u\n", track); - return; + // m_apiCore->OnDisconnect(m_host.c_str(), m_port); + m_apiCore->OnDisconnect(this); + if (m_con) + { + m_con->Release(); + m_con = nullptr; + } + m_conState = CON_DISCONNECT; + m_bConnected = CON_NONE; } - m_lastTrack = track; - // end temporary fix. - - if(track == 0) // notification message from the server, not as a response to a request from this API + void GenericConnection::OnRoutePacket(TcpConnection *con, const unsigned char *data, int dataLen) { - if (type == CTService::CTGAME_REQUEST_CONNECT) - { // this is a special case, for when we have identified our game code to server - m_bConnected = CON_IDENTIFIED; - m_apiCore->OnConnect(this); + short type; + unsigned track; + + ByteStream msg(data, dataLen); + ByteStream::ReadIterator iter = msg.begin(); + + get(iter, type); + get(iter, track); + GenericResponse *res = nullptr; + + // the following if block is a temporary fix that prevents + // a crash with a game team in which they occasionally find + // themselves receiving a dupe track in consecutive calls to + // OnRoutePacket (which then leads to a callback being called + // twice and data being invalid on the second call -> crash!). + if (track != 0 && + track == m_lastTrack) + { + printf("!!! ERROR !!! Got a duplicate track ID %u\n", track); + return; + } + m_lastTrack = track; + + // end temporary fix. + + if (track == 0) // notification message from the server, not as a response to a request from this API + { + if (type == CTService::CTGAME_REQUEST_CONNECT) + { // this is a special case, for when we have identified our game code to server + m_bConnected = CON_IDENTIFIED; + m_apiCore->OnConnect(this); + } + else + { + m_apiCore->responseCallback(type, iter, this); + } } else { - m_apiCore->responseCallback(type, iter, this); + map::iterator mapIter = m_apiCore->m_pending.find(track); + + if (mapIter != m_apiCore->m_pending.end()) + { + res = (*mapIter).second; + iter = msg.begin(); + res->unpack(iter); + m_apiCore->responseCallback(res); + m_apiCore->m_pendingCount--; + m_apiCore->m_pending.erase(mapIter); + delete res; + } } } - else + + void GenericConnection::process() { - map::iterator mapIter = m_apiCore->m_pending.find(track); + switch (m_conState) + { + case CON_DISCONNECT: + // create connection object, attempting to connect and + // checking for connection in next state, CON_NEGOTIATE + m_con = m_manager->EstablishConnection(m_host.c_str(), m_port); + if (m_con) + { + m_con->SetHandler(this); + m_conState = CON_NEGOTIATE; + m_conTimeout = time(nullptr) + m_reconnectTimeout; + } + break; + case CON_NEGOTIATE: + // check for connection - if(mapIter != m_apiCore->m_pending.end()) - { - res = (*mapIter).second; - iter = msg.begin(); - res->unpack(iter); - m_apiCore->responseCallback(res); - m_apiCore->m_pendingCount--; - m_apiCore->m_pending.erase(mapIter); - delete res; - } - } -} - -void GenericConnection::process() -{ - switch(m_conState) - { - case CON_DISCONNECT: - // create connection object, attempting to connect and - // checking for connection in next state, CON_NEGOTIATE - m_con = m_manager->EstablishConnection(m_host.c_str(), m_port); - if(m_con) - { - m_con->SetHandler(this); - m_conState = CON_NEGOTIATE; - m_conTimeout = time(nullptr) + m_reconnectTimeout; - } - break; - case CON_NEGOTIATE: - // check for connection - - if(m_con->GetStatus() == TcpConnection::StatusConnected) - { - // we're connected - m_conState = CON_CONNECT; - m_bConnected = CON_CONNECTED; - // instead of calling OnConnect() right now, we are going to submit a connection packet - // identifying us -// m_apiCore->OnConnect(this); - Base::ByteStream msg; - put(msg, (short)CTService::CTGAME_REQUEST_CONNECT); - put(msg, (unsigned)0); // track - put(msg, (unsigned)API_VERSION_CODE); - put(msg, m_apiCore->getGameCode()); - Send(msg); - } - else if(time(nullptr) > m_conTimeout) - { - // we did not connect - m_con->Disconnect(); - //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); - m_con = nullptr; + if (m_con->GetStatus() == TcpConnection::StatusConnected) + { + // we're connected + m_conState = CON_CONNECT; + m_bConnected = CON_CONNECTED; + // instead of calling OnConnect() right now, we are going to submit a connection packet + // identifying us + // m_apiCore->OnConnect(this); + Base::ByteStream msg; + put(msg, (short)CTService::CTGAME_REQUEST_CONNECT); + put(msg, (unsigned)0); // track + put(msg, (unsigned)API_VERSION_CODE); + put(msg, m_apiCore->getGameCode()); + Send(msg); + } + else if (time(nullptr) > m_conTimeout) + { + // we did not connect + m_con->Disconnect(); + //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); + m_con = nullptr; + m_conState = CON_DISCONNECT; + m_bConnected = CON_NONE; + } + break; + case CON_CONNECT: + // do nothing + break; + default: + // this should not occur, but we revert to CON_DISCONNECT if it does m_conState = CON_DISCONNECT; - m_bConnected = CON_NONE; - } - break; - case CON_CONNECT: - // do nothing - break; - default: - // this should not occur, but we revert to CON_DISCONNECT if it does - m_conState = CON_DISCONNECT; - m_bConnected = CON_NONE; - if (m_con) - { - m_con->Disconnect(); - //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); - m_con = nullptr; + m_bConnected = CON_NONE; + if (m_con) + { + m_con->Disconnect(); + //no need to release, since callback to onTerminated releases it, and callback is allways made m_con->Release(); + m_con = nullptr; + } } + m_manager->GiveTime(); } - m_manager->GiveTime(); -} -void GenericConnection::Send(Base::ByteStream &msg) -{ - if(m_con && m_con->GetStatus() == TcpConnection::StatusConnected) + void GenericConnection::Send(Base::ByteStream &msg) { - m_con->Send((const char *)msg.getBuffer(), msg.getSize()); + if (m_con && m_con->GetStatus() == TcpConnection::StatusConnected) + { + m_con->Send((const char *)msg.getBuffer(), msg.getSize()); + } } -} #ifdef EXTERNAL_DISTRO }; -#endif +#endif \ No newline at end of file diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericMessage.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericMessage.cpp index c01729d8..695d9442 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericMessage.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericMessage.cpp @@ -9,36 +9,35 @@ //---------------------------------------- #ifdef EXTERNAL_DISTRO -namespace NAMESPACE +namespace NAMESPACE { - #endif -using namespace Base; + using namespace Base; -//------------------------------------------- -GenericRequest::GenericRequest(short type, unsigned server_track) -: m_type(type), m_server_track(server_track) -//------------------------------------------- -{ -} + //------------------------------------------- + GenericRequest::GenericRequest(short type, unsigned server_track) + : m_type(type), m_server_track(server_track), m_track(0), m_timeout(100) + //------------------------------------------- + { + } -//------------------------------------------- -GenericResponse::GenericResponse(short type, unsigned result, void *user) -: m_type(type), m_result(result), m_user(user) -//------------------------------------------- -{ -} + //------------------------------------------- + GenericResponse::GenericResponse(short type, unsigned result, void *user) + : m_type(type), m_result(result), m_user(user), m_track(0), m_timeout(100) + //------------------------------------------- + { + } -//----------------------------------------- -void GenericResponse::unpack(ByteStream::ReadIterator &iter) -//----------------------------------------- -{ - get(iter, m_type); - get(iter, m_track); - get(iter, m_result); -} + //----------------------------------------- + void GenericResponse::unpack(ByteStream::ReadIterator &iter) + //----------------------------------------- + { + get(iter, m_type); + get(iter, m_track); + get(iter, m_result); + } #ifdef EXTERNAL_DISTRO }; -#endif +#endif \ No newline at end of file diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpManager.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpManager.cpp index 2586fa64..bfc84c13 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpManager.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpManager.cpp @@ -4,731 +4,707 @@ #include "TcpConnection.h" #ifndef WIN32 - #include +#include #endif - #ifdef EXTERNAL_DISTRO -namespace NAMESPACE +namespace NAMESPACE { #endif -TcpManager::TcpParams::TcpParams() -: port(0), - maxConnections(10), - incomingBufferSize(64*1024), - outgoingBufferSize(64*1024), - allocatorBlockSize(8*1024), - allocatorBlockCount(16), - maxRecvMessageSize(0), - keepAliveDelay(0), - noDataTimeout(0) -{ - memset(bindAddress, 0, sizeof(bindAddress)); -} + TcpManager::TcpParams::TcpParams() + : port(0), + maxConnections(10), + incomingBufferSize(64 * 1024), + outgoingBufferSize(64 * 1024), + allocatorBlockSize(8 * 1024), + allocatorBlockCount(16), + maxRecvMessageSize(0), + keepAliveDelay(0), + noDataTimeout(0) + { + memset(bindAddress, 0, sizeof(bindAddress)); + } -TcpManager::TcpParams::TcpParams(const TcpParams &cpy) -: port(cpy.port), - maxConnections(cpy.maxConnections), - incomingBufferSize(cpy.incomingBufferSize), - outgoingBufferSize(cpy.outgoingBufferSize), - allocatorBlockSize(cpy.allocatorBlockSize), - allocatorBlockCount(cpy.allocatorBlockCount), - maxRecvMessageSize(cpy.maxRecvMessageSize), - keepAliveDelay(cpy.keepAliveDelay), - noDataTimeout(cpy.noDataTimeout) -{ -} + TcpManager::TcpParams::TcpParams(const TcpParams &cpy) + : port(cpy.port), + maxConnections(cpy.maxConnections), + incomingBufferSize(cpy.incomingBufferSize), + outgoingBufferSize(cpy.outgoingBufferSize), + allocatorBlockSize(cpy.allocatorBlockSize), + allocatorBlockCount(cpy.allocatorBlockCount), + maxRecvMessageSize(cpy.maxRecvMessageSize), + keepAliveDelay(cpy.keepAliveDelay), + noDataTimeout(cpy.noDataTimeout) + { + } -TcpManager::TcpManager(const TcpParams ¶ms) -: m_handler(nullptr), - m_keepAliveList(nullptr, 1), - m_aliveList(nullptr, 2), - m_noDataList(nullptr, 1), - m_dataList(nullptr, 2), - m_params(params), - m_refCount(1), - m_connectionList(nullptr), - m_connectionListCount(0), - m_socket(INVALID_SOCKET), - m_boundAsServer(false), - m_allocator(params.allocatorBlockSize, params.allocatorBlockCount), - m_keepAliveTimer(), - m_noDataTimer() -{ - if (params.keepAliveDelay > 0) - m_keepAliveTimer.start(); - - if (params.noDataTimeout > 0) - m_noDataTimer.start(); - -#if defined(WIN32) - WSADATA wsaData; - WSAStartup(MAKEWORD(1,1), &wsaData); - - FD_ZERO(&m_permfds);//select only used on win32 -#endif - -} - - -TcpManager::~TcpManager() -{ -#if defined(WIN32) - WSACleanup(); -#endif - - if (m_boundAsServer) - { -#if defined(WIN32) - closesocket(m_socket); -#else - close(m_socket); -#endif - } - while (m_connectionList != nullptr) - { - TcpConnection *con = m_connectionList; - m_connectionList = m_connectionList->m_nextConnection; - con->Release(); - m_connectionListCount--; - } -} - - -bool TcpManager::BindAsServer() -{ - - m_socket = socket(AF_INET, SOCK_STREAM, 0); - - if (m_socket != INVALID_SOCKET) - { -#if defined(WIN32) - FD_SET(m_socket, &m_permfds);//the socket this server is listening on - - unsigned long isNonBlocking = 1; - int outBufSize = m_params.outgoingBufferSize; - int inBufSize = m_params.incomingBufferSize; - int keepAlive = 1; - int reuseAddr = 1; - struct linger ld; - ld.l_onoff = 0; - ld.l_linger = 0; - - if (ioctlsocket(m_socket, FIONBIO, &isNonBlocking) != 0 - || setsockopt(m_socket, SOL_SOCKET, SO_SNDBUF, (char *)&outBufSize, sizeof(outBufSize)) != 0 - || setsockopt(m_socket, SOL_SOCKET, SO_RCVBUF, (char *)&inBufSize, sizeof(inBufSize)) != 0 - || setsockopt(m_socket, SOL_SOCKET, SO_KEEPALIVE, (char *)&keepAlive, sizeof(keepAlive)) != 0 - || setsockopt(m_socket, SOL_SOCKET, SO_REUSEADDR, (char *)&reuseAddr, sizeof(reuseAddr)) != 0 - || setsockopt(m_socket, SOL_SOCKET, SO_LINGER, (char *)&ld, sizeof(ld)) != 0 ) - { - return false; - } -#else // linux is to remain the default compile mode - unsigned long isNonBlocking = 1; - unsigned long keepAlive = 1; - unsigned long outBufSize = m_params.outgoingBufferSize; - unsigned long inBufSize = m_params.incomingBufferSize; - unsigned long reuseAddr = 1; - struct linger ld; - ld.l_onoff = 0; - ld.l_linger = 0; - - if (ioctl(m_socket, FIONBIO, &isNonBlocking) != 0 - || setsockopt(m_socket, SOL_SOCKET, SO_SNDBUF, &outBufSize, sizeof(outBufSize)) != 0 - || setsockopt(m_socket, SOL_SOCKET, SO_RCVBUF, &inBufSize, sizeof(inBufSize)) != 0 - || setsockopt(m_socket, SOL_SOCKET, SO_KEEPALIVE, &keepAlive, sizeof(keepAlive)) != 0 - || setsockopt(m_socket, SOL_SOCKET, SO_REUSEADDR, &reuseAddr, sizeof(reuseAddr)) != 0 - || setsockopt(m_socket, SOL_SOCKET, SO_LINGER, &ld, sizeof(ld)) != 0) - { - return false; - } -#endif - } - else - { - return false; - } - - - struct sockaddr_in addr_loc; - addr_loc.sin_family = AF_INET; - addr_loc.sin_port = htons(m_params.port); - addr_loc.sin_addr.s_addr = htonl(INADDR_ANY); - if (m_params.bindAddress[0] != 0) - { - unsigned long address = inet_addr(m_params.bindAddress); - if (address == INADDR_NONE) - { - struct hostent * lphp; - lphp = gethostbyname(m_params.bindAddress); - if (lphp != nullptr) - addr_loc.sin_addr.s_addr = ((struct in_addr *)(lphp->h_addr))->s_addr; - } - else - { - addr_loc.sin_addr.s_addr = address; - } - } - - if (bind(m_socket, (struct sockaddr *)&addr_loc, sizeof(addr_loc)) != 0) - { - return false; - } - - if (listen(m_socket, 1000) != 0) - { - return false; - } - - m_boundAsServer = true; - return true; -} - -TcpConnection *TcpManager::acceptClient() -{ - TcpConnection *newConn = nullptr; - - if (m_boundAsServer && m_connectionListCount < m_params.maxConnections) - { - - sockaddr_in addr; - int addrLength = sizeof(addr); - SOCKET sock = ::accept(m_socket, (sockaddr *) &addr, (socklen_t *) &addrLength); - - - if (sock != INVALID_SOCKET) - { - newConn = new TcpConnection(this, &m_allocator, m_params, sock, IPAddress(addr.sin_addr.s_addr), ntohs(addr.sin_port)); - addNewConnection(newConn); - if (m_handler != nullptr) - { - m_handler->OnConnectRequest(newConn); - } - } - } - - return newConn; -} - -void TcpManager::SetHandler(TcpManagerHandler *handler) -{ - m_handler = handler; -} - -SOCKET TcpManager::getMaxFD() -{ + TcpManager::TcpManager(const TcpParams ¶ms) + : m_handler(nullptr), + m_keepAliveList(nullptr, 1), + m_aliveList(nullptr, 2), + m_noDataList(nullptr, 1), + m_dataList(nullptr, 2), + m_params(params), + m_refCount(1), + m_connectionList(nullptr), + m_connectionListCount(0), + m_socket(INVALID_SOCKET), + m_boundAsServer(false), + m_allocator(params.allocatorBlockSize, params.allocatorBlockCount), + m_keepAliveTimer(), + m_noDataTimer() #ifdef WIN32 - return 0;//this param is not used on win32 for select, only on unix -#else - SOCKET maxfd = 0; - - if (m_boundAsServer) - maxfd = m_socket+1; - - TcpConnection *next = nullptr; - for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) - { - next = con->m_nextConnection; - if (con->GetStatus() != TcpConnection::StatusDisconnected && con->m_socket > maxfd) - { - maxfd = con->m_socket + 1; - } - } - return maxfd; + , m_permfds() #endif -} + { + if (params.keepAliveDelay > 0) + m_keepAliveTimer.start(); -TcpConnection *TcpManager::getConnection(SOCKET fd) -{ - TcpConnection *next = nullptr; - for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) - { - next = con->m_nextConnection; - if (con->m_socket == fd) - { - return con; - } - } - //if get here ,couldn't find it - return nullptr; -} + if (params.noDataTimeout > 0) + m_noDataTimer.start(); -bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendTimePerConnection, unsigned maxRecvTimePerConnection) -{ - bool processedIncoming = false; +#if defined(WIN32) + WSADATA wsaData; + WSAStartup(MAKEWORD(1, 1), &wsaData); - if (maxTimeAcceptingConnections == 0 && maxSendTimePerConnection==0 && maxRecvTimePerConnection==0) - { - //they don't want to do anything now - return processedIncoming; - } + FD_ZERO(&m_permfds);//select only used on win32 +#endif + } - AddRef(); //keep a reference to ourself in case we callback to the application and the application releases us. + TcpManager::~TcpManager() + { +#if defined(WIN32) + WSACleanup(); +#endif + if (m_boundAsServer) + { +#if defined(WIN32) + closesocket(m_socket); +#else + close(m_socket); +#endif + } + while (m_connectionList != nullptr) + { + TcpConnection *con = m_connectionList; + m_connectionList = m_connectionList->m_nextConnection; + con->Release(); + m_connectionListCount--; + } + } + bool TcpManager::BindAsServer() + { + m_socket = socket(AF_INET, SOCK_STREAM, 0); - //first process outgoing on each connection, and finish establishing connections, if params say to - if (m_connectionListCount != 0 && maxSendTimePerConnection != 0) - { + if (m_socket != INVALID_SOCKET) + { +#if defined(WIN32) + FD_SET(m_socket, &m_permfds);//the socket this server is listening on - // Send output from last heartbeat - TcpConnection *next = nullptr; - for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) - { - con->AddRef(); - if (next) next->Release(); - next = con->m_nextConnection; - if (next) next->AddRef(); - if(con->GetStatus() == TcpConnection::StatusConnected) - { - Clock timer; - timer.start(); - while(!timer.isDone(maxSendTimePerConnection)) - { - int err = con->processOutgoing(); + unsigned long isNonBlocking = 1; + int outBufSize = m_params.outgoingBufferSize; + int inBufSize = m_params.incomingBufferSize; + int keepAlive = 1; + int reuseAddr = 1; + struct linger ld; + ld.l_onoff = 0; + ld.l_linger = 0; - if (err > 0) - { - //couldn't finish processing last request, don't try more - break; - } - else if (err < 0) - { - break; - } - } - con->Release(); - } - else if (con->GetStatus() == TcpConnection::StatusNegotiating) - { - if (con->finishConnect() < 0) - { + if (ioctlsocket(m_socket, FIONBIO, &isNonBlocking) != 0 + || setsockopt(m_socket, SOL_SOCKET, SO_SNDBUF, (char *)&outBufSize, sizeof(outBufSize)) != 0 + || setsockopt(m_socket, SOL_SOCKET, SO_RCVBUF, (char *)&inBufSize, sizeof(inBufSize)) != 0 + || setsockopt(m_socket, SOL_SOCKET, SO_KEEPALIVE, (char *)&keepAlive, sizeof(keepAlive)) != 0 + || setsockopt(m_socket, SOL_SOCKET, SO_REUSEADDR, (char *)&reuseAddr, sizeof(reuseAddr)) != 0 + || setsockopt(m_socket, SOL_SOCKET, SO_LINGER, (char *)&ld, sizeof(ld)) != 0) + { + return false; + } +#else // linux is to remain the default compile mode + unsigned long isNonBlocking = 1; + unsigned long keepAlive = 1; + unsigned long outBufSize = m_params.outgoingBufferSize; + unsigned long inBufSize = m_params.incomingBufferSize; + unsigned long reuseAddr = 1; + struct linger ld; + ld.l_onoff = 0; + ld.l_linger = 0; + + if (ioctl(m_socket, FIONBIO, &isNonBlocking) != 0 + || setsockopt(m_socket, SOL_SOCKET, SO_SNDBUF, &outBufSize, sizeof(outBufSize)) != 0 + || setsockopt(m_socket, SOL_SOCKET, SO_RCVBUF, &inBufSize, sizeof(inBufSize)) != 0 + || setsockopt(m_socket, SOL_SOCKET, SO_KEEPALIVE, &keepAlive, sizeof(keepAlive)) != 0 + || setsockopt(m_socket, SOL_SOCKET, SO_REUSEADDR, &reuseAddr, sizeof(reuseAddr)) != 0 + || setsockopt(m_socket, SOL_SOCKET, SO_LINGER, &ld, sizeof(ld)) != 0) + { + return false; + } +#endif + } + else + { + return false; + } + + struct sockaddr_in addr_loc; + addr_loc.sin_family = AF_INET; + addr_loc.sin_port = htons(m_params.port); + addr_loc.sin_addr.s_addr = htonl(INADDR_ANY); + if (m_params.bindAddress[0] != 0) + { + unsigned long address = inet_addr(m_params.bindAddress); + if (address == INADDR_NONE) + { + struct hostent * lphp; + lphp = gethostbyname(m_params.bindAddress); + if (lphp != nullptr) + addr_loc.sin_addr.s_addr = ((struct in_addr *)(lphp->h_addr))->s_addr; + } + else + { + addr_loc.sin_addr.s_addr = address; + } + } + + if (bind(m_socket, (struct sockaddr *)&addr_loc, sizeof(addr_loc)) != 0) + { + return false; + } + + if (listen(m_socket, 1000) != 0) + { + return false; + } + + m_boundAsServer = true; + return true; + } + + TcpConnection *TcpManager::acceptClient() + { + TcpConnection *newConn = nullptr; + + if (m_boundAsServer && m_connectionListCount < m_params.maxConnections) + { + sockaddr_in addr; + int addrLength = sizeof(addr); + SOCKET sock = ::accept(m_socket, (sockaddr *)&addr, (socklen_t *)&addrLength); + + if (sock != INVALID_SOCKET) + { + newConn = new TcpConnection(this, &m_allocator, m_params, sock, IPAddress(addr.sin_addr.s_addr), ntohs(addr.sin_port)); + addNewConnection(newConn); + if (m_handler != nullptr) + { + m_handler->OnConnectRequest(newConn); + } + } + } + + return newConn; + } + + void TcpManager::SetHandler(TcpManagerHandler *handler) + { + m_handler = handler; + } + + SOCKET TcpManager::getMaxFD() + { +#ifdef WIN32 + return 0;//this param is not used on win32 for select, only on unix +#else + SOCKET maxfd = 0; + + if (m_boundAsServer) + maxfd = m_socket + 1; + + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList; con != nullptr; con = next) + { + next = con->m_nextConnection; + if (con->GetStatus() != TcpConnection::StatusDisconnected && con->m_socket > maxfd) + { + maxfd = con->m_socket + 1; + } + } + return maxfd; +#endif + } + + TcpConnection *TcpManager::getConnection(SOCKET fd) + { + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList; con != nullptr; con = next) + { + next = con->m_nextConnection; + if (con->m_socket == fd) + { + return con; + } + } + //if get here ,couldn't find it + return nullptr; + } + + bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections, unsigned maxSendTimePerConnection, unsigned maxRecvTimePerConnection) + { + bool processedIncoming = false; + + if (maxTimeAcceptingConnections == 0 && maxSendTimePerConnection == 0 && maxRecvTimePerConnection == 0) + { + //they don't want to do anything now + return processedIncoming; + } + + AddRef(); //keep a reference to ourself in case we callback to the application and the application releases us. + + //first process outgoing on each connection, and finish establishing connections, if params say to + if (m_connectionListCount != 0 && maxSendTimePerConnection != 0) + { + // Send output from last heartbeat + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList; con != nullptr; con = next) + { + con->AddRef(); + if (next) next->Release(); + next = con->m_nextConnection; + if (next) next->AddRef(); + if (con->GetStatus() == TcpConnection::StatusConnected) + { + Clock timer; + timer.start(); + while (!timer.isDone(maxSendTimePerConnection)) + { + int err = con->processOutgoing(); + + if (err > 0) + { + //couldn't finish processing last request, don't try more + break; + } + else if (err < 0) + { + break; + } + } con->Release(); - continue; - } - con->Release(); - } - else //inactive client in client list???? - { - removeConnection(con); - con->Release(); - continue; - } - } - - } - - //process incoming messages (including connect requests) - if (( - m_boundAsServer //if in server mode and want to spend time accepting clients - && maxTimeAcceptingConnections != 0 - ) - || - ( - m_connectionListCount != 0 //if there are connections and want to spend time receiving on them - && maxRecvTimePerConnection != 0 - ) - ) - { -#ifdef WIN32 - SOCKET maxfd = getMaxFD(); //re-calc maxfd every time select on WIN32 - - //select on all fd's - struct timeval timeout; - - fd_set tmpfds; - tmpfds = m_permfds; - timeout.tv_sec = 0; - timeout.tv_usec = 0; - int cnt = select(maxfd, &tmpfds, nullptr, nullptr, &timeout); // blocks for timeout - - - if (cnt > 0) - { - if (m_boundAsServer && maxTimeAcceptingConnections != 0) - {//activity on our socket means connect requests - - //see if are new incoming clients - if (FD_ISSET(m_socket, &tmpfds)) - { - //yep - Clock timer; - timer.start(); - while (acceptClient() && !timer.isDone(maxTimeAcceptingConnections)) - { - //loop - } - } - } - - - - //process incoming client messages - if (maxRecvTimePerConnection != 0) - { - TcpConnection *next = nullptr; - for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next) - { - con->AddRef(); - if (next) next->Release(); - next = con->m_nextConnection; - if (next) next->AddRef(); - - SOCKET fd = con->m_socket; - if (fd == INVALID_SOCKET) - { - //invalid socket in list?, check if is connecting, otherwise, Disconnect and discard - if (con->GetStatus() != TcpConnection::StatusNegotiating) - { - removeConnection(con); - con->Release(); - continue; - } - } - - if (FD_ISSET(fd, &tmpfds)) - { - Clock timer; - timer.start(); - while(!timer.isDone(maxRecvTimePerConnection) && con->GetStatus() == TcpConnection::StatusConnected) - { - int err = con->processIncoming(); - if (err >= 0) - { - processedIncoming = true; - } - - if (err > 0) - { - //couldn't finish processing last request, don't try more - break; - } - else if (err < 0) - { - break; - } - - }//while(!timer...) - }//if (FD_ISSET...) + } + else if (con->GetStatus() == TcpConnection::StatusNegotiating) + { + if (con->finishConnect() < 0) + { + con->Release(); + continue; + } con->Release(); - }//for (...) - } //maxRecvTimePerConnection != 0 - }//cnt > 0 + } + else //inactive client in client list???? + { + removeConnection(con); + con->Release(); + continue; + } + } + } + + //process incoming messages (including connect requests) + if (( + m_boundAsServer //if in server mode and want to spend time accepting clients + && maxTimeAcceptingConnections != 0 + ) + || + ( + m_connectionListCount != 0 //if there are connections and want to spend time receiving on them + && maxRecvTimePerConnection != 0 + ) + ) + { +#ifdef WIN32 + SOCKET maxfd = getMaxFD(); //re-calc maxfd every time select on WIN32 + + //select on all fd's + struct timeval timeout; + + fd_set tmpfds; + tmpfds = m_permfds; + timeout.tv_sec = 0; + timeout.tv_usec = 0; + int cnt = select(maxfd, &tmpfds, nullptr, nullptr, &timeout); // blocks for timeout + + if (cnt > 0) + { + if (m_boundAsServer && maxTimeAcceptingConnections != 0) + {//activity on our socket means connect requests + //see if are new incoming clients + if (FD_ISSET(m_socket, &tmpfds)) + { + //yep + Clock timer; + timer.start(); + while (acceptClient() && !timer.isDone(maxTimeAcceptingConnections)) + { + //loop + } + } + } + + //process incoming client messages + if (maxRecvTimePerConnection != 0) + { + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList; con != nullptr; con = next) + { + con->AddRef(); + if (next) next->Release(); + next = con->m_nextConnection; + if (next) next->AddRef(); + + SOCKET fd = con->m_socket; + if (fd == INVALID_SOCKET) + { + //invalid socket in list?, check if is connecting, otherwise, Disconnect and discard + if (con->GetStatus() != TcpConnection::StatusNegotiating) + { + removeConnection(con); + con->Release(); + continue; + } + } + + if (FD_ISSET(fd, &tmpfds)) + { + Clock timer; + timer.start(); + while (!timer.isDone(maxRecvTimePerConnection) && con->GetStatus() == TcpConnection::StatusConnected) + { + int err = con->processIncoming(); + if (err >= 0) + { + processedIncoming = true; + } + + if (err > 0) + { + //couldn't finish processing last request, don't try more + break; + } + else if (err < 0) + { + break; + } + }//while(!timer...) + }//if (FD_ISSET...) + con->Release(); + }//for (...) + } //maxRecvTimePerConnection != 0 + }//cnt > 0 #else //on UNIX use poll - int numfds = m_connectionListCount; - int idx = 0; - if (m_boundAsServer) - { - numfds++; - idx++; - } + int numfds = m_connectionListCount; + int idx = 0; + if (m_boundAsServer) + { + numfds++; + idx++; + } - struct pollfd pollfds[numfds]; + struct pollfd pollfds[numfds]; - if (m_boundAsServer) - { - pollfds[0].fd = m_socket; - pollfds[0].events |= POLLIN; - } + if (m_boundAsServer) + { + pollfds[0].fd = m_socket; + pollfds[0].events |= POLLIN; + } - TcpConnection *next = nullptr; - for (TcpConnection *con = m_connectionList ; con != nullptr ; con = next, idx++) - { - next = con->m_nextConnection; - pollfds[idx].fd = con->m_socket; - pollfds[idx].events |= POLLIN; - pollfds[idx].events |= POLLHUP; - } - + TcpConnection *next = nullptr; + for (TcpConnection *con = m_connectionList; con != nullptr; con = next, idx++) + { + next = con->m_nextConnection; + pollfds[idx].fd = con->m_socket; + pollfds[idx].events |= POLLIN; + pollfds[idx].events |= POLLHUP; + } - int cnt = poll(pollfds, numfds, 1); + int cnt = poll(pollfds, numfds, 1); - if(cnt == SOCKET_ERROR) - { - //poll not working? - //TODO: need to notify client somehow, don't think we can assume a fatal error here - } - else if (cnt > 0) - { - for (idx = 0; idx < numfds; idx++) - { - //find corresponding TcpConnection - //TODO: optimize, seriously, this is takes linear time, every time - TcpConnection *con = getConnection(pollfds[idx].fd); + if (cnt == SOCKET_ERROR) + { + //poll not working? + //TODO: need to notify client somehow, don't think we can assume a fatal error here + } + else if (cnt > 0) + { + for (idx = 0; idx < numfds; idx++) + { + //find corresponding TcpConnection + //TODO: optimize, seriously, this is takes linear time, every time + TcpConnection *con = getConnection(pollfds[idx].fd); - if (pollfds[idx].revents & POLLIN) - { - if (m_boundAsServer && maxTimeAcceptingConnections != 0 && pollfds[idx].fd == m_socket) - { - //new incoming clients - Clock timer; - timer.start(); - while (acceptClient() && !timer.isDone(maxTimeAcceptingConnections)) - { - //loop - } + if (pollfds[idx].revents & POLLIN) + { + if (m_boundAsServer && maxTimeAcceptingConnections != 0 && pollfds[idx].fd == m_socket) + { + //new incoming clients + Clock timer; + timer.start(); + while (acceptClient() && !timer.isDone(maxTimeAcceptingConnections)) + { + //loop + } - continue;//don't try to readmsgs from listening fd - } - - //process regular msg(s) - if (con == nullptr) - { - close(pollfds[idx].fd); - continue; - } + continue;//don't try to readmsgs from listening fd + } - Clock timer; - timer.start(); - con->AddRef();//so it can't get deleted while we are checking it's status - while(!timer.isDone(maxRecvTimePerConnection) && con->GetStatus() == TcpConnection::StatusConnected) - { - int err = con->processIncoming(); - if (err >= 0) - { - processedIncoming = true; - } + //process regular msg(s) + if (con == nullptr) + { + close(pollfds[idx].fd); + continue; + } - if (err > 0) - { - //couldn't finish processing last request, don't try more - break; - } - else if (err < 0) - { - break; - } + Clock timer; + timer.start(); + con->AddRef();//so it can't get deleted while we are checking it's status + while (!timer.isDone(maxRecvTimePerConnection) && con->GetStatus() == TcpConnection::StatusConnected) + { + int err = con->processIncoming(); + if (err >= 0) + { + processedIncoming = true; + } - }//while(!timer....) - con->Release(); - }//if(pollfds[... - else if (pollfds[idx].revents & POLLHUP) - { - if (con == nullptr) - { - close(pollfds[idx].fd); - continue; - } + if (err > 0) + { + //couldn't finish processing last request, don't try more + break; + } + else if (err < 0) + { + break; + } + }//while(!timer....) + con->Release(); + }//if(pollfds[... + else if (pollfds[idx].revents & POLLHUP) + { + if (con == nullptr) + { + close(pollfds[idx].fd); + continue; + } - //Disconnect client - con->Disconnect(); - } - }//for (idx=0.... - }//else if (cnt > 0) + //Disconnect client + con->Disconnect(); + } + }//for (idx=0.... + }//else if (cnt > 0) #endif - }//wanted to process incoming messages or connect requests + }//wanted to process incoming messages or connect requests - //now process any keepalives, if time to do that - if (m_params.keepAliveDelay > 0 && m_keepAliveTimer.isDone(m_params.keepAliveDelay)) - { - TcpConnection *next = nullptr; - for (TcpConnection *con = m_keepAliveList.m_beginList ; con != nullptr ; con = next) - { - con->AddRef(); - if (next) next->Release(); - next = con->m_nextKeepAliveConnection; - if (next) next->AddRef(); - - con->Send(nullptr, 0); //note: this request will move the connection from the keepAliveList to the aliveList - con->Release(); - } + //now process any keepalives, if time to do that + if (m_params.keepAliveDelay > 0 && m_keepAliveTimer.isDone(m_params.keepAliveDelay)) + { + TcpConnection *next = nullptr; + for (TcpConnection *con = m_keepAliveList.m_beginList; con != nullptr; con = next) + { + con->AddRef(); + if (next) next->Release(); + next = con->m_nextKeepAliveConnection; + if (next) next->AddRef(); - //now move the complete alive list over to the keepalive list to reset those timers - m_keepAliveList.m_beginList = m_aliveList.m_beginList; - m_aliveList.m_beginList = nullptr; + con->Send(nullptr, 0); //note: this request will move the connection from the keepAliveList to the aliveList + con->Release(); + } - //switch id's for those connections that were in the alive list last go - around - int tmpID = m_aliveList.m_listID; - m_aliveList.m_listID = m_keepAliveList.m_listID; - m_keepAliveList.m_listID = tmpID; + //now move the complete alive list over to the keepalive list to reset those timers + m_keepAliveList.m_beginList = m_aliveList.m_beginList; + m_aliveList.m_beginList = nullptr; - m_keepAliveTimer.reset(); - m_keepAliveTimer.start(); - } + //switch id's for those connections that were in the alive list last go - around + int tmpID = m_aliveList.m_listID; + m_aliveList.m_listID = m_keepAliveList.m_listID; + m_keepAliveList.m_listID = tmpID; - //now process any noDataCons, if time to do that - if (m_params.noDataTimeout > 0 && m_noDataTimer.isDone(m_params.noDataTimeout)) - { - TcpConnection *next = nullptr; - for (TcpConnection *con = m_noDataList.m_beginList ; con != nullptr ; con = next) - { - con->AddRef(); - if (next) next->Release(); - next = con->m_nextRecvDataConnection; - if (next) next->AddRef(); + m_keepAliveTimer.reset(); + m_keepAliveTimer.start(); + } - //time to disconnect this guy - con->Disconnect(); - con->Release(); - } + //now process any noDataCons, if time to do that + if (m_params.noDataTimeout > 0 && m_noDataTimer.isDone(m_params.noDataTimeout)) + { + TcpConnection *next = nullptr; + for (TcpConnection *con = m_noDataList.m_beginList; con != nullptr; con = next) + { + con->AddRef(); + if (next) next->Release(); + next = con->m_nextRecvDataConnection; + if (next) next->AddRef(); - //now move the complete data list over to the nodata list to reset those timers - m_noDataList.m_beginList = m_dataList.m_beginList; - m_dataList.m_beginList = nullptr; + //time to disconnect this guy + con->Disconnect(); + con->Release(); + } - //switch id's for those connections that were in the data list last go - around - int tmpID = m_dataList.m_listID; - m_dataList.m_listID = m_noDataList.m_listID; - m_noDataList.m_listID = tmpID; + //now move the complete data list over to the nodata list to reset those timers + m_noDataList.m_beginList = m_dataList.m_beginList; + m_dataList.m_beginList = nullptr; - m_noDataTimer.reset(); - m_noDataTimer.start(); - } + //switch id's for those connections that were in the data list last go - around + int tmpID = m_dataList.m_listID; + m_dataList.m_listID = m_noDataList.m_listID; + m_noDataList.m_listID = tmpID; - Release(); + m_noDataTimer.reset(); + m_noDataTimer.start(); + } - return processedIncoming; -} + Release(); -TcpConnection *TcpManager::EstablishConnection(const char *serverAddress, unsigned short serverPort, unsigned timeout) -{ - if (m_boundAsServer) - { - //can't open outgoing connections when in server mode - // use a different TcpManager to do that - return nullptr; - } + return processedIncoming; + } - if (m_connectionListCount >= m_params.maxConnections) - return(nullptr); + TcpConnection *TcpManager::EstablishConnection(const char *serverAddress, unsigned short serverPort, unsigned timeout) + { + if (m_boundAsServer) + { + //can't open outgoing connections when in server mode + // use a different TcpManager to do that + return nullptr; + } - // get server address - unsigned long address = inet_addr(serverAddress); - if (address == INADDR_NONE) - { - struct hostent * lphp; - lphp = gethostbyname(serverAddress); - if (lphp == nullptr) - return(nullptr); - address = ((struct in_addr *)(lphp->h_addr))->s_addr; - } - IPAddress destIP(address); + if (m_connectionListCount >= m_params.maxConnections) + return(nullptr); - TcpConnection *con = new TcpConnection(this, &m_allocator, m_params, destIP, serverPort, timeout); - con->AddRef();//for the client - to conform to UdpLibrary method - addNewConnection(con); + // get server address + unsigned long address = inet_addr(serverAddress); + if (address == INADDR_NONE) + { + struct hostent * lphp; + lphp = gethostbyname(serverAddress); + if (lphp == nullptr) + return(nullptr); + address = ((struct in_addr *)(lphp->h_addr))->s_addr; + } + IPAddress destIP(address); - return con; -} + TcpConnection *con = new TcpConnection(this, &m_allocator, m_params, destIP, serverPort, timeout); + con->AddRef();//for the client - to conform to UdpLibrary method + addNewConnection(con); -void TcpManager::addNewConnection(TcpConnection *con) -{ - con->AddRef(); + return con; + } + + void TcpManager::addNewConnection(TcpConnection *con) + { + con->AddRef(); #ifdef WIN32 //uses select - if (con->m_socket != INVALID_SOCKET) - FD_SET(con->m_socket, &m_permfds); + if (con->m_socket != INVALID_SOCKET) + FD_SET(con->m_socket, &m_permfds); #endif - con->m_nextConnection = m_connectionList; - con->m_prevConnection = nullptr; - if (m_connectionList != nullptr) - m_connectionList->m_prevConnection = con; - m_connectionList = con; - m_connectionListCount++; + con->m_nextConnection = m_connectionList; + con->m_prevConnection = nullptr; + if (m_connectionList != nullptr) + m_connectionList->m_prevConnection = con; + m_connectionList = con; + m_connectionListCount++; - con->m_nextKeepAliveConnection = m_aliveList.m_beginList; - con->m_prevKeepAliveConnection = nullptr; - if (m_aliveList.m_beginList != nullptr) - m_aliveList.m_beginList->m_prevKeepAliveConnection = con; - m_aliveList.m_beginList = con; - con->m_aliveListId = m_keepAliveList.m_listID;//start it out thinking it's already in the alive list, since it is + con->m_nextKeepAliveConnection = m_aliveList.m_beginList; + con->m_prevKeepAliveConnection = nullptr; + if (m_aliveList.m_beginList != nullptr) + m_aliveList.m_beginList->m_prevKeepAliveConnection = con; + m_aliveList.m_beginList = con; + con->m_aliveListId = m_keepAliveList.m_listID;//start it out thinking it's already in the alive list, since it is - con->m_nextRecvDataConnection = m_dataList.m_beginList; - con->m_prevRecvDataConnection = nullptr; - if (m_dataList.m_beginList != nullptr) - m_dataList.m_beginList->m_prevRecvDataConnection = con; - m_dataList.m_beginList = con; - con->m_recvDataListId = m_noDataList.m_listID;//start it out thinking it's already in the data list, since it is -} + con->m_nextRecvDataConnection = m_dataList.m_beginList; + con->m_prevRecvDataConnection = nullptr; + if (m_dataList.m_beginList != nullptr) + m_dataList.m_beginList->m_prevRecvDataConnection = con; + m_dataList.m_beginList = con; + con->m_recvDataListId = m_noDataList.m_listID;//start it out thinking it's already in the data list, since it is + } -void TcpManager::removeConnection(TcpConnection *con) -{ - if (!con->wasRemovedFromMgr()) - { - con->setRemovedFromMgr(); - m_connectionListCount--; - #ifdef WIN32 //select only used on win32 - if (con->m_socket != INVALID_SOCKET) - { - FD_CLR(con->m_socket, &m_permfds); - } - #endif - if (con->m_prevConnection != nullptr) - con->m_prevConnection->m_nextConnection = con->m_nextConnection; - if (con->m_nextConnection != nullptr) - con->m_nextConnection->m_prevConnection = con->m_prevConnection; - if (m_connectionList == con) - m_connectionList = con->m_nextConnection; - con->m_nextConnection = nullptr; - con->m_prevConnection = nullptr; + void TcpManager::removeConnection(TcpConnection *con) + { + if (!con->wasRemovedFromMgr()) + { + con->setRemovedFromMgr(); + m_connectionListCount--; +#ifdef WIN32 //select only used on win32 + if (con->m_socket != INVALID_SOCKET) + { + FD_CLR(con->m_socket, &m_permfds); + } +#endif + if (con->m_prevConnection != nullptr) + con->m_prevConnection->m_nextConnection = con->m_nextConnection; + if (con->m_nextConnection != nullptr) + con->m_nextConnection->m_prevConnection = con->m_prevConnection; + if (m_connectionList == con) + m_connectionList = con->m_nextConnection; + con->m_nextConnection = nullptr; + con->m_prevConnection = nullptr; - if (con->m_prevKeepAliveConnection != nullptr) - con->m_prevKeepAliveConnection->m_nextKeepAliveConnection = con->m_nextKeepAliveConnection; - if (con->m_nextKeepAliveConnection != nullptr) - con->m_nextKeepAliveConnection->m_prevKeepAliveConnection = con->m_prevKeepAliveConnection; + if (con->m_prevKeepAliveConnection != nullptr) + con->m_prevKeepAliveConnection->m_nextKeepAliveConnection = con->m_nextKeepAliveConnection; + if (con->m_nextKeepAliveConnection != nullptr) + con->m_nextKeepAliveConnection->m_prevKeepAliveConnection = con->m_prevKeepAliveConnection; - if (m_aliveList.m_beginList == con) - m_aliveList.m_beginList = con->m_nextKeepAliveConnection; - else if (m_keepAliveList.m_beginList == con) - m_keepAliveList.m_beginList = con->m_nextKeepAliveConnection; - con->m_nextKeepAliveConnection = nullptr; - con->m_prevKeepAliveConnection = nullptr; + if (m_aliveList.m_beginList == con) + m_aliveList.m_beginList = con->m_nextKeepAliveConnection; + else if (m_keepAliveList.m_beginList == con) + m_keepAliveList.m_beginList = con->m_nextKeepAliveConnection; + con->m_nextKeepAliveConnection = nullptr; + con->m_prevKeepAliveConnection = nullptr; + if (con->m_prevRecvDataConnection != nullptr) + con->m_prevRecvDataConnection->m_nextRecvDataConnection = con->m_nextRecvDataConnection; + if (con->m_nextRecvDataConnection != nullptr) + con->m_nextRecvDataConnection->m_prevRecvDataConnection = con->m_prevRecvDataConnection; + if (m_dataList.m_beginList == con) + m_dataList.m_beginList = con->m_nextRecvDataConnection; + else if (m_noDataList.m_beginList == con) + m_noDataList.m_beginList = con->m_nextRecvDataConnection; + con->m_nextRecvDataConnection = nullptr; + con->m_prevRecvDataConnection = nullptr; - if (con->m_prevRecvDataConnection != nullptr) - con->m_prevRecvDataConnection->m_nextRecvDataConnection = con->m_nextRecvDataConnection; - if (con->m_nextRecvDataConnection != nullptr) - con->m_nextRecvDataConnection->m_prevRecvDataConnection = con->m_prevRecvDataConnection; + con->Release(); + } + } - if (m_dataList.m_beginList == con) - m_dataList.m_beginList = con->m_nextRecvDataConnection; - else if (m_noDataList.m_beginList == con) - m_noDataList.m_beginList = con->m_nextRecvDataConnection; - con->m_nextRecvDataConnection = nullptr; - con->m_prevRecvDataConnection = nullptr; + void TcpManager::AddRef() + { + m_refCount++; + } + void TcpManager::Release() + { + if (--m_refCount == 0) + delete this; + } + IPAddress TcpManager::GetLocalIp() const + { + struct sockaddr_in addr_self; + memset(&addr_self, 0, sizeof(addr_self)); + socklen_t len = sizeof(addr_self); + getsockname(m_socket, (struct sockaddr *)&addr_self, &len); + return(IPAddress(addr_self.sin_addr.s_addr)); + } - con->Release(); - } -} - -void TcpManager::AddRef() -{ - m_refCount++; -} - -void TcpManager::Release() -{ - if (--m_refCount == 0) - delete this; -} - -IPAddress TcpManager::GetLocalIp() const -{ - struct sockaddr_in addr_self; - memset(&addr_self, 0, sizeof(addr_self)); - socklen_t len = sizeof(addr_self); - getsockname(m_socket, (struct sockaddr *)&addr_self, &len); - return(IPAddress(addr_self.sin_addr.s_addr)); - -} - -unsigned int TcpManager::GetLocalPort() const -{ - struct sockaddr_in addr_self; - memset(&addr_self, 0, sizeof(addr_self)); - socklen_t len = sizeof(addr_self); - getsockname(m_socket, (struct sockaddr *)&addr_self, &len); - return(ntohs(addr_self.sin_port)); -} - + unsigned int TcpManager::GetLocalPort() const + { + struct sockaddr_in addr_self; + memset(&addr_self, 0, sizeof(addr_self)); + socklen_t len = sizeof(addr_self); + getsockname(m_socket, (struct sockaddr *)&addr_self, &len); + return(ntohs(addr_self.sin_port)); + } #ifdef EXTERNAL_DISTRO }; -#endif - - +#endif \ No newline at end of file diff --git a/external/ours/library/crypto/src/shared/original/queue.cpp b/external/ours/library/crypto/src/shared/original/queue.cpp index 9ce378de..590b8899 100755 --- a/external/ours/library/crypto/src/shared/original/queue.cpp +++ b/external/ours/library/crypto/src/shared/original/queue.cpp @@ -17,16 +17,16 @@ public: next = 0; } - inline unsigned int MaxSize() const {return buf.size;} + inline unsigned int MaxSize() const { return buf.size; } inline unsigned int CurrentSize() const { - return m_tail-m_head; + return m_tail - m_head; } inline bool UsedUp() const { - return (m_head==MaxSize()); + return (m_head == MaxSize()); } inline void Clear() @@ -36,48 +36,48 @@ public: inline unsigned int Put(byte inByte) { - if (MaxSize()==m_tail) + if (MaxSize() == m_tail) return 0; - buf[m_tail++]=inByte; + buf[m_tail++] = inByte; return 1; } inline unsigned int Put(const byte *inString, unsigned int length) { - unsigned int l = STDMIN(length, MaxSize()-m_tail); - memcpy(buf+m_tail, inString, l); + unsigned int l = STDMIN(length, MaxSize() - m_tail); + memcpy(buf + m_tail, inString, l); m_tail += l; return l; } inline unsigned int Peek(byte &outByte) const { - if (m_tail==m_head) + if (m_tail == m_head) return 0; - outByte=buf[m_head]; + outByte = buf[m_head]; return 1; } inline unsigned int Peek(byte *target, unsigned int copyMax) const { - unsigned int len = STDMIN(copyMax, m_tail-m_head); - memcpy(target, buf+m_head, len); + unsigned int len = STDMIN(copyMax, m_tail - m_head); + memcpy(target, buf + m_head, len); return len; } inline unsigned int CopyTo(BufferedTransformation &target) const { - unsigned int len = m_tail-m_head; - target.Put(buf+m_head, len); + unsigned int len = m_tail - m_head; + target.Put(buf + m_head, len); return len; } inline unsigned int CopyTo(BufferedTransformation &target, unsigned int copyMax) const { - unsigned int len = STDMIN(copyMax, m_tail-m_head); - target.Put(buf+m_head, len); + unsigned int len = STDMIN(copyMax, m_tail - m_head); + target.Put(buf + m_head, len); return len; } @@ -111,14 +111,14 @@ public: inline unsigned int Skip(unsigned int skipMax) { - unsigned int len = STDMIN(skipMax, m_tail-m_head); + unsigned int len = STDMIN(skipMax, m_tail - m_head); m_head += len; return len; } inline byte operator[](unsigned int i) const { - return buf[m_head+i]; + return buf[m_head + i]; } ByteQueueNode *next; @@ -130,7 +130,7 @@ public: // ******************************************************** ByteQueue::ByteQueue(unsigned int m_nodeSize) - : m_nodeSize(0), m_lazyLength(0) + : m_nodeSize(0), m_lazyLength(0), m_lazyString(nullptr) { m_head = m_tail = new ByteQueueNode(m_nodeSize); } @@ -146,7 +146,7 @@ void ByteQueue::CopyFrom(const ByteQueue ©) m_nodeSize = copy.m_nodeSize; m_head = m_tail = new ByteQueueNode(*copy.m_head); - for (ByteQueueNode *current=copy.m_head->next; current; current=current->next) + for (ByteQueueNode *current = copy.m_head->next; current; current = current->next) { m_tail->next = new ByteQueueNode(*current); m_tail = m_tail->next; @@ -166,18 +166,18 @@ void ByteQueue::Destroy() { ByteQueueNode *next; - for (ByteQueueNode *current=m_head; current; current=next) + for (ByteQueueNode *current = m_head; current; current = next) { - next=current->next; + next = current->next; delete current; } } unsigned long ByteQueue::CurrentSize() const { - unsigned long size=0; + unsigned long size = 0; - for (ByteQueueNode *current=m_head; current; current=current->next) + for (ByteQueueNode *current = m_head; current; current = current->next) size += current->CurrentSize(); return size + m_lazyLength; @@ -185,7 +185,7 @@ unsigned long ByteQueue::CurrentSize() const bool ByteQueue::IsEmpty() const { - return m_head==m_tail && m_head->CurrentSize()==0 && m_lazyLength==0; + return m_head == m_tail && m_head->CurrentSize() == 0 && m_lazyLength == 0; } void ByteQueue::Clear() @@ -214,7 +214,7 @@ void ByteQueue::Put(const byte *inString, unsigned int length) FinalizeLazyPut(); unsigned int len; - while ((len=m_tail->Put(inString, length)) < length) + while ((len = m_tail->Put(inString, length)) < length) { m_tail->next = new ByteQueueNode(m_nodeSize); m_tail = m_tail->next; @@ -227,8 +227,8 @@ void ByteQueue::CleanupUsedNodes() { while (m_head != m_tail && m_head->UsedUp()) { - ByteQueueNode *temp=m_head; - m_head=m_head->next; + ByteQueueNode *temp = m_head; + m_head = m_head->next; delete temp; } @@ -302,7 +302,7 @@ unsigned long ByteQueue::Skip(unsigned long skipMax) unsigned long ByteQueue::TransferTo(BufferedTransformation &target, unsigned long transferMax) { unsigned long bytesLeft = transferMax; - for (ByteQueueNode *current=m_head; bytesLeft && current; current=current->next) + for (ByteQueueNode *current = m_head; bytesLeft && current; current = current->next) bytesLeft -= current->TransferTo(target, bytesLeft); CleanupUsedNodes(); @@ -320,7 +320,7 @@ unsigned long ByteQueue::TransferTo(BufferedTransformation &target, unsigned lon unsigned long ByteQueue::CopyTo(BufferedTransformation &target, unsigned long copyMax) const { unsigned long bytesLeft = copyMax; - for (ByteQueueNode *current=m_head; bytesLeft && current; current=current->next) + for (ByteQueueNode *current = m_head; bytesLeft && current; current = current->next) bytesLeft -= current->CopyTo(target, bytesLeft); if (bytesLeft && m_lazyLength) { @@ -409,11 +409,11 @@ bool ByteQueue::operator==(const ByteQueue &rhs) const byte ByteQueue::operator[](unsigned long i) const { - for (ByteQueueNode *current=m_head; current; current=current->next) + for (ByteQueueNode *current = m_head; current; current = current->next) { if (i < current->CurrentSize()) return (*current)[i]; - + i -= current->CurrentSize(); } @@ -461,8 +461,8 @@ unsigned long ByteQueue::Walker::TransferTo(BufferedTransformation &target, unsi unsigned long bytesLeft = transferMax; while (m_node) { - unsigned int len = STDMIN(bytesLeft, (unsigned long)m_node->CurrentSize()-m_offset); - target.Put(m_node->buf+m_node->m_head+m_offset, len); + unsigned int len = STDMIN(bytesLeft, (unsigned long)m_node->CurrentSize() - m_offset); + target.Put(m_node->buf + m_node->m_head + m_offset, len); m_position += len; bytesLeft -= len; @@ -497,4 +497,4 @@ unsigned long ByteQueue::Walker::CopyTo(BufferedTransformation &target, unsigned return Walker(*this).TransferTo(target, copyMax); } -NAMESPACE_END +NAMESPACE_END \ No newline at end of file diff --git a/external/ours/library/localization/src/shared/LocalizedStringTableReaderWriter.cpp b/external/ours/library/localization/src/shared/LocalizedStringTableReaderWriter.cpp index e7dfbf27..91ea3b7e 100755 --- a/external/ours/library/localization/src/shared/LocalizedStringTableReaderWriter.cpp +++ b/external/ours/library/localization/src/shared/LocalizedStringTableReaderWriter.cpp @@ -20,64 +20,64 @@ namespace LocalizedStringTableReaderWriterNamespace { - void unfubarMicrosoftInvalidTextCharacters (Unicode::String & str) + void unfubarMicrosoftInvalidTextCharacters(Unicode::String & str) { typedef std::pair FubarCharacterInfo; typedef std::pair FubarStringInfo; - static const FubarCharacterInfo FubarCharactersCourtesyMicrosoft [] = + static const FubarCharacterInfo FubarCharactersCourtesyMicrosoft[] = { - FubarCharacterInfo (139, '<'), - FubarCharacterInfo (155, '>'), + FubarCharacterInfo(139, '<'), + FubarCharacterInfo(155, '>'), - FubarCharacterInfo (8216, '\''), - FubarCharacterInfo (8217, '\''), - FubarCharacterInfo (8221, '"'), - FubarCharacterInfo (8220, '"'), - FubarCharacterInfo (149, '-'), - FubarCharacterInfo (150, '-'), - FubarCharacterInfo (151, '-'), - FubarCharacterInfo (152, '~') + FubarCharacterInfo(8216, '\''), + FubarCharacterInfo(8217, '\''), + FubarCharacterInfo(8221, '"'), + FubarCharacterInfo(8220, '"'), + FubarCharacterInfo(149, '-'), + FubarCharacterInfo(150, '-'), + FubarCharacterInfo(151, '-'), + FubarCharacterInfo(152, '~') }; - - static const int FubarCharactersCourtesyMicrosoftLength = sizeof (FubarCharactersCourtesyMicrosoft) / sizeof (FubarCharactersCourtesyMicrosoft[0]); - - static const FubarStringInfo FubarStringsCourtesyMicrosoft [] = + + static const int FubarCharactersCourtesyMicrosoftLength = sizeof(FubarCharactersCourtesyMicrosoft) / sizeof(FubarCharactersCourtesyMicrosoft[0]); + + static const FubarStringInfo FubarStringsCourtesyMicrosoft[] = { - FubarStringInfo (133, Unicode::narrowToWide ("...")), - //-- carriage return - FubarStringInfo (13, Unicode::narrowToWide ("")) + FubarStringInfo(133, Unicode::narrowToWide("...")), + //-- carriage return + FubarStringInfo(13, Unicode::narrowToWide("")) }; - - static const int FubarStringsCourtesyMicrosoftLength = sizeof (FubarStringsCourtesyMicrosoft) / sizeof (FubarStringsCourtesyMicrosoft[0]); - + + static const int FubarStringsCourtesyMicrosoftLength = sizeof(FubarStringsCourtesyMicrosoft) / sizeof(FubarStringsCourtesyMicrosoft[0]); + { for (int i = 0; i < FubarCharactersCourtesyMicrosoftLength; ++i) { - const Unicode::unicode_char_t correctCharacter = FubarCharactersCourtesyMicrosoft [i].second; - const Unicode::unicode_char_t fubarCharacter = FubarCharactersCourtesyMicrosoft [i].first; - + const Unicode::unicode_char_t correctCharacter = FubarCharactersCourtesyMicrosoft[i].second; + const Unicode::unicode_char_t fubarCharacter = FubarCharactersCourtesyMicrosoft[i].first; + size_t pos = 0; - while ((pos = str.find (fubarCharacter, pos)) != Unicode::String::npos) + while ((pos = str.find(fubarCharacter, pos)) != Unicode::String::npos) { - str [pos] = correctCharacter; + str[pos] = correctCharacter; ++pos; } } } - + { for (int i = 0; i < FubarStringsCourtesyMicrosoftLength; ++i) { - const Unicode::unicode_char_t fubarCharacter = FubarStringsCourtesyMicrosoft [i].first; - const Unicode::String & correctString = FubarStringsCourtesyMicrosoft [i].second; - + const Unicode::unicode_char_t fubarCharacter = FubarStringsCourtesyMicrosoft[i].first; + const Unicode::String & correctString = FubarStringsCourtesyMicrosoft[i].second; + size_t pos = 0; - - while ((pos = str.find (fubarCharacter, pos)) != Unicode::String::npos) + + while ((pos = str.find(fubarCharacter, pos)) != Unicode::String::npos) { - str.replace (pos, 1, correctString); - pos += correctString.size (); + str.replace(pos, 1, correctString); + pos += correctString.size(); } } } @@ -88,20 +88,18 @@ using namespace LocalizedStringTableReaderWriterNamespace; //----------------------------------------------------------------- -LocalizedStringTableRW::LocalizedStringTableRW (const Unicode::NarrowString & filename) : -LocalizedStringTable (filename), -m_idNameMap () +LocalizedStringTableRW::LocalizedStringTableRW(const Unicode::NarrowString & filename) : + LocalizedStringTable(filename), + m_idNameMap() { - } //----------------------------------------------------------------- -LocalizedStringTableRW::LocalizedStringTableRW (const LocalizedStringTable & rhs) : -LocalizedStringTable (rhs), -m_idNameMap () +LocalizedStringTableRW::LocalizedStringTableRW(const LocalizedStringTable & rhs) : + LocalizedStringTable(rhs), + m_idNameMap() { - } //----------------------------------------------------------------- @@ -112,26 +110,26 @@ bool LocalizedStringTableRW::str_write(AbstractFile & fl, LocalizedString & locs LocalizedString::id_type id = locstr.m_id; LocalizedString::crc_type crcSource = locstr.m_sourceCrc; - LocalizedString::id_type buflen = locstr.m_str.length (); + LocalizedString::id_type buflen = locstr.m_str.length(); - if (!fl.write (sizeof (LocalizedString::id_type), &id)) + if (!fl.write(sizeof(LocalizedString::id_type), &id)) return false; - if (!fl.write (sizeof (LocalizedString::crc_type), &crcSource)) + if (!fl.write(sizeof(LocalizedString::crc_type), &crcSource)) return false; - if (!fl.write (sizeof (LocalizedString::id_type), &buflen)) + if (!fl.write(sizeof(LocalizedString::id_type), &buflen)) return false; // TODO: swab this buffer - Unicode::unicode_char_t * buf = new Unicode::unicode_char_t [buflen+1]; + Unicode::unicode_char_t * buf = new Unicode::unicode_char_t[buflen + 1]; - assert (buf != nullptr); //lint !e1924 // c-style cast. MSVC bug + assert(buf != nullptr); //lint !e1924 // c-style cast. MSVC bug - buf [buflen] = 0; - memcpy (buf, locstr.m_str.c_str (), sizeof (Unicode::unicode_char_t) * buflen); + buf[buflen] = 0; + memcpy(buf, locstr.m_str.c_str(), sizeof(Unicode::unicode_char_t) * buflen); - if (buflen && !fl.write (buflen * sizeof (Unicode::unicode_char_t), buf)) + if (buflen && !fl.write(buflen * sizeof(Unicode::unicode_char_t), buf)) { delete[] buf; return false; @@ -148,48 +146,47 @@ bool LocalizedStringTableRW::write(AbstractFile & fl) const { // TODO: swab these values on big endian systems LocalizedString::id_type next_unique = m_nextUniqueId; - LocalizedString::id_type num_entries = m_map.size (); - - if (!fl.write (sizeof (LocalizedString::id_type), &next_unique)) + LocalizedString::id_type num_entries = m_map.size(); + + if (!fl.write(sizeof(LocalizedString::id_type), &next_unique)) return false; - - if (!fl.write (sizeof (LocalizedString::id_type), &num_entries)) + + if (!fl.write(sizeof(LocalizedString::id_type), &num_entries)) return false; // write the string table - + { - for (Map_t::const_iterator iter = m_map.begin (); iter != m_map.end (); ++iter) + for (Map_t::const_iterator iter = m_map.begin(); iter != m_map.end(); ++iter) { if (str_write(fl, *((*iter).second)) == false) return false; } } - + // write the string/id map { - for (NameMap_t::const_iterator iter = m_nameMap.begin (); iter != m_nameMap.end (); ++iter) + for (NameMap_t::const_iterator iter = m_nameMap.begin(); iter != m_nameMap.end(); ++iter) { - // TODO: swab all these values on big endian systems - LocalizedString::id_type id = (*iter).second; - LocalizedString::id_type buflen = (*iter).first.length (); + LocalizedString::id_type id = (*iter).second; + LocalizedString::id_type buflen = (*iter).first.length(); - if (!fl.write (sizeof (LocalizedString::id_type), &id)) - return false; - - if (!fl.write (sizeof (LocalizedString::id_type), &buflen)) + if (!fl.write(sizeof(LocalizedString::id_type), &id)) return false; - char * buf = new char [buflen + 1]; + if (!fl.write(sizeof(LocalizedString::id_type), &buflen)) + return false; - assert (buf != nullptr); //lint !e1924 // c-style cast. MSVC bug + char * buf = new char[buflen + 1]; - buf [buflen] = 0; + assert(buf != nullptr); //lint !e1924 // c-style cast. MSVC bug - memcpy (buf, (*iter).first.c_str (), buflen); + buf[buflen] = 0; - if (buflen && !fl.write (sizeof (char) * buflen, buf)) + memcpy(buf, (*iter).first.c_str(), buflen); + + if (buflen && !fl.write(sizeof(char) * buflen, buf)) { delete[] buf; buf = 0; @@ -204,75 +201,73 @@ bool LocalizedStringTableRW::write(AbstractFile & fl) const return true; } - // ---------------------------------------------------------------------- /** */ -LocalizedStringTableRW *LocalizedStringTableRW::loadRW (AbstractFileFactory & fileFactory, const Unicode::NarrowString & filename) +LocalizedStringTableRW *LocalizedStringTableRW::loadRW(AbstractFileFactory & fileFactory, const Unicode::NarrowString & filename) { char version = -1; - - AbstractFile * const fl = openLoadFile (fileFactory, filename, version); - + + AbstractFile * const fl = openLoadFile(fileFactory, filename, version); + if (fl == 0) return 0; - - LocalizedStringTableRW * table = 0; - if (!fl->isOpen ()) + LocalizedStringTableRW * table = nullptr; + + if (!fl->isOpen()) { - } else { switch (version) { case 0: - table = new LocalizedStringTableRW (filename); - assert (table != nullptr); //lint !e1924 // c-style cast. MSVC bug - - if (table->load_0000 (*fl) == false) + table = new LocalizedStringTableRW(filename); + assert(table != nullptr); //lint !e1924 // c-style cast. MSVC bug + + if (table->load_0000(*fl) == false) { delete table; - table = 0; + table = nullptr; } break; case 1: - table = new LocalizedStringTableRW (filename); - assert (table != nullptr); //lint !e1924 // c-style cast. MSVC bug - - if (table->load_0001 (*fl) == false) + table = new LocalizedStringTableRW(filename); + assert(table != nullptr); //lint !e1924 // c-style cast. MSVC bug + + if (table->load_0001(*fl) == false) { delete table; - table = 0; + table = nullptr; } break; default: - assert (true); //lint !e1924 // c-style cast. MSVC bug + assert(true); //lint !e1924 // c-style cast. MSVC bug break; } } - - delete fl; - - //Go through all the strings and un-microsoft-fubar them - for(Map_t::iterator mapIter = table->m_map.begin(); mapIter != table->m_map.end(); ++mapIter) - { - LocalizedString *str = (*mapIter).second; - Unicode::String & strRef = str->m_str; - LocalizedStringTableReaderWriterNamespace::unfubarMicrosoftInvalidTextCharacters(strRef); - } - // populate idNameMap + delete fl; + if (table) { - table->m_idNameMap.clear (); - - for (NameMap_t::const_iterator iter = table->m_nameMap.begin (); iter != table->m_nameMap.end (); ++iter) + //Go through all the strings and un-microsoft-fubar them + for (Map_t::iterator mapIter = table->m_map.begin(); mapIter != table->m_map.end(); ++mapIter) { - table->m_idNameMap.insert (IdNameMap_t::value_type ((*iter).second, (*iter).first)); + LocalizedString *str = (*mapIter).second; + Unicode::String & strRef = str->m_str; + LocalizedStringTableReaderWriterNamespace::unfubarMicrosoftInvalidTextCharacters(strRef); + } + + // populate idNameMap + table->m_idNameMap.clear(); + + for (NameMap_t::const_iterator iter = table->m_nameMap.begin(); iter != table->m_nameMap.end(); ++iter) + { + table->m_idNameMap.insert(IdNameMap_t::value_type((*iter).second, (*iter).first)); } } @@ -283,71 +278,71 @@ LocalizedStringTableRW *LocalizedStringTableRW::loadRW (AbstractFileFactory & fi /** */ -bool LocalizedStringTableRW::writeRW (AbstractFileFactory & fileFactory, const Unicode::NarrowString & filename) const +bool LocalizedStringTableRW::writeRW(AbstractFileFactory & fileFactory, const Unicode::NarrowString & filename) const { //Go through all the strings and un-microsoft-fubar them - for(Map_t::const_iterator mapIter = m_map.begin(); mapIter != m_map.end(); ++mapIter) + for (Map_t::const_iterator mapIter = m_map.begin(); mapIter != m_map.end(); ++mapIter) { LocalizedString *str = (*mapIter).second; Unicode::String & strRef = str->m_str; LocalizedStringTableReaderWriterNamespace::unfubarMicrosoftInvalidTextCharacters(strRef); } - - AbstractFile * const fl = fileFactory.createFile (filename.c_str (), "wb"); - + + AbstractFile * const fl = fileFactory.createFile(filename.c_str(), "wb"); + if (fl == 0) return false; - + bool retval = false; - - if (!fl->isOpen ()) + + if (!fl->isOpen()) { retval = false; } else { // TODO: swab magic if big endian - + magic_type local_magic = LocalizedStringTable::ms_MAGIC; - - if (!fl->write (sizeof (magic_type), &local_magic)) + + if (!fl->write(sizeof(magic_type), &local_magic)) { delete fl; return false; } - + char currentVersion = LocalizedStringTable::getCurrentVersion(); - if (!fl->write(sizeof (char), ¤tVersion)) + if (!fl->write(sizeof(char), ¤tVersion)) { delete fl; return false; } - + retval = write(*fl); } - - delete fl; + + delete fl; return retval; } //----------------------------------------------------------------- -LocalizedString * LocalizedStringTableRW::addString (const Unicode::String & str, Unicode::NarrowString & theNameResult) +LocalizedString * LocalizedStringTableRW::addString(const Unicode::String & str, Unicode::NarrowString & theNameResult) { - LocalizedString * const locstr = (m_map [m_nextUniqueId] = new LocalizedString (m_nextUniqueId, int(time(0)), str)); + LocalizedString * const locstr = (m_map[m_nextUniqueId] = new LocalizedString(m_nextUniqueId, int(time(0)), str)); - assert (locstr != nullptr); //lint !e1924 // c-style cast. MSVC bug + assert(locstr != nullptr); //lint !e1924 // c-style cast. MSVC bug char buf[64]; - sprintf (buf, "%03ld_default", m_nextUniqueId); + sprintf(buf, "%03ld_default", m_nextUniqueId); Unicode::NarrowString name(buf); - const std::pair retval = m_nameMap.insert (NameMap_t::value_type (name, m_nextUniqueId)); + const std::pair retval = m_nameMap.insert(NameMap_t::value_type(name, m_nextUniqueId)); - assert (retval.second == true); //lint !e1924 // c-style cast. MSVC bug - - m_idNameMap [locstr->getId ()] = name; + assert(retval.second == true); //lint !e1924 // c-style cast. MSVC bug + + m_idNameMap[locstr->getId()] = name; theNameResult = name; @@ -358,197 +353,193 @@ LocalizedString * LocalizedStringTableRW::addString (const Unicode::String & st //----------------------------------------------------------------- -LocalizedString * LocalizedStringTableRW::addString (LocalizedString * locstr, const Unicode::NarrowString & name, std::string & resultStr) +LocalizedString * LocalizedStringTableRW::addString(LocalizedString * locstr, const Unicode::NarrowString & name, std::string & resultStr) { - char buf [1024]; - const size_t id = locstr->getId (); - + char buf[1024]; + const size_t id = locstr->getId(); + { - Map_t::const_iterator it = m_map.find (id); - if (it != m_map.end ()) + Map_t::const_iterator it = m_map.find(id); + if (it != m_map.end()) { - const std::string * old_name = getNameById (id); + const std::string * old_name = getNameById(id); const LocalizedString * old_locstr = (*it).second; - const std::string old_str = old_locstr ? Unicode::wideToNarrow (old_locstr->getString ()) : std::string (); - - sprintf (buf, + const std::string old_str = old_locstr ? Unicode::wideToNarrow(old_locstr->getString()) : std::string(); + + sprintf(buf, "LocalizedStringTableRW::addString failed inserting duplicate id [%d]\n" "Existing string name=[%s], str=[%s]\n", - id, - old_name ? old_name->c_str () : "", - old_str.c_str ()); + id, + old_name ? old_name->c_str() : "", + old_str.c_str()); resultStr += buf; return 0; } } { - NameMap_t::const_iterator it = m_nameMap.find (name); - if (it != m_nameMap.end ()) + NameMap_t::const_iterator it = m_nameMap.find(name); + if (it != m_nameMap.end()) { - const size_t old_id = (*it).second; - const std::string * old_name = getNameById (old_id); - const LocalizedString * old_locstr = getLocalizedString (old_id); - const std::string old_str = old_locstr ? Unicode::wideToNarrow (old_locstr->getString ()) : std::string (); - - sprintf (buf, + const size_t old_id = (*it).second; + const std::string * old_name = getNameById(old_id); + const LocalizedString * old_locstr = getLocalizedString(old_id); + const std::string old_str = old_locstr ? Unicode::wideToNarrow(old_locstr->getString()) : std::string(); + + sprintf(buf, "LocalizedStringTableRW::addString failed inserting duplicate name [%s]\n" "Existing string id=[%d] name=[%s], str=[%s]\n", - name.c_str (), - id, - old_name ? old_name->c_str () : "", - old_str.c_str ()); + name.c_str(), + id, + old_name ? old_name->c_str() : "", + old_str.c_str()); resultStr += buf; return 0; } } { - IdNameMap_t::const_iterator it = m_idNameMap.find (id); - if (it != m_idNameMap.end ()) + IdNameMap_t::const_iterator it = m_idNameMap.find(id); + if (it != m_idNameMap.end()) { - const std::string & old_name = (*it).second; - const LocalizedString * old_locstr = getLocalizedString (id); - const std::string old_str = old_locstr ? Unicode::wideToNarrow (old_locstr->getString ()) : std::string (); - - sprintf (buf, + const std::string & old_name = (*it).second; + const LocalizedString * old_locstr = getLocalizedString(id); + const std::string old_str = old_locstr ? Unicode::wideToNarrow(old_locstr->getString()) : std::string(); + + sprintf(buf, "LocalizedStringTableRW::addString failed inserting duplicate name [%s]\n" "Existing string name=[%s], str=[%s]\n", - name.c_str (), - old_name.c_str (), - old_str.c_str ()); + name.c_str(), + old_name.c_str(), + old_str.c_str()); resultStr += buf; return 0; } } - m_map [id] = locstr; - m_nameMap [name] = locstr->getId (); - m_idNameMap [id] = name; + m_map[id] = locstr; + m_nameMap[name] = locstr->getId(); + m_idNameMap[id] = name; - m_nextUniqueId = std::max(m_nextUniqueId, locstr->getId () + 1); + m_nextUniqueId = std::max(m_nextUniqueId, locstr->getId() + 1); return locstr; } //---------------------------------------------------------------------- -LocalizedString * LocalizedStringTableRW::addString (LocalizedString * locstr, const Unicode::String & name, std::string & resultStr) +LocalizedString * LocalizedStringTableRW::addString(LocalizedString * locstr, const Unicode::String & name, std::string & resultStr) { - return addString (locstr, Unicode::wideToNarrow (name), resultStr); + return addString(locstr, Unicode::wideToNarrow(name), resultStr); } //----------------------------------------------------------------- -bool LocalizedStringTableRW::removeStringByName (const Unicode::NarrowString & name) +bool LocalizedStringTableRW::removeStringByName(const Unicode::NarrowString & name) { + NameMap_t::iterator find_iter_id = m_nameMap.find(name); - NameMap_t::iterator find_iter_id = m_nameMap.find (name); - - if (find_iter_id == m_nameMap.end ()) + if (find_iter_id == m_nameMap.end()) return false; const size_t id = (*find_iter_id).second; - Map_t::iterator find_iter_string = m_map.find (id); + Map_t::iterator find_iter_string = m_map.find(id); - assert (find_iter_string != m_map.end ()); //lint !e1924 // c-style cast. MSVC bug + assert(find_iter_string != m_map.end()); //lint !e1924 // c-style cast. MSVC bug - IdNameMap_t::iterator find_iter_id_map = m_idNameMap.find (id); + IdNameMap_t::iterator find_iter_id_map = m_idNameMap.find(id); - assert (find_iter_id_map != m_idNameMap.end ()); //lint !e1924 // c-style cast. MSVC bug + assert(find_iter_id_map != m_idNameMap.end()); //lint !e1924 // c-style cast. MSVC bug - m_nameMap.erase (find_iter_id); - m_map.erase (find_iter_string); - m_idNameMap.erase (find_iter_id_map); + m_nameMap.erase(find_iter_id); + m_map.erase(find_iter_string); + m_idNameMap.erase(find_iter_id_map); return true; } //----------------------------------------------------------------- -bool LocalizedStringTableRW::rename (const Unicode::NarrowString & name, const Unicode::NarrowString & newName) +bool LocalizedStringTableRW::rename(const Unicode::NarrowString & name, const Unicode::NarrowString & newName) { // if (name == newName) return false; // names that start with numerals are special - if (isdigit (newName [0])) + if (isdigit(newName[0])) return false; - - NameMap_t::iterator find_iter_id = m_nameMap.find (newName); - - // newName already exists - if (find_iter_id != m_nameMap.end ()) - { + NameMap_t::iterator find_iter_id = m_nameMap.find(newName); + + // newName already exists + if (find_iter_id != m_nameMap.end()) + { LocalizedString::id_type id = (*find_iter_id).second; - LocalizedString * locstr = getLocalizedString (id); + LocalizedString * locstr = getLocalizedString(id); static_cast(locstr); - return false; - + return false; } - - find_iter_id = m_nameMap.find (name); - + + find_iter_id = m_nameMap.find(name); + // old name does not exist - if (find_iter_id == m_nameMap.end ()) - return false; - + if (find_iter_id == m_nameMap.end()) + return false; + size_t id = (*find_iter_id).second; - - m_nameMap.erase (find_iter_id); - - const std::pair retval = m_nameMap.insert (NameMap_t::value_type (newName, id)); - - assert (retval.second == true); //lint !e1924 // c-style cast. MSVC bug - - m_idNameMap [id] = newName; - + + m_nameMap.erase(find_iter_id); + + const std::pair retval = m_nameMap.insert(NameMap_t::value_type(newName, id)); + + assert(retval.second == true); //lint !e1924 // c-style cast. MSVC bug + + m_idNameMap[id] = newName; + return retval.second == true; } //----------------------------------------------------------------- -void LocalizedStringTableRW::setName (const Unicode::NarrowString & name) +void LocalizedStringTableRW::setName(const Unicode::NarrowString & name) { m_name = name; } //----------------------------------------------------------------- -void LocalizedStringTableRW::prepareTable (const LocalizedStringTableRW & rhs) +void LocalizedStringTableRW::prepareTable(const LocalizedStringTableRW & rhs) { - m_idNameMap.clear (); - m_nameMap.clear (); - m_map.clear (); + m_idNameMap.clear(); + m_nameMap.clear(); + m_map.clear(); - m_idNameMap = rhs.m_idNameMap; - m_nameMap = rhs.m_nameMap; + m_idNameMap = rhs.m_idNameMap; + m_nameMap = rhs.m_nameMap; m_nextUniqueId = rhs.m_nextUniqueId; - m_name = rhs.m_name; + m_name = rhs.m_name; - for (Map_t::const_iterator iter = rhs.m_map.begin (); iter != rhs.m_map.end (); ++iter) + for (Map_t::const_iterator iter = rhs.m_map.begin(); iter != rhs.m_map.end(); ++iter) { const LocalizedString * rhs_locstr = (*iter).second; - LocalizedString * locstr = new LocalizedString (rhs_locstr->m_id, 0, rhs_locstr->m_str); + LocalizedString * locstr = new LocalizedString(rhs_locstr->m_id, 0, rhs_locstr->m_str); - assert (locstr != nullptr); //lint !e1924 // c-style cast. MSVC bug - m_map.insert (Map_t::value_type (locstr->getId (), locstr )); + assert(locstr != nullptr); //lint !e1924 // c-style cast. MSVC bug + m_map.insert(Map_t::value_type(locstr->getId(), locstr)); } } //----------------------------------------------------------------- -LocalizedString * LocalizedStringTableRW::getLocalizedStringByName (const Unicode::String & name) +LocalizedString * LocalizedStringTableRW::getLocalizedStringByName(const Unicode::String & name) { - return getLocalizedStringByName(Unicode::wideToNarrow (name)); + return getLocalizedStringByName(Unicode::wideToNarrow(name)); } - -// ====================================================================== +// ====================================================================== \ No newline at end of file From 9d2013918ad69bcab0a22d8e12e5bd245547e6ba Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sun, 24 Jul 2016 21:36:20 -0700 Subject: [PATCH 159/302] some more to try... --- .../src/shared/core/ServerWorld.cpp | 663 ++- .../ServerXpManagerObjectTemplate.cpp | 24 +- .../serverKeyShare/src/shared/KeyShare.cpp | 112 +- .../serverScript/src/shared/JavaLibrary.cpp | 4198 ++++++++--------- .../serverScript/src/shared/JavaLibrary.h | 90 +- 5 files changed, 2516 insertions(+), 2571 deletions(-) diff --git a/engine/server/library/serverGame/src/shared/core/ServerWorld.cpp b/engine/server/library/serverGame/src/shared/core/ServerWorld.cpp index a3fb0233..5488b5f9 100755 --- a/engine/server/library/serverGame/src/shared/core/ServerWorld.cpp +++ b/engine/server/library/serverGame/src/shared/core/ServerWorld.cpp @@ -14,7 +14,7 @@ #include "serverGame/CellObject.h" #include "serverGame/CollisionCallbacks.h" #include "serverGame/CombatTracker.h" -#include "serverGame/ConfigServerGame.h" +#include "serverGame/ConfigServerGame.h" #include "serverGame/ConnectionServerConnection.h" #include "serverGame/ContainerInterface.h" #include "serverGame/ContainmentMessageManager.h" @@ -154,9 +154,6 @@ #include "unicodeArchive/UnicodeArchive.h" #include "sharedLog/Log.h" - - - Object const *getContainingPobForObjectInWorld(Object const &object) { Object const * const containingObject = ContainerInterface::getContainedByObject(object); @@ -174,81 +171,72 @@ Object const *getContainingPobForObjectInWorld(Object const &object) return 0; } - - - -void compare_results_int( std::set &results, const std::set &results2, ServerObject* object ) +void compare_results_int(std::set &results, const std::set &results2, ServerObject* object) { - if ( results.empty() && results2.empty() ) // nothing to say........ + if (results.empty() && results2.empty()) // nothing to say........ return; - Vector v=object->getPosition_w(); + Vector v = object->getPosition_w(); const Object* p = getContainingPobForObjectInWorld(*object); - if ( results == results2 ) + if (results == results2) { return; } - LOG("SphereGrid", ("---- Results differ for object at (%f %f %f) %p --------", v.x, v.y, v.z, p )); + LOG("SphereGrid", ("---- Results differ for object at (%f %f %f) %p --------", v.x, v.y, v.z, p)); std::set::iterator iter; - LOG("SphereGrid", ("=============== Tree Results %d =================",results.size())); - for ( iter = results.begin(); iter != results.end(); ++iter ) + LOG("SphereGrid", ("=============== Tree Results %d =================", results.size())); + for (iter = results.begin(); iter != results.end(); ++iter) { TriggerVolume* volume = *iter; ServerObject const &volumeOwner = volume->getOwner(); const Object* pob = getContainingPobForObjectInWorld(volume->getOwner()); Sphere const &localSphere = volumeOwner.getLocalSphere(); Sphere world(volumeOwner.getTransform_o2w().rotateTranslate_l2p(localSphere.getCenter()), volume->getRadius()); - Vector c=world.getCenter(); - LOG("SphereGrid",(" (%f %f %f) %f POB = %p DIST=%f",c.x,c.y,c.z,world.getRadius(),pob, c.magnitudeBetween(v) )); - + Vector c = world.getCenter(); + LOG("SphereGrid", (" (%f %f %f) %f POB = %p DIST=%f", c.x, c.y, c.z, world.getRadius(), pob, c.magnitudeBetween(v))); } - LOG("SphereGrid", ("------------------ Grid Results %d ------------------",results2.size())); - for ( iter = results2.begin(); iter != results2.end(); ++iter ) + LOG("SphereGrid", ("------------------ Grid Results %d ------------------", results2.size())); + for (iter = results2.begin(); iter != results2.end(); ++iter) { TriggerVolume* volume = *iter; ServerObject const &volumeOwner = volume->getOwner(); const Object* pob = getContainingPobForObjectInWorld(volume->getOwner()); Sphere const &localSphere = volumeOwner.getLocalSphere(); Sphere world(volumeOwner.getTransform_o2w().rotateTranslate_l2p(localSphere.getCenter()), volume->getRadius()); // o2p or o2w - Vector c=world.getCenter(); - LOG("SphereGrid",(" (%f %f %f) %f POB = %p DIST=%f",c.x,c.y,c.z,world.getRadius(),pob, c.magnitudeBetween(v) )); - + Vector c = world.getCenter(); + LOG("SphereGrid", (" (%f %f %f) %f POB = %p DIST=%f", c.x, c.y, c.z, world.getRadius(), pob, c.magnitudeBetween(v))); } - DEBUG_FATAL(true,("FATAL: SphereGrid failed to match SphereTree result set.")); + DEBUG_FATAL(true, ("FATAL: SphereGrid failed to match SphereTree result set.")); } - - - -void compare_results( Capsule const &test, std::vector &results_in, const std::set &results2, ServerObject* object ) +void compare_results(Capsule const &test, std::vector &results_in, const std::set &results2, ServerObject* object) { size_t i; std::set results; - for ( i = 0; i < results_in.size(); ++i ) + for (i = 0; i < results_in.size(); ++i) { TriggerVolume* volume = results_in[i]; ServerObject const &volumeOwner = volume->getOwner(); Sphere const &localSphere = volumeOwner.getLocalSphere(); Sphere world(volumeOwner.getTransform_o2w().rotateTranslate_l2p(localSphere.getCenter()), volume->getRadius()); // o2p or o2w - if ( test.intersectsSphere( world ) ) + if (test.intersectsSphere(world)) { - results.insert( results_in[ i ] ); + results.insert(results_in[i]); } } - compare_results_int( results, results2, object ); + compare_results_int(results, results2, object); } - -void compare_results( Vector const ¢er_w, float radius, std::vector &results_in, const std::set &results2, ServerObject* object ) +void compare_results(Vector const ¢er_w, float radius, std::vector &results_in, const std::set &results2, ServerObject* object) { size_t i; std::set results; - for ( i = 0; i < results_in.size(); ++i ) + for (i = 0; i < results_in.size(); ++i) { TriggerVolume* volume = results_in[i]; ServerObject const &volumeOwner = volume->getOwner(); @@ -256,24 +244,21 @@ void compare_results( Vector const ¢er_w, float radius, std::vectorgetRadius()); // o2p or o2w Sphere test(center_w, radius); - if ( test.intersectsSphere( world ) ) + if (test.intersectsSphere(world)) { - results.insert( results_in[ i ] ); + results.insert(results_in[i]); } } - compare_results_int( results, results2, object ); + compare_results_int(results, results2, object); } - - - // ====================================================================== namespace ServerWorldNamespace { std::vector s_loadBeaconEntries; bool ms_logTriggerStats = false; - + std::vector gs_pendingConcludeVector; std::vector > gs_pendingConcludeOpsVector; bool gs_pendingConcludeLock = false; @@ -319,9 +304,9 @@ bool ServerWorldNamespace::isPlayerHouseHook(Object const *object) if (object && object->getPortalProperty()) { ServerObject const * const serverObject = object->asServerObject(); - if ( serverObject - && ( serverObject->asShipObject() - || serverObject->getObjVars().hasItem("player_structure"))) + if (serverObject + && (serverObject->asShipObject() + || serverObject->getObjVars().hasItem("player_structure"))) return true; } return false; @@ -335,20 +320,20 @@ void ServerWorldNamespace::issueCollisionNearWarpWarning(Object const &object, V //-- Only issue these for authoritative server objects. Proxy server objects will hit this condition after an intra-planet teleport. // @todo allow proxies to know about a teleport and inform CollisionWorld so that we can always report these. - WARNING(!serverObject || serverObject->isAuthoritative(), + WARNING(!serverObject || serverObject->isAuthoritative(), ("CollisionWorld::update() had %d segments for object id=[%s], template=[%s], authority=[%s], game sever id=[%d], start position=[%.2f,%.2f,%.2f], end position=[%.2f,%.2f,%.2f], object probably should have warped but collision system is not warping it.", - segmentCount, - object.getNetworkId().getValueString().c_str(), - object.getObjectTemplateName(), - serverObject ? (serverObject->isAuthoritative() ? "authoritative" : "proxy") : "", - static_cast(GameServer::getInstance().getProcessId()), - oldPosition_w.x, - oldPosition_w.y, - oldPosition_w.z, - newPosition_w.x, - newPosition_w.y, - newPosition_w.z - )); + segmentCount, + object.getNetworkId().getValueString().c_str(), + object.getObjectTemplateName(), + serverObject ? (serverObject->isAuthoritative() ? "authoritative" : "proxy") : "", + static_cast(GameServer::getInstance().getProcessId()), + oldPosition_w.x, + oldPosition_w.y, + oldPosition_w.z, + newPosition_w.x, + newPosition_w.y, + newPosition_w.z + )); } // ---------------------------------------------------------------------- @@ -359,20 +344,20 @@ void ServerWorldNamespace::issueCollisionFarWarpWarning(Object const &object, Ve //-- Only issue these for authoritative server objects. Proxy server objects will hit this condition after an intra-planet teleport. // @todo allow proxies to know about a teleport and inform CollisionWorld so that we can always report these. - WARNING(!serverObject || serverObject->isAuthoritative(), + WARNING(!serverObject || serverObject->isAuthoritative(), ("CollisionWorld::update() had %d segments for object id=[%s], template=[%s], authority=[%s], game sever id=[%d], start position=[%.2f,%.2f,%.2f], end position=[%.2f,%.2f,%.2f], collision system will consider this a warp and adjust accordingly.", - segmentCount, - object.getNetworkId().getValueString().c_str(), - object.getObjectTemplateName(), - serverObject ? (serverObject->isAuthoritative() ? "authoritative" : "proxy") : "", - static_cast(GameServer::getInstance().getProcessId()), - oldPosition_w.x, - oldPosition_w.y, - oldPosition_w.z, - newPosition_w.x, - newPosition_w.y, - newPosition_w.z - )); + segmentCount, + object.getNetworkId().getValueString().c_str(), + object.getObjectTemplateName(), + serverObject ? (serverObject->isAuthoritative() ? "authoritative" : "proxy") : "", + static_cast(GameServer::getInstance().getProcessId()), + oldPosition_w.x, + oldPosition_w.y, + oldPosition_w.z, + newPosition_w.x, + newPosition_w.y, + newPosition_w.z + )); } // ---------------------------------------------------------------------- @@ -382,10 +367,9 @@ bool isRelevantToTriggerVolumes(Object const &object) return object.getObjectTemplate()->getId() == ServerCreatureObjectTemplate::ServerCreatureObjectTemplate_tag; } - // ---------------------------------------------------------------------- -class PlayerShipFilter: public SpatialSubdivisionFilter +class PlayerShipFilter : public SpatialSubdivisionFilter { public: PlayerShipFilter(ServerObject const *excludeObject) : @@ -402,23 +386,25 @@ private: ServerObject const *m_excludeObject; }; -class CreatureFilter: public SpatialSubdivisionFilter +class CreatureFilter : public SpatialSubdivisionFilter { public: CreatureFilter() {} bool operator() (ServerObject * const &object) const { - return (object->getObjectTemplate()->getId() == ServerCreatureObjectTemplate::ServerCreatureObjectTemplate_tag); } + return (object->getObjectTemplate()->getId() == ServerCreatureObjectTemplate::ServerCreatureObjectTemplate_tag); + } }; -class AuthoritativeNonPlayerCreatureFilter: public SpatialSubdivisionFilter +class AuthoritativeNonPlayerCreatureFilter : public SpatialSubdivisionFilter { public: AuthoritativeNonPlayerCreatureFilter() {} bool operator() (ServerObject * const &object) const { - return (object->isAuthoritative() && object->asCreatureObject() != nullptr && !object->isPlayerControlled()); } + return (object->isAuthoritative() && object->asCreatureObject() != nullptr && !object->isPlayerControlled()); + } }; -class TriggerVolumeFilter: public SpatialSubdivisionFilter +class TriggerVolumeFilter : public SpatialSubdivisionFilter { public: TriggerVolumeFilter() {} @@ -428,7 +414,7 @@ public: } }; -class TriggerVolumeFilterWithIgnoredObject: public SpatialSubdivisionFilter +class TriggerVolumeFilterWithIgnoredObject : public SpatialSubdivisionFilter { public: TriggerVolumeFilterWithIgnoredObject(ServerObject const &ignoredObject) : @@ -449,7 +435,7 @@ private: ServerObject const &m_ignoredObject; }; -class ServerObjectSphereExtentAccessor: public PortallizedSphereTreeAccessor +class ServerObjectSphereExtentAccessor : public PortallizedSphereTreeAccessor { public: @@ -464,12 +450,11 @@ public: { return getContainingPobForObjectInWorld(*NON_NULL(object)); } - }; //----------------------------------------------------------------------- -class TriggerVolumeSphereExtentAccessor: public PortallizedSphereTreeAccessor +class TriggerVolumeSphereExtentAccessor : public PortallizedSphereTreeAccessor { public: @@ -486,12 +471,11 @@ public: NOT_NULL(t); return getContainingPobForObjectInWorld(t->getOwner()); } - }; //----------------------------------------------------------------------- -class TriggerVolumeSphereExtentAccessor_Grid: public PortallizedSphereTreeAccessor +class TriggerVolumeSphereExtentAccessor_Grid : public PortallizedSphereTreeAccessor { public: @@ -508,14 +492,13 @@ public: NOT_NULL(t); return getContainingPobForObjectInWorld(t->getOwner()); } - }; //---------------------------------------------------------------------- -bool ServerWorld::m_installed = false; -Timer * ServerWorld::m_idleTimer = 0; -std::string * ServerWorld::m_sceneId = 0; +bool ServerWorld::m_installed = false; +Timer * ServerWorld::m_idleTimer = 0; +std::string * ServerWorld::m_sceneId = 0; SynchronizedWeatherGenerator * ServerWorld::m_weatherGenerator = 0; //----------------------------------------------------------------------- @@ -525,15 +508,12 @@ SynchronizedWeatherGenerator * ServerWorld::m_weatherGenerator = 0; // sphere extents. // // g_triggerSphereTree has a many to one relationship between trigger volumes -// and their owner objects. +// and their owner objects. PortallizedSphereTree *g_objectSphereTree = 0; PortallizedSphereTree *g_triggerSphereTree = 0; DoubleSphereGrid *g_triggerSphereGrid = 0; - - - // ---------------------------------------------------------------------- void ServerWorld::addIntangibleObject(Object * object) @@ -546,16 +526,16 @@ void ServerWorld::addIntangibleObject(Object * object) void ServerWorld::removeIntangibleObject(Object * object) { PROFILER_AUTO_BLOCK_DEFINE("ServerWorld::removeIntangibleObject"); - IGNORE_RETURN( World::removeObject(object, static_cast(WOL_Intangible)) ); + IGNORE_RETURN(World::removeObject(object, static_cast(WOL_Intangible))); } //----------------------------------------------------------------------- void ServerWorld::addObjectToConcludeList(ServerObject * object) { - if(! gs_pendingConcludeLock) + if (!gs_pendingConcludeLock) { - if(object) + if (object) { gs_pendingConcludeVector.push_back(object); } @@ -570,18 +550,18 @@ void ServerWorld::addObjectToConcludeList(ServerObject * object) void ServerWorld::addTangibleObject(ServerObject * object) { - if(object) + if (object) { DEBUG_FATAL(object->isBeingDestroyed(), ("Destroyed objects should no longer be added back to the world, they should have Object::scheduleForAlter() called on them.")); - + DEBUG_FATAL(!object->getObjectType(), ("Attempt to add unknown object to world, aborting add, continuing to run (FIXME!)")); #ifdef _DEBUG if (object->getPosition_w() == Vector::zero && (!dynamic_cast(object))) { DEBUG_WARNING(true, ("Adding object to origin, probably an error. server id=[%d], object id=[%s], object template name=[%s]", - static_cast(GameServer::getInstance().getProcessId()), - object->getNetworkId().getValueString().c_str(), - object->getObjectTemplateName())); + static_cast(GameServer::getInstance().getProcessId()), + object->getNetworkId().getValueString().c_str(), + object->getObjectTemplateName())); } #endif if (object->getObjectType()) @@ -594,8 +574,9 @@ void ServerWorld::addTangibleObject(ServerObject * object) Sphere s = object->getSphereExtent(); float r = s.getRadius(); WARNING_STRICT_FATAL(r != r, ("Someone is adding object %s:%s to the world that has a sphere extent radius that is Not a Number!", object->getObjectTemplateName(), object->getNetworkId().getValueString().c_str())); - - if((r == r) && (s.getCenter() == s.getCenter())) // check for NaN in radius + + //what the fuck? + if ((r == r) && (s.getCenter() == s.getCenter())) // check for NaN in radius { //First put in object sphere tree g_objectSphereTree->onObjectAdded(object); @@ -608,30 +589,30 @@ void ServerWorld::addTangibleObject(ServerObject * object) int system = ConfigServerGame::getTriggerVolumeSystem(); // 0 = old, 1 = compare, 2 = new - if ( system <= 1 ) + if (system <= 1) { PROFILER_AUTO_BLOCK_DEFINE("sphere_tree_find"); g_triggerSphereTree->findInRange(s.getCenter(), s.getRadius(), results); } - if ( system >= 1 ) + if (system >= 1) { PROFILER_AUTO_BLOCK_DEFINE("sphere_grid_find"); - g_triggerSphereGrid->findInRange( s.getCenter(), s.getRadius(), results2); + g_triggerSphereGrid->findInRange(s.getCenter(), s.getRadius(), results2); } - if ( system == 1 ) + if (system == 1) { - compare_results( s.getCenter(), s.getRadius(), results,results2,object); + compare_results(s.getCenter(), s.getRadius(), results, results2, object); } - + // potential add to trigger volumes - if ( system != 2 ) + if (system != 2) { for (std::vector::const_iterator i = results.begin(); i != results.end(); ++i) (*i)->addObject(*object); } - else if ( system == 2 ) + else if (system == 2) { for (std::set::const_iterator i = results2.begin(); i != results2.end(); ++i) (*i)->addObject(*object); @@ -663,7 +644,7 @@ void ServerWorld::addUniverseObject(UniverseObject * object) void ServerWorld::removeUniverseObject(UniverseObject * object) { - IGNORE_RETURN( World::removeObject(object, static_cast(WOL_Intangible)) ); + IGNORE_RETURN(World::removeObject(object, static_cast(WOL_Intangible))); } //----------------------------------------------------------------------- @@ -671,19 +652,19 @@ void ServerWorld::removeUniverseObject(UniverseObject * object) void ServerWorld::addObjectTriggerVolume(TriggerVolume * triggerVolume) { int system = ConfigServerGame::getTriggerVolumeSystem(); // 0 = old, 1 = compare, 2 = new - if ( system <= 1 ) + if (system <= 1) { PROFILER_AUTO_BLOCK_DEFINE("sphere_tree_add"); g_triggerSphereTree->onObjectAdded(triggerVolume); } - if ( system >= 1 ) + if (system >= 1) { PROFILER_AUTO_BLOCK_DEFINE("sphere_grid_add"); g_triggerSphereGrid->onObjectAdded(triggerVolume); } - // query the object sphere tree for objects that will be added to + // query the object sphere tree for objects that will be added to // the trigger volume now that it has been added std::vector results; // This is filtered as appropriate for things which should be in trigger volumes @@ -696,7 +677,7 @@ void ServerWorld::addObjectTriggerVolume(TriggerVolume * triggerVolume) /** * Creates a new authoritative object. The object will be added to the world - * when we have received a signal that it has been persisted. + * when we have received a signal that it has been persisted. * NOTE: createNewObjectEnd must be called to complete the creation process. * * @param templateName template to create the object from @@ -724,7 +705,7 @@ ServerObject *ServerWorld::createNewObject(std::string const &templateName, Tran /** * Creates a new authoritative object. The object will be added to the world - * when we have received a signal that it has been persisted. + * when we have received a signal that it has been persisted. * NOTE: createNewObjectEnd must be called to complete the creation process. * * @param templateCrc template to create the object from @@ -752,7 +733,7 @@ ServerObject *ServerWorld::createNewObject(uint32 templateCrc, Transform const & /** * Creates a new authoritative object. The object will be added to the world - * when we have received a signal that it has been persisted. + * when we have received a signal that it has been persisted. * NOTE: createNewObjectEnd must be called to complete the creation process. * * @param objectTemplate template to create the object from @@ -826,7 +807,7 @@ ServerObject *ServerWorld::createNewObject(uint32 templateCrc, ServerObject &con //----------------------------------------------------------------------- /** - * Creates a new authoritative object in a conatiner. + * Creates a new authoritative object in a conatiner. * NOTE: createNewObjectEnd must be called to complete the creation process. * * @param objectTemplate template to create the object from @@ -842,7 +823,7 @@ ServerObject *ServerWorld::createNewObject(ServerObjectTemplate const &objectTem ServerObject * const newObject = createObjectFromTemplate(objectTemplate, NetworkId::cms_invalid); if (!newObject) return 0; - + return createNewObjectIntermediate(newObject, container, persisted, allowOverload); } @@ -855,7 +836,7 @@ ServerObject *ServerWorld::createNewObject(ServerObjectTemplate const &objectTem ServerObject * const newObject = createObjectFromTemplate(objectTemplate, NetworkId::cms_invalid); if (!newObject) return 0; - + return createNewObjectIntermediate(newObject, container, slotId, persisted); } @@ -880,8 +861,8 @@ ServerObject *ServerWorld::createNewObject(uint32 templateCrc, ServerObject &con PROFILER_AUTO_BLOCK_DEFINE("createNewObject6crc"); ServerObject * const newObject = createObjectFromTemplate(templateCrc, NetworkId::cms_invalid); - if (!newObject) - return 0; + if (!newObject) + return 0; return createNewObjectIntermediate(newObject, container, slotId, persisted); } @@ -900,14 +881,14 @@ ServerObject *ServerWorld::createNewObject(uint32 templateCrc, ServerObject &con * * @return the newly created schematic */ -ManufactureSchematicObject* ServerWorld::createNewManufacturingSchematic ( - const CachedNetworkId & creator, ServerObject & container, const SlotId & slotId, +ManufactureSchematicObject* ServerWorld::createNewManufacturingSchematic( + const CachedNetworkId & creator, ServerObject & container, const SlotId & slotId, bool persisted) { CreatureObject * const creature = dynamic_cast(creator.getObject()); if (creature == nullptr) return nullptr; - + PlayerObject * player = PlayerCreatureController::getPlayerObject(creature); if (player == nullptr) return nullptr; @@ -920,7 +901,7 @@ ManufactureSchematicObject* ServerWorld::createNewManufacturingSchematic ( if (manfSchematic == nullptr) return nullptr; - if (createNewObjectIntermediate(manfSchematic, container, slotId, + if (createNewObjectIntermediate(manfSchematic, container, slotId, persisted) == nullptr) { delete manfSchematic; @@ -943,10 +924,10 @@ ManufactureSchematicObject* ServerWorld::createNewManufacturingSchematic ( * * @return the newly created schematic */ -ManufactureSchematicObject* ServerWorld::createNewManufacturingSchematic ( +ManufactureSchematicObject* ServerWorld::createNewManufacturingSchematic( const DraftSchematicObject & source, const Vector & position, bool persisted) { - ManufactureSchematicObject * const manfSchematic = + ManufactureSchematicObject * const manfSchematic = source.createManufactureSchematic(CachedNetworkId::cms_cachedInvalid); if (manfSchematic == nullptr) return nullptr; @@ -975,10 +956,10 @@ ManufactureSchematicObject* ServerWorld::createNewManufacturingSchematic ( * * @return the newly created schematic */ -ManufactureSchematicObject* ServerWorld::createNewManufacturingSchematic ( +ManufactureSchematicObject* ServerWorld::createNewManufacturingSchematic( const DraftSchematicObject & source, ServerObject & container, bool persisted) { - ManufactureSchematicObject * const manfSchematic = + ManufactureSchematicObject * const manfSchematic = source.createManufactureSchematic(CachedNetworkId::cms_cachedInvalid); if (manfSchematic == nullptr) return nullptr; @@ -991,7 +972,7 @@ ManufactureSchematicObject* ServerWorld::createNewManufacturingSchematic ( //----------------------------------------------------------------------- /** - * Called by the two above createNewObjectStart functions. Done to provide a + * Called by the two above createNewObjectStart functions. Done to provide a * function for common code. * * @param newObject the new object being created @@ -1010,7 +991,7 @@ ServerObject* ServerWorld::createNewObjectIntermediate(ServerObject *newObject, WARNING_STRICT_FATAL(true, ("Tried to create an object with network id 0.")); return nullptr; } - + NetworkController *objectController = dynamic_cast(newObject->getController()); if (objectController == nullptr) objectController = dynamic_cast(newObject->createDefaultController()); @@ -1034,14 +1015,14 @@ ServerObject* ServerWorld::createNewObjectIntermediate(ServerObject *newObject, { newObject->persist(); } - + return newObject; } //----------------------------------------------------------------------- /** - * Called by the two above createNewObjectStart in container functions. Done to + * Called by the two above createNewObjectStart in container functions. Done to * provide a function for common code. * * @param newObject the new object being created @@ -1059,7 +1040,7 @@ ServerObject* ServerWorld::createNewObjectIntermediate(ServerObject* newObject, WARNING_STRICT_FATAL(true, ("Tried to create an object with network id 0.")); return nullptr; } - + NetworkController *objectController = dynamic_cast(newObject->getController()); if (objectController == nullptr) objectController = dynamic_cast(newObject->createDefaultController()); @@ -1072,7 +1053,7 @@ ServerObject* ServerWorld::createNewObjectIntermediate(ServerObject* newObject, // prevent initial object data from being re-sent as deltas newObject->clearDeltas(); - Container::ContainerErrorCode tmp = Container::CEC_Success; + Container::ContainerErrorCode tmp = Container::CEC_Success; if (!ContainerInterface::transferItemToGeneralContainer(container, *newObject, nullptr, tmp, allowOverload)) { IGNORE_RETURN(newObject->permanentlyDestroy(DeleteReasons::BadContainerTransfer)); @@ -1141,7 +1122,7 @@ ServerObject* ServerWorld::createNewObjectIntermediate(ServerObject* newObject, PROFILER_AUTO_BLOCK_DEFINE("successTransfer"); const ServerObjectTemplate * objectTemplate = safe_cast< const ServerObjectTemplate *>(newObject->getObjectTemplate()); - + if (persisted || objectTemplate->getPersistByDefault()) { newObject->persist(); @@ -1186,13 +1167,13 @@ ServerObject* ServerWorld::createProxyObject(uint32 templateCrc, const NetworkId ServerObject *newObject = createObjectFromTemplate(templateCrc, id); DEBUG_WARNING(newObject == 0, ("Failed to load object from template [%s]", ObjectTemplateList::lookUp(templateCrc).getString())); - if(newObject) + if (newObject) { ServerController *objectController = dynamic_cast(newObject->getController()); if (objectController == nullptr) objectController = dynamic_cast(newObject->createDefaultController()); NOT_NULL(objectController); - + // initialize the object if (createAuthoritative) newObject->setAuthority(); @@ -1204,7 +1185,7 @@ ServerObject* ServerWorld::createProxyObject(uint32 templateCrc, const NetworkId //----------------------------------------------------------------------- -void ServerWorld::debugDump () +void ServerWorld::debugDump() { World::debugReport(); } @@ -1230,9 +1211,9 @@ ServerObject * ServerWorld::findObjectByNetworkId(const NetworkId& id, bool sear UNREF(searchQueuedList); if (id.getValue() == 0) return 0; - + ServerObject * object = safe_cast(NetworkIdManager::getObjectById(id)); - if (object && ( !object->isInitialized() || object->isBeingDestroyed()) ) + if (object && (!object->isInitialized() || object->isBeingDestroyed())) return 0; return object; } @@ -1246,7 +1227,7 @@ ServerObject * ServerWorld::findUninitializedObjectByNetworkId(const NetworkId& DEBUG_REPORT_LOG(true, ("ERROR - Tried to invoke ServerWorld::findUninitializedObjectByNetworkId with id %s\n", id.getValueString().c_str())); return 0; } - + ServerObject * object = safe_cast(NetworkIdManager::getObjectById(id)); if (object && object->isInitialized()) { @@ -1265,12 +1246,12 @@ void ServerWorld::findObjectsInRange(const Vector & location, const float distan //----------------------------------------------------------------------- -class StaticCollidableObjectFilter: public SpatialSubdivisionFilter +class StaticCollidableObjectFilter : public SpatialSubdivisionFilter { public: StaticCollidableObjectFilter() {} - bool operator() (ServerObject * const &object) const - { + bool operator() (ServerObject * const &object) const + { CollisionProperty const * collision = object->getCollisionProperty(); if (!collision) return false; @@ -1286,7 +1267,6 @@ void ServerWorld::findStaticCollidableObjectsInRange(const Vector & location, co //----------------------------------------------------------------------- - void ServerWorld::findCreaturesInRange(const Vector & location, const float distance, std::vector & results) { g_objectSphereTree->findInRange(location, distance, CreatureFilter(), results); @@ -1301,13 +1281,13 @@ void ServerWorld::findAuthoritativeNonPlayerCreaturesInRange(const Vector & loca //----------------------------------------------------------------------- -class CreatureNicheFilter: public SpatialSubdivisionFilter +class CreatureNicheFilter : public SpatialSubdivisionFilter { public: - explicit CreatureNicheFilter(int i_type, int i_mask): type(i_type), mask(i_mask) { type &= mask; } - bool operator() (ServerObject * const &object) const - { - CreatureObject * creature = dynamic_cast(object); + explicit CreatureNicheFilter(int i_type, int i_mask) : type(i_type), mask(i_mask) { type &= mask; } + bool operator() (ServerObject * const &object) const + { + CreatureObject * creature = dynamic_cast(object); if (!creature) return false; return (creature->getNiche() & mask) == type; @@ -1327,12 +1307,12 @@ void ServerWorld::findCreaturesOfNicheInRange(const Vector & location, const flo //----------------------------------------------------------------------- -class CreatureSpeciesFilter: public SpatialSubdivisionFilter +class CreatureSpeciesFilter : public SpatialSubdivisionFilter { public: - explicit CreatureSpeciesFilter(int i_species): species(i_species) {} - bool operator() (ServerObject * const &object) const - { + explicit CreatureSpeciesFilter(int i_species) : species(i_species) {} + bool operator() (ServerObject * const &object) const + { CreatureObject * creature = object->asCreatureObject(); if (!creature) return false; @@ -1353,12 +1333,12 @@ void ServerWorld::findCreaturesOfSpeciesInRange(const Vector & location, const f //----------------------------------------------------------------------- -class CreatureRaceFilter: public SpatialSubdivisionFilter +class CreatureRaceFilter : public SpatialSubdivisionFilter { public: - explicit CreatureRaceFilter(int i_species, int i_race): species(i_species), race(i_race) {} - bool operator() (ServerObject * const &object) const - { + explicit CreatureRaceFilter(int i_species, int i_race) : species(i_species), race(i_race) {} + bool operator() (ServerObject * const &object) const + { CreatureObject * creature = dynamic_cast(object); if (!creature) return false; @@ -1379,12 +1359,12 @@ void ServerWorld::findCreaturesOfRaceInRange(const Vector & location, const floa //----------------------------------------------------------------------- -class NPCFilter: public SpatialSubdivisionFilter +class NPCFilter : public SpatialSubdivisionFilter { public: bool operator() (ServerObject * const &object) const { - CreatureObject *c=dynamic_cast(object); + CreatureObject *c = dynamic_cast(object); if (c) return !(c->isPlayerControlled()); else @@ -1402,12 +1382,12 @@ void ServerWorld::findNPCsInRange(const Vector & location, const float distance, //----------------------------------------------------------------------- -class PlayerFilter: public SpatialSubdivisionFilter +class PlayerFilter : public SpatialSubdivisionFilter { public: bool operator() (ServerObject * const &object) const { - CreatureObject *c=dynamic_cast(object); + CreatureObject *c = dynamic_cast(object); if (c) return (c->isPlayerControlled()); else @@ -1489,9 +1469,9 @@ static bool _isObjectInConeLoop(const Object & coneCenterObject, const Object & //-- return true if angle between forward and position_o is smaller than the cone angle - const float dotProduct = coneAxisVector.dot(testOrientation); - const bool withinCone = (dotProduct >= cosAngle); - + const float dotProduct = coneAxisVector.dot(testOrientation); + const bool withinCone = (dotProduct >= cosAngle); + return withinCone; } @@ -1505,8 +1485,8 @@ static bool _isObjectInConeLoop(const Object & coneCenterObject, const Object & * @param angle cone angle in radians * @param results vector to store the found objects in */ -void ServerWorld::findObjectsInCone(const Object & coneCenterObject, - const Object & coneDirectionObject, float distance, +void ServerWorld::findObjectsInCone(const Object & coneCenterObject, + const Object & coneDirectionObject, float distance, float angle, std::vector & results) { std::vector rangeResults; @@ -1543,8 +1523,8 @@ void ServerWorld::findObjectsInCone(const Object & coneCenterObject, * @param angle cone angle in radians * @param results vector to store the found objects in */ -void ServerWorld::findObjectsInCone(const Object & coneCenterObject, - const Location & coneDirection, float distance, +void ServerWorld::findObjectsInCone(const Object & coneCenterObject, + const Location & coneDirection, float distance, float angle, std::vector & results) { std::vector rangeResults; @@ -1580,7 +1560,7 @@ void ServerWorld::findObjectsInCone(const Object & coneCenterObject, * @param angle cone angle in radians * @param results vector to store the found objects in */ -void ServerWorld::findCreaturesInCone(const Object & coneCenterObject, +void ServerWorld::findCreaturesInCone(const Object & coneCenterObject, const Object & coneDirectionObject, float distance, float angle, std::vector & results) { @@ -1618,7 +1598,7 @@ void ServerWorld::findCreaturesInCone(const Object & coneCenterObject, * @param angle cone angle in radians * @param results vector to store the found objects in */ -void ServerWorld::findCreaturesInCone(const Object & coneCenterObject, +void ServerWorld::findCreaturesInCone(const Object & coneCenterObject, const Location & coneDirection, float distance, float angle, std::vector & results) { @@ -1655,7 +1635,7 @@ void ServerWorld::findCreaturesInCone(const Object & coneCenterObject, * @param angle cone angle in radians * @param results vector to store the found objects in */ -void ServerWorld::findAuthoritativeNonPlayerCreaturesInCone(const Object & coneCenterObject, +void ServerWorld::findAuthoritativeNonPlayerCreaturesInCone(const Object & coneCenterObject, const Object & coneDirectionObject, float distance, float angle, std::vector & results) { @@ -1692,8 +1672,8 @@ void ServerWorld::findAuthoritativeNonPlayerCreaturesInCone(const Object & coneC * @param angle cone angle in radians * @param results vector to store the found objects in */ -void ServerWorld::findCreaturesOfNicheInCone(const Object & coneCenterObject, - const Object & coneDirectionObject, float distance, float angle, int niche, +void ServerWorld::findCreaturesOfNicheInCone(const Object & coneCenterObject, + const Object & coneDirectionObject, float distance, float angle, int niche, int mask, std::vector & results) { std::vector rangeResults; @@ -1728,7 +1708,7 @@ void ServerWorld::findCreaturesOfNicheInCone(const Object & coneCenterObject, * @param angle cone angle in radians * @param results vector to store the found objects in */ -void ServerWorld::findCreaturesOfSpeciesInCone(const Object & coneCenterObject, +void ServerWorld::findCreaturesOfSpeciesInCone(const Object & coneCenterObject, const Object & coneDirectionObject, float distance, float angle, int species, std::vector & results) { @@ -1764,8 +1744,8 @@ void ServerWorld::findCreaturesOfSpeciesInCone(const Object & coneCenterObject, * @param angle cone angle in radians * @param results vector to store the found objects in */ -void ServerWorld::findCreaturesOfRaceInCone(const Object & coneCenterObject, - const Object & coneDirectionObject, float distance, +void ServerWorld::findCreaturesOfRaceInCone(const Object & coneCenterObject, + const Object & coneDirectionObject, float distance, float angle, int species, int race, std::vector & results) { std::vector rangeResults; @@ -1800,8 +1780,8 @@ void ServerWorld::findCreaturesOfRaceInCone(const Object & coneCenterObject, * @param angle cone angle in radians * @param results vector to store the found objects in */ -void ServerWorld::findNonCreaturesInCone(const Object & coneCenterObject, - const Object & coneDirectionObject, float distance, float angle, +void ServerWorld::findNonCreaturesInCone(const Object & coneCenterObject, + const Object & coneDirectionObject, float distance, float angle, std::vector & results) { std::vector rangeResults; @@ -1836,8 +1816,8 @@ void ServerWorld::findNonCreaturesInCone(const Object & coneCenterObject, * @param angle cone angle in radians * @param results vector to store the found objects in */ -void ServerWorld::findNPCsInCone(const Object & coneCenterObject, - const Object & coneDirectionObject, float distance, +void ServerWorld::findNPCsInCone(const Object & coneCenterObject, + const Object & coneDirectionObject, float distance, float angle, std::vector & results) { std::vector rangeResults; @@ -1872,8 +1852,8 @@ void ServerWorld::findNPCsInCone(const Object & coneCenterObject, * @param angle cone angle in radians * @param results vector to store the found objects in */ -void ServerWorld::findPlayerCreaturesInCone(const Object & coneCenterObject, - const Object & coneDirectionObject, float distance, +void ServerWorld::findPlayerCreaturesInCone(const Object & coneCenterObject, + const Object & coneDirectionObject, float distance, float angle, std::vector & results) { std::vector rangeResults; @@ -1931,15 +1911,12 @@ ServerObject *ServerWorld::findClosestPlayer(const Vector & location, float dist return findClosestObjectInList(location, candidates); } - - - -class PobFilter: public SpatialSubdivisionFilter +class PobFilter : public SpatialSubdivisionFilter { public: PobFilter() {} - bool operator() (ServerObject * const &object) const - { + bool operator() (ServerObject * const &object) const + { PortalProperty const * portal = object->getPortalProperty(); if (!portal) return false; @@ -1947,21 +1924,18 @@ public: } }; - ServerObject *ServerWorld::findPobAtLocation(const Vector & location_w) { std::vector candidates; g_objectSphereTree->findInRange(location_w, 0.1f, PobFilter(), candidates); return findClosestObjectInList(location_w, candidates); - } - CellProperty const * ServerWorld::findCellAtLocation(const Vector & location_w) { CellProperty const * cell = CellProperty::getWorldCellProperty(); - + ServerObject const * const pob = findPobAtLocation(location_w); if (pob) { @@ -1985,19 +1959,19 @@ CellProperty const * ServerWorld::findCellAtLocation(const Vector & location_w) ServerObject *ServerWorld::findClosestObjectInList(const Vector &location, const std::vector &candidates) { if (candidates.empty()) return nullptr; - + typedef std::vector CandidatesType; - - CandidatesType::const_iterator closest=candidates.begin(); - float minDistance =(*closest)->getPosition_w().magnitudeBetweenSquared(location); - - for (CandidatesType::const_iterator i=closest+1; i != candidates.end(); ++i) + + CandidatesType::const_iterator closest = candidates.begin(); + float minDistance = (*closest)->getPosition_w().magnitudeBetweenSquared(location); + + for (CandidatesType::const_iterator i = closest + 1; i != candidates.end(); ++i) { float distance = (*i)->getPosition_w().magnitudeBetweenSquared(location); if (distance < minDistance) { minDistance = distance; - closest=i; + closest = i; } } @@ -2006,7 +1980,7 @@ ServerObject *ServerWorld::findClosestObjectInList(const Vector &location, const //----------------------------------------------------------------------- -class NonCreatureFilter: public SpatialSubdivisionFilter +class NonCreatureFilter : public SpatialSubdivisionFilter { public: bool operator() (ServerObject * const &object) const { return dynamic_cast(object) == 0; } @@ -2064,7 +2038,7 @@ static void endCreateServerCellObject(Object *newObject) } cellObject->setLoadWith(portalObject->getNetworkId()); - + if (portalObject->isPersisted()) cellObject->persist(); } @@ -2075,13 +2049,13 @@ void ServerWorld::install() { DEBUG_FATAL(m_installed, ("Trying to reinstall ServerWorld")); - DebugFlags::registerFlag (ms_logTriggerStats, "ServerGame", "logTriggerStats"); + DebugFlags::registerFlag(ms_logTriggerStats, "ServerGame", "logTriggerStats"); - m_idleTimer = new Timer; - g_objectSphereTree = new PortallizedSphereTree; + m_idleTimer = new Timer; + g_objectSphereTree = new PortallizedSphereTree; - g_triggerSphereTree = new PortallizedSphereTree; - g_triggerSphereGrid = new DoubleSphereGrid; + g_triggerSphereTree = new PortallizedSphereTree; + g_triggerSphereGrid = new DoubleSphereGrid; s_numMoveLists = ConfigServerGame::getNumberOfMoveObjectLists(); for (int i = 0; i < s_numMoveLists; ++i) @@ -2089,7 +2063,7 @@ void ServerWorld::install() s_moveObjectList.push_back(new MoveObjectMap); } s_moveObjectListValid = true; - + PortalProperty::install(beginCreateServerCellObject, endCreateServerCellObject); { @@ -2110,13 +2084,13 @@ void ServerWorld::install() CollisionWorld::setNearWarpWarningCallback(issueCollisionNearWarpWarning); CollisionWorld::setFarWarpWarningCallback(issueCollisionFarWarpWarning); } - + Region3dMaster::install(); RegionMaster::install(); Pvp::install(); // must be done after RegionMaster::install() GameServerMessageArchive::install(); AiCombatPulseQueue::install(); - + // install the object templates ServerArmorTemplate::install(true); ServerBattlefieldMarkerObjectTemplate::install(true); @@ -2180,7 +2154,7 @@ void ServerWorld::install() FormManagerServer::install(); // install the world - World::install (); + World::install(); m_idleTimer->setExpireTime(1.0f); m_installed = true; @@ -2213,16 +2187,16 @@ void ServerWorld::updateTriggerDatabase(ServerObject & movingObject) for (ServerObject::TriggerVolumeMap::const_iterator v = volumes.begin(); v != volumes.end(); ++v) { int system = ConfigServerGame::getTriggerVolumeSystem(); // 0 = old, 1 = compare, 2 = new - if ( system <= 1 ) + if (system <= 1) { PROFILER_AUTO_BLOCK_DEFINE("sphere_tree_move"); g_triggerSphereTree->onObjectMoved((*v).second); } - if ( system >= 1 ) + if (system >= 1) { PROFILER_AUTO_BLOCK_DEFINE("sphere_grid_move"); - g_triggerSphereGrid->onObjectMoved((*v).second ); + g_triggerSphereGrid->onObjectMoved((*v).second); } } } @@ -2250,31 +2224,29 @@ void ServerWorld::triggerMovingObjects(ServerObject &movingObject, Vector const static std::vector results; static std::set results2; - int system = ConfigServerGame::getTriggerVolumeSystem(); // 0 = old, 1 = compare, 2 = new - if (system <= 1 ) + if (system <= 1) g_triggerSphereTree->findInRange(pob, Vector::zero, 16384.f, results); - if ( system >= 1 ) + if (system >= 1) g_triggerSphereGrid->findInRange(pob, Vector::zero, 16384.f, results2); - if ( system == 1 ) + if (system == 1) { DEBUG_FATAL(results.size() != results2.size(), ("SphereGrid failed (%d vs. %d).", results.size(), results2.size())); } - if ( system != 2) + if (system != 2) { for (std::vector::const_iterator i = results.begin(); i != results.end(); ++i) if ((*i) && &(*i)->getOwner() != &movingObject) (*i)->objectMoved(movingObject); } - else if ( system == 2 ) + else if (system == 2) { for (std::set::const_iterator i = results2.begin(); i != results2.end(); ++i) if ((*i) && &(*i)->getOwner() != &movingObject) (*i)->objectMoved(movingObject); - } results.clear(); @@ -2295,21 +2267,21 @@ void ServerWorld::triggerMovingObjects(ServerObject &movingObject, Vector const { Capsule const queryCapsule(start, end, extentSphereRadius); { - if (system <= 1 ) + if (system <= 1) { PROFILER_AUTO_BLOCK_DEFINE("sphere_tree_find"); g_triggerSphereTree->findInRange(queryCapsule, results); } - if ( system >= 1 ) + if (system >= 1) { PROFILER_AUTO_BLOCK_DEFINE("sphere_grid_find"); - g_triggerSphereGrid->findInRange( queryCapsule, results2); + g_triggerSphereGrid->findInRange(queryCapsule, results2); } - if ( system == 1 ) + if (system == 1) { - compare_results(queryCapsule, results,results2,&movingObject); + compare_results(queryCapsule, results, results2, &movingObject); } } } @@ -2318,32 +2290,32 @@ void ServerWorld::triggerMovingObjects(ServerObject &movingObject, Vector const PROFILER_AUTO_BLOCK_DEFINE("ServerWorld::triggerMovingObject::findInRange (teleport)"); // We moved really far, so consider this a warp - if ( system <= 1 ) + if (system <= 1) { PROFILER_AUTO_BLOCK_DEFINE("sphere_tree_find"); g_triggerSphereTree->findInRange(end, extentSphereRadius, results); } - if ( system >= 1 ) + if (system >= 1) { PROFILER_AUTO_BLOCK_DEFINE("sphere_grid_find"); - g_triggerSphereGrid->findInRange( end, extentSphereRadius, results2); + g_triggerSphereGrid->findInRange(end, extentSphereRadius, results2); } - if ( system == 1 ) + if (system == 1) { - compare_results( end, extentSphereRadius, results,results2,&movingObject); + compare_results(end, extentSphereRadius, results, results2, &movingObject); } } - if ( system != 2 ) + if (system != 2) { PROFILER_AUTO_BLOCK_DEFINE("ServerWorld::triggerMovingObject::loop"); for (std::vector::const_iterator i = results.begin(); i != results.end(); ++i) if ((*i) && &(*i)->getOwner() != &movingObject) (*i)->moveObject(movingObject, start, end); } - else if ( system == 2 ) + else if (system == 2) { PROFILER_AUTO_BLOCK_DEFINE("ServerWorld::triggerMovingObject::loop"); for (std::set::const_iterator i = results2.begin(); i != results2.end(); ++i) @@ -2419,7 +2391,7 @@ void ServerWorld::triggerMovingTriggers(ServerObject &movingObject, Vector const if (object->getClient()) clcount++; } - + if (object != nullptr) t->moveTriggerVolume(*object, start, end); } @@ -2465,12 +2437,12 @@ void ServerWorld::moveObject(ServerObject & movingObject, const Vector & start, void ServerWorld::updateMoveObjectList() { DEBUG_FATAL(!s_moveObjectListValid, ("Cannot operate on uninitialized object list")); - + if (s_numMoveLists <= 0 || !s_moveObjectListValid) return; static int frameCounter = 0; - + s_moveObjectListLock = true; if (++frameCounter >= s_numMoveLists) frameCounter = 0; @@ -2486,20 +2458,19 @@ void ServerWorld::updateMoveObjectList() s_moveObjectListLock = false; } - //----------------------------------------------------------------------- void ServerWorld::internalMoveObject(ServerObject & movingObject, const Vector & start, const Vector & end) { PROFILER_AUTO_BLOCK_DEFINE("ServerWorld::moveObject"); - - // check for NaN - if(start == start && end == end && movingObject.getSphereExtent().getRadius() == movingObject.getSphereExtent().getRadius()) + + // check for NaN + if (start == start && end == end && movingObject.getSphereExtent().getRadius() == movingObject.getSphereExtent().getRadius()) { updateObjectDatabase(movingObject); updateTriggerDatabase(movingObject); - triggerMovingObjects(movingObject,start,end); - triggerMovingTriggers(movingObject,start,end); + triggerMovingObjects(movingObject, start, end); + triggerMovingTriggers(movingObject, start, end); } else { @@ -2508,7 +2479,6 @@ void ServerWorld::internalMoveObject(ServerObject & movingObject, const Vector & DEBUG_FATAL(start != start, ("Object %s:%s is moving from an invalid start position (NaN)", movingObject.getObjectTemplateName(), movingObject.getNetworkId().getValueString().c_str())); DEBUG_FATAL(movingObject.getSphereExtent().getRadius() != movingObject.getSphereExtent().getRadius(), ("Object %s:%s has an invalid sphere extent radius %f", movingObject.getNetworkId().getValueString().c_str(), movingObject.getSphereExtent().getRadius())); } - } //------------------------------------------------------------------------------------------ @@ -2517,9 +2487,9 @@ void ServerWorld::remove() { DEBUG_FATAL(!m_installed, ("Trying to reremove ServerWorld")); - DebugFlags::unregisterFlag (ms_logTriggerStats); - - World::remove (); + DebugFlags::unregisterFlag(ms_logTriggerStats); + + World::remove(); delete m_sceneId; m_sceneId = 0; @@ -2533,7 +2503,7 @@ void ServerWorld::remove() g_triggerSphereGrid = 0; delete m_idleTimer; - m_idleTimer =0; + m_idleTimer = 0; delete m_weatherGenerator; m_weatherGenerator = 0; @@ -2560,13 +2530,13 @@ void ServerWorld::remove() void ServerWorld::removeObjectTriggerVolume(TriggerVolume * triggerVolume) { int system = ConfigServerGame::getTriggerVolumeSystem(); // 0 = old, 1 = compare, 2 = new - if ( system <= 1 ) + if (system <= 1) { PROFILER_AUTO_BLOCK_DEFINE("sphere_tree_remove"); g_triggerSphereTree->onObjectRemoved(triggerVolume); } - if ( system >= 1 ) + if (system >= 1) { PROFILER_AUTO_BLOCK_DEFINE("sphere_grid_remove"); g_triggerSphereGrid->onObjectRemoved(triggerVolume); @@ -2581,7 +2551,7 @@ void ServerWorld::removeObjectFromGame(const ServerObject& object) PROFILER_AUTO_BLOCK_DEFINE("ServerWorld::removeObjectFromGame"); FATAL(gs_pendingConcludeLock, ("Attempt to delete an object DURING CONCLUDE")); std::vector::iterator vf = std::find(gs_pendingConcludeVector.begin(), gs_pendingConcludeVector.end(), const_cast(&object)); - if(vf != gs_pendingConcludeVector.end()) + if (vf != gs_pendingConcludeVector.end()) { *vf = gs_pendingConcludeVector.back(); gs_pendingConcludeVector.pop_back(); @@ -2621,7 +2591,7 @@ void ServerWorld::removeTangibleObject(ServerObject *object) if (!object) return; - + if (!object->isInWorld()) { WARNING_STRICT_FATAL(!object->isInWorld(), ("Tried to remove an object that was not in the world!")); @@ -2681,12 +2651,12 @@ void ServerWorld::removeTangibleObject(ServerObject *object) for (TriggerVolume::ContentsSet::const_iterator objectIterator = contents.begin(); objectIterator != contents.end(); ++objectIterator) t->removeObject(**objectIterator); // Now remove the actual trigger volume - removeObjectTriggerVolume( t ); + removeObjectTriggerVolume(t); } // remove the object sphere g_objectSphereTree->onObjectRemoved(object); } - + { PROFILER_AUTO_BLOCK_DEFINE("removeTangibleObject - World::removeObject 2"); IGNORE_RETURN(World::removeObject(object, static_cast(WOL_Tangible))); @@ -2695,7 +2665,7 @@ void ServerWorld::removeTangibleObject(ServerObject *object) //If the object is a ref obejct, remove it. { PROFILER_AUTO_BLOCK_DEFINE("removeTangibleObject - removeReferenceObject"); - TerrainObject * const terrain = TerrainObject::getInstance (); + TerrainObject * const terrain = TerrainObject::getInstance(); if (terrain && terrain->isReferenceObject(object)) terrain->removeReferenceObject(object); } @@ -2706,7 +2676,7 @@ void ServerWorld::removeTangibleObject(ServerObject *object) void ServerWorld::update(real time) { DEBUG_FATAL(!m_installed, ("ServerWorld is NOT installed!")); - + //-- update network { PROFILER_AUTO_BLOCK_DEFINE("NetworkHandler::dispatch()"); @@ -2714,7 +2684,7 @@ void ServerWorld::update(real time) } // scheduler code - World::beginFrame (); + World::beginFrame(); { { PROFILER_AUTO_BLOCK_DEFINE("Alter"); @@ -2730,7 +2700,7 @@ void ServerWorld::update(real time) PROFILER_AUTO_BLOCK_DEFINE("CreatureObject::updateMissionRequestQueue"); CreatureObject::updateMissionRequestQueue(); } - + { PROFILER_AUTO_BLOCK_DEFINE("CreatureObject::runMissionCreationQueue"); CreatureObject::runMissionCreationQueue(); @@ -2868,10 +2838,10 @@ void ServerWorld::update(real time) PROFILER_AUTO_BLOCK_DEFINE("AiCombatPulseQueue::alter"); AiCombatPulseQueue::alter(time); } - - { + + { PROFILER_AUTO_BLOCK_DEFINE("ServerWorld::conclude"); - + ServerObject::concludeScriptVars(); static std::vector deferredConcludes; // for objects not initialized deferredConcludes.clear(); @@ -2879,10 +2849,10 @@ void ServerWorld::update(real time) if (!gs_pendingConcludeVector.empty()) { { - PROFILER_AUTO_BLOCK_DEFINE("ServerWorld::emptyPending"); + PROFILER_AUTO_BLOCK_DEFINE("ServerWorld::emptyPending"); std::vector::iterator concludeIter; gs_pendingConcludeLock = true; - for(concludeIter = gs_pendingConcludeVector.begin(); concludeIter != gs_pendingConcludeVector.end(); ++concludeIter) + for (concludeIter = gs_pendingConcludeVector.begin(); concludeIter != gs_pendingConcludeVector.end(); ++concludeIter) { ServerObject *o = (*concludeIter)->asServerObject(); WARNING_STRICT_FATAL(!o, ("nullptr object in conclude list!")); @@ -2898,28 +2868,28 @@ void ServerWorld::update(real time) gs_pendingConcludeLock = false; } { - PROFILER_AUTO_BLOCK_DEFINE("ServerWorld::pendingConcludeOps"); + PROFILER_AUTO_BLOCK_DEFINE("ServerWorld::pendingConcludeOps"); std::vector >::iterator po; - for(po = gs_pendingConcludeOpsVector.begin(); po != gs_pendingConcludeOpsVector.end(); ++po) + for (po = gs_pendingConcludeOpsVector.begin(); po != gs_pendingConcludeOpsVector.end(); ++po) { - switch((*po).first) + switch ((*po).first) { - case 0: - addObjectToConcludeList((*po).second); - break; - case 1: - removeObjectFromGame(*(*po).second); - break; - default: - break; + case 0: + addObjectToConcludeList((*po).second); + break; + case 1: + removeObjectFromGame(*(*po).second); + break; + default: + break; } } gs_pendingConcludeOpsVector.clear(); } { - PROFILER_AUTO_BLOCK_DEFINE("ServerWorld::addDeferredConclude"); + PROFILER_AUTO_BLOCK_DEFINE("ServerWorld::addDeferredConclude"); std::vector::iterator i; - for(i = deferredConcludes.begin(); i != deferredConcludes.end(); ++i) + for (i = deferredConcludes.begin(); i != deferredConcludes.end(); ++i) { addObjectToConcludeList(*i); } @@ -2945,16 +2915,16 @@ void ServerWorld::update(real time) weatherFrameCount = 10; std::string buffer; getWeather().debugPrint(buffer); - DEBUG_REPORT_LOG(true,("Weather data is %s\n",buffer.c_str())); - } -#endif + DEBUG_REPORT_LOG(true, ("Weather data is %s\n", buffer.c_str())); } +#endif +} updatePlanetServer(); LineOfSightCache::update(); - World::endFrame (); + World::endFrame(); } //----------------------------------------------------------------------- @@ -2969,28 +2939,28 @@ const std::string &ServerWorld::getSceneId() const ObjectNotification &ServerWorld::getTangibleNotification() { - return ServerWorldTangibleNotification::getInstance (); + return ServerWorldTangibleNotification::getInstance(); } //----------------------------------------------------------------------- const ObjectNotification &ServerWorld::getTerrainObjectNotification() { - return ServerWorldTerrainObjectNotification::getInstance (); + return ServerWorldTerrainObjectNotification::getInstance(); } //----------------------------------------------------------------------- const ObjectNotification &ServerWorld::getIntangibleNotification() { - return ServerWorldIntangibleNotification::getInstance (); + return ServerWorldIntangibleNotification::getInstance(); } //----------------------------------------------------------------------- const ObjectNotification &ServerWorld::getUniverseNotification() { - return ServerWorldUniverseNotification::getInstance (); + return ServerWorldUniverseNotification::getInstance(); } //------------------------------------------------------------------- @@ -3022,12 +2992,12 @@ void ServerWorld::removeLoadBeacon(const TangibleObject * loadBeacon) bool ServerWorld::isInLoadBeaconRange(const Vector & worldPosition) { std::vector::const_iterator i; - for(i = ServerWorldNamespace::s_loadBeaconEntries.begin(); i != ServerWorldNamespace::s_loadBeaconEntries.end(); ++i) + for (i = ServerWorldNamespace::s_loadBeaconEntries.begin(); i != ServerWorldNamespace::s_loadBeaconEntries.end(); ++i) { float radius = static_cast((*i)->getInterestRadius()) + 300.0f; radius = radius * radius * 2; Vector beaconPosition = (*i)->getTransform_o2w().getPosition_p(); - if(beaconPosition.magnitudeBetweenSquared(worldPosition) < radius) + if (beaconPosition.magnitudeBetweenSquared(worldPosition) < radius) return true; } return false; @@ -3036,7 +3006,7 @@ bool ServerWorld::isInLoadBeaconRange(const Vector & worldPosition) //----------------------------------------------------------------------- /** - * Finds a "good" location in the world where we can place an object. Good is + * Finds a "good" location in the world where we can place an object. Good is * defined as a resonably flat area, not in water, where the object being placed * won't intersect other objects. The caller may disable the slope or water check * if they want. @@ -3048,69 +3018,69 @@ bool ServerWorld::isInLoadBeaconRange(const Vector & worldPosition) * @param dontCheckWater flag to skip the underwater check * @param dontCheckSlope flag to skip the slope check * - * @return a position in the world where the object can be placed, or 0 0 0 if + * @return a position in the world where the object can be placed, or 0 0 0 if * there is no valid position */ -Vector ServerWorld::getGoodLocation(float areaSizeX, float areaSizeZ, - const Vector & searchRectLowerLeftLocation, - const Vector & searchRectUpperRightLocation, +Vector ServerWorld::getGoodLocation(float areaSizeX, float areaSizeZ, + const Vector & searchRectLowerLeftLocation, + const Vector & searchRectUpperRightLocation, bool dontCheckWater, bool dontCheckSlope) { PROFILER_AUTO_BLOCK_DEFINE("ServerWorld::getGoodLocation"); Vector goodLocation; - TerrainObject const * const terrainObject = TerrainObject::getInstance (); + TerrainObject const * const terrainObject = TerrainObject::getInstance(); if (!terrainObject) { - DEBUG_WARNING (true, ("getGoodLocation (): PB there is no terrain system")); + DEBUG_WARNING(true, ("getGoodLocation (): PB there is no terrain system")); return goodLocation; } - LotManager const * const lotManager = ServerWorld::getConstLotManager (); + LotManager const * const lotManager = ServerWorld::getConstLotManager(); if (!lotManager) { - DEBUG_WARNING (true, ("getGoodLocation (): PB there is no lot system")); + DEBUG_WARNING(true, ("getGoodLocation (): PB there is no lot system")); return goodLocation; } //build searching rectangles from the given locations const float minimum = -8192.f + 512.f; - const float maximum = 8192.f - 512.f; + const float maximum = 8192.f - 512.f; Rectangle2d searchRect; searchRect.x0 = searchRectLowerLeftLocation.x; - searchRect.x0 = clamp (minimum, searchRectLowerLeftLocation.x, maximum); + searchRect.x0 = clamp(minimum, searchRectLowerLeftLocation.x, maximum); searchRect.y0 = searchRectLowerLeftLocation.z; - searchRect.y0 = clamp (minimum, searchRectLowerLeftLocation.z, maximum); + searchRect.y0 = clamp(minimum, searchRectLowerLeftLocation.z, maximum); searchRect.x1 = searchRectUpperRightLocation.x; - searchRect.x1 = clamp (minimum, searchRectUpperRightLocation.x, maximum); + searchRect.x1 = clamp(minimum, searchRectUpperRightLocation.x, maximum); searchRect.y1 = searchRectUpperRightLocation.z; - searchRect.y1 = clamp (minimum, searchRectUpperRightLocation.z, maximum); + searchRect.y1 = clamp(minimum, searchRectUpperRightLocation.z, maximum); //validate scripter-input rectangle areas > 0 if (searchRect.x0 > searchRect.x1) { - DEBUG_WARNING (true, ("getGoodLocation (): DB searchRect.x0 (%1.2f) > searchRect.x1 (%1.2f)", searchRect.x0, searchRect.x1)); + DEBUG_WARNING(true, ("getGoodLocation (): DB searchRect.x0 (%1.2f) > searchRect.x1 (%1.2f)", searchRect.x0, searchRect.x1)); return goodLocation; } if (searchRect.y0 > searchRect.y1) { - DEBUG_WARNING (true, ("getGoodLocation (): DB searchRect.z0 (%1.2f) > searchRect.z1 (%1.2f)", searchRect.y0, searchRect.y1)); + DEBUG_WARNING(true, ("getGoodLocation (): DB searchRect.z0 (%1.2f) > searchRect.z1 (%1.2f)", searchRect.y0, searchRect.y1)); return goodLocation; } //validate that the area we want to find is smaller than our search area if (areaSizeX > searchRect.getWidth()) { - DEBUG_WARNING (true, ("getGoodLocation (): DB goal rectangle x (%1.2f) is larger than our search rectangle width (%1.2f)", areaSizeX, searchRect.getWidth())); + DEBUG_WARNING(true, ("getGoodLocation (): DB goal rectangle x (%1.2f) is larger than our search rectangle width (%1.2f)", areaSizeX, searchRect.getWidth())); return goodLocation; } if (areaSizeZ > searchRect.getHeight()) { - DEBUG_WARNING (true, ("getGoodLocation (): DB goal rectangle y (%1.2f) is larger than our search rectangle height (%1.2f)", areaSizeZ, searchRect.getHeight())); + DEBUG_WARNING(true, ("getGoodLocation (): DB goal rectangle y (%1.2f) is larger than our search rectangle height (%1.2f)", areaSizeZ, searchRect.getHeight())); return goodLocation; } @@ -3127,9 +3097,9 @@ Vector ServerWorld::getGoodLocation(float areaSizeX, float areaSizeZ, static std::vector yRange; xRange.clear(); yRange.clear(); - for(int i = 0; i < numRows; ++i) + for (int i = 0; i < numRows; ++i) xRange.push_back(i); - for(int j = 0; j < numCols; ++j) + for (int j = 0; j < numCols; ++j) yRange.push_back(j); std::random_shuffle(xRange.begin(), xRange.end()); @@ -3138,9 +3108,9 @@ Vector ServerWorld::getGoodLocation(float areaSizeX, float areaSizeZ, Rectangle2d successRect; bool success = false; Rectangle2d currentRect; - for(std::vector::iterator it_x = xRange.begin(); it_x != xRange.end() && !success; ++it_x) + for (std::vector::iterator it_x = xRange.begin(); it_x != xRange.end() && !success; ++it_x) { - for(std::vector::iterator it_y = yRange.begin(); it_y != yRange.end() && !success; ++it_y) + for (std::vector::iterator it_y = yRange.begin(); it_y != yRange.end() && !success; ++it_y) { currentRect = startingRect; @@ -3148,13 +3118,13 @@ Vector ServerWorld::getGoodLocation(float areaSizeX, float areaSizeZ, currentRect.translate(*it_x * areaSizeX, *it_y * areaSizeZ); //the rectangle is a "good location" if it has neither water nor a steep slope - if (!dontCheckWater && terrainObject->getWater (currentRect)) + if (!dontCheckWater && terrainObject->getWater(currentRect)) continue; - if (!dontCheckSlope && terrainObject->getSlope (currentRect)) + if (!dontCheckSlope && terrainObject->getSlope(currentRect)) continue; - if (!lotManager->canPlace (currentRect)) + if (!lotManager->canPlace(currentRect)) continue; success = true; @@ -3168,7 +3138,7 @@ Vector ServerWorld::getGoodLocation(float areaSizeX, float areaSizeZ, //validate that our success point lies within the search area (debugging tests) if (successRect.x0 < searchRect.x0 || successRect.x1 > searchRect.x1 || successRect.y0 < searchRect.y0 || successRect.y1 > searchRect.y1) { - DEBUG_WARNING (true, ("getGoodLocation (): PB result does not fit within the search location")); + DEBUG_WARNING(true, ("getGoodLocation (): PB result does not fit within the search location")); return goodLocation; } @@ -3178,7 +3148,7 @@ Vector ServerWorld::getGoodLocation(float areaSizeX, float areaSizeZ, //conver that point into a location-friendly 3d point goodLocation = Vector(successLoc2d.x, 0.f, successLoc2d.y); - IGNORE_RETURN( terrainObject->getHeightForceChunkCreation(goodLocation, goodLocation.y) ); + IGNORE_RETURN(terrainObject->getHeightForceChunkCreation(goodLocation, goodLocation.y)); return goodLocation; } // ServerWorld::getGoodLocation @@ -3186,7 +3156,7 @@ Vector ServerWorld::getGoodLocation(float areaSizeX, float areaSizeZ, //----------------------------------------------------------------------- /** -* Finds a "good" location in the world where we can place an object. Good is +* Finds a "good" location in the world where we can place an object. Good is * defined as a resonably flat area, not in water, where the object being placed * won't intersect other objects. The caller may disable the slope or water check * if they want. This function checks for nearby collidable static objects as well. @@ -3199,69 +3169,69 @@ Vector ServerWorld::getGoodLocation(float areaSizeX, float areaSizeZ, * @param dontCheckSlope flag to skip the slope check * @param minStaticObjDistance the minimum distance a static object must be away from a "good" location * -* @return a position in the world where the object can be placed, or 0 0 0 if +* @return a position in the world where the object can be placed, or 0 0 0 if * there is no valid position */ -Vector ServerWorld::getGoodLocationAvoidCollidables(float areaSizeX, float areaSizeZ, - const Vector & searchRectLowerLeftLocation, - const Vector & searchRectUpperRightLocation, - bool dontCheckWater, bool dontCheckSlope, float minStaticObjDistance) +Vector ServerWorld::getGoodLocationAvoidCollidables(float areaSizeX, float areaSizeZ, + const Vector & searchRectLowerLeftLocation, + const Vector & searchRectUpperRightLocation, + bool dontCheckWater, bool dontCheckSlope, float minStaticObjDistance) { PROFILER_AUTO_BLOCK_DEFINE("ServerWorld::getGoodLocation"); Vector goodLocation; - TerrainObject const * const terrainObject = TerrainObject::getInstance (); + TerrainObject const * const terrainObject = TerrainObject::getInstance(); if (!terrainObject) { - DEBUG_WARNING (true, ("getGoodLocation (): PB there is no terrain system")); + DEBUG_WARNING(true, ("getGoodLocation (): PB there is no terrain system")); return goodLocation; } - LotManager const * const lotManager = ServerWorld::getConstLotManager (); + LotManager const * const lotManager = ServerWorld::getConstLotManager(); if (!lotManager) { - DEBUG_WARNING (true, ("getGoodLocation (): PB there is no lot system")); + DEBUG_WARNING(true, ("getGoodLocation (): PB there is no lot system")); return goodLocation; } //build searching rectangles from the given locations const float minimum = -8192.f + 512.f; - const float maximum = 8192.f - 512.f; + const float maximum = 8192.f - 512.f; Rectangle2d searchRect; searchRect.x0 = searchRectLowerLeftLocation.x; - searchRect.x0 = clamp (minimum, searchRectLowerLeftLocation.x, maximum); + searchRect.x0 = clamp(minimum, searchRectLowerLeftLocation.x, maximum); searchRect.y0 = searchRectLowerLeftLocation.z; - searchRect.y0 = clamp (minimum, searchRectLowerLeftLocation.z, maximum); + searchRect.y0 = clamp(minimum, searchRectLowerLeftLocation.z, maximum); searchRect.x1 = searchRectUpperRightLocation.x; - searchRect.x1 = clamp (minimum, searchRectUpperRightLocation.x, maximum); + searchRect.x1 = clamp(minimum, searchRectUpperRightLocation.x, maximum); searchRect.y1 = searchRectUpperRightLocation.z; - searchRect.y1 = clamp (minimum, searchRectUpperRightLocation.z, maximum); + searchRect.y1 = clamp(minimum, searchRectUpperRightLocation.z, maximum); //validate scripter-input rectangle areas > 0 if (searchRect.x0 > searchRect.x1) { - DEBUG_WARNING (true, ("getGoodLocation (): DB searchRect.x0 (%1.2f) > searchRect.x1 (%1.2f)", searchRect.x0, searchRect.x1)); + DEBUG_WARNING(true, ("getGoodLocation (): DB searchRect.x0 (%1.2f) > searchRect.x1 (%1.2f)", searchRect.x0, searchRect.x1)); return goodLocation; } if (searchRect.y0 > searchRect.y1) { - DEBUG_WARNING (true, ("getGoodLocation (): DB searchRect.z0 (%1.2f) > searchRect.z1 (%1.2f)", searchRect.y0, searchRect.y1)); + DEBUG_WARNING(true, ("getGoodLocation (): DB searchRect.z0 (%1.2f) > searchRect.z1 (%1.2f)", searchRect.y0, searchRect.y1)); return goodLocation; } //validate that the area we want to find is smaller than our search area if (areaSizeX > searchRect.getWidth()) { - DEBUG_WARNING (true, ("getGoodLocation (): DB goal rectangle x (%1.2f) is larger than our search rectangle width (%1.2f)", areaSizeX, searchRect.getWidth())); + DEBUG_WARNING(true, ("getGoodLocation (): DB goal rectangle x (%1.2f) is larger than our search rectangle width (%1.2f)", areaSizeX, searchRect.getWidth())); return goodLocation; } if (areaSizeZ > searchRect.getHeight()) { - DEBUG_WARNING (true, ("getGoodLocation (): DB goal rectangle y (%1.2f) is larger than our search rectangle height (%1.2f)", areaSizeZ, searchRect.getHeight())); + DEBUG_WARNING(true, ("getGoodLocation (): DB goal rectangle y (%1.2f) is larger than our search rectangle height (%1.2f)", areaSizeZ, searchRect.getHeight())); return goodLocation; } @@ -3278,9 +3248,9 @@ Vector ServerWorld::getGoodLocationAvoidCollidables(float areaSizeX, float areaS static std::vector yRange; xRange.clear(); yRange.clear(); - for(int i = 0; i < numRows; ++i) + for (int i = 0; i < numRows; ++i) xRange.push_back(i); - for(int j = 0; j < numCols; ++j) + for (int j = 0; j < numCols; ++j) yRange.push_back(j); std::random_shuffle(xRange.begin(), xRange.end()); @@ -3289,9 +3259,9 @@ Vector ServerWorld::getGoodLocationAvoidCollidables(float areaSizeX, float areaS Rectangle2d successRect; bool success = false; Rectangle2d currentRect; - for(std::vector::iterator it_x = xRange.begin(); it_x != xRange.end() && !success; ++it_x) + for (std::vector::iterator it_x = xRange.begin(); it_x != xRange.end() && !success; ++it_x) { - for(std::vector::iterator it_y = yRange.begin(); it_y != yRange.end() && !success; ++it_y) + for (std::vector::iterator it_y = yRange.begin(); it_y != yRange.end() && !success; ++it_y) { currentRect = startingRect; @@ -3299,15 +3269,15 @@ Vector ServerWorld::getGoodLocationAvoidCollidables(float areaSizeX, float areaS currentRect.translate(*it_x * areaSizeX, *it_y * areaSizeZ); //the rectangle is a "good location" if it has neither water nor a steep slope - if (!dontCheckWater && terrainObject->getWater (currentRect)) + if (!dontCheckWater && terrainObject->getWater(currentRect)) continue; - if (!dontCheckSlope && terrainObject->getSlope (currentRect)) + if (!dontCheckSlope && terrainObject->getSlope(currentRect)) continue; - if (!lotManager->canPlace (currentRect)) + if (!lotManager->canPlace(currentRect)) continue; - + // Look for nearby static collidable objects. std::vector collidables; Vector2d Loc2d = currentRect.getCenter(); @@ -3315,7 +3285,7 @@ Vector ServerWorld::getGoodLocationAvoidCollidables(float areaSizeX, float areaS ServerWorld::findStaticCollidableObjectsInRange(checkLoc, minStaticObjDistance, collidables); - if(!collidables.empty()) + if (!collidables.empty()) continue; success = true; @@ -3329,7 +3299,7 @@ Vector ServerWorld::getGoodLocationAvoidCollidables(float areaSizeX, float areaS //validate that our success point lies within the search area (debugging tests) if (successRect.x0 < searchRect.x0 || successRect.x1 > searchRect.x1 || successRect.y0 < searchRect.y0 || successRect.y1 > searchRect.y1) { - DEBUG_WARNING (true, ("getGoodLocation (): PB result does not fit within the search location")); + DEBUG_WARNING(true, ("getGoodLocation (): PB result does not fit within the search location")); return goodLocation; } @@ -3339,7 +3309,7 @@ Vector ServerWorld::getGoodLocationAvoidCollidables(float areaSizeX, float areaS //convert that point into a location-friendly 3d point goodLocation = Vector(successLoc2d.x, 0.f, successLoc2d.y); - IGNORE_RETURN( terrainObject->getHeightForceChunkCreation(goodLocation, goodLocation.y) ); + IGNORE_RETURN(terrainObject->getHeightForceChunkCreation(goodLocation, goodLocation.y)); return goodLocation; } // ServerWorld::getGoodLocationAvoidCollidables @@ -3386,8 +3356,8 @@ bool ServerWorld::isSpaceScene() { if (!s_checkedForSpaceScene) { - s_spaceScene=(strncmp("space_",getSceneId().c_str(),6)==0); - s_checkedForSpaceScene=true; + s_spaceScene = (strncmp("space_", getSceneId().c_str(), 6) == 0); + s_checkedForSpaceScene = true; } return s_spaceScene; @@ -3577,5 +3547,4 @@ void ServerWorldNamespace::updatePlanetServer() } } -// ====================================================================== - +// ====================================================================== \ No newline at end of file diff --git a/engine/server/library/serverGame/src/shared/objectTemplate/ServerXpManagerObjectTemplate.cpp b/engine/server/library/serverGame/src/shared/objectTemplate/ServerXpManagerObjectTemplate.cpp index 0ea899e7..332585f5 100755 --- a/engine/server/library/serverGame/src/shared/objectTemplate/ServerXpManagerObjectTemplate.cpp +++ b/engine/server/library/serverGame/src/shared/objectTemplate/ServerXpManagerObjectTemplate.cpp @@ -29,15 +29,15 @@ const TriggerVolumeData DefaultTriggerVolumeData; bool ServerXpManagerObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ ServerXpManagerObjectTemplate::ServerXpManagerObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : ServerUniverseObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // ServerXpManagerObjectTemplate::ServerXpManagerObjectTemplate @@ -46,8 +46,8 @@ ServerXpManagerObjectTemplate::ServerXpManagerObjectTemplate(const std::string & */ ServerXpManagerObjectTemplate::~ServerXpManagerObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // ServerXpManagerObjectTemplate::~ServerXpManagerObjectTemplate /** @@ -110,7 +110,7 @@ Tag ServerXpManagerObjectTemplate::getHighestTemplateVersion(void) const */ Object * ServerXpManagerObjectTemplate::createObject(void) const { -// return new XpManagerObject(this); + // return new XpManagerObject(this); return nullptr; } // ServerXpManagerObjectTemplate::createObject @@ -124,8 +124,8 @@ Object * ServerXpManagerObjectTemplate::createObject(void) const */ void ServerXpManagerObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != ServerXpManagerObjectTemplate_tag) { @@ -135,7 +135,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -155,10 +155,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -176,4 +174,4 @@ char paramName[MAX_NAME_SIZE]; return; } // ServerXpManagerObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/server/library/serverKeyShare/src/shared/KeyShare.cpp b/engine/server/library/serverKeyShare/src/shared/KeyShare.cpp index fc46f736..7c92da55 100755 --- a/engine/server/library/serverKeyShare/src/shared/KeyShare.cpp +++ b/engine/server/library/serverKeyShare/src/shared/KeyShare.cpp @@ -2,7 +2,6 @@ // copyright 2000 Verant Interactive // Author: Justin Randall - //----------------------------------------------------------------------- #include "serverKeyShare/FirstServerKeyShare.h" @@ -13,13 +12,13 @@ //----------------------------------------------------------------------- -KeyShare::Token::Token(const unsigned char * const newCipherData, - const uint32 newDataLen, - const unsigned char newDigest[KeyShareConstants::keyLength], - const uint32 newCipherDataLen) : -cipherData(0), -cipherDataLen(newCipherDataLen), -dataLen(newDataLen) +KeyShare::Token::Token(const unsigned char * const newCipherData, + const uint32 newDataLen, + const unsigned char newDigest[KeyShareConstants::keyLength], + const uint32 newCipherDataLen) : + cipherData(0), + cipherDataLen(newCipherDataLen), + dataLen(newDataLen) { cipherData = new unsigned char[cipherDataLen]; memcpy(cipherData, newCipherData, cipherDataLen); @@ -29,9 +28,9 @@ dataLen(newDataLen) //----------------------------------------------------------------------- KeyShare::Token::Token(const Token & source) : -cipherData(0), -cipherDataLen(source.cipherDataLen), -dataLen(source.dataLen) + cipherData(0), + cipherDataLen(source.cipherDataLen), + dataLen(source.dataLen) { cipherData = new unsigned char[cipherDataLen]; memcpy(cipherData, source.cipherData, cipherDataLen); @@ -39,25 +38,25 @@ dataLen(source.dataLen) } //----------------------------------------------------------------------- - + KeyShare::Token::Token(Archive::ReadIterator & source) : -cipherData(0), -cipherDataLen(0), -dataLen(0) + cipherData(0), + cipherDataLen(0), + dataLen(0) { Archive::get(source, cipherDataLen); // if the cipher data has been tampered with, don't unpack it. The vaidation will fail - if(cipherDataLen < 64) + if (cipherDataLen < 64) { Archive::get(source, dataLen); cipherData = new unsigned char[cipherDataLen]; unsigned int i; - for(i = 0; i < cipherDataLen; i ++) + for (i = 0; i < cipherDataLen; i++) { Archive::get(source, cipherData[i]); } - for(i = 0; i < KeyShareConstants::keyLength; i ++) + for (i = 0; i < KeyShareConstants::keyLength; i++) { Archive::get(source, digest[i]); } @@ -112,11 +111,11 @@ void KeyShare::Token::pack(Archive::ByteStream & target) const Archive::put(target, cipherDataLen); Archive::put(target, dataLen); unsigned int i; - for(i = 0; i < cipherDataLen; i ++) + for (i = 0; i < cipherDataLen; i++) { Archive::put(target, cipherData[i]); } - for(i = 0; i < KeyShareConstants::keyLength; i ++) + for (i = 0; i < KeyShareConstants::keyLength; i++) { Archive::put(target, digest[i]); } @@ -125,17 +124,17 @@ void KeyShare::Token::pack(Archive::ByteStream & target) const //----------------------------------------------------------------------- KeyShare::KeyShare(const unsigned int newKeyCount) : -decryptors(0), -encryptors(0), -hasher(0), -keyCount(newKeyCount), -keys(0) + decryptors(0), + encryptors(0), + hasher(0), + keyCount(newKeyCount), + keys(0) { keys = new Key[keyCount]; decryptors = new Crypto::TwofishDecryptor *[keyCount]; encryptors = new Crypto::TwofishEncryptor *[keyCount]; - for(unsigned int i = 0; i < keyCount; i ++) + for (unsigned int i = 0; i < keyCount; i++) { decryptors[i] = 0; encryptors[i] = 0; @@ -148,7 +147,7 @@ keys(0) KeyShare::~KeyShare() { delete[] keys; - for(unsigned int i = 0; i < keyCount; i ++) + for (unsigned int i = 0; i < keyCount; i++) { delete decryptors[i]; delete encryptors[i]; @@ -164,7 +163,7 @@ KeyShare::~KeyShare() bool KeyShare::decipherToken(const KeyShare::Token & token, unsigned char * clearTextData, uint32 & dataLen) const { bool result = false; - if(dataLen < token.getDataLen()) + if (dataLen < token.getDataLen()) { dataLen = token.getDataLen(); } @@ -175,10 +174,10 @@ bool KeyShare::decipherToken(const KeyShare::Token & token, unsigned char * clea unsigned char * clearText = new unsigned char[cipherDataLen]; memcpy(cipherText, token.getData(), cipherDataLen); - for(unsigned int i = 0; i < keyCount; i ++) + for (unsigned int i = 0; i < keyCount; i++) { DEBUG_REPORT_LOG(true, ("Decrypting with key: ")); - for(uint32 j = 0; j < 16; j ++) + for (uint32 j = 0; j < 16; j++) { DEBUG_REPORT_LOG(true, ("[%3i] ", keys[i].value[j])); } @@ -193,10 +192,10 @@ bool KeyShare::decipherToken(const KeyShare::Token & token, unsigned char * clea NOT_NULL(hasher); result = hasher->verify(digest, clearTextData, dataLen); - if(result) + if (result) { DEBUG_REPORT_LOG(true, ("succeeded\n")); - + break; } else @@ -215,14 +214,14 @@ bool KeyShare::decipherToken(const KeyShare::Token & token, unsigned char * clea void KeyShare::decrypt(const unsigned char * const sourceBuffer, const uint32 sourceBufferSize, unsigned char * resultBuffer, const uint32 keyIndex) const { const uint32 blockSize = decryptors[0]->getBlockSize(); - unsigned char * inBlock = new unsigned char [blockSize]; - unsigned char * outBlock = new unsigned char [blockSize]; + unsigned char * inBlock = new unsigned char[blockSize]; + unsigned char * outBlock = new unsigned char[blockSize]; memset(resultBuffer, 0, sourceBufferSize); - for(uint32 i = 0; i < sourceBufferSize; i += blockSize) + for (uint32 i = 0; i < sourceBufferSize; i += blockSize) { - if(i + blockSize > sourceBufferSize) + if (i + blockSize > sourceBufferSize) memcpy(inBlock, &sourceBuffer[i], sourceBufferSize - i); else memcpy(inBlock, &sourceBuffer[i], blockSize); @@ -241,7 +240,7 @@ const uint32 KeyShare::encrypt(const unsigned char * const sourceData, const uin const uint32 blockSize = encryptors[0]->getBlockSize(); // calculate the size of the encrypted result buffer - if(sourceDataSize % blockSize) + if (sourceDataSize % blockSize) { // if it's larger than some multiple of the cipher block size .... i = static_cast((sourceDataSize / blockSize) + 1) * blockSize; @@ -251,22 +250,22 @@ const uint32 KeyShare::encrypt(const unsigned char * const sourceData, const uin // it's already aligned on the cipher block byte boundary i = sourceDataSize; } - *resultBuffer = new unsigned char [i]; + *resultBuffer = new unsigned char[i]; DEBUG_REPORT_LOG(true, ("Encrypting with key: ")); - for(i = 0; i < 16; i ++) + for (i = 0; i < 16; i++) { DEBUG_REPORT_LOG(true, ("[%3i] ", keys[0].value[i])); } DEBUG_REPORT_LOG(true, ("\n")); - - unsigned char * inBlock = new unsigned char [blockSize]; - unsigned char * outBlock = new unsigned char [blockSize]; - for(i = 0; i < sourceDataSize; i += 16) + unsigned char * inBlock = new unsigned char[blockSize]; + unsigned char * outBlock = new unsigned char[blockSize]; + + for (i = 0; i < sourceDataSize; i += 16) { memset(inBlock, 0, KeyShareConstants::keyLength); - if(i + blockSize > sourceDataSize) + if (i + blockSize > sourceDataSize) memcpy(inBlock, &sourceData[i], sourceDataSize - i); else memcpy(inBlock, &sourceData[i], KeyShareConstants::keyLength); @@ -283,10 +282,9 @@ const uint32 KeyShare::encrypt(const unsigned char * const sourceData, const uin bool KeyShare::hasKey(const Key & source) { - for(unsigned int i = 0; i < getKeyCount(); i ++) + for (unsigned int i = 0; i < getKeyCount(); i++) { - - if(memcmp(source.value, keys[i].value, KeyShareConstants::keyLength) == 0) + if (memcmp(source.value, keys[i].value, KeyShareConstants::keyLength) == 0) return true; } return false; @@ -306,7 +304,7 @@ KeyShare::Token KeyShare::makeToken(const unsigned char * const data, const uint // encrypt the digest unsigned char * cipherDigest; IGNORE_RETURN(encrypt(digest, KeyShareConstants::keyLength, &cipherDigest)); ///@todo error checking - + // encrypt the cleartext data unsigned char * cipherData = 0; uint32 cipherDataLen = encrypt(data, dataLen, &cipherData); @@ -314,7 +312,7 @@ KeyShare::Token KeyShare::makeToken(const unsigned char * const data, const uint // build a token using the ciphertext data and digest Token token(cipherData, dataLen, cipherDigest, cipherDataLen); - // clean up allocation for cipher text, + // clean up allocation for cipher text, // it was deep copied in the token delete[] cipherData; delete[] cipherDigest; @@ -347,7 +345,7 @@ void KeyShare::setKey(const Key & newKey, const unsigned int index) void KeyShare::shift(void) { // shift key array - for(unsigned int i = getKeyCount() - 1; i > 0; i --) + for (unsigned int i = getKeyCount() - 1; i > 0; i--) { setKey(getKey(i - 1), i); } @@ -356,14 +354,15 @@ void KeyShare::shift(void) //----------------------------------------------------------------------- AutoVariableKeyShare::AutoVariableKeyShare() : -AutoVariableBase() + AutoVariableBase(), + value() { } //----------------------------------------------------------------------- AutoVariableKeyShare::AutoVariableKeyShare(const KeyShare::Key & source) : -AutoVariableBase() + AutoVariableBase() { value = source; } @@ -400,17 +399,16 @@ AutoVariableKeyShare::operator const KeyShare::Key & () const void AutoVariableKeyShare::pack(Archive::ByteStream & target) const { - for(unsigned int i = 0; i < KeyShareConstants::keyLength; ++i) + for (unsigned int i = 0; i < KeyShareConstants::keyLength; ++i) Archive::put(target, value.value[i]); - } //----------------------------------------------------------------------- -void AutoVariableKeyShare::unpack(Archive::ReadIterator & source) +void AutoVariableKeyShare::unpack(Archive::ReadIterator & source) { - for(unsigned int i = 0; i < KeyShareConstants::keyLength; ++i) + for (unsigned int i = 0; i < KeyShareConstants::keyLength; ++i) Archive::get(source, value.value[i]); } -//----------------------------------------------------------------------- +//----------------------------------------------------------------------- \ No newline at end of file diff --git a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp index 52c11b4d..2125176f 100755 --- a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp +++ b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp @@ -60,7 +60,6 @@ using namespace JNIWrappersNamespace; // macros //======================================================================== - #define GET_CLASS(var, name) tempClass = ms_env->FindClass(name); if (ms_env->ExceptionCheck()) { ms_env->ExceptionDescribe(); WARNING(true, ("Unable to find Java class "#name)); return false; } var = static_cast(ms_env->NewGlobalRef(tempClass)); ms_env->DeleteLocalRef(tempClass); if (var == 0) { DEBUG_WARNING(true, ("Unable to create global reference for JavaLibrary " #var )); return false; } #define GET_FIELD(var, clazz, name, sig) var = ms_env->GetFieldID(clazz, name, sig); if (ms_env->ExceptionCheck()) { ms_env->ExceptionDescribe(); WARNING(true, ("Unable to find Java field "#name" for class "#clazz)); return false; } #define GET_METHOD(var, clazz, name, sig) var = ms_env->GetMethodID(clazz, name, sig); if (ms_env->ExceptionCheck()) { ms_env->ExceptionDescribe(); WARNING(true, ("Unable to find Java method "#name" for class "#clazz)); return false; } @@ -72,7 +71,6 @@ using namespace JNIWrappersNamespace; // local constants //======================================================================== - // set path to jvm #if defined(WIN32) #define PATH_SEPARATOR ";" @@ -84,14 +82,13 @@ const char *JNI_DLL_PATH = "libjvm.so"; #endif extern "C" { -typedef jint (JNICALL *JNI_CREATEJAVAVMPROC)(JavaVM**, void**, void*); + typedef jint(JNICALL *JNI_CREATEJAVAVMPROC)(JavaVM**, void**, void*); } //======================================================================== // JNI native function namespaces //======================================================================== - namespace ScriptMethodsActionStatesNamespace { bool install(); @@ -721,7 +718,7 @@ jmethodID JavaLibrary::ms_midLibraryGMLibUnfreeze = nullptr; ////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// -int JavaLibrary::ms_loaded = 0; +volatile int JavaLibrary::ms_loaded = 0; Semaphore * JavaLibrary::ms_shutdownJava = nullptr; int JavaLibrary::GlobalInstances::ms_stringIdIndex = 0; @@ -740,7 +737,6 @@ GlobalRefPtr JavaLibrary::GlobalInstances::ms_menuInfo; GlobalArrayRefPtr JavaLibrary::ms_attribModList[MAX_RECURSION_COUNT]; GlobalArrayRefPtr JavaLibrary::ms_mentalStateModList[MAX_RECURSION_COUNT]; - // ====================================================================== std::set s_profileSections; @@ -783,7 +779,6 @@ void JavaLibrary::fatalHandler(int signum) fprintf(stderr, "In JavaLibrary::fatalHandler, signal %d: ", signum); if (signum == SIGSEGV && ms_jvm) { - // try to see if our call stack came from C or Java void *frameAddress = __builtin_frame_address(0); // the address that generated the segfault is stored at an offset of 0x44 from @@ -811,14 +806,14 @@ void JavaLibrary::fatalHandler(int signum) if (crashAddress2a != nullptr) { frameAddressA = __builtin_frame_address(1); - if (frameAddressA != nullptr && + if (frameAddressA != nullptr && (reinterpret_cast(frameAddressA) >> 16 == frameAddressHigh)) { crashAddress2b = __builtin_return_address(1); if (crashAddress2b != nullptr) { frameAddressB = __builtin_frame_address(2); - if (frameAddressB != nullptr && + if (frameAddressB != nullptr && (reinterpret_cast(frameAddressB) >> 16 == frameAddressHigh)) { crashAddress2c = __builtin_return_address(2); @@ -882,7 +877,7 @@ void JavaLibrary::fatalHandler(int signum) */ JavaLibrary::JavaLibrary(void) { -int i; + int i; if (ms_instance != nullptr || ms_loaded != 0) return; @@ -908,7 +903,6 @@ int i; for (i = 0; i < MAX_MODIFIABLE_STRING_ID_PARAMS; ++i) GlobalInstances::ms_modifiableStringIds[i] = GlobalRef::cms_nullPtr; - m_initializerThread = new MemberFunctionThreadZero("JavaLibrary", *this, &JavaLibrary::initializeJavaThread); ThreadHandle tempThreadHandle(m_initializerThread); // for some obscure reason, the thread doesn't run unless you create a handle, but we don't need the handle for anything UNREF(tempThreadHandle); @@ -932,7 +926,7 @@ int i; */ JavaLibrary::~JavaLibrary() { - disconnectFromJava(); + disconnectFromJava(); if (ms_shutdownJava != nullptr) { @@ -966,7 +960,7 @@ void JavaLibrary::install(void) { delete lib; if (ms_javaVmType != JV_none) - FATAL (true, ("Unable to initialize Java")); + FATAL(true, ("Unable to initialize Java")); } } } @@ -1051,7 +1045,7 @@ void JavaLibrary::initializeJavaThread() classPath += ConfigServerGame::getScriptPath(); JavaVMInitArgs vm_args; - JavaVMOption tempOption = {nullptr, nullptr}; + JavaVMOption tempOption = { nullptr, nullptr }; std::vector options; char *jdwpBuffer = nullptr; @@ -1084,8 +1078,8 @@ void JavaLibrary::initializeJavaThread() // java 1.8 and higher uses metaspace...which is apparently unlimited by default // we have to consider it with our 512m max above so 96 on 32-bit is as high as we go - tempOption.optionString = "-XX:MaxMetaspaceSize=96m"; - options.push_back(tempOption); + tempOption.optionString = "-XX:MaxMetaspaceSize=96m"; + options.push_back(tempOption); // rice options!!!!1! yay - actually after much trial and error these are a good mix for speed and efficiency // i should split these someday into separate optionStrings...or not @@ -1128,17 +1122,17 @@ void JavaLibrary::initializeJavaThread() tempOption.optionString = const_cast(classPath.c_str()); options.push_back(tempOption); -// TODO: this really sucks as the jvm won't start without the param -// there's a dynamic method but requires the jvm to already be running, wtf? -// so we'll support the dev and stable versions + // TODO: this really sucks as the jvm won't start without the param + // there's a dynamic method but requires the jvm to already be running, wtf? + // so we'll support the dev and stable versions #ifdef JNI_VERSION_1_9 - vm_args.version = JNI_VERSION_1_9; + vm_args.version = JNI_VERSION_1_9; #define JNIVERSET = 1 #endif #if !defined(JNIVERSET) && defined(JNI_VERSION_1_8) vm_args.version = JNI_VERSION_1_8; -#define JNIVERSET = 1 +#define JNIVERSET = 1 #endif #ifdef JNIVERSET @@ -1153,11 +1147,11 @@ void JavaLibrary::initializeJavaThread() // create the JVM JNIEnv * env = nullptr; - jint result = (*JNI_CreateJavaVMProc)(&ms_jvm, reinterpret_cast(&env), &vm_args); + jint result = (*JNI_CreateJavaVMProc)(&ms_jvm, reinterpret_cast(&env), &vm_args); if (result != 0) { - FATAL (true, ("Failed to CreateJavaVMProc: %d", result)); + FATAL(true, ("Failed to CreateJavaVMProc: %d", result)); ms_loaded = -1; return; } @@ -1165,7 +1159,7 @@ void JavaLibrary::initializeJavaThread() // i don't think this bit functions anymore with new java? if (ConfigServerGame::getTrapScriptCrashes()) - { + { //set up signal handler for fatals in linux OurSa.sa_handler = fatalHandler; sigemptyset(&OurSa.sa_mask); @@ -1199,10 +1193,10 @@ void JavaLibrary::initializeJavaThread() //---------------------------------------------------------------------- /** - * Connects this thread to the Java VM and initializes our member vars that + * Connects this thread to the Java VM and initializes our member vars that * reference Java objects. * - * @return true on success, false if we were unable to connect to Java or + * @return true on success, false if we were unable to connect to Java or * initialize our members */ bool JavaLibrary::connectToJava() @@ -1250,10 +1244,10 @@ bool JavaLibrary::connectToJava() ms_env->ExceptionDescribe(); return false; } - jobject localEntry = ms_env->NewObject(ms_clsScriptEntry, constructor, + jobject localEntry = ms_env->NewObject(ms_clsScriptEntry, constructor, scriptPath.getValue(), ConfigServerGame::getJavaConsoleDebugMessages(), - ConfigServerGame::getCrashOnScriptError(), + ConfigServerGame::getCrashOnScriptError(), ConfigServerGame::getScriptWatcherWarnTime(), ConfigServerGame::getScriptWatcherInterruptTime(), ConfigServerGame::getScriptStackErrorLimit(), @@ -1267,7 +1261,7 @@ bool JavaLibrary::connectToJava() ms_env->DeleteLocalRef(localEntry); // get the methodIDs for the runScript() and the unloadClass() methods - GET_STATIC_METHOD(ms_midRunOne,ms_clsScriptEntry, "runScript", "(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)I"); + GET_STATIC_METHOD(ms_midRunOne, ms_clsScriptEntry, "runScript", "(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)I"); GET_STATIC_METHOD(ms_midRunAll, ms_clsScriptEntry, "runScripts", "(Ljava/lang/String;[Ljava/lang/Object;)I"); GET_STATIC_METHOD(ms_midCallMessages, ms_clsScriptEntry, "callMessageHandlers", "(Ljava/lang/String;JLscript/dictionary;)I"); GET_STATIC_METHOD(ms_midRunConsoleHandler, ms_clsScriptEntry, "runConsoleHandler", "(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;"); @@ -1713,7 +1707,7 @@ bool JavaLibrary::connectToJava() GET_FIELD(ms_fidCombatEngineCombatantDataPosture, ms_clsCombatEngineCombatantData, "posture", "I"); GET_FIELD(ms_fidCombatEngineCombatantDataLocomotion, ms_clsCombatEngineCombatantData, "locomotion", "I"); GET_FIELD(ms_fidCombatEngineCombatantDataScriptMod, ms_clsCombatEngineCombatantData, "scriptMod", "I"); - + GET_CLASS(ms_clsCombatEngineAttackerData, "script/combat_engine$attacker_data"); GET_FIELD(ms_fidCombatEngineAttackerDataWeaponSkill, ms_clsCombatEngineAttackerData, "weaponSkillMod", "I"); GET_FIELD(ms_fidCombatEngineAttackerDataAims, ms_clsCombatEngineAttackerData, "aims", "I"); @@ -1734,7 +1728,7 @@ bool JavaLibrary::connectToJava() GET_FIELD(ms_fidCombatEngineWeaponDataElementalValue, ms_clsCombatEngineWeaponData, "elementalValue", "I"); GET_FIELD(ms_fidCombatEngineWeaponDataAttackSpeed, ms_clsCombatEngineWeaponData, "attackSpeed", "F"); GET_FIELD(ms_fidCombatEngineWeaponDataWoundChance, ms_clsCombatEngineWeaponData, "woundChance", "F"); - GET_FIELD(ms_fidCombatEngineWeaponDataAccuracy, ms_clsCombatEngineWeaponData, "accuracy", "I"); + GET_FIELD(ms_fidCombatEngineWeaponDataAccuracy, ms_clsCombatEngineWeaponData, "accuracy", "I"); GET_FIELD(ms_fidCombatEngineWeaponDataMinRange, ms_clsCombatEngineWeaponData, "minRange", "F"); GET_FIELD(ms_fidCombatEngineWeaponDataMaxRange, ms_clsCombatEngineWeaponData, "maxRange", "F"); GET_FIELD(ms_fidCombatEngineWeaponDataDamageRadius, ms_clsCombatEngineWeaponData, "damageRadius", "F"); @@ -1838,23 +1832,20 @@ bool JavaLibrary::connectToJava() GET_CLASS(ms_clsLibrarySpaceTransition, "script/library/space_transition"); GET_STATIC_METHOD(ms_midLibrarySpaceTransitionSetPlayerOvert, ms_clsLibrarySpaceTransition, "setPlayerOvert", "(J)V"); GET_STATIC_METHOD(ms_midLibrarySpaceTransitionClearOvertStatus, ms_clsLibrarySpaceTransition, "clearOvertStatus", "(J)V"); - + /////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// - + // get class and field info needed by the CS Handler stuff. These may not have been // written specifically for the CS Handler. - - - - GET_CLASS( ms_clsLibraryDump, "script/library/dump" ); - GET_STATIC_METHOD( ms_midLibraryDumpDumpTargetInfo, ms_clsLibraryDump, "getTargetInfoStringByLong", "(J)Ljava/lang/String;" ); - - GET_CLASS( ms_clsLibraryGMLib, "script/library/gmlib" ); - GET_STATIC_METHOD( ms_midLibraryGMLibFreeze, ms_clsLibraryGMLib, "freezePlayer", "(J)Ljava/lang/String;" ); - GET_STATIC_METHOD( ms_midLibraryGMLibUnfreeze, ms_clsLibraryGMLib, "unFreezePlayer", "(J)V" ); - + GET_CLASS(ms_clsLibraryDump, "script/library/dump"); + GET_STATIC_METHOD(ms_midLibraryDumpDumpTargetInfo, ms_clsLibraryDump, "getTargetInfoStringByLong", "(J)Ljava/lang/String;"); + + GET_CLASS(ms_clsLibraryGMLib, "script/library/gmlib"); + GET_STATIC_METHOD(ms_midLibraryGMLibFreeze, ms_clsLibraryGMLib, "freezePlayer", "(J)Ljava/lang/String;"); + GET_STATIC_METHOD(ms_midLibraryGMLibUnfreeze, ms_clsLibraryGMLib, "unFreezePlayer", "(J)V"); + ///////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////// // register our native methods @@ -1967,7 +1958,7 @@ bool JavaLibrary::registerNatives(const JNINativeMethod natives[], int count) result = lresult; } } - + ms_env->DeleteLocalRef(baseClass); if (ms_env->ExceptionCheck()) { @@ -1985,12 +1976,12 @@ bool JavaLibrary::registerNatives(const JNINativeMethod natives[], int count) //---------------------------------------------------------------------- /** - * Disconnects this thread from the Java VM. Any vars that reference Java objects + * Disconnects this thread from the Java VM. Any vars that reference Java objects * will be invalid after this call. */ void JavaLibrary::disconnectFromJava() { -int i; + int i; if (ms_jvm == 0 || ms_env == 0) return; @@ -2145,9 +2136,9 @@ bool JavaLibrary::queryScriptFunctions(const std::string & scriptName) scriptName); functionList.clear(); -// DEBUG_REPORT_LOG(true, ("Querying script %s methods:\n", scriptName.c_str())); + // DEBUG_REPORT_LOG(true, ("Querying script %s methods:\n", scriptName.c_str())); - // get the name of each method + // get the name of each method bool result = true; int count = getArrayLength(*scriptMethods); for (int i = 0; i < count; ++i) @@ -2168,7 +2159,7 @@ bool JavaLibrary::queryScriptFunctions(const std::string & scriptName) // convert the method name to a C string and store it std::string localName; convert(*methodName, localName); -// DEBUG_REPORT_LOG(true, ("\t%s\n", localName)); + // DEBUG_REPORT_LOG(true, ("\t%s\n", localName)); functionList.insert(localName); } return result; @@ -2183,7 +2174,7 @@ jlong JavaLibrary::getFreeJavaMemory() { if (ms_instance == nullptr || ms_env == nullptr) return 0; - + return ms_env->CallStaticLongMethod(ms_clsScriptEntry, ms_midScriptEntryGetFreeMem); } // JavaLibrary::getFreeJavaMemory @@ -2203,7 +2194,7 @@ void JavaLibrary::printJavaStack() void JavaLibrary::enableLogging(bool enable) const { if (ms_instance == nullptr || ms_env == nullptr) - return; + return; ms_env->CallStaticVoidMethod(ms_clsScriptEntry, ms_midScriptEntryEnableLogging, enable); @@ -2217,7 +2208,7 @@ void JavaLibrary::enableLogging(bool enable) const void JavaLibrary::enableNewJediTracking(bool enableTracking) { if (ms_instance == nullptr || ms_env == nullptr) - return; + return; ms_env->CallStaticVoidMethod(ms_clsScriptEntry, ms_midScriptEntryEnableNewJediTracking, enableTracking); @@ -2271,30 +2262,29 @@ void JavaLibrary::spaceClearOvert(const NetworkId & ship) callStaticVoidMethod(ms_clsLibrarySpaceTransition, ms_midLibrarySpaceTransitionClearOvertStatus, ship.getValue()); } -std::string JavaLibrary::getObjectDumpInfo( NetworkId id ) +std::string JavaLibrary::getObjectDumpInfo(NetworkId id) { - - JavaStringPtr s = callStaticStringMethod(ms_clsLibraryDump, ms_midLibraryDumpDumpTargetInfo, id.getValue() ); + JavaStringPtr s = callStaticStringMethod(ms_clsLibraryDump, ms_midLibraryDumpDumpTargetInfo, id.getValue()); std::string retval; - convert( *s, retval ); - + convert(*s, retval); + return retval; } -void JavaLibrary::freezePlayer( const NetworkId & id ) +void JavaLibrary::freezePlayer(const NetworkId & id) { - DEBUG_REPORT_LOG( true, ( "calling freeze code in script" ) ); - JavaStringPtr s = callStaticStringMethod( ms_clsLibraryGMLib, ms_midLibraryGMLibFreeze, id.getValue() ); - DEBUG_REPORT_LOG( true, ( "done with script" ) ); + DEBUG_REPORT_LOG(true, ("calling freeze code in script")); + JavaStringPtr s = callStaticStringMethod(ms_clsLibraryGMLib, ms_midLibraryGMLibFreeze, id.getValue()); + DEBUG_REPORT_LOG(true, ("done with script")); std::string retval; - convert( *s, retval ); - DEBUG_REPORT_LOG( true, ("Got back %s", retval.c_str() ) ); + convert(*s, retval); + DEBUG_REPORT_LOG(true, ("Got back %s", retval.c_str())); } -void JavaLibrary::unFreezePlayer( const NetworkId & id ) +void JavaLibrary::unFreezePlayer(const NetworkId & id) { - callStaticVoidMethod( ms_clsLibraryGMLib, ms_midLibraryGMLibUnfreeze, id.getValue() ); + callStaticVoidMethod(ms_clsLibraryGMLib, ms_midLibraryGMLibUnfreeze, id.getValue()); } /** @@ -2420,7 +2410,7 @@ void JavaLibrary::setObjIdLoaded(const NetworkId &object) } // JavaLibrary::setObjIdLoaded /** - * Sets the initialized flag of an obj_id. You cannot uninitialize an object, + * Sets the initialized flag of an obj_id. You cannot uninitialize an object, * it is marked uninitialized when it is deleted. * * @param object the object we want to flag as initialized @@ -2476,9 +2466,9 @@ void JavaLibrary::attachScriptToObjId(const NetworkId &object, { LocalRefPtr obj_id = getObjId(object); if (obj_id == LocalRef::cms_nullPtr) - return; + return; - JavaString jscript(script.c_str()); + JavaString jscript(script.c_str()); callVoidMethod(*obj_id, ms_midObjIdAttachScript, jscript.getValue()); } @@ -2543,9 +2533,9 @@ void JavaLibrary::detachScriptFromObjId(const NetworkId &object, { LocalRefPtr obj_id = getObjId(object); if (obj_id == LocalRef::cms_nullPtr) - return; + return; - JavaString jscript(script.c_str()); + JavaString jscript(script.c_str()); callVoidMethod(*obj_id, ms_midObjIdDetachScript, jscript.getValue()); } @@ -2562,7 +2552,7 @@ void JavaLibrary::detachAllScriptsFromObjId(const NetworkId &object) { LocalRefPtr obj_id = getObjId(object); if (obj_id == LocalRef::cms_nullPtr) - return; + return; callVoidMethod(*obj_id, ms_midObjIdDetachAllScripts); } @@ -2656,7 +2646,7 @@ jint JavaLibrary::callScriptEntry(const JavaStringParam & script, { LOG("ScriptInvestigation", ("callScriptEntry failed because runOne was nullptr")); } - + return SCRIPT_OVERRIDE; } @@ -2668,9 +2658,9 @@ jint JavaLibrary::callScriptEntry(const JavaStringParam & script, { LOG("ScriptRecursion", ("callScriptEntry1 recursion %d", ms_currentRecursionCount)); } - jint result = ms_env->CallStaticIntMethod(ms_clsScriptEntry, ms_midRunOne, + jint result = ms_env->CallStaticIntMethod(ms_clsScriptEntry, ms_midRunOne, script.getValue(), method.getValue(), params); - --ms_currentRecursionCount; + --ms_currentRecursionCount; result = handleScriptEntryCleanup(result); @@ -2718,9 +2708,9 @@ jint JavaLibrary::callScriptEntry(const JavaStringParam & method, jobjectArray p { LOG("ScriptRecursion", ("callScriptEntry2 recursion %d", ms_currentRecursionCount)); } - jint result = ms_env->CallStaticIntMethod(ms_clsScriptEntry, ms_midRunAll, + jint result = ms_env->CallStaticIntMethod(ms_clsScriptEntry, ms_midRunAll, method.getValue(), params); - --ms_currentRecursionCount; + --ms_currentRecursionCount; result = handleScriptEntryCleanup(result); @@ -2756,7 +2746,7 @@ jstring JavaLibrary::callScriptConsoleHandlerEntry(const JavaStringParam & scrip { LOG("ScriptInvestigation", ("callScriptConsoleHandlerEntry failed because runConsoleHandler was nullptr")); } - + return 0; } @@ -2768,9 +2758,9 @@ jstring JavaLibrary::callScriptConsoleHandlerEntry(const JavaStringParam & scrip { LOG("ScriptRecursion", ("callScriptConsoleHandlerEntry recursion %d", ms_currentRecursionCount)); } - jstring result = static_cast(ms_env->CallStaticObjectMethod( + jstring result = static_cast(ms_env->CallStaticObjectMethod( ms_clsScriptEntry, ms_midRunConsoleHandler, script.getValue(), method.getValue(), params)); - --ms_currentRecursionCount; + --ms_currentRecursionCount; IGNORE_RETURN(handleScriptEntryCleanup(SCRIPT_CONTINUE)); @@ -2806,270 +2796,270 @@ void JavaLibrary::convert(const ScriptParams & params, JavaDictionaryPtr & dicti JavaString paramName(params.getParamName(i).c_str()); switch (params.getParamType(i)) { - case Param::BOOL: + case Param::BOOL: + { + callObjectMethod(*localDictionary, + ms_midDictionaryPutBool, paramName.getValue(), + params.getBoolParam(i)); + } + break; + case Param::BOOL_ARRAY: + { + const std::deque & boolArray = params.getBoolArrayParam(i); + LocalBooleanArrayRefPtr array = createNewBooleanArray(boolArray.size()); + if (array != LocalBooleanArrayRef::cms_nullPtr) + { + if (boolArray.size() > 0) { - callObjectMethod(*localDictionary, - ms_midDictionaryPutBool, paramName.getValue(), - params.getBoolParam(i)); - } - break; - case Param::BOOL_ARRAY: - { - const std::deque & boolArray = params.getBoolArrayParam(i); - LocalBooleanArrayRefPtr array = createNewBooleanArray(boolArray.size()); - if (array != LocalBooleanArrayRef::cms_nullPtr) - { - if (boolArray.size() > 0) - { - // we need the array of bool to be contiguous in order to - // "memcopy" it into the Java return buffer; a deque - // does not store the array of bool contiguously; neither - // does a vector; in fact, if you find an stl container - // of bool that stores the array of bool contiguously, you - // should change this code to use it; for now, we allocate - // a temporary bool array and copy the deque's bool array - // into it, and pass that to the JNI call to do the "memcopy" - bool * tempBoolArray = new bool[boolArray.size()]; - int indexBoolArray = 0; - for (std::deque::const_iterator iter = boolArray.begin(); iter != boolArray.end(); ++iter, ++indexBoolArray) - tempBoolArray[indexBoolArray] = *iter; + // we need the array of bool to be contiguous in order to + // "memcopy" it into the Java return buffer; a deque + // does not store the array of bool contiguously; neither + // does a vector; in fact, if you find an stl container + // of bool that stores the array of bool contiguously, you + // should change this code to use it; for now, we allocate + // a temporary bool array and copy the deque's bool array + // into it, and pass that to the JNI call to do the "memcopy" + bool * tempBoolArray = new bool[boolArray.size()]; + int indexBoolArray = 0; + for (std::deque::const_iterator iter = boolArray.begin(); iter != boolArray.end(); ++iter, ++indexBoolArray) + tempBoolArray[indexBoolArray] = *iter; - setBooleanArrayRegion(*array, 0, boolArray.size(), - const_cast(reinterpret_cast(&tempBoolArray[0]))); + setBooleanArrayRegion(*array, 0, boolArray.size(), + const_cast(reinterpret_cast(&tempBoolArray[0]))); - delete [] tempBoolArray; - } + delete[] tempBoolArray; + } - callObjectMethod(*localDictionary, - ms_midDictionaryPut, paramName.getValue(), array->getValue() - ); - } - } - break; - case Param::INT: + callObjectMethod(*localDictionary, + ms_midDictionaryPut, paramName.getValue(), array->getValue() + ); + } + } + break; + case Param::INT: + { + callObjectMethod(*localDictionary, + ms_midDictionaryPutInt, paramName.getValue(), + params.getIntParam(i)); + } + break; + case Param::INT_ARRAY: + { + const std::vector & intArray = params.getIntArrayParam(i); + LocalIntArrayRefPtr array = createNewIntArray(intArray.size()); + if (array != LocalIntArrayRef::cms_nullPtr) + { + if (intArray.size() > 0) { - callObjectMethod(*localDictionary, - ms_midDictionaryPutInt, paramName.getValue(), - params.getIntParam(i)); - } - break; - case Param::INT_ARRAY: - { - const std::vector & intArray = params.getIntArrayParam(i); - LocalIntArrayRefPtr array = createNewIntArray(intArray.size()); - if (array != LocalIntArrayRef::cms_nullPtr) - { - if (intArray.size() > 0) - { #if INT_MAX == LONG_MAX - setIntArrayRegion(*array, 0, intArray.size(), const_cast( - reinterpret_cast(&intArray[0]))); + setIntArrayRegion(*array, 0, intArray.size(), const_cast( + reinterpret_cast(&intArray[0]))); #else - std::vector intArray2(intArray.begin(), intArray.end()); - setIntArrayRegion(*array, 0, intArray.size(), const_cast(&intArray2[0])); + std::vector intArray2(intArray.begin(), intArray.end()); + setIntArrayRegion(*array, 0, intArray.size(), const_cast(&intArray2[0])); #endif - } + } - callObjectMethod(*localDictionary, - ms_midDictionaryPut, paramName.getValue(), array->getValue() - ); + callObjectMethod(*localDictionary, + ms_midDictionaryPut, paramName.getValue(), array->getValue() + ); + } + } + break; + case Param::FLOAT: + { + callObjectMethod(*localDictionary, + ms_midDictionaryPutFloat, paramName.getValue(), + params.getFloatParam(i)); + } + break; + case Param::STRING: + { + JavaString value(params.getStringParam(i)); + callObjectMethod(*localDictionary, + ms_midDictionaryPut, paramName.getValue(), value.getValue()); + } + break; + case Param::STRING_ARRAY: + { + LocalObjectArrayRefPtr value; + ScriptConversion::convert(params.getStringArrayParam(i), value); + callObjectMethod(*localDictionary, + ms_midDictionaryPut, paramName.getValue(), value->getValue()); + } + break; + case Param::UNICODE: + { + JavaString value(params.getUnicodeParam(i)); + callObjectMethod(*localDictionary, + ms_midDictionaryPut, paramName.getValue(), value.getValue()); + } + break; + case Param::UNICODE_ARRAY: + { + LocalObjectArrayRefPtr value; + ScriptConversion::convert(params.getUnicodeArrayParam(i), value); + callObjectMethod(*localDictionary, + ms_midDictionaryPut, paramName.getValue(), value->getValue()); + } + break; + case Param::OBJECT_ID: + { + LocalRefPtr arg = getObjId(params.getObjIdParam(i)); + if (arg == LocalRef::cms_nullPtr) + return; + callObjectMethod(*localDictionary, + ms_midDictionaryPut, paramName.getValue(), arg->getValue()); + } + break; + case Param::OBJECT_ID_ARRAY: + { + const std::vector & objIds = + params.getObjIdArrayParam(i); + LocalObjectArrayRefPtr array = createNewObjectArray(objIds.size(), ms_clsObjId); + if (array != LocalObjectArrayRef::cms_nullPtr) + { + int count = objIds.size(); + for (int j = 0; j < count; ++j) + { + LocalRefPtr id = getObjId(objIds[j]); + if (id != LocalRef::cms_nullPtr) + { + setObjectArrayElement(*array, j, *id); } } - break; - case Param::FLOAT: + callObjectMethod(*localDictionary, + ms_midDictionaryPut, paramName.getValue(), array->getValue()); + } + else + { + if (ms_env->ExceptionCheck()) + ms_env->ExceptionDescribe(); + return; + } + } + break; + case Param::CACHED_OBJECT_ID_ARRAY: + { + const std::vector & objIds = + params.getCachedObjIdArrayParam(i); + LocalObjectArrayRefPtr array = createNewObjectArray(objIds.size(), ms_clsObjId); + if (array != LocalObjectArrayRef::cms_nullPtr) + { + int count = objIds.size(); + for (int j = 0; j < count; ++j) { - callObjectMethod(*localDictionary, - ms_midDictionaryPutFloat, paramName.getValue(), - params.getFloatParam(i)); - } - break; - case Param::STRING: - { - JavaString value(params.getStringParam(i)); - callObjectMethod(*localDictionary, - ms_midDictionaryPut, paramName.getValue(), value.getValue()); - } - break; - case Param::STRING_ARRAY: - { - LocalObjectArrayRefPtr value; - ScriptConversion::convert(params.getStringArrayParam(i), value); - callObjectMethod(*localDictionary, - ms_midDictionaryPut, paramName.getValue(), value->getValue()); - } - break; - case Param::UNICODE: - { - JavaString value(params.getUnicodeParam(i)); - callObjectMethod(*localDictionary, - ms_midDictionaryPut, paramName.getValue(), value.getValue()); - } - break; - case Param::UNICODE_ARRAY: - { - LocalObjectArrayRefPtr value; - ScriptConversion::convert(params.getUnicodeArrayParam(i), value); - callObjectMethod(*localDictionary, - ms_midDictionaryPut, paramName.getValue(), value->getValue()); - } - break; - case Param::OBJECT_ID: - { - LocalRefPtr arg = getObjId(params.getObjIdParam(i)); - if (arg == LocalRef::cms_nullPtr) - return; - callObjectMethod(*localDictionary, - ms_midDictionaryPut, paramName.getValue(), arg->getValue()); - } - break; - case Param::OBJECT_ID_ARRAY: - { - const std::vector & objIds = - params.getObjIdArrayParam(i); - LocalObjectArrayRefPtr array = createNewObjectArray(objIds.size(), ms_clsObjId); - if (array != LocalObjectArrayRef::cms_nullPtr) + LocalRefPtr id = getObjId(objIds[j]); + if (id != LocalRef::cms_nullPtr) { - int count = objIds.size(); - for (int j = 0; j < count; ++j) + setObjectArrayElement(*array, j, *id); + } + } + callObjectMethod(*localDictionary, + ms_midDictionaryPut, paramName.getValue(), array->getValue()); + } + else + { + if (ms_env->ExceptionCheck()) + ms_env->ExceptionDescribe(); + return; + } + } + break; + case Param::OBJECT_ID_ARRAY_ARRAY: + { + const std::vector *> & objIds = + params.getObjIdArrayArrayParam(i); + LocalObjectArrayRefPtr array = createNewObjectArray(objIds.size(), ms_clsObjIdArray); + if (array != LocalObjectArrayRef::cms_nullPtr) + { + int count = objIds.size(); + for (int j = 0; j < count; ++j) + { + const std::vector * inner = objIds[j]; + if (inner != nullptr) + { + LocalObjectArrayRefPtr innerArray = createNewObjectArray(inner->size(), ms_clsObjId); + if (innerArray != LocalObjectArrayRef::cms_nullPtr) { - LocalRefPtr id = getObjId(objIds[j]); - if (id != LocalRef::cms_nullPtr) + int innerCount = inner->size(); + for (int k = 0; k < innerCount; ++k) { - setObjectArrayElement(*array, j, *id); - } - } - callObjectMethod(*localDictionary, - ms_midDictionaryPut, paramName.getValue(), array->getValue()); - } - else - { - if (ms_env->ExceptionCheck()) - ms_env->ExceptionDescribe(); - return; - } - } - break; - case Param::CACHED_OBJECT_ID_ARRAY: - { - const std::vector & objIds = - params.getCachedObjIdArrayParam(i); - LocalObjectArrayRefPtr array = createNewObjectArray(objIds.size(), ms_clsObjId); - if (array != LocalObjectArrayRef::cms_nullPtr) - { - int count = objIds.size(); - for (int j = 0; j < count; ++j) - { - LocalRefPtr id = getObjId(objIds[j]); - if (id != LocalRef::cms_nullPtr) - { - setObjectArrayElement(*array, j, *id); - } - } - callObjectMethod(*localDictionary, - ms_midDictionaryPut, paramName.getValue(), array->getValue()); - } - else - { - if (ms_env->ExceptionCheck()) - ms_env->ExceptionDescribe(); - return; - } - } - break; - case Param::OBJECT_ID_ARRAY_ARRAY: - { - const std::vector *> & objIds = - params.getObjIdArrayArrayParam(i); - LocalObjectArrayRefPtr array = createNewObjectArray(objIds.size(), ms_clsObjIdArray); - if (array != LocalObjectArrayRef::cms_nullPtr) - { - int count = objIds.size(); - for (int j = 0; j < count; ++j) - { - const std::vector * inner = objIds[j]; - if (inner != nullptr) - { - LocalObjectArrayRefPtr innerArray = createNewObjectArray(inner->size(), ms_clsObjId); - if (innerArray != LocalObjectArrayRef::cms_nullPtr) + LocalRefPtr id = getObjId(inner->at(k)); + if (id != LocalRef::cms_nullPtr) { - int innerCount = inner->size(); - for (int k = 0; k < innerCount; ++k) - { - LocalRefPtr id = getObjId(inner->at(k)); - if (id != LocalRef::cms_nullPtr) - { - setObjectArrayElement(*innerArray, k, *id); - } - } - setObjectArrayElement(*array, j, *innerArray); - } - else - { - if (ms_env->ExceptionCheck()) - ms_env->ExceptionDescribe(); - return; + setObjectArrayElement(*innerArray, k, *id); } } - else - { - setObjectArrayElement(*array, j, *LocalRef::cms_nullPtr); + setObjectArrayElement(*array, j, *innerArray); } + else + { + if (ms_env->ExceptionCheck()) + ms_env->ExceptionDescribe(); + return; } - callObjectMethod(*localDictionary, - ms_midDictionaryPut, paramName.getValue(), array->getValue()); } else { - if (ms_env->ExceptionCheck()) - ms_env->ExceptionDescribe(); - return; + setObjectArrayElement(*array, j, *LocalRef::cms_nullPtr); } } - break; - case Param::LOCATION: - { - LocalRefPtr location; - if (ScriptConversion::convert(params.getLocationParam(i), "", NetworkId::cms_invalid, location)) - { - callObjectMethod(*localDictionary, - ms_midDictionaryPut, paramName.getValue(), location->getValue()); - } - } - break; - case Param::LOCATION_ARRAY: - { - LocalObjectArrayRefPtr locations; - if (ScriptConversion::convert(params.getLocationArrayParam(i), locations)) - { - callObjectMethod(*localDictionary, - ms_midDictionaryPut, paramName.getValue(), locations->getValue()); - } - } - break; - case Param::DICTIONARY: - { - LocalRefPtr dictionaryArg = convert(params.getValueDictionaryParam(i)); - if (dictionaryArg != LocalRef::cms_nullPtr) - { - callObjectMethod(*localDictionary, - ms_midDictionaryPut, paramName.getValue(), dictionaryArg->getValue()); - } - else - { - if (ms_env->ExceptionCheck()) - ms_env->ExceptionDescribe(); - return; - } - } - break; - default: - { - DEBUG_REPORT_LOG(true, ("Unknown/unhandled parameter type " - "%d while parsing ScriptParameters\n", static_cast( - params.getParamType(i)))); - return; - } - break; + callObjectMethod(*localDictionary, + ms_midDictionaryPut, paramName.getValue(), array->getValue()); + } + else + { + if (ms_env->ExceptionCheck()) + ms_env->ExceptionDescribe(); + return; + } + } + break; + case Param::LOCATION: + { + LocalRefPtr location; + if (ScriptConversion::convert(params.getLocationParam(i), "", NetworkId::cms_invalid, location)) + { + callObjectMethod(*localDictionary, + ms_midDictionaryPut, paramName.getValue(), location->getValue()); + } + } + break; + case Param::LOCATION_ARRAY: + { + LocalObjectArrayRefPtr locations; + if (ScriptConversion::convert(params.getLocationArrayParam(i), locations)) + { + callObjectMethod(*localDictionary, + ms_midDictionaryPut, paramName.getValue(), locations->getValue()); + } + } + break; + case Param::DICTIONARY: + { + LocalRefPtr dictionaryArg = convert(params.getValueDictionaryParam(i)); + if (dictionaryArg != LocalRef::cms_nullPtr) + { + callObjectMethod(*localDictionary, + ms_midDictionaryPut, paramName.getValue(), dictionaryArg->getValue()); + } + else + { + if (ms_env->ExceptionCheck()) + ms_env->ExceptionDescribe(); + return; + } + } + break; + default: + { + DEBUG_REPORT_LOG(true, ("Unknown/unhandled parameter type " + "%d while parsing ScriptParameters\n", static_cast( + params.getParamType(i)))); + return; + } + break; } } @@ -3113,7 +3103,7 @@ LocalObjectArrayRefPtr JavaLibrary::convert(const NetworkId & self, const std::s if (convert(jparams, 1, argList, args)) return jparams; - + return LocalObjectArrayRef::cms_nullPtr; } // JavaLibrary::convert @@ -3178,7 +3168,7 @@ bool JavaLibrary::convert(LocalObjectArrayRefPtr & javaParams, int startIndex, c else if (argList[i] != '[') break; else - ++dimensions; + ++dimensions; } if (paramIndex >= args.getParamCount()) @@ -3189,610 +3179,610 @@ bool JavaLibrary::convert(LocalObjectArrayRefPtr & javaParams, int startIndex, c LocalRefParamPtr arg = LocalRefParam::cms_nullPtr; switch (argType) { - case 'b': - if (dimensions == 0) + case 'b': + if (dimensions == 0) + { + if (args.getParamType(paramIndex) != Param::BOOL) + break; + jboolean param = args.getBoolParam(paramIndex); + arg = createNewObject(ms_clsBoolean, ms_midBoolean, param); + } + else + { + if (args.getParamType(paramIndex) != Param::BOOL_ARRAY) + break; + const std::deque & param = args.getBoolArrayParam(paramIndex); + int count = param.size(); + LocalBooleanArrayRefPtr localInstance = createNewBooleanArray(count); + + if (count > 0) { - if (args.getParamType(paramIndex) != Param::BOOL) + // we need the array of bool to be contiguous in order to + // "memcopy" it into the Java return buffer; a deque + // does not store the array of bool contiguously; neither + // does a vector; in fact, if you find an stl container + // of bool that stores the array of bool contiguously, you + // should change this code to use it; for now, we allocate + // a temporary bool array and copy the deque's bool array + // into it, and pass that to the JNI call to do the "memcopy" + bool * tempBoolArray = new bool[count]; + int indexBoolArray = 0; + for (std::deque::const_iterator iter = param.begin(); iter != param.end(); ++iter, ++indexBoolArray) + tempBoolArray[indexBoolArray] = *iter; + + setBooleanArrayRegion(*localInstance, 0, count, + const_cast(reinterpret_cast(&tempBoolArray[0]))); + + delete[] tempBoolArray; + } + + if (ms_env->ExceptionCheck()) + { + ms_env->ExceptionDescribe(); + return 0; + } + arg = localInstance; + } + break; + case 'i': + if (dimensions == 0) + { + if (args.getParamType(paramIndex) != Param::INT) + break; + if (modifiable) + { + arg = globals.getNextModifiableInt(); + if (arg == GlobalRef::cms_nullPtr) break; - jboolean param = args.getBoolParam(paramIndex); - arg = createNewObject(ms_clsBoolean, ms_midBoolean, param); + jint param = args.getIntParam(paramIndex); + setIntField(*arg, ms_fidModifiableIntData, param); } else { - if (args.getParamType(paramIndex) != Param::BOOL_ARRAY) - break; - const std::deque & param = args.getBoolArrayParam(paramIndex); - int count = param.size(); - LocalBooleanArrayRefPtr localInstance = createNewBooleanArray(count); - - if (count > 0) - { - // we need the array of bool to be contiguous in order to - // "memcopy" it into the Java return buffer; a deque - // does not store the array of bool contiguously; neither - // does a vector; in fact, if you find an stl container - // of bool that stores the array of bool contiguously, you - // should change this code to use it; for now, we allocate - // a temporary bool array and copy the deque's bool array - // into it, and pass that to the JNI call to do the "memcopy" - bool * tempBoolArray = new bool[count]; - int indexBoolArray = 0; - for (std::deque::const_iterator iter = param.begin(); iter != param.end(); ++iter, ++indexBoolArray) - tempBoolArray[indexBoolArray] = *iter; - - setBooleanArrayRegion(*localInstance, 0, count, - const_cast(reinterpret_cast(&tempBoolArray[0]))); - - delete [] tempBoolArray; - } - - if (ms_env->ExceptionCheck()) - { - ms_env->ExceptionDescribe(); - return 0; - } - arg = localInstance; + jint param = args.getIntParam(paramIndex); + arg = createNewObject(ms_clsInteger, ms_midInteger, param); } - break; - case 'i': - if (dimensions == 0) + } + else + { + if (args.getParamType(paramIndex) != Param::INT_ARRAY) + break; + const std::vector & param = args.getIntArrayParam(paramIndex); + int count = param.size(); + LocalIntArrayRefPtr localInstance = createNewIntArray(count); + jint * destination = ms_env->GetIntArrayElements(localInstance->getValue(), 0); + if (destination) { - if (args.getParamType(paramIndex) != Param::INT) + int i; + for (i = 0; i < count; ++i) + { + destination[i] = param[i]; + } + ms_env->ReleaseIntArrayElements(localInstance->getValue(), destination, 0); + } + if (ms_env->ExceptionCheck()) + { + ms_env->ExceptionDescribe(); + return 0; + } + arg = localInstance; + } + break; + case 'U': + { + if (dimensions != 0) + { + if (args.getParamType(paramIndex) != Param::BYTE_ARRAY) + break; + const std::vector & param = args.getByteArrayParam(paramIndex); + int count = param.size(); + LocalByteArrayRefPtr localInstance = createNewByteArray(count); + jbyte * destination = ms_env->GetByteArrayElements(localInstance->getValue(), 0); + if (destination) + { + int i; + for (i = 0; i < count; ++i) + { + destination[i] = param[i]; + } + ms_env->ReleaseByteArrayElements(localInstance->getValue(), destination, 0); + } + if (ms_env->ExceptionCheck()) + { + ms_env->ExceptionDescribe(); + return 0; + } + arg = localInstance; + } + } + break; + case 'f': + if (dimensions == 0) + { + if (args.getParamType(paramIndex) != Param::FLOAT) + break; + if (modifiable) + { + arg = globals.getNextModifiableFloat(); + if (arg == GlobalRef::cms_nullPtr) break; - if (modifiable) - { - arg = globals.getNextModifiableInt(); - if (arg == GlobalRef::cms_nullPtr) - break; - jint param = args.getIntParam(paramIndex); - setIntField(*arg, ms_fidModifiableIntData, param); - } - else - { - jint param = args.getIntParam(paramIndex); - arg = createNewObject(ms_clsInteger, ms_midInteger, param); - } + jfloat param = args.getFloatParam(paramIndex); + setFloatField(*arg, ms_fidModifiableFloatData, param); } else { - if (args.getParamType(paramIndex) != Param::INT_ARRAY) - break; - const std::vector & param = args.getIntArrayParam(paramIndex); - int count = param.size(); - LocalIntArrayRefPtr localInstance = createNewIntArray(count); - jint * destination = ms_env->GetIntArrayElements(localInstance->getValue(), 0); - if (destination) - { - int i; - for (i=0; iReleaseIntArrayElements(localInstance->getValue(), destination, 0); - } - if (ms_env->ExceptionCheck()) - { - ms_env->ExceptionDescribe(); - return 0; - } - arg = localInstance; + jfloat param = args.getFloatParam(paramIndex); + arg = createNewObject(ms_clsFloat, ms_midFloat, param); } - break; - case 'U': + } + else + { + if (args.getParamType(paramIndex) != Param::FLOAT_ARRAY) + break; + const std::vector & floats = args.getFloatArrayParam(paramIndex); + LocalFloatArrayRefPtr farray = createNewFloatArray(floats.size()); + if (farray != LocalFloatArrayRef::cms_nullPtr) { - if (dimensions != 0) + if (floats.size() > 0) + setFloatArrayRegion(*farray, 0, floats.size(), const_cast(&floats[0])); + arg = farray; + } + } + break; + case 's': + if (dimensions == 0) + { + if (args.getParamType(paramIndex) != Param::STRING) + break; + arg = createNewString(args.getStringParam(paramIndex)); + } + else + { + if (args.getParamType(paramIndex) != Param::STRING_ARRAY) + break; + + const std::vector & strings = + args.getStringArrayParam(paramIndex); + LocalObjectArrayRefPtr localInstance = createNewObjectArray(strings.size(), ms_clsString); + int i; + std::vector::const_iterator iter; + for (i = 0, iter = strings.begin(); iter != strings.end(); + ++i, ++iter) + { + if (*iter) { - if (args.getParamType(paramIndex) != Param::BYTE_ARRAY) + JavaString newString(*iter); + setObjectArrayElement(*localInstance, i, newString); + } + } + arg = localInstance; + } + break; + case 'u': + if (dimensions == 0) + { + if (args.getParamType(paramIndex) != Param::UNICODE) + break; + if (modifiable) + break; + const String_t ¶m = args.getUnicodeParam(paramIndex); + arg = createNewString(param.c_str(), static_cast(param.size())); + } + else + { + if (args.getParamType(paramIndex) != Param::UNICODE_ARRAY) + break; + + const std::vector & strings = + args.getUnicodeArrayParam(paramIndex); + LocalObjectArrayRefPtr localInstance = createNewObjectArray(strings.size(), ms_clsString); + int i; + std::vector::const_iterator iter; + for (i = 0, iter = strings.begin(); iter != strings.end(); + ++i, ++iter) + { + if (*iter != nullptr) + { + JavaString newString(**iter); + setObjectArrayElement(*localInstance, i, newString); + } + } + arg = localInstance; + } + break; + case 'L': + if (dimensions == 0) + { + if (args.getParamType(paramIndex) != Param::LOCATION) + break; + NetworkId cell; + LocalRefPtr target; + if (!ScriptConversion::convert(args.getLocationParam(paramIndex), cell, target)) + break; + arg = target; + } + else + { + if (args.getParamType(paramIndex) != Param::LOCATION_ARRAY) + break; + const std::vector & locations = args.getLocationArrayParam(paramIndex); + LocalObjectArrayRefPtr target; + if (!ScriptConversion::convert(locations, target)) + break; + arg = target; + } + break; + case 'O': + { + if (modifiable || dimensions > 1) + break; + if (dimensions == 1) + { + // obj_id array + if (args.getParamType(paramIndex) == Param::OBJECT_ID_ARRAY) + { + const std::vector & param = args.getObjIdArrayParam(paramIndex); + int count = param.size(); + int paramCount = 0; + LocalObjectArrayRefPtr localInstance = createNewObjectArray(count, ms_clsObjId); + for (int j = 0; j < count; ++j) + { + LocalRefPtr id = getObjId(param[j]); + if (id == LocalRef::cms_nullPtr) break; - const std::vector & param = args.getByteArrayParam(paramIndex); - int count = param.size(); - LocalByteArrayRefPtr localInstance = createNewByteArray(count); - jbyte * destination = ms_env->GetByteArrayElements(localInstance->getValue(), 0); - if (destination) - { - int i; - for (i=0; iReleaseByteArrayElements(localInstance->getValue(), destination, 0); - } + setObjectArrayElement(*localInstance, static_cast(paramCount), *id); if (ms_env->ExceptionCheck()) { ms_env->ExceptionDescribe(); return 0; } - arg = localInstance; + ++paramCount; } + arg = localInstance; } - break; - case 'f': - if (dimensions == 0) + else if (args.getParamType(paramIndex) == Param::CACHED_OBJECT_ID_ARRAY) { - if (args.getParamType(paramIndex) != Param::FLOAT) - break; - if (modifiable) + const std::vector & param = args.getCachedObjIdArrayParam(paramIndex); + int count = param.size(); + int paramCount = 0; + LocalObjectArrayRefPtr localInstance = createNewObjectArray(count, ms_clsObjId); + for (int j = 0; j < count; ++j) { - arg = globals.getNextModifiableFloat(); - if (arg == GlobalRef::cms_nullPtr) + LocalRefPtr id = getObjId(param[j]); + if (id == LocalRef::cms_nullPtr) break; - jfloat param = args.getFloatParam(paramIndex); - setFloatField(*arg, ms_fidModifiableFloatData, param); - } - else - { - jfloat param = args.getFloatParam(paramIndex); - arg = createNewObject(ms_clsFloat, ms_midFloat, param); - } - } - else - { - if (args.getParamType(paramIndex) != Param::FLOAT_ARRAY) - break; - const std::vector & floats = args.getFloatArrayParam(paramIndex); - LocalFloatArrayRefPtr farray = createNewFloatArray(floats.size()); - if (farray != LocalFloatArrayRef::cms_nullPtr) - { - if (floats.size() > 0) - setFloatArrayRegion(*farray, 0, floats.size(), const_cast(&floats[0])); - arg = farray; - } - } - break; - case 's': - if (dimensions == 0) - { - if (args.getParamType(paramIndex) != Param::STRING) - break; - arg = createNewString(args.getStringParam(paramIndex)); - } - else - { - if (args.getParamType(paramIndex) != Param::STRING_ARRAY) - break; - - const std::vector & strings = - args.getStringArrayParam(paramIndex); - LocalObjectArrayRefPtr localInstance = createNewObjectArray(strings.size(), ms_clsString); - int i; - std::vector::const_iterator iter; - for (i = 0, iter = strings.begin(); iter != strings.end(); - ++i, ++iter) - { - if (*iter) + setObjectArrayElement(*localInstance, static_cast(paramCount), *id); + if (ms_env->ExceptionCheck()) { - JavaString newString(*iter); - setObjectArrayElement(*localInstance, i, newString); + ms_env->ExceptionDescribe(); + return 0; } + ++paramCount; } arg = localInstance; } - break; - case 'u': - if (dimensions == 0) - { - if (args.getParamType(paramIndex) != Param::UNICODE) - break; - if (modifiable) - break; - const String_t ¶m = args.getUnicodeParam(paramIndex); - arg = createNewString(param.c_str(), static_cast(param.size())); - } - else - { - if (args.getParamType(paramIndex) != Param::UNICODE_ARRAY) - break; - - const std::vector & strings = - args.getUnicodeArrayParam(paramIndex); - LocalObjectArrayRefPtr localInstance = createNewObjectArray(strings.size(), ms_clsString); - int i; - std::vector::const_iterator iter; - for (i = 0, iter = strings.begin(); iter != strings.end(); - ++i, ++iter) - { - if (*iter != nullptr) - { - JavaString newString(**iter); - setObjectArrayElement(*localInstance, i, newString); - } - } - arg = localInstance; - } - break; - case 'L': - if (dimensions == 0) - { - if (args.getParamType(paramIndex) != Param::LOCATION) - break; - NetworkId cell; - LocalRefPtr target; - if (!ScriptConversion::convert(args.getLocationParam(paramIndex), cell, target)) - break; - arg = target; - } - else - { - if (args.getParamType(paramIndex) != Param::LOCATION_ARRAY) - break; - const std::vector & locations = args.getLocationArrayParam(paramIndex); - LocalObjectArrayRefPtr target; - if (!ScriptConversion::convert(locations, target)) - break; - arg = target; - } - break; - case 'O': + } + else { - if (modifiable || dimensions > 1) - break; - if (dimensions == 1) + if (args.getParamType(paramIndex) != Param::OBJECT_ID) + break; + arg = getObjId(args.getObjIdParam(paramIndex)); + } + } + break; + + //---------------------------------------------------------------------- + //-- menu info + + case 'm': + { + if (dimensions != 0) + break; + + if (args.getParamType(paramIndex) != Param::OBJECT_MENU_INFO) + break; + + const MenuDataVector & menuVector = args.getObjectMenuRequestDataArrayParam(paramIndex); + + arg = globals.getMenuInfo(); + + if (!convert(menuVector, arg)) + { + return 0; + } + } + break; + + //---------------------------------------------------------------------- + + case 'S': + if (dimensions == 0) + { + if (args.getParamType(paramIndex) != Param::STRING_ID) + break; + if (modifiable) + arg = globals.getNextModifiableStringId(); + else + arg = globals.getNextStringId(); + if (arg == GlobalArrayRef::cms_nullPtr) + break; + const StringId & param = args.getStringIdParam(paramIndex); + JavaString text(param.getTable().c_str()); + setObjectField(*arg, ms_fidStringIdTable, text); + if (param.getText().empty()) + { + setIntField(*arg, ms_fidStringIdIndexId, + static_cast(param.getTextIndex())); + JavaString text(""); + setObjectField(*arg, ms_fidStringIdAsciiId, text); + } + else + { + JavaString text(param.getText().c_str()); + setObjectField(*arg, ms_fidStringIdAsciiId, text); + } + } + else + { + if (args.getParamType(paramIndex) != Param::STRING_ID_ARRAY) + break; + if (modifiable) + break; + + const std::vector & strings = args.getStringIdArrayParam(paramIndex); + LocalObjectArrayRefPtr localInstance = createNewObjectArray(strings.size(), ms_clsStringId); + + int i; + std::vector::const_iterator iter; + for (i = 0, iter = strings.begin(); iter != strings.end(); ++i, ++iter) + { + const StringId * param = *iter; + // get the next available stringId from the pool + GlobalRefPtr stringIdObject = globals.getNextStringId(); + if (stringIdObject == GlobalRef::cms_nullPtr) + break; + // set the stringId elements + JavaString text(param->getTable().c_str()); + setObjectField(*stringIdObject, ms_fidStringIdTable, text); + if (param->getText().empty()) { - // obj_id array - if (args.getParamType(paramIndex) == Param::OBJECT_ID_ARRAY) - { - const std::vector & param = args.getObjIdArrayParam(paramIndex); - int count = param.size(); - int paramCount = 0; - LocalObjectArrayRefPtr localInstance = createNewObjectArray(count, ms_clsObjId); - for (int j = 0; j < count; ++j) - { - LocalRefPtr id = getObjId(param[j]); - if (id == LocalRef::cms_nullPtr) - break; - setObjectArrayElement(*localInstance, static_cast(paramCount), *id); - if (ms_env->ExceptionCheck()) - { - ms_env->ExceptionDescribe(); - return 0; - } - ++paramCount; - } - arg = localInstance; - } - else if (args.getParamType(paramIndex) == Param::CACHED_OBJECT_ID_ARRAY) - { - const std::vector & param = args.getCachedObjIdArrayParam(paramIndex); - int count = param.size(); - int paramCount = 0; - LocalObjectArrayRefPtr localInstance = createNewObjectArray(count, ms_clsObjId); - for (int j = 0; j < count; ++j) - { - LocalRefPtr id = getObjId(param[j]); - if (id == LocalRef::cms_nullPtr) - break; - setObjectArrayElement(*localInstance, static_cast(paramCount), *id); - if (ms_env->ExceptionCheck()) - { - ms_env->ExceptionDescribe(); - return 0; - } - ++paramCount; - } - arg = localInstance; - } + setIntField(*stringIdObject, ms_fidStringIdIndexId, + static_cast(param->getTextIndex())); + JavaString text(""); + setObjectField(*stringIdObject, ms_fidStringIdAsciiId, text); } else { - if (args.getParamType(paramIndex) != Param::OBJECT_ID) - break; - arg = getObjId(args.getObjIdParam(paramIndex)); + JavaString text(param->getText().c_str()); + setObjectField(*stringIdObject, ms_fidStringIdAsciiId, text); } + // add the string id to the array + setObjectArrayElement(*localInstance, i, *stringIdObject); + } + arg = localInstance; } break; - - //---------------------------------------------------------------------- - //-- menu info - - case 'm': - { - if (dimensions != 0) - break; - - if (args.getParamType(paramIndex) != Param::OBJECT_MENU_INFO) - break; - - const MenuDataVector & menuVector = args.getObjectMenuRequestDataArrayParam (paramIndex); - - arg = globals.getMenuInfo (); - - if (!convert (menuVector, arg)) - { - return 0; - } - } + case 'E': + //@todo: implement this + break; + case 'A': + if (modifiable || dimensions > 1) break; - - //---------------------------------------------------------------------- - - case 'S': - if (dimensions == 0) + if (dimensions == 1) + { + // attribMod array + if (args.getParamType(paramIndex) != Param::ATTRIB_MOD_ARRAY) + break; + const std::vector & param = args.getAttribModArrayParam(paramIndex); + int count = param.size(); + int paramCount = 0; + for (int j = 0; j < count; ++j) { - if (args.getParamType(paramIndex) != Param::STRING_ID) - break; - if (modifiable) - arg = globals.getNextModifiableStringId(); - else - arg = globals.getNextStringId(); - if (arg == GlobalArrayRef::cms_nullPtr) - break; - const StringId & param = args.getStringIdParam(paramIndex); - JavaString text(param.getTable().c_str()); - setObjectField(*arg, ms_fidStringIdTable, text); - if (param.getText().empty()) + // only send attribMods that actually do something + if (param[j].value != 0) { - setIntField(*arg, ms_fidStringIdIndexId, - static_cast(param.getTextIndex())); - JavaString text(""); - setObjectField(*arg, ms_fidStringIdAsciiId, text); - } - else - { - JavaString text(param.getText().c_str()); - setObjectField(*arg, ms_fidStringIdAsciiId, text); - } - } - else - { - if (args.getParamType(paramIndex) != Param::STRING_ID_ARRAY) - break; - if (modifiable) - break; + arg = globals.getNextAttribMod(); + if (arg == GlobalRef::cms_nullPtr) + return 0; - const std::vector & strings = args.getStringIdArrayParam(paramIndex); - LocalObjectArrayRefPtr localInstance = createNewObjectArray(strings.size(), ms_clsStringId); - - int i; - std::vector::const_iterator iter; - for (i = 0, iter = strings.begin(); iter != strings.end(); ++i, ++iter) - { - const StringId * param = *iter; - // get the next available stringId from the pool - GlobalRefPtr stringIdObject = globals.getNextStringId(); - if (stringIdObject == GlobalRef::cms_nullPtr) - break; - // set the stringId elements - JavaString text(param->getTable().c_str()); - setObjectField(*stringIdObject, ms_fidStringIdTable, text); - if (param->getText().empty()) + JavaString name(AttribModNameManager::getInstance( + ).getAttribModName(param[j].tag)); + setObjectField(*arg, ms_fidAttribModName, name); + if (!AttribMod::isSkillMod(param[j])) { - setIntField(*stringIdObject, ms_fidStringIdIndexId, - static_cast(param->getTextIndex())); - JavaString text(""); - setObjectField(*stringIdObject, ms_fidStringIdAsciiId, text); + setIntField(*arg, ms_fidAttribModType, static_cast(param[j].attrib)); } else { - JavaString text(param->getText().c_str()); - setObjectField(*stringIdObject, ms_fidStringIdAsciiId, text); + JavaString skill(AttribModNameManager::getInstance( + ).getAttribModName(param[j].skill)); + setObjectField(*arg, ms_fidAttribModSkill, skill); + } + setIntField(*arg, ms_fidAttribModValue, param[j].value); + setFloatField(*arg, ms_fidAttribModTime, param[j].sustain); + setFloatField(*arg, ms_fidAttribModAttack, param[j].attack); + setFloatField(*arg, ms_fidAttribModDecay, param[j].decay); + setIntField(*arg, ms_fidAttribModFlags, param[j].flags); + setObjectArrayElement(*ms_attribModList[ms_currentRecursionCount], static_cast(paramCount), *arg); + if (ms_env->ExceptionCheck()) + { + ms_env->ExceptionDescribe(); + return 0; + } + ++paramCount; + } + } + // fill in the rest of ms_attribModList with nullptr + for (; paramCount < MAX_ATTRIB_MOD_PARAMS; ++paramCount) + { + setObjectArrayElement(*ms_attribModList[ms_currentRecursionCount], static_cast(paramCount), *LocalRefParam::cms_nullPtr); + if (ms_env->ExceptionCheck()) + { + ms_env->ExceptionDescribe(); + return 0; + } + } + arg = ms_attribModList[ms_currentRecursionCount]; + } + else + { + // single attribMod + if (args.getParamType(paramIndex) != Param::ATTRIB_MOD) + break; + const AttribMod::AttribMod ¶m = args.getAttribModParam(paramIndex); + arg = globals.getNextAttribMod(); + if (arg == GlobalRef::cms_nullPtr) + return 0; + + JavaString name(AttribModNameManager::getInstance( + ).getAttribModName(param.tag)); + setObjectField(*arg, ms_fidAttribModName, name); + if (!AttribMod::isSkillMod(param)) + { + setIntField(*arg, ms_fidAttribModType, param.attrib); + } + else + { + JavaString skill(AttribModNameManager::getInstance( + ).getAttribModName(param.skill)); + setObjectField(*arg, ms_fidAttribModSkill, skill); + } + setIntField(*arg, ms_fidAttribModValue, param.value); + setFloatField(*arg, ms_fidAttribModTime, param.sustain); + setFloatField(*arg, ms_fidAttribModAttack, param.attack); + setFloatField(*arg, ms_fidAttribModDecay, param.decay); + setIntField(*arg, ms_fidAttribModFlags, param.flags); + } + break; + + case 'M': + if (modifiable || dimensions > 1) + break; + if (dimensions == 1) + { + // mental_state_mod array + if (args.getParamType(paramIndex) != Param::MENTAL_STATE_MOD_ARRAY) + break; + const std::vector & param = args.getMentalStateModArrayParam(paramIndex); + int count = param.size(); + int paramCount = 0; + for (int j = 0; j < count; ++j) + { + // only send mental_state_mods that actually do something + if (param[j].value != 0) + { + arg = globals.getNextMentalStateMod(); + if (arg == GlobalRef::cms_nullPtr) + return 0; + + setIntField(*arg, ms_fidMentalStateModType, param[j].target); + setFloatField(*arg, ms_fidMentalStateModValue, param[j].value); + setFloatField(*arg, ms_fidMentalStateModTime, param[j].timeAtValue); + setFloatField(*arg, ms_fidMentalStateModAttack, param[j].time); + setFloatField(*arg, ms_fidMentalStateModDecay, param[j].decay); + setObjectArrayElement( + *ms_mentalStateModList[ms_currentRecursionCount], + static_cast(paramCount), *arg); + if (ms_env->ExceptionCheck()) + { + ms_env->ExceptionDescribe(); + return 0; + } + ++paramCount; + } + } + // fill in the rest of ms_mentalStateModList with nullptr + for (; paramCount < MAX_MENTAL_STATE_MOD_PARAMS; ++paramCount) + { + setObjectArrayElement( + *ms_mentalStateModList[ms_currentRecursionCount], + static_cast(paramCount), *LocalRefParam::cms_nullPtr); + if (ms_env->ExceptionCheck()) + { + ms_env->ExceptionDescribe(); + return 0; + } + } + arg = ms_mentalStateModList[ms_currentRecursionCount]; + } + else + { + // single mental_state_mod + if (args.getParamType(paramIndex) != Param::MENTAL_STATE_MOD) + break; + const ServerObjectTemplate::MentalStateMod ¶m = args.getMentalStateModParam(paramIndex); + arg = globals.getNextMentalStateMod(); + if (arg == GlobalRef::cms_nullPtr) + return 0; + + setIntField(*arg, ms_fidMentalStateModType, param.target); + setFloatField(*arg, ms_fidMentalStateModValue, param.value); + setFloatField(*arg, ms_fidMentalStateModTime, param.timeAtValue); + setFloatField(*arg, ms_fidMentalStateModAttack, param.time); + setFloatField(*arg, ms_fidMentalStateModDecay, param.decay); + } + break; + + case 'D': + if (!modifiable && dimensions == 0) + { + const ManufactureObjectInterface & schematic = args.getManufactureSchematicParam(paramIndex); + arg = convert(schematic); + } + break; + + case 'I': + if (!modifiable && dimensions == 0) + { + const Crafting::IngredientSlot & slot = args.getIngredientSlotParam(paramIndex); + const ManufactureObjectInterface & schematic = args.getIngredientSlotParamSchematic(paramIndex); + int amountRequired = args.getIngredientSlotParamAmountRequired(paramIndex); + const std::string & appearance = args.getIngredientSlotParamAppearance(paramIndex); + arg = convert(schematic, slot, amountRequired, appearance, ""); + } + break; + + case 'V': + if (!modifiable) + { + if (dimensions == 0) + { + const ValueDictionary & dictionary = args.getValueDictionaryParam(paramIndex); + arg = convert(dictionary); + } + else if (dimensions == 1) + { + const std::vector & param = args.getValueDictionaryArrayParam(paramIndex); + LocalObjectArrayRefPtr localInstance = createNewObjectArray(param.size(), ms_clsDictionary); + + int paramCount = 0; + std::vector::const_iterator iter; + for (iter = param.begin(); iter != param.end(); ++iter) + { + setObjectArrayElement(*localInstance, static_cast(paramCount++), *convert(*iter)); + + if (ms_env->ExceptionCheck()) + { + ms_env->ExceptionDescribe(); + return 0; } - // add the string id to the array - setObjectArrayElement(*localInstance, i, *stringIdObject); } arg = localInstance; } - break; - case 'E': - //@todo: implement this - break; - case 'A': - if (modifiable || dimensions > 1) - break; - if (dimensions == 1) - { - // attribMod array - if (args.getParamType(paramIndex) != Param::ATTRIB_MOD_ARRAY) - break; - const std::vector & param = args.getAttribModArrayParam(paramIndex); - int count = param.size(); - int paramCount = 0; - for (int j = 0; j < count; ++j) - { - // only send attribMods that actually do something - if (param[j].value != 0) - { - arg = globals.getNextAttribMod(); - if (arg == GlobalRef::cms_nullPtr) - return 0; + } + break; - JavaString name(AttribModNameManager::getInstance( - ).getAttribModName(param[j].tag)); - setObjectField(*arg, ms_fidAttribModName, name); - if (!AttribMod::isSkillMod(param[j])) - { - setIntField(*arg, ms_fidAttribModType, static_cast(param[j].attrib)); - } - else - { - JavaString skill(AttribModNameManager::getInstance( - ).getAttribModName(param[j].skill)); - setObjectField(*arg, ms_fidAttribModSkill, skill); - } - setIntField(*arg, ms_fidAttribModValue, param[j].value); - setFloatField(*arg, ms_fidAttribModTime, param[j].sustain); - setFloatField(*arg, ms_fidAttribModAttack, param[j].attack); - setFloatField(*arg, ms_fidAttribModDecay, param[j].decay); - setIntField(*arg, ms_fidAttribModFlags, param[j].flags); - setObjectArrayElement(*ms_attribModList[ms_currentRecursionCount], static_cast(paramCount), *arg); - if (ms_env->ExceptionCheck()) - { - ms_env->ExceptionDescribe(); - return 0; - } - ++paramCount; - } - } - // fill in the rest of ms_attribModList with nullptr - for (; paramCount < MAX_ATTRIB_MOD_PARAMS; ++paramCount) - { - setObjectArrayElement(*ms_attribModList[ms_currentRecursionCount], static_cast(paramCount), *LocalRefParam::cms_nullPtr); - if (ms_env->ExceptionCheck()) - { - ms_env->ExceptionDescribe(); - return 0; - } - } - arg = ms_attribModList[ms_currentRecursionCount]; - } - else - { - // single attribMod - if (args.getParamType(paramIndex) != Param::ATTRIB_MOD) - break; - const AttribMod::AttribMod ¶m = args.getAttribModParam(paramIndex); - arg = globals.getNextAttribMod(); - if (arg == GlobalRef::cms_nullPtr) - return 0; - - JavaString name(AttribModNameManager::getInstance( - ).getAttribModName(param.tag)); - setObjectField(*arg, ms_fidAttribModName, name); - if (!AttribMod::isSkillMod(param)) - { - setIntField(*arg, ms_fidAttribModType, param.attrib); - } - else - { - JavaString skill(AttribModNameManager::getInstance( - ).getAttribModName(param.skill)); - setObjectField(*arg, ms_fidAttribModSkill, skill); - } - setIntField(*arg, ms_fidAttribModValue, param.value); - setFloatField(*arg, ms_fidAttribModTime, param.sustain); - setFloatField(*arg, ms_fidAttribModAttack, param.attack); - setFloatField(*arg, ms_fidAttribModDecay, param.decay); - setIntField(*arg, ms_fidAttribModFlags, param.flags); - } - break; - - case 'M': - if (modifiable || dimensions > 1) - break; - if (dimensions == 1) - { - // mental_state_mod array - if (args.getParamType(paramIndex) != Param::MENTAL_STATE_MOD_ARRAY) - break; - const std::vector & param = args.getMentalStateModArrayParam(paramIndex); - int count = param.size(); - int paramCount = 0; - for (int j = 0; j < count; ++j) - { - // only send mental_state_mods that actually do something - if (param[j].value != 0) - { - arg = globals.getNextMentalStateMod(); - if (arg == GlobalRef::cms_nullPtr) - return 0; - - setIntField(*arg, ms_fidMentalStateModType, param[j].target); - setFloatField(*arg, ms_fidMentalStateModValue, param[j].value); - setFloatField(*arg, ms_fidMentalStateModTime, param[j].timeAtValue); - setFloatField(*arg, ms_fidMentalStateModAttack, param[j].time); - setFloatField(*arg, ms_fidMentalStateModDecay, param[j].decay); - setObjectArrayElement( - *ms_mentalStateModList[ms_currentRecursionCount], - static_cast(paramCount), *arg); - if (ms_env->ExceptionCheck()) - { - ms_env->ExceptionDescribe(); - return 0; - } - ++paramCount; - } - } - // fill in the rest of ms_mentalStateModList with nullptr - for (; paramCount < MAX_MENTAL_STATE_MOD_PARAMS; ++paramCount) - { - setObjectArrayElement( - *ms_mentalStateModList[ms_currentRecursionCount], - static_cast(paramCount), *LocalRefParam::cms_nullPtr); - if (ms_env->ExceptionCheck()) - { - ms_env->ExceptionDescribe(); - return 0; - } - } - arg = ms_mentalStateModList[ms_currentRecursionCount]; - } - else - { - // single mental_state_mod - if (args.getParamType(paramIndex) != Param::MENTAL_STATE_MOD) - break; - const ServerObjectTemplate::MentalStateMod ¶m = args.getMentalStateModParam(paramIndex); - arg = globals.getNextMentalStateMod(); - if (arg == GlobalRef::cms_nullPtr) - return 0; - - setIntField(*arg, ms_fidMentalStateModType, param.target); - setFloatField(*arg, ms_fidMentalStateModValue, param.value); - setFloatField(*arg, ms_fidMentalStateModTime, param.timeAtValue); - setFloatField(*arg, ms_fidMentalStateModAttack, param.time); - setFloatField(*arg, ms_fidMentalStateModDecay, param.decay); - } - break; - - case 'D': - if (!modifiable && dimensions == 0) - { - const ManufactureObjectInterface & schematic = args.getManufactureSchematicParam(paramIndex); - arg = convert(schematic); - } - break; - - case 'I': - if (!modifiable && dimensions == 0) - { - const Crafting::IngredientSlot & slot = args.getIngredientSlotParam(paramIndex); - const ManufactureObjectInterface & schematic = args.getIngredientSlotParamSchematic(paramIndex); - int amountRequired = args.getIngredientSlotParamAmountRequired(paramIndex); - const std::string & appearance = args.getIngredientSlotParamAppearance(paramIndex); - arg = convert(schematic, slot, amountRequired, appearance, ""); - } - break; - - case 'V': - if (!modifiable) - { - if (dimensions == 0) - { - const ValueDictionary & dictionary = args.getValueDictionaryParam(paramIndex); - arg = convert(dictionary); - } - else if (dimensions == 1) - { - const std::vector & param = args.getValueDictionaryArrayParam(paramIndex); - LocalObjectArrayRefPtr localInstance = createNewObjectArray(param.size(), ms_clsDictionary); - - int paramCount = 0; - std::vector::const_iterator iter; - for (iter = param.begin(); iter != param.end(); ++iter) - { - setObjectArrayElement(*localInstance, static_cast(paramCount++), *convert(*iter)); - - if (ms_env->ExceptionCheck()) - { - ms_env->ExceptionDescribe(); - return 0; - } - } - arg = localInstance; - } - } - break; - - default: - DEBUG_REPORT_LOG(true, ("unknown parameter type %c(%#x)\n", argType, - static_cast(argType))); //lint !e571 suspicious cast - return 0; + default: + DEBUG_REPORT_LOG(true, ("unknown parameter type %c(%#x)\n", argType, + static_cast(argType))); //lint !e571 suspicious cast + return 0; } if (arg.get() == nullptr || arg == LocalRef::cms_nullPtr) { DEBUG_REPORT_LOG(true, ("bad parameter, %c%s%d%s\n", argType, - modifiable ? "*" : "", - dimensions, - dimensions > 0 ? " dimensions" : "" + modifiable ? "*" : "", + dimensions, + dimensions > 0 ? " dimensions" : "" )); return 0; } @@ -3832,197 +3822,196 @@ void JavaLibrary::alterScriptParams(jobjectArray jparams, const std::string& arg { switch (argList[i]) { - case 'i': - if (i < argList.size() - 1 && argList[i+1] == '*') + case 'i': + if (i < argList.size() - 1 && argList[i + 1] == '*') + { + ++i; + if (i == argList.size() || argList[i + 1] != '[') { - ++i; - if (i == argList.size() || argList[i+1] != '[') - { - LocalRefPtr arg = getObjectArrayElement(LocalObjectArrayRefParam(jparams), paramIndex + 1); - if (arg != LocalRef::cms_nullPtr) - { - int value = getIntField(*arg, ms_fidModifiableIntData); - args.changeParam(paramIndex, value); - } - else - { - WARNING_STRICT_FATAL(true, ("Error getting back integer param on script return paramIndex=%d, i=%d", paramIndex, i)); - } - } - else if (i < argList.size() - 1 && argList[i+1] == '[') - { - ++i; - - LocalArrayRefPtr arg = getArrayArrayElement(LocalObjectArrayRefParam(jparams), paramIndex + 1); - if (arg != LocalArrayRef::cms_nullPtr) - { - int count = getArrayLength(*arg); - std::vector * values = new std::vector(count, 0); - jint * jvalues = static_cast(ms_env->GetPrimitiveArrayCritical(static_cast(arg->getValue()), nullptr)); - for (int j = 0; j < count; ++j) - { - values->at(j) = static_cast(jvalues[j]); - } - ms_env->ReleasePrimitiveArrayCritical(static_cast(arg->getValue()), jvalues, JNI_ABORT); - args.changeParam(paramIndex, *values, true); - } - else - { - WARNING_STRICT_FATAL(true, ("Error getting back integer array param on script return")); - } - } - } - break; - case 'U': - if (i < argList.size() - 1 && argList[i+1] == '*') - { - ++i; - if (i == argList.size() || argList[i+1] != '[') - { - WARNING_STRICT_FATAL(true, ("Error getting back vector param on script return paramIndex=%d, i=%d", paramIndex, i)); - } - else if (i < argList.size() - 1 && argList[i+1] == '[') - { - ++i; - - LocalArrayRefPtr arg = getArrayArrayElement(LocalObjectArrayRefParam(jparams), paramIndex + 1); - if (arg != LocalArrayRef::cms_nullPtr) - { - int count = getArrayLength(*arg); - std::vector * values = new std::vector(count, 0); - jbyte * jvalues = static_cast(ms_env->GetPrimitiveArrayCritical(static_cast(arg->getValue()), nullptr)); - for (int j = 0; j < count; ++j) - { - values->at(j) = static_cast(jvalues[j]); - } - ms_env->ReleasePrimitiveArrayCritical(static_cast(arg->getValue()), jvalues, JNI_ABORT); - args.changeParam(paramIndex, *values, true); - } - else - { - WARNING_STRICT_FATAL(true, ("Error getting back integer array param on script return")); - } - } - } - break; - - case 'f': - if (i < argList.size() - 1 && argList[i+1] == '*') - { - ++i; LocalRefPtr arg = getObjectArrayElement(LocalObjectArrayRefParam(jparams), paramIndex + 1); if (arg != LocalRef::cms_nullPtr) { - args.changeParam(paramIndex, getFloatField(*arg, ms_fidModifiableFloatData)); + int value = getIntField(*arg, ms_fidModifiableIntData); + args.changeParam(paramIndex, value); } else { - WARNING_STRICT_FATAL(true, ("Error getting back float param on script return")); + WARNING_STRICT_FATAL(true, ("Error getting back integer param on script return paramIndex=%d, i=%d", paramIndex, i)); } } - break; - case 's': - if (i < argList.size() - 1 && argList[i+1] == '*') + else if (i < argList.size() - 1 && argList[i + 1] == '[') { ++i; - if (i < argList.size() - 1 && argList[i+1] == '[') - { - ++i; - LocalObjectArrayRefPtr arg = getObjectArrayArrayElement(LocalObjectArrayRefParam(jparams), paramIndex + 1); - if (arg != LocalObjectArrayRef::cms_nullPtr) - { - std::vector * strings = new std::vector(); - getStringArray(*arg, *strings); - args.changeParam(paramIndex, *strings, true); - } - else - { - WARNING_STRICT_FATAL(true, ("Error getting back string array param on script return")); - } - } - } - break; - case 'u': - if (i < argList.size() - 1 && argList[i+1] == '*') - { - ++i; - if (i < argList.size() - 1 && argList[i+1] == '[') - { - ++i; - LocalObjectArrayRefPtr arg = getObjectArrayArrayElement(LocalObjectArrayRefParam(jparams), paramIndex + 1); - if (arg != LocalObjectArrayRef::cms_nullPtr) - { - std::vector * strings = new std::vector(); - getStringArray(*arg, *strings); - args.changeParam(paramIndex, *strings, true); - } - else - { - WARNING_STRICT_FATAL(true, ("Error getting back string array param on script return")); - } - } - } - break; - case 'S': - if (i < argList.size() - 1 && argList[i+1] == '*') - { - ++i; - StringId * value = new StringId(); - LocalRefPtr arg = getObjectArrayElement(LocalObjectArrayRefParam(jparams), paramIndex + 1); - if (arg != LocalRef::cms_nullPtr) - { - // get the string id table - JavaStringPtr table = getStringField(*arg, ms_fidStringIdTable); - std::string localString; - convert(*table, localString); - value->setTable(localString); - // get the string id text, if it is not nullptr/empty, use it - localString.clear(); - JavaStringPtr text = getStringField(*arg, ms_fidStringIdAsciiId); - if (text != JavaString::cms_nullPtr) - convert(*text, localString); - if (localString[0] != '\0') - value->setText(localString); - else - { - // use the textIndex field instead - jint textIndex = getIntField(*arg, ms_fidStringIdIndexId); - value->setTextIndex(textIndex); - } - args.changeParam(paramIndex, *value, true); - } - else - { - WARNING_STRICT_FATAL(true, ("Error getting back string id param on script return")); - } - } - break; + LocalArrayRefPtr arg = getArrayArrayElement(LocalObjectArrayRefParam(jparams), paramIndex + 1); + if (arg != LocalArrayRef::cms_nullPtr) + { + int count = getArrayLength(*arg); + std::vector * values = new std::vector(count, 0); + jint * jvalues = static_cast(ms_env->GetPrimitiveArrayCritical(static_cast(arg->getValue()), nullptr)); + for (int j = 0; j < count; ++j) + { + values->at(j) = static_cast(jvalues[j]); + } + ms_env->ReleasePrimitiveArrayCritical(static_cast(arg->getValue()), jvalues, JNI_ABORT); + args.changeParam(paramIndex, *values, true); + } + else + { + WARNING_STRICT_FATAL(true, ("Error getting back integer array param on script return")); + } + } + } + break; + case 'U': + if (i < argList.size() - 1 && argList[i + 1] == '*') + { + ++i; + if (i == argList.size() || argList[i + 1] != '[') + { + WARNING_STRICT_FATAL(true, ("Error getting back vector param on script return paramIndex=%d, i=%d", paramIndex, i)); + } + else if (i < argList.size() - 1 && argList[i + 1] == '[') + { + ++i; + + LocalArrayRefPtr arg = getArrayArrayElement(LocalObjectArrayRefParam(jparams), paramIndex + 1); + if (arg != LocalArrayRef::cms_nullPtr) + { + int count = getArrayLength(*arg); + std::vector * values = new std::vector(count, 0); + jbyte * jvalues = static_cast(ms_env->GetPrimitiveArrayCritical(static_cast(arg->getValue()), nullptr)); + for (int j = 0; j < count; ++j) + { + values->at(j) = static_cast(jvalues[j]); + } + ms_env->ReleasePrimitiveArrayCritical(static_cast(arg->getValue()), jvalues, JNI_ABORT); + args.changeParam(paramIndex, *values, true); + } + else + { + WARNING_STRICT_FATAL(true, ("Error getting back integer array param on script return")); + } + } + } + break; + + case 'f': + if (i < argList.size() - 1 && argList[i + 1] == '*') + { + ++i; + LocalRefPtr arg = getObjectArrayElement(LocalObjectArrayRefParam(jparams), paramIndex + 1); + if (arg != LocalRef::cms_nullPtr) + { + args.changeParam(paramIndex, getFloatField(*arg, ms_fidModifiableFloatData)); + } + else + { + WARNING_STRICT_FATAL(true, ("Error getting back float param on script return")); + } + } + break; + case 's': + if (i < argList.size() - 1 && argList[i + 1] == '*') + { + ++i; + if (i < argList.size() - 1 && argList[i + 1] == '[') + { + ++i; + LocalObjectArrayRefPtr arg = getObjectArrayArrayElement(LocalObjectArrayRefParam(jparams), paramIndex + 1); + if (arg != LocalObjectArrayRef::cms_nullPtr) + { + std::vector * strings = new std::vector(); + getStringArray(*arg, *strings); + args.changeParam(paramIndex, *strings, true); + } + else + { + WARNING_STRICT_FATAL(true, ("Error getting back string array param on script return")); + } + } + } + break; + case 'u': + if (i < argList.size() - 1 && argList[i + 1] == '*') + { + ++i; + if (i < argList.size() - 1 && argList[i + 1] == '[') + { + ++i; + LocalObjectArrayRefPtr arg = getObjectArrayArrayElement(LocalObjectArrayRefParam(jparams), paramIndex + 1); + if (arg != LocalObjectArrayRef::cms_nullPtr) + { + std::vector * strings = new std::vector(); + getStringArray(*arg, *strings); + args.changeParam(paramIndex, *strings, true); + } + else + { + WARNING_STRICT_FATAL(true, ("Error getting back string array param on script return")); + } + } + } + break; + case 'S': + if (i < argList.size() - 1 && argList[i + 1] == '*') + { + ++i; + StringId * value = new StringId(); + LocalRefPtr arg = getObjectArrayElement(LocalObjectArrayRefParam(jparams), paramIndex + 1); + if (arg != LocalRef::cms_nullPtr) + { + // get the string id table + JavaStringPtr table = getStringField(*arg, ms_fidStringIdTable); + std::string localString; + convert(*table, localString); + value->setTable(localString); + // get the string id text, if it is not nullptr/empty, use it + localString.clear(); + JavaStringPtr text = getStringField(*arg, ms_fidStringIdAsciiId); + if (text != JavaString::cms_nullPtr) + convert(*text, localString); + if (localString[0] != '\0') + value->setText(localString); + else + { + // use the textIndex field instead + jint textIndex = getIntField(*arg, ms_fidStringIdIndexId); + value->setTextIndex(textIndex); + } + args.changeParam(paramIndex, *value, true); + } + else + { + WARNING_STRICT_FATAL(true, ("Error getting back string id param on script return")); + } + } + break; //---------------------------------------------------------------------- //-- menu info - case 'm': - if (i < argList.size() - 1 && argList[i+1] == '*') - { - ++i; + case 'm': + if (i < argList.size() - 1 && argList[i + 1] == '*') + { + ++i; - LocalRefPtr arg = getObjectArrayElement(LocalObjectArrayRefParam(jparams), paramIndex + 1); - MenuDataVector * menuVector = new MenuDataVector; - convert(arg, *menuVector); - args.changeParam (paramIndex, *menuVector, true); - } - break; + LocalRefPtr arg = getObjectArrayElement(LocalObjectArrayRefParam(jparams), paramIndex + 1); + MenuDataVector * menuVector = new MenuDataVector; + convert(arg, *menuVector); + args.changeParam(paramIndex, *menuVector, true); + } + break; //---------------------------------------------------------------------- - default: - break; + default: + break; } // skip extra characters in the arglist if (i < argList.size() - 1) { - if (argList[i+1] == '[' || argList[i+1] == '*') + if (argList[i + 1] == '[' || argList[i + 1] == '*') ++i; } } @@ -4053,7 +4042,7 @@ int JavaLibrary::runScripts(const NetworkId & caller, caller.getValueString().c_str(), method.c_str())); if (ms_env == nullptr || ms_clsObject == nullptr) - { + { DEBUG_REPORT_LOG(ConfigServerGame::getJavaConsoleDebugMessages(), ( "JavaLibrary::runScripts exit, self = %s, method = %s\n", caller.getValueString().c_str(), method.c_str())); @@ -4071,9 +4060,9 @@ int JavaLibrary::runScripts(const NetworkId & caller, if (ms_currentRecursionCount >= MAX_RECURSION_COUNT) { DEBUG_REPORT_LOG(true, ("JavaLibrary::runScripts (C version) max recursion " - "count reached, method = %s, object id = %s, dumping script!\n", + "count reached, method = %s, object id = %s, dumping script!\n", method.c_str(), caller.getValueString().c_str())); - LOG("ScriptInvestigation", ("runSCripts failed because max recursion count reached")); + LOG("ScriptInvestigation", ("runSCripts failed because max recursion count reached")); return SCRIPT_OVERRIDE; } @@ -4097,7 +4086,7 @@ int JavaLibrary::runScripts(const NetworkId & caller, DEBUG_REPORT_LOG(ConfigServerGame::getJavaConsoleDebugMessages(), ( "JavaLibrary::runScripts exit, self = %s, method = %s\n", caller.getValueString().c_str(), method.c_str())); - LOG("ScriptInvestigation", ("runSCripts failed because could not convert params")); + LOG("ScriptInvestigation", ("runSCripts failed because could not convert params")); return SCRIPT_OVERRIDE; } @@ -4105,7 +4094,7 @@ int JavaLibrary::runScripts(const NetworkId & caller, jint result = callScriptEntry(jmethod, jparams->getValue()); //========================================================================== - // !!IMPORTANT after this point our env pointer may have changed, we can't + // !!IMPORTANT after this point our env pointer may have changed, we can't // call any JNI functions on objects created with the old pointer!! //========================================================================== @@ -4131,7 +4120,7 @@ int JavaLibrary::runScripts(const NetworkId & caller, DEBUG_REPORT_LOG(ConfigServerGame::getJavaConsoleDebugMessages(), ( "JavaLibrary::runScripts exit, self = %s, method = %s\n", caller.getValueString().c_str(), method.c_str())); - LOG("ScriptInvestigation", ("runSCripts failed because exception after delete")); + LOG("ScriptInvestigation", ("runSCripts failed because exception after delete")); return SCRIPT_OVERRIDE; } } @@ -4157,7 +4146,7 @@ int JavaLibrary::runScripts(const NetworkId & caller, * * @return SCRIPT_CONTINUE or SCRIPT_OVERRIDE */ -int JavaLibrary::runScripts(const NetworkId & caller, +int JavaLibrary::runScripts(const NetworkId & caller, const std::string& method, const std::string& argList, const StringVector_t &args) { DEBUG_WARNING(true, ("Running scripts from the console not currently supported")); @@ -4191,7 +4180,7 @@ int JavaLibrary::runScript(const NetworkId & caller, const std::string& script, script.c_str(), caller.getValueString().c_str(), method.c_str())); if (ms_env == nullptr || ms_midRunOne == nullptr || ms_clsObject == nullptr) - { + { if (!ms_env) { LOG("ScriptInvestigation", ("runSCripts2 failed because env was nullptr")); @@ -4204,7 +4193,7 @@ int JavaLibrary::runScript(const NetworkId & caller, const std::string& script, { LOG("ScriptInvestigation", ("runSCripts2 failed because clsObject was nullptr")); } - + return SCRIPT_OVERRIDE; } @@ -4213,7 +4202,7 @@ int JavaLibrary::runScript(const NetworkId & caller, const std::string& script, DEBUG_REPORT_LOG(true, ("JavaLibrary::runScript (C version) max recursion " "count reached, script = %s, method = %s, object id = %s, dumping " "script!\n", script.c_str(), method.c_str(), caller.getValueString().c_str())); - LOG("ScriptInvestigation", ("runSCripts2 failed because max recursion count reached")); + LOG("ScriptInvestigation", ("runSCripts2 failed because max recursion count reached")); return SCRIPT_OVERRIDE; } @@ -4222,14 +4211,14 @@ int JavaLibrary::runScript(const NetworkId & caller, const std::string& script, if (ms_env->ExceptionCheck()) { ms_env->ExceptionDescribe(); - LOG("ScriptInvestigation", ("runSCripts2 failed because of exception")); + LOG("ScriptInvestigation", ("runSCripts2 failed because of exception")); return SCRIPT_OVERRIDE; } JavaString jmethod(method.c_str()); if (ms_env->ExceptionCheck()) { ms_env->ExceptionDescribe(); - LOG("ScriptInvestigation", ("runSCripts2 failed because of exception2")); + LOG("ScriptInvestigation", ("runSCripts2 failed because of exception2")); return SCRIPT_OVERRIDE; } @@ -4238,15 +4227,15 @@ int JavaLibrary::runScript(const NetworkId & caller, const std::string& script, if (jparams == LocalObjectArrayRef::cms_nullPtr) { ms_env->ExceptionDescribe(); - LOG("ScriptInvestigation", ("runSCripts2 failed because of exception3")); + LOG("ScriptInvestigation", ("runSCripts2 failed because of exception3")); return SCRIPT_OVERRIDE; } // invoke the script method jint result = callScriptEntry(jscript, jmethod, jparams->getValue()); - + //========================================================================== - // !!IMPORTANT after this point our env pointer may have changed, we can't + // !!IMPORTANT after this point our env pointer may have changed, we can't // call any JNI functions on objects created with the old pointer!! //========================================================================== @@ -4271,7 +4260,7 @@ int JavaLibrary::runScript(const NetworkId & caller, const std::string& script, if (ms_env->ExceptionCheck()) { ms_env->ExceptionDescribe(); - LOG("ScriptInvestigation", ("runScript failed because of exception4")); + LOG("ScriptInvestigation", ("runScript failed because of exception4")); return SCRIPT_OVERRIDE; } } @@ -4308,7 +4297,7 @@ int JavaLibrary::runScript(const NetworkId & caller, const std::string& script, PROFILER_AUTO_BLOCK_CHECK_DEFINE("JavaLibrary::runScript"); DEBUG_REPORT_LOG(true, ("JavaLibrary::runScript %s enter, method = %s\n", - script.c_str(), method.c_str())); + script.c_str(), method.c_str())); if (ms_env == nullptr || ms_midRunOne == nullptr || ms_clsObject == nullptr) { @@ -4331,9 +4320,9 @@ int JavaLibrary::runScript(const NetworkId & caller, const std::string& script, { DEBUG_REPORT_LOG(true, ("JavaLibrary::runScript (Java version) max " "recursion count reached, script = %s, method = %s, object id = %s, " - "dumping script!\n", script.c_str(), method.c_str(), + "dumping script!\n", script.c_str(), method.c_str(), caller.getValueString().c_str())); - LOG("ScriptInvestigation", ("runSCripts3 failed because of max recursion count")); + LOG("ScriptInvestigation", ("runSCripts3 failed because of max recursion count")); return SCRIPT_OVERRIDE; } @@ -4342,14 +4331,14 @@ int JavaLibrary::runScript(const NetworkId & caller, const std::string& script, if (ms_env->ExceptionCheck()) { ms_env->ExceptionDescribe(); - LOG("ScriptInvestigation", ("runSCripts3 failed because of exception")); + LOG("ScriptInvestigation", ("runSCripts3 failed because of exception")); return SCRIPT_OVERRIDE; } JavaString jmethod(method.c_str()); if (ms_env->ExceptionCheck()) { ms_env->ExceptionDescribe(); - LOG("ScriptInvestigation", ("runSCripts3 failed because of exception2")); + LOG("ScriptInvestigation", ("runSCripts3 failed because of exception2")); return SCRIPT_OVERRIDE; } @@ -4362,7 +4351,7 @@ int JavaLibrary::runScript(const NetworkId & caller, const std::string& script, if (ms_env->ExceptionCheck()) { ms_env->ExceptionDescribe(); - LOG("ScriptInvestigation", ("runSCripts3 failed because of exception3")); + LOG("ScriptInvestigation", ("runSCripts3 failed because of exception3")); return SCRIPT_OVERRIDE; } for (int i = 1; i < argsCount; ++i) @@ -4377,7 +4366,7 @@ int JavaLibrary::runScript(const NetworkId & caller, const std::string& script, if (ms_env->ExceptionCheck()) { ms_env->ExceptionDescribe(); - LOG("ScriptInvestigation", ("runSCripts3 failed because of exception4")); + LOG("ScriptInvestigation", ("runSCripts3 failed because of exception4")); return SCRIPT_OVERRIDE; } @@ -4385,7 +4374,7 @@ int JavaLibrary::runScript(const NetworkId & caller, const std::string& script, jint result = callScriptEntry(jscript, jmethod, jparams->getValue()); //========================================================================== - // !!IMPORTANT after this point our env pointer may have changed, we can't + // !!IMPORTANT after this point our env pointer may have changed, we can't // call any JNI functions on objects created with the old pointer!! //========================================================================== @@ -4394,7 +4383,7 @@ int JavaLibrary::runScript(const NetworkId & caller, const std::string& script, if (ms_env->ExceptionCheck()) { ms_env->ExceptionDescribe(); - LOG("ScriptInvestigation", ("runSCripts3 failed because of exception5")); + LOG("ScriptInvestigation", ("runSCripts3 failed because of exception5")); return SCRIPT_OVERRIDE; } } @@ -4408,7 +4397,7 @@ int JavaLibrary::runScript(const NetworkId & caller, const std::string& script, } DEBUG_REPORT_LOG(true, ("JavaLibrary::runScript %s exit, method = %s\n", - script.c_str(), method.c_str())); + script.c_str(), method.c_str())); return result; } // JavaLibrary::runScript(jobjectArray args) @@ -4451,7 +4440,7 @@ int JavaLibrary::runScript(const NetworkId & caller, const std::string& script, { LOG("ScriptInvestigation", ("runSCripts4 failed because clsObject was nullptr")); } - + return SCRIPT_OVERRIDE; } @@ -4459,9 +4448,9 @@ int JavaLibrary::runScript(const NetworkId & caller, const std::string& script, { DEBUG_REPORT_LOG(true, ("JavaLibrary::runScript (console version) max " "recursion count reached, script = %s, method = %s, object id = %s, " - "dumping script!\n", script.c_str(), method.c_str(), + "dumping script!\n", script.c_str(), method.c_str(), caller.getValueString().c_str())); - LOG("ScriptInvestigation", ("runSCripts4 failed because of max recursion count")); + LOG("ScriptInvestigation", ("runSCripts4 failed because of max recursion count")); return SCRIPT_OVERRIDE; } @@ -4470,13 +4459,13 @@ int JavaLibrary::runScript(const NetworkId & caller, const std::string& script, if (ms_env->ExceptionCheck()) { ms_env->ExceptionDescribe(); - LOG("ScriptInvestigation", ("runSCripts4 failed because of exception")); + LOG("ScriptInvestigation", ("runSCripts4 failed because of exception")); return SCRIPT_OVERRIDE; } JavaString jmethod(method.c_str()); if (ms_env->ExceptionCheck()) { - LOG("ScriptInvestigation", ("runSCripts4 failed because of exception2")); + LOG("ScriptInvestigation", ("runSCripts4 failed because of exception2")); ms_env->ExceptionDescribe(); return SCRIPT_OVERRIDE; } @@ -4487,7 +4476,7 @@ int JavaLibrary::runScript(const NetworkId & caller, const std::string& script, if (ms_env->ExceptionCheck()) { ms_env->ExceptionDescribe(); - LOG("ScriptInvestigation", ("runSCripts4 failed because of exception3")); + LOG("ScriptInvestigation", ("runSCripts4 failed because of exception3")); return SCRIPT_OVERRIDE; } // add the "self" parameter @@ -4496,7 +4485,7 @@ int JavaLibrary::runScript(const NetworkId & caller, const std::string& script, if (ms_env->ExceptionCheck()) { ms_env->ExceptionDescribe(); - LOG("ScriptInvestigation", ("runSCripts4 failed because of exception4")); + LOG("ScriptInvestigation", ("runSCripts4 failed because of exception4")); return SCRIPT_OVERRIDE; } @@ -4507,55 +4496,55 @@ int JavaLibrary::runScript(const NetworkId & caller, const std::string& script, const char *stringArg = Unicode::wideToNarrow(args[i]).c_str(); switch (argList[i]) { - case 'i': - { - jint param = atoi(stringArg); - arg = createNewObject(ms_clsInteger, ms_midInteger, param); - } - break; - case 'f': - { - jfloat param = static_cast(atof(stringArg)); - arg = createNewObject(ms_clsFloat, ms_midFloat, param); - } - break; - case 's': - { - arg = createNewString(stringArg); - } - break; - case 'u': - { - arg = createNewString(args[i].c_str(), static_cast(args[i].size())); - } - break; - case 'O': - { - arg = getObjId(NetworkId(stringArg)); - if (arg == LocalRef::cms_nullPtr) - { - LOG("ScriptInvestigation", ("runSCripts4 failed because of bad objid")); - return SCRIPT_OVERRIDE; - } - } - break; - default: - DEBUG_REPORT_LOG(true, ("unknown parameter type %c(%#x)\n", argList[i], - static_cast(argList[i]))); //lint !e571 suspicious cast - LOG("ScriptInvestigation", ("runSCripts4 failed because of param")); + case 'i': + { + jint param = atoi(stringArg); + arg = createNewObject(ms_clsInteger, ms_midInteger, param); + } + break; + case 'f': + { + jfloat param = static_cast(atof(stringArg)); + arg = createNewObject(ms_clsFloat, ms_midFloat, param); + } + break; + case 's': + { + arg = createNewString(stringArg); + } + break; + case 'u': + { + arg = createNewString(args[i].c_str(), static_cast(args[i].size())); + } + break; + case 'O': + { + arg = getObjId(NetworkId(stringArg)); + if (arg == LocalRef::cms_nullPtr) + { + LOG("ScriptInvestigation", ("runSCripts4 failed because of bad objid")); return SCRIPT_OVERRIDE; + } + } + break; + default: + DEBUG_REPORT_LOG(true, ("unknown parameter type %c(%#x)\n", argList[i], + static_cast(argList[i]))); //lint !e571 suspicious cast + LOG("ScriptInvestigation", ("runSCripts4 failed because of param")); + return SCRIPT_OVERRIDE; } if (ms_env->ExceptionCheck()) { ms_env->ExceptionDescribe(); - LOG("ScriptInvestigation", ("runSCripts4 failed because of exception5")); + LOG("ScriptInvestigation", ("runSCripts4 failed because of exception5")); return SCRIPT_OVERRIDE; } setObjectArrayElement(*jparams, static_cast(i + 1), *arg); if (ms_env->ExceptionCheck()) { ms_env->ExceptionDescribe(); - LOG("ScriptInvestigation", ("runSCripts4 failed because of exception6")); + LOG("ScriptInvestigation", ("runSCripts4 failed because of exception6")); return SCRIPT_OVERRIDE; } } @@ -4564,7 +4553,7 @@ int JavaLibrary::runScript(const NetworkId & caller, const std::string& script, jint result = callScriptEntry(jscript, jmethod, jparams->getValue()); //========================================================================== - // !!IMPORTANT after this point our env pointer may have changed, we can't + // !!IMPORTANT after this point our env pointer may have changed, we can't // call any JNI functions on objects created with the old pointer!! //========================================================================== @@ -4573,7 +4562,7 @@ int JavaLibrary::runScript(const NetworkId & caller, const std::string& script, if (ms_env->ExceptionCheck()) { ms_env->ExceptionDescribe(); - LOG("ScriptInvestigation", ("runSCripts4 failed because of exception7")); + LOG("ScriptInvestigation", ("runSCripts4 failed because of exception7")); return SCRIPT_OVERRIDE; } } @@ -4590,7 +4579,7 @@ int JavaLibrary::runScript(const NetworkId & caller, const std::string& script, } // JavaLibrary::runScript(StringVector_t args) /** - * Calls a special function on a script that returns a string instead of an + * Calls a special function on a script that returns a string instead of an * integer. The script function has no "self" associated with it. * * @param script the name of the script to call @@ -4600,10 +4589,10 @@ int JavaLibrary::runScript(const NetworkId & caller, const std::string& script, * * @return the string returned from the script function */ -std::string JavaLibrary::callScriptConsoleHandler(const std::string & script, +std::string JavaLibrary::callScriptConsoleHandler(const std::string & script, const std::string & method, const std::string & argList, ScriptParams & args) { -static const std::string errorReturnString; + static const std::string errorReturnString; // get the current env count, in case we reset our Java connection int currentEnvCount = ms_envCount; @@ -4613,11 +4602,11 @@ static const std::string errorReturnString; GlobalInstances globals; DEBUG_REPORT_LOG(ConfigServerGame::getJavaConsoleDebugMessages(), ( - "JavaLibrary::runScript %s enter, method = %s\n", script.c_str(), + "JavaLibrary::runScript %s enter, method = %s\n", script.c_str(), method.c_str())); if (ms_env == nullptr || ms_midRunConsoleHandler == nullptr || ms_clsObject == nullptr) - { + { if (!ms_env) { LOG("ScriptInvestigation", ("runSCripts2 failed because env was nullptr")); @@ -4630,7 +4619,7 @@ static const std::string errorReturnString; { LOG("ScriptInvestigation", ("runSCripts2 failed because clsObject was nullptr")); } - + return errorReturnString; } @@ -4648,14 +4637,14 @@ static const std::string errorReturnString; if (ms_env->ExceptionCheck()) { ms_env->ExceptionDescribe(); - LOG("ScriptInvestigation", ("callScriptConsoleHandler failed because of exception")); + LOG("ScriptInvestigation", ("callScriptConsoleHandler failed because of exception")); return errorReturnString; } JavaString jmethod(method.c_str()); if (ms_env->ExceptionCheck()) { ms_env->ExceptionDescribe(); - LOG("ScriptInvestigation", ("callScriptConsoleHandler failed because of exception2")); + LOG("ScriptInvestigation", ("callScriptConsoleHandler failed because of exception2")); return errorReturnString; } @@ -4664,7 +4653,7 @@ static const std::string errorReturnString; if (jparams == LocalObjectArrayRef::cms_nullPtr) { ms_env->ExceptionDescribe(); - LOG("ScriptInvestigation", ("callScriptConsoleHandler failed because of exception3")); + LOG("ScriptInvestigation", ("callScriptConsoleHandler failed because of exception3")); return errorReturnString; } @@ -4672,7 +4661,7 @@ static const std::string errorReturnString; jstring result = callScriptConsoleHandlerEntry(jscript, jmethod, jparams->getValue()); //========================================================================== - // !!IMPORTANT after this point our env pointer may have changed, we can't + // !!IMPORTANT after this point our env pointer may have changed, we can't // call any JNI functions on objects created with the old pointer!! //========================================================================== @@ -4777,7 +4766,7 @@ int JavaLibrary::callMessages(const NetworkId & caller, const std::string & meth { LOG("ScriptInvestigation", ("callMessages failed because clsObject was nullptr")); } - + return SCRIPT_OVERRIDE; } @@ -4812,13 +4801,13 @@ int JavaLibrary::callMessages(const NetworkId & caller, const std::string & meth { LOG("ScriptRecursion", ("callMessages recursion %d", ms_currentRecursionCount)); } - result = ms_env->CallStaticIntMethod(ms_clsScriptEntry, ms_midCallMessages, jmethod.getValue(), caller.getValue(), jdictionary); - --ms_currentRecursionCount; + result = ms_env->CallStaticIntMethod(ms_clsScriptEntry, ms_midCallMessages, jmethod.getValue(), caller.getValue(), jdictionary); + --ms_currentRecursionCount; result = handleScriptEntryCleanup(result); //========================================================================== - // !!IMPORTANT after this point our env pointer may have changed, we can't + // !!IMPORTANT after this point our env pointer may have changed, we can't // call any JNI functions on objects created with the old pointer!! //========================================================================== @@ -4882,7 +4871,7 @@ int JavaLibrary::callMessage(const NetworkId & caller, const std::string & scrip script.c_str(), method.c_str(), caller.getValueString().c_str())); LOG("ScriptInvestigation", ("callMessage failed because max recursion count")); return SCRIPT_OVERRIDE; - } + } const JavaDictionary * dictionary = dynamic_cast(&data); if (dictionary == nullptr) @@ -4955,7 +4944,7 @@ int JavaLibrary::callMessage(const NetworkId & caller, const std::string & scrip int result = callScriptEntry(jscript, jmethod, jparams->getValue()); //========================================================================== - // !!IMPORTANT after this point our env pointer may have changed, we can't + // !!IMPORTANT after this point our env pointer may have changed, we can't // call any JNI functions on objects created with the old pointer!! //========================================================================== @@ -4991,7 +4980,7 @@ int JavaLibrary::callMessage(const NetworkId & caller, const std::string & scrip const bool JavaLibrary::getClassName(const jclass & sourceClass, std::string & target) { bool result = false; - if(ms_env) + if (ms_env) { const LocalRefParamPtr classPtr(new LocalRefParam(sourceClass)); JavaStringPtr s = callStringMethod(*classPtr, JavaLibrary::ms_midClassGetName); @@ -5070,12 +5059,12 @@ bool JavaLibrary::unpackDictionary(const std::vector & packedData, uint32 crc = 0; int dataLen = packedData.size(); const int8 * data = &packedData[0]; - - std::vector::const_iterator result = std::find(packedData.begin(), + + std::vector::const_iterator result = std::find(packedData.begin(), packedData.end(), '*'); if (result != packedData.end()) { - // double-check: verify all the characters before the marker are + // double-check: verify all the characters before the marker are // digits int i; int markerPos = packedData.end() - result; @@ -5087,7 +5076,7 @@ bool JavaLibrary::unpackDictionary(const std::vector & packedData, } if (i == markerPos) { - data = &data[markerPos+1]; + data = &data[markerPos + 1]; // verify the crc dataLen -= markerPos + 1; uint32 dataCrc = Crc::calculate(data, dataLen); @@ -5099,7 +5088,7 @@ bool JavaLibrary::unpackDictionary(const std::vector & packedData, } } } - + if (data != nullptr && *data != '\0') { LocalByteArrayRefPtr jdata = createNewByteArray(dataLen); @@ -5133,7 +5122,7 @@ const bool JavaLibrary::convert(const JavaStringParam & source, std::string & ta { jboolean isCopy(false); const char * temp = ms_env->GetStringUTFChars(source.getValue(), &isCopy); - if(temp) + if (temp) { target = temp; ms_env->ReleaseStringUTFChars(source.getValue(), temp); @@ -5200,14 +5189,13 @@ const bool JavaLibrary::convert(const JavaDictionary & source, std::vector return result; } // JavaLibrary::convert(const JavaDictionary &, std::string &) - //======================================================================= const bool JavaLibrary::convert(const std::map & source, JavaDictionaryPtr & target) { std::vector > sourceData; - std::map:: const_iterator i; - for(i = source.begin(); i != source.end(); ++i) + std::map::const_iterator i; + for (i = source.begin(); i != source.end(); ++i) { sourceData.push_back(*i); } @@ -5226,7 +5214,7 @@ const bool JavaLibrary::convert(const std::vector > return false; std::vector >::const_iterator i; - for(i = source.begin(); i != source.end(); ++i) + for (i = source.begin(); i != source.end(); ++i) { int value = (*i).second; JavaString name((*i).first.c_str()); @@ -5247,7 +5235,7 @@ const bool JavaLibrary::convert(const std::vector > >::const_iterator i; - for(i = source.begin(); i != source.end(); ++i) + for (i = source.begin(); i != source.end(); ++i) { int value = (*i).second.first; JavaString name((*i).first.c_str()); @@ -5268,8 +5256,8 @@ const bool JavaLibrary::convert(const std::vector > return false; std::vector >::const_iterator i; - for(i = source.begin(); i != source.end(); ++i) -{ + for (i = source.begin(); i != source.end(); ++i) + { JavaString name((*i).first.c_str()); bool value = (*i).second; callObjectMethod(*target, ms_midDictionaryPutBool, name.getValue(), value); @@ -5280,288 +5268,287 @@ const bool JavaLibrary::convert(const std::vector > //======================================================================= namespace ScriptConversion { - -const bool convert(const jobject & source, Vector & target, NetworkId & targetCell, const Vector & i_default) -{ - if (!convert(source, target, targetCell)) + const bool convert(const jobject & source, Vector & target, NetworkId & targetCell, const Vector & i_default) { - target = i_default; - targetCell = NetworkId::cms_invalid; + if (!convert(source, target, targetCell)) + { + target = i_default; + targetCell = NetworkId::cms_invalid; + } + return true; } - return true; -} -const bool convert(const std::vector & source, LocalObjectArrayRefPtr & target) -{ - if (!JavaLibrary::getEnv()) - return false; + const bool convert(const std::vector & source, LocalObjectArrayRefPtr & target) + { + if (!JavaLibrary::getEnv()) + return false; - bool result = false; + bool result = false; int count = source.size(); - target = createNewObjectArray(count, JavaLibrary::ms_clsString); - if (target != LocalObjectArrayRef::cms_nullPtr) + target = createNewObjectArray(count, JavaLibrary::ms_clsString); + if (target != LocalObjectArrayRef::cms_nullPtr) { result = true; for (int i = 0; i < count; ++i) { if (source[i] != nullptr) { - JavaString targetElement(*source[i]); - setObjectArrayElement(*target, i, targetElement); + JavaString targetElement(*source[i]); + setObjectArrayElement(*target, i, targetElement); + } } } - } - return result; -} - -const bool convert(const jobject source, StringId & target) -{ - if (source == 0) - return false; - - JNIEnv * env = JavaLibrary::getEnv(); - if (!env) - return false; - - if (env->IsInstanceOf(source, JavaLibrary::ms_clsStringId) == JNI_FALSE) - return false; - - // @todo: it would be nice if we had a known max length for the table - // name and text in order to use buffers to get the strings - - // get the table - { - JavaStringPtr tempString = getStringField(LocalRefParam(source), JavaLibrary::ms_fidStringIdTable); - std::string localString; - JavaLibrary::convert(*tempString, localString); - target.setTable(localString); + return result; } - // get the text + const bool convert(const jobject source, StringId & target) { - JavaStringPtr tempString = getStringField(LocalRefParam(source), JavaLibrary::ms_fidStringIdAsciiId); - if (tempString != JavaString::cms_nullPtr && getStringLength(*tempString) > 0) + if (source == 0) + return false; + + JNIEnv * env = JavaLibrary::getEnv(); + if (!env) + return false; + + if (env->IsInstanceOf(source, JavaLibrary::ms_clsStringId) == JNI_FALSE) + return false; + + // @todo: it would be nice if we had a known max length for the table + // name and text in order to use buffers to get the strings + + // get the table { + JavaStringPtr tempString = getStringField(LocalRefParam(source), JavaLibrary::ms_fidStringIdTable); std::string localString; JavaLibrary::convert(*tempString, localString); - target.setText(localString); + target.setTable(localString); } - else + + // get the text { - // get the text index - jint textIndex = env->GetIntField(source, JavaLibrary::ms_fidStringIdIndexId); - target.setTextIndex(textIndex); + JavaStringPtr tempString = getStringField(LocalRefParam(source), JavaLibrary::ms_fidStringIdAsciiId); + if (tempString != JavaString::cms_nullPtr && getStringLength(*tempString) > 0) + { + std::string localString; + JavaLibrary::convert(*tempString, localString); + target.setText(localString); + } + else + { + // get the text index + jint textIndex = env->GetIntField(source, JavaLibrary::ms_fidStringIdIndexId); + target.setTextIndex(textIndex); + } } + + return true; } - return true; -} - -const bool convert(const LocalRefParam & source, StringId & target) -{ - return convert(source.getValue(), target); -} - -const bool convert(const StringId & source, LocalRefPtr & target) -{ - if (!JavaLibrary::getEnv()) - return false; - - target = allocObject(JavaLibrary::ms_clsStringId); - if (target == LocalRef::cms_nullPtr) - return false; - - // convert the table + const bool convert(const LocalRefParam & source, StringId & target) { - JavaString tempString(source.getTable().c_str()); - setObjectField(*target, JavaLibrary::ms_fidStringIdTable, tempString); + return convert(source.getValue(), target); } - // convert the text + const bool convert(const StringId & source, LocalRefPtr & target) { - JavaString tempString(source.getText().c_str()); - setObjectField(*target, JavaLibrary::ms_fidStringIdAsciiId, tempString); + if (!JavaLibrary::getEnv()) + return false; + + target = allocObject(JavaLibrary::ms_clsStringId); + if (target == LocalRef::cms_nullPtr) + return false; + + // convert the table + { + JavaString tempString(source.getTable().c_str()); + setObjectField(*target, JavaLibrary::ms_fidStringIdTable, tempString); + } + + // convert the text + { + JavaString tempString(source.getText().c_str()); + setObjectField(*target, JavaLibrary::ms_fidStringIdAsciiId, tempString); + } + + // convert the index + setIntField(*target, JavaLibrary::ms_fidStringIdIndexId, source.getTextIndex()); + return true; } - // convert the index - setIntField(*target, JavaLibrary::ms_fidStringIdIndexId, source.getTextIndex()); - return true; -} - -const bool convert(const std::vector & source, LocalObjectArrayRefPtr & strArray) -{ - JNIEnv * env = JavaLibrary::getEnv(); - if (!env) - return false; - - if (env->ExceptionCheck()) + const bool convert(const std::vector & source, LocalObjectArrayRefPtr & strArray) { - env->ExceptionDescribe(); - return false; - } + JNIEnv * env = JavaLibrary::getEnv(); + if (!env) + return false; - strArray = createNewObjectArray(static_cast(source.size()), JavaLibrary::ms_clsString); - std::vector::const_iterator i; - int index = 0; - for(i = source.begin(); i != source.end(); ++i) - { - const char * s = (*i).c_str(); - JavaString js(s); if (env->ExceptionCheck()) { env->ExceptionDescribe(); return false; } - setObjectArrayElement(*strArray, index, js); + + strArray = createNewObjectArray(static_cast(source.size()), JavaLibrary::ms_clsString); + std::vector::const_iterator i; + int index = 0; + for (i = source.begin(); i != source.end(); ++i) + { + const char * s = (*i).c_str(); + JavaString js(s); + if (env->ExceptionCheck()) + { + env->ExceptionDescribe(); + return false; + } + setObjectArrayElement(*strArray, index, js); + if (env->ExceptionCheck()) + { + env->ExceptionDescribe(); + return false; + } + ++index; + } + return true; + } + + const bool convert(const std::vector & source, LocalObjectArrayRefPtr & strArray) + { + JNIEnv * env = JavaLibrary::getEnv(); + if (!env) + return false; + if (env->ExceptionCheck()) { env->ExceptionDescribe(); return false; } - ++index; - } - return true; -} -const bool convert(const std::vector & source, LocalObjectArrayRefPtr & strArray) -{ - JNIEnv * env = JavaLibrary::getEnv(); - if (!env) - return false; - - if (env->ExceptionCheck()) - { - env->ExceptionDescribe(); - return false; + strArray = createNewObjectArray(static_cast(source.size()), JavaLibrary::ms_clsString); + std::vector::const_iterator i; + int index = 0; + for (i = source.begin(); i != source.end(); ++i) + { + JavaString js(*i); + if (env->ExceptionCheck()) + { + env->ExceptionDescribe(); + return false; + } + setObjectArrayElement(*strArray, index, js); + if (env->ExceptionCheck()) + { + env->ExceptionDescribe(); + return false; + } + ++index; + } + return true; } - strArray = createNewObjectArray(static_cast(source.size()), JavaLibrary::ms_clsString); - std::vector::const_iterator i; - int index = 0; - for(i = source.begin(); i != source.end(); ++i) + const bool convert(const std::set & source, LocalObjectArrayRefPtr & strArray) { - JavaString js(*i); + JNIEnv * env = JavaLibrary::getEnv(); + if (!env) + return false; + if (env->ExceptionCheck()) { env->ExceptionDescribe(); return false; } - setObjectArrayElement(*strArray, index, js); - if (env->ExceptionCheck()) + + strArray = createNewObjectArray(static_cast(source.size()), JavaLibrary::ms_clsString); + std::set::const_iterator i; + int index = 0; + for (i = source.begin(); i != source.end(); ++i) { - env->ExceptionDescribe(); - return false; + const std::string name = (*i).getName(); + const char * const s = name.c_str(); + + JavaString js(s); + if (env->ExceptionCheck()) + { + env->ExceptionDescribe(); + return false; + } + setObjectArrayElement(*strArray, index, js); + if (env->ExceptionCheck()) + { + env->ExceptionDescribe(); + return false; + } + ++index; } - ++index; - } - return true; -} -const bool convert(const std::set & source, LocalObjectArrayRefPtr & strArray) -{ - JNIEnv * env = JavaLibrary::getEnv(); - if (!env) - return false; - - if (env->ExceptionCheck()) - { - env->ExceptionDescribe(); - return false; + return true; } - strArray = createNewObjectArray(static_cast(source.size()), JavaLibrary::ms_clsString); - std::set::const_iterator i; - int index = 0; - for(i = source.begin(); i != source.end(); ++i) + const bool convert(const jobjectArray & source, stdvector::fwd & target) { - const std::string name = (*i).getName(); - const char * const s = name.c_str(); + JNIEnv * env = JavaLibrary::getEnv(); + if (!env || !source) + return false; - JavaString js(s); - if (env->ExceptionCheck()) + int count = env->GetArrayLength(source); + target.resize(count, ""); + + std::string tempString; + for (int i = 0; i < count; ++i) { - env->ExceptionDescribe(); - return false; + JavaStringPtr s = getStringArrayElement(LocalObjectArrayRefParam(source), i); + if (s != JavaString::cms_nullPtr) + { + if (JavaLibrary::convert(*s, tempString)) + target[i] = tempString; + } } - setObjectArrayElement(*strArray, index, js); - if (env->ExceptionCheck()) - { - env->ExceptionDescribe(); - return false; - } - ++index; + return true; } - return true; -} - -const bool convert(const jobjectArray & source, stdvector::fwd & target) -{ - JNIEnv * env = JavaLibrary::getEnv(); - if (!env || !source) - return false; - - int count = env->GetArrayLength(source); - target.resize(count, ""); - - std::string tempString; - for (int i = 0; i < count; ++i) + const bool convert(const jlongArray & source, std::vector &results) { - JavaStringPtr s = getStringArrayElement(LocalObjectArrayRefParam(source), i); - if (s != JavaString::cms_nullPtr) -{ - if (JavaLibrary::convert(*s, tempString)) - target[i] = tempString; - } - } - return true; -} - -const bool convert(const jlongArray & source, std::vector &results) -{ - bool result = false; - JNIEnv * env = JavaLibrary::getEnv(); - if (!env || !source) - return false; + bool result = false; + JNIEnv * env = JavaLibrary::getEnv(); + if (!env || !source) + return false; jsize count = env->GetArrayLength(source); jsize i; result = true; - jlong jlongTmp; - for (i=0; iGetLongArrayRegion(source, i, 1, &jlongTmp); - NetworkId nid(jlongTmp); - if (!nid) - { + env->GetLongArrayRegion(source, i, 1, &jlongTmp); + NetworkId nid(jlongTmp); + if (!nid) + { result = false; - } - else - { + } + else + { results.push_back(nid); - } + } } - return result; -} + return result; + } -const bool convert(const jlongArray & source, std::vector &results) -{ - JNIEnv * env = JavaLibrary::getEnv(); - if (!env || !source) + const bool convert(const jlongArray & source, std::vector &results) + { + JNIEnv * env = JavaLibrary::getEnv(); + if (!env || !source) return false; - bool result = false; + bool result = false; jsize count = env->GetArrayLength(source); jsize i; result = true; - for (i=0; iGetLongArrayRegion(source, i, 1, &id); + jlong id; + env->GetLongArrayRegion(source, i, 1, &id); ServerObject * object = 0; - if (!JavaLibrary::getObject(id, object)) + if (!JavaLibrary::getObject(id, object)) { result = false; } @@ -5571,855 +5558,852 @@ const bool convert(const jlongArray & source, std::vector &resul } } - return result; -} + return result; + } -const bool convert(const std::vector &source, LocalLongArrayRefPtr & result) -{ - JNIEnv * env = JavaLibrary::getEnv(); - if (!env) + const bool convert(const std::vector &source, LocalLongArrayRefPtr & result) + { + JNIEnv * env = JavaLibrary::getEnv(); + if (!env) return false; - int count = source.size(); - bool rv = true; - int resultCount = 0; - for (int i = 0; i < count; ++i) - { - if (source[i]) + int count = source.size(); + bool rv = true; + int resultCount = 0; + for (int i = 0; i < count; ++i) { - resultCount++; - } - } - result = createNewLongArray(resultCount); - for (int j = 0; j < count; ++j) - { - if (source[j]) - { - jlong arg = (source[j]->getNetworkId()).getValue(); - if (arg == 0) + if (source[i]) { - rv = false; - break; + resultCount++; } - setLongArrayRegion(*result, static_cast(--resultCount), 1, &arg); } - } - if (env->ExceptionCheck()) - { - env->ExceptionDescribe(); - rv = false; - } - return rv; -} - -const bool convert(const std::vector &source, LocalLongArrayRefPtr & result) -{ - JNIEnv * env = JavaLibrary::getEnv(); - if (!env) - return false; - - int count = source.size(); - bool rv = true; - int i; - int resultCount = 0; - for (i = 0; i < count; ++i) - { - if (source[i].isValid()) + result = createNewLongArray(resultCount); + for (int j = 0; j < count; ++j) { - resultCount++; - } - } - result = createNewLongArray(resultCount); - jlong jlongTmp; - for (int j = 0; j < count; ++j) - { - if (source[j].isValid()) - { - jlongTmp = source[j].getValue(); - - setLongArrayRegion(*result, static_cast(--resultCount), 1, &jlongTmp); + if (source[j]) + { + jlong arg = (source[j]->getNetworkId()).getValue(); + if (arg == 0) + { + rv = false; + break; + } + setLongArrayRegion(*result, static_cast(--resultCount), 1, &arg); } - else + } + if (env->ExceptionCheck()) { + env->ExceptionDescribe(); rv = false; } + return rv; } - if (env->ExceptionCheck()) + + const bool convert(const std::vector &source, LocalLongArrayRefPtr & result) { - env->ExceptionDescribe(); - rv = false; - } - return rv; -} + JNIEnv * env = JavaLibrary::getEnv(); + if (!env) + return false; -const bool convert(const jobject & source, Vector &target, NetworkId & targetCell) -{ - JNIEnv * env = JavaLibrary::getEnv(); - if (!env) - return false; - - if (!source) - return false; - - ServerObject * object = 0; - - if (env->IsInstanceOf(source, JavaLibrary::ms_clsLocation)) - { - target.x = env->GetFloatField(source, JavaLibrary::ms_fidLocationX); - target.y = env->GetFloatField(source, JavaLibrary::ms_fidLocationY); - target.z = env->GetFloatField(source, JavaLibrary::ms_fidLocationZ); - - LocalRefPtr cell = getObjectField(LocalRefParam(source), JavaLibrary::ms_fidLocationCell); - targetCell = JavaLibrary::getNetworkId(*cell); - return true; - } - else if (JavaLibrary::getObject(source, object)) - { - target = object->getPosition_p(); - const Object * cell = ContainerInterface::getContainedByObject(*object); - targetCell = (cell) ? cell->getNetworkId() : NetworkId::cms_invalid; - return true; - } - return false; -} - -const bool convertWorld(const jobject & source, Vector &target) -{ - JNIEnv * env = JavaLibrary::getEnv(); - if (!env) - return false; - - if (!source) - return false; - - ServerObject * object = 0; - - if (env->IsInstanceOf(source, JavaLibrary::ms_clsLocation)) - { - target.x = env->GetFloatField(source, JavaLibrary::ms_fidLocationX); - target.y = env->GetFloatField(source, JavaLibrary::ms_fidLocationY); - target.z = env->GetFloatField(source, JavaLibrary::ms_fidLocationZ); - - LocalRefPtr cell = getObjectField(LocalRefParam(source), JavaLibrary::ms_fidLocationCell); - Object * cellObject = 0; - if (JavaLibrary::getObject(*cell, cellObject)) + int count = source.size(); + bool rv = true; + int i; + int resultCount = 0; + for (i = 0; i < count; ++i) { - target = cellObject->rotateTranslate_o2w(target); + if (source[i].isValid()) + { + resultCount++; + } + } + result = createNewLongArray(resultCount); + jlong jlongTmp; + for (int j = 0; j < count; ++j) + { + if (source[j].isValid()) + { + jlongTmp = source[j].getValue(); + + setLongArrayRegion(*result, static_cast(--resultCount), 1, &jlongTmp); + } + else + { + rv = false; + } + } + if (env->ExceptionCheck()) + { + env->ExceptionDescribe(); + rv = false; + } + return rv; + } + + const bool convert(const jobject & source, Vector &target, NetworkId & targetCell) + { + JNIEnv * env = JavaLibrary::getEnv(); + if (!env) + return false; + + if (!source) + return false; + + ServerObject * object = 0; + + if (env->IsInstanceOf(source, JavaLibrary::ms_clsLocation)) + { + target.x = env->GetFloatField(source, JavaLibrary::ms_fidLocationX); + target.y = env->GetFloatField(source, JavaLibrary::ms_fidLocationY); + target.z = env->GetFloatField(source, JavaLibrary::ms_fidLocationZ); + + LocalRefPtr cell = getObjectField(LocalRefParam(source), JavaLibrary::ms_fidLocationCell); + targetCell = JavaLibrary::getNetworkId(*cell); + return true; + } + else if (JavaLibrary::getObject(source, object)) + { + target = object->getPosition_p(); + const Object * cell = ContainerInterface::getContainedByObject(*object); + targetCell = (cell) ? cell->getNetworkId() : NetworkId::cms_invalid; + return true; + } + return false; + } + + const bool convertWorld(const jobject & source, Vector &target) + { + JNIEnv * env = JavaLibrary::getEnv(); + if (!env) + return false; + + if (!source) + return false; + + ServerObject * object = 0; + + if (env->IsInstanceOf(source, JavaLibrary::ms_clsLocation)) + { + target.x = env->GetFloatField(source, JavaLibrary::ms_fidLocationX); + target.y = env->GetFloatField(source, JavaLibrary::ms_fidLocationY); + target.z = env->GetFloatField(source, JavaLibrary::ms_fidLocationZ); + + LocalRefPtr cell = getObjectField(LocalRefParam(source), JavaLibrary::ms_fidLocationCell); + Object * cellObject = 0; + if (JavaLibrary::getObject(*cell, cellObject)) + { + target = cellObject->rotateTranslate_o2w(target); + } + return true; + } + else if (JavaLibrary::getObject(source, object)) + { + target = object->getPosition_w(); + return true; + } + return false; + } + + const bool convertWorld(const jlong & source, Vector &target) + { + JNIEnv * env = JavaLibrary::getEnv(); + if (!env) + return false; + + if (source == 0) + return false; + + ServerObject * object = 0; + + if (JavaLibrary::getObject(source, object)) + { + target = object->getPosition_w(); + return true; + } + return false; + } + + const bool convertWorld(const LocalRefParam & source, Vector &target) + { + return convertWorld(source.getValue(), target); + } + + const bool convert(const Vector & source, const NetworkId & sourceCell, LocalRefPtr & target) + { + return convert(source, ServerWorld::getSceneId(), sourceCell, target); + } + + const bool convert(const jobject & source, Vector & targetLoc, std::string & targetSceneId, NetworkId & targetCell) + { + JNIEnv * env = JavaLibrary::getEnv(); + if (!env) + return false; + + if (!source) + return false; + + Object * object = 0; + + if (env->IsInstanceOf(source, JavaLibrary::ms_clsLocation)) + { + // get the xyz coords + targetLoc.x = env->GetFloatField(source, JavaLibrary::ms_fidLocationX); + targetLoc.y = env->GetFloatField(source, JavaLibrary::ms_fidLocationY); + targetLoc.z = env->GetFloatField(source, JavaLibrary::ms_fidLocationZ); + + // get the scene + //@todo EAS what's the right answer here? + JavaStringPtr sceneId = getStringField(LocalRefParam(source), JavaLibrary::ms_fidLocationArea); + if (sceneId == JavaString::cms_nullPtr) + { + targetSceneId.clear(); + return false; + } + JavaLibrary::convert(*sceneId, targetSceneId); + + // get the cell + LocalRefPtr cell = getObjectField(LocalRefParam(source), JavaLibrary::ms_fidLocationCell); + targetCell = JavaLibrary::getNetworkId(*cell); + return true; + } + else if (JavaLibrary::getObject(source, object)) + { + targetLoc = object->getPosition_p(); + targetSceneId = ServerWorld::getSceneId(); + const Object * cell = ContainerInterface::getContainedByObject(*object); + targetCell = (cell) ? cell->getNetworkId() : NetworkId::cms_invalid; + return true; + } + return false; + } + + const bool convertWorld(const jobject & source, Vector & targetLoc, std::string & targetSceneId) + { + JNIEnv * env = JavaLibrary::getEnv(); + if (!env) + return false; + + if (!source) + return false; + + Object * object = 0; + + if (env->IsInstanceOf(source, JavaLibrary::ms_clsLocation)) + { + // get the xyz coords + targetLoc.x = env->GetFloatField(source, JavaLibrary::ms_fidLocationX); + targetLoc.y = env->GetFloatField(source, JavaLibrary::ms_fidLocationY); + targetLoc.z = env->GetFloatField(source, JavaLibrary::ms_fidLocationZ); + + // get the scene + //@todo EAS what's the right answer here? + JavaStringPtr sceneId = getStringField(LocalRefParam(source), JavaLibrary::ms_fidLocationArea); + if (sceneId == JavaString::cms_nullPtr) + { + targetSceneId.clear(); + return false; + } + JavaLibrary::convert(*sceneId, targetSceneId); + + // get the cell + LocalRefPtr cell = getObjectField(LocalRefParam(source), JavaLibrary::ms_fidLocationCell); + Object * cellObject = 0; + if (JavaLibrary::getObject(*cell, cellObject)) + { + targetLoc = cellObject->rotateTranslate_o2w(targetLoc); + } + return true; + } + else if (JavaLibrary::getObject(source, object)) + { + targetLoc = object->getPosition_w(); + targetSceneId = ServerWorld::getSceneId(); + return true; + } + return false; + } + + const bool convert(const Location & sourceLoc, LocalRefPtr & target) + { + JNIEnv * env = JavaLibrary::getEnv(); + if (!env) + return false; + + target = allocObject(JavaLibrary::ms_clsLocation); + if (target == LocalRef::cms_nullPtr) + return false; + + // set xyz + setFloatField(*target, JavaLibrary::ms_fidLocationX, sourceLoc.getCoordinates().x); + setFloatField(*target, JavaLibrary::ms_fidLocationY, sourceLoc.getCoordinates().y); + setFloatField(*target, JavaLibrary::ms_fidLocationZ, sourceLoc.getCoordinates().z); + // set scene id + JavaString area(sourceLoc.getSceneId()); //ServerWorld::getSceneId().c_str()); + setObjectField(*target, JavaLibrary::ms_fidLocationArea, area); + // set cell + LocalRefPtr cell = JavaLibrary::getObjId(sourceLoc.getCell()); + setObjectField(*target, JavaLibrary::ms_fidLocationCell, *cell); + return true; + } + + const bool convert(const LocalRefParam & sourceLoc, Location & target) + { + JNIEnv * env = JavaLibrary::getEnv(); + if (!env) + return false; + + if (sourceLoc.getValue() == 0) + return false; + + float x = getFloatField(sourceLoc, JavaLibrary::ms_fidLocationX); + float y = getFloatField(sourceLoc, JavaLibrary::ms_fidLocationY); + float z = getFloatField(sourceLoc, JavaLibrary::ms_fidLocationZ); + + std::string planetName; + JavaStringPtr jplanetName = getStringField(sourceLoc, JavaLibrary::ms_fidLocationArea); + if (!JavaLibrary::convert(*jplanetName, planetName)) + return false; + + LocalRefPtr cell = getObjectField(sourceLoc, JavaLibrary::ms_fidLocationCell); + NetworkId targetCell = JavaLibrary::getNetworkId(*cell); + + target.setCoordinates(Vector(x, y, z)); + target.setSceneId(planetName.c_str()); + target.setCell(targetCell); + return true; + } + + const bool convert(const LocalObjectArrayRefParam & sourceLoc, std::vector & target) + { + JNIEnv * env = JavaLibrary::getEnv(); + if (!env) + return false; + + if (sourceLoc.getValue() == 0) + return false; + + jsize count = getArrayLength(sourceLoc); + target.resize(count); + for (int i = 0; i < count; ++i) + { + LocalRefPtr location(getObjectArrayElement(sourceLoc, i)); + if (location == LocalRef::cms_nullPtr || !convert(*location, target.at(i))) + return false; } return true; } - else if (JavaLibrary::getObject(source, object)) + + const bool convert(const Vector & sourceLoc, const std::string & sourceSceneId, const NetworkId & sourceCell, LocalRefPtr & target) { - target = object->getPosition_w(); - return true; - } - return false; -} - -const bool convertWorld(const jlong & source, Vector &target) -{ - JNIEnv * env = JavaLibrary::getEnv(); - if (!env) - return false; - - if (source == 0) - return false; - - ServerObject * object = 0; - - if (JavaLibrary::getObject(source, object)) - { - target = object->getPosition_w(); - return true; - } - return false; -} - -const bool convertWorld(const LocalRefParam & source, Vector &target) -{ - return convertWorld(source.getValue(), target); -} - -const bool convert(const Vector & source, const NetworkId & sourceCell, LocalRefPtr & target) -{ - return convert(source, ServerWorld::getSceneId(), sourceCell, target); -} - -const bool convert(const jobject & source, Vector & targetLoc, std::string & targetSceneId, NetworkId & targetCell) -{ - JNIEnv * env = JavaLibrary::getEnv(); - if (!env) + JNIEnv * env = JavaLibrary::getEnv(); + if (!env) return false; - if (!source) - return false; + target = allocObject(JavaLibrary::ms_clsLocation); + if (target == LocalRef::cms_nullPtr) + return false; - Object * object = 0; + // set xyz + setFloatField(*target, JavaLibrary::ms_fidLocationX, sourceLoc.x); + setFloatField(*target, JavaLibrary::ms_fidLocationY, sourceLoc.y); + setFloatField(*target, JavaLibrary::ms_fidLocationZ, sourceLoc.z); + // set scene id + JavaString area(sourceSceneId.c_str()); //ServerWorld::getSceneId().c_str()); + setObjectField(*target, JavaLibrary::ms_fidLocationArea, area); + // set cell + LocalRefPtr cell = JavaLibrary::getObjId(sourceCell); + setObjectField(*target, JavaLibrary::ms_fidLocationCell, *cell); + return true; + } - if (env->IsInstanceOf(source, JavaLibrary::ms_clsLocation)) + const bool convertWorld(const jobjectArray & source, std::vector &target) { - // get the xyz coords - targetLoc.x = env->GetFloatField(source, JavaLibrary::ms_fidLocationX); - targetLoc.y = env->GetFloatField(source, JavaLibrary::ms_fidLocationY); - targetLoc.z = env->GetFloatField(source, JavaLibrary::ms_fidLocationZ); + JNIEnv * env = JavaLibrary::getEnv(); + if (!env) + return false; - // get the scene - //@todo EAS what's the right answer here? - JavaStringPtr sceneId = getStringField(LocalRefParam(source), JavaLibrary::ms_fidLocationArea); - if (sceneId == JavaString::cms_nullPtr) + if (!source || !env->IsInstanceOf(source, JavaLibrary::ms_clsLocationArray)) return false; + + jsize count = env->GetArrayLength(source); + jsize i; + Vector v; + NetworkId cell; + bool result = true; + for (i = 0; i < count; ++i) { - targetSceneId.clear(); - return false; + LocalRefPtr element = getObjectArrayElement(LocalObjectArrayRefParam(source), i); + if (convertWorld(*element, v)) + { + target.push_back(v); + } + else + { + result = false; + } } - JavaLibrary::convert(*sceneId, targetSceneId); - // get the cell - LocalRefPtr cell = getObjectField(LocalRefParam(source), JavaLibrary::ms_fidLocationCell); - targetCell = JavaLibrary::getNetworkId(*cell); - return true; + return result && !target.empty(); } - else if (JavaLibrary::getObject(source, object)) + + const bool convert(const std::vector & source, LocalObjectArrayRefPtr & target) { - targetLoc = object->getPosition_p(); - targetSceneId = ServerWorld::getSceneId(); - const Object * cell = ContainerInterface::getContainedByObject(*object); - targetCell = (cell) ? cell->getNetworkId() : NetworkId::cms_invalid; - return true; - } - return false; -} - -const bool convertWorld(const jobject & source, Vector & targetLoc, std::string & targetSceneId) -{ - JNIEnv * env = JavaLibrary::getEnv(); - if (!env) + JNIEnv * env = JavaLibrary::getEnv(); + if (!env) return false; - if (!source) - return false; - - Object * object = 0; - - if (env->IsInstanceOf(source, JavaLibrary::ms_clsLocation)) - { - // get the xyz coords - targetLoc.x = env->GetFloatField(source, JavaLibrary::ms_fidLocationX); - targetLoc.y = env->GetFloatField(source, JavaLibrary::ms_fidLocationY); - targetLoc.z = env->GetFloatField(source, JavaLibrary::ms_fidLocationZ); - - // get the scene - //@todo EAS what's the right answer here? - JavaStringPtr sceneId = getStringField(LocalRefParam(source), JavaLibrary::ms_fidLocationArea); - if (sceneId == JavaString::cms_nullPtr) - { - targetSceneId.clear(); + if (source.empty()) return false; - } - JavaLibrary::convert(*sceneId, targetSceneId); - // get the cell - LocalRefPtr cell = getObjectField(LocalRefParam(source), JavaLibrary::ms_fidLocationCell); - Object * cellObject = 0; - if (JavaLibrary::getObject(*cell, cellObject)) + int count = source.size(); + int i; + + target = createNewObjectArray(source.size(), JavaLibrary::ms_clsLocation); + if (target == LocalObjectArrayRef::cms_nullPtr) + return false; + + NetworkId cell(NetworkId::cms_invalid); + bool result = true; + for (i = 0; i < count; ++i) { - targetLoc = cellObject->rotateTranslate_o2w(targetLoc); + LocalRefPtr element; + if (convert(*source[i], cell, element)) + { + setObjectArrayElement(*target, i, *element); + } + else + { + result = false; + } } + + return result; + } + + const bool convert(const LocalRefParam & source, const Region * & target) + { + return convert(source.getValue(), target); + } + + /** This method converts a java script.region class into a C++ Region class + */ + const bool convert(const jobject & source, const Region * &target) + { + JNIEnv * env = JavaLibrary::getEnv(); + if (env == nullptr || source == nullptr) + return false; + if (!env->IsInstanceOf(source, JavaLibrary::ms_clsRegion)) + return false; + + std::string planetName; + JavaStringPtr jplanetName = getStringField(LocalRefParam(source), JavaLibrary::ms_fidRegionPlanet); + if (!JavaLibrary::convert(*jplanetName, planetName)) + return false; + + Unicode::String regionName; + JavaStringPtr jregionName = getStringField(LocalRefParam(source), JavaLibrary::ms_fidRegionName); + if (!JavaLibrary::convert(*jregionName, regionName)) + return false; + + target = RegionMaster::getRegionByName(planetName, regionName); + return target != 0; + } + + /** This method converts a C++ RegionObject class into a Java script.region class + */ + const bool convert(const Region & source, LocalRefPtr & target) + { + JNIEnv * env = JavaLibrary::getEnv(); + if (!env) + return false; + + int pvp = source.getPvp(); + int mun = source.getMunicipal(); + int build = source.getBuildable(); + int geo = source.getGeography(); + int minDiff = source.getMinDifficulty(); + int maxDiff = source.getMaxDifficulty(); + int spawn = source.getSpawn(); + int mission = source.getMission(); + + const Unicode::String name(source.getName()); + JavaString jname(name); + + const std::string planetName(source.getPlanet()); + JavaString jplanetName(planetName); + + target = createNewObject(JavaLibrary::ms_clsRegion, JavaLibrary::ms_midRegion, + jname.getValue(), pvp, build, mun, geo, minDiff, maxDiff, spawn, mission, jplanetName.getValue()); + return (target != LocalRef::cms_nullPtr); + } + + // ---------------------------------------------------------------------- + + const bool convert(Transform const &sourceTransform, LocalRefPtr &target) + { + JNIEnv * const env = JavaLibrary::getEnv(); + if (!env) + return false; + + Vector const i(sourceTransform.getLocalFrameI_p()); + Vector const j(sourceTransform.getLocalFrameJ_p()); + Vector const k(sourceTransform.getLocalFrameK_p()); + Vector const p(sourceTransform.getPosition_p()); + target = createNewObject(JavaLibrary::ms_clsTransform, JavaLibrary::ms_midTransform, + i.x, j.x, k.x, p.x, + i.y, j.y, k.y, p.y, + i.z, j.z, k.z, p.z); + return (target != LocalRef::cms_nullPtr); + } + + // ---------------------------------------------------------------------- + + const bool convert(const jobject &sourceTransform, Transform &target) + { + JNIEnv * const env = JavaLibrary::getEnv(); + if (!env || !sourceTransform) + return false; + if (!env->IsInstanceOf(sourceTransform, JavaLibrary::ms_clsTransform)) + return false; + + LocalObjectArrayRefPtr matrix = getArrayObjectField(LocalRefParam(sourceTransform), JavaLibrary::ms_fidTransformMatrix); + LocalFloatArrayRefPtr row0 = getFloatArrayArrayElement(*matrix, 0); + LocalFloatArrayRefPtr row1 = getFloatArrayArrayElement(*matrix, 1); + LocalFloatArrayRefPtr row2 = getFloatArrayArrayElement(*matrix, 2); + + float * const row0Elements = env->GetFloatArrayElements(row0->getValue(), 0); + float * const row1Elements = env->GetFloatArrayElements(row1->getValue(), 0); + float * const row2Elements = env->GetFloatArrayElements(row2->getValue(), 0); + + target.setLocalFrameIJK_p( + Vector(row0Elements[0], row1Elements[0], row2Elements[0]), + Vector(row0Elements[1], row1Elements[1], row2Elements[1]), + Vector(row0Elements[2], row1Elements[2], row2Elements[2])); + target.setPosition_p(row0Elements[3], row1Elements[3], row2Elements[3]); + + env->ReleaseFloatArrayElements(row2->getValue(), row2Elements, JNI_ABORT); + env->ReleaseFloatArrayElements(row1->getValue(), row1Elements, JNI_ABORT); + env->ReleaseFloatArrayElements(row0->getValue(), row0Elements, JNI_ABORT); + return true; } - else if (JavaLibrary::getObject(source, object)) + + // ---------------------------------------------------------------------- + + const bool convert(const LocalRefParam &sourceTransform, Transform &target) { - targetLoc = object->getPosition_w(); - targetSceneId = ServerWorld::getSceneId(); - return true; + return convert(sourceTransform.getValue(), target); } - return false; -} -const bool convert(const Location & sourceLoc, LocalRefPtr & target) -{ - JNIEnv * env = JavaLibrary::getEnv(); - if (!env) - return false; + // ---------------------------------------------------------------------- - target = allocObject(JavaLibrary::ms_clsLocation); - if (target == LocalRef::cms_nullPtr) - return false; - - // set xyz - setFloatField(*target, JavaLibrary::ms_fidLocationX, sourceLoc.getCoordinates().x); - setFloatField(*target, JavaLibrary::ms_fidLocationY, sourceLoc.getCoordinates().y); - setFloatField(*target, JavaLibrary::ms_fidLocationZ, sourceLoc.getCoordinates().z); - // set scene id - JavaString area(sourceLoc.getSceneId()); //ServerWorld::getSceneId().c_str()); - setObjectField(*target, JavaLibrary::ms_fidLocationArea, area); - // set cell - LocalRefPtr cell = JavaLibrary::getObjId(sourceLoc.getCell()); - setObjectField(*target, JavaLibrary::ms_fidLocationCell, *cell); - return true; -} - -const bool convert(const LocalRefParam & sourceLoc, Location & target) -{ - JNIEnv * env = JavaLibrary::getEnv(); - if (!env) - return false; - - if (sourceLoc.getValue() == 0) - return false; - - float x = getFloatField(sourceLoc, JavaLibrary::ms_fidLocationX); - float y = getFloatField(sourceLoc, JavaLibrary::ms_fidLocationY); - float z = getFloatField(sourceLoc, JavaLibrary::ms_fidLocationZ); - - std::string planetName; - JavaStringPtr jplanetName = getStringField(sourceLoc, JavaLibrary::ms_fidLocationArea); - if (!JavaLibrary::convert(*jplanetName, planetName)) - return false; - - LocalRefPtr cell = getObjectField(sourceLoc, JavaLibrary::ms_fidLocationCell); - NetworkId targetCell = JavaLibrary::getNetworkId(*cell); - - target.setCoordinates(Vector(x, y, z)); - target.setSceneId(planetName.c_str()); - target.setCell(targetCell); - return true; -} - -const bool convert(const LocalObjectArrayRefParam & sourceLoc, std::vector & target) -{ - JNIEnv * env = JavaLibrary::getEnv(); - if (!env) - return false; - - if (sourceLoc.getValue() == 0) - return false; - - jsize count = getArrayLength(sourceLoc); - target.resize(count); - for (int i = 0; i < count; ++i) + const bool convert(const jobjectArray & source, std::vector &target) { - LocalRefPtr location(getObjectArrayElement(sourceLoc, i)); - if (location == LocalRef::cms_nullPtr || !convert(*location, target.at(i))) + JNIEnv * const env = JavaLibrary::getEnv(); + if (!env) return false; - } - return true; -} -const bool convert(const Vector & sourceLoc, const std::string & sourceSceneId, const NetworkId & sourceCell, LocalRefPtr & target) -{ - JNIEnv * env = JavaLibrary::getEnv(); - if (!env) - return false; + if (!source || !env->IsInstanceOf(source, JavaLibrary::ms_clsTransformArray)) return false; - target = allocObject(JavaLibrary::ms_clsLocation); - if (target == LocalRef::cms_nullPtr) - return false; - - // set xyz - setFloatField(*target, JavaLibrary::ms_fidLocationX, sourceLoc.x); - setFloatField(*target, JavaLibrary::ms_fidLocationY, sourceLoc.y); - setFloatField(*target, JavaLibrary::ms_fidLocationZ, sourceLoc.z); - // set scene id - JavaString area(sourceSceneId.c_str()); //ServerWorld::getSceneId().c_str()); - setObjectField(*target, JavaLibrary::ms_fidLocationArea, area); - // set cell - LocalRefPtr cell = JavaLibrary::getObjId(sourceCell); - setObjectField(*target, JavaLibrary::ms_fidLocationCell, *cell); - return true; -} - -const bool convertWorld(const jobjectArray & source, std::vector &target) -{ - JNIEnv * env = JavaLibrary::getEnv(); - if (!env) - return false; - - if (!source || !env->IsInstanceOf(source, JavaLibrary::ms_clsLocationArray)) return false; - - jsize count = env->GetArrayLength(source); - jsize i; - Vector v; - NetworkId cell; - bool result = true; - for (i=0; iGetArrayLength(source); + bool result = true; + for (jsize i = 0; i < count; ++i) { - target.push_back(v); + LocalRefPtr element = getObjectArrayElement(LocalObjectArrayRefParam(source), i); + + Transform t; + if (convert(*element, t)) + { + target.push_back(t); + } + else + { + result = false; + } } - else + + return result && !target.empty(); + } + + // ---------------------------------------------------------------------- + + const bool convert(const std::vector &source, LocalObjectArrayRefPtr & target) + { + JNIEnv * const env = JavaLibrary::getEnv(); + if (!env) + return false; + + int const count = source.size(); + + bool result = true; + + target = createNewObjectArray(count, JavaLibrary::ms_clsObjId); + + for (int i = 0; i < count; ++i) { + LocalRefPtr temp; + if (convert(source[i], temp)) + { + setObjectArrayElement(*target, i, *temp); + } + else + { + result = false; + target = LocalObjectArrayRef::cms_nullPtr; + break; + } + } + + if (env->ExceptionCheck()) + { + env->ExceptionDescribe(); result = false; } + + return result; } - return result && !target.empty(); -} + // ---------------------------------------------------------------------- -const bool convert(const std::vector & source, LocalObjectArrayRefPtr & target) -{ - JNIEnv * env = JavaLibrary::getEnv(); - if (!env) - return false; - - if (source.empty()) - return false; - - int count = source.size(); - int i; - - target = createNewObjectArray(source.size(), JavaLibrary::ms_clsLocation); - if (target == LocalObjectArrayRef::cms_nullPtr) - return false; - - NetworkId cell(NetworkId::cms_invalid); - bool result = true; - for (i=0; i < count; ++i) + const bool convert(const Vector &sourceVector, LocalRefPtr &target) { - LocalRefPtr element; - if (convert(*source[i], cell, element)) - { - setObjectArrayElement(*target, i, *element); - } - else - { - result = false; - } + JNIEnv *env = JavaLibrary::getEnv(); + if (!env) + return false; + + target = allocObject(JavaLibrary::ms_clsVector); + if (target == LocalRef::cms_nullPtr) + return false; + + setFloatField(*target, JavaLibrary::ms_fidVectorX, sourceVector.x); + setFloatField(*target, JavaLibrary::ms_fidVectorY, sourceVector.y); + setFloatField(*target, JavaLibrary::ms_fidVectorZ, sourceVector.z); + return true; } - return result; -} + // ---------------------------------------------------------------------- -const bool convert(const LocalRefParam & source, const Region * & target) -{ - return convert(source.getValue(), target); -} - -/** This method converts a java script.region class into a C++ Region class - */ -const bool convert(const jobject & source, const Region * &target) -{ - JNIEnv * env = JavaLibrary::getEnv(); - if (env == nullptr || source == nullptr) - return false; - if (!env->IsInstanceOf(source, JavaLibrary::ms_clsRegion)) - return false; - - std::string planetName; - JavaStringPtr jplanetName = getStringField(LocalRefParam(source), JavaLibrary::ms_fidRegionPlanet); - if (!JavaLibrary::convert(*jplanetName, planetName)) - return false; - - Unicode::String regionName; - JavaStringPtr jregionName = getStringField(LocalRefParam(source), JavaLibrary::ms_fidRegionName); - if (!JavaLibrary::convert(*jregionName, regionName)) - return false; - - target = RegionMaster::getRegionByName(planetName, regionName); - return target != 0; -} - -/** This method converts a C++ RegionObject class into a Java script.region class - */ -const bool convert(const Region & source, LocalRefPtr & target) -{ - JNIEnv * env = JavaLibrary::getEnv(); - if (!env) - return false; - - int pvp = source.getPvp(); - int mun = source.getMunicipal(); - int build = source.getBuildable(); - int geo = source.getGeography(); - int minDiff = source.getMinDifficulty(); - int maxDiff = source.getMaxDifficulty(); - int spawn = source.getSpawn(); - int mission = source.getMission(); - - const Unicode::String name(source.getName()); - JavaString jname(name); - - const std::string planetName(source.getPlanet()); - JavaString jplanetName(planetName); - - target = createNewObject(JavaLibrary::ms_clsRegion, JavaLibrary::ms_midRegion, - jname.getValue(), pvp, build, mun, geo, minDiff, maxDiff, spawn, mission, jplanetName.getValue()); - return (target != LocalRef::cms_nullPtr); -} - -// ---------------------------------------------------------------------- - -const bool convert(Transform const &sourceTransform, LocalRefPtr &target) -{ - JNIEnv * const env = JavaLibrary::getEnv(); - if (!env) - return false; - - Vector const i(sourceTransform.getLocalFrameI_p()); - Vector const j(sourceTransform.getLocalFrameJ_p()); - Vector const k(sourceTransform.getLocalFrameK_p()); - Vector const p(sourceTransform.getPosition_p()); - target = createNewObject(JavaLibrary::ms_clsTransform, JavaLibrary::ms_midTransform, - i.x, j.x, k.x, p.x, - i.y, j.y, k.y, p.y, - i.z, j.z, k.z, p.z); - return (target != LocalRef::cms_nullPtr); -} - -// ---------------------------------------------------------------------- - -const bool convert(const jobject &sourceTransform, Transform &target) -{ - JNIEnv * const env = JavaLibrary::getEnv(); - if (!env || !sourceTransform) - return false; - if (!env->IsInstanceOf(sourceTransform, JavaLibrary::ms_clsTransform)) - return false; - - LocalObjectArrayRefPtr matrix = getArrayObjectField(LocalRefParam(sourceTransform), JavaLibrary::ms_fidTransformMatrix); - LocalFloatArrayRefPtr row0 = getFloatArrayArrayElement(*matrix, 0); - LocalFloatArrayRefPtr row1 = getFloatArrayArrayElement(*matrix, 1); - LocalFloatArrayRefPtr row2 = getFloatArrayArrayElement(*matrix, 2); - - float * const row0Elements = env->GetFloatArrayElements(row0->getValue(), 0); - float * const row1Elements = env->GetFloatArrayElements(row1->getValue(), 0); - float * const row2Elements = env->GetFloatArrayElements(row2->getValue(), 0); - - target.setLocalFrameIJK_p( - Vector(row0Elements[0], row1Elements[0], row2Elements[0]), - Vector(row0Elements[1], row1Elements[1], row2Elements[1]), - Vector(row0Elements[2], row1Elements[2], row2Elements[2])); - target.setPosition_p(row0Elements[3], row1Elements[3], row2Elements[3]); - - env->ReleaseFloatArrayElements(row2->getValue(), row2Elements, JNI_ABORT); - env->ReleaseFloatArrayElements(row1->getValue(), row1Elements, JNI_ABORT); - env->ReleaseFloatArrayElements(row0->getValue(), row0Elements, JNI_ABORT); - - return true; -} - -// ---------------------------------------------------------------------- - -const bool convert(const LocalRefParam &sourceTransform, Transform &target) -{ - return convert(sourceTransform.getValue(), target); -} - -// ---------------------------------------------------------------------- - -const bool convert(const jobjectArray & source, std::vector &target) -{ - JNIEnv * const env = JavaLibrary::getEnv(); - if (!env) - return false; - - if (!source || !env->IsInstanceOf(source, JavaLibrary::ms_clsTransformArray)) return false; - - jsize const count = env->GetArrayLength(source); - bool result = true; - for (jsize i = 0; i < count; ++i) + const bool convert(const jobject & sourceVector, Vector & target) { - LocalRefPtr element = getObjectArrayElement(LocalObjectArrayRefParam(source), i); + JNIEnv *env = JavaLibrary::getEnv(); + if (!env || !sourceVector) + return false; + if (!env->IsInstanceOf(sourceVector, JavaLibrary::ms_clsVector)) + return false; - Transform t; - if (convert(*element, t)) - { - target.push_back(t); - } - else + target.x = env->GetFloatField(sourceVector, JavaLibrary::ms_fidVectorX); + target.y = env->GetFloatField(sourceVector, JavaLibrary::ms_fidVectorY); + target.z = env->GetFloatField(sourceVector, JavaLibrary::ms_fidVectorZ); + return true; + } + + // ---------------------------------------------------------------------- + + const bool convert(const LocalRefParam & sourceVector, Vector & target) { - result = false; - } + return convert(sourceVector.getValue(), target); } - return result && !target.empty(); - } + // ---------------------------------------------------------------------- -// ---------------------------------------------------------------------- - -const bool convert(const std::vector &source, LocalObjectArrayRefPtr & target) -{ - JNIEnv * const env = JavaLibrary::getEnv(); - if (!env) - return false; - - int const count = source.size(); - - bool result = true; - - target = createNewObjectArray(count, JavaLibrary::ms_clsObjId); - - for (int i = 0; i < count; ++i) + /** + * Convert a C++ AttribMod to a Java attrib_mod. + */ + const bool convert(const AttribMod::AttribMod & source, LocalRefPtr & target) { - LocalRefPtr temp; - if (convert(source[i],temp)) - { - setObjectArrayElement(*target, i, *temp); - } - else - { - result = false; - target = LocalObjectArrayRef::cms_nullPtr; - break; - } - } - - if (env->ExceptionCheck()) - { - env->ExceptionDescribe(); - result = false; - } + JNIEnv * env = JavaLibrary::getEnv(); + if (env == nullptr) + return false; - return result; -} + target = allocObject(JavaLibrary::ms_clsAttribMod); + if (target == LocalRef::cms_nullPtr) + return false; - - -// ---------------------------------------------------------------------- - -const bool convert(const Vector &sourceVector, LocalRefPtr &target) -{ - JNIEnv *env = JavaLibrary::getEnv(); - if (!env) - return false; - - target = allocObject(JavaLibrary::ms_clsVector); - if (target == LocalRef::cms_nullPtr) - return false; - - setFloatField(*target, JavaLibrary::ms_fidVectorX, sourceVector.x); - setFloatField(*target, JavaLibrary::ms_fidVectorY, sourceVector.y); - setFloatField(*target, JavaLibrary::ms_fidVectorZ, sourceVector.z); - return true; -} - -// ---------------------------------------------------------------------- - -const bool convert(const jobject & sourceVector, Vector & target) -{ - JNIEnv *env = JavaLibrary::getEnv(); - if (!env || !sourceVector) - return false; - if (!env->IsInstanceOf(sourceVector, JavaLibrary::ms_clsVector)) - return false; - - target.x = env->GetFloatField(sourceVector, JavaLibrary::ms_fidVectorX); - target.y = env->GetFloatField(sourceVector, JavaLibrary::ms_fidVectorY); - target.z = env->GetFloatField(sourceVector, JavaLibrary::ms_fidVectorZ); - return true; -} - -// ---------------------------------------------------------------------- - -const bool convert(const LocalRefParam & sourceVector, Vector & target) -{ - return convert(sourceVector.getValue(), target); -} - -// ---------------------------------------------------------------------- - -/** - * Convert a C++ AttribMod to a Java attrib_mod. - */ -const bool convert(const AttribMod::AttribMod & source, LocalRefPtr & target) -{ - JNIEnv * env = JavaLibrary::getEnv(); - if (env == nullptr) - return false; - - target = allocObject(JavaLibrary::ms_clsAttribMod); - if (target == LocalRef::cms_nullPtr) - return false; - - JavaString name(AttribModNameManager::getInstance( + JavaString name(AttribModNameManager::getInstance( ).getAttribModName(source.tag)); - setObjectField(*target, JavaLibrary::ms_fidAttribModName, name); - if (!AttribMod::isSkillMod(source)) - { - setIntField(*target, JavaLibrary::ms_fidAttribModType, source.attrib); - } - else - { - JavaString skill(AttribModNameManager::getInstance( + setObjectField(*target, JavaLibrary::ms_fidAttribModName, name); + if (!AttribMod::isSkillMod(source)) + { + setIntField(*target, JavaLibrary::ms_fidAttribModType, source.attrib); + } + else + { + JavaString skill(AttribModNameManager::getInstance( ).getAttribModName(source.skill)); - setObjectField(*target, JavaLibrary::ms_fidAttribModSkill, skill); - } - setIntField(*target, JavaLibrary::ms_fidAttribModValue, source.value); - setFloatField(*target, JavaLibrary::ms_fidAttribModTime, source.sustain); - setFloatField(*target, JavaLibrary::ms_fidAttribModAttack, source.attack); - setFloatField(*target, JavaLibrary::ms_fidAttribModDecay, source.decay); - setIntField(*target, JavaLibrary::ms_fidAttribModFlags, source.flags); - return true; -} - -/** - * Convert a Java attrib_mod to a C++ AttribMod. - */ -const bool convert(const jobject & source, AttribMod::AttribMod & target) -{ - JNIEnv * env = JavaLibrary::getEnv(); - if (env == nullptr) - return false; - - if (source == 0 || env->IsInstanceOf(source, JavaLibrary::ms_clsAttribMod) == JNI_FALSE) - return false; - - std::string modName; - JavaStringPtr name = getStringField(LocalRefParam(source), JavaLibrary::ms_fidAttribModName); - if (name != JavaString::cms_nullPtr) - { - if (!JavaLibrary::convert(*name, modName)) - return false; - - target.tag = Crc::calculate(modName.c_str()); - AttribModNameManager::getInstance().addAttribModName(modName.c_str()); - } - else - target.tag = 0; - - target.flags = env->GetIntField(source, JavaLibrary::ms_fidAttribModFlags); - if (!AttribMod::isSkillMod(target)) - { - target.attrib = env->GetIntField(source, JavaLibrary::ms_fidAttribModType); - } - else - { - std::string skillModName; - JavaStringPtr skillName = getStringField(LocalRefParam(source), JavaLibrary::ms_fidAttribModSkill); - - // a skillmod mod must have a skillmod name - if (skillName == JavaString::cms_nullPtr) - return false; - if (!JavaLibrary::convert(*skillName, skillModName)) - return false; - - target.skill = Crc::calculate(skillModName.c_str()); - AttribModNameManager::getInstance().addAttribModName(skillModName.c_str()); - } - target.value = env->GetIntField(source, JavaLibrary::ms_fidAttribModValue); - target.sustain = env->GetFloatField(source, JavaLibrary::ms_fidAttribModTime); - target.attack = env->GetFloatField(source, JavaLibrary::ms_fidAttribModAttack); - target.decay = env->GetFloatField(source, JavaLibrary::ms_fidAttribModDecay); - return true; -} - -/** - * Convert a Java attrib_mod to a C++ AttribMod. - */ -const bool convert(const LocalRefParam & source, AttribMod::AttribMod & target) -{ - return convert(source.getValue(), target); -} - -/** - * Convert a C++ AttribMod vector to a Java attrib_mod[]. - */ -const bool convert(const std::vector & source, LocalObjectArrayRefPtr & target) -{ - JNIEnv * env = JavaLibrary::getEnv(); - if (env == nullptr) - return false; - - int count = source.size(); - target = createNewObjectArray(count, JavaLibrary::ms_clsAttribMod); - if (target == LocalObjectArrayRef::cms_nullPtr) - return false; - - LocalRefPtr mod; - for (int i = 0; i < count; ++i) - { - if (!convert(source[i], mod)) - { - target = LocalObjectArrayRef::cms_nullPtr; - return false; + setObjectField(*target, JavaLibrary::ms_fidAttribModSkill, skill); } - setObjectArrayElement(*target, i, *mod); + setIntField(*target, JavaLibrary::ms_fidAttribModValue, source.value); + setFloatField(*target, JavaLibrary::ms_fidAttribModTime, source.sustain); + setFloatField(*target, JavaLibrary::ms_fidAttribModAttack, source.attack); + setFloatField(*target, JavaLibrary::ms_fidAttribModDecay, source.decay); + setIntField(*target, JavaLibrary::ms_fidAttribModFlags, source.flags); + return true; } - return true; -} -/** - * Convert a Java attrib_mod[] to a C++ AttribMod vector. - */ -const bool convert(const jobjectArray & source, std::vector & target) -{ - JNIEnv * env = JavaLibrary::getEnv(); - if (env == nullptr) - return false; - - if (source == 0) - return false; - - AttribMod::AttribMod mod; - int count = env->GetArrayLength(source); - for (int i = 0; i < count; ++i) + /** + * Convert a Java attrib_mod to a C++ AttribMod. + */ + const bool convert(const jobject & source, AttribMod::AttribMod & target) { - LocalRefPtr element = getObjectArrayElement(LocalObjectArrayRefParam(source), i); - bool result = convert(*element, mod); - if (!result) - { - target.clear(); + JNIEnv * env = JavaLibrary::getEnv(); + if (env == nullptr) return false; + + if (source == 0 || env->IsInstanceOf(source, JavaLibrary::ms_clsAttribMod) == JNI_FALSE) + return false; + + std::string modName; + JavaStringPtr name = getStringField(LocalRefParam(source), JavaLibrary::ms_fidAttribModName); + if (name != JavaString::cms_nullPtr) + { + if (!JavaLibrary::convert(*name, modName)) + return false; + + target.tag = Crc::calculate(modName.c_str()); + AttribModNameManager::getInstance().addAttribModName(modName.c_str()); } - target.push_back(mod); + else + target.tag = 0; + + target.flags = env->GetIntField(source, JavaLibrary::ms_fidAttribModFlags); + if (!AttribMod::isSkillMod(target)) + { + target.attrib = env->GetIntField(source, JavaLibrary::ms_fidAttribModType); + } + else + { + std::string skillModName; + JavaStringPtr skillName = getStringField(LocalRefParam(source), JavaLibrary::ms_fidAttribModSkill); + + // a skillmod mod must have a skillmod name + if (skillName == JavaString::cms_nullPtr) + return false; + if (!JavaLibrary::convert(*skillName, skillModName)) + return false; + + target.skill = Crc::calculate(skillModName.c_str()); + AttribModNameManager::getInstance().addAttribModName(skillModName.c_str()); + } + target.value = env->GetIntField(source, JavaLibrary::ms_fidAttribModValue); + target.sustain = env->GetFloatField(source, JavaLibrary::ms_fidAttribModTime); + target.attack = env->GetFloatField(source, JavaLibrary::ms_fidAttribModAttack); + target.decay = env->GetFloatField(source, JavaLibrary::ms_fidAttribModDecay); + return true; } - return true; -} -const bool convert(const jbyteArray & source, std::vector & target) -{ - JNIEnv * env = JavaLibrary::getEnv(); - if (env == nullptr) - return false; + /** + * Convert a Java attrib_mod to a C++ AttribMod. + */ + const bool convert(const LocalRefParam & source, AttribMod::AttribMod & target) + { + return convert(source.getValue(), target); + } - if (source == 0) - return false; + /** + * Convert a C++ AttribMod vector to a Java attrib_mod[]. + */ + const bool convert(const std::vector & source, LocalObjectArrayRefPtr & target) + { + JNIEnv * env = JavaLibrary::getEnv(); + if (env == nullptr) + return false; - int size = env->GetArrayLength(source); - target.reserve(size); - target.resize(size); - env->GetByteArrayRegion(source, 0, size, &target[0]); - return true; -} + int count = source.size(); + target = createNewObjectArray(count, JavaLibrary::ms_clsAttribMod); + if (target == LocalObjectArrayRef::cms_nullPtr) + return false; -const bool convert(const LocalByteArrayRef & source, std::vector & target) -{ - JNIEnv * env = JavaLibrary::getEnv(); - if (env == nullptr) - return false; + LocalRefPtr mod; + for (int i = 0; i < count; ++i) + { + if (!convert(source[i], mod)) + { + target = LocalObjectArrayRef::cms_nullPtr; + return false; + } + setObjectArrayElement(*target, i, *mod); + } + return true; + } - if (source.getValue() == 0) - return false; + /** + * Convert a Java attrib_mod[] to a C++ AttribMod vector. + */ + const bool convert(const jobjectArray & source, std::vector & target) + { + JNIEnv * env = JavaLibrary::getEnv(); + if (env == nullptr) + return false; - int size = getArrayLength(source); - target.reserve(size); - target.resize(size); - getByteArrayRegion(source, 0, size, &target[0]); - return true; -} + if (source == 0) + return false; -const bool convert(const std::vector & source, LocalByteArrayRefPtr & target) -{ - JNIEnv * env = JavaLibrary::getEnv(); - if (env == nullptr) - return false; + AttribMod::AttribMod mod; + int count = env->GetArrayLength(source); + for (int i = 0; i < count; ++i) + { + LocalRefPtr element = getObjectArrayElement(LocalObjectArrayRefParam(source), i); + bool result = convert(*element, mod); + if (!result) + { + target.clear(); + return false; + } + target.push_back(mod); + } + return true; + } - int count = source.size(); - target = createNewByteArray(count); - if (target == LocalByteArrayRef::cms_nullPtr) - return false; - - if (count > 0) - setByteArrayRegion(*target, 0, count, const_cast(&source[0])); - return true; -} + const bool convert(const jbyteArray & source, std::vector & target) + { + JNIEnv * env = JavaLibrary::getEnv(); + if (env == nullptr) + return false; + if (source == 0) + return false; + + int size = env->GetArrayLength(source); + target.reserve(size); + target.resize(size); + env->GetByteArrayRegion(source, 0, size, &target[0]); + return true; + } + + const bool convert(const LocalByteArrayRef & source, std::vector & target) + { + JNIEnv * env = JavaLibrary::getEnv(); + if (env == nullptr) + return false; + + if (source.getValue() == 0) + return false; + + int size = getArrayLength(source); + target.reserve(size); + target.resize(size); + getByteArrayRegion(source, 0, size, &target[0]); + return true; + } + + const bool convert(const std::vector & source, LocalByteArrayRefPtr & target) + { + JNIEnv * env = JavaLibrary::getEnv(); + if (env == nullptr) + return false; + + int count = source.size(); + target = createNewByteArray(count); + if (target == LocalByteArrayRef::cms_nullPtr) + return false; + + if (count > 0) + setByteArrayRegion(*target, 0, count, const_cast(&source[0])); + return true; + } }//namespace ScriptConversion //---------------------------------------------------------------------- -ServerObject * JavaLibrary::findObjectByNetworkId (const NetworkId & id) +ServerObject * JavaLibrary::findObjectByNetworkId(const NetworkId & id) { return ServerWorld::findObjectByNetworkId(id); } @@ -6429,9 +6413,9 @@ ServerObject * JavaLibrary::findObjectByNetworkId (const NetworkId & id) CreatureObject *JavaLibrary::getCreatureThrow(JNIEnv *env, jlong objId, char const *errorDescription, bool throwIfNotOnServer) { NOT_NULL(env); - + char buffer[512]; - + if (!objId) { IGNORE_RETURN(snprintf(buffer, sizeof(buffer) - 1, "%s: nullptr object id from script.", errorDescription)); @@ -6468,7 +6452,7 @@ CreatureObject *JavaLibrary::getCreatureThrow(JNIEnv *env, jlong objId, char con } else { - ServerObject *const serverObject = object->asServerObject(); + ServerObject *const serverObject = object->asServerObject(); CreatureObject *const creatureObject = serverObject ? serverObject->asCreatureObject() : nullptr; if (creatureObject) @@ -6490,9 +6474,9 @@ CreatureObject *JavaLibrary::getCreatureThrow(JNIEnv *env, jlong objId, char con ShipObject *JavaLibrary::getShipThrow(JNIEnv *env, jlong objId, char const *errorDescription, bool throwIfNotOnServer) { NOT_NULL(env); - + char buffer[512]; - + if (objId == 0) { IGNORE_RETURN(snprintf(buffer, sizeof(buffer) - 1, "%s: nullptr object id from script.", errorDescription)); @@ -6529,8 +6513,8 @@ ShipObject *JavaLibrary::getShipThrow(JNIEnv *env, jlong objId, char const *erro } else { - ServerObject *const serverObject = object->asServerObject(); - ShipObject *const shipObject = serverObject ? serverObject->asShipObject() : nullptr; + ServerObject *const serverObject = object->asServerObject(); + ShipObject *const shipObject = serverObject ? serverObject->asShipObject() : nullptr; if (shipObject) return shipObject; @@ -6561,4 +6545,4 @@ void JavaLibrary::throwInternalScriptError(const char * message) } } -//----------------------------------------------------------------------- +//----------------------------------------------------------------------- \ No newline at end of file diff --git a/engine/server/library/serverScript/src/shared/JavaLibrary.h b/engine/server/library/serverScript/src/shared/JavaLibrary.h index 6a4a5471..5029f0e3 100755 --- a/engine/server/library/serverScript/src/shared/JavaLibrary.h +++ b/engine/server/library/serverScript/src/shared/JavaLibrary.h @@ -62,7 +62,7 @@ namespace Crafting namespace Archive { -// struct DefaultObjectType; + // struct DefaultObjectType; template class AutoDeltaVector; } @@ -71,12 +71,10 @@ typedef Unicode::String String_t; typedef stdvector ::fwd StringVector_t; typedef stdvector::fwd MenuDataVector; - //======================================================================== // C<->Java conversion functions //======================================================================== - namespace ScriptConversion { const bool convert(const Location & sourceLoc, LocalRefPtr & target); @@ -127,14 +125,13 @@ namespace ScriptConversion const bool convert(const LocalRefParam & sourceVector, Vector & target); } - //======================================================================== // class JavaLibrary //======================================================================== class JavaLibrary { -// friend jobject convertDynamicVariableListToObject(JNIEnv *env, const DynamicVariableList& list); + // friend jobject convertDynamicVariableListToObject(JNIEnv *env, const DynamicVariableList& list); friend const bool ScriptConversion::convert(const Location & sourceLoc, LocalRefPtr & target); friend const bool ScriptConversion::convert(const LocalRefParam & sourceLoc, Location & target); friend const bool ScriptConversion::convert(const LocalObjectArrayRefParam & sourceLoc, stdvector::fwd & target); @@ -239,7 +236,7 @@ public: static jlong getFreeJavaMemory(); static void printJavaStack(); - static ServerObject * findObjectByNetworkId (const NetworkId & id); + static ServerObject * findObjectByNetworkId(const NetworkId & id); static CreatureObject *getCreatureThrow(JNIEnv *env, jlong objId, char const *errorDescription, bool throwIfNotOnServer = true); static ShipObject * getShipThrow(JNIEnv *env, jlong objId, char const *errorDescription, bool throwIfNotOnServer = true); @@ -250,7 +247,7 @@ public: if (obj != 0) { NetworkId id(getNetworkId(obj)); - result = dynamic_cast(findObjectByNetworkId (id)); + result = dynamic_cast(findObjectByNetworkId(id)); return result != 0; } return 0; @@ -262,7 +259,7 @@ public: if (obj != 0) { NetworkId id(static_cast(obj)); - result = dynamic_cast(findObjectByNetworkId (id)); + result = dynamic_cast(findObjectByNetworkId(id)); return result != 0; } return 0; @@ -274,7 +271,7 @@ public: if (obj.getValue() != 0) { NetworkId id(getNetworkId(obj)); - result = dynamic_cast(findObjectByNetworkId (id)); + result = dynamic_cast(findObjectByNetworkId(id)); return result != 0; } return 0; @@ -283,7 +280,7 @@ public: template static bool getObjectController(const jobject obj, OBJPTR &object, CTLPTR &controller) { - if (getObject (obj, object) && object) + if (getObject(obj, object) && object) { controller = dynamic_cast(object->getController()); return controller != 0; @@ -294,7 +291,7 @@ public: template static bool getObjectController(const jlong obj, OBJPTR &object, CTLPTR &controller) { - if (getObject (obj, object) && object) + if (getObject(obj, object) && object) { controller = dynamic_cast(object->getController()); return controller != 0; @@ -341,7 +338,7 @@ public: static void setupWeaponCombatData(JNIEnv *env, const WeaponObject * weapon, jobject weaponData); static LocalRefPtr createObjectAttribute(const ManufactureObjectInterface & manfSchematic, const DraftSchematicObject & draftSchematic, int attribIndex); - static LocalRefPtr createExperimentAttribute(const ManufactureObjectInterface & manfSchematic, const StringId & attribName); + static LocalRefPtr createExperimentAttribute(const ManufactureObjectInterface & manfSchematic, const StringId & attribName); static LocalRefPtr convert(const ManufactureObjectInterface & source); static LocalRefPtr convert(const ManufactureObjectInterface & schematic, const Crafting::IngredientSlot & source, int amountRequired, const std::string & appearance, const std::string & requiredIngredient); static jobject convert(const DraftSchematicObject & source); @@ -355,7 +352,7 @@ public: static jmethodID getMidAttribute(); static jfieldID getFidAttributeType(); static jfieldID getFidAttributeValue(); - + static jclass getClsBaseClassRangeInfo(); static jfieldID getFidBaseClassRangeInfoMinRange(); static jfieldID getFidBaseClassRangeInfoMaxRange(); @@ -375,9 +372,9 @@ public: static jfieldID getFidBaseClassDefenderResultsResult(); static jfieldID getFidBaseClassDefenderResultsClientEffectId(); - static jclass getClsColor(); + static jclass getClsColor(); static jmethodID getMidColor(); - + static jfieldID getFidCombatEngineAttackerDataWeaponSkill(); static jfieldID getFidCombatEngineAttackerDataAims(); static jfieldID getFidCombatEngineCombatantDataPos(); @@ -539,7 +536,7 @@ public: static jclass getClsVector(); static jclass getClsVectorArray(); - + protected: JavaLibrary(void); virtual ~JavaLibrary(); @@ -655,7 +652,6 @@ private: static jclass ms_clsThread; // reference to java.lang.Thread static jmethodID ms_midThreadDumpStack; // reference to java.lang.Thread.dumpStack() - static jclass ms_clsInternalScriptError; // reference to internal_script_exception static jclass ms_clsInternalScriptSeriousError; // reference to internal_script_error static jfieldID ms_fidInternalScriptSeriousErrorError; // fieldID for internal_script_error.wrappedError @@ -908,7 +904,7 @@ private: static jfieldID ms_fidCombatEngineWeaponDataElementalType; static jfieldID ms_fidCombatEngineWeaponDataElementalValue; static jfieldID ms_fidCombatEngineWeaponDataAttackSpeed; - static jfieldID ms_fidCombatEngineWeaponDataWoundChance; + static jfieldID ms_fidCombatEngineWeaponDataWoundChance; static jfieldID ms_fidCombatEngineWeaponDataAccuracy; static jfieldID ms_fidCombatEngineWeaponDataMinRange; static jfieldID ms_fidCombatEngineWeaponDataMaxRange; @@ -967,25 +963,25 @@ private: static jclass ms_clsLibrarySpaceTransition; static jmethodID ms_midLibrarySpaceTransitionSetPlayerOvert; static jmethodID ms_midLibrarySpaceTransitionClearOvertStatus; - -//////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////// - // java classes/methods needed by CS Handlers. These classes may not be CS specific - // if there is no previous call into them specifically. - + + //////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////// + // java classes/methods needed by CS Handlers. These classes may not be CS specific + // if there is no previous call into them specifically. + static jclass ms_clsLibraryDump; static jmethodID ms_midLibraryDumpDumpTargetInfo; - + static jclass ms_clsLibraryGMLib; static jmethodID ms_midLibraryGMLibFreeze; static jmethodID ms_midLibraryGMLibUnfreeze; - -//////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////// - - // flag that the JVM was loaded; once it is, it can never be loaded again - // without restarting the program - static int ms_loaded; + + //////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////// + + // flag that the JVM was loaded; once it is, it can never be loaded again + // without restarting the program + volatile static int ms_loaded; static Semaphore * ms_shutdownJava; // Java initialization functions @@ -1001,7 +997,7 @@ private: static jstring callScriptConsoleHandlerEntry(const JavaStringParam & script, const JavaStringParam & method, jobjectArray params); // obj_id functions - public: +public: static LocalRefPtr getObjId(const ServerObject & object); static LocalRefPtr getObjId(const NetworkId::NetworkIdType & id); static LocalRefPtr getObjId(const NetworkId & id); @@ -1011,20 +1007,20 @@ private: static LocalRefPtr getVector(Vector const & vector); -///////////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////////// static void spaceMakeOvert(const NetworkId &player); static void spaceClearOvert(const NetworkId &ship); - static std::string getObjectDumpInfo( NetworkId id ); + static std::string getObjectDumpInfo(NetworkId id); - static void freezePlayer( const NetworkId &id ); - static void unFreezePlayer( const NetworkId &id ); - -///////////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////////// + static void freezePlayer(const NetworkId &id); + static void unFreezePlayer(const NetworkId &id); - private: + ///////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////////// + +private: // misc support functions static LocalObjectArrayRefPtr convert(const NetworkId & caller, const std::string& argList, const ScriptParams &args); @@ -1260,7 +1256,7 @@ inline jfieldID JavaLibrary::getFidBaseClassDefenderResultsId() { return ms_fidBaseClassDefenderResultsId; } - + inline jfieldID JavaLibrary::getFidBaseClassDefenderResultsPosture() { return ms_fidBaseClassDefenderResultsPosture; @@ -1330,7 +1326,7 @@ inline jfieldID JavaLibrary::getFidCombatEngineCombatantDataScriptMod() { return ms_fidCombatEngineCombatantDataScriptMod; } - + inline jfieldID JavaLibrary::getFidCombatEngineDefenderDataCombatSkeleton() { return ms_fidCombatEngineDefenderDataCombatSkeleton; @@ -1620,7 +1616,7 @@ inline jmethodID JavaLibrary::getMidDynamicVariableListSetFloatArray() { return ms_midDynamicVariableListSetFloatArray; } - + inline jmethodID JavaLibrary::getMidDynamicVariableListSetInt() { return ms_midDynamicVariableListSetInt; @@ -1685,7 +1681,7 @@ inline jmethodID JavaLibrary::getMidDynamicVariableListSetVector() { return ms_midDynamicVariableListSetVector; } - + inline jmethodID JavaLibrary::getMidDynamicVariableListSetVectorArray() { return ms_midDynamicVariableListSetVectorArray; @@ -1880,7 +1876,7 @@ inline jclass JavaLibrary::getClsRegion() { return ms_clsRegion; } - + inline jclass JavaLibrary::getClsResourceAttribute() { return ms_clsResourceAttribute; From 8b9665a0f89c56760673b5ce290b334c600e9496 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sun, 24 Jul 2016 21:48:49 -0700 Subject: [PATCH 160/302] this is where i stop for the evening --- .../src/shared/core/CollisionWorld.cpp | 877 +++++---- .../src/shared/core/FloorMesh.cpp | 1569 ++++++++--------- .../SharedBattlefieldMarkerObjectTemplate.cpp | 37 +- .../SharedBuildingObjectTemplate.cpp | 29 +- .../SharedCellObjectTemplate.cpp | 24 +- ...aredConstructionContractObjectTemplate.cpp | 24 +- .../SharedCreatureObjectTemplate.cpp | 127 +- .../SharedDraftSchematicObjectTemplate.cpp | 180 +- .../SharedFactoryObjectTemplate.cpp | 24 +- .../SharedGroupObjectTemplate.cpp | 24 +- .../SharedGuildObjectTemplate.cpp | 24 +- .../SharedInstallationObjectTemplate.cpp | 24 +- .../SharedIntangibleObjectTemplate.cpp | 24 +- .../SharedJediManagerObjectTemplate.cpp | 24 +- ...aredManufactureSchematicObjectTemplate.cpp | 24 +- .../SharedMissionObjectTemplate.cpp | 24 +- .../objectTemplate/SharedObjectTemplate.cpp | 162 +- .../SharedPlayerObjectTemplate.cpp | 24 +- .../SharedPlayerQuestObjectTemplate.cpp | 24 +- .../SharedResourceContainerObjectTemplate.cpp | 24 +- .../SharedShipObjectTemplate.cpp | 42 +- .../SharedStaticObjectTemplate.cpp | 24 +- .../SharedTangibleObjectTemplate.cpp | 257 ++- .../SharedTerrainSurfaceObjectTemplate.cpp | 33 +- .../SharedUniverseObjectTemplate.cpp | 24 +- .../SharedVehicleObjectTemplate.cpp | 61 +- .../SharedWaypointObjectTemplate.cpp | 24 +- .../SharedWeaponObjectTemplate.cpp | 35 +- .../library/sharedMath/src/shared/Volume.cpp | 66 +- .../shared/template/ServerArmorTemplate.cpp | 42 +- .../template/ServerCreatureObjectTemplate.cpp | 43 +- .../ServerDraftSchematicObjectTemplate.cpp | 59 +- ...rverManufactureSchematicObjectTemplate.cpp | 47 +- .../shared/template/ServerObjectTemplate.cpp | 97 +- .../template/ServerTangibleObjectTemplate.cpp | 33 +- .../template/ServerUberObjectTemplate.cpp | 191 +- .../SharedDraftSchematicObjectTemplate.cpp | 55 +- .../template/SharedTangibleObjectTemplate.cpp | 95 +- .../src/shared/OptionManager.cpp | 808 +++++---- .../src/shared/tasks/TaskLocateStructure.cpp | 23 +- .../src/shared/tasks/TaskMoveToPlayer.cpp | 143 +- .../src/shared/tasks/TaskRestoreCharacter.cpp | 47 +- .../src/shared/tasks/TaskRestoreHouse.cpp | 49 +- .../src/shared/tasks/TaskUndeleteItem.cpp | 55 +- .../ServerJediManagerObjectTemplate.cpp | 22 +- .../src/shared/CombatEngineData.h | 55 +- 46 files changed, 2654 insertions(+), 3069 deletions(-) diff --git a/engine/shared/library/sharedCollision/src/shared/core/CollisionWorld.cpp b/engine/shared/library/sharedCollision/src/shared/core/CollisionWorld.cpp index 61b199f9..34514617 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/CollisionWorld.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/CollisionWorld.cpp @@ -67,7 +67,7 @@ namespace CollisionWorldNamespace // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - int const cs_nearWarpCollisionSegmentCount = 20; - int const cs_farWarpCollisionSegmentCount = 250; + int const cs_farWarpCollisionSegmentCount = 250; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -81,13 +81,13 @@ namespace CollisionWorldNamespace WarpWarningCallback s_nearWarpWarningCallback; WarpWarningCallback s_farWarpWarningCallback; - char const * ms_sptatialDatabaseNames[] = { + char const * ms_sptatialDatabaseNames[] = { "None", "Static", "Dynamic", "Barriers", "Doors" - }; + }; //---------------------------------------------------------------------- @@ -101,7 +101,7 @@ namespace CollisionWorldNamespace Vector deltaNormal = delta; deltaNormal.normalize(); - for ( ; distanceTraversed < totalDistance; ) + for (; distanceTraversed < totalDistance; ) { float distance = std::min(distanceTraversed + 2.0f, totalDistance); Vector const & endPos = startPos + (deltaNormal * distance); @@ -136,7 +136,6 @@ namespace CollisionWorldNamespace TerrainObject const *const terrainObject = TerrainObject::getConstInstance(); if (nullptr != terrainObject && terrainObject->hasPassableAffectors()) { - // pointA_w is *not* the previous world position, but actually the world // position for the previous position in the cell, in respect to the // current position of the previous cell. This has the effect that a @@ -184,7 +183,6 @@ namespace CollisionWorldNamespace CollisionWorld::NoCollisionDetectionThisFrameFunction ms_noCollisionDetectionThisFrameFunction = 0; CollisionWorld::CollisionDetectionOnHitFunction ms_collisionDetectionOnHitFunction = 0; CollisionWorld::DoCollisionWithTerrainFunction ms_doCollisionWithTerrainFunction = 0; - } using namespace CollisionWorldNamespace; @@ -222,11 +220,11 @@ std::string ms_reportString; // ---------- -void terrainChangedCallback ( Rectangle2d const & rect ) +void terrainChangedCallback(Rectangle2d const & rect) { - AxialBox box( Vector(rect.x0,-2000.0f,rect.y0), Vector(rect.x1,2000.0f,rect.y1) ); + AxialBox box(Vector(rect.x0, -2000.0f, rect.y0), Vector(rect.x1, 2000.0f, rect.y1)); - CollisionWorld::environmentChanged( MultiShape(box) ); + CollisionWorld::environmentChanged(MultiShape(box)); } // ====================================================================== @@ -237,16 +235,16 @@ void CollisionWorldNamespace::defaultNearWarpWarning(Object const &object, Vecto { WARNING(ConfigSharedCollision::getReportWarnings(), ("CollisionWorld::update() had %d segments for object id=[%s], template=[%s], start position=[%.2f,%.2f,%.2f], end position=[%.2f,%.2f,%.2f], object probably should have warped but collision system is not warping it.", - segmentCount, - object.getNetworkId().getValueString().c_str(), - object.getObjectTemplateName(), - oldPosition_w.x, - oldPosition_w.y, - oldPosition_w.z, - newPosition_w.x, - newPosition_w.y, - newPosition_w.z - )); + segmentCount, + object.getNetworkId().getValueString().c_str(), + object.getObjectTemplateName(), + oldPosition_w.x, + oldPosition_w.y, + oldPosition_w.z, + newPosition_w.x, + newPosition_w.y, + newPosition_w.z + )); } // ---------------------------------------------------------------------- @@ -255,16 +253,16 @@ void CollisionWorldNamespace::defaultFarWarpWarning(Object const &object, Vector { WARNING(ConfigSharedCollision::getReportWarnings(), ("CollisionWorld::update() had %d segments for object id=[%s], template=[%s], start position=[%.2f,%.2f,%.2f], end position=[%.2f,%.2f,%.2f], collision system will consider this a warp and adjust accordingly.", - segmentCount, - object.getNetworkId().getValueString().c_str(), - object.getObjectTemplateName(), - oldPosition_w.x, - oldPosition_w.y, - oldPosition_w.z, - newPosition_w.x, - newPosition_w.y, - newPosition_w.z - )); + segmentCount, + object.getNetworkId().getValueString().c_str(), + object.getObjectTemplateName(), + oldPosition_w.x, + oldPosition_w.y, + oldPosition_w.z, + newPosition_w.x, + newPosition_w.y, + newPosition_w.z + )); } // ---------------------------------------------------------------------- @@ -318,10 +316,10 @@ bool CollisionWorldNamespace::testFloorCollision(FloorLocator const &startFloorL // This most likely means that the pathWalkResult that was issued indicates a non-collision and should be caught in the // if statement above. WARNING(true, - ("testFloorCollision(): floor collision occurred while checking for floor collisions for floor of object id [%s] but collision floor location has no associated floor. Calling this a non-collision. PathWalkResult was [%d].", - floor->getOwner() ? floor->getOwner()->getNetworkId().getValueString().c_str() : "", - static_cast(pathWalkResult) - )); + ("testFloorCollision(): floor collision occurred while checking for floor collisions for floor of object id [%s] but collision floor location has no associated floor. Calling this a non-collision. PathWalkResult was [%d].", + floor->getOwner() ? floor->getOwner()->getNetworkId().getValueString().c_str() : "", + static_cast(pathWalkResult) + )); return false; } @@ -336,7 +334,6 @@ bool CollisionWorldNamespace::testFloorCollision(FloorLocator const &startFloorL return true; } - // ---------------------------------------------------------------------- void CollisionWorld::registerCanTestCollisionDetectionOnObjectThisFrame(CanTestCollisionDetectionOnObjectThisFrameFunction function) @@ -414,12 +411,12 @@ bool CollisionWorld::doCollisionWithTerrain(Object * const object) // class CollisionWorld: PUBLIC STATIC // ====================================================================== -void CollisionWorld::install ( bool serverSide ) +void CollisionWorld::install(bool serverSide) { - DEBUG_REPORT_LOG(true,("CollisionWorld::install()\n")); + DEBUG_REPORT_LOG(true, ("CollisionWorld::install()\n")); s_nearWarpWarningCallback = defaultNearWarpWarning; - s_farWarpWarningCallback = defaultFarWarpWarning; + s_farWarpWarningCallback = defaultFarWarpWarning; ConfigSharedCollision::install(); FloorMesh::install(); @@ -428,21 +425,21 @@ void CollisionWorld::install ( bool serverSide ) ms_serverSide = serverSide; - if(!serverSide) + if (!serverSide) { - TerrainObject::addTerrainChangedFunction( terrainChangedCallback ); + TerrainObject::addTerrainChangedFunction(terrainChangedCallback); } ms_database = new SpatialDatabase(); - ExitChain::add(CollisionWorld::remove,"CollisionWorld::remove()"); + ExitChain::add(CollisionWorld::remove, "CollisionWorld::remove()"); } // ---------- -void CollisionWorld::remove ( void ) +void CollisionWorld::remove(void) { - DEBUG_REPORT_LOG(true,("CollisionWorld::remove()\n")); + DEBUG_REPORT_LOG(true, ("CollisionWorld::remove()\n")); CollisionResolve::remove(); FloorMesh::remove(); @@ -456,7 +453,7 @@ void CollisionWorld::remove ( void ) // ---------------------------------------------------------------------- -void CollisionWorld::update ( float time ) +void CollisionWorld::update(float time) { CollisionNotification::purgeQueue(); @@ -492,7 +489,7 @@ void CollisionWorld::update ( float time ) CollisionProperty * cursor = CollisionProperty::getActiveHead(); - while(cursor) + while (cursor) { active.push_back(cursor); @@ -501,12 +498,12 @@ void CollisionWorld::update ( float time ) CollisionPropertyVector::size_type const count = active.size(); - if(count > 3000) + if (count > 3000) { - WARNING(true,("CollisionWorld::update - Updating more than 3000 objects this frame - something's probably wrong\n")); + WARNING(true, ("CollisionWorld::update - Updating more than 3000 objects this frame - something's probably wrong\n")); } - for(CollisionPropertyVector::size_type i = 0; i < count; i++) + for (CollisionPropertyVector::size_type i = 0; i < count; i++) { update(active[i], time); } @@ -515,7 +512,6 @@ void CollisionWorld::update ( float time ) // ---------- - #ifdef _MSC_VER FloatingPointUnit::setPrecision(oldPrecision); @@ -530,11 +526,11 @@ void CollisionWorld::update ( float time ) updateReportString(); - if(totalCollisionTime >= 0.1f && ConfigSharedCollision::getLogLongFrames()) + if (totalCollisionTime >= 0.1f && ConfigSharedCollision::getLogLongFrames()) { // Collision took more than 100 milliseconds - log the report - LOG("Collision",(ms_reportString.c_str())); + LOG("Collision", (ms_reportString.c_str())); } ms_updating = false; @@ -561,7 +557,7 @@ bool CollisionWorld::spatialSweepAndResolve(CollisionProperty * collider) int const potentialCount = static_cast(collidedWith.size()); - for(int i = 0; i < potentialCount; ++i) + for (int i = 0; i < potentialCount; ++i) { CollisionProperty * const toTestCollision = collidedWith.at(static_cast(i)); @@ -603,11 +599,11 @@ void CollisionWorld::update(CollisionProperty * collider, float time) Footprint * foot = collider->getFootprint(); - if(foot == nullptr) + if (foot == nullptr) { PROFILER_AUTO_BLOCK_DEFINE("CollisionWorld::update: foot == nullptr"); - IGNORE_RETURN (CollisionWorld::spatialSweepAndResolve(collider)); + IGNORE_RETURN(CollisionWorld::spatialSweepAndResolve(collider)); collider->storePosition(); collider->updateIdle(); @@ -638,11 +634,11 @@ void CollisionWorld::update(CollisionProperty * collider, float time) int segments = static_cast(ceil(moveLength / 2.0f)); - if(segments <= 1) + if (segments <= 1) { PROFILER_AUTO_BLOCK_DEFINE("CollisionWorld::update: segments <= 1"); - updateSegment(collider,time); + updateSegment(collider, time); } else { @@ -650,7 +646,7 @@ void CollisionWorld::update(CollisionProperty * collider, float time) // Break the move into pieces and resolve each separately - if(segments > cs_nearWarpCollisionSegmentCount) + if (segments > cs_nearWarpCollisionSegmentCount) { PROFILER_AUTO_BLOCK_DEFINE("CollisionWorld::update: segments > cs_nearWarpCollisionSegmentCount"); @@ -659,7 +655,7 @@ void CollisionWorld::update(CollisionProperty * collider, float time) (*s_nearWarpWarningCallback)(collider->getOwner(), pointA_w, pointB_w, segments); } - if(segments > cs_farWarpCollisionSegmentCount) + if (segments > cs_farWarpCollisionSegmentCount) { PROFILER_AUTO_BLOCK_DEFINE("CollisionWorld::update: segments > cs_farWarpCollisionSegmentCount"); @@ -676,25 +672,25 @@ void CollisionWorld::update(CollisionProperty * collider, float time) // This version just moves them, & hopefully they'll end up in the same cell as they were last frame - Vector pointA_B = CollisionUtils::transformFromWorld(pointA_w,cellB); + Vector pointA_B = CollisionUtils::transformFromWorld(pointA_w, cellB); NAN_CHECK(pointA_B); object->setPosition_p(pointA_B); - if(object->getParentCell() != cellA) + if (object->getParentCell() != cellA) { - REPORT_LOG(ConfigSharedCollision::getReportMessages(),("CollisionWorld::update - Tried to move the object back to where it was last frame, but it ended up in a different cell\n")); + REPORT_LOG(ConfigSharedCollision::getReportMessages(), ("CollisionWorld::update - Tried to move the object back to where it was last frame, but it ended up in a different cell\n")); } // ---------- float segmentTime = time / static_cast(segments); - Vector segmentDelta_w = (pointB_w-pointA_w) / static_cast(segments); + Vector segmentDelta_w = (pointB_w - pointA_w) / static_cast(segments); - for(int i = 0; i < segments; i++) + for (int i = 0; i < segments; i++) { - Vector segmentDelta_p = CollisionUtils::rotateToCell(CellProperty::getWorldCellProperty(),segmentDelta_w,object->getParentCell()); + Vector segmentDelta_p = CollisionUtils::rotateToCell(CellProperty::getWorldCellProperty(), segmentDelta_w, object->getParentCell()); Vector goal = object->getPosition_p() + segmentDelta_p; @@ -702,7 +698,7 @@ void CollisionWorld::update(CollisionProperty * collider, float time) object->setPosition_p(goal); - updateSegment(collider,segmentTime); + updateSegment(collider, segmentTime); } } @@ -710,9 +706,9 @@ void CollisionWorld::update(CollisionProperty * collider, float time) CellProperty const * finalCell = object->getParentCell(); - if(finalCell && (finalCell != CellProperty::getWorldCellProperty())) + if (finalCell && (finalCell != CellProperty::getWorldCellProperty())) { - if(!foot->isAttached()) + if (!foot->isAttached()) { PROFILER_AUTO_BLOCK_DEFINE("CollisionWorld::update: !foot->isAttached()"); @@ -723,7 +719,7 @@ void CollisionWorld::update(CollisionProperty * collider, float time) // ---------------------------------------------------------------------- -void CollisionWorld::updateSegment ( CollisionProperty * collider, float time ) +void CollisionWorld::updateSegment(CollisionProperty * collider, float time) { PROFILER_AUTO_BLOCK_DEFINE("CollisionWorld::updateSegment"); @@ -738,18 +734,18 @@ void CollisionWorld::updateSegment ( CollisionProperty * collider, float time ) Vector delta = pointB_p - pointA_p; - if((delta.x != 0.0f) || (delta.y != 0.0f)) + if ((delta.x != 0.0f) || (delta.y != 0.0f)) { Vector footPos_p = foot->getPosition_p(); Vector groundNormal_p = foot->getGroundNormal_p(); - if(groundNormal_p.y != 0.0f) + if (groundNormal_p.y != 0.0f) { float dx = pointB_p.x - footPos_p.x; float dz = pointB_p.z - footPos_p.z; - float dydx = -(groundNormal_p.x/groundNormal_p.y); - float dydz = -(groundNormal_p.z/groundNormal_p.y); + float dydx = -(groundNormal_p.x / groundNormal_p.y); + float dydz = -(groundNormal_p.z / groundNormal_p.y); float groundOffset = (dx * dydx) + (dz * dydz); @@ -764,20 +760,20 @@ void CollisionWorld::updateSegment ( CollisionProperty * collider, float time ) // ---------- // do the actual collision resolution step - IGNORE_RETURN(updateStep(collider,time)); + IGNORE_RETURN(updateStep(collider, time)); // and now repeatedly snap the object and re-run collision resolution until // there's no collision or we give up int j; - for(j = 0; j < 10; j++) + for (j = 0; j < 10; j++) { IGNORE_RETURN(foot->snapObjectToGround()); - ResolutionResult result = updateStep(collider,0.0f); + ResolutionResult result = updateStep(collider, 0.0f); - if(result == RR_NoCollision) + if (result == RR_NoCollision) { break; } @@ -821,13 +817,12 @@ void CollisionWorld::shoveAway(CollisionProperty * const collisionProperty, Coll NAN_CHECK(newPos); obj->setPosition_p(newPos); - } // ---------------------------------------------------------------------- // returns true if any collisions were resolved -ResolutionResult CollisionWorld::updateStep ( CollisionProperty * collider, float time ) +ResolutionResult CollisionWorld::updateStep(CollisionProperty * collider, float time) { PROFILER_AUTO_BLOCK_DEFINE("CollisionWorld::updateStep"); @@ -837,7 +832,7 @@ ResolutionResult CollisionWorld::updateStep ( CollisionProperty * collider, floa NOT_NULL(foot); - if(foot->isFloating()) + if (foot->isFloating()) { Vector newPos = foot->m_addToWorldPos; @@ -850,7 +845,6 @@ ResolutionResult CollisionWorld::updateStep ( CollisionProperty * collider, floa return RR_NoCollision; } - //---------------------------------------------------------------------- handleTerrainImpassability(*collider, true); @@ -867,7 +861,7 @@ ResolutionResult CollisionWorld::updateStep ( CollisionProperty * collider, floa PROFILER_AUTO_BLOCK_DEFINE("update floor database"); timer.start(); - ms_database->updateFloorCollision(collider,false); + ms_database->updateFloorCollision(collider, false); timer.stop(); floorUpdateTime += timer.getElapsedTime(); @@ -926,27 +920,27 @@ ResolutionResult CollisionWorld::updateStep ( CollisionProperty * collider, floa // ---------------------------------------------------------------------- -bool CollisionWorld::isUpdating ( void ) +bool CollisionWorld::isUpdating(void) { return ms_updating; } // ---------------------------------------------------------------------- -void CollisionWorld::updateReportString ( void ) +void CollisionWorld::updateReportString(void) { ms_reportString.clear(); char buffer[256]; - sprintf(buffer,"CollsionWorld::update -\n"); + sprintf(buffer, "CollsionWorld::update -\n"); ms_reportString += buffer; const int staticObjectCount = ms_database->getObjectCount(SpatialDatabase::Q_Static); const int dynamicObjectCount = ms_database->getObjectCount(SpatialDatabase::Q_Dynamic); const int floorCount = ms_database->getFloorCount(); - sprintf(buffer,"Database : %d S / %d D / %d F\n",staticObjectCount,dynamicObjectCount,floorCount); + sprintf(buffer, "Database : %d S / %d D / %d F\n", staticObjectCount, dynamicObjectCount, floorCount); ms_reportString += buffer; @@ -955,7 +949,7 @@ void CollisionWorld::updateReportString ( void ) int collisionCount = CollisionResolve::getCollisionCount(); int bounceCount = CollisionResolve::getBounceCount(); - sprintf(buffer,"Resolution : %d colliders, %d obstacles, %d collisions, %d bounces\n",colliderCount,obstacleCount,collisionCount,bounceCount); + sprintf(buffer, "Resolution : %d colliders, %d obstacles, %d collisions, %d bounces\n", colliderCount, obstacleCount, collisionCount, bounceCount); ms_reportString += buffer; ms_reportString += "C E F P L T O\n"; @@ -964,62 +958,62 @@ void CollisionWorld::updateReportString ( void ) float behaviorAverage = behaviorTotalTime / static_cast(behaviorAlterCount); - sprintf(buffer,"Behavior : %d, %1.3f total, %1.3f avg, %1.3f max\n",behaviorAlterCount,behaviorTotalTime * 1000.0f,behaviorAverage * 1000.0f,behaviorMaxTime * 1000.0f); + sprintf(buffer, "Behavior : %d, %1.3f total, %1.3f avg, %1.3f max\n", behaviorAlterCount, behaviorTotalTime * 1000.0f, behaviorAverage * 1000.0f, behaviorMaxTime * 1000.0f); ms_reportString += buffer; float aiControllerAverage = aiControllerTotalTime / static_cast(aiControllerAlterCount); - sprintf(buffer,"AiController : %d, %1.3f total, %1.3f avg, %1.3f max\n",aiControllerAlterCount, aiControllerTotalTime * 1000.0f, aiControllerAverage * 1000.0f, aiControllerMaxTime * 1000.0f); + sprintf(buffer, "AiController : %d, %1.3f total, %1.3f avg, %1.3f max\n", aiControllerAlterCount, aiControllerTotalTime * 1000.0f, aiControllerAverage * 1000.0f, aiControllerMaxTime * 1000.0f); ms_reportString += buffer; float canMoveAverage = canMoveTime / static_cast(canMoveCount); - sprintf(buffer,"Can move : %d, %1.3f total, %1.3f avg, %1.3f max\n",canMoveCount, canMoveTime * 1000.0f, canMoveAverage * 1000.0f, maxCanMoveTime * 1000.0f); + sprintf(buffer, "Can move : %d, %1.3f total, %1.3f avg, %1.3f max\n", canMoveCount, canMoveTime * 1000.0f, canMoveAverage * 1000.0f, maxCanMoveTime * 1000.0f); ms_reportString += buffer; - sprintf(buffer,"Extent updates : %d\n",extentUpdateCount); + sprintf(buffer, "Extent updates : %d\n", extentUpdateCount); ms_reportString += buffer; - sprintf(buffer,"Path scrub time : %1.3f msec\n",pathScrubTime * 1000.0f); + sprintf(buffer, "Path scrub time : %1.3f msec\n", pathScrubTime * 1000.0f); ms_reportString += buffer; - sprintf(buffer,"Pathfinding time : %1.3f msec\n",pathfindingTime * 1000.0f); + sprintf(buffer, "Pathfinding time : %1.3f msec\n", pathfindingTime * 1000.0f); ms_reportString += buffer; - sprintf(buffer,"Path build time : %1.3f msec\n",pathBuildTime * 1000.0f); + sprintf(buffer, "Path build time : %1.3f msec\n", pathBuildTime * 1000.0f); ms_reportString += buffer; - sprintf(buffer,"Path search time : %1.3f msec\n",pathSearchTime * 1000.0f); + sprintf(buffer, "Path search time : %1.3f msec\n", pathSearchTime * 1000.0f); ms_reportString += buffer; - sprintf(buffer,"Path search alloc : %d allocs\n",pathAllocations); + sprintf(buffer, "Path search alloc : %d allocs\n", pathAllocations); ms_reportString += buffer; - sprintf(buffer,"Footprint updates : %d updates\n",footprintUpdateCounter); + sprintf(buffer, "Footprint updates : %d updates\n", footprintUpdateCounter); ms_reportString += buffer; - sprintf(buffer,"All collision : %1.3f msec\n",totalCollisionTime * 1000.0f); + sprintf(buffer, "All collision : %1.3f msec\n", totalCollisionTime * 1000.0f); ms_reportString += buffer; - sprintf(buffer,"Floor update : %1.3f msec\n",floorUpdateTime * 1000.0f); + sprintf(buffer, "Floor update : %1.3f msec\n", floorUpdateTime * 1000.0f); ms_reportString += buffer; - sprintf(buffer,"Footprint update : %1.3f msec\n",footprintUpdateTime * 1000.0f); + sprintf(buffer, "Footprint update : %1.3f msec\n", footprintUpdateTime * 1000.0f); ms_reportString += buffer; - sprintf(buffer,"Collision detection : %1.3f msec\n",collisionDetectTime * 1000.0f); + sprintf(buffer, "Collision detection : %1.3f msec\n", collisionDetectTime * 1000.0f); ms_reportString += buffer; - sprintf(buffer,"Collision resolution : %1.3f msec\n",resolveCollisionsTime * 1000.0f); + sprintf(buffer, "Collision resolution : %1.3f msec\n", resolveCollisionsTime * 1000.0f); ms_reportString += buffer; - sprintf(buffer,"Terrain height : %1.3f msec\n",terrainHeightTime * 1000.0f); + sprintf(buffer, "Terrain height : %1.3f msec\n", terrainHeightTime * 1000.0f); ms_reportString += buffer; - sprintf(buffer,"Get cell : %1.3f msec\n",getCellTime * 1000.0f); + sprintf(buffer, "Get cell : %1.3f msec\n", getCellTime * 1000.0f); ms_reportString += buffer; - sprintf(buffer,"Post-update : %1.3f msec\n",postUpdateTime * 1000.0f); + sprintf(buffer, "Post-update : %1.3f msec\n", postUpdateTime * 1000.0f); ms_reportString += buffer; extentUpdateCount = 0; @@ -1041,13 +1035,13 @@ void CollisionWorld::updateReportString ( void ) // ---------------------------------------------------------------------- -void CollisionWorld::reportCallback( void ) +void CollisionWorld::reportCallback(void) { #if _DEBUG - if(!ConfigSharedCollision::getReportStatus()) return; + if (!ConfigSharedCollision::getReportStatus()) return; - DEBUG_REPORT_PRINT(true,(ms_reportString.c_str())); + DEBUG_REPORT_PRINT(true, (ms_reportString.c_str())); #endif } @@ -1074,15 +1068,15 @@ void CollisionWorld::setFarWarpWarningCallback(WarpWarningCallback callback) // ---------------------------------------------------------------------- -void CollisionWorld::addObject ( Object * object ) +void CollisionWorld::addObject(Object * object) { - if(object == nullptr) return; + if (object == nullptr) return; CollisionProperty * collision = object->getCollisionProperty(); - if((collision == nullptr) || collision->getDisableCollisionWorldAddRemove()) return; + if ((collision == nullptr) || collision->getDisableCollisionWorldAddRemove()) return; - if(collision->isInCollisionWorld()) return; + if (collision->isInCollisionWorld()) return; // ---------- @@ -1091,7 +1085,7 @@ void CollisionWorld::addObject ( Object * object ) SpatialDatabase::Query query = collision->getSpatialDatabaseStorageType(); bool added = false; - if(collision->isMobile()) + if (collision->isMobile()) { added = ms_database->addObject(query, object); } @@ -1099,12 +1093,12 @@ void CollisionWorld::addObject ( Object * object ) { Floor * pFloor = collision->getFloor(); - if(pFloor && !pFloor->isCellFloor()) + if (pFloor && !pFloor->isCellFloor()) { added = ms_database->addFloor(pFloor); } - if(collision->getExtent_l()) + if (collision->getExtent_l()) { if (dynamic_cast(object) != 0) { @@ -1121,15 +1115,15 @@ void CollisionWorld::addObject ( Object * object ) environmentChanged(MultiShape(collision->getBoundingSphere_w())); } - if(added) + if (added) { char const * name = object->getObjectTemplateName(); - if(name == nullptr) + if (name == nullptr) { Appearance const * appearance = object->getAppearance(); - if(appearance) + if (appearance) { name = appearance->getAppearanceTemplateName(); } @@ -1138,43 +1132,43 @@ void CollisionWorld::addObject ( Object * object ) int index = 0; switch (query) { - case SpatialDatabase::Q_Static: - index = 1; - break; - case SpatialDatabase::Q_Dynamic: - index = 2; - break; - case SpatialDatabase::Q_Barriers: - index = 3; - break; - case SpatialDatabase::Q_Doors: - index = 4; - break; - default: - break; + case SpatialDatabase::Q_Static: + index = 1; + break; + case SpatialDatabase::Q_Dynamic: + index = 2; + break; + case SpatialDatabase::Q_Barriers: + index = 3; + break; + case SpatialDatabase::Q_Doors: + index = 4; + break; + default: + break; } - DEBUG_REPORT_LOG(ConfigSharedCollision::getReportChanges(),("Added object %s to collision world [%s] at (%f,%f,%f)\n",name, ms_sptatialDatabaseNames[index], object->getPosition_w().x,object->getPosition_w().y,object->getPosition_w().z)); + DEBUG_REPORT_LOG(ConfigSharedCollision::getReportChanges(), ("Added object %s to collision world [%s] at (%f,%f,%f)\n", name, ms_sptatialDatabaseNames[index], object->getPosition_w().x, object->getPosition_w().y, object->getPosition_w().z)); } } // ---------- -void CollisionWorld::removeObject ( Object * object ) +void CollisionWorld::removeObject(Object * object) { - if(object == nullptr) return; + if (object == nullptr) return; CollisionProperty * collision = object->getCollisionProperty(); - if((collision == nullptr) || collision->getDisableCollisionWorldAddRemove()) return; + if ((collision == nullptr) || collision->getDisableCollisionWorldAddRemove()) return; - if(!collision->isInCollisionWorld()) return; + if (!collision->isInCollisionWorld()) return; // ---------- bool removed = false; - if(collision->isMobile()) + if (collision->isMobile()) { removed = ms_database->removeObject(SpatialDatabase::Q_Dynamic, object); } @@ -1182,12 +1176,12 @@ void CollisionWorld::removeObject ( Object * object ) { Floor * pFloor = collision->getFloor(); - if(pFloor && !pFloor->isCellFloor()) + if (pFloor && !pFloor->isCellFloor()) { removed = ms_database->removeFloor(pFloor); } - if(collision->getExtent_l()) + if (collision->getExtent_l()) { SpatialDatabase::Query query = SpatialDatabase::Q_Static; @@ -1206,9 +1200,9 @@ void CollisionWorld::removeObject ( Object * object ) environmentChanged(MultiShape(collision->getBoundingSphere_w())); } - if(removed) + if (removed) { - DEBUG_REPORT_LOG(ConfigSharedCollision::getReportChanges(),("Removed object %s from collision world\n",object->getObjectTemplateName())); + DEBUG_REPORT_LOG(ConfigSharedCollision::getReportChanges(), ("Removed object %s from collision world\n", object->getObjectTemplateName())); } collision->removeFromCollisionWorld(); @@ -1216,19 +1210,19 @@ void CollisionWorld::removeObject ( Object * object ) // ---------- -void CollisionWorld::moveObject (Object * object) +void CollisionWorld::moveObject(Object * object) { - if(object == nullptr) return; + if (object == nullptr) return; CollisionProperty * collision = object->getCollisionProperty(); - if(collision == nullptr) return; + if (collision == nullptr) return; - if(!collision->isInCollisionWorld()) return; + if (!collision->isInCollisionWorld()) return; // ---------- - if(object->getTransform_o2w() == collision->getLastTransform_w()) + if (object->getTransform_o2w() == collision->getLastTransform_w()) { return; } @@ -1238,7 +1232,7 @@ void CollisionWorld::moveObject (Object * object) IGNORE_RETURN(ms_database->moveObject(collision)); - if(!collision->isMobile()) + if (!collision->isMobile()) { environmentChanged(MultiShape(collision->getBoundingSphere_w())); } @@ -1246,15 +1240,15 @@ void CollisionWorld::moveObject (Object * object) // ---------- -void CollisionWorld::cellChanged ( Object * object ) +void CollisionWorld::cellChanged(Object * object) { - if(object == nullptr) return; + if (object == nullptr) return; CollisionProperty * collision = object->getCollisionProperty(); - if(collision == nullptr) return; + if (collision == nullptr) return; - if(!collision->isInCollisionWorld()) return; + if (!collision->isInCollisionWorld()) return; // ---------- @@ -1264,19 +1258,19 @@ void CollisionWorld::cellChanged ( Object * object ) // ---------- -void CollisionWorld::appearanceChanged ( Object * object ) +void CollisionWorld::appearanceChanged(Object * object) { - if(object == nullptr) return; + if (object == nullptr) return; CollisionProperty * collision = object->getCollisionProperty(); - if(collision == nullptr) return; + if (collision == nullptr) return; - if(!collision->isInCollisionWorld()) return; + if (!collision->isInCollisionWorld()) return; // ---------- - if(!collision->isMobile()) + if (!collision->isMobile()) { IGNORE_RETURN(ms_database->moveObject(collision)); @@ -1288,27 +1282,27 @@ void CollisionWorld::appearanceChanged ( Object * object ) // Something about the environment (terrain, static objects) has changed. // Wake up all collision properties in the changed area. -void CollisionWorld::environmentChanged ( MultiShape const & shape ) +void CollisionWorld::environmentChanged(MultiShape const & shape) { static ObjectVec mobs; mobs.clear(); - IGNORE_RETURN(ms_database->queryDynamics(shape,&mobs)); + IGNORE_RETURN(ms_database->queryDynamics(shape, &mobs)); ObjectVec::size_type const count = mobs.size(); - if(count > 500) + if (count > 500) { Vector c = shape.getCenter(); float x = shape.getExtentX() * 2.0f; float y = shape.getExtentY() * 2.0f; float z = shape.getExtentZ() * 2.0f; - WARNING(true,("CollisionWorld::environmentChanged - Changing environment wakes up over 500 AIs. This is probably bad. (%f,%f,%f), (%f,%f,%f)\n",c.x,c.y,c.z,x,y,z)); + WARNING(true, ("CollisionWorld::environmentChanged - Changing environment wakes up over 500 AIs. This is probably bad. (%f,%f,%f), (%f,%f,%f)\n", c.x, c.y, c.z, x, y, z)); } - for(ObjectVec::size_type i = 0; i < count; i++) + for (ObjectVec::size_type i = 0; i < count; i++) { Object * mob = mobs[i]; @@ -1324,21 +1318,21 @@ void CollisionWorld::environmentChanged ( MultiShape const & shape ) // ---------------------------------------------------------------------- -SpatialDatabase * CollisionWorld::getDatabase ( void ) +SpatialDatabase * CollisionWorld::getDatabase(void) { return ms_database; } // ---------------------------------------------------------------------- -void CollisionWorld::objectWarped ( Object * object ) +void CollisionWorld::objectWarped(Object * object) { - if(object == nullptr) return; + if (object == nullptr) return; CollisionProperty * collision = object->getCollisionProperty(); // object does not have a CollisionProperty - if(collision == nullptr) return; + if (collision == nullptr) return; // object is not in CollisionWorld if (!collision->isInCollisionWorld()) return; @@ -1356,37 +1350,37 @@ void CollisionWorld::objectWarped ( Object * object ) // range of the 2 objects before terrain LOS is done (only valid // if useTerrainLos is true) -QueryInteractionResult CollisionWorld::queryInteraction ( CellProperty const * cellA, Vector const & pointA, - CellProperty const * cellB, Vector const & pointB, - Object const * ignoreObject, - bool const useTerrainLos, - bool const generateTerrainLos, - float const terrainLosMinDistance, - float const terrainLosMaxDistance, - float & outHitTime, Object const * & outHitObject ) +QueryInteractionResult CollisionWorld::queryInteraction(CellProperty const * cellA, Vector const & pointA, + CellProperty const * cellB, Vector const & pointB, + Object const * ignoreObject, + bool const useTerrainLos, + bool const generateTerrainLos, + float const terrainLosMinDistance, + float const terrainLosMaxDistance, + float & outHitTime, Object const * & outHitObject) { PROFILER_AUTO_BLOCK_DEFINE("CollisionWorld::queryInteraction"); - Vector localB = CollisionUtils::transformToCell(cellB,pointB,cellA); + Vector localB = CollisionUtils::transformToCell(cellB, pointB, cellA); - Segment3d inSeg(pointA,localB); + Segment3d inSeg(pointA, localB); // ---------- // Test portals first. If the query line hits a portal, we'll ignore any collision after that hit. float hitPortalTime = REAL_MAX; - CellProperty const * nextCell = cellA->getDestinationCell(pointA,localB,hitPortalTime); + CellProperty const * nextCell = cellA->getDestinationCell(pointA, localB, hitPortalTime); // ---------- // Test all extents first BaseExtent const * cellExtent = cellA->getCollisionExtent(); - if(cellExtent) + if (cellExtent) { Range hitRange = cellExtent->rangedIntersect(inSeg); - if(!hitRange.isEmpty() && (hitRange.getMin() < hitPortalTime)) + if (!hitRange.isEmpty() && (hitRange.getMin() < hitPortalTime)) { outHitTime = hitRange.getMin(); outHitObject = &cellA->getOwner(); @@ -1401,9 +1395,9 @@ QueryInteractionResult CollisionWorld::queryInteraction ( CellProperty const * c Object const * hitObject; float hitTime = 0.0f; - if(ms_database->queryInteraction(cellA,inSeg,ignoreObject,hitObject,hitTime)) + if (ms_database->queryInteraction(cellA, inSeg, ignoreObject, hitObject, hitTime)) { - if(hitTime < hitPortalTime) + if (hitTime < hitPortalTime) { outHitTime = hitTime; outHitObject = hitObject; @@ -1419,7 +1413,7 @@ QueryInteractionResult CollisionWorld::queryInteraction ( CellProperty const * c { if ((inSeg.getLength() >= terrainLosMinDistance) && (inSeg.getLength() <= terrainLosMaxDistance)) { - if(cellA == CellProperty::getWorldCellProperty()) + if (cellA == CellProperty::getWorldCellProperty()) { PROFILER_AUTO_BLOCK_DEFINE("CollisionWorld::queryInteraction::Terrain"); @@ -1434,12 +1428,12 @@ QueryInteractionResult CollisionWorld::queryInteraction ( CellProperty const * c if (generateTerrainLos) { // do terrain LOS check, generating any missing terrain between the 2 points - terrainCollide = terrain->collideForceChunkCreation(pointA,localB,info); + terrainCollide = terrain->collideForceChunkCreation(pointA, localB, info); } else { // do terrain LOS check, using only the generated terrain between the 2 points - terrainCollide = terrain->collide(pointA,localB,info); + terrainCollide = terrain->collide(pointA, localB, info); } } @@ -1453,9 +1447,9 @@ QueryInteractionResult CollisionWorld::queryInteraction ( CellProperty const * c Vector delta = localB - pointA; - float hitTime = Collision3d::ComponentAlong(hitDelta,delta); + float hitTime = Collision3d::ComponentAlong(hitDelta, delta); - if(hitTime < hitPortalTime) + if (hitTime < hitPortalTime) { outHitTime = hitTime; outHitObject = nullptr; @@ -1467,14 +1461,13 @@ QueryInteractionResult CollisionWorld::queryInteraction ( CellProperty const * c } } - // ---------- // If we did not hit a portal, the query ends in this cell. // If this cell is not the goal cell, then the query fails. - if(nextCell == nullptr) + if (nextCell == nullptr) { - if(cellA != cellB) + if (cellA != cellB) { outHitTime = 1.0f; outHitObject = nullptr; @@ -1496,19 +1489,19 @@ QueryInteractionResult CollisionWorld::queryInteraction ( CellProperty const * c // Don't bother recursing if the segment we'd test in the next cell is tiny - if(clipPoint.magnitudeBetween(localB) <= 0.01f) + if (clipPoint.magnitudeBetween(localB) <= 0.01f) { return QIR_None; } - Vector nextPoint = CollisionUtils::transformToCell(cellA,clipPoint,nextCell); + Vector nextPoint = CollisionUtils::transformToCell(cellA, clipPoint, nextCell); // ---------- // infinite recursion sentinel static int recursed = 0; - if(recursed >= 10) + if (recursed >= 10) { return QIR_None; } @@ -1518,16 +1511,16 @@ QueryInteractionResult CollisionWorld::queryInteraction ( CellProperty const * c recursed++; QueryInteractionResult recurseResult = queryInteraction(nextCell, - nextPoint, - cellB, - pointB, - ignoreObject, - useTerrainLos, - generateTerrainLos, - terrainLosMinDistance, - terrainLosMaxDistance, - outHitTime, - outHitObject); + nextPoint, + cellB, + pointB, + ignoreObject, + useTerrainLos, + generateTerrainLos, + terrainLosMinDistance, + terrainLosMaxDistance, + outHitTime, + outHitObject); recursed--; @@ -1540,61 +1533,60 @@ QueryInteractionResult CollisionWorld::queryInteraction ( CellProperty const * c return recurseResult; } - } // ---------------------------------------------------------------------- -bool CollisionWorld::query( Line3d const & line, ObjectVec * outList ) +bool CollisionWorld::query(Line3d const & line, ObjectVec * outList) { - return ms_database->queryStatics(line,outList); + return ms_database->queryStatics(line, outList); } // ---------- -bool CollisionWorld::query( Sphere const & sphere, ObjectVec * outList ) +bool CollisionWorld::query(Sphere const & sphere, ObjectVec * outList) { - return ms_database->queryStatics(sphere,outList); + return ms_database->queryStatics(sphere, outList); } // ---------------------------------------------------------------------- // Given startLoc and goalLoc in the same cell, determine if startLoc // can reach goalLoc -CanMoveResult CollisionWorld::canMoveInCell ( Object const * object, - CellProperty const * startCell, - FloorLocator const & startLoc, - Vector const & goalPos, - bool checkY, - bool checkFlora, - bool checkFauna, - FloorLocator & outLoc, - int & outHitPortalId ) +CanMoveResult CollisionWorld::canMoveInCell(Object const * object, + CellProperty const * startCell, + FloorLocator const & startLoc, + Vector const & goalPos, + bool checkY, + bool checkFlora, + bool checkFauna, + FloorLocator & outLoc, + int & outHitPortalId) { FloorLocator goalLoc; - if(checkY) + if (checkY) { - makeLocator(startCell,goalPos,goalLoc); + makeLocator(startCell, goalPos, goalLoc); } else { - goalLoc.setFloor( startCell->getFloor() ); - goalLoc.setPosition_p( goalPos ); + goalLoc.setFloor(startCell->getFloor()); + goalLoc.setPosition_p(goalPos); } - return canMoveInCell(object, startCell,startLoc,goalLoc,checkY,checkFlora,checkFauna,outLoc,outHitPortalId ); + return canMoveInCell(object, startCell, startLoc, goalLoc, checkY, checkFlora, checkFauna, outLoc, outHitPortalId); } -CanMoveResult CollisionWorld::canMoveInCell ( Object const * object, - CellProperty const * startCell, - FloorLocator const & startLoc, - FloorLocator const & goalLoc, - bool checkY, - bool checkFlora, - bool checkFauna, - FloorLocator & outLoc, - int & outHitPortalId ) +CanMoveResult CollisionWorld::canMoveInCell(Object const * object, + CellProperty const * startCell, + FloorLocator const & startLoc, + FloorLocator const & goalLoc, + bool checkY, + bool checkFlora, + bool checkFauna, + FloorLocator & outLoc, + int & outHitPortalId) { // ---------- // Test collision extents @@ -1602,13 +1594,13 @@ CanMoveResult CollisionWorld::canMoveInCell ( Object const * object, Vector startPos = startLoc.getPosition_p(); Vector goalPos = goalLoc.getPosition_p(); - Segment3d querySeg(startPos,goalPos); + Segment3d querySeg(startPos, goalPos); - if(startCell == CellProperty::getWorldCellProperty()) + if (startCell == CellProperty::getWorldCellProperty()) { float radius = startLoc.getRadius(); - Sphere sphere(startPos + Vector(0.0f,radius,0.0f),radius); + Sphere sphere(startPos + Vector(0.0f, radius, 0.0f), radius); Vector delta = goalPos - startPos; float collisionTime = 0.0f; @@ -1618,11 +1610,11 @@ CanMoveResult CollisionWorld::canMoveInCell ( Object const * object, return CMR_HitObstacle; } - if(ms_database->queryMaterial(startCell,sphere,delta,MT_Solid,checkFlora,checkFauna,object,collisionTime)) + if (ms_database && ms_database->queryMaterial(startCell, sphere, delta, MT_Solid, checkFlora, checkFauna, object, collisionTime)) { float epsilon = 0.05f / delta.magnitude(); - if(collisionTime > -epsilon) + if (collisionTime > -epsilon) { return CMR_HitObstacle; } @@ -1640,23 +1632,23 @@ CanMoveResult CollisionWorld::canMoveInCell ( Object const * object, bool hasOutLoc = false; - if(startCell == CellProperty::getWorldCellProperty()) + if (startCell == CellProperty::getWorldCellProperty()) { - if(ms_database) + if (ms_database) { FloorVec floors; - IGNORE_RETURN(ms_database->queryFloors(startCell,querySeg,&floors)); + IGNORE_RETURN(ms_database->queryFloors(startCell, querySeg, &floors)); - for(uint i = 0; i < floors.size(); i++) + for (uint i = 0; i < floors.size(); i++) { Floor const * floor = floors[i]; - CanMoveResult result = canMoveOnFloor(object,startLoc,floor,goalLoc,checkY,checkFlora,checkFauna,outLoc,outHitPortalId); + CanMoveResult result = canMoveOnFloor(object, startLoc, floor, goalLoc, checkY, checkFlora, checkFauna, outLoc, outHitPortalId); - if(result == CMR_MoveOK) + if (result == CMR_MoveOK) { - if(outHitPortalId != -1) + if (outHitPortalId != -1) { hasOutLoc = true; } @@ -1674,13 +1666,13 @@ CanMoveResult CollisionWorld::canMoveInCell ( Object const * object, Floor const * cellFloor = startCell->getFloor(); - if(cellFloor) + if (cellFloor) { - return canMoveOnFloor(object,startLoc,cellFloor,goalLoc,checkY,checkFlora,checkFauna,outLoc,outHitPortalId); + return canMoveOnFloor(object, startLoc, cellFloor, goalLoc, checkY, checkFlora, checkFauna, outLoc, outHitPortalId); } else { - if(!hasOutLoc) outLoc = goalLoc; + if (!hasOutLoc) outLoc = goalLoc; return CMR_MoveOK; } @@ -1688,33 +1680,33 @@ CanMoveResult CollisionWorld::canMoveInCell ( Object const * object, // ---------------------------------------------------------------------- -CanMoveResult CollisionWorld::canMove ( CellProperty const * startCell, - Vector const & startPos, - Vector const & goalPos, - float moveRadius, - bool checkY, - bool checkFlora, - bool checkFauna ) +CanMoveResult CollisionWorld::canMove(CellProperty const * startCell, + Vector const & startPos, + Vector const & goalPos, + float moveRadius, + bool checkY, + bool checkFlora, + bool checkFauna) { canMoveCount++; - FloorLocator startLoc(startPos,moveRadius); + FloorLocator startLoc(startPos, moveRadius); FloorLocator dummy; - return canMove( nullptr, startCell, startLoc, goalPos, checkY, checkFlora, checkFauna, dummy ); + return canMove(nullptr, startCell, startLoc, goalPos, checkY, checkFlora, checkFauna, dummy); } // ---------- -CanMoveResult CollisionWorld::canMove ( Object const * object, - Vector const & goalPos, - float moveRadius, - bool checkY, - bool checkFlora, - bool checkFauna ) +CanMoveResult CollisionWorld::canMove(Object const * object, + Vector const & goalPos, + float moveRadius, + bool checkY, + bool checkFlora, + bool checkFauna) { - if(object == nullptr) + if (object == nullptr) { return CMR_Error; } @@ -1722,19 +1714,19 @@ CanMoveResult CollisionWorld::canMove ( Object const * object, { CollisionProperty const * collision = object->getCollisionProperty(); - if(collision) + if (collision) { Footprint const * foot = collision->getFootprint(); - if(foot && foot->isObjectInSync()) + if (foot && foot->isObjectInSync()) { FloorLocator const * footLoc = foot->getAnyContact(); - if(footLoc && footLoc->isAttached()) + if (footLoc && footLoc->isAttached()) { FloorLocator objectLoc = *footLoc; - objectLoc.setPosition_p( object->getPosition_p() ); + objectLoc.setPosition_p(object->getPosition_p()); objectLoc.setRadius(moveRadius); @@ -1742,31 +1734,31 @@ CanMoveResult CollisionWorld::canMove ( Object const * object, FloorLocator dummy; - return canMove( object, startCell, objectLoc, goalPos, checkY, checkFlora, checkFauna, dummy ); + return canMove(object, startCell, objectLoc, goalPos, checkY, checkFlora, checkFauna, dummy); } } } } - FloorLocator startLoc(object->getPosition_p(),moveRadius); + FloorLocator startLoc(object->getPosition_p(), moveRadius); FloorLocator dummy; - return canMove( object, object->getParentCell(), startLoc, goalPos, checkY, checkFlora, checkFauna, dummy ); + return canMove(object, object->getParentCell(), startLoc, goalPos, checkY, checkFlora, checkFauna, dummy); } // ---------------------------------------------------------------------- -CanMoveResult CollisionWorld::canMove ( Object const * object, - CellProperty const * startCell, - FloorLocator const & startLoc, - Vector const & goalPos, - bool checkY, - bool checkFlora, - bool checkFauna, - FloorLocator & endLoc ) +CanMoveResult CollisionWorld::canMove(Object const * object, + CellProperty const * startCell, + FloorLocator const & startLoc, + Vector const & goalPos, + bool checkY, + bool checkFlora, + bool checkFauna, + FloorLocator & endLoc) { - if(startCell == nullptr) + if (startCell == nullptr) { startCell = CellProperty::getWorldCellProperty(); } @@ -1775,16 +1767,16 @@ CanMoveResult CollisionWorld::canMove ( Object const * object, int hitPortalId = -1; - CanMoveResult cellResult = canMoveInCell(object,startCell,startLoc,goalPos,checkY,checkFlora,checkFauna,endLoc,hitPortalId); + CanMoveResult cellResult = canMoveInCell(object, startCell, startLoc, goalPos, checkY, checkFlora, checkFauna, endLoc, hitPortalId); - if(cellResult != CMR_MoveOK) + if (cellResult != CMR_MoveOK) { // We hit something in this cell return cellResult; } - if(hitPortalId == -1) + if (hitPortalId == -1) { // We made it to the goal without hitting a portal - the move // succeeds @@ -1797,21 +1789,21 @@ CanMoveResult CollisionWorld::canMove ( Object const * object, Floor const * floor = endLoc.getFloor(); - if(!floor) + if (!floor) { return CMR_Error; } Object const * owner = floor->getOwner(); - if(!owner) + if (!owner) { return CMR_Error; } - CellProperty * newCell = startCell->getDestinationCell(owner,hitPortalId); + CellProperty * newCell = startCell->getDestinationCell(owner, hitPortalId); - if(!newCell) + if (!newCell) { return CMR_Error; } @@ -1821,15 +1813,15 @@ CanMoveResult CollisionWorld::canMove ( Object const * object, Vector hitPortalPos = endLoc.getPosition_p(); - Vector newStartPos = CollisionUtils::transformToCell(startCell,hitPortalPos,newCell); + Vector newStartPos = CollisionUtils::transformToCell(startCell, hitPortalPos, newCell); - FloorLocator newStartLoc(newStartPos,startLoc.getRadius()); + FloorLocator newStartLoc(newStartPos, startLoc.getRadius()); - Vector newGoalPos = CollisionUtils::transformToCell(startCell,goalPos,newCell); + Vector newGoalPos = CollisionUtils::transformToCell(startCell, goalPos, newCell); float dist2 = newStartPos.magnitudeBetweenSquared(newGoalPos); - if(dist2 < 0.0000000001f) + if (dist2 < 0.0000000001f) { return CMR_MoveOK; } @@ -1837,11 +1829,11 @@ CanMoveResult CollisionWorld::canMove ( Object const * object, { static int recursionCounter = 0; - if(recursionCounter == 10) + if (recursionCounter == 10) { Vector s = startLoc.getPosition_w(); - WARNING_STRICT_FATAL(ConfigSharedCollision::getReportWarnings(),("CollisionWorld::canMove - infinite recursion detected (%f,%f,%f)",s.x,s.y,s.z)); + WARNING_STRICT_FATAL(ConfigSharedCollision::getReportWarnings(), ("CollisionWorld::canMove - infinite recursion detected (%f,%f,%f)", s.x, s.y, s.z)); endLoc = FloorLocator::invalid; return CMR_Error; @@ -1849,7 +1841,7 @@ CanMoveResult CollisionWorld::canMove ( Object const * object, recursionCounter++; - CanMoveResult result = canMove(object,newCell,newStartLoc,newGoalPos,checkY,checkFlora,checkFauna,endLoc); + CanMoveResult result = canMove(object, newCell, newStartLoc, newGoalPos, checkY, checkFlora, checkFauna, endLoc); recursionCounter--; @@ -1860,27 +1852,27 @@ CanMoveResult CollisionWorld::canMove ( Object const * object, // ---------- // A nullptr goal cell means we don't care what cell we end up in as long as we make it to the goal -CanMoveResult CollisionWorld::canMove ( Object const * object, - CellProperty const * startCell, - FloorLocator const & startLoc, - CellProperty const * goalCell, - FloorLocator const & goalLoc, - bool checkY, - bool checkFlora, - bool checkFauna ) +CanMoveResult CollisionWorld::canMove(Object const * object, + CellProperty const * startCell, + FloorLocator const & startLoc, + CellProperty const * goalCell, + FloorLocator const & goalLoc, + bool checkY, + bool checkFlora, + bool checkFauna) { // ---------- - if(startCell == nullptr) + if (startCell == nullptr) { startCell = CellProperty::getWorldCellProperty(); } - if(goalCell == nullptr) + if (goalCell == nullptr) { FloorLocator dummy; - return canMove(object,startCell,startLoc,goalLoc.getPosition_p(),checkY,checkFlora,checkFauna,dummy); + return canMove(object, startCell, startLoc, goalLoc.getPosition_p(), checkY, checkFlora, checkFauna, dummy); } // ---------- @@ -1888,14 +1880,14 @@ CanMoveResult CollisionWorld::canMove ( Object const * object, int hitPortalId = -1; FloorLocator endLoc; - if(startCell == goalCell) + if (startCell == goalCell) { // We're in the right cell. The move succeeds if it makes it to the goal // without hitting a portal on the way there. - CanMoveResult cellResult = canMoveInCell(object,startCell,startLoc,goalLoc,checkY,checkFlora,checkFauna,endLoc,hitPortalId); + CanMoveResult cellResult = canMoveInCell(object, startCell, startLoc, goalLoc, checkY, checkFlora, checkFauna, endLoc, hitPortalId); - if((cellResult == CMR_MoveOK) && (hitPortalId != -1)) + if ((cellResult == CMR_MoveOK) && (hitPortalId != -1)) { return CMR_MissedGoal; } @@ -1912,18 +1904,18 @@ CanMoveResult CollisionWorld::canMove ( Object const * object, Vector const & goalPos = goalLoc.getPosition_p(); - Vector localGoalPos = CollisionUtils::transformToCell(goalCell,goalPos,startCell); + Vector localGoalPos = CollisionUtils::transformToCell(goalCell, goalPos, startCell); - CanMoveResult cellResult = canMoveInCell(object,startCell,startLoc,localGoalPos,checkY,checkFlora,checkFauna,endLoc,hitPortalId); + CanMoveResult cellResult = canMoveInCell(object, startCell, startLoc, localGoalPos, checkY, checkFlora, checkFauna, endLoc, hitPortalId); - if(cellResult != CMR_MoveOK) + if (cellResult != CMR_MoveOK) { // We hit something while trying to get out of this cell - the move fails. return cellResult; } - if(hitPortalId == -1) + if (hitPortalId == -1) { // We can move towards the goal from the current cell, but we don't exit the cell via a portal-adjacent // floor edge and we're not in the right goal cell - we can never get to the goal cell, @@ -1936,52 +1928,52 @@ CanMoveResult CollisionWorld::canMove ( Object const * object, Floor const * floor = endLoc.getFloor(); - if(!floor) + if (!floor) { return CMR_Error; } Object const * owner = floor->getOwner(); - if(!owner) + if (!owner) { return CMR_Error; } - CellProperty * newCell = startCell->getDestinationCell(owner,hitPortalId); + CellProperty * newCell = startCell->getDestinationCell(owner, hitPortalId); - if(!newCell) + if (!newCell) { return CMR_Error; } Vector hitPortalPos = endLoc.getPosition_p(); - Vector newStartPos = CollisionUtils::transformToCell(startCell,hitPortalPos,newCell); + Vector newStartPos = CollisionUtils::transformToCell(startCell, hitPortalPos, newCell); - FloorLocator newStartLoc(newStartPos,startLoc.getRadius()); + FloorLocator newStartLoc(newStartPos, startLoc.getRadius()); newStartLoc.setRadius(startLoc.getRadius()); - return canMove(object,newCell,newStartLoc,goalCell,goalLoc,checkY,checkFlora,checkFauna); + return canMove(object, newCell, newStartLoc, goalCell, goalLoc, checkY, checkFlora, checkFauna); } // ---------------------------------------------------------------------- -CanMoveResult CollisionWorld::canMoveOnFloor ( Object const * object, - FloorLocator const & startLoc, - Floor const * floor, - FloorLocator const & goalLoc, - bool checkY, - bool checkFlora, - bool checkFauna, - FloorLocator & outLoc, - int & outHitPortalId ) +CanMoveResult CollisionWorld::canMoveOnFloor(Object const * object, + FloorLocator const & startLoc, + Floor const * floor, + FloorLocator const & goalLoc, + bool checkY, + bool checkFlora, + bool checkFauna, + FloorLocator & outLoc, + int & outHitPortalId) { FloorMesh const * floorMesh = floor->getFloorMesh(); - Vector const & startPos = startLoc.getPosition_p() + Vector(0.0f,startLoc.getOffset(),0.0f); - Vector const & goalPos = goalLoc.getPosition_p() + Vector(0.0f,goalLoc.getOffset(),0.0f); + Vector const & startPos = startLoc.getPosition_p() + Vector(0.0f, startLoc.getOffset(), 0.0f); + Vector const & goalPos = goalLoc.getPosition_p() + Vector(0.0f, goalLoc.getOffset(), 0.0f); Vector localGoalPos = goalPos; @@ -1991,25 +1983,25 @@ CanMoveResult CollisionWorld::canMoveOnFloor ( Object const * object, delta.y = 0.0f; - if(!startLoc.isAttachedTo(floor)) + if (!startLoc.isAttachedTo(floor)) { // Starting location isn't on this floor, run the canMoveOnFloor version that does an // attachment test instead - return canMoveOnFloor(object,startPos,radius,floor,goalLoc,checkY,checkFlora,checkFauna,outLoc,outHitPortalId); + return canMoveOnFloor(object, startPos, radius, floor, goalLoc, checkY, checkFlora, checkFauna, outLoc, outHitPortalId); } // ---------- FloorLocator result; - PathWalkResult walkResult = floor->canMove(startLoc,delta,-1,-1,result); + PathWalkResult walkResult = floor->canMove(startLoc, delta, -1, -1, result); outLoc = result; outHitPortalId = -1; - if((result.getTriId() >= 0) && (result.getEdgeId() >= 0)) + if ((result.getTriId() >= 0) && (result.getEdgeId() >= 0)) { int const exitTriId = result.getTriId(); @@ -2018,7 +2010,6 @@ CanMoveResult CollisionWorld::canMoveOnFloor ( Object const * object, outHitPortalId = exitTri.getPortalId(result.getEdgeId()); } - // ---------- // The move has clipped to a crossable edge of the floor. // Check to see if the move re-enters this floor, and if it does @@ -2026,15 +2017,15 @@ CanMoveResult CollisionWorld::canMoveOnFloor ( Object const * object, // Since this is a recursive call, it'll catch an arbitrary number of reentrances - if(walkResult == PWR_HitPortalEdge) + if (walkResult == PWR_HitPortalEdge) { // Exiting the mesh along a portal-adjacent edge is always a successful move. return CMR_MoveOK; } - else if(walkResult == PWR_ExitedMesh) + else if (walkResult == PWR_ExitedMesh) { - if(floor->isCellFloor()) + if (floor->isCellFloor()) { // Trying to walk off a ledge inside a cell isn't allowed at the moment. @@ -2045,9 +2036,9 @@ CanMoveResult CollisionWorld::canMoveOnFloor ( Object const * object, FloorLocator reenterLoc; - if(floor->findEntryPoint(result,reenterDelta,false,reenterLoc)) + if (floor->findEntryPoint(result, reenterDelta, false, reenterLoc)) { - if(reenterLoc.getTime() > 0.0f) + if (reenterLoc.getTime() > 0.0f) { Vector reenterPos = reenterLoc.getPosition_p(); @@ -2057,18 +2048,18 @@ CanMoveResult CollisionWorld::canMoveOnFloor ( Object const * object, static int recursionCounter = 0; - if(recursionCounter == 5) + if (recursionCounter == 5) { Vector s = startLoc.getPosition_w(); - WARNING_STRICT_FATAL(ConfigSharedCollision::getReportWarnings(),("CollisionWorld::canMoveOnFloor - infinite recursion detected (%f,%f,%f)",s.x,s.y,s.z)); + WARNING_STRICT_FATAL(ConfigSharedCollision::getReportWarnings(), ("CollisionWorld::canMoveOnFloor - infinite recursion detected (%f,%f,%f)", s.x, s.y, s.z)); outLoc = FloorLocator::invalid; outHitPortalId = -1; return CMR_Error; } recursionCounter++; - CanMoveResult floorResult = canMoveOnFloor(object,reenterLoc,floor,goalLoc,checkY,checkFlora,checkFauna,outLoc,outHitPortalId); + CanMoveResult floorResult = canMoveOnFloor(object, reenterLoc, floor, goalLoc, checkY, checkFlora, checkFauna, outLoc, outHitPortalId); recursionCounter--; @@ -2081,11 +2072,11 @@ CanMoveResult CollisionWorld::canMoveOnFloor ( Object const * object, return CMR_MoveOK; } - else if(walkResult == PWR_WalkOk) + else if (walkResult == PWR_WalkOk) { - if((floor->getCell() == CellProperty::getWorldCellProperty())) + if ((floor->getCell() == CellProperty::getWorldCellProperty())) { - if(result.isFallthrough()) + if (result.isFallthrough()) { return CMR_MoveOK; } @@ -2099,7 +2090,7 @@ CanMoveResult CollisionWorld::canMoveOnFloor ( Object const * object, // The start and goal locs are on this floor - if the move didn't get to // the goal tri, the move failed. - if(checkY && (goalLoc.getId() != -1) && (result.getId() != goalLoc.getId())) + if (checkY && (goalLoc.getId() != -1) && (result.getId() != goalLoc.getId())) { return CMR_MissedGoal; } @@ -2110,11 +2101,11 @@ CanMoveResult CollisionWorld::canMoveOnFloor ( Object const * object, } else { - if(result.getFloor() == floor) + if (result.getFloor() == floor) { Vector resultPos = result.getPosition_p(); - if((resultPos.y - goalPos.y) > 3.0f) + if ((resultPos.y - goalPos.y) > 3.0f) { return CMR_MissedGoal; } @@ -2137,29 +2128,29 @@ CanMoveResult CollisionWorld::canMoveOnFloor ( Object const * object, // ---------------------------------------------------------------------- -CanMoveResult CollisionWorld::canMoveOnFloor ( Object const * object, - Vector const & inPos, - float moveRadius, - Floor const * floor, - FloorLocator const & inGoalLoc, - bool checkY, - bool checkFlora, - bool checkFauna, - FloorLocator & outLoc, - int & outHitPortalId ) +CanMoveResult CollisionWorld::canMoveOnFloor(Object const * object, + Vector const & inPos, + float moveRadius, + Floor const * floor, + FloorLocator const & inGoalLoc, + bool checkY, + bool checkFlora, + bool checkFauna, + FloorLocator & outLoc, + int & outHitPortalId) { bool hasStartLoc = false; FloorLocator startLoc; FloorLocator goalLoc = inGoalLoc; - if(goalLoc.getFloor() != floor) + if (goalLoc.getFloor() != floor) { - Vector goalPos_p = goalLoc.getPosition_p( floor->getCell() ); + Vector goalPos_p = goalLoc.getPosition_p(floor->getCell()); FloorLocator tempLoc; - if(floor->dropTest( goalPos_p, tempLoc )) + if (floor->dropTest(goalPos_p, tempLoc)) { goalLoc = tempLoc; } @@ -2172,7 +2163,7 @@ CanMoveResult CollisionWorld::canMoveOnFloor ( Object const * object, // If the start point is already above the floor, the floor move will begin // at the floor point under the start point - if(floor->dropTest(inPos,startLoc)) + if (floor->dropTest(inPos, startLoc)) { Vector startPos_w = startLoc.getPosition_w(); @@ -2187,13 +2178,13 @@ CanMoveResult CollisionWorld::canMoveOnFloor ( Object const * object, Vector delta = goalLoc.getPosition_p() - inPos; - FloorLocator tempLoc(inPos,moveRadius); + FloorLocator tempLoc(inPos, moveRadius); - if(floor->findEntryPoint(tempLoc,delta,false,startLoc)) + if (floor->findEntryPoint(tempLoc, delta, false, startLoc)) { bool edgeCrossable = floor->getFloorMesh()->getFloorTri(startLoc.getId()).isCrossable(startLoc.getEdgeId()); - if(!edgeCrossable) + if (!edgeCrossable) { return CMR_HitFloorEdge; } @@ -2205,11 +2196,11 @@ CanMoveResult CollisionWorld::canMoveOnFloor ( Object const * object, // ---------- // If we found a starting point for the floor move, run the floor move - if(hasStartLoc) + if (hasStartLoc) { startLoc.setRadius(moveRadius); - return canMoveOnFloor(object,startLoc,floor,goalLoc,checkY,checkFlora,checkFauna,outLoc,outHitPortalId); + return canMoveOnFloor(object, startLoc, floor, goalLoc, checkY, checkFlora, checkFauna, outLoc, outHitPortalId); } else { @@ -2224,7 +2215,7 @@ CanMoveResult CollisionWorld::canMoveOnFloor ( Object const * object, // do a temporal collision test against each of them, return true if // the creature hit one and a pointer to the first one hit. -bool CollisionWorld::findFirstObstacle ( Object const * creature, float creatureRadius, Vector const & testPos, Vector const & goalPos, bool testStatics, bool testCreatures, Object const * & outObject ) +bool CollisionWorld::findFirstObstacle(Object const * creature, float creatureRadius, Vector const & testPos, Vector const & goalPos, bool testStatics, bool testCreatures, Object const * & outObject) { UNREF(goalPos); UNREF(creatureRadius); @@ -2233,21 +2224,21 @@ bool CollisionWorld::findFirstObstacle ( Object const * creature, float creature Vector delta = testPos - startPos; - if(creature == nullptr) return false; + if (creature == nullptr) return false; CollisionProperty const * collision = creature->getCollisionProperty(); - if(collision == nullptr) return false; + if (collision == nullptr) return false; BaseExtent const * baseExtent = collision->getExtent_p(); SimpleExtent const * simpleExtent = dynamic_cast(baseExtent); - if(simpleExtent == nullptr) return false; + if (simpleExtent == nullptr) return false; MultiShape const & shape = simpleExtent->getShape(); - if(shape.getShapeType() != MultiShape::MST_Sphere) return false; + if (shape.getShapeType() != MultiShape::MST_Sphere) return false; // ---------- // Test collision extents @@ -2262,24 +2253,24 @@ bool CollisionWorld::findFirstObstacle ( Object const * creature, float creature statics.clear(); creatures.clear(); - if(ms_database->queryObjects(creature->getParentCell(), shape, delta, (testStatics ? &statics : nullptr), (testCreatures ? &creatures : nullptr))) + if (ms_database->queryObjects(creature->getParentCell(), shape, delta, (testStatics ? &statics : nullptr), (testCreatures ? &creatures : nullptr))) { ObjectVector::size_type const nStatics = statics.size(); ObjectVector::size_type i; - for(i = 0; i < nStatics; i++) + for (i = 0; i < nStatics; i++) { Object const * obstacle = statics[i]; - if(obstacle == nullptr) continue; + if (obstacle == nullptr) continue; - if(obstacle == creature) continue; + if (obstacle == creature) continue; - if(Distance2d::Distance2(obstacle->getPosition_w(),goalPos) < 0.000001) continue; + if (Distance2d::Distance2(obstacle->getPosition_w(), goalPos) < 0.000001) continue; - DetectResult result = CollisionDetect::testObjects(creature,delta,obstacle); + DetectResult result = CollisionDetect::testObjects(creature, delta, obstacle); - if(result.collided && (result.collisionTime < minResult.collisionTime)) + if (result.collided && (result.collisionTime < minResult.collisionTime)) { minResult = result; minObject = obstacle; @@ -2288,19 +2279,19 @@ bool CollisionWorld::findFirstObstacle ( Object const * creature, float creature ObjectVector::size_type const nCreatures = creatures.size(); - for(i = 0; i < nCreatures; i++) + for (i = 0; i < nCreatures; i++) { Object const * obstacle = creatures[i]; - if(obstacle == nullptr) continue; + if (obstacle == nullptr) continue; - if(obstacle == creature) continue; + if (obstacle == creature) continue; - if(Distance2d::Distance2(obstacle->getPosition_w(),goalPos) < 0.000001) continue; + if (Distance2d::Distance2(obstacle->getPosition_w(), goalPos) < 0.000001) continue; - DetectResult result = CollisionDetect::testObjects(creature,delta,obstacle); + DetectResult result = CollisionDetect::testObjects(creature, delta, obstacle); - if(result.collided && (result.collisionTime < minResult.collisionTime)) + if (result.collided && (result.collisionTime < minResult.collisionTime)) { minResult = result; minObject = obstacle; @@ -2323,7 +2314,7 @@ bool CollisionWorld::findFirstObstacle ( Object const * creature, float creature // We collided with a floor. Check if we collide with the floor sooner than anything else. bool useFloorCollision; - if(!minResult.collided) // don't return a floor as a collision object if nothing was collided with earlier + if (!minResult.collided) // don't return a floor as a collision object if nothing was collided with earlier { useFloorCollision = false; } @@ -2332,7 +2323,7 @@ bool CollisionWorld::findFirstObstacle ( Object const * creature, float creature // Figure out if collided object is closer than floor. Collided object looks like its // extent is assumed to be in the same parent space as creature. That might be a bug. float const minResultMagnitudeSquared = (creature->getPosition_p() - minResult.extentB->getCenter()).magnitudeSquared(); - float const floorMagnitudeSquared = (creature->getPosition_w() - collisionLocation_w).magnitudeSquared(); + float const floorMagnitudeSquared = (creature->getPosition_w() - collisionLocation_w).magnitudeSquared(); useFloorCollision = floorMagnitudeSquared < minResultMagnitudeSquared; } @@ -2346,7 +2337,7 @@ bool CollisionWorld::findFirstObstacle ( Object const * creature, float creature } } - if(minResult.collided) + if (minResult.collided) { outObject = minObject; @@ -2360,7 +2351,7 @@ bool CollisionWorld::findFirstObstacle ( Object const * creature, float creature // ---------------------------------------------------------------------- -bool CollisionWorld::findFirstObstacle ( Sphere const & sphere, Vector const & goalPos, bool testStatics, bool testCreatures, Object const * & outObject ) +bool CollisionWorld::findFirstObstacle(Sphere const & sphere, Vector const & goalPos, bool testStatics, bool testCreatures, Object const * & outObject) { Vector startPos = sphere.getCenter(); @@ -2380,20 +2371,20 @@ bool CollisionWorld::findFirstObstacle ( Sphere const & sphere, Vector const & g statics.clear(); creatures.clear(); - if(ms_database->queryObjects(CellProperty::getWorldCellProperty(), shape, delta, (testStatics ? &statics : nullptr), (testCreatures ? &creatures : nullptr))) + if (ms_database->queryObjects(CellProperty::getWorldCellProperty(), shape, delta, (testStatics ? &statics : nullptr), (testCreatures ? &creatures : nullptr))) { size_t const nStatics = statics.size(); size_t i; - for(i = 0; i < nStatics; i++) + for (i = 0; i < nStatics; i++) { Object const * obstacle = statics[i]; - if(obstacle == nullptr) continue; + if (obstacle == nullptr) continue; - DetectResult result = CollisionDetect::testSphereObject(sphere,delta,obstacle); + DetectResult result = CollisionDetect::testSphereObject(sphere, delta, obstacle); - if(result.collided && (result.collisionTime < minResult.collisionTime)) + if (result.collided && (result.collisionTime < minResult.collisionTime)) { minResult = result; minObject = obstacle; @@ -2402,17 +2393,17 @@ bool CollisionWorld::findFirstObstacle ( Sphere const & sphere, Vector const & g size_t const nCreatures = creatures.size(); - for(i = 0; i < nCreatures; i++) + for (i = 0; i < nCreatures; i++) { Object const * obstacle = creatures[i]; - if(obstacle == nullptr) continue; + if (obstacle == nullptr) continue; - if(Distance2d::Distance2(obstacle->getPosition_w(),goalPos) < 0.000001) continue; + if (Distance2d::Distance2(obstacle->getPosition_w(), goalPos) < 0.000001) continue; - DetectResult result = CollisionDetect::testSphereObject(sphere,delta,obstacle); + DetectResult result = CollisionDetect::testSphereObject(sphere, delta, obstacle); - if(result.collided && (result.collisionTime < minResult.collisionTime)) + if (result.collided && (result.collisionTime < minResult.collisionTime)) { minResult = result; minObject = obstacle; @@ -2420,7 +2411,7 @@ bool CollisionWorld::findFirstObstacle ( Sphere const & sphere, Vector const & g } } - if(minResult.collided) + if (minResult.collided) { outObject = minObject; @@ -2435,14 +2426,14 @@ bool CollisionWorld::findFirstObstacle ( Sphere const & sphere, Vector const & g // ---------------------------------------------------------------------- // Compute the radius of the largest sphere that can fit around the given point without hitting anything -bool CollisionWorld::calcBubble ( CellProperty const * cell, Vector const & point_p, float maxDistance, float & outRadius ) +bool CollisionWorld::calcBubble(CellProperty const * cell, Vector const & point_p, float maxDistance, float & outRadius) { - return calcBubble(cell,point_p,nullptr,maxDistance,outRadius); + return calcBubble(cell, point_p, nullptr, maxDistance, outRadius); } -bool CollisionWorld::calcBubble ( CellProperty const * cell, Vector const & point_p, Object const * ignoreObject, float maxDistance, float & outRadius ) +bool CollisionWorld::calcBubble(CellProperty const * cell, Vector const & point_p, Object const * ignoreObject, float maxDistance, float & outRadius) { - Vector point_w = CollisionUtils::transformToWorld(cell,point_p); + Vector point_w = CollisionUtils::transformToWorld(cell, point_p); float minDistance = maxDistance; @@ -2451,17 +2442,17 @@ bool CollisionWorld::calcBubble ( CellProperty const * cell, Vector const & poin results.clear(); - if(ms_database->queryCloseStatics(point_w,minDistance,&results)) + if (ms_database->queryCloseStatics(point_w, minDistance, &results)) { ObjectVec::size_type const count = results.size(); - for(ObjectVec::size_type i = 0; i < count; i++) + for (ObjectVec::size_type i = 0; i < count; i++) { Object const * object = results[i]; NOT_NULL(object); - if(object == ignoreObject) continue; + if (object == ignoreObject) continue; CollisionProperty const * collision = object->getCollisionProperty(); @@ -2469,9 +2460,9 @@ bool CollisionWorld::calcBubble ( CellProperty const * cell, Vector const & poin float distance = REAL_MAX; - if(collision->getDistance(point_w,minDistance,distance)) + if (collision->getDistance(point_w, minDistance, distance)) { - if(distance < minDistance) minDistance = distance; + if (distance < minDistance) minDistance = distance; } } } @@ -2484,25 +2475,25 @@ bool CollisionWorld::calcBubble ( CellProperty const * cell, Vector const & poin results.clear(); - if(ms_database->queryCloseFloors(point_w,minDistance,&results)) + if (ms_database->queryCloseFloors(point_w, minDistance, &results)) { FloorVec::size_type const count = results.size(); - for(FloorVec::size_type i = 0; i < count; i++) + for (FloorVec::size_type i = 0; i < count; i++) { Floor const * floor = results[i]; NOT_NULL(floor); - if(floor->getOwner() == ignoreObject) continue; + if (floor->getOwner() == ignoreObject) continue; float distance = REAL_MAX; FloorEdgeId dummyId; - if(floor->getDistanceUncrossable2d(point_w,minDistance,distance,dummyId)) + if (floor->getDistanceUncrossable2d(point_w, minDistance, distance, dummyId)) { - if(distance < minDistance) minDistance = distance; + if (distance < minDistance) minDistance = distance; } } } @@ -2510,26 +2501,26 @@ bool CollisionWorld::calcBubble ( CellProperty const * cell, Vector const & poin // ---------- - if(cell && (cell != CellProperty::getWorldCellProperty())) + if (cell && (cell != CellProperty::getWorldCellProperty())) { Floor const * floor = cell->getFloor(); - if(floor) + if (floor) { float distance = REAL_MAX; FloorEdgeId dummyId; - if(floor->getDistanceUncrossable2d(point_w,minDistance,distance,dummyId)) + if (floor->getDistanceUncrossable2d(point_w, minDistance, distance, dummyId)) { - if(distance < minDistance) minDistance = distance; + if (distance < minDistance) minDistance = distance; } } } // ---------- - if(minDistance < maxDistance) + if (minDistance < maxDistance) { outRadius = minDistance; return true; @@ -2542,27 +2533,27 @@ bool CollisionWorld::calcBubble ( CellProperty const * cell, Vector const & poin // ---------------------------------------------------------------------- -bool CollisionWorld::testClear ( CellProperty const * cell, Sphere const & sphere_p ) +bool CollisionWorld::testClear(CellProperty const * cell, Sphere const & sphere_p) { - bool hitStatic = ms_database->queryMaterial(cell,sphere_p,MT_Solid); + bool hitStatic = ms_database->queryMaterial(cell, sphere_p, MT_Solid); - if(hitStatic) return false; + if (hitStatic) return false; return true; } // ---------------------------------------------------------------------- -bool CollisionWorld::canMoveInSpace( Object const * object, Sphere const & sphere, Vector const & goalPos ) +bool CollisionWorld::canMoveInSpace(Object const * object, Sphere const & sphere, Vector const & goalPos) { Vector delta = goalPos - sphere.getCenter(); float collisionTime = 0.0f; - if(ms_database->queryMaterial(CellProperty::getWorldCellProperty(),sphere,delta,MT_Solid,false,false,object,collisionTime)) + if (ms_database->queryMaterial(CellProperty::getWorldCellProperty(), sphere, delta, MT_Solid, false, false, object, collisionTime)) { float epsilon = 0.05f / delta.magnitude(); - if(collisionTime > -epsilon) + if (collisionTime > -epsilon) { return false; } @@ -2573,20 +2564,20 @@ bool CollisionWorld::canMoveInSpace( Object const * object, Sphere const & spher // ---------------------------------------------------------------------- -bool CollisionWorld::findLocators ( CellProperty const * cell, Vector const & point, std::vector & outLocs ) +bool CollisionWorld::findLocators(CellProperty const * cell, Vector const & point, std::vector & outLocs) { outLocs.clear(); // ---------- // If the point is in a cell, its only locator is the one on the cell floor - if(cell && (cell != CellProperty::getWorldCellProperty())) + if (cell && (cell != CellProperty::getWorldCellProperty())) { Floor const * floor = cell->getFloor(); FloorLocator tempLoc; - if( floor && floor->dropTest(point,tempLoc) ) + if (floor && floor->dropTest(point, tempLoc)) { outLocs.push_back(tempLoc); @@ -2602,21 +2593,21 @@ bool CollisionWorld::findLocators ( CellProperty const * cell, Vector const & po // ---------- // Otherwise we need to find all object floors and see if the point falls on any of them - if(ms_database) + if (ms_database) { FloorVec floors; - Segment3d querySeg( point, point - (Vector::unitY * 10.0f) ); + Segment3d querySeg(point, point - (Vector::unitY * 10.0f)); - IGNORE_RETURN(ms_database->queryFloors(cell,querySeg,&floors)); + IGNORE_RETURN(ms_database->queryFloors(cell, querySeg, &floors)); - for(uint i = 0; i < floors.size(); i++) + for (uint i = 0; i < floors.size(); i++) { Floor * floor = floors[i]; FloorLocator tempLoc; - if(floor && floor->dropTest(point,tempLoc)) + if (floor && floor->dropTest(point, tempLoc)) { outLocs.push_back(tempLoc); } @@ -2631,29 +2622,29 @@ bool CollisionWorld::findLocators ( CellProperty const * cell, Vector const & po // This should work OK, but if the point drops onto multiple floors it will make a locator for only // the topmost floor -bool CollisionWorld::makeLocator ( CellProperty const * cell, Vector const & point, FloorLocator & outLoc ) +bool CollisionWorld::makeLocator(CellProperty const * cell, Vector const & point, FloorLocator & outLoc) { static FloorLocatorVec tempLocs; tempLocs.clear(); - if(findLocators(cell,point,tempLocs)) + if (findLocators(cell, point, tempLocs)) { float maxHeight = -REAL_MAX; int highestLoc = -1; - for(uint i = 0; i < tempLocs.size(); i++) + for (uint i = 0; i < tempLocs.size(); i++) { float height = tempLocs[i].getPosition_p().y; - if(height > maxHeight) + if (height > maxHeight) { maxHeight = height; highestLoc = static_cast(i); } } - if(highestLoc != -1) + if (highestLoc != -1) { outLoc = tempLocs[static_cast(highestLoc)]; return true; @@ -2673,12 +2664,12 @@ bool CollisionWorld::makeLocator ( CellProperty const * cell, Vector const & poi // ---------------------------------------------------------------------- -bool CollisionWorld::isServerSide ( void ) +bool CollisionWorld::isServerSide(void) { return ms_serverSide; } -void CollisionWorld::setServerSide ( bool serverSide ) +void CollisionWorld::setServerSide(bool serverSide) { ms_serverSide = serverSide; } @@ -2711,22 +2702,22 @@ Floor const * CollisionWorld::getFloorStandingOn(Object const & object) float resultDistanceBelowObject = 0.0f; float dropTestHeight = std::numeric_limits::min(); - for(MultiListConstDataIterator it(floorList); it; ++it) + for (MultiListConstDataIterator it(floorList); it; ++it) { FloorContactShape const * const contact = *it; FloorLocator const & loc = contact->m_contact; Floor const * const f = loc.getFloor(); FloorLocator tempLoc; - if(f->dropTest(object.getPosition_p(),tempLoc)) + if (f->dropTest(object.getPosition_p(), tempLoc)) { //if we might be standing on it (it's below us), give 1/2 meter buffer space - if((tempLoc.getPosition_w().y - 0.5) <= objectHeight) + if ((tempLoc.getPosition_w().y - 0.5) <= objectHeight) { float const distanceBelowObject = std::max(0.0f, objectHeight - tempLoc.getPosition_w().y); //if none found yet, use it - if(!resultFloor) + if (!resultFloor) { resultFloor = f; resultDistanceBelowObject = distanceBelowObject; @@ -2735,7 +2726,7 @@ Floor const * CollisionWorld::getFloorStandingOn(Object const & object) else { //if it's less below us than the current, use it - if(distanceBelowObject < resultDistanceBelowObject) + if (distanceBelowObject < resultDistanceBelowObject) { resultFloor = f; resultDistanceBelowObject = distanceBelowObject; @@ -2753,7 +2744,7 @@ Floor const * CollisionWorld::getFloorStandingOn(Object const & object) if (terrainObject != nullptr) { CellProperty const * const parentCell = object.getParentCell(); - + if (parentCell->isWorldCell()) { float terrainHeight; @@ -2785,4 +2776,4 @@ Floor const * CollisionWorld::getFloorStandingOn(Object const & object) return resultFloor; } -// ---------------------------------------------------------------------- +// ---------------------------------------------------------------------- \ No newline at end of file diff --git a/engine/shared/library/sharedCollision/src/shared/core/FloorMesh.cpp b/engine/shared/library/sharedCollision/src/shared/core/FloorMesh.cpp index ae508f4a..80c3cead 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/FloorMesh.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/FloorMesh.cpp @@ -69,33 +69,34 @@ float gs_hopTolerance = 0.3f; float gs_clearTolerance = 0.001f; float gs_hitPastTolerance = 0.2f; // how far (meters) in the past a hit can occur and still be considered a hit -const Tag TAG_VERT = TAG(V,E,R,T); -const Tag TAG_TRIS = TAG(T,R,I,S); -const Tag TAG_FLOR = TAG(F,L,O,R); -const Tag TAG_PNOD = TAG(P,N,O,D); -const Tag TAG_PEDG = TAG(P,E,D,G); -const Tag TAG_BTRE = TAG(B,T,R,E); -const Tag TAG_BEDG = TAG(B,E,D,G); -const Tag TAG_PGRF = TAG(P,G,R,F); +const Tag TAG_VERT = TAG(V, E, R, T); +const Tag TAG_TRIS = TAG(T, R, I, S); +const Tag TAG_FLOR = TAG(F, L, O, R); +const Tag TAG_PNOD = TAG(P, N, O, D); +const Tag TAG_PEDG = TAG(P, E, D, G); +const Tag TAG_BTRE = TAG(B, T, R, E); +const Tag TAG_BEDG = TAG(B, E, D, G); +const Tag TAG_PGRF = TAG(P, G, R, F); template <> FloorMeshList::CreateDataResourceMap *FloorMeshList::ms_bindings = nullptr; template <> FloorMeshList::LoadedDataResourceMap *FloorMeshList::ms_loaded = nullptr; // ---------------------------------------------------------------------- -FloorMesh::FloorMesh(const std::string & filename) -: CollisionMesh(), - DataResource(filename.c_str ()), - m_vertices( new VectorVector() ), - m_floorTris( new FloorTriVec() ), - m_crossableEdges( new FloorEdgeIdVec() ), - m_uncrossableEdges( new FloorEdgeIdVec() ), - m_wallBaseEdges( new FloorEdgeIdVec() ), - m_wallTopEdges( new FloorEdgeIdVec() ), - m_pathGraph(nullptr), - m_appearance(nullptr), - m_triMarkCounter(1000), // just some random number - m_objectFloor(false) +FloorMesh::FloorMesh(const std::string & filename) + : CollisionMesh(), + DataResource(filename.c_str()), + m_vertices(new VectorVector()), + m_floorTris(new FloorTriVec()), + m_crossableEdges(new FloorEdgeIdVec()), + m_uncrossableEdges(new FloorEdgeIdVec()), + m_wallBaseEdges(new FloorEdgeIdVec()), + m_wallTopEdges(new FloorEdgeIdVec()), + m_pathGraph(nullptr), + m_appearance(nullptr), + m_triMarkCounter(1000), // just some random number + m_objectFloor(false), + m_pathLines() { #ifdef _DEBUG @@ -112,21 +113,21 @@ FloorMesh::FloorMesh(const std::string & filename) // ---------- -FloorMesh::FloorMesh( VectorVector const & vertices, IntVector const & indices ) -: CollisionMesh(), - DataResource(""), - m_vertices( new VectorVector() ), - m_floorTris( new FloorTriVec() ), - m_crossableEdges( new FloorEdgeIdVec() ), - m_uncrossableEdges( new FloorEdgeIdVec() ), - m_wallBaseEdges( new FloorEdgeIdVec() ), - m_wallTopEdges( new FloorEdgeIdVec() ), - m_pathGraph(nullptr), - m_appearance(nullptr), - m_triMarkCounter(1000), - m_objectFloor(false) +FloorMesh::FloorMesh(VectorVector const & vertices, IntVector const & indices) + : CollisionMesh(), + DataResource(""), + m_vertices(new VectorVector()), + m_floorTris(new FloorTriVec()), + m_crossableEdges(new FloorEdgeIdVec()), + m_uncrossableEdges(new FloorEdgeIdVec()), + m_wallBaseEdges(new FloorEdgeIdVec()), + m_wallTopEdges(new FloorEdgeIdVec()), + m_pathGraph(nullptr), + m_appearance(nullptr), + m_triMarkCounter(1000), + m_objectFloor(false) { - build(vertices,indices); + build(vertices, indices); #ifdef _DEBUG @@ -196,25 +197,25 @@ FloorMesh::~FloorMesh() // ---------------------------------------------------------------------- -void FloorMesh::calcBounds ( void ) const +void FloorMesh::calcBounds(void) const { AxialBox bounds; - for(int i = 0; i < getVertexCount(); i++) + for (int i = 0; i < getVertexCount(); i++) { - bounds.add( getVertex(i) ); + bounds.add(getVertex(i)); } // ---------- // floor collision will catch when a player is over/under a floor // mesh - bounds.setMax( bounds.getMax() + Vector(0.0f,2.0f,0.0f) ); - bounds.setMin( bounds.getMin() - Vector(0.0f,1.0f,0.0f) ); + bounds.setMax(bounds.getMax() + Vector(0.0f, 2.0f, 0.0f)); + bounds.setMin(bounds.getMin() - Vector(0.0f, 1.0f, 0.0f)); // ---------- - if(m_appearance) + if (m_appearance) { Extent const * extent = m_appearance->getExtent(); @@ -222,7 +223,7 @@ void FloorMesh::calcBounds ( void ) const AxialBox const & box = boxExtent->getBox(); - if(boxExtent) + if (boxExtent) { bounds.add(box.getCorner(0)); bounds.add(box.getCorner(1)); @@ -233,7 +234,7 @@ void FloorMesh::calcBounds ( void ) const // ---------- - m_extent->setShape( MultiShape(bounds) ); + m_extent->setShape(MultiShape(bounds)); setBoundsDirty(false); } @@ -241,122 +242,122 @@ void FloorMesh::calcBounds ( void ) const // ====================================================================== // Basic interface inherited from CollisionMesh - accessors -int FloorMesh::getVertexCount ( void ) const +int FloorMesh::getVertexCount(void) const { return m_vertices->size(); } -Vector const & FloorMesh::getVertex ( int whichVertex ) const +Vector const & FloorMesh::getVertex(int whichVertex) const { return m_vertices->at(whichVertex); } -void FloorMesh::setVertex ( int whichVertex, Vector const & newPoint ) +void FloorMesh::setVertex(int whichVertex, Vector const & newPoint) { m_vertices->at(whichVertex) = newPoint; } // ---------- -int FloorMesh::getTriCount ( void ) const +int FloorMesh::getTriCount(void) const { return m_floorTris->size(); } -IndexedTri const & FloorMesh::getIndexedTri ( int whichTri ) const +IndexedTri const & FloorMesh::getIndexedTri(int whichTri) const { return m_floorTris->at(whichTri); } -void FloorMesh::setIndexedTri ( int whichTri, IndexedTri const & newTri ) +void FloorMesh::setIndexedTri(int whichTri, IndexedTri const & newTri) { IndexedTri & I = m_floorTris->at(whichTri); - + I = newTri; } // ---------- -Triangle3d FloorMesh::getTriangle ( int whichTri ) const +Triangle3d FloorMesh::getTriangle(int whichTri) const { FloorTri const & F = getFloorTri(whichTri); - Vector const & A = getVertex( F.getCornerIndex(0) ); - Vector const & B = getVertex( F.getCornerIndex(1) ); - Vector const & C = getVertex( F.getCornerIndex(2) ); + Vector const & A = getVertex(F.getCornerIndex(0)); + Vector const & B = getVertex(F.getCornerIndex(1)); + Vector const & C = getVertex(F.getCornerIndex(2)); - return Triangle3d(A,B,C); + return Triangle3d(A, B, C); } // ---------------------------------------------------------------------- -Transform const & FloorMesh::getTransform_o2p ( void ) const +Transform const & FloorMesh::getTransform_o2p(void) const { return Transform::identity; } // ---------------------------------------------------------------------- -void FloorMesh::addTriangle ( Triangle3d const & t ) +void FloorMesh::addTriangle(Triangle3d const & t) { - int index = static_cast( m_vertices->size() ); + int index = static_cast(m_vertices->size()); m_vertices->push_back(t.getCornerA()); m_vertices->push_back(t.getCornerB()); m_vertices->push_back(t.getCornerC()); - addTriangle( index + 0, index + 1, index + 2 ); + addTriangle(index + 0, index + 1, index + 2); } // ---------- -void FloorMesh::addTriangle ( int iA, int iB, int iC ) +void FloorMesh::addTriangle(int iA, int iB, int iC) { FloorTri F; - F.setCornerIndex( 0, iA ); - F.setCornerIndex( 1, iB ); - F.setCornerIndex( 2, iC ); - - F.setNeighborIndex( 0, -1 ); - F.setNeighborIndex( 1, -1 ); - F.setNeighborIndex( 2, -1 ); + F.setCornerIndex(0, iA); + F.setCornerIndex(1, iB); + F.setCornerIndex(2, iC); - Vector A = getVertex( iA ); - Vector B = getVertex( iB ); - Vector C = getVertex( iC ); + F.setNeighborIndex(0, -1); + F.setNeighborIndex(1, -1); + F.setNeighborIndex(2, -1); - Vector temp = (C-A).cross(B-A); - IGNORE_RETURN( temp.normalize() ); + Vector A = getVertex(iA); + Vector B = getVertex(iB); + Vector C = getVertex(iC); - F.setNormal( temp ); + Vector temp = (C - A).cross(B - A); + IGNORE_RETURN(temp.normalize()); - F.setIndex( static_cast( getTriCount() ) ); + F.setNormal(temp); + + F.setIndex(static_cast(getTriCount())); m_floorTris->push_back(F); } // ---------------------------------------------------------------------- -void FloorMesh::deleteVertex ( int whichVertex ) +void FloorMesh::deleteVertex(int whichVertex) { UNREF(whichVertex); - FATAL(true,("can't delete floor vertices yet...")); + FATAL(true, ("can't delete floor vertices yet...")); } -void FloorMesh::deleteVertices ( IntVector const & vertIndices ) +void FloorMesh::deleteVertices(IntVector const & vertIndices) { UNREF(vertIndices); - FATAL(true,("can't delete floor vertices yet...")); + FATAL(true, ("can't delete floor vertices yet...")); } // ---------------------------------------------------------------------- -void FloorMesh::deleteTri ( int whichTriangle ) +void FloorMesh::deleteTri(int whichTriangle) { - IGNORE_RETURN( m_floorTris->erase( m_floorTris->begin() + whichTriangle ) ); + IGNORE_RETURN(m_floorTris->erase(m_floorTris->begin() + whichTriangle)); //@todo - This really doesn't need to be called after every erase, // it ought to be called after all the erasing is done. @@ -367,9 +368,9 @@ void FloorMesh::deleteTri ( int whichTriangle ) // ---------- // Mark-n-sweep delete -void FloorMesh::deleteTris ( IntVector const & triIndices ) +void FloorMesh::deleteTris(IntVector const & triIndices) { - if(triIndices.empty()) return; + if (triIndices.empty()) return; // ---------- @@ -379,27 +380,27 @@ void FloorMesh::deleteTris ( IntVector const & triIndices ) int indexCount = triIndices.size(); - for(int iBad = 0; iBad < indexCount; iBad++) + for (int iBad = 0; iBad < indexCount; iBad++) { - getFloorTri( triIndices[iBad] ).setMark(1); + getFloorTri(triIndices[iBad]).setMark(1); } // ---------- FloorTriVec * pGoodTris = new FloorTriVec; - for(int iTri = 0; iTri < getTriCount(); iTri++) + for (int iTri = 0; iTri < getTriCount(); iTri++) { FloorTri const & F = getFloorTri(iTri); - if(F.getMark() != 1) + if (F.getMark() != 1) { pGoodTris->push_back(F); } } // ---------- - + FloorTriVec * pOldTris = m_floorTris; m_floorTris = pGoodTris; @@ -411,7 +412,7 @@ void FloorMesh::deleteTris ( IntVector const & triIndices ) // ---------------------------------------------------------------------- -void FloorMesh::clear ( void ) +void FloorMesh::clear(void) { CollisionMesh::clear(); @@ -426,56 +427,56 @@ void FloorMesh::clear ( void ) // ---------------------------------------------------------------------- -void FloorMesh::assignIndices ( void ) +void FloorMesh::assignIndices(void) { - for(int i = 0; i < getTriCount(); i++) + for (int i = 0; i < getTriCount(); i++) { - getFloorTri(i).setIndex( static_cast(i) ); + getFloorTri(i).setIndex(static_cast(i)); } } // ---------------------------------------------------------------------- -void FloorMesh::clearMarks ( int clearMarkValue ) +void FloorMesh::clearMarks(int clearMarkValue) { - for(int i = 0; i < getTriCount(); i++) + for (int i = 0; i < getTriCount(); i++) { FloorTri & F = getFloorTri(i); F.setMark(clearMarkValue); - F.setEdgeMark(0,clearMarkValue); - F.setEdgeMark(1,clearMarkValue); - F.setEdgeMark(2,clearMarkValue); + F.setEdgeMark(0, clearMarkValue); + F.setEdgeMark(1, clearMarkValue); + F.setEdgeMark(2, clearMarkValue); } } // ---------------------------------------------------------------------- -void FloorMesh::clearPortalEdges ( void ) +void FloorMesh::clearPortalEdges(void) { - for(int i = 0; i < getTriCount(); i++) + for (int i = 0; i < getTriCount(); i++) { FloorTri & F = getFloorTri(i); - F.setPortalId(0,-1); - F.setPortalId(1,-1); - F.setPortalId(2,-1); + F.setPortalId(0, -1); + F.setPortalId(1, -1); + F.setPortalId(2, -1); } } // ---------------------------------------------------------------------- -void FloorMesh::setAppearance ( Appearance const * appearance ) +void FloorMesh::setAppearance(Appearance const * appearance) { m_appearance = appearance; - if(m_appearance && m_extent) + if (m_appearance && m_extent) { Extent const * extent = appearance->getExtent(); BoxExtent const * boxExtent = dynamic_cast(extent); - if(boxExtent) + if (boxExtent) { AxialBox bounds = m_extent->getShape().getAxialBox(); @@ -486,14 +487,14 @@ void FloorMesh::setAppearance ( Appearance const * appearance ) bounds.add(box.getCorner(2)); bounds.add(box.getCorner(3)); - m_extent->setShape( MultiShape(bounds) ); + m_extent->setShape(MultiShape(bounds)); } } } // ---------------------------------------------------------------------- -void FloorMesh::build ( VectorVector const & verts, IntVector const & indices ) +void FloorMesh::build(VectorVector const & verts, IntVector const & indices) { (*m_vertices) = verts; m_floorTris->clear(); @@ -502,13 +503,13 @@ void FloorMesh::build ( VectorVector const & verts, IntVector const & indices ) int nTris = indices.size() / 3; - for(int i = 0; i < nTris; i++) + for (int i = 0; i < nTris; i++) { int A = indices[i * 3 + 0]; int B = indices[i * 3 + 1]; int C = indices[i * 3 + 2]; - addTriangle(A,B,C); + addTriangle(A, B, C); } } @@ -517,26 +518,26 @@ void FloorMesh::build ( VectorVector const & verts, IntVector const & indices ) //@todo - Uses brute-force search, may be slow for big meshes. -void FloorMesh::addCrossableEdges ( IntVector const & edgePairs ) +void FloorMesh::addCrossableEdges(IntVector const & edgePairs) { - for(int iTri = 0; iTri < getTriCount(); iTri++) + for (int iTri = 0; iTri < getTriCount(); iTri++) { FloorTri & F = getFloorTri(iTri); // ---------- - + int nPairs = edgePairs.size() / 2; - for(int iPair = 0; iPair < nPairs; iPair++) + for (int iPair = 0; iPair < nPairs; iPair++) { int A = edgePairs[iPair * 2 + 0]; int B = edgePairs[iPair * 2 + 1]; - int whichEdge = FindEdgeUndirected(F,A,B); + int whichEdge = FindEdgeUndirected(F, A, B); - if(whichEdge != -1) + if (whichEdge != -1) { - F.setEdgeType(whichEdge,FET_Crossable); + F.setEdgeType(whichEdge, FET_Crossable); } } } @@ -547,67 +548,67 @@ void FloorMesh::addCrossableEdges ( IntVector const & edgePairs ) //@todo - Uses brute-force search, may be slow for big meshes. -void FloorMesh::addRampEdges ( IntVector const & edgePairs ) +void FloorMesh::addRampEdges(IntVector const & edgePairs) { - for(int iTri = 0; iTri < getTriCount(); iTri++) + for (int iTri = 0; iTri < getTriCount(); iTri++) { FloorTri & F = getFloorTri(iTri); // ---------- - + int nPairs = edgePairs.size() / 2; - for(int iPair = 0; iPair < nPairs; iPair++) + for (int iPair = 0; iPair < nPairs; iPair++) { int A = edgePairs[iPair * 2 + 0]; int B = edgePairs[iPair * 2 + 1]; - int whichEdge = FindEdgeUndirected(F,A,B); + int whichEdge = FindEdgeUndirected(F, A, B); - if(whichEdge != -1) + if (whichEdge != -1) { - F.setEdgeType(whichEdge,FET_WallBase); + F.setEdgeType(whichEdge, FET_WallBase); } } } } // ---------------------------------------------------------------------- -// Flag the tris in the floor we want to be able to fall through as +// Flag the tris in the floor we want to be able to fall through as // fall-through-able -void FloorMesh::addFallthroughTris ( IntVector const & triIDs ) +void FloorMesh::addFallthroughTris(IntVector const & triIDs) { int idCount = triIDs.size(); - for(int iTri = 0; iTri < idCount; iTri++) + for (int iTri = 0; iTri < idCount; iTri++) { int index = triIDs[iTri]; - FloorTri & F = getFloorTri( index ); + FloorTri & F = getFloorTri(index); F.setFallthrough(true); } } // ---------------------------------------------------------------------- -// All edges of all floor tris start out unlinked and non-crossable. -// Once we've linked all the tris up, go through and flag any edges that +// All edges of all floor tris start out unlinked and non-crossable. +// Once we've linked all the tris up, go through and flag any edges that // now have neighbors as crossable. -void FloorMesh::flagCrossableEdges ( void ) +void FloorMesh::flagCrossableEdges(void) { - for(int iTri = 0; iTri < getTriCount(); iTri++) + for (int iTri = 0; iTri < getTriCount(); iTri++) { FloorTri & F = getFloorTri(iTri); // ---------- - - for(int iEdge = 0; iEdge < 3; iEdge++) + + for (int iEdge = 0; iEdge < 3; iEdge++) { - if(F.hasNeighbor(iEdge)) + if (F.hasNeighbor(iEdge)) { - F.setEdgeType(iEdge,FET_Crossable); + F.setEdgeType(iEdge, FET_Crossable); } } } @@ -615,55 +616,55 @@ void FloorMesh::flagCrossableEdges ( void ) // ---------------------------------------------------------------------- -FloorTri & FloorMesh::getFloorTri ( int whichTri ) +FloorTri & FloorMesh::getFloorTri(int whichTri) { FATAL(whichTri < 0, ("FloorMesh::getFloorTri - tried to get an invalid tri")); FATAL(whichTri >= getTriCount(), ("FloorMesh::getFloorTri - tried to get an invalid tri")); - return m_floorTris->at( whichTri ); + return m_floorTris->at(whichTri); } -FloorTri const & FloorMesh::getFloorTri ( int whichTri ) const +FloorTri const & FloorMesh::getFloorTri(int whichTri) const { FATAL(whichTri < 0, ("FloorMesh::getFloorTri - tried to get an invalid tri")); FATAL(whichTri >= getTriCount(), ("FloorMesh::getFloorTri - tried to get an invalid tri")); - return m_floorTris->at( whichTri ); + return m_floorTris->at(whichTri); } // ---------- -FloorEdgeIdVec const & FloorMesh::getEdgeList ( FloorEdgeType edgeType ) const +FloorEdgeIdVec const & FloorMesh::getEdgeList(FloorEdgeType edgeType) const { - switch(edgeType) + switch (edgeType) { case FET_Crossable: return *m_crossableEdges; case FET_Uncrossable: return *m_uncrossableEdges; case FET_WallBase: return *m_wallBaseEdges; case FET_WallTop: return *m_wallTopEdges; - default: { - DEBUG_FATAL(true,("FloorMesh::getEdgeList - requesting invalid list $d\n",edgeType)); - static FloorEdgeIdVec dummy; - return dummy; - } + default: { + DEBUG_FATAL(true, ("FloorMesh::getEdgeList - requesting invalid list $d\n", edgeType)); + static FloorEdgeIdVec dummy; + return dummy; + } } } // ---------------------------------------------------------------------- -BaseClass * FloorMesh::getPathGraph ( void ) +BaseClass * FloorMesh::getPathGraph(void) { return m_pathGraph; } -BaseClass const * FloorMesh::getPathGraph ( void ) const +BaseClass const * FloorMesh::getPathGraph(void) const { return m_pathGraph; } -void FloorMesh::attachPathGraph ( BaseClass * newGraph ) +void FloorMesh::attachPathGraph(BaseClass * newGraph) { - if(m_pathGraph != newGraph) + if (m_pathGraph != newGraph) { delete m_pathGraph; m_pathGraph = newGraph; @@ -674,7 +675,7 @@ void FloorMesh::attachPathGraph ( BaseClass * newGraph ) // Clean out any unused vertices and update the vertex indices in the // floor tris to match -void FloorMesh::sweep ( void ) +void FloorMesh::sweep(void) { int nVerts = getVertexCount(); int nTris = getTriCount(); @@ -682,9 +683,9 @@ void FloorMesh::sweep ( void ) // ---------- // Build our vertex reference count table - IntVector vertRefcount(nVerts,0); + IntVector vertRefcount(nVerts, 0); - for(int iTri = 0; iTri < nTris; iTri++) + for (int iTri = 0; iTri < nTris; iTri++) { IndexedTri const & tri = getIndexedTri(iTri); @@ -706,9 +707,9 @@ void FloorMesh::sweep ( void ) int nUsedVerts = 0; int cursor = 0; - for(int iRemap = 0; iRemap < nVerts; iRemap++) + for (int iRemap = 0; iRemap < nVerts; iRemap++) { - if(vertRefcount[iRemap] != 0) + if (vertRefcount[iRemap] != 0) { nUsedVerts++; @@ -725,36 +726,36 @@ void FloorMesh::sweep ( void ) // ---------- // Use the remap table to pack all vertex data at the beginning of the array - for(int iVert = 0; iVert < nVerts; iVert++) + for (int iVert = 0; iVert < nVerts; iVert++) { int newIndex = vertRemap[iVert]; // Skip unused vertices & vertices that aren't moving - if(newIndex == -1) continue; - if(newIndex == static_cast(iVert)) continue; + if (newIndex == -1) continue; + if (newIndex == static_cast(iVert)) continue; // Move the used vertices to their new place in the array - setVertex( newIndex, getVertex(iVert) ); + setVertex(newIndex, getVertex(iVert)); } // ---------- // Use the remap table to update the floor tri's vertex indices - for(int iTri2 = 0; iTri2 < nTris; iTri2++) + for (int iTri2 = 0; iTri2 < nTris; iTri2++) { IndexedTri temp = getIndexedTri(iTri2); - int iA = vertRemap[ temp.getCornerIndex(0) ]; - int iB = vertRemap[ temp.getCornerIndex(1) ]; - int iC = vertRemap[ temp.getCornerIndex(2) ]; + int iA = vertRemap[temp.getCornerIndex(0)]; + int iB = vertRemap[temp.getCornerIndex(1)]; + int iC = vertRemap[temp.getCornerIndex(2)]; - temp.setCornerIndex( 0, iA ); - temp.setCornerIndex( 1, iB ); - temp.setCornerIndex( 2, iC ); + temp.setCornerIndex(0, iA); + temp.setCornerIndex(1, iB); + temp.setCornerIndex(2, iC); - setIndexedTri( iTri2, temp ); + setIndexedTri(iTri2, temp); } // ---------- @@ -767,24 +768,24 @@ void FloorMesh::sweep ( void ) // Brute-force, ON^2 adjacency calc - try and link every tri with every // other tri -void FloorMesh::link ( void ) +void FloorMesh::link(void) { int nTris = getTriCount(); - for(int A = 0; A < nTris-1; A++) + for (int A = 0; A < nTris - 1; A++) { - for(int B = A+1; B < nTris; B++) + for (int B = A + 1; B < nTris; B++) { - LinkTris( getFloorTri(A), getFloorTri(B) ); + LinkTris(getFloorTri(A), getFloorTri(B)); } } } // ---------------------------------------------------------------------- -void FloorMesh::compile ( void ) +void FloorMesh::compile(void) { - IGNORE_RETURN( scrub() ); // get rid of any degenerate triangles + IGNORE_RETURN(scrub()); // get rid of any degenerate triangles merge(); // merge the vertices for the triangles sweep(); // sweep out any unused vertices link(); // build adjacency information for the triangles @@ -796,7 +797,7 @@ void FloorMesh::compile ( void ) // ---------------------------------------------------------------------- -void FloorMesh::write ( Iff & iff ) +void FloorMesh::write(Iff & iff) { iff.insertForm(TAG_FLOR); iff.insertForm(TAG_0006); @@ -811,7 +812,7 @@ void FloorMesh::write ( Iff & iff ) for (int i = 0; i < vertCount; i++) { - iff.insertChunkFloatVector( getVertex(i) ); + iff.insertChunkFloatVector(getVertex(i)); } } iff.exitChunk(TAG_VERT); @@ -833,14 +834,14 @@ void FloorMesh::write ( Iff & iff ) // ---------- - if(m_boxTree != nullptr) + if (m_boxTree != nullptr) { m_boxTree->write(iff); } // ---------- - if(!m_crossableEdges->empty() || !m_uncrossableEdges->empty() || !m_wallBaseEdges->empty()) + if (!m_crossableEdges->empty() || !m_uncrossableEdges->empty() || !m_wallBaseEdges->empty()) { iff.insertChunk(TAG_BEDG); { @@ -851,7 +852,7 @@ void FloorMesh::write ( Iff & iff ) { int edgeCount = m_crossableEdges->size(); - for(int i = 0; i < edgeCount; i++) + for (int i = 0; i < edgeCount; i++) { FloorEdgeId & id = m_crossableEdges->at(i); @@ -859,14 +860,14 @@ void FloorMesh::write ( Iff & iff ) iff.insertChunkData(id.triId); iff.insertChunkData(id.edgeId); - iff.insertChunkData(crossable); + iff.insertChunkData(crossable); } } { int edgeCount = m_uncrossableEdges->size(); - for(int i = 0; i < edgeCount; i++) + for (int i = 0; i < edgeCount; i++) { FloorEdgeId & id = m_uncrossableEdges->at(i); @@ -874,14 +875,14 @@ void FloorMesh::write ( Iff & iff ) iff.insertChunkData(id.triId); iff.insertChunkData(id.edgeId); - iff.insertChunkData(crossable); + iff.insertChunkData(crossable); } } - + { int edgeCount = m_wallBaseEdges->size(); - for(int i = 0; i < edgeCount; i++) + for (int i = 0; i < edgeCount; i++) { FloorEdgeId & id = m_wallBaseEdges->at(i); @@ -889,7 +890,7 @@ void FloorMesh::write ( Iff & iff ) iff.insertChunkData(id.triId); iff.insertChunkData(id.edgeId); - iff.insertChunkData(crossable); + iff.insertChunkData(crossable); } } } @@ -897,23 +898,23 @@ void FloorMesh::write ( Iff & iff ) } // ---------- - + ObjectWriter graphWriter = FloorManager::getPathGraphWriter(); - if(m_pathGraph && graphWriter) + if (m_pathGraph && graphWriter) { - graphWriter(m_pathGraph,iff); + graphWriter(m_pathGraph, iff); } // ---------- - + iff.exitForm(TAG_0006); iff.exitForm(TAG_FLOR); } // ---------------------------------------------------------------------- -void FloorMesh::read ( Iff & iff ) +void FloorMesh::read(Iff & iff) { clear(); @@ -925,45 +926,45 @@ void FloorMesh::read ( Iff & iff ) switch (iff.getCurrentName()) { - case TAG_0000: - version = 0; - read_0000(iff); - break; + case TAG_0000: + version = 0; + read_0000(iff); + break; - case TAG_0001: - version = 1; - read_0001(iff); - break; + case TAG_0001: + version = 1; + read_0001(iff); + break; - case TAG_0002: - version = 2; - read_0002(iff); - break; + case TAG_0002: + version = 2; + read_0002(iff); + break; - case TAG_0003: - version = 3; - read_0003(iff); - break; + case TAG_0003: + version = 3; + read_0003(iff); + break; - case TAG_0004: - version = 4; - read_0004(iff); - break; + case TAG_0004: + version = 4; + read_0004(iff); + break; - case TAG_0005: - version = 5; - read_0005(iff); - break; + case TAG_0005: + version = 5; + read_0005(iff); + break; - case TAG_0006: - version = 6; - read_0006(iff); - break; + case TAG_0006: + version = 6; + read_0006(iff); + break; - default: - version = -1; - FATAL(true,("FloorMesh::Invalid version")); - break; + default: + version = -1; + FATAL(true, ("FloorMesh::Invalid version")); + break; } iff.exitForm(TAG_FLOR); @@ -973,31 +974,31 @@ void FloorMesh::read ( Iff & iff ) // floor versions 6 and earlier calculate their floor tri normals upside down. fix that here. - if(version <= 6) + if (version <= 6) { int triCount = getTriCount(); - for(int i = 0; i < triCount; i++) + for (int i = 0; i < triCount; i++) { FloorTri & T = getFloorTri(i); - T.setNormal( -T.getNormal() ); + T.setNormal(-T.getNormal()); } } // Check for inverted floor tris - if(DataLint::isInstalled()) + if (DataLint::isInstalled()) { int triCount = getTriCount(); - for(int i = 0; i < triCount; i++) + for (int i = 0; i < triCount; i++) { FloorTri & T = getFloorTri(i); - if(T.getNormal().y <= 0.0f) + if (T.getNormal().y <= 0.0f) { - DEBUG_WARNING(true,("FloorMesh::read - Floor %s contains a triangle that's not facing up (art error) [%1.2f, %1.2f, %1.2f]",iff.getFileName(), T.getNormal().x, T.getNormal().y, T.getNormal().z)); + DEBUG_WARNING(true, ("FloorMesh::read - Floor %s contains a triangle that's not facing up (art error) [%1.2f, %1.2f, %1.2f]", iff.getFileName(), T.getNormal().x, T.getNormal().y, T.getNormal().z)); break; } } @@ -1007,11 +1008,11 @@ void FloorMesh::read ( Iff & iff ) calcHeightFuncs(); - if(version < 5) buildBoundaryEdgeList(); + if (version < 5) buildBoundaryEdgeList(); #ifdef _DEBUG - if(ConfigSharedCollision::getBuildDebugData()) + if (ConfigSharedCollision::getBuildDebugData()) { buildDebugData(); } @@ -1021,7 +1022,7 @@ void FloorMesh::read ( Iff & iff ) // ---------------------------------------------------------------------- -void FloorMesh::read_0000 ( Iff & iff ) +void FloorMesh::read_0000(Iff & iff) { iff.enterForm(TAG_0000); @@ -1029,7 +1030,7 @@ void FloorMesh::read_0000 ( Iff & iff ) iff.enterChunk(TAG_VERT); { - while(iff.getChunkLengthLeft()) + while (iff.getChunkLengthLeft()) { Vector V = iff.read_floatVector(); @@ -1042,27 +1043,27 @@ void FloorMesh::read_0000 ( Iff & iff ) iff.enterChunk(TAG_TRIS); { - while(iff.getChunkLengthLeft()) + while (iff.getChunkLengthLeft()) { FloorTri F; - F.setIndex( iff.read_int32() ); + F.setIndex(iff.read_int32()); - F.setCornerIndex( 0, iff.read_int32() ); - F.setCornerIndex( 1, iff.read_int32() ); - F.setCornerIndex( 2, iff.read_int32() ); + F.setCornerIndex(0, iff.read_int32()); + F.setCornerIndex(1, iff.read_int32()); + F.setCornerIndex(2, iff.read_int32()); - F.setNeighborIndex( 0, iff.read_int32() ); - F.setNeighborIndex( 1, iff.read_int32() ); - F.setNeighborIndex( 2, iff.read_int32() ); + F.setNeighborIndex(0, iff.read_int32()); + F.setNeighborIndex(1, iff.read_int32()); + F.setNeighborIndex(2, iff.read_int32()); - F.setNormal( iff.read_floatVector() ); + F.setNormal(iff.read_floatVector()); - F.setEdgeType( 0, FET_Uncrossable ); - F.setEdgeType( 1, FET_Uncrossable ); - F.setEdgeType( 2, FET_Uncrossable ); + F.setEdgeType(0, FET_Uncrossable); + F.setEdgeType(1, FET_Uncrossable); + F.setEdgeType(2, FET_Uncrossable); - F.setFallthrough( false ); + F.setFallthrough(false); m_floorTris->push_back(F); } @@ -1080,7 +1081,7 @@ void FloorMesh::read_0000 ( Iff & iff ) // ---------------------------------------------------------------------- -void FloorMesh::read_0001 ( Iff & iff ) +void FloorMesh::read_0001(Iff & iff) { iff.enterForm(TAG_0001); @@ -1088,7 +1089,7 @@ void FloorMesh::read_0001 ( Iff & iff ) iff.enterChunk(TAG_VERT); { - while(iff.getChunkLengthLeft()) + while (iff.getChunkLengthLeft()) { Vector V = iff.read_floatVector(); @@ -1101,27 +1102,27 @@ void FloorMesh::read_0001 ( Iff & iff ) iff.enterChunk(TAG_TRIS); { - while(iff.getChunkLengthLeft()) + while (iff.getChunkLengthLeft()) { FloorTri F; - F.setIndex( iff.read_int32() ); + F.setIndex(iff.read_int32()); - F.setCornerIndex( 0, iff.read_int32() ); - F.setCornerIndex( 1, iff.read_int32() ); - F.setCornerIndex( 2, iff.read_int32() ); + F.setCornerIndex(0, iff.read_int32()); + F.setCornerIndex(1, iff.read_int32()); + F.setCornerIndex(2, iff.read_int32()); - F.setNeighborIndex( 0, iff.read_int32() ); - F.setNeighborIndex( 1, iff.read_int32() ); - F.setNeighborIndex( 2, iff.read_int32() ); + F.setNeighborIndex(0, iff.read_int32()); + F.setNeighborIndex(1, iff.read_int32()); + F.setNeighborIndex(2, iff.read_int32()); - F.setNormal( iff.read_floatVector() ); + F.setNormal(iff.read_floatVector()); - F.setCrossable( 0, iff.read_bool8() ); - F.setCrossable( 1, iff.read_bool8() ); - F.setCrossable( 2, iff.read_bool8() ); + F.setCrossable(0, iff.read_bool8()); + F.setCrossable(1, iff.read_bool8()); + F.setCrossable(2, iff.read_bool8()); - F.setFallthrough( iff.read_bool8() ); + F.setFallthrough(iff.read_bool8()); m_floorTris->push_back(F); } @@ -1135,7 +1136,7 @@ void FloorMesh::read_0001 ( Iff & iff ) // ---------------------------------------------------------------------- -void FloorMesh::read_0002 ( Iff & iff ) +void FloorMesh::read_0002(Iff & iff) { iff.enterForm(TAG_0002); @@ -1143,7 +1144,7 @@ void FloorMesh::read_0002 ( Iff & iff ) iff.enterChunk(TAG_VERT); { - while(iff.getChunkLengthLeft()) + while (iff.getChunkLengthLeft()) { Vector V = iff.read_floatVector(); @@ -1156,7 +1157,7 @@ void FloorMesh::read_0002 ( Iff & iff ) iff.enterChunk(TAG_TRIS); { - while(iff.getChunkLengthLeft()) + while (iff.getChunkLengthLeft()) { FloorTri F; @@ -1168,13 +1169,13 @@ void FloorMesh::read_0002 ( Iff & iff ) iff.exitChunk(TAG_TRIS); // ---------- - + iff.exitForm(TAG_0002); } // ---------------------------------------------------------------------- -void FloorMesh::read_0003 ( Iff & iff ) +void FloorMesh::read_0003(Iff & iff) { iff.enterForm(TAG_0003); @@ -1182,46 +1183,7 @@ void FloorMesh::read_0003 ( Iff & iff ) iff.enterChunk(TAG_VERT); { - while(iff.getChunkLengthLeft()) - { - Vector V = iff.read_floatVector(); - - m_vertices->push_back(V); - } - } - iff.exitChunk(TAG_VERT); - - // ---------- - - iff.enterChunk(TAG_TRIS); - { - FloorTri F; - - while(iff.getChunkLengthLeft()) - { - F.read_0001(iff); - - m_floorTris->push_back(F); - } - } - iff.exitChunk(TAG_TRIS); - - // ---------- - - iff.exitForm(TAG_0003); -} - -// ---------------------------------------------------------------------- - -void FloorMesh::read_0004 ( Iff & iff ) -{ - iff.enterForm(TAG_0004); - - // ---------- - - iff.enterChunk(TAG_VERT); - { - while(iff.getChunkLengthLeft()) + while (iff.getChunkLengthLeft()) { Vector V = iff.read_floatVector(); @@ -1236,7 +1198,46 @@ void FloorMesh::read_0004 ( Iff & iff ) { FloorTri F; - while(iff.getChunkLengthLeft()) + while (iff.getChunkLengthLeft()) + { + F.read_0001(iff); + + m_floorTris->push_back(F); + } + } + iff.exitChunk(TAG_TRIS); + + // ---------- + + iff.exitForm(TAG_0003); +} + +// ---------------------------------------------------------------------- + +void FloorMesh::read_0004(Iff & iff) +{ + iff.enterForm(TAG_0004); + + // ---------- + + iff.enterChunk(TAG_VERT); + { + while (iff.getChunkLengthLeft()) + { + Vector V = iff.read_floatVector(); + + m_vertices->push_back(V); + } + } + iff.exitChunk(TAG_VERT); + + // ---------- + + iff.enterChunk(TAG_TRIS); + { + FloorTri F; + + while (iff.getChunkLengthLeft()) { F.read_0001(iff); @@ -1251,7 +1252,7 @@ void FloorMesh::read_0004 ( Iff & iff ) ObjectFactory pathGraphFactory = FloorManager::getPathGraphFactory(); - if(pathGraphFactory) + if (pathGraphFactory) { // The factory knows how to build a path graph from the old // data format. @@ -1262,24 +1263,24 @@ void FloorMesh::read_0004 ( Iff & iff ) } else { - // We have a path graph to load but no factory to load it + // We have a path graph to load but no factory to load it // with, so skip the form iff.enterChunk(TAG_PNOD); - iff.exitChunk(TAG_PNOD,true); + iff.exitChunk(TAG_PNOD, true); iff.enterChunk(TAG_PEDG); - iff.exitChunk(TAG_PEDG,true); + iff.exitChunk(TAG_PEDG, true); } // ---------- - + iff.exitForm(TAG_0004); } // ---------------------------------------------------------------------- -void FloorMesh::read_0005 ( Iff & iff ) +void FloorMesh::read_0005(Iff & iff) { iff.enterForm(TAG_0005); @@ -1292,7 +1293,7 @@ void FloorMesh::read_0005 ( Iff & iff ) m_vertices->clear(); m_vertices->reserve(vertexCount); - while(iff.getChunkLengthLeft()) + while (iff.getChunkLengthLeft()) { Vector V = iff.read_floatVector(); @@ -1312,7 +1313,7 @@ void FloorMesh::read_0005 ( Iff & iff ) FloorTri F; - while(iff.getChunkLengthLeft()) + while (iff.getChunkLengthLeft()) { F.read_0001(iff); @@ -1323,7 +1324,7 @@ void FloorMesh::read_0005 ( Iff & iff ) // ---------- - if(iff.getCurrentName() == TAG_BTRE) + if (iff.getCurrentName() == TAG_BTRE) { m_boxTree = new BoxTree(); @@ -1332,29 +1333,29 @@ void FloorMesh::read_0005 ( Iff & iff ) // ---------- - if(iff.getCurrentName() == TAG_BEDG) + if (iff.getCurrentName() == TAG_BEDG) { iff.enterChunk(TAG_BEDG); { int edgeCount = iff.read_int32(); - for(int i = 0; i < edgeCount; i++) + for (int i = 0; i < edgeCount; i++) { int triId = iff.read_int32(); int edgeId = iff.read_int32(); - FloorEdgeId id(triId,edgeId); + FloorEdgeId id(triId, edgeId); bool crossable = iff.read_bool8(); UNREF(crossable); // redundant now that we've got an edge type - switch(getFloorTri(id.triId).getEdgeType(id.edgeId)) + switch (getFloorTri(id.triId).getEdgeType(id.edgeId)) { - case FET_Crossable: { m_crossableEdges->push_back(id); break; } + case FET_Crossable: { m_crossableEdges->push_back(id); break; } case FET_Uncrossable: { m_uncrossableEdges->push_back(id); break; } - case FET_WallBase: { m_wallBaseEdges->push_back(id); break; } - default: { break; } + case FET_WallBase: { m_wallBaseEdges->push_back(id); break; } + default: { break; } } } } @@ -1367,7 +1368,7 @@ void FloorMesh::read_0005 ( Iff & iff ) { ObjectFactory pathGraphFactory = FloorManager::getPathGraphFactory(); - if(pathGraphFactory && CollisionWorld::isServerSide()) + if (pathGraphFactory && CollisionWorld::isServerSide()) { BaseClass * pathGraph = pathGraphFactory(iff); @@ -1375,22 +1376,22 @@ void FloorMesh::read_0005 ( Iff & iff ) } else { - // We have a path graph to load but no factory to load it + // We have a path graph to load but no factory to load it // with, so skip the form iff.enterForm(); iff.exitForm(true); } } - + // ---------- - + iff.exitForm(TAG_0005); } // ---------------------------------------------------------------------- -void FloorMesh::read_0006 ( Iff & iff ) +void FloorMesh::read_0006(Iff & iff) { iff.enterForm(TAG_0006); @@ -1403,7 +1404,7 @@ void FloorMesh::read_0006 ( Iff & iff ) m_vertices->clear(); m_vertices->reserve(vertexCount); - for(int i = 0; i < vertexCount; i++) + for (int i = 0; i < vertexCount; i++) { Vector V = iff.read_floatVector(); @@ -1423,7 +1424,7 @@ void FloorMesh::read_0006 ( Iff & iff ) FloorTri F; - for(int i = 0; i < triCount; i++) + for (int i = 0; i < triCount; i++) { F.read_0002(iff); @@ -1434,7 +1435,7 @@ void FloorMesh::read_0006 ( Iff & iff ) // ---------- - if(iff.getCurrentName() == TAG_BTRE) + if (iff.getCurrentName() == TAG_BTRE) { m_boxTree = new BoxTree(); @@ -1443,29 +1444,29 @@ void FloorMesh::read_0006 ( Iff & iff ) // ---------- - if(iff.getCurrentName() == TAG_BEDG) + if (iff.getCurrentName() == TAG_BEDG) { iff.enterChunk(TAG_BEDG); { int edgeCount = iff.read_int32(); - for(int i = 0; i < edgeCount; i++) + for (int i = 0; i < edgeCount; i++) { int triId = iff.read_int32(); int edgeId = iff.read_int32(); - FloorEdgeId id(triId,edgeId); + FloorEdgeId id(triId, edgeId); bool crossable = iff.read_bool8(); UNREF(crossable); // redundant now that we've got an edge type - switch(getFloorTri(id.triId).getEdgeType(id.edgeId)) + switch (getFloorTri(id.triId).getEdgeType(id.edgeId)) { - case FET_Crossable: { m_crossableEdges->push_back(id); break; } + case FET_Crossable: { m_crossableEdges->push_back(id); break; } case FET_Uncrossable: { m_uncrossableEdges->push_back(id); break; } - case FET_WallBase: { m_wallBaseEdges->push_back(id); break; } - default: { break; } + case FET_WallBase: { m_wallBaseEdges->push_back(id); break; } + default: { break; } } } } @@ -1478,7 +1479,7 @@ void FloorMesh::read_0006 ( Iff & iff ) { ObjectFactory pathGraphFactory = FloorManager::getPathGraphFactory(); - if(pathGraphFactory && CollisionWorld::isServerSide()) + if (pathGraphFactory && CollisionWorld::isServerSide()) { BaseClass * pathGraph = pathGraphFactory(iff); @@ -1486,68 +1487,66 @@ void FloorMesh::read_0006 ( Iff & iff ) } else { - // We have a path graph to load but no factory to load it + // We have a path graph to load but no factory to load it // with, so skip the form iff.enterForm(); iff.exitForm(true); } } - + // ---------- - + iff.exitForm(TAG_0006); } // ====================================================================== // DataResource implementation -void FloorMesh::load ( Iff & iff ) +void FloorMesh::load(Iff & iff) { read(iff); } // ---------- -Tag FloorMesh::getId ( void ) const +Tag FloorMesh::getId(void) const { return TAG_FLOR; } - // ---------------------------------------------------------------------- -FloorMesh * FloorMesh::create ( const std::string & filename ) +FloorMesh * FloorMesh::create(const std::string & filename) { return new FloorMesh(filename); } // ---------- -void FloorMesh::release ( void ) const +void FloorMesh::release(void) const { FloorMeshList::release(*this); } - // ---------------------------------------------------------------------- -void FloorMesh::install ( void ) +void FloorMesh::install(void) { - FloorMeshList::registerTemplate(TAG_FLOR,FloorMesh::create); + FloorMeshList::registerTemplate(TAG_FLOR, FloorMesh::create); } -void FloorMesh::remove ( void ) +void FloorMesh::remove(void) { FloorMeshList::remove(); } // ---------------------------------------------------------------------- -bool FloorMesh::findFloorTri ( FloorLocator const & testLoc, - float heightTolerance, - bool bAllowJump, - FloorLocator & outLoc ) const +bool FloorMesh::findFloorTri(FloorLocator const & testLoc, + float heightTolerance, + bool bAllowJump, + FloorLocator & outLoc) const { Vector testPoint = testLoc.getPosition_l(); @@ -1555,11 +1554,11 @@ bool FloorMesh::findFloorTri ( FloorLocator const & testLoc, // If the line through the test point doesn't intersect the floor's bounding box, // the point can't land on the floor - Line3d line(testPoint,-Vector::unitY); + Line3d line(testPoint, -Vector::unitY); - bool bHitsBounds = Overlap3d::TestLineABox( line, getBoundingABox() ); + bool bHitsBounds = Overlap3d::TestLineABox(line, getBoundingABox()); - if(!bHitsBounds) + if (!bHitsBounds) { outLoc = FloorLocator::invalid; return false; @@ -1570,11 +1569,11 @@ bool FloorMesh::findFloorTri ( FloorLocator const & testLoc, FloorLocator closest; - bool bFound = intersectClosest(line,closest); + bool bFound = intersectClosest(line, closest); // ---------- - if(!bFound || (closest.getId() == -1)) + if (!bFound || (closest.getId() == -1)) { outLoc = FloorLocator::invalid; return false; @@ -1584,7 +1583,7 @@ bool FloorMesh::findFloorTri ( FloorLocator const & testLoc, float dist = closest.getOffset(); - if(dist > heightTolerance) + if (dist > heightTolerance) { // Floor tri is too far below the test point @@ -1592,7 +1591,7 @@ bool FloorMesh::findFloorTri ( FloorLocator const & testLoc, return false; } - if(dist > 0.0f) + if (dist > 0.0f) { // Floor tri is below the test point, we don't need a jump // or hop to get on it @@ -1603,7 +1602,7 @@ bool FloorMesh::findFloorTri ( FloorLocator const & testLoc, // ---------- - if(bAllowJump) + if (bAllowJump) { // Floor tri is above the test point, but we dont' care // since we're allowing jumps @@ -1614,24 +1613,24 @@ bool FloorMesh::findFloorTri ( FloorLocator const & testLoc, // ---------- - if(std::abs(dist) < gs_hopTolerance) + if (std::abs(dist) < gs_hopTolerance) { // Floor tri is above the test point but within the hop // tolerance and we're allowing hops - we can hop up onto it. - DEBUG_REPORT_LOG_PRINT(ConfigSharedCollision::getReportMessages(),("FloorMesh::findFloorTri - Found triangle we can hop onto\n")); + DEBUG_REPORT_LOG_PRINT(ConfigSharedCollision::getReportMessages(), ("FloorMesh::findFloorTri - Found triangle we can hop onto\n")); outLoc = closest; return true; } // ---------- - if(getFloorTri( closest.getId() ).isFallthrough()) + if (getFloorTri(closest.getId()).isFallthrough()) { // Floor tri is above the test point, out of hop range, and we're not allowing jumps // BUT, since it's marked as fallthrough we can be on it anyway. - DEBUG_REPORT_LOG_PRINT(ConfigSharedCollision::getReportMessages(),("FloorMesh::findFloorTri - Found fallthrough triangle we can jump onto\n")); + DEBUG_REPORT_LOG_PRINT(ConfigSharedCollision::getReportMessages(), ("FloorMesh::findFloorTri - Found fallthrough triangle we can jump onto\n")); outLoc = closest; return true; } @@ -1645,16 +1644,16 @@ bool FloorMesh::findFloorTri ( FloorLocator const & testLoc, // ---------- -bool FloorMesh::findFloorTri ( FloorLocator const & testLoc, - bool bAllowJump, - FloorLocator & outLoc ) const +bool FloorMesh::findFloorTri(FloorLocator const & testLoc, + bool bAllowJump, + FloorLocator & outLoc) const { - return findFloorTri(testLoc,REAL_MAX,bAllowJump,outLoc); + return findFloorTri(testLoc, REAL_MAX, bAllowJump, outLoc); } // ---------------------------------------------------------------------- -void FloorMesh::makeHitResult ( Vector const & begin, Vector const & delta, int hitTriId, int hitEdgeId, float hitTime, FloorLocator & result ) const +void FloorMesh::makeHitResult(Vector const & begin, Vector const & delta, int hitTriId, int hitEdgeId, float hitTime, FloorLocator & result) const { Vector endPoint = begin + delta * hitTime; @@ -1666,11 +1665,11 @@ void FloorMesh::makeHitResult ( Vector const & begin, Vector const & delta, int // ---------- - result = FloorLocator(this,endPoint); + result = FloorLocator(this, endPoint); result.setTriId(hitTriId); result.setEdgeId(hitEdgeId); - + result.setHitTriId(hitTriId); result.setHitEdgeId(hitEdgeId); @@ -1682,13 +1681,13 @@ void FloorMesh::makeHitResult ( Vector const & begin, Vector const & delta, int // ---------- -void FloorMesh::makeHitResult2 ( Vector const & begin, Vector const & delta, int centerTriId, int hitTriId, int hitEdgeId, float hitTime, FloorLocator & result ) const +void FloorMesh::makeHitResult2(Vector const & begin, Vector const & delta, int centerTriId, int hitTriId, int hitEdgeId, float hitTime, FloorLocator & result) const { Segment3d edge = getTriangle(hitTriId).getEdgeSegment(hitEdgeId); Vector endPoint = begin + delta * hitTime; - Vector contactPoint = Distance2d::ClosestPointSeg(endPoint,edge); + Vector contactPoint = Distance2d::ClosestPointSeg(endPoint, edge); Vector contactNormal = endPoint - contactPoint; contactNormal.y = 0.0f; @@ -1697,7 +1696,7 @@ void FloorMesh::makeHitResult2 ( Vector const & begin, Vector const & delta, int // ---------- - result = FloorLocator(this,endPoint); + result = FloorLocator(this, endPoint); result.setTriId(centerTriId); result.setEdgeId(-1); @@ -1713,13 +1712,13 @@ void FloorMesh::makeHitResult2 ( Vector const & begin, Vector const & delta, int // ---------- -void FloorMesh::makeExitResult ( Vector const & begin, Vector const & delta, int hitTriId, int hitEdgeId, float hitTime, FloorLocator & result ) const +void FloorMesh::makeExitResult(Vector const & begin, Vector const & delta, int hitTriId, int hitEdgeId, float hitTime, FloorLocator & result) const { Segment3d edge = getTriangle(hitTriId).getEdgeSegment(hitEdgeId); Vector endPoint = begin + delta * hitTime; - Vector contactPoint = Distance2d::ClosestPointSeg(endPoint,edge); + Vector contactPoint = Distance2d::ClosestPointSeg(endPoint, edge); Vector contactNormal = endPoint - contactPoint; contactNormal.y = 0.0f; @@ -1728,7 +1727,7 @@ void FloorMesh::makeExitResult ( Vector const & begin, Vector const & delta, int // ---------- - result = FloorLocator(this,endPoint); + result = FloorLocator(this, endPoint); result.setTriId(hitTriId); result.setEdgeId(hitEdgeId); @@ -1744,7 +1743,7 @@ void FloorMesh::makeExitResult ( Vector const & begin, Vector const & delta, int // ---------- -void FloorMesh::makeSuccessResult ( FloorLocator const & loc, FloorLocator & result ) const +void FloorMesh::makeSuccessResult(FloorLocator const & loc, FloorLocator & result) const { result = loc; @@ -1754,7 +1753,7 @@ void FloorMesh::makeSuccessResult ( FloorLocator const & loc, FloorLocator & res // ---------- -void FloorMesh::makeFailureResult ( FloorLocator & result ) const +void FloorMesh::makeFailureResult(FloorLocator & result) const { result = FloorLocator::invalid; } @@ -1763,20 +1762,20 @@ void FloorMesh::makeFailureResult ( FloorLocator & result ) const // Triangles facing down cannot be entered // Crossable edges of fallthrough tris can be entered from anywhere -// uncrossable edges cannot be entered +// uncrossable edges cannot be entered // Crossable edges of non-fallthrough tris can be entered from above // Ramp edges can be entered from above -bool FloorMesh::canEnterEdge ( FloorLocator const & enterLoc ) const +bool FloorMesh::canEnterEdge(FloorLocator const & enterLoc) const { - if(enterLoc.getEdgeId() == -1) return false; - if(enterLoc.getTriId() == -1) return false; - if(enterLoc.getFloorMesh() == nullptr) return false; + if (enterLoc.getEdgeId() == -1) return false; + if (enterLoc.getTriId() == -1) return false; + if (enterLoc.getFloorMesh() == nullptr) return false; // Can't enter the tri if it's facing down - if(getTriangle(enterLoc.getTriId()).getNormal().y < 0.0f) + if (getTriangle(enterLoc.getTriId()).getNormal().y < 0.0f) { return false; } @@ -1787,13 +1786,13 @@ bool FloorMesh::canEnterEdge ( FloorLocator const & enterLoc ) const FloorEdgeType edgeType = F.getEdgeType(enterLoc.getEdgeId()); - if(edgeType == FET_Uncrossable) + if (edgeType == FET_Uncrossable) { return false; } - else if(edgeType == FET_Crossable) + else if (edgeType == FET_Crossable) { - if(F.isFallthrough()) + if (F.isFallthrough()) { return true; } @@ -1802,22 +1801,22 @@ bool FloorMesh::canEnterEdge ( FloorLocator const & enterLoc ) const return enterLoc.getOffset() >= -1.0f; } } - else if(edgeType == FET_WallBase) + else if (edgeType == FET_WallBase) { return enterLoc.getOffset() >= 0.0f; } else { - DEBUG_WARNING(true,("FloorMesh::canEnterEdge - bad edge type")); + DEBUG_WARNING(true, ("FloorMesh::canEnterEdge - bad edge type")); return false; } } -bool FloorMesh::canEnterEdge ( FloorLocator const & startLoc, Vector const & delta, FloorEdgeId const & id, bool useRadius ) const +bool FloorMesh::canEnterEdge(FloorLocator const & startLoc, Vector const & delta, FloorEdgeId const & id, bool useRadius) const { FloorLocator entryLoc; - if(intersectEdge(startLoc,delta,id,useRadius,false,entryLoc)) + if (intersectEdge(startLoc, delta, id, useRadius, false, entryLoc)) { return canEnterEdge(entryLoc); } @@ -1833,11 +1832,11 @@ bool FloorMesh::canEnterEdge ( FloorLocator const & startLoc, Vector const & del // Ramp edges can be exited only if doing so causes a valid reentrance -bool FloorMesh::canExitEdge ( FloorLocator const & exitLoc, Vector const & delta, bool useRadius ) const +bool FloorMesh::canExitEdge(FloorLocator const & exitLoc, Vector const & delta, bool useRadius) const { - if(exitLoc.getTriId() == -1) return false; - if(exitLoc.getEdgeId() == -1) return false; - if(exitLoc.getFloorMesh() == nullptr) return false; + if (exitLoc.getTriId() == -1) return false; + if (exitLoc.getEdgeId() == -1) return false; + if (exitLoc.getFloorMesh() == nullptr) return false; FloorEdgeType edgeType = exitLoc.getFloorTri().getEdgeType(exitLoc.getEdgeId()); @@ -1845,15 +1844,15 @@ bool FloorMesh::canExitEdge ( FloorLocator const & exitLoc, Vector const & delta UNREF(exitPos); - if(edgeType == FET_Uncrossable) + if (edgeType == FET_Uncrossable) { return false; } - else if(edgeType == FET_Crossable) + else if (edgeType == FET_Crossable) { return true; } - else if(edgeType == FET_WallBase) + else if (edgeType == FET_WallBase) { // Can only enter through a non-fallthrough tri if the path crosses over // the boundary @@ -1866,14 +1865,14 @@ bool FloorMesh::canExitEdge ( FloorLocator const & exitLoc, Vector const & delta Vector testDelta = delta; - if(testDelta.magnitudeSquared() > 0.01f) + if (testDelta.magnitudeSquared() > 0.01f) { testDelta.normalize(); testDelta *= 0.1f; } - if(findEntrance(exitLoc,testDelta,useRadius,entryLoc)) + if (findEntrance(exitLoc, testDelta, useRadius, entryLoc)) { Vector enterPos = entryLoc.getPosition_p(); @@ -1888,9 +1887,9 @@ bool FloorMesh::canExitEdge ( FloorLocator const & exitLoc, Vector const & delta Vector edgeDir = getTriangle(exitLoc.getTriId()).getEdgeDir(exitLoc.getEdgeId()); - Vector edgeNormal(edgeDir.z,0.0f,-edgeDir.x); + Vector edgeNormal(edgeDir.z, 0.0f, -edgeDir.x); - if(delta.dot(edgeNormal) > 0.0f) + if (delta.dot(edgeNormal) > 0.0f) { return true; } @@ -1902,7 +1901,7 @@ bool FloorMesh::canExitEdge ( FloorLocator const & exitLoc, Vector const & delta } else { - DEBUG_WARNING(true,("FloorMesh::canExitEdge - bad edge type")); + DEBUG_WARNING(true, ("FloorMesh::canExitEdge - bad edge type")); return false; } @@ -1910,18 +1909,18 @@ bool FloorMesh::canExitEdge ( FloorLocator const & exitLoc, Vector const & delta // ---------- -bool FloorMesh::canExitEdge ( FloorLocator const & startLoc, Vector const & delta, FloorEdgeId const & id, bool useRadius ) const +bool FloorMesh::canExitEdge(FloorLocator const & startLoc, Vector const & delta, FloorEdgeId const & id, bool useRadius) const { - if(id.triId == -1) return false; - if(id.edgeId == -1) return false; + if (id.triId == -1) return false; + if (id.edgeId == -1) return false; FloorEdgeType edgeType = getFloorTri(id.triId).getEdgeType(id.edgeId); - if(edgeType == FET_Uncrossable) + if (edgeType == FET_Uncrossable) { return false; } - else if(edgeType == FET_Crossable) + else if (edgeType == FET_Crossable) { return true; } @@ -1929,11 +1928,11 @@ bool FloorMesh::canExitEdge ( FloorLocator const & startLoc, Vector const & delt { FloorLocator exitLoc; - if(intersectEdge(startLoc,delta,id,useRadius,true,exitLoc)) + if (intersectEdge(startLoc, delta, id, useRadius, true, exitLoc)) { Vector newDelta = delta - (delta * exitLoc.getTime()); - return canExitEdge(exitLoc,newDelta,useRadius); + return canExitEdge(exitLoc, newDelta, useRadius); } else { @@ -1944,11 +1943,11 @@ bool FloorMesh::canExitEdge ( FloorLocator const & startLoc, Vector const & delt // ---------------------------------------------------------------------- -PathWalkResult FloorMesh::findStartingTri ( FloorLocator const & startLoc, Vector const & delta, bool useRadius, int & outTriId ) const +PathWalkResult FloorMesh::findStartingTri(FloorLocator const & startLoc, Vector const & delta, bool useRadius, int & outTriId) const { FloorLocator entryLoc; - if(findEntrance(startLoc,delta,useRadius,entryLoc)) + if (findEntrance(startLoc, delta, useRadius, entryLoc)) { outTriId = entryLoc.getId(); @@ -1962,7 +1961,7 @@ PathWalkResult FloorMesh::findStartingTri ( FloorLocator const & startLoc, Vecto // ---------------------------------------------------------------------- -bool FloorMesh::findClosestLocation ( FloorLocator const & testLoc, FloorLocator & result ) const +bool FloorMesh::findClosestLocation(FloorLocator const & testLoc, FloorLocator & result) const { Vector point = testLoc.getPosition_l(); @@ -1972,29 +1971,29 @@ bool FloorMesh::findClosestLocation ( FloorLocator const & testLoc, FloorLocator Vector minPoint = Vector::zero; int minId = -1; - for(int i = 0; i < getTriCount(); i++) + for (int i = 0; i < getTriCount(); i++) { Triangle3d T = getTriangle(i); - Vector triPoint = Distance3d::ClosestPointTri(point,T); + Vector triPoint = Distance3d::ClosestPointTri(point, T); real dist = (point - triPoint).magnitudeSquared(); - if(dist < minDist) + if (dist < minDist) { - if(T.getNormal().y < 0.0f) + if (T.getNormal().y < 0.0f) { // Triangle's facing down, skip it. continue; } - + minDist = dist; minPoint = triPoint; minId = i; } } - if(minId == -1) + if (minId == -1) { result = FloorLocator::invalid; @@ -2003,16 +2002,16 @@ bool FloorMesh::findClosestLocation ( FloorLocator const & testLoc, FloorLocator // ---------- - Vector scooted = Collision3d::MoveIntoTriangle(minPoint,getTriangle(minId),ConfigSharedCollision::getWallEpsilon()); + Vector scooted = Collision3d::MoveIntoTriangle(minPoint, getTriangle(minId), ConfigSharedCollision::getWallEpsilon()); - result = FloorLocator(this,scooted,minId,0.0f,0.0f); + result = FloorLocator(this, scooted, minId, 0.0f, 0.0f); return true; } // ---------------------------------------------------------------------- -bool FloorMesh::calcHitTime ( Segment3d const & moveSeg, int triId, int edgeId, float & outHitTime ) const +bool FloorMesh::calcHitTime(Segment3d const & moveSeg, int triId, int edgeId, float & outHitTime) const { Line3d moveLine = moveSeg.getLine(); @@ -2022,9 +2021,9 @@ bool FloorMesh::calcHitTime ( Segment3d const & moveSeg, int triId, int edgeId, float param; - bool hit = Intersect2d::IntersectLineSeg( moveLine, edge, hitTime, param ); + bool hit = Intersect2d::IntersectLineSeg(moveLine, edge, hitTime, param); - if(hit) + if (hit) { outHitTime = hitTime; @@ -2038,17 +2037,17 @@ bool FloorMesh::calcHitTime ( Segment3d const & moveSeg, int triId, int edgeId, // ---------------------------------------------------------------------- -bool FloorMesh::attach ( FloorLocator & loc ) const +bool FloorMesh::attach(FloorLocator & loc) const { - if(loc.getFloorMesh() != this) + if (loc.getFloorMesh() != this) { loc.setFloorMesh(this); FloorLocator tempLoc; - bool dropOK = dropTest(loc,tempLoc); + bool dropOK = dropTest(loc, tempLoc); - if(dropOK) loc = tempLoc; + if (dropOK) loc = tempLoc; return dropOK; } @@ -2060,14 +2059,14 @@ bool FloorMesh::attach ( FloorLocator & loc ) const // ---------------------------------------------------------------------- -PathWalkResult FloorMesh::pathWalkPoint ( FloorLocator const & startLoc, Vector const & delta, - int & outHitTriId, int & outHitEdge, float & outHitTime ) const +PathWalkResult FloorMesh::pathWalkPoint(FloorLocator const & startLoc, Vector const & delta, + int & outHitTriId, int & outHitEdge, float & outHitTime) const { Vector begin = startLoc.getPosition_l(); Vector end = begin + delta; - Segment3d pathSegment(begin,end); - Ribbon3d pathRibbon(pathSegment,-Vector::unitY); + Segment3d pathSegment(begin, end); + Ribbon3d pathRibbon(pathSegment, -Vector::unitY); outHitTriId = -1; outHitEdge = -1; @@ -2078,15 +2077,15 @@ PathWalkResult FloorMesh::pathWalkPoint ( FloorLocator const & startLoc, Vector int startTriId = startLoc.getId(); - if(startTriId == -1) + if (startTriId == -1) { - PathWalkResult entryResult = findStartingTri(startLoc,delta,false,startTriId); + PathWalkResult entryResult = findStartingTri(startLoc, delta, false, startTriId); - if(entryResult == PWR_DoesntEnter) + if (entryResult == PWR_DoesntEnter) { return PWR_DoesntEnter; } - else if(entryResult == PWR_CantEnter) + else if (entryResult == PWR_CantEnter) { return PWR_CantEnter; } @@ -2095,19 +2094,19 @@ PathWalkResult FloorMesh::pathWalkPoint ( FloorLocator const & startLoc, Vector { Triangle3d startTri = getTriangle(startTriId); - if( !Overlap2d::TestPointTri(begin,startTri) ) + if (!Overlap2d::TestPointTri(begin, startTri)) { - int enterTriEdge = Collision3d::TestEntranceTri(pathRibbon,startTri); + int enterTriEdge = Collision3d::TestEntranceTri(pathRibbon, startTri); - if(enterTriEdge == -1) + if (enterTriEdge == -1) { return PWR_DoesntEnter; } else { - FloorEdgeId id(startTriId,enterTriEdge); + FloorEdgeId id(startTriId, enterTriEdge); - if(!canEnterEdge(startLoc,delta,id,false)) + if (!canEnterEdge(startLoc, delta, id, false)) { return PWR_CantEnter; } @@ -2119,16 +2118,16 @@ PathWalkResult FloorMesh::pathWalkPoint ( FloorLocator const & startLoc, Vector int currentTriId = startTriId; - // trap for an infinite loop - fan + // trap for an infinite loop - fan int numIterations = 0; const int maxIterations = 100; - while(currentTriId != -1 && numIterations < maxIterations) + while (currentTriId != -1 && numIterations < maxIterations) { Triangle3d currentTri = getTriangle(currentTriId); - - if( Overlap2d::TestPointTri(end,currentTri) ) + + if (Overlap2d::TestPointTri(end, currentTri)) { outHitTriId = currentTriId; outHitEdge = -1; @@ -2140,8 +2139,8 @@ PathWalkResult FloorMesh::pathWalkPoint ( FloorLocator const & startLoc, Vector // ---------- int hitEdgeId = Collision3d::TestExitTri(pathRibbon, currentTri); - - if(hitEdgeId == -1) + + if (hitEdgeId == -1) { outHitTriId = currentTriId; outHitEdge = -1; @@ -2152,9 +2151,9 @@ PathWalkResult FloorMesh::pathWalkPoint ( FloorLocator const & startLoc, Vector float tempHitTime = 0.0f; - bool calcHitOK = calcHitTime( pathSegment, currentTriId, hitEdgeId, tempHitTime ); + bool calcHitOK = calcHitTime(pathSegment, currentTriId, hitEdgeId, tempHitTime); - if(!calcHitOK) + if (!calcHitOK) { FLOOR_WARNING("FloorMesh::pathWalkPoint - Couldn't calc exit time"); @@ -2162,15 +2161,15 @@ PathWalkResult FloorMesh::pathWalkPoint ( FloorLocator const & startLoc, Vector } else { - FloorEdgeId id(currentTriId,hitEdgeId); + FloorEdgeId id(currentTriId, hitEdgeId); - if(!canExitEdge(startLoc,delta,id,false)) + if (!canExitEdge(startLoc, delta, id, false)) { Vector contactDelta = delta * tempHitTime; float contactDist = contactDelta.magnitude(); - if(contactDist <= wallEpsilon) + if (contactDist <= wallEpsilon) { // The starting point is extremely close to the contact point, close enough that // the starting point can be considered to be in contact with its hit edge @@ -2196,13 +2195,13 @@ PathWalkResult FloorMesh::pathWalkPoint ( FloorLocator const & startLoc, Vector int neighborTriId = getFloorTri(currentTriId).getNeighborIndex(hitEdgeId); - if(neighborTriId == -1) + if (neighborTriId == -1) { float tempHitTime(0); - bool calcHitOK = calcHitTime( pathSegment, currentTriId, hitEdgeId, tempHitTime ); + bool calcHitOK = calcHitTime(pathSegment, currentTriId, hitEdgeId, tempHitTime); - if(!calcHitOK) + if (!calcHitOK) { FLOOR_WARNING("FloorMesh::pathWalkPoint - Couldn't calc exit time"); @@ -2214,7 +2213,7 @@ PathWalkResult FloorMesh::pathWalkPoint ( FloorLocator const & startLoc, Vector int portalId = floorTri.getPortalId(hitEdgeId); - if(portalId == -1) + if (portalId == -1) { outHitTriId = currentTriId; outHitEdge = hitEdgeId; @@ -2233,7 +2232,7 @@ PathWalkResult FloorMesh::pathWalkPoint ( FloorLocator const & startLoc, Vector } } - if(neighborTriId == currentTriId) + if (neighborTriId == currentTriId) { outHitTriId = currentTriId; outHitEdge = hitEdgeId; @@ -2242,7 +2241,6 @@ PathWalkResult FloorMesh::pathWalkPoint ( FloorLocator const & startLoc, Vector return PWR_WalkFailed; } - // ---------- // Path didn't clip against this tri, step to the adjacent tri @@ -2251,7 +2249,7 @@ PathWalkResult FloorMesh::pathWalkPoint ( FloorLocator const & startLoc, Vector } // Should never get here, but... - if(numIterations >= maxIterations) + if (numIterations >= maxIterations) FLOOR_WARNING("FloorMesh::pathWalkPoint - numInterations exceeded maxInterations"); else FLOOR_WARNING("FloorMesh::pathWalkPoint - couldn't find a neighbortTriId"); @@ -2265,11 +2263,11 @@ PathWalkResult FloorMesh::pathWalkPoint ( FloorLocator const & startLoc, Vector // ---------------------------------------------------------------------- -void FloorMesh::setPartTags ( void ) +void FloorMesh::setPartTags(void) { FloorTriStack unprocessed; - for(int i = 0; i < getTriCount(); i++) + for (int i = 0; i < getTriCount(); i++) { FloorTri * tri = &getFloorTri(i); @@ -2282,21 +2280,21 @@ void FloorMesh::setPartTags ( void ) int currentTag = 0; - while(!unprocessed.empty()) + while (!unprocessed.empty()) { FloorTri * currentTri = unprocessed.top(); unprocessed.pop(); - if(currentTri->getPartTag() != -1) continue; + if (currentTri->getPartTag() != -1) continue; processing.push(currentTri); - while(!processing.empty()) + while (!processing.empty()) { FloorTri * tri = processing.top(); processing.pop(); - if(tri->getPartTag() != -1) continue; + if (tri->getPartTag() != -1) continue; tri->setPartTag(currentTag); @@ -2304,9 +2302,9 @@ void FloorMesh::setPartTags ( void ) int neighborB = tri->getNeighborIndex(1); int neighborC = tri->getNeighborIndex(2); - if(neighborA != -1) processing.push(&getFloorTri( neighborA) ); - if(neighborB != -1) processing.push(&getFloorTri( neighborB) ); - if(neighborC != -1) processing.push(&getFloorTri( neighborC) ); + if (neighborA != -1) processing.push(&getFloorTri(neighborA)); + if (neighborB != -1) processing.push(&getFloorTri(neighborB)); + if (neighborC != -1) processing.push(&getFloorTri(neighborC)); } currentTag++; @@ -2315,15 +2313,15 @@ void FloorMesh::setPartTags ( void ) // ---------- -int FloorMesh::getPartCount ( void ) const +int FloorMesh::getPartCount(void) const { int temp = 0; - for(int i = 0; i < getTriCount(); i++) + for (int i = 0; i < getTriCount(); i++) { int tag = getFloorTri(i).getPartTag(); - if(tag > temp) temp = tag; + if (tag > temp) temp = tag; } return temp + 1; @@ -2332,11 +2330,11 @@ int FloorMesh::getPartCount ( void ) const // ---------------------------------------------------------------------- // compute the height functions for each tri in the floor -void FloorMesh::calcHeightFuncs ( void ) +void FloorMesh::calcHeightFuncs(void) { int triCount = getTriCount(); - for(int i = 0; i < triCount; i++) + for (int i = 0; i < triCount; i++) { FloorTri & T = getFloorTri(i); @@ -2344,15 +2342,15 @@ void FloorMesh::calcHeightFuncs ( void ) Vector N = T.getNormal(); - if(N.y == 0.0f) continue; + if (N.y == 0.0f) continue; float da = A.dot(N); - float dydx = -(N.x/N.y); - float dydz = -(N.z/N.y); - float c = (da/N.y); + float dydx = -(N.x / N.y); + float dydz = -(N.z / N.y); + float c = (da / N.y); - Vector heightFunc(dydx,c,dydz); + Vector heightFunc(dydx, c, dydz); T.setHeightFunc(heightFunc); } @@ -2363,26 +2361,26 @@ void FloorMesh::calcHeightFuncs ( void ) // floor mesh adjacent to the portal as being connected to it. Returns // true if the portal was matched to any edge of the floor -bool FloorMesh::matchSegmentToPoly ( Vector const & a, Vector const & b, VectorVector const & polyVerts ) +bool FloorMesh::matchSegmentToPoly(Vector const & a, Vector const & b, VectorVector const & polyVerts) { - Plane3d polyPlane( polyVerts[0], polyVerts[1], polyVerts[2] ); + Plane3d polyPlane(polyVerts[0], polyVerts[1], polyVerts[2]); // ---------- // Test 1 - Match the segment to the poly if it projects onto the interior // of the poly and is less than 10 centimeters away from the poly's plane. //ClosestPointPlane can't handle a zero length normal vector - if(polyPlane.getNormal().magnitudeSquared() > Vector::NORMALIZE_THRESHOLD) + if (polyPlane.getNormal().magnitudeSquared() > Vector::NORMALIZE_THRESHOLD) { - Vector a2 = Distance3d::ClosestPointPlane(a,polyPlane); - Vector b2 = Distance3d::ClosestPointPlane(b,polyPlane); + Vector a2 = Distance3d::ClosestPointPlane(a, polyPlane); + Vector b2 = Distance3d::ClosestPointPlane(b, polyPlane); - if(a2.inPolygon(polyVerts) && b2.inPolygon(polyVerts)) + if (a2.inPolygon(polyVerts) && b2.inPolygon(polyVerts)) { real distA = (a2 - a).magnitude(); real distB = (b2 - b).magnitude(); - if((distA < 0.1f) && (distB < 0.1f)) return true; + if ((distA < 0.1f) && (distB < 0.1f)) return true; } } @@ -2392,15 +2390,15 @@ bool FloorMesh::matchSegmentToPoly ( Vector const & a, Vector const & b, VectorV int vertCount = polyVerts.size(); - for(int i = 0; i < vertCount; i++) + for (int i = 0; i < vertCount; i++) { - Vector pa = polyVerts[i + 0]; + Vector pa = polyVerts[i + 0]; Vector pb = polyVerts[(i + 1) % vertCount]; - Segment3d S(pa,pb); + Segment3d S(pa, pb); - Vector a2 = Distance3d::ClosestPointSeg(a,S); - Vector b2 = Distance3d::ClosestPointSeg(b,S); + Vector a2 = Distance3d::ClosestPointSeg(a, S); + Vector b2 = Distance3d::ClosestPointSeg(b, S); // See if the distance between the verts is less than 5 centimeters for // both ends @@ -2408,7 +2406,7 @@ bool FloorMesh::matchSegmentToPoly ( Vector const & a, Vector const & b, VectorV real distA = (a2 - a).magnitude(); real distB = (b2 - b).magnitude(); - if((distA < 0.05f) && (distB < 0.05f)) return true; + if ((distA < 0.05f) && (distB < 0.05f)) return true; } // ---------- @@ -2416,13 +2414,13 @@ bool FloorMesh::matchSegmentToPoly ( Vector const & a, Vector const & b, VectorV // to the poly { - Vector a2 = Distance3d::ClosestPointPoly(a,polyVerts); - Vector b2 = Distance3d::ClosestPointPoly(b,polyVerts); + Vector a2 = Distance3d::ClosestPointPoly(a, polyVerts); + Vector b2 = Distance3d::ClosestPointPoly(b, polyVerts); real distA = (a2 - a).magnitude(); real distB = (b2 - b).magnitude(); - if((distA < 0.01f) && (distB < 0.01f)) return true; + if ((distA < 0.01f) && (distB < 0.01f)) return true; } return false; @@ -2430,20 +2428,20 @@ bool FloorMesh::matchSegmentToPoly ( Vector const & a, Vector const & b, VectorV // ---------------------------------------------------------------------- -void FloorMesh::findAdjacentBoundaryEdges ( VectorVector const & polyVerts, EdgeIdVec & outIds ) const +void FloorMesh::findAdjacentBoundaryEdges(VectorVector const & polyVerts, EdgeIdVec & outIds) const { - if(polyVerts.size() < 3) return; + if (polyVerts.size() < 3) return; - for(int currentTri = 0; currentTri < getTriCount(); currentTri++ ) + for (int currentTri = 0; currentTri < getTriCount(); currentTri++) { FloorTri const & F = getFloorTri(currentTri); Triangle3d T = getTriangle(currentTri); - for(int currentEdge = 0; currentEdge < 3; currentEdge++ ) + for (int currentEdge = 0; currentEdge < 3; currentEdge++) { // don't try and match internal edges - if(F.getNeighborIndex(currentEdge) != -1) + if (F.getNeighborIndex(currentEdge) != -1) { continue; } @@ -2451,9 +2449,9 @@ void FloorMesh::findAdjacentBoundaryEdges ( VectorVector const & polyVerts, Edge Vector a = T.getCorner(currentEdge); Vector b = T.getCorner(currentEdge + 1); - if(matchSegmentToPoly(a,b,polyVerts)) + if (matchSegmentToPoly(a, b, polyVerts)) { - outIds.push_back( EdgeId(currentTri,currentEdge) ); + outIds.push_back(EdgeId(currentTri, currentEdge)); } } } @@ -2461,19 +2459,19 @@ void FloorMesh::findAdjacentBoundaryEdges ( VectorVector const & polyVerts, Edge // ---------------------------------------------------------------------- -bool FloorMesh::flagPortalEdges( VectorVector const & portalVerts, int portalId ) +bool FloorMesh::flagPortalEdges(VectorVector const & portalVerts, int portalId) { EdgeIdVec tempIds; - findAdjacentBoundaryEdges(portalVerts,tempIds); + findAdjacentBoundaryEdges(portalVerts, tempIds); int idCount = tempIds.size(); - for(int i = 0; i < idCount; i++) + for (int i = 0; i < idCount; i++) { EdgeId const & id = tempIds[i]; - getFloorTri(id.first).setPortalId( id.second, portalId ); + getFloorTri(id.first).setPortalId(id.second, portalId); } return !tempIds.empty(); @@ -2481,16 +2479,16 @@ bool FloorMesh::flagPortalEdges( VectorVector const & portalVerts, int portalId // ---------------------------------------------------------------------- -bool FloorMesh::validate ( FloorLocator const & loc ) const +bool FloorMesh::validate(FloorLocator const & loc) const { - if(loc.getId() == -1) + if (loc.getId() == -1) { return true; } FloorLocator temp; - if( !testIntersect( Line3d(loc.getPosition_l(),-Vector::unitY), loc.getId(), temp) ) + if (!testIntersect(Line3d(loc.getPosition_l(), -Vector::unitY), loc.getId(), temp)) { FLOOR_WARNING("FloorMesh::validate - Validate locator failed"); return false; @@ -2503,11 +2501,11 @@ bool FloorMesh::validate ( FloorLocator const & loc ) const // ---------------------------------------------------------------------- -PathWalkResult FloorMesh::pathWalkCircle ( FloorLocator const & startLoc, - Vector const & delta, - int ignoreTriId, - int ignoreEdge, - FloorLocator & result ) const +PathWalkResult FloorMesh::pathWalkCircle(FloorLocator const & startLoc, + Vector const & delta, + int ignoreTriId, + int ignoreEdge, + FloorLocator & result) const { float radius = startLoc.getRadius(); @@ -2521,28 +2519,28 @@ PathWalkResult FloorMesh::pathWalkCircle ( FloorLocator const & startLoc, int hitEdgeId = -1; int centerTriId = -1; - PathWalkResult walkResult = pathWalkCircleGetIds( startLoc, delta, ignoreTriId, ignoreEdge, hitTime, hitId, hitEdgeId, centerTriId ); + PathWalkResult walkResult = pathWalkCircleGetIds(startLoc, delta, ignoreTriId, ignoreEdge, hitTime, hitId, hitEdgeId, centerTriId); // ---------- // use the results to build a FloorLocator - if(walkResult == PWR_DoesntEnter) + if (walkResult == PWR_DoesntEnter) { - FloorLocator endLoc(this,begin+delta,-1,0.0f,radius); + FloorLocator endLoc(this, begin + delta, -1, 0.0f, radius); - makeSuccessResult(endLoc,result); + makeSuccessResult(endLoc, result); return walkResult; } - else if(walkResult == PWR_HitBeforeEnter) + else if (walkResult == PWR_HitBeforeEnter) { - makeHitResult2( begin, delta, centerTriId, hitId, hitEdgeId, hitTime, result ); + makeHitResult2(begin, delta, centerTriId, hitId, hitEdgeId, hitTime, result); result.setRadius(radius); return walkResult; } - else if((walkResult == PWR_MissedStartTri) || (walkResult == PWR_CantEnter) || (walkResult == PWR_StartLocInvalid) || (walkResult == PWR_WalkFailed) || (walkResult == PWR_HitPast)) + else if ((walkResult == PWR_MissedStartTri) || (walkResult == PWR_CantEnter) || (walkResult == PWR_StartLocInvalid) || (walkResult == PWR_WalkFailed) || (walkResult == PWR_HitPast)) { makeFailureResult(result); @@ -2550,46 +2548,46 @@ PathWalkResult FloorMesh::pathWalkCircle ( FloorLocator const & startLoc, return walkResult; } - else if((walkResult == PWR_HitEdge) || (walkResult == PWR_InContact)) + else if ((walkResult == PWR_HitEdge) || (walkResult == PWR_InContact)) { - makeHitResult2( begin, delta, centerTriId, hitId, hitEdgeId, hitTime, result ); + makeHitResult2(begin, delta, centerTriId, hitId, hitEdgeId, hitTime, result); result.setRadius(radius); return walkResult; } - else if((walkResult == PWR_CenterHitEdge) || (walkResult == PWR_CenterInContact)) + else if ((walkResult == PWR_CenterHitEdge) || (walkResult == PWR_CenterInContact)) { - makeHitResult( begin, delta, hitId, hitEdgeId, hitTime, result ); + makeHitResult(begin, delta, hitId, hitEdgeId, hitTime, result); result.setRadius(radius); return walkResult; } - else if(walkResult == PWR_ExitedMesh) + else if (walkResult == PWR_ExitedMesh) { - makeExitResult( begin, delta, hitId, hitEdgeId, hitTime, result ); + makeExitResult(begin, delta, hitId, hitEdgeId, hitTime, result); result.setRadius(radius); return walkResult; } - else if(walkResult == PWR_HitPortalEdge) + else if (walkResult == PWR_HitPortalEdge) { - makeExitResult( begin, delta, hitId, hitEdgeId, hitTime, result ); + makeExitResult(begin, delta, hitId, hitEdgeId, hitTime, result); result.setRadius(radius); return walkResult; } - else if(walkResult == PWR_WalkOk) + else if (walkResult == PWR_WalkOk) { - Line3d endLine(begin+delta,-Vector::unitY); + Line3d endLine(begin + delta, -Vector::unitY); FloorLocator dropLoc; - if(centerTriId != -1) + if (centerTriId != -1) { - if(!testIntersect(endLine, centerTriId, dropLoc)) + if (!testIntersect(endLine, centerTriId, dropLoc)) { FLOOR_WARNING("FloorMesh::pathWalkCircle - Walk was OK, but end point isn't in the end triangle"); @@ -2603,7 +2601,7 @@ PathWalkResult FloorMesh::pathWalkCircle ( FloorLocator const & startLoc, dropLoc.setRadius(radius); - makeSuccessResult(dropLoc,result); + makeSuccessResult(dropLoc, result); return walkResult; } @@ -2635,20 +2633,20 @@ PathWalkResult FloorMesh::pathWalkCircle ( FloorLocator const & startLoc, struct EdgeQueueEntry { - EdgeQueueEntry( int id, float time ) - : triId(id), hitTime(time) + EdgeQueueEntry(int id, float time) + : triId(id), hitTime(time) { } // This compare returns A.hitTime > B.hitTime so that the queue // will be ordered earliest-to-latest - static bool compare ( EdgeQueueEntry const & A, EdgeQueueEntry const & B ) + static bool compare(EdgeQueueEntry const & A, EdgeQueueEntry const & B) { return A.hitTime > B.hitTime; } - bool operator < ( EdgeQueueEntry const & A ) const + bool operator < (EdgeQueueEntry const & A) const { return hitTime > A.hitTime; } @@ -2658,22 +2656,22 @@ struct EdgeQueueEntry }; typedef std::priority_queue< EdgeQueueEntry > FloorEdgeQueue; -typedef std::stack FloorTriIdStack; +typedef std::stack FloorTriIdStack; // ---------- -PathWalkResult FloorMesh::pathWalkCircleGetIds ( FloorLocator const & inStartLoc, Vector const & delta, - int ignoreTriId, int ignoreEdge, - float & outHitTime, int & outHitTriId, int & outHitEdge, int & outCenterTriId ) const +PathWalkResult FloorMesh::pathWalkCircleGetIds(FloorLocator const & inStartLoc, Vector const & delta, + int ignoreTriId, int ignoreEdge, + float & outHitTime, int & outHitTriId, int & outHitEdge, int & outCenterTriId) const { FloorLocator startLoc = inStartLoc; Vector begin = startLoc.getPosition_l(); Vector end = begin + delta; - Line3d beginLine(begin,-Vector::unitY); - Ribbon3d pathRibbon(begin,end,-Vector::unitY); + Line3d beginLine(begin, -Vector::unitY); + Ribbon3d pathRibbon(begin, end, -Vector::unitY); - Circle circle( begin, startLoc.getRadius() ); + Circle circle(begin, startLoc.getRadius()); outHitTime = REAL_MAX; outHitTriId = -1; @@ -2685,15 +2683,15 @@ PathWalkResult FloorMesh::pathWalkCircleGetIds ( FloorLocator const & inStartLoc int startTriId = startLoc.getId(); - if(startTriId == -1) + if (startTriId == -1) { - PathWalkResult entryResult = findStartingTri(startLoc,delta,true,startTriId); + PathWalkResult entryResult = findStartingTri(startLoc, delta, true, startTriId); - if(entryResult == PWR_DoesntEnter) + if (entryResult == PWR_DoesntEnter) { return PWR_DoesntEnter; } - else if(entryResult == PWR_CantEnter) + else if (entryResult == PWR_CantEnter) { return PWR_CantEnter; } @@ -2704,19 +2702,19 @@ PathWalkResult FloorMesh::pathWalkCircleGetIds ( FloorLocator const & inStartLoc { Triangle3d startTri = getTriangle(startTriId); - if( !Overlap3d::TestLineTriSided(beginLine,startTri) ) + if (!Overlap3d::TestLineTriSided(beginLine, startTri)) { - int enterTriEdge = Collision3d::TestEntranceTri(pathRibbon,startTri); + int enterTriEdge = Collision3d::TestEntranceTri(pathRibbon, startTri); - if(enterTriEdge == -1) + if (enterTriEdge == -1) { return PWR_DoesntEnter; } else { - FloorEdgeId id(startTriId,enterTriEdge); + FloorEdgeId id(startTriId, enterTriEdge); - if(!canEnterEdge(startLoc,delta,id,true)) + if (!canEnterEdge(startLoc, delta, id, true)) { return PWR_CantEnter; } @@ -2725,7 +2723,7 @@ PathWalkResult FloorMesh::pathWalkCircleGetIds ( FloorLocator const & inStartLoc } // ---------- - // First things first - Find out if and when the center of the circle will + // First things first - Find out if and when the center of the circle will // exit the floor during this timestep PathWalkResult centerWalkResult; @@ -2734,16 +2732,16 @@ PathWalkResult FloorMesh::pathWalkCircleGetIds ( FloorLocator const & inStartLoc int centerHitEdge = -1; { - centerWalkResult = pathWalkPoint( startLoc, delta, centerHitTriId, centerHitEdge, centerHitTime ); + centerWalkResult = pathWalkPoint(startLoc, delta, centerHitTriId, centerHitEdge, centerHitTime); - if( (centerWalkResult == PWR_MissedStartTri) - || (centerWalkResult == PWR_CantEnter) - || (centerWalkResult == PWR_WalkFailed) - || (centerWalkResult == PWR_StartLocInvalid) ) + if ((centerWalkResult == PWR_MissedStartTri) + || (centerWalkResult == PWR_CantEnter) + || (centerWalkResult == PWR_WalkFailed) + || (centerWalkResult == PWR_StartLocInvalid)) { return centerWalkResult; } - else if( centerWalkResult == PWR_InContact ) + else if (centerWalkResult == PWR_InContact) { // The center of the circle is in contact with an edge and will stay in contact during this timestep. @@ -2754,7 +2752,7 @@ PathWalkResult FloorMesh::pathWalkCircleGetIds ( FloorLocator const & inStartLoc return PWR_CenterInContact; } - else if( (centerWalkResult == PWR_ExitedMesh) || (centerWalkResult == PWR_HitEdge) || (centerWalkResult == PWR_HitPortalEdge) ) + else if ((centerWalkResult == PWR_ExitedMesh) || (centerWalkResult == PWR_HitEdge) || (centerWalkResult == PWR_HitPortalEdge)) { // The center of the circle will hit an edge during this timestep } @@ -2764,7 +2762,7 @@ PathWalkResult FloorMesh::pathWalkCircleGetIds ( FloorLocator const & inStartLoc } // ---------- - + bool hitAnything = false; float circleHitTime = 1.0f; int circleHitTriId = -1; @@ -2774,27 +2772,27 @@ PathWalkResult FloorMesh::pathWalkCircleGetIds ( FloorLocator const & inStartLoc FloorEdgeQueue unprocessed; - unprocessed.push( EdgeQueueEntry(startTriId,0.0f) ); + unprocessed.push(EdgeQueueEntry(startTriId, 0.0f)); - while(!unprocessed.empty()) + while (!unprocessed.empty()) { int currentTriId = unprocessed.top().triId; unprocessed.pop(); - FloorTri const & currentTri = getFloorTri( currentTriId ); - - if(currentTri.getMark() == markValue) continue; + FloorTri const & currentTri = getFloorTri(currentTriId); + + if (currentTri.getMark() == markValue) continue; currentTri.setMark(markValue); // ---------- // Test for hits with each edge of the tri - for(int i = 0; i < 3; i++) + for (int i = 0; i < 3; i++) { // See if it's even possible to hit this edge - if((ignoreTriId == currentTriId) && (ignoreEdge == i)) + if ((ignoreTriId == currentTriId) && (ignoreEdge == i)) { continue; } @@ -2803,11 +2801,11 @@ PathWalkResult FloorMesh::pathWalkCircleGetIds ( FloorLocator const & inStartLoc Vector edgeDir = edge.getDelta(); - Vector edgeNormal(edgeDir.z,0.0f,-edgeDir.x); + Vector edgeNormal(edgeDir.z, 0.0f, -edgeDir.x); - Vector V(delta.x,0.0f,delta.z); + Vector V(delta.x, 0.0f, delta.z); - if(edgeNormal.dot(V) > 0.0f) + if (edgeNormal.dot(V) > 0.0f) { // circle is moving away from the edge @@ -2815,7 +2813,7 @@ PathWalkResult FloorMesh::pathWalkCircleGetIds ( FloorLocator const & inStartLoc FloorEdgeType edgeType = getFloorTri(currentTriId).getEdgeType(i); - if(edgeType == FET_WallBase) + if (edgeType == FET_WallBase) { continue; } @@ -2823,33 +2821,33 @@ PathWalkResult FloorMesh::pathWalkCircleGetIds ( FloorLocator const & inStartLoc // Compute the time of intersection between the circle and the edge - Range hitRange = Intersect2d::IntersectCircleSeg(circle,V,edge); + Range hitRange = Intersect2d::IntersectCircleSeg(circle, V, edge); - // Ignore the hit if it ended in the past, starts further in the future than our + // Ignore the hit if it ended in the past, starts further in the future than our // earliest hit, or starts after the circle has already left the floor - if( hitRange.isEmpty() ) continue; - if( hitRange.getMax() < 0.0f ) continue; - if( hitRange.getMin() > circleHitTime ) continue; + if (hitRange.isEmpty()) continue; + if (hitRange.getMax() < 0.0f) continue; + if (hitRange.getMin() > circleHitTime) continue; - if( (centerWalkResult == PWR_ExitedMesh) || (centerWalkResult == PWR_HitPortalEdge) || (centerWalkResult == PWR_HitEdge) ) + if ((centerWalkResult == PWR_ExitedMesh) || (centerWalkResult == PWR_HitPortalEdge) || (centerWalkResult == PWR_HitEdge)) { - if(hitRange.getMin() > centerHitTime) continue; + if (hitRange.getMin() > centerHitTime) continue; } // This hit needs processing. - FloorEdgeId id(currentTriId,i); + FloorEdgeId id(currentTriId, i); - if(canExitEdge(startLoc,delta,id,true)) + if (canExitEdge(startLoc, delta, id, true)) { // Crossable edge hit - push the adjacent triangle onto the stack int neighbor = currentTri.getNeighborIndex(i); - if(neighbor != -1) + if (neighbor != -1) { - unprocessed.push( EdgeQueueEntry(neighbor,hitRange.getMin()) ); + unprocessed.push(EdgeQueueEntry(neighbor, hitRange.getMin())); } } else @@ -2858,29 +2856,29 @@ PathWalkResult FloorMesh::pathWalkCircleGetIds ( FloorLocator const & inStartLoc Vector endPoint = begin + V * hitRange.getMin(); - Vector contactPoint = Distance2d::ClosestPointSeg(endPoint,edge); + Vector contactPoint = Distance2d::ClosestPointSeg(endPoint, edge); Vector contactNormal = endPoint - contactPoint; contactNormal.y = 0.0f; - if(contactNormal.dot(V) >= 0.0f) + if (contactNormal.dot(V) >= 0.0f) { continue; } - if(hitRange.getMin() == hitRange.getMax()) + if (hitRange.getMin() == hitRange.getMax()) { // Degenerate hit - circle grazes one end of the segment. Ignore the hit. - + continue; } - else if(hitRange.getMin() < 0.0f) + else if (hitRange.getMin() < 0.0f) { float stepDistance = delta.magnitude(); float contactDistance = stepDistance * -hitRange.getMin(); - if(contactDistance < wallEpsilon) + if (contactDistance < wallEpsilon) { circleHitTime = hitRange.getMin(); circleHitTriId = currentTriId; @@ -2907,13 +2905,13 @@ PathWalkResult FloorMesh::pathWalkCircleGetIds ( FloorLocator const & inStartLoc // ---------- - if(hitAnything) + if (hitAnything) { float stepDistance = delta.magnitude(); float contactDist = std::abs(stepDistance * circleHitTime); - if((circleHitTime < 0) && (contactDist > wallEpsilon)) + if ((circleHitTime < 0) && (contactDist > wallEpsilon)) { // The circle hit an edge some time in the past. @@ -2926,7 +2924,7 @@ PathWalkResult FloorMesh::pathWalkCircleGetIds ( FloorLocator const & inStartLoc } else { - if(contactDist <= wallEpsilon) + if (contactDist <= wallEpsilon) { // The circle is currently in contact with an edge @@ -2939,7 +2937,7 @@ PathWalkResult FloorMesh::pathWalkCircleGetIds ( FloorLocator const & inStartLoc } else { - // The circle hits an edge during this timestep. + // The circle hits an edge during this timestep. // Walk the center of the circle to where it will be at the contact time Vector newDelta = delta * circleHitTime; @@ -2948,9 +2946,9 @@ PathWalkResult FloorMesh::pathWalkCircleGetIds ( FloorLocator const & inStartLoc int newCenterHitEdge = -1; float newCenterHitTime = REAL_MAX; - PathWalkResult result = pathWalkPoint( startLoc, newDelta, newCenterTriId, newCenterHitEdge, newCenterHitTime ); + PathWalkResult result = pathWalkPoint(startLoc, newDelta, newCenterTriId, newCenterHitEdge, newCenterHitTime); - if(result == PWR_HitEdge) + if (result == PWR_HitEdge) { outHitTime = newCenterHitTime; outHitTriId = newCenterTriId; @@ -2959,7 +2957,7 @@ PathWalkResult FloorMesh::pathWalkCircleGetIds ( FloorLocator const & inStartLoc return PWR_CenterHitEdge; } - else if(result == PWR_InContact) + else if (result == PWR_InContact) { outHitTime = newCenterHitTime; outHitTriId = newCenterTriId; @@ -2968,7 +2966,7 @@ PathWalkResult FloorMesh::pathWalkCircleGetIds ( FloorLocator const & inStartLoc return PWR_CenterInContact; } - else if(result == PWR_DoesntEnter) + else if (result == PWR_DoesntEnter) { outHitTime = circleHitTime; outHitTriId = circleHitTriId; @@ -2977,7 +2975,7 @@ PathWalkResult FloorMesh::pathWalkCircleGetIds ( FloorLocator const & inStartLoc return PWR_HitBeforeEnter; } - else if(result != PWR_WalkOk) + else if (result != PWR_WalkOk) { FLOOR_WARNING("FloorMeshpathWalkCircleGetIds - Walking the center to the time of the circle's contact failed"); return PWR_WalkFailed; @@ -2994,7 +2992,7 @@ PathWalkResult FloorMesh::pathWalkCircleGetIds ( FloorLocator const & inStartLoc } else { - if(centerWalkResult == PWR_HitEdge) + if (centerWalkResult == PWR_HitEdge) { outHitTime = centerHitTime; outHitTriId = centerHitTriId; @@ -3003,7 +3001,7 @@ PathWalkResult FloorMesh::pathWalkCircleGetIds ( FloorLocator const & inStartLoc return PWR_CenterHitEdge; } - else if(centerWalkResult == PWR_InContact) + else if (centerWalkResult == PWR_InContact) { outHitTime = centerHitTime; outHitTriId = centerHitTriId; @@ -3012,7 +3010,7 @@ PathWalkResult FloorMesh::pathWalkCircleGetIds ( FloorLocator const & inStartLoc return PWR_CenterInContact; } - else if(centerWalkResult == PWR_ExitedMesh) + else if (centerWalkResult == PWR_ExitedMesh) { outHitTime = centerHitTime; outHitTriId = centerHitTriId; @@ -3021,7 +3019,7 @@ PathWalkResult FloorMesh::pathWalkCircleGetIds ( FloorLocator const & inStartLoc return PWR_ExitedMesh; } - else if(centerWalkResult == PWR_HitPortalEdge) + else if (centerWalkResult == PWR_HitPortalEdge) { outHitTime = centerHitTime; outHitTriId = centerHitTriId; @@ -3042,35 +3040,35 @@ PathWalkResult FloorMesh::pathWalkCircleGetIds ( FloorLocator const & inStartLoc return PWR_WalkOk; } } - + WARNING_STRICT_FATAL(true, ("pathWalkCircleGetIds failed to compute a result. Return PWR_WalkOk")); outHitTime = REAL_MAX; outHitTriId = -1; outHitEdge = -1; outCenterTriId = centerHitTriId; - + return PWR_WalkOk; } // ---------------------------------------------------------------------- -bool FloorMesh::testAboveCrossables ( FloorLocator const & testLoc ) const +bool FloorMesh::testAboveCrossables(FloorLocator const & testLoc) const { - Vector offset(0.0f,gs_hopTolerance,0.0f); + Vector offset(0.0f, gs_hopTolerance, 0.0f); - Circle circle( testLoc.getOffsetPosition_l() + offset, testLoc.getRadius() - gs_clearTolerance ); + Circle circle(testLoc.getOffsetPosition_l() + offset, testLoc.getRadius() - gs_clearTolerance); int edgeCount = m_crossableEdges->size(); - for(int i = 0; i < edgeCount; i++) + for (int i = 0; i < edgeCount; i++) { FloorEdgeId id = m_crossableEdges->at(i); - if(getFloorTri(id.triId).isFallthrough()) continue; + if (getFloorTri(id.triId).isFallthrough()) continue; Segment3d edge = getTriangle(id.triId).getEdgeSegment(id.edgeId); - if( Overlap3d::TestSegCircle_Below(edge,circle) ) + if (Overlap3d::TestSegCircle_Below(edge, circle)) { return false; } @@ -3081,31 +3079,31 @@ bool FloorMesh::testAboveCrossables ( FloorLocator const & testLoc ) const // ---------------------------------------------------------------------- -bool FloorMesh::testAboveCrossables ( FloorLocator const & testLoc, Vector const & inDelta ) const +bool FloorMesh::testAboveCrossables(FloorLocator const & testLoc, Vector const & inDelta) const { - DEBUG_FATAL(inDelta.y != 0.0f,("FloorMesh::testCrossables - can't handle Y movement yet\n")); + DEBUG_FATAL(inDelta.y != 0.0f, ("FloorMesh::testCrossables - can't handle Y movement yet\n")); - Vector delta(inDelta.x,0.0f,inDelta.z); + Vector delta(inDelta.x, 0.0f, inDelta.z); - Vector offset(0.0f,gs_hopTolerance,0.0f); + Vector offset(0.0f, gs_hopTolerance, 0.0f); - Circle circle( testLoc.getOffsetPosition_l() + offset, testLoc.getRadius() - gs_clearTolerance ); + Circle circle(testLoc.getOffsetPosition_l() + offset, testLoc.getRadius() - gs_clearTolerance); int edgeCount = m_crossableEdges->size(); - for(int i = 0; i < edgeCount; i++) + for (int i = 0; i < edgeCount; i++) { FloorEdgeId id = m_crossableEdges->at(i); - if(getFloorTri(id.triId).isFallthrough()) continue; + if (getFloorTri(id.triId).isFallthrough()) continue; Segment3d edge = getTriangle(id.triId).getEdgeSegment(id.edgeId); - Range hitRange = Intersect3d::IntersectCircleSeg_Below(circle,delta,edge); + Range hitRange = Intersect3d::IntersectCircleSeg_Below(circle, delta, edge); - if(hitRange.isEmpty()) continue; - - if((hitRange.getMin() <= 1.0f) && (hitRange.getMax() >= 0.0f)) return false; + if (hitRange.isEmpty()) continue; + + if ((hitRange.getMin() <= 1.0f) && (hitRange.getMax() >= 0.0f)) return false; } return true; @@ -3113,7 +3111,7 @@ bool FloorMesh::testAboveCrossables ( FloorLocator const & testLoc, Vector const // ---------------------------------------------------------------------- -bool FloorMesh::testClear ( FloorLocator const & inTestLoc ) const +bool FloorMesh::testClear(FloorLocator const & inTestLoc) const { FloorLocator testLoc = inTestLoc; @@ -3121,12 +3119,12 @@ bool FloorMesh::testClear ( FloorLocator const & inTestLoc ) const int startTriId = testLoc.getId(); - if(startTriId == -1) + if (startTriId == -1) { return true; } - Circle testCircle( testLoc.getOffsetPosition_l(), testLoc.getRadius() ); + Circle testCircle(testLoc.getOffsetPosition_l(), testLoc.getRadius()); // ---------- @@ -3135,60 +3133,60 @@ bool FloorMesh::testClear ( FloorLocator const & inTestLoc ) const static FloorTriIdQueue unprocessed; unprocessed.clear(); - unprocessed.push_back( startTriId ); + unprocessed.push_back(startTriId); bool testedAboveCrossables = false; - while(!unprocessed.empty()) + while (!unprocessed.empty()) { int currentTriId = unprocessed.front(); unprocessed.pop_front(); - FloorTri const & currentTri = getFloorTri( currentTriId ); - - if(currentTri.getMark() == markValue) continue; + FloorTri const & currentTri = getFloorTri(currentTriId); + + if (currentTri.getMark() == markValue) continue; currentTri.setMark(markValue); // ---------- - - for(int i = 0; i < 3; i++) + + for (int i = 0; i < 3; i++) { Segment3d edge = getTriangle(currentTriId).getEdgeSegment(i); - if(!Overlap2d::TestSegCircle(edge,testCircle)) continue; + if (!Overlap2d::TestSegCircle(edge, testCircle)) continue; // ---------- FloorEdgeType type = currentTri.getEdgeType(i); - if(type == FET_Crossable) + if (type == FET_Crossable) { // circle overlaps a crossable edge, push the neighbor onto the stack int neighbor = currentTri.getNeighborIndex(i); - if(neighbor != -1) + if (neighbor != -1) { - unprocessed.push_back( neighbor ); + unprocessed.push_back(neighbor); } continue; } - else if(type == FET_Uncrossable) + else if (type == FET_Uncrossable) { // circle overlaps an uncrossable edge, circle is not clear return false; } - else if(type == FET_WallBase) + else if (type == FET_WallBase) { // circle overlaps a wall base. circle is not clear if it's under a crossable // edge of a solid tri. we only need to run this test once. - if(testedAboveCrossables) continue; + if (testedAboveCrossables) continue; - if(!testAboveCrossables(testLoc)) + if (!testAboveCrossables(testLoc)) { return false; } @@ -3207,7 +3205,7 @@ bool FloorMesh::testClear ( FloorLocator const & inTestLoc ) const // ---------------------------------------------------------------------- -bool FloorMesh::getClosestCollidableEdge ( FloorLocator const & loc, int & outTriId, int & outEdgeId, float & outDist ) const +bool FloorMesh::getClosestCollidableEdge(FloorLocator const & loc, int & outTriId, int & outEdgeId, float & outDist) const { FloorLocator testLoc = loc; @@ -3215,12 +3213,12 @@ bool FloorMesh::getClosestCollidableEdge ( FloorLocator const & loc, int & outTr int startTriId = testLoc.getId(); - if(startTriId == -1) + if (startTriId == -1) { return false; } - Circle testCircle( testLoc.getPosition_l(), testLoc.getRadius() ); + Circle testCircle(testLoc.getPosition_l(), testLoc.getRadius()); int minTriId = -1; int minEdgeId = -1; @@ -3232,63 +3230,63 @@ bool FloorMesh::getClosestCollidableEdge ( FloorLocator const & loc, int & outTr static FloorTriIdQueue unprocessed; unprocessed.clear(); - unprocessed.push_back( startTriId ); + unprocessed.push_back(startTriId); bool testedAboveCrossables = false; bool isAboveCrossables = false; - while(!unprocessed.empty()) + while (!unprocessed.empty()) { int currentTriId = unprocessed.front(); unprocessed.pop_front(); - FloorTri const & currentTri = getFloorTri( currentTriId ); - - if(currentTri.getMark() == markValue) continue; + FloorTri const & currentTri = getFloorTri(currentTriId); + + if (currentTri.getMark() == markValue) continue; currentTri.setMark(markValue); // ---------- - - for(int i = 0; i < 3; i++) + + for (int i = 0; i < 3; i++) { Segment3d edge = getTriangle(currentTriId).getEdgeSegment(i); - float dist = Distance2d::DistancePointSeg( testCircle.getCenter(), edge ); + float dist = Distance2d::DistancePointSeg(testCircle.getCenter(), edge); - if(dist >= testCircle.getRadius()) continue; + if (dist >= testCircle.getRadius()) continue; // ---------- FloorEdgeType type = currentTri.getEdgeType(i); - if(type == FET_Crossable) + if (type == FET_Crossable) { int neighbor = currentTri.getNeighborIndex(i); - if(neighbor != -1) + if (neighbor != -1) { - unprocessed.push_back( neighbor ); + unprocessed.push_back(neighbor); } } - else if(type == FET_Uncrossable) + else if (type == FET_Uncrossable) { testCircle.setRadius(dist); minTriId = currentTriId; minEdgeId = i; } - else if(type == FET_WallBase) + else if (type == FET_WallBase) { // circle overlaps a wall base. circle is not clear if it's under a crossable // edge of a solid tri. we only need to run this test once. - if(testedAboveCrossables) continue; + if (testedAboveCrossables) continue; isAboveCrossables = testAboveCrossables(testLoc); testedAboveCrossables = true; - if(!isAboveCrossables) + if (!isAboveCrossables) { testCircle.setRadius(dist); @@ -3303,7 +3301,7 @@ bool FloorMesh::getClosestCollidableEdge ( FloorLocator const & loc, int & outTr } } - if(minTriId != -1) + if (minTriId != -1) { outTriId = minTriId; outEdgeId = minEdgeId; @@ -3319,7 +3317,7 @@ bool FloorMesh::getClosestCollidableEdge ( FloorLocator const & loc, int & outTr // ---------------------------------------------------------------------- -bool FloorMesh::testConnectable ( FloorLocator const & locA, FloorLocator const & locB ) const +bool FloorMesh::testConnectable(FloorLocator const & locA, FloorLocator const & locB) const { Vector posA = locA.getPosition_l(); Vector posB = locB.getPosition_l(); @@ -3330,43 +3328,43 @@ bool FloorMesh::testConnectable ( FloorLocator const & locA, FloorLocator const FloorLocator moveResultA; FloorLocator moveResultB; - PathWalkResult resultA = pathWalkCircle(locA,deltaA,-1,-1,moveResultA); - PathWalkResult resultB = pathWalkCircle(locB,deltaB,-1,-1,moveResultB); + PathWalkResult resultA = pathWalkCircle(locA, deltaA, -1, -1, moveResultA); + PathWalkResult resultB = pathWalkCircle(locB, deltaB, -1, -1, moveResultB); - if((resultA == PWR_ExitedMesh) || (resultA == PWR_HitPortalEdge)) + if ((resultA == PWR_ExitedMesh) || (resultA == PWR_HitPortalEdge)) { // If the move from A didn't exit the floor at B, we can't connect the locators - if(moveResultA.getTriId() != locB.getTriId()) + if (moveResultA.getTriId() != locB.getTriId()) { return false; } } - if((resultB == PWR_ExitedMesh) || (resultB == PWR_HitPortalEdge)) + if ((resultB == PWR_ExitedMesh) || (resultB == PWR_HitPortalEdge)) { // If the move from B didn't exit the floor at A, we can't connect the locators - if(moveResultB.getTriId() != locA.getTriId()) + if (moveResultB.getTriId() != locA.getTriId()) { return false; } } - if((resultA != PWR_WalkOk) && (resultA != PWR_ExitedMesh) && (resultA != PWR_HitPortalEdge)) return false; - if((resultB != PWR_WalkOk) && (resultB != PWR_ExitedMesh) && (resultB != PWR_HitPortalEdge)) return false; + if ((resultA != PWR_WalkOk) && (resultA != PWR_ExitedMesh) && (resultA != PWR_HitPortalEdge)) return false; + if ((resultB != PWR_WalkOk) && (resultB != PWR_ExitedMesh) && (resultB != PWR_HitPortalEdge)) return false; - if(resultA == PWR_WalkOk) + if (resultA == PWR_WalkOk) { - if(moveResultA.getId() != locB.getId()) + if (moveResultA.getId() != locB.getId()) { return false; } } - if(resultB == PWR_WalkOk) + if (resultB == PWR_WalkOk) { - if(moveResultB.getId() != locA.getId()) + if (moveResultB.getId() != locA.getId()) { return false; } @@ -3379,26 +3377,26 @@ bool FloorMesh::testConnectable ( FloorLocator const & locA, FloorLocator const // The points returned by getGoodLocation won't be evenly distributed over // the floor, but I don't think that's a problem. -bool FloorMesh::getGoodLocation ( float radius, Vector & outLoc ) const +bool FloorMesh::getGoodLocation(float radius, Vector & outLoc) const { int triCount = getTriCount(); int attempts = 10; - while(attempts) + while (attempts) { // Pick a random triangle in the floor - int triIndex = Random::random(triCount-1); + int triIndex = Random::random(triCount - 1); Triangle3d const & tri = getTriangle(triIndex); // Pick a random barycentric coordinate - float baryX = Random::randomReal(0.0f,1.0f); - float baryY = Random::randomReal(0.0f,1.0f); + float baryX = Random::randomReal(0.0f, 1.0f); + float baryY = Random::randomReal(0.0f, 1.0f); - if((baryX + baryY) > 1.0f) + if ((baryX + baryY) > 1.0f) { baryX = 1.0f - baryX; baryY = 1.0f - baryY; @@ -3411,11 +3409,11 @@ bool FloorMesh::getGoodLocation ( float radius, Vector & outLoc ) const Vector const & B = tri.getCornerB(); Vector const & C = tri.getCornerC(); - Vector point = A + (B-A) * baryX + (C-A) * baryY; - - FloorLocator testLoc(this,point,-1,0.0f,radius); + Vector point = A + (B - A) * baryX + (C - A) * baryY; - if(testClear(testLoc)) + FloorLocator testLoc(this, point, -1, 0.0f, radius); + + if (testClear(testLoc)) { outLoc = point; @@ -3432,36 +3430,36 @@ bool FloorMesh::getGoodLocation ( float radius, Vector & outLoc ) const // ---------------------------------------------------------------------- -int FloorMesh::getTriMarkValue ( void ) const +int FloorMesh::getTriMarkValue(void) const { return m_triMarkCounter++; } // ---------------------------------------------------------------------- -void FloorMesh::buildBoundaryEdgeList ( void ) +void FloorMesh::buildBoundaryEdgeList(void) { m_crossableEdges->clear(); m_uncrossableEdges->clear(); m_wallBaseEdges->clear(); m_wallTopEdges->clear(); - for(int i = 0; i < getTriCount(); i++) + for (int i = 0; i < getTriCount(); i++) { FloorTri const & F = getFloorTri(i); - for(int j = 0; j < 3; j++) + for (int j = 0; j < 3; j++) { - if(F.getNeighborIndex(j) == -1) + if (F.getNeighborIndex(j) == -1) { - FloorEdgeId id(i,j); + FloorEdgeId id(i, j); - switch(F.getEdgeType(j)) + switch (F.getEdgeType(j)) { - case FET_Crossable: { m_crossableEdges->push_back(id); break; } + case FET_Crossable: { m_crossableEdges->push_back(id); break; } case FET_Uncrossable: { m_uncrossableEdges->push_back(id); break; } - case FET_WallBase: { m_wallBaseEdges->push_back(id); break; } - default: { break; } + case FET_WallBase: { m_wallBaseEdges->push_back(id); break; } + default: { break; } } } } @@ -3470,7 +3468,7 @@ void FloorMesh::buildBoundaryEdgeList ( void ) // ---------------------------------------------------------------------- -bool FloorMesh::intersectEdge ( FloorLocator const & startLoc, Vector const & delta, FloorEdgeId const & id, bool useRadius, bool testFront, FloorLocator & outLoc ) const +bool FloorMesh::intersectEdge(FloorLocator const & startLoc, Vector const & delta, FloorEdgeId const & id, bool useRadius, bool testFront, FloorLocator & outLoc) const { Vector point = startLoc.getPosition_l(); @@ -3479,15 +3477,15 @@ bool FloorMesh::intersectEdge ( FloorLocator const & startLoc, Vector const & de float hitTime; - if(useRadius) + if (useRadius) { - Circle circle(point,startLoc.getRadius()); + Circle circle(point, startLoc.getRadius()); - Range hitRange = Intersect2d::IntersectCircleSeg(circle,delta,edge); + Range hitRange = Intersect2d::IntersectCircleSeg(circle, delta, edge); - if( hitRange.isEmpty() ) return false; - if( hitRange.getMax() < 0.0f ) return false; - if( hitRange.getMin() > 1.0f ) return false; + if (hitRange.isEmpty()) return false; + if (hitRange.getMax() < 0.0f) return false; + if (hitRange.getMin() > 1.0f) return false; hitTime = hitRange.getMin(); } @@ -3495,18 +3493,18 @@ bool FloorMesh::intersectEdge ( FloorLocator const & startLoc, Vector const & de { float param; - Line3d moveLine(point,delta); + Line3d moveLine(point, delta); - bool hitSeg = Intersect2d::IntersectLineSeg( moveLine, edge, hitTime, param ); + bool hitSeg = Intersect2d::IntersectLineSeg(moveLine, edge, hitTime, param); - if(!hitSeg) return false; - if(hitTime > 1.0f) return false; + if (!hitSeg) return false; + if (hitTime > 1.0f) return false; - if(hitTime < 0.0f) + if (hitTime < 0.0f) { float dist = -delta.magnitude() * hitTime; - if(dist > 0.2f) + if (dist > 0.2f) { return false; } @@ -3523,17 +3521,17 @@ bool FloorMesh::intersectEdge ( FloorLocator const & startLoc, Vector const & de Vector cross = delta.cross(edge.getDelta()); - if(testFront) + if (testFront) { - if(cross.y < 0.0f) return false; + if (cross.y < 0.0f) return false; } else { - if(cross.y > 0.0f) return false; + if (cross.y > 0.0f) return false; } Vector centerHitPos = point + delta * hitTime; - Vector crossPoint = Distance3d::ClosestPointYLine(edge,centerHitPos); + Vector crossPoint = Distance3d::ClosestPointYLine(edge, centerHitPos); float offset = centerHitPos.y - crossPoint.y + startLoc.getOffset(); @@ -3552,37 +3550,37 @@ bool FloorMesh::intersectEdge ( FloorLocator const & startLoc, Vector const & de // ---------------------------------------------------------------------- -bool FloorMesh::intersectBoundary ( FloorLocator const & startLoc, Vector const & delta, bool useRadius, FloorLocatorVec & results ) const +bool FloorMesh::intersectBoundary(FloorLocator const & startLoc, Vector const & delta, bool useRadius, FloorLocatorVec & results) const { results.clear(); bool result = false; - result |= intersectBoundary( m_crossableEdges, startLoc, delta, useRadius, results ); - result |= intersectBoundary( m_wallBaseEdges, startLoc, delta, useRadius, results ); + result |= intersectBoundary(m_crossableEdges, startLoc, delta, useRadius, results); + result |= intersectBoundary(m_wallBaseEdges, startLoc, delta, useRadius, results); return result; } // ---------- -bool FloorMesh::intersectBoundary ( FloorEdgeIdVec * edgeList, FloorLocator const & startLoc, Vector const & delta, bool useRadius, FloorLocatorVec & results ) const +bool FloorMesh::intersectBoundary(FloorEdgeIdVec * edgeList, FloorLocator const & startLoc, Vector const & delta, bool useRadius, FloorLocatorVec & results) const { bool hit = false; int edgeCount = edgeList->size(); - for( int i = 0; i < edgeCount; i++) + for (int i = 0; i < edgeCount; i++) { FloorEdgeId & id = edgeList->at(i); - Vector V(delta.x,0.0f,delta.z); + Vector V(delta.x, 0.0f, delta.z); FloorLocator hitLoc; - bool hitEdgeId = intersectEdge(startLoc,V,id,useRadius,false,hitLoc); + bool hitEdgeId = intersectEdge(startLoc, V, id, useRadius, false, hitLoc); - if(hitEdgeId) + if (hitEdgeId) { hit = true; @@ -3593,21 +3591,20 @@ bool FloorMesh::intersectBoundary ( FloorEdgeIdVec * edgeList, FloorLocator cons return hit; } - // ---------------------------------------------------------------------- -bool FloorMesh::dropTest ( FloorLocator const & testLoc, FloorLocator & outLoc ) const +bool FloorMesh::dropTest(FloorLocator const & testLoc, FloorLocator & outLoc) const { - return dropTest(testLoc,ConfigSharedCollision::getHopHeight(),outLoc); + return dropTest(testLoc, ConfigSharedCollision::getHopHeight(), outLoc); } // ---------- -bool FloorMesh::dropTest ( FloorLocator const & testLoc, float hopHeight, FloorLocator & outLoc ) const +bool FloorMesh::dropTest(FloorLocator const & testLoc, float hopHeight, FloorLocator & outLoc) const { Vector point = testLoc.getPosition_l(); - Line3d line(point,-Vector::unitY); + Line3d line(point, -Vector::unitY); FloorLocator closestAbove; FloorLocator closestBelow; @@ -3617,7 +3614,7 @@ bool FloorMesh::dropTest ( FloorLocator const & testLoc, float hopHeight, FloorL // Our drop dir points down, so the closestBelow locator is in 'front' of the line, // and the closestAbove locator is 'behind' it. - if( findClosestPair(line,-1,closestBelow,closestAbove) ) + if (findClosestPair(line, -1, closestBelow, closestAbove)) { float distBelow = std::abs(closestBelow.getOffset()); float distAbove = std::abs(closestAbove.getOffset()); @@ -3625,11 +3622,11 @@ bool FloorMesh::dropTest ( FloorLocator const & testLoc, float hopHeight, FloorL closestAbove.setSurface(this); closestBelow.setSurface(this); - if(closestAbove.isAttached() && closestBelow.isAttached()) + if (closestAbove.isAttached() && closestBelow.isAttached()) { // Handle test points on or slightly below the floor correctly - if((distAbove < distBelow) && (distAbove < 1.0f)) + if ((distAbove < distBelow) && (distAbove < 1.0f)) { outLoc = closestAbove; } @@ -3638,15 +3635,15 @@ bool FloorMesh::dropTest ( FloorLocator const & testLoc, float hopHeight, FloorL outLoc = closestBelow; } } - else if(closestBelow.isAttached()) + else if (closestBelow.isAttached()) { - if(distBelow <= fallHeight) + if (distBelow <= fallHeight) { outLoc = closestBelow; } else { - if(closestBelow.getFloorTri().isFallthrough()) + if (closestBelow.getFloorTri().isFallthrough()) { outLoc = closestBelow; } @@ -3656,15 +3653,15 @@ bool FloorMesh::dropTest ( FloorLocator const & testLoc, float hopHeight, FloorL } } } - else if(closestAbove.isAttached()) + else if (closestAbove.isAttached()) { - if(distAbove <= hopHeight) + if (distAbove <= hopHeight) { outLoc = closestAbove; } else { - if(closestAbove.getFloorTri().isFallthrough()) + if (closestAbove.getFloorTri().isFallthrough()) { outLoc = closestAbove; } @@ -3691,19 +3688,19 @@ bool FloorMesh::dropTest ( FloorLocator const & testLoc, float hopHeight, FloorL // ---------------------------------------------------------------------- -bool FloorMesh::dropTest ( FloorLocator const & testLoc, int triID, FloorLocator & outLoc ) const +bool FloorMesh::dropTest(FloorLocator const & testLoc, int triID, FloorLocator & outLoc) const { Vector point = testLoc.getPosition_l(); - Line3d line(point,-Vector::unitY); + Line3d line(point, -Vector::unitY); FloorLocator tempLoc; - if(testIntersect(line,triID,tempLoc)) + if (testIntersect(line, triID, tempLoc)) { float absDist = std::abs(tempLoc.getOffset()); - if(absDist <= ConfigSharedCollision::getHopHeight()) + if (absDist <= ConfigSharedCollision::getHopHeight()) { outLoc = tempLoc; return true; @@ -3715,15 +3712,15 @@ bool FloorMesh::dropTest ( FloorLocator const & testLoc, int triID, FloorLocator // ---------------------------------------------------------------------- -bool FloorMesh::findEntrance ( FloorLocator const & startLoc, Vector const & delta, bool useRadius, FloorLocator & outLoc ) const +bool FloorMesh::findEntrance(FloorLocator const & startLoc, Vector const & delta, bool useRadius, FloorLocator & outLoc) const { static FloorLocatorVec results; results.clear(); - bool intersected = intersectBoundary(startLoc,delta,useRadius,results); + bool intersected = intersectBoundary(startLoc, delta, useRadius, results); - if(!intersected) return false; + if (!intersected) return false; // ---------- @@ -3742,7 +3739,7 @@ bool FloorMesh::findEntrance ( FloorLocator const & startLoc, Vector const & del Vector startOffsetPoint = startLoc.getOffsetPosition_l(); Vector hitPoint = entryLoc.getPosition_l(); - + Vector crossOffsetPoint = startOffsetPoint + delta * hitTime; Vector temp = hitPoint - startOffsetPoint; @@ -3751,12 +3748,12 @@ bool FloorMesh::findEntrance ( FloorLocator const & startLoc, Vector const & del float distA = temp.magnitude(); float distB = hitPoint.magnitudeBetween(crossOffsetPoint); - // For a crossing to be considered an entrance, it has to be within half a meter + // For a crossing to be considered an entrance, it has to be within half a meter // (fudge factor) of the earliest crossing, and it has to be closer to the move // segment than the earliest crossing. - if(distA >= (minDistA + 0.5f)) continue; - if(distB >= minDistB) continue; + if (distA >= (minDistA + 0.5f)) continue; + if (distB >= minDistB) continue; float offset = entryLoc.getOffset(); @@ -3765,21 +3762,21 @@ bool FloorMesh::findEntrance ( FloorLocator const & startLoc, Vector const & del bool fallthrough = entryLoc.getFloorTri().isFallthrough(); - if((offset < hopHeight) && (!fallthrough)) + if ((offset < hopHeight) && (!fallthrough)) { // crosses too far below solid tri - - continue; + + continue; } - if((offset > fallHeight) && (!fallthrough)) + if ((offset > fallHeight) && (!fallthrough)) { // crosses too far above solid tri continue; } - if(canEnterEdge(entryLoc)) + if (canEnterEdge(entryLoc)) { minDistA = distA; minDistB = distB; @@ -3787,7 +3784,7 @@ bool FloorMesh::findEntrance ( FloorLocator const & startLoc, Vector const & del } } - if(minIndex != -1) + if (minIndex != -1) { outLoc = results[minIndex]; @@ -3801,42 +3798,42 @@ bool FloorMesh::findEntrance ( FloorLocator const & startLoc, Vector const & del // ---------------------------------------------------------------------- -void FloorMesh::drawDebugShapes ( DebugShapeRenderer * renderer, bool drawExtent ) const +void FloorMesh::drawDebugShapes(DebugShapeRenderer * renderer, bool drawExtent) const { UNREF(renderer); UNREF(drawExtent); #ifdef _DEBUG - if(renderer == nullptr) return; + if (renderer == nullptr) return; - if(ConfigSharedCollision::getDrawFloors()) + if (ConfigSharedCollision::getDrawFloors()) { - if( m_crossableLines ) renderer->drawLineList( *m_crossableLines, VectorArgb::solidGreen ); - if( m_uncrossableLines ) renderer->drawLineList( *m_uncrossableLines, VectorArgb::solidRed ); - if( m_interiorLines ) renderer->drawLineList( *m_interiorLines, VectorArgb::solidWhite); - if( m_portalLines ) renderer->drawLineList( *m_portalLines, PackedArgb(255,220,255,0) ); - if( m_rampLines ) renderer->drawLineList( *m_rampLines, PackedArgb(255,255,175,0) ); - if( m_fallthroughTriLines ) renderer->drawLineList( *m_fallthroughTriLines, VectorArgb::solidRed ); - if( m_solidTriLines ) renderer->drawLineList( *m_solidTriLines, VectorArgb::solidWhite ); + if (m_crossableLines) renderer->drawLineList(*m_crossableLines, VectorArgb::solidGreen); + if (m_uncrossableLines) renderer->drawLineList(*m_uncrossableLines, VectorArgb::solidRed); + if (m_interiorLines) renderer->drawLineList(*m_interiorLines, VectorArgb::solidWhite); + if (m_portalLines) renderer->drawLineList(*m_portalLines, PackedArgb(255, 220, 255, 0)); + if (m_rampLines) renderer->drawLineList(*m_rampLines, PackedArgb(255, 255, 175, 0)); + if (m_fallthroughTriLines) renderer->drawLineList(*m_fallthroughTriLines, VectorArgb::solidRed); + if (m_solidTriLines) renderer->drawLineList(*m_solidTriLines, VectorArgb::solidWhite); - if(drawExtent) + if (drawExtent) { getExtent_l()->drawDebugShapes(renderer); } } - if(ConfigSharedCollision::getDrawPathNodes()) + if (ConfigSharedCollision::getDrawPathNodes()) { ObjectRenderer pathRenderer = FloorManager::getPathGraphRenderer(); - if(m_pathGraph && pathRenderer) + if (m_pathGraph && pathRenderer) { - pathRenderer(m_pathGraph,renderer); + pathRenderer(m_pathGraph, renderer); } } - if(m_boxTree && ConfigSharedCollision::getDrawBoxTrees()) + if (m_boxTree && ConfigSharedCollision::getDrawBoxTrees()) { m_boxTree->drawDebugShapes(renderer); } @@ -3848,9 +3845,9 @@ void FloorMesh::drawDebugShapes ( DebugShapeRenderer * renderer, bool drawExtent #ifdef _DEBUG -void FloorMesh::buildDebugData ( void ) +void FloorMesh::buildDebugData(void) { - Vector scootUp(0.0f,0.04f,0.0f); + Vector scootUp(0.0f, 0.04f, 0.0f); // ---------- // Create our line arrays for the debug info @@ -3873,18 +3870,18 @@ void FloorMesh::buildDebugData ( void ) // ---------- - for(int i = 0; i < getTriCount(); i++) + for (int i = 0; i < getTriCount(); i++) { FloorTri const & F = getFloorTri(i); // Create border edges for the tri - for(int j = 0; j < 3; j++) + for (int j = 0; j < 3; j++) { Vector a = getVertex(F.getCornerIndex(j)) + scootUp; - Vector b = getVertex(F.getCornerIndex(j+1)) + scootUp; + Vector b = getVertex(F.getCornerIndex(j + 1)) + scootUp; - if(F.getNeighborIndex(j) != -1) + if (F.getNeighborIndex(j) != -1) { m_interiorLines->push_back(a); m_interiorLines->push_back(b); @@ -3898,18 +3895,18 @@ void FloorMesh::buildDebugData ( void ) VectorVector * container = m_uncrossableLines; - if(edgeType == FET_Crossable) container = m_crossableLines; + if (edgeType == FET_Crossable) container = m_crossableLines; - if(edgeType == FET_WallBase) container = m_rampLines; + if (edgeType == FET_WallBase) container = m_rampLines; - if(F.getPortalId(j) != -1) container = m_portalLines; + if (F.getPortalId(j) != -1) container = m_portalLines; // Edge indicators are duplicated 3 times to make them more visible - for(int i = 0; i < 3; i++) + for (int i = 0; i < 3; i++) { - container->push_back( a + scootUp * float(i) ); - container->push_back( b + scootUp * float(i) ); + container->push_back(a + scootUp * float(i)); + container->push_back(b + scootUp * float(i)); } } @@ -3942,9 +3939,9 @@ void FloorMesh::buildDebugData ( void ) // ---------------------------------------------------------------------- -bool FloorMesh::getDistanceUncrossable2d ( Vector const & V, float maxDistance, float & outDistance, FloorEdgeId & outEdgeId ) const +bool FloorMesh::getDistanceUncrossable2d(Vector const & V, float maxDistance, float & outDistance, FloorEdgeId & outEdgeId) const { - if(!m_uncrossableEdges) return false; + if (!m_uncrossableEdges) return false; // ---------- @@ -3952,24 +3949,24 @@ bool FloorMesh::getDistanceUncrossable2d ( Vector const & V, float maxDistance, float minDistance = maxDistance; - FloorEdgeId minId(-1,-1); + FloorEdgeId minId(-1, -1); - for(int i = 0; i < count; i++) + for (int i = 0; i < count; i++) { FloorEdgeId const & id = m_uncrossableEdges->at(i); Segment3d edge = getTriangle(id.triId).getEdgeSegment(id.edgeId); - float dist = Distance2d::DistancePointSeg(V,edge); + float dist = Distance2d::DistancePointSeg(V, edge); - if(dist < minDistance) + if (dist < minDistance) { minDistance = dist; minId = id; } } - if(minDistance != maxDistance) + if (minDistance != maxDistance) { outDistance = minDistance; outEdgeId = minId; @@ -3982,4 +3979,4 @@ bool FloorMesh::getDistanceUncrossable2d ( Vector const & V, float maxDistance, } } -// ====================================================================== +// ====================================================================== \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBattlefieldMarkerObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBattlefieldMarkerObjectTemplate.cpp index 5219f6c2..ee7609f5 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBattlefieldMarkerObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBattlefieldMarkerObjectTemplate.cpp @@ -24,20 +24,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedBattlefieldMarkerObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ SharedBattlefieldMarkerObjectTemplate::SharedBattlefieldMarkerObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedTangibleObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // SharedBattlefieldMarkerObjectTemplate::SharedBattlefieldMarkerObjectTemplate @@ -46,8 +46,8 @@ SharedBattlefieldMarkerObjectTemplate::SharedBattlefieldMarkerObjectTemplate(con */ SharedBattlefieldMarkerObjectTemplate::~SharedBattlefieldMarkerObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // SharedBattlefieldMarkerObjectTemplate::~SharedBattlefieldMarkerObjectTemplate /** @@ -106,8 +106,6 @@ Tag SharedBattlefieldMarkerObjectTemplate::getHighestTemplateVersion(void) const //@BEGIN TFD int SharedBattlefieldMarkerObjectTemplate::getNumberOfPoles() const { - - const SharedBattlefieldMarkerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -157,8 +155,6 @@ int SharedBattlefieldMarkerObjectTemplate::getNumberOfPoles() const int SharedBattlefieldMarkerObjectTemplate::getNumberOfPolesMin() const { - - const SharedBattlefieldMarkerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -208,8 +204,6 @@ int SharedBattlefieldMarkerObjectTemplate::getNumberOfPolesMin() const int SharedBattlefieldMarkerObjectTemplate::getNumberOfPolesMax() const { - - const SharedBattlefieldMarkerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -259,8 +253,6 @@ int SharedBattlefieldMarkerObjectTemplate::getNumberOfPolesMax() const float SharedBattlefieldMarkerObjectTemplate::getRadius() const { - - const SharedBattlefieldMarkerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -310,8 +302,6 @@ float SharedBattlefieldMarkerObjectTemplate::getRadius() const float SharedBattlefieldMarkerObjectTemplate::getRadiusMin() const { - - const SharedBattlefieldMarkerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -361,8 +351,6 @@ float SharedBattlefieldMarkerObjectTemplate::getRadiusMin() const float SharedBattlefieldMarkerObjectTemplate::getRadiusMax() const { - - const SharedBattlefieldMarkerObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -410,7 +398,6 @@ float SharedBattlefieldMarkerObjectTemplate::getRadiusMax() const return value; } // SharedBattlefieldMarkerObjectTemplate::getRadiusMax - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -419,8 +406,8 @@ float SharedBattlefieldMarkerObjectTemplate::getRadiusMax() const */ void SharedBattlefieldMarkerObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedBattlefieldMarkerObjectTemplate_tag) { @@ -430,7 +417,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -450,10 +437,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,1)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 1)) { - - m_versionOk = false; } @@ -479,4 +464,4 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedBattlefieldMarkerObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBuildingObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBuildingObjectTemplate.cpp index b666e7d3..04da57c3 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBuildingObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedBuildingObjectTemplate.cpp @@ -23,20 +23,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedBuildingObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ SharedBuildingObjectTemplate::SharedBuildingObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedTangibleObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // SharedBuildingObjectTemplate::SharedBuildingObjectTemplate @@ -45,8 +45,8 @@ SharedBuildingObjectTemplate::SharedBuildingObjectTemplate(const std::string & f */ SharedBuildingObjectTemplate::~SharedBuildingObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // SharedBuildingObjectTemplate::~SharedBuildingObjectTemplate /** @@ -105,8 +105,6 @@ Tag SharedBuildingObjectTemplate::getHighestTemplateVersion(void) const //@BEGIN TFD const std::string & SharedBuildingObjectTemplate::getTerrainModificationFileName() const { - - const SharedBuildingObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -134,8 +132,6 @@ const std::string & SharedBuildingObjectTemplate::getTerrainModificationFileName const std::string & SharedBuildingObjectTemplate::getInteriorLayoutFileName() const { - - const SharedBuildingObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -161,7 +157,6 @@ const std::string & SharedBuildingObjectTemplate::getInteriorLayoutFileName() co return value; } // SharedBuildingObjectTemplate::getInteriorLayoutFileName - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -170,8 +165,8 @@ const std::string & SharedBuildingObjectTemplate::getInteriorLayoutFileName() co */ void SharedBuildingObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedBuildingObjectTemplate_tag) { @@ -181,7 +176,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -201,10 +196,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,1)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 1)) { - - m_versionOk = false; } @@ -230,4 +223,4 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedBuildingObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCellObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCellObjectTemplate.cpp index adee55bf..5b19458e 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCellObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCellObjectTemplate.cpp @@ -23,20 +23,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedCellObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ SharedCellObjectTemplate::SharedCellObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // SharedCellObjectTemplate::SharedCellObjectTemplate @@ -45,8 +45,8 @@ SharedCellObjectTemplate::SharedCellObjectTemplate(const std::string & filename) */ SharedCellObjectTemplate::~SharedCellObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // SharedCellObjectTemplate::~SharedCellObjectTemplate /** @@ -112,8 +112,8 @@ Tag SharedCellObjectTemplate::getHighestTemplateVersion(void) const */ void SharedCellObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedCellObjectTemplate_tag) { @@ -123,7 +123,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -143,10 +143,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -164,4 +162,4 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedCellObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedConstructionContractObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedConstructionContractObjectTemplate.cpp index 8f6a8531..b47a62d9 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedConstructionContractObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedConstructionContractObjectTemplate.cpp @@ -23,20 +23,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedConstructionContractObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ SharedConstructionContractObjectTemplate::SharedConstructionContractObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedIntangibleObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // SharedConstructionContractObjectTemplate::SharedConstructionContractObjectTemplate @@ -45,8 +45,8 @@ SharedConstructionContractObjectTemplate::SharedConstructionContractObjectTempla */ SharedConstructionContractObjectTemplate::~SharedConstructionContractObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // SharedConstructionContractObjectTemplate::~SharedConstructionContractObjectTemplate /** @@ -112,8 +112,8 @@ Tag SharedConstructionContractObjectTemplate::getHighestTemplateVersion(void) co */ void SharedConstructionContractObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedConstructionContractObjectTemplate_tag) { @@ -123,7 +123,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -143,10 +143,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -164,4 +162,4 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedConstructionContractObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCreatureObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCreatureObjectTemplate.cpp index a6f21c63..9a451895 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCreatureObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCreatureObjectTemplate.cpp @@ -29,7 +29,7 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedCreatureObjectTemplate::ms_allowDefaultTemplateParams = true; @@ -42,8 +42,9 @@ typedef ::RangedIntCustomizationVariable GlobalRangedIntCustomizationVariableTyp SharedCreatureObjectTemplate::SharedCreatureObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedTangibleObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { m_movementTable = 0; } // SharedCreatureObjectTemplate::SharedCreatureObjectTemplate @@ -53,8 +54,8 @@ SharedCreatureObjectTemplate::SharedCreatureObjectTemplate(const std::string & f */ SharedCreatureObjectTemplate::~SharedCreatureObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP delete m_movementTable; m_movementTable = 0; } // SharedCreatureObjectTemplate::~SharedCreatureObjectTemplate @@ -122,7 +123,7 @@ void SharedCreatureObjectTemplate::postLoad() void SharedCreatureObjectTemplate::createCustomizationDataPropertyAsNeeded(Object &object, bool /* forceCreation */) const { - //-- Properties cannot be added while an object is in the world. Some callers may be in the world, + //-- Properties cannot be added while an object is in the world. Some callers may be in the world, // so temporarily remove the object from the world if necessary. bool shouldBeInWorld = object.isInWorld(); if (shouldBeInWorld) @@ -147,18 +148,18 @@ void SharedCreatureObjectTemplate::createCustomizationDataPropertyAsNeeded(Objec AssetCustomizationManager::addCustomizationVariablesForAsset(TemporaryCrcString(getAppearanceFilename().c_str(), true), *customizationData, skipSharedOwnerVariables); //-- set up mappings for any variables which need dependent mappings - int numVariableMappings = getCustomizationVariableMappingCount(); + int numVariableMappings = getCustomizationVariableMappingCount(); for (int i = 0; i < numVariableMappings; ++i) { CustomizationVariableMapping localVariableMapping; - getCustomizationVariableMapping(localVariableMapping, i); + getCustomizationVariableMapping(localVariableMapping, i); GlobalRangedIntCustomizationVariableType *source = safe_cast(customizationData->findVariable(localVariableMapping.sourceVariable)); - if(source) - { - source->setDependentVariable(localVariableMapping.dependentVariable); - } - } - + if (source) + { + source->setDependentVariable(localVariableMapping.dependentVariable); + } + } + //-- release local reference to the CustomizationData instance customizationData->release(); } @@ -169,8 +170,6 @@ void SharedCreatureObjectTemplate::createCustomizationDataPropertyAsNeeded(Objec //@BEGIN TFD SharedCreatureObjectTemplate::Gender SharedCreatureObjectTemplate::getGender() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -198,8 +197,6 @@ SharedCreatureObjectTemplate::Gender SharedCreatureObjectTemplate::getGender() c SharedCreatureObjectTemplate::Niche SharedCreatureObjectTemplate::getNiche() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -227,8 +224,6 @@ SharedCreatureObjectTemplate::Niche SharedCreatureObjectTemplate::getNiche() con SharedCreatureObjectTemplate::Species SharedCreatureObjectTemplate::getSpecies() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -256,8 +251,6 @@ SharedCreatureObjectTemplate::Species SharedCreatureObjectTemplate::getSpecies() SharedCreatureObjectTemplate::Race SharedCreatureObjectTemplate::getRace() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -726,8 +719,6 @@ float SharedCreatureObjectTemplate::getTurnRateMax(MovementTypes index) const const std::string & SharedCreatureObjectTemplate::getAnimationMapFilename() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -755,8 +746,6 @@ const std::string & SharedCreatureObjectTemplate::getAnimationMapFilename() cons float SharedCreatureObjectTemplate::getSlopeModAngle() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -806,8 +795,6 @@ float SharedCreatureObjectTemplate::getSlopeModAngle() const float SharedCreatureObjectTemplate::getSlopeModAngleMin() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -857,8 +844,6 @@ float SharedCreatureObjectTemplate::getSlopeModAngleMin() const float SharedCreatureObjectTemplate::getSlopeModAngleMax() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -908,8 +893,6 @@ float SharedCreatureObjectTemplate::getSlopeModAngleMax() const float SharedCreatureObjectTemplate::getSlopeModPercent() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -959,8 +942,6 @@ float SharedCreatureObjectTemplate::getSlopeModPercent() const float SharedCreatureObjectTemplate::getSlopeModPercentMin() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1010,8 +991,6 @@ float SharedCreatureObjectTemplate::getSlopeModPercentMin() const float SharedCreatureObjectTemplate::getSlopeModPercentMax() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1061,8 +1040,6 @@ float SharedCreatureObjectTemplate::getSlopeModPercentMax() const float SharedCreatureObjectTemplate::getWaterModPercent() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1112,8 +1089,6 @@ float SharedCreatureObjectTemplate::getWaterModPercent() const float SharedCreatureObjectTemplate::getWaterModPercentMin() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1163,8 +1138,6 @@ float SharedCreatureObjectTemplate::getWaterModPercentMin() const float SharedCreatureObjectTemplate::getWaterModPercentMax() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1214,8 +1187,6 @@ float SharedCreatureObjectTemplate::getWaterModPercentMax() const float SharedCreatureObjectTemplate::getStepHeight() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1265,8 +1236,6 @@ float SharedCreatureObjectTemplate::getStepHeight() const float SharedCreatureObjectTemplate::getStepHeightMin() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1316,8 +1285,6 @@ float SharedCreatureObjectTemplate::getStepHeightMin() const float SharedCreatureObjectTemplate::getStepHeightMax() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1367,8 +1334,6 @@ float SharedCreatureObjectTemplate::getStepHeightMax() const float SharedCreatureObjectTemplate::getCollisionHeight() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1418,8 +1383,6 @@ float SharedCreatureObjectTemplate::getCollisionHeight() const float SharedCreatureObjectTemplate::getCollisionHeightMin() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1469,8 +1432,6 @@ float SharedCreatureObjectTemplate::getCollisionHeightMin() const float SharedCreatureObjectTemplate::getCollisionHeightMax() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1520,8 +1481,6 @@ float SharedCreatureObjectTemplate::getCollisionHeightMax() const float SharedCreatureObjectTemplate::getCollisionRadius() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1571,8 +1530,6 @@ float SharedCreatureObjectTemplate::getCollisionRadius() const float SharedCreatureObjectTemplate::getCollisionRadiusMin() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1622,8 +1579,6 @@ float SharedCreatureObjectTemplate::getCollisionRadiusMin() const float SharedCreatureObjectTemplate::getCollisionRadiusMax() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1673,8 +1628,6 @@ float SharedCreatureObjectTemplate::getCollisionRadiusMax() const const std::string & SharedCreatureObjectTemplate::getMovementDatatable() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1729,8 +1682,6 @@ bool SharedCreatureObjectTemplate::getPostureAlignToTerrain(Postures index) cons float SharedCreatureObjectTemplate::getSwimHeight() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1780,8 +1731,6 @@ float SharedCreatureObjectTemplate::getSwimHeight() const float SharedCreatureObjectTemplate::getSwimHeightMin() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1831,8 +1780,6 @@ float SharedCreatureObjectTemplate::getSwimHeightMin() const float SharedCreatureObjectTemplate::getSwimHeightMax() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1882,8 +1829,6 @@ float SharedCreatureObjectTemplate::getSwimHeightMax() const float SharedCreatureObjectTemplate::getWarpTolerance() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1933,8 +1878,6 @@ float SharedCreatureObjectTemplate::getWarpTolerance() const float SharedCreatureObjectTemplate::getWarpToleranceMin() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1984,8 +1927,6 @@ float SharedCreatureObjectTemplate::getWarpToleranceMin() const float SharedCreatureObjectTemplate::getWarpToleranceMax() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -2035,8 +1976,6 @@ float SharedCreatureObjectTemplate::getWarpToleranceMax() const float SharedCreatureObjectTemplate::getCollisionOffsetX() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -2086,8 +2025,6 @@ float SharedCreatureObjectTemplate::getCollisionOffsetX() const float SharedCreatureObjectTemplate::getCollisionOffsetXMin() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -2137,8 +2074,6 @@ float SharedCreatureObjectTemplate::getCollisionOffsetXMin() const float SharedCreatureObjectTemplate::getCollisionOffsetXMax() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -2188,8 +2123,6 @@ float SharedCreatureObjectTemplate::getCollisionOffsetXMax() const float SharedCreatureObjectTemplate::getCollisionOffsetZ() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -2239,8 +2172,6 @@ float SharedCreatureObjectTemplate::getCollisionOffsetZ() const float SharedCreatureObjectTemplate::getCollisionOffsetZMin() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -2290,8 +2221,6 @@ float SharedCreatureObjectTemplate::getCollisionOffsetZMin() const float SharedCreatureObjectTemplate::getCollisionOffsetZMax() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -2341,8 +2270,6 @@ float SharedCreatureObjectTemplate::getCollisionOffsetZMax() const float SharedCreatureObjectTemplate::getCollisionLength() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -2392,8 +2319,6 @@ float SharedCreatureObjectTemplate::getCollisionLength() const float SharedCreatureObjectTemplate::getCollisionLengthMin() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -2443,8 +2368,6 @@ float SharedCreatureObjectTemplate::getCollisionLengthMin() const float SharedCreatureObjectTemplate::getCollisionLengthMax() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -2494,8 +2417,6 @@ float SharedCreatureObjectTemplate::getCollisionLengthMax() const float SharedCreatureObjectTemplate::getCameraHeight() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -2545,8 +2466,6 @@ float SharedCreatureObjectTemplate::getCameraHeight() const float SharedCreatureObjectTemplate::getCameraHeightMin() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -2596,8 +2515,6 @@ float SharedCreatureObjectTemplate::getCameraHeightMin() const float SharedCreatureObjectTemplate::getCameraHeightMax() const { - - const SharedCreatureObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -2645,7 +2562,6 @@ float SharedCreatureObjectTemplate::getCameraHeightMax() const return value; } // SharedCreatureObjectTemplate::getCameraHeightMax - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -2654,8 +2570,8 @@ float SharedCreatureObjectTemplate::getCameraHeightMax() const */ void SharedCreatureObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedCreatureObjectTemplate_tag) { @@ -2665,7 +2581,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -2685,10 +2601,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,1,3)) + if (getHighestTemplateVersion() != TAG(0, 0, 1, 3)) { - - m_versionOk = false; } @@ -2802,5 +2716,4 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedCreatureObjectTemplate::load -//@END TFD - +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedDraftSchematicObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedDraftSchematicObjectTemplate.cpp index 658899be..d20a240a 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedDraftSchematicObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedDraftSchematicObjectTemplate.cpp @@ -23,24 +23,24 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedDraftSchematicObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ SharedDraftSchematicObjectTemplate::SharedDraftSchematicObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedIntangibleObjectTemplate(filename) - ,m_slotsLoaded(false) - ,m_slotsAppend(false) - ,m_attributesLoaded(false) - ,m_attributesAppend(false) - ,m_versionOk(true) -//@END TFD INIT + , m_slotsLoaded(false) + , m_slotsAppend(false) + , m_attributesLoaded(false) + , m_attributesAppend(false) + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // SharedDraftSchematicObjectTemplate::SharedDraftSchematicObjectTemplate @@ -49,7 +49,7 @@ SharedDraftSchematicObjectTemplate::SharedDraftSchematicObjectTemplate(const std */ SharedDraftSchematicObjectTemplate::~SharedDraftSchematicObjectTemplate() { -//@BEGIN TFD CLEANUP + //@BEGIN TFD CLEANUP { std::vector::iterator iter; for (iter = m_slots.begin(); iter != m_slots.end(); ++iter) @@ -68,7 +68,7 @@ SharedDraftSchematicObjectTemplate::~SharedDraftSchematicObjectTemplate() } m_attributes.clear(); } -//@END TFD CLEANUP + //@END TFD CLEANUP } // SharedDraftSchematicObjectTemplate::~SharedDraftSchematicObjectTemplate /** @@ -138,7 +138,7 @@ void SharedDraftSchematicObjectTemplate::getSlots(IngredientSlot &data, int inde if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slots in template %s", DataResource::getName())); - return ; + return; } else { @@ -152,10 +152,10 @@ void SharedDraftSchematicObjectTemplate::getSlots(IngredientSlot &data, int inde { int baseCount = base->getSlotsCount(); if (index < baseCount) - { - base->getSlots(data, index); - return; - } + { + base->getSlots(data, index); + return; + } index -= baseCount; } @@ -181,7 +181,7 @@ void SharedDraftSchematicObjectTemplate::getSlotsMin(IngredientSlot &data, int i if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slots in template %s", DataResource::getName())); - return ; + return; } else { @@ -195,10 +195,10 @@ void SharedDraftSchematicObjectTemplate::getSlotsMin(IngredientSlot &data, int i { int baseCount = base->getSlotsCount(); if (index < baseCount) - { - base->getSlotsMin(data, index); - return; - } + { + base->getSlotsMin(data, index); + return; + } index -= baseCount; } @@ -224,7 +224,7 @@ void SharedDraftSchematicObjectTemplate::getSlotsMax(IngredientSlot &data, int i if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter slots in template %s", DataResource::getName())); - return ; + return; } else { @@ -238,10 +238,10 @@ void SharedDraftSchematicObjectTemplate::getSlotsMax(IngredientSlot &data, int i { int baseCount = base->getSlotsCount(); if (index < baseCount) - { - base->getSlotsMax(data, index); - return; - } + { + base->getSlotsMax(data, index); + return; + } index -= baseCount; } @@ -291,7 +291,7 @@ void SharedDraftSchematicObjectTemplate::getAttributes(SchematicAttribute &data, if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attributes in template %s", DataResource::getName())); - return ; + return; } else { @@ -305,10 +305,10 @@ void SharedDraftSchematicObjectTemplate::getAttributes(SchematicAttribute &data, { int baseCount = base->getAttributesCount(); if (index < baseCount) - { - base->getAttributes(data, index); - return; - } + { + base->getAttributes(data, index); + return; + } index -= baseCount; } @@ -335,7 +335,7 @@ void SharedDraftSchematicObjectTemplate::getAttributesMin(SchematicAttribute &da if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attributes in template %s", DataResource::getName())); - return ; + return; } else { @@ -349,10 +349,10 @@ void SharedDraftSchematicObjectTemplate::getAttributesMin(SchematicAttribute &da { int baseCount = base->getAttributesCount(); if (index < baseCount) - { - base->getAttributesMin(data, index); - return; - } + { + base->getAttributesMin(data, index); + return; + } index -= baseCount; } @@ -379,7 +379,7 @@ void SharedDraftSchematicObjectTemplate::getAttributesMax(SchematicAttribute &da if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter attributes in template %s", DataResource::getName())); - return ; + return; } else { @@ -393,10 +393,10 @@ void SharedDraftSchematicObjectTemplate::getAttributesMax(SchematicAttribute &da { int baseCount = base->getAttributesCount(); if (index < baseCount) - { - base->getAttributesMax(data, index); - return; - } + { + base->getAttributesMax(data, index); + return; + } index -= baseCount; } @@ -436,8 +436,6 @@ size_t SharedDraftSchematicObjectTemplate::getAttributesCount(void) const const std::string & SharedDraftSchematicObjectTemplate::getCraftedSharedTemplate() const { - - const SharedDraftSchematicObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -463,7 +461,6 @@ const std::string & SharedDraftSchematicObjectTemplate::getCraftedSharedTemplate return value; } // SharedDraftSchematicObjectTemplate::getCraftedSharedTemplate - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -472,8 +469,8 @@ const std::string & SharedDraftSchematicObjectTemplate::getCraftedSharedTemplate */ void SharedDraftSchematicObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedDraftSchematicObjectTemplate_tag) { @@ -483,7 +480,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -503,10 +500,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,3)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 3)) { - - m_versionOk = false; } @@ -568,7 +563,6 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedDraftSchematicObjectTemplate::load - //============================================================================= // class SharedDraftSchematicObjectTemplate::_IngredientSlot @@ -617,8 +611,6 @@ Tag SharedDraftSchematicObjectTemplate::_IngredientSlot::getId(void) const const StringId SharedDraftSchematicObjectTemplate::_IngredientSlot::getName(bool versionOk) const { - - const SharedDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; if (m_baseData != nullptr) { @@ -646,8 +638,6 @@ const StringId SharedDraftSchematicObjectTemplate::_IngredientSlot::getName(bool const std::string & SharedDraftSchematicObjectTemplate::_IngredientSlot::getHardpoint(bool versionOk) const { - - const SharedDraftSchematicObjectTemplate::_IngredientSlot * base = nullptr; if (m_baseData != nullptr) { @@ -673,7 +663,6 @@ const std::string & SharedDraftSchematicObjectTemplate::_IngredientSlot::getHard return value; } // SharedDraftSchematicObjectTemplate::_IngredientSlot::getHardpoint - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -682,8 +671,8 @@ const std::string & SharedDraftSchematicObjectTemplate::_IngredientSlot::getHard */ void SharedDraftSchematicObjectTemplate::_IngredientSlot::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -705,7 +694,6 @@ char paramName[MAX_NAME_SIZE]; UNREF(file); } // SharedDraftSchematicObjectTemplate::_IngredientSlot::load - //============================================================================= // class SharedDraftSchematicObjectTemplate::_SchematicAttribute @@ -754,8 +742,6 @@ Tag SharedDraftSchematicObjectTemplate::_SchematicAttribute::getId(void) const const StringId SharedDraftSchematicObjectTemplate::_SchematicAttribute::getName(bool versionOk) const { - - const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = nullptr; if (m_baseData != nullptr) { @@ -783,8 +769,6 @@ const StringId SharedDraftSchematicObjectTemplate::_SchematicAttribute::getName( const StringId SharedDraftSchematicObjectTemplate::_SchematicAttribute::getExperiment(bool versionOk) const { - - const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = nullptr; if (m_baseData != nullptr) { @@ -812,8 +796,6 @@ const StringId SharedDraftSchematicObjectTemplate::_SchematicAttribute::getExper int SharedDraftSchematicObjectTemplate::_SchematicAttribute::getValue(bool versionOk) const { - - const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = nullptr; if (m_baseData != nullptr) { @@ -863,8 +845,6 @@ int SharedDraftSchematicObjectTemplate::_SchematicAttribute::getValue(bool versi int SharedDraftSchematicObjectTemplate::_SchematicAttribute::getValueMin(bool versionOk) const { - - const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = nullptr; if (m_baseData != nullptr) { @@ -914,8 +894,6 @@ int SharedDraftSchematicObjectTemplate::_SchematicAttribute::getValueMin(bool ve int SharedDraftSchematicObjectTemplate::_SchematicAttribute::getValueMax(bool versionOk) const { - - const SharedDraftSchematicObjectTemplate::_SchematicAttribute * base = nullptr; if (m_baseData != nullptr) { @@ -963,7 +941,6 @@ int SharedDraftSchematicObjectTemplate::_SchematicAttribute::getValueMax(bool ve return value; } // SharedDraftSchematicObjectTemplate::_SchematicAttribute::getValueMax - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -972,8 +949,8 @@ int SharedDraftSchematicObjectTemplate::_SchematicAttribute::getValueMax(bool ve */ void SharedDraftSchematicObjectTemplate::_SchematicAttribute::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -1001,17 +978,17 @@ char paramName[MAX_NAME_SIZE]; //---------------------------------------------------------------------- -const StringId SharedDraftSchematicObjectTemplate::getCraftedName () const +const StringId SharedDraftSchematicObjectTemplate::getCraftedName() const { - StringId sid = getObjectName (); + StringId sid = getObjectName(); - if (sid.isInvalid ()) + if (sid.isInvalid()) { - const SharedObjectTemplate * const sot = fetchCraftedSharedObjectTemplate (); + const SharedObjectTemplate * const sot = fetchCraftedSharedObjectTemplate(); if (sot) { - sid = sot->getObjectName (); - sot->releaseReference (); + sid = sot->getObjectName(); + sot->releaseReference(); } } @@ -1020,17 +997,17 @@ const StringId SharedDraftSchematicObjectTemplate::getCraftedName //---------------------------------------------------------------------- -const StringId SharedDraftSchematicObjectTemplate::getCraftedDetailedDescription () const +const StringId SharedDraftSchematicObjectTemplate::getCraftedDetailedDescription() const { - StringId sid = getDetailedDescription (); + StringId sid = getDetailedDescription(); - if (sid.isInvalid ()) + if (sid.isInvalid()) { - const SharedObjectTemplate * const sot = fetchCraftedSharedObjectTemplate (); + const SharedObjectTemplate * const sot = fetchCraftedSharedObjectTemplate(); if (sot) { - sid = sot->getDetailedDescription (); - sot->releaseReference (); + sid = sot->getDetailedDescription(); + sot->releaseReference(); } } @@ -1039,17 +1016,17 @@ const StringId SharedDraftSchematicObjectTemplate::getCraftedDetailedDescription //---------------------------------------------------------------------- -const StringId SharedDraftSchematicObjectTemplate::getCraftedLookAtText () const +const StringId SharedDraftSchematicObjectTemplate::getCraftedLookAtText() const { - StringId sid = getLookAtText (); + StringId sid = getLookAtText(); - if (sid.isInvalid ()) + if (sid.isInvalid()) { - const SharedObjectTemplate * const sot = fetchCraftedSharedObjectTemplate (); + const SharedObjectTemplate * const sot = fetchCraftedSharedObjectTemplate(); if (sot) { - sid = sot->getLookAtText (); - sot->releaseReference (); + sid = sot->getLookAtText(); + sot->releaseReference(); } } @@ -1058,17 +1035,17 @@ const StringId SharedDraftSchematicObjectTemplate::getCraftedLookAtText //---------------------------------------------------------------------- -const std::string SharedDraftSchematicObjectTemplate::getCraftedAppearanceFilename () const +const std::string SharedDraftSchematicObjectTemplate::getCraftedAppearanceFilename() const { - const std::string & app = getAppearanceFilename (); + const std::string & app = getAppearanceFilename(); - if (app.empty ()) + if (app.empty()) { - const SharedObjectTemplate * const sot = fetchCraftedSharedObjectTemplate (); + const SharedObjectTemplate * const sot = fetchCraftedSharedObjectTemplate(); if (sot) { - const std::string capp = sot->getAppearanceFilename (); - sot->releaseReference (); + const std::string capp = sot->getAppearanceFilename(); + sot->releaseReference(); return capp; } } @@ -1078,19 +1055,18 @@ const std::string SharedDraftSchematicObjectTemplate::getCraftedAppearanceFilena //---------------------------------------------------------------------- -const SharedObjectTemplate * SharedDraftSchematicObjectTemplate::fetchCraftedSharedObjectTemplate () const +const SharedObjectTemplate * SharedDraftSchematicObjectTemplate::fetchCraftedSharedObjectTemplate() const { - const std::string & sotName = getCraftedSharedTemplate (); - const SharedObjectTemplate * const sot = safe_cast(ObjectTemplateList::fetch (sotName.c_str ())); + const std::string & sotName = getCraftedSharedTemplate(); + const SharedObjectTemplate * const sot = safe_cast(ObjectTemplateList::fetch(sotName.c_str())); if (!sot) { - const char * const draftName = this->DataResource::getName (); - WARNING (true, ("SharedDraftSchematicObjectTemplate [%s] could not load craftedSharedTemplate [%s]", draftName ? draftName : "", sotName.c_str ())); + const char * const draftName = this->DataResource::getName(); + WARNING(true, ("SharedDraftSchematicObjectTemplate [%s] could not load craftedSharedTemplate [%s]", draftName ? draftName : "", sotName.c_str())); } return sot; } -//---------------------------------------------------------------------- - +//---------------------------------------------------------------------- \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedFactoryObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedFactoryObjectTemplate.cpp index 75390ff3..e7d9e1f7 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedFactoryObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedFactoryObjectTemplate.cpp @@ -23,20 +23,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedFactoryObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ SharedFactoryObjectTemplate::SharedFactoryObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedTangibleObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // SharedFactoryObjectTemplate::SharedFactoryObjectTemplate @@ -45,8 +45,8 @@ SharedFactoryObjectTemplate::SharedFactoryObjectTemplate(const std::string & fil */ SharedFactoryObjectTemplate::~SharedFactoryObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // SharedFactoryObjectTemplate::~SharedFactoryObjectTemplate /** @@ -112,8 +112,8 @@ Tag SharedFactoryObjectTemplate::getHighestTemplateVersion(void) const */ void SharedFactoryObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedFactoryObjectTemplate_tag) { @@ -123,7 +123,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -143,10 +143,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -164,4 +162,4 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedFactoryObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGroupObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGroupObjectTemplate.cpp index 3605fec1..87dc2c57 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGroupObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGroupObjectTemplate.cpp @@ -23,20 +23,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedGroupObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ SharedGroupObjectTemplate::SharedGroupObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedUniverseObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // SharedGroupObjectTemplate::SharedGroupObjectTemplate @@ -45,8 +45,8 @@ SharedGroupObjectTemplate::SharedGroupObjectTemplate(const std::string & filenam */ SharedGroupObjectTemplate::~SharedGroupObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // SharedGroupObjectTemplate::~SharedGroupObjectTemplate /** @@ -112,8 +112,8 @@ Tag SharedGroupObjectTemplate::getHighestTemplateVersion(void) const */ void SharedGroupObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedGroupObjectTemplate_tag) { @@ -123,7 +123,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -143,10 +143,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -164,4 +162,4 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedGroupObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGuildObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGuildObjectTemplate.cpp index 6a07324b..03650c6b 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGuildObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedGuildObjectTemplate.cpp @@ -23,20 +23,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedGuildObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ SharedGuildObjectTemplate::SharedGuildObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedUniverseObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // SharedGuildObjectTemplate::SharedGuildObjectTemplate @@ -45,8 +45,8 @@ SharedGuildObjectTemplate::SharedGuildObjectTemplate(const std::string & filenam */ SharedGuildObjectTemplate::~SharedGuildObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // SharedGuildObjectTemplate::~SharedGuildObjectTemplate /** @@ -112,8 +112,8 @@ Tag SharedGuildObjectTemplate::getHighestTemplateVersion(void) const */ void SharedGuildObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedGuildObjectTemplate_tag) { @@ -123,7 +123,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -143,10 +143,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -164,4 +162,4 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedGuildObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedInstallationObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedInstallationObjectTemplate.cpp index 64db45c4..4e0e5c1b 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedInstallationObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedInstallationObjectTemplate.cpp @@ -23,20 +23,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedInstallationObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ SharedInstallationObjectTemplate::SharedInstallationObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedTangibleObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // SharedInstallationObjectTemplate::SharedInstallationObjectTemplate @@ -45,8 +45,8 @@ SharedInstallationObjectTemplate::SharedInstallationObjectTemplate(const std::st */ SharedInstallationObjectTemplate::~SharedInstallationObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // SharedInstallationObjectTemplate::~SharedInstallationObjectTemplate /** @@ -112,8 +112,8 @@ Tag SharedInstallationObjectTemplate::getHighestTemplateVersion(void) const */ void SharedInstallationObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedInstallationObjectTemplate_tag) { @@ -123,7 +123,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -143,10 +143,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -164,4 +162,4 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedInstallationObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedIntangibleObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedIntangibleObjectTemplate.cpp index ef0e1df9..ba2ef96f 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedIntangibleObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedIntangibleObjectTemplate.cpp @@ -23,20 +23,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedIntangibleObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ SharedIntangibleObjectTemplate::SharedIntangibleObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // SharedIntangibleObjectTemplate::SharedIntangibleObjectTemplate @@ -45,8 +45,8 @@ SharedIntangibleObjectTemplate::SharedIntangibleObjectTemplate(const std::string */ SharedIntangibleObjectTemplate::~SharedIntangibleObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // SharedIntangibleObjectTemplate::~SharedIntangibleObjectTemplate /** @@ -112,8 +112,8 @@ Tag SharedIntangibleObjectTemplate::getHighestTemplateVersion(void) const */ void SharedIntangibleObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedIntangibleObjectTemplate_tag) { @@ -123,7 +123,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -143,10 +143,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -164,4 +162,4 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedIntangibleObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedJediManagerObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedJediManagerObjectTemplate.cpp index 9ee18be7..3d1387bc 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedJediManagerObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedJediManagerObjectTemplate.cpp @@ -24,20 +24,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedJediManagerObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ SharedJediManagerObjectTemplate::SharedJediManagerObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedUniverseObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // SharedJediManagerObjectTemplate::SharedJediManagerObjectTemplate @@ -46,8 +46,8 @@ SharedJediManagerObjectTemplate::SharedJediManagerObjectTemplate(const std::stri */ SharedJediManagerObjectTemplate::~SharedJediManagerObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // SharedJediManagerObjectTemplate::~SharedJediManagerObjectTemplate /** @@ -113,8 +113,8 @@ Tag SharedJediManagerObjectTemplate::getHighestTemplateVersion(void) const */ void SharedJediManagerObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedJediManagerObjectTemplate_tag) { @@ -124,7 +124,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -144,10 +144,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -165,4 +163,4 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedJediManagerObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedManufactureSchematicObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedManufactureSchematicObjectTemplate.cpp index 40779694..2f637eae 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedManufactureSchematicObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedManufactureSchematicObjectTemplate.cpp @@ -23,20 +23,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedManufactureSchematicObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ SharedManufactureSchematicObjectTemplate::SharedManufactureSchematicObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedIntangibleObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // SharedManufactureSchematicObjectTemplate::SharedManufactureSchematicObjectTemplate @@ -45,8 +45,8 @@ SharedManufactureSchematicObjectTemplate::SharedManufactureSchematicObjectTempla */ SharedManufactureSchematicObjectTemplate::~SharedManufactureSchematicObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // SharedManufactureSchematicObjectTemplate::~SharedManufactureSchematicObjectTemplate /** @@ -112,8 +112,8 @@ Tag SharedManufactureSchematicObjectTemplate::getHighestTemplateVersion(void) co */ void SharedManufactureSchematicObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedManufactureSchematicObjectTemplate_tag) { @@ -123,7 +123,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -143,10 +143,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -164,4 +162,4 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedManufactureSchematicObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedMissionObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedMissionObjectTemplate.cpp index 67ef6517..29fbcc08 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedMissionObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedMissionObjectTemplate.cpp @@ -23,20 +23,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedMissionObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ SharedMissionObjectTemplate::SharedMissionObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedIntangibleObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // SharedMissionObjectTemplate::SharedMissionObjectTemplate @@ -45,8 +45,8 @@ SharedMissionObjectTemplate::SharedMissionObjectTemplate(const std::string & fil */ SharedMissionObjectTemplate::~SharedMissionObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // SharedMissionObjectTemplate::~SharedMissionObjectTemplate /** @@ -112,8 +112,8 @@ Tag SharedMissionObjectTemplate::getHighestTemplateVersion(void) const */ void SharedMissionObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedMissionObjectTemplate_tag) { @@ -123,7 +123,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -143,10 +143,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -164,4 +162,4 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedMissionObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedObjectTemplate.cpp index f23cc1e5..4fa1374b 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedObjectTemplate.cpp @@ -33,7 +33,7 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedObjectTemplate::ms_allowDefaultTemplateParams = true; @@ -46,13 +46,13 @@ class SharedObjectTemplate::PreloadManager { public: - explicit PreloadManager (const SharedObjectTemplate* sharedObjectTemplate); - ~PreloadManager (); + explicit PreloadManager(const SharedObjectTemplate* sharedObjectTemplate); + ~PreloadManager(); private: - - PreloadManager (); - PreloadManager (const PreloadManager&); + + PreloadManager(); + PreloadManager(const PreloadManager&); PreloadManager& operator= (const PreloadManager&); private: @@ -63,40 +63,40 @@ private: // ---------------------------------------------------------------------- -SharedObjectTemplate::PreloadManager::PreloadManager (const SharedObjectTemplate* const sharedObjectTemplate) : -m_preloadAppearanceTemplate (0), -m_preloadPortalPropertyTemplate (0) +SharedObjectTemplate::PreloadManager::PreloadManager(const SharedObjectTemplate* const sharedObjectTemplate) : + m_preloadAppearanceTemplate(0), + m_preloadPortalPropertyTemplate(0) { NOT_NULL(sharedObjectTemplate); - const std::string& appearanceFileName = sharedObjectTemplate->getAppearanceFilename (); - if (!appearanceFileName.empty ()) + const std::string& appearanceFileName = sharedObjectTemplate->getAppearanceFilename(); + if (!appearanceFileName.empty()) { bool found = false; - m_preloadAppearanceTemplate = AppearanceTemplateList::fetch (appearanceFileName.c_str (), found); + m_preloadAppearanceTemplate = AppearanceTemplateList::fetch(appearanceFileName.c_str(), found); WARNING(!found, ("SharedObjectTemplate [%s] unable to load appearance [%s]", sharedObjectTemplate->getName(), appearanceFileName.c_str())); - m_preloadAppearanceTemplate->preloadAssets (); + m_preloadAppearanceTemplate->preloadAssets(); } - const std::string& portalLayoutFilename = sharedObjectTemplate->getPortalLayoutFilename (); - if (!portalLayoutFilename.empty ()) + const std::string& portalLayoutFilename = sharedObjectTemplate->getPortalLayoutFilename(); + if (!portalLayoutFilename.empty()) { - m_preloadPortalPropertyTemplate = PortalPropertyTemplateList::fetch (TemporaryCrcString (portalLayoutFilename.c_str (), true)); - m_preloadPortalPropertyTemplate->preloadAssets (); + m_preloadPortalPropertyTemplate = PortalPropertyTemplateList::fetch(TemporaryCrcString(portalLayoutFilename.c_str(), true)); + m_preloadPortalPropertyTemplate->preloadAssets(); } if (sharedObjectTemplate->m_clientData) - sharedObjectTemplate->m_clientData->preloadAssets (); + sharedObjectTemplate->m_clientData->preloadAssets(); } // ---------------------------------------------------------------------- -SharedObjectTemplate::PreloadManager::~PreloadManager () +SharedObjectTemplate::PreloadManager::~PreloadManager() { if (m_preloadAppearanceTemplate) - AppearanceTemplateList::release (m_preloadAppearanceTemplate); + AppearanceTemplateList::release(m_preloadAppearanceTemplate); if (m_preloadPortalPropertyTemplate) - m_preloadPortalPropertyTemplate->release (); + m_preloadPortalPropertyTemplate->release(); } // ====================================================================== @@ -107,12 +107,13 @@ SharedObjectTemplate::PreloadManager::~PreloadManager () SharedObjectTemplate::SharedObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : ObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT , m_slotDescriptor(nullptr) , m_arrangementDescriptor(nullptr) - , m_clientData (0) - , m_preloadManager (0) + , m_clientData(0) + , m_preloadManager(0) { } // SharedObjectTemplate::SharedObjectTemplate @@ -121,10 +122,10 @@ SharedObjectTemplate::SharedObjectTemplate(const std::string & filename) */ SharedObjectTemplate::~SharedObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP - //-- Release ArrangementDescriptor resource. + //-- Release ArrangementDescriptor resource. if (m_arrangementDescriptor) { m_arrangementDescriptor->release(); @@ -140,7 +141,7 @@ SharedObjectTemplate::~SharedObjectTemplate() //-- delete client data if (m_clientData) - m_clientData->releaseReference (); + m_clientData->releaseReference(); //-- delete preloadmanager if (m_preloadManager) @@ -184,18 +185,17 @@ ObjectTemplate * SharedObjectTemplate::create(const std::string & filename) return new SharedObjectTemplate(filename); } // SharedObjectTemplate::create - -void SharedObjectTemplate::preloadAssets () const +void SharedObjectTemplate::preloadAssets() const { - ObjectTemplate::preloadAssets (); + ObjectTemplate::preloadAssets(); if (!m_preloadManager) - m_preloadManager = new PreloadManager (this); + m_preloadManager = new PreloadManager(this); } -void SharedObjectTemplate::garbageCollect () const +void SharedObjectTemplate::garbageCollect() const { - ObjectTemplate::garbageCollect (); + ObjectTemplate::garbageCollect(); if (m_preloadManager) { @@ -204,7 +204,6 @@ void SharedObjectTemplate::garbageCollect () const } } - /** * Returns the template id. * @@ -258,18 +257,16 @@ void SharedObjectTemplate::postLoad(void) //-- load the client data file if (ms_createClientDataFunction) { - const std::string& clientDataFile = getClientDataFile (); + const std::string& clientDataFile = getClientDataFile(); - if (!clientDataFile.empty ()) - m_clientData = ms_createClientDataFunction (clientDataFile.c_str ()); + if (!clientDataFile.empty()) + m_clientData = ms_createClientDataFunction(clientDataFile.c_str()); } } // SharedObjectTemplate::postLoad //@BEGIN TFD const StringId SharedObjectTemplate::getObjectName() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -297,8 +294,6 @@ const StringId SharedObjectTemplate::getObjectName() const const StringId SharedObjectTemplate::getDetailedDescription() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -326,8 +321,6 @@ const StringId SharedObjectTemplate::getDetailedDescription() const const StringId SharedObjectTemplate::getLookAtText() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -355,8 +348,6 @@ const StringId SharedObjectTemplate::getLookAtText() const bool SharedObjectTemplate::getSnapToTerrain() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -384,8 +375,6 @@ bool SharedObjectTemplate::getSnapToTerrain() const SharedObjectTemplate::ContainerType SharedObjectTemplate::getContainerType() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -413,8 +402,6 @@ SharedObjectTemplate::ContainerType SharedObjectTemplate::getContainerType() con int SharedObjectTemplate::getContainerVolumeLimit() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -464,8 +451,6 @@ int SharedObjectTemplate::getContainerVolumeLimit() const int SharedObjectTemplate::getContainerVolumeLimitMin() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -515,8 +500,6 @@ int SharedObjectTemplate::getContainerVolumeLimitMin() const int SharedObjectTemplate::getContainerVolumeLimitMax() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -566,8 +549,6 @@ int SharedObjectTemplate::getContainerVolumeLimitMax() const const std::string & SharedObjectTemplate::getTintPalette() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -595,8 +576,6 @@ const std::string & SharedObjectTemplate::getTintPalette() const const std::string & SharedObjectTemplate::getSlotDescriptorFilename() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -624,8 +603,6 @@ const std::string & SharedObjectTemplate::getSlotDescriptorFilename() const const std::string & SharedObjectTemplate::getArrangementDescriptorFilename() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -653,8 +630,6 @@ const std::string & SharedObjectTemplate::getArrangementDescriptorFilename() con const std::string & SharedObjectTemplate::getAppearanceFilename() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -682,8 +657,6 @@ const std::string & SharedObjectTemplate::getAppearanceFilename() const const std::string & SharedObjectTemplate::getPortalLayoutFilename() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -711,8 +684,6 @@ const std::string & SharedObjectTemplate::getPortalLayoutFilename() const const std::string & SharedObjectTemplate::getClientDataFile() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -740,8 +711,6 @@ const std::string & SharedObjectTemplate::getClientDataFile() const float SharedObjectTemplate::getScale() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -791,8 +760,6 @@ float SharedObjectTemplate::getScale() const float SharedObjectTemplate::getScaleMin() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -842,8 +809,6 @@ float SharedObjectTemplate::getScaleMin() const float SharedObjectTemplate::getScaleMax() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -893,8 +858,6 @@ float SharedObjectTemplate::getScaleMax() const SharedObjectTemplate::GameObjectType SharedObjectTemplate::getGameObjectType() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -922,8 +885,6 @@ SharedObjectTemplate::GameObjectType SharedObjectTemplate::getGameObjectType() c bool SharedObjectTemplate::getSendToClient() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -951,8 +912,6 @@ bool SharedObjectTemplate::getSendToClient() const float SharedObjectTemplate::getScaleThresholdBeforeExtentTest() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1002,8 +961,6 @@ float SharedObjectTemplate::getScaleThresholdBeforeExtentTest() const float SharedObjectTemplate::getScaleThresholdBeforeExtentTestMin() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1053,8 +1010,6 @@ float SharedObjectTemplate::getScaleThresholdBeforeExtentTestMin() const float SharedObjectTemplate::getScaleThresholdBeforeExtentTestMax() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1104,8 +1059,6 @@ float SharedObjectTemplate::getScaleThresholdBeforeExtentTestMax() const float SharedObjectTemplate::getClearFloraRadius() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1155,8 +1108,6 @@ float SharedObjectTemplate::getClearFloraRadius() const float SharedObjectTemplate::getClearFloraRadiusMin() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1206,8 +1157,6 @@ float SharedObjectTemplate::getClearFloraRadiusMin() const float SharedObjectTemplate::getClearFloraRadiusMax() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1257,8 +1206,6 @@ float SharedObjectTemplate::getClearFloraRadiusMax() const SharedObjectTemplate::SurfaceType SharedObjectTemplate::getSurfaceType() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1286,8 +1233,6 @@ SharedObjectTemplate::SurfaceType SharedObjectTemplate::getSurfaceType() const float SharedObjectTemplate::getNoBuildRadius() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1337,8 +1282,6 @@ float SharedObjectTemplate::getNoBuildRadius() const float SharedObjectTemplate::getNoBuildRadiusMin() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1388,8 +1331,6 @@ float SharedObjectTemplate::getNoBuildRadiusMin() const float SharedObjectTemplate::getNoBuildRadiusMax() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1439,8 +1380,6 @@ float SharedObjectTemplate::getNoBuildRadiusMax() const bool SharedObjectTemplate::getOnlyVisibleInTools() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1468,8 +1407,6 @@ bool SharedObjectTemplate::getOnlyVisibleInTools() const float SharedObjectTemplate::getLocationReservationRadius() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1519,8 +1456,6 @@ float SharedObjectTemplate::getLocationReservationRadius() const float SharedObjectTemplate::getLocationReservationRadiusMin() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1570,8 +1505,6 @@ float SharedObjectTemplate::getLocationReservationRadiusMin() const float SharedObjectTemplate::getLocationReservationRadiusMax() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1621,8 +1554,6 @@ float SharedObjectTemplate::getLocationReservationRadiusMax() const bool SharedObjectTemplate::getForceNoCollision() const { - - const SharedObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1648,7 +1579,6 @@ bool SharedObjectTemplate::getForceNoCollision() const return value; } // SharedObjectTemplate::getForceNoCollision - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -1657,8 +1587,8 @@ bool SharedObjectTemplate::getForceNoCollision() const */ void SharedObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedObjectTemplate_tag) { @@ -1667,7 +1597,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -1687,10 +1617,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,1,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 1, 0)) { - - m_versionOk = false; } @@ -1760,7 +1688,7 @@ char paramName[MAX_NAME_SIZE]; // PUBLIC STATIC SharedObjectTemplate //=================================================================== -void SharedObjectTemplate::setCreateClientDataFunction (SharedObjectTemplate::CreateClientDataFunction createClientDataFunction) +void SharedObjectTemplate::setCreateClientDataFunction(SharedObjectTemplate::CreateClientDataFunction createClientDataFunction) { ms_createClientDataFunction = createClientDataFunction; } @@ -1769,7 +1697,7 @@ void SharedObjectTemplate::setCreateClientDataFunction (SharedObjectTemplate::Cr // PUBLIC SharedObjectTemplate //=================================================================== -const SharedObjectTemplateClientData* SharedObjectTemplate::getClientData () const +const SharedObjectTemplateClientData* SharedObjectTemplate::getClientData() const { return m_clientData; } @@ -1780,4 +1708,4 @@ const SharedObjectTemplateClientData* SharedObjectTemplate::getClientData () con SharedObjectTemplate::CreateClientDataFunction SharedObjectTemplate::ms_createClientDataFunction; -//=================================================================== +//=================================================================== \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerObjectTemplate.cpp index 4a744f52..0d49d170 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerObjectTemplate.cpp @@ -24,20 +24,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedPlayerObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ SharedPlayerObjectTemplate::SharedPlayerObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedIntangibleObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // SharedPlayerObjectTemplate::SharedPlayerObjectTemplate @@ -46,8 +46,8 @@ SharedPlayerObjectTemplate::SharedPlayerObjectTemplate(const std::string & filen */ SharedPlayerObjectTemplate::~SharedPlayerObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // SharedPlayerObjectTemplate::~SharedPlayerObjectTemplate /** @@ -113,8 +113,8 @@ Tag SharedPlayerObjectTemplate::getHighestTemplateVersion(void) const */ void SharedPlayerObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedPlayerObjectTemplate_tag) { @@ -124,7 +124,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -144,10 +144,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -165,4 +163,4 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedPlayerObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerQuestObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerQuestObjectTemplate.cpp index a68fab70..9f7b24d9 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerQuestObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedPlayerQuestObjectTemplate.cpp @@ -24,20 +24,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedPlayerQuestObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ SharedPlayerQuestObjectTemplate::SharedPlayerQuestObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedTangibleObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // SharedPlayerQuestObjectTemplate::SharedPlayerQuestObjectTemplate @@ -46,8 +46,8 @@ SharedPlayerQuestObjectTemplate::SharedPlayerQuestObjectTemplate(const std::stri */ SharedPlayerQuestObjectTemplate::~SharedPlayerQuestObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // SharedPlayerQuestObjectTemplate::~SharedPlayerQuestObjectTemplate /** @@ -113,8 +113,8 @@ Tag SharedPlayerQuestObjectTemplate::getHighestTemplateVersion(void) const */ void SharedPlayerQuestObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedPlayerQuestObjectTemplate_tag) { @@ -124,7 +124,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -144,10 +144,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -165,4 +163,4 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedPlayerQuestObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedResourceContainerObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedResourceContainerObjectTemplate.cpp index 224c3c26..70dde24a 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedResourceContainerObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedResourceContainerObjectTemplate.cpp @@ -23,20 +23,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedResourceContainerObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ SharedResourceContainerObjectTemplate::SharedResourceContainerObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedTangibleObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // SharedResourceContainerObjectTemplate::SharedResourceContainerObjectTemplate @@ -45,8 +45,8 @@ SharedResourceContainerObjectTemplate::SharedResourceContainerObjectTemplate(con */ SharedResourceContainerObjectTemplate::~SharedResourceContainerObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // SharedResourceContainerObjectTemplate::~SharedResourceContainerObjectTemplate /** @@ -112,8 +112,8 @@ Tag SharedResourceContainerObjectTemplate::getHighestTemplateVersion(void) const */ void SharedResourceContainerObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedResourceContainerObjectTemplate_tag) { @@ -123,7 +123,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -143,10 +143,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -164,4 +162,4 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedResourceContainerObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedShipObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedShipObjectTemplate.cpp index c4ef1930..7a22a942 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedShipObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedShipObjectTemplate.cpp @@ -13,7 +13,6 @@ #include "sharedGame/FirstSharedGame.h" #include "sharedGame/SharedShipObjectTemplate.h" - #include "sharedFile/Iff.h" #include "sharedGame/AssetCustomizationManager.h" #include "sharedMath/Vector.h" @@ -30,20 +29,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedShipObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ SharedShipObjectTemplate::SharedShipObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedTangibleObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // SharedShipObjectTemplate::SharedShipObjectTemplate @@ -52,8 +51,8 @@ SharedShipObjectTemplate::SharedShipObjectTemplate(const std::string & filename) */ SharedShipObjectTemplate::~SharedShipObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // SharedShipObjectTemplate::~SharedShipObjectTemplate /** @@ -129,16 +128,16 @@ void SharedShipObjectTemplate::createCustomizationDataPropertyAsNeeded(Object &o // variables since we are a creature. The SharedTangibleObjectTemplate version of // this function sets it to true. bool const skipSharedOwnerVariables = false; - const std::string & appearanceFilename = getAppearanceFilename(); - if(!appearanceFilename.empty()) - { + const std::string & appearanceFilename = getAppearanceFilename(); + if (!appearanceFilename.empty()) + { AssetCustomizationManager::addCustomizationVariablesForAsset(TemporaryCrcString(appearanceFilename.c_str(), true), *customizationData, skipSharedOwnerVariables); } else { //Perhaps it's a POB ship, check the portalLayoutFilename const std::string & portalLayoutFilename = getPortalLayoutFilename(); - AssetCustomizationManager::addCustomizationVariablesForAsset(TemporaryCrcString(portalLayoutFilename.c_str(), true), *customizationData, skipSharedOwnerVariables); + AssetCustomizationManager::addCustomizationVariablesForAsset(TemporaryCrcString(portalLayoutFilename.c_str(), true), *customizationData, skipSharedOwnerVariables); } //-- release local reference to the CustomizationData instance @@ -149,8 +148,6 @@ void SharedShipObjectTemplate::createCustomizationDataPropertyAsNeeded(Object &o //@BEGIN TFD const std::string & SharedShipObjectTemplate::getCockpitFilename() const { - - const SharedShipObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -178,8 +175,6 @@ const std::string & SharedShipObjectTemplate::getCockpitFilename() const bool SharedShipObjectTemplate::getHasWings() const { - - const SharedShipObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -207,8 +202,6 @@ bool SharedShipObjectTemplate::getHasWings() const bool SharedShipObjectTemplate::getPlayerControlled() const { - - const SharedShipObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -236,8 +229,6 @@ bool SharedShipObjectTemplate::getPlayerControlled() const const std::string & SharedShipObjectTemplate::getInteriorLayoutFileName() const { - - const SharedShipObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -263,7 +254,6 @@ const std::string & SharedShipObjectTemplate::getInteriorLayoutFileName() const return value; } // SharedShipObjectTemplate::getInteriorLayoutFileName - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -272,8 +262,8 @@ const std::string & SharedShipObjectTemplate::getInteriorLayoutFileName() const */ void SharedShipObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedShipObjectTemplate_tag) { @@ -283,7 +273,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -303,10 +293,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,4)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 4)) { - - m_versionOk = false; } @@ -336,4 +324,4 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedShipObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedStaticObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedStaticObjectTemplate.cpp index d1b4ebea..b00c7729 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedStaticObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedStaticObjectTemplate.cpp @@ -23,20 +23,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedStaticObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ SharedStaticObjectTemplate::SharedStaticObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // SharedStaticObjectTemplate::SharedStaticObjectTemplate @@ -45,8 +45,8 @@ SharedStaticObjectTemplate::SharedStaticObjectTemplate(const std::string & filen */ SharedStaticObjectTemplate::~SharedStaticObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // SharedStaticObjectTemplate::~SharedStaticObjectTemplate /** @@ -112,8 +112,8 @@ Tag SharedStaticObjectTemplate::getHighestTemplateVersion(void) const */ void SharedStaticObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedStaticObjectTemplate_tag) { @@ -123,7 +123,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -143,10 +143,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -164,4 +162,4 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedStaticObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTangibleObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTangibleObjectTemplate.cpp index 2056fc23..e0cae7f5 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTangibleObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTangibleObjectTemplate.cpp @@ -32,33 +32,33 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedTangibleObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ SharedTangibleObjectTemplate::SharedTangibleObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedObjectTemplate(filename) - ,m_paletteColorCustomizationVariablesLoaded(false) - ,m_paletteColorCustomizationVariablesAppend(false) - ,m_rangedIntCustomizationVariablesLoaded(false) - ,m_rangedIntCustomizationVariablesAppend(false) - ,m_constStringCustomizationVariablesLoaded(false) - ,m_constStringCustomizationVariablesAppend(false) - ,m_socketDestinationsLoaded(false) - ,m_socketDestinationsAppend(false) - ,m_certificationsRequiredLoaded(false) - ,m_certificationsRequiredAppend(false) - ,m_customizationVariableMappingLoaded(false) - ,m_customizationVariableMappingAppend(false) - ,m_versionOk(true) -//@END TFD INIT - ,m_structureFootprint (0) + , m_paletteColorCustomizationVariablesLoaded(false) + , m_paletteColorCustomizationVariablesAppend(false) + , m_rangedIntCustomizationVariablesLoaded(false) + , m_rangedIntCustomizationVariablesAppend(false) + , m_constStringCustomizationVariablesLoaded(false) + , m_constStringCustomizationVariablesAppend(false) + , m_socketDestinationsLoaded(false) + , m_socketDestinationsAppend(false) + , m_certificationsRequiredLoaded(false) + , m_certificationsRequiredAppend(false) + , m_customizationVariableMappingLoaded(false) + , m_customizationVariableMappingAppend(false) + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT + , m_structureFootprint(0) { } // SharedTangibleObjectTemplate::SharedTangibleObjectTemplate @@ -67,7 +67,7 @@ SharedTangibleObjectTemplate::SharedTangibleObjectTemplate(const std::string & f */ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() { -//@BEGIN TFD CLEANUP + //@BEGIN TFD CLEANUP { std::vector::iterator iter; for (iter = m_paletteColorCustomizationVariables.begin(); iter != m_paletteColorCustomizationVariables.end(); ++iter) @@ -122,8 +122,8 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() } m_customizationVariableMapping.clear(); } -//@END TFD CLEANUP - + //@END TFD CLEANUP + if (m_structureFootprint) { delete m_structureFootprint; @@ -189,13 +189,13 @@ Tag SharedTangibleObjectTemplate::getHighestTemplateVersion(void) const */ void SharedTangibleObjectTemplate::postLoad() { - SharedObjectTemplate::postLoad (); + SharedObjectTemplate::postLoad(); //-- load the structure footprint - if (getStructureFootprintFileName ().length () != 0) + if (getStructureFootprintFileName().length() != 0) { - m_structureFootprint = new StructureFootprint (); - m_structureFootprint->load (getStructureFootprintFileName ().c_str ()); + m_structureFootprint = new StructureFootprint(); + m_structureFootprint->load(getStructureFootprintFileName().c_str()); } } @@ -204,7 +204,7 @@ void SharedTangibleObjectTemplate::postLoad() * * @return the structure footprint */ -const StructureFootprint* SharedTangibleObjectTemplate::getStructureFootprint () const +const StructureFootprint* SharedTangibleObjectTemplate::getStructureFootprint() const { return m_structureFootprint; } @@ -236,7 +236,7 @@ const StructureFootprint* SharedTangibleObjectTemplate::getStructureFootprint () */ void SharedTangibleObjectTemplate::createCustomizationDataPropertyAsNeeded(Object &object, bool /* forceCreation */) const { - //-- Properties cannot be added while an object is in the world. Some callers may be in the world, + //-- Properties cannot be added while an object is in the world. Some callers may be in the world, // so temporarily remove the object from the world if necessary. bool shouldBeInWorld = object.isInWorld(); if (shouldBeInWorld) @@ -260,8 +260,6 @@ void SharedTangibleObjectTemplate::createCustomizationDataPropertyAsNeeded(Objec bool const skipSharedOwnerVariables = true; AssetCustomizationManager::addCustomizationVariablesForAsset(TemporaryCrcString(getAppearanceFilename().c_str(), true), *customizationData, skipSharedOwnerVariables); - - //-- release local reference to the CustomizationData instance customizationData->release(); } @@ -281,7 +279,7 @@ void SharedTangibleObjectTemplate::getPaletteColorCustomizationVariables(Palette if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter paletteColorCustomizationVariables in template %s", DataResource::getName())); - return ; + return; } else { @@ -295,10 +293,10 @@ void SharedTangibleObjectTemplate::getPaletteColorCustomizationVariables(Palette { int baseCount = base->getPaletteColorCustomizationVariablesCount(); if (index < baseCount) - { - base->getPaletteColorCustomizationVariables(data, index); - return; - } + { + base->getPaletteColorCustomizationVariables(data, index); + return; + } index -= baseCount; } @@ -325,7 +323,7 @@ void SharedTangibleObjectTemplate::getPaletteColorCustomizationVariablesMin(Pale if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter paletteColorCustomizationVariables in template %s", DataResource::getName())); - return ; + return; } else { @@ -339,10 +337,10 @@ void SharedTangibleObjectTemplate::getPaletteColorCustomizationVariablesMin(Pale { int baseCount = base->getPaletteColorCustomizationVariablesCount(); if (index < baseCount) - { - base->getPaletteColorCustomizationVariablesMin(data, index); - return; - } + { + base->getPaletteColorCustomizationVariablesMin(data, index); + return; + } index -= baseCount; } @@ -369,7 +367,7 @@ void SharedTangibleObjectTemplate::getPaletteColorCustomizationVariablesMax(Pale if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter paletteColorCustomizationVariables in template %s", DataResource::getName())); - return ; + return; } else { @@ -383,10 +381,10 @@ void SharedTangibleObjectTemplate::getPaletteColorCustomizationVariablesMax(Pale { int baseCount = base->getPaletteColorCustomizationVariablesCount(); if (index < baseCount) - { - base->getPaletteColorCustomizationVariablesMax(data, index); - return; - } + { + base->getPaletteColorCustomizationVariablesMax(data, index); + return; + } index -= baseCount; } @@ -437,7 +435,7 @@ void SharedTangibleObjectTemplate::getRangedIntCustomizationVariables(RangedIntC if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter rangedIntCustomizationVariables in template %s", DataResource::getName())); - return ; + return; } else { @@ -451,10 +449,10 @@ void SharedTangibleObjectTemplate::getRangedIntCustomizationVariables(RangedIntC { int baseCount = base->getRangedIntCustomizationVariablesCount(); if (index < baseCount) - { - base->getRangedIntCustomizationVariables(data, index); - return; - } + { + base->getRangedIntCustomizationVariables(data, index); + return; + } index -= baseCount; } @@ -482,7 +480,7 @@ void SharedTangibleObjectTemplate::getRangedIntCustomizationVariablesMin(RangedI if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter rangedIntCustomizationVariables in template %s", DataResource::getName())); - return ; + return; } else { @@ -496,10 +494,10 @@ void SharedTangibleObjectTemplate::getRangedIntCustomizationVariablesMin(RangedI { int baseCount = base->getRangedIntCustomizationVariablesCount(); if (index < baseCount) - { - base->getRangedIntCustomizationVariablesMin(data, index); - return; - } + { + base->getRangedIntCustomizationVariablesMin(data, index); + return; + } index -= baseCount; } @@ -527,7 +525,7 @@ void SharedTangibleObjectTemplate::getRangedIntCustomizationVariablesMax(RangedI if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter rangedIntCustomizationVariables in template %s", DataResource::getName())); - return ; + return; } else { @@ -541,10 +539,10 @@ void SharedTangibleObjectTemplate::getRangedIntCustomizationVariablesMax(RangedI { int baseCount = base->getRangedIntCustomizationVariablesCount(); if (index < baseCount) - { - base->getRangedIntCustomizationVariablesMax(data, index); - return; - } + { + base->getRangedIntCustomizationVariablesMax(data, index); + return; + } index -= baseCount; } @@ -596,7 +594,7 @@ void SharedTangibleObjectTemplate::getConstStringCustomizationVariables(ConstStr if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter constStringCustomizationVariables in template %s", DataResource::getName())); - return ; + return; } else { @@ -610,10 +608,10 @@ void SharedTangibleObjectTemplate::getConstStringCustomizationVariables(ConstStr { int baseCount = base->getConstStringCustomizationVariablesCount(); if (index < baseCount) - { - base->getConstStringCustomizationVariables(data, index); - return; - } + { + base->getConstStringCustomizationVariables(data, index); + return; + } index -= baseCount; } @@ -639,7 +637,7 @@ void SharedTangibleObjectTemplate::getConstStringCustomizationVariablesMin(Const if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter constStringCustomizationVariables in template %s", DataResource::getName())); - return ; + return; } else { @@ -653,10 +651,10 @@ void SharedTangibleObjectTemplate::getConstStringCustomizationVariablesMin(Const { int baseCount = base->getConstStringCustomizationVariablesCount(); if (index < baseCount) - { - base->getConstStringCustomizationVariablesMin(data, index); - return; - } + { + base->getConstStringCustomizationVariablesMin(data, index); + return; + } index -= baseCount; } @@ -682,7 +680,7 @@ void SharedTangibleObjectTemplate::getConstStringCustomizationVariablesMax(Const if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter constStringCustomizationVariables in template %s", DataResource::getName())); - return ; + return; } else { @@ -696,10 +694,10 @@ void SharedTangibleObjectTemplate::getConstStringCustomizationVariablesMax(Const { int baseCount = base->getConstStringCustomizationVariablesCount(); if (index < baseCount) - { - base->getConstStringCustomizationVariablesMax(data, index); - return; - } + { + base->getConstStringCustomizationVariablesMax(data, index); + return; + } index -= baseCount; } @@ -796,8 +794,6 @@ size_t SharedTangibleObjectTemplate::getSocketDestinationsCount(void) const const std::string & SharedTangibleObjectTemplate::getStructureFootprintFileName() const { - - const SharedTangibleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -825,8 +821,6 @@ const std::string & SharedTangibleObjectTemplate::getStructureFootprintFileName( bool SharedTangibleObjectTemplate::getUseStructureFootprintOutline() const { - - const SharedTangibleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -854,8 +848,6 @@ bool SharedTangibleObjectTemplate::getUseStructureFootprintOutline() const bool SharedTangibleObjectTemplate::getTargetable() const { - - const SharedTangibleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -953,7 +945,7 @@ void SharedTangibleObjectTemplate::getCustomizationVariableMapping(Customization if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter customizationVariableMapping in template %s", DataResource::getName())); - return ; + return; } else { @@ -967,10 +959,10 @@ void SharedTangibleObjectTemplate::getCustomizationVariableMapping(Customization { int baseCount = base->getCustomizationVariableMappingCount(); if (index < baseCount) - { - base->getCustomizationVariableMapping(data, index); - return; - } + { + base->getCustomizationVariableMapping(data, index); + return; + } index -= baseCount; } @@ -996,7 +988,7 @@ void SharedTangibleObjectTemplate::getCustomizationVariableMappingMin(Customizat if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter customizationVariableMapping in template %s", DataResource::getName())); - return ; + return; } else { @@ -1010,10 +1002,10 @@ void SharedTangibleObjectTemplate::getCustomizationVariableMappingMin(Customizat { int baseCount = base->getCustomizationVariableMappingCount(); if (index < baseCount) - { - base->getCustomizationVariableMappingMin(data, index); - return; - } + { + base->getCustomizationVariableMappingMin(data, index); + return; + } index -= baseCount; } @@ -1039,7 +1031,7 @@ void SharedTangibleObjectTemplate::getCustomizationVariableMappingMax(Customizat if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == nullptr) { DEBUG_WARNING(true, ("Returning default value for missing parameter customizationVariableMapping in template %s", DataResource::getName())); - return ; + return; } else { @@ -1053,10 +1045,10 @@ void SharedTangibleObjectTemplate::getCustomizationVariableMappingMax(Customizat { int baseCount = base->getCustomizationVariableMappingCount(); if (index < baseCount) - { - base->getCustomizationVariableMappingMax(data, index); - return; - } + { + base->getCustomizationVariableMappingMax(data, index); + return; + } index -= baseCount; } @@ -1095,8 +1087,6 @@ size_t SharedTangibleObjectTemplate::getCustomizationVariableMappingCount(void) SharedTangibleObjectTemplate::ClientVisabilityFlags SharedTangibleObjectTemplate::getClientVisabilityFlag() const { - - const SharedTangibleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1122,7 +1112,6 @@ SharedTangibleObjectTemplate::ClientVisabilityFlags SharedTangibleObjectTemplate return value; } // SharedTangibleObjectTemplate::getClientVisabilityFlag - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -1131,8 +1120,8 @@ SharedTangibleObjectTemplate::ClientVisabilityFlags SharedTangibleObjectTemplate */ void SharedTangibleObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedTangibleObjectTemplate_tag) { @@ -1142,7 +1131,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -1162,10 +1151,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,1,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 1, 0)) { - - m_versionOk = false; } @@ -1309,7 +1296,6 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedTangibleObjectTemplate::load - //============================================================================= // class SharedTangibleObjectTemplate::_ConstStringCustomizationVariable @@ -1358,8 +1344,6 @@ Tag SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::getId(void) const std::string & SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::getVariableName(bool versionOk) const { - - const SharedTangibleObjectTemplate::_ConstStringCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { @@ -1387,8 +1371,6 @@ const std::string & SharedTangibleObjectTemplate::_ConstStringCustomizationVaria const std::string & SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::getConstValue(bool versionOk) const { - - const SharedTangibleObjectTemplate::_ConstStringCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { @@ -1414,7 +1396,6 @@ const std::string & SharedTangibleObjectTemplate::_ConstStringCustomizationVaria return value; } // SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::getConstValue - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -1423,8 +1404,8 @@ const std::string & SharedTangibleObjectTemplate::_ConstStringCustomizationVaria */ void SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -1446,7 +1427,6 @@ char paramName[MAX_NAME_SIZE]; UNREF(file); } // SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::load - //============================================================================= // class SharedTangibleObjectTemplate::_CustomizationVariableMapping @@ -1495,8 +1475,6 @@ Tag SharedTangibleObjectTemplate::_CustomizationVariableMapping::getId(void) con const std::string & SharedTangibleObjectTemplate::_CustomizationVariableMapping::getSourceVariable(bool versionOk) const { - - const SharedTangibleObjectTemplate::_CustomizationVariableMapping * base = nullptr; if (m_baseData != nullptr) { @@ -1524,8 +1502,6 @@ const std::string & SharedTangibleObjectTemplate::_CustomizationVariableMapping: const std::string & SharedTangibleObjectTemplate::_CustomizationVariableMapping::getDependentVariable(bool versionOk) const { - - const SharedTangibleObjectTemplate::_CustomizationVariableMapping * base = nullptr; if (m_baseData != nullptr) { @@ -1551,7 +1527,6 @@ const std::string & SharedTangibleObjectTemplate::_CustomizationVariableMapping: return value; } // SharedTangibleObjectTemplate::_CustomizationVariableMapping::getDependentVariable - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -1560,8 +1535,8 @@ const std::string & SharedTangibleObjectTemplate::_CustomizationVariableMapping: */ void SharedTangibleObjectTemplate::_CustomizationVariableMapping::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -1583,7 +1558,6 @@ char paramName[MAX_NAME_SIZE]; UNREF(file); } // SharedTangibleObjectTemplate::_CustomizationVariableMapping::load - //============================================================================= // class SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable @@ -1632,8 +1606,6 @@ Tag SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getId(void const std::string & SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getVariableName(bool versionOk) const { - - const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { @@ -1661,8 +1633,6 @@ const std::string & SharedTangibleObjectTemplate::_PaletteColorCustomizationVari const std::string & SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getPalettePathName(bool versionOk) const { - - const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { @@ -1690,8 +1660,6 @@ const std::string & SharedTangibleObjectTemplate::_PaletteColorCustomizationVari int SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getDefaultPaletteIndex(bool versionOk) const { - - const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { @@ -1741,8 +1709,6 @@ int SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getDefault int SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getDefaultPaletteIndexMin(bool versionOk) const { - - const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { @@ -1792,8 +1758,6 @@ int SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getDefault int SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getDefaultPaletteIndexMax(bool versionOk) const { - - const SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { @@ -1841,7 +1805,6 @@ int SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getDefault return value; } // SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getDefaultPaletteIndexMax - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -1850,8 +1813,8 @@ int SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getDefault */ void SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -1875,7 +1838,6 @@ char paramName[MAX_NAME_SIZE]; UNREF(file); } // SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::load - //============================================================================= // class SharedTangibleObjectTemplate::_RangedIntCustomizationVariable @@ -1924,8 +1886,6 @@ Tag SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getId(void) c const std::string & SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getVariableName(bool versionOk) const { - - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { @@ -1953,8 +1913,6 @@ const std::string & SharedTangibleObjectTemplate::_RangedIntCustomizationVariabl int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMinValueInclusive(bool versionOk) const { - - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { @@ -2004,8 +1962,6 @@ int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMinValueIn int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMinValueInclusiveMin(bool versionOk) const { - - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { @@ -2055,8 +2011,6 @@ int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMinValueIn int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMinValueInclusiveMax(bool versionOk) const { - - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { @@ -2106,8 +2060,6 @@ int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMinValueIn int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getDefaultValue(bool versionOk) const { - - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { @@ -2157,8 +2109,6 @@ int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getDefaultVal int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getDefaultValueMin(bool versionOk) const { - - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { @@ -2208,8 +2158,6 @@ int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getDefaultVal int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getDefaultValueMax(bool versionOk) const { - - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { @@ -2259,8 +2207,6 @@ int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getDefaultVal int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMaxValueExclusive(bool versionOk) const { - - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { @@ -2310,8 +2256,6 @@ int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMaxValueEx int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMaxValueExclusiveMin(bool versionOk) const { - - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { @@ -2361,8 +2305,6 @@ int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMaxValueEx int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMaxValueExclusiveMax(bool versionOk) const { - - const SharedTangibleObjectTemplate::_RangedIntCustomizationVariable * base = nullptr; if (m_baseData != nullptr) { @@ -2410,7 +2352,6 @@ int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMaxValueEx return value; } // SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMaxValueExclusiveMax - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -2419,8 +2360,8 @@ int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getMaxValueEx */ void SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -2446,4 +2387,4 @@ char paramName[MAX_NAME_SIZE]; UNREF(file); } // SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTerrainSurfaceObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTerrainSurfaceObjectTemplate.cpp index b0724d3a..b2b26568 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTerrainSurfaceObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedTerrainSurfaceObjectTemplate.cpp @@ -23,20 +23,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedTerrainSurfaceObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ SharedTerrainSurfaceObjectTemplate::SharedTerrainSurfaceObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : ObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // SharedTerrainSurfaceObjectTemplate::SharedTerrainSurfaceObjectTemplate @@ -45,8 +45,8 @@ SharedTerrainSurfaceObjectTemplate::SharedTerrainSurfaceObjectTemplate(const std */ SharedTerrainSurfaceObjectTemplate::~SharedTerrainSurfaceObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // SharedTerrainSurfaceObjectTemplate::~SharedTerrainSurfaceObjectTemplate /** @@ -105,8 +105,6 @@ Tag SharedTerrainSurfaceObjectTemplate::getHighestTemplateVersion(void) const //@BEGIN TFD float SharedTerrainSurfaceObjectTemplate::getCover() const { - - const SharedTerrainSurfaceObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -156,8 +154,6 @@ float SharedTerrainSurfaceObjectTemplate::getCover() const float SharedTerrainSurfaceObjectTemplate::getCoverMin() const { - - const SharedTerrainSurfaceObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -207,8 +203,6 @@ float SharedTerrainSurfaceObjectTemplate::getCoverMin() const float SharedTerrainSurfaceObjectTemplate::getCoverMax() const { - - const SharedTerrainSurfaceObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -258,8 +252,6 @@ float SharedTerrainSurfaceObjectTemplate::getCoverMax() const const std::string & SharedTerrainSurfaceObjectTemplate::getSurfaceType() const { - - const SharedTerrainSurfaceObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -285,7 +277,6 @@ const std::string & SharedTerrainSurfaceObjectTemplate::getSurfaceType() const return value; } // SharedTerrainSurfaceObjectTemplate::getSurfaceType - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -294,8 +285,8 @@ const std::string & SharedTerrainSurfaceObjectTemplate::getSurfaceType() const */ void SharedTerrainSurfaceObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedTerrainSurfaceObjectTemplate_tag) { @@ -304,7 +295,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -324,10 +315,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -351,4 +340,4 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedTerrainSurfaceObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedUniverseObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedUniverseObjectTemplate.cpp index bb5fbff4..e1ced8e6 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedUniverseObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedUniverseObjectTemplate.cpp @@ -24,20 +24,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedUniverseObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ SharedUniverseObjectTemplate::SharedUniverseObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // SharedUniverseObjectTemplate::SharedUniverseObjectTemplate @@ -46,8 +46,8 @@ SharedUniverseObjectTemplate::SharedUniverseObjectTemplate(const std::string & f */ SharedUniverseObjectTemplate::~SharedUniverseObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // SharedUniverseObjectTemplate::~SharedUniverseObjectTemplate /** @@ -113,8 +113,8 @@ Tag SharedUniverseObjectTemplate::getHighestTemplateVersion(void) const */ void SharedUniverseObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedUniverseObjectTemplate_tag) { @@ -124,7 +124,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -144,10 +144,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -165,4 +163,4 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedUniverseObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedVehicleObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedVehicleObjectTemplate.cpp index b48e6d42..514e9511 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedVehicleObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedVehicleObjectTemplate.cpp @@ -23,20 +23,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedVehicleObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ SharedVehicleObjectTemplate::SharedVehicleObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedTangibleObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // SharedVehicleObjectTemplate::SharedVehicleObjectTemplate @@ -45,8 +45,8 @@ SharedVehicleObjectTemplate::SharedVehicleObjectTemplate(const std::string & fil */ SharedVehicleObjectTemplate::~SharedVehicleObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // SharedVehicleObjectTemplate::~SharedVehicleObjectTemplate /** @@ -252,8 +252,6 @@ float SharedVehicleObjectTemplate::getSpeedMax(MovementTypes index) const float SharedVehicleObjectTemplate::getSlopeAversion() const { - - const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -303,8 +301,6 @@ float SharedVehicleObjectTemplate::getSlopeAversion() const float SharedVehicleObjectTemplate::getSlopeAversionMin() const { - - const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -354,8 +350,6 @@ float SharedVehicleObjectTemplate::getSlopeAversionMin() const float SharedVehicleObjectTemplate::getSlopeAversionMax() const { - - const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -405,8 +399,6 @@ float SharedVehicleObjectTemplate::getSlopeAversionMax() const float SharedVehicleObjectTemplate::getHoverValue() const { - - const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -456,8 +448,6 @@ float SharedVehicleObjectTemplate::getHoverValue() const float SharedVehicleObjectTemplate::getHoverValueMin() const { - - const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -507,8 +497,6 @@ float SharedVehicleObjectTemplate::getHoverValueMin() const float SharedVehicleObjectTemplate::getHoverValueMax() const { - - const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -558,8 +546,6 @@ float SharedVehicleObjectTemplate::getHoverValueMax() const float SharedVehicleObjectTemplate::getTurnRate() const { - - const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -609,8 +595,6 @@ float SharedVehicleObjectTemplate::getTurnRate() const float SharedVehicleObjectTemplate::getTurnRateMin() const { - - const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -660,8 +644,6 @@ float SharedVehicleObjectTemplate::getTurnRateMin() const float SharedVehicleObjectTemplate::getTurnRateMax() const { - - const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -711,8 +693,6 @@ float SharedVehicleObjectTemplate::getTurnRateMax() const float SharedVehicleObjectTemplate::getMaxVelocity() const { - - const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -762,8 +742,6 @@ float SharedVehicleObjectTemplate::getMaxVelocity() const float SharedVehicleObjectTemplate::getMaxVelocityMin() const { - - const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -813,8 +791,6 @@ float SharedVehicleObjectTemplate::getMaxVelocityMin() const float SharedVehicleObjectTemplate::getMaxVelocityMax() const { - - const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -864,8 +840,6 @@ float SharedVehicleObjectTemplate::getMaxVelocityMax() const float SharedVehicleObjectTemplate::getAcceleration() const { - - const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -915,8 +889,6 @@ float SharedVehicleObjectTemplate::getAcceleration() const float SharedVehicleObjectTemplate::getAccelerationMin() const { - - const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -966,8 +938,6 @@ float SharedVehicleObjectTemplate::getAccelerationMin() const float SharedVehicleObjectTemplate::getAccelerationMax() const { - - const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1017,8 +987,6 @@ float SharedVehicleObjectTemplate::getAccelerationMax() const float SharedVehicleObjectTemplate::getBraking() const { - - const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1068,8 +1036,6 @@ float SharedVehicleObjectTemplate::getBraking() const float SharedVehicleObjectTemplate::getBrakingMin() const { - - const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1119,8 +1085,6 @@ float SharedVehicleObjectTemplate::getBrakingMin() const float SharedVehicleObjectTemplate::getBrakingMax() const { - - const SharedVehicleObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -1168,7 +1132,6 @@ float SharedVehicleObjectTemplate::getBrakingMax() const return value; } // SharedVehicleObjectTemplate::getBrakingMax - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -1177,8 +1140,8 @@ float SharedVehicleObjectTemplate::getBrakingMax() const */ void SharedVehicleObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedVehicleObjectTemplate_tag) { @@ -1188,7 +1151,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -1208,10 +1171,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -1259,4 +1220,4 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedVehicleObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWaypointObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWaypointObjectTemplate.cpp index a5f730a2..d5c089f9 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWaypointObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWaypointObjectTemplate.cpp @@ -23,20 +23,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedWaypointObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ SharedWaypointObjectTemplate::SharedWaypointObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedIntangibleObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // SharedWaypointObjectTemplate::SharedWaypointObjectTemplate @@ -45,8 +45,8 @@ SharedWaypointObjectTemplate::SharedWaypointObjectTemplate(const std::string & f */ SharedWaypointObjectTemplate::~SharedWaypointObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // SharedWaypointObjectTemplate::~SharedWaypointObjectTemplate /** @@ -112,8 +112,8 @@ Tag SharedWaypointObjectTemplate::getHighestTemplateVersion(void) const */ void SharedWaypointObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedWaypointObjectTemplate_tag) { @@ -123,7 +123,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -143,10 +143,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { - - m_versionOk = false; } @@ -164,4 +162,4 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedWaypointObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWeaponObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWeaponObjectTemplate.cpp index 4b8d05b7..8190a334 100755 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWeaponObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedWeaponObjectTemplate.cpp @@ -23,20 +23,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool SharedWeaponObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ SharedWeaponObjectTemplate::SharedWeaponObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedTangibleObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // SharedWeaponObjectTemplate::SharedWeaponObjectTemplate @@ -45,8 +45,8 @@ SharedWeaponObjectTemplate::SharedWeaponObjectTemplate(const std::string & filen */ SharedWeaponObjectTemplate::~SharedWeaponObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // SharedWeaponObjectTemplate::~SharedWeaponObjectTemplate /** @@ -105,8 +105,6 @@ Tag SharedWeaponObjectTemplate::getHighestTemplateVersion(void) const //@BEGIN TFD const std::string & SharedWeaponObjectTemplate::getWeaponEffect() const { - - const SharedWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -134,8 +132,6 @@ const std::string & SharedWeaponObjectTemplate::getWeaponEffect() const int SharedWeaponObjectTemplate::getWeaponEffectIndex() const { - - const SharedWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -185,8 +181,6 @@ int SharedWeaponObjectTemplate::getWeaponEffectIndex() const int SharedWeaponObjectTemplate::getWeaponEffectIndexMin() const { - - const SharedWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -236,8 +230,6 @@ int SharedWeaponObjectTemplate::getWeaponEffectIndexMin() const int SharedWeaponObjectTemplate::getWeaponEffectIndexMax() const { - - const SharedWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -287,8 +279,6 @@ int SharedWeaponObjectTemplate::getWeaponEffectIndexMax() const SharedWeaponObjectTemplate::AttackType SharedWeaponObjectTemplate::getAttackType() const { - - const SharedWeaponObjectTemplate * base = nullptr; if (m_baseData != nullptr) { @@ -314,7 +304,6 @@ SharedWeaponObjectTemplate::AttackType SharedWeaponObjectTemplate::getAttackType return value; } // SharedWeaponObjectTemplate::getAttackType - /** * Loads the template data from an iff file. We should already be in the form * for this template. @@ -323,8 +312,8 @@ SharedWeaponObjectTemplate::AttackType SharedWeaponObjectTemplate::getAttackType */ void SharedWeaponObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedWeaponObjectTemplate_tag) { @@ -334,7 +323,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -354,10 +343,8 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,4)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 4)) { - - m_versionOk = false; } @@ -385,4 +372,4 @@ char paramName[MAX_NAME_SIZE]; return; } // SharedWeaponObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedMath/src/shared/Volume.cpp b/engine/shared/library/sharedMath/src/shared/Volume.cpp index 65a8c69f..2ab0d658 100755 --- a/engine/shared/library/sharedMath/src/shared/Volume.cpp +++ b/engine/shared/library/sharedMath/src/shared/Volume.cpp @@ -25,9 +25,9 @@ // @param vertexList Co-planar set of points describing the siloutte edges of the volume. Volume::Volume(const Vector &originPoint, const int numberOfVertices, const Vector * const vertexList) -: + : m_numberOfPlanes(numberOfVertices + 1), - m_plane(new Plane[ static_cast(m_numberOfPlanes) ]) + m_plane(new Plane[static_cast(m_numberOfPlanes)]) { NOT_NULL(vertexList); DEBUG_FATAL(numberOfVertices < 3, ("At least 3 vertices are necessary")); @@ -37,58 +37,58 @@ Volume::Volume(const Vector &originPoint, const int numberOfVertices, const Vect // build the sides for (int i = 1; i < numberOfVertices; ++i) - m_plane[i].set(originPoint, vertexList[i-1], vertexList[i]); - m_plane[numberOfVertices].set(originPoint, vertexList[numberOfVertices-1], vertexList[0]); + m_plane[i].set(originPoint, vertexList[i - 1], vertexList[i]); + m_plane[numberOfVertices].set(originPoint, vertexList[numberOfVertices - 1], vertexList[0]); } // ---------------------------------------------------------------------- /** * Create an undefined volume - * + * * This constructor creates a volume consisting of the specified number of planes, * but does not set up the plane data. - * + * * @param numberOfPlanes Number of planes in the volume. */ Volume::Volume(const int numberOfPlanes) -: + : m_numberOfPlanes(numberOfPlanes), - m_plane(new Plane[ static_cast(m_numberOfPlanes) ]) + m_plane(new Plane[static_cast(m_numberOfPlanes)]) { } // ---------------------------------------------------------------------- /** * Construct a new volume from another, transformed by the specified transformation. - * + * * @param other The other volume * @param trans The transform to be applied. */ -Volume::Volume (const Volume &rhs, const Transform &newTransform) -: +Volume::Volume(const Volume &rhs, const Transform &newTransform) + : m_numberOfPlanes(rhs.m_numberOfPlanes), - m_plane(new Plane[ static_cast(m_numberOfPlanes) ]) + m_plane(new Plane[static_cast(m_numberOfPlanes)]) { for (int i = 0; i < m_numberOfPlanes; ++i) - m_plane [i].set(rhs.m_plane[i], newTransform); + m_plane[i].set(rhs.m_plane[i], newTransform); } // ---------------------------------------------------------------------- Volume::~Volume() { - delete [] m_plane; + delete[] m_plane; } // ---------------------------------------------------------------------- /** * Set a specific plane in the volume - * + * * This routine can be used to build up a volume after having used the * constructor that takes a number of planes. - * + * * @param index The plane to modify. * @param plane The new value for the plane data. */ @@ -102,10 +102,10 @@ void Volume::setPlane(const int index, const Plane &plane) // ---------------------------------------------------------------------- /** * Set a specific plane in the volume - * + * * This routine can be used to build up a volume after having used the * constructor that takes a number of planes. - * + * * @param index The plane to modify. * @param plane The new value for the plane data. */ @@ -119,7 +119,7 @@ const Plane &Volume::getPlane(const int index) const // ---------------------------------------------------------------------- /** * Test a point against a volume - * + * * @param point Point to test. * @return True if the point is within the volume. */ @@ -136,7 +136,7 @@ bool Volume::contains(const Vector &point) const // ---------------------------------------------------------------------- /** * See if the volume completely contains the sphere - * + * * @param sphere The sphere to check. * @return True if the entire sphere is within the volume, otherwise false. */ @@ -156,7 +156,7 @@ bool Volume::contains(const Sphere &sphere) const // ---------------------------------------------------------------------- /** * Test a point cloud against a volume - * + * * @param pointCloud Point cloud to test. * @param numberOfPoints Number of points in the point cloud. * @return True if the point is within the volume. @@ -168,7 +168,7 @@ bool Volume::contains(const Vector *pointCloud, int numberOfPoints) const DEBUG_FATAL(numberOfPoints <= 0, ("numberOfPoints is less than 1")); for (int i = 0; i < m_numberOfPlanes; ++i) - for (int j = 0; i < numberOfPoints; ++j) + for (int j = 0; j < numberOfPoints; ++j) if (m_plane[i].computeDistanceTo(pointCloud[j]) > 0) return false; @@ -178,9 +178,9 @@ bool Volume::contains(const Vector *pointCloud, int numberOfPoints) const // ---------------------------------------------------------------------- /** * See if the volume intersects a sphere. - * + * * The sphere is in the volume if any portion of it is within the volume. - * + * * @param sphere The sphere to check. * @return True if the any portion of the sphere is within the volume, otherwise false. */ @@ -200,9 +200,9 @@ bool Volume::intersects(const Sphere &sphere) const // ---------------------------------------------------------------------- /** * See if the volume intersects the segment. - * + * * The segment is considered to be in the volume if both points test on the negative side of any plane - * + * * @param start Start point of segment. * @param end End point of segment. * @return False if any segment is on the negative side of any plane @@ -223,12 +223,12 @@ bool Volume::intersects(Vector const & start, Vector const & end) const // ---------------------------------------------------------------------- /** * Fast Conservative check of a point cloud against the volume - * + * * This routine will return true if the point could is completely outside any one * plane of the volume. If the routine returns true, the point cloud is definitely * outside the volume. However, a false result does not guarentee that the point * cloud intersects the volume. - * + * * @param pointCloud Point cloud to test. * @param numberOfPoints Number of points in the point cloud. * @return See remarks for more information. @@ -255,7 +255,7 @@ bool Volume::fastConservativeExcludes(const Vector *pointCloud, int numberOfPoin // ---------------------------------------------------------------------- /** * Transform the volume by the specified transformation. - * + * * @param transform The transform to be applied. */ @@ -268,7 +268,7 @@ void Volume::transform(const Transform &newTransform) // ---------------------------------------------------------------------- /** * Transform the specified volume by the specified transformation. - * + * * @param source The source volume to transform. * @param transform The transform to be applied. */ @@ -277,13 +277,13 @@ void Volume::transform(const Volume &source, const Transform &newTransform) { if (m_numberOfPlanes != source.m_numberOfPlanes) { - delete [] m_plane; + delete[] m_plane; m_numberOfPlanes = source.m_numberOfPlanes; - m_plane = new Plane[ static_cast(m_numberOfPlanes) ]; + m_plane = new Plane[static_cast(m_numberOfPlanes)]; } for (int i = 0; i < m_numberOfPlanes; ++i) m_plane[i].set(source.m_plane[i], newTransform); } -// ====================================================================== +// ====================================================================== \ No newline at end of file diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerArmorTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerArmorTemplate.cpp index c162ae34..4ca36d87 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerArmorTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerArmorTemplate.cpp @@ -21,16 +21,17 @@ #include #include - /** * Class constructor. */ ServerArmorTemplate::ServerArmorTemplate(const std::string & filename) //@BEGIN TFD INIT : TpfTemplate(filename) - ,m_specialProtectionLoaded(false) - ,m_specialProtectionAppend(false) -//@END TFD INIT + , m_specialProtectionLoaded(false) + , m_specialProtectionAppend(false) + , m_templateVersion(0) + , m_versionOk(false) + //@END TFD INIT { } // ServerArmorTemplate::ServerArmorTemplate @@ -39,7 +40,7 @@ ServerArmorTemplate::ServerArmorTemplate(const std::string & filename) */ ServerArmorTemplate::~ServerArmorTemplate() { -//@BEGIN TFD CLEANUP + //@BEGIN TFD CLEANUP { std::vector::iterator iter; for (iter = m_specialProtection.begin(); iter != m_specialProtection.end(); ++iter) @@ -49,7 +50,7 @@ ServerArmorTemplate::~ServerArmorTemplate() } m_specialProtection.clear(); } -//@END TFD CLEANUP + //@END TFD CLEANUP } // ServerArmorTemplate::~ServerArmorTemplate /** @@ -274,7 +275,6 @@ bool ServerArmorTemplate::isAppend(const char *name) const return TpfTemplate::isAppend(name); } // ServerArmorTemplate::isAppend - int ServerArmorTemplate::getListLength(const char *name) const { if (strcmp(name, "specialProtection") == 0) @@ -297,8 +297,8 @@ int ServerArmorTemplate::getListLength(const char *name) const */ void ServerArmorTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != ServerArmorTemplate_tag) { @@ -308,7 +308,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -328,7 +328,7 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,1)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 1)) { if (DataLint::isEnabled()) DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); @@ -401,18 +401,18 @@ char paramName[MAX_NAME_SIZE]; */ void ServerArmorTemplate::save(Iff &file) { -int count; + int count; file.insertForm(ServerArmorTemplate_tag); if (m_baseTemplateName.size() != 0) { - file.insertForm(TAG(D,E,R,V)); + file.insertForm(TAG(D, E, R, V)); file.insertChunk(TAG(X, X, X, X)); file.insertChunkData(m_baseTemplateName.c_str(), m_baseTemplateName.size() + 1); file.exitChunk(); file.exitForm(); } - file.insertForm(TAG(0,0,0,1)); + file.insertForm(TAG(0, 0, 0, 1)); file.allowNonlinearFunctions(); int paramCount = 0; @@ -447,7 +447,7 @@ int count; count = m_specialProtection.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_specialProtection[i]->saveToIff(file);} + m_specialProtection[i]->saveToIff(file); } file.exitChunk(); ++paramCount; // save vulnerability @@ -462,7 +462,7 @@ int count; count = 3; file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < 3; ++i) - m_encumbrance[i].saveToIff(file);} + m_encumbrance[i].saveToIff(file); } file.exitChunk(); ++paramCount; @@ -477,7 +477,6 @@ int count; file.exitForm(); } // ServerArmorTemplate::save - //============================================================================= // class ServerArmorTemplate::_SpecialProtection @@ -621,7 +620,6 @@ bool ServerArmorTemplate::_SpecialProtection::isAppend(const char *name) const return TpfTemplate::isAppend(name); } // ServerArmorTemplate::_SpecialProtection::isAppend - int ServerArmorTemplate::_SpecialProtection::getListLength(const char *name) const { return TpfTemplate::getListLength(name); @@ -635,8 +633,8 @@ int ServerArmorTemplate::_SpecialProtection::getListLength(const char *name) con */ void ServerArmorTemplate::_SpecialProtection::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -666,7 +664,7 @@ char paramName[MAX_NAME_SIZE]; */ void ServerArmorTemplate::_SpecialProtection::save(Iff &file) { -int count; + int count; file.insertForm(_SpecialProtection_tag); @@ -695,4 +693,4 @@ int count; UNREF(count); } // ServerArmorTemplate::_SpecialProtection::save -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerCreatureObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerCreatureObjectTemplate.cpp index f63f0d43..f70b5fd7 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerCreatureObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerCreatureObjectTemplate.cpp @@ -20,17 +20,17 @@ #include #include - - /** * Class constructor. */ ServerCreatureObjectTemplate::ServerCreatureObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : ServerTangibleObjectTemplate(filename) - ,m_attribModsLoaded(false) - ,m_attribModsAppend(false) -//@END TFD INIT + , m_attribModsLoaded(false) + , m_attribModsAppend(false) + , m_templateVersion(0) + , m_versionOk(false) + //@END TFD INIT { } // ServerCreatureObjectTemplate::ServerCreatureObjectTemplate @@ -39,7 +39,7 @@ ServerCreatureObjectTemplate::ServerCreatureObjectTemplate(const std::string & f */ ServerCreatureObjectTemplate::~ServerCreatureObjectTemplate() { -//@BEGIN TFD CLEANUP + //@BEGIN TFD CLEANUP { std::vector::iterator iter; for (iter = m_attribMods.begin(); iter != m_attribMods.end(); ++iter) @@ -49,7 +49,7 @@ ServerCreatureObjectTemplate::~ServerCreatureObjectTemplate() } m_attribMods.clear(); } -//@END TFD CLEANUP + //@END TFD CLEANUP } // ServerCreatureObjectTemplate::~ServerCreatureObjectTemplate /** @@ -406,7 +406,6 @@ bool ServerCreatureObjectTemplate::isAppend(const char *name) const return ServerTangibleObjectTemplate::isAppend(name); } // ServerCreatureObjectTemplate::isAppend - int ServerCreatureObjectTemplate::getListLength(const char *name) const { if (strcmp(name, "attributes") == 0) @@ -445,8 +444,8 @@ int ServerCreatureObjectTemplate::getListLength(const char *name) const */ void ServerCreatureObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != ServerCreatureObjectTemplate_tag) { @@ -456,7 +455,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -476,7 +475,7 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,5)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 5)) { if (DataLint::isEnabled()) DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); @@ -615,18 +614,18 @@ char paramName[MAX_NAME_SIZE]; */ void ServerCreatureObjectTemplate::save(Iff &file) { -int count; + int count; file.insertForm(ServerCreatureObjectTemplate_tag); if (m_baseTemplateName.size() != 0) { - file.insertForm(TAG(D,E,R,V)); + file.insertForm(TAG(D, E, R, V)); file.insertChunk(TAG(X, X, X, X)); file.insertChunkData(m_baseTemplateName.c_str(), m_baseTemplateName.size() + 1); file.exitChunk(); file.exitForm(); } - file.insertForm(TAG(0,0,0,5)); + file.insertForm(TAG(0, 0, 0, 5)); file.allowNonlinearFunctions(); int paramCount = 0; @@ -643,7 +642,7 @@ int count; count = 6; file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < 6; ++i) - m_attributes[i].saveToIff(file);} + m_attributes[i].saveToIff(file); } file.exitChunk(); ++paramCount; // save minAttributes @@ -652,7 +651,7 @@ int count; count = 6; file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < 6; ++i) - m_minAttributes[i].saveToIff(file);} + m_minAttributes[i].saveToIff(file); } file.exitChunk(); ++paramCount; // save maxAttributes @@ -661,7 +660,7 @@ int count; count = 6; file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < 6; ++i) - m_maxAttributes[i].saveToIff(file);} + m_maxAttributes[i].saveToIff(file); } file.exitChunk(); ++paramCount; // save minDrainModifier @@ -700,7 +699,7 @@ int count; count = m_attribMods.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_attribMods[i]->saveToIff(file);} + m_attribMods[i]->saveToIff(file); } file.exitChunk(); ++paramCount; // save shockWounds @@ -733,7 +732,7 @@ int count; count = 4; file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < 4; ++i) - m_maxMentalStates[i].saveToIff(file);} + m_maxMentalStates[i].saveToIff(file); } file.exitChunk(); ++paramCount; // save mentalStatesDecay @@ -742,7 +741,7 @@ int count; count = 4; file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < 4; ++i) - m_mentalStatesDecay[i].saveToIff(file);} + m_mentalStatesDecay[i].saveToIff(file); } file.exitChunk(); ++paramCount; @@ -757,4 +756,4 @@ int count; file.exitForm(); } // ServerCreatureObjectTemplate::save -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerDraftSchematicObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerDraftSchematicObjectTemplate.cpp index 53c05125..e86547a9 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerDraftSchematicObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerDraftSchematicObjectTemplate.cpp @@ -20,21 +20,21 @@ #include #include - - /** * Class constructor. */ ServerDraftSchematicObjectTemplate::ServerDraftSchematicObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : ServerIntangibleObjectTemplate(filename) - ,m_slotsLoaded(false) - ,m_slotsAppend(false) - ,m_skillCommandsLoaded(false) - ,m_skillCommandsAppend(false) - ,m_manufactureScriptsLoaded(false) - ,m_manufactureScriptsAppend(false) -//@END TFD INIT + , m_slotsLoaded(false) + , m_slotsAppend(false) + , m_skillCommandsLoaded(false) + , m_skillCommandsAppend(false) + , m_manufactureScriptsLoaded(false) + , m_manufactureScriptsAppend(false) + , m_templateVersion(0) + , m_versionOk(false) + //@END TFD INIT { } // ServerDraftSchematicObjectTemplate::ServerDraftSchematicObjectTemplate @@ -43,7 +43,7 @@ ServerDraftSchematicObjectTemplate::ServerDraftSchematicObjectTemplate(const std */ ServerDraftSchematicObjectTemplate::~ServerDraftSchematicObjectTemplate() { -//@BEGIN TFD CLEANUP + //@BEGIN TFD CLEANUP { std::vector::iterator iter; for (iter = m_slots.begin(); iter != m_slots.end(); ++iter) @@ -71,7 +71,7 @@ ServerDraftSchematicObjectTemplate::~ServerDraftSchematicObjectTemplate() } m_manufactureScripts.clear(); } -//@END TFD CLEANUP + //@END TFD CLEANUP } // ServerDraftSchematicObjectTemplate::~ServerDraftSchematicObjectTemplate /** @@ -372,7 +372,6 @@ bool ServerDraftSchematicObjectTemplate::isAppend(const char *name) const return ServerIntangibleObjectTemplate::isAppend(name); } // ServerDraftSchematicObjectTemplate::isAppend - int ServerDraftSchematicObjectTemplate::getListLength(const char *name) const { if (strcmp(name, "slots") == 0) @@ -399,8 +398,8 @@ int ServerDraftSchematicObjectTemplate::getListLength(const char *name) const */ void ServerDraftSchematicObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != ServerDraftSchematicObjectTemplate_tag) { @@ -410,7 +409,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -430,7 +429,7 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,7)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 7)) { if (DataLint::isEnabled()) DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); @@ -533,18 +532,18 @@ char paramName[MAX_NAME_SIZE]; */ void ServerDraftSchematicObjectTemplate::save(Iff &file) { -int count; + int count; file.insertForm(ServerDraftSchematicObjectTemplate_tag); if (m_baseTemplateName.size() != 0) { - file.insertForm(TAG(D,E,R,V)); + file.insertForm(TAG(D, E, R, V)); file.insertChunk(TAG(X, X, X, X)); file.insertChunkData(m_baseTemplateName.c_str(), m_baseTemplateName.size() + 1); file.exitChunk(); file.exitForm(); } - file.insertForm(TAG(0,0,0,7)); + file.insertForm(TAG(0, 0, 0, 7)); file.allowNonlinearFunctions(); int paramCount = 0; @@ -579,7 +578,7 @@ int count; count = m_slots.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_slots[i]->saveToIff(file);} + m_slots[i]->saveToIff(file); } file.exitChunk(); ++paramCount; if (!m_skillCommandsLoaded) @@ -594,7 +593,7 @@ int count; count = m_skillCommands.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_skillCommands[i]->saveToIff(file);} + m_skillCommands[i]->saveToIff(file); } file.exitChunk(); ++paramCount; // save destroyIngredients @@ -615,7 +614,7 @@ int count; count = m_manufactureScripts.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_manufactureScripts[i]->saveToIff(file);} + m_manufactureScripts[i]->saveToIff(file); } file.exitChunk(); ++paramCount; // save itemsPerContainer @@ -648,7 +647,6 @@ int count; file.exitForm(); } // ServerDraftSchematicObjectTemplate::save - //============================================================================= // class ServerDraftSchematicObjectTemplate::_IngredientSlot @@ -657,8 +655,8 @@ int count; */ ServerDraftSchematicObjectTemplate::_IngredientSlot::_IngredientSlot(const std::string & filename) : TpfTemplate(filename) - ,m_optionsLoaded(false) - ,m_optionsAppend(false) + , m_optionsLoaded(false) + , m_optionsAppend(false) { } // ServerDraftSchematicObjectTemplate::_IngredientSlot::_IngredientSlot @@ -880,7 +878,6 @@ bool ServerDraftSchematicObjectTemplate::_IngredientSlot::isAppend(const char *n return TpfTemplate::isAppend(name); } // ServerDraftSchematicObjectTemplate::_IngredientSlot::isAppend - int ServerDraftSchematicObjectTemplate::_IngredientSlot::getListLength(const char *name) const { if (strcmp(name, "options") == 0) @@ -899,8 +896,8 @@ int ServerDraftSchematicObjectTemplate::_IngredientSlot::getListLength(const cha */ void ServerDraftSchematicObjectTemplate::_IngredientSlot::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -955,7 +952,7 @@ char paramName[MAX_NAME_SIZE]; */ void ServerDraftSchematicObjectTemplate::_IngredientSlot::save(Iff &file) { -int count; + int count; file.insertForm(_IngredientSlot_tag); @@ -985,7 +982,7 @@ int count; count = m_options.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_options[i]->saveToIff(file);} + m_options[i]->saveToIff(file); } file.exitChunk(); ++paramCount; // save optionalSkillCommand @@ -1016,4 +1013,4 @@ int count; file.exitForm(true); } // ServerDraftSchematicObjectTemplate::_IngredientSlot::save -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerManufactureSchematicObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerManufactureSchematicObjectTemplate.cpp index 73735880..63d2033e 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerManufactureSchematicObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerManufactureSchematicObjectTemplate.cpp @@ -20,19 +20,19 @@ #include #include - - /** * Class constructor. */ ServerManufactureSchematicObjectTemplate::ServerManufactureSchematicObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : ServerIntangibleObjectTemplate(filename) - ,m_ingredientsLoaded(false) - ,m_ingredientsAppend(false) - ,m_attributesLoaded(false) - ,m_attributesAppend(false) -//@END TFD INIT + , m_ingredientsLoaded(false) + , m_ingredientsAppend(false) + , m_attributesLoaded(false) + , m_attributesAppend(false) + , m_templateVersion(0) + , m_versionOk(false) + //@END TFD INIT { } // ServerManufactureSchematicObjectTemplate::ServerManufactureSchematicObjectTemplate @@ -41,7 +41,7 @@ ServerManufactureSchematicObjectTemplate::ServerManufactureSchematicObjectTempla */ ServerManufactureSchematicObjectTemplate::~ServerManufactureSchematicObjectTemplate() { -//@BEGIN TFD CLEANUP + //@BEGIN TFD CLEANUP { std::vector::iterator iter; for (iter = m_ingredients.begin(); iter != m_ingredients.end(); ++iter) @@ -60,7 +60,7 @@ ServerManufactureSchematicObjectTemplate::~ServerManufactureSchematicObjectTempl } m_attributes.clear(); } -//@END TFD CLEANUP + //@END TFD CLEANUP } // ServerManufactureSchematicObjectTemplate::~ServerManufactureSchematicObjectTemplate /** @@ -282,7 +282,6 @@ bool ServerManufactureSchematicObjectTemplate::isAppend(const char *name) const return ServerIntangibleObjectTemplate::isAppend(name); } // ServerManufactureSchematicObjectTemplate::isAppend - int ServerManufactureSchematicObjectTemplate::getListLength(const char *name) const { if (strcmp(name, "ingredients") == 0) @@ -305,8 +304,8 @@ int ServerManufactureSchematicObjectTemplate::getListLength(const char *name) co */ void ServerManufactureSchematicObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != ServerManufactureSchematicObjectTemplate_tag) { @@ -316,7 +315,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -336,7 +335,7 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { if (DataLint::isEnabled()) DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); @@ -412,18 +411,18 @@ char paramName[MAX_NAME_SIZE]; */ void ServerManufactureSchematicObjectTemplate::save(Iff &file) { -int count; + int count; file.insertForm(ServerManufactureSchematicObjectTemplate_tag); if (m_baseTemplateName.size() != 0) { - file.insertForm(TAG(D,E,R,V)); + file.insertForm(TAG(D, E, R, V)); file.insertChunk(TAG(X, X, X, X)); file.insertChunkData(m_baseTemplateName.c_str(), m_baseTemplateName.size() + 1); file.exitChunk(); file.exitForm(); } - file.insertForm(TAG(0,0,0,0)); + file.insertForm(TAG(0, 0, 0, 0)); file.allowNonlinearFunctions(); int paramCount = 0; @@ -452,7 +451,7 @@ int count; count = m_ingredients.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_ingredients[i]->saveToIff(file);} + m_ingredients[i]->saveToIff(file); } file.exitChunk(); ++paramCount; // save itemCount @@ -473,7 +472,7 @@ int count; count = m_attributes.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_attributes[i]->saveToIff(file);} + m_attributes[i]->saveToIff(file); } file.exitChunk(); ++paramCount; @@ -488,7 +487,6 @@ int count; file.exitForm(); } // ServerManufactureSchematicObjectTemplate::save - //============================================================================= // class ServerManufactureSchematicObjectTemplate::_IngredientSlot @@ -637,7 +635,6 @@ bool ServerManufactureSchematicObjectTemplate::_IngredientSlot::isAppend(const c return TpfTemplate::isAppend(name); } // ServerManufactureSchematicObjectTemplate::_IngredientSlot::isAppend - int ServerManufactureSchematicObjectTemplate::_IngredientSlot::getListLength(const char *name) const { return TpfTemplate::getListLength(name); @@ -651,8 +648,8 @@ int ServerManufactureSchematicObjectTemplate::_IngredientSlot::getListLength(con */ void ServerManufactureSchematicObjectTemplate::_IngredientSlot::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -682,7 +679,7 @@ char paramName[MAX_NAME_SIZE]; */ void ServerManufactureSchematicObjectTemplate::_IngredientSlot::save(Iff &file) { -int count; + int count; file.insertForm(_IngredientSlot_tag); @@ -711,4 +708,4 @@ int count; UNREF(count); } // ServerManufactureSchematicObjectTemplate::_IngredientSlot::save -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerObjectTemplate.cpp index 5df8660b..257b1f02 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerObjectTemplate.cpp @@ -20,27 +20,27 @@ #include #include - - /** * Class constructor. */ ServerObjectTemplate::ServerObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : TpfTemplate(filename) - ,m_scriptsLoaded(false) - ,m_scriptsAppend(false) - ,m_visibleFlagsLoaded(false) - ,m_visibleFlagsAppend(false) - ,m_deleteFlagsLoaded(false) - ,m_deleteFlagsAppend(false) - ,m_moveFlagsLoaded(false) - ,m_moveFlagsAppend(false) - ,m_contentsLoaded(false) - ,m_contentsAppend(false) - ,m_xpPointsLoaded(false) - ,m_xpPointsAppend(false) -//@END TFD INIT + , m_scriptsLoaded(false) + , m_scriptsAppend(false) + , m_visibleFlagsLoaded(false) + , m_visibleFlagsAppend(false) + , m_deleteFlagsLoaded(false) + , m_deleteFlagsAppend(false) + , m_moveFlagsLoaded(false) + , m_moveFlagsAppend(false) + , m_contentsLoaded(false) + , m_contentsAppend(false) + , m_xpPointsLoaded(false) + , m_xpPointsAppend(false) + , m_templateVersion(0) + , m_versionOk(false) + //@END TFD INIT { } // ServerObjectTemplate::ServerObjectTemplate @@ -49,7 +49,7 @@ ServerObjectTemplate::ServerObjectTemplate(const std::string & filename) */ ServerObjectTemplate::~ServerObjectTemplate() { -//@BEGIN TFD CLEANUP + //@BEGIN TFD CLEANUP { std::vector::iterator iter; for (iter = m_scripts.begin(); iter != m_scripts.end(); ++iter) @@ -104,7 +104,7 @@ ServerObjectTemplate::~ServerObjectTemplate() } m_xpPoints.clear(); } -//@END TFD CLEANUP + //@END TFD CLEANUP } // ServerObjectTemplate::~ServerObjectTemplate /** @@ -500,7 +500,6 @@ bool ServerObjectTemplate::isAppend(const char *name) const return TpfTemplate::isAppend(name); } // ServerObjectTemplate::isAppend - int ServerObjectTemplate::getListLength(const char *name) const { if (strcmp(name, "scripts") == 0) @@ -543,8 +542,8 @@ int ServerObjectTemplate::getListLength(const char *name) const */ void ServerObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != ServerObjectTemplate_tag) { @@ -554,7 +553,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -574,7 +573,7 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,1,1)) + if (getHighestTemplateVersion() != TAG(0, 0, 1, 1)) { if (DataLint::isEnabled()) DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); @@ -750,18 +749,18 @@ char paramName[MAX_NAME_SIZE]; */ void ServerObjectTemplate::save(Iff &file) { -int count; + int count; file.insertForm(ServerObjectTemplate_tag); if (m_baseTemplateName.size() != 0) { - file.insertForm(TAG(D,E,R,V)); + file.insertForm(TAG(D, E, R, V)); file.insertChunk(TAG(X, X, X, X)); file.insertChunkData(m_baseTemplateName.c_str(), m_baseTemplateName.size() + 1); file.exitChunk(); file.exitForm(); } - file.insertForm(TAG(0,0,1,1)); + file.insertForm(TAG(0, 0, 1, 1)); file.allowNonlinearFunctions(); int paramCount = 0; @@ -784,7 +783,7 @@ int count; count = m_scripts.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_scripts[i]->saveToIff(file);} + m_scripts[i]->saveToIff(file); } file.exitChunk(); ++paramCount; // save objvars @@ -811,7 +810,7 @@ int count; count = m_visibleFlags.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_visibleFlags[i]->saveToIff(file);} + m_visibleFlags[i]->saveToIff(file); } file.exitChunk(); ++paramCount; if (!m_deleteFlagsLoaded) @@ -826,7 +825,7 @@ int count; count = m_deleteFlags.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_deleteFlags[i]->saveToIff(file);} + m_deleteFlags[i]->saveToIff(file); } file.exitChunk(); ++paramCount; if (!m_moveFlagsLoaded) @@ -841,7 +840,7 @@ int count; count = m_moveFlags.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_moveFlags[i]->saveToIff(file);} + m_moveFlags[i]->saveToIff(file); } file.exitChunk(); ++paramCount; // save invulnerable @@ -868,7 +867,7 @@ int count; count = 3; file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < 3; ++i) - m_updateRanges[i].saveToIff(file);} + m_updateRanges[i].saveToIff(file); } file.exitChunk(); ++paramCount; if (!m_contentsLoaded) @@ -883,7 +882,7 @@ int count; count = m_contents.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_contents[i]->saveToIff(file);} + m_contents[i]->saveToIff(file); } file.exitChunk(); ++paramCount; if (!m_xpPointsLoaded) @@ -898,7 +897,7 @@ int count; count = m_xpPoints.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_xpPoints[i]->saveToIff(file);} + m_xpPoints[i]->saveToIff(file); } file.exitChunk(); ++paramCount; // save persistByDefault @@ -925,7 +924,6 @@ int count; file.exitForm(); } // ServerObjectTemplate::save - //============================================================================= // class ServerObjectTemplate::_AttribMod @@ -1113,7 +1111,6 @@ bool ServerObjectTemplate::_AttribMod::isAppend(const char *name) const return TpfTemplate::isAppend(name); } // ServerObjectTemplate::_AttribMod::isAppend - int ServerObjectTemplate::_AttribMod::getListLength(const char *name) const { return TpfTemplate::getListLength(name); @@ -1127,8 +1124,8 @@ int ServerObjectTemplate::_AttribMod::getListLength(const char *name) const */ void ServerObjectTemplate::_AttribMod::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -1164,7 +1161,7 @@ char paramName[MAX_NAME_SIZE]; */ void ServerObjectTemplate::_AttribMod::save(Iff &file) { -int count; + int count; file.insertForm(_AttribMod_tag); @@ -1211,7 +1208,6 @@ int count; UNREF(count); } // ServerObjectTemplate::_AttribMod::save - //============================================================================= // class ServerObjectTemplate::_Contents @@ -1371,7 +1367,6 @@ bool ServerObjectTemplate::_Contents::isAppend(const char *name) const return TpfTemplate::isAppend(name); } // ServerObjectTemplate::_Contents::isAppend - int ServerObjectTemplate::_Contents::getListLength(const char *name) const { return TpfTemplate::getListLength(name); @@ -1385,8 +1380,8 @@ int ServerObjectTemplate::_Contents::getListLength(const char *name) const */ void ServerObjectTemplate::_Contents::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -1418,7 +1413,7 @@ char paramName[MAX_NAME_SIZE]; */ void ServerObjectTemplate::_Contents::save(Iff &file) { -int count; + int count; file.insertForm(_Contents_tag); @@ -1453,7 +1448,6 @@ int count; UNREF(count); } // ServerObjectTemplate::_Contents::save - //============================================================================= // class ServerObjectTemplate::_MentalStateMod @@ -1641,7 +1635,6 @@ bool ServerObjectTemplate::_MentalStateMod::isAppend(const char *name) const return TpfTemplate::isAppend(name); } // ServerObjectTemplate::_MentalStateMod::isAppend - int ServerObjectTemplate::_MentalStateMod::getListLength(const char *name) const { return TpfTemplate::getListLength(name); @@ -1655,8 +1648,8 @@ int ServerObjectTemplate::_MentalStateMod::getListLength(const char *name) const */ void ServerObjectTemplate::_MentalStateMod::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -1692,7 +1685,7 @@ char paramName[MAX_NAME_SIZE]; */ void ServerObjectTemplate::_MentalStateMod::save(Iff &file) { -int count; + int count; file.insertForm(_MentalStateMod_tag); @@ -1739,7 +1732,6 @@ int count; UNREF(count); } // ServerObjectTemplate::_MentalStateMod::save - //============================================================================= // class ServerObjectTemplate::_Xp @@ -1897,7 +1889,6 @@ bool ServerObjectTemplate::_Xp::isAppend(const char *name) const return TpfTemplate::isAppend(name); } // ServerObjectTemplate::_Xp::isAppend - int ServerObjectTemplate::_Xp::getListLength(const char *name) const { return TpfTemplate::getListLength(name); @@ -1911,8 +1902,8 @@ int ServerObjectTemplate::_Xp::getListLength(const char *name) const */ void ServerObjectTemplate::_Xp::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -1944,7 +1935,7 @@ char paramName[MAX_NAME_SIZE]; */ void ServerObjectTemplate::_Xp::save(Iff &file) { -int count; + int count; file.insertForm(_Xp_tag); @@ -1979,4 +1970,4 @@ int count; UNREF(count); } // ServerObjectTemplate::_Xp::save -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerTangibleObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerTangibleObjectTemplate.cpp index 52fd36b3..980b1547 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerTangibleObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerTangibleObjectTemplate.cpp @@ -20,17 +20,17 @@ #include #include - - /** * Class constructor. */ ServerTangibleObjectTemplate::ServerTangibleObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : ServerObjectTemplate(filename) - ,m_triggerVolumesLoaded(false) - ,m_triggerVolumesAppend(false) -//@END TFD INIT + , m_triggerVolumesLoaded(false) + , m_triggerVolumesAppend(false) + , m_templateVersion(0) + , m_versionOk(false) + //@END TFD INIT { } // ServerTangibleObjectTemplate::ServerTangibleObjectTemplate @@ -39,7 +39,7 @@ ServerTangibleObjectTemplate::ServerTangibleObjectTemplate(const std::string & f */ ServerTangibleObjectTemplate::~ServerTangibleObjectTemplate() { -//@BEGIN TFD CLEANUP + //@BEGIN TFD CLEANUP { std::vector::iterator iter; for (iter = m_triggerVolumes.begin(); iter != m_triggerVolumes.end(); ++iter) @@ -49,7 +49,7 @@ ServerTangibleObjectTemplate::~ServerTangibleObjectTemplate() } m_triggerVolumes.clear(); } -//@END TFD CLEANUP + //@END TFD CLEANUP } // ServerTangibleObjectTemplate::~ServerTangibleObjectTemplate /** @@ -303,7 +303,6 @@ bool ServerTangibleObjectTemplate::isAppend(const char *name) const return ServerObjectTemplate::isAppend(name); } // ServerTangibleObjectTemplate::isAppend - int ServerTangibleObjectTemplate::getListLength(const char *name) const { if (strcmp(name, "triggerVolumes") == 0) @@ -322,8 +321,8 @@ int ServerTangibleObjectTemplate::getListLength(const char *name) const */ void ServerTangibleObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != ServerTangibleObjectTemplate_tag) { @@ -333,7 +332,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -353,7 +352,7 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,4)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 4)) { if (DataLint::isEnabled()) DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); @@ -418,18 +417,18 @@ char paramName[MAX_NAME_SIZE]; */ void ServerTangibleObjectTemplate::save(Iff &file) { -int count; + int count; file.insertForm(ServerTangibleObjectTemplate_tag); if (m_baseTemplateName.size() != 0) { - file.insertForm(TAG(D,E,R,V)); + file.insertForm(TAG(D, E, R, V)); file.insertChunk(TAG(X, X, X, X)); file.insertChunkData(m_baseTemplateName.c_str(), m_baseTemplateName.size() + 1); file.exitChunk(); file.exitForm(); } - file.insertForm(TAG(0,0,0,4)); + file.insertForm(TAG(0, 0, 0, 4)); file.allowNonlinearFunctions(); int paramCount = 0; @@ -446,7 +445,7 @@ int count; count = m_triggerVolumes.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_triggerVolumes[i]->saveToIff(file);} + m_triggerVolumes[i]->saveToIff(file); } file.exitChunk(); ++paramCount; // save combatSkeleton @@ -503,4 +502,4 @@ int count; file.exitForm(); } // ServerTangibleObjectTemplate::save -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedTemplate/src/shared/template/ServerUberObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/ServerUberObjectTemplate.cpp index 6aba5832..16239668 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/ServerUberObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/ServerUberObjectTemplate.cpp @@ -20,59 +20,59 @@ #include #include - - /** * Class constructor. */ ServerUberObjectTemplate::ServerUberObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : TpfTemplate(filename) - ,m_intListSimpleLoaded(false) - ,m_intListSimpleAppend(false) - ,m_intListWeightedListLoaded(false) - ,m_intListWeightedListAppend(false) - ,m_intListRandomRangeLoaded(false) - ,m_intListRandomRangeAppend(false) - ,m_intListDiceRollLoaded(false) - ,m_intListDiceRollAppend(false) - ,m_floatListSimpleLoaded(false) - ,m_floatListSimpleAppend(false) - ,m_floatListWeightedListLoaded(false) - ,m_floatListWeightedListAppend(false) - ,m_floatListRandomRangeLoaded(false) - ,m_floatListRandomRangeAppend(false) - ,m_enumListIndexedLoaded(false) - ,m_enumListIndexedAppend(false) - ,m_enumListWeightedListLoaded(false) - ,m_enumListWeightedListAppend(false) - ,m_stringIdListSimpleLoaded(false) - ,m_stringIdListSimpleAppend(false) - ,m_stringIdListWeightedListLoaded(false) - ,m_stringIdListWeightedListAppend(false) - ,m_stringListSimpleLoaded(false) - ,m_stringListSimpleAppend(false) - ,m_stringListWeightedListLoaded(false) - ,m_stringListWeightedListAppend(false) - ,m_triggerVolumeListLoaded(false) - ,m_triggerVolumeListAppend(false) - ,m_triggerVolumesListWeightedListLoaded(false) - ,m_triggerVolumesListWeightedListAppend(false) - ,m_boolListDerivedLoaded(false) - ,m_boolListDerivedAppend(false) - ,m_boolListSimpleLoaded(false) - ,m_boolListSimpleAppend(false) - ,m_boolListWeightedListLoaded(false) - ,m_boolListWeightedListAppend(false) - ,m_vectorListSimpleLoaded(false) - ,m_vectorListSimpleAppend(false) - ,m_filenameListSimpleLoaded(false) - ,m_filenameListSimpleAppend(false) - ,m_templateListSimpleLoaded(false) - ,m_templateListSimpleAppend(false) - ,m_structListSimpleLoaded(false) - ,m_structListSimpleAppend(false) -//@END TFD INIT + , m_intListSimpleLoaded(false) + , m_intListSimpleAppend(false) + , m_intListWeightedListLoaded(false) + , m_intListWeightedListAppend(false) + , m_intListRandomRangeLoaded(false) + , m_intListRandomRangeAppend(false) + , m_intListDiceRollLoaded(false) + , m_intListDiceRollAppend(false) + , m_floatListSimpleLoaded(false) + , m_floatListSimpleAppend(false) + , m_floatListWeightedListLoaded(false) + , m_floatListWeightedListAppend(false) + , m_floatListRandomRangeLoaded(false) + , m_floatListRandomRangeAppend(false) + , m_enumListIndexedLoaded(false) + , m_enumListIndexedAppend(false) + , m_enumListWeightedListLoaded(false) + , m_enumListWeightedListAppend(false) + , m_stringIdListSimpleLoaded(false) + , m_stringIdListSimpleAppend(false) + , m_stringIdListWeightedListLoaded(false) + , m_stringIdListWeightedListAppend(false) + , m_stringListSimpleLoaded(false) + , m_stringListSimpleAppend(false) + , m_stringListWeightedListLoaded(false) + , m_stringListWeightedListAppend(false) + , m_triggerVolumeListLoaded(false) + , m_triggerVolumeListAppend(false) + , m_triggerVolumesListWeightedListLoaded(false) + , m_triggerVolumesListWeightedListAppend(false) + , m_boolListDerivedLoaded(false) + , m_boolListDerivedAppend(false) + , m_boolListSimpleLoaded(false) + , m_boolListSimpleAppend(false) + , m_boolListWeightedListLoaded(false) + , m_boolListWeightedListAppend(false) + , m_vectorListSimpleLoaded(false) + , m_vectorListSimpleAppend(false) + , m_filenameListSimpleLoaded(false) + , m_filenameListSimpleAppend(false) + , m_templateListSimpleLoaded(false) + , m_templateListSimpleAppend(false) + , m_structListSimpleLoaded(false) + , m_structListSimpleAppend(false) + , m_templateVersion(0) + , m_versionOk(false) + //@END TFD INIT { } // ServerUberObjectTemplate::ServerUberObjectTemplate @@ -81,7 +81,7 @@ ServerUberObjectTemplate::ServerUberObjectTemplate(const std::string & filename) */ ServerUberObjectTemplate::~ServerUberObjectTemplate() { -//@BEGIN TFD CLEANUP + //@BEGIN TFD CLEANUP { std::vector::iterator iter; for (iter = m_intListSimple.begin(); iter != m_intListSimple.end(); ++iter) @@ -258,7 +258,7 @@ ServerUberObjectTemplate::~ServerUberObjectTemplate() *iter = nullptr; } } -//@END TFD CLEANUP + //@END TFD CLEANUP } // ServerUberObjectTemplate::~ServerUberObjectTemplate /** @@ -1772,7 +1772,6 @@ bool ServerUberObjectTemplate::isAppend(const char *name) const return TpfTemplate::isAppend(name); } // ServerUberObjectTemplate::isAppend - int ServerUberObjectTemplate::getListLength(const char *name) const { if (strcmp(name, "intListSimple") == 0) @@ -1923,8 +1922,8 @@ int ServerUberObjectTemplate::getListLength(const char *name) const */ void ServerUberObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != ServerUberObjectTemplate_tag) { @@ -1934,7 +1933,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -1954,7 +1953,7 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { if (DataLint::isEnabled()) DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); @@ -2654,18 +2653,18 @@ char paramName[MAX_NAME_SIZE]; */ void ServerUberObjectTemplate::save(Iff &file) { -int count; + int count; file.insertForm(ServerUberObjectTemplate_tag); if (m_baseTemplateName.size() != 0) { - file.insertForm(TAG(D,E,R,V)); + file.insertForm(TAG(D, E, R, V)); file.insertChunk(TAG(X, X, X, X)); file.insertChunkData(m_baseTemplateName.c_str(), m_baseTemplateName.size() + 1); file.exitChunk(); file.exitForm(); } - file.insertForm(TAG(0,0,0,0)); + file.insertForm(TAG(0, 0, 0, 0)); file.allowNonlinearFunctions(); int paramCount = 0; @@ -2784,7 +2783,7 @@ int count; count = m_intListSimple.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_intListSimple[i]->saveToIff(file);} + m_intListSimple[i]->saveToIff(file); } file.exitChunk(); ++paramCount; if (!m_intListWeightedListLoaded) @@ -2799,7 +2798,7 @@ int count; count = m_intListWeightedList.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_intListWeightedList[i]->saveToIff(file);} + m_intListWeightedList[i]->saveToIff(file); } file.exitChunk(); ++paramCount; if (!m_intListRandomRangeLoaded) @@ -2814,7 +2813,7 @@ int count; count = m_intListRandomRange.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_intListRandomRange[i]->saveToIff(file);} + m_intListRandomRange[i]->saveToIff(file); } file.exitChunk(); ++paramCount; if (!m_intListDiceRollLoaded) @@ -2829,7 +2828,7 @@ int count; count = m_intListDiceRoll.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_intListDiceRoll[i]->saveToIff(file);} + m_intListDiceRoll[i]->saveToIff(file); } file.exitChunk(); ++paramCount; // save floatAtDerived @@ -2910,7 +2909,7 @@ int count; count = m_floatListSimple.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_floatListSimple[i]->saveToIff(file);} + m_floatListSimple[i]->saveToIff(file); } file.exitChunk(); ++paramCount; if (!m_floatListWeightedListLoaded) @@ -2925,7 +2924,7 @@ int count; count = m_floatListWeightedList.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_floatListWeightedList[i]->saveToIff(file);} + m_floatListWeightedList[i]->saveToIff(file); } file.exitChunk(); ++paramCount; if (!m_floatListRandomRangeLoaded) @@ -2940,7 +2939,7 @@ int count; count = m_floatListRandomRange.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_floatListRandomRange[i]->saveToIff(file);} + m_floatListRandomRange[i]->saveToIff(file); } file.exitChunk(); ++paramCount; // save enumIndexedByEnumSingle @@ -2949,7 +2948,7 @@ int count; count = 3; file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < 3; ++i) - m_enumIndexedByEnumSingle[i].saveToIff(file);} + m_enumIndexedByEnumSingle[i].saveToIff(file); } file.exitChunk(); ++paramCount; // save enumIndexedByEnumWeightedList @@ -2958,7 +2957,7 @@ int count; count = 3; file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < 3; ++i) - m_enumIndexedByEnumWeightedList[i].saveToIff(file);} + m_enumIndexedByEnumWeightedList[i].saveToIff(file); } file.exitChunk(); ++paramCount; if (!m_enumListIndexedLoaded) @@ -2973,7 +2972,7 @@ int count; count = m_enumListIndexed.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_enumListIndexed[i]->saveToIff(file);} + m_enumListIndexed[i]->saveToIff(file); } file.exitChunk(); ++paramCount; if (!m_enumListWeightedListLoaded) @@ -2988,7 +2987,7 @@ int count; count = m_enumListWeightedList.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_enumListWeightedList[i]->saveToIff(file);} + m_enumListWeightedList[i]->saveToIff(file); } file.exitChunk(); ++paramCount; // save stringIdDerived @@ -3021,7 +3020,7 @@ int count; count = m_stringIdListSimple.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_stringIdListSimple[i]->saveToIff(file);} + m_stringIdListSimple[i]->saveToIff(file); } file.exitChunk(); ++paramCount; if (!m_stringIdListWeightedListLoaded) @@ -3036,7 +3035,7 @@ int count; count = m_stringIdListWeightedList.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_stringIdListWeightedList[i]->saveToIff(file);} + m_stringIdListWeightedList[i]->saveToIff(file); } file.exitChunk(); ++paramCount; // save stringDerived @@ -3069,7 +3068,7 @@ int count; count = m_stringListSimple.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_stringListSimple[i]->saveToIff(file);} + m_stringListSimple[i]->saveToIff(file); } file.exitChunk(); ++paramCount; if (!m_stringListWeightedListLoaded) @@ -3084,7 +3083,7 @@ int count; count = m_stringListWeightedList.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_stringListWeightedList[i]->saveToIff(file);} + m_stringListWeightedList[i]->saveToIff(file); } file.exitChunk(); ++paramCount; // save triggerVolumeDerived @@ -3117,7 +3116,7 @@ int count; count = m_triggerVolumeList.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_triggerVolumeList[i]->saveToIff(file);} + m_triggerVolumeList[i]->saveToIff(file); } file.exitChunk(); ++paramCount; if (!m_triggerVolumesListWeightedListLoaded) @@ -3132,7 +3131,7 @@ int count; count = m_triggerVolumesListWeightedList.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_triggerVolumesListWeightedList[i]->saveToIff(file);} + m_triggerVolumesListWeightedList[i]->saveToIff(file); } file.exitChunk(); ++paramCount; // save boolDerived @@ -3165,7 +3164,7 @@ int count; count = m_boolListDerived.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_boolListDerived[i]->saveToIff(file);} + m_boolListDerived[i]->saveToIff(file); } file.exitChunk(); ++paramCount; if (!m_boolListSimpleLoaded) @@ -3180,7 +3179,7 @@ int count; count = m_boolListSimple.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_boolListSimple[i]->saveToIff(file);} + m_boolListSimple[i]->saveToIff(file); } file.exitChunk(); ++paramCount; if (!m_boolListWeightedListLoaded) @@ -3195,7 +3194,7 @@ int count; count = m_boolListWeightedList.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_boolListWeightedList[i]->saveToIff(file);} + m_boolListWeightedList[i]->saveToIff(file); } file.exitChunk(); ++paramCount; // save vectorAtDerived @@ -3222,7 +3221,7 @@ int count; count = m_vectorListSimple.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_vectorListSimple[i]->saveToIff(file);} + m_vectorListSimple[i]->saveToIff(file); } file.exitChunk(); ++paramCount; // save filenameAtDerived @@ -3255,7 +3254,7 @@ int count; count = m_filenameListSimple.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_filenameListSimple[i]->saveToIff(file);} + m_filenameListSimple[i]->saveToIff(file); } file.exitChunk(); ++paramCount; // save objvarDerived @@ -3300,7 +3299,7 @@ int count; count = m_templateListSimple.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_templateListSimple[i]->saveToIff(file);} + m_templateListSimple[i]->saveToIff(file); } file.exitChunk(); ++paramCount; // save structAtDerived @@ -3327,7 +3326,7 @@ int count; count = m_structListSimple.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_structListSimple[i]->saveToIff(file);} + m_structListSimple[i]->saveToIff(file); } file.exitChunk(); ++paramCount; // save structArrayEnum @@ -3336,7 +3335,7 @@ int count; count = 3; file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < 3; ++i) - m_structArrayEnum[i].saveToIff(file);} + m_structArrayEnum[i].saveToIff(file); } file.exitChunk(); ++paramCount; // save structArrayInteger @@ -3345,7 +3344,7 @@ int count; count = 2; file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < 2; ++i) - m_structArrayInteger[i].saveToIff(file);} + m_structArrayInteger[i].saveToIff(file); } file.exitChunk(); ++paramCount; // save integerArray @@ -3354,7 +3353,7 @@ int count; count = 2; file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < 2; ++i) - m_integerArray[i].saveToIff(file);} + m_integerArray[i].saveToIff(file); } file.exitChunk(); ++paramCount; // save floatArray @@ -3363,7 +3362,7 @@ int count; count = 2; file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < 2; ++i) - m_floatArray[i].saveToIff(file);} + m_floatArray[i].saveToIff(file); } file.exitChunk(); ++paramCount; // save stringArray @@ -3372,7 +3371,7 @@ int count; count = 2; file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < 2; ++i) - m_stringArray[i].saveToIff(file);} + m_stringArray[i].saveToIff(file); } file.exitChunk(); ++paramCount; // save boolArray @@ -3381,7 +3380,7 @@ int count; count = 2; file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < 2; ++i) - m_boolArray[i].saveToIff(file);} + m_boolArray[i].saveToIff(file); } file.exitChunk(); ++paramCount; // save stringIdArray @@ -3390,7 +3389,7 @@ int count; count = 2; file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < 2; ++i) - m_stringIdArray[i].saveToIff(file);} + m_stringIdArray[i].saveToIff(file); } file.exitChunk(); ++paramCount; // save triggerArray @@ -3399,7 +3398,7 @@ int count; count = 2; file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < 2; ++i) - m_triggerArray[i].saveToIff(file);} + m_triggerArray[i].saveToIff(file); } file.exitChunk(); ++paramCount; // save vectorArray @@ -3408,7 +3407,7 @@ int count; count = 2; file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < 2; ++i) - m_vectorArray[i].saveToIff(file);} + m_vectorArray[i].saveToIff(file); } file.exitChunk(); ++paramCount; // save fileNameArray @@ -3417,7 +3416,7 @@ int count; count = 2; file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < 2; ++i) - m_fileNameArray[i].saveToIff(file);} + m_fileNameArray[i].saveToIff(file); } file.exitChunk(); ++paramCount; @@ -3432,7 +3431,6 @@ int count; file.exitForm(); } // ServerUberObjectTemplate::save - //============================================================================= // class ServerUberObjectTemplate::_Foo @@ -3594,7 +3592,6 @@ bool ServerUberObjectTemplate::_Foo::isAppend(const char *name) const return TpfTemplate::isAppend(name); } // ServerUberObjectTemplate::_Foo::isAppend - int ServerUberObjectTemplate::_Foo::getListLength(const char *name) const { return TpfTemplate::getListLength(name); @@ -3608,8 +3605,8 @@ int ServerUberObjectTemplate::_Foo::getListLength(const char *name) const */ void ServerUberObjectTemplate::_Foo::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -3641,7 +3638,7 @@ char paramName[MAX_NAME_SIZE]; */ void ServerUberObjectTemplate::_Foo::save(Iff &file) { -int count; + int count; file.insertForm(_Foo_tag); @@ -3676,4 +3673,4 @@ int count; UNREF(count); } // ServerUberObjectTemplate::_Foo::save -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedDraftSchematicObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedDraftSchematicObjectTemplate.cpp index 9c18023d..30332171 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedDraftSchematicObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedDraftSchematicObjectTemplate.cpp @@ -20,19 +20,19 @@ #include #include - - /** * Class constructor. */ SharedDraftSchematicObjectTemplate::SharedDraftSchematicObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedIntangibleObjectTemplate(filename) - ,m_slotsLoaded(false) - ,m_slotsAppend(false) - ,m_attributesLoaded(false) - ,m_attributesAppend(false) -//@END TFD INIT + , m_slotsLoaded(false) + , m_slotsAppend(false) + , m_attributesLoaded(false) + , m_attributesAppend(false) + , m_templateVersion(0) + , m_versionOk(false) + //@END TFD INIT { } // SharedDraftSchematicObjectTemplate::SharedDraftSchematicObjectTemplate @@ -41,7 +41,7 @@ SharedDraftSchematicObjectTemplate::SharedDraftSchematicObjectTemplate(const std */ SharedDraftSchematicObjectTemplate::~SharedDraftSchematicObjectTemplate() { -//@BEGIN TFD CLEANUP + //@BEGIN TFD CLEANUP { std::vector::iterator iter; for (iter = m_slots.begin(); iter != m_slots.end(); ++iter) @@ -60,7 +60,7 @@ SharedDraftSchematicObjectTemplate::~SharedDraftSchematicObjectTemplate() } m_attributes.clear(); } -//@END TFD CLEANUP + //@END TFD CLEANUP } // SharedDraftSchematicObjectTemplate::~SharedDraftSchematicObjectTemplate /** @@ -252,7 +252,6 @@ bool SharedDraftSchematicObjectTemplate::isAppend(const char *name) const return SharedIntangibleObjectTemplate::isAppend(name); } // SharedDraftSchematicObjectTemplate::isAppend - int SharedDraftSchematicObjectTemplate::getListLength(const char *name) const { if (strcmp(name, "slots") == 0) @@ -275,8 +274,8 @@ int SharedDraftSchematicObjectTemplate::getListLength(const char *name) const */ void SharedDraftSchematicObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedDraftSchematicObjectTemplate_tag) { @@ -286,7 +285,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -306,7 +305,7 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,3)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 3)) { if (DataLint::isEnabled()) DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); @@ -378,18 +377,18 @@ char paramName[MAX_NAME_SIZE]; */ void SharedDraftSchematicObjectTemplate::save(Iff &file) { -int count; + int count; file.insertForm(SharedDraftSchematicObjectTemplate_tag); if (m_baseTemplateName.size() != 0) { - file.insertForm(TAG(D,E,R,V)); + file.insertForm(TAG(D, E, R, V)); file.insertChunk(TAG(X, X, X, X)); file.insertChunkData(m_baseTemplateName.c_str(), m_baseTemplateName.size() + 1); file.exitChunk(); file.exitForm(); } - file.insertForm(TAG(0,0,0,3)); + file.insertForm(TAG(0, 0, 0, 3)); file.allowNonlinearFunctions(); int paramCount = 0; @@ -406,7 +405,7 @@ int count; count = m_slots.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_slots[i]->saveToIff(file);} + m_slots[i]->saveToIff(file); } file.exitChunk(); ++paramCount; if (!m_attributesLoaded) @@ -421,7 +420,7 @@ int count; count = m_attributes.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_attributes[i]->saveToIff(file);} + m_attributes[i]->saveToIff(file); } file.exitChunk(); ++paramCount; // save craftedSharedTemplate @@ -442,7 +441,6 @@ int count; file.exitForm(); } // SharedDraftSchematicObjectTemplate::save - //============================================================================= // class SharedDraftSchematicObjectTemplate::_IngredientSlot @@ -588,7 +586,6 @@ bool SharedDraftSchematicObjectTemplate::_IngredientSlot::isAppend(const char *n return TpfTemplate::isAppend(name); } // SharedDraftSchematicObjectTemplate::_IngredientSlot::isAppend - int SharedDraftSchematicObjectTemplate::_IngredientSlot::getListLength(const char *name) const { return TpfTemplate::getListLength(name); @@ -602,8 +599,8 @@ int SharedDraftSchematicObjectTemplate::_IngredientSlot::getListLength(const cha */ void SharedDraftSchematicObjectTemplate::_IngredientSlot::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -633,7 +630,7 @@ char paramName[MAX_NAME_SIZE]; */ void SharedDraftSchematicObjectTemplate::_IngredientSlot::save(Iff &file) { -int count; + int count; file.insertForm(_IngredientSlot_tag); @@ -662,7 +659,6 @@ int count; UNREF(count); } // SharedDraftSchematicObjectTemplate::_IngredientSlot::save - //============================================================================= // class SharedDraftSchematicObjectTemplate::_SchematicAttribute @@ -822,7 +818,6 @@ bool SharedDraftSchematicObjectTemplate::_SchematicAttribute::isAppend(const cha return TpfTemplate::isAppend(name); } // SharedDraftSchematicObjectTemplate::_SchematicAttribute::isAppend - int SharedDraftSchematicObjectTemplate::_SchematicAttribute::getListLength(const char *name) const { return TpfTemplate::getListLength(name); @@ -836,8 +831,8 @@ int SharedDraftSchematicObjectTemplate::_SchematicAttribute::getListLength(const */ void SharedDraftSchematicObjectTemplate::_SchematicAttribute::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -869,7 +864,7 @@ char paramName[MAX_NAME_SIZE]; */ void SharedDraftSchematicObjectTemplate::_SchematicAttribute::save(Iff &file) { -int count; + int count; file.insertForm(_SchematicAttribute_tag); @@ -904,4 +899,4 @@ int count; UNREF(count); } // SharedDraftSchematicObjectTemplate::_SchematicAttribute::save -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedTemplate/src/shared/template/SharedTangibleObjectTemplate.cpp b/engine/shared/library/sharedTemplate/src/shared/template/SharedTangibleObjectTemplate.cpp index 10a66071..4d25f625 100755 --- a/engine/shared/library/sharedTemplate/src/shared/template/SharedTangibleObjectTemplate.cpp +++ b/engine/shared/library/sharedTemplate/src/shared/template/SharedTangibleObjectTemplate.cpp @@ -20,27 +20,27 @@ #include #include - - /** * Class constructor. */ SharedTangibleObjectTemplate::SharedTangibleObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : SharedObjectTemplate(filename) - ,m_paletteColorCustomizationVariablesLoaded(false) - ,m_paletteColorCustomizationVariablesAppend(false) - ,m_rangedIntCustomizationVariablesLoaded(false) - ,m_rangedIntCustomizationVariablesAppend(false) - ,m_constStringCustomizationVariablesLoaded(false) - ,m_constStringCustomizationVariablesAppend(false) - ,m_socketDestinationsLoaded(false) - ,m_socketDestinationsAppend(false) - ,m_certificationsRequiredLoaded(false) - ,m_certificationsRequiredAppend(false) - ,m_customizationVariableMappingLoaded(false) - ,m_customizationVariableMappingAppend(false) -//@END TFD INIT + , m_paletteColorCustomizationVariablesLoaded(false) + , m_paletteColorCustomizationVariablesAppend(false) + , m_rangedIntCustomizationVariablesLoaded(false) + , m_rangedIntCustomizationVariablesAppend(false) + , m_constStringCustomizationVariablesLoaded(false) + , m_constStringCustomizationVariablesAppend(false) + , m_socketDestinationsLoaded(false) + , m_socketDestinationsAppend(false) + , m_certificationsRequiredLoaded(false) + , m_certificationsRequiredAppend(false) + , m_customizationVariableMappingLoaded(false) + , m_customizationVariableMappingAppend(false) + , m_templateVersion(0) + , m_versionOk(false) + //@END TFD INIT { } // SharedTangibleObjectTemplate::SharedTangibleObjectTemplate @@ -49,7 +49,7 @@ SharedTangibleObjectTemplate::SharedTangibleObjectTemplate(const std::string & f */ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() { -//@BEGIN TFD CLEANUP + //@BEGIN TFD CLEANUP { std::vector::iterator iter; for (iter = m_paletteColorCustomizationVariables.begin(); iter != m_paletteColorCustomizationVariables.end(); ++iter) @@ -104,7 +104,7 @@ SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate() } m_customizationVariableMapping.clear(); } -//@END TFD CLEANUP + //@END TFD CLEANUP } // SharedTangibleObjectTemplate::~SharedTangibleObjectTemplate /** @@ -430,7 +430,6 @@ bool SharedTangibleObjectTemplate::isAppend(const char *name) const return SharedObjectTemplate::isAppend(name); } // SharedTangibleObjectTemplate::isAppend - int SharedTangibleObjectTemplate::getListLength(const char *name) const { if (strcmp(name, "paletteColorCustomizationVariables") == 0) @@ -469,8 +468,8 @@ int SharedTangibleObjectTemplate::getListLength(const char *name) const */ void SharedTangibleObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != SharedTangibleObjectTemplate_tag) { @@ -480,7 +479,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -500,7 +499,7 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,1,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 1, 0)) { if (DataLint::isEnabled()) DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); @@ -654,18 +653,18 @@ char paramName[MAX_NAME_SIZE]; */ void SharedTangibleObjectTemplate::save(Iff &file) { -int count; + int count; file.insertForm(SharedTangibleObjectTemplate_tag); if (m_baseTemplateName.size() != 0) { - file.insertForm(TAG(D,E,R,V)); + file.insertForm(TAG(D, E, R, V)); file.insertChunk(TAG(X, X, X, X)); file.insertChunkData(m_baseTemplateName.c_str(), m_baseTemplateName.size() + 1); file.exitChunk(); file.exitForm(); } - file.insertForm(TAG(0,0,1,0)); + file.insertForm(TAG(0, 0, 1, 0)); file.allowNonlinearFunctions(); int paramCount = 0; @@ -682,7 +681,7 @@ int count; count = m_paletteColorCustomizationVariables.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_paletteColorCustomizationVariables[i]->saveToIff(file);} + m_paletteColorCustomizationVariables[i]->saveToIff(file); } file.exitChunk(); ++paramCount; if (!m_rangedIntCustomizationVariablesLoaded) @@ -697,7 +696,7 @@ int count; count = m_rangedIntCustomizationVariables.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_rangedIntCustomizationVariables[i]->saveToIff(file);} + m_rangedIntCustomizationVariables[i]->saveToIff(file); } file.exitChunk(); ++paramCount; if (!m_constStringCustomizationVariablesLoaded) @@ -712,7 +711,7 @@ int count; count = m_constStringCustomizationVariables.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_constStringCustomizationVariables[i]->saveToIff(file);} + m_constStringCustomizationVariables[i]->saveToIff(file); } file.exitChunk(); ++paramCount; if (!m_socketDestinationsLoaded) @@ -727,7 +726,7 @@ int count; count = m_socketDestinations.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_socketDestinations[i]->saveToIff(file);} + m_socketDestinations[i]->saveToIff(file); } file.exitChunk(); ++paramCount; // save structureFootprintFileName @@ -760,7 +759,7 @@ int count; count = m_certificationsRequired.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_certificationsRequired[i]->saveToIff(file);} + m_certificationsRequired[i]->saveToIff(file); } file.exitChunk(); ++paramCount; if (!m_customizationVariableMappingLoaded) @@ -775,7 +774,7 @@ int count; count = m_customizationVariableMapping.size(); file.insertChunkData(&count, sizeof(count)); {for (int i = 0; i < count; ++i) - m_customizationVariableMapping[i]->saveToIff(file);} + m_customizationVariableMapping[i]->saveToIff(file); } file.exitChunk(); ++paramCount; // save clientVisabilityFlag @@ -796,7 +795,6 @@ int count; file.exitForm(); } // SharedTangibleObjectTemplate::save - //============================================================================= // class SharedTangibleObjectTemplate::_ConstStringCustomizationVariable @@ -940,7 +938,6 @@ bool SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::isAppend(c return TpfTemplate::isAppend(name); } // SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::isAppend - int SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::getListLength(const char *name) const { return TpfTemplate::getListLength(name); @@ -954,8 +951,8 @@ int SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::getListLeng */ void SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -985,7 +982,7 @@ char paramName[MAX_NAME_SIZE]; */ void SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::save(Iff &file) { -int count; + int count; file.insertForm(_ConstStringCustomizationVariable_tag); @@ -1014,7 +1011,6 @@ int count; UNREF(count); } // SharedTangibleObjectTemplate::_ConstStringCustomizationVariable::save - //============================================================================= // class SharedTangibleObjectTemplate::_CustomizationVariableMapping @@ -1158,7 +1154,6 @@ bool SharedTangibleObjectTemplate::_CustomizationVariableMapping::isAppend(const return TpfTemplate::isAppend(name); } // SharedTangibleObjectTemplate::_CustomizationVariableMapping::isAppend - int SharedTangibleObjectTemplate::_CustomizationVariableMapping::getListLength(const char *name) const { return TpfTemplate::getListLength(name); @@ -1172,8 +1167,8 @@ int SharedTangibleObjectTemplate::_CustomizationVariableMapping::getListLength(c */ void SharedTangibleObjectTemplate::_CustomizationVariableMapping::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -1203,7 +1198,7 @@ char paramName[MAX_NAME_SIZE]; */ void SharedTangibleObjectTemplate::_CustomizationVariableMapping::save(Iff &file) { -int count; + int count; file.insertForm(_CustomizationVariableMapping_tag); @@ -1232,7 +1227,6 @@ int count; UNREF(count); } // SharedTangibleObjectTemplate::_CustomizationVariableMapping::save - //============================================================================= // class SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable @@ -1392,7 +1386,6 @@ bool SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::isAppend( return TpfTemplate::isAppend(name); } // SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::isAppend - int SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getListLength(const char *name) const { return TpfTemplate::getListLength(name); @@ -1406,8 +1399,8 @@ int SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::getListLen */ void SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -1439,7 +1432,7 @@ char paramName[MAX_NAME_SIZE]; */ void SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::save(Iff &file) { -int count; + int count; file.insertForm(_PaletteColorCustomizationVariable_tag); @@ -1474,7 +1467,6 @@ int count; UNREF(count); } // SharedTangibleObjectTemplate::_PaletteColorCustomizationVariable::save - //============================================================================= // class SharedTangibleObjectTemplate::_RangedIntCustomizationVariable @@ -1648,7 +1640,6 @@ bool SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::isAppend(con return TpfTemplate::isAppend(name); } // SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::isAppend - int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getListLength(const char *name) const { return TpfTemplate::getListLength(name); @@ -1662,8 +1653,8 @@ int SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::getListLength */ void SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; file.enterForm(); @@ -1697,7 +1688,7 @@ char paramName[MAX_NAME_SIZE]; */ void SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::save(Iff &file) { -int count; + int count; file.insertForm(_RangedIntCustomizationVariable_tag); @@ -1738,4 +1729,4 @@ int count; UNREF(count); } // SharedTangibleObjectTemplate::_RangedIntCustomizationVariable::save -//@END TFD +//@END TFD \ No newline at end of file diff --git a/engine/shared/library/sharedUtility/src/shared/OptionManager.cpp b/engine/shared/library/sharedUtility/src/shared/OptionManager.cpp index 2ba423ed..abeed4c3 100755 --- a/engine/shared/library/sharedUtility/src/shared/OptionManager.cpp +++ b/engine/shared/library/sharedUtility/src/shared/OptionManager.cpp @@ -27,12 +27,12 @@ namespace OptionManagerNamespace { - const Tag TAG_BOOL = TAG (B,O,O,L); - const Tag TAG_FLT = TAG3 (F,L,T); - const Tag TAG_INT = TAG3 (I,N,T); - const Tag TAG_OPTN = TAG (O,P,T,N); - const Tag TAG_STDS = TAG (S,T,D,S); - const Tag TAG_UNIS = TAG (U,N,I,S); + const Tag TAG_BOOL = TAG(B, O, O, L); + const Tag TAG_FLT = TAG3(F, L, T); + const Tag TAG_INT = TAG3(I, N, T); + const Tag TAG_OPTN = TAG(O, P, T, N); + const Tag TAG_STDS = TAG(S, T, D, S); + const Tag TAG_UNIS = TAG(U, N, I, S); bool ms_optionManagersEnabled = true; } @@ -43,29 +43,29 @@ using namespace OptionManagerNamespace; // PUBLIC Option //=================================================================== -OptionManager::Option::Option (Option::Type const type) : - m_version (0), - m_name (0), - m_section (0), - m_void (0), - m_type (type) +OptionManager::Option::Option(Option::Type const type) : + m_version(0), + m_name(0), + m_section(0), + m_void(0), + m_type(type) { } //------------------------------------------------------------------- -OptionManager::Option::~Option () +OptionManager::Option::~Option() { } //------------------------------------------------------------------- -OptionManager::Option::Option (Option const & rhs) : - m_version (rhs.m_version), - m_name (rhs.m_name), - m_section (rhs.m_section), - m_void (rhs.m_void), - m_type (rhs.m_type) +OptionManager::Option::Option(Option const & rhs) : + m_version(rhs.m_version), + m_name(rhs.m_name), + m_section(rhs.m_section), + m_void(rhs.m_void), + m_type(rhs.m_type) { } @@ -73,48 +73,48 @@ OptionManager::Option::Option (Option const & rhs) : OptionManager::Option & OptionManager::Option::operator= (Option const & rhs) { - m_version = rhs.m_version; - m_name = rhs.m_name; - m_section = rhs.m_section; - m_void = rhs.m_void; - m_type = rhs.m_type; + m_version = rhs.m_version; + m_name = rhs.m_name; + m_section = rhs.m_section; + m_void = rhs.m_void; + m_type = rhs.m_type; return *this; } //------------------------------------------------------------------- -OptionManager::Option::Type OptionManager::Option::getType () const +OptionManager::Option::Type OptionManager::Option::getType() const { return m_type; } //------------------------------------------------------------------- -void OptionManager::Option::debugDump (char const * operation) const +void OptionManager::Option::debugDump(char const * operation) const { UNREF(operation); switch (m_type) { case T_bool: - DEBUG_REPORT_LOG (true, ("OptionManager::Option %s (ver %d) [%s] %s=%s\n", operation, m_version, m_section, m_name, *m_bool ? "true" : "false")); + DEBUG_REPORT_LOG(true, ("OptionManager::Option %s (ver %d) [%s] %s=%s\n", operation, m_version, m_section, m_name, *m_bool ? "true" : "false")); break; case T_float: - DEBUG_REPORT_LOG (true, ("OptionManager::Option %s (ver %d) [%s] %s=%1.5f\n", operation, m_version, m_section, m_name, *m_float)); + DEBUG_REPORT_LOG(true, ("OptionManager::Option %s (ver %d) [%s] %s=%1.5f\n", operation, m_version, m_section, m_name, *m_float)); break; case T_int: - DEBUG_REPORT_LOG (true, ("OptionManager::Option %s (ver %d) [%s] %s=%i\n", operation, m_version, m_section, m_name, *m_int)); + DEBUG_REPORT_LOG(true, ("OptionManager::Option %s (ver %d) [%s] %s=%i\n", operation, m_version, m_section, m_name, *m_int)); break; case T_stdString: - DEBUG_REPORT_LOG (true, ("OptionManager::Option %s (ver %d) [%s] %s=%s\n", operation, m_version, m_section, m_name, m_stdString->c_str ())); + DEBUG_REPORT_LOG(true, ("OptionManager::Option %s (ver %d) [%s] %s=%s\n", operation, m_version, m_section, m_name, m_stdString->c_str())); break; case T_unicodeString: - DEBUG_REPORT_LOG (true, ("OptionManager::Option %s (ver %d) [%s] %s=%s\n", operation, m_version, m_section, m_name, Unicode::wideToNarrow(*m_unicodeString).c_str ())); + DEBUG_REPORT_LOG(true, ("OptionManager::Option %s (ver %d) [%s] %s=%s\n", operation, m_version, m_section, m_name, Unicode::wideToNarrow(*m_unicodeString).c_str())); break; default: @@ -133,24 +133,23 @@ void OptionManager::setOptionManagersEnabled(bool enabled) //---------------------------------------------------------------------- - -OptionManager::OptionManager () : - m_registeredOptionList (new OptionList), - m_savedOptionList (new OptionList), - m_stringList (new StringList), - m_boolList (new BoolList), - m_floatList (new FloatList), - m_intList (new IntList), - m_stdStringList (new StdStringList), - m_unicodeStringList (new UnicodeStringList) +OptionManager::OptionManager() : + m_registeredOptionList(new OptionList), + m_savedOptionList(new OptionList), + m_stringList(new StringList), + m_boolList(new BoolList), + m_floatList(new FloatList), + m_intList(new IntList), + m_stdStringList(new StdStringList), + m_unicodeStringList(new UnicodeStringList) { } //------------------------------------------------------------------- -OptionManager::~OptionManager () +OptionManager::~OptionManager() { - clearSavedLists (); + clearSavedLists(); delete m_registeredOptionList; delete m_savedOptionList; @@ -164,7 +163,7 @@ OptionManager::~OptionManager () //------------------------------------------------------------------- -void OptionManager::load (char const * const fileName) +void OptionManager::load(char const * const fileName) { if (!ms_optionManagersEnabled) return; @@ -174,246 +173,245 @@ void OptionManager::load (char const * const fileName) if (Iff::isValid(fileName)) { Iff iff; - if (iff.open (fileName, true)) + if (iff.open(fileName, true)) { if (iff.getCurrentName() == TAG_OPTN) { - load (iff); + load(iff); } else { - REPORT_LOG (true, ("OptionManager::load: %s not a valid options Iff\n", fileName)); + REPORT_LOG(true, ("OptionManager::load: %s not a valid options Iff\n", fileName)); } } } else { - REPORT_LOG (true, ("OptionManager::load: %s not a valid Iff\n", fileName)); + REPORT_LOG(true, ("OptionManager::load: %s not a valid Iff\n", fileName)); } } else { - REPORT_LOG (true, ("OptionManager::load: %s not found\n", fileName)); + REPORT_LOG(true, ("OptionManager::load: %s not found\n", fileName)); } if (ConfigSharedUtility::getLogOptionManager()) { - OptionList::iterator iter = m_savedOptionList->begin (); - for (; iter != m_savedOptionList->end (); ++iter) - iter->debugDump ("load"); + OptionList::iterator iter = m_savedOptionList->begin(); + for (; iter != m_savedOptionList->end(); ++iter) + iter->debugDump("load"); } } //------------------------------------------------------------------- -void OptionManager::save (char const * const fileName) +void OptionManager::save(char const * const fileName) { if (!ms_optionManagersEnabled) return; - Iff iff (1024); - save (iff); - if (!iff.write (fileName, true)) - DEBUG_REPORT_LOG (true, ("OptionManager::save: could not write %s\n", fileName)); + Iff iff(1024); + save(iff); + if (!iff.write(fileName, true)) + DEBUG_REPORT_LOG(true, ("OptionManager::save: could not write %s\n", fileName)); if (ConfigSharedUtility::getLogOptionManager()) { - OptionList::iterator iter = m_registeredOptionList->begin (); - for (; iter != m_registeredOptionList->end (); ++iter) - iter->debugDump ("save"); + OptionList::iterator iter = m_registeredOptionList->begin(); + for (; iter != m_registeredOptionList->end(); ++iter) + iter->debugDump("save"); } } //---------------------------------------------------------------------- -void OptionManager::clearSavedLists () +void OptionManager::clearSavedLists() { - m_savedOptionList->clear (); + m_savedOptionList->clear(); - std::for_each (m_stringList->begin (), m_stringList->end (), ArrayPointerDeleter ()); - m_stringList->clear (); + std::for_each(m_stringList->begin(), m_stringList->end(), ArrayPointerDeleter()); + m_stringList->clear(); - std::for_each (m_boolList->begin (), m_boolList->end (), PointerDeleter ()); - m_boolList->clear (); + std::for_each(m_boolList->begin(), m_boolList->end(), PointerDeleter()); + m_boolList->clear(); - std::for_each (m_floatList->begin (), m_floatList->end (), PointerDeleter ()); - m_floatList->clear (); + std::for_each(m_floatList->begin(), m_floatList->end(), PointerDeleter()); + m_floatList->clear(); - std::for_each (m_intList->begin (), m_intList->end (), PointerDeleter ()); - m_intList->clear (); + std::for_each(m_intList->begin(), m_intList->end(), PointerDeleter()); + m_intList->clear(); - std::for_each (m_stdStringList->begin (), m_stdStringList->end (), PointerDeleter ()); - m_stdStringList->clear (); + std::for_each(m_stdStringList->begin(), m_stdStringList->end(), PointerDeleter()); + m_stdStringList->clear(); - std::for_each (m_unicodeStringList->begin (), m_unicodeStringList->end (), PointerDeleter ()); - m_unicodeStringList->clear (); + std::for_each(m_unicodeStringList->begin(), m_unicodeStringList->end(), PointerDeleter()); + m_unicodeStringList->clear(); } //------------------------------------------------------------------- -void OptionManager::registerOption (bool & variable, char const * const section, char const * const name, const int version) +void OptionManager::registerOption(bool & variable, char const * const section, char const * const name, const int version) { - Option option (Option::T_bool); - option.m_bool = &variable; + Option option(Option::T_bool); + option.m_bool = &variable; option.m_section = section; - option.m_name = name; + option.m_name = name; option.m_version = version; - m_registeredOptionList->push_back (option); + m_registeredOptionList->push_back(option); - variable = findBool (section, name, variable, version); + variable = findBool(section, name, variable, version); } //------------------------------------------------------------------- -void OptionManager::registerOption (float & variable, char const * const section, char const * const name, const int version) +void OptionManager::registerOption(float & variable, char const * const section, char const * const name, const int version) { - Option option (Option::T_float); - option.m_float = &variable; + Option option(Option::T_float); + option.m_float = &variable; option.m_section = section; - option.m_name = name; + option.m_name = name; option.m_version = version; - m_registeredOptionList->push_back (option); + m_registeredOptionList->push_back(option); - variable = findFloat (section, name, variable, version); + variable = findFloat(section, name, variable, version); } //------------------------------------------------------------------- -void OptionManager::registerOption (int & variable, char const * const section, char const * const name, const int version) +void OptionManager::registerOption(int & variable, char const * const section, char const * const name, const int version) { - Option option (Option::T_int); - option.m_int = &variable; + Option option(Option::T_int); + option.m_int = &variable; option.m_section = section; - option.m_name = name; + option.m_name = name; option.m_version = version; - m_registeredOptionList->push_back (option); + m_registeredOptionList->push_back(option); - variable = findInt (section, name, variable, version); + variable = findInt(section, name, variable, version); } //---------------------------------------------------------------------- -void OptionManager::registerOption (std::string & variable, char const * const section, char const * const name, const int version) +void OptionManager::registerOption(std::string & variable, char const * const section, char const * const name, const int version) { - Option option (Option::T_stdString); - option.m_stdString = &variable; - option.m_section = section; - option.m_name = name; - option.m_version = version; - m_registeredOptionList->push_back (option); + Option option(Option::T_stdString); + option.m_stdString = &variable; + option.m_section = section; + option.m_name = name; + option.m_version = version; + m_registeredOptionList->push_back(option); - variable = findStdString (section, name, variable, version); + variable = findStdString(section, name, variable, version); } - //---------------------------------------------------------------------- -void OptionManager::registerOption (Unicode::String & variable, char const * const section, char const * const name, const int version) +void OptionManager::registerOption(Unicode::String & variable, char const * const section, char const * const name, const int version) { - Option option (Option::T_unicodeString); + Option option(Option::T_unicodeString); option.m_unicodeString = &variable; - option.m_section = section; - option.m_name = name; - option.m_version = version; - m_registeredOptionList->push_back (option); + option.m_section = section; + option.m_name = name; + option.m_version = version; + m_registeredOptionList->push_back(option); - variable = findUnicodeString (section, name, variable, version); + variable = findUnicodeString(section, name, variable, version); } //=================================================================== // STATIC PRIVATE OptionManager //=================================================================== -bool OptionManager::findBool (char const * const section, char const * const name, bool const defaultValue, const int version) +bool OptionManager::findBool(char const * const section, char const * const name, bool const defaultValue, const int version) { bool value = defaultValue; - OptionList::iterator iter = m_savedOptionList->begin (); - for (; iter != m_savedOptionList->end (); ++iter) + OptionList::iterator iter = m_savedOptionList->begin(); + for (; iter != m_savedOptionList->end(); ++iter) { const Option& option = *iter; - if (option.getType () == Option::T_bool && strcmp (section, option.m_section) == 0 && strcmp (name, option.m_name) == 0 && option.m_version == version) + if (section && (option.getType() == Option::T_bool && strcmp(section, option.m_section) == 0 && strcmp(name, option.m_name) == 0 && option.m_version == version)) { value = *option.m_bool; break; } } - if (section && name && ConfigFile::isInstalled ()) - return ConfigFile::getKeyBool (section, name, value, true); + if (section && name && ConfigFile::isInstalled()) + return ConfigFile::getKeyBool(section, name, value, true); return value; } //---------------------------------------------------------------------- -float OptionManager::findFloat (char const * const section, char const * const name, float const defaultValue, const int version) +float OptionManager::findFloat(char const * const section, char const * const name, float const defaultValue, const int version) { float value = defaultValue; - OptionList::iterator iter = m_savedOptionList->begin (); - for (; iter != m_savedOptionList->end (); ++iter) + OptionList::iterator iter = m_savedOptionList->begin(); + for (; iter != m_savedOptionList->end(); ++iter) { const Option& option = *iter; - if (option.getType () == Option::T_float && strcmp (section, option.m_section) == 0 && strcmp (name, option.m_name) == 0 && option.m_version == version) + if (section && (option.getType() == Option::T_float && strcmp(section, option.m_section) == 0 && strcmp(name, option.m_name) == 0 && option.m_version == version)) { value = *option.m_float; break; } } - if (section && name && ConfigFile::isInstalled ()) - return ConfigFile::getKeyFloat (section, name, value, true); + if (section && name && ConfigFile::isInstalled()) + return ConfigFile::getKeyFloat(section, name, value, true); return value; } //---------------------------------------------------------------------- -int OptionManager::findInt (char const * const section, char const * const name, int const defaultValue, const int version) +int OptionManager::findInt(char const * const section, char const * const name, int const defaultValue, const int version) { int value = defaultValue; - OptionList::iterator iter = m_savedOptionList->begin (); - for (; iter != m_savedOptionList->end (); ++iter) + OptionList::iterator iter = m_savedOptionList->begin(); + for (; iter != m_savedOptionList->end(); ++iter) { const Option& option = *iter; - if (option.getType () == Option::T_int && strcmp (section, option.m_section) == 0 && strcmp (name, option.m_name) == 0 && option.m_version == version) + if (section && (option.getType() == Option::T_int && strcmp(section, option.m_section) == 0 && strcmp(name, option.m_name) == 0 && option.m_version == version)) { value = *option.m_int; break; } } - if (section && name && ConfigFile::isInstalled ()) - return ConfigFile::getKeyInt (section, name, value, true); + if (section && name && ConfigFile::isInstalled()) + return ConfigFile::getKeyInt(section, name, value, true); return value; } //---------------------------------------------------------------------- -std::string OptionManager::findStdString (char const * const section, char const * const name, std::string const & defaultValue, const int version) +std::string OptionManager::findStdString(char const * const section, char const * const name, std::string const & defaultValue, const int version) { std::string value = defaultValue; - OptionList::iterator iter = m_savedOptionList->begin (); - for (; iter != m_savedOptionList->end (); ++iter) + OptionList::iterator iter = m_savedOptionList->begin(); + for (; iter != m_savedOptionList->end(); ++iter) { const Option& option = *iter; - if (option.getType () == Option::T_stdString && strcmp (section, option.m_section) == 0 && strcmp (name, option.m_name) == 0 && option.m_version == version) + if (section && (option.getType() == Option::T_stdString && strcmp(section, option.m_section) == 0 && strcmp(name, option.m_name) == 0 && option.m_version == version)) { - NOT_NULL (option.m_stdString); + NOT_NULL(option.m_stdString); value = *option.m_stdString; break; } } - if (section && name && ConfigFile::isInstalled ()) + if (section && name && ConfigFile::isInstalled()) { - const char * const str = ConfigFile::getKeyString (section, name, value.c_str (), true); + const char * const str = ConfigFile::getKeyString(section, name, value.c_str(), true); if (str) - return std::string (str); + return std::string(str); } return value; @@ -421,17 +419,17 @@ std::string OptionManager::findStdString (char const * const section, char const //---------------------------------------------------------------------- -Unicode::String OptionManager::findUnicodeString (char const * const section, char const * const name, Unicode::String const & defaultValue, const int version) +Unicode::String OptionManager::findUnicodeString(char const * const section, char const * const name, Unicode::String const & defaultValue, const int version) { Unicode::String value = defaultValue; - OptionList::iterator iter = m_savedOptionList->begin (); - for (; iter != m_savedOptionList->end (); ++iter) + OptionList::iterator iter = m_savedOptionList->begin(); + for (; iter != m_savedOptionList->end(); ++iter) { const Option& option = *iter; - if (option.getType () == Option::T_unicodeString && strcmp (section, option.m_section) == 0 && strcmp (name, option.m_name) == 0 && option.m_version == version) + if (option.getType() == Option::T_unicodeString && strcmp(section, option.m_section) == 0 && strcmp(name, option.m_name) == 0 && option.m_version == version) { - NOT_NULL (option.m_unicodeString); + NOT_NULL(option.m_unicodeString); value = *option.m_unicodeString; break; } @@ -444,285 +442,285 @@ Unicode::String OptionManager::findUnicodeString (char const * const section, ch //---------------------------------------------------------------------- -void OptionManager::load (Iff & iff) +void OptionManager::load(Iff & iff) { - iff.enterForm (TAG_OPTN); + iff.enterForm(TAG_OPTN); - int version = 0; + int version = 0; - switch (iff.getCurrentName ()) - { - case TAG_0000: - case TAG_0001: - WARNING (true, ("OptionManager::load: detected old version (below 0002), skipping load...")); - break; + switch (iff.getCurrentName()) + { + case TAG_0000: + case TAG_0001: + WARNING(true, ("OptionManager::load: detected old version (below 0002), skipping load...")); + break; // loading of version 0002 still supported in order to convert to version 0003 on save - case TAG_0002: - version = 2; - break; + case TAG_0002: + version = 2; + break; - case TAG_0003: - version = 3; - break; + case TAG_0003: + version = 3; + break; - default: - { - char tagBuffer [5]; - ConvertTagToString (iff.getCurrentName (), tagBuffer); + default: + { + char tagBuffer[5]; + ConvertTagToString(iff.getCurrentName(), tagBuffer); - char buffer [128]; - iff.formatLocation (buffer, sizeof (buffer)); - DEBUG_FATAL (true, ("OptionManager::load - invalid version %s/%s", buffer, tagBuffer)); - } - break; - } + char buffer[128]; + iff.formatLocation(buffer, sizeof(buffer)); + DEBUG_FATAL(true, ("OptionManager::load - invalid version %s/%s", buffer, tagBuffer)); + } + break; + } - if (version >= 2) - { - loadVersion(iff, version); - } + if (version >= 2) + { + loadVersion(iff, version); + } - iff.exitForm (TAG_OPTN, true); + iff.exitForm(TAG_OPTN, true); } //------------------------------------------------------------------- -void OptionManager::save (Iff & iff) +void OptionManager::save(Iff & iff) { - iff.insertForm (TAG_OPTN); + iff.insertForm(TAG_OPTN); - iff.insertForm (TAG_0003); + iff.insertForm(TAG_0003); - OptionList::iterator iter = m_registeredOptionList->begin (); - for (; iter != m_registeredOptionList->end (); ++iter) - { - const Option& option = *iter; + OptionList::iterator iter = m_registeredOptionList->begin(); + for (; iter != m_registeredOptionList->end(); ++iter) + { + const Option& option = *iter; - switch (option.getType ()) - { - case Option::T_bool: - { - iff.insertChunk (TAG_BOOL); + switch (option.getType()) + { + case Option::T_bool: + { + iff.insertChunk(TAG_BOOL); - iff.insertChunkData (static_cast (*option.m_bool ? 1 : 0)); - iff.insertChunkString (option.m_section); - iff.insertChunkString (option.m_name); - iff.insertChunkData (option.m_version); + iff.insertChunkData(static_cast (*option.m_bool ? 1 : 0)); + iff.insertChunkString(option.m_section); + iff.insertChunkString(option.m_name); + iff.insertChunkData(option.m_version); - iff.exitChunk (TAG_BOOL); - } - break; + iff.exitChunk(TAG_BOOL); + } + break; - case Option::T_float: - { - iff.insertChunk (TAG_FLT); + case Option::T_float: + { + iff.insertChunk(TAG_FLT); - iff.insertChunkData (*option.m_float); - iff.insertChunkString (option.m_section); - iff.insertChunkString (option.m_name); - iff.insertChunkData (option.m_version); + iff.insertChunkData(*option.m_float); + iff.insertChunkString(option.m_section); + iff.insertChunkString(option.m_name); + iff.insertChunkData(option.m_version); - iff.exitChunk (TAG_FLT); - } - break; + iff.exitChunk(TAG_FLT); + } + break; - case Option::T_int: - { - iff.insertChunk (TAG_INT); + case Option::T_int: + { + iff.insertChunk(TAG_INT); - iff.insertChunkData (*option.m_int); - iff.insertChunkString (option.m_section); - iff.insertChunkString (option.m_name); - iff.insertChunkData (option.m_version); + iff.insertChunkData(*option.m_int); + iff.insertChunkString(option.m_section); + iff.insertChunkString(option.m_name); + iff.insertChunkData(option.m_version); - iff.exitChunk (TAG_INT); - } - break; + iff.exitChunk(TAG_INT); + } + break; - case Option::T_stdString: - { - iff.insertChunk (TAG_STDS); + case Option::T_stdString: + { + iff.insertChunk(TAG_STDS); - iff.insertChunkString (option.m_stdString->c_str ()); - iff.insertChunkString (option.m_section); - iff.insertChunkString (option.m_name); - iff.insertChunkData (option.m_version); + iff.insertChunkString(option.m_stdString->c_str()); + iff.insertChunkString(option.m_section); + iff.insertChunkString(option.m_name); + iff.insertChunkData(option.m_version); - iff.exitChunk (TAG_STDS); - } - break; + iff.exitChunk(TAG_STDS); + } + break; - case Option::T_unicodeString: - { - iff.insertChunk (TAG_UNIS); + case Option::T_unicodeString: + { + iff.insertChunk(TAG_UNIS); - iff.insertChunkString (*option.m_unicodeString); - iff.insertChunkString (option.m_section); - iff.insertChunkString (option.m_name); - iff.insertChunkData (option.m_version); + iff.insertChunkString(*option.m_unicodeString); + iff.insertChunkString(option.m_section); + iff.insertChunkString(option.m_name); + iff.insertChunkData(option.m_version); - iff.exitChunk (TAG_UNIS); - } - break; + iff.exitChunk(TAG_UNIS); + } + break; - default: - break; - } - } + default: + break; + } + } - iff.exitForm (TAG_0003); + iff.exitForm(TAG_0003); - iff.exitForm (TAG_OPTN); + iff.exitForm(TAG_OPTN); } //------------------------------------------------------------------- void OptionManager::loadVersion(Iff & iff, const int version) { - clearSavedLists (); + clearSavedLists(); Tag versionTag = iff.getCurrentName(); - iff.enterForm (versionTag); + iff.enterForm(versionTag); - while (iff.getNumberOfBlocksLeft ()) + while (iff.getNumberOfBlocksLeft()) + { + switch (iff.getCurrentName()) { - switch (iff.getCurrentName ()) + case TAG_BOOL: + { + iff.enterChunk(TAG_BOOL); + + Option option(Option::T_bool); + option.m_bool = new bool; + *option.m_bool = iff.read_bool8(); + option.m_section = iff.read_string(); + option.m_name = iff.read_string(); + if (version > 2) { - case TAG_BOOL: - { - iff.enterChunk (TAG_BOOL); - - Option option (Option::T_bool); - option.m_bool = new bool; - *option.m_bool = iff.read_bool8 (); - option.m_section = iff.read_string (); - option.m_name = iff.read_string (); - if (version > 2) - { - option.m_version = iff.read_int32 (); - } - m_savedOptionList->push_back (option); - - //-- save these for deleting later - m_stringList->push_back (const_cast (option.m_section)); - m_stringList->push_back (const_cast (option.m_name)); - m_boolList->push_back (option.m_bool); - - iff.exitChunk (TAG_BOOL); - } - break; - - case TAG_FLT: - { - iff.enterChunk (TAG_FLT); - - Option option (Option::T_float); - option.m_float = new float; - *option.m_float = iff.read_float (); - option.m_section = iff.read_string (); - option.m_name = iff.read_string (); - if (version > 2) - { - option.m_version = iff.read_int32 (); - } - m_savedOptionList->push_back (option); - - //-- save these for deleting later - m_stringList->push_back (const_cast (option.m_section)); - m_stringList->push_back (const_cast (option.m_name)); - m_floatList->push_back (option.m_float); - - iff.exitChunk (TAG_FLT); - } - break; - - case TAG_INT: - { - iff.enterChunk (TAG_INT); - - Option option (Option::T_int); - option.m_int = new int; - *option.m_int = iff.read_int32 (); - option.m_section = iff.read_string (); - option.m_name = iff.read_string (); - if (version > 2) - { - option.m_version = iff.read_int32 (); - } - m_savedOptionList->push_back (option); - - //-- save these for deleting later - m_stringList->push_back (const_cast (option.m_section)); - m_stringList->push_back (const_cast (option.m_name)); - m_intList->push_back (option.m_int); - - iff.exitChunk (TAG_INT); - } - break; - - case TAG_STDS: - { - iff.enterChunk (TAG_STDS); - - Option option (Option::T_stdString); - option.m_stdString = new std::string; - *option.m_stdString = iff.read_stdstring (); - option.m_section = iff.read_string (); - option.m_name = iff.read_string (); - if (version > 2) - { - option.m_version = iff.read_int32 (); - } - m_savedOptionList->push_back (option); - - //-- save these for deleting later - m_stringList->push_back (const_cast (option.m_section)); - m_stringList->push_back (const_cast (option.m_name)); - m_stdStringList->push_back (option.m_stdString); - - iff.exitChunk (TAG_STDS); - } - break; - - case TAG_UNIS: - { - iff.enterChunk (TAG_UNIS); - - Option option (Option::T_unicodeString); - option.m_unicodeString = new Unicode::String; - *option.m_unicodeString = iff.read_unicodeString (); - option.m_section = iff.read_string (); - option.m_name = iff.read_string (); - if (version > 2) - { - option.m_version = iff.read_int32 (); - } - m_savedOptionList->push_back (option); - - //-- save these for deleting later - m_stringList->push_back (const_cast (option.m_section)); - m_stringList->push_back (const_cast (option.m_name)); - m_unicodeStringList->push_back (option.m_unicodeString); - - iff.exitChunk (TAG_UNIS); - } - break; - - default: - { - iff.enterChunk (); - iff.exitChunk (true); - } + option.m_version = iff.read_int32(); } + m_savedOptionList->push_back(option); + + //-- save these for deleting later + m_stringList->push_back(const_cast (option.m_section)); + m_stringList->push_back(const_cast (option.m_name)); + m_boolList->push_back(option.m_bool); + + iff.exitChunk(TAG_BOOL); } - - iff.exitForm (versionTag); + break; + + case TAG_FLT: + { + iff.enterChunk(TAG_FLT); + + Option option(Option::T_float); + option.m_float = new float; + *option.m_float = iff.read_float(); + option.m_section = iff.read_string(); + option.m_name = iff.read_string(); + if (version > 2) + { + option.m_version = iff.read_int32(); + } + m_savedOptionList->push_back(option); + + //-- save these for deleting later + m_stringList->push_back(const_cast (option.m_section)); + m_stringList->push_back(const_cast (option.m_name)); + m_floatList->push_back(option.m_float); + + iff.exitChunk(TAG_FLT); + } + break; + + case TAG_INT: + { + iff.enterChunk(TAG_INT); + + Option option(Option::T_int); + option.m_int = new int; + *option.m_int = iff.read_int32(); + option.m_section = iff.read_string(); + option.m_name = iff.read_string(); + if (version > 2) + { + option.m_version = iff.read_int32(); + } + m_savedOptionList->push_back(option); + + //-- save these for deleting later + m_stringList->push_back(const_cast (option.m_section)); + m_stringList->push_back(const_cast (option.m_name)); + m_intList->push_back(option.m_int); + + iff.exitChunk(TAG_INT); + } + break; + + case TAG_STDS: + { + iff.enterChunk(TAG_STDS); + + Option option(Option::T_stdString); + option.m_stdString = new std::string; + *option.m_stdString = iff.read_stdstring(); + option.m_section = iff.read_string(); + option.m_name = iff.read_string(); + if (version > 2) + { + option.m_version = iff.read_int32(); + } + m_savedOptionList->push_back(option); + + //-- save these for deleting later + m_stringList->push_back(const_cast (option.m_section)); + m_stringList->push_back(const_cast (option.m_name)); + m_stdStringList->push_back(option.m_stdString); + + iff.exitChunk(TAG_STDS); + } + break; + + case TAG_UNIS: + { + iff.enterChunk(TAG_UNIS); + + Option option(Option::T_unicodeString); + option.m_unicodeString = new Unicode::String; + *option.m_unicodeString = iff.read_unicodeString(); + option.m_section = iff.read_string(); + option.m_name = iff.read_string(); + if (version > 2) + { + option.m_version = iff.read_int32(); + } + m_savedOptionList->push_back(option); + + //-- save these for deleting later + m_stringList->push_back(const_cast (option.m_section)); + m_stringList->push_back(const_cast (option.m_name)); + m_unicodeStringList->push_back(option.m_unicodeString); + + iff.exitChunk(TAG_UNIS); + } + break; + + default: + { + iff.enterChunk(); + iff.exitChunk(true); + } + } + } + + iff.exitForm(versionTag); //-- copy the loaded values into any registered values - copyOptionListIntersection (*m_savedOptionList, *m_registeredOptionList); + copyOptionListIntersection(*m_savedOptionList, *m_registeredOptionList); } //---------------------------------------------------------------------- @@ -732,51 +730,51 @@ void OptionManager::loadVersion(Iff & iff, const int version) * The size of dst is unchanged. */ - void OptionManager::copyOptionListIntersection (const OptionList & src, OptionList & dst) +void OptionManager::copyOptionListIntersection(const OptionList & src, OptionList & dst) +{ + for (OptionList::const_iterator it = src.begin(); it != src.end(); ++it) { - for (OptionList::const_iterator it = src.begin (); it != src.end (); ++it) + const Option & sopt = *it; + + for (OptionList::iterator rit = dst.begin(); rit != dst.end(); ++rit) { - const Option & sopt = *it; + const Option & dopt = *rit; - for (OptionList::iterator rit = dst.begin (); rit != dst.end (); ++rit) + if (dopt.m_name && sopt.m_name && !strcmp(dopt.m_name, sopt.m_name) && + dopt.m_section && sopt.m_section && !strcmp(dopt.m_section, sopt.m_section) && + dopt.m_type == sopt.m_type && + dopt.m_version == sopt.m_version) // default value takes precedence when version changes { - const Option & dopt = *rit; - - if (dopt.m_name && sopt.m_name && !strcmp (dopt.m_name, sopt.m_name) && - dopt.m_section && sopt.m_section && !strcmp (dopt.m_section, sopt.m_section) && - dopt.m_type == sopt.m_type && - dopt.m_version == sopt.m_version) // default value takes precedence when version changes + switch (dopt.m_type) { - switch (dopt.m_type) - { - case Option::T_bool: - NOT_NULL (dopt.m_bool); - NOT_NULL (sopt.m_bool); - *dopt.m_bool = *sopt.m_bool; - break; - case Option::T_float: - NOT_NULL (dopt.m_float); - NOT_NULL (sopt.m_float); - *dopt.m_float = *sopt.m_float; - break; - case Option::T_int: - NOT_NULL (dopt.m_int); - NOT_NULL (sopt.m_int); - *dopt.m_int = *sopt.m_int; - break; - case Option::T_stdString: - NOT_NULL (dopt.m_stdString); - NOT_NULL (sopt.m_stdString); - *dopt.m_stdString = *sopt.m_stdString; - break; - case Option::T_unicodeString: - NOT_NULL (dopt.m_unicodeString); - NOT_NULL (sopt.m_unicodeString); - *dopt.m_unicodeString = *sopt.m_unicodeString; - break; - } + case Option::T_bool: + NOT_NULL(dopt.m_bool); + NOT_NULL(sopt.m_bool); + *dopt.m_bool = *sopt.m_bool; + break; + case Option::T_float: + NOT_NULL(dopt.m_float); + NOT_NULL(sopt.m_float); + *dopt.m_float = *sopt.m_float; + break; + case Option::T_int: + NOT_NULL(dopt.m_int); + NOT_NULL(sopt.m_int); + *dopt.m_int = *sopt.m_int; + break; + case Option::T_stdString: + NOT_NULL(dopt.m_stdString); + NOT_NULL(sopt.m_stdString); + *dopt.m_stdString = *sopt.m_stdString; + break; + case Option::T_unicodeString: + NOT_NULL(dopt.m_unicodeString); + NOT_NULL(sopt.m_unicodeString); + *dopt.m_unicodeString = *sopt.m_unicodeString; + break; } } } } -//=================================================================== +} +//=================================================================== \ No newline at end of file diff --git a/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskLocateStructure.cpp b/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskLocateStructure.cpp index 1bafa34a..8fae32e4 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskLocateStructure.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskLocateStructure.cpp @@ -19,12 +19,15 @@ // ====================================================================== TaskLocateStructure::TaskLocateStructure(const NetworkId &itemId, const std::string &whoRequested) : - TaskRequest(), - m_itemId(itemId), - m_whoRequested(whoRequested) + TaskRequest(), + m_itemId(itemId), + m_whoRequested(whoRequested), + m_x(0), + m_z(0), + m_found(false) { } - + //----------------------------------------------------------------------- TaskLocateStructure::~TaskLocateStructure() @@ -38,7 +41,7 @@ bool TaskLocateStructure::process(DB::Session *session) LocateStructureQuery query; query.item_id = m_itemId; - if (! (session->exec(&query))) + if (!(session->exec(&query))) return false; query.done(); @@ -49,8 +52,8 @@ bool TaskLocateStructure::process(DB::Session *session) m_z = query.z.getValue(); m_sceneId = query.sceneId.getValueASCII(); } - - LOG("CustomerService", ("playerStructure: Locate structure (%s): result %s", m_itemId.getValueString().c_str(), (m_found? "found": "not found"))); + + LOG("CustomerService", ("playerStructure: Locate structure (%s): result %s", m_itemId.getValueString().c_str(), (m_found ? "found" : "not found"))); return true; } @@ -77,7 +80,7 @@ void TaskLocateStructure::onComplete() void TaskLocateStructure::LocateStructureQuery::getSQL(std::string &sql) { - sql=std::string("begin ") + DatabaseProcess::getInstance().getSchemaQualifier()+"loader.locate_structure(:item_id, :x, :z, :scene_id, :found); end;"; + sql = std::string("begin ") + DatabaseProcess::getInstance().getSchemaQualifier() + "loader.locate_structure(:item_id, :x, :z, :scene_id, :found); end;"; } // ---------------------------------------------------------------------- @@ -89,7 +92,7 @@ bool TaskLocateStructure::LocateStructureQuery::bindParameters() if (!bindParameter(z)) return false; if (!bindParameter(sceneId)) return false; if (!bindParameter(found)) return false; - + return true; } @@ -113,4 +116,4 @@ TaskLocateStructure::LocateStructureQuery::LocateStructureQuery() { } -// ====================================================================== +// ====================================================================== \ No newline at end of file diff --git a/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskMoveToPlayer.cpp b/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskMoveToPlayer.cpp index 529feb79..294bd378 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskMoveToPlayer.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskMoveToPlayer.cpp @@ -18,13 +18,14 @@ // ====================================================================== TaskMoveToPlayer::TaskMoveToPlayer(const NetworkId &oid, const NetworkId &player, const std::string &whoRequested) : - TaskRequest(), - m_oid(oid), - m_player(player), - m_whoRequested(whoRequested) + TaskRequest(), + m_oid(oid), + m_player(player), + m_whoRequested(whoRequested), + m_result(0) { } - + //----------------------------------------------------------------------- TaskMoveToPlayer::~TaskMoveToPlayer() @@ -38,13 +39,13 @@ bool TaskMoveToPlayer::process(DB::Session *session) MoveToPlayerQuery query; query.oid = m_oid; query.player = m_player; - - if (! (session->exec(&query))) + + if (!(session->exec(&query))) return false; query.done(); m_result = query.result.getValue(); - + LOG("DatabaseRestore", ("Move Item (%s) to Player (%s): result %i", m_oid.getValueString().c_str(), m_player.getValueString().c_str(), m_result)); return true; } @@ -56,81 +57,81 @@ void TaskMoveToPlayer::onComplete() std::string message; switch (m_result) { - case 1: - message = "Item moved. (It may not reappear until the next server restart.)"; - break; + case 1: + message = "Item moved. (It may not reappear until the next server restart.)"; + break; - case 2: - message = "Could not find player's inventory"; - break; + case 2: + message = "Could not find player's inventory"; + break; - case 3: - message = "Object id does not exist"; - break; + case 3: + message = "Object id does not exist"; + break; - case 4: - message = "The database returned an unknown error code"; - break; + case 4: + message = "The database returned an unknown error code"; + break; - case 5: - message = "Object id cannot be a player"; - break; + case 5: + message = "Object id cannot be a player"; + break; - case 6: - message = "Object id cannot be object/tangible/inventory/character_inventory.iff"; - break; + case 6: + message = "Object id cannot be object/tangible/inventory/character_inventory.iff"; + break; - case 7: - message = "Object id cannot be object/tangible/mission_bag/mission_bag.iff"; - break; + case 7: + message = "Object id cannot be object/tangible/mission_bag/mission_bag.iff"; + break; - case 8: - message = "Object id cannot be object/tangible/datapad/character_datapad.iff"; - break; + case 8: + message = "Object id cannot be object/tangible/datapad/character_datapad.iff"; + break; - case 9: - message = "Object id cannot be object/tangible/bank/character_bank.iff"; - break; + case 9: + message = "Object id cannot be object/tangible/bank/character_bank.iff"; + break; - case 10: - message = "Object id cannot be object/weapon/melee/unarmed/unarmed_default_player.iff"; - break; + case 10: + message = "Object id cannot be object/weapon/melee/unarmed/unarmed_default_player.iff"; + break; - case 11: - message = "Object id cannot be object/player/player.iff"; - break; + case 11: + message = "Object id cannot be object/player/player.iff"; + break; - case 12: - message = "Object id cannot be object/cell/cell.iff"; - break; + case 12: + message = "Object id cannot be object/cell/cell.iff"; + break; - case 13: - message = "Object id cannot be object/tangible/inventory/vendor_inventory.iff"; - break; + case 13: + message = "Object id cannot be object/tangible/inventory/vendor_inventory.iff"; + break; - case 14: - message = "Object cannot be contained directly by a datapad"; - break; - - case 15: - message = "Object cannot be a building"; - break; - - case 16: - message = "Object cannot be an installation"; - break; - - case 17: - message = "Object cannot be a ship"; - break; - - default: - message = "admin.move_item_to_player() returned an unknown error code"; - break; + case 14: + message = "Object cannot be contained directly by a datapad"; + break; + + case 15: + message = "Object cannot be a building"; + break; + + case 16: + message = "Object cannot be an installation"; + break; + + case 17: + message = "Object cannot be a ship"; + break; + + default: + message = "admin.move_item_to_player() returned an unknown error code"; + break; } - + GenericValueTypeMessage > reply("DatabaseConsoleReplyMessage", - std::make_pair(m_whoRequested, message)); + std::make_pair(m_whoRequested, message)); DatabaseProcess::getInstance().sendToAnyGameServer(reply); } @@ -138,7 +139,7 @@ void TaskMoveToPlayer::onComplete() void TaskMoveToPlayer::MoveToPlayerQuery::getSQL(std::string &sql) { - sql=std::string("begin :result := ") + DatabaseProcess::getInstance().getSchemaQualifier()+"admin.move_item_to_player (:item_id, :player_id); end;"; + sql = std::string("begin :result := ") + DatabaseProcess::getInstance().getSchemaQualifier() + "admin.move_item_to_player (:item_id, :player_id); end;"; } // ---------------------------------------------------------------------- @@ -148,7 +149,7 @@ bool TaskMoveToPlayer::MoveToPlayerQuery::bindParameters() if (!bindParameter(result)) return false; if (!bindParameter(oid)) return false; if (!bindParameter(player)) return false; - + return true; } @@ -172,4 +173,4 @@ TaskMoveToPlayer::MoveToPlayerQuery::MoveToPlayerQuery() { } -// ====================================================================== +// ====================================================================== \ No newline at end of file diff --git a/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskRestoreCharacter.cpp b/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskRestoreCharacter.cpp index 863c7004..ae975a1e 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskRestoreCharacter.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskRestoreCharacter.cpp @@ -18,12 +18,15 @@ // ====================================================================== TaskRestoreCharacter::TaskRestoreCharacter(const NetworkId &characterId, const std::string &whoRequested) : - TaskRequest(), - m_characterId(characterId), - m_whoRequested(whoRequested) + TaskRequest(), + m_characterId(characterId), + m_whoRequested(whoRequested), + m_result(0), + m_account(0), + m_templateId(0) { } - + //----------------------------------------------------------------------- TaskRestoreCharacter::~TaskRestoreCharacter() @@ -36,8 +39,8 @@ bool TaskRestoreCharacter::process(DB::Session *session) { RestoreCharacterQuery query; query.character_id = m_characterId; - - if (! (session->exec(&query))) + + if (!(session->exec(&query))) return false; query.done(); @@ -45,7 +48,7 @@ bool TaskRestoreCharacter::process(DB::Session *session) query.character_name.getValue(m_characterName); query.account.getValue(m_account); query.template_id.getValue(m_templateId); - + LOG("DatabaseRestore", ("Restore Character (%s): result %i", m_characterId.getValueString().c_str(), m_result)); return true; } @@ -54,7 +57,7 @@ bool TaskRestoreCharacter::process(DB::Session *session) void TaskRestoreCharacter::onComplete() { - if (m_result==1) + if (m_result == 1) { LoginRestoreCharacterMessage msg(m_whoRequested, m_characterId, m_account, m_characterName, m_templateId, false); //TODO: "/restoreJedi" command DatabaseProcess::getInstance().sendToCentralServer(msg, true); @@ -64,21 +67,21 @@ void TaskRestoreCharacter::onComplete() std::string message; switch (m_result) { - case 2: - message = "Object id was incorrect or character was not deleted"; - break; + case 2: + message = "Object id was incorrect or character was not deleted"; + break; - case 3: - message = "There was an error in the database while attempting to restore the character."; - break; + case 3: + message = "There was an error in the database while attempting to restore the character."; + break; - default: - message = "The database returned an unknown code in response to the request to restore the character."; - break; + default: + message = "The database returned an unknown code in response to the request to restore the character."; + break; } - + GenericValueTypeMessage > reply("DatabaseConsoleReplyMessage", - std::make_pair(m_whoRequested, message)); + std::make_pair(m_whoRequested, message)); DatabaseProcess::getInstance().sendToAnyGameServer(reply); } } @@ -87,7 +90,7 @@ void TaskRestoreCharacter::onComplete() void TaskRestoreCharacter::RestoreCharacterQuery::getSQL(std::string &sql) { - sql=std::string("begin :result := ") + DatabaseProcess::getInstance().getSchemaQualifier()+"admin.restore_character (:character_id, :character_name, :account, :template_id); end;"; + sql = std::string("begin :result := ") + DatabaseProcess::getInstance().getSchemaQualifier() + "admin.restore_character (:character_id, :character_name, :account, :template_id); end;"; } // ---------------------------------------------------------------------- @@ -99,7 +102,7 @@ bool TaskRestoreCharacter::RestoreCharacterQuery::bindParameters() if (!bindParameter(character_name)) return false; if (!bindParameter(account)) return false; if (!bindParameter(template_id)) return false; - + return true; } @@ -123,4 +126,4 @@ TaskRestoreCharacter::RestoreCharacterQuery::RestoreCharacterQuery() { } -// ====================================================================== +// ====================================================================== \ No newline at end of file diff --git a/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskRestoreHouse.cpp b/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskRestoreHouse.cpp index 21457af1..adf76c6d 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskRestoreHouse.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskRestoreHouse.cpp @@ -18,12 +18,13 @@ // ====================================================================== TaskRestoreHouse::TaskRestoreHouse(const NetworkId &houseId, const std::string &whoRequested) : - TaskRequest(), - m_houseId(houseId), - m_whoRequested(whoRequested) + TaskRequest(), + m_houseId(houseId), + m_whoRequested(whoRequested), + m_result(0) { } - + //----------------------------------------------------------------------- TaskRestoreHouse::~TaskRestoreHouse() @@ -36,13 +37,13 @@ bool TaskRestoreHouse::process(DB::Session *session) { RestoreHouseQuery query; query.house_id = m_houseId; - - if (! (session->exec(&query))) + + if (!(session->exec(&query))) return false; query.done(); m_result = query.result.getValue(); - + LOG("DatabaseRestore", ("Restore house (%s): result %i", m_houseId.getValueString().c_str(), m_result)); return true; } @@ -54,25 +55,25 @@ void TaskRestoreHouse::onComplete() std::string message; switch (m_result) { - case 1: - message = "House restored. (It may not reappear until the next server restart.)"; - break; + case 1: + message = "House restored. (It may not reappear until the next server restart.)"; + break; - case 2: - message = "Object id was incorrect or house was not deleted"; - break; + case 2: + message = "Object id was incorrect or house was not deleted"; + break; - case 3: - message = "There was an error in the database while attempting to restore the house."; - break; + case 3: + message = "There was an error in the database while attempting to restore the house."; + break; - default: - message = "The database returned an unknown code in response to the request to restore the house."; - break; + default: + message = "The database returned an unknown code in response to the request to restore the house."; + break; } - + GenericValueTypeMessage > reply("DatabaseConsoleReplyMessage", - std::make_pair(m_whoRequested, message)); + std::make_pair(m_whoRequested, message)); DatabaseProcess::getInstance().sendToAnyGameServer(reply); } @@ -80,7 +81,7 @@ void TaskRestoreHouse::onComplete() void TaskRestoreHouse::RestoreHouseQuery::getSQL(std::string &sql) { - sql=std::string("begin :result := ") + DatabaseProcess::getInstance().getSchemaQualifier()+"admin.restore_house (:house_id); end;"; + sql = std::string("begin :result := ") + DatabaseProcess::getInstance().getSchemaQualifier() + "admin.restore_house (:house_id); end;"; } // ---------------------------------------------------------------------- @@ -89,7 +90,7 @@ bool TaskRestoreHouse::RestoreHouseQuery::bindParameters() { if (!bindParameter(result)) return false; if (!bindParameter(house_id)) return false; - + return true; } @@ -113,4 +114,4 @@ TaskRestoreHouse::RestoreHouseQuery::RestoreHouseQuery() { } -// ====================================================================== +// ====================================================================== \ No newline at end of file diff --git a/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskUndeleteItem.cpp b/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskUndeleteItem.cpp index b81b3243..c74f302d 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskUndeleteItem.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskUndeleteItem.cpp @@ -18,12 +18,13 @@ // ====================================================================== TaskUndeleteItem::TaskUndeleteItem(const NetworkId &itemId, const std::string &whoRequested) : - TaskRequest(), - m_itemId(itemId), - m_whoRequested(whoRequested) + TaskRequest(), + m_itemId(itemId), + m_whoRequested(whoRequested), + m_result(0) { } - + //----------------------------------------------------------------------- TaskUndeleteItem::~TaskUndeleteItem() @@ -37,12 +38,12 @@ bool TaskUndeleteItem::process(DB::Session *session) UndeleteItemQuery query; query.item_id = m_itemId; - if (! (session->exec(&query))) + if (!(session->exec(&query))) return false; query.done(); m_result = query.result.getValue(); - + LOG("DatabaseRestore", ("Undelete Item (%s): result %i", m_itemId.getValueString().c_str(), m_result)); return true; } @@ -54,29 +55,29 @@ void TaskUndeleteItem::onComplete() std::string message; switch (m_result) { - case 1: - message = "Item restored."; - break; + case 1: + message = "Item restored."; + break; - case 2: - message = "Object id was incorrect or item was not deleted"; - break; + case 2: + message = "Object id was incorrect or item was not deleted"; + break; - case 3: - message = "There was an error in the database while attempting to undelete the item."; - break; - case 4: - message = "Item restored. Loading this item from database..."; - Loader::getInstance().locateStructure(m_itemId, m_whoRequested); - break; + case 3: + message = "There was an error in the database while attempting to undelete the item."; + break; + case 4: + message = "Item restored. Loading this item from database..."; + Loader::getInstance().locateStructure(m_itemId, m_whoRequested); + break; - default: - message = "The database returned an unknown code in response to the request to undelete the item."; - break; + default: + message = "The database returned an unknown code in response to the request to undelete the item."; + break; } - + GenericValueTypeMessage > reply("DatabaseConsoleReplyMessage", - std::make_pair(m_whoRequested, message)); + std::make_pair(m_whoRequested, message)); DatabaseProcess::getInstance().sendToAnyGameServer(reply); } @@ -84,7 +85,7 @@ void TaskUndeleteItem::onComplete() void TaskUndeleteItem::UndeleteItemQuery::getSQL(std::string &sql) { - sql=std::string("begin :result := ") + DatabaseProcess::getInstance().getSchemaQualifier()+"admin.undelete_item (:item_id); end;"; + sql = std::string("begin :result := ") + DatabaseProcess::getInstance().getSchemaQualifier() + "admin.undelete_item (:item_id); end;"; } // ---------------------------------------------------------------------- @@ -93,7 +94,7 @@ bool TaskUndeleteItem::UndeleteItemQuery::bindParameters() { if (!bindParameter(result)) return false; if (!bindParameter(item_id)) return false; - + return true; } @@ -117,4 +118,4 @@ TaskUndeleteItem::UndeleteItemQuery::UndeleteItemQuery() { } -// ====================================================================== +// ====================================================================== \ No newline at end of file diff --git a/game/server/application/SwgGameServer/src/shared/objectTemplate/ServerJediManagerObjectTemplate.cpp b/game/server/application/SwgGameServer/src/shared/objectTemplate/ServerJediManagerObjectTemplate.cpp index aaf9f5a9..734633e2 100755 --- a/game/server/application/SwgGameServer/src/shared/objectTemplate/ServerJediManagerObjectTemplate.cpp +++ b/game/server/application/SwgGameServer/src/shared/objectTemplate/ServerJediManagerObjectTemplate.cpp @@ -23,20 +23,20 @@ const std::string DefaultString(""); const StringId DefaultStringId("", 0); -const Vector DefaultVector(0,0,0); +const Vector DefaultVector(0, 0, 0); const TriggerVolumeData DefaultTriggerVolumeData; bool ServerJediManagerObjectTemplate::ms_allowDefaultTemplateParams = true; - /** * Class constructor. */ ServerJediManagerObjectTemplate::ServerJediManagerObjectTemplate(const std::string & filename) //@BEGIN TFD INIT : ServerUniverseObjectTemplate(filename) - ,m_versionOk(true) -//@END TFD INIT + , m_versionOk(true) + , m_templateVersion(0) + //@END TFD INIT { } // ServerJediManagerObjectTemplate::ServerJediManagerObjectTemplate @@ -45,8 +45,8 @@ ServerJediManagerObjectTemplate::ServerJediManagerObjectTemplate(const std::stri */ ServerJediManagerObjectTemplate::~ServerJediManagerObjectTemplate() { -//@BEGIN TFD CLEANUP -//@END TFD CLEANUP + //@BEGIN TFD CLEANUP + //@END TFD CLEANUP } // ServerJediManagerObjectTemplate::~ServerJediManagerObjectTemplate /** @@ -131,8 +131,8 @@ void ServerJediManagerObjectTemplate::testValues(void) const */ void ServerJediManagerObjectTemplate::load(Iff &file) { -static const int MAX_NAME_SIZE = 256; -char paramName[MAX_NAME_SIZE]; + static const int MAX_NAME_SIZE = 256; + char paramName[MAX_NAME_SIZE]; if (file.getCurrentName() != ServerJediManagerObjectTemplate_tag) { @@ -142,7 +142,7 @@ char paramName[MAX_NAME_SIZE]; file.enterForm(); m_templateVersion = file.getCurrentName(); - if (m_templateVersion == TAG(D,E,R,V)) + if (m_templateVersion == TAG(D, E, R, V)) { file.enterForm(); file.enterChunk(); @@ -162,7 +162,7 @@ char paramName[MAX_NAME_SIZE]; file.exitForm(); m_templateVersion = file.getCurrentName(); } - if (getHighestTemplateVersion() != TAG(0,0,0,0)) + if (getHighestTemplateVersion() != TAG(0, 0, 0, 0)) { if (DataLint::isEnabled()) DEBUG_WARNING(true, ("template %s version out of date", file.getFileName())); @@ -183,4 +183,4 @@ char paramName[MAX_NAME_SIZE]; return; } // ServerJediManagerObjectTemplate::load -//@END TFD +//@END TFD \ No newline at end of file diff --git a/game/shared/library/swgSharedUtility/src/shared/CombatEngineData.h b/game/shared/library/swgSharedUtility/src/shared/CombatEngineData.h index 118e2167..c6dbe0da 100755 --- a/game/shared/library/swgSharedUtility/src/shared/CombatEngineData.h +++ b/game/shared/library/swgSharedUtility/src/shared/CombatEngineData.h @@ -6,7 +6,6 @@ // //======================================================================== - #ifndef _INCLUDED_CombatEngineData_H #define _INCLUDED_CombatEngineData_H @@ -67,19 +66,19 @@ namespace CombatEngineData enum DamageType { - DT_none = 0x00000000, - DT_kinetic = 0x00000001, - DT_energy = 0x00000002, - DT_blast = 0x00000004, - DT_stun = 0x00000008, - DT_restraint = 0x00000010, - DT_elemental_heat = 0x00000020, - DT_elemental_cold = 0x00000040, - DT_elemental_acid = 0x00000080, - DT_elemental_eletrical = 0x00000100, - DT_environmental_heat = 0x00000200, - DT_environmental_cold = 0x00000400, - DT_environmental_acid = 0x00000800, + DT_none = 0x00000000, + DT_kinetic = 0x00000001, + DT_energy = 0x00000002, + DT_blast = 0x00000004, + DT_stun = 0x00000008, + DT_restraint = 0x00000010, + DT_elemental_heat = 0x00000020, + DT_elemental_cold = 0x00000040, + DT_elemental_acid = 0x00000080, + DT_elemental_eletrical = 0x00000100, + DT_environmental_heat = 0x00000200, + DT_environmental_cold = 0x00000400, + DT_environmental_acid = 0x00000800, DT_environmental_electrical = 0x00001000 }; @@ -109,14 +108,14 @@ namespace CombatEngineData NetworkId::NetworkIdType target; // if only one target is given NetworkId::NetworkIdType *targets; // for multiple targets } targetData; - + struct { //@todo make this a NetworkId NetworkId::NetworkIdType weapon; // if 0, use attacker's primary weapon int mode; // 0 = primary, 1 = secondary, etc } attackData; - + int attitudeData; Postures::Enumerator postureData; } actionData; @@ -137,23 +136,23 @@ namespace CombatEngineData { DamageData(void); - std::vector damage;// list of attribute modifiers this damage - // caused, pre armor effectiveness - CachedNetworkId attackerId; // who caused the damage (nullptr for - // environmental effects, etc) + std::vector damage;// list of attribute modifiers this damage + // caused, pre armor effectiveness + CachedNetworkId attackerId; // who caused the damage (nullptr for + // environmental effects, etc) NetworkId weaponId; // id of the weapon used DamageType damageType; uint16 hitLocationIndex; uint16 actionId; bool wounded; bool ignoreInvulnerable; -// MessageQueueCombatAction * combatActionMessage; + // MessageQueueCombatAction * combatActionMessage; }; struct DefenseData { - std::vector damage; // list of damage I have taken this - // timeslice + std::vector damage; // list of damage I have taken this + // timeslice }; struct CombatData @@ -162,7 +161,6 @@ namespace CombatEngineData DefenseData defenseData; }; - //-------------------------------------------------- // CombatEngineData inline functions @@ -171,6 +169,7 @@ namespace CombatEngineData type = none; memset(&actionData, 0, sizeof(actionData)); sequenceId = 0; + targetSelf = 0; } // ActionItem::ActionItem inline ActionItem::~ActionItem(void) @@ -195,13 +194,11 @@ namespace CombatEngineData actionId(0), wounded(false), ignoreInvulnerable(false) -// combatActionMessage(nullptr) - { - } - + // combatActionMessage(nullptr) + { + } const char *const getCombatDefenseName(CombatDefense combatDefense); }; - #endif // _INCLUDED_CombatEngineData_H From 5d6bb85fa33d0814e929dc750fdce947691b3682 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Mon, 25 Jul 2016 02:46:02 +0000 Subject: [PATCH 161/302] fix bug --- .../library/sharedCollision/src/shared/core/FloorMesh.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/engine/shared/library/sharedCollision/src/shared/core/FloorMesh.cpp b/engine/shared/library/sharedCollision/src/shared/core/FloorMesh.cpp index 80c3cead..edd97c38 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/FloorMesh.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/FloorMesh.cpp @@ -95,8 +95,7 @@ FloorMesh::FloorMesh(const std::string & filename) m_pathGraph(nullptr), m_appearance(nullptr), m_triMarkCounter(1000), // just some random number - m_objectFloor(false), - m_pathLines() + m_objectFloor(false) { #ifdef _DEBUG @@ -3979,4 +3978,4 @@ bool FloorMesh::getDistanceUncrossable2d(Vector const & V, float maxDistance, fl } } -// ====================================================================== \ No newline at end of file +// ====================================================================== From 3129127815661e30e001eaccba69c4cd4b88f30c Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Mon, 25 Jul 2016 05:17:05 +0000 Subject: [PATCH 162/302] via apathy - Replace push_back with emplace_back to create a default object which is immediately accessed following the changed line via .back() --- .../shared/library/sharedNetwork/src/shared/NetworkHandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/shared/library/sharedNetwork/src/shared/NetworkHandler.cpp b/engine/shared/library/sharedNetwork/src/shared/NetworkHandler.cpp index 39d1b0f4..a013651e 100755 --- a/engine/shared/library/sharedNetwork/src/shared/NetworkHandler.cpp +++ b/engine/shared/library/sharedNetwork/src/shared/NetworkHandler.cpp @@ -256,7 +256,7 @@ void NetworkHandler::onReceive(Connection * c, const unsigned char * d, int s) { if(c) { - services.inputQueue.push_back(IncomingData()); + services.inputQueue.emplace_back(IncomingData()); services.inputQueue.back().connection = c; services.inputQueue.back().byteStream.put(d, s); From d9b4adb7e88597686889701e0b810d6c2dd4148a Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Mon, 25 Jul 2016 05:20:32 +0000 Subject: [PATCH 163/302] per apathy - other files/libs will need this where boost is used - [PATCH] Replace boost::shared_ptr usage with std::shared_ptr --- .../src/shared/UniqueNameList.cpp | 30 +++++++++---------- .../sharedUtility/src/shared/UniqueNameList.h | 6 ++-- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/engine/shared/library/sharedUtility/src/shared/UniqueNameList.cpp b/engine/shared/library/sharedUtility/src/shared/UniqueNameList.cpp index 1a93ed8c..f0f3173a 100755 --- a/engine/shared/library/sharedUtility/src/shared/UniqueNameList.cpp +++ b/engine/shared/library/sharedUtility/src/shared/UniqueNameList.cpp @@ -8,10 +8,10 @@ #include "sharedUtility/FirstSharedUtility.h" #include "sharedUtility/UniqueNameList.h" -#include "boost/smart_ptr.hpp" #include "sharedFoundation/CrcLowerString.h" #include +#include #include #include @@ -31,24 +31,24 @@ public: struct LessNameComparator { - bool operator ()(const boost::shared_ptr &lhs, const boost::shared_ptr &rhs) const; + bool operator ()(const std::shared_ptr &lhs, const std::shared_ptr &rhs) const; - bool operator ()(const boost::shared_ptr &lhs, const boost::shared_ptr &rhs) const; - bool operator ()(const boost::shared_ptr &lhs, const boost::shared_ptr &rhs) const; + bool operator ()(const std::shared_ptr &lhs, const std::shared_ptr &rhs) const; + bool operator ()(const std::shared_ptr &lhs, const std::shared_ptr &rhs) const; - bool operator ()(const boost::shared_ptr &lhs, const CrcLowerString &rhs) const; - bool operator ()(const CrcLowerString &lhs, const boost::shared_ptr &rhs) const; + bool operator ()(const std::shared_ptr &lhs, const CrcLowerString &rhs) const; + bool operator ()(const CrcLowerString &lhs, const std::shared_ptr &rhs) const; }; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - public: - NameInfo(const boost::shared_ptr &name, int index); + NameInfo(const std::shared_ptr &name, int index); public: - boost::shared_ptr m_name; + std::shared_ptr m_name; int m_index; private: @@ -62,35 +62,35 @@ private: //lint -esym(1714, LessNameComparator::operator*) // not referenced // wrong, in STL functions -inline bool UniqueNameList::NameInfo::LessNameComparator::operator ()(const boost::shared_ptr &lhs, const boost::shared_ptr &rhs) const +inline bool UniqueNameList::NameInfo::LessNameComparator::operator ()(const std::shared_ptr &lhs, const std::shared_ptr &rhs) const { return *(lhs->m_name.get()) < *(rhs->m_name.get()); } // ---------------------------------------------------------------------- -inline bool UniqueNameList::NameInfo::LessNameComparator::operator ()(const boost::shared_ptr &lhs, const boost::shared_ptr &rhs) const +inline bool UniqueNameList::NameInfo::LessNameComparator::operator ()(const std::shared_ptr &lhs, const std::shared_ptr &rhs) const { return *(lhs.get()) < *(rhs->m_name.get()); } // ---------------------------------------------------------------------- -inline bool UniqueNameList::NameInfo::LessNameComparator::operator ()(const boost::shared_ptr &lhs, const boost::shared_ptr &rhs) const +inline bool UniqueNameList::NameInfo::LessNameComparator::operator ()(const std::shared_ptr &lhs, const std::shared_ptr &rhs) const { return *(lhs->m_name.get()) < *(rhs.get()); } // ---------------------------------------------------------------------- -inline bool UniqueNameList::NameInfo::LessNameComparator::operator ()(const boost::shared_ptr &lhs, const CrcLowerString &rhs) const +inline bool UniqueNameList::NameInfo::LessNameComparator::operator ()(const std::shared_ptr &lhs, const CrcLowerString &rhs) const { return *(lhs->m_name.get()) < rhs; } // ---------------------------------------------------------------------- -inline bool UniqueNameList::NameInfo::LessNameComparator::operator ()(const CrcLowerString &lhs, const boost::shared_ptr &rhs) const +inline bool UniqueNameList::NameInfo::LessNameComparator::operator ()(const CrcLowerString &lhs, const std::shared_ptr &rhs) const { return lhs < *(rhs->m_name.get()); } @@ -99,7 +99,7 @@ inline bool UniqueNameList::NameInfo::LessNameComparator::operator ()(const CrcL // class UniqueNameList::NameInfo // ====================================================================== -UniqueNameList::NameInfo::NameInfo(const boost::shared_ptr &name, int index) +UniqueNameList::NameInfo::NameInfo(const std::shared_ptr &name, int index) : m_name(name), m_index(index) { @@ -144,7 +144,7 @@ int UniqueNameList::submitName(const SharedCrcLowerString &name) //-- create it const int newIndex = static_cast(m_nameInfoByName->size()); - boost::shared_ptr newNameInfo(new NameInfo(name, newIndex)); + std::shared_ptr newNameInfo = std::make_shared(name, newIndex); //-- add to lists IGNORE_RETURN(m_nameInfoByName->insert(result.first, newNameInfo)); diff --git a/engine/shared/library/sharedUtility/src/shared/UniqueNameList.h b/engine/shared/library/sharedUtility/src/shared/UniqueNameList.h index d96f5665..37958778 100755 --- a/engine/shared/library/sharedUtility/src/shared/UniqueNameList.h +++ b/engine/shared/library/sharedUtility/src/shared/UniqueNameList.h @@ -13,7 +13,7 @@ class CrcLowerString; -namespace boost +namespace std { template class shared_ptr; @@ -37,7 +37,7 @@ class UniqueNameList { public: - typedef boost::shared_ptr SharedCrcLowerString; + typedef std::shared_ptr SharedCrcLowerString; public: @@ -56,7 +56,7 @@ private: struct NameInfo; - typedef stdvector >::fwd NameInfoVector; + typedef stdvector >::fwd NameInfoVector; private: From 80b0db532781ef44b8617a865c91920f6ffb9517 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Mon, 25 Jul 2016 05:25:38 +0000 Subject: [PATCH 164/302] another patch by apathy to remove shared_ptr --- .../shared/library/sharedGame/src/shared/core/CraftingData.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/engine/shared/library/sharedGame/src/shared/core/CraftingData.h b/engine/shared/library/sharedGame/src/shared/core/CraftingData.h index d52a5ad6..7eb2dcad 100755 --- a/engine/shared/library/sharedGame/src/shared/core/CraftingData.h +++ b/engine/shared/library/sharedGame/src/shared/core/CraftingData.h @@ -10,8 +10,9 @@ #define INCLUDED_CraftingData_H #include "sharedFoundation/NetworkId.h" -#include "boost/smart_ptr.hpp" #include "StringId.h" + +#include #include class CreatureObject; @@ -210,7 +211,7 @@ namespace Crafting //------------------------------------------------------------------------------ - typedef boost::shared_ptr SimpleIngredientPtr; + typedef std::shared_ptr SimpleIngredientPtr; typedef std::vector Ingredients; //------------------------------------------------------------------------------ From 00fa2c450b214a56e9d26dc23c3dd2b38f769fbe Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Mon, 25 Jul 2016 05:26:31 +0000 Subject: [PATCH 165/302] [apathy] - emplace_back --- .../sharedGame/src/shared/core/SharedBuildoutAreaManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/shared/library/sharedGame/src/shared/core/SharedBuildoutAreaManager.cpp b/engine/shared/library/sharedGame/src/shared/core/SharedBuildoutAreaManager.cpp index 5786d3e6..66ddbb64 100755 --- a/engine/shared/library/sharedGame/src/shared/core/SharedBuildoutAreaManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/SharedBuildoutAreaManager.cpp @@ -223,7 +223,7 @@ void SharedBuildoutAreaManager::install() int const areaCount = areaListTable.getNumRows(); for (int areaRow = 0; areaRow < areaCount; ++areaRow) { - areasForScene.push_back(BuildoutArea()); + areasForScene.emplace_back(BuildoutArea()); BuildoutArea &buildoutArea = areasForScene.back(); buildoutArea.areaIndex = i*100+areaRow; buildoutArea.areaName = areaListTable.getStringValue("area", areaRow); From c9abbf17719e022240f7978c73bf6d9155775895 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Mon, 25 Jul 2016 05:26:57 +0000 Subject: [PATCH 166/302] [apathy] [PATCH] Replace boost:shared_ptr with std::shared_ptr --- .../library/sharedGame/src/shared/core/WearableEntry.cpp | 4 ++-- .../library/sharedGame/src/shared/core/WearableEntry.h | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/engine/shared/library/sharedGame/src/shared/core/WearableEntry.cpp b/engine/shared/library/sharedGame/src/shared/core/WearableEntry.cpp index f0c9912a..16f9c44e 100755 --- a/engine/shared/library/sharedGame/src/shared/core/WearableEntry.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/WearableEntry.cpp @@ -91,8 +91,8 @@ namespace Archive get(source, isWeapon); if (isWeapon) { - target.m_weaponSharedBaselines = boost::shared_ptr(new BaselinesMessage(source)); - target.m_weaponSharedNpBaselines = boost::shared_ptr(new BaselinesMessage(source)); + target.m_weaponSharedBaselines = std::make_shared(source); + target.m_weaponSharedNpBaselines = std::make_shared(source); } } diff --git a/engine/shared/library/sharedGame/src/shared/core/WearableEntry.h b/engine/shared/library/sharedGame/src/shared/core/WearableEntry.h index 45432612..0ac59b15 100755 --- a/engine/shared/library/sharedGame/src/shared/core/WearableEntry.h +++ b/engine/shared/library/sharedGame/src/shared/core/WearableEntry.h @@ -13,7 +13,8 @@ #include "Archive/AutoByteStream.h" #include "sharedFoundation/NetworkId.h" #include "sharedNetworkMessages/BaselinesMessage.h" -#include "boost/smart_ptr.hpp" + +#include class WearableEntry; @@ -42,8 +43,8 @@ class WearableEntry int m_arrangement; NetworkId m_networkId; int m_objectTemplate; - boost::shared_ptr m_weaponSharedBaselines; - boost::shared_ptr m_weaponSharedNpBaselines; + std::shared_ptr m_weaponSharedBaselines; + std::shared_ptr m_weaponSharedNpBaselines; bool operator==(const WearableEntry&) const; From d7f94e8f7ca63adff684f75b10e9de6db53844a3 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Mon, 25 Jul 2016 05:32:38 +0000 Subject: [PATCH 167/302] [apathy] [PATCH] Replace boost::shared_ptr with std::shared_ptr --- .../server/library/serverGame/src/shared/ai/AiMovementBase.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/server/library/serverGame/src/shared/ai/AiMovementBase.h b/engine/server/library/serverGame/src/shared/ai/AiMovementBase.h index 5881b536..393ba778 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiMovementBase.h +++ b/engine/server/library/serverGame/src/shared/ai/AiMovementBase.h @@ -9,7 +9,7 @@ #ifndef INCLUDED_AiMovementBase_H #define INCLUDED_AiMovementBase_H -#include "boost/smart_ptr.hpp" +#include class AICreatureController; class AiDebugString; @@ -136,7 +136,7 @@ protected: //----------------------------------------------------------------------- // define shared pointer template for AiMovementBase -typedef boost::shared_ptr AiMovementBasePtr; +typedef std::shared_ptr AiMovementBasePtr; #define AiMovementBaseNullPtr AiMovementBasePtr() From e20ac25bfc8bfd18c0b0c1246f70f88904ef83bb Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Mon, 25 Jul 2016 05:33:05 +0000 Subject: [PATCH 168/302] [apathy] [PATCH] Replace boost::shared_ptr with std::shared_ptr --- .../src/shared/FirstServerScript.h | 2 +- .../src/shared/GameScriptObject.cpp | 1 - .../src/shared/GameScriptObject.h | 2 +- .../serverScript/src/shared/JNIWrappers.h | 33 ++++++++++--------- .../src/shared/ScriptDictionary.h | 2 +- .../src/shared/ScriptMethodsWorldInfo.cpp | 1 - 6 files changed, 20 insertions(+), 21 deletions(-) diff --git a/engine/server/library/serverScript/src/shared/FirstServerScript.h b/engine/server/library/serverScript/src/shared/FirstServerScript.h index 0e096798..5735b6b2 100755 --- a/engine/server/library/serverScript/src/shared/FirstServerScript.h +++ b/engine/server/library/serverScript/src/shared/FirstServerScript.h @@ -1,10 +1,10 @@ #ifndef INCLUDED_FirstServerScript_H #define INCLUDED_FirstServerScript_H -#include "boost/smart_ptr.hpp" #include "sharedFoundation/FirstSharedFoundation.h" #include "sharedMemoryManager/FirstSharedMemoryManager.h" #include "StringId.h" +#include #endif diff --git a/engine/server/library/serverScript/src/shared/GameScriptObject.cpp b/engine/server/library/serverScript/src/shared/GameScriptObject.cpp index 3e8e9396..ab118b52 100755 --- a/engine/server/library/serverScript/src/shared/GameScriptObject.cpp +++ b/engine/server/library/serverScript/src/shared/GameScriptObject.cpp @@ -9,7 +9,6 @@ #include "serverScript/FirstServerScript.h" #include "serverScript/GameScriptObject.h" -#include "boost/smart_ptr.hpp" #include "ScriptMessage.h" #include "serverGame/ConfigServerGame.h" #include "serverGame/ServerController.h" diff --git a/engine/server/library/serverScript/src/shared/GameScriptObject.h b/engine/server/library/serverScript/src/shared/GameScriptObject.h index 13947145..3926c42b 100755 --- a/engine/server/library/serverScript/src/shared/GameScriptObject.h +++ b/engine/server/library/serverScript/src/shared/GameScriptObject.h @@ -44,7 +44,7 @@ class ScriptDictionary; class ScriptMessage; class ScriptParams; class ServerObject; -typedef boost::shared_ptr ScriptDictionaryPtr; +typedef std::shared_ptr ScriptDictionaryPtr; struct ScriptData { diff --git a/engine/server/library/serverScript/src/shared/JNIWrappers.h b/engine/server/library/serverScript/src/shared/JNIWrappers.h index b664ccd2..9fe29627 100755 --- a/engine/server/library/serverScript/src/shared/JNIWrappers.h +++ b/engine/server/library/serverScript/src/shared/JNIWrappers.h @@ -11,6 +11,7 @@ #include #include "serverScript/ScriptDictionary.h" +#include namespace boost { @@ -33,22 +34,22 @@ class GlobalArrayRef; class JavaStringParam; class JavaString; class JavaDictionary; -typedef boost::shared_ptr LocalRefParamPtr; -typedef boost::shared_ptr LocalArrayRefParamPtr; -typedef boost::shared_ptr LocalObjectArrayRefParamPtr; -typedef boost::shared_ptr LocalRefPtr; -typedef boost::shared_ptr LocalArrayRefPtr; -typedef boost::shared_ptr LocalObjectArrayRefPtr; -typedef boost::shared_ptr LocalByteArrayRefPtr; -typedef boost::shared_ptr LocalIntArrayRefPtr; -typedef boost::shared_ptr LocalFloatArrayRefPtr; -typedef boost::shared_ptr LocalBooleanArrayRefPtr; -typedef boost::shared_ptr LocalLongArrayRefPtr; -typedef boost::shared_ptr GlobalRefPtr; -typedef boost::shared_ptr GlobalArrayRefPtr; -typedef boost::shared_ptr JavaStringParamPtr; -typedef boost::shared_ptr JavaStringPtr; -typedef boost::shared_ptr JavaDictionaryPtr; +typedef std::shared_ptr LocalRefParamPtr; +typedef std::shared_ptr LocalArrayRefParamPtr; +typedef std::shared_ptr LocalObjectArrayRefParamPtr; +typedef std::shared_ptr LocalRefPtr; +typedef std::shared_ptr LocalArrayRefPtr; +typedef std::shared_ptr LocalObjectArrayRefPtr; +typedef std::shared_ptr LocalByteArrayRefPtr; +typedef std::shared_ptr LocalIntArrayRefPtr; +typedef std::shared_ptr LocalFloatArrayRefPtr; +typedef std::shared_ptr LocalBooleanArrayRefPtr; +typedef std::shared_ptr LocalLongArrayRefPtr; +typedef std::shared_ptr GlobalRefPtr; +typedef std::shared_ptr GlobalArrayRefPtr; +typedef std::shared_ptr JavaStringParamPtr; +typedef std::shared_ptr JavaStringPtr; +typedef std::shared_ptr JavaDictionaryPtr; //======================================================================== diff --git a/engine/server/library/serverScript/src/shared/ScriptDictionary.h b/engine/server/library/serverScript/src/shared/ScriptDictionary.h index 5b689226..4a547d34 100755 --- a/engine/server/library/serverScript/src/shared/ScriptDictionary.h +++ b/engine/server/library/serverScript/src/shared/ScriptDictionary.h @@ -42,7 +42,7 @@ private: ScriptDictionary(const ScriptDictionary &); ScriptDictionary & operator = (const ScriptDictionary &); }; -typedef boost::shared_ptr ScriptDictionaryPtr; +typedef std::shared_ptr ScriptDictionaryPtr; inline ScriptDictionary::ScriptDictionary(void) diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsWorldInfo.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsWorldInfo.cpp index ca3d5b8d..5c0714b7 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsWorldInfo.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsWorldInfo.cpp @@ -11,7 +11,6 @@ #include "serverScript/JavaLibrary.h" #include "UnicodeUtils.h" -#include "boost/smart_ptr.hpp" // for boost::shared_ptr and friends #include "serverGame/ContainerInterface.h" #include "sharedDebug/Profiler.h" #include "serverGame/CreatureObject.h" From a84205abecef5bf2f521f123c0646e2db38292d5 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Mon, 25 Jul 2016 05:34:40 +0000 Subject: [PATCH 169/302] [apathy] [PATCH] Changed forward declaration from boost::shared_ptr to --- .../server/library/serverScript/src/shared/GameScriptObject.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/server/library/serverScript/src/shared/GameScriptObject.h b/engine/server/library/serverScript/src/shared/GameScriptObject.h index 3926c42b..7e9a487e 100755 --- a/engine/server/library/serverScript/src/shared/GameScriptObject.h +++ b/engine/server/library/serverScript/src/shared/GameScriptObject.h @@ -31,7 +31,7 @@ // constants and typedefs /*************************************************************************/ -namespace boost +namespace std { template class shared_ptr; } From be02bf64c305de038b79a27215bb9cbd5092124a Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Mon, 25 Jul 2016 05:39:03 +0000 Subject: [PATCH 170/302] [apathy] [PATCH] Replaced boost::shared_ptr with std::shared_ptr, update headers accordingly --- .../library/serverGame/src/shared/core/ServerUIManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/server/library/serverGame/src/shared/core/ServerUIManager.cpp b/engine/server/library/serverGame/src/shared/core/ServerUIManager.cpp index be9ccc62..14a3123a 100755 --- a/engine/server/library/serverGame/src/shared/core/ServerUIManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/ServerUIManager.cpp @@ -6,7 +6,6 @@ #include "serverGame/FirstServerGame.h" #include "ServerUIManager.h" -#include "boost/smart_ptr.hpp" #include "serverGame/Client.h" #include "serverGame/GameServer.h" #include "serverGame/ServerMessageForwarding.h" @@ -29,6 +28,7 @@ #include "sharedNetworkMessages/SuiUpdatePageMessage.h" #include #include +#include //---------------------------------------------------------------------- From 73d718ba9e7d7ff8409b487fe25831dc63cfc64b Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Mon, 25 Jul 2016 05:39:29 +0000 Subject: [PATCH 171/302] [apathy][PATCH] Cast jboolean to bool --- .../serverScript/src/shared/ScriptMethodsNewbieTutorial.cpp | 2 +- .../serverScript/src/shared/ScriptMethodsPlayerAccount.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsNewbieTutorial.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsNewbieTutorial.cpp index 037b7ff5..c9d0cbfc 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsNewbieTutorial.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsNewbieTutorial.cpp @@ -330,7 +330,7 @@ void JNICALL ScriptMethodsNewbieTutorialNamespace::newbieTutorialSendStartingLoc typedef std::pair Payload; typedef MessageQueueGenericValueType MessageType; - MessageType * const message = new MessageType (Payload (name, result)); + MessageType * const message = new MessageType (Payload (name, (bool)result)); sendMessageToPlayer (*player, message, CM_startingLocationSelectionResult); } diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsPlayerAccount.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsPlayerAccount.cpp index 0234a47c..b7d49e7d 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsPlayerAccount.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsPlayerAccount.cpp @@ -407,7 +407,7 @@ jboolean JNICALL ScriptMethodsPlayerAccountNamespace::setCompletedTutorial(JNIEn const unsigned int stationId = playerObject->getClient()->getStationId(); LOG("CustomerService", ("Setting tutorial bit to %s for stationId %i\n", (value) ? "true" : "false", stationId)); - GenericValueTypeMessage< std::pair > const updateTutorial("LoginToggleCompletedTutorial", std::pair(stationId, value)); + GenericValueTypeMessage< std::pair > const updateTutorial("LoginToggleCompletedTutorial", std::pair(stationId, (bool)value)); GameServer::getInstance().sendToCentralServer(updateTutorial); return true; } From 0f815ce30e4069c42783ab2db7faadadafc9c69e Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Mon, 25 Jul 2016 05:41:26 +0000 Subject: [PATCH 172/302] include --- .../library/serverScript/src/shared/ScriptMethodsRegion3d.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsRegion3d.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsRegion3d.cpp index 6e209336..3853352d 100755 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsRegion3d.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsRegion3d.cpp @@ -15,6 +15,8 @@ #include "serverGame/RegionSphere.h" #include "serverScript/ScriptParameters.h" +#include + using namespace JNIWrappersNamespace; From 88888e40919107a6c527715777dbe2e1c4dba4de Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Mon, 25 Jul 2016 05:47:57 +0000 Subject: [PATCH 173/302] bye bye, boost! thanks @apathy! --- CMakeLists.txt | 1 - engine/server/library/serverGame/src/CMakeLists.txt | 1 - engine/server/library/serverNetworkMessages/src/CMakeLists.txt | 1 - engine/server/library/serverPathfinding/src/CMakeLists.txt | 1 - engine/server/library/serverScript/src/CMakeLists.txt | 1 - engine/shared/library/sharedNetworkMessages/src/CMakeLists.txt | 1 - engine/shared/library/sharedUtility/src/CMakeLists.txt | 1 - .../shared/library/sharedUtility/src/shared/UniqueNameList.h | 2 +- game/server/application/SwgGameServer/src/CMakeLists.txt | 3 +-- 9 files changed, 2 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 33a0aa14..1137f22e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,6 @@ include_directories(/usr/include/i386-linux-gnu) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) find_package(BISON REQUIRED) -find_package(Boost REQUIRED) find_package(FLEX REQUIRED) find_package(JNI REQUIRED) find_package(LibXml2 REQUIRED) diff --git a/engine/server/library/serverGame/src/CMakeLists.txt b/engine/server/library/serverGame/src/CMakeLists.txt index c4a092e5..3fde09a0 100644 --- a/engine/server/library/serverGame/src/CMakeLists.txt +++ b/engine/server/library/serverGame/src/CMakeLists.txt @@ -752,7 +752,6 @@ include_directories( ${SWG_EXTERNALS_SOURCE_DIR}/ours/library/unicode/include ${SWG_EXTERNALS_SOURCE_DIR}/ours/library/unicodeArchive/include/public ${SWG_EXTERNALS_SOURCE_DIR}/3rd/library/platform/projects - ${Boost_INCLUDE_DIR} ${JNI_INCLUDE_DIRS} ${PCRE_INCLUDE_DIR} ) diff --git a/engine/server/library/serverNetworkMessages/src/CMakeLists.txt b/engine/server/library/serverNetworkMessages/src/CMakeLists.txt index 2e9ded82..edb6e914 100644 --- a/engine/server/library/serverNetworkMessages/src/CMakeLists.txt +++ b/engine/server/library/serverNetworkMessages/src/CMakeLists.txt @@ -509,7 +509,6 @@ include_directories( ${SWG_EXTERNALS_SOURCE_DIR}/ours/library/singleton/include ${SWG_EXTERNALS_SOURCE_DIR}/ours/library/unicode/include ${SWG_EXTERNALS_SOURCE_DIR}/ours/library/unicodeArchive/include/public - ${Boost_INCLUDE_DIR} ) add_library(serverNetworkMessages STATIC diff --git a/engine/server/library/serverPathfinding/src/CMakeLists.txt b/engine/server/library/serverPathfinding/src/CMakeLists.txt index f1127c72..14e03fbb 100644 --- a/engine/server/library/serverPathfinding/src/CMakeLists.txt +++ b/engine/server/library/serverPathfinding/src/CMakeLists.txt @@ -62,7 +62,6 @@ include_directories( ${SWG_EXTERNALS_SOURCE_DIR}/ours/library/localizationArchive/include/public ${SWG_EXTERNALS_SOURCE_DIR}/ours/library/unicode/include ${SWG_EXTERNALS_SOURCE_DIR}/ours/library/unicodeArchive/include/public - ${Boost_INCLUDE_DIR} ) add_library(serverPathfinding STATIC diff --git a/engine/server/library/serverScript/src/CMakeLists.txt b/engine/server/library/serverScript/src/CMakeLists.txt index 12730bfa..7190ea0e 100644 --- a/engine/server/library/serverScript/src/CMakeLists.txt +++ b/engine/server/library/serverScript/src/CMakeLists.txt @@ -138,7 +138,6 @@ include_directories( ${SWG_EXTERNALS_SOURCE_DIR}/ours/library/singleton/include ${SWG_EXTERNALS_SOURCE_DIR}/ours/library/unicode/include ${SWG_EXTERNALS_SOURCE_DIR}/ours/library/unicodeArchive/include/public - ${Boost_INCLUDE_DIR} ${JNI_INCLUDE_DIRS} ) diff --git a/engine/shared/library/sharedNetworkMessages/src/CMakeLists.txt b/engine/shared/library/sharedNetworkMessages/src/CMakeLists.txt index 977aea23..eed44696 100644 --- a/engine/shared/library/sharedNetworkMessages/src/CMakeLists.txt +++ b/engine/shared/library/sharedNetworkMessages/src/CMakeLists.txt @@ -724,7 +724,6 @@ include_directories( ${SWG_EXTERNALS_SOURCE_DIR}/ours/library/singleton/include ${SWG_EXTERNALS_SOURCE_DIR}/ours/library/unicode/include ${SWG_EXTERNALS_SOURCE_DIR}/ours/library/unicodeArchive/include/public - ${Boost_INCLUDE_DIR} ) add_library(sharedNetworkMessages STATIC diff --git a/engine/shared/library/sharedUtility/src/CMakeLists.txt b/engine/shared/library/sharedUtility/src/CMakeLists.txt index d4da46d1..85fbddb3 100644 --- a/engine/shared/library/sharedUtility/src/CMakeLists.txt +++ b/engine/shared/library/sharedUtility/src/CMakeLists.txt @@ -124,7 +124,6 @@ include_directories( ${SWG_EXTERNALS_SOURCE_DIR}/ours/library/localization/include ${SWG_EXTERNALS_SOURCE_DIR}/ours/library/unicode/include ${SWG_EXTERNALS_SOURCE_DIR}/ours/library/unicodeArchive/include/public - ${Boost_INCLUDE_DIR} ) add_library(sharedUtility STATIC diff --git a/engine/shared/library/sharedUtility/src/shared/UniqueNameList.h b/engine/shared/library/sharedUtility/src/shared/UniqueNameList.h index 37958778..dfe33b2f 100755 --- a/engine/shared/library/sharedUtility/src/shared/UniqueNameList.h +++ b/engine/shared/library/sharedUtility/src/shared/UniqueNameList.h @@ -28,7 +28,7 @@ namespace std * (1) unique name to a stable integer index, and (2) integer index * mapped back to unique name. Names are lower case, case insensitive. * - * This class makes use of boost::shared_ptr to minimize the number of + * This class makes use of shared_ptr to minimize the number of * memory allocations associated with using a CrcLowerString. It also * makes use of sorted vectors for storage. */ diff --git a/game/server/application/SwgGameServer/src/CMakeLists.txt b/game/server/application/SwgGameServer/src/CMakeLists.txt index 1bc63e22..85758e34 100644 --- a/game/server/application/SwgGameServer/src/CMakeLists.txt +++ b/game/server/application/SwgGameServer/src/CMakeLists.txt @@ -91,14 +91,13 @@ include_directories( ${SWG_GAME_SOURCE_DIR}/shared/library/swgSharedNetworkMessages/include/public ${SWG_GAME_SOURCE_DIR}/shared/library/swgSharedUtility/include/public ${SWG_GAME_SOURCE_DIR}/server/library/swgServerNetworkMessages/include/public - ${SWG_EXTERNALS_SOURCE_DIR}/ours/library/archive/include + ${SWG_EXTERNALS_SOURCE_DIR}/ours/library/archive/include ${SWG_EXTERNALS_SOURCE_DIR}/ours/library/fileInterface/include/public ${SWG_EXTERNALS_SOURCE_DIR}/ours/library/localization/include ${SWG_EXTERNALS_SOURCE_DIR}/ours/library/localizationArchive/include/public ${SWG_EXTERNALS_SOURCE_DIR}/ours/library/singleton/include ${SWG_EXTERNALS_SOURCE_DIR}/ours/library/unicode/include ${SWG_EXTERNALS_SOURCE_DIR}/ours/library/unicodeArchive/include/public - ${Boost_INCLUDE_DIR} ${JNI_INCLUDE_DIRS} ) From 814cf4f7313a545adfc8bcc1a2fcd88d1de130b2 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Mon, 25 Jul 2016 22:11:10 -0700 Subject: [PATCH 174/302] some more static analyzer suggestions --- .../src/shared/CentralServer.cpp | 917 +++---- .../CentralServer/src/shared/CentralServer.h | 37 +- .../console/ConsoleCommandParserServer.cpp | 422 ++- .../src/shared/core/AuthTransferTracker.cpp | 15 +- .../src/shared/core/ServerBuildoutManager.cpp | 2 +- .../src/shared/core/ServerWorld.cpp | 4 +- .../src/shared/object/GroupObject.cpp | 51 +- .../src/shared/pvp/PvpRuleSetNormal.cpp | 112 +- .../sharedDebug/src/shared/DataLint.cpp | 398 +-- .../src/shared/RemoteDebug_inner.cpp | 451 ++- .../shared/core/AssetCustomizationManager.cpp | 272 +- .../shared/core/TemplateDefinitionFile.cpp | 44 +- .../library/platform/utils/Base/AutoLog.cpp | 607 ++-- .../CSAssistgameapi/CSAssistgameapicore.cpp | 2430 ++++++++--------- .../CSAssist/utils/Base/AutoLog.cpp | 522 ++-- .../ChatAPI/utils/Base/AutoLog.cpp | 522 ++-- 16 files changed, 3350 insertions(+), 3456 deletions(-) diff --git a/engine/server/application/CentralServer/src/shared/CentralServer.cpp b/engine/server/application/CentralServer/src/shared/CentralServer.cpp index 89562972..a8ec0005 100755 --- a/engine/server/application/CentralServer/src/shared/CentralServer.cpp +++ b/engine/server/application/CentralServer/src/shared/CentralServer.cpp @@ -122,15 +122,14 @@ #include "unicodeArchive/UnicodeArchive.h" #include - // Trying todo something here ... #include "webAPI.h" namespace CentralServerNamespace { - bool gs_connectionServersPublic=false; - bool gs_clusterIsLocked=false; - bool gs_clusterIsSecret=false; + bool gs_connectionServersPublic = false; + bool gs_clusterIsLocked = false; + bool gs_clusterIsSecret = false; std::map ms_sceneToHostMap; @@ -158,99 +157,97 @@ using namespace CentralServerNamespace; // ====================================================================== CentralServer::CentralObject::CentralObject() : -m_sceneId(), -m_authoritativeProcess(0), -m_proxyProcessList() + m_sceneId(), + m_authoritativeProcess(0), + m_proxyProcessList() { - } //----------------------------------------------------------------------- CentralServer::CentralObject::CentralObject(const CentralServer::SceneId & sceneId, uint32 authProcess) : -m_sceneId(sceneId), -m_authoritativeProcess(authProcess), -m_proxyProcessList() + m_sceneId(sceneId), + m_authoritativeProcess(authProcess), + m_proxyProcessList() { - } //----------------------------------------------------------------------- CentralServer::CentralServer() : -Singleton(), -MessageDispatch::Receiver(), -m_connectionServerConnections(), -m_chatServerConnections(), -m_csServerConnections(), -m_gameServers(), -m_accountConnectionMap(), -m_dbProcessServerProcessId(0), -m_done(false), -m_gameService(0), -m_chatService(0), -m_connService(0), -m_csService(0), -m_planetService(0), -m_consoleService(0), -m_transferServerConnection(0), -m_stationPlayersCollectorConnection(0), -m_gameServerConnections(), -m_gameServerConnectionsList(), -m_playerSceneMap(), -m_loginServerConnectionMap(), -m_loginServerKeys(0), -m_loginService(0), -m_pAuctionTransferClient(0), -m_messagesWaitingForPlanetServer(), -m_pendingLoadingObjects(), -m_pendingNewObjects(), -m_nextFreeProcessId(0), -m_taskManager(0), -m_taskService(0), -m_commandLine(), -m_pendingTransfers(), -m_totalPlayerCount(0), -m_totalFreeTrialCount(0), -m_totalEmptySceneCount(0), -m_totalTutorialSceneCount(0), -m_totalFalconSceneCount(0), -m_metricsData(0), -m_pendingPlanetServers(), -m_planetsWaitingForPreload(), -m_planetServers(), -m_nextPlanetWatcherPort(ConfigCentralServer::getFirstPlanetWatcherPort()), -m_databaseBacklogged(false), -m_lastLoadingStateTime(0), -m_timeClusterStarted(time(0)), -m_clusterStartupTime(-1), -m_timeClusterWentIntoLoadingState(time(0)), -m_clusterId(0), -m_serverPings(), -m_shutdownTotalTime(0), -m_shutdownMaxTime(0), -m_shutdownSystemMessage(Unicode::narrowToWide("")), -m_shutdownPhase(0), -m_shutdownHaveDatabaseSaveStart(false), -m_shutdownHaveDatabaseComplete(false), -m_curTime(0), -m_lastTimeSystemTimeMismatchNotification(0), -m_lastTimeSystemTimeMismatchNotificationDescription(), -m_disconnectedTaskManagerList(), -m_populationStatistics(), -m_timePopulationStatisticsRefresh(0), -m_timePopulationStatisticsNextRefresh(0), -m_gcwScoreStatistics(), -m_timeGcwScoreStatisticsRefresh(0), -m_timeGcwScoreStatisticsNextRefresh(0), -m_lastLoginTimeStatistics(), -m_createTimeStatistics(), -m_timeLastLoginTimeStatisticsRefresh(0), -m_timeLastLoginTimeStatisticsNextRefresh(0), -m_numberOfCharacterMatchRequests(0), -m_numberOfCharacterMatchResults(0), -m_timeSpentOnCharacterMatchRequestsMs(0), -m_timeCharacterMatchStatisticsNextRefresh(0) + Singleton(), + MessageDispatch::Receiver(), + m_connectionServerConnections(), + m_chatServerConnections(), + m_csServerConnections(), + m_gameServers(), + m_accountConnectionMap(), + m_dbProcessServerProcessId(0), + m_done(false), + m_gameService(0), + m_chatService(0), + m_connService(0), + m_csService(0), + m_planetService(0), + m_consoleService(0), + m_transferServerConnection(0), + m_stationPlayersCollectorConnection(0), + m_gameServerConnections(), + m_gameServerConnectionsList(), + m_playerSceneMap(), + m_loginServerConnectionMap(), + m_loginServerKeys(0), + m_loginService(0), + m_pAuctionTransferClient(0), + m_messagesWaitingForPlanetServer(), + m_pendingLoadingObjects(), + m_pendingNewObjects(), + m_nextFreeProcessId(0), + m_taskManager(0), + m_taskService(0), + m_commandLine(), + m_pendingTransfers(), + m_totalPlayerCount(0), + m_totalFreeTrialCount(0), + m_totalEmptySceneCount(0), + m_totalTutorialSceneCount(0), + m_totalFalconSceneCount(0), + m_metricsData(0), + m_pendingPlanetServers(), + m_planetsWaitingForPreload(), + m_planetServers(), + m_nextPlanetWatcherPort(ConfigCentralServer::getFirstPlanetWatcherPort()), + m_databaseBacklogged(false), + m_lastLoadingStateTime(0), + m_timeClusterStarted(time(0)), + m_clusterStartupTime(-1), + m_timeClusterWentIntoLoadingState(time(0)), + m_clusterId(0), + m_serverPings(), + m_shutdownTotalTime(0), + m_shutdownMaxTime(0), + m_shutdownSystemMessage(Unicode::narrowToWide("")), + m_shutdownPhase(0), + m_shutdownHaveDatabaseSaveStart(false), + m_shutdownHaveDatabaseComplete(false), + m_curTime(0), + m_lastTimeSystemTimeMismatchNotification(0), + m_lastTimeSystemTimeMismatchNotificationDescription(), + m_disconnectedTaskManagerList(), + m_populationStatistics(), + m_timePopulationStatisticsRefresh(0), + m_timePopulationStatisticsNextRefresh(0), + m_gcwScoreStatistics(), + m_timeGcwScoreStatisticsRefresh(0), + m_timeGcwScoreStatisticsNextRefresh(0), + m_lastLoginTimeStatistics(), + m_createTimeStatistics(), + m_timeLastLoginTimeStatisticsRefresh(0), + m_timeLastLoginTimeStatisticsNextRefresh(0), + m_numberOfCharacterMatchRequests(0), + m_numberOfCharacterMatchResults(0), + m_timeSpentOnCharacterMatchRequestsMs(0), + m_timeCharacterMatchStatisticsNextRefresh(0) { m_curTime = static_cast(time(0)); m_loginServerKeys = new KeyServer(20); @@ -275,9 +272,9 @@ m_timeCharacterMatchStatisticsNextRefresh(0) connectToMessage("TaskConnectionOpened"); connectToMessage("RandomNameRequest"); // from connection server connectToMessage("RandomNameResponse"); // from game server - connectToMessage("VerifyAndLockNameRequest"); // from connection server - connectToMessage("VerifyAndLockNameResponse"); // from game server - + connectToMessage("VerifyAndLockNameRequest"); // from connection server + connectToMessage("VerifyAndLockNameResponse"); // from game server + //Object Messages connectToMessage("RequestObjectMessage"); connectToMessage("RequestChunkMessage"); @@ -386,7 +383,7 @@ m_timeCharacterMatchStatisticsNextRefresh(0) connectToMessage("RestartServerByRoleMessage"); connectToMessage("ExcommunicateGameServerMessage"); connectToMessage("RestartPlanetMessage"); - + // Cluster state connectToMessage("UpdateClusterLockedAndSecretState"); @@ -432,7 +429,7 @@ m_timeCharacterMatchStatisticsNextRefresh(0) CentralServer::~CentralServer() { ConsoleManager::remove(); - + CentralCSHandler::remove(); ms_sceneToHostMap.clear(); @@ -578,9 +575,9 @@ const std::string& CentralServer::getHostForScene(const std::string& scene) cons void CentralServer::getReadyGameServers(std::vector &theList) { std::map::const_iterator i; - for (i = m_gameServerConnections.begin(); i!=m_gameServerConnections.end(); ++i) + for (i = m_gameServerConnections.begin(); i != m_gameServerConnections.end(); ++i) { - if ((*i).second->getProcessId()!=getDbProcessServerProcessId() && i->second->getReady()) + if ((*i).second->getProcessId() != getDbProcessServerProcessId() && i->second->getReady()) theList.push_back(i->second->getProcessId()); } } @@ -654,7 +651,7 @@ GameServerConnection * CentralServer::getGameServer(const uint32 processId) cons { GameServerConnection * result = 0; std::map::const_iterator i = m_gameServerConnections.find(processId); - if(i != m_gameServerConnections.end()) + if (i != m_gameServerConnections.end()) result = (*i).second; return result; } @@ -679,7 +676,7 @@ void CentralServer::pushAllKeys(ConnectionServerConnection * targetConnectionSer { DEBUG_FATAL(static_cast(m_loginServerKeys->getKeyCount()) < 0, ("Invalid number of keys (uint overflow) in CentralServer.h")); - for(int i = static_cast(m_loginServerKeys->getKeyCount()) - 1; i >= 0 ; i --) + for (int i = static_cast(m_loginServerKeys->getKeyCount()) - 1; i >= 0; i--) { ConnectionKeyPush pk(m_loginServerKeys->getKey(static_cast(i))); targetConnectionServer->send(pk, true); @@ -717,7 +714,7 @@ void CentralServer::launchStartingProcesses() const launchStartingConnectionServers(); std::string options = "-s dbProcess centralServerAddress="; - if(getGameService()) + if (getGameService()) { options += getGameService()->getBindAddress(); } @@ -730,7 +727,7 @@ void CentralServer::launchStartingProcesses() const m_taskManager->send(pd, true); options = "-s ChatServer centralServerAddress="; - if(getChatService()) + if (getChatService()) { options += getChatService()->getBindAddress(); } @@ -744,7 +741,7 @@ void CentralServer::launchStartingProcesses() const m_taskManager->send(pc, true); options = "-s CustomerServiceServer centralServerAddress="; - if(getCustomerService()) + if (getCustomerService()) { options += getCustomerService()->getBindAddress(); } @@ -775,17 +772,17 @@ void CentralServer::launchStartingConnectionServers() const char const * const host = ConfigCentralServer::getStartingConnectionServer(i); if (host) { - char const * listenAddress = strchr(host,':'); + char const * listenAddress = strchr(host, ':'); DEBUG_FATAL(!listenAddress, ("Could not start up connection server because string %s has no listen address", host)); std::string hostString(host, static_cast(listenAddress - host)); ++listenAddress; - char const * publicPort = strchr(listenAddress,':'); + char const * publicPort = strchr(listenAddress, ':'); DEBUG_FATAL(!publicPort, ("Could not start up connection server because string %s has no public port", host)); std::string listenString(listenAddress, static_cast(publicPort - listenAddress)); ++publicPort; - char const * privatePort = strchr(publicPort,':'); + char const * privatePort = strchr(publicPort, ':'); DEBUG_FATAL(!privatePort, ("Could not start up connection server because string %s has no private port", host)); std::string publicPortString(publicPort, static_cast(privatePort - publicPort)); ++privatePort; @@ -800,13 +797,12 @@ void CentralServer::launchStartingConnectionServers() const } // if there were none specified, use defaults - if(i == 0) + if (i == 0) { // must update s_connectionServerHostList before calling startConnectionServer() s_connectionServerHostList.push_back("node0"); startConnectionServer(s_connectionServerHostList.size(), NetworkHandler::getHostName(), 0, 0, 0); } - } //----------------------------------------------------------------------- @@ -818,7 +814,7 @@ void CentralServer::launchStartingPlanetServers() int i = 0; int const numberOfStartPlanets = ConfigCentralServer::getNumberOfStartPlanets(); - for (i = 0; i < numberOfStartPlanets ; ++i) + for (i = 0; i < numberOfStartPlanets; ++i) { char const * const p = ConfigCentralServer::getStartPlanet(i); if (p) @@ -829,11 +825,11 @@ void CentralServer::launchStartingPlanetServers() std::string hostName; char const * planet = p; NOT_NULL(planet); - char const * host = strchr(planet,':'); + char const * host = strchr(planet, ':'); if (host) { - planetName = std::string(planet, static_cast(host - planet) ); + planetName = std::string(planet, static_cast(host - planet)); ++host; hostName = host; } @@ -849,7 +845,7 @@ void CentralServer::launchStartingPlanetServers() // if there were no planets specified, get the configfile default and // start that planet - if(i == 0) + if (i == 0) { startPlanetServer("any", ConfigCentralServer::getStartPlanet(), 0); } @@ -868,7 +864,7 @@ void CentralServer::launchCommoditiesServer() void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, const MessageDispatch::MessageBase & message) { - if(message.isType("LoginKeyPush")) + if (message.isType("LoginKeyPush")) { // receiving another key Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); @@ -876,7 +872,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons m_loginServerKeys->pushKey(k.getKey()); DEBUG_REPORT_LOG(true, ("Received session key.\n")); ConnectionServerConnectionList::iterator i = m_connectionServerConnections.begin(); - for (;i != m_connectionServerConnections.end(); ++i) + for (; i != m_connectionServerConnections.end(); ++i) { (*i)->send(k, true); } @@ -898,7 +894,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons m_accountConnectionMap.erase(i); } } - else if(message.isType("ConnectionOpened")) + else if (message.isType("ConnectionOpened")) { if (!dynamic_cast(&source)) { @@ -909,13 +905,13 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons newServer->send(pidMessage, true); } } - else if(message.isType("ConnectionServerConnectionClosed")) + else if (message.isType("ConnectionServerConnectionClosed")) { - DEBUG_REPORT_LOG(true,("Handling connection server crash.\n")); + DEBUG_REPORT_LOG(true, ("Handling connection server crash.\n")); ConnectionServerConnection const *c = safe_cast(&source); removeFromAccountConnectionMap(c->getId()); } - else if(message.isType("GameConnectionClosed")) + else if (message.isType("GameConnectionClosed")) { DEBUG_REPORT_LOG(true, ("Game server closed connection\n")); GameServerConnection const *g = safe_cast(&source); @@ -928,12 +924,12 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons m_loginServerConnectionMap[l->getProcessId()] = l; //Send connection server data ConnectionServerConnectionList::iterator i = m_connectionServerConnections.begin(); - for(; i != m_connectionServerConnections.end(); ++i) + for (; i != m_connectionServerConnections.end(); ++i) { const ConnectionServerConnection * const csc = *i; - if ( (csc->getClientServicePortPrivate() != 0) || (csc->getClientServicePortPublic() != 0) ) + if ((csc->getClientServicePortPrivate() != 0) || (csc->getClientServicePortPublic() != 0)) { - const LoginConnectionServerAddress csa(csc->getId(), csc->getClientServiceAddress(), csc->getClientServicePortPrivate(), csc->getClientServicePortPublic(), csc->getPlayerCount(), csc->getPingPort ()); + const LoginConnectionServerAddress csa(csc->getId(), csc->getClientServiceAddress(), csc->getClientServicePortPrivate(), csc->getClientServicePortPublic(), csc->getPlayerCount(), csc->getPingPort()); l->send(csa, true); } } @@ -945,11 +941,11 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons CharacterCreationTracker::getInstance().retryLoginServerCreates(); } - else if(message.isType("LoginConnectionClosed")) + else if (message.isType("LoginConnectionClosed")) { LoginServerConnection const *l = safe_cast(&source); - LoginServerConnectionMapType::iterator i=m_loginServerConnectionMap.find(l->getProcessId()); - if (i!=m_loginServerConnectionMap.end()) + LoginServerConnectionMapType::iterator i = m_loginServerConnectionMap.find(l->getProcessId()); + if (i != m_loginServerConnectionMap.end()) m_loginServerConnectionMap.erase(i); // In development mode, try to reconnect to the login server if we aren't shutting down @@ -959,14 +955,14 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons CharacterCreationTracker::getInstance().onLoginServerDisconnect(l->getProcessId()); } - else if(message.isType("ClusterId")) + else if (message.isType("ClusterId")) { Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); GenericValueTypeMessage const msg(ri); if (m_clusterId == 0) { - FATAL(((msg.getValue() < 1) || (msg.getValue() > 255)),("Cluster Id (%lu) must be between 1 and 255 inclusive", msg.getValue())); + FATAL(((msg.getValue() < 1) || (msg.getValue() > 255)), ("Cluster Id (%lu) must be between 1 and 255 inclusive", msg.getValue())); m_clusterId = static_cast(msg.getValue()); @@ -975,7 +971,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons } } - else if(message.isType("CentralGameServerConnect")) + else if (message.isType("CentralGameServerConnect")) { Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); CentralGameServerConnect c(ri); @@ -983,10 +979,9 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons GameServerConnection *g = const_cast(safe_cast(&source)); if (g != nullptr) { - FATAL(ConfigCentralServer::getValidateBuildVersionNumber() && strcmp(ApplicationVersion::getInternalVersion(), c.getBuildVersionNumber().c_str()), ("Build version number mismatch: central server (%s), remote server %s (%s)", - ApplicationVersion::getInternalVersion(), g->getRemoteAddress().c_str(), c.getBuildVersionNumber().c_str())); + ApplicationVersion::getInternalVersion(), g->getRemoteAddress().c_str(), c.getBuildVersionNumber().c_str())); // a game server (or db process) has connected... addGameServer(g); @@ -1020,9 +1015,9 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons { GameServerConnection *g = const_cast(safe_cast(&source)); std::set::const_iterator chatIter; - for(chatIter = m_chatServerConnections.begin(); chatIter != m_chatServerConnections.end(); ++chatIter) + for (chatIter = m_chatServerConnections.begin(); chatIter != m_chatServerConnections.end(); ++chatIter) { - if((*chatIter)->getGameServicePort()) + if ((*chatIter)->getGameServicePort()) { ChatServerOnline cso((*chatIter)->getRemoteAddress(), (*chatIter)->getGameServicePort()); g->send(cso, true); @@ -1040,16 +1035,16 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons broadcastToGameServers(address); } - else if(message.isType("TaskConnectionClosed")) + else if (message.isType("TaskConnectionClosed")) { // Net::getInstance().connect(Network::Address("127.0.0.1", ConfigCentralServer::getTaskManagerPort()), TaskConnection()); } - else if(message.isType("TaskConnectionOpened")) + else if (message.isType("TaskConnectionOpened")) { DEBUG_REPORT_LOG(true, ("Task manager connection opened\n")); } - else if(message.isType("CentralGameServerDbProcessServerProcessId")) + else if (message.isType("CentralGameServerDbProcessServerProcessId")) { DEBUG_REPORT_LOG(true, ("dbProcess connected\n")); Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); @@ -1061,7 +1056,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons launchStartingPlanetServers(); } - else if(message.isType("RequestChunkMessage")) + else if (message.isType("RequestChunkMessage")) { Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); RequestChunkMessage t(ri); @@ -1069,13 +1064,13 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons // Forward this message to the dbProcess sendToGameServer(m_dbProcessServerProcessId, t, true); } - else if(message.isType("LocateStructureMessage")) + else if (message.isType("LocateStructureMessage")) { Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); LocateStructureMessage t(ri); sendToPlanetServer(t.getSceneId(), t, true); } - else if(message.isType("ForceUnloadObjectMessage")) + else if (message.isType("ForceUnloadObjectMessage")) { //N.B. This message can come from a game server or from the planet server. DEBUG_WARNING(true, ("Received ForceUnloadObject. Need to implement this\n")); @@ -1087,7 +1082,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons //forceUnload(t.getId(),t.getPermaDelete()); } //Character Creation Messages - else if(message.isType("ConnectionCreateCharacter")) + else if (message.isType("ConnectionCreateCharacter")) { Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); ConnectionCreateCharacter c(ri); @@ -1095,50 +1090,49 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons LOG("TraceCharacterCreation", ("%d received ConnectionCreateCharacter", c.getStationId())); CharacterCreationTracker::getInstance().handleCreateNewCharacter(c); } - else if(message.isType("GameCreateCharacterFailed")) + else if (message.isType("GameCreateCharacterFailed")) { DEBUG_REPORT_LOG(true, ("Game server advises central that character creation failed\n")); Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); GameCreateCharacterFailed f(ri); CharacterCreationTracker::getInstance().handleGameCreateCharacterFailed(f.getStationId(), f.getName(), f.getErrorMessage(), f.getOptionalDetailedErrorMessage()); } - else if(message.isType("DatabaseCreateCharacterSuccess")) + else if (message.isType("DatabaseCreateCharacterSuccess")) { DEBUG_REPORT_LOG(true, ("Database Process advises central that character creation succeeded\n")); Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); DatabaseCreateCharacterSuccess s(ri); CharacterCreationTracker::getInstance().handleDatabaseCreateCharacterSuccess(s.getStationId(), s.getCharacterName(), s.getObjectId(), s.getTemplateId(), s.getJedi()); } - else if(message.isType("LoginCreateCharacterAckMessage")) + else if (message.isType("LoginCreateCharacterAckMessage")) { DEBUG_REPORT_LOG(true, ("Login Server advises central that character creation succeeded\n")); Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); LoginCreateCharacterAckMessage s(ri); CharacterCreationTracker::getInstance().handleLoginCreateCharacterAck(s.getStationId()); } - else if(message.isType("LoginRestoreCharacterMessage")) + else if (message.isType("LoginRestoreCharacterMessage")) { Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); LoginRestoreCharacterMessage msg(ri); IGNORE_RETURN(sendToArbitraryLoginServer(msg)); } - else if(message.isType("NewCharacterCreated")) + else if (message.isType("NewCharacterCreated")) { Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); GenericValueTypeMessage const ncc(ri); CentralServer::getInstance().sendToAllConnectionServers(ncc, true); } - else if(message.isType("DatabaseConsoleReplyMessage")) + else if (message.isType("DatabaseConsoleReplyMessage")) { Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); - ri = static_cast(message).getByteStream().begin(); GenericValueTypeMessage > msg(ri); IGNORE_RETURN(sendToRandomGameServer(msg)); } - else if(message.isType("LoginUpgradeAccountMessage")) + else if (message.isType("LoginUpgradeAccountMessage")) { Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); LoginUpgradeAccountMessage msg(ri); @@ -1146,9 +1140,9 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons if (msg.getIsAck()) { MessageToMessage const reply( - MessageToPayload(msg.getReplyToObject(), NetworkId::cms_invalid, msg.getReplyMessage(), msg.getPackedMessageData(), 0, false, MessageToPayload::DT_c,NetworkId::cms_invalid,std::string(), 0), + MessageToPayload(msg.getReplyToObject(), NetworkId::cms_invalid, msg.getReplyMessage(), msg.getPackedMessageData(), 0, false, MessageToPayload::DT_c, NetworkId::cms_invalid, std::string(), 0), 0); - sendToAllGameServers (reply,true); + sendToAllGameServers(reply, true); } else { @@ -1158,7 +1152,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons else if (message.isType("RandomNameRequest")) { GameServerConnection * gameServer = getRandomGameServer(); - if(gameServer) + if (gameServer) { Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); RandomNameRequest crnr(ri); @@ -1176,13 +1170,13 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons } else { - DEBUG_REPORT_LOG(true,("Could not send name to client because unable to determine which connection server to use.\n")); + DEBUG_REPORT_LOG(true, ("Could not send name to client because unable to determine which connection server to use.\n")); } } else if (message.isType("VerifyAndLockNameRequest")) { GameServerConnection * gameServer = getRandomGameServer(); - if(gameServer) + if (gameServer) { Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); VerifyAndLockNameRequest valnr(ri); @@ -1200,12 +1194,12 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons } else { - DEBUG_REPORT_LOG(true,("Could not send name lock response to client because unable to determine which connection server to use.\n")); + DEBUG_REPORT_LOG(true, ("Could not send name lock response to client because unable to determine which connection server to use.\n")); } - } + } else if (message.isType("RequestOIDsMessage")) { - DEBUG_REPORT_LOG(true,("Got RequestOIDsMessage.\n")); + DEBUG_REPORT_LOG(true, ("Got RequestOIDsMessage.\n")); Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); RequestOIDsMessage m(ri); @@ -1216,7 +1210,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons } else if (message.isType("AddOIDBlockMessage")) { - DEBUG_REPORT_LOG(true,("Got AddOIDBlockMessage.\n")); + DEBUG_REPORT_LOG(true, ("Got AddOIDBlockMessage.\n")); Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); AddOIDBlockMessage m(ri); @@ -1228,7 +1222,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons else if (message.isType("LoggedInMessage")) { Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); - LoggedInMessage m (ri); + LoggedInMessage m(ri); DEBUG_REPORT_LOG(true, ("Pending character %lu is logging in or dropping\n", m.getAccountNumber())); // Once they're logged in, Central doesn't need to know about them anymore: @@ -1241,7 +1235,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons CharacterListMessage m(ri); // Find the client connection and send the character to it. - DEBUG_REPORT_LOG(true,("Got CharacterListMessage for %lu.\n",m.getAccountNumber())); + DEBUG_REPORT_LOG(true, ("Got CharacterListMessage for %lu.\n", m.getAccountNumber())); ConnectionServerConnection *conn = getConnectionServerForAccount(m.getAccountNumber()); if (conn) @@ -1250,7 +1244,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons } else { - DEBUG_REPORT_LOG(true,("Warning: received CharacterListMessage for client that is not connected.")); + DEBUG_REPORT_LOG(true, ("Warning: received CharacterListMessage for client that is not connected.")); } } else if (message.isType("ValidateCharacterForLoginMessage")) @@ -1269,10 +1263,10 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons ValidateCharacterForLoginReplyMessage msg(ri); ConnectionServerConnection *conn = getConnectionServerForAccount(msg.getSuid()); - if(conn) - conn->send(msg,true); + if (conn) + conn->send(msg, true); else - DEBUG_REPORT_LOG(true,("Trying to handle ValidateCharacterForLoginReplyMessage for account %lu, but could not determine which connection server to use.\n",msg.getSuid())); + DEBUG_REPORT_LOG(true, ("Trying to handle ValidateCharacterForLoginReplyMessage for account %lu, but could not determine which connection server to use.\n", msg.getSuid())); } else if (message.isType("EnableCharacterMessage")) { @@ -1306,19 +1300,19 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons GenericValueTypeMessage > reply("DatabaseConsoleReplyMessage", std::make_pair(msg.getValue().first, msg.getValue().second)); getRandomGameServer()->send(reply, true); } - else if(message.isType("TransferReplyLoginLocationData")) + else if (message.isType("TransferReplyLoginLocationData")) { Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); GenericValueTypeMessage reply(ri); // If this request has a CS Tool Id associated with it, it is an admin request for the CSTool, - // and so we should send it directly to the connection server, and not depend on a + // and so we should send it directly to the connection server, and not depend on a // transfer server existing. - - if(reply.getValue().getCSToolId() > 0) + + if (reply.getValue().getCSToolId() > 0) { GenericValueTypeMessage loginMessage("TransferLoginCharacterToSourceServer", reply.getValue()); ConnectionServerConnection * conn = getAnyConnectionServer(); - if(conn) + if (conn) { conn->send(loginMessage, true); } @@ -1327,7 +1321,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons LOG("CustomerService", ("CharacterTransfer: Received TransferReplyLoginLocationData from database for character %s\n", reply.getValue().getSourceCharacterName().c_str())); - if(reply.getValue().getTransferRequestSource() == TransferRequestMoveValidation::TRS_transfer_server) + if (reply.getValue().getTransferRequestSource() == TransferRequestMoveValidation::TRS_transfer_server) { CentralServer::getInstance().sendToTransferServer(reply); } @@ -1335,13 +1329,13 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons { // send character to ConnectionServer for login to a game server ConnectionServerConnection * connectionServer = CentralServer::getInstance().getAnyConnectionServer(); - if(connectionServer) + if (connectionServer) { const GenericValueTypeMessage login("TransferLoginCharacterToSourceServer", reply.getValue()); connectionServer->send(login, true); LOG("CustomerService", ("CharacterTransfer: Sending TransferLoginCharacterToSourceServer to ConnectionServer : %s", login.getValue().toString().c_str())); - } + } } } else if (message.isType("CentralPlanetServerConnect")) @@ -1353,7 +1347,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons PlanetManager::addServer(msg.getSceneId(), g); std::map, time_t> >::iterator f = m_pendingPlanetServers.find(msg.getSceneId()); - if(f != m_pendingPlanetServers.end()) + if (f != m_pendingPlanetServers.end()) m_pendingPlanetServers.erase(f); IGNORE_RETURN(m_planetServers.insert(std::make_pair(msg.getSceneId(), g))); @@ -1365,12 +1359,12 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons // handle planet transfers and logins for planet server that aren't up yet std::vector::iterator t; - for(t = m_messagesWaitingForPlanetServer.begin(); t != m_messagesWaitingForPlanetServer.end();) + for (t = m_messagesWaitingForPlanetServer.begin(); t != m_messagesWaitingForPlanetServer.end();) { Archive::ReadIterator tri = t->begin(); const GameNetworkMessage gnm(tri); tri = t->begin(); - if(gnm.isType("RequestGameServerForLoginMessage")) + if (gnm.isType("RequestGameServerForLoginMessage")) { const RequestGameServerForLoginMessage loginMessage(tri); if (loginMessage.getScene() == msg.getSceneId()) @@ -1379,7 +1373,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons handleRequestGameServerForLoginMessage(loginMessage); } } - else if(gnm.isType("RequestSceneTransfer")) + else if (gnm.isType("RequestSceneTransfer")) { const RequestSceneTransfer sceneMessage(tri); if (sceneMessage.getSceneName() == msg.getSceneId()) @@ -1398,14 +1392,14 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons else if (message.isType("RequestSceneTransfer")) { Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); - const RequestSceneTransfer msg (ri); + const RequestSceneTransfer msg(ri); handleRequestSceneTransfer(msg); } else if (message.isType("SceneTransferMessage")) { Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); - SceneTransferMessage msg (ri); + SceneTransferMessage msg(ri); sendToGameServer(msg.getSourceGameServer(), msg, true); } @@ -1432,16 +1426,16 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); MessageToMessage msg(ri); - WARNING_STRICT_FATAL(true,("CentralServer receieved a messageTo. These should not go to Central anymore. Sender was server %u\n", safe_cast(&source)->getProcessId())); + WARNING_STRICT_FATAL(true, ("CentralServer receieved a messageTo. These should not go to Central anymore. Sender was server %u\n", safe_cast(&source)->getProcessId())); } else if (message.isType("MessageToAckMessage")) { Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); MessageToAckMessage msg(ri); - WARNING_STRICT_FATAL(true,("CentralServer receieved a MessageToAckMessage. These should not go to Central anymore. Sender was server %u\n",safe_cast(&source)->getProcessId())); + WARNING_STRICT_FATAL(true, ("CentralServer receieved a MessageToAckMessage. These should not go to Central anymore. Sender was server %u\n", safe_cast(&source)->getProcessId())); } - else if(message.isType("ChatServerConnectionOpened")) + else if (message.isType("ChatServerConnectionOpened")) { // enumerate servers ChatServerConnection *chatServer = const_cast(safe_cast(&source)); @@ -1451,9 +1445,9 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons { ConnectionServerConnection * c = (*ci); - if ( (c != nullptr) - && !c->getChatServiceAddress().empty() - && (c->getChatServicePort() != 0)) + if ((c != nullptr) + && !c->getChatServiceAddress().empty() + && (c->getChatServicePort() != 0)) { EnumerateServers e(true, c->getChatServiceAddress(), c->getChatServicePort(), ct); chatServer->send(e, true); @@ -1512,9 +1506,9 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons { ConnectionServerConnection * c = (*ci); - if ( (c != nullptr) - && !c->getCustomerServiceAddress().empty() - && (c->getCustomerServicePort() != 0)) + if ((c != nullptr) + && !c->getCustomerServiceAddress().empty() + && (c->getCustomerServicePort() != 0)) { EnumerateServers e(true, c->getCustomerServiceAddress(), c->getCustomerServicePort(), ct); csServer->send(e, true); @@ -1525,14 +1519,14 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons } } } - else if(message.isType("ChatServerConnectionClosed")) + else if (message.isType("ChatServerConnectionClosed")) { ChatServerConnection *chatServer = const_cast(safe_cast(&source)); IGNORE_RETURN(m_chatServerConnections.erase(chatServer)); // spawn a new chat server! std::string options = "-s ChatServer centralServerAddress="; - if(CentralServer::getInstance().getChatService()) + if (CentralServer::getInstance().getChatService()) { options += CentralServer::getInstance().getChatService()->getBindAddress(); } @@ -1545,7 +1539,6 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons options += ConfigCentralServer::getClusterName(); TaskSpawnProcess pc(ConfigCentralServer::getChatServerHost(), "ChatServer", options, ConfigCentralServer::getChatServerRestartDelayTimeSeconds()); CentralServer::getInstance().sendTaskMessage(pc); - } else if (message.isType("CustomerServiceConnectionClosed")) { @@ -1554,7 +1547,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons // spawn a new cs server! std::string options = "-s CustomerServiceServer centralServerAddress="; - if(CentralServer::getInstance().getCustomerService()) + if (CentralServer::getInstance().getCustomerService()) { options += CentralServer::getInstance().getCustomerService()->getBindAddress(); } @@ -1568,19 +1561,18 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons TaskSpawnProcess pc("any", "CustomerServiceServer", options); CentralServer::getInstance().sendTaskMessage(pc); } - else if(message.isType("ChatServerOnline")) + else if (message.isType("ChatServerOnline")) { Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); - ChatServerOnline cso (ri); + ChatServerOnline cso(ri); ChatServerConnection *csc = const_cast(safe_cast(&source)); csc->setGameServicePort(cso.getPort()); SceneGameMap::const_iterator iter; - for(iter = m_gameServers.begin(); iter != m_gameServers.end(); ++iter) + for (iter = m_gameServers.begin(); iter != m_gameServers.end(); ++iter) { GameServerConnection * conn = (*iter).second; conn->send(cso, true); } - } else if (message.isType("RequestGameServerForLoginMessage")) { @@ -1618,8 +1610,6 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons handleGameServerForLoginMessage(msg); } - - else if (message.isType("ExchangeListCreditsMessage")) { Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); @@ -1628,8 +1618,6 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons handleExchangeListCreditsMessage(msg); } - - else if (message.isType("PlanetLoadCharacterMessage")) { Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); @@ -1639,7 +1627,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons GenericValueTypeMessage > const aboutToLoadCharacterFromDB("AboutToLoadCharacterFromDB", std::make_pair(msg.getCharacterId(), msg.getGameServerId())); sendToAllGameServersExceptDBProcess(aboutToLoadCharacterFromDB, true); - sendToDBProcess(msg,true); + sendToDBProcess(msg, true); } else if (message.isType("ConnSrvDropDupeConns")) { @@ -1697,7 +1685,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons if (hasDBConnection()) { LOG("CustomerService", ("Player:deleted character %s for stationId %u", msg.getCharacterId().getValueString().c_str(), msg.getStationId())); - sendToDBProcess(msg,true); + sendToDBProcess(msg, true); // let the game servers know that the character is being deleted GenericValueTypeMessage const msg2("DeleteCharacterNotificationMessage", msg.getCharacterId()); @@ -1728,12 +1716,12 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons } else { - WARNING_STRICT_FATAL(true,("Got UpdatePlayerCountMessage from something that wasn't a ConnectionServer.\n")); + WARNING_STRICT_FATAL(true, ("Got UpdatePlayerCountMessage from something that wasn't a ConnectionServer.\n")); } } else if (message.isType("ValidateAccountMessage")) { - DEBUG_REPORT_LOG(true,("ValidateAccountMessage\n")); + DEBUG_REPORT_LOG(true, ("ValidateAccountMessage\n")); Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); ValidateAccountMessage msg(ri); @@ -1745,14 +1733,14 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons } else if (message.isType("ValidateAccountReplyMessage")) { - DEBUG_REPORT_LOG(true,("ValidateAccountReplyMessage\n")); + DEBUG_REPORT_LOG(true, ("ValidateAccountReplyMessage\n")); Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); ValidateAccountReplyMessage msg(ri); - ConnectionServerConnection *conn=getConnectionServerForAccount(msg.getStationId()); + ConnectionServerConnection *conn = getConnectionServerForAccount(msg.getStationId()); if (conn) { - conn->send(msg,true); + conn->send(msg, true); } } else if (message.isType("PreloadRequestCompleteMessage")) @@ -1760,13 +1748,13 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); PreloadRequestCompleteMessage msg(ri); - sendToDBProcess(msg,true); + sendToDBProcess(msg, true); } else if (message.isType("ReconnectToTransferServer")) { - if(ConfigCentralServer::getTransferServerPort()) + if (ConfigCentralServer::getTransferServerPort()) { - if(! getInstance().m_transferServerConnection) + if (!getInstance().m_transferServerConnection) { getInstance().m_transferServerConnection = new TransferServerConnection(ConfigCentralServer::getTransferServerAddress(), ConfigCentralServer::getTransferServerPort()); s_retryTransferServerConnection = true; @@ -1775,9 +1763,9 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons } else if (message.isType("ReconnectToStationPlayersCollector")) { - if(ConfigCentralServer::getStationPlayersCollectorPort()) + if (ConfigCentralServer::getStationPlayersCollectorPort()) { - if(! getInstance().m_stationPlayersCollectorConnection) + if (!getInstance().m_stationPlayersCollectorConnection) { getInstance().m_stationPlayersCollectorConnection = new StationPlayersCollectorConnection(ConfigCentralServer::getStationPlayersCollectorAddress(), ConfigCentralServer::getStationPlayersCollectorPort()); s_retryStationPlayersCollectorConnection = true; @@ -1789,8 +1777,8 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); PreloadFinishedMessage msg(ri); - const PlanetServerConnection *conn=dynamic_cast(&source); - WARNING_STRICT_FATAL(!conn,("Programmer bug: got PreloadFinishedMessaage from something that wasn't a PlanetServer.\n")); + const PlanetServerConnection *conn = dynamic_cast(&source); + WARNING_STRICT_FATAL(!conn, ("Programmer bug: got PreloadFinishedMessaage from something that wasn't a PlanetServer.\n")); if (conn) { if (msg.getFinished()) @@ -1800,7 +1788,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons { m_timeClusterWentIntoLoadingState = 0; - DEBUG_REPORT_LOG(true,("Preload finished on all planets.\n")); + DEBUG_REPORT_LOG(true, ("Preload finished on all planets.\n")); // record how long it took the cluster to come up if (m_clusterStartupTime == -1) @@ -1820,21 +1808,21 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons sendToAllLoginServers(msg); sendTaskMessage(msg); - m_lastLoadingStateTime=time(0); + m_lastLoadingStateTime = time(0); // connect to the character transfer server - if(ConfigCentralServer::getTransferServerPort()) + if (ConfigCentralServer::getTransferServerPort()) { - if(! getInstance().m_transferServerConnection) + if (!getInstance().m_transferServerConnection) { getInstance().m_transferServerConnection = new TransferServerConnection(ConfigCentralServer::getTransferServerAddress(), ConfigCentralServer::getTransferServerPort()); s_retryTransferServerConnection = true; } } - + // connect to the station players collector - if(ConfigCentralServer::getStationPlayersCollectorPort()) + if (ConfigCentralServer::getStationPlayersCollectorPort()) { - if(! getInstance().m_stationPlayersCollectorConnection) + if (!getInstance().m_stationPlayersCollectorConnection) { getInstance().m_stationPlayersCollectorConnection = new StationPlayersCollectorConnection(ConfigCentralServer::getStationPlayersCollectorAddress(), ConfigCentralServer::getStationPlayersCollectorPort()); s_retryStationPlayersCollectorConnection = true; @@ -1848,21 +1836,20 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons } else { - if(getInstance().m_transferServerConnection != nullptr) + if (getInstance().m_transferServerConnection != nullptr) { getInstance().m_transferServerConnection->disconnect(); getInstance().m_transferServerConnection = 0; s_retryTransferServerConnection = false; } - - if(getInstance().m_stationPlayersCollectorConnection != nullptr) + + if (getInstance().m_stationPlayersCollectorConnection != nullptr) { getInstance().m_stationPlayersCollectorConnection->disconnect(); getInstance().m_stationPlayersCollectorConnection = 0; s_retryStationPlayersCollectorConnection = false; } - IGNORE_RETURN(m_planetsWaitingForPreload.insert(conn->getSceneId())); if (isPreloadFinished()) @@ -1870,7 +1857,6 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons else if (m_timeClusterWentIntoLoadingState <= 0) m_timeClusterWentIntoLoadingState = time(0); - sendToAllLoginServers(msg); sendTaskMessage(msg); } @@ -1932,18 +1918,18 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons --(iterFind->second.second); } } - else if(message.isType("SetConnectionServerPublic")) + else if (message.isType("SetConnectionServerPublic")) { Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); SetConnectionServerPublic msg(ri); - if(msg.getIsPublic()) + if (msg.getIsPublic()) gs_connectionServersPublic = true; else gs_connectionServersPublic = false; sendToAllConnectionServers(msg, true); } - else if(message.isType("ProfilerOperationMessage")) + else if (message.isType("ProfilerOperationMessage")) { Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); ProfilerOperationMessage msg(ri); @@ -1961,7 +1947,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons { GameServerConnection const *g = safe_cast(&source); NOT_NULL(g); - LOG("CentralServerPings",("Got reply from %lu",g->getProcessId())); + LOG("CentralServerPings", ("Got reply from %lu", g->getProcessId())); IGNORE_RETURN(m_serverPings.erase(g->getProcessId())); } else if (message.isType("DatabaseBackloggedMessage")) @@ -1984,16 +1970,16 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons else if (message.isType("DatabaseSaveStart")) { - LOG("CentralServer",("Received DatabaseSaveStart network message.")); - if( m_shutdownPhase == 4 ) + LOG("CentralServer", ("Received DatabaseSaveStart network message.")); + if (m_shutdownPhase == 4) { - LOG("CentralServerShutdown",("Shutdown Phase %d: Setting indicator for receipt of DatabaseSaveStart.", m_shutdownPhase)); + LOG("CentralServerShutdown", ("Shutdown Phase %d: Setting indicator for receipt of DatabaseSaveStart.", m_shutdownPhase)); m_shutdownHaveDatabaseSaveStart = true; checkShutdownProcess(); } - else if( m_shutdownPhase == 5 && m_shutdownHaveDatabaseSaveStart) + else if (m_shutdownPhase == 5 && m_shutdownHaveDatabaseSaveStart) { - LOG("CentralServerShutdown",("Shutdown Phase %d: Setting indicator that final database save cycle is complete.", m_shutdownPhase)); + LOG("CentralServerShutdown", ("Shutdown Phase %d: Setting indicator that final database save cycle is complete.", m_shutdownPhase)); m_shutdownHaveDatabaseComplete = true; checkShutdownProcess(); } @@ -2002,15 +1988,15 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons { Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); GenericValueTypeMessage msg(ri); - LOG("CentralServer",("Received DatabaseSaveComplete network message.")); + LOG("CentralServer", ("Received DatabaseSaveComplete network message.")); // tell all the Planet Servers that the save finished - sendToAllPlanetServers(msg,true); + sendToAllPlanetServers(msg, true); // don't want to indicate this yet until we are at the beginning of a full cycle - if( m_shutdownPhase == 5 && m_shutdownHaveDatabaseSaveStart) + if (m_shutdownPhase == 5 && m_shutdownHaveDatabaseSaveStart) { - LOG("CentralServerShutdown",("Shutdown Phase %d: Setting indicator that final database save cycle is complete.", m_shutdownPhase)); + LOG("CentralServerShutdown", ("Shutdown Phase %d: Setting indicator that final database save cycle is complete.", m_shutdownPhase)); m_shutdownHaveDatabaseComplete = true; checkShutdownProcess(); } @@ -2020,22 +2006,21 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); GameNetworkMessage msg(ri); - sendToDBProcess(msg,true); + sendToDBProcess(msg, true); } else if (message.isType("ShutdownCluster")) { - LOG("CentralServerShutdown",("Received ShutdownCluster network message.")); + LOG("CentralServerShutdown", ("Received ShutdownCluster network message.")); Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); ShutdownCluster m(ri); startShutdownProcess(m.getTimeToShutdown(), m.getMaxTime(), m.getSystemMessage()); } else if (message.isType("AbortShutdown")) { - LOG("CentralServerShutdown",("Received AbortShutdown network message.")); + LOG("CentralServerShutdown", ("Received AbortShutdown network message.")); abortShutdownProcess(); } - else if (message.isType("SetSceneForPlayer")) { Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); @@ -2059,7 +2044,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons } else { - m_playerSceneMap[ssfp.getValue().first]=std::make_pair(ssfp.getValue().second.first, (ssfp.getValue().second.second ? (::time(nullptr) + static_cast(ConfigCentralServer::getCtsDenyLoginThresholdSeconds())) : 0)); + m_playerSceneMap[ssfp.getValue().first] = std::make_pair(ssfp.getValue().second.first, (ssfp.getValue().second.second ? (::time(nullptr) + static_cast(ConfigCentralServer::getCtsDenyLoginThresholdSeconds())) : 0)); } } } @@ -2069,21 +2054,21 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); TaskProcessDiedMessage died(ri); LOG("TaskProcessDied", ("received TaskProcessDied for %s:%i", died.getProcessName().c_str(), died.getProcessId()));; - if(died.getProcessName().find("SwgGameServer") != std::string::npos) + if (died.getProcessName().find("SwgGameServer") != std::string::npos) { LOG("TaskProcessDied", ("Dead process %i is a game server", died.getProcessId())); // extract sceneId size_t pos = died.getProcessName().find("sceneID="); - if(pos != std::string::npos) + if (pos != std::string::npos) { pos += std::string("sceneID=").length(); size_t end = died.getProcessName().find_first_of(' ', pos); - if(end != std::string::npos) + if (end != std::string::npos) { std::string scene = died.getProcessName().substr(pos, end - pos); LOG("TaskProcessDied", ("Dead game server process %i was running sceneID %s, advising planet server", died.getProcessId(), scene.c_str())); std::map::iterator f = m_planetServers.find(scene); - if(f != m_planetServers.end()) + if (f != m_planetServers.end()) { f->second->send(died, true); } @@ -2106,37 +2091,37 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons m_disconnectedTaskManagerList = msg.getValue(); } - else if(message.isType("TransferServerConnectionClosed")) + else if (message.isType("TransferServerConnectionClosed")) { // connect to the character transfer server - if(ConfigCentralServer::getTransferServerPort()) + if (ConfigCentralServer::getTransferServerPort()) { - if(s_retryTransferServerConnection) + if (s_retryTransferServerConnection) { getInstance().m_transferServerConnection = new TransferServerConnection(ConfigCentralServer::getTransferServerAddress(), ConfigCentralServer::getTransferServerPort()); } } } - else if(message.isType("StationPlayersCollectorConnectionClosed")) + else if (message.isType("StationPlayersCollectorConnectionClosed")) { // connect to the station players collector - if(ConfigCentralServer::getStationPlayersCollectorPort()) + if (ConfigCentralServer::getStationPlayersCollectorPort()) { - if(s_retryStationPlayersCollectorConnection) + if (s_retryStationPlayersCollectorConnection) { getInstance().m_stationPlayersCollectorConnection = new StationPlayersCollectorConnection(ConfigCentralServer::getStationPlayersCollectorAddress(), ConfigCentralServer::getStationPlayersCollectorPort()); } } } - else if(message.isType("ClaimRewardsMessage")) + else if (message.isType("ClaimRewardsMessage")) { Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); ClaimRewardsMessage msg(ri); sendToArbitraryLoginServer(msg); } - else if(message.isType("ClaimRewardsReplyMessage")) + else if (message.isType("ClaimRewardsReplyMessage")) { - DEBUG_REPORT_LOG(true,("Central got ClaimRewardsReplyMessage\n")); + DEBUG_REPORT_LOG(true, ("Central got ClaimRewardsReplyMessage\n")); Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); ClaimRewardsReplyMessage msg(ri); sendToGameServer(msg.getGameServer(), msg, true); @@ -2148,7 +2133,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons LoginServerConnection const * l = dynamic_cast(&source); if (l) { - m_purgeAccountToLoginServerMap[msg.getValue()]= l->getProcessId(); // remember which login server is handling this purge + m_purgeAccountToLoginServerMap[msg.getValue()] = l->getProcessId(); // remember which login server is handling this purge sendToDBProcess(msg, true); } } @@ -2157,10 +2142,10 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); GenericValueTypeMessage msg(ri); - std::map::iterator i=m_purgeAccountToLoginServerMap.find(msg.getValue()); - if (i!=m_purgeAccountToLoginServerMap.end()) + std::map::iterator i = m_purgeAccountToLoginServerMap.find(msg.getValue()); + if (i != m_purgeAccountToLoginServerMap.end()) { - sendToLoginServer(i->second,msg); + sendToLoginServer(i->second, msg); m_purgeAccountToLoginServerMap.erase(i); } } @@ -2190,8 +2175,8 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); GenericValueTypeMessage msg(ri); - GenericValueTypeMessage const shutdownMsg("ShutdownMessage", 0); - sendToPlanetServer(msg.getValue(),shutdownMsg, true); + GenericValueTypeMessage const shutdownMsg("ShutdownMessage", 0); + sendToPlanetServer(msg.getValue(), shutdownMsg, true); } else if (message.isType("UpdateClusterLockedAndSecretState")) { @@ -2308,27 +2293,27 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons LoginUpgradeAccountMessage::OccupyUnlockedSlotResponse const response = static_cast(occupyUnlockedSlotRsp.getValue().first.first); if (response == LoginUpgradeAccountMessage::OUSR_success) { - LOG("CustomerService",("JediUnlockedSlot:Player %s OccupyUnlockedSlot request SUCCESS", occupyUnlockedSlotRsp.getValue().first.second.getValueString().c_str())); + LOG("CustomerService", ("JediUnlockedSlot:Player %s OccupyUnlockedSlot request SUCCESS", occupyUnlockedSlotRsp.getValue().first.second.getValueString().c_str())); } else if (response == LoginUpgradeAccountMessage::OUSR_db_error) { - LOG("CustomerService",("JediUnlockedSlot:Player %s OccupyUnlockedSlot request FAILED - internal db error", occupyUnlockedSlotRsp.getValue().first.second.getValueString().c_str())); + LOG("CustomerService", ("JediUnlockedSlot:Player %s OccupyUnlockedSlot request FAILED - internal db error", occupyUnlockedSlotRsp.getValue().first.second.getValueString().c_str())); } else if (response == LoginUpgradeAccountMessage::OUSR_account_has_no_unlocked_slot) { - LOG("CustomerService",("JediUnlockedSlot:Player %s OccupyUnlockedSlot request FAILED - account doesn't have an unlocked slot", occupyUnlockedSlotRsp.getValue().first.second.getValueString().c_str())); + LOG("CustomerService", ("JediUnlockedSlot:Player %s OccupyUnlockedSlot request FAILED - account doesn't have an unlocked slot", occupyUnlockedSlotRsp.getValue().first.second.getValueString().c_str())); } else if (response == LoginUpgradeAccountMessage::OUSR_account_has_no_unoccupied_unlocked_slot) { - LOG("CustomerService",("JediUnlockedSlot:Player %s OccupyUnlockedSlot request FAILED - account has no unoccupied unlocked slot", occupyUnlockedSlotRsp.getValue().first.second.getValueString().c_str())); + LOG("CustomerService", ("JediUnlockedSlot:Player %s OccupyUnlockedSlot request FAILED - account has no unoccupied unlocked slot", occupyUnlockedSlotRsp.getValue().first.second.getValueString().c_str())); } else if (response == LoginUpgradeAccountMessage::OUSR_cluster_already_has_unlocked_slot_character) { - LOG("CustomerService",("JediUnlockedSlot:Player %s OccupyUnlockedSlot request FAILED - cluster already has an unlocked slot character", occupyUnlockedSlotRsp.getValue().first.second.getValueString().c_str())); + LOG("CustomerService", ("JediUnlockedSlot:Player %s OccupyUnlockedSlot request FAILED - cluster already has an unlocked slot character", occupyUnlockedSlotRsp.getValue().first.second.getValueString().c_str())); } else { - LOG("CustomerService",("JediUnlockedSlot:Player %s OccupyUnlockedSlot request FAILED - unknown result code (%d)", occupyUnlockedSlotRsp.getValue().first.second.getValueString().c_str(), occupyUnlockedSlotRsp.getValue().first.first)); + LOG("CustomerService", ("JediUnlockedSlot:Player %s OccupyUnlockedSlot request FAILED - unknown result code (%d)", occupyUnlockedSlotRsp.getValue().first.second.getValueString().c_str(), occupyUnlockedSlotRsp.getValue().first.first)); } GameServerConnection * gs = getGameServer(occupyUnlockedSlotRsp.getValue().second); @@ -2347,7 +2332,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons LoginUpgradeAccountMessage::VacateUnlockedSlotResponse const response = static_cast(vacateUnlockedSlotRsp.getValue().first.first); if (response == LoginUpgradeAccountMessage::VUSR_success) { - LOG("CustomerService",("JediUnlockedSlot:Player %s VacateUnlockedSlot request SUCCESS", vacateUnlockedSlotRsp.getValue().first.second.getValueString().c_str())); + LOG("CustomerService", ("JediUnlockedSlot:Player %s VacateUnlockedSlot request SUCCESS", vacateUnlockedSlotRsp.getValue().first.second.getValueString().c_str())); // to safeguard against any sort of timing exploit to create another normal // slot character while this one is being converted to normal, thus allowing @@ -2361,23 +2346,23 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons } else if (response == LoginUpgradeAccountMessage::VUSR_db_error) { - LOG("CustomerService",("JediUnlockedSlot:Player %s VacateUnlockedSlot request FAILED - internal db error", vacateUnlockedSlotRsp.getValue().first.second.getValueString().c_str())); + LOG("CustomerService", ("JediUnlockedSlot:Player %s VacateUnlockedSlot request FAILED - internal db error", vacateUnlockedSlotRsp.getValue().first.second.getValueString().c_str())); } else if (response == LoginUpgradeAccountMessage::VUSR_account_has_no_unlocked_slot) { - LOG("CustomerService",("JediUnlockedSlot:Player %s VacateUnlockedSlot request FAILED - account doesn't have an unlocked slot", vacateUnlockedSlotRsp.getValue().first.second.getValueString().c_str())); + LOG("CustomerService", ("JediUnlockedSlot:Player %s VacateUnlockedSlot request FAILED - account doesn't have an unlocked slot", vacateUnlockedSlotRsp.getValue().first.second.getValueString().c_str())); } else if (response == LoginUpgradeAccountMessage::VUSR_not_unlocked_slot_character) { - LOG("CustomerService",("JediUnlockedSlot:Player %s VacateUnlockedSlot request FAILED - character is not an unlocked slot character", vacateUnlockedSlotRsp.getValue().first.second.getValueString().c_str())); + LOG("CustomerService", ("JediUnlockedSlot:Player %s VacateUnlockedSlot request FAILED - character is not an unlocked slot character", vacateUnlockedSlotRsp.getValue().first.second.getValueString().c_str())); } else if (response == LoginUpgradeAccountMessage::VUSR_no_available_normal_character_slot) { - LOG("CustomerService",("JediUnlockedSlot:Player %s VacateUnlockedSlot request FAILED - no available normal character slot for the account on this galaxy", vacateUnlockedSlotRsp.getValue().first.second.getValueString().c_str())); + LOG("CustomerService", ("JediUnlockedSlot:Player %s VacateUnlockedSlot request FAILED - no available normal character slot for the account on this galaxy", vacateUnlockedSlotRsp.getValue().first.second.getValueString().c_str())); } else { - LOG("CustomerService",("JediUnlockedSlot:Player %s VacateUnlockedSlot request FAILED - unknown result code (%d)", vacateUnlockedSlotRsp.getValue().first.second.getValueString().c_str(), vacateUnlockedSlotRsp.getValue().first.first)); + LOG("CustomerService", ("JediUnlockedSlot:Player %s VacateUnlockedSlot request FAILED - unknown result code (%d)", vacateUnlockedSlotRsp.getValue().first.second.getValueString().c_str(), vacateUnlockedSlotRsp.getValue().first.first)); } GameServerConnection * gs = getGameServer(vacateUnlockedSlotRsp.getValue().second.second); @@ -2396,31 +2381,31 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons LoginUpgradeAccountMessage::SwapUnlockedSlotResponse const response = static_cast(swapUnlockedSlotRsp.getValue().first.first); if (response == LoginUpgradeAccountMessage::SUSR_success) { - LOG("CustomerService",("JediUnlockedSlot:Player %s SwapUnlockedSlot with %s (%s) request SUCCESS", swapUnlockedSlotRsp.getValue().first.second.getValueString().c_str(), swapUnlockedSlotRsp.getValue().second.second.first.getValueString().c_str(), swapUnlockedSlotRsp.getValue().second.second.second.c_str())); + LOG("CustomerService", ("JediUnlockedSlot:Player %s SwapUnlockedSlot with %s (%s) request SUCCESS", swapUnlockedSlotRsp.getValue().first.second.getValueString().c_str(), swapUnlockedSlotRsp.getValue().second.second.first.getValueString().c_str(), swapUnlockedSlotRsp.getValue().second.second.second.c_str())); } else if (response == LoginUpgradeAccountMessage::SUSR_db_error) { - LOG("CustomerService",("JediUnlockedSlot:Player %s SwapUnlockedSlot with %s request FAILED - internal db error", swapUnlockedSlotRsp.getValue().first.second.getValueString().c_str(), swapUnlockedSlotRsp.getValue().second.second.first.getValueString().c_str())); + LOG("CustomerService", ("JediUnlockedSlot:Player %s SwapUnlockedSlot with %s request FAILED - internal db error", swapUnlockedSlotRsp.getValue().first.second.getValueString().c_str(), swapUnlockedSlotRsp.getValue().second.second.first.getValueString().c_str())); } else if (response == LoginUpgradeAccountMessage::SUSR_account_has_no_unlocked_slot) { - LOG("CustomerService",("JediUnlockedSlot:Player %s SwapUnlockedSlot with %s request FAILED - account doesn't have an unlocked slot", swapUnlockedSlotRsp.getValue().first.second.getValueString().c_str(), swapUnlockedSlotRsp.getValue().second.second.first.getValueString().c_str())); + LOG("CustomerService", ("JediUnlockedSlot:Player %s SwapUnlockedSlot with %s request FAILED - account doesn't have an unlocked slot", swapUnlockedSlotRsp.getValue().first.second.getValueString().c_str(), swapUnlockedSlotRsp.getValue().second.second.first.getValueString().c_str())); } else if (response == LoginUpgradeAccountMessage::SUSR_not_unlocked_slot_character) { - LOG("CustomerService",("JediUnlockedSlot:Player %s SwapUnlockedSlot with %s request FAILED - source character is not an unlocked slot character", swapUnlockedSlotRsp.getValue().first.second.getValueString().c_str(), swapUnlockedSlotRsp.getValue().second.second.first.getValueString().c_str())); + LOG("CustomerService", ("JediUnlockedSlot:Player %s SwapUnlockedSlot with %s request FAILED - source character is not an unlocked slot character", swapUnlockedSlotRsp.getValue().first.second.getValueString().c_str(), swapUnlockedSlotRsp.getValue().second.second.first.getValueString().c_str())); } else if (response == LoginUpgradeAccountMessage::SUSR_invalid_target_character) { - LOG("CustomerService",("JediUnlockedSlot:Player %s SwapUnlockedSlot with %s request FAILED - target character is either not valid, not on the same account, or not on this galaxy", swapUnlockedSlotRsp.getValue().first.second.getValueString().c_str(), swapUnlockedSlotRsp.getValue().second.second.first.getValueString().c_str())); + LOG("CustomerService", ("JediUnlockedSlot:Player %s SwapUnlockedSlot with %s request FAILED - target character is either not valid, not on the same account, or not on this galaxy", swapUnlockedSlotRsp.getValue().first.second.getValueString().c_str(), swapUnlockedSlotRsp.getValue().second.second.first.getValueString().c_str())); } else if (response == LoginUpgradeAccountMessage::SUSR_target_character_already_unlocked_slot_character) { - LOG("CustomerService",("JediUnlockedSlot:Player %s SwapUnlockedSlot with %s request FAILED - target character is already an unlocked slot character", swapUnlockedSlotRsp.getValue().first.second.getValueString().c_str(), swapUnlockedSlotRsp.getValue().second.second.first.getValueString().c_str())); + LOG("CustomerService", ("JediUnlockedSlot:Player %s SwapUnlockedSlot with %s request FAILED - target character is already an unlocked slot character", swapUnlockedSlotRsp.getValue().first.second.getValueString().c_str(), swapUnlockedSlotRsp.getValue().second.second.first.getValueString().c_str())); } else { - LOG("CustomerService",("JediUnlockedSlot:Player %s SwapUnlockedSlot with %s request FAILED - unknown result code (%d)", swapUnlockedSlotRsp.getValue().first.second.getValueString().c_str(), swapUnlockedSlotRsp.getValue().second.second.first.getValueString().c_str(), swapUnlockedSlotRsp.getValue().first.first)); + LOG("CustomerService", ("JediUnlockedSlot:Player %s SwapUnlockedSlot with %s request FAILED - unknown result code (%d)", swapUnlockedSlotRsp.getValue().first.second.getValueString().c_str(), swapUnlockedSlotRsp.getValue().second.second.first.getValueString().c_str(), swapUnlockedSlotRsp.getValue().first.first)); } GameServerConnection * gs = getGameServer(swapUnlockedSlotRsp.getValue().second.first); @@ -2466,7 +2451,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons if (gs) gs->send(msg, true); } - else if(ClusterWideDataManagerList::handleMessage(source, message)) + else if (ClusterWideDataManagerList::handleMessage(source, message)) { // nothing else to do with the message since it was // handled by the Cluster wide data manager @@ -2480,13 +2465,13 @@ void CentralServer::removeConnectionServerConnection(const ConnectionServerConne if (conn) { startConnectionServer(conn->getConnectionServerNumber(), - conn->getGameServiceAddress(), - conn->getClientServicePortPublic(), - conn->getClientServicePortPrivate(), true, - ConfigCentralServer::getConnectionServerRestartDelayTimeSeconds()); + conn->getGameServiceAddress(), + conn->getClientServicePortPublic(), + conn->getClientServicePortPrivate(), true, + ConfigCentralServer::getConnectionServerRestartDelayTimeSeconds()); ConnectionServerConnectionList::iterator i = m_connectionServerConnections.begin(); - for(;i != m_connectionServerConnections.end();++i) + for (; i != m_connectionServerConnections.end(); ++i) { if (conn->getId() == (*i)->getId()) { @@ -2495,7 +2480,6 @@ void CentralServer::removeConnectionServerConnection(const ConnectionServerConne IGNORE_RETURN(m_connectionServerConnections.erase(i)); return; } - } // Clean up all the account info for the connection @@ -2560,7 +2544,7 @@ void CentralServer::removeGameServer(GameServerConnection const *gameServer) ExcommunicateGameServerMessage const excommunicateMessage(pid, 0, ""); sendToAllGameServersExceptDBProcess(excommunicateMessage, true); } - else + else { DEBUG_WARNING(true, ("A game server crashed but our process ID ptr is nullptr.")); } @@ -2579,7 +2563,7 @@ void CentralServer::run(void) { SetupSharedLog::install("CentralServer"); SetupSharedUtility::Data utilityData; - SetupSharedUtility::install (utilityData); + SetupSharedUtility::install(utilityData); SetupServerUtility::install(); gs_connectionServersPublic = ConfigCentralServer::getStartPublic(); @@ -2613,7 +2597,6 @@ void CentralServer::run(void) setup.port = ConfigCentralServer::getConnectionServicePort(); setup.bindInterface = ConfigCentralServer::getConnectionServiceBindInterface(); Service * cons = new Service(ConnectionAllocator(), setup); - NOT_NULL(cons); cserver.m_connService = cons; setup.port = ConfigCentralServer::getConsoleServicePort(); @@ -2623,7 +2606,7 @@ void CentralServer::run(void) setup.port = ConfigCentralServer::getCommodityServerServicePort(); setup.bindInterface = ConfigCentralServer::getCommodityServerServiceBindInterface(); s_commodityServerService = new Service(ConnectionAllocator(), setup); - + setup.port = ConfigCentralServer::getLoginServicePort(); if (ConfigCentralServer::getDevelopmentMode()) cserver.connectToLoginServer(); @@ -2635,33 +2618,33 @@ void CentralServer::run(void) // connect to the task manager cserver.m_taskManager = new TaskConnection("127.0.0.1", ConfigCentralServer::getTaskManagerPort()); - + unsigned long startTime = Clock::timeMs(); - unsigned long nextLoadingLogTime=0; - unsigned long nextPingTime=0; + unsigned long nextLoadingLogTime = 0; + unsigned long nextPingTime = 0; unsigned long nextPopulationLogTime = 0; - LOG("ServerStartup",("CentralServer starting")); + LOG("ServerStartup", ("CentralServer starting")); #ifndef WIN32 - if( FileExists( ".shutdown") ) + if (FileExists(".shutdown")) { LOG("CentralServer", ("Removing stale .shutdown file.")); - IGNORE_RETURN(::remove( ".shutdown" )); + IGNORE_RETURN(::remove(".shutdown")); } - if( FileExists( ".abortshutdown" ) ) + if (FileExists(".abortshutdown")) { LOG("CentralServer", ("Removing stale .abortshutdown file.")); - IGNORE_RETURN(::remove( ".abortshutdown" )); + IGNORE_RETURN(::remove(".abortshutdown")); } - if( FileExists( ".startanymissingplanet") ) + if (FileExists(".startanymissingplanet")) { LOG("CentralServer", ("Removing stale .startanymissingplanet file.")); - IGNORE_RETURN(::remove( ".startanymissingplanet" )); + IGNORE_RETURN(::remove(".startanymissingplanet")); } - if( FileExists( ".startanymissinggameserver") ) + if (FileExists(".startanymissinggameserver")) { LOG("CentralServer", ("Removing stale .startanymissinggameserver file.")); - IGNORE_RETURN(::remove( ".startanymissinggameserver" )); + IGNORE_RETURN(::remove(".startanymissinggameserver")); } #endif @@ -2669,10 +2652,8 @@ void CentralServer::run(void) { unsigned long lastFrameTime = 0; unsigned long frameStartTime = Clock::timeMs(); - - PROFILER_AUTO_BLOCK_DEFINE("main loop"); - bool barrierReached = true; + PROFILER_AUTO_BLOCK_DEFINE("main loop"); do { @@ -2698,8 +2679,7 @@ void CentralServer::run(void) PROFILER_AUTO_BLOCK_DEFINE("Os::sleep"); Os::sleep(1); } - - } while (!barrierReached && !cserver.m_done); + } while (!cserver.m_done); //@todo Central needs to run a clock so we can schedule re-tries with the login server. { @@ -2720,12 +2700,12 @@ void CentralServer::run(void) if (curTime > nextLoadingLogTime) { nextLoadingLogTime = curTime + 10000; - for (std::set::const_iterator i=getInstance().m_planetsWaitingForPreload.begin(); i!=getInstance().m_planetsWaitingForPreload.end(); ++i) - LOG("Preload",("Waiting for planet %s",i->c_str())); + for (std::set::const_iterator i = getInstance().m_planetsWaitingForPreload.begin(); i != getInstance().m_planetsWaitingForPreload.end(); ++i) + LOG("Preload", ("Waiting for planet %s", i->c_str())); } //Perodically ping all the servers - if (ConfigCentralServer::getServerPingTimeout() != 0 && static_cast(curTime-nextPingTime) > 0) + if (ConfigCentralServer::getServerPingTimeout() != 0 && static_cast(curTime - nextPingTime) > 0) { nextPingTime = curTime + static_cast(ConfigCentralServer::getServerPingTimeout() * 1000); getInstance().doServerPings(); @@ -2739,24 +2719,21 @@ void CentralServer::run(void) } } - - - ServerClock::getInstance().incrementServerFrame(); - if(ConfigCentralServer::getShutdown()) + if (ConfigCentralServer::getShutdown()) { cserver.done(); } unsigned long currentTime = Clock::timeMs(); lastFrameTime = currentTime - frameStartTime; - if(lastFrameTime > 1000) + if (lastFrameTime > 1000) { LOG("profile", ("Long loop (%u ms):\n%s", lastFrameTime, PROFILER_GET_LAST_FRAME_DATA())); } } - LOG("ServerStartup",("CentralServer exiting")); + LOG("ServerStartup", ("CentralServer exiting")); SetupSharedLog::remove(); CentralServer::remove(); @@ -2773,7 +2750,7 @@ void CentralServer::update() static int shutdownCheckLoopCount = 0; m_curTime = static_cast(time(0)); - + // Tell the LoginServers if necessary if ((++loopCount > ConfigCentralServer::getUpdatePlayerCountFrequency())) { @@ -2783,13 +2760,12 @@ void CentralServer::update() sendPopulationUpdateToLoginServer(); } - // update the webAPI if specified int webUpdateIntervalSeconds = ConfigCentralServer::getWebUpdateIntervalSeconds(); - std::string updateURL = std::string(ConfigCentralServer::getMetricsDataURL()); + std::string updateURL = std::string(ConfigCentralServer::getMetricsDataURL()); // assuming that every 5th frame is ~1 second, we can multiply and then check - if ( !(updateURL.empty()) && webUpdateIntervalSeconds && (++apiLoopCount > (webUpdateIntervalSeconds*1000)) ) + if (!(updateURL.empty()) && webUpdateIntervalSeconds && (++apiLoopCount > (webUpdateIntervalSeconds * 1000))) { apiLoopCount = 0; @@ -2797,31 +2773,31 @@ void CentralServer::update() sendMetricsToWebAPI(updateURL); } - if ( ConfigCentralServer::getAuctionEnabled() ) // allow auctions? + if (ConfigCentralServer::getAuctionEnabled()) // allow auctions? { - if ( m_pAuctionTransferClient == nullptr ) + if (m_pAuctionTransferClient == nullptr) { - const char* hostName[1] = { ConfigCentralServer::getAuctionServer() }; - const short port[1] = { (short)ConfigCentralServer::getAuctionPort() }; + const char* hostName[1] = { ConfigCentralServer::getAuctionServer() }; + const short port[1] = { (short)ConfigCentralServer::getAuctionPort() }; - std::string s_id = ConfigCentralServer::getAuctionIDPrefix(); - s_id += ConfigCentralServer::getClusterName(); + std::string s_id = ConfigCentralServer::getAuctionIDPrefix(); + s_id += ConfigCentralServer::getClusterName(); - const char *identifier[1]; - identifier[ 0 ] = s_id.c_str(); + const char *identifier[1]; + identifier[0] = s_id.c_str(); - m_pAuctionTransferClient = new AuctionTransferClient( hostName, port, 1, identifier, 1 ); + m_pAuctionTransferClient = new AuctionTransferClient(hostName, port, 1, identifier, 1); } m_pAuctionTransferClient->process(); - } - else if ( m_pAuctionTransferClient ) + } + else if (m_pAuctionTransferClient) { - delete( m_pAuctionTransferClient ); + delete(m_pAuctionTransferClient); m_pAuctionTransferClient = 0; } // check every 5th frame (one second roughly?) - if ( ++shutdownCheckLoopCount > 5 ) + if (++shutdownCheckLoopCount > 5) { shutdownCheckLoopCount = 0; @@ -2836,35 +2812,34 @@ void CentralServer::update() void CentralServer::sendPopulationUpdateToLoginServer() { // Add up all the population totals (these are referenced by the metrics data) - m_totalPlayerCount = 0; - m_totalFreeTrialCount = 0; - m_totalEmptySceneCount = 0; + m_totalPlayerCount = 0; + m_totalFreeTrialCount = 0; + m_totalEmptySceneCount = 0; m_totalTutorialSceneCount = 0; - m_totalFalconSceneCount = 0; + m_totalFalconSceneCount = 0; - ConnectionServerConnectionList::const_iterator i; - for (i=m_connectionServerConnections.begin(); i!=m_connectionServerConnections.end(); ++i) + for (i = m_connectionServerConnections.begin(); i != m_connectionServerConnections.end(); ++i) { if (*i) { - m_totalPlayerCount += (**i).getPlayerCount(); - m_totalFreeTrialCount += (**i).getFreeTrialCount(); - m_totalEmptySceneCount += (**i).getEmptySceneCount(); + m_totalPlayerCount += (**i).getPlayerCount(); + m_totalFreeTrialCount += (**i).getFreeTrialCount(); + m_totalEmptySceneCount += (**i).getEmptySceneCount(); m_totalTutorialSceneCount += (**i).getTutorialSceneCount(); - m_totalFalconSceneCount += (**i).getFalconSceneCount(); + m_totalFalconSceneCount += (**i).getFalconSceneCount(); } } - bool loadedRecently=false; - if (!isPreloadFinished() || (time(0)-m_lastLoadingStateTime < static_cast(ConfigCentralServer::getRecentLoadingStateSeconds()))) - loadedRecently=true; + bool loadedRecently = false; + if (!isPreloadFinished() || (time(0) - m_lastLoadingStateTime < static_cast(ConfigCentralServer::getRecentLoadingStateSeconds()))) + loadedRecently = true; UpdatePlayerCountMessage upm(loadedRecently, m_totalPlayerCount, m_totalFreeTrialCount, m_totalEmptySceneCount, m_totalTutorialSceneCount, m_totalFalconSceneCount); sendToAllLoginServers(upm); } -void CentralServer::sendMetricsToWebAPI(std::string updateURL) +void CentralServer::sendMetricsToWebAPI(const std::string &updateURL) { std::ostringstream postBuf; @@ -2878,7 +2853,7 @@ void CentralServer::sendMetricsToWebAPI(std::string updateURL) void CentralServer::sendTaskMessage(const GameNetworkMessage & source) { - if(m_taskManager) + if (m_taskManager) m_taskManager->send(source, true); DEBUG_REPORT_LOG(!m_taskManager, ("There is no task manager connection, but app is attempting to send to one\n")); } @@ -2888,13 +2863,13 @@ void CentralServer::sendTaskMessage(const GameNetworkMessage & source) void CentralServer::sendToGameServer(const uint32 gameServerProcessId, const GameNetworkMessage & message, const bool reliable) const { GameServerConnection * g = getGameServer(gameServerProcessId); - if(g) + if (g) { g->send(message, reliable); } else { - DEBUG_WARNING(true,("Attempted to send to game server %i, without connection.\n",gameServerProcessId)); + DEBUG_WARNING(true, ("Attempted to send to game server %i, without connection.\n", gameServerProcessId)); } } @@ -2902,16 +2877,16 @@ void CentralServer::sendToGameServer(const uint32 gameServerProcessId, const Gam void CentralServer::sendToLoginServer(uint32 loginServerId, const GameNetworkMessage &message) { - LoginServerConnectionMapType::iterator i=m_loginServerConnectionMap.find(loginServerId); - if (i!=m_loginServerConnectionMap.end() && i->second) - i->second->send(message,true); + LoginServerConnectionMapType::iterator i = m_loginServerConnectionMap.find(loginServerId); + if (i != m_loginServerConnectionMap.end() && i->second) + i->second->send(message, true); } // ---------------------------------------------------------------------- void CentralServer::sendToAllGameServers(const GameNetworkMessage & message, const bool reliable) { - for (std::map::const_iterator i = m_gameServerConnections.begin(); i!=m_gameServerConnections.end(); ++i) + for (std::map::const_iterator i = m_gameServerConnections.begin(); i != m_gameServerConnections.end(); ++i) { (*i).second->send(message, reliable); } @@ -2921,7 +2896,7 @@ void CentralServer::sendToAllGameServers(const GameNetworkMessage & message, con void CentralServer::sendToAllGameServersExceptDBProcess(const GameNetworkMessage & message, const bool reliable) { - for (std::map::const_iterator i = m_gameServerConnections.begin(); i!=m_gameServerConnections.end(); ++i) + for (std::map::const_iterator i = m_gameServerConnections.begin(); i != m_gameServerConnections.end(); ++i) { if ((*i).first != getDbProcessServerProcessId()) (*i).second->send(message, reliable); @@ -2957,7 +2932,7 @@ void CentralServer::sendToPlanetServer(const std::string &sceneId, const GameNet // ---------------------------------------------------------------------- -void CentralServer::sendToAllConnectionServers(const GameNetworkMessage & message, const bool reliable, Connection const * exclude /*= nullptr*/) +void CentralServer::sendToAllConnectionServers(const GameNetworkMessage & message, const bool reliable, Connection const * exclude /*= nullptr*/) { // send to all connection servers for (ConnectionServerConnectionList::const_iterator i = m_connectionServerConnections.begin(); i != m_connectionServerConnections.end(); ++i) @@ -2972,13 +2947,13 @@ void CentralServer::sendToAllConnectionServers(const GameNetworkMessage & messag void CentralServer::sendToDBProcess(const GameNetworkMessage & message, const bool reliable) const { GameServerConnection * g = getGameServer(getDbProcessServerProcessId()); - if(g) + if (g) { g->send(message, reliable); } else { - DEBUG_FATAL(!m_done,("Attempted to send message to DBProcess without connection (there should always be a connection to DBProcess).")); + DEBUG_FATAL(!m_done, ("Attempted to send message to DBProcess without connection (there should always be a connection to DBProcess).")); } } @@ -3010,7 +2985,7 @@ void CentralServer::removePlanetServer(const PlanetServerConnection * p) { if ((*i).second == p) { - DEBUG_REPORT_LOG(true,("Central lost connection to Planet Server %s\n",p->getSceneId().c_str())); + DEBUG_REPORT_LOG(true, ("Central lost connection to Planet Server %s\n", p->getSceneId().c_str())); i = m_planetServers.erase(i); if (isPreloadFinished()) @@ -3045,14 +3020,14 @@ void CentralServer::setCommandLine(const std::string & c) const bool getStartLocation(const std::string & name, std::string & planetName, Vector & coordinates, NetworkId & cellId) { - const StartingLocationData * const sld = StartingLocationManager::findLocationByName (name); + const StartingLocationData * const sld = StartingLocationManager::findLocationByName(name); if (sld) { - planetName = sld->planet; + planetName = sld->planet; coordinates.x = sld->x; coordinates.y = sld->y; coordinates.z = sld->z; - cellId = NetworkId (sld->cellId); + cellId = NetworkId(sld->cellId); return true; } @@ -3066,13 +3041,13 @@ void CentralServer::startPlanetServer(const std::string & host, const std::strin { FATAL(sceneId.empty(), ("CentralServer::startPlanetServer: empty sceneId, host='%s'", host.c_str())); std::map, time_t> >::const_iterator f = m_pendingPlanetServers.find(sceneId); - if(f == m_pendingPlanetServers.end()) + if (f == m_pendingPlanetServers.end()) { std::map::const_iterator pf = m_planetServers.find(sceneId); - if(pf == m_planetServers.end()) + if (pf == m_planetServers.end()) { std::string options = "-s PlanetServer centralServerAddress="; - if(m_planetService) + if (m_planetService) { options += m_planetService->getBindAddress(); } @@ -3084,16 +3059,16 @@ void CentralServer::startPlanetServer(const std::string & host, const std::strin options += sceneId; char buffer[20]; - IGNORE_RETURN(_itoa(m_nextPlanetWatcherPort++,buffer,10)); + IGNORE_RETURN(_itoa(m_nextPlanetWatcherPort++, buffer, 10)); options += " watcherServicePort="; options += buffer; static unsigned int portBase = 0; - IGNORE_RETURN(_itoa(portBase,buffer,10)); + IGNORE_RETURN(_itoa(portBase, buffer, 10)); portBase += 100; options += " gameServerDebuggingPortBase="; options += buffer; - + TaskSpawnProcess spawn(host.empty() ? std::string("any") : host, "PlanetServer", options, spawnDelay); CentralServer::getInstance().sendTaskMessage(spawn); m_pendingPlanetServers[sceneId] = std::make_pair(std::make_pair(host, options), ::time(nullptr)); @@ -3105,14 +3080,14 @@ void CentralServer::startPlanetServer(const std::string & host, const std::strin else if (m_timeClusterWentIntoLoadingState <= 0) m_timeClusterWentIntoLoadingState = time(0); - if(getInstance().m_transferServerConnection != nullptr && !preloadFinished) + if (getInstance().m_transferServerConnection != nullptr && !preloadFinished) { getInstance().m_transferServerConnection->disconnect(); getInstance().m_transferServerConnection = 0; s_retryTransferServerConnection = false; } - - if(getInstance().m_stationPlayersCollectorConnection != nullptr && ! isPreloadFinished()) + + if (getInstance().m_stationPlayersCollectorConnection != nullptr && !isPreloadFinished()) { getInstance().m_stationPlayersCollectorConnection->disconnect(); getInstance().m_stationPlayersCollectorConnection = 0; @@ -3134,14 +3109,14 @@ void CentralServer::handleRequestGameServerForLoginMessage(const RequestGameServ static const std::string loginTrace("TRACE_LOGIN"); std::string effectiveScene; - PlayerSceneMapType::iterator i=m_playerSceneMap.find(msg.getCharacterId()); - if (i!=m_playerSceneMap.end()) + PlayerSceneMapType::iterator i = m_playerSceneMap.find(msg.getCharacterId()); + if (i != m_playerSceneMap.end()) { - effectiveScene=i->second.first; + effectiveScene = i->second.first; LOG(loginTrace, ("using sceneId (%s) from memory for character (%s)", effectiveScene.c_str(), msg.getCharacterId().getValueString().c_str())); } else - effectiveScene=msg.getScene(); // only use the DB scene if we don't have more recent information + effectiveScene = msg.getScene(); // only use the DB scene if we don't have more recent information // for CTS, the source character must currently be on one of the 10 original ground planets if (msg.getForCtsSourceCharacter()) @@ -3177,7 +3152,7 @@ void CentralServer::handleRequestGameServerForLoginMessage(const RequestGameServ if (conn) { LOG(loginTrace, ("handling RequestGameServerForLoginMessage(%s)", msg.getCharacterId().getValueString().c_str())); - conn->send(msg,true); + conn->send(msg, true); } else { @@ -3185,12 +3160,12 @@ void CentralServer::handleRequestGameServerForLoginMessage(const RequestGameServ bool allowDynamicStart = ConfigFile::getKeyBool("CentralServer", "startPlanetsDynamically", false); std::map::const_iterator f = ms_sceneToHostMap.find(msg.getScene()); - if(f != ms_sceneToHostMap.end()) + if (f != ms_sceneToHostMap.end()) { isPlanetValid = true; } - if(isPlanetValid || allowDynamicStart) + if (isPlanetValid || allowDynamicStart) { LOG(loginTrace, ("deferring RequestGameServerForLoginMessage(%s)", msg.getCharacterId().getValueString().c_str())); DEBUG_REPORT_LOG(true, ("Starting planet server for login")); @@ -3212,7 +3187,7 @@ void CentralServer::handleRequestSceneTransfer(const RequestSceneTransfer &msg) PlanetServerConnection *conn = PlanetManager::getPlanetServerForScene(msg.getSceneName()); if (conn) { - conn->send(msg,true); + conn->send(msg, true); } else { @@ -3233,13 +3208,13 @@ void CentralServer::handleGameServerForLoginMessage(const GameServerForLoginMess ConnectionServerConnection *conn = getConnectionServerForAccount(msg.getStationId()); if (conn) { - conn->send(msg,true); + conn->send(msg, true); } else { - if(! ConnectionServerConnection::sendToPseudoClientConnection(msg.getStationId(), msg)) + if (!ConnectionServerConnection::sendToPseudoClientConnection(msg.getStationId(), msg)) { - LOG("TRACE_LOGIN", ("Trying to log account %i in, but could not determine which connection server to use.",msg.getStationId())); + LOG("TRACE_LOGIN", ("Trying to log account %i in, but could not determine which connection server to use.", msg.getStationId())); } } } @@ -3248,32 +3223,28 @@ void CentralServer::handleGameServerForLoginMessage(const GameServerForLoginMess void CentralServer::handleExchangeListCreditsMessage(const ExchangeListCreditsMessage &msg) { - LOG("Exchange", ("Central Server got exchange list credits %d.",msg.getCredits())); - if ( m_pAuctionTransferClient == nullptr ) + LOG("Exchange", ("Central Server got exchange list credits %d.", msg.getCredits())); + if (m_pAuctionTransferClient == nullptr) { // send failure packet } //////////////////////m_pAuctionTransferClient->addCoinToAuction( msg ); } - - - - ConnectionServerConnection * CentralServer::getAnyConnectionServer() { ConnectionServerConnection * result = 0; - if(! m_connectionServerConnections.empty()) + if (!m_connectionServerConnections.empty()) { result = *(m_connectionServerConnections.begin()); - if(result) + if (result) { int leastPlayers = result->getPlayerCount(); std::vector::iterator i; - for(i = m_connectionServerConnections.begin(); i != m_connectionServerConnections.end(); ++i) + for (i = m_connectionServerConnections.begin(); i != m_connectionServerConnections.end(); ++i) { - if((*i)->getPlayerCount() < leastPlayers) + if ((*i)->getPlayerCount() < leastPlayers) result = *i; } } @@ -3286,8 +3257,8 @@ ConnectionServerConnection * CentralServer::getAnyConnectionServer() ConnectionServerConnection * CentralServer::getConnectionServerForAccount(StationId suid) { ConnectionServerConnection * result = nullptr; - ConnectionServerSUIDMap::iterator i=m_accountConnectionMap.find(suid); - if (i!=m_accountConnectionMap.end()) + ConnectionServerSUIDMap::iterator i = m_accountConnectionMap.find(suid); + if (i != m_accountConnectionMap.end()) { result = (*i).second; } @@ -3313,8 +3284,8 @@ void CentralServer::addToAccountConnectionMap(StationId suid, ConnectionServerCo void CentralServer::removeFromAccountConnectionMap(StationId suid) { - ConnectionServerSUIDMap::iterator i=m_accountConnectionMap.find(suid); - if (i!=m_accountConnectionMap.end()) + ConnectionServerSUIDMap::iterator i = m_accountConnectionMap.find(suid); + if (i != m_accountConnectionMap.end()) { // Erase the entry m_accountConnectionMap.erase(i++); @@ -3326,11 +3297,11 @@ void CentralServer::removeFromAccountConnectionMap(StationId suid) void CentralServer::removeFromAccountConnectionMap(int connectionServerConnectionId) { ConnectionServerSUIDMap::iterator i; - for(i = m_accountConnectionMap.begin(); i != m_accountConnectionMap.end();) + for (i = m_accountConnectionMap.begin(); i != m_accountConnectionMap.end();) { const ConnectionServerConnection* cconn = (*i).second; - if(cconn && (cconn->getId() == connectionServerConnectionId)) + if (cconn && (cconn->getId() == connectionServerConnectionId)) { // Erase the entry m_accountConnectionMap.erase(i++); @@ -3383,7 +3354,7 @@ void CentralServer::startConnectionServer(int connectionServerNumber, const std: void CentralServer::startConnectionServer(int connectionServerNumber, const std::string& listenAddress, const std::string * publicPort, const std::string * internalPort, const SpawnDelaySeconds spawnDelay) const { UNREF(listenAddress); //once we add dual nic support, we can use this - if(!m_connService) + if (!m_connService) { DEBUG_WARNING(true, ("Could not start connection server because there was no service for it")); return; @@ -3415,7 +3386,7 @@ void CentralServer::startConnectionServer(int connectionServerNumber, const std: std::string options = "-s ConnectionServer clusterName="; options += ConfigCentralServer::getClusterName(); - if(gs_connectionServersPublic) + if (gs_connectionServersPublic) options += " startPublicServer=true"; options += " centralServerAddress="; @@ -3441,7 +3412,7 @@ void CentralServer::startConnectionServer(int connectionServerNumber, const std: options += _itoa(connectionServerNumber, servicePort, 10); DEBUG_REPORT_LOG(true, ("Spawning Connection server with options %s\n", options.c_str())); - TaskSpawnProcess p(s_connectionServerHostList[connectionServerNumber-1], "ConnectionServer", options, spawnDelay); + TaskSpawnProcess p(s_connectionServerHostList[connectionServerNumber - 1], "ConnectionServer", options, spawnDelay); CentralServer::getInstance().sendTaskMessage(p); } @@ -3449,8 +3420,8 @@ void CentralServer::startConnectionServer(int connectionServerNumber, const std: void CentralServer::sendToAllLoginServers(const GameNetworkMessage &message) { - for (LoginServerConnectionMapType::iterator i=m_loginServerConnectionMap.begin(); i!=m_loginServerConnectionMap.end(); ++i) - i->second->send(message,true); + for (LoginServerConnectionMapType::iterator i = m_loginServerConnectionMap.begin(); i != m_loginServerConnectionMap.end(); ++i) + i->second->send(message, true); } // ---------------------------------------------------------------------- @@ -3466,7 +3437,7 @@ uint32 CentralServer::sendToArbitraryLoginServer(const GameNetworkMessage &messa if (!roundRobin) { - i->second->send(message,true); + i->second->send(message, true); return i->second->getProcessId(); } @@ -3476,7 +3447,7 @@ uint32 CentralServer::sendToArbitraryLoginServer(const GameNetworkMessage &messa std::advance(i, nextServer); - i->second->send(message,true); + i->second->send(message, true); return i->second->getProcessId(); } @@ -3512,7 +3483,7 @@ void CentralServer::remove() delete cs.m_connService; delete cs.m_planetService; delete cs.m_loginService; - if(cs.m_taskManager) + if (cs.m_taskManager) { cs.m_taskManager->setDisconnectReason("CentralServer::remove"); cs.m_taskManager->disconnect(); @@ -3527,7 +3498,7 @@ std::vector CentralServer::getGameServers() const { std::vector result; std::map::const_iterator i; - for(i = m_gameServerConnections.begin(); i != m_gameServerConnections.end(); ++i) + for (i = m_gameServerConnections.begin(); i != m_gameServerConnections.end(); ++i) { result.push_back((*i).second); } @@ -3540,7 +3511,7 @@ void CentralServer::sendToConnectionServerForAccount(StationId account, const Ga { ConnectionServerConnection *conn = getConnectionServerForAccount(account); if (conn) - conn->send(message,reliable); + conn->send(message, reliable); } // ---------------------------------------------------------------------- @@ -3550,7 +3521,7 @@ uint32 CentralServer::sendToRandomGameServer(const GameNetworkMessage &message) GameServerConnection *conn = getRandomGameServer(); if (conn) { - conn->send(message,true); + conn->send(message, true); return conn->getProcessId(); } else @@ -3561,10 +3532,10 @@ uint32 CentralServer::sendToRandomGameServer(const GameNetworkMessage &message) void CentralServer::doServerPings() { - for (std::set::iterator i=m_serverPings.begin(); i!=m_serverPings.end(); ++i) + for (std::set::iterator i = m_serverPings.begin(); i != m_serverPings.end(); ++i) { - LOG("CentralServerPings",("Dropping server %lu because it hasn't responded to CentralPingMessage",*i)); - GameServerConnection *conn=getGameServer(*i); + LOG("CentralServerPings", ("Dropping server %lu because it hasn't responded to CentralPingMessage", *i)); + GameServerConnection *conn = getGameServer(*i); if (conn) { // tell task manager to kill the offending process (in case it's hung) @@ -3577,7 +3548,7 @@ void CentralServer::doServerPings() } else { - LOG("CentralServerPings",("Didn't have connection to %lu to drop",*i)); + LOG("CentralServerPings", ("Didn't have connection to %lu to drop", *i)); ExcommunicateGameServerMessage const excommunicateMessage(*i, 0, ""); excommunicateServer(excommunicateMessage); // haven't received a reply (see CentralPingMessage, above) } @@ -3585,13 +3556,13 @@ void CentralServer::doServerPings() m_serverPings.clear(); CentralPingMessage ping; - for (std::map::iterator j=m_gameServerConnections.begin(); j!=m_gameServerConnections.end(); ++j) + for (std::map::iterator j = m_gameServerConnections.begin(); j != m_gameServerConnections.end(); ++j) { if (j->first != getDbProcessServerProcessId()) { - LOG("CentralServerPings",("Pinging %lu",j->first)); + LOG("CentralServerPings", ("Pinging %lu", j->first)); IGNORE_RETURN(m_serverPings.insert(j->first)); - j->second->send(ping,true); + j->second->send(ping, true); } } } @@ -3603,36 +3574,36 @@ void CentralServer::doServerPings() */ void CentralServer::excommunicateServer(const ExcommunicateGameServerMessage & msg) { - sendToAllGameServers(msg,true); - sendToAllPlanetServers(msg,true); - sendToAllConnectionServers(msg,true); + sendToAllGameServers(msg, true); + sendToAllPlanetServers(msg, true); + sendToAllConnectionServers(msg, true); } //----------------------------------------------------------------------- void CentralServer::startShutdownProcess(const uint32 timeToShutdown, const uint32 maxTime, const Unicode::String &systemMessage) { // sanity checking - if ( m_shutdownPhase > 6) + if (m_shutdownPhase > 6) { WARNING("CentralServerShutdown", ("startShutdownProcess: invalid value in CentralServer::m_shutdownPhase. Current value is %d. Resetting.", m_shutdownPhase)); m_shutdownPhase = 0; } // server already in the process of shutting down - if ( m_shutdownPhase > 0 ) + if (m_shutdownPhase > 0) { LOG("CentralServerShutdown", ("startShutdownProcess: Server already in the process of shutting down. Current shutdown phase is %d.", m_shutdownPhase)); return; } - if( timeToShutdown>maxTime ) + if (timeToShutdown > maxTime) { LOG("CentralServerShutdown", ("startShutdownProcess: time to shutdown is greater than max time.")); return; } m_shutdownPhase = 1; - LOG("CentralServerShutdown",("Shutdown Phase %d: Shutdown sequence starting now.", m_shutdownPhase)); - LOG("CentralServerShutdown",("Shutdown Phase %d: time to shutdown=%dsec, max time to wait=%dsec, broadcast warning message=\"%s\".", m_shutdownPhase, timeToShutdown, maxTime, Unicode::wideToNarrow(systemMessage).c_str())); + LOG("CentralServerShutdown", ("Shutdown Phase %d: Shutdown sequence starting now.", m_shutdownPhase)); + LOG("CentralServerShutdown", ("Shutdown Phase %d: time to shutdown=%dsec, max time to wait=%dsec, broadcast warning message=\"%s\".", m_shutdownPhase, timeToShutdown, maxTime, Unicode::wideToNarrow(systemMessage).c_str())); // this is the time in the future that we need to start the shutdown process. m_shutdownTotalTime = m_curTime + timeToShutdown; m_shutdownMaxTime = m_curTime + maxTime; @@ -3648,27 +3619,27 @@ void CentralServer::checkShutdownProcess() static bool warn10 = false; static bool warn0 = false; static uint32 lastWarn = m_curTime; - static uint32 nextAbortCheck = m_curTime+1; - static uint32 nextShutdownCheck = m_curTime+30; + static uint32 nextAbortCheck = m_curTime + 1; + static uint32 nextShutdownCheck = m_curTime + 30; - if( !m_shutdownPhase ) + if (!m_shutdownPhase) { #ifndef WIN32 // check if a .shutdown file exists - if( m_curTime > nextShutdownCheck ) + if (m_curTime > nextShutdownCheck) { nextShutdownCheck = m_curTime + 30; - if( FileExists(".shutdown") ) + if (FileExists(".shutdown")) { StdioFile shutdownFile(".shutdown", "r"); - if(shutdownFile.isOpen()) + if (shutdownFile.isOpen()) { - char destBuffer[64] = {"\0"}; - if(shutdownFile.read(destBuffer, sizeof(destBuffer)) > 0) + char destBuffer[64] = { "\0" }; + if (shutdownFile.read(destBuffer, sizeof(destBuffer)) > 0) { destBuffer[sizeof(destBuffer) - 1] = 0; int shutdownTime = atoi(destBuffer); - if(shutdownTime > 0) + if (shutdownTime > 0) { LOG("CentralServerShutdown", ("Detected a .shutdown file. Initiating shutdown sequence.")); startShutdownProcess(shutdownTime, 7200, Unicode::narrowToWide("The server will be shutting down soon. Please find a safe place to logout.")); @@ -3680,7 +3651,7 @@ void CentralServer::checkShutdownProcess() return; } - if( FileExists( ".startanymissingplanet") ) + if (FileExists(".startanymissingplanet")) { LOG("CentralServer", ("Detected a .startanymissingplanet file. Checking for any planets that are not started, and starting them.")); @@ -3714,18 +3685,18 @@ void CentralServer::checkShutdownProcess() } } - IGNORE_RETURN(::remove( ".startanymissingplanet" )); + IGNORE_RETURN(::remove(".startanymissingplanet")); return; } - if( FileExists( ".startanymissinggameserver") ) + if (FileExists(".startanymissinggameserver")) { LOG("CentralServer", ("Detected a .startanymissinggameserver file. Checking for any game servers that are not started, and starting them.")); const GenericValueTypeMessage startAnyMissingGameServer("SAMGS", 0); sendToAllPlanetServers(startAnyMissingGameServer, true); - IGNORE_RETURN(::remove( ".startanymissinggameserver" )); + IGNORE_RETURN(::remove(".startanymissinggameserver")); return; } } @@ -3734,13 +3705,12 @@ void CentralServer::checkShutdownProcess() } // should we abort? - if( m_curTime > nextAbortCheck ) + if (m_curTime > nextAbortCheck) { #ifndef WIN32 nextAbortCheck = m_curTime + 1; - if( FileExists(".abortshutdown") ) + if (FileExists(".abortshutdown")) { - IGNORE_RETURN(::remove(".abortshutdown")); LOG("CentralServerShutdown", ("Shutdown Phase %d: Detected a .abortshutdown file. Aborting shutdown sequence.", m_shutdownPhase)); abortShutdownProcess(); @@ -3750,94 +3720,91 @@ void CentralServer::checkShutdownProcess() } // Phase 1 is an immediate broadcast to players for the first shutdown warning - if( m_shutdownPhase == 1 ) + if (m_shutdownPhase == 1) { char strTimeLeft[1024]; uint32 timeLeft = m_shutdownTotalTime - m_curTime; - if( timeLeft < 1 ) + if (timeLeft < 1) { strTimeLeft[0] = '\0'; } - else if( timeLeft < 60 ) + else if (timeLeft < 60) { sprintf(strTimeLeft, " ( %lusec left )", timeLeft); } else { - sprintf(strTimeLeft, " ( %lumin left )", timeLeft/60); + sprintf(strTimeLeft, " ( %lumin left )", timeLeft / 60); } - LOG("CentralServerShutdown",("Shutdown Phase %d: Broadcasting first shutdown message to players: \"%s %s\"", m_shutdownPhase, Unicode::wideToNarrow(m_shutdownSystemMessage).c_str(), strTimeLeft)); - ConGenericMessage const msg("game any systemMessage " + Unicode::wideToNarrow(m_shutdownSystemMessage)+strTimeLeft, 0); + LOG("CentralServerShutdown", ("Shutdown Phase %d: Broadcasting first shutdown message to players: \"%s %s\"", m_shutdownPhase, Unicode::wideToNarrow(m_shutdownSystemMessage).c_str(), strTimeLeft)); + ConGenericMessage const msg("game any systemMessage " + Unicode::wideToNarrow(m_shutdownSystemMessage) + strTimeLeft, 0); IGNORE_RETURN(sendToRandomGameServer(msg)); m_shutdownPhase = 2; lastWarn = m_curTime; } // Phase 2 is broadcasting a system message every 60sec while we wait for time to expire - else if( m_shutdownPhase == 2 ) + else if (m_shutdownPhase == 2) { - if( m_curTime >= m_shutdownTotalTime) + if (m_curTime >= m_shutdownTotalTime) { - LOG("CentralServerShutdown",("Shutdown Phase %d: Done broadcasting shutdown warning message to players . Advancing shutdown phase.", m_shutdownPhase)); + LOG("CentralServerShutdown", ("Shutdown Phase %d: Done broadcasting shutdown warning message to players . Advancing shutdown phase.", m_shutdownPhase)); m_shutdownPhase = 3; warn30 = false; warn10 = false; warn0 = false; - - } // broadcast warning message to players every 60sec. - else if( m_curTime >= lastWarn+60 ) + else if (m_curTime >= lastWarn + 60) { char strTimeLeft[1024]; uint32 timeLeft = m_shutdownTotalTime - m_curTime; - if( timeLeft < 1 ) + if (timeLeft < 1) { strTimeLeft[0] = '\0'; } - else if( timeLeft < 60 ) + else if (timeLeft < 60) { sprintf(strTimeLeft, " ( %lusec left)", timeLeft); } else { - sprintf(strTimeLeft, " ( %lumin left)", timeLeft/60); + sprintf(strTimeLeft, " ( %lumin left)", timeLeft / 60); } - LOG("CentralServerShutdown",("Shutdown Phase %d: Broadcasting shutdown message to players: \"%s %s\"", m_shutdownPhase, Unicode::wideToNarrow(m_shutdownSystemMessage).c_str(), strTimeLeft)); - ConGenericMessage const msg("game any systemMessage " + Unicode::wideToNarrow(m_shutdownSystemMessage)+strTimeLeft, 0); + LOG("CentralServerShutdown", ("Shutdown Phase %d: Broadcasting shutdown message to players: \"%s %s\"", m_shutdownPhase, Unicode::wideToNarrow(m_shutdownSystemMessage).c_str(), strTimeLeft)); + ConGenericMessage const msg("game any systemMessage " + Unicode::wideToNarrow(m_shutdownSystemMessage) + strTimeLeft, 0); IGNORE_RETURN(sendToRandomGameServer(msg)); lastWarn = m_curTime; } } // warn the players they are about to be disconnected - else if( m_shutdownPhase == 3 ) + else if (m_shutdownPhase == 3) { - if( m_curTime>=m_shutdownTotalTime && !warn30 ) + if (m_curTime >= m_shutdownTotalTime && !warn30) { - LOG("CentralServerShutdown",("Shutdown Phase %d: Broadcasting 30sec disconnect warning message to players.", m_shutdownPhase)); + LOG("CentralServerShutdown", ("Shutdown Phase %d: Broadcasting 30sec disconnect warning message to players.", m_shutdownPhase)); ConGenericMessage const msg("game any systemMessage You will be disconnected in 30sec so the server can perform a final save before shutting down. Please find a safe place to logout now.", 0); IGNORE_RETURN(sendToRandomGameServer(msg)); warn30 = true; - } - else if( m_curTime >= (m_shutdownTotalTime+20) && !warn10 ) + else if (m_curTime >= (m_shutdownTotalTime + 20) && !warn10) { - LOG("CentralServerShutdown",("Shutdown Phase %d: Broadcasting 10sec disconnect warning message to players.", m_shutdownPhase)); + LOG("CentralServerShutdown", ("Shutdown Phase %d: Broadcasting 10sec disconnect warning message to players.", m_shutdownPhase)); ConGenericMessage const msg("game any systemMessage You will be disconnected in 10sec so the server can perform a final save before shutting down. Please find a safe place to logout now.", 0); IGNORE_RETURN(sendToRandomGameServer(msg)); warn10 = true; } - else if( m_curTime >= (m_shutdownTotalTime+30) && !warn0 ) + else if (m_curTime >= (m_shutdownTotalTime + 30) && !warn0) { - LOG("CentralServerShutdown",("Shutdown Phase %d: Broadcasting final disconnect warning message to players.", m_shutdownPhase)); + LOG("CentralServerShutdown", ("Shutdown Phase %d: Broadcasting final disconnect warning message to players.", m_shutdownPhase)); ConGenericMessage const msg("game any systemMessage You will now be disconnected so the server can perform a final save before shutting down.", 0); IGNORE_RETURN(sendToRandomGameServer(msg)); warn0 = true; } - else if( m_curTime >= (m_shutdownTotalTime+35) ) + else if (m_curTime >= (m_shutdownTotalTime + 35)) { - LOG("CentralServerShutdown",("Shutdown Phase %d: Setting server to private, disconnecting the players and now waiting for next database save cycle to begin.", m_shutdownPhase)); + LOG("CentralServerShutdown", ("Shutdown Phase %d: Setting server to private, disconnecting the players and now waiting for next database save cycle to begin.", m_shutdownPhase)); gs_connectionServersPublic = false; SetConnectionServerPublic const msg(false); sendToAllConnectionServers(msg, true); @@ -3854,32 +3821,32 @@ void CentralServer::checkShutdownProcess() sendToDBProcess(msg3, true); } } - else if( m_shutdownPhase == 4 ) + else if (m_shutdownPhase == 4) { - if( m_shutdownHaveDatabaseSaveStart ) + if (m_shutdownHaveDatabaseSaveStart) { - LOG("CentralServerShutdown",("Shutdown Phase %d: Starting final database save cycle. Advancing shutdown phase.", m_shutdownPhase)); + LOG("CentralServerShutdown", ("Shutdown Phase %d: Starting final database save cycle. Advancing shutdown phase.", m_shutdownPhase)); m_shutdownPhase = 5; } } - else if( m_shutdownPhase == 5 ) + else if (m_shutdownPhase == 5) { // we are done. Shut it down. Shut it down now! - if( m_shutdownHaveDatabaseComplete) + if (m_shutdownHaveDatabaseComplete) { - LOG("CentralServerShutdown",("Shutdown Phase %d: Completed final database save cycle. Advancing shutdown phase.", m_shutdownPhase)); + LOG("CentralServerShutdown", ("Shutdown Phase %d: Completed final database save cycle. Advancing shutdown phase.", m_shutdownPhase)); m_shutdownPhase = 6; - LOG("CentralServerShutdown",("Shutdown Phase %d: Instructing TaskManager to shutdown the cluster without restarting.", m_shutdownPhase)); + LOG("CentralServerShutdown", ("Shutdown Phase %d: Instructing TaskManager to shutdown the cluster without restarting.", m_shutdownPhase)); ConGenericMessage const msg("stop", 0); sendTaskMessage(msg); } } // maximum amount of time to wait has expired. Shut it down now without waiting for anything else. - else if( m_curTime >= m_shutdownMaxTime ) + else if (m_curTime >= m_shutdownMaxTime) { - LOG("CentralServerShutdown",("Shutdown Phase %d: Maximum time has gone by. Forcing a shutdown now.", m_shutdownPhase)); + LOG("CentralServerShutdown", ("Shutdown Phase %d: Maximum time has gone by. Forcing a shutdown now.", m_shutdownPhase)); m_shutdownPhase = 6; - LOG("CentralServerShutdown",("Shutdown Phase %d: Instructing TaskManager to shutdown the cluster without restarting.", m_shutdownPhase)); + LOG("CentralServerShutdown", ("Shutdown Phase %d: Instructing TaskManager to shutdown the cluster without restarting.", m_shutdownPhase)); ConGenericMessage const msg("stop", 0); sendTaskMessage(msg); } @@ -3888,7 +3855,7 @@ void CentralServer::checkShutdownProcess() void CentralServer::abortShutdownProcess() { LOG("CentralServerShutdown", ("Shutdown Phase %d: Aborting shutdown sequence.", m_shutdownPhase)); - if( m_shutdownPhase > 0 ) + if (m_shutdownPhase > 0) { ConGenericMessage const msg("game any systemMessage The server shutdown has been aborted. The server is no longer shutting down.", 0); IGNORE_RETURN(sendToRandomGameServer(msg)); @@ -3910,7 +3877,7 @@ void CentralServer::abortShutdownProcess() void CentralServer::sendToTransferServer(const GameNetworkMessage & msg) const { - if(getInstance().m_transferServerConnection) + if (getInstance().m_transferServerConnection) { getInstance().m_transferServerConnection->send(msg, true); } @@ -3922,7 +3889,7 @@ void CentralServer::sendToTransferServer(const GameNetworkMessage & msg) const void CentralServer::sendToStationPlayersCollector(const GameNetworkMessage & msg) const { - if(getInstance().m_stationPlayersCollectorConnection) + if (getInstance().m_stationPlayersCollectorConnection) { getInstance().m_stationPlayersCollectorConnection->send(msg, true); } @@ -4026,7 +3993,7 @@ std::pair > const *, std::map getGameServers() const; time_t getLastTimeSystemTimeMismatchNotification() const; @@ -172,24 +172,23 @@ public: void removeFromAccountConnectionMap(StationId suid); private: - void handleRequestGameServerForLoginMessage (const RequestGameServerForLoginMessage & msg); - void handleRequestSceneTransfer (const RequestSceneTransfer & msg); - void handleGameServerForLoginMessage (const GameServerForLoginMessage & msg); + void handleRequestGameServerForLoginMessage(const RequestGameServerForLoginMessage & msg); + void handleRequestSceneTransfer(const RequestSceneTransfer & msg); + void handleGameServerForLoginMessage(const GameServerForLoginMessage & msg); + void handleExchangeListCreditsMessage(const ExchangeListCreditsMessage& msg); - void handleExchangeListCreditsMessage (const ExchangeListCreditsMessage& msg); - - size_t getGameServerCount (void) const; + size_t getGameServerCount(void) const; void update(); void sendPopulationUpdateToLoginServer(); - void sendMetricsToWebAPI(std::string updateURL); + void sendMetricsToWebAPI(const std::string &updateURL); ConnectionServerConnection * getConnectionServerForAccount(StationId suid); void addToAccountConnectionMap(StationId suid, ConnectionServerConnection * cconn, uint32 subscriptionBits); void removeFromAccountConnectionMap(int connectionServerConnectionId); void doServerPings(); void excommunicateServer(const ExcommunicateGameServerMessage &); -protected: +protected: friend class Singleton; CentralServer(); @@ -205,11 +204,11 @@ private: SceneGameMap m_gameServers; ConnectionServerSUIDMap m_accountConnectionMap; -// Network::Address clientService; - /** - The dbProcessServerProcessId is set by the DBProcess. The central server - refers to this process if there are no matching objects in any of its maps. - */ + // Network::Address clientService; + /** + The dbProcessServerProcessId is set by the DBProcess. The central server + refers to this process if there are no matching objects in any of its maps. + */ uint32 m_dbProcessServerProcessId; bool m_done; Service * m_gameService; @@ -330,7 +329,7 @@ inline int CentralServer::getNumConnectionServers() const inline int CentralServer::getNumDatabaseServers() const { GameServerConnection * g = getGameServer(getDbProcessServerProcessId()); - if(g) + if (g) { return 1; } diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserServer.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserServer.cpp index 4ae847c2..6fe053e7 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserServer.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserServer.cpp @@ -116,7 +116,7 @@ static const CommandParser::CmdInfo cmds[] = {ms_testStructurePlacement, 1, "